[
  {
    "path": ".gitignore",
    "content": "# Xcode\n#\n# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore\n\n## Build generated\nbuild/\nDerivedData/\n\n## Various settings\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata/\n\n## Other\n*.moved-aside\n*.xccheckout\n*.xcscmblueprint\n\n## Obj-C/Swift specific\n*.hmap\n*.ipa\n*.dSYM.zip\n*.dSYM\n\n## Playgrounds\ntimeline.xctimeline\nplayground.xcworkspace\n\n# Swift Package Manager\n#\n# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.\n# Packages/\n# Package.pins\n# Package.resolved\n.build/\n\n# CocoaPods\n#\n# We recommend against adding the Pods directory to your .gitignore. However\n# you should judge for yourself, the pros and cons are mentioned at:\n# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control\n#\n# Pods/\n#\n# Add this line if you want to avoid checking in source code from the Xcode workspace\n# *.xcworkspace\n\n# Carthage\n#\n# Add this line if you want to avoid checking in source code from Carthage dependencies.\n# Carthage/Checkouts\n\nCarthage/Build\n\n# fastlane\n#\n# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the\n# screenshots whenever they are needed.\n# For more information about the recommended setup visit:\n# https://docs.fastlane.tools/best-practices/source-control/#source-control\n\nfastlane/report.xml\nfastlane/Preview.html\nfastlane/screenshots/**/*.png\nfastlane/test_output\n\n# Code Injection\n#\n# After new code Injection tools there's a generated folder /iOSInjectionProject\n# https://github.com/johnno1962/injectionforxcode\n\niOSInjectionProject/\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"size\" : \"20x20\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Notification@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"20x20\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Notification@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Small.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Small@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Small@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"40x40\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Small-40@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"40x40\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Small-40@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"60x60\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-60@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"60x60\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-60@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"1024x1024\",\n      \"idiom\" : \"ios-marketing\",\n      \"filename\" : \"Icon-60@2xstore_1024pt.png\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/MessageVideoDownload.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"MessageVideoDownload@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"MessageVideoDownload@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/MessageVideoPlay.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"MessageVideoPlay@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"MessageVideoPlay@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/ReceiverImageNodeBorder.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ReceiverImageNodeBorder@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ReceiverImageNodeBorder@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/ic_avatar_placeholder.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_avatar_placeholder.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_avatar_placeholder@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_avatar_placeholder@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/ic_group_placeholder.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_group_placeholder.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_group_placeholder@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_group_placeholder@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/ic_msg_forward_n.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_msg_forward_n@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_msg_forward_n@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/ic_msg_forward_s.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_msg_forward_s@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_msg_forward_s@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_receiver_background_highlight.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_receiver_background_highlight@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_receiver_background_highlight@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_receiver_background_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_receiver_background_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_receiver_background_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_receiver_background_reversed.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_receiver_background_reversed@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_receiver_background_reversed@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_sender_background_highlight.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_sender_background_highlight@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_sender_background_highlight@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_sender_background_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_sender_background_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_sender_background_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_sender_background_reversed.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_sender_background_reversed@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_sender_background_reversed@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_receiver_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_receiver_playing_1.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_playing_1@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_playing_1@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_receiver_playing_2.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_playing_2@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_playing_2@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_receiver_playing_3.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_playing_3@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_receiver_playing_3@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_sender_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_sender_playing_1.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_playing_1@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_playing_1@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_sender_playing_2.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_playing_2@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_playing_2@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/message_voice_sender_playing_3.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_playing_3@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"message_voice_sender_playing_3@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/play_btn_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"play_btn_normal.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/play_btn_pressed.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"play_btn_pressed.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/player_back_button.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"player_back_button@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"player_back_button@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/ChatView/player_suspend_button.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"player_suspend_button@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"player_suspend_button@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Common/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Common/ic_list_selection.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"ic_list_selection@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"ic_list_selection@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Common/ic_placeholder.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"ic_placeholder@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"ic_placeholder@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/LaunchImage.launchimage/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"extent\" : \"full-screen\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"2436h\",\n      \"filename\" : \"LaunchImage(1125*2436).png\",\n      \"minimum-system-version\" : \"11.0\",\n      \"orientation\" : \"portrait\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"extent\" : \"full-screen\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"736h\",\n      \"filename\" : \"LaunchImage(1242*2208).png\",\n      \"minimum-system-version\" : \"8.0\",\n      \"orientation\" : \"portrait\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"extent\" : \"full-screen\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"667h\",\n      \"filename\" : \"LaunchImage(750*1334).png\",\n      \"minimum-system-version\" : \"8.0\",\n      \"orientation\" : \"portrait\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"LaunchImage(640*960)-1.png\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"extent\" : \"full-screen\",\n      \"idiom\" : \"iphone\",\n      \"subtype\" : \"retina4\",\n      \"filename\" : \"LaunchImage(640*1136)-1.png\",\n      \"minimum-system-version\" : \"7.0\",\n      \"orientation\" : \"portrait\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"LaunchImage(768*1024)-1.png\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"LaunchImage(768*1024)@2x-1.png\",\n      \"extent\" : \"full-screen\",\n      \"minimum-system-version\" : \"7.0\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Launch(320*480).png\",\n      \"extent\" : \"full-screen\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"LaunchImage(640*960).png\",\n      \"extent\" : \"full-screen\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"orientation\" : \"portrait\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"LaunchImage(640*1136).png\",\n      \"extent\" : \"full-screen\",\n      \"subtype\" : \"retina4\",\n      \"scale\" : \"2x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Mine/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Mine/icon_arrow_right.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"icon_arrow_right@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"icon_arrow_right@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/ic_album_reflash.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"ic_album_reflash@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/ic_comment_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"ic_comment_normal@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"ic_comment_normal@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/ic_comment_selected.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"ic_comment_selected@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"ic_comment_selected@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/ic_star_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"ic_star_normal@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"ic_star_normal@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/ic_star_selected.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"ic_star_selected@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"ic_star_selected@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/nav_camera_black.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"filename\" : \"nav_camera_black.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Moments/nav_camera_white.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"filename\" : \"nav_camera_white.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Nav/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Nav/icon_more_add.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"icon_more_add@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"icon_more_add@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Nav/nav_back_black.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"nav_back_black@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"nav_back_black@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/Nav/nav_back_white.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"filename\" : \"nav_back_white@2x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"filename\" : \"nav_back_white@3x.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar01_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar01_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar01_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar01_selected.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar01_selected@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar01_selected@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar02_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar02_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar02_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar02_selected.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar02_selected@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar02_selected@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar03_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar03_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar03_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar03_selected.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar03_selected@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar03_selected@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar04_normal.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar04_normal@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar04_normal@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Assets.xcassets/TabBar/ic_tabbar04_selected.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar04_selected@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"ic_tabbar04_selected@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/AppDelegate/AppDelegate+Utils.swift",
    "content": "//\n//  AppDelegate+Utils.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport Reachability\nimport IQKeyboardManagerSwift\nimport SnapKit\nimport Localize_Swift\nimport RxSwift\nimport RxCocoa\nimport NSObject_Rx\nimport SwifterSwift\nimport RxTheme\nimport WidgetKit\n\nextension AppDelegate {\n    \n    // MARK: - NetworkStatusListener\n    // 开始网络连接状态监听\n    func networkStatusListener() {\n        // 1.设置网络状态消息监听\n        // 2.获得网络Reachability对象\n        NotificationCenter.default.addObserver(self, selector: #selector(reachabilityChanged(note:)), name: .reachabilityChanged, object: reachability)\n        do {\n            // 3.开启网络状态消息监听\n            try reachability.startNotifier()\n        }catch {\n            print(\"could not start reachability notifier\")\n        }\n    }\n    \n    @objc func reachabilityChanged(note: NSNotification) {\n        // 4.准备获取网络连接信息\n        let curReachability = note.object as! Reachability\n        // 5.判断网络连接状态A\n        switch curReachability.connection {\n        case .wifi:\n            printLog(\"Reachable via WiFi\")\n        case .cellular:\n            printLog(\"Reachable via Cellular\")\n        case .none:\n            printLog(\"Network not reachable\")\n            showReachability(\"当前网络已断开\".rLocalized())\n        case .unavailable:\n            printLog(\"Network not unavailable\")\n            showReachability(\"当前网络已断开\".rLocalized())\n        }\n    }\n    \n    func showReachability(_ message: String) {\n        MBHUD.showImageError(message)\n    }\n    \n    // MARK: - AppearanceSetting\n    func appearanceSetting() {\n        // iOS 11 及其以上系统运行\n        if #available(iOS 11, *) {\n            UIScrollView.appearance().contentInsetAdjustmentBehavior = .never\n            UITableView.appearance().contentInsetAdjustmentBehavior = .never\n            UICollectionView.appearance().contentInsetAdjustmentBehavior = .never\n        }\n    }\n    \n    // MARK: - 设置窗口根控制器\n    func setupViewController() {\n        window = UIWindow(frame: UIScreen.main.bounds)\n        window?.backgroundColor = UIColor.white\n        \n        let tabBar = FYBaseTabBarController()\n        AppDelegate.app.window?.rootViewController = tabBar\n        AppDelegate.app.window?.makeKeyAndVisible()\n    }\n    \n    // MARK: - 键盘管理\n    func keyboardManager() {\n        //开启键盘监听\n        IQKeyboardManager.shared.enable = true\n        //控制点击背景是否收起键盘\n        IQKeyboardManager.shared.shouldResignOnTouchOutside = true\n        //控制键盘上的工具条文字颜色是否用户自定义\n        IQKeyboardManager.shared.shouldToolbarUsesTextFieldTintColor = true\n        //IQKeyboardManager.sharedManager().shouldToolbarUsesTextFieldTintColor = true\n        //将右边Done改成完成\n        //IQKeyboardManager.shared.toolbarDoneBarButtonItemText = \"完成\"\n        // 控制是否显示键盘上的工具条\n        IQKeyboardManager.shared.enableAutoToolbar = true\n        //最新版的设置键盘的returnKey的关键字 ,可以点击键盘上的next键，自动跳转到下一个输入框，最后一个输入框点击完成，自动收起键盘\n        IQKeyboardManager.shared.toolbarManageBehaviour = .byPosition\n    }\n    \n    func configTheme() {\n        // 上次所选主题\n        if (lastThemeMode == .system) {\n            if #available(iOS 13.0, *) {\n                // iOS13可跟随系统\n                if UITraitCollection.current.userInterfaceStyle == .dark {\n                    print(\"System Dark mode\")\n                    themeService.switch(.dark)\n                }else {\n                    print(\"System Light mode\")\n                    themeService.switch(.light)\n                }\n            }\n        }else {\n            // 自行选择的\n            switch lastThemeMode {\n            case .light:\n                themeService.switch(.light)\n            default:\n                themeService.switch(.dark)\n            }\n        }\n    }\n    \n    // 刷新Widget数据\n    func reloadWidgetData() {\n        \n        if #available(iOS 14.0, *) {\n            WidgetCenter.shared.reloadAllTimelines()\n            WidgetCenter.shared.reloadTimelines(ofKind: \"JetChatWidget\")\n        } else {\n            // Fallback on earlier versions\n        }\n    }\n    \n    // FPS\n    func setupFPSStatus() {\n#if DEBUG\n        UIApplication.shared.keyWindow?.addSubview(fpsLabel)\n#endif\n    }\n    \n    func appInitializes() {\n        configTheme()\n        keyboardManager()\n        appearanceSetting()\n        networkStatusListener()\n        LanguageManager.manager.initConfig()\n        // 刷新Widget组件数据\n        reloadWidgetData()\n    }\n}\n\n\nextension AppDelegate {\n    \n    /// 获取window当前导航控制器\n    public var currentViewController: UIViewController? {\n        get {\n            guard UIApplication.shared.keyWindow?.rootViewController != nil else {\n                return nil\n            }\n            \n            if let nav = UIApplication.shared.keyWindow?.rootViewController as? UINavigationController {\n                return nav\n            }\n            if let tab = UIApplication.shared.keyWindow?.rootViewController as? UITabBarController {\n                return tab\n            }\n            if let rootVC = UIApplication.shared.keyWindow?.rootViewController {\n                return rootVC\n            }\n            \n            return nil\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/AppDelegate/AppDelegate+Wcdb.swift",
    "content": "//\n//  AppDelegate+Wcdb.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/9.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport WCDBSwift\n\nextension AppDelegate {\n    \n    /// 创建数据库-表\n    func createWcdbTable()\n    {\n        WCDataBaseManager.shared.createTable(table: kTABLE.chat, of: FYMessageChatModel.self)\n        WCDataBaseManager.shared.createTable(table: kTABLE.message, of: FYMessageItem.self)\n        WCDataBaseManager.shared.createTable(table: kTABLE.session, of: FYMessageItem.self)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/AppDelegate/AppDelegate.swift",
    "content": "//\n//  AppDelegate.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/27.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport Reachability\nimport WCDBSwift\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    /// 单利\n    static let app: AppDelegate = (UIApplication.shared.delegate as? AppDelegate)!\n    \n    let reachability = try! Reachability.init()\n    \n    var window: UIWindow?\n\n    var lastThemeMode: FYThemeMode {\n        return FYThemeCenter.shared.currentTheme\n    }\n    \n    /// fps\n    public lazy var fpsLabel: FPSLabel = {\n        let label = FPSLabel(frame: CGRect.init(x: kScreenW - 80, y: (kScreenH - 30)/2, width: 70, height: 30))\n        label.backgroundColor = .red\n        label.textColor = .white\n        return label\n    }()\n    \n    /// 毛玻璃\n    fileprivate lazy var visualEffectView: UIVisualEffectView = {\n        let blurEffect = UIBlurEffect.init(style: lastThemeMode == .dark ? .dark : .light)\n        let vi = UIVisualEffectView(effect: blurEffect)\n        vi.frame = UIScreen.main.bounds\n        vi.alpha = 0\n        return vi\n    }()\n    \n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n        // app initialize\n        appInitializes()\n        // init rootViewController\n        setupViewController()\n        // create db table\n        createWcdbTable()\n        // FPS\n        setupFPSStatus()\n        \n        return true\n    }\n\n    // 快要进入前台\n    func applicationWillResignActive(_ application: UIApplication) {\n        reloadWidgetData()\n    }\n    \n    // 已经退到后台\n    func applicationDidEnterBackground(_ application: UIApplication) {\n        reloadWidgetData()\n    }\n\n    func applicationWillEnterForeground(_ application: UIApplication) {\n        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.\n    }\n\n    // 已经进入到前台\n    func applicationDidBecomeActive(_ application: UIApplication) {\n        reloadWidgetData()\n    }\n\n    func applicationWillTerminate(_ application: UIApplication) {\n        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.\n    }\n    \n    // 接收Widget点击交互\n    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {\n        if url.absoluteURL.absoluteString.contains(\"chatId\") {\n            let urlString = url.absoluteURL.absoluteString\n            let chatObjc = urlString.components(separatedBy:\"=\")\n            if let chatId = chatObjc.last {\n                printLog(\"Widget safe chatId === \\(chatId)\")\n                openWidgetChat(chatId: chatId.int ?? -1)\n            }\n        }\n        \n        return true\n    }\n    \n    // MARK: - Widget\n    \n    private func openWidgetChat(chatId: Int) {\n        guard chatId > 0 else { return }\n        \n        let chatModel = FYDBQueryHelper.shared.qureyFromChatId(chatId)\n        let chatVc = FYChatBaseViewController(chatModel: chatModel)\n        \n        if let tabbar = AppDelegate.app.window?.rootViewController as? UITabBarController {\n            if let nav = tabbar.viewControllers?[tabbar.selectedIndex] as? UINavigationController {\n                nav.pushViewController(chatVc, animated: false)\n            }\n        }\n    }\n    \n    // MARK: - VisualEffect\n    \n    private func addWindowVisualEffect() {\n        \n        UIApplication.shared.keyWindow?.addSubview(self.visualEffectView)\n        UIView.animate(withDuration: 0.5) {\n            self.visualEffectView.alpha = 1\n        }\n    }\n    \n    private func removeWindowVisualEffect() {\n        \n        if !visualEffectView.isEqual(nil)  {\n            UIView.animate(withDuration: 0.25) {\n                self.visualEffectView.alpha = 0\n            } completion: { finished in\n                self.visualEffectView.removeFromSuperview()\n            }\n        }\n    }\n\n    deinit {\n        // 关闭网络状态消息监听\n        reachability.stopNotifier()\n        // 移除网络状态消息通知\n        NotificationCenter.default.removeObserver(self, name: .reachabilityChanged, object: reachability)\n    }\n}\n\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Base/FYBaseIGListViewController.swift",
    "content": "//\n//  FYBaseIGListViewController.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport IGListKit\nimport IGListDiffKit\n\nclass FYBaseIGListViewController: FYBaseViewController {\n\n    // MARK: - lazy var\n    \n    var objects: [ListDiffable] = [ListDiffable]()\n    \n    /// 朋友圈-列表\n    lazy var collectionView: UICollectionView = {\n        let flowLayout = UICollectionViewFlowLayout()\n        let collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: flowLayout)\n        if #available(iOS 11.0, *) {\n            collectionView.contentInsetAdjustmentBehavior = .never\n        } else {\n            automaticallyAdjustsScrollViewInsets = false\n        }\n        collectionView.backgroundColor = .clear\n        return collectionView\n    }()\n    \n    lazy var adapter: ListAdapter = {\n        let adapter = ListAdapter(updater: ListAdapterUpdater(), viewController: self)\n        return adapter\n    }()\n\n    // MARK: - life cycle\n    \n    override func viewWillAppear(_ animated: Bool) {\n        super.viewWillAppear(animated)\n        \n        self.navigationController?.setNavigationBarHidden(true, animated: animated)\n    }\n    \n    override func viewWillDisappear(_ animated: Bool) {\n        super.viewWillDisappear(animated)\n    }\n    \n    override func viewDidDisappear(_ animated: Bool) {\n        super.viewDidDisappear(animated)\n        self.view.endEditing(true)\n    }\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        self.fd_prefersNavigationBarHidden = true\n        self.automaticallyAdjustsScrollViewInsets = false\n        self.modalPresentationCapturesStatusBarAppearance = false\n        \n        view.addSubview(collectionView)\n        adapter.collectionView = collectionView\n        adapter.dataSource = self\n        \n        makeUI()\n        createViewModel()\n        bindViewModel()\n    }\n    \n    override func viewDidLayoutSubviews() {\n        super.viewDidLayoutSubviews()\n        collectionView.frame = view.bounds\n    }\n    \n    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {\n        view.endEditing(true)\n        UIApplication.shared.keyWindow?.endEditing(true)\n    }\n}\n\n// MARK: - <ListAdapterDataSource>\n\nextension FYBaseIGListViewController : ListAdapterDataSource {\n    \n    func objects(for listAdapter: ListAdapter) -> [ListDiffable] {\n        return objects\n    }\n    \n    func listAdapter(_ listAdapter: ListAdapter, sectionControllerFor object: Any) -> ListSectionController {\n        return ListSectionController()\n    }\n    \n    func emptyView(for listAdapter: ListAdapter) -> UIView? {\n        // 无数据时collectionView的展示\n        return nil\n    }\n}\n\nextension Notification.Name {\n    \n    struct list {\n        /// 发布通知\n        static let publish = Notification.Name(\"list-publish\")\n        /// 删除通知\n        static let delete = Notification.Name(\"list-delete\")\n        /// 定位通知\n        static let location = Notification.Name(\"list-location\")\n        /// collectionview的评论列表定位到当前通知\n        static let contentOffset = Notification.Name(\"list-contentOffset\")\n        /// 跳转通知\n        static let push = Notification.Name(\"list-push\")\n        /// 打开URL通知\n        static let openURL = Notification.Name(\"list-openURL\")\n    }\n}\n\n\nextension NSObject {\n    /// 返回类名\n    static var fy_className: String {\n        get {\n            let a = NSStringFromClass(self)\n            let className = a.split(separator: \".\").last\n            return String(className!)\n        }\n    }\n}\n\n\npublic extension UITableView {\n    /// 获取当前`cell`实例\n    func cell<T>(_ cellClass: T.Type, reuseIdentifier: String? = nil, fromNib: Bool = false) -> T where T : UITableViewCell {\n        let identifier = reuseIdentifier ?? cellClass.fy_className\n        var cell = dequeueReusableCell(withIdentifier: identifier) as? T\n        if cell == nil {\n            if fromNib {\n                cell = Bundle.main.loadNibNamed(cellClass.fy_className, owner: self\n                                                , options: nil)?.last as? T\n            }else {\n                cell = T(style: .default, reuseIdentifier: identifier)\n            }\n        }\n        return cell!\n    }\n}\n\npublic extension UICollectionView {\n    \n    /// 获取当前`cell`实例\n    func cell<T>(_ cellClass: T.Type, indexPath: IndexPath, reuseIdentifier: String? = nil, fromNib: Bool = false) -> T where T : UICollectionViewCell {\n        let identifier = reuseIdentifier ?? cellClass.fy_className\n        if fromNib {\n            register(UINib(nibName: cellClass.fy_className, bundle: nil), forCellWithReuseIdentifier: identifier)\n        }else {\n            register(cellClass, forCellWithReuseIdentifier: identifier)\n        }\n        return dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! T\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Base/FYBaseNavigationController.swift",
    "content": "//\n//  FYBaseNavigationController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport RxTheme\nimport RxSwift\nimport RxCocoa\n\nclass FYBaseNavigationController: UINavigationController {\n    \n    override var preferredStatusBarStyle: UIStatusBarStyle {\n        return .lightContent\n    }\n    \n    private var titleTextAttributes: [NSAttributedString.Key : NSObject] {\n        return [NSAttributedString.Key.font:UIFont.PingFangMedium(17),\n                NSAttributedString.Key.foregroundColor:UIColor.white]\n    }\n    \n    private lazy var backButton: UIButton = {\n        let button = UIButton(type: .custom)\n        button.frame = CGRect(x: 0, y: 0, width: 40, height: 40)\n        button.theme.buttonImage(from: themed { $0.nav_back_image }, for: .normal)\n        button.imageEdgeInsets = UIEdgeInsets(top: 0, left:-20, bottom: 0, right: 0)\n        button.addTarget(self, action: #selector(pop), for: .touchUpInside)\n        return button\n    }()\n    \n    // MARK: - Life cycle\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        didInitialize()\n    }\n    \n    // 初始化导航栏\n    func didInitialize() {\n        self.navigationBar.shadowImage = UIImage()\n        \n        settingNavBarStyle()\n        \n        // 设置代理\n        delegate = self\n        self.navigationBar.isTranslucent = false\n        self.interactivePopGestureRecognizer?.delegate = self\n        self.automaticallyAdjustsScrollViewInsets = false;\n    }\n    \n    private func addThemeChangedNoti() {\n        NotificationCenter.default.addObserver(self, selector: #selector(settingNavBarStyle), name: .kTraitCollectionDidChange, object: nil)\n    }\n\n    // MARK: - Notification\n    \n    @objc private func settingNavBarStyle() {\n        \n        themeService.typeStream.subscribe ({ theme in\n            \n            if #available(iOS 13, *) {\n                let appearance = UINavigationBarAppearance()\n                // 重置导航栏背景颜色和阴影\n                appearance.configureWithOpaqueBackground()\n                appearance.shadowImage = UIImage()\n                appearance.shadowColor = nil\n                appearance.titleTextAttributes = self.titleTextAttributes\n                \n                switch theme.event.element {\n                case .light:\n                    // 设置背景色\n                    appearance.theme.backgroundColor = themed { $0.FYColor_Nav_BackgroundColor }\n                    self.navigationBar.standardAppearance = appearance\n                    self.navigationBar.scrollEdgeAppearance = appearance\n                    \n                default:\n                    // 设置背景色\n                    appearance.theme.backgroundColor = themed { $0.FYColor_Nav_BackgroundColor }\n                    self.navigationBar.standardAppearance = appearance\n                    self.navigationBar.scrollEdgeAppearance = appearance\n                }\n            }\n            else {\n                // 导航栏背景颜色\n                self.navigationBar.theme.backgroundColor = themed { $0.FYColor_Nav_BackgroundColor }\n            }\n            \n            self.navigationBar.theme.barTintColor = themed { $0.FYColor_Nav_BackgroundColor }\n            self.navigationBar.titleTextAttributes = self.titleTextAttributes\n            self.navigationBar.tintColor = .Color_White_FFFFFF\n            \n        }).disposed(by: rx.disposeBag)\n        \n    }\n}\n\n\n// MARK: - UINavigationControllerDelegate\n\nextension FYBaseNavigationController: UINavigationControllerDelegate, UIGestureRecognizerDelegate {\n    \n    override func pushViewController(_ viewController: UIViewController, animated: Bool) {\n        \n        if self.viewControllers.count > 0 {\n            // 隐藏tabBar\n            viewController.hidesBottomBarWhenPushed = true\n            \n            let backItem = UIBarButtonItem(customView: self.backButton)\n            viewController.navigationItem.leftBarButtonItem = backItem\n            // 手势可用\n            self.interactivePopGestureRecognizer?.isEnabled = true\n        }\n        \n        super.pushViewController(viewController, animated: animated)\n    }\n    \n    /// 返回&出栈\n    @objc private func pop() {\n        self.popViewController(animated: true)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Base/FYBaseTabBarController.swift",
    "content": "//\n//  FYBaseTabBarController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYBaseTabBarController: UITabBarController {\n    \n    // MARK: - life cycle\n    \n    private var indexFlag: Int = 0\n    \n    private lazy var impactGenerator: UIImpactFeedbackGenerator = {\n        let imp = UIImpactFeedbackGenerator(style: .medium)\n        return imp\n    }()\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        didInitialize()\n        createChildVc()\n    }\n    \n    // MARK: - initialize\n    \n    private func didInitialize() {\n        let tabBar = UITabBar.appearance()\n        tabBar.isTranslucent = false\n\n        if #available(iOS 13, *) {\n            let normalAttr = [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 10),\n                              NSAttributedString.Key.foregroundColor : UIColor.tabBarTitleNormalColor()]\n            let selectedAttr = [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 10),\n                                NSAttributedString.Key.foregroundColor : UIColor.tabBarTitleSelectColor()]\n            let appearance = UITabBarAppearance()\n            let par = NSMutableParagraphStyle.init()\n            par.alignment = .center\n            \n            let noraml = appearance.stackedLayoutAppearance.normal\n            noraml.titleTextAttributes = normalAttr\n            \n            let selected = appearance.stackedLayoutAppearance.selected\n            selected.titleTextAttributes = selectedAttr\n            \n            // 官方文档写的是 重置背景和阴影为透明\n            appearance.configureWithTransparentBackground()\n            appearance.configureWithOpaqueBackground()\n            // 设置\n            self.tabBar.standardAppearance = appearance\n            \n        }else {\n            let normalAttr = [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 13),\n                              NSAttributedString.Key.foregroundColor : UIColor.tabBarTitleNormalColor()]\n            let selectedAttr = [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 13),\n                                NSAttributedString.Key.foregroundColor : UIColor.tabBarTitleSelectColor()]\n            \n            let tabBarItem = UITabBarItem.appearance()\n            tabBarItem.setTitleTextAttributes(normalAttr, for: .normal)\n            tabBarItem.setTitleTextAttributes(selectedAttr, for: .selected)\n        }\n        \n        // 设置背景颜色\n        self.tabBar.theme.backgroundColor = themed{ $0.FYColor_Tab_BackgroundColor }\n    }\n    \n    private func createChildVc() {\n        \n        let vc1 = FYSesstionListViewController()\n        addChildViewController(vc1,\n                               title: \"会话\".rLocalized(),\n                              image: R.image.ic_tabbar01_normal()!,\n                              selectedImage: R.image.ic_tabbar01_selected()!)\n        \n        let vc2 = FYChatRoomListViewController()\n        addChildViewController(vc2,\n                               title: \"群组\".rLocalized(),\n                              image: R.image.ic_tabbar02_normal()!,\n                              selectedImage: R.image.ic_tabbar02_selected()!)\n        \n        let vc3 = FYContactsListViewController()\n        addChildViewController(vc3,\n                               title: \"好友\".rLocalized(),\n                              image: R.image.ic_tabbar03_normal()!,\n                              selectedImage: R.image.ic_tabbar03_selected()!)\n        \n        let vc4 = FYMineViewController()\n        addChildViewController(vc4, title: \"我\".rLocalized(),\n                              image: R.image.ic_tabbar04_normal()!,\n                              selectedImage: R.image.ic_tabbar04_selected()!)\n    }\n    \n    /// 为tababr点击添加动画\n    /// - Parameters:\n    ///   - tabbar: tabbar\n    ///   - item: tabbar菜单\n    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {\n        \n        if let index = tabBar.items?.firstIndex(of: item) {\n            if indexFlag != index {\n                animationSelectedIndex(index: index)\n            }\n        }\n    }\n    \n    override func didReceiveMemoryWarning() {\n        super.didReceiveMemoryWarning()\n        // Dispose of any resources that can be recreated.\n    }\n}\n\n\nextension FYBaseTabBarController {\n\n    fileprivate func addChildViewController(_ vc: UIViewController?,\n                                        title: String,\n                                        image: UIImage,\n                                        selectedImage: UIImage) {\n        \n        if let rootVC = vc {\n            // configure\n            rootVC.title = title\n            rootVC.tabBarItem.image = UIImage.imageWithRenderingMode(image)\n            rootVC.tabBarItem.selectedImage = UIImage.imageWithRenderingMode(selectedImage)\n            // nav\n            let nav = FYBaseNavigationController(rootViewController: rootVC)\n            addChild(nav)\n        }\n    }\n    \n    \n    /// 实现点击选中缩放动画\n    private func animationSelectedIndex(index: Int) {\n        var btnImageViews: [UIView] = []\n        \n        for tabBarButton in self.tabBar.subviews {\n            if tabBarButton.isKind(of: NSClassFromString(\"UITabBarButton\")!) {\n                for imageView in tabBarButton.subviews {\n                    if imageView.isKind(of: NSClassFromString(\"UITabBarSwappableImageView\")!) {\n                        btnImageViews.append(imageView)\n                    }\n                }\n            }\n        }\n        \n        // 缩放动画\n        let pulse = CABasicAnimation(keyPath: \"transform.scale\")\n        pulse.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)\n        pulse.duration = 0.15\n        pulse.repeatCount = 1\n        pulse.autoreverses = true\n        pulse.fromValue = NSNumber(value: 0.7)\n        pulse.toValue = NSNumber(value: 1.1)\n        \n        btnImageViews[index].layer.add(pulse, forKey: nil)\n        \n        indexFlag = index\n        impactGenerator.impactOccurred()\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Base/FYBaseViewController.swift",
    "content": "//\n//  FYBaseViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//  业务基类\n\nimport UIKit\nimport HandyJSON\nimport RxSwift\nimport RxCocoa\nimport Moya\n\nclass FYBaseViewController: UIViewController {\n    \n    override var preferredStatusBarStyle: UIStatusBarStyle {\n        return .lightContent\n    }\n    \n    let headerRefreshTrigger = PublishSubject<Void>()\n    let footerRefreshTrigger = PublishSubject<Void>()\n    let loadingTrigger = PublishSubject<Void>()\n\n    let isHeaderLoading = BehaviorRelay(value: false)\n    let isFooterLoading = BehaviorRelay(value: false)\n    let isLoading = BehaviorRelay(value: false)\n\n    /// 设置导航栏底线\n    var hideNavShadowImage: Bool = false {\n        didSet {\n            if hideNavShadowImage == true {\n                self.navigationController?.navigationBar.shadowImage = UIImage()\n            }\n        }\n    }\n    \n    /// 基类-普通列表\n    lazy var plainTabView: UITableView = {\n        let frame = CGRect(x: 0, y: 0, width: kScreenW, height: self.view.height)\n        let table = UITableView(frame: frame, style: .plain)\n        table.backgroundColor = .clear\n        table.separatorColor = .clear\n        table.delegate = self as? UITableViewDelegate\n        table.dataSource = self as? UITableViewDataSource\n        table.showsVerticalScrollIndicator = false\n        table.showsHorizontalScrollIndicator = false\n        table.tableFooterView = UIView()\n        if #available(iOS 11.0, *) {\n            table.contentInsetAdjustmentBehavior = UIScrollView.ContentInsetAdjustmentBehavior.never\n        } else {\n            // Fallback on earlier versions\n        }\n        return table\n    }()\n    \n    /// 基类-分组列表\n    lazy var groupTabView: UITableView = {\n        let frame = CGRect(x: 0, y: 0, width: kScreenW, height: self.view.height)\n        let table = UITableView(frame: frame, style: .grouped)\n        table.backgroundColor = .clear\n        table.separatorColor = .clear\n        table.delegate = self as? UITableViewDelegate\n        table.dataSource = self as? UITableViewDataSource\n        table.showsVerticalScrollIndicator = false\n        table.showsHorizontalScrollIndicator = false\n        table.tableFooterView = UIView()\n        if #available(iOS 11.0, *) {\n            table.contentInsetAdjustmentBehavior = UIScrollView.ContentInsetAdjustmentBehavior.never\n        } else {\n            // Fallback on earlier versions\n        }\n        return table\n    }()\n            \n    // 解决push时界面卡住问题\n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        if self.navigationController?.viewControllers.first == self {\n            self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false\n        }else {\n            self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true\n        }\n    }\n    \n    override func viewWillDisappear(_ animated: Bool) {\n        super.viewWillDisappear(animated)\n    }\n    \n    override func viewDidDisappear(_ animated: Bool) {\n        super.viewDidDisappear(animated)\n        self.view.endEditing(true)\n    }\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V2 }\n        \n        self.fd_prefersNavigationBarHidden = false\n        self.automaticallyAdjustsScrollViewInsets = false\n        self.modalPresentationCapturesStatusBarAppearance = false\n        \n        makeUI()\n        createViewModel()\n        bindViewModel()\n    }\n    \n    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {\n        view.endEditing(true)\n        UIApplication.shared.keyWindow?.endEditing(true)\n    }\n    \n    // 系统主题变化\n    override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {\n        super.traitCollectionDidChange(previousTraitCollection)\n        \n        if #available(iOS 13.0, *) {\n            guard let hasUserInterfaceStyleChanged = previousTraitCollection?.hasDifferentColorAppearance(comparedTo: previousTraitCollection) else {\n                return\n            }\n            \n            DispatchQueue.main.async {\n                self.userInterfaceStyleListener(isChanged: hasUserInterfaceStyleChanged)\n            }\n        } else {\n            // Fallback on earlier versions\n        }\n    }\n    \n    // MARK: - 提供子类重写\n    open func makeUI() { }\n    open func createViewModel() { }\n    open func bindViewModel() { }\n}\n\n// MARK: - Action\n\nextension FYBaseViewController {\n    \n    /// 基类方法 - 返回上一个控制器\n    @objc func popLastVC() {\n        if ((self.navigationController?.viewControllers) != nil) {\n            self.navigationController?.popViewController(animated: true)\n        }\n    }\n    \n    /// 基类方法 - 返回根控制器\n    @objc func popRootVC() {\n        if ((self.navigationController?.viewControllers) != nil) {\n            self.navigationController?.popToRootViewController(animated: true)\n        }\n    }\n}\n\n// MARK: - UserInterfaceStyleListener\n\nextension FYBaseViewController {\n    \n    /// 监听当前系统模式\n    func userInterfaceStyleListener(isChanged: Bool) {\n        let lastThemeMode = FYThemeCenter.shared.currentTheme\n        if (lastThemeMode != .system) {\n            return\n        }\n        \n        if #available(iOS 13.0, *) {\n            if UITraitCollection.current.userInterfaceStyle == .dark {\n                print(\"System Dark mode\")\n                themeService.switch(.dark)\n            }else {\n                print(\"System Light mode\")\n                themeService.switch(.light)\n            }\n            \n            // 发出系统主题模式改变通知\n            NotificationCenter.default.post(name: .kTraitCollectionDidChange, object: nil)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Base/Model/FYCellDataConfig.swift",
    "content": "//\n//  FYCellDataConfig.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/2.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport HandyJSON\n\nclass FYCellDataConfig: NSObject {\n    var title: String?\n    var subtitle: String?\n    var image: String?\n    var isShow: Bool = false\n    \n    var targetVC: UIViewController?\n    \n    public init(title: String? = \"\", subtitle: String? = \"\", image : String? = \"\", isShow: Bool = false, targetVC: UIViewController? = nil) {\n        super.init()\n        \n        self.title = title\n        self.subtitle = subtitle\n        self.image = image\n        \n        self.isShow = isShow\n        self.targetVC = targetVC\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Base/ViewModel/BaseViewModel.swift",
    "content": "//\n//  BaseViewModel.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2019/3/15.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport RxSwift\nimport RxCocoa\nimport Moya\n\nprotocol ViewModelType {\n    associatedtype Input\n    associatedtype Output\n    \n    func transform(input: Input) -> Output\n}\n\nclass BaseViewModel: NSObject {\n    \n    var page = 0\n    var pageSize = 20\n    \n    let loading = ActivityIndicator()\n    let headerLoading = ActivityIndicator()\n    let footerLoading = ActivityIndicator()\n    let error = ErrorTracker()\n    \n    override init() {\n        super.init()\n        \n        error.asDriver().drive(onNext: { (error) in\n            printLog(\"ViewModel error：\\(error.localizedDescription)\")\n        }).disposed(by: rx.disposeBag)\n    }\n    \n    deinit {\n        print(\"\\(type(of: self)):Deinited\")\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Common/AppCommon.swift",
    "content": "//\n//  AppCommon.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/27.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport Reachability\nimport SnapKit\n\n// MARK: - 常用距离\npublic let kScreen  = UIScreen.main.bounds\npublic let kScreenW = UIScreen.main.bounds.size.width\npublic let kScreenH = UIScreen.main.bounds.size.height\n\npublic let kMargin = kFitScale(at: 10)\npublic let kLineMargin = kFitScale(at: 1)\n\npublic let isIphoneX = { () -> Bool in\n    var isX = false\n    if #available(iOS 11.0, *) {\n        isX = (UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0) > CGFloat(0.0)\n    }\n    return isX\n}\n\npublic let kWindowSafeAreaInset = { () -> UIEdgeInsets in\n    var insets = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0)\n    if #available(iOS 11.0, *) {\n        insets = UIApplication.shared.keyWindow?.safeAreaInsets ?? insets\n    }\n    return insets\n}\n\npublic let kSafeAreaTop = kWindowSafeAreaInset().top == 0 ? 20 : kWindowSafeAreaInset().top\npublic let kSafeAreaBottom = kWindowSafeAreaInset().bottom\npublic let kStatusH = kWindowSafeAreaInset().top\npublic let kNavigaH = 44 + kStatusH\npublic let kTabBarH = 49 + kSafeAreaBottom\n\n// MARK: - 动画执行时间\nlet kDuration: TimeInterval = 3.0\n\n// MARK: - 偏好设置存储\n/// 应用是否首次启动\npublic let kAppLaunchUserDefaultsKey = \"kAppLaunchUserDefaultsKey\"\n/// 应用当前语言设置\npublic let kAppLanguageUserDefaultsKey = \"kAppLanguageUserDefaultsKey\"\n/// 白天夜间模式\npublic let kThemeSettingUserDefaultKey = \"kThemeSettingUserDefaultKey\"\n\n\n// MARK: - FileManager Path\npublic let cachesURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]\npublic let libraryURL = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)[0]\n\n\n// MARK: - 当前窗口\nlet kCurrentWindow = UIApplication.shared.keyWindow\n\n// MARK: - 自定义打印日志\nfunc printLog<T>(_ message: T, fileName: String = #file, methodName: String = #function, lineNumber: Int = #line){\n    //文件名、方法、行号、打印信息\n    #if DEBUG\n    print(\"方法:\\(methodName)\\n行号:\\(lineNumber)\\n打印信息:\\(message)\");\n    #endif\n}\n\n\n// MARK: - 系统信息相关\nlet infoDictionary = Bundle.main.infoDictionary!\n/// 程序名称\nlet appDisplayName = infoDictionary[\"CFBundleDisplayName\"] as! String\n/// 主程序版本号\nlet majorVersion = infoDictionary[\"CFBundleShortVersionString\"] as! String\n\n/// 设备唯一标识码\npublic let kDeviceUUID = { () -> String in\n    if let uuid = UIDevice.current.identifierForVendor?.uuidString {\n        return uuid\n    }\n    return \"\"\n}\n\n\n// MARK: - 屏幕适配375 | 6s尺寸\nfunc kFitScale(at ratio: CGFloat) -> CGFloat {\n    return (UIScreen.main.bounds.width / 375) * ratio\n}\n\n// MARK: - 朋友圈\nlet mImageW = (kScreenW - 156) / 3\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/Array/Array+Extension.swift",
    "content": "//\n//  NSArray+Extension.swift\n//  EmiotAppCode\n//\n//  Created by Jett on 2017/5/27.\n//  Copyright © 2017年 Zehuihong. All rights reserved.\n//\n\nimport UIKit\n\n\nextension Array {\n    \n    subscript (safe index:Int) -> Element?{\n        return (0..<count).contains(index) ? self[index] : nil\n    }\n    \n    func toJSONString() -> String {\n        let data = try? JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions.prettyPrinted)\n        let strJson = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)\n        return strJson! as String\n    }\n    \n    func toData() -> Data {\n        let data = try? JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions.prettyPrinted)\n        return data!\n    }\n}\n\nextension Array where Element: Hashable {\n    \n    // 数组去重处理\n    var unique:[Element] {\n        var uniq = Set<Element>()\n        uniq.reserveCapacity(self.count)\n        return self.filter {\n            return uniq.insert($0).inserted\n        }\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/Dictionary/Dictionary+Exted.swift",
    "content": "//\n//  Dictionary+EXTension.swift\n//  SZBookMall\n//\n//  Created by fisland on 2017/11/20.\n//  Copyright © 2017年 Zehuihong. All rights reserved.\n//\n\nimport Foundation\n\nextension Dictionary {\n    \n    static func += <KeyType, ValueType> ( left: inout Dictionary<KeyType, ValueType>, right: Dictionary<KeyType, ValueType>) {\n        for (k, v) in right {\n            left.updateValue(v, forKey: k)\n        }\n    }\n    \n    func toJSONString() -> String {\n        let data = try? JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions.prettyPrinted)\n        let jsonString = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)\n        return jsonString! as String\n    }\n    \n    func toData() -> Data {\n        let data = try? JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions.prettyPrinted)\n        return data!\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/Notification/Notification+Name.swift",
    "content": "//\n//  Notification+Name.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/10/10.\n//  Copyright © 2019 Jett. All rights reserved.\n//  通知便捷使用\n\nimport Foundation\n\n// MARK: - NSNotificationName\n\nextension NSNotification.Name {\n    \n    /// 主题更改\n    public static let kThemeDidChanged = Notification.Name(\"kThemeDidChanged\")\n    \n    /// 网络状态监听\n    public static let kReachabilityChanged = Notification.Name(rawValue:\"ReachabilityChangedNotification\")\n    \n    /// 刷新消息列表\n    public static let kNeedRefreshSesstionList = Notification.Name(rawValue:\"kNeedRefreshSesstionList\")\n    \n    /// 退出群聊\n    public static let kNeedRefreshChatInfoList = Notification.Name(rawValue:\"kNeedRefreshChatInfoList\")\n    \n    /// 系统主题模式改变\n    public static let kTraitCollectionDidChange = Notification.Name(rawValue:\"kTraitCollectionDidChange\")\n}\n\n\n// MARK: - NotificationCenter\n\npublic typealias NotiCenter = NotificationCenter\n\nextension NotificationCenter {\n    \n    /// 发送通知内容\n    static func postNoti(_ name: NSNotification.Name, object: Any? = nil) {\n        self.default.post(name: name, object: nil)\n    }\n    \n    /// 发送通知传递实体内容\n    static func postNotiWithUserInfo(_ name: NSNotification.Name, object: Any? = nil, userInfo: [AnyHashable : Any] = [AnyHashable : Any]()) {\n        self.default.post(name: name, object: nil, userInfo: userInfo)\n    }\n    \n    \n    func observe(name: NSNotification.Name?, object: Any?, queue: OperationQueue?, using block: @escaping (Notification) ->()) -> NotificationToken {\n          let token = addObserver(forName: name, object: object, queue: queue, using: block)\n          return NotificationToken(notificationCenter: self, token: token)\n    }\n    \n    class func addObserve(target: Any, action: Selector, name: NSNotification.Name?, object: Any? = nil) {\n        self.default.addObserver(target, selector: action, name: name, object: object)\n    }\n}\n\n\nfinal class NotificationToken: NSObject {\n      let notificcationCenter: NotificationCenter\n      let token: Any\n      \n      init(notificationCenter: NotificationCenter = .default, token: Any) {\n            self.notificcationCenter = notificationCenter\n            self.token = token\n      }\n    \n      deinit {\n        notificcationCenter.removeObserver(token)\n      }\n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/RxSwift/JFButton+Rx.swift",
    "content": "//\n//  JFButton+Rx.swift\n//  MK-MChain\n//\n//  Created by Jett on 2019/5/30.\n//  Copyright © 2019 miku. All rights reserved.\n//\n\nimport Foundation\nimport Kingfisher\nimport RxCocoa\nimport RxSwift\n\nprivate var KJFButtonIndicator   = \"KJFButtonIndicator\"\nprivate var KJFButtonCurrentText = \"KJFButtonCurrentText\"\n\nextension Reactive where Base: UIButton {\n    //是否秀菊花\n    public var isShowIndicator: Binder<Bool>{\n        return Binder(self.base, binding: { btn, active in\n            if active{\n                objc_setAssociatedObject(btn, &KJFButtonCurrentText, btn.currentTitle, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n                btn.setTitle(\"\", for: .normal)\n                btn.whiteIndicator.startAnimating()\n                btn.isUserInteractionEnabled = false\n            }\n            else{\n                btn.whiteIndicator.stopAnimating()\n                if let title = objc_getAssociatedObject(btn, &KJFButtonCurrentText) as? String{\n                    btn.setTitle(title, for: .normal)\n                }\n                btn.isUserInteractionEnabled = true\n            }\n        })\n    }\n}\n\n\npublic extension UIButton {\n    var whiteIndicator : UIActivityIndicatorView{\n        get {\n            var indicator = objc_getAssociatedObject(self, &KJFButtonIndicator)\n                as? UIActivityIndicatorView\n            if indicator == nil {\n                indicator = UIActivityIndicatorView(style: .white)\n                indicator!.center = CGPoint(x: self.bounds.width / 2,\n                                            y: self.bounds.height / 2)\n                self.addSubview(indicator!)\n                //indicator.startAnimating()\n            }\n            self.whiteIndicator = indicator!\n            //c重新设置中心点\n            indicator!.center = CGPoint(x: self.bounds.width / 2,\n                                        y: self.bounds.height / 2)\n            return indicator!\n        }\n        set {\n            objc_setAssociatedObject(self, &KJFButtonIndicator, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n}\n\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/RxSwift/MJRefresh+Rx.swift",
    "content": "//\n//  MJRefresh+Rx.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/13.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport MJRefresh\nimport RxSwift\nimport RxCocoa\n\n//对MJRefreshComponent增加rx扩展\nextension Reactive where Base: MJRefreshComponent {\n     \n    /// 正在刷新事件\n    var refreshing: ControlEvent<Void> {\n        let source: Observable<Void> = Observable.create {\n            [weak control = self.base] observer  in\n            if let control = control {\n                control.refreshingBlock = {\n                    observer.on(.next(()))\n                }\n            }\n            return Disposables.create()\n        }\n        return ControlEvent(events: source)\n    }\n    \n    /// 正在刷新\n    var isRefreshing: Binder<Bool> {\n        return Binder(base) { refresh, isRefresh in\n            if isRefresh {\n                refresh.beginRefreshing()\n            }\n        }\n    }\n     \n    /// 停止刷新\n    var endRefreshing: Binder<Bool> {\n        return Binder(base) { refresh, isEnd in\n            if isEnd {\n                refresh.endRefreshing()\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/RxSwift/Observable+Operators.swift",
    "content": "//\n//  Observable+Operators.swift\n//  Cake Builder\n//\n//  Created by Khoren Markosyan on 10/19/16.\n//  Copyright © 2016 Khoren Markosyan. All rights reserved.\n//\n\nimport Foundation\nimport RxSwift\nimport RxCocoa\n\n\nprotocol OptionalType {\n    associatedtype Wrapped\n\n    var value: Wrapped? { get }\n}\n\nextension Optional: OptionalType {\n    var value: Wrapped? {\n        return self\n    }\n}\n\nextension Observable where Element: OptionalType {\n    func filterNil() -> Observable<Element.Wrapped> {\n        return flatMap { (element) -> Observable<Element.Wrapped> in\n            if let value = element.value {\n                return .just(value)\n            } else {\n                return .empty()\n            }\n        }\n    }\n\n    func filterNilKeepOptional() -> Observable<Element> {\n        return self.filter { (element) -> Bool in\n            return element.value != nil\n        }\n    }\n\n    func replaceNil(with nilValue: Element.Wrapped) -> Observable<Element.Wrapped> {\n        return flatMap { (element) -> Observable<Element.Wrapped> in\n            if let value = element.value {\n                return .just(value)\n            } else {\n                return .just(nilValue)\n            }\n        }\n    }\n}\n\nprotocol BooleanType {\n    var boolValue: Bool { get }\n}\nextension Bool: BooleanType {\n    var boolValue: Bool { return self }\n}\n\n// Maps true to false and vice versa\nextension Observable where Element: BooleanType {\n    func not() -> Observable<Bool> {\n        return self.map { input in\n            return !input.boolValue\n        }\n    }\n}\n\nextension Observable where Element: Equatable {\n    func ignore(value: Element) -> Observable<Element> {\n        return filter { (selfE) -> Bool in\n            return value != selfE\n        }\n    }\n}\n\nextension ObservableType where Element == Bool {\n    /// Boolean not operator\n    public func not() -> Observable<Bool> {\n        return self.map(!)\n    }\n}\n\nextension SharedSequenceConvertibleType {\n    func mapToVoid() -> SharedSequence<SharingStrategy, Void> {\n        return map { _ in }\n    }\n}\n\nextension ObservableType {\n    func asDriverOnErrorJustComplete() -> Driver<Element> {\n        return asDriver { error in\n            assertionFailure(\"Error \\(error)\")\n            return Driver.empty()\n        }\n    }\n\n    func mapToVoid() -> Observable<Void> {\n        return map { _ in }\n    }\n}\n\n//https://gist.github.com/brocoo/aaabf12c6c2b13d292f43c971ab91dfa\nextension Reactive where Base: UIScrollView {\n    public var reachedBottom: Observable<Void> {\n        let scrollView = self.base as UIScrollView\n        return self.contentOffset.flatMap { [weak scrollView] (contentOffset) -> Observable<Void> in\n            guard let scrollView = scrollView else { return Observable.empty() }\n            let visibleHeight = scrollView.frame.height - self.base.contentInset.top - scrollView.contentInset.bottom\n            let y = contentOffset.y + scrollView.contentInset.top\n            let threshold = max(0.0, scrollView.contentSize.height - visibleHeight)\n            return (y > threshold) ? Observable.just(()) : Observable.empty()\n        }\n    }\n}\n\n// Two way binding operator between control property and variable, that's all it takes {\n\ninfix operator <-> : DefaultPrecedence\n\nfunc nonMarkedText(_ textInput: UITextInput) -> String? {\n    let start = textInput.beginningOfDocument\n    let end = textInput.endOfDocument\n\n    guard let rangeAll = textInput.textRange(from: start, to: end),\n        let text = textInput.text(in: rangeAll) else {\n            return nil\n    }\n\n    guard let markedTextRange = textInput.markedTextRange else {\n        return text\n    }\n\n    guard let startRange = textInput.textRange(from: start, to: markedTextRange.start),\n        let endRange = textInput.textRange(from: markedTextRange.end, to: end) else {\n            return text\n    }\n\n    return (textInput.text(in: startRange) ?? \"\") + (textInput.text(in: endRange) ?? \"\")\n}\n\nfunc <-> <Base>(textInput: TextInput<Base>, variable: BehaviorRelay<String>) -> Disposable {\n    let bindToUIDisposable = variable.asObservable()\n        .bind(to: textInput.text)\n    let bindToVariable = textInput.text\n        .subscribe(onNext: { [weak base = textInput.base] value in\n            guard let base = base else {\n                return\n            }\n\n            let nonMarkedTextValue = nonMarkedText(base)\n\n            /**\n             In some cases `textInput.textRangeFromPosition(start, toPosition: end)` will return nil even though the underlying\n             value is not nil. This appears to be an Apple bug. If it's not, and we are doing something wrong, please let us know.\n             The can be reproed easily if replace bottom code with\n\n             if nonMarkedTextValue != variable.value {\n             variable.value = nonMarkedTextValue ?? \"\"\n             }\n\n             and you hit \"Done\" button on keyboard.\n             */\n            if let nonMarkedTextValue = nonMarkedTextValue, nonMarkedTextValue != variable.value {\n                variable.accept(nonMarkedTextValue)\n            }\n            }, onCompleted: {\n                bindToUIDisposable.dispose()\n        })\n\n    return Disposables.create(bindToUIDisposable, bindToVariable)\n}\n\nfunc <-> <T>(property: ControlProperty<T>, variable: BehaviorRelay<T>) -> Disposable {\n    if T.self == String.self {\n        #if DEBUG\n        fatalError(\"It is ok to delete this message, but this is here to warn that you are maybe trying to bind to some `rx.text` property directly to variable.\\n\" +\n            \"That will usually work ok, but for some languages that use IME, that simplistic method could cause unexpected issues because it will return intermediate results while text is being inputed.\\n\" +\n            \"REMEDY: Just use `textField <-> variable` instead of `textField.rx.text <-> variable`.\\n\" +\n            \"Find out more here: https://github.com/ReactiveX/RxSwift/issues/649\\n\"\n        )\n        #endif\n    }\n\n    let bindToUIDisposable = variable.asObservable()\n        .bind(to: property)\n    let bindToVariable = property\n        .subscribe(onNext: { value in\n            variable.accept(value)\n        }, onCompleted: {\n            bindToUIDisposable.dispose()\n        })\n\n    return Disposables.create(bindToUIDisposable, bindToVariable)\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/SnapKit/ConstraintArray+Extensions.swift",
    "content": "\nimport SnapKit\n\nextension String {\n    func size(withFont font: UIFont) -> CGSize {\n        let attributes = [NSAttributedString.Key.font: font]\n        return (self as NSString).size(withAttributes: attributes)\n    }\n}\n\nextension Array where Element: ConstraintView {\n    \n    public var snp: ConstraintArrayDSL {\n        return ConstraintArrayDSL(array: self)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/SnapKit/ConstraintArrayDSL.swift",
    "content": "\nimport SnapKit\n\npublic struct ConstraintArrayDSL {\n    @discardableResult\n    public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {\n        var constraints = Array<Constraint>()\n        for view in self.array {\n            constraints.append(contentsOf: view.snp.prepareConstraints(closure))\n        }\n        return constraints\n    }\n    \n    public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        for view in self.array {\n            view.snp.makeConstraints(closure)\n        }\n    }\n    \n    public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        for view in self.array {\n            view.snp.remakeConstraints(closure)\n        }\n    }\n    \n    public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        for view in self.array {\n            view.snp.updateConstraints(closure)\n        }\n    }\n    \n    public func removeConstraints() {\n        for view in self.array {\n            view.snp.removeConstraints()\n        }\n    }\n    \n    /// distribute with fixed spacing\n    ///\n    /// - Parameters:\n    ///   - axisType: which axis to distribute items along\n    ///   - fixedSpacing: the spacing between each item\n    ///   - leadSpacing: the spacing before the first item and the container\n    ///   - tailSpacing: the spacing after the last item and the container\n    public func distributeViewsAlong(axisType:NSLayoutConstraint.Axis,\n                                     fixedSpacing:CGFloat,\n                                     leadSpacing:CGFloat = 0,\n                                     tailSpacing:CGFloat = 0) {\n        \n        guard self.array.count > 1, let tempSuperView = commonSuperviewOfViews() else {\n            return\n        }\n        \n        if axisType == .horizontal {\n            var prev : ConstraintView?\n            for (i, v) in self.array.enumerated() {\n                v.snp.makeConstraints({ (make) in\n                    if prev != nil {\n                        make.width.equalTo(prev!)\n                        make.left.equalTo((prev?.snp.right)!).offset(fixedSpacing)\n                        if (i == self.array.count - 1) {//last one\n                            make.right.equalTo(tempSuperView).offset(-tailSpacing);\n                        }\n                    }else {\n                        make.left.equalTo(tempSuperView).offset(leadSpacing);\n                    }\n                })\n                prev = v;\n            }\n        }else {\n            var prev : ConstraintView?\n            for (i, v) in self.array.enumerated() {\n                v.snp.makeConstraints({ (make) in\n                    if prev != nil {\n                        make.height.equalTo(prev!)\n                        make.top.equalTo((prev?.snp.bottom)!).offset(fixedSpacing)\n                        if (i == self.array.count - 1) {//last one\n                            make.bottom.equalTo(tempSuperView).offset(-tailSpacing);\n                        }\n                    }else {\n                        make.top.equalTo(tempSuperView).offset(leadSpacing);\n                    }\n                })\n                prev = v;\n            }\n        }\n    }\n    \n    /// distribute with fixed item size\n    ///\n    /// - Parameters:\n    ///   - axisType: which axis to distribute items along\n    ///   - fixedItemLength: the fixed length of each item\n    ///   - leadSpacing: the spacing before the first item and the container\n    ///   - tailSpacing: the spacing after the last item and the container\n    public func distributeViewsAlong(axisType:NSLayoutConstraint.Axis,\n                                     fixedItemLength:CGFloat,\n                                     leadSpacing:CGFloat = 0,\n                                     tailSpacing:CGFloat = 0) {\n        \n        guard self.array.count > 1, let tempSuperView = commonSuperviewOfViews() else {\n            return\n        }\n        \n        if axisType == .horizontal {\n            var prev : ConstraintView?\n            for (i, v) in self.array.enumerated() {\n                v.snp.makeConstraints({ (make) in\n                    make.width.equalTo(fixedItemLength)\n                    if prev != nil {\n                        if (i == self.array.count - 1) {//last one\n                            make.right.equalTo(tempSuperView).offset(-tailSpacing);\n                        }else {\n                            let offset = (CGFloat(1) - (CGFloat(i) / CGFloat(self.array.count - 1))) *\n                                (fixedItemLength + leadSpacing) - CGFloat(i) *\n                                tailSpacing /\n                                CGFloat(self.array.count - 1)\n                            make.right\n                                .equalTo(tempSuperView)\n                                .multipliedBy(CGFloat(i) / CGFloat(self.array.count - 1))\n                                .offset(offset)\n                        }\n                    }else {\n                        make.left.equalTo(tempSuperView).offset(leadSpacing);\n                    }\n                })\n                prev = v;\n            }\n        }else {\n            var prev : ConstraintView?\n            for (i, v) in self.array.enumerated() {\n                v.snp.makeConstraints({ (make) in\n                    make.height.equalTo(fixedItemLength)\n                    if prev != nil {\n                        if (i == self.array.count - 1) {//last one\n                            make.bottom.equalTo(tempSuperView).offset(-tailSpacing);\n                        }else {\n                            let offset = (CGFloat(1) - (CGFloat(i) / CGFloat(self.array.count - 1))) *\n                                    (fixedItemLength + leadSpacing) - CGFloat(i) *\n                                    tailSpacing /\n                                    CGFloat(self.array.count - 1)\n                            \n                            make.bottom\n                                .equalTo(tempSuperView)\n                                .multipliedBy(CGFloat(i) / CGFloat(self.array.count-1))\n                                .offset(offset)\n                        }\n                    }else {\n                        make.top.equalTo(tempSuperView).offset(leadSpacing);\n                    }\n                })\n                prev = v;\n            }\n        }\n    }\n    \n    public func distributeSudokuViews(fixedItemWidth: CGFloat,\n                                      fixedItemHeight: CGFloat,\n                                      warpCount: Int,\n                                      edgeInset: UIEdgeInsets = UIEdgeInsets.zero) {\n        \n        guard self.array.count > 1, warpCount >= 1, let tempSuperView = commonSuperviewOfViews() else {\n            return\n        }\n        \n        let rowCount = self.array.count % warpCount == 0 ? self.array.count / warpCount : self.array.count / warpCount + 1;\n        let columnCount = warpCount\n        \n        for (i,v) in self.array.enumerated() {\n            \n            let currentRow = i / warpCount\n            let currentColumn = i % warpCount\n            \n            v.snp.makeConstraints({ (make) in\n                make.width.equalTo(fixedItemWidth)\n                make.height.equalTo(fixedItemHeight)\n                if currentRow == 0 {//fisrt row\n                    make.top.equalTo(tempSuperView).offset(edgeInset.top)\n                }\n                if currentRow == rowCount - 1 {//last row\n                    make.bottom.equalTo(tempSuperView).offset(-edgeInset.bottom)\n                }\n                \n                if currentRow != 0 && currentRow != rowCount - 1 {//other row\n                    let offset = (CGFloat(1) - CGFloat(currentRow) / CGFloat(rowCount - 1)) * (fixedItemHeight + edgeInset.top) - CGFloat(currentRow) * edgeInset.bottom / CGFloat(rowCount - 1)\n                    make.bottom\n                        .equalTo(tempSuperView)\n                        .multipliedBy(CGFloat(currentRow) / CGFloat(rowCount - 1))\n                        .offset(offset);\n                }\n                \n                if currentColumn == 0 {//first col\n                    make.left.equalTo(tempSuperView).offset(edgeInset.left)\n                }\n                if currentColumn == columnCount - 1 {//last col\n                    make.right.equalTo(tempSuperView).offset(-edgeInset.right)\n                }\n                \n                if currentColumn != 0 && currentColumn != columnCount - 1 {//other col\n                    let offset = (CGFloat(1) - CGFloat(currentColumn) / CGFloat(columnCount - 1)) * (fixedItemWidth + edgeInset.left) - CGFloat(currentColumn) * edgeInset.right / CGFloat(columnCount - 1)\n                    make.right\n                        .equalTo(tempSuperView)\n                        .multipliedBy(CGFloat(currentColumn) / CGFloat(columnCount - 1))\n                        .offset(offset);\n                }\n            })\n        }\n    }\n    \n    public func distributeSudokuViews(fixedLineSpacing: CGFloat,\n                                      fixedInteritemSpacing: CGFloat,\n                                      warpCount: Int,\n                                      edgeInset: UIEdgeInsets = UIEdgeInsets.zero) {\n        \n        guard self.array.count > 1, warpCount >= 1, let tempSuperView = commonSuperviewOfViews() else {\n            return\n        }\n        \n        let columnCount = warpCount\n        let rowCount = self.array.count % warpCount == 0 ? self.array.count / warpCount : self.array.count / warpCount + 1;\n        \n        var prev : ConstraintView?\n        \n        for (i,v) in self.array.enumerated() {\n            \n            let currentRow = i / warpCount\n            let currentColumn = i % warpCount\n            \n            v.snp.makeConstraints({ (make) in\n                if prev != nil {\n                    make.width.height.equalTo(prev!)\n                }\n                if currentRow == 0 {//fisrt row\n                    make.top.equalTo(tempSuperView).offset(edgeInset.top)\n                }\n                if currentRow == rowCount - 1 {//last row\n                    if currentRow != 0 && i - columnCount >= 0 {\n                        make.top.equalTo(self.array[i-columnCount].snp.bottom).offset(fixedLineSpacing)\n                    }\n                    make.bottom.equalTo(tempSuperView).offset(-edgeInset.bottom)\n                }\n                \n                if currentRow != 0 && currentRow != rowCount - 1 {//other row\n                    make.top.equalTo(self.array[i-columnCount].snp.bottom).offset(fixedLineSpacing);\n                }\n                \n                if currentColumn == 0 {//first col\n                    make.left.equalTo(tempSuperView).offset(edgeInset.left)\n                }\n                if currentColumn == warpCount - 1 {//last col\n                    if currentColumn != 0 {\n                        make.left.equalTo(prev!.snp.right).offset(fixedInteritemSpacing)\n                    }\n                    make.right.equalTo(tempSuperView).offset(-edgeInset.right)\n                }\n                \n                if currentColumn != 0 && currentColumn != warpCount - 1 {//other col\n                    make.left.equalTo(prev!.snp.right).offset(fixedInteritemSpacing);\n                }\n            })\n            prev = v\n        }\n    }\n    \n    \n    \n    \n    \n    public var target: AnyObject? {\n        return self.array as AnyObject\n    }\n    \n    internal let array: Array<ConstraintView>\n    \n    internal init(array: Array<ConstraintView>) {\n        self.array = array\n        \n    }\n    \n}\n\nprivate extension ConstraintArrayDSL {\n    func commonSuperviewOfViews() -> ConstraintView? {\n        var commonSuperview : ConstraintView?\n        var previousView : ConstraintView?\n        \n        for view in self.array {\n            if previousView != nil {\n                commonSuperview = view.closestCommonSuperview(commonSuperview)\n            }else {\n                commonSuperview = view\n            }\n            previousView = view\n        }\n        \n        return commonSuperview\n    }\n}\n\nprivate extension ConstraintView {\n    func closestCommonSuperview(_ view : ConstraintView?) -> ConstraintView? {\n        var closestCommonSuperview: ConstraintView?\n        var secondViewSuperview: ConstraintView? = view\n        while closestCommonSuperview == nil && secondViewSuperview != nil {\n            var firstViewSuperview: ConstraintView? = self\n            while closestCommonSuperview == nil && firstViewSuperview != nil {\n                if secondViewSuperview == firstViewSuperview {\n                    closestCommonSuperview = secondViewSuperview\n                }\n                firstViewSuperview = firstViewSuperview?.superview\n            }\n            secondViewSuperview = secondViewSuperview?.superview\n        }\n        return closestCommonSuperview\n        \n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/Strings/String+Date.swift",
    "content": "//\n//  String+Date.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport Foundation\nimport SwiftDate\n\nextension String {\n    \n    /// 通用时间 HH:mm MM-dd\n    ///\n    /// - Returns: 本地时间\n    func commonDateString() -> String? {\n        let region = Region.current\n        let update = self.toISODate(region: region)\n        let date = update?.date.convertTo(region: region)\n        let now = date?.toFormat(\"HH:mm MM-dd\", locale: region.locale)\n        return now\n    }\n    \n    /// 日期时间 yyyy-MM-dd HH:mm:ss\n    ///\n    /// - Returns: 本地时间\n    func allDateString() -> String? {\n        let region = Region.current\n        let update = self.toISODate(region: region)\n        let date = update?.date.convertTo(region: region)\n        let now = date?.toFormat(\"yyyy-MM-dd HH:mm:ss\", locale: region.locale)\n        return now\n    }\n    \n    /// 日期 yyyy-MM-dd\n    ///\n    /// - Returns: 本地时间\n    func dateDayString() -> String? {\n        let region = Region.current\n        let update = self.toISODate(region: region)\n        let date = update?.date.convertTo(region: region)\n        let now = date?.toFormat(\"yyyy-MM-dd\", locale: region.locale)\n        return now\n    }\n    \n    /// 日期 yyyy.MM.dd\n    ///\n    /// - Returns: 本地时间\n    func dotDateString() -> String? {\n        let region = Region.current\n        let update = self.toISODate(region: region)\n        let date = update?.date.convertTo(region: region)\n        let now = date?.toFormat(\"yyyy.MM.dd\", locale: region.locale)\n        return now\n    }\n    \n    /**\n     时间戳转为时间\n     \n     - returns: 时间字符串\n     */\n    func timeStampToString() -> String {\n        let string = NSString(string: self)\n        let timeSta: TimeInterval = string.doubleValue / 1000.0\n        let dfmatter = DateFormatter()\n        dfmatter.dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n        let date = Date(timeIntervalSince1970: timeSta)\n        return dfmatter.string(from: date)\n    }\n    \n    /**\n     时间戳转为NSDate\n     \n     - returns: NSDate\n     */\n    func timeStampToDate() -> Date {\n        let string = NSString(string: self)\n        let timeSta: TimeInterval = string.doubleValue\n        let date = Date(timeIntervalSince1970: timeSta)\n        return date\n    }\n    \n    /**\n     时间转为时间戳\n     \n     - returns: 时间戳字符串\n     */\n    func stringToTimeStamp() -> String {\n        let dfmatter = DateFormatter()\n        dfmatter.dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n        let date = dfmatter.date(from: self)\n        let dateStamp: TimeInterval = date!.timeIntervalSince1970\n        let dateSt:Int = Int(dateStamp)\n        return String(dateSt)\n    }\n    \n    \n    /**\n     时间戳处理(当前时间比较)\n     \n     - returns: 对比时间\n     */\n    func compareCurrentTime() -> String {\n        let string = NSString(string: self)\n        let formatter = DateFormatter()\n        formatter.dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n        let timeDate = formatter.date(from: string as String)\n        let currentDate = Date()\n        let timeInterval: TimeInterval = currentDate.timeIntervalSince(timeDate!)\n        \n        var temp: Double = 0\n        var result = String()\n        if (timeInterval/60 < 1) {\n            result = \"刚刚\"\n        }else if ((timeInterval/60)<60){\n            temp = timeInterval/60\n            result = String(format:\"%ld分钟前\", Int(temp))\n            \n        }else if ((timeInterval/60/60)<24){\n            temp = timeInterval/60/60\n            result = String(format:\"%ld小时前\", Int(temp))\n            \n        }else if ((timeInterval/60/60/24)<30){\n            temp = timeInterval/60/60/24\n            result = String(format:\"%ld天前\", Int(temp))\n            \n        }else if ((timeInterval/60/60/24/30)<12){\n            temp = timeInterval/60/60/24/30\n            result = String(format:\"%ld月前\", Int(temp))\n            \n        }else{\n            temp = timeInterval/60/60/24/30/12;\n            result = String(format:\"%ld年前\", Int(temp))\n        }\n        \n        return result\n    }\n    \n    \n    /**\n     传入cell文本内容，解析成元素为昵称的数组\n     \n     - returns: 昵称数组\n     */\n    func checkAtUserNickname() -> [String]? {\n        do {\n            let pattern = \"@\\\\S*\"\n            let regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpression.Options.caseInsensitive)\n            let results = regex.matches(in: self, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, self.length))\n            \n            var resultStrings = [String]()\n            for result in results {\n                resultStrings.append(String((self as NSString).substring(with: result.range)))\n            }\n            return resultStrings\n        }\n        catch {\n            return nil\n        }\n    }\n    \n    \n    func validNumber() -> Bool{\n        do {\n            let pattern = \"^[0-9]*$\"\n            let regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpression.Options.caseInsensitive)\n            let results = regex.matches(in: self, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, self.length))\n            \n            return results.count > 0\n            \n        }catch {\n            return false\n        }\n        \n    }\n    \n    \n    /// 获取文本的最大高度\n    func getTextMaxHeigh(_ font: UIFont, width:CGFloat) -> CGFloat {\n        let normalText = NSString.init(string: self)\n        let size = CGSize(width: width, height: 1000)\n        let dic: [NSAttributedString.Key: Any] = [NSAttributedString.Key(rawValue: NSAttributedString.Key.font.rawValue): font]\n        let stringSize = normalText.boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: dic, context:nil).size\n        return stringSize.height\n    }\n    \n    /// 获取文本的最大宽度\n    func getTextMaxWidth(_ font: UIFont, height: CGFloat) -> CGFloat {\n        let normalText = NSString.init(string: self)\n        let size = CGSize(width: 1000, height: height)\n        let dic:[NSAttributedString.Key: Any] = [NSAttributedString.Key(rawValue: NSAttributedString.Key.font.rawValue): font]\n        let stringSize = normalText.boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: dic, context:nil).size\n        return stringSize.width\n    }\n}\n\n// MARK: - 当前时间比较\n\nextension String {\n    \n    func detailDate24Week(time: Double, format: String = \"yyyy-MM-dd HH:mm:ss\") -> String{\n        let formatter = DateFormatter()\n        formatter.dateStyle = DateFormatter.Style.medium\n        formatter.timeStyle = DateFormatter.Style.short\n        formatter.dateFormat = format\n        let timeInterval = TimeInterval(time / 1000.0)\n        \n        //获取到Date\n        let confromTimeDate = Date.init(timeIntervalSince1970: timeInterval)\n        var calender = NSCalendar.current\n        let unitFlags = Set<Calendar.Component>([.year,.month,.day,.hour,.minute])\n        \n        let comp = calender.dateComponents(unitFlags, from: Date())\n        _ = String(comp.year!)\n        _ = String(comp.day!)\n        \n        let comp2 = calender.dateComponents(unitFlags, from: confromTimeDate)\n        _ = String(comp2.year!)\n        _ = String(comp2.month!)\n        _ = String(comp2.day!)\n        \n        var hour = String(comp2.hour!)\n        var minute = String(comp2.minute!)\n        \n        // 设置区域\n        calender.locale = Locale.init(identifier: \"zh_CN\")\n        // 设置时区\n        /*\n         设置时区，设置为 GMT+8，即北京时间(+8)\n         */\n        calender.timeZone = TimeZone.init(abbreviation: \"EST\")!\n        calender.timeZone = TimeZone.init(secondsFromGMT: +28800)!\n        // 设定每周的第一天从星期几开始\n        /*\n         1 代表星期日开始，2 代表星期一开始，以此类推。默认值是 1\n         */\n        calender.firstWeekday = 1\n        \n        //ordinalityOfUnit\n        let timeWeek = calender.component(.weekOfYear, from: confromTimeDate)\n        let systimeWeek = calender.component(.weekOfYear, from: Date.init())\n        \n        if calender.isDateInToday(confromTimeDate) {\n            if hour.doubleValue < 10 {\n                hour = \"0\\(hour)\"\n            }\n            if minute.doubleValue < 10 {\n                minute = \"0\\(minute)\"\n            }\n            \n            return \"今天\".rLocalized() + \" \\(hour):\\(minute)\"\n            \n        }else if calender.isDateInYesterday(confromTimeDate) {\n            if hour.doubleValue < 10 {\n                hour = \"0\\(hour)\"\n            }\n            if minute.doubleValue < 10 {\n                minute = \"0\\(minute)\"\n            }\n            \n            return \"昨天\".rLocalized() + \" \\(hour):\\(minute)\"\n            \n        }else if timeWeek == systimeWeek {\n            let weeks = [\"星期日\".rLocalized(),\n                         \"星期一\".rLocalized(),\n                         \"星期二\".rLocalized(),\n                         \"星期三\".rLocalized(),\n                         \"星期四\".rLocalized(),\n                         \"星期五\".rLocalized(),\n                         \"星期六\".rLocalized()]\n            let i = calender.ordinality(of: .weekday, in: .weekOfYear, for: confromTimeDate)\n            //此处一定要记得减1\n            return weeks[i!-1]\n            \n        }else {\n            \n            return self.getCurrentTime(timeNum: time, format: \"MM-dd\")\n        }\n        \n    }\n     \n    //MARK: - 时间格式转换\"YYYY-MM-dd HH:mm:ss\"\n    func getCurrentTime(timeNum:Double , format:String) -> String {\n        let formatter = DateFormatter()\n        formatter.dateStyle = DateFormatter.Style.medium\n        formatter.timeStyle = DateFormatter.Style.short\n        formatter.dateFormat = format\n        let timeInterval = TimeInterval(timeNum / 1000.0)\n        let confromTimesp = NSDate(timeIntervalSince1970:timeInterval)\n        let confromTimespStr = formatter.string(from: confromTimesp as Date)\n        return confromTimespStr\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/Strings/String+Extension.swift",
    "content": "\n//\n//  String+Extension.swift\n//  String+Extension\n//\n//  Created by TAN on 2017/10/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport CommonCrypto\nimport UIKit\n\n\nextension String {\n    \n    /// 截取第一个到第任意位置\n    ///\n    /// - Parameter end: 结束的位值\n    /// - Returns: 截取后的字符串\n    public func stringCut(end: Int) -> String{\n        if !(end <= count) { return self }\n        let sInde = index(startIndex, offsetBy: end)\n        return String(self[..<sInde])\n    }\n    \n    /// 截取任意位置到结束\n    ///\n    /// - Parameter end:\n    /// - Returns: 截取后的字符串\n    public func stringCutToEnd(star: Int) -> String {\n        if !(star < count) { return \"截取超出范围\" }\n        let sRang = index(startIndex, offsetBy: star)..<endIndex\n        return String(self[sRang])\n    }\n    \n    /// 截取最后几位\n    ///\n    /// - Parameter last:\n    /// - Returns: 截取后的字符串\n    public func stringCutLastEnd(last: Int) -> String {\n        if !(last < count) { return \"截取超出范围\" }\n        let sRang = index(endIndex, offsetBy: -last)..<endIndex\n        return String(self[sRang])\n    }\n    \n    /// 字符串任意位置插入\n    ///\n    /// - Parameters:\n    ///   - content: 插入内容\n    ///   - locat: 插入的位置\n    /// - Returns: 添加后的字符串\n    public func stringInsert(content: String, locat: Int) -> String {\n        if !(locat < count) { return \"操作超出范围\" }\n        let str1 = stringCut(end: locat)\n        let str2 = stringCutToEnd(star: locat)\n        return str1 + content + str2\n    }\n    \n    \n    /// JSON字符串转字典\n    ///\n    /// - Parameter jsonString: json字符串\n    /// - Returns: 转成后的字典\n    func getDictionaryFromJSONString(_ jsonString: String) ->NSDictionary {\n        let jsonData:Data = jsonString.data(using: .utf8)!\n        let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)\n        if dict != nil {\n            return dict as! NSDictionary\n        }\n        return NSDictionary()\n    }\n    \n    \n    /// JSON字符串转数组\n    ///\n    /// - Parameter jsonString: json字符串\n    /// - Returns: 转成后的数组\n    func getArrayFromJSONString(jsonString:String) ->NSArray{\n        \n        let jsonData:Data = jsonString.data(using: .utf8)!\n        \n        let array = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)\n        if array != nil {\n            return array as! NSArray\n        }\n        return array as! NSArray\n    }\n    \n    \n    /// 字典转成JSON字符串\n    ///\n    /// - Parameter dictionary: 字典\n    /// - Returns: 转成后的字符串\n    func getJSONStringFromDictionary(_ dictionary: NSDictionary) -> String {\n        if (!JSONSerialization.isValidJSONObject(dictionary)) {\n            print(\"无法解析出JSONString\")\n            return \"\"\n        }\n        let data : NSData! = try? JSONSerialization.data(withJSONObject: dictionary, options: []) as NSData\n        let JSONString = NSString(data:data as Data, encoding: String.Encoding.utf8.rawValue)\n        return JSONString! as String\n    }\n    \n    \n    /// 数组转JSON字符串\n    ///\n    /// - Parameter array: 数组\n    /// - Returns: 转成后的字符串\n    func getJSONStringFromArray(array:NSArray) -> String {\n        if (!JSONSerialization.isValidJSONObject(array)) {\n            print(\"无法解析出JSONString\")\n            return \"\"\n        }\n        \n        let data : Data = try! JSONSerialization.data(withJSONObject: array, options: []) as Data\n        let JSONString = NSString(data:data as Data,encoding: String.Encoding.utf8.rawValue)\n        return JSONString! as String\n        \n    }\n    \n    /// 计算字符串的尺寸\n    ///\n    /// - Parameters:\n    ///   - text: 字符串\n    ///   - rectSize: 容器的尺寸\n    ///   - fontSize: 字体\n    /// - Returns: 尺寸\n    ///\n    public func getStringSize(rectSize: CGSize, fontSize: CGFloat) -> CGSize {\n        let str: NSString = self as NSString\n        let rect = str.boundingRect(with: rectSize, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: fontSize)], context: nil)\n        return CGSize(width: ceil(rect.width), height: ceil(rect.height))\n    }\n    \n    public func getStringSize(fontSize: CGFloat) -> CGSize {\n        return self.getStringSize(rectSize: CGSize(width: CGFloat(MAXFLOAT), height: CGFloat(MAXFLOAT)), fontSize: fontSize)\n    }\n    \n    /// 输入字符串 输出数组\n    /// e.g  \"qwert\" -> [\"q\",\"w\",\"e\",\"r\",\"t\"]\n    /// - Returns: [\"q\",\"w\",\"e\",\"r\",\"t\"]\n    public func stringToArr() -> [String] {\n        let num = count\n        if !(num > 0) { return [\"\"] }\n        var arr: [String] = []\n        for i in 0..<num {\n            let tempStr: String = self[self.index(self.startIndex, offsetBy: i)].description\n            arr.append(tempStr)\n        }\n        return arr\n    }\n    \n    /// 字符串截取         3  6\n    /// e.g let aaa = \"abcdefghijklmnopqrstuvwxyz\"  -> \"cdef\"\n    /// - Parameters:\n    ///   - start: 开始位置 3\n    ///   - end: 结束位置 6\n    /// - Returns: 截取后的字符串 \"cdef\"\n    public func startToEnd(start: Int,end: Int) -> String {\n        if !(end < count) || start > end { return \"取值范围错误\" }\n        var tempStr: String = \"\"\n        for i in start...end {\n            let temp: String = self[self.index(self.startIndex, offsetBy: i - 1)].description\n            tempStr += temp\n        }\n        return tempStr\n    }\n    \n    /// 字符串修改部分为密文\n    ///\n    /// - Parameters:\n    ///   - start: 开始位置\n    ///   - end: 结束为止\n    /// - Returns: 修改后的字符串\n    func stringAddSecret(start: Int, end: Int) -> String{\n        if !(end < count) || start > end { return \"取值范围错误\" }\n        let startI = self.index(self.startIndex, offsetBy: start)\n        \n        let offset = count - start - end\n        let endI = self.index(startI, offsetBy: offset)\n        let secret = String.init(repeating: \"*\", count: offset)\n        let string = self.replacingCharacters(in: startI..<endI, with: secret)\n        return string\n    }\n    \n    /// 字符URL格式化,中文路径encoding\n    ///\n    /// - Returns: 格式化的 url\n    public func stringEncoding() -> String {\n        let url = self.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)\n        return url!\n    }\n    \n    /// 字符URL格式化,防止被转义\n    ///\n    /// - Returns: 格式化的 url\n    public func stringEncod() -> String {\n        let url = self.stringEncoding()\n        let result = url.removingPercentEncoding ?? \"\"\n        return result\n    }\n    \n    /// 是否包含字符串\n    public func containsIgnoringCase(find: String) -> Bool{\n        return self.range(of: find, options: .caseInsensitive) != nil\n    }\n    \n    /// 去除字符串中空格\n    public func trimming() -> String {\n        return self.replacingOccurrences(of: \" \", with: \"\").trimmingCharacters(in: CharacterSet.urlPathAllowed)\n    }\n    \n    /// MD5加密1\n    public func md51() -> String {\n        let str = self.cString(using: String.Encoding.utf8)\n        let strLen = CUnsignedInt(self.lengthOfBytes(using: String.Encoding.utf8))\n        let digestLen = Int(CC_MD5_DIGEST_LENGTH)\n        let result = UnsafeMutablePointer<UInt8>.allocate(capacity: 16) //16位加密\n        CC_MD5(str!, strLen, result)\n        let hash = NSMutableString()\n        for i in 0 ..< digestLen {\n            hash.appendFormat(\"%02x\", result[i])\n        }\n        free(result)\n        return String(format: hash as String)\n    }\n    \n\n    /// 限制设置为整数\n    ///\n    /// - Returns: 只返回整数的字符串\n    func getDigits() -> String {\n        return String(self.filter {\n            if let value = $0.int, value >= 0 && value <= 9 {\n                return true\n            }\n            return false\n        })\n    }\n}\n\nextension String {\n    /// MD5加密\n    var ios_md5 : String{\n        let str = self.cString(using: String.Encoding.utf8)\n        let strLen = CC_LONG(self.lengthOfBytes(using: String.Encoding.utf8))\n        let digestLen = Int(CC_MD5_DIGEST_LENGTH)\n        let result = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: digestLen)\n        \n        CC_MD5(str!, strLen, result)\n        \n        let hash = NSMutableString()\n        for i in 0 ..< digestLen {\n            hash.appendFormat(\"%02x\", result[i])\n        }\n        result.deinitialize(count: 16)\n        \n        return String(format: hash as String)\n    }\n}\n\nextension NSString{\n    ///修改字符串中数字样式\n    @objc\n    public func attributeNumber(_ fontsize :CGFloat,color:UIColor,hcolor:UIColor,B:Bool)-> NSMutableAttributedString{\n       return (self as String).attributeNumber(fontsize, color: color, hcolor: hcolor, B: B)\n    }\n}\n\nextension String {\n    /// 删除字符串中Unicode.Cc/Cf字符,类似于\\0这种\n    public func stringByRemovingControlCharacters() -> String {\n        let controlChars = CharacterSet.controlCharacters\n        var range = self.rangeOfCharacter(from: controlChars)\n        var mutable = self\n        while let removeRange = range {\n            mutable.removeSubrange(removeRange)\n            range = mutable.rangeOfCharacter(from: controlChars)\n        }\n        return mutable\n    }\n    \n    /// 修改字符串中数字样式,将其加粗,变黑,加大4个字号,同时修改行间距\n    ///\n    /// - Parameters:\n    ///   - fontsize: 非数字字号\n    ///   - color: 非数字颜色\n    ///   - lineSpace: 行间距\n    /// - Returns: 修改完成的AttributedString\n    public func attributeNumber(BoldFontSize fontsize:CGFloat, color:UIColor,lineSpace:CGFloat?)->NSMutableAttributedString{\n        let AttributedStr = NSMutableAttributedString(string: self, attributes: [.font: UIFont.systemFont(ofSize: fontsize), .foregroundColor: color])\n        for i in 0 ..< self.count {\n            let char = self.utf8[self.index(self.startIndex, offsetBy: i)]\n            if (char > 47 && char < 58) {\n                AttributedStr.addAttribute(.foregroundColor, value: UIColor(red: 33 / 255.0, green: 34 / 255.0, blue: 35 / 255.0, alpha: 1), range: NSRange(location: i, length: 1))\n                AttributedStr.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: fontsize + 4), range: NSRange(location: i, length: 1))\n            }\n        }\n        if let space = lineSpace {\n            let paragraphStyleT = NSMutableParagraphStyle()\n            paragraphStyleT.lineSpacing = space\n            AttributedStr.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyleT, range: NSMakeRange(0,self.count))\n        }\n        return AttributedStr\n    }\n    \n    /// 给字符串中数字变样式\n    ///\n    /// - Parameters:\n    ///   - fontsize: 字体大小\n    ///   - color: 非数字颜色\n    ///   - hcolor: 数字颜色\n    ///   - B: 是否加粗变大\n    /// - Returns: 修改完成字符串\n    public func attributeNumber(_ fontsize :CGFloat,color:UIColor,hcolor:UIColor,B:Bool)-> NSMutableAttributedString{\n        let AttributedStr = NSMutableAttributedString(string: self, attributes: [.font: UIFont.systemFont(ofSize: fontsize), .foregroundColor: color])\n        for i in 0 ..< self.count {\n            let char = self.utf8[self.index(self.startIndex, offsetBy: i)]\n            if (char > 47 && char < 58) {\n                AttributedStr.addAttribute(.foregroundColor, value: hcolor, range: NSRange(location: i, length: 1))\n                if B {\n                    AttributedStr.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: fontsize + 2), range: NSRange(location: i, length: 1))\n                }\n            }\n        }\n        return AttributedStr\n    }\n    \n    \n    /// 字符串修改行间距和字间距\n    ///\n    /// - Parameters:\n    ///   - lineSpace: 行间距\n    ///   - wordSpace: 字间距\n    /// - Returns: 修改完成字符串\n    public func attributeChangeSpace(lineSpace:CGFloat, wordSpace:CGFloat) -> NSMutableAttributedString {\n\n        let attributedString = NSMutableAttributedString.init(string: self, attributes: [NSAttributedString.Key.kern:wordSpace])\n        let paragraphStyle = NSMutableParagraphStyle()\n        paragraphStyle.lineSpacing = lineSpace\n        attributedString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: .init(location: 0, length: self.count))\n        return attributedString\n    }\n\n    \n    /// 指定文本内容字体变色\n    ///\n    /// - Parameters:\n    ///   - fontSize: 字体大小\n    ///   - allColor:的字体颜色\n    ///   - changedColor: 需要改变的颜色\n    ///   - normalContent: 不设置变色的文本\n    ///   - richContent: 需设置变色的文本\n    /// - Returns: 返回富文本\n    public func attributeSpecified(_ font :UIFont, originalColor: UIColor, changedColor: UIColor, normalContent: String, richContent: String)-> NSMutableAttributedString{\n        guard normalContent.length > 0, richContent.length > 0 else {\n            return NSMutableAttributedString.init()\n        }\n        \n        // 所有文本内容\n        let allContent = normalContent\n        let attributedStr = NSMutableAttributedString(string: allContent)\n        \n        let range1: NSRange = NSRange(location: (attributedStr.string as NSString).range(of: normalContent).location, length: (attributedStr.string as NSString).range(of: normalContent).length)\n        \n        let range2: NSRange = NSRange(location: (attributedStr.string as NSString).range(of: richContent).location, length: (attributedStr.string as NSString).range(of: richContent).length)\n        \n        attributedStr.addAttributes([NSAttributedString.Key.font: font,\n                                     NSAttributedString.Key.foregroundColor : originalColor], range: range1)\n        \n        attributedStr.addAttributes([NSAttributedString.Key.font: font,\n                                     NSAttributedString.Key.foregroundColor : changedColor], range: range2)\n        \n        return attributedStr;\n    }\n    \n    \n    /// 替换手机号中间四位\n    ///\n    /// - Returns: 替换后的值\n    func replacePhone() -> String {\n        let start = self.index(self.startIndex, offsetBy: 3)\n        let end = self.index(self.startIndex, offsetBy: 7)\n        let range = Range(uncheckedBounds: (lower: start, upper: end))\n        return self.replacingCharacters(in: range, with: \"****\")\n    }\n}\n\nextension String {\n    public var length: Int {\n        ///更改成其他的影响含有emoji协议的签名\n        return self.utf16.count\n    }\n    public var doubleValue: Double {\n        return (self as NSString).doubleValue\n    }\n    public var intValue: Int32 {\n        return (self as NSString).intValue\n    }\n    public var floatValue: Float {\n        return (self as NSString).floatValue\n    }\n    public var integerValue: Int {\n        return (self as NSString).integerValue\n    }\n    public var longLongValue: Int64 {\n        return (self as NSString).longLongValue\n    }\n    public var boolValue: Bool {\n        return (self as NSString).boolValue\n    }\n}\n\npublic protocol URLConvertibleProtocol {\n    var URLValue: URL? { get }\n    var URLStringValue: String { get }\n}\n\nextension String: URLConvertibleProtocol {\n    ///String转换成URL\n    public var URLValue: URL? {\n        if let URL = URL(string: self) {\n            return URL\n        }\n        let set = CharacterSet()\n            .union(.urlHostAllowed)\n            .union(.urlPathAllowed)\n            .union(.urlQueryAllowed)\n            .union(.urlFragmentAllowed)\n        return self.addingPercentEncoding(withAllowedCharacters: set).flatMap { URL(string: $0) }\n    }\n    public var URLStringValue: String {\n        return self\n    }\n}\n\nextension String{\n    /**\n     将当前字符串拼接到cache目录后面\n     */\n    public func cacheDir() -> String{\n        let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last!\n        return (path as NSString).appendingPathComponent((self as NSString).lastPathComponent)\n    }\n    /**\n     将当前字符串拼接到doc目录后面\n     */\n    public func docDir() -> String{\n        let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).first!\n        return (path as NSString).appendingPathComponent((self as NSString).lastPathComponent)\n    }\n    /**\n     将当前字符串拼接到tmp目录后面\n     */\n    public func tmpDir() -> String{\n        let path = NSTemporaryDirectory() as NSString\n        return path.appendingPathComponent((self as NSString).lastPathComponent)\n    }\n}\n\nextension String{\n    ///判断String是否存在汉字\n    public func isIncludeChineseIn() -> Bool {\n        for (_, value) in self.enumerated() {\n            if (\"\\u{4E00}\" <= value  && value <= \"\\u{9FA5}\") {\n                return true\n            }\n        }\n        return false\n    }\n}\n\n// MARK: - 通用正则处理\nextension String {\n    \n    // MARK: -  字符输入长度限制\n    func trimAll(_ trim: String, rangeCount: Int) -> Bool {\n        \n        if (trim.lengthOfBytes(using: String.Encoding.utf8) == rangeCount) {\n            printLog(\"输入限制为%d个字符\")\n            return false\n        }else {\n            return true\n        }\n    }\n    \n    // MARK: 用户名正则表达式\n    func validateUserName() -> Bool {\n        let phoneRegex = try? NSRegularExpression(pattern: \"^[A-Za-z0-9]{3,20}$\", options: NSRegularExpression.Options.caseInsensitive)\n        return phoneRegex?.firstMatch(in: self, options: [], range: NSMakeRange(0, self.length)) != nil\n    }\n    \n    // MARK: 手机号正则表达式\n    func validateMobile() -> Bool {\n        let phoneRegex = try? NSRegularExpression(pattern: \"^1(3[0-9]|5[0-35-9]|8[02345-9]|70|77)\\\\d{8}$\", options: NSRegularExpression.Options.caseInsensitive)\n        return phoneRegex?.firstMatch(in: self, options: [], range: NSMakeRange(0, self.length)) != nil\n    }\n    \n    // MARK: - 图形验证码正则表达式\n    func validatePicture() -> Bool {\n        let pictureCodeRegex: String = \"^(?![0-9]+$)(?![a-zA-Z]+$)[a-zA-Z0-9]{4}\"\n        let pictureCodeTest = NSPredicate(format: \"SELF MATCHES\", pictureCodeRegex)\n        return pictureCodeTest.evaluate(with: self)\n    }\n    \n    // MARK: 邮箱正则表达式\n    func validateEmail() -> Bool {\n        let emailRegex = try? NSRegularExpression(pattern: \"[\\\\w!#$%&'*+/=?^_`{|}~-]+(?:\\\\.[\\\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\\\w](?:[\\\\w-]*[\\\\w])?\\\\.)+[\\\\w](?:[\\\\w-]*[\\\\w])?\", options: NSRegularExpression.Options.caseInsensitive)\n        return emailRegex?.firstMatch(in: self, options: [], range: NSMakeRange(0, self.length)) != nil\n    }\n    \n    // MARK: 密码正则表达式（6-16位密码且包含英文字母和数字组合，不能使用特殊字符）\n    func validatePassword() -> Bool {\n        let passwordRegex: String = \"^(?![0-9]+$)(?![a-zA-Z]+$)[a-zA-Z0-9]{8,16}\"\n        let passwordTest = NSPredicate(format: \"SELF MATCHES %@\", passwordRegex)\n        return passwordTest.evaluate(with: self)\n    }\n    \n    // MARK: 邮政编码正则表达式（中国邮政编码为6位数字）\n    func validateZipCode() -> Bool {// [1-9]\\d{5}(?!\\d)$\n        let zipCodeRegex: String = \"[1-9]\\\\d{5}(?!\\\\d)$\"\n        let zipCodeTest = NSPredicate(format: \"SELF MATCHES %@\", zipCodeRegex)\n        return zipCodeTest.evaluate(with: self)\n    }\n    \n    // MARK: 纯数字正则表达式\n    func validateShouldNum() -> Bool {\n        if self.length <= 0 {\n            return false\n        }\n        let shouldNumRegex: String = \"[0-9]*\"\n        let shouldNumTest = NSPredicate(format: \"SELF MATCHES %@\", shouldNumRegex)\n        return shouldNumTest.evaluate(with: self)\n    }\n    \n    // MARK: 身份证正则表达式\n    func validIDCardNumber() -> Bool{\n        do {\n            let pattern = \"(^[0-9]{15}$)|([0-9]{17}([0-9]|X)$)\"\n            let regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpression.Options.caseInsensitive)\n            let results = regex.matches(in: self, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, self.length))\n            \n            return results.count > 0\n            \n        }catch {\n            return false\n        }\n    }\n}\n\n\n// MARK: - 字符复制\n\nextension String {\n    \n    /// 字符串复制\n    public func stringGeneral() {\n        guard self.length > 0 else {\n            printLog(\"复制内容不能为空\")\n            return\n        }\n        \n        UIPasteboard.general.string = self\n        MBConfiguredHUD.showSuccess(\"复制成功\")\n    }\n\n}\n\n\nextension String {\n    \n    /// 拓展方法\n    var utf8Encoded: Data {\n        return data(using: .utf8)!\n    }\n    \n    func urlEncoded() -> String {\n        let encodeUrlString = self.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)\n        return encodeUrlString ?? \"\"\n    }\n}\n\n\nextension String {\n    static func randomCode(length:Int) -> String {\n        let base = pow(10, length - 1) as NSDecimalNumber\n        let max = (pow(10, length) - (base as Decimal) - 1) as NSDecimalNumber\n        let code = String(Int(arc4random_uniform(UInt32(max.intValue))) + base.intValue)\n        return code\n    }\n}\n\n\nextension String {\n    /// 是否包含空/空格字符\n    var isBlank: Bool {\n        return allSatisfy({ $0.isWhitespace })\n    }\n}\n\nextension Optional where Wrapped == String {\n    var isBlank: Bool {\n        return self?.isBlank ?? true\n    }\n}\n\n\nextension String {\n    \n    /// 获取文字的宽高 空字符串高度为字体高度\n    ///\n    /// - Parameters:\n    ///   - maxWidth: 空间的最大宽度\n    ///   - font: 文字字体\n    /// - Returns: 返回计算好的size\n    func textSize(_ maxWidth: CGFloat, font: UIFont) -> CGSize {\n        let constraint = CGSize(width: maxWidth, height: CGFloat.greatestFiniteMagnitude)\n        let rect = self.boundingRect(with: constraint, options: ([.usesLineFragmentOrigin]), attributes: [NSAttributedString.Key.font: font], context: nil)\n        return CGSize(width: ceil(rect.width), height: ceil(rect.height))\n    }\n    \n    /// 获取文字的每一行字符串 空字符串为空数组\n    ///\n    /// - Parameters:\n    ///   - maxWidth: 空间的最大宽度\n    ///   - font: 文字字体\n    /// - Returns: 返回计算好的行字符串\n    func textLines(_ maxWidth: CGFloat, font: UIFont) -> [String] {\n        let myFont = CTFontCreateWithName(font.fontName as CFString, font.pointSize, nil)\n        \n        let attStr = NSMutableAttributedString(string: self)\n        let paragraphStyle = NSMutableParagraphStyle()\n        paragraphStyle.lineBreakMode = .byCharWrapping\n        \n        attStr.addAttribute(.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attStr.length))\n        attStr.addAttribute(NSAttributedString.Key(kCTFontAttributeName as String), value: myFont, range: NSRange(location: 0, length: attStr.length))\n        let frameSetter = CTFramesetterCreateWithAttributedString(attStr)\n        \n        let path = CGMutablePath()\n        path.addRect(CGRect(x: 0, y: 0, width:maxWidth, height: 100000), transform: .identity)\n        \n        let frame = CTFramesetterCreateFrame(frameSetter, CFRangeMake(CFIndex(0), CFIndex(0)), path, nil)\n        let lines = CTFrameGetLines(frame) as? [AnyHashable]\n        var linesArray: [String] = []\n        \n        for line in lines ?? [] {\n            let lineRange = CTLineGetStringRange(line as! CTLine)\n            let range = NSRange(location: lineRange.location, length: lineRange.length)\n            \n            let lineString = (self as NSString).substring(with: range)\n            CFAttributedStringSetAttribute(attStr, lineRange, kCTKernAttributeName, (NSNumber(value: 0.0)))\n            linesArray.append(lineString)\n        }\n        return linesArray\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIColor/UIColor+Extension.swift",
    "content": "//\n//  UIColor+Extend.swift\n//  UIColor\n//\n//  Created by TAN on 2018/8/30.\n//  Copyright © 2018年 iOS. All rights reserved.\n//  UIColor使用拓展\n\nimport UIKit\n\nextension UIColor {\n    \n    /// 16进制转化Color\n    ///\n    /// - Parameter hex: 16进制\n    /// - Returns: Color\n    class func colorWithHexStr(_ hex: String) -> UIColor {\n        \n        var cString = hex.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).uppercased()\n        \n        if (cString.hasSuffix(\"#\")) {\n            let index = cString.index(cString.startIndex, offsetBy: 1)\n            //cString = cString.substring(from: index)\n            cString = String(cString[index...]) // Swift 4\n        }\n        \n        if (cString.count != 6) {\n            \n            return UIColor.red\n        }\n    \n        let rIndex = cString.index(cString.startIndex, offsetBy: 2)\n        //let rString = cString.substring(to: rIndex)\n        let rString = String(cString[..<rIndex])\n        \n        //let otherString = cString.substring(from: rIndex)\n        let otherString = String(cString[rIndex...])\n        \n        let gIndex = otherString.index(otherString.startIndex, offsetBy: 2)\n        \n        //let gString = otherString.substring(to: gIndex)\n        let gString =  String(otherString[..<gIndex])\n        \n        let bIndex = cString.index(cString.endIndex, offsetBy: -2)\n        //let bString = cString.substring(from: bIndex)\n        let bString = String(cString[bIndex...])\n        \n        var r:CUnsignedInt = 0, g:CUnsignedInt = 0, b:CUnsignedInt = 0;\n        Scanner(string: rString).scanHexInt32(&r)\n        Scanner(string: gString).scanHexInt32(&g)\n        Scanner(string: bString).scanHexInt32(&b)\n        \n        return UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: (1))\n    }\n    \n    \n    /// 16进制转化Color\n    ///\n    /// - Parameters:\n    ///   - hex: 16进制\n    ///   - alpha: 透明度\n    /// - Returns: Color\n    class func colorWithHexStr(_ hex: String, alpha: CGFloat) -> UIColor {\n        var cString:String = hex.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines).uppercased()\n        \n        if (cString.hasPrefix(\"#\")) {\n            cString = (cString as NSString).substring(from: 1)\n        }\n        \n        if (cString.count != 6) {\n            return UIColor.gray\n        }\n        \n        let rString = (cString as NSString).substring(to: 2)\n        let gString = ((cString as NSString).substring(from: 2) as NSString).substring(to: 2)\n        let bString = ((cString as NSString).substring(from: 4) as NSString).substring(to: 2)\n        \n        var r:CUnsignedInt = 0, g:CUnsignedInt = 0, b:CUnsignedInt = 0;\n        Scanner(string: rString).scanHexInt32(&r)\n        Scanner(string: gString).scanHexInt32(&g)\n        Scanner(string: bString).scanHexInt32(&b)\n        \n        return UIColor(red: CGFloat(r) / 255.0, green: CGFloat(g) / 255.0, blue: CGFloat(b) / 255.0, alpha: alpha)\n    }\n    \n    \n    // MARK: - RGB的颜色设置\n    class func RGB(r: CGFloat, g: CGFloat, b: CGFloat) -> UIColor {\n        return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: 1.0)\n    }\n    \n    class func RGBA(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> UIColor {\n        return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: a/1.0)\n    }\n    \n    // MARK: - 随机颜色\n    /// 随机颜色\n    ///\n    /// - Returns: 随机颜色\n    class func randomColor() -> UIColor {\n        let red = CGFloat(arc4random_uniform(256))\n        let green = CGFloat(arc4random_uniform(256))\n        let blue = CGFloat(arc4random_uniform(256))\n        return RGB(r: red, g: green, b: blue)\n    }\n    \n    \n    // MARK: - 应用控件主题颜色\n    /// 1FB922\n    ///\n    /// - Returns: 1FB922\n    class func appThemeHexColor() ->UIColor {\n        return colorWithHexStr(\"1FB922\")\n    }\n    \n    // MARK: - HUD的背景颜色\n    class func hudBackgroundColor() -> UIColor {\n        return UIColor.black.withAlphaComponent(0.7)\n    }\n    \n    // MARK: - tabBar标题未选中颜色\n    class func tabBarTitleNormalColor() -> UIColor {\n        return colorWithHexStr(\"AAAAAA\")\n    }\n    \n    // MARK: - tabBar标题已选中颜色\n    class func tabBarTitleSelectColor() -> UIColor {\n        return colorWithHexStr(\"1FB922\")\n    }\n}\n\n\nextension UIColor {\n    \n    convenience init?(netHex: Int) {\n        self.init(red:(netHex >> 16) & 0xff, green:(netHex >> 8) & 0xff, blue:netHex & 0xff)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UIAlert+Extension.swift",
    "content": "//\n//  EasyAlertView.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass EasyAlertView: NSObject {\n    \n    override init() { }\n    \n    /// 点击不响应提示框\n    class func sureActionAlert(title: String, message: String, vc: UIViewController) {\n        let alertVC = UIAlertController(title: title, message: message, preferredStyle: .alert)\n\n        let sureAction = UIAlertAction(title: \"确定\".rLocalized(), style: .default) { (UIAlertAction) in\n            \n        }\n        \n        alertVC.addAction(sureAction)\n        vc.present(alertVC, animated: true, completion: nil)\n    }\n\n    /// 默认带确认&取消事件响应的提示框\n    class func confirmAlert(title: String, message: String, vc: UIViewController, source: @escaping () -> Void) {\n        let alertVC = UIAlertController(title: title, message: message, preferredStyle: .alert)\n\n        let confirmAction = UIAlertAction(title: \"确定\".rLocalized(), style: .default) { (UIAlertAction) in\n            source()\n        }\n        let cancleAction = UIAlertAction(title: \"取消\".rLocalized(), style: .default, handler: nil)\n\n        alertVC.addAction(cancleAction)\n        alertVC.addAction(confirmAction)\n        vc.present(alertVC, animated: true, completion: nil)\n    }\n\n    class func defaultConfirm(title: String, message: String, vc: UIViewController, source: @escaping () -> Void) {\n        let alertVC = UIAlertController(title: title, message: message, preferredStyle: .alert)\n\n        let confirmAction = UIAlertAction(title: \"确认\".rLocalized(), style: .default) { (UIAlertAction) in\n            source()\n        }\n\n        alertVC.addAction(confirmAction)\n        vc.present(alertVC, animated: true, completion: nil)\n    }\n\n    /// 默认只带确认事件响应的提示框\n    class func sheetAction(title: String, message: String, vc: UIViewController, source: @escaping () -> Void) {\n        let alertVC = UIAlertController(title: title, message: message, preferredStyle: .actionSheet)\n\n        let confirmAction = UIAlertAction(title: \"确定\".rLocalized(), style: .default) { (UIAlertAction) in\n            source()\n        }\n\n        let cancleAction = UIAlertAction(title: \"取消\".rLocalized(), style: .default, handler: nil)\n        alertVC.addAction(cancleAction)\n        alertVC.addAction(confirmAction)\n        vc.present(alertVC, animated: true, completion: nil)\n    }\n\n    /// 完全自定义样式的Alert\n    class func customAlert(title: String, message: String, confirm: String, cancel: String, vc: UIViewController, confirmBlock: @escaping () -> Void, cancelBlock: @escaping () -> Void) {\n        let alertVC = UIAlertController(title: title, message: message, preferredStyle: .alert)\n        let confirmAction = UIAlertAction(title: confirm, style: .default) { (UIAlertAction) in\n            confirmBlock()\n        }\n        let cancelAction = UIAlertAction(title: cancel, style: .default) { (UIAlertAction) in\n            cancelBlock()\n        }\n\n        alertVC.addAction(confirmAction)\n        alertVC.addAction(cancelAction)\n        vc.present(alertVC, animated: true, completion: nil)\n    }\n\n    class func customConfirm(title: String, message: String, confirm: String, vc: UIViewController, source: @escaping () -> Void) {\n        let alertVC = UIAlertController(title: title, message: message, preferredStyle: .alert)\n\n        let confirmAction = UIAlertAction(title: confirm, style: .default) { (UIAlertAction) in\n            source()\n        }\n\n        alertVC.addAction(confirmAction)\n        vc.present(alertVC, animated: true, completion: nil)\n    }\n\n    /// 带文本输入的提示框\n    func textFiledAlert(title: String, message: String, placeholder: String, vc: UIViewController, source: @escaping (_ text: String) -> Void) {\n        let alertVC = UIAlertController(title: title, message: message, preferredStyle: .alert)\n\n        alertVC.addTextField { (textFiled: UITextField) in\n            textFiled.placeholder = placeholder\n        }\n\n        let cancelAction = UIAlertAction(title: \"确定\".rLocalized(), style: .default, handler: nil)\n        let confirmAction = UIAlertAction(title: \"取消\".rLocalized(), style: .default) { (UIAlertAction) in\n            let login = alertVC.textFields![0]\n            source(login.text!)\n            printLog(\"输入的是：\\(String(describing: login.text))\")\n        }\n        \n        alertVC.addAction(cancelAction)\n        alertVC.addAction(confirmAction)\n        vc.present(alertVC, animated: true, completion: nil)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UIButton+Extension.swift",
    "content": "//\n//  UIButton+Extension.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/10/11.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport RxSwift\nimport RxCocoa\nimport RxTheme\n\n/// 按钮图片和文字对齐方式\nenum ButtonStyle {\n    ///图片在左，文字在右，整体居中\n    case `default`\n    ///图片在左，文字在右，整体居中\n    case left\n    ///图片在右，文字在左，整体居中。\n    case right\n    ///图片在上，文字在下，整体居中\n    case top\n    ///图片在下，文字在上，整体居中\n    case bottom\n    ///图片居中，文字在图片下面。\n    case centerTop\n    ///图片居中，文字在图片上面\n    case centerBottom\n    ///图片居中，文字在上距离按钮顶部。\n    case centerUp\n    ///图片居中，文字在按钮下边。\n    case centerDown\n    ///图片在右，文字在左，距离按钮两边边距\n    case rightLeft\n    ///图片在左，文字在右，距离按钮两边边距\n    case leftRight\n}\n\n// MARK: - Button EdgeInsets\n\nextension UIButton {\n    \n    /// 按钮图片和文字的排版\n    /// - Parameter style: 样式\n    /// - Parameter padding: 间距大小\n    func setImageButtonStyle(_ style: ButtonStyle, padding: CGFloat){\n        \n        if imageView?.image != nil && titleLabel?.text != nil {\n            //先还原\n            titleEdgeInsets = .zero\n            imageEdgeInsets = .zero\n            \n            let imageRect: CGRect = imageView!.frame\n            let titleRect: CGRect = titleLabel!.frame\n            let totalHeight: CGFloat = (imageRect.size.height) + padding + (titleRect.size.height)\n            let selfWidth  = frame.size.width\n            let selfHeight = frame.size.height\n            \n            switch style {\n            case .left:\n                if padding != 0 {\n                    titleEdgeInsets = UIEdgeInsets(top: 0, left: padding / 2, bottom: 0, right: -padding / 2)\n                    \n                    imageEdgeInsets = UIEdgeInsets(top: 0, left: -padding / 2, bottom: 0, right: padding / 2)\n                }\n                \n                break\n                \n            case .right:\n                //图片在右，文字在左\n                titleEdgeInsets = UIEdgeInsets(top: 0, left: -((imageRect.size.width) + padding / 2), bottom: 0, right: ((imageRect.size.width) + padding / 2))\n                \n                imageEdgeInsets = UIEdgeInsets(top: 0, left: ((titleRect.size.width) + padding / 2), bottom: 0, right: -((titleRect.size.width) + padding / 2))\n                \n                break\n                \n            case .top:\n                //图片在上，文字在下\n                titleEdgeInsets = UIEdgeInsets(top: ((selfHeight - totalHeight) / 2 + imageRect.size.height + padding - titleRect.origin.y),\n                                               left: (selfWidth/2 - titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2,\n                                               bottom: -((selfHeight - totalHeight) / 2 + imageRect.size.height + padding - titleRect.origin.y),\n                                               right: -(selfWidth / 2 - titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2)\n                \n                imageEdgeInsets = UIEdgeInsets(top: ((selfHeight - totalHeight) / 2 - imageRect.origin.y),\n                                               left: (selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2),\n                                               bottom: -((selfHeight - totalHeight)/2 - imageRect.origin.y),\n                                               right: -(selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2))\n                break\n                \n            case .bottom:\n                //图片在下，文字在上。\n                titleEdgeInsets = UIEdgeInsets(top: ((selfHeight - totalHeight) / 2 - titleRect.origin.y),\n                                               left: (selfWidth / 2 - titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2,\n                                               bottom: -((selfHeight - totalHeight) / 2 - titleRect.origin.y),\n                                               right: -(selfWidth / 2 - titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2)\n                \n                imageEdgeInsets = UIEdgeInsets(top: ((selfHeight - totalHeight) / 2 + titleRect.size.height + padding - imageRect.origin.y),\n                                               left: (selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2),\n                                               bottom: -((selfHeight - totalHeight) / 2 + titleRect.size.height + padding - imageRect.origin.y),\n                                               right: -(selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2))\n                break\n                \n            case .centerTop:\n                titleEdgeInsets = UIEdgeInsets(top: -(titleRect.origin.y - padding),\n                                               left: (selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2,\n                                               bottom: (titleRect.origin.y - padding),\n                                               right: -(selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2)\n                \n                imageEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: (selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2),\n                                               bottom: 0,\n                                               right: -(selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2))\n                break\n                \n            case .centerBottom:\n                titleEdgeInsets = UIEdgeInsets(top: (selfHeight - padding - titleRect.origin.y - titleRect.size.height),\n                                               left: (selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2,\n                                               bottom: -(selfHeight - padding - titleRect.origin.y - titleRect.size.height),\n                                               right: -(selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2)\n                \n                imageEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: (selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2),\n                                               bottom: 0,\n                                               right: -(selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2))\n                break\n                \n            case .centerUp:\n                titleEdgeInsets = UIEdgeInsets(top: -(titleRect.origin.y + titleRect.size.height - imageRect.origin.y + padding),\n                                               left: (selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2,\n                                               bottom: (titleRect.origin.y + titleRect.size.height - imageRect.origin.y + padding),\n                                               right: -(selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2)\n                \n                imageEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: (selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2),\n                                               bottom: 0,\n                                               right: -(selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2))\n                break\n                \n            case .centerDown:\n                titleEdgeInsets = UIEdgeInsets(top: (imageRect.origin.y + imageRect.size.height - titleRect.origin.y + padding),\n                                               left: (selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2,\n                                               bottom: -(imageRect.origin.y + imageRect.size.height - titleRect.origin.y + padding),\n                                               right: -(selfWidth / 2 -  titleRect.origin.x - titleRect.size.width / 2) - (selfWidth - titleRect.size.width) / 2)\n                \n                imageEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: (selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2),\n                                               bottom: 0,\n                                               right: -(selfWidth / 2 - imageRect.origin.x - imageRect.size.width / 2))\n                \n                break\n                \n            case .rightLeft:\n                //图片在右，文字在左，距离按钮两边边距\n                titleEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: -(titleRect.origin.x - padding),\n                                               bottom: 0,\n                                               right: (titleRect.origin.x - padding))\n                \n                imageEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: (selfWidth - padding - imageRect.origin.x - imageRect.size.width),\n                                               bottom: 0,\n                                               right: -(selfWidth - padding - imageRect.origin.x - imageRect.size.width))\n                break\n                \n            case .leftRight:\n                //图片在左，文字在右，距离按钮两边边距\n                titleEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: (selfWidth - padding - titleRect.origin.x - titleRect.size.width),\n                                               bottom: 0,\n                                               right: -(selfWidth - padding - titleRect.origin.x - titleRect.size.width))\n                imageEdgeInsets = UIEdgeInsets(top: 0,\n                                               left: -(imageRect.origin.x - padding),\n                                               bottom: 0,\n                                               right: (imageRect.origin.x - padding))\n                break\n                \n            default:\n                titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)\n                imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)\n                break\n            }\n        }else {\n            titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)\n            imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)\n        }\n        \n    }\n}\n\n\n// MARK: - RxSwift tap\n\nextension UIButton {\n    \n    func rxTapClosure(_ time: DispatchTimeInterval = .microseconds(100), callback:(@escaping() -> ())) {\n        \n        self.rx.tap.debounce(time, scheduler: MainScheduler.instance).bind {\n            callback()\n        }.disposed(by: rx.disposeBag)\n    }\n}\n\n\n// MARK: - Theme\n\npublic extension ThemeProxy where Base: UIButton {\n\n    func buttonImage(from newValue: ThemeAttribute<UIImage?>, for state: UIControl.State) {\n        base.setImage(newValue.value, for: state)\n        let disposable = newValue.stream\n            .take(until: base.rx.deallocating)\n            .observe(on: MainScheduler.instance)\n            .bind(to: base.rx.buttnImage(for: state))\n        hold(disposable, for: \"buttnImage.forState.\\(state.rawValue)\")\n    }\n\n}\n\nextension Reactive where Base: UIButton {\n    \n    /// Bindable sink for `buttnImage` property\n    func buttnImage(for state: UIControl.State) -> Binder<UIImage?> {\n        return Binder(self.base) { view, attr in\n            view.setImage(attr, for: state)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UIFont+PingFang.swift",
    "content": "//\n//  UIFont+PingFang.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2019/3/6.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport UIKit\n\nextension UIFont {\n    \n    /// 苹方-简 常规体 PingFangSC-Regular\n    static func PingFangRegular(_ size:CGFloat) -> UIFont {\n        return UIFont(name: \"PingFangSC-Regular\", size: size) ?? UIFont.systemFont(ofSize:size)\n    }\n    \n    /// 苹方-简 中黑体 PingFangSC-Medium\n    static func PingFangMedium(_  size:CGFloat) -> UIFont {\n        return UIFont(name: \"PingFangSC-Medium\", size: size) ?? UIFont.systemFont(ofSize:size)\n    }\n    \n    /// 苹方-简 中粗体 PingFangSC-Semibold\n    static func PingFangSemibold(_ size:CGFloat) -> UIFont {\n        return UIFont(name: \"PingFangSC-Semibold\", size: size) ?? UIFont.systemFont(ofSize:size)\n    }\n    \n    /// 苹方-特粗体 PingFang-SC-Heavy\n    static func PingFangHeavy(_ size:CGFloat) -> UIFont {\n        return UIFont(name: \"PingFang-SC-Heavy\", size: size) ?? UIFont.systemFont(ofSize:size)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UIImage+Extension.swift",
    "content": "//\n//  LWUIImage+Extension.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\n\nextension UIImage {\n    \n    /// 颜色转化为图片\n    class func imageWithColor(_ color: UIColor) -> UIImage {\n        \n        let rect = CGRect(x: 0, y: 0, width: 1, height: 1)\n        UIGraphicsBeginImageContext(rect.size)\n        \n        let context = UIGraphicsGetCurrentContext()\n        context?.setFillColor(color.cgColor)\n        context?.fill(rect)\n        \n        let image = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        \n        return image!\n    }\n    \n    /// 图片去锯齿\n    func setAntialiasedImage(_ size: CGSize, _ scale: CGFloat) -> UIImage {\n        UIGraphicsBeginImageContextWithOptions(size, false, 0.0)\n        self.draw(in: CGRect(x: 1, y: 1, width: size.width-2, height: size.height-2))\n        let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!\n        UIGraphicsEndImageContext()\n        return image\n    }\n    \n    /// 图片置灰\n    func setAshPlacingImage(_ sourceImage: UIImage) -> UIImage {\n        UIGraphicsBeginImageContext(self.size)\n        let colorSpace = CGColorSpaceCreateDeviceGray()\n        let context = CGContext(data: nil , width: Int(self.size.width), height: Int(self.size.height),bitsPerComponent: 8, bytesPerRow: 0, space: colorSpace, bitmapInfo: CGImageAlphaInfo.none.rawValue)\n        context?.draw(sourceImage.cgImage!, in: CGRect.init(x: 0, y: 0, width: sourceImage.size.width, height: sourceImage.size.height))\n        let cgImage = context!.makeImage()\n        let grayImage = UIImage.init(cgImage: cgImage!)\n        return grayImage\n    }\n    \n    /// 截屏使用\n    func screenShotWithoutMask(shotView: UIView) -> UIImage {\n        UIGraphicsBeginImageContextWithOptions(shotView.frame.size, true, 0.0)\n        shotView.drawHierarchy(in: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: kScreenW, height: kScreenH)), afterScreenUpdates: false)\n        let image = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return image!\n    }\n    \n    \n    /// 图片点九处理\n    /// - Parameter sscale: 比例\n    func stretchableImage(centerStretchScale sscale:CGFloat) -> UIImage {\n        let top = self.size.height - 8;\n        let left = self.size.width / 2 - 2;\n        let right = self.size.width / 2 + 2;\n        let bottom = self.size.height - 4;\n        return self.resizableImage(withCapInsets: UIEdgeInsets.init(top: top, left: left, bottom: bottom, right: right), resizingMode: .stretch)\n    }\n    \n    /// 返回不同颜色的新图片\n    func changeColor(color: UIColor) -> UIImage? {\n        \n        UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale);\n        \n        let context = UIGraphicsGetCurrentContext();\n        context?.translateBy(x: 0, y: self.size.height)\n        context?.scaleBy(x: 1.0, y: -1.0)\n        context?.setBlendMode(.normal)\n        \n        let rect = CGRect.init(x: 0, y: 0, width: self.size.width, height: self.size.height)\n        context?.clip(to: rect, mask: self.cgImage!)\n        context?.setFillColor(color.cgColor)\n        context?.fill(rect)\n        \n        let newImage = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        return newImage\n    }\n    \n    /// 返回不被拉伸的图片\n    class func imageWithRenderingMode(_ originalImage: UIImage) -> UIImage {\n        return originalImage.withRenderingMode(.alwaysOriginal)\n    }\n    \n    /**\n     生成高清二维码\n     */\n    class func createQRForString(_ qrString: String) -> UIImage {\n        if qrString.isEmpty == true{\n            return UIImage()\n        }\n        // 将字符串转换为二进制\n        let data = qrString.data(using: String.Encoding.utf8, allowLossyConversion: false)\n        let filter = CIFilter(name: \"CIQRCodeGenerator\")!\n        filter.setValue(data, forKey: \"inputMessage\")\n        filter.setValue(\"H\", forKey: \"inputCorrectionLevel\")\n        let qrCIImage = filter.outputImage\n        let colorFilter = CIFilter(name: \"CIFalseColor\")!\n        colorFilter.setDefaults()\n        colorFilter.setValue(qrCIImage, forKey: \"inputImage\")\n        colorFilter.setValue(CIColor(red: 0, green: 0, blue: 0), forKey: \"inputColor0\")\n        colorFilter.setValue(CIColor(red: 1, green: 1, blue: 1), forKey: \"inputColor1\")\n        \n        let outImage = colorFilter.outputImage\n        let scale = 172 / outImage!.extent.size.width;\n        let transform = CGAffineTransform(scaleX: scale, y: scale)\n        let transformImage = colorFilter.outputImage!.transformed(by: transform)\n        let image = UIImage(ciImage: transformImage)\n        \n        return image\n    }\n    \n    /// 拉伸按钮背景图片\n    class func resizableImage(_ image: UIImage) -> UIImage {\n        let w: CGFloat = image.size.width * 0.5\n        let h: CGFloat = image.size.height * 0.5\n        return image.resizableImage(withCapInsets: UIEdgeInsets(top: w, left: h, bottom: w, right: h))\n    }\n}\n\n// 扩展 UIImage 的 init 方法，获得渐变效果\npublic extension UIImage {\n    \n    convenience init?(gradientColors:[UIColor], size: CGSize) {\n        UIGraphicsBeginImageContextWithOptions(size, true, 0)\n        let context = UIGraphicsGetCurrentContext()\n        let colorSpace = CGColorSpaceCreateDeviceRGB()\n        let colors = gradientColors.map {(color: UIColor) -> AnyObject? in return color.cgColor as AnyObject } as NSArray\n        let gradient = CGGradient(colorsSpace: colorSpace, colors: colors, locations: nil)\n        // 第二个参数是起始位置，第三个参数是终止位置\n        context!.drawLinearGradient(gradient!, start: CGPoint(x: 0, y: 0), end: CGPoint(x: size.width, y: 0), options: CGGradientDrawingOptions(rawValue: 0))\n        self.init(cgImage: (UIGraphicsGetImageFromCurrentImageContext()?.cgImage)!)\n        UIGraphicsEndImageContext()\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UIImageView+Kingfisher.swift",
    "content": "//\n//  UIImageView+Kingfisher.swift\n//  MK-MChain\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 miku. All rights reserved.\n//\n\nimport UIKit\nimport Foundation\nimport Kingfisher\nimport RxTheme\nimport RxCocoa\nimport RxSwift\n\nenum ImageResult {\n    case success(UIImage)\n    case failure(String)\n}\n\nextension UIImageView {\n    \n    /// 设置网络图片\n    ///\n    /// - Parameter url: 网络图片资源url\n    func setImageWithURL(_ url: String) {\n        guard let imageURL = url.URLValue else {\n            return\n        }\n        \n        kf.setImage(with: imageURL)\n    }\n    \n    \n    /// 设置网络图片及占位图\n    ///\n    /// - Parameters:\n    ///   - url: 网络图片资源url\n    ///   - placeholder: 占位图片\n    func setImageWithURL(_ url: String, placeholder: UIImage = UIImage()) {\n        guard let imageURL = url.URLValue else {\n            self.setPlaceholderImage(placeholder)\n            return\n        }\n        \n        kf.setImage(with: imageURL, placeholder: placeholder)\n    }\n    \n    /// 设置网络图片及占位图\n    ///\n    /// - Parameters:\n    ///   - url: 网络图片资源url\n    ///   - placeholder: 占位图片名称\n    func setImageWithURL(_ url: String, placeholder: String) {\n        guard let imageURL = url.URLValue else {\n            self.setPlaceholderImageNamed(placeholder)\n            return\n        }\n        \n        kf.setImage(with: imageURL, placeholder: UIImage(named: placeholder))\n    }\n    \n    func setPlaceholderImage(_ image: UIImage) {\n        DispatchQueue.main.async {\n            self.image = image\n        }\n    }\n    \n    func setPlaceholderImageNamed(_ named: String) {\n        DispatchQueue.main.async {\n            if let placeholder = UIImage(named: named) {\n                self.image = placeholder\n            }\n        }\n    }\n    \n    /// 下载网络图片资源\n    ///\n    /// - Parameters:\n    ///   - url: 网络图片资源url\n    ///   - placeholder: 占位图片名称\n    ///   - callback: 下载完成回调\n    func downloadImageWithURL(_ url: String,\n                              placeholder: UIImage = UIImage(),\n                              callback:(@escaping (ImageResult) -> ())) {\n        guard let imageURL = URL(string: url) else {\n            return\n        }\n        \n        kf.setImage(with: imageURL, options: [.memoryCacheExpiration(.expired)]) { result in\n            switch result {\n            case .success(let value):\n                printLog(\"Task done for: \\(value.source.url?.absoluteString ?? \"\")\")\n                callback(ImageResult.success(try! result.get().image))\n            case .failure(let error):\n                printLog(\"Job failed: \\(error.localizedDescription)\")\n                callback(ImageResult.failure(\"Job failed: \\(error.localizedDescription)\"))\n            }\n        }\n    }\n}\n\n// MARK: - Theme\n\npublic extension ThemeProxy where Base: UIImageView {\n    \n    /// (set only) bind a stream to backgroundColor\n    var image: ThemeAttribute<UIImage?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.image = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.image)\n            hold(disposable, for: \"backgroundColor\")\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UILabel+Extension.swift",
    "content": "//\n//  UIlabel+Extension.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2019/3/26.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass PaddingLabel: UILabel {\n    private struct AssociatedKeys {\n        static var padding = UIEdgeInsets()\n    }\n    \n    public var padding: UIEdgeInsets? {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.padding) as? UIEdgeInsets\n        }\n        set {\n            if let newValue = newValue {\n                objc_setAssociatedObject(self, &AssociatedKeys.padding, newValue as UIEdgeInsets?, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            }\n        }\n    }\n    \n    override open func draw(_ rect: CGRect) {\n        if let insets = padding {\n            self.drawText(in: rect.inset(by: insets))\n        } else {\n            self.drawText(in: rect)\n        }\n    }\n    \n    override open var intrinsicContentSize: CGSize {\n        guard let text = self.text else { return super.intrinsicContentSize }\n        \n        var contentSize = super.intrinsicContentSize\n        var textWidth: CGFloat = frame.size.width\n        var insetsHeight: CGFloat = 0.0\n        var insetsWidth: CGFloat = 0.0\n        \n        if let insets = padding {\n            insetsWidth += insets.left + insets.right\n            insetsHeight += insets.top + insets.bottom\n            textWidth -= insetsWidth\n        }\n        \n        let newSize = text.boundingRect(with: CGSize(width: textWidth, height: CGFloat.greatestFiniteMagnitude),\n                                        options: NSStringDrawingOptions.usesLineFragmentOrigin,\n                                        attributes: [NSAttributedString.Key.font: self.font!], context: nil)\n        \n        contentSize.height = ceil(newSize.size.height) + insetsHeight\n        contentSize.width = ceil(newSize.size.width) + insetsWidth\n        \n        return contentSize\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UINavBarItem+Extension.swift",
    "content": "//\n//  NavBarItem+Extension.swift\n//  SwiftStudy\n//\n//  Created by iOS.Jet on 2019/2/20.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport UIKit\n\n/// 便捷方法拓展\nextension UIBarButtonItem {\n\n    /// 设置导航栏侧边内容(只设置图片)\n    ///\n    /// - Parameters:\n    ///   - image: 普通状态下图片\n    ///   - action: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setNavItemImage(_ image: UIImage, target: Any?, action: Selector) -> UIBarButtonItem {\n        let customButton = UIButton(type: .custom)\n        customButton.setImage(image, for: .normal)\n        customButton.setTitleColor(.appThemeHexColor(), for: .normal)\n        customButton.titleLabel?.font = UIFont(name: \"PingFangSC-Regular\", size: 14)\n        customButton.sizeToFit()\n        customButton.addTarget(target, action: action, for: .touchUpInside)\n        return UIBarButtonItem(customView: customButton)\n    }\n    \n    /// 设置导航栏侧边内容(设置普通&高亮图片)\n    ///\n    /// - Parameters:\n    ///   - image: 普通状态下图片\n    ///   - hightImage: 高亮状态下图片\n    ///   - action: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setNavItemHightImage(_ image: UIImage, hightImage: UIImage, target: Any?, action: Selector) -> UIBarButtonItem {\n        let customButton = UIButton(type: .custom)\n        customButton.setImage(image, for: .normal)\n        customButton.setImage(hightImage, for: .highlighted)\n        customButton.setTitleColor(.appThemeHexColor(), for: .normal)\n        customButton.titleLabel?.font = UIFont(name: \"PingFangSC-Regular\", size: 14)\n        customButton.sizeToFit()\n        customButton.addTarget(target, action: action, for: .touchUpInside)\n        return UIBarButtonItem(customView: customButton)\n    }\n    \n    /// 设置导航栏侧边内容(设置普通&高亮图片)\n    ///\n    /// - Parameters:\n    ///   - image: 普通状态下图片\n    ///   - selectedImage: 选中状态下图片\n    ///   - action: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setNavItemSelectedImage(_ image: UIImage, selectedImage: UIImage, target: Any?, action: Selector) -> UIBarButtonItem {\n        let customButton = UIButton(type: .custom)\n        customButton.setImage(image, for: .normal)\n        customButton.setImage(selectedImage, for: .selected)\n        customButton.setTitleColor(.appThemeHexColor(), for: .normal)\n        customButton.titleLabel?.font = UIFont(name: \"PingFangSC-Regular\", size: 14)\n        customButton.sizeToFit()\n        customButton.addTarget(target, action: action, for: .touchUpInside)\n        return UIBarButtonItem(customView: customButton)\n    }\n    \n    /// 设置导航栏侧边内容(只设置文字)\n    ///\n    /// - Parameters:\n    ///   - title: 普通状态下文字\n    ///   - selector: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setNavItemTitle(_ title: String, target: Any?, selector: Selector) -> UIBarButtonItem {\n        let customButton = UIButton(type: .custom)\n        customButton.setTitle(title, for: .normal)\n        customButton.setTitleColor(.appThemeHexColor(), for: .normal)\n        customButton.titleLabel?.font = UIFont(name: \"PingFangSC-Regular\", size: 14)\n        customButton.sizeToFit()\n        customButton.addTarget(target, action: selector, for: .touchUpInside)\n        return UIBarButtonItem(customView: customButton)\n    }\n    \n    \n    /// 设置导航栏侧边内容(只设置文字)\n    ///\n    /// - Parameters:\n    ///   - title: 普通状态下文字\n    ///   - color: 普通状态下文字颜色\n    ///   - action: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setTitleWithColor(_ title: String, color: UIColor, target: Any?, selector: Selector) -> UIBarButtonItem {\n        let customButton = UIButton(type: .custom)\n        customButton.setTitle(title, for: .normal)\n        customButton.setTitleColor(color, for: .normal)\n        customButton.titleLabel?.font = UIFont(name: \"PingFangSC-Regular\", size: 14)\n        customButton.sizeToFit()\n        customButton.addTarget(target, action: selector, for: .touchUpInside)\n        return UIBarButtonItem(customView: customButton)\n    }\n    \n    /// 设置导航栏侧边内容(设置图片+文字)\n    ///\n    /// - Parameters:\n    ///   - image: 普通状态下图片\n    ///   - title: 普通状态下文字\n    ///   - action: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setNavItemImageOrTitle(_ image: UIImage, title: String, target: Any, action: Selector) -> UIBarButtonItem {\n        let customButton = UIButton(type: .custom)\n        customButton.setImage(image, for: .normal)\n        customButton.setTitle(title, for: .normal)\n        customButton.setTitleColor(.appThemeHexColor(), for: .normal)\n        customButton.titleLabel?.font = UIFont(name: \"PingFangSC-Regular\", size: 14)\n        customButton.sizeToFit()\n        customButton.addTarget(target, action: action, for: .touchUpInside)\n        return UIBarButtonItem(customView: customButton)\n    }\n    \n    /// 设置导航栏侧边内容(设置高亮图片+文字)\n    ///\n    /// - Parameters:\n    ///   - hightImage: 高亮状态下图片\n    ///   - title: 普通状态下文字\n    ///   - action: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setNavItemHightImageOrTitle(_ hightImage: UIImage, title: String, target: Any?, action: Selector) -> UIBarButtonItem {\n        let customButton = UIButton(type: .custom)\n        customButton.setTitle(title, for: .normal)\n        customButton.setImage(hightImage, for: .highlighted)\n        customButton.setTitleColor(.appThemeHexColor(), for: .normal)\n        customButton.titleLabel?.font = UIFont(name: \"PingFangSC-Regular\", size: 14)\n        customButton.sizeToFit()\n        customButton.addTarget(target, action: action, for: .touchUpInside)\n        return UIBarButtonItem(customView: customButton)\n    }\n    \n    \n    /// 设置导航栏侧边内容(自定义按钮)\n    ///\n    /// - Parameters:\n    ///   - button: 自定义按钮\n    ///   - action: 添加的点击事件\n    /// - Returns: 自定义设置导航栏侧边内容\n    class func setNavItemCustomView(_ button : UIButton, target: Any?, action: Selector) -> UIBarButtonItem {\n        button.sizeToFit()\n        button.addTarget(target, action: action, for: .touchUpInside)\n        return UIBarButtonItem(customView: button)\n    }\n    \n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIKit/UITableView+Extension.swift",
    "content": "//\n//  UITableView+EmptyData.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/6/12.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\n\npublic extension UITableView {\n    \n    func scrollToFirst(at scrollPosition: UITableView.ScrollPosition, animated: Bool) {\n        guard numberOfSections > 0 else { return }\n        guard numberOfRows(inSection: 0) > 0 else { return }\n        let indexPath = IndexPath(item: 0, section: 0)\n        scrollToRow(at: indexPath, at: scrollPosition, animated: animated)\n    }\n    \n    func scrollToLast(at scrollPosition: UITableView.ScrollPosition, animated: Bool) {\n        guard numberOfSections > 0 else { return }\n        let lastSection = numberOfSections - 1\n        guard numberOfRows(inSection: 0) > 0 else { return }\n        let lastIndexPath = IndexPath(item: numberOfRows(inSection: lastSection)-1, section: lastSection)\n        scrollToRow(at: lastIndexPath, at: scrollPosition, animated: animated)\n    }\n}\n\npublic extension UITableView {\n    \n    // MARK: - Cell register and reuse\n    /**\n     Register cell nib\n     \n     - parameter aClass: class\n     */\n    func fy_registerCellNib<T: UITableViewCell>(_ aClass: T.Type) {\n        let name = String(describing: aClass)\n        let nib = UINib(nibName: name, bundle: nil)\n        self.register(nib, forCellReuseIdentifier: name)\n    }\n    \n    /**\n     Register cell class\n     \n     - parameter aClass: class\n     */\n    func fy_registerCellClass<T: UITableViewCell>(_ aClass: T.Type) {\n        let name = String(describing: aClass)\n        self.register(aClass, forCellReuseIdentifier: name)\n    }\n    \n    /**\n     Reusable Cell\n     \n     - parameter aClass:    class\n     \n     - returns: cell\n     */\n    func fy_dequeueReusableCell<T: UITableViewCell>(_ aClass: T.Type) -> T! {\n        let name = String(describing: aClass)\n        guard let cell = dequeueReusableCell(withIdentifier: name) as? T else {\n            fatalError(\"\\(name) is not registed\")\n        }\n        return cell\n    }\n    \n    // MARK: - HeaderFooter register and reuse\n    /**\n     Register cell nib\n     \n     - parameter aClass: class\n     */\n    func fy_registerHeaderFooterNib<T: UIView>(_ aClass: T.Type) {\n        let name = String(describing: aClass)\n        let nib = UINib(nibName: name, bundle: nil)\n        self.register(nib, forHeaderFooterViewReuseIdentifier: name)\n    }\n    \n    /**\n     Register cell class\n     \n     - parameter aClass: class\n     */\n    func fy_registerHeaderFooterClass<T: UIView>(_ aClass: T.Type) {\n        let name = String(describing: aClass)\n        self.register(aClass, forHeaderFooterViewReuseIdentifier: name)\n    }\n    \n    /**\n     Reusable Cell\n     \n     - parameter aClass:    class\n     \n     - returns: cell\n     */\n    func fy_dequeueReusableHeaderFooter<T: UIView>(_ aClass: T.Type) -> T! {\n        let name = String(describing: aClass)\n        guard let cell = dequeueReusableHeaderFooterView(withIdentifier: name) as? T else {\n            fatalError(\"\\(name) is not registed\")\n        }\n        return cell\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIView/UIView+Extensions.swift",
    "content": "//\n//  UIView+Extend.swift\n//  UIView拓展\n//\n//  Created by Mac on 2018/8/16.\n//  Copyright © 2018年 iOS. All rights reserved.\n//\n\nimport UIKit\nimport SnapKit\nimport RxTheme\nimport RxSwift\n\nextension UIView {\n    \n    /// x\n    public var x : CGFloat {\n        \n        get {\n            return self.frame.origin.x\n        }\n        set (x) {\n            var frame = self.frame\n            frame.origin.x = x\n            self.frame = frame\n        }\n    }\n    \n    \n    /// y\n    public var y : CGFloat {\n        \n        get {\n            return self.frame.origin.y\n        }\n        set (y) {\n            var frame = self.frame\n            frame.origin.y = y\n            self.frame = frame\n        }\n    }\n    \n    \n    /// maxX\n    public var maxX : CGFloat {\n        \n        get {\n            return self.frame.maxX\n        }\n        set(maxX) {\n            self.frame.origin.x = maxX - self.frame.size.width\n        }\n    }\n    \n    /// maxY\n    public var maxY : CGFloat {\n        \n        get {\n            return self.frame.maxY\n        }\n        set(maxY) {\n            self.frame.origin.y = maxY - self.frame.size.height\n        }\n    }\n    \n    \n    /// width\n    public var width : CGFloat {\n        \n        get {\n            return self.frame.size.width\n        }\n        set (width) {\n            var frame = self.frame\n            frame.size.width = width\n            self.frame = frame\n        }\n    }\n    \n    \n    /// height\n    public var height : CGFloat {\n        \n        get {\n            return self.frame.size.height\n        }\n        set (height) {\n            var frame = self.frame\n            frame.size.height = height\n            self.frame = frame\n        }\n    }\n    \n    \n    /// centerX\n    public var centerX : CGFloat {\n        \n        get {\n            return self.center.x\n        }\n        set (centerX) {\n            var center = self.center\n            center.x = centerX\n            self.center = center\n        }\n    }\n    \n    \n    /// centerY\n    public var centerY : CGFloat {\n        \n        get {\n            return self.center.y\n        }\n        set (centerY) {\n            var center = self.center\n            center.y = centerY\n            self.center = center\n        }\n    }\n    \n    \n    /// size\n    public var size : CGSize {\n        \n        get {\n            return self.frame.size\n        }\n        set (size) {\n            var newSize = self.frame.size\n            newSize = CGSize(width: size.width, height: size.height)\n            self.frame.size = newSize\n        }\n    }\n    \n    \n    /// origin\n    public var origin : CGPoint {\n        \n        get {\n            return self.frame.origin\n        }\n        set (origin) {\n            var newOrigin = self.frame.origin\n            newOrigin = CGPoint(x: origin.x, y: origin.y)\n            self.frame.origin = newOrigin\n        }\n    }\n    \n    \n    /// cornerRadius\n    public var radius: CGFloat {\n        \n        get {\n            return self.layer.cornerRadius;\n        }\n        set (radius){\n            self.layer.cornerRadius = radius\n            \n            guard self.layer.masksToBounds else {\n                return\n            }\n            self.layer.masksToBounds = true\n        }\n    }\n    \n    \n    /// borderWidth\n    public var borderWidth: CGFloat {\n        \n        get {\n            return self.layer.borderWidth\n        }\n        set (borderWidth){\n            self.layer.borderWidth = borderWidth\n            \n            guard self.layer.masksToBounds else {\n                return\n            }\n            self.layer.masksToBounds = true\n        }\n    }\n    \n    \n    /// 指定方向设置圆角\n    ///\n    /// - Parameters:\n    ///   - size: 圆角大小\n    ///   - type: 圆角方向\n    public func makeLayerRadius(_ size: CGSize?, type: UIRectCorner) {\n        guard let size = size else {\n            return\n        }\n        \n        let bezierPath = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: type, cornerRadii: size)\n        let maskLayer = CAShapeLayer()\n        maskLayer.frame = self.bounds\n        maskLayer.path = bezierPath.cgPath\n        self.layer.mask = maskLayer\n    }\n    \n    \n    /// 设置view的阴影\n    ///\n    /// - Parameters:\n    ///   - radius: 阴影的模糊半径\n    ///   - color: 阴影颜色\n    ///   - size: 阴影的偏移量\n    public func makeLayerShadow(_ size: CGSize?, radius: CGFloat, color: UIColor, opacity: Float) {\n        guard let size = size else {\n            return\n        }\n        \n        self.layer.shadowColor = color.cgColor\n        self.layer.shadowOffset = size\n        self.layer.shadowRadius = radius\n        self.layer.shadowOpacity = opacity //阴影透明度(默认为1 | 0为不显示)\n    }\n    \n    /// 设置view的阴影 带圆角\n    ///\n    /// - Parameters:\n    ///   - size: 大小  默认CGSize(width: 0, height: 3)\n    ///   - radius: 阴影的模糊半径 默认 4\n    ///   - color: 阴影颜色 默认 黑色 0.5\n    ///   - opacity: 阴影 渲染 默认1\n    ///   - corner: 圆角 默认18\n    \n    public func makeLayerShadowCorner(size: CGSize = CGSize(width: 0, height: 3),\n                                      radius: CGFloat = 4,\n                                      color: UIColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5),\n                                      opacity: Float = 1,\n                                      corner: CGFloat = 18) {\n        self.layer.shadowColor = color.cgColor\n        self.layer.shadowOffset = size\n        self.layer.shadowRadius = radius\n        self.layer.shadowOpacity = opacity\n        self.layer.cornerRadius = corner\n    }\n    \n    /// 设置view的阴影 带圆角 背景色\n    ///\n    /// - Parameters:\n    ///   - size: 大小  默认CGSize(width: 0, height: 2)\n    ///   - radius: 阴影的模糊半径 默认 3\n    ///   - color:  阴影颜色 默认 黑色 0.3\n    ///   - opacity: 阴影 渲染 默认1\n    ///   - corner: 圆角 默认8\n    ///   - bgColor: 背景色\n    public func setShadowCornerBgColor(size: CGSize = CGSize(width: 0, height: 2),\n                                       radius: CGFloat = 3,\n                                       color: UIColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.3),\n                                       opacity: Float = 1,\n                                       corner: CGFloat = 8,\n                                       bgColor: UIColor) {\n        self.layer.cornerRadius = corner\n        self.layer.shadowColor = color.cgColor\n        self.layer.shadowRadius = radius\n        self.layer.shadowOffset = size\n        self.layer.shadowOpacity = opacity\n        self.layer.backgroundColor = bgColor.cgColor\n    }\n    \n    \n    /// 设置view的渐变颜色背景\n    ///\n    /// - Parameter colors: 渐变色颜色数组\n    public func makeGradientLayer(_ colors: [Any]?) {\n        guard let colors = colors else {\n            return\n        }\n        \n        let gradientLayer = CAGradientLayer()\n        let sizeWidth = UIScreen.main.bounds.size.width\n        gradientLayer.frame = CGRect(x: 0, y: 0, width: sizeWidth, height: self.height)\n        gradientLayer.startPoint = CGPoint(x: -0.03, y: -0.1)\n        gradientLayer.endPoint = CGPoint(x: 0.96, y: 0.96)\n        gradientLayer.locations = [0, 1.0]\n        //设置渐变的主颜色\n        gradientLayer.colors = colors\n        //将gradientLayer作为子layer添加到主layer上\n        self.layer.addSublayer(gradientLayer)\n        self.layer.masksToBounds = true\n    }\n    \n    \n    /// 设置view默认的渐变颜色(3E9EF7 ~ 185DFF)\n    public func makeDefaultGradient() {\n        let colors = [UIColor.colorWithHexStr(\"3E9EF7\").cgColor,\n                      UIColor.colorWithHexStr(\"185DFF\").cgColor]\n        \n        let gradientLayer = CAGradientLayer()\n        let sizeWidth = UIScreen.main.bounds.size.width\n        gradientLayer.frame = CGRect(x: 0, y: 0, width: sizeWidth, height: self.height)\n        gradientLayer.startPoint = CGPoint(x: 0, y: 0)\n        gradientLayer.endPoint = CGPoint(x: 0.93, y: 0.92)\n        gradientLayer.locations = [0, 1.0]\n        //设置渐变的主颜色\n        gradientLayer.colors = colors\n        //将gradientLayer作为子layer添加到主layer上\n        self.layer.addSublayer(gradientLayer)\n        self.layer.masksToBounds = true\n    }\n    \n    \n    /// 设置边距宽度和颜色\n    func makeLayerBoards(at width: CGFloat, color: UIColor) {\n        self.layer.borderWidth = width\n        self.layer.borderColor = color.cgColor\n    }\n}\n\nextension UIView {\n    class func fromNib<T : UIView>() -> T {\n        return Bundle.main.loadNibNamed(String(describing: T.self), owner: nil, options: nil)![0] as! T\n    }\n}\n\nprotocol ViewChainable {}\nextension ViewChainable where Self: UIView {\n    @discardableResult\n    func config(_ config: (Self) -> Void) -> Self {\n        config(self)\n        return self\n    }\n}\n\n\n\nextension UIView: ViewChainable {\n    \n    func adhere(toSuperView: UIView) -> Self {\n        toSuperView.addSubview(self)\n        return self\n    }\n    \n    @discardableResult\n    func layout(snapKitMaker: (ConstraintMaker) -> Void) -> Self {\n        self.snp.makeConstraints { (make) in\n            snapKitMaker(make)\n        }\n        return self\n    }\n}\n\nextension UIView {\n    \n    func cropView(with rect: CGRect) -> UIImage? {\n        UIGraphicsBeginImageContextWithOptions(CGSize(width: rect.size.width, height: rect.size.height), _: false, _: 0.0) //currentView 当前的view  创建一个基于位图的图形上下文并指定大小为\n        if let context = UIGraphicsGetCurrentContext() {\n            layer.render(in: context)\n        } //renderInContext呈现接受者及其子范围到指定的上下文\n        let viewImage: UIImage? = UIGraphicsGetImageFromCurrentImageContext() //返回一个基于当前图形上下文的图片\n        UIGraphicsEndImageContext() //移除栈顶的基于当前位图的图形上下文\n        //    UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);//然后将该图片保存到图片图\n        return viewImage\n    }\n    \n}\n\n// MARK: - Reactive Tap\n\nextension UIView {\n    \n    func tapClosure(callback:(@escaping() -> ())) {\n        let tapGesture = UITapGestureRecognizer()\n        self.isUserInteractionEnabled = true\n        self.addGestureRecognizer(tapGesture)\n        \n        // 绑定方式实现\n        tapGesture.rx.event.bind { _ in\n            callback()\n        }.disposed(by: rx.disposeBag)\n    }\n}\n\n// MARK: - ThemeProxy\n\npublic extension ThemeProxy where Base: UITextField {\n    \n    /// (set only) bind a stream to borderColor\n    var placeholderColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.setPlaceHolderTextColor(newValue.value ?? UIColor.lightGray)\n        }\n    }\n}\n\n@available(iOS 13.0, *)\npublic extension ThemeProxy where Base: UIBarAppearance {\n    \n    /// (set only) bind a stream to backgroundColor\n    var backgroundColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.backgroundColor = newValue.value ?? UIColor.gray\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Extensions/UIView/UIViewController+Extend.swift",
    "content": "//\n//  UIViewController+Extend.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/8/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\n\nextension UIViewController {\n    \n    /// Configuration back\n    @objc func back(_ animated: Bool = true) {\n        navigationController?.popViewController(animated: animated)\n    }\n    \n    // Get currentController\n    class func currentViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {\n        if let navigationController = controller as? UINavigationController {\n            return currentViewController(controller: navigationController.visibleViewController)\n        }\n        if let tabBarController = controller as? UITabBarController {\n            if let selected = tabBarController.selectedViewController {\n                return currentViewController(controller: selected)\n            }\n        }\n        if let presented = controller?.presentedViewController {\n            return currentViewController(controller: presented)\n        }\n        return controller\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Libraries/ActionSheet/FYActionSheet.swift",
    "content": "//\n//  FYActionSheet.swift\n//  FYActionSheet\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019年 Jett. All rights reserved.\n//\n\nimport Foundation\nimport UIKit\n\nclass FYActionSheet: BottomPopupViewController {\n    \n    // MARK: - Setter\n    \n    var textFont: UIFont? {\n        didSet {\n            guard let font = textFont else {\n                return\n            }\n            \n            titleFont = font\n            tableView.reloadData()\n        }\n    }\n    \n    var cancelTextFont: UIFont? {\n        didSet {\n            guard let font = textFont else {\n                return\n            }\n            \n            cancelBtn.titleLabel?.font = font\n        }\n    }\n    \n    var textColor: UIColor?\n    \n    var cancelTextColor: UIColor? {\n        didSet {\n            guard let titleColor = textColor else {\n                return\n            }\n            \n            cancelBtn.setTitleColor(titleColor, for: .normal)\n        }\n    }\n    \n    // MARK: - Private\n    \n    private let bottomSpace: CGFloat = 6\n    private let cancelHeight: CGFloat = 44\n    private let bottomSafeHeight: CGFloat = 34\n    \n    // MARK: - lazy var\n\n    public var handler: ((_ index: Int)->Void)?\n    \n    private var titleFont: UIFont? = nil\n    \n    private var dataSource: [String] = []\n    private var isShowCancel: Bool = true\n    \n    private var cellHeight: CGFloat = 55\n    \n    private var tableHeight: CGFloat {\n        return CGFloat(dataSource.count) * cellHeight\n    }\n    \n    private lazy var cancelBtn: UIButton = {\n        let button = UIButton(type: .custom)\n        button.frame = CGRect(x: 0, y: bottomSpace, width: kScreenW, height: cancelHeight)\n        button.setTitle(\"取消\".rLocalized(), for: .normal)\n        button.titleLabel?.font = .PingFangRegular(14)\n        button.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V2 }, for: .normal)\n        button.addTarget(self, action: #selector(dissAction), for: .touchUpInside)\n        button.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n        return button\n    }()\n    \n    private lazy var footerBtnView: UIView = {\n        let height = bottomSpace + cancelHeight\n        let footerView = UIView(frame: CGRect(x: 0, y: 0, width: kScreenW, height: height))\n        footerView.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V2 }\n        footerView.addSubview(cancelBtn)\n        return footerView\n    }()\n    \n    private lazy var tableView: UITableView = {\n        let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: kScreenW, height: tableHeight))\n        tableView.delegate = self\n        tableView.bounces = false\n        tableView.isScrollEnabled = false\n        tableView.dataSource = self\n        tableView.separatorStyle = .none\n        tableView.tableFooterView = UIView()\n        tableView.estimatedSectionHeaderHeight = 0\n        tableView.estimatedSectionFooterHeight = 0\n        tableView.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V2 }\n        tableView.register(cellWithClass: FYActionSheetCell.self)\n        return tableView\n    }()\n    \n    // MARK: - Life cycle\n    \n    required public init(isShowCancel: Bool = false, actionTitles: [String]) {\n        self.dataSource = actionTitles\n        self.isShowCancel = isShowCancel\n        super.init(nibName: nil, bundle: nil)\n        \n        buildUI()\n    }\n    \n    required public init?(coder aDecoder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    private func buildUI() {\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V2 }\n        if isShowCancel {\n            tableView.tableFooterView = footerBtnView\n        }\n        \n        view.addSubview(tableView)\n        tableView.snp.makeConstraints { (make) in\n            make.top.equalToSuperview()\n            make.left.right.equalToSuperview()\n            make.bottom.equalToSuperview()\n        }\n        \n        tableView.reloadData()\n    }\n    \n    // Bottom popup attribute variables\n    // You can override the desired variable to change appearance\n    \n    override var popupHeight: CGFloat { makePopHeight() }\n    \n    override var popupTopCornerRadius: CGFloat { return 8 }\n    \n    override var popupPresentDuration: Double { return 0.25 }\n    \n    override var popupDismissDuration: Double { return 0.25 }\n    \n    override var popupShouldDismissInteractivelty: Bool { return false }\n    \n    override var popupDimmingViewAlpha: CGFloat { return BottomPopupConstants.kDimmingViewDefaultAlphaValue }\n    \n    private func makePopHeight() -> CGFloat {\n        if isShowCancel {\n            return tableHeight + footerBtnView.height + bottomSafeHeight\n        }else {\n            return tableHeight + bottomSafeHeight\n        }\n    }\n    \n    // MARK: - Action\n    \n    @objc func dissAction() {\n        dismiss(animated: true, completion: nil)\n    }\n}\n\n// MARK: - UITableViewDataSource && UITableViewDelegate\n\nextension FYActionSheet: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withClass: FYActionSheetCell.self)\n        if dataSource.count > indexPath.row {\n            cell.textColor = textColor\n            cell.titleFont = titleFont\n            cell.title = dataSource[safe: indexPath.row]\n            if indexPath.row == dataSource.count - 1 {\n                cell.hideLine = true\n            }\n        }\n        return cell\n    }\n    \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        return cellHeight\n    }\n    \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        if dataSource.count > indexPath.row {\n            handler?(indexPath.row)\n        }\n        \n        dissAction()\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Libraries/ActionSheet/FYActionSheetCell.swift",
    "content": "//\n//  FYActionSheetCell.swift\n//  PGActionSheet\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019年 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYActionSheetCell: UITableViewCell {\n    \n    // MARK: - setter && getter\n    \n    var title: String? {\n        didSet {\n            titleLabel.text = title ?? \"\"\n        }\n    }\n    \n    var titleFont: UIFont? {\n        didSet {\n            guard let font = titleFont else {\n                return\n            }\n            \n            titleLabel.font = font\n        }\n    }\n    \n    var textColor: UIColor? {\n        didSet {\n            guard let color = textColor else {\n                return\n            }\n            \n            titleLabel.textColor = color\n        }\n    }\n    \n    var hideLine: Bool? {\n        didSet {\n            guard let isHidden = hideLine else {\n                return\n            }\n            \n            lineView.isHidden = isHidden\n        }\n    }\n    \n    private lazy var titleLabel: UILabel = {\n        let label = UILabel()\n        label.textAlignment = .center\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        label.font = .PingFangRegular(14)\n        return label\n    }()\n    \n    private lazy var lineView: UIView = {\n        let view = UIView()\n        view.theme.backgroundColor = themed { $0.FYColor_BorderColor_V1 }\n        return view\n    }()\n    \n    // MARK: - life cycle\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        self.selectionStyle = .none\n        theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n        contentView.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n        \n        buildUI()\n    }\n    \n    private func buildUI() {\n        contentView.addSubview(titleLabel)\n        contentView.addSubview(lineView)\n        \n        titleLabel.snp.makeConstraints { (make) in\n            make.left.equalToSuperview().offset(13)\n            make.right.equalToSuperview().offset(-13)\n            make.centerY.equalToSuperview()\n        }\n        \n        lineView.snp.makeConstraints { (make) in\n            make.left.right.equalToSuperview()\n            make.bottom.equalToSuperview()\n            make.height.equalTo(0.5)\n        }\n    }\n    \n    required init?(coder aDecoder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Libraries/HUDProgress/MBConfiguredHUD.swift",
    "content": "//\n//  MBConfiguredHUD.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/2/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport MBProgressHUD\nimport UIKit\n\ntypealias MBHUD = MBConfiguredHUD\n\n/// 弹框显示时间\nfileprivate let kAfterDelay: TimeInterval = 1.5\n\nclass MBConfiguredHUD: NSObject {\n\n    fileprivate static let kRegularFont = UIFont.PingFangRegular(14)\n    \n    /// 获取用于显示提示框的view\n    class func hudWindow() -> UIWindow {\n        var window = UIApplication.shared.keyWindow\n        if window?.windowLevel != UIWindow.Level.normal {\n            let windowArray = UIApplication.shared.windows\n            for newWindow in windowArray {\n                if newWindow.windowLevel == UIWindow.Level.normal {\n                    window = newWindow\n                    break\n                }\n            }\n        }\n        return window!\n    }\n    \n    // MARK: - 具体样式设置\n    \n    /// 普通的菊花HUD(需要手动隐藏)\n    class func show() {\n        DispatchQueue.main.async {\n            let window = hudWindow()\n            MBProgressHUD.hide(for: window, animated: false)\n            // create\n            let hud = MBProgressHUD.showAdded(to: window, animated: true)\n            hud.mode = .indeterminate\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.bezelView.style = .solidColor\n            UIActivityIndicatorView.appearance(whenContainedInInstancesOf:\n                [MBProgressHUD.self]).color = .white //设置菊花颜色为白色\n            hud.bezelView.color = .hudBackgroundColor()\n            hud.isUserInteractionEnabled = false\n            hud.removeFromSuperViewOnHide = true\n        }\n    }\n    \n    /// 带文字的菊花HUD（需手动隐藏）\n    class func showStatus(_ status: String, view: UIView = hudWindow()) {\n        DispatchQueue.main.async {\n            let window = view\n            MBProgressHUD.hide(for: window, animated: false)\n            // create\n            let hud = MBProgressHUD.showAdded(to: window, animated: true)\n            hud.label.text = status\n            hud.mode = .indeterminate\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.animationType = .zoom\n            hud.contentColor = .white //文字和菊花颜色\n            hud.bezelView.style = .solidColor\n            UIActivityIndicatorView.appearance(whenContainedInInstancesOf:\n                [MBProgressHUD.self]).color = .white\n            hud.isUserInteractionEnabled = false\n            hud.bezelView.color = .hudBackgroundColor()\n            hud.removeFromSuperViewOnHide = true\n        }\n    }\n    \n    /// 普通文本提示HUD（自动隐藏）\n    class func showMessage(_ message: String) {\n        DispatchQueue.main.async {\n            let window = hudWindow()\n            MBProgressHUD.hide(for: window, animated: false)\n            // create\n            let hud = MBProgressHUD.showAdded(to: window, animated: true)\n            hud.mode = .text\n            hud.label.text = message\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.bezelView.style = .solidColor\n            hud.margin = 5\n            hud.animationType = .zoom\n            hud.isUserInteractionEnabled = false\n            hud.bezelView.color = .hudBackgroundColor()\n            //hud.bezelView.cornerRadius = 4\n            hud.removeFromSuperViewOnHide = true\n            hud.hide(animated: true, afterDelay: kAfterDelay)\n        }\n    }\n    \n    /// 长类型文本提示HUD（自动隐藏）\n    class func showLongMessage(_ message: String) {\n        DispatchQueue.main.async {\n            let window = hudWindow()\n            MBProgressHUD.hide(for: window, animated: false)\n            // create\n            let hud = MBProgressHUD.showAdded(to: window, animated: true)\n            hud.mode = .text\n            hud.label.text = message\n            hud.label.numberOfLines = 0\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.bezelView.style = .solidColor\n            hud.margin = 5\n            hud.animationType = .zoom\n            hud.isUserInteractionEnabled = false\n            hud.bezelView.color = .hudBackgroundColor()\n            //hud.bezelView.cornerRadius = 4\n            hud.removeFromSuperViewOnHide = true\n            hud.hide(animated: true, afterDelay: kAfterDelay)\n        }\n    }\n    \n    /// 成功提示HUD + 图片\n    class func showSuccess(_ success: String) {\n        DispatchQueue.main.async {\n            let window = hudWindow()\n            MBProgressHUD.hide(for: window, animated: false)\n            // create\n            let hud = MBProgressHUD.showAdded(to: window, animated: true)\n            let imageView = UIImageView(image: UIImage(named: \"HUDAssets.bundle/icon_hud_success\"))\n            hud.mode = .customView\n            hud.label.text = success\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.bezelView.layer.masksToBounds = false;\n            hud.bezelView.style = .solidColor\n            hud.animationType = .zoom\n            hud.customView = imageView\n            //hud.minSize = CGSize(width: 231, height: 123) //弹框大小设置\n            hud.isUserInteractionEnabled = false\n            hud.bezelView.color = .hudBackgroundColor()\n            hud.removeFromSuperViewOnHide = true\n            hud.hide(animated: true, afterDelay: kAfterDelay)\n        }\n    }\n    \n    /// 失败提示HUD + 图片\n    class func showFailure(_ success: String) {\n        DispatchQueue.main.async {\n            let window = hudWindow()\n            MBProgressHUD.hide(for: window, animated: false)\n            // create\n            let hud = MBProgressHUD.showAdded(to: window, animated: true)\n            let imageView = UIImageView(image: UIImage(named: \"HUDAssets.bundle/icon_hud_failure\"))\n            hud.mode = .customView\n            hud.label.text = success\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.animationType = .zoom\n            hud.bezelView.layer.masksToBounds = false;\n            hud.bezelView.style = .solidColor\n            hud.customView = imageView\n            //hud.minSize = CGSize(width: 231, height: 123) //弹框大小设置\n            hud.isUserInteractionEnabled = false\n            hud.bezelView.color = .hudBackgroundColor()\n            hud.removeFromSuperViewOnHide = true\n            hud.hide(animated: true, afterDelay: kAfterDelay)\n        }\n    }\n    \n    /// 错误提示HUD + 图片\n    class func showImageError(_ error: String) {\n        DispatchQueue.main.async {\n            let window = hudWindow()\n            MBProgressHUD.hide(for: window, animated: false)\n            // create\n            let hud = MBProgressHUD.showAdded(to: window, animated: true)\n            let imageView = UIImageView(image: UIImage(named: \"HUDAssets.bundle/icon_hud_error\"))\n            hud.mode = .customView\n            hud.label.text = error\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.animationType = .zoom\n            hud.bezelView.layer.masksToBounds = false;\n            hud.bezelView.style = .solidColor\n            hud.customView = imageView\n            hud.isUserInteractionEnabled = false\n            hud.bezelView.color = .hudBackgroundColor()\n            hud.removeFromSuperViewOnHide = true\n            hud.hide(animated: true, afterDelay: kAfterDelay)\n        }\n    }\n    \n    \n    /// HUD立即消失\n    class func hide(_ view: UIView = hudWindow()) {\n        DispatchQueue.main.async {\n            view.isUserInteractionEnabled = true\n            MBProgressHUD.hide(for: view, animated: true)\n        }\n    }\n    \n    /// HUD指定时间消失\n    class func hideWithDelay(_ view: UIView = hudWindow(), delay: TimeInterval = kAfterDelay) {\n        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delay) {\n            view.isUserInteractionEnabled = true\n            MBProgressHUD.hide(for: view, animated: true)\n        }\n    }\n}\n\n\nextension MBConfiguredHUD {\n    \n    /// 指定父视图提示HUD\n    class func showMessageInView(_ message: String, view: UIView) {\n        DispatchQueue.main.async {\n            MBProgressHUD.hide(for: view, animated: true)\n            // create\n            let hud = MBProgressHUD.showAdded(to: view, animated: true)\n            hud.mode = .text\n            hud.label.text = message\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.bezelView.style = .solidColor\n            hud.margin = 5\n            hud.animationType = .zoom\n            hud.isUserInteractionEnabled = false\n            hud.bezelView.color = .hudBackgroundColor()\n            //hud.bezelView.cornerRadius = 4\n            hud.removeFromSuperViewOnHide = true\n            hud.hide(animated: true, afterDelay: kAfterDelay)\n        }\n    }\n    \n    /// 指定父视图成功提示HUD\n    class func showSuccessInView(_ success: String, view: UIView) {\n        MBConfiguredHUD.hide()\n        DispatchQueue.main.async {\n            MBProgressHUD.hide(for: view, animated: true)\n            // create\n            let hud = MBProgressHUD.showAdded(to: view, animated: true)\n            let imageView = UIImageView(image: UIImage(named: \"HUDAssets.bundle/icon_hud_success\"))\n            hud.mode = .customView\n            hud.label.text = success\n            hud.label.textColor = .white\n            hud.label.font = self.kRegularFont\n            hud.contentColor = .white //文字和菊花颜色\n            hud.animationType = .zoom\n            hud.bezelView.layer.masksToBounds = false;\n            hud.bezelView.style = .solidColor\n            hud.customView = imageView\n            //hud.minSize = CGSize(width: 231, height: 123) //弹框大小设置\n            hud.isUserInteractionEnabled = true\n            hud.bezelView.color = .hudBackgroundColor()\n            hud.removeFromSuperViewOnHide = true\n            hud.hide(animated: true, afterDelay: kAfterDelay)\n        }\n    }\n\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Libraries/NavPopup/Cell/FYNavDropMenuCell.swift",
    "content": "//\n//  FYNavDropMenuCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/6.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYNavDropMenuCell: UITableViewCell {\n\n    // MARK: - setter && getter\n    \n    var model: FYCellDataConfig? {\n        didSet {\n            guard let model = model else {\n                return\n            }\n            \n            titleLabel.text = model.title\n            leftImageView.image = UIImage(named: model.image!)\n            lineView.isHidden = !model.isShow\n            \n            if model.image.isBlank {\n                titleLabel.snp.remakeConstraints { (make) in\n                    make.centerY.equalToSuperview()\n                    make.centerX.equalToSuperview()\n                }\n            }\n        }\n    }\n    \n    private lazy var titleLabel: UILabel = {\n        let label = UILabel()\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        label.font = UIFont.PingFangRegular(15)\n        return label\n    }()\n    \n    private lazy var leftImageView: UIImageView = {\n        let imageView = UIImageView()\n        return imageView\n    }()\n    \n    private lazy var lineView: UIView = {\n        let view = UIView()\n        view.theme.backgroundColor = themed { $0.FYColor_BorderColor_V1 }\n        return view\n    }()\n    \n    // MARK: - life cycle\n    \n    override func awakeFromNib() {\n        super.awakeFromNib()\n        // Initialization code\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n    }\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n         \n        self.makeUI()\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    func makeUI() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n        \n        contentView.addSubview(leftImageView)\n        contentView.addSubview(titleLabel)\n        contentView.addSubview(lineView)\n        \n        leftImageView.snp.makeConstraints { (make) in\n            make.centerY.equalToSuperview()\n            make.left.equalToSuperview().offset(16)\n            make.width.equalTo(25)\n            make.height.equalTo(25)\n        }\n        \n        titleLabel.snp.makeConstraints { (make) in\n            make.centerY.equalToSuperview()\n            make.left.equalTo(leftImageView.snp.right).offset(5)\n        }\n        \n        lineView.snp.makeConstraints { (make) in\n            make.left.bottom.right.equalToSuperview()\n            make.height.equalTo(0.6)\n        }\n    }\n\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Libraries/NavPopup/FYNavPopuListMenu.swift",
    "content": "//\n//  FYNavPopuListMenu.swift\n//  FYNavPopuListMenu\n//\n//  Created by iOS.Jet on 2019/2/20.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\n/// 声明代理方法\nprotocol FYPopListMenuDelegate: Any {\n    func menu(_ model: FYCellDataConfig, didSelectRowAt index: Int)\n}\n\nextension FYPopListMenuDelegate {\n    func menu(_ model: FYCellDataConfig, didSelectRowAt index: Int) { }\n}\n\nclass FYNavPopuListMenu: UIView {\n    \n    let kMaxCount: CGFloat = 6\n    let kCellHeight: CGFloat = 50\n    let triangleHeight: CGFloat = 12\n    \n    var tableH: CGFloat = 0\n    let tableW: CGFloat = 140\n    \n    let xSpace: CGFloat = 15\n    var ySpace: CGFloat = kNavigaH + 1\n    \n    var didClosedClosure : (()->Void)?\n    \n    var didSelectedClosure : ((Int, FYCellDataConfig)->Void)?\n    \n    var dataSource: [FYCellDataConfig] = []\n    \n    /// 设置代理\n    var delegate: FYPopListMenuDelegate?\n    \n    /// 尖角\n    var triangleView: UIView?\n    var triangleFrame: CGRect?\n    \n    // MARK: - var lazy\n    \n    private lazy var tapGesture: UITapGestureRecognizer = {\n        let tap = UITapGestureRecognizer.init(target: self, action: #selector(dismiss))\n        tap.numberOfTapsRequired = 1\n        return tap\n    }()\n\n    private lazy var menuMaskView: UIView = {\n        let maskView = UIView.init()\n        maskView.isUserInteractionEnabled = true\n        maskView.addGestureRecognizer(tapGesture)\n        maskView.backgroundColor = UIColor.clear\n        maskView.alpha = 0\n        return maskView\n    }()\n    \n    private lazy var tableView: UITableView = {\n        let table = UITableView.init()\n        table.delegate = self\n        table.dataSource = self\n        table.cornerRadius = 5\n        table.estimatedRowHeight = 0\n        table.rowHeight = kCellHeight\n        table.separatorStyle = .none\n        table.tableFooterView = UIView()\n        table.showsVerticalScrollIndicator = false\n        table.separatorInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)\n        table.isScrollEnabled = dataSource.count > Int(kMaxCount)\n        table.register(FYNavDropMenuCell.self, forCellReuseIdentifier: \"kPopMenuCellIdentifier\")\n        return table\n    }()\n    \n    private lazy var contentView: UIView = {\n        let content = UIView.init()\n        content.backgroundColor = UIColor.clear\n        content.makeLayerShadowCorner()\n        content.alpha = 0\n        return content\n    }()\n    \n    \n    // MARK: - Life cycle\n    \n    convenience init(dataSource: [FYCellDataConfig], ySpace: CGFloat = kNavigaH + 1) {\n        self.init()\n        self.ySpace = ySpace\n        self.dataSource = dataSource\n        \n        makeUI()\n    }\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        \n        makeUI()\n    }\n    \n    required init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        \n        makeUI()\n    }\n    \n    func makeUI() {\n        self.frame = UIScreen.main.bounds\n        self.backgroundColor = UIColor.clear\n        guard dataSource.count > 0 else {\n            return\n        }\n        \n        self.menuMaskView.frame = self.bounds\n        self.addSubview(menuMaskView)\n        \n        tableH = dataSource.count > Int(kMaxCount) ? kMaxCount : CGFloat(dataSource.count) * kCellHeight\n        \n        contentView.frame = CGRect(x: kScreenW - tableW - xSpace, y: ySpace, width: tableW, height: tableH + triangleHeight)\n        addSubview(contentView)\n        \n        triangleFrame = CGRect(x: tableW - 25, y: 0, width: 16, height: triangleHeight)\n        drawTriangleView()\n        \n        tableView.frame = CGRect(x: 0, y: triangleHeight, width: tableW, height: tableH)\n        contentView.addSubview(tableView)\n    }\n    \n    // 绘制三角形尖角\n    func drawTriangleView() {\n        if triangleView == nil {\n            triangleView = UIView()\n            triangleView?.alpha = 0.0\n            triangleView?.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n            contentView.addSubview(triangleView!)\n        }\n        \n        triangleFrame = CGRect(x: self.triangleFrame!.minX, y: triangleFrame!.minY, width: triangleFrame!.width, height: triangleFrame!.height)\n        triangleView?.frame = triangleFrame!\n        \n        let shaperLayer = CAShapeLayer()\n        let path = CGMutablePath()\n        path.move(to: CGPoint(x: triangleFrame!.width * 0.5, y: 0), transform: .identity)\n        path.addLine(to: CGPoint(x: 0, y: triangleFrame!.height), transform: .identity)\n        path.addLine(to: CGPoint(x: triangleFrame!.width, y: triangleFrame!.height), transform: .identity)\n        shaperLayer.path = path\n        \n        triangleView?.layer.mask = shaperLayer\n    }\n}\n\n\n// MARK: - Action\n\nextension FYNavPopuListMenu {\n    \n    func show() {\n        self.contentView.alpha   = 1.0\n        self.menuMaskView.alpha  = 1.0\n        self.triangleView?.alpha = 1.0\n        UIApplication.shared.keyWindow?.addSubview(self)\n        \n        let animation = CAKeyframeAnimation(keyPath: \"transform\")\n        animation.duration = CFTimeInterval(0.2) //动画时间\n        var values = [AnyHashable]()\n        values.append(NSValue(caTransform3D: CATransform3DMakeScale(0.5, 0.5, 1.0)))\n        values.append(NSValue(caTransform3D: CATransform3DMakeScale(0.95, 0.95, 1.0)))\n        values.append(NSValue(caTransform3D: CATransform3DMakeScale(1.0, 1.0, 1.0)))\n        animation.values = values\n        self.contentView.layer.add(animation, forKey: nil)\n    }\n    \n    @objc func dismiss(_ isAnimate: Bool = true) {\n        // 关闭\n        self.didClosedClosure?()\n        \n        self.contentView.layer.removeAllAnimations()\n        UIView.animate(withDuration: 0.25, animations: { [unowned self] in\n            self.triangleView?.alpha = 0\n            self.menuMaskView.alpha  = 0\n            self.contentView.alpha   = 0\n            self.contentView.transform = CGAffineTransform(scaleX: 0.1, y: 0.1)\n        }) { (finished) -> Void in\n            self.removeFromSuperview()\n        }\n    }\n}\n\n// MARK: - UITableViewDataSource && Delegate\n\nextension FYNavPopuListMenu: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: \"kPopMenuCellIdentifier\", for: indexPath) as! FYNavDropMenuCell\n        if let model = dataSource[safe: indexPath.row] {\n            cell.model = model\n        }\n        return cell\n    }\n \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        if let model = dataSource[safe: indexPath.row] {\n            delegate?.menu(model, didSelectRowAt: indexPath.row)\n            // block\n            if didSelectedClosure != nil {\n                didSelectedClosure?(indexPath.row, model)\n            }\n        }\n        \n        dismiss()\n    }\n    \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        return kCellHeight\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Libraries/Refreshing/FYMomentsHeaderRefresh.swift",
    "content": "//\n//  FYMomentsHeaderRefresh.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport MJRefresh\n\nfileprivate let kHeaderHeight: CGFloat = 60\n\nclass FYMomentsHeaderRefresh: MJRefreshHeader {\n    \n    private lazy var rotateImageView: UIImageView = {\n        let imageView = UIImageView(image: R.image.ic_album_reflash())\n        return imageView\n    }()\n    \n    // MARK: - prepare\n    \n    override func prepare() {\n        super.prepare()\n        \n        self.ignoredScrollViewContentInsetTop = -60\n        self.mj_h = kHeaderHeight\n        \n        self.addSubview(rotateImageView)\n        self.mj_y = -self.mj_h - self.ignoredScrollViewContentInsetTop;\n    }\n    \n    override func placeSubviews() {\n        super.placeSubviews()\n        \n        self.rotateImageView.frame = CGRect(x: 30, y: 30, width: 30, height: 30)\n    }\n    \n    // MARK: - ScrollViewPanStateDidChange\n    \n    override func scrollViewPanStateDidChange(_ change: [AnyHashable : Any]?) {\n        super.scrollViewPanStateDidChange(change)\n        \n        self.mj_y = -self.mj_h - self.ignoredScrollViewContentInsetTop;\n        let scrollViewOffsetY: CGFloat = self.scrollView?.mj_offsetY ?? 0\n        let pullingY: CGFloat = abs(scrollViewOffsetY + 64 +\n                                     self.ignoredScrollViewContentInsetTop)\n        \n        if (pullingY >= kHeaderHeight) {\n            let marginY: CGFloat = -kHeaderHeight - (pullingY - kHeaderHeight) -\n            self.ignoredScrollViewContentInsetTop;\n            \n            self.mj_y = marginY ;\n        }\n        \n        UIView.animate(withDuration: 1.35) {\n            self.rotateImageView.transform = CGAffineTransform(rotationAngle: CGFloat.pi / 2).concatenating(self.rotateImageView.transform)\n        }\n    }\n    \n    // MARK: - MJRefreshState\n    \n    override var state: MJRefreshState {\n        didSet {\n            switch state {\n            case .idle:\n                self.rotateImageView.isHidden = true\n            case .pulling:\n                self.rotateImageView.isHidden = false\n            case .refreshing:\n                self.rotateImageView.isHidden = false\n            default:\n                break\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/Controller/FYChatBaseViewController.swift",
    "content": "//\n//  FYChatBaseViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/13.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport IQKeyboardManagerSwift\nimport YBImageBrowser\nimport RxSwift\n\n\npublic enum ChatType: Int {\n    case singleChat  = 1\n    case groupedChat = 2\n}\n\nprivate let kTextMessageCellIdentifier  = \"kTextMessageCellIdentifier\"\nprivate let kImageMessageCellIdentifier = \"kImageMessageCellIdentifier\"\nprivate let kVideoMessageCellIdentifier = \"kVideoMessageCellIdentifier\"\n\nclass FYChatBaseViewController: FYBaseViewController {\n    \n    /// 角标数记录\n    private var badge: Int = 0\n    \n    // 键盘收起/弹出\n    private var isBecome: Bool = false\n    private var isSended: Bool = true\n    private var isTimered: Bool = false\n    private let keyboardLastY: CGFloat = 301\n    \n    private let kToolBarLastH: CGFloat = 52\n    private var kToolBarLastY: CGFloat = 551\n    private var lastMaxY: CGFloat = 0.0\n    \n    \n    // MARK: - var lazy\n    \n    /// 聊天类型（默认单聊）\n    var chatModel: FYMessageChatModel? = FYMessageChatModel()\n    \n    /// 消息转发\n    var isForward: Bool = false\n    var forwardData: FYMessageItem?\n    \n    var timer: Timer?\n    var viewModel: FYMessageViewModel?\n    \n    var dataSource: [FYMessageItem] = []\n    \n    private lazy var keyboardView: ChatKeyboardView = {\n        let toolBarY = kScreenH - kNavigaH - kToolBarLastH - kSafeAreaBottom\n        let view = ChatKeyboardView(frame: CGRect(x: 0, y: toolBarY, width: kScreenW, height: kToolBarLastH))\n        view.delegate = self\n        return view\n    }()\n    \n    // MARK: - life cycle\n    \n    override func viewWillAppear(_ animated: Bool) {\n        super.viewWillAppear(animated)\n        IQKeyboardManager.shared.enable = false\n        IQKeyboardManager.shared.enableAutoToolbar = false\n    }\n    \n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        // 禁止侧滑返回手势\n        navigationController?.interactivePopGestureRecognizer?.isEnabled = false\n        navigationController?.fd_fullscreenPopGestureRecognizer.isEnabled = false\n    }\n    \n    override func viewDidDisappear(_ animated: Bool) {\n        super.viewDidDisappear(animated)\n        IQKeyboardManager.shared.enable = true\n        IQKeyboardManager.shared.enableAutoToolbar = true\n        // stop timer\n        stopChatTimer()\n    }\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V2 }\n        \n        configNavBar()\n        loadCacheData()\n    }\n    \n    /// 构造聊天会话\n    /// - Parameter chatModel: 聊天实体（分单聊、群聊）\n    /// - Parameter isForward: 是否转发消息\n    convenience init(chatModel: FYMessageChatModel, isForward: Bool = false) {\n        self.init()\n        \n        self.chatModel = chatModel\n        self.isForward = isForward\n        self.viewModel = FYMessageViewModel(chatModel: chatModel)\n    }\n    \n    private func configNavBar() {\n        if chatModel?.nickName.isBlank == false {\n            navigationItem.title = chatModel?.nickName\n        }else {\n            navigationItem.title = chatModel?.name\n        }\n        \n        if chatModel?.chatType == 2 {\n            let rightBarButtonItem = UIBarButtonItem(title: \"退出群\".rLocalized(), style: .plain, target: self, action: #selector(exitGroupChat))\n            navigationItem.rightBarButtonItem = rightBarButtonItem\n        }\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        let height = kScreenH - (kToolBarLastH + kSafeAreaBottom + kNavigaH)\n        plainTabView.frame = CGRect(x: 0, y: 0, width: kScreenW, height: height)\n        plainTabView.dataSource = self\n        plainTabView.delegate = self\n        plainTabView.separatorStyle = .none\n        plainTabView.estimatedRowHeight = 100\n        plainTabView.tableFooterView = UIView()\n        plainTabView.showsVerticalScrollIndicator = true\n        registerChatCell()\n        view.addSubview(plainTabView)\n        // 添加聊天键盘\n        view.addSubview(keyboardView)\n        \n        viewModel?.tableView = plainTabView\n    }\n    \n    override func bindViewModel() {\n        super.bindViewModel()\n        \n        let refresh = Observable.of(Observable.never(), loadingTrigger).merge()\n        let input = FYMessageViewModel.Input(makeMessage: refresh, makeBrowser: refresh)\n        let output = viewModel?.transform(input: input)\n        // message\n        output?.message.asDriver(onErrorJustReturn: FYMessageItem())\n            .drive(onNext: { [weak self] (msgItem) in\n                guard let self = self else { return }\n                guard msgItem.msgType != nil else {\n                    return\n                }\n                self.reloadChatData(msgItem)\n            }).disposed(by: rx.disposeBag)\n        // browser\n        output?.browser.asDriver(onErrorJustReturn: [])\n            .drive(onNext: { [weak self] (objects) in\n                guard let self = self else { return }\n                guard objects.count > 0 else {\n                    return\n                }\n                self.browserWithData(objects, index: (self.viewModel?.imageIndex.value)!)\n        }).disposed(by: rx.disposeBag)\n        \n        // forward\n        if isForward {\n            if let messageItem = forwardData {\n                reloadChatData(messageItem)\n            }\n        }\n    }\n    \n    private func startChatTimer() {\n        \n        if chatModel?.chatType == 2 && !self.isTimered {\n            timer = Timer(timeInterval: 10, target: self, selector: #selector(makeGroupAutoSend), userInfo: nil, repeats: true)\n            RunLoop.main.add(timer!, forMode: .common)\n            timer?.fire() // 启动定时器\n            \n            isTimered = true\n        }\n    }\n    \n    private func saveWidgetData(item: FYMessageItem) {\n        if let object = item.toJSON() {\n            FYUserDefaultManager.saveWidgetObject(object)\n        }\n        \n        AppDelegate.app.reloadWidgetData()\n    }\n    \n    private func stopChatTimer() {\n        if isTimered {\n            timer?.invalidate()\n        }\n    }\n    \n    private func registerChatCell() {\n        plainTabView.register(FYTextMessageCell.self, forCellReuseIdentifier: kTextMessageCellIdentifier)\n        plainTabView.register(FYImageMessageCell.self, forCellReuseIdentifier: kImageMessageCellIdentifier)\n        plainTabView.register(FYVideoMessageCell.self, forCellReuseIdentifier: kVideoMessageCellIdentifier)\n    }\n    \n    /// 滚到底部\n    private func scrollToBottom(_ animated: Bool = true) {\n        \n        plainTabView.scrollToLast(at: .bottom, animated: animated)\n    }\n    \n    override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {\n        let myTouch = touches.first! as UITouch\n        let myLocation = myTouch.location(in: self.view)\n        if myLocation.y < keyboardLastY {\n            NotificationCenter.default.post(name: .kChatTextKeyboardNeedHide, object: nil)\n        }\n    }\n    \n    \n    /// 退出群聊\n    @objc private func exitGroupChat() {\n        \n        EasyAlertView.customAlert(title: \"确定退出当前群组吗？\".rLocalized(), message: \"\", confirm: \"确定\".rLocalized(), cancel: \"取消\".rLocalized(), vc: self, confirmBlock: {\n            if let uid = self.chatModel?.uid {\n                self.stopChatTimer()\n                FYDBQueryHelper.shared.deleteFromChatWithId(uid)\n                FYDBQueryHelper.shared.deleteFromMesssageWithId(uid)\n                // 退出群\n                NotificationCenter.default.post(name: .kNeedRefreshChatInfoList, object: nil)\n                \n                let message = String(format: \"你已退出%@群聊\", self.chatModel?.name ?? \"\")\n                MBHUD.showMessage(message)\n                self.navigationController?.popViewController()\n            }\n        }, cancelBlock: {\n            \n        })\n    }\n    \n    deinit {\n        stopChatTimer()\n    }\n}\n\n\n// MARK: - ChatKeyboardViewDelegate\n\nextension FYChatBaseViewController: ChatKeyboardViewDelegate {\n    \n    func keyboard(_ keyboard: ChatKeyboardView, DidFinish content: String) {\n        \n        makeChatMessage(.text, content: content)\n    }\n    \n    func keyboard(_ keyboard: ChatKeyboardView, DidBecome isBecome: Bool) {\n        self.isSended = true\n        self.isBecome = isBecome\n    }\n    \n    func keyboard(_ keyboard: ChatKeyboardView, DidMoreMenu type: ChatMoreMenuType) {\n        \n        openImagePicker(type)\n    }\n    \n    func keyboard(_ keyboard: ChatKeyboardView, DidObserver offsetY: CGFloat) {\n        restChatKeyboardSafeTop(offsetY)\n    }\n    \n    private func restChatKeyboardSafeTop(_ offsetY: CGFloat) {\n        if (dataSource.count >= 1) {\n            let lastIndex = IndexPath(row: dataSource.count - 1, section: 0)\n            let rect = plainTabView.rectForRow(at: lastIndex)\n            if rect.width > 0 {\n                lastMaxY = rect.origin.y + rect.size.height\n                if (lastMaxY <= plainTabView.height) {\n                    if (lastMaxY >= offsetY) {\n                        plainTabView.y = offsetY - lastMaxY\n                    }else {\n                        plainTabView.y = 0\n                    }\n                    \n                }else {\n                    \n                    plainTabView.y += offsetY - plainTabView.maxY;\n                }\n            }else {\n                \n                printLog(\"========😁😁😁😁😁😁😁😁\")\n            }\n        }\n    }\n    \n    private func makeChatMessage(_ type: ChatDataType, content: String = \"\") {\n        viewModel?.browserType.accept(.none)\n        viewModel?.messageType.accept(type)\n        if type == .text {\n            viewModel?.content.accept(content)\n        }\n        loadingTrigger.onNext(())\n        \n        startChatTimer()\n    }\n    \n    /// 模拟群组聊天自动发送消息\n    @objc private func makeGroupAutoSend() {\n        viewModel?.browserType.accept(.none)\n        viewModel?.messageType.accept(.autoSend)\n        loadingTrigger.onNext(())\n    }\n    \n    private func reloadChatData(_ msgItem: FYMessageItem) {\n        isSended = true\n        dataSource.append(msgItem)\n        viewModel?.dataSource.accept(dataSource)\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData {\n                self.scrollToBottom()\n                self.beginCacheMessage(msgItem)\n                self.restChatKeyboardSafeTop(self.keyboardView.y)\n            }\n        }\n        \n        saveWidgetData(item: msgItem)\n    }\n}\n\n// MARK: - MoreMenu Manager\n\nextension FYChatBaseViewController: TZImagePickerControllerDelegate {\n    \n    private func openImagePicker(_ type: ChatMoreMenuType) {\n        let imagePicker = TZImagePickerController(maxImagesCount: 1, columnNumber: 5, delegate: self)\n        imagePicker?.didFinishPickingPhotosHandle = {(images: [UIImage]?, assets:[Any]?, isSelectOriginalPhoto: Bool) in\n            printLog(images)\n            if (type == .album) {\n                self.makeChatMessage(.image)\n            }else if (type == .video) {\n                self.makeChatMessage(.video)\n            }\n        }\n        \n        switch type {\n        case .album, .video:\n            present(imagePicker!, animated: true, completion: nil)\n        default:\n            break\n        }\n    }\n}\n\n// MARK: - DataBase\n\nextension FYChatBaseViewController {\n    \n    func beginCacheMessage(_ object: FYMessageItem) {\n        FYDBQueryHelper.shared.insertFromMessage(object)\n        \n        // 更新角标\n        self.badge += 1\n        if let uid = self.chatModel?.uid {\n            self.chatModel?.unReadCount = self.badge\n            FYDBQueryHelper.shared.updateFromChatModel(self.chatModel!, uid: uid)\n            // 通知刷新会话列表\n            NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n        }\n    }\n    \n    \n    func loadCacheData(_ toBottom: Bool = true) {\n        if let chatId = chatModel?.uid {\n            dataSource = FYDBQueryHelper.shared.qureyFromMessagesWithChatId(chatId)\n            viewModel?.dataSource.accept(dataSource)\n        }\n        \n        plainTabView.reloadData()\n        if (toBottom) {\n            scrollToBottom(toBottom)\n        }\n    }\n}\n\n\n// MARK: - UITableViewDataSource\n\nextension FYChatBaseViewController: UITableViewDataSource {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        if let model = dataSource[safe: indexPath.row] {\n            if model.msgType == 1 {\n                let textCell = tableView.dequeueReusableCell(withIdentifier: kTextMessageCellIdentifier) as! FYTextMessageCell\n                textCell.delegate = self\n                configureCellModel(cell: textCell, at: indexPath)\n                return textCell\n            }else if model.msgType == 2 {\n                let imageCell = tableView.dequeueReusableCell(withIdentifier: kImageMessageCellIdentifier) as! FYImageMessageCell\n                configureCellModel(cell: imageCell, at: indexPath)\n                imageCell.delegate = self\n                return imageCell\n            }else if model.msgType == 3 {\n                let videoCell = tableView.dequeueReusableCell(withIdentifier: kVideoMessageCellIdentifier) as! FYVideoMessageCell\n                configureCellModel(cell: videoCell, at: indexPath)\n                videoCell.delegate = self\n                return videoCell\n            }\n        }\n        \n        return UITableViewCell()\n    }\n    \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        if let model = dataSource[safe: indexPath.row] {\n            if model.msgType == 1 {\n                return plainTabView.fd_heightForCell(withIdentifier: kTextMessageCellIdentifier, cacheBy: indexPath) { [weak self] (cell) in\n                    if let textCell = cell as? FYTextMessageCell {\n                        self?.configureCellModel(cell: textCell, at: indexPath)\n                    }\n                }\n            }else if model.msgType == 2 {\n                return plainTabView.fd_heightForCell(withIdentifier: kImageMessageCellIdentifier, cacheBy: indexPath) { [weak self] (cell) in\n                    if let imageCell = cell as? FYImageMessageCell {\n                        self?.configureCellModel(cell: imageCell, at: indexPath)\n                    }\n                }\n            }else if model.msgType == 3 {\n                return plainTabView.fd_heightForCell(withIdentifier: kVideoMessageCellIdentifier, cacheBy: indexPath) { [weak self] (cell) in\n                    if let videoCell = cell as? FYVideoMessageCell {\n                        self?.configureCellModel(cell: videoCell, at: indexPath)\n                    }\n                }\n            }\n        }\n        \n        return 0.01\n    }\n    \n    \n    func configureCellModel(cell: UITableViewCell, at indexPath: IndexPath) {\n        if let textCell = cell as? FYTextMessageCell {\n            textCell.model = self.dataSource[safe: indexPath.row]\n        }else if let imageCell = cell as? FYImageMessageCell {\n            imageCell.model = self.dataSource[safe: indexPath.row]\n        }else if let viodeCell = cell as? FYVideoMessageCell {\n            viodeCell.model = self.dataSource[safe: indexPath.row]\n        }\n    }\n}\n\n// MARK: - FYMessageBaseCellDelegate\n\nextension FYChatBaseViewController: FYMessageBaseCellDelegate {\n    \n    func cell(_ cell: FYMessageBaseCell, didMenu style: MenuShowStyle, model: FYMessageItem) {\n        if style == .delete {\n            if let row = plainTabView.indexPath(for: cell)?.item {\n                dataSource.remove(at: row)\n                if let messageId = model.messageId {\n                    FYDBQueryHelper.shared.deleteFromMessageId(messageId)\n                }\n                \n                loadCacheData(false)\n                // 通知刷新会话列表\n                NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n            }\n        }else if style == .copy {\n            if let message = model.message, message.length > 0 {\n                message.stringGeneral()\n            }\n        }else if (style == .share) {\n            \n            messageForward(model)\n        }\n    }\n    \n    func cell(_ cell: FYMessageBaseCell, didTapAvatarAt model: FYMessageItem) {\n        if model.sendType == 0 {\n            return\n        }\n        \n        let userModel = FYDBQueryHelper.shared.qureyFromChatId(model.chatId!)\n        let infoVC = FYContactsInfoViewController()\n        infoVC.chatModel = userModel\n        navigationController?.pushViewController(infoVC)\n    }\n    \n    func cell(_ cell: FYMessageBaseCell, didTapPictureAt model: FYMessageItem) {\n        if let row = plainTabView.indexPath(for: cell)?.item {\n            if model.msgType == 2 {\n                viewModel?.messageType.accept(.none)\n                viewModel?.imageIndex.accept(row)\n                viewModel?.browserType.accept(.image)\n                loadingTrigger.onNext(())\n            }\n        }\n    }\n    \n    func cell(_ cell: FYMessageBaseCell, didTapVideoAt model: FYMessageItem) {\n        if let row = plainTabView.indexPath(for: cell)?.item {\n            if model.msgType == 3 {\n                viewModel?.messageType.accept(.none)\n                viewModel?.imageIndex.accept(row)\n                viewModel?.browserType.accept(.video)\n                loadingTrigger.onNext(())\n            }\n        }\n    }\n    \n    /// 消息转发\n    private func messageForward(_ message: FYMessageItem) {\n        if let chatType = message.chatType {\n            let forwardVC = FYMessageForwardViewController()\n            if chatType == 1 {\n                forwardVC.forwardStyle = .friend\n            }else {\n                forwardVC.forwardStyle = .grouped\n            }\n            forwardVC.messageItem = message\n            self.navigationController?.pushViewController(forwardVC)\n        }\n    }\n}\n\n// MARK: - UITableViewDelegate\n\nextension FYChatBaseViewController: UITableViewDelegate, UIScrollViewDelegate {\n    \n    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {\n        if isSended {\n            isSended = false\n        }\n    }\n    \n    func scrollViewDidScroll(_ scrollView: UIScrollView) {\n        if isSended {\n            return\n        }\n    \n        if plainTabView.y <= 0 && isBecome {\n            DispatchQueue.main.async {\n                NotificationCenter.default.post(name: .kChatTextKeyboardNeedHide, object: nil)\n            }\n        }\n    }\n}\n\n\n// MARK: - Image && Video Browser\n\nextension FYChatBaseViewController {\n    \n    func browserWithData(_ dataSource: [AnyObject]?, index: Int = 0) {\n        var browserIndex = 0\n        let browser = YBImageBrowser()\n        if let imageData = dataSource as? [YBIBImageData] {\n            browserIndex = (viewModel?.browserIndexs.value[index] ?? index)\n            browser.dataSourceArray = imageData\n        }else if let videoData = dataSource as? [YBIBVideoData] {\n            browserIndex = (viewModel?.browserIndexs.value[index] ?? index)\n            browser.dataSourceArray = videoData\n        }\n        browser.currentPage = browserIndex - 1\n        browser.show()\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/Controller/FYChatRoomListViewController.swift",
    "content": "//\n//  FYChatRoomListViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/8/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport WCDBSwift\n\nfileprivate let kGroupedChatCellIdentifier = \"kGroupedChatCellIdentifier\"\n\nclass FYChatRoomListViewController: FYBaseViewController {\n\n    // MARK: - var lazy\n    \n    var dataSource: [FYMessageChatModel] = []\n    \n    private lazy var deleteButton: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"删除所有群组\".rLocalized(), for: .normal)\n        button.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V11 }, for: .normal)\n        button.titleLabel?.font = .PingFangRegular(16)\n        button.sizeToFit()\n        button.isHidden = true\n        button.rxTapClosure { [weak self] in\n            self?.showClearAlert()\n        }\n        return button\n    }()\n    \n    \n    // MARK: - life cycle\n    \n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        deleteButton.isHidden = dataSource.count > 0 ? false : true\n    }\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"群聊\".rLocalized()\n        \n        loadGroupData()\n        registerGroupNoti()\n    }\n    \n    @objc private func loadGroupData() {\n        dataSource = FYDBQueryHelper.shared.qureyFromChatsWithType(2)\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData()\n            self.deleteButton.isHidden = self.dataSource.count > 0 ? false : true\n        }\n    }\n    \n    private func registerGroupNoti() {\n        NotificationCenter.default.addObserver(self, selector: #selector(loadGroupData), name: .kNeedRefreshChatInfoList, object: nil)\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n    \n        navigationItem.leftBarButtonItem = UIBarButtonItem(customView: deleteButton)\n        \n        let rightBarButtonItem = UIBarButtonItem(title: \"加入群\".rLocalized(), style: .plain, target: self, action: #selector(addGroupData))\n        navigationItem.rightBarButtonItem = rightBarButtonItem\n        \n        plainTabView.register(FYContactsTableViewCell.self, forCellReuseIdentifier: kGroupedChatCellIdentifier)\n        view.addSubview(plainTabView)\n        plainTabView.snp.makeConstraints { (make) in\n            make.top.left.right.equalTo(self.view)\n            if #available(iOS 11.0, *) {\n                make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom)\n            } else {\n                make.bottom.equalTo(self.view.snp.bottomMargin)\n            }\n        }\n    }\n    \n    @objc private func showClearAlert() {\n        \n        EasyAlertView.customAlert(title: \"确定删除全部群组吗？\".rLocalized(), message: \"删除后，会话记录也将清除\".rLocalized(), confirm: \"确定\".rLocalized(), cancel: \"取消\".rLocalized(), vc: self, confirmBlock: {\n            self.removerGroupData()\n        }, cancelBlock: {\n            \n        })\n    }\n    \n    @objc private func addGroupData() {\n        var uid = 10\n        if let lastUser = dataSource.last {\n            uid = lastUser.uid! + 1\n        }\n        \n        let chat = FYMessageChatModel()\n        chat.uid = uid\n        chat.name = \"好好学习群：\\(uid)\"\n        chat.avatar = \"https://img2.woyaogexing.com/2019/11/10/c133b080fcfd43e1916e74eaea4c631b!400x400.jpeg\"\n        chat.isShowName = true\n        chat.chatType = 2 //群聊\n        \n        dataSource.append(chat)\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData {\n                self.scrollToBottom()\n                FYDBQueryHelper.shared.insertFromChat(chat)\n                self.deleteButton.isHidden = self.dataSource.count > 0 ? false : true\n            }\n        }\n    }\n    \n    @objc private func removerGroupData() {\n        dataSource.removeAll()\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData {\n                self.scrollToBottom()\n                FYDBQueryHelper.shared.deleteFromChatsWithType(2)\n                FYDBQueryHelper.shared.deleteFromMessagesWithType(2)\n                self.deleteButton.isHidden = self.dataSource.count > 0 ? false : true\n                // 刷新会话列表\n                NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n            }\n        }\n    }\n\n    \n    /// 滚到底部\n    private func scrollToBottom(_ animated: Bool = true) {\n        \n        plainTabView.scrollToLast(at: .bottom, animated: animated)\n    }\n}\n\n\n\n// MARK: - UITableViewDataSource && Delegate\n\nextension FYChatRoomListViewController: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: kGroupedChatCellIdentifier) as! FYContactsTableViewCell\n        if let model = dataSource[safe: indexPath.row] {\n            cell.model = model\n        }\n        return cell\n    }\n    \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        if let model = dataSource[safe: indexPath.row] {\n            let chatModel = FYDBQueryHelper.shared.qureyFromChatId(model.uid!)\n            let chatVC = FYChatBaseViewController(chatModel: chatModel)\n            navigationController?.pushViewController(chatVC, animated: true)\n            // clear\n            clearCurrentBadge(chatModel)\n        }\n    }\n    \n    /// 清空角标\n    private func clearCurrentBadge(_ group: FYMessageChatModel) {\n        \n        if FYDBQueryHelper.shared.queryFromSesstionsUnReadCount() > 0 {\n            if let uid = group.uid {\n                group.unReadCount = 0\n                FYDBQueryHelper.shared.updateFromChatModel(group, uid: uid)\n                // 刷新会话列表\n                NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n            }\n        }\n    }\n        \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        return 82\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/Controller/FYMessageForwardViewController.swift",
    "content": "//\n//  FYMessageForwardViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/12/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nenum ForwardStyle {\n    case friend\n    case grouped\n}\n\n\nclass FYMessageForwardViewController: FYBaseViewController {\n\n    // MARK: - lazy var\n    \n    /// 转发方式\n    public var forwardStyle = ForwardStyle.friend\n    public var messageItem: FYMessageItem?\n    \n    private var dataSource: [FYMessageChatModel] = []\n    private var selectedModel: FYMessageChatModel?\n \n    private lazy var forwardBtn: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"发送\".rLocalized(), for: .normal)\n        button.setTitleColor(.colorWithHexStr(\"FFFFFF\"), for: .normal)\n        button.sizeToFit()\n        button.isHidden = true\n        button.rxTapClosure { [weak self] in\n            self?.forwardAction()\n        }\n        return button\n    }()\n    \n    \n    // MARK: - life cycle\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"消息转发\".rLocalized()\n        \n        loadChatBodyData(forwardStyle)\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        let rightBarButtonItem = UIBarButtonItem(customView: self.forwardBtn)\n        navigationItem.rightBarButtonItem = rightBarButtonItem\n        \n        plainTabView.register(cellWithClass: FYContactsTableViewCell.self)\n        view.addSubview(plainTabView)\n        plainTabView.snp.makeConstraints { (make) in\n            make.top.left.right.equalTo(self.view)\n            if #available(iOS 11.0, *) {\n                make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom)\n            } else {\n                make.bottom.equalTo(self.view.snp.bottomMargin)\n            }\n        }\n    }\n    \n    private func loadChatBodyData(_ style: ForwardStyle) {\n        if (style == .friend) {\n            dataSource = FYDBQueryHelper.shared.qureyFromChatsWithType(1)\n        }else {\n            dataSource = FYDBQueryHelper.shared.qureyFromChatsWithType(2)\n        }\n        \n        plainTabView.reloadData()\n    }\n    \n    // 开始转发\n    private func forwardAction() {\n        \n        if let model = selectedModel {\n            MBHUD.showStatus(\"正在发送...\")\n            DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {\n                if let message = self.messageItem {\n                    // 须实例化新的对象（避免数据库插入新值失败）\n                    let msgItem = FYMessageItem()\n                    msgItem.message = message.message\n                    msgItem.chatId = model.uid\n                    msgItem.sendType = 0 //始终是发送方\n                    msgItem.name = message.name\n                    msgItem.avatar = message.avatar\n                    msgItem.date = Date().string(withFormat: \"yyyy-MM-dd HH:mm:ss\")\n                    msgItem.msgType = message.msgType\n                    msgItem.chatType = message.chatType\n                    if (message.msgType == 2) {\n                        msgItem.image = message.image\n                    }else if (message.msgType == 3) {\n                        msgItem.video = message.video\n                        msgItem.image = message.image\n                    }\n                    \n                    let chat = FYDBQueryHelper.shared.qureyFromChatId(model.uid!)\n                    let chatVC = FYChatBaseViewController(chatModel: chat, isForward: true)\n                    chatVC.forwardData = msgItem\n                    \n                    MBHUD.showSuccess(\"转发成功\")\n                    self.navigationController?.pushViewController(chatVC, completion: {\n                        self.navigationController?.remove(withName: \"FYMessageForwardViewController\")\n                    })\n                }\n            }\n        }\n    }\n}\n\n// MARK: - UITableViewDataSource && Delegate\n\nextension FYMessageForwardViewController: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withClass: FYContactsTableViewCell.self, for: indexPath)\n        cell.selectedView.isHidden = false\n        if let model = dataSource[safe: indexPath.row] {\n            cell.model = model\n        }\n        return cell\n    }\n    \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        if let model = dataSource[safe: indexPath.row] {\n            selectedModel = model\n            forwardBtn.isHidden = false\n        }\n    }\n        \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        return 82\n    }\n}\n\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/Model/FYMessageBaseModel.swift",
    "content": "//\n//  FYMessageBaseModel.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/20.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport WCDBSwift\nimport HandyJSON\n\nclass FYMessageBaseModel: NSObject, HandyJSON {\n    \n    required override init() { }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/Model/FYMessageChatModel.swift",
    "content": "//\n//  FYMessageChatModel.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport WCDBSwift\n\nclass FYMessageChatModel: FYMessageBaseModel, TableCodable {\n        \n    /// 主键自增id\n    var identifier: Int? = nil\n    /// 用户id\n    var uid: Int? = nil\n    /// 用户名称\n    var name: String? = nil\n    /// 用户头像\n    var avatar: String? = nil\n    /// 是否显示昵称\n    var isShowName: Bool = false\n    /// 聊天类型：1：单聊；2：群聊\n    var chatType: Int? = nil\n    /// 未读数\n    var unReadCount: Int? = nil\n    /// 备注名（昵称）\n    var nickName: String? = nil\n        \n    enum CodingKeys: String, CodingTableKey {\n        typealias Root = FYMessageChatModel\n        static let objectRelationalMapping = TableBinding(CodingKeys.self)\n        \n        case identifier = \"id\"\n        case uid\n        case name\n        case avatar\n        case isShowName\n        case chatType\n        case unReadCount\n        case nickName\n        \n        //Column constraints for primary key, unique, not null, default value and so on. It is optional.\n        static var columnConstraintBindings: [CodingKeys: ColumnConstraintBinding]? {\n            return [\n                .identifier: ColumnConstraintBinding(isPrimary: true, isAutoIncrement: true)\n            ]\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/Model/FYMessageItem.swift",
    "content": "//\n//  FYMessageItem.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/20.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport WCDBSwift\n\n//消息发送类型，我的还是别人的\nenum SendType: Int {\n    case mine = 0\n    case someone = 1\n}\n\nclass FYMessageItem: FYMessageBaseModel, TableCodable {\n    \n    /// 消息id（主键 - 自增长）\n    var messageId: Int? = nil\n    /// 会话id\n    var chatId: Int? = nil\n    \n    var name: String? = nil\n    var avatar: String? = nil\n    var message: String? = nil\n    var image: String? = nil\n    var video: String? = nil\n    \n    /// 消息发送时间\n    var date: String? = nil\n    /// 消息类型：文字:1；2:图片\n    var msgType: Int? = nil\n    /// 消息发送方式：0:我的；1:别人\n    var sendType: Int? = nil\n    /// 聊天类型：1：单聊；2：群聊；3：视频\n    var chatType: Int? = nil\n    /// 未读数\n    var unReadCount: Int? = nil\n    \n    /// 备注名称\n    var nickName: String? = nil\n    \n    enum CodingKeys: String, CodingTableKey {\n        typealias Root = FYMessageItem\n        static let objectRelationalMapping = TableBinding(CodingKeys.self)\n        \n        case messageId = \"id\"\n        case chatId\n        case name\n        case avatar\n        case message\n        case date\n        case image\n        case video\n        case sendType\n        case msgType\n        case chatType\n        case unReadCount\n        case nickName\n        \n        //Column constraints for primary key, unique, not null, default value and so on. It is optional.\n        static var columnConstraintBindings: [CodingKeys: ColumnConstraintBinding]? {\n            return [\n                .messageId: ColumnConstraintBinding(isPrimary: true, isAutoIncrement: true)\n            ]\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/View/FYImageMessageCell.swift",
    "content": "//\n//  FYImageMessageCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/27.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYImageMessageCell: FYMessageBaseCell {\n\n    // MARK: - var lazy\n    \n    lazy var pictureView: UIImageView = {\n        let imageView = UIImageView()\n        imageView.backgroundColor = .random\n        return imageView\n    }()\n    \n    lazy var pictureTap: UITapGestureRecognizer = {\n        let tap = UITapGestureRecognizer(target: self, action: #selector(pictureTapAction(_:)))\n        return tap\n    }()\n    \n    // MARK: - life cycle\n    \n    override func awakeFromNib() {\n        super.awakeFromNib()\n        // Initialization code\n    }\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        \n        initSubview()\n        setupLabelLongPressGes(cellType: .imageCell)\n    }\n    \n    func initSubview() {\n        \n        dateLabel.snp.remakeConstraints { (make) in\n            make.top.equalToSuperview().offset(17)\n            make.centerX.equalToSuperview()\n            make.height.equalTo(18)\n        }\n        \n        dateGradView.snp.remakeConstraints { (make) in\n            make.top.equalTo(dateLabel).offset(-1)\n            make.left.equalTo(dateLabel).offset(-2)\n            make.bottom.equalTo(dateLabel).offset(1)\n            make.right.equalTo(dateLabel).offset(2)\n        }\n        \n        avatarView.snp.remakeConstraints { (make) in\n            make.width.height.equalTo(40)\n            make.left.equalToSuperview().offset(10)\n            make.top.equalTo(dateGradView.snp.bottom).offset(5)\n        }\n\n        nameLabel.snp.remakeConstraints { (make) in\n            make.top.equalTo(avatarView)\n            make.left.equalTo(avatarView.snp.right).offset(3)\n        }\n        \n        pictureView.isUserInteractionEnabled = true\n        pictureView.addGestureRecognizer(self.pictureTap)\n        contentView.addSubview(pictureView)\n        pictureView.snp.remakeConstraints { (make) in\n            make.top.equalTo(nameLabel.snp.bottom).offset(5)\n            make.left.equalTo(avatarView.snp.right).offset(5)\n            make.bottom.equalTo(self.contentView).offset(-17)\n            make.width.equalTo(80)\n            make.height.equalTo(120)\n        }\n        \n        activityIndicatorView.snp.remakeConstraints { (make) in\n            make.centerY.equalTo(pictureView)\n            make.centerX.equalToSuperview()\n            make.width.height.equalTo(30)\n        }\n        \n        dateLabel.setContentHuggingPriority(.required, for: .horizontal)\n        pictureView.setContentHuggingPriority(.required, for: .horizontal)\n    }\n    \n    override func layoutMessageCell() {\n        super.layoutMessageCell()\n        guard let msgType = model?.msgType, msgType == 2 else {\n            return\n        }\n        \n        dateLabel.text = model?.date\n\n        if let avatarURL = model?.avatar {\n            avatarView.setImageWithURL(avatarURL)\n        }\n        \n        if let imageURL = model?.image {\n            pictureView.setImageWithURL(imageURL)\n        }\n        \n        if model?.nickName.isBlank == false {\n            nameLabel.text = model?.nickName\n        }else {\n            nameLabel.text = model?.name\n        }\n        \n        // 重新布局\n        if let sendType = model?.sendType {\n            setupCellLayout(sendType: sendType)\n        }\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    override func setSelected(_ selected: Bool, animated: Bool) {\n        super.setSelected(selected, animated: animated)\n\n        // Configure the view for the selected state\n    }\n    \n    \n    // MARK: - Action\n    \n    @objc func pictureTapAction(_ tap: UITapGestureRecognizer) {\n        if let dataModel = self.model {\n            delegate?.cell(self, didTapPictureAt: dataModel)\n        }\n    }\n\n}\n\n\n// MARK: - Layout\n\nextension FYImageMessageCell {\n    \n    func setupCellLayout(sendType: Int) {\n        \n        if sendType == 0 { //我发送的\n            avatarView.snp.remakeConstraints { (make) in\n                make.width.height.equalTo(40)\n                make.right.equalToSuperview().offset(-10)\n                make.top.equalTo(dateGradView.snp.bottom).offset(5)\n            }\n\n            nameLabel.isHidden = true\n            nameLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(avatarView)\n                make.right.equalTo(avatarView.snp.left).offset(-3)\n                make.height.equalTo(0)\n            }\n            \n            pictureView.snp.remakeConstraints { (make) in\n                make.top.equalTo(nameLabel)\n                make.right.equalTo(avatarView.snp.left).offset(-5)\n                make.bottom.equalTo(self.contentView).offset(-17)\n                make.width.equalTo(80)\n                make.height.equalTo(120)\n            }\n            \n            activityIndicatorView.snp.remakeConstraints { (make) in\n                make.centerY.equalTo(pictureView)\n                make.right.equalTo(pictureView.snp.left)\n                make.width.height.equalTo(30)\n            }\n            \n            // start\n            activityStartAnimating()\n            \n        }else {\n            avatarView.snp.remakeConstraints { (make) in\n                make.width.height.equalTo(40)\n                make.left.equalToSuperview().offset(10)\n                make.top.equalTo(dateGradView.snp.bottom).offset(5)\n            }\n\n            nameLabel.isHidden = false\n            nameLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(avatarView)\n                make.left.equalTo(avatarView.snp.right).offset(3)\n            }\n            \n            pictureView.snp.remakeConstraints { (make) in\n                make.top.equalTo(nameLabel.snp.bottom).offset(5)\n                make.left.equalTo(avatarView.snp.right).offset(5)\n                make.bottom.equalTo(self.contentView).offset(-17)\n                make.width.equalTo(80)\n                make.height.equalTo(120)\n            }\n        }\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/View/FYMessageBaseCell.swift",
    "content": "//\n//  FYMessageBaseCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/23.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nenum RootCellType {\n    case textCell\n    case imageCell\n    case viodeCell\n}\n\nenum MenuShowStyle {\n    case share\n    case copy\n    case delete\n}\n\nprotocol FYMessageBaseCellDelegate: AnyObject {\n    func cell(_ cell: FYMessageBaseCell, didMenu style: MenuShowStyle, model: FYMessageItem)\n    func cell(_ cell: FYMessageBaseCell, didTapAvatarAt model: FYMessageItem)\n    func cell(_ cell: FYMessageBaseCell, didTapPictureAt model: FYMessageItem)\n    func cell(_ cell: FYMessageBaseCell, didTapVideoAt model: FYMessageItem)\n}\n\nextension FYMessageBaseCellDelegate {\n    func cell(_ cell: FYMessageBaseCell, didMenu style: MenuShowStyle, model: FYMessageItem) {}\n    func cell(_ cell: FYMessageBaseCell, didTapAvatarAt model: FYMessageItem) {}\n    func cell(_ cell: FYMessageBaseCell, didTapPictureAt model: FYMessageItem) {}\n    func cell(_ cell: FYMessageBaseCell, didTapVideoAt model: FYMessageItem) {}\n}\n\nclass FYMessageBaseCell: UITableViewCell {\n\n    var model: FYMessageItem? {\n        didSet {\n            guard let _ = model else {\n                return\n            }\n            \n            layoutMessageCell()\n        }\n    }\n    \n    \n    // MARK: - lazy var\n    \n    weak var delegate: FYMessageBaseCellDelegate?\n    \n    lazy var avatarTap: UITapGestureRecognizer = {\n        let tap = UITapGestureRecognizer(target: self, action: #selector(avatarTapAction(_:)))\n        return tap\n    }()\n    \n    lazy var avatarView: UIImageView = {\n        let imageView = UIImageView(image: R.image.ic_avatar_placeholder()!)\n        imageView.cornerRadius = 7\n        imageView.addGestureRecognizer(self.avatarTap)\n        imageView.isUserInteractionEnabled = true\n        return imageView\n    }()\n    \n    lazy var bubbleView: UIImageView = {\n        let imageView = UIImageView()\n        return imageView\n    }()\n    \n    lazy var nameLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 15)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V2 }\n        return label\n    }()\n    \n    lazy var dateLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 11)\n        label.textColor = .white\n        return label\n    }()\n    \n    lazy var dateGradView: UIView = {\n        let view = UIView()\n        view.cornerRadius = 5\n        view.backgroundColor = .RGBA(r: 190, g: 190, b: 190, a: 0.6)\n        return view\n    }()\n    \n    lazy var activityIndicatorView: UIActivityIndicatorView = {\n        let activityView = UIActivityIndicatorView(style: .gray)\n        activityView.backgroundColor = .clear\n        activityView.isHidden = true\n        return activityView\n    }()\n    \n    // MARK: - life cycle\n     \n    override func awakeFromNib() {\n        super.awakeFromNib()\n        // Initialization code\n        selectionStyle = .none\n    }\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        selectionStyle = .none\n        backgroundColor = .clear\n        \n        contentView.addSubview(dateGradView)\n        contentView.addSubview(dateLabel)\n        contentView.addSubview(avatarView)\n        contentView.addSubview(bubbleView)\n        contentView.addSubview(nameLabel)\n        contentView.addSubview(activityIndicatorView)\n    }\n    \n    /// 提供子类调用\n    open func layoutMessageCell() { }\n    \n    /// 执行加载动画\n    open func activityStartAnimating() {\n        guard let sendType = model?.sendType, sendType == 0 else {\n            return\n        }\n        guard let sendDate = model?.date else {\n            return\n        }\n        \n        let nowDate = Date().string(withFormat: \"yyyy-MM-dd HH:mm:ss\")\n        if ((nowDate.stringToTimeStamp().doubleValue - sendDate.stringToTimeStamp().doubleValue) <= 1) {\n            self.activityIndicatorView.isHidden = false\n            self.activityIndicatorView.startAnimating()\n            DispatchQueue.main.asyncAfter(deadline: .now() + 1.25) {\n                self.activityIndicatorView.startAnimating()\n                self.activityIndicatorView.isHidden = true\n            }\n        }\n    }\n    \n    /// 提供子类调用\n    /// - Parameter cellType: cell类型\n    open func setupLabelLongPressGes(cellType: RootCellType) {\n        var longPressGes = UILongPressGestureRecognizer.init()\n        if (cellType == .textCell) {\n            longPressGes = UILongPressGestureRecognizer(target: self, action: #selector(showMenu1Controller))\n        }else {\n            longPressGes = UILongPressGestureRecognizer(target: self, action: #selector(showMenu2Controller))\n        }\n            \n        longPressGes.minimumPressDuration = 1\n        //longPressGes.numberOfTapsRequired = 1\n        longPressGes.numberOfTouchesRequired = 1\n        // 长按有效移动范围（从点击开始，长按移动的允许范围 单位 px\n        longPressGes.allowableMovement = 15\n        \n        self.addGestureRecognizer(longPressGes)\n    }\n    \n    @objc func showMenu1Controller() {\n        if (UIMenuController.shared.isMenuVisible){\n            return\n        }\n        \n        let sendType = model?.sendType\n        \n        self.becomeFirstResponder()\n        let menu = UIMenuController.shared\n        let item1 = UIMenuItem(title: \"转发\".rLocalized(), action: #selector(menuShareAction))\n        let item2 = UIMenuItem(title: \"复制\".rLocalized(), action: #selector(menuCopyAction))\n        let item3 = UIMenuItem(title: \"删除\".rLocalized(), action: #selector(menuDeleteAction))\n        menu.menuItems = [item1, item2, item3]\n        // 设置箭头方向\n        menu.arrowDirection = .default\n        if sendType == 0 {\n            let rect = CGRect(x: 40, y: 40, width: self.width, height: self.height)\n            menu.setTargetRect(rect, in: self)\n        }else {\n            let rect = CGRect(x: -60, y: 60, width: self.width, height: self.height)\n            menu.setTargetRect(rect, in: self)\n        }\n        menu.setMenuVisible(true, animated: true)\n    }\n    \n    @objc func showMenu2Controller() {\n        if (UIMenuController.shared.isMenuVisible){\n            return\n        }\n        \n        let sendType = model?.sendType\n        \n        self.becomeFirstResponder()\n        let menu = UIMenuController.shared\n        let item1 = UIMenuItem(title: \"转发\".rLocalized(), action: #selector(menuShareAction))\n        let item3 = UIMenuItem(title: \"删除\".rLocalized(), action: #selector(menuDeleteAction))\n        menu.menuItems = [item1, item3]\n        // 设置箭头方向\n        menu.arrowDirection = .default\n        if sendType == 0 {\n            let rect = CGRect(x: 40, y: 40, width: self.width, height: self.height)\n            menu.setTargetRect(rect, in: self)\n        }else {\n            let rect = CGRect(x: -60, y: 60, width: self.width, height: self.height)\n            menu.setTargetRect(rect, in: self)\n        }\n        menu.setMenuVisible(true, animated: true)\n    }\n\n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n\n    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {\n        if #available(iOS 13.0, *) {\n            UIMenuController.shared.hideMenu()\n        }\n    }\n    \n    // MARK: - Action\n    \n    /// 分享\n    @objc open func menuShareAction() {\n        if let dataModel = self.model {\n            delegate?.cell(self, didMenu: .share, model: dataModel)\n        }\n    }\n    \n    /// 复制\n    @objc open func menuCopyAction() {\n        if let dataModel = self.model {\n            delegate?.cell(self, didMenu: .copy, model: dataModel)\n        }\n    }\n    \n    \n    /// 删除\n    @objc open func menuDeleteAction() {\n        if let dataModel = self.model {\n            delegate?.cell(self, didMenu: .delete, model: dataModel)\n        }\n    }\n    \n    \n    /// 点击用户头像\n    @objc func avatarTapAction(_ tap: UIGestureRecognizer) {\n        if let dataModel = self.model {\n            delegate?.cell(self, didTapAvatarAt: dataModel)\n        }\n    }\n    \n    override var canBecomeFirstResponder: Bool {\n        return true\n    }\n\n    override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {\n        if [#selector(menuShareAction), #selector(menuCopyAction), #selector(menuDeleteAction)].contains(action) {\n            return true\n        }\n        return false\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/View/FYTextMessageCell.swift",
    "content": "//\n//  FYTextMessageCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/20.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport YYText\n\nclass FYTextMessageCell: FYMessageBaseCell {\n    \n    private let kMaxWidth: CGFloat = kScreenW * 0.55\n    \n    // MARK: - var lazy\n\n    lazy var contentLabel: YYLabel = {\n        let label = YYLabel()\n        label.numberOfLines = 0\n        label.displaysAsynchronously = true;\n        label.clearContentsBeforeAsynchronouslyDisplay = false;\n        label.font = UIFont.systemFont(ofSize: 15)\n        switch themeService.type {\n        case .light:\n            label.textColor = .Color_Black_000000\n        default:\n            label.textColor = .Color_Gray_5A636D\n        }\n        return label\n    }()\n    \n    // MARK: - life cycle\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        \n        initSubview()\n        setupLabelLongPressGes(cellType: .textCell)\n    }\n    \n    func initSubview() {\n        contentView.addSubview(contentLabel)\n        \n        dateLabel.snp.remakeConstraints { (make) in\n            make.top.equalToSuperview().offset(17)\n            make.centerX.equalToSuperview()\n            make.height.equalTo(18)\n        }\n        \n        dateGradView.snp.remakeConstraints { (make) in\n            make.top.equalTo(dateLabel).offset(-1)\n            make.left.equalTo(dateLabel).offset(-2)\n            make.bottom.equalTo(dateLabel).offset(1)\n            make.right.equalTo(dateLabel).offset(2)\n        }\n        \n        avatarView.snp.remakeConstraints { (make) in\n            make.width.height.equalTo(40)\n            make.left.equalToSuperview().offset(10)\n            make.top.equalTo(dateGradView.snp.bottom).offset(5)\n        }\n\n        nameLabel.snp.remakeConstraints { (make) in\n            make.top.equalTo(avatarView)\n            make.left.equalTo(avatarView.snp.right).offset(3)\n        }\n\n        bubbleView.snp.remakeConstraints { (make) in\n            make.top.equalTo(nameLabel.snp.bottom).offset(2)\n            make.bottom.equalTo(contentLabel.snp.bottom).offset(2)\n            make.left.equalTo(avatarView.snp.right)\n            make.width.width.equalTo(kMaxWidth)\n            make.height.equalTo(contentLabel).offset(26)\n        }\n        \n        contentLabel.snp.remakeConstraints { (make) in\n            make.top.equalTo(bubbleView).offset(13);\n            make.left.equalTo(bubbleView).offset(20);\n            make.right.equalTo(bubbleView).offset(-15);\n        }\n        \n        activityIndicatorView.snp.remakeConstraints { (make) in\n            make.centerY.equalTo(bubbleView)\n            make.centerX.equalToSuperview()\n            make.width.height.equalTo(30)\n        }\n        \n        dateLabel.setContentHuggingPriority(.required, for: .horizontal)\n        bubbleView.setContentHuggingPriority(.required, for: .horizontal)\n    }\n    \n    override func layoutMessageCell() {\n        super.layoutMessageCell()\n        guard let msgType = model?.msgType, msgType == 1 else {\n            return\n        }\n        \n        dateLabel.text = model?.date\n        contentLabel.text = model?.message\n        \n        if let imageURL = model?.avatar {\n            avatarView.setImageWithURL(imageURL, placeholder: \"ic_avatar_placeholder\")\n        }\n        \n        if let nickName = model?.nickName, nickName.length > 0 {\n            nameLabel.text = nickName\n        }else {\n            nameLabel.text = model?.name\n        }\n        \n        // 重新布局\n        let contentSize = contentLabel.sizeThatFits(CGSize(width: kMaxWidth, height: CGFloat(Float.greatestFiniteMagnitude)))\n        if let sendType = model?.sendType {\n            setupCellLayout(sendType: sendType, size: contentSize)\n        }\n        \n        // 设置泡泡\n        let bubbleImage = model?.sendType == 0 ? #imageLiteral(resourceName: \"message_sender_background_normal\") : #imageLiteral(resourceName: \"message_receiver_background_normal\")\n        bubbleView.image = bubbleImage.stretchableImage(centerStretchScale: 0.65)\n    }\n    \n    required init?(coder aDecoder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n}\n\n// MARK: - Layout\n\nextension FYTextMessageCell {\n    \n    func setupCellLayout(sendType: Int, size: CGSize) {\n        let sizeWidth  = size.width + 12\n        let sizeHeight = size.height + 8\n        \n        contentLabel.preferredMaxLayoutWidth = size.width\n        \n        if sendType == 0 { //我发送的\n            avatarView.snp.remakeConstraints { (make) in\n                make.width.height.equalTo(40)\n                make.right.equalToSuperview().offset(-10)\n                make.top.equalTo(dateGradView.snp.bottom).offset(5)\n            }\n\n            nameLabel.isHidden = true\n            nameLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(avatarView)\n                make.right.equalTo(avatarView.snp.left).offset(-3)\n                make.height.equalTo(0)\n            }\n            \n            contentLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(nameLabel.snp.bottom).offset(8)\n                make.bottom.equalToSuperview().offset(-15)\n                make.right.equalTo(avatarView.snp.left).offset(-14)\n                make.width.equalTo(sizeWidth)\n                make.height.equalTo(sizeHeight)\n            }\n            \n            let top: CGFloat = contentLabel.text!.containEmoji ? -10 : -12\n            let bottmom: CGFloat = contentLabel.text!.containEmoji ? 10 : 12\n            bubbleView.snp.remakeConstraints { (make) in\n                make.right.equalTo(avatarView.snp.left).offset(-2)\n                make.top.equalTo(contentLabel).offset(top)\n                make.bottom.equalTo(contentLabel).offset(bottmom)\n                make.width.equalTo(contentLabel).offset(30)\n            }\n            \n            activityIndicatorView.snp.remakeConstraints { (make) in\n                make.centerY.equalTo(bubbleView)\n                make.right.equalTo(bubbleView.snp.left)\n                make.width.height.equalTo(30)\n            }\n            \n            // start\n            activityStartAnimating()\n            \n        }else {\n            avatarView.snp.remakeConstraints { (make) in\n                make.width.height.equalTo(40)\n                make.left.equalToSuperview().offset(10)\n                make.top.equalTo(dateGradView.snp.bottom).offset(5)\n            }\n\n            nameLabel.isHidden = false\n            nameLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(avatarView)\n                make.left.equalTo(avatarView.snp.right).offset(3)\n            }\n            \n            contentLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(nameLabel.snp.bottom).offset(10)\n                make.left.equalTo(avatarView.snp.right).offset(21)\n                make.bottom.equalToSuperview().offset(-15)\n                make.width.equalTo(sizeWidth)\n            }\n            \n            let top: CGFloat = contentLabel.text!.containEmoji ? -10 : -12\n            let bottmom: CGFloat = contentLabel.text!.containEmoji ? 10 : 12\n            bubbleView.snp.remakeConstraints { (make) in\n                make.left.equalTo(avatarView.snp.right).offset(2)\n                make.top.equalTo(contentLabel).offset(top)\n                make.bottom.equalTo(contentLabel).offset(bottmom)\n                make.width.equalTo(contentLabel).offset(30)\n            }\n        }\n    }\n}\n\n   \n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/View/FYVideoMessageCell.swift",
    "content": "//\n//  FYVideoMessageCell.swift\n//  FY-JetChat\n//\n//  Created by fangyuan on 2019/12/22.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYVideoMessageCell: FYMessageBaseCell {\n\n    // MARK: - var lazy\n    \n    lazy var videoImageView: UIImageView = {\n        let imageView = UIImageView()\n        imageView.backgroundColor = .random\n        return imageView\n    }()\n    \n    lazy var playImgView: UIImageView = {\n        let image = UIImage(named: \"play_btn_normal\")\n        let imageView = UIImageView(image: image)\n        return imageView\n    }()\n    \n    lazy var videoTap: UITapGestureRecognizer = {\n        let tap = UITapGestureRecognizer(target: self, action: #selector(videoTapAction(_:)))\n        return tap\n    }()\n    \n    // MARK: - life cycle\n    \n    override func awakeFromNib() {\n        super.awakeFromNib()\n        // Initialization code\n    }\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        \n        initSubview()\n        setupLabelLongPressGes(cellType: .viodeCell)\n    }\n    \n    func initSubview() {\n        \n        dateLabel.snp.remakeConstraints { (make) in\n            make.top.equalToSuperview().offset(17)\n            make.centerX.equalToSuperview()\n            make.height.equalTo(18)\n        }\n        \n        dateGradView.snp.remakeConstraints { (make) in\n            make.top.equalTo(dateLabel).offset(-1)\n            make.left.equalTo(dateLabel).offset(-2)\n            make.bottom.equalTo(dateLabel).offset(1)\n            make.right.equalTo(dateLabel).offset(2)\n        }\n        \n        avatarView.snp.remakeConstraints { (make) in\n            make.width.height.equalTo(40)\n            make.left.equalToSuperview().offset(10)\n            make.top.equalTo(dateGradView.snp.bottom).offset(5)\n        }\n\n        nameLabel.snp.remakeConstraints { (make) in\n            make.top.equalTo(avatarView)\n            make.left.equalTo(avatarView.snp.right).offset(3)\n        }\n        \n        videoImageView.isUserInteractionEnabled = true\n        videoImageView.addGestureRecognizer(self.videoTap)\n        contentView.addSubview(videoImageView)\n        videoImageView.snp.remakeConstraints { (make) in\n            make.top.equalTo(nameLabel.snp.bottom).offset(5)\n            make.left.equalTo(avatarView.snp.right).offset(5)\n            make.bottom.equalTo(self.contentView).offset(-17)\n            make.width.equalTo(100)\n            make.height.equalTo(145)\n        }\n        \n        videoImageView.addSubview(playImgView)\n        videoImageView.bringSubviewToFront(playImgView)\n        playImgView.snp.makeConstraints { (make) in\n            make.center.equalToSuperview()\n            make.size.equalTo(CGSize(width: 40, height: 40))\n        }\n        \n        activityIndicatorView.snp.remakeConstraints { (make) in\n            make.centerY.equalTo(videoImageView)\n            make.centerX.equalToSuperview()\n            make.width.height.equalTo(30)\n        }\n        \n        dateLabel.setContentHuggingPriority(.required, for: .horizontal)\n        videoImageView.setContentHuggingPriority(.required, for: .horizontal)\n    }\n    \n    override func layoutMessageCell() {\n        super.layoutMessageCell()\n        guard let msgType = model?.msgType, msgType == 3 else {\n            return\n        }\n        \n        dateLabel.text = model?.date\n        \n        if let avatarURL = model?.avatar {\n            avatarView.setImageWithURL(avatarURL)\n        }\n        \n        if let imageURL = model?.image {\n            videoImageView.setImageWithURL(imageURL)\n        }\n        \n        if model?.nickName.isBlank == false {\n            nameLabel.text = model?.nickName\n        }else {\n            nameLabel.text = model?.name\n        }\n        \n        // 重新布局\n        if let sendType = model?.sendType {\n            setupCellLayout(sendType: sendType)\n        }\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    override func setSelected(_ selected: Bool, animated: Bool) {\n        super.setSelected(selected, animated: animated)\n\n        // Configure the view for the selected state\n    }\n    \n    // MARK: - Action\n    \n    @objc func videoTapAction(_ tap: UITapGestureRecognizer) {\n        if let videoModel = self.model {\n            delegate?.cell(self, didTapVideoAt: videoModel)\n        }\n    }\n\n}\n\n\n// MARK: - Layout\n\nextension FYVideoMessageCell {\n    \n    func setupCellLayout(sendType: Int) {\n        \n        if sendType == 0 { //我发送的\n            avatarView.snp.remakeConstraints { (make) in\n                make.width.height.equalTo(40)\n                make.right.equalToSuperview().offset(-10)\n                make.top.equalTo(dateGradView.snp.bottom).offset(5)\n            }\n\n            nameLabel.isHidden = true\n            nameLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(avatarView)\n                make.right.equalTo(avatarView.snp.left).offset(-3)\n                make.height.equalTo(0)\n            }\n            \n            videoImageView.snp.remakeConstraints { (make) in\n                make.top.equalTo(nameLabel)\n                make.right.equalTo(avatarView.snp.left).offset(-5)\n                make.bottom.equalTo(self.contentView).offset(-17)\n                make.width.equalTo(100)\n                make.height.equalTo(145)\n            }\n            \n            activityIndicatorView.snp.remakeConstraints { (make) in\n                make.centerY.equalTo(videoImageView)\n                make.right.equalTo(videoImageView.snp.left)\n                make.width.height.equalTo(30)\n            }\n            \n            activityStartAnimating()\n            \n        }else {\n            avatarView.snp.remakeConstraints { (make) in\n                make.width.height.equalTo(40)\n                make.left.equalToSuperview().offset(10)\n                make.top.equalTo(dateGradView.snp.bottom).offset(5)\n            }\n\n            nameLabel.isHidden = false\n            nameLabel.snp.remakeConstraints { (make) in\n                make.top.equalTo(avatarView)\n                make.left.equalTo(avatarView.snp.right).offset(3)\n            }\n            \n            videoImageView.snp.remakeConstraints { (make) in\n                make.top.equalTo(nameLabel.snp.bottom).offset(5)\n                make.left.equalTo(avatarView.snp.right).offset(5)\n                make.bottom.equalTo(self.contentView).offset(-17)\n                make.width.equalTo(100)\n                make.height.equalTo(145)\n            }\n        }\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/ChatRoom/ViewModel/FYMessageViewModel.swift",
    "content": "//\n//  FYMessageViewModel.swift\n//  FY-JetChat\n//\n//  Created by fangyuan on 2020/1/3.\n//  Copyright © 2020 iOS.Jet. All rights reserved.\n//\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\nimport HandyJSON\nimport YBImageBrowser\n\npublic enum ChatDataType {\n    case none\n    case text\n    case image\n    case video\n    case autoSend\n}\n\npublic enum BrowserTypeData {\n    case none\n    case image\n    case video\n}\n\nclass FYMessageViewModel: BaseViewModel, ViewModelType {\n    \n    /// 消息类型\n    var messageType = BehaviorRelay<ChatDataType>(value: .none)\n    /// 浏览图片&视频类型\n    var browserType = BehaviorRelay<BrowserTypeData>(value: .none)\n    \n    /// 文本\n    var content = BehaviorRelay<String>(value: \"\")\n    /// 图片索引\n    var imageIndex = BehaviorRelay<Int>(value: 0)\n    \n    var tableView: UITableView?\n    var chatModel: FYMessageChatModel?\n    \n    /// 图片视频浏览\n    var dataSource = BehaviorRelay<[FYMessageItem]>.init(value: [])\n    var browserIndexs = BehaviorRelay<[Int: Int]>.init(value: [:])\n    \n    // MARK: - Transform\n    \n    struct Input {\n        let makeMessage: Observable<Void>\n        let makeBrowser: Observable<Void>\n    }\n    \n    struct Output {\n        let message: BehaviorRelay<FYMessageItem>\n        let browser: BehaviorRelay<[AnyObject]>\n    }\n    \n    func transform(input: FYMessageViewModel.Input) -> FYMessageViewModel.Output {\n        let outMessage = BehaviorRelay<FYMessageItem>(value: FYMessageItem())\n        let outBrowsers = BehaviorRelay<[AnyObject]>(value: [])\n        \n        // 发送消息\n        input.makeMessage.flatMapLatest ({ [weak self]() -> Single<FYMessageItem> in\n            guard let self = self else {\n                return Single.never()\n            }\n        \n            if (self.messageType.value == .text) {\n                return self.makeChatTextMessage().trackActivity(self.loading).asSingle()\n            }else if (self.messageType.value == .image) {\n                return self.makeChatImageMessage().trackActivity(self.loading).asSingle()\n            }else if (self.messageType.value == .video) {\n                return self.makeChatVideoMessage().trackActivity(self.loading).asSingle()\n            }else if (self.messageType.value == .autoSend) {\n                return self.makeChatGroupAutoSend().trackActivity(self.loading).asSingle()\n            }else {\n                return Single.never()\n            }\n        })\n            .asObservable()\n            .subscribe(onNext: { (data) in\n                outMessage.accept(data)\n            }).disposed(by: rx.disposeBag)\n        \n        // 浏览图片\n        input.makeBrowser.flatMapLatest ({ [weak self]() -> Single<[AnyObject]> in\n            guard let self = self else {\n                return Single.never()\n            }\n            \n            if (self.browserType.value == .image) {\n                return self.makeBrowserImagesData().trackActivity(self.loading).asSingle()\n            }else if (self.browserType.value == .video) {\n                return self.makeBrowserVideosData().trackActivity(self.loading).asSingle()\n            }else {\n                return Single.never()\n            }\n        })\n            .asObservable()\n            .subscribe(onNext: { (objects) in\n                outBrowsers.accept(objects)\n            }).disposed(by: rx.disposeBag)\n        \n        return Output(message: outMessage, browser: outBrowsers)\n    }\n    \n    // MARK: - init\n    \n    init(chatModel: FYMessageChatModel) {\n        super.init()\n        \n        self.chatModel = chatModel\n    }\n}\n\n// MARK: - Configuration Message\n\nextension FYMessageViewModel {\n    \n    /// 文本消息\n    private func makeChatTextMessage() -> Single<FYMessageItem> {\n        return Single<FYMessageItem>.create { single in\n            let random = arc4random() % 9\n            let msgItem = FYMessageItem()\n            msgItem.message = self.content.value\n            msgItem.chatId = self.chatModel?.uid\n            if self.chatModel?.chatType == 1 {\n                msgItem.sendType = random % 2 == 0 ? 1 : 0\n                if self.chatModel?.nickName.isBlank == false {\n                    msgItem.name = random % 2 == 0 ? self.chatModel?.nickName : \"逆流而上\"\n                }else {\n                    msgItem.name = random % 2 == 0 ? self.chatModel?.name : \"逆流而上\"\n                }\n                msgItem.avatar = random % 2 == 0 ? self.chatModel?.avatar : \"https://img2.woyaogexing.com/2019/11/27/d1dddb1e1faf4b578f12b28a08b04174!400x400.jpeg\"\n            }else {\n                msgItem.sendType = 0\n                msgItem.name = \"逆流而上\"\n                msgItem.avatar = \"https://img2.woyaogexing.com/2019/11/27/d1dddb1e1faf4b578f12b28a08b04174!400x400.jpeg\"\n            }\n            \n            msgItem.date = Date().string(withFormat: \"yyyy-MM-dd HH:mm:ss\")\n            msgItem.msgType = 1 //文字\n            msgItem.chatType = self.chatModel?.chatType\n        \n            single(.success(msgItem))\n            return Disposables.create()\n        }\n    }\n    \n    \n    /// 图片消息\n    private func makeChatImageMessage() -> Single<FYMessageItem> {\n        return Single<FYMessageItem>.create { single in\n            let random = arc4random() % 9\n            let msgItem = FYMessageItem()\n            msgItem.chatId = self.chatModel?.uid\n            \n            if self.chatModel?.chatType == 1 {\n                msgItem.sendType = random % 2 == 0 ? 1 : 0\n                if self.chatModel?.nickName.isBlank == false {\n                    msgItem.name = random % 2 == 0 ? self.chatModel?.nickName : \"逆流而上\"\n                    msgItem.nickName = random % 2 == 0 ? self.chatModel?.nickName : \"逆流而上\"\n                }else {\n                    msgItem.name = random % 2 == 0 ? self.chatModel?.name : \"逆流而上\"\n                }\n                msgItem.avatar = random % 2 == 0 ? self.chatModel?.avatar : \"https://img2.woyaogexing.com/2019/11/27/d1dddb1e1faf4b578f12b28a08b04174!400x400.jpeg\"\n            }else {\n                msgItem.sendType = 0\n                msgItem.name = \"逆流而上\"\n                msgItem.avatar = \"https://img2.woyaogexing.com/2019/11/27/d1dddb1e1faf4b578f12b28a08b04174!400x400.jpeg\"\n            }\n            \n            msgItem.date = Date().string(withFormat: \"yyyy-MM-dd HH:mm:ss\")\n            msgItem.image = random % 2 == 0 ? \"http://img2.woyaogexing.com/2022/04/27/76d9d570d2004c9ba326587045dede07!360x640.jpeg\" : \"http://img2.woyaogexing.com/2022/04/27/fcc7c52df7454e1680a6625cc3fea7b0.jpeg\"\n            msgItem.msgType = 2 //图片\n            msgItem.message = \"【图片】\"\n            msgItem.chatType = self.chatModel?.chatType\n            \n            single(.success(msgItem))\n            return Disposables.create()\n        }\n    }\n    \n    \n    /// 视频消息\n    private func makeChatVideoMessage() -> Single<FYMessageItem> {\n        return Single<FYMessageItem>.create { single in\n            let random = arc4random() % 9\n            let msgItem = FYMessageItem()\n            msgItem.chatId = self.chatModel?.uid\n            \n            if self.chatModel?.chatType == 1 {\n                msgItem.sendType = random % 2 == 0 ? 1 : 0\n                if self.chatModel?.nickName.isBlank == false {\n                    msgItem.name = random % 2 == 0 ? self.chatModel?.nickName : \"逆流而上\"\n                    msgItem.nickName = random % 2 == 0 ? self.chatModel?.nickName : \"逆流而上\"\n                }else {\n                    msgItem.name = random % 2 == 0 ? self.chatModel?.name : \"逆流而上\"\n                }\n                msgItem.avatar = random % 2 == 0 ? self.chatModel?.avatar : \"https://img2.woyaogexing.com/2019/11/27/d1dddb1e1faf4b578f12b28a08b04174!400x400.jpeg\"\n            }else {\n                msgItem.sendType = 0\n                msgItem.name = \"逆流而上\"\n                msgItem.avatar = \"https://img2.woyaogexing.com/2019/11/27/d1dddb1e1faf4b578f12b28a08b04174!400x400.jpeg\"\n            }\n            \n            msgItem.date = Date().string(withFormat: \"yyyy-MM-dd HH:mm:ss\")\n            msgItem.image = random % 2 == 0 ? \"http://img2.woyaogexing.com/2022/04/25/e484edc5029c41fda2e0dbf1b4310818.jpeg\" : \"http://img2.woyaogexing.com/2022/04/28/69f49803d9ea443c84c88907e8e76879.jpeg\"\n            msgItem.video = random % 2 == 0 ? \"localVideo0.mp4\" : \"https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0200ff00000bdkpfpdd2r6fb5kf6m50&line=0.mp4\"\n            msgItem.msgType = 3 //视频\n            msgItem.message = \"【视频】\"\n            msgItem.chatType = self.chatModel?.chatType\n            \n            \n            single(.success(msgItem))\n            return Disposables.create()\n        }\n    }\n    \n    \n    /// 自动发送文本信息\n    private func makeChatAutoSendText() -> Single<FYMessageItem> {\n        \n        return Single<FYMessageItem>.create { single in\n            let random = arc4random() % 20\n            let msgItem = FYMessageItem()\n            msgItem.message = random % 2 == 0 ? \"😬😬😬😬😬😬你觉得今天天气如何呢？\" : \"周末一起去郊游吧😸😸😸😸😸\"\n            msgItem.chatId = self.chatModel?.uid\n            msgItem.sendType = 1\n            msgItem.name = random % 2 == 0 ? \"彩虹天堂🌈\" : \"惊鸿一面🍎\"\n            msgItem.avatar = random % 2 == 0 ? \"https://img2.woyaogexing.com/2019/11/23/593796f9c01c43ca8c44b6501a45db90!400x400.jpeg\" : \"https://img2.woyaogexing.com/2019/11/11/4f3352cc750c4648a1c7e320cf045fbc!400x400.jpeg\"\n            msgItem.date = Date().string(withFormat: \"yyyy-MM-dd HH:mm:ss\")\n            msgItem.msgType = 1 //文字\n            msgItem.chatType = self.chatModel?.chatType\n            \n            \n            single(.success(msgItem))\n            return Disposables.create()\n        }\n    }\n    \n\n    /// 模拟群组群员自动发送消息\n    private func makeChatGroupAutoSend() -> Single<FYMessageItem> {\n        let random = arc4random() % 3\n        \n        switch random {\n        case 0:\n            return makeChatImageMessage()\n        case 1:\n            return makeChatVideoMessage()\n        default:\n            return makeChatAutoSendText()\n        }\n    }\n}\n\n\n// MARK: - Configuration ImageData\n\nextension FYMessageViewModel {\n    \n    private func makeBrowserImagesData() -> Single<[AnyObject]> {\n        return Single<[AnyObject]>.create { single in\n            var indexs: [Int: Int] = [:]\n            var images: [YBIBImageData] = []\n            \n            var imageIndex = 0\n            for (index, model) in self.dataSource.value.enumerated() {\n                if model.msgType == 2 {\n                    let data = YBIBImageData()\n                    data.imageURL = URL(string: model.image!)\n                    data.projectiveView = self.projectiveViewAtRow(self.imageIndex.value)\n                    images.append(data)\n                    imageIndex += 1 //图片索引\n                }\n                \n                indexs[index] = imageIndex\n            }\n            \n            self.browserIndexs.accept(indexs)\n            \n            single(.success(images))\n            return Disposables.create()\n        }\n    }\n    \n    private func makeBrowserVideosData() -> Single<[AnyObject]> {\n        return Single<[AnyObject]>.create { single in\n            var videos: [YBIBVideoData] = []\n            var indexs: [Int: Int] = [:]\n            \n            var videoIndex = 0\n            for (index, model) in self.dataSource.value.enumerated() {\n                if model.msgType == 3 {\n                    if (model.video?.hasSuffix(\".mp4\"))! && (model.video?.hasPrefix(\"http\"))! { //网络视频\n                        let data = YBIBVideoData()\n                        UIImageView().downloadImageWithURL(model.image!, callback: { (result) in\n                            printLog(\"thumbImage\\(result)\")\n                            switch result {\n                            case .success(let value):\n                                data.thumbImage = value\n                            case .failure(let error):\n                                printLog(\"Job failed: \\(error)\")\n                            }\n                        })\n                        data.videoURL = URL(string: model.video!)\n                        data.projectiveView = self.projectiveViewAtRow(self.imageIndex.value)\n                        videos.append(data)\n                        videoIndex += 1 //图片索引\n                    }else {\n                        if let path = Bundle.main.path(forResource: model.video?.deletingPathExtension, ofType:model.video?.pathExtension) {\n                            let data = YBIBVideoData()\n                            UIImageView().downloadImageWithURL(model.image!, callback: { (result) in\n                                printLog(\"thumbImage\\(result)\")\n                                switch result {\n                                case .success(let value):\n                                    data.thumbImage = value\n                                case .failure(let error):\n                                    printLog(\"Job failed: \\(error)\")\n                                }\n                            })\n                            data.videoURL = URL(fileURLWithPath: path)\n                            data.projectiveView = self.projectiveViewAtRow(self.imageIndex.value)\n                            videos.append(data)\n                            videoIndex += 1 //图片索引\n                        }\n                    }\n                }\n                \n                indexs[index] = videoIndex\n            }\n            \n            self.browserIndexs.accept(indexs)\n            \n            single(.success(videos))\n            return Disposables.create()\n        }\n    }\n    \n    \n    private func projectiveViewAtRow(_ row: Int) -> UIView {\n        guard let table = tableView else {\n            return UIView()\n        }\n        \n        let indexPath = IndexPath(row: row, section: 0)\n        if let imageCell = table.cellForRow(at: indexPath) as? FYImageMessageCell {\n            return imageCell.pictureView\n        }else {\n            let videoCell = table.cellForRow(at: indexPath) as? FYVideoMessageCell\n            return videoCell?.videoImageView ?? UIView()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Contacts/Controller/FYContactsInfoViewController.swift",
    "content": "//\n//  FYContactsInfoViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/30.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYContactsInfoViewController: FYBaseViewController {\n\n    var chatModel: FYMessageChatModel? {\n        didSet {\n            guard let model = chatModel else {\n                return\n            }\n            \n            headerView.chatModel = model\n            if model.chatType == 1 {\n                dataSource = [\"设置备注名\".rLocalized()]\n            }\n            \n            plainTabView.reloadData()\n        }\n    }\n    \n    // MARK: - lazy var\n    \n    private var dataSource: [String] = []\n    \n    private lazy var headerView: FYContactsInfoView = {\n        let view = FYContactsInfoView()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        view.frame = CGRect(x: 0, y: 0, width: kScreenW, height: 100)\n        return view\n    }()\n    \n    private lazy var footerView: UIView = {\n        let view = UIView(frame: CGRect(x: 0, y: 0, width: kScreenW, height: 100))\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        view.addSubview(sendButton)\n        sendButton.snp.makeConstraints { (make) in\n            make.left.equalToSuperview().offset(30)\n            make.right.equalToSuperview().offset(-30)\n            make.centerY.equalToSuperview()\n            make.height.equalTo(44)\n        }\n        return view\n    }()\n    \n    private lazy var sendButton: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"发消息\".rLocalized(), for: .normal)\n        button.backgroundColor = .appThemeHexColor()\n        button.radius = 7\n        button.rxTapClosure { [weak self] in\n            if let model = self?.chatModel {\n                let chatVC = FYChatBaseViewController(chatModel: model)\n                self?.navigationController?.pushViewController(chatVC)\n            }\n        }\n        return button\n    }()\n    \n    // MARK: - life cycle\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"个人信息\".rLocalized()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V10 }\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        plainTabView.rowHeight = 50\n        plainTabView.tableHeaderView = headerView\n        plainTabView.tableFooterView = footerView\n        \n        view.addSubview(plainTabView)\n        plainTabView.snp.makeConstraints { (make) in\n            make.top.left.right.equalTo(self.view)\n            if #available(iOS 11.0, *) {\n                make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom)\n            } else {\n                make.bottom.equalTo(self.view.snp.bottomMargin)\n            }\n        }\n    }\n    \n}\n\n\n// MARK: - UITableViewDataSource && Delegate\n\nextension FYContactsInfoViewController: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let kContactsInfoCellIdentifier = \"kContactsInfoCellIdentifier\"\n        var cell = tableView.dequeueReusableCell(withIdentifier: kContactsInfoCellIdentifier)\n        if cell == nil {\n            cell = UITableViewCell(style: .default, reuseIdentifier: kContactsInfoCellIdentifier)\n            cell?.selectionStyle = .none\n            cell?.textLabel?.text = dataSource[safe: indexPath.row]\n            cell?.textLabel?.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n            cell?.accessoryView = createAccessoryView()\n            cell?.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        }\n        return cell!\n    }\n    \n    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {\n        return UIView()\n    }\n\n    func tableView(_ tableView: UITableView, estimatedHeightForHeaderInSection section: Int) -> CGFloat {\n        return 10.0\n    }\n    \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        if let model = chatModel {\n            let editVC = FYEditChatInfoViewController()\n            editVC.chatModel = model\n            navigationController?.pushViewController(editVC)\n        }\n    }\n    \n    private func createAccessoryView() -> UIImageView {\n        let arrowView = UIImageView()\n        arrowView.image = UIImage(named: \"icon_arrow_right\")\n        arrowView.sizeToFit()\n        return arrowView\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Contacts/Controller/FYContactsListViewController.swift",
    "content": "//\n//  FYContactsListViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/8/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nprivate let kContactsCellReuseIdentifier = \"kContactsCellReuseIdentifier\"\n\nclass FYContactsListViewController: FYBaseViewController {\n\n    // MARK: - lazy var\n    \n    var dataSource: [FYMessageChatModel] = []\n    \n    private lazy var deleteButton: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"删除所有好友\".rLocalized(), for: .normal)\n        button.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V11 }, for: .normal)\n        button.titleLabel?.font = .PingFangRegular(16)\n        button.sizeToFit()\n        button.isHidden = true\n        button.rxTapClosure { [weak self] in\n            self?.showDeleteAlert()\n        }\n        return button\n    }()\n    \n    // MARK: - life cycle\n    \n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        \n        deleteButton.isHidden = dataSource.count > 0 ? false : true\n    }\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"好友\".rLocalized()\n        \n        reloadUserData()\n        registerUsersNoti()\n    }\n    \n    @objc private func reloadUserData() {\n        dataSource = FYDBQueryHelper.shared.qureyFromChatsWithType(1)\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData()\n        }\n    }\n    \n    private func registerUsersNoti() {\n        NotificationCenter.default.addObserver(self, selector: #selector(reloadUserData), name: .kNeedRefreshSesstionList, object: nil)\n        NotificationCenter.default.addObserver(self, selector: #selector(reloadUserData), name: .kNeedRefreshChatInfoList, object: nil)\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        let leftBarButtonItem = UIBarButtonItem(customView: deleteButton)\n        navigationItem.leftBarButtonItem = leftBarButtonItem\n        \n        let rightBarButtonItem = UIBarButtonItem(title: \"添加好友\".rLocalized(), style: .plain, target: self, action: #selector(addUserData))\n        navigationItem.rightBarButtonItem = rightBarButtonItem\n        \n        \n        plainTabView.register(FYContactsTableViewCell.self, forCellReuseIdentifier: kContactsCellReuseIdentifier)\n        view.addSubview(plainTabView)\n        plainTabView.snp.makeConstraints { (make) in\n            make.top.left.right.equalTo(self.view)\n            if #available(iOS 11.0, *) {\n                make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom)\n            } else {\n                make.bottom.equalTo(self.view.snp.bottomMargin)\n            }\n        }\n    }\n    \n    @objc private func showDeleteAlert() {\n        EasyAlertView.customAlert(title: \"确定删除全部好友吗？\".rLocalized(), message: \"删除后，会话记录也将清除\".rLocalized(), confirm: \"确定\".rLocalized(), cancel: \"取消\".rLocalized(), vc: self, confirmBlock: {\n            self.removerUserData()\n        }, cancelBlock: {\n            \n        })\n    }\n    \n    @objc private func addUserData() {\n        var uid = 10000\n        if let lastUser = dataSource.last {\n            uid = lastUser.uid! + 1\n        }\n        \n        let chat = FYMessageChatModel()\n        chat.uid = uid\n        chat.name = \"用户名：\" + \"\\(uid)\"\n        \n        chat.avatar = \"http://img.duoziwang.com/2019/02/04232036664241.jpg\"\n        chat.isShowName = true\n        chat.chatType = 1 //单聊\n        \n        dataSource.append(chat)\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData {\n                self.scrollToBottom()\n                FYDBQueryHelper.shared.insertFromChat(chat)\n                self.deleteButton.isHidden = self.dataSource.count > 0 ? false : true\n            }\n        }\n    }\n    \n    @objc private func removerUserData() {\n        dataSource.removeAll()\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData {\n                self.scrollToBottom()\n                FYDBQueryHelper.shared.deleteFromChatsWithType(1)\n                FYDBQueryHelper.shared.deleteFromMessagesWithType(1)\n                self.deleteButton.isHidden = self.dataSource.count > 0 ? false : true\n                // 刷新会话列表\n                NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n            }\n        }\n    }\n    \n    \n    /// 滚到底部\n    private func scrollToBottom(_ animated: Bool = true) {\n        if dataSource.count >= 1 {\n            plainTabView.scrollToRow(at: IndexPath(row: dataSource.count - 1, section: 0), at: .bottom, animated: animated)}\n    }\n}\n\n\n\n// MARK: - UITableViewDataSource && Delegate\n\nextension FYContactsListViewController: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: kContactsCellReuseIdentifier) as! FYContactsTableViewCell\n        if let model = dataSource[safe: indexPath.row] {\n            cell.model = model\n            cell.didAvatarCallClosure = { [weak self] model in\n                self?.pushChatInfo(model)\n            }\n        }\n        \n        return cell\n    }\n    \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        if let model = dataSource[safe: indexPath.row] {\n            let user = FYDBQueryHelper.shared.qureyFromChatId(model.uid!)\n            let chatVC = FYChatBaseViewController(chatModel: user)\n            navigationController?.pushViewController(chatVC, animated: true)\n            // clear\n            clearCurrentBadge(user)\n        }\n    }\n    \n    /// 清空角标\n    private func clearCurrentBadge(_ user: FYMessageChatModel) {\n        if FYDBQueryHelper.shared.queryFromSesstionsUnReadCount() > 0 {\n            if let uid = user.uid {\n                user.unReadCount = 0\n                FYDBQueryHelper.shared.updateFromChatModel(user, uid: uid)\n                // 刷新会话列表\n                NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n            }\n        }\n    }\n    \n    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {\n        if editingStyle == .delete {\n            deleteChatFriend(indexPath.row)\n        }\n    }\n    \n    func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {\n        return \"删除\".rLocalized()\n    }\n    \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        return 82\n    }\n    \n    \n    /// 删除好友\n    @objc private func deleteChatFriend(_ row: Int) {\n        EasyAlertView.customAlert(title: \"确定删除该好友吗？\".rLocalized(), message: \"\", confirm: \"确定\".rLocalized(), cancel: \"取消\".rLocalized(), vc: self, confirmBlock: {\n            self.handleDeleteContactsAtRow(row)\n        }, cancelBlock: {\n            \n        })\n    }\n    \n    func handleDeleteContactsAtRow(_ row: Int) {\n        if let model = dataSource[safe: row] {\n            dataSource.remove(at: row)\n            plainTabView.deleteRows(at: [IndexPath.init(row: row, section: 0)], with: .left)\n            DispatchQueue.main.async {\n                self.plainTabView.reloadData {\n                    if let uid = model.uid {\n                        FYDBQueryHelper.shared.deleteFromChatWithId(uid)\n                        FYDBQueryHelper.shared.deleteFromMesssageWithId(uid)\n                        // 刷新会话列表\n                        NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n                    }\n                }\n            }\n        }\n        \n        deleteButton.isHidden = dataSource.count > 0 ? false : true\n    }\n    \n    func pushChatInfo(_ model: FYMessageChatModel) {\n        let userModel = FYDBQueryHelper.shared.qureyFromChatId(model.uid!)\n        let infoVC = FYContactsInfoViewController()\n        infoVC.chatModel = userModel\n        navigationController?.pushViewController(infoVC)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Contacts/Controller/FYEditChatInfoViewController.swift",
    "content": "//\n//  FYEditChatInfoViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/30.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport RxSwift\n\nclass FYEditChatInfoViewController: FYBaseViewController {\n    \n    var chatModel: FYMessageChatModel? {\n        didSet {\n            guard let model = chatModel else {\n                return\n            }\n            \n            if let nickName = model.nickName {\n                if !nickName.isBlank {\n                    myTextField.text = nickName\n                }\n            }\n        }\n    }\n    \n    // MARK: - lazy var\n    \n    private lazy var saveButton: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"保存\".rLocalized(), for: .normal)\n        button.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V11 }, for: .normal)\n        button.titleLabel?.font = .PingFangRegular(16)\n        button.isHidden = true\n        button.sizeToFit()\n        button.rxTapClosure { [weak self] in\n            self?.saveEditing()\n        }\n        return button\n    }()\n    \n    private lazy var myTextField: UITextField = {\n        let textField = UITextField()\n        let leftView = UIView(frame: CGRect(x: 0, y: 0, width: 10, height: 40))\n        textField.placeholder = \"备注名称不超过12个字\".rLocalized()\n        textField.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        textField.leftView = leftView\n        textField.delegate = self\n        textField.leftViewMode = .always\n        textField.theme.placeholderColor = themed { $0.FYColor_Placeholder_Color_V1 }\n        textField.clearButtonMode = .whileEditing\n        textField.font = .PingFangRegular(15)\n        textField.cornerRadius = 5\n        textField.layer.theme.borderColor = themed { $0.FYColor_BorderColor_V1.cgColor }\n        textField.borderWidth = 1\n        return textField\n    }()\n    \n    // MARK: - life cycle\n    \n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        \n        myTextField.becomeFirstResponder()\n    }\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        navigationItem.title = \"修改备注名称\".rLocalized()\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        let rightBarButtonItem = UIBarButtonItem(customView: saveButton)\n        navigationItem.rightBarButtonItem = rightBarButtonItem\n        \n        myTextField.rx.text.orEmpty\n        .map { $0.count == 0 }\n        .share(replay: 1)\n        .bind(to: saveButton.rx.isHidden)\n        .disposed(by: rx.disposeBag)\n        \n        view.addSubview(myTextField)\n        myTextField.snp.makeConstraints { (make) in\n            make.top.equalToSuperview().offset(kSafeAreaTop + 50)\n            make.left.equalToSuperview().offset(15)\n            make.right.equalToSuperview().offset(-15)\n            make.height.equalTo(40)\n        }\n    }\n\n}\n\n// MARK: - UITextFieldDelegate\n\nextension FYEditChatInfoViewController: UITextFieldDelegate {\n    \n    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {\n        \n        if (range.length == 1 && string.count == 0)\n        {\n            return true\n        }\n        if range.location >= 12\n        {\n            return false\n        }\n                \n        return true\n    }\n    \n    // MARK: - Action\n    \n    private func saveEditing() {\n        myTextField.resignFirstResponder()\n        chatModel?.nickName = myTextField.text ?? \"\"\n        \n        if let model = chatModel, let uid = model.uid {\n            FYDBQueryHelper.shared.updateFromChatModel(model, uid: uid)\n            \n            let messages = FYDBQueryHelper.shared.qureyFromMessagesWithChatId(uid)\n            for msgItem in messages {\n                if msgItem.sendType == 1 {\n                    if let message = FYDBQueryHelper.shared.queryMessageWithMsgId(msgItem.messageId!) {\n                        message.nickName = myTextField.text ?? \"\"\n                        FYDBQueryHelper.shared.updateMessageWithMsgId(message: message, messageId: message.messageId!)\n                    }\n                }\n            }\n            \n            NotificationCenter.default.post(name: .kNeedRefreshSesstionList, object: nil)\n            NotificationCenter.default.post(name: .kNeedRefreshChatInfoList, object: nil)\n            \n            MBHUD.showStatus(\"正在保存...\".rLocalized())\n            DispatchQueue.main.asyncAfter(deadline: .now() + 1.25) {\n                MBHUD.hide()\n                self.navigationController?.popToRootViewController(animated: true)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Contacts/View/FYContactsInfoView.swift",
    "content": "//\n//  FYContactsInfoView.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/30.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYContactsInfoView: UIView {\n    \n    // MARK: - setter\n    \n    var chatModel: FYMessageChatModel? {\n        didSet {\n            guard let model = chatModel else {\n                return\n            }\n            \n            nameLabel.text = model.name\n            \n            if let nickName = model.nickName, nickName.length > 0 {\n                nickLabel.text = \"备注名：\".rLocalized() + nickName\n            }\n            \n            uidLabel.text = \"uid：\\(model.uid ?? 1000)\"\n            avatarView.setImageWithURL(model.avatar!, placeholder: \"ic_avatar_placeholder\")\n        }\n    }\n    \n    \n    // MARK: - private lazy var\n    \n    private lazy var avatarView: UIImageView = {\n        let imageView = UIImageView()\n        imageView.backgroundColor = .random\n        imageView.cornerRadius = 5\n        return imageView\n    }()\n    \n    private lazy var nameLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 14)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        return label\n    }()\n    \n    private lazy var nickLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 13)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V2 }\n        return label\n    }()\n    \n    private lazy var uidLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 12)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V2 }\n        return label\n    }()\n    \n    // MARK: - life cycle\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        \n        makeUI()\n    }\n    \n    required init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        \n        makeUI()\n    }\n    \n    func makeUI() {\n        self.addSubview(avatarView)\n        self.addSubview(nameLabel)\n        self.addSubview(nickLabel)\n        self.addSubview(uidLabel)\n        \n        avatarView.snp.remakeConstraints { (make) in\n            make.width.height.equalTo(60)\n            make.left.equalToSuperview().offset(10)\n            make.centerY.equalToSuperview()\n        }\n        \n        nameLabel.snp.remakeConstraints { (make) in\n            make.top.equalTo(avatarView).offset(2)\n            make.left.equalTo(avatarView.snp.right).offset(10)\n        }\n        \n        nickLabel.snp.remakeConstraints { (make) in\n            make.left.equalTo(nameLabel)\n            make.top.equalTo(nameLabel.snp.bottom).offset(5)\n        }\n        \n        uidLabel.snp.remakeConstraints { (make) in\n            make.bottom.equalTo(avatarView).offset(-2)\n            make.left.equalTo(nameLabel)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Contacts/View/FYContactsTableViewCell.swift",
    "content": "//\n//  FYContactsTableViewCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYContactsTableViewCell: UITableViewCell {\n\n    var model: FYMessageChatModel? {\n        didSet {\n            guard let chatModel = model else {\n                return\n            }\n\n            if chatModel.nickName.isBlank == false {\n                nameLabel.text = chatModel.nickName\n            }else {\n                nameLabel.text = chatModel.name\n            }\n            \n            uidLabel.text = \"uid：\\(chatModel.uid ?? 1000)\"\n            avatarView.setImageWithURL(chatModel.avatar ?? \"\", placeholder: R.image.ic_avatar_placeholder()!)\n        }\n    }\n    \n    // MARK: - var lazy\n    \n    var didAvatarCallClosure : ((FYMessageChatModel)->Void)?\n    \n    private lazy var avatarView: UIImageView = {\n        let imageView = UIImageView()\n        imageView.cornerRadius = 7\n        imageView.tapClosure { [weak self] in\n            self?.avatarAction()\n        }\n        return imageView\n    }()\n    \n    private lazy var nameLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 15)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        return label\n    }()\n    \n    private lazy var uidLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 14)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V10 }\n        return label\n    }()\n    \n    lazy var selectedView: UIImageView = {\n        let imageView = UIImageView()\n        imageView.isHidden = true\n        return imageView\n    }()\n    \n    lazy var lineView: UIView = {\n        let v = UIView()\n        v.theme.backgroundColor = themed { $0.FYColor_BorderColor_V2 }\n        return v\n    }()\n    \n    \n    // MARK: - life cycle\n    \n    override func awakeFromNib() {\n        super.awakeFromNib()\n        // Initialization code\n        selectionStyle = .none\n    }\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        \n        setupSubview()\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    func setupSubview() {\n        selectionStyle = .none\n        theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        contentView.addSubview(avatarView)\n        contentView.addSubview(nameLabel)\n        contentView.addSubview(uidLabel)\n        contentView.addSubview(selectedView)\n        contentView.addSubview(lineView)\n        \n        avatarView.snp.makeConstraints { (make) in\n            make.left.equalToSuperview().offset(14)\n            make.centerY.equalToSuperview()\n            make.width.height.equalTo(60)\n        }\n        \n        nameLabel.snp.makeConstraints { (make) in\n            make.left.equalTo(avatarView.snp.right).offset(8)\n            make.top.equalTo(avatarView)\n            make.right.equalToSuperview().offset(-14)\n        }\n        \n        uidLabel.snp.makeConstraints { (make) in\n            make.left.equalTo(nameLabel)\n            make.top.equalTo(nameLabel.snp.bottom).offset(20)\n            make.right.equalToSuperview().offset(-14)\n        }\n        \n        selectedView.snp.makeConstraints { (make) in\n            make.centerY.equalToSuperview()\n            make.right.equalToSuperview().offset(-14)\n        }\n        \n        lineView.snp.makeConstraints { make in\n            make.bottom.right.equalToSuperview()\n            make.left.equalTo(avatarView)\n            make.height.equalTo(0.7)\n        }\n    }\n    \n    override func setSelected(_ selected: Bool, animated: Bool) {\n        super.setSelected(selected, animated: animated)\n\n        if selected {\n            selectedView.image = UIImage(named: \"ic_msg_forward_s\")\n        }else {\n            selectedView.image = UIImage(named: \"ic_msg_forward_n\")\n        }\n    }\n\n    // MARK: - Action\n    \n    @objc func avatarAction() {\n        if didAvatarCallClosure != nil {\n            didAvatarCallClosure?(self.model!)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Conversation/Controller/FYSesstionListViewController.swift",
    "content": "//\n//  FYSesstionListViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/8/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nprivate let kSessionsCellReuseIdentifier = \"kSessionsCellReuseIdentifier\"\n\nclass FYSesstionListViewController: FYBaseViewController {\n    \n    var dataSource: [FYMessageItem] = []\n    \n    private lazy var clearButton: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"全部已读\".rLocalized(), for: .normal)\n        button.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V11 }, for: .normal)\n        button.titleLabel?.font = .PingFangRegular(16)\n        button.isHidden = true\n        button.sizeToFit()\n        button.rxTapClosure { [weak self] in\n            self?.readAllAction()\n        }\n        return button\n    }()\n    \n    private lazy var menuList: [FYCellDataConfig] = {\n        let items = [\n            FYCellDataConfig(title: \"发起单聊\".rLocalized(), image: \"ic_tabbar01_selected\", isShow: true),\n            FYCellDataConfig(title: \"发起群聊\".rLocalized(), image: \"ic_tabbar02_selected\", isShow: true),\n            FYCellDataConfig(title: \"添加朋友\".rLocalized(), image: \"ic_tabbar03_selected\", isShow: true),\n            FYCellDataConfig(title: \"扫一扫\".rLocalized(), image: \"ic_tabbar04_selected\", isShow: false)\n        ]\n        return items\n    }()\n    \n    // MARK: - Life cycle\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"会话\".rLocalized();\n        \n        reloadSesstionData()\n        registerSessionNoti()\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        let navLeftItem = UIBarButtonItem(customView: clearButton)\n        navigationItem.leftBarButtonItem = navLeftItem\n        \n        let rightBarButtonItem = UIBarButtonItem(image: R.image.icon_more_add(), style: .done, target: self, action: #selector(showPopMenu))\n        navigationItem.rightBarButtonItem = rightBarButtonItem\n        \n        setupTableView()\n    }\n    \n    private func registerSessionNoti() {\n        NotificationCenter.default.addObserver(self, selector: #selector(reloadSesstionData), name: .kNeedRefreshSesstionList, object: nil)\n        NotificationCenter.default.addObserver(self, selector: #selector(reloadSesstionData), name: .kNeedRefreshChatInfoList, object: nil)\n    }\n    \n    func setupTableView() {\n        plainTabView.register(FYConversationCell.self, forCellReuseIdentifier: kSessionsCellReuseIdentifier)\n        view.addSubview(plainTabView)\n        plainTabView.snp.makeConstraints { (make) in\n            make.top.left.right.equalTo(self.view)\n            if #available(iOS 11.0, *) {\n                make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom)\n            } else {\n                make.bottom.equalTo(self.view.snp.bottomMargin)\n            }\n        }\n    }\n    \n    @objc func showPopMenu() {\n        let popView = FYNavPopuListMenu(dataSource: menuList)\n        popView.delegate = self\n        popView.show()\n    }\n    \n    @objc func readAllAction() {\n        let lastSesstions = FYDBQueryHelper.shared.qureyFromLastSesstions()\n        if lastSesstions.count > 0 {\n            for item in lastSesstions {\n                let chat = FYDBQueryHelper.shared.qureyFromChatId(item.chatId!)\n                chat.unReadCount = 0\n                FYDBQueryHelper.shared.updateFromChatModel(chat, uid: chat.uid!)\n            }\n            \n            reloadSesstionData()\n            MBHUD.showSuccess(\"已清除全部未读消息数\".rLocalized())\n        }\n    }\n\n    @objc private func reloadSesstionData() {\n        dataSource = FYDBQueryHelper.shared.qureyFromLastSesstions()\n        reloadTableView()\n    }\n    \n    private func showSessionBadge() {\n        var badgeValue: String? = nil\n        let unReadCount = FYDBQueryHelper.shared.queryFromSesstionsUnReadCount()\n        if unReadCount > 0 {\n            badgeValue = unReadCount > 99 ? \"99+\" : \"\\(unReadCount)\"\n        }else {\n            badgeValue = nil\n        }\n        self.tabBarItem.badgeValue = badgeValue\n    }\n    \n    /// 清空角标\n    private func clearCurrentBadge(_ user: FYMessageChatModel) {\n        if FYDBQueryHelper.shared.queryFromSesstionsUnReadCount() > 0 {\n            if let uid = user.uid {\n                user.unReadCount = 0\n                FYDBQueryHelper.shared.updateFromChatModel(user, uid: uid)\n                reloadSesstionData()\n            }\n        }\n    }\n    \n    /// 滚到底部\n    private func scrollToBottom(_ animated: Bool = true) {\n        if dataSource.count >= 1 {\n            plainTabView.scrollToRow(at: IndexPath(row: dataSource.count - 1, section: 0), at: .bottom, animated: animated)}\n    }\n    \n    /// 刷新会话列表\n    private func reloadTableView() {\n        DispatchQueue.main.async {\n            self.plainTabView.reloadData()\n            self.showSessionBadge()\n        }\n    }\n}\n\n// MARK: - FYPopListMenuDelegate\n\nextension FYSesstionListViewController: FYPopListMenuDelegate {\n    \n    func menu(_ model: FYCellDataConfig, didSelectRowAt index: Int) {\n        if index == 0 || index == 2 {\n            UIViewController.currentViewController()?.tabBarController?.selectedIndex = 2\n        }else if index == 1 {\n            UIViewController.currentViewController()?.tabBarController?.selectedIndex = 1\n        }else {\n            let scanVC = ScanQRCodeViewController()\n            navigationController?.pushViewController(scanVC)\n        }\n    }\n}\n\n\n// MARK: - UITableViewDataSource && Delegate\n\nextension FYSesstionListViewController: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: kSessionsCellReuseIdentifier) as! FYConversationCell\n        if let model = dataSource[safe: indexPath.row] {\n            cell.model = model\n            cell.avatarOnClick = { [weak self] in\n                self?.pushChatInfo(model)\n            }\n        }\n        clearButton.isHidden = FYDBQueryHelper.shared.queryFromSesstionsUnReadCount() <= 0\n        return cell\n    }\n    \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        if let model = dataSource[safe: indexPath.row] {\n            let user = FYDBQueryHelper.shared.qureyFromChatId(model.chatId!)\n            let chatVC = FYChatBaseViewController(chatModel: user)\n            navigationController?.pushViewController(chatVC, animated: true)\n            // clear\n            model.unReadCount = 0\n            clearCurrentBadge(user)\n        }\n    }\n    \n    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {\n        if editingStyle == .delete {\n            handleDeleteSesstionAtRow(indexPath.row)\n        }\n    }\n    \n    func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {\n        return \"删除\".rLocalized()\n    }\n    \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        return 82\n    }\n\n    /// 删除会话记录\n    func handleDeleteSesstionAtRow(_ row: Int) {\n        if let model = dataSource[safe: row] {\n            dataSource.remove(at: row)\n            plainTabView.deleteRows(at: [IndexPath.init(row: row, section: 0)], with: .left)\n            if let chatId = model.chatId {\n                // 清除记录\n                FYDBQueryHelper.shared.deleteFromMesssageWithId(chatId)\n                // 清除角标\n                let user = FYDBQueryHelper.shared.qureyFromChatId(chatId)\n                clearCurrentBadge(user)\n                reloadSesstionData()\n            }\n        }\n    }\n    \n    func pushChatInfo(_ model: FYMessageItem) {\n        let userModel = FYDBQueryHelper.shared.qureyFromChatId(model.chatId!)\n        let infoVC = FYContactsInfoViewController()\n        infoVC.chatModel = userModel\n        navigationController?.pushViewController(infoVC)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Conversation/View/FYConversationCell.swift",
    "content": "//\n//  FYConversationCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/28.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYConversationCell: UITableViewCell {\n\n    var avatarOnClick: (()->Void)?\n    \n    var model: FYMessageItem? {\n        didSet {\n            guard let msgItem = model else {\n                return\n            }\n            \n            if msgItem.nickName.isBlank == false {\n                nameLabel.text = msgItem.nickName\n            }else {\n                nameLabel.text = msgItem.name\n            }\n            \n            messageLabel.text = msgItem.message\n            \n            if let doubleDate = msgItem.date?.stringToTimeStamp().doubleValue {\n                dateLabel.text = msgItem.date?.detailDate24Week(time: doubleDate * 1000)\n            }\n            avatarView.setImageWithURL(model!.avatar!, placeholder: \"ic_avatar_placeholder\")\n            \n            if let unReadCount = msgItem.unReadCount, unReadCount > 0 {\n                if unReadCount <= 99 {\n                    badgeLabel.text = \"\\(unReadCount)\"\n                }else {\n                    badgeLabel.text = \"99+\"\n                }\n                badgeLabel.isHidden = false\n            }else {\n                badgeLabel.isHidden = true\n                badgeLabel.text = nil\n            }\n        }\n    }\n    \n    // MARK: - var lazy\n    \n    private lazy var avatarView: UIImageView = {\n        let imageView = UIImageView()\n        imageView.cornerRadius = 7\n        imageView.tapClosure { [weak self] in\n            self?.avatarTapAction()\n        }\n        return imageView\n    }()\n    \n    private lazy var nameLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 15)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        return label\n    }()\n    \n    private lazy var badgeLabel: UILabel = {\n        let label = UILabel()\n        label.isHidden = true\n        label.textColor = .white\n        label.backgroundColor = .red\n        label.font = .PingFangRegular(9)\n        label.textAlignment = .center\n        label.cornerRadius = 8\n        return label\n    }()\n    \n    private lazy var messageLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 14)\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V10 }\n        return label\n    }()\n    \n    private lazy var dateLabel: UILabel = {\n        let label = UILabel()\n        label.font = UIFont.systemFont(ofSize: 12)\n        label.textAlignment = .right\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V2 }\n        return label\n    }()\n    \n    lazy var lineView: UIView = {\n        let v = UIView()\n        v.theme.backgroundColor = themed { $0.FYColor_BorderColor_V2 }\n        return v\n    }()\n    \n    // MARK: - life cycle\n    \n    override func awakeFromNib() {\n        super.awakeFromNib()\n        // Initialization code\n        selectionStyle = .none\n    }\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        \n        setupSubview()\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    func setupSubview() {\n        selectionStyle = .none\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        contentView.addSubview(avatarView)\n        contentView.addSubview(nameLabel)\n        contentView.addSubview(dateLabel)\n        contentView.addSubview(messageLabel)\n        contentView.addSubview(badgeLabel)\n        contentView.addSubview(lineView)\n                \n        avatarView.snp.makeConstraints { (make) in\n            make.left.equalToSuperview().offset(14)\n            make.centerY.equalToSuperview()\n            make.width.height.equalTo(60)\n        }\n        \n        badgeLabel.snp.makeConstraints { (make) in\n            make.right.equalTo(avatarView).offset(8)\n            make.top.equalTo(avatarView).offset(-8)\n            make.width.height.equalTo(16)\n        }\n        \n        nameLabel.snp.makeConstraints { (make) in\n            make.left.equalTo(avatarView.snp.right).offset(12)\n            make.top.equalTo(avatarView)\n            make.right.equalToSuperview().offset(-14)\n        }\n        \n        dateLabel.snp.makeConstraints { (make) in\n            make.right.equalToSuperview().offset(-14)\n            make.top.equalTo(avatarView)\n        }\n        \n        messageLabel.snp.makeConstraints { (make) in\n            make.left.equalTo(nameLabel)\n            make.top.equalTo(nameLabel.snp.bottom).offset(20)\n            make.right.equalToSuperview().offset(-14)\n        }\n        \n        lineView.snp.makeConstraints { make in\n            make.bottom.right.equalToSuperview()\n            make.left.equalTo(avatarView)\n            make.height.equalTo(0.7)\n        }\n    }\n    \n    // MARK: - Action\n    \n    @objc\n    func avatarTapAction() {\n        if avatarOnClick != nil {\n            avatarOnClick!()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Mine/Controller/FYMineViewController.swift",
    "content": "//\n//  FYMineViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/8/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport RxSwift\nimport SafariServices\n\nclass FYMineViewController: FYBaseViewController {\n\n    // MARK: - life cycle\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"我\".rLocalized()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V10 }\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n    \n        let moments = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: false)\n                .title(text: \"朋友圈\".rLocalized())\n                .contentState(state: .normal)\n                .clickClosure({ [weak self] in\n                    self?.momentsAction()\n                }).last(isLine: true)\n        }\n        .adhere(toSuperView: self.view)\n        .layout(snapKitMaker: { make in\n            make.top.equalTo(self.view)\n            make.left.right.equalTo(self.view)\n            make.height.equalTo(50)\n        })\n        \n        let settings = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: false)\n                .title(text: \"设置\".rLocalized())\n                .contentState(state: .normal)\n                .clickClosure({ [weak self] in\n                    self?.settingAction()\n                }).last(isLine: false)\n        }\n        .adhere(toSuperView: self.view)\n        .layout(snapKitMaker: { make in\n            make.top.equalTo(moments.snp.bottom)\n            make.left.right.equalTo(self.view)\n            make.height.equalTo(moments)\n        })\n        \n        _ = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: false)\n                .title(text: \"作者github\".rLocalized())\n                .content(text: \"Jett\")\n                .contentState(state: .normal)\n                .clickClosure({ [weak self] in\n                    self?.openSafariURL(url: \"https://github.com/developerjet\")\n                }).last(isLine: false)\n        }\n        .adhere(toSuperView: self.view)\n        .layout(snapKitMaker: { make in\n            make.top.equalTo(settings.snp.bottom).offset(10)\n            make.left.right.equalTo(self.view)\n            make.height.equalTo(settings)\n        })\n    }\n    \n\n    // MARK: - Action\n    \n    private func momentsAction() {\n        let momentsVc = FYMomentsViewController()\n        navigationController?.pushViewController(momentsVc)\n    }\n\n    private func settingAction() {\n        let settingVC = FYSettingViewController()\n        navigationController?.pushViewController(settingVC)\n    }\n    \n    \n    private func openSafariURL(url: String) {\n        if let urlValue = url.URLValue {\n            let safariVC = SFSafariViewController(url: urlValue)\n            present(safariVC, animated: true, completion: nil)\n        }\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Mine/Controller/FYSettingViewController.swift",
    "content": "//\n//  FYSettingViewController.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/6.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYSettingViewController: FYBaseViewController {\n    \n    // MARK: - Private\n    \n    private var languageView: FYFastGridListView!\n    private var versionView: FYFastGridListView!\n    private var cachesView: FYFastGridListView!\n    private var themeView: FYFastGridListView!\n    \n    // MARK: - life cycle\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        navigationItem.title = \"设置\".rLocalized()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V10 }\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        let languageCode = LanguageManager.manager.selectedLanguage\n        languageView = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: false)\n                .title(text: \"语言设置\".rLocalized())\n                .content(text: (languageCode?.getLanguageRaw().rLocalized())!)\n                .contentState(state: .highlight)\n                .clickClosure({ [weak self] in\n                    self?.showLanguageAction()\n                }).last(isLine: true)\n        }\n        .adhere(toSuperView: self.view)\n        .layout(snapKitMaker: { make in\n            make.top.equalTo(self.view)\n            make.left.right.equalTo(self.view)\n            make.height.equalTo(50)\n        })\n        \n\n        versionView = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: false)\n                .title(text: \"版本\".rLocalized())\n                .content(text: \"版本号:\".rLocalized() + majorVersion)\n                .contentState(state: .normal)\n                .clickClosure({\n                    MBHUD.showImageError(\"已是最新版本\".rLocalized())\n                }).last(isLine: true)\n        }\n        .adhere(toSuperView: self.view)\n        .layout(snapKitMaker: { make in\n            make.top.equalTo(languageView.snp.bottom)\n            make.left.right.equalTo(self.view)\n            make.height.equalTo(languageView)\n        })\n        \n\n        cachesView = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: false)\n                .title(text: \"清除图片缓存\".rLocalized())\n                .content(text: \"\\(fileCachesSize())\")\n                .contentState(state: .normal)\n                .clickClosure({ [weak self] in\n                    self?.beginClearCaches()\n                }).last(isLine: true)\n        }\n        .adhere(toSuperView: self.view)\n        .layout(snapKitMaker: { make in\n            make.top.equalTo(versionView.snp.bottom)\n            make.left.right.equalTo(self.view)\n            make.height.equalTo(versionView)\n        })\n        \n        \n        var themeTitle: String = \"\"\n        let lastThemeMode = FYThemeCenter.shared.currentTheme\n        switch lastThemeMode {\n        case .light:\n            themeTitle = \"白天模式\".rLocalized()\n        case .dark:\n            themeTitle = \"黑夜模式\".rLocalized()\n        default:\n            themeTitle = \"跟随系统\".rLocalized()\n        }\n        \n        themeView = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: false)\n                .title(text: \"主题模式\".rLocalized())\n                .content(text: themeTitle )\n                .contentState(state: .normal)\n                .clickClosure({ [weak self] in\n                    self?.themeSelection()\n                }).last(isLine: false)\n        }\n        .adhere(toSuperView: self.view)\n        .layout(snapKitMaker: { make in\n            make.top.equalTo(cachesView.snp.bottom)\n            make.left.right.equalTo(self.view)\n            make.height.equalTo(cachesView)\n        })\n    }\n    \n    private func fileCachesSize() -> String {\n        return FYFileSizeManager.manager.cacheSize()\n    }\n    \n    // MARK: - Action\n    \n    private func showLanguageAction() {\n        \n        let titles = LanguageManager.manager.currentLanguages\n        let actionSheet = FYActionSheet(isShowCancel: true, actionTitles: titles)\n        self.present(actionSheet, animated: true)\n        \n        actionSheet.handler = { index in\n            if (index == 0) {\n                LanguageManager.manager.setCurrentLanguage(.kChinese)\n            }else {\n                LanguageManager.manager.setCurrentLanguage(.kEnglish)\n            }\n            self.navigationController?.popViewController(animated: false)\n        }\n    }\n    \n    private func beginClearCaches() {\n        MBHUD.show()\n        \n        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2.0) {\n            FYFileSizeManager.manager.clearImageCaches {\n                MBHUD.showSuccess(\"清除成功\".rLocalized())\n                self.cachesView.contentLabel.text = self.fileCachesSize()\n            }\n        }\n    }\n    \n    private func themeSelection() {\n        let themeVc = FYThemeSelectionListVC()\n        navigationController?.pushViewController(themeVc)\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Mine/Controller/FYThemeSelectionListVC.swift",
    "content": "//\n//  FYThemeSelectionListVC.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/30.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYThemeSelectionListVC: FYBaseViewController {\n    \n    // MARK: - lazy var\n    \n    private var systemThemeView: FYFastGridListView!\n    private var lightThemeView: FYFastGridListView!\n    private var drakThemeView: FYFastGridListView!\n    \n    // MARK: - life cycle\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        self.navigationItem.title = \"主题模式\".rLocalized()\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V10 }\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        \n        var isHideSystem: Bool = true\n        var systemHeight: CGFloat = 0\n        \n        // iOS可跟随系统模式\n        if #available(iOS 13.0, *) {\n            systemHeight = 50\n            isHideSystem = false\n        }\n        \n        let lastThemeMode = FYThemeCenter.shared.currentTheme\n        systemThemeView = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: lastThemeMode == .system ? false : true)\n                .title(text: \"跟随系统\".rLocalized())\n                .content(text: \"选取后，将跟随系统设定模式\".rLocalized())\n                .contentState(state: .normal)\n                .clickClosure({ [weak self] in\n                    self?.selectedTheme(mode: .system)\n                }).last(isLine: true)\n        }\n            .adhere(toSuperView: self.view)\n            .layout(snapKitMaker: { make in\n                make.top.equalTo(self.view)\n                make.left.right.equalTo(self.view)\n                make.height.equalTo(systemHeight)\n            })\n        \n        lightThemeView = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: lastThemeMode == .light ? false : true)\n                .title(text: \"白天模式\".rLocalized())\n                .contentState(state: .highlight)\n                .clickClosure({ [weak self] in\n                    self?.selectedTheme(mode: .light)\n                }).last(isLine: true)\n        }\n            .adhere(toSuperView: self.view)\n            .layout(snapKitMaker: { make in\n                make.top.equalTo(systemThemeView.snp.bottom)\n                make.left.right.equalTo(self.view)\n                make.height.equalTo(50)\n            })\n        \n        \n        drakThemeView = FYFastGridListView().config { (view) in\n            view.isHiddenArrow(isHidden: lastThemeMode == .dark ? false : true)\n                .title(text: \"黑夜模式\".rLocalized())\n                .contentState(state: .normal)\n                .clickClosure({ [weak self] in\n                    self?.selectedTheme(mode: .dark)\n                }).last(isLine: false)\n        }\n            .adhere(toSuperView: self.view)\n            .layout(snapKitMaker: { make in\n                make.top.equalTo(lightThemeView.snp.bottom)\n                make.left.right.equalTo(self.view)\n                make.height.equalTo(lightThemeView)\n            })\n        \n        systemThemeView.isHidden = isHideSystem\n        systemThemeView.rightImageView.image = R.image.ic_list_selection()\n        \n        lightThemeView.rightImageView.image = R.image.ic_list_selection()\n        drakThemeView.rightImageView.image = R.image.ic_list_selection()\n    }\n    \n    // MARK: - Action\n    \n    private func selectedTheme(mode: FYThemeMode) {\n        \n        switch mode {\n        case .light:\n            lightThemeView.isHiddenArrow(isHidden: false)\n            drakThemeView.isHiddenArrow(isHidden: true)\n            systemThemeView.isHiddenArrow(isHidden: true)\n            themeService.switch(.light)\n            \n        case .dark:\n            themeService.switch(.dark)\n            drakThemeView.isHiddenArrow(isHidden: false)\n            lightThemeView.isHiddenArrow(isHidden: true)\n            systemThemeView.isHiddenArrow(isHidden: true)\n            \n        default:\n            if #available(iOS 13.0, *) {\n                // iOS13跟随系统\n                if UITraitCollection.current.userInterfaceStyle == .dark {\n                    print(\"System Dark mode\")\n                    themeService.switch(.dark)\n                }else {\n                    print(\"System Light mode\")\n                    themeService.switch(.light)\n                }\n                \n                systemThemeView.isHiddenArrow(isHidden: false)\n                lightThemeView.isHiddenArrow(isHidden: true)\n                drakThemeView.isHiddenArrow(isHidden: true)\n            }\n        }\n                \n        FYThemeCenter.shared.saveSelectionTheme(mode: mode)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Mine/View/FYFastGridListView.swift",
    "content": "//\n//  FYFastGridListView.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/8/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//  快速实现列表栏\n\nimport UIKit\nimport RxSwift\n\n/**\n 用例:（Example）\n \n let language = FYFastGridListView().config { (view) in\n view.isHiddenArrow(isHidden: false)\n .title(text: \"语言设置\")\n .content(text: \"简体中文\")\n .contentState(state: .highlight)\n .clickClosure({ [weak self] in\n })\n .last(isLine: true)\n }\n .adhere(toSuperView: self.view)\n .layout(snapKitMaker: { make in\n make.top.equalTo(self.view)\n make.left.right.equalTo(self.view)\n make.height.equalTo(50)\n })\n \n */\n\nclass FYFastGridListView: UIView {\n\n    fileprivate var didClickClosure : (()->Void)?\n    \n    // MARK: - Lazy var\n    \n    lazy var titleLabel: UILabel = {\n        let label = UILabel()\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        label.font = UIFont.PingFangRegular(14)\n        return label\n    }()\n    \n    lazy var contentLabel: UILabel = {\n        let label = UILabel()\n        label.theme.textColor = themed { $0.FYColor_Main_TextColor_V2 }\n        label.font = UIFont.PingFangRegular(14)\n        return label\n    }()\n    \n    lazy var rightImageView: UIImageView = {\n        let imageView = UIImageView()\n        imageView.image = R.image.icon_arrow_right()\n        return imageView\n    }()\n    \n    lazy var lineView: UIView = {\n        let view = UIView()\n        view.theme.backgroundColor = themed { $0.FYColor_BorderColor_V2 }\n        return view\n    }()\n    \n    // MARK: - Life cycle\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        \n        makeUI()\n    }\n    \n    required init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        \n        makeUI()\n    }\n    \n    func makeUI() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        self.addSubview(self.titleLabel)\n        self.addSubview(self.contentLabel)\n        self.addSubview(self.rightImageView)\n        self.addSubview(self.lineView)\n\n        self.titleLabel.snp.makeConstraints { (make) in\n            make.centerY.equalTo(self)\n            make.left.equalTo(self).offset(15)\n        }\n        \n        self.contentLabel.snp.makeConstraints { (make) in\n            make.centerY.equalTo(self)\n            make.right.equalTo(self).offset(-30)\n        }\n        \n        self.rightImageView.snp.makeConstraints { (make) in\n            make.centerY.equalTo(self)\n            make.right.equalTo(self).offset(-15)\n        }\n        \n        self.lineView.snp.makeConstraints { (make) in\n            make.bottom.equalTo(self)\n            make.height.equalTo(0.5)\n            make.left.equalTo(self).offset(14)\n            make.right.equalTo(self)\n        }\n        \n\n        let tap = UITapGestureRecognizer()\n        tap.rx.event.throttle(.microseconds(100), scheduler: MainScheduler.instance).subscribe {[weak self] (event) in\n            self?.didClickClosure?()\n        }.disposed(by: rx.disposeBag)\n        self.addGestureRecognizer(tap)\n    }\n}\n\n\nenum CustomContentColorState {\n    case normal\n    case highlight\n    \n    func stateColor() -> UIColor {\n        switch self {\n        case .normal:\n            switch themeService.type {\n            case .light:\n                return .Color_Gray_77808A\n            default:\n                return .Color_Gray_5A636D\n            }\n        case .highlight:\n            return .Color_Blue_1890FF\n        }\n    }\n}\n\nprotocol CustomContentProtocal { }\n\nextension CustomContentProtocal where Self: FYFastGridListView {\n    @discardableResult\n    func config(_ config:(Self)->Void) -> Self {\n        config(self)\n        return self\n    }\n}\n\n\nextension FYFastGridListView: CustomContentProtocal {\n    @discardableResult\n    func title(text: String) -> Self {\n        self.titleLabel.text = text\n        return self\n    }\n    \n    @discardableResult\n    func content(text: String) -> Self {\n        self.contentLabel.text = text\n        return self\n    }\n    \n    @discardableResult\n    func titleColor(color: UIColor) -> Self {\n        self.titleLabel.textColor = color\n        return self\n    }\n    \n    @discardableResult\n    func contentColor(color: UIColor) -> Self {\n        self.contentLabel.textColor = color\n        return self\n    }\n    \n    @discardableResult\n    func contentState(state:CustomContentColorState) -> Self {\n        self.contentLabel.textColor = state.stateColor()\n        return self\n    }\n    \n    @discardableResult\n    func clickClosure(_ closure:@escaping ()->Void) -> Self {\n        didClickClosure = closure\n        self.isUserInteractionEnabled = true\n        return self\n    }\n    \n    @discardableResult\n    func isHiddenArrow(isHidden: Bool) -> Self {\n        if (isHidden) {\n            // 隐藏箭头\n            self.rightImageView.isHidden = true\n            \n            self.contentLabel.snp.updateConstraints{ (make) in\n                make.right.equalTo(self).offset(-15)\n            }\n            \n        }else {\n            // 显示箭头\n            self.rightImageView.isHidden = false\n            \n            self.contentLabel.snp.updateConstraints { (make) in\n                make.centerY.equalTo(self)\n                make.right.equalTo(self).offset(-30)\n            }\n            \n            self.rightImageView.snp.updateConstraints { (make) in\n                make.centerY.equalTo(self)\n                make.right.equalTo(self).offset(-15)\n            }\n        }\n        \n        self.updateConstraints()\n        \n        return self\n    }\n    \n    // 最后分割线\n    @discardableResult\n    func last(isLine: Bool) {\n        if (isLine) {\n            self.lineView.isHidden = false\n        }else {\n            self.lineView.isHidden = true\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/FYMomentsViewController.swift",
    "content": "//\n//  FYMomentsViewController.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport IGListKit\nimport IGListDiffKit\nimport MJRefresh\n\nclass FYMomentsViewController: FYBaseIGListViewController {\n\n    // MARK: - lazy var\n    \n    fileprivate var contentOffsetY: CGFloat = 0\n    \n    fileprivate var publish: NSObjectProtocol?\n    fileprivate var location: NSObjectProtocol?\n    fileprivate var delete: NSObjectProtocol?\n    fileprivate var contentOffset: NSObjectProtocol?\n    fileprivate var push: NSObjectProtocol?\n    fileprivate var openURL: NSObjectProtocol?\n    fileprivate var page: Int = 1\n    \n    private lazy var momentNavBar: FYMomentNavBar = {\n        let nav = FYMomentNavBar(frame: CGRect(x: 0, y: 0, width: kScreenW, height: kNavigaH))\n        nav.onClick = { [weak self] index in\n            switch index {\n            case 100:\n                self?.navigationController?.popViewController(animated: true)\n            default:\n                break\n            }\n        }\n        return nav\n    }()\n    \n    // MARK: - life cycle\n    \n    override func listAdapter(_ listAdapter: ListAdapter, sectionControllerFor object: Any) -> ListSectionController {\n        switch object {\n        case is FYMomentInfo:\n            let section = FYMomentBindingSection()\n            return section\n        default:\n            fatalError()\n        }\n    }\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"朋友圈\".rLocalized()\n        \n        addRefreshing()\n        loadData()\n    }\n    \n    override func makeUI() {\n        super.makeUI()\n        adapter.scrollViewDelegate = self\n        \n        view.addSubview(momentNavBar)\n        momentNavBar.snp.makeConstraints { make in\n            make.left.top.right.equalTo(self.view);\n            make.height.equalTo(kNavigaH)\n        }\n    }\n    \n    private func addRefreshing() {\n        \n        collectionView.mj_header = FYMomentsHeaderRefresh(refreshingBlock: {[weak self] in\n            DispatchQueue.main.asyncAfter(deadline: .now() + 1) {\n                self?.collectionView.mj_header?.endRefreshing()\n            }\n        })\n        \n        collectionView.mj_footer = MJRefreshAutoNormalFooter(refreshingBlock: {[weak self] in\n            DispatchQueue.main.asyncAfter(deadline: .now() + 1) {\n                self?.loadData(\"moments2\")\n                self?.collectionView.mj_footer?.endRefreshing()\n            }\n        })\n    }\n    \n    private func loadData(_ resource: String = \"moments1\") {\n        do {\n            let url = Bundle.main.url(forResource: resource, withExtension: \"json\")!\n            do {\n                let data = try Data(contentsOf: url)\n                let jsonData: Any = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.mutableContainers)\n                \n                if let jsonArray = jsonData as? NSArray {\n                    if let modelArray = [FYMomentInfo].deserialize(from: jsonArray) {\n                        for info in modelArray {\n                            info?.id = Int(arc4random_uniform(255))\n                            self.objects.append(info!)\n                        }\n                    }\n                    \n                    adapter.performUpdates(animated: true, completion: nil)\n                }\n                \n            } catch  {\n                print(\"decode failure\")\n            }\n        }\n    }\n}\n\nfileprivate extension FYMomentsViewController {\n    \n    func notification() {\n        publish = NotificationCenter.default.addObserver(forName: NSNotification.Name.list.publish, object: nil, queue: OperationQueue.main) {[weak self] (noti) in\n            self?.loadData()\n        }\n        \n        location = NotificationCenter.default.addObserver(forName: NSNotification.Name.list.location, object: nil, queue: OperationQueue.main) { [weak self] (noti) in\n            guard let object = noti.object as? FYMomentInfo else {\n                return\n            }\n            print(\"click location\", object)\n        }\n        \n        delete = NotificationCenter.default.addObserver(forName: Notification.Name.list.delete, object: nil, queue: OperationQueue.main) {[weak self] (noti) in\n            guard let object = noti.object as? FYMomentInfo, let self = self else {\n                return\n            }\n            self.objects.removeAll { (element) -> Bool in\n                guard let ele = element as? FYMomentInfo else {\n                    return false\n                }\n                return ele.id == object.id\n            }\n            self.adapter.performUpdates(animated: true, completion: nil)\n        }\n        \n        contentOffset = NotificationCenter.default.addObserver(forName: NSNotification.Name.list.contentOffset, object: nil, queue: OperationQueue.main, using: {[weak self] (noti) in\n            guard let offset = noti.object as? CGFloat, let self = self else {\n                return\n            }\n            if offset < 0 { return }\n            self.collectionView.setContentOffset(CGPoint(x: 0, y: offset), animated: false)\n        })\n        \n        push = NotificationCenter.default.addObserver(forName: NSNotification.Name.list.push, object: nil, queue: OperationQueue.main, using: {[weak self] (noti) in\n            guard let userId = noti.object as? Int, let self = self else {\n                return\n            }\n            print(userId)\n        })\n        \n        openURL = NotificationCenter.default.addObserver(forName: NSNotification.Name.list.openURL, object: nil, queue: OperationQueue.main, using: {[weak self] (noti) in\n            guard let url = noti.object as? URL, let self = self else {\n                return\n            }\n            print(url)\n        })\n    }\n}\n\n// MARK: - <UIScrollViewDelegate>\n\nextension FYMomentsViewController: UIScrollViewDelegate {\n    \n    func scrollViewDidScroll(_ scrollView: UIScrollView) {\n        contentOffsetY = scrollView.contentOffset.y\n        \n        momentNavBar.navBarView.alpha = contentOffsetY / 150\n        momentNavBar.titleLabel.alpha = contentOffsetY / 150\n\n        if contentOffsetY / 150 > 0.6 {\n            momentNavBar.isScrollUp = true\n        } else {\n            momentNavBar.isScrollUp = false\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/JSONData/moments1.json",
    "content": "[\n  {\n    \"id\": 1,\n    \"userInfo\": {\n      \"user_id\": 1,\n      \"background_url\": \"https://img-pre.ivsky.com/img/tupian/pre/202108/08/hushui-004.jpg\",\n      \"avatar_url\": \"http://img2.woyaogexing.com/2022/03/07/ed37ea279a614c299a34c50cd5bbea4a!400x400.jpeg\",\n      \"user_name\": \"Jett2022\"\n    }\n  },\n  {\n    \"id\": 1,\n    \"limage\": \"http://img2.woyaogexing.com/2021/07/30/f0fb4aa3f74b4674868307b56910834a!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/28/58d93adf40b84dcbb8b9979b56a4e6f6!400x400.jpeg\",\n    \"userName\": \"夜风已冷~\",\n    \"location\": \"北京·天安门\",\n    \"publicTime\": \"6小时前\",\n    \"comments\": [\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/28/5fd0ec3fd5a440a79bc77708e7c974b0!400x400.jpeg\",\n        \"comment\": \"万代大\",\n        \"person\": \"欧米茄\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/26/58348c965d544872a09fd13a3adb1055!400x400.jpeg\",\n        \"comment\": \"你在说什么？\",\n        \"person\": \"要死啦\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/03/25/cadfd26a57b9498d813dbb667c0e0467!400x400.jpeg\",\n        \"comment\": \"红哦哦\",\n        \"person\": \"爱的心疼\"\n      }\n    ]\n  },\n  {\n    \"id\": 2,\n    \"limage\": \"\",\n    \"avatar\": \"http://p1.ifengimg.com/fck/2017_46/61dc7cab79bf1e8_w500_h500.jpg\",\n    \"userName\": \"后知后觉\",\n    \"content\": \"对，这话我说过 021-87888822xxa\",\n    \"location\": \"西京·未央宫\",\n    \"publicTime\": \"1小时前\"\n  },\n  {\n    \"id\": 3,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/28/041a8496038c41e89d3a6f3e8f29437b!400x400.jpeg,http://img2.woyaogexing.com/2022/04/28/a5481ff508c44a2282d688b575538a7a!400x400.jpeg,http://img2.woyaogexing.com/2022/04/28/2eab80f3c570464e8cee901aab3f5b04!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/28/8c289846c64c4ee98e17db122e4f07c0!400x400.jpeg\",\n    \"userName\": \"路飞呀\",\n    \"content\": \"伟大的成绩和辛勤劳动是成正比例的，有一分劳动就有一分收获，日积月累，从少到多，奇迹就可以创造出来。http://baidu.com\",\n    \"location\": \"东京·大相国寺\",\n    \"publicTime\": \"6小时前\",\n    \"comments\": [\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/03/25/a2aa4794c7be4acf8cce2ae3379f3f24!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"james\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/03/25/8134faf1a51d4abcb6b4faa97f14c5e1!400x400.jpeg\",\n        \"comment\": \"boston\",\n        \"person\": \"irving\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/28/422f1e900a414686ac4e3e6b5d8b26ae!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"love\"\n      }\n    ]\n  },\n  {\n    \"id\": 4,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/25/6a4dc51ddf364cef888385a2243c9ebf!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/28/dbfa227a12f4443a8ba4ea82aff5be9f!400x400.jpeg\",\n    \"userName\": \"箴言至心\",\n    \"content\": \"哪里有天才，我是把别人喝咖啡的工夫都用在了工作上了。\",\n    \"location\": \"北京·故宫\",\n    \"publicTime\": \"10小时前\"\n  },\n  {\n    \"id\": 5,\n    \"limage\": \"https://img2.woyaogexing.com/2021/08/19/96be8e219e544752af1de5d91b9d0e52!400x400.png,http://img2.woyaogexing.com/2022/04/27/c143c859d17b49edb874be731554a403!400x400.jpeg,http://img2.woyaogexing.com/2022/04/25/fa535ae764ff43eab654633711968401!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/27/9c89a905f5e846ea9e05d2b490808766!400x400.jpeg\",\n    \"userName\": \"友谊的船\",\n    \"content\": \"友谊是两颗心真诚相待，而不是一颗心对另一颗心敲打\",\n    \"location\": \"\",\n    \"publicTime\": \"昨天\",\n    \"comments\": [\n      {\n          \n        \"avatar_url\": \"http://img2.woyaogexing.com/2021/04/26/04ee2aa30c4a48e889288adbb2f0be54!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"james\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2021/04/26/148cbcc87dc6429ab3c43c9984707ae9!400x400.jpeg\",\n        \"comment\": \"boston\",\n        \"person\": \"irving\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2021/07/27/08c15c4a423e4c69bd40ff0650265794!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"love\"\n      }\n    ]\n  },\n  {\n    \"id\": 6,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/26/5a543644c3914b9eae280d2afd936ac5!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/ab179fdf8381437d9b8c26bdebd3d2e7!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/1b1110d87aee44b58b4a389e995654f6!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/8ec9794503304346abd4803dab76389c!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/5db569d16da4497da9ff145687c1a091!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/abde3839d7bc4b1a8df008d26442de27!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/b220efc9b4794a0092f47e01dafba2b5!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/9e9c95954b2242c4a4118006457ac6e5!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/7698cb12589047fb84b9956626d34c05!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/25/817ea967fe1645dd8c9f00efc4b9f6e0!400x400.jpeg\",\n    \"userName\": \"夏日炎炎\",\n    \"content\": \"夏日炎炎，有你才甜呀。\",\n    \"location\": \"深圳·白石洲\",\n    \"publicTime\": \"2天前\"\n  },\n  {\n    \"id\": 7,\n    \"limage\": \"http://i7.qhimg.com/t01dc4b7086db70a49a.jpg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/25/f2f5a9ee19d7496596a7a009a4749f6f!400x400.jpeg\",\n    \"userName\": \"苏东坡\",\n    \"content\": \"明月几时有，老夫想喝酒！！！\",\n    \"location\": \"\",\n    \"publicTime\": \"10小时前\"\n  },\n  {\n    \"id\": 8,\n    \"limage\": \"http://img5.artron.net/auction/2012/art501702/d/art5017020027.jpg,http://www.99zihua.com/images/goods/20130502/4238481536fbdad4.jpg,http://n.sinaimg.cn/history/transform/20171009/bWJ7-fymrcpw5253182.jpg,https://pic.rmb.bdstatic.com/1cbba2fabf1554017b9eed38f65715d3.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/25/f2f5a9ee19d7496596a7a009a4749f6f!400x400.jpeg\",\n    \"userName\": \"苏轼\",\n    \"content\": \"十年生死两茫茫，不思量，自难忘。千里孤坟，无处话凄凉。纵使相逢应不识，尘满面，鬓如霜。\\n夜来幽梦忽还乡，小轩窗，正梳妆。相顾无言，惟有泪千行。料得年年肠断处，明月夜，短松冈。\",\n    \"location\": \"苏州·寒山寺\",\n    \"publicTime\": \"10小时前\"\n  }\n]\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/JSONData/moments2.json",
    "content": "[\n  {\n    \"id\": 1,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/28/a32f8f6c174a4c69af755a14da5ff822!400x400.png\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/28/60e043b181144b5e9134c6f32154412b!400x400.png\",\n    \"userName\": \"萌宠一族\",\n    \"location\": \"北京·大相国寺\",\n    \"publicTime\": \"6小时前\"\n  },\n  {\n    \"id\": 2,\n    \"limage\": \"\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/28/940828f2ebf1492497f1f5ac610f3ed5!400x400.jpeg\",\n    \"userName\": \"爱的每一天\",\n    \"content\": \"对，这话我说过\",\n    \"location\": \"西京·未央宫\",\n    \"publicTime\": \"1小时前\",\n    \"comments\": [\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/25/18db0f9f462644c3843303e5d83aab05!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"james\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/25/d1be4715a1dc4d85b11e471a29c462f4!400x400.jpeg\",\n        \"comment\": \"boston\",\n        \"person\": \"irving\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/25/0afc130b217245da8f8d7bd4a922b8d7!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"love\"\n      }\n    ]\n  },\n  {\n    \"id\": 3,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/29/8479fe903b9a4938b569f6ee08006d08!400x400.jpeg,http://img2.woyaogexing.com/2022/04/28/86196aa1295a4ebf9254274bdb847408!400x400.jpeg,http://img2.woyaogexing.com/2022/04/28/81ea9c2da0f0426cbcb76a74a80fee71!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/25/853289c432004926b7728b435cfc8c66!400x400.jpeg\",\n    \"userName\": \"如果当时\",\n    \"content\": \"跋涉三年的逝水年华，他始终默默地在原地等她回来，他说，在哪儿走失的，我一定会在哪儿一直等到你回来。那一刻她才知道，也许，正是为着他的不完美，她才更爱他。\",\n    \"location\": \"南京·中山陵\",\n    \"publicTime\": \"6小时前\",\n    \"comments\": [\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2021/07/30/2f5ea8a0711840b19abf2f2aefc6b829!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"james\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2021/07/30/8ad7888a3a7c4c3fb4f8ab28506ca495!400x400.jpeg\",\n        \"comment\": \"boston\",\n        \"person\": \"irving\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2021/07/30/55ad05a68b4a42f984342f88479660ed!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"love\"\n      }\n    ]\n  },\n  {\n    \"id\": 4,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/27/e43a084ef60b4dab8190f1e8ec6eadfc!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/421ac909604641339171b88089dd8189!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/d2cdd99e2c374d7ba96223ebbc5fa9b9!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/27/e2327f3995964bf9b857e840d9311def!400x400.jpeg\",\n    \"userName\": \"天道酬勤\",\n    \"content\": \"哪里有天才，我是把别人喝咖啡的工夫都用在了工作上了。\",\n    \"location\": \"北京·故宫\",\n    \"publicTime\": \"10小时前\",\n    \"comments\": [\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/25/2d36d0ff34f94a32b2dc6dd498769f87!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"james\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/25/f73ebd9c1bc74cd3bed24c7f9c576cb2!400x400.jpeg\",\n        \"comment\": \"boston\",\n        \"person\": \"irving\"\n      },\n      {\n        \"avatar_url\": \"http://img2.woyaogexing.com/2022/04/28/0bf4f2c245f948f2bb78d419713fda8f!400x400.jpeg\",\n        \"comment\": \"cav\",\n        \"person\": \"love\"\n      }\n    ]\n  },\n  {\n    \"id\": 5,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/27/a53eb0dc04e34d03b4c278faaa06b13e!400x400.jpeg,http://img2.woyaogexing.com/2022/04/27/a2c236610a074d07932b058a67baf633!400x400.jpeg,http://img2.woyaogexing.com/2022/04/27/d559baeadd19415bbfb3067bcb6c40e8!400x400.jpeg,http://img2.woyaogexing.com/2022/04/27/19fc3585283f4c74b463241bbe120ec9!400x400.jpeg,http://img2.woyaogexing.com/2022/04/25/fa535ae764ff43eab654633711968401!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2021/07/27/c3d34960b12b432497175a792807b78e!400x400.jpeg\",\n    \"userName\": \"明天会更好\",\n    \"content\": \"友谊是两颗心真诚相待，而不是一颗心对另一颗心敲打\",\n    \"location\": \"\",\n    \"publicTime\": \"昨天\"\n  },\n  {\n    \"id\": 6,\n    \"limage\": \"http://img2.woyaogexing.com/2022/04/26/e857e8668e5c41bbaf744b6dabab8e85!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/ab179fdf8381437d9b8c26bdebd3d2e7!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/1b1110d87aee44b58b4a389e995654f6!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/8ec9794503304346abd4803dab76389c!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/5db569d16da4497da9ff145687c1a091!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/abde3839d7bc4b1a8df008d26442de27!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/b220efc9b4794a0092f47e01dafba2b5!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/9e9c95954b2242c4a4118006457ac6e5!400x400.jpeg,http://img2.woyaogexing.com/2022/04/26/7698cb12589047fb84b9956626d34c05!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/25/1cbf8d90bb76446db3adf799670fe764!400x400.jpeg\",\n    \"userName\": \"星辰大海\",\n    \"content\": \"\",\n    \"location\": \"海南·三亚\",\n    \"publicTime\": \"5天前\"\n  },\n  {\n    \"id\": 7,\n    \"limage\": \"http://i7.qhimg.com/t01dc4b7086db70a49a.jpg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/25/f2f5a9ee19d7496596a7a009a4749f6f!400x400.jpeg\",\n    \"userName\": \"苏东坡\",\n    \"content\": \"明月几时有，老夫想喝酒！！！\",\n    \"location\": \"\",\n    \"publicTime\": \"10小时前\"\n  },\n  {\n    \"id\": 8,\n    \"limage\": \"http://img5.artron.net/auction/2012/art501702/d/art5017020027.jpg,http://www.99zihua.com/images/goods/20130502/4238481536fbdad4.jpg,http://n.sinaimg.cn/history/transform/20171009/bWJ7-fymrcpw5253182.jpg,https://pic.rmb.bdstatic.com/1cbba2fabf1554017b9eed38f65715d3.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2022/04/25/6b29fbeb53ea4f86ae2363631f9fd3e1!400x400.jpeg\",\n    \"userName\": \"苏东坡\",\n    \"content\": \"缺月挂疏桐，漏断人初静。时见幽人独往来，缥缈孤鸿影。\\n惊起却回头，有恨无人省。拣尽寒枝不肯栖，寂寞沙洲冷。\",\n    \"location\": \"苏州·姑苏城\",\n    \"publicTime\": \"10小时前\"\n  },\n  {\n    \"id\": 9,\n    \"limage\": \"http://img2.woyaogexing.com/2021/09/03/9fd125d679984528ae7e7aeab532aad2!400x400.jpeg,http://img2.woyaogexing.com/2021/09/03/fff2a9c00d63463181ff172f1220624c!400x400.jpeg,http://img2.woyaogexing.com/2021/09/03/10c7774f252b47f0a1699cb549d55313!400x400.jpeg\",\n    \"avatar\": \"http://img2.woyaogexing.com/2021/09/03/717b15e552284d3e951d2f8ac7e789a7!400x400.jpeg\",\n    \"userName\": \"秋天的海\",\n    \"location\": \"法国·巴黎\",\n    \"publicTime\": \"昨天\"\n  },\n]\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/Model/FYCommentInfo.swift",
    "content": "//\n//  FYFYCommentInfo.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport HandyJSON\n\nclass FYCommentInfo: HandyJSON {\n    \n    var user_id: Int = 0\n    var person: String = \"\"\n    var comment: String = \"\"\n    var avatar_url: String = \"\"\n    \n    required init() { }\n}\n\nextension FYCommentInfo: Equatable {\n    \n    static func == (lhs: FYCommentInfo, rhs: FYCommentInfo) -> Bool {\n        return (lhs.comment == rhs.comment) && (lhs.user_id == rhs.user_id)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/Model/FYMoUserInfo.swift",
    "content": "//\n//  FYMoUserInfo.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport HandyJSON\nimport IGListDiffKit\n\nclass FYMoUserInfo: HandyJSON {\n    \n    /// 用户个人id\n    var user_id: Int = 0\n    /// 顶部背景图片\n    var background_url: String = \"\"\n    /// 用户个人头像\n    var avatar_url: String = \"\"\n    /// 用户个人昵称\n    var user_name: String = \"\"\n    \n    required init() { }\n}\n\nextension FYMoUserInfo: ListDiffable {\n    \n    func diffIdentifier() -> NSObjectProtocol {\n        return user_id as NSObjectProtocol\n    }\n    \n    func isEqual(toDiffableObject object: ListDiffable?) -> Bool {\n        guard self === object else { return true }\n        guard let object = object as? FYMoUserInfo else { return false }\n        return user_id == object.user_id\n    }\n}\n\nextension FYMoUserInfo: Equatable {\n    \n    static func == (lhs: FYMoUserInfo, rhs: FYMoUserInfo) -> Bool {\n        return lhs.isEqual(toDiffableObject: rhs)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/Model/FYMomentInfo.swift",
    "content": "//\n//  FYMomentInfo.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport HandyJSON\nimport IGListDiffKit\n\nclass FYMomentInfo: HandyJSON {\n\n    var id: Int = 0\n    var avatar: String = \"\"\n    var userName: String = \"\"\n    var content: String = \"\"\n    var location: String = \"\"\n    var publicTime: String = \"\"\n    \n    /// 图片组\n    var limage: String = \"\"\n    \n    /// 个人信息\n    var userInfo: FYMoUserInfo?\n    \n    /// 评论数据\n    var comments: [FYCommentInfo] = []\n    \n    /// 文字是否展开\n    var isTextExpend: Bool = false\n    \n    required init() { }\n}\n\nextension FYMomentInfo {\n    \n    /// 图片数组\n    var images: [String] {\n        return limage.split(separator: \",\").map({String($0)})\n    }\n    \n    var cellHeight: CGFloat {\n        var cellHeight: CGFloat = 10 + 20 + 10\n        \n        if !content.isEmpty {\n            let expendH: CGFloat = isNeedExpend ? 30 : 0\n            cellHeight += textHeight + expendH\n        }\n        \n        if images.count > 0 {\n            cellHeight += 10\n            cellHeight += momentPicsHeight(images.count)\n        }\n\n        return cellHeight\n    }\n    \n    /// 文字是否需要展开\n    var isNeedExpend: Bool {\n        let lines = content.textLines(MomentHeaderCell.contentW, font: UIFont.systemFont(ofSize: 17))\n        return lines.count > 3\n    }\n    \n    var textHeight: CGFloat {\n        let lines = content.textLines(MomentHeaderCell.contentW, font: UIFont.systemFont(ofSize: 17))\n        \n        return UIFont.systemFont(ofSize: 17).lineHeight * CGFloat((lines.count > 3 && !isTextExpend ? 3 : lines.count))\n    }\n    \n    func momentPicsHeight(_ picCount: Int) -> CGFloat {\n        let verticalSpace: CGFloat = 5\n        if picCount == 1 {\n            return mImageW * 2 + verticalSpace\n        }\n        if picCount <= 3 {\n            return mImageW + 2 * verticalSpace\n        }\n        if picCount <= 6 {\n            return 2 * mImageW + 3 * verticalSpace\n        }\n        return 3 * mImageW + 4 * verticalSpace\n    }\n    \n    var thumbsHeight: CGFloat {\n        let verticalSpace: CGFloat = 5\n        let rows = comments.count / 7 + (comments.count % 7 > 0 ? 1 : 0)\n        let vertical = CGFloat(rows) * verticalSpace * 2\n        return CGFloat(rows) * CommentThumbView.itemWidth + vertical\n    }\n    \n    var commentHeight: CGFloat {\n        return CGFloat(comments.count * 50)\n    }\n    \n    var contentHeight: CGFloat {\n        return thumbsHeight + commentHeight\n    }\n}\n\nextension FYMomentInfo: ListDiffable {\n    \n    func diffIdentifier() -> NSObjectProtocol {\n        return id as NSObjectProtocol\n    }\n    \n    func isEqual(toDiffableObject object: ListDiffable?) -> Bool {\n        guard self === object else { return true }\n        guard let object = object as? FYMomentInfo else { return false }\n        return id == object.id\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/Sections/FYMomentBindingSection.swift",
    "content": "//\n//  FYFYMomentBindingSection.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport IGListKit\nimport IGListDiffKit\n\nenum ViewModelEnum: String {\n    case top, header, image_single, location, bottom, comment\n}\n\nclass FYMomentBindingSection: ListBindingSectionController<ListDiffable> {\n    var momentInfo: FYMomentInfo!\n    \n    override init() {\n        super.init()\n        dataSource = self\n        selectionDelegate = self\n    }\n    \n    override func didUpdate(to object: Any) {\n        guard let obj = object as? FYMomentInfo else { fatalError() }\n        momentInfo = obj\n        super.didUpdate(to: obj)\n    }\n    \n    // MARK: cell\n    func momentTopCell(at index: Int) -> MomentTopCell {\n        guard let cell = collectionContext?.dequeueReusableCell(of: MomentTopCell.self, for: self, at: index) as? MomentTopCell else { fatalError() }\n        cell.bindViewModel(object!)\n        return cell\n    }\n    \n    func momentHeaderCell(at index: Int) -> MomentHeaderCell {\n        guard let cell = collectionContext?.dequeueReusableCell(of: MomentHeaderCell.self, for: self, at: index) as? MomentHeaderCell else { fatalError() }\n        cell.bindViewModel(object!)\n        cell.onClick = {[weak self] idx in\n            self?.toExpend()\n        }\n        return cell\n    }\n    \n    func momentHeaderImageCell(at index: Int) -> MomentHeaderImageCell {\n        guard let cell = collectionContext?.dequeueReusableCell(of: MomentHeaderImageCell.self, for: self, at: index) as? MomentHeaderImageCell else { fatalError() }\n        cell.bindViewModel(object!)\n        cell.onClick = {[weak self] idx in\n            self?.toExpend()\n        }\n        return cell\n    }\n    \n    func momentLocationCell(at index: Int) -> MomentLocationCell {\n        guard let cell = collectionContext?.dequeueReusableCell(of: MomentLocationCell.self, for: self, at: index) as? MomentLocationCell else { fatalError() }\n        cell.bindViewModel(object!)\n        return cell\n    }\n    \n    func momentBottomCell(at index: Int) -> MomentBottomCell {\n        guard let cell = collectionContext?.dequeueReusableCell(of: MomentBottomCell.self, for: self, at: index) as? MomentBottomCell else { fatalError() }\n        cell.bindViewModel(object!)\n        cell.onClick = {[weak self] action in\n            guard let self = self else { return }\n            switch action {\n            case .thumbup:\n                self.toFavor()\n            case .delete:\n                self.toDelete()\n            case .comment(let text):\n                self.toComment(text)\n            case .commentDraft(let text):\n                self.toSaveDraft(text)\n            }\n        }\n        \n        cell.onRelativeRect = {[unowned self] () -> CGRect in\n            let first = self.cellForItem(at: 0).frame\n            let last = self.cellForItem(at: index).frame\n            let rect = CGRect(x: 0, y: first.minY, width: first.width, height: last.maxY-first.minY)\n            return rect\n        }\n        return cell\n    }\n    \n    func momentCommentCell(at index: Int) -> MomentCommentCell {\n        guard let cell = collectionContext?.dequeueReusableCell(of: MomentCommentCell.self, for: self, at: index) as? MomentCommentCell else { fatalError() }\n        cell.bindViewModel(object!)\n        cell.actionDelegate = self\n        return cell\n    }\n}\n\n\nextension FYMomentBindingSection: ListBindingSectionControllerDataSource, ListBindingSectionControllerSelectionDelegate {\n    \n    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, viewModelsFor object: Any) -> [ListDiffable] {\n        guard let object = object as? FYMomentInfo else { return [] }\n        var results: [ListDiffable] = []\n        if object.userInfo?.background_url != nil {\n            results.append(ViewModelEnum.top.rawValue as ListDiffable)\n        }\n        if object.images.count == 1 {\n            results.append(ViewModelEnum.image_single.rawValue as ListDiffable)\n        }else {\n            results.append(ViewModelEnum.header.rawValue as ListDiffable)\n        }\n        if !object.location.isEmpty {\n            results.append(ViewModelEnum.location.rawValue as ListDiffable)\n        }\n        if object.userInfo == nil {\n            results.append(ViewModelEnum.bottom.rawValue as ListDiffable)\n            results.append(ViewModelEnum.comment.rawValue as ListDiffable)\n        }\n        return results\n    }\n    \n    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, cellForViewModel viewModel: Any, at index: Int) -> UICollectionViewCell & ListBindable {\n        \n        let viewModel = ViewModelEnum(rawValue: viewModel as! String)!\n        switch viewModel {\n        case .top:\n            return momentTopCell(at: index)\n        case .image_single:\n            return momentHeaderImageCell(at: index)\n        case .header:\n            return momentHeaderCell(at: index)\n        case .location:\n            return momentLocationCell(at: index)\n        case .bottom:\n            return momentBottomCell(at: index)\n        case .comment:\n            return momentCommentCell(at: index)\n        }\n    }\n    \n    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, sizeForViewModel viewModel: Any, at index: Int) -> CGSize {\n        guard let object = object as? FYMomentInfo else { fatalError() }\n        let viewModel = ViewModelEnum(rawValue: viewModel as! String)!\n        let width: CGFloat = collectionContext!.containerSize(for: self).width\n        switch viewModel {\n        case .top:\n            return CGSize(width: width, height: 340)\n        case .header, .image_single:\n            return CGSize(width: width, height: object.cellHeight)\n        case .location:\n            return CGSize(width: width, height: 30)\n        case .bottom:\n            return CGSize(width: width, height: 30)\n        case .comment:\n            var height = object.contentHeight\n            height += object.contentHeight > 0 ? 20 : 10\n            return CGSize(width: width, height: height)\n        }\n    }\n    \n    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, didSelectItemAt index: Int, viewModel: Any) {\n        \n    }\n    \n    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, didDeselectItemAt index: Int, viewModel: Any) {\n        \n    }\n    \n    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, didHighlightItemAt index: Int, viewModel: Any) {\n        \n    }\n    \n    func sectionController(_ sectionController: ListBindingSectionController<ListDiffable>, didUnhighlightItemAt index: Int, viewModel: Any) {\n        \n    }\n}\n\nfileprivate extension FYMomentBindingSection {\n    func toExpend() {\n        guard let object = object as? FYMomentInfo else { fatalError() }\n        object.isTextExpend = !object.isTextExpend\n        self.didUpdate(to: object)\n        self.collectionContext?.performBatch(animated: false, updates: { (context) in\n            context.reload(self)\n        }, completion: nil)\n    }\n    func toDelete() {\n        NotificationCenter.default.post(name: NSNotification.Name.list.delete, object: object)\n    }\n    /// 点赞\n    func toFavor() {\n        guard let object = object as? FYMomentInfo else { fatalError() }\n        self.didUpdate(to: object)\n        self.collectionContext?.performBatch(animated: false, updates: { (context) in\n            context.reload(self)\n        }, completion: nil)\n    }\n    /// 评论\n    func toComment(_ text: String) {\n        print(\"comment: \\(text)\")\n        guard let object = object as? FYMomentInfo else { fatalError() }\n        self.didUpdate(to: object)\n        self.collectionContext?.performBatch(animated: false, updates: { (context) in\n            context.reload(self)\n        }, completion: nil)\n    }\n    func toSaveDraft(_ text: String) {\n        print(\"comment draft: \\(text)\")\n    }\n}\n\nextension FYMomentBindingSection: MomentCommentDelegate {\n    \n    func contentDidSelected(_ model: FYCommentInfo, action: CommentContentClickAction) {\n        print(action, model)\n        switch action {\n        case .avatar:\n            print(\"点击头像\")\n        case .title:\n            print(\"点击title\")\n        case .reply:\n            print(\"回复的标题\")\n        case .bg(let isSelf):\n            print(\"点击背景 \\(isSelf)\")\n        case .comment(let text):\n            print(\"评论: \\(text)\")\n            toComment(text)\n        case .commentDraft(let text):\n            print(\"评论草稿: \\(text)\")\n        }\n    }\n    \n    func thumbDidSelected(_ model: FYCommentInfo) {\n        print(model)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/CommentContentCell.swift",
    "content": "//\n//  CommentContentCell.swift\n//  JetChat\n//\n//  Created by Jett on 2020/6/9.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\n\nclass CommentContentCell: UITableViewCell {\n    \n    fileprivate lazy var avatarImageView: UIImageView = {\n        let iv = UIImageView()\n        iv.layer.cornerRadius = 5\n        iv.layer.masksToBounds = true\n        iv.isUserInteractionEnabled = true\n        let tap = UITapGestureRecognizer(target: self, action: #selector(viewClick(_:)))\n        iv.addGestureRecognizer(tap)\n        return iv\n    }()\n    \n    fileprivate lazy var titleBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V1 }, for: .normal)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)\n        btn.contentHorizontalAlignment = .left\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        return btn\n    }()\n    \n    fileprivate lazy var contentLabel: FYLabel = {\n        let lb = FYLabel()\n        lb.font = UIFont.systemFont(ofSize: 14)\n        lb.theme.textColor = themed{ $0.FYColor_Main_TextColor_V3 }\n        lb.numberOfLines = 0\n        return lb\n    }()\n    \n    var comment: FYCommentInfo! {\n        didSet {\n            avatarImageView.setImageWithURL(comment.avatar_url, placeholder: R.image.ic_avatar_placeholder()!)\n            titleBtn.setTitle(comment.person, for: .normal)\n\n            let reply: String? = \"--\"\n            if let parent = reply, !parent.isEmpty {\n                contentLabel.text = \"回复\\(parent)：\\(comment.comment)\"\n            }else {\n                contentLabel.text = comment.comment\n            }\n        }\n    }\n    \n    var onClick: ((CommentContentClickAction)->Void)?\n    var onTextClick: (()->Void)?\n    \n    static func getHeight(_ model: FYCommentInfo) -> CGFloat {\n        let font = UIFont.systemFont(ofSize: 14)\n        let width = kScreenW - 50 - 34 - MomentHeaderCell.padding * 2\n        let height = 50 + model.comment.textSize(width, font: font).height - font.lineHeight\n        return height\n    }\n    \n    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {\n        super.init(style: style, reuseIdentifier: reuseIdentifier)\n        self.selectionStyle = .none\n        self.backgroundColor = .clear\n        \n        addSubview(avatarImageView)\n        addSubview(titleBtn)\n        addSubview(contentLabel)\n        setMultiLabel(contentLabel)\n        \n        avatarImageView.snp.makeConstraints { (make) in\n            make.width.height.equalTo(40)\n            make.leading.equalToSuperview()\n            make.top.equalTo(5)\n        }\n        \n        titleBtn.snp.makeConstraints { (make) in\n            make.leading.equalTo(avatarImageView.snp.trailing).offset(5)\n            make.top.equalTo(avatarImageView)\n            make.height.equalTo(18)\n            make.trailing.lessThanOrEqualToSuperview().offset(-5)\n        }\n        \n        contentLabel.snp.makeConstraints { (make) in\n            make.leading.equalTo(titleBtn)\n            make.trailing.lessThanOrEqualToSuperview().offset(-5)\n            make.top.equalTo(titleBtn.snp.bottom)\n        }\n    }\n    \n    private func setMultiLabel(_ label: FYLabel) {\n        let reply = FYLabelType.custom(pattern: \"回复(.+)：\", start: 2, tender: -1)\n        label.customColor = [reply: .Color_Blue_375793]\n        label.enabledTypes = [.URL, .phone, reply]\n        label.handleNormalTap {[weak self] text in\n            self?.onTextClick?()\n        }\n        label.handleCustomTap(reply) {[weak self] (text) in\n            self?.onClick?(.reply)\n        }\n        label.handleURLTap { (text) in\n            NotificationCenter.default.post(name: NSNotification.Name.list.openURL, object: URL(string: text))\n        }\n        label.handlePhoneTap { (phone) in\n            UIApplication.shared.openURL(URL(string: \"tel://\\(phone)\")!)\n        }\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    @objc private func viewClick(_ ges: UIGestureRecognizer) {\n        onClick?(.avatar)\n    }\n    \n    @objc private func click(_ btn: UIButton) {\n        onClick?(.title)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/CommentContentView.swift",
    "content": "//\n//  CommentContentView.swift\n//  JetChat\n//\n//  Created by Jett on 2020/5/11.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\n\nenum CommentContentClickAction {\n    /// 点击头像\n    case avatar\n    /// 点击title\n    case title\n    /// 回复的标题\n    case reply\n    /// 点击背景 是否是自己的评论\n    case bg(Bool)\n    /// 评论\n    case comment(String)\n    /// 草稿\n    case commentDraft(String)\n}\n\nclass CommentContentView: UITableView {\n    \n    var comments = [FYCommentInfo]() {\n        didSet {\n            reloadData()\n        }\n    }\n    \n    weak var actionDelegate: MomentCommentDelegate?\n    \n    fileprivate lazy var commentnputView: CommentInputView = {\n        let inputView = CommentInputView()\n        inputView.delegate = self\n        return inputView\n    }()\n    \n    fileprivate var selectRow: IndexPath?\n    \n    init(frame: CGRect) {\n        super.init(frame: frame, style: .plain)\n        self.delegate = self\n        self.dataSource = self\n        self.backgroundColor = .clear\n        \n        separatorInset = UIEdgeInsets(top: 0, left: 50, bottom: 0, right: 0)\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError()\n    }\n    \n    func tapContentBg() {\n        guard let indexPath = selectRow else {\n            return\n        }\n        let model = comments[indexPath.item]\n        let isSelf = indexPath.item % 2 == 0\n        if !isSelf {\n            self.commentnputView.textView.placeholder = \"回复\\(model.person)：\"\n            self.commentnputView.show()\n        }\n        actionDelegate?.contentDidSelected(model, action: .bg(isSelf))\n    }\n}\n\nextension CommentContentView: UITableViewDataSource, UITableViewDelegate {\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return comments.count\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = cell(CommentContentCell.self)\n        let model = comments[indexPath.item]\n        cell.comment = model\n        cell.onClick = {[weak self] action in\n            self?.actionDelegate?.contentDidSelected(model, action: action)\n        }\n        cell.onTextClick = {[weak self] in\n            self?.selectRow = indexPath\n            self?.tapContentBg()\n        }\n        return cell\n    }\n    \n    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {\n        let model = comments[indexPath.item]\n        return CommentContentCell.getHeight(model)\n    }\n    \n    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        tableView.deselectRow(at: indexPath, animated: true)\n        selectRow = indexPath\n        tapContentBg()\n    }\n}\n\nextension CommentContentView: CommentInputViewDelegate {\n    \n    func onTopChanged(_ top: CGFloat) {\n        guard let indexPath = selectRow, var rect = self.actionDelegate?.commentRect() else {\n            return\n        }\n        var height: CGFloat = 0\n        for idx in 0...indexPath.item {\n            height += CommentContentCell.getHeight(self.comments[idx])\n        }\n        rect.origin.y += height\n        rect.size.height = 10\n        \n        commentnputView.scrollForComment(rect)\n    }\n    \n    func onTextChanged(_ text: String) {\n        print(\"comment draft: \\(text)\")\n        guard let indexPath = selectRow else {\n            return\n        }\n        let model = comments[indexPath.item]\n        actionDelegate?.contentDidSelected(model, action: .commentDraft(text))\n    }\n    \n    func onSend(_ text: String) {\n        guard let indexPath = selectRow, !text.isEmpty else {\n            return\n        }\n        let model = comments[indexPath.item]\n        actionDelegate?.contentDidSelected(model, action: .comment(text))\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/CommentInputView.swift",
    "content": "//\n//  CommentInputView.swift\n//  JetChat\n//\n//  Created by Jett on 2020/5/12.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\n\nprotocol CommentInputViewDelegate: NSObjectProtocol {\n    /// 容器高度变化通知\n    func onTopChanged(_ top: CGFloat) -> Void\n    /// 输入文本\n    func onTextChanged(_ text: String) -> Void\n    /// 点击发送\n    func onSend(_ text: String) -> Void\n}\n\nclass CommentInputView: UIView {\n    fileprivate(set) lazy var contentView: UIView = {\n        let v = UIView()\n        v.frame = CGRect(x: 0, y: kScreenH, width: kScreenW, height: contentMinHeight)\n        v.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V13 }\n        \n        let layer = CALayer()\n        layer.backgroundColor = UIColor.lightGray.cgColor\n        layer.frame = CGRect(x: 0, y: 0, width: kScreenW, height: 0.5)\n        v.layer.addSublayer(layer)\n        return v\n    }()\n    \n    /// 容器的最小高度\n    fileprivate let contentMinHeight: CGFloat = 50\n    /// 容器最大高度\n    fileprivate let contentMaxHeight: CGFloat = 120\n    /// 容器减去输入框的高度\n    fileprivate let surplusHeight: CGFloat = 15\n    /// // 记录上一次容器高度\n    fileprivate var previousCtHeight: CGFloat = 0\n    /// 记录容器高度\n    fileprivate var ctHeight: CGFloat = 0\n    fileprivate(set) var keyboardHeight: CGFloat = 0\n    /// 容器高度\n    fileprivate(set) var ctTop: CGFloat = 0 {\n        didSet {\n            delegate?.onTopChanged(ctTop)\n        }\n    }\n    weak var delegate: CommentInputViewDelegate?\n    \n    fileprivate(set) lazy var textView: FYTextView = {\n        let v = FYTextView()\n        v.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n        v.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        v.placeholder = \"评论\".rLocalized()\n        v.lineBreak = false\n        v.returnKeyType = .send\n        v.enablesReturnKeyAutomatically = true\n        v.showsVerticalScrollIndicator = false\n        v.showsHorizontalScrollIndicator = false\n        v.layer.cornerRadius = 5\n        v.layer.masksToBounds = true\n        v.font = UIFont.systemFont(ofSize: 16)\n        v.frame = CGRect(x: 15, y: surplusHeight/2, width: kScreenW-30, height: contentMinHeight-surplusHeight)\n        return v\n    }()\n    \n    init() {\n        super.init(frame: UIScreen.main.bounds)\n        setup()\n    }\n    \n    func show() {\n        UIApplication.shared.keyWindow?.addSubview(self)\n        textView.becomeFirstResponder()\n    }\n    \n    func dismiss() {\n        textView.resignFirstResponder()\n        removeFromSuperview()\n    }\n    \n    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {\n        guard let currentPoint = touches.first?.location(in: superview) else {\n            return\n        }\n        if !contentView.frame.contains(currentPoint) {\n            dismiss()\n        }\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    /// 滚动collectionview\n    func scrollForComment(_ rect: CGRect) {\n        if keyboardHeight > 0 {\n            let offset = rect.maxY - ctTop\n            NotificationCenter.default.post(name: NSNotification.Name.list.contentOffset, object: offset)\n        }\n    }\n}\n\n\nfileprivate extension CommentInputView {\n    \n    func setup() {\n        addSubview(contentView)\n        contentView.addSubview(textView)\n        \n        textView.onKeyAction = {[weak self] action in\n            guard let `self` = self else {\n                return\n            }\n            \n            switch action {\n            case .keyboard(let rect, let duration):\n                self.updateTop(rect: rect, duration: duration)\n            case .change(_):\n                self.updateHeight(self.textView.autoHeight)\n                self.delegate?.onTextChanged(self.textView.text)\n            case .done:\n                self.dismiss()\n                self.delegate?.onSend(self.textView.text)\n            default:\n                break\n            }\n        }\n    }\n    \n\n    func updateTop(rect: CGRect, duration: Double) {\n        var keyboardH: CGFloat = 0\n        if rect.origin.y == UIScreen.main.bounds.height {\n            keyboardH = 0\n        } else {\n            keyboardH = rect.size.height\n        }\n        keyboardHeight = keyboardH\n        // 容器的top\n        var top: CGFloat = 0\n        if keyboardH > 0 {\n            top = kScreenH - contentView.frame.height - keyboardHeight\n        } else {\n            top = kScreenH\n        }\n        if ctTop == top { return }\n        ctTop = top\n        \n        UIView.animate(withDuration: duration, animations: {\n            self.contentView.frame.origin.y = top\n        }) { finished in\n            if keyboardH == 0 {\n                self.textView.text = nil\n                self.updateHeight(self.textView.autoHeight)\n                self.removeFromSuperview()\n            }\n        }\n    }\n    \n    func updateHeight(_ height: CGFloat) {\n        var ctHeight = height + surplusHeight\n        if ctHeight < contentMinHeight || textView.text.count == 0 {\n            ctHeight = contentMinHeight\n        }\n        if ctHeight > contentMaxHeight {\n            ctHeight = contentMaxHeight\n        }\n        if ctHeight == previousCtHeight {\n            return\n        }\n        previousCtHeight = ctHeight\n        self.ctHeight = ctHeight\n        ctTop = kScreenH - ctHeight - keyboardHeight\n        \n        UIView.animate(withDuration: 0.25) {\n            self.contentView.frame.size.height = ctHeight\n            self.contentView.frame.origin.y = self.ctTop\n            \n            self.textView.frame.size.height = ctHeight - self.surplusHeight\n            \n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/CommentThumbView.swift",
    "content": "//\n//  CommentThumbView.swift\n//  JetChat\n//\n//  Created by Jett on 2020/5/11.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\n\n/// 点赞头像\nclass CommentThumbView: NineImageView {\n    \n    static let itemWidth: CGFloat = (kScreenW - 30 - 16*2) / 7\n    \n    var onClick: ((Int)->Void)?\n    \n    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        let cell = collectionView.cell(NineImageViewCell.self, indexPath: indexPath)\n        cell.imageView.setImageWithURL(images[indexPath.item])\n        if isRounds {\n            cell.imageView.layer.cornerRadius = 5\n            cell.imageView.layer.masksToBounds = true\n        }\n        return cell\n    }\n    \n    override func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {\n        return CGSize(width: CommentThumbView.itemWidth, height: CommentThumbView.itemWidth)\n    }\n    \n    override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {\n        print(\"点赞头像 \\(indexPath)\")\n        onClick?(indexPath.item)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/MomentBottomCell.swift",
    "content": "//\n//  MomentBottomCell.swift\n//  JetChat\n//\n//  Created by Jett on 2020/4/15.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\nimport IGListDiffKit\n\nenum MomentBottomAction {\n    ///  删除\n    case delete\n    /// 点赞/取消\n    case thumbup\n    /// 评论\n    case comment(String)\n    /// 草稿\n    case commentDraft(String)\n}\n\nclass MomentBottomCell: UICollectionViewCell {\n    \n    fileprivate lazy var timeLb: UILabel = {\n        let lb = UILabel()\n        lb.sizeToFit()\n        lb.theme.textColor = themed{ $0.FYColor_Main_TextColor_V4 }\n        lb.font = UIFont.systemFont(ofSize: 13)\n        return lb\n    }()\n    \n    fileprivate lazy var deleteBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)\n        btn.setTitleColor(.blue, for: .normal)\n        btn.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V12 }, for: .normal)\n        btn.setTitle(\"删除\".rLocalized(), for: .normal)\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        btn.tag = 1\n        return btn\n    }()\n    \n    fileprivate lazy var moreBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.frame = CGRect(x: kScreenW-MomentHeaderCell.padding-30, y: 5, width: 30, height: 20)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 20)\n        btn.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V2 }, for: .normal)\n        btn.setTitle(\"··\", for: .normal)\n        btn.backgroundColor = .groupTableViewBackground\n        btn.layer.cornerRadius = 2\n        btn.layer.masksToBounds = true\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        return btn\n    }()\n    \n    var onClick: ((MomentBottomAction)->Void)?\n    /// section的顶部cell，即头像部分\n    var onRelativeRect: (()->CGRect)?\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        setup()\n    }\n    \n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        setup()\n    }\n    \n    fileprivate lazy var commentnputView: CommentInputView = {\n        let inputView = CommentInputView()\n        inputView.delegate = self\n        return inputView\n    }()\n    \n    var viewModel: FYMomentInfo?\n}\n\nfileprivate extension MomentBottomCell {\n    \n    func setup() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        addSubview(timeLb)\n        addSubview(deleteBtn)\n        addSubview(moreBtn)\n        \n        timeLb.translatesAutoresizingMaskIntoConstraints = false\n        addConstraint(NSLayoutConstraint(item: timeLb, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading, multiplier: 1, constant: MomentHeaderCell.contentLeft))\n        addConstraint(NSLayoutConstraint(item: timeLb, attribute: .centerY, relatedBy: .equal, toItem: moreBtn, attribute: .centerY, multiplier: 1, constant: 0))\n        \n        deleteBtn.translatesAutoresizingMaskIntoConstraints = false\n        addConstraint(NSLayoutConstraint(item: deleteBtn, attribute: .leading, relatedBy: .equal, toItem: timeLb, attribute: .trailing, multiplier: 1, constant: 10))\n        addConstraint(NSLayoutConstraint(item: deleteBtn, attribute: .centerY, relatedBy: .equal, toItem: timeLb, attribute: .centerY, multiplier: 1, constant: 0))\n    }\n    \n    @objc func click(_ btn: UIButton) {\n        switch btn.tag {\n        case 0:\n            // more\n            OperateMenuView.show(self.moreBtn, isLiked: false, canComment: true) {[weak self] idx in\n                guard let `self` = self else { return }\n                if idx == 0 {\n                    self.onClick?(.thumbup)\n                }else {\n                    self.commentnputView.show()\n                }\n            }\n        case 1:\n            // delete\n            self.onClick?(.delete)\n        default:\n            break\n        }\n    }\n}\n\nextension MomentBottomCell: ListBindable {\n    \n    func bindViewModel(_ viewModel: Any) {\n        guard let viewModel = viewModel as? FYMomentInfo else { return }\n        self.viewModel = viewModel\n        timeLb.text = viewModel.publicTime\n        timeLb.sizeToFit()\n        deleteBtn.isHidden = false\n    }\n}\n\nextension MomentBottomCell: CommentInputViewDelegate {\n    func onTopChanged(_ top: CGFloat) {\n        if let onRelativeRect = onRelativeRect {\n            commentnputView.scrollForComment(onRelativeRect())\n        }\n    }\n    \n    func onTextChanged(_ text: String) {\n        print(\"comment draft: \\(text)\")\n        self.onClick?(.commentDraft(text))\n    }\n    \n    func onSend(_ text: String) {\n        if !text.isEmpty {\n            self.onClick?(.comment(text))\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/MomentCommentCell.swift",
    "content": "//\n//  MomentCommentCell.swift\n//  JetChat\n//\n//  Created by Jett on 2020/4/17.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\n\nprotocol MomentCommentDelegate: NSObjectProtocol {\n    func contentDidSelected(_ model: FYCommentInfo, action: CommentContentClickAction)\n    func thumbDidSelected(_ model: FYCommentInfo)\n    /// 只用于commentView获取当前cell的frame\n    func commentRect() -> CGRect\n}\n\nextension MomentCommentDelegate {\n    func commentRect() -> CGRect {\n        return .zero\n    }\n}\n\nclass MomentCommentCell: UICollectionViewCell {\n    \n    fileprivate lazy var containerView: UIView = {\n        let v = UIView()\n        let x = MomentHeaderCell.padding\n        v.frame = CGRect(x: x, y: 10, width: bounds.width-x*2, height: 0)\n        v.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V1 }\n        v.layer.cornerRadius = 5\n        v.layer.masksToBounds = true\n        return v\n    }()\n    \n    fileprivate lazy var thumbView: NineImageView = {\n        let view = CommentThumbView(frame: .zero)\n        view.onClick = {[weak self] idx in\n            if let model = self?.viewModel?.comments[idx] {\n                self?.thumbDidSelected(model)\n            }\n        }\n        return view\n    }()\n    \n    fileprivate lazy var thumbIcon: UIImageView = {\n        let iv = UIImageView(image: R.image.ic_star_selected())\n        iv.frame = CGRect(x: 10, y: 10, width: 14, height: 12)\n        return iv\n    }()\n    \n    fileprivate lazy var commentIcon: UIImageView = {\n        let iv = UIImageView(image: R.image.ic_comment_selected())\n        iv.frame = CGRect(x: 10, y: 10, width: 14, height: 12)\n        return iv\n    }()\n    \n    fileprivate lazy var commentView: CommentContentView = {\n        let view = CommentContentView(frame: .zero)\n        view.actionDelegate = self\n        return view\n    }()\n    \n    fileprivate lazy var divisionV: UIView = {\n        let v = UIView()\n        v.frame = CGRect(x: 0, y: 0, width: containerView.bounds.width, height: 0.65)\n        v.theme.backgroundColor = themed { $0.FYColor_BorderColor_V2 }\n        return v\n    }()\n    \n    fileprivate lazy var separatorV: UIView = {\n        let v = UIView(frame: bounds)\n        v.theme.backgroundColor = themed { $0.FYColor_BorderColor_V1 }\n        return v\n    }()\n    \n    weak var actionDelegate: MomentCommentDelegate?\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        setup()\n    }\n\n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        setup()\n    }\n    \n    func setup() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        addSubview(containerView)\n        containerView.addSubview(thumbIcon)\n        containerView.addSubview(thumbView)\n        \n        containerView.addSubview(divisionV)\n        containerView.addSubview(commentIcon)\n        containerView.addSubview(commentView)\n        \n        addSubview(separatorV)\n        \n        // 离屏渲染 + 栅格化\n        layer.drawsAsynchronously = true\n        layer.shouldRasterize = true\n        layer.rasterizationScale = UIScreen.main.scale\n    }\n    \n    var viewModel: FYMomentInfo?\n}\n\nextension MomentCommentCell: ListBindable {\n    \n    func bindViewModel(_ viewModel: Any) {\n        guard let viewModel = viewModel as? FYMomentInfo else { return }\n        self.viewModel = viewModel\n        containerView.frame.size.height = viewModel.contentHeight\n        \n        let minX = thumbIcon.frame.maxX + thumbIcon.frame.minX\n        thumbView.frame = CGRect(x: minX, y: 5, width: containerView.bounds.width-minX, height: viewModel.thumbsHeight-10)\n        thumbView.isRounds = true\n        thumbView.images = viewModel.comments.map({$0.avatar_url})\n        \n        divisionV.frame.origin.y = thumbView.frame.maxY+5-divisionV.frame.height\n        divisionV.isHidden = viewModel.comments.count == 0\n        \n        if viewModel.comments.count == 0 {\n            thumbIcon.frame.size.height = 0\n            divisionV.frame.origin.y = 0\n        }\n        \n        commentIcon.frame.origin.y = thumbIcon.frame.minY + divisionV.frame.maxY\n        commentView.frame = CGRect(x: minX, y: divisionV.frame.maxY, width: thumbView.bounds.width, height: viewModel.commentHeight)\n        commentView.comments = viewModel.comments\n        \n        separatorV.frame = CGRect(x: 0, y: bounds.height-1, width: bounds.width, height: 1)\n    }\n}\n\nextension MomentCommentCell: MomentCommentDelegate {\n    \n    func contentDidSelected(_ model: FYCommentInfo, action: CommentContentClickAction) {\n        actionDelegate?.contentDidSelected(model, action: action)\n    }\n    \n    func thumbDidSelected(_ model: FYCommentInfo) {\n        actionDelegate?.thumbDidSelected(model)\n    }\n    \n    func commentRect() -> CGRect {\n        var rect = frame\n        rect.origin.y += commentView.frame.minY\n        return rect\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/MomentHeaderCell.swift",
    "content": "//\n//  MomentHeaderCell.swift\n//  JetChat\n//\n//  Created by Jett on 2022/4/14.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Kingfisher\nimport YBImageBrowser\nimport UIKit\n\n/// 多张图片显示\nclass MomentHeaderCell: UICollectionViewCell {\n    \n    var onClick: ((Int)->Void)?\n    \n    static let padding: CGFloat = 16\n    static let contentLeft = padding+10+50\n    static let contentW = kScreenW-padding-contentLeft\n    \n    fileprivate lazy var avatarImageView: UIImageView = {\n        let iv = UIImageView()\n        iv.frame = CGRect(x: MomentHeaderCell.padding, y: 10, width: 50, height: 50)\n        iv.layer.cornerRadius = 10\n        iv.layer.masksToBounds = true\n        iv.isUserInteractionEnabled = true\n        let tap = UITapGestureRecognizer(target: self, action: #selector(previewImage(_:)))\n        iv.addGestureRecognizer(tap)\n        return iv\n    }()\n    \n    fileprivate lazy var usernameLb: UILabel = {\n        let lb = UILabel()\n        lb.frame = CGRect(x: avatarImageView.frame.maxX+10, y: avatarImageView.frame.minY+2, width: MomentHeaderCell.contentW, height: 20)\n        lb.theme.textColor = themed { $0.FYColor_Main_TextColor_V2 }\n        lb.font = UIFont.boldSystemFont(ofSize: 17)\n        return lb\n    }()\n    \n    fileprivate lazy var contentLb: FYLabel = {\n        let lb = FYLabel()\n        lb.frame = CGRect(x: usernameLb.frame.minX, y: usernameLb.frame.maxY+5, width: MomentHeaderCell.contentW, height: 0)\n        lb.font = UIFont.systemFont(ofSize: 17)\n        lb.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        lb.numberOfLines = 0\n        lb.showFavor = {[weak self] in\n            guard let self = self else { return }\n        }\n        return lb\n    }()\n    \n    fileprivate lazy var expendBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.setTitle(\"展开\".rLocalized(), for: .normal)\n        btn.setTitle(\"收起\".rLocalized(), for: .selected)\n        btn.setTitleColor(.Color_Blue_1890FF, for: .normal)\n        btn.setTitleColor(.Color_Blue_1890FF, for: .selected)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        btn.sizeToFit()\n        btn.isHidden = true\n        return btn\n    }()\n    \n    fileprivate lazy var nineImageView: NineImageView = {\n        let view = NineImageView(frame: .zero)\n        view.frame = contentLb.frame\n        view.frame.size.width -= 50\n        view.onPreviewImages = { [weak self] images, indexPath, sourceView in\n            self?.browserImages(images, index: indexPath.item, sourceView: sourceView)\n        }\n        return view\n    }()\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        setup()\n    }\n\n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        setup()\n    }\n    \n    var viewModel: FYMomentInfo?\n    \n    \n    func browserImages(_ images: [String], index: Int, sourceView: UIView? = nil) {\n        guard images.count > 0 else { return }\n        \n        var imageDatas: [YBIBImageData] = []\n        for imageUrl in images {\n            let data = YBIBImageData()\n            data.imageURL = URL(string: imageUrl)\n            imageDatas.append(data)\n        }\n        \n        let browser = YBImageBrowser()\n        browser.dataSourceArray = imageDatas\n        browser.currentPage = index\n        browser.show()\n    }\n}\n\nextension MomentHeaderCell {\n    \n    func setup() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        addSubview(avatarImageView)\n        addSubview(usernameLb)\n        addSubview(contentLb)\n        addSubview(expendBtn)\n        addSubview(nineImageView)\n        setupLabel()\n    }\n    \n    func setupLabel() {\n        contentLb.enabledTypes = [.URL, .phone]\n        contentLb.handleURLTap { (text) in\n            NotificationCenter.default.post(name: NSNotification.Name.list.openURL, object: URL(string: text))\n        }\n        \n        contentLb.handlePhoneTap { (phone) in\n            if let url = NSURL(string: \"tel://\\(phone)\") as? URL {\n                UIApplication.shared.open(url, options: [:], completionHandler: nil)\n            }\n        }\n    }\n    \n    @objc func previewImage(_ ges: UIGestureRecognizer) {\n        switch ges.view?.tag {\n        case 0:\n            NotificationCenter.default.post(name: NSNotification.Name.list.push, object: viewModel?.userInfo)\n        default:\n            break\n        }\n    }\n    \n    @objc func click(_ btn: UIButton) {\n        onClick?(btn.tag)\n    }\n}\n\nextension MomentHeaderCell: ListBindable {\n    \n    func bindViewModel(_ viewModel: Any) {\n        guard let viewModel = viewModel as? FYMomentInfo else { return }\n        self.viewModel = viewModel\n\n        if (viewModel.avatar.length > 0) {\n            avatarImageView.setImageWithURL(viewModel.avatar, placeholder: R.image.ic_avatar_placeholder()!)\n        }\n        \n        if (viewModel.userName.length > 0) {\n            usernameLb.text = viewModel.userName\n        }\n        \n        if (viewModel.content.length > 0) {\n            contentLb.text = viewModel.content\n        }\n        \n        contentLb.frame.size.height = viewModel.textHeight\n        \n        if viewModel.isNeedExpend {\n            expendBtn.isSelected = viewModel.isTextExpend\n            contentLb.numberOfLines = viewModel.isTextExpend ? 0 : 3\n            expendBtn.frame.origin = CGPoint(x: contentLb.frame.minX, y: contentLb.frame.maxY)\n        }\n        \n        expendBtn.isHidden = !viewModel.isNeedExpend\n        \n        // 不能通过if判断切换同一位置的显示视图\n        if viewModel.images.count > 0 {\n            let maxY = contentLb.frame.maxY + 10 + (!expendBtn.isHidden ? expendBtn.frame.height : 0)\n            nineImageView.images = viewModel.images\n            nineImageView.frame.origin.y = maxY\n            nineImageView.frame.size.height = viewModel.momentPicsHeight(viewModel.images.count)\n        }else {\n            nineImageView.frame.size.height = 0\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/MomentHeaderImageCell.swift",
    "content": "//\n//  MomentHeaderImageCell.swift\n//  JetChat\n//\n//  Created by Jett on 2022/4/16.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Kingfisher\nimport YBImageBrowser\n\n/// 单张图片显示\nclass MomentHeaderImageCell: UICollectionViewCell {\n    \n    static let padding: CGFloat = 16\n    static let contentLeft = padding + 60\n    static let contentW = kScreenW-padding-contentLeft\n    \n    var onClick: ((Int)->Void)?\n    \n    fileprivate lazy var avatarImageView: UIImageView = {\n        let iv = UIImageView()\n        iv.frame = CGRect(x: MomentHeaderCell.padding, y: 10, width: 50, height: 50)\n        iv.layer.cornerRadius = 10\n        iv.layer.masksToBounds = true\n        iv.isUserInteractionEnabled = true\n        let tap = UITapGestureRecognizer(target: self, action: #selector(previewImage(_:)))\n        iv.addGestureRecognizer(tap)\n        return iv\n    }()\n    \n    fileprivate lazy var usernameLb: UILabel = {\n        let lb = UILabel()\n        lb.frame = CGRect(x: avatarImageView.frame.maxX+10, y: avatarImageView.frame.minY+2, width: MomentHeaderCell.contentW, height: 20)\n        lb.theme.textColor = themed{ $0.FYColor_Main_TextColor_V2 }\n        lb.font = UIFont.boldSystemFont(ofSize: 17)\n        return lb\n    }()\n    \n    fileprivate lazy var contentLb: FYLabel = {\n        let lb = FYLabel()\n        lb.frame = CGRect(x: usernameLb.frame.minX, y: usernameLb.frame.maxY+5, width: MomentHeaderCell.contentW, height: 0)\n        lb.font = UIFont.systemFont(ofSize: 17)\n        lb.theme.textColor = themed{ $0.FYColor_Main_TextColor_V1 }\n        lb.numberOfLines = 0\n        lb.showFavor = {[weak self] in\n            guard let self = self else { return }\n        }\n        return lb\n    }()\n    \n    /// 单张图片\n    fileprivate lazy var singleImageView: UIImageView = {\n        let iv = UIImageView()\n        iv.frame = contentLb.frame\n        iv.clipsToBounds = true\n        iv.autoresizesSubviews = true\n        iv.clearsContextBeforeDrawing = true\n        iv.isUserInteractionEnabled = true\n        let tap = UITapGestureRecognizer(target: self, action: #selector(previewImage(_:)))\n        iv.addGestureRecognizer(tap)\n        iv.tag = 10\n        return iv\n    }()\n    \n    fileprivate lazy var expendBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.setTitle(\"展开\", for: .normal)\n        btn.setTitle(\"收起\", for: .selected)\n        btn.setTitleColor(.Color_Blue_1890FF, for: .normal)\n        btn.setTitleColor(.Color_Blue_1890FF, for: .selected)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        btn.sizeToFit()\n        btn.isHidden = true\n        return btn\n    }()\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        setup()\n    }\n    \n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        setup()\n    }\n    \n    var viewModel: FYMomentInfo?\n}\n\nextension MomentHeaderImageCell {\n    \n    func setup() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        addSubview(avatarImageView)\n        addSubview(usernameLb)\n        addSubview(contentLb)\n        addSubview(singleImageView)\n        addSubview(expendBtn)\n        \n        setLabel()\n    }\n    \n    func setLabel() {\n        contentLb.enabledTypes = [.URL, .phone]\n        contentLb.handleURLTap { (text) in\n            NotificationCenter.default.post(name: NSNotification.Name.list.openURL, object: URL(string: text))\n        }\n        contentLb.handlePhoneTap { (phone) in\n            UIApplication.shared.openURL(URL(string: \"tel://\\(phone)\")!)\n        }\n    }\n    \n    @objc func previewImage(_ ges: UIGestureRecognizer) {\n        switch ges.view?.tag {\n        case 0:\n            NotificationCenter.default.post(name: NSNotification.Name.list.push, object: viewModel?.userInfo)\n        case 10:\n            print(\"预览图片\")\n            if let images = self.viewModel?.images {\n                singleBrowserImages(images, index: 0, sourceView: singleImageView)\n            }\n        default:\n            break\n        }\n    }\n    \n    @objc func click(_ btn: UIButton) {\n        onClick?(btn.tag)\n    }\n    \n    func singleBrowserImages(_ images: [String], index: Int, sourceView: UIView?) {\n        guard images.count > 0 else { return }\n        guard let projectiveView = sourceView else { return }\n        \n        var imageDatas: [YBIBImageData] = []\n        for imageUrl in images {\n            let data = YBIBImageData()\n            data.imageURL = URL(string: imageUrl)\n            data.projectiveView = projectiveView\n            imageDatas.append(data)\n        }\n        \n        let browser = YBImageBrowser()\n        browser.dataSourceArray = imageDatas\n        browser.currentPage = index\n        browser.show()\n    }\n}\n\nextension MomentHeaderImageCell: ListBindable {\n    \n    func bindViewModel(_ viewModel: Any) {\n        guard let viewModel = viewModel as? FYMomentInfo else { return }\n        self.viewModel = viewModel\n        \n        avatarImageView.setImageWithURL(viewModel.avatar, placeholder: R.image.ic_avatar_placeholder()!)\n        \n        usernameLb.text = viewModel.userName\n        \n        contentLb.text = viewModel.content\n        contentLb.frame.size.height = viewModel.textHeight\n        \n        if viewModel.isNeedExpend {\n            expendBtn.isSelected = viewModel.isTextExpend\n            contentLb.numberOfLines = viewModel.isTextExpend ? 0 : 3\n            expendBtn.frame.origin = CGPoint(x: contentLb.frame.minX, y: contentLb.frame.maxY)\n        }\n        expendBtn.isHidden = !viewModel.isNeedExpend\n        \n        if viewModel.images.count > 0 {\n            let maxY = contentLb.frame.maxY + 10 + (!expendBtn.isHidden ? expendBtn.frame.height : 0)\n            singleImageView.setImageWithURL(viewModel.images[0], placeholder:R.image.ic_placeholder()!)\n            \n            singleImageView.frame.origin.y = maxY\n            singleImageView.frame.size.height = viewModel.momentPicsHeight(viewModel.images.count)\n            singleImageView.frame.size.width = singleImageView.frame.size.height\n        }else {\n            singleImageView.frame.size.height = 0\n        }\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/MomentLocationCell.swift",
    "content": "//\n//  MomentLocationCell.swift\n//  JetChat\n//\n//  Created by Jett on 2020/4/15.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\n\nclass MomentLocationCell: UICollectionViewCell {\n    \n    var viewModel: FYMomentInfo?\n    \n    fileprivate lazy var locationBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.frame.origin = CGPoint(x: MomentHeaderCell.contentLeft, y: 0)\n        btn.theme.titleColor(from: themed { $0.FYColor_Main_TextColor_V4 }, for: .normal)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)\n        btn.sizeToFit()\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        return btn\n    }()\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        makeUI()\n    }\n    \n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        makeUI()\n    }\n    \n    func makeUI() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        addSubview(locationBtn)\n    }\n    \n    @objc func click(_ btn: UIButton) {\n        NotificationCenter.default.post(name: NSNotification.Name.list.location, object: viewModel)\n    }\n}\n\nextension MomentLocationCell: ListBindable {\n    \n    func bindViewModel(_ viewModel: Any) {\n        guard let viewModel = viewModel as? FYMomentInfo else { return }\n        self.viewModel = viewModel\n        locationBtn.setTitle(viewModel.location, for: .normal)\n        locationBtn.sizeToFit()\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/Cell/MomentTopCell.swift",
    "content": "//\n//  MomentTopCell.swift\n//  JetChat\n//\n//  Created by Jett on 2022/4/16.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Foundation\n\nprivate let topOffset: CGFloat = 60\nprivate let bottomIndent: CGFloat = 40\nprivate let avatorW: CGFloat = 80\nprivate let space: CGFloat = 20\n\n/// 顶部视图\nclass MomentTopCell: UICollectionViewCell {\n    \n    fileprivate lazy var bgImageView: UIImageView = {\n        let iv = UIImageView()\n        iv.frame = CGRect(x: 0, y: 0, width: kScreenW, height: bounds.size.height - bottomIndent)\n        iv.contentMode = .scaleAspectFill\n        return iv\n    }()\n    \n    fileprivate lazy var avatarImageView: UIImageView = {\n        let iv = UIImageView()\n        iv.frame =  CGRect(x: kScreenW - avatorW - 16, y: bgImageView.frame.maxY, width: avatorW, height: avatorW)\n        iv.layer.cornerRadius = 10\n        iv.layer.masksToBounds = true\n        return iv\n    }()\n    \n    fileprivate lazy var userNameLabel: UILabel = {\n        let lb = UILabel()\n        lb.frame = CGRect(x: 0, y: avatarImageView.frame.minY + space, width: avatarImageView.frame.minX - space, height: 30)\n        lb.textAlignment = .right\n        lb.theme.textColor = themed { $0.FYColor_Placeholder_Color_V3 }\n        lb.font = .PingFangSemibold(18)\n        return lb\n    }()\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        setup()\n    }\n    \n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        setup()\n    }\n    \n    func setup() {\n        theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V5 }\n        \n        addSubview(bgImageView)\n        addSubview(avatarImageView)\n        addSubview(userNameLabel)\n        \n        bgImageView.frame.origin.y -= topOffset\n        avatarImageView.frame.origin.y -= topOffset\n        userNameLabel.frame.origin.y -= topOffset\n        bgImageView.frame.size.height += topOffset\n    }\n}\n\nextension MomentTopCell: ListBindable {\n    \n    func bindViewModel(_ viewModel: Any) {\n        guard let viewModel = viewModel as? FYMomentInfo, let info = viewModel.userInfo else {\n            return\n        }\n        \n        bgImageView.setImageWithURL(info.background_url, placeholder: R.image.ic_placeholder()!)\n        avatarImageView.setImageWithURL(info.avatar_url , placeholder: R.image.ic_avatar_placeholder()!)\n        userNameLabel.text = info.user_name\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/FYMomentNavBar.swift",
    "content": "//\n//  FYMomentNavBar.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass FYMomentNavBar: UIView {\n    \n    var onClick: ((Int)->Void)?\n    \n    lazy var navBarView: UIView = {\n        let v = UIView(frame: bounds)\n        v.backgroundColor = UIColor(red: 239, green: 239, blue: 239, alpha: 1.0)\n        v.alpha = 0\n        return v\n    }()\n    \n    lazy var titleLabel: UILabel = {\n        let label = UILabel()\n        label.text = \"朋友圈\".rLocalized()\n        label.alpha = 0\n        label.font = UIFont.boldSystemFont(ofSize: 17)\n        label.textAlignment = .center\n        return label\n    }()\n    \n    lazy var backBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.setImage(UIImage(named: \"nav_back_white\"), for: .normal)\n        btn.addTarget(self, action: #selector(clickAction(_:)), for: .touchUpInside)\n        btn.tag = 100;\n        return btn\n    }()\n    \n    lazy var camareBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.setImage(UIImage(named: \"nav_camera_white\"), for: .normal)\n        btn.addTarget(self, action: #selector(clickAction(_:)), for: .touchUpInside)\n        btn.tag = 200\n        return btn\n    }()\n    \n    var isScrollUp: Bool = false {\n        didSet {\n            let backImage = isScrollUp ? \"nav_back_black\" : \"nav_back_white\"\n            let cameraImage = isScrollUp ? \"nav_camera_black\" : \"nav_camera_white\"\n            \n            backBtn.setImage(UIImage(named: backImage), for: .normal)\n            camareBtn.setImage(UIImage(named: cameraImage), for: .normal)\n        }\n    }\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        \n        makeUI()\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n}\n\n\nfileprivate extension FYMomentNavBar {\n    \n    func makeUI() {\n        addSubview(navBarView)\n        addSubview(titleLabel)\n        addSubview(backBtn)\n        addSubview(camareBtn)\n        \n        navBarView.snp.makeConstraints { make in\n            make.edges.equalTo(self)\n        }\n        \n        titleLabel.snp.makeConstraints { make in\n            make.top.equalTo(self).offset(44)\n            make.centerX.equalTo(self);\n        }\n        \n        backBtn.snp.makeConstraints { make in\n            make.left.equalTo(self).offset(20)\n            make.top.equalTo(self).offset(44)\n            make.width.height.equalTo(30)\n        }\n        \n        camareBtn.snp.makeConstraints { make in\n            make.right.equalTo(self).offset(-20)\n            make.top.equalTo(self.backBtn)\n            make.width.height.equalTo(30)\n        }\n    }\n    \n    @objc func clickAction(_ btn: UIButton) {\n        onClick?(btn.tag)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/MomentLabel/FYLabel.swift",
    "content": "//\n//  FYLabel.swift\n//\n//  Created by Jett on 2022/04/28.\n//  Copyright 2022 Jett. All rights reserved.\n//\n\nimport UIKit\n\ntypealias ElementTuple = (range: NSRange, element: FYElements, type: FYLabelType)\n\nopen class FYLabel: UILabel {\n    \n    override public init(frame: CGRect) {\n        super.init(frame: frame)\n        setupLabel()\n    }\n    \n    required public init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        setupLabel()\n    }\n    open override func awakeFromNib() {\n        super.awakeFromNib()\n        updateTextStorage()\n    }\n    // MARK: 公用 属性\n    open var enabledTypes: [FYLabelType] = [.URL, .phone, .hashtag, .mention]\n    \n    open var hashtagColor : UIColor = .blue{\n        didSet {updateTextStorage(updateString: false)}\n    }\n    open var hashtagSelectColor : UIColor = UIColor.blue.withAlphaComponent(0.5) {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    \n    open var mentionColor : UIColor = .blue{\n        didSet {updateTextStorage(updateString: false)}\n    }\n    open var mentionSelectColor : UIColor = UIColor.blue.withAlphaComponent(0.5){\n        didSet {updateTextStorage(updateString: false)}\n    }\n    \n    open var URLColor : UIColor = .blue{\n        didSet {updateTextStorage(updateString: false)}\n    }\n    open var URLSelectColor : UIColor = UIColor.blue.withAlphaComponent(0.5){\n        didSet {updateTextStorage(updateString: false)}\n    }\n    \n    open var customColor : [FYLabelType : UIColor] = [:] {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    open var customSelectColor : [FYLabelType : UIColor] = [:] {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    \n    // MARK: 重写\n    override open var text: String? {\n        didSet {updateTextStorage()}\n    }\n    override open var attributedText: NSAttributedString?{\n        didSet {updateTextStorage()}\n    }\n    override open var font: UIFont! {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    override open var textColor: UIColor! {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    override open var textAlignment: NSTextAlignment {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    open override var numberOfLines: Int {\n        didSet { textContainer.maximumNumberOfLines = numberOfLines }\n    }\n    /// 行间距\n    open var lineSpacing : CGFloat = 0 {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    /// 段间距\n    open var paragraphSpacing : CGFloat = 0 {\n        didSet {updateTextStorage(updateString: false)}\n    }\n    \n    // MARK: 私有属性\n    /*\n     NSTextStorage保存并管理UITextView要展示的文字内容，该类是NSMutableAttributedString的子类，由于可以灵活地往文字添加或修改属性，所以非常适用于保存并修改文字属性。\n     NSLayoutManager用于管理NSTextStorage其中的文字内容的排版布局。\n     NSTextContainer则定义了一个矩形区域用于存放已经进行了排版并设置好属性的文字。\n     以上三者是相互包含相互作用的层次关系。\n     NSTextStorage -> NSLayoutManager -> NSTextContainer\n     */\n    fileprivate var textStorage : NSTextStorage =  NSTextStorage()\n    fileprivate var layoutManager : NSLayoutManager =  NSLayoutManager()\n    fileprivate var textContainer : NSTextContainer =  NSTextContainer()\n    \n    fileprivate lazy var elementDict = [FYLabelType: [ElementTuple]]()\n    fileprivate var selectedElementTuple : ElementTuple?\n    \n    public typealias LabelCallBack = (String) -> ()\n    fileprivate var hashNormalHandler: LabelCallBack?\n    fileprivate var hashtagTapHandler: LabelCallBack?\n    fileprivate var mentionTapHandler: LabelCallBack?\n    fileprivate var urlTapHandler: LabelCallBack?\n    fileprivate var phoneTapHandler: LabelCallBack?\n    fileprivate var customHandler: [FYLabelType : LabelCallBack] = [:]\n    \n    // MARK: 公用 方法\n    /// 文本点击事件 （响应除`enabledTypes`属性设置外的点击事件\n    open func handleNormalTap(_ handler: @escaping LabelCallBack) {\n        hashNormalHandler = handler\n    }\n    /// 标签点击事件\n    open func handleHashtagTap(_ handler: @escaping LabelCallBack) {\n        hashtagTapHandler = handler\n    }\n    /// 提醒点击事件\n    open func handleMentionTap(_ handler: @escaping LabelCallBack) {\n        mentionTapHandler = handler\n    }\n    /// URL 点击事件\n    open func handleURLTap(_ handler: @escaping LabelCallBack) {\n        urlTapHandler = handler\n    }\n    /// URL 点击事件\n    open func handlePhoneTap(_ handler: @escaping LabelCallBack) {\n        phoneTapHandler = handler\n    }\n    /// 自定义 点击事件\n    open func handleCustomTap(_ type: FYLabelType, handler: @escaping LabelCallBack) {\n        customHandler[type] = handler\n    }\n    \n    fileprivate var drawBeginY : CGFloat = 0\n    override open func drawText(in rect: CGRect) {\n        let range = NSRange(location: 0, length: textStorage.length)\n        textContainer.size = rect.size\n        let newRect = layoutManager.usedRect(for: textContainer)\n        drawBeginY = (rect.size.height - newRect.size.height) / 2\n        let newOrigin = CGPoint(x: rect.origin.x, y: drawBeginY)\n        \n        layoutManager.drawGlyphs(forGlyphRange: range, at: newOrigin)\n    }\n    \n    override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {\n        guard let touch = touches.first else {return}\n        onTouch(touch)\n    }\n    \n    override open func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {\n        guard let touch = touches.first else {return}\n        onTouch(touch)\n    }\n    \n    override open func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {\n        guard let touch = touches.first else {return}\n        onTouch(touch)\n    }\n    open override var canBecomeFirstResponder: Bool { return true }\n    \n    open override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {\n        return performAction(action, sender: sender)\n    }\n    /// 是否允许长按复制\n    var enableLongPress: Bool? {\n        didSet {\n            isUserInteractionEnabled = enableLongPress ?? false\n            if oldValue != nil && enableLongPress != true {\n                removeGestureRecognizer(longPress)\n            } else if oldValue == nil && enableLongPress == true {\n                addGestureRecognizer(longPress)\n            }\n        }\n    }\n    \n    fileprivate lazy var longPress: UILongPressGestureRecognizer = {\n        return UILongPressGestureRecognizer(target: self, action: #selector(longPressAction(_:)))\n    }()\n}\n// MARK: - init\nfileprivate extension FYLabel {\n    func setupLabel()  {\n        numberOfLines = 1\n        textStorage.addLayoutManager(layoutManager)\n        layoutManager.addTextContainer(textContainer)\n        textContainer.maximumNumberOfLines = numberOfLines\n        textContainer.lineFragmentPadding = 0\n        textContainer.lineBreakMode = .byWordWrapping\n        isUserInteractionEnabled = true\n        enableLongPress = true\n    }\n    func updateTextStorage(updateString: Bool = true) {\n        guard let attributedText = attributedText else {return}\n        \n        let mutAttrString = addOrdinarilyAttributes(attributedText)\n        if updateString {\n            clearElementTupleDict()\n            getElementTupleDict(mutAttrString)\n        }\n        \n        addPatternAttributes(mutAttrString)\n        textStorage.setAttributedString(mutAttrString)\n        \n        setNeedsDisplay()\n    }\n    func clearElementTupleDict() {\n        for (type, _) in elementDict {\n            elementDict[type]?.removeAll()\n        }\n    }\n    /// 核心方法,配置elementDict\n    func getElementTupleDict(_ mutAttrString : NSMutableAttributedString) {\n        \n        let textString = mutAttrString.string\n        let range = NSRange(location: 0, length: textString.count)\n        \n        for type in enabledTypes {\n            elementDict[type] = creatElementTupleArr(type: type, from: textString, range: range)\n        }\n    }\n    // 给所有字符串添加文字属性\n    func addOrdinarilyAttributes(_ attrString : NSAttributedString) -> NSMutableAttributedString {\n        \n        let mutAttrString = NSMutableAttributedString(attributedString: attrString)\n        \n        if mutAttrString.string.count == 0 {\n            return mutAttrString\n        }\n        \n        var range = NSRange(location: 0, length: 0)\n        //给指定索引的字符返回属性\n        var attributes = mutAttrString.attributes(at: 0, effectiveRange: &range)\n        attributes[NSAttributedString.Key.font] = font\n        attributes[NSAttributedString.Key.foregroundColor] = textColor\n        \n        let paragraphStyle = attributes[NSAttributedString.Key.paragraphStyle] as? NSMutableParagraphStyle ?? NSMutableParagraphStyle()\n        paragraphStyle.lineBreakMode = NSLineBreakMode.byWordWrapping\n        paragraphStyle.alignment = textAlignment\n        paragraphStyle.lineSpacing = lineSpacing\n        paragraphStyle.paragraphSpacing = paragraphSpacing\n        \n        attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle\n        mutAttrString.setAttributes(attributes, range: range)\n        \n        return mutAttrString\n    }\n    /// 给目标字符串添加文字属性\n    func addPatternAttributes(_ mutAttrString : NSMutableAttributedString) {\n        if mutAttrString.string.count == 0 { return }\n        \n        var range = NSRange(location: 0, length: 0)\n        //给指定索引的字符返回属性\n        var attributes = mutAttrString.attributes(at: 0, effectiveRange: &range)\n        \n        for (type, elements) in elementDict {\n            switch type {\n            case .hashtag:\n                attributes[.foregroundColor] = hashtagColor\n            case .mention:\n                attributes[.foregroundColor] = mentionColor\n            case .URL    :\n                attributes[.foregroundColor] = URLColor\n            case .phone  :\n                attributes[.foregroundColor] = URLColor\n            case .custom :\n                attributes[.foregroundColor] = customColor[type] ?? textColor\n            }\n            \n            for element in elements {\n                if mutAttrString.string.count < element.range.location + element.range.length {\n                    return\n                }\n                mutAttrString.setAttributes(attributes, range: element.range)\n            }\n        }\n    }\n    \n    func creatElementTupleArr(type: FYLabelType, from textString: String, range: NSRange) -> [ElementTuple] {\n        \n        var elementTupleArr = [ElementTuple]()\n        let nsstring = textString as NSString\n        \n        let matches = FYLabelRegex.getMatches(type: type, from: textString, range: range)\n        for match in matches {\n            let range = NSRange(location: match.range.location + type.startIndex, length: match.range.length + type.tenderLength - type.startIndex)\n            let word = nsstring.substring(with: range)\n            guard word.count > 0 else { continue }\n            elementTupleArr.append((range, FYElements.creat(with: type, text: word), type))\n        }\n        return elementTupleArr\n    }\n}\n\n// MARK: - touch\nfileprivate extension FYLabel {\n    \n    func updateWhenSelected(_ isSelected :Bool){\n        guard let elementTuple = selectedElementTuple else {return}\n        \n        //给指定索引的字符返回属性\n        var attributes = textStorage.attributes(at: 0, effectiveRange: nil)\n        if isSelected {\n            switch elementTuple.type {\n            case .hashtag:\n                attributes[NSAttributedString.Key.foregroundColor] = hashtagSelectColor\n            case .mention:\n                attributes[NSAttributedString.Key.foregroundColor] = mentionSelectColor\n            case .URL    :\n                attributes[NSAttributedString.Key.foregroundColor] = URLSelectColor\n            case .phone  :\n                attributes[NSAttributedString.Key.foregroundColor] = URLSelectColor\n            case .custom :\n                var color = self.customSelectColor[elementTuple.type] ?? self.customColor[elementTuple.type]\n                color = color ?? textColor\n                attributes[NSAttributedString.Key.foregroundColor] = color\n            }\n        } else{\n            switch elementTuple.type {\n            case .hashtag: attributes[NSAttributedString.Key.foregroundColor] = hashtagColor\n            case .mention: attributes[NSAttributedString.Key.foregroundColor] = mentionColor\n            case .URL    : attributes[NSAttributedString.Key.foregroundColor] = URLColor\n            case .phone  : attributes[NSAttributedString.Key.foregroundColor] = URLColor\n            case .custom : attributes[NSAttributedString.Key.foregroundColor] = customColor[elementTuple.type] ?? textColor\n            }\n        }\n        \n        textStorage.addAttributes(attributes, range: elementTuple.range)\n        setNeedsDisplay()\n    }\n    \n    func getSelectElementTuple(_ index: Int) -> ElementTuple? {\n        for elementTuples in elementDict.map({ $0.1 }) {\n            for elementTuple in elementTuples {\n                guard index >= elementTuple.range.location else { continue }\n                guard index < elementTuple.range.location + elementTuple.range.length else { continue }\n                return elementTuple\n            }\n        }\n        return nil\n    }\n    \n    func onTouch(_ touch : UITouch) {\n        var location = touch.location(in: self)\n        location.y -= drawBeginY\n        \n        let textRect = layoutManager.boundingRect(forGlyphRange: NSRange(location: 0, length: textStorage.length), in: textContainer)\n        guard textRect.contains(location) else {return}\n        \n        let index = layoutManager.glyphIndex(for: location, in: textContainer)\n        let elementTuple = getSelectElementTuple(index)\n        \n        switch touch.phase {\n        case .began,.moved:\n            if elementTuple?.range.location != selectedElementTuple?.range.location {\n                updateWhenSelected(false)\n                selectedElementTuple = elementTuple\n                updateWhenSelected(true)\n            }\n        case .ended:\n            guard let elementTuple = elementTuple else {\n                if let text = text {\n                    hashNormalHandler?(text)\n                }\n                return\n            }\n            updateWhenSelected(false)\n            switch elementTuple.element {\n            case .hashtag(let hashtag)  : didTapHashtag(hashtag)\n            case .mention(let mention)  : didTapMention(mention)\n            case .URL(let URL)          : didTapURL(URL)\n            case .phone(let phone)      : didTapPhone(phone)\n            case .custom(let custom)    : didTapCustom(elementTuple.type, custom: custom)\n            }\n        default: break\n        }\n    }\n    /// 点击的是标签\n    func didTapHashtag(_ hashtagString : String) -> Void {\n        hashtagTapHandler?(hashtagString)\n    }\n    /// 点击的是提醒\n    func didTapMention(_ mentionString : String) -> Void {\n        mentionTapHandler?(mentionString)\n    }\n    /// 点击的是URL\n    func didTapURL(_ URLString : String) -> Void {\n        urlTapHandler?(URLString)\n    }\n    /// 点击的是phone\n    func didTapPhone(_ phoneString : String) -> Void {\n        phoneTapHandler?(phoneString)\n    }\n    /// 点击的是自定义\n    func didTapCustom(_ type : FYLabelType,custom : String) -> Void {\n        guard let customHandler = customHandler[type] else {return}\n        customHandler(custom)\n    }\n}\nprivate var showFavorKey: Void?\npublic extension FYLabel {\n    var showFavor: (()->Void)? {\n        set {\n            objc_setAssociatedObject(self, &showFavorKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n        get {\n            return objc_getAssociatedObject(self, &showFavorKey) as? (()->Void)? ?? nil\n        }\n    }\n}\n// MARK: 手势\nfileprivate extension FYLabel {\n    @objc func longPressAction(_ sender: UIGestureRecognizer) {\n        guard sender.state == .began else {\n            return\n        }\n        becomeFirstResponder()\n\n        let menuController = UIMenuController.shared\n        let copyItem = UIMenuItem(title: \"复制\", action: #selector(copyText))\n        var items = [copyItem]\n        if showFavor != nil {\n            items.append(UIMenuItem(title: \"收藏\", action: #selector(favor)))\n        }\n        menuController.menuItems = items\n        // 设置菜单控制器点击区域为当前控件 bounds\n        menuController.setTargetRect(bounds, in: self)\n        menuController.setMenuVisible(true, animated: true)\n\n    }\n    @objc func copyText() {\n        UIPasteboard.general.string = self.text\n    }\n    @objc func favor() {\n        showFavor?()\n    }\n    @objc func performAction(_ action: Selector, sender: Any?) -> Bool {\n        switch action {\n        case #selector(copyText), #selector(favor):\n            return true\n        default:\n            return false\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/MomentLabel/FYLabelType.swift",
    "content": "//\n//  FYLabelType.swift\n//\n//  Created by Jett on 2022/04/28.\n//  Copyright 2022 Jett. All rights reserved.\n//\n\nimport UIKit\n\n/* 枚举关联值 */\npublic enum FYElements{\n    case hashtag(String)\n    case mention(String)\n    case URL(String)\n    case phone(String)\n    case custom(String)\n    \n    static func creat(with type : FYLabelType, text : String) -> FYElements {\n        switch type {\n        case .hashtag   :return hashtag(text)\n        case .mention   :return mention(text)\n        case .URL       :return URL(text)\n        case .phone     :return phone(text)\n        case .custom    :return custom(text)\n        }\n    }\n}\n\npublic struct FYLabelRegex {\n    static let hashtagPattern = \"#.*?#\"\n    static let mentionPattern = \"@[\\\\p{L}0-9_]*\"\n    static let URLPattern = \"[a-zA-Z]*://[a-zA-Z0-9/\\\\.]*\"\n    static let phonePattern = \"400[0-9]{7}|1[34578]\\\\d{9}$|0[0-9]{2,3}-[0-9]{8}\"\n    \n    static func getMatches(type: FYLabelType, from textString: String, range: NSRange) -> [NSTextCheckingResult]{\n        let pattern = type.pattern\n        let regex = try! NSRegularExpression(pattern: pattern, options: [.caseInsensitive])\n        let matches = regex.matches(in: textString, options: [], range: range)\n        \n        return matches\n    }\n}\npublic enum FYLabelType {\n    /// #话题#\n    case hashtag\n    /// @用户名\n    case mention\n    /// URL\n    case URL\n    /// 400正则)|(800正则)|(手机号)|(座机号)|\n    case phone\n    \n    case custom(pattern: String, start: Int, tender: Int)\n    \n    var pattern : String {\n        switch self {\n        case .hashtag   : return FYLabelRegex.hashtagPattern\n        case .mention   : return FYLabelRegex.mentionPattern\n        case .URL       : return FYLabelRegex.URLPattern\n        case .phone     : return FYLabelRegex.phonePattern\n        case .custom(let pattern, _, _) : return pattern\n        }\n    }\n    /// 长度减少\n    var tenderLength: Int {\n        switch self {\n        case .hashtag           : return -2\n        case .mention           : return -1\n        case .URL, .phone       : return 0\n        case .custom(_, _, let tender)  : return tender\n        }\n    }\n    /// 相对起始位置\n    var startIndex: Int {\n        switch self {\n        case .URL, .phone:\n            return 0\n        case .mention, .hashtag:\n            return 1\n        case .custom(_, let start, _):\n            return start\n        }\n    }\n    \n}\n\nextension FYLabelType : Hashable, Equatable {\n    public var hashValue : Int {\n        switch self {\n        case .hashtag   : return -3\n        case .mention   : return -2\n        case .URL       : return -1\n        case .phone     : return -4\n        case .custom(let pattern, _, _) : return pattern.hashValue\n        }\n    }\n    \n    public func hash(into hasher: inout Hasher) {\n        switch self {\n        case .hashtag   : hasher.combine(-3)\n        case .mention   : hasher.combine(-2)\n        case .URL       : hasher.combine(-1)\n        case .phone     : hasher.combine(-4)\n        case .custom(let pattern, _, _) : hasher.combine(pattern)\n        }\n    }\n    \n    public static func == (lhs: FYLabelType, rhs: FYLabelType) -> Bool {\n        \n        switch (lhs, rhs) {\n        case (.mention, .mention): return true\n        case (.hashtag, .hashtag): return true\n        case (.URL, .URL): return true\n        case (.phone, .phone): return true\n        case (.custom(let pattern1, _, _), .custom(let pattern2, _, _)): return pattern1 == pattern2\n        default: return false\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/NineImageView.swift",
    "content": "//\n//  NineImageView.swift\n//  JetChat\n//\n//  Created by Jett on 2022/4/14.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport Kingfisher\nimport YBImageBrowser\nimport UIKit\n\nclass NineImageView: UICollectionView {\n    \n    var images = [String]() {\n        didSet {\n            reloadData()\n        }\n    }\n    \n    var isRounds = false\n    \n    init(frame: CGRect) {\n        let layout = UICollectionViewFlowLayout()\n        layout.minimumInteritemSpacing = 5\n        layout.minimumLineSpacing = 5\n        super.init(frame: frame, collectionViewLayout: layout)\n        delegate = self\n        dataSource = self\n        backgroundColor = .clear\n        if #available(iOS 11.0, *) {\n            contentInsetAdjustmentBehavior = .never\n        }\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError()\n    }\n    \n    @objc var onPreviewImages: (([String], IndexPath, UIView)->Void)?\n}\n\nextension NineImageView: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {\n    \n    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        return images.count\n    }\n    \n    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        let cell = collectionView.cell(NineImageViewCell.self, indexPath: indexPath)\n        cell.imageView.setImageWithURL(images[indexPath.item], placeholder: R.image.ic_placeholder()!)\n        if isRounds {\n            cell.imageView.layer.cornerRadius = 5\n            cell.imageView.layer.masksToBounds = true\n        }\n        return cell\n    }\n    \n    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {\n        // 不能动态设置size\n        return CGSize(width: mImageW, height: mImageW)\n    }\n    \n    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {\n        print(\"图片预览\\(indexPath)\")\n        \n        let cell = collectionView.cell(NineImageViewCell.self, indexPath: indexPath)\n        if images.count > 0 {\n            onPreviewImages?(images, indexPath, cell.imageView)\n        }\n    }\n}\n\nclass NineImageViewCell: UICollectionViewCell {\n    \n    lazy var imageView: UIImageView = {\n        let iv = UIImageView()\n        iv.contentMode = .scaleAspectFill\n        iv.clipsToBounds = true\n        iv.autoresizesSubviews = true\n        iv.clearsContextBeforeDrawing = true\n        return iv\n    }()\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        addSubview(imageView)\n        imageView.frame = bounds\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/OperateMenuView.swift",
    "content": "//\n//  OperateMenuView.swift\n//  JetChat\n//\n//  Created by Jett on 2020/5/11.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport SnapKit\nimport UIKit\n\n/// 赞｜评论菜单\nclass OperateMenuView: UIView {\n    \n    fileprivate lazy var thumbupBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.setImage(R.image.ic_star_normal(), for: .normal)\n        btn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 3, bottom: 0, right: 0)\n        btn.setTitle(\"赞\".rLocalized(), for: .normal)\n        btn.setTitle(\"取消\".rLocalized(), for: .selected)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)\n        btn.setTitleColor(.white, for: .normal)\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        return btn\n    }()\n    \n    fileprivate lazy var commentBtn: UIButton = {\n        let btn = UIButton(type: .custom)\n        btn.setImage(R.image.ic_comment_normal(), for: .normal)\n        btn.setTitle(\"评论\".rLocalized(), for: .normal)\n        btn.titleEdgeInsets = UIEdgeInsets(top: 0, left: 3, bottom: 0, right: 0)\n        btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)\n        btn.setTitleColor(.white, for: .normal)\n        btn.addTarget(self, action: #selector(click(_:)), for: .touchUpInside)\n        btn.tag = 1\n        return btn\n    }()\n    \n    fileprivate lazy var contentView: UIView = {\n        let v = UIView()\n        v.frame = CGRect(x: 0, y: 0, width: 160, height: 36)\n        v.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V6 }\n        v.layer.cornerRadius = 5\n        v.layer.masksToBounds = true\n        return v\n    }()\n    \n    fileprivate lazy var separatorView: UIView = {\n        let v = UIView()\n        v.backgroundColor = .black\n        return v\n    }()\n    \n    static func show(_ relative: UIView, isLiked: Bool, canComment: Bool, completed: ((Int)->Void)?) {\n        let v = OperateMenuView(isLiked, canComment: canComment, completed: completed)\n        UIApplication.shared.keyWindow?.addSubview(v)\n        // 计算相对于屏幕的位置\n        let frame = relative.convert(relative.bounds, to: UIApplication.shared.keyWindow)\n        v.show(by: frame)\n    }\n    \n    fileprivate var completed: ((Int)->Void)?\n    fileprivate var canComment = true\n    private init(_ isLiked: Bool, canComment: Bool, completed: ((Int)->Void)?) {\n        super.init(frame: UIScreen.main.bounds)\n        self.completed = completed\n        thumbupBtn.isSelected = isLiked\n        self.canComment = canComment\n        setup()\n    }\n    \n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        setup()\n    }\n}\n\nfileprivate extension OperateMenuView {\n    \n    func setup() {\n        addSubview(contentView)\n        isUserInteractionEnabled = true\n        let tap = UITapGestureRecognizer(target: self, action: #selector(hide))\n        addGestureRecognizer(tap)\n        \n        contentView.addSubview(thumbupBtn)\n        \n        thumbupBtn.snp.makeConstraints { (make) in\n            make.width.equalToSuperview().multipliedBy(0.5)\n            make.height.leading.centerY.equalToSuperview()\n        }\n        if canComment {\n            contentView.addSubview(commentBtn)\n            contentView.addSubview(separatorView)\n\n            separatorView.snp.makeConstraints { (make) in\n                make.width.equalTo(0.5)\n                make.height.equalToSuperview().inset(5)\n                make.leading.equalTo(thumbupBtn.snp.trailing)\n                make.centerY.equalToSuperview()\n            }\n            commentBtn.snp.makeConstraints { (make) in\n                make.width.equalToSuperview().multipliedBy(0.5)\n                make.height.trailing.centerY.equalToSuperview()\n            }\n        }else {\n            thumbupBtn.snp.remakeConstraints { (make) in\n                make.edges.equalToSuperview()\n            }\n        }\n    }\n    \n    @objc func click(_ btn: UIButton) {\n        hide()\n        btn.isSelected = !btn.isSelected\n        completed?(btn.tag)\n    }\n    \n    func show(by relative: CGRect) {\n        let width: CGFloat = canComment ? 160 : 80\n        let originY = relative.midY - 36/2\n        let originX = relative.minX - width - 10\n        contentView.frame = CGRect(x: relative.minX, y: originY, width: 0, height: 36)\n        UIView.animate(withDuration: 0.25) {\n            self.contentView.frame.origin.y = originY\n            self.contentView.frame.origin.x = originX\n            self.contentView.frame.size.width = width\n        }\n    }\n    \n    @objc func hide() {\n        \n        UIView.animate(withDuration: 0.25, animations: {\n            self.contentView.alpha = 0\n        }) { (_) in\n            self.alpha = 0\n            self.removeFromSuperview()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/Moments/View/TextView/FYTextView.swift",
    "content": "//\n//  JXTextView.swift\n//\n//  Created by Jett on 2020/5/9.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\n\npublic enum TextAction {\n    case change(text: String)\n    case delete\n    case done\n    case keyboard(rect: CGRect, duration: Double)\n}\n\nclass FYTextView: UITextView {\n    \n    fileprivate lazy var placeholderLb: UILabel = {\n        let lb = UILabel()\n        lb.text = \"请输入内容....\"\n        lb.font = self.font\n        lb.textColor = UIColor.lightGray\n        lb.frame.origin = CGPoint(x: 5, y: 8)\n        lb.sizeToFit()\n        return lb\n    }()\n    var placeholderColor: UIColor = UIColor.lightGray {\n        didSet {\n            placeholderLb.textColor = placeholderColor\n        }\n    }\n    var placeholder: String? {\n        didSet {\n            placeholderLb.text = placeholder\n            placeholderLb.sizeToFit()\n        }\n    }\n    var maxCount: Int = 200\n    var onKeyAction: ((TextAction)->Void)?\n    fileprivate var textObservation: NSKeyValueObservation?\n    /// 自动计算高度\n    var autoHeight: CGFloat {\n        let size = CGSize(width: self.bounds.width, height: CGFloat.greatestFiniteMagnitude)\n        let constraint = self.sizeThatFits(size)\n        return constraint.height\n    }\n    /// 是否允许换行\n    var lineBreak = true\n    \n    override init(frame: CGRect, textContainer: NSTextContainer?) {\n        super.init(frame: frame, textContainer: textContainer)\n        setupUI()\n    }\n    \n    required init?(coder: NSCoder) {\n        super.init(coder: coder)\n        setupUI()\n    }\n    \n    deinit {\n        NotificationCenter.default.removeObserver(self)\n    }\n    \n    override func layoutSubviews() {\n        super.layoutSubviews()\n        if responds(to: #selector(setter: UITextView.textContainerInset)) {\n            placeholderLb.frame.origin.x = textContainerInset.left + 5\n            placeholderLb.frame.origin.y = textContainerInset.top\n        }\n    }\n}\nfileprivate extension FYTextView {\n    func setupUI(){\n        addSubview(placeholderLb)\n        delegate = self\n        \n        textObservation = observe(\\.text, changeHandler: { (tv, change) in\n            self.placeholderLb.isHidden = tv.hasText\n        })\n        NotificationCenter.default.addObserver(self, selector: #selector(textChanged(n:)), name: UITextView.textDidChangeNotification, object: nil)\n        \n        NotificationCenter.default.addObserver(self, selector: #selector(keyboardChanged(n:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)\n        \n    }\n    @objc func keyboardChanged(n: Notification){\n        guard let rect = (n.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue,\n            let duration = (n.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue else{\n                return\n        }\n        onKeyAction?(.keyboard(rect: rect, duration: duration))\n    }\n    \n    @objc func textChanged(n: Notification){\n        placeholderLb.isHidden = self.hasText\n    }\n}\nextension FYTextView: UITextViewDelegate {\n    func textViewDidChange(_ textView: UITextView) {\n        onKeyAction?(.change(text: textView.text))\n    }\n    func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {\n        if !lineBreak && text == \"\\n\" {\n            onKeyAction?(.done)\n            return false\n        }\n        if textView.text.count >= maxCount {\n            textView.text = String(textView.text.prefix(maxCount-1))\n            return false\n        }\n        return true\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/MainModule/QrScan/ScanQRCodeViewController.swift",
    "content": "//\n//  ScanQRCodeViewController.swift\n//  JChat\n//\n//  Created by JIGUANG on 2017/8/16.\n//  Copyright © 2017年 HXHG. All rights reserved.\n//\n\nimport UIKit\nimport AVFoundation\n\nclass ScanQRCodeViewController: UIViewController {\n    \n    final let borderW = CGFloat(240)\n    final let borderY = (UIScreen.main.bounds.size.height - 240) * 0.5;\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n        navigationItem.title = \"扫一扫\".rLocalized()\n        view.backgroundColor = .white\n        \n        self.extendedLayoutIncludesOpaqueBars = true;\n        \n        let authStatus = AVCaptureDevice.authorizationStatus(for: AVMediaType(rawValue: convertFromAVMediaType(AVMediaType.video)))\n        if(authStatus == .restricted || authStatus == .denied){\n            let alertView = UIAlertView(title: \"无法访问相机\", message: \"请在设备的设置-趣阅中允许访问相机。\",delegate: self, cancelButtonTitle: \"好的\", otherButtonTitles: \"去设置\")\n            alertView.show()\n            return;\n        }\n        \n        previewLayer.frame = view.frame\n        view.layer.addSublayer(previewLayer)\n        session.startRunning()\n        \n        let borderView = UIImageView(frame: CGRect(x: (view.width - borderW) / 2, y: borderY, width: borderW, height: borderW))\n        borderView.image = UIImage(named: \"icon_qrc_border\")\n        view.addSubview(borderView)\n        \n        qrcLine = UIImageView(frame: CGRect(x: (view.width - 190) / 2, y: borderY, width: 190, height: 6))\n        qrcLine.image = UIImage(named: \"icon_qrc_line\")\n        view.addSubview(qrcLine)\n\n        let imageView = UIImageView(frame: view.frame)\n        imageView.image = _getBackgroundImage()\n        view.addSubview(imageView)\n        \n        let tipsLabel = UILabel(frame: CGRect(x: 10, y: borderY + borderW + 17.5, width: view.width - 20, height: 20))\n        tipsLabel.font = UIFont.systemFont(ofSize: 14)\n        tipsLabel.text = \"将取景框对准二维码，即可自动扫描\".rLocalized()\n        tipsLabel.textColor = .appThemeHexColor()\n        tipsLabel.textAlignment = .center\n        tipsLabel.numberOfLines = 2\n        view.addSubview(tipsLabel)\n        \n        NotificationCenter.default.addObserver(self, selector: #selector(startQRCAnimate), name: UIApplication.didBecomeActiveNotification, object: nil)\n    }\n    \n    var qrcLine: UIImageView!\n    var isStopAnimate = false\n    \n    override func viewWillAppear(_ animated: Bool) {\n        super.viewWillAppear(animated)\n        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)\n        navigationController?.navigationBar.shadowImage = UIImage()\n    }\n        \n    override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        session.startRunning()\n        isStopAnimate = false\n        isAnimating = false\n        startQRCAnimate()\n    }\n    \n    override func viewWillDisappear(_ animated: Bool) {\n        super.viewWillDisappear(animated)\n        navigationController?.navigationBar.setBackgroundImage(nil, for: .default)\n        navigationController?.navigationBar.shadowImage = nil\n        navigationController?.navigationBar.barTintColor = UIColor(netHex: 0x2dd0cf)\n        self.qrcLine.layer.removeAllAnimations()\n    }\n    \n    override func viewWillLayoutSubviews() {\n        super.viewWillLayoutSubviews()\n        \n    }\n    \n    deinit {\n        NotificationCenter.default.removeObserver(self)\n    }\n    \n    fileprivate lazy var session: AVCaptureSession = {\n        var session = AVCaptureSession()\n        var device = AVCaptureDevice.default(for: AVMediaType(rawValue: convertFromAVMediaType(AVMediaType.video)))\n        var input: AVCaptureDeviceInput?\n        do {\n            input = try AVCaptureDeviceInput(device: device!)\n        } catch {\n            print(error)\n        }\n        if input != nil {\n            session.addInput(input!)\n        }\n        var output = AVCaptureMetadataOutput()\n        session.addOutput(output)\n        output.metadataObjectTypes = [AVMetadataObject.ObjectType.qr]\n        output.setMetadataObjectsDelegate(self, queue: DispatchQueue.main)\n        \n        return session\n    }()\n    \n    fileprivate lazy var previewLayer: AVCaptureVideoPreviewLayer = {\n        var previewLayer = AVCaptureVideoPreviewLayer(session: self.session)\n        return previewLayer\n    }()\n    \n    private func _getBackgroundImage() -> UIImage? {\n        UIGraphicsBeginImageContext(view.frame.size)\n        guard let ctx = UIGraphicsGetCurrentContext() else {\n            return nil\n        }\n        ctx.setFillColor(red: 0, green: 0, blue: 0, alpha: 0.5)\n        let screenSize = UIScreen.main.bounds.size\n        var drawRect = CGRect(x: 0, y: 0, width: screenSize.width, height: screenSize.height)\n        ctx.fill(drawRect)\n        drawRect = CGRect(x: (view.width - borderW) / 2, y: borderY, width: borderW, height: borderW)\n        ctx.clear(drawRect)\n        let image = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return image\n    }\n    \n    var isAnimating = false\n    \n    @objc func startQRCAnimate() {\n        if isStopAnimate || isAnimating {\n            return\n        }\n        isAnimating = true\n        qrcLine.frame = CGRect(x: (self.view.width - 190) / 2, y: borderY, width: 190, height: 6)\n        UIView.animate(withDuration: 2.5, animations: {\n            self.qrcLine.frame = CGRect(x: (self.view.width - 190) / 2, y: self.borderY + self.borderW - 5, width: 190, height: 6)\n        }) { (finish) in\n            self.isAnimating = false\n            self.qrcLine.frame = CGRect(x: (self.view.width - 190) / 2, y: self.borderY, width: 190, height: 6)\n            if finish {\n                self.startQRCAnimate()\n            }\n        }\n    }\n}\n\n// MARK: - AVCaptureMetadataOutputObjectsDelegate\n\nextension ScanQRCodeViewController: AVCaptureMetadataOutputObjectsDelegate {\n    \n    func metadataOutput(_ captureOutput: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {\n        for metadataObject in metadataObjects {\n            guard let object = metadataObject as? AVMetadataMachineReadableCodeObject else {\n                return\n            }\n            \n            let barCodeObject = previewLayer.transformedMetadataObject(for: object)\n            let frame = barCodeObject!.bounds\n            \n            let validFrame = CGRect(x: (view.width - borderW) / 2, y: borderY, width: borderW, height: borderW)\n            if frame.origin.x < validFrame.origin.x || frame.origin.x + frame.size.width > validFrame.origin.x + validFrame.size.width {\n                return\n            }\n            \n            if frame.size.width > validFrame.size.width {\n                return\n            }\n            \n            if frame.origin.y < validFrame.origin.y || frame.origin.y + frame.size.height > validFrame.origin.y + validFrame.size.height {\n                return\n            }\n            \n            if frame.size.height > validFrame.size.height {\n                return\n            }\n            \n            if object.type.rawValue == convertFromAVMetadataObjectObjectType(AVMetadataObject.ObjectType.qr) {\n                guard let url = object.stringValue else {\n                    return\n                }\n                \n                if let openURL = URL(string: url) {\n                    if UIApplication.shared.canOpenURL(openURL) {\n                        UIApplication.shared.open(openURL, options: [:], completionHandler: nil)\n                    } else {\n                        guard let safeURL = URL(string: \"https://\" + url) else {\n                            return\n                        }\n                        \n                        UIApplication.shared.open(safeURL, options: [:], completionHandler: nil)\n                    }\n                    return\n                }\n            \n                let jsonData: Data = url.data(using: .utf8)!\n\n                let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)\n                guard let info = dict as? NSDictionary else {\n                    return\n                }\n\n                session.stopRunning()\n            }\n        }\n    }\n    \n\n    func convertStringToDictionary(text: String) -> [String : AnyObject]? {\n        if let data = text.data(using: .utf8) {\n            do {\n                return try JSONSerialization.jsonObject(with: data, options: [JSONSerialization.ReadingOptions.init(rawValue: 0)]) as? [String:AnyObject]\n            } catch let error as NSError {\n                print(error)\n            }\n        }\n        return nil\n    }\n}\n\nextension ScanQRCodeViewController: UIAlertViewDelegate {\n    \n    func alertView(_ alertView: UIAlertView, clickedButtonAt buttonIndex: Int) {\n        if buttonIndex == 1 {\n            \n        }\n    }\n}\n\n\n// Helper function inserted by Swift 4.2 migrator.\nfileprivate func convertFromAVMediaType(_ input: AVMediaType) -> String {\n\treturn input.rawValue\n}\n\n// Helper function inserted by Swift 4.2 migrator.\nfileprivate func convertFromAVMetadataObjectObjectType(_ input: AVMetadataObject.ObjectType) -> String {\n\treturn input.rawValue\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Resource/Languages/en.lproj/InfoPlist.strings",
    "content": "/* \n  InfoPlist.strings\n  FY-IMChat\n \n  美式英语\n \n  Created by iOS.Jet on 2019/3/4.\n  Copyright © 2019 development. All rights reserved.\n*/\n\nNSCameraUsageDescription = \"To scan the QR code, do you allow using the camera?\";\nNSPhotoLibraryUsageDescription = \"App requests your permission to access the photos in the gallery.\";\nNSPhotoLibraryAddUsageDescription = \"App requests your permission to access the photos in the gallery.\";\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Resource/Languages/en.lproj/Localizable.strings",
    "content": "\"温馨提示\" = \"Tips\";\n\"确定\" = \"Confirm\";\n\"取消\" = \"Cancel\";\n\"设置\" = \"Settings\";\n\"会话\" = \"Session\";\n\"群组\" = \"Group\";\n\"好友\" = \"Friends\";\n\"我\" = \"Mine\";\n\"加入群\" = \"Join group\";\n\"删除所有群组\" = \"Delete all\";\n\"添加好友\" = \"Add Friends\";\n\"删除所有好友\" = \"Delete all\";\n\"语言设置\" = \"Language settings\";\n\"版本\" = \"Version\";\n\"简体中文\" = \"Chinese\";\n\"英文\" = \"English\";\n\n\"当前网络已断开\" = \"Network disconnected\";\n\"版本号:\" = \"Version number:\";\n\"已是最新版本\" = \"Is the latest version\";\n\"发起单聊\" = \"Single chat\";\n\"发起群聊\" = \"Group chat\";\n\"添加朋友\" = \"Add Friends\";\n\"扫一扫\" = \"Scan\";\n\"将取景框对准二维码，即可自动扫描\" = \"Aim the viewfinder at the QR code and it can be scanned automatically\";\n\n\"确定退出当前群组吗？\" = \"Are you sure you want to leave the current group?\";\n\"你已退出%@群聊\" = \"You have quit %@ group chat\";\n\"确定删除全部好友吗？\" = \"Are you sure to delete all friends?\";\n\"确定删除全部群组吗？\" = \"Are you sure to delete all groups?\";\n\"删除后，会话记录也将清除\" = \"After deletion, the session record will also be cleared\";\n\"退出群\" = \"Exit group\";\n\"已清除全部未读消息数\" = \"All unread messages cleared\";\n\"全部已读\" = \"Read all\";\n\"群聊\" = \"Group chat\";\n\"确定删除该好友吗？\" = \"Are you sure to delete this friend?\";\n\n\"保存\" = \"Save\";\n\"备注名称不超过12个字\" = \"Remark name no more than 12 words\";\n\"修改备注名称\" = \"Modify remark name\";\n\"设置备注名\" = \"Setting remark name\";\n\"正在保存...\" = \"Saving\";\n\"发送\" = \"Send\";\n\"消息转发\" = \"Forward\";\n\"发消息\" = \"Sending\";\n\"个人信息\" = \"Personal information\";\n\"用户名：\" = \"Username:\";\n\"备注名：\" = \"Remark name:\";\n\"转发\" = \"Forward\";\n\"复制\" = \"Copy\";\n\"删除\" = \"Delete\";\n\n\"请输入...\" = \"Please enter...\";\n\"图片\" = \"Album\";\n\"拍照\" = \"Camera\";\n\"视频\" = \"Video\";\n\"位置\" = \"Location\";\n\"语音\" = \"Voice\";\n\"钱包\" = \"Wallet\";\n\"转账\" = \"Transfer\";\n\"名片\" = \"Card\";\n\"收藏\" = \"Collection\";\n\"隐藏\" = \"Hide\";\n\n\"昨天\" = \"Yesterday\";\n\"今天\" = \"Today\";\n\"星期一\" = \"Monday\";\n\"星期二\" = \"Tuesday\";\n\"星期三\" = \"Wednesday\";\n\"星期四\" = \"Thursday\";\n\"星期五\" = \"Friday\";\n\"星期六\" = \"Saturday\";\n\"星期日\" = \"Sunday\";\n\n\"清除图片缓存\" = \"Clear picture cache\";\n\"清除成功\" = \"Cleared success\";\n\"朋友圈\" = \"Wechat Moments\";\n\"评论\" = \"Comment\";\n\"赞\" = \"Star\";\n\n\"主题模式\" = \"Theme mode\";\n\"白天模式\" = \"Light\";\n\"黑夜模式\" = \"Drak\";\n\"跟随系统\" = \"Follow system\";\n\"选取后，将跟随系统设定模式\" = \"Follow system setting\";\n\"作者github\" = \"Author GitHub\";\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Resource/Languages/zh-Hans.lproj/InfoPlist.strings",
    "content": "/* \n  InfoPlist.strings\n  FY-IMChat\n \n  简体中文\n\n  Created by iOS.Jet on 2019/3/4.\n  Copyright © 2019 development. All rights reserved.\n*/\n\nNSCameraUsageDescription = \"需要扫描二维码或拍照,是否允许打开相机?\";\nNSPhotoLibraryUsageDescription = \"App需要您的同意,才能访问相册保存图片\";\nNSPhotoLibraryAddUsageDescription = \"App需要您的同意,才能访问相册保存图片\";\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Resource/Languages/zh-Hans.lproj/LWLocalizations.strings",
    "content": "\"a_launch_title\" = \"\";\n\"a_launch_create\" = \"\";\n\"a_launch_choose\" = \"\";\n\"a_launch_login\" = \"\";\n\"a_launch_current\" = \"\";\n\"b_login_title\" = \"\";\n\"b_login_phone\" = \"\";\n\"b_login_password\" = \"\";\n\"b_login_phone_input\" = \"\";\n\n\"b_login_password_input\" = \"\";\n\"b_login_forget\" = \"\";\n\"b_login_login_btn\" = \"\";\n\"c_register_create_title\" = \"\";\n\"c_register_create_id\" = \"\";\n\"c_register_create_phone\" = \"\";\n\"c_register_create_code\" = \"\";\n\"c_register_create_id_input\" = \"\";\n\"c_register_create_phone_input\" = \"\";\n\"c_register_create_code_input\" = \"\";\n\n\"c_register_create_agree\" = \"\";\n\"c_register_create_agreement\" = \"\";\n\"c_register_create_send\" = \"\";\n\"c_register_create_next\" = \"\";\n\"c_register_set_password_title\" = \"\";\n\"c_register_set_password\" = \"\";\n\"c_register_set_password_again\" = \"\";\n\"c_register_set_password_code\" = \"\";\n\"c_register_set_password_input\" = \"\";\n\"c_register_set_password_again_input\" = \"\";\n\n\"c_register_set_password_code_input\" = \"\";\n\"c_register_set_password_next\" = \"\";\n\"c_register_set_password_tip\" = \"\";\n\"c_register_set_password_tip2\" = \"\";\n\"c_register_set_payment_title\" = \"\";\n\"c_register_set_payment_msg\" = \"\";\n\"c_register_set_payment_skip\" = \"\";\n\"c_register_set_payment_next\" = \"\";\n\"c_register_confirm_payment_title\" = \"\";\n\"c_register_confirm_payment_btn\" = \"\";\n\n\"c_register_mnemonic_backup_title\" = \"\";\n\"c_register_mnemonic_backup_msg\" = \"\";\n\"c_register_mnemonic_backup_next\" = \"\";\n\"c_register_mnemonic_confirm_title\" = \"\";\n\"c_register_mnemonic_confirm_finish\" = \"\";\n\"c_register_mnemonic_confirm_msg\" = \"\";\n\"c_register_mnemonic_confirm_tip\" = \"\";\n\"d_retrieve_title\" = \"\";\n\"d_retrieve_phone\" = \"\";\n\"d_retrieve_code\" = \"\";\n\n\"d_retrieve_phone_input\" = \"\";\n\"d_retrieve_code_input\" = \"\";\n\"d_retrieve_send\" = \"\";\n\"d_retrieve_next\" = \"\";\n\"d_retrieve_password\" = \"\";\n\"d_retrieve_password_again\" = \"\";\n\"d_retrieve_finish\" = \"\";\n\"d_retrieve_reset_success_tip\" = \"\";\n\"e_wallet_title\" = \"\";\n\"e_wallet_assets\" = \"\";\n\n\"e_wallet_earned\" = \"\";\n\"e_wallet_revenue\" = \"\";\n\"e_wallet_coin_set_title\" = \"\";\n\"e_wallet_coin_current\" = \"\";\n\"e_wallet_coin_more\" = \"\";\n\"e_wallet_coin_remove\" = \"\";\n\"f_wallet_detail_available\" = \"\";\n\"f_wallet_detail_freeze\" = \"\";\n\"f_wallet_detail_equivalent\" = \"\";\n\"f_wallet_detail_ad\" = \"\";\n\n\"f_wallet_detail_record\" = \"\";\n\"f_wallet_detail_filter\" = \"\";\n\"f_wallet_detail_in\" = \"\";\n\"f_wallet_detail_out\" = \"\";\n\"f_wallet_detail_balance\" = \"\";\n\"f_wallet_detail_status\" = \"\";\n\"f_wallet_detail_quanity\" = \"\";\n\"f_wallet_detail_status_confirmed\" = \"\";\n\"f_wallet_detail_status_confirming\" = \"\";\n\"f_wallet_detail_btn_eeceipt\" = \"\";\n\n\"f_wallet_detail_btn_transfer\" = \"\";\n\"f_wallet_transfer_detail_title\" = \"\";\n\"f_wallet_transfer_detail_amount\" = \"\";\n\"f_wallet_transfer_detail_address\" = \"\";\n\"f_wallet_transfer_detail_id\" = \"\";\n\"f_wallet_transfer_detail_date\" = \"\";\n\"f_wallet_transfer_detail_status\" = \"\";\n\"g_wallet_receipt_title\" = \"\";\n\"g_wallet_receipt_copy\" = \"\";\n\"g_wallet_receipt_album\" = \"\";\n\n\"h_transfer_title\" = \"\";\n\"h_transfer_address_placeholder\" = \"\";\n\"h_transfer_fee\" = \"\";\n\"h_transfer_balance\" = \"\";\n\"h_transfer_fee_msg\" = \"\";\n\"h_transfer_btn\" = \"\";\n\"h_transfer_pay_title\" = \"\";\n\"h_transfer_pay_msg\" = \"\";\n\"h_transfer_pay_btn\" = \"\";\n\"j_mine_main_usercenter\" = \"\";\n\n\"j_mine_main_security\" = \"\";\n\"j_mine_main_contact\" = \"\";\n\"j_mine_main_setting\" = \"\";\n\"j_mine_main_ad\" = \"\";\n\"j_mine_setting_language\" = \"\";\n\"j_mine_setting_version\" = \"\";\n\"j_mine_security_login\" = \"\";\n\"j_mine_security_pay\" = \"\";\n\"j_mine_security_login_1_title\" = \"\";\n\"j_mine_security_login_1_phone\" = \"\";\n\n\"j_mine_security_login_1_code\" = \"\";\n\"j_mine_security_login_1_phone_input\" = \"\";\n\"j_mine_security_login_1_code_input\" = \"\";\n\"j_mine_security_login_1_send\" = \"\";\n\"j_mine_security_login_1_next\" = \"\";\n\"j_mine_security_login_2_title\" = \"\";\n\"j_mine_security_login_2_password\" = \"\";\n\"j_mine_security_login_2_password_again\" = \"\";\n\"j_mine_security_login_2_finish\" = \"\";\n\"j_mine_security_login_2_success_tip\" = \"\";\n\n\"j_mine_security_pay_1_title\" = \"\";\n\"j_mine_security_pay_1_msg\" = \"\";\n\"j_mine_security_pay_1_next\" = \"\";\n\"j_mine_security_pay_2_title\" = \"\";\n\"j_mine_security_pay_2_finish\" = \"\";\n\"j_mine_user_idname\" = \"\";\n\"j_mine_user_phone\" = \"\";\n\"j_mine_user_mnemonic\" = \"\";\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Resource/Languages/zh-Hans.lproj/Localizable.strings",
    "content": "\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Resource/LaunchScreen.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"20037\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" useSafeAreas=\"YES\" colorMatched=\"YES\" initialViewController=\"01J-lp-oVM\">\n    <device id=\"retina6_1\" orientation=\"portrait\" appearance=\"light\"/>\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"20020\"/>\n        <capability name=\"Safe area layout guides\" minToolsVersion=\"9.0\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"EHf-IW-A2E\">\n            <objects>\n                <viewController id=\"01J-lp-oVM\" sceneMemberID=\"viewController\">\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"Ze5-6b-2t3\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"414\" height=\"896\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <viewLayoutGuide key=\"safeArea\" id=\"Bcu-3y-fUS\"/>\n                        <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"iYj-Kq-Ea1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"53\" y=\"375\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Resource/R.generated.swift",
    "content": "//\n// This is a generated file, do not edit!\n// Generated by R.swift, see https://github.com/mac-cain13/R.swift\n//\n\nimport Foundation\nimport Rswift\nimport UIKit\n\n/// This `R` struct is generated and contains references to static resources.\nstruct R: Rswift.Validatable {\n  fileprivate static let applicationLocale = hostingBundle.preferredLocalizations.first.flatMap { Locale(identifier: $0) } ?? Locale.current\n  fileprivate static let hostingBundle = Bundle(for: R.Class.self)\n\n  /// Find first language and bundle for which the table exists\n  fileprivate static func localeBundle(tableName: String, preferredLanguages: [String]) -> (Foundation.Locale, Foundation.Bundle)? {\n    // Filter preferredLanguages to localizations, use first locale\n    var languages = preferredLanguages\n      .map { Locale(identifier: $0) }\n      .prefix(1)\n      .flatMap { locale -> [String] in\n        if hostingBundle.localizations.contains(locale.identifier) {\n          if let language = locale.languageCode, hostingBundle.localizations.contains(language) {\n            return [locale.identifier, language]\n          } else {\n            return [locale.identifier]\n          }\n        } else if let language = locale.languageCode, hostingBundle.localizations.contains(language) {\n          return [language]\n        } else {\n          return []\n        }\n      }\n\n    // If there's no languages, use development language as backstop\n    if languages.isEmpty {\n      if let developmentLocalization = hostingBundle.developmentLocalization {\n        languages = [developmentLocalization]\n      }\n    } else {\n      // Insert Base as second item (between locale identifier and languageCode)\n      languages.insert(\"Base\", at: 1)\n\n      // Add development language as backstop\n      if let developmentLocalization = hostingBundle.developmentLocalization {\n        languages.append(developmentLocalization)\n      }\n    }\n\n    // Find first language for which table exists\n    // Note: key might not exist in chosen language (in that case, key will be shown)\n    for language in languages {\n      if let lproj = hostingBundle.url(forResource: language, withExtension: \"lproj\"),\n         let lbundle = Bundle(url: lproj)\n      {\n        let strings = lbundle.url(forResource: tableName, withExtension: \"strings\")\n        let stringsdict = lbundle.url(forResource: tableName, withExtension: \"stringsdict\")\n\n        if strings != nil || stringsdict != nil {\n          return (Locale(identifier: language), lbundle)\n        }\n      }\n    }\n\n    // If table is available in main bundle, don't look for localized resources\n    let strings = hostingBundle.url(forResource: tableName, withExtension: \"strings\", subdirectory: nil, localization: nil)\n    let stringsdict = hostingBundle.url(forResource: tableName, withExtension: \"stringsdict\", subdirectory: nil, localization: nil)\n\n    if strings != nil || stringsdict != nil {\n      return (applicationLocale, hostingBundle)\n    }\n\n    // If table is not found for requested languages, key will be shown\n    return nil\n  }\n\n  /// Load string from Info.plist file\n  fileprivate static func infoPlistString(path: [String], key: String) -> String? {\n    var dict = hostingBundle.infoDictionary\n    for step in path {\n      guard let obj = dict?[step] as? [String: Any] else { return nil }\n      dict = obj\n    }\n    return dict?[key] as? String\n  }\n\n  static func validate() throws {\n    try intern.validate()\n  }\n\n  #if os(iOS) || os(tvOS)\n  /// This `R.storyboard` struct is generated, and contains static references to 1 storyboards.\n  struct storyboard {\n    /// Storyboard `LaunchScreen`.\n    static let launchScreen = _R.storyboard.launchScreen()\n\n    #if os(iOS) || os(tvOS)\n    /// `UIStoryboard(name: \"LaunchScreen\", bundle: ...)`\n    static func launchScreen(_: Void = ()) -> UIKit.UIStoryboard {\n      return UIKit.UIStoryboard(resource: R.storyboard.launchScreen)\n    }\n    #endif\n\n    fileprivate init() {}\n  }\n  #endif\n\n  /// This `R.entitlements` struct is generated, and contains static references to 1 properties.\n  struct entitlements {\n    struct comAppleSecurityApplicationGroups {\n      static let groupComJetchat2022JetChatWidget = infoPlistString(path: [\"com.apple.security.application-groups\"], key: \"group.com.jetchat.2022.JetChatWidget\") ?? \"group.com.jetchat.2022.JetChatWidget\"\n\n      fileprivate init() {}\n    }\n\n    fileprivate init() {}\n  }\n\n  /// This `R.file` struct is generated, and contains static references to 49 files.\n  struct file {\n    /// Resource file `Emoticons.bundle`.\n    static let emoticonsBundle = Rswift.FileResource(bundle: R.hostingBundle, name: \"Emoticons\", pathExtension: \"bundle\")\n    /// Resource file `Expression.bundle`.\n    static let expressionBundle = Rswift.FileResource(bundle: R.hostingBundle, name: \"Expression\", pathExtension: \"bundle\")\n    /// Resource file `Expression.plist`.\n    static let expressionPlist = Rswift.FileResource(bundle: R.hostingBundle, name: \"Expression\", pathExtension: \"plist\")\n    /// Resource file `HUDAssets.bundle`.\n    static let hudAssetsBundle = Rswift.FileResource(bundle: R.hostingBundle, name: \"HUDAssets\", pathExtension: \"bundle\")\n    /// Resource file `ToolViewEmotion@2x.png`.\n    static let toolViewEmotion2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewEmotion@2x\", pathExtension: \"png\")\n    /// Resource file `ToolViewEmotion@3x.png`.\n    static let toolViewEmotion3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewEmotion@3x\", pathExtension: \"png\")\n    /// Resource file `ToolViewEmotionHL@2x.png`.\n    static let toolViewEmotionHL2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewEmotionHL@2x\", pathExtension: \"png\")\n    /// Resource file `ToolViewEmotionHL@3x.png`.\n    static let toolViewEmotionHL3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewEmotionHL@3x\", pathExtension: \"png\")\n    /// Resource file `ToolViewInputVoice@2x.png`.\n    static let toolViewInputVoice2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewInputVoice@2x\", pathExtension: \"png\")\n    /// Resource file `ToolViewInputVoice@3x.png`.\n    static let toolViewInputVoice3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewInputVoice@3x\", pathExtension: \"png\")\n    /// Resource file `ToolViewInputVoiceHL@2x.png`.\n    static let toolViewInputVoiceHL2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewInputVoiceHL@2x\", pathExtension: \"png\")\n    /// Resource file `ToolViewInputVoiceHL@3x.png`.\n    static let toolViewInputVoiceHL3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewInputVoiceHL@3x\", pathExtension: \"png\")\n    /// Resource file `ToolViewKeyboard@2x.png`.\n    static let toolViewKeyboard2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewKeyboard@2x\", pathExtension: \"png\")\n    /// Resource file `ToolViewKeyboard@3x.png`.\n    static let toolViewKeyboard3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewKeyboard@3x\", pathExtension: \"png\")\n    /// Resource file `ToolViewKeyboardHL@2x.png`.\n    static let toolViewKeyboardHL2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewKeyboardHL@2x\", pathExtension: \"png\")\n    /// Resource file `ToolViewKeyboardHL@3x.png`.\n    static let toolViewKeyboardHL3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ToolViewKeyboardHL@3x\", pathExtension: \"png\")\n    /// Resource file `TypeSelectorBtnHL_Black@2x.png`.\n    static let typeSelectorBtnHL_Black2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"TypeSelectorBtnHL_Black@2x\", pathExtension: \"png\")\n    /// Resource file `TypeSelectorBtnHL_Black@3x.png`.\n    static let typeSelectorBtnHL_Black3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"TypeSelectorBtnHL_Black@3x\", pathExtension: \"png\")\n    /// Resource file `TypeSelectorBtn_Black@2x.png`.\n    static let typeSelectorBtn_Black2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"TypeSelectorBtn_Black@2x\", pathExtension: \"png\")\n    /// Resource file `TypeSelectorBtn_Black@3x.png`.\n    static let typeSelectorBtn_Black3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"TypeSelectorBtn_Black@3x\", pathExtension: \"png\")\n    /// Resource file `ic_emotion_delete@2x.png`.\n    static let ic_emotion_delete2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_emotion_delete@2x\", pathExtension: \"png\")\n    /// Resource file `ic_emotion_delete@3x.png`.\n    static let ic_emotion_delete3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_emotion_delete@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_album@2x.png`.\n    static let ic_more_album2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_album@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_album@3x.png`.\n    static let ic_more_album3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_album@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_camera@2x.png`.\n    static let ic_more_camera2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_camera@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_camera@3x.png`.\n    static let ic_more_camera3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_camera@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_favorite@2x.png`.\n    static let ic_more_favorite2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_favorite@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_favorite@3x.png`.\n    static let ic_more_favorite3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_favorite@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_friendcard@2x.png`.\n    static let ic_more_friendcard2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_friendcard@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_friendcard@3x.png`.\n    static let ic_more_friendcard3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_friendcard@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_location@2x.png`.\n    static let ic_more_location2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_location@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_location@3x.png`.\n    static let ic_more_location3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_location@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_pay@2x.png`.\n    static let ic_more_pay2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_pay@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_pay@3x.png`.\n    static let ic_more_pay3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_pay@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_sight@2x.png`.\n    static let ic_more_sight2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_sight@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_sight@3x.png`.\n    static let ic_more_sight3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_sight@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_video@2x.png`.\n    static let ic_more_video2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_video@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_video@3x.png`.\n    static let ic_more_video3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_video@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_voice@2x.png`.\n    static let ic_more_voice2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_voice@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_voice@3x.png`.\n    static let ic_more_voice3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_voice@3x\", pathExtension: \"png\")\n    /// Resource file `ic_more_wallet@2x.png`.\n    static let ic_more_wallet2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_wallet@2x\", pathExtension: \"png\")\n    /// Resource file `ic_more_wallet@3x.png`.\n    static let ic_more_wallet3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"ic_more_wallet@3x\", pathExtension: \"png\")\n    /// Resource file `icon_emoji_expression@2x.png`.\n    static let icon_emoji_expression2xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"icon_emoji_expression@2x\", pathExtension: \"png\")\n    /// Resource file `icon_emoji_expression@3x.png`.\n    static let icon_emoji_expression3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"icon_emoji_expression@3x\", pathExtension: \"png\")\n    /// Resource file `icon_qrc_border@3x.png`.\n    static let icon_qrc_border3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"icon_qrc_border@3x\", pathExtension: \"png\")\n    /// Resource file `icon_qrc_line@3x.png`.\n    static let icon_qrc_line3xPng = Rswift.FileResource(bundle: R.hostingBundle, name: \"icon_qrc_line@3x\", pathExtension: \"png\")\n    /// Resource file `localVideo0.mp4`.\n    static let localVideo0Mp4 = Rswift.FileResource(bundle: R.hostingBundle, name: \"localVideo0\", pathExtension: \"mp4\")\n    /// Resource file `moments1.json`.\n    static let moments1Json = Rswift.FileResource(bundle: R.hostingBundle, name: \"moments1\", pathExtension: \"json\")\n    /// Resource file `moments2.json`.\n    static let moments2Json = Rswift.FileResource(bundle: R.hostingBundle, name: \"moments2\", pathExtension: \"json\")\n\n    /// `bundle.url(forResource: \"Emoticons\", withExtension: \"bundle\")`\n    static func emoticonsBundle(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.emoticonsBundle\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"Expression\", withExtension: \"bundle\")`\n    static func expressionBundle(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.expressionBundle\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"Expression\", withExtension: \"plist\")`\n    static func expressionPlist(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.expressionPlist\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"HUDAssets\", withExtension: \"bundle\")`\n    static func hudAssetsBundle(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.hudAssetsBundle\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewEmotion@2x\", withExtension: \"png\")`\n    static func toolViewEmotion2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewEmotion2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewEmotion@3x\", withExtension: \"png\")`\n    static func toolViewEmotion3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewEmotion3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewEmotionHL@2x\", withExtension: \"png\")`\n    static func toolViewEmotionHL2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewEmotionHL2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewEmotionHL@3x\", withExtension: \"png\")`\n    static func toolViewEmotionHL3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewEmotionHL3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewInputVoice@2x\", withExtension: \"png\")`\n    static func toolViewInputVoice2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewInputVoice2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewInputVoice@3x\", withExtension: \"png\")`\n    static func toolViewInputVoice3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewInputVoice3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewInputVoiceHL@2x\", withExtension: \"png\")`\n    static func toolViewInputVoiceHL2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewInputVoiceHL2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewInputVoiceHL@3x\", withExtension: \"png\")`\n    static func toolViewInputVoiceHL3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewInputVoiceHL3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewKeyboard@2x\", withExtension: \"png\")`\n    static func toolViewKeyboard2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewKeyboard2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewKeyboard@3x\", withExtension: \"png\")`\n    static func toolViewKeyboard3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewKeyboard3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewKeyboardHL@2x\", withExtension: \"png\")`\n    static func toolViewKeyboardHL2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewKeyboardHL2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ToolViewKeyboardHL@3x\", withExtension: \"png\")`\n    static func toolViewKeyboardHL3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.toolViewKeyboardHL3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"TypeSelectorBtnHL_Black@2x\", withExtension: \"png\")`\n    static func typeSelectorBtnHL_Black2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.typeSelectorBtnHL_Black2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"TypeSelectorBtnHL_Black@3x\", withExtension: \"png\")`\n    static func typeSelectorBtnHL_Black3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.typeSelectorBtnHL_Black3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"TypeSelectorBtn_Black@2x\", withExtension: \"png\")`\n    static func typeSelectorBtn_Black2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.typeSelectorBtn_Black2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"TypeSelectorBtn_Black@3x\", withExtension: \"png\")`\n    static func typeSelectorBtn_Black3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.typeSelectorBtn_Black3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_emotion_delete@2x\", withExtension: \"png\")`\n    static func ic_emotion_delete2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_emotion_delete2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_emotion_delete@3x\", withExtension: \"png\")`\n    static func ic_emotion_delete3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_emotion_delete3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_album@2x\", withExtension: \"png\")`\n    static func ic_more_album2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_album2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_album@3x\", withExtension: \"png\")`\n    static func ic_more_album3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_album3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_camera@2x\", withExtension: \"png\")`\n    static func ic_more_camera2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_camera2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_camera@3x\", withExtension: \"png\")`\n    static func ic_more_camera3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_camera3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_favorite@2x\", withExtension: \"png\")`\n    static func ic_more_favorite2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_favorite2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_favorite@3x\", withExtension: \"png\")`\n    static func ic_more_favorite3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_favorite3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_friendcard@2x\", withExtension: \"png\")`\n    static func ic_more_friendcard2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_friendcard2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_friendcard@3x\", withExtension: \"png\")`\n    static func ic_more_friendcard3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_friendcard3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_location@2x\", withExtension: \"png\")`\n    static func ic_more_location2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_location2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_location@3x\", withExtension: \"png\")`\n    static func ic_more_location3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_location3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_pay@2x\", withExtension: \"png\")`\n    static func ic_more_pay2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_pay2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_pay@3x\", withExtension: \"png\")`\n    static func ic_more_pay3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_pay3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_sight@2x\", withExtension: \"png\")`\n    static func ic_more_sight2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_sight2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_sight@3x\", withExtension: \"png\")`\n    static func ic_more_sight3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_sight3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_video@2x\", withExtension: \"png\")`\n    static func ic_more_video2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_video2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_video@3x\", withExtension: \"png\")`\n    static func ic_more_video3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_video3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_voice@2x\", withExtension: \"png\")`\n    static func ic_more_voice2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_voice2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_voice@3x\", withExtension: \"png\")`\n    static func ic_more_voice3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_voice3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_wallet@2x\", withExtension: \"png\")`\n    static func ic_more_wallet2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_wallet2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"ic_more_wallet@3x\", withExtension: \"png\")`\n    static func ic_more_wallet3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.ic_more_wallet3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"icon_emoji_expression@2x\", withExtension: \"png\")`\n    static func icon_emoji_expression2xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.icon_emoji_expression2xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"icon_emoji_expression@3x\", withExtension: \"png\")`\n    static func icon_emoji_expression3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.icon_emoji_expression3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"icon_qrc_border@3x\", withExtension: \"png\")`\n    static func icon_qrc_border3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.icon_qrc_border3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"icon_qrc_line@3x\", withExtension: \"png\")`\n    static func icon_qrc_line3xPng(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.icon_qrc_line3xPng\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"localVideo0\", withExtension: \"mp4\")`\n    static func localVideo0Mp4(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.localVideo0Mp4\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"moments1\", withExtension: \"json\")`\n    static func moments1Json(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.moments1Json\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    /// `bundle.url(forResource: \"moments2\", withExtension: \"json\")`\n    static func moments2Json(_: Void = ()) -> Foundation.URL? {\n      let fileResource = R.file.moments2Json\n      return fileResource.bundle.url(forResource: fileResource)\n    }\n\n    fileprivate init() {}\n  }\n\n  /// This `R.image` struct is generated, and contains static references to 69 images.\n  struct image {\n    /// Image `LaunchImage`.\n    static let launchImage = Rswift.ImageResource(bundle: R.hostingBundle, name: \"LaunchImage\")\n    /// Image `MessageVideoDownload`.\n    static let messageVideoDownload = Rswift.ImageResource(bundle: R.hostingBundle, name: \"MessageVideoDownload\")\n    /// Image `MessageVideoPlay`.\n    static let messageVideoPlay = Rswift.ImageResource(bundle: R.hostingBundle, name: \"MessageVideoPlay\")\n    /// Image `ReceiverImageNodeBorder`.\n    static let receiverImageNodeBorder = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ReceiverImageNodeBorder\")\n    /// Image `ToolViewEmotionHL`.\n    static let toolViewEmotionHL = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ToolViewEmotionHL\")\n    /// Image `ToolViewEmotion`.\n    static let toolViewEmotion = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ToolViewEmotion\")\n    /// Image `ToolViewInputVoiceHL`.\n    static let toolViewInputVoiceHL = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ToolViewInputVoiceHL\")\n    /// Image `ToolViewInputVoice`.\n    static let toolViewInputVoice = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ToolViewInputVoice\")\n    /// Image `ToolViewKeyboardHL`.\n    static let toolViewKeyboardHL = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ToolViewKeyboardHL\")\n    /// Image `ToolViewKeyboard`.\n    static let toolViewKeyboard = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ToolViewKeyboard\")\n    /// Image `TypeSelectorBtnHL_Black`.\n    static let typeSelectorBtnHL_Black = Rswift.ImageResource(bundle: R.hostingBundle, name: \"TypeSelectorBtnHL_Black\")\n    /// Image `TypeSelectorBtn_Black`.\n    static let typeSelectorBtn_Black = Rswift.ImageResource(bundle: R.hostingBundle, name: \"TypeSelectorBtn_Black\")\n    /// Image `ic_album_reflash`.\n    static let ic_album_reflash = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_album_reflash\")\n    /// Image `ic_avatar_placeholder`.\n    static let ic_avatar_placeholder = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_avatar_placeholder\")\n    /// Image `ic_comment_normal`.\n    static let ic_comment_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_comment_normal\")\n    /// Image `ic_comment_selected`.\n    static let ic_comment_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_comment_selected\")\n    /// Image `ic_emotion_delete`.\n    static let ic_emotion_delete = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_emotion_delete\")\n    /// Image `ic_group_placeholder`.\n    static let ic_group_placeholder = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_group_placeholder\")\n    /// Image `ic_list_selection`.\n    static let ic_list_selection = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_list_selection\")\n    /// Image `ic_more_album`.\n    static let ic_more_album = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_album\")\n    /// Image `ic_more_camera`.\n    static let ic_more_camera = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_camera\")\n    /// Image `ic_more_favorite`.\n    static let ic_more_favorite = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_favorite\")\n    /// Image `ic_more_friendcard`.\n    static let ic_more_friendcard = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_friendcard\")\n    /// Image `ic_more_location`.\n    static let ic_more_location = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_location\")\n    /// Image `ic_more_pay`.\n    static let ic_more_pay = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_pay\")\n    /// Image `ic_more_sight`.\n    static let ic_more_sight = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_sight\")\n    /// Image `ic_more_video`.\n    static let ic_more_video = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_video\")\n    /// Image `ic_more_voice`.\n    static let ic_more_voice = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_voice\")\n    /// Image `ic_more_wallet`.\n    static let ic_more_wallet = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_more_wallet\")\n    /// Image `ic_msg_forward_n`.\n    static let ic_msg_forward_n = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_msg_forward_n\")\n    /// Image `ic_msg_forward_s`.\n    static let ic_msg_forward_s = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_msg_forward_s\")\n    /// Image `ic_placeholder`.\n    static let ic_placeholder = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_placeholder\")\n    /// Image `ic_star_normal`.\n    static let ic_star_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_star_normal\")\n    /// Image `ic_star_selected`.\n    static let ic_star_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_star_selected\")\n    /// Image `ic_tabbar01_normal`.\n    static let ic_tabbar01_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar01_normal\")\n    /// Image `ic_tabbar01_selected`.\n    static let ic_tabbar01_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar01_selected\")\n    /// Image `ic_tabbar02_normal`.\n    static let ic_tabbar02_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar02_normal\")\n    /// Image `ic_tabbar02_selected`.\n    static let ic_tabbar02_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar02_selected\")\n    /// Image `ic_tabbar03_normal`.\n    static let ic_tabbar03_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar03_normal\")\n    /// Image `ic_tabbar03_selected`.\n    static let ic_tabbar03_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar03_selected\")\n    /// Image `ic_tabbar04_normal`.\n    static let ic_tabbar04_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar04_normal\")\n    /// Image `ic_tabbar04_selected`.\n    static let ic_tabbar04_selected = Rswift.ImageResource(bundle: R.hostingBundle, name: \"ic_tabbar04_selected\")\n    /// Image `icon_arrow_right`.\n    static let icon_arrow_right = Rswift.ImageResource(bundle: R.hostingBundle, name: \"icon_arrow_right\")\n    /// Image `icon_emoji_expression`.\n    static let icon_emoji_expression = Rswift.ImageResource(bundle: R.hostingBundle, name: \"icon_emoji_expression\")\n    /// Image `icon_more_add`.\n    static let icon_more_add = Rswift.ImageResource(bundle: R.hostingBundle, name: \"icon_more_add\")\n    /// Image `icon_qrc_border`.\n    static let icon_qrc_border = Rswift.ImageResource(bundle: R.hostingBundle, name: \"icon_qrc_border\")\n    /// Image `icon_qrc_line`.\n    static let icon_qrc_line = Rswift.ImageResource(bundle: R.hostingBundle, name: \"icon_qrc_line\")\n    /// Image `message_receiver_background_highlight`.\n    static let message_receiver_background_highlight = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_receiver_background_highlight\")\n    /// Image `message_receiver_background_normal`.\n    static let message_receiver_background_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_receiver_background_normal\")\n    /// Image `message_receiver_background_reversed`.\n    static let message_receiver_background_reversed = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_receiver_background_reversed\")\n    /// Image `message_sender_background_highlight`.\n    static let message_sender_background_highlight = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_sender_background_highlight\")\n    /// Image `message_sender_background_normal`.\n    static let message_sender_background_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_sender_background_normal\")\n    /// Image `message_sender_background_reversed`.\n    static let message_sender_background_reversed = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_sender_background_reversed\")\n    /// Image `message_voice_receiver_normal`.\n    static let message_voice_receiver_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_receiver_normal\")\n    /// Image `message_voice_receiver_playing_1`.\n    static let message_voice_receiver_playing_1 = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_receiver_playing_1\")\n    /// Image `message_voice_receiver_playing_2`.\n    static let message_voice_receiver_playing_2 = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_receiver_playing_2\")\n    /// Image `message_voice_receiver_playing_3`.\n    static let message_voice_receiver_playing_3 = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_receiver_playing_3\")\n    /// Image `message_voice_sender_normal`.\n    static let message_voice_sender_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_sender_normal\")\n    /// Image `message_voice_sender_playing_1`.\n    static let message_voice_sender_playing_1 = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_sender_playing_1\")\n    /// Image `message_voice_sender_playing_2`.\n    static let message_voice_sender_playing_2 = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_sender_playing_2\")\n    /// Image `message_voice_sender_playing_3`.\n    static let message_voice_sender_playing_3 = Rswift.ImageResource(bundle: R.hostingBundle, name: \"message_voice_sender_playing_3\")\n    /// Image `nav_back_black`.\n    static let nav_back_black = Rswift.ImageResource(bundle: R.hostingBundle, name: \"nav_back_black\")\n    /// Image `nav_back_white`.\n    static let nav_back_white = Rswift.ImageResource(bundle: R.hostingBundle, name: \"nav_back_white\")\n    /// Image `nav_camera_black`.\n    static let nav_camera_black = Rswift.ImageResource(bundle: R.hostingBundle, name: \"nav_camera_black\")\n    /// Image `nav_camera_white`.\n    static let nav_camera_white = Rswift.ImageResource(bundle: R.hostingBundle, name: \"nav_camera_white\")\n    /// Image `play_btn_normal`.\n    static let play_btn_normal = Rswift.ImageResource(bundle: R.hostingBundle, name: \"play_btn_normal\")\n    /// Image `play_btn_pressed`.\n    static let play_btn_pressed = Rswift.ImageResource(bundle: R.hostingBundle, name: \"play_btn_pressed\")\n    /// Image `player_back_button`.\n    static let player_back_button = Rswift.ImageResource(bundle: R.hostingBundle, name: \"player_back_button\")\n    /// Image `player_suspend_button`.\n    static let player_suspend_button = Rswift.ImageResource(bundle: R.hostingBundle, name: \"player_suspend_button\")\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"LaunchImage\", bundle: ..., traitCollection: ...)`\n    static func launchImage(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.launchImage, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"MessageVideoDownload\", bundle: ..., traitCollection: ...)`\n    static func messageVideoDownload(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.messageVideoDownload, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"MessageVideoPlay\", bundle: ..., traitCollection: ...)`\n    static func messageVideoPlay(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.messageVideoPlay, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ReceiverImageNodeBorder\", bundle: ..., traitCollection: ...)`\n    static func receiverImageNodeBorder(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.receiverImageNodeBorder, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ToolViewEmotion\", bundle: ..., traitCollection: ...)`\n    static func toolViewEmotion(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.toolViewEmotion, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ToolViewEmotionHL\", bundle: ..., traitCollection: ...)`\n    static func toolViewEmotionHL(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.toolViewEmotionHL, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ToolViewInputVoice\", bundle: ..., traitCollection: ...)`\n    static func toolViewInputVoice(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.toolViewInputVoice, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ToolViewInputVoiceHL\", bundle: ..., traitCollection: ...)`\n    static func toolViewInputVoiceHL(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.toolViewInputVoiceHL, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ToolViewKeyboard\", bundle: ..., traitCollection: ...)`\n    static func toolViewKeyboard(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.toolViewKeyboard, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ToolViewKeyboardHL\", bundle: ..., traitCollection: ...)`\n    static func toolViewKeyboardHL(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.toolViewKeyboardHL, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"TypeSelectorBtnHL_Black\", bundle: ..., traitCollection: ...)`\n    static func typeSelectorBtnHL_Black(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.typeSelectorBtnHL_Black, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"TypeSelectorBtn_Black\", bundle: ..., traitCollection: ...)`\n    static func typeSelectorBtn_Black(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.typeSelectorBtn_Black, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_album_reflash\", bundle: ..., traitCollection: ...)`\n    static func ic_album_reflash(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_album_reflash, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_avatar_placeholder\", bundle: ..., traitCollection: ...)`\n    static func ic_avatar_placeholder(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_avatar_placeholder, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_comment_normal\", bundle: ..., traitCollection: ...)`\n    static func ic_comment_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_comment_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_comment_selected\", bundle: ..., traitCollection: ...)`\n    static func ic_comment_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_comment_selected, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_emotion_delete\", bundle: ..., traitCollection: ...)`\n    static func ic_emotion_delete(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_emotion_delete, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_group_placeholder\", bundle: ..., traitCollection: ...)`\n    static func ic_group_placeholder(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_group_placeholder, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_list_selection\", bundle: ..., traitCollection: ...)`\n    static func ic_list_selection(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_list_selection, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_album\", bundle: ..., traitCollection: ...)`\n    static func ic_more_album(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_album, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_camera\", bundle: ..., traitCollection: ...)`\n    static func ic_more_camera(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_camera, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_favorite\", bundle: ..., traitCollection: ...)`\n    static func ic_more_favorite(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_favorite, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_friendcard\", bundle: ..., traitCollection: ...)`\n    static func ic_more_friendcard(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_friendcard, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_location\", bundle: ..., traitCollection: ...)`\n    static func ic_more_location(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_location, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_pay\", bundle: ..., traitCollection: ...)`\n    static func ic_more_pay(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_pay, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_sight\", bundle: ..., traitCollection: ...)`\n    static func ic_more_sight(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_sight, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_video\", bundle: ..., traitCollection: ...)`\n    static func ic_more_video(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_video, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_voice\", bundle: ..., traitCollection: ...)`\n    static func ic_more_voice(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_voice, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_more_wallet\", bundle: ..., traitCollection: ...)`\n    static func ic_more_wallet(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_more_wallet, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_msg_forward_n\", bundle: ..., traitCollection: ...)`\n    static func ic_msg_forward_n(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_msg_forward_n, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_msg_forward_s\", bundle: ..., traitCollection: ...)`\n    static func ic_msg_forward_s(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_msg_forward_s, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_placeholder\", bundle: ..., traitCollection: ...)`\n    static func ic_placeholder(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_placeholder, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_star_normal\", bundle: ..., traitCollection: ...)`\n    static func ic_star_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_star_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_star_selected\", bundle: ..., traitCollection: ...)`\n    static func ic_star_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_star_selected, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar01_normal\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar01_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar01_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar01_selected\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar01_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar01_selected, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar02_normal\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar02_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar02_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar02_selected\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar02_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar02_selected, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar03_normal\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar03_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar03_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar03_selected\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar03_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar03_selected, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar04_normal\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar04_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar04_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"ic_tabbar04_selected\", bundle: ..., traitCollection: ...)`\n    static func ic_tabbar04_selected(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.ic_tabbar04_selected, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"icon_arrow_right\", bundle: ..., traitCollection: ...)`\n    static func icon_arrow_right(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.icon_arrow_right, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"icon_emoji_expression\", bundle: ..., traitCollection: ...)`\n    static func icon_emoji_expression(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.icon_emoji_expression, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"icon_more_add\", bundle: ..., traitCollection: ...)`\n    static func icon_more_add(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.icon_more_add, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"icon_qrc_border\", bundle: ..., traitCollection: ...)`\n    static func icon_qrc_border(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.icon_qrc_border, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"icon_qrc_line\", bundle: ..., traitCollection: ...)`\n    static func icon_qrc_line(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.icon_qrc_line, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_receiver_background_highlight\", bundle: ..., traitCollection: ...)`\n    static func message_receiver_background_highlight(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_receiver_background_highlight, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_receiver_background_normal\", bundle: ..., traitCollection: ...)`\n    static func message_receiver_background_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_receiver_background_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_receiver_background_reversed\", bundle: ..., traitCollection: ...)`\n    static func message_receiver_background_reversed(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_receiver_background_reversed, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_sender_background_highlight\", bundle: ..., traitCollection: ...)`\n    static func message_sender_background_highlight(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_sender_background_highlight, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_sender_background_normal\", bundle: ..., traitCollection: ...)`\n    static func message_sender_background_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_sender_background_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_sender_background_reversed\", bundle: ..., traitCollection: ...)`\n    static func message_sender_background_reversed(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_sender_background_reversed, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_receiver_normal\", bundle: ..., traitCollection: ...)`\n    static func message_voice_receiver_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_receiver_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_receiver_playing_1\", bundle: ..., traitCollection: ...)`\n    static func message_voice_receiver_playing_1(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_receiver_playing_1, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_receiver_playing_2\", bundle: ..., traitCollection: ...)`\n    static func message_voice_receiver_playing_2(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_receiver_playing_2, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_receiver_playing_3\", bundle: ..., traitCollection: ...)`\n    static func message_voice_receiver_playing_3(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_receiver_playing_3, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_sender_normal\", bundle: ..., traitCollection: ...)`\n    static func message_voice_sender_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_sender_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_sender_playing_1\", bundle: ..., traitCollection: ...)`\n    static func message_voice_sender_playing_1(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_sender_playing_1, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_sender_playing_2\", bundle: ..., traitCollection: ...)`\n    static func message_voice_sender_playing_2(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_sender_playing_2, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"message_voice_sender_playing_3\", bundle: ..., traitCollection: ...)`\n    static func message_voice_sender_playing_3(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.message_voice_sender_playing_3, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"nav_back_black\", bundle: ..., traitCollection: ...)`\n    static func nav_back_black(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.nav_back_black, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"nav_back_white\", bundle: ..., traitCollection: ...)`\n    static func nav_back_white(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.nav_back_white, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"nav_camera_black\", bundle: ..., traitCollection: ...)`\n    static func nav_camera_black(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.nav_camera_black, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"nav_camera_white\", bundle: ..., traitCollection: ...)`\n    static func nav_camera_white(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.nav_camera_white, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"play_btn_normal\", bundle: ..., traitCollection: ...)`\n    static func play_btn_normal(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.play_btn_normal, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"play_btn_pressed\", bundle: ..., traitCollection: ...)`\n    static func play_btn_pressed(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.play_btn_pressed, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"player_back_button\", bundle: ..., traitCollection: ...)`\n    static func player_back_button(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.player_back_button, compatibleWith: traitCollection)\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// `UIImage(named: \"player_suspend_button\", bundle: ..., traitCollection: ...)`\n    static func player_suspend_button(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIImage? {\n      return UIKit.UIImage(resource: R.image.player_suspend_button, compatibleWith: traitCollection)\n    }\n    #endif\n\n    fileprivate init() {}\n  }\n\n  /// This `R.string` struct is generated, and contains static references to 2 localization tables.\n  struct string {\n    /// This `R.string.infoPlist` struct is generated, and contains static references to 3 localization keys.\n    struct infoPlist {\n      /// en translation: App requests your permission to access the photos in the gallery.\n      ///\n      /// Locales: en, zh-Hans\n      static let nsPhotoLibraryAddUsageDescription = Rswift.StringResource(key: \"NSPhotoLibraryAddUsageDescription\", tableName: \"InfoPlist\", bundle: R.hostingBundle, locales: [\"en\", \"zh-Hans\"], comment: nil)\n      /// en translation: App requests your permission to access the photos in the gallery.\n      ///\n      /// Locales: en, zh-Hans\n      static let nsPhotoLibraryUsageDescription = Rswift.StringResource(key: \"NSPhotoLibraryUsageDescription\", tableName: \"InfoPlist\", bundle: R.hostingBundle, locales: [\"en\", \"zh-Hans\"], comment: nil)\n      /// en translation: To scan the QR code, do you allow using the camera?\n      ///\n      /// Locales: en, zh-Hans\n      static let nsCameraUsageDescription = Rswift.StringResource(key: \"NSCameraUsageDescription\", tableName: \"InfoPlist\", bundle: R.hostingBundle, locales: [\"en\", \"zh-Hans\"], comment: nil)\n\n      /// en translation: App requests your permission to access the photos in the gallery.\n      ///\n      /// Locales: en, zh-Hans\n      static func nsPhotoLibraryAddUsageDescription(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"NSPhotoLibraryAddUsageDescription\", tableName: \"InfoPlist\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"InfoPlist\", preferredLanguages: preferredLanguages) else {\n          return \"NSPhotoLibraryAddUsageDescription\"\n        }\n\n        return NSLocalizedString(\"NSPhotoLibraryAddUsageDescription\", tableName: \"InfoPlist\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: App requests your permission to access the photos in the gallery.\n      ///\n      /// Locales: en, zh-Hans\n      static func nsPhotoLibraryUsageDescription(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"NSPhotoLibraryUsageDescription\", tableName: \"InfoPlist\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"InfoPlist\", preferredLanguages: preferredLanguages) else {\n          return \"NSPhotoLibraryUsageDescription\"\n        }\n\n        return NSLocalizedString(\"NSPhotoLibraryUsageDescription\", tableName: \"InfoPlist\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: To scan the QR code, do you allow using the camera?\n      ///\n      /// Locales: en, zh-Hans\n      static func nsCameraUsageDescription(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"NSCameraUsageDescription\", tableName: \"InfoPlist\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"InfoPlist\", preferredLanguages: preferredLanguages) else {\n          return \"NSCameraUsageDescription\"\n        }\n\n        return NSLocalizedString(\"NSCameraUsageDescription\", tableName: \"InfoPlist\", bundle: bundle, comment: \"\")\n      }\n\n      fileprivate init() {}\n    }\n\n    /// This `R.string.localizable` struct is generated, and contains static references to 79 localization keys.\n    struct localizable {\n      /// en translation: Add Friends\n      ///\n      /// Locales: en\n      static let 添加好友 = Rswift.StringResource(key: \"添加好友\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Add Friends\n      ///\n      /// Locales: en\n      static let 添加朋友 = Rswift.StringResource(key: \"添加朋友\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: After deletion, the session record will also be cleared\n      ///\n      /// Locales: en\n      static let 删除后会话记录也将清除 = Rswift.StringResource(key: \"删除后，会话记录也将清除\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Aim the viewfinder at the QR code and it can be scanned automatically\n      ///\n      /// Locales: en\n      static let 将取景框对准二维码即可自动扫描 = Rswift.StringResource(key: \"将取景框对准二维码，即可自动扫描\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Album\n      ///\n      /// Locales: en\n      static let 图片 = Rswift.StringResource(key: \"图片\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: All unread messages cleared\n      ///\n      /// Locales: en\n      static let 已清除全部未读消息数 = Rswift.StringResource(key: \"已清除全部未读消息数\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Are you sure to delete all friends?\n      ///\n      /// Locales: en\n      static let 确定删除全部好友吗 = Rswift.StringResource(key: \"确定删除全部好友吗？\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Are you sure to delete all groups?\n      ///\n      /// Locales: en\n      static let 确定删除全部群组吗 = Rswift.StringResource(key: \"确定删除全部群组吗？\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Are you sure to delete this friend?\n      ///\n      /// Locales: en\n      static let 确定删除该好友吗 = Rswift.StringResource(key: \"确定删除该好友吗？\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Are you sure you want to leave the current group?\n      ///\n      /// Locales: en\n      static let 确定退出当前群组吗 = Rswift.StringResource(key: \"确定退出当前群组吗？\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Author GitHub\n      ///\n      /// Locales: en\n      static let 作者github = Rswift.StringResource(key: \"作者github\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Camera\n      ///\n      /// Locales: en\n      static let 拍照 = Rswift.StringResource(key: \"拍照\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Cancel\n      ///\n      /// Locales: en\n      static let 取消 = Rswift.StringResource(key: \"取消\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Card\n      ///\n      /// Locales: en\n      static let 名片 = Rswift.StringResource(key: \"名片\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Chinese\n      ///\n      /// Locales: en\n      static let 简体中文 = Rswift.StringResource(key: \"简体中文\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Clear picture cache\n      ///\n      /// Locales: en\n      static let 清除图片缓存 = Rswift.StringResource(key: \"清除图片缓存\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Cleared success\n      ///\n      /// Locales: en\n      static let 清除成功 = Rswift.StringResource(key: \"清除成功\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Collection\n      ///\n      /// Locales: en\n      static let 收藏 = Rswift.StringResource(key: \"收藏\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Comment\n      ///\n      /// Locales: en\n      static let 评论 = Rswift.StringResource(key: \"评论\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Confirm\n      ///\n      /// Locales: en\n      static let 确定 = Rswift.StringResource(key: \"确定\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Copy\n      ///\n      /// Locales: en\n      static let 复制 = Rswift.StringResource(key: \"复制\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Delete\n      ///\n      /// Locales: en\n      static let 删除 = Rswift.StringResource(key: \"删除\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Delete all\n      ///\n      /// Locales: en\n      static let 删除所有好友 = Rswift.StringResource(key: \"删除所有好友\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Delete all\n      ///\n      /// Locales: en\n      static let 删除所有群组 = Rswift.StringResource(key: \"删除所有群组\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Drak\n      ///\n      /// Locales: en\n      static let 黑夜模式 = Rswift.StringResource(key: \"黑夜模式\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: English\n      ///\n      /// Locales: en\n      static let 英文 = Rswift.StringResource(key: \"英文\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Exit group\n      ///\n      /// Locales: en\n      static let 退出群 = Rswift.StringResource(key: \"退出群\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Follow system\n      ///\n      /// Locales: en\n      static let 跟随系统 = Rswift.StringResource(key: \"跟随系统\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Follow system setting\n      ///\n      /// Locales: en\n      static let 选取后将跟随系统设定模式 = Rswift.StringResource(key: \"选取后，将跟随系统设定模式\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Forward\n      ///\n      /// Locales: en\n      static let 消息转发 = Rswift.StringResource(key: \"消息转发\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Forward\n      ///\n      /// Locales: en\n      static let 转发 = Rswift.StringResource(key: \"转发\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Friday\n      ///\n      /// Locales: en\n      static let 星期五 = Rswift.StringResource(key: \"星期五\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Friends\n      ///\n      /// Locales: en\n      static let 好友 = Rswift.StringResource(key: \"好友\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Group\n      ///\n      /// Locales: en\n      static let 群组 = Rswift.StringResource(key: \"群组\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Group chat\n      ///\n      /// Locales: en\n      static let 发起群聊 = Rswift.StringResource(key: \"发起群聊\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Group chat\n      ///\n      /// Locales: en\n      static let 群聊 = Rswift.StringResource(key: \"群聊\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Hide\n      ///\n      /// Locales: en\n      static let 隐藏 = Rswift.StringResource(key: \"隐藏\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Is the latest version\n      ///\n      /// Locales: en\n      static let 已是最新版本 = Rswift.StringResource(key: \"已是最新版本\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Join group\n      ///\n      /// Locales: en\n      static let 加入群 = Rswift.StringResource(key: \"加入群\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Language settings\n      ///\n      /// Locales: en\n      static let 语言设置 = Rswift.StringResource(key: \"语言设置\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Light\n      ///\n      /// Locales: en\n      static let 白天模式 = Rswift.StringResource(key: \"白天模式\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Location\n      ///\n      /// Locales: en\n      static let 位置 = Rswift.StringResource(key: \"位置\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Mine\n      ///\n      /// Locales: en\n      static let 我 = Rswift.StringResource(key: \"我\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Modify remark name\n      ///\n      /// Locales: en\n      static let 修改备注名称 = Rswift.StringResource(key: \"修改备注名称\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Monday\n      ///\n      /// Locales: en\n      static let 星期一 = Rswift.StringResource(key: \"星期一\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Network disconnected\n      ///\n      /// Locales: en\n      static let 当前网络已断开 = Rswift.StringResource(key: \"当前网络已断开\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Personal information\n      ///\n      /// Locales: en\n      static let 个人信息 = Rswift.StringResource(key: \"个人信息\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Please enter...\n      ///\n      /// Locales: en\n      static let 请输入 = Rswift.StringResource(key: \"请输入...\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Read all\n      ///\n      /// Locales: en\n      static let 全部已读 = Rswift.StringResource(key: \"全部已读\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Remark name no more than 12 words\n      ///\n      /// Locales: en\n      static let 备注名称不超过12个字 = Rswift.StringResource(key: \"备注名称不超过12个字\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Remark name:\n      ///\n      /// Locales: en\n      static let 备注名 = Rswift.StringResource(key: \"备注名：\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Saturday\n      ///\n      /// Locales: en\n      static let 星期六 = Rswift.StringResource(key: \"星期六\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Save\n      ///\n      /// Locales: en\n      static let 保存 = Rswift.StringResource(key: \"保存\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Saving\n      ///\n      /// Locales: en\n      static let 正在保存 = Rswift.StringResource(key: \"正在保存...\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Scan\n      ///\n      /// Locales: en\n      static let 扫一扫 = Rswift.StringResource(key: \"扫一扫\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Send\n      ///\n      /// Locales: en\n      static let 发送 = Rswift.StringResource(key: \"发送\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Sending\n      ///\n      /// Locales: en\n      static let 发消息 = Rswift.StringResource(key: \"发消息\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Session\n      ///\n      /// Locales: en\n      static let 会话 = Rswift.StringResource(key: \"会话\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Setting remark name\n      ///\n      /// Locales: en\n      static let 设置备注名 = Rswift.StringResource(key: \"设置备注名\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Settings\n      ///\n      /// Locales: en\n      static let 设置 = Rswift.StringResource(key: \"设置\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Single chat\n      ///\n      /// Locales: en\n      static let 发起单聊 = Rswift.StringResource(key: \"发起单聊\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Star\n      ///\n      /// Locales: en\n      static let 赞 = Rswift.StringResource(key: \"赞\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Sunday\n      ///\n      /// Locales: en\n      static let 星期日 = Rswift.StringResource(key: \"星期日\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Theme mode\n      ///\n      /// Locales: en\n      static let 主题模式 = Rswift.StringResource(key: \"主题模式\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Thursday\n      ///\n      /// Locales: en\n      static let 星期四 = Rswift.StringResource(key: \"星期四\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Tips\n      ///\n      /// Locales: en\n      static let 温馨提示 = Rswift.StringResource(key: \"温馨提示\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Today\n      ///\n      /// Locales: en\n      static let 今天 = Rswift.StringResource(key: \"今天\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Transfer\n      ///\n      /// Locales: en\n      static let 转账 = Rswift.StringResource(key: \"转账\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Tuesday\n      ///\n      /// Locales: en\n      static let 星期二 = Rswift.StringResource(key: \"星期二\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Username:\n      ///\n      /// Locales: en\n      static let 用户名 = Rswift.StringResource(key: \"用户名：\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Version\n      ///\n      /// Locales: en\n      static let 版本 = Rswift.StringResource(key: \"版本\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Version number:\n      ///\n      /// Locales: en\n      static let 版本号 = Rswift.StringResource(key: \"版本号:\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Video\n      ///\n      /// Locales: en\n      static let 视频 = Rswift.StringResource(key: \"视频\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Voice\n      ///\n      /// Locales: en\n      static let 语音 = Rswift.StringResource(key: \"语音\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Wallet\n      ///\n      /// Locales: en\n      static let 钱包 = Rswift.StringResource(key: \"钱包\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Wechat Moments\n      ///\n      /// Locales: en\n      static let 朋友圈 = Rswift.StringResource(key: \"朋友圈\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Wednesday\n      ///\n      /// Locales: en\n      static let 星期三 = Rswift.StringResource(key: \"星期三\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: Yesterday\n      ///\n      /// Locales: en\n      static let 昨天 = Rswift.StringResource(key: \"昨天\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n      /// en translation: You have quit %@ group chat\n      ///\n      /// Locales: en\n      static let 你已退出群聊 = Rswift.StringResource(key: \"你已退出%@群聊\", tableName: \"Localizable\", bundle: R.hostingBundle, locales: [\"en\"], comment: nil)\n\n      /// en translation: Add Friends\n      ///\n      /// Locales: en\n      static func 添加好友(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"添加好友\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"添加好友\"\n        }\n\n        return NSLocalizedString(\"添加好友\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Add Friends\n      ///\n      /// Locales: en\n      static func 添加朋友(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"添加朋友\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"添加朋友\"\n        }\n\n        return NSLocalizedString(\"添加朋友\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: After deletion, the session record will also be cleared\n      ///\n      /// Locales: en\n      static func 删除后会话记录也将清除(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"删除后，会话记录也将清除\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"删除后，会话记录也将清除\"\n        }\n\n        return NSLocalizedString(\"删除后，会话记录也将清除\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Aim the viewfinder at the QR code and it can be scanned automatically\n      ///\n      /// Locales: en\n      static func 将取景框对准二维码即可自动扫描(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"将取景框对准二维码，即可自动扫描\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"将取景框对准二维码，即可自动扫描\"\n        }\n\n        return NSLocalizedString(\"将取景框对准二维码，即可自动扫描\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Album\n      ///\n      /// Locales: en\n      static func 图片(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"图片\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"图片\"\n        }\n\n        return NSLocalizedString(\"图片\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: All unread messages cleared\n      ///\n      /// Locales: en\n      static func 已清除全部未读消息数(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"已清除全部未读消息数\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"已清除全部未读消息数\"\n        }\n\n        return NSLocalizedString(\"已清除全部未读消息数\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Are you sure to delete all friends?\n      ///\n      /// Locales: en\n      static func 确定删除全部好友吗(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"确定删除全部好友吗？\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"确定删除全部好友吗？\"\n        }\n\n        return NSLocalizedString(\"确定删除全部好友吗？\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Are you sure to delete all groups?\n      ///\n      /// Locales: en\n      static func 确定删除全部群组吗(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"确定删除全部群组吗？\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"确定删除全部群组吗？\"\n        }\n\n        return NSLocalizedString(\"确定删除全部群组吗？\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Are you sure to delete this friend?\n      ///\n      /// Locales: en\n      static func 确定删除该好友吗(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"确定删除该好友吗？\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"确定删除该好友吗？\"\n        }\n\n        return NSLocalizedString(\"确定删除该好友吗？\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Are you sure you want to leave the current group?\n      ///\n      /// Locales: en\n      static func 确定退出当前群组吗(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"确定退出当前群组吗？\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"确定退出当前群组吗？\"\n        }\n\n        return NSLocalizedString(\"确定退出当前群组吗？\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Author GitHub\n      ///\n      /// Locales: en\n      static func 作者github(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"作者github\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"作者github\"\n        }\n\n        return NSLocalizedString(\"作者github\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Camera\n      ///\n      /// Locales: en\n      static func 拍照(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"拍照\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"拍照\"\n        }\n\n        return NSLocalizedString(\"拍照\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Cancel\n      ///\n      /// Locales: en\n      static func 取消(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"取消\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"取消\"\n        }\n\n        return NSLocalizedString(\"取消\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Card\n      ///\n      /// Locales: en\n      static func 名片(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"名片\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"名片\"\n        }\n\n        return NSLocalizedString(\"名片\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Chinese\n      ///\n      /// Locales: en\n      static func 简体中文(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"简体中文\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"简体中文\"\n        }\n\n        return NSLocalizedString(\"简体中文\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Clear picture cache\n      ///\n      /// Locales: en\n      static func 清除图片缓存(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"清除图片缓存\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"清除图片缓存\"\n        }\n\n        return NSLocalizedString(\"清除图片缓存\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Cleared success\n      ///\n      /// Locales: en\n      static func 清除成功(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"清除成功\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"清除成功\"\n        }\n\n        return NSLocalizedString(\"清除成功\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Collection\n      ///\n      /// Locales: en\n      static func 收藏(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"收藏\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"收藏\"\n        }\n\n        return NSLocalizedString(\"收藏\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Comment\n      ///\n      /// Locales: en\n      static func 评论(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"评论\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"评论\"\n        }\n\n        return NSLocalizedString(\"评论\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Confirm\n      ///\n      /// Locales: en\n      static func 确定(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"确定\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"确定\"\n        }\n\n        return NSLocalizedString(\"确定\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Copy\n      ///\n      /// Locales: en\n      static func 复制(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"复制\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"复制\"\n        }\n\n        return NSLocalizedString(\"复制\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Delete\n      ///\n      /// Locales: en\n      static func 删除(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"删除\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"删除\"\n        }\n\n        return NSLocalizedString(\"删除\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Delete all\n      ///\n      /// Locales: en\n      static func 删除所有好友(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"删除所有好友\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"删除所有好友\"\n        }\n\n        return NSLocalizedString(\"删除所有好友\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Delete all\n      ///\n      /// Locales: en\n      static func 删除所有群组(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"删除所有群组\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"删除所有群组\"\n        }\n\n        return NSLocalizedString(\"删除所有群组\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Drak\n      ///\n      /// Locales: en\n      static func 黑夜模式(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"黑夜模式\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"黑夜模式\"\n        }\n\n        return NSLocalizedString(\"黑夜模式\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: English\n      ///\n      /// Locales: en\n      static func 英文(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"英文\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"英文\"\n        }\n\n        return NSLocalizedString(\"英文\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Exit group\n      ///\n      /// Locales: en\n      static func 退出群(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"退出群\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"退出群\"\n        }\n\n        return NSLocalizedString(\"退出群\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Follow system\n      ///\n      /// Locales: en\n      static func 跟随系统(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"跟随系统\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"跟随系统\"\n        }\n\n        return NSLocalizedString(\"跟随系统\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Follow system setting\n      ///\n      /// Locales: en\n      static func 选取后将跟随系统设定模式(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"选取后，将跟随系统设定模式\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"选取后，将跟随系统设定模式\"\n        }\n\n        return NSLocalizedString(\"选取后，将跟随系统设定模式\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Forward\n      ///\n      /// Locales: en\n      static func 消息转发(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"消息转发\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"消息转发\"\n        }\n\n        return NSLocalizedString(\"消息转发\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Forward\n      ///\n      /// Locales: en\n      static func 转发(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"转发\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"转发\"\n        }\n\n        return NSLocalizedString(\"转发\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Friday\n      ///\n      /// Locales: en\n      static func 星期五(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"星期五\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"星期五\"\n        }\n\n        return NSLocalizedString(\"星期五\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Friends\n      ///\n      /// Locales: en\n      static func 好友(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"好友\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"好友\"\n        }\n\n        return NSLocalizedString(\"好友\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Group\n      ///\n      /// Locales: en\n      static func 群组(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"群组\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"群组\"\n        }\n\n        return NSLocalizedString(\"群组\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Group chat\n      ///\n      /// Locales: en\n      static func 发起群聊(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"发起群聊\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"发起群聊\"\n        }\n\n        return NSLocalizedString(\"发起群聊\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Group chat\n      ///\n      /// Locales: en\n      static func 群聊(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"群聊\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"群聊\"\n        }\n\n        return NSLocalizedString(\"群聊\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Hide\n      ///\n      /// Locales: en\n      static func 隐藏(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"隐藏\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"隐藏\"\n        }\n\n        return NSLocalizedString(\"隐藏\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Is the latest version\n      ///\n      /// Locales: en\n      static func 已是最新版本(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"已是最新版本\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"已是最新版本\"\n        }\n\n        return NSLocalizedString(\"已是最新版本\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Join group\n      ///\n      /// Locales: en\n      static func 加入群(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"加入群\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"加入群\"\n        }\n\n        return NSLocalizedString(\"加入群\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Language settings\n      ///\n      /// Locales: en\n      static func 语言设置(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"语言设置\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"语言设置\"\n        }\n\n        return NSLocalizedString(\"语言设置\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Light\n      ///\n      /// Locales: en\n      static func 白天模式(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"白天模式\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"白天模式\"\n        }\n\n        return NSLocalizedString(\"白天模式\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Location\n      ///\n      /// Locales: en\n      static func 位置(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"位置\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"位置\"\n        }\n\n        return NSLocalizedString(\"位置\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Mine\n      ///\n      /// Locales: en\n      static func 我(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"我\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"我\"\n        }\n\n        return NSLocalizedString(\"我\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Modify remark name\n      ///\n      /// Locales: en\n      static func 修改备注名称(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"修改备注名称\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"修改备注名称\"\n        }\n\n        return NSLocalizedString(\"修改备注名称\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Monday\n      ///\n      /// Locales: en\n      static func 星期一(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"星期一\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"星期一\"\n        }\n\n        return NSLocalizedString(\"星期一\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Network disconnected\n      ///\n      /// Locales: en\n      static func 当前网络已断开(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"当前网络已断开\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"当前网络已断开\"\n        }\n\n        return NSLocalizedString(\"当前网络已断开\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Personal information\n      ///\n      /// Locales: en\n      static func 个人信息(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"个人信息\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"个人信息\"\n        }\n\n        return NSLocalizedString(\"个人信息\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Please enter...\n      ///\n      /// Locales: en\n      static func 请输入(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"请输入...\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"请输入...\"\n        }\n\n        return NSLocalizedString(\"请输入...\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Read all\n      ///\n      /// Locales: en\n      static func 全部已读(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"全部已读\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"全部已读\"\n        }\n\n        return NSLocalizedString(\"全部已读\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Remark name no more than 12 words\n      ///\n      /// Locales: en\n      static func 备注名称不超过12个字(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"备注名称不超过12个字\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"备注名称不超过12个字\"\n        }\n\n        return NSLocalizedString(\"备注名称不超过12个字\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Remark name:\n      ///\n      /// Locales: en\n      static func 备注名(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"备注名：\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"备注名：\"\n        }\n\n        return NSLocalizedString(\"备注名：\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Saturday\n      ///\n      /// Locales: en\n      static func 星期六(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"星期六\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"星期六\"\n        }\n\n        return NSLocalizedString(\"星期六\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Save\n      ///\n      /// Locales: en\n      static func 保存(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"保存\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"保存\"\n        }\n\n        return NSLocalizedString(\"保存\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Saving\n      ///\n      /// Locales: en\n      static func 正在保存(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"正在保存...\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"正在保存...\"\n        }\n\n        return NSLocalizedString(\"正在保存...\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Scan\n      ///\n      /// Locales: en\n      static func 扫一扫(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"扫一扫\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"扫一扫\"\n        }\n\n        return NSLocalizedString(\"扫一扫\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Send\n      ///\n      /// Locales: en\n      static func 发送(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"发送\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"发送\"\n        }\n\n        return NSLocalizedString(\"发送\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Sending\n      ///\n      /// Locales: en\n      static func 发消息(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"发消息\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"发消息\"\n        }\n\n        return NSLocalizedString(\"发消息\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Session\n      ///\n      /// Locales: en\n      static func 会话(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"会话\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"会话\"\n        }\n\n        return NSLocalizedString(\"会话\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Setting remark name\n      ///\n      /// Locales: en\n      static func 设置备注名(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"设置备注名\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"设置备注名\"\n        }\n\n        return NSLocalizedString(\"设置备注名\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Settings\n      ///\n      /// Locales: en\n      static func 设置(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"设置\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"设置\"\n        }\n\n        return NSLocalizedString(\"设置\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Single chat\n      ///\n      /// Locales: en\n      static func 发起单聊(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"发起单聊\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"发起单聊\"\n        }\n\n        return NSLocalizedString(\"发起单聊\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Star\n      ///\n      /// Locales: en\n      static func 赞(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"赞\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"赞\"\n        }\n\n        return NSLocalizedString(\"赞\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Sunday\n      ///\n      /// Locales: en\n      static func 星期日(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"星期日\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"星期日\"\n        }\n\n        return NSLocalizedString(\"星期日\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Theme mode\n      ///\n      /// Locales: en\n      static func 主题模式(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"主题模式\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"主题模式\"\n        }\n\n        return NSLocalizedString(\"主题模式\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Thursday\n      ///\n      /// Locales: en\n      static func 星期四(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"星期四\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"星期四\"\n        }\n\n        return NSLocalizedString(\"星期四\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Tips\n      ///\n      /// Locales: en\n      static func 温馨提示(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"温馨提示\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"温馨提示\"\n        }\n\n        return NSLocalizedString(\"温馨提示\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Today\n      ///\n      /// Locales: en\n      static func 今天(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"今天\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"今天\"\n        }\n\n        return NSLocalizedString(\"今天\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Transfer\n      ///\n      /// Locales: en\n      static func 转账(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"转账\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"转账\"\n        }\n\n        return NSLocalizedString(\"转账\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Tuesday\n      ///\n      /// Locales: en\n      static func 星期二(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"星期二\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"星期二\"\n        }\n\n        return NSLocalizedString(\"星期二\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Username:\n      ///\n      /// Locales: en\n      static func 用户名(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"用户名：\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"用户名：\"\n        }\n\n        return NSLocalizedString(\"用户名：\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Version\n      ///\n      /// Locales: en\n      static func 版本(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"版本\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"版本\"\n        }\n\n        return NSLocalizedString(\"版本\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Version number:\n      ///\n      /// Locales: en\n      static func 版本号(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"版本号:\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"版本号:\"\n        }\n\n        return NSLocalizedString(\"版本号:\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Video\n      ///\n      /// Locales: en\n      static func 视频(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"视频\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"视频\"\n        }\n\n        return NSLocalizedString(\"视频\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Voice\n      ///\n      /// Locales: en\n      static func 语音(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"语音\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"语音\"\n        }\n\n        return NSLocalizedString(\"语音\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Wallet\n      ///\n      /// Locales: en\n      static func 钱包(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"钱包\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"钱包\"\n        }\n\n        return NSLocalizedString(\"钱包\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Wechat Moments\n      ///\n      /// Locales: en\n      static func 朋友圈(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"朋友圈\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"朋友圈\"\n        }\n\n        return NSLocalizedString(\"朋友圈\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Wednesday\n      ///\n      /// Locales: en\n      static func 星期三(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"星期三\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"星期三\"\n        }\n\n        return NSLocalizedString(\"星期三\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: Yesterday\n      ///\n      /// Locales: en\n      static func 昨天(preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          return NSLocalizedString(\"昨天\", bundle: hostingBundle, comment: \"\")\n        }\n\n        guard let (_, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"昨天\"\n        }\n\n        return NSLocalizedString(\"昨天\", bundle: bundle, comment: \"\")\n      }\n\n      /// en translation: You have quit %@ group chat\n      ///\n      /// Locales: en\n      static func 你已退出群聊(_ value1: String, preferredLanguages: [String]? = nil) -> String {\n        guard let preferredLanguages = preferredLanguages else {\n          let format = NSLocalizedString(\"你已退出%@群聊\", bundle: hostingBundle, comment: \"\")\n          return String(format: format, locale: applicationLocale, value1)\n        }\n\n        guard let (locale, bundle) = localeBundle(tableName: \"Localizable\", preferredLanguages: preferredLanguages) else {\n          return \"你已退出%@群聊\"\n        }\n\n        let format = NSLocalizedString(\"你已退出%@群聊\", bundle: bundle, comment: \"\")\n        return String(format: format, locale: locale, value1)\n      }\n\n      fileprivate init() {}\n    }\n\n    fileprivate init() {}\n  }\n\n  fileprivate struct intern: Rswift.Validatable {\n    fileprivate static func validate() throws {\n      try _R.validate()\n    }\n\n    fileprivate init() {}\n  }\n\n  fileprivate class Class {}\n\n  fileprivate init() {}\n}\n\nstruct _R: Rswift.Validatable {\n  static func validate() throws {\n    #if os(iOS) || os(tvOS)\n    try storyboard.validate()\n    #endif\n  }\n\n  #if os(iOS) || os(tvOS)\n  struct storyboard: Rswift.Validatable {\n    static func validate() throws {\n      #if os(iOS) || os(tvOS)\n      try launchScreen.validate()\n      #endif\n    }\n\n    #if os(iOS) || os(tvOS)\n    struct launchScreen: Rswift.StoryboardResourceWithInitialControllerType, Rswift.Validatable {\n      typealias InitialController = UIKit.UIViewController\n\n      let bundle = R.hostingBundle\n      let name = \"LaunchScreen\"\n\n      static func validate() throws {\n        if #available(iOS 11.0, tvOS 11.0, *) {\n        }\n      }\n\n      fileprivate init() {}\n    }\n    #endif\n\n    fileprivate init() {}\n  }\n  #endif\n\n  fileprivate init() {}\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupDismissAnimator.swift",
    "content": "//\n//  DraggableDismissAnimator.swift\n//  PresentationController\n//\n//  Created by Emre on 11.09.2018.\n//  Copyright © 2018 Emre. All rights reserved.\n//\n\nimport UIKit\n\nfinal class BottomPopupDismissAnimator: NSObject, UIViewControllerAnimatedTransitioning {\n    private unowned var attributesOwner: BottomPresentableViewController\n    \n    init(attributesOwner: BottomPresentableViewController) {\n        self.attributesOwner = attributesOwner\n    }\n    \n    func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {\n        return attributesOwner.popupDismissDuration\n    }\n    \n    func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {\n        let fromVC = transitionContext.viewController(forKey: .from)!\n        let dismissFrame = CGRect(origin: CGPoint(x: 0, y: UIScreen.main.bounds.size.height), size: fromVC.view.frame.size)\n        \n        UIView.animate(withDuration: transitionDuration(using: transitionContext), animations: {\n            fromVC.view.frame = dismissFrame\n        }) { (_) in\n            transitionContext.completeTransition(!transitionContext.transitionWasCancelled)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupDismissInteractionController.swift",
    "content": "//\n//  DraggableDismissInteractionController.swift\n//  PresentationController\n//\n//  Created by Emre on 11.09.2018.\n//  Copyright © 2018 Emre. All rights reserved.\n//\n\nimport UIKit\n\nprotocol BottomPopupDismissInteractionControllerDelegate: class {\n    func dismissInteractionPercentChanged(from oldValue: CGFloat, to newValue: CGFloat)\n}\n\nfinal class BottomPopupDismissInteractionController: UIPercentDrivenInteractiveTransition {\n    private let kMinPercentOfVisiblePartToCompleteAnimation = CGFloat(0.5)\n    private let kSwipeDownThreshold = CGFloat(1000)\n    private weak var presentedViewController: BottomPresentableViewController?\n    private weak var transitioningDelegate: BottomPopupTransitionHandler?\n    private unowned var attributesDelegate: BottomPopupAttributesDelegate\n    weak var delegate: BottomPopupDismissInteractionControllerDelegate?\n    \n    private var currentPercent: CGFloat = 0 {\n        didSet {\n            delegate?.dismissInteractionPercentChanged(from: oldValue, to: currentPercent)\n        }\n    }\n    \n    init(presentedViewController: BottomPresentableViewController?, attributesDelegate: BottomPopupAttributesDelegate) {\n        self.presentedViewController = presentedViewController\n        self.transitioningDelegate = presentedViewController?.transitioningDelegate as? BottomPopupTransitionHandler\n        self.attributesDelegate = attributesDelegate\n        super.init()\n        preparePanGesture(in: presentedViewController?.view)\n    }\n    \n    private func finishAnimation(withVelocity velocity: CGPoint) {\n        if currentPercent > kMinPercentOfVisiblePartToCompleteAnimation || velocity.y > kSwipeDownThreshold {\n            finish()\n        } else {\n            cancel()\n        }\n    }\n    \n    private func preparePanGesture(in view: UIView?) {\n        let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:)))\n        presentedViewController?.view?.addGestureRecognizer(panGesture)\n    }\n    \n    @objc private func handlePanGesture(_ pan: UIPanGestureRecognizer) {\n        guard attributesDelegate.popupShouldBeganDismiss else { return }\n            \n        let translationY = pan.translation(in: presentedViewController?.view).y\n        currentPercent = min(max(translationY/(presentedViewController?.view.frame.size.height ?? 0), 0), 1)\n        \n        switch pan.state {\n        case .began:\n            transitioningDelegate?.isInteractiveDismissStarted = true\n            presentedViewController?.dismiss(animated: true, completion: nil)\n        case .changed:\n            update(currentPercent)\n        default:\n            let velocity = pan.velocity(in: presentedViewController?.view)\n            transitioningDelegate?.isInteractiveDismissStarted = false\n            finishAnimation(withVelocity: velocity)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupNavigationController.swift",
    "content": "//\n//  BottomPopupNavigationController.swift\n//  BottomPopup\n//\n//  Created by Emre on 11.10.2018.\n//  Copyright © 2018 Emre. All rights reserved.\n//\n\nimport UIKit\n\n@objcMembers class BottomPopupNavigationController: UINavigationController, BottomPopupAttributesDelegate {\n    \n    private var transitionHandler: BottomPopupTransitionHandler?\n    open weak var popupDelegate: BottomPopupDelegate?\n    \n    // MARK: Initializations\n    \n    override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {\n        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)\n        \n        initialize()\n    }\n    \n    public override init(rootViewController: UIViewController) {\n        super.init(rootViewController: rootViewController)\n        \n        initialize()\n    }\n    \n    required public init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        \n        initialize()\n    }\n    \n    open override func viewDidLoad() {\n        super.viewDidLoad()\n        \n        transitionHandler?.notifyViewLoaded(withPopupDelegate: popupDelegate)\n        popupDelegate?.bottomPopupViewLoaded()\n        self.view.accessibilityIdentifier = popupViewAccessibilityIdentifier\n    }\n    \n    override open func viewWillAppear(_ animated: Bool) {\n        super.viewWillAppear(animated)\n        \n        curveTopCorners()\n        popupDelegate?.bottomPopupWillAppear()\n    }\n    \n    open override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        \n        popupDelegate?.bottomPopupDidAppear()\n    }\n    \n    open override func viewWillDisappear(_ animated: Bool) {\n        super.viewWillDisappear(animated)\n        \n        popupDelegate?.bottomPopupWillDismiss()\n    }\n    \n    open override func viewDidDisappear(_ animated: Bool) {\n        super.viewDidDisappear(animated)\n        \n        popupDelegate?.bottomPopupDidDismiss()\n    }\n    \n    //MARK: Private Methods\n    \n    private func initialize() {\n        transitionHandler = BottomPopupTransitionHandler(popupViewController: self)\n        transitioningDelegate = transitionHandler\n        modalPresentationStyle = .custom\n    }\n    \n    private func curveTopCorners() {\n        let path = UIBezierPath(roundedRect: self.view.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: popupTopCornerRadius, height: 0))\n        let maskLayer = CAShapeLayer()\n        maskLayer.frame = self.view.bounds\n        maskLayer.path = path.cgPath\n        self.view.layer.mask = maskLayer\n    }\n    \n    //MARK: BottomPopupAttributesDelegate Variables\n    \n    open var popupHeight: CGFloat { return BottomPopupConstants.kDefaultHeight }\n    \n    open var popupTopCornerRadius: CGFloat { return BottomPopupConstants.kDefaultTopCornerRadius }\n    \n    open var popupPresentDuration: Double { return BottomPopupConstants.kDefaultPresentDuration }\n    \n    open var popupDismissDuration: Double { return BottomPopupConstants.kDefaultDismissDuration }\n    \n    open var popupShouldDismissInteractivelty: Bool { return BottomPopupConstants.dismissInteractively }\n    \n    open var popupDimmingViewAlpha: CGFloat { return BottomPopupConstants.kDimmingViewDefaultAlphaValue }\n    \n    open var popupShouldBeganDismiss: Bool { return BottomPopupConstants.shouldBeganDismiss }\n    \n    open var popupViewAccessibilityIdentifier: String { return BottomPopupConstants.defaultPopupViewAccessibilityIdentifier }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupPresentAnimator.swift",
    "content": "//\n//  DraggablePresentAnimator.swift\n//  PresentationController\n//\n//  Created by Emre on 11.09.2018.\n//  Copyright © 2018 Emre. All rights reserved.\n//\n\nimport UIKit\n\nfinal class BottomPopupPresentAnimator: NSObject, UIViewControllerAnimatedTransitioning {\n    private unowned var attributesOwner: BottomPresentableViewController\n    \n    init(attributesOwner: BottomPresentableViewController) {\n        self.attributesOwner = attributesOwner\n    }\n    \n    func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {\n        return attributesOwner.popupPresentDuration\n    }\n    \n    func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {\n        let toVC = transitionContext.viewController(forKey: .to)!\n        transitionContext.containerView.addSubview(toVC.view)\n        let presentFrame = transitionContext.finalFrame(for: toVC)\n        let initialFrame = CGRect(origin: CGPoint(x: 0, y: UIScreen.main.bounds.size.height), size: presentFrame.size)\n        toVC.view.frame = initialFrame\n        UIView.animate(withDuration: transitionDuration(using: transitionContext), animations: {\n            toVC.view.frame = presentFrame\n        }) { (_) in\n            transitionContext.completeTransition(true)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupPresentationController.swift",
    "content": "//\n//  BottomPopupPresentationController.swift\n//  PresentationController\n//\n//  Created by Emre on 11.09.2018.\n//  Copyright © 2018 Emre. All rights reserved.\n//\n\nimport UIKit\n\n@objcMembers final class BottomPopupPresentationController: UIPresentationController {\n    private var dimmingView: UIView!\n    private unowned var attributesDelegate: BottomPopupAttributesDelegate\n    \n    override var frameOfPresentedViewInContainerView: CGRect {\n        get {\n            return CGRect(origin: CGPoint(x: 0, y: UIScreen.main.bounds.size.height - attributesDelegate.popupHeight), size: CGSize(width: presentedViewController.view.frame.size.width, height: attributesDelegate.popupHeight))\n        }\n    }\n    \n    private func changeDimmingViewAlphaAlongWithAnimation(to alpha: CGFloat) {\n        guard let coordinator = presentedViewController.transitionCoordinator else {\n            dimmingView.backgroundColor = UIColor.black.withAlphaComponent(alpha)\n            return\n        }\n        \n        coordinator.animate(alongsideTransition: { _ in\n            self.dimmingView.backgroundColor = UIColor.black.withAlphaComponent(alpha)\n        })\n    }\n    \n    init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?, attributesDelegate: BottomPopupAttributesDelegate) {\n        self.attributesDelegate = attributesDelegate\n        super.init(presentedViewController: presentedViewController, presenting: presentingViewController)\n        setupDimmingView()\n    }\n    \n    override func containerViewWillLayoutSubviews() {\n        presentedView?.frame = frameOfPresentedViewInContainerView\n    }\n    \n    override func presentationTransitionWillBegin() {\n        containerView?.insertSubview(dimmingView, at: 0)\n        changeDimmingViewAlphaAlongWithAnimation(to: attributesDelegate.popupDimmingViewAlpha)\n    }\n    \n    override func dismissalTransitionWillBegin() {\n        changeDimmingViewAlphaAlongWithAnimation(to: 0)\n    }\n    \n    @objc private func handleTap(_ tap: UITapGestureRecognizer) {\n        guard attributesDelegate.popupShouldBeganDismiss else { return }\n        presentedViewController.dismiss(animated: true, completion: nil)\n    }\n    \n    @objc private func handleSwipe(_ swipe: UISwipeGestureRecognizer) {\n        guard attributesDelegate.popupShouldBeganDismiss else { return }\n        presentedViewController.dismiss(animated: true, completion: nil)\n    }\n}\n\nprivate extension BottomPopupPresentationController {\n    func setupDimmingView() {\n        dimmingView = UIView()\n        dimmingView.frame = CGRect(origin: .zero, size: UIScreen.main.bounds.size)\n        dimmingView.backgroundColor = UIColor.black.withAlphaComponent(0)\n        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))\n        let swipeGesture = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipe(_:)))\n        swipeGesture.direction = [.down, .up]\n        dimmingView.isUserInteractionEnabled = true\n        [tapGesture, swipeGesture].forEach { dimmingView.addGestureRecognizer($0) }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupTransitionHandler.swift",
    "content": "//\n//  DraggableTransitioningDelegate.swift\n//  PresentationController\n//\n//  Created by Emre on 11.09.2018.\n//  Copyright © 2018 Emre. All rights reserved.\n//\n\nimport UIKit\n\nfinal class BottomPopupTransitionHandler: NSObject, UIViewControllerTransitioningDelegate {\n    private let presentAnimator: BottomPopupPresentAnimator\n    private let dismissAnimator: BottomPopupDismissAnimator\n    private var interactionController: BottomPopupDismissInteractionController?\n    private unowned var popupViewController: BottomPresentableViewController\n    fileprivate weak var popupDelegate: BottomPopupDelegate?\n    \n    var isInteractiveDismissStarted = false\n    \n    init(popupViewController: BottomPresentableViewController) {\n        self.popupViewController = popupViewController\n        \n        presentAnimator = BottomPopupPresentAnimator(attributesOwner: popupViewController)\n        dismissAnimator = BottomPopupDismissAnimator(attributesOwner: popupViewController)\n    }\n    \n    //MARK: Public\n    func notifyViewLoaded(withPopupDelegate delegate: BottomPopupDelegate?) {\n        self.popupDelegate = delegate\n        if popupViewController.popupShouldDismissInteractivelty {\n            interactionController = BottomPopupDismissInteractionController(presentedViewController: popupViewController, attributesDelegate: popupViewController)\n            interactionController?.delegate = self\n        }\n    }\n    \n    //MARK: Specific animators\n    func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {\n        return BottomPopupPresentationController(presentedViewController: presented, presenting: presenting, attributesDelegate: popupViewController)\n    }\n    \n    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {\n        return presentAnimator\n    }\n    \n    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {\n        return dismissAnimator\n    }\n    \n    func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {\n        return isInteractiveDismissStarted ? interactionController : nil\n    }\n}\n\nextension BottomPopupTransitionHandler: BottomPopupDismissInteractionControllerDelegate {\n    func dismissInteractionPercentChanged(from oldValue: CGFloat, to newValue: CGFloat) {\n        popupDelegate?.bottomPopupDismissInteractionPercentChanged(from: oldValue, to: newValue)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupUtils.swift",
    "content": "//\n//  BottomPopupUtils.swift\n//  BottomPopup\n//\n//  Created by Emre on 11.10.2018.\n//  Copyright © 2018 Emre. All rights reserved.\n//\n\nimport UIKit\n\ntypealias BottomPresentableViewController = BottomPopupAttributesDelegate & UIViewController\n\npublic protocol BottomPopupDelegate: AnyObject {\n    func bottomPopupViewLoaded()\n    func bottomPopupWillAppear()\n    func bottomPopupDidAppear()\n    func bottomPopupWillDismiss()\n    func bottomPopupDidDismiss()\n    func bottomPopupDismissInteractionPercentChanged(from oldValue: CGFloat, to newValue: CGFloat)\n}\n\npublic extension BottomPopupDelegate {\n    func bottomPopupViewLoaded() { }\n    func bottomPopupWillAppear() { }\n    func bottomPopupDidAppear() { }\n    func bottomPopupWillDismiss() { }\n    func bottomPopupDidDismiss() { }\n    func bottomPopupDismissInteractionPercentChanged(from oldValue: CGFloat, to newValue: CGFloat) { }\n}\n\npublic protocol BottomPopupAttributesDelegate: AnyObject {\n    var popupHeight: CGFloat { get }\n    var popupTopCornerRadius: CGFloat { get }\n    var popupPresentDuration: Double { get }\n    var popupDismissDuration: Double { get }\n    var popupShouldDismissInteractivelty: Bool { get }\n    var popupDimmingViewAlpha: CGFloat { get }\n    var popupShouldBeganDismiss: Bool { get }\n    var popupViewAccessibilityIdentifier: String { get }\n}\n\npublic struct BottomPopupConstants {\n    static let kDefaultHeight: CGFloat = 377.0\n    static let kDefaultTopCornerRadius: CGFloat = 10.0\n    static let kDefaultPresentDuration = 0.5\n    static let kDefaultDismissDuration = 0.5\n    static let dismissInteractively = true\n    static let shouldBeganDismiss = true\n    static let kDimmingViewDefaultAlphaValue: CGFloat = 0.5\n    static let defaultPopupViewAccessibilityIdentifier: String = \"bottomPopupView\"\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/BottomPopupViewController.swift",
    "content": "//\n//  BottomPopupViewController.swift\n//  Trendyol\n//\n//  Created by Emre on 11.09.2018.\n//  Copyright © 2018 Trendyol.com. All rights reserved.\n//\n\nimport UIKit\n\n@objcMembers open class BottomPopupViewController: UIViewController, BottomPopupAttributesDelegate {\n    private var transitionHandler: BottomPopupTransitionHandler?\n    open weak var popupDelegate: BottomPopupDelegate?\n    \n    // MARK: Initializations\n    \n    override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {\n        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)\n        \n        initialize()\n    }\n    \n    required public init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        \n        initialize()\n    }\n    \n    open override func viewDidLoad() {\n        \n        super.viewDidLoad()\n        transitionHandler?.notifyViewLoaded(withPopupDelegate: popupDelegate)\n        popupDelegate?.bottomPopupViewLoaded()\n        self.view.accessibilityIdentifier = popupViewAccessibilityIdentifier\n    }\n    \n    open override  func viewWillAppear(_ animated: Bool) {\n        super.viewWillAppear(animated)\n        \n        curveTopCorners()\n        popupDelegate?.bottomPopupWillAppear()\n    }\n    \n    open override func viewDidAppear(_ animated: Bool) {\n        super.viewDidAppear(animated)\n        \n        popupDelegate?.bottomPopupDidAppear()\n    }\n    \n    open override func viewWillDisappear(_ animated: Bool) {\n        super.viewWillDisappear(animated)\n        \n        popupDelegate?.bottomPopupWillDismiss()\n    }\n    \n    open override func viewDidDisappear(_ animated: Bool) {\n        super.viewDidDisappear(animated)\n        \n        popupDelegate?.bottomPopupDidDismiss()\n    }\n    \n    //MARK: Private Methods\n    \n    private func initialize() {\n        transitionHandler = BottomPopupTransitionHandler(popupViewController: self)\n        transitioningDelegate = transitionHandler\n        modalPresentationStyle = .custom\n    }\n    \n    private func curveTopCorners() {\n        let path = UIBezierPath(roundedRect: self.view.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: popupTopCornerRadius, height: 0))\n        let maskLayer = CAShapeLayer()\n        maskLayer.frame = self.view.bounds\n        maskLayer.path = path.cgPath\n        self.view.layer.mask = maskLayer\n    }\n    \n    //MARK: BottomPopupAttributesDelegate Variables\n    \n    open var popupHeight: CGFloat { return BottomPopupConstants.kDefaultHeight }\n    \n    open var popupTopCornerRadius: CGFloat { return BottomPopupConstants.kDefaultTopCornerRadius }\n    \n    open var popupPresentDuration: Double { return BottomPopupConstants.kDefaultPresentDuration }\n    \n    open var popupDismissDuration: Double { return BottomPopupConstants.kDefaultDismissDuration }\n    \n    open var popupShouldDismissInteractivelty: Bool { return BottomPopupConstants.dismissInteractively }\n    \n    open var popupDimmingViewAlpha: CGFloat { return BottomPopupConstants.kDimmingViewDefaultAlphaValue }\n    \n    open var popupShouldBeganDismiss: Bool { return BottomPopupConstants.shouldBeganDismiss }\n    \n    open var popupViewAccessibilityIdentifier: String { return BottomPopupConstants.defaultPopupViewAccessibilityIdentifier }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/BottomPopupController/CSBottomPopupNavigationController.swift",
    "content": "//\n//  CSBottomPopupNavigationController.swift\n//  ConsensusStorage\n//\n//  Created by Apple on 2021/10/25.\n//  Copyright © 2021 Apple. All rights reserved.\n//\n\nimport UIKit\n\n@objcMembers class CSBottomPopupNavigationController: BottomPopupNavigationController {\n    \n    @objc var showHeight: CGFloat = 500\n    @objc var topCornerRadius: CGFloat = 10\n    @objc var presentDuration: Double = 0.25\n    @objc var dismissDuration: Double = 0.25\n    @objc var shouldDismissInteractivelty: Bool = true\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        // Do any additional setup after loading the view.\n    }\n\n    // Bottom popup attribute variables\n    // You can override the desired variable to change appearance\n    \n    override var popupHeight: CGFloat { return showHeight }\n    \n    override var popupTopCornerRadius: CGFloat { return topCornerRadius }\n    \n    override var popupPresentDuration: Double { return presentDuration }\n    \n    override var popupDismissDuration: Double { return dismissDuration }\n    \n    override var popupShouldDismissInteractivelty: Bool { return true }\n    \n    override var popupDimmingViewAlpha: CGFloat { return BottomPopupConstants.kDimmingViewDefaultAlphaValue }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/NavigationHandy/NSObject+BinAdd.h",
    "content": "//\n//  NSObject+BinAdd.h\n//  CommonElement\n//\n//  Created by 熊彬 on 16/6/3.\n//  Copyright © 2016年 熊彬. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\nNS_ASSUME_NONNULL_BEGIN\n@interface NSObject (BinAdd)\n\n#pragma mark - About Class\n///=============================================================================\n/// @name About Class\n///=============================================================================\n//类名\n- (NSString *)className;\n+ (NSString *)className;\n//父类名称\n- (NSString *)superClassName;\n+ (NSString *)superClassName;\n\n//实例属性字典\n-(NSDictionary *)propertyDictionary;\n\n//属性名称列表\n- (NSArray*)propertyKeys;\n+ (NSArray *)propertyKeys;\n\n//属性详细信息列表\n- (NSArray *)propertiesInfo;\n+ (NSArray *)propertiesInfo;\n\n//格式化后的属性列表\n+ (NSArray *)propertiesWithCodeFormat;\n\n//方法列表\n-(NSArray*)methodList;\n+(NSArray*)methodList;\n\n-(NSArray*)methodListInfo;\n\n//创建并返回一个指向所有已注册类的指针列表\n+ (NSArray *)registedClassList;\n//实例变量\n+ (NSArray *)instanceVariable;\n\n//协议列表\n-(NSDictionary *)protocolList;\n+ (NSDictionary *)protocolList;\n\n\n- (BOOL)hasPropertyForKey:(NSString*)key;\n- (BOOL)hasIvarForKey:(NSString*)key;\n\n#pragma mark - Swap method (Swizzling)\n///=============================================================================\n/// @name Swap method (Swizzling)\n///=============================================================================\n\n/**\n * 交换两个实例方法的实现.\n \n * @param originalSel   Selector 1.\n * @param newSel        Selector 2.\n * @return              YES if swizzling succeed; otherwise, NO.\n */\n+ (BOOL)swizzleInstanceMethod:(SEL)originalSel with:(SEL)newSel;\n\n/**\n * 交换类方法的实现\n \n * @param originalSel   Selector 1.\n * @param newSel        Selector 2.\n * @return              YES if swizzling succeed; otherwise, NO.\n */\n+ (BOOL)swizzleClassMethod:(SEL)originalSel with:(SEL)newSel;\n\n@end\nNS_ASSUME_NONNULL_END"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/NavigationHandy/NSObject+BinAdd.m",
    "content": "//\n//  NSObject+BinAdd.m\n//  CommonElement\n//\n//  Created by 熊彬 on 16/6/3.\n//  Copyright © 2016年 熊彬. All rights reserved.\n//\n\n#import \"NSObject+BinAdd.h\"\n#import <objc/objc.h>\n#import <objc/runtime.h>\n\n@implementation NSObject (BinAdd)\n- (NSString *)className\n{\n    return NSStringFromClass([self class]);\n}\n- (NSString *)superClassName\n{\n    return NSStringFromClass([self superclass]);\n}\n+ (NSString *)className\n{\n    return NSStringFromClass([self class]);\n}\n+ (NSString *)superClassName\n{\n    return NSStringFromClass([self superclass]);\n}\n-(NSDictionary *)propertyDictionary\n{\n    //创建可变字典\n    NSMutableDictionary *dict = [NSMutableDictionary dictionary];\n    unsigned int outCount;\n    objc_property_t *props = class_copyPropertyList([self class], &outCount);\n    for(int i=0;i<outCount;i++){\n        objc_property_t prop = props[i];\n        NSString *propName = [[NSString alloc]initWithCString:property_getName(prop) encoding:NSUTF8StringEncoding];\n        id propValue = [self valueForKey:propName];\n        [dict setObject:propValue?:[NSNull null] forKey:propName];\n    }\n    free(props);\n    return dict;\n}\n- (NSArray*)propertyKeys\n{\n    return [[self class] propertyKeys];\n}\n+ (NSArray *)propertyKeys {\n    unsigned int propertyCount = 0;\n    objc_property_t * properties = class_copyPropertyList(self, &propertyCount);\n    NSMutableArray * propertyNames = [NSMutableArray array];\n    for (unsigned int i = 0; i < propertyCount; ++i) {\n        objc_property_t property = properties[i];\n        const char * name = property_getName(property);\n        [propertyNames addObject:[NSString stringWithUTF8String:name]];\n    }\n    free(properties);\n    return propertyNames;\n}\n- (NSArray *)propertiesInfo\n{\n    return [[self class] propertiesInfo];\n}\n\n+ (NSArray *)propertiesInfo\n{\n    NSMutableArray *propertieArray = [NSMutableArray array];\n    \n    unsigned int propertyCount;\n    objc_property_t *properties = class_copyPropertyList([self class], &propertyCount);\n    \n    for (int i = 0; i < propertyCount; i++)\n    {\n        [propertieArray addObject:({\n            \n            NSDictionary *dictionary = [self dictionaryWithProperty:properties[i]];\n            \n            dictionary;\n        })];\n    }\n    \n    free(properties);\n    \n    return propertieArray;\n}\n+ (NSArray *)propertiesWithCodeFormat\n{\n    NSMutableArray *array = [NSMutableArray array];\n    \n    NSArray *properties = [[self class] propertiesInfo];\n    \n    for (NSDictionary *item in properties)\n    {\n        NSMutableString *format = ({\n            \n            NSMutableString *formatString = [NSMutableString stringWithFormat:@\"@property \"];\n            //attribute\n            NSArray *attribute = [item objectForKey:@\"attribute\"];\n            attribute = [attribute sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {\n                return [obj1 compare:obj2 options:NSNumericSearch];\n            }];\n            if (attribute && attribute.count > 0)\n            {\n                NSString *attributeStr = [NSString stringWithFormat:@\"(%@)\",[attribute componentsJoinedByString:@\", \"]];\n                \n                [formatString appendString:attributeStr];\n            }\n            \n            //type\n            NSString *type = [item objectForKey:@\"type\"];\n            if (type) {\n                [formatString appendString:@\" \"];\n                [formatString appendString:type];\n            }\n            \n            //name\n            NSString *name = [item objectForKey:@\"name\"];\n            if (name) {\n                [formatString appendString:@\" \"];\n                [formatString appendString:name];\n                [formatString appendString:@\";\"];\n            }\n            \n            formatString;\n        });\n        \n        [array addObject:format];\n    }\n    \n    return array;\n}\n-(NSArray*)methodList{\n    u_int               count;\n    NSMutableArray *methodList = [NSMutableArray array];\n    Method *methods= class_copyMethodList([self class], &count);\n    for (int i = 0; i < count ; i++)\n    {\n        SEL name = method_getName(methods[i]);\n        NSString *strName = [NSString  stringWithCString:sel_getName(name) encoding:NSUTF8StringEncoding];\n        [methodList addObject:strName];\n    }\n    free(methods);\n    return methodList;\n}\n-(NSArray*)methodListInfo{\n    u_int               count;\n    NSMutableArray *methodList = [NSMutableArray array];\n    Method *methods= class_copyMethodList([self class], &count);\n    for (int i = 0; i < count ; i++)\n    {\n        NSMutableDictionary *info = [NSMutableDictionary dictionary];\n        \n        Method method = methods[i];\n        //        IMP imp = method_getImplementation(method);\n        SEL name = method_getName(method);\n        // 返回方法的参数的个数\n        int argumentsCount = method_getNumberOfArguments(method);\n        //获取描述方法参数和返回值类型的字符串\n        const char *encoding =method_getTypeEncoding(method);\n        //取方法的返回值类型的字符串\n        const char *returnType =method_copyReturnType(method);\n        \n        NSMutableArray *arguments = [NSMutableArray array];\n        for (int index=0; index<argumentsCount; index++) {\n            // 获取方法的指定位置参数的类型字符串\n            char *arg =   method_copyArgumentType(method,index);\n            //            NSString *argString = [NSString stringWithCString:arg encoding:NSUTF8StringEncoding];\n            [arguments addObject:[[self class] decodeType:arg]];\n        }\n        \n        NSString *returnTypeString =[[self class] decodeType:returnType];\n        NSString *encodeString = [[self class] decodeType:encoding];\n        NSString *nameString = [NSString  stringWithCString:sel_getName(name) encoding:NSUTF8StringEncoding];\n        \n        [info setObject:arguments forKey:@\"arguments\"];\n        [info setObject:[NSString stringWithFormat:@\"%d\",argumentsCount] forKey:@\"argumentsCount\"];\n        [info setObject:returnTypeString forKey:@\"returnType\"];\n        [info setObject:encodeString forKey:@\"encode\"];\n        [info setObject:nameString forKey:@\"name\"];\n        //        [info setObject:imp_f forKey:@\"imp\"];\n        [methodList addObject:info];\n    }\n    free(methods);\n    return methodList;\n}\n+(NSArray*)methodList{\n    u_int               count;\n    NSMutableArray *methodList = [NSMutableArray array];\n    Method * methods= class_copyMethodList([self class], &count);\n    for (int i = 0; i < count ; i++)\n    {\n        SEL name = method_getName(methods[i]);\n        NSString *strName = [NSString  stringWithCString:sel_getName(name) encoding:NSUTF8StringEncoding];\n        [methodList addObject:strName];\n    }\n    free(methods);\n    \n    return methodList;\n}\n//创建并返回一个指向所有已注册类的指针列表\n+ (NSArray *)registedClassList\n{\n    NSMutableArray *result = [NSMutableArray array];\n    \n    unsigned int count;\n    Class *classes = objc_copyClassList(&count);\n    for (int i = 0; i < count; i++)\n    {\n        [result addObject:NSStringFromClass(classes[i])];\n    }\n    free(classes);\n    [result sortedArrayUsingSelector:@selector(compare:)];\n    \n    return result;\n}\n\n\n-(NSDictionary *)protocolList{\n    return [[self class]protocolList];\n}\n+ (NSDictionary *)protocolList\n{\n    NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];\n    \n    unsigned int count;\n    Protocol * __unsafe_unretained * protocols = class_copyProtocolList([self class], &count);\n    for (int i = 0; i < count; i++)\n    {\n        Protocol *protocol = protocols[i];\n        \n        NSString *protocolName = [NSString stringWithCString:protocol_getName(protocol) encoding:NSUTF8StringEncoding];\n        \n        NSMutableArray *superProtocolArray = ({\n            \n            NSMutableArray *array = [NSMutableArray array];\n            \n            unsigned int superProtocolCount;\n            Protocol * __unsafe_unretained * superProtocols = protocol_copyProtocolList(protocol, &superProtocolCount);\n            for (int ii = 0; ii < superProtocolCount; ii++)\n            {\n                Protocol *superProtocol = superProtocols[ii];\n                \n                NSString *superProtocolName = [NSString stringWithCString:protocol_getName(superProtocol) encoding:NSUTF8StringEncoding];\n                \n                [array addObject:superProtocolName];\n            }\n            free(superProtocols);\n            \n            array;\n        });\n        \n        [dictionary setObject:superProtocolArray forKey:protocolName];\n    }\n    free(protocols);\n    \n    return dictionary;\n}\n\n+ (NSArray *)instanceVariable\n{\n    unsigned int outCount;\n    Ivar *ivars = class_copyIvarList([self class], &outCount);\n    NSMutableArray *result = [NSMutableArray array];\n    for (int i = 0; i < outCount; i++) {\n        NSString *type = [[self class] decodeType:ivar_getTypeEncoding(ivars[i])];\n        NSString *name = [NSString stringWithCString:ivar_getName(ivars[i]) encoding:NSUTF8StringEncoding];\n        NSString *ivarDescription = [NSString stringWithFormat:@\"%@ %@\", type, name];\n        [result addObject:ivarDescription];\n    }\n    free(ivars);\n    return result.count ? [result copy] : nil;\n}\n\n- (BOOL)hasPropertyForKey:(NSString*)key\n{\n    objc_property_t property = class_getProperty([self class], [key UTF8String]);\n    return (BOOL)property;\n}\n- (BOOL)hasIvarForKey:(NSString*)key\n{\n    Ivar ivar = class_getInstanceVariable([self class], [key UTF8String]);\n    return (BOOL)ivar;\n}\n#pragma mark -- help\n+ (NSDictionary *)dictionaryWithProperty:(objc_property_t)property\n{\n    NSMutableDictionary *result = [NSMutableDictionary dictionary];\n    \n    //name\n    \n    NSString *propertyName = [NSString stringWithCString:property_getName(property) encoding:NSUTF8StringEncoding];\n    [result setObject:propertyName forKey:@\"name\"];\n    \n    //attribute\n    \n    NSMutableDictionary *attributeDictionary = ({\n        \n        NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];\n        \n        unsigned int attributeCount;\n        objc_property_attribute_t *attrs = property_copyAttributeList(property, &attributeCount);\n        \n        for (int i = 0; i < attributeCount; i++)\n        {\n            NSString *name = [NSString stringWithCString:attrs[i].name encoding:NSUTF8StringEncoding];\n            NSString *value = [NSString stringWithCString:attrs[i].value encoding:NSUTF8StringEncoding];\n            [dictionary setObject:value forKey:name];\n        }\n        \n        free(attrs);\n        \n        dictionary;\n    });\n    \n    NSMutableArray *attributeArray = [NSMutableArray array];\n    \n    /***\n     https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html#//apple_ref/doc/uid/TP40008048-CH101-SW6\n     \n     R           | The property is read-only (readonly).\n     C           | The property is a copy of the value last assigned (copy).\n     &           | The property is a reference to the value last assigned (retain).\n     N           | The property is non-atomic (nonatomic).\n     G<name>     | The property defines a custom getter selector name. The name follows the G (for example, GcustomGetter,).\n     S<name>     | The property defines a custom setter selector name. The name follows the S (for example, ScustomSetter:,).\n     D           | The property is dynamic (@dynamic).\n     W           | The property is a weak reference (__weak).\n     P           | The property is eligible for garbage collection.\n     t<encoding> | Specifies the type using old-style encoding.\n     */\n    \n    //R\n    if ([attributeDictionary objectForKey:@\"R\"])\n    {\n        [attributeArray addObject:@\"readonly\"];\n    }\n    //C\n    if ([attributeDictionary objectForKey:@\"C\"])\n    {\n        [attributeArray addObject:@\"copy\"];\n    }\n    //&\n    if ([attributeDictionary objectForKey:@\"&\"])\n    {\n        [attributeArray addObject:@\"strong\"];\n    }\n    //N\n    if ([attributeDictionary objectForKey:@\"N\"])\n    {\n        [attributeArray addObject:@\"nonatomic\"];\n    }\n    else\n    {\n        [attributeArray addObject:@\"atomic\"];\n    }\n    //G<name>\n    if ([attributeDictionary objectForKey:@\"G\"])\n    {\n        [attributeArray addObject:[NSString stringWithFormat:@\"getter=%@\", [attributeDictionary objectForKey:@\"G\"]]];\n    }\n    //S<name>\n    if ([attributeDictionary objectForKey:@\"S\"])\n    {\n        [attributeArray addObject:[NSString stringWithFormat:@\"setter=%@\", [attributeDictionary objectForKey:@\"G\"]]];\n    }\n    //D\n    if ([attributeDictionary objectForKey:@\"D\"])\n    {\n        [result setObject:[NSNumber numberWithBool:YES] forKey:@\"isDynamic\"];\n    }\n    else\n    {\n        [result setObject:[NSNumber numberWithBool:NO] forKey:@\"isDynamic\"];\n    }\n    //W\n    if ([attributeDictionary objectForKey:@\"W\"])\n    {\n        [attributeArray addObject:@\"weak\"];\n    }\n    //P\n    if ([attributeDictionary objectForKey:@\"P\"])\n    {\n        //TODO:P | The property is eligible for garbage collection.\n    }\n    //T\n    if ([attributeDictionary objectForKey:@\"T\"])\n    {\n        /*\n         https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html\n         c               A char\n         i               An int\n         s               A short\n         l               A long l is treated as a 32-bit quantity on 64-bit programs.\n         q               A long long\n         C               An unsigned char\n         I               An unsigned int\n         S               An unsigned short\n         L               An unsigned long\n         Q               An unsigned long long\n         f               A float\n         d               A double\n         B               A C++ bool or a C99 _Bool\n         v               A void\n         *               A character string (char *)\n         @               An object (whether statically typed or typed id)\n         #               A class object (Class)\n         :               A method selector (SEL)\n         [array type]    An array\n         {name=type...}  A structure\n         (name=type...)  A union\n         bnum            A bit field of num bits\n         ^type           A pointer to type\n         ?               An unknown type (among other things, this code is used for function pointers)\n         \n         */\n        \n        NSDictionary *typeDic = @{@\"c\":@\"char\",\n                                  @\"i\":@\"int\",\n                                  @\"s\":@\"short\",\n                                  @\"l\":@\"long\",\n                                  @\"q\":@\"long long\",\n                                  @\"C\":@\"unsigned char\",\n                                  @\"I\":@\"unsigned int\",\n                                  @\"S\":@\"unsigned short\",\n                                  @\"L\":@\"unsigned long\",\n                                  @\"Q\":@\"unsigned long long\",\n                                  @\"f\":@\"float\",\n                                  @\"d\":@\"double\",\n                                  @\"B\":@\"BOOL\",\n                                  @\"v\":@\"void\",\n                                  @\"*\":@\"char *\",\n                                  @\"@\":@\"id\",\n                                  @\"#\":@\"Class\",\n                                  @\":\":@\"SEL\",\n                                  };\n        //TODO:An array\n        NSString *key = [attributeDictionary objectForKey:@\"T\"];\n        \n        id type_str = [typeDic objectForKey:key];\n        \n        if (type_str == nil)\n        {\n            if ([[key substringToIndex:1] isEqualToString:@\"@\"] && [key rangeOfString:@\"?\"].location == NSNotFound)\n            {\n                type_str = [[key substringWithRange:NSMakeRange(2, key.length - 3)] stringByAppendingString:@\"*\"];\n            }\n            else if ([[key substringToIndex:1] isEqualToString:@\"^\"])\n            {\n                id str = [typeDic objectForKey:[key substringFromIndex:1]];\n                \n                if (str)\n                {\n                    type_str = [NSString stringWithFormat:@\"%@ *\",str];\n                }\n            }\n            else\n            {\n                type_str = @\"unknow\";\n            }\n        }\n        \n        [result setObject:type_str forKey:@\"type\"];\n    }\n    \n    [result setObject:attributeArray forKey:@\"attribute\"];\n    \n    return result;\n}\n+ (NSString *)decodeType:(const char *)cString\n{\n    if (!strcmp(cString, @encode(char)))\n        return @\"char\";\n    if (!strcmp(cString, @encode(int)))\n        return @\"int\";\n    if (!strcmp(cString, @encode(short)))\n        return @\"short\";\n    if (!strcmp(cString, @encode(long)))\n        return @\"long\";\n    if (!strcmp(cString, @encode(long long)))\n        return @\"long long\";\n    if (!strcmp(cString, @encode(unsigned char)))\n        return @\"unsigned char\";\n    if (!strcmp(cString, @encode(unsigned int)))\n        return @\"unsigned int\";\n    if (!strcmp(cString, @encode(unsigned short)))\n        return @\"unsigned short\";\n    if (!strcmp(cString, @encode(unsigned long)))\n        return @\"unsigned long\";\n    if (!strcmp(cString, @encode(unsigned long long)))\n        return @\"unsigned long long\";\n    if (!strcmp(cString, @encode(float)))\n        return @\"float\";\n    if (!strcmp(cString, @encode(double)))\n        return @\"double\";\n    if (!strcmp(cString, @encode(bool)))\n        return @\"bool\";\n    if (!strcmp(cString, @encode(_Bool)))\n        return @\"_Bool\";\n    if (!strcmp(cString, @encode(void)))\n        return @\"void\";\n    if (!strcmp(cString, @encode(char *)))\n        return @\"char *\";\n    if (!strcmp(cString, @encode(id)))\n        return @\"id\";\n    if (!strcmp(cString, @encode(Class)))\n        return @\"class\";\n    if (!strcmp(cString, @encode(SEL)))\n        return @\"SEL\";\n    if (!strcmp(cString, @encode(BOOL)))\n        return @\"BOOL\";\n    \n    //    NSDictionary *typeDic = @{@\"c\":@\"char\",\n    //                              @\"i\":@\"int\",\n    //                              @\"s\":@\"short\",\n    //                              @\"l\":@\"long\",\n    //                              @\"q\":@\"long long\",\n    //                              @\"C\":@\"unsigned char\",\n    //                              @\"I\":@\"unsigned int\",\n    //                              @\"S\":@\"unsigned short\",\n    //                              @\"L\":@\"unsigned long\",\n    //                              @\"Q\":@\"unsigned long long\",\n    //                              @\"f\":@\"float\",\n    //                              @\"d\":@\"double\",\n    //                              @\"B\":@\"BOOL\",\n    //                              @\"v\":@\"void\",\n    //                              @\"*\":@\"char *\",\n    //                              @\"@\":@\"id\",\n    //                              @\"#\":@\"Class\",\n    //                              @\":\":@\"SEL\",\n    //                              };\n    \n    //@TODO: do handle bitmasks\n    NSString *result = [NSString stringWithCString:cString encoding:NSUTF8StringEncoding];\n    //    if ([typeDic objectForKey:result]) {\n    //        return [typeDic objectForKey:result];\n    //    }\n    if ([[result substringToIndex:1] isEqualToString:@\"@\"] && [result rangeOfString:@\"?\"].location == NSNotFound) {\n        result = [[result substringWithRange:NSMakeRange(2, result.length - 3)] stringByAppendingString:@\"*\"];\n    } else\n    {\n        if ([[result substringToIndex:1] isEqualToString:@\"^\"]) {\n            result = [NSString stringWithFormat:@\"%@ *\",\n                      [NSString decodeType:[[result substringFromIndex:1] cStringUsingEncoding:NSUTF8StringEncoding]]];\n        }\n    }\n    return result;\n}\n\n+ (BOOL)swizzleInstanceMethod:(SEL)originalSel with:(SEL)newSel {\n    Method originalMethod = class_getInstanceMethod(self, originalSel);\n    Method newMethod = class_getInstanceMethod(self, newSel);\n    if (!originalMethod || !newMethod) return NO;\n    \n    class_addMethod(self,\n                    originalSel,\n                    class_getMethodImplementation(self, originalSel),\n                    method_getTypeEncoding(originalMethod));\n    class_addMethod(self,\n                    newSel,\n                    class_getMethodImplementation(self, newSel),\n                    method_getTypeEncoding(newMethod));\n    \n    method_exchangeImplementations(class_getInstanceMethod(self, originalSel),\n                                   class_getInstanceMethod(self, newSel));\n    return YES;\n}\n\n+ (BOOL)swizzleClassMethod:(SEL)originalSel with:(SEL)newSel {\n    Class class = object_getClass(self);\n    Method originalMethod = class_getInstanceMethod(class, originalSel);\n    Method newMethod = class_getInstanceMethod(class, newSel);\n    if (!originalMethod || !newMethod) return NO;\n    method_exchangeImplementations(originalMethod, newMethod);\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/NavigationHandy/UINavigationController+Extensions.h",
    "content": "//\n//  UINavigationController+Extensions.h\n//  IDCMWallet\n//\n//  Created by IDCM on 2018/5/21.\n//  Copyright © 2018年 IDCM. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UINavigationController (Extensions)\n\n\n\n/**\n 返回对应控制器 根据类名\n \n @param vcClassName 根据类名返回vc\n */\n- (UIViewController *)getViewControllerByname:(NSString *)vcClassName;\n\n/**\n 返回对应控制器 根据index\n \n @param index 根据index返回vc\n */\n- (UIViewController *)getViewControllerByIndex:(NSInteger )index;\n\n/**\n 返回对应的层 从前往后\n\n @param index 从前往后第几个 如果超过childs长度则返回root\n */\n- (void)popBackViewControllerToIndex:(NSInteger)index;\n\n/**\n 返回对应的层 从后往前\n \n @param index 从后往前第几个 如果超过childs长度则返回root\n */\n- (void)popBackViewControllerFromIndex:(NSInteger)index;\n\n/**\n 返回对应的层 根据类名\n \n @param vcClassName 根据类名返回到对应页面\n */\n- (void)popBackViewController:(NSString *)vcClassName;\n\n- (void)removeControllerWithName:(NSString *)name;\n- (void)removeControllerFromIndex:(NSInteger)index;\n- (void)removeControllerToIndex:(NSInteger)index;\n\n/**\n 判断是否包含类\n \n @param vcClassName 类名\n */\n- (BOOL)containViewController:(NSString *)vcClassName;\n\n/**\n 替换当前栈堆 控制器位置\n\n @param index 替换的位置 index\n @param replaceVC 替换的控制器\n */\n-(void)repleaseControllerAtIndex:(NSInteger )index withController:(UIViewController *)replaceVC;\n@end\n\n// UIViewController+BackButtonHandler.h\n@protocol BackButtonHandlerProtocol <NSObject>\n@optional\n// 重写下面的方法以拦截导航栏返回按钮点击事件，返回 YES 则 pop，NO 则不 pop\n-(BOOL)navigationShouldPopOnBackButton;\n@end\n\n@interface UIViewController (BackButtonHandler) <BackButtonHandlerProtocol>\n\n@end\n\n\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/NavigationHandy/UINavigationController+Extensions.m",
    "content": "//\n//  UINavigationController+Extensions.m\n//  IDCMWallet\n//\n//  Created by IDCM on 2018/5/21.\n//  Copyright © 2018年 IDCM. All rights reserved.\n//\n\n#import \"UINavigationController+Extensions.h\"\n#import \"NSObject+BinAdd.h\"\n\n@implementation UINavigationController (Extensions)\n- (void)popBackViewController:(NSString *)vcClassName{\n    UIViewController *vc;\n    for (UIViewController *childVC in self.childViewControllers) {\n        if ([childVC.className isEqualToString:vcClassName]) {\n            vc = childVC;\n            break;\n        }\n        \n        //swift class name 会带上项目名称\n        NSArray *arr  = [childVC.className componentsSeparatedByString:@\".\"];\n        if (arr.lastObject != nil && [arr.lastObject isEqualToString:vcClassName]) {\n            vc = childVC;\n            break;\n        }\n    }\n    \n    if (vc) {\n        [self popToViewController:vc animated:true];\n    }\n}\n- (void)popBackViewControllerToIndex:(NSInteger)index{\n    if (index > self.childViewControllers.count) {\n        return;\n    }\n    UIViewController *vc = [self.childViewControllers objectAtIndex:index];\n    [self popToViewController:vc animated:true];\n}\n\n- (void)popBackViewControllerFromIndex:(NSInteger)index{\n    if (index > self.childViewControllers.count) {\n        return;\n    }\n    UIViewController *vc = [self.childViewControllers objectAtIndex:self.childViewControllers.count - index - 1];\n    [self popToViewController:vc animated:true];\n}\n\n- (UIViewController *)getViewControllerByname:(NSString *)vcClassName{\n    UIViewController *vc;\n    for (UIViewController *childVC in self.childViewControllers) {\n        NSLog(@\"childVC.className-------------------->%@\",childVC.className);\n        if ([childVC.className containsString:vcClassName]) {\n            vc = childVC;\n            break;\n        }\n    }\n    \n    if (vc) {\n        return vc;\n    }\n    return nil;\n}\n\n- (UIViewController *)getViewControllerByIndex:(NSInteger)index{\n    if (index > self.childViewControllers.count) {\n        return nil;\n    }\n    UIViewController *vc = [self.childViewControllers objectAtIndex:index];\n    return vc;\n}\n\n- (void)removeControllerWithName:(NSString *)name {\n    UIViewController *controller = [self getViewControllerByname:name];\n    if (controller) {\n        NSMutableArray *arr = self.viewControllers.mutableCopy;\n        [arr removeObject:controller];\n        [self setViewControllers:arr.copy];\n    }\n}\n\n- (void)removeControllerFromIndex:(NSInteger)index {\n    if (index >= 0 && index < self.viewControllers.count) {\n        NSMutableArray *arr = self.viewControllers.mutableCopy;\n        [arr removeObjectAtIndex:index];\n        [self setViewControllers:arr.copy];\n    }\n}\n\n- (void)removeControllerToIndex:(NSInteger)index {\n    if (index >= 0 && index < self.viewControllers.count) {\n        NSMutableArray *arr = self.viewControllers.mutableCopy;\n        [arr removeObjectAtIndex:(arr.count - 1) - index];\n        [self setViewControllers:arr.copy];\n    }\n}\n-(void)repleaseControllerAtIndex:(NSInteger)index withController:(UIViewController *)replaceVC{\n    if (index >= 0 && index < self.viewControllers.count) {\n        replaceVC.hidesBottomBarWhenPushed = index!= 0?YES:NO;\n        NSMutableArray *arr = self.viewControllers.mutableCopy;\n        [arr replaceObjectAtIndex:index withObject:replaceVC];\n        [self setViewControllers:arr.copy];\n    }\n}\n- (BOOL)containViewController:(NSString *)vcClassName{\n    UIViewController *vc;\n    for (UIViewController *childVC in self.childViewControllers) {\n        if ([childVC.className isEqualToString:vcClassName]) {\n            vc = childVC;\n            break;\n        }\n    }\n    \n    if (vc) {\n        return YES;\n    }\n    return NO;\n}\n\n@end\n@implementation UIViewController (BackButtonHandler)\n\n@end\n\n@implementation UINavigationController (ShouldPopOnBackButton)\n\n- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item {\n    \n    if([self.viewControllers count] < [navigationBar.items count]) {\n        return YES;\n    }\n    \n    BOOL shouldPop = YES;\n    UIViewController* vc = [self topViewController];\n    if([vc respondsToSelector:@selector(navigationShouldPopOnBackButton)]) {\n        shouldPop = [vc navigationShouldPopOnBackButton];\n    }\n    \n    if(shouldPop) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            [self popViewControllerAnimated:YES];\n        });\n    } else {\n        // 取消 pop 后，复原返回按钮的状态\n        for(UIView *subview in [navigationBar subviews]) {\n            if(0. < subview.alpha && subview.alpha < 1.) {\n                [UIView animateWithDuration:.25 animations:^{\n                    subview.alpha = 1.;\n                }];\n            }\n        }\n    }\n    return NO;\n}\n\n@end\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/RxActivityIndicator/ActivityIndicator.swift",
    "content": "//\n//  ActivityIndicator.swift\n//  RxExample\n//\n//  Created by Krunoslav Zaher on 10/18/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if !RX_NO_MODULE\nimport RxSwift\nimport RxCocoa\n#endif\n\nprivate struct ActivityToken<E>: ObservableConvertibleType, Disposable {\n    private let _source: Observable<E>\n    private let _dispose: Cancelable\n\n    init(source: Observable<E>, disposeAction: @escaping () -> Void) {\n        _source = source\n        _dispose = Disposables.create(with: disposeAction)\n    }\n\n    func dispose() {\n        _dispose.dispose()\n    }\n\n    func asObservable() -> Observable<E> {\n        return _source\n    }\n}\n\n/**\n Enables monitoring of sequence computation.\n If there is at least one sequence computation in progress, `true` will be sent.\n When all activities complete `false` will be sent.\n */\npublic class ActivityIndicator: SharedSequenceConvertibleType {\n    public typealias Element = Bool\n    public typealias SharingStrategy = DriverSharingStrategy\n\n    private let _lock = NSRecursiveLock()\n    private let _relay = BehaviorRelay(value: 0)\n    private let _loading: SharedSequence<SharingStrategy, Bool>\n\n    public init() {\n        _loading = _relay.asDriver()\n            .map { $0 > 0 }\n            .distinctUntilChanged()\n    }\n\n    fileprivate func trackActivityOfObservable<Source: ObservableConvertibleType>(_ source: Source) -> Observable<Source.Element> {\n        return Observable.using({ () -> ActivityToken<Source.Element> in\n            self.increment()\n            return ActivityToken(source: source.asObservable(), disposeAction: self.decrement)\n        }, observableFactory: { value in\n            return value.asObservable()\n        })\n    }\n\n    private func increment() {\n        _lock.lock()\n        _relay.accept(_relay.value + 1)\n        _lock.unlock()\n    }\n\n    private func decrement() {\n        _lock.lock()\n        _relay.accept(_relay.value - 1)\n        _lock.unlock()\n    }\n\n    public func asSharedSequence() -> SharedSequence<SharingStrategy, Element> {\n        return _loading\n    }\n}\n\nextension ObservableConvertibleType {\n    public func trackActivity(_ activityIndicator: ActivityIndicator) -> Observable<Element> {\n        return activityIndicator.trackActivityOfObservable(self)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Thirdparty/RxErrorTracker/ErrorTracker.swift",
    "content": "//\n// Created by sergdort on 03/02/2017.\n// Copyright (c) 2017 sergdort. All rights reserved.\n//\n\nimport Foundation\nimport RxSwift\nimport RxCocoa\n\nfinal class ErrorTracker: SharedSequenceConvertibleType {\n    typealias SharingStrategy = DriverSharingStrategy\n    private let _subject = PublishSubject<Error>()\n\n    func trackError<O: ObservableConvertibleType>(from source: O) -> Observable<O.Element> {\n        return source.asObservable().do(onError: onError)\n    }\n\n    func asSharedSequence() -> SharedSequence<SharingStrategy, Error> {\n        return _subject.asObservable().asDriverOnErrorJustComplete()\n    }\n\n    func asObservable() -> Observable<Error> {\n        return _subject.asObservable()\n    }\n\n    private func onError(_ error: Error) {\n        _subject.onNext(error)\n    }\n\n    deinit {\n        _subject.onCompleted()\n    }\n}\n\nextension ObservableConvertibleType {\n    func trackError(_ errorTracker: ErrorTracker) -> Observable<Element> {\n        return errorTracker.trackError(from: self)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/DataBase/WCDBManager/DBQuery/FYDBQueryHelper.swift",
    "content": "//\n//  FYDBQueryHelper.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/27.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport WCDBSwift\n\nclass FYDBQueryHelper: NSObject {\n    \n    /// 操作单利\n    static let shared = FYDBQueryHelper.init()\n    \n    override init() {\n        super.init()\n    }\n    \n    // MARK: - 消息缓存处理\n    \n    /// 添加当前消息\n    /// - Parameter objects: 消息实体\n    func insertFromMessage(_ object: FYMessageItem) {\n        WCDataBaseManager.shared.insertToDb(objects: [object], intoTable:kTABLE.message)\n    }\n    \n    /// 查询对应的消息列表\n    /// - Parameter chatId: 会话id\n    func qureyFromMessagesWithChatId(_ chatId: Int) -> [FYMessageItem] {\n        var sesstions: [FYMessageItem] = []\n        let query = FYMessageItem.Properties.chatId == chatId\n        if let dbData = WCDataBaseManager.shared.qureyObjectsFromDb(fromTable: kTABLE.message, cls: FYMessageItem.self, where: query) {\n            sesstions.append(contentsOf: dbData)\n        }\n        return sesstions\n    }\n        \n    /// 删除单个消息\n    /// - Parameter messageId: 消息id\n    func deleteFromMessageId(_ messageId: Int) {\n        let query = FYMessageItem.Properties.messageId == messageId\n        WCDataBaseManager.shared.deleteFromDb(fromTable: kTABLE.message, where: query)\n    }\n    \n    \n    /// 更新某个聊天体\n    /// - Parameters:\n    ///   - message: 消息\n    ///   - messageId: 消息id\n    func updateChatWithMsgId(_ message: FYMessageItem, messageId: Int) {\n        let query = FYMessageItem.Properties.messageId == messageId\n        WCDataBaseManager.shared.updateToDb(table: kTABLE.chat, on: FYMessageChatModel.Properties.all, with: message, where: query)\n    }\n    \n    /// 更新单个消息\n    /// - Parameter messageId: 消息id\n    func updateMessageWithMsgId(message: FYMessageItem, messageId: Int) {\n        let query = FYMessageItem.Properties.messageId == messageId\n        WCDataBaseManager.shared.updateToDb(table: kTABLE.message, on: FYMessageItem.Properties.all, with: message, where: query)\n    }\n    \n    \n    /// 查询单个消息\n    /// - Parameter messageId: 消息id\n    func queryMessageWithMsgId(_ messageId: Int) -> FYMessageItem? {\n        let query = FYMessageItem.Properties.messageId == messageId\n        return WCDataBaseManager.shared.qureyObjectFromDb(fromTable: kTABLE.message, cls: FYMessageItem.self, where: query)\n    }\n    \n    /// 根据聊天类型删除消息列表\n    /// - Parameter chatType: （聊天类型：1：单聊；2：群聊）\n    func deleteFromMessagesWithType(_ chatType: Int) {\n        let query = FYMessageItem.Properties.chatType == chatType\n        WCDataBaseManager.shared.deleteFromDb(fromTable: kTABLE.message, where: query)\n    }\n    \n    /// 删除对应的消息列表\n    /// - Parameter chatId: 会话id\n    func deleteFromMesssageWithId(_ chatId: Int) {\n        let query = FYMessageItem.Properties.chatId == chatId\n        WCDataBaseManager.shared.deleteFromDb(fromTable: kTABLE.message, where: query)\n    }\n    \n    \n    /// 查询当前的消息会话列表\n    func qureyFromLastSesstions() -> [FYMessageItem] {\n        let chats = FYDBQueryHelper.shared.queryFromAllChats()\n        var sesstions: [FYMessageItem] = []\n        for chat in chats {\n            if let chatId = chat.uid {\n                let messages = FYDBQueryHelper.shared.qureyFromMessagesWithChatId(chatId)\n                if messages.count > 0 {\n                    if let model = messages.last {\n                        model.name = chat.name\n                        model.nickName = chat.nickName //备注名称\n                        model.avatar = chat.avatar\n                        model.chatType = chat.chatType\n                        model.unReadCount = chat.unReadCount\n                        sesstions.append(model) //获取最后一条消息\n                    }\n                }\n                \n            }\n        }\n        \n        \n        \n        // 排序处理\n        return sesstions.sorted {\n            return $0.date?.stringToTimeStamp().doubleValue ?? 0 >= $1.date?.stringToTimeStamp().doubleValue ?? 0\n        }\n    }\n    \n    \n    /// 获取当前的未读消息总数\n    func queryFromSesstionsUnReadCount() -> Int {\n        var badge: Int = 0\n        let chats = FYDBQueryHelper.shared.queryFromAllChats()\n        for chat in chats {\n            if let unReadCount = chat.unReadCount {\n                badge += unReadCount\n            }\n        }\n        return badge\n    }\n\n    // MARK: - 用户或者群列表缓存处理\n    \n    /// 添加聊天用户或者群\n    /// - Parameter chat: 用户或者群\n    func insertFromChat(_ chat: FYMessageChatModel) {\n        WCDataBaseManager.shared.insertToDb(objects: [chat], intoTable:kTABLE.chat)\n    }\n    \n    \n    /// 更新好友群信息\n    /// - Parameters:\n    ///   - chat: 好友或者群\n    ///   - uid: 好友或群id\n    func updateFromChatModel(_ chat: FYMessageChatModel, uid: Int) {\n        let query = FYMessageChatModel.Properties.uid == uid\n        WCDataBaseManager.shared.updateToDb(table: kTABLE.chat, on: FYMessageChatModel.Properties.all, with: chat, where: query)\n    }\n    \n    /// 删除所有单聊用户或者群聊\n    /// - Parameter chatType: （聊天类型：1：单聊；2：群聊）\n    func deleteFromChatsWithType(_ chatType: Int) {\n        let query = FYMessageChatModel.Properties.chatType == chatType\n        WCDataBaseManager.shared.deleteFromDb(fromTable: kTABLE.chat, where: query)\n    }\n    \n    /// 删除单个好友或者群\n    /// - Parameter uid: 好友或群id\n    func deleteFromChatWithId(_ uid: Int) {\n        let query = FYMessageChatModel.Properties.uid == uid\n        WCDataBaseManager.shared.deleteFromDb(fromTable: kTABLE.chat, where: query)\n    }\n    \n    \n    /// 查询当前好友或者群列表\n    /// - Parameter chatType: 聊天类型\n    func qureyFromChatsWithType(_ chatType: Int) -> [FYMessageChatModel] {\n        var sesstions: [FYMessageChatModel] = []\n        let query = FYMessageChatModel.Properties.chatType == chatType\n        if let dbData = WCDataBaseManager.shared.qureyObjectsFromDb(fromTable: kTABLE.chat, cls: FYMessageChatModel.self, where: query) {\n            sesstions.append(contentsOf: dbData)\n        }\n        return sesstions\n    }\n    \n    /// 查询当前所有好友或者群列表\n    func queryFromAllChats() -> [FYMessageChatModel] {\n        var sesstions: [FYMessageChatModel] = []\n        let query = FYMessageChatModel.Properties.all.count\n        if let dbData = WCDataBaseManager.shared.qureyObjectsFromDb(fromTable: kTABLE.chat, cls: FYMessageChatModel.self, where: query) {\n            sesstions.append(contentsOf: dbData)\n        }\n        return sesstions\n    }\n    \n    /// 根据uid查询当前好友所有聊天记录\n    func queryChatFromAllChats(_ uid: Int) -> [FYMessageChatModel] {\n        var sesstions: [FYMessageChatModel] = []\n        let query = FYMessageChatModel.Properties.uid == uid\n        if let dbData = WCDataBaseManager.shared.qureyObjectsFromDb(fromTable: kTABLE.chat, cls: FYMessageChatModel.self, where: query) {\n            sesstions.append(contentsOf: dbData)\n        }\n        return sesstions\n    }\n    \n    \n    /// 查询单个好友或者群\n    /// - Parameter uid: 好友或群ID\n    func qureyFromChatId(_ uid: Int) -> FYMessageChatModel {\n        var chat = FYMessageChatModel()\n        let query = FYMessageChatModel.Properties.uid == uid\n        if let dbData = WCDataBaseManager.shared.qureyObjectsFromDb(fromTable: kTABLE.chat, cls: FYMessageChatModel.self, where: query) {\n            if dbData.count > 0 {\n                chat = dbData.map{ $0 }.first!\n            }\n        }\n        return chat\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/DataBase/WCDBManager/DBQuery/FYMessageUserModel.swift",
    "content": "//\n//  FYMessageUserModel.swift\n//  FY-JetChat\n//\n//  Created by fangyuan on 2019/12/14.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport WCDBSwift\n\nclass FYMessageUserModel: FYMessageBaseModel, TableCodable {\n        \n    /// 主键自增id\n    var identifier: Int? = nil\n    /// 用户id\n    var uid: Int? = nil\n    /// 用户名称\n    var name: String? = nil\n    /// 用户头像\n    var avatar: String? = nil\n    /// 备注名（昵称）\n    var nickName: String? = nil\n        \n    enum CodingKeys: String, CodingTableKey {\n        typealias Root = FYMessageUserModel\n        static let objectRelationalMapping = TableBinding(CodingKeys.self)\n        \n        case identifier = \"id\"\n        case uid\n        case name\n        case avatar\n        case nickName\n        \n        //Column constraints for primary key, unique, not null, default value and so on. It is optional.\n        static var columnConstraintBindings: [CodingKeys: ColumnConstraintBinding]? {\n            return [\n                .identifier: ColumnConstraintBinding(isPrimary: true, isAutoIncrement: true)\n            ]\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/DataBase/WCDataBaseManager.swift",
    "content": "//\n//  WCDataBaseManager.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/6.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport Foundation\nimport WCDBSwift\n\n\nfileprivate struct WCDataBasePath {\n    \n    let dbPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,\n                                                     .userDomainMask,\n                                                     true).last! + \"/WCDB/FYIM.db\"\n}\n\nclass WCDataBaseManager: NSObject {\n    \n    static let shared = WCDataBaseManager()\n    \n    let dataBasePath = URL(fileURLWithPath: WCDataBasePath().dbPath)\n    \n    var dataBase: Database?\n    \n    private override init() {\n        super.init()\n\n        dataBase = createDb()\n    }\n    \n    ///创建库\n    private func createDb() -> Database {\n        debugPrint(\"数据库路径==\\(dataBasePath.absoluteString)\")\n        return Database(withFileURL: dataBasePath)\n    }\n    \n    \n    ///创建表\n    func createTable<T: TableDecodable>(table: String, of ttype:T.Type) -> Void {\n        do {\n            try dataBase?.create(table: table, of:ttype)\n        } catch let error {\n            debugPrint(\"create table error \\(error.localizedDescription)\")\n        }\n    }\n    \n    \n    ///插入\n    func insertToDb<T: TableEncodable>(objects: [T], intoTable table: String) -> Void {\n        do {\n            try dataBase?.insert(objects: objects, intoTable: table)\n        } catch let error {\n            debugPrint(\" insert obj error \\(error.localizedDescription)\")\n        }\n    }\n    \n    ///修改\n    func updateToDb<T: TableEncodable>(table: String, on propertys:[PropertyConvertible],with object:T,where condition: Condition? = nil) -> Void {\n        do {\n            try dataBase?.update(table: table, on: propertys, with: object, where: condition)\n        } catch let error {\n            debugPrint(\" update obj error \\(error.localizedDescription)\")\n        }\n    }\n    \n    ///删除\n    func deleteFromDb(fromTable: String, where condition: Condition? = nil) -> Void {\n        do {\n            try dataBase?.delete(fromTable: fromTable, where:condition)\n        } catch let error {\n            debugPrint(\"delete error \\(error.localizedDescription)\")\n        }\n    }\n    \n    ///查询多个\n    func qureyObjectsFromDb<T: TableDecodable>(fromTable: String, cls cName: T.Type, where condition: Condition? = nil, orderBy orderList:[OrderBy]? = nil) -> [T]? {\n        do {\n            let allObjects: [T] = try (dataBase?.getObjects(fromTable: fromTable, where:condition, orderBy:orderList))!\n            debugPrint(\"\\(allObjects)\");\n            return allObjects\n        } catch let error {\n            debugPrint(\"no data find \\(error.localizedDescription)\")\n        }\n        return nil\n    }\n    \n    ///查询单个\n    func qureyObjectFromDb<T: TableDecodable>(fromTable: String, cls cName: T.Type, where condition: Condition? = nil, orderBy orderList:[OrderBy]? = nil) -> T? {\n        do {\n            let object: T = try (dataBase?.getObject(fromTable: fromTable, where:condition, orderBy:orderList))!\n            debugPrint(\"\\(object)\");\n            return object\n        } catch let error {\n            debugPrint(\"no data find \\(error.localizedDescription)\")\n        }\n        return nil\n    }\n    \n    ///删除数据表\n    func dropTable(table: String) -> Void {\n        do {\n            try dataBase?.drop(table: table)\n        } catch let error {\n            debugPrint(\"drop table error \\(error)\")\n        }\n    }\n    \n    /// 删除所有与该数据库相关的文件\n    func removeDbFile() -> Void {\n        do {\n            try dataBase?.close(onClosed: {\n                try dataBase?.removeFiles()\n            })\n        } catch let error {\n            debugPrint(\"not close db \\(error)\")\n        }\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/DataBase/WCDataBaseTable.swift",
    "content": "//\n//  WCDataBaseTable.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/6.\n//  Copyright © 2019 Jett. All rights reserved.\n//  本地缓存数据库表名称\n\nimport Foundation\n\ntypealias kTABLE = WCDataBaseTable\n\n/// 数据库 - 表名称\nenum WCDataBaseTable: String {\n    case chatTable    = \"chatTable\"\n    case messageTable = \"messageTable\"\n    case sessionTable = \"sessionTable\"\n    \n}\n\nextension WCDataBaseTable {\n    \n    static var chat : String {\n        get {\n            return self.chatTable.rawValue\n        }\n    }\n    \n    static var message : String {\n        get {\n            return self.messageTable.rawValue\n        }\n    }\n    \n    static var session : String {\n        get {\n            return self.sessionTable.rawValue\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/FPSLabel/FPSLabel.swift",
    "content": "//\n//  FPSLabel.swift\n//  FPSDemo\n//\n//  Created by just so so on 2019/10/7.\n//  Copyright © 2019 bruce yao. All rights reserved.\n//\n\nimport UIKit\n\nclass FPSLabel: UILabel {\n    //CADisplayLink\n    fileprivate var link: CADisplayLink?\n    fileprivate var count: UInt = 0\n    fileprivate var lastTime: TimeInterval = 0\n\n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        ///样式\n        layer.cornerRadius = 5\n        layer.masksToBounds = true\n        backgroundColor = UIColor.init(white: 0, alpha: 0.7)\n        font = UIFont.init(name: \"Menlo\", size: 14)\n        self.textAlignment = .center\n        ///防止循环引用\n        link = CADisplayLink.init(target: WeakProxy.init(self), selector: #selector(tick(_:)))\n        ///main runloop 添加到\n        link?.add(to: RunLoop.main, forMode: .common)\n    }\n    deinit {\n        link?.invalidate()\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n  \n    ///滴答滴答\n    @objc fileprivate func tick(_ link: CADisplayLink) {\n        if lastTime == 0 {\n            lastTime = link.timestamp\n            return\n        }\n        count = count + 1\n        let delta = link.timestamp - lastTime\n        if delta < 1 {\n            return\n        }\n        lastTime = link.timestamp;\n        let fps = Double(count) / delta\n        count = 0\n        let progress = fps / 60.0\n        let color = UIColor.init(hue: CGFloat(0.27 * (progress - 0.2)), saturation: 1, brightness: 0.9, alpha: 1)\n        self.textColor = color\n        self.text = String.init(format: \"%.0lf FPS\", round(fps))\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/FPSLabel/WeakProxy.h",
    "content": "//\n//  WeakProxy.h\n//  FPSDemo\n//\n//  Created by just so so on 2019/10/7.\n//  Copyright © 2019 bruce yao. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface WeakProxy : NSProxy\n+ (instancetype)proxyWith:(id)target;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/FPSLabel/WeakProxy.m",
    "content": "//\n//  WeakProxy.m\n//  FPSDemo\n//\n//  Created by just so so on 2019/10/7.\n//  Copyright © 2019 bruce yao. All rights reserved.\n//链接：https://blog.csdn.net/weixin_38735568/article/details/101772108\n\n#import \"WeakProxy.h\"\n@interface WeakProxy()\n@property (nonatomic, weak) id target;\n@end\n@implementation WeakProxy\n///类方法 初始化\n+ (instancetype)proxyWith:(id)target {\n    WeakProxy *proxy = [WeakProxy alloc];\n    proxy.target = target;\n    return proxy;\n}\n\n- (id)forwardingTargetForSelector:(SEL)aSelector {\n    return self.target;\n}\n\n- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {\n    return [NSObject instanceMethodSignatureForSelector:@selector(init)];\n}\n- (void)forwardInvocation:(NSInvocation *)invocation {\n    void *null = NULL;\n    [invocation getReturnValue:&null];\n}\n\n\n@end\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/FileSizeManager/FYFileSizeManager.swift",
    "content": "//\n//  FYFileSizeManager.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/28.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport Kingfisher\nimport YBImageBrowser\nimport SDWebImage\n\nclass FYFileSizeManager: NSObject {\n\n    static let manager = FYFileSizeManager()\n    \n    /// 显示缓存大小\n    public func cacheSize() -> String {\n        guard let cachePath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).first else { return \"0M\" }\n        return String(format: \"%.2fM\", folderSize(filePath: cachePath))\n    }\n    \n    \n    /// 计算单个文件的大小\n    public func fileSize(filePath: String) -> UInt64 {\n        let manager = FileManager.default\n        if manager.fileExists(atPath: filePath) {\n            do {\n                let attr = try manager.attributesOfItem(atPath: filePath)\n                let size = attr[FileAttributeKey.size] as! UInt64\n                return size\n            } catch  {\n                print(\"error :\\(error)\")\n                return 0\n            }\n        }\n        return 0\n    }\n    \n    \n    /// 遍历文件夹，返回多少M\n    public func folderSize(filePath: String) -> CGFloat {\n        let folderPath = filePath as NSString\n        let manager = FileManager.default\n        if manager.fileExists(atPath: filePath) {\n            let childFilesEnumerator = manager.enumerator(atPath: filePath)\n            var fileName = \"\"\n            var folderSize: UInt64 = 0\n            while childFilesEnumerator?.nextObject() != nil {\n                guard let nextObject = childFilesEnumerator?.nextObject() as? String else {\n                    return 0\n                }\n                fileName = nextObject\n                let fileAbsolutePath = folderPath.strings(byAppendingPaths: [fileName])\n                folderSize += fileSize(filePath: fileAbsolutePath[0])\n            }\n            return CGFloat(folderSize) / (1024.0 * 1024.0)\n        }\n        \n        return 0\n    }\n    \n    \n    /// 清除缓存\n    func clearCache() {\n        let cachPath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)[0] as NSString\n        let files = FileManager.default.subpaths(atPath: cachPath as String)\n        for p in files! {\n            let path = cachPath.appendingPathComponent(p)\n            if FileManager.default.fileExists(atPath: path) {\n                do {\n                    try FileManager.default.removeItem(atPath: path)\n                } catch {\n                    print(\"error:\\(error)\")\n                }\n            }\n        }\n    }\n\n    /// 删除沙盒里的文件\n    public func deleteFile(filePath: String) {\n        let manager = FileManager.default\n        let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)[0] as NSString\n        let uniquePath = path.appendingPathComponent(filePath)\n        if manager.fileExists(atPath: uniquePath) {\n            do {\n                try FileManager.default.removeItem(atPath: uniquePath)\n            } catch {\n                print(\"error:\\(error)\")\n            }\n        }\n    }\n\n    \n    /// 获取图片缓存\n    public func imageCacheSize( _ callback: @escaping (String) -> ()) {\n        let cache = ImageCache.default\n        cache.diskStorage.config.sizeLimit = UInt(200 * 1024 * 1024)\n        cache.diskStorage.config.expiration = .days(15)\n        cache.calculateDiskStorageSize { result in\n            switch result {\n            case .success(let size):\n                var dataSize : String{\n                    guard size >= 1024 else { return \"\\(size)bytes\" }\n                    guard size >= 1048576 else { return \"\\(size / 1024)K\" }\n                    guard size >= 1073741824 else { return \"\\(size / 1048576)M\" }\n                    return \"\\(size / 1073741824)G\"\n                }\n                callback(dataSize)\n                \n            case .failure(let error):\n                print(\"统计图片缓存失败\", error)\n                callback(\"0M\")\n            }\n        }\n    }\n    \n    /// 清除图片缓存\n    public func clearImageCaches(completion handler: (()->())?) {\n        clearCache()\n        \n        SDImageCachesManager.shared.clear(with: .all) {\n            handler?()\n        }\n    \n        let cache = KingfisherManager.shared.cache\n        cache.clearMemoryCache()//清理网络缓存\n        cache.cleanExpiredDiskCache()//清理过期的，或者超过硬盘限制大小的\n        cache.clearDiskCache {\n            handler?()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/FileSizeManager/FYUserDefaultManager.swift",
    "content": "//\n//  FYUserDefaultManager.swift\n//  FY-IMChat\n//\n//  Created by Jett on 2022/5/7.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport Foundation\n\nclass FYUserDefaultManager: NSObject {\n\n    /// 存储当前值\n    /// - Parameters:\n    ///   - object: 需要存储的数据\n    ///   - key: 存储数据对应的key\n    class func saveObject(_ object: Any, key: String) {\n        UserDefaults.standard.setValue(object, forKey: key)\n        UserDefaults.standard.synchronize()\n    }\n\n    \n    /// 获取已存储的值\n    /// - Parameter key: 已存储数据对应的key\n    class func readObjectForKey(_ key: String) -> Any? {\n        return UserDefaults.standard.value(forKey: key)\n    }\n    \n    // MARK: - Widget\n    \n    class func saveWidgetObject(_ object: Any, widgetKey: String = \"widgetKey\", suiteName: String = \"group.com.jetchat.2022.JetChatWidget\") {\n        let userDefaults = UserDefaults(suiteName: suiteName)\n        userDefaults?.set(object, forKey: widgetKey)\n        userDefaults?.synchronize()\n    }\n    \n    class func readWidgetObject(_ widgetKey: String = \"widgetKey\", suiteName: String = \"group.com.jetchat.2022.JetChatWidget\") -> Any? {\n        let userDefaults = UserDefaults(suiteName: suiteName)\n        if let object = userDefaults?.value(forKey: widgetKey) as? Any {\n            return object\n        }\n        return nil\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/Helpers/CountDownHandy.swift",
    "content": "//\n//  LWCommonClock.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/3/6.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\n@available(iOS 10.0, *)\nclass CountDownHandy: NSObject {\n\n    /// 默认的短信验证码发送倒计时(60s)\n    ///\n    /// - Parameters:\n    ///   - button: 按钮\n    class func beginClockSMS(_ button: UIButton) {\n        \n        CountDownHandy().startClockWithButton(button, time: 120)\n    }\n    \n    /// 多个按钮控制短信验证码发送倒计时(60s)\n    ///\n    /// - Parameters:\n    ///   - button1: 按钮1\n    ///   - button2: 按钮2\n    class func setGreyClockSMS(_ button1: UIButton, button2: UIButton) {\n        \n        CountDownHandy().startGrayWithButton(button1, button2: button2, time: 60)\n    }\n    \n    /// 短信验证码发送倒计时\n    ///\n    /// - Parameters:\n    ///   - button: 按钮\n    ///   - time: 总倒计时长\n    class func beginClockTime(_ button: UIButton, time: Int) {\n        guard time > 0 else {\n            return\n        }\n        \n        CountDownHandy().startClockWithButton(button, time: time)\n    }\n    \n    \n    /// 开始倒计时\n    func startClockWithButton(_ button: UIButton, time: Int) {\n        \n        let oldDate = Date()\n        var newTime = time\n        \n        let codeTimer = DispatchSource.makeTimerSource(flags: .init(rawValue: 0), queue: DispatchQueue.global())\n        \n        codeTimer.schedule(deadline: .now(), repeating: .milliseconds(1000))  //此处方法与Swift 3.0 不同\n        codeTimer.setEventHandler {\n            // 停止计时\n            if newTime <= 0 {\n                codeTimer.cancel()\n                DispatchQueue.main.async {\n                    button.isEnabled = true\n                    //button.setTitle(Lca.c_register_create_send.rLocalized(), for: .normal)\n                }\n                return\n            }\n            else{\n                let newDate = Date()\n                let timeInterva = newDate.timeIntervalSince(oldDate)\n                var calTime = time - Int(timeInterva)\n                if calTime <= 0{\n                    calTime = 0\n                }\n                DispatchQueue.main.async {\n                    button.setTitle(\"\\(calTime)s\", for: .normal)\n                    button.isEnabled = false\n                }\n                if calTime <= 1{\n                    newTime = 1\n                }\n                newTime = newTime - 1\n            }\n        }\n        \n        /// 开启定时器\n        codeTimer.activate()\n    }\n    \n    /// 开始置灰色倒计时\n    func startGrayWithButton(_ button1: UIButton, button2: UIButton, time: Int) {\n        var newTime = time\n        let codeTimer = DispatchSource.makeTimerSource(flags: .init(rawValue: 0), queue: DispatchQueue.global())\n        \n        codeTimer.schedule(deadline: .now(), repeating: .milliseconds(1000))  //此处方法与Swift 3.0 不同\n        codeTimer.setEventHandler {\n            newTime = newTime - 1\n            DispatchQueue.main.async {\n                button1.isEnabled = false\n                button2.isEnabled = false\n            }\n            \n            // 停止计时\n            if newTime < 0 {\n                codeTimer.cancel()\n                DispatchQueue.main.async {\n                    button1.isEnabled = true\n                    button2.isEnabled = true\n                    //button1.setTitle(Lca.c_register_create_send.rLocalized(), for: .normal)\n                }\n                return\n            }\n            \n            DispatchQueue.main.async {\n                \n                button1.setTitle(\"\\(newTime)s\", for: .normal)\n            }\n        }\n        \n        /// 开启定时器\n        codeTimer.activate()\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/Helpers/LanguageManager.swift",
    "content": "//\n//  LWLanguageManager.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/3/4.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport Foundation\nimport Localize_Swift\nimport Rswift\n\npublic enum kLanguageType: String {\n    \n    case kEnglish = \"en\"\n    case kChinese = \"zh-Hans\"\n    \n    static let allLanguages = [kEnglish, kChinese]\n    static let alllocalizedStr = allLanguages.map { (type) -> String in\n        return type.rawValue\n    }\n    \n    func serverLanguage() -> String {\n        switch self {\n        case .kEnglish:\n            return \"en\"\n        default:\n            return \"cn\"\n        }\n    }\n    \n    func getLanguageRaw() -> String {\n        switch self {\n        case .kEnglish:\n            return \"English\"\n        default:\n            return \"简体中文\"\n        }\n    }\n}\n\nclass LanguageManager: NSObject {\n    \n    /// 单利\n    static let manager = LanguageManager()\n    \n    /// 当前已选语言\n    var selectedLanguage = kLanguageType(rawValue: \"zh-Hans\")\n\n    /// 当前所有语言\n    var currentLanguages: [String] {\n        return [\"简体中文\".rLocalized(), \"英文\".rLocalized()]\n    }\n    \n    override init() {}\n    \n    \n    /// 初始化设置\n    func initConfig() {\n        let languageCode = Localize.defaultLanguage()\n        \n        let language = UserDefaults.standard.string(forKey: kAppLanguageUserDefaultsKey) ??\n           languageCode\n        self.selectedLanguage = kLanguageType.init(rawValue: language)\n        Localize.setCurrentLanguage(language)\n    }\n    \n    /// 切换语言\n    ///\n    /// - Parameter type: 语言类型\n    func setCurrentLanguage(_ languageType: kLanguageType) {\n        if languageType == self.selectedLanguage {\n            return\n        }\n        \n        UserDefaults.standard.set(languageType.rawValue, forKey: kAppLanguageUserDefaultsKey)\n        UserDefaults.standard.synchronize()\n        \n        LanguageManager.manager.selectedLanguage = languageType\n        Localize.setCurrentLanguage(languageType.rawValue)\n        \n        // rest\n        restRootController()\n    }\n    \n    // 切换根控制器\n    private func restRootController() {\n        let tabBar = FYBaseTabBarController()\n        UIApplication.shared.keyWindow?.rootViewController = tabBar\n        UIApplication.shared.keyWindow?.makeKeyAndVisible()\n        \n        // FPS\n        AppDelegate.app.setupFPSStatus()\n    }\n}\n\n// MARK: - R.string.localizable\n\nextension String {\n    \n    /// r优化的国际化语言\n    ///\n    /// - Returns: 对应国际化语言\n    func rLocalized() -> String {\n        return self.localized()\n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Cell/ChatAppleEmojiCell.swift",
    "content": "//\n//  ChatAppleEmojiCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass ChatAppleEmojiCell: UICollectionViewCell {\n    \n    // MARK: - lazy var\n    \n    var model: ChatEmoticon? {\n        didSet {\n            guard let emoticon = model else {\n                return\n            }\n            \n            if emoticon.isDelete {\n                emojiBtn.setTitle(nil, for: .normal)\n                emojiBtn.setImage(UIImage(named: \"ic_emotion_delete\"), for: .normal)\n                emojiBtn.setImage(UIImage(named: \"ic_emotion_delete\"), for: .highlighted)\n            }else if emoticon.isSpace {\n                emojiBtn.setImage(nil, for: .normal)\n                emojiBtn.setTitle(nil, for: .normal)\n            }else if emoticon.emojiCode?.length ?? 0 > 0 {\n                emojiBtn.setTitle(emoticon.emojiCode, for: .normal)\n                emojiBtn.setImage(nil, for: .normal)\n            }else {\n                guard let imgPath = emoticon.imgPath else {\n                    return\n                }\n                \n                emojiBtn.setTitle(nil, for: .normal)\n                emojiBtn.setImage(UIImage(contentsOfFile: imgPath), for: .normal)\n            }\n        }\n    }\n    \n    lazy var emojiBtn: UIButton = {\n        let button = UIButton(type: .custom)\n        button.backgroundColor = .clear\n        button.titleLabel?.font = UIFont.systemFont(ofSize: 16)\n        button.isUserInteractionEnabled = false\n        return button\n    }()\n    \n    // MARK: - life cycle\n \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        \n        self.addSubview(emojiBtn)\n        emojiBtn.snp.makeConstraints { (make) in\n            make.centerX.centerY.equalToSuperview()\n            make.width.height.equalTo(36)\n        }\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Cell/ChatKeyboardFlowLayout.swift",
    "content": "//\n//  ChatMoreViewFlowLayout.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/16.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass ChatKeyboardFlowLayout: UICollectionViewFlowLayout {\n    // 保存所有item\n    fileprivate var attributesArr: [UICollectionViewLayoutAttributes] = []\n    fileprivate var col: Int = 0\n    fileprivate var row: Int = 0\n    \n    init(column: Int, row: Int) {\n        super.init()\n        self.col = column\n        self.row = row\n    }\n    \n    required init?(coder aDecoder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    // MARK: - 重新布局\n    override func prepare() {\n        super.prepare()\n        \n        let itemWH: CGFloat = kScreenW / CGFloat(col)\n        \n        // 设置itemSize\n        itemSize = CGSize(width: itemWH, height: itemWH)\n        minimumLineSpacing = 0\n        minimumInteritemSpacing = 0\n        scrollDirection = .horizontal\n        \n        // 设置collectionView属性\n        collectionView?.isPagingEnabled = true\n        collectionView?.showsHorizontalScrollIndicator = false\n        collectionView?.showsVerticalScrollIndicator = true\n        let insertMargin = (collectionView!.bounds.height - CGFloat(row) * itemWH) * 0.5\n        collectionView?.contentInset = UIEdgeInsets(top: insertMargin, left: 0, bottom: insertMargin, right: 0)\n        \n        var page = 0\n        let itemsCount = collectionView?.numberOfItems(inSection: 0) ?? 0\n        for itemIndex in 0..<itemsCount {\n            let indexPath = IndexPath(item: itemIndex, section: 0)\n            let attributes = UICollectionViewLayoutAttributes(forCellWith: indexPath)\n            \n            page = itemIndex / (col * row)\n            // 通过一系列计算, 得到x, y值\n            let x = itemSize.width * CGFloat(itemIndex % Int(col)) + (CGFloat(page) * kScreenW)\n            let y = itemSize.height * CGFloat((itemIndex - page * row * col) / col)\n            \n            attributes.frame = CGRect(x: x, y: y, width: itemSize.width, height: itemSize.height)\n            // 把每一个新的属性保存起来\n            attributesArr.append(attributes)\n        }\n        \n    }\n    \n    override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {\n        var rectAttributes: [UICollectionViewLayoutAttributes] = []\n        _ = attributesArr.map({\n            if rect.contains($0.frame) {\n                rectAttributes.append($0)\n            }\n        })\n        return rectAttributes\n    }\n    \n    override var collectionViewContentSize: CGSize {\n        let size: CGSize = super.collectionViewContentSize\n        let collectionViewWidth: CGFloat = self.collectionView!.frame.size.width\n        let nbOfScreen: Int = Int(ceil(size.width / collectionViewWidth))\n        let newSize: CGSize = CGSize(width: collectionViewWidth * CGFloat(nbOfScreen), height: size.height)\n        return newSize\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Cell/ChatMoreMenuCell.swift",
    "content": "//\n//  FYChatMoreMenuCell.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/16.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass ChatMoreMenuCell: UICollectionViewCell {\n    \n    // MARK: - lazy var\n    \n    var model: ChatMoreMnueConfig? {\n        didSet {\n            guard model != nil else {\n                return\n            }\n            \n            self.imageView.image = UIImage(named: model!.image!)\n            self.titleLabel.text = model?.title ?? \"\"\n        }\n    }\n    \n    private lazy var titleLabel: UILabel = {\n        let label = UILabel()\n        label.textAlignment = .center\n        label.theme.textColor = themed{ $0.FYColor_Main_TextColor_V1 }\n        label.font = UIFont.systemFont(ofSize: 14)\n        return label\n    }()\n    \n    private lazy var imageView: UIImageView = {\n        let imageView = UIImageView()\n        return imageView\n    }()\n    \n    // MARK: - life cycle\n \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        \n        contentView.addSubview(imageView)\n        contentView.addSubview(titleLabel)\n    }\n    \n    required init?(coder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    \n    override func layoutSubviews() {\n        super.layoutSubviews()\n        \n        imageView.snp.makeConstraints { (make) in\n            make.centerX.equalToSuperview()\n            make.centerY.equalToSuperview().offset(-10)\n            make.width.height.equalTo(36)\n        }\n        \n        titleLabel.snp.makeConstraints { (make) in\n            make.left.right.equalToSuperview()\n            make.top.equalTo(imageView.snp.bottom)\n            make.height.equalTo(21)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/ChatEmojiListView.swift",
    "content": "//\n//  ChatEmojiListView.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/14.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\n\n/// 行数\nfileprivate let kRowNumber = 3\n/// 列数\nfileprivate let kColumnNumber = 8\n\nfileprivate let kEmotionCellNumberOfOnePage = kRowNumber * kColumnNumber\n\nprotocol ChatEmojiListViewDelegate {\n    /// 获取的表情\n    func emojiView(_ emojiView: ChatEmojiListView, DidFinish emotion: ChatEmoticon)\n    /// 发送内容\n    func emojiView(_ emojiView: ChatEmojiListView, DidFinish isSend: Bool)\n    /// 删除上一步内容\n    func emojiView(_ emojiView: ChatEmojiListView, DidDelete backward: Bool)\n}\n\nextension ChatEmojiListViewDelegate {\n    func emojiView(_ emojiView: ChatEmojiListView, DidFinish emoji: String) {}\n    func emojiView(_ emojiView: ChatEmojiListView, DidFinish isSend: Bool) {}\n    func emojiView(_ emojiView: ChatEmojiListView, DidDelete backward: Bool) {}\n}\n\nclass ChatEmojiListView: UIView {\n    \n    private var selectedIndex: Int = 0\n    private let kBottomMargin: CGFloat = 8\n    private let kBottomHeight: CGFloat = 44\n    \n    // MARK: - lazy var\n    \n    var selectedType: Int = 0\n    \n    /// 设置代理\n    var delegate: ChatEmojiListViewDelegate?\n    \n    /// 隐藏分页指示器\n    var hidePageController: Bool = false {\n        didSet {\n            self.sendButton.alpha = self.hidePageController ? 0.0 : 1.0\n            self.pageControl.alpha = self.hidePageController ? 0.0 : 1.0\n            self.bottomView.alpha = self.hidePageController ? 0.0 : 1.0\n            UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseOut, animations: {\n                self.sendButton.isHidden = self.hidePageController\n                self.pageControl.isHidden = self.hidePageController\n                self.bottomView.isHidden = self.hidePageController\n            }, completion: nil)\n            \n            scrollToLeft()\n        }\n    }\n        \n    var pageIndicatorTintColor: UIColor? {\n        didSet {\n            guard pageIndicatorTintColor != nil else {\n                return\n            }\n            pageControl.pageIndicatorTintColor = pageIndicatorTintColor\n        }\n    }\n    \n    var currentPageIndicatorTintColor: UIColor? {\n        didSet {\n            guard currentPageIndicatorTintColor != nil else {\n                return\n            }\n            pageControl.currentPageIndicatorTintColor = currentPageIndicatorTintColor\n        }\n    }\n    \n    lazy var emojiButtons: [UIButton] = {\n        let buttons = [self.appleEmojiBtn, self.weChatEmojiBtn]\n        return buttons\n    }()\n    \n    lazy var dataSource: [ChatEmoticon] = {\n        return ChatEmotionHelper.getAppleAllEmotions()\n    }()\n    \n    lazy var collectionView: UICollectionView = {\n        let layout = ChatKeyboardFlowLayout(column: kColumnNumber, row: kRowNumber)\n        // collectionView\n        let collection = UICollectionView(frame: self.bounds, collectionViewLayout: layout)\n        collection.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V14 }\n        collection.register(cellWithClass: ChatAppleEmojiCell.self)\n        collection.showsHorizontalScrollIndicator = true\n        collection.showsVerticalScrollIndicator = true\n        collection.dataSource = self\n        collection.delegate = self\n        collection.isPagingEnabled = true\n        return collection\n    }()\n    \n    lazy var pageControl: UIPageControl = {\n        let pager = UIPageControl()\n        pager.backgroundColor = .clear\n        pager.theme.pageIndicatorTintColor = themed { $0.FYColor_BorderColor_V1 }\n        pager.theme.currentPageIndicatorTintColor = themed { $0.FYColor_Main_TextColor_V3 }\n        pager.currentPage = 0\n        pager.numberOfPages = self.dataSource.count / kEmotionCellNumberOfOnePage + (self.dataSource.count % kEmotionCellNumberOfOnePage == 0 ? 0 : 1)\n        pager.isHidden = true\n        return pager\n    }()\n    \n    lazy var sendButton: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"发送\".rLocalized(), for: .normal)\n        button.titleLabel?.font = UIFont.systemFont(ofSize: 15)\n        button.theme.titleColor(from: themed{ $0.FYColor_Main_TextColor_V12 }, for: .normal)\n        button.setTitleColor(.lightGray, for: .disabled)\n        button.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V13 }\n        button.isEnabled = false\n        button.addTarget(self, action: #selector(sendContent), for: .touchUpInside)\n        return button\n    }()\n    \n    lazy var bottomView: UIView = {\n        let toolBar = UIView()\n        toolBar.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V14 }\n        toolBar.isUserInteractionEnabled = true\n        return toolBar\n    }()\n    \n    lazy var appleEmojiBtn: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setTitle(\"😊\", for: .normal)\n        button.addTarget(self, action: #selector(emojiAction), for: .touchUpInside)\n        button.backgroundColor = .clear\n        button.tag = 1000\n        return button\n    }()\n    \n    lazy var weChatEmojiBtn: UIButton = {\n        let button = UIButton(type: .custom)\n        button.setImage(UIImage(named: \"icon_emoji_expression\"), for: .normal)\n        button.addTarget(self, action: #selector(emojiAction), for: .touchUpInside)\n        button.backgroundColor = .clear\n        button.tag = 1001\n        return button\n    }()\n    \n    lazy var emojiSelectView: UIView = {\n        let v = UIView()\n        v.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V15 }\n        return v\n    }()\n    \n    \n    // MARK: - life cycle\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n           \n        makeUI()\n        reloadData()\n        registerNotification()\n    }\n       \n    required init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n\n        makeUI()\n        reloadData()\n        registerNotification()\n    }\n    \n    func makeUI() {\n        theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V14 }\n        \n        bottomView.addSubview(emojiSelectView)\n        bottomView.addSubview(appleEmojiBtn)\n        bottomView.addSubview(weChatEmojiBtn)\n        bottomView.addSubview(sendButton)\n        \n        addSubview(bottomView)\n        bringSubviewToFront(bottomView)\n        addSubview(pageControl)\n        addSubview(collectionView)\n        \n        bottomView.snp.makeConstraints { (make) in\n            make.left.right.equalToSuperview()\n            make.bottom.equalToSuperview().offset(-kSafeAreaBottom)\n            make.height.equalTo(kBottomHeight)\n        }\n        \n        emojiSelectView.snp.makeConstraints { (make) in\n            make.left.equalToSuperview()\n            make.height.equalToSuperview()\n            make.width.equalTo(70)\n        }\n        \n        appleEmojiBtn.snp.makeConstraints { (make) in\n            make.left.equalToSuperview()\n            make.height.equalToSuperview()\n            make.width.equalTo(emojiSelectView)\n        }\n        \n        weChatEmojiBtn.snp.makeConstraints { (make) in\n            make.left.equalTo(appleEmojiBtn.snp.right)\n            make.height.equalToSuperview()\n            make.width.equalTo(emojiSelectView)\n        }\n        \n        sendButton.snp.makeConstraints { (make) in\n            make.right.equalToSuperview()\n            make.height.equalToSuperview()\n            make.width.equalTo(70)\n        }\n        \n        pageControl.snp.makeConstraints { make in\n            make.bottom.equalTo(bottomView.snp.top)\n            make.centerX.equalToSuperview()\n            make.height.equalTo(20)\n        }\n        \n        collectionView.snp.makeConstraints { make in\n            make.top.left.right.equalToSuperview()\n            make.bottom.equalTo(pageControl.snp.top)\n        }\n    }\n    \n    func registerNotification() {\n        // 实时监听输入值的改变\n        NotificationCenter.default.addObserver(self, selector: #selector(contentDidChanged(_:)), name: .kChatTextKeyboardChanged, object: nil)\n    }\n    \n    open func reloadData() {\n        self.needsUpdateConstraints()\n        self.layoutIfNeeded()\n        \n        self.sendButton.alpha = 1.0\n        self.pageControl.alpha = 1.0\n        self.bottomView.alpha = 1.0\n        UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseOut, animations: {\n            self.sendButton.isHidden = false\n            self.pageControl.isHidden = false\n            self.bottomView.isHidden = false\n        }, completion: nil)\n        \n        DispatchQueue.main.async {\n            self.collectionView.reloadData()\n            self.scrollToLeft()\n        }\n    }\n    \n    /// 发送\n    @objc func sendContent() {\n        \n        delegate?.emojiView(self, DidFinish: true)\n    }\n    \n    @objc func emojiAction(_ button: UIButton) {\n        if self.selectedIndex == button.tag - 1000 {\n            return;\n        }\n        \n        switch button.tag {\n        case 1000:\n            dataSource = ChatEmotionHelper.getAppleAllEmotions()\n            break\n        default:\n            dataSource = ChatEmotionHelper.getWeChatAllEmotions()\n            break\n        }\n        \n        selectedIndex = button.tag - 1000\n        emojiSelection(index: selectedIndex)\n        \n        reloadData()\n    }\n    \n    // MARK: - Action\n    \n    @objc\n    func emojiSelection(index: Int) {\n        // 选择emoji类型\n        UIView.animate(withDuration: 0.25) {\n            self.emojiSelectView.snp.updateConstraints { make in\n                make.left.equalToSuperview().offset(70 * index)\n            }\n        }\n        \n        emojiSelectView.superview?.layoutIfNeeded()\n    }\n    \n    @objc\n    func scrollToLeft(_ animated: Bool = false) {\n        collectionView.scrollToItem(at: IndexPath(row: 0, section: 0), at: .centeredHorizontally, animated: animated)\n    }\n}\n\n// MARK: - Notification\n\nextension ChatEmojiListView {\n    \n    @objc func contentDidChanged(_ noti: Notification) {\n        if (noti.object == nil) {\n            return\n        }\n        \n        if let insertText = noti.object as? String {\n            printLog(\"String -- \\(insertText)\")\n            sendButton.isEnabled = insertText.length > 0\n        }\n        \n        if let insertAttrs = noti.object as? NSAttributedString {\n            printLog(\"NSAttributedString -- \\(insertAttrs)\")\n            sendButton.isEnabled = insertAttrs.length > 0\n        }\n    }\n}\n\n// MARK: - UICollectionViewDataSource\n\nextension ChatEmojiListView: UICollectionViewDataSource {\n    \n    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        let cell = collectionView.dequeueReusableCell(withClass: ChatAppleEmojiCell.self, for: indexPath)\n        if let model = dataSource[safe: indexPath.row] {\n            cell.model = model\n        }\n        return cell\n    }\n    \n}\n\n// MARK: - UICollectionViewDelegate\n\nextension ChatEmojiListView: UICollectionViewDelegate {\n    \n    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {\n        if dataSource.count > indexPath.row {\n            if let emojiModel = dataSource[safe: indexPath.row] {\n                if emojiModel.isDelete {\n                    delegate?.emojiView(self, DidDelete: true)\n                }else {\n                    if (emojiModel.isSpace) {\n                        return\n                    }\n                    \n                    delegate?.emojiView(self, DidFinish: emojiModel)\n                }\n            }\n        }\n    }\n}\n\nextension ChatEmojiListView {\n    \n    func scrollViewDidScroll(_ scrollView: UIScrollView) {\n        if scrollView == collectionView {\n            let offsetX = scrollView.contentOffset.x\n            let index = offsetX / kScreenW\n            pageControl.currentPage = Int(index)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/ChatGrowingTextView.swift",
    "content": "//\n//  ChatGrowingTextView.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/14.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass ChatGrowingTextView: UITextView {\n    /// 行数部分间距调整\n    fileprivate let kEdgeInset: CGFloat = 12\n    /// 内容字体默认大小\n    fileprivate let kDefultSize: CGFloat = 15.0\n    \n    // MARK: - var lazy\n    \n    /// 默认3行的高度\n    fileprivate var maxTextViewHeight: CGFloat = 80\n    \n    var placeholder: String? = \"\" {\n        didSet {\n            self.placeholderLabel.text = placeholder\n        }\n    }\n    \n    var placeholderColor: UIColor? = .black {\n        didSet {\n            self.placeholderLabel.textColor = placeholderColor\n        }\n    }\n    \n    var maxNumberOfLines: Int = 3 {\n        didSet {\n            let numberOfLines = CGFloat(maxNumberOfLines)\n            maxTextViewHeight = CGFloat(ceilf(Float(self.font!.lineHeight * numberOfLines + self.textContainerInset.top + self.textContainerInset.bottom))) - kEdgeInset\n        }\n    }\n    \n    \n    \n    /// 输入框高度监听回调\n    var didTextChangedHeightClosure : ((CGFloat)->Void)?\n    \n    /// 占位标签\n    fileprivate lazy var placeholderLabel: UILabel = {\n        let frame = CGRect(x: 5, y: 7, width: kScreenW - 10, height: 21)\n        let label = UILabel(frame: frame)\n        label.numberOfLines = 1\n        label.text = \"请输入你要发送的消息\"\n        label.theme.textColor = themed{ $0.FYColor_Placeholder_Color_V3 }\n        label.font = UIFont.systemFont(ofSize: self.kDefultSize)\n        return label\n    }()\n    \n    // MARK: - life cycle\n    \n    override init(frame: CGRect, textContainer: NSTextContainer?) {\n        super.init(frame: frame, textContainer: textContainer)\n        \n        setup()\n    }\n    \n    required public init?(coder aDecoder: NSCoder) {\n        fatalError(\"init(coder:) has not been implemented\")\n    }\n    \n    fileprivate func setup() {\n        theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V12 }\n        \n        self.isScrollEnabled = false\n        self.scrollsToTop = false\n        //self.contentInset = UIEdgeInsets(top: 1, left: 0, bottom: 1, right: 0)\n        self.showsHorizontalScrollIndicator = false\n        self.enablesReturnKeyAutomatically = true\n        self.font = UIFont.systemFont(ofSize: kDefultSize)\n        self.returnKeyType = .send\n        \n        self.layer.cornerRadius = 4\n        self.layer.borderWidth = 1\n        self.layer.theme.borderColor = themed { $0.FYColor_BorderColor_V9.cgColor }\n        self.layer.masksToBounds = true\n        // 添加占位控件\n        addSubview(self.placeholderLabel)\n        \n        // register\n        registerChangeNotification()\n    }\n    \n    fileprivate func registerChangeNotification() {\n        // 实时监听输入值的改变\n        NotificationCenter.default.addObserver(self,\n                                               selector: #selector(textDidChanged),\n                                               name: UITextView.textDidChangeNotification,\n                                               object: self)\n        \n        self.addObserver(self, forKeyPath: \"attributedText\", options: .new, context: nil)\n    }\n    \n    // MARK: - KVO监听\n    \n    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {\n        if keyPath == \"attributedText\" {\n            textDidChanged()\n        }else {\n            \n            super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)\n        }\n    }\n    \n    \n    deinit {\n        NotificationCenter.default.removeObserver(self)\n        self.removeObserver(self, forKeyPath: \"attributedText\")\n    }\n       \n}\n\n// MARK: - Action\n\nextension ChatGrowingTextView {\n    \n    @objc func textDidChanged() {\n        placeholderLabel.isHidden = self.hasText\n        \n        // 计算高度\n        let constrainSize = CGSize(width: self.frame.size.width, height: CGFloat(MAXFLOAT))\n        var size = self.sizeThatFits(constrainSize)\n        \n        if size.height >= maxTextViewHeight {\n            self.isScrollEnabled = true\n            size.height = maxTextViewHeight\n        }else {\n            self.isScrollEnabled = false\n            if (didTextChangedHeightClosure != nil && !self.isScrollEnabled) {\n                didTextChangedHeightClosure?(size.height)\n            }\n        }\n        \n        let nowFrame = self.frame\n        frame.size.height = size.height\n        self.frame = nowFrame\n        \n        self.layoutIfNeeded()\n        \n        sendChangedNoti()\n    }\n    \n    func sendChangedNoti() {\n        \n        NotificationCenter.default.post(name: .kChatTextKeyboardChanged, object: self.text, userInfo: nil)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/ChatKeyboard+Extensions.swift",
    "content": "//\n//  ChatKeyboardView+Exted.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/14.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport Foundation\nimport UIKit\n\nlet kChatScreenW: CGFloat = UIScreen.main.bounds.size.width\nlet kChatScreenH: CGFloat = UIScreen.main.bounds.size.height\n\n\n// MARK: - NSNotificationName\n\npublic extension NSNotification.Name {\n    /// 获取点击空白处回收键盘的处理通知\n    static let kChatTextKeyboardNeedHide = Notification.Name(\"kChatTextKeyboardNeedHide\")\n    /// 获取文本输入框值变化\n    static let kChatTextKeyboardChanged = Notification.Name(\"kChatTextKeyboardChanged\")\n}\n\n// MARK: - Emoji URL\n\npublic extension URL {\n\n    static let kAppleEmojiURL = URL(fileURLWithPath: Bundle.main.path(forResource: \"Emoticons.bundle/com.apple.emoji/info\", ofType:\"plist\")!)\n    \n    static let kWeChatEmojiURL = URL(fileURLWithPath: Bundle.main.path(forResource: \"Expression.bundle/Expression\", ofType:\"plist\")!)\n}\n\n// MARK: - Emoji Scanner\n\npublic extension String {\n    \n    static func scannerEmoji(_ code: String = \"\") -> String {\n        guard code.length > 0 else {\n            return \"🙂\"\n        }\n        \n        \n        //创建扫描器\n        let scanner = Scanner(string: code)\n        var result: UInt32 = 0\n        //利用扫描器扫出结果\n        scanner.scanHexInt32(&result)\n        //将结果转换成字符\n        let c = Character(UnicodeScalar(result)!)\n        //将字符转换成字符串\n        return String(c)\n    }\n}\n\n\n// MARK: - 获取textView属性字符串,换成对应的表情字符串\n\nextension UITextView {\n    \n    func getEmotionString() -> String {\n        let attrMStr = NSMutableAttributedString(attributedString: attributedText)\n        \n        let range = NSRange(location: 0, length: attrMStr.length)\n        attrMStr.enumerateAttributes(in: range, options: []) { (dict, range, _) in\n            if let attachment = dict[.attachment] as? ChatEmotionAttachment {\n                attrMStr.replaceCharacters(in: range, with: attachment.text!)\n            }\n        }\n        \n        return attrMStr.string\n    }\n    \n    /// 添加表情图片\n    func insertEmotion(emotion: ChatEmoticon) {\n        // 空白\n        if emotion.isSpace {\n            return\n        }\n        \n        // 删除\n        if emotion.isDelete {\n            deleteBackward()\n            return\n        }\n        \n        // 表情\n        let attachment = ChatEmotionAttachment()\n        attachment.text = emotion.text\n        attachment.image = UIImage(contentsOfFile: emotion.imgPath!)\n        let font = self.font!\n        attachment.bounds = CGRect(x: 0, y: -4, width: font.lineHeight, height: font.lineHeight)\n        let attrImageStr = NSAttributedString(attachment: attachment)\n        \n        let attrMStr = NSMutableAttributedString(attributedString: attributedText)\n        let range = selectedRange\n        attrMStr.replaceCharacters(in: range, with: attrImageStr)\n        attributedText = attrMStr\n        self.font = font\n        selectedRange = NSRange(location: range.location + 1, length: 0)\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/ChatKeyboardView.swift",
    "content": "//\n//  ChatKeyboardView.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/14.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\nimport SwiftyJSON\n\nprotocol ChatKeyboardViewDelegate: AnyObject {\n    /// 输入完消息\n    func keyboard(_ keyboard: ChatKeyboardView, DidFinish content: String)\n    /// 键盘收起/弹出\n    func keyboard(_ keyboard: ChatKeyboardView, DidBecome isBecome: Bool)\n    /// 键盘的y值\n    func keyboard(_ keyboard: ChatKeyboardView, DidObserver offsetY: CGFloat)\n    /// 菜单栏点击\n    func keyboard(_ keyboard: ChatKeyboardView, DidMoreMenu type: ChatMoreMenuType)\n}\n\nextension ChatKeyboardViewDelegate {\n    func keyboard(_ keyboard: ChatKeyboardView, DidFinish content: String) {}\n    func keyboard(_ keyboard: ChatKeyboardView, DidBecome isBecome: Bool) {}\n    func keyboard(_ keyboard: ChatKeyboardView, DidObserver offsetY: CGFloat) {}\n    func keyboard(_ keyboard: ChatKeyboardView, DidMoreMenu type: ChatMoreMenuType) {}\n}\n\nclass ChatKeyboardView: UIView {\n    \n    private let kSpace: CGFloat = 8.0\n    private let kViewWH: CGFloat = 36.0\n    private let kLineHeight: CGFloat = 0.75\n    \n    // MARK: - var lazy\n        \n    weak var delegate: ChatKeyboardViewDelegate?\n    \n    fileprivate var toolBarHeight: CGFloat = 52.0\n    fileprivate var lastTextHeight: CGFloat = 34.0\n    fileprivate var keyboardHeight: CGFloat = 0.0\n    \n    /// 底部菜单容器高度\n    fileprivate var contentHeight: CGFloat = 0.0\n    \n    fileprivate var isShowEmoji = false\n    fileprivate var isShowMore = false\n    \n    /// 是否弹出了系统键盘\n    fileprivate var isShowKeyboard = false\n    \n    \n    /// 表情&键盘按钮\n    fileprivate lazy var emojiButton : UIButton = {\n        let button = UIButton(type: .custom)\n        let x: CGFloat = kScreenW - self.kViewWH * 2 - self.kSpace * 2\n        button.frame = CGRect(x: x, y: self.kSpace, width: self.kViewWH, height: self.kViewWH)\n        button.setImage(UIImage(named: \"ToolViewEmotion\"), for: .normal)\n        button.setImage(UIImage(named: \"ToolViewEmotionHL\"), for: .highlighted)\n        button.setImage(UIImage(named: \"ToolViewKeyboard\"), for: .selected)\n        button.isSelected = false\n        button.addTarget(self, action: #selector(emojiDidAction(_:)), for: .touchUpInside)\n        return button\n    }()\n    \n    \n    /// 更多按钮\n    fileprivate lazy var moreButton : UIButton = {\n        let button = UIButton(type: .custom)\n        let x: CGFloat = kScreenW - self.kViewWH - self.kSpace\n        button.frame = CGRect(x: x, y: self.kSpace, width: self.kViewWH, height: self.kViewWH)\n        button.setImage(UIImage(named: \"TypeSelectorBtn_Black\"), for: .normal)\n        button.setImage(UIImage(named: \"TypeSelectorBtnHL_Black\"), for: .highlighted)\n        button.addTarget(self, action: #selector(moreDidAction(_:)), for: .touchUpInside)\n        return button\n    }()\n    \n    /// 文本输入框\n    fileprivate lazy var chatTextView: ChatGrowingTextView = {\n        let w: CGFloat = kScreenW - self.kViewWH * 2 - self.kSpace * 3 - self.kSpace\n        let textView = ChatGrowingTextView(frame: CGRect(x: self.kSpace, y: self.kSpace, width: w, height: self.kViewWH))\n        textView.placeholder = \"请输入...\".rLocalized()\n        textView.theme.textColor = themed { $0.FYColor_Main_TextColor_V1 }\n        textView.maxNumberOfLines = 5\n        textView.delegate = self\n        textView.didTextChangedHeightClosure = { [weak self] height in\n            self?.changeKeyboardHeight(height: height)\n        }\n        return textView\n    }()\n    \n    fileprivate lazy var topLineView: UIView = {\n        let lineView1 = UIView(frame: CGRect(x: 0, y: 0, width: kScreenW, height: kLineHeight))\n        lineView1.theme.backgroundColor = themed { $0.FYColor_BorderColor_V9 }\n        return lineView1\n    }()\n    \n    fileprivate lazy var bottomLineView: UIView = {\n        let lineView2 = UIView(frame: CGRect(x: 0, y: self.toolBarHeight - kLineHeight, width: kScreenW, height: kLineHeight))\n        lineView2.theme.backgroundColor = themed { $0.FYColor_BorderColor_V9 }\n        return lineView2\n    }()\n    \n    fileprivate lazy var toolBarView: UIView = {\n        let view = UIView(frame: CGRect(x: 0, y: 0, width: kScreenW, height: self.toolBarHeight))\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V13 }\n        return view\n    }()\n    \n    /// 底部背景容器\n    fileprivate lazy var contentView: UIView = {\n        let y = self.toolBarView.maxY\n        let view = UIView(frame: CGRect(x: 0, y: y, width: kScreenW, height: self.contentHeight))\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V14 }\n        return view\n    }()\n    \n    /// 表情列表\n    fileprivate lazy var emojiListView: ChatEmojiListView = {\n        let view = ChatEmojiListView(frame: self.contentView.bounds)\n        view.delegate = self\n        view.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V14 }\n        view.isHidden = true\n        return view\n    }()\n    \n    /// 更多菜单\n    fileprivate lazy var moreMenuView: ChatMoreMenuView = {\n        let view = ChatMoreMenuView(frame: self.contentView.bounds)\n        view.isHidden = true\n        view.delegate = self\n        return view\n    }()\n    \n    // MARK: - life cycle\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n        \n        setupKeyboardView()\n        registerNotification()\n    }\n    \n    required init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        \n        setupKeyboardView()\n        registerNotification()\n    }\n    \n    func setupKeyboardView() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V13 }\n        self.isUserInteractionEnabled = true\n        \n        addSubview(toolBarView)\n        toolBarView.addSubview(moreButton)\n        toolBarView.addSubview(emojiButton)\n        toolBarView.addSubview(chatTextView)\n        toolBarView.addSubview(topLineView)\n        toolBarView.addSubview(bottomLineView)\n        \n        addSubview(contentView)\n        contentView.addSubview(moreMenuView)\n        contentView.addSubview(emojiListView)\n    }\n    \n    // MARK: - 监听键盘通知\n    private func registerNotification() {\n        // 监听键盘弹出通知\n        NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)),\n                                               name:UIResponder.keyboardWillShowNotification,object: nil)\n        // 监听键盘隐藏通知\n        NotificationCenter.default.addObserver(self,selector: #selector(keyboardWillHide(_:)),\n                                               name: UIResponder.keyboardWillHideNotification, object: nil)\n        \n        // 主要是为了获取点击空白处回收键盘的处理\n        NotificationCenter.default.addObserver(self,selector: #selector(keyboardNeedHide),\n                                               name: .kChatTextKeyboardNeedHide, object: nil)\n        // 添加KVO监听输入键盘y值\n        addObserver(self, forKeyPath: \"frame\", options: [.new, .old], context: nil)\n    }\n    \n    // MARK: - KVO监听\n    \n    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {\n        if keyPath == \"frame\" && ((object as? UIView) != nil) {\n            if let changeObject = change.value {\n                if let newFrame = changeObject[.newKey] as? CGRect {\n                    delegate?.keyboard(self, DidObserver: newFrame.origin.y)\n                    printLog(\"y值发生改变\\(newFrame.origin.y)\")\n                }\n            }\n        }else {\n            \n            super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)\n        }\n    }\n    \n    deinit {\n        \n        self.removeObserver(self, forKeyPath: \"frame\")\n    }\n}\n\n// MARK: - ChatEmojiListViewDelegate\n\nextension ChatKeyboardView: ChatEmojiListViewDelegate {\n    \n    func emojiView(_ emojiView: ChatEmojiListView, DidFinish emotion: ChatEmoticon) {\n        if (emotion.emojiCode?.length ?? 0 > 0) {\n            chatTextView.insertText(emotion.emojiCode!)\n        }else if (emotion.imgPath?.length ?? 0 > 0) {\n            chatTextView.insertEmotion(emotion: emotion)\n        }\n    }\n    \n    func emojiView(_ emojiView: ChatEmojiListView, DidDelete backward: Bool) {\n        chatTextView.deleteBackward()\n    }\n    \n    func emojiView(_ emojiView: ChatEmojiListView, DidFinish isSend: Bool) {\n        if (isSend && chatTextView.text.length > 0) {\n            sendChatMessage()\n        }\n    }\n}\n\n// MARK: - ChatMoreMenuViewDelegate\n\nextension ChatKeyboardView: ChatMoreMenuViewDelegate {\n    \n    func menu(_ view: ChatMoreMenuView, DidSelected type: ChatMoreMenuType) {\n        \n        delegate?.keyboard(self, DidMoreMenu: type)\n    }\n}\n\n// MARK: - UITextViewDelegate\n\nextension ChatKeyboardView: UITextViewDelegate {\n    \n    func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {\n        // 发送键&回车键处理\n        if (text == \"\\n\") {\n            if (isShowKeyboard) {\n                isShowKeyboard = true\n            }\n            \n            sendChatMessage()\n            return false\n        }\n        \n        return true\n    }\n    \n    \n    /// 发送消息内容\n    private func sendChatMessage() {\n        delegate?.keyboard(self, DidFinish: self.chatTextView.text ?? \"\")\n        \n        changeKeyboardHeight(height: lastTextHeight)\n        chatTextView.clear()\n    }\n}\n\n\n// MARK: - KeyBoard Manager\n\nextension ChatKeyboardView {\n    \n    /// 键盘将要显示\n    @objc func keyboardWillShow(_ noti: NSNotification) {\n        guard let userInfo = noti.userInfo else {\n            return\n        }\n        \n        contentHeight = 0\n        delegate?.keyboard(self, DidBecome: true)\n        \n        let duration = userInfo[\"UIKeyboardAnimationDurationUserInfoKey\"] as! Double\n        let endFrame = (userInfo[\"UIKeyboardFrameEndUserInfoKey\"] as! NSValue).cgRectValue\n        let y = endFrame.origin.y\n        // 获取键盘的高度\n        keyboardHeight = endFrame.height\n        // 键盘弹出状态\n        isShowKeyboard = true\n        \n        let option = userInfo[\"UIKeyboardAnimationCurveUserInfoKey\"] as! Int\n        \n        var changedY = y - self.toolBarHeight - kNavigaH - contentHeight\n        if (isShowEmoji || isShowMore) { //显示系统键盘\n            isShowMore = false\n            isShowEmoji = false\n            self.emojiListView.isHidden = true\n            self.moreMenuView.isHidden = true\n            self.moreMenuView.hidePageController = true\n            self.emojiListView.hidePageController = true\n            \n            changedY = y - self.toolBarHeight - kNavigaH\n        }\n        \n        UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(rawValue: UIView.AnimationOptions.RawValue(option)), animations: {\n            self.frame = CGRect(x: 0, y: changedY, width: kScreenW, height: self.toolBarHeight + self.contentHeight)\n        }, completion: nil)\n    }\n    \n    /// 键盘将要消失\n    @objc func keyboardWillHide(_ noti: NSNotification) {\n        guard let userInfo = noti.userInfo else {\n            return\n        }\n        \n        delegate?.keyboard(self, DidBecome: false)\n        \n        let duration = userInfo[\"UIKeyboardAnimationDurationUserInfoKey\"] as! Double\n        let endFrame = (userInfo[\"UIKeyboardFrameEndUserInfoKey\"] as! NSValue).cgRectValue\n        //let y = endFrame.origin.y\n        // 获取键盘的高度\n        keyboardHeight = endFrame.height\n        // 键盘弹出状态\n        isShowKeyboard = false\n            \n        let option = userInfo[\"UIKeyboardAnimationCurveUserInfoKey\"] as! Int\n        let changedY = kScreenH - kNavigaH - self.toolBarHeight - kSafeAreaBottom - self.contentHeight\n        UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(rawValue: UIView.AnimationOptions.RawValue(option)), animations: {\n            self.frame = CGRect(x: 0, y: changedY, width: kScreenW, height: self.toolBarHeight + self.contentHeight)\n        }, completion: nil)\n    }\n    \n    @objc func keyboardNeedHide(_ noti: NSNotification) {\n        \n        chatTextView.resignFirstResponder()\n        moreMenuView.hidePageController = true\n        emojiListView.hidePageController = true\n        \n        contentHeight = 0.0\n        restToolbarContentHeight(true)\n        \n        delegate?.keyboard(self, DidBecome: false)\n    }\n}\n\n\n\n// MARK: - Action\n\nextension ChatKeyboardView {\n    \n    /// 表情按钮点击处理\n    @objc func emojiDidAction(_ button: UIButton) {\n        button.isSelected = !button.isSelected\n        \n        if button.isSelected {\n            if !isShowEmoji {\n                isShowEmoji = true\n                if isShowMore {\n                    isShowMore = false\n                    moreMenuView.isHidden = true\n                    moreMenuView.hidePageController = true\n                }\n            }\n            \n            showEmojiView()\n            \n        }else {\n            if (isShowKeyboard) {\n                button.isSelected = true\n                showEmojiView()\n                return\n            }\n            \n            isShowEmoji = false\n            contentHeight = 0.0\n            contentView.isHidden = true\n            \n            moreMenuView.hidePageController = true\n            emojiListView.isHidden = true\n            chatTextView.becomeFirstResponder()\n        }\n        \n    }\n    \n    func showEmojiView() {\n        contentHeight = 250\n        contentView.isHidden = false\n        emojiListView.isHidden = false\n        chatTextView.resignFirstResponder()\n        \n        restToolbarContentHeight()\n        emojiListView.reloadData()\n        \n        delegate?.keyboard(self, DidBecome: true)\n    }\n    \n    /// 更多按钮点击处理\n    @objc func moreDidAction(_ button: UIButton) {\n        // 如有弹出菜单\n        if isShowMore {\n            return\n        }\n        \n        isShowMore = true\n        contentHeight = 250\n        contentView.isHidden = false\n        moreMenuView.isHidden = false\n        emojiListView.isHidden = true\n        chatTextView.resignFirstResponder()\n        \n        restToolbarContentHeight()\n        moreMenuView.reloadData()\n        \n        delegate?.keyboard(self, DidBecome: true)\n    }\n    \n    /// 更改容器高度\n    func restToolbarContentHeight(_ isRest: Bool = false) {\n        var changedY = kScreenH - self.toolBarHeight - kNavigaH - contentHeight\n        if (isRest) {\n            if isShowEmoji {\n                isShowEmoji = false\n            }\n            if (isShowMore) {\n                isShowMore = false\n            }\n            \n            changedY = kScreenH - self.toolBarHeight - kNavigaH - contentHeight - kSafeAreaBottom\n        }\n        \n        UIView.animate(withDuration: 0.25, delay: 0, options: .curveEaseOut, animations: {\n            self.contentView.frame = CGRect(x: 0, y: self.toolBarView.maxY, width: kScreenW, height: self.contentHeight)\n            self.emojiListView.frame = self.contentView.bounds\n            self.moreMenuView.frame = self.contentView.bounds\n            self.frame = CGRect(x: 0, y: changedY, width: kScreenW, height: self.toolBarHeight + self.contentHeight)\n        }, completion: nil)\n        \n        self.layoutIfNeeded()\n    }\n    \n}\n\n// MARK: - 改变输入框高度位置\n\nextension ChatKeyboardView {\n    \n    func changeKeyboardHeight(_ isClear: Bool = false, height: CGFloat) {\n        let textHeight = height\n        \n        toolBarHeight = textHeight + kSpace * 2\n        toolBarView.frame = CGRect(x: toolBarView.x, y: 0, width: toolBarView.width, height: toolBarHeight)\n        \n        let spaceY = toolBarView.height - kSpace - kViewWH\n        chatTextView.frame = CGRect(x: chatTextView.x, y: chatTextView.x, width: chatTextView.width, height: textHeight)\n        moreButton.frame = CGRect(x: moreButton.x, y: spaceY, width: moreButton.width, height: moreButton.height)\n        emojiButton.frame = CGRect(x: emojiButton.x, y: spaceY, width: emojiButton.width, height: emojiButton.height)\n        \n        contentView.frame = CGRect(x: contentView.x, y: toolBarView.maxY, width: contentView.width, height: contentHeight)\n        \n        topLineView.frame = CGRect(x: 0, y: 0, width: kScreenW, height: kLineHeight)\n        bottomLineView.frame = CGRect(x: 0, y: toolBarView.height - kLineHeight, width: kScreenW, height: kLineHeight)\n        \n        \n        if (isShowKeyboard) {\n            if isShowEmoji {\n                isShowEmoji = false\n            }\n            if (isShowMore) {\n                isShowMore = false\n            }\n            \n            let changedY = kScreenH - keyboardHeight - toolBarHeight - kNavigaH\n            self.frame = CGRect(x: 0, y: changedY, width: kScreenW, height: toolBarView.height + contentView.height)\n        }else {\n            let changedY = kScreenH - kNavigaH - (toolBarView.height + contentView.height)\n            self.frame = CGRect(x: 0, y: changedY, width: kScreenW, height: toolBarView.height + contentView.height)\n        }\n        \n        self.setNeedsLayout()\n        //printLog(\"ToolBarHeight === \\(toolBarView.height)\")\n        printLog(\"self y === \\(self.frame.origin.y)\")\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/ChatMoreMenuView.swift",
    "content": "//\n//  ChatMoreMenuView.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/14.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\n/// 行数\nfileprivate let kRowNumber = 2\n/// 列数\nfileprivate let kColumnNumber = 4\n\nfileprivate let kMoreMenuCellNumberOfOnePage = kRowNumber * kColumnNumber\n\nprotocol ChatMoreMenuViewDelegate {\n    /// 获取选择的菜单\n    func menu(_ view: ChatMoreMenuView, DidSelected type: ChatMoreMenuType)\n}\n\nextension ChatMoreMenuViewDelegate {\n    \n    func menu(_ view: ChatMoreMenuView, DidSelected type: ChatMoreMenuType) {}\n}\n\nclass ChatMoreMenuView: UIView {\n    \n    // MARK: - lazy var\n    \n    var delegate: ChatMoreMenuViewDelegate?\n    \n    /// 隐藏分页指示器\n    var hidePageController: Bool = false {\n        didSet {\n            self.pageControl.alpha = self.hidePageController ? 0.0 : 1.0\n            UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseOut, animations: {\n                self.pageControl.isHidden = self.hidePageController\n            }, completion: nil)\n            \n            self.collectionView.scrollToItem(at: IndexPath(row: 0, section: 0), at: .centeredHorizontally, animated: false)\n        }\n    }\n        \n    var pageIndicatorTintColor: UIColor? {\n        didSet {\n            guard pageIndicatorTintColor != nil else {\n                return\n            }\n            pageControl.pageIndicatorTintColor = pageIndicatorTintColor\n        }\n    }\n    \n    var currentPageIndicatorTintColor: UIColor? {\n        didSet {\n            guard currentPageIndicatorTintColor != nil else {\n                return\n            }\n            pageControl.currentPageIndicatorTintColor = currentPageIndicatorTintColor\n        }\n    }\n\n    lazy var dataSource: [ChatMoreMnueConfig] = {\n        let configs = [\n            ChatMoreMnueConfig(title: \"图片\".rLocalized(), image: \"ic_more_album\", type: .album),\n            ChatMoreMnueConfig(title: \"拍照\".rLocalized(), image: \"ic_more_camera\", type: .camera),\n            ChatMoreMnueConfig(title: \"视频\".rLocalized(), image: \"ic_more_video\", type: .video),\n            ChatMoreMnueConfig(title: \"位置\".rLocalized(), image: \"ic_more_location\", type: .location),\n            ChatMoreMnueConfig(title: \"语音\".rLocalized(), image: \"ic_more_voice\", type: .voice),\n            ChatMoreMnueConfig(title: \"钱包\".rLocalized(), image: \"ic_more_wallet\", type: .wallet),\n            ChatMoreMnueConfig(title: \"转账\".rLocalized(), image: \"ic_more_pay\", type: .pay),\n            ChatMoreMnueConfig(title: \"名片\".rLocalized(), image: \"ic_more_friendcard\", type: .friendcard),\n            ChatMoreMnueConfig(title: \"收藏\".rLocalized(), image: \"ic_more_favorite\", type: .favorite),\n            ChatMoreMnueConfig(title: \"隐藏\".rLocalized(), image: \"ic_more_sight\", type: .sight)]\n        return configs\n    }()\n    \n    lazy var collectionView: UICollectionView = {\n        let layout = ChatKeyboardFlowLayout(column: kColumnNumber, row: kRowNumber)\n        // collectionView\n        let collection = UICollectionView(frame: self.bounds, collectionViewLayout: layout)\n        collection.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V14 }\n        collection.register(cellWithClass: ChatMoreMenuCell.self)\n        collection.showsHorizontalScrollIndicator = true\n        collection.showsVerticalScrollIndicator = true\n        collection.dataSource = self\n        collection.delegate = self\n        collection.isPagingEnabled = true\n        return collection\n    }()\n    \n    lazy var pageControl: UIPageControl = {\n        let pager = UIPageControl()\n        pager.backgroundColor = .clear\n        pager.theme.pageIndicatorTintColor = themed { $0.FYColor_BorderColor_V1 }\n        pager.theme.currentPageIndicatorTintColor = themed { $0.FYColor_Main_TextColor_V3 }\n        pager.currentPage = 0\n        pager.isHidden = true\n        pager.numberOfPages = self.dataSource.count / kMoreMenuCellNumberOfOnePage + (self.dataSource.count % kMoreMenuCellNumberOfOnePage == 0 ? 0 : 1)\n        return pager\n    }()\n    \n    // MARK: - life cycle\n    \n    override init(frame: CGRect) {\n        super.init(frame: frame)\n           \n        makeUI()\n        reloadData()\n    }\n       \n    required init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n\n        makeUI()\n        reloadData()\n    }\n    \n    func makeUI() {\n        self.theme.backgroundColor = themed { $0.FYColor_BackgroundColor_V14 }\n        \n        addSubview(pageControl)\n        addSubview(collectionView)\n        \n        pageControl.snp.makeConstraints { make in\n            make.bottom.equalToSuperview().offset(-kSafeAreaBottom)\n            make.centerX.equalToSuperview()\n            make.height.equalTo(30)\n        }\n        \n        collectionView.snp.makeConstraints { make in\n            make.top.left.right.equalToSuperview()\n            make.bottom.equalTo(pageControl.snp.top)\n        }\n    }\n    \n    open func reloadData() {\n        self.needsUpdateConstraints()\n        self.layoutIfNeeded()\n        \n        UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseOut, animations: {\n            self.pageControl.alpha = 1.0\n            self.pageControl.isHidden = false\n        }, completion: nil)\n        \n        DispatchQueue.main.async {\n            self.collectionView.reloadData()\n        }\n    }\n}\n\n\n// MARK: - UICollectionViewDataSource\n\nextension ChatMoreMenuView: UICollectionViewDataSource {\n    \n    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        return dataSource.count\n    }\n    \n    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        let cell = collectionView.dequeueReusableCell(withClass: ChatMoreMenuCell.self, for: indexPath)\n        if let model = dataSource[safe: indexPath.row] {\n            cell.model = model\n        }\n        return cell\n    }\n    \n}\n\n// MARK: - UICollectionViewDelegate\n\nextension ChatMoreMenuView: UICollectionViewDelegate {\n    \n    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {\n        if let model = dataSource[safe: indexPath.row] {\n            delegate?.menu(self, DidSelected: model.type!)\n        }\n    }\n}\n\nextension ChatMoreMenuView {\n    \n    func scrollViewDidScroll(_ scrollView: UIScrollView) {\n        if scrollView == collectionView {\n            let offsetX = scrollView.contentOffset.x\n            let index = offsetX / kScreenW\n            pageControl.currentPage = Int(index)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Helper/ChatEmotionAttachment.swift",
    "content": "//\n//  ChatEmotionAttachment.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/22.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass ChatEmotionAttachment: NSTextAttachment {\n    var text: String?\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Helper/ChatEmotionHelper.swift",
    "content": "//\n//  ChatEmotionHelper.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/21.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass ChatEmotionHelper: NSObject {\n    \n    // MARK: - 获取Apple表情模型数组\n    class func getAppleAllEmotions() -> [ChatEmoticon] {\n        var emotions: [ChatEmoticon] = [ChatEmoticon]()\n        let root = NSDictionary(contentsOf: .kAppleEmojiURL)\n        let array = root?[\"emoticons\"] as! [[String : String]]\n        var index = 0\n        for dict in array {\n            emotions.append(ChatEmoticon(dict: dict))\n            index += 1\n            if index == 23 {\n                // 添加删除表情\n                emotions.append(ChatEmoticon(isDelete: true))\n                index = 0\n            }\n        }\n        \n        // 添加空白表情\n        emotions = self.addEmptyEmotion(emotiions: emotions)\n        \n        return emotions\n    }\n    \n    // MARK: - 获取WeChat表情模型数组\n    class func getWeChatAllEmotions() -> [ChatEmoticon] {\n        var emotions: [ChatEmoticon] = [ChatEmoticon]()\n        let plistPath = Bundle.main.path(forResource: \"Expression\", ofType: \"plist\")\n        let array = NSArray(contentsOfFile: plistPath!) as! [[String : String]]\n        \n        var index = 0\n        for dict in array {\n            emotions.append(ChatEmoticon(dict: dict))\n            index += 1\n            if index == 23 {\n                // 添加删除表情\n                emotions.append(ChatEmoticon(isDelete: true))\n                index = 0\n            }\n        }\n        \n        // 添加空白表情\n        emotions = self.addEmptyEmotion(emotiions: emotions)\n        \n        return emotions\n    }\n    \n    // 添加空白表情\n    fileprivate class func addEmptyEmotion(emotiions: [ChatEmoticon]) -> [ChatEmoticon] {\n        var emos = emotiions\n        let count = emos.count % 24\n        if count == 0 {\n            return emos\n        }\n        for _ in count..<23 {\n            emos.append(ChatEmoticon(isSpace: true))\n        }\n        emos.append(ChatEmoticon(isDelete: true))\n        return emos\n    }\n    \n    class func getImagePath(emotionName: String?) -> String? {\n        if emotionName == nil {\n            return nil\n        }\n        return Bundle.main.bundlePath + \"/Expression.bundle/\" + emotionName! + \".png\"\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Helper/ChatFindEmotion.swift",
    "content": "//\n//  ChatFindEmotion.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/22.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nclass ChatFindEmotion: NSObject {\n    // MARK: - 单例\n    static let shared: ChatFindEmotion = ChatFindEmotion()\n    \n    // MARK: - 查找属性字符串的方法\n    func findAttrStr(text: String?, font: UIFont) -> NSMutableAttributedString? {\n        guard let text = text else {\n            return nil\n        }\n        \n        let pattern = \"\\\\[.*?\\\\]\" // 匹配表情\n        \n        guard let regex = try? NSRegularExpression(pattern: pattern, options: []) else {\n            return nil\n        }\n        \n        let resutlts = regex.matches(in: text, options: [], range: NSMakeRange(0, text.count))\n        \n        let attrMStr = NSMutableAttributedString(string: text, attributes: [NSAttributedString.Key.font : font])\n        \n        for (_, result) in resutlts.enumerated().reversed() {\n            let emojiCode = (text as NSString).substring(with: result.range)\n            guard let imgPath = findImagePath(emojiCode: emojiCode) else {\n                return nil\n            }\n            let attachment = NSTextAttachment()\n            attachment.image = UIImage(contentsOfFile: imgPath)\n            attachment.bounds = CGRect(x: 0, y: -4, width: font.lineHeight, height: font.lineHeight)\n            let attrImageStr = NSAttributedString(attachment: attachment)\n            attrMStr.replaceCharacters(in: result.range, with: attrImageStr)\n        }\n        \n        return attrMStr\n    }\n    \n    \n    func findImagePath(emojiCode: String) -> String? {\n        for emotion in ChatEmotionHelper.getWeChatAllEmotions() {\n            if emotion.text! == emojiCode {\n                return emotion.imgPath\n            }\n        }\n        return nil\n    }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Model/ChatEmoticon.swift",
    "content": "//\n//  ChatEmoticon.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\n@objcMembers\nclass ChatEmoticon: NSObject {\n    \n    // MARK: - 定义属性\n    \n    var type: String?\n    var chs: String?\n    var text: String?\n    \n    \n    var image: String? {   // 表情对应的图片名称\n        didSet {\n            imgPath = Bundle.main.bundlePath + \"/Expression.bundle/\" + image! + \".png\"\n        }\n    }\n    \n    \n    var code: String? {\n        didSet {\n            if let code = code {\n                //创建扫描器\n                let scanner = Scanner(string: code)\n                var result: UInt32 = 0\n                //利用扫描器扫出结果\n                scanner.scanHexInt32(&result)\n                //将结果转换成字符\n                let c = Character(UnicodeScalar(result)!)\n                //将字符转换成字符串\n                emojiCode = String(c)\n            }\n        }\n    }\n    \n    /// emoji表情解析后的code码\n    var emojiCode: String?\n    \n    /// 图片的绝对路径\n    var imgPath: String?\n    \n    /// 是否是移除键\n    var isDelete: Bool = false\n    /// 是否是空格\n    var isSpace: Bool = false\n    \n     init(dict: [String: String]) {\n        super.init()\n        \n        setValuesForKeys(dict)\n    }\n    \n    init(isDelete: Bool) {\n        super.init()\n        self.isDelete = true\n    }\n    \n    init(isSpace: Bool) {\n        super.init()\n        self.isSpace = true\n    }\n    \n    override func setValue(_ value: Any?, forUndefinedKey key: String) {\n        \n    }\n}\n\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Model/ChatMoreMnueConfig.swift",
    "content": "//\n//  ChatMoreMnueConfig.swift\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/11/18.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\nimport UIKit\n\nenum ChatMoreMenuType: Int {\n    case album = 1001\n    case camera = 1002\n    case video = 1003\n    case location = 1004\n    case voice = 1005\n    case wallet = 1006\n    case pay = 1007\n    case friendcard = 1008\n    case favorite = 1009\n    case sight = 1010\n}\n\nclass ChatMoreMnueConfig: NSObject {\n    var title: String?\n    var image: String?\n    \n    var type: ChatMoreMenuType?\n    \n    init(title: String, image: String, type: ChatMoreMenuType) {\n        super.init()\n        \n        self.title = title\n        self.image = image\n        self.type = type\n    }\n    \n    required override init() { }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Resource/Emoji/Emoticons.bundle/com.apple.emoji/info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>id</key>\n\t<string>com.apple.emoji</string>\n\t<key>version</key>\n\t<real>2</real>\n\t<key>group_name_cn</key>\n\t<string>Emoji</string>\n\t<key>group_name_en</key>\n\t<string>Emoji</string>\n\t<key>group_name_tw</key>\n\t<string>Emoji</string>\n\t<key>display_only</key>\n\t<integer>0</integer>\n\t<key>group_type</key>\n\t<integer>0</integer>\n\t<key>emoticons</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f603</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f60d</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f612</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f633</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f601</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f618</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f609</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f620</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f61e</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f625</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f62d</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f61d</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f621</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f623</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f614</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f604</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f637</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f61a</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f613</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f602</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f60a</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f622</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f61c</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f628</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f630</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f632</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f60f</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f631</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f62a</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f616</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f60c</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f47f</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f47b</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f385</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f467</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f466</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f469</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f468</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f436</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f431</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f44d</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f44e</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f44a</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x270a</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x270c</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f4aa</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f44f</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f448</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f446</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f449</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f447</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f44c</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x2764</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f494</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f64f</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x2600</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f319</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f31f</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x26a1</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x2601</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x2614</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f341</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f33b</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f343</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f457</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f380</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f444</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f339</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x2615</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f382</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f559</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f37a</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f50d</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f4f1</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f3e0</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f697</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f381</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x26bd</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f4a3</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>code</key>\n\t\t\t<string>0x1f48e</string>\n\t\t\t<key>type</key>\n\t\t\t<string>1</string>\n\t\t</dict>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/KeyboardCore/Resource/Emotion/Expression.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<array>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[微笑]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_1</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[撇嘴]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_2</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[色]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_3</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[发呆]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_4</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[得意]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_5</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[流泪]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_6</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[害羞]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_7</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[闭嘴]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_8</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[睡]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_9</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[大哭]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_10</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[尴尬]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_11</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[发怒]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_12</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[调皮]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_13</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[呲牙]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_14</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[惊讶]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_15</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[难过]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_16</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[酷]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_17</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[冷汗]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_18</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[抓狂]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_19</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[吐]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_20</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[偷笑]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_21</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[愉快]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_22</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[白眼]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_23</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[傲慢]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_24</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[饥饿]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_25</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[困]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_26</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[惊恐]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_27</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[流汗]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_28</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[憨笑]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_29</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[悠闲]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_30</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[奋斗]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_31</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[咒骂]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_32</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[疑问]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_33</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[嘘]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_34</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[晕]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_35</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[疯了]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_36</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[衰]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_37</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[骷髅]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_38</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[敲打]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_39</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[再见]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_40</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[擦汗]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_41</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[抠鼻]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_42</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[鼓掌]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_43</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[糗大了]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_44</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[坏笑]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_45</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[左哼哼]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_46</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[右哼哼]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_47</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[哈欠]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_48</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[鄙视]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_49</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[委屈]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_50</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[快哭了]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_51</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[阴险]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_52</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[亲亲]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_53</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[吓]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_54</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[可怜]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_55</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[菜刀]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_56</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[西瓜]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_57</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[啤酒]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_58</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[篮球]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_59</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[乒乓]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_60</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[咖啡]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_61</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[饭]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_62</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[猪头]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_63</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[玫瑰]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_64</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[凋谢]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_65</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[嘴唇]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_66</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[爱心]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_67</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[心碎]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_68</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[蛋糕]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_69</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[闪电]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_70</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[炸弹]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_71</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[刀]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_72</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[足球]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_73</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[瓢虫]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_74</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[便便]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_75</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[月亮]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_76</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[太阳]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_77</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[礼物]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_78</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[拥抱]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_79</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[强]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_80</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[弱]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_81</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[握手]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_82</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[胜利]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_83</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[抱拳]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_84</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[勾引]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_85</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[拳头]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_86</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[差劲]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_87</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[爱你]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_88</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[NO]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_89</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[OK]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_90</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[爱情]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_91</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[飞吻]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_92</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[跳跳]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_93</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[发抖]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_94</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[怄火]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_95</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[转圈]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_96</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[磕头]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_97</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[回头]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_98</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[跳绳]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_99</string>\n\t</dict>\n\t<dict>\n\t\t<key>text</key>\n\t\t<string>[投降]</string>\n\t\t<key>image</key>\n\t\t<string>Expression_100</string>\n\t</dict>\n</array>\n</plist>\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/Theme/FYDarkTheme.swift",
    "content": "//\n//  FYDarkTheme.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/30.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport RxSwift\nimport RxTheme\n\nstruct FYDarkTheme: Theme {\n\n    // MARK: - **************************** Dark Color ****************************\n    \n    // MARK: - 导航栏\n    /// 导航栏背景色   黑-> 10171B\n    var FYColor_Nav_BackgroundColor = UIColor.Color_Black_10171B\n    \n    // MARK: - TabBar\n    /// TabBar背景色 黑-> 181D21\n    var FYColor_Tab_BackgroundColor = UIColor.Color_Black_181D21\n    \n    // MARK: - 背景色\n    /// 一级模块背景色     黑 -> 181D21 白 -> FFFFFF\n    var FYColor_BackgroundColor_V1 = UIColor.Color_Black_181D21\n    \n    /// 二级模块背景色     黑 -> 252D33 白 -> F6F6F6\n    var FYColor_BackgroundColor_V2 = UIColor.Color_Black_252D33\n    \n    /// 三级模块背景色   黑 -> FFFFFF 白 -> 000000\n    var FYColor_BackgroundColor_V3 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> FFFFFF 白 -> F6F6F6\n    var FYColor_BackgroundColor_V4 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 252D33 白 -> FFFFFF\n    var FYColor_BackgroundColor_V5 = UIColor.Color_Black_252D33\n    \n    /// 黑 -> 2B343B 白 -> 384955\n    var FYColor_BackgroundColor_V6 = UIColor.Color_Black_2B343B\n    \n    /// 黑 -> 10171B 白 -> C0C0C0\n    var FYColor_BackgroundColor_V7 = UIColor.Color_Black_10171B\n    \n    /// 黑 -> 000000 白 -> F6F6F6\n    var FYColor_BackgroundColor_V8 = UIColor.Color_Black_000000\n    \n    /// 黑 -> 10171B 白 -> 2C363E\n    var FYColor_BackgroundColor_V9 = UIColor.Color_Black_10171B\n    \n    /// 黑 -> 2C363E 白 -> F6F6F6\n    var FYColor_BackgroundColor_V10 = UIColor.Color_Black_2C363E\n    \n    /// 黑 -> 0F1317 白 -> F6F6F6\n    var FYColor_BackgroundColor_V11 = UIColor.Color_Black_0F1317\n    \n    /// 黑 -> 2C363E 白 -> FFFFFF\n    var FYColor_BackgroundColor_V12 = UIColor.Color_Black_2C363E\n    \n    /// 黑 -> 272D34 白 -> F7F7F7\n    var FYColor_BackgroundColor_V13 = UIColor.Color_Black_272D34\n    \n    /// 黑 -> 272D34 白 -> F8F8F8\n    var FYColor_BackgroundColor_V14 = UIColor.Color_Black_272D34\n    \n    /// 黑 -> 10171B 白 -> CCCCCC\n    var FYColor_BackgroundColor_V15 = UIColor.Color_Black_10171B\n    \n    //MARK: - 边框颜色\n    /// 黑 -> 1E2328 白 -> E5E5E5\n    var FYColor_BorderColor_V1 = UIColor.Color_Gray_1E2328\n    \n    /// 黑 -> 5A636D 白 -> E5E5E5\n    var FYColor_BorderColor_V2 = UIColor.Color_Gray_5A636D\n    \n    /// 黑 -> 12171B 白 -> F6F6F6\n    var FYColor_BorderColor_V3 = UIColor.Color_Black_12171B\n    \n    /// 黑 -> 181D21 白 -> E5E5E5\n    var FYColor_BorderColor_V4 = UIColor.Color_Black_181D21\n    \n    /// 黑 -> FFFFFF 白 -> E5E5E5\n    var FYColor_BorderColor_V5 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 1E2328 白 -> F6F6F6\n    var FYColor_BorderColor_V6 = UIColor.Color_Gray_1E2328\n    \n    /// 黑 -> 272E37 白 -> E5E5E5\n    var FYColor_BorderColor_V7 = UIColor.Color_Gray_272E37\n    \n    /// 黑 -> 12171B 白 -> E5E5E5\n    var FYColor_BorderColor_V8 = UIColor.Color_Black_12171B\n    \n    /// 黑 -> 2C363E 白 -> E5E5E5\n    var FYColor_BorderColor_V9 = UIColor.Color_Black_2C363E\n    \n    // MARK: - 文本颜色 (Placeholder)\n    /// 黑 -> 919191 白 -> B4B4B4\n    var FYColor_Placeholder_Color_V1 = UIColor.Color_Gray_919191\n    \n    /// 黑 -> 6D777C 白 -> 999999\n    var FYColor_Placeholder_Color_V2 = UIColor.Color_Gray_6D777C\n    \n    /// 黑 -> FFFFFF 白 -> 999999\n    var FYColor_Placeholder_Color_V3 = UIColor.Color_Gray_999999\n    \n    // MARK: - 文本颜色 (TextColor)\n    /// 黑 -> FFFFFF 白 -> 000000\n    var FYColor_Main_TextColor_V1 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 5A636D 白 -> 77808A\n    var FYColor_Main_TextColor_V2 = UIColor.Color_Gray_5A636D\n    \n    /// 黑 -> FFFFFF 白 -> 77808A\n    var FYColor_Main_TextColor_V3 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 919191 白 -> 1D1E34\n    var FYColor_Main_TextColor_V4 = UIColor.Color_Gray_919191\n    \n    /// 黑 -> 000000 白 -> FFFFFF\n    var FYColor_Main_TextColor_V5 = UIColor.Color_Gray_919191\n    \n    /// 黑 -> 000000 白 -> 000000\n    var FYColor_Main_TextColor_V6 = UIColor.Color_Black_000000\n    \n    /// 黑 -> 5A636D 白 -> B4B4B4\n    var FYColor_Main_TextColor_V7 = UIColor.Color_Gray_5A636D\n    \n    /// 黑 -> FFBF27 白 -> 000000\n    var FYColor_Main_TextColor_V8 = UIColor.Color_Yellow_FFBF27\n    \n    /// 黑 -> FFFFFF 白 -> 666666\n    var FYColor_Main_TextColor_V9 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 9BA1A4 白 -> 666666\n    var FYColor_Main_TextColor_V10 = UIColor.Color_Gray_9BA1A4\n    \n    /// 黑 -> FFFFFF 白 -> 1A1F24\n    var FYColor_Main_TextColor_V11 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> FFFFFF 白 -> 1890FF\n    var FYColor_Main_TextColor_V12 = UIColor.Color_White_FFFFFF\n    \n    \n    // MARK: - UIImage Configuration\n    \n    var nav_back_image = R.image.nav_back_white()!\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/Theme/FYLightTheme.swift",
    "content": "//\n//  FYLightTheme.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/30.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport RxSwift\nimport RxTheme\n\nstruct FYLightTheme: Theme {\n\n    // MARK: - **************************** Light Color ****************************\n    \n    // MARK: - 导航栏\n    /// 导航栏背景色   白-> 696969\n    var FYColor_Nav_BackgroundColor = UIColor.Color_Gray_696969\n    \n    // MARK: - TabBar\n    /// TabBar背景色  白-> FFFFFF\n    var FYColor_Tab_BackgroundColor = UIColor.Color_White_FFFFFF\n    \n    // MARK: - 背景色\n    /// 一级模块背景色     黑 -> 181D21 白 -> FFFFFF\n    var FYColor_BackgroundColor_V1 = UIColor.Color_White_FFFFFF\n    \n    /// 二级模块背景色     黑 -> 252D33 白 -> F6F6F6\n    var FYColor_BackgroundColor_V2 = UIColor.Color_Gray_F6F6F6\n    \n    /// 三级模块背景色   黑 -> FFFFFF 白 -> 000000\n    var FYColor_BackgroundColor_V3 = UIColor.Color_Black_000000\n    \n    /// 黑 -> FFFFFF 白 -> F6F6F6\n    var FYColor_BackgroundColor_V4 = UIColor.Color_Gray_F6F6F6\n    \n    /// 黑 -> 252D33 白 -> FFFFFF\n    var FYColor_BackgroundColor_V5 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 2B343B 白 -> 384955\n    var FYColor_BackgroundColor_V6 = UIColor.Color_Gray_384955\n    \n    /// 黑 -> 10171B 白 -> C0C0C0\n    var FYColor_BackgroundColor_V7 = UIColor.Color_Gray_C0C0C0\n    \n    /// 黑 -> 000000 白 -> F6F6F6\n    var FYColor_BackgroundColor_V8 = UIColor.Color_Gray_F6F6F6\n    \n    /// 黑 -> 10171B 白 -> 2C363E\n    var FYColor_BackgroundColor_V9 = UIColor.Color_Black_2C363E\n    \n    /// 黑 -> 2C363E 白 -> F6F6F6\n    var FYColor_BackgroundColor_V10 = UIColor.Color_Gray_F6F6F6\n    \n    /// 黑 -> 0F1317 白 -> F6F6F6\n    var FYColor_BackgroundColor_V11 = UIColor.Color_Gray_F6F6F6\n    \n    /// 黑 -> 2C363E 白 -> FFFFFF\n    var FYColor_BackgroundColor_V12 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 272D34 白 -> F7F7F7\n    var FYColor_BackgroundColor_V13 = UIColor.Color_Gray_F7F7F7\n    \n    /// 黑 -> 272D34 白 -> F8F8F8\n    var FYColor_BackgroundColor_V14 = UIColor.Color_Gray_F8F8F8\n    \n    /// 黑 -> 10171B 白 -> CCCCCC\n    var FYColor_BackgroundColor_V15 = UIColor.Color_Gray_CCCCCC\n    \n    //MARK: - 边框颜色\n    /// 黑 -> 1E2328 白 -> E5E5E5\n    var FYColor_BorderColor_V1 = UIColor.Color_Gray_E5E5E5\n    \n    /// 黑 -> 5A636D 白 -> E5E5E5\n    var FYColor_BorderColor_V2 = UIColor.Color_Gray_E5E5E5\n    \n    /// 黑 -> 12171B 白 -> F6F6F6\n    var FYColor_BorderColor_V3 = UIColor.Color_Gray_F6F6F6\n    \n    /// 黑 -> 181D21 白 -> E5E5E5\n    var FYColor_BorderColor_V4 = UIColor.Color_Gray_E5E5E5\n    \n    /// 黑 -> FFFFFF 白 -> E5E5E5\n    var FYColor_BorderColor_V5 = UIColor.Color_Gray_E5E5E5\n    \n    /// 黑 -> 1E2328 白 -> F6F6F6\n    var FYColor_BorderColor_V6 = UIColor.Color_Gray_F6F6F6\n    \n    /// 黑 -> 272E37 白 -> E5E5E5\n    var FYColor_BorderColor_V7 = UIColor.Color_Gray_E5E5E5\n    \n    /// 黑 -> 12171B 白 -> E5E5E5\n    var FYColor_BorderColor_V8 = UIColor.Color_Gray_E5E5E5\n    \n    /// 黑 -> 2C363E 白 -> E5E5E5\n    var FYColor_BorderColor_V9 = UIColor.Color_Gray_E5E5E5\n    \n    // MARK: - 文本颜色 (Placeholder)\n    /// 黑 -> 919191 白 -> B4B4B4\n    var FYColor_Placeholder_Color_V1 = UIColor.Color_Gray_B4B4B4\n    \n    /// 黑 -> 6D777C 白 -> 999999\n    var FYColor_Placeholder_Color_V2 = UIColor.Color_Gray_999999\n    \n    /// 黑 -> FFFFFF 白 -> 999999\n    var FYColor_Placeholder_Color_V3 = UIColor.Color_White_FFFFFF\n    \n    // MARK: - 文本颜色 (TextColor)\n    /// 黑 -> FFFFFF 白 -> 000000\n    var FYColor_Main_TextColor_V1 = UIColor.Color_Black_000000\n    \n    /// 黑 -> 5A636D 白 -> 77808A\n    var FYColor_Main_TextColor_V2 = UIColor.Color_Gray_77808A\n    \n    /// 黑 -> FFFFFF 白 -> 77808A\n    var FYColor_Main_TextColor_V3 = UIColor.Color_Gray_77808A\n    \n    /// 黑 -> 919191 白 -> 1D1E34\n    var FYColor_Main_TextColor_V4 = UIColor.Color_Black_1D1E34\n    \n    /// 黑 -> 000000 白 -> FFFFFF\n    var FYColor_Main_TextColor_V5 = UIColor.Color_White_FFFFFF\n    \n    /// 黑 -> 000000 白 -> 000000\n    var FYColor_Main_TextColor_V6 = UIColor.Color_Black_000000\n    \n    /// 黑 -> 5A636D 白 -> B4B4B4\n    var FYColor_Main_TextColor_V7 = UIColor.Color_Gray_B4B4B4\n    \n    /// 黑 -> FFBF27 白 -> 000000\n    var FYColor_Main_TextColor_V8 = UIColor.Color_Black_000000\n    \n    /// 黑 -> FFFFFF 白 -> 666666\n    var FYColor_Main_TextColor_V9 = UIColor.Color_Gray_666666\n    \n    /// 黑 -> 9BA1A4 白 -> 666666\n    var FYColor_Main_TextColor_V10 = UIColor.Color_Gray_666666\n\n    /// 黑 -> FFFFFF 白 -> 1A1F24\n    var FYColor_Main_TextColor_V11 = UIColor.Color_Gray_1A1F24\n    \n    /// 黑 -> FFFFFF 白 -> 1890FF\n    var FYColor_Main_TextColor_V12 = UIColor.Color_Blue_1890FF\n    \n    // MARK: - UIImage Configuration\n    \n    var nav_back_image = R.image.nav_back_black()!\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/Theme/FYThemeCenter.swift",
    "content": "//\n//  FYThemeCenter.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/30.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\nimport RxSwift\nimport RxTheme\n\nlet themeService = ThemeType.service(initial: .dark)\n\npublic enum FYThemeMode: Int {\n    /// 跟随系统\n    case system = 0\n    /// 白天模式\n    case light = 1\n    /// 黑夜模式\n    case dark = 2\n}\n\nprotocol Theme {\n    \n    // MARK: - 导航栏\n    /// 导航栏背景色   黑-> 10171B 白-> 696969\n    var FYColor_Nav_BackgroundColor: UIColor { get }\n    \n    // MARK: - TabBar\n    /// TabBar背景色 黑-> 181D21 白-> FFFFFF\n    var FYColor_Tab_BackgroundColor: UIColor { get }\n    \n    // MARK: - 背景色\n    /// 一级模块背景色     黑 -> 181D21 白 -> FFFFFF\n    var FYColor_BackgroundColor_V1: UIColor { get }\n    \n    /// 二级模块背景色     黑 -> 252D33 白 -> F6F6F6\n    var FYColor_BackgroundColor_V2: UIColor { get }\n    \n    /// 三级级模块背景色   黑 -> FFFFFF 白 -> 000000\n    var FYColor_BackgroundColor_V3: UIColor { get }\n    \n    /// 黑 -> FFFFFF 白 -> F6F6F6\n    var FYColor_BackgroundColor_V4: UIColor { get }\n    \n    /// 黑 -> 252D33 白 -> FFFFFF\n    var FYColor_BackgroundColor_V5: UIColor { get }\n    \n    /// 黑 -> 2B343B 白 -> 384955\n    var FYColor_BackgroundColor_V6: UIColor { get }\n    \n    /// 黑 -> 10171B 白 -> C0C0C0\n    var FYColor_BackgroundColor_V7: UIColor { get }\n    \n    /// 黑 -> 000000 白 -> F6F6F6\n    var FYColor_BackgroundColor_V8: UIColor { get }\n    \n    /// 黑 -> 10171B 白 -> 2C363E\n    var FYColor_BackgroundColor_V9: UIColor { get }\n    \n    /// 黑 -> 2C363E 白 -> F6F6F6\n    var FYColor_BackgroundColor_V10: UIColor { get }\n    \n    /// 黑 -> 0F1317 白 -> F6F6F6\n    var FYColor_BackgroundColor_V11: UIColor { get }\n    \n    /// 黑 -> 2C363E 白 -> FFFFFF\n    var FYColor_BackgroundColor_V12: UIColor { get }\n    \n    /// 黑 -> 272D34 白 -> F7F7F7\n    var FYColor_BackgroundColor_V13: UIColor { get }\n    \n    /// 黑 -> 272D34 白 -> F8F8F8\n    var FYColor_BackgroundColor_V14: UIColor { get }\n    \n    /// 黑 -> 10171B 白 -> CCCCCC\n    var FYColor_BackgroundColor_V15: UIColor { get }\n    \n    //MARK: - 边框颜色\n    /// 黑 -> 1E2328 白 -> E5E5E5\n    var FYColor_BorderColor_V1: UIColor { get }\n    \n    /// 黑 -> 5A636D 白 -> E5E5E5\n    var FYColor_BorderColor_V2: UIColor { get }\n    \n    /// 黑 -> 12171B 白 -> F6F6F6\n    var FYColor_BorderColor_V3: UIColor { get }\n    \n    /// 黑 -> 181D21 白 -> E5E5E5\n    var FYColor_BorderColor_V4: UIColor { get }\n    \n    /// 黑 -> FFFFFF 白 -> E5E5E5\n    var FYColor_BorderColor_V5: UIColor { get }\n    \n    /// 黑 -> 1E2328 白 -> F6F6F6\n    var FYColor_BorderColor_V6: UIColor { get }\n    \n    /// 黑 -> 272E37 白 -> E5E5E5\n    var FYColor_BorderColor_V7: UIColor { get }\n    \n    /// 黑 -> 12171B 白 -> E5E5E5\n    var FYColor_BorderColor_V8: UIColor { get }\n    \n    /// 黑 -> 2C363E 白 -> E5E5E5\n    var FYColor_BorderColor_V9: UIColor { get }\n    \n    // MARK: - 文本颜色 (Placeholder)\n    /// 黑 -> 919191 白 -> B4B4B4\n    var FYColor_Placeholder_Color_V1: UIColor { get }\n    \n    /// 黑 -> 6D777C 白 -> 999999\n    var FYColor_Placeholder_Color_V2: UIColor { get }\n    \n    /// 黑 -> FFFFFF 白 -> 999999\n    var FYColor_Placeholder_Color_V3: UIColor { get }\n    \n    // MARK: - 文本颜色 (TextColor)\n    /// 黑 -> FFFFFF 白 -> 000000\n    var FYColor_Main_TextColor_V1: UIColor { get }\n    \n    /// 黑 -> 5A636D 白 -> 77808A\n    var FYColor_Main_TextColor_V2: UIColor { get }\n    \n    /// 黑 -> FFFFFF 白 -> 77808A\n    var FYColor_Main_TextColor_V3: UIColor { get }\n    \n    /// 黑 -> 919191 白 -> 1D1E34\n    var FYColor_Main_TextColor_V4: UIColor { get }\n    \n    /// 黑 -> 000000 白 -> FFFFFF\n    var FYColor_Main_TextColor_V5: UIColor { get }\n    \n    /// 黑 -> 000000 白 -> 000000\n    var FYColor_Main_TextColor_V6: UIColor { get }\n    \n    /// 黑 -> 5A636D 白 -> B4B4B4\n    var FYColor_Main_TextColor_V7: UIColor { get }\n    \n    /// 黑 -> FFBF27 白 -> 000000\n    var FYColor_Main_TextColor_V8: UIColor { get }\n    \n    /// 黑 -> FFFFFF 白 -> 666666\n    var FYColor_Main_TextColor_V9: UIColor { get }\n    \n    /// 黑 -> 9BA1A4 白 -> 666666\n    var FYColor_Main_TextColor_V10: UIColor { get }\n    \n    /// 黑 -> FFFFFF 白 -> 1A1F24\n    var FYColor_Main_TextColor_V11: UIColor { get }\n    \n    /// 黑 -> FFFFFF 白 -> 1890FF\n    var FYColor_Main_TextColor_V12: UIColor { get }\n    \n    \n    // MARK: - UIImage Configuration\n    \n    var nav_back_image: UIImage { get }\n}\n\n\nenum ThemeType: ThemeProvider {\n\n    case light\n    case dark\n\n    var associatedObject: Theme {\n        switch self {\n        case .light:\n            return FYLightTheme()\n        case .dark:\n            return FYDarkTheme()\n        }\n    }\n}\n\nfunc themed<T>(_ mapper: @escaping ((Theme) -> T)) -> ThemeAttribute<T> {\n    return themeService.attribute(mapper)\n}\n\n// MARK: - Center Manager\n\nclass FYThemeCenter: NSObject {\n    \n    /// 单利\n    static let shared = FYThemeCenter()\n    \n    override init() { }\n    \n    \n    /// 保存当前所选主题模式\n    /// - Parameters:\n    ///   - themeMode: 主题模式\n    ///   - isRestWindow: 是否重新载入窗口\n    func saveSelectionTheme(mode: FYThemeMode, isRestWindow: Bool = false) {\n        UserDefaults.standard.set(mode.rawValue, forKey: kThemeSettingUserDefaultKey)\n        UserDefaults.standard.synchronize()\n        \n        if (isRestWindow) {\n            self.resetAppWindow()\n        }\n    }\n    \n    \n    /// 当前已选主题模式\n    /// - Returns: 已选主题模式\n    var currentTheme: FYThemeMode {\n        if let lastTheme = UserDefaults.standard.value(forKey: kThemeSettingUserDefaultKey) as? Int {\n            return FYThemeMode(rawValue: lastTheme) ?? .light\n        }else {\n            return .light\n        }\n    }\n    \n    /// 切换根控制器\n    private func resetAppWindow() {\n        let tabBar = FYBaseTabBarController()\n        UIApplication.shared.keyWindow?.rootViewController = tabBar\n        UIApplication.shared.keyWindow?.makeKeyAndVisible()\n        \n        // FPS\n        AppDelegate.app.setupFPSStatus()\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/Classes/Utilites/Theme/FYThemeColors.swift",
    "content": "//\n//  FYThemeColor.swift\n//  FY-JetChat\n//\n//  Created by Jett on 2022/4/30.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport UIKit\n\nextension UIColor {\n    \n    convenience init(hex: Int, alpha: CGFloat = 1.0) {\n        let red = CGFloat((hex & 0xFF0000) >> 16) / 255\n        let green = CGFloat((hex & 0xFF00) >> 8) / 255\n        let blue = CGFloat(hex & 0xFF) / 255\n        self.init(red: red, green: green, blue: blue, alpha: alpha)\n    }\n    \n    // 白\n    static var Color_White_FFFFFF: UIColor { UIColor(hex: 0xFFFFFF) }\n    static var Color_White_F7F7F7: UIColor { UIColor(hex: 0xF7F7F7) }\n    static var Color_White_F9F9F9: UIColor { UIColor(hex: 0xF9F9F9) }\n    static var Color_White_F7F7FA: UIColor { UIColor(hex: 0xF7F7FA) }\n    static var Color_White_F3F3F3: UIColor { UIColor(hex: 0xF3F3F3) }\n    static var Color_White_F5F5F5: UIColor { UIColor(hex: 0xF5F5F5) }\n    \n    // 黑\n    static var Color_Black_000000: UIColor { UIColor(hex: 0x000000) }\n    static var Color_Black_202C33: UIColor { UIColor(hex: 0x202C33) }\n    static var Color_Black_2F404A: UIColor { UIColor(hex: 0x2F404A) }\n    static var Color_Black_223037: UIColor { UIColor(hex: 0x223037) }\n    static var Color_Black_252D33: UIColor { UIColor(hex: 0x252D33) }\n    static var Color_Black_25333A: UIColor { UIColor(hex: 0x25333A) }\n    static var Color_Black_344A56: UIColor { UIColor(hex: 0x344A56) }\n    static var Color_Black_272D34: UIColor { UIColor(hex: 0x272D34) }\n    static var Color_Black_030303: UIColor { UIColor(hex: 0x030303) }\n    static var Color_Black_10171B: UIColor { UIColor(hex: 0x10171B) }\n    static var Color_Black_181D21: UIColor { UIColor(hex: 0x181D21) }\n    static var Color_Black_1B2025: UIColor { UIColor(hex: 0x1B2025) }\n    static var Color_Black_12171B: UIColor { UIColor(hex: 0x12171B) }\n    static var Color_Black_565F68: UIColor { UIColor(hex: 0x565F68) }\n    static var Color_Black_2C363E: UIColor { UIColor(hex: 0x2C363E) }\n    static var Color_Black_161B1E: UIColor { UIColor(hex: 0x161B1E) }\n    static var Color_Black_2B343B: UIColor { UIColor(hex: 0x2B343B) }\n    static var Color_Black_181818: UIColor { UIColor(hex: 0x181818) }\n    static var Color_Black_433C37: UIColor { UIColor(hex: 0x433C37) }\n    static var Color_Black_0E1418: UIColor { UIColor(hex: 0x0E1418) }\n    static var Color_Black_1D1E34: UIColor { UIColor(hex: 0x0E1418) }\n    static var Color_Black_384955: UIColor { UIColor(hex: 0x384955) }\n    static var Color_Black_0F1317: UIColor { UIColor(hex: 0x0F1317) }\n    static var Color_Black_21272F: UIColor { UIColor(hex: 0x21272F) }\n    static var Color_Black_28323B: UIColor { UIColor(hex: 0x28323B) }\n    static var Color_Black_15191E: UIColor { UIColor(hex: 0x15191E) }\n    static var Color_Black_313944: UIColor { UIColor(hex: 0x313944) }\n    static var Color_Black_1D232A: UIColor { UIColor(hex: 0x1D232A) }\n    static var Color_Black_0E2B2D: UIColor { UIColor(hex: 0x0E2B2D) }\n    static var Color_Black_193434: UIColor { UIColor(hex: 0x193434) }\n    static var Color_Black_29313A: UIColor { UIColor(hex: 0x29313A) }\n    static var Color_Black_1A2029: UIColor { UIColor(hex: 0x1A2029) }\n    static var Color_Black_1E262C: UIColor { UIColor(hex: 0x1E262C) }\n    static var Color_Black_2A2F33: UIColor { UIColor(hex: 0x2A2F33) }\n    static var Color_Black_171D28: UIColor { UIColor(hex: 0x171D28) }\n    static var Color_Black_252C33: UIColor { UIColor(hex: 0x252C33) }\n    static var Color_Black_333333: UIColor { UIColor(hex: 0x333333) }\n    \n    // 绿\n    static var Color_Green_02EAD0: UIColor { UIColor(hex: 0x02EAD0) }\n    static var Color_Green_00D4BC: UIColor { UIColor(hex: 0x00D4BC) }\n    static var Color_Green_27B87D: UIColor { UIColor(hex: 0x27B87D) }\n    static var Color_Green_01E8CE: UIColor { UIColor(hex: 0x01E8CE) }\n    static var Color_Green_00C1AB: UIColor { UIColor(hex: 0x00C1AB) }\n    static var Color_Green_008878: UIColor { UIColor(hex: 0x008878) }\n    static var Color_Green_136440: UIColor { UIColor(hex: 0x136440) }\n    static var Color_Green_16BD74: UIColor { UIColor(hex: 0x16BD74) }\n    static var Color_Green_1ED760: UIColor { UIColor(hex: 0x1ED760) }\n    static var Color_Green_09BB07: UIColor { UIColor(hex: 0x09BB07) }\n    static var Color_Green_124F4C: UIColor { UIColor(hex: 0x124F4C) }\n    static var Color_Green_0A978A: UIColor { UIColor(hex: 0x0A978A) }\n    static var Color_Green_E5FAF8: UIColor { UIColor(hex: 0xE5FAF8) }\n    static var Color_Green_E8F8F6: UIColor { UIColor(hex: 0xE8F8F6) }\n    static var Color_Green_0E413F: UIColor { UIColor(hex: 0x0E413F) }\n    static var Color_Green_CCF2EE: UIColor { UIColor(hex: 0xCCF2EE) }\n    static var Color_Green_102B2D: UIColor { UIColor(hex: 0x102B2D) }\n    static var Color_Green_00C2AD: UIColor { UIColor(hex: 0x00C2AD) }\n    static var Color_Green_163E3E: UIColor { UIColor(hex: 0x163E3E) }\n    static var Color_Green_DBF7F4: UIColor { UIColor(hex: 0xDBF7F4) }\n    static var Color_Green_144848: UIColor { UIColor(hex: 0x144848) }\n    static var Color_Green_00C7B1: UIColor { UIColor(hex: 0x00C7B1) }\n    static var Color_Green_00C0AB: UIColor { UIColor(hex: 0x00C0AB, alpha: 0.2) }\n\n    // 红\n    static var Color_Red_FF5055: UIColor { UIColor(hex: 0xFF5055) }\n    static var Color_Red_FF4646: UIColor { UIColor(hex: 0xFF4646) }\n    static var Color_Red_FF2B00: UIColor { UIColor(hex: 0xFF2B00) }\n    static var Color_Red_EB6164: UIColor { UIColor(hex: 0xEB6164) }\n    static var Color_Red_BB5254: UIColor { UIColor(hex: 0xBB5254) }\n    static var Color_Red_9A4245: UIColor { UIColor(hex: 0x9A4245) }\n    static var Color_Red_FEF6F5: UIColor { UIColor(hex: 0xFEF6F5) }\n    static var Color_Red_FFE8E5: UIColor { UIColor(hex: 0xFFE8E5) }\n    static var Color_Red_F25534: UIColor { UIColor(hex: 0xF25534) }\n    static var Color_Red_8C3624: UIColor { UIColor(hex: 0x8C3624) }\n    static var Color_Red_ED2931: UIColor { UIColor(hex: 0xED2931) }\n    static var Color_Red_F95A3E: UIColor { UIColor(hex: 0xF95A3E) }\n    static var Color_Red_51282D: UIColor { UIColor(hex: 0x51282D) }\n    static var Color_Red_A22E3B: UIColor { UIColor(hex: 0xA22E3B) }\n    static var Color_Red_FDEFEF: UIColor { UIColor(hex: 0xFDEFEF) }\n    static var Color_Red_392024: UIColor { UIColor(hex: 0x392024) }\n    static var Color_Red_FFDCDD: UIColor { UIColor(hex: 0xFFDCDD) }\n    static var Color_Red_351F23: UIColor { UIColor(hex: 0x351F23) }\n    static var Color_Red_FE3A1C: UIColor { UIColor(hex: 0xFE3A1C) }\n    static var Color_Red_FF0000: UIColor { UIColor(hex: 0xFF0000) }\n    static var Color_Red_3C272C: UIColor { UIColor(hex: 0x3C272C) }\n    static var Color_Red_E5474C: UIColor { UIColor(hex: 0xE5474C) }\n    static var Color_Red_F75B48: UIColor { UIColor(hex: 0xF75B48) }\n    \n    // 灰\n    static var Color_Gray_919191: UIColor { UIColor(hex: 0x919191) }\n    static var Color_Gray_323A42: UIColor { UIColor(hex: 0x323A42) }\n    static var Color_Gray_3E4951: UIColor { UIColor(hex: 0x3E4951) }\n    static var Color_Gray_384955: UIColor { UIColor(hex: 0x384955) }\n    static var Color_Gray_272D34: UIColor { UIColor(hex: 0x272D34) }\n    static var Color_Gray_5A636D: UIColor { UIColor(hex: 0x5A636D) }\n    static var Color_Gray_1E2328: UIColor { UIColor(hex: 0x1E2328) }\n    static var Color_Gray_7E8B99: UIColor { UIColor(hex: 0x7E8B99) }\n    static var Color_Gray_7B7C7D: UIColor { UIColor(hex: 0x7B7C7D) }\n    static var Color_Gray_E5E5E5: UIColor { UIColor(hex: 0xE5E5E5) }\n    static var Color_Gray_C0C0C0: UIColor { UIColor(hex: 0xC0C0C0) }\n    static var Color_Gray_CCCCCC: UIColor { UIColor(hex: 0xCCCCCC) }\n    static var Color_Gray_B4B4B4: UIColor { UIColor(hex: 0xB4B4B4) }\n    static var Color_Gray_B2B2B2: UIColor { UIColor(hex: 0xB2B2B2) }\n    static var Color_Gray_BEBEBE: UIColor { UIColor(hex: 0xBEBEBE) }\n    static var Color_Gray_1A1F24: UIColor { UIColor(hex: 0x1A1F24) }\n    static var Color_Gray_F5F5F5: UIColor { UIColor(hex: 0xF5F5F5) }\n    static var Color_Gray_F7F7F7: UIColor { UIColor(hex: 0xF7F7F7) }\n    static var Color_Gray_F8F8F8: UIColor { UIColor(hex: 0xF8F8F8) }\n    static var Color_Gray_DBDBDB: UIColor { UIColor(hex: 0xDBDBDB) }\n    static var Color_Gray_EAEAEA: UIColor { UIColor(hex: 0xEAEAEA) }\n    static var Color_Gray_F0BD5C: UIColor { UIColor(hex: 0xF0BD5C) }\n    static var Color_Gray_F0F0F0: UIColor { UIColor(hex: 0xF0F0F0) }\n    static var Color_Gray_DEDEDE: UIColor { UIColor(hex: 0xDEDEDE) }\n    static var Color_Gray_F6F7FA: UIColor { UIColor(hex: 0xF6F7FA) }\n    static var Color_Gray_EEEEEE: UIColor { UIColor(hex: 0xEEEEEE) }\n    static var Color_Gray_EDEDED: UIColor { UIColor(hex: 0xEDEDED) }\n    static var Color_Gray_77808A: UIColor { UIColor(hex: 0x77808A) }\n    static var Color_Gray_F6F6F6: UIColor { UIColor(hex: 0xF6F6F6) }\n    static var Color_Gray_272E37: UIColor { UIColor(hex: 0x272E37) }\n    static var Color_Gray_F4F4F4: UIColor { UIColor(hex: 0xF4F4F4) }\n    static var Color_Gray_E9E9E9: UIColor { UIColor(hex: 0xE9E9E9) }\n    static var Color_Gray_364450: UIColor { UIColor(hex: 0x364450) }\n    static var Color_Gray_E2E2E2: UIColor { UIColor(hex: 0xE2E2E2) }\n    static var Color_Gray_F5FCFC: UIColor { UIColor(hex: 0xF5FCFC) }\n    static var Color_Gray_EBF5F5: UIColor { UIColor(hex: 0xEBF5F5) }\n    static var Color_Gray_9BA1A4: UIColor { UIColor(hex: 0x9BA1A4) }\n    static var Color_Gray_666666: UIColor { UIColor(hex: 0x666666) }\n    static var Color_Gray_6D777C: UIColor { UIColor(hex: 0x6D777C) }\n    static var Color_Gray_999999: UIColor { UIColor(hex: 0x999999) }\n    static var Color_Gray_959B9E: UIColor { UIColor(hex: 0x959B9E) }\n    static var Color_Gray_C6C6C6: UIColor { UIColor(hex: 0xC6C6C6) }\n    static var Color_Gray_484D50: UIColor { UIColor(hex: 0x484D50) }\n    static var Color_Gray_97A2B0: UIColor { UIColor(hex: 0x97A2B0) }\n    static var Color_Gray_3D4950: UIColor { UIColor(hex: 0x3D4950) }\n    static var Color_Gray_CAD1D8: UIColor { UIColor(hex: 0xCAD1D8) }\n    static var Color_Gray_9AA5B5: UIColor { UIColor(hex: 0x9AA5B5) }\n    static var Color_Gray_D2D2D2: UIColor { UIColor(hex: 0xD2D2D2) }\n    static var Color_Gray_D8D8D8: UIColor { UIColor(hex: 0xD8D8D8) }\n    static var Color_Gray_696969: UIColor { UIColor(hex: 0x696969)  }\n    \n    // 橙\n    static var Color_Orange_FF793A: UIColor { UIColor(hex: 0xFF793A) }\n    static var Color_Orange_FFA946: UIColor { UIColor(hex: 0xFFA946) }\n    static var Color_Orange_FD5900: UIColor { UIColor(hex: 0xFD5900) }\n    static var Color_Orange_CFA972: UIColor { UIColor(hex: 0xCFA972) }\n    static var Color_Orange_F59B23: UIColor { UIColor(hex: 0xF59B23) }\n    static var Color_Orange_FF8F61: UIColor { UIColor(hex: 0xFF8F61) }\n    static var Color_Orange_FE8E1C: UIColor { UIColor(hex: 0xFE8E1C) }\n\n    // 金\n    static var Color_Gold_CFA972: UIColor { UIColor(hex: 0xCFA972) }\n    static var Color_Gold_F7F0E7: UIColor { UIColor(hex: 0xF7F0E7) }\n    static var Color_Gold_7D5923: UIColor { UIColor(hex: 0x7D5923) }\n    static var Color_Gold_DBBA86: UIColor { UIColor(hex: 0xDBBA86) }\n    static var Color_Gold_D4AB91: UIColor { UIColor(hex: 0xD4AB91) }\n    static var Color_Gold_ECD5C4: UIColor { UIColor(hex: 0xECD5C4) }\n    static var Color_Gold_CA9F84: UIColor { UIColor(hex: 0xCA9F84) }\n\n\n    // 黄\n    static var Color_Yellow_FFCC00: UIColor { UIColor(hex: 0xFFCC00) }\n    static var Color_Yellow_FFE5A7: UIColor { UIColor(hex: 0xFFE5A7) }\n    static var Color_Yellow_FFBF27: UIColor { UIColor(hex: 0xFFBF27) }\n\n    // 蓝\n    static var Color_Blue_6CD0D8: UIColor { UIColor(hex: 0x6CD0D8) }\n    static var Color_Blue_186DD5: UIColor { UIColor(hex: 0x186DD5) }\n    static var Color_Blue_1890FF: UIColor { UIColor(hex: 0x1890FF) }\n    static var Color_Blue_0000FF: UIColor { UIColor(hex: 0x0000FF) }\n    static var Color_Blue_375793: UIColor { UIColor(hex: 375793) }\n\n\n    // 粉\n    static var Color_Pink_F86882: UIColor { UIColor(hex: 0xF86882) }\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat/FY-IMChat.entitlements",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>com.apple.security.application-groups</key>\n\t<array>\n\t\t<string>group.com.jetchat.2022.JetChatWidget</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/FY-IMChat/FYObjcBridge.h",
    "content": "//\n//  FYObjcBridge.h\n//  FY-JetChat\n//\n//  Created by iOS.Jet on 2019/3/1.\n//  Copyright © 2019 Jett. All rights reserved.\n//\n\n#ifndef FYObjcBridge_h\n#define FYObjcBridge_h\n\n// MARK: - Objc\n#import <TZImagePickerController.h> ///<图片选择 ///<占位视图\n#import <MJRefresh/MJRefresh.h>\n#import \"UINavigationController+Extensions.h\" //<导航栏返回处理\n#import <UIView_FDCollapsibleConstraints/UIView+FDCollapsibleConstraints.h>///<xib隐藏\n#import \"UINavigationController+FDFullscreenPopGesture.h\" ///< 导航栏手势处理\n#import <UITableView+FDTemplateLayoutCell.h> ///< cell高度动态计算\n#import <IGListKit.h>  /// 朋友圈布局\n#import <IGListDiffKit.h>\n#import \"WeakProxy.h\"\n\n#endif /* FYObjcBridge_h */\n"
  },
  {
    "path": "JetChat/FY-IMChat/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleDisplayName</key>\n\t<string>JetChat</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>NSAppTransportSecurity</key>\n\t<dict>\n\t\t<key>NSAllowsArbitraryLoads</key>\n\t\t<true/>\n\t</dict>\n\t<key>NSCameraUsageDescription</key>\n\t<string>需要扫描二维码或拍照,是否允许打开相机?</string>\n\t<key>NSFaceIDUsageDescription</key>\n\t<string>App需要您的同意,才能使用Face ID</string>\n\t<key>NSMicrophoneUsageDescription</key>\n\t<string>App需要您的同意,才能访问麦克风</string>\n\t<key>NSPhotoLibraryAddUsageDescription</key>\n\t<string>App需要您的同意,才能访问相册保存图片</string>\n\t<key>NSPhotoLibraryUsageDescription</key>\n\t<string>App需要您的同意,才能访问相册保存图片</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UIStatusBarStyle</key>\n\t<string>UIStatusBarStyleLightContent</string>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UIViewControllerBasedStatusBarAppearance</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/FY-IMChat.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t271C02BE23929B3A0041617F /* ChatMoreMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026123929B3A0041617F /* ChatMoreMenuView.swift */; };\n\t\t271C02BF23929B3A0041617F /* ChatEmojiListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026223929B3A0041617F /* ChatEmojiListView.swift */; };\n\t\t271C02C023929B3A0041617F /* ChatKeyboard+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026323929B3A0041617F /* ChatKeyboard+Extensions.swift */; };\n\t\t271C02C123929B3A0041617F /* ChatMoreMenuCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026523929B3A0041617F /* ChatMoreMenuCell.swift */; };\n\t\t271C02C223929B3A0041617F /* ChatKeyboardFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026623929B3A0041617F /* ChatKeyboardFlowLayout.swift */; };\n\t\t271C02C323929B3A0041617F /* ChatAppleEmojiCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026723929B3A0041617F /* ChatAppleEmojiCell.swift */; };\n\t\t271C02C423929B3A0041617F /* ChatKeyboardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026823929B3A0041617F /* ChatKeyboardView.swift */; };\n\t\t271C02C523929B3A0041617F /* ChatEmoticon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026A23929B3A0041617F /* ChatEmoticon.swift */; };\n\t\t271C02C623929B3A0041617F /* ChatMoreMnueConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026B23929B3A0041617F /* ChatMoreMnueConfig.swift */; };\n\t\t271C02C723929B3A0041617F /* ChatGrowingTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C026C23929B3A0041617F /* ChatGrowingTextView.swift */; };\n\t\t271C02C823929B3A0041617F /* ic_emotion_delete@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C026F23929B3A0041617F /* ic_emotion_delete@3x.png */; };\n\t\t271C02C923929B3A0041617F /* ic_emotion_delete@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027023929B3A0041617F /* ic_emotion_delete@2x.png */; };\n\t\t271C02CA23929B3A0041617F /* Emoticons.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 271C027123929B3A0041617F /* Emoticons.bundle */; };\n\t\t271C02CB23929B3A0041617F /* ic_more_favorite@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027323929B3A0041617F /* ic_more_favorite@2x.png */; };\n\t\t271C02CC23929B3A0041617F /* ic_more_location@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027423929B3A0041617F /* ic_more_location@3x.png */; };\n\t\t271C02CD23929B3A0041617F /* ic_more_location@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027523929B3A0041617F /* ic_more_location@2x.png */; };\n\t\t271C02CE23929B3A0041617F /* ic_more_favorite@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027623929B3A0041617F /* ic_more_favorite@3x.png */; };\n\t\t271C02CF23929B3A0041617F /* ic_more_wallet@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027723929B3A0041617F /* ic_more_wallet@2x.png */; };\n\t\t271C02D023929B3A0041617F /* ic_more_video@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027823929B3A0041617F /* ic_more_video@2x.png */; };\n\t\t271C02D123929B3A0041617F /* ic_more_video@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027923929B3A0041617F /* ic_more_video@3x.png */; };\n\t\t271C02D223929B3A0041617F /* ic_more_wallet@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027A23929B3A0041617F /* ic_more_wallet@3x.png */; };\n\t\t271C02D323929B3A0041617F /* ic_more_camera@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027B23929B3A0041617F /* ic_more_camera@2x.png */; };\n\t\t271C02D423929B3A0041617F /* ic_more_album@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027C23929B3A0041617F /* ic_more_album@2x.png */; };\n\t\t271C02D523929B3A0041617F /* ic_more_sight@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027D23929B3A0041617F /* ic_more_sight@3x.png */; };\n\t\t271C02D623929B3A0041617F /* ic_more_album@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027E23929B3A0041617F /* ic_more_album@3x.png */; };\n\t\t271C02D723929B3A0041617F /* ic_more_sight@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C027F23929B3A0041617F /* ic_more_sight@2x.png */; };\n\t\t271C02D823929B3A0041617F /* ic_more_camera@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028023929B3A0041617F /* ic_more_camera@3x.png */; };\n\t\t271C02D923929B3A0041617F /* ic_more_friendcard@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028123929B3A0041617F /* ic_more_friendcard@2x.png */; };\n\t\t271C02DA23929B3A0041617F /* ic_more_pay@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028223929B3A0041617F /* ic_more_pay@3x.png */; };\n\t\t271C02DB23929B3A0041617F /* ic_more_voice@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028323929B3A0041617F /* ic_more_voice@3x.png */; };\n\t\t271C02DC23929B3A0041617F /* ic_more_voice@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028423929B3A0041617F /* ic_more_voice@2x.png */; };\n\t\t271C02DD23929B3A0041617F /* ic_more_friendcard@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028523929B3A0041617F /* ic_more_friendcard@3x.png */; };\n\t\t271C02DE23929B3A0041617F /* ic_more_pay@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028623929B3A0041617F /* ic_more_pay@2x.png */; };\n\t\t271C02DF23929B3A0041617F /* ToolViewKeyboardHL@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028823929B3A0041617F /* ToolViewKeyboardHL@3x.png */; };\n\t\t271C02E023929B3A0041617F /* ToolViewEmotion@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028923929B3A0041617F /* ToolViewEmotion@3x.png */; };\n\t\t271C02E123929B3A0041617F /* ToolViewEmotion@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028A23929B3A0041617F /* ToolViewEmotion@2x.png */; };\n\t\t271C02E223929B3A0041617F /* ToolViewKeyboardHL@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028B23929B3A0041617F /* ToolViewKeyboardHL@2x.png */; };\n\t\t271C02E323929B3A0041617F /* ToolViewInputVoice@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028C23929B3A0041617F /* ToolViewInputVoice@3x.png */; };\n\t\t271C02E423929B3A0041617F /* ToolViewKeyboard@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028D23929B3A0041617F /* ToolViewKeyboard@3x.png */; };\n\t\t271C02E523929B3A0041617F /* ToolViewKeyboard@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028E23929B3A0041617F /* ToolViewKeyboard@2x.png */; };\n\t\t271C02E623929B3A0041617F /* ToolViewInputVoice@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C028F23929B3A0041617F /* ToolViewInputVoice@2x.png */; };\n\t\t271C02E723929B3A0041617F /* ToolViewEmotionHL@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029023929B3A0041617F /* ToolViewEmotionHL@3x.png */; };\n\t\t271C02E823929B3A0041617F /* ToolViewInputVoiceHL@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029123929B3A0041617F /* ToolViewInputVoiceHL@2x.png */; };\n\t\t271C02E923929B3A0041617F /* ToolViewInputVoiceHL@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029223929B3A0041617F /* ToolViewInputVoiceHL@3x.png */; };\n\t\t271C02EA23929B3A0041617F /* ToolViewEmotionHL@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029323929B3A0041617F /* ToolViewEmotionHL@2x.png */; };\n\t\t271C02EB23929B3A0041617F /* TypeSelectorBtnHL_Black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029423929B3A0041617F /* TypeSelectorBtnHL_Black@2x.png */; };\n\t\t271C02EC23929B3A0041617F /* TypeSelectorBtn_Black@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029523929B3A0041617F /* TypeSelectorBtn_Black@3x.png */; };\n\t\t271C02ED23929B3A0041617F /* TypeSelectorBtn_Black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029623929B3A0041617F /* TypeSelectorBtn_Black@2x.png */; };\n\t\t271C02EE23929B3A0041617F /* TypeSelectorBtnHL_Black@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029723929B3A0041617F /* TypeSelectorBtnHL_Black@3x.png */; };\n\t\t271C02EF23929B3A0041617F /* icon_emoji_expression@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029923929B3A0041617F /* icon_emoji_expression@2x.png */; };\n\t\t271C02F023929B3A0041617F /* Expression.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 271C029A23929B3A0041617F /* Expression.bundle */; };\n\t\t271C02F123929B3A0041617F /* icon_emoji_expression@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 271C029B23929B3A0041617F /* icon_emoji_expression@3x.png */; };\n\t\t271C02F223929B3A0041617F /* Expression.plist in Resources */ = {isa = PBXBuildFile; fileRef = 271C029C23929B3A0041617F /* Expression.plist */; };\n\t\t271C02F323929B3A0041617F /* ChatFindEmotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C029E23929B3A0041617F /* ChatFindEmotion.swift */; };\n\t\t271C02F423929B3A0041617F /* ChatEmotionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C029F23929B3A0041617F /* ChatEmotionHelper.swift */; };\n\t\t271C02F523929B3A0041617F /* ChatEmotionAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C02A023929B3A0041617F /* ChatEmotionAttachment.swift */; };\n\t\t271C02F623929B3A0041617F /* WeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 271C02A223929B3A0041617F /* WeakProxy.m */; };\n\t\t271C02F723929B3A0041617F /* FPSLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C02A323929B3A0041617F /* FPSLabel.swift */; };\n\t\t271C02FB23929B3A0041617F /* LanguageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C02AB23929B3A0041617F /* LanguageManager.swift */; };\n\t\t271C02FD23929B3A0041617F /* CountDownHandy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 271C02AD23929B3A0041617F /* CountDownHandy.swift */; };\n\t\t27433F9B238D70D4004D5E3D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EA7238D70D3004D5E3D /* AppDelegate.swift */; };\n\t\t27433F9C238D70D4004D5E3D /* AppDelegate+Wcdb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EA8238D70D3004D5E3D /* AppDelegate+Wcdb.swift */; };\n\t\t27433F9D238D70D4004D5E3D /* AppDelegate+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EA9238D70D3004D5E3D /* AppDelegate+Utils.swift */; };\n\t\t27433FA0238D70D4004D5E3D /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EAF238D70D3004D5E3D /* String+Extension.swift */; };\n\t\t27433FA1238D70D4004D5E3D /* String+Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EB0238D70D3004D5E3D /* String+Date.swift */; };\n\t\t27433FA2238D70D4004D5E3D /* UIColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EB2238D70D3004D5E3D /* UIColor+Extension.swift */; };\n\t\t27433FA3238D70D4004D5E3D /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EB4238D70D3004D5E3D /* UIView+Extensions.swift */; };\n\t\t27433FA4238D70D4004D5E3D /* UIViewController+Extend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EB5238D70D3004D5E3D /* UIViewController+Extend.swift */; };\n\t\t27433FA6238D70D4004D5E3D /* JFButton+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EB8238D70D3004D5E3D /* JFButton+Rx.swift */; };\n\t\t27433FA7238D70D4004D5E3D /* Observable+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EB9238D70D3004D5E3D /* Observable+Operators.swift */; };\n\t\t27433FA8238D70D4004D5E3D /* MJRefresh+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EBA238D70D3004D5E3D /* MJRefresh+Rx.swift */; };\n\t\t27433FA9238D70D4004D5E3D /* Array+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EBC238D70D3004D5E3D /* Array+Extension.swift */; };\n\t\t27433FAA238D70D4004D5E3D /* UIAlert+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EBE238D70D3004D5E3D /* UIAlert+Extension.swift */; };\n\t\t27433FAB238D70D4004D5E3D /* UILabel+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EBF238D70D3004D5E3D /* UILabel+Extension.swift */; };\n\t\t27433FAC238D70D4004D5E3D /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC0238D70D3004D5E3D /* UIButton+Extension.swift */; };\n\t\t27433FAD238D70D4004D5E3D /* UIImageView+Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC1238D70D3004D5E3D /* UIImageView+Kingfisher.swift */; };\n\t\t27433FAE238D70D4004D5E3D /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC2238D70D3004D5E3D /* UIImage+Extension.swift */; };\n\t\t27433FAF238D70D4004D5E3D /* UINavBarItem+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC3238D70D3004D5E3D /* UINavBarItem+Extension.swift */; };\n\t\t27433FB0238D70D4004D5E3D /* UIFont+PingFang.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC4238D70D3004D5E3D /* UIFont+PingFang.swift */; };\n\t\t27433FB1238D70D4004D5E3D /* UITableView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC5238D70D3004D5E3D /* UITableView+Extension.swift */; };\n\t\t27433FB2238D70D4004D5E3D /* ConstraintArray+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC7238D70D3004D5E3D /* ConstraintArray+Extensions.swift */; };\n\t\t27433FB3238D70D4004D5E3D /* ConstraintArrayDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433EC8238D70D3004D5E3D /* ConstraintArrayDSL.swift */; };\n\t\t27433FB5238D70D4004D5E3D /* Dictionary+Exted.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433ECC238D70D3004D5E3D /* Dictionary+Exted.swift */; };\n\t\t27434018238D70D5004D5E3D /* ErrorTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433F63238D70D4004D5E3D /* ErrorTracker.swift */; };\n\t\t2743401A238D70D5004D5E3D /* UINavigationController+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 27433F68238D70D4004D5E3D /* UINavigationController+Extensions.m */; };\n\t\t2743401B238D70D5004D5E3D /* NSObject+BinAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 27433F69238D70D4004D5E3D /* NSObject+BinAdd.m */; };\n\t\t2743401D238D70D5004D5E3D /* BaseViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433F6F238D70D4004D5E3D /* BaseViewModel.swift */; };\n\t\t2743401E238D70D5004D5E3D /* FYBaseTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433F70238D70D4004D5E3D /* FYBaseTabBarController.swift */; };\n\t\t27434022238D70D5004D5E3D /* FYBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433F75238D70D4004D5E3D /* FYBaseNavigationController.swift */; };\n\t\t27434024238D70D5004D5E3D /* FYBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433F78238D70D4004D5E3D /* FYBaseViewController.swift */; };\n\t\t27434029238D70D5004D5E3D /* AppCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433F7F238D70D4004D5E3D /* AppCommon.swift */; };\n\t\t27434035238D70D5004D5E3D /* MBConfiguredHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27433F98238D70D4004D5E3D /* MBConfiguredHUD.swift */; };\n\t\t27434036238D70D5004D5E3D /* HUDAssets.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 27433F99238D70D4004D5E3D /* HUDAssets.bundle */; };\n\t\t27B954E623AFAA5600B94667 /* localVideo0.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 27B954E523AFAA5600B94667 /* localVideo0.mp4 */; };\n\t\t2B166CEE22534DFB0018AF62 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B166CED22534DFB0018AF62 /* LaunchScreen.storyboard */; };\n\t\t2B9E10F6222F752700638202 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2B9E10F8222F752700638202 /* Localizable.strings */; };\n\t\t2BC1B0D9229134E600A5CB54 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2BC1B0D8229134E600A5CB54 /* Assets.xcassets */; };\n\t\t2E59E750222CFFCA005BC4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2E59E752222CFFCA005BC4B7 /* InfoPlist.strings */; };\n\t\t2ECBFDC822269BF400871913 /* FY_IMChatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2ECBFDC722269BF400871913 /* FY_IMChatTests.swift */; };\n\t\t2ECBFDD322269BF400871913 /* FY_IMChatUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2ECBFDD222269BF400871913 /* FY_IMChatUITests.swift */; };\n\t\t2EF014772230FC6D00681D4F /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EF014762230FC6D00681D4F /* WebKit.framework */; };\n\t\t4C15484D28362BDA00AD7400 /* WCDataBaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C15484B28362BD900AD7400 /* WCDataBaseManager.swift */; };\n\t\t4C15484E28362BDA00AD7400 /* WCDataBaseTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C15484C28362BDA00AD7400 /* WCDataBaseTable.swift */; };\n\t\t4C4A1A272818DABA00CDD3B1 /* BottomPopupUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A1E2818DABA00CDD3B1 /* BottomPopupUtils.swift */; };\n\t\t4C4A1A282818DABA00CDD3B1 /* BottomPopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A1F2818DABA00CDD3B1 /* BottomPopupViewController.swift */; };\n\t\t4C4A1A292818DABA00CDD3B1 /* BottomPopupDismissInteractionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A202818DABA00CDD3B1 /* BottomPopupDismissInteractionController.swift */; };\n\t\t4C4A1A2A2818DABA00CDD3B1 /* BottomPopupNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A212818DABA00CDD3B1 /* BottomPopupNavigationController.swift */; };\n\t\t4C4A1A2B2818DABA00CDD3B1 /* BottomPopupDismissAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A222818DABA00CDD3B1 /* BottomPopupDismissAnimator.swift */; };\n\t\t4C4A1A2C2818DABA00CDD3B1 /* BottomPopupPresentAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A232818DABA00CDD3B1 /* BottomPopupPresentAnimator.swift */; };\n\t\t4C4A1A2D2818DABA00CDD3B1 /* CSBottomPopupNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A242818DABA00CDD3B1 /* CSBottomPopupNavigationController.swift */; };\n\t\t4C4A1A2E2818DABA00CDD3B1 /* BottomPopupTransitionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A252818DABA00CDD3B1 /* BottomPopupTransitionHandler.swift */; };\n\t\t4C4A1A2F2818DABA00CDD3B1 /* BottomPopupPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A262818DABA00CDD3B1 /* BottomPopupPresentationController.swift */; };\n\t\t4C4A1A332818DB7200CDD3B1 /* FYActionSheetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A312818DB7200CDD3B1 /* FYActionSheetCell.swift */; };\n\t\t4C4A1A342818DB7200CDD3B1 /* FYActionSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4A1A322818DB7200CDD3B1 /* FYActionSheet.swift */; };\n\t\t4C509CB528267AE700CE66DF /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C509CB428267AE700CE66DF /* WidgetKit.framework */; };\n\t\t4C509CB728267AE700CE66DF /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C509CB628267AE700CE66DF /* SwiftUI.framework */; };\n\t\t4C509CBA28267AE700CE66DF /* JetChatWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C509CB928267AE700CE66DF /* JetChatWidget.swift */; };\n\t\t4C509CBD28267AEA00CE66DF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C509CBC28267AEA00CE66DF /* Assets.xcassets */; };\n\t\t4C509CBF28267AEA00CE66DF /* JetChatWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 4C509CBB28267AE700CE66DF /* JetChatWidget.intentdefinition */; };\n\t\t4C509CC028267AEA00CE66DF /* JetChatWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 4C509CBB28267AE700CE66DF /* JetChatWidget.intentdefinition */; };\n\t\t4C509CC328267AEA00CE66DF /* JetChatWidgetExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 4C509CB328267AE700CE66DF /* JetChatWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };\n\t\t4C509CCA2826817A00CE66DF /* FYUserDefaultManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C509CC92826817A00CE66DF /* FYUserDefaultManager.swift */; };\n\t\t4C5579622817C3C3006D8A09 /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5579612817C3C3006D8A09 /* ActivityIndicator.swift */; };\n\t\t4C5E7B192824FAB000C968D3 /* FYMomentsHeaderRefresh.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5E7B182824FAAF00C968D3 /* FYMomentsHeaderRefresh.swift */; };\n\t\t4C5FB429281A974C001F70E3 /* FYLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5FB427281A974C001F70E3 /* FYLabel.swift */; };\n\t\t4C5FB42A281A974C001F70E3 /* FYLabelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5FB428281A974C001F70E3 /* FYLabelType.swift */; };\n\t\t4C5FB42D281AA7DD001F70E3 /* FYFileSizeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5FB42C281AA7DD001F70E3 /* FYFileSizeManager.swift */; };\n\t\t4C75A40A2817C8FF00E9EF54 /* R.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4092817C8FF00E9EF54 /* R.generated.swift */; };\n\t\t4C75A40D2817CA3300E9EF54 /* FYCellDataConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A40C2817CA3300E9EF54 /* FYCellDataConfig.swift */; };\n\t\t4C75A4372817D0F400E9EF54 /* FYEditChatInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4112817D0F300E9EF54 /* FYEditChatInfoViewController.swift */; };\n\t\t4C75A4382817D0F400E9EF54 /* FYContactsInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4122817D0F300E9EF54 /* FYContactsInfoViewController.swift */; };\n\t\t4C75A4392817D0F400E9EF54 /* FYContactsListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4132817D0F300E9EF54 /* FYContactsListViewController.swift */; };\n\t\t4C75A43A2817D0F400E9EF54 /* FYContactsInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4152817D0F300E9EF54 /* FYContactsInfoView.swift */; };\n\t\t4C75A43B2817D0F400E9EF54 /* FYContactsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4162817D0F300E9EF54 /* FYContactsTableViewCell.swift */; };\n\t\t4C75A43C2817D0F400E9EF54 /* ScanQRCodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4182817D0F300E9EF54 /* ScanQRCodeViewController.swift */; };\n\t\t4C75A43D2817D0F400E9EF54 /* icon_qrc_border@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C75A41A2817D0F300E9EF54 /* icon_qrc_border@3x.png */; };\n\t\t4C75A43E2817D0F400E9EF54 /* icon_qrc_line@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C75A41B2817D0F300E9EF54 /* icon_qrc_line@3x.png */; };\n\t\t4C75A43F2817D0F400E9EF54 /* FYMessageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A41E2817D0F300E9EF54 /* FYMessageViewModel.swift */; };\n\t\t4C75A4402817D0F400E9EF54 /* FYChatBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4202817D0F300E9EF54 /* FYChatBaseViewController.swift */; };\n\t\t4C75A4412817D0F400E9EF54 /* FYMessageForwardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4212817D0F300E9EF54 /* FYMessageForwardViewController.swift */; };\n\t\t4C75A4422817D0F400E9EF54 /* FYChatRoomListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4222817D0F300E9EF54 /* FYChatRoomListViewController.swift */; };\n\t\t4C75A4432817D0F400E9EF54 /* FYMessageItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4242817D0F300E9EF54 /* FYMessageItem.swift */; };\n\t\t4C75A4442817D0F400E9EF54 /* FYMessageChatModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4252817D0F300E9EF54 /* FYMessageChatModel.swift */; };\n\t\t4C75A4452817D0F400E9EF54 /* FYMessageBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4262817D0F300E9EF54 /* FYMessageBaseModel.swift */; };\n\t\t4C75A4462817D0F400E9EF54 /* FYVideoMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4282817D0F300E9EF54 /* FYVideoMessageCell.swift */; };\n\t\t4C75A4472817D0F400E9EF54 /* FYImageMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4292817D0F300E9EF54 /* FYImageMessageCell.swift */; };\n\t\t4C75A4482817D0F400E9EF54 /* FYTextMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A42A2817D0F300E9EF54 /* FYTextMessageCell.swift */; };\n\t\t4C75A4492817D0F400E9EF54 /* FYMessageBaseCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A42B2817D0F300E9EF54 /* FYMessageBaseCell.swift */; };\n\t\t4C75A44A2817D0F400E9EF54 /* FYMineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A42E2817D0F300E9EF54 /* FYMineViewController.swift */; };\n\t\t4C75A44B2817D0F400E9EF54 /* FYSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A42F2817D0F300E9EF54 /* FYSettingViewController.swift */; };\n\t\t4C75A44C2817D0F400E9EF54 /* FYFastGridListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4312817D0F300E9EF54 /* FYFastGridListView.swift */; };\n\t\t4C75A44D2817D0F400E9EF54 /* FYSesstionListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4342817D0F400E9EF54 /* FYSesstionListViewController.swift */; };\n\t\t4C75A44E2817D0F400E9EF54 /* FYConversationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C75A4362817D0F400E9EF54 /* FYConversationCell.swift */; };\n\t\t4CBE2B28281B937900FDB081 /* FYNavPopuListMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBE2B25281B937900FDB081 /* FYNavPopuListMenu.swift */; };\n\t\t4CBE2B29281B937900FDB081 /* FYNavDropMenuCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBE2B27281B937900FDB081 /* FYNavDropMenuCell.swift */; };\n\t\t4CBE2B2C281BCDE500FDB081 /* Notification+Name.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBE2B2B281BCDE500FDB081 /* Notification+Name.swift */; };\n\t\t4CBE2B35281BCE9500FDB081 /* FYDBQueryHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBE2B30281BCE9500FDB081 /* FYDBQueryHelper.swift */; };\n\t\t4CBE2B36281BCE9500FDB081 /* FYMessageUserModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBE2B31281BCE9500FDB081 /* FYMessageUserModel.swift */; };\n\t\t4CF27C18281CEFDC00DBD7EC /* FYThemeCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF27C17281CEFDC00DBD7EC /* FYThemeCenter.swift */; };\n\t\t4CF27C1A281CF04B00DBD7EC /* FYDarkTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF27C19281CF04B00DBD7EC /* FYDarkTheme.swift */; };\n\t\t4CF27C1C281CF05D00DBD7EC /* FYLightTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF27C1B281CF05D00DBD7EC /* FYLightTheme.swift */; };\n\t\t4CF27C1E281CF82600DBD7EC /* FYThemeColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF27C1D281CF82600DBD7EC /* FYThemeColors.swift */; };\n\t\t4CF27C20281D4EE600DBD7EC /* FYThemeSelectionListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF27C1F281D4EE600DBD7EC /* FYThemeSelectionListVC.swift */; };\n\t\t4CF85630281A2FFA00F48D4D /* FYMomentsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8562F281A2FFA00F48D4D /* FYMomentsViewController.swift */; };\n\t\t4CF8568C281A34C200F48D4D /* FYMomentNavBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8568B281A34C200F48D4D /* FYMomentNavBar.swift */; };\n\t\t4CF8568E281A3B8400F48D4D /* FYBaseIGListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8568D281A3B8400F48D4D /* FYBaseIGListViewController.swift */; };\n\t\t4CF85690281A3E8100F48D4D /* FYMomentInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8568F281A3E8100F48D4D /* FYMomentInfo.swift */; };\n\t\t4CF85692281A3F0F00F48D4D /* FYMoUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF85691281A3F0F00F48D4D /* FYMoUserInfo.swift */; };\n\t\t4CF85694281A3F5300F48D4D /* FYCommentInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF85693281A3F5300F48D4D /* FYCommentInfo.swift */; };\n\t\t4CF856A0281A40D400F48D4D /* MomentBottomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF85696281A40D400F48D4D /* MomentBottomCell.swift */; };\n\t\t4CF856A1281A40D400F48D4D /* MomentHeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF85697281A40D400F48D4D /* MomentHeaderCell.swift */; };\n\t\t4CF856A2281A40D400F48D4D /* CommentInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF85698281A40D400F48D4D /* CommentInputView.swift */; };\n\t\t4CF856A3281A40D400F48D4D /* MomentLocationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF85699281A40D400F48D4D /* MomentLocationCell.swift */; };\n\t\t4CF856A4281A40D400F48D4D /* CommentContentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8569A281A40D400F48D4D /* CommentContentCell.swift */; };\n\t\t4CF856A5281A40D400F48D4D /* MomentCommentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8569B281A40D400F48D4D /* MomentCommentCell.swift */; };\n\t\t4CF856A6281A40D400F48D4D /* CommentThumbView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8569C281A40D400F48D4D /* CommentThumbView.swift */; };\n\t\t4CF856A7281A40D400F48D4D /* CommentContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8569D281A40D400F48D4D /* CommentContentView.swift */; };\n\t\t4CF856A8281A40D400F48D4D /* MomentTopCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8569E281A40D400F48D4D /* MomentTopCell.swift */; };\n\t\t4CF856A9281A40D400F48D4D /* MomentHeaderImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8569F281A40D400F48D4D /* MomentHeaderImageCell.swift */; };\n\t\t4CF856AC281A40F300F48D4D /* NineImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF856AA281A40F300F48D4D /* NineImageView.swift */; };\n\t\t4CF856AD281A40F300F48D4D /* OperateMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF856AB281A40F300F48D4D /* OperateMenuView.swift */; };\n\t\t4CF856B5281A433700F48D4D /* FYTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF856B4281A433700F48D4D /* FYTextView.swift */; };\n\t\t4CF856B8281A456700F48D4D /* FYMomentBindingSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF856B7281A456700F48D4D /* FYMomentBindingSection.swift */; };\n\t\t4CF856BF281A4D2800F48D4D /* moments1.json in Resources */ = {isa = PBXBuildFile; fileRef = 4CF856BD281A4D2800F48D4D /* moments1.json */; };\n\t\t4CF856C0281A4D2800F48D4D /* moments2.json in Resources */ = {isa = PBXBuildFile; fileRef = 4CF856BE281A4D2800F48D4D /* moments2.json */; };\n\t\tB8766C51931F201D9A764FC9 /* Pods_FY_IMChat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E374D4E527160347F32F8B70 /* Pods_FY_IMChat.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t2ECBFDC422269BF400871913 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 2ECBFDA722269BF300871913 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 2ECBFDAE22269BF300871913;\n\t\t\tremoteInfo = \"FY-IMChat\";\n\t\t};\n\t\t2ECBFDCF22269BF400871913 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 2ECBFDA722269BF300871913 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 2ECBFDAE22269BF300871913;\n\t\t\tremoteInfo = \"FY-IMChat\";\n\t\t};\n\t\t4C509CC128267AEA00CE66DF /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 2ECBFDA722269BF300871913 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4C509CB228267AE700CE66DF;\n\t\t\tremoteInfo = JetChatWidgetExtension;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t4C509CC428267AEA00CE66DF /* Embed App Extensions */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 13;\n\t\t\tfiles = (\n\t\t\t\t4C509CC328267AEA00CE66DF /* JetChatWidgetExtension.appex in Embed App Extensions */,\n\t\t\t);\n\t\t\tname = \"Embed App Extensions\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t271C026123929B3A0041617F /* ChatMoreMenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMoreMenuView.swift; sourceTree = \"<group>\"; };\n\t\t271C026223929B3A0041617F /* ChatEmojiListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatEmojiListView.swift; sourceTree = \"<group>\"; };\n\t\t271C026323929B3A0041617F /* ChatKeyboard+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"ChatKeyboard+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t271C026523929B3A0041617F /* ChatMoreMenuCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMoreMenuCell.swift; sourceTree = \"<group>\"; };\n\t\t271C026623929B3A0041617F /* ChatKeyboardFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatKeyboardFlowLayout.swift; sourceTree = \"<group>\"; };\n\t\t271C026723929B3A0041617F /* ChatAppleEmojiCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatAppleEmojiCell.swift; sourceTree = \"<group>\"; };\n\t\t271C026823929B3A0041617F /* ChatKeyboardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatKeyboardView.swift; sourceTree = \"<group>\"; };\n\t\t271C026A23929B3A0041617F /* ChatEmoticon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatEmoticon.swift; sourceTree = \"<group>\"; };\n\t\t271C026B23929B3A0041617F /* ChatMoreMnueConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMoreMnueConfig.swift; sourceTree = \"<group>\"; };\n\t\t271C026C23929B3A0041617F /* ChatGrowingTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatGrowingTextView.swift; sourceTree = \"<group>\"; };\n\t\t271C026F23929B3A0041617F /* ic_emotion_delete@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_emotion_delete@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027023929B3A0041617F /* ic_emotion_delete@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_emotion_delete@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027123929B3A0041617F /* Emoticons.bundle */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.plug-in\"; path = Emoticons.bundle; sourceTree = \"<group>\"; };\n\t\t271C027323929B3A0041617F /* ic_more_favorite@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_favorite@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027423929B3A0041617F /* ic_more_location@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_location@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027523929B3A0041617F /* ic_more_location@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_location@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027623929B3A0041617F /* ic_more_favorite@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_favorite@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027723929B3A0041617F /* ic_more_wallet@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_wallet@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027823929B3A0041617F /* ic_more_video@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_video@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027923929B3A0041617F /* ic_more_video@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_video@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027A23929B3A0041617F /* ic_more_wallet@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_wallet@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027B23929B3A0041617F /* ic_more_camera@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_camera@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027C23929B3A0041617F /* ic_more_album@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_album@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027D23929B3A0041617F /* ic_more_sight@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_sight@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027E23929B3A0041617F /* ic_more_album@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_album@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C027F23929B3A0041617F /* ic_more_sight@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_sight@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028023929B3A0041617F /* ic_more_camera@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_camera@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028123929B3A0041617F /* ic_more_friendcard@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_friendcard@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028223929B3A0041617F /* ic_more_pay@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_pay@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028323929B3A0041617F /* ic_more_voice@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_voice@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028423929B3A0041617F /* ic_more_voice@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_voice@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028523929B3A0041617F /* ic_more_friendcard@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_friendcard@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028623929B3A0041617F /* ic_more_pay@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ic_more_pay@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028823929B3A0041617F /* ToolViewKeyboardHL@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewKeyboardHL@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028923929B3A0041617F /* ToolViewEmotion@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewEmotion@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028A23929B3A0041617F /* ToolViewEmotion@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewEmotion@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028B23929B3A0041617F /* ToolViewKeyboardHL@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewKeyboardHL@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028C23929B3A0041617F /* ToolViewInputVoice@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewInputVoice@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028D23929B3A0041617F /* ToolViewKeyboard@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewKeyboard@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028E23929B3A0041617F /* ToolViewKeyboard@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewKeyboard@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C028F23929B3A0041617F /* ToolViewInputVoice@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewInputVoice@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029023929B3A0041617F /* ToolViewEmotionHL@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewEmotionHL@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029123929B3A0041617F /* ToolViewInputVoiceHL@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewInputVoiceHL@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029223929B3A0041617F /* ToolViewInputVoiceHL@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewInputVoiceHL@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029323929B3A0041617F /* ToolViewEmotionHL@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"ToolViewEmotionHL@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029423929B3A0041617F /* TypeSelectorBtnHL_Black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"TypeSelectorBtnHL_Black@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029523929B3A0041617F /* TypeSelectorBtn_Black@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"TypeSelectorBtn_Black@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029623929B3A0041617F /* TypeSelectorBtn_Black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"TypeSelectorBtn_Black@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029723929B3A0041617F /* TypeSelectorBtnHL_Black@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"TypeSelectorBtnHL_Black@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029923929B3A0041617F /* icon_emoji_expression@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"icon_emoji_expression@2x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029A23929B3A0041617F /* Expression.bundle */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.plug-in\"; path = Expression.bundle; sourceTree = \"<group>\"; };\n\t\t271C029B23929B3A0041617F /* icon_emoji_expression@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"icon_emoji_expression@3x.png\"; sourceTree = \"<group>\"; };\n\t\t271C029C23929B3A0041617F /* Expression.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expression.plist; sourceTree = \"<group>\"; };\n\t\t271C029E23929B3A0041617F /* ChatFindEmotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatFindEmotion.swift; sourceTree = \"<group>\"; };\n\t\t271C029F23929B3A0041617F /* ChatEmotionHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatEmotionHelper.swift; sourceTree = \"<group>\"; };\n\t\t271C02A023929B3A0041617F /* ChatEmotionAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatEmotionAttachment.swift; sourceTree = \"<group>\"; };\n\t\t271C02A223929B3A0041617F /* WeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WeakProxy.m; sourceTree = \"<group>\"; };\n\t\t271C02A323929B3A0041617F /* FPSLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FPSLabel.swift; sourceTree = \"<group>\"; };\n\t\t271C02A423929B3A0041617F /* WeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakProxy.h; sourceTree = \"<group>\"; };\n\t\t271C02AB23929B3A0041617F /* LanguageManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LanguageManager.swift; sourceTree = \"<group>\"; };\n\t\t271C02AD23929B3A0041617F /* CountDownHandy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CountDownHandy.swift; sourceTree = \"<group>\"; };\n\t\t27433EA7238D70D3004D5E3D /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\t27433EA8238D70D3004D5E3D /* AppDelegate+Wcdb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"AppDelegate+Wcdb.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EA9238D70D3004D5E3D /* AppDelegate+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"AppDelegate+Utils.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EAF238D70D3004D5E3D /* String+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"String+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EB0238D70D3004D5E3D /* String+Date.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"String+Date.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EB2238D70D3004D5E3D /* UIColor+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIColor+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EB4238D70D3004D5E3D /* UIView+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIView+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EB5238D70D3004D5E3D /* UIViewController+Extend.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIViewController+Extend.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EB8238D70D3004D5E3D /* JFButton+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"JFButton+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EB9238D70D3004D5E3D /* Observable+Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Observable+Operators.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EBA238D70D3004D5E3D /* MJRefresh+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"MJRefresh+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EBC238D70D3004D5E3D /* Array+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Array+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EBE238D70D3004D5E3D /* UIAlert+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIAlert+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EBF238D70D3004D5E3D /* UILabel+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UILabel+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC0238D70D3004D5E3D /* UIButton+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIButton+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC1238D70D3004D5E3D /* UIImageView+Kingfisher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIImageView+Kingfisher.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC2238D70D3004D5E3D /* UIImage+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIImage+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC3238D70D3004D5E3D /* UINavBarItem+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UINavBarItem+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC4238D70D3004D5E3D /* UIFont+PingFang.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UIFont+PingFang.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC5238D70D3004D5E3D /* UITableView+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"UITableView+Extension.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC7238D70D3004D5E3D /* ConstraintArray+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"ConstraintArray+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t27433EC8238D70D3004D5E3D /* ConstraintArrayDSL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstraintArrayDSL.swift; sourceTree = \"<group>\"; };\n\t\t27433ECC238D70D3004D5E3D /* Dictionary+Exted.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Dictionary+Exted.swift\"; sourceTree = \"<group>\"; };\n\t\t27433F63238D70D4004D5E3D /* ErrorTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorTracker.swift; sourceTree = \"<group>\"; };\n\t\t27433F67238D70D4004D5E3D /* NSObject+BinAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"NSObject+BinAdd.h\"; sourceTree = \"<group>\"; };\n\t\t27433F68238D70D4004D5E3D /* UINavigationController+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = \"UINavigationController+Extensions.m\"; sourceTree = \"<group>\"; };\n\t\t27433F69238D70D4004D5E3D /* NSObject+BinAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = \"NSObject+BinAdd.m\"; sourceTree = \"<group>\"; };\n\t\t27433F6A238D70D4004D5E3D /* UINavigationController+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = \"UINavigationController+Extensions.h\"; sourceTree = \"<group>\"; };\n\t\t27433F6F238D70D4004D5E3D /* BaseViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseViewModel.swift; sourceTree = \"<group>\"; };\n\t\t27433F70238D70D4004D5E3D /* FYBaseTabBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYBaseTabBarController.swift; sourceTree = \"<group>\"; };\n\t\t27433F75238D70D4004D5E3D /* FYBaseNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYBaseNavigationController.swift; sourceTree = \"<group>\"; };\n\t\t27433F78238D70D4004D5E3D /* FYBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYBaseViewController.swift; sourceTree = \"<group>\"; };\n\t\t27433F7F238D70D4004D5E3D /* AppCommon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppCommon.swift; sourceTree = \"<group>\"; };\n\t\t27433F98238D70D4004D5E3D /* MBConfiguredHUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MBConfiguredHUD.swift; sourceTree = \"<group>\"; };\n\t\t27433F99238D70D4004D5E3D /* HUDAssets.bundle */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.plug-in\"; path = HUDAssets.bundle; sourceTree = \"<group>\"; };\n\t\t27B954E523AFAA5600B94667 /* localVideo0.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = localVideo0.mp4; sourceTree = \"<group>\"; };\n\t\t2B166CED22534DFB0018AF62 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = Classes/Resource/LaunchScreen.storyboard; sourceTree = \"<group>\"; };\n\t\t2B9E10F7222F752700638202 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = \"<group>\"; };\n\t\t2B9E10F9222F752800638202 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = \"zh-Hans\"; path = \"zh-Hans.lproj/Localizable.strings\"; sourceTree = \"<group>\"; };\n\t\t2BC1B0D8229134E600A5CB54 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t2E2C3B9E2228C9D300BF1C5D /* FYObjcBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FYObjcBridge.h; sourceTree = \"<group>\"; };\n\t\t2E59E751222CFFCA005BC4B7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = \"<group>\"; };\n\t\t2E59E753222CFFD7005BC4B7 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = \"zh-Hans\"; path = \"zh-Hans.lproj/InfoPlist.strings\"; sourceTree = \"<group>\"; };\n\t\t2ECBFDAF22269BF300871913 /* JetChat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JetChat.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t2ECBFDBE22269BF400871913 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t2ECBFDC322269BF400871913 /* FY-IMChatTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"FY-IMChatTests.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t2ECBFDC722269BF400871913 /* FY_IMChatTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FY_IMChatTests.swift; sourceTree = \"<group>\"; };\n\t\t2ECBFDC922269BF400871913 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t2ECBFDCE22269BF400871913 /* FY-IMChatUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"FY-IMChatUITests.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t2ECBFDD222269BF400871913 /* FY_IMChatUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FY_IMChatUITests.swift; sourceTree = \"<group>\"; };\n\t\t2ECBFDD422269BF400871913 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t2EF014762230FC6D00681D4F /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };\n\t\t2EF014782230FC7200681D4F /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };\n\t\t4C15484B28362BD900AD7400 /* WCDataBaseManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WCDataBaseManager.swift; path = \"FY-IMChat/Classes/Utilites/DataBase/WCDataBaseManager.swift\"; sourceTree = SOURCE_ROOT; };\n\t\t4C15484C28362BDA00AD7400 /* WCDataBaseTable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WCDataBaseTable.swift; path = \"FY-IMChat/Classes/Utilites/DataBase/WCDataBaseTable.swift\"; sourceTree = SOURCE_ROOT; };\n\t\t4C4A1A1E2818DABA00CDD3B1 /* BottomPopupUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupUtils.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A1F2818DABA00CDD3B1 /* BottomPopupViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A202818DABA00CDD3B1 /* BottomPopupDismissInteractionController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupDismissInteractionController.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A212818DABA00CDD3B1 /* BottomPopupNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupNavigationController.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A222818DABA00CDD3B1 /* BottomPopupDismissAnimator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupDismissAnimator.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A232818DABA00CDD3B1 /* BottomPopupPresentAnimator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupPresentAnimator.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A242818DABA00CDD3B1 /* CSBottomPopupNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSBottomPopupNavigationController.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A252818DABA00CDD3B1 /* BottomPopupTransitionHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupTransitionHandler.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A262818DABA00CDD3B1 /* BottomPopupPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BottomPopupPresentationController.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A312818DB7200CDD3B1 /* FYActionSheetCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYActionSheetCell.swift; sourceTree = \"<group>\"; };\n\t\t4C4A1A322818DB7200CDD3B1 /* FYActionSheet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYActionSheet.swift; sourceTree = \"<group>\"; };\n\t\t4C509CB328267AE700CE66DF /* JetChatWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = \"wrapper.app-extension\"; includeInIndex = 0; path = JetChatWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t4C509CB428267AE700CE66DF /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };\n\t\t4C509CB628267AE700CE66DF /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };\n\t\t4C509CB928267AE700CE66DF /* JetChatWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetChatWidget.swift; sourceTree = \"<group>\"; };\n\t\t4C509CBB28267AE700CE66DF /* JetChatWidget.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = JetChatWidget.intentdefinition; sourceTree = \"<group>\"; };\n\t\t4C509CBC28267AEA00CE66DF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t4C509CBE28267AEA00CE66DF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t4C509CC828267B1A00CE66DF /* JetChatWidgetExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = JetChatWidgetExtension.entitlements; sourceTree = \"<group>\"; };\n\t\t4C509CC92826817A00CE66DF /* FYUserDefaultManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYUserDefaultManager.swift; sourceTree = \"<group>\"; };\n\t\t4C509CCB28268BC600CE66DF /* FY-IMChat.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = \"FY-IMChat.entitlements\"; sourceTree = \"<group>\"; };\n\t\t4C5579612817C3C3006D8A09 /* ActivityIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = \"<group>\"; };\n\t\t4C5E7B182824FAAF00C968D3 /* FYMomentsHeaderRefresh.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMomentsHeaderRefresh.swift; sourceTree = \"<group>\"; };\n\t\t4C5FB427281A974C001F70E3 /* FYLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYLabel.swift; sourceTree = \"<group>\"; };\n\t\t4C5FB428281A974C001F70E3 /* FYLabelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYLabelType.swift; sourceTree = \"<group>\"; };\n\t\t4C5FB42C281AA7DD001F70E3 /* FYFileSizeManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYFileSizeManager.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4092817C8FF00E9EF54 /* R.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = R.generated.swift; sourceTree = \"<group>\"; };\n\t\t4C75A40C2817CA3300E9EF54 /* FYCellDataConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYCellDataConfig.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4112817D0F300E9EF54 /* FYEditChatInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYEditChatInfoViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4122817D0F300E9EF54 /* FYContactsInfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYContactsInfoViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4132817D0F300E9EF54 /* FYContactsListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYContactsListViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4152817D0F300E9EF54 /* FYContactsInfoView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYContactsInfoView.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4162817D0F300E9EF54 /* FYContactsTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYContactsTableViewCell.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4182817D0F300E9EF54 /* ScanQRCodeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScanQRCodeViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A41A2817D0F300E9EF54 /* icon_qrc_border@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"icon_qrc_border@3x.png\"; sourceTree = \"<group>\"; };\n\t\t4C75A41B2817D0F300E9EF54 /* icon_qrc_line@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = \"icon_qrc_line@3x.png\"; sourceTree = \"<group>\"; };\n\t\t4C75A41E2817D0F300E9EF54 /* FYMessageViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMessageViewModel.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4202817D0F300E9EF54 /* FYChatBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYChatBaseViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4212817D0F300E9EF54 /* FYMessageForwardViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMessageForwardViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4222817D0F300E9EF54 /* FYChatRoomListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYChatRoomListViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4242817D0F300E9EF54 /* FYMessageItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMessageItem.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4252817D0F300E9EF54 /* FYMessageChatModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMessageChatModel.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4262817D0F300E9EF54 /* FYMessageBaseModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMessageBaseModel.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4282817D0F300E9EF54 /* FYVideoMessageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYVideoMessageCell.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4292817D0F300E9EF54 /* FYImageMessageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYImageMessageCell.swift; sourceTree = \"<group>\"; };\n\t\t4C75A42A2817D0F300E9EF54 /* FYTextMessageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYTextMessageCell.swift; sourceTree = \"<group>\"; };\n\t\t4C75A42B2817D0F300E9EF54 /* FYMessageBaseCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMessageBaseCell.swift; sourceTree = \"<group>\"; };\n\t\t4C75A42E2817D0F300E9EF54 /* FYMineViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMineViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A42F2817D0F300E9EF54 /* FYSettingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYSettingViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4312817D0F300E9EF54 /* FYFastGridListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYFastGridListView.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4342817D0F400E9EF54 /* FYSesstionListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYSesstionListViewController.swift; sourceTree = \"<group>\"; };\n\t\t4C75A4362817D0F400E9EF54 /* FYConversationCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYConversationCell.swift; sourceTree = \"<group>\"; };\n\t\t4CBE2B25281B937900FDB081 /* FYNavPopuListMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYNavPopuListMenu.swift; sourceTree = \"<group>\"; };\n\t\t4CBE2B27281B937900FDB081 /* FYNavDropMenuCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYNavDropMenuCell.swift; sourceTree = \"<group>\"; };\n\t\t4CBE2B2B281BCDE500FDB081 /* Notification+Name.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = \"Notification+Name.swift\"; sourceTree = \"<group>\"; };\n\t\t4CBE2B30281BCE9500FDB081 /* FYDBQueryHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYDBQueryHelper.swift; sourceTree = \"<group>\"; };\n\t\t4CBE2B31281BCE9500FDB081 /* FYMessageUserModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYMessageUserModel.swift; sourceTree = \"<group>\"; };\n\t\t4CF27C17281CEFDC00DBD7EC /* FYThemeCenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYThemeCenter.swift; sourceTree = \"<group>\"; };\n\t\t4CF27C19281CF04B00DBD7EC /* FYDarkTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYDarkTheme.swift; sourceTree = \"<group>\"; };\n\t\t4CF27C1B281CF05D00DBD7EC /* FYLightTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYLightTheme.swift; sourceTree = \"<group>\"; };\n\t\t4CF27C1D281CF82600DBD7EC /* FYThemeColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYThemeColors.swift; sourceTree = \"<group>\"; };\n\t\t4CF27C1F281D4EE600DBD7EC /* FYThemeSelectionListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYThemeSelectionListVC.swift; sourceTree = \"<group>\"; };\n\t\t4CF8562F281A2FFA00F48D4D /* FYMomentsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYMomentsViewController.swift; sourceTree = \"<group>\"; };\n\t\t4CF8568B281A34C200F48D4D /* FYMomentNavBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYMomentNavBar.swift; sourceTree = \"<group>\"; };\n\t\t4CF8568D281A3B8400F48D4D /* FYBaseIGListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYBaseIGListViewController.swift; sourceTree = \"<group>\"; };\n\t\t4CF8568F281A3E8100F48D4D /* FYMomentInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYMomentInfo.swift; sourceTree = \"<group>\"; };\n\t\t4CF85691281A3F0F00F48D4D /* FYMoUserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYMoUserInfo.swift; sourceTree = \"<group>\"; };\n\t\t4CF85693281A3F5300F48D4D /* FYCommentInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYCommentInfo.swift; sourceTree = \"<group>\"; };\n\t\t4CF85696281A40D400F48D4D /* MomentBottomCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentBottomCell.swift; sourceTree = \"<group>\"; };\n\t\t4CF85697281A40D400F48D4D /* MomentHeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentHeaderCell.swift; sourceTree = \"<group>\"; };\n\t\t4CF85698281A40D400F48D4D /* CommentInputView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentInputView.swift; sourceTree = \"<group>\"; };\n\t\t4CF85699281A40D400F48D4D /* MomentLocationCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentLocationCell.swift; sourceTree = \"<group>\"; };\n\t\t4CF8569A281A40D400F48D4D /* CommentContentCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentContentCell.swift; sourceTree = \"<group>\"; };\n\t\t4CF8569B281A40D400F48D4D /* MomentCommentCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentCommentCell.swift; sourceTree = \"<group>\"; };\n\t\t4CF8569C281A40D400F48D4D /* CommentThumbView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentThumbView.swift; sourceTree = \"<group>\"; };\n\t\t4CF8569D281A40D400F48D4D /* CommentContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentContentView.swift; sourceTree = \"<group>\"; };\n\t\t4CF8569E281A40D400F48D4D /* MomentTopCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentTopCell.swift; sourceTree = \"<group>\"; };\n\t\t4CF8569F281A40D400F48D4D /* MomentHeaderImageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentHeaderImageCell.swift; sourceTree = \"<group>\"; };\n\t\t4CF856AA281A40F300F48D4D /* NineImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NineImageView.swift; sourceTree = \"<group>\"; };\n\t\t4CF856AB281A40F300F48D4D /* OperateMenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OperateMenuView.swift; sourceTree = \"<group>\"; };\n\t\t4CF856B4281A433700F48D4D /* FYTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FYTextView.swift; sourceTree = \"<group>\"; };\n\t\t4CF856B7281A456700F48D4D /* FYMomentBindingSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FYMomentBindingSection.swift; sourceTree = \"<group>\"; };\n\t\t4CF856BD281A4D2800F48D4D /* moments1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = moments1.json; sourceTree = \"<group>\"; };\n\t\t4CF856BE281A4D2800F48D4D /* moments2.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = moments2.json; sourceTree = \"<group>\"; };\n\t\t5858C5E76CAB64DDB07738CD /* Pods-FY-IMChat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-FY-IMChat.release.xcconfig\"; path = \"Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t98E659EF05275210EC83E03D /* Pods-FY-IMChat.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-FY-IMChat.debug.xcconfig\"; path = \"Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tE374D4E527160347F32F8B70 /* Pods_FY_IMChat.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FY_IMChat.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t2ECBFDAC22269BF300871913 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2EF014772230FC6D00681D4F /* WebKit.framework in Frameworks */,\n\t\t\t\tB8766C51931F201D9A764FC9 /* Pods_FY_IMChat.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t2ECBFDC022269BF400871913 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t2ECBFDCB22269BF400871913 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t4C509CB028267AE700CE66DF /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4C509CB728267AE700CE66DF /* SwiftUI.framework in Frameworks */,\n\t\t\t\t4C509CB528267AE700CE66DF /* WidgetKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t271C025623929B3A0041617F /* Utilites */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF27C16281CEF3B00DBD7EC /* Theme */,\n\t\t\t\t4CBE2B2D281BCE9500FDB081 /* DataBase */,\n\t\t\t\t4C5FB42B281AA7D0001F70E3 /* FileSizeManager */,\n\t\t\t\t271C026023929B3A0041617F /* KeyboardCore */,\n\t\t\t\t271C02A123929B3A0041617F /* FPSLabel */,\n\t\t\t\t271C02AA23929B3A0041617F /* Helpers */,\n\t\t\t);\n\t\t\tpath = Utilites;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C026023929B3A0041617F /* KeyboardCore */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C026123929B3A0041617F /* ChatMoreMenuView.swift */,\n\t\t\t\t271C026223929B3A0041617F /* ChatEmojiListView.swift */,\n\t\t\t\t271C026823929B3A0041617F /* ChatKeyboardView.swift */,\n\t\t\t\t271C026C23929B3A0041617F /* ChatGrowingTextView.swift */,\n\t\t\t\t271C026323929B3A0041617F /* ChatKeyboard+Extensions.swift */,\n\t\t\t\t271C026423929B3A0041617F /* Cell */,\n\t\t\t\t271C026923929B3A0041617F /* Model */,\n\t\t\t\t271C026D23929B3A0041617F /* Resource */,\n\t\t\t\t271C029D23929B3A0041617F /* Helper */,\n\t\t\t);\n\t\t\tpath = KeyboardCore;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C026423929B3A0041617F /* Cell */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C026523929B3A0041617F /* ChatMoreMenuCell.swift */,\n\t\t\t\t271C026623929B3A0041617F /* ChatKeyboardFlowLayout.swift */,\n\t\t\t\t271C026723929B3A0041617F /* ChatAppleEmojiCell.swift */,\n\t\t\t);\n\t\t\tpath = Cell;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C026923929B3A0041617F /* Model */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C026A23929B3A0041617F /* ChatEmoticon.swift */,\n\t\t\t\t271C026B23929B3A0041617F /* ChatMoreMnueConfig.swift */,\n\t\t\t);\n\t\t\tpath = Model;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C026D23929B3A0041617F /* Resource */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C026E23929B3A0041617F /* Emoji */,\n\t\t\t\t271C027223929B3A0041617F /* MoreMnues */,\n\t\t\t\t271C028723929B3A0041617F /* ChatToolbar */,\n\t\t\t\t271C029823929B3A0041617F /* Emotion */,\n\t\t\t);\n\t\t\tpath = Resource;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C026E23929B3A0041617F /* Emoji */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C026F23929B3A0041617F /* ic_emotion_delete@3x.png */,\n\t\t\t\t271C027023929B3A0041617F /* ic_emotion_delete@2x.png */,\n\t\t\t\t271C027123929B3A0041617F /* Emoticons.bundle */,\n\t\t\t);\n\t\t\tpath = Emoji;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C027223929B3A0041617F /* MoreMnues */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C027323929B3A0041617F /* ic_more_favorite@2x.png */,\n\t\t\t\t271C027423929B3A0041617F /* ic_more_location@3x.png */,\n\t\t\t\t271C027523929B3A0041617F /* ic_more_location@2x.png */,\n\t\t\t\t271C027623929B3A0041617F /* ic_more_favorite@3x.png */,\n\t\t\t\t271C027723929B3A0041617F /* ic_more_wallet@2x.png */,\n\t\t\t\t271C027823929B3A0041617F /* ic_more_video@2x.png */,\n\t\t\t\t271C027923929B3A0041617F /* ic_more_video@3x.png */,\n\t\t\t\t271C027A23929B3A0041617F /* ic_more_wallet@3x.png */,\n\t\t\t\t271C027B23929B3A0041617F /* ic_more_camera@2x.png */,\n\t\t\t\t271C027C23929B3A0041617F /* ic_more_album@2x.png */,\n\t\t\t\t271C027D23929B3A0041617F /* ic_more_sight@3x.png */,\n\t\t\t\t271C027E23929B3A0041617F /* ic_more_album@3x.png */,\n\t\t\t\t271C027F23929B3A0041617F /* ic_more_sight@2x.png */,\n\t\t\t\t271C028023929B3A0041617F /* ic_more_camera@3x.png */,\n\t\t\t\t271C028123929B3A0041617F /* ic_more_friendcard@2x.png */,\n\t\t\t\t271C028223929B3A0041617F /* ic_more_pay@3x.png */,\n\t\t\t\t271C028323929B3A0041617F /* ic_more_voice@3x.png */,\n\t\t\t\t271C028423929B3A0041617F /* ic_more_voice@2x.png */,\n\t\t\t\t271C028523929B3A0041617F /* ic_more_friendcard@3x.png */,\n\t\t\t\t271C028623929B3A0041617F /* ic_more_pay@2x.png */,\n\t\t\t);\n\t\t\tpath = MoreMnues;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C028723929B3A0041617F /* ChatToolbar */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C028823929B3A0041617F /* ToolViewKeyboardHL@3x.png */,\n\t\t\t\t271C028923929B3A0041617F /* ToolViewEmotion@3x.png */,\n\t\t\t\t271C028A23929B3A0041617F /* ToolViewEmotion@2x.png */,\n\t\t\t\t271C028B23929B3A0041617F /* ToolViewKeyboardHL@2x.png */,\n\t\t\t\t271C028C23929B3A0041617F /* ToolViewInputVoice@3x.png */,\n\t\t\t\t271C028D23929B3A0041617F /* ToolViewKeyboard@3x.png */,\n\t\t\t\t271C028E23929B3A0041617F /* ToolViewKeyboard@2x.png */,\n\t\t\t\t271C028F23929B3A0041617F /* ToolViewInputVoice@2x.png */,\n\t\t\t\t271C029023929B3A0041617F /* ToolViewEmotionHL@3x.png */,\n\t\t\t\t271C029123929B3A0041617F /* ToolViewInputVoiceHL@2x.png */,\n\t\t\t\t271C029223929B3A0041617F /* ToolViewInputVoiceHL@3x.png */,\n\t\t\t\t271C029323929B3A0041617F /* ToolViewEmotionHL@2x.png */,\n\t\t\t\t271C029423929B3A0041617F /* TypeSelectorBtnHL_Black@2x.png */,\n\t\t\t\t271C029523929B3A0041617F /* TypeSelectorBtn_Black@3x.png */,\n\t\t\t\t271C029623929B3A0041617F /* TypeSelectorBtn_Black@2x.png */,\n\t\t\t\t271C029723929B3A0041617F /* TypeSelectorBtnHL_Black@3x.png */,\n\t\t\t);\n\t\t\tpath = ChatToolbar;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C029823929B3A0041617F /* Emotion */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C029923929B3A0041617F /* icon_emoji_expression@2x.png */,\n\t\t\t\t271C029A23929B3A0041617F /* Expression.bundle */,\n\t\t\t\t271C029B23929B3A0041617F /* icon_emoji_expression@3x.png */,\n\t\t\t\t271C029C23929B3A0041617F /* Expression.plist */,\n\t\t\t);\n\t\t\tpath = Emotion;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C029D23929B3A0041617F /* Helper */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C029E23929B3A0041617F /* ChatFindEmotion.swift */,\n\t\t\t\t271C029F23929B3A0041617F /* ChatEmotionHelper.swift */,\n\t\t\t\t271C02A023929B3A0041617F /* ChatEmotionAttachment.swift */,\n\t\t\t);\n\t\t\tpath = Helper;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C02A123929B3A0041617F /* FPSLabel */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C02A323929B3A0041617F /* FPSLabel.swift */,\n\t\t\t\t271C02A423929B3A0041617F /* WeakProxy.h */,\n\t\t\t\t271C02A223929B3A0041617F /* WeakProxy.m */,\n\t\t\t);\n\t\t\tpath = FPSLabel;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t271C02AA23929B3A0041617F /* Helpers */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t271C02AB23929B3A0041617F /* LanguageManager.swift */,\n\t\t\t\t271C02AD23929B3A0041617F /* CountDownHandy.swift */,\n\t\t\t);\n\t\t\tpath = Helpers;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EA5238D70D3004D5E3D /* AppDelegate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EA7238D70D3004D5E3D /* AppDelegate.swift */,\n\t\t\t\t27433EA8238D70D3004D5E3D /* AppDelegate+Wcdb.swift */,\n\t\t\t\t27433EA9238D70D3004D5E3D /* AppDelegate+Utils.swift */,\n\t\t\t);\n\t\t\tpath = AppDelegate;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EAA238D70D3004D5E3D /* Extensions */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EAE238D70D3004D5E3D /* Strings */,\n\t\t\t\t27433EB1238D70D3004D5E3D /* UIColor */,\n\t\t\t\t27433EB3238D70D3004D5E3D /* UIView */,\n\t\t\t\t27433EB6238D70D3004D5E3D /* RxSwift */,\n\t\t\t\t27433EBB238D70D3004D5E3D /* Array */,\n\t\t\t\t27433EBD238D70D3004D5E3D /* UIKit */,\n\t\t\t\t4CBE2B2A281BCDE500FDB081 /* Notification */,\n\t\t\t\t27433EC6238D70D3004D5E3D /* SnapKit */,\n\t\t\t\t27433ECB238D70D3004D5E3D /* Dictionary */,\n\t\t\t);\n\t\t\tpath = Extensions;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EAE238D70D3004D5E3D /* Strings */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EB0238D70D3004D5E3D /* String+Date.swift */,\n\t\t\t\t27433EAF238D70D3004D5E3D /* String+Extension.swift */,\n\t\t\t);\n\t\t\tpath = Strings;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EB1238D70D3004D5E3D /* UIColor */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EB2238D70D3004D5E3D /* UIColor+Extension.swift */,\n\t\t\t);\n\t\t\tpath = UIColor;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EB3238D70D3004D5E3D /* UIView */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EB4238D70D3004D5E3D /* UIView+Extensions.swift */,\n\t\t\t\t27433EB5238D70D3004D5E3D /* UIViewController+Extend.swift */,\n\t\t\t);\n\t\t\tpath = UIView;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EB6238D70D3004D5E3D /* RxSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EB8238D70D3004D5E3D /* JFButton+Rx.swift */,\n\t\t\t\t27433EB9238D70D3004D5E3D /* Observable+Operators.swift */,\n\t\t\t\t27433EBA238D70D3004D5E3D /* MJRefresh+Rx.swift */,\n\t\t\t);\n\t\t\tpath = RxSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EBB238D70D3004D5E3D /* Array */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EBC238D70D3004D5E3D /* Array+Extension.swift */,\n\t\t\t);\n\t\t\tpath = Array;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EBD238D70D3004D5E3D /* UIKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EBE238D70D3004D5E3D /* UIAlert+Extension.swift */,\n\t\t\t\t27433EBF238D70D3004D5E3D /* UILabel+Extension.swift */,\n\t\t\t\t27433EC0238D70D3004D5E3D /* UIButton+Extension.swift */,\n\t\t\t\t27433EC1238D70D3004D5E3D /* UIImageView+Kingfisher.swift */,\n\t\t\t\t27433EC2238D70D3004D5E3D /* UIImage+Extension.swift */,\n\t\t\t\t27433EC3238D70D3004D5E3D /* UINavBarItem+Extension.swift */,\n\t\t\t\t27433EC4238D70D3004D5E3D /* UIFont+PingFang.swift */,\n\t\t\t\t27433EC5238D70D3004D5E3D /* UITableView+Extension.swift */,\n\t\t\t);\n\t\t\tpath = UIKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433EC6238D70D3004D5E3D /* SnapKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433EC7238D70D3004D5E3D /* ConstraintArray+Extensions.swift */,\n\t\t\t\t27433EC8238D70D3004D5E3D /* ConstraintArrayDSL.swift */,\n\t\t\t);\n\t\t\tpath = SnapKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433ECB238D70D3004D5E3D /* Dictionary */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433ECC238D70D3004D5E3D /* Dictionary+Exted.swift */,\n\t\t\t);\n\t\t\tpath = Dictionary;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F57238D70D4004D5E3D /* Thirdparty */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433F62238D70D4004D5E3D /* RxErrorTracker */,\n\t\t\t\t4C4A1A1D2818DAB900CDD3B1 /* BottomPopupController */,\n\t\t\t\t4C5579602817C3C3006D8A09 /* RxActivityIndicator */,\n\t\t\t\t27433F66238D70D4004D5E3D /* NavigationHandy */,\n\t\t\t);\n\t\t\tpath = Thirdparty;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F62238D70D4004D5E3D /* RxErrorTracker */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433F63238D70D4004D5E3D /* ErrorTracker.swift */,\n\t\t\t);\n\t\t\tpath = RxErrorTracker;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F66238D70D4004D5E3D /* NavigationHandy */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433F67238D70D4004D5E3D /* NSObject+BinAdd.h */,\n\t\t\t\t27433F69238D70D4004D5E3D /* NSObject+BinAdd.m */,\n\t\t\t\t27433F68238D70D4004D5E3D /* UINavigationController+Extensions.m */,\n\t\t\t\t27433F6A238D70D4004D5E3D /* UINavigationController+Extensions.h */,\n\t\t\t);\n\t\t\tpath = NavigationHandy;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F6D238D70D4004D5E3D /* Base */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A40B2817CA3300E9EF54 /* Model */,\n\t\t\t\t27433F6E238D70D4004D5E3D /* ViewModel */,\n\t\t\t\t27433F78238D70D4004D5E3D /* FYBaseViewController.swift */,\n\t\t\t\t4CF8568D281A3B8400F48D4D /* FYBaseIGListViewController.swift */,\n\t\t\t\t27433F70238D70D4004D5E3D /* FYBaseTabBarController.swift */,\n\t\t\t\t27433F75238D70D4004D5E3D /* FYBaseNavigationController.swift */,\n\t\t\t);\n\t\t\tpath = Base;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F6E238D70D4004D5E3D /* ViewModel */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433F6F238D70D4004D5E3D /* BaseViewModel.swift */,\n\t\t\t);\n\t\t\tpath = ViewModel;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F79238D70D4004D5E3D /* Common */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433F7F238D70D4004D5E3D /* AppCommon.swift */,\n\t\t\t);\n\t\t\tpath = Common;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F80238D70D4004D5E3D /* Libraries */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CBE2B24281B937900FDB081 /* NavPopup */,\n\t\t\t\t4C5E7B172824FAAF00C968D3 /* Refreshing */,\n\t\t\t\t4C4A1A302818DB7200CDD3B1 /* ActionSheet */,\n\t\t\t\t27433F97238D70D4004D5E3D /* HUDProgress */,\n\t\t\t);\n\t\t\tpath = Libraries;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27433F97238D70D4004D5E3D /* HUDProgress */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433F98238D70D4004D5E3D /* MBConfiguredHUD.swift */,\n\t\t\t\t27433F99238D70D4004D5E3D /* HUDAssets.bundle */,\n\t\t\t);\n\t\t\tpath = HUDProgress;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27B954E423AFAA5600B94667 /* Video */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27B954E523AFAA5600B94667 /* localVideo0.mp4 */,\n\t\t\t);\n\t\t\tpath = Video;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2E59E746222CFEF4005BC4B7 /* Languages */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2E59E752222CFFCA005BC4B7 /* InfoPlist.strings */,\n\t\t\t\t2B9E10F8222F752700638202 /* Localizable.strings */,\n\t\t\t);\n\t\t\tpath = Languages;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2EB8E28E223745C500FD3235 /* Recovered References */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = \"Recovered References\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2ECBFDA622269BF300871913 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C509CC828267B1A00CE66DF /* JetChatWidgetExtension.entitlements */,\n\t\t\t\t2ECBFDB122269BF300871913 /* FY-IMChat */,\n\t\t\t\t2ECBFDC622269BF400871913 /* FY-IMChatTests */,\n\t\t\t\t2ECBFDD122269BF400871913 /* FY-IMChatUITests */,\n\t\t\t\t4C509CB828267AE700CE66DF /* JetChatWidget */,\n\t\t\t\t2ECBFDB022269BF300871913 /* Products */,\n\t\t\t\t884BB488DBE648A934939F40 /* Frameworks */,\n\t\t\t\t2EB8E28E223745C500FD3235 /* Recovered References */,\n\t\t\t\t6A4C5C987FCC1B21829C5F08 /* Pods */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2ECBFDB022269BF300871913 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2ECBFDAF22269BF300871913 /* JetChat.app */,\n\t\t\t\t2ECBFDC322269BF400871913 /* FY-IMChatTests.xctest */,\n\t\t\t\t2ECBFDCE22269BF400871913 /* FY-IMChatUITests.xctest */,\n\t\t\t\t4C509CB328267AE700CE66DF /* JetChatWidgetExtension.appex */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2ECBFDB122269BF300871913 /* FY-IMChat */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C509CCB28268BC600CE66DF /* FY-IMChat.entitlements */,\n\t\t\t\t2BC1B0D8229134E600A5CB54 /* Assets.xcassets */,\n\t\t\t\t2ECBFDE022269DBF00871913 /* Classes */,\n\t\t\t\t2B166CED22534DFB0018AF62 /* LaunchScreen.storyboard */,\n\t\t\t\t2E2C3B9E2228C9D300BF1C5D /* FYObjcBridge.h */,\n\t\t\t\t2ECBFDBE22269BF400871913 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = \"FY-IMChat\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2ECBFDC622269BF400871913 /* FY-IMChatTests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2ECBFDC722269BF400871913 /* FY_IMChatTests.swift */,\n\t\t\t\t2ECBFDC922269BF400871913 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = \"FY-IMChatTests\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2ECBFDD122269BF400871913 /* FY-IMChatUITests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2ECBFDD222269BF400871913 /* FY_IMChatUITests.swift */,\n\t\t\t\t2ECBFDD422269BF400871913 /* Info.plist */,\n\t\t\t);\n\t\t\tpath = \"FY-IMChatUITests\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2ECBFDE022269DBF00871913 /* Classes */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27433F6D238D70D4004D5E3D /* Base */,\n\t\t\t\t27433EA5238D70D3004D5E3D /* AppDelegate */,\n\t\t\t\t4C75A40E2817D0F300E9EF54 /* MainModule */,\n\t\t\t\t27433F79238D70D4004D5E3D /* Common */,\n\t\t\t\t27433EAA238D70D3004D5E3D /* Extensions */,\n\t\t\t\t27433F80238D70D4004D5E3D /* Libraries */,\n\t\t\t\t271C025623929B3A0041617F /* Utilites */,\n\t\t\t\t27433F57238D70D4004D5E3D /* Thirdparty */,\n\t\t\t\t2ECBFDEC22269DBF00871913 /* Resource */,\n\t\t\t);\n\t\t\tpath = Classes;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2ECBFDEC22269DBF00871913 /* Resource */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4092817C8FF00E9EF54 /* R.generated.swift */,\n\t\t\t\t27B954E423AFAA5600B94667 /* Video */,\n\t\t\t\t2E59E746222CFEF4005BC4B7 /* Languages */,\n\t\t\t);\n\t\t\tpath = Resource;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C4A1A1D2818DAB900CDD3B1 /* BottomPopupController */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C4A1A1E2818DABA00CDD3B1 /* BottomPopupUtils.swift */,\n\t\t\t\t4C4A1A1F2818DABA00CDD3B1 /* BottomPopupViewController.swift */,\n\t\t\t\t4C4A1A202818DABA00CDD3B1 /* BottomPopupDismissInteractionController.swift */,\n\t\t\t\t4C4A1A212818DABA00CDD3B1 /* BottomPopupNavigationController.swift */,\n\t\t\t\t4C4A1A222818DABA00CDD3B1 /* BottomPopupDismissAnimator.swift */,\n\t\t\t\t4C4A1A232818DABA00CDD3B1 /* BottomPopupPresentAnimator.swift */,\n\t\t\t\t4C4A1A242818DABA00CDD3B1 /* CSBottomPopupNavigationController.swift */,\n\t\t\t\t4C4A1A252818DABA00CDD3B1 /* BottomPopupTransitionHandler.swift */,\n\t\t\t\t4C4A1A262818DABA00CDD3B1 /* BottomPopupPresentationController.swift */,\n\t\t\t);\n\t\t\tpath = BottomPopupController;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C4A1A302818DB7200CDD3B1 /* ActionSheet */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C4A1A322818DB7200CDD3B1 /* FYActionSheet.swift */,\n\t\t\t\t4C4A1A312818DB7200CDD3B1 /* FYActionSheetCell.swift */,\n\t\t\t);\n\t\t\tpath = ActionSheet;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C509CB828267AE700CE66DF /* JetChatWidget */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C509CB928267AE700CE66DF /* JetChatWidget.swift */,\n\t\t\t\t4C509CBB28267AE700CE66DF /* JetChatWidget.intentdefinition */,\n\t\t\t\t4C509CBC28267AEA00CE66DF /* Assets.xcassets */,\n\t\t\t\t4C509CBE28267AEA00CE66DF /* Info.plist */,\n\t\t\t);\n\t\t\tpath = JetChatWidget;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C5579602817C3C3006D8A09 /* RxActivityIndicator */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C5579612817C3C3006D8A09 /* ActivityIndicator.swift */,\n\t\t\t);\n\t\t\tpath = RxActivityIndicator;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C5E7B172824FAAF00C968D3 /* Refreshing */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C5E7B182824FAAF00C968D3 /* FYMomentsHeaderRefresh.swift */,\n\t\t\t);\n\t\t\tpath = Refreshing;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C5FB426281A974C001F70E3 /* MomentLabel */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C5FB427281A974C001F70E3 /* FYLabel.swift */,\n\t\t\t\t4C5FB428281A974C001F70E3 /* FYLabelType.swift */,\n\t\t\t);\n\t\t\tpath = MomentLabel;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C5FB42B281AA7D0001F70E3 /* FileSizeManager */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C5FB42C281AA7DD001F70E3 /* FYFileSizeManager.swift */,\n\t\t\t\t4C509CC92826817A00CE66DF /* FYUserDefaultManager.swift */,\n\t\t\t);\n\t\t\tpath = FileSizeManager;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A40B2817CA3300E9EF54 /* Model */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A40C2817CA3300E9EF54 /* FYCellDataConfig.swift */,\n\t\t\t);\n\t\t\tpath = Model;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A40E2817D0F300E9EF54 /* MainModule */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A40F2817D0F300E9EF54 /* Contacts */,\n\t\t\t\t4C75A4172817D0F300E9EF54 /* QrScan */,\n\t\t\t\t4C75A41C2817D0F300E9EF54 /* ChatRoom */,\n\t\t\t\t4C75A4322817D0F300E9EF54 /* Conversation */,\n\t\t\t\t4CF8562B281A2F8900F48D4D /* Moments */,\n\t\t\t\t4C75A42C2817D0F300E9EF54 /* Mine */,\n\t\t\t);\n\t\t\tpath = MainModule;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A40F2817D0F300E9EF54 /* Contacts */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4102817D0F300E9EF54 /* Controller */,\n\t\t\t\t4C75A4142817D0F300E9EF54 /* View */,\n\t\t\t);\n\t\t\tpath = Contacts;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4102817D0F300E9EF54 /* Controller */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4112817D0F300E9EF54 /* FYEditChatInfoViewController.swift */,\n\t\t\t\t4C75A4122817D0F300E9EF54 /* FYContactsInfoViewController.swift */,\n\t\t\t\t4C75A4132817D0F300E9EF54 /* FYContactsListViewController.swift */,\n\t\t\t);\n\t\t\tpath = Controller;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4142817D0F300E9EF54 /* View */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4152817D0F300E9EF54 /* FYContactsInfoView.swift */,\n\t\t\t\t4C75A4162817D0F300E9EF54 /* FYContactsTableViewCell.swift */,\n\t\t\t);\n\t\t\tpath = View;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4172817D0F300E9EF54 /* QrScan */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4182817D0F300E9EF54 /* ScanQRCodeViewController.swift */,\n\t\t\t\t4C75A4192817D0F300E9EF54 /* Image */,\n\t\t\t);\n\t\t\tpath = QrScan;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4192817D0F300E9EF54 /* Image */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A41A2817D0F300E9EF54 /* icon_qrc_border@3x.png */,\n\t\t\t\t4C75A41B2817D0F300E9EF54 /* icon_qrc_line@3x.png */,\n\t\t\t);\n\t\t\tpath = Image;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A41C2817D0F300E9EF54 /* ChatRoom */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A41D2817D0F300E9EF54 /* ViewModel */,\n\t\t\t\t4C75A41F2817D0F300E9EF54 /* Controller */,\n\t\t\t\t4C75A4232817D0F300E9EF54 /* Model */,\n\t\t\t\t4C75A4272817D0F300E9EF54 /* View */,\n\t\t\t);\n\t\t\tpath = ChatRoom;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A41D2817D0F300E9EF54 /* ViewModel */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A41E2817D0F300E9EF54 /* FYMessageViewModel.swift */,\n\t\t\t);\n\t\t\tpath = ViewModel;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A41F2817D0F300E9EF54 /* Controller */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4202817D0F300E9EF54 /* FYChatBaseViewController.swift */,\n\t\t\t\t4C75A4212817D0F300E9EF54 /* FYMessageForwardViewController.swift */,\n\t\t\t\t4C75A4222817D0F300E9EF54 /* FYChatRoomListViewController.swift */,\n\t\t\t);\n\t\t\tpath = Controller;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4232817D0F300E9EF54 /* Model */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4242817D0F300E9EF54 /* FYMessageItem.swift */,\n\t\t\t\t4C75A4252817D0F300E9EF54 /* FYMessageChatModel.swift */,\n\t\t\t\t4C75A4262817D0F300E9EF54 /* FYMessageBaseModel.swift */,\n\t\t\t);\n\t\t\tpath = Model;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4272817D0F300E9EF54 /* View */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A42B2817D0F300E9EF54 /* FYMessageBaseCell.swift */,\n\t\t\t\t4C75A42A2817D0F300E9EF54 /* FYTextMessageCell.swift */,\n\t\t\t\t4C75A4282817D0F300E9EF54 /* FYVideoMessageCell.swift */,\n\t\t\t\t4C75A4292817D0F300E9EF54 /* FYImageMessageCell.swift */,\n\t\t\t);\n\t\t\tpath = View;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A42C2817D0F300E9EF54 /* Mine */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A42D2817D0F300E9EF54 /* Controller */,\n\t\t\t\t4C75A4302817D0F300E9EF54 /* View */,\n\t\t\t);\n\t\t\tpath = Mine;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A42D2817D0F300E9EF54 /* Controller */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A42E2817D0F300E9EF54 /* FYMineViewController.swift */,\n\t\t\t\t4C75A42F2817D0F300E9EF54 /* FYSettingViewController.swift */,\n\t\t\t\t4CF27C1F281D4EE600DBD7EC /* FYThemeSelectionListVC.swift */,\n\t\t\t);\n\t\t\tpath = Controller;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4302817D0F300E9EF54 /* View */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4312817D0F300E9EF54 /* FYFastGridListView.swift */,\n\t\t\t);\n\t\t\tpath = View;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4322817D0F300E9EF54 /* Conversation */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4332817D0F400E9EF54 /* Controller */,\n\t\t\t\t4C75A4352817D0F400E9EF54 /* View */,\n\t\t\t);\n\t\t\tpath = Conversation;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4332817D0F400E9EF54 /* Controller */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4342817D0F400E9EF54 /* FYSesstionListViewController.swift */,\n\t\t\t);\n\t\t\tpath = Controller;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C75A4352817D0F400E9EF54 /* View */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C75A4362817D0F400E9EF54 /* FYConversationCell.swift */,\n\t\t\t);\n\t\t\tpath = View;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CBE2B24281B937900FDB081 /* NavPopup */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CBE2B25281B937900FDB081 /* FYNavPopuListMenu.swift */,\n\t\t\t\t4CBE2B26281B937900FDB081 /* Cell */,\n\t\t\t);\n\t\t\tpath = NavPopup;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CBE2B26281B937900FDB081 /* Cell */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CBE2B27281B937900FDB081 /* FYNavDropMenuCell.swift */,\n\t\t\t);\n\t\t\tpath = Cell;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CBE2B2A281BCDE500FDB081 /* Notification */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CBE2B2B281BCDE500FDB081 /* Notification+Name.swift */,\n\t\t\t);\n\t\t\tpath = Notification;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CBE2B2D281BCE9500FDB081 /* DataBase */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CBE2B2E281BCE9500FDB081 /* WCDBManager */,\n\t\t\t);\n\t\t\tpath = DataBase;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CBE2B2E281BCE9500FDB081 /* WCDBManager */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CBE2B2F281BCE9500FDB081 /* DBQuery */,\n\t\t\t\t4C15484B28362BD900AD7400 /* WCDataBaseManager.swift */,\n\t\t\t\t4C15484C28362BDA00AD7400 /* WCDataBaseTable.swift */,\n\t\t\t);\n\t\t\tpath = WCDBManager;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CBE2B2F281BCE9500FDB081 /* DBQuery */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CBE2B30281BCE9500FDB081 /* FYDBQueryHelper.swift */,\n\t\t\t\t4CBE2B31281BCE9500FDB081 /* FYMessageUserModel.swift */,\n\t\t\t);\n\t\t\tpath = DBQuery;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF27C16281CEF3B00DBD7EC /* Theme */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF27C17281CEFDC00DBD7EC /* FYThemeCenter.swift */,\n\t\t\t\t4CF27C1D281CF82600DBD7EC /* FYThemeColors.swift */,\n\t\t\t\t4CF27C19281CF04B00DBD7EC /* FYDarkTheme.swift */,\n\t\t\t\t4CF27C1B281CF05D00DBD7EC /* FYLightTheme.swift */,\n\t\t\t);\n\t\t\tpath = Theme;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF8562B281A2F8900F48D4D /* Moments */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF856BC281A4D2800F48D4D /* JSONData */,\n\t\t\t\t4CF856B6281A454200F48D4D /* Sections */,\n\t\t\t\t4CF8562C281A2F8900F48D4D /* Model */,\n\t\t\t\t4CF8562D281A2F8900F48D4D /* View */,\n\t\t\t\t4CF8562F281A2FFA00F48D4D /* FYMomentsViewController.swift */,\n\t\t\t);\n\t\t\tpath = Moments;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF8562C281A2F8900F48D4D /* Model */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF8568F281A3E8100F48D4D /* FYMomentInfo.swift */,\n\t\t\t\t4CF85691281A3F0F00F48D4D /* FYMoUserInfo.swift */,\n\t\t\t\t4CF85693281A3F5300F48D4D /* FYCommentInfo.swift */,\n\t\t\t);\n\t\t\tpath = Model;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF8562D281A2F8900F48D4D /* View */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF856B3281A433700F48D4D /* TextView */,\n\t\t\t\t4C5FB426281A974C001F70E3 /* MomentLabel */,\n\t\t\t\t4CF85695281A40D400F48D4D /* Cell */,\n\t\t\t\t4CF856AA281A40F300F48D4D /* NineImageView.swift */,\n\t\t\t\t4CF856AB281A40F300F48D4D /* OperateMenuView.swift */,\n\t\t\t\t4CF8568B281A34C200F48D4D /* FYMomentNavBar.swift */,\n\t\t\t);\n\t\t\tpath = View;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF85695281A40D400F48D4D /* Cell */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF8569F281A40D400F48D4D /* MomentHeaderImageCell.swift */,\n\t\t\t\t4CF85696281A40D400F48D4D /* MomentBottomCell.swift */,\n\t\t\t\t4CF85697281A40D400F48D4D /* MomentHeaderCell.swift */,\n\t\t\t\t4CF85698281A40D400F48D4D /* CommentInputView.swift */,\n\t\t\t\t4CF85699281A40D400F48D4D /* MomentLocationCell.swift */,\n\t\t\t\t4CF8569A281A40D400F48D4D /* CommentContentCell.swift */,\n\t\t\t\t4CF8569B281A40D400F48D4D /* MomentCommentCell.swift */,\n\t\t\t\t4CF8569C281A40D400F48D4D /* CommentThumbView.swift */,\n\t\t\t\t4CF8569D281A40D400F48D4D /* CommentContentView.swift */,\n\t\t\t\t4CF8569E281A40D400F48D4D /* MomentTopCell.swift */,\n\t\t\t);\n\t\t\tpath = Cell;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF856B3281A433700F48D4D /* TextView */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF856B4281A433700F48D4D /* FYTextView.swift */,\n\t\t\t);\n\t\t\tpath = TextView;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF856B6281A454200F48D4D /* Sections */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF856B7281A456700F48D4D /* FYMomentBindingSection.swift */,\n\t\t\t);\n\t\t\tpath = Sections;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF856BC281A4D2800F48D4D /* JSONData */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4CF856BD281A4D2800F48D4D /* moments1.json */,\n\t\t\t\t4CF856BE281A4D2800F48D4D /* moments2.json */,\n\t\t\t);\n\t\t\tpath = JSONData;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6A4C5C987FCC1B21829C5F08 /* Pods */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t98E659EF05275210EC83E03D /* Pods-FY-IMChat.debug.xcconfig */,\n\t\t\t\t5858C5E76CAB64DDB07738CD /* Pods-FY-IMChat.release.xcconfig */,\n\t\t\t);\n\t\t\tpath = Pods;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t884BB488DBE648A934939F40 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2EF014782230FC7200681D4F /* JavaScriptCore.framework */,\n\t\t\t\t2EF014762230FC6D00681D4F /* WebKit.framework */,\n\t\t\t\tE374D4E527160347F32F8B70 /* Pods_FY_IMChat.framework */,\n\t\t\t\t4C509CB428267AE700CE66DF /* WidgetKit.framework */,\n\t\t\t\t4C509CB628267AE700CE66DF /* SwiftUI.framework */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t2ECBFDAE22269BF300871913 /* FY-IMChat */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 2ECBFDD722269BF400871913 /* Build configuration list for PBXNativeTarget \"FY-IMChat\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t2C91F496D1EC74FC8499020A /* [CP] Check Pods Manifest.lock */,\n\t\t\t\t4C75A4062817C63500E9EF54 /* ShellScript */,\n\t\t\t\t2ECBFDAB22269BF300871913 /* Sources */,\n\t\t\t\t2ECBFDAC22269BF300871913 /* Frameworks */,\n\t\t\t\t2ECBFDAD22269BF300871913 /* Resources */,\n\t\t\t\t2E461CF143CEEA3003A03808 /* [CP] Embed Pods Frameworks */,\n\t\t\t\t4C509CC428267AEA00CE66DF /* Embed App Extensions */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t4C509CC228267AEA00CE66DF /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"FY-IMChat\";\n\t\t\tproductName = \"FY-IMChat\";\n\t\t\tproductReference = 2ECBFDAF22269BF300871913 /* JetChat.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\t2ECBFDC222269BF400871913 /* FY-IMChatTests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 2ECBFDDA22269BF400871913 /* Build configuration list for PBXNativeTarget \"FY-IMChatTests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t2ECBFDBF22269BF400871913 /* Sources */,\n\t\t\t\t2ECBFDC022269BF400871913 /* Frameworks */,\n\t\t\t\t2ECBFDC122269BF400871913 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t2ECBFDC522269BF400871913 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"FY-IMChatTests\";\n\t\t\tproductName = \"FY-IMChatTests\";\n\t\t\tproductReference = 2ECBFDC322269BF400871913 /* FY-IMChatTests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\t2ECBFDCD22269BF400871913 /* FY-IMChatUITests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 2ECBFDDD22269BF400871913 /* Build configuration list for PBXNativeTarget \"FY-IMChatUITests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t2ECBFDCA22269BF400871913 /* Sources */,\n\t\t\t\t2ECBFDCB22269BF400871913 /* Frameworks */,\n\t\t\t\t2ECBFDCC22269BF400871913 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t2ECBFDD022269BF400871913 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"FY-IMChatUITests\";\n\t\t\tproductName = \"FY-IMChatUITests\";\n\t\t\tproductReference = 2ECBFDCE22269BF400871913 /* FY-IMChatUITests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.ui-testing\";\n\t\t};\n\t\t4C509CB228267AE700CE66DF /* JetChatWidgetExtension */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 4C509CC728267AEA00CE66DF /* Build configuration list for PBXNativeTarget \"JetChatWidgetExtension\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t4C509CAF28267AE700CE66DF /* Sources */,\n\t\t\t\t4C509CB028267AE700CE66DF /* Frameworks */,\n\t\t\t\t4C509CB128267AE700CE66DF /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = JetChatWidgetExtension;\n\t\t\tproductName = JetChatWidgetExtension;\n\t\t\tproductReference = 4C509CB328267AE700CE66DF /* JetChatWidgetExtension.appex */;\n\t\t\tproductType = \"com.apple.product-type.app-extension\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t2ECBFDA722269BF300871913 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tCLASSPREFIX = FY;\n\t\t\t\tKnownAssetTags = (\n\t\t\t\t\tlaunchName,\n\t\t\t\t);\n\t\t\t\tLastSwiftUpdateCheck = 1330;\n\t\t\t\tLastUpgradeCheck = 1020;\n\t\t\t\tORGANIZATIONNAME = Jett;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t2ECBFDAE22269BF300871913 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 10.1;\n\t\t\t\t\t};\n\t\t\t\t\t2ECBFDC222269BF400871913 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 10.1;\n\t\t\t\t\t\tTestTargetID = 2ECBFDAE22269BF300871913;\n\t\t\t\t\t};\n\t\t\t\t\t2ECBFDCD22269BF400871913 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 10.1;\n\t\t\t\t\t\tTestTargetID = 2ECBFDAE22269BF300871913;\n\t\t\t\t\t};\n\t\t\t\t\t4C509CB228267AE700CE66DF = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 13.3.1;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 2ECBFDAA22269BF300871913 /* Build configuration list for PBXProject \"FY-IMChat\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t\t\"zh-Hans\",\n\t\t\t);\n\t\t\tmainGroup = 2ECBFDA622269BF300871913;\n\t\t\tproductRefGroup = 2ECBFDB022269BF300871913 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t2ECBFDAE22269BF300871913 /* FY-IMChat */,\n\t\t\t\t2ECBFDC222269BF400871913 /* FY-IMChatTests */,\n\t\t\t\t2ECBFDCD22269BF400871913 /* FY-IMChatUITests */,\n\t\t\t\t4C509CB228267AE700CE66DF /* JetChatWidgetExtension */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t2ECBFDAD22269BF300871913 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t271C02EA23929B3A0041617F /* ToolViewEmotionHL@2x.png in Resources */,\n\t\t\t\t271C02F023929B3A0041617F /* Expression.bundle in Resources */,\n\t\t\t\t271C02E323929B3A0041617F /* ToolViewInputVoice@3x.png in Resources */,\n\t\t\t\t271C02CC23929B3A0041617F /* ic_more_location@3x.png in Resources */,\n\t\t\t\t271C02C923929B3A0041617F /* ic_emotion_delete@2x.png in Resources */,\n\t\t\t\t271C02D023929B3A0041617F /* ic_more_video@2x.png in Resources */,\n\t\t\t\t271C02D623929B3A0041617F /* ic_more_album@3x.png in Resources */,\n\t\t\t\t271C02DF23929B3A0041617F /* ToolViewKeyboardHL@3x.png in Resources */,\n\t\t\t\t271C02C823929B3A0041617F /* ic_emotion_delete@3x.png in Resources */,\n\t\t\t\t271C02DB23929B3A0041617F /* ic_more_voice@3x.png in Resources */,\n\t\t\t\t271C02D423929B3A0041617F /* ic_more_album@2x.png in Resources */,\n\t\t\t\t2E59E750222CFFCA005BC4B7 /* InfoPlist.strings in Resources */,\n\t\t\t\t271C02E623929B3A0041617F /* ToolViewInputVoice@2x.png in Resources */,\n\t\t\t\t271C02D123929B3A0041617F /* ic_more_video@3x.png in Resources */,\n\t\t\t\t271C02E123929B3A0041617F /* ToolViewEmotion@2x.png in Resources */,\n\t\t\t\t271C02F123929B3A0041617F /* icon_emoji_expression@3x.png in Resources */,\n\t\t\t\t271C02CD23929B3A0041617F /* ic_more_location@2x.png in Resources */,\n\t\t\t\t271C02E923929B3A0041617F /* ToolViewInputVoiceHL@3x.png in Resources */,\n\t\t\t\t271C02D523929B3A0041617F /* ic_more_sight@3x.png in Resources */,\n\t\t\t\t271C02E523929B3A0041617F /* ToolViewKeyboard@2x.png in Resources */,\n\t\t\t\t271C02D323929B3A0041617F /* ic_more_camera@2x.png in Resources */,\n\t\t\t\t2B166CEE22534DFB0018AF62 /* LaunchScreen.storyboard in Resources */,\n\t\t\t\t271C02E023929B3A0041617F /* ToolViewEmotion@3x.png in Resources */,\n\t\t\t\t271C02DD23929B3A0041617F /* ic_more_friendcard@3x.png in Resources */,\n\t\t\t\t271C02DA23929B3A0041617F /* ic_more_pay@3x.png in Resources */,\n\t\t\t\t271C02E723929B3A0041617F /* ToolViewEmotionHL@3x.png in Resources */,\n\t\t\t\t271C02EF23929B3A0041617F /* icon_emoji_expression@2x.png in Resources */,\n\t\t\t\t4CF856C0281A4D2800F48D4D /* moments2.json in Resources */,\n\t\t\t\t271C02E223929B3A0041617F /* ToolViewKeyboardHL@2x.png in Resources */,\n\t\t\t\t271C02DE23929B3A0041617F /* ic_more_pay@2x.png in Resources */,\n\t\t\t\t271C02E423929B3A0041617F /* ToolViewKeyboard@3x.png in Resources */,\n\t\t\t\t271C02D223929B3A0041617F /* ic_more_wallet@3x.png in Resources */,\n\t\t\t\t271C02CF23929B3A0041617F /* ic_more_wallet@2x.png in Resources */,\n\t\t\t\t271C02EB23929B3A0041617F /* TypeSelectorBtnHL_Black@2x.png in Resources */,\n\t\t\t\t271C02EC23929B3A0041617F /* TypeSelectorBtn_Black@3x.png in Resources */,\n\t\t\t\t271C02E823929B3A0041617F /* ToolViewInputVoiceHL@2x.png in Resources */,\n\t\t\t\t271C02CE23929B3A0041617F /* ic_more_favorite@3x.png in Resources */,\n\t\t\t\t27434036238D70D5004D5E3D /* HUDAssets.bundle in Resources */,\n\t\t\t\t4CF856BF281A4D2800F48D4D /* moments1.json in Resources */,\n\t\t\t\t271C02D723929B3A0041617F /* ic_more_sight@2x.png in Resources */,\n\t\t\t\t271C02D923929B3A0041617F /* ic_more_friendcard@2x.png in Resources */,\n\t\t\t\t271C02CA23929B3A0041617F /* Emoticons.bundle in Resources */,\n\t\t\t\t27B954E623AFAA5600B94667 /* localVideo0.mp4 in Resources */,\n\t\t\t\t2B9E10F6222F752700638202 /* Localizable.strings in Resources */,\n\t\t\t\t271C02F223929B3A0041617F /* Expression.plist in Resources */,\n\t\t\t\t271C02CB23929B3A0041617F /* ic_more_favorite@2x.png in Resources */,\n\t\t\t\t271C02ED23929B3A0041617F /* TypeSelectorBtn_Black@2x.png in Resources */,\n\t\t\t\t271C02D823929B3A0041617F /* ic_more_camera@3x.png in Resources */,\n\t\t\t\t271C02EE23929B3A0041617F /* TypeSelectorBtnHL_Black@3x.png in Resources */,\n\t\t\t\t4C75A43E2817D0F400E9EF54 /* icon_qrc_line@3x.png in Resources */,\n\t\t\t\t271C02DC23929B3A0041617F /* ic_more_voice@2x.png in Resources */,\n\t\t\t\t2BC1B0D9229134E600A5CB54 /* Assets.xcassets in Resources */,\n\t\t\t\t4C75A43D2817D0F400E9EF54 /* icon_qrc_border@3x.png in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t2ECBFDC122269BF400871913 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t2ECBFDCC22269BF400871913 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t4C509CB128267AE700CE66DF /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4C509CBD28267AEA00CE66DF /* Assets.xcassets in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t2C91F496D1EC74FC8499020A /* [CP] Check Pods Manifest.lock */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\",\n\t\t\t\t\"${PODS_ROOT}/Manifest.lock\",\n\t\t\t);\n\t\t\tname = \"[CP] Check Pods Manifest.lock\";\n\t\t\toutputFileListPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t\t\"$(DERIVED_FILE_DIR)/Pods-FY-IMChat-checkManifestLockResult.txt\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"diff \\\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\\\" \\\"${PODS_ROOT}/Manifest.lock\\\" > /dev/null\\nif [ $? != 0 ] ; then\\n    # print error to STDERR\\n    echo \\\"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\\\" >&2\\n    exit 1\\nfi\\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\\necho \\\"SUCCESS\\\" > \\\"${SCRIPT_OUTPUT_FILE_0}\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\t2E461CF143CEEA3003A03808 /* [CP] Embed Pods Frameworks */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t);\n\t\t\tname = \"[CP] Embed Pods Frameworks\";\n\t\t\toutputFileListPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${PODS_ROOT}/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-frameworks.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\t4C75A4062817C63500E9EF54 /* ShellScript */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputFileListPaths = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"$TEMP_DIR/rswift-lastrun\",\n\t\t\t);\n\t\t\toutputFileListPaths = (\n\t\t\t);\n\t\t\toutputPaths = (\n\t\t\t\t\"$SRCROOT/FY-IMChat/Classes/Resource/R.generated.swift\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"$PODS_ROOT/R.swift/rswift\\\" generate \\\"$SRCROOT/FY-IMChat/Classes/Resource/R.generated.swift\\\"\\n\\n\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t2ECBFDAB22269BF300871913 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t27433FA0238D70D4004D5E3D /* String+Extension.swift in Sources */,\n\t\t\t\t4CBE2B35281BCE9500FDB081 /* FYDBQueryHelper.swift in Sources */,\n\t\t\t\t4CF85690281A3E8100F48D4D /* FYMomentInfo.swift in Sources */,\n\t\t\t\t27434029238D70D5004D5E3D /* AppCommon.swift in Sources */,\n\t\t\t\t27433FAF238D70D4004D5E3D /* UINavBarItem+Extension.swift in Sources */,\n\t\t\t\t4C75A44C2817D0F400E9EF54 /* FYFastGridListView.swift in Sources */,\n\t\t\t\t27434035238D70D5004D5E3D /* MBConfiguredHUD.swift in Sources */,\n\t\t\t\t4C75A4452817D0F400E9EF54 /* FYMessageBaseModel.swift in Sources */,\n\t\t\t\t4C75A43A2817D0F400E9EF54 /* FYContactsInfoView.swift in Sources */,\n\t\t\t\t4C4A1A292818DABA00CDD3B1 /* BottomPopupDismissInteractionController.swift in Sources */,\n\t\t\t\t271C02C023929B3A0041617F /* ChatKeyboard+Extensions.swift in Sources */,\n\t\t\t\t271C02BF23929B3A0041617F /* ChatEmojiListView.swift in Sources */,\n\t\t\t\t271C02BE23929B3A0041617F /* ChatMoreMenuView.swift in Sources */,\n\t\t\t\t27433FB0238D70D4004D5E3D /* UIFont+PingFang.swift in Sources */,\n\t\t\t\t4CF856A4281A40D400F48D4D /* CommentContentCell.swift in Sources */,\n\t\t\t\t4C75A44D2817D0F400E9EF54 /* FYSesstionListViewController.swift in Sources */,\n\t\t\t\t271C02FB23929B3A0041617F /* LanguageManager.swift in Sources */,\n\t\t\t\t4CF856AD281A40F300F48D4D /* OperateMenuView.swift in Sources */,\n\t\t\t\t27433F9C238D70D4004D5E3D /* AppDelegate+Wcdb.swift in Sources */,\n\t\t\t\t27433F9B238D70D4004D5E3D /* AppDelegate.swift in Sources */,\n\t\t\t\t2743401A238D70D5004D5E3D /* UINavigationController+Extensions.m in Sources */,\n\t\t\t\t4CF856AC281A40F300F48D4D /* NineImageView.swift in Sources */,\n\t\t\t\t27434024238D70D5004D5E3D /* FYBaseViewController.swift in Sources */,\n\t\t\t\t4CF856A7281A40D400F48D4D /* CommentContentView.swift in Sources */,\n\t\t\t\t4C5FB42D281AA7DD001F70E3 /* FYFileSizeManager.swift in Sources */,\n\t\t\t\t4CF856A2281A40D400F48D4D /* CommentInputView.swift in Sources */,\n\t\t\t\t4CF85692281A3F0F00F48D4D /* FYMoUserInfo.swift in Sources */,\n\t\t\t\t27433FA7238D70D4004D5E3D /* Observable+Operators.swift in Sources */,\n\t\t\t\t27433FAD238D70D4004D5E3D /* UIImageView+Kingfisher.swift in Sources */,\n\t\t\t\t27433FAA238D70D4004D5E3D /* UIAlert+Extension.swift in Sources */,\n\t\t\t\t4C5579622817C3C3006D8A09 /* ActivityIndicator.swift in Sources */,\n\t\t\t\t4CF8568E281A3B8400F48D4D /* FYBaseIGListViewController.swift in Sources */,\n\t\t\t\t271C02FD23929B3A0041617F /* CountDownHandy.swift in Sources */,\n\t\t\t\t2743401D238D70D5004D5E3D /* BaseViewModel.swift in Sources */,\n\t\t\t\t4CF27C1E281CF82600DBD7EC /* FYThemeColors.swift in Sources */,\n\t\t\t\t271C02C123929B3A0041617F /* ChatMoreMenuCell.swift in Sources */,\n\t\t\t\t271C02C623929B3A0041617F /* ChatMoreMnueConfig.swift in Sources */,\n\t\t\t\t4CBE2B28281B937900FDB081 /* FYNavPopuListMenu.swift in Sources */,\n\t\t\t\t4C75A4492817D0F400E9EF54 /* FYMessageBaseCell.swift in Sources */,\n\t\t\t\t4CBE2B29281B937900FDB081 /* FYNavDropMenuCell.swift in Sources */,\n\t\t\t\t27433FB5238D70D4004D5E3D /* Dictionary+Exted.swift in Sources */,\n\t\t\t\t4C4A1A342818DB7200CDD3B1 /* FYActionSheet.swift in Sources */,\n\t\t\t\t4C5FB429281A974C001F70E3 /* FYLabel.swift in Sources */,\n\t\t\t\t4C75A44B2817D0F400E9EF54 /* FYSettingViewController.swift in Sources */,\n\t\t\t\t4C75A44A2817D0F400E9EF54 /* FYMineViewController.swift in Sources */,\n\t\t\t\t271C02C523929B3A0041617F /* ChatEmoticon.swift in Sources */,\n\t\t\t\t4C4A1A2C2818DABA00CDD3B1 /* BottomPopupPresentAnimator.swift in Sources */,\n\t\t\t\t27433FAE238D70D4004D5E3D /* UIImage+Extension.swift in Sources */,\n\t\t\t\t27433FA3238D70D4004D5E3D /* UIView+Extensions.swift in Sources */,\n\t\t\t\t4CF856A1281A40D400F48D4D /* MomentHeaderCell.swift in Sources */,\n\t\t\t\t2743401B238D70D5004D5E3D /* NSObject+BinAdd.m in Sources */,\n\t\t\t\t4C5E7B192824FAB000C968D3 /* FYMomentsHeaderRefresh.swift in Sources */,\n\t\t\t\t4C4A1A2A2818DABA00CDD3B1 /* BottomPopupNavigationController.swift in Sources */,\n\t\t\t\t27433FA8238D70D4004D5E3D /* MJRefresh+Rx.swift in Sources */,\n\t\t\t\t4C75A43C2817D0F400E9EF54 /* ScanQRCodeViewController.swift in Sources */,\n\t\t\t\t4C4A1A332818DB7200CDD3B1 /* FYActionSheetCell.swift in Sources */,\n\t\t\t\t4C75A4372817D0F400E9EF54 /* FYEditChatInfoViewController.swift in Sources */,\n\t\t\t\t271C02F523929B3A0041617F /* ChatEmotionAttachment.swift in Sources */,\n\t\t\t\t4C75A43F2817D0F400E9EF54 /* FYMessageViewModel.swift in Sources */,\n\t\t\t\t4C4A1A272818DABA00CDD3B1 /* BottomPopupUtils.swift in Sources */,\n\t\t\t\t2743401E238D70D5004D5E3D /* FYBaseTabBarController.swift in Sources */,\n\t\t\t\t27433FB3238D70D4004D5E3D /* ConstraintArrayDSL.swift in Sources */,\n\t\t\t\t4C15484D28362BDA00AD7400 /* WCDataBaseManager.swift in Sources */,\n\t\t\t\t4CF85694281A3F5300F48D4D /* FYCommentInfo.swift in Sources */,\n\t\t\t\t27433FA9238D70D4004D5E3D /* Array+Extension.swift in Sources */,\n\t\t\t\t4CBE2B2C281BCDE500FDB081 /* Notification+Name.swift in Sources */,\n\t\t\t\t4C75A40A2817C8FF00E9EF54 /* R.generated.swift in Sources */,\n\t\t\t\t27434022238D70D5004D5E3D /* FYBaseNavigationController.swift in Sources */,\n\t\t\t\t271C02F723929B3A0041617F /* FPSLabel.swift in Sources */,\n\t\t\t\t4CF85630281A2FFA00F48D4D /* FYMomentsViewController.swift in Sources */,\n\t\t\t\t4CF856A3281A40D400F48D4D /* MomentLocationCell.swift in Sources */,\n\t\t\t\t4C75A4482817D0F400E9EF54 /* FYTextMessageCell.swift in Sources */,\n\t\t\t\t4CF856B5281A433700F48D4D /* FYTextView.swift in Sources */,\n\t\t\t\t4CF856A5281A40D400F48D4D /* MomentCommentCell.swift in Sources */,\n\t\t\t\t27433F9D238D70D4004D5E3D /* AppDelegate+Utils.swift in Sources */,\n\t\t\t\t4CF8568C281A34C200F48D4D /* FYMomentNavBar.swift in Sources */,\n\t\t\t\t27433FA4238D70D4004D5E3D /* UIViewController+Extend.swift in Sources */,\n\t\t\t\t4CBE2B36281BCE9500FDB081 /* FYMessageUserModel.swift in Sources */,\n\t\t\t\t27433FB1238D70D4004D5E3D /* UITableView+Extension.swift in Sources */,\n\t\t\t\t27433FAC238D70D4004D5E3D /* UIButton+Extension.swift in Sources */,\n\t\t\t\t4CF27C1C281CF05D00DBD7EC /* FYLightTheme.swift in Sources */,\n\t\t\t\t27433FA6238D70D4004D5E3D /* JFButton+Rx.swift in Sources */,\n\t\t\t\t4C75A40D2817CA3300E9EF54 /* FYCellDataConfig.swift in Sources */,\n\t\t\t\t4C75A43B2817D0F400E9EF54 /* FYContactsTableViewCell.swift in Sources */,\n\t\t\t\t4C75A4392817D0F400E9EF54 /* FYContactsListViewController.swift in Sources */,\n\t\t\t\t4CF856B8281A456700F48D4D /* FYMomentBindingSection.swift in Sources */,\n\t\t\t\t271C02F323929B3A0041617F /* ChatFindEmotion.swift in Sources */,\n\t\t\t\t271C02F623929B3A0041617F /* WeakProxy.m in Sources */,\n\t\t\t\t4C4A1A2E2818DABA00CDD3B1 /* BottomPopupTransitionHandler.swift in Sources */,\n\t\t\t\t27433FA1238D70D4004D5E3D /* String+Date.swift in Sources */,\n\t\t\t\t4C5FB42A281A974C001F70E3 /* FYLabelType.swift in Sources */,\n\t\t\t\t4CF27C20281D4EE600DBD7EC /* FYThemeSelectionListVC.swift in Sources */,\n\t\t\t\t4C75A4472817D0F400E9EF54 /* FYImageMessageCell.swift in Sources */,\n\t\t\t\t4C4A1A2D2818DABA00CDD3B1 /* CSBottomPopupNavigationController.swift in Sources */,\n\t\t\t\t271C02F423929B3A0041617F /* ChatEmotionHelper.swift in Sources */,\n\t\t\t\t4CF27C18281CEFDC00DBD7EC /* FYThemeCenter.swift in Sources */,\n\t\t\t\t27433FAB238D70D4004D5E3D /* UILabel+Extension.swift in Sources */,\n\t\t\t\t4C75A4412817D0F400E9EF54 /* FYMessageForwardViewController.swift in Sources */,\n\t\t\t\t4C4A1A2F2818DABA00CDD3B1 /* BottomPopupPresentationController.swift in Sources */,\n\t\t\t\t271C02C723929B3A0041617F /* ChatGrowingTextView.swift in Sources */,\n\t\t\t\t4C75A4462817D0F400E9EF54 /* FYVideoMessageCell.swift in Sources */,\n\t\t\t\t27434018238D70D5004D5E3D /* ErrorTracker.swift in Sources */,\n\t\t\t\t4CF27C1A281CF04B00DBD7EC /* FYDarkTheme.swift in Sources */,\n\t\t\t\t4C509CC028267AEA00CE66DF /* JetChatWidget.intentdefinition in Sources */,\n\t\t\t\t4C4A1A282818DABA00CDD3B1 /* BottomPopupViewController.swift in Sources */,\n\t\t\t\t27433FB2238D70D4004D5E3D /* ConstraintArray+Extensions.swift in Sources */,\n\t\t\t\t4C15484E28362BDA00AD7400 /* WCDataBaseTable.swift in Sources */,\n\t\t\t\t4C75A4402817D0F400E9EF54 /* FYChatBaseViewController.swift in Sources */,\n\t\t\t\t4CF856A9281A40D400F48D4D /* MomentHeaderImageCell.swift in Sources */,\n\t\t\t\t4C75A4432817D0F400E9EF54 /* FYMessageItem.swift in Sources */,\n\t\t\t\t27433FA2238D70D4004D5E3D /* UIColor+Extension.swift in Sources */,\n\t\t\t\t4C75A44E2817D0F400E9EF54 /* FYConversationCell.swift in Sources */,\n\t\t\t\t4C75A4442817D0F400E9EF54 /* FYMessageChatModel.swift in Sources */,\n\t\t\t\t4CF856A6281A40D400F48D4D /* CommentThumbView.swift in Sources */,\n\t\t\t\t271C02C223929B3A0041617F /* ChatKeyboardFlowLayout.swift in Sources */,\n\t\t\t\t4C75A4422817D0F400E9EF54 /* FYChatRoomListViewController.swift in Sources */,\n\t\t\t\t271C02C423929B3A0041617F /* ChatKeyboardView.swift in Sources */,\n\t\t\t\t4C75A4382817D0F400E9EF54 /* FYContactsInfoViewController.swift in Sources */,\n\t\t\t\t4CF856A8281A40D400F48D4D /* MomentTopCell.swift in Sources */,\n\t\t\t\t271C02C323929B3A0041617F /* ChatAppleEmojiCell.swift in Sources */,\n\t\t\t\t4CF856A0281A40D400F48D4D /* MomentBottomCell.swift in Sources */,\n\t\t\t\t4C509CCA2826817A00CE66DF /* FYUserDefaultManager.swift in Sources */,\n\t\t\t\t4C4A1A2B2818DABA00CDD3B1 /* BottomPopupDismissAnimator.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t2ECBFDBF22269BF400871913 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2ECBFDC822269BF400871913 /* FY_IMChatTests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t2ECBFDCA22269BF400871913 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2ECBFDD322269BF400871913 /* FY_IMChatUITests.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t4C509CAF28267AE700CE66DF /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4C509CBF28267AEA00CE66DF /* JetChatWidget.intentdefinition in Sources */,\n\t\t\t\t4C509CBA28267AE700CE66DF /* JetChatWidget.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t2ECBFDC522269BF400871913 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 2ECBFDAE22269BF300871913 /* FY-IMChat */;\n\t\t\ttargetProxy = 2ECBFDC422269BF400871913 /* PBXContainerItemProxy */;\n\t\t};\n\t\t2ECBFDD022269BF400871913 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 2ECBFDAE22269BF300871913 /* FY-IMChat */;\n\t\t\ttargetProxy = 2ECBFDCF22269BF400871913 /* PBXContainerItemProxy */;\n\t\t};\n\t\t4C509CC228267AEA00CE66DF /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 4C509CB228267AE700CE66DF /* JetChatWidgetExtension */;\n\t\t\ttargetProxy = 4C509CC128267AEA00CE66DF /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin PBXVariantGroup section */\n\t\t2B9E10F8222F752700638202 /* Localizable.strings */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t2B9E10F7222F752700638202 /* en */,\n\t\t\t\t2B9E10F9222F752800638202 /* zh-Hans */,\n\t\t\t);\n\t\t\tname = Localizable.strings;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2E59E752222CFFCA005BC4B7 /* InfoPlist.strings */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t2E59E751222CFFCA005BC4B7 /* en */,\n\t\t\t\t2E59E753222CFFD7005BC4B7 /* zh-Hans */,\n\t\t\t);\n\t\t\tname = InfoPlist.strings;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2ECBFDD522269BF400871913 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.1;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t2ECBFDD622269BF400871913 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.1;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t2ECBFDD822269BF400871913 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 98E659EF05275210EC83E03D /* Pods-FY-IMChat.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = \"FY-IMChat/FY-IMChat.entitlements\";\n\t\t\t\tCODE_SIGN_IDENTITY = \"Apple Development\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEVELOPMENT_TEAM = Z3CD857XLC;\n\t\t\t\tENABLE_BITCODE = NO;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = \"$(inherited)\";\n\t\t\t\tINFOPLIST_FILE = \"FY-IMChat/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tOTHER_LDFLAGS = (\n\t\t\t\t\t\"-ObjC\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.jetchat.ios;\n\t\t\t\tPRODUCT_NAME = JetChat;\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = \"\";\n\t\t\t\tSWIFT_OBJC_BRIDGING_HEADER = \"FY-IMChat/FYObjcBridge.h\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 1;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t2ECBFDD922269BF400871913 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5858C5E76CAB64DDB07738CD /* Pods-FY-IMChat.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = \"FY-IMChat/FY-IMChat.entitlements\";\n\t\t\t\tCODE_SIGN_IDENTITY = \"Apple Development\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEVELOPMENT_TEAM = Z3CD857XLC;\n\t\t\t\tENABLE_BITCODE = NO;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = \"$(inherited)\";\n\t\t\t\tINFOPLIST_FILE = \"FY-IMChat/Info.plist\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tOTHER_LDFLAGS = (\n\t\t\t\t\t\"-ObjC\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.jetchat.ios;\n\t\t\t\tPRODUCT_NAME = JetChat;\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = \"\";\n\t\t\t\tSWIFT_OBJC_BRIDGING_HEADER = \"FY-IMChat/FYObjcBridge.h\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = 1;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t2ECBFDDB22269BF400871913 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tBUNDLE_LOADER = \"$(TEST_HOST)\";\n\t\t\t\tCODE_SIGN_STYLE = Manual;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = \"FY-IMChatTests/Info.plist\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.miku.LWallet.FY-IMChatTests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = \"\";\n\t\t\t\t\"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]\" = \"\";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_HOST = \"$(BUILT_PRODUCTS_DIR)/FY-IMChat.app/FY-IMChat\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t2ECBFDDC22269BF400871913 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tBUNDLE_LOADER = \"$(TEST_HOST)\";\n\t\t\t\tCODE_SIGN_STYLE = Manual;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = \"FY-IMChatTests/Info.plist\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.miku.LWallet.FY-IMChatTests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = \"\";\n\t\t\t\t\"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]\" = \"\";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_HOST = \"$(BUILT_PRODUCTS_DIR)/FY-IMChat.app/FY-IMChat\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t2ECBFDDE22269BF400871913 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCODE_SIGN_STYLE = Manual;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = \"FY-IMChatUITests/Info.plist\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.miku.LWallet.FY-IMChatUITests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = \"\";\n\t\t\t\t\"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]\" = \"\";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_TARGET_NAME = \"FY-IMChat\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t2ECBFDDF22269BF400871913 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCODE_SIGN_STYLE = Manual;\n\t\t\t\tDEVELOPMENT_TEAM = \"\";\n\t\t\t\tINFOPLIST_FILE = \"FY-IMChatUITests/Info.plist\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.miku.LWallet.FY-IMChatUITests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tPROVISIONING_PROFILE_SPECIFIER = \"\";\n\t\t\t\t\"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]\" = \"\";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tTEST_TARGET_NAME = \"FY-IMChat\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4C509CC528267AEA00CE66DF /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++17\";\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = JetChatWidgetExtension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"Apple Development\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_TEAM = Z3CD857XLC;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_FILE = JetChatWidget/Info.plist;\n\t\t\t\tINFOPLIST_KEY_CFBundleDisplayName = JetChatWidget;\n\t\t\t\tINFOPLIST_KEY_NSHumanReadableCopyright = \"Copyright © 2022 Jett. All rights reserved.\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.4;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@executable_path/../../Frameworks\",\n\t\t\t\t);\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.jetchat.ios.JetChatWidget;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4C509CC628267AEA00CE66DF /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++17\";\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCODE_SIGN_ENTITLEMENTS = JetChatWidgetExtension.entitlements;\n\t\t\t\tCODE_SIGN_IDENTITY = \"Apple Development\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEVELOPMENT_TEAM = Z3CD857XLC;\n\t\t\t\tGENERATE_INFOPLIST_FILE = YES;\n\t\t\t\tINFOPLIST_FILE = JetChatWidget/Info.plist;\n\t\t\t\tINFOPLIST_KEY_CFBundleDisplayName = JetChatWidget;\n\t\t\t\tINFOPLIST_KEY_NSHumanReadableCopyright = \"Copyright © 2022 Jett. All rights reserved.\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 15.4;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@executable_path/../../Frameworks\",\n\t\t\t\t);\n\t\t\t\tMARKETING_VERSION = 1.0;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.jetchat.ios.JetChatWidget;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_EMIT_LOC_STRINGS = YES;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t2ECBFDAA22269BF300871913 /* Build configuration list for PBXProject \"FY-IMChat\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2ECBFDD522269BF400871913 /* Debug */,\n\t\t\t\t2ECBFDD622269BF400871913 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t2ECBFDD722269BF400871913 /* Build configuration list for PBXNativeTarget \"FY-IMChat\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2ECBFDD822269BF400871913 /* Debug */,\n\t\t\t\t2ECBFDD922269BF400871913 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t2ECBFDDA22269BF400871913 /* Build configuration list for PBXNativeTarget \"FY-IMChatTests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2ECBFDDB22269BF400871913 /* Debug */,\n\t\t\t\t2ECBFDDC22269BF400871913 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t2ECBFDDD22269BF400871913 /* Build configuration list for PBXNativeTarget \"FY-IMChatUITests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2ECBFDDE22269BF400871913 /* Debug */,\n\t\t\t\t2ECBFDDF22269BF400871913 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t4C509CC728267AEA00CE66DF /* Build configuration list for PBXNativeTarget \"JetChatWidgetExtension\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4C509CC528267AEA00CE66DF /* Debug */,\n\t\t\t\t4C509CC628267AEA00CE66DF /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 2ECBFDA722269BF300871913 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/FY-IMChat.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "JetChat/FY-IMChat.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/FY-IMChat.xcodeproj/xcshareddata/xcschemes/FY-IMChat.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1020\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"2ECBFDAE22269BF300871913\"\n               BuildableName = \"JetChat.app\"\n               BlueprintName = \"FY-IMChat\"\n               ReferencedContainer = \"container:FY-IMChat.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"2ECBFDAE22269BF300871913\"\n            BuildableName = \"JetChat.app\"\n            BlueprintName = \"FY-IMChat\"\n            ReferencedContainer = \"container:FY-IMChat.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"2ECBFDC222269BF400871913\"\n               BuildableName = \"FY-IMChatTests.xctest\"\n               BlueprintName = \"FY-IMChatTests\"\n               ReferencedContainer = \"container:FY-IMChat.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"2ECBFDCD22269BF400871913\"\n               BuildableName = \"FY-IMChatUITests.xctest\"\n               BlueprintName = \"FY-IMChatUITests\"\n               ReferencedContainer = \"container:FY-IMChat.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"2ECBFDAE22269BF300871913\"\n            BuildableName = \"JetChat.app\"\n            BlueprintName = \"FY-IMChat\"\n            ReferencedContainer = \"container:FY-IMChat.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <CommandLineArguments>\n         <CommandLineArgument\n            argument = \"-FIRDebugEnabled\"\n            isEnabled = \"YES\">\n         </CommandLineArgument>\n      </CommandLineArguments>\n      <EnvironmentVariables>\n         <EnvironmentVariable\n            key = \"OS_ACTIVITY_MODE\"\n            value = \"disable\"\n            isEnabled = \"YES\">\n         </EnvironmentVariable>\n      </EnvironmentVariables>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"2ECBFDAE22269BF300871913\"\n            BuildableName = \"JetChat.app\"\n            BlueprintName = \"FY-IMChat\"\n            ReferencedContainer = \"container:FY-IMChat.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "JetChat/FY-IMChat.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:FY-IMChat.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:Pods/Pods.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "JetChat/FY-IMChat.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/FY-IMChatTests/FY_IMChatTests.swift",
    "content": "//\n//  MK_LWalletTests.swift\n//  FY-JetChatTests\n//\n//  Created by iOS.Jet on 2019/2/27.\n//  Copyright © 2019 Jett.Jet. All rights reserved.\n//\n\nimport XCTest\n@testable import FY_IMChat\n\nclass FY_IMChatTests: XCTestCase {\n\n    override func setUp() {\n        // Put setup code here. This method is called before the invocation of each test method in the class.\n    }\n\n    override func tearDown() {\n        // Put teardown code here. This method is called after the invocation of each test method in the class.\n    }\n\n    func testExample() {\n        // This is an example of a functional test case.\n        // Use XCTAssert and related functions to verify your tests produce the correct results.\n    }\n\n    func testPerformanceExample() {\n        // This is an example of a performance test case.\n        self.measure {\n            // Put the code you want to measure the time of here.\n        }\n    }\n\n}\n"
  },
  {
    "path": "JetChat/FY-IMChatTests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/FY-IMChatUITests/FY_IMChatUITests.swift",
    "content": "//\n//  MK_LWalletUITests.swift\n//  FY-JetChatUITests\n//\n//  Created by iOS.Jet on 2019/2/27.\n//  Copyright © 2019 Jett.Jet. All rights reserved.\n//\n\nimport XCTest\n\nclass FY_IMChatUITests: XCTestCase {\n\n    override func setUp() {\n        // Put setup code here. This method is called before the invocation of each test method in the class.\n\n        // In UI tests it is usually best to stop immediately when a failure occurs.\n        continueAfterFailure = false\n\n        // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.\n        XCUIApplication().launch()\n\n        // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.\n    }\n\n    override func tearDown() {\n        // Put teardown code here. This method is called after the invocation of each test method in the class.\n    }\n\n    func testExample() {\n        // Use recording to get started writing UI tests.\n        // Use XCTAssert and related functions to verify your tests produce the correct results.\n    }\n\n}\n"
  },
  {
    "path": "JetChat/FY-IMChatUITests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/JetChatWidget/Assets.xcassets/AccentColor.colorset/Contents.json",
    "content": "{\n  \"colors\" : [\n    {\n      \"idiom\" : \"universal\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/JetChatWidget/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"3x\",\n      \"size\" : \"60x60\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x20\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"29x29\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"40x40\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"1x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"76x76\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"scale\" : \"2x\",\n      \"size\" : \"83.5x83.5\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"scale\" : \"1x\",\n      \"size\" : \"1024x1024\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/JetChatWidget/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/JetChatWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json",
    "content": "{\n  \"colors\" : [\n    {\n      \"idiom\" : \"universal\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/JetChatWidget/Assets.xcassets/icon_widget_bg.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"filename\" : \"icon_widget_bg.png\",\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "JetChat/JetChatWidget/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSExtension</key>\n\t<dict>\n\t\t<key>NSExtensionPointIdentifier</key>\n\t\t<string>com.apple.widgetkit-extension</string>\n\t</dict>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/JetChatWidget/JetChatWidget.intentdefinition",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>INEnums</key>\n\t<array/>\n\t<key>INIntentDefinitionModelVersion</key>\n\t<string>1.2</string>\n\t<key>INIntentDefinitionNamespace</key>\n\t<string>88xZPY</string>\n\t<key>INIntentDefinitionSystemVersion</key>\n\t<string>21E258</string>\n\t<key>INIntentDefinitionToolsBuildVersion</key>\n\t<string>13E500a</string>\n\t<key>INIntentDefinitionToolsVersion</key>\n\t<string>13.3.1</string>\n\t<key>INIntents</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>INIntentCategory</key>\n\t\t\t<string>information</string>\n\t\t\t<key>INIntentClassPrefix</key>\n\t\t\t<string>FY</string>\n\t\t\t<key>INIntentDescriptionID</key>\n\t\t\t<string>tVvJ9c</string>\n\t\t\t<key>INIntentEligibleForWidgets</key>\n\t\t\t<true/>\n\t\t\t<key>INIntentIneligibleForSuggestions</key>\n\t\t\t<true/>\n\t\t\t<key>INIntentLastParameterTag</key>\n\t\t\t<integer>1</integer>\n\t\t\t<key>INIntentName</key>\n\t\t\t<string>Configuration</string>\n\t\t\t<key>INIntentResponse</key>\n\t\t\t<dict>\n\t\t\t\t<key>INIntentResponseCodes</key>\n\t\t\t\t<array>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>INIntentResponseCodeName</key>\n\t\t\t\t\t\t<string>success</string>\n\t\t\t\t\t\t<key>INIntentResponseCodeSuccess</key>\n\t\t\t\t\t\t<true/>\n\t\t\t\t\t</dict>\n\t\t\t\t\t<dict>\n\t\t\t\t\t\t<key>INIntentResponseCodeName</key>\n\t\t\t\t\t\t<string>failure</string>\n\t\t\t\t\t</dict>\n\t\t\t\t</array>\n\t\t\t</dict>\n\t\t\t<key>INIntentTitle</key>\n\t\t\t<string>Configuration</string>\n\t\t\t<key>INIntentTitleID</key>\n\t\t\t<string>gpCwrM</string>\n\t\t\t<key>INIntentType</key>\n\t\t\t<string>Custom</string>\n\t\t\t<key>INIntentVerb</key>\n\t\t\t<string>View</string>\n\t\t</dict>\n\t</array>\n\t<key>INTypes</key>\n\t<array/>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/JetChatWidget/JetChatWidget.swift",
    "content": "//\n//  JetChatWidget.swift\n//  JetChatWidget\n//\n//  Created by Jett on 2022/5/7.\n//  Copyright © 2022 Jett. All rights reserved.\n//\n\nimport WidgetKit\nimport SwiftUI\nimport Intents\n\nstruct Provider: IntentTimelineProvider {\n    func placeholder(in context: Context) -> SimpleEntry {\n        SimpleEntry(date: Date(), object: \"\" , configuration: FYConfigurationIntent())\n    }\n\n    func getSnapshot(for configuration: FYConfigurationIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) {\n        let entry = SimpleEntry(date: Date(), object: \"\",  configuration: configuration)\n        completion(entry)\n    }\n\n    func getTimeline(for configuration: FYConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {\n        var entries: [SimpleEntry] = []\n\n        // Generate a timeline consisting of five entries an hour apart, starting from the current date.\n        let currentDate = Date()\n        for hourOffset in 0 ..< 5 {\n            let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!\n            let entry = SimpleEntry(date: entryDate, object: \"\", configuration: configuration)\n            entries.append(entry)\n        }\n\n        let timeline = Timeline(entries: entries, policy: .atEnd)\n        completion(timeline)\n    }\n}\n\nstruct SimpleEntry: TimelineEntry {\n    let date: Date\n    let object: Any\n    let configuration: FYConfigurationIntent\n}\n\n// 读取最近聊天消息\nfunc readWidgetMessageItem(_ widgetKey: String = \"widgetKey\", suiteName: String = \"group.com.jetchat.2022.JetChatWidget\") -> WidgetMsgItem? {\n    let userDefaults = UserDefaults(suiteName: suiteName)\n    if let object = userDefaults?.object(forKey: widgetKey) {\n        // 将objc转成data\n        let data: Data = try! JSONSerialization.data(withJSONObject: object, options: .fragmentsAllowed)\n        // 将data转成相应模型\n        let decoder = JSONDecoder()\n        do {\n            let msgItem = try decoder.decode(WidgetMsgItem.self, from: data)\n            return msgItem\n        } catch {\n            print(\"Got error while parsing: \\(error)\")\n            return nil\n        }\n    }\n    return nil\n}\n\n//从UserDefault中取值\nfunc fileSimpleModel(_ entryDate: Date) -> SimpleEntry\n{\n    if let object = readWidgetMessageItem() {\n        return SimpleEntry(date: entryDate, object: object, configuration: .init())\n    }\n    return SimpleEntry(date: entryDate, object: WidgetMsgItem(), configuration: .init())\n}\n\nstruct JetChatWidgetEntryView : View {\n    var entry: Provider.Entry\n    \n    let msgItem = fileSimpleModel(.now).object as! WidgetMsgItem\n    \n    var body: some View {\n        VStack(alignment: .leading, spacing: 0) {\n            Text(\"最近聊天\")\n                .foregroundColor(Color.green)\n                .font(.system(size: 20))\n                .padding(EdgeInsets(top:10, leading: 15, bottom: 10, trailing: 15))\n            \n            Text(msgItem.date)\n                .foregroundColor(Color.white)\n                .lineLimit(1)\n                .font(.system(size: 14))\n                .padding(EdgeInsets(top: 5, leading: 15, bottom: 5, trailing: 15))\n            \n            Text(\"\\(msgItem.nickName ?? msgItem.name)：\\(msgItem.message)\")\n                .foregroundColor(Color.white)\n                .lineLimit(4)\n                .font(.system(size: 13))\n                .padding(EdgeInsets(top:10, leading: 15, bottom: 5, trailing: 15))\n            \n        }.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .leading)\n            .padding(5)\n            //widget背景图片\n            .background(\n                Image(\"icon_widget_bg\")\n                    .scaledToFill()\n            ).widgetURL(URL(string: String(format: \"https://www.jetchat.com/chatId=%ld\", msgItem.chatId ?? -1)))\n\n    }\n}\n\n@main\nstruct JetChatWidget: Widget {\n    let kind: String = \"JetChatWidget\"\n\n    var body: some WidgetConfiguration {\n        IntentConfiguration(kind: kind, intent: FYConfigurationIntent.self, provider: Provider()) { entry in\n            JetChatWidgetEntryView(entry: entry)\n        }\n        .configurationDisplayName(\"JetChat Widget\")\n        .description(\"This is an jetchat widget.\")\n    }\n}\n\nstruct JetChatWidget_Previews: PreviewProvider {\n    static var previews: some View {\n        JetChatWidgetEntryView(entry: SimpleEntry(date: Date(), object: \"\", configuration: FYConfigurationIntent()))\n            .previewContext(WidgetPreviewContext(family: .systemSmall))\n    }\n}\n\nstruct WidgetMsgItem: Codable {\n    /// 聊天会话id\n    var chatId: Int?\n    /// 用户名\n    var name: String = \"\"\n    /// 最近消息\n    var message: String = \"\"\n    /// 消息发送时间\n    var date: String = \"\"\n    /// 昵称备注名称\n    var nickName: String? = \"\"\n}\n"
  },
  {
    "path": "JetChat/JetChatWidgetExtension.entitlements",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>com.apple.security.application-groups</key>\n\t<array>\n\t\t<string>group.com.jetchat.2022.JetChatWidget</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Podfile",
    "content": "# Uncomment the next line to define a global platform for your project\n# platform :ios, '9.0'\n\ntarget 'FY-IMChat' do\n  # Comment the next line if you don't want to use dynamic frameworks\n  use_frameworks!\n\n  # *********************************************** Swift ***********************************************\n\n\tpod 'SwiftyJSON'\n\tpod 'SnapKit'\n\tpod 'RxSwift'\n\tpod 'RxCocoa'\n\tpod 'RxTheme'\n\tpod 'NSObject+Rx'\n\tpod 'Moya/RxSwift'\n\tpod 'HandyJSON'\n\tpod 'ReachabilitySwift'\n\tpod 'Localize-Swift'\n\tpod 'Kingfisher'\n\tpod 'R.swift'\n\tpod 'WCDB.swift' #本地数据库缓存\n\tpod 'SwifterSwift'\n\tpod 'SwiftDate'\n  \n\n  # *********************************************** Objective-C ***********************************************\n\n\tpod 'UIView+FDCollapsibleConstraints'\n\tpod 'FDFullscreenPopGesture', '1.1'\n\tpod 'UITableView+FDTemplateLayoutCell'\n\tpod 'TZImagePickerController'\n\tpod 'IQKeyboardManagerSwift'\n\tpod 'MBProgressHUD'\n\tpod 'MJRefresh'\n\tpod 'YBImageBrowser'\n\tpod 'YBImageBrowser/Video'\n\tpod 'LookinServer', :configurations => ['Debug'] #UI层级调试\n\tpod 'IGListKit' #朋友圈列表布局\n \tpod 'YYText'\n     \nend\n\n\n\npost_install do |installer|\n    installer.pods_project.targets.each do |target|\n        target.build_configurations.each do |config|\n            config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'\n        end\n    end\nend\n\n\ninstall! 'cocoapods',\n          disable_input_output_paths: true,\n          generate_multiple_pod_projects: true\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/LICENSE",
    "content": "Copyright (c) 2014-2022 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/README.md",
    "content": "![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/master/Resources/AlamofireLogo.png)\n\n[![Swift](https://img.shields.io/badge/Swift-5.3_5.4_5.5_5.6-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.3_5.4_5.5_5.6-Orange?style=flat-square)\n[![Platforms](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_Linux_Windows-yellowgreen?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_Linux_Windows-Green?style=flat-square)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg?style=flat-square)](https://img.shields.io/cocoapods/v/Alamofire.svg)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat-square)](https://github.com/Carthage/Carthage)\n[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)\n[![Twitter](https://img.shields.io/badge/twitter-@AlamofireSF-blue.svg?style=flat-square)](https://twitter.com/AlamofireSF)\n[![Swift Forums](https://img.shields.io/badge/Swift_Forums-Alamofire-orange?style=flat-square)](https://forums.swift.org/c/related-projects/alamofire/37)\n\nAlamofire is an HTTP networking library written in Swift.\n\n- [Features](#features)\n- [Component Libraries](#component-libraries)\n- [Requirements](#requirements)\n- [Migration Guides](#migration-guides)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Contributing](#contributing)\n- [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#using-alamofire)\n  - [**Introduction -**](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#introduction) [Making Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-requests), [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling), [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation), [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching)\n  - **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods), [Parameters and Parameter Encoder](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md##request-parameters-and-parameter-encoders), [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers), [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication)\n  - **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file), [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server)\n  - **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics), [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output)\n- [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md)\n  - **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session), [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#sessiondelegate), [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request)\n  - **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests), [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests-with-requestinterceptor)\n  - **Model Objects -** [Custom Response Handlers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#customizing-response-handlers)\n  - **Advanced Concurrency -** [Swift Concurrency](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-swift-concurrency) and [Combine](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#using-alamofire-with-combine)\n  - **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security), [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability)\n- [Open Radars](#open-radars)\n- [FAQ](#faq)\n- [Credits](#credits)\n- [Donations](#donations)\n- [License](#license)\n\n## Features\n\n- [x] Chainable Request / Response Methods\n- [x] Swift Concurrency Support Back to iOS 13, macOS 10.15, tvOS 13, and watchOS 6.\n- [x] Combine Support\n- [x] URL / JSON Parameter Encoding\n- [x] Upload File / Data / Stream / MultipartFormData\n- [x] Download File using Request or Resume Data\n- [x] Authentication with `URLCredential`\n- [x] HTTP Response Validation\n- [x] Upload and Download Progress Closures with Progress\n- [x] cURL Command Output\n- [x] Dynamically Adapt and Retry Requests\n- [x] TLS Certificate and Public Key Pinning\n- [x] Network Reachability\n- [x] Comprehensive Unit and Integration Test Coverage\n- [x] [Complete Documentation](https://alamofire.github.io/Alamofire)\n\n## Component Libraries\n\nIn order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem.\n\n- [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache, and a priority-based image downloading system.\n- [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire.\n\n## Requirements\n\n| Platform | Minimum Swift Version | Installation | Status |\n| --- | --- | --- | --- |\n| iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 5.3 | [CocoaPods](#cocoapods), [Carthage](#carthage), [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |\n| Linux | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |\n| Windows | Latest Only | [Swift Package Manager](#swift-package-manager) | Building But Unsupported |\n\n#### Known Issues on Linux and Windows\n\nAlamofire builds on Linux and Windows but there are missing features and many issues in the underlying `swift-corelibs-foundation` that prevent full functionality and may cause crashes. These include:\n- `ServerTrustManager` and associated certificate functionality is unavailable, so there is no certificate pinning and no client certificate support.\n- Various methods of HTTP authentication may crash, including HTTP Basic and HTTP Digest. Crashes may occur if responses contain server challenges.\n- Cache control through `CachedResponseHandler` and associated APIs is unavailable, as the underlying delegate methods aren't called.\n- `URLSessionTaskMetrics` are never gathered.\n\nDue to these issues, Alamofire is unsupported on Linux and Windows. Please report any crashes to the [Swift bug reporter](https://bugs.swift.org).\n\n## Migration Guides\n\n- [Alamofire 5.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%205.0%20Migration%20Guide.md)\n- [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md)\n- [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md)\n- [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md)\n\n## Communication\n- If you **need help with making network requests** using Alamofire, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire) and tag `alamofire`.\n- If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/) or [Apple's documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system), on top of which Alamofire is built.\n- If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire).\n- If you'd like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire).\n- If you'd like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire). \n- If you **found a bug**, open an issue here on GitHub and follow the guide. The more detail the better!\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'Alamofire'\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"Alamofire/Alamofire\"\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. \n\nOnce you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/Alamofire/Alamofire.git\", .upToNextMajor(from: \"5.6.1\"))\n]\n```\n\n### Manually\n\nIf you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually.\n\n#### Embedded Framework\n\n- Open up Terminal, `cd` into your top-level project directory, and run the following command \"if\" your project is not initialized as a git repository:\n\n  ```bash\n  $ git init\n  ```\n\n- Add Alamofire as a git [submodule](https://git-scm.com/docs/git-submodule) by running the following command:\n\n  ```bash\n  $ git submodule add https://github.com/Alamofire/Alamofire.git\n  ```\n\n- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project.\n\n    > It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.\n\n- Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.\n- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the \"Targets\" heading in the sidebar.\n- In the tab bar at the top of that window, open the \"General\" panel.\n- Click on the `+` button under the \"Embedded Binaries\" section.\n- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder.\n\n    > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`.\n\n- Select the top `Alamofire.framework` for iOS and the bottom one for macOS.\n\n    > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS`, or `Alamofire watchOS`.\n\n- And that's it!\n\n  > The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.\n\n## Contributing\n\nBefore contributing to Alamofire, please read the instructions detailed in our [contribution guide](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md).\n\n## Open Radars\n\nThe following radars have some effect on the current implementation of Alamofire.\n\n- [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in the test case\n- `rdar://26870455` - Background URL Session Configurations do not work in the simulator\n- `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest`\n\n## Resolved Radars\n\nThe following radars have been resolved over time after being filed against the Alamofire project.\n\n- [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage.\n  - (Resolved): 9/1/17 in Xcode 9 beta 6.\n- [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+\n  - (Resolved): Just add `CFNetwork` to your linked frameworks.\n- `FB7624529` - `urlSession(_:task:didFinishCollecting:)` never called on watchOS\n  - (Resolved): Metrics now collected on watchOS 7+.\n\n## FAQ\n\n### What's the origin of the name Alamofire?\n\nAlamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html), a hybrid variant of the Bluebonnet, the official state flower of Texas.\n\n## Credits\n\nAlamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org). You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases.\n\n### Security Disclosure\n\nIf you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker.\n\n## Sponsorship\n\nThe [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially stay registered as a federal non-profit organization.\nRegistering will allow Foundation members to gain some legal protections and also allow us to put donations to use, tax-free.\nSponsoring the ASF will enable us to:\n\n- Pay our yearly legal fees to keep the non-profit in good status\n- Pay for our mail servers to help us stay on top of all questions and security issues\n- Potentially fund test servers to make it easier for us to test the edge cases\n- Potentially fund developers to work on one of our projects full-time\n\nThe community adoption of the ASF libraries has been amazing.\nWe are greatly humbled by your enthusiasm around the projects and want to continue to do everything we can to move the needle forward.\nWith your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members.\nIf you use any of our libraries for work, see if your employers would be interested in donating.\nAny amount you can donate, whether once or monthly, to help us reach our goal would be greatly appreciated.\n\n[Sponsor Alamofire](https://github.com/sponsors/Alamofire)\n\n## Supporters\n\n[MacStadium](https://macstadium.com) provides Alamofire with a free, hosted Mac mini.\n\n![Powered by MacStadium](https://raw.githubusercontent.com/Alamofire/Alamofire/master/Resources/MacStadiumLogo.png)\n\n## License\n\nAlamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE) for details.\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/AFError.swift",
    "content": "//\n//  AFError.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with\n/// their own associated reasons.\npublic enum AFError: Error {\n    /// The underlying reason the `.multipartEncodingFailed` error occurred.\n    public enum MultipartEncodingFailureReason {\n        /// The `fileURL` provided for reading an encodable body part isn't a file `URL`.\n        case bodyPartURLInvalid(url: URL)\n        /// The filename of the `fileURL` provided has either an empty `lastPathComponent` or `pathExtension.\n        case bodyPartFilenameInvalid(in: URL)\n        /// The file at the `fileURL` provided was not reachable.\n        case bodyPartFileNotReachable(at: URL)\n        /// Attempting to check the reachability of the `fileURL` provided threw an error.\n        case bodyPartFileNotReachableWithError(atURL: URL, error: Error)\n        /// The file at the `fileURL` provided is actually a directory.\n        case bodyPartFileIsDirectory(at: URL)\n        /// The size of the file at the `fileURL` provided was not returned by the system.\n        case bodyPartFileSizeNotAvailable(at: URL)\n        /// The attempt to find the size of the file at the `fileURL` provided threw an error.\n        case bodyPartFileSizeQueryFailedWithError(forURL: URL, error: Error)\n        /// An `InputStream` could not be created for the provided `fileURL`.\n        case bodyPartInputStreamCreationFailed(for: URL)\n        /// An `OutputStream` could not be created when attempting to write the encoded data to disk.\n        case outputStreamCreationFailed(for: URL)\n        /// The encoded body data could not be written to disk because a file already exists at the provided `fileURL`.\n        case outputStreamFileAlreadyExists(at: URL)\n        /// The `fileURL` provided for writing the encoded body data to disk is not a file `URL`.\n        case outputStreamURLInvalid(url: URL)\n        /// The attempt to write the encoded body data to disk failed with an underlying error.\n        case outputStreamWriteFailed(error: Error)\n        /// The attempt to read an encoded body part `InputStream` failed with underlying system error.\n        case inputStreamReadFailed(error: Error)\n    }\n\n    /// Represents unexpected input stream length that occur when encoding the `MultipartFormData`. Instances will be\n    /// embedded within an `AFError.multipartEncodingFailed` `.inputStreamReadFailed` case.\n    public struct UnexpectedInputStreamLength: Error {\n        /// The expected byte count to read.\n        public var bytesExpected: UInt64\n        /// The actual byte count read.\n        public var bytesRead: UInt64\n    }\n\n    /// The underlying reason the `.parameterEncodingFailed` error occurred.\n    public enum ParameterEncodingFailureReason {\n        /// The `URLRequest` did not have a `URL` to encode.\n        case missingURL\n        /// JSON serialization failed with an underlying system error during the encoding process.\n        case jsonEncodingFailed(error: Error)\n        /// Custom parameter encoding failed due to the associated `Error`.\n        case customEncodingFailed(error: Error)\n    }\n\n    /// The underlying reason the `.parameterEncoderFailed` error occurred.\n    public enum ParameterEncoderFailureReason {\n        /// Possible missing components.\n        public enum RequiredComponent {\n            /// The `URL` was missing or unable to be extracted from the passed `URLRequest` or during encoding.\n            case url\n            /// The `HTTPMethod` could not be extracted from the passed `URLRequest`.\n            case httpMethod(rawValue: String)\n        }\n\n        /// A `RequiredComponent` was missing during encoding.\n        case missingRequiredComponent(RequiredComponent)\n        /// The underlying encoder failed with the associated error.\n        case encoderFailed(error: Error)\n    }\n\n    /// The underlying reason the `.responseValidationFailed` error occurred.\n    public enum ResponseValidationFailureReason {\n        /// The data file containing the server response did not exist.\n        case dataFileNil\n        /// The data file containing the server response at the associated `URL` could not be read.\n        case dataFileReadFailed(at: URL)\n        /// The response did not contain a `Content-Type` and the `acceptableContentTypes` provided did not contain a\n        /// wildcard type.\n        case missingContentType(acceptableContentTypes: [String])\n        /// The response `Content-Type` did not match any type in the provided `acceptableContentTypes`.\n        case unacceptableContentType(acceptableContentTypes: [String], responseContentType: String)\n        /// The response status code was not acceptable.\n        case unacceptableStatusCode(code: Int)\n        /// Custom response validation failed due to the associated `Error`.\n        case customValidationFailed(error: Error)\n    }\n\n    /// The underlying reason the response serialization error occurred.\n    public enum ResponseSerializationFailureReason {\n        /// The server response contained no data or the data was zero length.\n        case inputDataNilOrZeroLength\n        /// The file containing the server response did not exist.\n        case inputFileNil\n        /// The file containing the server response could not be read from the associated `URL`.\n        case inputFileReadFailed(at: URL)\n        /// String serialization failed using the provided `String.Encoding`.\n        case stringSerializationFailed(encoding: String.Encoding)\n        /// JSON serialization failed with an underlying system error.\n        case jsonSerializationFailed(error: Error)\n        /// A `DataDecoder` failed to decode the response due to the associated `Error`.\n        case decodingFailed(error: Error)\n        /// A custom response serializer failed due to the associated `Error`.\n        case customSerializationFailed(error: Error)\n        /// Generic serialization failed for an empty response that wasn't type `Empty` but instead the associated type.\n        case invalidEmptyResponse(type: String)\n    }\n\n    #if !(os(Linux) || os(Windows))\n    /// Underlying reason a server trust evaluation error occurred.\n    public enum ServerTrustFailureReason {\n        /// The output of a server trust evaluation.\n        public struct Output {\n            /// The host for which the evaluation was performed.\n            public let host: String\n            /// The `SecTrust` value which was evaluated.\n            public let trust: SecTrust\n            /// The `OSStatus` of evaluation operation.\n            public let status: OSStatus\n            /// The result of the evaluation operation.\n            public let result: SecTrustResultType\n\n            /// Creates an `Output` value from the provided values.\n            init(_ host: String, _ trust: SecTrust, _ status: OSStatus, _ result: SecTrustResultType) {\n                self.host = host\n                self.trust = trust\n                self.status = status\n                self.result = result\n            }\n        }\n\n        /// No `ServerTrustEvaluator` was found for the associated host.\n        case noRequiredEvaluator(host: String)\n        /// No certificates were found with which to perform the trust evaluation.\n        case noCertificatesFound\n        /// No public keys were found with which to perform the trust evaluation.\n        case noPublicKeysFound\n        /// During evaluation, application of the associated `SecPolicy` failed.\n        case policyApplicationFailed(trust: SecTrust, policy: SecPolicy, status: OSStatus)\n        /// During evaluation, setting the associated anchor certificates failed.\n        case settingAnchorCertificatesFailed(status: OSStatus, certificates: [SecCertificate])\n        /// During evaluation, creation of the revocation policy failed.\n        case revocationPolicyCreationFailed\n        /// `SecTrust` evaluation failed with the associated `Error`, if one was produced.\n        case trustEvaluationFailed(error: Error?)\n        /// Default evaluation failed with the associated `Output`.\n        case defaultEvaluationFailed(output: Output)\n        /// Host validation failed with the associated `Output`.\n        case hostValidationFailed(output: Output)\n        /// Revocation check failed with the associated `Output` and options.\n        case revocationCheckFailed(output: Output, options: RevocationTrustEvaluator.Options)\n        /// Certificate pinning failed.\n        case certificatePinningFailed(host: String, trust: SecTrust, pinnedCertificates: [SecCertificate], serverCertificates: [SecCertificate])\n        /// Public key pinning failed.\n        case publicKeyPinningFailed(host: String, trust: SecTrust, pinnedKeys: [SecKey], serverKeys: [SecKey])\n        /// Custom server trust evaluation failed due to the associated `Error`.\n        case customEvaluationFailed(error: Error)\n    }\n    #endif\n\n    /// The underlying reason the `.urlRequestValidationFailed`\n    public enum URLRequestValidationFailureReason {\n        /// URLRequest with GET method had body data.\n        case bodyDataInGETRequest(Data)\n    }\n\n    ///  `UploadableConvertible` threw an error in `createUploadable()`.\n    case createUploadableFailed(error: Error)\n    ///  `URLRequestConvertible` threw an error in `asURLRequest()`.\n    case createURLRequestFailed(error: Error)\n    /// `SessionDelegate` threw an error while attempting to move downloaded file to destination URL.\n    case downloadedFileMoveFailed(error: Error, source: URL, destination: URL)\n    /// `Request` was explicitly cancelled.\n    case explicitlyCancelled\n    /// `URLConvertible` type failed to create a valid `URL`.\n    case invalidURL(url: URLConvertible)\n    /// Multipart form encoding failed.\n    case multipartEncodingFailed(reason: MultipartEncodingFailureReason)\n    /// `ParameterEncoding` threw an error during the encoding process.\n    case parameterEncodingFailed(reason: ParameterEncodingFailureReason)\n    /// `ParameterEncoder` threw an error while running the encoder.\n    case parameterEncoderFailed(reason: ParameterEncoderFailureReason)\n    /// `RequestAdapter` threw an error during adaptation.\n    case requestAdaptationFailed(error: Error)\n    /// `RequestRetrier` threw an error during the request retry process.\n    case requestRetryFailed(retryError: Error, originalError: Error)\n    /// Response validation failed.\n    case responseValidationFailed(reason: ResponseValidationFailureReason)\n    /// Response serialization failed.\n    case responseSerializationFailed(reason: ResponseSerializationFailureReason)\n    #if !(os(Linux) || os(Windows))\n    /// `ServerTrustEvaluating` instance threw an error during trust evaluation.\n    case serverTrustEvaluationFailed(reason: ServerTrustFailureReason)\n    #endif\n    /// `Session` which issued the `Request` was deinitialized, most likely because its reference went out of scope.\n    case sessionDeinitialized\n    /// `Session` was explicitly invalidated, possibly with the `Error` produced by the underlying `URLSession`.\n    case sessionInvalidated(error: Error?)\n    /// `URLSessionTask` completed with error.\n    case sessionTaskFailed(error: Error)\n    /// `URLRequest` failed validation.\n    case urlRequestValidationFailed(reason: URLRequestValidationFailureReason)\n}\n\nextension Error {\n    /// Returns the instance cast as an `AFError`.\n    public var asAFError: AFError? {\n        self as? AFError\n    }\n\n    /// Returns the instance cast as an `AFError`. If casting fails, a `fatalError` with the specified `message` is thrown.\n    public func asAFError(orFailWith message: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> AFError {\n        guard let afError = self as? AFError else {\n            fatalError(message(), file: file, line: line)\n        }\n        return afError\n    }\n\n    /// Casts the instance as `AFError` or returns `defaultAFError`\n    func asAFError(or defaultAFError: @autoclosure () -> AFError) -> AFError {\n        self as? AFError ?? defaultAFError()\n    }\n}\n\n// MARK: - Error Booleans\n\nextension AFError {\n    /// Returns whether the instance is `.sessionDeinitialized`.\n    public var isSessionDeinitializedError: Bool {\n        if case .sessionDeinitialized = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.sessionInvalidated`.\n    public var isSessionInvalidatedError: Bool {\n        if case .sessionInvalidated = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.explicitlyCancelled`.\n    public var isExplicitlyCancelledError: Bool {\n        if case .explicitlyCancelled = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.invalidURL`.\n    public var isInvalidURLError: Bool {\n        if case .invalidURL = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.parameterEncodingFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isParameterEncodingError: Bool {\n        if case .parameterEncodingFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.parameterEncoderFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isParameterEncoderError: Bool {\n        if case .parameterEncoderFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.multipartEncodingFailed`. When `true`, the `url` and `underlyingError`\n    /// properties will contain the associated values.\n    public var isMultipartEncodingError: Bool {\n        if case .multipartEncodingFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.requestAdaptationFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isRequestAdaptationError: Bool {\n        if case .requestAdaptationFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.responseValidationFailed`. When `true`, the `acceptableContentTypes`,\n    /// `responseContentType`,  `responseCode`, and `underlyingError` properties will contain the associated values.\n    public var isResponseValidationError: Bool {\n        if case .responseValidationFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.responseSerializationFailed`. When `true`, the `failedStringEncoding` and\n    /// `underlyingError` properties will contain the associated values.\n    public var isResponseSerializationError: Bool {\n        if case .responseSerializationFailed = self { return true }\n        return false\n    }\n\n    #if !(os(Linux) || os(Windows))\n    /// Returns whether the instance is `.serverTrustEvaluationFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isServerTrustEvaluationError: Bool {\n        if case .serverTrustEvaluationFailed = self { return true }\n        return false\n    }\n    #endif\n\n    /// Returns whether the instance is `requestRetryFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isRequestRetryError: Bool {\n        if case .requestRetryFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `createUploadableFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isCreateUploadableError: Bool {\n        if case .createUploadableFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isCreateURLRequestError: Bool {\n        if case .createURLRequestFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `downloadedFileMoveFailed`. When `true`, the `destination` and `underlyingError` properties will\n    /// contain the associated values.\n    public var isDownloadedFileMoveError: Bool {\n        if case .downloadedFileMoveFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isSessionTaskError: Bool {\n        if case .sessionTaskFailed = self { return true }\n        return false\n    }\n}\n\n// MARK: - Convenience Properties\n\nextension AFError {\n    /// The `URLConvertible` associated with the error.\n    public var urlConvertible: URLConvertible? {\n        guard case let .invalidURL(url) = self else { return nil }\n        return url\n    }\n\n    /// The `URL` associated with the error.\n    public var url: URL? {\n        guard case let .multipartEncodingFailed(reason) = self else { return nil }\n        return reason.url\n    }\n\n    /// The underlying `Error` responsible for generating the failure associated with `.sessionInvalidated`,\n    /// `.parameterEncodingFailed`, `.parameterEncoderFailed`, `.multipartEncodingFailed`, `.requestAdaptationFailed`,\n    /// `.responseSerializationFailed`, `.requestRetryFailed` errors.\n    public var underlyingError: Error? {\n        switch self {\n        case let .multipartEncodingFailed(reason):\n            return reason.underlyingError\n        case let .parameterEncodingFailed(reason):\n            return reason.underlyingError\n        case let .parameterEncoderFailed(reason):\n            return reason.underlyingError\n        case let .requestAdaptationFailed(error):\n            return error\n        case let .requestRetryFailed(retryError, _):\n            return retryError\n        case let .responseValidationFailed(reason):\n            return reason.underlyingError\n        case let .responseSerializationFailed(reason):\n            return reason.underlyingError\n        #if !(os(Linux) || os(Windows))\n        case let .serverTrustEvaluationFailed(reason):\n            return reason.underlyingError\n        #endif\n        case let .sessionInvalidated(error):\n            return error\n        case let .createUploadableFailed(error):\n            return error\n        case let .createURLRequestFailed(error):\n            return error\n        case let .downloadedFileMoveFailed(error, _, _):\n            return error\n        case let .sessionTaskFailed(error):\n            return error\n        case .explicitlyCancelled,\n             .invalidURL,\n             .sessionDeinitialized,\n             .urlRequestValidationFailed:\n            return nil\n        }\n    }\n\n    /// The acceptable `Content-Type`s of a `.responseValidationFailed` error.\n    public var acceptableContentTypes: [String]? {\n        guard case let .responseValidationFailed(reason) = self else { return nil }\n        return reason.acceptableContentTypes\n    }\n\n    /// The response `Content-Type` of a `.responseValidationFailed` error.\n    public var responseContentType: String? {\n        guard case let .responseValidationFailed(reason) = self else { return nil }\n        return reason.responseContentType\n    }\n\n    /// The response code of a `.responseValidationFailed` error.\n    public var responseCode: Int? {\n        guard case let .responseValidationFailed(reason) = self else { return nil }\n        return reason.responseCode\n    }\n\n    /// The `String.Encoding` associated with a failed `.stringResponse()` call.\n    public var failedStringEncoding: String.Encoding? {\n        guard case let .responseSerializationFailed(reason) = self else { return nil }\n        return reason.failedStringEncoding\n    }\n\n    /// The `source` URL of a `.downloadedFileMoveFailed` error.\n    public var sourceURL: URL? {\n        guard case let .downloadedFileMoveFailed(_, source, _) = self else { return nil }\n        return source\n    }\n\n    /// The `destination` URL of a `.downloadedFileMoveFailed` error.\n    public var destinationURL: URL? {\n        guard case let .downloadedFileMoveFailed(_, _, destination) = self else { return nil }\n        return destination\n    }\n\n    #if !(os(Linux) || os(Windows))\n    /// The download resume data of any underlying network error. Only produced by `DownloadRequest`s.\n    public var downloadResumeData: Data? {\n        (underlyingError as? URLError)?.userInfo[NSURLSessionDownloadTaskResumeData] as? Data\n    }\n    #endif\n}\n\nextension AFError.ParameterEncodingFailureReason {\n    var underlyingError: Error? {\n        switch self {\n        case let .jsonEncodingFailed(error),\n             let .customEncodingFailed(error):\n            return error\n        case .missingURL:\n            return nil\n        }\n    }\n}\n\nextension AFError.ParameterEncoderFailureReason {\n    var underlyingError: Error? {\n        switch self {\n        case let .encoderFailed(error):\n            return error\n        case .missingRequiredComponent:\n            return nil\n        }\n    }\n}\n\nextension AFError.MultipartEncodingFailureReason {\n    var url: URL? {\n        switch self {\n        case let .bodyPartURLInvalid(url),\n             let .bodyPartFilenameInvalid(url),\n             let .bodyPartFileNotReachable(url),\n             let .bodyPartFileIsDirectory(url),\n             let .bodyPartFileSizeNotAvailable(url),\n             let .bodyPartInputStreamCreationFailed(url),\n             let .outputStreamCreationFailed(url),\n             let .outputStreamFileAlreadyExists(url),\n             let .outputStreamURLInvalid(url),\n             let .bodyPartFileNotReachableWithError(url, _),\n             let .bodyPartFileSizeQueryFailedWithError(url, _):\n            return url\n        case .outputStreamWriteFailed,\n             .inputStreamReadFailed:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .bodyPartFileNotReachableWithError(_, error),\n             let .bodyPartFileSizeQueryFailedWithError(_, error),\n             let .outputStreamWriteFailed(error),\n             let .inputStreamReadFailed(error):\n            return error\n        case .bodyPartURLInvalid,\n             .bodyPartFilenameInvalid,\n             .bodyPartFileNotReachable,\n             .bodyPartFileIsDirectory,\n             .bodyPartFileSizeNotAvailable,\n             .bodyPartInputStreamCreationFailed,\n             .outputStreamCreationFailed,\n             .outputStreamFileAlreadyExists,\n             .outputStreamURLInvalid:\n            return nil\n        }\n    }\n}\n\nextension AFError.ResponseValidationFailureReason {\n    var acceptableContentTypes: [String]? {\n        switch self {\n        case let .missingContentType(types),\n             let .unacceptableContentType(types, _):\n            return types\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .unacceptableStatusCode,\n             .customValidationFailed:\n            return nil\n        }\n    }\n\n    var responseContentType: String? {\n        switch self {\n        case let .unacceptableContentType(_, responseType):\n            return responseType\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .missingContentType,\n             .unacceptableStatusCode,\n             .customValidationFailed:\n            return nil\n        }\n    }\n\n    var responseCode: Int? {\n        switch self {\n        case let .unacceptableStatusCode(code):\n            return code\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .missingContentType,\n             .unacceptableContentType,\n             .customValidationFailed:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .customValidationFailed(error):\n            return error\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .missingContentType,\n             .unacceptableContentType,\n             .unacceptableStatusCode:\n            return nil\n        }\n    }\n}\n\nextension AFError.ResponseSerializationFailureReason {\n    var failedStringEncoding: String.Encoding? {\n        switch self {\n        case let .stringSerializationFailed(encoding):\n            return encoding\n        case .inputDataNilOrZeroLength,\n             .inputFileNil,\n             .inputFileReadFailed(_),\n             .jsonSerializationFailed(_),\n             .decodingFailed(_),\n             .customSerializationFailed(_),\n             .invalidEmptyResponse:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .jsonSerializationFailed(error),\n             let .decodingFailed(error),\n             let .customSerializationFailed(error):\n            return error\n        case .inputDataNilOrZeroLength,\n             .inputFileNil,\n             .inputFileReadFailed,\n             .stringSerializationFailed,\n             .invalidEmptyResponse:\n            return nil\n        }\n    }\n}\n\n#if !(os(Linux) || os(Windows))\nextension AFError.ServerTrustFailureReason {\n    var output: AFError.ServerTrustFailureReason.Output? {\n        switch self {\n        case let .defaultEvaluationFailed(output),\n             let .hostValidationFailed(output),\n             let .revocationCheckFailed(output, _):\n            return output\n        case .noRequiredEvaluator,\n             .noCertificatesFound,\n             .noPublicKeysFound,\n             .policyApplicationFailed,\n             .settingAnchorCertificatesFailed,\n             .revocationPolicyCreationFailed,\n             .trustEvaluationFailed,\n             .certificatePinningFailed,\n             .publicKeyPinningFailed,\n             .customEvaluationFailed:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .customEvaluationFailed(error):\n            return error\n        case let .trustEvaluationFailed(error):\n            return error\n        case .noRequiredEvaluator,\n             .noCertificatesFound,\n             .noPublicKeysFound,\n             .policyApplicationFailed,\n             .settingAnchorCertificatesFailed,\n             .revocationPolicyCreationFailed,\n             .defaultEvaluationFailed,\n             .hostValidationFailed,\n             .revocationCheckFailed,\n             .certificatePinningFailed,\n             .publicKeyPinningFailed:\n            return nil\n        }\n    }\n}\n#endif\n\n// MARK: - Error Descriptions\n\nextension AFError: LocalizedError {\n    public var errorDescription: String? {\n        switch self {\n        case .explicitlyCancelled:\n            return \"Request explicitly cancelled.\"\n        case let .invalidURL(url):\n            return \"URL is not valid: \\(url)\"\n        case let .parameterEncodingFailed(reason):\n            return reason.localizedDescription\n        case let .parameterEncoderFailed(reason):\n            return reason.localizedDescription\n        case let .multipartEncodingFailed(reason):\n            return reason.localizedDescription\n        case let .requestAdaptationFailed(error):\n            return \"Request adaption failed with error: \\(error.localizedDescription)\"\n        case let .responseValidationFailed(reason):\n            return reason.localizedDescription\n        case let .responseSerializationFailed(reason):\n            return reason.localizedDescription\n        case let .requestRetryFailed(retryError, originalError):\n            return \"\"\"\n            Request retry failed with retry error: \\(retryError.localizedDescription), \\\n            original error: \\(originalError.localizedDescription)\n            \"\"\"\n        case .sessionDeinitialized:\n            return \"\"\"\n            Session was invalidated without error, so it was likely deinitialized unexpectedly. \\\n            Be sure to retain a reference to your Session for the duration of your requests.\n            \"\"\"\n        case let .sessionInvalidated(error):\n            return \"Session was invalidated with error: \\(error?.localizedDescription ?? \"No description.\")\"\n        #if !(os(Linux) || os(Windows))\n        case let .serverTrustEvaluationFailed(reason):\n            return \"Server trust evaluation failed due to reason: \\(reason.localizedDescription)\"\n        #endif\n        case let .urlRequestValidationFailed(reason):\n            return \"URLRequest validation failed due to reason: \\(reason.localizedDescription)\"\n        case let .createUploadableFailed(error):\n            return \"Uploadable creation failed with error: \\(error.localizedDescription)\"\n        case let .createURLRequestFailed(error):\n            return \"URLRequest creation failed with error: \\(error.localizedDescription)\"\n        case let .downloadedFileMoveFailed(error, source, destination):\n            return \"Moving downloaded file from: \\(source) to: \\(destination) failed with error: \\(error.localizedDescription)\"\n        case let .sessionTaskFailed(error):\n            return \"URLSessionTask failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.ParameterEncodingFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case .missingURL:\n            return \"URL request to encode was missing a URL\"\n        case let .jsonEncodingFailed(error):\n            return \"JSON could not be encoded because of error:\\n\\(error.localizedDescription)\"\n        case let .customEncodingFailed(error):\n            return \"Custom parameter encoder failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.ParameterEncoderFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .missingRequiredComponent(component):\n            return \"Encoding failed due to a missing request component: \\(component)\"\n        case let .encoderFailed(error):\n            return \"The underlying encoder failed with the error: \\(error)\"\n        }\n    }\n}\n\nextension AFError.MultipartEncodingFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .bodyPartURLInvalid(url):\n            return \"The URL provided is not a file URL: \\(url)\"\n        case let .bodyPartFilenameInvalid(url):\n            return \"The URL provided does not have a valid filename: \\(url)\"\n        case let .bodyPartFileNotReachable(url):\n            return \"The URL provided is not reachable: \\(url)\"\n        case let .bodyPartFileNotReachableWithError(url, error):\n            return \"\"\"\n            The system returned an error while checking the provided URL for reachability.\n            URL: \\(url)\n            Error: \\(error)\n            \"\"\"\n        case let .bodyPartFileIsDirectory(url):\n            return \"The URL provided is a directory: \\(url)\"\n        case let .bodyPartFileSizeNotAvailable(url):\n            return \"Could not fetch the file size from the provided URL: \\(url)\"\n        case let .bodyPartFileSizeQueryFailedWithError(url, error):\n            return \"\"\"\n            The system returned an error while attempting to fetch the file size from the provided URL.\n            URL: \\(url)\n            Error: \\(error)\n            \"\"\"\n        case let .bodyPartInputStreamCreationFailed(url):\n            return \"Failed to create an InputStream for the provided URL: \\(url)\"\n        case let .outputStreamCreationFailed(url):\n            return \"Failed to create an OutputStream for URL: \\(url)\"\n        case let .outputStreamFileAlreadyExists(url):\n            return \"A file already exists at the provided URL: \\(url)\"\n        case let .outputStreamURLInvalid(url):\n            return \"The provided OutputStream URL is invalid: \\(url)\"\n        case let .outputStreamWriteFailed(error):\n            return \"OutputStream write failed with error: \\(error)\"\n        case let .inputStreamReadFailed(error):\n            return \"InputStream read failed with error: \\(error)\"\n        }\n    }\n}\n\nextension AFError.ResponseSerializationFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case .inputDataNilOrZeroLength:\n            return \"Response could not be serialized, input data was nil or zero length.\"\n        case .inputFileNil:\n            return \"Response could not be serialized, input file was nil.\"\n        case let .inputFileReadFailed(url):\n            return \"Response could not be serialized, input file could not be read: \\(url).\"\n        case let .stringSerializationFailed(encoding):\n            return \"String could not be serialized with encoding: \\(encoding).\"\n        case let .jsonSerializationFailed(error):\n            return \"JSON could not be serialized because of error:\\n\\(error.localizedDescription)\"\n        case let .invalidEmptyResponse(type):\n            return \"\"\"\n            Empty response could not be serialized to type: \\(type). \\\n            Use Empty as the expected type for such responses.\n            \"\"\"\n        case let .decodingFailed(error):\n            return \"Response could not be decoded because of error:\\n\\(error.localizedDescription)\"\n        case let .customSerializationFailed(error):\n            return \"Custom response serializer failed with error:\\n\\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.ResponseValidationFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case .dataFileNil:\n            return \"Response could not be validated, data file was nil.\"\n        case let .dataFileReadFailed(url):\n            return \"Response could not be validated, data file could not be read: \\(url).\"\n        case let .missingContentType(types):\n            return \"\"\"\n            Response Content-Type was missing and acceptable content types \\\n            (\\(types.joined(separator: \",\"))) do not match \"*/*\".\n            \"\"\"\n        case let .unacceptableContentType(acceptableTypes, responseType):\n            return \"\"\"\n            Response Content-Type \"\\(responseType)\" does not match any acceptable types: \\\n            \\(acceptableTypes.joined(separator: \",\")).\n            \"\"\"\n        case let .unacceptableStatusCode(code):\n            return \"Response status code was unacceptable: \\(code).\"\n        case let .customValidationFailed(error):\n            return \"Custom response validation failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n\n#if !(os(Linux) || os(Windows))\nextension AFError.ServerTrustFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .noRequiredEvaluator(host):\n            return \"A ServerTrustEvaluating value is required for host \\(host) but none was found.\"\n        case .noCertificatesFound:\n            return \"No certificates were found or provided for evaluation.\"\n        case .noPublicKeysFound:\n            return \"No public keys were found or provided for evaluation.\"\n        case .policyApplicationFailed:\n            return \"Attempting to set a SecPolicy failed.\"\n        case .settingAnchorCertificatesFailed:\n            return \"Attempting to set the provided certificates as anchor certificates failed.\"\n        case .revocationPolicyCreationFailed:\n            return \"Attempting to create a revocation policy failed.\"\n        case let .trustEvaluationFailed(error):\n            return \"SecTrust evaluation failed with error: \\(error?.localizedDescription ?? \"None\")\"\n        case let .defaultEvaluationFailed(output):\n            return \"Default evaluation failed for host \\(output.host).\"\n        case let .hostValidationFailed(output):\n            return \"Host validation failed for host \\(output.host).\"\n        case let .revocationCheckFailed(output, _):\n            return \"Revocation check failed for host \\(output.host).\"\n        case let .certificatePinningFailed(host, _, _, _):\n            return \"Certificate pinning failed for host \\(host).\"\n        case let .publicKeyPinningFailed(host, _, _, _):\n            return \"Public key pinning failed for host \\(host).\"\n        case let .customEvaluationFailed(error):\n            return \"Custom trust evaluation failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n#endif\n\nextension AFError.URLRequestValidationFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .bodyDataInGETRequest(data):\n            return \"\"\"\n            Invalid URLRequest: Requests with GET method cannot have body data:\n            \\(String(decoding: data, as: UTF8.self))\n            \"\"\"\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Alamofire.swift",
    "content": "//\n//  Alamofire.swift\n//\n//  Copyright (c) 2014-2021 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Dispatch\nimport Foundation\n#if canImport(FoundationNetworking)\n@_exported import FoundationNetworking\n#endif\n\n// Enforce minimum Swift version for all platforms and build systems.\n#if swift(<5.3)\n#error(\"Alamofire doesn't support Swift versions below 5.3.\")\n#endif\n\n/// Reference to `Session.default` for quick bootstrapping and examples.\npublic let AF = Session.default\n\n/// Current Alamofire version. Necessary since SPM doesn't use dynamic libraries. Plus this will be more accurate.\nlet version = \"5.6.1\"\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/AlamofireExtended.swift",
    "content": "//\n//  AlamofireExtended.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n/// Type that acts as a generic extension point for all `AlamofireExtended` types.\npublic struct AlamofireExtension<ExtendedType> {\n    /// Stores the type or meta-type of any extended type.\n    public private(set) var type: ExtendedType\n\n    /// Create an instance from the provided value.\n    ///\n    /// - Parameter type: Instance being extended.\n    public init(_ type: ExtendedType) {\n        self.type = type\n    }\n}\n\n/// Protocol describing the `af` extension points for Alamofire extended types.\npublic protocol AlamofireExtended {\n    /// Type being extended.\n    associatedtype ExtendedType\n\n    /// Static Alamofire extension point.\n    static var af: AlamofireExtension<ExtendedType>.Type { get set }\n    /// Instance Alamofire extension point.\n    var af: AlamofireExtension<ExtendedType> { get set }\n}\n\nextension AlamofireExtended {\n    /// Static Alamofire extension point.\n    public static var af: AlamofireExtension<Self>.Type {\n        get { AlamofireExtension<Self>.self }\n        set {}\n    }\n\n    /// Instance Alamofire extension point.\n    public var af: AlamofireExtension<Self> {\n        get { AlamofireExtension(self) }\n        set {}\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/AuthenticationInterceptor.swift",
    "content": "//\n//  AuthenticationInterceptor.swift\n//\n//  Copyright (c) 2020 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Types adopting the `AuthenticationCredential` protocol can be used to authenticate `URLRequest`s.\n///\n/// One common example of an `AuthenticationCredential` is an OAuth2 credential containing an access token used to\n/// authenticate all requests on behalf of a user. The access token generally has an expiration window of 60 minutes\n/// which will then require a refresh of the credential using the refresh token to generate a new access token.\npublic protocol AuthenticationCredential {\n    /// Whether the credential requires a refresh. This property should always return `true` when the credential is\n    /// expired. It is also wise to consider returning `true` when the credential will expire in several seconds or\n    /// minutes depending on the expiration window of the credential.\n    ///\n    /// For example, if the credential is valid for 60 minutes, then it would be wise to return `true` when the\n    /// credential is only valid for 5 minutes or less. That ensures the credential will not expire as it is passed\n    /// around backend services.\n    var requiresRefresh: Bool { get }\n}\n\n// MARK: -\n\n/// Types adopting the `Authenticator` protocol can be used to authenticate `URLRequest`s with an\n/// `AuthenticationCredential` as well as refresh the `AuthenticationCredential` when required.\npublic protocol Authenticator: AnyObject {\n    /// The type of credential associated with the `Authenticator` instance.\n    associatedtype Credential: AuthenticationCredential\n\n    /// Applies the `Credential` to the `URLRequest`.\n    ///\n    /// In the case of OAuth2, the access token of the `Credential` would be added to the `URLRequest` as a Bearer\n    /// token to the `Authorization` header.\n    ///\n    /// - Parameters:\n    ///   - credential: The `Credential`.\n    ///   - urlRequest: The `URLRequest`.\n    func apply(_ credential: Credential, to urlRequest: inout URLRequest)\n\n    /// Refreshes the `Credential` and executes the `completion` closure with the `Result` once complete.\n    ///\n    /// Refresh can be called in one of two ways. It can be called before the `Request` is actually executed due to\n    /// a `requiresRefresh` returning `true` during the adapt portion of the `Request` creation process. It can also\n    /// be triggered by a failed `Request` where the authentication server denied access due to an expired or\n    /// invalidated access token.\n    ///\n    /// In the case of OAuth2, this method would use the refresh token of the `Credential` to generate a new\n    /// `Credential` using the authentication service. Once complete, the `completion` closure should be called with\n    /// the new `Credential`, or the error that occurred.\n    ///\n    /// In general, if the refresh call fails with certain status codes from the authentication server (commonly a 401),\n    /// the refresh token in the `Credential` can no longer be used to generate a valid `Credential`. In these cases,\n    /// you will need to reauthenticate the user with their username / password.\n    ///\n    /// Please note, these are just general examples of common use cases. They are not meant to solve your specific\n    /// authentication server challenges. Please work with your authentication server team to ensure your\n    /// `Authenticator` logic matches their expectations.\n    ///\n    /// - Parameters:\n    ///   - credential: The `Credential` to refresh.\n    ///   - session:    The `Session` requiring the refresh.\n    ///   - completion: The closure to be executed once the refresh is complete.\n    func refresh(_ credential: Credential, for session: Session, completion: @escaping (Result<Credential, Error>) -> Void)\n\n    /// Determines whether the `URLRequest` failed due to an authentication error based on the `HTTPURLResponse`.\n    ///\n    /// If the authentication server **CANNOT** invalidate credentials after they are issued, then simply return `false`\n    /// for this method. If the authentication server **CAN** invalidate credentials due to security breaches, then you\n    /// will need to work with your authentication server team to understand how to identify when this occurs.\n    ///\n    /// In the case of OAuth2, where an authentication server can invalidate credentials, you will need to inspect the\n    /// `HTTPURLResponse` or possibly the `Error` for when this occurs. This is commonly handled by the authentication\n    /// server returning a 401 status code and some additional header to indicate an OAuth2 failure occurred.\n    ///\n    /// It is very important to understand how your authentication server works to be able to implement this correctly.\n    /// For example, if your authentication server returns a 401 when an OAuth2 error occurs, and your downstream\n    /// service also returns a 401 when you are not authorized to perform that operation, how do you know which layer\n    /// of the backend returned you a 401? You do not want to trigger a refresh unless you know your authentication\n    /// server is actually the layer rejecting the request. Again, work with your authentication server team to understand\n    /// how to identify an OAuth2 401 error vs. a downstream 401 error to avoid endless refresh loops.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: The `URLRequest`.\n    ///   - response:   The `HTTPURLResponse`.\n    ///   - error:      The `Error`.\n    ///\n    /// - Returns: `true` if the `URLRequest` failed due to an authentication error, `false` otherwise.\n    func didRequest(_ urlRequest: URLRequest, with response: HTTPURLResponse, failDueToAuthenticationError error: Error) -> Bool\n\n    /// Determines whether the `URLRequest` is authenticated with the `Credential`.\n    ///\n    /// If the authentication server **CANNOT** invalidate credentials after they are issued, then simply return `true`\n    /// for this method. If the authentication server **CAN** invalidate credentials due to security breaches, then\n    /// read on.\n    ///\n    /// When an authentication server can invalidate credentials, it means that you may have a non-expired credential\n    /// that appears to be valid, but will be rejected by the authentication server when used. Generally when this\n    /// happens, a number of requests are all sent when the application is foregrounded, and all of them will be\n    /// rejected by the authentication server in the order they are received. The first failed request will trigger a\n    /// refresh internally, which will update the credential, and then retry all the queued requests with the new\n    /// credential. However, it is possible that some of the original requests will not return from the authentication\n    /// server until the refresh has completed. This is where this method comes in.\n    ///\n    /// When the authentication server rejects a credential, we need to check to make sure we haven't refreshed the\n    /// credential while the request was in flight. If it has already refreshed, then we don't need to trigger an\n    /// additional refresh. If it hasn't refreshed, then we need to refresh.\n    ///\n    /// Now that it is understood how the result of this method is used in the refresh lifecyle, let's walk through how\n    /// to implement it. You should return `true` in this method if the `URLRequest` is authenticated in a way that\n    /// matches the values in the `Credential`. In the case of OAuth2, this would mean that the Bearer token in the\n    /// `Authorization` header of the `URLRequest` matches the access token in the `Credential`. If it matches, then we\n    /// know the `Credential` was used to authenticate the `URLRequest` and should return `true`. If the Bearer token\n    /// did not match the access token, then you should return `false`.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: The `URLRequest`.\n    ///   - credential: The `Credential`.\n    ///\n    /// - Returns: `true` if the `URLRequest` is authenticated with the `Credential`, `false` otherwise.\n    func isRequest(_ urlRequest: URLRequest, authenticatedWith credential: Credential) -> Bool\n}\n\n// MARK: -\n\n/// Represents various authentication failures that occur when using the `AuthenticationInterceptor`. All errors are\n/// still vended from Alamofire as `AFError` types. The `AuthenticationError` instances will be embedded within\n/// `AFError` `.requestAdaptationFailed` or `.requestRetryFailed` cases.\npublic enum AuthenticationError: Error {\n    /// The credential was missing so the request could not be authenticated.\n    case missingCredential\n    /// The credential was refreshed too many times within the `RefreshWindow`.\n    case excessiveRefresh\n}\n\n// MARK: -\n\n/// The `AuthenticationInterceptor` class manages the queuing and threading complexity of authenticating requests.\n/// It relies on an `Authenticator` type to handle the actual `URLRequest` authentication and `Credential` refresh.\npublic class AuthenticationInterceptor<AuthenticatorType>: RequestInterceptor where AuthenticatorType: Authenticator {\n    // MARK: Typealiases\n\n    /// Type of credential used to authenticate requests.\n    public typealias Credential = AuthenticatorType.Credential\n\n    // MARK: Helper Types\n\n    /// Type that defines a time window used to identify excessive refresh calls. When enabled, prior to executing a\n    /// refresh, the `AuthenticationInterceptor` compares the timestamp history of previous refresh calls against the\n    /// `RefreshWindow`. If more refreshes have occurred within the refresh window than allowed, the refresh is\n    /// cancelled and an `AuthorizationError.excessiveRefresh` error is thrown.\n    public struct RefreshWindow {\n        /// `TimeInterval` defining the duration of the time window before the current time in which the number of\n        /// refresh attempts is compared against `maximumAttempts`. For example, if `interval` is 30 seconds, then the\n        /// `RefreshWindow` represents the past 30 seconds. If more attempts occurred in the past 30 seconds than\n        /// `maximumAttempts`, an `.excessiveRefresh` error will be thrown.\n        public let interval: TimeInterval\n\n        /// Total refresh attempts allowed within `interval` before throwing an `.excessiveRefresh` error.\n        public let maximumAttempts: Int\n\n        /// Creates a `RefreshWindow` instance from the specified `interval` and `maximumAttempts`.\n        ///\n        /// - Parameters:\n        ///   - interval:        `TimeInterval` defining the duration of the time window before the current time.\n        ///   - maximumAttempts: The maximum attempts allowed within the `TimeInterval`.\n        public init(interval: TimeInterval = 30.0, maximumAttempts: Int = 5) {\n            self.interval = interval\n            self.maximumAttempts = maximumAttempts\n        }\n    }\n\n    private struct AdaptOperation {\n        let urlRequest: URLRequest\n        let session: Session\n        let completion: (Result<URLRequest, Error>) -> Void\n    }\n\n    private enum AdaptResult {\n        case adapt(Credential)\n        case doNotAdapt(AuthenticationError)\n        case adaptDeferred\n    }\n\n    private struct MutableState {\n        var credential: Credential?\n\n        var isRefreshing = false\n        var refreshTimestamps: [TimeInterval] = []\n        var refreshWindow: RefreshWindow?\n\n        var adaptOperations: [AdaptOperation] = []\n        var requestsToRetry: [(RetryResult) -> Void] = []\n    }\n\n    // MARK: Properties\n\n    /// The `Credential` used to authenticate requests.\n    public var credential: Credential? {\n        get { $mutableState.credential }\n        set { $mutableState.credential = newValue }\n    }\n\n    let authenticator: AuthenticatorType\n    let queue = DispatchQueue(label: \"org.alamofire.authentication.inspector\")\n\n    @Protected\n    private var mutableState: MutableState\n\n    // MARK: Initialization\n\n    /// Creates an `AuthenticationInterceptor` instance from the specified parameters.\n    ///\n    /// A `nil` `RefreshWindow` will result in the `AuthenticationInterceptor` not checking for excessive refresh calls.\n    /// It is recommended to always use a `RefreshWindow` to avoid endless refresh cycles.\n    ///\n    /// - Parameters:\n    ///   - authenticator: The `Authenticator` type.\n    ///   - credential:    The `Credential` if it exists. `nil` by default.\n    ///   - refreshWindow: The `RefreshWindow` used to identify excessive refresh calls. `RefreshWindow()` by default.\n    public init(authenticator: AuthenticatorType,\n                credential: Credential? = nil,\n                refreshWindow: RefreshWindow? = RefreshWindow()) {\n        self.authenticator = authenticator\n        mutableState = MutableState(credential: credential, refreshWindow: refreshWindow)\n    }\n\n    // MARK: Adapt\n\n    public func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        let adaptResult: AdaptResult = $mutableState.write { mutableState in\n            // Queue the adapt operation if a refresh is already in place.\n            guard !mutableState.isRefreshing else {\n                let operation = AdaptOperation(urlRequest: urlRequest, session: session, completion: completion)\n                mutableState.adaptOperations.append(operation)\n                return .adaptDeferred\n            }\n\n            // Throw missing credential error is the credential is missing.\n            guard let credential = mutableState.credential else {\n                let error = AuthenticationError.missingCredential\n                return .doNotAdapt(error)\n            }\n\n            // Queue the adapt operation and trigger refresh operation if credential requires refresh.\n            guard !credential.requiresRefresh else {\n                let operation = AdaptOperation(urlRequest: urlRequest, session: session, completion: completion)\n                mutableState.adaptOperations.append(operation)\n                refresh(credential, for: session, insideLock: &mutableState)\n                return .adaptDeferred\n            }\n\n            return .adapt(credential)\n        }\n\n        switch adaptResult {\n        case let .adapt(credential):\n            var authenticatedRequest = urlRequest\n            authenticator.apply(credential, to: &authenticatedRequest)\n            completion(.success(authenticatedRequest))\n\n        case let .doNotAdapt(adaptError):\n            completion(.failure(adaptError))\n\n        case .adaptDeferred:\n            // No-op: adapt operation captured during refresh.\n            break\n        }\n    }\n\n    // MARK: Retry\n\n    public func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -> Void) {\n        // Do not attempt retry if there was not an original request and response from the server.\n        guard let urlRequest = request.request, let response = request.response else {\n            completion(.doNotRetry)\n            return\n        }\n\n        // Do not attempt retry unless the `Authenticator` verifies failure was due to authentication error (i.e. 401 status code).\n        guard authenticator.didRequest(urlRequest, with: response, failDueToAuthenticationError: error) else {\n            completion(.doNotRetry)\n            return\n        }\n\n        // Do not attempt retry if there is no credential.\n        guard let credential = credential else {\n            let error = AuthenticationError.missingCredential\n            completion(.doNotRetryWithError(error))\n            return\n        }\n\n        // Retry the request if the `Authenticator` verifies it was authenticated with a previous credential.\n        guard authenticator.isRequest(urlRequest, authenticatedWith: credential) else {\n            completion(.retry)\n            return\n        }\n\n        $mutableState.write { mutableState in\n            mutableState.requestsToRetry.append(completion)\n\n            guard !mutableState.isRefreshing else { return }\n\n            refresh(credential, for: session, insideLock: &mutableState)\n        }\n    }\n\n    // MARK: Refresh\n\n    private func refresh(_ credential: Credential, for session: Session, insideLock mutableState: inout MutableState) {\n        guard !isRefreshExcessive(insideLock: &mutableState) else {\n            let error = AuthenticationError.excessiveRefresh\n            handleRefreshFailure(error, insideLock: &mutableState)\n            return\n        }\n\n        mutableState.refreshTimestamps.append(ProcessInfo.processInfo.systemUptime)\n        mutableState.isRefreshing = true\n\n        // Dispatch to queue to hop out of the lock in case authenticator.refresh is implemented synchronously.\n        queue.async {\n            self.authenticator.refresh(credential, for: session) { result in\n                self.$mutableState.write { mutableState in\n                    switch result {\n                    case let .success(credential):\n                        self.handleRefreshSuccess(credential, insideLock: &mutableState)\n                    case let .failure(error):\n                        self.handleRefreshFailure(error, insideLock: &mutableState)\n                    }\n                }\n            }\n        }\n    }\n\n    private func isRefreshExcessive(insideLock mutableState: inout MutableState) -> Bool {\n        guard let refreshWindow = mutableState.refreshWindow else { return false }\n\n        let refreshWindowMin = ProcessInfo.processInfo.systemUptime - refreshWindow.interval\n\n        let refreshAttemptsWithinWindow = mutableState.refreshTimestamps.reduce(into: 0) { attempts, refreshTimestamp in\n            guard refreshWindowMin <= refreshTimestamp else { return }\n            attempts += 1\n        }\n\n        let isRefreshExcessive = refreshAttemptsWithinWindow >= refreshWindow.maximumAttempts\n\n        return isRefreshExcessive\n    }\n\n    private func handleRefreshSuccess(_ credential: Credential, insideLock mutableState: inout MutableState) {\n        mutableState.credential = credential\n\n        let adaptOperations = mutableState.adaptOperations\n        let requestsToRetry = mutableState.requestsToRetry\n\n        mutableState.adaptOperations.removeAll()\n        mutableState.requestsToRetry.removeAll()\n\n        mutableState.isRefreshing = false\n\n        // Dispatch to queue to hop out of the mutable state lock\n        queue.async {\n            adaptOperations.forEach { self.adapt($0.urlRequest, for: $0.session, completion: $0.completion) }\n            requestsToRetry.forEach { $0(.retry) }\n        }\n    }\n\n    private func handleRefreshFailure(_ error: Error, insideLock mutableState: inout MutableState) {\n        let adaptOperations = mutableState.adaptOperations\n        let requestsToRetry = mutableState.requestsToRetry\n\n        mutableState.adaptOperations.removeAll()\n        mutableState.requestsToRetry.removeAll()\n\n        mutableState.isRefreshing = false\n\n        // Dispatch to queue to hop out of the mutable state lock\n        queue.async {\n            adaptOperations.forEach { $0.completion(.failure(error)) }\n            requestsToRetry.forEach { $0(.doNotRetryWithError(error)) }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/CachedResponseHandler.swift",
    "content": "//\n//  CachedResponseHandler.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that handles whether the data task should store the HTTP response in the cache.\npublic protocol CachedResponseHandler {\n    /// Determines whether the HTTP response should be stored in the cache.\n    ///\n    /// The `completion` closure should be passed one of three possible options:\n    ///\n    ///   1. The cached response provided by the server (this is the most common use case).\n    ///   2. A modified version of the cached response (you may want to modify it in some way before caching).\n    ///   3. A `nil` value to prevent the cached response from being stored in the cache.\n    ///\n    /// - Parameters:\n    ///   - task:       The data task whose request resulted in the cached response.\n    ///   - response:   The cached response to potentially store in the cache.\n    ///   - completion: The closure to execute containing cached response, a modified response, or `nil`.\n    func dataTask(_ task: URLSessionDataTask,\n                  willCacheResponse response: CachedURLResponse,\n                  completion: @escaping (CachedURLResponse?) -> Void)\n}\n\n// MARK: -\n\n/// `ResponseCacher` is a convenience `CachedResponseHandler` making it easy to cache, not cache, or modify a cached\n/// response.\npublic struct ResponseCacher {\n    /// Defines the behavior of the `ResponseCacher` type.\n    public enum Behavior {\n        /// Stores the cached response in the cache.\n        case cache\n        /// Prevents the cached response from being stored in the cache.\n        case doNotCache\n        /// Modifies the cached response before storing it in the cache.\n        case modify((URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)\n    }\n\n    /// Returns a `ResponseCacher` with a `.cache` `Behavior`.\n    public static let cache = ResponseCacher(behavior: .cache)\n    /// Returns a `ResponseCacher` with a `.doNotCache` `Behavior`.\n    public static let doNotCache = ResponseCacher(behavior: .doNotCache)\n\n    /// The `Behavior` of the `ResponseCacher`.\n    public let behavior: Behavior\n\n    /// Creates a `ResponseCacher` instance from the `Behavior`.\n    ///\n    /// - Parameter behavior: The `Behavior`.\n    public init(behavior: Behavior) {\n        self.behavior = behavior\n    }\n}\n\nextension ResponseCacher: CachedResponseHandler {\n    public func dataTask(_ task: URLSessionDataTask,\n                         willCacheResponse response: CachedURLResponse,\n                         completion: @escaping (CachedURLResponse?) -> Void) {\n        switch behavior {\n        case .cache:\n            completion(response)\n        case .doNotCache:\n            completion(nil)\n        case let .modify(closure):\n            let response = closure(task, response)\n            completion(response)\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension CachedResponseHandler where Self == ResponseCacher {\n    /// Provides a `ResponseCacher` which caches the response, if allowed. Equivalent to `ResponseCacher.cache`.\n    public static var cache: ResponseCacher { .cache }\n\n    /// Provides a `ResponseCacher` which does not cache the response. Equivalent to `ResponseCacher.doNotCache`.\n    public static var doNotCache: ResponseCacher { .doNotCache }\n\n    /// Creates a `ResponseCacher` which modifies the proposed `CachedURLResponse` using the provided closure.\n    ///\n    /// - Parameter closure: Closure used to modify the `CachedURLResponse`.\n    /// - Returns:           The `ResponseCacher`.\n    public static func modify(using closure: @escaping ((URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)) -> ResponseCacher {\n        ResponseCacher(behavior: .modify(closure))\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Combine.swift",
    "content": "//\n//  Combine.swift\n//\n//  Copyright (c) 2020 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n#if !((os(iOS) && (arch(i386) || arch(arm))) || os(Windows) || os(Linux))\n\nimport Combine\nimport Dispatch\nimport Foundation\n\n// MARK: - DataRequest / UploadRequest\n\n/// A Combine `Publisher` that publishes the `DataResponse<Value, AFError>` of the provided `DataRequest`.\n@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\npublic struct DataResponsePublisher<Value>: Publisher {\n    public typealias Output = DataResponse<Value, AFError>\n    public typealias Failure = Never\n\n    private typealias Handler = (@escaping (_ response: DataResponse<Value, AFError>) -> Void) -> DataRequest\n\n    private let request: DataRequest\n    private let responseHandler: Handler\n\n    /// Creates an instance which will serialize responses using the provided `ResponseSerializer`.\n    ///\n    /// - Parameters:\n    ///   - request:    `DataRequest` for which to publish the response.\n    ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.\n    ///   - serializer: `ResponseSerializer` used to produce the published `DataResponse`.\n    public init<Serializer: ResponseSerializer>(_ request: DataRequest, queue: DispatchQueue, serializer: Serializer)\n        where Value == Serializer.SerializedObject {\n        self.request = request\n        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }\n    }\n\n    /// Creates an instance which will serialize responses using the provided `DataResponseSerializerProtocol`.\n    ///\n    /// - Parameters:\n    ///   - request:    `DataRequest` for which to publish the response.\n    ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.\n    ///   - serializer: `DataResponseSerializerProtocol` used to produce the published `DataResponse`.\n    public init<Serializer: DataResponseSerializerProtocol>(_ request: DataRequest,\n                                                            queue: DispatchQueue,\n                                                            serializer: Serializer)\n        where Value == Serializer.SerializedObject {\n        self.request = request\n        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }\n    }\n\n    /// Publishes only the `Result` of the `DataResponse` value.\n    ///\n    /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.\n    public func result() -> AnyPublisher<Result<Value, AFError>, Never> {\n        map(\\.result).eraseToAnyPublisher()\n    }\n\n    /// Publishes the `Result` of the `DataResponse` as a single `Value` or fail with the `AFError` instance.\n    ///\n    /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.\n    public func value() -> AnyPublisher<Value, AFError> {\n        setFailureType(to: AFError.self).flatMap(\\.result.publisher).eraseToAnyPublisher()\n    }\n\n    public func receive<S>(subscriber: S) where S: Subscriber, DataResponsePublisher.Failure == S.Failure, DataResponsePublisher.Output == S.Input {\n        subscriber.receive(subscription: Inner(request: request,\n                                               responseHandler: responseHandler,\n                                               downstream: subscriber))\n    }\n\n    private final class Inner<Downstream: Subscriber>: Subscription, Cancellable\n        where Downstream.Input == Output {\n        typealias Failure = Downstream.Failure\n\n        @Protected\n        private var downstream: Downstream?\n        private let request: DataRequest\n        private let responseHandler: Handler\n\n        init(request: DataRequest, responseHandler: @escaping Handler, downstream: Downstream) {\n            self.request = request\n            self.responseHandler = responseHandler\n            self.downstream = downstream\n        }\n\n        func request(_ demand: Subscribers.Demand) {\n            assert(demand > 0)\n\n            guard let downstream = downstream else { return }\n\n            self.downstream = nil\n            responseHandler { response in\n                _ = downstream.receive(response)\n                downstream.receive(completion: .finished)\n            }.resume()\n        }\n\n        func cancel() {\n            request.cancel()\n            downstream = nil\n        }\n    }\n}\n\n@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\nextension DataResponsePublisher where Value == Data? {\n    /// Creates an instance which publishes a `DataResponse<Data?, AFError>` value without serialization.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public init(_ request: DataRequest, queue: DispatchQueue) {\n        self.request = request\n        responseHandler = { request.response(queue: queue, completionHandler: $0) }\n    }\n}\n\nextension DataRequest {\n    /// Creates a `DataResponsePublisher` for this instance using the given `ResponseSerializer` and `DispatchQueue`.\n    ///\n    /// - Parameters:\n    ///   - serializer: `ResponseSerializer` used to serialize response `Data`.\n    ///   - queue:      `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.\n    ///\n    /// - Returns:      The `DataResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishResponse<Serializer: ResponseSerializer, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DataResponsePublisher<T>\n        where Serializer.SerializedObject == T {\n        DataResponsePublisher(self, queue: queue, serializer: serializer)\n    }\n\n    /// Creates a `DataResponsePublisher` for this instance and uses a `DataResponseSerializer` to serialize the\n    /// response.\n    ///\n    /// - Parameters:\n    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.\n    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`\n    ///                          by default.\n    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by\n    ///                          default.\n    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of\n    ///                          status code. `[.head]` by default.\n    /// - Returns:               The `DataResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishData(queue: DispatchQueue = .main,\n                            preprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                            emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                            emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DataResponsePublisher<Data> {\n        publishResponse(using: DataResponseSerializer(dataPreprocessor: preprocessor,\n                                                      emptyResponseCodes: emptyResponseCodes,\n                                                      emptyRequestMethods: emptyRequestMethods),\n                        on: queue)\n    }\n\n    /// Creates a `DataResponsePublisher` for this instance and uses a `StringResponseSerializer` to serialize the\n    /// response.\n    ///\n    /// - Parameters:\n    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.\n    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`\n    ///                          by default.\n    ///   - encoding:            `String.Encoding` to parse the response. `nil` by default, in which case the encoding\n    ///                          will be determined by the server response, falling back to the default HTTP character\n    ///                          set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by\n    ///                          default.\n    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of\n    ///                          status code. `[.head]` by default.\n    ///\n    /// - Returns:               The `DataResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishString(queue: DispatchQueue = .main,\n                              preprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                              encoding: String.Encoding? = nil,\n                              emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                              emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DataResponsePublisher<String> {\n        publishResponse(using: StringResponseSerializer(dataPreprocessor: preprocessor,\n                                                        encoding: encoding,\n                                                        emptyResponseCodes: emptyResponseCodes,\n                                                        emptyRequestMethods: emptyRequestMethods),\n                        on: queue)\n    }\n\n    @_disfavoredOverload\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    @available(*, deprecated, message: \"Renamed publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyRequestMethods).\")\n    public func publishDecodable<T: Decodable>(type: T.Type = T.self,\n                                               queue: DispatchQueue = .main,\n                                               preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,\n                                               decoder: DataDecoder = JSONDecoder(),\n                                               emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,\n                                               emptyResponseMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DataResponsePublisher<T> {\n        publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,\n                                                           decoder: decoder,\n                                                           emptyResponseCodes: emptyResponseCodes,\n                                                           emptyRequestMethods: emptyResponseMethods),\n                        on: queue)\n    }\n\n    /// Creates a `DataResponsePublisher` for this instance and uses a `DecodableResponseSerializer` to serialize the\n    /// response.\n    ///\n    /// - Parameters:\n    ///   - type:                `Decodable` type to which to decode response `Data`. Inferred from the context by\n    ///                          default.\n    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.\n    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization.\n    ///                          `PassthroughPreprocessor()` by default.\n    ///   - decoder:             `DataDecoder` instance used to decode response `Data`. `JSONDecoder()` by default.\n    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by\n    ///                          default.\n    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of\n    ///                          status code. `[.head]` by default.\n    ///\n    /// - Returns:               The `DataResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishDecodable<T: Decodable>(type: T.Type = T.self,\n                                               queue: DispatchQueue = .main,\n                                               preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,\n                                               decoder: DataDecoder = JSONDecoder(),\n                                               emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,\n                                               emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DataResponsePublisher<T> {\n        publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,\n                                                           decoder: decoder,\n                                                           emptyResponseCodes: emptyResponseCodes,\n                                                           emptyRequestMethods: emptyRequestMethods),\n                        on: queue)\n    }\n\n    /// Creates a `DataResponsePublisher` for this instance which does not serialize the response before publishing.\n    ///\n    ///   - queue: `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.\n    ///\n    /// - Returns: The `DataResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishUnserialized(queue: DispatchQueue = .main) -> DataResponsePublisher<Data?> {\n        DataResponsePublisher(self, queue: queue)\n    }\n}\n\n// A Combine `Publisher` that publishes a sequence of `Stream<Value, AFError>` values received by the provided `DataStreamRequest`.\n@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\npublic struct DataStreamPublisher<Value>: Publisher {\n    public typealias Output = DataStreamRequest.Stream<Value, AFError>\n    public typealias Failure = Never\n\n    private typealias Handler = (@escaping DataStreamRequest.Handler<Value, AFError>) -> DataStreamRequest\n\n    private let request: DataStreamRequest\n    private let streamHandler: Handler\n\n    /// Creates an instance which will serialize responses using the provided `DataStreamSerializer`.\n    ///\n    /// - Parameters:\n    ///   - request:    `DataStreamRequest` for which to publish the response.\n    ///   - queue:      `DispatchQueue` on which the `Stream<Value, AFError>` values will be published. `.main` by\n    ///                 default.\n    ///   - serializer: `DataStreamSerializer` used to produce the published `Stream<Value, AFError>` values.\n    public init<Serializer: DataStreamSerializer>(_ request: DataStreamRequest, queue: DispatchQueue, serializer: Serializer)\n        where Value == Serializer.SerializedObject {\n        self.request = request\n        streamHandler = { request.responseStream(using: serializer, on: queue, stream: $0) }\n    }\n\n    /// Publishes only the `Result` of the `DataStreamRequest.Stream`'s `Event`s.\n    ///\n    /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.\n    public func result() -> AnyPublisher<Result<Value, AFError>, Never> {\n        compactMap { stream in\n            switch stream.event {\n            case let .stream(result):\n                return result\n            // If the stream has completed with an error, send the error value downstream as a `.failure`.\n            case let .complete(completion):\n                return completion.error.map(Result.failure)\n            }\n        }\n        .eraseToAnyPublisher()\n    }\n\n    /// Publishes the streamed values of the `DataStreamRequest.Stream` as a sequence of `Value` or fail with the\n    /// `AFError` instance.\n    ///\n    /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.\n    public func value() -> AnyPublisher<Value, AFError> {\n        result().setFailureType(to: AFError.self).flatMap(\\.publisher).eraseToAnyPublisher()\n    }\n\n    public func receive<S>(subscriber: S) where S: Subscriber, DataStreamPublisher.Failure == S.Failure, DataStreamPublisher.Output == S.Input {\n        subscriber.receive(subscription: Inner(request: request,\n                                               streamHandler: streamHandler,\n                                               downstream: subscriber))\n    }\n\n    private final class Inner<Downstream: Subscriber>: Subscription, Cancellable\n        where Downstream.Input == Output {\n        typealias Failure = Downstream.Failure\n\n        @Protected\n        private var downstream: Downstream?\n        private let request: DataStreamRequest\n        private let streamHandler: Handler\n\n        init(request: DataStreamRequest, streamHandler: @escaping Handler, downstream: Downstream) {\n            self.request = request\n            self.streamHandler = streamHandler\n            self.downstream = downstream\n        }\n\n        func request(_ demand: Subscribers.Demand) {\n            assert(demand > 0)\n\n            guard let downstream = downstream else { return }\n\n            self.downstream = nil\n            streamHandler { stream in\n                _ = downstream.receive(stream)\n                if case .complete = stream.event {\n                    downstream.receive(completion: .finished)\n                }\n            }.resume()\n        }\n\n        func cancel() {\n            request.cancel()\n            downstream = nil\n        }\n    }\n}\n\nextension DataStreamRequest {\n    /// Creates a `DataStreamPublisher` for this instance using the given `DataStreamSerializer` and `DispatchQueue`.\n    ///\n    /// - Parameters:\n    ///   - serializer: `DataStreamSerializer` used to serialize the streamed `Data`.\n    ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.\n    /// - Returns:      The `DataStreamPublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishStream<Serializer: DataStreamSerializer>(using serializer: Serializer,\n                                                                on queue: DispatchQueue = .main) -> DataStreamPublisher<Serializer.SerializedObject> {\n        DataStreamPublisher(self, queue: queue, serializer: serializer)\n    }\n\n    /// Creates a `DataStreamPublisher` for this instance which uses a `PassthroughStreamSerializer` to stream `Data`\n    /// unserialized.\n    ///\n    /// - Parameters:\n    ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.\n    /// - Returns:      The `DataStreamPublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishData(queue: DispatchQueue = .main) -> DataStreamPublisher<Data> {\n        publishStream(using: PassthroughStreamSerializer(), on: queue)\n    }\n\n    /// Creates a `DataStreamPublisher` for this instance which uses a `StringStreamSerializer` to serialize stream\n    /// `Data` values into `String` values.\n    ///\n    /// - Parameters:\n    ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.\n    /// - Returns:      The `DataStreamPublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishString(queue: DispatchQueue = .main) -> DataStreamPublisher<String> {\n        publishStream(using: StringStreamSerializer(), on: queue)\n    }\n\n    /// Creates a `DataStreamPublisher` for this instance which uses a `DecodableStreamSerializer` with the provided\n    /// parameters to serialize stream `Data` values into the provided type.\n    ///\n    /// - Parameters:\n    ///   - type:         `Decodable` type to which to decode stream `Data`. Inferred from the context by default.\n    ///   - queue:        `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.\n    ///   - decoder:      `DataDecoder` instance used to decode stream `Data`. `JSONDecoder()` by default.\n    ///   - preprocessor: `DataPreprocessor` which filters incoming stream `Data` before serialization.\n    ///                   `PassthroughPreprocessor()` by default.\n    /// - Returns:        The `DataStreamPublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishDecodable<T: Decodable>(type: T.Type = T.self,\n                                               queue: DispatchQueue = .main,\n                                               decoder: DataDecoder = JSONDecoder(),\n                                               preprocessor: DataPreprocessor = PassthroughPreprocessor()) -> DataStreamPublisher<T> {\n        publishStream(using: DecodableStreamSerializer(decoder: decoder,\n                                                       dataPreprocessor: preprocessor),\n                      on: queue)\n    }\n}\n\n/// A Combine `Publisher` that publishes the `DownloadResponse<Value, AFError>` of the provided `DownloadRequest`.\n@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\npublic struct DownloadResponsePublisher<Value>: Publisher {\n    public typealias Output = DownloadResponse<Value, AFError>\n    public typealias Failure = Never\n\n    private typealias Handler = (@escaping (_ response: DownloadResponse<Value, AFError>) -> Void) -> DownloadRequest\n\n    private let request: DownloadRequest\n    private let responseHandler: Handler\n\n    /// Creates an instance which will serialize responses using the provided `ResponseSerializer`.\n    ///\n    /// - Parameters:\n    ///   - request:    `DownloadRequest` for which to publish the response.\n    ///   - queue:      `DispatchQueue` on which the `DownloadResponse` value will be published. `.main` by default.\n    ///   - serializer: `ResponseSerializer` used to produce the published `DownloadResponse`.\n    public init<Serializer: ResponseSerializer>(_ request: DownloadRequest, queue: DispatchQueue, serializer: Serializer)\n        where Value == Serializer.SerializedObject {\n        self.request = request\n        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }\n    }\n\n    /// Creates an instance which will serialize responses using the provided `DownloadResponseSerializerProtocol` value.\n    ///\n    /// - Parameters:\n    ///   - request:    `DownloadRequest` for which to publish the response.\n    ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.\n    ///   - serializer: `DownloadResponseSerializerProtocol` used to produce the published `DownloadResponse`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public init<Serializer: DownloadResponseSerializerProtocol>(_ request: DownloadRequest,\n                                                                queue: DispatchQueue,\n                                                                serializer: Serializer)\n        where Value == Serializer.SerializedObject {\n        self.request = request\n        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }\n    }\n\n    /// Publishes only the `Result` of the `DownloadResponse` value.\n    ///\n    /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.\n    public func result() -> AnyPublisher<Result<Value, AFError>, Never> {\n        map(\\.result).eraseToAnyPublisher()\n    }\n\n    /// Publishes the `Result` of the `DownloadResponse` as a single `Value` or fail with the `AFError` instance.\n    ///\n    /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.\n    public func value() -> AnyPublisher<Value, AFError> {\n        setFailureType(to: AFError.self).flatMap(\\.result.publisher).eraseToAnyPublisher()\n    }\n\n    public func receive<S>(subscriber: S) where S: Subscriber, DownloadResponsePublisher.Failure == S.Failure, DownloadResponsePublisher.Output == S.Input {\n        subscriber.receive(subscription: Inner(request: request,\n                                               responseHandler: responseHandler,\n                                               downstream: subscriber))\n    }\n\n    private final class Inner<Downstream: Subscriber>: Subscription, Cancellable\n        where Downstream.Input == Output {\n        typealias Failure = Downstream.Failure\n\n        @Protected\n        private var downstream: Downstream?\n        private let request: DownloadRequest\n        private let responseHandler: Handler\n\n        init(request: DownloadRequest, responseHandler: @escaping Handler, downstream: Downstream) {\n            self.request = request\n            self.responseHandler = responseHandler\n            self.downstream = downstream\n        }\n\n        func request(_ demand: Subscribers.Demand) {\n            assert(demand > 0)\n\n            guard let downstream = downstream else { return }\n\n            self.downstream = nil\n            responseHandler { response in\n                _ = downstream.receive(response)\n                downstream.receive(completion: .finished)\n            }.resume()\n        }\n\n        func cancel() {\n            request.cancel()\n            downstream = nil\n        }\n    }\n}\n\nextension DownloadRequest {\n    /// Creates a `DownloadResponsePublisher` for this instance using the given `ResponseSerializer` and `DispatchQueue`.\n    ///\n    /// - Parameters:\n    ///   - serializer: `ResponseSerializer` used to serialize the response `Data` from disk.\n    ///   - queue:      `DispatchQueue` on which the `DownloadResponse` will be published.`.main` by default.\n    ///\n    /// - Returns:      The `DownloadResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishResponse<Serializer: ResponseSerializer, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DownloadResponsePublisher<T>\n        where Serializer.SerializedObject == T {\n        DownloadResponsePublisher(self, queue: queue, serializer: serializer)\n    }\n\n    /// Creates a `DownloadResponsePublisher` for this instance using the given `DownloadResponseSerializerProtocol` and\n    /// `DispatchQueue`.\n    ///\n    /// - Parameters:\n    ///   - serializer: `DownloadResponseSerializer` used to serialize the response `Data` from disk.\n    ///   - queue:      `DispatchQueue` on which the `DownloadResponse` will be published.`.main` by default.\n    ///\n    /// - Returns:      The `DownloadResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishResponse<Serializer: DownloadResponseSerializerProtocol, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DownloadResponsePublisher<T>\n        where Serializer.SerializedObject == T {\n        DownloadResponsePublisher(self, queue: queue, serializer: serializer)\n    }\n\n    /// Creates a `DownloadResponsePublisher` for this instance and uses a `URLResponseSerializer` to serialize the\n    /// response.\n    ///\n    /// - Parameter queue: `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.\n    ///\n    /// - Returns:         The `DownloadResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishURL(queue: DispatchQueue = .main) -> DownloadResponsePublisher<URL> {\n        publishResponse(using: URLResponseSerializer(), on: queue)\n    }\n\n    /// Creates a `DownloadResponsePublisher` for this instance and uses a `DataResponseSerializer` to serialize the\n    /// response.\n    ///\n    /// - Parameters:\n    ///   - queue:               `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.\n    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`\n    ///                          by default.\n    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by\n    ///                          default.\n    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of\n    ///                          status code. `[.head]` by default.\n    ///\n    /// - Returns:               The `DownloadResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishData(queue: DispatchQueue = .main,\n                            preprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                            emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                            emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DownloadResponsePublisher<Data> {\n        publishResponse(using: DataResponseSerializer(dataPreprocessor: preprocessor,\n                                                      emptyResponseCodes: emptyResponseCodes,\n                                                      emptyRequestMethods: emptyRequestMethods),\n                        on: queue)\n    }\n\n    /// Creates a `DownloadResponsePublisher` for this instance and uses a `StringResponseSerializer` to serialize the\n    /// response.\n    ///\n    /// - Parameters:\n    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.\n    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`\n    ///                          by default.\n    ///   - encoding:            `String.Encoding` to parse the response. `nil` by default, in which case the encoding\n    ///                          will be determined by the server response, falling back to the default HTTP character\n    ///                          set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by\n    ///                          default.\n    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of\n    ///                          status code. `[.head]` by default.\n    ///\n    /// - Returns:               The `DownloadResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishString(queue: DispatchQueue = .main,\n                              preprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                              encoding: String.Encoding? = nil,\n                              emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                              emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DownloadResponsePublisher<String> {\n        publishResponse(using: StringResponseSerializer(dataPreprocessor: preprocessor,\n                                                        encoding: encoding,\n                                                        emptyResponseCodes: emptyResponseCodes,\n                                                        emptyRequestMethods: emptyRequestMethods),\n                        on: queue)\n    }\n\n    @_disfavoredOverload\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    @available(*, deprecated, message: \"Renamed publishDecodable(type:queue:preprocessor:decoder:emptyResponseCodes:emptyRequestMethods).\")\n    public func publishDecodable<T: Decodable>(type: T.Type = T.self,\n                                               queue: DispatchQueue = .main,\n                                               preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,\n                                               decoder: DataDecoder = JSONDecoder(),\n                                               emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,\n                                               emptyResponseMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DownloadResponsePublisher<T> {\n        publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,\n                                                           decoder: decoder,\n                                                           emptyResponseCodes: emptyResponseCodes,\n                                                           emptyRequestMethods: emptyResponseMethods),\n                        on: queue)\n    }\n\n    /// Creates a `DownloadResponsePublisher` for this instance and uses a `DecodableResponseSerializer` to serialize\n    /// the response.\n    ///\n    /// - Parameters:\n    ///   - type:                `Decodable` type to which to decode response `Data`. Inferred from the context by default.\n    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.\n    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization.\n    ///                          `PassthroughPreprocessor()` by default.\n    ///   - decoder:             `DataDecoder` instance used to decode response `Data`. `JSONDecoder()` by default.\n    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by\n    ///                          default.\n    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless\n    ///                          of status code. `[.head]` by default.\n    ///\n    /// - Returns:               The `DownloadResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishDecodable<T: Decodable>(type: T.Type = T.self,\n                                               queue: DispatchQueue = .main,\n                                               preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,\n                                               decoder: DataDecoder = JSONDecoder(),\n                                               emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,\n                                               emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DownloadResponsePublisher<T> {\n        publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,\n                                                           decoder: decoder,\n                                                           emptyResponseCodes: emptyResponseCodes,\n                                                           emptyRequestMethods: emptyRequestMethods),\n                        on: queue)\n    }\n}\n\n@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\nextension DownloadResponsePublisher where Value == URL? {\n    /// Creates an instance which publishes a `DownloadResponse<URL?, AFError>` value without serialization.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public init(_ request: DownloadRequest, queue: DispatchQueue) {\n        self.request = request\n        responseHandler = { request.response(queue: queue, completionHandler: $0) }\n    }\n}\n\nextension DownloadRequest {\n    /// Creates a `DownloadResponsePublisher` for this instance which does not serialize the response before publishing.\n    ///\n    /// - Parameter queue: `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.\n    ///\n    /// - Returns:         The `DownloadResponsePublisher`.\n    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)\n    public func publishUnserialized(on queue: DispatchQueue = .main) -> DownloadResponsePublisher<URL?> {\n        DownloadResponsePublisher(self, queue: queue)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Concurrency.swift",
    "content": "//\n//  Concurrency.swift\n//\n//  Copyright (c) 2021 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n#if compiler(>=5.6.0) && canImport(_Concurrency)\n\nimport Foundation\n\n// MARK: - Request Event Streams\n\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\nextension Request {\n    /// Creates a `StreamOf<Progress>` for the instance's upload progress.\n    ///\n    /// - Parameter bufferingPolicy: `BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:                   The `StreamOf<Progress>`.\n    public func uploadProgress(bufferingPolicy: StreamOf<Progress>.BufferingPolicy = .unbounded) -> StreamOf<Progress> {\n        stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in\n            uploadProgress(queue: .singleEventQueue) { progress in\n                continuation.yield(progress)\n            }\n        }\n    }\n\n    /// Creates a `StreamOf<Progress>` for the instance's download progress.\n    ///\n    /// - Parameter bufferingPolicy: `BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:                   The `StreamOf<Progress>`.\n    public func downloadProgress(bufferingPolicy: StreamOf<Progress>.BufferingPolicy = .unbounded) -> StreamOf<Progress> {\n        stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in\n            downloadProgress(queue: .singleEventQueue) { progress in\n                continuation.yield(progress)\n            }\n        }\n    }\n\n    /// Creates a `StreamOf<URLRequest>` for the `URLRequest`s produced for the instance.\n    ///\n    /// - Parameter bufferingPolicy: `BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:                   The `StreamOf<URLRequest>`.\n    public func urlRequests(bufferingPolicy: StreamOf<URLRequest>.BufferingPolicy = .unbounded) -> StreamOf<URLRequest> {\n        stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in\n            onURLRequestCreation(on: .singleEventQueue) { request in\n                continuation.yield(request)\n            }\n        }\n    }\n\n    /// Creates a `StreamOf<URLSessionTask>` for the `URLSessionTask`s produced for the instance.\n    ///\n    /// - Parameter bufferingPolicy: `BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:                   The `StreamOf<URLSessionTask>`.\n    public func urlSessionTasks(bufferingPolicy: StreamOf<URLSessionTask>.BufferingPolicy = .unbounded) -> StreamOf<URLSessionTask> {\n        stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in\n            onURLSessionTaskCreation(on: .singleEventQueue) { task in\n                continuation.yield(task)\n            }\n        }\n    }\n\n    /// Creates a `StreamOf<String>` for the cURL descriptions produced for the instance.\n    ///\n    /// - Parameter bufferingPolicy: `BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:                   The `StreamOf<String>`.\n    public func cURLDescriptions(bufferingPolicy: StreamOf<String>.BufferingPolicy = .unbounded) -> StreamOf<String> {\n        stream(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in\n            cURLDescription(on: .singleEventQueue) { description in\n                continuation.yield(description)\n            }\n        }\n    }\n\n    private func stream<T>(of type: T.Type = T.self,\n                           bufferingPolicy: StreamOf<T>.BufferingPolicy = .unbounded,\n                           yielder: @escaping (StreamOf<T>.Continuation) -> Void) -> StreamOf<T> {\n        StreamOf<T>(bufferingPolicy: bufferingPolicy) { [unowned self] continuation in\n            yielder(continuation)\n            // Must come after serializers run in order to catch retry progress.\n            onFinish {\n                continuation.finish()\n            }\n        }\n    }\n}\n\n// MARK: - DataTask\n\n/// Value used to `await` a `DataResponse` and associated values.\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\npublic struct DataTask<Value> {\n    /// `DataResponse` produced by the `DataRequest` and its response handler.\n    public var response: DataResponse<Value, AFError> {\n        get async {\n            if shouldAutomaticallyCancel {\n                return await withTaskCancellationHandler {\n                    self.cancel()\n                } operation: {\n                    await task.value\n                }\n            } else {\n                return await task.value\n            }\n        }\n    }\n\n    /// `Result` of any response serialization performed for the `response`.\n    public var result: Result<Value, AFError> {\n        get async { await response.result }\n    }\n\n    /// `Value` returned by the `response`.\n    public var value: Value {\n        get async throws {\n            try await result.get()\n        }\n    }\n\n    private let request: DataRequest\n    private let task: Task<DataResponse<Value, AFError>, Never>\n    private let shouldAutomaticallyCancel: Bool\n\n    fileprivate init(request: DataRequest, task: Task<DataResponse<Value, AFError>, Never>, shouldAutomaticallyCancel: Bool) {\n        self.request = request\n        self.task = task\n        self.shouldAutomaticallyCancel = shouldAutomaticallyCancel\n    }\n\n    /// Cancel the underlying `DataRequest` and `Task`.\n    public func cancel() {\n        task.cancel()\n    }\n\n    /// Resume the underlying `DataRequest`.\n    public func resume() {\n        request.resume()\n    }\n\n    /// Suspend the underlying `DataRequest`.\n    public func suspend() {\n        request.suspend()\n    }\n}\n\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\nextension DataRequest {\n    /// Creates a `DataTask` to `await` a `Data` value.\n    ///\n    /// - Parameters:\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DataTask`'s async\n    ///                                properties. `false` by default.\n    ///   - dataPreprocessor:          `DataPreprocessor` which processes the received `Data` before completion.\n    ///   - emptyResponseCodes:        HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods:       `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///\n    /// - Returns: The `DataTask`.\n    public func serializingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,\n                                dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                                emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                                emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DataTask<Data> {\n        serializingResponse(using: DataResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                          emptyResponseCodes: emptyResponseCodes,\n                                                          emptyRequestMethods: emptyRequestMethods),\n                            automaticallyCancelling: shouldAutomaticallyCancel)\n    }\n\n    /// Creates a `DataTask` to `await` serialization of a `Decodable` value.\n    ///\n    /// - Parameters:\n    ///   - type:                      `Decodable` type to decode from response data.\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DataTask`'s async\n    ///                                properties. `false` by default.\n    ///   - dataPreprocessor:          `DataPreprocessor` which processes the received `Data` before calling the serializer.\n    ///                                `PassthroughPreprocessor()` by default.\n    ///   - decoder:                   `DataDecoder` to use to decode the response. `JSONDecoder()` by default.\n    ///   - emptyResponseCodes:        HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods:       `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///\n    /// - Returns: The `DataTask`.\n    public func serializingDecodable<Value: Decodable>(_ type: Value.Type = Value.self,\n                                                       automaticallyCancelling shouldAutomaticallyCancel: Bool = false,\n                                                       dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<Value>.defaultDataPreprocessor,\n                                                       decoder: DataDecoder = JSONDecoder(),\n                                                       emptyResponseCodes: Set<Int> = DecodableResponseSerializer<Value>.defaultEmptyResponseCodes,\n                                                       emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<Value>.defaultEmptyRequestMethods) -> DataTask<Value> {\n        serializingResponse(using: DecodableResponseSerializer<Value>(dataPreprocessor: dataPreprocessor,\n                                                                      decoder: decoder,\n                                                                      emptyResponseCodes: emptyResponseCodes,\n                                                                      emptyRequestMethods: emptyRequestMethods),\n                            automaticallyCancelling: shouldAutomaticallyCancel)\n    }\n\n    /// Creates a `DataTask` to `await` serialization of a `String` value.\n    ///\n    /// - Parameters:\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DataTask`'s async\n    ///                                properties. `false` by default.\n    ///   - dataPreprocessor:          `DataPreprocessor` which processes the received `Data` before calling the serializer.\n    ///                                `PassthroughPreprocessor()` by default.\n    ///   - encoding:                  `String.Encoding` to use during serialization. Defaults to `nil`, in which case\n    ///                                the encoding will be determined from the server response, falling back to the\n    ///                                default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:        HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods:       `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///\n    /// - Returns: The `DataTask`.\n    public func serializingString(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,\n                                  dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                                  encoding: String.Encoding? = nil,\n                                  emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                                  emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DataTask<String> {\n        serializingResponse(using: StringResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                            encoding: encoding,\n                                                            emptyResponseCodes: emptyResponseCodes,\n                                                            emptyRequestMethods: emptyRequestMethods),\n                            automaticallyCancelling: shouldAutomaticallyCancel)\n    }\n\n    /// Creates a `DataTask` to `await` serialization using the provided `ResponseSerializer` instance.\n    ///\n    /// - Parameters:\n    ///   - serializer:                `ResponseSerializer` responsible for serializing the request, response, and data.\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DataTask`'s async\n    ///                                properties. `false` by default.\n    ///\n    /// - Returns: The `DataTask`.\n    public func serializingResponse<Serializer: ResponseSerializer>(using serializer: Serializer,\n                                                                    automaticallyCancelling shouldAutomaticallyCancel: Bool = false)\n        -> DataTask<Serializer.SerializedObject> {\n        dataTask(automaticallyCancelling: shouldAutomaticallyCancel) {\n            self.response(queue: .singleEventQueue,\n                          responseSerializer: serializer,\n                          completionHandler: $0)\n        }\n    }\n\n    /// Creates a `DataTask` to `await` serialization using the provided `DataResponseSerializerProtocol` instance.\n    ///\n    /// - Parameters:\n    ///   - serializer:                `DataResponseSerializerProtocol` responsible for serializing the request,\n    ///                                response, and data.\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DataTask`'s async\n    ///                                properties. `false` by default.\n    ///\n    /// - Returns: The `DataTask`.\n    public func serializingResponse<Serializer: DataResponseSerializerProtocol>(using serializer: Serializer,\n                                                                                automaticallyCancelling shouldAutomaticallyCancel: Bool = false)\n        -> DataTask<Serializer.SerializedObject> {\n        dataTask(automaticallyCancelling: shouldAutomaticallyCancel) {\n            self.response(queue: .singleEventQueue,\n                          responseSerializer: serializer,\n                          completionHandler: $0)\n        }\n    }\n\n    private func dataTask<Value>(automaticallyCancelling shouldAutomaticallyCancel: Bool,\n                                 forResponse onResponse: @escaping (@escaping (DataResponse<Value, AFError>) -> Void) -> Void)\n        -> DataTask<Value> {\n        let task = Task {\n            await withTaskCancellationHandler {\n                self.cancel()\n            } operation: {\n                await withCheckedContinuation { continuation in\n                    onResponse {\n                        continuation.resume(returning: $0)\n                    }\n                }\n            }\n        }\n\n        return DataTask<Value>(request: self, task: task, shouldAutomaticallyCancel: shouldAutomaticallyCancel)\n    }\n}\n\n// MARK: - DownloadTask\n\n/// Value used to `await` a `DownloadResponse` and associated values.\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\npublic struct DownloadTask<Value> {\n    /// `DownloadResponse` produced by the `DownloadRequest` and its response handler.\n    public var response: DownloadResponse<Value, AFError> {\n        get async {\n            if shouldAutomaticallyCancel {\n                return await withTaskCancellationHandler {\n                    self.cancel()\n                } operation: {\n                    await task.value\n                }\n            } else {\n                return await task.value\n            }\n        }\n    }\n\n    /// `Result` of any response serialization performed for the `response`.\n    public var result: Result<Value, AFError> {\n        get async { await response.result }\n    }\n\n    /// `Value` returned by the `response`.\n    public var value: Value {\n        get async throws {\n            try await result.get()\n        }\n    }\n\n    private let task: Task<AFDownloadResponse<Value>, Never>\n    private let request: DownloadRequest\n    private let shouldAutomaticallyCancel: Bool\n\n    fileprivate init(request: DownloadRequest, task: Task<AFDownloadResponse<Value>, Never>, shouldAutomaticallyCancel: Bool) {\n        self.request = request\n        self.task = task\n        self.shouldAutomaticallyCancel = shouldAutomaticallyCancel\n    }\n\n    /// Cancel the underlying `DownloadRequest` and `Task`.\n    public func cancel() {\n        task.cancel()\n    }\n\n    /// Resume the underlying `DownloadRequest`.\n    public func resume() {\n        request.resume()\n    }\n\n    /// Suspend the underlying `DownloadRequest`.\n    public func suspend() {\n        request.suspend()\n    }\n}\n\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\nextension DownloadRequest {\n    /// Creates a `DownloadTask` to `await` a `Data` value.\n    ///\n    /// - Parameters:\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DownloadTask`'s async\n    ///                                properties. `false` by default.\n    ///   - dataPreprocessor:          `DataPreprocessor` which processes the received `Data` before completion.\n    ///   - emptyResponseCodes:        HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods:       `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///\n    /// - Returns:                   The `DownloadTask`.\n    public func serializingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,\n                                dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                                emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                                emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DownloadTask<Data> {\n        serializingDownload(using: DataResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                          emptyResponseCodes: emptyResponseCodes,\n                                                          emptyRequestMethods: emptyRequestMethods),\n                            automaticallyCancelling: shouldAutomaticallyCancel)\n    }\n\n    /// Creates a `DownloadTask` to `await` serialization of a `Decodable` value.\n    ///\n    /// - Note: This serializer reads the entire response into memory before parsing.\n    ///\n    /// - Parameters:\n    ///   - type:                      `Decodable` type to decode from response data.\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DownloadTask`'s async\n    ///                                properties. `false` by default.\n    ///   - dataPreprocessor:          `DataPreprocessor` which processes the received `Data` before calling the serializer.\n    ///                                `PassthroughPreprocessor()` by default.\n    ///   - decoder:                   `DataDecoder` to use to decode the response. `JSONDecoder()` by default.\n    ///   - emptyResponseCodes:        HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods:       `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///\n    /// - Returns:                   The `DownloadTask`.\n    public func serializingDecodable<Value: Decodable>(_ type: Value.Type = Value.self,\n                                                       automaticallyCancelling shouldAutomaticallyCancel: Bool = false,\n                                                       dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<Value>.defaultDataPreprocessor,\n                                                       decoder: DataDecoder = JSONDecoder(),\n                                                       emptyResponseCodes: Set<Int> = DecodableResponseSerializer<Value>.defaultEmptyResponseCodes,\n                                                       emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<Value>.defaultEmptyRequestMethods) -> DownloadTask<Value> {\n        serializingDownload(using: DecodableResponseSerializer<Value>(dataPreprocessor: dataPreprocessor,\n                                                                      decoder: decoder,\n                                                                      emptyResponseCodes: emptyResponseCodes,\n                                                                      emptyRequestMethods: emptyRequestMethods),\n                            automaticallyCancelling: shouldAutomaticallyCancel)\n    }\n\n    /// Creates a `DownloadTask` to `await` serialization of the downloaded file's `URL` on disk.\n    ///\n    /// - Parameters:\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DownloadTask`'s async\n    ///                                properties. `false` by default.\n    ///\n    /// - Returns: The `DownloadTask`.\n    public func serializingDownloadedFileURL(automaticallyCancelling shouldAutomaticallyCancel: Bool = false) -> DownloadTask<URL> {\n        serializingDownload(using: URLResponseSerializer(),\n                            automaticallyCancelling: shouldAutomaticallyCancel)\n    }\n\n    /// Creates a `DownloadTask` to `await` serialization of a `String` value.\n    ///\n    /// - Parameters:\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DownloadTask`'s async\n    ///                                properties. `false` by default.\n    ///   - dataPreprocessor:          `DataPreprocessor` which processes the received `Data` before calling the\n    ///                                serializer. `PassthroughPreprocessor()` by default.\n    ///   - encoding:                  `String.Encoding` to use during serialization. Defaults to `nil`, in which case\n    ///                                the encoding will be determined from the server response, falling back to the\n    ///                                default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:        HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods:       `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///\n    /// - Returns:                   The `DownloadTask`.\n    public func serializingString(automaticallyCancelling shouldAutomaticallyCancel: Bool = false,\n                                  dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                                  encoding: String.Encoding? = nil,\n                                  emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                                  emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DownloadTask<String> {\n        serializingDownload(using: StringResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                            encoding: encoding,\n                                                            emptyResponseCodes: emptyResponseCodes,\n                                                            emptyRequestMethods: emptyRequestMethods),\n                            automaticallyCancelling: shouldAutomaticallyCancel)\n    }\n\n    /// Creates a `DownloadTask` to `await` serialization using the provided `ResponseSerializer` instance.\n    ///\n    /// - Parameters:\n    ///   - serializer:                `ResponseSerializer` responsible for serializing the request, response, and data.\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DownloadTask`'s async\n    ///                                properties. `false` by default.\n    ///\n    /// - Returns: The `DownloadTask`.\n    public func serializingDownload<Serializer: ResponseSerializer>(using serializer: Serializer,\n                                                                    automaticallyCancelling shouldAutomaticallyCancel: Bool = false)\n        -> DownloadTask<Serializer.SerializedObject> {\n        downloadTask(automaticallyCancelling: shouldAutomaticallyCancel) {\n            self.response(queue: .singleEventQueue,\n                          responseSerializer: serializer,\n                          completionHandler: $0)\n        }\n    }\n\n    /// Creates a `DownloadTask` to `await` serialization using the provided `DownloadResponseSerializerProtocol`\n    /// instance.\n    ///\n    /// - Parameters:\n    ///   - serializer:                `DownloadResponseSerializerProtocol` responsible for serializing the request,\n    ///                                response, and data.\n    ///   - shouldAutomaticallyCancel: `Bool` determining whether or not the request should be cancelled when the\n    ///                                enclosing async context is cancelled. Only applies to `DownloadTask`'s async\n    ///                                properties. `false` by default.\n    ///\n    /// - Returns: The `DownloadTask`.\n    public func serializingDownload<Serializer: DownloadResponseSerializerProtocol>(using serializer: Serializer,\n                                                                                    automaticallyCancelling shouldAutomaticallyCancel: Bool = false)\n        -> DownloadTask<Serializer.SerializedObject> {\n        downloadTask(automaticallyCancelling: shouldAutomaticallyCancel) {\n            self.response(queue: .singleEventQueue,\n                          responseSerializer: serializer,\n                          completionHandler: $0)\n        }\n    }\n\n    private func downloadTask<Value>(automaticallyCancelling shouldAutomaticallyCancel: Bool,\n                                     forResponse onResponse: @escaping (@escaping (DownloadResponse<Value, AFError>) -> Void) -> Void)\n        -> DownloadTask<Value> {\n        let task = Task {\n            await withTaskCancellationHandler {\n                self.cancel()\n            } operation: {\n                await withCheckedContinuation { continuation in\n                    onResponse {\n                        continuation.resume(returning: $0)\n                    }\n                }\n            }\n        }\n\n        return DownloadTask<Value>(request: self, task: task, shouldAutomaticallyCancel: shouldAutomaticallyCancel)\n    }\n}\n\n// MARK: - DataStreamTask\n\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\npublic struct DataStreamTask {\n    // Type of created streams.\n    public typealias Stream<Success, Failure: Error> = StreamOf<DataStreamRequest.Stream<Success, Failure>>\n\n    private let request: DataStreamRequest\n\n    fileprivate init(request: DataStreamRequest) {\n        self.request = request\n    }\n\n    /// Creates a `Stream` of `Data` values from the underlying `DataStreamRequest`.\n    ///\n    /// - Parameters:\n    ///   - shouldAutomaticallyCancel: `Bool` indicating whether the underlying `DataStreamRequest` should be canceled\n    ///                                which observation of the stream stops. `true` by default.\n    ///   - bufferingPolicy: `         BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:                   The `Stream`.\n    public func streamingData(automaticallyCancelling shouldAutomaticallyCancel: Bool = true, bufferingPolicy: Stream<Data, Never>.BufferingPolicy = .unbounded) -> Stream<Data, Never> {\n        createStream(automaticallyCancelling: shouldAutomaticallyCancel, bufferingPolicy: bufferingPolicy) { onStream in\n            self.request.responseStream(on: .streamCompletionQueue(forRequestID: request.id), stream: onStream)\n        }\n    }\n\n    /// Creates a `Stream` of `UTF-8` `String`s from the underlying `DataStreamRequest`.\n    ///\n    /// - Parameters:\n    ///   - shouldAutomaticallyCancel: `Bool` indicating whether the underlying `DataStreamRequest` should be canceled\n    ///                                which observation of the stream stops. `true` by default.\n    ///   - bufferingPolicy: `         BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    /// - Returns:\n    public func streamingStrings(automaticallyCancelling shouldAutomaticallyCancel: Bool = true, bufferingPolicy: Stream<String, Never>.BufferingPolicy = .unbounded) -> Stream<String, Never> {\n        createStream(automaticallyCancelling: shouldAutomaticallyCancel, bufferingPolicy: bufferingPolicy) { onStream in\n            self.request.responseStreamString(on: .streamCompletionQueue(forRequestID: request.id), stream: onStream)\n        }\n    }\n\n    /// Creates a `Stream` of `Decodable` values from the underlying `DataStreamRequest`.\n    ///\n    /// - Parameters:\n    ///   - type:                      `Decodable` type to be serialized from stream payloads.\n    ///   - shouldAutomaticallyCancel: `Bool` indicating whether the underlying `DataStreamRequest` should be canceled\n    ///                                which observation of the stream stops. `true` by default.\n    ///   - bufferingPolicy:           `BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:            The `Stream`.\n    public func streamingDecodables<T>(_ type: T.Type = T.self,\n                                       automaticallyCancelling shouldAutomaticallyCancel: Bool = true,\n                                       bufferingPolicy: Stream<T, AFError>.BufferingPolicy = .unbounded)\n        -> Stream<T, AFError> where T: Decodable {\n        streamingResponses(serializedUsing: DecodableStreamSerializer<T>(),\n                           automaticallyCancelling: shouldAutomaticallyCancel,\n                           bufferingPolicy: bufferingPolicy)\n    }\n\n    /// Creates a `Stream` of values using the provided `DataStreamSerializer` from the underlying `DataStreamRequest`.\n    ///\n    /// - Parameters:\n    ///   - serializer:                `DataStreamSerializer` to use to serialize incoming `Data`.\n    ///   - shouldAutomaticallyCancel: `Bool` indicating whether the underlying `DataStreamRequest` should be canceled\n    ///                                which observation of the stream stops. `true` by default.\n    ///   - bufferingPolicy:           `BufferingPolicy` that determines the stream's buffering behavior.`.unbounded` by default.\n    ///\n    /// - Returns:           The `Stream`.\n    public func streamingResponses<Serializer: DataStreamSerializer>(serializedUsing serializer: Serializer,\n                                                                     automaticallyCancelling shouldAutomaticallyCancel: Bool = true,\n                                                                     bufferingPolicy: Stream<Serializer.SerializedObject, AFError>.BufferingPolicy = .unbounded)\n        -> Stream<Serializer.SerializedObject, AFError> {\n        createStream(automaticallyCancelling: shouldAutomaticallyCancel, bufferingPolicy: bufferingPolicy) { onStream in\n            self.request.responseStream(using: serializer,\n                                        on: .streamCompletionQueue(forRequestID: request.id),\n                                        stream: onStream)\n        }\n    }\n\n    private func createStream<Success, Failure: Error>(automaticallyCancelling shouldAutomaticallyCancel: Bool = true,\n                                                       bufferingPolicy: Stream<Success, Failure>.BufferingPolicy = .unbounded,\n                                                       forResponse onResponse: @escaping (@escaping (DataStreamRequest.Stream<Success, Failure>) -> Void) -> Void)\n        -> Stream<Success, Failure> {\n        StreamOf(bufferingPolicy: bufferingPolicy) {\n            guard shouldAutomaticallyCancel,\n                  request.isInitialized || request.isResumed || request.isSuspended else { return }\n\n            cancel()\n        } builder: { continuation in\n            onResponse { stream in\n                continuation.yield(stream)\n                if case .complete = stream.event {\n                    continuation.finish()\n                }\n            }\n        }\n    }\n\n    /// Cancel the underlying `DataStreamRequest`.\n    public func cancel() {\n        request.cancel()\n    }\n\n    /// Resume the underlying `DataStreamRequest`.\n    public func resume() {\n        request.resume()\n    }\n\n    /// Suspend the underlying `DataStreamRequest`.\n    public func suspend() {\n        request.suspend()\n    }\n}\n\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\nextension DataStreamRequest {\n    /// Creates a `DataStreamTask` used to `await` streams of serialized values.\n    ///\n    /// - Returns: The `DataStreamTask`.\n    public func streamTask() -> DataStreamTask {\n        DataStreamTask(request: self)\n    }\n}\n\nextension DispatchQueue {\n    fileprivate static let singleEventQueue = DispatchQueue(label: \"org.alamofire.concurrencySingleEventQueue\",\n                                                            attributes: .concurrent)\n\n    fileprivate static func streamCompletionQueue(forRequestID id: UUID) -> DispatchQueue {\n        DispatchQueue(label: \"org.alamofire.concurrencyStreamCompletionQueue-\\(id)\", target: .singleEventQueue)\n    }\n}\n\n/// An asynchronous sequence generated from an underlying `AsyncStream`. Only produced by Alamofire.\n@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)\npublic struct StreamOf<Element>: AsyncSequence {\n    public typealias AsyncIterator = Iterator\n    public typealias BufferingPolicy = AsyncStream<Element>.Continuation.BufferingPolicy\n    fileprivate typealias Continuation = AsyncStream<Element>.Continuation\n\n    private let bufferingPolicy: BufferingPolicy\n    private let onTermination: (() -> Void)?\n    private let builder: (Continuation) -> Void\n\n    fileprivate init(bufferingPolicy: BufferingPolicy = .unbounded,\n                     onTermination: (() -> Void)? = nil,\n                     builder: @escaping (Continuation) -> Void) {\n        self.bufferingPolicy = bufferingPolicy\n        self.onTermination = onTermination\n        self.builder = builder\n    }\n\n    public func makeAsyncIterator() -> Iterator {\n        var continuation: AsyncStream<Element>.Continuation?\n        let stream = AsyncStream<Element> { innerContinuation in\n            continuation = innerContinuation\n            builder(innerContinuation)\n        }\n\n        return Iterator(iterator: stream.makeAsyncIterator()) {\n            continuation?.finish()\n            self.onTermination?()\n        }\n    }\n\n    public struct Iterator: AsyncIteratorProtocol {\n        private final class Token {\n            private let onDeinit: () -> Void\n\n            init(onDeinit: @escaping () -> Void) {\n                self.onDeinit = onDeinit\n            }\n\n            deinit {\n                onDeinit()\n            }\n        }\n\n        private var iterator: AsyncStream<Element>.AsyncIterator\n        private let token: Token\n\n        init(iterator: AsyncStream<Element>.AsyncIterator, onCancellation: @escaping () -> Void) {\n            self.iterator = iterator\n            token = Token(onDeinit: onCancellation)\n        }\n\n        public mutating func next() async -> Element? {\n            await iterator.next()\n        }\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift",
    "content": "//\n//  DispatchQueue+Alamofire.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Dispatch\nimport Foundation\n\nextension DispatchQueue {\n    /// Execute the provided closure after a `TimeInterval`.\n    ///\n    /// - Parameters:\n    ///   - delay:   `TimeInterval` to delay execution.\n    ///   - closure: Closure to execute.\n    func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) {\n        asyncAfter(deadline: .now() + delay, execute: closure)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/EventMonitor.swift",
    "content": "//\n//  EventMonitor.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Protocol outlining the lifetime events inside Alamofire. It includes both events received from the various\n/// `URLSession` delegate protocols as well as various events from the lifetime of `Request` and its subclasses.\npublic protocol EventMonitor {\n    /// The `DispatchQueue` onto which Alamofire's root `CompositeEventMonitor` will dispatch events. `.main` by default.\n    var queue: DispatchQueue { get }\n\n    // MARK: - URLSession Events\n\n    // MARK: URLSessionDelegate Events\n\n    /// Event called during `URLSessionDelegate`'s `urlSession(_:didBecomeInvalidWithError:)` method.\n    func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?)\n\n    // MARK: URLSessionTaskDelegate Events\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didReceive:completionHandler:)` method.\n    func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` method.\n    func urlSession(_ session: URLSession,\n                    task: URLSessionTask,\n                    didSendBodyData bytesSent: Int64,\n                    totalBytesSent: Int64,\n                    totalBytesExpectedToSend: Int64)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:needNewBodyStream:)` method.\n    func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` method.\n    func urlSession(_ session: URLSession,\n                    task: URLSessionTask,\n                    willPerformHTTPRedirection response: HTTPURLResponse,\n                    newRequest request: URLRequest)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didFinishCollecting:)` method.\n    func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didCompleteWithError:)` method.\n    func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:taskIsWaitingForConnectivity:)` method.\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask)\n\n    // MARK: URLSessionDataDelegate Events\n\n    /// Event called during `URLSessionDataDelegate`'s `urlSession(_:dataTask:didReceive:)` method.\n    func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data)\n\n    /// Event called during `URLSessionDataDelegate`'s `urlSession(_:dataTask:willCacheResponse:completionHandler:)` method.\n    func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse)\n\n    // MARK: URLSessionDownloadDelegate Events\n\n    /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)` method.\n    func urlSession(_ session: URLSession,\n                    downloadTask: URLSessionDownloadTask,\n                    didResumeAtOffset fileOffset: Int64,\n                    expectedTotalBytes: Int64)\n\n    /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)` method.\n    func urlSession(_ session: URLSession,\n                    downloadTask: URLSessionDownloadTask,\n                    didWriteData bytesWritten: Int64,\n                    totalBytesWritten: Int64,\n                    totalBytesExpectedToWrite: Int64)\n\n    /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didFinishDownloadingTo:)` method.\n    func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL)\n\n    // MARK: - Request Events\n\n    /// Event called when a `URLRequest` is first created for a `Request`. If a `RequestAdapter` is active, the\n    /// `URLRequest` will be adapted before being issued.\n    func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest)\n\n    /// Event called when the attempt to create a `URLRequest` from a `Request`'s original `URLRequestConvertible` value fails.\n    func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError)\n\n    /// Event called when a `RequestAdapter` adapts the `Request`'s initial `URLRequest`.\n    func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest)\n\n    /// Event called when a `RequestAdapter` fails to adapt the `Request`'s initial `URLRequest`.\n    func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: AFError)\n\n    /// Event called when a final `URLRequest` is created for a `Request`.\n    func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest)\n\n    /// Event called when a `URLSessionTask` subclass instance is created for a `Request`.\n    func request(_ request: Request, didCreateTask task: URLSessionTask)\n\n    /// Event called when a `Request` receives a `URLSessionTaskMetrics` value.\n    func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics)\n\n    /// Event called when a `Request` fails due to an error created by Alamofire. e.g. When certificate pinning fails.\n    func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError)\n\n    /// Event called when a `Request`'s task completes, possibly with an error. A `Request` may receive this event\n    /// multiple times if it is retried.\n    func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?)\n\n    /// Event called when a `Request` is about to be retried.\n    func requestIsRetrying(_ request: Request)\n\n    /// Event called when a `Request` finishes and response serializers are being called.\n    func requestDidFinish(_ request: Request)\n\n    /// Event called when a `Request` receives a `resume` call.\n    func requestDidResume(_ request: Request)\n\n    /// Event called when a `Request`'s associated `URLSessionTask` is resumed.\n    func request(_ request: Request, didResumeTask task: URLSessionTask)\n\n    /// Event called when a `Request` receives a `suspend` call.\n    func requestDidSuspend(_ request: Request)\n\n    /// Event called when a `Request`'s associated `URLSessionTask` is suspended.\n    func request(_ request: Request, didSuspendTask task: URLSessionTask)\n\n    /// Event called when a `Request` receives a `cancel` call.\n    func requestDidCancel(_ request: Request)\n\n    /// Event called when a `Request`'s associated `URLSessionTask` is cancelled.\n    func request(_ request: Request, didCancelTask task: URLSessionTask)\n\n    // MARK: DataRequest Events\n\n    /// Event called when a `DataRequest` calls a `Validation`.\n    func request(_ request: DataRequest,\n                 didValidateRequest urlRequest: URLRequest?,\n                 response: HTTPURLResponse,\n                 data: Data?,\n                 withResult result: Request.ValidationResult)\n\n    /// Event called when a `DataRequest` creates a `DataResponse<Data?>` value without calling a `ResponseSerializer`.\n    func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>)\n\n    /// Event called when a `DataRequest` calls a `ResponseSerializer` and creates a generic `DataResponse<Value, AFError>`.\n    func request<Value>(_ request: DataRequest, didParseResponse response: DataResponse<Value, AFError>)\n\n    // MARK: DataStreamRequest Events\n\n    /// Event called when a `DataStreamRequest` calls a `Validation` closure.\n    ///\n    /// - Parameters:\n    ///   - request:    `DataStreamRequest` which is calling the `Validation`.\n    ///   - urlRequest: `URLRequest` of the request being validated.\n    ///   - response:   `HTTPURLResponse` of the request being validated.\n    ///   - result:      Produced `ValidationResult`.\n    func request(_ request: DataStreamRequest,\n                 didValidateRequest urlRequest: URLRequest?,\n                 response: HTTPURLResponse,\n                 withResult result: Request.ValidationResult)\n\n    /// Event called when a `DataStreamSerializer` produces a value from streamed `Data`.\n    ///\n    /// - Parameters:\n    ///   - request: `DataStreamRequest` for which the value was serialized.\n    ///   - result:  `Result` of the serialization attempt.\n    func request<Value>(_ request: DataStreamRequest, didParseStream result: Result<Value, AFError>)\n\n    // MARK: UploadRequest Events\n\n    /// Event called when an `UploadRequest` creates its `Uploadable` value, indicating the type of upload it represents.\n    func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable)\n\n    /// Event called when an `UploadRequest` failed to create its `Uploadable` value due to an error.\n    func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError)\n\n    /// Event called when an `UploadRequest` provides the `InputStream` from its `Uploadable` value. This only occurs if\n    /// the `InputStream` does not wrap a `Data` value or file `URL`.\n    func request(_ request: UploadRequest, didProvideInputStream stream: InputStream)\n\n    // MARK: DownloadRequest Events\n\n    /// Event called when a `DownloadRequest`'s `URLSessionDownloadTask` finishes and the temporary file has been moved.\n    func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>)\n\n    /// Event called when a `DownloadRequest`'s `Destination` closure is called and creates the destination URL the\n    /// downloaded file will be moved to.\n    func request(_ request: DownloadRequest, didCreateDestinationURL url: URL)\n\n    /// Event called when a `DownloadRequest` calls a `Validation`.\n    func request(_ request: DownloadRequest,\n                 didValidateRequest urlRequest: URLRequest?,\n                 response: HTTPURLResponse,\n                 fileURL: URL?,\n                 withResult result: Request.ValidationResult)\n\n    /// Event called when a `DownloadRequest` creates a `DownloadResponse<URL?, AFError>` without calling a `ResponseSerializer`.\n    func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>)\n\n    /// Event called when a `DownloadRequest` calls a `DownloadResponseSerializer` and creates a generic `DownloadResponse<Value, AFError>`\n    func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>)\n}\n\nextension EventMonitor {\n    /// The default queue on which `CompositeEventMonitor`s will call the `EventMonitor` methods. `.main` by default.\n    public var queue: DispatchQueue { .main }\n\n    // MARK: Default Implementations\n\n    public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didReceive challenge: URLAuthenticationChallenge) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didSendBodyData bytesSent: Int64,\n                           totalBytesSent: Int64,\n                           totalBytesExpectedToSend: Int64) {}\n    public func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           willPerformHTTPRedirection response: HTTPURLResponse,\n                           newRequest request: URLRequest) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didFinishCollecting metrics: URLSessionTaskMetrics) {}\n    public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {}\n    public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {}\n    public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {}\n    public func urlSession(_ session: URLSession,\n                           dataTask: URLSessionDataTask,\n                           willCacheResponse proposedResponse: CachedURLResponse) {}\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didResumeAtOffset fileOffset: Int64,\n                           expectedTotalBytes: Int64) {}\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didWriteData bytesWritten: Int64,\n                           totalBytesWritten: Int64,\n                           totalBytesExpectedToWrite: Int64) {}\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didFinishDownloadingTo location: URL) {}\n    public func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest) {}\n    public func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError) {}\n    public func request(_ request: Request,\n                        didAdaptInitialRequest initialRequest: URLRequest,\n                        to adaptedRequest: URLRequest) {}\n    public func request(_ request: Request,\n                        didFailToAdaptURLRequest initialRequest: URLRequest,\n                        withError error: AFError) {}\n    public func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) {}\n    public func request(_ request: Request, didCreateTask task: URLSessionTask) {}\n    public func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) {}\n    public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError) {}\n    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {}\n    public func requestIsRetrying(_ request: Request) {}\n    public func requestDidFinish(_ request: Request) {}\n    public func requestDidResume(_ request: Request) {}\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {}\n    public func requestDidSuspend(_ request: Request) {}\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {}\n    public func requestDidCancel(_ request: Request) {}\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {}\n    public func request(_ request: DataRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        data: Data?,\n                        withResult result: Request.ValidationResult) {}\n    public func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>) {}\n    public func request<Value>(_ request: DataRequest, didParseResponse response: DataResponse<Value, AFError>) {}\n    public func request(_ request: DataStreamRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        withResult result: Request.ValidationResult) {}\n    public func request<Value>(_ request: DataStreamRequest, didParseStream result: Result<Value, AFError>) {}\n    public func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) {}\n    public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError) {}\n    public func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) {}\n    public func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>) {}\n    public func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) {}\n    public func request(_ request: DownloadRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        fileURL: URL?,\n                        withResult result: Request.ValidationResult) {}\n    public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>) {}\n    public func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>) {}\n}\n\n/// An `EventMonitor` which can contain multiple `EventMonitor`s and calls their methods on their queues.\npublic final class CompositeEventMonitor: EventMonitor {\n    public let queue = DispatchQueue(label: \"org.alamofire.compositeEventMonitor\", qos: .utility)\n\n    let monitors: [EventMonitor]\n\n    init(monitors: [EventMonitor]) {\n        self.monitors = monitors\n    }\n\n    func performEvent(_ event: @escaping (EventMonitor) -> Void) {\n        queue.async {\n            for monitor in self.monitors {\n                monitor.queue.async { event(monitor) }\n            }\n        }\n    }\n\n    public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {\n        performEvent { $0.urlSession(session, didBecomeInvalidWithError: error) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didReceive challenge: URLAuthenticationChallenge) {\n        performEvent { $0.urlSession(session, task: task, didReceive: challenge) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didSendBodyData bytesSent: Int64,\n                           totalBytesSent: Int64,\n                           totalBytesExpectedToSend: Int64) {\n        performEvent {\n            $0.urlSession(session,\n                          task: task,\n                          didSendBodyData: bytesSent,\n                          totalBytesSent: totalBytesSent,\n                          totalBytesExpectedToSend: totalBytesExpectedToSend)\n        }\n    }\n\n    public func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) {\n        performEvent {\n            $0.urlSession(session, taskNeedsNewBodyStream: task)\n        }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           willPerformHTTPRedirection response: HTTPURLResponse,\n                           newRequest request: URLRequest) {\n        performEvent {\n            $0.urlSession(session,\n                          task: task,\n                          willPerformHTTPRedirection: response,\n                          newRequest: request)\n        }\n    }\n\n    public func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {\n        performEvent { $0.urlSession(session, task: task, didFinishCollecting: metrics) }\n    }\n\n    public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {\n        performEvent { $0.urlSession(session, task: task, didCompleteWithError: error) }\n    }\n\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {\n        performEvent { $0.urlSession(session, taskIsWaitingForConnectivity: task) }\n    }\n\n    public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {\n        performEvent { $0.urlSession(session, dataTask: dataTask, didReceive: data) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           dataTask: URLSessionDataTask,\n                           willCacheResponse proposedResponse: CachedURLResponse) {\n        performEvent { $0.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didResumeAtOffset fileOffset: Int64,\n                           expectedTotalBytes: Int64) {\n        performEvent {\n            $0.urlSession(session,\n                          downloadTask: downloadTask,\n                          didResumeAtOffset: fileOffset,\n                          expectedTotalBytes: expectedTotalBytes)\n        }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didWriteData bytesWritten: Int64,\n                           totalBytesWritten: Int64,\n                           totalBytesExpectedToWrite: Int64) {\n        performEvent {\n            $0.urlSession(session,\n                          downloadTask: downloadTask,\n                          didWriteData: bytesWritten,\n                          totalBytesWritten: totalBytesWritten,\n                          totalBytesExpectedToWrite: totalBytesExpectedToWrite)\n        }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didFinishDownloadingTo location: URL) {\n        performEvent { $0.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) }\n    }\n\n    public func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest) {\n        performEvent { $0.request(request, didCreateInitialURLRequest: urlRequest) }\n    }\n\n    public func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError) {\n        performEvent { $0.request(request, didFailToCreateURLRequestWithError: error) }\n    }\n\n    public func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest) {\n        performEvent { $0.request(request, didAdaptInitialRequest: initialRequest, to: adaptedRequest) }\n    }\n\n    public func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: AFError) {\n        performEvent { $0.request(request, didFailToAdaptURLRequest: initialRequest, withError: error) }\n    }\n\n    public func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) {\n        performEvent { $0.request(request, didCreateURLRequest: urlRequest) }\n    }\n\n    public func request(_ request: Request, didCreateTask task: URLSessionTask) {\n        performEvent { $0.request(request, didCreateTask: task) }\n    }\n\n    public func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) {\n        performEvent { $0.request(request, didGatherMetrics: metrics) }\n    }\n\n    public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError) {\n        performEvent { $0.request(request, didFailTask: task, earlyWithError: error) }\n    }\n\n    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {\n        performEvent { $0.request(request, didCompleteTask: task, with: error) }\n    }\n\n    public func requestIsRetrying(_ request: Request) {\n        performEvent { $0.requestIsRetrying(request) }\n    }\n\n    public func requestDidFinish(_ request: Request) {\n        performEvent { $0.requestDidFinish(request) }\n    }\n\n    public func requestDidResume(_ request: Request) {\n        performEvent { $0.requestDidResume(request) }\n    }\n\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {\n        performEvent { $0.request(request, didResumeTask: task) }\n    }\n\n    public func requestDidSuspend(_ request: Request) {\n        performEvent { $0.requestDidSuspend(request) }\n    }\n\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {\n        performEvent { $0.request(request, didSuspendTask: task) }\n    }\n\n    public func requestDidCancel(_ request: Request) {\n        performEvent { $0.requestDidCancel(request) }\n    }\n\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {\n        performEvent { $0.request(request, didCancelTask: task) }\n    }\n\n    public func request(_ request: DataRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        data: Data?,\n                        withResult result: Request.ValidationResult) {\n        performEvent { $0.request(request,\n                                  didValidateRequest: urlRequest,\n                                  response: response,\n                                  data: data,\n                                  withResult: result)\n        }\n    }\n\n    public func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n\n    public func request<Value>(_ request: DataRequest, didParseResponse response: DataResponse<Value, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n\n    public func request(_ request: DataStreamRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        withResult result: Request.ValidationResult) {\n        performEvent { $0.request(request,\n                                  didValidateRequest: urlRequest,\n                                  response: response,\n                                  withResult: result)\n        }\n    }\n\n    public func request<Value>(_ request: DataStreamRequest, didParseStream result: Result<Value, AFError>) {\n        performEvent { $0.request(request, didParseStream: result) }\n    }\n\n    public func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) {\n        performEvent { $0.request(request, didCreateUploadable: uploadable) }\n    }\n\n    public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError) {\n        performEvent { $0.request(request, didFailToCreateUploadableWithError: error) }\n    }\n\n    public func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) {\n        performEvent { $0.request(request, didProvideInputStream: stream) }\n    }\n\n    public func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>) {\n        performEvent { $0.request(request, didFinishDownloadingUsing: task, with: result) }\n    }\n\n    public func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) {\n        performEvent { $0.request(request, didCreateDestinationURL: url) }\n    }\n\n    public func request(_ request: DownloadRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        fileURL: URL?,\n                        withResult result: Request.ValidationResult) {\n        performEvent { $0.request(request,\n                                  didValidateRequest: urlRequest,\n                                  response: response,\n                                  fileURL: fileURL,\n                                  withResult: result) }\n    }\n\n    public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n\n    public func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n}\n\n/// `EventMonitor` that allows optional closures to be set to receive events.\nopen class ClosureEventMonitor: EventMonitor {\n    /// Closure called on the `urlSession(_:didBecomeInvalidWithError:)` event.\n    open var sessionDidBecomeInvalidWithError: ((URLSession, Error?) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:didReceive:completionHandler:)`.\n    open var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> Void)?\n\n    /// Closure that receives `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` event.\n    open var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:needNewBodyStream:)` event.\n    open var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` event.\n    open var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:didFinishCollecting:)` event.\n    open var taskDidFinishCollectingMetrics: ((URLSession, URLSessionTask, URLSessionTaskMetrics) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:didCompleteWithError:)` event.\n    open var taskDidComplete: ((URLSession, URLSessionTask, Error?) -> Void)?\n\n    /// Closure called on the `urlSession(_:taskIsWaitingForConnectivity:)` event.\n    open var taskIsWaitingForConnectivity: ((URLSession, URLSessionTask) -> Void)?\n\n    /// Closure that receives the `urlSession(_:dataTask:didReceive:)` event.\n    open var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)?\n\n    /// Closure called on the `urlSession(_:dataTask:willCacheResponse:completionHandler:)` event.\n    open var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> Void)?\n\n    /// Closure called on the `urlSession(_:downloadTask:didFinishDownloadingTo:)` event.\n    open var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> Void)?\n\n    /// Closure called on the `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)`\n    /// event.\n    open var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)?\n\n    /// Closure called on the `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)` event.\n    open var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)?\n\n    // MARK: - Request Events\n\n    /// Closure called on the `request(_:didCreateInitialURLRequest:)` event.\n    open var requestDidCreateInitialURLRequest: ((Request, URLRequest) -> Void)?\n\n    /// Closure called on the `request(_:didFailToCreateURLRequestWithError:)` event.\n    open var requestDidFailToCreateURLRequestWithError: ((Request, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didAdaptInitialRequest:to:)` event.\n    open var requestDidAdaptInitialRequestToAdaptedRequest: ((Request, URLRequest, URLRequest) -> Void)?\n\n    /// Closure called on the `request(_:didFailToAdaptURLRequest:withError:)` event.\n    open var requestDidFailToAdaptURLRequestWithError: ((Request, URLRequest, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didCreateURLRequest:)` event.\n    open var requestDidCreateURLRequest: ((Request, URLRequest) -> Void)?\n\n    /// Closure called on the `request(_:didCreateTask:)` event.\n    open var requestDidCreateTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `request(_:didGatherMetrics:)` event.\n    open var requestDidGatherMetrics: ((Request, URLSessionTaskMetrics) -> Void)?\n\n    /// Closure called on the `request(_:didFailTask:earlyWithError:)` event.\n    open var requestDidFailTaskEarlyWithError: ((Request, URLSessionTask, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didCompleteTask:with:)` event.\n    open var requestDidCompleteTaskWithError: ((Request, URLSessionTask, AFError?) -> Void)?\n\n    /// Closure called on the `requestIsRetrying(_:)` event.\n    open var requestIsRetrying: ((Request) -> Void)?\n\n    /// Closure called on the `requestDidFinish(_:)` event.\n    open var requestDidFinish: ((Request) -> Void)?\n\n    /// Closure called on the `requestDidResume(_:)` event.\n    open var requestDidResume: ((Request) -> Void)?\n\n    /// Closure called on the `request(_:didResumeTask:)` event.\n    open var requestDidResumeTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `requestDidSuspend(_:)` event.\n    open var requestDidSuspend: ((Request) -> Void)?\n\n    /// Closure called on the `request(_:didSuspendTask:)` event.\n    open var requestDidSuspendTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `requestDidCancel(_:)` event.\n    open var requestDidCancel: ((Request) -> Void)?\n\n    /// Closure called on the `request(_:didCancelTask:)` event.\n    open var requestDidCancelTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `request(_:didValidateRequest:response:data:withResult:)` event.\n    open var requestDidValidateRequestResponseDataWithResult: ((DataRequest, URLRequest?, HTTPURLResponse, Data?, Request.ValidationResult) -> Void)?\n\n    /// Closure called on the `request(_:didParseResponse:)` event.\n    open var requestDidParseResponse: ((DataRequest, DataResponse<Data?, AFError>) -> Void)?\n\n    /// Closure called on the `request(_:didValidateRequest:response:withResult:)` event.\n    open var requestDidValidateRequestResponseWithResult: ((DataStreamRequest, URLRequest?, HTTPURLResponse, Request.ValidationResult) -> Void)?\n\n    /// Closure called on the `request(_:didCreateUploadable:)` event.\n    open var requestDidCreateUploadable: ((UploadRequest, UploadRequest.Uploadable) -> Void)?\n\n    /// Closure called on the `request(_:didFailToCreateUploadableWithError:)` event.\n    open var requestDidFailToCreateUploadableWithError: ((UploadRequest, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didProvideInputStream:)` event.\n    open var requestDidProvideInputStream: ((UploadRequest, InputStream) -> Void)?\n\n    /// Closure called on the `request(_:didFinishDownloadingUsing:with:)` event.\n    open var requestDidFinishDownloadingUsingTaskWithResult: ((DownloadRequest, URLSessionTask, Result<URL, AFError>) -> Void)?\n\n    /// Closure called on the `request(_:didCreateDestinationURL:)` event.\n    open var requestDidCreateDestinationURL: ((DownloadRequest, URL) -> Void)?\n\n    /// Closure called on the `request(_:didValidateRequest:response:temporaryURL:destinationURL:withResult:)` event.\n    open var requestDidValidateRequestResponseFileURLWithResult: ((DownloadRequest, URLRequest?, HTTPURLResponse, URL?, Request.ValidationResult) -> Void)?\n\n    /// Closure called on the `request(_:didParseResponse:)` event.\n    open var requestDidParseDownloadResponse: ((DownloadRequest, DownloadResponse<URL?, AFError>) -> Void)?\n\n    public let queue: DispatchQueue\n\n    /// Creates an instance using the provided queue.\n    ///\n    /// - Parameter queue: `DispatchQueue` on which events will fired. `.main` by default.\n    public init(queue: DispatchQueue = .main) {\n        self.queue = queue\n    }\n\n    open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {\n        sessionDidBecomeInvalidWithError?(session, error)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) {\n        taskDidReceiveChallenge?(session, task, challenge)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         didSendBodyData bytesSent: Int64,\n                         totalBytesSent: Int64,\n                         totalBytesExpectedToSend: Int64) {\n        taskDidSendBodyData?(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend)\n    }\n\n    open func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) {\n        taskNeedNewBodyStream?(session, task)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         willPerformHTTPRedirection response: HTTPURLResponse,\n                         newRequest request: URLRequest) {\n        taskWillPerformHTTPRedirection?(session, task, response, request)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {\n        taskDidFinishCollectingMetrics?(session, task, metrics)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {\n        taskDidComplete?(session, task, error)\n    }\n\n    open func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {\n        taskIsWaitingForConnectivity?(session, task)\n    }\n\n    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {\n        dataTaskDidReceiveData?(session, dataTask, data)\n    }\n\n    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) {\n        dataTaskWillCacheResponse?(session, dataTask, proposedResponse)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didResumeAtOffset fileOffset: Int64,\n                         expectedTotalBytes: Int64) {\n        downloadTaskDidResumeAtOffset?(session, downloadTask, fileOffset, expectedTotalBytes)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didWriteData bytesWritten: Int64,\n                         totalBytesWritten: Int64,\n                         totalBytesExpectedToWrite: Int64) {\n        downloadTaskDidWriteData?(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite)\n    }\n\n    open func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {\n        downloadTaskDidFinishDownloadingToURL?(session, downloadTask, location)\n    }\n\n    // MARK: Request Events\n\n    open func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest) {\n        requestDidCreateInitialURLRequest?(request, urlRequest)\n    }\n\n    open func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError) {\n        requestDidFailToCreateURLRequestWithError?(request, error)\n    }\n\n    open func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest) {\n        requestDidAdaptInitialRequestToAdaptedRequest?(request, initialRequest, adaptedRequest)\n    }\n\n    open func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: AFError) {\n        requestDidFailToAdaptURLRequestWithError?(request, initialRequest, error)\n    }\n\n    open func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) {\n        requestDidCreateURLRequest?(request, urlRequest)\n    }\n\n    open func request(_ request: Request, didCreateTask task: URLSessionTask) {\n        requestDidCreateTask?(request, task)\n    }\n\n    open func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) {\n        requestDidGatherMetrics?(request, metrics)\n    }\n\n    open func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError) {\n        requestDidFailTaskEarlyWithError?(request, task, error)\n    }\n\n    open func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {\n        requestDidCompleteTaskWithError?(request, task, error)\n    }\n\n    open func requestIsRetrying(_ request: Request) {\n        requestIsRetrying?(request)\n    }\n\n    open func requestDidFinish(_ request: Request) {\n        requestDidFinish?(request)\n    }\n\n    open func requestDidResume(_ request: Request) {\n        requestDidResume?(request)\n    }\n\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {\n        requestDidResumeTask?(request, task)\n    }\n\n    open func requestDidSuspend(_ request: Request) {\n        requestDidSuspend?(request)\n    }\n\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {\n        requestDidSuspendTask?(request, task)\n    }\n\n    open func requestDidCancel(_ request: Request) {\n        requestDidCancel?(request)\n    }\n\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {\n        requestDidCancelTask?(request, task)\n    }\n\n    open func request(_ request: DataRequest,\n                      didValidateRequest urlRequest: URLRequest?,\n                      response: HTTPURLResponse,\n                      data: Data?,\n                      withResult result: Request.ValidationResult) {\n        requestDidValidateRequestResponseDataWithResult?(request, urlRequest, response, data, result)\n    }\n\n    open func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>) {\n        requestDidParseResponse?(request, response)\n    }\n\n    public func request(_ request: DataStreamRequest, didValidateRequest urlRequest: URLRequest?, response: HTTPURLResponse, withResult result: Request.ValidationResult) {\n        requestDidValidateRequestResponseWithResult?(request, urlRequest, response, result)\n    }\n\n    open func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) {\n        requestDidCreateUploadable?(request, uploadable)\n    }\n\n    open func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError) {\n        requestDidFailToCreateUploadableWithError?(request, error)\n    }\n\n    open func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) {\n        requestDidProvideInputStream?(request, stream)\n    }\n\n    open func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>) {\n        requestDidFinishDownloadingUsingTaskWithResult?(request, task, result)\n    }\n\n    open func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) {\n        requestDidCreateDestinationURL?(request, url)\n    }\n\n    open func request(_ request: DownloadRequest,\n                      didValidateRequest urlRequest: URLRequest?,\n                      response: HTTPURLResponse,\n                      fileURL: URL?,\n                      withResult result: Request.ValidationResult) {\n        requestDidValidateRequestResponseFileURLWithResult?(request,\n                                                            urlRequest,\n                                                            response,\n                                                            fileURL,\n                                                            result)\n    }\n\n    open func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>) {\n        requestDidParseDownloadResponse?(request, response)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/HTTPHeaders.swift",
    "content": "//\n//  HTTPHeaders.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// An order-preserving and case-insensitive representation of HTTP headers.\npublic struct HTTPHeaders {\n    private var headers: [HTTPHeader] = []\n\n    /// Creates an empty instance.\n    public init() {}\n\n    /// Creates an instance from an array of `HTTPHeader`s. Duplicate case-insensitive names are collapsed into the last\n    /// name and value encountered.\n    public init(_ headers: [HTTPHeader]) {\n        self.init()\n\n        headers.forEach { update($0) }\n    }\n\n    /// Creates an instance from a `[String: String]`. Duplicate case-insensitive names are collapsed into the last name\n    /// and value encountered.\n    public init(_ dictionary: [String: String]) {\n        self.init()\n\n        dictionary.forEach { update(HTTPHeader(name: $0.key, value: $0.value)) }\n    }\n\n    /// Case-insensitively updates or appends an `HTTPHeader` into the instance using the provided `name` and `value`.\n    ///\n    /// - Parameters:\n    ///   - name:  The `HTTPHeader` name.\n    ///   - value: The `HTTPHeader value.\n    public mutating func add(name: String, value: String) {\n        update(HTTPHeader(name: name, value: value))\n    }\n\n    /// Case-insensitively updates or appends the provided `HTTPHeader` into the instance.\n    ///\n    /// - Parameter header: The `HTTPHeader` to update or append.\n    public mutating func add(_ header: HTTPHeader) {\n        update(header)\n    }\n\n    /// Case-insensitively updates or appends an `HTTPHeader` into the instance using the provided `name` and `value`.\n    ///\n    /// - Parameters:\n    ///   - name:  The `HTTPHeader` name.\n    ///   - value: The `HTTPHeader value.\n    public mutating func update(name: String, value: String) {\n        update(HTTPHeader(name: name, value: value))\n    }\n\n    /// Case-insensitively updates or appends the provided `HTTPHeader` into the instance.\n    ///\n    /// - Parameter header: The `HTTPHeader` to update or append.\n    public mutating func update(_ header: HTTPHeader) {\n        guard let index = headers.index(of: header.name) else {\n            headers.append(header)\n            return\n        }\n\n        headers.replaceSubrange(index...index, with: [header])\n    }\n\n    /// Case-insensitively removes an `HTTPHeader`, if it exists, from the instance.\n    ///\n    /// - Parameter name: The name of the `HTTPHeader` to remove.\n    public mutating func remove(name: String) {\n        guard let index = headers.index(of: name) else { return }\n\n        headers.remove(at: index)\n    }\n\n    /// Sort the current instance by header name, case insensitively.\n    public mutating func sort() {\n        headers.sort { $0.name.lowercased() < $1.name.lowercased() }\n    }\n\n    /// Returns an instance sorted by header name.\n    ///\n    /// - Returns: A copy of the current instance sorted by name.\n    public func sorted() -> HTTPHeaders {\n        var headers = self\n        headers.sort()\n\n        return headers\n    }\n\n    /// Case-insensitively find a header's value by name.\n    ///\n    /// - Parameter name: The name of the header to search for, case-insensitively.\n    ///\n    /// - Returns:        The value of header, if it exists.\n    public func value(for name: String) -> String? {\n        guard let index = headers.index(of: name) else { return nil }\n\n        return headers[index].value\n    }\n\n    /// Case-insensitively access the header with the given name.\n    ///\n    /// - Parameter name: The name of the header.\n    public subscript(_ name: String) -> String? {\n        get { value(for: name) }\n        set {\n            if let value = newValue {\n                update(name: name, value: value)\n            } else {\n                remove(name: name)\n            }\n        }\n    }\n\n    /// The dictionary representation of all headers.\n    ///\n    /// This representation does not preserve the current order of the instance.\n    public var dictionary: [String: String] {\n        let namesAndValues = headers.map { ($0.name, $0.value) }\n\n        return Dictionary(namesAndValues, uniquingKeysWith: { _, last in last })\n    }\n}\n\nextension HTTPHeaders: ExpressibleByDictionaryLiteral {\n    public init(dictionaryLiteral elements: (String, String)...) {\n        self.init()\n\n        elements.forEach { update(name: $0.0, value: $0.1) }\n    }\n}\n\nextension HTTPHeaders: ExpressibleByArrayLiteral {\n    public init(arrayLiteral elements: HTTPHeader...) {\n        self.init(elements)\n    }\n}\n\nextension HTTPHeaders: Sequence {\n    public func makeIterator() -> IndexingIterator<[HTTPHeader]> {\n        headers.makeIterator()\n    }\n}\n\nextension HTTPHeaders: Collection {\n    public var startIndex: Int {\n        headers.startIndex\n    }\n\n    public var endIndex: Int {\n        headers.endIndex\n    }\n\n    public subscript(position: Int) -> HTTPHeader {\n        headers[position]\n    }\n\n    public func index(after i: Int) -> Int {\n        headers.index(after: i)\n    }\n}\n\nextension HTTPHeaders: CustomStringConvertible {\n    public var description: String {\n        headers.map(\\.description)\n            .joined(separator: \"\\n\")\n    }\n}\n\n// MARK: - HTTPHeader\n\n/// A representation of a single HTTP header's name / value pair.\npublic struct HTTPHeader: Hashable {\n    /// Name of the header.\n    public let name: String\n\n    /// Value of the header.\n    public let value: String\n\n    /// Creates an instance from the given `name` and `value`.\n    ///\n    /// - Parameters:\n    ///   - name:  The name of the header.\n    ///   - value: The value of the header.\n    public init(name: String, value: String) {\n        self.name = name\n        self.value = value\n    }\n}\n\nextension HTTPHeader: CustomStringConvertible {\n    public var description: String {\n        \"\\(name): \\(value)\"\n    }\n}\n\nextension HTTPHeader {\n    /// Returns an `Accept` header.\n    ///\n    /// - Parameter value: The `Accept` value.\n    /// - Returns:         The header.\n    public static func accept(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"Accept\", value: value)\n    }\n\n    /// Returns an `Accept-Charset` header.\n    ///\n    /// - Parameter value: The `Accept-Charset` value.\n    /// - Returns:         The header.\n    public static func acceptCharset(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"Accept-Charset\", value: value)\n    }\n\n    /// Returns an `Accept-Language` header.\n    ///\n    /// Alamofire offers a default Accept-Language header that accumulates and encodes the system's preferred languages.\n    /// Use `HTTPHeader.defaultAcceptLanguage`.\n    ///\n    /// - Parameter value: The `Accept-Language` value.\n    ///\n    /// - Returns:         The header.\n    public static func acceptLanguage(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"Accept-Language\", value: value)\n    }\n\n    /// Returns an `Accept-Encoding` header.\n    ///\n    /// Alamofire offers a default accept encoding value that provides the most common values. Use\n    /// `HTTPHeader.defaultAcceptEncoding`.\n    ///\n    /// - Parameter value: The `Accept-Encoding` value.\n    ///\n    /// - Returns:         The header\n    public static func acceptEncoding(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"Accept-Encoding\", value: value)\n    }\n\n    /// Returns a `Basic` `Authorization` header using the `username` and `password` provided.\n    ///\n    /// - Parameters:\n    ///   - username: The username of the header.\n    ///   - password: The password of the header.\n    ///\n    /// - Returns:    The header.\n    public static func authorization(username: String, password: String) -> HTTPHeader {\n        let credential = Data(\"\\(username):\\(password)\".utf8).base64EncodedString()\n\n        return authorization(\"Basic \\(credential)\")\n    }\n\n    /// Returns a `Bearer` `Authorization` header using the `bearerToken` provided\n    ///\n    /// - Parameter bearerToken: The bearer token.\n    ///\n    /// - Returns:               The header.\n    public static func authorization(bearerToken: String) -> HTTPHeader {\n        authorization(\"Bearer \\(bearerToken)\")\n    }\n\n    /// Returns an `Authorization` header.\n    ///\n    /// Alamofire provides built-in methods to produce `Authorization` headers. For a Basic `Authorization` header use\n    /// `HTTPHeader.authorization(username:password:)`. For a Bearer `Authorization` header, use\n    /// `HTTPHeader.authorization(bearerToken:)`.\n    ///\n    /// - Parameter value: The `Authorization` value.\n    ///\n    /// - Returns:         The header.\n    public static func authorization(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"Authorization\", value: value)\n    }\n\n    /// Returns a `Content-Disposition` header.\n    ///\n    /// - Parameter value: The `Content-Disposition` value.\n    ///\n    /// - Returns:         The header.\n    public static func contentDisposition(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"Content-Disposition\", value: value)\n    }\n\n    /// Returns a `Content-Type` header.\n    ///\n    /// All Alamofire `ParameterEncoding`s and `ParameterEncoder`s set the `Content-Type` of the request, so it may not be necessary to manually\n    /// set this value.\n    ///\n    /// - Parameter value: The `Content-Type` value.\n    ///\n    /// - Returns:         The header.\n    public static func contentType(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"Content-Type\", value: value)\n    }\n\n    /// Returns a `User-Agent` header.\n    ///\n    /// - Parameter value: The `User-Agent` value.\n    ///\n    /// - Returns:         The header.\n    public static func userAgent(_ value: String) -> HTTPHeader {\n        HTTPHeader(name: \"User-Agent\", value: value)\n    }\n}\n\nextension Array where Element == HTTPHeader {\n    /// Case-insensitively finds the index of an `HTTPHeader` with the provided name, if it exists.\n    func index(of name: String) -> Int? {\n        let lowercasedName = name.lowercased()\n        return firstIndex { $0.name.lowercased() == lowercasedName }\n    }\n}\n\n// MARK: - Defaults\n\nextension HTTPHeaders {\n    /// The default set of `HTTPHeaders` used by Alamofire. Includes `Accept-Encoding`, `Accept-Language`, and\n    /// `User-Agent`.\n    public static let `default`: HTTPHeaders = [.defaultAcceptEncoding,\n                                                .defaultAcceptLanguage,\n                                                .defaultUserAgent]\n}\n\nextension HTTPHeader {\n    /// Returns Alamofire's default `Accept-Encoding` header, appropriate for the encodings supported by particular OS\n    /// versions.\n    ///\n    /// See the [Accept-Encoding HTTP header documentation](https://tools.ietf.org/html/rfc7230#section-4.2.3) .\n    public static let defaultAcceptEncoding: HTTPHeader = {\n        let encodings: [String]\n        if #available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *) {\n            encodings = [\"br\", \"gzip\", \"deflate\"]\n        } else {\n            encodings = [\"gzip\", \"deflate\"]\n        }\n\n        return .acceptEncoding(encodings.qualityEncoded())\n    }()\n\n    /// Returns Alamofire's default `Accept-Language` header, generated by querying `Locale` for the user's\n    /// `preferredLanguages`.\n    ///\n    /// See the [Accept-Language HTTP header documentation](https://tools.ietf.org/html/rfc7231#section-5.3.5).\n    public static let defaultAcceptLanguage: HTTPHeader = .acceptLanguage(Locale.preferredLanguages.prefix(6).qualityEncoded())\n\n    /// Returns Alamofire's default `User-Agent` header.\n    ///\n    /// See the [User-Agent header documentation](https://tools.ietf.org/html/rfc7231#section-5.5.3).\n    ///\n    /// Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 13.0.0) Alamofire/5.0.0`\n    public static let defaultUserAgent: HTTPHeader = {\n        let info = Bundle.main.infoDictionary\n        let executable = (info?[\"CFBundleExecutable\"] as? String) ??\n            (ProcessInfo.processInfo.arguments.first?.split(separator: \"/\").last.map(String.init)) ??\n            \"Unknown\"\n        let bundle = info?[\"CFBundleIdentifier\"] as? String ?? \"Unknown\"\n        let appVersion = info?[\"CFBundleShortVersionString\"] as? String ?? \"Unknown\"\n        let appBuild = info?[\"CFBundleVersion\"] as? String ?? \"Unknown\"\n\n        let osNameVersion: String = {\n            let version = ProcessInfo.processInfo.operatingSystemVersion\n            let versionString = \"\\(version.majorVersion).\\(version.minorVersion).\\(version.patchVersion)\"\n            let osName: String = {\n                #if os(iOS)\n                #if targetEnvironment(macCatalyst)\n                return \"macOS(Catalyst)\"\n                #else\n                return \"iOS\"\n                #endif\n                #elseif os(watchOS)\n                return \"watchOS\"\n                #elseif os(tvOS)\n                return \"tvOS\"\n                #elseif os(macOS)\n                return \"macOS\"\n                #elseif os(Linux)\n                return \"Linux\"\n                #elseif os(Windows)\n                return \"Windows\"\n                #else\n                return \"Unknown\"\n                #endif\n            }()\n\n            return \"\\(osName) \\(versionString)\"\n        }()\n\n        let alamofireVersion = \"Alamofire/\\(version)\"\n\n        let userAgent = \"\\(executable)/\\(appVersion) (\\(bundle); build:\\(appBuild); \\(osNameVersion)) \\(alamofireVersion)\"\n\n        return .userAgent(userAgent)\n    }()\n}\n\nextension Collection where Element == String {\n    func qualityEncoded() -> String {\n        enumerated().map { index, encoding in\n            let quality = 1.0 - (Double(index) * 0.1)\n            return \"\\(encoding);q=\\(quality)\"\n        }.joined(separator: \", \")\n    }\n}\n\n// MARK: - System Type Extensions\n\nextension URLRequest {\n    /// Returns `allHTTPHeaderFields` as `HTTPHeaders`.\n    public var headers: HTTPHeaders {\n        get { allHTTPHeaderFields.map(HTTPHeaders.init) ?? HTTPHeaders() }\n        set { allHTTPHeaderFields = newValue.dictionary }\n    }\n}\n\nextension HTTPURLResponse {\n    /// Returns `allHeaderFields` as `HTTPHeaders`.\n    public var headers: HTTPHeaders {\n        (allHeaderFields as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders()\n    }\n}\n\nextension URLSessionConfiguration {\n    /// Returns `httpAdditionalHeaders` as `HTTPHeaders`.\n    public var headers: HTTPHeaders {\n        get { (httpAdditionalHeaders as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders() }\n        set { httpAdditionalHeaders = newValue.dictionary }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/HTTPMethod.swift",
    "content": "//\n//  HTTPMethod.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n/// Type representing HTTP methods. Raw `String` value is stored and compared case-sensitively, so\n/// `HTTPMethod.get != HTTPMethod(rawValue: \"get\")`.\n///\n/// See https://tools.ietf.org/html/rfc7231#section-4.3\npublic struct HTTPMethod: RawRepresentable, Equatable, Hashable {\n    /// `CONNECT` method.\n    public static let connect = HTTPMethod(rawValue: \"CONNECT\")\n    /// `DELETE` method.\n    public static let delete = HTTPMethod(rawValue: \"DELETE\")\n    /// `GET` method.\n    public static let get = HTTPMethod(rawValue: \"GET\")\n    /// `HEAD` method.\n    public static let head = HTTPMethod(rawValue: \"HEAD\")\n    /// `OPTIONS` method.\n    public static let options = HTTPMethod(rawValue: \"OPTIONS\")\n    /// `PATCH` method.\n    public static let patch = HTTPMethod(rawValue: \"PATCH\")\n    /// `POST` method.\n    public static let post = HTTPMethod(rawValue: \"POST\")\n    /// `PUT` method.\n    public static let put = HTTPMethod(rawValue: \"PUT\")\n    /// `QUERY` method.\n    public static let query = HTTPMethod(rawValue: \"QUERY\")\n    /// `TRACE` method.\n    public static let trace = HTTPMethod(rawValue: \"TRACE\")\n\n    public let rawValue: String\n\n    public init(rawValue: String) {\n        self.rawValue = rawValue\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/MultipartFormData.swift",
    "content": "//\n//  MultipartFormData.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n#if os(iOS) || os(watchOS) || os(tvOS)\nimport MobileCoreServices\n#elseif os(macOS)\nimport CoreServices\n#endif\n\n/// Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode\n/// multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead\n/// to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the\n/// data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for\n/// larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset.\n///\n/// For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well\n/// and the w3 form documentation.\n///\n/// - https://www.ietf.org/rfc/rfc2388.txt\n/// - https://www.ietf.org/rfc/rfc2045.txt\n/// - https://www.w3.org/TR/html401/interact/forms.html#h-17.13\nopen class MultipartFormData {\n    // MARK: - Helper Types\n\n    enum EncodingCharacters {\n        static let crlf = \"\\r\\n\"\n    }\n\n    enum BoundaryGenerator {\n        enum BoundaryType {\n            case initial, encapsulated, final\n        }\n\n        static func randomBoundary() -> String {\n            let first = UInt32.random(in: UInt32.min...UInt32.max)\n            let second = UInt32.random(in: UInt32.min...UInt32.max)\n\n            return String(format: \"alamofire.boundary.%08x%08x\", first, second)\n        }\n\n        static func boundaryData(forBoundaryType boundaryType: BoundaryType, boundary: String) -> Data {\n            let boundaryText: String\n\n            switch boundaryType {\n            case .initial:\n                boundaryText = \"--\\(boundary)\\(EncodingCharacters.crlf)\"\n            case .encapsulated:\n                boundaryText = \"\\(EncodingCharacters.crlf)--\\(boundary)\\(EncodingCharacters.crlf)\"\n            case .final:\n                boundaryText = \"\\(EncodingCharacters.crlf)--\\(boundary)--\\(EncodingCharacters.crlf)\"\n            }\n\n            return Data(boundaryText.utf8)\n        }\n    }\n\n    class BodyPart {\n        let headers: HTTPHeaders\n        let bodyStream: InputStream\n        let bodyContentLength: UInt64\n        var hasInitialBoundary = false\n        var hasFinalBoundary = false\n\n        init(headers: HTTPHeaders, bodyStream: InputStream, bodyContentLength: UInt64) {\n            self.headers = headers\n            self.bodyStream = bodyStream\n            self.bodyContentLength = bodyContentLength\n        }\n    }\n\n    // MARK: - Properties\n\n    /// Default memory threshold used when encoding `MultipartFormData`, in bytes.\n    public static let encodingMemoryThreshold: UInt64 = 10_000_000\n\n    /// The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`.\n    open lazy var contentType: String = \"multipart/form-data; boundary=\\(self.boundary)\"\n\n    /// The content length of all body parts used to generate the `multipart/form-data` not including the boundaries.\n    public var contentLength: UInt64 { bodyParts.reduce(0) { $0 + $1.bodyContentLength } }\n\n    /// The boundary used to separate the body parts in the encoded form data.\n    public let boundary: String\n\n    let fileManager: FileManager\n\n    private var bodyParts: [BodyPart]\n    private var bodyPartError: AFError?\n    private let streamBufferSize: Int\n\n    // MARK: - Lifecycle\n\n    /// Creates an instance.\n    ///\n    /// - Parameters:\n    ///   - fileManager: `FileManager` to use for file operations, if needed.\n    ///   - boundary: Boundary `String` used to separate body parts.\n    public init(fileManager: FileManager = .default, boundary: String? = nil) {\n        self.fileManager = fileManager\n        self.boundary = boundary ?? BoundaryGenerator.randomBoundary()\n        bodyParts = []\n\n        //\n        // The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more\n        // information, please refer to the following article:\n        //   - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html\n        //\n        streamBufferSize = 1024\n    }\n\n    // MARK: - Body Parts\n\n    /// Creates a body part from the data and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)\n    /// - `Content-Type: #{mimeType}` (HTTP Header)\n    /// - Encoded file data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - data:     `Data` to encoding into the instance.\n    ///   - name:     Name to associate with the `Data` in the `Content-Disposition` HTTP header.\n    ///   - fileName: Filename to associate with the `Data` in the `Content-Disposition` HTTP header.\n    ///   - mimeType: MIME type to associate with the data in the `Content-Type` HTTP header.\n    public func append(_ data: Data, withName name: String, fileName: String? = nil, mimeType: String? = nil) {\n        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)\n        let stream = InputStream(data: data)\n        let length = UInt64(data.count)\n\n        append(stream, withLength: length, headers: headers)\n    }\n\n    /// Creates a body part from the file and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - `Content-Disposition: form-data; name=#{name}; filename=#{generated filename}` (HTTP Header)\n    /// - `Content-Type: #{generated mimeType}` (HTTP Header)\n    /// - Encoded file data\n    /// - Multipart form boundary\n    ///\n    /// The filename in the `Content-Disposition` HTTP header is generated from the last path component of the\n    /// `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the\n    /// system associated MIME type.\n    ///\n    /// - Parameters:\n    ///   - fileURL: `URL` of the file whose content will be encoded into the instance.\n    ///   - name:    Name to associate with the file content in the `Content-Disposition` HTTP header.\n    public func append(_ fileURL: URL, withName name: String) {\n        let fileName = fileURL.lastPathComponent\n        let pathExtension = fileURL.pathExtension\n\n        if !fileName.isEmpty && !pathExtension.isEmpty {\n            let mime = mimeType(forPathExtension: pathExtension)\n            append(fileURL, withName: name, fileName: fileName, mimeType: mime)\n        } else {\n            setBodyPartError(withReason: .bodyPartFilenameInvalid(in: fileURL))\n        }\n    }\n\n    /// Creates a body part from the file and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - Content-Disposition: form-data; name=#{name}; filename=#{filename} (HTTP Header)\n    /// - Content-Type: #{mimeType} (HTTP Header)\n    /// - Encoded file data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - fileURL:  `URL` of the file whose content will be encoded into the instance.\n    ///   - name:     Name to associate with the file content in the `Content-Disposition` HTTP header.\n    ///   - fileName: Filename to associate with the file content in the `Content-Disposition` HTTP header.\n    ///   - mimeType: MIME type to associate with the file content in the `Content-Type` HTTP header.\n    public func append(_ fileURL: URL, withName name: String, fileName: String, mimeType: String) {\n        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)\n\n        //============================================================\n        //                 Check 1 - is file URL?\n        //============================================================\n\n        guard fileURL.isFileURL else {\n            setBodyPartError(withReason: .bodyPartURLInvalid(url: fileURL))\n            return\n        }\n\n        //============================================================\n        //              Check 2 - is file URL reachable?\n        //============================================================\n\n        #if !(os(Linux) || os(Windows))\n        do {\n            let isReachable = try fileURL.checkPromisedItemIsReachable()\n            guard isReachable else {\n                setBodyPartError(withReason: .bodyPartFileNotReachable(at: fileURL))\n                return\n            }\n        } catch {\n            setBodyPartError(withReason: .bodyPartFileNotReachableWithError(atURL: fileURL, error: error))\n            return\n        }\n        #endif\n\n        //============================================================\n        //            Check 3 - is file URL a directory?\n        //============================================================\n\n        var isDirectory: ObjCBool = false\n        let path = fileURL.path\n\n        guard fileManager.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else {\n            setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL))\n            return\n        }\n\n        //============================================================\n        //          Check 4 - can the file size be extracted?\n        //============================================================\n\n        let bodyContentLength: UInt64\n\n        do {\n            guard let fileSize = try fileManager.attributesOfItem(atPath: path)[.size] as? NSNumber else {\n                setBodyPartError(withReason: .bodyPartFileSizeNotAvailable(at: fileURL))\n                return\n            }\n\n            bodyContentLength = fileSize.uint64Value\n        } catch {\n            setBodyPartError(withReason: .bodyPartFileSizeQueryFailedWithError(forURL: fileURL, error: error))\n            return\n        }\n\n        //============================================================\n        //       Check 5 - can a stream be created from file URL?\n        //============================================================\n\n        guard let stream = InputStream(url: fileURL) else {\n            setBodyPartError(withReason: .bodyPartInputStreamCreationFailed(for: fileURL))\n            return\n        }\n\n        append(stream, withLength: bodyContentLength, headers: headers)\n    }\n\n    /// Creates a body part from the stream and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)\n    /// - `Content-Type: #{mimeType}` (HTTP Header)\n    /// - Encoded stream data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - stream:   `InputStream` to encode into the instance.\n    ///   - length:   Length, in bytes, of the stream.\n    ///   - name:     Name to associate with the stream content in the `Content-Disposition` HTTP header.\n    ///   - fileName: Filename to associate with the stream content in the `Content-Disposition` HTTP header.\n    ///   - mimeType: MIME type to associate with the stream content in the `Content-Type` HTTP header.\n    public func append(_ stream: InputStream,\n                       withLength length: UInt64,\n                       name: String,\n                       fileName: String,\n                       mimeType: String) {\n        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)\n        append(stream, withLength: length, headers: headers)\n    }\n\n    /// Creates a body part with the stream, length, and headers and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - HTTP headers\n    /// - Encoded stream data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - stream:  `InputStream` to encode into the instance.\n    ///   - length:  Length, in bytes, of the stream.\n    ///   - headers: `HTTPHeaders` for the body part.\n    public func append(_ stream: InputStream, withLength length: UInt64, headers: HTTPHeaders) {\n        let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length)\n        bodyParts.append(bodyPart)\n    }\n\n    // MARK: - Data Encoding\n\n    /// Encodes all appended body parts into a single `Data` value.\n    ///\n    /// - Note: This method will load all the appended body parts into memory all at the same time. This method should\n    ///         only be used when the encoded data will have a small memory footprint. For large data cases, please use\n    ///         the `writeEncodedData(to:))` method.\n    ///\n    /// - Returns: The encoded `Data`, if encoding is successful.\n    /// - Throws:  An `AFError` if encoding encounters an error.\n    public func encode() throws -> Data {\n        if let bodyPartError = bodyPartError {\n            throw bodyPartError\n        }\n\n        var encoded = Data()\n\n        bodyParts.first?.hasInitialBoundary = true\n        bodyParts.last?.hasFinalBoundary = true\n\n        for bodyPart in bodyParts {\n            let encodedData = try encode(bodyPart)\n            encoded.append(encodedData)\n        }\n\n        return encoded\n    }\n\n    /// Writes all appended body parts to the given file `URL`.\n    ///\n    /// This process is facilitated by reading and writing with input and output streams, respectively. Thus,\n    /// this approach is very memory efficient and should be used for large body part data.\n    ///\n    /// - Parameter fileURL: File `URL` to which to write the form data.\n    /// - Throws:            An `AFError` if encoding encounters an error.\n    public func writeEncodedData(to fileURL: URL) throws {\n        if let bodyPartError = bodyPartError {\n            throw bodyPartError\n        }\n\n        if fileManager.fileExists(atPath: fileURL.path) {\n            throw AFError.multipartEncodingFailed(reason: .outputStreamFileAlreadyExists(at: fileURL))\n        } else if !fileURL.isFileURL {\n            throw AFError.multipartEncodingFailed(reason: .outputStreamURLInvalid(url: fileURL))\n        }\n\n        guard let outputStream = OutputStream(url: fileURL, append: false) else {\n            throw AFError.multipartEncodingFailed(reason: .outputStreamCreationFailed(for: fileURL))\n        }\n\n        outputStream.open()\n        defer { outputStream.close() }\n\n        bodyParts.first?.hasInitialBoundary = true\n        bodyParts.last?.hasFinalBoundary = true\n\n        for bodyPart in bodyParts {\n            try write(bodyPart, to: outputStream)\n        }\n    }\n\n    // MARK: - Private - Body Part Encoding\n\n    private func encode(_ bodyPart: BodyPart) throws -> Data {\n        var encoded = Data()\n\n        let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData()\n        encoded.append(initialData)\n\n        let headerData = encodeHeaders(for: bodyPart)\n        encoded.append(headerData)\n\n        let bodyStreamData = try encodeBodyStream(for: bodyPart)\n        encoded.append(bodyStreamData)\n\n        if bodyPart.hasFinalBoundary {\n            encoded.append(finalBoundaryData())\n        }\n\n        return encoded\n    }\n\n    private func encodeHeaders(for bodyPart: BodyPart) -> Data {\n        let headerText = bodyPart.headers.map { \"\\($0.name): \\($0.value)\\(EncodingCharacters.crlf)\" }\n            .joined()\n            + EncodingCharacters.crlf\n\n        return Data(headerText.utf8)\n    }\n\n    private func encodeBodyStream(for bodyPart: BodyPart) throws -> Data {\n        let inputStream = bodyPart.bodyStream\n        inputStream.open()\n        defer { inputStream.close() }\n\n        var encoded = Data()\n\n        while inputStream.hasBytesAvailable {\n            var buffer = [UInt8](repeating: 0, count: streamBufferSize)\n            let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize)\n\n            if let error = inputStream.streamError {\n                throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: error))\n            }\n\n            if bytesRead > 0 {\n                encoded.append(buffer, count: bytesRead)\n            } else {\n                break\n            }\n        }\n\n        guard UInt64(encoded.count) == bodyPart.bodyContentLength else {\n            let error = AFError.UnexpectedInputStreamLength(bytesExpected: bodyPart.bodyContentLength,\n                                                            bytesRead: UInt64(encoded.count))\n            throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: error))\n        }\n\n        return encoded\n    }\n\n    // MARK: - Private - Writing Body Part to Output Stream\n\n    private func write(_ bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        try writeInitialBoundaryData(for: bodyPart, to: outputStream)\n        try writeHeaderData(for: bodyPart, to: outputStream)\n        try writeBodyStream(for: bodyPart, to: outputStream)\n        try writeFinalBoundaryData(for: bodyPart, to: outputStream)\n    }\n\n    private func writeInitialBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData()\n        return try write(initialData, to: outputStream)\n    }\n\n    private func writeHeaderData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        let headerData = encodeHeaders(for: bodyPart)\n        return try write(headerData, to: outputStream)\n    }\n\n    private func writeBodyStream(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        let inputStream = bodyPart.bodyStream\n\n        inputStream.open()\n        defer { inputStream.close() }\n\n        while inputStream.hasBytesAvailable {\n            var buffer = [UInt8](repeating: 0, count: streamBufferSize)\n            let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize)\n\n            if let streamError = inputStream.streamError {\n                throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: streamError))\n            }\n\n            if bytesRead > 0 {\n                if buffer.count != bytesRead {\n                    buffer = Array(buffer[0..<bytesRead])\n                }\n\n                try write(&buffer, to: outputStream)\n            } else {\n                break\n            }\n        }\n    }\n\n    private func writeFinalBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        if bodyPart.hasFinalBoundary {\n            return try write(finalBoundaryData(), to: outputStream)\n        }\n    }\n\n    // MARK: - Private - Writing Buffered Data to Output Stream\n\n    private func write(_ data: Data, to outputStream: OutputStream) throws {\n        var buffer = [UInt8](repeating: 0, count: data.count)\n        data.copyBytes(to: &buffer, count: data.count)\n\n        return try write(&buffer, to: outputStream)\n    }\n\n    private func write(_ buffer: inout [UInt8], to outputStream: OutputStream) throws {\n        var bytesToWrite = buffer.count\n\n        while bytesToWrite > 0, outputStream.hasSpaceAvailable {\n            let bytesWritten = outputStream.write(buffer, maxLength: bytesToWrite)\n\n            if let error = outputStream.streamError {\n                throw AFError.multipartEncodingFailed(reason: .outputStreamWriteFailed(error: error))\n            }\n\n            bytesToWrite -= bytesWritten\n\n            if bytesToWrite > 0 {\n                buffer = Array(buffer[bytesWritten..<buffer.count])\n            }\n        }\n    }\n\n    // MARK: - Private - Content Headers\n\n    private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> HTTPHeaders {\n        var disposition = \"form-data; name=\\\"\\(name)\\\"\"\n        if let fileName = fileName { disposition += \"; filename=\\\"\\(fileName)\\\"\" }\n\n        var headers: HTTPHeaders = [.contentDisposition(disposition)]\n        if let mimeType = mimeType { headers.add(.contentType(mimeType)) }\n\n        return headers\n    }\n\n    // MARK: - Private - Boundary Encoding\n\n    private func initialBoundaryData() -> Data {\n        BoundaryGenerator.boundaryData(forBoundaryType: .initial, boundary: boundary)\n    }\n\n    private func encapsulatedBoundaryData() -> Data {\n        BoundaryGenerator.boundaryData(forBoundaryType: .encapsulated, boundary: boundary)\n    }\n\n    private func finalBoundaryData() -> Data {\n        BoundaryGenerator.boundaryData(forBoundaryType: .final, boundary: boundary)\n    }\n\n    // MARK: - Private - Errors\n\n    private func setBodyPartError(withReason reason: AFError.MultipartEncodingFailureReason) {\n        guard bodyPartError == nil else { return }\n        bodyPartError = AFError.multipartEncodingFailed(reason: reason)\n    }\n}\n\n#if canImport(UniformTypeIdentifiers)\nimport UniformTypeIdentifiers\n\nextension MultipartFormData {\n    // MARK: - Private - Mime Type\n\n    private func mimeType(forPathExtension pathExtension: String) -> String {\n        if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) {\n            return UTType(filenameExtension: pathExtension)?.preferredMIMEType ?? \"application/octet-stream\"\n        } else {\n            if\n                let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(),\n                let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue() {\n                return contentType as String\n            }\n\n            return \"application/octet-stream\"\n        }\n    }\n}\n\n#else\n\nextension MultipartFormData {\n    // MARK: - Private - Mime Type\n\n    private func mimeType(forPathExtension pathExtension: String) -> String {\n        #if !(os(Linux) || os(Windows))\n        if\n            let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(),\n            let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue() {\n            return contentType as String\n        }\n        #endif\n\n        return \"application/octet-stream\"\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/MultipartUpload.swift",
    "content": "//\n//  MultipartUpload.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Internal type which encapsulates a `MultipartFormData` upload.\nfinal class MultipartUpload {\n    lazy var result = Result { try build() }\n\n    @Protected\n    private(set) var multipartFormData: MultipartFormData\n    let encodingMemoryThreshold: UInt64\n    let request: URLRequestConvertible\n    let fileManager: FileManager\n\n    init(encodingMemoryThreshold: UInt64,\n         request: URLRequestConvertible,\n         multipartFormData: MultipartFormData) {\n        self.encodingMemoryThreshold = encodingMemoryThreshold\n        self.request = request\n        fileManager = multipartFormData.fileManager\n        self.multipartFormData = multipartFormData\n    }\n\n    func build() throws -> UploadRequest.Uploadable {\n        let uploadable: UploadRequest.Uploadable\n        if $multipartFormData.contentLength < encodingMemoryThreshold {\n            let data = try $multipartFormData.read { try $0.encode() }\n\n            uploadable = .data(data)\n        } else {\n            let tempDirectoryURL = fileManager.temporaryDirectory\n            let directoryURL = tempDirectoryURL.appendingPathComponent(\"org.alamofire.manager/multipart.form.data\")\n            let fileName = UUID().uuidString\n            let fileURL = directoryURL.appendingPathComponent(fileName)\n\n            try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil)\n\n            do {\n                try $multipartFormData.read { try $0.writeEncodedData(to: fileURL) }\n            } catch {\n                // Cleanup after attempted write if it fails.\n                try? fileManager.removeItem(at: fileURL)\n                throw error\n            }\n\n            uploadable = .file(fileURL, shouldRemove: true)\n        }\n\n        return uploadable\n    }\n}\n\nextension MultipartUpload: UploadConvertible {\n    func asURLRequest() throws -> URLRequest {\n        var urlRequest = try request.asURLRequest()\n\n        $multipartFormData.read { multipartFormData in\n            urlRequest.headers.add(.contentType(multipartFormData.contentType))\n        }\n\n        return urlRequest\n    }\n\n    func createUploadable() throws -> UploadRequest.Uploadable {\n        try result.get()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/NetworkReachabilityManager.swift",
    "content": "//\n//  NetworkReachabilityManager.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n#if !(os(watchOS) || os(Linux) || os(Windows))\n\nimport Foundation\nimport SystemConfiguration\n\n/// The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and\n/// WiFi network interfaces.\n///\n/// Reachability can be used to determine background information about why a network operation failed, or to retry\n/// network requests when a connection is established. It should not be used to prevent a user from initiating a network\n/// request, as it's possible that an initial request may be required to establish reachability.\nopen class NetworkReachabilityManager {\n    /// Defines the various states of network reachability.\n    public enum NetworkReachabilityStatus {\n        /// It is unknown whether the network is reachable.\n        case unknown\n        /// The network is not reachable.\n        case notReachable\n        /// The network is reachable on the associated `ConnectionType`.\n        case reachable(ConnectionType)\n\n        init(_ flags: SCNetworkReachabilityFlags) {\n            guard flags.isActuallyReachable else { self = .notReachable; return }\n\n            var networkStatus: NetworkReachabilityStatus = .reachable(.ethernetOrWiFi)\n\n            if flags.isCellular { networkStatus = .reachable(.cellular) }\n\n            self = networkStatus\n        }\n\n        /// Defines the various connection types detected by reachability flags.\n        public enum ConnectionType {\n            /// The connection type is either over Ethernet or WiFi.\n            case ethernetOrWiFi\n            /// The connection type is a cellular connection.\n            case cellular\n        }\n    }\n\n    /// A closure executed when the network reachability status changes. The closure takes a single argument: the\n    /// network reachability status.\n    public typealias Listener = (NetworkReachabilityStatus) -> Void\n\n    /// Default `NetworkReachabilityManager` for the zero address and a `listenerQueue` of `.main`.\n    public static let `default` = NetworkReachabilityManager()\n\n    // MARK: - Properties\n\n    /// Whether the network is currently reachable.\n    open var isReachable: Bool { isReachableOnCellular || isReachableOnEthernetOrWiFi }\n\n    /// Whether the network is currently reachable over the cellular interface.\n    ///\n    /// - Note: Using this property to decide whether to make a high or low bandwidth request is not recommended.\n    ///         Instead, set the `allowsCellularAccess` on any `URLRequest`s being issued.\n    ///\n    open var isReachableOnCellular: Bool { status == .reachable(.cellular) }\n\n    /// Whether the network is currently reachable over Ethernet or WiFi interface.\n    open var isReachableOnEthernetOrWiFi: Bool { status == .reachable(.ethernetOrWiFi) }\n\n    /// `DispatchQueue` on which reachability will update.\n    public let reachabilityQueue = DispatchQueue(label: \"org.alamofire.reachabilityQueue\")\n\n    /// Flags of the current reachability type, if any.\n    open var flags: SCNetworkReachabilityFlags? {\n        var flags = SCNetworkReachabilityFlags()\n\n        return (SCNetworkReachabilityGetFlags(reachability, &flags)) ? flags : nil\n    }\n\n    /// The current network reachability status.\n    open var status: NetworkReachabilityStatus {\n        flags.map(NetworkReachabilityStatus.init) ?? .unknown\n    }\n\n    /// Mutable state storage.\n    struct MutableState {\n        /// A closure executed when the network reachability status changes.\n        var listener: Listener?\n        /// `DispatchQueue` on which listeners will be called.\n        var listenerQueue: DispatchQueue?\n        /// Previously calculated status.\n        var previousStatus: NetworkReachabilityStatus?\n    }\n\n    /// `SCNetworkReachability` instance providing notifications.\n    private let reachability: SCNetworkReachability\n\n    /// Protected storage for mutable state.\n    @Protected\n    private var mutableState = MutableState()\n\n    // MARK: - Initialization\n\n    /// Creates an instance with the specified host.\n    ///\n    /// - Note: The `host` value must *not* contain a scheme, just the hostname.\n    ///\n    /// - Parameters:\n    ///   - host:          Host used to evaluate network reachability. Must *not* include the scheme (e.g. `https`).\n    public convenience init?(host: String) {\n        guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil }\n\n        self.init(reachability: reachability)\n    }\n\n    /// Creates an instance that monitors the address 0.0.0.0.\n    ///\n    /// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing\n    /// status of the device, both IPv4 and IPv6.\n    public convenience init?() {\n        var zero = sockaddr()\n        zero.sa_len = UInt8(MemoryLayout<sockaddr>.size)\n        zero.sa_family = sa_family_t(AF_INET)\n\n        guard let reachability = SCNetworkReachabilityCreateWithAddress(nil, &zero) else { return nil }\n\n        self.init(reachability: reachability)\n    }\n\n    private init(reachability: SCNetworkReachability) {\n        self.reachability = reachability\n    }\n\n    deinit {\n        stopListening()\n    }\n\n    // MARK: - Listening\n\n    /// Starts listening for changes in network reachability status.\n    ///\n    /// - Note: Stops and removes any existing listener.\n    ///\n    /// - Parameters:\n    ///   - queue:    `DispatchQueue` on which to call the `listener` closure. `.main` by default.\n    ///   - listener: `Listener` closure called when reachability changes.\n    ///\n    /// - Returns: `true` if listening was started successfully, `false` otherwise.\n    @discardableResult\n    open func startListening(onQueue queue: DispatchQueue = .main,\n                             onUpdatePerforming listener: @escaping Listener) -> Bool {\n        stopListening()\n\n        $mutableState.write { state in\n            state.listenerQueue = queue\n            state.listener = listener\n        }\n\n        var context = SCNetworkReachabilityContext(version: 0,\n                                                   info: Unmanaged.passUnretained(self).toOpaque(),\n                                                   retain: nil,\n                                                   release: nil,\n                                                   copyDescription: nil)\n        let callback: SCNetworkReachabilityCallBack = { _, flags, info in\n            guard let info = info else { return }\n\n            let instance = Unmanaged<NetworkReachabilityManager>.fromOpaque(info).takeUnretainedValue()\n            instance.notifyListener(flags)\n        }\n\n        let queueAdded = SCNetworkReachabilitySetDispatchQueue(reachability, reachabilityQueue)\n        let callbackAdded = SCNetworkReachabilitySetCallback(reachability, callback, &context)\n\n        // Manually call listener to give initial state, since the framework may not.\n        if let currentFlags = flags {\n            reachabilityQueue.async {\n                self.notifyListener(currentFlags)\n            }\n        }\n\n        return callbackAdded && queueAdded\n    }\n\n    /// Stops listening for changes in network reachability status.\n    open func stopListening() {\n        SCNetworkReachabilitySetCallback(reachability, nil, nil)\n        SCNetworkReachabilitySetDispatchQueue(reachability, nil)\n        $mutableState.write { state in\n            state.listener = nil\n            state.listenerQueue = nil\n            state.previousStatus = nil\n        }\n    }\n\n    // MARK: - Internal - Listener Notification\n\n    /// Calls the `listener` closure of the `listenerQueue` if the computed status hasn't changed.\n    ///\n    /// - Note: Should only be called from the `reachabilityQueue`.\n    ///\n    /// - Parameter flags: `SCNetworkReachabilityFlags` to use to calculate the status.\n    func notifyListener(_ flags: SCNetworkReachabilityFlags) {\n        let newStatus = NetworkReachabilityStatus(flags)\n\n        $mutableState.write { state in\n            guard state.previousStatus != newStatus else { return }\n\n            state.previousStatus = newStatus\n\n            let listener = state.listener\n            state.listenerQueue?.async { listener?(newStatus) }\n        }\n    }\n}\n\n// MARK: -\n\nextension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {}\n\nextension SCNetworkReachabilityFlags {\n    var isReachable: Bool { contains(.reachable) }\n    var isConnectionRequired: Bool { contains(.connectionRequired) }\n    var canConnectAutomatically: Bool { contains(.connectionOnDemand) || contains(.connectionOnTraffic) }\n    var canConnectWithoutUserInteraction: Bool { canConnectAutomatically && !contains(.interventionRequired) }\n    var isActuallyReachable: Bool { isReachable && (!isConnectionRequired || canConnectWithoutUserInteraction) }\n    var isCellular: Bool {\n        #if os(iOS) || os(tvOS)\n        return contains(.isWWAN)\n        #else\n        return false\n        #endif\n    }\n\n    /// Human readable `String` for all states, to help with debugging.\n    var readableDescription: String {\n        let W = isCellular ? \"W\" : \"-\"\n        let R = isReachable ? \"R\" : \"-\"\n        let c = isConnectionRequired ? \"c\" : \"-\"\n        let t = contains(.transientConnection) ? \"t\" : \"-\"\n        let i = contains(.interventionRequired) ? \"i\" : \"-\"\n        let C = contains(.connectionOnTraffic) ? \"C\" : \"-\"\n        let D = contains(.connectionOnDemand) ? \"D\" : \"-\"\n        let l = contains(.isLocalAddress) ? \"l\" : \"-\"\n        let d = contains(.isDirect) ? \"d\" : \"-\"\n        let a = contains(.connectionAutomatic) ? \"a\" : \"-\"\n\n        return \"\\(W)\\(R) \\(c)\\(t)\\(i)\\(C)\\(D)\\(l)\\(d)\\(a)\"\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Notifications.swift",
    "content": "//\n//  Notifications.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension Request {\n    /// Posted when a `Request` is resumed. The `Notification` contains the resumed `Request`.\n    public static let didResumeNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didResume\")\n    /// Posted when a `Request` is suspended. The `Notification` contains the suspended `Request`.\n    public static let didSuspendNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didSuspend\")\n    /// Posted when a `Request` is cancelled. The `Notification` contains the cancelled `Request`.\n    public static let didCancelNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didCancel\")\n    /// Posted when a `Request` is finished. The `Notification` contains the completed `Request`.\n    public static let didFinishNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didFinish\")\n\n    /// Posted when a `URLSessionTask` is resumed. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    public static let didResumeTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didResumeTask\")\n    /// Posted when a `URLSessionTask` is suspended. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    public static let didSuspendTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didSuspendTask\")\n    /// Posted when a `URLSessionTask` is cancelled. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    public static let didCancelTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didCancelTask\")\n    /// Posted when a `URLSessionTask` is completed. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    public static let didCompleteTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didCompleteTask\")\n}\n\n// MARK: -\n\nextension Notification {\n    /// The `Request` contained by the instance's `userInfo`, `nil` otherwise.\n    public var request: Request? {\n        userInfo?[String.requestKey] as? Request\n    }\n\n    /// Convenience initializer for a `Notification` containing a `Request` payload.\n    ///\n    /// - Parameters:\n    ///   - name:    The name of the notification.\n    ///   - request: The `Request` payload.\n    init(name: Notification.Name, request: Request) {\n        self.init(name: name, object: nil, userInfo: [String.requestKey: request])\n    }\n}\n\nextension NotificationCenter {\n    /// Convenience function for posting notifications with `Request` payloads.\n    ///\n    /// - Parameters:\n    ///   - name:    The name of the notification.\n    ///   - request: The `Request` payload.\n    func postNotification(named name: Notification.Name, with request: Request) {\n        let notification = Notification(name: name, request: request)\n        post(notification)\n    }\n}\n\nextension String {\n    /// User info dictionary key representing the `Request` associated with the notification.\n    fileprivate static let requestKey = \"org.alamofire.notification.key.request\"\n}\n\n/// `EventMonitor` that provides Alamofire's notifications.\npublic final class AlamofireNotifications: EventMonitor {\n    public func requestDidResume(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didResumeNotification, with: request)\n    }\n\n    public func requestDidSuspend(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didSuspendNotification, with: request)\n    }\n\n    public func requestDidCancel(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didCancelNotification, with: request)\n    }\n\n    public func requestDidFinish(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didFinishNotification, with: request)\n    }\n\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {\n        NotificationCenter.default.postNotification(named: Request.didResumeTaskNotification, with: request)\n    }\n\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {\n        NotificationCenter.default.postNotification(named: Request.didSuspendTaskNotification, with: request)\n    }\n\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {\n        NotificationCenter.default.postNotification(named: Request.didCancelTaskNotification, with: request)\n    }\n\n    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {\n        NotificationCenter.default.postNotification(named: Request.didCompleteTaskNotification, with: request)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/OperationQueue+Alamofire.swift",
    "content": "//\n//  OperationQueue+Alamofire.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension OperationQueue {\n    /// Creates an instance using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - qualityOfService:            `QualityOfService` to be applied to the queue. `.default` by default.\n    ///   - maxConcurrentOperationCount: Maximum concurrent operations.\n    ///                                  `OperationQueue.defaultMaxConcurrentOperationCount` by default.\n    ///   - underlyingQueue: Underlying  `DispatchQueue`. `nil` by default.\n    ///   - name:                        Name for the queue. `nil` by default.\n    ///   - startSuspended:              Whether the queue starts suspended. `false` by default.\n    convenience init(qualityOfService: QualityOfService = .default,\n                     maxConcurrentOperationCount: Int = OperationQueue.defaultMaxConcurrentOperationCount,\n                     underlyingQueue: DispatchQueue? = nil,\n                     name: String? = nil,\n                     startSuspended: Bool = false) {\n        self.init()\n        self.qualityOfService = qualityOfService\n        self.maxConcurrentOperationCount = maxConcurrentOperationCount\n        self.underlyingQueue = underlyingQueue\n        self.name = name\n        isSuspended = startSuspended\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/ParameterEncoder.swift",
    "content": "//\n//  ParameterEncoder.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that can encode any `Encodable` type into a `URLRequest`.\npublic protocol ParameterEncoder {\n    /// Encode the provided `Encodable` parameters into `request`.\n    ///\n    /// - Parameters:\n    ///   - parameters: The `Encodable` parameter value.\n    ///   - request:    The `URLRequest` into which to encode the parameters.\n    ///\n    /// - Returns:      A `URLRequest` with the result of the encoding.\n    /// - Throws:       An `Error` when encoding fails. For Alamofire provided encoders, this will be an instance of\n    ///                 `AFError.parameterEncoderFailed` with an associated `ParameterEncoderFailureReason`.\n    func encode<Parameters: Encodable>(_ parameters: Parameters?, into request: URLRequest) throws -> URLRequest\n}\n\n/// A `ParameterEncoder` that encodes types as JSON body data.\n///\n/// If no `Content-Type` header is already set on the provided `URLRequest`s, it's set to `application/json`.\nopen class JSONParameterEncoder: ParameterEncoder {\n    /// Returns an encoder with default parameters.\n    public static var `default`: JSONParameterEncoder { JSONParameterEncoder() }\n\n    /// Returns an encoder with `JSONEncoder.outputFormatting` set to `.prettyPrinted`.\n    public static var prettyPrinted: JSONParameterEncoder {\n        let encoder = JSONEncoder()\n        encoder.outputFormatting = .prettyPrinted\n\n        return JSONParameterEncoder(encoder: encoder)\n    }\n\n    /// Returns an encoder with `JSONEncoder.outputFormatting` set to `.sortedKeys`.\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    public static var sortedKeys: JSONParameterEncoder {\n        let encoder = JSONEncoder()\n        encoder.outputFormatting = .sortedKeys\n\n        return JSONParameterEncoder(encoder: encoder)\n    }\n\n    /// `JSONEncoder` used to encode parameters.\n    public let encoder: JSONEncoder\n\n    /// Creates an instance with the provided `JSONEncoder`.\n    ///\n    /// - Parameter encoder: The `JSONEncoder`. `JSONEncoder()` by default.\n    public init(encoder: JSONEncoder = JSONEncoder()) {\n        self.encoder = encoder\n    }\n\n    open func encode<Parameters: Encodable>(_ parameters: Parameters?,\n                                            into request: URLRequest) throws -> URLRequest {\n        guard let parameters = parameters else { return request }\n\n        var request = request\n\n        do {\n            let data = try encoder.encode(parameters)\n            request.httpBody = data\n            if request.headers[\"Content-Type\"] == nil {\n                request.headers.update(.contentType(\"application/json\"))\n            }\n        } catch {\n            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))\n        }\n\n        return request\n    }\n}\n\n#if swift(>=5.5)\nextension ParameterEncoder where Self == JSONParameterEncoder {\n    /// Provides a default `JSONParameterEncoder` instance.\n    public static var json: JSONParameterEncoder { JSONParameterEncoder() }\n\n    /// Creates a `JSONParameterEncoder` using the provided `JSONEncoder`.\n    ///\n    /// - Parameter encoder: `JSONEncoder` used to encode parameters. `JSONEncoder()` by default.\n    /// - Returns:           The `JSONParameterEncoder`.\n    public static func json(encoder: JSONEncoder = JSONEncoder()) -> JSONParameterEncoder {\n        JSONParameterEncoder(encoder: encoder)\n    }\n}\n#endif\n\n/// A `ParameterEncoder` that encodes types as URL-encoded query strings to be set on the URL or as body data, depending\n/// on the `Destination` set.\n///\n/// If no `Content-Type` header is already set on the provided `URLRequest`s, it will be set to\n/// `application/x-www-form-urlencoded; charset=utf-8`.\n///\n/// Encoding behavior can be customized by passing an instance of `URLEncodedFormEncoder` to the initializer.\nopen class URLEncodedFormParameterEncoder: ParameterEncoder {\n    /// Defines where the URL-encoded string should be set for each `URLRequest`.\n    public enum Destination {\n        /// Applies the encoded query string to any existing query string for `.get`, `.head`, and `.delete` request.\n        /// Sets it to the `httpBody` for all other methods.\n        case methodDependent\n        /// Applies the encoded query string to any existing query string from the `URLRequest`.\n        case queryString\n        /// Applies the encoded query string to the `httpBody` of the `URLRequest`.\n        case httpBody\n\n        /// Determines whether the URL-encoded string should be applied to the `URLRequest`'s `url`.\n        ///\n        /// - Parameter method: The `HTTPMethod`.\n        ///\n        /// - Returns:          Whether the URL-encoded string should be applied to a `URL`.\n        func encodesParametersInURL(for method: HTTPMethod) -> Bool {\n            switch self {\n            case .methodDependent: return [.get, .head, .delete].contains(method)\n            case .queryString: return true\n            case .httpBody: return false\n            }\n        }\n    }\n\n    /// Returns an encoder with default parameters.\n    public static var `default`: URLEncodedFormParameterEncoder { URLEncodedFormParameterEncoder() }\n\n    /// The `URLEncodedFormEncoder` to use.\n    public let encoder: URLEncodedFormEncoder\n\n    /// The `Destination` for the URL-encoded string.\n    public let destination: Destination\n\n    /// Creates an instance with the provided `URLEncodedFormEncoder` instance and `Destination` value.\n    ///\n    /// - Parameters:\n    ///   - encoder:     The `URLEncodedFormEncoder`. `URLEncodedFormEncoder()` by default.\n    ///   - destination: The `Destination`. `.methodDependent` by default.\n    public init(encoder: URLEncodedFormEncoder = URLEncodedFormEncoder(), destination: Destination = .methodDependent) {\n        self.encoder = encoder\n        self.destination = destination\n    }\n\n    open func encode<Parameters: Encodable>(_ parameters: Parameters?,\n                                            into request: URLRequest) throws -> URLRequest {\n        guard let parameters = parameters else { return request }\n\n        var request = request\n\n        guard let url = request.url else {\n            throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.url))\n        }\n\n        guard let method = request.method else {\n            let rawValue = request.method?.rawValue ?? \"nil\"\n            throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.httpMethod(rawValue: rawValue)))\n        }\n\n        if destination.encodesParametersInURL(for: method),\n           var components = URLComponents(url: url, resolvingAgainstBaseURL: false) {\n            let query: String = try Result<String, Error> { try encoder.encode(parameters) }\n                .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get()\n            let newQueryString = [components.percentEncodedQuery, query].compactMap { $0 }.joinedWithAmpersands()\n            components.percentEncodedQuery = newQueryString.isEmpty ? nil : newQueryString\n\n            guard let newURL = components.url else {\n                throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.url))\n            }\n\n            request.url = newURL\n        } else {\n            if request.headers[\"Content-Type\"] == nil {\n                request.headers.update(.contentType(\"application/x-www-form-urlencoded; charset=utf-8\"))\n            }\n\n            request.httpBody = try Result<Data, Error> { try encoder.encode(parameters) }\n                .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get()\n        }\n\n        return request\n    }\n}\n\n#if swift(>=5.5)\nextension ParameterEncoder where Self == URLEncodedFormParameterEncoder {\n    /// Provides a default `URLEncodedFormParameterEncoder` instance.\n    public static var urlEncodedForm: URLEncodedFormParameterEncoder { URLEncodedFormParameterEncoder() }\n\n    /// Creates a `URLEncodedFormParameterEncoder` with the provided encoder and destination.\n    ///\n    /// - Parameters:\n    ///   - encoder:     `URLEncodedFormEncoder` used to encode the parameters. `URLEncodedFormEncoder()` by default.\n    ///   - destination: `Destination` to which to encode the parameters. `.methodDependent` by default.\n    /// - Returns:       The `URLEncodedFormParameterEncoder`.\n    public static func urlEncodedForm(encoder: URLEncodedFormEncoder = URLEncodedFormEncoder(),\n                                      destination: URLEncodedFormParameterEncoder.Destination = .methodDependent) -> URLEncodedFormParameterEncoder {\n        URLEncodedFormParameterEncoder(encoder: encoder, destination: destination)\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/ParameterEncoding.swift",
    "content": "//\n//  ParameterEncoding.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A dictionary of parameters to apply to a `URLRequest`.\npublic typealias Parameters = [String: Any]\n\n/// A type used to define how a set of parameters are applied to a `URLRequest`.\npublic protocol ParameterEncoding {\n    /// Creates a `URLRequest` by encoding parameters and applying them on the passed request.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: `URLRequestConvertible` value onto which parameters will be encoded.\n    ///   - parameters: `Parameters` to encode onto the request.\n    ///\n    /// - Returns:      The encoded `URLRequest`.\n    /// - Throws:       Any `Error` produced during parameter encoding.\n    func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest\n}\n\n// MARK: -\n\n/// Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP\n/// body of the URL request. Whether the query string is set or appended to any existing URL query string or set as\n/// the HTTP body depends on the destination of the encoding.\n///\n/// The `Content-Type` HTTP header field of an encoded request with HTTP body is set to\n/// `application/x-www-form-urlencoded; charset=utf-8`.\n///\n/// There is no published specification for how to encode collection types. By default the convention of appending\n/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for\n/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the\n/// square brackets appended to array keys.\n///\n/// `BoolEncoding` can be used to configure how boolean values are encoded. The default behavior is to encode\n/// `true` as 1 and `false` as 0.\npublic struct URLEncoding: ParameterEncoding {\n    // MARK: Helper Types\n\n    /// Defines whether the url-encoded query string is applied to the existing query string or HTTP body of the\n    /// resulting URL request.\n    public enum Destination {\n        /// Applies encoded query string result to existing query string for `GET`, `HEAD` and `DELETE` requests and\n        /// sets as the HTTP body for requests with any other HTTP method.\n        case methodDependent\n        /// Sets or appends encoded query string result to existing query string.\n        case queryString\n        /// Sets encoded query string result as the HTTP body of the URL request.\n        case httpBody\n\n        func encodesParametersInURL(for method: HTTPMethod) -> Bool {\n            switch self {\n            case .methodDependent: return [.get, .head, .delete].contains(method)\n            case .queryString: return true\n            case .httpBody: return false\n            }\n        }\n    }\n\n    /// Configures how `Array` parameters are encoded.\n    public enum ArrayEncoding {\n        /// An empty set of square brackets is appended to the key for every value. This is the default behavior.\n        case brackets\n        /// No brackets are appended. The key is encoded as is.\n        case noBrackets\n        /// Brackets containing the item index are appended. This matches the jQuery and Node.js behavior.\n        case indexInBrackets\n\n        func encode(key: String, atIndex index: Int) -> String {\n            switch self {\n            case .brackets:\n                return \"\\(key)[]\"\n            case .noBrackets:\n                return key\n            case .indexInBrackets:\n                return \"\\(key)[\\(index)]\"\n            }\n        }\n    }\n\n    /// Configures how `Bool` parameters are encoded.\n    public enum BoolEncoding {\n        /// Encode `true` as `1` and `false` as `0`. This is the default behavior.\n        case numeric\n        /// Encode `true` and `false` as string literals.\n        case literal\n\n        func encode(value: Bool) -> String {\n            switch self {\n            case .numeric:\n                return value ? \"1\" : \"0\"\n            case .literal:\n                return value ? \"true\" : \"false\"\n            }\n        }\n    }\n\n    // MARK: Properties\n\n    /// Returns a default `URLEncoding` instance with a `.methodDependent` destination.\n    public static var `default`: URLEncoding { URLEncoding() }\n\n    /// Returns a `URLEncoding` instance with a `.queryString` destination.\n    public static var queryString: URLEncoding { URLEncoding(destination: .queryString) }\n\n    /// Returns a `URLEncoding` instance with an `.httpBody` destination.\n    public static var httpBody: URLEncoding { URLEncoding(destination: .httpBody) }\n\n    /// The destination defining where the encoded query string is to be applied to the URL request.\n    public let destination: Destination\n\n    /// The encoding to use for `Array` parameters.\n    public let arrayEncoding: ArrayEncoding\n\n    /// The encoding to use for `Bool` parameters.\n    public let boolEncoding: BoolEncoding\n\n    // MARK: Initialization\n\n    /// Creates an instance using the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - destination:   `Destination` defining where the encoded query string will be applied. `.methodDependent` by\n    ///                    default.\n    ///   - arrayEncoding: `ArrayEncoding` to use. `.brackets` by default.\n    ///   - boolEncoding:  `BoolEncoding` to use. `.numeric` by default.\n    public init(destination: Destination = .methodDependent,\n                arrayEncoding: ArrayEncoding = .brackets,\n                boolEncoding: BoolEncoding = .numeric) {\n        self.destination = destination\n        self.arrayEncoding = arrayEncoding\n        self.boolEncoding = boolEncoding\n    }\n\n    // MARK: Encoding\n\n    public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {\n        var urlRequest = try urlRequest.asURLRequest()\n\n        guard let parameters = parameters else { return urlRequest }\n\n        if let method = urlRequest.method, destination.encodesParametersInURL(for: method) {\n            guard let url = urlRequest.url else {\n                throw AFError.parameterEncodingFailed(reason: .missingURL)\n            }\n\n            if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty {\n                let percentEncodedQuery = (urlComponents.percentEncodedQuery.map { $0 + \"&\" } ?? \"\") + query(parameters)\n                urlComponents.percentEncodedQuery = percentEncodedQuery\n                urlRequest.url = urlComponents.url\n            }\n        } else {\n            if urlRequest.headers[\"Content-Type\"] == nil {\n                urlRequest.headers.update(.contentType(\"application/x-www-form-urlencoded; charset=utf-8\"))\n            }\n\n            urlRequest.httpBody = Data(query(parameters).utf8)\n        }\n\n        return urlRequest\n    }\n\n    /// Creates a percent-escaped, URL encoded query string components from the given key-value pair recursively.\n    ///\n    /// - Parameters:\n    ///   - key:   Key of the query component.\n    ///   - value: Value of the query component.\n    ///\n    /// - Returns: The percent-escaped, URL encoded query string components.\n    public func queryComponents(fromKey key: String, value: Any) -> [(String, String)] {\n        var components: [(String, String)] = []\n        switch value {\n        case let dictionary as [String: Any]:\n            for (nestedKey, value) in dictionary {\n                components += queryComponents(fromKey: \"\\(key)[\\(nestedKey)]\", value: value)\n            }\n        case let array as [Any]:\n            for (index, value) in array.enumerated() {\n                components += queryComponents(fromKey: arrayEncoding.encode(key: key, atIndex: index), value: value)\n            }\n        case let number as NSNumber:\n            if number.isBool {\n                components.append((escape(key), escape(boolEncoding.encode(value: number.boolValue))))\n            } else {\n                components.append((escape(key), escape(\"\\(number)\")))\n            }\n        case let bool as Bool:\n            components.append((escape(key), escape(boolEncoding.encode(value: bool))))\n        default:\n            components.append((escape(key), escape(\"\\(value)\")))\n        }\n        return components\n    }\n\n    /// Creates a percent-escaped string following RFC 3986 for a query string key or value.\n    ///\n    /// - Parameter string: `String` to be percent-escaped.\n    ///\n    /// - Returns:          The percent-escaped `String`.\n    public func escape(_ string: String) -> String {\n        string.addingPercentEncoding(withAllowedCharacters: .afURLQueryAllowed) ?? string\n    }\n\n    private func query(_ parameters: [String: Any]) -> String {\n        var components: [(String, String)] = []\n\n        for key in parameters.keys.sorted(by: <) {\n            let value = parameters[key]!\n            components += queryComponents(fromKey: key, value: value)\n        }\n        return components.map { \"\\($0)=\\($1)\" }.joined(separator: \"&\")\n    }\n}\n\n// MARK: -\n\n/// Uses `JSONSerialization` to create a JSON representation of the parameters object, which is set as the body of the\n/// request. The `Content-Type` HTTP header field of an encoded request is set to `application/json`.\npublic struct JSONEncoding: ParameterEncoding {\n    // MARK: Properties\n\n    /// Returns a `JSONEncoding` instance with default writing options.\n    public static var `default`: JSONEncoding { JSONEncoding() }\n\n    /// Returns a `JSONEncoding` instance with `.prettyPrinted` writing options.\n    public static var prettyPrinted: JSONEncoding { JSONEncoding(options: .prettyPrinted) }\n\n    /// The options for writing the parameters as JSON data.\n    public let options: JSONSerialization.WritingOptions\n\n    // MARK: Initialization\n\n    /// Creates an instance using the specified `WritingOptions`.\n    ///\n    /// - Parameter options: `JSONSerialization.WritingOptions` to use.\n    public init(options: JSONSerialization.WritingOptions = []) {\n        self.options = options\n    }\n\n    // MARK: Encoding\n\n    public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {\n        var urlRequest = try urlRequest.asURLRequest()\n\n        guard let parameters = parameters else { return urlRequest }\n\n        do {\n            let data = try JSONSerialization.data(withJSONObject: parameters, options: options)\n\n            if urlRequest.headers[\"Content-Type\"] == nil {\n                urlRequest.headers.update(.contentType(\"application/json\"))\n            }\n\n            urlRequest.httpBody = data\n        } catch {\n            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))\n        }\n\n        return urlRequest\n    }\n\n    /// Encodes any JSON compatible object into a `URLRequest`.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: `URLRequestConvertible` value into which the object will be encoded.\n    ///   - jsonObject: `Any` value (must be JSON compatible` to be encoded into the `URLRequest`. `nil` by default.\n    ///\n    /// - Returns:      The encoded `URLRequest`.\n    /// - Throws:       Any `Error` produced during encoding.\n    public func encode(_ urlRequest: URLRequestConvertible, withJSONObject jsonObject: Any? = nil) throws -> URLRequest {\n        var urlRequest = try urlRequest.asURLRequest()\n\n        guard let jsonObject = jsonObject else { return urlRequest }\n\n        do {\n            let data = try JSONSerialization.data(withJSONObject: jsonObject, options: options)\n\n            if urlRequest.headers[\"Content-Type\"] == nil {\n                urlRequest.headers.update(.contentType(\"application/json\"))\n            }\n\n            urlRequest.httpBody = data\n        } catch {\n            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))\n        }\n\n        return urlRequest\n    }\n}\n\n// MARK: -\n\nextension NSNumber {\n    fileprivate var isBool: Bool {\n        // Use Obj-C type encoding to check whether the underlying type is a `Bool`, as it's guaranteed as part of\n        // swift-corelibs-foundation, per [this discussion on the Swift forums](https://forums.swift.org/t/alamofire-on-linux-possible-but-not-release-ready/34553/22).\n        String(cString: objCType) == \"c\"\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Protected.swift",
    "content": "//\n//  Protected.swift\n//\n//  Copyright (c) 2014-2020 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nprivate protocol Lock {\n    func lock()\n    func unlock()\n}\n\nextension Lock {\n    /// Executes a closure returning a value while acquiring the lock.\n    ///\n    /// - Parameter closure: The closure to run.\n    ///\n    /// - Returns:           The value the closure generated.\n    func around<T>(_ closure: () throws -> T) rethrows -> T {\n        lock(); defer { unlock() }\n        return try closure()\n    }\n\n    /// Execute a closure while acquiring the lock.\n    ///\n    /// - Parameter closure: The closure to run.\n    func around(_ closure: () throws -> Void) rethrows {\n        lock(); defer { unlock() }\n        try closure()\n    }\n}\n\n#if os(Linux) || os(Windows)\n\nextension NSLock: Lock {}\n\n#endif\n\n#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)\n/// An `os_unfair_lock` wrapper.\nfinal class UnfairLock: Lock {\n    private let unfairLock: os_unfair_lock_t\n\n    init() {\n        unfairLock = .allocate(capacity: 1)\n        unfairLock.initialize(to: os_unfair_lock())\n    }\n\n    deinit {\n        unfairLock.deinitialize(count: 1)\n        unfairLock.deallocate()\n    }\n\n    fileprivate func lock() {\n        os_unfair_lock_lock(unfairLock)\n    }\n\n    fileprivate func unlock() {\n        os_unfair_lock_unlock(unfairLock)\n    }\n}\n#endif\n\n/// A thread-safe wrapper around a value.\n@propertyWrapper\n@dynamicMemberLookup\nfinal class Protected<T> {\n    #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)\n    private let lock = UnfairLock()\n    #elseif os(Linux) || os(Windows)\n    private let lock = NSLock()\n    #endif\n    private var value: T\n\n    init(_ value: T) {\n        self.value = value\n    }\n\n    /// The contained value. Unsafe for anything more than direct read or write.\n    var wrappedValue: T {\n        get { lock.around { value } }\n        set { lock.around { value = newValue } }\n    }\n\n    var projectedValue: Protected<T> { self }\n\n    init(wrappedValue: T) {\n        value = wrappedValue\n    }\n\n    /// Synchronously read or transform the contained value.\n    ///\n    /// - Parameter closure: The closure to execute.\n    ///\n    /// - Returns:           The return value of the closure passed.\n    func read<U>(_ closure: (T) throws -> U) rethrows -> U {\n        try lock.around { try closure(self.value) }\n    }\n\n    /// Synchronously modify the protected value.\n    ///\n    /// - Parameter closure: The closure to execute.\n    ///\n    /// - Returns:           The modified value.\n    @discardableResult\n    func write<U>(_ closure: (inout T) throws -> U) rethrows -> U {\n        try lock.around { try closure(&self.value) }\n    }\n\n    subscript<Property>(dynamicMember keyPath: WritableKeyPath<T, Property>) -> Property {\n        get { lock.around { value[keyPath: keyPath] } }\n        set { lock.around { value[keyPath: keyPath] = newValue } }\n    }\n\n    subscript<Property>(dynamicMember keyPath: KeyPath<T, Property>) -> Property {\n        lock.around { value[keyPath: keyPath] }\n    }\n}\n\nextension Protected where T == Request.MutableState {\n    /// Attempts to transition to the passed `State`.\n    ///\n    /// - Parameter state: The `State` to attempt transition to.\n    ///\n    /// - Returns:         Whether the transition occurred.\n    func attemptToTransitionTo(_ state: Request.State) -> Bool {\n        lock.around {\n            guard value.state.canTransitionTo(state) else { return false }\n\n            value.state = state\n\n            return true\n        }\n    }\n\n    /// Perform a closure while locked with the provided `Request.State`.\n    ///\n    /// - Parameter perform: The closure to perform while locked.\n    func withState(perform: (Request.State) -> Void) {\n        lock.around { perform(value.state) }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/RedirectHandler.swift",
    "content": "//\n//  RedirectHandler.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that handles how an HTTP redirect response from a remote server should be redirected to the new request.\npublic protocol RedirectHandler {\n    /// Determines how the HTTP redirect response should be redirected to the new request.\n    ///\n    /// The `completion` closure should be passed one of three possible options:\n    ///\n    ///   1. The new request specified by the redirect (this is the most common use case).\n    ///   2. A modified version of the new request (you may want to route it somewhere else).\n    ///   3. A `nil` value to deny the redirect request and return the body of the redirect response.\n    ///\n    /// - Parameters:\n    ///   - task:       The `URLSessionTask` whose request resulted in a redirect.\n    ///   - request:    The `URLRequest` to the new location specified by the redirect response.\n    ///   - response:   The `HTTPURLResponse` containing the server's response to the original request.\n    ///   - completion: The closure to execute containing the new `URLRequest`, a modified `URLRequest`, or `nil`.\n    func task(_ task: URLSessionTask,\n              willBeRedirectedTo request: URLRequest,\n              for response: HTTPURLResponse,\n              completion: @escaping (URLRequest?) -> Void)\n}\n\n// MARK: -\n\n/// `Redirector` is a convenience `RedirectHandler` making it easy to follow, not follow, or modify a redirect.\npublic struct Redirector {\n    /// Defines the behavior of the `Redirector` type.\n    public enum Behavior {\n        /// Follow the redirect as defined in the response.\n        case follow\n        /// Do not follow the redirect defined in the response.\n        case doNotFollow\n        /// Modify the redirect request defined in the response.\n        case modify((URLSessionTask, URLRequest, HTTPURLResponse) -> URLRequest?)\n    }\n\n    /// Returns a `Redirector` with a `.follow` `Behavior`.\n    public static let follow = Redirector(behavior: .follow)\n    /// Returns a `Redirector` with a `.doNotFollow` `Behavior`.\n    public static let doNotFollow = Redirector(behavior: .doNotFollow)\n\n    /// The `Behavior` of the `Redirector`.\n    public let behavior: Behavior\n\n    /// Creates a `Redirector` instance from the `Behavior`.\n    ///\n    /// - Parameter behavior: The `Behavior`.\n    public init(behavior: Behavior) {\n        self.behavior = behavior\n    }\n}\n\n// MARK: -\n\nextension Redirector: RedirectHandler {\n    public func task(_ task: URLSessionTask,\n                     willBeRedirectedTo request: URLRequest,\n                     for response: HTTPURLResponse,\n                     completion: @escaping (URLRequest?) -> Void) {\n        switch behavior {\n        case .follow:\n            completion(request)\n        case .doNotFollow:\n            completion(nil)\n        case let .modify(closure):\n            let request = closure(task, request, response)\n            completion(request)\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension RedirectHandler where Self == Redirector {\n    /// Provides a `Redirector` which follows redirects. Equivalent to `Redirector.follow`.\n    public static var follow: Redirector { .follow }\n\n    /// Provides a `Redirector` which does not follow redirects. Equivalent to `Redirector.doNotFollow`.\n    public static var doNotFollow: Redirector { .doNotFollow }\n\n    /// Creates a `Redirector` which modifies the redirected `URLRequest` using the provided closure.\n    ///\n    /// - Parameter closure: Closure used to modify the redirect.\n    /// - Returns:           The `Redirector`.\n    public static func modify(using closure: @escaping (URLSessionTask, URLRequest, HTTPURLResponse) -> URLRequest?) -> Redirector {\n        Redirector(behavior: .modify(closure))\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Request.swift",
    "content": "//\n//  Request.swift\n//\n//  Copyright (c) 2014-2020 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// `Request` is the common superclass of all Alamofire request types and provides common state, delegate, and callback\n/// handling.\npublic class Request {\n    /// State of the `Request`, with managed transitions between states set when calling `resume()`, `suspend()`, or\n    /// `cancel()` on the `Request`.\n    public enum State {\n        /// Initial state of the `Request`.\n        case initialized\n        /// `State` set when `resume()` is called. Any tasks created for the `Request` will have `resume()` called on\n        /// them in this state.\n        case resumed\n        /// `State` set when `suspend()` is called. Any tasks created for the `Request` will have `suspend()` called on\n        /// them in this state.\n        case suspended\n        /// `State` set when `cancel()` is called. Any tasks created for the `Request` will have `cancel()` called on\n        /// them. Unlike `resumed` or `suspended`, once in the `cancelled` state, the `Request` can no longer transition\n        /// to any other state.\n        case cancelled\n        /// `State` set when all response serialization completion closures have been cleared on the `Request` and\n        /// enqueued on their respective queues.\n        case finished\n\n        /// Determines whether `self` can be transitioned to the provided `State`.\n        func canTransitionTo(_ state: State) -> Bool {\n            switch (self, state) {\n            case (.initialized, _):\n                return true\n            case (_, .initialized), (.cancelled, _), (.finished, _):\n                return false\n            case (.resumed, .cancelled), (.suspended, .cancelled), (.resumed, .suspended), (.suspended, .resumed):\n                return true\n            case (.suspended, .suspended), (.resumed, .resumed):\n                return false\n            case (_, .finished):\n                return true\n            }\n        }\n    }\n\n    // MARK: - Initial State\n\n    /// `UUID` providing a unique identifier for the `Request`, used in the `Hashable` and `Equatable` conformances.\n    public let id: UUID\n    /// The serial queue for all internal async actions.\n    public let underlyingQueue: DispatchQueue\n    /// The queue used for all serialization actions. By default it's a serial queue that targets `underlyingQueue`.\n    public let serializationQueue: DispatchQueue\n    /// `EventMonitor` used for event callbacks.\n    public let eventMonitor: EventMonitor?\n    /// The `Request`'s interceptor.\n    public let interceptor: RequestInterceptor?\n    /// The `Request`'s delegate.\n    public private(set) weak var delegate: RequestDelegate?\n\n    // MARK: - Mutable State\n\n    /// Type encapsulating all mutable state that may need to be accessed from anything other than the `underlyingQueue`.\n    struct MutableState {\n        /// State of the `Request`.\n        var state: State = .initialized\n        /// `ProgressHandler` and `DispatchQueue` provided for upload progress callbacks.\n        var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)?\n        /// `ProgressHandler` and `DispatchQueue` provided for download progress callbacks.\n        var downloadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)?\n        /// `RedirectHandler` provided for to handle request redirection.\n        var redirectHandler: RedirectHandler?\n        /// `CachedResponseHandler` provided to handle response caching.\n        var cachedResponseHandler: CachedResponseHandler?\n        /// Queue and closure called when the `Request` is able to create a cURL description of itself.\n        var cURLHandler: (queue: DispatchQueue, handler: (String) -> Void)?\n        /// Queue and closure called when the `Request` creates a `URLRequest`.\n        var urlRequestHandler: (queue: DispatchQueue, handler: (URLRequest) -> Void)?\n        /// Queue and closure called when the `Request` creates a `URLSessionTask`.\n        var urlSessionTaskHandler: (queue: DispatchQueue, handler: (URLSessionTask) -> Void)?\n        /// Response serialization closures that handle response parsing.\n        var responseSerializers: [() -> Void] = []\n        /// Response serialization completion closures executed once all response serializers are complete.\n        var responseSerializerCompletions: [() -> Void] = []\n        /// Whether response serializer processing is finished.\n        var responseSerializerProcessingFinished = false\n        /// `URLCredential` used for authentication challenges.\n        var credential: URLCredential?\n        /// All `URLRequest`s created by Alamofire on behalf of the `Request`.\n        var requests: [URLRequest] = []\n        /// All `URLSessionTask`s created by Alamofire on behalf of the `Request`.\n        var tasks: [URLSessionTask] = []\n        /// All `URLSessionTaskMetrics` values gathered by Alamofire on behalf of the `Request`. Should correspond\n        /// exactly the the `tasks` created.\n        var metrics: [URLSessionTaskMetrics] = []\n        /// Number of times any retriers provided retried the `Request`.\n        var retryCount = 0\n        /// Final `AFError` for the `Request`, whether from various internal Alamofire calls or as a result of a `task`.\n        var error: AFError?\n        /// Whether the instance has had `finish()` called and is running the serializers. Should be replaced with a\n        /// representation in the state machine in the future.\n        var isFinishing = false\n        /// Actions to run when requests are finished. Use for concurrency support.\n        var finishHandlers: [() -> Void] = []\n    }\n\n    /// Protected `MutableState` value that provides thread-safe access to state values.\n    @Protected\n    fileprivate var mutableState = MutableState()\n\n    /// `State` of the `Request`.\n    public var state: State { $mutableState.state }\n    /// Returns whether `state` is `.initialized`.\n    public var isInitialized: Bool { state == .initialized }\n    /// Returns whether `state is `.resumed`.\n    public var isResumed: Bool { state == .resumed }\n    /// Returns whether `state` is `.suspended`.\n    public var isSuspended: Bool { state == .suspended }\n    /// Returns whether `state` is `.cancelled`.\n    public var isCancelled: Bool { state == .cancelled }\n    /// Returns whether `state` is `.finished`.\n    public var isFinished: Bool { state == .finished }\n\n    // MARK: Progress\n\n    /// Closure type executed when monitoring the upload or download progress of a request.\n    public typealias ProgressHandler = (Progress) -> Void\n\n    /// `Progress` of the upload of the body of the executed `URLRequest`. Reset to `0` if the `Request` is retried.\n    public let uploadProgress = Progress(totalUnitCount: 0)\n    /// `Progress` of the download of any response data. Reset to `0` if the `Request` is retried.\n    public let downloadProgress = Progress(totalUnitCount: 0)\n    /// `ProgressHandler` called when `uploadProgress` is updated, on the provided `DispatchQueue`.\n    private var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? {\n        get { $mutableState.uploadProgressHandler }\n        set { $mutableState.uploadProgressHandler = newValue }\n    }\n\n    /// `ProgressHandler` called when `downloadProgress` is updated, on the provided `DispatchQueue`.\n    fileprivate var downloadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? {\n        get { $mutableState.downloadProgressHandler }\n        set { $mutableState.downloadProgressHandler = newValue }\n    }\n\n    // MARK: Redirect Handling\n\n    /// `RedirectHandler` set on the instance.\n    public private(set) var redirectHandler: RedirectHandler? {\n        get { $mutableState.redirectHandler }\n        set { $mutableState.redirectHandler = newValue }\n    }\n\n    // MARK: Cached Response Handling\n\n    /// `CachedResponseHandler` set on the instance.\n    public private(set) var cachedResponseHandler: CachedResponseHandler? {\n        get { $mutableState.cachedResponseHandler }\n        set { $mutableState.cachedResponseHandler = newValue }\n    }\n\n    // MARK: URLCredential\n\n    /// `URLCredential` used for authentication challenges. Created by calling one of the `authenticate` methods.\n    public private(set) var credential: URLCredential? {\n        get { $mutableState.credential }\n        set { $mutableState.credential = newValue }\n    }\n\n    // MARK: Validators\n\n    /// `Validator` callback closures that store the validation calls enqueued.\n    @Protected\n    fileprivate var validators: [() -> Void] = []\n\n    // MARK: URLRequests\n\n    /// All `URLRequests` created on behalf of the `Request`, including original and adapted requests.\n    public var requests: [URLRequest] { $mutableState.requests }\n    /// First `URLRequest` created on behalf of the `Request`. May not be the first one actually executed.\n    public var firstRequest: URLRequest? { requests.first }\n    /// Last `URLRequest` created on behalf of the `Request`.\n    public var lastRequest: URLRequest? { requests.last }\n    /// Current `URLRequest` created on behalf of the `Request`.\n    public var request: URLRequest? { lastRequest }\n\n    /// `URLRequest`s from all of the `URLSessionTask`s executed on behalf of the `Request`. May be different from\n    /// `requests` due to `URLSession` manipulation.\n    public var performedRequests: [URLRequest] { $mutableState.read { $0.tasks.compactMap(\\.currentRequest) } }\n\n    // MARK: HTTPURLResponse\n\n    /// `HTTPURLResponse` received from the server, if any. If the `Request` was retried, this is the response of the\n    /// last `URLSessionTask`.\n    public var response: HTTPURLResponse? { lastTask?.response as? HTTPURLResponse }\n\n    // MARK: Tasks\n\n    /// All `URLSessionTask`s created on behalf of the `Request`.\n    public var tasks: [URLSessionTask] { $mutableState.tasks }\n    /// First `URLSessionTask` created on behalf of the `Request`.\n    public var firstTask: URLSessionTask? { tasks.first }\n    /// Last `URLSessionTask` crated on behalf of the `Request`.\n    public var lastTask: URLSessionTask? { tasks.last }\n    /// Current `URLSessionTask` created on behalf of the `Request`.\n    public var task: URLSessionTask? { lastTask }\n\n    // MARK: Metrics\n\n    /// All `URLSessionTaskMetrics` gathered on behalf of the `Request`. Should correspond to the `tasks` created.\n    public var allMetrics: [URLSessionTaskMetrics] { $mutableState.metrics }\n    /// First `URLSessionTaskMetrics` gathered on behalf of the `Request`.\n    public var firstMetrics: URLSessionTaskMetrics? { allMetrics.first }\n    /// Last `URLSessionTaskMetrics` gathered on behalf of the `Request`.\n    public var lastMetrics: URLSessionTaskMetrics? { allMetrics.last }\n    /// Current `URLSessionTaskMetrics` gathered on behalf of the `Request`.\n    public var metrics: URLSessionTaskMetrics? { lastMetrics }\n\n    // MARK: Retry Count\n\n    /// Number of times the `Request` has been retried.\n    public var retryCount: Int { $mutableState.retryCount }\n\n    // MARK: Error\n\n    /// `Error` returned from Alamofire internally, from the network request directly, or any validators executed.\n    public fileprivate(set) var error: AFError? {\n        get { $mutableState.error }\n        set { $mutableState.error = newValue }\n    }\n\n    /// Default initializer for the `Request` superclass.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`.\n    init(id: UUID = UUID(),\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         delegate: RequestDelegate) {\n        self.id = id\n        self.underlyingQueue = underlyingQueue\n        self.serializationQueue = serializationQueue\n        self.eventMonitor = eventMonitor\n        self.interceptor = interceptor\n        self.delegate = delegate\n    }\n\n    // MARK: - Internal Event API\n\n    // All API must be called from underlyingQueue.\n\n    /// Called when an initial `URLRequest` has been created on behalf of the instance. If a `RequestAdapter` is active,\n    /// the `URLRequest` will be adapted before being issued.\n    ///\n    /// - Parameter request: The `URLRequest` created.\n    func didCreateInitialURLRequest(_ request: URLRequest) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        $mutableState.write { $0.requests.append(request) }\n\n        eventMonitor?.request(self, didCreateInitialURLRequest: request)\n    }\n\n    /// Called when initial `URLRequest` creation has failed, typically through a `URLRequestConvertible`.\n    ///\n    /// - Note: Triggers retry.\n    ///\n    /// - Parameter error: `AFError` thrown from the failed creation.\n    func didFailToCreateURLRequest(with error: AFError) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        self.error = error\n\n        eventMonitor?.request(self, didFailToCreateURLRequestWithError: error)\n\n        callCURLHandlerIfNecessary()\n\n        retryOrFinish(error: error)\n    }\n\n    /// Called when a `RequestAdapter` has successfully adapted a `URLRequest`.\n    ///\n    /// - Parameters:\n    ///   - initialRequest: The `URLRequest` that was adapted.\n    ///   - adaptedRequest: The `URLRequest` returned by the `RequestAdapter`.\n    func didAdaptInitialRequest(_ initialRequest: URLRequest, to adaptedRequest: URLRequest) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        $mutableState.write { $0.requests.append(adaptedRequest) }\n\n        eventMonitor?.request(self, didAdaptInitialRequest: initialRequest, to: adaptedRequest)\n    }\n\n    /// Called when a `RequestAdapter` fails to adapt a `URLRequest`.\n    ///\n    /// - Note: Triggers retry.\n    ///\n    /// - Parameters:\n    ///   - request: The `URLRequest` the adapter was called with.\n    ///   - error:   The `AFError` returned by the `RequestAdapter`.\n    func didFailToAdaptURLRequest(_ request: URLRequest, withError error: AFError) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        self.error = error\n\n        eventMonitor?.request(self, didFailToAdaptURLRequest: request, withError: error)\n\n        callCURLHandlerIfNecessary()\n\n        retryOrFinish(error: error)\n    }\n\n    /// Final `URLRequest` has been created for the instance.\n    ///\n    /// - Parameter request: The `URLRequest` created.\n    func didCreateURLRequest(_ request: URLRequest) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        $mutableState.read { state in\n            state.urlRequestHandler?.queue.async { state.urlRequestHandler?.handler(request) }\n        }\n\n        eventMonitor?.request(self, didCreateURLRequest: request)\n\n        callCURLHandlerIfNecessary()\n    }\n\n    /// Asynchronously calls any stored `cURLHandler` and then removes it from `mutableState`.\n    private func callCURLHandlerIfNecessary() {\n        $mutableState.write { mutableState in\n            guard let cURLHandler = mutableState.cURLHandler else { return }\n\n            cURLHandler.queue.async { cURLHandler.handler(self.cURLDescription()) }\n\n            mutableState.cURLHandler = nil\n        }\n    }\n\n    /// Called when a `URLSessionTask` is created on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` created.\n    func didCreateTask(_ task: URLSessionTask) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        $mutableState.write { state in\n            state.tasks.append(task)\n\n            guard let urlSessionTaskHandler = state.urlSessionTaskHandler else { return }\n\n            urlSessionTaskHandler.queue.async { urlSessionTaskHandler.handler(task) }\n        }\n\n        eventMonitor?.request(self, didCreateTask: task)\n    }\n\n    /// Called when resumption is completed.\n    func didResume() {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        eventMonitor?.requestDidResume(self)\n    }\n\n    /// Called when a `URLSessionTask` is resumed on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` resumed.\n    func didResumeTask(_ task: URLSessionTask) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        eventMonitor?.request(self, didResumeTask: task)\n    }\n\n    /// Called when suspension is completed.\n    func didSuspend() {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        eventMonitor?.requestDidSuspend(self)\n    }\n\n    /// Called when a `URLSessionTask` is suspended on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` suspended.\n    func didSuspendTask(_ task: URLSessionTask) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        eventMonitor?.request(self, didSuspendTask: task)\n    }\n\n    /// Called when cancellation is completed, sets `error` to `AFError.explicitlyCancelled`.\n    func didCancel() {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        error = error ?? AFError.explicitlyCancelled\n\n        eventMonitor?.requestDidCancel(self)\n    }\n\n    /// Called when a `URLSessionTask` is cancelled on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` cancelled.\n    func didCancelTask(_ task: URLSessionTask) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        eventMonitor?.request(self, didCancelTask: task)\n    }\n\n    /// Called when a `URLSessionTaskMetrics` value is gathered on behalf of the instance.\n    ///\n    /// - Parameter metrics: The `URLSessionTaskMetrics` gathered.\n    func didGatherMetrics(_ metrics: URLSessionTaskMetrics) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        $mutableState.write { $0.metrics.append(metrics) }\n\n        eventMonitor?.request(self, didGatherMetrics: metrics)\n    }\n\n    /// Called when a `URLSessionTask` fails before it is finished, typically during certificate pinning.\n    ///\n    /// - Parameters:\n    ///   - task:  The `URLSessionTask` which failed.\n    ///   - error: The early failure `AFError`.\n    func didFailTask(_ task: URLSessionTask, earlyWithError error: AFError) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        self.error = error\n\n        // Task will still complete, so didCompleteTask(_:with:) will handle retry.\n        eventMonitor?.request(self, didFailTask: task, earlyWithError: error)\n    }\n\n    /// Called when a `URLSessionTask` completes. All tasks will eventually call this method.\n    ///\n    /// - Note: Response validation is synchronously triggered in this step.\n    ///\n    /// - Parameters:\n    ///   - task:  The `URLSessionTask` which completed.\n    ///   - error: The `AFError` `task` may have completed with. If `error` has already been set on the instance, this\n    ///            value is ignored.\n    func didCompleteTask(_ task: URLSessionTask, with error: AFError?) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        self.error = self.error ?? error\n\n        validators.forEach { $0() }\n\n        eventMonitor?.request(self, didCompleteTask: task, with: error)\n\n        retryOrFinish(error: self.error)\n    }\n\n    /// Called when the `RequestDelegate` is going to retry this `Request`. Calls `reset()`.\n    func prepareForRetry() {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        $mutableState.write { $0.retryCount += 1 }\n\n        reset()\n\n        eventMonitor?.requestIsRetrying(self)\n    }\n\n    /// Called to determine whether retry will be triggered for the particular error, or whether the instance should\n    /// call `finish()`.\n    ///\n    /// - Parameter error: The possible `AFError` which may trigger retry.\n    func retryOrFinish(error: AFError?) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        guard let error = error, let delegate = delegate else { finish(); return }\n\n        delegate.retryResult(for: self, dueTo: error) { retryResult in\n            switch retryResult {\n            case .doNotRetry:\n                self.finish()\n            case let .doNotRetryWithError(retryError):\n                self.finish(error: retryError.asAFError(orFailWith: \"Received retryError was not already AFError\"))\n            case .retry, .retryWithDelay:\n                delegate.retryRequest(self, withDelay: retryResult.delay)\n            }\n        }\n    }\n\n    /// Finishes this `Request` and starts the response serializers.\n    ///\n    /// - Parameter error: The possible `Error` with which the instance will finish.\n    func finish(error: AFError? = nil) {\n        dispatchPrecondition(condition: .onQueue(underlyingQueue))\n\n        guard !$mutableState.isFinishing else { return }\n\n        $mutableState.isFinishing = true\n\n        if let error = error { self.error = error }\n\n        // Start response handlers\n        processNextResponseSerializer()\n\n        eventMonitor?.requestDidFinish(self)\n    }\n\n    /// Appends the response serialization closure to the instance.\n    ///\n    ///  - Note: This method will also `resume` the instance if `delegate.startImmediately` returns `true`.\n    ///\n    /// - Parameter closure: The closure containing the response serialization call.\n    func appendResponseSerializer(_ closure: @escaping () -> Void) {\n        $mutableState.write { mutableState in\n            mutableState.responseSerializers.append(closure)\n\n            if mutableState.state == .finished {\n                mutableState.state = .resumed\n            }\n\n            if mutableState.responseSerializerProcessingFinished {\n                underlyingQueue.async { self.processNextResponseSerializer() }\n            }\n\n            if mutableState.state.canTransitionTo(.resumed) {\n                underlyingQueue.async { if self.delegate?.startImmediately == true { self.resume() } }\n            }\n        }\n    }\n\n    /// Returns the next response serializer closure to execute if there's one left.\n    ///\n    /// - Returns: The next response serialization closure, if there is one.\n    func nextResponseSerializer() -> (() -> Void)? {\n        var responseSerializer: (() -> Void)?\n\n        $mutableState.write { mutableState in\n            let responseSerializerIndex = mutableState.responseSerializerCompletions.count\n\n            if responseSerializerIndex < mutableState.responseSerializers.count {\n                responseSerializer = mutableState.responseSerializers[responseSerializerIndex]\n            }\n        }\n\n        return responseSerializer\n    }\n\n    /// Processes the next response serializer and calls all completions if response serialization is complete.\n    func processNextResponseSerializer() {\n        guard let responseSerializer = nextResponseSerializer() else {\n            // Execute all response serializer completions and clear them\n            var completions: [() -> Void] = []\n\n            $mutableState.write { mutableState in\n                completions = mutableState.responseSerializerCompletions\n\n                // Clear out all response serializers and response serializer completions in mutable state since the\n                // request is complete. It's important to do this prior to calling the completion closures in case\n                // the completions call back into the request triggering a re-processing of the response serializers.\n                // An example of how this can happen is by calling cancel inside a response completion closure.\n                mutableState.responseSerializers.removeAll()\n                mutableState.responseSerializerCompletions.removeAll()\n\n                if mutableState.state.canTransitionTo(.finished) {\n                    mutableState.state = .finished\n                }\n\n                mutableState.responseSerializerProcessingFinished = true\n                mutableState.isFinishing = false\n            }\n\n            completions.forEach { $0() }\n\n            // Cleanup the request\n            cleanup()\n\n            return\n        }\n\n        serializationQueue.async { responseSerializer() }\n    }\n\n    /// Notifies the `Request` that the response serializer is complete.\n    ///\n    /// - Parameter completion: The completion handler provided with the response serializer, called when all serializers\n    ///                         are complete.\n    func responseSerializerDidComplete(completion: @escaping () -> Void) {\n        $mutableState.write { $0.responseSerializerCompletions.append(completion) }\n        processNextResponseSerializer()\n    }\n\n    /// Resets all task and response serializer related state for retry.\n    func reset() {\n        error = nil\n\n        uploadProgress.totalUnitCount = 0\n        uploadProgress.completedUnitCount = 0\n        downloadProgress.totalUnitCount = 0\n        downloadProgress.completedUnitCount = 0\n\n        $mutableState.write { state in\n            state.isFinishing = false\n            state.responseSerializerCompletions = []\n        }\n    }\n\n    /// Called when updating the upload progress.\n    ///\n    /// - Parameters:\n    ///   - totalBytesSent: Total bytes sent so far.\n    ///   - totalBytesExpectedToSend: Total bytes expected to send.\n    func updateUploadProgress(totalBytesSent: Int64, totalBytesExpectedToSend: Int64) {\n        uploadProgress.totalUnitCount = totalBytesExpectedToSend\n        uploadProgress.completedUnitCount = totalBytesSent\n\n        uploadProgressHandler?.queue.async { self.uploadProgressHandler?.handler(self.uploadProgress) }\n    }\n\n    /// Perform a closure on the current `state` while locked.\n    ///\n    /// - Parameter perform: The closure to perform.\n    func withState(perform: (State) -> Void) {\n        $mutableState.withState(perform: perform)\n    }\n\n    // MARK: Task Creation\n\n    /// Called when creating a `URLSessionTask` for this `Request`. Subclasses must override.\n    ///\n    /// - Parameters:\n    ///   - request: `URLRequest` to use to create the `URLSessionTask`.\n    ///   - session: `URLSession` which creates the `URLSessionTask`.\n    ///\n    /// - Returns:   The `URLSessionTask` created.\n    func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        fatalError(\"Subclasses must override.\")\n    }\n\n    // MARK: - Public API\n\n    // These APIs are callable from any queue.\n\n    // MARK: State\n\n    /// Cancels the instance. Once cancelled, a `Request` can no longer be resumed or suspended.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func cancel() -> Self {\n        $mutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.cancelled) else { return }\n\n            mutableState.state = .cancelled\n\n            underlyingQueue.async { self.didCancel() }\n\n            guard let task = mutableState.tasks.last, task.state != .completed else {\n                underlyingQueue.async { self.finish() }\n                return\n            }\n\n            // Resume to ensure metrics are gathered.\n            task.resume()\n            task.cancel()\n            underlyingQueue.async { self.didCancelTask(task) }\n        }\n\n        return self\n    }\n\n    /// Suspends the instance.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func suspend() -> Self {\n        $mutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.suspended) else { return }\n\n            mutableState.state = .suspended\n\n            underlyingQueue.async { self.didSuspend() }\n\n            guard let task = mutableState.tasks.last, task.state != .completed else { return }\n\n            task.suspend()\n            underlyingQueue.async { self.didSuspendTask(task) }\n        }\n\n        return self\n    }\n\n    /// Resumes the instance.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func resume() -> Self {\n        $mutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.resumed) else { return }\n\n            mutableState.state = .resumed\n\n            underlyingQueue.async { self.didResume() }\n\n            guard let task = mutableState.tasks.last, task.state != .completed else { return }\n\n            task.resume()\n            underlyingQueue.async { self.didResumeTask(task) }\n        }\n\n        return self\n    }\n\n    // MARK: - Closure API\n\n    /// Associates a credential using the provided values with the instance.\n    ///\n    /// - Parameters:\n    ///   - username:    The username.\n    ///   - password:    The password.\n    ///   - persistence: The `URLCredential.Persistence` for the created `URLCredential`. `.forSession` by default.\n    ///\n    /// - Returns:       The instance.\n    @discardableResult\n    public func authenticate(username: String, password: String, persistence: URLCredential.Persistence = .forSession) -> Self {\n        let credential = URLCredential(user: username, password: password, persistence: persistence)\n\n        return authenticate(with: credential)\n    }\n\n    /// Associates the provided credential with the instance.\n    ///\n    /// - Parameter credential: The `URLCredential`.\n    ///\n    /// - Returns:              The instance.\n    @discardableResult\n    public func authenticate(with credential: URLCredential) -> Self {\n        $mutableState.credential = credential\n\n        return self\n    }\n\n    /// Sets a closure to be called periodically during the lifecycle of the instance as data is read from the server.\n    ///\n    /// - Note: Only the last closure provided is used.\n    ///\n    /// - Parameters:\n    ///   - queue:   The `DispatchQueue` to execute the closure on. `.main` by default.\n    ///   - closure: The closure to be executed periodically as data is read from the server.\n    ///\n    /// - Returns:   The instance.\n    @discardableResult\n    public func downloadProgress(queue: DispatchQueue = .main, closure: @escaping ProgressHandler) -> Self {\n        $mutableState.downloadProgressHandler = (handler: closure, queue: queue)\n\n        return self\n    }\n\n    /// Sets a closure to be called periodically during the lifecycle of the instance as data is sent to the server.\n    ///\n    /// - Note: Only the last closure provided is used.\n    ///\n    /// - Parameters:\n    ///   - queue:   The `DispatchQueue` to execute the closure on. `.main` by default.\n    ///   - closure: The closure to be executed periodically as data is sent to the server.\n    ///\n    /// - Returns:   The instance.\n    @discardableResult\n    public func uploadProgress(queue: DispatchQueue = .main, closure: @escaping ProgressHandler) -> Self {\n        $mutableState.uploadProgressHandler = (handler: closure, queue: queue)\n\n        return self\n    }\n\n    // MARK: Redirects\n\n    /// Sets the redirect handler for the instance which will be used if a redirect response is encountered.\n    ///\n    /// - Note: Attempting to set the redirect handler more than once is a logic error and will crash.\n    ///\n    /// - Parameter handler: The `RedirectHandler`.\n    ///\n    /// - Returns:           The instance.\n    @discardableResult\n    public func redirect(using handler: RedirectHandler) -> Self {\n        $mutableState.write { mutableState in\n            precondition(mutableState.redirectHandler == nil, \"Redirect handler has already been set.\")\n            mutableState.redirectHandler = handler\n        }\n\n        return self\n    }\n\n    // MARK: Cached Responses\n\n    /// Sets the cached response handler for the `Request` which will be used when attempting to cache a response.\n    ///\n    /// - Note: Attempting to set the cache handler more than once is a logic error and will crash.\n    ///\n    /// - Parameter handler: The `CachedResponseHandler`.\n    ///\n    /// - Returns:           The instance.\n    @discardableResult\n    public func cacheResponse(using handler: CachedResponseHandler) -> Self {\n        $mutableState.write { mutableState in\n            precondition(mutableState.cachedResponseHandler == nil, \"Cached response handler has already been set.\")\n            mutableState.cachedResponseHandler = handler\n        }\n\n        return self\n    }\n\n    // MARK: - Lifetime APIs\n\n    /// Sets a handler to be called when the cURL description of the request is available.\n    ///\n    /// - Note: When waiting for a `Request`'s `URLRequest` to be created, only the last `handler` will be called.\n    ///\n    /// - Parameters:\n    ///   - queue:   `DispatchQueue` on which `handler` will be called.\n    ///   - handler: Closure to be called when the cURL description is available.\n    ///\n    /// - Returns:           The instance.\n    @discardableResult\n    public func cURLDescription(on queue: DispatchQueue, calling handler: @escaping (String) -> Void) -> Self {\n        $mutableState.write { mutableState in\n            if mutableState.requests.last != nil {\n                queue.async { handler(self.cURLDescription()) }\n            } else {\n                mutableState.cURLHandler = (queue, handler)\n            }\n        }\n\n        return self\n    }\n\n    /// Sets a handler to be called when the cURL description of the request is available.\n    ///\n    /// - Note: When waiting for a `Request`'s `URLRequest` to be created, only the last `handler` will be called.\n    ///\n    /// - Parameter handler: Closure to be called when the cURL description is available. Called on the instance's\n    ///                      `underlyingQueue` by default.\n    ///\n    /// - Returns:           The instance.\n    @discardableResult\n    public func cURLDescription(calling handler: @escaping (String) -> Void) -> Self {\n        $mutableState.write { mutableState in\n            if mutableState.requests.last != nil {\n                underlyingQueue.async { handler(self.cURLDescription()) }\n            } else {\n                mutableState.cURLHandler = (underlyingQueue, handler)\n            }\n        }\n\n        return self\n    }\n\n    /// Sets a closure to called whenever Alamofire creates a `URLRequest` for this instance.\n    ///\n    /// - Note: This closure will be called multiple times if the instance adapts incoming `URLRequest`s or is retried.\n    ///\n    /// - Parameters:\n    ///   - queue:   `DispatchQueue` on which `handler` will be called. `.main` by default.\n    ///   - handler: Closure to be called when a `URLRequest` is available.\n    ///\n    /// - Returns:   The instance.\n    @discardableResult\n    public func onURLRequestCreation(on queue: DispatchQueue = .main, perform handler: @escaping (URLRequest) -> Void) -> Self {\n        $mutableState.write { state in\n            if let request = state.requests.last {\n                queue.async { handler(request) }\n            }\n\n            state.urlRequestHandler = (queue, handler)\n        }\n\n        return self\n    }\n\n    /// Sets a closure to be called whenever the instance creates a `URLSessionTask`.\n    ///\n    /// - Note: This API should only be used to provide `URLSessionTask`s to existing API, like `NSFileProvider`. It\n    ///         **SHOULD NOT** be used to interact with tasks directly, as that may be break Alamofire features.\n    ///         Additionally, this closure may be called multiple times if the instance is retried.\n    ///\n    /// - Parameters:\n    ///   - queue:   `DispatchQueue` on which `handler` will be called. `.main` by default.\n    ///   - handler: Closure to be called when the `URLSessionTask` is available.\n    ///\n    /// - Returns:   The instance.\n    @discardableResult\n    public func onURLSessionTaskCreation(on queue: DispatchQueue = .main, perform handler: @escaping (URLSessionTask) -> Void) -> Self {\n        $mutableState.write { state in\n            if let task = state.tasks.last {\n                queue.async { handler(task) }\n            }\n\n            state.urlSessionTaskHandler = (queue, handler)\n        }\n\n        return self\n    }\n\n    // MARK: Cleanup\n\n    /// Adds a `finishHandler` closure to be called when the request completes.\n    ///\n    /// - Parameter closure: Closure to be called when the request finishes.\n    func onFinish(perform finishHandler: @escaping () -> Void) {\n        guard !isFinished else { finishHandler(); return }\n\n        $mutableState.write { state in\n            state.finishHandlers.append(finishHandler)\n        }\n    }\n\n    /// Final cleanup step executed when the instance finishes response serialization.\n    func cleanup() {\n        delegate?.cleanup(after: self)\n        let handlers = $mutableState.finishHandlers\n        handlers.forEach { $0() }\n        $mutableState.write { state in\n            state.finishHandlers.removeAll()\n        }\n    }\n}\n\n// MARK: - Protocol Conformances\n\nextension Request: Equatable {\n    public static func ==(lhs: Request, rhs: Request) -> Bool {\n        lhs.id == rhs.id\n    }\n}\n\nextension Request: Hashable {\n    public func hash(into hasher: inout Hasher) {\n        hasher.combine(id)\n    }\n}\n\nextension Request: CustomStringConvertible {\n    /// A textual representation of this instance, including the `HTTPMethod` and `URL` if the `URLRequest` has been\n    /// created, as well as the response status code, if a response has been received.\n    public var description: String {\n        guard let request = performedRequests.last ?? lastRequest,\n              let url = request.url,\n              let method = request.httpMethod else { return \"No request created yet.\" }\n\n        let requestDescription = \"\\(method) \\(url.absoluteString)\"\n\n        return response.map { \"\\(requestDescription) (\\($0.statusCode))\" } ?? requestDescription\n    }\n}\n\nextension Request {\n    /// cURL representation of the instance.\n    ///\n    /// - Returns: The cURL equivalent of the instance.\n    public func cURLDescription() -> String {\n        guard\n            let request = lastRequest,\n            let url = request.url,\n            let host = url.host,\n            let method = request.httpMethod else { return \"$ curl command could not be created\" }\n\n        var components = [\"$ curl -v\"]\n\n        components.append(\"-X \\(method)\")\n\n        if let credentialStorage = delegate?.sessionConfiguration.urlCredentialStorage {\n            let protectionSpace = URLProtectionSpace(host: host,\n                                                     port: url.port ?? 0,\n                                                     protocol: url.scheme,\n                                                     realm: host,\n                                                     authenticationMethod: NSURLAuthenticationMethodHTTPBasic)\n\n            if let credentials = credentialStorage.credentials(for: protectionSpace)?.values {\n                for credential in credentials {\n                    guard let user = credential.user, let password = credential.password else { continue }\n                    components.append(\"-u \\(user):\\(password)\")\n                }\n            } else {\n                if let credential = credential, let user = credential.user, let password = credential.password {\n                    components.append(\"-u \\(user):\\(password)\")\n                }\n            }\n        }\n\n        if let configuration = delegate?.sessionConfiguration, configuration.httpShouldSetCookies {\n            if\n                let cookieStorage = configuration.httpCookieStorage,\n                let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty {\n                let allCookies = cookies.map { \"\\($0.name)=\\($0.value)\" }.joined(separator: \";\")\n\n                components.append(\"-b \\\"\\(allCookies)\\\"\")\n            }\n        }\n\n        var headers = HTTPHeaders()\n\n        if let sessionHeaders = delegate?.sessionConfiguration.headers {\n            for header in sessionHeaders where header.name != \"Cookie\" {\n                headers[header.name] = header.value\n            }\n        }\n\n        for header in request.headers where header.name != \"Cookie\" {\n            headers[header.name] = header.value\n        }\n\n        for header in headers {\n            let escapedValue = header.value.replacingOccurrences(of: \"\\\"\", with: \"\\\\\\\"\")\n            components.append(\"-H \\\"\\(header.name): \\(escapedValue)\\\"\")\n        }\n\n        if let httpBodyData = request.httpBody {\n            let httpBody = String(decoding: httpBodyData, as: UTF8.self)\n            var escapedBody = httpBody.replacingOccurrences(of: \"\\\\\\\"\", with: \"\\\\\\\\\\\"\")\n            escapedBody = escapedBody.replacingOccurrences(of: \"\\\"\", with: \"\\\\\\\"\")\n\n            components.append(\"-d \\\"\\(escapedBody)\\\"\")\n        }\n\n        components.append(\"\\\"\\(url.absoluteString)\\\"\")\n\n        return components.joined(separator: \" \\\\\\n\\t\")\n    }\n}\n\n/// Protocol abstraction for `Request`'s communication back to the `SessionDelegate`.\npublic protocol RequestDelegate: AnyObject {\n    /// `URLSessionConfiguration` used to create the underlying `URLSessionTask`s.\n    var sessionConfiguration: URLSessionConfiguration { get }\n\n    /// Determines whether the `Request` should automatically call `resume()` when adding the first response handler.\n    var startImmediately: Bool { get }\n\n    /// Notifies the delegate the `Request` has reached a point where it needs cleanup.\n    ///\n    /// - Parameter request: The `Request` to cleanup after.\n    func cleanup(after request: Request)\n\n    /// Asynchronously ask the delegate whether a `Request` will be retried.\n    ///\n    /// - Parameters:\n    ///   - request:    `Request` which failed.\n    ///   - error:      `Error` which produced the failure.\n    ///   - completion: Closure taking the `RetryResult` for evaluation.\n    func retryResult(for request: Request, dueTo error: AFError, completion: @escaping (RetryResult) -> Void)\n\n    /// Asynchronously retry the `Request`.\n    ///\n    /// - Parameters:\n    ///   - request:   `Request` which will be retried.\n    ///   - timeDelay: `TimeInterval` after which the retry will be triggered.\n    func retryRequest(_ request: Request, withDelay timeDelay: TimeInterval?)\n}\n\n// MARK: - Subclasses\n\n// MARK: - DataRequest\n\n/// `Request` subclass which handles in-memory `Data` download using `URLSessionDataTask`.\npublic class DataRequest: Request {\n    /// `URLRequestConvertible` value used to create `URLRequest`s for this instance.\n    public let convertible: URLRequestConvertible\n    /// `Data` read from the server so far.\n    public var data: Data? { mutableData }\n\n    /// Protected storage for the `Data` read by the instance.\n    @Protected\n    private var mutableData: Data? = nil\n\n    /// Creates a `DataRequest` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - convertible:        `URLRequestConvertible` value used to create `URLRequest`s for this instance.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`.\n    init(id: UUID = UUID(),\n         convertible: URLRequestConvertible,\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         delegate: RequestDelegate) {\n        self.convertible = convertible\n\n        super.init(id: id,\n                   underlyingQueue: underlyingQueue,\n                   serializationQueue: serializationQueue,\n                   eventMonitor: eventMonitor,\n                   interceptor: interceptor,\n                   delegate: delegate)\n    }\n\n    override func reset() {\n        super.reset()\n\n        mutableData = nil\n    }\n\n    /// Called when `Data` is received by this instance.\n    ///\n    /// - Note: Also calls `updateDownloadProgress`.\n    ///\n    /// - Parameter data: The `Data` received.\n    func didReceive(data: Data) {\n        if self.data == nil {\n            mutableData = data\n        } else {\n            $mutableData.write { $0?.append(data) }\n        }\n\n        updateDownloadProgress()\n    }\n\n    override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        let copiedRequest = request\n        return session.dataTask(with: copiedRequest)\n    }\n\n    /// Called to updated the `downloadProgress` of the instance.\n    func updateDownloadProgress() {\n        let totalBytesReceived = Int64(data?.count ?? 0)\n        let totalBytesExpected = task?.response?.expectedContentLength ?? NSURLSessionTransferSizeUnknown\n\n        downloadProgress.totalUnitCount = totalBytesExpected\n        downloadProgress.completedUnitCount = totalBytesReceived\n\n        downloadProgressHandler?.queue.async { self.downloadProgressHandler?.handler(self.downloadProgress) }\n    }\n\n    /// Validates the request, using the specified closure.\n    ///\n    /// - Note: If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Parameter validation: `Validation` closure used to validate the response.\n    ///\n    /// - Returns:              The instance.\n    @discardableResult\n    public func validate(_ validation: @escaping Validation) -> Self {\n        let validator: () -> Void = { [unowned self] in\n            guard self.error == nil, let response = self.response else { return }\n\n            let result = validation(self.request, response, self.data)\n\n            if case let .failure(error) = result { self.error = error.asAFError(or: .responseValidationFailed(reason: .customValidationFailed(error: error))) }\n\n            self.eventMonitor?.request(self,\n                                       didValidateRequest: self.request,\n                                       response: response,\n                                       data: self.data,\n                                       withResult: result)\n        }\n\n        $validators.write { $0.append(validator) }\n\n        return self\n    }\n}\n\n// MARK: - DataStreamRequest\n\n/// `Request` subclass which streams HTTP response `Data` through a `Handler` closure.\npublic final class DataStreamRequest: Request {\n    /// Closure type handling `DataStreamRequest.Stream` values.\n    public typealias Handler<Success, Failure: Error> = (Stream<Success, Failure>) throws -> Void\n\n    /// Type encapsulating an `Event` as it flows through the stream, as well as a `CancellationToken` which can be used\n    /// to stop the stream at any time.\n    public struct Stream<Success, Failure: Error> {\n        /// Latest `Event` from the stream.\n        public let event: Event<Success, Failure>\n        /// Token used to cancel the stream.\n        public let token: CancellationToken\n\n        /// Cancel the ongoing stream by canceling the underlying `DataStreamRequest`.\n        public func cancel() {\n            token.cancel()\n        }\n    }\n\n    /// Type representing an event flowing through the stream. Contains either the `Result` of processing streamed\n    /// `Data` or the completion of the stream.\n    public enum Event<Success, Failure: Error> {\n        /// Output produced every time the instance receives additional `Data`. The associated value contains the\n        /// `Result` of processing the incoming `Data`.\n        case stream(Result<Success, Failure>)\n        /// Output produced when the instance has completed, whether due to stream end, cancellation, or an error.\n        /// Associated `Completion` value contains the final state.\n        case complete(Completion)\n    }\n\n    /// Value containing the state of a `DataStreamRequest` when the stream was completed.\n    public struct Completion {\n        /// Last `URLRequest` issued by the instance.\n        public let request: URLRequest?\n        /// Last `HTTPURLResponse` received by the instance.\n        public let response: HTTPURLResponse?\n        /// Last `URLSessionTaskMetrics` produced for the instance.\n        public let metrics: URLSessionTaskMetrics?\n        /// `AFError` produced for the instance, if any.\n        public let error: AFError?\n    }\n\n    /// Type used to cancel an ongoing stream.\n    public struct CancellationToken {\n        weak var request: DataStreamRequest?\n\n        init(_ request: DataStreamRequest) {\n            self.request = request\n        }\n\n        /// Cancel the ongoing stream by canceling the underlying `DataStreamRequest`.\n        public func cancel() {\n            request?.cancel()\n        }\n    }\n\n    /// `URLRequestConvertible` value used to create `URLRequest`s for this instance.\n    public let convertible: URLRequestConvertible\n    /// Whether or not the instance will be cancelled if stream parsing encounters an error.\n    public let automaticallyCancelOnStreamError: Bool\n\n    /// Internal mutable state specific to this type.\n    struct StreamMutableState {\n        /// `OutputStream` bound to the `InputStream` produced by `asInputStream`, if it has been called.\n        var outputStream: OutputStream?\n        /// Stream closures called as `Data` is received.\n        var streams: [(_ data: Data) -> Void] = []\n        /// Number of currently executing streams. Used to ensure completions are only fired after all streams are\n        /// enqueued.\n        var numberOfExecutingStreams = 0\n        /// Completion calls enqueued while streams are still executing.\n        var enqueuedCompletionEvents: [() -> Void] = []\n    }\n\n    @Protected\n    var streamMutableState = StreamMutableState()\n\n    /// Creates a `DataStreamRequest` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - id:                               `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()`\n    ///                                        by default.\n    ///   - convertible:                      `URLRequestConvertible` value used to create `URLRequest`s for this\n    ///                                        instance.\n    ///   - automaticallyCancelOnStreamError: `Bool` indicating whether the instance will be cancelled when an `Error`\n    ///                                       is thrown while serializing stream `Data`.\n    ///   - underlyingQueue:                  `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue:               `DispatchQueue` on which all serialization work is performed. By default\n    ///                                       targets\n    ///                                       `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:                     `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:                      `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:                         `RequestDelegate` that provides an interface to actions not performed by\n    ///                                       the `Request`.\n    init(id: UUID = UUID(),\n         convertible: URLRequestConvertible,\n         automaticallyCancelOnStreamError: Bool,\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         delegate: RequestDelegate) {\n        self.convertible = convertible\n        self.automaticallyCancelOnStreamError = automaticallyCancelOnStreamError\n\n        super.init(id: id,\n                   underlyingQueue: underlyingQueue,\n                   serializationQueue: serializationQueue,\n                   eventMonitor: eventMonitor,\n                   interceptor: interceptor,\n                   delegate: delegate)\n    }\n\n    override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        let copiedRequest = request\n        return session.dataTask(with: copiedRequest)\n    }\n\n    override func finish(error: AFError? = nil) {\n        $streamMutableState.write { state in\n            state.outputStream?.close()\n        }\n\n        super.finish(error: error)\n    }\n\n    func didReceive(data: Data) {\n        $streamMutableState.write { state in\n            #if !(os(Linux) || os(Windows))\n            if let stream = state.outputStream {\n                underlyingQueue.async {\n                    var bytes = Array(data)\n                    stream.write(&bytes, maxLength: bytes.count)\n                }\n            }\n            #endif\n            state.numberOfExecutingStreams += state.streams.count\n            let localState = state\n            underlyingQueue.async { localState.streams.forEach { $0(data) } }\n        }\n    }\n\n    /// Validates the `URLRequest` and `HTTPURLResponse` received for the instance using the provided `Validation` closure.\n    ///\n    /// - Parameter validation: `Validation` closure used to validate the request and response.\n    ///\n    /// - Returns:              The `DataStreamRequest`.\n    @discardableResult\n    public func validate(_ validation: @escaping Validation) -> Self {\n        let validator: () -> Void = { [unowned self] in\n            guard self.error == nil, let response = self.response else { return }\n\n            let result = validation(self.request, response)\n\n            if case let .failure(error) = result {\n                self.error = error.asAFError(or: .responseValidationFailed(reason: .customValidationFailed(error: error)))\n            }\n\n            self.eventMonitor?.request(self,\n                                       didValidateRequest: self.request,\n                                       response: response,\n                                       withResult: result)\n        }\n\n        $validators.write { $0.append(validator) }\n\n        return self\n    }\n\n    #if !(os(Linux) || os(Windows))\n    /// Produces an `InputStream` that receives the `Data` received by the instance.\n    ///\n    /// - Note: The `InputStream` produced by this method must have `open()` called before being able to read `Data`.\n    ///         Additionally, this method will automatically call `resume()` on the instance, regardless of whether or\n    ///         not the creating session has `startRequestsImmediately` set to `true`.\n    ///\n    /// - Parameter bufferSize: Size, in bytes, of the buffer between the `OutputStream` and `InputStream`.\n    ///\n    /// - Returns:              The `InputStream` bound to the internal `OutboundStream`.\n    public func asInputStream(bufferSize: Int = 1024) -> InputStream? {\n        defer { resume() }\n\n        var inputStream: InputStream?\n        $streamMutableState.write { state in\n            Foundation.Stream.getBoundStreams(withBufferSize: bufferSize,\n                                              inputStream: &inputStream,\n                                              outputStream: &state.outputStream)\n            state.outputStream?.open()\n        }\n\n        return inputStream\n    }\n    #endif\n\n    func capturingError(from closure: () throws -> Void) {\n        do {\n            try closure()\n        } catch {\n            self.error = error.asAFError(or: .responseSerializationFailed(reason: .customSerializationFailed(error: error)))\n            cancel()\n        }\n    }\n\n    func appendStreamCompletion<Success, Failure>(on queue: DispatchQueue,\n                                                  stream: @escaping Handler<Success, Failure>) {\n        appendResponseSerializer {\n            self.underlyingQueue.async {\n                self.responseSerializerDidComplete {\n                    self.$streamMutableState.write { state in\n                        guard state.numberOfExecutingStreams == 0 else {\n                            state.enqueuedCompletionEvents.append {\n                                self.enqueueCompletion(on: queue, stream: stream)\n                            }\n\n                            return\n                        }\n\n                        self.enqueueCompletion(on: queue, stream: stream)\n                    }\n                }\n            }\n        }\n    }\n\n    func enqueueCompletion<Success, Failure>(on queue: DispatchQueue,\n                                             stream: @escaping Handler<Success, Failure>) {\n        queue.async {\n            do {\n                let completion = Completion(request: self.request,\n                                            response: self.response,\n                                            metrics: self.metrics,\n                                            error: self.error)\n                try stream(.init(event: .complete(completion), token: .init(self)))\n            } catch {\n                // Ignore error, as errors on Completion can't be handled anyway.\n            }\n        }\n    }\n}\n\nextension DataStreamRequest.Stream {\n    /// Incoming `Result` values from `Event.stream`.\n    public var result: Result<Success, Failure>? {\n        guard case let .stream(result) = event else { return nil }\n\n        return result\n    }\n\n    /// `Success` value of the instance, if any.\n    public var value: Success? {\n        guard case let .success(value) = result else { return nil }\n\n        return value\n    }\n\n    /// `Failure` value of the instance, if any.\n    public var error: Failure? {\n        guard case let .failure(error) = result else { return nil }\n\n        return error\n    }\n\n    /// `Completion` value of the instance, if any.\n    public var completion: DataStreamRequest.Completion? {\n        guard case let .complete(completion) = event else { return nil }\n\n        return completion\n    }\n}\n\n// MARK: - DownloadRequest\n\n/// `Request` subclass which downloads `Data` to a file on disk using `URLSessionDownloadTask`.\npublic class DownloadRequest: Request {\n    /// A set of options to be executed prior to moving a downloaded file from the temporary `URL` to the destination\n    /// `URL`.\n    public struct Options: OptionSet {\n        /// Specifies that intermediate directories for the destination URL should be created.\n        public static let createIntermediateDirectories = Options(rawValue: 1 << 0)\n        /// Specifies that any previous file at the destination `URL` should be removed.\n        public static let removePreviousFile = Options(rawValue: 1 << 1)\n\n        public let rawValue: Int\n\n        public init(rawValue: Int) {\n            self.rawValue = rawValue\n        }\n    }\n\n    // MARK: Destination\n\n    /// A closure executed once a `DownloadRequest` has successfully completed in order to determine where to move the\n    /// temporary file written to during the download process. The closure takes two arguments: the temporary file URL\n    /// and the `HTTPURLResponse`, and returns two values: the file URL where the temporary file should be moved and\n    /// the options defining how the file should be moved.\n    ///\n    /// - Note: Downloads from a local `file://` `URL`s do not use the `Destination` closure, as those downloads do not\n    ///         return an `HTTPURLResponse`. Instead the file is merely moved within the temporary directory.\n    public typealias Destination = (_ temporaryURL: URL,\n                                    _ response: HTTPURLResponse) -> (destinationURL: URL, options: Options)\n\n    /// Creates a download file destination closure which uses the default file manager to move the temporary file to a\n    /// file URL in the first available directory with the specified search path directory and search path domain mask.\n    ///\n    /// - Parameters:\n    ///   - directory: The search path directory. `.documentDirectory` by default.\n    ///   - domain:    The search path domain mask. `.userDomainMask` by default.\n    ///   - options:   `DownloadRequest.Options` used when moving the downloaded file to its destination. None by\n    ///                default.\n    /// - Returns: The `Destination` closure.\n    public class func suggestedDownloadDestination(for directory: FileManager.SearchPathDirectory = .documentDirectory,\n                                                   in domain: FileManager.SearchPathDomainMask = .userDomainMask,\n                                                   options: Options = []) -> Destination {\n        { temporaryURL, response in\n            let directoryURLs = FileManager.default.urls(for: directory, in: domain)\n            let url = directoryURLs.first?.appendingPathComponent(response.suggestedFilename!) ?? temporaryURL\n\n            return (url, options)\n        }\n    }\n\n    /// Default `Destination` used by Alamofire to ensure all downloads persist. This `Destination` prepends\n    /// `Alamofire_` to the automatically generated download name and moves it within the temporary directory. Files\n    /// with this destination must be additionally moved if they should survive the system reclamation of temporary\n    /// space.\n    static let defaultDestination: Destination = { url, _ in\n        (defaultDestinationURL(url), [])\n    }\n\n    /// Default `URL` creation closure. Creates a `URL` in the temporary directory with `Alamofire_` prepended to the\n    /// provided file name.\n    static let defaultDestinationURL: (URL) -> URL = { url in\n        let filename = \"Alamofire_\\(url.lastPathComponent)\"\n        let destination = url.deletingLastPathComponent().appendingPathComponent(filename)\n\n        return destination\n    }\n\n    // MARK: Downloadable\n\n    /// Type describing the source used to create the underlying `URLSessionDownloadTask`.\n    public enum Downloadable {\n        /// Download should be started from the `URLRequest` produced by the associated `URLRequestConvertible` value.\n        case request(URLRequestConvertible)\n        /// Download should be started from the associated resume `Data` value.\n        case resumeData(Data)\n    }\n\n    // MARK: Mutable State\n\n    /// Type containing all mutable state for `DownloadRequest` instances.\n    private struct DownloadRequestMutableState {\n        /// Possible resume `Data` produced when cancelling the instance.\n        var resumeData: Data?\n        /// `URL` to which `Data` is being downloaded.\n        var fileURL: URL?\n    }\n\n    /// Protected mutable state specific to `DownloadRequest`.\n    @Protected\n    private var mutableDownloadState = DownloadRequestMutableState()\n\n    /// If the download is resumable and is eventually cancelled or fails, this value may be used to resume the download\n    /// using the `download(resumingWith data:)` API.\n    ///\n    /// - Note: For more information about `resumeData`, see [Apple's documentation](https://developer.apple.com/documentation/foundation/urlsessiondownloadtask/1411634-cancel).\n    public var resumeData: Data? {\n        #if !(os(Linux) || os(Windows))\n        return $mutableDownloadState.resumeData ?? error?.downloadResumeData\n        #else\n        return $mutableDownloadState.resumeData\n        #endif\n    }\n\n    /// If the download is successful, the `URL` where the file was downloaded.\n    public var fileURL: URL? { $mutableDownloadState.fileURL }\n\n    // MARK: Initial State\n\n    /// `Downloadable` value used for this instance.\n    public let downloadable: Downloadable\n    /// The `Destination` to which the downloaded file is moved.\n    let destination: Destination\n\n    /// Creates a `DownloadRequest` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - downloadable:       `Downloadable` value used to create `URLSessionDownloadTasks` for the instance.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`\n    ///   - destination:        `Destination` closure used to move the downloaded file to its final location.\n    init(id: UUID = UUID(),\n         downloadable: Downloadable,\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         delegate: RequestDelegate,\n         destination: @escaping Destination) {\n        self.downloadable = downloadable\n        self.destination = destination\n\n        super.init(id: id,\n                   underlyingQueue: underlyingQueue,\n                   serializationQueue: serializationQueue,\n                   eventMonitor: eventMonitor,\n                   interceptor: interceptor,\n                   delegate: delegate)\n    }\n\n    override func reset() {\n        super.reset()\n\n        $mutableDownloadState.write {\n            $0.resumeData = nil\n            $0.fileURL = nil\n        }\n    }\n\n    /// Called when a download has finished.\n    ///\n    /// - Parameters:\n    ///   - task:   `URLSessionTask` that finished the download.\n    ///   - result: `Result` of the automatic move to `destination`.\n    func didFinishDownloading(using task: URLSessionTask, with result: Result<URL, AFError>) {\n        eventMonitor?.request(self, didFinishDownloadingUsing: task, with: result)\n\n        switch result {\n        case let .success(url): $mutableDownloadState.fileURL = url\n        case let .failure(error): self.error = error\n        }\n    }\n\n    /// Updates the `downloadProgress` using the provided values.\n    ///\n    /// - Parameters:\n    ///   - bytesWritten:              Total bytes written so far.\n    ///   - totalBytesExpectedToWrite: Total bytes expected to write.\n    func updateDownloadProgress(bytesWritten: Int64, totalBytesExpectedToWrite: Int64) {\n        downloadProgress.totalUnitCount = totalBytesExpectedToWrite\n        downloadProgress.completedUnitCount += bytesWritten\n\n        downloadProgressHandler?.queue.async { self.downloadProgressHandler?.handler(self.downloadProgress) }\n    }\n\n    override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        session.downloadTask(with: request)\n    }\n\n    /// Creates a `URLSessionTask` from the provided resume data.\n    ///\n    /// - Parameters:\n    ///   - data:    `Data` used to resume the download.\n    ///   - session: `URLSession` used to create the `URLSessionTask`.\n    ///\n    /// - Returns:   The `URLSessionTask` created.\n    public func task(forResumeData data: Data, using session: URLSession) -> URLSessionTask {\n        session.downloadTask(withResumeData: data)\n    }\n\n    /// Cancels the instance. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended.\n    ///\n    /// - Note: This method will NOT produce resume data. If you wish to cancel and produce resume data, use\n    ///         `cancel(producingResumeData:)` or `cancel(byProducingResumeData:)`.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    override public func cancel() -> Self {\n        cancel(producingResumeData: false)\n    }\n\n    /// Cancels the instance, optionally producing resume data. Once cancelled, a `DownloadRequest` can no longer be\n    /// resumed or suspended.\n    ///\n    /// - Note: If `producingResumeData` is `true`, the `resumeData` property will be populated with any resume data, if\n    ///         available.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func cancel(producingResumeData shouldProduceResumeData: Bool) -> Self {\n        cancel(optionallyProducingResumeData: shouldProduceResumeData ? { _ in } : nil)\n    }\n\n    /// Cancels the instance while producing resume data. Once cancelled, a `DownloadRequest` can no longer be resumed\n    /// or suspended.\n    ///\n    /// - Note: The resume data passed to the completion handler will also be available on the instance's `resumeData`\n    ///         property.\n    ///\n    /// - Parameter completionHandler: The completion handler that is called when the download has been successfully\n    ///                                cancelled. It is not guaranteed to be called on a particular queue, so you may\n    ///                                want use an appropriate queue to perform your work.\n    ///\n    /// - Returns:                     The instance.\n    @discardableResult\n    public func cancel(byProducingResumeData completionHandler: @escaping (_ data: Data?) -> Void) -> Self {\n        cancel(optionallyProducingResumeData: completionHandler)\n    }\n\n    /// Internal implementation of cancellation that optionally takes a resume data handler. If no handler is passed,\n    /// cancellation is performed without producing resume data.\n    ///\n    /// - Parameter completionHandler: Optional resume data handler.\n    ///\n    /// - Returns:                     The instance.\n    private func cancel(optionallyProducingResumeData completionHandler: ((_ resumeData: Data?) -> Void)?) -> Self {\n        $mutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.cancelled) else { return }\n\n            mutableState.state = .cancelled\n\n            underlyingQueue.async { self.didCancel() }\n\n            guard let task = mutableState.tasks.last as? URLSessionDownloadTask, task.state != .completed else {\n                underlyingQueue.async { self.finish() }\n                return\n            }\n\n            if let completionHandler = completionHandler {\n                // Resume to ensure metrics are gathered.\n                task.resume()\n                task.cancel { resumeData in\n                    self.$mutableDownloadState.resumeData = resumeData\n                    self.underlyingQueue.async { self.didCancelTask(task) }\n                    completionHandler(resumeData)\n                }\n            } else {\n                // Resume to ensure metrics are gathered.\n                task.resume()\n                task.cancel()\n                self.underlyingQueue.async { self.didCancelTask(task) }\n            }\n        }\n\n        return self\n    }\n\n    /// Validates the request, using the specified closure.\n    ///\n    /// - Note: If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Parameter validation: `Validation` closure to validate the response.\n    ///\n    /// - Returns:              The instance.\n    @discardableResult\n    public func validate(_ validation: @escaping Validation) -> Self {\n        let validator: () -> Void = { [unowned self] in\n            guard self.error == nil, let response = self.response else { return }\n\n            let result = validation(self.request, response, self.fileURL)\n\n            if case let .failure(error) = result {\n                self.error = error.asAFError(or: .responseValidationFailed(reason: .customValidationFailed(error: error)))\n            }\n\n            self.eventMonitor?.request(self,\n                                       didValidateRequest: self.request,\n                                       response: response,\n                                       fileURL: self.fileURL,\n                                       withResult: result)\n        }\n\n        $validators.write { $0.append(validator) }\n\n        return self\n    }\n}\n\n// MARK: - UploadRequest\n\n/// `DataRequest` subclass which handles `Data` upload from memory, file, or stream using `URLSessionUploadTask`.\npublic class UploadRequest: DataRequest {\n    /// Type describing the origin of the upload, whether `Data`, file, or stream.\n    public enum Uploadable {\n        /// Upload from the provided `Data` value.\n        case data(Data)\n        /// Upload from the provided file `URL`, as well as a `Bool` determining whether the source file should be\n        /// automatically removed once uploaded.\n        case file(URL, shouldRemove: Bool)\n        /// Upload from the provided `InputStream`.\n        case stream(InputStream)\n    }\n\n    // MARK: Initial State\n\n    /// The `UploadableConvertible` value used to produce the `Uploadable` value for this instance.\n    public let upload: UploadableConvertible\n\n    /// `FileManager` used to perform cleanup tasks, including the removal of multipart form encoded payloads written\n    /// to disk.\n    public let fileManager: FileManager\n\n    // MARK: Mutable State\n\n    /// `Uploadable` value used by the instance.\n    public var uploadable: Uploadable?\n\n    /// Creates an `UploadRequest` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - convertible:        `UploadConvertible` value used to determine the type of upload to be performed.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - fileManager:        `FileManager` used to perform cleanup tasks, including the removal of multipart form\n    ///                         encoded payloads written to disk.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`.\n    init(id: UUID = UUID(),\n         convertible: UploadConvertible,\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         fileManager: FileManager,\n         delegate: RequestDelegate) {\n        upload = convertible\n        self.fileManager = fileManager\n\n        super.init(id: id,\n                   convertible: convertible,\n                   underlyingQueue: underlyingQueue,\n                   serializationQueue: serializationQueue,\n                   eventMonitor: eventMonitor,\n                   interceptor: interceptor,\n                   delegate: delegate)\n    }\n\n    /// Called when the `Uploadable` value has been created from the `UploadConvertible`.\n    ///\n    /// - Parameter uploadable: The `Uploadable` that was created.\n    func didCreateUploadable(_ uploadable: Uploadable) {\n        self.uploadable = uploadable\n\n        eventMonitor?.request(self, didCreateUploadable: uploadable)\n    }\n\n    /// Called when the `Uploadable` value could not be created.\n    ///\n    /// - Parameter error: `AFError` produced by the failure.\n    func didFailToCreateUploadable(with error: AFError) {\n        self.error = error\n\n        eventMonitor?.request(self, didFailToCreateUploadableWithError: error)\n\n        retryOrFinish(error: error)\n    }\n\n    override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        guard let uploadable = uploadable else {\n            fatalError(\"Attempting to create a URLSessionUploadTask when Uploadable value doesn't exist.\")\n        }\n\n        switch uploadable {\n        case let .data(data): return session.uploadTask(with: request, from: data)\n        case let .file(url, _): return session.uploadTask(with: request, fromFile: url)\n        case .stream: return session.uploadTask(withStreamedRequest: request)\n        }\n    }\n\n    override func reset() {\n        // Uploadable must be recreated on every retry.\n        uploadable = nil\n\n        super.reset()\n    }\n\n    /// Produces the `InputStream` from `uploadable`, if it can.\n    ///\n    /// - Note: Calling this method with a non-`.stream` `Uploadable` is a logic error and will crash.\n    ///\n    /// - Returns: The `InputStream`.\n    func inputStream() -> InputStream {\n        guard let uploadable = uploadable else {\n            fatalError(\"Attempting to access the input stream but the uploadable doesn't exist.\")\n        }\n\n        guard case let .stream(stream) = uploadable else {\n            fatalError(\"Attempted to access the stream of an UploadRequest that wasn't created with one.\")\n        }\n\n        eventMonitor?.request(self, didProvideInputStream: stream)\n\n        return stream\n    }\n\n    override public func cleanup() {\n        defer { super.cleanup() }\n\n        guard\n            let uploadable = uploadable,\n            case let .file(url, shouldRemove) = uploadable,\n            shouldRemove\n        else { return }\n\n        try? fileManager.removeItem(at: url)\n    }\n}\n\n/// A type that can produce an `UploadRequest.Uploadable` value.\npublic protocol UploadableConvertible {\n    /// Produces an `UploadRequest.Uploadable` value from the instance.\n    ///\n    /// - Returns: The `UploadRequest.Uploadable`.\n    /// - Throws:  Any `Error` produced during creation.\n    func createUploadable() throws -> UploadRequest.Uploadable\n}\n\nextension UploadRequest.Uploadable: UploadableConvertible {\n    public func createUploadable() throws -> UploadRequest.Uploadable {\n        self\n    }\n}\n\n/// A type that can be converted to an upload, whether from an `UploadRequest.Uploadable` or `URLRequestConvertible`.\npublic protocol UploadConvertible: UploadableConvertible & URLRequestConvertible {}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/RequestInterceptor.swift",
    "content": "//\n//  RequestInterceptor.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Stores all state associated with a `URLRequest` being adapted.\npublic struct RequestAdapterState {\n    /// The `UUID` of the `Request` associated with the `URLRequest` to adapt.\n    public let requestID: UUID\n\n    /// The `Session` associated with the `URLRequest` to adapt.\n    public let session: Session\n}\n\n// MARK: -\n\n/// A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary.\npublic protocol RequestAdapter {\n    /// Inspects and adapts the specified `URLRequest` in some manner and calls the completion handler with the Result.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: The `URLRequest` to adapt.\n    ///   - session:    The `Session` that will execute the `URLRequest`.\n    ///   - completion: The completion handler that must be called when adaptation is complete.\n    func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void)\n\n    /// Inspects and adapts the specified `URLRequest` in some manner and calls the completion handler with the Result.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: The `URLRequest` to adapt.\n    ///   - state:      The `RequestAdapterState` associated with the `URLRequest`.\n    ///   - completion: The completion handler that must be called when adaptation is complete.\n    func adapt(_ urlRequest: URLRequest, using state: RequestAdapterState, completion: @escaping (Result<URLRequest, Error>) -> Void)\n}\n\nextension RequestAdapter {\n    public func adapt(_ urlRequest: URLRequest, using state: RequestAdapterState, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        adapt(urlRequest, for: state.session, completion: completion)\n    }\n}\n\n// MARK: -\n\n/// Outcome of determination whether retry is necessary.\npublic enum RetryResult {\n    /// Retry should be attempted immediately.\n    case retry\n    /// Retry should be attempted after the associated `TimeInterval`.\n    case retryWithDelay(TimeInterval)\n    /// Do not retry.\n    case doNotRetry\n    /// Do not retry due to the associated `Error`.\n    case doNotRetryWithError(Error)\n}\n\nextension RetryResult {\n    var retryRequired: Bool {\n        switch self {\n        case .retry, .retryWithDelay: return true\n        default: return false\n        }\n    }\n\n    var delay: TimeInterval? {\n        switch self {\n        case let .retryWithDelay(delay): return delay\n        default: return nil\n        }\n    }\n\n    var error: Error? {\n        guard case let .doNotRetryWithError(error) = self else { return nil }\n        return error\n    }\n}\n\n/// A type that determines whether a request should be retried after being executed by the specified session manager\n/// and encountering an error.\npublic protocol RequestRetrier {\n    /// Determines whether the `Request` should be retried by calling the `completion` closure.\n    ///\n    /// This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs\n    /// to be retried. The one requirement is that the completion closure is called to ensure the request is properly\n    /// cleaned up after.\n    ///\n    /// - Parameters:\n    ///   - request:    `Request` that failed due to the provided `Error`.\n    ///   - session:    `Session` that produced the `Request`.\n    ///   - error:      `Error` encountered while executing the `Request`.\n    ///   - completion: Completion closure to be executed when a retry decision has been determined.\n    func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -> Void)\n}\n\n// MARK: -\n\n/// Type that provides both `RequestAdapter` and `RequestRetrier` functionality.\npublic protocol RequestInterceptor: RequestAdapter, RequestRetrier {}\n\nextension RequestInterceptor {\n    public func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        completion(.success(urlRequest))\n    }\n\n    public func retry(_ request: Request,\n                      for session: Session,\n                      dueTo error: Error,\n                      completion: @escaping (RetryResult) -> Void) {\n        completion(.doNotRetry)\n    }\n}\n\n/// `RequestAdapter` closure definition.\npublic typealias AdaptHandler = (URLRequest, Session, _ completion: @escaping (Result<URLRequest, Error>) -> Void) -> Void\n/// `RequestRetrier` closure definition.\npublic typealias RetryHandler = (Request, Session, Error, _ completion: @escaping (RetryResult) -> Void) -> Void\n\n// MARK: -\n\n/// Closure-based `RequestAdapter`.\nopen class Adapter: RequestInterceptor {\n    private let adaptHandler: AdaptHandler\n\n    /// Creates an instance using the provided closure.\n    ///\n    /// - Parameter adaptHandler: `AdaptHandler` closure to be executed when handling request adaptation.\n    public init(_ adaptHandler: @escaping AdaptHandler) {\n        self.adaptHandler = adaptHandler\n    }\n\n    open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        adaptHandler(urlRequest, session, completion)\n    }\n\n    open func adapt(_ urlRequest: URLRequest, using state: RequestAdapterState, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        adaptHandler(urlRequest, state.session, completion)\n    }\n}\n\n#if swift(>=5.5)\nextension RequestAdapter where Self == Adapter {\n    /// Creates an `Adapter` using the provided `AdaptHandler` closure.\n    ///\n    /// - Parameter closure: `AdaptHandler` to use to adapt the request.\n    /// - Returns:           The `Adapter`.\n    public static func adapter(using closure: @escaping AdaptHandler) -> Adapter {\n        Adapter(closure)\n    }\n}\n#endif\n\n// MARK: -\n\n/// Closure-based `RequestRetrier`.\nopen class Retrier: RequestInterceptor {\n    private let retryHandler: RetryHandler\n\n    /// Creates an instance using the provided closure.\n    ///\n    /// - Parameter retryHandler: `RetryHandler` closure to be executed when handling request retry.\n    public init(_ retryHandler: @escaping RetryHandler) {\n        self.retryHandler = retryHandler\n    }\n\n    open func retry(_ request: Request,\n                    for session: Session,\n                    dueTo error: Error,\n                    completion: @escaping (RetryResult) -> Void) {\n        retryHandler(request, session, error, completion)\n    }\n}\n\n#if swift(>=5.5)\nextension RequestRetrier where Self == Retrier {\n    /// Creates a `Retrier` using the provided `RetryHandler` closure.\n    ///\n    /// - Parameter closure: `RetryHandler` to use to retry the request.\n    /// - Returns:           The `Retrier`.\n    public static func retrier(using closure: @escaping RetryHandler) -> Retrier {\n        Retrier(closure)\n    }\n}\n#endif\n\n// MARK: -\n\n/// `RequestInterceptor` which can use multiple `RequestAdapter` and `RequestRetrier` values.\nopen class Interceptor: RequestInterceptor {\n    /// All `RequestAdapter`s associated with the instance. These adapters will be run until one fails.\n    public let adapters: [RequestAdapter]\n    /// All `RequestRetrier`s associated with the instance. These retriers will be run one at a time until one triggers retry.\n    public let retriers: [RequestRetrier]\n\n    /// Creates an instance from `AdaptHandler` and `RetryHandler` closures.\n    ///\n    /// - Parameters:\n    ///   - adaptHandler: `AdaptHandler` closure to be used.\n    ///   - retryHandler: `RetryHandler` closure to be used.\n    public init(adaptHandler: @escaping AdaptHandler, retryHandler: @escaping RetryHandler) {\n        adapters = [Adapter(adaptHandler)]\n        retriers = [Retrier(retryHandler)]\n    }\n\n    /// Creates an instance from `RequestAdapter` and `RequestRetrier` values.\n    ///\n    /// - Parameters:\n    ///   - adapter: `RequestAdapter` value to be used.\n    ///   - retrier: `RequestRetrier` value to be used.\n    public init(adapter: RequestAdapter, retrier: RequestRetrier) {\n        adapters = [adapter]\n        retriers = [retrier]\n    }\n\n    /// Creates an instance from the arrays of `RequestAdapter` and `RequestRetrier` values.\n    ///\n    /// - Parameters:\n    ///   - adapters:     `RequestAdapter` values to be used.\n    ///   - retriers:     `RequestRetrier` values to be used.\n    ///   - interceptors: `RequestInterceptor`s to be used.\n    public init(adapters: [RequestAdapter] = [], retriers: [RequestRetrier] = [], interceptors: [RequestInterceptor] = []) {\n        self.adapters = adapters + interceptors\n        self.retriers = retriers + interceptors\n    }\n\n    open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        adapt(urlRequest, for: session, using: adapters, completion: completion)\n    }\n\n    private func adapt(_ urlRequest: URLRequest,\n                       for session: Session,\n                       using adapters: [RequestAdapter],\n                       completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        var pendingAdapters = adapters\n\n        guard !pendingAdapters.isEmpty else { completion(.success(urlRequest)); return }\n\n        let adapter = pendingAdapters.removeFirst()\n\n        adapter.adapt(urlRequest, for: session) { result in\n            switch result {\n            case let .success(urlRequest):\n                self.adapt(urlRequest, for: session, using: pendingAdapters, completion: completion)\n            case .failure:\n                completion(result)\n            }\n        }\n    }\n\n    open func adapt(_ urlRequest: URLRequest, using state: RequestAdapterState, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        adapt(urlRequest, using: state, adapters: adapters, completion: completion)\n    }\n\n    private func adapt(_ urlRequest: URLRequest,\n                       using state: RequestAdapterState,\n                       adapters: [RequestAdapter],\n                       completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        var pendingAdapters = adapters\n\n        guard !pendingAdapters.isEmpty else { completion(.success(urlRequest)); return }\n\n        let adapter = pendingAdapters.removeFirst()\n\n        adapter.adapt(urlRequest, using: state) { result in\n            switch result {\n            case let .success(urlRequest):\n                self.adapt(urlRequest, using: state, adapters: pendingAdapters, completion: completion)\n            case .failure:\n                completion(result)\n            }\n        }\n    }\n\n    open func retry(_ request: Request,\n                    for session: Session,\n                    dueTo error: Error,\n                    completion: @escaping (RetryResult) -> Void) {\n        retry(request, for: session, dueTo: error, using: retriers, completion: completion)\n    }\n\n    private func retry(_ request: Request,\n                       for session: Session,\n                       dueTo error: Error,\n                       using retriers: [RequestRetrier],\n                       completion: @escaping (RetryResult) -> Void) {\n        var pendingRetriers = retriers\n\n        guard !pendingRetriers.isEmpty else { completion(.doNotRetry); return }\n\n        let retrier = pendingRetriers.removeFirst()\n\n        retrier.retry(request, for: session, dueTo: error) { result in\n            switch result {\n            case .retry, .retryWithDelay, .doNotRetryWithError:\n                completion(result)\n            case .doNotRetry:\n                // Only continue to the next retrier if retry was not triggered and no error was encountered\n                self.retry(request, for: session, dueTo: error, using: pendingRetriers, completion: completion)\n            }\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension RequestInterceptor where Self == Interceptor {\n    /// Creates an `Interceptor` using the provided `AdaptHandler` and `RetryHandler` closures.\n    ///\n    /// - Parameters:\n    ///   - adapter: `AdapterHandler`to use to adapt the request.\n    ///   - retrier: `RetryHandler` to use to retry the request.\n    /// - Returns:   The `Interceptor`.\n    public static func interceptor(adapter: @escaping AdaptHandler, retrier: @escaping RetryHandler) -> Interceptor {\n        Interceptor(adaptHandler: adapter, retryHandler: retrier)\n    }\n\n    /// Creates an `Interceptor` using the provided `RequestAdapter` and `RequestRetrier` instances.\n    /// - Parameters:\n    ///   - adapter: `RequestAdapter` to use to adapt the request\n    ///   - retrier: `RequestRetrier` to use to retry the request.\n    /// - Returns:   The `Interceptor`.\n    public static func interceptor(adapter: RequestAdapter, retrier: RequestRetrier) -> Interceptor {\n        Interceptor(adapter: adapter, retrier: retrier)\n    }\n\n    /// Creates an `Interceptor` using the provided `RequestAdapter`s, `RequestRetrier`s, and `RequestInterceptor`s.\n    /// - Parameters:\n    ///   - adapters:     `RequestAdapter`s to use to adapt the request. These adapters will be run until one fails.\n    ///   - retriers:     `RequestRetrier`s to use to retry the request. These retriers will be run one at a time until\n    ///                   a retry is triggered.\n    ///   - interceptors: `RequestInterceptor`s to use to intercept the request.\n    /// - Returns:        The `Interceptor`.\n    public static func interceptor(adapters: [RequestAdapter] = [],\n                                   retriers: [RequestRetrier] = [],\n                                   interceptors: [RequestInterceptor] = []) -> Interceptor {\n        Interceptor(adapters: adapters, retriers: retriers, interceptors: interceptors)\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/RequestTaskMap.swift",
    "content": "//\n//  RequestTaskMap.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that maintains a two way, one to one map of `URLSessionTask`s to `Request`s.\nstruct RequestTaskMap {\n    private typealias Events = (completed: Bool, metricsGathered: Bool)\n\n    private var tasksToRequests: [URLSessionTask: Request]\n    private var requestsToTasks: [Request: URLSessionTask]\n    private var taskEvents: [URLSessionTask: Events]\n\n    var requests: [Request] {\n        Array(tasksToRequests.values)\n    }\n\n    init(tasksToRequests: [URLSessionTask: Request] = [:],\n         requestsToTasks: [Request: URLSessionTask] = [:],\n         taskEvents: [URLSessionTask: (completed: Bool, metricsGathered: Bool)] = [:]) {\n        self.tasksToRequests = tasksToRequests\n        self.requestsToTasks = requestsToTasks\n        self.taskEvents = taskEvents\n    }\n\n    subscript(_ request: Request) -> URLSessionTask? {\n        get { requestsToTasks[request] }\n        set {\n            guard let newValue = newValue else {\n                guard let task = requestsToTasks[request] else {\n                    fatalError(\"RequestTaskMap consistency error: no task corresponding to request found.\")\n                }\n\n                requestsToTasks.removeValue(forKey: request)\n                tasksToRequests.removeValue(forKey: task)\n                taskEvents.removeValue(forKey: task)\n\n                return\n            }\n\n            requestsToTasks[request] = newValue\n            tasksToRequests[newValue] = request\n            taskEvents[newValue] = (completed: false, metricsGathered: false)\n        }\n    }\n\n    subscript(_ task: URLSessionTask) -> Request? {\n        get { tasksToRequests[task] }\n        set {\n            guard let newValue = newValue else {\n                guard let request = tasksToRequests[task] else {\n                    fatalError(\"RequestTaskMap consistency error: no request corresponding to task found.\")\n                }\n\n                tasksToRequests.removeValue(forKey: task)\n                requestsToTasks.removeValue(forKey: request)\n                taskEvents.removeValue(forKey: task)\n\n                return\n            }\n\n            tasksToRequests[task] = newValue\n            requestsToTasks[newValue] = task\n            taskEvents[task] = (completed: false, metricsGathered: false)\n        }\n    }\n\n    var count: Int {\n        precondition(tasksToRequests.count == requestsToTasks.count,\n                     \"RequestTaskMap.count invalid, requests.count: \\(tasksToRequests.count) != tasks.count: \\(requestsToTasks.count)\")\n\n        return tasksToRequests.count\n    }\n\n    var eventCount: Int {\n        precondition(taskEvents.count == count, \"RequestTaskMap.eventCount invalid, count: \\(count) != taskEvents.count: \\(taskEvents.count)\")\n\n        return taskEvents.count\n    }\n\n    var isEmpty: Bool {\n        precondition(tasksToRequests.isEmpty == requestsToTasks.isEmpty,\n                     \"RequestTaskMap.isEmpty invalid, requests.isEmpty: \\(tasksToRequests.isEmpty) != tasks.isEmpty: \\(requestsToTasks.isEmpty)\")\n\n        return tasksToRequests.isEmpty\n    }\n\n    var isEventsEmpty: Bool {\n        precondition(taskEvents.isEmpty == isEmpty, \"RequestTaskMap.isEventsEmpty invalid, isEmpty: \\(isEmpty) != taskEvents.isEmpty: \\(taskEvents.isEmpty)\")\n\n        return taskEvents.isEmpty\n    }\n\n    mutating func disassociateIfNecessaryAfterGatheringMetricsForTask(_ task: URLSessionTask) -> Bool {\n        guard let events = taskEvents[task] else {\n            fatalError(\"RequestTaskMap consistency error: no events corresponding to task found.\")\n        }\n\n        switch (events.completed, events.metricsGathered) {\n        case (_, true): fatalError(\"RequestTaskMap consistency error: duplicate metricsGatheredForTask call.\")\n        case (false, false): taskEvents[task] = (completed: false, metricsGathered: true); return false\n        case (true, false): self[task] = nil; return true\n        }\n    }\n\n    mutating func disassociateIfNecessaryAfterCompletingTask(_ task: URLSessionTask) -> Bool {\n        guard let events = taskEvents[task] else {\n            fatalError(\"RequestTaskMap consistency error: no events corresponding to task found.\")\n        }\n\n        switch (events.completed, events.metricsGathered) {\n        case (true, _): fatalError(\"RequestTaskMap consistency error: duplicate completionReceivedForTask call.\")\n        #if os(Linux) // Linux doesn't gather metrics, so unconditionally remove the reference and return true.\n        default: self[task] = nil; return true\n        #else\n        case (false, false):\n            if #available(macOS 10.12, iOS 10, watchOS 7, tvOS 10, *) {\n                taskEvents[task] = (completed: true, metricsGathered: false); return false\n            } else {\n                // watchOS < 7 doesn't gather metrics, so unconditionally remove the reference and return true.\n                self[task] = nil; return true\n            }\n        case (false, true):\n            self[task] = nil; return true\n        #endif\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Response.swift",
    "content": "//\n//  Response.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Default type of `DataResponse` returned by Alamofire, with an `AFError` `Failure` type.\npublic typealias AFDataResponse<Success> = DataResponse<Success, AFError>\n/// Default type of `DownloadResponse` returned by Alamofire, with an `AFError` `Failure` type.\npublic typealias AFDownloadResponse<Success> = DownloadResponse<Success, AFError>\n\n/// Type used to store all values associated with a serialized response of a `DataRequest` or `UploadRequest`.\npublic struct DataResponse<Success, Failure: Error> {\n    /// The URL request sent to the server.\n    public let request: URLRequest?\n\n    /// The server's response to the URL request.\n    public let response: HTTPURLResponse?\n\n    /// The data returned by the server.\n    public let data: Data?\n\n    /// The final metrics of the response.\n    ///\n    /// - Note: Due to `FB7624529`, collection of `URLSessionTaskMetrics` on watchOS is currently disabled.`\n    ///\n    public let metrics: URLSessionTaskMetrics?\n\n    /// The time taken to serialize the response.\n    public let serializationDuration: TimeInterval\n\n    /// The result of response serialization.\n    public let result: Result<Success, Failure>\n\n    /// Returns the associated value of the result if it is a success, `nil` otherwise.\n    public var value: Success? { result.success }\n\n    /// Returns the associated error value if the result if it is a failure, `nil` otherwise.\n    public var error: Failure? { result.failure }\n\n    /// Creates a `DataResponse` instance with the specified parameters derived from the response serialization.\n    ///\n    /// - Parameters:\n    ///   - request:               The `URLRequest` sent to the server.\n    ///   - response:              The `HTTPURLResponse` from the server.\n    ///   - data:                  The `Data` returned by the server.\n    ///   - metrics:               The `URLSessionTaskMetrics` of the `DataRequest` or `UploadRequest`.\n    ///   - serializationDuration: The duration taken by serialization.\n    ///   - result:                The `Result` of response serialization.\n    public init(request: URLRequest?,\n                response: HTTPURLResponse?,\n                data: Data?,\n                metrics: URLSessionTaskMetrics?,\n                serializationDuration: TimeInterval,\n                result: Result<Success, Failure>) {\n        self.request = request\n        self.response = response\n        self.data = data\n        self.metrics = metrics\n        self.serializationDuration = serializationDuration\n        self.result = result\n    }\n}\n\n// MARK: -\n\nextension DataResponse: CustomStringConvertible, CustomDebugStringConvertible {\n    /// The textual representation used when written to an output stream, which includes whether the result was a\n    /// success or failure.\n    public var description: String {\n        \"\\(result)\"\n    }\n\n    /// The debug textual representation used when written to an output stream, which includes (if available) a summary\n    /// of the `URLRequest`, the request's headers and body (if decodable as a `String` below 100KB); the\n    /// `HTTPURLResponse`'s status code, headers, and body; the duration of the network and serialization actions; and\n    /// the `Result` of serialization.\n    public var debugDescription: String {\n        guard let urlRequest = request else { return \"[Request]: None\\n[Result]: \\(result)\" }\n\n        let requestDescription = DebugDescription.description(of: urlRequest)\n\n        let responseDescription = response.map { response in\n            let responseBodyDescription = DebugDescription.description(for: data, headers: response.headers)\n\n            return \"\"\"\n            \\(DebugDescription.description(of: response))\n                \\(responseBodyDescription.indentingNewlines())\n            \"\"\"\n        } ?? \"[Response]: None\"\n\n        let networkDuration = metrics.map { \"\\($0.taskInterval.duration)s\" } ?? \"None\"\n\n        return \"\"\"\n        \\(requestDescription)\n        \\(responseDescription)\n        [Network Duration]: \\(networkDuration)\n        [Serialization Duration]: \\(serializationDuration)s\n        [Result]: \\(result)\n        \"\"\"\n    }\n}\n\n// MARK: -\n\nextension DataResponse {\n    /// Evaluates the specified closure when the result of this `DataResponse` is a success, passing the unwrapped\n    /// result value as a parameter.\n    ///\n    /// Use the `map` method with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let possibleInt = possibleData.map { $0.count }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A `DataResponse` whose result wraps the value returned by the given closure. If this instance's\n    ///            result is a failure, returns a response wrapping the same failure.\n    public func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DataResponse<NewSuccess, Failure> {\n        DataResponse<NewSuccess, Failure>(request: request,\n                                          response: response,\n                                          data: data,\n                                          metrics: metrics,\n                                          serializationDuration: serializationDuration,\n                                          result: result.map(transform))\n    }\n\n    /// Evaluates the given closure when the result of this `DataResponse` is a success, passing the unwrapped result\n    /// value as a parameter.\n    ///\n    /// Use the `tryMap` method with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMap {\n    ///         try JSONSerialization.jsonObject(with: $0)\n    ///     }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A success or failure `DataResponse` depending on the result of the given closure. If this instance's\n    ///            result is a failure, returns the same failure.\n    public func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DataResponse<NewSuccess, Error> {\n        DataResponse<NewSuccess, Error>(request: request,\n                                        response: response,\n                                        data: data,\n                                        metrics: metrics,\n                                        serializationDuration: serializationDuration,\n                                        result: result.tryMap(transform))\n    }\n\n    /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `mapError` function with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let withMyError = possibleData.mapError { MyError.error($0) }\n    ///\n    /// - Parameter transform: A closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DataResponse` instance containing the result of the transform.\n    public func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DataResponse<Success, NewFailure> {\n        DataResponse<Success, NewFailure>(request: request,\n                                          response: response,\n                                          data: data,\n                                          metrics: metrics,\n                                          serializationDuration: serializationDuration,\n                                          result: result.mapError(transform))\n    }\n\n    /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `tryMapError` function with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMapError {\n    ///         try someFailableFunction(taking: $0)\n    ///     }\n    ///\n    /// - Parameter transform: A throwing closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DataResponse` instance containing the result of the transform.\n    public func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DataResponse<Success, Error> {\n        DataResponse<Success, Error>(request: request,\n                                     response: response,\n                                     data: data,\n                                     metrics: metrics,\n                                     serializationDuration: serializationDuration,\n                                     result: result.tryMapError(transform))\n    }\n}\n\n// MARK: -\n\n/// Used to store all data associated with a serialized response of a download request.\npublic struct DownloadResponse<Success, Failure: Error> {\n    /// The URL request sent to the server.\n    public let request: URLRequest?\n\n    /// The server's response to the URL request.\n    public let response: HTTPURLResponse?\n\n    /// The final destination URL of the data returned from the server after it is moved.\n    public let fileURL: URL?\n\n    /// The resume data generated if the request was cancelled.\n    public let resumeData: Data?\n\n    /// The final metrics of the response.\n    ///\n    /// - Note: Due to `FB7624529`, collection of `URLSessionTaskMetrics` on watchOS is currently disabled.`\n    ///\n    public let metrics: URLSessionTaskMetrics?\n\n    /// The time taken to serialize the response.\n    public let serializationDuration: TimeInterval\n\n    /// The result of response serialization.\n    public let result: Result<Success, Failure>\n\n    /// Returns the associated value of the result if it is a success, `nil` otherwise.\n    public var value: Success? { result.success }\n\n    /// Returns the associated error value if the result if it is a failure, `nil` otherwise.\n    public var error: Failure? { result.failure }\n\n    /// Creates a `DownloadResponse` instance with the specified parameters derived from response serialization.\n    ///\n    /// - Parameters:\n    ///   - request:               The `URLRequest` sent to the server.\n    ///   - response:              The `HTTPURLResponse` from the server.\n    ///   - fileURL:               The final destination URL of the data returned from the server after it is moved.\n    ///   - resumeData:            The resume `Data` generated if the request was cancelled.\n    ///   - metrics:               The `URLSessionTaskMetrics` of the `DownloadRequest`.\n    ///   - serializationDuration: The duration taken by serialization.\n    ///   - result:                The `Result` of response serialization.\n    public init(request: URLRequest?,\n                response: HTTPURLResponse?,\n                fileURL: URL?,\n                resumeData: Data?,\n                metrics: URLSessionTaskMetrics?,\n                serializationDuration: TimeInterval,\n                result: Result<Success, Failure>) {\n        self.request = request\n        self.response = response\n        self.fileURL = fileURL\n        self.resumeData = resumeData\n        self.metrics = metrics\n        self.serializationDuration = serializationDuration\n        self.result = result\n    }\n}\n\n// MARK: -\n\nextension DownloadResponse: CustomStringConvertible, CustomDebugStringConvertible {\n    /// The textual representation used when written to an output stream, which includes whether the result was a\n    /// success or failure.\n    public var description: String {\n        \"\\(result)\"\n    }\n\n    /// The debug textual representation used when written to an output stream, which includes the URL request, the URL\n    /// response, the temporary and destination URLs, the resume data, the durations of the network and serialization\n    /// actions, and the response serialization result.\n    public var debugDescription: String {\n        guard let urlRequest = request else { return \"[Request]: None\\n[Result]: \\(result)\" }\n\n        let requestDescription = DebugDescription.description(of: urlRequest)\n        let responseDescription = response.map(DebugDescription.description(of:)) ?? \"[Response]: None\"\n        let networkDuration = metrics.map { \"\\($0.taskInterval.duration)s\" } ?? \"None\"\n        let resumeDataDescription = resumeData.map { \"\\($0)\" } ?? \"None\"\n\n        return \"\"\"\n        \\(requestDescription)\n        \\(responseDescription)\n        [File URL]: \\(fileURL?.path ?? \"None\")\n        [Resume Data]: \\(resumeDataDescription)\n        [Network Duration]: \\(networkDuration)\n        [Serialization Duration]: \\(serializationDuration)s\n        [Result]: \\(result)\n        \"\"\"\n    }\n}\n\n// MARK: -\n\nextension DownloadResponse {\n    /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped\n    /// result value as a parameter.\n    ///\n    /// Use the `map` method with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let possibleInt = possibleData.map { $0.count }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance's\n    ///            result is a failure, returns a response wrapping the same failure.\n    public func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DownloadResponse<NewSuccess, Failure> {\n        DownloadResponse<NewSuccess, Failure>(request: request,\n                                              response: response,\n                                              fileURL: fileURL,\n                                              resumeData: resumeData,\n                                              metrics: metrics,\n                                              serializationDuration: serializationDuration,\n                                              result: result.map(transform))\n    }\n\n    /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped\n    /// result value as a parameter.\n    ///\n    /// Use the `tryMap` method with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMap {\n    ///         try JSONSerialization.jsonObject(with: $0)\n    ///     }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A success or failure `DownloadResponse` depending on the result of the given closure. If this\n    /// instance's result is a failure, returns the same failure.\n    public func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DownloadResponse<NewSuccess, Error> {\n        DownloadResponse<NewSuccess, Error>(request: request,\n                                            response: response,\n                                            fileURL: fileURL,\n                                            resumeData: resumeData,\n                                            metrics: metrics,\n                                            serializationDuration: serializationDuration,\n                                            result: result.tryMap(transform))\n    }\n\n    /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `mapError` function with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let withMyError = possibleData.mapError { MyError.error($0) }\n    ///\n    /// - Parameter transform: A closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DownloadResponse` instance containing the result of the transform.\n    public func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DownloadResponse<Success, NewFailure> {\n        DownloadResponse<Success, NewFailure>(request: request,\n                                              response: response,\n                                              fileURL: fileURL,\n                                              resumeData: resumeData,\n                                              metrics: metrics,\n                                              serializationDuration: serializationDuration,\n                                              result: result.mapError(transform))\n    }\n\n    /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `tryMapError` function with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMapError {\n    ///         try someFailableFunction(taking: $0)\n    ///     }\n    ///\n    /// - Parameter transform: A throwing closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DownloadResponse` instance containing the result of the transform.\n    public func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DownloadResponse<Success, Error> {\n        DownloadResponse<Success, Error>(request: request,\n                                         response: response,\n                                         fileURL: fileURL,\n                                         resumeData: resumeData,\n                                         metrics: metrics,\n                                         serializationDuration: serializationDuration,\n                                         result: result.tryMapError(transform))\n    }\n}\n\nprivate enum DebugDescription {\n    static func description(of request: URLRequest) -> String {\n        let requestSummary = \"\\(request.httpMethod!) \\(request)\"\n        let requestHeadersDescription = DebugDescription.description(for: request.headers)\n        let requestBodyDescription = DebugDescription.description(for: request.httpBody, headers: request.headers)\n\n        return \"\"\"\n        [Request]: \\(requestSummary)\n            \\(requestHeadersDescription.indentingNewlines())\n            \\(requestBodyDescription.indentingNewlines())\n        \"\"\"\n    }\n\n    static func description(of response: HTTPURLResponse) -> String {\n        \"\"\"\n        [Response]:\n            [Status Code]: \\(response.statusCode)\n            \\(DebugDescription.description(for: response.headers).indentingNewlines())\n        \"\"\"\n    }\n\n    static func description(for headers: HTTPHeaders) -> String {\n        guard !headers.isEmpty else { return \"[Headers]: None\" }\n\n        let headerDescription = \"\\(headers.sorted())\".indentingNewlines()\n        return \"\"\"\n        [Headers]:\n            \\(headerDescription)\n        \"\"\"\n    }\n\n    static func description(for data: Data?,\n                            headers: HTTPHeaders,\n                            allowingPrintableTypes printableTypes: [String] = [\"json\", \"xml\", \"text\"],\n                            maximumLength: Int = 100_000) -> String {\n        guard let data = data, !data.isEmpty else { return \"[Body]: None\" }\n\n        guard\n            data.count <= maximumLength,\n            printableTypes.compactMap({ headers[\"Content-Type\"]?.contains($0) }).contains(true)\n        else { return \"[Body]: \\(data.count) bytes\" }\n\n        return \"\"\"\n        [Body]:\n            \\(String(decoding: data, as: UTF8.self)\n            .trimmingCharacters(in: .whitespacesAndNewlines)\n            .indentingNewlines())\n        \"\"\"\n    }\n}\n\nextension String {\n    fileprivate func indentingNewlines(by spaceCount: Int = 4) -> String {\n        let spaces = String(repeating: \" \", count: spaceCount)\n        return replacingOccurrences(of: \"\\n\", with: \"\\n\\(spaces)\")\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/ResponseSerialization.swift",
    "content": "//\n//  ResponseSerialization.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n// MARK: Protocols\n\n/// The type to which all data response serializers must conform in order to serialize a response.\npublic protocol DataResponseSerializerProtocol {\n    /// The type of serialized object to be created.\n    associatedtype SerializedObject\n\n    /// Serialize the response `Data` into the provided type..\n    ///\n    /// - Parameters:\n    ///   - request:  `URLRequest` which was used to perform the request, if any.\n    ///   - response: `HTTPURLResponse` received from the server, if any.\n    ///   - data:     `Data` returned from the server, if any.\n    ///   - error:    `Error` produced by Alamofire or the underlying `URLSession` during the request.\n    ///\n    /// - Returns:    The `SerializedObject`.\n    /// - Throws:     Any `Error` produced during serialization.\n    func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> SerializedObject\n}\n\n/// The type to which all download response serializers must conform in order to serialize a response.\npublic protocol DownloadResponseSerializerProtocol {\n    /// The type of serialized object to be created.\n    associatedtype SerializedObject\n\n    /// Serialize the downloaded response `Data` from disk into the provided type..\n    ///\n    /// - Parameters:\n    ///   - request:  `URLRequest` which was used to perform the request, if any.\n    ///   - response: `HTTPURLResponse` received from the server, if any.\n    ///   - fileURL:  File `URL` to which the response data was downloaded.\n    ///   - error:    `Error` produced by Alamofire or the underlying `URLSession` during the request.\n    ///\n    /// - Returns:    The `SerializedObject`.\n    /// - Throws:     Any `Error` produced during serialization.\n    func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> SerializedObject\n}\n\n/// A serializer that can handle both data and download responses.\npublic protocol ResponseSerializer: DataResponseSerializerProtocol & DownloadResponseSerializerProtocol {\n    /// `DataPreprocessor` used to prepare incoming `Data` for serialization.\n    var dataPreprocessor: DataPreprocessor { get }\n    /// `HTTPMethod`s for which empty response bodies are considered appropriate.\n    var emptyRequestMethods: Set<HTTPMethod> { get }\n    /// HTTP response codes for which empty response bodies are considered appropriate.\n    var emptyResponseCodes: Set<Int> { get }\n}\n\n/// Type used to preprocess `Data` before it handled by a serializer.\npublic protocol DataPreprocessor {\n    /// Process           `Data` before it's handled by a serializer.\n    /// - Parameter data: The raw `Data` to process.\n    func preprocess(_ data: Data) throws -> Data\n}\n\n/// `DataPreprocessor` that returns passed `Data` without any transform.\npublic struct PassthroughPreprocessor: DataPreprocessor {\n    public init() {}\n\n    public func preprocess(_ data: Data) throws -> Data { data }\n}\n\n/// `DataPreprocessor` that trims Google's typical `)]}',\\n` XSSI JSON header.\npublic struct GoogleXSSIPreprocessor: DataPreprocessor {\n    public init() {}\n\n    public func preprocess(_ data: Data) throws -> Data {\n        (data.prefix(6) == Data(\")]}',\\n\".utf8)) ? data.dropFirst(6) : data\n    }\n}\n\n#if swift(>=5.5)\nextension DataPreprocessor where Self == PassthroughPreprocessor {\n    /// Provides a `PassthroughPreprocessor` instance.\n    public static var passthrough: PassthroughPreprocessor { PassthroughPreprocessor() }\n}\n\nextension DataPreprocessor where Self == GoogleXSSIPreprocessor {\n    /// Provides a `GoogleXSSIPreprocessor` instance.\n    public static var googleXSSI: GoogleXSSIPreprocessor { GoogleXSSIPreprocessor() }\n}\n#endif\n\nextension ResponseSerializer {\n    /// Default `DataPreprocessor`. `PassthroughPreprocessor` by default.\n    public static var defaultDataPreprocessor: DataPreprocessor { PassthroughPreprocessor() }\n    /// Default `HTTPMethod`s for which empty response bodies are considered appropriate. `[.head]` by default.\n    public static var defaultEmptyRequestMethods: Set<HTTPMethod> { [.head] }\n    /// HTTP response codes for which empty response bodies are considered appropriate. `[204, 205]` by default.\n    public static var defaultEmptyResponseCodes: Set<Int> { [204, 205] }\n\n    public var dataPreprocessor: DataPreprocessor { Self.defaultDataPreprocessor }\n    public var emptyRequestMethods: Set<HTTPMethod> { Self.defaultEmptyRequestMethods }\n    public var emptyResponseCodes: Set<Int> { Self.defaultEmptyResponseCodes }\n\n    /// Determines whether the `request` allows empty response bodies, if `request` exists.\n    ///\n    /// - Parameter request: `URLRequest` to evaluate.\n    ///\n    /// - Returns:           `Bool` representing the outcome of the evaluation, or `nil` if `request` was `nil`.\n    public func requestAllowsEmptyResponseData(_ request: URLRequest?) -> Bool? {\n        request.flatMap(\\.httpMethod)\n            .flatMap(HTTPMethod.init)\n            .map { emptyRequestMethods.contains($0) }\n    }\n\n    /// Determines whether the `response` allows empty response bodies, if `response` exists`.\n    ///\n    /// - Parameter response: `HTTPURLResponse` to evaluate.\n    ///\n    /// - Returns:            `Bool` representing the outcome of the evaluation, or `nil` if `response` was `nil`.\n    public func responseAllowsEmptyResponseData(_ response: HTTPURLResponse?) -> Bool? {\n        response.map(\\.statusCode)\n            .map { emptyResponseCodes.contains($0) }\n    }\n\n    /// Determines whether `request` and `response` allow empty response bodies.\n    ///\n    /// - Parameters:\n    ///   - request:  `URLRequest` to evaluate.\n    ///   - response: `HTTPURLResponse` to evaluate.\n    ///\n    /// - Returns:    `true` if `request` or `response` allow empty bodies, `false` otherwise.\n    public func emptyResponseAllowed(forRequest request: URLRequest?, response: HTTPURLResponse?) -> Bool {\n        (requestAllowsEmptyResponseData(request) == true) || (responseAllowsEmptyResponseData(response) == true)\n    }\n}\n\n/// By default, any serializer declared to conform to both types will get file serialization for free, as it just feeds\n/// the data read from disk into the data response serializer.\nextension DownloadResponseSerializerProtocol where Self: DataResponseSerializerProtocol {\n    public func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Self.SerializedObject {\n        guard error == nil else { throw error! }\n\n        guard let fileURL = fileURL else {\n            throw AFError.responseSerializationFailed(reason: .inputFileNil)\n        }\n\n        let data: Data\n        do {\n            data = try Data(contentsOf: fileURL)\n        } catch {\n            throw AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))\n        }\n\n        do {\n            return try serialize(request: request, response: response, data: data, error: error)\n        } catch {\n            throw error\n        }\n    }\n}\n\n// MARK: - Default\n\nextension DataRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - completionHandler: The code to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func response(queue: DispatchQueue = .main, completionHandler: @escaping (AFDataResponse<Data?>) -> Void) -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let result = AFResult<Data?>(value: self.data, error: self.error)\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DataResponse(request: self.request,\n                                            response: self.response,\n                                            data: self.data,\n                                            metrics: self.metrics,\n                                            serializationDuration: 0,\n                                            result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n            }\n        }\n\n        return self\n    }\n\n    private func _response<Serializer: DataResponseSerializerProtocol>(queue: DispatchQueue = .main,\n                                                                       responseSerializer: Serializer,\n                                                                       completionHandler: @escaping (AFDataResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let start = ProcessInfo.processInfo.systemUptime\n            let result: AFResult<Serializer.SerializedObject> = Result {\n                try responseSerializer.serialize(request: self.request,\n                                                 response: self.response,\n                                                 data: self.data,\n                                                 error: self.error)\n            }.mapError { error in\n                error.asAFError(or: .responseSerializationFailed(reason: .customSerializationFailed(error: error)))\n            }\n\n            let end = ProcessInfo.processInfo.systemUptime\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DataResponse(request: self.request,\n                                            response: self.response,\n                                            data: self.data,\n                                            metrics: self.metrics,\n                                            serializationDuration: end - start,\n                                            result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                guard let serializerError = result.failure, let delegate = self.delegate else {\n                    self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n                    return\n                }\n\n                delegate.retryResult(for: self, dueTo: serializerError) { retryResult in\n                    var didComplete: (() -> Void)?\n\n                    defer {\n                        if let didComplete = didComplete {\n                            self.responseSerializerDidComplete { queue.async { didComplete() } }\n                        }\n                    }\n\n                    switch retryResult {\n                    case .doNotRetry:\n                        didComplete = { completionHandler(response) }\n\n                    case let .doNotRetryWithError(retryError):\n                        let result: AFResult<Serializer.SerializedObject> = .failure(retryError.asAFError(orFailWith: \"Received retryError was not already AFError\"))\n\n                        let response = DataResponse(request: self.request,\n                                                    response: self.response,\n                                                    data: self.data,\n                                                    metrics: self.metrics,\n                                                    serializationDuration: end - start,\n                                                    result: result)\n\n                        didComplete = { completionHandler(response) }\n\n                    case .retry, .retryWithDelay:\n                        delegate.retryRequest(self, withDelay: retryResult.delay)\n                    }\n                }\n            }\n        }\n\n        return self\n    }\n\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:              The queue on which the completion handler is dispatched. `.main` by default\n    ///   - responseSerializer: The response serializer responsible for serializing the request, response, and data.\n    ///   - completionHandler:  The code to be executed once the request has finished.\n    ///\n    /// - Returns:              The request.\n    @discardableResult\n    public func response<Serializer: DataResponseSerializerProtocol>(queue: DispatchQueue = .main,\n                                                                     responseSerializer: Serializer,\n                                                                     completionHandler: @escaping (AFDataResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        _response(queue: queue, responseSerializer: responseSerializer, completionHandler: completionHandler)\n    }\n\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:              The queue on which the completion handler is dispatched. `.main` by default\n    ///   - responseSerializer: The response serializer responsible for serializing the request, response, and data.\n    ///   - completionHandler:  The code to be executed once the request has finished.\n    ///\n    /// - Returns:              The request.\n    @discardableResult\n    public func response<Serializer: ResponseSerializer>(queue: DispatchQueue = .main,\n                                                         responseSerializer: Serializer,\n                                                         completionHandler: @escaping (AFDataResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        _response(queue: queue, responseSerializer: responseSerializer, completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - completionHandler: The code to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func response(queue: DispatchQueue = .main,\n                         completionHandler: @escaping (AFDownloadResponse<URL?>) -> Void)\n        -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let result = AFResult<URL?>(value: self.fileURL, error: self.error)\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DownloadResponse(request: self.request,\n                                                response: self.response,\n                                                fileURL: self.fileURL,\n                                                resumeData: self.resumeData,\n                                                metrics: self.metrics,\n                                                serializationDuration: 0,\n                                                result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n            }\n        }\n\n        return self\n    }\n\n    private func _response<Serializer: DownloadResponseSerializerProtocol>(queue: DispatchQueue = .main,\n                                                                           responseSerializer: Serializer,\n                                                                           completionHandler: @escaping (AFDownloadResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let start = ProcessInfo.processInfo.systemUptime\n            let result: AFResult<Serializer.SerializedObject> = Result {\n                try responseSerializer.serializeDownload(request: self.request,\n                                                         response: self.response,\n                                                         fileURL: self.fileURL,\n                                                         error: self.error)\n            }.mapError { error in\n                error.asAFError(or: .responseSerializationFailed(reason: .customSerializationFailed(error: error)))\n            }\n            let end = ProcessInfo.processInfo.systemUptime\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DownloadResponse(request: self.request,\n                                                response: self.response,\n                                                fileURL: self.fileURL,\n                                                resumeData: self.resumeData,\n                                                metrics: self.metrics,\n                                                serializationDuration: end - start,\n                                                result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                guard let serializerError = result.failure, let delegate = self.delegate else {\n                    self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n                    return\n                }\n\n                delegate.retryResult(for: self, dueTo: serializerError) { retryResult in\n                    var didComplete: (() -> Void)?\n\n                    defer {\n                        if let didComplete = didComplete {\n                            self.responseSerializerDidComplete { queue.async { didComplete() } }\n                        }\n                    }\n\n                    switch retryResult {\n                    case .doNotRetry:\n                        didComplete = { completionHandler(response) }\n\n                    case let .doNotRetryWithError(retryError):\n                        let result: AFResult<Serializer.SerializedObject> = .failure(retryError.asAFError(orFailWith: \"Received retryError was not already AFError\"))\n\n                        let response = DownloadResponse(request: self.request,\n                                                        response: self.response,\n                                                        fileURL: self.fileURL,\n                                                        resumeData: self.resumeData,\n                                                        metrics: self.metrics,\n                                                        serializationDuration: end - start,\n                                                        result: result)\n\n                        didComplete = { completionHandler(response) }\n\n                    case .retry, .retryWithDelay:\n                        delegate.retryRequest(self, withDelay: retryResult.delay)\n                    }\n                }\n            }\n        }\n\n        return self\n    }\n\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:              The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - responseSerializer: The response serializer responsible for serializing the request, response, and data\n    ///                         contained in the destination `URL`.\n    ///   - completionHandler:  The code to be executed once the request has finished.\n    ///\n    /// - Returns:              The request.\n    @discardableResult\n    public func response<Serializer: DownloadResponseSerializerProtocol>(queue: DispatchQueue = .main,\n                                                                         responseSerializer: Serializer,\n                                                                         completionHandler: @escaping (AFDownloadResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        _response(queue: queue, responseSerializer: responseSerializer, completionHandler: completionHandler)\n    }\n\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:              The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - responseSerializer: The response serializer responsible for serializing the request, response, and data\n    ///                         contained in the destination `URL`.\n    ///   - completionHandler:  The code to be executed once the request has finished.\n    ///\n    /// - Returns:              The request.\n    @discardableResult\n    public func response<Serializer: ResponseSerializer>(queue: DispatchQueue = .main,\n                                                         responseSerializer: Serializer,\n                                                         completionHandler: @escaping (AFDownloadResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        _response(queue: queue, responseSerializer: responseSerializer, completionHandler: completionHandler)\n    }\n}\n\n// MARK: - URL\n\n/// A `DownloadResponseSerializerProtocol` that performs only `Error` checking and ensures that a downloaded `fileURL`\n/// is present.\npublic struct URLResponseSerializer: DownloadResponseSerializerProtocol {\n    /// Creates an instance.\n    public init() {}\n\n    public func serializeDownload(request: URLRequest?,\n                                  response: HTTPURLResponse?,\n                                  fileURL: URL?,\n                                  error: Error?) throws -> URL {\n        guard error == nil else { throw error! }\n\n        guard let url = fileURL else {\n            throw AFError.responseSerializationFailed(reason: .inputFileNil)\n        }\n\n        return url\n    }\n}\n\n#if swift(>=5.5)\nextension DownloadResponseSerializerProtocol where Self == URLResponseSerializer {\n    /// Provides a `URLResponseSerializer` instance.\n    public static var url: URLResponseSerializer { URLResponseSerializer() }\n}\n#endif\n\nextension DownloadRequest {\n    /// Adds a handler using a `URLResponseSerializer` to be called once the request is finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is called. `.main` by default.\n    ///   - completionHandler: A closure to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseURL(queue: DispatchQueue = .main,\n                            completionHandler: @escaping (AFDownloadResponse<URL>) -> Void) -> Self {\n        response(queue: queue, responseSerializer: URLResponseSerializer(), completionHandler: completionHandler)\n    }\n}\n\n// MARK: - Data\n\n/// A `ResponseSerializer` that performs minimal response checking and returns any response `Data` as-is. By default, a\n/// request returning `nil` or no data is considered an error. However, if the request has an `HTTPMethod` or the\n/// response has an  HTTP status code valid for empty responses, then an empty `Data` value is returned.\npublic final class DataResponseSerializer: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n\n    /// Creates a `DataResponseSerializer` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    public init(dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) {\n        self.dataPreprocessor = dataPreprocessor\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Data {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            return Data()\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        return data\n    }\n}\n\n#if swift(>=5.5)\nextension ResponseSerializer where Self == DataResponseSerializer {\n    /// Provides a default `DataResponseSerializer` instance.\n    public static var data: DataResponseSerializer { DataResponseSerializer() }\n\n    /// Creates a `DataResponseSerializer` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    ///\n    /// - Returns:               The `DataResponseSerializer`.\n    public static func data(dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                            emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                            emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DataResponseSerializer {\n        DataResponseSerializer(dataPreprocessor: dataPreprocessor,\n                               emptyResponseCodes: emptyResponseCodes,\n                               emptyRequestMethods: emptyRequestMethods)\n    }\n}\n#endif\n\nextension DataRequest {\n    /// Adds a handler using a `DataResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:               The queue on which the completion handler is called. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @discardableResult\n    public func responseData(queue: DispatchQueue = .main,\n                             dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                             emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                             emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods,\n                             completionHandler: @escaping (AFDataResponse<Data>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: DataResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                            emptyResponseCodes: emptyResponseCodes,\n                                                            emptyRequestMethods: emptyRequestMethods),\n                 completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler using a `DataResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:               The queue on which the completion handler is called. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @discardableResult\n    public func responseData(queue: DispatchQueue = .main,\n                             dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                             emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                             emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods,\n                             completionHandler: @escaping (AFDownloadResponse<Data>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: DataResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                            emptyResponseCodes: emptyResponseCodes,\n                                                            emptyRequestMethods: emptyRequestMethods),\n                 completionHandler: completionHandler)\n    }\n}\n\n// MARK: - String\n\n/// A `ResponseSerializer` that decodes the response data as a `String`. By default, a request returning `nil` or no\n/// data is considered an error. However, if the request has an `HTTPMethod` or the response has an  HTTP status code\n/// valid for empty responses, then an empty `String` is returned.\npublic final class StringResponseSerializer: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    /// Optional string encoding used to validate the response.\n    public let encoding: String.Encoding?\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n\n    /// Creates an instance with the provided values.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - encoding:            A string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    public init(dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                encoding: String.Encoding? = nil,\n                emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) {\n        self.dataPreprocessor = dataPreprocessor\n        self.encoding = encoding\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> String {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            return \"\"\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        var convertedEncoding = encoding\n\n        if let encodingName = response?.textEncodingName, convertedEncoding == nil {\n            convertedEncoding = String.Encoding(ianaCharsetName: encodingName)\n        }\n\n        let actualEncoding = convertedEncoding ?? .isoLatin1\n\n        guard let string = String(data: data, encoding: actualEncoding) else {\n            throw AFError.responseSerializationFailed(reason: .stringSerializationFailed(encoding: actualEncoding))\n        }\n\n        return string\n    }\n}\n\n#if swift(>=5.5)\nextension ResponseSerializer where Self == StringResponseSerializer {\n    /// Provides a default `StringResponseSerializer` instance.\n    public static var string: StringResponseSerializer { StringResponseSerializer() }\n\n    /// Creates a `StringResponseSerializer` with the provided values.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - encoding:            A string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    ///\n    /// - Returns:               The `StringResponseSerializer`.\n    public static func string(dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                              encoding: String.Encoding? = nil,\n                              emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                              emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> StringResponseSerializer {\n        StringResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                 encoding: encoding,\n                                 emptyResponseCodes: emptyResponseCodes,\n                                 emptyRequestMethods: emptyRequestMethods)\n    }\n}\n#endif\n\nextension DataRequest {\n    /// Adds a handler using a `StringResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:               The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - encoding:            The string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @discardableResult\n    public func responseString(queue: DispatchQueue = .main,\n                               dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                               encoding: String.Encoding? = nil,\n                               emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                               emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods,\n                               completionHandler: @escaping (AFDataResponse<String>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: StringResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                              encoding: encoding,\n                                                              emptyResponseCodes: emptyResponseCodes,\n                                                              emptyRequestMethods: emptyRequestMethods),\n                 completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler using a `StringResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:               The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - encoding:            The string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @discardableResult\n    public func responseString(queue: DispatchQueue = .main,\n                               dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                               encoding: String.Encoding? = nil,\n                               emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                               emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods,\n                               completionHandler: @escaping (AFDownloadResponse<String>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: StringResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                              encoding: encoding,\n                                                              emptyResponseCodes: emptyResponseCodes,\n                                                              emptyRequestMethods: emptyRequestMethods),\n                 completionHandler: completionHandler)\n    }\n}\n\n// MARK: - JSON\n\n/// A `ResponseSerializer` that decodes the response data using `JSONSerialization`. By default, a request returning\n/// `nil` or no data is considered an error. However, if the request has an `HTTPMethod` or the response has an\n/// HTTP status code valid for empty responses, then an `NSNull` value is returned.\n@available(*, deprecated, message: \"JSONResponseSerializer deprecated and will be removed in Alamofire 6. Use DecodableResponseSerializer instead.\")\npublic final class JSONResponseSerializer: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n    /// `JSONSerialization.ReadingOptions` used when serializing a response.\n    public let options: JSONSerialization.ReadingOptions\n\n    /// Creates an instance with the provided values.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    ///   - options:             The options to use. `.allowFragments` by default.\n    public init(dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,\n                emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,\n                options: JSONSerialization.ReadingOptions = .allowFragments) {\n        self.dataPreprocessor = dataPreprocessor\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n        self.options = options\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Any {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            return NSNull()\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        do {\n            return try JSONSerialization.jsonObject(with: data, options: options)\n        } catch {\n            throw AFError.responseSerializationFailed(reason: .jsonSerializationFailed(error: error))\n        }\n    }\n}\n\nextension DataRequest {\n    /// Adds a handler using a `JSONResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:               The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - encoding:            The string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - options:             `JSONSerialization.ReadingOptions` used when parsing the response. `.allowFragments`\n    ///                          by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @available(*, deprecated, message: \"responseJSON deprecated and will be removed in Alamofire 6. Use responseDecodable instead.\")\n    @discardableResult\n    public func responseJSON(queue: DispatchQueue = .main,\n                             dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,\n                             emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,\n                             emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,\n                             options: JSONSerialization.ReadingOptions = .allowFragments,\n                             completionHandler: @escaping (AFDataResponse<Any>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: JSONResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                            emptyResponseCodes: emptyResponseCodes,\n                                                            emptyRequestMethods: emptyRequestMethods,\n                                                            options: options),\n                 completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler using a `JSONResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:               The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - encoding:            The string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - options:             `JSONSerialization.ReadingOptions` used when parsing the response. `.allowFragments`\n    ///                          by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @available(*, deprecated, message: \"responseJSON deprecated and will be removed in Alamofire 6. Use responseDecodable instead.\")\n    @discardableResult\n    public func responseJSON(queue: DispatchQueue = .main,\n                             dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,\n                             emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,\n                             emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,\n                             options: JSONSerialization.ReadingOptions = .allowFragments,\n                             completionHandler: @escaping (AFDownloadResponse<Any>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: JSONResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                            emptyResponseCodes: emptyResponseCodes,\n                                                            emptyRequestMethods: emptyRequestMethods,\n                                                            options: options),\n                 completionHandler: completionHandler)\n    }\n}\n\n// MARK: - Empty\n\n/// Protocol representing an empty response. Use `T.emptyValue()` to get an instance.\npublic protocol EmptyResponse {\n    /// Empty value for the conforming type.\n    ///\n    /// - Returns: Value of `Self` to use for empty values.\n    static func emptyValue() -> Self\n}\n\n/// Type representing an empty value. Use `Empty.value` to get the static instance.\npublic struct Empty: Codable {\n    /// Static `Empty` instance used for all `Empty` responses.\n    public static let value = Empty()\n}\n\nextension Empty: EmptyResponse {\n    public static func emptyValue() -> Empty {\n        value\n    }\n}\n\n// MARK: - DataDecoder Protocol\n\n/// Any type which can decode `Data` into a `Decodable` type.\npublic protocol DataDecoder {\n    /// Decode `Data` into the provided type.\n    ///\n    /// - Parameters:\n    ///   - type:  The `Type` to be decoded.\n    ///   - data:  The `Data` to be decoded.\n    ///\n    /// - Returns: The decoded value of type `D`.\n    /// - Throws:  Any error that occurs during decode.\n    func decode<D: Decodable>(_ type: D.Type, from data: Data) throws -> D\n}\n\n/// `JSONDecoder` automatically conforms to `DataDecoder`.\nextension JSONDecoder: DataDecoder {}\n/// `PropertyListDecoder` automatically conforms to `DataDecoder`.\nextension PropertyListDecoder: DataDecoder {}\n\n// MARK: - Decodable\n\n/// A `ResponseSerializer` that decodes the response data as a generic value using any type that conforms to\n/// `DataDecoder`. By default, this is an instance of `JSONDecoder`. Additionally, a request returning `nil` or no data\n/// is considered an error. However, if the request has an `HTTPMethod` or the response has an HTTP status code valid\n/// for empty responses then an empty value will be returned. If the decoded type conforms to `EmptyResponse`, the\n/// type's `emptyValue()` will be returned. If the decoded type is `Empty`, the `.value` instance is returned. If the\n/// decoded type *does not* conform to `EmptyResponse` and isn't `Empty`, an error will be produced.\npublic final class DecodableResponseSerializer<T: Decodable>: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    /// The `DataDecoder` instance used to decode responses.\n    public let decoder: DataDecoder\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n\n    /// Creates an instance using the values provided.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - decoder:             The `DataDecoder`. `JSONDecoder()` by default.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    public init(dataPreprocessor: DataPreprocessor = DecodableResponseSerializer.defaultDataPreprocessor,\n                decoder: DataDecoder = JSONDecoder(),\n                emptyResponseCodes: Set<Int> = DecodableResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer.defaultEmptyRequestMethods) {\n        self.dataPreprocessor = dataPreprocessor\n        self.decoder = decoder\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> T {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            guard let emptyResponseType = T.self as? EmptyResponse.Type, let emptyValue = emptyResponseType.emptyValue() as? T else {\n                throw AFError.responseSerializationFailed(reason: .invalidEmptyResponse(type: \"\\(T.self)\"))\n            }\n\n            return emptyValue\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        do {\n            return try decoder.decode(T.self, from: data)\n        } catch {\n            throw AFError.responseSerializationFailed(reason: .decodingFailed(error: error))\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension ResponseSerializer {\n    /// Creates a `DecodableResponseSerializer` using the values provided.\n    ///\n    /// - Parameters:\n    ///   - type:                `Decodable` type to decode from response data.\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - decoder:             The `DataDecoder`. `JSONDecoder()` by default.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    ///\n    /// - Returns:               The `DecodableResponseSerializer`.\n    public static func decodable<T: Decodable>(of type: T.Type,\n                                               dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,\n                                               decoder: DataDecoder = JSONDecoder(),\n                                               emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,\n                                               emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DecodableResponseSerializer<T> where Self == DecodableResponseSerializer<T> {\n        DecodableResponseSerializer<T>(dataPreprocessor: dataPreprocessor,\n                                       decoder: decoder,\n                                       emptyResponseCodes: emptyResponseCodes,\n                                       emptyRequestMethods: emptyRequestMethods)\n    }\n}\n#endif\n\nextension DataRequest {\n    /// Adds a handler using a `DecodableResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - type:                `Decodable` type to decode from response data.\n    ///   - queue:               The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - decoder:             `DataDecoder` to use to decode the response. `JSONDecoder()` by default.\n    ///   - encoding:            The string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @discardableResult\n    public func responseDecodable<T: Decodable>(of type: T.Type = T.self,\n                                                queue: DispatchQueue = .main,\n                                                dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,\n                                                decoder: DataDecoder = JSONDecoder(),\n                                                emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,\n                                                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods,\n                                                completionHandler: @escaping (AFDataResponse<T>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: DecodableResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                                 decoder: decoder,\n                                                                 emptyResponseCodes: emptyResponseCodes,\n                                                                 emptyRequestMethods: emptyRequestMethods),\n                 completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler using a `DecodableResponseSerializer` to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - type:                `Decodable` type to decode from response data.\n    ///   - queue:               The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - dataPreprocessor:    `DataPreprocessor` which processes the received `Data` before calling the\n    ///                          `completionHandler`. `PassthroughPreprocessor()` by default.\n    ///   - decoder:             `DataDecoder` to use to decode the response. `JSONDecoder()` by default.\n    ///   - encoding:            The string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  HTTP status codes for which empty responses are always valid. `[204, 205]` by default.\n    ///   - emptyRequestMethods: `HTTPMethod`s for which empty responses are always valid. `[.head]` by default.\n    ///   - completionHandler:   A closure to be executed once the request has finished.\n    ///\n    /// - Returns:               The request.\n    @discardableResult\n    public func responseDecodable<T: Decodable>(of type: T.Type = T.self,\n                                                queue: DispatchQueue = .main,\n                                                dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,\n                                                decoder: DataDecoder = JSONDecoder(),\n                                                emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,\n                                                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods,\n                                                completionHandler: @escaping (AFDownloadResponse<T>) -> Void) -> Self {\n        response(queue: queue,\n                 responseSerializer: DecodableResponseSerializer(dataPreprocessor: dataPreprocessor,\n                                                                 decoder: decoder,\n                                                                 emptyResponseCodes: emptyResponseCodes,\n                                                                 emptyRequestMethods: emptyRequestMethods),\n                 completionHandler: completionHandler)\n    }\n}\n\n// MARK: - DataStreamRequest\n\n/// A type which can serialize incoming `Data`.\npublic protocol DataStreamSerializer {\n    /// Type produced from the serialized `Data`.\n    associatedtype SerializedObject\n\n    /// Serializes incoming `Data` into a `SerializedObject` value.\n    ///\n    /// - Parameter data: `Data` to be serialized.\n    ///\n    /// - Throws: Any error produced during serialization.\n    func serialize(_ data: Data) throws -> SerializedObject\n}\n\n/// `DataStreamSerializer` which uses the provided `DataPreprocessor` and `DataDecoder` to serialize the incoming `Data`.\npublic struct DecodableStreamSerializer<T: Decodable>: DataStreamSerializer {\n    /// `DataDecoder` used to decode incoming `Data`.\n    public let decoder: DataDecoder\n    /// `DataPreprocessor` incoming `Data` is passed through before being passed to the `DataDecoder`.\n    public let dataPreprocessor: DataPreprocessor\n\n    /// Creates an instance with the provided `DataDecoder` and `DataPreprocessor`.\n    /// - Parameters:\n    ///   - decoder: `        DataDecoder` used to decode incoming `Data`. `JSONDecoder()` by default.\n    ///   - dataPreprocessor: `DataPreprocessor` used to process incoming `Data` before it's passed through the\n    ///                       `decoder`. `PassthroughPreprocessor()` by default.\n    public init(decoder: DataDecoder = JSONDecoder(), dataPreprocessor: DataPreprocessor = PassthroughPreprocessor()) {\n        self.decoder = decoder\n        self.dataPreprocessor = dataPreprocessor\n    }\n\n    public func serialize(_ data: Data) throws -> T {\n        let processedData = try dataPreprocessor.preprocess(data)\n        do {\n            return try decoder.decode(T.self, from: processedData)\n        } catch {\n            throw AFError.responseSerializationFailed(reason: .decodingFailed(error: error))\n        }\n    }\n}\n\n/// `DataStreamSerializer` which performs no serialization on incoming `Data`.\npublic struct PassthroughStreamSerializer: DataStreamSerializer {\n    /// Creates an instance.\n    public init() {}\n\n    public func serialize(_ data: Data) throws -> Data { data }\n}\n\n/// `DataStreamSerializer` which serializes incoming stream `Data` into `UTF8`-decoded `String` values.\npublic struct StringStreamSerializer: DataStreamSerializer {\n    /// Creates an instance.\n    public init() {}\n\n    public func serialize(_ data: Data) throws -> String {\n        String(decoding: data, as: UTF8.self)\n    }\n}\n\n#if swift(>=5.5)\nextension DataStreamSerializer {\n    /// Creates a `DecodableStreamSerializer` instance with the provided `DataDecoder` and `DataPreprocessor`.\n    ///\n    /// - Parameters:\n    ///   - type:             `Decodable` type to decode from stream data.\n    ///   - decoder: `        DataDecoder` used to decode incoming `Data`. `JSONDecoder()` by default.\n    ///   - dataPreprocessor: `DataPreprocessor` used to process incoming `Data` before it's passed through the\n    ///                       `decoder`. `PassthroughPreprocessor()` by default.\n    public static func decodable<T: Decodable>(of type: T.Type,\n                                               decoder: DataDecoder = JSONDecoder(),\n                                               dataPreprocessor: DataPreprocessor = PassthroughPreprocessor()) -> Self where Self == DecodableStreamSerializer<T> {\n        DecodableStreamSerializer<T>(decoder: decoder, dataPreprocessor: dataPreprocessor)\n    }\n}\n\nextension DataStreamSerializer where Self == PassthroughStreamSerializer {\n    /// Provides a `PassthroughStreamSerializer` instance.\n    public static var passthrough: PassthroughStreamSerializer { PassthroughStreamSerializer() }\n}\n\nextension DataStreamSerializer where Self == StringStreamSerializer {\n    /// Provides a `StringStreamSerializer` instance.\n    public static var string: StringStreamSerializer { StringStreamSerializer() }\n}\n#endif\n\nextension DataStreamRequest {\n    /// Adds a `StreamHandler` which performs no parsing on incoming `Data`.\n    ///\n    /// - Parameters:\n    ///   - queue:  `DispatchQueue` on which to perform `StreamHandler` closure.\n    ///   - stream: `StreamHandler` closure called as `Data` is received. May be called multiple times.\n    ///\n    /// - Returns:  The `DataStreamRequest`.\n    @discardableResult\n    public func responseStream(on queue: DispatchQueue = .main, stream: @escaping Handler<Data, Never>) -> Self {\n        let parser = { [unowned self] (data: Data) in\n            queue.async {\n                self.capturingError {\n                    try stream(.init(event: .stream(.success(data)), token: .init(self)))\n                }\n\n                self.updateAndCompleteIfPossible()\n            }\n        }\n\n        $streamMutableState.write { $0.streams.append(parser) }\n        appendStreamCompletion(on: queue, stream: stream)\n\n        return self\n    }\n\n    /// Adds a `StreamHandler` which uses the provided `DataStreamSerializer` to process incoming `Data`.\n    ///\n    /// - Parameters:\n    ///   - serializer: `DataStreamSerializer` used to process incoming `Data`. Its work is done on the `serializationQueue`.\n    ///   - queue:      `DispatchQueue` on which to perform `StreamHandler` closure.\n    ///   - stream:     `StreamHandler` closure called as `Data` is received. May be called multiple times.\n    ///\n    /// - Returns:      The `DataStreamRequest`.\n    @discardableResult\n    public func responseStream<Serializer: DataStreamSerializer>(using serializer: Serializer,\n                                                                 on queue: DispatchQueue = .main,\n                                                                 stream: @escaping Handler<Serializer.SerializedObject, AFError>) -> Self {\n        let parser = { [unowned self] (data: Data) in\n            self.serializationQueue.async {\n                // Start work on serialization queue.\n                let result = Result { try serializer.serialize(data) }\n                    .mapError { $0.asAFError(or: .responseSerializationFailed(reason: .customSerializationFailed(error: $0))) }\n                // End work on serialization queue.\n                self.underlyingQueue.async {\n                    self.eventMonitor?.request(self, didParseStream: result)\n\n                    if result.isFailure, self.automaticallyCancelOnStreamError {\n                        self.cancel()\n                    }\n\n                    queue.async {\n                        self.capturingError {\n                            try stream(.init(event: .stream(result), token: .init(self)))\n                        }\n\n                        self.updateAndCompleteIfPossible()\n                    }\n                }\n            }\n        }\n\n        $streamMutableState.write { $0.streams.append(parser) }\n        appendStreamCompletion(on: queue, stream: stream)\n\n        return self\n    }\n\n    /// Adds a `StreamHandler` which parses incoming `Data` as a UTF8 `String`.\n    ///\n    /// - Parameters:\n    ///   - queue:      `DispatchQueue` on which to perform `StreamHandler` closure.\n    ///   - stream:     `StreamHandler` closure called as `Data` is received. May be called multiple times.\n    ///\n    /// - Returns:  The `DataStreamRequest`.\n    @discardableResult\n    public func responseStreamString(on queue: DispatchQueue = .main,\n                                     stream: @escaping Handler<String, Never>) -> Self {\n        let parser = { [unowned self] (data: Data) in\n            self.serializationQueue.async {\n                // Start work on serialization queue.\n                let string = String(decoding: data, as: UTF8.self)\n                // End work on serialization queue.\n                self.underlyingQueue.async {\n                    self.eventMonitor?.request(self, didParseStream: .success(string))\n\n                    queue.async {\n                        self.capturingError {\n                            try stream(.init(event: .stream(.success(string)), token: .init(self)))\n                        }\n\n                        self.updateAndCompleteIfPossible()\n                    }\n                }\n            }\n        }\n\n        $streamMutableState.write { $0.streams.append(parser) }\n        appendStreamCompletion(on: queue, stream: stream)\n\n        return self\n    }\n\n    private func updateAndCompleteIfPossible() {\n        $streamMutableState.write { state in\n            state.numberOfExecutingStreams -= 1\n\n            guard state.numberOfExecutingStreams == 0, !state.enqueuedCompletionEvents.isEmpty else { return }\n\n            let completionEvents = state.enqueuedCompletionEvents\n            self.underlyingQueue.async { completionEvents.forEach { $0() } }\n            state.enqueuedCompletionEvents.removeAll()\n        }\n    }\n\n    /// Adds a `StreamHandler` which parses incoming `Data` using the provided `DataDecoder`.\n    ///\n    /// - Parameters:\n    ///   - type:         `Decodable` type to parse incoming `Data` into.\n    ///   - queue:        `DispatchQueue` on which to perform `StreamHandler` closure.\n    ///   - decoder:      `DataDecoder` used to decode the incoming `Data`.\n    ///   - preprocessor: `DataPreprocessor` used to process the incoming `Data` before it's passed to the `decoder`.\n    ///   - stream:       `StreamHandler` closure called as `Data` is received. May be called multiple times.\n    ///\n    /// - Returns: The `DataStreamRequest`.\n    @discardableResult\n    public func responseStreamDecodable<T: Decodable>(of type: T.Type = T.self,\n                                                      on queue: DispatchQueue = .main,\n                                                      using decoder: DataDecoder = JSONDecoder(),\n                                                      preprocessor: DataPreprocessor = PassthroughPreprocessor(),\n                                                      stream: @escaping Handler<T, AFError>) -> Self {\n        responseStream(using: DecodableStreamSerializer<T>(decoder: decoder, dataPreprocessor: preprocessor),\n                       stream: stream)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Result+Alamofire.swift",
    "content": "//\n//  Result+Alamofire.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Default type of `Result` returned by Alamofire, with an `AFError` `Failure` type.\npublic typealias AFResult<Success> = Result<Success, AFError>\n\n// MARK: - Internal APIs\n\nextension Result {\n    /// Returns whether the instance is `.success`.\n    var isSuccess: Bool {\n        guard case .success = self else { return false }\n        return true\n    }\n\n    /// Returns whether the instance is `.failure`.\n    var isFailure: Bool {\n        !isSuccess\n    }\n\n    /// Returns the associated value if the result is a success, `nil` otherwise.\n    var success: Success? {\n        guard case let .success(value) = self else { return nil }\n        return value\n    }\n\n    /// Returns the associated error value if the result is a failure, `nil` otherwise.\n    var failure: Failure? {\n        guard case let .failure(error) = self else { return nil }\n        return error\n    }\n\n    /// Initializes a `Result` from value or error. Returns `.failure` if the error is non-nil, `.success` otherwise.\n    ///\n    /// - Parameters:\n    ///   - value: A value.\n    ///   - error: An `Error`.\n    init(value: Success, error: Failure?) {\n        if let error = error {\n            self = .failure(error)\n        } else {\n            self = .success(value)\n        }\n    }\n\n    /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter.\n    ///\n    /// Use the `tryMap` method with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: Result<Data, Error> = .success(Data(...))\n    ///     let possibleObject = possibleData.tryMap {\n    ///         try JSONSerialization.jsonObject(with: $0)\n    ///     }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance.\n    ///\n    /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the\n    ///            same failure.\n    func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> Result<NewSuccess, Error> {\n        switch self {\n        case let .success(value):\n            do {\n                return try .success(transform(value))\n            } catch {\n                return .failure(error)\n            }\n        case let .failure(error):\n            return .failure(error)\n        }\n    }\n\n    /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `tryMapError` function with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: Result<Data, Error> = .success(Data(...))\n    ///     let possibleObject = possibleData.tryMapError {\n    ///         try someFailableFunction(taking: $0)\n    ///     }\n    ///\n    /// - Parameter transform: A throwing closure that takes the error of the instance.\n    ///\n    /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns\n    ///            the same success.\n    func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> Result<Success, Error> {\n        switch self {\n        case let .failure(error):\n            do {\n                return try .failure(transform(error))\n            } catch {\n                return .failure(error)\n            }\n        case let .success(value):\n            return .success(value)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/RetryPolicy.swift",
    "content": "//\n//  RetryPolicy.swift\n//\n//  Copyright (c) 2019-2020 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes\n/// as well as certain types of networking errors.\nopen class RetryPolicy: RequestInterceptor {\n    /// The default retry limit for retry policies.\n    public static let defaultRetryLimit: UInt = 2\n\n    /// The default exponential backoff base for retry policies (must be a minimum of 2).\n    public static let defaultExponentialBackoffBase: UInt = 2\n\n    /// The default exponential backoff scale for retry policies.\n    public static let defaultExponentialBackoffScale: Double = 0.5\n\n    /// The default HTTP methods to retry.\n    /// See [RFC 2616 - Section 9.1.2](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) for more information.\n    public static let defaultRetryableHTTPMethods: Set<HTTPMethod> = [.delete, // [Delete](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7) - not always idempotent\n                                                                      .get, // [GET](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3) - generally idempotent\n                                                                      .head, // [HEAD](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4) - generally idempotent\n                                                                      .options, // [OPTIONS](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2) - inherently idempotent\n                                                                      .put, // [PUT](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6) - not always idempotent\n                                                                      .trace // [TRACE](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8) - inherently idempotent\n    ]\n\n    /// The default HTTP status codes to retry.\n    /// See [RFC 2616 - Section 10](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10) for more information.\n    public static let defaultRetryableHTTPStatusCodes: Set<Int> = [408, // [Request Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.9)\n                                                                   500, // [Internal Server Error](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1)\n                                                                   502, // [Bad Gateway](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.3)\n                                                                   503, // [Service Unavailable](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4)\n                                                                   504 // [Gateway Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.5)\n    ]\n\n    /// The default URL error codes to retry.\n    public static let defaultRetryableURLErrorCodes: Set<URLError.Code> = [// [Security] App Transport Security disallowed a connection because there is no secure network connection.\n        //   - [Disabled] ATS settings do not change at runtime.\n        // .appTransportSecurityRequiresSecureConnection,\n\n        // [System] An app or app extension attempted to connect to a background session that is already connected to a\n        // process.\n        //   - [Enabled] The other process could release the background session.\n        .backgroundSessionInUseByAnotherProcess,\n\n        // [System] The shared container identifier of the URL session configuration is needed but has not been set.\n        //   - [Disabled] Cannot change at runtime.\n        // .backgroundSessionRequiresSharedContainer,\n\n        // [System] The app is suspended or exits while a background data task is processing.\n        //   - [Enabled] App can be foregrounded or launched to recover.\n        .backgroundSessionWasDisconnected,\n\n        // [Network] The URL Loading system received bad data from the server.\n        //   - [Enabled] Server could return valid data when retrying.\n        .badServerResponse,\n\n        // [Resource] A malformed URL prevented a URL request from being initiated.\n        //   - [Disabled] URL was most likely constructed incorrectly.\n        // .badURL,\n\n        // [System] A connection was attempted while a phone call is active on a network that does not support\n        // simultaneous phone and data communication (EDGE or GPRS).\n        //   - [Enabled] Phone call could be ended to allow request to recover.\n        .callIsActive,\n\n        // [Client] An asynchronous load has been canceled.\n        //   - [Disabled] Request was cancelled by the client.\n        // .cancelled,\n\n        // [File System] A download task couldn’t close the downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotCloseFile,\n\n        // [Network] An attempt to connect to a host failed.\n        //   - [Enabled] Server or DNS lookup could recover during retry.\n        .cannotConnectToHost,\n\n        // [File System] A download task couldn’t create the downloaded file on disk because of an I/O failure.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotCreateFile,\n\n        // [Data] Content data received during a connection request had an unknown content encoding.\n        //   - [Disabled] Server is unlikely to modify the content encoding during a retry.\n        // .cannotDecodeContentData,\n\n        // [Data] Content data received during a connection request could not be decoded for a known content encoding.\n        //   - [Disabled] Server is unlikely to modify the content encoding during a retry.\n        // .cannotDecodeRawData,\n\n        // [Network] The host name for a URL could not be resolved.\n        //   - [Enabled] Server or DNS lookup could recover during retry.\n        .cannotFindHost,\n\n        // [Network] A request to load an item only from the cache could not be satisfied.\n        //   - [Enabled] Cache could be populated during a retry.\n        .cannotLoadFromNetwork,\n\n        // [File System] A download task was unable to move a downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotMoveFile,\n\n        // [File System] A download task was unable to open the downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotOpenFile,\n\n        // [Data] A task could not parse a response.\n        //   - [Disabled] Invalid response is unlikely to recover with retry.\n        // .cannotParseResponse,\n\n        // [File System] A download task was unable to remove a downloaded file from disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotRemoveFile,\n\n        // [File System] A download task was unable to write to the downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotWriteToFile,\n\n        // [Security] A client certificate was rejected.\n        //   - [Disabled] Client certificate is unlikely to change with retry.\n        // .clientCertificateRejected,\n\n        // [Security] A client certificate was required to authenticate an SSL connection during a request.\n        //   - [Disabled] Client certificate is unlikely to be provided with retry.\n        // .clientCertificateRequired,\n\n        // [Data] The length of the resource data exceeds the maximum allowed.\n        //   - [Disabled] Resource will likely still exceed the length maximum on retry.\n        // .dataLengthExceedsMaximum,\n\n        // [System] The cellular network disallowed a connection.\n        //   - [Enabled] WiFi connection could be established during retry.\n        .dataNotAllowed,\n\n        // [Network] The host address could not be found via DNS lookup.\n        //   - [Enabled] DNS lookup could succeed during retry.\n        .dnsLookupFailed,\n\n        // [Data] A download task failed to decode an encoded file during the download.\n        //   - [Enabled] Server could correct the decoding issue with retry.\n        .downloadDecodingFailedMidStream,\n\n        // [Data] A download task failed to decode an encoded file after downloading.\n        //   - [Enabled] Server could correct the decoding issue with retry.\n        .downloadDecodingFailedToComplete,\n\n        // [File System] A file does not exist.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .fileDoesNotExist,\n\n        // [File System] A request for an FTP file resulted in the server responding that the file is not a plain file,\n        // but a directory.\n        //   - [Disabled] FTP directory is not likely to change to a file during a retry.\n        // .fileIsDirectory,\n\n        // [Network] A redirect loop has been detected or the threshold for number of allowable redirects has been\n        // exceeded (currently 16).\n        //   - [Disabled] The redirect loop is unlikely to be resolved within the retry window.\n        // .httpTooManyRedirects,\n\n        // [System] The attempted connection required activating a data context while roaming, but international roaming\n        // is disabled.\n        //   - [Enabled] WiFi connection could be established during retry.\n        .internationalRoamingOff,\n\n        // [Connectivity] A client or server connection was severed in the middle of an in-progress load.\n        //   - [Enabled] A network connection could be established during retry.\n        .networkConnectionLost,\n\n        // [File System] A resource couldn’t be read because of insufficient permissions.\n        //   - [Disabled] Permissions are unlikely to be granted during retry.\n        // .noPermissionsToReadFile,\n\n        // [Connectivity] A network resource was requested, but an internet connection has not been established and\n        // cannot be established automatically.\n        //   - [Enabled] A network connection could be established during retry.\n        .notConnectedToInternet,\n\n        // [Resource] A redirect was specified by way of server response code, but the server did not accompany this\n        // code with a redirect URL.\n        //   - [Disabled] The redirect URL is unlikely to be supplied during a retry.\n        // .redirectToNonExistentLocation,\n\n        // [Client] A body stream is needed but the client did not provide one.\n        //   - [Disabled] The client will be unlikely to supply a body stream during retry.\n        // .requestBodyStreamExhausted,\n\n        // [Resource] A requested resource couldn’t be retrieved.\n        //   - [Disabled] The resource is unlikely to become available during the retry window.\n        // .resourceUnavailable,\n\n        // [Security] An attempt to establish a secure connection failed for reasons that can’t be expressed more\n        // specifically.\n        //   - [Enabled] The secure connection could be established during a retry given the lack of specificity\n        //     provided by the error.\n        .secureConnectionFailed,\n\n        // [Security] A server certificate had a date which indicates it has expired, or is not yet valid.\n        //   - [Enabled] The server certificate could become valid within the retry window.\n        .serverCertificateHasBadDate,\n\n        // [Security] A server certificate was not signed by any root server.\n        //   - [Disabled] The server certificate is unlikely to change during the retry window.\n        // .serverCertificateHasUnknownRoot,\n\n        // [Security] A server certificate is not yet valid.\n        //   - [Enabled] The server certificate could become valid within the retry window.\n        .serverCertificateNotYetValid,\n\n        // [Security] A server certificate was signed by a root server that isn’t trusted.\n        //   - [Disabled] The server certificate is unlikely to become trusted within the retry window.\n        // .serverCertificateUntrusted,\n\n        // [Network] An asynchronous operation timed out.\n        //   - [Enabled] The request timed out for an unknown reason and should be retried.\n        .timedOut\n\n        // [System] The URL Loading System encountered an error that it can’t interpret.\n        //   - [Disabled] The error could not be interpreted and is unlikely to be recovered from during a retry.\n        // .unknown,\n\n        // [Resource] A properly formed URL couldn’t be handled by the framework.\n        //   - [Disabled] The URL is unlikely to change during a retry.\n        // .unsupportedURL,\n\n        // [Client] Authentication is required to access a resource.\n        //   - [Disabled] The user authentication is unlikely to be provided by retrying.\n        // .userAuthenticationRequired,\n\n        // [Client] An asynchronous request for authentication has been canceled by the user.\n        //   - [Disabled] The user cancelled authentication and explicitly took action to not retry.\n        // .userCancelledAuthentication,\n\n        // [Resource] A server reported that a URL has a non-zero content length, but terminated the network connection\n        // gracefully without sending any data.\n        //   - [Disabled] The server is unlikely to provide data during the retry window.\n        // .zeroByteResource,\n    ]\n\n    /// The total number of times the request is allowed to be retried.\n    public let retryLimit: UInt\n\n    /// The base of the exponential backoff policy (should always be greater than or equal to 2).\n    public let exponentialBackoffBase: UInt\n\n    /// The scale of the exponential backoff.\n    public let exponentialBackoffScale: Double\n\n    /// The HTTP methods that are allowed to be retried.\n    public let retryableHTTPMethods: Set<HTTPMethod>\n\n    /// The HTTP status codes that are automatically retried by the policy.\n    public let retryableHTTPStatusCodes: Set<Int>\n\n    /// The URL error codes that are automatically retried by the policy.\n    public let retryableURLErrorCodes: Set<URLError.Code>\n\n    /// Creates a `RetryPolicy` from the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - retryLimit:               The total number of times the request is allowed to be retried. `2` by default.\n    ///   - exponentialBackoffBase:   The base of the exponential backoff policy. `2` by default.\n    ///   - exponentialBackoffScale:  The scale of the exponential backoff. `0.5` by default.\n    ///   - retryableHTTPMethods:     The HTTP methods that are allowed to be retried.\n    ///                               `RetryPolicy.defaultRetryableHTTPMethods` by default.\n    ///   - retryableHTTPStatusCodes: The HTTP status codes that are automatically retried by the policy.\n    ///                               `RetryPolicy.defaultRetryableHTTPStatusCodes` by default.\n    ///   - retryableURLErrorCodes:   The URL error codes that are automatically retried by the policy.\n    ///                               `RetryPolicy.defaultRetryableURLErrorCodes` by default.\n    public init(retryLimit: UInt = RetryPolicy.defaultRetryLimit,\n                exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,\n                exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,\n                retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods,\n                retryableHTTPStatusCodes: Set<Int> = RetryPolicy.defaultRetryableHTTPStatusCodes,\n                retryableURLErrorCodes: Set<URLError.Code> = RetryPolicy.defaultRetryableURLErrorCodes) {\n        precondition(exponentialBackoffBase >= 2, \"The `exponentialBackoffBase` must be a minimum of 2.\")\n\n        self.retryLimit = retryLimit\n        self.exponentialBackoffBase = exponentialBackoffBase\n        self.exponentialBackoffScale = exponentialBackoffScale\n        self.retryableHTTPMethods = retryableHTTPMethods\n        self.retryableHTTPStatusCodes = retryableHTTPStatusCodes\n        self.retryableURLErrorCodes = retryableURLErrorCodes\n    }\n\n    open func retry(_ request: Request,\n                    for session: Session,\n                    dueTo error: Error,\n                    completion: @escaping (RetryResult) -> Void) {\n        if request.retryCount < retryLimit, shouldRetry(request: request, dueTo: error) {\n            completion(.retryWithDelay(pow(Double(exponentialBackoffBase), Double(request.retryCount)) * exponentialBackoffScale))\n        } else {\n            completion(.doNotRetry)\n        }\n    }\n\n    /// Determines whether or not to retry the provided `Request`.\n    ///\n    /// - Parameters:\n    ///     - request: `Request` that failed due to the provided `Error`.\n    ///     - error:   `Error` encountered while executing the `Request`.\n    ///\n    /// - Returns:     `Bool` determining whether or not to retry the `Request`.\n    open func shouldRetry(request: Request, dueTo error: Error) -> Bool {\n        guard let httpMethod = request.request?.method, retryableHTTPMethods.contains(httpMethod) else { return false }\n\n        if let statusCode = request.response?.statusCode, retryableHTTPStatusCodes.contains(statusCode) {\n            return true\n        } else {\n            let errorCode = (error as? URLError)?.code\n            let afErrorCode = (error.asAFError?.underlyingError as? URLError)?.code\n\n            guard let code = errorCode ?? afErrorCode else { return false }\n\n            return retryableURLErrorCodes.contains(code)\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension RequestInterceptor where Self == RetryPolicy {\n    /// Provides a default `RetryPolicy` instance.\n    public static var retryPolicy: RetryPolicy { RetryPolicy() }\n\n    /// Creates an `RetryPolicy` from the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - retryLimit:               The total number of times the request is allowed to be retried. `2` by default.\n    ///   - exponentialBackoffBase:   The base of the exponential backoff policy. `2` by default.\n    ///   - exponentialBackoffScale:  The scale of the exponential backoff. `0.5` by default.\n    ///   - retryableHTTPMethods:     The HTTP methods that are allowed to be retried.\n    ///                               `RetryPolicy.defaultRetryableHTTPMethods` by default.\n    ///   - retryableHTTPStatusCodes: The HTTP status codes that are automatically retried by the policy.\n    ///                               `RetryPolicy.defaultRetryableHTTPStatusCodes` by default.\n    ///   - retryableURLErrorCodes:   The URL error codes that are automatically retried by the policy.\n    ///                               `RetryPolicy.defaultRetryableURLErrorCodes` by default.\n    ///\n    /// - Returns:                    The `RetryPolicy`\n    public static func retryPolicy(retryLimit: UInt = RetryPolicy.defaultRetryLimit,\n                                   exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,\n                                   exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,\n                                   retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods,\n                                   retryableHTTPStatusCodes: Set<Int> = RetryPolicy.defaultRetryableHTTPStatusCodes,\n                                   retryableURLErrorCodes: Set<URLError.Code> = RetryPolicy.defaultRetryableURLErrorCodes) -> RetryPolicy {\n        RetryPolicy(retryLimit: retryLimit,\n                    exponentialBackoffBase: exponentialBackoffBase,\n                    exponentialBackoffScale: exponentialBackoffScale,\n                    retryableHTTPMethods: retryableHTTPMethods,\n                    retryableHTTPStatusCodes: retryableHTTPStatusCodes,\n                    retryableURLErrorCodes: retryableURLErrorCodes)\n    }\n}\n#endif\n\n// MARK: -\n\n/// A retry policy that automatically retries idempotent requests for network connection lost errors. For more\n/// information about retrying network connection lost errors, please refer to Apple's\n/// [technical document](https://developer.apple.com/library/content/qa/qa1941/_index.html).\nopen class ConnectionLostRetryPolicy: RetryPolicy {\n    /// Creates a `ConnectionLostRetryPolicy` instance from the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - retryLimit:              The total number of times the request is allowed to be retried.\n    ///                              `RetryPolicy.defaultRetryLimit` by default.\n    ///   - exponentialBackoffBase:  The base of the exponential backoff policy.\n    ///                              `RetryPolicy.defaultExponentialBackoffBase` by default.\n    ///   - exponentialBackoffScale: The scale of the exponential backoff.\n    ///                              `RetryPolicy.defaultExponentialBackoffScale` by default.\n    ///   - retryableHTTPMethods:    The idempotent http methods to retry.\n    ///                              `RetryPolicy.defaultRetryableHTTPMethods` by default.\n    public init(retryLimit: UInt = RetryPolicy.defaultRetryLimit,\n                exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,\n                exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,\n                retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods) {\n        super.init(retryLimit: retryLimit,\n                   exponentialBackoffBase: exponentialBackoffBase,\n                   exponentialBackoffScale: exponentialBackoffScale,\n                   retryableHTTPMethods: retryableHTTPMethods,\n                   retryableHTTPStatusCodes: [],\n                   retryableURLErrorCodes: [.networkConnectionLost])\n    }\n}\n\n#if swift(>=5.5)\nextension RequestInterceptor where Self == ConnectionLostRetryPolicy {\n    /// Provides a default `ConnectionLostRetryPolicy` instance.\n    public static var connectionLostRetryPolicy: ConnectionLostRetryPolicy { ConnectionLostRetryPolicy() }\n\n    /// Creates a `ConnectionLostRetryPolicy` instance from the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - retryLimit:              The total number of times the request is allowed to be retried.\n    ///                              `RetryPolicy.defaultRetryLimit` by default.\n    ///   - exponentialBackoffBase:  The base of the exponential backoff policy.\n    ///                              `RetryPolicy.defaultExponentialBackoffBase` by default.\n    ///   - exponentialBackoffScale: The scale of the exponential backoff.\n    ///                              `RetryPolicy.defaultExponentialBackoffScale` by default.\n    ///   - retryableHTTPMethods:    The idempotent http methods to retry.\n    ///\n    /// - Returns:                   The `ConnectionLostRetryPolicy`.\n    public static func connectionLostRetryPolicy(retryLimit: UInt = RetryPolicy.defaultRetryLimit,\n                                                 exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,\n                                                 exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,\n                                                 retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods) -> ConnectionLostRetryPolicy {\n        ConnectionLostRetryPolicy(retryLimit: retryLimit,\n                                  exponentialBackoffBase: exponentialBackoffBase,\n                                  exponentialBackoffScale: exponentialBackoffScale,\n                                  retryableHTTPMethods: retryableHTTPMethods)\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/ServerTrustEvaluation.swift",
    "content": "//\n//  ServerTrustPolicy.swift\n//\n//  Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Responsible for managing the mapping of `ServerTrustEvaluating` values to given hosts.\nopen class ServerTrustManager {\n    /// Determines whether all hosts for this `ServerTrustManager` must be evaluated. `true` by default.\n    public let allHostsMustBeEvaluated: Bool\n\n    /// The dictionary of policies mapped to a particular host.\n    public let evaluators: [String: ServerTrustEvaluating]\n\n    /// Initializes the `ServerTrustManager` instance with the given evaluators.\n    ///\n    /// Since different servers and web services can have different leaf certificates, intermediate and even root\n    /// certificates, it is important to have the flexibility to specify evaluation policies on a per host basis. This\n    /// allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key\n    /// pinning for host3 and disabling evaluation for host4.\n    ///\n    /// - Parameters:\n    ///   - allHostsMustBeEvaluated: The value determining whether all hosts for this instance must be evaluated. `true`\n    ///                              by default.\n    ///   - evaluators:              A dictionary of evaluators mapped to hosts.\n    public init(allHostsMustBeEvaluated: Bool = true, evaluators: [String: ServerTrustEvaluating]) {\n        self.allHostsMustBeEvaluated = allHostsMustBeEvaluated\n        self.evaluators = evaluators\n    }\n\n    #if !(os(Linux) || os(Windows))\n    /// Returns the `ServerTrustEvaluating` value for the given host, if one is set.\n    ///\n    /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override\n    /// this method and implement more complex mapping implementations such as wildcards.\n    ///\n    /// - Parameter host: The host to use when searching for a matching policy.\n    ///\n    /// - Returns:        The `ServerTrustEvaluating` value for the given host if found, `nil` otherwise.\n    /// - Throws:         `AFError.serverTrustEvaluationFailed` if `allHostsMustBeEvaluated` is `true` and no matching\n    ///                   evaluators are found.\n    open func serverTrustEvaluator(forHost host: String) throws -> ServerTrustEvaluating? {\n        guard let evaluator = evaluators[host] else {\n            if allHostsMustBeEvaluated {\n                throw AFError.serverTrustEvaluationFailed(reason: .noRequiredEvaluator(host: host))\n            }\n\n            return nil\n        }\n\n        return evaluator\n    }\n    #endif\n}\n\n/// A protocol describing the API used to evaluate server trusts.\npublic protocol ServerTrustEvaluating {\n    #if os(Linux) || os(Windows)\n    // Implement this once Linux/Windows has API for evaluating server trusts.\n    #else\n    /// Evaluates the given `SecTrust` value for the given `host`.\n    ///\n    /// - Parameters:\n    ///   - trust: The `SecTrust` value to evaluate.\n    ///   - host:  The host for which to evaluate the `SecTrust` value.\n    ///\n    /// - Returns: A `Bool` indicating whether the evaluator considers the `SecTrust` value valid for `host`.\n    func evaluate(_ trust: SecTrust, forHost host: String) throws\n    #endif\n}\n\n// MARK: - Server Trust Evaluators\n\n#if !(os(Linux) || os(Windows))\n/// An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the\n/// host provided by the challenge. Applications are encouraged to always validate the host in production environments\n/// to guarantee the validity of the server's certificate chain.\npublic final class DefaultTrustEvaluator: ServerTrustEvaluating {\n    private let validateHost: Bool\n\n    /// Creates a `DefaultTrustEvaluator`.\n    ///\n    /// - Parameter validateHost: Determines whether or not the evaluator should validate the host. `true` by default.\n    public init(validateHost: Bool = true) {\n        self.validateHost = validateHost\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        try trust.af.performDefaultValidation(forHost: host)\n    }\n}\n\n/// An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate\n/// the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates.\n/// Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS\n/// 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production\n/// environments to guarantee the validity of the server's certificate chain.\npublic final class RevocationTrustEvaluator: ServerTrustEvaluating {\n    /// Represents the options to be use when evaluating the status of a certificate.\n    /// Only Revocation Policy Constants are valid, and can be found in [Apple's documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants).\n    public struct Options: OptionSet {\n        /// Perform revocation checking using the CRL (Certification Revocation List) method.\n        public static let crl = Options(rawValue: kSecRevocationCRLMethod)\n        /// Consult only locally cached replies; do not use network access.\n        public static let networkAccessDisabled = Options(rawValue: kSecRevocationNetworkAccessDisabled)\n        /// Perform revocation checking using OCSP (Online Certificate Status Protocol).\n        public static let ocsp = Options(rawValue: kSecRevocationOCSPMethod)\n        /// Prefer CRL revocation checking over OCSP; by default, OCSP is preferred.\n        public static let preferCRL = Options(rawValue: kSecRevocationPreferCRL)\n        /// Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a\n        /// \"best attempt\" basis, where failure to reach the server is not considered fatal.\n        public static let requirePositiveResponse = Options(rawValue: kSecRevocationRequirePositiveResponse)\n        /// Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the\n        /// certificate and the value of `preferCRL`.\n        public static let any = Options(rawValue: kSecRevocationUseAnyAvailableMethod)\n\n        /// The raw value of the option.\n        public let rawValue: CFOptionFlags\n\n        /// Creates an `Options` value with the given `CFOptionFlags`.\n        ///\n        /// - Parameter rawValue: The `CFOptionFlags` value to initialize with.\n        public init(rawValue: CFOptionFlags) {\n            self.rawValue = rawValue\n        }\n    }\n\n    private let performDefaultValidation: Bool\n    private let validateHost: Bool\n    private let options: Options\n\n    /// Creates a `RevocationTrustEvaluator` using the provided parameters.\n    ///\n    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use\n    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.\n    ///\n    /// - Parameters:\n    ///   - performDefaultValidation: Determines whether default validation should be performed in addition to\n    ///                               evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:             Determines whether or not the evaluator should validate the host, in addition to\n    ///                               performing the default evaluation, even if `performDefaultValidation` is `false`.\n    ///                               `true` by default.\n    ///   - options:                  The `Options` to use to check the revocation status of the certificate. `.any` by\n    ///                               default.\n    public init(performDefaultValidation: Bool = true, validateHost: Bool = true, options: Options = .any) {\n        self.performDefaultValidation = performDefaultValidation\n        self.validateHost = validateHost\n        self.options = options\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        if performDefaultValidation {\n            try trust.af.performDefaultValidation(forHost: host)\n        }\n\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {\n            try trust.af.evaluate(afterApplying: SecPolicy.af.revocation(options: options))\n        } else {\n            try trust.af.validate(policy: SecPolicy.af.revocation(options: options)) { status, result in\n                AFError.serverTrustEvaluationFailed(reason: .revocationCheckFailed(output: .init(host, trust, status, result), options: options))\n            }\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension ServerTrustEvaluating where Self == RevocationTrustEvaluator {\n    /// Provides a default `RevocationTrustEvaluator` instance.\n    public static var revocationChecking: RevocationTrustEvaluator { RevocationTrustEvaluator() }\n\n    /// Creates a `RevocationTrustEvaluator` using the provided parameters.\n    ///\n    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use\n    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.\n    ///\n    /// - Parameters:\n    ///   - performDefaultValidation: Determines whether default validation should be performed in addition to\n    ///                               evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:             Determines whether or not the evaluator should validate the host, in addition\n    ///                               to performing the default evaluation, even if `performDefaultValidation` is\n    ///                               `false`. `true` by default.\n    ///   - options:                  The `Options` to use to check the revocation status of the certificate. `.any`\n    ///                               by default.\n    /// - Returns:                    The `RevocationTrustEvaluator`.\n    public static func revocationChecking(performDefaultValidation: Bool = true,\n                                          validateHost: Bool = true,\n                                          options: RevocationTrustEvaluator.Options = .any) -> RevocationTrustEvaluator {\n        RevocationTrustEvaluator(performDefaultValidation: performDefaultValidation,\n                                 validateHost: validateHost,\n                                 options: options)\n    }\n}\n#endif\n\n/// Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned\n/// certificates match one of the server certificates. By validating both the certificate chain and host, certificate\n/// pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.\n/// Applications are encouraged to always validate the host and require a valid certificate chain in production\n/// environments.\npublic final class PinnedCertificatesTrustEvaluator: ServerTrustEvaluating {\n    private let certificates: [SecCertificate]\n    private let acceptSelfSignedCertificates: Bool\n    private let performDefaultValidation: Bool\n    private let validateHost: Bool\n\n    /// Creates a `PinnedCertificatesTrustEvaluator` from the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - certificates:                 The certificates to use to evaluate the trust. All `cer`, `crt`, and `der`\n    ///                                   certificates in `Bundle.main` by default.\n    ///   - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaluation, allowing\n    ///                                   self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE\n    ///                                   FALSE IN PRODUCTION!\n    ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to\n    ///                                   evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition\n    ///                                   to performing the default evaluation, even if `performDefaultValidation` is\n    ///                                   `false`. `true` by default.\n    public init(certificates: [SecCertificate] = Bundle.main.af.certificates,\n                acceptSelfSignedCertificates: Bool = false,\n                performDefaultValidation: Bool = true,\n                validateHost: Bool = true) {\n        self.certificates = certificates\n        self.acceptSelfSignedCertificates = acceptSelfSignedCertificates\n        self.performDefaultValidation = performDefaultValidation\n        self.validateHost = validateHost\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        guard !certificates.isEmpty else {\n            throw AFError.serverTrustEvaluationFailed(reason: .noCertificatesFound)\n        }\n\n        if acceptSelfSignedCertificates {\n            try trust.af.setAnchorCertificates(certificates)\n        }\n\n        if performDefaultValidation {\n            try trust.af.performDefaultValidation(forHost: host)\n        }\n\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        let serverCertificatesData = Set(trust.af.certificateData)\n        let pinnedCertificatesData = Set(certificates.af.data)\n        let pinnedCertificatesInServerData = !serverCertificatesData.isDisjoint(with: pinnedCertificatesData)\n        if !pinnedCertificatesInServerData {\n            throw AFError.serverTrustEvaluationFailed(reason: .certificatePinningFailed(host: host,\n                                                                                        trust: trust,\n                                                                                        pinnedCertificates: certificates,\n                                                                                        serverCertificates: trust.af.certificates))\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension ServerTrustEvaluating where Self == PinnedCertificatesTrustEvaluator {\n    /// Provides a default `PinnedCertificatesTrustEvaluator` instance.\n    public static var pinnedCertificates: PinnedCertificatesTrustEvaluator { PinnedCertificatesTrustEvaluator() }\n\n    /// Creates a `PinnedCertificatesTrustEvaluator` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - certificates:                 The certificates to use to evaluate the trust. All `cer`, `crt`, and `der`\n    ///                                   certificates in `Bundle.main` by default.\n    ///   - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaluation, allowing\n    ///                                   self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE\n    ///                                   FALSE IN PRODUCTION!\n    ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to\n    ///                                   evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition\n    ///                                   to performing the default evaluation, even if `performDefaultValidation` is\n    ///                                   `false`. `true` by default.\n    public static func pinnedCertificates(certificates: [SecCertificate] = Bundle.main.af.certificates,\n                                          acceptSelfSignedCertificates: Bool = false,\n                                          performDefaultValidation: Bool = true,\n                                          validateHost: Bool = true) -> PinnedCertificatesTrustEvaluator {\n        PinnedCertificatesTrustEvaluator(certificates: certificates,\n                                         acceptSelfSignedCertificates: acceptSelfSignedCertificates,\n                                         performDefaultValidation: performDefaultValidation,\n                                         validateHost: validateHost)\n    }\n}\n#endif\n\n/// Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned\n/// public keys match one of the server certificate public keys. By validating both the certificate chain and host,\n/// public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.\n/// Applications are encouraged to always validate the host and require a valid certificate chain in production\n/// environments.\npublic final class PublicKeysTrustEvaluator: ServerTrustEvaluating {\n    private let keys: [SecKey]\n    private let performDefaultValidation: Bool\n    private let validateHost: Bool\n\n    /// Creates a `PublicKeysTrustEvaluator` from the provided parameters.\n    ///\n    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use\n    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.\n    ///\n    /// - Parameters:\n    ///   - keys:                     The `SecKey`s to use to validate public keys. Defaults to the public keys of all\n    ///                               certificates included in the main bundle.\n    ///   - performDefaultValidation: Determines whether default validation should be performed in addition to\n    ///                               evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:             Determines whether or not the evaluator should validate the host, in addition to\n    ///                               performing the default evaluation, even if `performDefaultValidation` is `false`.\n    ///                               `true` by default.\n    public init(keys: [SecKey] = Bundle.main.af.publicKeys,\n                performDefaultValidation: Bool = true,\n                validateHost: Bool = true) {\n        self.keys = keys\n        self.performDefaultValidation = performDefaultValidation\n        self.validateHost = validateHost\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        guard !keys.isEmpty else {\n            throw AFError.serverTrustEvaluationFailed(reason: .noPublicKeysFound)\n        }\n\n        if performDefaultValidation {\n            try trust.af.performDefaultValidation(forHost: host)\n        }\n\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        let pinnedKeysInServerKeys: Bool = {\n            for serverPublicKey in trust.af.publicKeys {\n                for pinnedPublicKey in keys {\n                    if serverPublicKey == pinnedPublicKey {\n                        return true\n                    }\n                }\n            }\n            return false\n        }()\n\n        if !pinnedKeysInServerKeys {\n            throw AFError.serverTrustEvaluationFailed(reason: .publicKeyPinningFailed(host: host,\n                                                                                      trust: trust,\n                                                                                      pinnedKeys: keys,\n                                                                                      serverKeys: trust.af.publicKeys))\n        }\n    }\n}\n\n#if swift(>=5.5)\nextension ServerTrustEvaluating where Self == PublicKeysTrustEvaluator {\n    /// Provides a default `PublicKeysTrustEvaluator` instance.\n    public static var publicKeys: PublicKeysTrustEvaluator { PublicKeysTrustEvaluator() }\n\n    /// Creates a `PublicKeysTrustEvaluator` from the provided parameters.\n    ///\n    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use\n    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.\n    ///\n    /// - Parameters:\n    ///   - keys:                     The `SecKey`s to use to validate public keys. Defaults to the public keys of all\n    ///                               certificates included in the main bundle.\n    ///   - performDefaultValidation: Determines whether default validation should be performed in addition to\n    ///                               evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:             Determines whether or not the evaluator should validate the host, in addition to\n    ///                               performing the default evaluation, even if `performDefaultValidation` is `false`.\n    ///                               `true` by default.\n    public static func publicKeys(keys: [SecKey] = Bundle.main.af.publicKeys,\n                                  performDefaultValidation: Bool = true,\n                                  validateHost: Bool = true) -> PublicKeysTrustEvaluator {\n        PublicKeysTrustEvaluator(keys: keys, performDefaultValidation: performDefaultValidation, validateHost: validateHost)\n    }\n}\n#endif\n\n/// Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the\n/// evaluators consider it valid.\npublic final class CompositeTrustEvaluator: ServerTrustEvaluating {\n    private let evaluators: [ServerTrustEvaluating]\n\n    /// Creates a `CompositeTrustEvaluator` from the provided evaluators.\n    ///\n    /// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust.\n    public init(evaluators: [ServerTrustEvaluating]) {\n        self.evaluators = evaluators\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        try evaluators.evaluate(trust, forHost: host)\n    }\n}\n\n#if swift(>=5.5)\nextension ServerTrustEvaluating where Self == CompositeTrustEvaluator {\n    /// Creates a `CompositeTrustEvaluator` from the provided evaluators.\n    ///\n    /// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust.\n    public static func composite(evaluators: [ServerTrustEvaluating]) -> CompositeTrustEvaluator {\n        CompositeTrustEvaluator(evaluators: evaluators)\n    }\n}\n#endif\n\n/// Disables all evaluation which in turn will always consider any server trust as valid.\n///\n/// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test\n///         certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).\n///\n/// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**\n@available(*, deprecated, renamed: \"DisabledTrustEvaluator\", message: \"DisabledEvaluator has been renamed DisabledTrustEvaluator.\")\npublic typealias DisabledEvaluator = DisabledTrustEvaluator\n\n/// Disables all evaluation which in turn will always consider any server trust as valid.\n///\n///\n/// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test\n///         certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).\n///\n/// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**\npublic final class DisabledTrustEvaluator: ServerTrustEvaluating {\n    /// Creates an instance.\n    public init() {}\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {}\n}\n\n// MARK: - Extensions\n\nextension Array where Element == ServerTrustEvaluating {\n    #if os(Linux) || os(Windows)\n    // Add this same convenience method for Linux/Windows.\n    #else\n    /// Evaluates the given `SecTrust` value for the given `host`.\n    ///\n    /// - Parameters:\n    ///   - trust: The `SecTrust` value to evaluate.\n    ///   - host:  The host for which to evaluate the `SecTrust` value.\n    ///\n    /// - Returns: Whether or not the evaluator considers the `SecTrust` value valid for `host`.\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        for evaluator in self {\n            try evaluator.evaluate(trust, forHost: host)\n        }\n    }\n    #endif\n}\n\nextension Bundle: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType: Bundle {\n    /// Returns all valid `cer`, `crt`, and `der` certificates in the bundle.\n    public var certificates: [SecCertificate] {\n        paths(forResourcesOfTypes: [\".cer\", \".CER\", \".crt\", \".CRT\", \".der\", \".DER\"]).compactMap { path in\n            guard\n                let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData,\n                let certificate = SecCertificateCreateWithData(nil, certificateData) else { return nil }\n\n            return certificate\n        }\n    }\n\n    /// Returns all public keys for the valid certificates in the bundle.\n    public var publicKeys: [SecKey] {\n        certificates.af.publicKeys\n    }\n\n    /// Returns all pathnames for the resources identified by the provided file extensions.\n    ///\n    /// - Parameter types: The filename extensions locate.\n    ///\n    /// - Returns:         All pathnames for the given filename extensions.\n    public func paths(forResourcesOfTypes types: [String]) -> [String] {\n        Array(Set(types.flatMap { type.paths(forResourcesOfType: $0, inDirectory: nil) }))\n    }\n}\n\nextension SecTrust: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType == SecTrust {\n    /// Evaluates `self` after applying the `SecPolicy` value provided.\n    ///\n    /// - Parameter policy: The `SecPolicy` to apply to `self` before evaluation.\n    ///\n    /// - Throws:           Any `Error` from applying the `SecPolicy` or from evaluation.\n    @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)\n    public func evaluate(afterApplying policy: SecPolicy) throws {\n        try apply(policy: policy).af.evaluate()\n    }\n\n    /// Attempts to validate `self` using the `SecPolicy` provided and transforming any error produced using the closure passed.\n    ///\n    /// - Parameters:\n    ///   - policy:        The `SecPolicy` used to evaluate `self`.\n    ///   - errorProducer: The closure used transform the failed `OSStatus` and `SecTrustResultType`.\n    /// - Throws:          Any `Error` from applying the `policy`, or the result of `errorProducer` if validation fails.\n    @available(iOS, introduced: 10, deprecated: 12, renamed: \"evaluate(afterApplying:)\")\n    @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: \"evaluate(afterApplying:)\")\n    @available(tvOS, introduced: 10, deprecated: 12, renamed: \"evaluate(afterApplying:)\")\n    @available(watchOS, introduced: 3, deprecated: 5, renamed: \"evaluate(afterApplying:)\")\n    public func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {\n        try apply(policy: policy).af.validate(errorProducer: errorProducer)\n    }\n\n    /// Applies a `SecPolicy` to `self`, throwing if it fails.\n    ///\n    /// - Parameter policy: The `SecPolicy`.\n    ///\n    /// - Returns: `self`, with the policy applied.\n    /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.policyApplicationFailed` reason.\n    public func apply(policy: SecPolicy) throws -> SecTrust {\n        let status = SecTrustSetPolicies(type, policy)\n\n        guard status.af.isSuccess else {\n            throw AFError.serverTrustEvaluationFailed(reason: .policyApplicationFailed(trust: type,\n                                                                                       policy: policy,\n                                                                                       status: status))\n        }\n\n        return type\n    }\n\n    /// Evaluate `self`, throwing an `Error` if evaluation fails.\n    ///\n    /// - Throws: `AFError.serverTrustEvaluationFailed` with reason `.trustValidationFailed` and associated error from\n    ///           the underlying evaluation.\n    @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)\n    public func evaluate() throws {\n        var error: CFError?\n        let evaluationSucceeded = SecTrustEvaluateWithError(type, &error)\n\n        if !evaluationSucceeded {\n            throw AFError.serverTrustEvaluationFailed(reason: .trustEvaluationFailed(error: error))\n        }\n    }\n\n    /// Validate `self`, passing any failure values through `errorProducer`.\n    ///\n    /// - Parameter errorProducer: The closure used to transform the failed `OSStatus` and `SecTrustResultType` into an\n    ///                            `Error`.\n    /// - Throws:                  The `Error` produced by the `errorProducer` closure.\n    @available(iOS, introduced: 10, deprecated: 12, renamed: \"evaluate()\")\n    @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: \"evaluate()\")\n    @available(tvOS, introduced: 10, deprecated: 12, renamed: \"evaluate()\")\n    @available(watchOS, introduced: 3, deprecated: 5, renamed: \"evaluate()\")\n    public func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {\n        var result = SecTrustResultType.invalid\n        let status = SecTrustEvaluate(type, &result)\n\n        guard status.af.isSuccess && result.af.isSuccess else {\n            throw errorProducer(status, result)\n        }\n    }\n\n    /// Sets a custom certificate chain on `self`, allowing full validation of a self-signed certificate and its chain.\n    ///\n    /// - Parameter certificates: The `SecCertificate`s to add to the chain.\n    /// - Throws:                 Any error produced when applying the new certificate chain.\n    public func setAnchorCertificates(_ certificates: [SecCertificate]) throws {\n        // Add additional anchor certificates.\n        let status = SecTrustSetAnchorCertificates(type, certificates as CFArray)\n        guard status.af.isSuccess else {\n            throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: status,\n                                                                                               certificates: certificates))\n        }\n\n        // Trust only the set anchor certs.\n        let onlyStatus = SecTrustSetAnchorCertificatesOnly(type, true)\n        guard onlyStatus.af.isSuccess else {\n            throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: onlyStatus,\n                                                                                               certificates: certificates))\n        }\n    }\n\n    /// The public keys contained in `self`.\n    public var publicKeys: [SecKey] {\n        certificates.af.publicKeys\n    }\n\n    #if swift(>=5.5) // Xcode 13 / 2021 SDKs.\n    /// The `SecCertificate`s contained in `self`.\n    public var certificates: [SecCertificate] {\n        if #available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) {\n            return (SecTrustCopyCertificateChain(type) as? [SecCertificate]) ?? []\n        } else {\n            return (0..<SecTrustGetCertificateCount(type)).compactMap { index in\n                SecTrustGetCertificateAtIndex(type, index)\n            }\n        }\n    }\n    #else\n    /// The `SecCertificate`s contained in `self`.\n    public var certificates: [SecCertificate] {\n        (0..<SecTrustGetCertificateCount(type)).compactMap { index in\n            SecTrustGetCertificateAtIndex(type, index)\n        }\n    }\n    #endif\n\n    /// The `Data` values for all certificates contained in `self`.\n    public var certificateData: [Data] {\n        certificates.af.data\n    }\n\n    /// Validates `self` after applying `SecPolicy.af.default`. This evaluation does not validate the hostname.\n    ///\n    /// - Parameter host: The hostname, used only in the error output if validation fails.\n    /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.\n    public func performDefaultValidation(forHost host: String) throws {\n        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {\n            try evaluate(afterApplying: SecPolicy.af.default)\n        } else {\n            try validate(policy: SecPolicy.af.default) { status, result in\n                AFError.serverTrustEvaluationFailed(reason: .defaultEvaluationFailed(output: .init(host, type, status, result)))\n            }\n        }\n    }\n\n    /// Validates `self` after applying `SecPolicy.af.hostname(host)`, which performs the default validation as well as\n    /// hostname validation.\n    ///\n    /// - Parameter host: The hostname to use in the validation.\n    /// - Throws:         An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.\n    public func performValidation(forHost host: String) throws {\n        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {\n            try evaluate(afterApplying: SecPolicy.af.hostname(host))\n        } else {\n            try validate(policy: SecPolicy.af.hostname(host)) { status, result in\n                AFError.serverTrustEvaluationFailed(reason: .hostValidationFailed(output: .init(host, type, status, result)))\n            }\n        }\n    }\n}\n\nextension SecPolicy: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType == SecPolicy {\n    /// Creates a `SecPolicy` instance which will validate server certificates but not require a host name match.\n    public static let `default` = SecPolicyCreateSSL(true, nil)\n\n    /// Creates a `SecPolicy` instance which will validate server certificates and much match the provided hostname.\n    ///\n    /// - Parameter hostname: The hostname to validate against.\n    ///\n    /// - Returns:            The `SecPolicy`.\n    public static func hostname(_ hostname: String) -> SecPolicy {\n        SecPolicyCreateSSL(true, hostname as CFString)\n    }\n\n    /// Creates a `SecPolicy` which checks the revocation of certificates.\n    ///\n    /// - Parameter options: The `RevocationTrustEvaluator.Options` for evaluation.\n    ///\n    /// - Returns:           The `SecPolicy`.\n    /// - Throws:            An `AFError.serverTrustEvaluationFailed` error with reason `.revocationPolicyCreationFailed`\n    ///                      if the policy cannot be created.\n    public static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy {\n        guard let policy = SecPolicyCreateRevocation(options.rawValue) else {\n            throw AFError.serverTrustEvaluationFailed(reason: .revocationPolicyCreationFailed)\n        }\n\n        return policy\n    }\n}\n\nextension Array: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType == [SecCertificate] {\n    /// All `Data` values for the contained `SecCertificate`s.\n    public var data: [Data] {\n        type.map { SecCertificateCopyData($0) as Data }\n    }\n\n    /// All public `SecKey` values for the contained `SecCertificate`s.\n    public var publicKeys: [SecKey] {\n        type.compactMap(\\.af.publicKey)\n    }\n}\n\nextension SecCertificate: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType == SecCertificate {\n    /// The public key for `self`, if it can be extracted.\n    ///\n    /// - Note: On 2020 OSes and newer, only RSA and ECDSA keys are supported.\n    ///\n    public var publicKey: SecKey? {\n        let policy = SecPolicyCreateBasicX509()\n        var trust: SecTrust?\n        let trustCreationStatus = SecTrustCreateWithCertificates(type, policy, &trust)\n\n        guard let createdTrust = trust, trustCreationStatus == errSecSuccess else { return nil }\n\n        if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) {\n            return SecTrustCopyKey(createdTrust)\n        } else {\n            return SecTrustCopyPublicKey(createdTrust)\n        }\n    }\n}\n\nextension OSStatus: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType == OSStatus {\n    /// Returns whether `self` is `errSecSuccess`.\n    public var isSuccess: Bool { type == errSecSuccess }\n}\n\nextension SecTrustResultType: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType == SecTrustResultType {\n    /// Returns whether `self is `.unspecified` or `.proceed`.\n    public var isSuccess: Bool {\n        type == .unspecified || type == .proceed\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Session.swift",
    "content": "//\n//  Session.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// `Session` creates and manages Alamofire's `Request` types during their lifetimes. It also provides common\n/// functionality for all `Request`s, including queuing, interception, trust management, redirect handling, and response\n/// cache handling.\nopen class Session {\n    /// Shared singleton instance used by all `AF.request` APIs. Cannot be modified.\n    public static let `default` = Session()\n\n    /// Underlying `URLSession` used to create `URLSessionTasks` for this instance, and for which this instance's\n    /// `delegate` handles `URLSessionDelegate` callbacks.\n    ///\n    /// - Note: This instance should **NOT** be used to interact with the underlying `URLSessionTask`s. Doing so will\n    ///         break internal Alamofire logic that tracks those tasks.\n    ///\n    public let session: URLSession\n    /// Instance's `SessionDelegate`, which handles the `URLSessionDelegate` methods and `Request` interaction.\n    public let delegate: SessionDelegate\n    /// Root `DispatchQueue` for all internal callbacks and state update. **MUST** be a serial queue.\n    public let rootQueue: DispatchQueue\n    /// Value determining whether this instance automatically calls `resume()` on all created `Request`s.\n    public let startRequestsImmediately: Bool\n    /// `DispatchQueue` on which `URLRequest`s are created asynchronously. By default this queue uses `rootQueue` as its\n    /// `target`, but a separate queue can be used if request creation is determined to be a bottleneck. Always profile\n    /// and test before introducing an additional queue.\n    public let requestQueue: DispatchQueue\n    /// `DispatchQueue` passed to all `Request`s on which they perform their response serialization. By default this\n    /// queue uses `rootQueue` as its `target` but a separate queue can be used if response serialization is determined\n    /// to be a bottleneck. Always profile and test before introducing an additional queue.\n    public let serializationQueue: DispatchQueue\n    /// `RequestInterceptor` used for all `Request` created by the instance. `RequestInterceptor`s can also be set on a\n    /// per-`Request` basis, in which case the `Request`'s interceptor takes precedence over this value.\n    public let interceptor: RequestInterceptor?\n    /// `ServerTrustManager` instance used to evaluate all trust challenges and provide certificate and key pinning.\n    public let serverTrustManager: ServerTrustManager?\n    /// `RedirectHandler` instance used to provide customization for request redirection.\n    public let redirectHandler: RedirectHandler?\n    /// `CachedResponseHandler` instance used to provide customization of cached response handling.\n    public let cachedResponseHandler: CachedResponseHandler?\n    /// `CompositeEventMonitor` used to compose Alamofire's `defaultEventMonitors` and any passed `EventMonitor`s.\n    public let eventMonitor: CompositeEventMonitor\n    /// `EventMonitor`s included in all instances. `[AlamofireNotifications()]` by default.\n    public let defaultEventMonitors: [EventMonitor] = [AlamofireNotifications()]\n\n    /// Internal map between `Request`s and any `URLSessionTasks` that may be in flight for them.\n    var requestTaskMap = RequestTaskMap()\n    /// `Set` of currently active `Request`s.\n    var activeRequests: Set<Request> = []\n    /// Completion events awaiting `URLSessionTaskMetrics`.\n    var waitingCompletions: [URLSessionTask: () -> Void] = [:]\n\n    /// Creates a `Session` from a `URLSession` and other parameters.\n    ///\n    /// - Note: When passing a `URLSession`, you must create the `URLSession` with a specific `delegateQueue` value and\n    ///         pass the `delegateQueue`'s `underlyingQueue` as the `rootQueue` parameter of this initializer.\n    ///\n    /// - Parameters:\n    ///   - session:                  Underlying `URLSession` for this instance.\n    ///   - delegate:                 `SessionDelegate` that handles `session`'s delegate callbacks as well as `Request`\n    ///                               interaction.\n    ///   - rootQueue:                Root `DispatchQueue` for all internal callbacks and state updates. **MUST** be a\n    ///                               serial queue.\n    ///   - startRequestsImmediately: Determines whether this instance will automatically start all `Request`s. `true`\n    ///                               by default. If set to `false`, all `Request`s created must have `.resume()` called.\n    ///                               on them for them to start.\n    ///   - requestQueue:             `DispatchQueue` on which to perform `URLRequest` creation. By default this queue\n    ///                               will use the `rootQueue` as its `target`. A separate queue can be used if it's\n    ///                               determined request creation is a bottleneck, but that should only be done after\n    ///                               careful testing and profiling. `nil` by default.\n    ///   - serializationQueue:       `DispatchQueue` on which to perform all response serialization. By default this\n    ///                               queue will use the `rootQueue` as its `target`. A separate queue can be used if\n    ///                               it's determined response serialization is a bottleneck, but that should only be\n    ///                               done after careful testing and profiling. `nil` by default.\n    ///   - interceptor:              `RequestInterceptor` to be used for all `Request`s created by this instance. `nil`\n    ///                               by default.\n    ///   - serverTrustManager:       `ServerTrustManager` to be used for all trust evaluations by this instance. `nil`\n    ///                               by default.\n    ///   - redirectHandler:          `RedirectHandler` to be used by all `Request`s created by this instance. `nil` by\n    ///                               default.\n    ///   - cachedResponseHandler:    `CachedResponseHandler` to be used by all `Request`s created by this instance.\n    ///                               `nil` by default.\n    ///   - eventMonitors:            Additional `EventMonitor`s used by the instance. Alamofire always adds a\n    ///                               `AlamofireNotifications` `EventMonitor` to the array passed here. `[]` by default.\n    public init(session: URLSession,\n                delegate: SessionDelegate,\n                rootQueue: DispatchQueue,\n                startRequestsImmediately: Bool = true,\n                requestQueue: DispatchQueue? = nil,\n                serializationQueue: DispatchQueue? = nil,\n                interceptor: RequestInterceptor? = nil,\n                serverTrustManager: ServerTrustManager? = nil,\n                redirectHandler: RedirectHandler? = nil,\n                cachedResponseHandler: CachedResponseHandler? = nil,\n                eventMonitors: [EventMonitor] = []) {\n        precondition(session.configuration.identifier == nil,\n                     \"Alamofire does not support background URLSessionConfigurations.\")\n        precondition(session.delegateQueue.underlyingQueue === rootQueue,\n                     \"Session(session:) initializer must be passed the DispatchQueue used as the delegateQueue's underlyingQueue as rootQueue.\")\n\n        self.session = session\n        self.delegate = delegate\n        self.rootQueue = rootQueue\n        self.startRequestsImmediately = startRequestsImmediately\n        self.requestQueue = requestQueue ?? DispatchQueue(label: \"\\(rootQueue.label).requestQueue\", target: rootQueue)\n        self.serializationQueue = serializationQueue ?? DispatchQueue(label: \"\\(rootQueue.label).serializationQueue\", target: rootQueue)\n        self.interceptor = interceptor\n        self.serverTrustManager = serverTrustManager\n        self.redirectHandler = redirectHandler\n        self.cachedResponseHandler = cachedResponseHandler\n        eventMonitor = CompositeEventMonitor(monitors: defaultEventMonitors + eventMonitors)\n        delegate.eventMonitor = eventMonitor\n        delegate.stateProvider = self\n    }\n\n    /// Creates a `Session` from a `URLSessionConfiguration`.\n    ///\n    /// - Note: This initializer lets Alamofire handle the creation of the underlying `URLSession` and its\n    ///         `delegateQueue`, and is the recommended initializer for most uses.\n    ///\n    /// - Parameters:\n    ///   - configuration:            `URLSessionConfiguration` to be used to create the underlying `URLSession`. Changes\n    ///                               to this value after being passed to this initializer will have no effect.\n    ///                               `URLSessionConfiguration.af.default` by default.\n    ///   - delegate:                 `SessionDelegate` that handles `session`'s delegate callbacks as well as `Request`\n    ///                               interaction. `SessionDelegate()` by default.\n    ///   - rootQueue:                Root `DispatchQueue` for all internal callbacks and state updates. **MUST** be a\n    ///                               serial queue. `DispatchQueue(label: \"org.alamofire.session.rootQueue\")` by default.\n    ///   - startRequestsImmediately: Determines whether this instance will automatically start all `Request`s. `true`\n    ///                               by default. If set to `false`, all `Request`s created must have `.resume()` called.\n    ///                               on them for them to start.\n    ///   - requestQueue:             `DispatchQueue` on which to perform `URLRequest` creation. By default this queue\n    ///                               will use the `rootQueue` as its `target`. A separate queue can be used if it's\n    ///                               determined request creation is a bottleneck, but that should only be done after\n    ///                               careful testing and profiling. `nil` by default.\n    ///   - serializationQueue:       `DispatchQueue` on which to perform all response serialization. By default this\n    ///                               queue will use the `rootQueue` as its `target`. A separate queue can be used if\n    ///                               it's determined response serialization is a bottleneck, but that should only be\n    ///                               done after careful testing and profiling. `nil` by default.\n    ///   - interceptor:              `RequestInterceptor` to be used for all `Request`s created by this instance. `nil`\n    ///                               by default.\n    ///   - serverTrustManager:       `ServerTrustManager` to be used for all trust evaluations by this instance. `nil`\n    ///                               by default.\n    ///   - redirectHandler:          `RedirectHandler` to be used by all `Request`s created by this instance. `nil` by\n    ///                               default.\n    ///   - cachedResponseHandler:    `CachedResponseHandler` to be used by all `Request`s created by this instance.\n    ///                               `nil` by default.\n    ///   - eventMonitors:            Additional `EventMonitor`s used by the instance. Alamofire always adds a\n    ///                               `AlamofireNotifications` `EventMonitor` to the array passed here. `[]` by default.\n    public convenience init(configuration: URLSessionConfiguration = URLSessionConfiguration.af.default,\n                            delegate: SessionDelegate = SessionDelegate(),\n                            rootQueue: DispatchQueue = DispatchQueue(label: \"org.alamofire.session.rootQueue\"),\n                            startRequestsImmediately: Bool = true,\n                            requestQueue: DispatchQueue? = nil,\n                            serializationQueue: DispatchQueue? = nil,\n                            interceptor: RequestInterceptor? = nil,\n                            serverTrustManager: ServerTrustManager? = nil,\n                            redirectHandler: RedirectHandler? = nil,\n                            cachedResponseHandler: CachedResponseHandler? = nil,\n                            eventMonitors: [EventMonitor] = []) {\n        precondition(configuration.identifier == nil, \"Alamofire does not support background URLSessionConfigurations.\")\n\n        // Retarget the incoming rootQueue for safety, unless it's the main queue, which we know is safe.\n        let serialRootQueue = (rootQueue === DispatchQueue.main) ? rootQueue : DispatchQueue(label: rootQueue.label,\n                                                                                             target: rootQueue)\n        let delegateQueue = OperationQueue(maxConcurrentOperationCount: 1, underlyingQueue: serialRootQueue, name: \"\\(serialRootQueue.label).sessionDelegate\")\n        let session = URLSession(configuration: configuration, delegate: delegate, delegateQueue: delegateQueue)\n\n        self.init(session: session,\n                  delegate: delegate,\n                  rootQueue: serialRootQueue,\n                  startRequestsImmediately: startRequestsImmediately,\n                  requestQueue: requestQueue,\n                  serializationQueue: serializationQueue,\n                  interceptor: interceptor,\n                  serverTrustManager: serverTrustManager,\n                  redirectHandler: redirectHandler,\n                  cachedResponseHandler: cachedResponseHandler,\n                  eventMonitors: eventMonitors)\n    }\n\n    deinit {\n        finishRequestsForDeinit()\n        session.invalidateAndCancel()\n    }\n\n    // MARK: - All Requests API\n\n    /// Perform an action on all active `Request`s.\n    ///\n    /// - Note: The provided `action` closure is performed asynchronously, meaning that some `Request`s may complete and\n    ///         be unavailable by time it runs. Additionally, this action is performed on the instances's `rootQueue`,\n    ///         so care should be taken that actions are fast. Once the work on the `Request`s is complete, any\n    ///         additional work should be performed on another queue.\n    ///\n    /// - Parameters:\n    ///   - action:     Closure to perform with all `Request`s.\n    public func withAllRequests(perform action: @escaping (Set<Request>) -> Void) {\n        rootQueue.async {\n            action(self.activeRequests)\n        }\n    }\n\n    /// Cancel all active `Request`s, optionally calling a completion handler when complete.\n    ///\n    /// - Note: This is an asynchronous operation and does not block the creation of future `Request`s. Cancelled\n    ///         `Request`s may not cancel immediately due internal work, and may not cancel at all if they are close to\n    ///         completion when cancelled.\n    ///\n    /// - Parameters:\n    ///   - queue:      `DispatchQueue` on which the completion handler is run. `.main` by default.\n    ///   - completion: Closure to be called when all `Request`s have been cancelled.\n    public func cancelAllRequests(completingOnQueue queue: DispatchQueue = .main, completion: (() -> Void)? = nil) {\n        withAllRequests { requests in\n            requests.forEach { $0.cancel() }\n            queue.async {\n                completion?()\n            }\n        }\n    }\n\n    // MARK: - DataRequest\n\n    /// Closure which provides a `URLRequest` for mutation.\n    public typealias RequestModifier = (inout URLRequest) throws -> Void\n\n    struct RequestConvertible: URLRequestConvertible {\n        let url: URLConvertible\n        let method: HTTPMethod\n        let parameters: Parameters?\n        let encoding: ParameterEncoding\n        let headers: HTTPHeaders?\n        let requestModifier: RequestModifier?\n\n        func asURLRequest() throws -> URLRequest {\n            var request = try URLRequest(url: url, method: method, headers: headers)\n            try requestModifier?(&request)\n\n            return try encoding.encode(request, with: parameters)\n        }\n    }\n\n    /// Creates a `DataRequest` from a `URLRequest` created using the passed components and a `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible:     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:          `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:      `Parameters` (a.k.a. `[String: Any]`) value to be encoded into the `URLRequest`. `nil` by\n    ///                      default.\n    ///   - encoding:        `ParameterEncoding` to be used to encode the `parameters` value into the `URLRequest`.\n    ///                      `URLEncoding.default` by default.\n    ///   - headers:         `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:     `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - requestModifier: `RequestModifier` which will be applied to the `URLRequest` created from the provided\n    ///                      parameters. `nil` by default.\n    ///\n    /// - Returns:       The created `DataRequest`.\n    open func request(_ convertible: URLConvertible,\n                      method: HTTPMethod = .get,\n                      parameters: Parameters? = nil,\n                      encoding: ParameterEncoding = URLEncoding.default,\n                      headers: HTTPHeaders? = nil,\n                      interceptor: RequestInterceptor? = nil,\n                      requestModifier: RequestModifier? = nil) -> DataRequest {\n        let convertible = RequestConvertible(url: convertible,\n                                             method: method,\n                                             parameters: parameters,\n                                             encoding: encoding,\n                                             headers: headers,\n                                             requestModifier: requestModifier)\n\n        return request(convertible, interceptor: interceptor)\n    }\n\n    struct RequestEncodableConvertible<Parameters: Encodable>: URLRequestConvertible {\n        let url: URLConvertible\n        let method: HTTPMethod\n        let parameters: Parameters?\n        let encoder: ParameterEncoder\n        let headers: HTTPHeaders?\n        let requestModifier: RequestModifier?\n\n        func asURLRequest() throws -> URLRequest {\n            var request = try URLRequest(url: url, method: method, headers: headers)\n            try requestModifier?(&request)\n\n            return try parameters.map { try encoder.encode($0, into: request) } ?? request\n        }\n    }\n\n    /// Creates a `DataRequest` from a `URLRequest` created using the passed components, `Encodable` parameters, and a\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible:     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:          `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:      `Encodable` value to be encoded into the `URLRequest`. `nil` by default.\n    ///   - encoder:         `ParameterEncoder` to be used to encode the `parameters` value into the `URLRequest`.\n    ///                      `URLEncodedFormParameterEncoder.default` by default.\n    ///   - headers:         `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:     `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - requestModifier: `RequestModifier` which will be applied to the `URLRequest` created from\n    ///                      the provided parameters. `nil` by default.\n    ///\n    /// - Returns:           The created `DataRequest`.\n    open func request<Parameters: Encodable>(_ convertible: URLConvertible,\n                                             method: HTTPMethod = .get,\n                                             parameters: Parameters? = nil,\n                                             encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default,\n                                             headers: HTTPHeaders? = nil,\n                                             interceptor: RequestInterceptor? = nil,\n                                             requestModifier: RequestModifier? = nil) -> DataRequest {\n        let convertible = RequestEncodableConvertible(url: convertible,\n                                                      method: method,\n                                                      parameters: parameters,\n                                                      encoder: encoder,\n                                                      headers: headers,\n                                                      requestModifier: requestModifier)\n\n        return request(convertible, interceptor: interceptor)\n    }\n\n    /// Creates a `DataRequest` from a `URLRequestConvertible` value and a `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///\n    /// - Returns:       The created `DataRequest`.\n    open func request(_ convertible: URLRequestConvertible, interceptor: RequestInterceptor? = nil) -> DataRequest {\n        let request = DataRequest(convertible: convertible,\n                                  underlyingQueue: rootQueue,\n                                  serializationQueue: serializationQueue,\n                                  eventMonitor: eventMonitor,\n                                  interceptor: interceptor,\n                                  delegate: self)\n\n        perform(request)\n\n        return request\n    }\n\n    // MARK: - DataStreamRequest\n\n    /// Creates a `DataStreamRequest` from the passed components, `Encodable` parameters, and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible:                      `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:                           `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:                       `Encodable` value to be encoded into the `URLRequest`. `nil` by default.\n    ///   - encoder:                          `ParameterEncoder` to be used to encode the `parameters` value into the\n    ///                                       `URLRequest`.\n    ///                                       `URLEncodedFormParameterEncoder.default` by default.\n    ///   - headers:                          `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - automaticallyCancelOnStreamError: `Bool` indicating whether the instance should be canceled when an `Error`\n    ///                                       is thrown while serializing stream `Data`. `false` by default.\n    ///   - interceptor:                      `RequestInterceptor` value to be used by the returned `DataRequest`. `nil`\n    ///                                       by default.\n    ///   - requestModifier:                  `RequestModifier` which will be applied to the `URLRequest` created from\n    ///                                       the provided parameters. `nil` by default.\n    ///\n    /// - Returns:       The created `DataStream` request.\n    open func streamRequest<Parameters: Encodable>(_ convertible: URLConvertible,\n                                                   method: HTTPMethod = .get,\n                                                   parameters: Parameters? = nil,\n                                                   encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default,\n                                                   headers: HTTPHeaders? = nil,\n                                                   automaticallyCancelOnStreamError: Bool = false,\n                                                   interceptor: RequestInterceptor? = nil,\n                                                   requestModifier: RequestModifier? = nil) -> DataStreamRequest {\n        let convertible = RequestEncodableConvertible(url: convertible,\n                                                      method: method,\n                                                      parameters: parameters,\n                                                      encoder: encoder,\n                                                      headers: headers,\n                                                      requestModifier: requestModifier)\n\n        return streamRequest(convertible,\n                             automaticallyCancelOnStreamError: automaticallyCancelOnStreamError,\n                             interceptor: interceptor)\n    }\n\n    /// Creates a `DataStreamRequest` from the passed components and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible:                      `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:                           `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - headers:                          `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - automaticallyCancelOnStreamError: `Bool` indicating whether the instance should be canceled when an `Error`\n    ///                                       is thrown while serializing stream `Data`. `false` by default.\n    ///   - interceptor:                      `RequestInterceptor` value to be used by the returned `DataRequest`. `nil`\n    ///                                       by default.\n    ///   - requestModifier:                  `RequestModifier` which will be applied to the `URLRequest` created from\n    ///                                       the provided parameters. `nil` by default.\n    ///\n    /// - Returns:       The created `DataStream` request.\n    open func streamRequest(_ convertible: URLConvertible,\n                            method: HTTPMethod = .get,\n                            headers: HTTPHeaders? = nil,\n                            automaticallyCancelOnStreamError: Bool = false,\n                            interceptor: RequestInterceptor? = nil,\n                            requestModifier: RequestModifier? = nil) -> DataStreamRequest {\n        let convertible = RequestEncodableConvertible(url: convertible,\n                                                      method: method,\n                                                      parameters: Empty?.none,\n                                                      encoder: URLEncodedFormParameterEncoder.default,\n                                                      headers: headers,\n                                                      requestModifier: requestModifier)\n\n        return streamRequest(convertible,\n                             automaticallyCancelOnStreamError: automaticallyCancelOnStreamError,\n                             interceptor: interceptor)\n    }\n\n    /// Creates a `DataStreamRequest` from the passed `URLRequestConvertible` value and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible:                      `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - automaticallyCancelOnStreamError: `Bool` indicating whether the instance should be canceled when an `Error`\n    ///                                       is thrown while serializing stream `Data`. `false` by default.\n    ///   - interceptor:                      `RequestInterceptor` value to be used by the returned `DataRequest`. `nil`\n    ///                                        by default.\n    ///\n    /// - Returns:       The created `DataStreamRequest`.\n    open func streamRequest(_ convertible: URLRequestConvertible,\n                            automaticallyCancelOnStreamError: Bool = false,\n                            interceptor: RequestInterceptor? = nil) -> DataStreamRequest {\n        let request = DataStreamRequest(convertible: convertible,\n                                        automaticallyCancelOnStreamError: automaticallyCancelOnStreamError,\n                                        underlyingQueue: rootQueue,\n                                        serializationQueue: serializationQueue,\n                                        eventMonitor: eventMonitor,\n                                        interceptor: interceptor,\n                                        delegate: self)\n\n        perform(request)\n\n        return request\n    }\n\n    // MARK: - DownloadRequest\n\n    /// Creates a `DownloadRequest` using a `URLRequest` created using the passed components, `RequestInterceptor`, and\n    /// `Destination`.\n    ///\n    /// - Parameters:\n    ///   - convertible:     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:          `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:      `Parameters` (a.k.a. `[String: Any]`) value to be encoded into the `URLRequest`. `nil` by\n    ///                      default.\n    ///   - encoding:        `ParameterEncoding` to be used to encode the `parameters` value into the `URLRequest`.\n    ///                      Defaults to `URLEncoding.default`.\n    ///   - headers:         `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:     `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - requestModifier: `RequestModifier` which will be applied to the `URLRequest` created from the provided\n    ///                      parameters. `nil` by default.\n    ///   - destination:     `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                      should be moved. `nil` by default.\n    ///\n    /// - Returns:           The created `DownloadRequest`.\n    open func download(_ convertible: URLConvertible,\n                       method: HTTPMethod = .get,\n                       parameters: Parameters? = nil,\n                       encoding: ParameterEncoding = URLEncoding.default,\n                       headers: HTTPHeaders? = nil,\n                       interceptor: RequestInterceptor? = nil,\n                       requestModifier: RequestModifier? = nil,\n                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let convertible = RequestConvertible(url: convertible,\n                                             method: method,\n                                             parameters: parameters,\n                                             encoding: encoding,\n                                             headers: headers,\n                                             requestModifier: requestModifier)\n\n        return download(convertible, interceptor: interceptor, to: destination)\n    }\n\n    /// Creates a `DownloadRequest` from a `URLRequest` created using the passed components, `Encodable` parameters, and\n    /// a `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible:     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:          `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:      Value conforming to `Encodable` to be encoded into the `URLRequest`. `nil` by default.\n    ///   - encoder:         `ParameterEncoder` to be used to encode the `parameters` value into the `URLRequest`.\n    ///                      Defaults to `URLEncodedFormParameterEncoder.default`.\n    ///   - headers:         `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:     `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - requestModifier: `RequestModifier` which will be applied to the `URLRequest` created from the provided\n    ///                      parameters. `nil` by default.\n    ///   - destination:     `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                      should be moved. `nil` by default.\n    ///\n    /// - Returns:           The created `DownloadRequest`.\n    open func download<Parameters: Encodable>(_ convertible: URLConvertible,\n                                              method: HTTPMethod = .get,\n                                              parameters: Parameters? = nil,\n                                              encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default,\n                                              headers: HTTPHeaders? = nil,\n                                              interceptor: RequestInterceptor? = nil,\n                                              requestModifier: RequestModifier? = nil,\n                                              to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let convertible = RequestEncodableConvertible(url: convertible,\n                                                      method: method,\n                                                      parameters: parameters,\n                                                      encoder: encoder,\n                                                      headers: headers,\n                                                      requestModifier: requestModifier)\n\n        return download(convertible, interceptor: interceptor, to: destination)\n    }\n\n    /// Creates a `DownloadRequest` from a `URLRequestConvertible` value, a `RequestInterceptor`, and a `Destination`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - destination: `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                  should be moved. `nil` by default.\n    ///\n    /// - Returns:       The created `DownloadRequest`.\n    open func download(_ convertible: URLRequestConvertible,\n                       interceptor: RequestInterceptor? = nil,\n                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let request = DownloadRequest(downloadable: .request(convertible),\n                                      underlyingQueue: rootQueue,\n                                      serializationQueue: serializationQueue,\n                                      eventMonitor: eventMonitor,\n                                      interceptor: interceptor,\n                                      delegate: self,\n                                      destination: destination ?? DownloadRequest.defaultDestination)\n\n        perform(request)\n\n        return request\n    }\n\n    /// Creates a `DownloadRequest` from the `resumeData` produced from a previously cancelled `DownloadRequest`, as\n    /// well as a `RequestInterceptor`, and a `Destination`.\n    ///\n    /// - Note: If `destination` is not specified, the download will be moved to a temporary location determined by\n    ///         Alamofire. The file will not be deleted until the system purges the temporary files.\n    ///\n    /// - Note: On some versions of all Apple platforms (iOS 10 - 10.2, macOS 10.12 - 10.12.2, tvOS 10 - 10.1, watchOS 3 - 3.1.1),\n    /// `resumeData` is broken on background URL session configurations. There's an underlying bug in the `resumeData`\n    /// generation logic where the data is written incorrectly and will always fail to resume the download. For more\n    /// information about the bug and possible workarounds, please refer to the [this Stack Overflow post](http://stackoverflow.com/a/39347461/1342462).\n    ///\n    /// - Parameters:\n    ///   - data:        The resume data from a previously cancelled `DownloadRequest` or `URLSessionDownloadTask`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - destination: `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                  should be moved. `nil` by default.\n    ///\n    /// - Returns:       The created `DownloadRequest`.\n    open func download(resumingWith data: Data,\n                       interceptor: RequestInterceptor? = nil,\n                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let request = DownloadRequest(downloadable: .resumeData(data),\n                                      underlyingQueue: rootQueue,\n                                      serializationQueue: serializationQueue,\n                                      eventMonitor: eventMonitor,\n                                      interceptor: interceptor,\n                                      delegate: self,\n                                      destination: destination ?? DownloadRequest.defaultDestination)\n\n        perform(request)\n\n        return request\n    }\n\n    // MARK: - UploadRequest\n\n    struct ParameterlessRequestConvertible: URLRequestConvertible {\n        let url: URLConvertible\n        let method: HTTPMethod\n        let headers: HTTPHeaders?\n        let requestModifier: RequestModifier?\n\n        func asURLRequest() throws -> URLRequest {\n            var request = try URLRequest(url: url, method: method, headers: headers)\n            try requestModifier?(&request)\n\n            return request\n        }\n    }\n\n    struct Upload: UploadConvertible {\n        let request: URLRequestConvertible\n        let uploadable: UploadableConvertible\n\n        func createUploadable() throws -> UploadRequest.Uploadable {\n            try uploadable.createUploadable()\n        }\n\n        func asURLRequest() throws -> URLRequest {\n            try request.asURLRequest()\n        }\n    }\n\n    // MARK: Data\n\n    /// Creates an `UploadRequest` for the given `Data`, `URLRequest` components, and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - data:            The `Data` to upload.\n    ///   - convertible:     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:          `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:         `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:     `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:     `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                      default.\n    ///   - requestModifier: `RequestModifier` which will be applied to the `URLRequest` created from the provided\n    ///                      parameters. `nil` by default.\n    ///\n    /// - Returns:           The created `UploadRequest`.\n    open func upload(_ data: Data,\n                     to convertible: URLConvertible,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default,\n                     requestModifier: RequestModifier? = nil) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: convertible,\n                                                          method: method,\n                                                          headers: headers,\n                                                          requestModifier: requestModifier)\n\n        return upload(data, with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the given `Data` using the `URLRequestConvertible` value and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - data:        The `Data` to upload.\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ data: Data,\n                     with convertible: URLRequestConvertible,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        upload(.data(data), with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: File\n\n    /// Creates an `UploadRequest` for the file at the given file `URL`, using a `URLRequest` from the provided\n    /// components and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - fileURL:         The `URL` of the file to upload.\n    ///   - convertible:     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:          `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:         `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:     `RequestInterceptor` value to be used by the returned `UploadRequest`. `nil` by default.\n    ///   - fileManager:     `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                      default.\n    ///   - requestModifier: `RequestModifier` which will be applied to the `URLRequest` created from the provided\n    ///                      parameters. `nil` by default.\n    ///\n    /// - Returns:           The created `UploadRequest`.\n    open func upload(_ fileURL: URL,\n                     to convertible: URLConvertible,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default,\n                     requestModifier: RequestModifier? = nil) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: convertible,\n                                                          method: method,\n                                                          headers: headers,\n                                                          requestModifier: requestModifier)\n\n        return upload(fileURL, with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the file at the given file `URL` using the `URLRequestConvertible` value and\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - fileURL:     The `URL` of the file to upload.\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ fileURL: URL,\n                     with convertible: URLRequestConvertible,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        upload(.file(fileURL, shouldRemove: false), with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: InputStream\n\n    /// Creates an `UploadRequest` from the `InputStream` provided using a `URLRequest` from the provided components and\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - stream:          The `InputStream` that provides the data to upload.\n    ///   - convertible:     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:          `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:         `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:     `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:     `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                      default.\n    ///   - requestModifier: `RequestModifier` which will be applied to the `URLRequest` created from the provided\n    ///                      parameters. `nil` by default.\n    ///\n    /// - Returns:           The created `UploadRequest`.\n    open func upload(_ stream: InputStream,\n                     to convertible: URLConvertible,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default,\n                     requestModifier: RequestModifier? = nil) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: convertible,\n                                                          method: method,\n                                                          headers: headers,\n                                                          requestModifier: requestModifier)\n\n        return upload(stream, with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` from the provided `InputStream` using the `URLRequestConvertible` value and\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - stream:      The `InputStream` that provides the data to upload.\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ stream: InputStream,\n                     with convertible: URLRequestConvertible,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        upload(.stream(stream), with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: MultipartFormData\n\n    /// Creates an `UploadRequest` for the multipart form data built using a closure and sent using the provided\n    /// `URLRequest` components and `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:      `MultipartFormData` building closure.\n    ///   - url:                    `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - method:                  `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:                 `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` to be used if the form data exceeds the memory threshold and is\n    ///                              written to disk before being uploaded. `.default` instance by default.\n    ///   - requestModifier:         `RequestModifier` which will be applied to the `URLRequest` created from the\n    ///                              provided parameters. `nil` by default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: @escaping (MultipartFormData) -> Void,\n                     to url: URLConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default,\n                     requestModifier: RequestModifier? = nil) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: url,\n                                                          method: method,\n                                                          headers: headers,\n                                                          requestModifier: requestModifier)\n\n        let formData = MultipartFormData(fileManager: fileManager)\n        multipartFormData(formData)\n\n        return upload(multipartFormData: formData,\n                      with: convertible,\n                      usingThreshold: encodingMemoryThreshold,\n                      interceptor: interceptor,\n                      fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` using a `MultipartFormData` building closure, the provided `URLRequestConvertible`\n    /// value, and a `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:       `MultipartFormData` building closure.\n    ///   - request:                 `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` to be used if the form data exceeds the memory threshold and is\n    ///                              written to disk before being uploaded. `.default` instance by default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: @escaping (MultipartFormData) -> Void,\n                     with request: URLRequestConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let formData = MultipartFormData(fileManager: fileManager)\n        multipartFormData(formData)\n\n        return upload(multipartFormData: formData,\n                      with: request,\n                      usingThreshold: encodingMemoryThreshold,\n                      interceptor: interceptor,\n                      fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the prebuilt `MultipartFormData` value using the provided `URLRequest` components\n    /// and `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:       `MultipartFormData` instance to upload.\n    ///   - url:                     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - method:                  `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:                 `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` to be used if the form data exceeds the memory threshold and is\n    ///                              written to disk before being uploaded. `.default` instance by default.\n    ///   - requestModifier:         `RequestModifier` which will be applied to the `URLRequest` created from the\n    ///                              provided parameters. `nil` by default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: MultipartFormData,\n                     to url: URLConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default,\n                     requestModifier: RequestModifier? = nil) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: url,\n                                                          method: method,\n                                                          headers: headers,\n                                                          requestModifier: requestModifier)\n\n        let multipartUpload = MultipartUpload(encodingMemoryThreshold: encodingMemoryThreshold,\n                                              request: convertible,\n                                              multipartFormData: multipartFormData)\n\n        return upload(multipartUpload, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the prebuilt `MultipartFormData` value using the providing `URLRequestConvertible`\n    /// value and `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:       `MultipartFormData` instance to upload.\n    ///   - request:                 `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                              default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: MultipartFormData,\n                     with request: URLRequestConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let multipartUpload = MultipartUpload(encodingMemoryThreshold: encodingMemoryThreshold,\n                                              request: request,\n                                              multipartFormData: multipartFormData)\n\n        return upload(multipartUpload, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: - Internal API\n\n    // MARK: Uploadable\n\n    func upload(_ uploadable: UploadRequest.Uploadable,\n                with convertible: URLRequestConvertible,\n                interceptor: RequestInterceptor?,\n                fileManager: FileManager) -> UploadRequest {\n        let uploadable = Upload(request: convertible, uploadable: uploadable)\n\n        return upload(uploadable, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    func upload(_ upload: UploadConvertible, interceptor: RequestInterceptor?, fileManager: FileManager) -> UploadRequest {\n        let request = UploadRequest(convertible: upload,\n                                    underlyingQueue: rootQueue,\n                                    serializationQueue: serializationQueue,\n                                    eventMonitor: eventMonitor,\n                                    interceptor: interceptor,\n                                    fileManager: fileManager,\n                                    delegate: self)\n\n        perform(request)\n\n        return request\n    }\n\n    // MARK: Perform\n\n    /// Starts performing the provided `Request`.\n    ///\n    /// - Parameter request: The `Request` to perform.\n    func perform(_ request: Request) {\n        rootQueue.async {\n            guard !request.isCancelled else { return }\n\n            self.activeRequests.insert(request)\n\n            self.requestQueue.async {\n                // Leaf types must come first, otherwise they will cast as their superclass.\n                switch request {\n                case let r as UploadRequest: self.performUploadRequest(r) // UploadRequest must come before DataRequest due to subtype relationship.\n                case let r as DataRequest: self.performDataRequest(r)\n                case let r as DownloadRequest: self.performDownloadRequest(r)\n                case let r as DataStreamRequest: self.performDataStreamRequest(r)\n                default: fatalError(\"Attempted to perform unsupported Request subclass: \\(type(of: request))\")\n                }\n            }\n        }\n    }\n\n    func performDataRequest(_ request: DataRequest) {\n        dispatchPrecondition(condition: .onQueue(requestQueue))\n\n        performSetupOperations(for: request, convertible: request.convertible)\n    }\n\n    func performDataStreamRequest(_ request: DataStreamRequest) {\n        dispatchPrecondition(condition: .onQueue(requestQueue))\n\n        performSetupOperations(for: request, convertible: request.convertible)\n    }\n\n    func performUploadRequest(_ request: UploadRequest) {\n        dispatchPrecondition(condition: .onQueue(requestQueue))\n\n        performSetupOperations(for: request, convertible: request.convertible) {\n            do {\n                let uploadable = try request.upload.createUploadable()\n                self.rootQueue.async { request.didCreateUploadable(uploadable) }\n                return true\n            } catch {\n                self.rootQueue.async { request.didFailToCreateUploadable(with: error.asAFError(or: .createUploadableFailed(error: error))) }\n                return false\n            }\n        }\n    }\n\n    func performDownloadRequest(_ request: DownloadRequest) {\n        dispatchPrecondition(condition: .onQueue(requestQueue))\n\n        switch request.downloadable {\n        case let .request(convertible):\n            performSetupOperations(for: request, convertible: convertible)\n        case let .resumeData(resumeData):\n            rootQueue.async { self.didReceiveResumeData(resumeData, for: request) }\n        }\n    }\n\n    func performSetupOperations(for request: Request,\n                                convertible: URLRequestConvertible,\n                                shouldCreateTask: @escaping () -> Bool = { true }) {\n        dispatchPrecondition(condition: .onQueue(requestQueue))\n\n        let initialRequest: URLRequest\n\n        do {\n            initialRequest = try convertible.asURLRequest()\n            try initialRequest.validate()\n        } catch {\n            rootQueue.async { request.didFailToCreateURLRequest(with: error.asAFError(or: .createURLRequestFailed(error: error))) }\n            return\n        }\n\n        rootQueue.async { request.didCreateInitialURLRequest(initialRequest) }\n\n        guard !request.isCancelled else { return }\n\n        guard let adapter = adapter(for: request) else {\n            guard shouldCreateTask() else { return }\n            rootQueue.async { self.didCreateURLRequest(initialRequest, for: request) }\n            return\n        }\n\n        let adapterState = RequestAdapterState(requestID: request.id, session: self)\n\n        adapter.adapt(initialRequest, using: adapterState) { result in\n            do {\n                let adaptedRequest = try result.get()\n                try adaptedRequest.validate()\n\n                self.rootQueue.async { request.didAdaptInitialRequest(initialRequest, to: adaptedRequest) }\n\n                guard shouldCreateTask() else { return }\n\n                self.rootQueue.async { self.didCreateURLRequest(adaptedRequest, for: request) }\n            } catch {\n                self.rootQueue.async { request.didFailToAdaptURLRequest(initialRequest, withError: .requestAdaptationFailed(error: error)) }\n            }\n        }\n    }\n\n    // MARK: - Task Handling\n\n    func didCreateURLRequest(_ urlRequest: URLRequest, for request: Request) {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        request.didCreateURLRequest(urlRequest)\n\n        guard !request.isCancelled else { return }\n\n        let task = request.task(for: urlRequest, using: session)\n        requestTaskMap[request] = task\n        request.didCreateTask(task)\n\n        updateStatesForTask(task, request: request)\n    }\n\n    func didReceiveResumeData(_ data: Data, for request: DownloadRequest) {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        guard !request.isCancelled else { return }\n\n        let task = request.task(forResumeData: data, using: session)\n        requestTaskMap[request] = task\n        request.didCreateTask(task)\n\n        updateStatesForTask(task, request: request)\n    }\n\n    func updateStatesForTask(_ task: URLSessionTask, request: Request) {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        request.withState { state in\n            switch state {\n            case .initialized, .finished:\n                // Do nothing.\n                break\n            case .resumed:\n                task.resume()\n                rootQueue.async { request.didResumeTask(task) }\n            case .suspended:\n                task.suspend()\n                rootQueue.async { request.didSuspendTask(task) }\n            case .cancelled:\n                // Resume to ensure metrics are gathered.\n                task.resume()\n                task.cancel()\n                rootQueue.async { request.didCancelTask(task) }\n            }\n        }\n    }\n\n    // MARK: - Adapters and Retriers\n\n    func adapter(for request: Request) -> RequestAdapter? {\n        if let requestInterceptor = request.interceptor, let sessionInterceptor = interceptor {\n            return Interceptor(adapters: [requestInterceptor, sessionInterceptor])\n        } else {\n            return request.interceptor ?? interceptor\n        }\n    }\n\n    func retrier(for request: Request) -> RequestRetrier? {\n        if let requestInterceptor = request.interceptor, let sessionInterceptor = interceptor {\n            return Interceptor(retriers: [requestInterceptor, sessionInterceptor])\n        } else {\n            return request.interceptor ?? interceptor\n        }\n    }\n\n    // MARK: - Invalidation\n\n    func finishRequestsForDeinit() {\n        requestTaskMap.requests.forEach { request in\n            rootQueue.async {\n                request.finish(error: AFError.sessionDeinitialized)\n            }\n        }\n    }\n}\n\n// MARK: - RequestDelegate\n\nextension Session: RequestDelegate {\n    public var sessionConfiguration: URLSessionConfiguration {\n        session.configuration\n    }\n\n    public var startImmediately: Bool { startRequestsImmediately }\n\n    public func cleanup(after request: Request) {\n        activeRequests.remove(request)\n    }\n\n    public func retryResult(for request: Request, dueTo error: AFError, completion: @escaping (RetryResult) -> Void) {\n        guard let retrier = retrier(for: request) else {\n            rootQueue.async { completion(.doNotRetry) }\n            return\n        }\n\n        retrier.retry(request, for: self, dueTo: error) { retryResult in\n            self.rootQueue.async {\n                guard let retryResultError = retryResult.error else { completion(retryResult); return }\n\n                let retryError = AFError.requestRetryFailed(retryError: retryResultError, originalError: error)\n                completion(.doNotRetryWithError(retryError))\n            }\n        }\n    }\n\n    public func retryRequest(_ request: Request, withDelay timeDelay: TimeInterval?) {\n        rootQueue.async {\n            let retry: () -> Void = {\n                guard !request.isCancelled else { return }\n\n                request.prepareForRetry()\n                self.perform(request)\n            }\n\n            if let retryDelay = timeDelay {\n                self.rootQueue.after(retryDelay) { retry() }\n            } else {\n                retry()\n            }\n        }\n    }\n}\n\n// MARK: - SessionStateProvider\n\nextension Session: SessionStateProvider {\n    func request(for task: URLSessionTask) -> Request? {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        return requestTaskMap[task]\n    }\n\n    func didGatherMetricsForTask(_ task: URLSessionTask) {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        let didDisassociate = requestTaskMap.disassociateIfNecessaryAfterGatheringMetricsForTask(task)\n\n        if didDisassociate {\n            waitingCompletions[task]?()\n            waitingCompletions[task] = nil\n        }\n    }\n\n    func didCompleteTask(_ task: URLSessionTask, completion: @escaping () -> Void) {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        let didDisassociate = requestTaskMap.disassociateIfNecessaryAfterCompletingTask(task)\n\n        if didDisassociate {\n            completion()\n        } else {\n            waitingCompletions[task] = completion\n        }\n    }\n\n    func credential(for task: URLSessionTask, in protectionSpace: URLProtectionSpace) -> URLCredential? {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        return requestTaskMap[task]?.credential ??\n            session.configuration.urlCredentialStorage?.defaultCredential(for: protectionSpace)\n    }\n\n    func cancelRequestsForSessionInvalidation(with error: Error?) {\n        dispatchPrecondition(condition: .onQueue(rootQueue))\n\n        requestTaskMap.requests.forEach { $0.finish(error: AFError.sessionInvalidated(error: error)) }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/SessionDelegate.swift",
    "content": "//\n//  SessionDelegate.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Class which implements the various `URLSessionDelegate` methods to connect various Alamofire features.\nopen class SessionDelegate: NSObject {\n    private let fileManager: FileManager\n\n    weak var stateProvider: SessionStateProvider?\n    var eventMonitor: EventMonitor?\n\n    /// Creates an instance from the given `FileManager`.\n    ///\n    /// - Parameter fileManager: `FileManager` to use for underlying file management, such as moving downloaded files.\n    ///                          `.default` by default.\n    public init(fileManager: FileManager = .default) {\n        self.fileManager = fileManager\n    }\n\n    /// Internal method to find and cast requests while maintaining some integrity checking.\n    ///\n    /// - Parameters:\n    ///   - task: The `URLSessionTask` for which to find the associated `Request`.\n    ///   - type: The `Request` subclass type to cast any `Request` associate with `task`.\n    func request<R: Request>(for task: URLSessionTask, as type: R.Type) -> R? {\n        guard let provider = stateProvider else {\n            assertionFailure(\"StateProvider is nil.\")\n            return nil\n        }\n\n        return provider.request(for: task) as? R\n    }\n}\n\n/// Type which provides various `Session` state values.\nprotocol SessionStateProvider: AnyObject {\n    var serverTrustManager: ServerTrustManager? { get }\n    var redirectHandler: RedirectHandler? { get }\n    var cachedResponseHandler: CachedResponseHandler? { get }\n\n    func request(for task: URLSessionTask) -> Request?\n    func didGatherMetricsForTask(_ task: URLSessionTask)\n    func didCompleteTask(_ task: URLSessionTask, completion: @escaping () -> Void)\n    func credential(for task: URLSessionTask, in protectionSpace: URLProtectionSpace) -> URLCredential?\n    func cancelRequestsForSessionInvalidation(with error: Error?)\n}\n\n// MARK: URLSessionDelegate\n\nextension SessionDelegate: URLSessionDelegate {\n    open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {\n        eventMonitor?.urlSession(session, didBecomeInvalidWithError: error)\n\n        stateProvider?.cancelRequestsForSessionInvalidation(with: error)\n    }\n}\n\n// MARK: URLSessionTaskDelegate\n\nextension SessionDelegate: URLSessionTaskDelegate {\n    /// Result of a `URLAuthenticationChallenge` evaluation.\n    typealias ChallengeEvaluation = (disposition: URLSession.AuthChallengeDisposition, credential: URLCredential?, error: AFError?)\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         didReceive challenge: URLAuthenticationChallenge,\n                         completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {\n        eventMonitor?.urlSession(session, task: task, didReceive: challenge)\n\n        let evaluation: ChallengeEvaluation\n        switch challenge.protectionSpace.authenticationMethod {\n        case NSURLAuthenticationMethodHTTPBasic, NSURLAuthenticationMethodHTTPDigest, NSURLAuthenticationMethodNTLM,\n             NSURLAuthenticationMethodNegotiate:\n            evaluation = attemptCredentialAuthentication(for: challenge, belongingTo: task)\n        #if !(os(Linux) || os(Windows))\n        case NSURLAuthenticationMethodServerTrust:\n            evaluation = attemptServerTrustAuthentication(with: challenge)\n        case NSURLAuthenticationMethodClientCertificate:\n            evaluation = attemptCredentialAuthentication(for: challenge, belongingTo: task)\n        #endif\n        default:\n            evaluation = (.performDefaultHandling, nil, nil)\n        }\n\n        if let error = evaluation.error {\n            stateProvider?.request(for: task)?.didFailTask(task, earlyWithError: error)\n        }\n\n        completionHandler(evaluation.disposition, evaluation.credential)\n    }\n\n    #if !(os(Linux) || os(Windows))\n    /// Evaluates the server trust `URLAuthenticationChallenge` received.\n    ///\n    /// - Parameter challenge: The `URLAuthenticationChallenge`.\n    ///\n    /// - Returns:             The `ChallengeEvaluation`.\n    func attemptServerTrustAuthentication(with challenge: URLAuthenticationChallenge) -> ChallengeEvaluation {\n        let host = challenge.protectionSpace.host\n\n        guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,\n              let trust = challenge.protectionSpace.serverTrust\n        else {\n            return (.performDefaultHandling, nil, nil)\n        }\n\n        do {\n            guard let evaluator = try stateProvider?.serverTrustManager?.serverTrustEvaluator(forHost: host) else {\n                return (.performDefaultHandling, nil, nil)\n            }\n\n            try evaluator.evaluate(trust, forHost: host)\n\n            return (.useCredential, URLCredential(trust: trust), nil)\n        } catch {\n            return (.cancelAuthenticationChallenge, nil, error.asAFError(or: .serverTrustEvaluationFailed(reason: .customEvaluationFailed(error: error))))\n        }\n    }\n    #endif\n\n    /// Evaluates the credential-based authentication `URLAuthenticationChallenge` received for `task`.\n    ///\n    /// - Parameters:\n    ///   - challenge: The `URLAuthenticationChallenge`.\n    ///   - task:      The `URLSessionTask` which received the challenge.\n    ///\n    /// - Returns:     The `ChallengeEvaluation`.\n    func attemptCredentialAuthentication(for challenge: URLAuthenticationChallenge,\n                                         belongingTo task: URLSessionTask) -> ChallengeEvaluation {\n        guard challenge.previousFailureCount == 0 else {\n            return (.rejectProtectionSpace, nil, nil)\n        }\n\n        guard let credential = stateProvider?.credential(for: task, in: challenge.protectionSpace) else {\n            return (.performDefaultHandling, nil, nil)\n        }\n\n        return (.useCredential, credential, nil)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         didSendBodyData bytesSent: Int64,\n                         totalBytesSent: Int64,\n                         totalBytesExpectedToSend: Int64) {\n        eventMonitor?.urlSession(session,\n                                 task: task,\n                                 didSendBodyData: bytesSent,\n                                 totalBytesSent: totalBytesSent,\n                                 totalBytesExpectedToSend: totalBytesExpectedToSend)\n\n        stateProvider?.request(for: task)?.updateUploadProgress(totalBytesSent: totalBytesSent,\n                                                                totalBytesExpectedToSend: totalBytesExpectedToSend)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) {\n        eventMonitor?.urlSession(session, taskNeedsNewBodyStream: task)\n\n        guard let request = request(for: task, as: UploadRequest.self) else {\n            assertionFailure(\"needNewBodyStream did not find UploadRequest.\")\n            completionHandler(nil)\n            return\n        }\n\n        completionHandler(request.inputStream())\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         willPerformHTTPRedirection response: HTTPURLResponse,\n                         newRequest request: URLRequest,\n                         completionHandler: @escaping (URLRequest?) -> Void) {\n        eventMonitor?.urlSession(session, task: task, willPerformHTTPRedirection: response, newRequest: request)\n\n        if let redirectHandler = stateProvider?.request(for: task)?.redirectHandler ?? stateProvider?.redirectHandler {\n            redirectHandler.task(task, willBeRedirectedTo: request, for: response, completion: completionHandler)\n        } else {\n            completionHandler(request)\n        }\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {\n        eventMonitor?.urlSession(session, task: task, didFinishCollecting: metrics)\n\n        stateProvider?.request(for: task)?.didGatherMetrics(metrics)\n\n        stateProvider?.didGatherMetricsForTask(task)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {\n        eventMonitor?.urlSession(session, task: task, didCompleteWithError: error)\n\n        let request = stateProvider?.request(for: task)\n\n        stateProvider?.didCompleteTask(task) {\n            request?.didCompleteTask(task, with: error.map { $0.asAFError(or: .sessionTaskFailed(error: $0)) })\n        }\n    }\n\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    open func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {\n        eventMonitor?.urlSession(session, taskIsWaitingForConnectivity: task)\n    }\n}\n\n// MARK: URLSessionDataDelegate\n\nextension SessionDelegate: URLSessionDataDelegate {\n    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {\n        eventMonitor?.urlSession(session, dataTask: dataTask, didReceive: data)\n\n        if let request = request(for: dataTask, as: DataRequest.self) {\n            request.didReceive(data: data)\n        } else if let request = request(for: dataTask, as: DataStreamRequest.self) {\n            request.didReceive(data: data)\n        } else {\n            assertionFailure(\"dataTask did not find DataRequest or DataStreamRequest in didReceive\")\n            return\n        }\n    }\n\n    open func urlSession(_ session: URLSession,\n                         dataTask: URLSessionDataTask,\n                         willCacheResponse proposedResponse: CachedURLResponse,\n                         completionHandler: @escaping (CachedURLResponse?) -> Void) {\n        eventMonitor?.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse)\n\n        if let handler = stateProvider?.request(for: dataTask)?.cachedResponseHandler ?? stateProvider?.cachedResponseHandler {\n            handler.dataTask(dataTask, willCacheResponse: proposedResponse, completion: completionHandler)\n        } else {\n            completionHandler(proposedResponse)\n        }\n    }\n}\n\n// MARK: URLSessionDownloadDelegate\n\nextension SessionDelegate: URLSessionDownloadDelegate {\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didResumeAtOffset fileOffset: Int64,\n                         expectedTotalBytes: Int64) {\n        eventMonitor?.urlSession(session,\n                                 downloadTask: downloadTask,\n                                 didResumeAtOffset: fileOffset,\n                                 expectedTotalBytes: expectedTotalBytes)\n        guard let downloadRequest = request(for: downloadTask, as: DownloadRequest.self) else {\n            assertionFailure(\"downloadTask did not find DownloadRequest.\")\n            return\n        }\n\n        downloadRequest.updateDownloadProgress(bytesWritten: fileOffset,\n                                               totalBytesExpectedToWrite: expectedTotalBytes)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didWriteData bytesWritten: Int64,\n                         totalBytesWritten: Int64,\n                         totalBytesExpectedToWrite: Int64) {\n        eventMonitor?.urlSession(session,\n                                 downloadTask: downloadTask,\n                                 didWriteData: bytesWritten,\n                                 totalBytesWritten: totalBytesWritten,\n                                 totalBytesExpectedToWrite: totalBytesExpectedToWrite)\n        guard let downloadRequest = request(for: downloadTask, as: DownloadRequest.self) else {\n            assertionFailure(\"downloadTask did not find DownloadRequest.\")\n            return\n        }\n\n        downloadRequest.updateDownloadProgress(bytesWritten: bytesWritten,\n                                               totalBytesExpectedToWrite: totalBytesExpectedToWrite)\n    }\n\n    open func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {\n        eventMonitor?.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location)\n\n        guard let request = request(for: downloadTask, as: DownloadRequest.self) else {\n            assertionFailure(\"downloadTask did not find DownloadRequest.\")\n            return\n        }\n\n        let (destination, options): (URL, DownloadRequest.Options)\n        if let response = request.response {\n            (destination, options) = request.destination(location, response)\n        } else {\n            // If there's no response this is likely a local file download, so generate the temporary URL directly.\n            (destination, options) = (DownloadRequest.defaultDestinationURL(location), [])\n        }\n\n        eventMonitor?.request(request, didCreateDestinationURL: destination)\n\n        do {\n            if options.contains(.removePreviousFile), fileManager.fileExists(atPath: destination.path) {\n                try fileManager.removeItem(at: destination)\n            }\n\n            if options.contains(.createIntermediateDirectories) {\n                let directory = destination.deletingLastPathComponent()\n                try fileManager.createDirectory(at: directory, withIntermediateDirectories: true)\n            }\n\n            try fileManager.moveItem(at: location, to: destination)\n\n            request.didFinishDownloading(using: downloadTask, with: .success(destination))\n        } catch {\n            request.didFinishDownloading(using: downloadTask, with: .failure(.downloadedFileMoveFailed(error: error,\n                                                                                                       source: location,\n                                                                                                       destination: destination)))\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/StringEncoding+Alamofire.swift",
    "content": "//\n//  StringEncoding+Alamofire.swift\n//\n//  Copyright (c) 2020 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension String.Encoding {\n    /// Creates an encoding from the IANA charset name.\n    ///\n    /// - Notes: These mappings match those [provided by CoreFoundation](https://opensource.apple.com/source/CF/CF-476.18/CFStringUtilities.c.auto.html)\n    ///\n    /// - Parameter name: IANA charset name.\n    init?(ianaCharsetName name: String) {\n        switch name.lowercased() {\n        case \"utf-8\":\n            self = .utf8\n        case \"iso-8859-1\":\n            self = .isoLatin1\n        case \"unicode-1-1\", \"iso-10646-ucs-2\", \"utf-16\":\n            self = .utf16\n        case \"utf-16be\":\n            self = .utf16BigEndian\n        case \"utf-16le\":\n            self = .utf16LittleEndian\n        case \"utf-32\":\n            self = .utf32\n        case \"utf-32be\":\n            self = .utf32BigEndian\n        case \"utf-32le\":\n            self = .utf32LittleEndian\n        default:\n            return nil\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift",
    "content": "//\n//  URLConvertible+URLRequestConvertible.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Types adopting the `URLConvertible` protocol can be used to construct `URL`s, which can then be used to construct\n/// `URLRequests`.\npublic protocol URLConvertible {\n    /// Returns a `URL` from the conforming instance or throws.\n    ///\n    /// - Returns: The `URL` created from the instance.\n    /// - Throws:  Any error thrown while creating the `URL`.\n    func asURL() throws -> URL\n}\n\nextension String: URLConvertible {\n    /// Returns a `URL` if `self` can be used to initialize a `URL` instance, otherwise throws.\n    ///\n    /// - Returns: The `URL` initialized with `self`.\n    /// - Throws:  An `AFError.invalidURL` instance.\n    public func asURL() throws -> URL {\n        guard let url = URL(string: self) else { throw AFError.invalidURL(url: self) }\n\n        return url\n    }\n}\n\nextension URL: URLConvertible {\n    /// Returns `self`.\n    public func asURL() throws -> URL { self }\n}\n\nextension URLComponents: URLConvertible {\n    /// Returns a `URL` if the `self`'s `url` is not nil, otherwise throws.\n    ///\n    /// - Returns: The `URL` from the `url` property.\n    /// - Throws:  An `AFError.invalidURL` instance.\n    public func asURL() throws -> URL {\n        guard let url = url else { throw AFError.invalidURL(url: self) }\n\n        return url\n    }\n}\n\n// MARK: -\n\n/// Types adopting the `URLRequestConvertible` protocol can be used to safely construct `URLRequest`s.\npublic protocol URLRequestConvertible {\n    /// Returns a `URLRequest` or throws if an `Error` was encountered.\n    ///\n    /// - Returns: A `URLRequest`.\n    /// - Throws:  Any error thrown while constructing the `URLRequest`.\n    func asURLRequest() throws -> URLRequest\n}\n\nextension URLRequestConvertible {\n    /// The `URLRequest` returned by discarding any `Error` encountered.\n    public var urlRequest: URLRequest? { try? asURLRequest() }\n}\n\nextension URLRequest: URLRequestConvertible {\n    /// Returns `self`.\n    public func asURLRequest() throws -> URLRequest { self }\n}\n\n// MARK: -\n\nextension URLRequest {\n    /// Creates an instance with the specified `url`, `method`, and `headers`.\n    ///\n    /// - Parameters:\n    ///   - url:     The `URLConvertible` value.\n    ///   - method:  The `HTTPMethod`.\n    ///   - headers: The `HTTPHeaders`, `nil` by default.\n    /// - Throws:    Any error thrown while converting the `URLConvertible` to a `URL`.\n    public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws {\n        let url = try url.asURL()\n\n        self.init(url: url)\n\n        httpMethod = method.rawValue\n        allHTTPHeaderFields = headers?.dictionary\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/URLEncodedFormEncoder.swift",
    "content": "//\n//  URLEncodedFormEncoder.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// An object that encodes instances into URL-encoded query strings.\n///\n/// There is no published specification for how to encode collection types. By default, the convention of appending\n/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for\n/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the\n/// square brackets appended to array keys.\n///\n/// `BoolEncoding` can be used to configure how `Bool` values are encoded. The default behavior is to encode\n/// `true` as 1 and `false` as 0.\n///\n/// `DateEncoding` can be used to configure how `Date` values are encoded. By default, the `.deferredToDate`\n/// strategy is used, which formats dates from their structure.\n///\n/// `SpaceEncoding` can be used to configure how spaces are encoded. Modern encodings use percent replacement (`%20`),\n/// while older encodings may expect spaces to be replaced with `+`.\n///\n/// This type is largely based on Vapor's [`url-encoded-form`](https://github.com/vapor/url-encoded-form) project.\npublic final class URLEncodedFormEncoder {\n    /// Encoding to use for `Array` values.\n    public enum ArrayEncoding {\n        /// An empty set of square brackets (\"[]\") are appended to the key for every value. This is the default encoding.\n        case brackets\n        /// No brackets are appended to the key and the key is encoded as is.\n        case noBrackets\n        /// Brackets containing the item index are appended. This matches the jQuery and Node.js behavior.\n        case indexInBrackets\n\n        /// Encodes the key according to the encoding.\n        ///\n        /// - Parameters:\n        ///     - key:      The `key` to encode.\n        ///     - index:   When this enum instance is `.indexInBrackets`, the `index` to encode.\n        ///\n        /// - Returns:          The encoded key.\n        func encode(_ key: String, atIndex index: Int) -> String {\n            switch self {\n            case .brackets: return \"\\(key)[]\"\n            case .noBrackets: return key\n            case .indexInBrackets: return \"\\(key)[\\(index)]\"\n            }\n        }\n    }\n\n    /// Encoding to use for `Bool` values.\n    public enum BoolEncoding {\n        /// Encodes `true` as `1`, `false` as `0`.\n        case numeric\n        /// Encodes `true` as \"true\", `false` as \"false\". This is the default encoding.\n        case literal\n\n        /// Encodes the given `Bool` as a `String`.\n        ///\n        /// - Parameter value: The `Bool` to encode.\n        ///\n        /// - Returns:         The encoded `String`.\n        func encode(_ value: Bool) -> String {\n            switch self {\n            case .numeric: return value ? \"1\" : \"0\"\n            case .literal: return value ? \"true\" : \"false\"\n            }\n        }\n    }\n\n    /// Encoding to use for `Data` values.\n    public enum DataEncoding {\n        /// Defers encoding to the `Data` type.\n        case deferredToData\n        /// Encodes `Data` as a Base64-encoded string. This is the default encoding.\n        case base64\n        /// Encode the `Data` as a custom value encoded by the given closure.\n        case custom((Data) throws -> String)\n\n        /// Encodes `Data` according to the encoding.\n        ///\n        /// - Parameter data: The `Data` to encode.\n        ///\n        /// - Returns:        The encoded `String`, or `nil` if the `Data` should be encoded according to its\n        ///                   `Encodable` implementation.\n        func encode(_ data: Data) throws -> String? {\n            switch self {\n            case .deferredToData: return nil\n            case .base64: return data.base64EncodedString()\n            case let .custom(encoding): return try encoding(data)\n            }\n        }\n    }\n\n    /// Encoding to use for `Date` values.\n    public enum DateEncoding {\n        /// ISO8601 and RFC3339 formatter.\n        private static let iso8601Formatter: ISO8601DateFormatter = {\n            let formatter = ISO8601DateFormatter()\n            formatter.formatOptions = .withInternetDateTime\n            return formatter\n        }()\n\n        /// Defers encoding to the `Date` type. This is the default encoding.\n        case deferredToDate\n        /// Encodes `Date`s as seconds since midnight UTC on January 1, 1970.\n        case secondsSince1970\n        /// Encodes `Date`s as milliseconds since midnight UTC on January 1, 1970.\n        case millisecondsSince1970\n        /// Encodes `Date`s according to the ISO8601 and RFC3339 standards.\n        case iso8601\n        /// Encodes `Date`s using the given `DateFormatter`.\n        case formatted(DateFormatter)\n        /// Encodes `Date`s using the given closure.\n        case custom((Date) throws -> String)\n\n        /// Encodes the date according to the encoding.\n        ///\n        /// - Parameter date: The `Date` to encode.\n        ///\n        /// - Returns:        The encoded `String`, or `nil` if the `Date` should be encoded according to its\n        ///                   `Encodable` implementation.\n        func encode(_ date: Date) throws -> String? {\n            switch self {\n            case .deferredToDate:\n                return nil\n            case .secondsSince1970:\n                return String(date.timeIntervalSince1970)\n            case .millisecondsSince1970:\n                return String(date.timeIntervalSince1970 * 1000.0)\n            case .iso8601:\n                return DateEncoding.iso8601Formatter.string(from: date)\n            case let .formatted(formatter):\n                return formatter.string(from: date)\n            case let .custom(closure):\n                return try closure(date)\n            }\n        }\n    }\n\n    /// Encoding to use for keys.\n    ///\n    /// This type is derived from [`JSONEncoder`'s `KeyEncodingStrategy`](https://github.com/apple/swift/blob/6aa313b8dd5f05135f7f878eccc1db6f9fbe34ff/stdlib/public/Darwin/Foundation/JSONEncoder.swift#L128)\n    /// and [`XMLEncoder`s `KeyEncodingStrategy`](https://github.com/MaxDesiatov/XMLCoder/blob/master/Sources/XMLCoder/Encoder/XMLEncoder.swift#L102).\n    public enum KeyEncoding {\n        /// Use the keys specified by each type. This is the default encoding.\n        case useDefaultKeys\n        /// Convert from \"camelCaseKeys\" to \"snake_case_keys\" before writing a key.\n        ///\n        /// Capital characters are determined by testing membership in\n        /// `CharacterSet.uppercaseLetters` and `CharacterSet.lowercaseLetters`\n        /// (Unicode General Categories Lu and Lt).\n        /// The conversion to lower case uses `Locale.system`, also known as\n        /// the ICU \"root\" locale. This means the result is consistent\n        /// regardless of the current user's locale and language preferences.\n        ///\n        /// Converting from camel case to snake case:\n        /// 1. Splits words at the boundary of lower-case to upper-case\n        /// 2. Inserts `_` between words\n        /// 3. Lowercases the entire string\n        /// 4. Preserves starting and ending `_`.\n        ///\n        /// For example, `oneTwoThree` becomes `one_two_three`. `_oneTwoThree_` becomes `_one_two_three_`.\n        ///\n        /// - Note: Using a key encoding strategy has a nominal performance cost, as each string key has to be converted.\n        case convertToSnakeCase\n        /// Same as convertToSnakeCase, but using `-` instead of `_`.\n        /// For example `oneTwoThree` becomes `one-two-three`.\n        case convertToKebabCase\n        /// Capitalize the first letter only.\n        /// For example `oneTwoThree` becomes  `OneTwoThree`.\n        case capitalized\n        /// Uppercase all letters.\n        /// For example `oneTwoThree` becomes  `ONETWOTHREE`.\n        case uppercased\n        /// Lowercase all letters.\n        /// For example `oneTwoThree` becomes  `onetwothree`.\n        case lowercased\n        /// A custom encoding using the provided closure.\n        case custom((String) -> String)\n\n        func encode(_ key: String) -> String {\n            switch self {\n            case .useDefaultKeys: return key\n            case .convertToSnakeCase: return convertToSnakeCase(key)\n            case .convertToKebabCase: return convertToKebabCase(key)\n            case .capitalized: return String(key.prefix(1).uppercased() + key.dropFirst())\n            case .uppercased: return key.uppercased()\n            case .lowercased: return key.lowercased()\n            case let .custom(encoding): return encoding(key)\n            }\n        }\n\n        private func convertToSnakeCase(_ key: String) -> String {\n            convert(key, usingSeparator: \"_\")\n        }\n\n        private func convertToKebabCase(_ key: String) -> String {\n            convert(key, usingSeparator: \"-\")\n        }\n\n        private func convert(_ key: String, usingSeparator separator: String) -> String {\n            guard !key.isEmpty else { return key }\n\n            var words: [Range<String.Index>] = []\n            // The general idea of this algorithm is to split words on\n            // transition from lower to upper case, then on transition of >1\n            // upper case characters to lowercase\n            //\n            // myProperty -> my_property\n            // myURLProperty -> my_url_property\n            //\n            // It is assumed, per Swift naming conventions, that the first character of the key is lowercase.\n            var wordStart = key.startIndex\n            var searchRange = key.index(after: wordStart)..<key.endIndex\n\n            // Find next uppercase character\n            while let upperCaseRange = key.rangeOfCharacter(from: CharacterSet.uppercaseLetters, options: [], range: searchRange) {\n                let untilUpperCase = wordStart..<upperCaseRange.lowerBound\n                words.append(untilUpperCase)\n\n                // Find next lowercase character\n                searchRange = upperCaseRange.lowerBound..<searchRange.upperBound\n                guard let lowerCaseRange = key.rangeOfCharacter(from: CharacterSet.lowercaseLetters, options: [], range: searchRange) else {\n                    // There are no more lower case letters. Just end here.\n                    wordStart = searchRange.lowerBound\n                    break\n                }\n\n                // Is the next lowercase letter more than 1 after the uppercase?\n                // If so, we encountered a group of uppercase letters that we\n                // should treat as its own word\n                let nextCharacterAfterCapital = key.index(after: upperCaseRange.lowerBound)\n                if lowerCaseRange.lowerBound == nextCharacterAfterCapital {\n                    // The next character after capital is a lower case character and therefore not a word boundary.\n                    // Continue searching for the next upper case for the boundary.\n                    wordStart = upperCaseRange.lowerBound\n                } else {\n                    // There was a range of >1 capital letters. Turn those into a word, stopping at the capital before the lower case character.\n                    let beforeLowerIndex = key.index(before: lowerCaseRange.lowerBound)\n                    words.append(upperCaseRange.lowerBound..<beforeLowerIndex)\n\n                    // Next word starts at the capital before the lowercase we just found\n                    wordStart = beforeLowerIndex\n                }\n                searchRange = lowerCaseRange.upperBound..<searchRange.upperBound\n            }\n            words.append(wordStart..<searchRange.upperBound)\n            let result = words.map { range in\n                key[range].lowercased()\n            }.joined(separator: separator)\n\n            return result\n        }\n    }\n\n    /// Encoding to use for spaces.\n    public enum SpaceEncoding {\n        /// Encodes spaces according to normal percent escaping rules (%20).\n        case percentEscaped\n        /// Encodes spaces as `+`,\n        case plusReplaced\n\n        /// Encodes the string according to the encoding.\n        ///\n        /// - Parameter string: The `String` to encode.\n        ///\n        /// - Returns:          The encoded `String`.\n        func encode(_ string: String) -> String {\n            switch self {\n            case .percentEscaped: return string.replacingOccurrences(of: \" \", with: \"%20\")\n            case .plusReplaced: return string.replacingOccurrences(of: \" \", with: \"+\")\n            }\n        }\n    }\n\n    /// `URLEncodedFormEncoder` error.\n    public enum Error: Swift.Error {\n        /// An invalid root object was created by the encoder. Only keyed values are valid.\n        case invalidRootObject(String)\n\n        var localizedDescription: String {\n            switch self {\n            case let .invalidRootObject(object):\n                return \"URLEncodedFormEncoder requires keyed root object. Received \\(object) instead.\"\n            }\n        }\n    }\n\n    /// Whether or not to sort the encoded key value pairs.\n    ///\n    /// - Note: This setting ensures a consistent ordering for all encodings of the same parameters. When set to `false`,\n    ///         encoded `Dictionary` values may have a different encoded order each time they're encoded due to\n    ///       ` Dictionary`'s random storage order, but `Encodable` types will maintain their encoded order.\n    public let alphabetizeKeyValuePairs: Bool\n    /// The `ArrayEncoding` to use.\n    public let arrayEncoding: ArrayEncoding\n    /// The `BoolEncoding` to use.\n    public let boolEncoding: BoolEncoding\n    /// THe `DataEncoding` to use.\n    public let dataEncoding: DataEncoding\n    /// The `DateEncoding` to use.\n    public let dateEncoding: DateEncoding\n    /// The `KeyEncoding` to use.\n    public let keyEncoding: KeyEncoding\n    /// The `SpaceEncoding` to use.\n    public let spaceEncoding: SpaceEncoding\n    /// The `CharacterSet` of allowed (non-escaped) characters.\n    public var allowedCharacters: CharacterSet\n\n    /// Creates an instance from the supplied parameters.\n    ///\n    /// - Parameters:\n    ///   - alphabetizeKeyValuePairs: Whether or not to sort the encoded key value pairs. `true` by default.\n    ///   - arrayEncoding:            The `ArrayEncoding` to use. `.brackets` by default.\n    ///   - boolEncoding:             The `BoolEncoding` to use. `.numeric` by default.\n    ///   - dataEncoding:             The `DataEncoding` to use. `.base64` by default.\n    ///   - dateEncoding:             The `DateEncoding` to use. `.deferredToDate` by default.\n    ///   - keyEncoding:              The `KeyEncoding` to use. `.useDefaultKeys` by default.\n    ///   - spaceEncoding:            The `SpaceEncoding` to use. `.percentEscaped` by default.\n    ///   - allowedCharacters:        The `CharacterSet` of allowed (non-escaped) characters. `.afURLQueryAllowed` by\n    ///                               default.\n    public init(alphabetizeKeyValuePairs: Bool = true,\n                arrayEncoding: ArrayEncoding = .brackets,\n                boolEncoding: BoolEncoding = .numeric,\n                dataEncoding: DataEncoding = .base64,\n                dateEncoding: DateEncoding = .deferredToDate,\n                keyEncoding: KeyEncoding = .useDefaultKeys,\n                spaceEncoding: SpaceEncoding = .percentEscaped,\n                allowedCharacters: CharacterSet = .afURLQueryAllowed) {\n        self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs\n        self.arrayEncoding = arrayEncoding\n        self.boolEncoding = boolEncoding\n        self.dataEncoding = dataEncoding\n        self.dateEncoding = dateEncoding\n        self.keyEncoding = keyEncoding\n        self.spaceEncoding = spaceEncoding\n        self.allowedCharacters = allowedCharacters\n    }\n\n    func encode(_ value: Encodable) throws -> URLEncodedFormComponent {\n        let context = URLEncodedFormContext(.object([]))\n        let encoder = _URLEncodedFormEncoder(context: context,\n                                             boolEncoding: boolEncoding,\n                                             dataEncoding: dataEncoding,\n                                             dateEncoding: dateEncoding)\n        try value.encode(to: encoder)\n\n        return context.component\n    }\n\n    /// Encodes the `value` as a URL form encoded `String`.\n    ///\n    /// - Parameter value: The `Encodable` value.`\n    ///\n    /// - Returns:         The encoded `String`.\n    /// - Throws:          An `Error` or `EncodingError` instance if encoding fails.\n    public func encode(_ value: Encodable) throws -> String {\n        let component: URLEncodedFormComponent = try encode(value)\n\n        guard case let .object(object) = component else {\n            throw Error.invalidRootObject(\"\\(component)\")\n        }\n\n        let serializer = URLEncodedFormSerializer(alphabetizeKeyValuePairs: alphabetizeKeyValuePairs,\n                                                  arrayEncoding: arrayEncoding,\n                                                  keyEncoding: keyEncoding,\n                                                  spaceEncoding: spaceEncoding,\n                                                  allowedCharacters: allowedCharacters)\n        let query = serializer.serialize(object)\n\n        return query\n    }\n\n    /// Encodes the value as `Data`. This is performed by first creating an encoded `String` and then returning the\n    /// `.utf8` data.\n    ///\n    /// - Parameter value: The `Encodable` value.\n    ///\n    /// - Returns:         The encoded `Data`.\n    ///\n    /// - Throws:          An `Error` or `EncodingError` instance if encoding fails.\n    public func encode(_ value: Encodable) throws -> Data {\n        let string: String = try encode(value)\n\n        return Data(string.utf8)\n    }\n}\n\nfinal class _URLEncodedFormEncoder {\n    var codingPath: [CodingKey]\n    // Returns an empty dictionary, as this encoder doesn't support userInfo.\n    var userInfo: [CodingUserInfoKey: Any] { [:] }\n\n    let context: URLEncodedFormContext\n\n    private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n    private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n    private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n    init(context: URLEncodedFormContext,\n         codingPath: [CodingKey] = [],\n         boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n         dataEncoding: URLEncodedFormEncoder.DataEncoding,\n         dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n        self.context = context\n        self.codingPath = codingPath\n        self.boolEncoding = boolEncoding\n        self.dataEncoding = dataEncoding\n        self.dateEncoding = dateEncoding\n    }\n}\n\nextension _URLEncodedFormEncoder: Encoder {\n    func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key: CodingKey {\n        let container = _URLEncodedFormEncoder.KeyedContainer<Key>(context: context,\n                                                                   codingPath: codingPath,\n                                                                   boolEncoding: boolEncoding,\n                                                                   dataEncoding: dataEncoding,\n                                                                   dateEncoding: dateEncoding)\n        return KeyedEncodingContainer(container)\n    }\n\n    func unkeyedContainer() -> UnkeyedEncodingContainer {\n        _URLEncodedFormEncoder.UnkeyedContainer(context: context,\n                                                codingPath: codingPath,\n                                                boolEncoding: boolEncoding,\n                                                dataEncoding: dataEncoding,\n                                                dateEncoding: dateEncoding)\n    }\n\n    func singleValueContainer() -> SingleValueEncodingContainer {\n        _URLEncodedFormEncoder.SingleValueContainer(context: context,\n                                                    codingPath: codingPath,\n                                                    boolEncoding: boolEncoding,\n                                                    dataEncoding: dataEncoding,\n                                                    dateEncoding: dateEncoding)\n    }\n}\n\nfinal class URLEncodedFormContext {\n    var component: URLEncodedFormComponent\n\n    init(_ component: URLEncodedFormComponent) {\n        self.component = component\n    }\n}\n\nenum URLEncodedFormComponent {\n    typealias Object = [(key: String, value: URLEncodedFormComponent)]\n\n    case string(String)\n    case array([URLEncodedFormComponent])\n    case object(Object)\n\n    /// Converts self to an `[URLEncodedFormData]` or returns `nil` if not convertible.\n    var array: [URLEncodedFormComponent]? {\n        switch self {\n        case let .array(array): return array\n        default: return nil\n        }\n    }\n\n    /// Converts self to an `Object` or returns `nil` if not convertible.\n    var object: Object? {\n        switch self {\n        case let .object(object): return object\n        default: return nil\n        }\n    }\n\n    /// Sets self to the supplied value at a given path.\n    ///\n    ///     data.set(to: \"hello\", at: [\"path\", \"to\", \"value\"])\n    ///\n    /// - parameters:\n    ///     - value: Value of `Self` to set at the supplied path.\n    ///     - path: `CodingKey` path to update with the supplied value.\n    public mutating func set(to value: URLEncodedFormComponent, at path: [CodingKey]) {\n        set(&self, to: value, at: path)\n    }\n\n    /// Recursive backing method to `set(to:at:)`.\n    private func set(_ context: inout URLEncodedFormComponent, to value: URLEncodedFormComponent, at path: [CodingKey]) {\n        guard !path.isEmpty else {\n            context = value\n            return\n        }\n\n        let end = path[0]\n        var child: URLEncodedFormComponent\n        switch path.count {\n        case 1:\n            child = value\n        case 2...:\n            if let index = end.intValue {\n                let array = context.array ?? []\n                if array.count > index {\n                    child = array[index]\n                } else {\n                    child = .array([])\n                }\n                set(&child, to: value, at: Array(path[1...]))\n            } else {\n                child = context.object?.first { $0.key == end.stringValue }?.value ?? .object(.init())\n                set(&child, to: value, at: Array(path[1...]))\n            }\n        default: fatalError(\"Unreachable\")\n        }\n\n        if let index = end.intValue {\n            if var array = context.array {\n                if array.count > index {\n                    array[index] = child\n                } else {\n                    array.append(child)\n                }\n                context = .array(array)\n            } else {\n                context = .array([child])\n            }\n        } else {\n            if var object = context.object {\n                if let index = object.firstIndex(where: { $0.key == end.stringValue }) {\n                    object[index] = (key: end.stringValue, value: child)\n                } else {\n                    object.append((key: end.stringValue, value: child))\n                }\n                context = .object(object)\n            } else {\n                context = .object([(key: end.stringValue, value: child)])\n            }\n        }\n    }\n}\n\nstruct AnyCodingKey: CodingKey, Hashable {\n    let stringValue: String\n    let intValue: Int?\n\n    init?(stringValue: String) {\n        self.stringValue = stringValue\n        intValue = nil\n    }\n\n    init?(intValue: Int) {\n        stringValue = \"\\(intValue)\"\n        self.intValue = intValue\n    }\n\n    init<Key>(_ base: Key) where Key: CodingKey {\n        if let intValue = base.intValue {\n            self.init(intValue: intValue)!\n        } else {\n            self.init(stringValue: base.stringValue)!\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder {\n    final class KeyedContainer<Key> where Key: CodingKey {\n        var codingPath: [CodingKey]\n\n        private let context: URLEncodedFormContext\n        private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n        private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n        private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n        init(context: URLEncodedFormContext,\n             codingPath: [CodingKey],\n             boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n             dataEncoding: URLEncodedFormEncoder.DataEncoding,\n             dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n            self.context = context\n            self.codingPath = codingPath\n            self.boolEncoding = boolEncoding\n            self.dataEncoding = dataEncoding\n            self.dateEncoding = dateEncoding\n        }\n\n        private func nestedCodingPath(for key: CodingKey) -> [CodingKey] {\n            codingPath + [key]\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder.KeyedContainer: KeyedEncodingContainerProtocol {\n    func encodeNil(forKey key: Key) throws {\n        let context = EncodingError.Context(codingPath: codingPath,\n                                            debugDescription: \"URLEncodedFormEncoder cannot encode nil values.\")\n        throw EncodingError.invalidValue(\"\\(key): nil\", context)\n    }\n\n    func encode<T>(_ value: T, forKey key: Key) throws where T: Encodable {\n        var container = nestedSingleValueEncoder(for: key)\n        try container.encode(value)\n    }\n\n    func nestedSingleValueEncoder(for key: Key) -> SingleValueEncodingContainer {\n        let container = _URLEncodedFormEncoder.SingleValueContainer(context: context,\n                                                                    codingPath: nestedCodingPath(for: key),\n                                                                    boolEncoding: boolEncoding,\n                                                                    dataEncoding: dataEncoding,\n                                                                    dateEncoding: dateEncoding)\n\n        return container\n    }\n\n    func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer {\n        let container = _URLEncodedFormEncoder.UnkeyedContainer(context: context,\n                                                                codingPath: nestedCodingPath(for: key),\n                                                                boolEncoding: boolEncoding,\n                                                                dataEncoding: dataEncoding,\n                                                                dateEncoding: dateEncoding)\n\n        return container\n    }\n\n    func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {\n        let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,\n                                                                         codingPath: nestedCodingPath(for: key),\n                                                                         boolEncoding: boolEncoding,\n                                                                         dataEncoding: dataEncoding,\n                                                                         dateEncoding: dateEncoding)\n\n        return KeyedEncodingContainer(container)\n    }\n\n    func superEncoder() -> Encoder {\n        _URLEncodedFormEncoder(context: context,\n                               codingPath: codingPath,\n                               boolEncoding: boolEncoding,\n                               dataEncoding: dataEncoding,\n                               dateEncoding: dateEncoding)\n    }\n\n    func superEncoder(forKey key: Key) -> Encoder {\n        _URLEncodedFormEncoder(context: context,\n                               codingPath: nestedCodingPath(for: key),\n                               boolEncoding: boolEncoding,\n                               dataEncoding: dataEncoding,\n                               dateEncoding: dateEncoding)\n    }\n}\n\nextension _URLEncodedFormEncoder {\n    final class SingleValueContainer {\n        var codingPath: [CodingKey]\n\n        private var canEncodeNewValue = true\n\n        private let context: URLEncodedFormContext\n        private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n        private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n        private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n        init(context: URLEncodedFormContext,\n             codingPath: [CodingKey],\n             boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n             dataEncoding: URLEncodedFormEncoder.DataEncoding,\n             dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n            self.context = context\n            self.codingPath = codingPath\n            self.boolEncoding = boolEncoding\n            self.dataEncoding = dataEncoding\n            self.dateEncoding = dateEncoding\n        }\n\n        private func checkCanEncode(value: Any?) throws {\n            guard canEncodeNewValue else {\n                let context = EncodingError.Context(codingPath: codingPath,\n                                                    debugDescription: \"Attempt to encode value through single value container when previously value already encoded.\")\n                throw EncodingError.invalidValue(value as Any, context)\n            }\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder.SingleValueContainer: SingleValueEncodingContainer {\n    func encodeNil() throws {\n        try checkCanEncode(value: nil)\n        defer { canEncodeNewValue = false }\n\n        let context = EncodingError.Context(codingPath: codingPath,\n                                            debugDescription: \"URLEncodedFormEncoder cannot encode nil values.\")\n        throw EncodingError.invalidValue(\"nil\", context)\n    }\n\n    func encode(_ value: Bool) throws {\n        try encode(value, as: String(boolEncoding.encode(value)))\n    }\n\n    func encode(_ value: String) throws {\n        try encode(value, as: value)\n    }\n\n    func encode(_ value: Double) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Float) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int8) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int16) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int32) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int64) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt8) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt16) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt32) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt64) throws {\n        try encode(value, as: String(value))\n    }\n\n    private func encode<T>(_ value: T, as string: String) throws where T: Encodable {\n        try checkCanEncode(value: value)\n        defer { canEncodeNewValue = false }\n\n        context.component.set(to: .string(string), at: codingPath)\n    }\n\n    func encode<T>(_ value: T) throws where T: Encodable {\n        switch value {\n        case let date as Date:\n            guard let string = try dateEncoding.encode(date) else {\n                try attemptToEncode(value)\n                return\n            }\n\n            try encode(value, as: string)\n        case let data as Data:\n            guard let string = try dataEncoding.encode(data) else {\n                try attemptToEncode(value)\n                return\n            }\n\n            try encode(value, as: string)\n        case let decimal as Decimal:\n            // Decimal's `Encodable` implementation returns an object, not a single value, so override it.\n            try encode(value, as: String(describing: decimal))\n        default:\n            try attemptToEncode(value)\n        }\n    }\n\n    private func attemptToEncode<T>(_ value: T) throws where T: Encodable {\n        try checkCanEncode(value: value)\n        defer { canEncodeNewValue = false }\n\n        let encoder = _URLEncodedFormEncoder(context: context,\n                                             codingPath: codingPath,\n                                             boolEncoding: boolEncoding,\n                                             dataEncoding: dataEncoding,\n                                             dateEncoding: dateEncoding)\n        try value.encode(to: encoder)\n    }\n}\n\nextension _URLEncodedFormEncoder {\n    final class UnkeyedContainer {\n        var codingPath: [CodingKey]\n\n        var count = 0\n        var nestedCodingPath: [CodingKey] {\n            codingPath + [AnyCodingKey(intValue: count)!]\n        }\n\n        private let context: URLEncodedFormContext\n        private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n        private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n        private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n        init(context: URLEncodedFormContext,\n             codingPath: [CodingKey],\n             boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n             dataEncoding: URLEncodedFormEncoder.DataEncoding,\n             dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n            self.context = context\n            self.codingPath = codingPath\n            self.boolEncoding = boolEncoding\n            self.dataEncoding = dataEncoding\n            self.dateEncoding = dateEncoding\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder.UnkeyedContainer: UnkeyedEncodingContainer {\n    func encodeNil() throws {\n        let context = EncodingError.Context(codingPath: codingPath,\n                                            debugDescription: \"URLEncodedFormEncoder cannot encode nil values.\")\n        throw EncodingError.invalidValue(\"nil\", context)\n    }\n\n    func encode<T>(_ value: T) throws where T: Encodable {\n        var container = nestedSingleValueContainer()\n        try container.encode(value)\n    }\n\n    func nestedSingleValueContainer() -> SingleValueEncodingContainer {\n        defer { count += 1 }\n\n        return _URLEncodedFormEncoder.SingleValueContainer(context: context,\n                                                           codingPath: nestedCodingPath,\n                                                           boolEncoding: boolEncoding,\n                                                           dataEncoding: dataEncoding,\n                                                           dateEncoding: dateEncoding)\n    }\n\n    func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {\n        defer { count += 1 }\n        let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,\n                                                                         codingPath: nestedCodingPath,\n                                                                         boolEncoding: boolEncoding,\n                                                                         dataEncoding: dataEncoding,\n                                                                         dateEncoding: dateEncoding)\n\n        return KeyedEncodingContainer(container)\n    }\n\n    func nestedUnkeyedContainer() -> UnkeyedEncodingContainer {\n        defer { count += 1 }\n\n        return _URLEncodedFormEncoder.UnkeyedContainer(context: context,\n                                                       codingPath: nestedCodingPath,\n                                                       boolEncoding: boolEncoding,\n                                                       dataEncoding: dataEncoding,\n                                                       dateEncoding: dateEncoding)\n    }\n\n    func superEncoder() -> Encoder {\n        defer { count += 1 }\n\n        return _URLEncodedFormEncoder(context: context,\n                                      codingPath: codingPath,\n                                      boolEncoding: boolEncoding,\n                                      dataEncoding: dataEncoding,\n                                      dateEncoding: dateEncoding)\n    }\n}\n\nfinal class URLEncodedFormSerializer {\n    private let alphabetizeKeyValuePairs: Bool\n    private let arrayEncoding: URLEncodedFormEncoder.ArrayEncoding\n    private let keyEncoding: URLEncodedFormEncoder.KeyEncoding\n    private let spaceEncoding: URLEncodedFormEncoder.SpaceEncoding\n    private let allowedCharacters: CharacterSet\n\n    init(alphabetizeKeyValuePairs: Bool,\n         arrayEncoding: URLEncodedFormEncoder.ArrayEncoding,\n         keyEncoding: URLEncodedFormEncoder.KeyEncoding,\n         spaceEncoding: URLEncodedFormEncoder.SpaceEncoding,\n         allowedCharacters: CharacterSet) {\n        self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs\n        self.arrayEncoding = arrayEncoding\n        self.keyEncoding = keyEncoding\n        self.spaceEncoding = spaceEncoding\n        self.allowedCharacters = allowedCharacters\n    }\n\n    func serialize(_ object: URLEncodedFormComponent.Object) -> String {\n        var output: [String] = []\n        for (key, component) in object {\n            let value = serialize(component, forKey: key)\n            output.append(value)\n        }\n        output = alphabetizeKeyValuePairs ? output.sorted() : output\n\n        return output.joinedWithAmpersands()\n    }\n\n    func serialize(_ component: URLEncodedFormComponent, forKey key: String) -> String {\n        switch component {\n        case let .string(string): return \"\\(escape(keyEncoding.encode(key)))=\\(escape(string))\"\n        case let .array(array): return serialize(array, forKey: key)\n        case let .object(object): return serialize(object, forKey: key)\n        }\n    }\n\n    func serialize(_ object: URLEncodedFormComponent.Object, forKey key: String) -> String {\n        var segments: [String] = object.map { subKey, value in\n            let keyPath = \"[\\(subKey)]\"\n            return serialize(value, forKey: key + keyPath)\n        }\n        segments = alphabetizeKeyValuePairs ? segments.sorted() : segments\n\n        return segments.joinedWithAmpersands()\n    }\n\n    func serialize(_ array: [URLEncodedFormComponent], forKey key: String) -> String {\n        var segments: [String] = array.enumerated().map { index, component in\n            let keyPath = arrayEncoding.encode(key, atIndex: index)\n            return serialize(component, forKey: keyPath)\n        }\n        segments = alphabetizeKeyValuePairs ? segments.sorted() : segments\n\n        return segments.joinedWithAmpersands()\n    }\n\n    func escape(_ query: String) -> String {\n        var allowedCharactersWithSpace = allowedCharacters\n        allowedCharactersWithSpace.insert(charactersIn: \" \")\n        let escapedQuery = query.addingPercentEncoding(withAllowedCharacters: allowedCharactersWithSpace) ?? query\n        let spaceEncodedQuery = spaceEncoding.encode(escapedQuery)\n\n        return spaceEncodedQuery\n    }\n}\n\nextension Array where Element == String {\n    func joinedWithAmpersands() -> String {\n        joined(separator: \"&\")\n    }\n}\n\nextension CharacterSet {\n    /// Creates a CharacterSet from RFC 3986 allowed characters.\n    ///\n    /// RFC 3986 states that the following characters are \"reserved\" characters.\n    ///\n    /// - General Delimiters: \":\", \"#\", \"[\", \"]\", \"@\", \"?\", \"/\"\n    /// - Sub-Delimiters: \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"\n    ///\n    /// In RFC 3986 - Section 3.4, it states that the \"?\" and \"/\" characters should not be escaped to allow\n    /// query strings to include a URL. Therefore, all \"reserved\" characters with the exception of \"?\" and \"/\"\n    /// should be percent-escaped in the query string.\n    public static let afURLQueryAllowed: CharacterSet = {\n        let generalDelimitersToEncode = \":#[]@\" // does not include \"?\" or \"/\" due to RFC 3986 - Section 3.4\n        let subDelimitersToEncode = \"!$&'()*+,;=\"\n        let encodableDelimiters = CharacterSet(charactersIn: \"\\(generalDelimitersToEncode)\\(subDelimitersToEncode)\")\n\n        return CharacterSet.urlQueryAllowed.subtracting(encodableDelimiters)\n    }()\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/URLRequest+Alamofire.swift",
    "content": "//\n//  URLRequest+Alamofire.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension URLRequest {\n    /// Returns the `httpMethod` as Alamofire's `HTTPMethod` type.\n    public var method: HTTPMethod? {\n        get { httpMethod.flatMap(HTTPMethod.init) }\n        set { httpMethod = newValue?.rawValue }\n    }\n\n    public func validate() throws {\n        if method == .get, let bodyData = httpBody {\n            throw AFError.urlRequestValidationFailed(reason: .bodyDataInGETRequest(bodyData))\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift",
    "content": "//\n//  URLSessionConfiguration+Alamofire.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension URLSessionConfiguration: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType: URLSessionConfiguration {\n    /// Alamofire's default configuration. Same as `URLSessionConfiguration.default` but adds Alamofire default\n    /// `Accept-Language`, `Accept-Encoding`, and `User-Agent` headers.\n    public static var `default`: URLSessionConfiguration {\n        let configuration = URLSessionConfiguration.default\n        configuration.headers = .default\n\n        return configuration\n    }\n\n    /// `.ephemeral` configuration with Alamofire's default `Accept-Language`, `Accept-Encoding`, and `User-Agent`\n    /// headers.\n    public static var ephemeral: URLSessionConfiguration {\n        let configuration = URLSessionConfiguration.ephemeral\n        configuration.headers = .default\n\n        return configuration\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire/Source/Validation.swift",
    "content": "//\n//  Validation.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension Request {\n    // MARK: Helper Types\n\n    fileprivate typealias ErrorReason = AFError.ResponseValidationFailureReason\n\n    /// Used to represent whether a validation succeeded or failed.\n    public typealias ValidationResult = Result<Void, Error>\n\n    fileprivate struct MIMEType {\n        let type: String\n        let subtype: String\n\n        var isWildcard: Bool { type == \"*\" && subtype == \"*\" }\n\n        init?(_ string: String) {\n            let components: [String] = {\n                let stripped = string.trimmingCharacters(in: .whitespacesAndNewlines)\n                let split = stripped[..<(stripped.range(of: \";\")?.lowerBound ?? stripped.endIndex)]\n\n                return split.components(separatedBy: \"/\")\n            }()\n\n            if let type = components.first, let subtype = components.last {\n                self.type = type\n                self.subtype = subtype\n            } else {\n                return nil\n            }\n        }\n\n        func matches(_ mime: MIMEType) -> Bool {\n            switch (type, subtype) {\n            case (mime.type, mime.subtype), (mime.type, \"*\"), (\"*\", mime.subtype), (\"*\", \"*\"):\n                return true\n            default:\n                return false\n            }\n        }\n    }\n\n    // MARK: Properties\n\n    fileprivate var acceptableStatusCodes: Range<Int> { 200..<300 }\n\n    fileprivate var acceptableContentTypes: [String] {\n        if let accept = request?.value(forHTTPHeaderField: \"Accept\") {\n            return accept.components(separatedBy: \",\")\n        }\n\n        return [\"*/*\"]\n    }\n\n    // MARK: Status Code\n\n    fileprivate func validate<S: Sequence>(statusCode acceptableStatusCodes: S,\n                                           response: HTTPURLResponse)\n        -> ValidationResult\n        where S.Iterator.Element == Int {\n        if acceptableStatusCodes.contains(response.statusCode) {\n            return .success(())\n        } else {\n            let reason: ErrorReason = .unacceptableStatusCode(code: response.statusCode)\n            return .failure(AFError.responseValidationFailed(reason: reason))\n        }\n    }\n\n    // MARK: Content Type\n\n    fileprivate func validate<S: Sequence>(contentType acceptableContentTypes: S,\n                                           response: HTTPURLResponse,\n                                           data: Data?)\n        -> ValidationResult\n        where S.Iterator.Element == String {\n        guard let data = data, !data.isEmpty else { return .success(()) }\n\n        return validate(contentType: acceptableContentTypes, response: response)\n    }\n\n    fileprivate func validate<S: Sequence>(contentType acceptableContentTypes: S,\n                                           response: HTTPURLResponse)\n        -> ValidationResult\n        where S.Iterator.Element == String {\n        guard\n            let responseContentType = response.mimeType,\n            let responseMIMEType = MIMEType(responseContentType)\n        else {\n            for contentType in acceptableContentTypes {\n                if let mimeType = MIMEType(contentType), mimeType.isWildcard {\n                    return .success(())\n                }\n            }\n\n            let error: AFError = {\n                let reason: ErrorReason = .missingContentType(acceptableContentTypes: acceptableContentTypes.sorted())\n                return AFError.responseValidationFailed(reason: reason)\n            }()\n\n            return .failure(error)\n        }\n\n        for contentType in acceptableContentTypes {\n            if let acceptableMIMEType = MIMEType(contentType), acceptableMIMEType.matches(responseMIMEType) {\n                return .success(())\n            }\n        }\n\n        let error: AFError = {\n            let reason: ErrorReason = .unacceptableContentType(acceptableContentTypes: acceptableContentTypes.sorted(),\n                                                               responseContentType: responseContentType)\n\n            return AFError.responseValidationFailed(reason: reason)\n        }()\n\n        return .failure(error)\n    }\n}\n\n// MARK: -\n\nextension DataRequest {\n    /// A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the\n    /// request was valid.\n    public typealias Validation = (URLRequest?, HTTPURLResponse, Data?) -> ValidationResult\n\n    /// Validates that the response has a status code in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Parameter acceptableStatusCodes: `Sequence` of acceptable response status codes.\n    ///\n    /// - Returns:                         The instance.\n    @discardableResult\n    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {\n        validate { [unowned self] _, response, _ in\n            self.validate(statusCode: acceptableStatusCodes, response: response)\n        }\n    }\n\n    /// Validates that the response has a content type in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {\n        validate { [unowned self] _, response, data in\n            self.validate(contentType: acceptableContentTypes(), response: response, data: data)\n        }\n    }\n\n    /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content\n    /// type matches any specified in the Accept HTTP header field.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate() -> Self {\n        let contentTypes: () -> [String] = { [unowned self] in\n            self.acceptableContentTypes\n        }\n        return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes())\n    }\n}\n\nextension DataStreamRequest {\n    /// A closure used to validate a request that takes a `URLRequest` and `HTTPURLResponse` and returns whether the\n    /// request was valid.\n    public typealias Validation = (_ request: URLRequest?, _ response: HTTPURLResponse) -> ValidationResult\n\n    /// Validates that the response has a status code in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Parameter acceptableStatusCodes: `Sequence` of acceptable response status codes.\n    ///\n    /// - Returns:                         The instance.\n    @discardableResult\n    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {\n        validate { [unowned self] _, response in\n            self.validate(statusCode: acceptableStatusCodes, response: response)\n        }\n    }\n\n    /// Validates that the response has a content type in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {\n        validate { [unowned self] _, response in\n            self.validate(contentType: acceptableContentTypes(), response: response)\n        }\n    }\n\n    /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content\n    /// type matches any specified in the Accept HTTP header field.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func validate() -> Self {\n        let contentTypes: () -> [String] = { [unowned self] in\n            self.acceptableContentTypes\n        }\n        return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes())\n    }\n}\n\n// MARK: -\n\nextension DownloadRequest {\n    /// A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a\n    /// destination URL, and returns whether the request was valid.\n    public typealias Validation = (_ request: URLRequest?,\n                                   _ response: HTTPURLResponse,\n                                   _ fileURL: URL?)\n        -> ValidationResult\n\n    /// Validates that the response has a status code in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Parameter acceptableStatusCodes: `Sequence` of acceptable response status codes.\n    ///\n    /// - Returns:                         The instance.\n    @discardableResult\n    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {\n        validate { [unowned self] _, response, _ in\n            self.validate(statusCode: acceptableStatusCodes, response: response)\n        }\n    }\n\n    /// Validates that the response has a content type in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {\n        validate { [unowned self] _, response, fileURL in\n            guard let validFileURL = fileURL else {\n                return .failure(AFError.responseValidationFailed(reason: .dataFileNil))\n            }\n\n            do {\n                let data = try Data(contentsOf: validFileURL)\n                return self.validate(contentType: acceptableContentTypes(), response: response, data: data)\n            } catch {\n                return .failure(AFError.responseValidationFailed(reason: .dataFileReadFailed(at: validFileURL)))\n            }\n        }\n    }\n\n    /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content\n    /// type matches any specified in the Accept HTTP header field.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate() -> Self {\n        let contentTypes = { [unowned self] in\n            self.acceptableContentTypes\n        }\n        return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes())\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Alamofire.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t0A2051EA0914A2749DA2F7861A9CDD88 /* ParameterEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC2EA49A1B0E0517D5615D945A1D2F73 /* ParameterEncoder.swift */; };\n\t\t1DCDE46D0E94332E4C186BFFDD3BEEF5 /* AlamofireExtended.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F3A8D6988BE763B29FD1CED8B0F0E8 /* AlamofireExtended.swift */; };\n\t\t254F24FBBEF34222F55E8D0D1A529F49 /* Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 851203AC13D57B60943A3D829ABC69FD /* Combine.swift */; };\n\t\t2A14B156801E9B6CA78E0315974075F2 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C4053832FEFD0F8B9CEDBB748646216 /* Notifications.swift */; };\n\t\t2DD69493543E21B33A15F68825B0128A /* NetworkReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71047F59C36C60ED4DAD9F8531193F48 /* NetworkReachabilityManager.swift */; };\n\t\t32E0F47AED3C9C20B71A0B74AE2729E7 /* CachedResponseHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FBE7B560B5D1A1C1F6994ACB3908DD6 /* CachedResponseHandler.swift */; };\n\t\t34DC51C049DD492632AE5D4EECAD9692 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5722B8FD2185FDF5A63D5DDEBBE828F4 /* Response.swift */; };\n\t\t627FE23AB2A99CB197EB6FCB234FFA01 /* RedirectHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8E4276DB5225716A45E6D73D7C8814A /* RedirectHandler.swift */; };\n\t\t6C56055FEDC2EAB4BAE62EDE8EC93B65 /* URLSessionConfiguration+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F5E916AEF3F2D3302E9286BAEDADFDC /* URLSessionConfiguration+Alamofire.swift */; };\n\t\t6DB19E6A404DC6E48944226A29E63FAD /* Protected.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A17CB1B3F1A646181434E02043AE4A9 /* Protected.swift */; };\n\t\t6FA1C2761AACC20A9D29E8D4BAAE3D38 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E400B9C221A199141363B822034737D /* MultipartFormData.swift */; };\n\t\t71A044CFBDF31C2954EF267B619FCA7C /* RetryPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = A777786034AA3DAED36C544EBBB0BE17 /* RetryPolicy.swift */; };\n\t\t7B780DF98CD63FE86DED9791F2BAC9B0 /* StringEncoding+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0D76B0CA7C280DCCA3C50F6AE99B52C /* StringEncoding+Alamofire.swift */; };\n\t\t7C37932A7CCAD169552F3AA48CFD221E /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CE5B1A2C9408DD1774C9837A4E7CD4 /* EventMonitor.swift */; };\n\t\t86F5A7CC87ECAB730DB431A33C6EE8E6 /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3743BEF1080A8DC1D71A82857E48B9 /* ParameterEncoding.swift */; };\n\t\t8A7E7CD446ABD6F5192B57DFBCF0D5FC /* Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97F5557764115A3E7B2B876F825517B2 /* Session.swift */; };\n\t\t8D745FB91C58D355FCDE815516E00BF9 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F31E760BA0B35046C6060C798E4BB78 /* Request.swift */; };\n\t\t9927815D3EFE3F4424DF16BA289BDAED /* HTTPHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96E3DB87ACFBC8F3E440668B169BAFAD /* HTTPHeaders.swift */; };\n\t\t9F291CC20DD5B5ED32936B4E059F9BD7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1BB9776E628FF1183F277FAE29EDB624 /* Foundation.framework */; };\n\t\t9FEEE2982ECEC995F1F173C372F8F9B0 /* Result+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19498655818EC4ECAAD4D2F2BEB77015 /* Result+Alamofire.swift */; };\n\t\tA2003C57F33B0E68E1E9B14FE318E049 /* Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 237FD85C062BB32E9452655779BA7927 /* Concurrency.swift */; };\n\t\tA3F0D4C2D120AAFBAC5BAAD373FC442C /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4E4C11DD81AE4B9C4158F354BD44233 /* CFNetwork.framework */; };\n\t\tA626185897C70BBD0C959C23C91E0EAA /* OperationQueue+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = B86F8939933D19B4D3E1DE7B22CBEB43 /* OperationQueue+Alamofire.swift */; };\n\t\tA6827CC573473B3E36C3225C6B7B46B4 /* URLConvertible+URLRequestConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 624A417772BA4FAB25BBD7CF729BDE1C /* URLConvertible+URLRequestConvertible.swift */; };\n\t\tAC29E8069D329D375A1167D4B97E3177 /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = A737455D29EB95727684DB684B32BE01 /* Validation.swift */; };\n\t\tB2CE5A8133B8BEBF6F840858BDD54213 /* URLRequest+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00571F6974B40513160B3F985877A862 /* URLRequest+Alamofire.swift */; };\n\t\tB3E45649923766C92B927881F90AB7A8 /* MultipartUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217C3B6C84EF37B3D46A589894758024 /* MultipartUpload.swift */; };\n\t\tB5680599181740E0B606BEA0EF8DCA5F /* ServerTrustEvaluation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F3A7BC7B0B8E218B79A84051BB8C920 /* ServerTrustEvaluation.swift */; };\n\t\tB76037809299E8C23917745EB1C0DEED /* AFError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5252984862448E92536EE6896FD3C064 /* AFError.swift */; };\n\t\tB9848C08433A53F78613C0F32E20A498 /* HTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BA047D81D4B5A8D4719DD5FC0A26F84 /* HTTPMethod.swift */; };\n\t\tBC628E85CF00F7E12EA23F7D41B15EC5 /* RequestInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 090A5AB2922DFE6F567891A144E511CB /* RequestInterceptor.swift */; };\n\t\tBE4E500440E5B200D02FB4F9CE49CBFB /* Alamofire-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F314077ACB3DB8372B7F60ADE4C4CC77 /* Alamofire-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tBF959882BC087542FFBE4BCBA9B398F1 /* SessionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 581E730B4DCDE04EAE8CA4598A09C43A /* SessionDelegate.swift */; };\n\t\tCF7A09FAFC24749C4593179931067C96 /* AuthenticationInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D59D2016351214818AEF5C60F1597D5D /* AuthenticationInterceptor.swift */; };\n\t\tD31636203169CF94112E33CA4A00EDDD /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BAF4CB5A5BEFA56133443DD410D169 /* Alamofire.swift */; };\n\t\tD6D8BEE882D405DA3EB92BBBDBF3320B /* Alamofire-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 25C5EC1EB4BF380AD46721809B07F74A /* Alamofire-dummy.m */; };\n\t\tDA2C6AF7B2E263F88512955FCBE876DE /* URLEncodedFormEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07D59B0C1AD14C5F94B3B5D2869C2FE /* URLEncodedFormEncoder.swift */; };\n\t\tDC0EB849D4010EBF703DF476F24AF5DA /* DispatchQueue+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EBDB99DAE329B93042E6CE74AD11E9 /* DispatchQueue+Alamofire.swift */; };\n\t\tE754DFB193485D3CB6B2E77CCF72FB4F /* RequestTaskMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98AEAE3203FC92E08788AF90E5464072 /* RequestTaskMap.swift */; };\n\t\tFED4316D33650896E39F10C97D1D6C1A /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F2E511750AE31D6B58EA876E0E91F67 /* ResponseSerialization.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t00571F6974B40513160B3F985877A862 /* URLRequest+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"URLRequest+Alamofire.swift\"; path = \"Source/URLRequest+Alamofire.swift\"; sourceTree = \"<group>\"; };\n\t\t090A5AB2922DFE6F567891A144E511CB /* RequestInterceptor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestInterceptor.swift; path = Source/RequestInterceptor.swift; sourceTree = \"<group>\"; };\n\t\t0BA047D81D4B5A8D4719DD5FC0A26F84 /* HTTPMethod.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HTTPMethod.swift; path = Source/HTTPMethod.swift; sourceTree = \"<group>\"; };\n\t\t0F2E511750AE31D6B58EA876E0E91F67 /* ResponseSerialization.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResponseSerialization.swift; path = Source/ResponseSerialization.swift; sourceTree = \"<group>\"; };\n\t\t19498655818EC4ECAAD4D2F2BEB77015 /* Result+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Result+Alamofire.swift\"; path = \"Source/Result+Alamofire.swift\"; sourceTree = \"<group>\"; };\n\t\t1BB9776E628FF1183F277FAE29EDB624 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t1F31E760BA0B35046C6060C798E4BB78 /* Request.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Request.swift; path = Source/Request.swift; sourceTree = \"<group>\"; };\n\t\t1F5E916AEF3F2D3302E9286BAEDADFDC /* URLSessionConfiguration+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"URLSessionConfiguration+Alamofire.swift\"; path = \"Source/URLSessionConfiguration+Alamofire.swift\"; sourceTree = \"<group>\"; };\n\t\t217C3B6C84EF37B3D46A589894758024 /* MultipartUpload.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartUpload.swift; path = Source/MultipartUpload.swift; sourceTree = \"<group>\"; };\n\t\t237FD85C062BB32E9452655779BA7927 /* Concurrency.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Concurrency.swift; path = Source/Concurrency.swift; sourceTree = \"<group>\"; };\n\t\t25C5EC1EB4BF380AD46721809B07F74A /* Alamofire-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"Alamofire-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t2C4053832FEFD0F8B9CEDBB748646216 /* Notifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Notifications.swift; path = Source/Notifications.swift; sourceTree = \"<group>\"; };\n\t\t2E322595956F6D84C6BEEC8C4A741FE8 /* Alamofire.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Alamofire.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t2F3A7BC7B0B8E218B79A84051BB8C920 /* ServerTrustEvaluation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ServerTrustEvaluation.swift; path = Source/ServerTrustEvaluation.swift; sourceTree = \"<group>\"; };\n\t\t2FBE7B560B5D1A1C1F6994ACB3908DD6 /* CachedResponseHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CachedResponseHandler.swift; path = Source/CachedResponseHandler.swift; sourceTree = \"<group>\"; };\n\t\t31BAF4CB5A5BEFA56133443DD410D169 /* Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alamofire.swift; path = Source/Alamofire.swift; sourceTree = \"<group>\"; };\n\t\t3A17CB1B3F1A646181434E02043AE4A9 /* Protected.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Protected.swift; path = Source/Protected.swift; sourceTree = \"<group>\"; };\n\t\t4EA985410A8D3BE11ADFBA9C644E4435 /* Alamofire-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"Alamofire-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t5252984862448E92536EE6896FD3C064 /* AFError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AFError.swift; path = Source/AFError.swift; sourceTree = \"<group>\"; };\n\t\t5722B8FD2185FDF5A63D5DDEBBE828F4 /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Source/Response.swift; sourceTree = \"<group>\"; };\n\t\t574703F845E1303C0F8F73A212883401 /* Alamofire-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Alamofire-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t581E730B4DCDE04EAE8CA4598A09C43A /* SessionDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionDelegate.swift; path = Source/SessionDelegate.swift; sourceTree = \"<group>\"; };\n\t\t624A417772BA4FAB25BBD7CF729BDE1C /* URLConvertible+URLRequestConvertible.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"URLConvertible+URLRequestConvertible.swift\"; path = \"Source/URLConvertible+URLRequestConvertible.swift\"; sourceTree = \"<group>\"; };\n\t\t6C335C796159CBD3B48764946405CC49 /* Alamofire.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Alamofire.modulemap; sourceTree = \"<group>\"; };\n\t\t6E400B9C221A199141363B822034737D /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Source/MultipartFormData.swift; sourceTree = \"<group>\"; };\n\t\t71047F59C36C60ED4DAD9F8531193F48 /* NetworkReachabilityManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkReachabilityManager.swift; path = Source/NetworkReachabilityManager.swift; sourceTree = \"<group>\"; };\n\t\t75EBDB99DAE329B93042E6CE74AD11E9 /* DispatchQueue+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DispatchQueue+Alamofire.swift\"; path = \"Source/DispatchQueue+Alamofire.swift\"; sourceTree = \"<group>\"; };\n\t\t838A7EADD3693326F073BE27C1337F60 /* Alamofire.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Alamofire.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t851203AC13D57B60943A3D829ABC69FD /* Combine.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Combine.swift; path = Source/Combine.swift; sourceTree = \"<group>\"; };\n\t\t96E3DB87ACFBC8F3E440668B169BAFAD /* HTTPHeaders.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HTTPHeaders.swift; path = Source/HTTPHeaders.swift; sourceTree = \"<group>\"; };\n\t\t97F5557764115A3E7B2B876F825517B2 /* Session.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Session.swift; path = Source/Session.swift; sourceTree = \"<group>\"; };\n\t\t98AEAE3203FC92E08788AF90E5464072 /* RequestTaskMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestTaskMap.swift; path = Source/RequestTaskMap.swift; sourceTree = \"<group>\"; };\n\t\tA5F3A8D6988BE763B29FD1CED8B0F0E8 /* AlamofireExtended.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AlamofireExtended.swift; path = Source/AlamofireExtended.swift; sourceTree = \"<group>\"; };\n\t\tA737455D29EB95727684DB684B32BE01 /* Validation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Source/Validation.swift; sourceTree = \"<group>\"; };\n\t\tA777786034AA3DAED36C544EBBB0BE17 /* RetryPolicy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RetryPolicy.swift; path = Source/RetryPolicy.swift; sourceTree = \"<group>\"; };\n\t\tA8E4276DB5225716A45E6D73D7C8814A /* RedirectHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RedirectHandler.swift; path = Source/RedirectHandler.swift; sourceTree = \"<group>\"; };\n\t\tB0D76B0CA7C280DCCA3C50F6AE99B52C /* StringEncoding+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"StringEncoding+Alamofire.swift\"; path = \"Source/StringEncoding+Alamofire.swift\"; sourceTree = \"<group>\"; };\n\t\tB86F8939933D19B4D3E1DE7B22CBEB43 /* OperationQueue+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"OperationQueue+Alamofire.swift\"; path = \"Source/OperationQueue+Alamofire.swift\"; sourceTree = \"<group>\"; };\n\t\tCC2EA49A1B0E0517D5615D945A1D2F73 /* ParameterEncoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoder.swift; path = Source/ParameterEncoder.swift; sourceTree = \"<group>\"; };\n\t\tD063EE811069D306211D06E68BEF5C09 /* Alamofire */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Alamofire; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tD07D59B0C1AD14C5F94B3B5D2869C2FE /* URLEncodedFormEncoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = URLEncodedFormEncoder.swift; path = Source/URLEncodedFormEncoder.swift; sourceTree = \"<group>\"; };\n\t\tD4CE5B1A2C9408DD1774C9837A4E7CD4 /* EventMonitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EventMonitor.swift; path = Source/EventMonitor.swift; sourceTree = \"<group>\"; };\n\t\tD59D2016351214818AEF5C60F1597D5D /* AuthenticationInterceptor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AuthenticationInterceptor.swift; path = Source/AuthenticationInterceptor.swift; sourceTree = \"<group>\"; };\n\t\tDD3743BEF1080A8DC1D71A82857E48B9 /* ParameterEncoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoding.swift; path = Source/ParameterEncoding.swift; sourceTree = \"<group>\"; };\n\t\tE4E4C11DD81AE4B9C4158F354BD44233 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; };\n\t\tF314077ACB3DB8372B7F60ADE4C4CC77 /* Alamofire-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Alamofire-umbrella.h\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t272AA4ADCDF15FCEE0A7CD58EDFBD240 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tA3F0D4C2D120AAFBAC5BAAD373FC442C /* CFNetwork.framework in Frameworks */,\n\t\t\t\t9F291CC20DD5B5ED32936B4E059F9BD7 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0D7BCD481FAEC42F606FACA5F1A46F0A /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6C335C796159CBD3B48764946405CC49 /* Alamofire.modulemap */,\n\t\t\t\t25C5EC1EB4BF380AD46721809B07F74A /* Alamofire-dummy.m */,\n\t\t\t\t4EA985410A8D3BE11ADFBA9C644E4435 /* Alamofire-Info.plist */,\n\t\t\t\t574703F845E1303C0F8F73A212883401 /* Alamofire-prefix.pch */,\n\t\t\t\tF314077ACB3DB8372B7F60ADE4C4CC77 /* Alamofire-umbrella.h */,\n\t\t\t\t838A7EADD3693326F073BE27C1337F60 /* Alamofire.debug.xcconfig */,\n\t\t\t\t2E322595956F6D84C6BEEC8C4A741FE8 /* Alamofire.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/Alamofire\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t15DB8F8C32C4899ECF82C9A66D2947FC /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD063EE811069D306211D06E68BEF5C09 /* Alamofire */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t258F2A33F7C2551A44E6D268FE86814F /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8D32B23A300AC06BE36C248720F514AD /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7FC35244BD082D1BE9DB3EBD155E705A /* Alamofire */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5252984862448E92536EE6896FD3C064 /* AFError.swift */,\n\t\t\t\t31BAF4CB5A5BEFA56133443DD410D169 /* Alamofire.swift */,\n\t\t\t\tA5F3A8D6988BE763B29FD1CED8B0F0E8 /* AlamofireExtended.swift */,\n\t\t\t\tD59D2016351214818AEF5C60F1597D5D /* AuthenticationInterceptor.swift */,\n\t\t\t\t2FBE7B560B5D1A1C1F6994ACB3908DD6 /* CachedResponseHandler.swift */,\n\t\t\t\t851203AC13D57B60943A3D829ABC69FD /* Combine.swift */,\n\t\t\t\t237FD85C062BB32E9452655779BA7927 /* Concurrency.swift */,\n\t\t\t\t75EBDB99DAE329B93042E6CE74AD11E9 /* DispatchQueue+Alamofire.swift */,\n\t\t\t\tD4CE5B1A2C9408DD1774C9837A4E7CD4 /* EventMonitor.swift */,\n\t\t\t\t96E3DB87ACFBC8F3E440668B169BAFAD /* HTTPHeaders.swift */,\n\t\t\t\t0BA047D81D4B5A8D4719DD5FC0A26F84 /* HTTPMethod.swift */,\n\t\t\t\t6E400B9C221A199141363B822034737D /* MultipartFormData.swift */,\n\t\t\t\t217C3B6C84EF37B3D46A589894758024 /* MultipartUpload.swift */,\n\t\t\t\t71047F59C36C60ED4DAD9F8531193F48 /* NetworkReachabilityManager.swift */,\n\t\t\t\t2C4053832FEFD0F8B9CEDBB748646216 /* Notifications.swift */,\n\t\t\t\tB86F8939933D19B4D3E1DE7B22CBEB43 /* OperationQueue+Alamofire.swift */,\n\t\t\t\tCC2EA49A1B0E0517D5615D945A1D2F73 /* ParameterEncoder.swift */,\n\t\t\t\tDD3743BEF1080A8DC1D71A82857E48B9 /* ParameterEncoding.swift */,\n\t\t\t\t3A17CB1B3F1A646181434E02043AE4A9 /* Protected.swift */,\n\t\t\t\tA8E4276DB5225716A45E6D73D7C8814A /* RedirectHandler.swift */,\n\t\t\t\t1F31E760BA0B35046C6060C798E4BB78 /* Request.swift */,\n\t\t\t\t090A5AB2922DFE6F567891A144E511CB /* RequestInterceptor.swift */,\n\t\t\t\t98AEAE3203FC92E08788AF90E5464072 /* RequestTaskMap.swift */,\n\t\t\t\t5722B8FD2185FDF5A63D5DDEBBE828F4 /* Response.swift */,\n\t\t\t\t0F2E511750AE31D6B58EA876E0E91F67 /* ResponseSerialization.swift */,\n\t\t\t\t19498655818EC4ECAAD4D2F2BEB77015 /* Result+Alamofire.swift */,\n\t\t\t\tA777786034AA3DAED36C544EBBB0BE17 /* RetryPolicy.swift */,\n\t\t\t\t2F3A7BC7B0B8E218B79A84051BB8C920 /* ServerTrustEvaluation.swift */,\n\t\t\t\t97F5557764115A3E7B2B876F825517B2 /* Session.swift */,\n\t\t\t\t581E730B4DCDE04EAE8CA4598A09C43A /* SessionDelegate.swift */,\n\t\t\t\tB0D76B0CA7C280DCCA3C50F6AE99B52C /* StringEncoding+Alamofire.swift */,\n\t\t\t\t624A417772BA4FAB25BBD7CF729BDE1C /* URLConvertible+URLRequestConvertible.swift */,\n\t\t\t\tD07D59B0C1AD14C5F94B3B5D2869C2FE /* URLEncodedFormEncoder.swift */,\n\t\t\t\t00571F6974B40513160B3F985877A862 /* URLRequest+Alamofire.swift */,\n\t\t\t\t1F5E916AEF3F2D3302E9286BAEDADFDC /* URLSessionConfiguration+Alamofire.swift */,\n\t\t\t\tA737455D29EB95727684DB684B32BE01 /* Validation.swift */,\n\t\t\t\t0D7BCD481FAEC42F606FACA5F1A46F0A /* Support Files */,\n\t\t\t);\n\t\t\tname = Alamofire;\n\t\t\tpath = Alamofire;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8D32B23A300AC06BE36C248720F514AD /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE4E4C11DD81AE4B9C4158F354BD44233 /* CFNetwork.framework */,\n\t\t\t\t1BB9776E628FF1183F277FAE29EDB624 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF9CB9BECCE32DDA4A2CF383F40D304C6 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7FC35244BD082D1BE9DB3EBD155E705A /* Alamofire */,\n\t\t\t\t258F2A33F7C2551A44E6D268FE86814F /* Frameworks */,\n\t\t\t\t15DB8F8C32C4899ECF82C9A66D2947FC /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tD494003D09185C0D607CE4362679C417 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tBE4E500440E5B200D02FB4F9CE49CBFB /* Alamofire-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t81B7E9B7CD0CADA087A4BB042FBA92E7 /* Alamofire */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 964874FC92F964E1F19F56E6610AE60B /* Build configuration list for PBXNativeTarget \"Alamofire\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tD494003D09185C0D607CE4362679C417 /* Headers */,\n\t\t\t\t9AF650F4DCF2E22891B0DFAA21067F09 /* Sources */,\n\t\t\t\t272AA4ADCDF15FCEE0A7CD58EDFBD240 /* Frameworks */,\n\t\t\t\t1F8E566C12AFE3AACB8C2BD293001C1C /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Alamofire;\n\t\t\tproductName = Alamofire;\n\t\t\tproductReference = D063EE811069D306211D06E68BEF5C09 /* Alamofire */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t56A9F5337958C3BFB5BA830E81895EE7 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3C27EE8C2658DDA0F3E3BF447B623A73 /* Build configuration list for PBXProject \"Alamofire\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = F9CB9BECCE32DDA4A2CF383F40D304C6;\n\t\t\tproductRefGroup = 15DB8F8C32C4899ECF82C9A66D2947FC /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t81B7E9B7CD0CADA087A4BB042FBA92E7 /* Alamofire */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t1F8E566C12AFE3AACB8C2BD293001C1C /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t9AF650F4DCF2E22891B0DFAA21067F09 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB76037809299E8C23917745EB1C0DEED /* AFError.swift in Sources */,\n\t\t\t\tD31636203169CF94112E33CA4A00EDDD /* Alamofire.swift in Sources */,\n\t\t\t\tD6D8BEE882D405DA3EB92BBBDBF3320B /* Alamofire-dummy.m in Sources */,\n\t\t\t\t1DCDE46D0E94332E4C186BFFDD3BEEF5 /* AlamofireExtended.swift in Sources */,\n\t\t\t\tCF7A09FAFC24749C4593179931067C96 /* AuthenticationInterceptor.swift in Sources */,\n\t\t\t\t32E0F47AED3C9C20B71A0B74AE2729E7 /* CachedResponseHandler.swift in Sources */,\n\t\t\t\t254F24FBBEF34222F55E8D0D1A529F49 /* Combine.swift in Sources */,\n\t\t\t\tA2003C57F33B0E68E1E9B14FE318E049 /* Concurrency.swift in Sources */,\n\t\t\t\tDC0EB849D4010EBF703DF476F24AF5DA /* DispatchQueue+Alamofire.swift in Sources */,\n\t\t\t\t7C37932A7CCAD169552F3AA48CFD221E /* EventMonitor.swift in Sources */,\n\t\t\t\t9927815D3EFE3F4424DF16BA289BDAED /* HTTPHeaders.swift in Sources */,\n\t\t\t\tB9848C08433A53F78613C0F32E20A498 /* HTTPMethod.swift in Sources */,\n\t\t\t\t6FA1C2761AACC20A9D29E8D4BAAE3D38 /* MultipartFormData.swift in Sources */,\n\t\t\t\tB3E45649923766C92B927881F90AB7A8 /* MultipartUpload.swift in Sources */,\n\t\t\t\t2DD69493543E21B33A15F68825B0128A /* NetworkReachabilityManager.swift in Sources */,\n\t\t\t\t2A14B156801E9B6CA78E0315974075F2 /* Notifications.swift in Sources */,\n\t\t\t\tA626185897C70BBD0C959C23C91E0EAA /* OperationQueue+Alamofire.swift in Sources */,\n\t\t\t\t0A2051EA0914A2749DA2F7861A9CDD88 /* ParameterEncoder.swift in Sources */,\n\t\t\t\t86F5A7CC87ECAB730DB431A33C6EE8E6 /* ParameterEncoding.swift in Sources */,\n\t\t\t\t6DB19E6A404DC6E48944226A29E63FAD /* Protected.swift in Sources */,\n\t\t\t\t627FE23AB2A99CB197EB6FCB234FFA01 /* RedirectHandler.swift in Sources */,\n\t\t\t\t8D745FB91C58D355FCDE815516E00BF9 /* Request.swift in Sources */,\n\t\t\t\tBC628E85CF00F7E12EA23F7D41B15EC5 /* RequestInterceptor.swift in Sources */,\n\t\t\t\tE754DFB193485D3CB6B2E77CCF72FB4F /* RequestTaskMap.swift in Sources */,\n\t\t\t\t34DC51C049DD492632AE5D4EECAD9692 /* Response.swift in Sources */,\n\t\t\t\tFED4316D33650896E39F10C97D1D6C1A /* ResponseSerialization.swift in Sources */,\n\t\t\t\t9FEEE2982ECEC995F1F173C372F8F9B0 /* Result+Alamofire.swift in Sources */,\n\t\t\t\t71A044CFBDF31C2954EF267B619FCA7C /* RetryPolicy.swift in Sources */,\n\t\t\t\tB5680599181740E0B606BEA0EF8DCA5F /* ServerTrustEvaluation.swift in Sources */,\n\t\t\t\t8A7E7CD446ABD6F5192B57DFBCF0D5FC /* Session.swift in Sources */,\n\t\t\t\tBF959882BC087542FFBE4BCBA9B398F1 /* SessionDelegate.swift in Sources */,\n\t\t\t\t7B780DF98CD63FE86DED9791F2BAC9B0 /* StringEncoding+Alamofire.swift in Sources */,\n\t\t\t\tA6827CC573473B3E36C3225C6B7B46B4 /* URLConvertible+URLRequestConvertible.swift in Sources */,\n\t\t\t\tDA2C6AF7B2E263F88512955FCBE876DE /* URLEncodedFormEncoder.swift in Sources */,\n\t\t\t\tB2CE5A8133B8BEBF6F840858BDD54213 /* URLRequest+Alamofire.swift in Sources */,\n\t\t\t\t6C56055FEDC2EAB4BAE62EDE8EC93B65 /* URLSessionConfiguration+Alamofire.swift in Sources */,\n\t\t\t\tAC29E8069D329D375A1167D4B97E3177 /* Validation.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\tA6FB06411EC6D9B8E5472E8F236342DE /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tA9206ED9640E588E5AA293F9D6A16221 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 838A7EADD3693326F073BE27C1337F60 /* Alamofire.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Alamofire/Alamofire-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Alamofire/Alamofire-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Alamofire/Alamofire.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Alamofire;\n\t\t\t\tPRODUCT_NAME = Alamofire;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.5;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tB5F7C111091F13E46146A8F199113257 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 2E322595956F6D84C6BEEC8C4A741FE8 /* Alamofire.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Alamofire/Alamofire-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Alamofire/Alamofire-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Alamofire/Alamofire.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Alamofire;\n\t\t\t\tPRODUCT_NAME = Alamofire;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.5;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tBDA87E95117989221CEE3597485B083F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3C27EE8C2658DDA0F3E3BF447B623A73 /* Build configuration list for PBXProject \"Alamofire\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA6FB06411EC6D9B8E5472E8F236342DE /* Debug */,\n\t\t\t\tBDA87E95117989221CEE3597485B083F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t964874FC92F964E1F19F56E6610AE60B /* Build configuration list for PBXNativeTarget \"Alamofire\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA9206ED9640E588E5AA293F9D6A16221 /* Debug */,\n\t\t\t\tB5F7C111091F13E46146A8F199113257 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 56A9F5337958C3BFB5BA830E81895EE7 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/FDFullscreenPopGesture/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import <UIKit/UIKit.h>\n\n/// \"UINavigation+FDFullscreenPopGesture\" extends UINavigationController's swipe-\n/// to-pop behavior in iOS 7+ by supporting fullscreen pan gesture. Instead of\n/// screen edge, you can now swipe from any place on the screen and the onboard\n/// interactive pop transition works seamlessly.\n///\n/// Adding the implementation file of this category to your target will\n/// automatically patch UINavigationController with this feature.\n@interface UINavigationController (FDFullscreenPopGesture)\n\n/// The gesture recognizer that actually handles interactive pop.\n@property (nonatomic, strong, readonly) UIPanGestureRecognizer *fd_fullscreenPopGestureRecognizer;\n\n/// A view controller is able to control navigation bar's appearance by itself,\n/// rather than a global way, checking \"fd_prefersNavigationBarHidden\" property.\n/// Default to YES, disable it if you don't want so.\n@property (nonatomic, assign) BOOL fd_viewControllerBasedNavigationBarAppearanceEnabled;\n\n@end\n\n/// Allows any view controller to disable interactive pop gesture, which might\n/// be necessary when the view controller itself handles pan gesture in some\n/// cases.\n@interface UIViewController (FDFullscreenPopGesture)\n\n/// Whether the interactive pop gesture is disabled when contained in a navigation\n/// stack.\n@property (nonatomic, assign) BOOL fd_interactivePopDisabled;\n\n/// Indicate this view controller prefers its navigation bar hidden or not,\n/// checked when view controller based navigation bar's appearance is enabled.\n/// Default to NO, bars are more likely to show.\n@property (nonatomic, assign) BOOL fd_prefersNavigationBarHidden;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/FDFullscreenPopGesture/FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import \"UINavigationController+FDFullscreenPopGesture.h\"\n#import <objc/runtime.h>\n\n@interface _FDFullscreenPopGestureRecognizerDelegate : NSObject <UIGestureRecognizerDelegate>\n\n@property (nonatomic, weak) UINavigationController *navigationController;\n\n@end\n\n@implementation _FDFullscreenPopGestureRecognizerDelegate\n\n- (BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer\n{\n    // Ignore when no view controller is pushed into the navigation stack.\n    if (self.navigationController.viewControllers.count <= 1) {\n        return NO;\n    }\n    \n    // Disable when the active view controller doesn't allow interactive pop.\n    UIViewController *topViewController = self.navigationController.viewControllers.lastObject;\n    if (topViewController.fd_interactivePopDisabled) {\n        return NO;\n    }\n\n    // Ignore pan gesture when the navigation controller is currently in transition.\n    if ([[self.navigationController valueForKey:@\"_isTransitioning\"] boolValue]) {\n        return NO;\n    }\n    \n    // Prevent calling the handler when the gesture begins in an opposite direction.\n    CGPoint translation = [gestureRecognizer translationInView:gestureRecognizer.view];\n    if (translation.x <= 0) {\n        return NO;\n    }\n    \n    return YES;\n}\n\n@end\n\ntypedef void (^_FDViewControllerWillAppearInjectBlock)(UIViewController *viewController, BOOL animated);\n\n@interface UIViewController (FDFullscreenPopGesturePrivate)\n\n@property (nonatomic, copy) _FDViewControllerWillAppearInjectBlock fd_willAppearInjectBlock;\n\n@end\n\n@implementation UIViewController (FDFullscreenPopGesturePrivate)\n\n+ (void)load\n{\n    Method originalMethod = class_getInstanceMethod(self, @selector(viewWillAppear:));\n    Method swizzledMethod = class_getInstanceMethod(self, @selector(fd_viewWillAppear:));\n    method_exchangeImplementations(originalMethod, swizzledMethod);\n}\n\n- (void)fd_viewWillAppear:(BOOL)animated\n{\n    // Forward to primary implementation.\n    [self fd_viewWillAppear:animated];\n    \n    if (self.fd_willAppearInjectBlock) {\n        self.fd_willAppearInjectBlock(self, animated);\n    }\n}\n\n- (_FDViewControllerWillAppearInjectBlock)fd_willAppearInjectBlock\n{\n    return objc_getAssociatedObject(self, _cmd);\n}\n\n- (void)setFd_willAppearInjectBlock:(_FDViewControllerWillAppearInjectBlock)block\n{\n    objc_setAssociatedObject(self, @selector(fd_willAppearInjectBlock), block, OBJC_ASSOCIATION_COPY_NONATOMIC);\n}\n\n@end\n\n@implementation UINavigationController (FDFullscreenPopGesture)\n\n+ (void)load\n{\n    // Inject \"-pushViewController:animated:\"\n    Method originalMethod = class_getInstanceMethod(self, @selector(pushViewController:animated:));\n    Method swizzledMethod = class_getInstanceMethod(self, @selector(fd_pushViewController:animated:));\n    method_exchangeImplementations(originalMethod, swizzledMethod);\n}\n\n- (void)fd_pushViewController:(UIViewController *)viewController animated:(BOOL)animated\n{\n    if (![self.interactivePopGestureRecognizer.view.gestureRecognizers containsObject:self.fd_fullscreenPopGestureRecognizer]) {\n        \n        // Add our own gesture recognizer to where the onboard screen edge pan gesture recognizer is attached to.\n        [self.interactivePopGestureRecognizer.view addGestureRecognizer:self.fd_fullscreenPopGestureRecognizer];\n\n        // Forward the gesture events to the private handler of the onboard gesture recognizer.\n        NSArray *internalTargets = [self.interactivePopGestureRecognizer valueForKey:@\"targets\"];\n        id internalTarget = [internalTargets.firstObject valueForKey:@\"target\"];\n        SEL internalAction = NSSelectorFromString(@\"handleNavigationTransition:\");\n        self.fd_fullscreenPopGestureRecognizer.delegate = self.fd_popGestureRecognizerDelegate;\n        [self.fd_fullscreenPopGestureRecognizer addTarget:internalTarget action:internalAction];\n\n        // Disable the onboard gesture recognizer.\n        self.interactivePopGestureRecognizer.enabled = NO;\n    }\n    \n    // Handle perferred navigation bar appearance.\n    [self fd_setupViewControllerBasedNavigationBarAppearanceIfNeeded:viewController];\n    \n    // Forward to primary implementation.\n    [self fd_pushViewController:viewController animated:animated];\n}\n\n- (void)fd_setupViewControllerBasedNavigationBarAppearanceIfNeeded:(UIViewController *)appearingViewController\n{\n    if (!self.fd_viewControllerBasedNavigationBarAppearanceEnabled) {\n        return;\n    }\n    \n    __weak typeof(self) weakSelf = self;\n    _FDViewControllerWillAppearInjectBlock block = ^(UIViewController *viewController, BOOL animated) {\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        if (strongSelf) {\n            [strongSelf setNavigationBarHidden:viewController.fd_prefersNavigationBarHidden animated:animated];\n        }\n    };\n    \n    // Setup will appear inject block to appearing view controller.\n    // Setup disappearing view controller as well, because not every view controller is added into\n    // stack by pushing, maybe by \"-setViewControllers:\".\n    appearingViewController.fd_willAppearInjectBlock = block;\n    UIViewController *disappearingViewController = self.viewControllers.lastObject;\n    if (disappearingViewController && !disappearingViewController.fd_willAppearInjectBlock) {\n        disappearingViewController.fd_willAppearInjectBlock = block;\n    }\n}\n\n- (_FDFullscreenPopGestureRecognizerDelegate *)fd_popGestureRecognizerDelegate\n{\n    _FDFullscreenPopGestureRecognizerDelegate *delegate = objc_getAssociatedObject(self, _cmd);\n\n    if (!delegate) {\n        delegate = [[_FDFullscreenPopGestureRecognizerDelegate alloc] init];\n        delegate.navigationController = self;\n        \n        objc_setAssociatedObject(self, _cmd, delegate, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return delegate;\n}\n\n- (UIPanGestureRecognizer *)fd_fullscreenPopGestureRecognizer\n{\n    UIPanGestureRecognizer *panGestureRecognizer = objc_getAssociatedObject(self, _cmd);\n\n    if (!panGestureRecognizer) {\n        panGestureRecognizer = [[UIPanGestureRecognizer alloc] init];\n        panGestureRecognizer.maximumNumberOfTouches = 1;\n        \n        objc_setAssociatedObject(self, _cmd, panGestureRecognizer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return panGestureRecognizer;\n}\n\n- (BOOL)fd_viewControllerBasedNavigationBarAppearanceEnabled\n{\n    NSNumber *number = objc_getAssociatedObject(self, _cmd);\n    if (number) {\n        return number.boolValue;\n    }\n    self.fd_viewControllerBasedNavigationBarAppearanceEnabled = YES;\n    return YES;\n}\n\n- (void)setFd_viewControllerBasedNavigationBarAppearanceEnabled:(BOOL)enabled\n{\n    SEL key = @selector(fd_viewControllerBasedNavigationBarAppearanceEnabled);\n    objc_setAssociatedObject(self, key, @(enabled), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n\n@implementation UIViewController (FDFullscreenPopGesture)\n\n- (BOOL)fd_interactivePopDisabled\n{\n    return [objc_getAssociatedObject(self, _cmd) boolValue];\n}\n\n- (void)setFd_interactivePopDisabled:(BOOL)disabled\n{\n    objc_setAssociatedObject(self, @selector(fd_interactivePopDisabled), @(disabled), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (BOOL)fd_prefersNavigationBarHidden\n{\n    return [objc_getAssociatedObject(self, _cmd) boolValue];\n}\n\n- (void)setFd_prefersNavigationBarHidden:(BOOL)hidden\n{\n    objc_setAssociatedObject(self, @selector(fd_prefersNavigationBarHidden), @(hidden), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/FDFullscreenPopGesture/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/FDFullscreenPopGesture/README.md",
    "content": "# FDFullscreenPopGesture\nAn UINavigationController's category to enable fullscreen pop gesture in an iOS7+ system style with AOP.\n\n# Overview\n\n![snapshot](https://raw.githubusercontent.com/forkingdog/FDFullscreenPopGesture/master/Snapshots/snapshot0.gif)\n\n这个扩展来自 @J_雨 同学的这个很天才的思路，他的文章地址：[http://www.jianshu.com/p/d39f7d22db6c](http://www.jianshu.com/p/d39f7d22db6c)\n\n# Usage\n\n**AOP**, just add 2 files and **no need** for any setups, all navigation controllers will be able to use fullscreen pop gesture automatically.  \n\nTo disable this pop gesture of a navigation controller:  \n\n``` objc\nnavigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;\n```\n\nTo disable this pop gesture of a view controller:  \n\n``` objc\nviewController.fd_interactivePopDisabled = YES;\n```\n\nRequire at least iOS **7.0**.\n\n# View Controller Based Navigation Bar Appearance\n\nIt handles navigation bar transition properly when using fullscreen gesture to push or pop a view controller:  \n\n- with bar -> without bar\n- without bar -> with bar\n- without bar -> without bar\n\n![snapshot with bar states](https://raw.githubusercontent.com/forkingdog/FDFullscreenPopGesture/master/Snapshots/snapshot1.gif)\n\nThis opmiziation is enabled by default, from now on you don't need to call **UINavigationController**'s `-setNavigationBarHidden:animated:` method, instead, use view controller's specific API to hide its bar:  \n\n``` objc\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.fd_prefersNavigationBarHidden = NO;\n}\n```\n\nAnd this property is **YES** by default.\n\n# Installation\n\nUse cocoapods  \n\n``` ruby\npod 'FDFullscreenPopGesture', '1.1'\n```\n# Release Notes\n\n**1.1** - View controller based navigation bar appearance and transition.  \n**1.0** - Fullscreen pop gesture.  \n\n# License  \nMIT\n"
  },
  {
    "path": "JetChat/Pods/FDFullscreenPopGesture.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t5D93002EF70CBE67D34305A810908957 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2811DD0C4F403A862FC617FEC2F6885F /* Foundation.framework */; };\n\t\t617CF3E9354339B5EBCA7247D220C38A /* UINavigationController+FDFullscreenPopGesture.m in Sources */ = {isa = PBXBuildFile; fileRef = 442410656F7B7C29C1EDA454EB5E2343 /* UINavigationController+FDFullscreenPopGesture.m */; };\n\t\t8EFBD71FE38A0D04B06250BE2AE064B7 /* UINavigationController+FDFullscreenPopGesture.h in Headers */ = {isa = PBXBuildFile; fileRef = F30A1FC2B45F5F84D07ED1DF369F6CE0 /* UINavigationController+FDFullscreenPopGesture.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCA5F3AB14971F5906A19F38B1B040BCD /* FDFullscreenPopGesture-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F92CAC636918E7E2EFBADA2B4F6015EB /* FDFullscreenPopGesture-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFC8A200019C8B10E0CC39FB07E6FB7C2 /* FDFullscreenPopGesture-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CFCF7002D0DA3C01CD7ADA43409F360 /* FDFullscreenPopGesture-dummy.m */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t2811DD0C4F403A862FC617FEC2F6885F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t442410656F7B7C29C1EDA454EB5E2343 /* UINavigationController+FDFullscreenPopGesture.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UINavigationController+FDFullscreenPopGesture.m\"; path = \"FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.m\"; sourceTree = \"<group>\"; };\n\t\t4A250EF9BD00E7210DA5117560B6D053 /* FDFullscreenPopGesture-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"FDFullscreenPopGesture-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t647138C6D5F4D7B77416F217E4115BB7 /* FDFullscreenPopGesture */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = FDFullscreenPopGesture; path = FDFullscreenPopGesture.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t7166D4F0E7815B12E4444BE344A12EFD /* FDFullscreenPopGesture.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = FDFullscreenPopGesture.modulemap; sourceTree = \"<group>\"; };\n\t\t8CD2EDE0491A752449362412A74882A2 /* FDFullscreenPopGesture.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = FDFullscreenPopGesture.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t8CFCF7002D0DA3C01CD7ADA43409F360 /* FDFullscreenPopGesture-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"FDFullscreenPopGesture-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tB31F55AAFF6653EDBFB0532E3E78041D /* FDFullscreenPopGesture.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = FDFullscreenPopGesture.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tF30A1FC2B45F5F84D07ED1DF369F6CE0 /* UINavigationController+FDFullscreenPopGesture.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UINavigationController+FDFullscreenPopGesture.h\"; path = \"FDFullscreenPopGesture/UINavigationController+FDFullscreenPopGesture.h\"; sourceTree = \"<group>\"; };\n\t\tF80D0671D125F6B1355456995A040F4D /* FDFullscreenPopGesture-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"FDFullscreenPopGesture-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tF92CAC636918E7E2EFBADA2B4F6015EB /* FDFullscreenPopGesture-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"FDFullscreenPopGesture-umbrella.h\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tD1F7324A9E5004FCF3FFDF413BE2D28F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t5D93002EF70CBE67D34305A810908957 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t21CC3615D07A552BD0339CED13C768E0 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2811DD0C4F403A862FC617FEC2F6885F /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t36B6711F9529BB5DFBCF89662990DC79 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD4CEADBFEEB4F8156DC2FE72C4A4F3A9 /* FDFullscreenPopGesture */,\n\t\t\t\t506A2BACD5AD77047A7F08CF2A67A485 /* Frameworks */,\n\t\t\t\tE3E5A86431510652F9E2558AE1242A3B /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t506A2BACD5AD77047A7F08CF2A67A485 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t21CC3615D07A552BD0339CED13C768E0 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5B5E5FF442A6392515F26E866DB9435E /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7166D4F0E7815B12E4444BE344A12EFD /* FDFullscreenPopGesture.modulemap */,\n\t\t\t\t8CFCF7002D0DA3C01CD7ADA43409F360 /* FDFullscreenPopGesture-dummy.m */,\n\t\t\t\t4A250EF9BD00E7210DA5117560B6D053 /* FDFullscreenPopGesture-Info.plist */,\n\t\t\t\tF80D0671D125F6B1355456995A040F4D /* FDFullscreenPopGesture-prefix.pch */,\n\t\t\t\tF92CAC636918E7E2EFBADA2B4F6015EB /* FDFullscreenPopGesture-umbrella.h */,\n\t\t\t\t8CD2EDE0491A752449362412A74882A2 /* FDFullscreenPopGesture.debug.xcconfig */,\n\t\t\t\tB31F55AAFF6653EDBFB0532E3E78041D /* FDFullscreenPopGesture.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/FDFullscreenPopGesture\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD4CEADBFEEB4F8156DC2FE72C4A4F3A9 /* FDFullscreenPopGesture */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF30A1FC2B45F5F84D07ED1DF369F6CE0 /* UINavigationController+FDFullscreenPopGesture.h */,\n\t\t\t\t442410656F7B7C29C1EDA454EB5E2343 /* UINavigationController+FDFullscreenPopGesture.m */,\n\t\t\t\t5B5E5FF442A6392515F26E866DB9435E /* Support Files */,\n\t\t\t);\n\t\t\tname = FDFullscreenPopGesture;\n\t\t\tpath = FDFullscreenPopGesture;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE3E5A86431510652F9E2558AE1242A3B /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t647138C6D5F4D7B77416F217E4115BB7 /* FDFullscreenPopGesture */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t40FB73262556541BE31C68A371D768B2 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCA5F3AB14971F5906A19F38B1B040BCD /* FDFullscreenPopGesture-umbrella.h in Headers */,\n\t\t\t\t8EFBD71FE38A0D04B06250BE2AE064B7 /* UINavigationController+FDFullscreenPopGesture.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tA8BAA0D80184552CA0F0647BF03C3D1B /* FDFullscreenPopGesture */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = C65CDAF9EE52F14CC151AF6E556D6FE0 /* Build configuration list for PBXNativeTarget \"FDFullscreenPopGesture\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t40FB73262556541BE31C68A371D768B2 /* Headers */,\n\t\t\t\tEBA71A78DF744C1BCA8203DC3E1EDD3E /* Sources */,\n\t\t\t\tD1F7324A9E5004FCF3FFDF413BE2D28F /* Frameworks */,\n\t\t\t\tB5EED544008394283215889E53A9A72A /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = FDFullscreenPopGesture;\n\t\t\tproductName = FDFullscreenPopGesture;\n\t\t\tproductReference = 647138C6D5F4D7B77416F217E4115BB7 /* FDFullscreenPopGesture */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tD866A8E7E3B7C15B8CA393D72C310963 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = DC8F4C97B07ED0D19369D41D6D324894 /* Build configuration list for PBXProject \"FDFullscreenPopGesture\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 36B6711F9529BB5DFBCF89662990DC79;\n\t\t\tproductRefGroup = E3E5A86431510652F9E2558AE1242A3B /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tA8BAA0D80184552CA0F0647BF03C3D1B /* FDFullscreenPopGesture */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tB5EED544008394283215889E53A9A72A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tEBA71A78DF744C1BCA8203DC3E1EDD3E /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tFC8A200019C8B10E0CC39FB07E6FB7C2 /* FDFullscreenPopGesture-dummy.m in Sources */,\n\t\t\t\t617CF3E9354339B5EBCA7247D220C38A /* UINavigationController+FDFullscreenPopGesture.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t5475041B13520804AB82F0B304AD3A49 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = B31F55AAFF6653EDBFB0532E3E78041D /* FDFullscreenPopGesture.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = FDFullscreenPopGesture;\n\t\t\t\tPRODUCT_NAME = FDFullscreenPopGesture;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t64A7D7F7C843687AA32404B3DFE7C981 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t803A23C9436E2B759F5881F0C44B0ECE /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 8CD2EDE0491A752449362412A74882A2 /* FDFullscreenPopGesture.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = FDFullscreenPopGesture;\n\t\t\t\tPRODUCT_NAME = FDFullscreenPopGesture;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tD7DEE269AECDA48C238E51ABF0EBBFF4 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tC65CDAF9EE52F14CC151AF6E556D6FE0 /* Build configuration list for PBXNativeTarget \"FDFullscreenPopGesture\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t803A23C9436E2B759F5881F0C44B0ECE /* Debug */,\n\t\t\t\t5475041B13520804AB82F0B304AD3A49 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDC8F4C97B07ED0D19369D41D6D324894 /* Build configuration list for PBXProject \"FDFullscreenPopGesture\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD7DEE269AECDA48C238E51ABF0EBBFF4 /* Debug */,\n\t\t\t\t64A7D7F7C843687AA32404B3DFE7C981 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = D866A8E7E3B7C15B8CA393D72C310963 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/LICENSE",
    "content": "   Copyright 1999-2016  Alibaba Group Holding Ltd.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n1. reflection\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Brad Hilton\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n2. ObjectMapper\n\nThe MIT License (MIT)\nCopyright (c) 2014 Hearst\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/README.md",
    "content": "# HandyJSON\n\nHandyJSON is a framework written in Swift which to make converting model objects( **pure classes/structs** ) to and from JSON easy on iOS.\n\nCompared with others, the most significant feature of HandyJSON is that it does not require the objects inherit from NSObject(**not using KVC but reflection**), neither implements a 'mapping' function(**writing value to memory directly to achieve property assignment**).\n\nHandyJSON is totally depend on the memory layout rules infered from Swift runtime code. We are watching it and will follow every bit if it changes.\n\n[![Build Status](https://travis-ci.org/alibaba/HandyJSON.svg?branch=master)](https://travis-ci.org/alibaba/HandyJSON)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Cocoapods Version](https://img.shields.io/cocoapods/v/HandyJSON.svg?style=flat)](http://cocoadocs.org/docsets/HandyJSON)\n[![Cocoapods Platform](https://img.shields.io/cocoapods/p/HandyJSON.svg?style=flat)](http://cocoadocs.org/docsets/HandyJSON)\n[![Codecov branch](https://img.shields.io/codecov/c/github/alibaba/HandyJSON/master.svg?style=flat)](https://codecov.io/gh/alibaba/HandyJSON/branch/master)\n\n## [中文文档](./README_cn.md)\n\n## 交流群\n\n群号: 581331250\n\n![交流群](qq_group.png)\n\n## Sample Code\n\n### Deserialization\n\n```swift\nclass BasicTypes: HandyJSON {\n    var int: Int = 2\n    var doubleOptional: Double?\n    var stringImplicitlyUnwrapped: String!\n\n    required init() {}\n}\n\nlet jsonString = \"{\\\"doubleOptional\\\":1.1,\\\"stringImplicitlyUnwrapped\\\":\\\"hello\\\",\\\"int\\\":1}\"\nif let object = BasicTypes.deserialize(from: jsonString) {\n    print(object.int)\n    print(object.doubleOptional!)\n    print(object.stringImplicitlyUnwrapped)\n}\n```\n\n### Serialization\n\n```swift\n\nlet object = BasicTypes()\nobject.int = 1\nobject.doubleOptional = 1.1\nobject.stringImplicitlyUnwrapped = “hello\"\n\nprint(object.toJSON()!) // serialize to dictionary\nprint(object.toJSONString()!) // serialize to JSON string\nprint(object.toJSONString(prettyPrint: true)!) // serialize to pretty JSON string\n```\n\n# Content\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n    - [Cocoapods](#cocoapods)\n    - [Carthage](#carthage)\n    - [Manually](#manually)\n- [Deserialization](#deserialization)\n    - [The Basics](#the-basics)\n    - [Support Struct](#support-struct)\n    - [Support Enum Property](#support-enum-property)\n    - [Optional/ImplicitlyUnwrappedOptional/Collections/...](#optionalimplicitlyunwrappedoptionalcollections)\n    - [Designated Path](#designated-path)\n    - [Composition Object](#composition-object)\n    - [Inheritance Object](#inheritance-object)\n    - [JSON Array](#json-array)\n    - [Mapping From Dictionary](#mapping-from-dictionary)\n    - [Custom Mapping](#custom-mapping)\n    - [Date/Data/URL/Decimal/Color](#datedataurldecimalcolor)\n    - [Exclude Property](#exclude-property)\n    - [Update Existing Model](#update-existing-model)\n    - [Supported Property Type](#supported-property-type)\n- [Serialization](#serialization)\n    - [The Basics](#the-basics)\n    - [Mapping And Excluding](#mapping-and-excluding)\n- [FAQ](#faq)\n- [To Do](#to-do)\n\n# Features\n\n* Serialize/Deserialize Object/JSON to/From JSON/Object\n\n* Naturally use object property name for mapping, no need to specify a mapping relationship\n\n* Support almost all types in Swift, including enum\n\n* Support struct\n\n* Custom transformations\n\n* Type-Adaption, such as string json field maps to int property, int json field maps to string property\n\nAn overview of types supported can be found at file: [BasicTypes.swift](./HandyJSONTest/BasicTypes.swift)\n\n# Requirements\n\n* iOS 8.0+/OSX 10.9+/watchOS 2.0+/tvOS 9.0+\n\n* Swift 3.0+ / Swift 4.0+ / Swift 5.0+\n\n# Installation\n\n**To use with Swift 5.0/5.1 ( Xcode 10.2+/11.0+ ), version == 5.0.1**\n\n**To use with Swift 4.2 ( Xcode 10 ), version == 4.2.0**\n\n**To use with Swift 4.0, version >= 4.1.1**\n\n**To use with Swift 3.x, version >= 1.8.0**\n\nFor Legacy Swift2.x support, take a look at the [swift2 branch](https://github.com/alibaba/HandyJSON/tree/master_for_swift_2x).\n\n## Cocoapods\n\nAdd the following line to your `Podfile`:\n\n```\npod 'HandyJSON', '~> 5.0.1'\n```\n\nThen, run the following command:\n\n```\n$ pod install\n```\n\n## Carthage\n\nYou can add a dependency on `HandyJSON` by adding the following line to your `Cartfile`:\n\n```\ngithub \"alibaba/HandyJSON\" ~> 5.0.1\n```\n\n## Manually\n\nYou can integrate `HandyJSON` into your project manually by doing the following steps:\n\n* Open up `Terminal`, `cd` into your top-level project directory, and add `HandyJSON` as a submodule:\n\n```\ngit init && git submodule add https://github.com/alibaba/HandyJSON.git\n```\n\n* Open the new `HandyJSON` folder, drag the `HandyJSON.xcodeproj` into the `Project Navigator` of your project.\n\n* Select your application project in the `Project Navigator`, open the `General` panel in the right window.\n\n* Click on the `+` button under the `Embedded Binaries` section.\n\n* You will see two different `HandyJSON.xcodeproj` folders each with four different versions of the HandyJSON.framework nested inside a Products folder.\n> It does not matter which Products folder you choose from, but it does matter which HandyJSON.framework you choose.\n\n* Select one of the four `HandyJSON.framework` which matches the platform your Application should run on.\n\n* Congratulations!\n\n# Deserialization\n\n## The Basics\n\nTo support deserialization from JSON, a class/struct need to conform to 'HandyJSON' protocol. It's truly protocol, not some class inherited from NSObject.\n\nTo conform to 'HandyJSON', a class need to implement an empty initializer.\n\n```swift\nclass BasicTypes: HandyJSON {\n    var int: Int = 2\n    var doubleOptional: Double?\n    var stringImplicitlyUnwrapped: String!\n\n    required init() {}\n}\n\nlet jsonString = \"{\\\"doubleOptional\\\":1.1,\\\"stringImplicitlyUnwrapped\\\":\\\"hello\\\",\\\"int\\\":1}\"\nif let object = BasicTypes.deserialize(from: jsonString) {\n    // …\n}\n```\n\n## Support Struct\n\nFor struct, since the compiler provide a default empty initializer, we use it for free.\n\n```swift\nstruct BasicTypes: HandyJSON {\n    var int: Int = 2\n    var doubleOptional: Double?\n    var stringImplicitlyUnwrapped: String!\n}\n\nlet jsonString = \"{\\\"doubleOptional\\\":1.1,\\\"stringImplicitlyUnwrapped\\\":\\\"hello\\\",\\\"int\\\":1}\"\nif let object = BasicTypes.deserialize(from: jsonString) {\n    // …\n}\n```\n\nBut also notice that, if you have a designated initializer to override the default one in the struct, you should explicitly declare an empty one(no `required` modifier need).\n\n## Support Enum Property\n\nTo be convertable, An `enum` must conform to `HandyJSONEnum` protocol. Nothing special need to do now.\n\n```swift\nenum AnimalType: String, HandyJSONEnum {\n    case Cat = \"cat\"\n    case Dog = \"dog\"\n    case Bird = \"bird\"\n}\n\nstruct Animal: HandyJSON {\n    var name: String?\n    var type: AnimalType?\n}\n\nlet jsonString = \"{\\\"type\\\":\\\"cat\\\",\\\"name\\\":\\\"Tom\\\"}\"\nif let animal = Animal.deserialize(from: jsonString) {\n    print(animal.type?.rawValue)\n}\n```\n\n## Optional/ImplicitlyUnwrappedOptional/Collections/...\n\n'HandyJSON' support classes/structs composed of `optional`, `implicitlyUnwrappedOptional`, `array`, `dictionary`, `objective-c base type`, `nested type` etc. properties.\n\n```swift\nclass BasicTypes: HandyJSON {\n    var bool: Bool = true\n    var intOptional: Int?\n    var doubleImplicitlyUnwrapped: Double!\n    var anyObjectOptional: Any?\n\n    var arrayInt: Array<Int> = []\n    var arrayStringOptional: Array<String>?\n    var setInt: Set<Int>?\n    var dictAnyObject: Dictionary<String, Any> = [:]\n\n    var nsNumber = 2\n    var nsString: NSString?\n\n    required init() {}\n}\n\nlet object = BasicTypes()\nobject.intOptional = 1\nobject.doubleImplicitlyUnwrapped = 1.1\nobject.anyObjectOptional = \"StringValue\"\nobject.arrayInt = [1, 2]\nobject.arrayStringOptional = [\"a\", \"b\"]\nobject.setInt = [1, 2]\nobject.dictAnyObject = [\"key1\": 1, \"key2\": \"stringValue\"]\nobject.nsNumber = 2\nobject.nsString = \"nsStringValue\"\n\nlet jsonString = object.toJSONString()!\n\nif let object = BasicTypes.deserialize(from: jsonString) {\n    // ...\n}\n```\n\n## Designated Path\n\n`HandyJSON` supports deserialization from designated path of JSON.\n\n```swift\nclass Cat: HandyJSON {\n    var id: Int64!\n    var name: String!\n\n    required init() {}\n}\n\nlet jsonString = \"{\\\"code\\\":200,\\\"msg\\\":\\\"success\\\",\\\"data\\\":{\\\"cat\\\":{\\\"id\\\":12345,\\\"name\\\":\\\"Kitty\\\"}}}\"\n\nif let cat = Cat.deserialize(from: jsonString, designatedPath: \"data.cat\") {\n    print(cat.name)\n}\n```\n\n## Composition Object\n\nNotice that all the properties of a class/struct need to deserialized should be type conformed to `HandyJSON`.\n\n```swift\nclass Component: HandyJSON {\n    var aInt: Int?\n    var aString: String?\n\n    required init() {}\n}\n\nclass Composition: HandyJSON {\n    var aInt: Int?\n    var comp1: Component?\n    var comp2: Component?\n\n    required init() {}\n}\n\nlet jsonString = \"{\\\"num\\\":12345,\\\"comp1\\\":{\\\"aInt\\\":1,\\\"aString\\\":\\\"aaaaa\\\"},\\\"comp2\\\":{\\\"aInt\\\":2,\\\"aString\\\":\\\"bbbbb\\\"}}\"\n\nif let composition = Composition.deserialize(from: jsonString) {\n    print(composition)\n}\n```\n\n## Inheritance Object\n\nA subclass need deserialization, it's superclass need to conform to `HandyJSON`.\n\n```swift\nclass Animal: HandyJSON {\n    var id: Int?\n    var color: String?\n\n    required init() {}\n}\n\nclass Cat: Animal {\n    var name: String?\n\n    required init() {}\n}\n\nlet jsonString = \"{\\\"id\\\":12345,\\\"color\\\":\\\"black\\\",\\\"name\\\":\\\"cat\\\"}\"\n\nif let cat = Cat.deserialize(from: jsonString) {\n    print(cat)\n}\n```\n\n## JSON Array\n\nIf the first level of a JSON text is an array, we turn it to objects array.\n\n```swift\nclass Cat: HandyJSON {\n    var name: String?\n    var id: String?\n\n    required init() {}\n}\n\nlet jsonArrayString: String? = \"[{\\\"name\\\":\\\"Bob\\\",\\\"id\\\":\\\"1\\\"}, {\\\"name\\\":\\\"Lily\\\",\\\"id\\\":\\\"2\\\"}, {\\\"name\\\":\\\"Lucy\\\",\\\"id\\\":\\\"3\\\"}]\"\nif let cats = [Cat].deserialize(from: jsonArrayString) {\n    cats.forEach({ (cat) in\n        // ...\n    })\n}\n```\n\n## Mapping From Dictionary\n\n`HandyJSON` support mapping swift dictionary to model.\n\n```swift\nvar dict = [String: Any]()\ndict[\"doubleOptional\"] = 1.1\ndict[\"stringImplicitlyUnwrapped\"] = \"hello\"\ndict[\"int\"] = 1\nif let object = BasicTypes.deserialize(from: dict) {\n    // ...\n}\n```\n\n## Custom Mapping\n\n`HandyJSON` let you customize the key mapping to JSON fields, or parsing method of any property. All you need to do is implementing an optional `mapping` function, do things in it.\n\nWe bring the transformer from [`ObjectMapper`](https://github.com/Hearst-DD/ObjectMapper). If you are familiar with it, it’s almost the same here.\n\n```swift\nclass Cat: HandyJSON {\n    var id: Int64!\n    var name: String!\n    var parent: (String, String)?\n    var friendName: String?\n\n    required init() {}\n\n    func mapping(mapper: HelpingMapper) {\n        // specify 'cat_id' field in json map to 'id' property in object\n        mapper <<<\n            self.id <-- \"cat_id\"\n\n        // specify 'parent' field in json parse as following to 'parent' property in object\n        mapper <<<\n            self.parent <-- TransformOf<(String, String), String>(fromJSON: { (rawString) -> (String, String)? in\n                if let parentNames = rawString?.characters.split(separator: \"/\").map(String.init) {\n                    return (parentNames[0], parentNames[1])\n                }\n                return nil\n            }, toJSON: { (tuple) -> String? in\n                if let _tuple = tuple {\n                    return \"\\(_tuple.0)/\\(_tuple.1)\"\n                }\n                return nil\n            })\n\n        // specify 'friend.name' path field in json map to 'friendName' property\n        mapper <<<\n            self.friendName <-- \"friend.name\"\n    }\n}\n\nlet jsonString = \"{\\\"cat_id\\\":12345,\\\"name\\\":\\\"Kitty\\\",\\\"parent\\\":\\\"Tom/Lily\\\",\\\"friend\\\":{\\\"id\\\":54321,\\\"name\\\":\\\"Lily\\\"}}\"\n\nif let cat = Cat.deserialize(from: jsonString) {\n    print(cat.id)\n    print(cat.parent)\n    print(cat.friendName)\n}\n```\n\n## Date/Data/URL/Decimal/Color\n\n`HandyJSON` prepare some useful transformer for some none-basic type.\n\n```swift\nclass ExtendType: HandyJSON {\n    var date: Date?\n    var decimal: NSDecimalNumber?\n    var url: URL?\n    var data: Data?\n    var color: UIColor?\n\n    func mapping(mapper: HelpingMapper) {\n        mapper <<<\n            date <-- CustomDateFormatTransform(formatString: \"yyyy-MM-dd\")\n\n        mapper <<<\n            decimal <-- NSDecimalNumberTransform()\n\n        mapper <<<\n            url <-- URLTransform(shouldEncodeURLString: false)\n\n        mapper <<<\n            data <-- DataTransform()\n\n        mapper <<<\n            color <-- HexColorTransform()\n    }\n\n    public required init() {}\n}\n\nlet object = ExtendType()\nobject.date = Date()\nobject.decimal = NSDecimalNumber(string: \"1.23423414371298437124391243\")\nobject.url = URL(string: \"https://www.aliyun.com\")\nobject.data = Data(base64Encoded: \"aGVsbG8sIHdvcmxkIQ==\")\nobject.color = UIColor.blue\n\nprint(object.toJSONString()!)\n// it prints:\n// {\"date\":\"2017-09-11\",\"decimal\":\"1.23423414371298437124391243\",\"url\":\"https:\\/\\/www.aliyun.com\",\"data\":\"aGVsbG8sIHdvcmxkIQ==\",\"color\":\"0000FF\"}\n\nlet mappedObject = ExtendType.deserialize(from: object.toJSONString()!)!\nprint(mappedObject.date)\n...\n```\n\n## Exclude Property\n\nIf any non-basic property of a class/struct could not conform to `HandyJSON`/`HandyJSONEnum` or you just do not want to do the deserialization with it, you should exclude it in the mapping function.\n\n```swift\nclass NotHandyJSONType {\n    var dummy: String?\n}\n\nclass Cat: HandyJSON {\n    var id: Int64!\n    var name: String!\n    var notHandyJSONTypeProperty: NotHandyJSONType?\n    var basicTypeButNotWantedProperty: String?\n\n    required init() {}\n\n    func mapping(mapper: HelpingMapper) {\n        mapper >>> self.notHandyJSONTypeProperty\n        mapper >>> self.basicTypeButNotWantedProperty\n    }\n}\n\nlet jsonString = \"{\\\"name\\\":\\\"cat\\\",\\\"id\\\":\\\"12345\\\"}\"\n\nif let cat = Cat.deserialize(from: jsonString) {\n    print(cat)\n}\n```\n\n## Update Existing Model\n\n`HandyJSON` support updating an existing model with given json string or dictionary.\n\n```swift\nclass BasicTypes: HandyJSON {\n    var int: Int = 2\n    var doubleOptional: Double?\n    var stringImplicitlyUnwrapped: String!\n\n    required init() {}\n}\n\nvar object = BasicTypes()\nobject.int = 1\nobject.doubleOptional = 1.1\n\nlet jsonString = \"{\\\"doubleOptional\\\":2.2}\"\nJSONDeserializer.update(object: &object, from: jsonString)\nprint(object.int)\nprint(object.doubleOptional)\n```\n\n## Supported Property Type\n\n* `Int`/`Bool`/`Double`/`Float`/`String`/`NSNumber`/`NSString`\n\n* `RawRepresentable` enum\n\n* `NSArray/NSDictionary`\n\n* `Int8/Int16/Int32/Int64`/`UInt8/UInt16/UInt23/UInt64`\n\n* `Optional<T>/ImplicitUnwrappedOptional<T>` // T is one of the above types\n\n* `Array<T>` // T is one of the above types\n\n* `Dictionary<String, T>` // T is one of the above types\n\n* Nested of aboves\n\n# Serialization\n\n## The Basics\n\nNow, a class/model which need to serialize to JSON should also conform to `HandyJSON` protocol.\n\n```swift\nclass BasicTypes: HandyJSON {\n    var int: Int = 2\n    var doubleOptional: Double?\n    var stringImplicitlyUnwrapped: String!\n\n    required init() {}\n}\n\nlet object = BasicTypes()\nobject.int = 1\nobject.doubleOptional = 1.1\nobject.stringImplicitlyUnwrapped = “hello\"\n\nprint(object.toJSON()!) // serialize to dictionary\nprint(object.toJSONString()!) // serialize to JSON string\nprint(object.toJSONString(prettyPrint: true)!) // serialize to pretty JSON string\n```\n\n## Mapping And Excluding\n\nIt’s all like what we do on deserialization. A property which is excluded, it will not take part in neither deserialization nor serialization. And the mapper items define both the deserializing rules and serializing rules. Refer to the usage above.\n\n# FAQ\n\n## Q: Why the mapping function is not working in the inheritance object?\n\nA: For some reason, you should define an empty mapping function in the super class(the root class if more than one layer), and override it in the subclass.\n\nIt's the same with `didFinishMapping` function.\n\n## Q: Why my didSet/willSet is not working?\n\nA: Since `HandyJSON` assign properties by writing value to memory directly, it doesn't trigger any observing function. You need to call the `didSet/willSet` logic explicitly after/before the deserialization.\n\nBut since version `1.8.0`, `HandyJSON` handle dynamic properties by the `KVC` mechanism which will trigger the `KVO`. That means, if you do really need the `didSet/willSet`, you can define your model like follow:\n\n```swift\nclass BasicTypes: NSObject, HandyJSON {\n    dynamic var int: Int = 0 {\n        didSet {\n            print(\"oldValue: \", oldValue)\n        }\n        willSet {\n            print(\"newValue: \", newValue)\n        }\n    }\n\n    public override required init() {}\n}\n```\n\nIn this situation, `NSObject` and `dynamic` are both needed.\n\nAnd in versions since `1.8.0`, `HandyJSON` offer a `didFinishMapping` function to allow you to fill some observing logic.\n\n```swift\nclass BasicTypes: HandyJSON {\n    var int: Int?\n\n    required init() {}\n\n    func didFinishMapping() {\n        print(\"you can fill some observing logic here\")\n    }\n}\n\n```\n\nIt may help.\n\n## Q: How to support Enum property?\n\nIt your enum conform to `RawRepresentable` protocol, please look into [Support Enum Property](#support-enum-property). Or use the `EnumTransform`:\n\n```swift\nenum EnumType: String {\n    case type1, type2\n}\n\nclass BasicTypes: HandyJSON {\n    var type: EnumType?\n\n    func mapping(mapper: HelpingMapper) {\n        mapper <<<\n            type <-- EnumTransform()\n    }\n\n    required init() {}\n}\n\nlet object = BasicTypes()\nobject.type = EnumType.type2\nprint(object.toJSONString()!)\nlet mappedObject = BasicTypes.deserialize(from: object.toJSONString()!)!\nprint(mappedObject.type)\n```\n\nOtherwise, you should implement your custom mapping function.\n\n```swift\nenum EnumType {\n    case type1, type2\n}\n\nclass BasicTypes: HandyJSON {\n    var type: EnumType?\n\n    func mapping(mapper: HelpingMapper) {\n        mapper <<<\n            type <-- TransformOf<EnumType, String>(fromJSON: { (rawString) -> EnumType? in\n                if let _str = rawString {\n                    switch (_str) {\n                    case \"type1\":\n                        return EnumType.type1\n                    case \"type2\":\n                        return EnumType.type2\n                    default:\n                        return nil\n                    }\n                }\n                return nil\n            }, toJSON: { (enumType) -> String? in\n                if let _type = enumType {\n                    switch (_type) {\n                    case EnumType.type1:\n                        return \"type1\"\n                    case EnumType.type2:\n                        return \"type2\"\n                    }\n                }\n                return nil\n            })\n    }\n\n    required init() {}\n}\n```\n\n# Credit\n\n* [reflection](https://github.com/Zewo/Reflection): After the first version which used the swift mirror mechanism, HandyJSON had imported the reflection library and rewrote some code for class properties inspecting.\n* [ObjectMapper](https://github.com/tristanhimmelman/ObjectMapper): To make HandyJSON more compatible with the general style, the Mapper function support Transform which designed by ObjectMapper. And we import some testcases from ObjectMapper.\n\n# License\n\nHandyJSON is released under the Apache License, Version 2.0. See LICENSE for details.\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/AnyExtensions.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  AnyExtension.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 08/01/2017.\n//\n\nprotocol AnyExtensions {}\n\nextension AnyExtensions {\n\n    public static func isValueTypeOrSubtype(_ value: Any) -> Bool {\n        return value is Self\n    }\n\n    public static func value(from storage: UnsafeRawPointer) -> Any {\n        return storage.assumingMemoryBound(to: self).pointee\n    }\n\n    public static func write(_ value: Any, to storage: UnsafeMutableRawPointer) {\n        guard let this = value as? Self else {\n            return\n        }\n        storage.assumingMemoryBound(to: self).pointee = this\n    }\n\n    public static func takeValue(from anyValue: Any) -> Self? {\n        return anyValue as? Self\n    }\n}\n\nfunc extensions(of type: Any.Type) -> AnyExtensions.Type {\n    struct Extensions : AnyExtensions {}\n    var extensions: AnyExtensions.Type = Extensions.self\n    withUnsafePointer(to: &extensions) { pointer in\n        UnsafeMutableRawPointer(mutating: pointer).assumingMemoryBound(to: Any.Type.self).pointee = type\n    }\n    return extensions\n}\n\nfunc extensions(of value: Any) -> AnyExtensions {\n    struct Extensions : AnyExtensions {}\n    var extensions: AnyExtensions = Extensions()\n    withUnsafePointer(to: &extensions) { pointer in\n        UnsafeMutableRawPointer(mutating: pointer).assumingMemoryBound(to: Any.self).pointee = value\n    }\n    return extensions\n}\n\n/// Tests if `value` is `type` or a subclass of `type`\nfunc value(_ value: Any, is type: Any.Type) -> Bool {\n    return extensions(of: type).isValueTypeOrSubtype(value)\n}\n\n/// Tests equality of any two existential types\nfunc == (lhs: Any.Type, rhs: Any.Type) -> Bool {\n    return Metadata(type: lhs) == Metadata(type: rhs)\n}\n\n// MARK: AnyExtension + Storage\nextension AnyExtensions {\n\n    mutating func storage() -> UnsafeRawPointer {\n        if type(of: self) is AnyClass {\n            let opaquePointer = Unmanaged.passUnretained(self as AnyObject).toOpaque()\n            return UnsafeRawPointer(opaquePointer)\n        } else {\n            return withUnsafePointer(to: &self) { pointer in\n                return UnsafeRawPointer(pointer)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/BuiltInBasicType.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//  Created by zhouzhuo on 7/7/16.\n//\n\nimport Foundation\n\nprotocol _BuiltInBasicType: _Transformable {\n\n    static func _transform(from object: Any) -> Self?\n    func _plainValue() -> Any?\n}\n\n// Suppport integer type\n\nprotocol IntegerPropertyProtocol: FixedWidthInteger, _BuiltInBasicType {\n    init?(_ text: String, radix: Int)\n    init(_ number: NSNumber)\n}\n\nextension IntegerPropertyProtocol {\n\n    static func _transform(from object: Any) -> Self? {\n        switch object {\n        case let str as String:\n            return Self(str, radix: 10)\n        case let num as NSNumber:\n            return Self(num)\n        default:\n            return nil\n        }\n    }\n    \n    func _plainValue() -> Any? {\n        return self\n    }\n}\n\nextension Int: IntegerPropertyProtocol {}\nextension UInt: IntegerPropertyProtocol {}\nextension Int8: IntegerPropertyProtocol {}\nextension Int16: IntegerPropertyProtocol {}\nextension Int32: IntegerPropertyProtocol {}\nextension Int64: IntegerPropertyProtocol {}\nextension UInt8: IntegerPropertyProtocol {}\nextension UInt16: IntegerPropertyProtocol {}\nextension UInt32: IntegerPropertyProtocol {}\nextension UInt64: IntegerPropertyProtocol {}\n\nextension Bool: _BuiltInBasicType {\n\n    static func _transform(from object: Any) -> Bool? {\n        switch object {\n        case let str as NSString:\n            let lowerCase = str.lowercased\n            if [\"0\", \"false\"].contains(lowerCase) {\n                return false\n            }\n            if [\"1\", \"true\"].contains(lowerCase) {\n                return true\n            }\n            return nil\n        case let num as NSNumber:\n            return num.boolValue\n        default:\n            return nil\n        }\n    }\n\n    func _plainValue() -> Any? {\n        return self\n    }\n}\n\n// Support float type\n\nprotocol FloatPropertyProtocol: _BuiltInBasicType, LosslessStringConvertible {\n    init(_ number: NSNumber)\n}\n\nextension FloatPropertyProtocol {\n\n    static func _transform(from object: Any) -> Self? {\n        switch object {\n        case let str as String:\n            return Self(str)\n        case let num as NSNumber:\n            return Self(num)\n        default:\n            return nil\n        }\n    }\n\n    func _plainValue() -> Any? {\n        return self\n    }\n}\n\nextension Float: FloatPropertyProtocol {}\nextension Double: FloatPropertyProtocol {}\n\nfileprivate let formatter: NumberFormatter = {\n    let formatter = NumberFormatter()\n    formatter.usesGroupingSeparator = false\n    formatter.numberStyle = .decimal\n    formatter.maximumFractionDigits = 16\n    return formatter\n}()\n\nextension String: _BuiltInBasicType {\n\n    static func _transform(from object: Any) -> String? {\n        switch object {\n        case let str as String:\n            return str\n        case let num as NSNumber:\n            // Boolean Type Inside\n            if NSStringFromClass(type(of: num)) == \"__NSCFBoolean\" {\n                if num.boolValue {\n                    return \"true\"\n                } else {\n                    return \"false\"\n                }\n            }\n            return formatter.string(from: num)\n        case _ as NSNull:\n            return nil\n        default:\n            return \"\\(object)\"\n        }\n    }\n\n    func _plainValue() -> Any? {\n        return self\n    }\n}\n\n// MARK: Optional Support\n\nextension Optional: _BuiltInBasicType {\n\n    static func _transform(from object: Any) -> Optional? {\n        if let value = (Wrapped.self as? _Transformable.Type)?.transform(from: object) as? Wrapped {\n            return Optional(value)\n        } else if let value = object as? Wrapped {\n            return Optional(value)\n        }\n        return nil\n    }\n\n    func _getWrappedValue() -> Any? {\n        return self.map( { (wrapped) -> Any in\n            return wrapped as Any\n        })\n    }\n\n    func _plainValue() -> Any? {\n        if let value = _getWrappedValue() {\n            if let transformable = value as? _Transformable {\n                return transformable.plainValue()\n            } else {\n                return value\n            }\n        }\n        return nil\n    }\n}\n\n// MARK: Collection Support : Array & Set\n\nextension Collection {\n\n    static func _collectionTransform(from object: Any) -> [Iterator.Element]? {\n        guard let arr = object as? [Any] else {\n            InternalLogger.logDebug(\"Expect object to be an array but it's not\")\n            return nil\n        }\n        typealias Element = Iterator.Element\n        var result: [Element] = [Element]()\n        arr.forEach { (each) in\n            if let element = (Element.self as? _Transformable.Type)?.transform(from: each) as? Element {\n                result.append(element)\n            } else if let element = each as? Element {\n                result.append(element)\n            }\n        }\n        return result\n    }\n\n    func _collectionPlainValue() -> Any? {\n        typealias Element = Iterator.Element\n        var result: [Any] = [Any]()\n        self.forEach { (each) in\n            if let transformable = each as? _Transformable, let transValue = transformable.plainValue() {\n                result.append(transValue)\n            } else {\n                InternalLogger.logError(\"value: \\(each) isn't transformable type!\")\n            }\n        }\n        return result\n    }\n}\n\nextension Array: _BuiltInBasicType {\n\n    static func _transform(from object: Any) -> [Element]? {\n        return self._collectionTransform(from: object)\n    }\n\n    func _plainValue() -> Any? {\n        return self._collectionPlainValue()\n    }\n}\n\nextension Set: _BuiltInBasicType {\n\n    static func _transform(from object: Any) -> Set<Element>? {\n        if let arr = self._collectionTransform(from: object) {\n            return Set(arr)\n        }\n        return nil\n    }\n\n    func _plainValue() -> Any? {\n        return self._collectionPlainValue()\n    }\n}\n\n// MARK: Dictionary Support\n\nextension Dictionary: _BuiltInBasicType {\n\n    static func _transform(from object: Any) -> [Key: Value]? {\n        guard let dict = object as? [String: Any] else {\n            InternalLogger.logDebug(\"Expect object to be an NSDictionary but it's not\")\n            return nil\n        }\n        var result = [Key: Value]()\n        for (key, value) in dict {\n            if let sKey = key as? Key {\n                if let nValue = (Value.self as? _Transformable.Type)?.transform(from: value) as? Value {\n                    result[sKey] = nValue\n                } else if let nValue = value as? Value {\n                    result[sKey] = nValue\n                }\n            }\n        }\n        return result\n    }\n\n    func _plainValue() -> Any? {\n        var result = [String: Any]()\n        for (key, value) in self {\n            if let key = key as? String {\n                if let transformable = value as? _Transformable {\n                    if let transValue = transformable.plainValue() {\n                        result[key] = transValue\n                    }\n                }\n            }\n        }\n        return result\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/BuiltInBridgeType.swift",
    "content": "//\n//  BuiltInBridgeType.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 15/07/2017.\n//  Copyright © 2017 aliyun. All rights reserved.\n//\n\nimport Foundation\n\nprotocol _BuiltInBridgeType: _Transformable {\n\n    static func _transform(from object: Any) -> _BuiltInBridgeType?\n    func _plainValue() -> Any?\n}\n\nextension NSString: _BuiltInBridgeType {\n\n    static func _transform(from object: Any) -> _BuiltInBridgeType? {\n        if let str = String.transform(from: object) {\n            return NSString(string: str)\n        }\n        return nil\n    }\n\n    func _plainValue() -> Any? {\n        return self\n    }\n}\n\nextension NSNumber: _BuiltInBridgeType {\n\n    static func _transform(from object: Any) -> _BuiltInBridgeType? {\n        switch object {\n        case let num as NSNumber:\n            return num\n        case let str as NSString:\n            let lowercase = str.lowercased\n            if lowercase == \"true\" {\n                return NSNumber(booleanLiteral: true)\n            } else if lowercase == \"false\" {\n                return NSNumber(booleanLiteral: false)\n            } else {\n                // normal number\n                let formatter = NumberFormatter()\n                formatter.numberStyle = .decimal\n                return formatter.number(from: str as String)\n            }\n        default:\n            return nil\n        }\n    }\n\n    func _plainValue() -> Any? {\n        return self\n    }\n}\n\nextension NSArray: _BuiltInBridgeType {\n    \n    static func _transform(from object: Any) -> _BuiltInBridgeType? {\n        return object as? NSArray\n    }\n\n    func _plainValue() -> Any? {\n        return (self as? Array<Any>)?.plainValue()\n    }\n}\n\nextension NSDictionary: _BuiltInBridgeType {\n    \n    static func _transform(from object: Any) -> _BuiltInBridgeType? {\n        return object as? NSDictionary\n    }\n\n    func _plainValue() -> Any? {\n        return (self as? Dictionary<String, Any>)?.plainValue()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/CBridge.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  CBridge.swift\n//  HandyJSON\n//\n//  Created by chantu on 2018/7/15.\n//  Copyright © 2018 aliyun. All rights reserved.\n//\n\nimport Foundation\n\n@_silgen_name(\"swift_getTypeByMangledNameInContext\")\npublic func _getTypeByMangledNameInContext(\n    _ name: UnsafePointer<UInt8>,\n    _ nameLength: Int,\n    genericContext: UnsafeRawPointer?,\n    genericArguments: UnsafeRawPointer?)\n    -> Any.Type?\n\n\n@_silgen_name(\"swift_getTypeContextDescriptor\")\npublic func _swift_getTypeContextDescriptor(_ metadata: UnsafeRawPointer?) -> UnsafeRawPointer?\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Configuration.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  Configuration.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 08/01/2017.\n//\n\npublic struct DeserializeOptions: OptionSet {\n    public let rawValue: Int\n\n    public static let caseInsensitive = DeserializeOptions(rawValue: 1 << 0)\n\n    public static let defaultOptions: DeserializeOptions = []\n\n    public init(rawValue: Int) {\n        self.rawValue = rawValue\n    }\n}\n\npublic enum DebugMode: Int {\n    case verbose = 0\n    case debug = 1\n    case error = 2\n    case none = 3\n}\n\npublic struct HandyJSONConfiguration {\n\n    private static var _mode = DebugMode.error\n    public static var debugMode: DebugMode {\n        get {\n            return _mode\n        }\n        set {\n            _mode = newValue\n        }\n    }\n\n    public static var deserializeOptions: DeserializeOptions = .defaultOptions\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/ContextDescriptorType.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  Created by zhouzhuo on 07/01/2017.\n//\n\nprotocol ContextDescriptorType : MetadataType {\n    var contextDescriptorOffsetLocation: Int { get }\n}\n\nextension ContextDescriptorType {\n\n    var contextDescriptor: ContextDescriptorProtocol? {\n        let pointer = UnsafePointer<Int>(self.pointer)\n        let base = pointer.advanced(by: contextDescriptorOffsetLocation)\n        if base.pointee == 0 {\n            // swift class created dynamically in objc-runtime didn't have valid contextDescriptor\n            return nil\n        }\n        if self.kind == .class {\n            return ContextDescriptor<_ClassContextDescriptor>(pointer: relativePointer(base: base, offset: base.pointee - Int(bitPattern: base)))\n        } else {\n            return ContextDescriptor<_StructContextDescriptor>(pointer: relativePointer(base: base, offset: base.pointee - Int(bitPattern: base)))\n        }\n    }\n\n    var contextDescriptorPointer: UnsafeRawPointer? {\n        let pointer = UnsafePointer<Int>(self.pointer)\n        let base = pointer.advanced(by: contextDescriptorOffsetLocation)\n        if base.pointee == 0 {\n            return nil\n        }\n        return UnsafeRawPointer(bitPattern: base.pointee)\n    }\n\n//    var genericArgumentVector: UnsafeRawPointer? {\n//        let pointer = UnsafePointer<Int>(self.pointer)\n//        let base = pointer.advanced(by: 19)\n//        if base.pointee == 0 {\n//            return nil\n//        }\n//        return UnsafeRawPointer(base)\n//    }\n\n    var mangledName: String {\n        let pointer = UnsafePointer<Int>(self.pointer)\n        let base = pointer.advanced(by: contextDescriptorOffsetLocation)\n        let mangledNameAddress = base.pointee + 2 * 4 // 2 properties in front\n        if let offset = contextDescriptor?.mangledName,\n            let cString = UnsafePointer<UInt8>(bitPattern: mangledNameAddress + offset) {\n            return String(cString: cString)\n        }\n        return \"\"\n    }\n\n    var numberOfFields: Int {\n        return contextDescriptor?.numberOfFields ?? 0\n    }\n\n    var fieldOffsets: [Int]? {\n        guard let contextDescriptor = self.contextDescriptor else {\n            return nil\n        }\n        let vectorOffset = contextDescriptor.fieldOffsetVector\n        guard vectorOffset != 0 else {\n            return nil\n        }\n        if self.kind == .class {\n            return (0..<contextDescriptor.numberOfFields).map {\n                return UnsafePointer<Int>(pointer)[vectorOffset + $0]\n            }\n        } else {\n            return (0..<contextDescriptor.numberOfFields).map {\n                return Int(UnsafePointer<Int32>(pointer)[vectorOffset * (is64BitPlatform ? 2 : 1) + $0])\n            }\n        }\n    }\n\n    var reflectionFieldDescriptor: FieldDescriptor? {\n        guard let contextDescriptor = self.contextDescriptor else {\n            return nil\n        }\n        let pointer = UnsafePointer<Int>(self.pointer)\n        let base = pointer.advanced(by: contextDescriptorOffsetLocation)\n        let offset = contextDescriptor.reflectionFieldDescriptor\n        let address = base.pointee + 4 * 4 // (4 properties in front) * (sizeof Int32)\n        guard let fieldDescriptorPtr = UnsafePointer<_FieldDescriptor>(bitPattern: address + offset) else {\n            return nil\n        }\n        return FieldDescriptor(pointer: fieldDescriptorPtr)\n    }\n}\n\nprotocol ContextDescriptorProtocol {\n    var mangledName: Int { get }\n    var numberOfFields: Int { get }\n    var fieldOffsetVector: Int { get }\n    var reflectionFieldDescriptor: Int { get }\n}\n\nstruct ContextDescriptor<T: _ContextDescriptorProtocol>: ContextDescriptorProtocol, PointerType {\n\n    var pointer: UnsafePointer<T>\n\n    var mangledName: Int {\n        return Int(pointer.pointee.mangledNameOffset)\n    }\n\n    var numberOfFields: Int {\n        return Int(pointer.pointee.numberOfFields)\n    }\n\n    var fieldOffsetVector: Int {\n        return Int(pointer.pointee.fieldOffsetVector)\n    }\n\n    var fieldTypesAccessor: Int {\n        return Int(pointer.pointee.fieldTypesAccessor)\n    }\n\n    var reflectionFieldDescriptor: Int {\n        return Int(pointer.pointee.reflectionFieldDescriptor)\n    }\n}\n\nprotocol _ContextDescriptorProtocol {\n    var mangledNameOffset: Int32 { get }\n    var numberOfFields: Int32 { get }\n    var fieldOffsetVector: Int32 { get }\n    var fieldTypesAccessor: Int32 { get }\n    var reflectionFieldDescriptor: Int32 { get }\n}\n\nstruct _StructContextDescriptor: _ContextDescriptorProtocol {\n    var flags: Int32\n    var parent: Int32\n    var mangledNameOffset: Int32\n    var fieldTypesAccessor: Int32\n    var reflectionFieldDescriptor: Int32\n    var numberOfFields: Int32\n    var fieldOffsetVector: Int32\n}\n\nstruct _ClassContextDescriptor: _ContextDescriptorProtocol {\n    var flags: Int32\n    var parent: Int32\n    var mangledNameOffset: Int32\n    var fieldTypesAccessor: Int32\n    var reflectionFieldDescriptor: Int32\n    var superClsRef: Int32\n    var metadataNegativeSizeInWords: Int32\n    var metadataPositiveSizeInWords: Int32\n    var numImmediateMembers: Int32\n    var numberOfFields: Int32\n    var fieldOffsetVector: Int32\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/CustomDateFormatTransform.swift",
    "content": "//\n//  CustomDateFormatTransform.swift\n//  ObjectMapper\n//\n//  Created by Dan McCracken on 3/8/15.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class CustomDateFormatTransform: DateFormatterTransform {\n\n    public init(formatString: String) {\n\t\tlet formatter = DateFormatter()\n\t\tformatter.locale = Locale(identifier: \"en_US_POSIX\")\n\t\tformatter.dateFormat = formatString\n\n\t\tsuper.init(dateFormatter: formatter)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/DataTransform.swift",
    "content": "//\n//  DataTransform.swift\n//  ObjectMapper\n//\n//  Created by Yagrushkin, Evgeny on 8/30/16.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class DataTransform: TransformType {\n\tpublic typealias Object = Data\n\tpublic typealias JSON = String\n\n\tpublic init() {}\n\n\topen func transformFromJSON(_ value: Any?) -> Data? {\n\t\tguard let string = value as? String else{\n\t\t\treturn nil\n\t\t}\n\t\treturn Data(base64Encoded: string)\n\t}\n\n\topen func transformToJSON(_ value: Data?) -> String? {\n\t\tguard let data = value else{\n\t\t\treturn nil\n\t\t}\n\t\treturn data.base64EncodedString()\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/DateFormatterTransform.swift",
    "content": "//\n//  DateFormatterTransform.swift\n//  ObjectMapper\n//\n//  Created by Tristan Himmelman on 2015-03-09.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class DateFormatterTransform: TransformType {\n\tpublic typealias Object = Date\n\tpublic typealias JSON = String\n\n\tpublic let dateFormatter: DateFormatter\n\n\tpublic init(dateFormatter: DateFormatter) {\n\t\tself.dateFormatter = dateFormatter\n\t}\n\n\topen func transformFromJSON(_ value: Any?) -> Date? {\n\t\tif let dateString = value as? String {\n\t\t\treturn dateFormatter.date(from: dateString)\n\t\t}\n\t\treturn nil\n\t}\n\n\topen func transformToJSON(_ value: Date?) -> String? {\n\t\tif let date = value {\n\t\t\treturn dateFormatter.string(from: date)\n\t\t}\n\t\treturn nil\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/DateTransform.swift",
    "content": "//\n//  DateTransform.swift\n//  ObjectMapper\n//\n//  Created by Tristan Himmelman on 2014-10-13.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class DateTransform: TransformType {\n\tpublic typealias Object = Date\n\tpublic typealias JSON = Double\n\n\tpublic init() {}\n\n\topen func transformFromJSON(_ value: Any?) -> Date? {\n\t\tif let timeInt = value as? Double {\n\t\t\treturn Date(timeIntervalSince1970: TimeInterval(timeInt))\n\t\t}\n\n\t\tif let timeStr = value as? String {\n\t\t\treturn Date(timeIntervalSince1970: TimeInterval(atof(timeStr)))\n\t\t}\n\n\t\treturn nil\n\t}\n\n\topen func transformToJSON(_ value: Date?) -> Double? {\n\t\tif let date = value {\n\t\t\treturn Double(date.timeIntervalSince1970)\n\t\t}\n\t\treturn nil\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Deserializer.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//  Created by zhouzhuo on 7/7/16.\n//\n\nimport Foundation\n\npublic extension HandyJSON {\n\n    /// Finds the internal dictionary in `dict` as the `designatedPath` specified, and converts it to a Model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer\n    static func deserialize(from dict: NSDictionary?, designatedPath: String? = nil) -> Self? {\n        return deserialize(from: dict as? [String: Any], designatedPath: designatedPath)\n    }\n\n    /// Finds the internal dictionary in `dict` as the `designatedPath` specified, and converts it to a Model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer\n    static func deserialize(from dict: [String: Any]?, designatedPath: String? = nil) -> Self? {\n        return JSONDeserializer<Self>.deserializeFrom(dict: dict, designatedPath: designatedPath)\n    }\n\n    /// Finds the internal JSON field in `json` as the `designatedPath` specified, and converts it to a Model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer\n    static func deserialize(from json: String?, designatedPath: String? = nil) -> Self? {\n        return JSONDeserializer<Self>.deserializeFrom(json: json, designatedPath: designatedPath)\n    }\n}\n\npublic extension Array where Element: HandyJSON {\n\n    /// if the JSON field finded by `designatedPath` in `json` is representing a array, such as `[{...}, {...}, {...}]`,\n    /// this method converts it to a Models array\n    static func deserialize(from json: String?, designatedPath: String? = nil) -> [Element?]? {\n        return JSONDeserializer<Element>.deserializeModelArrayFrom(json: json, designatedPath: designatedPath)\n    }\n\n    /// deserialize model array from NSArray\n    static func deserialize(from array: NSArray?) -> [Element?]? {\n        return JSONDeserializer<Element>.deserializeModelArrayFrom(array: array)\n    }\n\n    /// deserialize model array from array\n    static func deserialize(from array: [Any]?) -> [Element?]? {\n        return JSONDeserializer<Element>.deserializeModelArrayFrom(array: array)\n    }\n}\n\npublic class JSONDeserializer<T: HandyJSON> {\n\n    /// Finds the internal dictionary in `dict` as the `designatedPath` specified, and map it to a Model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer, or nil\n    public static func deserializeFrom(dict: NSDictionary?, designatedPath: String? = nil) -> T? {\n        return deserializeFrom(dict: dict as? [String: Any], designatedPath: designatedPath)\n    }\n\n    /// Finds the internal dictionary in `dict` as the `designatedPath` specified, and map it to a Model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer, or nil\n    public static func deserializeFrom(dict: [String: Any]?, designatedPath: String? = nil) -> T? {\n        var targetDict = dict\n        if let path = designatedPath {\n            targetDict = getInnerObject(inside: targetDict, by: path) as? [String: Any]\n        }\n        if let _dict = targetDict {\n            return T._transform(dict: _dict) as? T\n        }\n        return nil\n    }\n\n    /// Finds the internal JSON field in `json` as the `designatedPath` specified, and converts it to Model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer, or nil\n    public static func deserializeFrom(json: String?, designatedPath: String? = nil) -> T? {\n        guard let _json = json else {\n            return nil\n        }\n        do {\n            let jsonObject = try JSONSerialization.jsonObject(with: _json.data(using: String.Encoding.utf8)!, options: .allowFragments)\n            if let jsonDict = jsonObject as? NSDictionary {\n                return self.deserializeFrom(dict: jsonDict, designatedPath: designatedPath)\n            }\n        } catch let error {\n            InternalLogger.logError(error)\n        }\n        return nil\n    }\n\n    /// Finds the internal dictionary in `dict` as the `designatedPath` specified, and use it to reassign an exist model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer, or nil\n    public static func update(object: inout T, from dict: [String: Any]?, designatedPath: String? = nil) {\n        var targetDict = dict\n        if let path = designatedPath {\n            targetDict = getInnerObject(inside: targetDict, by: path) as? [String: Any]\n        }\n        if let _dict = targetDict {\n            T._transform(dict: _dict, to: &object)\n        }\n    }\n\n    /// Finds the internal JSON field in `json` as the `designatedPath` specified, and use it to reassign an exist model\n    /// `designatedPath` is a string like `result.data.orderInfo`, which each element split by `.` represents key of each layer, or nil\n    public static func update(object: inout T, from json: String?, designatedPath: String? = nil) {\n        guard let _json = json else {\n            return\n        }\n        do {\n            let jsonObject = try JSONSerialization.jsonObject(with: _json.data(using: String.Encoding.utf8)!, options: .allowFragments)\n            if let jsonDict = jsonObject as? [String: Any] {\n                update(object: &object, from: jsonDict, designatedPath: designatedPath)\n            }\n        } catch let error {\n            InternalLogger.logError(error)\n        }\n    }\n\n    /// if the JSON field found by `designatedPath` in `json` is representing a array, such as `[{...}, {...}, {...}]`,\n    /// this method converts it to a Models array\n    public static func deserializeModelArrayFrom(json: String?, designatedPath: String? = nil) -> [T?]? {\n        guard let _json = json else {\n            return nil\n        }\n        do {\n            let jsonObject = try JSONSerialization.jsonObject(with: _json.data(using: String.Encoding.utf8)!, options: .allowFragments)\n            if let jsonArray = getInnerObject(inside: jsonObject, by: designatedPath) as? [Any] {\n                return jsonArray.map({ (item) -> T? in\n                    return self.deserializeFrom(dict: item as? [String: Any])\n                })\n            }\n        } catch let error {\n            InternalLogger.logError(error)\n        }\n        return nil\n    }\n\n    /// mapping raw array to Models array\n    public static func deserializeModelArrayFrom(array: NSArray?) -> [T?]? {\n        return deserializeModelArrayFrom(array: array as? [Any])\n    }\n\n    /// mapping raw array to Models array\n    public static func deserializeModelArrayFrom(array: [Any]?) -> [T?]? {\n        guard let _arr = array else {\n            return nil\n        }\n        return _arr.map({ (item) -> T? in\n            return self.deserializeFrom(dict: item as? NSDictionary)\n        })\n    }\n}\n\nfileprivate func getInnerObject(inside object: Any?, by designatedPath: String?) -> Any? {\n    var result: Any? = object\n    var abort = false\n    if let paths = designatedPath?.components(separatedBy: \".\"), paths.count > 0 {\n        var next = object as? [String: Any]\n        paths.forEach({ (seg) in\n            if seg.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) == \"\" || abort {\n                return\n            }\n            if let _next = next?[seg] {\n                result = _next\n                next = _next as? [String: Any]\n            } else {\n                abort = true\n            }\n        })\n    }\n    return abort ? nil : result\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/EnumTransform.swift",
    "content": "//\n//  EnumTransform.swift\n//  ObjectMapper\n//\n//  Created by Kaan Dedeoglu on 3/20/15.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class EnumTransform<T: RawRepresentable>: TransformType {\n\tpublic typealias Object = T\n\tpublic typealias JSON = T.RawValue\n\n\tpublic init() {}\n\n\topen func transformFromJSON(_ value: Any?) -> T? {\n\t\tif let raw = value as? T.RawValue {\n\t\t\treturn T(rawValue: raw)\n\t\t}\n\t\treturn nil\n\t}\n\n\topen func transformToJSON(_ value: T?) -> T.RawValue? {\n\t\tif let obj = value {\n\t\t\treturn obj.rawValue\n\t\t}\n\t\treturn nil\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/EnumType.swift",
    "content": "//\n//  EnumType.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 16/07/2017.\n//  Copyright © 2017 aliyun. All rights reserved.\n//\n\nimport Foundation\n\npublic protocol _RawEnumProtocol: _Transformable {\n\n    static func _transform(from object: Any) -> Self?\n    func _plainValue() -> Any?\n}\n\nextension RawRepresentable where Self: _RawEnumProtocol {\n\n    public static func _transform(from object: Any) -> Self? {\n        if let transformableType = RawValue.self as? _Transformable.Type {\n            if let typedValue = transformableType.transform(from: object) {\n                return Self(rawValue: typedValue as! RawValue)\n            }\n        }\n        return nil\n    }\n\n    public func _plainValue() -> Any? {\n        return self.rawValue\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Export.swift",
    "content": "//\n//  Export.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 16/07/2017.\n//  Copyright © 2017 aliyun. All rights reserved.\n//\n\nimport Foundation\n\npublic protocol HandyJSONCustomTransformable: _ExtendCustomBasicType {}\n\npublic protocol HandyJSON: _ExtendCustomModelType {}\n\npublic protocol HandyJSONEnum: _RawEnumProtocol {}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/ExtendCustomBasicType.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  ExtendCustomBasicType.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 05/09/2017.\n//\n\npublic protocol _ExtendCustomBasicType: _Transformable {\n\n    static func _transform(from object: Any) -> Self?\n    func _plainValue() -> Any?\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/ExtendCustomModelType.swift",
    "content": "//\n//  ExtendCustomType.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 16/07/2017.\n//  Copyright © 2017 aliyun. All rights reserved.\n//\n\nimport Foundation\n\npublic protocol _ExtendCustomModelType: _Transformable {\n    init()\n    mutating func willStartMapping()\n    mutating func mapping(mapper: HelpingMapper)\n    mutating func didFinishMapping()\n}\n\nextension _ExtendCustomModelType {\n\n    public mutating func willStartMapping() {}\n    public mutating func mapping(mapper: HelpingMapper) {}\n    public mutating func didFinishMapping() {}\n}\n\nfileprivate func convertKeyIfNeeded(dict: [String: Any]) -> [String: Any] {\n    if HandyJSONConfiguration.deserializeOptions.contains(.caseInsensitive) {\n        var newDict = [String: Any]()\n        dict.forEach({ (kvPair) in\n            let (key, value) = kvPair\n            newDict[key.lowercased()] = value\n        })\n        return newDict\n    }\n    return dict\n}\n\nfileprivate func getRawValueFrom(dict: [String: Any], property: PropertyInfo, mapper: HelpingMapper) -> Any? {\n    let address = Int(bitPattern: property.address)\n    if let mappingHandler = mapper.getMappingHandler(key: address) {\n        if let mappingPaths = mappingHandler.mappingPaths, mappingPaths.count > 0 {\n            for mappingPath in mappingPaths {\n                if let _value = dict.findValueBy(path: mappingPath) {\n                    return _value\n                }\n            }\n            return nil\n        }\n    }\n    if HandyJSONConfiguration.deserializeOptions.contains(.caseInsensitive) {\n        return dict[property.key.lowercased()]\n    }\n    return dict[property.key]\n}\n\nfileprivate func convertValue(rawValue: Any, property: PropertyInfo, mapper: HelpingMapper) -> Any? {\n    if rawValue is NSNull { return nil }\n    if let mappingHandler = mapper.getMappingHandler(key: Int(bitPattern: property.address)), let transformer = mappingHandler.assignmentClosure {\n        return transformer(rawValue)\n    }\n    if let transformableType = property.type as? _Transformable.Type {\n        return transformableType.transform(from: rawValue)\n    } else {\n        return extensions(of: property.type).takeValue(from: rawValue)\n    }\n}\n\nfileprivate func assignProperty(convertedValue: Any, instance: _ExtendCustomModelType, property: PropertyInfo) {\n    if property.bridged {\n        (instance as! NSObject).setValue(convertedValue, forKey: property.key)\n    } else {\n        extensions(of: property.type).write(convertedValue, to: property.address)\n    }\n}\n\nfileprivate func readAllChildrenFrom(mirror: Mirror) -> [(String, Any)] {\n    var children = [(label: String?, value: Any)]()\n    let mirrorChildrenCollection = AnyRandomAccessCollection(mirror.children)!\n    children += mirrorChildrenCollection\n\n    var currentMirror = mirror\n    while let superclassChildren = currentMirror.superclassMirror?.children {\n        let randomCollection = AnyRandomAccessCollection(superclassChildren)!\n        children += randomCollection\n        currentMirror = currentMirror.superclassMirror!\n    }\n    var result = [(String, Any)]()\n    children.forEach { (child) in\n        if let _label = child.label {\n            result.append((_label, child.value))\n        }\n    }\n    return result\n}\n\nfileprivate func merge(children: [(String, Any)], propertyInfos: [PropertyInfo]) -> [String: (Any, PropertyInfo?)] {\n    var infoDict = [String: PropertyInfo]()\n    propertyInfos.forEach { (info) in\n        infoDict[info.key] = info\n    }\n\n    var result = [String: (Any, PropertyInfo?)]()\n    children.forEach { (child) in\n        result[child.0] = (child.1, infoDict[child.0])\n    }\n    return result\n}\n\n// this's a workaround before https://bugs.swift.org/browse/SR-5223 fixed\nextension NSObject {\n    static func createInstance() -> NSObject {\n        return self.init()\n    }\n}\n\nextension _ExtendCustomModelType {\n\n    static func _transform(from object: Any) -> Self? {\n        if let dict = object as? [String: Any] {\n            // nested object, transform recursively\n            return self._transform(dict: dict) as? Self\n        }\n        return nil\n    }\n\n    static func _transform(dict: [String: Any]) -> _ExtendCustomModelType? {\n\n        var instance: Self\n        if let _nsType = Self.self as? NSObject.Type {\n            instance = _nsType.createInstance() as! Self\n        } else {\n            instance = Self.init()\n        }\n        instance.willStartMapping()\n        _transform(dict: dict, to: &instance)\n        instance.didFinishMapping()\n        return instance\n    }\n\n    static func _transform(dict: [String: Any], to instance: inout Self) {\n        guard let properties = getProperties(forType: Self.self) else {\n            InternalLogger.logDebug(\"Failed when try to get properties from type: \\(type(of: Self.self))\")\n            return\n        }\n\n        // do user-specified mapping first\n        let mapper = HelpingMapper()\n        instance.mapping(mapper: mapper)\n\n        // get head addr\n        let rawPointer = instance.headPointer()\n        InternalLogger.logVerbose(\"instance start at: \", Int(bitPattern: rawPointer))\n\n        // process dictionary\n        let _dict = convertKeyIfNeeded(dict: dict)\n\n        let instanceIsNsObject = instance.isNSObjectType()\n        let bridgedPropertyList = instance.getBridgedPropertyList()\n\n        for property in properties {\n            let isBridgedProperty = instanceIsNsObject && bridgedPropertyList.contains(property.key)\n\n            let propAddr = rawPointer.advanced(by: property.offset)\n            InternalLogger.logVerbose(property.key, \"address at: \", Int(bitPattern: propAddr))\n            if mapper.propertyExcluded(key: Int(bitPattern: propAddr)) {\n                InternalLogger.logDebug(\"Exclude property: \\(property.key)\")\n                continue\n            }\n\n            let propertyDetail = PropertyInfo(key: property.key, type: property.type, address: propAddr, bridged: isBridgedProperty)\n            InternalLogger.logVerbose(\"field: \", property.key, \"  offset: \", property.offset, \"  isBridgeProperty: \", isBridgedProperty)\n\n            if let rawValue = getRawValueFrom(dict: _dict, property: propertyDetail, mapper: mapper) {\n                if let convertedValue = convertValue(rawValue: rawValue, property: propertyDetail, mapper: mapper) {\n                    assignProperty(convertedValue: convertedValue, instance: instance, property: propertyDetail)\n                    continue\n                }\n            }\n            InternalLogger.logDebug(\"Property: \\(property.key) hasn't been written in\")\n        }\n    }\n}\n\nextension _ExtendCustomModelType {\n\n    func _plainValue() -> Any? {\n        return Self._serializeAny(object: self)\n    }\n\n    static func _serializeAny(object: _Transformable) -> Any? {\n\n        let mirror = Mirror(reflecting: object)\n\n        guard let displayStyle = mirror.displayStyle else {\n            return object.plainValue()\n        }\n\n        // after filtered by protocols above, now we expect the type is pure struct/class\n        switch displayStyle {\n        case .class, .struct:\n            let mapper = HelpingMapper()\n            // do user-specified mapping first\n            if !(object is _ExtendCustomModelType) {\n                InternalLogger.logDebug(\"This model of type: \\(type(of: object)) is not mappable but is class/struct type\")\n                return object\n            }\n\n            let children = readAllChildrenFrom(mirror: mirror)\n\n            guard let properties = getProperties(forType: type(of: object)) else {\n                InternalLogger.logError(\"Can not get properties info for type: \\(type(of: object))\")\n                return nil\n            }\n\n            var mutableObject = object as! _ExtendCustomModelType\n            let instanceIsNsObject = mutableObject.isNSObjectType()\n            let head = mutableObject.headPointer()\n            let bridgedProperty = mutableObject.getBridgedPropertyList()\n            let propertyInfos = properties.map({ (desc) -> PropertyInfo in\n                return PropertyInfo(key: desc.key, type: desc.type, address: head.advanced(by: desc.offset),\n                                        bridged: instanceIsNsObject && bridgedProperty.contains(desc.key))\n            })\n\n            mutableObject.mapping(mapper: mapper)\n\n            let requiredInfo = merge(children: children, propertyInfos: propertyInfos)\n\n            return _serializeModelObject(instance: mutableObject, properties: requiredInfo, mapper: mapper) as Any\n        default:\n            return object.plainValue()\n        }\n    }\n\n    static func _serializeModelObject(instance: _ExtendCustomModelType, properties: [String: (Any, PropertyInfo?)], mapper: HelpingMapper) -> [String: Any] {\n\n        var dict = [String: Any]()\n        for (key, property) in properties {\n            var realKey = key\n            var realValue = property.0\n\n            if let info = property.1 {\n                if info.bridged, let _value = (instance as! NSObject).value(forKey: key) {\n                    realValue = _value\n                }\n\n                if mapper.propertyExcluded(key: Int(bitPattern: info.address)) {\n                    continue\n                }\n\n                if let mappingHandler = mapper.getMappingHandler(key: Int(bitPattern: info.address)) {\n                    // if specific key is set, replace the label\n                    if let mappingPaths = mappingHandler.mappingPaths, mappingPaths.count > 0 {\n                        // take the first path, last segment if more than one\n                        realKey = mappingPaths[0].segments.last!\n                    }\n\n                    if let transformer = mappingHandler.takeValueClosure {\n                        if let _transformedValue = transformer(realValue) {\n                            dict[realKey] = _transformedValue\n                        }\n                        continue\n                    }\n                }\n            }\n\n            if let typedValue = realValue as? _Transformable {\n                if let result = self._serializeAny(object: typedValue) {\n                    dict[realKey] = result\n                    continue\n                }\n            }\n\n            InternalLogger.logDebug(\"The value for key: \\(key) is not transformable type\")\n        }\n        return dict\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/FieldDescriptor.swift",
    "content": "//\n//  FieldDescriptor.swift\n//  HandyJSON\n//\n//  Created by chantu on 2019/1/31.\n//  Copyright © 2019 aliyun. All rights reserved.\n//\n\nimport Foundation\n\nenum FieldDescriptorKind : UInt16 {\n    // Swift nominal types.\n    case Struct = 0\n    case Class\n    case Enum\n\n    // Fixed-size multi-payload enums have a special descriptor format that\n    // encodes spare bits.\n    //\n    // FIXME: Actually implement this. For now, a descriptor with this kind\n    // just means we also have a builtin descriptor from which we get the\n    // size and alignment.\n    case MultiPayloadEnum\n\n    // A Swift opaque protocol. There are no fields, just a record for the\n    // type itself.\n    case `Protocol`\n\n    // A Swift class-bound protocol.\n    case ClassProtocol\n\n    // An Objective-C protocol, which may be imported or defined in Swift.\n    case ObjCProtocol\n\n    // An Objective-C class, which may be imported or defined in Swift.\n    // In the former case, field type metadata is not emitted, and\n    // must be obtained from the Objective-C runtime.\n    case ObjCClass\n}\n\nstruct FieldDescriptor: PointerType {\n\n    var pointer: UnsafePointer<_FieldDescriptor>\n\n    var fieldRecordSize: Int {\n        return Int(pointer.pointee.fieldRecordSize)\n    }\n\n    var numFields: Int {\n        return Int(pointer.pointee.numFields)\n    }\n\n    var fieldRecords: [FieldRecord] {\n        return (0..<numFields).map({ (i) -> FieldRecord in\n            return FieldRecord(pointer: UnsafePointer<_FieldRecord>(pointer + 1) + i)\n        })\n    }\n}\n\nstruct _FieldDescriptor {\n    var mangledTypeNameOffset: Int32\n    var superClassOffset: Int32\n    var fieldDescriptorKind: FieldDescriptorKind\n    var fieldRecordSize: Int16\n    var numFields: Int32\n}\n\nstruct FieldRecord: PointerType {\n\n    var pointer: UnsafePointer<_FieldRecord>\n\n    var fieldRecordFlags: Int {\n        return Int(pointer.pointee.fieldRecordFlags)\n    }\n\n    var mangledTypeName: UnsafePointer<UInt8>? {\n        let address = Int(bitPattern: pointer) + 1 * 4\n        let offset = Int(pointer.pointee.mangledTypeNameOffset)\n        let cString = UnsafePointer<UInt8>(bitPattern: address + offset)\n        return cString\n    }\n\n    var fieldName: String {\n        let address = Int(bitPattern: pointer) + 2 * 4\n        let offset = Int(pointer.pointee.fieldNameOffset)\n        if let cString = UnsafePointer<UInt8>(bitPattern: address + offset) {\n            return String(cString: cString)\n        }\n        return \"\"\n    }\n}\n\nstruct _FieldRecord {\n    var fieldRecordFlags: Int32\n    var mangledTypeNameOffset: Int32\n    var fieldNameOffset: Int32\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/HandyJSON.h",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//  Created by zhouzhuo on 7/11/16.\n//\n\n@import Foundation;\n\n//! Project version number for HandyJSON.\nFOUNDATION_EXPORT double HandyJSONVersionNumber;\n\n//! Project version string for HandyJSON.\nFOUNDATION_EXPORT const unsigned char HandyJSONVersionString[];\n\n// In this header, you should import all the public headers of your framework using statements like #import <HandyJSON/PublicHeader.h>\n\n\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/HelpingMapper.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//  Created by zhouzhuo on 9/20/16.\n//\n\nimport Foundation\n\npublic typealias CustomMappingKeyValueTuple = (Int, MappingPropertyHandler)\n\nstruct MappingPath {\n    var segments: [String]\n\n    static func buildFrom(rawPath: String) -> MappingPath {\n        let regex = try! NSRegularExpression(pattern: \"(?<![\\\\\\\\])\\\\.\")\n        let nsString = rawPath as NSString\n        let results = regex.matches(in: rawPath, range: NSRange(location: 0, length: nsString.length))\n        var splitPoints = results.map { $0.range.location }\n\n        var curPos = 0\n        var pathArr = [String]()\n        splitPoints.append(nsString.length)\n        splitPoints.forEach({ (point) in\n            let start = rawPath.index(rawPath.startIndex, offsetBy: curPos)\n            let end = rawPath.index(rawPath.startIndex, offsetBy: point)\n            let subPath = String(rawPath[start ..< end]).replacingOccurrences(of: \"\\\\.\", with: \".\")\n            if !subPath.isEmpty {\n                pathArr.append(subPath)\n            }\n            curPos = point + 1\n        })\n        return MappingPath(segments: pathArr)\n    }\n}\n\nextension Dictionary where Key == String, Value: Any {\n\n    func findValueBy(path: MappingPath) -> Any? {\n        var currentDict: [String: Any]? = self\n        var lastValue: Any?\n        path.segments.forEach { (segment) in\n            lastValue = currentDict?[segment]\n            currentDict = currentDict?[segment] as? [String: Any]\n        }\n        return lastValue\n    }\n}\n\npublic class MappingPropertyHandler {\n    var mappingPaths: [MappingPath]?\n    var assignmentClosure: ((Any?) -> (Any?))?\n    var takeValueClosure: ((Any?) -> (Any?))?\n    \n    public init(rawPaths: [String]?, assignmentClosure: ((Any?) -> (Any?))?, takeValueClosure: ((Any?) -> (Any?))?) {\n        let mappingPaths = rawPaths?.map({ (rawPath) -> MappingPath in\n            if HandyJSONConfiguration.deserializeOptions.contains(.caseInsensitive) {\n                return MappingPath.buildFrom(rawPath: rawPath.lowercased())\n            }\n            return MappingPath.buildFrom(rawPath: rawPath)\n        }).filter({ (mappingPath) -> Bool in\n            return mappingPath.segments.count > 0\n        })\n        if let count = mappingPaths?.count, count > 0 {\n            self.mappingPaths = mappingPaths\n        }\n        self.assignmentClosure = assignmentClosure\n        self.takeValueClosure = takeValueClosure\n    }\n}\n\npublic class HelpingMapper {\n    \n    private var mappingHandlers = [Int: MappingPropertyHandler]()\n    private var excludeProperties = [Int]()\n    \n    internal func getMappingHandler(key: Int) -> MappingPropertyHandler? {\n        return self.mappingHandlers[key]\n    }\n    \n    internal func propertyExcluded(key: Int) -> Bool {\n        return self.excludeProperties.contains(key)\n    }\n    \n    public func specify<T>(property: inout T, name: String) {\n        self.specify(property: &property, name: name, converter: nil)\n    }\n    \n    public func specify<T>(property: inout T, converter: @escaping (String) -> T) {\n        self.specify(property: &property, name: nil, converter: converter)\n    }\n    \n    public func specify<T>(property: inout T, name: String?, converter: ((String) -> T)?) {\n        let pointer = withUnsafePointer(to: &property, { return $0 })\n        let key = Int(bitPattern: pointer)\n        let names = (name == nil ? nil : [name!])\n        \n        if let _converter = converter {\n            let assignmentClosure = { (jsonValue: Any?) -> Any? in\n                if let _value = jsonValue{\n                    if let object = _value as? NSObject {\n                        if let str = String.transform(from: object){\n                            return _converter(str)\n                        }\n                    }\n                }\n                return nil\n            }\n            self.mappingHandlers[key] = MappingPropertyHandler(rawPaths: names, assignmentClosure: assignmentClosure, takeValueClosure: nil)\n        } else {\n            self.mappingHandlers[key] = MappingPropertyHandler(rawPaths: names, assignmentClosure: nil, takeValueClosure: nil)\n        }\n    }\n    \n    public func exclude<T>(property: inout T) {\n        self._exclude(property: &property)\n    }\n    \n    fileprivate func addCustomMapping(key: Int, mappingInfo: MappingPropertyHandler) {\n        self.mappingHandlers[key] = mappingInfo\n    }\n    \n    fileprivate func _exclude<T>(property: inout T) {\n        let pointer = withUnsafePointer(to: &property, { return $0 })\n        self.excludeProperties.append(Int(bitPattern: pointer))\n    }\n}\n\ninfix operator <-- : LogicalConjunctionPrecedence\n\npublic func <-- <T>(property: inout T, name: String) -> CustomMappingKeyValueTuple {\n    return property <-- [name]\n}\n\npublic func <-- <T>(property: inout T, names: [String]) -> CustomMappingKeyValueTuple {\n    let pointer = withUnsafePointer(to: &property, { return $0 })\n    let key = Int(bitPattern: pointer)\n    return (key, MappingPropertyHandler(rawPaths: names, assignmentClosure: nil, takeValueClosure: nil))\n}\n\n// MARK: non-optional properties\npublic func <-- <Transform: TransformType>(property: inout Transform.Object, transformer: Transform) -> CustomMappingKeyValueTuple {\n    return property <-- (nil, transformer)\n}\n\npublic func <-- <Transform: TransformType>(property: inout Transform.Object, transformer: (String?, Transform?)) -> CustomMappingKeyValueTuple {\n    let names = (transformer.0 == nil ? [] : [transformer.0!])\n    return property <-- (names, transformer.1)\n}\n\npublic func <-- <Transform: TransformType>(property: inout Transform.Object, transformer: ([String], Transform?)) -> CustomMappingKeyValueTuple {\n    let pointer = withUnsafePointer(to: &property, { return $0 })\n    let key = Int(bitPattern: pointer)\n    let assignmentClosure = { (jsonValue: Any?) -> Transform.Object? in\n        return transformer.1?.transformFromJSON(jsonValue)\n    }\n    let takeValueClosure = { (objectValue: Any?) -> Any? in\n        if let _value = objectValue as? Transform.Object {\n            return transformer.1?.transformToJSON(_value) as Any\n        }\n        return nil\n    }\n    return (key, MappingPropertyHandler(rawPaths: transformer.0, assignmentClosure: assignmentClosure, takeValueClosure: takeValueClosure))\n}\n\n// MARK: optional properties\npublic func <-- <Transform: TransformType>(property: inout Transform.Object?, transformer: Transform) -> CustomMappingKeyValueTuple {\n    return property <-- (nil, transformer)\n}\n\npublic func <-- <Transform: TransformType>(property: inout Transform.Object?, transformer: (String?, Transform?)) -> CustomMappingKeyValueTuple {\n    let names = (transformer.0 == nil ? [] : [transformer.0!])\n    return property <-- (names, transformer.1)\n}\n\npublic func <-- <Transform: TransformType>(property: inout Transform.Object?, transformer: ([String], Transform?)) -> CustomMappingKeyValueTuple {\n    let pointer = withUnsafePointer(to: &property, { return $0 })\n    let key = Int(bitPattern: pointer)\n    let assignmentClosure = { (jsonValue: Any?) -> Any? in\n        return transformer.1?.transformFromJSON(jsonValue)\n    }\n    let takeValueClosure = { (objectValue: Any?) -> Any? in\n        if let _value = objectValue as? Transform.Object {\n            return transformer.1?.transformToJSON(_value) as Any\n        }\n        return nil\n    }\n    return (key, MappingPropertyHandler(rawPaths: transformer.0, assignmentClosure: assignmentClosure, takeValueClosure: takeValueClosure))\n}\n\ninfix operator <<< : AssignmentPrecedence\n\npublic func <<< (mapper: HelpingMapper, mapping: CustomMappingKeyValueTuple) {\n    mapper.addCustomMapping(key: mapping.0, mappingInfo: mapping.1)\n}\n\npublic func <<< (mapper: HelpingMapper, mappings: [CustomMappingKeyValueTuple]) {\n    mappings.forEach { (mapping) in\n        mapper.addCustomMapping(key: mapping.0, mappingInfo: mapping.1)\n    }\n}\n\ninfix operator >>> : AssignmentPrecedence\n\npublic func >>> <T> (mapper: HelpingMapper, property: inout T) {\n    mapper._exclude(property: &property)\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/HexColorTransform.swift",
    "content": "//\n//  HexColorTransform.swift\n//  ObjectMapper\n//\n//  Created by Vitaliy Kuzmenko on 10/10/16.\n//  Copyright © 2016 hearst. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS) || os(watchOS)\nimport UIKit\n#else\nimport Cocoa\n#endif\n\nopen class HexColorTransform: TransformType {\n\n\t#if os(iOS) || os(tvOS) || os(watchOS)\n\tpublic typealias Object = UIColor\n\t#else\n\tpublic typealias Object = NSColor\n\t#endif\n\n\tpublic typealias JSON = String\n\n\tvar prefix: Bool = false\n\n\tvar alpha: Bool = false\n\n\tpublic init(prefixToJSON: Bool = false, alphaToJSON: Bool = false) {\n\t\talpha = alphaToJSON\n\t\tprefix = prefixToJSON\n\t}\n\n\topen func transformFromJSON(_ value: Any?) -> Object? {\n\t\tif let rgba = value as? String {\n\t\t\tif rgba.hasPrefix(\"#\") {\n\t\t\t\tlet index = rgba.index(rgba.startIndex, offsetBy: 1)\n\t\t\t\tlet hex = String(rgba[index...])\n\t\t\t\treturn getColor(hex: hex)\n\t\t\t} else {\n\t\t\t\treturn getColor(hex: rgba)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\topen func transformToJSON(_ value: Object?) -> JSON? {\n\t\tif let value = value {\n\t\t\treturn hexString(color: value)\n\t\t}\n\t\treturn nil\n\t}\n\n\tfileprivate func hexString(color: Object) -> String {\n\t\tlet comps = color.cgColor.components!\n\t\tlet r = Int(comps[0] * 255)\n\t\tlet g = Int(comps[1] * 255)\n\t\tlet b = Int(comps[2] * 255)\n\t\tlet a = Int(comps[3] * 255)\n\t\tvar hexString: String = \"\"\n\t\tif prefix {\n\t\t\thexString = \"#\"\n\t\t}\n\t\thexString += String(format: \"%02X%02X%02X\", r, g, b)\n\n\t\tif alpha {\n\t\t\thexString += String(format: \"%02X\", a)\n\t\t}\n\t\treturn hexString\n\t}\n\n\tfileprivate func getColor(hex: String) -> Object? {\n\t\tvar red: CGFloat   = 0.0\n\t\tvar green: CGFloat = 0.0\n\t\tvar blue: CGFloat  = 0.0\n\t\tvar alpha: CGFloat = 1.0\n\n\t\tlet scanner = Scanner(string: hex)\n\t\tvar hexValue: CUnsignedLongLong = 0\n\t\tif scanner.scanHexInt64(&hexValue) {\n\t\t\tswitch (hex.count) {\n\t\t\tcase 3:\n\t\t\t\tred   = CGFloat((hexValue & 0xF00) >> 8)       / 15.0\n\t\t\t\tgreen = CGFloat((hexValue & 0x0F0) >> 4)       / 15.0\n\t\t\t\tblue  = CGFloat(hexValue & 0x00F)              / 15.0\n\t\t\tcase 4:\n\t\t\t\tred   = CGFloat((hexValue & 0xF000) >> 12)     / 15.0\n\t\t\t\tgreen = CGFloat((hexValue & 0x0F00) >> 8)      / 15.0\n\t\t\t\tblue  = CGFloat((hexValue & 0x00F0) >> 4)      / 15.0\n\t\t\t\talpha = CGFloat(hexValue & 0x000F)             / 15.0\n\t\t\tcase 6:\n\t\t\t\tred   = CGFloat((hexValue & 0xFF0000) >> 16)   / 255.0\n\t\t\t\tgreen = CGFloat((hexValue & 0x00FF00) >> 8)    / 255.0\n\t\t\t\tblue  = CGFloat(hexValue & 0x0000FF)           / 255.0\n\t\t\tcase 8:\n\t\t\t\tred   = CGFloat((hexValue & 0xFF000000) >> 24) / 255.0\n\t\t\t\tgreen = CGFloat((hexValue & 0x00FF0000) >> 16) / 255.0\n\t\t\t\tblue  = CGFloat((hexValue & 0x0000FF00) >> 8)  / 255.0\n\t\t\t\talpha = CGFloat(hexValue & 0x000000FF)         / 255.0\n\t\t\tdefault:\n\t\t\t\t// Invalid RGB string, number of characters after '#' should be either 3, 4, 6 or 8\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\t// \"Scan hex error\n\t\t\treturn nil\n\t\t}\n\t\t#if os(iOS) || os(tvOS) || os(watchOS)\n\t\t\treturn UIColor(red: red, green: green, blue: blue, alpha: alpha)\n\t\t#else\n\t\t\treturn NSColor(calibratedRed: red, green: green, blue: blue, alpha: alpha)\n\t\t#endif\n\t}\n}\n\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/ISO8601DateTransform.swift",
    "content": "//\n//  ISO8601DateTransform.swift\n//  ObjectMapper\n//\n//  Created by Jean-Pierre Mouilleseaux on 21 Nov 2014.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class ISO8601DateTransform: DateFormatterTransform {\n\n\tpublic init() {\n\t\tlet formatter = DateFormatter()\n\t\tformatter.locale = Locale(identifier: \"en_US_POSIX\")\n\t\tformatter.dateFormat = \"yyyy-MM-dd'T'HH:mm:ssZZZZZ\"\n\n\t\tsuper.init(dateFormatter: formatter)\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Logger.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  Logger.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 08/01/2017.\n//\n\nstruct InternalLogger {\n\n    static func logError(_ items: Any..., separator: String = \" \", terminator: String = \"\\n\") {\n        if HandyJSONConfiguration.debugMode.rawValue <= DebugMode.error.rawValue {\n            print(items, separator: separator, terminator: terminator)\n        }\n    }\n\n    static func logDebug(_ items: Any..., separator: String = \" \", terminator: String = \"\\n\") {\n        if HandyJSONConfiguration.debugMode.rawValue <= DebugMode.debug.rawValue {\n            print(items, separator: separator, terminator: terminator)\n        }\n    }\n\n    static func logVerbose(_ items: Any..., separator: String = \" \", terminator: String = \"\\n\") {\n        if HandyJSONConfiguration.debugMode.rawValue <= DebugMode.verbose.rawValue {\n            print(items, separator: separator, terminator: terminator)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/MangledName.swift",
    "content": "//\n//  MangledName.swift\n//  HandyJSON\n//\n//  Created by chantu on 2019/2/2.\n//  Copyright © 2019 aliyun. All rights reserved.\n//\n\nimport Foundation\n\n // mangled name might contain 0 but it is not the end, do not just use strlen\nfunc getMangledTypeNameSize(_ mangledName: UnsafePointer<UInt8>) -> Int {\n    // TODO: should find the actually size \n    return 256\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Measuable.swift",
    "content": "//\n//  Measuable.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 15/07/2017.\n//  Copyright © 2017 aliyun. All rights reserved.\n//\n\nimport Foundation\n\ntypealias Byte = Int8\n\npublic protocol _Measurable {}\n\nextension _Measurable {\n\n    // locate the head of a struct type object in memory\n    mutating func headPointerOfStruct() -> UnsafeMutablePointer<Byte> {\n\n        return withUnsafeMutablePointer(to: &self) {\n            return UnsafeMutableRawPointer($0).bindMemory(to: Byte.self, capacity: MemoryLayout<Self>.stride)\n        }\n    }\n\n    // locating the head of a class type object in memory\n    mutating func headPointerOfClass() -> UnsafeMutablePointer<Byte> {\n\n        let opaquePointer = Unmanaged.passUnretained(self as AnyObject).toOpaque()\n        let mutableTypedPointer = opaquePointer.bindMemory(to: Byte.self, capacity: MemoryLayout<Self>.stride)\n        return UnsafeMutablePointer<Byte>(mutableTypedPointer)\n    }\n\n    // locating the head of an object\n    mutating func headPointer() -> UnsafeMutablePointer<Byte> {\n        if Self.self is AnyClass {\n            return self.headPointerOfClass()\n        } else {\n            return self.headPointerOfStruct()\n        }\n    }\n\n    func isNSObjectType() -> Bool {\n        return (type(of: self) as? NSObject.Type) != nil\n    }\n\n    func getBridgedPropertyList() -> Set<String> {\n        if let anyClass = type(of: self) as? AnyClass {\n            return _getBridgedPropertyList(anyClass: anyClass)\n        }\n        return []\n    }\n\n    func _getBridgedPropertyList(anyClass: AnyClass) -> Set<String> {\n        if !(anyClass is HandyJSON.Type) {\n            return []\n        }\n        var propertyList = Set<String>()\n        if let superClass = class_getSuperclass(anyClass), superClass != NSObject.self {\n            propertyList = propertyList.union(_getBridgedPropertyList(anyClass: superClass))\n        }\n        let count = UnsafeMutablePointer<UInt32>.allocate(capacity: 1)\n        if let props = class_copyPropertyList(anyClass, count) {\n            for i in 0 ..< count.pointee {\n                let name = String(cString: property_getName(props.advanced(by: Int(i)).pointee))\n                propertyList.insert(name)\n            }\n            free(props)\n        }\n        #if swift(>=4.1)\n        count.deallocate()\n        #else\n        count.deallocate(capacity: 1)\n        #endif\n        return propertyList\n    }\n\n    // memory size occupy by self object\n    static func size() -> Int {\n        return MemoryLayout<Self>.size\n    }\n\n    // align\n    static func align() -> Int {\n        return MemoryLayout<Self>.alignment\n    }\n\n    // Returns the offset to the next integer that is greater than\n    // or equal to Value and is a multiple of Align. Align must be\n    // non-zero.\n    static func offsetToAlignment(value: Int, align: Int) -> Int {\n        let m = value % align\n        return m == 0 ? 0 : (align - m)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Metadata.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  Created by zhouzhuo on 07/01/2017.\n//\n\nstruct _class_rw_t {\n    var flags: Int32\n    var version: Int32\n    var ro: UInt\n    // other fields we don't care\n\n    // reference: include/swift/Remote/MetadataReader.h/readObjcRODataPtr\n    func class_ro_t() -> UnsafePointer<_class_ro_t>? {\n        var addr: UInt = self.ro\n        if (self.ro & UInt(1)) != 0 {\n            if let ptr = UnsafePointer<UInt>(bitPattern: self.ro ^ 1) {\n                addr = ptr.pointee\n            }\n        }\n        return UnsafePointer<_class_ro_t>(bitPattern: addr)\n    }\n}\n\nstruct _class_ro_t {\n    var flags: Int32\n    var instanceStart: Int32\n    var instanceSize: Int32\n    // other fields we don't care\n}\n\n// MARK: MetadataType\nprotocol MetadataType : PointerType {\n    static var kind: Metadata.Kind? { get }\n}\n\nextension MetadataType {\n\n    var kind: Metadata.Kind {\n        return Metadata.Kind(flag: UnsafePointer<Int>(pointer).pointee)\n    }\n\n    init?(anyType: Any.Type) {\n        self.init(pointer: unsafeBitCast(anyType, to: UnsafePointer<Int>.self))\n        if let kind = type(of: self).kind, kind != self.kind {\n            return nil\n        }\n    }\n}\n\n// MARK: Metadata\nstruct Metadata : MetadataType {\n    var pointer: UnsafePointer<Int>\n\n    init(type: Any.Type) {\n        self.init(pointer: unsafeBitCast(type, to: UnsafePointer<Int>.self))\n    }\n}\n\nstruct _Metadata {}\n\nvar is64BitPlatform: Bool {\n    return MemoryLayout<Int>.size == MemoryLayout<Int64>.size\n}\n\n// MARK: Metadata + Kind\n// include/swift/ABI/MetadataKind.def\nlet MetadataKindIsNonHeap = 0x200\nlet MetadataKindIsRuntimePrivate = 0x100\nlet MetadataKindIsNonType = 0x400\nextension Metadata {\n    static let kind: Kind? = nil\n\n    enum Kind {\n        case `struct`\n        case `enum`\n        case optional\n        case opaque\n        case foreignClass\n        case tuple\n        case function\n        case existential\n        case metatype\n        case objCClassWrapper\n        case existentialMetatype\n        case heapLocalVariable\n        case heapGenericLocalVariable\n        case errorObject\n        case `class` // The kind only valid for non-class metadata\n        init(flag: Int) {\n            switch flag {\n            case (0 | MetadataKindIsNonHeap): self = .struct\n            case (1 | MetadataKindIsNonHeap): self = .enum\n            case (2 | MetadataKindIsNonHeap): self = .optional\n            case (3 | MetadataKindIsNonHeap): self = .foreignClass\n            case (0 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap): self = .opaque\n            case (1 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap): self = .tuple\n            case (2 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap): self = .function\n            case (3 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap): self = .existential\n            case (4 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap): self = .metatype\n            case (5 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap): self = .objCClassWrapper\n            case (6 | MetadataKindIsRuntimePrivate | MetadataKindIsNonHeap): self = .existentialMetatype\n            case (0 | MetadataKindIsNonType): self = .heapLocalVariable\n            case (0 | MetadataKindIsNonType | MetadataKindIsRuntimePrivate): self = .heapGenericLocalVariable\n            case (1 | MetadataKindIsNonType | MetadataKindIsRuntimePrivate): self = .errorObject\n            default: self = .class\n            }\n        }\n    }\n}\n\n// MARK: Metadata + Class\nextension Metadata {\n    struct Class : ContextDescriptorType {\n\n        static let kind: Kind? = .class\n        var pointer: UnsafePointer<_Metadata._Class>\n\n        var isSwiftClass: Bool {\n            get {\n                // see include/swift/Runtime/Config.h macro SWIFT_CLASS_IS_SWIFT_MASK\n                // it can be 1 or 2 depending on environment\n                let lowbit = self.pointer.pointee.rodataPointer & 3\n                return lowbit != 0\n            }\n        }\n\n        var contextDescriptorOffsetLocation: Int {\n            return is64BitPlatform ? 8 : 11\n        }\n\n        var superclass: Class? {\n            guard let superclass = pointer.pointee.superclass else {\n                return nil\n            }\n\n            // If the superclass doesn't conform to handyjson/handyjsonenum protocol,\n            // we should ignore the properties inside\n            if !(superclass is HandyJSON.Type) && !(superclass is HandyJSONEnum.Type) {\n                return nil\n            }\n\n            // ignore objc-runtime layer\n            guard let metaclass = Metadata.Class(anyType: superclass) else {\n                return nil\n            }\n\n            return metaclass\n        }\n\n        var vTableSize: Int {\n            // memory size after ivar destroyer\n            return Int(pointer.pointee.classObjectSize - pointer.pointee.classObjectAddressPoint) - (contextDescriptorOffsetLocation + 2) * MemoryLayout<Int>.size\n        }\n\n        // reference: https://github.com/apple/swift/blob/master/docs/ABI/TypeMetadata.rst#generic-argument-vector\n        var genericArgumentVector: UnsafeRawPointer? {\n            let pointer = UnsafePointer<Int>(self.pointer)\n            var superVTableSize = 0\n            if let _superclass = self.superclass {\n                superVTableSize = _superclass.vTableSize / MemoryLayout<Int>.size\n            }\n            let base = pointer.advanced(by: contextDescriptorOffsetLocation + 2 + superVTableSize)\n            if base.pointee == 0 {\n                return nil\n            }\n            return UnsafeRawPointer(base)\n        }\n\n        func _propertyDescriptionsAndStartPoint() -> ([Property.Description], Int32?)? {\n            let instanceStart = pointer.pointee.class_rw_t()?.pointee.class_ro_t()?.pointee.instanceStart\n            var result: [Property.Description] = []\n            if let fieldOffsets = self.fieldOffsets, let fieldRecords = self.reflectionFieldDescriptor?.fieldRecords {\n                class NameAndType {\n                    var name: String?\n                    var type: Any.Type?\n                }\n                \n                for i in 0..<self.numberOfFields {\n                    let name = fieldRecords[i].fieldName\n                    if let cMangledTypeName = fieldRecords[i].mangledTypeName,\n                        let fieldType = _getTypeByMangledNameInContext(cMangledTypeName, getMangledTypeNameSize(cMangledTypeName), genericContext: self.contextDescriptorPointer, genericArguments: self.genericArgumentVector) {\n\n                        result.append(Property.Description(key: name, type: fieldType, offset: fieldOffsets[i]))\n                    }\n                }\n            }\n\n            if let superclass = superclass,\n                String(describing: unsafeBitCast(superclass.pointer, to: Any.Type.self)) != \"SwiftObject\",  // ignore the root swift object\n                let superclassProperties = superclass._propertyDescriptionsAndStartPoint(),\n                superclassProperties.0.count > 0 {\n\n                return (superclassProperties.0 + result, superclassProperties.1)\n            }\n            return (result, instanceStart)\n        }\n\n        func propertyDescriptions() -> [Property.Description]? {\n            let propsAndStp = _propertyDescriptionsAndStartPoint()\n            if let firstInstanceStart = propsAndStp?.1,\n                let firstProperty = propsAndStp?.0.first?.offset {\n                    return propsAndStp?.0.map({ (propertyDesc) -> Property.Description in\n                        let offset = propertyDesc.offset - firstProperty + Int(firstInstanceStart)\n                        return Property.Description(key: propertyDesc.key, type: propertyDesc.type, offset: offset)\n                    })\n            } else {\n                return propsAndStp?.0\n            }\n        }\n    }\n}\n\nextension _Metadata {\n    struct _Class {\n        var kind: Int\n        var superclass: Any.Type?\n        var reserveword1: Int\n        var reserveword2: Int\n        var rodataPointer: UInt\n        var classFlags: UInt32\n        var instanceAddressPoint: UInt32\n        var instanceSize: UInt32\n        var instanceAlignmentMask: UInt16\n        var runtimeReservedField: UInt16\n        var classObjectSize: UInt32\n        var classObjectAddressPoint: UInt32\n        var nominalTypeDescriptor: Int\n        var ivarDestroyer: Int\n        // other fields we don't care\n\n        func class_rw_t() -> UnsafePointer<_class_rw_t>? {\n            if MemoryLayout<Int>.size == MemoryLayout<Int64>.size {\n                let fast_data_mask: UInt64 = 0x00007ffffffffff8\n                let databits_t: UInt64 = UInt64(self.rodataPointer)\n                return UnsafePointer<_class_rw_t>(bitPattern: UInt(databits_t & fast_data_mask))\n            } else {\n                return UnsafePointer<_class_rw_t>(bitPattern: self.rodataPointer & 0xfffffffc)\n            }\n        }\n    }\n}\n\n// MARK: Metadata + Struct\nextension Metadata {\n    struct Struct : ContextDescriptorType {\n        static let kind: Kind? = .struct\n        var pointer: UnsafePointer<_Metadata._Struct>\n        var contextDescriptorOffsetLocation: Int {\n            return 1\n        }\n\n        var genericArgumentOffsetLocation: Int {\n            return 2\n        }\n\n        var genericArgumentVector: UnsafeRawPointer? {\n            let pointer = UnsafePointer<Int>(self.pointer)\n            let base = pointer.advanced(by: genericArgumentOffsetLocation)\n            if base.pointee == 0 {\n                return nil\n            }\n            return UnsafeRawPointer(base)\n        }\n\n        func propertyDescriptions() -> [Property.Description]? {\n            guard let fieldOffsets = self.fieldOffsets, let fieldRecords = self.reflectionFieldDescriptor?.fieldRecords else {\n                return []\n            }\n            var result: [Property.Description] = []\n            class NameAndType {\n                var name: String?\n                var type: Any.Type?\n            }\n            for i in 0..<self.numberOfFields {\n                let name = fieldRecords[i].fieldName\n                if let cMangledTypeName = fieldRecords[i].mangledTypeName,\n                    let fieldType = _getTypeByMangledNameInContext(cMangledTypeName, getMangledTypeNameSize(cMangledTypeName), genericContext: self.contextDescriptorPointer, genericArguments: self.genericArgumentVector) {\n\n                    result.append(Property.Description(key: name, type: fieldType, offset: fieldOffsets[i]))\n                }\n            }\n            return result\n        }\n    }\n}\n\nextension _Metadata {\n    struct _Struct {\n        var kind: Int\n        var contextDescriptorOffset: Int\n        var parent: Metadata?\n    }\n}\n\n// MARK: Metadata + ObjcClassWrapper\nextension Metadata {\n    struct ObjcClassWrapper: ContextDescriptorType {\n        static let kind: Kind? = .objCClassWrapper\n        var pointer: UnsafePointer<_Metadata._ObjcClassWrapper>\n        var contextDescriptorOffsetLocation: Int {\n            return is64BitPlatform ? 8 : 11\n        }\n\n        var targetType: Any.Type? {\n            get {\n                return pointer.pointee.targetType\n            }\n        }\n    }\n}\n\nextension _Metadata {\n    struct _ObjcClassWrapper {\n        var kind: Int\n        var targetType: Any.Type?\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/NSDecimalNumberTransform.swift",
    "content": "//\n//  TransformOf.swift\n//  ObjectMapper\n//\n//  Created by Tristan Himmelman on 8/22/16.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class NSDecimalNumberTransform: TransformType {\n    public typealias Object = NSDecimalNumber\n    public typealias JSON = String\n\n    public init() {}\n\n    open func transformFromJSON(_ value: Any?) -> NSDecimalNumber? {\n        if let string = value as? String {\n            return NSDecimalNumber(string: string)\n        }\n        if let double = value as? Double {\n            return NSDecimalNumber(value: double)\n        }\n        return nil\n    }\n\n    open func transformToJSON(_ value: NSDecimalNumber?) -> String? {\n        guard let value = value else { return nil }\n        return value.description\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/OtherExtension.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  OtherExtension.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 08/01/2017.\n//\n\nprotocol UTF8Initializable {\n    init?(validatingUTF8: UnsafePointer<CChar>)\n}\n\nextension String : UTF8Initializable {}\n\nextension Array where Element : UTF8Initializable {\n\n    init(utf8Strings: UnsafePointer<CChar>) {\n        var strings = [Element]()\n        var pointer = utf8Strings\n        while let string = Element(validatingUTF8: pointer) {\n            strings.append(string)\n            while pointer.pointee != 0 {\n                pointer.advance()\n            }\n            pointer.advance()\n            guard pointer.pointee != 0 else {\n                break\n            }\n        }\n        self = strings\n    }\n}\n\nextension Strideable {\n    mutating func advance() {\n        self = advanced(by: 1)\n    }\n}\n\nextension UnsafePointer {\n\n    init<T>(_ pointer: UnsafePointer<T>) {\n        self = UnsafeRawPointer(pointer).assumingMemoryBound(to: Pointee.self)\n    }\n}\n\nfunc relativePointer<T, U, V>(base: UnsafePointer<T>, offset: U) -> UnsafePointer<V> where U : FixedWidthInteger {\n    return UnsafeRawPointer(base).advanced(by: Int(integer: offset)).assumingMemoryBound(to: V.self)\n}\n\nextension Int {\n    fileprivate init<T : FixedWidthInteger>(integer: T) {\n        switch integer {\n        case let value as Int: self = value\n        case let value as Int32: self = Int(value)\n        case let value as Int16: self = Int(value)\n        case let value as Int8: self = Int(value)\n        default: self = 0\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/PointerType.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  Created by zhouzhuo on 07/01/2017.\n//\n\nprotocol PointerType : Equatable {\n    associatedtype Pointee\n    var pointer: UnsafePointer<Pointee> { get set }\n}\n\nextension PointerType {\n    init<T>(pointer: UnsafePointer<T>) {\n        func cast<T, U>(_ value: T) -> U {\n            return unsafeBitCast(value, to: U.self)\n        }\n        self = cast(UnsafePointer<Pointee>(pointer))\n    }\n}\n\nfunc == <T: PointerType>(lhs: T, rhs: T) -> Bool {\n    return lhs.pointer == rhs.pointer\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Properties.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  Created by zhouzhuo on 07/01/2017.\n//\n\n\n/// An instance property\nstruct Property {\n    let key: String\n    let value: Any\n\n    /// An instance property description\n    struct Description {\n        public let key: String\n        public let type: Any.Type\n        public let offset: Int\n        public func write(_ value: Any, to storage: UnsafeMutableRawPointer) {\n            return extensions(of: type).write(value, to: storage.advanced(by: offset))\n        }\n    }\n}\n\n/// Retrieve properties for `instance`\nfunc getProperties(forInstance instance: Any) -> [Property]? {\n    if let props = getProperties(forType: type(of: instance)) {\n        var copy = extensions(of: instance)\n        let storage = copy.storage()\n        return props.map {\n            nextProperty(description: $0, storage: storage)\n        }\n    }\n    return nil\n}\n\nprivate func nextProperty(description: Property.Description, storage: UnsafeRawPointer) -> Property {\n    return Property(\n        key: description.key,\n        value: extensions(of: description.type).value(from: storage.advanced(by: description.offset))\n    )\n}\n\n/// Retrieve property descriptions for `type`\nfunc getProperties(forType type: Any.Type) -> [Property.Description]? {\n    if let structDescriptor = Metadata.Struct(anyType: type) {\n        return structDescriptor.propertyDescriptions()\n    } else if let classDescriptor = Metadata.Class(anyType: type) {\n        return classDescriptor.propertyDescriptions()\n    } else if let objcClassDescriptor = Metadata.ObjcClassWrapper(anyType: type),\n        let targetType = objcClassDescriptor.targetType {\n        return getProperties(forType: targetType)\n    }\n    return nil\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/PropertyInfo.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  PropertyInfo.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 20/08/2017.\n//\n\nstruct PropertyInfo {\n    let key: String\n    let type: Any.Type\n    let address: UnsafeMutableRawPointer\n    let bridged: Bool\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/ReflectionHelper.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  Helper.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 07/01/2017.\n//\n\nstruct ReflectionHelper {\n\n    static func mutableStorage<T>(instance: inout T) -> UnsafeMutableRawPointer {\n        return UnsafeMutableRawPointer(mutating: storage(instance: &instance))\n    }\n\n    static func storage<T>(instance: inout T) -> UnsafeRawPointer {\n        if type(of: instance) is AnyClass {\n            let opaquePointer = Unmanaged.passUnretained(instance as AnyObject).toOpaque()\n            return UnsafeRawPointer(opaquePointer)\n        } else {\n            return withUnsafePointer(to: &instance) { pointer in\n                return UnsafeRawPointer(pointer)\n            }\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Serializer.swift",
    "content": "/*\n * Copyright 1999-2101 Alibaba Group.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n//\n//  JSONSerializer.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 9/30/16.\n//\n\nimport Foundation\n\npublic extension HandyJSON {\n\n    func toJSON() -> [String: Any]? {\n        if let dict = Self._serializeAny(object: self) as? [String: Any] {\n            return dict\n        }\n        return nil\n    }\n\n    func toJSONString(prettyPrint: Bool = false) -> String? {\n\n        if let anyObject = self.toJSON() {\n            if JSONSerialization.isValidJSONObject(anyObject) {\n                do {\n                    let jsonData: Data\n                    if prettyPrint {\n                        jsonData = try JSONSerialization.data(withJSONObject: anyObject, options: [.prettyPrinted])\n                    } else {\n                        jsonData = try JSONSerialization.data(withJSONObject: anyObject, options: [])\n                    }\n                    return String(data: jsonData, encoding: .utf8)\n                } catch let error {\n                    InternalLogger.logError(error)\n                }\n            } else {\n                InternalLogger.logDebug(\"\\(anyObject)) is not a valid JSON Object\")\n            }\n        }\n        return nil\n    }\n}\n\npublic extension Collection where Iterator.Element: HandyJSON {\n\n    func toJSON() -> [[String: Any]?] {\n        return self.map{ $0.toJSON() }\n    }\n\n    func toJSONString(prettyPrint: Bool = false) -> String? {\n\n        let anyArray = self.toJSON()\n        if JSONSerialization.isValidJSONObject(anyArray) {\n            do {\n                let jsonData: Data\n                if prettyPrint {\n                    jsonData = try JSONSerialization.data(withJSONObject: anyArray, options: [.prettyPrinted])\n                } else {\n                    jsonData = try JSONSerialization.data(withJSONObject: anyArray, options: [])\n                }\n                return String(data: jsonData, encoding: .utf8)\n            } catch let error {\n                InternalLogger.logError(error)\n            }\n        } else {\n            InternalLogger.logDebug(\"\\(self.toJSON()) is not a valid JSON Object\")\n        }\n        return nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/TransformOf.swift",
    "content": "//\n//  TransformOf.swift\n//  ObjectMapper\n//\n//  Created by Syo Ikeda on 1/23/15.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nopen class TransformOf<ObjectType, JSONType>: TransformType {\n\tpublic typealias Object = ObjectType\n\tpublic typealias JSON = JSONType\n\n\tprivate let fromJSON: (JSONType?) -> ObjectType?\n\tprivate let toJSON: (ObjectType?) -> JSONType?\n\n\tpublic init(fromJSON: @escaping(JSONType?) -> ObjectType?, toJSON: @escaping(ObjectType?) -> JSONType?) {\n\t\tself.fromJSON = fromJSON\n\t\tself.toJSON = toJSON\n\t}\n\n\topen func transformFromJSON(_ value: Any?) -> ObjectType? {\n\t\treturn fromJSON(value as? JSONType)\n\t}\n\n\topen func transformToJSON(_ value: ObjectType?) -> JSONType? {\n\t\treturn toJSON(value)\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/TransformType.swift",
    "content": "//\n//  TransformType.swift\n//  ObjectMapper\n//\n//  Created by Syo Ikeda on 2/4/15.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\npublic protocol TransformType {\n\tassociatedtype Object\n\tassociatedtype JSON\n\n\tfunc transformFromJSON(_ value: Any?) -> Object?\n\tfunc transformToJSON(_ value: Object?) -> JSON?\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/Transformable.swift",
    "content": "//\n//  Transformable.swift\n//  HandyJSON\n//\n//  Created by zhouzhuo on 15/07/2017.\n//  Copyright © 2017 aliyun. All rights reserved.\n//\n\nimport Foundation\n\npublic protocol _Transformable: _Measurable {}\n\nextension _Transformable {\n\n    static func transform(from object: Any) -> Self? {\n        if let typedObject = object as? Self {\n            return typedObject\n        }\n        switch self {\n        case let type as _ExtendCustomBasicType.Type:\n            return type._transform(from: object) as? Self\n        case let type as _BuiltInBridgeType.Type:\n            return type._transform(from: object) as? Self\n        case let type as _BuiltInBasicType.Type:\n            return type._transform(from: object) as? Self\n        case let type as _RawEnumProtocol.Type:\n            return type._transform(from: object) as? Self\n        case let type as _ExtendCustomModelType.Type:\n            return type._transform(from: object) as? Self\n        default:\n            return nil\n        }\n    }\n\n    func plainValue() -> Any? {\n        switch self {\n        case let rawValue as _ExtendCustomBasicType:\n            return rawValue._plainValue()\n        case let rawValue as _BuiltInBridgeType:\n            return rawValue._plainValue()\n        case let rawValue as _BuiltInBasicType:\n            return rawValue._plainValue()\n        case let rawValue as _RawEnumProtocol:\n            return rawValue._plainValue()\n        case let rawValue as _ExtendCustomModelType:\n            return rawValue._plainValue()\n        default:\n            return nil\n        }\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON/Source/URLTransform.swift",
    "content": "//\n//  URLTransform.swift\n//  ObjectMapper\n//\n//  Created by Tristan Himmelman on 2014-10-27.\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2014-2016 Hearst\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nopen class URLTransform: TransformType {\n\tpublic typealias Object = URL\n\tpublic typealias JSON = String\n\tprivate let shouldEncodeURLString: Bool\n\n\t/**\n\tInitializes the URLTransform with an option to encode URL strings before converting them to an NSURL\n\t- parameter shouldEncodeUrlString: when true (the default) the string is encoded before passing\n\tto `NSURL(string:)`\n\t- returns: an initialized transformer\n\t*/\n\tpublic init(shouldEncodeURLString: Bool = true) {\n\t\tself.shouldEncodeURLString = shouldEncodeURLString\n\t}\n\n\topen func transformFromJSON(_ value: Any?) -> URL? {\n\t\tguard let URLString = value as? String else { return nil }\n\n\t\tif !shouldEncodeURLString {\n\t\t\treturn URL(string: URLString)\n\t\t}\n\n\t\tguard let escapedURLString = URLString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) else {\n\t\t\treturn nil\n\t\t}\n\t\treturn URL(string: escapedURLString)\n\t}\n\n\topen func transformToJSON(_ value: URL?) -> String? {\n\t\tif let URL = value {\n\t\t\treturn URL.absoluteString\n\t\t}\n\t\treturn nil\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/HandyJSON.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t00696F323C84DC5A2A692E2A6081431B /* ExtendCustomModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3491BBF499954AB6636B8F55E8C4C6E /* ExtendCustomModelType.swift */; };\n\t\t023BEA463461C03AACAC54594241FEF4 /* FieldDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01B49F1B2BD503CAA8F9A36D988FC451 /* FieldDescriptor.swift */; };\n\t\t0B7136EF61C9B872D69C803E12475B7D /* ISO8601DateTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9FDB3B6D22E961BB219F8BDFABD8A30 /* ISO8601DateTransform.swift */; };\n\t\t0C5FC2091B80694CE43702FDB1935D16 /* MangledName.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A7E9CC917BBB8F027B5E1217CB5289 /* MangledName.swift */; };\n\t\t11A1EE6528044A9492F656B8E336DE3E /* NSDecimalNumberTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2CF0AB7B5814FD58807F16AD7477946 /* NSDecimalNumberTransform.swift */; };\n\t\t158EE2069FBD8C0D25FDA58D236AA4FA /* Transformable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A449BF89ED5935EF41F23FD9241CF18E /* Transformable.swift */; };\n\t\t210ABF16C1578D9AE4B80158FC9CA60D /* DateTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60B450FE1326E0EDD6199A3812B42E33 /* DateTransform.swift */; };\n\t\t28E44676D2FC37473D3A2D02C400D4EF /* ContextDescriptorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C90716A9F0DCBB3B9842D81086485D7C /* ContextDescriptorType.swift */; };\n\t\t2F1FE107E4E78ADE69CFCA860C4FB51C /* EnumType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB19464E2CFF35B5DCAB7A6EEF92F8A /* EnumType.swift */; };\n\t\t321D9C08BAF1F47F3B81F3E895C8A6A4 /* PointerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39658B165F58F89B8219335A5AB29D94 /* PointerType.swift */; };\n\t\t39496C96338AC1FAC0B78BB0A11849CB /* URLTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87C057657067DC6ED8C209519862A6E2 /* URLTransform.swift */; };\n\t\t4304E3BBB2E55E660AF820EF350CD51C /* HandyJSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 271436BCA6901851B6F5224DF04A7762 /* HandyJSON.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t43BCAC5F6A6B5FFAC1EB192496674A68 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54EE6558C01DAA76985025318D7FA98E /* Configuration.swift */; };\n\t\t46BC22AE63AA1D16D05B517FA75C2E41 /* OtherExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DB9918469A01AA3398D458A0107407E /* OtherExtension.swift */; };\n\t\t567BA2411FE9AE8DD133E14C50A4BD6A /* BuiltInBasicType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EA5D4A9C73210F67DA4B0F770BA782F /* BuiltInBasicType.swift */; };\n\t\t574EC4B09A6B2478BD77BA15EB7E55F2 /* Deserializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 675AB74000D9EFF37EB895DC9BA6AEEB /* Deserializer.swift */; };\n\t\t5B136F03D1C28E4D1CC0CF95E05FC8FF /* TransformType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18CCD66189A92D6E1D299C79BD0553FE /* TransformType.swift */; };\n\t\t666E3BED23D56CF42278C558EE9CE3B7 /* HelpingMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB9CE32B57E35E85CB6AA88776279CD /* HelpingMapper.swift */; };\n\t\t667DD4C1C3268DE2A2F482C18B03E7B1 /* DataTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6844F26945ECA0ADDED805CB0BC1FDF5 /* DataTransform.swift */; };\n\t\t66FDDD98C57832F525ACDBBB20D26E3A /* AnyExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53670C692633AF453AD8CDE89CD418EA /* AnyExtensions.swift */; };\n\t\t682177F4A6B84F5FF991BDF0B3AA8DC7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4AB48DDE41CE98F186217D90B47ABCB /* Foundation.framework */; };\n\t\t8A5DF3861C6A91E3A067A8C1612A43C8 /* BuiltInBridgeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F7210402545D2697D46EFA772D8415E /* BuiltInBridgeType.swift */; };\n\t\t92B64E0C27AFAC0A24B7A8FA4D82BB1F /* DateFormatterTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5486A4D33DCCAF9CA419B074FF4FA374 /* DateFormatterTransform.swift */; };\n\t\t98ACC7EEC41A956BA13EE380BF3BE0F6 /* EnumTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4693D867EBE9F8D3E4B9FAE77E13A912 /* EnumTransform.swift */; };\n\t\t9EA493AE4AC193DC8C604152A43C368E /* Serializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69E4EC48920B4CD6D7CC5373B0058C56 /* Serializer.swift */; };\n\t\t9FD9237F73E7F58165473926AD0E0246 /* CustomDateFormatTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE4DF09BA8A4AABB7B25FC32578B0EED /* CustomDateFormatTransform.swift */; };\n\t\tA03A98D4BEBF7E5889A037B932859A1C /* Properties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28434F25E35DBDF84B75767B2FC3E8F5 /* Properties.swift */; };\n\t\tA082236197E627DD46CC11619258C34F /* Measuable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78D12D74EF5DBDE55070A46734F0E48E /* Measuable.swift */; };\n\t\tA8D436679D69B9EFAB7F9D2856981FB1 /* CBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965BAF08925B7995BB93C7BE7DB1DB51 /* CBridge.swift */; };\n\t\tAC365338CC7C0F758B174BF545AC6B26 /* HexColorTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = C54A62F37C73BAB0457624CF15AA618B /* HexColorTransform.swift */; };\n\t\tB2D0FE3C2FC0DB243058D4B3A97F4018 /* TransformOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963A2E567D5152E51402C9A3CF3BF2F4 /* TransformOf.swift */; };\n\t\tB36BC3C119B58CE55B72E3F1CF3D73BC /* HandyJSON-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A81F8C1BA9556BAD5F0E6B987AF200 /* HandyJSON-dummy.m */; };\n\t\tC686DF7C40DFFA956462AF079A794148 /* PropertyInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA6948ECEEFAE54BDA32235BCB6FAF3C /* PropertyInfo.swift */; };\n\t\tD91EF6CFFBA81F50BD48C1A5D2D3F9E5 /* ExtendCustomBasicType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DD8000266FFC7C36E6684B7D2BBB35C /* ExtendCustomBasicType.swift */; };\n\t\tE26B17499569EF4C189BEB857FF2A390 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F81C1D35D903969E80B49A26ACDD60B7 /* Logger.swift */; };\n\t\tEA5BCCF9F0C27D89D339D593024F1246 /* Export.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79371706431FD3415AF58F812970A1D1 /* Export.swift */; };\n\t\tEF1CB9D2A303867DFB023F37A85A9A04 /* Metadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48A3BC5411FD321774EB0A254EA9AC57 /* Metadata.swift */; };\n\t\tF1EE08FBEF2A2DB3A7933AAB8FA1C2E5 /* ReflectionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC8CCB3BD1CE4EC17E30476642B07F4B /* ReflectionHelper.swift */; };\n\t\tFACF98D89E80F92B56812F89FF669EEB /* HandyJSON-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D12857D888B11734D18874A7AF00F096 /* HandyJSON-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t01B49F1B2BD503CAA8F9A36D988FC451 /* FieldDescriptor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FieldDescriptor.swift; path = Source/FieldDescriptor.swift; sourceTree = \"<group>\"; };\n\t\t04CB150BF8CCAF444D9CC4284A595D74 /* HandyJSON */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = HandyJSON; path = HandyJSON.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t0C67BEAC6E62F220116F1CBE8F062D6D /* HandyJSON-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"HandyJSON-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t18CCD66189A92D6E1D299C79BD0553FE /* TransformType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TransformType.swift; path = Source/TransformType.swift; sourceTree = \"<group>\"; };\n\t\t1FB19464E2CFF35B5DCAB7A6EEF92F8A /* EnumType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EnumType.swift; path = Source/EnumType.swift; sourceTree = \"<group>\"; };\n\t\t271436BCA6901851B6F5224DF04A7762 /* HandyJSON.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = HandyJSON.h; path = Source/HandyJSON.h; sourceTree = \"<group>\"; };\n\t\t28434F25E35DBDF84B75767B2FC3E8F5 /* Properties.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Properties.swift; path = Source/Properties.swift; sourceTree = \"<group>\"; };\n\t\t2EA5D4A9C73210F67DA4B0F770BA782F /* BuiltInBasicType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BuiltInBasicType.swift; path = Source/BuiltInBasicType.swift; sourceTree = \"<group>\"; };\n\t\t39658B165F58F89B8219335A5AB29D94 /* PointerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PointerType.swift; path = Source/PointerType.swift; sourceTree = \"<group>\"; };\n\t\t4693D867EBE9F8D3E4B9FAE77E13A912 /* EnumTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EnumTransform.swift; path = Source/EnumTransform.swift; sourceTree = \"<group>\"; };\n\t\t48A3BC5411FD321774EB0A254EA9AC57 /* Metadata.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Metadata.swift; path = Source/Metadata.swift; sourceTree = \"<group>\"; };\n\t\t50A81F8C1BA9556BAD5F0E6B987AF200 /* HandyJSON-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"HandyJSON-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t53670C692633AF453AD8CDE89CD418EA /* AnyExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyExtensions.swift; path = Source/AnyExtensions.swift; sourceTree = \"<group>\"; };\n\t\t5486A4D33DCCAF9CA419B074FF4FA374 /* DateFormatterTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DateFormatterTransform.swift; path = Source/DateFormatterTransform.swift; sourceTree = \"<group>\"; };\n\t\t54EE6558C01DAA76985025318D7FA98E /* Configuration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Configuration.swift; path = Source/Configuration.swift; sourceTree = \"<group>\"; };\n\t\t60B450FE1326E0EDD6199A3812B42E33 /* DateTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DateTransform.swift; path = Source/DateTransform.swift; sourceTree = \"<group>\"; };\n\t\t675AB74000D9EFF37EB895DC9BA6AEEB /* Deserializer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Deserializer.swift; path = Source/Deserializer.swift; sourceTree = \"<group>\"; };\n\t\t6844F26945ECA0ADDED805CB0BC1FDF5 /* DataTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DataTransform.swift; path = Source/DataTransform.swift; sourceTree = \"<group>\"; };\n\t\t69E4EC48920B4CD6D7CC5373B0058C56 /* Serializer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Serializer.swift; path = Source/Serializer.swift; sourceTree = \"<group>\"; };\n\t\t78D12D74EF5DBDE55070A46734F0E48E /* Measuable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Measuable.swift; path = Source/Measuable.swift; sourceTree = \"<group>\"; };\n\t\t79371706431FD3415AF58F812970A1D1 /* Export.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Export.swift; path = Source/Export.swift; sourceTree = \"<group>\"; };\n\t\t7DD8000266FFC7C36E6684B7D2BBB35C /* ExtendCustomBasicType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExtendCustomBasicType.swift; path = Source/ExtendCustomBasicType.swift; sourceTree = \"<group>\"; };\n\t\t87C057657067DC6ED8C209519862A6E2 /* URLTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = URLTransform.swift; path = Source/URLTransform.swift; sourceTree = \"<group>\"; };\n\t\t8DB9918469A01AA3398D458A0107407E /* OtherExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = OtherExtension.swift; path = Source/OtherExtension.swift; sourceTree = \"<group>\"; };\n\t\t8F7210402545D2697D46EFA772D8415E /* BuiltInBridgeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BuiltInBridgeType.swift; path = Source/BuiltInBridgeType.swift; sourceTree = \"<group>\"; };\n\t\t963A2E567D5152E51402C9A3CF3BF2F4 /* TransformOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TransformOf.swift; path = Source/TransformOf.swift; sourceTree = \"<group>\"; };\n\t\t965BAF08925B7995BB93C7BE7DB1DB51 /* CBridge.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CBridge.swift; path = Source/CBridge.swift; sourceTree = \"<group>\"; };\n\t\tA3491BBF499954AB6636B8F55E8C4C6E /* ExtendCustomModelType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExtendCustomModelType.swift; path = Source/ExtendCustomModelType.swift; sourceTree = \"<group>\"; };\n\t\tA449BF89ED5935EF41F23FD9241CF18E /* Transformable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Transformable.swift; path = Source/Transformable.swift; sourceTree = \"<group>\"; };\n\t\tAA6948ECEEFAE54BDA32235BCB6FAF3C /* PropertyInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PropertyInfo.swift; path = Source/PropertyInfo.swift; sourceTree = \"<group>\"; };\n\t\tB4AB48DDE41CE98F186217D90B47ABCB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tB6890CA1ADA21871C286A255836E8D5D /* HandyJSON-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"HandyJSON-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tBE4DF09BA8A4AABB7B25FC32578B0EED /* CustomDateFormatTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CustomDateFormatTransform.swift; path = Source/CustomDateFormatTransform.swift; sourceTree = \"<group>\"; };\n\t\tC2CF0AB7B5814FD58807F16AD7477946 /* NSDecimalNumberTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSDecimalNumberTransform.swift; path = Source/NSDecimalNumberTransform.swift; sourceTree = \"<group>\"; };\n\t\tC54A62F37C73BAB0457624CF15AA618B /* HexColorTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HexColorTransform.swift; path = Source/HexColorTransform.swift; sourceTree = \"<group>\"; };\n\t\tC90716A9F0DCBB3B9842D81086485D7C /* ContextDescriptorType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ContextDescriptorType.swift; path = Source/ContextDescriptorType.swift; sourceTree = \"<group>\"; };\n\t\tD12857D888B11734D18874A7AF00F096 /* HandyJSON-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"HandyJSON-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tD4A7E9CC917BBB8F027B5E1217CB5289 /* MangledName.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MangledName.swift; path = Source/MangledName.swift; sourceTree = \"<group>\"; };\n\t\tD879D6209EA8264473ED4B2E0C8C143E /* HandyJSON.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = HandyJSON.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tDD1836DF97F5ED4D25BF4BD84D6D4972 /* HandyJSON.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = HandyJSON.modulemap; sourceTree = \"<group>\"; };\n\t\tE9FDB3B6D22E961BB219F8BDFABD8A30 /* ISO8601DateTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ISO8601DateTransform.swift; path = Source/ISO8601DateTransform.swift; sourceTree = \"<group>\"; };\n\t\tEC8CCB3BD1CE4EC17E30476642B07F4B /* ReflectionHelper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReflectionHelper.swift; path = Source/ReflectionHelper.swift; sourceTree = \"<group>\"; };\n\t\tECB9CE32B57E35E85CB6AA88776279CD /* HelpingMapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HelpingMapper.swift; path = Source/HelpingMapper.swift; sourceTree = \"<group>\"; };\n\t\tF77ED3CB99C3B3A4DF920D0D55D89621 /* HandyJSON.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = HandyJSON.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tF81C1D35D903969E80B49A26ACDD60B7 /* Logger.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Logger.swift; path = Source/Logger.swift; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tBE8FCD7B74D1E92F00ED5DAEB2957A6A /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t682177F4A6B84F5FF991BDF0B3AA8DC7 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t01B6C4C41760DE95A27FC5353B1D3BE9 /* HandyJSON */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t53670C692633AF453AD8CDE89CD418EA /* AnyExtensions.swift */,\n\t\t\t\t2EA5D4A9C73210F67DA4B0F770BA782F /* BuiltInBasicType.swift */,\n\t\t\t\t8F7210402545D2697D46EFA772D8415E /* BuiltInBridgeType.swift */,\n\t\t\t\t965BAF08925B7995BB93C7BE7DB1DB51 /* CBridge.swift */,\n\t\t\t\t54EE6558C01DAA76985025318D7FA98E /* Configuration.swift */,\n\t\t\t\tC90716A9F0DCBB3B9842D81086485D7C /* ContextDescriptorType.swift */,\n\t\t\t\tBE4DF09BA8A4AABB7B25FC32578B0EED /* CustomDateFormatTransform.swift */,\n\t\t\t\t6844F26945ECA0ADDED805CB0BC1FDF5 /* DataTransform.swift */,\n\t\t\t\t5486A4D33DCCAF9CA419B074FF4FA374 /* DateFormatterTransform.swift */,\n\t\t\t\t60B450FE1326E0EDD6199A3812B42E33 /* DateTransform.swift */,\n\t\t\t\t675AB74000D9EFF37EB895DC9BA6AEEB /* Deserializer.swift */,\n\t\t\t\t4693D867EBE9F8D3E4B9FAE77E13A912 /* EnumTransform.swift */,\n\t\t\t\t1FB19464E2CFF35B5DCAB7A6EEF92F8A /* EnumType.swift */,\n\t\t\t\t79371706431FD3415AF58F812970A1D1 /* Export.swift */,\n\t\t\t\t7DD8000266FFC7C36E6684B7D2BBB35C /* ExtendCustomBasicType.swift */,\n\t\t\t\tA3491BBF499954AB6636B8F55E8C4C6E /* ExtendCustomModelType.swift */,\n\t\t\t\t01B49F1B2BD503CAA8F9A36D988FC451 /* FieldDescriptor.swift */,\n\t\t\t\t271436BCA6901851B6F5224DF04A7762 /* HandyJSON.h */,\n\t\t\t\tECB9CE32B57E35E85CB6AA88776279CD /* HelpingMapper.swift */,\n\t\t\t\tC54A62F37C73BAB0457624CF15AA618B /* HexColorTransform.swift */,\n\t\t\t\tE9FDB3B6D22E961BB219F8BDFABD8A30 /* ISO8601DateTransform.swift */,\n\t\t\t\tF81C1D35D903969E80B49A26ACDD60B7 /* Logger.swift */,\n\t\t\t\tD4A7E9CC917BBB8F027B5E1217CB5289 /* MangledName.swift */,\n\t\t\t\t78D12D74EF5DBDE55070A46734F0E48E /* Measuable.swift */,\n\t\t\t\t48A3BC5411FD321774EB0A254EA9AC57 /* Metadata.swift */,\n\t\t\t\tC2CF0AB7B5814FD58807F16AD7477946 /* NSDecimalNumberTransform.swift */,\n\t\t\t\t8DB9918469A01AA3398D458A0107407E /* OtherExtension.swift */,\n\t\t\t\t39658B165F58F89B8219335A5AB29D94 /* PointerType.swift */,\n\t\t\t\t28434F25E35DBDF84B75767B2FC3E8F5 /* Properties.swift */,\n\t\t\t\tAA6948ECEEFAE54BDA32235BCB6FAF3C /* PropertyInfo.swift */,\n\t\t\t\tEC8CCB3BD1CE4EC17E30476642B07F4B /* ReflectionHelper.swift */,\n\t\t\t\t69E4EC48920B4CD6D7CC5373B0058C56 /* Serializer.swift */,\n\t\t\t\tA449BF89ED5935EF41F23FD9241CF18E /* Transformable.swift */,\n\t\t\t\t963A2E567D5152E51402C9A3CF3BF2F4 /* TransformOf.swift */,\n\t\t\t\t18CCD66189A92D6E1D299C79BD0553FE /* TransformType.swift */,\n\t\t\t\t87C057657067DC6ED8C209519862A6E2 /* URLTransform.swift */,\n\t\t\t\t125D0BA97975F6EAB4C3FF04A760B062 /* Support Files */,\n\t\t\t);\n\t\t\tname = HandyJSON;\n\t\t\tpath = HandyJSON;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t125D0BA97975F6EAB4C3FF04A760B062 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDD1836DF97F5ED4D25BF4BD84D6D4972 /* HandyJSON.modulemap */,\n\t\t\t\t50A81F8C1BA9556BAD5F0E6B987AF200 /* HandyJSON-dummy.m */,\n\t\t\t\t0C67BEAC6E62F220116F1CBE8F062D6D /* HandyJSON-Info.plist */,\n\t\t\t\tB6890CA1ADA21871C286A255836E8D5D /* HandyJSON-prefix.pch */,\n\t\t\t\tD12857D888B11734D18874A7AF00F096 /* HandyJSON-umbrella.h */,\n\t\t\t\tF77ED3CB99C3B3A4DF920D0D55D89621 /* HandyJSON.debug.xcconfig */,\n\t\t\t\tD879D6209EA8264473ED4B2E0C8C143E /* HandyJSON.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/HandyJSON\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t26180FC30248C7E479B58B2440237BF1 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tFB9AABD16B531D8EE08AFFBC1A8F1C08 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4BA2BBF2BBBA9159E5F60CF3F3A14F50 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t04CB150BF8CCAF444D9CC4284A595D74 /* HandyJSON */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tFB9AABD16B531D8EE08AFFBC1A8F1C08 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB4AB48DDE41CE98F186217D90B47ABCB /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tFE93C58F0D5C315330391D5683CD66B0 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t26180FC30248C7E479B58B2440237BF1 /* Frameworks */,\n\t\t\t\t01B6C4C41760DE95A27FC5353B1D3BE9 /* HandyJSON */,\n\t\t\t\t4BA2BBF2BBBA9159E5F60CF3F3A14F50 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t11928F6CF98C6C77EEB22D76B8FE2606 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4304E3BBB2E55E660AF820EF350CD51C /* HandyJSON.h in Headers */,\n\t\t\t\tFACF98D89E80F92B56812F89FF669EEB /* HandyJSON-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t42160F46A22E1CA007076183E782CF4B /* HandyJSON */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 8191188948CBC46133944DA1260E9536 /* Build configuration list for PBXNativeTarget \"HandyJSON\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t11928F6CF98C6C77EEB22D76B8FE2606 /* Headers */,\n\t\t\t\t4A89C4540FC39BDFF7057B4F7EA2FA23 /* Sources */,\n\t\t\t\tBE8FCD7B74D1E92F00ED5DAEB2957A6A /* Frameworks */,\n\t\t\t\t88817298B68211F9CF1B067693C6018B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = HandyJSON;\n\t\t\tproductName = HandyJSON;\n\t\t\tproductReference = 04CB150BF8CCAF444D9CC4284A595D74 /* HandyJSON */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t4B53B2B557184E3552D624DC9F1C6561 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 1C51737069F1310749529A47BF6938C4 /* Build configuration list for PBXProject \"HandyJSON\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = FE93C58F0D5C315330391D5683CD66B0;\n\t\t\tproductRefGroup = 4BA2BBF2BBBA9159E5F60CF3F3A14F50 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t42160F46A22E1CA007076183E782CF4B /* HandyJSON */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t88817298B68211F9CF1B067693C6018B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t4A89C4540FC39BDFF7057B4F7EA2FA23 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t66FDDD98C57832F525ACDBBB20D26E3A /* AnyExtensions.swift in Sources */,\n\t\t\t\t567BA2411FE9AE8DD133E14C50A4BD6A /* BuiltInBasicType.swift in Sources */,\n\t\t\t\t8A5DF3861C6A91E3A067A8C1612A43C8 /* BuiltInBridgeType.swift in Sources */,\n\t\t\t\tA8D436679D69B9EFAB7F9D2856981FB1 /* CBridge.swift in Sources */,\n\t\t\t\t43BCAC5F6A6B5FFAC1EB192496674A68 /* Configuration.swift in Sources */,\n\t\t\t\t28E44676D2FC37473D3A2D02C400D4EF /* ContextDescriptorType.swift in Sources */,\n\t\t\t\t9FD9237F73E7F58165473926AD0E0246 /* CustomDateFormatTransform.swift in Sources */,\n\t\t\t\t667DD4C1C3268DE2A2F482C18B03E7B1 /* DataTransform.swift in Sources */,\n\t\t\t\t92B64E0C27AFAC0A24B7A8FA4D82BB1F /* DateFormatterTransform.swift in Sources */,\n\t\t\t\t210ABF16C1578D9AE4B80158FC9CA60D /* DateTransform.swift in Sources */,\n\t\t\t\t574EC4B09A6B2478BD77BA15EB7E55F2 /* Deserializer.swift in Sources */,\n\t\t\t\t98ACC7EEC41A956BA13EE380BF3BE0F6 /* EnumTransform.swift in Sources */,\n\t\t\t\t2F1FE107E4E78ADE69CFCA860C4FB51C /* EnumType.swift in Sources */,\n\t\t\t\tEA5BCCF9F0C27D89D339D593024F1246 /* Export.swift in Sources */,\n\t\t\t\tD91EF6CFFBA81F50BD48C1A5D2D3F9E5 /* ExtendCustomBasicType.swift in Sources */,\n\t\t\t\t00696F323C84DC5A2A692E2A6081431B /* ExtendCustomModelType.swift in Sources */,\n\t\t\t\t023BEA463461C03AACAC54594241FEF4 /* FieldDescriptor.swift in Sources */,\n\t\t\t\tB36BC3C119B58CE55B72E3F1CF3D73BC /* HandyJSON-dummy.m in Sources */,\n\t\t\t\t666E3BED23D56CF42278C558EE9CE3B7 /* HelpingMapper.swift in Sources */,\n\t\t\t\tAC365338CC7C0F758B174BF545AC6B26 /* HexColorTransform.swift in Sources */,\n\t\t\t\t0B7136EF61C9B872D69C803E12475B7D /* ISO8601DateTransform.swift in Sources */,\n\t\t\t\tE26B17499569EF4C189BEB857FF2A390 /* Logger.swift in Sources */,\n\t\t\t\t0C5FC2091B80694CE43702FDB1935D16 /* MangledName.swift in Sources */,\n\t\t\t\tA082236197E627DD46CC11619258C34F /* Measuable.swift in Sources */,\n\t\t\t\tEF1CB9D2A303867DFB023F37A85A9A04 /* Metadata.swift in Sources */,\n\t\t\t\t11A1EE6528044A9492F656B8E336DE3E /* NSDecimalNumberTransform.swift in Sources */,\n\t\t\t\t46BC22AE63AA1D16D05B517FA75C2E41 /* OtherExtension.swift in Sources */,\n\t\t\t\t321D9C08BAF1F47F3B81F3E895C8A6A4 /* PointerType.swift in Sources */,\n\t\t\t\tA03A98D4BEBF7E5889A037B932859A1C /* Properties.swift in Sources */,\n\t\t\t\tC686DF7C40DFFA956462AF079A794148 /* PropertyInfo.swift in Sources */,\n\t\t\t\tF1EE08FBEF2A2DB3A7933AAB8FA1C2E5 /* ReflectionHelper.swift in Sources */,\n\t\t\t\t9EA493AE4AC193DC8C604152A43C368E /* Serializer.swift in Sources */,\n\t\t\t\t158EE2069FBD8C0D25FDA58D236AA4FA /* Transformable.swift in Sources */,\n\t\t\t\tB2D0FE3C2FC0DB243058D4B3A97F4018 /* TransformOf.swift in Sources */,\n\t\t\t\t5B136F03D1C28E4D1CC0CF95E05FC8FF /* TransformType.swift in Sources */,\n\t\t\t\t39496C96338AC1FAC0B78BB0A11849CB /* URLTransform.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t0223F3B6B002101B41DA2C2931058917 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t76758648F90A98EC58E67DA79EE6D4FB /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = F77ED3CB99C3B3A4DF920D0D55D89621 /* HandyJSON.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/HandyJSON/HandyJSON-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/HandyJSON/HandyJSON-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/HandyJSON/HandyJSON.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = HandyJSON;\n\t\t\t\tPRODUCT_NAME = HandyJSON;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t833F5C0017504EB98F358B14676D0A86 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = D879D6209EA8264473ED4B2E0C8C143E /* HandyJSON.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/HandyJSON/HandyJSON-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/HandyJSON/HandyJSON-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/HandyJSON/HandyJSON.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = HandyJSON;\n\t\t\t\tPRODUCT_NAME = HandyJSON;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tB19C6FD615870E59B381CD4D8E72618B /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t1C51737069F1310749529A47BF6938C4 /* Build configuration list for PBXProject \"HandyJSON\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t0223F3B6B002101B41DA2C2931058917 /* Debug */,\n\t\t\t\tB19C6FD615870E59B381CD4D8E72618B /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t8191188948CBC46133944DA1260E9536 /* Build configuration list for PBXNativeTarget \"HandyJSON\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t76758648F90A98EC58E67DA79EE6D4FB /* Debug */,\n\t\t\t\t833F5C0017504EB98F358B14676D0A86 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 4B53B2B557184E3552D624DC9F1C6561 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/LICENSE.md",
    "content": "MIT License\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/README.md",
    "content": "<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/Instagram/IGListKit/master/Resources/logo-animation.gif\" width=400 />\n</p>\n\n<p align=\"center\">\n    <a href=\"https://travis-ci.org/Instagram/IGListKit\">\n        <img src=\"https://travis-ci.org/Instagram/IGListKit.svg?branch=master&style=flat\"\n             alt=\"Build Status\">\n    </a>\n    <a href=\"https://coveralls.io/github/Instagram/IGListKit?branch=master\">\n      <img src=\"https://coveralls.io/repos/github/Instagram/IGListKit/badge.svg?branch=master\"\n           alt=\"Coverage Status\" />\n    </a>\n    <a href=\"https://cocoapods.org/pods/IGListKit\">\n        <img src=\"https://img.shields.io/cocoapods/v/IGListKit.svg?style=flat\"\n             alt=\"Pods Version\">\n    </a>\n    <a href=\"https://instagram.github.io/IGListKit/\">\n        <img src=\"https://img.shields.io/cocoapods/p/IGListKit.svg?style=flat\"\n             alt=\"Platforms\">\n    </a>\n    <a href=\"https://github.com/Carthage/Carthage\">\n        <img src=\"https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat\"\n             alt=\"Carthage Compatible\">\n    </a>\n</p>\n\n----------------\n\nA data-driven `UICollectionView` framework for building fast and flexible lists.\n\n|         | Main Features  |\n----------|-----------------\n&#128581; | Never call `performBatchUpdates(_:, completion:)` or `reloadData()` again\n&#127968; | Better architecture with reusable cells and components\n&#128288; | Create collections with multiple data types\n&#128273; | Decoupled diffing algorithm\n&#9989;   | Fully unit tested\n&#128269; | Customize your diffing behavior for your models\n&#128241; | Simply `UICollectionView` at its core\n&#128640; | Extendable API\n&#128038; | Written in Objective-C with full Swift interop support\n\n`IGListKit` is built and maintained with &#10084;&#65039; by [Instagram engineering](https://engineering.instagram.com/).\nWe use the open source version `master` branch in the Instagram app.\n\n## Requirements\n\n- Xcode 9.0+\n- iOS 9.0+\n- tvOS 9.0+\n- macOS 10.11+ *(diffing algorithm components only)*\n- Interoperability with Swift 3.0+\n\n## Installation\n\n### CocoaPods\n\nThe preferred installation method is with [CocoaPods](https://cocoapods.org). Add the following to your `Podfile`:\n\n```ruby\npod 'IGListKit', '~> 4.0.0'\n```\n\n### Carthage\n\nFor [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:\n\n```ogdl\ngithub \"Instagram/IGListKit\" ~> 4.0.0\n```\n\n> For advanced usage, see our [Installation Guide](https://instagram.github.io/IGListKit/installation.html).\n\n## Getting Started\n\n```bash\n$ git clone https://github.com/Instagram/IGListKit.git\n$ cd IGListKit/\n$ ./scripts/setup.sh\n```\n\n- Our [Getting Started guide](https://instagram.github.io/IGListKit/getting-started.html)\n- Ray Wenderlich's [IGListKit Tutorial: Better UICollectionViews](https://www.raywenderlich.com/147162/iglistkit-tutorial-better-uicollectionviews)\n- Our [example projects](https://github.com/Instagram/IGListKit/tree/master/Examples)\n- Ryan Nystrom's [talk at try! Swift NYC](https://realm.io/news/tryswift-ryan-nystrom-refactoring-at-scale-lessons-learned-rewriting-instagram-feed/) (Note: this talk was for an earlier version. Some APIs have changed.)\n- [Migrating an UITableView to IGListCollectionView](https://medium.com/cocoaacademymag/iglistkit-migrating-an-uitableview-to-iglistkitcollectionview-65a30cf9bac9), by Rodrigo Cavalcante\n- [Keeping data fresh in Buffer for iOS with AsyncDisplayKit, IGListKit & Pusher](https://overflow.buffer.com/2017/04/10/keeping-data-fresh-buffer-ios-asyncdisplaykit-iglistkit-pusher/), Andy Yates, Buffer\n\n## Documentation\n\nYou can find [the docs here](https://instagram.github.io/IGListKit). Documentation is generated with [jazzy](https://github.com/realm/jazzy) and hosted on [GitHub-Pages](https://pages.github.com).\n\nTo regenerate docs, run `./scripts/build_docs.sh` from the root directory in the repo.\n\n## Vision\n\nFor the long-term goals and \"vision\" of `IGListKit`, please read our [Vision](https://github.com/Instagram/IGListKit/blob/master/Guides/VISION.md) doc.\n\n## Contributing\n\nPlease see the [CONTRIBUTING](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) file for how to help. At Instagram, we sync the open source version of `IGListKit` daily, so we're always testing the latest changes. But that requires all changes be thoroughly tested and follow our style guide.\n\nWe have a set of [starter tasks](https://github.com/Instagram/IGListKit/issues?q=is%3Aissue+is%3Aopen+label%3Astarter-task) that are great for beginners to jump in on and start contributing.\n\n## License\n\n`IGListKit` is [MIT-licensed](./LICENSE).\n\nThe files in the `/Examples/` directory are licensed under a separate license as specified in each file. Documentation is licensed [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/).\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListAssert.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#ifndef IGAssert\n#define IGAssert( condition, ... ) NSCAssert( (condition) , ##__VA_ARGS__)\n#endif // IGAssert\n\n#ifndef IGFailAssert\n#define IGFailAssert( ... ) IGAssert( (NO) , ##__VA_ARGS__)\n#endif // IGFailAssert\n\n#ifndef IGParameterAssert\n#define IGParameterAssert( condition ) IGAssert( (condition) , @\"Invalid parameter not satisfying: %@\", @#condition)\n#endif // IGParameterAssert\n\n#ifndef IGAssertMainThread\n#define IGAssertMainThread() IGAssert( ([NSThread isMainThread] == YES), @\"Must be on the main thread\")\n#endif // IGAssertMainThread\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListBatchUpdateData.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n#import <IGListDiffKit/IGListMoveIndex.h>\n#import <IGListDiffKit/IGListMoveIndexPath.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An instance of `IGListBatchUpdateData` takes section indexes and item index paths \n and performs cleanup on init in order to perform a crash-free\n update via `-[UICollectionView performBatchUpdates:completion:]`.\n */\nIGLK_SUBCLASSING_RESTRICTED\nNS_SWIFT_NAME(ListBatchUpdateData)\n@interface IGListBatchUpdateData : NSObject\n\n/**\n Section insert indexes.\n */\n@property (nonatomic, strong, readonly) NSIndexSet *insertSections;\n\n/**\n Section delete indexes.\n */\n@property (nonatomic, strong, readonly) NSIndexSet *deleteSections;\n\n/**\n Section moves.\n */\n@property (nonatomic, strong, readonly) NSSet<IGListMoveIndex *> *moveSections;\n\n/**\n Item insert index paths.\n */\n@property (nonatomic, strong, readonly) NSArray<NSIndexPath *> *insertIndexPaths;\n\n/**\n Item delete index paths.\n */\n@property (nonatomic, strong, readonly) NSArray<NSIndexPath *> *deleteIndexPaths;\n\n/**\n Item update index paths.\n */\n@property (nonatomic, strong, readonly) NSArray<NSIndexPath *> *updateIndexPaths;\n\n/**\n Item moves.\n */\n@property (nonatomic, strong, readonly) NSArray<IGListMoveIndexPath *> *moveIndexPaths;\n\n/**\n Creates a new batch update object with section and item operations.\n\n @param insertSections Section indexes to insert.\n @param deleteSections Section indexes to delete.\n @param moveSections Section moves.\n @param insertIndexPaths Item index paths to insert.\n @param deleteIndexPaths Item index paths to delete.\n @param updateIndexPaths Item index paths to update.\n @param moveIndexPaths Item index paths to move.\n @param fixIndexPathImbalance When enabled, we remove duplicate NSIndexPath inserts to avoid insert/delete imbalance and a crash.\n\n @return A new batch update object.\n */\n- (instancetype)initWithInsertSections:(NSIndexSet *)insertSections\n                        deleteSections:(NSIndexSet *)deleteSections\n                          moveSections:(NSSet<IGListMoveIndex *> *)moveSections\n                      insertIndexPaths:(NSArray<NSIndexPath *> *)insertIndexPaths\n                      deleteIndexPaths:(NSArray<NSIndexPath *> *)deleteIndexPaths\n                      updateIndexPaths:(NSArray<NSIndexPath *> *)updateIndexPaths\n                        moveIndexPaths:(NSArray<IGListMoveIndexPath *> *)moveIndexPaths\n                 fixIndexPathImbalance:(BOOL)fixIndexPathImbalance NS_DESIGNATED_INITIALIZER;\n\n/**\n Convenience initializer with fixIndexPathImbalance disabled.\n */\n- (instancetype)initWithInsertSections:(NSIndexSet *)insertSections\n                        deleteSections:(NSIndexSet *)deleteSections\n                          moveSections:(NSSet<IGListMoveIndex *> *)moveSections\n                      insertIndexPaths:(NSArray<NSIndexPath *> *)insertIndexPaths\n                      deleteIndexPaths:(NSArray<NSIndexPath *> *)deleteIndexPaths\n                      updateIndexPaths:(NSArray<NSIndexPath *> *)updateIndexPaths\n                        moveIndexPaths:(NSArray<IGListMoveIndexPath *> *)moveIndexPaths;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListBatchUpdateData.mm",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListBatchUpdateData.h\"\n\n#import <unordered_map>\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListDiffKit/IGListCompatibility.h>\n\n// Plucks the given move from available moves and turns it into a delete + insert\nstatic void convertMoveToDeleteAndInsert(NSMutableSet<IGListMoveIndex *> *moves,\n                                         IGListMoveIndex *move,\n                                         NSMutableIndexSet *deletes,\n                                         NSMutableIndexSet *inserts) {\n    [moves removeObject:move];\n\n    // add a delete and insert respecting the move's from and to sections\n    // delete + insert will result in reloading the entire section\n    [deletes addIndex:move.from];\n    [inserts addIndex:move.to];\n}\n\n@implementation IGListBatchUpdateData\n\n// Converts all section moves that have index path operations into a section delete + insert.\n+ (void)_cleanIndexPathsWithMap:(const std::unordered_map<NSInteger, IGListMoveIndex*> &)map\n                         moves:(NSMutableSet<IGListMoveIndex *> *)moves\n                    indexPaths:(NSMutableArray<NSIndexPath *> *)indexPaths\n                       deletes:(NSMutableIndexSet *)deletes\n                       inserts:(NSMutableIndexSet *)inserts {\n    for (NSInteger i = indexPaths.count - 1; i >= 0; i--) {\n        NSIndexPath *path = indexPaths[i];\n        const auto it = map.find(path.section);\n        if (it != map.end() && it->second != nil) {\n            [indexPaths removeObjectAtIndex:i];\n            convertMoveToDeleteAndInsert(moves, it->second, deletes, inserts);\n        }\n    }\n}\n\n- (instancetype)initWithInsertSections:(NSIndexSet *)insertSections\n                        deleteSections:(NSIndexSet *)deleteSections\n                          moveSections:(NSSet<IGListMoveIndex *> *)moveSections\n                      insertIndexPaths:(NSArray<NSIndexPath *> *)insertIndexPaths\n                      deleteIndexPaths:(NSArray<NSIndexPath *> *)deleteIndexPaths\n                      updateIndexPaths:(NSArray<NSIndexPath *> *)updateIndexPaths\n                        moveIndexPaths:(NSArray<IGListMoveIndexPath *> *)moveIndexPaths {\n    return [self initWithInsertSections:insertSections\n                         deleteSections:deleteSections\n                           moveSections:moveSections\n                       insertIndexPaths:insertIndexPaths\n                       deleteIndexPaths:deleteIndexPaths\n                       updateIndexPaths:updateIndexPaths\n                         moveIndexPaths:moveIndexPaths\n                  fixIndexPathImbalance:NO];\n}\n\n/**\n Converts all section moves that are also reloaded, or have index path inserts, deletes, or reloads into a section\n delete + insert in order to avoid UICollectionView heap corruptions, exceptions, and animation/snapshot bugs.\n */\n- (instancetype)initWithInsertSections:(nonnull NSIndexSet *)insertSections\n                        deleteSections:(nonnull NSIndexSet *)deleteSections\n                          moveSections:(nonnull NSSet<IGListMoveIndex *> *)moveSections\n                      insertIndexPaths:(nonnull NSArray<NSIndexPath *> *)insertIndexPaths\n                      deleteIndexPaths:(nonnull NSArray<NSIndexPath *> *)deleteIndexPaths\n                      updateIndexPaths:(nonnull NSArray<NSIndexPath *> *)updateIndexPaths\n                        moveIndexPaths:(nonnull NSArray<IGListMoveIndexPath *> *)moveIndexPaths\n                 fixIndexPathImbalance:(BOOL)fixIndexPathImbalance {\n    IGParameterAssert(insertSections != nil);\n    IGParameterAssert(deleteSections != nil);\n    IGParameterAssert(moveSections != nil);\n    IGParameterAssert(insertIndexPaths != nil);\n    IGParameterAssert(deleteIndexPaths != nil);\n    IGParameterAssert(updateIndexPaths != nil);\n    IGParameterAssert(moveIndexPaths != nil);\n    if (self = [super init]) {\n        NSMutableSet<IGListMoveIndex *> *mMoveSections = [moveSections mutableCopy];\n        NSMutableIndexSet *mDeleteSections = [deleteSections mutableCopy];\n        NSMutableIndexSet *mInsertSections = [insertSections mutableCopy];\n        NSMutableSet<IGListMoveIndexPath *> *mMoveIndexPaths = [moveIndexPaths mutableCopy];\n\n        // these collections should NEVER be mutated during cleanup passes, otherwise sections that have multiple item\n        // changes (e.g. a moved section that has a delete + reload on different index paths w/in the section) will only\n        // convert one of the item changes into a section delete+insert. this will fail hard and be VERY difficult to\n        // debug\n        const NSInteger moveCount = [moveSections count];\n        std::unordered_map<NSInteger, IGListMoveIndex*> fromMap(moveCount);\n        std::unordered_map<NSInteger, IGListMoveIndex*> toMap(moveCount);\n        for (IGListMoveIndex *move in moveSections) {\n            const NSInteger from = move.from;\n            const NSInteger to = move.to;\n\n            // if the move is already deleted or inserted, discard it because count-changing operations must match\n            // with data source changes\n            if ([deleteSections containsIndex:from] || [insertSections containsIndex:to]) {\n                [mMoveSections removeObject:move];\n            } else {\n                fromMap[from] = move;\n                toMap[to] = move;\n            }\n        }\n\n        // avoid a flaky UICollectionView bug when deleting from the same index path twice\n        // exposes a possible data source inconsistency issue\n        NSMutableArray<NSIndexPath *> *mDeleteIndexPaths = [[[NSSet setWithArray:deleteIndexPaths] allObjects] mutableCopy];\n\n        NSMutableArray<NSIndexPath *> *mInsertIndexPaths;\n        if (fixIndexPathImbalance) {\n            // Since we remove duplicate deletes (see above) we also need to remove inserts to keep the same insert/delete\n            // balance. For example, if we reload (insert & delete) the same NSIndexPath twice, we would otherwise end up\n            // with 2 inserts and 1 delete.\n            mInsertIndexPaths = [[[NSSet setWithArray:insertIndexPaths] allObjects] mutableCopy];\n        } else {\n            mInsertIndexPaths = [insertIndexPaths mutableCopy];\n        }\n\n        // avoids a bug where a cell is animated twice and one of the snapshot cells is never removed from the hierarchy\n        [IGListBatchUpdateData _cleanIndexPathsWithMap:fromMap moves:mMoveSections indexPaths:mDeleteIndexPaths deletes:mDeleteSections inserts:mInsertSections];\n\n        // prevents a bug where UICollectionView corrupts the heap memory when inserting into a section that is moved\n        [IGListBatchUpdateData _cleanIndexPathsWithMap:toMap moves:mMoveSections indexPaths:mInsertIndexPaths deletes:mDeleteSections inserts:mInsertSections];\n\n        for (IGListMoveIndexPath *move in moveIndexPaths) {\n            // if the section w/ an index path move is deleted, just drop the move\n            if ([deleteSections containsIndex:move.from.section]) {\n                [mMoveIndexPaths removeObject:move];\n            }\n\n            // if a move is inside a section that is moved, convert the section move to a delete+insert\n            const auto it = fromMap.find(move.from.section);\n            if (it != fromMap.end() && it->second != nil) {\n                IGListMoveIndex *sectionMove = it->second;\n                [mMoveIndexPaths removeObject:move];\n                [mMoveSections removeObject:sectionMove];\n                [mDeleteSections addIndex:sectionMove.from];\n                [mInsertSections addIndex:sectionMove.to];\n            }\n        }\n\n        _deleteSections = [mDeleteSections copy];\n        _insertSections = [mInsertSections copy];\n        _moveSections = [mMoveSections copy];\n        _deleteIndexPaths = [mDeleteIndexPaths copy];\n        _insertIndexPaths = [mInsertIndexPaths copy];\n        _updateIndexPaths = [updateIndexPaths copy];\n        _moveIndexPaths = [mMoveIndexPaths copy];\n    }\n    return self;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (object == self) {\n        return YES;\n    }\n    if ([object isKindOfClass:[IGListBatchUpdateData class]]) {\n        return ([self.insertSections isEqual:[object insertSections]]\n                && [self.deleteSections isEqual:[object deleteSections]]\n                && [self.moveSections isEqual:[object moveSections]]\n                && [self.insertIndexPaths isEqual:[object insertIndexPaths]]\n                && [self.deleteIndexPaths isEqual:[object deleteIndexPaths]]\n                && [self.updateIndexPaths isEqual:[object updateIndexPaths]]\n                && [self.moveIndexPaths isEqual:[object moveIndexPaths]]);\n    }\n    return NO;\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@ %p; deleteSections: %lu; insertSections: %lu; moveSections: %lu; deleteIndexPaths: %lu; insertIndexPaths: %lu; updateIndexPaths: %lu>\",\n            NSStringFromClass(self.class), self, (unsigned long)self.deleteSections.count, (unsigned long)self.insertSections.count, (unsigned long)self.moveSections.count,\n            (unsigned long)self.deleteIndexPaths.count, (unsigned long)self.insertIndexPaths.count, (unsigned long)self.updateIndexPaths.count];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListCompatibility.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <TargetConditionals.h>\n\n#if TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR\n#import <UIKit/UIKit.h>\n#else\n#import <Cocoa/Cocoa.h>\n#endif\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListDiff.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListDiffable.h>\n#import <IGListDiffKit/IGListIndexPathResult.h>\n#import <IGListDiffKit/IGListIndexSetResult.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An option for how to do comparisons between similar objects.\n */\nNS_SWIFT_NAME(ListDiffOption)\ntypedef NS_ENUM(NSInteger, IGListDiffOption) {\n    /**\n     Compare objects using pointer personality.\n     */\n    IGListDiffPointerPersonality,\n    /**\n     Compare objects using `-[IGListDiffable isEqualToDiffableObject:]`.\n     */\n    IGListDiffEquality\n};\n\n/**\n Creates a diff using indexes between two collections.\n\n @param oldArray The old objects to diff against.\n @param newArray The new objects.\n @param option An option on how to compare objects.\n\n @return A result object containing affected indexes.\n */\nNS_SWIFT_NAME(ListDiff(oldArray:newArray:option:))\nFOUNDATION_EXTERN  IGListIndexSetResult *IGListDiff(NSArray<id<IGListDiffable>> *_Nullable oldArray,\n                                                   NSArray<id<IGListDiffable>> *_Nullable newArray,\n                                                   IGListDiffOption option);\n\n/**\n Creates a diff using index paths between two collections.\n\n @param fromSection The old section.\n @param toSection The new section.\n @param oldArray The old objects to diff against.\n @param newArray The new objects.\n @param option An option on how to compare objects.\n\n @return A result object containing affected indexes.\n */\nNS_SWIFT_NAME(ListDiffPaths(fromSection:toSection:oldArray:newArray:option:))\nFOUNDATION_EXTERN IGListIndexPathResult *IGListDiffPaths(NSInteger fromSection,\n                                                         NSInteger toSection,\n                                                         NSArray<id<IGListDiffable>> *_Nullable oldArray,\n                                                         NSArray<id<IGListDiffable>> *_Nullable newArray,\n                                                         IGListDiffOption option);\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListDiff.mm",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListDiff.h\"\n\n#import <stack>\n#import <unordered_map>\n#import <vector>\n\n#import <IGListDiffKit/IGListCompatibility.h>\n#import <IGListDiffKit/IGListExperiments.h>\n\n#import \"IGListIndexPathResultInternal.h\"\n#import \"IGListIndexSetResultInternal.h\"\n#import \"IGListMoveIndexInternal.h\"\n#import \"IGListMoveIndexPathInternal.h\"\n\nusing namespace std;\n\n/// Used to track data stats while diffing.\nstruct IGListEntry {\n    /// The number of times the data occurs in the old array\n    NSInteger oldCounter = 0;\n    /// The number of times the data occurs in the new array\n    NSInteger newCounter = 0;\n    /// The indexes of the data in the old array\n    stack<NSInteger> oldIndexes;\n    /// Flag marking if the data has been updated between arrays by checking the isEqual: method\n    BOOL updated = NO;\n};\n\n/// Track both the entry and algorithm index. Default the index to NSNotFound\nstruct IGListRecord {\n    IGListEntry *entry;\n    mutable NSInteger index;\n\n    IGListRecord() {\n        entry = NULL;\n        index = NSNotFound;\n    }\n};\n\nstatic id<NSObject> IGListTableKey(__unsafe_unretained id<IGListDiffable> object) {\n    id<NSObject> key = [object diffIdentifier];\n    NSCAssert(key != nil, @\"Cannot use a nil key for the diffIdentifier of object %@\", object);\n    return key;\n}\n\nstruct IGListEqualID {\n    bool operator()(const id a, const id b) const {\n        return (a == b) || [a isEqual: b];\n    }\n};\n\nstruct IGListHashID {\n    size_t operator()(const id o) const {\n        return (size_t)[o hash];\n    }\n};\n\nstatic void addIndexToMap(BOOL useIndexPaths, NSInteger section, NSInteger index, __unsafe_unretained id<IGListDiffable> object, __unsafe_unretained NSMapTable *map) {\n    id value;\n    if (useIndexPaths) {\n        value = [NSIndexPath indexPathForItem:index inSection:section];\n    } else {\n        value = @(index);\n    }\n    [map setObject:value forKey:[object diffIdentifier]];\n}\n\nstatic void addIndexToCollection(BOOL useIndexPaths, __unsafe_unretained id collection, NSInteger section, NSInteger index) {\n    if (useIndexPaths) {\n        NSIndexPath *path = [NSIndexPath indexPathForItem:index inSection:section];\n        [collection addObject:path];\n    } else {\n        [collection addIndex:index];\n    }\n};\n\nstatic NSArray<NSIndexPath *> *indexPathsAndPopulateMap(__unsafe_unretained NSArray<id<IGListDiffable>> *array, NSInteger section, __unsafe_unretained NSMapTable *map) {\n    NSMutableArray<NSIndexPath *> *paths = [NSMutableArray new];\n    [array enumerateObjectsUsingBlock:^(id<IGListDiffable> obj, NSUInteger idx, BOOL *stop) {\n        NSIndexPath *path = [NSIndexPath indexPathForItem:idx inSection:section];\n        [paths addObject:path];\n        [map setObject:path forKey:[obj diffIdentifier]];\n    }];\n    return paths;\n}\n\nstatic id IGListDiffing(BOOL returnIndexPaths,\n                        NSInteger fromSection,\n                        NSInteger toSection,\n                        NSArray<id<IGListDiffable>> *oldArray,\n                        NSArray<id<IGListDiffable>> *newArray,\n                        IGListDiffOption option,\n                        IGListExperiment experiments) {\n    const NSInteger newCount = newArray.count;\n    const NSInteger oldCount = oldArray.count;\n\n    NSMapTable *oldMap = [NSMapTable strongToStrongObjectsMapTable];\n    NSMapTable *newMap = [NSMapTable strongToStrongObjectsMapTable];\n\n    // if no new objects, everything from the oldArray is deleted\n    // take a shortcut and just build a delete-everything result\n    if (newCount == 0) {\n        if (returnIndexPaths) {\n            return [[IGListIndexPathResult alloc] initWithInserts:[NSArray new]\n                                                          deletes:indexPathsAndPopulateMap(oldArray, fromSection, oldMap)\n                                                          updates:[NSArray new]\n                                                            moves:[NSArray new]\n                                                  oldIndexPathMap:oldMap\n                                                  newIndexPathMap:newMap];\n        } else {\n            [oldArray enumerateObjectsUsingBlock:^(id<IGListDiffable> obj, NSUInteger idx, BOOL *stop) {\n                addIndexToMap(returnIndexPaths, fromSection, idx, obj, oldMap);\n            }];\n            return [[IGListIndexSetResult alloc] initWithInserts:[NSIndexSet new]\n                                                         deletes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, oldCount)]\n                                                         updates:[NSIndexSet new]\n                                                           moves:[NSArray new]\n                                                     oldIndexMap:oldMap\n                                                     newIndexMap:newMap];\n        }\n    }\n\n    // if no old objects, everything from the newArray is inserted\n    // take a shortcut and just build an insert-everything result\n    if (oldCount == 0) {\n        if (returnIndexPaths) {\n            return [[IGListIndexPathResult alloc] initWithInserts:indexPathsAndPopulateMap(newArray, toSection, newMap)\n                                                          deletes:[NSArray new]\n                                                          updates:[NSArray new]\n                                                            moves:[NSArray new]\n                                                  oldIndexPathMap:oldMap\n                                                  newIndexPathMap:newMap];\n        } else {\n            [newArray enumerateObjectsUsingBlock:^(id<IGListDiffable> obj, NSUInteger idx, BOOL *stop) {\n                addIndexToMap(returnIndexPaths, toSection, idx, obj, newMap);\n            }];\n            return [[IGListIndexSetResult alloc] initWithInserts:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, newCount)]\n                                                         deletes:[NSIndexSet new]\n                                                         updates:[NSIndexSet new]\n                                                           moves:[NSArray new]\n                                                     oldIndexMap:oldMap\n                                                     newIndexMap:newMap];\n        }\n    }\n\n    // symbol table uses the old/new array diffIdentifier as the key and IGListEntry as the value\n    // using id<NSObject> as the key provided by https://lists.gnu.org/archive/html/discuss-gnustep/2011-07/msg00019.html\n    unordered_map<id<NSObject>, IGListEntry, IGListHashID, IGListEqualID> table;\n\n    // pass 1\n    // create an entry for every item in the new array\n    // increment its new count for each occurence\n    vector<IGListRecord> newResultsArray(newCount);\n    for (NSInteger i = 0; i < newCount; i++) {\n        id<NSObject> key = IGListTableKey(newArray[i]);\n        IGListEntry &entry = table[key];\n        entry.newCounter++;\n\n        // add NSNotFound for each occurence of the item in the new array\n        entry.oldIndexes.push(NSNotFound);\n\n        // note: the entry is just a pointer to the entry which is stack-allocated in the table\n        newResultsArray[i].entry = &entry;\n    }\n\n    // pass 2\n    // update or create an entry for every item in the old array\n    // increment its old count for each occurence\n    // record the original index of the item in the old array\n    // MUST be done in descending order to respect the oldIndexes stack construction\n    vector<IGListRecord> oldResultsArray(oldCount);\n    for (NSInteger i = oldCount - 1; i >= 0; i--) {\n        id<NSObject> key = IGListTableKey(oldArray[i]);\n        IGListEntry &entry = table[key];\n        entry.oldCounter++;\n\n        // push the original indices where the item occurred onto the index stack\n        entry.oldIndexes.push(i);\n\n        // note: the entry is just a pointer to the entry which is stack-allocated in the table\n        oldResultsArray[i].entry = &entry;\n    }\n\n    // pass 3\n    // handle data that occurs in both arrays\n    for (NSInteger i = 0; i < newCount; i++) {\n        IGListEntry *entry = newResultsArray[i].entry;\n\n        // grab and pop the top original index. if the item was inserted this will be NSNotFound\n        NSCAssert(!entry->oldIndexes.empty(), @\"Old indexes is empty while iterating new item %li. Should have NSNotFound\", (long)i);\n        const NSInteger originalIndex = entry->oldIndexes.top();\n        entry->oldIndexes.pop();\n\n        if (originalIndex < oldCount) {\n            const id<IGListDiffable> n = newArray[i];\n            const id<IGListDiffable> o = oldArray[originalIndex];\n            switch (option) {\n                case IGListDiffPointerPersonality:\n                    // flag the entry as updated if the pointers are not the same\n                    if (n != o) {\n                        entry->updated = YES;\n                    }\n                    break;\n                case IGListDiffEquality:\n                    // use -[IGListDiffable isEqualToDiffableObject:] between both version of data to see if anything has changed\n                    // skip the equality check if both indexes point to the same object\n                    if (n != o && ![n isEqualToDiffableObject:o]) {\n                        entry->updated = YES;\n                    }\n                    break;\n            }\n        }\n        if (originalIndex != NSNotFound\n            && entry->newCounter > 0\n            && entry->oldCounter > 0) {\n            // if an item occurs in the new and old array, it is unique\n            // assign the index of new and old records to the opposite index (reverse lookup)\n            newResultsArray[i].index = originalIndex;\n            oldResultsArray[originalIndex].index = i;\n        }\n    }\n\n    // storage for final NSIndexPaths or indexes\n    id mInserts, mMoves, mUpdates, mDeletes;\n    if (returnIndexPaths) {\n        mInserts = [NSMutableArray<NSIndexPath *> new];\n        mMoves = [NSMutableArray<IGListMoveIndexPath *> new];\n        mUpdates = [NSMutableArray<NSIndexPath *> new];\n        mDeletes = [NSMutableArray<NSIndexPath *> new];\n    } else {\n        mInserts = [NSMutableIndexSet new];\n        mMoves = [NSMutableArray<IGListMoveIndex *> new];\n        mUpdates = [NSMutableIndexSet new];\n        mDeletes = [NSMutableIndexSet new];\n    }\n\n    // track offsets from deleted items to calculate where items have moved\n    vector<NSInteger> deleteOffsets(oldCount), insertOffsets(newCount);\n    NSInteger runningOffset = 0;\n\n    // iterate old array records checking for deletes\n    // incremement offset for each delete\n    for (NSInteger i = 0; i < oldCount; i++) {\n        deleteOffsets[i] = runningOffset;\n        const IGListRecord record = oldResultsArray[i];\n        // if the record index in the new array doesn't exist, its a delete\n        if (record.index == NSNotFound) {\n            addIndexToCollection(returnIndexPaths, mDeletes, fromSection, i);\n            runningOffset++;\n        }\n\n        addIndexToMap(returnIndexPaths, fromSection, i, oldArray[i], oldMap);\n    }\n\n    // reset and track offsets from inserted items to calculate where items have moved\n    runningOffset = 0;\n\n    for (NSInteger i = 0; i < newCount; i++) {\n        insertOffsets[i] = runningOffset;\n        const IGListRecord record = newResultsArray[i];\n        const NSInteger oldIndex = record.index;\n        // add to inserts if the opposing index is NSNotFound\n        if (record.index == NSNotFound) {\n            addIndexToCollection(returnIndexPaths, mInserts, toSection, i);\n            runningOffset++;\n        } else {\n            // note that an entry can be updated /and/ moved\n            if (record.entry->updated) {\n                addIndexToCollection(returnIndexPaths, mUpdates, fromSection, oldIndex);\n            }\n\n            // calculate the offset and determine if there was a move\n            // if the indexes match, ignore the index\n            const NSInteger insertOffset = insertOffsets[i];\n            const NSInteger deleteOffset = deleteOffsets[oldIndex];\n            if ((oldIndex - deleteOffset + insertOffset) != i) {\n                id move;\n                if (returnIndexPaths) {\n                    NSIndexPath *from = [NSIndexPath indexPathForItem:oldIndex inSection:fromSection];\n                    NSIndexPath *to = [NSIndexPath indexPathForItem:i inSection:toSection];\n                    move = [[IGListMoveIndexPath alloc] initWithFrom:from to:to];\n                } else {\n                    move = [[IGListMoveIndex alloc] initWithFrom:oldIndex to:i];\n                }\n                [mMoves addObject:move];\n            }\n        }\n\n        addIndexToMap(returnIndexPaths, toSection, i, newArray[i], newMap);\n    }\n\n    NSCAssert((oldCount + [mInserts count] - [mDeletes count]) == newCount,\n              @\"Sanity check failed applying %lu inserts and %lu deletes to old count %li equaling new count %li\",\n              (unsigned long)[mInserts count], (unsigned long)[mDeletes count], (long)oldCount, (long)newCount);\n\n    if (returnIndexPaths) {\n        return [[IGListIndexPathResult alloc] initWithInserts:mInserts\n                                                      deletes:mDeletes\n                                                      updates:mUpdates\n                                                        moves:mMoves\n                                              oldIndexPathMap:oldMap\n                                              newIndexPathMap:newMap];\n    } else {\n        return [[IGListIndexSetResult alloc] initWithInserts:mInserts\n                                                     deletes:mDeletes\n                                                     updates:mUpdates\n                                                       moves:mMoves\n                                                 oldIndexMap:oldMap\n                                                 newIndexMap:newMap];\n    }\n}\n\nIGListIndexSetResult *IGListDiff(NSArray<id<IGListDiffable> > *oldArray,\n                                 NSArray<id<IGListDiffable>> *newArray,\n                                 IGListDiffOption option) {\n    return IGListDiffing(NO, 0, 0, oldArray, newArray, option, 0);\n}\n\nIGListIndexPathResult *IGListDiffPaths(NSInteger fromSection,\n                                       NSInteger toSection,\n                                       NSArray<id<IGListDiffable>> *oldArray,\n                                       NSArray<id<IGListDiffable>> *newArray,\n                                       IGListDiffOption option) {\n    return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option, 0);\n}\n\nIGListIndexSetResult *IGListDiffExperiment(NSArray<id<IGListDiffable>> *_Nullable oldArray,\n                                           NSArray<id<IGListDiffable>> *_Nullable newArray,\n                                           IGListDiffOption option,\n                                           IGListExperiment experiments) {\n    return IGListDiffing(NO, 0, 0, oldArray, newArray, option, experiments);\n}\n\nIGListIndexPathResult *IGListDiffPathsExperiment(NSInteger fromSection,\n                                                 NSInteger toSection,\n                                                 NSArray<id<IGListDiffable>> *_Nullable oldArray,\n                                                 NSArray<id<IGListDiffable>> *_Nullable newArray,\n                                                 IGListDiffOption option,\n                                                 IGListExperiment experiments) {\n    return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option, experiments);\n}\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListDiffKit.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListDiffKit/IGListCompatibility.h>\n\n/**\n * Project version number for IGListKit.\n */\nFOUNDATION_EXPORT double IGListKitVersionNumber;\n\n/**\n * Project version string for IGListKit.\n */\nFOUNDATION_EXPORT const unsigned char IGListKitVersionString[];\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListDiffKit/IGListBatchUpdateData.h>\n#import <IGListDiffKit/IGListDiff.h>\n#import <IGListDiffKit/IGListDiffable.h>\n#import <IGListDiffKit/IGListExperiments.h>\n#import <IGListDiffKit/IGListIndexPathResult.h>\n#import <IGListDiffKit/IGListIndexSetResult.h>\n#import <IGListDiffKit/IGListMoveIndex.h>\n#import <IGListDiffKit/IGListMoveIndexPath.h>\n#import <IGListDiffKit/NSNumber+IGListDiffable.h>\n#import <IGListDiffKit/NSString+IGListDiffable.h>\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListDiffable.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n/**\n The `IGListDiffable` protocol provides methods needed to compare the identity and equality of two objects.\n */\nNS_SWIFT_NAME(ListDiffable)\n@protocol IGListDiffable\n\n/**\n Returns a key that uniquely identifies the object.\n\n @return A key that can be used to uniquely identify the object.\n\n @note Two objects may share the same identifier, but are not equal. A common pattern is to use the `NSObject` \n category for automatic conformance. However this means that objects will be identified on their\n pointer value so finding updates becomes impossible.\n\n @warning This value should never be mutated.\n */\n- (nonnull id<NSObject>)diffIdentifier;\n\n/**\n Returns whether the receiver and a given object are equal.\n\n @param object The object to be compared to the receiver.\n\n @return `YES` if the receiver and object are equal, otherwise `NO`.\n */\n- (BOOL)isEqualToDiffableObject:(nullable id<IGListDiffable>)object;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListExperiments.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListDiff.h>\n\n/**\n Bitmask-able options used for pre-release feature testing.\n */\nNS_SWIFT_NAME(ListExperiment)\ntypedef NS_OPTIONS (NSInteger, IGListExperiment) {\n    /// Specifies no experiments.\n    IGListExperimentNone = 1 << 1,\n    /// Test updater diffing performed on a background queue.\n    IGListExperimentBackgroundDiffing = 1 << 2,\n    /// Test fallback to reloadData when \"too many\" update operations.\n    IGListExperimentReloadDataFallback = 1 << 3,\n    /// Test removing the layout pass when calling scrollToObject to avoid creating off-screen cells.\n    IGListExperimentAvoidLayoutOnScrollToObject = 1 << 4,\n    /// Test fixing a crash when inserting and deleting the same NSIndexPath multiple times.\n    IGListExperimentFixIndexPathImbalance = 1 << 5,\n    /// Test deferring object creation until just before diffing.\n    IGListExperimentDeferredToObjectCreation = 1 << 6,\n    /// Test getting collection view at update time.\n    IGListExperimentGetCollectionViewAtUpdate = 1 << 7,\n    /// Test invalidating layout when cell reloads/updates in IGListBindingSectionController.\n    IGListExperimentInvalidateLayoutForUpdates = 1 << 8,\n    /// Test using the collection view when asking for layout instead of accessing the data source. Only apply to IGListCollectionViewLayout.\n    IGListExperimentUseCollectionViewInsteadOfDataSourceInLayout = 1 << 9\n};\n\n/**\n Check if an experiment is enabled in a bitmask.\n\n @param mask The bitmask of experiments.\n @param option The option to compare with.\n\n @return `YES` if the option is in the bitmask, otherwise `NO`.\n */\nNS_SWIFT_NAME(ListExperimentEnabled(mask:option:))\nstatic inline BOOL IGListExperimentEnabled(IGListExperiment mask, IGListExperiment option) {\n    return (mask & option) != 0;\n}\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Performs an index diff with an experiment bitmask.\n\n @param oldArray The old array of objects.\n @param newArray The new array of objects.\n @param option Option to specify the type of diff.\n @param experiments Optional experiments.\n\n @return An index set result object contained the changed indexes.\n\n @see `IGListDiff()`.\n */\nNS_SWIFT_NAME(ListDiffExperiment(oldArray:newArray:option:experiments:))\nFOUNDATION_EXTERN IGListIndexSetResult *IGListDiffExperiment(NSArray<id<IGListDiffable>> *_Nullable oldArray,\n                                                             NSArray<id<IGListDiffable>> *_Nullable newArray,\n                                                             IGListDiffOption option,\n                                                             IGListExperiment experiments);\n\n/**\n Performs a index path diff with an experiment bitmask.\n\n @param fromSection The old section.\n @param toSection The new section.\n @param oldArray The old array of objects.\n @param newArray The new array of objects.\n @param option Option to specify the type of diff.\n @param experiments Optional experiments.\n\n @return An index path result object containing the changed indexPaths.\n\n @see `IGListDiffPaths()`.\n */\nNS_SWIFT_NAME(ListDiffPathsExperiment(fromSection:toSection:oldArray:newArray:option:experiments:))\nFOUNDATION_EXTERN IGListIndexPathResult *IGListDiffPathsExperiment(NSInteger fromSection,\n                                                                   NSInteger toSection,\n                                                                   NSArray<id<IGListDiffable>> *_Nullable oldArray,\n                                                                   NSArray<id<IGListDiffable>> *_Nullable newArray,\n                                                                   IGListDiffOption option,\n                                                                   IGListExperiment experiments);\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListIndexPathResult.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMoveIndexPath.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A result object returned when diffing with sections.\n */\nNS_SWIFT_NAME(ListIndexPathResult)\n@interface IGListIndexPathResult : NSObject\n\n/**\n The index paths inserted into the new collection.\n */\n@property (nonatomic, copy, readonly) NSArray<NSIndexPath *> *inserts;\n\n/**\n The index paths deleted from the old collection.\n */\n@property (nonatomic, copy, readonly) NSArray<NSIndexPath *> *deletes;\n\n/**\n The index paths in the old collection that need updated.\n */\n@property (nonatomic, copy, readonly) NSArray<NSIndexPath *> *updates;\n\n/**\n The moves from an index path in the old collection to an index path in the new collection.\n */\n@property (nonatomic, copy, readonly) NSArray<IGListMoveIndexPath *> *moves;\n\n/**\n A Read-only boolean that indicates whether the result has any changes or not.\n `YES` if the result has changes, `NO` otherwise.\n */\n@property (nonatomic, assign, readonly) BOOL hasChanges;\n\n/**\n Returns the index path of the object with the specified identifier *before* the diff.\n\n @param identifier The diff identifier of the object.\n\n @return The index path of the object before the diff, or `nil`.\n \n @see `-[IGListDiffable diffIdentifier]`.\n */\n- (nullable NSIndexPath *)oldIndexPathForIdentifier:(id<NSObject>)identifier;\n\n/**\n Returns the index path of the object with the specified identifier *after* the diff.\n\n @param identifier The diff identifier of the object.\n\n @return The index path of the object after the diff, or `nil`.\n\n @see `-[IGListDiffable diffIdentifier]`.\n */\n- (nullable NSIndexPath *)newIndexPathForIdentifier:(id<NSObject>)identifier;\n\n/**\n Creates a new result object with operations safe for use in `UITableView` and `UICollectionView` batch updates.\n */\n- (IGListIndexPathResult *)resultForBatchUpdates;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListIndexPathResult.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListIndexPathResult.h\"\n#import \"IGListIndexPathResultInternal.h\"\n\n@implementation IGListIndexPathResult {\n    NSMapTable<id<NSObject>, NSIndexPath *> *_oldIndexPathMap;\n    NSMapTable<id<NSObject>, NSIndexPath *> *_newIndexPathMap;\n}\n\n- (instancetype)initWithInserts:(NSArray<NSIndexPath *> *)inserts\n                        deletes:(NSArray<NSIndexPath *> *)deletes\n                        updates:(NSArray<NSIndexPath *> *)updates\n                          moves:(NSArray<IGListMoveIndexPath *> *)moves\n                oldIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)oldIndexPathMap\n                newIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)newIndexPathMap {\n    if (self = [super init]) {\n        _inserts = inserts;\n        _deletes = deletes;\n        _updates = updates;\n        _moves = moves;\n        _oldIndexPathMap = oldIndexPathMap;\n        _newIndexPathMap = newIndexPathMap;\n    }\n    return self;\n}\n\n- (BOOL)hasChanges {\n    return self.changeCount > 0;\n}\n\n- (NSInteger)changeCount {\n    return self.inserts.count + self.deletes.count + self.updates.count + self.moves.count;\n}\n\n- (IGListIndexPathResult *)resultForBatchUpdates {\n    NSMutableSet<NSIndexPath *> *deletes = [NSMutableSet setWithArray:self.deletes];\n    NSMutableSet<NSIndexPath *> *inserts = [NSMutableSet setWithArray:self.inserts];\n    NSMutableSet<NSIndexPath *> *filteredUpdates = [NSMutableSet setWithArray:self.updates];\n\n    NSArray<IGListMoveIndexPath *> *moves = self.moves;\n    NSMutableArray<IGListMoveIndexPath *> *filteredMoves = [moves mutableCopy];\n\n    // convert move+update to delete+insert, respecting the from/to of the move\n    const NSInteger moveCount = moves.count;\n    for (NSInteger i = moveCount - 1; i >= 0; i--) {\n        IGListMoveIndexPath *move = moves[i];\n        if ([filteredUpdates containsObject:move.from]) {\n            [filteredMoves removeObjectAtIndex:i];\n            [filteredUpdates removeObject:move.from];\n            [deletes addObject:move.from];\n            [inserts addObject:move.to];\n        }\n    }\n\n    // iterate all new identifiers. if its index is updated, delete from the old index and insert the new index\n    for (id<NSObject> key in [_oldIndexPathMap keyEnumerator]) {\n        NSIndexPath *indexPath = [_oldIndexPathMap objectForKey:key];\n        if ([filteredUpdates containsObject:indexPath]) {\n            [deletes addObject:indexPath];\n            [inserts addObject:(id)[_newIndexPathMap objectForKey:key]];\n        }\n    }\n\n    return [[IGListIndexPathResult alloc] initWithInserts:[inserts allObjects]\n                                                  deletes:[deletes allObjects]\n                                                  updates:[NSArray new]\n                                                    moves:filteredMoves\n                                          oldIndexPathMap:_oldIndexPathMap\n                                          newIndexPathMap:_newIndexPathMap];\n}\n\n- (NSIndexPath *)oldIndexPathForIdentifier:(id<NSObject>)identifier {\n    return [_oldIndexPathMap objectForKey:identifier];\n}\n\n- (NSIndexPath *)newIndexPathForIdentifier:(id<NSObject>)identifier {\n    return [_newIndexPathMap objectForKey:identifier];\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@ %p; %lu inserts; %lu deletes; %lu updates; %lu moves>\",\n            NSStringFromClass(self.class), self, (unsigned long)self.inserts.count, (unsigned long)self.deletes.count, (unsigned long)self.updates.count, (unsigned long)self.moves.count];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListIndexSetResult.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMoveIndex.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A result object returned when diffing with indexes.\n */\nNS_SWIFT_NAME(ListIndexSetResult)\n@interface IGListIndexSetResult : NSObject\n\n/**\n The indexes inserted into the new collection.\n */\n@property (nonatomic, strong, readonly) NSIndexSet *inserts;\n\n/**\n The indexes deleted from the old collection.\n */\n@property (nonatomic, strong, readonly) NSIndexSet *deletes;\n\n/**\n The indexes in the old collection that need updated.\n */\n@property (nonatomic, strong, readonly) NSIndexSet *updates;\n\n/**\n The moves from an index in the old collection to an index in the new collection.\n */\n@property (nonatomic, copy, readonly) NSArray<IGListMoveIndex *> *moves;\n\n/**\n A Read-only boolean that indicates whether the result has any changes or not.\n `YES` if the result has changes, `NO` otherwise.\n */\n@property (nonatomic, assign, readonly) BOOL hasChanges;\n\n/**\n Returns the index of the object with the specified identifier *before* the diff.\n\n @param identifier The diff identifier of the object.\n\n @return The index of the object before the diff, or `NSNotFound`.\n\n @see `-[IGListDiffable diffIdentifier]`.\n */\n- (NSInteger)oldIndexForIdentifier:(id<NSObject>)identifier;\n\n/**\n Returns the index of the object with the specified identifier *after* the diff.\n\n @param identifier The diff identifier of the object.\n\n @return The index path of the object after the diff, or `NSNotFound`.\n\n @see `-[IGListDiffable diffIdentifier]`.\n */\n- (NSInteger)newIndexForIdentifier:(id<NSObject>)identifier;\n\n/**\n Creates a new result object with operations safe for use in `UITableView` and `UICollectionView` batch updates.\n */\n- (IGListIndexSetResult *)resultForBatchUpdates;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListIndexSetResult.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListIndexSetResult.h\"\n#import \"IGListIndexSetResultInternal.h\"\n\n@implementation IGListIndexSetResult {\n    NSMapTable<id<NSObject>, NSNumber *> *_oldIndexMap;\n    NSMapTable<id<NSObject>, NSNumber *> *_newIndexMap;\n}\n\n- (instancetype)initWithInserts:(NSIndexSet *)inserts\n                        deletes:(NSIndexSet *)deletes\n                        updates:(NSIndexSet *)updates\n                          moves:(NSArray<IGListMoveIndex *> *)moves\n                    oldIndexMap:(NSMapTable<id<NSObject>, NSNumber *> *)oldIndexMap\n                    newIndexMap:(NSMapTable<id<NSObject>, NSNumber *> *)newIndexMap {\n    if (self = [super init]) {\n        _inserts = inserts;\n        _deletes = deletes;\n        _updates = updates;\n        _moves = moves;\n        _oldIndexMap = oldIndexMap;\n        _newIndexMap = newIndexMap;\n    }\n    return self;\n}\n\n- (BOOL)hasChanges {\n    return self.changeCount > 0;\n}\n\n- (NSInteger)changeCount {\n    return self.inserts.count + self.deletes.count + self.updates.count + self.moves.count;\n}\n\n- (IGListIndexSetResult *)resultForBatchUpdates {\n    NSMutableIndexSet *deletes = [self.deletes mutableCopy];\n    NSMutableIndexSet *inserts = [self.inserts mutableCopy];\n    NSMutableIndexSet *filteredUpdates = [self.updates mutableCopy];\n\n    NSArray<IGListMoveIndex *> *moves = self.moves;\n    NSMutableArray<IGListMoveIndex *> *filteredMoves = [moves mutableCopy];\n\n    // convert all update+move to delete+insert\n    const NSInteger moveCount = moves.count;\n    for (NSInteger i = moveCount - 1; i >= 0; i--) {\n        IGListMoveIndex *move = moves[i];\n        if ([filteredUpdates containsIndex:move.from]) {\n            [filteredMoves removeObjectAtIndex:i];\n            [filteredUpdates removeIndex:move.from];\n            [deletes addIndex:move.from];\n            [inserts addIndex:move.to];\n        }\n    }\n\n    // iterate all new identifiers. if its index is updated, delete from the old index and insert the new index\n    for (id<NSObject> key in [_oldIndexMap keyEnumerator]) {\n        const NSInteger index = [[_oldIndexMap objectForKey:key] integerValue];\n        if ([filteredUpdates containsIndex:index]) {\n            [deletes addIndex:index];\n            [inserts addIndex:[[_newIndexMap objectForKey:key] integerValue]];\n        }\n    }\n\n    return [[IGListIndexSetResult alloc] initWithInserts:inserts\n                                                 deletes:deletes\n                                                 updates:[NSIndexSet new]\n                                                   moves:filteredMoves\n                                             oldIndexMap:_oldIndexMap\n                                             newIndexMap:_newIndexMap];\n}\n\n- (NSInteger)oldIndexForIdentifier:(id<NSObject>)identifier {\n    NSNumber *index = [_oldIndexMap objectForKey:identifier];\n    return index == nil ? NSNotFound : [index integerValue];\n}\n\n- (NSInteger)newIndexForIdentifier:(id<NSObject>)identifier {\n    NSNumber *index = [_newIndexMap objectForKey:identifier];\n    return index == nil ? NSNotFound : [index integerValue];\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@ %p; %lu inserts; %lu deletes; %lu updates; %lu moves>\",\n            NSStringFromClass(self.class), self, (unsigned long)self.inserts.count, (unsigned long)self.deletes.count, (unsigned long)self.updates.count, (unsigned long)self.moves.count];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListMacros.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#ifndef IGLK_SUBCLASSING_RESTRICTED\n#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)\n#define IGLK_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted))\n#else\n#define IGLK_SUBCLASSING_RESTRICTED\n#endif // #if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)\n#endif // #ifndef IGLK_SUBCLASSING_RESTRICTED\n\n#ifndef IGLK_UNAVAILABLE\n#define IGLK_UNAVAILABLE(message) __attribute__((unavailable(message)))\n#endif // #ifndef IGLK_UNAVAILABLE\n\n#if IGLK_LOGGING_ENABLED\n#define IGLKLog( s, ... ) do { NSLog( @\"IGListKit: %@\", [NSString stringWithFormat: (s), ##__VA_ARGS__] ); } while(0)\n#else\n#define IGLKLog( s, ... )\n#endif\n\n#ifndef IGLK_DEBUG_DESCRIPTION_ENABLED\n#define IGLK_DEBUG_DESCRIPTION_ENABLED DEBUG\n#endif // #ifndef IGLK_DEBUG_DESCRIPTION_ENABLED\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListMoveIndex.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An object representing a move between indexes.\n */\nNS_SWIFT_NAME(ListMoveIndex)\n@interface IGListMoveIndex : NSObject\n\n/**\n An index in the old collection.\n */\n@property (nonatomic, assign, readonly) NSInteger from;\n\n/**\n An index in the new collection.\n */\n@property (nonatomic, assign, readonly) NSInteger to;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListMoveIndex.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListMoveIndex.h\"\n\n@implementation IGListMoveIndex\n\n- (instancetype)initWithFrom:(NSInteger)from to:(NSInteger)to {\n    if (self = [super init]) {\n        _from = from;\n        _to = to;\n    }\n    return self;\n}\n\n- (NSUInteger)hash {\n    return _from ^ _to;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (object == self) {\n        return YES;\n    }\n    if ([object isKindOfClass:[IGListMoveIndex class]]) {\n        const NSInteger f1 = self.from, f2 = [object from];\n        const NSInteger t1 = self.to, t2 = [object to];\n        return f1 == f2 && t1 == t2;\n    }\n    return NO;\n}\n\n- (NSComparisonResult)compare:(id)object {\n    const NSInteger right = [object from];\n    const NSInteger left = [self from];\n    if (left == right) {\n        return NSOrderedSame;\n    } else if (left < right) {\n        return NSOrderedAscending;\n    } else {\n        return NSOrderedDescending;\n    }\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@ %p; from: %li; to: %li;>\", NSStringFromClass(self.class), self, (long)self.from, (long)self.to];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListMoveIndexPath.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An object representing a move between indexes.\n */\nNS_SWIFT_NAME(ListMoveIndexPath)\n@interface IGListMoveIndexPath : NSObject\n\n/**\n An index path in the old collection.\n */\n@property (nonatomic, strong, readonly) NSIndexPath *from;\n\n/**\n An index path in the new collection.\n */\n@property (nonatomic, strong, readonly) NSIndexPath *to;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/IGListMoveIndexPath.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListMoveIndexPath.h\"\n\n@implementation IGListMoveIndexPath\n\n- (instancetype)initWithFrom:(NSIndexPath *)from to:(NSIndexPath *)to {\n    NSParameterAssert(from != nil);\n    NSParameterAssert(to != nil);\n    if (self = [super init]) {\n        _from = from;\n        _to = to;\n    }\n    return self;\n}\n\n- (NSUInteger)hash {\n    return [_from hash] ^ [_to hash];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (object == self) {\n        return YES;\n    }\n    if ([object isKindOfClass:[IGListMoveIndexPath class]]) {\n        NSIndexPath *f1 = self.from, *f2 = [object from];\n        NSIndexPath *t1 = self.to, *t2 = [object to];\n        return [f1 isEqual:f2] && [t1 isEqual:t2];\n    }\n    return NO;\n}\n\n- (NSComparisonResult)compare:(id)object {\n    return [[self from] compare:[object from]];\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@ %p; from: %@; to: %@;>\", NSStringFromClass(self.class), self, self.from, self.to];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/Internal/IGListIndexPathResultInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListIndexPathResult.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListIndexPathResult()\n\n- (instancetype)initWithInserts:(NSArray<NSIndexPath *> *)inserts\n                        deletes:(NSArray<NSIndexPath *> *)deletes\n                        updates:(NSArray<NSIndexPath *> *)updates\n                          moves:(NSArray<IGListMoveIndexPath *> *)moves\n                oldIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)oldIndexPathMap\n                newIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)newIndexPathMap;\n\n@property (nonatomic, assign, readonly) NSInteger changeCount;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/Internal/IGListIndexSetResultInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListIndexSetResult.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListIndexSetResult()\n\n- (instancetype)initWithInserts:(NSIndexSet *)inserts\n                        deletes:(NSIndexSet *)deletes\n                        updates:(NSIndexSet *)updates\n                          moves:(NSArray<IGListMoveIndex *> *)moves\n                    oldIndexMap:(NSMapTable<id<NSObject>, NSNumber *> *)oldIndexMap\n                    newIndexMap:(NSMapTable<id<NSObject>, NSNumber *> *)newIndexMap;\n\n@property (nonatomic, assign, readonly) NSInteger changeCount;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/Internal/IGListMoveIndexInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMoveIndex.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListMoveIndex ()\n\n- (instancetype)initWithFrom:(NSInteger)from to:(NSInteger)to NS_DESIGNATED_INITIALIZER;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/Internal/IGListMoveIndexPathInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListMoveIndexPath ()\n\n- (instancetype)initWithFrom:(NSIndexPath *)from to:(NSIndexPath *)to NS_DESIGNATED_INITIALIZER;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/NSNumber+IGListDiffable.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListDiffable.h>\n\n/**\n This category provides default `IGListDiffable` conformance for `NSNumber`.\n */\n@interface NSNumber (IGListDiffable) <IGListDiffable>\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/NSNumber+IGListDiffable.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"NSNumber+IGListDiffable.h\"\n\n@implementation NSNumber (IGListDiffable)\n\n- (id<NSObject>)diffIdentifier {\n    return self;\n}\n\n- (BOOL)isEqualToDiffableObject:(id<IGListDiffable>)object {\n    return [self isEqual:object];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/NSString+IGListDiffable.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListDiffable.h>\n\n/**\n This category provides default `IGListDiffable` conformance for `NSString`.\n */\n@interface NSString (IGListDiffable) <IGListDiffable>\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit/Source/IGListDiffKit/NSString+IGListDiffable.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"NSString+IGListDiffable.h\"\n\n@implementation NSString (IGListDiffable)\n\n- (id<NSObject>)diffIdentifier {\n    return self;\n}\n\n- (BOOL)isEqualToDiffableObject:(id<IGListDiffable>)object {\n    return [self isEqual:object];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListDiffKit.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t0E7B5A4FA3947991B079FC8036B1D57E /* NSString+IGListDiffable.m in Sources */ = {isa = PBXBuildFile; fileRef = 891CC7C693988BFC9A8D26C0301B8648 /* NSString+IGListDiffable.m */; };\n\t\t1C0FEC4DBC92CA502EB97ABECD940922 /* NSNumber+IGListDiffable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4500275AFBA8B77116EC51FBF9CDB67A /* NSNumber+IGListDiffable.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1C41AA2C97C7743D2B5FACD8981DBD1D /* NSNumber+IGListDiffable.m in Sources */ = {isa = PBXBuildFile; fileRef = 563A74A4AAE0AE3F80D15DD13EAA1FD9 /* NSNumber+IGListDiffable.m */; };\n\t\t1CA3C8653E3F742C0FA38B7589F39B40 /* IGListDiffKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CAF7C8ABD4F22C75D54B309648589D36 /* IGListDiffKit-dummy.m */; };\n\t\t21DE7B226CB11026BEB28EE188785E5D /* IGListIndexPathResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 85B69351814D2368E6A962E35AB63843 /* IGListIndexPathResult.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2E428040542468E65509083E3B6CF0F6 /* IGListCompatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = D305A8FA60FA27EF707A75D040E0DF36 /* IGListCompatibility.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3BC80255D812EB19D1F0A5F4F9047F86 /* IGListIndexPathResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D040CE96D774B44BD2D25941B823775 /* IGListIndexPathResult.m */; };\n\t\t3C991924113297BCE709D5A164F250E4 /* IGListBatchUpdateData.mm in Sources */ = {isa = PBXBuildFile; fileRef = E9744EADF79114CCF14C8CC73294E313 /* IGListBatchUpdateData.mm */; };\n\t\t41559189D435B4EEDD5CFD198FDCF73F /* IGListBatchUpdateData.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDBAE08ED0521773AEF7C6EE588C21F /* IGListBatchUpdateData.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6664644E3E0B730609FB3B13926D871F /* IGListMoveIndexPathInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 52DC5E1716D36FEAF32C7C38B5EB7FC6 /* IGListMoveIndexPathInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t6BFE1372141D1D1C93E44E508CDB9E67 /* IGListMoveIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = 529D8B78455D278363BA20251A9036A1 /* IGListMoveIndex.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6F44268A22C89E67711B2D9686BEC00C /* IGListMoveIndex.m in Sources */ = {isa = PBXBuildFile; fileRef = 58A29333CCD6F15FBB167E1B9F9F0686 /* IGListMoveIndex.m */; };\n\t\t6FC4B2264ED4D460053E300C3E5BE109 /* IGListIndexPathResultInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B1CD1A034AD3F64EF1A6B1E12871787 /* IGListIndexPathResultInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t71D7D70B6E8302C82CBCD8EACAC20D7C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D25C9CCFEB555036C7B8D4289B775FD3 /* Foundation.framework */; };\n\t\t805C1C2E0B9E4E74E69C9209453D901F /* IGListMoveIndexInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE24744139B94E829E268A9D55522EF /* IGListMoveIndexInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t843D71F9C98B0BCF89B5927C99C66A71 /* IGListDiffable.h in Headers */ = {isa = PBXBuildFile; fileRef = 688D88734730651A988AA978538DA29B /* IGListDiffable.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8774A64D1962DFA2002048AC7B10344E /* IGListMoveIndexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F07DA24694AA6DB43A506C9DEA41617 /* IGListMoveIndexPath.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8800BD3FBF12AEC2C82020FB97363427 /* IGListDiffKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 50486C82FB8A45758EA656C470AAF32D /* IGListDiffKit.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8BF32B5178F06AB0468C2FA7D10D1134 /* NSString+IGListDiffable.h in Headers */ = {isa = PBXBuildFile; fileRef = D5879AB360AAD21A13724A3E132B2033 /* NSString+IGListDiffable.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t9431688AF26EBCB3A62B39BBE3AFDDC8 /* IGListDiff.mm in Sources */ = {isa = PBXBuildFile; fileRef = D34C93E79073FEB04582F4513327E0FC /* IGListDiff.mm */; };\n\t\tB2545C4C4EA775048BF0ABF7994B9D1D /* IGListDiff.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A221EDAD4E2184FCCA736DAE49BED72 /* IGListDiff.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB484BDF8EDCA5419E87AFC9C84C51CED /* IGListMoveIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 898B5668B5F49B68967804ED76E9DA5C /* IGListMoveIndexPath.m */; };\n\t\tB59E967EAC4DC977EA6C8A7D7E4F3371 /* IGListIndexSetResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A8AAAAF750EB65101D319B91D06A6B8 /* IGListIndexSetResult.m */; };\n\t\tCED21D9D67576CD13A71FB3B5AF34B69 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66138C4701012355A8B43FDC990F9E79 /* UIKit.framework */; };\n\t\tD1C38BED14869358A5B6E53FB461F6F7 /* IGListIndexSetResultInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DB29E6E4830E5DB57D6F1ED8C147E99 /* IGListIndexSetResultInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tE1D9BD1F669E7D4A6A466442B4A5F441 /* IGListAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D57CBA4A6A588D33F27392773D9F6DD /* IGListAssert.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE5868779EDF1A0EECF30F714AABD1A97 /* IGListDiffKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 53FB42C0F73BE3B531945BE429513243 /* IGListDiffKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE75E6AC70F1D2148A70312AF9E370154 /* IGListIndexSetResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 797790920421ACCB6E4AD187A8C02567 /* IGListIndexSetResult.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEC223EBF07D5D0EC88CECB2A47CF74DE /* IGListMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FCD7ECDFEC351BA09EAEF9216D21A30 /* IGListMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF5BDE92E37209743EB917C28668FC993 /* IGListExperiments.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C58B2CD3CE9171839925A43D7509F9 /* IGListExperiments.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t07C58B2CD3CE9171839925A43D7509F9 /* IGListExperiments.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListExperiments.h; path = Source/IGListDiffKit/IGListExperiments.h; sourceTree = \"<group>\"; };\n\t\t09906A73B522E0B399586722C2E4010E /* IGListDiffKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IGListDiffKit.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t1A221EDAD4E2184FCCA736DAE49BED72 /* IGListDiff.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListDiff.h; path = Source/IGListDiffKit/IGListDiff.h; sourceTree = \"<group>\"; };\n\t\t1B1CD1A034AD3F64EF1A6B1E12871787 /* IGListIndexPathResultInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListIndexPathResultInternal.h; path = Source/IGListDiffKit/Internal/IGListIndexPathResultInternal.h; sourceTree = \"<group>\"; };\n\t\t2D040CE96D774B44BD2D25941B823775 /* IGListIndexPathResult.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListIndexPathResult.m; path = Source/IGListDiffKit/IGListIndexPathResult.m; sourceTree = \"<group>\"; };\n\t\t3A8AAAAF750EB65101D319B91D06A6B8 /* IGListIndexSetResult.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListIndexSetResult.m; path = Source/IGListDiffKit/IGListIndexSetResult.m; sourceTree = \"<group>\"; };\n\t\t3D09B8D220B715033D7540B4338537C6 /* IGListDiffKit */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IGListDiffKit; path = IGListDiffKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t3FCD7ECDFEC351BA09EAEF9216D21A30 /* IGListMacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListMacros.h; path = Source/IGListDiffKit/IGListMacros.h; sourceTree = \"<group>\"; };\n\t\t4500275AFBA8B77116EC51FBF9CDB67A /* NSNumber+IGListDiffable.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSNumber+IGListDiffable.h\"; path = \"Source/IGListDiffKit/NSNumber+IGListDiffable.h\"; sourceTree = \"<group>\"; };\n\t\t4AEF45B68E019E8EFB6FCE002BB87957 /* IGListDiffKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IGListDiffKit.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t4B2DA503A39987D3759F731F635458D3 /* IGListDiffKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IGListDiffKit.modulemap; sourceTree = \"<group>\"; };\n\t\t4DB29E6E4830E5DB57D6F1ED8C147E99 /* IGListIndexSetResultInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListIndexSetResultInternal.h; path = Source/IGListDiffKit/Internal/IGListIndexSetResultInternal.h; sourceTree = \"<group>\"; };\n\t\t50486C82FB8A45758EA656C470AAF32D /* IGListDiffKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListDiffKit.h; path = Source/IGListDiffKit/IGListDiffKit.h; sourceTree = \"<group>\"; };\n\t\t529D8B78455D278363BA20251A9036A1 /* IGListMoveIndex.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListMoveIndex.h; path = Source/IGListDiffKit/IGListMoveIndex.h; sourceTree = \"<group>\"; };\n\t\t52DC5E1716D36FEAF32C7C38B5EB7FC6 /* IGListMoveIndexPathInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListMoveIndexPathInternal.h; path = Source/IGListDiffKit/Internal/IGListMoveIndexPathInternal.h; sourceTree = \"<group>\"; };\n\t\t53FB42C0F73BE3B531945BE429513243 /* IGListDiffKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"IGListDiffKit-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t563A74A4AAE0AE3F80D15DD13EAA1FD9 /* NSNumber+IGListDiffable.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSNumber+IGListDiffable.m\"; path = \"Source/IGListDiffKit/NSNumber+IGListDiffable.m\"; sourceTree = \"<group>\"; };\n\t\t58A29333CCD6F15FBB167E1B9F9F0686 /* IGListMoveIndex.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListMoveIndex.m; path = Source/IGListDiffKit/IGListMoveIndex.m; sourceTree = \"<group>\"; };\n\t\t66138C4701012355A8B43FDC990F9E79 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };\n\t\t688D88734730651A988AA978538DA29B /* IGListDiffable.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListDiffable.h; path = Source/IGListDiffKit/IGListDiffable.h; sourceTree = \"<group>\"; };\n\t\t68DC990799B9F016F837531000EADBFB /* IGListDiffKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"IGListDiffKit-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t797790920421ACCB6E4AD187A8C02567 /* IGListIndexSetResult.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListIndexSetResult.h; path = Source/IGListDiffKit/IGListIndexSetResult.h; sourceTree = \"<group>\"; };\n\t\t85B69351814D2368E6A962E35AB63843 /* IGListIndexPathResult.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListIndexPathResult.h; path = Source/IGListDiffKit/IGListIndexPathResult.h; sourceTree = \"<group>\"; };\n\t\t891CC7C693988BFC9A8D26C0301B8648 /* NSString+IGListDiffable.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSString+IGListDiffable.m\"; path = \"Source/IGListDiffKit/NSString+IGListDiffable.m\"; sourceTree = \"<group>\"; };\n\t\t898B5668B5F49B68967804ED76E9DA5C /* IGListMoveIndexPath.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListMoveIndexPath.m; path = Source/IGListDiffKit/IGListMoveIndexPath.m; sourceTree = \"<group>\"; };\n\t\t8D57CBA4A6A588D33F27392773D9F6DD /* IGListAssert.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAssert.h; path = Source/IGListDiffKit/IGListAssert.h; sourceTree = \"<group>\"; };\n\t\t8F07DA24694AA6DB43A506C9DEA41617 /* IGListMoveIndexPath.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListMoveIndexPath.h; path = Source/IGListDiffKit/IGListMoveIndexPath.h; sourceTree = \"<group>\"; };\n\t\t9579ACF571D506683799F4307415BCC0 /* IGListDiffKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"IGListDiffKit-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tCAE24744139B94E829E268A9D55522EF /* IGListMoveIndexInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListMoveIndexInternal.h; path = Source/IGListDiffKit/Internal/IGListMoveIndexInternal.h; sourceTree = \"<group>\"; };\n\t\tCAF7C8ABD4F22C75D54B309648589D36 /* IGListDiffKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"IGListDiffKit-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tD25C9CCFEB555036C7B8D4289B775FD3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tD305A8FA60FA27EF707A75D040E0DF36 /* IGListCompatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCompatibility.h; path = Source/IGListDiffKit/IGListCompatibility.h; sourceTree = \"<group>\"; };\n\t\tD34C93E79073FEB04582F4513327E0FC /* IGListDiff.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = IGListDiff.mm; path = Source/IGListDiffKit/IGListDiff.mm; sourceTree = \"<group>\"; };\n\t\tD5879AB360AAD21A13724A3E132B2033 /* NSString+IGListDiffable.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSString+IGListDiffable.h\"; path = \"Source/IGListDiffKit/NSString+IGListDiffable.h\"; sourceTree = \"<group>\"; };\n\t\tE9744EADF79114CCF14C8CC73294E313 /* IGListBatchUpdateData.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = IGListBatchUpdateData.mm; path = Source/IGListDiffKit/IGListBatchUpdateData.mm; sourceTree = \"<group>\"; };\n\t\tFEDBAE08ED0521773AEF7C6EE588C21F /* IGListBatchUpdateData.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBatchUpdateData.h; path = Source/IGListDiffKit/IGListBatchUpdateData.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3313EB213E440351B6DDEB1787E2FACD /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t71D7D70B6E8302C82CBCD8EACAC20D7C /* Foundation.framework in Frameworks */,\n\t\t\t\tCED21D9D67576CD13A71FB3B5AF34B69 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0213B4968B149ADE9A6FB192D8431B4E /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3D09B8D220B715033D7540B4338537C6 /* IGListDiffKit */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t32A04C87608171B5B1C10FDA65C61137 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t87ED95DC7ED385F8EB7A0B20281E5F14 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t51E6DDA9E73D1A9EE26513524CB577A5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t32A04C87608171B5B1C10FDA65C61137 /* Frameworks */,\n\t\t\t\tA8F56ED980735121AED4CFC967C59371 /* IGListDiffKit */,\n\t\t\t\t0213B4968B149ADE9A6FB192D8431B4E /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t686053AFCF0016C9C90270948248D52A /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4B2DA503A39987D3759F731F635458D3 /* IGListDiffKit.modulemap */,\n\t\t\t\tCAF7C8ABD4F22C75D54B309648589D36 /* IGListDiffKit-dummy.m */,\n\t\t\t\t9579ACF571D506683799F4307415BCC0 /* IGListDiffKit-Info.plist */,\n\t\t\t\t68DC990799B9F016F837531000EADBFB /* IGListDiffKit-prefix.pch */,\n\t\t\t\t53FB42C0F73BE3B531945BE429513243 /* IGListDiffKit-umbrella.h */,\n\t\t\t\t09906A73B522E0B399586722C2E4010E /* IGListDiffKit.debug.xcconfig */,\n\t\t\t\t4AEF45B68E019E8EFB6FCE002BB87957 /* IGListDiffKit.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/IGListDiffKit\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t87ED95DC7ED385F8EB7A0B20281E5F14 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD25C9CCFEB555036C7B8D4289B775FD3 /* Foundation.framework */,\n\t\t\t\t66138C4701012355A8B43FDC990F9E79 /* UIKit.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA8F56ED980735121AED4CFC967C59371 /* IGListDiffKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8D57CBA4A6A588D33F27392773D9F6DD /* IGListAssert.h */,\n\t\t\t\tFEDBAE08ED0521773AEF7C6EE588C21F /* IGListBatchUpdateData.h */,\n\t\t\t\tE9744EADF79114CCF14C8CC73294E313 /* IGListBatchUpdateData.mm */,\n\t\t\t\tD305A8FA60FA27EF707A75D040E0DF36 /* IGListCompatibility.h */,\n\t\t\t\t1A221EDAD4E2184FCCA736DAE49BED72 /* IGListDiff.h */,\n\t\t\t\tD34C93E79073FEB04582F4513327E0FC /* IGListDiff.mm */,\n\t\t\t\t688D88734730651A988AA978538DA29B /* IGListDiffable.h */,\n\t\t\t\t50486C82FB8A45758EA656C470AAF32D /* IGListDiffKit.h */,\n\t\t\t\t07C58B2CD3CE9171839925A43D7509F9 /* IGListExperiments.h */,\n\t\t\t\t85B69351814D2368E6A962E35AB63843 /* IGListIndexPathResult.h */,\n\t\t\t\t2D040CE96D774B44BD2D25941B823775 /* IGListIndexPathResult.m */,\n\t\t\t\t1B1CD1A034AD3F64EF1A6B1E12871787 /* IGListIndexPathResultInternal.h */,\n\t\t\t\t797790920421ACCB6E4AD187A8C02567 /* IGListIndexSetResult.h */,\n\t\t\t\t3A8AAAAF750EB65101D319B91D06A6B8 /* IGListIndexSetResult.m */,\n\t\t\t\t4DB29E6E4830E5DB57D6F1ED8C147E99 /* IGListIndexSetResultInternal.h */,\n\t\t\t\t3FCD7ECDFEC351BA09EAEF9216D21A30 /* IGListMacros.h */,\n\t\t\t\t529D8B78455D278363BA20251A9036A1 /* IGListMoveIndex.h */,\n\t\t\t\t58A29333CCD6F15FBB167E1B9F9F0686 /* IGListMoveIndex.m */,\n\t\t\t\tCAE24744139B94E829E268A9D55522EF /* IGListMoveIndexInternal.h */,\n\t\t\t\t8F07DA24694AA6DB43A506C9DEA41617 /* IGListMoveIndexPath.h */,\n\t\t\t\t898B5668B5F49B68967804ED76E9DA5C /* IGListMoveIndexPath.m */,\n\t\t\t\t52DC5E1716D36FEAF32C7C38B5EB7FC6 /* IGListMoveIndexPathInternal.h */,\n\t\t\t\t4500275AFBA8B77116EC51FBF9CDB67A /* NSNumber+IGListDiffable.h */,\n\t\t\t\t563A74A4AAE0AE3F80D15DD13EAA1FD9 /* NSNumber+IGListDiffable.m */,\n\t\t\t\tD5879AB360AAD21A13724A3E132B2033 /* NSString+IGListDiffable.h */,\n\t\t\t\t891CC7C693988BFC9A8D26C0301B8648 /* NSString+IGListDiffable.m */,\n\t\t\t\t686053AFCF0016C9C90270948248D52A /* Support Files */,\n\t\t\t);\n\t\t\tname = IGListDiffKit;\n\t\t\tpath = IGListDiffKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tDFEDAEE18D870C0BE780FF3982BD969E /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE1D9BD1F669E7D4A6A466442B4A5F441 /* IGListAssert.h in Headers */,\n\t\t\t\t41559189D435B4EEDD5CFD198FDCF73F /* IGListBatchUpdateData.h in Headers */,\n\t\t\t\t2E428040542468E65509083E3B6CF0F6 /* IGListCompatibility.h in Headers */,\n\t\t\t\tB2545C4C4EA775048BF0ABF7994B9D1D /* IGListDiff.h in Headers */,\n\t\t\t\t843D71F9C98B0BCF89B5927C99C66A71 /* IGListDiffable.h in Headers */,\n\t\t\t\t8800BD3FBF12AEC2C82020FB97363427 /* IGListDiffKit.h in Headers */,\n\t\t\t\tE5868779EDF1A0EECF30F714AABD1A97 /* IGListDiffKit-umbrella.h in Headers */,\n\t\t\t\tF5BDE92E37209743EB917C28668FC993 /* IGListExperiments.h in Headers */,\n\t\t\t\t21DE7B226CB11026BEB28EE188785E5D /* IGListIndexPathResult.h in Headers */,\n\t\t\t\t6FC4B2264ED4D460053E300C3E5BE109 /* IGListIndexPathResultInternal.h in Headers */,\n\t\t\t\tE75E6AC70F1D2148A70312AF9E370154 /* IGListIndexSetResult.h in Headers */,\n\t\t\t\tD1C38BED14869358A5B6E53FB461F6F7 /* IGListIndexSetResultInternal.h in Headers */,\n\t\t\t\tEC223EBF07D5D0EC88CECB2A47CF74DE /* IGListMacros.h in Headers */,\n\t\t\t\t6BFE1372141D1D1C93E44E508CDB9E67 /* IGListMoveIndex.h in Headers */,\n\t\t\t\t805C1C2E0B9E4E74E69C9209453D901F /* IGListMoveIndexInternal.h in Headers */,\n\t\t\t\t8774A64D1962DFA2002048AC7B10344E /* IGListMoveIndexPath.h in Headers */,\n\t\t\t\t6664644E3E0B730609FB3B13926D871F /* IGListMoveIndexPathInternal.h in Headers */,\n\t\t\t\t1C0FEC4DBC92CA502EB97ABECD940922 /* NSNumber+IGListDiffable.h in Headers */,\n\t\t\t\t8BF32B5178F06AB0468C2FA7D10D1134 /* NSString+IGListDiffable.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t9074A5DFB260E6240F743D74D3F432DD /* IGListDiffKit */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 90343FA0F0F3FD4E515F8011D89B7655 /* Build configuration list for PBXNativeTarget \"IGListDiffKit\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tDFEDAEE18D870C0BE780FF3982BD969E /* Headers */,\n\t\t\t\t434AF7F7EF11B97F7B0A49C9D84CE274 /* Sources */,\n\t\t\t\t3313EB213E440351B6DDEB1787E2FACD /* Frameworks */,\n\t\t\t\t7E74210CCEC52B33E183CF0F9BFEE885 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = IGListDiffKit;\n\t\t\tproductName = IGListDiffKit;\n\t\t\tproductReference = 3D09B8D220B715033D7540B4338537C6 /* IGListDiffKit */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t8B76D7491E1F67A0F4D5DF287FE0F5DD /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 5D29734D6ABF87BF0167C68BFC6AAC1B /* Build configuration list for PBXProject \"IGListDiffKit\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 51E6DDA9E73D1A9EE26513524CB577A5;\n\t\t\tproductRefGroup = 0213B4968B149ADE9A6FB192D8431B4E /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t9074A5DFB260E6240F743D74D3F432DD /* IGListDiffKit */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t7E74210CCEC52B33E183CF0F9BFEE885 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t434AF7F7EF11B97F7B0A49C9D84CE274 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3C991924113297BCE709D5A164F250E4 /* IGListBatchUpdateData.mm in Sources */,\n\t\t\t\t9431688AF26EBCB3A62B39BBE3AFDDC8 /* IGListDiff.mm in Sources */,\n\t\t\t\t1CA3C8653E3F742C0FA38B7589F39B40 /* IGListDiffKit-dummy.m in Sources */,\n\t\t\t\t3BC80255D812EB19D1F0A5F4F9047F86 /* IGListIndexPathResult.m in Sources */,\n\t\t\t\tB59E967EAC4DC977EA6C8A7D7E4F3371 /* IGListIndexSetResult.m in Sources */,\n\t\t\t\t6F44268A22C89E67711B2D9686BEC00C /* IGListMoveIndex.m in Sources */,\n\t\t\t\tB484BDF8EDCA5419E87AFC9C84C51CED /* IGListMoveIndexPath.m in Sources */,\n\t\t\t\t1C41AA2C97C7743D2B5FACD8981DBD1D /* NSNumber+IGListDiffable.m in Sources */,\n\t\t\t\t0E7B5A4FA3947991B079FC8036B1D57E /* NSString+IGListDiffable.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t831D2B424C71C452F2DECB3B1CC388D2 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t98DB69DBC18935DE6609ABCD9987EA2C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 09906A73B522E0B399586722C2E4010E /* IGListDiffKit.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/IGListDiffKit/IGListDiffKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/IGListDiffKit/IGListDiffKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/IGListDiffKit/IGListDiffKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = IGListDiffKit;\n\t\t\t\tPRODUCT_NAME = IGListDiffKit;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tAA1381E1295BC961C43CB26FA88E977A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tAFA842305C0BC253DE7DDA56FDA40357 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 4AEF45B68E019E8EFB6FCE002BB87957 /* IGListDiffKit.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/IGListDiffKit/IGListDiffKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/IGListDiffKit/IGListDiffKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/IGListDiffKit/IGListDiffKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = IGListDiffKit;\n\t\t\t\tPRODUCT_NAME = IGListDiffKit;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t5D29734D6ABF87BF0167C68BFC6AAC1B /* Build configuration list for PBXProject \"IGListDiffKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tAA1381E1295BC961C43CB26FA88E977A /* Debug */,\n\t\t\t\t831D2B424C71C452F2DECB3B1CC388D2 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t90343FA0F0F3FD4E515F8011D89B7655 /* Build configuration list for PBXNativeTarget \"IGListDiffKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t98DB69DBC18935DE6609ABCD9987EA2C /* Debug */,\n\t\t\t\tAFA842305C0BC253DE7DDA56FDA40357 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 8B76D7491E1F67A0F4D5DF287FE0F5DD /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/LICENSE.md",
    "content": "MIT License\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
  },
  {
    "path": "JetChat/Pods/IGListKit/README.md",
    "content": "<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/Instagram/IGListKit/master/Resources/logo-animation.gif\" width=400 />\n</p>\n\n<p align=\"center\">\n    <a href=\"https://travis-ci.org/Instagram/IGListKit\">\n        <img src=\"https://travis-ci.org/Instagram/IGListKit.svg?branch=master&style=flat\"\n             alt=\"Build Status\">\n    </a>\n    <a href=\"https://coveralls.io/github/Instagram/IGListKit?branch=master\">\n      <img src=\"https://coveralls.io/repos/github/Instagram/IGListKit/badge.svg?branch=master\"\n           alt=\"Coverage Status\" />\n    </a>\n    <a href=\"https://cocoapods.org/pods/IGListKit\">\n        <img src=\"https://img.shields.io/cocoapods/v/IGListKit.svg?style=flat\"\n             alt=\"Pods Version\">\n    </a>\n    <a href=\"https://instagram.github.io/IGListKit/\">\n        <img src=\"https://img.shields.io/cocoapods/p/IGListKit.svg?style=flat\"\n             alt=\"Platforms\">\n    </a>\n    <a href=\"https://github.com/Carthage/Carthage\">\n        <img src=\"https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat\"\n             alt=\"Carthage Compatible\">\n    </a>\n</p>\n\n----------------\n\nA data-driven `UICollectionView` framework for building fast and flexible lists.\n\n|         | Main Features  |\n----------|-----------------\n&#128581; | Never call `performBatchUpdates(_:, completion:)` or `reloadData()` again\n&#127968; | Better architecture with reusable cells and components\n&#128288; | Create collections with multiple data types\n&#128273; | Decoupled diffing algorithm\n&#9989;   | Fully unit tested\n&#128269; | Customize your diffing behavior for your models\n&#128241; | Simply `UICollectionView` at its core\n&#128640; | Extendable API\n&#128038; | Written in Objective-C with full Swift interop support\n\n`IGListKit` is built and maintained with &#10084;&#65039; by [Instagram engineering](https://engineering.instagram.com/).\nWe use the open source version `master` branch in the Instagram app.\n\n## Requirements\n\n- Xcode 9.0+\n- iOS 9.0+\n- tvOS 9.0+\n- macOS 10.11+ *(diffing algorithm components only)*\n- Interoperability with Swift 3.0+\n\n## Installation\n\n### CocoaPods\n\nThe preferred installation method is with [CocoaPods](https://cocoapods.org). Add the following to your `Podfile`:\n\n```ruby\npod 'IGListKit', '~> 4.0.0'\n```\n\n### Carthage\n\nFor [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:\n\n```ogdl\ngithub \"Instagram/IGListKit\" ~> 4.0.0\n```\n\n> For advanced usage, see our [Installation Guide](https://instagram.github.io/IGListKit/installation.html).\n\n## Getting Started\n\n```bash\n$ git clone https://github.com/Instagram/IGListKit.git\n$ cd IGListKit/\n$ ./scripts/setup.sh\n```\n\n- Our [Getting Started guide](https://instagram.github.io/IGListKit/getting-started.html)\n- Ray Wenderlich's [IGListKit Tutorial: Better UICollectionViews](https://www.raywenderlich.com/147162/iglistkit-tutorial-better-uicollectionviews)\n- Our [example projects](https://github.com/Instagram/IGListKit/tree/master/Examples)\n- Ryan Nystrom's [talk at try! Swift NYC](https://realm.io/news/tryswift-ryan-nystrom-refactoring-at-scale-lessons-learned-rewriting-instagram-feed/) (Note: this talk was for an earlier version. Some APIs have changed.)\n- [Migrating an UITableView to IGListCollectionView](https://medium.com/cocoaacademymag/iglistkit-migrating-an-uitableview-to-iglistkitcollectionview-65a30cf9bac9), by Rodrigo Cavalcante\n- [Keeping data fresh in Buffer for iOS with AsyncDisplayKit, IGListKit & Pusher](https://overflow.buffer.com/2017/04/10/keeping-data-fresh-buffer-ios-asyncdisplaykit-iglistkit-pusher/), Andy Yates, Buffer\n\n## Documentation\n\nYou can find [the docs here](https://instagram.github.io/IGListKit). Documentation is generated with [jazzy](https://github.com/realm/jazzy) and hosted on [GitHub-Pages](https://pages.github.com).\n\nTo regenerate docs, run `./scripts/build_docs.sh` from the root directory in the repo.\n\n## Vision\n\nFor the long-term goals and \"vision\" of `IGListKit`, please read our [Vision](https://github.com/Instagram/IGListKit/blob/master/Guides/VISION.md) doc.\n\n## Contributing\n\nPlease see the [CONTRIBUTING](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) file for how to help. At Instagram, we sync the open source version of `IGListKit` daily, so we're always testing the latest changes. But that requires all changes be thoroughly tested and follow our style guide.\n\nWe have a set of [starter tasks](https://github.com/Instagram/IGListKit/issues?q=is%3Aissue+is%3Aopen+label%3Astarter-task) that are great for beginners to jump in on and start contributing.\n\n## License\n\n`IGListKit` is [MIT-licensed](./LICENSE).\n\nThe files in the `/Examples/` directory are licensed under a separate license as specified in each file. Documentation is licensed [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/).\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListDiffKit/Internal/IGListIndexPathResultInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListIndexPathResult.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListIndexPathResult()\n\n- (instancetype)initWithInserts:(NSArray<NSIndexPath *> *)inserts\n                        deletes:(NSArray<NSIndexPath *> *)deletes\n                        updates:(NSArray<NSIndexPath *> *)updates\n                          moves:(NSArray<IGListMoveIndexPath *> *)moves\n                oldIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)oldIndexPathMap\n                newIndexPathMap:(NSMapTable<id<NSObject>, NSIndexPath *> *)newIndexPathMap;\n\n@property (nonatomic, assign, readonly) NSInteger changeCount;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListDiffKit/Internal/IGListIndexSetResultInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListIndexSetResult.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListIndexSetResult()\n\n- (instancetype)initWithInserts:(NSIndexSet *)inserts\n                        deletes:(NSIndexSet *)deletes\n                        updates:(NSIndexSet *)updates\n                          moves:(NSArray<IGListMoveIndex *> *)moves\n                    oldIndexMap:(NSMapTable<id<NSObject>, NSNumber *> *)oldIndexMap\n                    newIndexMap:(NSMapTable<id<NSObject>, NSNumber *> *)newIndexMap;\n\n@property (nonatomic, assign, readonly) NSInteger changeCount;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListDiffKit/Internal/IGListMoveIndexInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMoveIndex.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListMoveIndex ()\n\n- (instancetype)initWithFrom:(NSInteger)from to:(NSInteger)to NS_DESIGNATED_INITIALIZER;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListDiffKit/Internal/IGListMoveIndexPathInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface IGListMoveIndexPath ()\n\n- (instancetype)initWithFrom:(NSIndexPath *)from to:(NSIndexPath *)to NS_DESIGNATED_INITIALIZER;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapter.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListExperiments.h>\n#import <IGListDiffKit/IGListMacros.h>\n#import <IGListKit/IGListAdapterDataSource.h>\n#import <IGListKit/IGListAdapterDelegate.h>\n#import <IGListKit/IGListAdapterMoveDelegate.h>\n#import <IGListKit/IGListAdapterPerformanceDelegate.h>\n#import <IGListKit/IGListAdapterUpdateListener.h>\n#import <IGListKit/IGListCollectionContext.h>\n\n@protocol IGListUpdatingDelegate;\n\n@class IGListSectionController;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A block to execute when the list updates are completed.\n\n @param finished Specifies whether or not the update animations completed successfully.\n */\nNS_SWIFT_NAME(ListUpdaterCompletion)\ntypedef void (^IGListUpdaterCompletion)(BOOL finished);\n\n/**\n `IGListAdapter` objects provide an abstraction for feeds of objects in a `UICollectionView` by breaking each object\n into individual sections, called \"section controllers\". These controllers (objects subclassing to\n `IGListSectionController`) act as a data source and delegate for each section.\n\n Feed implementations must act as the data source for an `IGListAdapter` in order to drive the objects and section\n controllers in a collection view.\n */\nIGLK_SUBCLASSING_RESTRICTED\nNS_SWIFT_NAME(ListAdapter)\n@interface IGListAdapter : NSObject\n\n/**\n The view controller that houses the adapter.\n */\n@property (nonatomic, nullable, weak) UIViewController *viewController;\n\n/**\n The collection view used with the adapter.\n\n @note Setting this property will automatically set isPrefetchingEnabled to `NO\u0010` for performance reasons.\n */\n@property (nonatomic, nullable, weak) UICollectionView *collectionView;\n\n/**\n The object that acts as the data source for the adapter.\n */\n@property (nonatomic, nullable, weak) id <IGListAdapterDataSource> dataSource;\n\n/**\n The object that receives top-level events for section controllers.\n */\n@property (nonatomic, nullable, weak) id <IGListAdapterDelegate> delegate;\n\n/**\n The object that receives `UICollectionViewDelegate` events.\n\n @note This object *will not* receive `UIScrollViewDelegate` events. Instead use scrollViewDelegate.\n */\n@property (nonatomic, nullable, weak) id <UICollectionViewDelegate> collectionViewDelegate;\n\n/**\n The object that receives `UIScrollViewDelegate` events.\n */\n@property (nonatomic, nullable, weak) id <UIScrollViewDelegate> scrollViewDelegate;\n\n/**\n The object that receives `IGListAdapterMoveDelegate` events resulting from interactive reordering of sections.\n\n @note This works with UICollectionView interactive reordering available on iOS 9.0+\n */\n@property (nonatomic, nullable, weak) id <IGListAdapterMoveDelegate> moveDelegate NS_AVAILABLE_IOS(9_0);\n\n/**\n The object that receives `IGListAdapterPerformanceDelegate` events to measure performance.\n */\n@property (nonatomic, nullable, weak) id <IGListAdapterPerformanceDelegate> performanceDelegate;\n\n/**\n The updater for the adapter.\n */\n@property (nonatomic, strong, readonly) id <IGListUpdatingDelegate> updater;\n\n/**\n A bitmask of experiments to conduct on the adapter.\n */\n@property (nonatomic, assign) IGListExperiment experiments;\n\n/**\n Initializes a new `IGListAdapter` object.\n\n @param updater An object that manages updates to the collection view.\n @param viewController The view controller that will house the adapter.\n @param workingRangeSize The number of objects before and after the viewport to consider within the working range.\n\n @return A new list adapter object.\n\n @note The working range is the number of objects beyond the visible objects (plus and minus) that should be\n notified when they are close to being visible. For instance, if you have 3 objects on screen and a working range of 2,\n the previous and succeeding 2 objects will be notified that they are within the working range. As you scroll the list\n the range is updated as objects enter and exit the working range.\n\n To opt out of using the working range, use `initWithUpdater:viewController:` or provide a working range of `0`.\n */\n- (instancetype)initWithUpdater:(id <IGListUpdatingDelegate>)updater\n                 viewController:(nullable UIViewController *)viewController\n               workingRangeSize:(NSInteger)workingRangeSize NS_DESIGNATED_INITIALIZER;\n\n/**\n Initializes a new `IGListAdapter` object with a working range of `0`.\n\n @param updater An object that manages updates to the collection view.\n @param viewController The view controller that will house the adapter.\n\n @return A new list adapter object.\n */\n- (instancetype)initWithUpdater:(id <IGListUpdatingDelegate>)updater\n                 viewController:(nullable UIViewController *)viewController;\n\n/**\n Perform an update from the previous state of the data source. This is analogous to calling\n `-[UICollectionView performBatchUpdates:completion:]`.\n\n @param animated A flag indicating if the transition should be animated.\n @param completion The block to execute when the updates complete.\n */\n- (void)performUpdatesAnimated:(BOOL)animated completion:(nullable IGListUpdaterCompletion)completion;\n\n/**\n Perform an immediate reload of the data in the data source, discarding the old objects.\n\n @param completion The block to execute when the reload completes.\n\n @warning Do not use this method to update without animations as it can be very expensive to teardown and rebuild all\n section controllers. Use `-[IGListAdapter performUpdatesAnimated:completion]` instead.\n */\n- (void)reloadDataWithCompletion:(nullable IGListUpdaterCompletion)completion;\n\n/**\n Reload the list for only the specified objects.\n\n @param objects The objects to reload.\n */\n- (void)reloadObjects:(NSArray *)objects;\n\n/**\n Query the section controller at a given section index. Constant time lookup.\n\n @param section A section in the list.\n\n @return A section controller or `nil` if the section does not exist.\n */\n- (nullable IGListSectionController *)sectionControllerForSection:(NSInteger)section;\n\n/**\n Query the section index of a list. Constant time lookup.\n\n @param sectionController A list object.\n\n @return The section index of the list if it exists, otherwise `NSNotFound`.\n */\n- (NSInteger)sectionForSectionController:(IGListSectionController *)sectionController;\n\n/**\n Returns the section controller for the specified object. Constant time lookup.\n\n @param object An object from the data source.\n\n @return A section controller or `nil` if `object` is not in the list.\n\n @see `-[IGListAdapterDataSource listAdapter:sectionControllerForObject:]`\n */\n- (__kindof IGListSectionController * _Nullable)sectionControllerForObject:(id)object;\n\n/**\n Returns the object corresponding to the specified section controller in the list. Constant time lookup.\n\n @param sectionController A section controller in the list.\n\n @return The object for the specified section controller, or `nil` if not found.\n */\n- (nullable id)objectForSectionController:(IGListSectionController *)sectionController;\n\n/**\n Returns the object corresponding to a section in the list. Constant time lookup.\n\n @param section A section in the list.\n\n @return The object for the specified section, or `nil` if the section does not exist.\n */\n- (nullable id)objectAtSection:(NSInteger)section;\n\n/**\n Returns the section corresponding to the specified object in the list. Constant time lookup.\n\n @param object An object in the list.\n\n @return The section index of `object` if found, otherwise `NSNotFound`.\n */\n- (NSInteger)sectionForObject:(id)object;\n\n/**\n Returns a copy of all the objects currently driving the adapter.\n\n @return An array of objects.\n */\n- (NSArray *)objects;\n\n/**\n An unordered array of the currently visible section controllers.\n\n @return An array of section controllers.\n */\n- (NSArray<IGListSectionController *> *)visibleSectionControllers;\n\n/**\n An unordered array of the currently visible objects.\n\n @return An array of objects\n */\n- (NSArray *)visibleObjects;\n\n/**\n An unordered array of the currently visible cells for a given object.\n\n @param object An object in the list\n\n @return An array of collection view cells.\n */\n- (NSArray<UICollectionViewCell *> *)visibleCellsForObject:(id)object;\n\n/**\n Scrolls to the specified object in the list adapter.\n\n @param object The object to which to scroll.\n @param supplementaryKinds The types of supplementary views in the section.\n @param scrollDirection An option indicating the direction to scroll.\n @param scrollPosition An option that specifies where the item should be positioned when scrolling finishes.\n @param animated A flag indicating if the scrolling should be animated.\n */\n- (void)scrollToObject:(id)object\n    supplementaryKinds:(nullable NSArray<NSString *> *)supplementaryKinds\n       scrollDirection:(UICollectionViewScrollDirection)scrollDirection\n        scrollPosition:(UICollectionViewScrollPosition)scrollPosition\n              animated:(BOOL)animated;\n\n/**\n Returns the size of a cell at the specified index path.\n\n @param indexPath The index path of the cell.\n\n @return The size of the cell.\n */\n- (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)indexPath;\n\n/**\n Returns the size of a supplementary view in the list at the specified index path.\n\n @param elementKind The kind of supplementary view.\n @param indexPath The index path of the supplementary view.\n\n @return The size of the supplementary view.\n */\n- (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind\n                             atIndexPath:(NSIndexPath *)indexPath;\n\n/**\n Adds a listener to the list adapter.\n\n @param updateListener The object conforming to the `IGListAdapterUpdateListener` protocol.\n\n @note Listeners are held weakly so there is no need to call `-[IGListAdapter removeUpdateListener:]` on `dealloc`.\n */\n- (void)addUpdateListener:(id<IGListAdapterUpdateListener>)updateListener;\n\n/**\n Removes a listener from the list adapter.\n\n @param updateListener The object conforming to the `IGListAdapterUpdateListener` protocol.\n */\n- (void)removeUpdateListener:(id<IGListAdapterUpdateListener>)updateListener;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapter.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListAdapterInternal.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListKit/IGListAdapterUpdater.h>\n#import <IGListKit/IGListSupplementaryViewSource.h>\n\n#import \"IGListArrayUtilsInternal.h\"\n#import \"IGListDebugger.h\"\n#import \"IGListSectionControllerInternal.h\"\n#import \"UICollectionViewLayout+InteractiveReordering.h\"\n#import \"UIScrollView+IGListKit.h\"\n\n@implementation IGListAdapter {\n    NSMapTable<UICollectionReusableView *, IGListSectionController *> *_viewSectionControllerMap;\n    // An array of blocks to execute once batch updates are finished\n    NSMutableArray<void (^)(void)> *_queuedCompletionBlocks;\n    NSHashTable<id<IGListAdapterUpdateListener>> *_updateListeners;\n}\n\n- (void)dealloc {\n    [self.sectionMap reset];\n}\n\n\n#pragma mark - Init\n\n- (instancetype)initWithUpdater:(id <IGListUpdatingDelegate>)updater\n                 viewController:(UIViewController *)viewController\n               workingRangeSize:(NSInteger)workingRangeSize {\n    IGAssertMainThread();\n    IGParameterAssert(updater);\n\n    if (self = [super init]) {\n        NSPointerFunctions *keyFunctions = [updater objectLookupPointerFunctions];\n        NSPointerFunctions *valueFunctions = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory];\n        NSMapTable *table = [[NSMapTable alloc] initWithKeyPointerFunctions:keyFunctions valuePointerFunctions:valueFunctions capacity:0];\n        _sectionMap = [[IGListSectionMap alloc] initWithMapTable:table];\n\n        _displayHandler = [IGListDisplayHandler new];\n        _workingRangeHandler = [[IGListWorkingRangeHandler alloc] initWithWorkingRangeSize:workingRangeSize];\n        _updateListeners = [NSHashTable weakObjectsHashTable];\n\n        _viewSectionControllerMap = [NSMapTable mapTableWithKeyOptions:NSMapTableObjectPointerPersonality | NSMapTableStrongMemory\n                                                          valueOptions:NSMapTableStrongMemory];\n\n        _updater = updater;\n        _viewController = viewController;\n\n        [IGListDebugger trackAdapter:self];\n    }\n    return self;\n}\n\n- (instancetype)initWithUpdater:(id<IGListUpdatingDelegate>)updater\n                 viewController:(UIViewController *)viewController {\n    return [self initWithUpdater:updater\n                  viewController:viewController\n                workingRangeSize:0];\n}\n\n- (UICollectionView *)collectionView {\n    return _collectionView;\n}\n\n- (void)setCollectionView:(UICollectionView *)collectionView {\n    IGAssertMainThread();\n\n    // if collection view has been used by a different list adapter, treat it as if we were using a new collection view\n    // this happens when embedding a UICollectionView inside a UICollectionViewCell that is reused\n    if (_collectionView != collectionView || _collectionView.dataSource != self) {\n        // if the collection view was being used with another IGListAdapter (e.g. cell reuse)\n        // destroy the previous association so the old adapter doesn't update the wrong collection view\n        static NSMapTable<UICollectionView *, IGListAdapter *> *globalCollectionViewAdapterMap = nil;\n        if (globalCollectionViewAdapterMap == nil) {\n            globalCollectionViewAdapterMap = [NSMapTable weakToWeakObjectsMapTable];\n        }\n        [globalCollectionViewAdapterMap removeObjectForKey:_collectionView];\n        [[globalCollectionViewAdapterMap objectForKey:collectionView] setCollectionView:nil];\n        [globalCollectionViewAdapterMap setObject:self forKey:collectionView];\n\n        // dump old registered section controllers in the case that we are changing collection views or setting for\n        // the first time\n        _registeredCellIdentifiers = [NSMutableSet new];\n        _registeredNibNames = [NSMutableSet new];\n        _registeredSupplementaryViewIdentifiers = [NSMutableSet new];\n        _registeredSupplementaryViewNibNames = [NSMutableSet new];\n\n        const BOOL settingFirstCollectionView = _collectionView == nil;\n\n        _collectionView = collectionView;\n        _collectionView.dataSource = self;\n\n        if (@available(iOS 10.0, tvOS 10, *)) {\n            _collectionView.prefetchingEnabled = NO;\n        }\n\n        [_collectionView.collectionViewLayout ig_hijackLayoutInteractiveReorderingMethodForAdapter:self];\n        [_collectionView.collectionViewLayout invalidateLayout];\n\n        [self _updateCollectionViewDelegate];\n\n        // only construct\n        if (!IGListExperimentEnabled(self.experiments, IGListExperimentGetCollectionViewAtUpdate)\n            || settingFirstCollectionView) {\n            [self _updateAfterPublicSettingsChange];\n        }\n    }\n}\n\n- (void)setDataSource:(id<IGListAdapterDataSource>)dataSource {\n    if (_dataSource != dataSource) {\n        _dataSource = dataSource;\n        [self _updateAfterPublicSettingsChange];\n    }\n}\n\n// reset and configure the delegate proxy whenever this property is set\n- (void)setCollectionViewDelegate:(id<UICollectionViewDelegate>)collectionViewDelegate {\n    IGAssertMainThread();\n    IGAssert(![collectionViewDelegate conformsToProtocol:@protocol(UICollectionViewDelegateFlowLayout)],\n             @\"UICollectionViewDelegateFlowLayout conformance is automatically handled by IGListAdapter.\");\n\n    if (_collectionViewDelegate != collectionViewDelegate) {\n        _collectionViewDelegate = collectionViewDelegate;\n        [self _createProxyAndUpdateCollectionViewDelegate];\n    }\n}\n\n- (void)setScrollViewDelegate:(id<UIScrollViewDelegate>)scrollViewDelegate {\n    IGAssertMainThread();\n\n    if (_scrollViewDelegate != scrollViewDelegate) {\n        _scrollViewDelegate = scrollViewDelegate;\n        [self _createProxyAndUpdateCollectionViewDelegate];\n    }\n}\n\n- (void)_updateAfterPublicSettingsChange {\n    id<IGListAdapterDataSource> dataSource = _dataSource;\n    if (_collectionView != nil && dataSource != nil) {\n        NSArray *uniqueObjects = objectsWithDuplicateIdentifiersRemoved([dataSource objectsForListAdapter:self]);\n        [self _updateObjects:uniqueObjects dataSource:dataSource];\n    }\n}\n\n- (void)_createProxyAndUpdateCollectionViewDelegate {\n    // there is a known bug with accessibility and using an NSProxy as the delegate that will cause EXC_BAD_ACCESS\n    // when voiceover is enabled. it will hold an unsafe ref to the delegate\n    _collectionView.delegate = nil;\n\n    self.delegateProxy = [[IGListAdapterProxy alloc] initWithCollectionViewTarget:_collectionViewDelegate\n                                                                 scrollViewTarget:_scrollViewDelegate\n                                                                      interceptor:self];\n    [self _updateCollectionViewDelegate];\n}\n\n- (void)_updateCollectionViewDelegate {\n    // set up the delegate to the proxy so the adapter can intercept events\n    // default to the adapter simply being the delegate\n    _collectionView.delegate = (id<UICollectionViewDelegate>)self.delegateProxy ?: self;\n}\n\n\n#pragma mark - Scrolling\n\n- (void)scrollToObject:(id)object\n    supplementaryKinds:(NSArray<NSString *> *)supplementaryKinds\n       scrollDirection:(UICollectionViewScrollDirection)scrollDirection\n        scrollPosition:(UICollectionViewScrollPosition)scrollPosition\n              animated:(BOOL)animated {\n    IGAssertMainThread();\n    IGParameterAssert(object != nil);\n\n    const NSInteger section = [self sectionForObject:object];\n    if (section == NSNotFound) {\n        return;\n    }\n\n    UICollectionView *collectionView = self.collectionView;\n    const BOOL avoidLayout = IGListExperimentEnabled(self.experiments, IGListExperimentAvoidLayoutOnScrollToObject);\n\n    // Experiment with skipping the forced layout to avoid creating off-screen cells.\n    // Calling [collectionView layoutIfNeeded] creates the current visible cells that will no longer be visible after the scroll.\n    // We can avoid that by asking the UICollectionView (not the layout object) for the attributes. So if the attributes are not\n    // ready, the UICollectionView will call -prepareLayout, return the attributes, but doesn't generate the cells just yet.\n    if (!avoidLayout) {\n        [collectionView setNeedsLayout];\n        [collectionView layoutIfNeeded];\n    }\n\n    NSIndexPath *indexPathFirstElement = [NSIndexPath indexPathForItem:0 inSection:section];\n\n    // collect the layout attributes for the cell and supplementary views for the first index\n    // this will break if there are supplementary views beyond item 0\n    NSMutableArray<UICollectionViewLayoutAttributes *> *attributes = nil;\n\n    const NSInteger numberOfItems = [collectionView numberOfItemsInSection:section];\n    if (numberOfItems > 0) {\n        attributes = [self _layoutAttributesForItemAndSupplementaryViewAtIndexPath:indexPathFirstElement\n                                                                supplementaryKinds:supplementaryKinds].mutableCopy;\n\n        if (numberOfItems > 1) {\n            NSIndexPath *indexPathLastElement = [NSIndexPath indexPathForItem:(numberOfItems - 1) inSection:section];\n            UICollectionViewLayoutAttributes *lastElementattributes = [self _layoutAttributesForItemAndSupplementaryViewAtIndexPath:indexPathLastElement\n                                                                                                                 supplementaryKinds:supplementaryKinds].firstObject;\n            if (lastElementattributes != nil) {\n                [attributes addObject:lastElementattributes];\n            }\n        }\n    } else {\n        NSMutableArray *supplementaryAttributes = [NSMutableArray new];\n        for (NSString* supplementaryKind in supplementaryKinds) {\n            UICollectionViewLayoutAttributes *supplementaryAttribute = [self _layoutAttributesForSupplementaryViewOfKind:supplementaryKind atIndexPath:indexPathFirstElement];\n            if (supplementaryAttribute != nil) {\n                [supplementaryAttributes addObject: supplementaryAttribute];\n            }\n        }\n        attributes = supplementaryAttributes;\n    }\n\n    CGFloat offsetMin = 0.0;\n    CGFloat offsetMax = 0.0;\n    for (UICollectionViewLayoutAttributes *attribute in attributes) {\n        const CGRect frame = attribute.frame;\n        CGFloat originMin;\n        CGFloat endMax;\n        switch (scrollDirection) {\n            case UICollectionViewScrollDirectionHorizontal:\n                originMin = CGRectGetMinX(frame);\n                endMax = CGRectGetMaxX(frame);\n                break;\n            case UICollectionViewScrollDirectionVertical:\n                originMin = CGRectGetMinY(frame);\n                endMax = CGRectGetMaxY(frame);\n                break;\n        }\n\n        // find the minimum origin value of all the layout attributes\n        if (attribute == attributes.firstObject || originMin < offsetMin) {\n            offsetMin = originMin;\n        }\n        // find the maximum end value of all the layout attributes\n        if (attribute == attributes.firstObject || endMax > offsetMax) {\n            offsetMax = endMax;\n        }\n    }\n\n    const CGFloat offsetMid = (offsetMin + offsetMax) / 2.0;\n    const CGFloat collectionViewWidth = collectionView.bounds.size.width;\n    const CGFloat collectionViewHeight = collectionView.bounds.size.height;\n    const UIEdgeInsets contentInset = collectionView.ig_contentInset;\n    CGPoint contentOffset = collectionView.contentOffset;\n    switch (scrollDirection) {\n        case UICollectionViewScrollDirectionHorizontal: {\n            switch (scrollPosition) {\n                case UICollectionViewScrollPositionRight:\n                    contentOffset.x = offsetMax - collectionViewWidth + contentInset.right;\n                    break;\n                case UICollectionViewScrollPositionCenteredHorizontally: {\n                    const CGFloat insets = (contentInset.left - contentInset.right) / 2.0;\n                    contentOffset.x = offsetMid - collectionViewWidth / 2.0 - insets;\n                    break;\n                }\n                case UICollectionViewScrollPositionLeft:\n                case UICollectionViewScrollPositionNone:\n                case UICollectionViewScrollPositionTop:\n                case UICollectionViewScrollPositionBottom:\n                case UICollectionViewScrollPositionCenteredVertically:\n                    contentOffset.x = offsetMin - contentInset.left;\n                    break;\n            }\n            const CGFloat maxOffsetX = collectionView.contentSize.width - collectionView.frame.size.width + contentInset.right;\n            const CGFloat minOffsetX = -contentInset.left;\n            contentOffset.x = MIN(contentOffset.x, maxOffsetX);\n            contentOffset.x = MAX(contentOffset.x, minOffsetX);\n            break;\n        }\n        case UICollectionViewScrollDirectionVertical: {\n            switch (scrollPosition) {\n                case UICollectionViewScrollPositionBottom:\n                    contentOffset.y = offsetMax - collectionViewHeight + contentInset.bottom;\n                    break;\n                case UICollectionViewScrollPositionCenteredVertically: {\n                    const CGFloat insets = (contentInset.top - contentInset.bottom) / 2.0;\n                    contentOffset.y = offsetMid - collectionViewHeight / 2.0 - insets;\n                    break;\n                }\n                case UICollectionViewScrollPositionTop:\n                case UICollectionViewScrollPositionNone:\n                case UICollectionViewScrollPositionLeft:\n                case UICollectionViewScrollPositionRight:\n                case UICollectionViewScrollPositionCenteredHorizontally:\n                    contentOffset.y = offsetMin - contentInset.top;\n                    break;\n            }\n            CGFloat maxHeight;\n            if (avoidLayout) {\n                // If we don't call [collectionView layoutIfNeeded], the collectionView.contentSize does not get updated.\n                // So lets use the layout object, since it should have been updated by now.\n                maxHeight = collectionView.collectionViewLayout.collectionViewContentSize.height;\n            } else {\n                maxHeight = collectionView.contentSize.height;\n            }\n            const CGFloat maxOffsetY = maxHeight - collectionView.frame.size.height + contentInset.bottom;\n            const CGFloat minOffsetY = -contentInset.top;\n            contentOffset.y = MIN(contentOffset.y, maxOffsetY);\n            contentOffset.y = MAX(contentOffset.y, minOffsetY);\n            break;\n        }\n    }\n\n    [collectionView setContentOffset:contentOffset animated:animated];\n}\n\n#pragma mark - Editing\n\n- (void)performUpdatesAnimated:(BOOL)animated completion:(IGListUpdaterCompletion)completion {\n    IGAssertMainThread();\n\n    id<IGListAdapterDataSource> dataSource = self.dataSource;\n    UICollectionView *collectionView = self.collectionView;\n    if (dataSource == nil || collectionView == nil) {\n        IGLKLog(@\"Warning: Your call to %s is ignored as dataSource or collectionView haven't been set.\", __PRETTY_FUNCTION__);\n        if (completion) {\n            completion(NO);\n        }\n        return;\n    }\n\n    NSArray *fromObjects = self.sectionMap.objects;\n\n    IGListToObjectBlock toObjectsBlock;\n    __weak __typeof__(self) weakSelf = self;\n    if (IGListExperimentEnabled(self.experiments, IGListExperimentDeferredToObjectCreation)) {\n        toObjectsBlock = ^NSArray *{\n            __typeof__(self) strongSelf = weakSelf;\n            if (strongSelf == nil) {\n                return nil;\n            }\n            return [dataSource objectsForListAdapter:strongSelf];\n        };\n    } else {\n        NSArray *newObjects = [dataSource objectsForListAdapter:self];\n        toObjectsBlock = ^NSArray *{\n            return newObjects;\n        };\n    }\n\n    [self _enterBatchUpdates];\n    [self.updater performUpdateWithCollectionViewBlock:[self _collectionViewBlock]\n                                           fromObjects:fromObjects\n                                        toObjectsBlock:toObjectsBlock\n                                              animated:animated\n                                 objectTransitionBlock:^(NSArray *toObjects) {\n                                     // temporarily capture the item map that we are transitioning from in case\n                                     // there are any item deletes at the same\n                                     weakSelf.previousSectionMap = [weakSelf.sectionMap copy];\n\n                                     [weakSelf _updateObjects:toObjects dataSource:dataSource];\n                                 } completion:^(BOOL finished) {\n                                     // release the previous items\n                                     weakSelf.previousSectionMap = nil;\n\n                                     [weakSelf _notifyDidUpdate:IGListAdapterUpdateTypePerformUpdates animated:animated];\n                                     if (completion) {\n                                         completion(finished);\n                                     }\n                                     [weakSelf _exitBatchUpdates];\n                                 }];\n}\n\n- (void)reloadDataWithCompletion:(nullable IGListUpdaterCompletion)completion {\n    IGAssertMainThread();\n\n    id<IGListAdapterDataSource> dataSource = self.dataSource;\n    UICollectionView *collectionView = self.collectionView;\n    if (dataSource == nil || collectionView == nil) {\n        IGLKLog(@\"Warning: Your call to %s is ignored as dataSource or collectionView haven't been set.\", __PRETTY_FUNCTION__);\n        if (completion) {\n            completion(NO);\n        }\n        return;\n    }\n\n    NSArray *uniqueObjects = objectsWithDuplicateIdentifiersRemoved([dataSource objectsForListAdapter:self]);\n\n    __weak __typeof__(self) weakSelf = self;\n    [self.updater reloadDataWithCollectionViewBlock:[self _collectionViewBlock]\n                                  reloadUpdateBlock:^{\n                                      // purge all section controllers from the item map so that they are regenerated\n                                      [weakSelf.sectionMap reset];\n                                      [weakSelf _updateObjects:uniqueObjects dataSource:dataSource];\n                                  } completion:^(BOOL finished) {\n                                      [weakSelf _notifyDidUpdate:IGListAdapterUpdateTypeReloadData animated:NO];\n                                      if (completion) {\n                                          completion(finished);\n                                      }\n                                  }];\n}\n\n- (void)reloadObjects:(NSArray *)objects {\n    IGAssertMainThread();\n    IGParameterAssert(objects);\n\n    NSMutableIndexSet *sections = [NSMutableIndexSet new];\n\n    // use the item map based on whether or not we're in an update block\n    IGListSectionMap *map = [self _sectionMapUsingPreviousIfInUpdateBlock:YES];\n\n    for (id object in objects) {\n        // look up the item using the map's lookup function. might not be the same item\n        const NSInteger section = [map sectionForObject:object];\n        const BOOL notFound = section == NSNotFound;\n        if (notFound) {\n            continue;\n        }\n        [sections addIndex:section];\n\n        // reverse lookup the item using the section. if the pointer has changed the trigger update events and swap items\n        if (object != [map objectForSection:section]) {\n            [map updateObject:object];\n            [[map sectionControllerForSection:section] didUpdateToObject:object];\n        }\n    }\n\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Tried to reload the adapter without a collection view\");\n\n    [self.updater reloadCollectionView:collectionView sections:sections];\n}\n\n- (void)addUpdateListener:(id<IGListAdapterUpdateListener>)updateListener {\n    IGAssertMainThread();\n    IGParameterAssert(updateListener != nil);\n\n    [_updateListeners addObject:updateListener];\n}\n\n- (void)removeUpdateListener:(id<IGListAdapterUpdateListener>)updateListener {\n    IGAssertMainThread();\n    IGParameterAssert(updateListener != nil);\n\n    [_updateListeners removeObject:updateListener];\n}\n\n- (void)_notifyDidUpdate:(IGListAdapterUpdateType)update animated:(BOOL)animated {\n    for (id<IGListAdapterUpdateListener> listener in _updateListeners) {\n        [listener listAdapter:self didFinishUpdate:update animated:animated];\n    }\n}\n\n\n#pragma mark - List Items & Sections\n\n- (nullable IGListSectionController *)sectionControllerForSection:(NSInteger)section {\n    IGAssertMainThread();\n\n    return [self.sectionMap sectionControllerForSection:section];\n}\n\n- (NSInteger)sectionForSectionController:(IGListSectionController *)sectionController {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n\n    return [self.sectionMap sectionForSectionController:sectionController];\n}\n\n- (IGListSectionController *)sectionControllerForObject:(id)object {\n    IGAssertMainThread();\n    IGParameterAssert(object != nil);\n\n    return [self.sectionMap sectionControllerForObject:object];\n}\n\n- (id)objectForSectionController:(IGListSectionController *)sectionController {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n\n    const NSInteger section = [self.sectionMap sectionForSectionController:sectionController];\n    return [self.sectionMap objectForSection:section];\n}\n\n- (id)objectAtSection:(NSInteger)section {\n    IGAssertMainThread();\n\n    return [self.sectionMap objectForSection:section];\n}\n\n- (NSInteger)sectionForObject:(id)item {\n    IGAssertMainThread();\n    IGParameterAssert(item != nil);\n\n    return [self.sectionMap sectionForObject:item];\n}\n\n- (NSArray *)objects {\n    IGAssertMainThread();\n\n    return self.sectionMap.objects;\n}\n\n- (id<IGListSupplementaryViewSource>)_supplementaryViewSourceAtIndexPath:(NSIndexPath *)indexPath {\n    IGListSectionController *sectionController = [self sectionControllerForSection:indexPath.section];\n    return [sectionController supplementaryViewSource];\n}\n\n- (NSArray<IGListSectionController *> *)visibleSectionControllers {\n    IGAssertMainThread();\n    return [[self.displayHandler visibleListSections] allObjects];\n}\n\n- (NSArray *)visibleObjects {\n    IGAssertMainThread();\n    NSArray<UICollectionViewCell *> *visibleCells = [self.collectionView visibleCells];\n    NSMutableSet *visibleObjects = [NSMutableSet new];\n    for (UICollectionViewCell *cell in visibleCells) {\n        IGListSectionController *sectionController = [self sectionControllerForView:cell];\n        IGAssert(sectionController != nil, @\"Section controller nil for cell %@\", cell);\n        if (sectionController != nil) {\n            const NSInteger section = [self sectionForSectionController:sectionController];\n            id object = [self objectAtSection:section];\n            IGAssert(object != nil, @\"Object not found for section controller %@ at section %li\", sectionController, (long)section);\n            if (object != nil) {\n                [visibleObjects addObject:object];\n            }\n        }\n    }\n    return [visibleObjects allObjects];\n}\n\n- (NSArray<UICollectionViewCell *> *)visibleCellsForObject:(id)object {\n    IGAssertMainThread();\n    IGParameterAssert(object != nil);\n\n    const NSInteger section = [self.sectionMap sectionForObject:object];\n    if (section == NSNotFound) {\n        return [NSArray new];\n    }\n\n    NSArray<UICollectionViewCell *> *visibleCells = [self.collectionView visibleCells];\n    UICollectionView *collectionView = self.collectionView;\n    NSPredicate *controllerPredicate = [NSPredicate predicateWithBlock:^BOOL(UICollectionViewCell* cell, NSDictionary* bindings) {\n        NSIndexPath *indexPath = [collectionView indexPathForCell:cell];\n        return indexPath.section == section;\n    }];\n\n    return [visibleCells filteredArrayUsingPredicate:controllerPredicate];\n}\n\n\n#pragma mark - Layout\n\n- (CGSize)sizeForItemAtIndexPath:(NSIndexPath *)indexPath {\n    IGAssertMainThread();\n    id<IGListAdapterPerformanceDelegate> performanceDelegate = self.performanceDelegate;\n    [performanceDelegate listAdapterWillCallSize:self];\n\n    IGListSectionController *sectionController = [self sectionControllerForSection:indexPath.section];\n    const CGSize size = [sectionController sizeForItemAtIndex:indexPath.item];\n    const CGSize positiveSize = CGSizeMake(MAX(size.width, 0.0), MAX(size.height, 0.0));\n\n    [performanceDelegate listAdapter:self didCallSizeOnSectionController:sectionController atIndex:indexPath.item];\n    return positiveSize;\n}\n\n- (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath {\n    IGAssertMainThread();\n    id <IGListSupplementaryViewSource> supplementaryViewSource = [self _supplementaryViewSourceAtIndexPath:indexPath];\n    if ([[supplementaryViewSource supportedElementKinds] containsObject:elementKind]) {\n        const CGSize size = [supplementaryViewSource sizeForSupplementaryViewOfKind:elementKind atIndex:indexPath.item];\n        return CGSizeMake(MAX(size.width, 0.0), MAX(size.height, 0.0));\n    }\n    return CGSizeZero;\n}\n\n\n#pragma mark - Private API\n\n- (IGListCollectionViewBlock)_collectionViewBlock {\n    if (IGListExperimentEnabled(self.experiments, IGListExperimentGetCollectionViewAtUpdate)) {\n        __weak __typeof__(self) weakSelf = self;\n        return ^UICollectionView *{ return weakSelf.collectionView; };\n    } else {\n        __weak UICollectionView *collectionView = _collectionView;\n        return ^UICollectionView *{ return collectionView; };\n    }\n}\n\n// this method is what updates the \"source of truth\"\n// this should only be called just before the collection view is updated\n- (void)_updateObjects:(NSArray *)objects dataSource:(id<IGListAdapterDataSource>)dataSource {\n    IGParameterAssert(dataSource != nil);\n\n#if DEBUG\n    for (id object in objects) {\n        IGAssert([object isEqualToDiffableObject:object], @\"Object instance %@ not equal to itself. This will break infra map tables.\", object);\n    }\n#endif\n\n    NSMutableArray<IGListSectionController *> *sectionControllers = [NSMutableArray new];\n    NSMutableArray *validObjects = [NSMutableArray new];\n\n    IGListSectionMap *map = self.sectionMap;\n\n    // collect items that have changed since the last update\n    NSMutableSet *updatedObjects = [NSMutableSet new];\n\n    // push the view controller and collection context into a local thread container so they are available on init\n    // for IGListSectionController subclasses after calling [super init]\n    IGListSectionControllerPushThread(self.viewController, self);\n\n    for (id object in objects) {\n        // infra checks to see if a controller exists\n        IGListSectionController *sectionController = [map sectionControllerForObject:object];\n\n        // if not, query the data source for a new one\n        if (sectionController == nil) {\n            sectionController = [dataSource listAdapter:self sectionControllerForObject:object];\n        }\n\n        if (sectionController == nil) {\n            IGLKLog(@\"WARNING: Ignoring nil section controller returned by data source %@ for object %@.\",\n                    dataSource, object);\n            continue;\n        }\n\n        // in case the section controller was created outside of -listAdapter:sectionControllerForObject:\n        sectionController.collectionContext = self;\n        sectionController.viewController = self.viewController;\n\n        // check if the item has changed instances or is new\n        const NSInteger oldSection = [map sectionForObject:object];\n        if (oldSection == NSNotFound || [map objectForSection:oldSection] != object) {\n            [updatedObjects addObject:object];\n        }\n\n        [sectionControllers addObject:sectionController];\n        [validObjects addObject:object];\n    }\n\n#if DEBUG\n    IGAssert([NSSet setWithArray:sectionControllers].count == sectionControllers.count,\n             @\"Section controllers array is not filled with unique objects; section controllers are being reused\");\n#endif\n\n    // clear the view controller and collection context\n    IGListSectionControllerPopThread();\n\n    [map updateWithObjects:validObjects sectionControllers:sectionControllers];\n\n    // now that the maps have been created and contexts are assigned, we consider the section controller \"fully loaded\"\n    for (id object in updatedObjects) {\n        [[map sectionControllerForObject:object] didUpdateToObject:object];\n    }\n\n    NSInteger itemCount = 0;\n    for (IGListSectionController *sectionController in sectionControllers) {\n        itemCount += [sectionController numberOfItems];\n    }\n\n    [self _updateBackgroundViewShouldHide:itemCount > 0];\n}\n\n- (void)_updateBackgroundViewShouldHide:(BOOL)shouldHide {\n    if (self.isInUpdateBlock) {\n        return; // will be called again when update block completes\n    }\n    UIView *backgroundView = [self.dataSource emptyViewForListAdapter:self];\n    // don't do anything if the client is using the same view\n    if (backgroundView != _collectionView.backgroundView) {\n        // collection view will just stack the background views underneath each other if we do not remove the previous\n        // one first. also fine if it is nil\n        [_collectionView.backgroundView removeFromSuperview];\n        _collectionView.backgroundView = backgroundView;\n    }\n    _collectionView.backgroundView.hidden = shouldHide;\n}\n\n- (BOOL)_itemCountIsZero {\n    __block BOOL isZero = YES;\n    [self.sectionMap enumerateUsingBlock:^(id  _Nonnull object, IGListSectionController * _Nonnull sectionController, NSInteger section, BOOL * _Nonnull stop) {\n        if (sectionController.numberOfItems > 0) {\n            isZero = NO;\n            *stop = YES;\n        }\n    }];\n    return isZero;\n}\n\n- (IGListSectionMap *)_sectionMapUsingPreviousIfInUpdateBlock:(BOOL)usePreviousMapIfInUpdateBlock {\n    // if we are inside an update block, we may have to use the /previous/ item map for some operations\n    IGListSectionMap *previousSectionMap = self.previousSectionMap;\n    if (usePreviousMapIfInUpdateBlock && self.isInUpdateBlock && previousSectionMap != nil) {\n        return previousSectionMap;\n    } else {\n        return self.sectionMap;\n    }\n}\n\n- (NSArray<NSIndexPath *> *)indexPathsFromSectionController:(IGListSectionController *)sectionController\n                                                    indexes:(NSIndexSet *)indexes\n                                 usePreviousIfInUpdateBlock:(BOOL)usePreviousIfInUpdateBlock {\n    NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray new];\n\n    IGListSectionMap *map = [self _sectionMapUsingPreviousIfInUpdateBlock:usePreviousIfInUpdateBlock];\n    const NSInteger section = [map sectionForSectionController:sectionController];\n    if (section != NSNotFound) {\n        [indexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {\n            [indexPaths addObject:[NSIndexPath indexPathForItem:idx inSection:section]];\n        }];\n    }\n    return indexPaths;\n}\n\n- (NSIndexPath *)indexPathForSectionController:(IGListSectionController *)controller\n                                         index:(NSInteger)index\n                    usePreviousIfInUpdateBlock:(BOOL)usePreviousIfInUpdateBlock {\n    IGListSectionMap *map = [self _sectionMapUsingPreviousIfInUpdateBlock:usePreviousIfInUpdateBlock];\n    const NSInteger section = [map sectionForSectionController:controller];\n    if (section == NSNotFound) {\n        return nil;\n    } else {\n        return [NSIndexPath indexPathForItem:index inSection:section];\n    }\n}\n\n- (NSArray<UICollectionViewLayoutAttributes *> *)_layoutAttributesForItemAndSupplementaryViewAtIndexPath:(NSIndexPath *)indexPath\n                                                                                      supplementaryKinds:(NSArray<NSString *> *)supplementaryKinds {\n    NSMutableArray<UICollectionViewLayoutAttributes *> *attributes = [NSMutableArray new];\n\n    UICollectionViewLayoutAttributes *cellAttributes = [self _layoutAttributesForItemAtIndexPath:indexPath];\n    if (cellAttributes) {\n        [attributes addObject:cellAttributes];\n    }\n\n    for (NSString *kind in supplementaryKinds) {\n        UICollectionViewLayoutAttributes *supplementaryAttributes = [self _layoutAttributesForSupplementaryViewOfKind:kind atIndexPath:indexPath];\n        if (supplementaryAttributes) {\n            [attributes addObject:supplementaryAttributes];\n        }\n    }\n\n    return attributes;\n}\n\n- (nullable UICollectionViewLayoutAttributes *)_layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {\n    if (IGListExperimentEnabled(self.experiments, IGListExperimentAvoidLayoutOnScrollToObject)) {\n        return [self.collectionView layoutAttributesForItemAtIndexPath:indexPath];\n    } else {\n        return [self.collectionView.collectionViewLayout layoutAttributesForItemAtIndexPath:indexPath];\n    }\n}\n\n- (nullable UICollectionViewLayoutAttributes *)_layoutAttributesForSupplementaryViewOfKind:(NSString *)elementKind\n                                                                               atIndexPath:(NSIndexPath *)indexPath {\n    if (IGListExperimentEnabled(self.experiments, IGListExperimentAvoidLayoutOnScrollToObject)) {\n        return [self.collectionView layoutAttributesForSupplementaryElementOfKind:elementKind atIndexPath:indexPath];\n    } else {\n        return [self.collectionView.collectionViewLayout layoutAttributesForSupplementaryViewOfKind:elementKind atIndexPath:indexPath];\n    }\n}\n\n- (void)mapView:(UICollectionReusableView *)view toSectionController:(IGListSectionController *)sectionController {\n    IGAssertMainThread();\n    IGParameterAssert(view != nil);\n    IGParameterAssert(sectionController != nil);\n    [_viewSectionControllerMap setObject:sectionController forKey:view];\n}\n\n- (nullable IGListSectionController *)sectionControllerForView:(UICollectionReusableView *)view {\n    IGAssertMainThread();\n    return [_viewSectionControllerMap objectForKey:view];\n}\n\n- (void)removeMapForView:(UICollectionReusableView *)view {\n    IGAssertMainThread();\n    [_viewSectionControllerMap removeObjectForKey:view];\n}\n\n- (void)_deferBlockBetweenBatchUpdates:(void (^)(void))block {\n    IGAssertMainThread();\n    if (_queuedCompletionBlocks == nil) {\n        block();\n    } else {\n        [_queuedCompletionBlocks addObject:block];\n    }\n}\n\n- (void)_enterBatchUpdates {\n    _queuedCompletionBlocks = [NSMutableArray new];\n}\n\n- (void)_exitBatchUpdates {\n    NSArray *blocks = [_queuedCompletionBlocks copy];\n    _queuedCompletionBlocks = nil;\n    for (void (^block)(void) in blocks) {\n        block();\n    }\n}\n\n#pragma mark - UIScrollViewDelegate\n\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n    id<IGListAdapterPerformanceDelegate> performanceDelegate = self.performanceDelegate;\n    [performanceDelegate listAdapterWillCallScroll:self];\n\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UIScrollViewDelegate> scrollViewDelegate = self.scrollViewDelegate;\n    if ([scrollViewDelegate respondsToSelector:@selector(scrollViewDidScroll:)]) {\n        [scrollViewDelegate scrollViewDidScroll:scrollView];\n    }\n    NSArray<IGListSectionController *> *visibleSectionControllers = [self visibleSectionControllers];\n    for (IGListSectionController *sectionController in visibleSectionControllers) {\n        [[sectionController scrollDelegate] listAdapter:self didScrollSectionController:sectionController];\n    }\n\n    [performanceDelegate listAdapter:self didCallScroll:scrollView];\n}\n\n- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UIScrollViewDelegate> scrollViewDelegate = self.scrollViewDelegate;\n    if ([scrollViewDelegate respondsToSelector:@selector(scrollViewWillBeginDragging:)]) {\n        [scrollViewDelegate scrollViewWillBeginDragging:scrollView];\n    }\n    NSArray<IGListSectionController *> *visibleSectionControllers = [self visibleSectionControllers];\n    for (IGListSectionController *sectionController in visibleSectionControllers) {\n        [[sectionController scrollDelegate] listAdapter:self willBeginDraggingSectionController:sectionController];\n    }\n}\n\n- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UIScrollViewDelegate> scrollViewDelegate = self.scrollViewDelegate;\n    if ([scrollViewDelegate respondsToSelector:@selector(scrollViewDidEndDragging:willDecelerate:)]) {\n        [scrollViewDelegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate];\n    }\n    NSArray<IGListSectionController *> *visibleSectionControllers = [self visibleSectionControllers];\n    for (IGListSectionController *sectionController in visibleSectionControllers) {\n        [[sectionController scrollDelegate] listAdapter:self didEndDraggingSectionController:sectionController willDecelerate:decelerate];\n    }\n}\n\n- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UIScrollViewDelegate> scrollViewDelegate = self.scrollViewDelegate;\n    if ([scrollViewDelegate respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {\n        [scrollViewDelegate scrollViewDidEndDecelerating:scrollView];\n    }\n    NSArray<IGListSectionController *> *visibleSectionControllers = [self visibleSectionControllers];\n    for (IGListSectionController *sectionController in visibleSectionControllers) {\n        id<IGListScrollDelegate> scrollDelegate = [sectionController scrollDelegate];\n        if ([scrollDelegate respondsToSelector:@selector(listAdapter:didEndDeceleratingSectionController:)]) {\n            [scrollDelegate listAdapter:self didEndDeceleratingSectionController:sectionController];\n        }\n    }\n}\n\n#pragma mark - IGListCollectionContext\n\n- (CGSize)containerSize {\n    return self.collectionView.bounds.size;\n}\n\n- (UIEdgeInsets)containerInset {\n    return self.collectionView.contentInset;\n}\n\n- (UIEdgeInsets)adjustedContainerInset {\n    return self.collectionView.ig_contentInset;\n}\n\n- (CGSize)insetContainerSize {\n    UICollectionView *collectionView = self.collectionView;\n    return UIEdgeInsetsInsetRect(collectionView.bounds, collectionView.ig_contentInset).size;\n}\n\n- (IGListCollectionScrollingTraits)scrollingTraits {\n    UICollectionView *collectionView = self.collectionView;\n    return (IGListCollectionScrollingTraits) {\n        .isTracking = collectionView.isTracking,\n        .isDragging = collectionView.isDragging,\n        .isDecelerating = collectionView.isDecelerating,\n    };\n}\n\n- (CGSize)containerSizeForSectionController:(IGListSectionController *)sectionController {\n    const UIEdgeInsets inset = sectionController.inset;\n    return CGSizeMake(self.containerSize.width - inset.left - inset.right,\n                      self.containerSize.height - inset.top - inset.bottom);\n}\n\n- (NSInteger)indexForCell:(UICollectionViewCell *)cell sectionController:(nonnull IGListSectionController *)sectionController {\n    IGAssertMainThread();\n    IGParameterAssert(cell != nil);\n    IGParameterAssert(sectionController != nil);\n    NSIndexPath *indexPath = [self.collectionView indexPathForCell:cell];\n    IGAssert(indexPath == nil\n             || indexPath.section == [self sectionForSectionController:sectionController],\n             @\"Requesting a cell from another section controller is not allowed.\");\n    return indexPath != nil ? indexPath.item : NSNotFound;\n}\n\n- (__kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index\n                                    sectionController:(IGListSectionController *)sectionController {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n\n    // if this is accessed while a cell is being dequeued or displaying working range elements, just return nil\n    if (_isDequeuingCell || _isSendingWorkingRangeDisplayUpdates) {\n        return nil;\n    }\n\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:YES];\n    // prevent querying the collection view if it isn't fully reloaded yet for the current data set\n    if (indexPath != nil\n        && indexPath.section < [self.collectionView numberOfSections]) {\n        // only return a cell if it belongs to the section controller\n        // this association is created in -collectionView:cellForItemAtIndexPath:\n        UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];\n        if ([self sectionControllerForView:cell] == sectionController) {\n            return cell;\n        }\n    }\n    return nil;\n}\n\n- (NSArray<UICollectionViewCell *> *)visibleCellsForSectionController:(IGListSectionController *)sectionController {\n    NSMutableArray *cells = [NSMutableArray new];\n    UICollectionView *collectionView = self.collectionView;\n    NSArray *visibleCells = [collectionView visibleCells];\n    const NSInteger section = [self sectionForSectionController:sectionController];\n    for (UICollectionViewCell *cell in visibleCells) {\n        if ([collectionView indexPathForCell:cell].section == section) {\n            [cells addObject:cell];\n        }\n    }\n    return cells;\n}\n\n- (NSArray<NSIndexPath *> *)visibleIndexPathsForSectionController:(IGListSectionController *) sectionController {\n    NSMutableArray *paths = [NSMutableArray new];\n    UICollectionView *collectionView = self.collectionView;\n    NSArray *visiblePaths = [collectionView indexPathsForVisibleItems];\n    const NSInteger section = [self sectionForSectionController:sectionController];\n    for (NSIndexPath *path in visiblePaths) {\n        if (path.section == section) {\n            [paths addObject:path];\n        }\n    }\n    return paths;\n}\n\n- (void)deselectItemAtIndex:(NSInteger)index\n          sectionController:(IGListSectionController *)sectionController\n                   animated:(BOOL)animated {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    [self.collectionView deselectItemAtIndexPath:indexPath animated:animated];\n}\n\n- (void)selectItemAtIndex:(NSInteger)index\n        sectionController:(IGListSectionController *)sectionController\n                 animated:(BOOL)animated\n           scrollPosition:(UICollectionViewScrollPosition)scrollPosition {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    [self.collectionView selectItemAtIndexPath:indexPath animated:animated scrollPosition:scrollPosition];\n}\n\n- (__kindof UICollectionViewCell *)dequeueReusableCellOfClass:(Class)cellClass\n                                          withReuseIdentifier:(NSString *)reuseIdentifier\n                                         forSectionController:(IGListSectionController *)sectionController\n                                                      atIndex:(NSInteger)index {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(cellClass != nil);\n    IGParameterAssert(index >= 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Dequeueing cell of class %@ with reuseIdentifier %@ from section controller %@ without a collection view at index %li\", NSStringFromClass(cellClass), reuseIdentifier, sectionController, (long)index);\n    NSString *identifier = IGListReusableViewIdentifier(cellClass, nil, reuseIdentifier);\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    if (![self.registeredCellIdentifiers containsObject:identifier]) {\n        [self.registeredCellIdentifiers addObject:identifier];\n        [collectionView registerClass:cellClass forCellWithReuseIdentifier:identifier];\n    }\n    return [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];\n}\n\n- (__kindof UICollectionViewCell *)dequeueReusableCellOfClass:(Class)cellClass\n                                         forSectionController:(IGListSectionController *)sectionController\n                                                      atIndex:(NSInteger)index {\n    return [self dequeueReusableCellOfClass:cellClass withReuseIdentifier:nil forSectionController:sectionController atIndex:index];\n}\n\n- (__kindof UICollectionViewCell *)dequeueReusableCellFromStoryboardWithIdentifier:(NSString *)identifier\n                                                              forSectionController:(IGListSectionController *)sectionController\n                                                                           atIndex:(NSInteger)index {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(identifier.length > 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Reloading adapter without a collection view.\");\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    return [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];\n}\n\n- (UICollectionViewCell *)dequeueReusableCellWithNibName:(NSString *)nibName\n                                                  bundle:(NSBundle *)bundle\n                                    forSectionController:(IGListSectionController *)sectionController\n                                                 atIndex:(NSInteger)index {\n    IGAssertMainThread();\n    IGParameterAssert([nibName length] > 0);\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(index >= 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Dequeueing cell with nib name %@ and bundle %@ from section controller %@ without a collection view at index %li.\", nibName, bundle, sectionController, (long)index);\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    if (![self.registeredNibNames containsObject:nibName]) {\n        [self.registeredNibNames addObject:nibName];\n        UINib *nib = [UINib nibWithNibName:nibName bundle:bundle];\n        [collectionView registerNib:nib forCellWithReuseIdentifier:nibName];\n    }\n    return [collectionView dequeueReusableCellWithReuseIdentifier:nibName forIndexPath:indexPath];\n}\n\n- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind\n                                                         forSectionController:(IGListSectionController *)sectionController\n                                                                        class:(Class)viewClass\n                                                                      atIndex:(NSInteger)index {\n    IGAssertMainThread();\n    IGParameterAssert(elementKind.length > 0);\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(viewClass != nil);\n    IGParameterAssert(index >= 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Dequeueing cell of class %@ from section controller %@ without a collection view at index %li with supplementary view %@\", NSStringFromClass(viewClass), sectionController, (long)index, elementKind);\n    NSString *identifier = IGListReusableViewIdentifier(viewClass, elementKind, nil);\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    if (![self.registeredSupplementaryViewIdentifiers containsObject:identifier]) {\n        [self.registeredSupplementaryViewIdentifiers addObject:identifier];\n        [collectionView registerClass:viewClass forSupplementaryViewOfKind:elementKind withReuseIdentifier:identifier];\n    }\n    return [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:identifier forIndexPath:indexPath];\n}\n\n- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewFromStoryboardOfKind:(NSString *)elementKind\n                                                                             withIdentifier:(NSString *)identifier\n                                                                       forSectionController:(IGListSectionController *)sectionController\n                                                                                    atIndex:(NSInteger)index {\n    IGAssertMainThread();\n    IGParameterAssert(elementKind.length > 0);\n    IGParameterAssert(identifier.length > 0);\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(index >= 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Dequeueing Supplementary View from storyboard of kind %@ with identifier %@ for section controller %@ without a collection view at index %li\", elementKind, identifier, sectionController, (long)index);\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    return [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:identifier forIndexPath:indexPath];\n}\n\n- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind\n                                                         forSectionController:(IGListSectionController *)sectionController\n                                                                      nibName:(NSString *)nibName\n                                                                       bundle:(NSBundle *)bundle\n                                                                      atIndex:(NSInteger)index {\n    IGAssertMainThread();\n    IGParameterAssert([nibName length] > 0);\n    IGParameterAssert([elementKind length] > 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Reloading adapter without a collection view.\");\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    if (![self.registeredSupplementaryViewNibNames containsObject:nibName]) {\n        [self.registeredSupplementaryViewNibNames addObject:nibName];\n        UINib *nib = [UINib nibWithNibName:nibName bundle:bundle];\n        [collectionView registerNib:nib forSupplementaryViewOfKind:elementKind withReuseIdentifier:nibName];\n    }\n    return [collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:nibName forIndexPath:indexPath];\n}\n\n- (void)performBatchAnimated:(BOOL)animated updates:(void (^)(id<IGListBatchContext>))updates completion:(void (^)(BOOL))completion {\n    IGAssertMainThread();\n    IGParameterAssert(updates != nil);\n    IGAssert(self.collectionView != nil, @\"Performing batch updates without a collection view.\");\n\n    [self _enterBatchUpdates];\n    __weak __typeof__(self) weakSelf = self;\n    [self.updater performUpdateWithCollectionViewBlock:[self _collectionViewBlock] animated:animated itemUpdates:^{\n        weakSelf.isInUpdateBlock = YES;\n        // the adapter acts as the batch context with its API stripped to just the IGListBatchContext protocol\n        updates(weakSelf);\n        weakSelf.isInUpdateBlock = NO;\n    } completion: ^(BOOL finished) {\n        [weakSelf _updateBackgroundViewShouldHide:![weakSelf _itemCountIsZero]];\n        [weakSelf _notifyDidUpdate:IGListAdapterUpdateTypeItemUpdates animated:animated];\n        if (completion) {\n            completion(finished);\n        }\n        [weakSelf _exitBatchUpdates];\n    }];\n}\n\n- (void)scrollToSectionController:(IGListSectionController *)sectionController\n                          atIndex:(NSInteger)index\n                   scrollPosition:(UICollectionViewScrollPosition)scrollPosition\n                         animated:(BOOL)animated {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n\n    NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n    [self.collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated];\n}\n\n- (void)invalidateLayoutForSectionController:(IGListSectionController *)sectionController\n                                  completion:(void (^)(BOOL finished))completion{\n    const NSInteger section = [self sectionForSectionController:sectionController];\n    const NSInteger items = [_collectionView numberOfItemsInSection:section];\n\n    NSMutableArray<NSIndexPath *> *indexPaths = [NSMutableArray new];\n    for (NSInteger item = 0; item < items; item++) {\n        [indexPaths addObject:[NSIndexPath indexPathForItem:item inSection:section]];\n    }\n\n    UICollectionViewLayout *layout = _collectionView.collectionViewLayout;\n    UICollectionViewLayoutInvalidationContext *context = [[[layout.class invalidationContextClass] alloc] init];\n    [context invalidateItemsAtIndexPaths:indexPaths];\n\n    __weak __typeof__(_collectionView) weakCollectionView = _collectionView;\n\n    // do not call -[UICollectionView performBatchUpdates:completion:] while already updating. defer it until completed.\n    [self _deferBlockBetweenBatchUpdates:^{\n        [weakCollectionView performBatchUpdates:^{\n            [layout invalidateLayoutWithContext:context];\n        } completion:completion];\n    }];\n}\n\n#pragma mark - IGListBatchContext\n\n- (void)reloadInSectionController:(IGListSectionController *)sectionController atIndexes:(NSIndexSet *)indexes {\n    IGAssertMainThread();\n    IGParameterAssert(indexes != nil);\n    IGParameterAssert(sectionController != nil);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Tried to reload the adapter from %@ without a collection view at indexes %@.\", sectionController, indexes);\n\n    if (indexes.count == 0) {\n        return;\n    }\n\n    /**\n     UICollectionView is not designed to support -reloadSections: or -reloadItemsAtIndexPaths: during batch updates.\n     Internally it appears to convert these operations to a delete+insert. However the transformation is too simple\n     in that it doesn't account for the item's section being moved (naturally or explicitly) and can queue animation\n     collisions.\n\n     If you have an object at section 2 with 4 items and attempt to reload item at index 1, you would create an\n     NSIndexPath at section: 2, item: 1. Within -performBatchUpdates:, UICollectionView converts this to a delete\n     and insert at the same NSIndexPath.\n\n     If a section were inserted at position 2, the original section 2 has naturally shifted to section 3. However,\n     the insert NSIndexPath is section: 2, item: 1. Now the UICollectionView has a section animation at section 2,\n     as well as an item insert animation at section: 2, item: 1, and it will throw an exception.\n\n     IGListAdapter tracks the before/after mapping of section controllers to make precise NSIndexPath conversions.\n     */\n    [indexes enumerateIndexesUsingBlock:^(NSUInteger index, BOOL *stop) {\n        NSIndexPath *fromIndexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:YES];\n        NSIndexPath *toIndexPath = [self indexPathForSectionController:sectionController index:index usePreviousIfInUpdateBlock:NO];\n        // index paths could be nil if a section controller is prematurely reloading or a reload was batched with\n        // the section controller being deleted\n        if (fromIndexPath != nil && toIndexPath != nil) {\n            [self.updater reloadItemInCollectionView:collectionView fromIndexPath:fromIndexPath toIndexPath:toIndexPath];\n        }\n    }];\n}\n\n- (void)insertInSectionController:(IGListSectionController *)sectionController atIndexes:(NSIndexSet *)indexes {\n    IGAssertMainThread();\n    IGParameterAssert(indexes != nil);\n    IGParameterAssert(sectionController != nil);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Inserting items from %@ without a collection view at indexes %@.\", sectionController, indexes);\n\n    if (indexes.count == 0) {\n        return;\n    }\n\n    NSArray *indexPaths = [self indexPathsFromSectionController:sectionController indexes:indexes usePreviousIfInUpdateBlock:NO];\n    [self.updater insertItemsIntoCollectionView:collectionView indexPaths:indexPaths];\n    [self _updateBackgroundViewShouldHide:![self _itemCountIsZero]];\n}\n\n- (void)deleteInSectionController:(IGListSectionController *)sectionController atIndexes:(NSIndexSet *)indexes {\n    IGAssertMainThread();\n    IGParameterAssert(indexes != nil);\n    IGParameterAssert(sectionController != nil);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Deleting items from %@ without a collection view at indexes %@.\", sectionController, indexes);\n\n    if (indexes.count == 0) {\n        return;\n    }\n\n    NSArray *indexPaths = [self indexPathsFromSectionController:sectionController indexes:indexes usePreviousIfInUpdateBlock:YES];\n    [self.updater deleteItemsFromCollectionView:collectionView indexPaths:indexPaths];\n    [self _updateBackgroundViewShouldHide:![self _itemCountIsZero]];\n}\n\n- (void)invalidateLayoutInSectionController:(IGListSectionController *)sectionController atIndexes:(NSIndexSet *)indexes {\n    IGAssertMainThread();\n    IGParameterAssert(indexes != nil);\n    IGParameterAssert(sectionController != nil);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Invalidating items from %@ without a collection view at indexes %@.\", sectionController, indexes);\n\n    if (indexes.count == 0) {\n        return;\n    }\n\n    NSArray *indexPaths = [self indexPathsFromSectionController:sectionController indexes:indexes usePreviousIfInUpdateBlock:NO];\n    UICollectionViewLayout *layout = collectionView.collectionViewLayout;\n    UICollectionViewLayoutInvalidationContext *context = [[[layout.class invalidationContextClass] alloc] init];\n    [context invalidateItemsAtIndexPaths:indexPaths];\n    [layout invalidateLayoutWithContext:context];\n}\n\n- (void)moveInSectionController:(IGListSectionController *)sectionController fromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(fromIndex >= 0);\n    IGParameterAssert(toIndex >= 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Moving items from %@ without a collection view from index %li to index %li.\",\n             sectionController, (long)fromIndex, (long)toIndex);\n\n    NSIndexPath *fromIndexPath = [self indexPathForSectionController:sectionController index:fromIndex usePreviousIfInUpdateBlock:YES];\n    NSIndexPath *toIndexPath = [self indexPathForSectionController:sectionController index:toIndex usePreviousIfInUpdateBlock:NO];\n\n    if (fromIndexPath == nil || toIndexPath == nil) {\n        return;\n    }\n\n    [self.updater moveItemInCollectionView:collectionView fromIndexPath:fromIndexPath toIndexPath:toIndexPath];\n}\n\n- (void)reloadSectionController:(IGListSectionController *)sectionController {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Reloading items from %@ without a collection view.\", sectionController);\n\n    IGListSectionMap *map = [self _sectionMapUsingPreviousIfInUpdateBlock:YES];\n    const NSInteger section = [map sectionForSectionController:sectionController];\n    if (section == NSNotFound) {\n        return;\n    }\n\n    NSIndexSet *sections = [NSIndexSet indexSetWithIndex:section];\n    [self.updater reloadCollectionView:collectionView sections:sections];\n    [self _updateBackgroundViewShouldHide:![self _itemCountIsZero]];\n}\n\n- (void)moveSectionControllerInteractive:(IGListSectionController *)sectionController\n                               fromIndex:(NSInteger)fromIndex\n                                 toIndex:(NSInteger)toIndex NS_AVAILABLE_IOS(9_0) {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(fromIndex >= 0);\n    IGParameterAssert(toIndex >= 0);\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Moving section %@ without a collection view from index %li to index %li.\",\n             sectionController, (long)fromIndex, (long)toIndex);\n    IGAssert(self.moveDelegate != nil, @\"Moving section %@ without a moveDelegate set\", sectionController);\n\n    if (fromIndex != toIndex) {\n        id<IGListAdapterDataSource> dataSource = self.dataSource;\n\n        NSArray *previousObjects = [self.sectionMap objects];\n\n        if (self.isLastInteractiveMoveToLastSectionIndex) {\n            self.isLastInteractiveMoveToLastSectionIndex = NO;\n        }\n        else if (fromIndex < toIndex) {\n            toIndex -= 1;\n        }\n\n        NSMutableArray *mutObjects = [previousObjects mutableCopy];\n        id object = [previousObjects objectAtIndex:fromIndex];\n        [mutObjects removeObjectAtIndex:fromIndex];\n        [mutObjects insertObject:object atIndex:toIndex];\n\n        NSArray *objects = [mutObjects copy];\n\n        // inform the data source to update its model\n        [self.moveDelegate listAdapter:self moveObject:object from:previousObjects to:objects];\n\n        // update our model based on that provided by the data source\n        NSArray<id<IGListDiffable>> *updatedObjects = [dataSource objectsForListAdapter:self];\n        [self _updateObjects:updatedObjects dataSource:dataSource];\n    }\n\n    // even if from and to index are equal, we need to perform the \"move\"\n    // iOS interactively moves items, not sections, so we might have actually moved the item\n    // to the end of the preceeding section or beginning of the following section\n    [self.updater moveSectionInCollectionView:collectionView fromIndex:fromIndex toIndex:toIndex];\n}\n\n- (void)moveInSectionControllerInteractive:(IGListSectionController *)sectionController\n                                 fromIndex:(NSInteger)fromIndex\n                                   toIndex:(NSInteger)toIndex NS_AVAILABLE_IOS(9_0) {\n    IGAssertMainThread();\n    IGParameterAssert(sectionController != nil);\n    IGParameterAssert(fromIndex >= 0);\n    IGParameterAssert(toIndex >= 0);\n\n    [sectionController moveObjectFromIndex:fromIndex toIndex:toIndex];\n}\n\n- (void)revertInvalidInteractiveMoveFromIndexPath:(NSIndexPath *)sourceIndexPath\n                                      toIndexPath:(NSIndexPath *)destinationIndexPath NS_AVAILABLE_IOS(9_0) {\n    UICollectionView *collectionView = self.collectionView;\n    IGAssert(collectionView != nil, @\"Reverting move without a collection view from %@ to %@.\",\n             sourceIndexPath, destinationIndexPath);\n\n    // revert by moving back in the opposite direction\n    [collectionView moveItemAtIndexPath:destinationIndexPath toIndexPath:sourceIndexPath];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterDataSource.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListDiffable.h>\n\n@class IGListAdapter;\n@class IGListSectionController;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Implement this protocol to provide data to an `IGListAdapter`.\n */\nNS_SWIFT_NAME(ListAdapterDataSource)\n@protocol IGListAdapterDataSource <NSObject>\n\n/**\n Asks the data source for the objects to display in the list.\n\n @param listAdapter The list adapter requesting this information.\n\n @return An array of objects for the list.\n */\n- (NSArray<id <IGListDiffable>> *)objectsForListAdapter:(IGListAdapter *)listAdapter;\n\n/**\n Asks the data source for a section controller for the specified object in the list.\n\n @param listAdapter The list adapter requesting this information.\n @param object An object in the list.\n\n @return A new section controller instance that can be displayed in the list.\n\n @note New section controllers should be initialized here for objects when asked. You may pass any other data to\n the section controller at this time.\n\n Section controllers are initialized for all objects whenever the `IGListAdapter` is created, updated, or reloaded.\n Section controllers are reused when objects are moved or updated. Maintaining the `-[IGListDiffable diffIdentifier]`\n guarantees this.\n */\n- (IGListSectionController *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object;\n\n/**\n Asks the data source for a view to use as the collection view background when the list is empty.\n\n @param listAdapter The list adapter requesting this information.\n\n @return A view to use as the collection view background, or `nil` if you don't want a background view.\n\n @note This method is called every time the list adapter is updated. You are free to return new views every time,\n but for performance reasons you may want to retain the view and return it here. The infra is only responsible for\n adding the background view and maintaining its visibility.\n */\n- (nullable UIView *)emptyViewForListAdapter:(IGListAdapter *)listAdapter;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListAdapter;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Conform to `IGListAdapterDelegate` to receive display events for objects in a list.\n */\nNS_SWIFT_NAME(ListAdapterDelegate)\n@protocol IGListAdapterDelegate <NSObject>\n\n/**\n Notifies the delegate that a list object is about to be displayed.\n\n @param listAdapter The list adapter sending this information.\n @param object The object that will display.\n @param index The index of the object in the list.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter willDisplayObject:(id)object atIndex:(NSInteger)index;\n\n/**\n Notifies the delegate that a list object is no longer being displayed.\n\n @param listAdapter The list adapter sending this information.\n @param object The object that ended display.\n @param index The index of the object in the list.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didEndDisplayingObject:(id)object atIndex:(NSInteger)index;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterMoveDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListAdapter;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Conform to `IGListAdapterMoveDelegate` to receive interactive reordering requests.\n */\nNS_SWIFT_NAME(ListAdapterMoveDelegate)\n@protocol IGListAdapterMoveDelegate <NSObject>\n\n/**\n Asks the delegate to move a section object as the result of interactive reordering.\n\n @param listAdapter The list adapter sending this information.\n @param object the object that was moved\n @param previousObjects The array of objects prior to the move.\n @param objects The array of objects after the move.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter\n         moveObject:(id)object\n               from:(NSArray *)previousObjects\n                 to:(NSArray *)objects;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterPerformanceDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListAdapter;\n@class IGListSectionController;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n `IGListAdapterPerformanceDelegate` can be used to measure cell dequeue, display, size, and scroll callbacks. \n */\nNS_SWIFT_NAME(ListAdapterPerformanceDelegate)\n@protocol IGListAdapterPerformanceDelegate <NSObject>\n\n/**\n Will call `-[IGListAdapter collectionView:cellForItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n */\n- (void)listAdapterWillCallDequeueCell:(IGListAdapter *)listAdapter;\n\n/**\n Did finish calling `-[IGListAdapter collectionView:cellForItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n @param cell A cell that was dequeued.\n @param sectionController The section controller providing the cell.\n @param index Item index of the cell.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didCallDequeueCell:(UICollectionViewCell *)cell onSectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index;\n\n/**\n Will call `-[IGListAdapter collectionView:willDisplayCell:forItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n */\n- (void)listAdapterWillCallDisplayCell:(IGListAdapter *)listAdapter;\n\n/**\n Did finish calling `-[IGListAdapter collectionView:willDisplayCell:forItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n @param cell A cell that will be displayed.\n @param sectionController The section controller for that cell.\n @param index Item index of the cell.\n\n @note Keep in mind this also includes calling the `IGListAdapter`'s collectionViewDelegate and workingRangeHandler.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didCallDisplayCell:(UICollectionViewCell *)cell onSectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index;\n\n/**\n Will call `-[IGListAdapter collectionView:didEndDisplayingCell:forItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n */\n- (void)listAdapterWillCallEndDisplayCell:(IGListAdapter *)listAdapter;\n\n/**\n Did finish calling `-[IGListAdapter collectionView:didEndDisplayingCell:forItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n @param cell A cell that was displayed.\n @param sectionController The section controller for that cell.\n @param index Item index of the cell.\n\n @note Keep in mind this also includes calling the `IGListAdapter`'s collectionViewDelegate and workingRangeHandler.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didCallEndDisplayCell:(UICollectionViewCell *)cell onSectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index;\n\n/**\n Will call `-[IGListAdapter collectionView:collectionViewLayout:sizeForItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n */\n- (void)listAdapterWillCallSize:(IGListAdapter *)listAdapter;\n\n/**\n Did finish calling `-[IGListAdapter collectionView:collectionViewLayout:sizeForItemAtIndexPath:]`.\n\n @param listAdapter The list adapter sending this information.\n @param sectionController The section controller providing the size.\n @param index Item index used to calculate the size.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didCallSizeOnSectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index;\n\n/**\n Will call `-[IGListAdapter scrollViewDidScroll:]`.\n\n @param listAdapter The list adapter sending this information.\n */\n- (void)listAdapterWillCallScroll:(IGListAdapter *)listAdapter;\n\n/**\n Did finish calling `-[IGListAdapter scrollViewDidScroll:]`.\n\n @param listAdapter The list adapter sending this information.\n @param scrollView The scroll view backing the UICollectionView.\n\n @note Keep in mind this also includes calling the `IGListAdapter`'s scrollViewDelegate and all visible `IGListSectioControllers`.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didCallScroll:(UIScrollView *)scrollView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterUpdateListener.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListAdapter;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The type of update that was performed by an `IGListAdapter`.\n */\nNS_SWIFT_NAME(ListAdapterUpdateType)\ntypedef NS_ENUM(NSInteger, IGListAdapterUpdateType) {\n    /**\n     `-[IGListAdapter performUpdatesAnimated:completion:]` was executed.\n     */\n    IGListAdapterUpdateTypePerformUpdates,\n    /**\n     `-[IGListAdapter reloadDataWithCompletion:]` was executed.\n     */\n    IGListAdapterUpdateTypeReloadData,\n    /**\n     `-[IGListCollectionContext performBatchAnimated:updates:completion:]` was executed by an `IGListSectionController`.\n     */\n    IGListAdapterUpdateTypeItemUpdates,\n};\n\n/**\n Conform to this protocol to receive events about `IGListAdapter` updates.\n */\nNS_SWIFT_NAME(ListAdapterUpdateListener)\n@protocol IGListAdapterUpdateListener <NSObject>\n\n/**\n Notifies a listener that the listAdapter was updated.\n\n @param listAdapter The `IGListAdapter` that updated.\n @param update The type of update executed.\n @param animated A flag indicating if the update was animated. Always `NO` for `IGListAdapterUpdateTypeReloadData`.\n\n @note This event is sent before the completion block in `-[IGListAdapter performUpdatesAnimated:completion:]` and\n `-[IGListAdapter reloadDataWithCompletion:]` is executed. This event is also delivered when an\n `IGListSectionController` updates via `-[IGListCollectionContext performBatchAnimated:updates:completion:]`.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter\n    didFinishUpdate:(IGListAdapterUpdateType)update\n           animated:(BOOL)animated;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterUpdater.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListExperiments.h>\n#import <IGListDiffKit/IGListMacros.h>\n#import <IGListKit/IGListAdapterUpdaterDelegate.h>\n#import <IGListKit/IGListUpdatingDelegate.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An `IGListAdapterUpdater` is a concrete type that conforms to `IGListUpdatingDelegate`.\n It is an out-of-box updater for `IGListAdapter` objects to use.\n\n @note This updater performs re-entrant, coalesced updating for a list. It also uses a least-minimal diff \n for calculating UI updates when `IGListAdapter` calls \n `-performUpdateWithCollectionView:fromObjects:toObjects:completion:`.\n */\nIGLK_SUBCLASSING_RESTRICTED\nNS_SWIFT_NAME(ListAdapterUpdater)\n@interface IGListAdapterUpdater : NSObject <IGListUpdatingDelegate>\n\n/**\n The delegate that receives events with data on the performance of a transition.\n */\n@property (nonatomic, weak) id<IGListAdapterUpdaterDelegate> delegate;\n\n/**\n A flag indicating if a move should be treated as a \"delete, then insert\" operation.\n */\n@property (nonatomic, assign) BOOL movesAsDeletesInserts;\n\n/**\n A flag indicating that section reloads should be treated as item reloads, instead of converting them to \"delete, then insert\" operations.\n This only applies if the number of items for the section is unchanged.\n\n @note If the number of items for the section is changed, we would fallback to the default behavior and convert it to \"delete + insert\",\n because the collectionView can crash otherwise.\n \n Default is NO.\n */\n@property (nonatomic, assign) BOOL preferItemReloadsForSectionReloads;\n\n/**\n A flag indicating whether this updater should skip diffing and simply call\n `reloadData` for updates when the collection view is not in a window. The default value is `YES`.\n \n @note This will result in better performance, but will not generate the same delegate\n callbacks. If using a custom layout, it will not receive `prepareForCollectionViewUpdates:`.\n\n @warning On iOS < 8.3, this behavior is unsupported and will always be treated as `NO`.\n */\n@property (nonatomic, assign) BOOL allowsBackgroundReloading;\n\n/**\n A bitmask of experiments to conduct on the updater.\n */\n@property (nonatomic, assign) IGListExperiment experiments;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterUpdater.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListAdapterUpdater.h\"\n#import \"IGListAdapterUpdaterInternal.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n\n#import \"IGListArrayUtilsInternal.h\"\n#import \"IGListIndexSetResultInternal.h\"\n#import \"IGListMoveIndexPathInternal.h\"\n#import \"IGListReloadIndexPath.h\"\n#import \"UICollectionView+IGListBatchUpdateData.h\"\n\n@implementation IGListAdapterUpdater\n\n- (instancetype)init {\n    IGAssertMainThread();\n\n    if (self = [super init]) {\n        // the default is to use animations unless NO is passed\n        _queuedUpdateIsAnimated = YES;\n        _completionBlocks = [NSMutableArray new];\n        _batchUpdates = [IGListBatchUpdates new];\n        _allowsBackgroundReloading = YES;\n    }\n    return self;\n}\n\n#pragma mark - Private API\n\n- (BOOL)hasChanges {\n    return self.hasQueuedReloadData\n    || [self.batchUpdates hasChanges]\n    || self.fromObjects != nil\n    || self.toObjectsBlock != nil;\n}\n\n- (void)performReloadDataWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock {\n    IGAssertMainThread();\n\n    id<IGListAdapterUpdaterDelegate> delegate = self.delegate;\n    void (^reloadUpdates)(void) = self.reloadUpdates;\n    IGListBatchUpdates *batchUpdates = self.batchUpdates;\n    NSMutableArray *completionBlocks = [self.completionBlocks mutableCopy];\n\n    [self cleanStateBeforeUpdates];\n\n    void (^executeCompletionBlocks)(BOOL) = ^(BOOL finished) {\n        for (IGListUpdatingCompletion block in completionBlocks) {\n            block(finished);\n        }\n\n        self.state = IGListBatchUpdateStateIdle;\n    };\n\n    // bail early if the collection view has been deallocated in the time since the update was queued\n    UICollectionView *collectionView = collectionViewBlock();\n    if (collectionView == nil) {\n        [self _cleanStateAfterUpdates];\n        executeCompletionBlocks(NO);\n        return;\n    }\n\n    // item updates must not send mutations to the collection view while we are reloading\n    self.state = IGListBatchUpdateStateExecutingBatchUpdateBlock;\n\n    if (reloadUpdates) {\n        reloadUpdates();\n    }\n\n    // execute all stored item update blocks even if we are just calling reloadData. the actual collection view\n    // mutations will be discarded, but clients are encouraged to put their actual /data/ mutations inside the\n    // update block as well, so if we don't execute the block the changes will never happen\n    for (IGListItemUpdateBlock itemUpdateBlock in batchUpdates.itemUpdateBlocks) {\n        itemUpdateBlock();\n    }\n\n    // add any completion blocks from item updates. added after item blocks are executed in order to capture any\n    // re-entrant updates\n    [completionBlocks addObjectsFromArray:batchUpdates.itemCompletionBlocks];\n\n    self.state = IGListBatchUpdateStateExecutedBatchUpdateBlock;\n\n    [self _cleanStateAfterUpdates];\n\n    [delegate listAdapterUpdater:self willReloadDataWithCollectionView:collectionView];\n    [collectionView reloadData];\n    [collectionView.collectionViewLayout invalidateLayout];\n    [collectionView layoutIfNeeded];\n    [delegate listAdapterUpdater:self didReloadDataWithCollectionView:collectionView];\n\n    executeCompletionBlocks(YES);\n}\n\n- (void)performBatchUpdatesWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock {\n    IGAssertMainThread();\n    IGAssert(self.state == IGListBatchUpdateStateIdle, @\"Should not call batch updates when state isn't idle\");\n\n    // create local variables so we can immediately clean our state but pass these items into the batch update block\n    id<IGListAdapterUpdaterDelegate> delegate = self.delegate;\n    NSArray *fromObjects = [self.fromObjects copy];\n    IGListToObjectBlock toObjectsBlock = [self.toObjectsBlock copy];\n    NSMutableArray *completionBlocks = [self.completionBlocks mutableCopy];\n    void (^objectTransitionBlock)(NSArray *) = [self.objectTransitionBlock copy];\n    const BOOL animated = self.queuedUpdateIsAnimated;\n    IGListBatchUpdates *batchUpdates = self.batchUpdates;\n\n    // clean up all state so that new updates can be coalesced while the current update is in flight\n    [self cleanStateBeforeUpdates];\n\n    void (^executeCompletionBlocks)(BOOL) = ^(BOOL finished) {\n        self.applyingUpdateData = nil;\n        self.state = IGListBatchUpdateStateIdle;\n\n        for (IGListUpdatingCompletion block in completionBlocks) {\n            block(finished);\n        }\n    };\n\n    // bail early if the collection view has been deallocated in the time since the update was queued\n    UICollectionView *collectionView = collectionViewBlock();\n    if (collectionView == nil) {\n        [self _cleanStateAfterUpdates];\n        executeCompletionBlocks(NO);\n        return;\n    }\n\n    NSArray *toObjects = nil;\n    if (toObjectsBlock != nil) {\n        toObjects = objectsWithDuplicateIdentifiersRemoved(toObjectsBlock());\n    }\n#ifdef DEBUG\n    for (id obj in toObjects) {\n        IGAssert([obj conformsToProtocol:@protocol(IGListDiffable)],\n                 @\"In order to use IGListAdapterUpdater, object %@ must conform to IGListDiffable\", obj);\n        IGAssert([obj diffIdentifier] != nil,\n                 @\"Cannot have a nil diffIdentifier for object %@\", obj);\n    }\n#endif\n\n    void (^executeUpdateBlocks)(void) = ^{\n        self.state = IGListBatchUpdateStateExecutingBatchUpdateBlock;\n\n        // run the update block so that the adapter can set its items. this makes sure that just before the update is\n        // committed that the data source is updated to the /latest/ \"toObjects\". this makes the data source in sync\n        // with the items that the updater is transitioning to\n        if (objectTransitionBlock != nil) {\n            objectTransitionBlock(toObjects);\n        }\n\n        // execute each item update block which should make calls like insert, delete, and reload for index paths\n        // we collect all mutations in corresponding sets on self, then filter based on UICollectionView shortcomings\n        // call after the objectTransitionBlock so section level mutations happen before any items\n        for (IGListItemUpdateBlock itemUpdateBlock in batchUpdates.itemUpdateBlocks) {\n            itemUpdateBlock();\n        }\n\n        // add any completion blocks from item updates. added after item blocks are executed in order to capture any\n        // re-entrant updates\n        [completionBlocks addObjectsFromArray:batchUpdates.itemCompletionBlocks];\n\n        self.state = IGListBatchUpdateStateExecutedBatchUpdateBlock;\n    };\n\n    void (^reloadDataFallback)(void) = ^{\n        executeUpdateBlocks();\n        [self _cleanStateAfterUpdates];\n        [self _performBatchUpdatesItemBlockApplied];\n        [collectionView reloadData];\n        [collectionView layoutIfNeeded];\n\n        executeCompletionBlocks(YES);\n    };\n\n    // if the collection view isn't in a visible window, skip diffing and batch updating. execute all transition blocks,\n    // reload data, execute completion blocks, and get outta here\n    if (self.allowsBackgroundReloading && collectionView.window == nil) {\n        [self _beginPerformBatchUpdatesToObjects:toObjects];\n        reloadDataFallback();\n        return;\n    }\n\n    // disables multiple performBatchUpdates: from happening at the same time\n    [self _beginPerformBatchUpdatesToObjects:toObjects];\n\n    const IGListExperiment experiments = self.experiments;\n\n    IGListIndexSetResult *(^performDiff)(void) = ^{\n        return IGListDiffExperiment(fromObjects, toObjects, IGListDiffEquality, experiments);\n    };\n\n    // block executed in the first param block of -[UICollectionView performBatchUpdates:completion:]\n    void (^batchUpdatesBlock)(IGListIndexSetResult *result) = ^(IGListIndexSetResult *result){\n        executeUpdateBlocks();\n\n        self.applyingUpdateData = [self _flushCollectionView:collectionView\n                                              withDiffResult:result\n                                                batchUpdates:self.batchUpdates\n                                                 fromObjects:fromObjects];\n\n        [self _cleanStateAfterUpdates];\n        [self _performBatchUpdatesItemBlockApplied];\n    };\n\n    // block used as the second param of -[UICollectionView performBatchUpdates:completion:]\n    void (^batchUpdatesCompletionBlock)(BOOL) = ^(BOOL finished) {\n        IGListBatchUpdateData *oldApplyingUpdateData = self.applyingUpdateData;\n        executeCompletionBlocks(finished);\n\n        [delegate listAdapterUpdater:self didPerformBatchUpdates:oldApplyingUpdateData collectionView:collectionView];\n\n        // queue another update in case something changed during batch updates. this method will bail next runloop if\n        // there are no changes\n        [self _queueUpdateWithCollectionViewBlock:collectionViewBlock];\n    };\n\n    // block that executes the batch update and exception handling\n    void (^performUpdate)(IGListIndexSetResult *) = ^(IGListIndexSetResult *result){\n        [collectionView layoutIfNeeded];\n\n        @try {\n            [delegate  listAdapterUpdater:self\nwillPerformBatchUpdatesWithCollectionView:collectionView\n                              fromObjects:fromObjects\n                                toObjects:toObjects\n                       listIndexSetResult:result];\n            if (collectionView.dataSource == nil) {\n                // If the data source is nil, we should not call any collection view update.\n                batchUpdatesCompletionBlock(NO);\n            } else if (result.changeCount > 100 && IGListExperimentEnabled(experiments, IGListExperimentReloadDataFallback)) {\n                reloadDataFallback();\n            } else if (animated) {\n                [collectionView performBatchUpdates:^{\n                    batchUpdatesBlock(result);\n                } completion:batchUpdatesCompletionBlock];\n            } else {\n                [CATransaction begin];\n                [CATransaction setDisableActions:YES];\n                [collectionView performBatchUpdates:^{\n                    batchUpdatesBlock(result);\n                } completion:^(BOOL finished) {\n                    [CATransaction commit];\n                    batchUpdatesCompletionBlock(finished);\n                }];\n            }\n        } @catch (NSException *exception) {\n            [delegate listAdapterUpdater:self\n                          collectionView:collectionView\n                  willCrashWithException:exception\n                             fromObjects:fromObjects\n                               toObjects:toObjects\n                              diffResult:result\n                                 updates:(id)self.applyingUpdateData];\n            @throw exception;\n        }\n    };\n\n    if (IGListExperimentEnabled(experiments, IGListExperimentBackgroundDiffing)) {\n        dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{\n            IGListIndexSetResult *result = performDiff();\n            dispatch_async(dispatch_get_main_queue(), ^{\n                performUpdate(result);\n            });\n        });\n    } else {\n        IGListIndexSetResult *result = performDiff();\n        performUpdate(result);\n    }\n}\n\nvoid convertReloadToDeleteInsert(NSMutableIndexSet *reloads,\n                                 NSMutableIndexSet *deletes,\n                                 NSMutableIndexSet *inserts,\n                                 IGListIndexSetResult *result,\n                                 NSArray<id<IGListDiffable>> *fromObjects) {\n    // reloadSections: is unsafe to use within performBatchUpdates:, so instead convert all reloads into deletes+inserts\n    const BOOL hasObjects = [fromObjects count] > 0;\n    [[reloads copy] enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {\n        // if a diff was not performed, there are no changes. instead use the same index that was originally queued\n        id<NSObject> diffIdentifier = hasObjects ? [fromObjects[idx] diffIdentifier] : nil;\n        const NSInteger from = hasObjects ? [result oldIndexForIdentifier:diffIdentifier] : idx;\n        const NSInteger to = hasObjects ? [result newIndexForIdentifier:diffIdentifier] : idx;\n        [reloads removeIndex:from];\n\n        // if a reload is queued outside the diff and the object was inserted or deleted it cannot be\n        if (from != NSNotFound && to != NSNotFound) {\n            [deletes addIndex:from];\n            [inserts addIndex:to];\n        } else {\n            IGAssert([result.deletes containsIndex:idx],\n                     @\"Reloaded section %lu was not found in deletes with from: %li, to: %li, deletes: %@, fromClass: %@\",\n                     (unsigned long)idx, (long)from, (long)to, deletes, [(id)fromObjects[idx] class]);\n        }\n    }];\n}\n\nstatic NSArray<NSIndexPath *> *convertSectionReloadToItemUpdates(NSIndexSet *sectionReloads, UICollectionView *collectionView) {\n    NSMutableArray<NSIndexPath *> *updates = [NSMutableArray new];\n    [sectionReloads enumerateIndexesUsingBlock:^(NSUInteger sectionIndex, BOOL * _Nonnull stop) {\n        NSUInteger numberOfItems = [collectionView numberOfItemsInSection:sectionIndex];\n        for (NSUInteger itemIndex = 0; itemIndex < numberOfItems; itemIndex++) {\n            [updates addObject:[NSIndexPath indexPathForItem:itemIndex inSection:sectionIndex]];\n        }\n    }];\n    return [updates copy];\n}\n\n- (IGListBatchUpdateData *)_flushCollectionView:(UICollectionView *)collectionView\n                                withDiffResult:(IGListIndexSetResult *)diffResult\n                                  batchUpdates:(IGListBatchUpdates *)batchUpdates\n                                   fromObjects:(NSArray <id<IGListDiffable>> *)fromObjects {\n    NSSet *moves = [[NSSet alloc] initWithArray:diffResult.moves];\n\n    // combine section reloads from the diff and manual reloads via reloadItems:\n    NSMutableIndexSet *reloads = [diffResult.updates mutableCopy];\n    [reloads addIndexes:batchUpdates.sectionReloads];\n\n    NSMutableIndexSet *inserts = [diffResult.inserts mutableCopy];\n    NSMutableIndexSet *deletes = [diffResult.deletes mutableCopy];\n    NSMutableArray<NSIndexPath *> *itemUpdates = [NSMutableArray new];\n    if (self.movesAsDeletesInserts) {\n        for (IGListMoveIndex *move in moves) {\n            [deletes addIndex:move.from];\n            [inserts addIndex:move.to];\n        }\n        // clear out all moves\n        moves = [NSSet new];\n    }\n\n    // Item reloads are not safe, if any section moves happened or there are inserts/deletes.\n    if (self.preferItemReloadsForSectionReloads\n        && moves.count == 0 && inserts.count == 0 && deletes.count == 0 && reloads.count > 0) {\n        [reloads enumerateIndexesUsingBlock:^(NSUInteger sectionIndex, BOOL * _Nonnull stop) {\n            NSMutableIndexSet *localIndexSet = [NSMutableIndexSet indexSetWithIndex:sectionIndex];\n            if (sectionIndex < [collectionView numberOfSections]\n                && sectionIndex < [collectionView.dataSource numberOfSectionsInCollectionView:collectionView]\n                && [collectionView numberOfItemsInSection:sectionIndex] == [collectionView.dataSource collectionView:collectionView numberOfItemsInSection:sectionIndex]) {\n                // Perfer to do item reloads instead, if the number of items in section is unchanged.\n                [itemUpdates addObjectsFromArray:convertSectionReloadToItemUpdates(localIndexSet, collectionView)];\n            } else {\n                // Otherwise, fallback to convert into delete+insert section operation.\n                convertReloadToDeleteInsert(localIndexSet, deletes, inserts, diffResult, fromObjects);\n            }\n        }];\n    } else {\n        // reloadSections: is unsafe to use within performBatchUpdates:, so instead convert all reloads into deletes+inserts\n        convertReloadToDeleteInsert(reloads, deletes, inserts, diffResult, fromObjects);\n    }\n\n    NSMutableArray<NSIndexPath *> *itemInserts = batchUpdates.itemInserts;\n    NSMutableArray<NSIndexPath *> *itemDeletes = batchUpdates.itemDeletes;\n    NSMutableArray<IGListMoveIndexPath *> *itemMoves = batchUpdates.itemMoves;\n\n    NSSet<NSIndexPath *> *uniqueDeletes = [NSSet setWithArray:itemDeletes];\n    NSMutableSet<NSIndexPath *> *reloadDeletePaths = [NSMutableSet new];\n    NSMutableSet<NSIndexPath *> *reloadInsertPaths = [NSMutableSet new];\n    for (IGListReloadIndexPath *reload in batchUpdates.itemReloads) {\n        if (![uniqueDeletes containsObject:reload.fromIndexPath]) {\n            [reloadDeletePaths addObject:reload.fromIndexPath];\n            [reloadInsertPaths addObject:reload.toIndexPath];\n        }\n    }\n    [itemDeletes addObjectsFromArray:[reloadDeletePaths allObjects]];\n    [itemInserts addObjectsFromArray:[reloadInsertPaths allObjects]];\n\n    const BOOL fixIndexPathImbalance = IGListExperimentEnabled(self.experiments, IGListExperimentFixIndexPathImbalance);\n    IGListBatchUpdateData *updateData = [[IGListBatchUpdateData alloc] initWithInsertSections:inserts\n                                                                               deleteSections:deletes\n                                                                                 moveSections:moves\n                                                                             insertIndexPaths:itemInserts\n                                                                             deleteIndexPaths:itemDeletes\n                                                                             updateIndexPaths:itemUpdates\n                                                                               moveIndexPaths:itemMoves\n                                                                        fixIndexPathImbalance:fixIndexPathImbalance];\n    [collectionView ig_applyBatchUpdateData:updateData];\n    return updateData;\n}\n\n- (void)_beginPerformBatchUpdatesToObjects:(NSArray *)toObjects {\n    self.pendingTransitionToObjects = toObjects;\n    self.state = IGListBatchUpdateStateQueuedBatchUpdate;\n}\n\n- (void)_performBatchUpdatesItemBlockApplied {\n    self.pendingTransitionToObjects = nil;\n}\n\n- (void)cleanStateBeforeUpdates {\n    self.queuedUpdateIsAnimated = YES;\n\n    // destroy to/from transition items\n    self.fromObjects = nil;\n    self.toObjectsBlock = nil;\n\n    // destroy reloadData state\n    self.reloadUpdates = nil;\n    self.queuedReloadData = NO;\n\n    // remove indexpath/item changes\n    self.objectTransitionBlock = nil;\n\n    // removes all object completion blocks. done before updates to start collecting completion blocks for coalesced\n    // or re-entrant object updates\n    [self.completionBlocks removeAllObjects];\n}\n\n- (void)_cleanStateAfterUpdates {\n    self.batchUpdates = [IGListBatchUpdates new];\n}\n\n- (void)_queueUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock {\n    IGAssertMainThread();\n\n    __weak __typeof__(self) weakSelf = self;\n\n    // dispatch_async to give the main queue time to collect more batch updates so that a minimum amount of work\n    // (diffing, etc) is done on main. dispatch_async does not garauntee a full runloop turn will pass though.\n    // see -performUpdateWithCollectionView:fromObjects:toObjects:animated:objectTransitionBlock:completion: for more\n    // details on how coalescence is done.\n    dispatch_async(dispatch_get_main_queue(), ^{\n        if (weakSelf.state != IGListBatchUpdateStateIdle\n            || ![weakSelf hasChanges]) {\n            return;\n        }\n\n        if (weakSelf.hasQueuedReloadData) {\n            [weakSelf performReloadDataWithCollectionViewBlock:collectionViewBlock];\n        } else {\n            [weakSelf performBatchUpdatesWithCollectionViewBlock:collectionViewBlock];\n        }\n    });\n}\n\n\n#pragma mark - IGListUpdatingDelegate\n\nstatic BOOL IGListIsEqual(const void *a, const void *b, NSUInteger (*size)(const void *item)) {\n    const id<IGListDiffable, NSObject> left = (__bridge id<IGListDiffable, NSObject>)a;\n    const id<IGListDiffable, NSObject> right = (__bridge id<IGListDiffable, NSObject>)b;\n    return [left class] == [right class]\n    && [[left diffIdentifier] isEqual:[right diffIdentifier]];\n}\n\n// since the diffing algo used in this updater keys items based on their -diffIdentifier, we must use a map table that\n// precisely mimics this behavior\nstatic NSUInteger IGListIdentifierHash(const void *item, NSUInteger (*size)(const void *item)) {\n    return [[(__bridge id<IGListDiffable>)item diffIdentifier] hash];\n}\n\n- (NSPointerFunctions *)objectLookupPointerFunctions {\n    NSPointerFunctions *functions = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory];\n    functions.hashFunction = IGListIdentifierHash;\n    functions.isEqualFunction = IGListIsEqual;\n    return functions;\n}\n\n- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                            fromObjects:(NSArray *)fromObjects\n                         toObjectsBlock:(IGListToObjectBlock)toObjectsBlock\n                               animated:(BOOL)animated\n                  objectTransitionBlock:(IGListObjectTransitionBlock)objectTransitionBlock\n                             completion:(IGListUpdatingCompletion)completion {\n    IGAssertMainThread();\n    IGParameterAssert(collectionViewBlock != nil);\n    IGParameterAssert(objectTransitionBlock != nil);\n\n    // only update the items that we are coming from if it has not been set\n    // this allows multiple updates to be called while an update is already in progress, and the transition from > to\n    // will be done on the first \"fromObjects\" received and the last \"toObjects\"\n    // if performBatchUpdates: hasn't applied the update block, then data source hasn't transitioned its state. if an\n    // update is queued in between then we must use the pending toObjects\n    self.fromObjects = self.fromObjects ?: self.pendingTransitionToObjects ?: fromObjects;\n    self.toObjectsBlock = toObjectsBlock;\n\n    // disabled animations will always take priority\n    // reset to YES in -cleanupState\n    self.queuedUpdateIsAnimated = self.queuedUpdateIsAnimated && animated;\n\n    // always use the last update block, even though this should always do the exact same thing\n    self.objectTransitionBlock = objectTransitionBlock;\n\n    IGListUpdatingCompletion localCompletion = completion;\n    if (localCompletion) {\n        [self.completionBlocks addObject:localCompletion];\n    }\n\n    [self _queueUpdateWithCollectionViewBlock:collectionViewBlock];\n}\n\n- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                               animated:(BOOL)animated\n                            itemUpdates:(void (^)(void))itemUpdates\n                             completion:(void (^)(BOOL))completion {\n    IGAssertMainThread();\n    IGParameterAssert(collectionViewBlock != nil);\n    IGParameterAssert(itemUpdates != nil);\n\n    IGListBatchUpdates *batchUpdates = self.batchUpdates;\n    if (completion != nil) {\n        [batchUpdates.itemCompletionBlocks addObject:completion];\n    }\n\n    // if already inside the execution of the update block, immediately unload the itemUpdates block.\n    // the completion blocks are executed later in the lifecycle, so that still needs to be added to the batch\n    if (self.state == IGListBatchUpdateStateExecutingBatchUpdateBlock) {\n        itemUpdates();\n    } else {\n        [batchUpdates.itemUpdateBlocks addObject:itemUpdates];\n\n        // disabled animations will always take priority\n        // reset to YES in -cleanupState\n        self.queuedUpdateIsAnimated = self.queuedUpdateIsAnimated && animated;\n\n        [self _queueUpdateWithCollectionViewBlock:collectionViewBlock];\n    }\n}\n\n- (void)insertItemsIntoCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray <NSIndexPath *> *)indexPaths {\n    IGAssertMainThread();\n    IGParameterAssert(collectionView != nil);\n    IGParameterAssert(indexPaths != nil);\n    if (self.state == IGListBatchUpdateStateExecutingBatchUpdateBlock) {\n        [self.batchUpdates.itemInserts addObjectsFromArray:indexPaths];\n    } else {\n        [self.delegate listAdapterUpdater:self willInsertIndexPaths:indexPaths collectionView:collectionView];\n        [collectionView insertItemsAtIndexPaths:indexPaths];\n    }\n}\n\n- (void)deleteItemsFromCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray <NSIndexPath *> *)indexPaths {\n    IGAssertMainThread();\n    IGParameterAssert(collectionView != nil);\n    IGParameterAssert(indexPaths != nil);\n    if (self.state == IGListBatchUpdateStateExecutingBatchUpdateBlock) {\n        [self.batchUpdates.itemDeletes addObjectsFromArray:indexPaths];\n    } else {\n        [self.delegate listAdapterUpdater:self willDeleteIndexPaths:indexPaths collectionView:collectionView];\n        [collectionView deleteItemsAtIndexPaths:indexPaths];\n    }\n}\n\n- (void)moveItemInCollectionView:(UICollectionView *)collectionView\n                   fromIndexPath:(NSIndexPath *)fromIndexPath\n                     toIndexPath:(NSIndexPath *)toIndexPath {\n    if (self.state == IGListBatchUpdateStateExecutingBatchUpdateBlock) {\n        IGListMoveIndexPath *move = [[IGListMoveIndexPath alloc] initWithFrom:fromIndexPath to:toIndexPath];\n        [self.batchUpdates.itemMoves addObject:move];\n    } else {\n        [self.delegate listAdapterUpdater:self willMoveFromIndexPath:fromIndexPath toIndexPath:toIndexPath collectionView:collectionView];\n        [collectionView moveItemAtIndexPath:fromIndexPath toIndexPath:toIndexPath];\n    }\n}\n\n- (void)reloadItemInCollectionView:(UICollectionView *)collectionView\n                     fromIndexPath:(NSIndexPath *)fromIndexPath\n                       toIndexPath:(NSIndexPath *)toIndexPath {\n    if (self.state == IGListBatchUpdateStateExecutingBatchUpdateBlock) {\n        IGListReloadIndexPath *reload = [[IGListReloadIndexPath alloc] initWithFromIndexPath:fromIndexPath toIndexPath:toIndexPath];\n        [self.batchUpdates.itemReloads addObject:reload];\n    } else {\n        [self.delegate listAdapterUpdater:self willReloadIndexPaths:@[fromIndexPath] collectionView:collectionView];\n        [collectionView reloadItemsAtIndexPaths:@[fromIndexPath]];\n    }\n}\n\n- (void)moveSectionInCollectionView:(UICollectionView *)collectionView\n                          fromIndex:(NSInteger)fromIndex\n                            toIndex:(NSInteger)toIndex {\n    IGAssertMainThread();\n    IGParameterAssert(collectionView != nil);\n\n    // iOS expects interactive reordering to be movement of items not sections\n    // after moving a single-item section controller,\n    // you end up with two items in the section for the drop location,\n    // and zero items in the section originating at the drag location\n    // so, we have to reload data rather than doing a section move\n\n    [collectionView reloadData];\n\n    // It seems that reloadData called during UICollectionView's moveItemAtIndexPath\n    // delegate call does not reload all cells as intended\n    // So, we further reload all visible sections to make sure none of our cells\n    // are left with data that's out of sync with our dataSource\n\n    id<IGListAdapterUpdaterDelegate> delegate = self.delegate;\n\n    NSMutableIndexSet *visibleSections = [NSMutableIndexSet new];\n    NSArray *visibleIndexPaths = [collectionView indexPathsForVisibleItems];\n    for (NSIndexPath *visibleIndexPath in visibleIndexPaths) {\n        [visibleSections addIndex:visibleIndexPath.section];\n    }\n\n    [delegate listAdapterUpdater:self willReloadSections:visibleSections collectionView:collectionView];\n\n    // prevent double-animation from reloadData + reloadSections\n\n    [CATransaction begin];\n    [CATransaction setDisableActions:YES];\n    [collectionView performBatchUpdates:^{\n        [collectionView reloadSections:visibleSections];\n    } completion:^(BOOL finished) {\n        [CATransaction commit];\n    }];\n}\n\n- (void)reloadDataWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                   reloadUpdateBlock:(IGListReloadUpdateBlock)reloadUpdateBlock\n                          completion:(nullable IGListUpdatingCompletion)completion {\n    IGAssertMainThread();\n    IGParameterAssert(collectionViewBlock != nil);\n    IGParameterAssert(reloadUpdateBlock != nil);\n\n    IGListUpdatingCompletion localCompletion = completion;\n    if (localCompletion) {\n        [self.completionBlocks addObject:localCompletion];\n    }\n\n    self.reloadUpdates = reloadUpdateBlock;\n    self.queuedReloadData = YES;\n    [self _queueUpdateWithCollectionViewBlock:collectionViewBlock];\n}\n\n- (void)reloadCollectionView:(UICollectionView *)collectionView sections:(NSIndexSet *)sections {\n    IGAssertMainThread();\n    IGParameterAssert(collectionView != nil);\n    IGParameterAssert(sections != nil);\n    if (self.state == IGListBatchUpdateStateExecutingBatchUpdateBlock) {\n        [self.batchUpdates.sectionReloads addIndexes:sections];\n    } else {\n        [self.delegate listAdapterUpdater:self willReloadSections:sections collectionView:collectionView];\n        [collectionView reloadSections:sections];\n    }\n}\n\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListAdapterUpdaterDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListBatchUpdateData.h>\n\n@class IGListAdapterUpdater;\n@class IGListBatchUpdates;\n@class IGListIndexSetResult;\n@protocol IGListDiffable;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A protocol that receives events about `IGListAdapterUpdater` operations.\n */\nNS_SWIFT_NAME(ListAdapterUpdaterDelegate)\n@protocol IGListAdapterUpdaterDelegate <NSObject>\n\n/**\n Notifies the delegate that the updater will call `-[UICollectionView performBatchUpdates:completion:]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param collectionView The collection view that will perform the batch updates.\n @param fromObjects The items transitioned from in the batch updates, if any.\n @param toObjects The items transitioned to in the batch updates, if any.\n @param listIndexSetResults The diffing result of indices to be inserted/removed/updated/moved/etc.\n */\n- (void)               listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\nwillPerformBatchUpdatesWithCollectionView:(UICollectionView *)collectionView\n                              fromObjects:(nullable NSArray <id<IGListDiffable>> *)fromObjects\n                                toObjects:(nullable NSArray <id<IGListDiffable>> *)toObjects\n                       listIndexSetResult:(nullable IGListIndexSetResult *)listIndexSetResults;\n\n/**\n Notifies the delegate that the updater successfully finished `-[UICollectionView performBatchUpdates:completion:]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param updates The batch updates that were applied to the collection view.\n @param collectionView The collection view that performed the batch updates.\n\n @note This event is called in the completion block of the batch update.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\n    didPerformBatchUpdates:(IGListBatchUpdateData *)updates\n            collectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the updater will call `-[UICollectionView insertItemsAtIndexPaths:]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param indexPaths An array of index paths that will be inserted.\n @param collectionView The collection view that will perform the insert.\n\n @note This event is only sent when outside of `-[UICollectionView performBatchUpdates:completion:]`.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\n      willInsertIndexPaths:(NSArray<NSIndexPath *> *)indexPaths\n            collectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the updater will call `-[UICollectionView deleteItemsAtIndexPaths:]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param indexPaths An array of index paths that will be deleted.\n @param collectionView The collection view that will perform the delete.\n\n @note This event is only sent when outside of `-[UICollectionView performBatchUpdates:completion:]`.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\n      willDeleteIndexPaths:(NSArray<NSIndexPath *> *)indexPaths\n            collectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the updater will call `-[UICollectionView moveItemAtIndexPath:toIndexPath:]`\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param fromIndexPath The index path of the item that will be moved.\n @param toIndexPath The index path to move the item to.\n @param collectionView The collection view that will perform the move.\n\n @note This event is only sent when outside of `-[UICollectionView performBatchUpdates:completion:]`.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\n     willMoveFromIndexPath:(NSIndexPath *)fromIndexPath\n               toIndexPath:(NSIndexPath *)toIndexPath\n            collectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the updater will call `-[UICollectionView reloadItemsAtIndexPaths:]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param indexPaths An array of index paths that will be reloaded.\n @param collectionView The collection view that will perform the reload.\n\n @note This event is only sent when outside of `-[UICollectionView performBatchUpdates:completion:]`.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\n      willReloadIndexPaths:(NSArray<NSIndexPath *> *)indexPaths\n            collectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the updater will call `-[UICollectionView reloadSections:]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param sections The sections that will be reloaded\n @param collectionView The collection view that will perform the reload.\n\n @note This event is only sent when outside of `-[UICollectionView performBatchUpdates:completion:]`.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\n        willReloadSections:(NSIndexSet *)sections\n            collectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the updater will call `-[UICollectionView reloadData]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param collectionView The collection view that will be reloaded.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater willReloadDataWithCollectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the updater successfully called `-[UICollectionView reloadData]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param collectionView The collection view that reloaded.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater didReloadDataWithCollectionView:(UICollectionView *)collectionView;\n\n/**\n Notifies the delegate that the collection view threw an exception in `-[UICollectionView performBatchUpdates:completion:]`.\n\n @param listAdapterUpdater The adapter updater owning the transition.\n @param collectionView The collection view being updated.\n @param exception The exception thrown by the collection view.\n @param fromObjects The items transitioned from in the diff, if any.\n @param toObjects The items transitioned to in the diff, if any.\n @param diffResult The diff result that were computed from `fromObjects` and `toObjects`.\n @param updates The batch updates that were applied to the collection view.\n */\n- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater\n            collectionView:(UICollectionView *)collectionView\n    willCrashWithException:(NSException *)exception\n               fromObjects:(nullable NSArray *)fromObjects\n                 toObjects:(nullable NSArray *)toObjects\n                diffResult:(IGListIndexSetResult *)diffResult\n                   updates:(IGListBatchUpdateData *)updates;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListBatchContext.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListSectionController;\n\n\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Objects conforming to the IGListBatchContext protocol provide a way for section controllers to mutate their cells or\n reload everything within the section.\n */\nNS_SWIFT_NAME(ListBatchContext)\n@protocol IGListBatchContext <NSObject>\n\n/**\n Reloads cells in the section controller.\n \n @param sectionController  The section controller who's cells need reloading.\n @param indexes The indexes of items that need reloading.\n */\n- (void)reloadInSectionController:(IGListSectionController *)sectionController\n                        atIndexes:(NSIndexSet *)indexes;\n\n/**\n Inserts cells in the list.\n \n @param sectionController The section controller who's cells need inserting.\n @param indexes The indexes of items that need inserting.\n */\n- (void)insertInSectionController:(IGListSectionController *)sectionController\n                        atIndexes:(NSIndexSet *)indexes;\n\n/**\n Deletes cells in the list.\n \n @param sectionController The section controller who's cells need deleted.\n @param indexes The indexes of items that need deleting.\n */\n- (void)deleteInSectionController:(IGListSectionController *)sectionController\n                        atIndexes:(NSIndexSet *)indexes;\n\n/**\n Invalidates layouts of cells at specific in the section controller.\n \n @param sectionController The section controller who's cells need invalidating.\n @param indexes The indexes of items that need invalidating.\n */\n- (void)invalidateLayoutInSectionController:(IGListSectionController *)sectionController\n                                  atIndexes:(NSIndexSet *)indexes;\n\n/**\n Moves a cell from one index to another within the section controller.\n \n @param sectionController The section controller who's cell needs moved.\n @param fromIndex The index the cell is currently in.\n @param toIndex The index the cell should move to.\n */\n- (void)moveInSectionController:(IGListSectionController *)sectionController\n                      fromIndex:(NSInteger)fromIndex\n                        toIndex:(NSInteger)toIndex;\n\n/**\n Reloads the entire section controller.\n \n @param sectionController The section controller who's cells need reloading.\n */\n- (void)reloadSectionController:(IGListSectionController *)sectionController;\n    \n/**\n Moves a section controller from one index to another during interactive reordering.\n \n @param sectionController The section controller to move.\n @param fromIndex The index where the section currently resides.\n @param toIndex The index the section should move to.\n */\n- (void)moveSectionControllerInteractive:(IGListSectionController *)sectionController\n                               fromIndex:(NSInteger)fromIndex\n                                 toIndex:(NSInteger)toIndex NS_AVAILABLE_IOS(9_0);\n\n/**\n Moves an object within a section controller from one index to another during interactive reordering.\n \n @param sectionController The section controller containing the object to move.\n @param fromIndex The index where the object currently resides.\n @param toIndex The index the object should move to.\n */\n- (void)moveInSectionControllerInteractive:(IGListSectionController *)sectionController\n                                 fromIndex:(NSInteger)fromIndex\n                                   toIndex:(NSInteger)toIndex NS_AVAILABLE_IOS(9_0);\n    \n/**\n Reverts an move from one indexPath to another during interactive reordering.\n \n @param sourceIndexPath The indexPath the item was originally in.\n @param destinationIndexPath The indexPath the item was moving to.\n */\n- (void)revertInvalidInteractiveMoveFromIndexPath:(NSIndexPath *)sourceIndexPath\n                                      toIndexPath:(NSIndexPath *)destinationIndexPath NS_AVAILABLE_IOS(9_0);\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListBindable.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A protocol for cells that configure themselves given a view model.\n */\nNS_SWIFT_NAME(ListBindable)\n@protocol IGListBindable <NSObject>\n\n/**\n Tells the cell to configure itself with the given view model.\n\n @param viewModel The view model for the cell.\n\n @note The view model can change many times throughout the lifetime of a cell as the model values change and the cell\n is reused. Implementations should use only this method to do their configuration.\n */\n- (void)bindViewModel:(id)viewModel;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListBindingSectionController.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n#import <IGListKit/IGListBindingSectionControllerDataSource.h>\n#import <IGListKit/IGListBindingSectionControllerSelectionDelegate.h>\n#import <IGListKit/IGListSectionController.h>\n\n@protocol IGListDiffable;\n@protocol IGListBindable;\n\n@class IGListBindingSectionController;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n This section controller uses a data source to transform its \"top level\" object into an array of diffable view models.\n It then automatically binds each view model to cells via the `IGListBindable` protocol.\n \n Models used with `IGListBindingSectionController` should take special care to always return `YES` for identical\n objects. That is, any objects with matching `-diffIdentifier`s should always be equal, that way the section controller\n can create new view models via the data source, create a diff, and update the specific cells that have changed.\n \n In Objective-C, your `-isEqualToDiffableObject:` can simply be:\n ```\n - (BOOL)isEqualToDiffableObject:(id)object {\n   return YES;\n }\n ```\n \n In Swift:\n ```\n func isEqual(toDiffableObject object: IGListDiffable?) -> Bool {\n   return true\n }\n ```\n \n Only when `-diffIdentifier`s match is object equality compared, so you can assume the class is the same, and the\n instance has already been checked.\n */\nNS_SWIFT_NAME(ListBindingSectionController)\n@interface IGListBindingSectionController<__covariant ObjectType : id<IGListDiffable>> : IGListSectionController\n\n/**\n A data source that transforms a top-level object into view models, and returns cells and sizes for given view models.\n */\n@property (nonatomic, weak, nullable) id<IGListBindingSectionControllerDataSource> dataSource;\n\n/**\n A delegate that receives selection events from cells in an `IGListBindingSectionController` instance.\n */\n@property (nonatomic, weak, nullable) id<IGListBindingSectionControllerSelectionDelegate> selectionDelegate;\n\n/**\n The object currently assigned to the section controller, if any.\n */\n@property (nonatomic, strong, readonly, nullable) ObjectType object;\n\n/**\n The array of view models created from the data source. Values are changed when the top-level object changes or by\n calling `-updateAnimated:completion:` manually.\n */\n@property (nonatomic, strong, readonly) NSArray<id<IGListDiffable>> *viewModels;\n\n/**\n Tells the section controller to query for new view models, diff the changes, and update its cells.\n\n @param animated A flag indicating if the transition should be animated or not.\n @param completion An optional completion block executed after updates finish. Parameter is YES if updates were applied.\n */\n- (void)updateAnimated:(BOOL)animated completion:(nullable void (^)(BOOL updated))completion;\n\n/**\n Notifies the section that a list object should move within a section as the result of interactive reordering.\n \n @param sourceIndex The starting index of the object.\n @param destinationIndex The ending index of the object.\n \n @note this method must be implemented if interactive reordering is enabled. To ensure updating the internal viewModels array, **calling super is required**, preferably before your own implementation.\n */\n- (void)moveObjectFromIndex:(NSInteger)sourceIndex toIndex:(NSInteger)destinationIndex NS_REQUIRES_SUPER;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListBindingSectionController.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListBindingSectionController.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListKit/IGListBindable.h>\n\n#import \"IGListArrayUtilsInternal.h\"\n\ntypedef NS_ENUM(NSInteger, IGListDiffingSectionState) {\n    IGListDiffingSectionStateIdle = 0,\n    IGListDiffingSectionStateUpdateQueued,\n    IGListDiffingSectionStateUpdateApplied\n};\n\n@interface IGListBindingSectionController()\n\n@property (nonatomic, strong, readwrite) NSArray<id<IGListDiffable>> *viewModels;\n\n@property (nonatomic, strong) id object;\n@property (nonatomic, assign) IGListDiffingSectionState state;\n\n@end\n\n@implementation IGListBindingSectionController\n\n#pragma mark - Public API\n\n- (void)updateAnimated:(BOOL)animated completion:(void (^)(BOOL))completion {\n    IGAssertMainThread();\n\n    if (self.state != IGListDiffingSectionStateIdle) {\n        if (completion != nil) {\n            completion(NO);\n        }\n        return;\n    }\n    self.state = IGListDiffingSectionStateUpdateQueued;\n\n    __block IGListIndexSetResult *result = nil;\n    __block NSArray<id<IGListDiffable>> *oldViewModels = nil;\n\n    id<IGListCollectionContext> collectionContext = self.collectionContext;\n    [self.collectionContext performBatchAnimated:animated updates:^(id<IGListBatchContext> batchContext) {\n        if (self.state != IGListDiffingSectionStateUpdateQueued) {\n            return;\n        }\n        \n        oldViewModels = self.viewModels;\n\n        id<IGListDiffable> object = self.object;\n        IGAssert(object != nil, @\"Expected IGListBindingSectionController object to be non-nil before updating.\");\n        \n        NSArray *newViewModels = [self.dataSource sectionController:self viewModelsForObject:object];\n        self.viewModels = objectsWithDuplicateIdentifiersRemoved(newViewModels);\n        result = IGListDiff(oldViewModels, self.viewModels, IGListDiffEquality);\n        \n        [result.updates enumerateIndexesUsingBlock:^(NSUInteger oldUpdatedIndex, BOOL *stop) {\n            id identifier = [oldViewModels[oldUpdatedIndex] diffIdentifier];\n            const NSInteger indexAfterUpdate = [result newIndexForIdentifier:identifier];\n            if (indexAfterUpdate != NSNotFound) {\n                UICollectionViewCell<IGListBindable> *cell = [collectionContext cellForItemAtIndex:oldUpdatedIndex\n                                                                                 sectionController:self];\n                [cell bindViewModel:self.viewModels[indexAfterUpdate]];\n            }\n        }];\n        \n        if (IGListExperimentEnabled(self.collectionContext.experiments, IGListExperimentInvalidateLayoutForUpdates)) {\n            [batchContext invalidateLayoutInSectionController:self atIndexes:result.updates];\n        }\n        [batchContext deleteInSectionController:self atIndexes:result.deletes];\n        [batchContext insertInSectionController:self atIndexes:result.inserts];\n        \n        for (IGListMoveIndex *move in result.moves) {\n            [batchContext moveInSectionController:self fromIndex:move.from toIndex:move.to];\n        }\n        \n        self.state = IGListDiffingSectionStateUpdateApplied;\n    } completion:^(BOOL finished) {\n        self.state = IGListDiffingSectionStateIdle;\n        if (completion != nil) {\n            completion(YES);\n        }\n    }];\n}\n\n#pragma mark - IGListSectionController Overrides\n\n- (NSInteger)numberOfItems {\n    return self.viewModels.count;\n}\n\n- (CGSize)sizeForItemAtIndex:(NSInteger)index {\n    return [self.dataSource sectionController:self sizeForViewModel:self.viewModels[index] atIndex:index];\n}\n\n- (UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index {\n    id<IGListDiffable> viewModel = self.viewModels[index];\n    UICollectionViewCell<IGListBindable> *cell = [self.dataSource sectionController:self cellForViewModel:viewModel atIndex:index];\n    [cell bindViewModel:viewModel];\n    return cell;\n}\n\n- (void)didUpdateToObject:(id)object {\n    id oldObject = self.object;\n    self.object = object;\n\n    if (oldObject == nil) {\n        NSArray *viewModels = [self.dataSource sectionController:self viewModelsForObject:object];\n        self.viewModels = objectsWithDuplicateIdentifiersRemoved(viewModels);\n    } else {\n#if IGLK_LOGGING_ENABLED\n        if (![oldObject isEqualToDiffableObject:object]) {\n            IGLKLog(@\"Warning: Unequal objects %@ and %@ will cause IGListBindingSectionController to reload the entire section\",\n                    oldObject, object);\n        }\n#endif\n        [self updateAnimated:YES completion:nil];\n    }\n}\n\n- (void)moveObjectFromIndex:(NSInteger)sourceIndex toIndex:(NSInteger)destinationIndex {\n    NSMutableArray *viewModels = [self.viewModels mutableCopy];\n    \n    id modelAtSource = [viewModels objectAtIndex:sourceIndex];\n    [viewModels removeObjectAtIndex:sourceIndex];\n    [viewModels insertObject:modelAtSource atIndex:destinationIndex];\n    \n    self.viewModels = viewModels;\n}\n\n- (void)didSelectItemAtIndex:(NSInteger)index {\n    [self.selectionDelegate sectionController:self didSelectItemAtIndex:index viewModel:self.viewModels[index]];\n}\n\n- (void)didDeselectItemAtIndex:(NSInteger)index {\n    [self.selectionDelegate sectionController:self didDeselectItemAtIndex:index viewModel:self.viewModels[index]];\n}\n\n- (void)didHighlightItemAtIndex:(NSInteger)index {\n    [self.selectionDelegate sectionController:self didHighlightItemAtIndex:index viewModel:self.viewModels[index]];\n}\n\n- (void)didUnhighlightItemAtIndex:(NSInteger)index {\n    [self.selectionDelegate sectionController:self didUnhighlightItemAtIndex:index viewModel:self.viewModels[index]];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListBindingSectionControllerDataSource.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@class IGListBindingSectionController;\n\n@protocol IGListBindable;\n@protocol IGListDiffable;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A protocol that returns data to power cells in an `IGListBindingSectionController`.\n */\nNS_SWIFT_NAME(ListBindingSectionControllerDataSource)\n@protocol IGListBindingSectionControllerDataSource <NSObject>\n\n/**\n Create an array of view models given a top-level object.\n\n @param sectionController The section controller requesting view models.\n @param object The top-level object that powers the section controller.\n \n @return A new array of view models.\n */\n- (NSArray<id<IGListDiffable>> *)sectionController:(IGListBindingSectionController *)sectionController\n                               viewModelsForObject:(id)object;\n\n/**\n Return a dequeued cell for a given view model.\n\n @param sectionController The section controller requesting a cell.\n @param viewModel The view model for the cell.\n @param index The index of the view model.\n \n @return A dequeued cell.\n \n @note The section controller will call `-bindViewModel:` with the provided view model after the cell is dequeued. You\n should handle cell configuration using this method. However, you can do additional configuration at this stage as well.\n */\n- (UICollectionViewCell<IGListBindable> *)sectionController:(IGListBindingSectionController *)sectionController\n                                           cellForViewModel:(id)viewModel\n                                                    atIndex:(NSInteger)index;\n\n/**\n Return a cell size for a given view model.\n\n @param sectionController The section controller requesting a size.\n @param viewModel The view model for the cell.\n @param index The index of the view model.\n \n @return A size for the view model.\n */\n- (CGSize)sectionController:(IGListBindingSectionController *)sectionController\n           sizeForViewModel:(id)viewModel\n                    atIndex:(NSInteger)index;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListBindingSectionControllerSelectionDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListBindingSectionController;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A protocol that handles cell selection events in an `IGListBindingSectionController`.\n */\nNS_SWIFT_NAME(ListBindingSectionControllerSelectionDelegate)\n@protocol IGListBindingSectionControllerSelectionDelegate <NSObject>\n\n/**\n Tells the delegate that a cell at a given index was selected.\n\n @param sectionController The section controller the selection occurred in.\n @param index The index of the selected cell.\n @param viewModel The view model that was bound to the cell.\n */\n- (void)sectionController:(IGListBindingSectionController *)sectionController\n     didSelectItemAtIndex:(NSInteger)index\n                viewModel:(id)viewModel;\n\n/**\n Tells the delegate that a cell at a given index was deselected.\n\n @param sectionController The section controller the deselection occurred in.\n @param index The index of the deselected cell.\n @param viewModel The view model that was bound to the cell.\n */\n- (void)sectionController:(IGListBindingSectionController *)sectionController\n   didDeselectItemAtIndex:(NSInteger)index\n                viewModel:(id)viewModel;\n\n/**\n Tells the delegate that a cell at a given index was highlighted.\n\n @param sectionController The section controller the highlight occurred in.\n @param index The index of the highlighted cell.\n @param viewModel The view model that was bound to the cell.\n */\n- (void)sectionController:(IGListBindingSectionController *)sectionController\n  didHighlightItemAtIndex:(NSInteger)index\n                viewModel:(id)viewModel;\n\n/**\n Tells the delegate that a cell at a given index was unhighlighted.\n\n @param sectionController The section controller the unhighlight occurred in.\n @param index The index of the unhighlighted cell.\n @param viewModel The view model that was bound to the cell.\n */\n- (void)sectionController:(IGListBindingSectionController *)sectionController\ndidUnhighlightItemAtIndex:(NSInteger)index\n                viewModel:(id)viewModel;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionContext.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListExperiments.h>\n#import <IGListKit/IGListBatchContext.h>\n#import <IGListKit/IGListCollectionScrollingTraits.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class IGListSectionController;\n\n/**\n The collection context provides limited access to the collection-related information that\n section controllers need for operations like sizing, dequeuing cells, inserting, deleting, reloading, etc.\n */\nNS_SWIFT_NAME(ListCollectionContext)\n@protocol IGListCollectionContext <NSObject>\n\n/**\n The size of the collection view. You can use this for sizing cells.\n */\n@property (nonatomic, readonly) CGSize containerSize;\n\n/**\n The content insets of the collection view. You can use this for sizing cells.\n */\n@property (nonatomic, readonly) UIEdgeInsets containerInset;\n\n/**\n The adjusted content insets of the collection view. Equivalent to containerInset under iOS 11.\n */\n@property (nonatomic, readonly) UIEdgeInsets adjustedContainerInset;\n\n/**\n The size of the collection view with content insets applied.\n */\n@property (nonatomic, readonly) CGSize insetContainerSize;\n\n/**\n The current scrolling traits of the underlying collection view.\n */\n@property (nonatomic, readonly) IGListCollectionScrollingTraits scrollingTraits;\n\n/**\n A bitmask of experiments to conduct on the section controller.\n */\n@property (nonatomic, assign) IGListExperiment experiments;\n\n/**\n Returns size of the collection view relative to the section controller.\n \n @param sectionController The section controller requesting this information.\n \n @return The size of the collection view minus the given section controller's insets.\n */\n- (CGSize)containerSizeForSectionController:(IGListSectionController *)sectionController;\n\n/**\n Returns the index of the specified cell in the collection relative to the section controller.\n\n @param cell An existing cell in the collection.\n @param sectionController The section controller requesting this information.\n\n @return The index of the cell or `NSNotFound` if it does not exist in the collection.\n */\n- (NSInteger)indexForCell:(UICollectionViewCell *)cell\n        sectionController:(IGListSectionController *)sectionController;\n\n/**\n Returns the cell in the collection at the specified index for the section controller.\n\n @param index The index of the desired cell.\n @param sectionController The section controller requesting this information.\n\n @return The collection view cell, or `nil` if not found.\n\n @warning This method may return `nil` if the cell is offscreen.\n */\n- (nullable __kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index\n                                             sectionController:(IGListSectionController *)sectionController;\n\n/**\n Returns the visible cells for the given section controller.\n\n @param sectionController The section controller requesting this information.\n\n @return An array of visible cells, or an empty array if none are found.\n */\n- (NSArray<UICollectionViewCell *> *)visibleCellsForSectionController:(IGListSectionController *)sectionController;\n\n/**\n Returns the visible paths for the given section controller.\n \n @param sectionController The section controller requesting this information.\n \n @return An array of visible index paths, or an empty array if none are found.\n */\n- (NSArray<NSIndexPath *> *)visibleIndexPathsForSectionController:(IGListSectionController *) sectionController;\n\n/**\n Deselects a cell in the collection.\n\n @param index The index of the item to deselect.\n @param sectionController The section controller requesting this information.\n @param animated Pass `YES` to animate the change, `NO` otherwise.\n */\n- (void)deselectItemAtIndex:(NSInteger)index\n          sectionController:(IGListSectionController *)sectionController\n                   animated:(BOOL)animated;\n\n/**\n Selects a cell in the collection.\n \n @param index The index of the item to select.\n @param sectionController The section controller requesting this information.\n @param animated Pass `YES` to animate the change, `NO` otherwise.\n @param scrollPosition An option that specifies where the item should be positioned when scrolling finishes.\n */\n- (void)selectItemAtIndex:(NSInteger)index\n        sectionController:(IGListSectionController *)sectionController\n                 animated:(BOOL)animated\n           scrollPosition:(UICollectionViewScrollPosition)scrollPosition;\n\n/**\n Dequeues a cell from the collection view reuse pool.\n\n @param cellClass The class of the cell you want to dequeue.\n @param reuseIdentifier A reuse identifier for the specified cell. This parameter may be `nil`.\n @param sectionController The section controller requesting this information.\n @param index The index of the cell.\n\n @return A cell dequeued from the reuse pool or a newly created one.\n\n @note This method uses a string representation of the cell class as the identifier.\n */\n- (__kindof UICollectionViewCell *)dequeueReusableCellOfClass:(Class)cellClass\n                                          withReuseIdentifier:(nullable NSString *)reuseIdentifier\n                                         forSectionController:(IGListSectionController *)sectionController\n                                                      atIndex:(NSInteger)index;\n\n/**\n Dequeues a cell from the collection view reuse pool.\n\n @param cellClass The class of the cell you want to dequeue.\n @param sectionController The section controller requesting this information.\n @param index The index of the cell.\n\n @return A cell dequeued from the reuse pool or a newly created one.\n\n @note This method uses a string representation of the cell class as the identifier.\n */\n- (__kindof UICollectionViewCell *)dequeueReusableCellOfClass:(Class)cellClass\n                                         forSectionController:(IGListSectionController *)sectionController\n                                                      atIndex:(NSInteger)index;\n\n/**\n Dequeues a cell from the collection view reuse pool.\n\n @param nibName The name of the nib file.\n @param bundle The bundle in which to search for the nib file. If `nil`, this method searches the main bundle.\n @param sectionController The section controller requesting this information.\n @param index The index of the cell.\n\n @return A cell dequeued from the reuse pool or a newly created one.\n\n @note This method uses a string representation of the cell class as the identifier.\n */\n- (__kindof UICollectionViewCell *)dequeueReusableCellWithNibName:(NSString *)nibName\n                                                           bundle:(nullable NSBundle *)bundle\n                                             forSectionController:(IGListSectionController *)sectionController\n                                                          atIndex:(NSInteger)index;\n\n/**\n Dequeues a storyboard prototype cell from the collection view reuse pool.\n\n @param identifier The identifier of the cell prototype in storyboard.\n @param sectionController The section controller requesting this information.\n @param index The index of the cell.\n\n @return A cell dequeued from the reuse pool or a newly created one.\n */\n- (__kindof UICollectionViewCell *)dequeueReusableCellFromStoryboardWithIdentifier:(NSString *)identifier\n                                                              forSectionController:(IGListSectionController *)sectionController\n                                                                           atIndex:(NSInteger)index;\n\n/**\n Dequeues a supplementary view from the collection view reuse pool.\n\n @param elementKind The kind of supplementary view.\n @param sectionController The section controller requesting this information.\n @param viewClass The class of the supplementary view.\n @param index The index of the supplementary view.\n\n @return A supplementary view dequeued from the reuse pool or a newly created one.\n\n @note This method uses a string representation of the view class as the identifier.\n */\n- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind\n                                                         forSectionController:(IGListSectionController *)sectionController\n                                                                        class:(Class)viewClass\n                                                                      atIndex:(NSInteger)index;\n\n/**\n Dequeues a supplementary view from the collection view reuse pool.\n\n @param elementKind The kind of supplementary view.\n @param identifier The identifier of the supplementary view in storyboard.\n @param sectionController The section controller requesting this information.\n @param index The index of the supplementary view.\n\n @return A supplementary view dequeued from the reuse pool or a newly created one.\n */\n- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewFromStoryboardOfKind:(NSString *)elementKind\n                                                                             withIdentifier:(NSString *)identifier\n                                                                       forSectionController:(IGListSectionController *)sectionController\n                                                                                    atIndex:(NSInteger)index;\n/**\n Dequeues a supplementary view from the collection view reuse pool.\n\n @param elementKind The kind of supplementary view.\n @param sectionController The section controller requesting this information.\n @param nibName The name of the nib file.\n @param bundle The bundle in which to search for the nib file. If `nil`, this method searches the main bundle.\n @param index The index of the supplementary view.\n\n @return A supplementary view dequeued from the reuse pool or a newly created one.\n\n @note This method uses a string representation of the view class as the identifier.\n */\n- (__kindof UICollectionReusableView *)dequeueReusableSupplementaryViewOfKind:(NSString *)elementKind\n                                                         forSectionController:(IGListSectionController *)sectionController\n                                                                      nibName:(NSString *)nibName\n                                                                       bundle:(nullable NSBundle *)bundle\n                                                                      atIndex:(NSInteger)index;\n\n/**\n Invalidate the backing `UICollectionViewLayout` for all items in the section controller.\n\n @param sectionController The section controller that needs invalidating.\n @param completion An optional completion block to execute when the updates are finished.\n\n @note This method can be wrapped in `UIView\u0010` animation APIs to control the duration or perform without animations. This\n will end up calling `-[UICollectionView performBatchUpdates:completion:]` internally, so invalidated changes may not be\n reflected in the cells immediately.\n */\n- (void)invalidateLayoutForSectionController:(IGListSectionController *)sectionController\n                                  completion:(nullable void (^)(BOOL finished))completion;\n\n/**\n Batches and performs many cell-level updates in a single transaction.\n\n @param animated A flag indicating if the transition should be animated.\n @param updates A block with a context parameter to make mutations.\n @param completion An optional completion block to execute when the updates are finished.\n\n @note You should make state changes that impact the number of items in your section controller within the updates\n block alongside changes on the context object.\n\n For example, inside your section controllers, you may want to delete *and* insert into the data source that backs your\n section controller. For example:\n\n ```\n [self.collectionContext performBatchItemUpdates:^ (id<IGListBatchContext> batchContext>){\n   // perform data source changes inside the update block\n   [self.items addObject:newItem];\n   [self.items removeObjectAtIndex:0];\n\n   NSIndexSet *inserts = [NSIndexSet indexSetWithIndex:[self.items count] - 1];\n   [batchContext insertInSectionController:self atIndexes:inserts];\n\n   NSIndexSet *deletes = [NSIndexSet indexSetWithIndex:0];\n   [batchContext deleteInSectionController:self atIndexes:deletes];\n } completion:nil];\n ```\n\n @warning You **must** perform data modifications **inside** the update block. Updates will not be performed\n synchronously, so you should make sure that your data source changes only when necessary.\n */\n- (void)performBatchAnimated:(BOOL)animated\n                     updates:(void (^)(id<IGListBatchContext> batchContext))updates\n                  completion:(nullable void (^)(BOOL finished))completion;\n\n\n/**\n Scrolls to the specified section controller in the list.\n\n @param sectionController The section controller.\n @param index The index of the item in the section controller to which to scroll.\n @param scrollPosition An option that specifies where the item should be positioned when scrolling finishes.\n @param animated A flag indicating if the scrolling should be animated.\n */\n- (void)scrollToSectionController:(IGListSectionController *)sectionController\n                          atIndex:(NSInteger)index\n                   scrollPosition:(UICollectionViewScrollPosition)scrollPosition\n                         animated:(BOOL)animated;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionScrollingTraits.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n/**\n The current scrolling traits of the underlying collection view.\n The attributes are always equal to their corresponding properties on the underlying collection view.\n */\nNS_SWIFT_NAME(ListCollectionScrollingTraits)\ntypedef struct IGListCollectionScrollingTraits {\n    /// returns YES if user has touched. may not yet have started dragging.\n    bool isTracking;\n    /// returns YES if user has started scrolling. this may require some time and or distance to move to initiate dragging\n    bool isDragging;\n    /// returns YES if user isn't dragging (touch up) but scroll view is still moving.\n    bool isDecelerating;\n} IGListCollectionScrollingTraits;\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionView.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@protocol IGListCollectionViewLayoutCompatible;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n This `UICollectionView` subclass allows for partial layout invalidation using `IGListCollectionViewLayout`,\n or custom layout classes that conform to IGListCollectionViewLayoutCompatible.\n\n @note When updating a collection view (ex: calling `-insertSections`), `-invalidateLayoutWithContext` gets called on\n the layout object. However, the invalidation context doesn't provide details on which index paths are being modified,\n which typically forces a full layout re-calculation. `IGListCollectionView` gives `IGListCollectionViewLayout` the\n missing information to re-calculate only the modified layout attributes.\n */\nNS_SWIFT_NAME(ListCollectionView)\n@interface IGListCollectionView : UICollectionView\n\n/**\n Create a new view with an `IGListcollectionViewLayout` class or subclass.\n\n @param frame The frame to initialize with.\n @param collectionViewLayout The layout to use with the collection view. You can use IGListCollectionViewLayout\n here, or a custom layout class that conforms to IGListCollectionViewLayoutCompatible.\n\n @note You can initialize a new view with a base layout by simply calling `-[IGListCollectionView initWithFrame:]`.\n */\n- (instancetype)initWithFrame:(CGRect)frame listCollectionViewLayout:(UICollectionViewLayout<IGListCollectionViewLayoutCompatible> *)collectionViewLayout NS_DESIGNATED_INITIALIZER;\n\n/**\n :nodoc:\n */\n- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)collectionViewLayout NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionView.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListCollectionView.h\"\n\n#import \"IGListCollectionViewLayout.h\"\n#import \"IGListCollectionViewLayoutCompatible.h\"\n\n@implementation IGListCollectionView\n\n#pragma mark - Init\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    IGListCollectionViewLayout *layout = [[IGListCollectionViewLayout alloc] initWithStickyHeaders:NO topContentInset:0 stretchToEdge:YES];\n    return [self initWithFrame:frame listCollectionViewLayout:layout];\n}\n\n- (instancetype)initWithFrame:(CGRect)frame listCollectionViewLayout:(UICollectionViewLayout<IGListCollectionViewLayoutCompatible> *)collectionViewLayout {\n    return [super initWithFrame:frame collectionViewLayout:collectionViewLayout];\n}\n\n#pragma mark - IGListCollectionViewLayout\n\n- (UICollectionViewLayout<IGListCollectionViewLayoutCompatible> *)_listLayout {\n    if ([self.collectionViewLayout conformsToProtocol:@protocol(IGListCollectionViewLayoutCompatible)]) {\n        return (UICollectionViewLayout<IGListCollectionViewLayoutCompatible> *)self.collectionViewLayout;\n    }\n\n    return nil;\n}\n\n#pragma mark - Overides reloads\n\n- (void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths {\n    [self _didModifyIndexPaths:indexPaths];\n    [super reloadItemsAtIndexPaths:indexPaths];\n}\n\n- (void)reloadSections:(NSIndexSet *)sections {\n    [self _didModifySections:sections];\n    [super reloadSections:sections];\n}\n\n#pragma mark - Override deletes\n\n- (void)deleteItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths {\n    [self _didModifyIndexPaths:indexPaths];\n    [super deleteItemsAtIndexPaths:indexPaths];\n}\n\n- (void)deleteSections:(NSIndexSet *)sections {\n    [self _didModifySections:sections];\n    [super deleteSections:sections];\n}\n\n#pragma mark - Override inserts\n\n- (void)insertItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths {\n    [self _didModifyIndexPaths:indexPaths];\n    [super insertItemsAtIndexPaths:indexPaths];\n}\n\n- (void)insertSections:(NSIndexSet *)sections {\n    [self _didModifySections:sections];\n    [super insertSections:sections];\n}\n\n#pragma mark - Override moves\n\n- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath {\n    [self _didModifyIndexPaths:@[indexPath, newIndexPath]];\n    [super moveItemAtIndexPath:indexPath toIndexPath:newIndexPath];\n}\n\n- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection {\n    [self _didModifySection:MIN(section, newSection)];\n    [super moveSection:section toSection:newSection];\n}\n\n#pragma mark - Modify section\n\n- (void)_didModifySections:(NSIndexSet *)sections {\n    if (sections.count == 0) {\n        return;\n    }\n    [self _didModifySection:sections.firstIndex];\n}\n\n- (void)_didModifySection:(NSUInteger)section {\n    [self._listLayout didModifySection:section];\n}\n\n#pragma mark - Modified index path\n\n- (void)_didModifyIndexPaths:(NSArray<NSIndexPath *> *)indexPaths {\n    for (NSIndexPath *indexPath in indexPaths) {\n        [self _didModifySection:indexPath.section];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionViewDelegateLayout.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n/**\n Conform to `IGListCollectionViewDelegateLayout` to provide customized layout information for a collection view.\n */\n@protocol IGListCollectionViewDelegateLayout <UICollectionViewDelegateFlowLayout>\n\n/**\n Asks the delegate to customize and return the starting layout information for an item being inserted into the collection view.\n\n @param collectionView The collection view to perform the transition on.\n @param collectionViewLayout The layout to use with the collection view.\n @param attributes The starting layout information for an item being inserted into the collection view.\n @param indexPath The index path of the item being inserted.\n */\n- (UICollectionViewLayoutAttributes *)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout customizedInitialLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes atIndexPath:(NSIndexPath *)indexPath;\n\n/**\n Asks the delegate to customize and return the final layout information for an item that is about to be removed from the collection view.\n\n @param collectionView The collection view to perform the transition on.\n @param collectionViewLayout The layout to use with the collection view.\n @param attributes The final layout information for an item that is about to be removed from the collection view.\n @param indexPath The index path of the item being deleted.\n */\n- (UICollectionViewLayoutAttributes *)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout customizedFinalLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes atIndexPath:(NSIndexPath *)indexPath;\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionViewLayout.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListExperiments.h>\n#import <IGListDiffKit/IGListMacros.h>\n\n#import \"IGListCollectionViewLayoutCompatible.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n This UICollectionViewLayout subclass is for vertically or horizontally scrolling lists of data with variable widths and\n heights. It supports an infinite number of sections and items. All work is done on the main thread, and while extremely efficient,\n care must be taken not to stall the main thread in sizing delegate methods.\n\n This layout piggybacks on the mechanics of UICollectionViewFlowLayout in that:\n\n - Your UICollectionView data source must also conform to UICollectionViewDelegateFlowLayout\n - Header support given via UICollectionElementKindSectionHeader\n\n All UICollectionViewDelegateFlowLayout methods are required and used by this layout:\n\n ```\n - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;\n - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section;\n - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section;\n - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section;\n - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;\n ```\n\n In a vertically scrolling layout, sections and items are put into the same horizontal row until the max-x position\n of an item extends beyond the width of the collection view. When that happens, the item is \"newlined\" to the next row.\n The y position of that row is determined by the maximum height (including section insets) of the section/item of the previous row.\n\n Ex. of a section (2,0) with a large width causing a newline.\n ```\n |[ 0,0 ][ 1,0 ]         |\n |[         2,0         ]|\n ```\n\n A section with a non-zero height header will always cause that section to newline. Headers are always stretched to the\n width of the collection view, pinched with the section insets.\n\n Ex. of a section (2,0) with a header inset on the left/right.\n ```\n |[ 0,0 ][ 1,0 ]         |\n | >======header=======< |\n | [ 2,0 ]               |\n ```\n\n Section insets apply to items in the section no matter if they begin on a new row or are on the same row as a previous\n section.\n\n Ex. of a section (2) with multiple items and a left inset.\n ```\n |[ 0,0 ][ 1,0 ] >[ 2,0 ]|\n | >[ 2,1 ][ 2,2 ][ 2,3 ]|\n ```\n\n Interitem spacing applies to items and sections within the same row. Line spacing only applies to items within the same\n section.\n \n In a horizontally scrolling layout, sections and items are flowed vertically until they need to be \"newlined\" to the \n next column. Headers, if used, are stretched to the height of the collection view, minus the section insets.\n\n Please see the unit tests for more configuration examples and expected output.\n */\nNS_SWIFT_NAME(ListCollectionViewLayout)\n@interface IGListCollectionViewLayout : UICollectionViewLayout <IGListCollectionViewLayoutCompatible>\n\n/**\n Direction in which layout will be scrollable; items will be flowed in the perpendicular direction, \"newlining\" when they\n run out of space along that axis or when a non-zero header is found.\n */\n@property (nonatomic, readonly) UICollectionViewScrollDirection scrollDirection;\n\n/**\n Set this to adjust the offset of the sticky headers in the scrolling direction. Can be used to change the sticky \n header position as UI like the navigation bar is scrolled offscreen. In a vertically scrolling layout, changing \n this to the height of the navigation bar will give the effect of the headers sticking to the nav as it is collapsed.\n\n @note Changing the value on this method will invalidate the layout every time.\n */\n@property (nonatomic, assign) CGFloat stickyHeaderYOffset;\n\n/**\n Set this to `YES` to show sticky header when a section had no item. Default is `NO`.\n*/\n@property (nonatomic, assign) BOOL showHeaderWhenEmpty;\n\n/**\n A bitmask of experiments to conduct on the adapter.\n */\n@property (nonatomic, assign) IGListExperiment experiments;\n\n/**\n Create and return a new collection view layout.\n\n @param stickyHeaders Set to `YES` to stick section headers to the top of the bounds while scrolling.\n @param scrollDirection Direction along which the collection view will be scrollable (if content size exceeds the frame size)\n @param topContentInset The content inset (top or left, depending on scrolling direction) used to offset the sticky headers. Ignored if stickyHeaders is `NO`.\n @param stretchToEdge Specifies whether to stretch width (in vertically scrolling layout) or height (horizontally scrolling) of last item to right/bottom edge when distance from last item to right/bottom edge < epsilon(1)\n\n @return A new collection view layout.\n */\n- (instancetype)initWithStickyHeaders:(BOOL)stickyHeaders\n                      scrollDirection:(UICollectionViewScrollDirection)scrollDirection\n                      topContentInset:(CGFloat)topContentInset\n                        stretchToEdge:(BOOL)stretchToEdge NS_DESIGNATED_INITIALIZER;\n\n/**\n Create and return a new vertically scrolling collection view layout.\n \n @param stickyHeaders Set to `YES` to stick section headers to the top of the bounds while scrolling.\n @param topContentInset The top content inset used to offset the sticky headers. Ignored if stickyHeaders is `NO`.\n @param stretchToEdge Specifies whether to stretch width of last item to right edge when distance from last item to right edge < epsilon(1)\n \n @return A new collection view layout.\n */\n- (instancetype)initWithStickyHeaders:(BOOL)stickyHeaders\n                      topContentInset:(CGFloat)topContentInset\n                        stretchToEdge:(BOOL)stretchToEdge;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionViewLayout.mm",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListCollectionViewLayout.h\"\n#import \"IGListCollectionViewLayoutInternal.h\"\n\n#import <vector>\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListKit/IGListCollectionViewDelegateLayout.h>\n\n#import \"UIScrollView+IGListKit.h\"\n\nstatic CGFloat UIEdgeInsetsLeadingInsetInDirection(UIEdgeInsets insets, UICollectionViewScrollDirection direction) {\n    switch (direction) {\n        case UICollectionViewScrollDirectionVertical: return insets.top;\n        case UICollectionViewScrollDirectionHorizontal: return insets.left;\n    }\n}\n\nstatic CGFloat UIEdgeInsetsTrailingInsetInDirection(UIEdgeInsets insets, UICollectionViewScrollDirection direction) {\n    switch (direction) {\n        case UICollectionViewScrollDirectionVertical: return insets.bottom;\n        case UICollectionViewScrollDirectionHorizontal: return insets.right;\n    }\n}\n\nstatic CGFloat CGPointGetCoordinateInDirection(CGPoint point, UICollectionViewScrollDirection direction) {\n    switch (direction) {\n        case UICollectionViewScrollDirectionVertical: return point.y;\n        case UICollectionViewScrollDirectionHorizontal: return point.x;\n    }\n}\n\nstatic CGFloat CGRectGetLengthInDirection(CGRect rect, UICollectionViewScrollDirection direction) {\n    switch (direction) {\n        case UICollectionViewScrollDirectionVertical: return rect.size.height;\n        case UICollectionViewScrollDirectionHorizontal: return rect.size.width;\n    }\n}\n\nstatic CGFloat CGRectGetMaxInDirection(CGRect rect, UICollectionViewScrollDirection direction) {\n    switch (direction) {\n        case UICollectionViewScrollDirectionVertical: return CGRectGetMaxY(rect);\n        case UICollectionViewScrollDirectionHorizontal: return CGRectGetMaxX(rect);\n    }\n}\n\nstatic CGFloat CGRectGetMinInDirection(CGRect rect, UICollectionViewScrollDirection direction) {\n    switch (direction) {\n        case UICollectionViewScrollDirectionVertical: return CGRectGetMinY(rect);\n        case UICollectionViewScrollDirectionHorizontal: return CGRectGetMinX(rect);\n    }\n}\n\nstatic CGFloat CGSizeGetLengthInDirection(CGSize size, UICollectionViewScrollDirection direction) {\n    switch (direction) {\n        case UICollectionViewScrollDirectionVertical: return size.height;\n        case UICollectionViewScrollDirectionHorizontal: return size.width;\n    }\n}\n\nstatic NSIndexPath *indexPathForSection(NSInteger section) {\n    return [NSIndexPath indexPathForItem:0 inSection:section];\n}\n\nstatic NSInteger IGListMergeMinimumInvalidatedSection(NSInteger section, NSInteger otherSection) {\n    if (section == NSNotFound && otherSection == NSNotFound) {\n        return NSNotFound;\n    } else if (section == NSNotFound) {\n        return otherSection;\n    } else if (otherSection == NSNotFound) {\n        return section;\n    }\n    \n    return MIN(section, otherSection);\n}\n\nstruct IGListSectionEntry {\n    /**\n     Represents the minimum-bounding box of every element in the section. This includes all item frames as well as the\n     header bounds. It is made simply by unioning all item and header frames. Use this to find section intersections\n     to build layout attributes given a rect.\n     */\n    CGRect bounds;\n    \n    // The insets for the section. Used to find total content size of the section.\n    UIEdgeInsets insets;\n    \n    // The RESTING frame of the header view (e.g. when the header is not sticking to the top of the scroll view).\n    CGRect headerBounds;\n    \n    // The RESTING frame of the footer view\n    CGRect footerBounds;\n    \n    // An array of frames for each cell in the section.\n    std::vector<CGRect> itemBounds;\n    \n    // last item distance in scroll direction, used for partial invalidation\n    CGFloat lastItemCoordInScrollDirection;\n    \n    // last item distance in fixed direction, used for partial invalidation\n    CGFloat lastItemCoordInFixedDirection;\n    \n    // last next row distance in scroll direction, used for partial invalidation\n    CGFloat lastNextRowCoordInScrollDirection;\n    \n    // Returns YES when the section has visible content (header and/or items).\n    BOOL isValid() {\n        return !CGSizeEqualToSize(bounds.size, CGSizeZero);\n    }\n};\n\n// Each section has a base zIndex of section * maxZIndexPerSection;\n// section header adds (maxZIndexPerSection - 1) to the base zIndex;\n// other cells adds (item) to the base zIndex.\n// This allows us to present tooltips that can grow from the cell to its top.\nstatic void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attributes) {\n    const NSInteger maxZIndexPerSection = 1000;\n    const NSInteger baseZIndex = attributes.indexPath.section * maxZIndexPerSection;\n    \n    switch (attributes.representedElementCategory) {\n        case UICollectionElementCategoryCell:\n            attributes.zIndex = baseZIndex + attributes.indexPath.item;\n            break;\n        case UICollectionElementCategorySupplementaryView:\n            attributes.zIndex = baseZIndex + maxZIndexPerSection - 1;\n            break;\n        case UICollectionElementCategoryDecorationView:\n            attributes.zIndex = baseZIndex - 1;\n            break;\n    }\n}\n\n@interface IGListCollectionViewLayoutInvalidationContext : UICollectionViewLayoutInvalidationContext\n@property (nonatomic, assign) BOOL ig_invalidateSupplementaryAttributes;\n@property (nonatomic, assign) BOOL ig_invalidateAllAttributes;\n@end\n\n@implementation IGListCollectionViewLayoutInvalidationContext\n@end\n\n@interface IGListCollectionViewLayout ()\n\n@property (nonatomic, assign, readonly) BOOL stickyHeaders;\n@property (nonatomic, assign, readonly) CGFloat topContentInset;\n@property (nonatomic, assign, readonly) BOOL stretchToEdge;\n\n@end\n\n@implementation IGListCollectionViewLayout {\n    std::vector<IGListSectionEntry> _sectionData;\n    NSMutableDictionary<NSIndexPath *, UICollectionViewLayoutAttributes *> *_attributesCache;\n    \n    // invalidate starting at this section\n    NSInteger _minimumInvalidatedSection;\n    \n    /**\n     The workflow for getting sticky headers working:\n     1. Use a custom invalidation context to mark supplementary attributes invalid.\n     2. Return YES from -shouldInvalidateLayoutForBoundsChange:\n     3. In -invalidationContextForBoundsChange: mark supplementary attributes invalid on the custom context.\n     4. Purge supplementary caches in -invalidateLayoutWithContext: if context says they are invalid\n     5. Use cached attributes in -layoutAttributesForSupplementaryViewOfKind:atIndexPath: if they exist, else rebuild\n     6. Make sure -layoutAttributesForElementsInRect: always uses the attributes returned from\n     -layoutAttributesForSupplementaryViewOfKind:atIndexPath:.\n     */\n    NSMutableDictionary<NSString *, NSMutableDictionary <NSIndexPath *, UICollectionViewLayoutAttributes *> *> *_supplementaryAttributesCache;\n}\n\n- (instancetype)initWithStickyHeaders:(BOOL)stickyHeaders\n                      topContentInset:(CGFloat)topContentInset\n                        stretchToEdge:(BOOL)stretchToEdge {\n    return [self initWithStickyHeaders:stickyHeaders\n                       scrollDirection:UICollectionViewScrollDirectionVertical\n                       topContentInset:topContentInset\n                         stretchToEdge:stretchToEdge];\n}\n\n- (instancetype)initWithStickyHeaders:(BOOL)stickyHeaders\n                      scrollDirection:(UICollectionViewScrollDirection)scrollDirection\n                      topContentInset:(CGFloat)topContentInset\n                        stretchToEdge:(BOOL)stretchToEdge {\n    if (self = [super init]) {\n        _scrollDirection = scrollDirection;\n        _stickyHeaders = stickyHeaders;\n        _topContentInset = topContentInset;\n        _stretchToEdge = stretchToEdge;\n        _attributesCache = [NSMutableDictionary new];\n        _supplementaryAttributesCache = [NSMutableDictionary dictionaryWithDictionary:@{\n                                                                                        UICollectionElementKindSectionHeader: [NSMutableDictionary new],\n                                                                                        UICollectionElementKindSectionFooter: [NSMutableDictionary new],\n                                                                                        }];\n        _minimumInvalidatedSection = NSNotFound;\n    }\n    return self;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    return [self initWithStickyHeaders:NO topContentInset:0 stretchToEdge:NO];\n}\n\n#pragma mark - UICollectionViewLayout\n\n- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath {\n    UICollectionViewLayoutAttributes *attributes = [super initialLayoutAttributesForAppearingItemAtIndexPath:itemIndexPath];\n    id<IGListCollectionViewDelegateLayout> delegate = (id<IGListCollectionViewDelegateLayout>)self.collectionView.delegate;\n    if ([delegate respondsToSelector:@selector(collectionView:layout:customizedInitialLayoutAttributes:atIndexPath:)]) {\n        return [delegate collectionView:self.collectionView\n                                 layout:self\n      customizedInitialLayoutAttributes:attributes\n                            atIndexPath:itemIndexPath];\n    }\n    return attributes;\n}\n\n- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAtIndexPath:(NSIndexPath *)itemIndexPath{\n    UICollectionViewLayoutAttributes *attributes = [super finalLayoutAttributesForDisappearingItemAtIndexPath:itemIndexPath];\n    id<IGListCollectionViewDelegateLayout> delegate = (id<IGListCollectionViewDelegateLayout>)self.collectionView.delegate;\n    if ([delegate respondsToSelector:@selector(collectionView:layout:customizedFinalLayoutAttributes:atIndexPath:)]) {\n        return [delegate collectionView:self.collectionView\n                                 layout:self\n        customizedFinalLayoutAttributes:attributes\n                            atIndexPath:itemIndexPath];\n    }\n    return attributes;\n}\n\n- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {\n    IGAssertMainThread();\n    \n    NSMutableArray *result = [NSMutableArray new];\n    \n    const NSRange range = [self _rangeOfSectionsInRect:rect];\n    if (range.location == NSNotFound) {\n        return nil;\n    }\n    \n    for (NSInteger section = range.location; section < NSMaxRange(range); section++) {\n        const NSInteger itemCount = _sectionData[section].itemBounds.size();\n        \n        // do not add headers if there are no items\n        if (itemCount > 0 || self.showHeaderWhenEmpty) {\n            for (NSString *elementKind in _supplementaryAttributesCache.allKeys) {\n                NSIndexPath *indexPath = indexPathForSection(section);\n                UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForSupplementaryViewOfKind:elementKind\n                                                                                                    atIndexPath:indexPath];\n                // do not add zero height headers/footers or headers/footers that are outside the rect\n                const CGRect frame = attributes.frame;\n                const CGRect intersection = CGRectIntersection(frame, rect);\n                if (attributes && !CGRectIsEmpty(intersection) && CGRectGetLengthInDirection(frame, self.scrollDirection) > 0.0) {\n                    [result addObject:attributes];\n                }\n            }\n        }\n        \n        // add all cells within the rect, return early if it starts iterating outside\n        for (NSInteger item = 0; item < itemCount; item++) {\n            NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];\n            UICollectionViewLayoutAttributes *attributes = [self layoutAttributesForItemAtIndexPath:indexPath];\n            if (CGRectIntersectsRect(attributes.frame, rect)) {\n                [result addObject:attributes];\n            }\n        }\n    }\n    \n    return result;\n}\n\n- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {\n    IGAssertMainThread();\n    IGParameterAssert(indexPath != nil);\n    \n    UICollectionViewLayoutAttributes *attributes = _attributesCache[indexPath];\n    if (attributes != nil) {\n        return attributes;\n    }\n    \n    // avoid OOB errors\n    const NSInteger section = indexPath.section;\n    const NSInteger item = indexPath.item;\n    if (section >= _sectionData.size()\n        || item >= _sectionData[section].itemBounds.size()) {\n        return nil;\n    }\n    \n    attributes = [[[self class] layoutAttributesClass] layoutAttributesForCellWithIndexPath:indexPath];\n    attributes.frame = _sectionData[indexPath.section].itemBounds[indexPath.item];\n    adjustZIndexForAttributes(attributes);\n    _attributesCache[indexPath] = attributes;\n    return attributes;\n}\n\n- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath {\n    IGAssertMainThread();\n    IGParameterAssert(indexPath != nil);\n    \n    UICollectionViewLayoutAttributes *attributes = _supplementaryAttributesCache[elementKind][indexPath];\n    if (attributes != nil) {\n        return attributes;\n    }\n    \n    // avoid OOB errors\n    const NSInteger section = indexPath.section;\n    if (section >= _sectionData.size()) {\n        return nil;\n    }\n    \n    UICollectionView *collectionView = self.collectionView;\n    const IGListSectionEntry entry = _sectionData[section];\n    const CGFloat minOffset = CGRectGetMinInDirection(entry.bounds, self.scrollDirection);\n    \n    CGRect frame = CGRectZero;\n    \n    if ([elementKind isEqualToString:UICollectionElementKindSectionHeader]) {\n        frame = entry.headerBounds;\n        \n        if (self.stickyHeaders) {\n            CGFloat offset = CGPointGetCoordinateInDirection(collectionView.contentOffset, self.scrollDirection) + self.topContentInset + self.stickyHeaderYOffset;\n            \n            if (section + 1 == _sectionData.size()) {\n                offset = MAX(minOffset, offset);\n            } else {\n                const CGFloat maxOffset = CGRectGetMinInDirection(_sectionData[section + 1].bounds, self.scrollDirection) - CGRectGetLengthInDirection(frame, self.scrollDirection);\n                offset = MIN(MAX(minOffset, offset), maxOffset);\n            }\n            switch (self.scrollDirection) {\n                case UICollectionViewScrollDirectionVertical:\n                    frame.origin.y = offset;\n                    break;\n                case UICollectionViewScrollDirectionHorizontal:\n                    frame.origin.x = offset;\n                    break;\n            }\n        }\n    } else if ([elementKind isEqualToString:UICollectionElementKindSectionFooter]) {\n        frame = entry.footerBounds;\n    }\n\n    if (CGRectIsEmpty(frame)) {\n        // Just like UICollectionViewFlowLayout, if the header/footer size is empty, do not not return an attribute.\n        // If we did return something, calling [UICollectionView layoutAttributesForSupplementaryElementOfKind...] would too,\n        // which could then crash if the UICollectionViewDelegate is not expecting to actually return a supplimentary view.\n        return nil;\n    } else {\n        attributes = [UICollectionViewLayoutAttributes layoutAttributesForSupplementaryViewOfKind:elementKind withIndexPath:indexPath];\n        attributes.frame = frame;\n        adjustZIndexForAttributes(attributes);\n        _supplementaryAttributesCache[elementKind][indexPath] = attributes;\n        return attributes;\n    }\n}\n\n- (CGSize)collectionViewContentSize {\n    IGAssertMainThread();\n    \n    const NSInteger sectionCount = _sectionData.size();\n    \n    if (sectionCount == 0) {\n        return CGSizeZero;\n    }\n    \n    const IGListSectionEntry section = _sectionData[sectionCount - 1];\n    UICollectionView *collectionView = self.collectionView;\n    const UIEdgeInsets contentInset = collectionView.ig_contentInset;\n    switch (self.scrollDirection) {\n        case UICollectionViewScrollDirectionVertical: {\n            const CGFloat height = CGRectGetMaxY(section.bounds) + section.insets.bottom;\n            return CGSizeMake(CGRectGetWidth(collectionView.bounds) - contentInset.left - contentInset.right, height);\n        }\n        case UICollectionViewScrollDirectionHorizontal: {\n            const CGFloat width = CGRectGetMaxX(section.bounds) + section.insets.right;\n            return CGSizeMake(width, CGRectGetHeight(collectionView.bounds) - contentInset.top - contentInset.bottom);\n        }\n    }\n    \n}\n\n- (void)invalidateLayoutWithContext:(IGListCollectionViewLayoutInvalidationContext *)context {\n    BOOL hasInvalidatedItemIndexPaths = NO;\n    if ([context respondsToSelector:@selector(invalidatedItemIndexPaths)]) {\n        hasInvalidatedItemIndexPaths = [context invalidatedItemIndexPaths].count > 0;\n    }\n    \n    if (hasInvalidatedItemIndexPaths\n        || [context invalidateEverything]\n        || context.ig_invalidateAllAttributes) {\n        // invalidates all\n        _minimumInvalidatedSection = 0;\n    } else if ([context invalidateDataSourceCounts] && _minimumInvalidatedSection == NSNotFound) {\n        // invalidate all if count changed and we don't have information on the minimum invalidated section\n        _minimumInvalidatedSection = 0;\n    }\n    \n    if (context.ig_invalidateSupplementaryAttributes) {\n        [self _resetSupplementaryAttributesCache];\n    }\n    \n    [super invalidateLayoutWithContext:context];\n}\n\n+ (Class)invalidationContextClass {\n    return [IGListCollectionViewLayoutInvalidationContext class];\n}\n\n- (UICollectionViewLayoutInvalidationContext *)invalidationContextForBoundsChange:(CGRect)newBounds {\n    const CGRect oldBounds = self.collectionView.bounds;\n    \n    IGListCollectionViewLayoutInvalidationContext *context =\n    (IGListCollectionViewLayoutInvalidationContext *)[super invalidationContextForBoundsChange:newBounds];\n    context.ig_invalidateSupplementaryAttributes = YES;\n    if (!CGSizeEqualToSize(oldBounds.size, newBounds.size)) {\n        context.ig_invalidateAllAttributes = YES;\n    }\n    return context;\n}\n\n- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {\n    const CGRect oldBounds = self.collectionView.bounds;\n    \n    // always invalidate for size changes\n    if (!CGSizeEqualToSize(oldBounds.size, newBounds.size)) {\n        return YES;\n    }\n    \n    // if the y origin has changed, only invalidate when using sticky headers\n    if (CGRectGetMinInDirection(newBounds, self.scrollDirection) != CGRectGetMinInDirection(oldBounds, self.scrollDirection)) {\n        return self.stickyHeaders;\n    }\n    \n    return NO;\n}\n\n- (void)prepareLayout {\n    [self _calculateLayoutIfNeeded];\n}\n\n#pragma mark - Public API\n\n- (void)setStickyHeaderYOffset:(CGFloat)stickyHeaderYOffset {\n    IGAssertMainThread();\n    \n    if (_stickyHeaderYOffset != stickyHeaderYOffset) {\n        _stickyHeaderYOffset = stickyHeaderYOffset;\n        \n        IGListCollectionViewLayoutInvalidationContext *invalidationContext = [IGListCollectionViewLayoutInvalidationContext new];\n        invalidationContext.ig_invalidateSupplementaryAttributes = YES;\n        [self invalidateLayoutWithContext:invalidationContext];\n    }\n}\n\n#pragma mark - Private API\n\n- (void)_calculateLayoutIfNeeded {\n    if (_minimumInvalidatedSection == NSNotFound) {\n        return;\n    }\n    \n    // purge attribute caches so they are rebuilt\n    [_attributesCache removeAllObjects];\n    [self _resetSupplementaryAttributesCache];\n    \n    UICollectionView *collectionView = self.collectionView;\n    id<UICollectionViewDataSource> dataSource = collectionView.dataSource;\n    id<UICollectionViewDelegateFlowLayout> delegate = (id<UICollectionViewDelegateFlowLayout>)collectionView.delegate;\n    \n    const NSInteger sectionCount = (IGListExperimentEnabled(_experiments, IGListExperimentUseCollectionViewInsteadOfDataSourceInLayout)\n                                    ? [collectionView numberOfSections]\n                                    : [dataSource numberOfSectionsInCollectionView:collectionView]);\n    const UIEdgeInsets contentInset = collectionView.ig_contentInset;\n    const CGRect contentInsetAdjustedCollectionViewBounds = UIEdgeInsetsInsetRect(collectionView.bounds, contentInset);\n    \n    _sectionData.resize(sectionCount);\n    \n    CGFloat itemCoordInScrollDirection = 0.0;\n    CGFloat itemCoordInFixedDirection = 0.0;\n    CGFloat nextRowCoordInScrollDirection = 0.0;\n    \n    // union item frames and optionally the header to find a bounding box of the entire section\n    CGRect rollingSectionBounds = CGRectZero;\n    \n    // populate last valid section information\n    const NSInteger lastValidSection = _minimumInvalidatedSection - 1;\n    if (lastValidSection >= 0 && lastValidSection < sectionCount) {\n        itemCoordInScrollDirection = _sectionData[lastValidSection].lastItemCoordInScrollDirection;\n        itemCoordInFixedDirection = _sectionData[lastValidSection].lastItemCoordInFixedDirection;\n        nextRowCoordInScrollDirection = _sectionData[lastValidSection].lastNextRowCoordInScrollDirection;\n        rollingSectionBounds = _sectionData[lastValidSection].bounds;\n    }\n    \n    for (NSInteger section = _minimumInvalidatedSection; section < sectionCount; section++) {\n        const NSInteger itemCount = (IGListExperimentEnabled(_experiments, IGListExperimentUseCollectionViewInsteadOfDataSourceInLayout)\n                                     ? [collectionView numberOfItemsInSection:section]\n                                     : [dataSource collectionView:collectionView numberOfItemsInSection:section]);\n        const BOOL itemsEmpty = itemCount == 0;\n        const BOOL hideHeaderWhenItemsEmpty = itemsEmpty && !self.showHeaderWhenEmpty;\n        _sectionData[section].itemBounds = std::vector<CGRect>(itemCount);\n        \n        const CGSize headerSize = [delegate collectionView:collectionView layout:self referenceSizeForHeaderInSection:section];\n        const CGSize footerSize = [delegate collectionView:collectionView layout:self referenceSizeForFooterInSection:section];\n        const UIEdgeInsets insets = [delegate collectionView:collectionView layout:self insetForSectionAtIndex:section];\n        const CGFloat lineSpacing = [delegate collectionView:collectionView layout:self minimumLineSpacingForSectionAtIndex:section];\n        const CGFloat interitemSpacing = [delegate collectionView:collectionView layout:self minimumInteritemSpacingForSectionAtIndex:section];\n        \n        const CGSize paddedCollectionViewSize = UIEdgeInsetsInsetRect(contentInsetAdjustedCollectionViewBounds, insets).size;\n        const UICollectionViewScrollDirection fixedDirection = self.scrollDirection == UICollectionViewScrollDirectionHorizontal ? UICollectionViewScrollDirectionVertical : UICollectionViewScrollDirectionHorizontal;\n        const CGFloat paddedLengthInFixedDirection = CGSizeGetLengthInDirection(paddedCollectionViewSize, fixedDirection);\n        const CGFloat headerLengthInScrollDirection = hideHeaderWhenItemsEmpty ? 0 : CGSizeGetLengthInDirection(headerSize, self.scrollDirection);\n        const CGFloat footerLengthInScrollDirection = hideHeaderWhenItemsEmpty ? 0 : CGSizeGetLengthInDirection(footerSize, self.scrollDirection);\n        const BOOL headerExists = headerLengthInScrollDirection > 0;\n        const BOOL footerExists = footerLengthInScrollDirection > 0;\n        \n        // start the section accounting for the header size\n        // header length in scroll direction is subtracted from the sectionBounds when calculating the header bounds after items are done\n        // this bumps the first row of items over enough to make room for the header\n        itemCoordInScrollDirection += headerLengthInScrollDirection;\n        nextRowCoordInScrollDirection += headerLengthInScrollDirection;\n        \n        // add the leading inset in fixed direction in case the section falls on the same row as the previous\n        // if the section is newlined then the coord in fixed direction is reset\n        itemCoordInFixedDirection += UIEdgeInsetsLeadingInsetInDirection(insets, fixedDirection);\n        \n        // the farthest in the fixed direction the frame of an item in this section can go\n        const CGFloat maxCoordinateInFixedDirection = CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection) - UIEdgeInsetsTrailingInsetInDirection(insets, fixedDirection);\n        \n        for (NSInteger item = 0; item < itemCount; item++) {\n            NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];\n            const CGSize size = [delegate collectionView:collectionView layout:self sizeForItemAtIndexPath:indexPath];\n            \n            IGAssert(CGSizeGetLengthInDirection(size, fixedDirection) <= paddedLengthInFixedDirection\n                     || fabs(CGSizeGetLengthInDirection(size, fixedDirection) - paddedLengthInFixedDirection) < FLT_EPSILON,\n                     @\"%@ of item %li in section %li (%.0f pt) must be less than or equal to container (%.0f pt) accounting for section insets %@\",\n                     self.scrollDirection == UICollectionViewScrollDirectionVertical ? @\"Width\" : @\"Height\",\n                     (long)item,\n                     (long)section,\n                     CGSizeGetLengthInDirection(size, fixedDirection),\n                     CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection),\n                     NSStringFromUIEdgeInsets(insets));\n            \n            CGFloat itemLengthInFixedDirection = MIN(CGSizeGetLengthInDirection(size, fixedDirection), paddedLengthInFixedDirection);\n            \n            // if the origin and length in fixed direction of the item busts the size of the container\n            // or if this is the first item and the header has a non-zero size\n            // newline to the next row and reset\n            // define epsilon to avoid float overflow issue\n            const CGFloat epsilon = 1.0;\n            if (itemCoordInFixedDirection + itemLengthInFixedDirection > maxCoordinateInFixedDirection + epsilon\n                || (item == 0 && headerExists)) {\n                itemCoordInScrollDirection = nextRowCoordInScrollDirection;\n                itemCoordInFixedDirection = UIEdgeInsetsLeadingInsetInDirection(insets, fixedDirection);\n                \n                \n                // if newlining, always append line spacing unless its the very first item of the section\n                if (item > 0) {\n                    itemCoordInScrollDirection += lineSpacing;\n                }\n            }\n            \n            const CGFloat distanceToEdge = paddedLengthInFixedDirection - (itemCoordInFixedDirection + itemLengthInFixedDirection);\n            if (self.stretchToEdge && distanceToEdge > 0 && distanceToEdge <= epsilon) {\n                itemLengthInFixedDirection = paddedLengthInFixedDirection - itemCoordInFixedDirection;\n            }\n            \n            const CGRect rawFrame = (self.scrollDirection == UICollectionViewScrollDirectionVertical) ?\n            CGRectMake(itemCoordInFixedDirection,\n                       itemCoordInScrollDirection + insets.top,\n                       itemLengthInFixedDirection,\n                       size.height) :\n            CGRectMake(itemCoordInScrollDirection + insets.left,\n                       itemCoordInFixedDirection,\n                       size.width,\n                       itemLengthInFixedDirection);\n            const CGRect frame = IGListRectIntegralScaled(rawFrame);\n            \n            _sectionData[section].itemBounds[item] = frame;\n            \n            // track the max size of the row to find the coord of the next row, adjust for leading inset while iterating items\n            nextRowCoordInScrollDirection = MAX(CGRectGetMaxInDirection(frame, self.scrollDirection) - UIEdgeInsetsLeadingInsetInDirection(insets, self.scrollDirection), nextRowCoordInScrollDirection);\n            \n            // increase the rolling coord in fixed direction appropriately and add item spacing for all items on the same row\n            itemCoordInFixedDirection += itemLengthInFixedDirection + interitemSpacing;\n            \n            // union the rolling section bounds\n            if (item == 0) {\n                rollingSectionBounds = frame;\n            } else {\n                rollingSectionBounds = CGRectUnion(rollingSectionBounds, frame);\n            }\n        }\n        \n        const CGRect headerBounds = self.scrollDirection == UICollectionViewScrollDirectionVertical ?\n        CGRectMake(insets.left,\n                   itemsEmpty ? CGRectGetMaxY(rollingSectionBounds) : CGRectGetMinY(rollingSectionBounds) - headerSize.height,\n                   paddedLengthInFixedDirection,\n                   hideHeaderWhenItemsEmpty ? 0 : headerSize.height) :\n        CGRectMake(itemsEmpty ? CGRectGetMaxX(rollingSectionBounds) : CGRectGetMinX(rollingSectionBounds) - headerSize.width,\n                   insets.top,\n                   hideHeaderWhenItemsEmpty ? 0 : headerSize.width,\n                   paddedLengthInFixedDirection);\n        \n        _sectionData[section].headerBounds = headerBounds;\n        \n        if (itemsEmpty) {\n            rollingSectionBounds = headerBounds;\n        }\n        \n        const CGRect footerBounds = (self.scrollDirection == UICollectionViewScrollDirectionVertical) ?\n        CGRectMake(insets.left,\n                   CGRectGetMaxY(rollingSectionBounds),\n                   paddedLengthInFixedDirection,\n                   hideHeaderWhenItemsEmpty ? 0 : footerSize.height) :\n        CGRectMake(CGRectGetMaxX(rollingSectionBounds) + insets.right,\n                   insets.top,\n                   hideHeaderWhenItemsEmpty ? 0 : footerSize.width,\n                   paddedLengthInFixedDirection);\n        \n        _sectionData[section].footerBounds = footerBounds;\n        \n        // union the header before setting the bounds of the section\n        // only do this when the header has a size, otherwise the union stretches to box empty space\n        if (headerExists) {\n            rollingSectionBounds = CGRectUnion(rollingSectionBounds, headerBounds);\n        }\n        if (footerExists) {\n            rollingSectionBounds = CGRectUnion(rollingSectionBounds, footerBounds);\n        }\n        \n        _sectionData[section].bounds = rollingSectionBounds;\n        _sectionData[section].insets = insets;\n        \n        // bump the coord for the next section with the right insets\n        itemCoordInFixedDirection += UIEdgeInsetsTrailingInsetInDirection(insets, fixedDirection);\n        \n        // find the farthest point in the section and add the trailing inset to find the next row's coord\n        nextRowCoordInScrollDirection = MAX(nextRowCoordInScrollDirection, CGRectGetMaxInDirection(rollingSectionBounds, self.scrollDirection) + UIEdgeInsetsTrailingInsetInDirection(insets, self.scrollDirection));\n        \n        // keep track of coordinates for partial invalidation\n        _sectionData[section].lastItemCoordInScrollDirection = itemCoordInScrollDirection;\n        _sectionData[section].lastItemCoordInFixedDirection = itemCoordInFixedDirection;\n        _sectionData[section].lastNextRowCoordInScrollDirection = nextRowCoordInScrollDirection;\n    }\n    \n    _minimumInvalidatedSection = NSNotFound;\n}\n\n- (NSRange)_rangeOfSectionsInRect:(CGRect)rect {\n    NSRange result = NSMakeRange(NSNotFound, 0);\n    \n    const NSInteger sectionCount = _sectionData.size();\n    for (NSInteger section = 0; section < sectionCount; section++) {\n        IGListSectionEntry entry = _sectionData[section];\n        if (entry.isValid() && CGRectIntersectsRect(entry.bounds, rect)) {\n            const NSRange sectionRange = NSMakeRange(section, 1);\n            if (result.location == NSNotFound) {\n                result = sectionRange;\n            } else {\n                result = NSUnionRange(result, sectionRange);\n            }\n        }\n    }\n    \n    return result;\n}\n\n- (void)_resetSupplementaryAttributesCache {\n    [_supplementaryAttributesCache enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSMutableDictionary<NSIndexPath *,UICollectionViewLayoutAttributes *> * _Nonnull attributesCache, BOOL * _Nonnull stop) {\n        [attributesCache removeAllObjects];\n    }];\n}\n\n#pragma mark - Minimum Invalidated Section\n\n- (void)didModifySection:(NSInteger)modifiedSection {\n    _minimumInvalidatedSection = IGListMergeMinimumInvalidatedSection(_minimumInvalidatedSection, modifiedSection);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListCollectionViewLayoutCompatible.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A protocol for layouts that defines interaction with an IGListCollectionView, for recieving updated section indexes.\n */\nNS_SWIFT_NAME(ListCollectionViewLayoutCompatible)\n@protocol IGListCollectionViewLayoutCompatible <NSObject>\n\n/**\n Called to notify the layout that a specific section was modified before invalidation. This can be used to optimize\n layout re-calculation.\n \n @note When updating a collection view (ex: calling `-insertSections`), `-invalidateLayoutWithContext` gets called on\n the layout object. However, the invalidation context doesn't provide details on which index paths are being modified,\n which typically forces a full layout re-calculation. Layouts can use this method to keep track of which section\n actually needs to be updated on the following `-invalidateLayoutWithContext`. See `IGListCollectionView`.\n \n @param modifiedSection The section that was modified.\n */\n- (void)didModifySection:(NSInteger)modifiedSection;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListDisplayDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@class IGListAdapter;\n@class IGListSectionController;\n\n\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Implement this protocol to receive display events for a section controller when it is on screen.\n */\nNS_SWIFT_NAME(ListDisplayDelegate)\n@protocol IGListDisplayDelegate <NSObject>\n\n/**\n Tells the delegate that the specified section controller is about to be displayed.\n\n @param listAdapter The list adapter for the section controller.\n @param sectionController The section controller about to be displayed.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter willDisplaySectionController:(IGListSectionController *)sectionController;\n\n/**\n Tells the delegate that the specified section controller is no longer being displayed.\n\n @param listAdapter       The list adapter for the section controller.\n @param sectionController The section controller that is no longer displayed.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didEndDisplayingSectionController:(IGListSectionController *)sectionController;\n\n/**\n Tells the delegate that a cell in the specified list is about to be displayed.\n\n @param listAdapter The list adapter in which the cell will display.\n @param sectionController The section controller that is displaying the cell.\n @param cell The cell about to be displayed.\n @param index The index of the cell in the section.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter willDisplaySectionController:(IGListSectionController *)sectionController\n               cell:(UICollectionViewCell *)cell\n            atIndex:(NSInteger)index;\n\n/**\n Tells the delegate that a cell in the specified list is no longer being displayed.\n\n @param listAdapter The list adapter in which the cell was displayed.\n @param sectionController The section controller that is no longer displaying the cell.\n @param cell The cell that is no longer displayed.\n @param index The index of the cell in the section.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didEndDisplayingSectionController:(IGListSectionController *)sectionController\n               cell:(UICollectionViewCell *)cell\n            atIndex:(NSInteger)index;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListGenericSectionController.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListKit/IGListSectionController.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n This class adds a helper layer to `IGListSectionController\u0010` to automatically store a generic object in\n `didUpdateToObject:`.\n */\nNS_SWIFT_NAME(ListGenericSectionController)\n@interface IGListGenericSectionController<__covariant ObjectType> : IGListSectionController\n\n/**\n The object mapped to this section controller. Matches the object provided in\n `[IGListAdapterDataSource listAdapter:sectionControllerForObject:]` when this section controller was created and\n returned.\n\n @note This object is briefly `nil` between initialization and the first call to `didUpdateToObject:`. After that, it is\n safe to assume that this is non-`nil`.\n */\n@property (nonatomic, strong, nullable, readonly) ObjectType object;\n\n/**\n Updates the section controller to a new object.\n\n @param object The object mapped to this section controller.\n\n @note This `IGListSectionController` subclass sets its object in this method, so any overrides **must call super**.\n */\n- (void)didUpdateToObject:(id)object NS_REQUIRES_SUPER;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListGenericSectionController.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListGenericSectionController.h\"\n\n@implementation IGListGenericSectionController\n\n- (void)didUpdateToObject:(id)object {\n    _object = object;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListKit.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListDiffKit/IGListCompatibility.h>\n\n/**\n * Project version number for IGListKit.\n */\nFOUNDATION_EXPORT double IGListKitVersionNumber;\n\n/**\n * Project version string for IGListKit.\n */\nFOUNDATION_EXPORT const unsigned char IGListKitVersionString[];\n\n#if TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR\n\n// iOS and tvOS only:\n\n#import <IGListKit/IGListAdapter.h>\n#import <IGListKit/IGListAdapterDataSource.h>\n#import <IGListKit/IGListAdapterDelegate.h>\n#import <IGListKit/IGListAdapterUpdateListener.h>\n#import <IGListKit/IGListAdapterUpdater.h>\n#import <IGListKit/IGListAdapterUpdaterDelegate.h>\n#import <IGListKit/IGListBatchContext.h>\n#import <IGListKit/IGListBindable.h>\n#import <IGListKit/IGListBindingSectionController.h>\n#import <IGListKit/IGListBindingSectionControllerDataSource.h>\n#import <IGListKit/IGListBindingSectionControllerSelectionDelegate.h>\n#import <IGListKit/IGListCollectionContext.h>\n#import <IGListKit/IGListCollectionView.h>\n#import <IGListKit/IGListCollectionViewLayout.h>\n#import <IGListKit/IGListDisplayDelegate.h>\n#import <IGListKit/IGListGenericSectionController.h>\n#import <IGListKit/IGListCollectionViewDelegateLayout.h>\n#import <IGListKit/IGListReloadDataUpdater.h>\n#import <IGListKit/IGListScrollDelegate.h>\n#import <IGListKit/IGListSectionController.h>\n#import <IGListKit/IGListSingleSectionController.h>\n#import <IGListKit/IGListSupplementaryViewSource.h>\n#import <IGListKit/IGListTransitionDelegate.h>\n#import <IGListKit/IGListUpdatingDelegate.h>\n#import <IGListKit/IGListWorkingRangeDelegate.h>\n#import <IGListKit/IGListCollectionViewDelegateLayout.h>\n\n#endif\n\n// Shared (iOS, tvOS, macOS compatible):\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListDiffKit/IGListBatchUpdateData.h>\n#import <IGListDiffKit/IGListDiff.h>\n#import <IGListDiffKit/IGListDiffable.h>\n#import <IGListDiffKit/IGListExperiments.h>\n#import <IGListDiffKit/IGListIndexPathResult.h>\n#import <IGListDiffKit/IGListIndexSetResult.h>\n#import <IGListDiffKit/IGListMoveIndex.h>\n#import <IGListDiffKit/IGListMoveIndexPath.h>\n#import <IGListDiffKit/NSNumber+IGListDiffable.h>\n#import <IGListDiffKit/NSString+IGListDiffable.h>\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListReloadDataUpdater.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n#import <IGListKit/IGListUpdatingDelegate.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An `IGListReloadDataUpdater` is a concrete type that conforms to `IGListUpdatingDelegate`.\n It is an out-of-box updater for `IGListAdapter` objects to use.\n\n @note This updater performs simple, synchronous updates using `-[UICollectionView reloadData]`.\n */\nIGLK_SUBCLASSING_RESTRICTED\nNS_SWIFT_NAME(ListReloadDataUpdater)\n@interface IGListReloadDataUpdater : NSObject <IGListUpdatingDelegate>\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListReloadDataUpdater.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListKit/IGListReloadDataUpdater.h>\n\n@implementation IGListReloadDataUpdater\n\n#pragma mark - IGListUpdatingDelegate\n\n- (NSPointerFunctions *)objectLookupPointerFunctions {\n    return [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsObjectPersonality];\n}\n\n- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                            fromObjects:(NSArray *)fromObjects\n                         toObjectsBlock:(IGListToObjectBlock)toObjectsBlock\n                               animated:(BOOL)animated\n                  objectTransitionBlock:(IGListObjectTransitionBlock)objectTransitionBlock\n                             completion:(IGListUpdatingCompletion)completion {\n    if (toObjectsBlock != nil) {\n        NSArray *toObjects = toObjectsBlock() ?: @[];\n        objectTransitionBlock(toObjects);\n    }\n    [self _synchronousReloadDataWithCollectionView:collectionViewBlock()];\n    if (completion) {\n        completion(YES);\n    }\n}\n\n- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                               animated:(BOOL)animated\n                            itemUpdates:(IGListItemUpdateBlock)itemUpdates\n                             completion:(IGListUpdatingCompletion)completion {\n    itemUpdates();\n    [self _synchronousReloadDataWithCollectionView:collectionViewBlock()];\n    if (completion) {\n        completion(YES);\n    }\n}\n\n- (void)insertItemsIntoCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray<NSIndexPath *> *)indexPaths {\n    [self _synchronousReloadDataWithCollectionView:collectionView];\n}\n\n- (void)deleteItemsFromCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray<NSIndexPath *> *)indexPaths {\n    [self _synchronousReloadDataWithCollectionView:collectionView];\n}\n\n- (void)moveItemInCollectionView:(UICollectionView *)collectionView fromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {\n    [self _synchronousReloadDataWithCollectionView:collectionView];\n}\n\n- (void)reloadItemInCollectionView:(UICollectionView *)collectionView fromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {\n    [self _synchronousReloadDataWithCollectionView:collectionView];\n}\n\n- (void)moveSectionInCollectionView:(UICollectionView *)collectionView fromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex {\n    [self _synchronousReloadDataWithCollectionView:collectionView];\n}\n\n- (void)reloadDataWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock reloadUpdateBlock:(IGListReloadUpdateBlock)reloadUpdateBlock completion:(IGListUpdatingCompletion)completion {\n    reloadUpdateBlock();\n    [self _synchronousReloadDataWithCollectionView:collectionViewBlock()];\n    if (completion) {\n        completion(YES);\n    }\n}\n\n- (void)reloadCollectionView:(UICollectionView *)collectionView sections:(NSIndexSet *)sections {\n    [self _synchronousReloadDataWithCollectionView:collectionView];\n}\n\n- (void)_synchronousReloadDataWithCollectionView:(UICollectionView *)collectionView {\n    [collectionView reloadData];\n    [collectionView layoutIfNeeded];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListScrollDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@class IGListAdapter;\n@class IGListSectionController;\n\n\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Implement this protocol to receive display events for a section controller when it is on screen.\n */\nNS_SWIFT_NAME(ListScrollDelegate)\n@protocol IGListScrollDelegate <NSObject>\n\n/**\n Tells the delegate that the section controller was scrolled on screen.\n\n @param listAdapter The list adapter whose collection view was scrolled.\n @param sectionController The visible section controller that was scrolled.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didScrollSectionController:(IGListSectionController *)sectionController;\n\n/**\n Tells the delegate that the section controller will be dragged on screen.\n\n @param listAdapter The list adapter whose collection view will drag.\n @param sectionController The visible section controller that will drag.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter willBeginDraggingSectionController:(IGListSectionController *)sectionController;\n\n/**\n Tells the delegate that the section controller did end dragging on screen.\n\n @param listAdapter The list adapter whose collection view ended dragging.\n @param sectionController The visible section controller that ended dragging.\n @param decelerate 'Yes' if the scrolling movement will continue, but decelerate, after a touch-up gesture during a \n dragging operation. If the value is 'No', scrolling stops immediately upon touch-up.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didEndDraggingSectionController:(IGListSectionController *)sectionController willDecelerate:(BOOL)decelerate;\n\n@optional\n\n/**\n Tells the delegate that the section controller did end decelerating on screen.\n\n @param listAdapter The list adapter whose collection view ended decelerating.\n @param sectionController The visible section controller that ended decelerating.\n\n @note This method is `@optional` until the next breaking-change release.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter didEndDeceleratingSectionController:(IGListSectionController *)sectionController;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListSectionController.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListKit/IGListCollectionContext.h>\n#import <IGListKit/IGListDisplayDelegate.h>\n#import <IGListKit/IGListScrollDelegate.h>\n#import <IGListKit/IGListSupplementaryViewSource.h>\n#import <IGListKit/IGListTransitionDelegate.h>\n#import <IGListKit/IGListWorkingRangeDelegate.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The base class for section controllers used in a list. This class is intended to be subclassed.\n */\nNS_SWIFT_NAME(ListSectionController)\n@interface IGListSectionController : NSObject\n\n/**\n Returns the number of items in the section.\n\n @return A count of items in the list.\n\n @note The count returned is used to drive the number of cells displayed for this section controller. The default \n implementation returns 1. **Calling super is not required.**\n */\n- (NSInteger)numberOfItems;\n\n/**\n The specific size for the item at the specified index.\n\n @param index The row index of the item.\n\n @return The size for the item at index.\n\n @note The returned size is not guaranteed to be used. The implementation may query sections for their\n layout information at will, or use its own layout metrics. For example, consider a dynamic-text sized list versus a\n fixed height-and-width grid. The former will ask each section for a size, and the latter will likely not. The default\n implementation returns size zero. **Calling super is not required.**\n */\n- (CGSize)sizeForItemAtIndex:(NSInteger)index;\n\n/**\n Return a dequeued cell for a given index.\n\n @param index The index of the requested row.\n\n @return A configured `UICollectionViewCell` subclass.\n\n @note This is your opportunity to do any cell setup and configuration. The infrastructure requests a cell when it\n will be used on screen. You should never allocate new cells in this method, instead use the provided adapter to call\n one of the dequeue methods on the IGListCollectionContext. The default implementation will assert. **You must override\n this method without calling super.**\n \n @warning Don't call this method to obtain a reference to currently dequeued cells: a new cell will be dequeued\n and returned, rather than the existing cell that you may have intended to retrieve. Instead, you can call\n `-cellForItemAtIndex:sectionController:` on `IGListCollectionContext` to obtain active cell references.\n */\n- (__kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index;\n\n/**\n Updates the section controller to a new object.\n\n @param object The object mapped to this section controller.\n\n @note When this method is called, all available contexts and configurations have been set for the section\n controller. This method will only be called when the object instance has changed, including from `nil` or a previous\n object. **Calling super is not required.**\n */\n- (void)didUpdateToObject:(id)object;\n\n/**\n Tells the section controller that the cell at the specified index path was selected.\n\n @param index The index of the selected cell.\n\n @note The default implementation does nothing. **Calling super is not required.**\n */\n- (void)didSelectItemAtIndex:(NSInteger)index;\n\n/**\n Tells the section controller that the cell at the specified index path was deselected.\n\n @param index The index of the deselected cell.\n\n @note The default implementation does nothing. **Calling super is not required.**\n */\n- (void)didDeselectItemAtIndex:(NSInteger)index;\n\n/**\n Tells the section controller that the cell at the specified index path was highlighted.\n\n @param index The index of the highlighted cell.\n\n @note The default implementation does nothing. **Calling super is not required.**\n */\n- (void)didHighlightItemAtIndex:(NSInteger)index;\n\n/**\n Tells the section controller that the cell at the specified index path was unhighlighted.\n\n @param index The index of the unhighlighted cell.\n\n @note The default implementation does nothing. **Calling super is not required.**\n */\n- (void)didUnhighlightItemAtIndex:(NSInteger)index;\n    \n/**\n Identifies whether an object can be moved through interactive reordering.\n \n @param index The index of the object in the list.\n\n @return `YES` if the object is allowed to move, otherwise `NO`.\n \n @note Interactive reordering is supported both for items within a single section, as well as for reordering sections\n themselves when sections contain only one item. The default implementation returns false.\n */\n- (BOOL)canMoveItemAtIndex:(NSInteger)index;\n\n/**\n Notifies the section that a list object should move within a section as the result of interactive reordering.\n \n @param sourceIndex The starting index of the object.\n @param destinationIndex The ending index of the object.\n \n @note this method must be implemented if interactive reordering is enabled.\n */\n- (void)moveObjectFromIndex:(NSInteger)sourceIndex toIndex:(NSInteger)destinationIndex NS_AVAILABLE_IOS(9_0);\n    \n/**\n The view controller housing the adapter that created this section controller.\n\n @note Use this view controller to push, pop, present, or do other custom transitions. \n \n @warning It is considered very bad practice to cast this to a known view controller \n and call methods on it other than for navigations and transitions.\n */\n@property (nonatomic, weak, nullable, readonly) UIViewController *viewController;\n\n/**\n A context object for interacting with the collection. \n \n Use this property for accessing the collection size, dequeuing cells, reloading, inserting, deleting, etc.\n */\n@property (nonatomic, weak, nullable, readonly) id <IGListCollectionContext> collectionContext;\n\n/**\n Returns the section within the list for this section controller.\n\n @note This value also relates to the section within a `UICollectionView` that this section controller's cells belong.\n It also relates to the `-[NSIndexPath section]` value for individual cells within the collection view.\n */\n@property (nonatomic, assign, readonly) NSInteger section;\n\n/**\n Returns `YES` if the section controller is the first section in the list, `NO` otherwise.\n */\n@property (nonatomic, assign, readonly) BOOL isFirstSection;\n\n/**\n Returns `YES` if the section controller is the last section in the list, `NO` otherwise.\n */\n@property (nonatomic, assign, readonly) BOOL isLastSection;\n\n/**\n The margins used to lay out content in the section controller.\n\n @see `-[UICollectionViewFlowLayout sectionInset]`.\n */\n@property (nonatomic, assign) UIEdgeInsets inset;\n\n/**\n The minimum spacing to use between rows of items.\n\n @see `-[UICollectionViewFlowLayout minimumLineSpacing]`.\n */\n@property (nonatomic, assign) CGFloat minimumLineSpacing;\n\n/**\n The minimum spacing to use between items in the same row.\n\n @see `-[UICollectionViewFlowLayout minimumInteritemSpacing]`.\n */\n@property (nonatomic, assign) CGFloat minimumInteritemSpacing;\n\n/**\n The supplementary view source for the section controller. Can be `nil`.\n\n @return An object that conforms to `IGListSupplementaryViewSource` or `nil`.\n\n @note You may wish to return `self` if your section controller implements this protocol.\n */\n@property (nonatomic, weak, nullable) id <IGListSupplementaryViewSource> supplementaryViewSource;\n\n/**\n An object that handles display events for the section controller. Can be `nil`.\n\n @return An object that conforms to `IGListDisplayDelegate` or `nil`.\n\n @note You may wish to return `self` if your section controller implements this protocol.\n */\n@property (nonatomic, weak, nullable) id <IGListDisplayDelegate> displayDelegate;\n\n/**\n An object that handles working range events for the section controller. Can be `nil`.\n\n @return An object that conforms to `IGListWorkingRangeDelegate` or `nil`.\n\n @note You may wish to return `self` if your section controller implements this protocol.\n */\n@property (nonatomic, weak, nullable) id <IGListWorkingRangeDelegate> workingRangeDelegate;\n\n/**\n An object that handles scroll events for the section controller. Can be `nil`.\n\n @return An object that conforms to `IGListScrollDelegate` or `nil`.\n\n @note You may wish to return `self` if your section controller implements this protocol.\n */\n@property (nonatomic, weak, nullable) id <IGListScrollDelegate> scrollDelegate;\n\n/**\n An object that handles transition events for the section controller. Can be `nil`.\n\n @return An object that conforms to `IGListTransitionDelegat` or `nil`.\n\n @note You may wish to return `self` if your section controller implements this protocol.\n */\n@property (nonatomic, weak, nullable) id<IGListTransitionDelegate> transitionDelegate;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListSectionController.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListSectionControllerInternal.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListDiffKit/IGListMacros.h>\n\nstatic NSString * const kIGListSectionControllerThreadKey = @\"kIGListSectionControllerThreadKey\";\n\n@interface IGListSectionControllerThreadContext : NSObject\n@property (nonatomic, weak) UIViewController *viewController;\n@property (nonatomic, weak) id<IGListCollectionContext> collectionContext;\n@end\n@implementation IGListSectionControllerThreadContext\n@end\n\nstatic NSMutableArray<IGListSectionControllerThreadContext *> *threadContextStack(void) {\n    IGAssertMainThread();\n    NSMutableDictionary *threadDictionary = [[NSThread currentThread] threadDictionary];\n    NSMutableArray *stack = threadDictionary[kIGListSectionControllerThreadKey];\n    if (stack == nil) {\n        stack = [NSMutableArray new];\n        threadDictionary[kIGListSectionControllerThreadKey] = stack;\n    }\n    return stack;\n}\n\nvoid IGListSectionControllerPushThread(UIViewController *viewController, id<IGListCollectionContext> collectionContext) {\n    IGListSectionControllerThreadContext *context = [IGListSectionControllerThreadContext new];\n    context.viewController = viewController;\n    context.collectionContext = collectionContext;\n\n    [threadContextStack() addObject:context];\n}\n\nvoid IGListSectionControllerPopThread(void) {\n    NSMutableArray *stack = threadContextStack();\n    IGAssert(stack.count > 0, @\"IGListSectionController thread stack is empty\");\n    [stack removeLastObject];\n}\n\n@implementation IGListSectionController\n\n- (instancetype)init {\n    if (self = [super init]) {\n        IGListSectionControllerThreadContext *context = [threadContextStack() lastObject];\n        _viewController = context.viewController;\n        _collectionContext = context.collectionContext;\n\n        if (_collectionContext == nil) {\n            IGLKLog(@\"Warning: Creating %@ outside of -[IGListAdapterDataSource listAdapter:sectionControllerForObject:]. Collection context and view controller will be set later.\",\n                    NSStringFromClass([self class]));\n        }\n\n        _minimumInteritemSpacing = 0.0;\n        _minimumLineSpacing = 0.0;\n        _inset = UIEdgeInsetsZero;\n        _section = NSNotFound;\n    }\n    return self;\n}\n\n- (NSInteger)numberOfItems {\n    return 1;\n}\n\n- (CGSize)sizeForItemAtIndex:(NSInteger)index {\n    return CGSizeZero;\n}\n\n- (__kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index {\n    IGFailAssert(@\"Section controller %@ must override %s:\", self, __PRETTY_FUNCTION__);\n    return nil;\n}\n\n- (void)didUpdateToObject:(id)object {}\n\n- (void)didSelectItemAtIndex:(NSInteger)index {}\n\n- (void)didDeselectItemAtIndex:(NSInteger)index {}\n\n- (void)didHighlightItemAtIndex:(NSInteger)index {}\n\n- (void)didUnhighlightItemAtIndex:(NSInteger)index {}\n    \n- (BOOL)canMoveItemAtIndex:(NSInteger)index {\n    return NO;\n}\n\n- (BOOL)canMoveItemAtIndex:(NSInteger)sourceItemIndex toIndex:(NSInteger)destinationItemIndex {\n    return [self canMoveItemAtIndex:sourceItemIndex];\n}\n    \n- (void)moveObjectFromIndex:(NSInteger)sourceIndex toIndex:(NSInteger)destinationIndex {\n    IGFailAssert(@\"Section controller %@ must override %s if interactive reordering is enabled.\", self, __PRETTY_FUNCTION__);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListSingleSectionController.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n#import <IGListKit/IGListSectionController.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n\n/**\n A block used to configure cells.\n\n @param item The model with which to configure the cell.\n @param cell The cell to configure.\n */\nNS_SWIFT_NAME(ListSingleSectionCellConfigureBlock)\ntypedef void (^IGListSingleSectionCellConfigureBlock)(id item, __kindof UICollectionViewCell *cell);\n\n/**\n A block that returns the size for the cell given the collection context.\n\n @param item The model for the section.\n @param collectionContext The collection context for the section.\n\n @return The size for the cell.\n */\nNS_SWIFT_NAME(ListSingleSectionCellSizeBlock)\ntypedef CGSize (^IGListSingleSectionCellSizeBlock)(id item, id<IGListCollectionContext> _Nullable collectionContext);\n\n@class IGListSingleSectionController;\n\n/**\n A delegate that can receive selection events on an `IGListSingleSectionController`.\n */\nNS_SWIFT_NAME(ListSingleSectionControllerDelegate)\n@protocol IGListSingleSectionControllerDelegate <NSObject>\n\n/**\n Tells the delegate that the section controller was selected.\n\n @param sectionController The section controller that was selected.\n @param object The model for the given section.\n */\n- (void)didSelectSectionController:(IGListSingleSectionController *)sectionController\n                        withObject:(id)object;\n\n@optional\n\n/**\n Tells the delegate that the section controller was deselected.\n\n @param sectionController The section controller that was deselected.\n @param object The model for the given section.\n\n @note Method is `@optional` until the 4.0.0 release where it will become required.\n */\n- (void)didDeselectSectionController:(IGListSingleSectionController *)sectionController\n                          withObject:(id)object;\n\n@end\n\n/**\n This section controller is meant to make building simple, single-cell lists easier. By providing the type of cell, a block\n to configure the cell, and a block to return the size of a cell, you can use an `IGListAdapter`-powered list with a\n simpler architecture.\n */\nIGLK_SUBCLASSING_RESTRICTED\nNS_SWIFT_NAME(ListSingleSectionController)\n@interface IGListSingleSectionController : IGListSectionController\n\n/**\n Creates a new section controller for a given cell type that will always have only one cell when present in a list.\n \n @param cellClass The `UICollectionViewCell` subclass for the single cell.\n @param configureBlock A block that configures the cell with the item given to the section controller.\n @param sizeBlock A block that returns the size for the cell given the collection context.\n \n @return A new section controller.\n \n @warning Be VERY CAREFUL not to create retain cycles by holding strong references to: the object that owns the adapter\n (usually `self`) or the `IGListAdapter`. Pass in locally scoped objects or use `weak` references!\n */\n- (instancetype)initWithCellClass:(Class)cellClass\n                   configureBlock:(IGListSingleSectionCellConfigureBlock)configureBlock\n                        sizeBlock:(IGListSingleSectionCellSizeBlock)sizeBlock;\n\n/**\n Creates a new section controller for a given nib name and bundle that will always have only one cell when present in a list.\n \n @param nibName The name of the nib file for the single cell.\n @param bundle The bundle in which to search for the nib file. If `nil`, this method looks for the file in the main bundle.\n @param configureBlock A block that configures the cell with the item given to the section controller.\n @param sizeBlock A block that returns the size for the cell given the collection context.\n \n @return A new section controller.\n\n @warning Be VERY CAREFUL not to create retain cycles by holding strong references to: the object that owns the adapter\n (usually `self`) or the `IGListAdapter`. Pass in locally scoped objects or use `weak` references!\n */\n- (instancetype)initWithNibName:(NSString *)nibName\n                         bundle:(nullable NSBundle *)bundle\n                 configureBlock:(IGListSingleSectionCellConfigureBlock)configureBlock\n                      sizeBlock:(IGListSingleSectionCellSizeBlock)sizeBlock;\n\n/**\n Creates a new section controller for a given storyboard cell identifier that will always have only one cell when present in a list.\n \n @param identifier The identifier of the cell prototype in storyboard.\n @param configureBlock A block that configures the cell with the item given to the section controller.\n @param sizeBlock A block that returns the size for the cell given the collection context.\n \n @return A new section controller.\n\n @warning Be VERY CAREFUL not to create retain cycles by holding strong references to: the object that owns the adapter\n (usually `self`) or the `IGListAdapter`. Pass in locally scoped objects or use `weak` references!\n */\n- (instancetype)initWithStoryboardCellIdentifier:(NSString *)identifier\n                                  configureBlock:(IGListSingleSectionCellConfigureBlock)configureBlock\n                                       sizeBlock:(IGListSingleSectionCellSizeBlock)sizeBlock;\n\n/**\n An optional delegate that handles selection and deselection.\n */\n@property (nonatomic, weak, nullable) id<IGListSingleSectionControllerDelegate> selectionDelegate;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListSingleSectionController.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListSingleSectionController.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n\n@interface IGListSingleSectionController ()\n\n@property (nonatomic, strong, readonly) NSString *nibName;\n@property (nonatomic, strong, readonly) NSBundle *bundle;\n@property (nonatomic, strong, readonly) NSString *identifier;\n@property (nonatomic, strong, readonly) Class cellClass;\n@property (nonatomic, strong, readonly) IGListSingleSectionCellConfigureBlock configureBlock;\n@property (nonatomic, strong, readonly) IGListSingleSectionCellSizeBlock sizeBlock;\n\n@property (nonatomic, strong) id item;\n\n@end\n\n@implementation IGListSingleSectionController\n\n- (instancetype)initWithCellClass:(Class)cellClass\n                   configureBlock:(IGListSingleSectionCellConfigureBlock)configureBlock\n                        sizeBlock:(IGListSingleSectionCellSizeBlock)sizeBlock {\n    IGParameterAssert(cellClass != nil);\n    IGParameterAssert(configureBlock != nil);\n    IGParameterAssert(sizeBlock != nil);\n    if (self = [super init]) {\n        _cellClass = cellClass;\n        _configureBlock = [configureBlock copy];\n        _sizeBlock = [sizeBlock copy];\n    }\n    return self;\n}\n\n- (instancetype)initWithNibName:(NSString *)nibName\n                         bundle:(NSBundle *)bundle\n                 configureBlock:(IGListSingleSectionCellConfigureBlock)configureBlock\n                      sizeBlock:(IGListSingleSectionCellSizeBlock)sizeBlock {\n    IGParameterAssert(nibName != nil);\n    IGParameterAssert(configureBlock != nil);\n    IGParameterAssert(sizeBlock != nil);\n    if (self = [super init]) {\n        _nibName = [nibName copy];\n        _bundle = bundle;\n        _configureBlock = [configureBlock copy];\n        _sizeBlock = [sizeBlock copy];\n    }\n    return self;\n}\n\n- (instancetype)initWithStoryboardCellIdentifier:(NSString *)identifier\n                                  configureBlock:(IGListSingleSectionCellConfigureBlock)configureBlock\n                                       sizeBlock:(IGListSingleSectionCellSizeBlock)sizeBlock {\n    IGParameterAssert(identifier.length > 0);\n    IGParameterAssert(configureBlock != nil);\n    IGParameterAssert(sizeBlock != nil);\n    if (self = [super init]) {\n        _identifier = [identifier copy];\n        _configureBlock = [configureBlock copy];\n        _sizeBlock = [sizeBlock copy];\n    }\n    return self;\n\n}\n\n#pragma mark - IGListSectionController Overrides\n\n- (NSInteger)numberOfItems {\n    return 1;\n}\n\n- (CGSize)sizeForItemAtIndex:(NSInteger)index {\n    return self.sizeBlock(self.item, self.collectionContext);\n}\n\n- (UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index {\n    IGParameterAssert(index == 0);\n    id cell;\n    id<IGListCollectionContext> collectionContext = self.collectionContext;\n    if ([self.nibName length] > 0) {\n        cell = [collectionContext dequeueReusableCellWithNibName:self.nibName\n                                                          bundle:self.bundle\n                                            forSectionController:self\n                                                         atIndex:index];\n    } else if ([self.identifier length] > 0) {\n        cell = [collectionContext dequeueReusableCellFromStoryboardWithIdentifier:self.identifier\n                                                             forSectionController:self\n                                                                          atIndex:index];\n    } else {\n        cell = [collectionContext dequeueReusableCellOfClass:self.cellClass forSectionController:self atIndex:index];\n    }\n    self.configureBlock(self.item, cell);\n    return cell;\n}\n\n- (void)didUpdateToObject:(id)object {\n    self.item = object;\n}\n\n- (void)didSelectItemAtIndex:(NSInteger)index {\n    [self.selectionDelegate didSelectSectionController:self withObject:self.item];\n}\n\n- (void)didDeselectItemAtIndex:(NSInteger)index {\n    if ([self.selectionDelegate respondsToSelector:@selector(didDeselectSectionController:withObject:)]) {\n        [self.selectionDelegate didDeselectSectionController:self withObject:self.item];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListSupplementaryViewSource.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Conform to this protocol to provide information about a list's supplementary views. This data is used in\n `IGListAdapter` which then configures and maintains a `UICollectionView`. The supplementary API reflects that in\n `UICollectionView`, `UICollectionViewLayout`, and `UICollectionViewDataSource`.\n */\nNS_SWIFT_NAME(ListSupplementaryViewSource)\n@protocol IGListSupplementaryViewSource <NSObject>\n\n/**\n Asks the SupplementaryViewSource for an array of supported element kinds.\n\n @return An array of element kind strings that the supplementary source handles.\n */\n- (NSArray<NSString *> *)supportedElementKinds;\n\n/**\n Asks the SupplementaryViewSource for a configured supplementary view for the specified kind and index.\n\n @param elementKind The kind of supplementary view being requested\n @param index The index for the supplementary veiw being requested.\n\n @note This is your opportunity to do any supplementary view setup and configuration.\n\n @warning You should never allocate new views in this method. Instead deque a view from the `IGListCollectionContext`.\n */\n- (__kindof UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind\n                                                                 atIndex:(NSInteger)index;\n\n/**\n Asks the SupplementaryViewSource for the size of a supplementary view for the given kind and index path.\n\n @param elementKind The kind of supplementary view.\n @param index The index of the requested view.\n\n @return The size for the supplementary view.\n */\n- (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind\n                                 atIndex:(NSInteger)index;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListTransitionDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n Conform to `IGListTransitionDelegate` to provide customized layout information for a collection view.\n */\n@protocol IGListTransitionDelegate <NSObject>\n\n/**\n Asks the delegate to customize and return the starting layout information for an item being inserted into the collection view.\n\n @param listAdapter The adapter controlling the list.\n @param attributes The starting layout information for an item being inserted into the collection view.\n @param sectionController The section controller to perform the transition on.\n @param index The index of the item being inserted.\n */\n- (UICollectionViewLayoutAttributes *)listAdapter:(IGListAdapter *)listAdapter customizedInitialLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes sectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index;\n\n/**\n Asks the delegate to customize and return the final layout information for an item that is about to be removed from the collection view.\n\n @param listAdapter The adapter controlling the list.\n @param attributes The final layout information for an item that is about to be removed from the collection view.\n @param sectionController The section controller to perform the transition on.\n @param index The index of the item being deleted.\n */\n- (UICollectionViewLayoutAttributes *)listAdapter:(IGListAdapter *)listAdapter customizedFinalLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes sectionController:(IGListSectionController *)sectionController atIndex:(NSInteger)index;\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListUpdatingDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@protocol IGListDiffable;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A completion block to execute when updates are finished.\n\n @param finished Specifies whether or not the update finished.\n */\nNS_SWIFT_NAME(ListUpdatingCompletion)\ntypedef void (^IGListUpdatingCompletion)(BOOL finished);\n\n/**\n A block to be called when the adapter applies changes to the collection view.\n\n @param toObjects The new objects in the collection.\n */\nNS_SWIFT_NAME(ListObjectTransitionBlock)\ntypedef void (^IGListObjectTransitionBlock)(NSArray *toObjects);\n\n/// A block that contains all of the updates.\nNS_SWIFT_NAME(ListItemUpdateBlock)\ntypedef void (^IGListItemUpdateBlock)(void);\n\n/// A block to be called when an adapter reloads the collection view.\nNS_SWIFT_NAME(ListReloadUpdateBlock)\ntypedef void (^IGListReloadUpdateBlock)(void);\n\n/// A block that returns an array of objects to transition to.\nNS_SWIFT_NAME(ListToObjectBlock)\ntypedef NSArray * _Nullable (^IGListToObjectBlock)(void);\n\n/// A block that returns a collection view to perform updates on.\nNS_SWIFT_NAME(ListCollectionViewBlock)\ntypedef UICollectionView * _Nullable (^IGListCollectionViewBlock)(void);\n\n/**\n Implement this protocol in order to handle both section and row based update events. Implementation should forward or\n coalesce these events to a backing store or collection.\n */\nNS_SWIFT_NAME(ListUpdatingDelegate)\n@protocol IGListUpdatingDelegate <NSObject>\n\n/**\n Asks the delegate for the pointer functions for looking up an object in a collection.\n\n @return Pointer functions for looking up an object in a collection.\n\n @note Since the updating delegate is responsible for transitioning between object sets, it becomes the \"source of\n truth\" for how objects and their corresponding section controllers are mapped. This allows the updater to control if\n objects are looked up by pointer, or more traditionally, with `-hash`/`-isEqual`.\n\n For behavior similar to `NSDictionary`, simply return\n `+[NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsObjectPersonality]`.\n */\n- (NSPointerFunctions *)objectLookupPointerFunctions;\n\n/**\n Tells the delegate to perform a section transition from an old array of objects to a new one.\n\n @param collectionViewBlock A block returning the collecion view to perform updates on.\n @param fromObjects The previous objects in the collection view. Objects must conform to `IGListDiffable`.\n @param toObjectsBlock A block returning the new objects in the collection view. Objects must conform to `IGListDiffable`.\n @param animated A flag indicating if the transition should be animated.\n @param objectTransitionBlock A block that must be called when the adapter applies changes to the collection view.\n @param completion A completion block to execute when the update is finished.\n\n @note Implementations determine how to transition between objects. You can perform a diff on the objects, reload\n each section, or simply call `-reloadData` on the collection view. In the end, the collection view must be setup with a\n section for each object in the `toObjects` array.\n\n The `objectTransitionBlock` block should be called prior to making any `UICollectionView` updates, passing in the `toObjects`\n that the updater is applying.\n */\n- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                                 fromObjects:(nullable NSArray<id <IGListDiffable>> *)fromObjects\n                              toObjectsBlock:(nullable IGListToObjectBlock)toObjectsBlock\n                                    animated:(BOOL)animated\n                       objectTransitionBlock:(IGListObjectTransitionBlock)objectTransitionBlock\n                                  completion:(nullable IGListUpdatingCompletion)completion;\n\n/**\n Tells the delegate to perform item inserts at the given index paths.\n\n @param collectionView The collection view on which to perform the transition.\n @param indexPaths The index paths to insert items into.\n */\n- (void)insertItemsIntoCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray <NSIndexPath *> *)indexPaths;\n\n/**\n Tells the delegate to perform item deletes at the given index paths.\n\n @param collectionView The collection view on which to perform the transition.\n @param indexPaths The index paths to delete items from.\n */\n- (void)deleteItemsFromCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray <NSIndexPath *> *)indexPaths;\n\n/**\n Tells the delegate to move an item from and to given index paths.\n\n @param collectionView The collection view on which to perform the transition.\n @param fromIndexPath The source index path of the item to move.\n @param toIndexPath The destination index path of the item to move.\n */\n- (void)moveItemInCollectionView:(UICollectionView *)collectionView\n                   fromIndexPath:(NSIndexPath *)fromIndexPath\n                     toIndexPath:(NSIndexPath *)toIndexPath;\n\n/**\n Tells the delegate to reload an item from and to given index paths.\n\n @param collectionView The collection view on which to perform the transition.\n @param fromIndexPath The source index path of the item to reload.\n @param toIndexPath The destination index path of the item to reload.\n\n @note Since UICollectionView is unable to handle calling -[UICollectionView reloadItemsAtIndexPaths:] safely while also\n executing insert and delete operations in the same batch updates, the updater must know about the origin and\n destination of the reload to perform a safe transition.\n */\n- (void)reloadItemInCollectionView:(UICollectionView *)collectionView\n                     fromIndexPath:(NSIndexPath *)fromIndexPath\n                       toIndexPath:(NSIndexPath *)toIndexPath;\n\n/**\n Tells the delegate to move a section from and to given indexes.\n\n @param collectionView The collection view on which to perform the transition.\n @param fromIndex The source index of the section to move.\n @param toIndex The destination index of the section to move.\n */\n- (void)moveSectionInCollectionView:(UICollectionView *)collectionView\n                          fromIndex:(NSInteger)fromIndex\n                            toIndex:(NSInteger)toIndex;\n\n/**\n Completely reload data in the collection.\n\n @param collectionViewBlock A block returning the collecion view to reload.\n @param reloadUpdateBlock A block that must be called when the adapter reloads the collection view.\n @param completion A completion block to execute when the reload is finished.\n */\n- (void)reloadDataWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                        reloadUpdateBlock:(IGListReloadUpdateBlock)reloadUpdateBlock\n                               completion:(nullable IGListUpdatingCompletion)completion;\n\n/**\n Completely reload each section in the collection view.\n\n @param collectionView The collection view to reload.\n @param sections The sections to reload.\n */\n- (void)reloadCollectionView:(UICollectionView *)collectionView sections:(NSIndexSet *)sections;\n\n/**\n Perform an item update block in the collection view.\n\n @param collectionViewBlock A block returning the collecion view to perform updates on.\n @param animated A flag indicating if the transition should be animated.\n @param itemUpdates A block containing all of the updates.\n @param completion A completion block to execute when the update is finished.\n */\n- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock\n                                    animated:(BOOL)animated\n                                 itemUpdates:(IGListItemUpdateBlock)itemUpdates\n                                  completion:(nullable IGListUpdatingCompletion)completion;\n\n@end\n\nNS_ASSUME_NONNULL_END\n\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/IGListWorkingRangeDelegate.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@class IGListAdapter;\n@class IGListSectionController;\n\n\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Implement this protocol to receive working range events for a list.\n\n The working range is a range *near* the viewport in which you can begin preparing content for display. For example,\n you could begin decoding images, or warming text caches.\n */\nNS_SWIFT_NAME(ListWorkingRangeDelegate)\n@protocol IGListWorkingRangeDelegate <NSObject>\n\n/**\n Notifies the delegate that an section controller will enter the working range.\n\n @param listAdapter The adapter controlling the list.\n @param sectionController The section controller entering the range.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter sectionControllerWillEnterWorkingRange:(IGListSectionController *)sectionController;\n\n/**\n Notifies the delegate that an section controller exited the working range.\n\n @param listAdapter The adapter controlling the list.\n @param sectionController The section controller that exited the range.\n */\n- (void)listAdapter:(IGListAdapter *)listAdapter sectionControllerDidExitWorkingRange:(IGListSectionController *)sectionController;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapter+DebugDescription.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListKit/IGListKit.h>\n\n@interface IGListAdapter (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapter+DebugDescription.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListAdapter+DebugDescription.h\"\n\n#import \"IGListAdapterInternal.h\"\n#import \"IGListAdapterUpdater+DebugDescription.h\"\n#import \"IGListDebuggingUtilities.h\"\n#import \"IGListSectionMap+DebugDescription.h\"\n#import \"UICollectionView+DebugDescription.h\"\n\n@implementation IGListAdapter (DebugDescription)\n\n- (NSString *)debugDescription {\n    NSMutableArray *lines = [NSMutableArray arrayWithObject:[NSString stringWithFormat:@\"IGListAdapter %p:\", self]];\n    [lines addObjectsFromArray:IGListDebugIndentedLines([self debugDescriptionLines])];\n    return [lines componentsJoinedByString:@\"\\n\"];\n}\n\n- (NSArray<NSString *> *)debugDescriptionLines {\n    NSMutableArray *debug = [NSMutableArray new];\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\n    [debug addObject:[NSString stringWithFormat:@\"Updater type: %@\", NSStringFromClass(self.updater.class)]];\n    [debug addObject:[NSString stringWithFormat:@\"Data source: %@\", self.dataSource]];\n    [debug addObject:[NSString stringWithFormat:@\"Collection view delegate: %@\", self.collectionViewDelegate]];\n    [debug addObject:[NSString stringWithFormat:@\"Scroll view delegate: %@\", self.scrollViewDelegate]];\n    [debug addObject:[NSString stringWithFormat:@\"Is in update block: %@\", IGListDebugBOOL(self.isInUpdateBlock)]];\n    [debug addObject:[NSString stringWithFormat:@\"View controller: %@\", self.viewController]];\n    if (@available(iOS 10.0, tvOS 10, *)) {\n        [debug addObject:[NSString stringWithFormat:@\"Is prefetching enabled: %@\", IGListDebugBOOL(self.collectionView.isPrefetchingEnabled)]];\n    }\n\n    if (self.registeredCellIdentifiers.count > 0) {\n        [debug addObject:@\"Registered cell identifiers:\"];\n        [debug addObject:[self.registeredCellIdentifiers description]];\n    }\n\n    if (self.registeredNibNames.count > 0) {\n        [debug addObject:@\"Registered nib names:\"];\n        [debug addObject:[self.registeredNibNames description]];\n    }\n\n    if (self.registeredSupplementaryViewIdentifiers.count > 0) {\n        [debug addObject:@\"Registered supplementary view identifiers:\"];\n        [debug addObject:[self.registeredSupplementaryViewIdentifiers description]];\n    }\n\n    if (self.registeredSupplementaryViewNibNames.count > 0) {\n        [debug addObject:@\"Registered supplementary view nib names:\"];\n        [debug addObject:self.registeredSupplementaryViewNibNames];\n    }\n\n    if ([self.updater isKindOfClass:[IGListAdapterUpdater class]]) {\n        [debug addObject:[NSString stringWithFormat:@\"IGListAdapterUpdater instance %p:\", self.updater]];\n        [debug addObjectsFromArray:IGListDebugIndentedLines([(IGListAdapterUpdater *)self.updater debugDescriptionLines])];\n    }\n\n    [debug addObject:@\"Section map details:\"];\n    [debug addObjectsFromArray:IGListDebugIndentedLines([self.sectionMap debugDescriptionLines])];\n\n    if (self.previousSectionMap != nil) {\n        [debug addObject:@\"Previous section map details:\"];\n        [debug addObjectsFromArray:IGListDebugIndentedLines([self.previousSectionMap debugDescriptionLines])];\n    }\n\n    [debug addObject:@\"Collection view details:\"];\n    [debug addObjectsFromArray:IGListDebugIndentedLines([self.collectionView debugDescriptionLines])];\n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n    return debug;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapter+UICollectionView.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListKit/IGListAdapter.h>\n#import <IGListKit/IGListCollectionViewDelegateLayout.h>\n\n@interface IGListAdapter (UICollectionView)\n<\nUICollectionViewDataSource,\nIGListCollectionViewDelegateLayout\n>\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapter+UICollectionView.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListAdapter+UICollectionView.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListKit/IGListAdapterInternal.h>\n#import <IGListKit/IGListSectionController.h>\n#import <IGListKit/IGListSectionControllerInternal.h>\n\n@implementation IGListAdapter (UICollectionView)\n\n#pragma mark - UICollectionViewDataSource\n\n- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {\n    return self.sectionMap.objects.count;\n}\n\n- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n    IGListSectionController * sectionController = [self sectionControllerForSection:section];\n    IGAssert(sectionController != nil, @\"Nil section controller for section %li for item %@. Check your -diffIdentifier and -isEqual: implementations.\",\n             (long)section, [self.sectionMap objectForSection:section]);\n    const NSInteger numberOfItems = [sectionController numberOfItems];\n    IGAssert(numberOfItems >= 0, @\"Cannot return negative number of items %li for section controller %@.\", (long)numberOfItems, sectionController);\n    return numberOfItems;\n}\n\n- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n    id<IGListAdapterPerformanceDelegate> performanceDelegate = self.performanceDelegate;\n    [performanceDelegate listAdapterWillCallDequeueCell:self];\n\n    IGListSectionController *sectionController = [self sectionControllerForSection:indexPath.section];\n\n    // flag that a cell is being dequeued in case it tries to access a cell in the process\n    _isDequeuingCell = YES;\n    UICollectionViewCell *cell = [sectionController cellForItemAtIndex:indexPath.item];\n    _isDequeuingCell = NO;\n\n    IGAssert(cell != nil, @\"Returned a nil cell at indexPath <%@> from section controller: <%@>\", indexPath, sectionController);\n\n    // associate the section controller with the cell so that we know which section controller is using it\n    [self mapView:cell toSectionController:sectionController];\n\n    [performanceDelegate listAdapter:self didCallDequeueCell:cell onSectionController:sectionController atIndex:indexPath.item];\n    return cell;\n}\n\n- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {\n    IGListSectionController *sectionController = [self sectionControllerForSection:indexPath.section];\n    id <IGListSupplementaryViewSource> supplementarySource = [sectionController supplementaryViewSource];\n    UICollectionReusableView *view = [supplementarySource viewForSupplementaryElementOfKind:kind atIndex:indexPath.item];\n    IGAssert(view != nil, @\"Returned a nil supplementary view at indexPath <%@> from section controller: <%@>, supplementary source: <%@>\", indexPath, sectionController, supplementarySource);\n\n    // associate the section controller with the cell so that we know which section controller is using it\n    [self mapView:view toSectionController:sectionController];\n\n    return view;\n}\n\n- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath {\n    const NSInteger sectionIndex = indexPath.section;\n    const NSInteger itemIndex = indexPath.item;\n\n    IGListSectionController *sectionController = [self sectionControllerForSection:sectionIndex];\n    return [sectionController canMoveItemAtIndex:itemIndex];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView\n   moveItemAtIndexPath:(NSIndexPath *)sourceIndexPath\n           toIndexPath:(NSIndexPath *)destinationIndexPath {\n\n    const NSInteger sourceSectionIndex = sourceIndexPath.section;\n    const NSInteger destinationSectionIndex = destinationIndexPath.section;\n    const NSInteger sourceItemIndex = sourceIndexPath.item;\n    const NSInteger destinationItemIndex = destinationIndexPath.item;\n\n    IGListSectionController *sourceSectionController = [self sectionControllerForSection:sourceSectionIndex];\n    IGListSectionController *destinationSectionController = [self sectionControllerForSection:destinationSectionIndex];\n\n    // this is a move within a section\n    if (sourceSectionController == destinationSectionController) {\n\n        if ([sourceSectionController canMoveItemAtIndex:sourceItemIndex toIndex:destinationItemIndex]) {\n            [self moveInSectionControllerInteractive:sourceSectionController\n                                           fromIndex:sourceItemIndex\n                                             toIndex:destinationItemIndex];\n        } else {\n            // otherwise this is a move of an _item_ from one section to another section\n            // we need to revert the change as it's too late to cancel\n            [self revertInvalidInteractiveMoveFromIndexPath:sourceIndexPath toIndexPath:destinationIndexPath];\n        }\n        return;\n    }\n\n    // this is a reordering of sections themselves\n    if ([sourceSectionController numberOfItems] == 1 && [destinationSectionController numberOfItems] == 1) {\n\n        // perform view changes in the collection view\n        [self moveSectionControllerInteractive:sourceSectionController\n                                     fromIndex:sourceSectionIndex\n                                       toIndex:destinationSectionIndex];\n        return;\n    }\n\n    // otherwise this is a move of an _item_ from one section to another section\n    // this is not currently supported, so we need to revert the change as it's too late to cancel\n    [self revertInvalidInteractiveMoveFromIndexPath:sourceIndexPath toIndexPath:destinationIndexPath];\n}\n\n#pragma mark - UICollectionViewDelegate\n\n- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:didSelectItemAtIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView didSelectItemAtIndexPath:indexPath];\n    }\n\n    IGListSectionController * sectionController = [self sectionControllerForSection:indexPath.section];\n    [sectionController didSelectItemAtIndex:indexPath.item];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath {\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:didDeselectItemAtIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView didDeselectItemAtIndexPath:indexPath];\n    }\n\n    IGListSectionController * sectionController = [self sectionControllerForSection:indexPath.section];\n    [sectionController didDeselectItemAtIndex:indexPath.item];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {\n    id<IGListAdapterPerformanceDelegate> performanceDelegate = self.performanceDelegate;\n    [performanceDelegate listAdapterWillCallDisplayCell:self];\n\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:willDisplayCell:forItemAtIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView willDisplayCell:cell forItemAtIndexPath:indexPath];\n    }\n\n    IGListSectionController *sectionController = [self sectionControllerForView:cell];\n    // if the section controller relationship was destroyed, reconnect it\n    // this happens with iOS 10 UICollectionView display range changes\n    if (sectionController == nil) {\n        sectionController = [self sectionControllerForSection:indexPath.section];\n        [self mapView:cell toSectionController:sectionController];\n    }\n\n    id object = [self.sectionMap objectForSection:indexPath.section];\n    [self.displayHandler willDisplayCell:cell forListAdapter:self sectionController:sectionController object:object indexPath:indexPath];\n\n    _isSendingWorkingRangeDisplayUpdates = YES;\n    [self.workingRangeHandler willDisplayItemAtIndexPath:indexPath forListAdapter:self];\n    _isSendingWorkingRangeDisplayUpdates = NO;\n\n    [performanceDelegate listAdapter:self didCallDisplayCell:cell onSectionController:sectionController atIndex:indexPath.item];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {\n    id<IGListAdapterPerformanceDelegate> performanceDelegate = self.performanceDelegate;\n    [performanceDelegate listAdapterWillCallEndDisplayCell:self];\n\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:didEndDisplayingCell:forItemAtIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView didEndDisplayingCell:cell forItemAtIndexPath:indexPath];\n    }\n\n    IGListSectionController *sectionController = [self sectionControllerForView:cell];\n    [self.displayHandler didEndDisplayingCell:cell forListAdapter:self sectionController:sectionController indexPath:indexPath];\n    [self.workingRangeHandler didEndDisplayingItemAtIndexPath:indexPath forListAdapter:self];\n\n    // break the association between the cell and the section controller\n    [self removeMapForView:cell];\n\n    [performanceDelegate listAdapter:self didCallEndDisplayCell:cell onSectionController:sectionController atIndex:indexPath.item];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath {\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:willDisplaySupplementaryView:forElementKind:atIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView willDisplaySupplementaryView:view forElementKind:elementKind atIndexPath:indexPath];\n    }\n\n    IGListSectionController *sectionController = [self sectionControllerForView:view];\n    // if the section controller relationship was destroyed, reconnect it\n    // this happens with iOS 10 UICollectionView display range changes\n    if (sectionController == nil) {\n        sectionController = [self.sectionMap sectionControllerForSection:indexPath.section];\n        [self mapView:view toSectionController:sectionController];\n    }\n\n    id object = [self.sectionMap objectForSection:indexPath.section];\n    [self.displayHandler willDisplaySupplementaryView:view forListAdapter:self sectionController:sectionController object:object indexPath:indexPath];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath {\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:didEndDisplayingSupplementaryView:forElementOfKind:atIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView didEndDisplayingSupplementaryView:view forElementOfKind:elementKind atIndexPath:indexPath];\n    }\n\n    IGListSectionController *sectionController = [self sectionControllerForView:view];\n    [self.displayHandler didEndDisplayingSupplementaryView:view forListAdapter:self sectionController:sectionController indexPath:indexPath];\n\n    [self removeMapForView:view];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath {\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:didHighlightItemAtIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView didHighlightItemAtIndexPath:indexPath];\n    }\n\n    IGListSectionController * sectionController = [self sectionControllerForSection:indexPath.section];\n    [sectionController didHighlightItemAtIndex:indexPath.item];\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath {\n    // forward this method to the delegate b/c this implementation will steal the message from the proxy\n    id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;\n    if ([collectionViewDelegate respondsToSelector:@selector(collectionView:didUnhighlightItemAtIndexPath:)]) {\n        [collectionViewDelegate collectionView:collectionView didUnhighlightItemAtIndexPath:indexPath];\n    }\n\n    IGListSectionController * sectionController = [self sectionControllerForSection:indexPath.section];\n    [sectionController didUnhighlightItemAtIndex:indexPath.item];\n}\n\n#pragma mark - UICollectionViewDelegateFlowLayout\n\n- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {\n    IGAssert(![self.collectionViewDelegate respondsToSelector:_cmd], @\"IGListAdapter is consuming method also implemented by the collectionViewDelegate: %@\", NSStringFromSelector(_cmd));\n\n    CGSize size = [self sizeForItemAtIndexPath:indexPath];\n    IGAssert(!isnan(size.height), @\"IGListAdapter returned NaN height = %f for item at indexPath <%@>\", size.height, indexPath);\n    IGAssert(!isnan(size.width), @\"IGListAdapter returned NaN width = %f for item at indexPath <%@>\", size.width, indexPath);\n\n    return size;\n}\n\n- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {\n    IGAssert(![self.collectionViewDelegate respondsToSelector:_cmd], @\"IGListAdapter is consuming method also implemented by the collectionViewDelegate: %@\", NSStringFromSelector(_cmd));\n    return [[self sectionControllerForSection:section] inset];\n}\n\n- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {\n    IGAssert(![self.collectionViewDelegate respondsToSelector:_cmd], @\"IGListAdapter is consuming method also implemented by the collectionViewDelegate: %@\", NSStringFromSelector(_cmd));\n    return [[self sectionControllerForSection:section] minimumLineSpacing];\n}\n\n- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {\n    IGAssert(![self.collectionViewDelegate respondsToSelector:_cmd], @\"IGListAdapter is consuming method also implemented by the collectionViewDelegate: %@\", NSStringFromSelector(_cmd));\n    return [[self sectionControllerForSection:section] minimumInteritemSpacing];\n}\n\n- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {\n    IGAssert(![self.collectionViewDelegate respondsToSelector:_cmd], @\"IGListAdapter is consuming method also implemented by the collectionViewDelegate: %@\", NSStringFromSelector(_cmd));\n    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:section];\n    return [self sizeForSupplementaryViewOfKind:UICollectionElementKindSectionHeader atIndexPath:indexPath];\n}\n\n- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {\n    IGAssert(![self.collectionViewDelegate respondsToSelector:_cmd], @\"IGListAdapter is consuming method also implemented by the collectionViewDelegate: %@\", NSStringFromSelector(_cmd));\n    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:0 inSection:section];\n    return [self sizeForSupplementaryViewOfKind:UICollectionElementKindSectionFooter atIndexPath:indexPath];\n}\n\n#pragma mark - IGListCollectionViewDelegateLayout\n\n- (UICollectionViewLayoutAttributes *)collectionView:(UICollectionView *)collectionView\n                                              layout:(UICollectionViewLayout*)collectionViewLayout\n                   customizedInitialLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes\n                                         atIndexPath:(NSIndexPath *)indexPath {\n    IGListSectionController *sectionController = [self sectionControllerForSection:indexPath.section];\n    if (sectionController.transitionDelegate) {\n        return [sectionController.transitionDelegate listAdapter:self\n                               customizedInitialLayoutAttributes:attributes\n                                               sectionController:sectionController\n                                                         atIndex:indexPath.item];\n    }\n    return attributes;\n}\n\n- (UICollectionViewLayoutAttributes *)collectionView:(UICollectionView *)collectionView\n                                              layout:(UICollectionViewLayout*)collectionViewLayout\n                     customizedFinalLayoutAttributes:(UICollectionViewLayoutAttributes *)attributes\n                                         atIndexPath:(NSIndexPath *)indexPath {\n    IGListSectionController *sectionController = [self sectionControllerForSection:indexPath.section];\n    if (sectionController.transitionDelegate) {\n        return [sectionController.transitionDelegate listAdapter:self\n                                 customizedFinalLayoutAttributes:attributes\n                                               sectionController:sectionController\n                                                         atIndex:indexPath.item];\n    }\n    return attributes;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapterInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListKit/IGListAdapter.h>\n#import <IGListKit/IGListBatchContext.h>\n#import <IGListKit/IGListCollectionContext.h>\n\n#import \"IGListAdapter+UICollectionView.h\"\n#import \"IGListAdapterProxy.h\"\n#import \"IGListDisplayHandler.h\"\n#import \"IGListSectionMap.h\"\n#import \"IGListWorkingRangeHandler.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n/// Generate a string representation of a reusable view class when registering with a UICollectionView.\nNS_INLINE NSString *IGListReusableViewIdentifier(Class viewClass, NSString * _Nullable kind, NSString * _Nullable givenReuseIdentifier) {\n    return [NSString stringWithFormat:@\"%@%@%@\", kind ?: @\"\", givenReuseIdentifier ?: @\"\", NSStringFromClass(viewClass)];\n}\n\n@interface IGListAdapter ()\n<\nIGListCollectionContext,\nIGListBatchContext\n>\n{\n    __weak UICollectionView *_collectionView;\n    BOOL _isDequeuingCell;\n    BOOL _isSendingWorkingRangeDisplayUpdates;\n}\n\n@property (nonatomic, strong) id <IGListUpdatingDelegate> updater;\n\n@property (nonatomic, strong, readonly) IGListSectionMap *sectionMap;\n@property (nonatomic, strong, readonly) IGListDisplayHandler *displayHandler;\n@property (nonatomic, strong, readonly) IGListWorkingRangeHandler *workingRangeHandler;\n\n@property (nonatomic, strong, nullable) IGListAdapterProxy *delegateProxy;\n\n@property (nonatomic, strong, nullable) UIView *emptyBackgroundView;\n\n// we need to special case interactive section moves that are moved to the last position\n@property (nonatomic) BOOL isLastInteractiveMoveToLastSectionIndex;\n\n/**\n When making object updates inside a batch update block, delete operations must use the section /before/ any moves take\n place. This includes when other objects are deleted or inserted ahead of the section controller making the mutations.\n In order to account for this we must track when the adapter is in the middle of an update block as well as the section\n controller mapping prior to the transition.\n\n Note that the previous section controller map is destroyed as soon as a transition is finished so there is no dangling\n objects or section controllers.\n */\n@property (nonatomic, assign) BOOL isInUpdateBlock;\n@property (nonatomic, strong, nullable) IGListSectionMap *previousSectionMap;\n\n/**\n Set of cell identifiers registered with the list context.\n Identifiers are constructed with the `IGListReusableViewIdentifier` function.\n */\n@property (nonatomic, strong) NSMutableSet<NSString *> *registeredCellIdentifiers;\n@property (nonatomic, strong) NSMutableSet<NSString *> *registeredNibNames;\n@property (nonatomic, strong) NSMutableSet<NSString *> *registeredSupplementaryViewIdentifiers;\n@property (nonatomic, strong) NSMutableSet<NSString *> *registeredSupplementaryViewNibNames;\n\n- (void)mapView:(__kindof UIView *)view toSectionController:(IGListSectionController *)sectionController;\n- (nullable IGListSectionController *)sectionControllerForView:(__kindof UIView *)view;\n- (void)removeMapForView:(__kindof UIView *)view;\n\n- (NSArray *)indexPathsFromSectionController:(IGListSectionController *)sectionController\n                                     indexes:(NSIndexSet *)indexes\n                  usePreviousIfInUpdateBlock:(BOOL)usePreviousIfInUpdateBlock;\n\n- (nullable NSIndexPath *)indexPathForSectionController:(IGListSectionController *)controller\n                                                  index:(NSInteger)index\n                             usePreviousIfInUpdateBlock:(BOOL)usePreviousIfInUpdateBlock;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapterProxy.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n\n@class IGListAdapter;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A proxy that sends a custom set of selectors to an IGListAdapter object and the rest to a UICollectionViewDelegate\n target.\n */\nIGLK_SUBCLASSING_RESTRICTED\n@interface IGListAdapterProxy : NSProxy\n\n/**\n Create a new proxy object with targets and interceptor.\n\n @param collectionViewTarget A UICollectionViewDelegate conforming object that receives non-intercepted messages.\n @param scrollViewTarget A UIScrollViewDelegate conforming object that receives non-intercepted messages.\n @param interceptor An IGListAdapter object that intercepts a set of messages.\n\n @return A new IGListAdapterProxy object.\n */\n- (instancetype)initWithCollectionViewTarget:(nullable id<UICollectionViewDelegate>)collectionViewTarget\n                            scrollViewTarget:(nullable id<UIScrollViewDelegate>)scrollViewTarget\n                                 interceptor:(IGListAdapter *)interceptor;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapterProxy.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListAdapterProxy.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n\n#import \"IGListCollectionViewDelegateLayout.h\"\n\n/**\n Define messages that you want the IGListAdapter object to intercept. Pattern copied from\n https://github.com/facebook/AsyncDisplayKit/blob/7b112a2dcd0391ddf3671f9dcb63521f554b78bd/AsyncDisplayKit/ASCollectionView.mm#L34-L53\n */\nstatic BOOL isInterceptedSelector(SEL sel) {\n    return (\n            // UIScrollViewDelegate\n            sel == @selector(scrollViewDidScroll:) ||\n            sel == @selector(scrollViewWillBeginDragging:) ||\n            sel == @selector(scrollViewDidEndDragging:willDecelerate:) ||\n            sel == @selector(scrollViewDidEndDecelerating:) ||\n            // UICollectionViewDelegate\n            sel == @selector(collectionView:willDisplayCell:forItemAtIndexPath:) ||\n            sel == @selector(collectionView:didEndDisplayingCell:forItemAtIndexPath:) ||\n            sel == @selector(collectionView:didSelectItemAtIndexPath:) ||\n            sel == @selector(collectionView:didDeselectItemAtIndexPath:) ||\n            sel == @selector(collectionView:didHighlightItemAtIndexPath:) ||\n            sel == @selector(collectionView:didUnhighlightItemAtIndexPath:) ||\n            // UICollectionViewDelegateFlowLayout\n            sel == @selector(collectionView:layout:sizeForItemAtIndexPath:) ||\n            sel == @selector(collectionView:layout:insetForSectionAtIndex:) ||\n            sel == @selector(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:) ||\n            sel == @selector(collectionView:layout:minimumLineSpacingForSectionAtIndex:) ||\n            sel == @selector(collectionView:layout:referenceSizeForFooterInSection:) ||\n            sel == @selector(collectionView:layout:referenceSizeForHeaderInSection:) ||\n            \n            // IGListCollectionViewDelegateLayout\n            sel == @selector(collectionView:layout:customizedInitialLayoutAttributes:atIndexPath:) ||\n            sel == @selector(collectionView:layout:customizedFinalLayoutAttributes:atIndexPath:)\n            );\n}\n\n@interface IGListAdapterProxy () {\n    __weak id _collectionViewTarget;\n    __weak id _scrollViewTarget;\n    __weak IGListAdapter *_interceptor;\n}\n\n@end\n\n@implementation IGListAdapterProxy\n\n- (instancetype)initWithCollectionViewTarget:(nullable id<UICollectionViewDelegate>)collectionViewTarget\n                            scrollViewTarget:(nullable id<UIScrollViewDelegate>)scrollViewTarget\n                                 interceptor:(IGListAdapter *)interceptor {\n    IGParameterAssert(interceptor != nil);\n    // -[NSProxy init] is undefined\n    if (self) {\n        _collectionViewTarget = collectionViewTarget;\n        _scrollViewTarget = scrollViewTarget;\n        _interceptor = interceptor;\n    }\n    return self;\n}\n\n- (BOOL)respondsToSelector:(SEL)aSelector {\n    return isInterceptedSelector(aSelector)\n    || [_collectionViewTarget respondsToSelector:aSelector]\n    || [_scrollViewTarget respondsToSelector:aSelector];\n}\n\n- (id)forwardingTargetForSelector:(SEL)aSelector {\n    if (isInterceptedSelector(aSelector)) {\n        return _interceptor;\n    }\n\n    // since UICollectionViewDelegate is a superset of UIScrollViewDelegate, first check if the method exists in\n    // _scrollViewTarget, otherwise use the _collectionViewTarget\n    return [_scrollViewTarget respondsToSelector:aSelector] ? _scrollViewTarget : _collectionViewTarget;\n}\n\n// handling unimplemented methods and nil target/interceptor\n// https://github.com/Flipboard/FLAnimatedImage/blob/76a31aefc645cc09463a62d42c02954a30434d7d/FLAnimatedImage/FLAnimatedImage.m#L786-L807\n- (void)forwardInvocation:(NSInvocation *)invocation {\n    void *nullPointer = NULL;\n    [invocation setReturnValue:&nullPointer];\n}\n\n- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {\n    return [NSObject instanceMethodSignatureForSelector:@selector(init)];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapterUpdater+DebugDescription.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListKit/IGListKit.h>\n\n@interface IGListAdapterUpdater (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapterUpdater+DebugDescription.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListAdapterUpdater+DebugDescription.h\"\n\n#import \"IGListAdapterUpdaterInternal.h\"\n#import \"IGListBatchUpdateData+DebugDescription.h\"\n#import \"IGListDebuggingUtilities.h\"\n\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\nstatic NSMutableArray *linesFromObjects(NSArray *objects) {\n    NSMutableArray *lines = [NSMutableArray new];\n    for (id object in objects) {\n        [lines addObject:[NSString stringWithFormat:@\"Object %p of type %@ with identifier %@\",\n                          object, NSStringFromClass([object class]), [object diffIdentifier]]];\n    }\n    return lines;\n}\n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n\n@implementation IGListAdapterUpdater (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines {\n    NSMutableArray *debug = [NSMutableArray new];\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\n    [debug addObject:[NSString stringWithFormat:@\"Moves as deletes+inserts: %@\", IGListDebugBOOL(self.movesAsDeletesInserts)]];\n    [debug addObject:[NSString stringWithFormat:@\"Allows background reloading: %@\", IGListDebugBOOL(self.allowsBackgroundReloading)]];\n    [debug addObject:[NSString stringWithFormat:@\"Has queued reload data: %@\", IGListDebugBOOL(self.hasQueuedReloadData)]];\n    [debug addObject:[NSString stringWithFormat:@\"Queued update is animated: %@\", IGListDebugBOOL(self.queuedUpdateIsAnimated)]];\n\n    NSString *stateString;\n    switch (self.state) {\n        case IGListBatchUpdateStateIdle:\n            stateString = @\"Idle\";\n            break;\n        case IGListBatchUpdateStateQueuedBatchUpdate:\n            stateString = @\"Queued batch update\";\n            break;\n        case IGListBatchUpdateStateExecutedBatchUpdateBlock:\n            stateString = @\"Executed batch update block\";\n            break;\n        case IGListBatchUpdateStateExecutingBatchUpdateBlock:\n            stateString = @\"Executing batch update block\";\n            break;\n    }\n    [debug addObject:[NSString stringWithFormat:@\"State: %@\", stateString]];\n\n    if (self.applyingUpdateData != nil) {\n        [debug addObject:@\"Batch update data:\"];\n        [debug addObjectsFromArray:IGListDebugIndentedLines([self.applyingUpdateData debugDescriptionLines])];\n    }\n\n    if (self.fromObjects != nil) {\n        [debug addObject:@\"From objects:\"];\n        [debug addObjectsFromArray:IGListDebugIndentedLines(linesFromObjects(self.fromObjects))];\n    }\n\n    if (self.toObjectsBlock != nil) {\n        [debug addObject:@\"To objects:\"];\n        [debug addObjectsFromArray:IGListDebugIndentedLines(linesFromObjects(self.toObjectsBlock()))];\n    }\n\n    if (self.pendingTransitionToObjects != nil) {\n        [debug addObject:@\"Pending objects:\"];\n        [debug addObjectsFromArray:IGListDebugIndentedLines(linesFromObjects(self.pendingTransitionToObjects))];\n    }\n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n    return debug;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListAdapterUpdaterInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n#import <QuartzCore/QuartzCore.h>\n\n#import <IGListDiffKit/IGListMoveIndexPath.h>\n\n#import \"IGListAdapterUpdater.h\"\n#import \"IGListBatchUpdateState.h\"\n#import \"IGListBatchUpdates.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\nFOUNDATION_EXTERN void convertReloadToDeleteInsert(NSMutableIndexSet *reloads,\n                                                   NSMutableIndexSet *deletes,\n                                                   NSMutableIndexSet *inserts,\n                                                   IGListIndexSetResult *result,\n                                                   NSArray<id<IGListDiffable>> *fromObjects);\n\n@interface IGListAdapterUpdater ()\n\n@property (nonatomic, copy, nullable) NSArray *fromObjects;\n@property (nonatomic, copy, nullable) IGListToObjectBlock toObjectsBlock;\n@property (nonatomic, copy, nullable) NSArray *pendingTransitionToObjects;\n@property (nonatomic, strong) NSMutableArray<IGListUpdatingCompletion> *completionBlocks;\n\n@property (nonatomic, assign) BOOL queuedUpdateIsAnimated;\n\n@property (nonatomic, strong) IGListBatchUpdates *batchUpdates;\n\n@property (nonatomic, copy, nullable) IGListObjectTransitionBlock objectTransitionBlock;\n\n@property (nonatomic, copy, nullable) IGListReloadUpdateBlock reloadUpdates;\n@property (nonatomic, assign, getter=hasQueuedReloadData) BOOL queuedReloadData;\n\n@property (nonatomic, assign) IGListBatchUpdateState state;\n@property (nonatomic, strong, nullable) IGListBatchUpdateData *applyingUpdateData;\n\n- (void)performReloadDataWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock;\n- (void)performBatchUpdatesWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock;\n- (void)cleanStateBeforeUpdates;\n- (BOOL)hasChanges;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListArrayUtilsInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#ifndef IGListArrayUtilsInternal_h\n#define IGListArrayUtilsInternal_h\n\n#import <IGListDiffKit/IGListAssert.h>\n\nstatic NSArray *objectsWithDuplicateIdentifiersRemoved(NSArray<id<IGListDiffable>> *objects) {\n    if (objects == nil) {\n        return nil;\n    }\n    \n    NSMapTable *identifierMap = [NSMapTable strongToStrongObjectsMapTable];\n    NSMutableArray *uniqueObjects = [NSMutableArray new];\n    for (id<IGListDiffable> object in objects) {\n        id diffIdentifier = [object diffIdentifier];\n        id previousObject = [identifierMap objectForKey:diffIdentifier];\n        if (diffIdentifier != nil\n            && previousObject == nil) {\n            [identifierMap setObject:object forKey:diffIdentifier];\n            [uniqueObjects addObject:object];\n        } else {\n            IGLKLog(@\"Duplicate identifier %@ for object %@ with object %@\", diffIdentifier, object, previousObject);\n        }\n    }\n    return uniqueObjects;\n}\n\n#endif /* IGListArrayUtilsInternal_h */\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListBatchUpdateData+DebugDescription.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListKit/IGListKit.h>\n\n@interface IGListBatchUpdateData (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListBatchUpdateData+DebugDescription.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListBatchUpdateData+DebugDescription.h\"\n\n@implementation IGListBatchUpdateData (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines {\n    NSMutableArray *debug = [NSMutableArray new];\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\n    [debug addObject:[NSString stringWithFormat:@\"Insert sections: %@\", self.insertSections]];\n    [debug addObject:[NSString stringWithFormat:@\"Delete sections: %@\", self.deleteSections]];\n\n    for (IGListMoveIndex *move in self.moveSections) {\n        [debug addObject:[NSString stringWithFormat:@\"Move from section %li to %li\", (long)move.from, (long)move.to]];\n    }\n\n    for (NSIndexPath *path in self.deleteIndexPaths) {\n        [debug addObject:[NSString stringWithFormat:@\"Delete section %li item %li\", (long)path.section, (long)path.item]];\n    }\n\n    for (NSIndexPath *path in self.insertIndexPaths) {\n        [debug addObject:[NSString stringWithFormat:@\"Insert section %li item %li\", (long)path.section, (long)path.item]];\n    }\n\n    for (IGListMoveIndexPath *move in self.moveIndexPaths) {\n        [debug addObject:[NSString stringWithFormat:@\"Move from section %li item %li to section %li item %li\",\n                          (long)move.from.section, (long)move.from.item, (long)move.to.section, (long)move.to.item]];\n    }\n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n    return debug;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListBatchUpdateState.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\ntypedef NS_ENUM (NSInteger, IGListBatchUpdateState) {\n    IGListBatchUpdateStateIdle,\n    IGListBatchUpdateStateQueuedBatchUpdate,\n    IGListBatchUpdateStateExecutingBatchUpdateBlock,\n    IGListBatchUpdateStateExecutedBatchUpdateBlock,\n};\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListBatchUpdates.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n\n@class IGListMoveIndexPath;\n@class IGListReloadIndexPath;\n\nIGLK_SUBCLASSING_RESTRICTED\n@interface IGListBatchUpdates : NSObject\n\n@property (nonatomic, strong, readonly) NSMutableIndexSet *sectionReloads;\n@property (nonatomic, strong, readonly) NSMutableArray<NSIndexPath *> *itemInserts;\n@property (nonatomic, strong, readonly) NSMutableArray<NSIndexPath *> *itemDeletes;\n@property (nonatomic, strong, readonly) NSMutableArray<IGListReloadIndexPath *> *itemReloads;\n@property (nonatomic, strong, readonly) NSMutableArray<IGListMoveIndexPath *> *itemMoves;\n\n@property (nonatomic, strong, readonly) NSMutableArray<void (^)(void)> *itemUpdateBlocks;\n@property (nonatomic, strong, readonly) NSMutableArray<void (^)(BOOL)> *itemCompletionBlocks;\n\n- (BOOL)hasChanges;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListBatchUpdates.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListBatchUpdates.h\"\n\n@implementation IGListBatchUpdates\n\n- (instancetype)init {\n    if (self = [super init]) {\n        _sectionReloads = [NSMutableIndexSet new];\n        _itemInserts = [NSMutableArray new];\n        _itemMoves = [NSMutableArray new];\n        _itemDeletes = [NSMutableArray new];\n        _itemReloads = [NSMutableArray new];\n        _itemUpdateBlocks = [NSMutableArray new];\n        _itemCompletionBlocks = [NSMutableArray new];\n    }\n    return self;\n}\n\n- (BOOL)hasChanges {\n    return [self.itemUpdateBlocks count] > 0\n    || [self.sectionReloads count] > 0\n    || [self.itemInserts count] > 0\n    || [self.itemMoves count] > 0\n    || [self.itemReloads count] > 0\n    || [self.itemDeletes count] > 0;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListBindingSectionController+DebugDescription.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <IGListKit/IGListKit.h>\n\n@interface IGListBindingSectionController (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListBindingSectionController+DebugDescription.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListBindingSectionController+DebugDescription.h\"\n\n#import \"IGListDebuggingUtilities.h\"\n\n@implementation IGListBindingSectionController (DebugDescription)\n\n- (NSString *)debugDescription {\n    NSMutableArray *lines = [NSMutableArray arrayWithObject:[NSString stringWithFormat:@\"IGListBindingSectionController %p:\", self]];\n    [lines addObjectsFromArray:IGListDebugIndentedLines([self debugDescriptionLines])];\n    return [lines componentsJoinedByString:@\"\\n\"];\n}\n\n- (NSArray<NSString *> *)debugDescriptionLines {\n    NSMutableArray *debug = [NSMutableArray new];\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\n    [debug addObject:[NSString stringWithFormat:@\"Data source: %@\", self.dataSource]];\n    [debug addObject:[NSString stringWithFormat:@\"Selection delegate: %@\", self.selectionDelegate]];\n    [debug addObject:[NSString stringWithFormat:@\"Object: %@\", self.object]];\n    [debug addObject:@\"View models:\"];\n    for (id<IGListDiffable> viewModel in self.viewModels) {\n        [debug addObject:[NSString stringWithFormat:@\"%@: %@\", viewModel, viewModel.diffIdentifier]];\n    }\n    [debug addObject:[NSString stringWithFormat:@\"Number of items: %ld\", (long)self.numberOfItems]];\n    [debug addObject:[NSString stringWithFormat:@\"View controller: %@\", self.viewController]];\n    [debug addObject:[NSString stringWithFormat:@\"Collection context: %@\", self.collectionContext]];\n    [debug addObject:[NSString stringWithFormat:@\"Section: %ld\", (long)self.section]];\n    [debug addObject:[NSString stringWithFormat:@\"Is first section: %@\", IGListDebugBOOL(self.isFirstSection)]];\n    [debug addObject:[NSString stringWithFormat:@\"Is last section: %@\", IGListDebugBOOL(self.isLastSection)]];\n    [debug addObject:[NSString stringWithFormat:@\"Supplementary view source: %@\", self.supplementaryViewSource]];\n    [debug addObject:[NSString stringWithFormat:@\"Display delegate: %@\", self.displayDelegate]];\n    [debug addObject:[NSString stringWithFormat:@\"Working range delegate: %@\", self.workingRangeDelegate]];\n    [debug addObject:[NSString stringWithFormat:@\"Scroll delegate: %@\", self.scrollDelegate]];\n    \n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n    return debug;\n}\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListCollectionViewLayoutInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nstatic CGRect IGListRectIntegralScaled(CGRect rect) {\n    CGFloat scale = [[UIScreen mainScreen] scale];\n    return CGRectMake(floorf(rect.origin.x * scale) / scale,\n                      floorf(rect.origin.y * scale) / scale,\n                      ceilf(rect.size.width * scale) / scale,\n                      ceilf(rect.size.height * scale) / scale);\n}\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListDebugger.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n\n@class IGListAdapter;\n\nIGLK_SUBCLASSING_RESTRICTED\n@interface IGListDebugger : NSObject\n\n+ (void)trackAdapter:(IGListAdapter *)adapter;\n\n+ (NSArray<NSString *> *)adapterDescriptions;\n\n+ (void)clear;\n\n+ (NSString *)dump;\n\n- (instancetype)init NS_UNAVAILABLE;\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListDebugger.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListDebugger.h\"\n\n#import \"IGListAdapter+DebugDescription.h\"\n\n@implementation IGListDebugger\n\nstatic NSHashTable<IGListAdapter *> *livingAdaptersTable = nil;\n\n+ (void)trackAdapter:(IGListAdapter *)adapter {\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\n    if (livingAdaptersTable == nil) {\n        livingAdaptersTable = [NSHashTable weakObjectsHashTable];\n    }\n    [livingAdaptersTable addObject:adapter];\n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n}\n\n+ (NSArray<NSString *> *)adapterDescriptions {\n    NSMutableArray *descriptions = [NSMutableArray new];\n    for (IGListAdapter *adapter in livingAdaptersTable) {\n        [descriptions addObject:[adapter debugDescription]];\n    }\n    return descriptions;\n}\n\n+ (void)clear {\n    [livingAdaptersTable removeAllObjects];\n}\n\n+ (NSString *)dump {\n    return [[self adapterDescriptions] componentsJoinedByString:@\"\\n\"];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListDebuggingUtilities.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListAdapter;\n\nextern NSString *IGListDebugBOOL(BOOL b);\n\nextern NSArray<NSString *> *IGListDebugIndentedLines(NSArray<NSString *> *lines);\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListDebuggingUtilities.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListDebuggingUtilities.h\"\n\nNSString *IGListDebugBOOL(BOOL b) {\n    return b ? @\"Yes\" : @\"No\";\n}\n\nNSArray<NSString *> *IGListDebugIndentedLines(NSArray<NSString *> *lines) {\n    NSMutableArray *newLines = [NSMutableArray new];\n    for (NSString *line in lines) {\n        [newLines addObject:[NSString stringWithFormat:@\"  %@\", line]];\n    }\n    return newLines;\n}\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListDisplayHandler.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n\n@class IGListAdapter;\n@class IGListSectionController;\n\n\n\nNS_ASSUME_NONNULL_BEGIN\n\nIGLK_SUBCLASSING_RESTRICTED\n@interface IGListDisplayHandler : NSObject\n\n/**\n Counted set of the currently visible section controllers.\n */\n@property (nonatomic, strong, readonly) NSCountedSet<IGListSectionController *> *visibleListSections;\n\n/**\n Tells the handler that a cell will be displayed in the IGListAdapter.\n\n @param cell A cell that will be displayed.\n @param listAdapter The adapter the cell will display in.\n @param sectionController The section controller that manages the cell.\n @param object The object that powers the section controller.\n @param indexPath The index path of the cell in the UICollectionView.\n */\n- (void)willDisplayCell:(UICollectionViewCell *)cell\n         forListAdapter:(IGListAdapter *)listAdapter\n      sectionController:(IGListSectionController *)sectionController\n                 object:(id)object\n              indexPath:(NSIndexPath *)indexPath;\n\n/**\n Tells the handler that a cell did end display in the IGListAdapter.\n\n @param cell A cell that will be displayed.\n @param listAdapter The adapter the cell will display in.\n @param sectionController The section controller that manages the cell.\n @param indexPath The index path of the cell in the UICollectionView.\n */\n- (void)didEndDisplayingCell:(UICollectionViewCell *)cell\n              forListAdapter:(IGListAdapter *)listAdapter\n           sectionController:(IGListSectionController *)sectionController\n                   indexPath:(NSIndexPath *)indexPath;\n\n\n/**\n Tells the handler that a supplementary view will be displayed in the IGListAdapter.\n\n @param view A supplementary view that will be displayed.\n @param listAdapter The adapter the supplementary view will display in.\n @param sectionController The section controller that manages the supplementary view.\n @param object The object that powers the section controller.\n @param indexPath The index path of the supplementary view in the UICollectionView.\n */\n- (void)willDisplaySupplementaryView:(UICollectionReusableView *)view\n                      forListAdapter:(IGListAdapter *)listAdapter\n                   sectionController:(IGListSectionController *)sectionController\n                              object:(id)object\n                           indexPath:(NSIndexPath *)indexPath;\n\n\n/**\n Tells the handler that a supplementary view did end display in the IGListAdapter.\n\n @param view A supplementary view that will be displayed.\n @param listAdapter The adapter the supplementary view will display in.\n @param sectionController The section controller that manages the supplementary view.\n @param indexPath The index path of the supplementary view in the UICollectionView.\n */\n- (void)didEndDisplayingSupplementaryView:(UICollectionReusableView *)view\n                           forListAdapter:(IGListAdapter *)listAdapter\n                        sectionController:(IGListSectionController *)sectionController\n                                indexPath:(NSIndexPath *)indexPath;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListDisplayHandler.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListDisplayHandler.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListKit/IGListAdapter.h>\n#import <IGListKit/IGListDisplayDelegate.h>\n#import <IGListKit/IGListSectionController.h>\n\n@interface IGListDisplayHandler ()\n\n@property (nonatomic, strong) NSMapTable *visibleViewObjectMap;\n\n@end\n\n@implementation IGListDisplayHandler\n\n- (instancetype)init {\n    if (self = [super init]) {\n        _visibleListSections = [NSCountedSet new];\n        _visibleViewObjectMap = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableStrongMemory capacity:0];\n    }\n    return self;\n}\n\n- (id)_pluckObjectForView:(UICollectionReusableView *)view {\n    NSMapTable *viewObjectMap = self.visibleViewObjectMap;\n    id object = [viewObjectMap objectForKey:view];\n    [viewObjectMap removeObjectForKey:view];\n    return object;\n}\n\n- (void)_willDisplayReusableView:(UICollectionReusableView *)view\n                 forListAdapter:(IGListAdapter *)listAdapter\n              sectionController:(IGListSectionController *)sectionController\n                         object:(id)object\n                      indexPath:(NSIndexPath *)indexPath {\n    IGParameterAssert(view != nil);\n    IGParameterAssert(listAdapter != nil);\n    IGParameterAssert(object != nil);\n    IGParameterAssert(indexPath != nil);\n\n    [self.visibleViewObjectMap setObject:object forKey:view];\n    NSCountedSet *visibleListSections = self.visibleListSections;\n    if ([visibleListSections countForObject:sectionController] == 0) {\n        [sectionController.displayDelegate listAdapter:listAdapter willDisplaySectionController:sectionController];\n        [listAdapter.delegate listAdapter:listAdapter willDisplayObject:object atIndex:indexPath.section];\n    }\n    [visibleListSections addObject:sectionController];\n}\n\n- (void)_didEndDisplayingReusableView:(UICollectionReusableView *)view\n                      forListAdapter:(IGListAdapter *)listAdapter\n                   sectionController:(IGListSectionController *)sectionController\n                              object:(id)object\n                           indexPath:(NSIndexPath *)indexPath {\n    IGParameterAssert(view != nil);\n    IGParameterAssert(listAdapter != nil);\n    IGParameterAssert(indexPath != nil);\n\n    if (object == nil || sectionController == nil) {\n        return;\n    }\n\n    const NSInteger section = indexPath.section;\n\n    NSCountedSet *visibleSections = self.visibleListSections;\n    [visibleSections removeObject:sectionController];\n\n    if ([visibleSections countForObject:sectionController] == 0) {\n        [sectionController.displayDelegate listAdapter:listAdapter didEndDisplayingSectionController:sectionController];\n        [listAdapter.delegate listAdapter:listAdapter didEndDisplayingObject:object atIndex:section];\n    }\n}\n\n- (void)willDisplaySupplementaryView:(UICollectionReusableView *)view\n                      forListAdapter:(IGListAdapter *)listAdapter\n                   sectionController:(IGListSectionController *)sectionController\n                              object:(id)object\n                           indexPath:(NSIndexPath *)indexPath {\n    [self _willDisplayReusableView:view forListAdapter:listAdapter sectionController:sectionController object:object indexPath:indexPath];\n}\n\n- (void)didEndDisplayingSupplementaryView:(UICollectionReusableView *)view\n                           forListAdapter:(IGListAdapter *)listAdapter\n                        sectionController:(IGListSectionController *)sectionController\n                                indexPath:(NSIndexPath *)indexPath {\n    // if cell display events break, don't send display events when the object has disappeared\n    id object = [self _pluckObjectForView:view];\n    [self _didEndDisplayingReusableView:view forListAdapter:listAdapter sectionController:sectionController object:object indexPath:indexPath];\n}\n\n- (void)willDisplayCell:(UICollectionViewCell *)cell\n         forListAdapter:(IGListAdapter *)listAdapter\n      sectionController:(IGListSectionController *)sectionController\n                 object:(id)object\n              indexPath:(NSIndexPath *)indexPath {\n    id <IGListDisplayDelegate> displayDelegate = [sectionController displayDelegate];\n    [displayDelegate listAdapter:listAdapter willDisplaySectionController:sectionController cell:cell atIndex:indexPath.item];\n    [self _willDisplayReusableView:cell forListAdapter:listAdapter sectionController:sectionController object:object indexPath:indexPath];\n}\n\n- (void)didEndDisplayingCell:(UICollectionViewCell *)cell\n              forListAdapter:(IGListAdapter *)listAdapter\n           sectionController:(IGListSectionController *)sectionController\n                   indexPath:(NSIndexPath *)indexPath {\n    // if cell display events break, don't send cell events to the displayDelegate when the object has disappeared\n    id object = [self _pluckObjectForView:cell];\n    if (object == nil) {\n        return;\n    }\n\n    [sectionController.displayDelegate listAdapter:listAdapter didEndDisplayingSectionController:sectionController cell:cell atIndex:indexPath.item];\n    [self _didEndDisplayingReusableView:cell forListAdapter:listAdapter sectionController:sectionController object:object indexPath:indexPath];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListReloadIndexPath.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An object with index path information for reloading an item during a batch update.\n */\nIGLK_SUBCLASSING_RESTRICTED\n@interface IGListReloadIndexPath : NSObject\n\n/**\n The index path of the item before batch updates are applied.\n */\n@property (nonatomic, strong, readonly) NSIndexPath *fromIndexPath;\n\n/**\n The index path of the item after batch updates are applied.\n */\n@property (nonatomic, strong, readonly) NSIndexPath *toIndexPath;\n\n/**\n Creates a new reload object.\n\n @param fromIndexPath The index path of the item before batch updates.\n @param toIndexPath The index path of the item after batch updates.\n @return A new reload object.\n */\n- (instancetype)initWithFromIndexPath:(NSIndexPath *)fromIndexPath\n                          toIndexPath:(NSIndexPath *)toIndexPath NS_DESIGNATED_INITIALIZER;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListReloadIndexPath.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListReloadIndexPath.h\"\n\n@implementation IGListReloadIndexPath\n\n- (instancetype)initWithFromIndexPath:(NSIndexPath *)fromIndexPath\n                          toIndexPath:(NSIndexPath *)toIndexPath {\n    if (self = [super init]) {\n        _fromIndexPath = fromIndexPath;\n        _toIndexPath = toIndexPath;\n    }\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListSectionControllerInternal.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListSectionController.h\"\n\nFOUNDATION_EXTERN void IGListSectionControllerPushThread(UIViewController *viewController, id<IGListCollectionContext> collectionContext);\n\nFOUNDATION_EXTERN void IGListSectionControllerPopThread(void);\n\n@interface IGListSectionController()\n\n@property (nonatomic, weak, readwrite) id<IGListCollectionContext> collectionContext;\n\n@property (nonatomic, weak, readwrite) UIViewController *viewController;\n\n@property (nonatomic, assign, readwrite) NSInteger section;\n\n@property (nonatomic, assign, readwrite) BOOL isFirstSection;\n\n@property (nonatomic, assign, readwrite) BOOL isLastSection;\n\n/*\n Provides a way for specialized section controllers (like the stacked section controller) to reject invalid moves\n */\n- (BOOL)canMoveItemAtIndex:(NSInteger)sourceItemIndex toIndex:(NSInteger)destinationItemIndex;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListSectionMap+DebugDescription.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import \"IGListSectionMap.h\"\n\n@interface IGListSectionMap (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListSectionMap+DebugDescription.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListSectionMap+DebugDescription.h\"\n\n#import \"IGListBindingSectionController.h\"\n\n@implementation IGListSectionMap (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines {\n    NSMutableArray *debug = [NSMutableArray new];\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\n    [self enumerateUsingBlock:^(id object, IGListSectionController *sectionController, NSInteger section, BOOL *stop) {\n        if ([sectionController isKindOfClass:[IGListBindingSectionController class]]) {\n            [debug addObject:[sectionController debugDescription]];\n        } else {\n            [debug addObject:[NSString stringWithFormat:@\"Object and section controller at section: %li:\", (long)section]];\n            [debug addObject:[NSString stringWithFormat:@\"  %@\", object]];\n            [debug addObject:[NSString stringWithFormat:@\"  %@\", sectionController]];\n        }\n    }];\n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n    return debug;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListSectionMap.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n#import <IGListDiffKit/IGListMacros.h>\n\n@class IGListSectionController;\n\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The IGListSectionMap provides a way to map a collection of objects to a collection of section controllers and achieve\n constant-time lookups O(1).\n\n IGListSectionMap is a mutable object and does not guarantee thread safety.\n */\nIGLK_SUBCLASSING_RESTRICTED\n@interface IGListSectionMap : NSObject <NSCopying>\n\n- (instancetype)initWithMapTable:(NSMapTable *)mapTable NS_DESIGNATED_INITIALIZER;\n\n/**\n The objects stored in the map.\n */\n@property (nonatomic, strong, readonly) NSArray *objects;\n\n/**\n Update the map with objects and the section controller counterparts.\n\n @param objects The objects in the collection.\n @param sectionControllers The section controllers that map to each object.\n */\n- (void)updateWithObjects:(NSArray <id <NSObject>> *)objects sectionControllers:(NSArray <IGListSectionController *> *)sectionControllers;\n\n/**\n Fetch a section controller given a section.\n\n @param section The section index of the section controller.\n\n @return A section controller.\n */\n- (nullable IGListSectionController *)sectionControllerForSection:(NSInteger)section;\n\n/**\n Fetch the object for a section\n\n @param section The section index of the object.\n\n @return The object corresponding to the section.\n */\n- (nullable id)objectForSection:(NSInteger)section;\n\n/**\n Fetch a section controller given an object. Can return nil.\n\n @param object The object that maps to a section controller.\n\n @return A section controller.\n */\n- (nullable id)sectionControllerForObject:(id)object;\n\n/**\n Look up the section index for a section controller.\n\n @param sectionController The list to look up.\n\n @return The section index of the given section controller if it exists, NSNotFound otherwise.\n */\n- (NSInteger)sectionForSectionController:(id)sectionController;\n\n/**\n Look up the section index for an object.\n\n @param object The object to look up.\n\n @return The section index of the given object if it exists, NSNotFound otherwise.\n */\n- (NSInteger)sectionForObject:(id)object;\n\n/**\n Remove all saved objects and section controllers.\n */\n- (void)reset;\n\n/**\n Update an object with a new instance.\n */\n- (void)updateObject:(id)object;\n\n/**\n Applies a given block object to the entries of the section controller map.\n\n @param block A block object to operate on entries in the section controller map.\n */\n- (void)enumerateUsingBlock:(void (^)(id object, IGListSectionController *sectionController, NSInteger section, BOOL *stop))block;\n\n/**\n :nodoc:\n */\n- (instancetype)init NS_UNAVAILABLE;\n\n/**\n :nodoc:\n */\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListSectionMap.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListSectionMap.h\"\n\n#import <IGListDiffKit/IGListAssert.h>\n\n#import \"IGListSectionControllerInternal.h\"\n\n@interface IGListSectionMap ()\n\n// both of these maps allow fast lookups of objects, list objects, and indexes\n@property (nonatomic, strong, readonly, nonnull) NSMapTable<id, IGListSectionController *> *objectToSectionControllerMap;\n@property (nonatomic, strong, readonly, nonnull) NSMapTable<IGListSectionController *, NSNumber *> *sectionControllerToSectionMap;\n\n@property (nonatomic, strong, nonnull) NSMutableArray *mObjects;\n\n@end\n\n@implementation IGListSectionMap\n\n- (instancetype)initWithMapTable:(NSMapTable *)mapTable {\n    IGParameterAssert(mapTable != nil);\n\n    if (self = [super init]) {\n        _objectToSectionControllerMap = [mapTable copy];\n\n        // lookup list objects by pointer equality\n        _sectionControllerToSectionMap = [[NSMapTable alloc] initWithKeyOptions:NSMapTableStrongMemory | NSMapTableObjectPointerPersonality\n                                                                   valueOptions:NSMapTableStrongMemory\n                                                                       capacity:0];\n        _mObjects = [NSMutableArray new];\n    }\n    return self;\n}\n\n\n#pragma mark - Public API\n\n- (NSArray *)objects {\n    return [self.mObjects copy];\n}\n\n- (NSInteger)sectionForSectionController:(IGListSectionController *)sectionController {\n    IGParameterAssert(sectionController != nil);\n\n    NSNumber *index = [self.sectionControllerToSectionMap objectForKey:sectionController];\n    return index != nil ? [index integerValue] : NSNotFound;\n}\n\n- (IGListSectionController *)sectionControllerForSection:(NSInteger)section {\n    return [self.objectToSectionControllerMap objectForKey:[self objectForSection:section]];\n}\n\n- (void)updateWithObjects:(NSArray *)objects sectionControllers:(NSArray *)sectionControllers {\n    IGParameterAssert(objects.count == sectionControllers.count);\n\n    [self reset];\n\n    self.mObjects = [objects mutableCopy];\n\n    id firstObject = objects.firstObject;\n    id lastObject = objects.lastObject;\n\n    [objects enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL *stop) {\n        IGListSectionController *sectionController = sectionControllers[idx];\n\n        // set the index of the list for easy reverse lookup\n        [self.sectionControllerToSectionMap setObject:@(idx) forKey:sectionController];\n        [self.objectToSectionControllerMap setObject:sectionController forKey:object];\n\n        sectionController.isFirstSection = (object == firstObject);\n        sectionController.isLastSection = (object == lastObject);\n        sectionController.section = (NSInteger)idx;\n    }];\n}\n\n- (nullable IGListSectionController *)sectionControllerForObject:(id)object {\n    IGParameterAssert(object != nil);\n\n    return [self.objectToSectionControllerMap objectForKey:object];\n}\n\n- (nullable id)objectForSection:(NSInteger)section {\n    NSArray *objects = self.mObjects;\n    if (section < objects.count) {\n        return objects[section];\n    } else {\n        return nil;\n    }\n}\n\n- (NSInteger)sectionForObject:(id)object {\n    IGParameterAssert(object != nil);\n\n    id sectionController = [self sectionControllerForObject:object];\n    if (sectionController == nil) {\n        return NSNotFound;\n    } else {\n        return [self sectionForSectionController:sectionController];\n    }\n}\n\n- (void)reset {\n    [self enumerateUsingBlock:^(id  _Nonnull object, IGListSectionController * _Nonnull sectionController, NSInteger section, BOOL * _Nonnull stop) {\n        sectionController.section = NSNotFound;\n        sectionController.isFirstSection = NO;\n        sectionController.isLastSection = NO;\n    }];\n\n    [self.sectionControllerToSectionMap removeAllObjects];\n    [self.objectToSectionControllerMap removeAllObjects];\n}\n\n- (void)updateObject:(id)object {\n    IGParameterAssert(object != nil);\n    const NSInteger section = [self sectionForObject:object];\n    id sectionController = [self sectionControllerForObject:object];\n    [self.sectionControllerToSectionMap setObject:@(section) forKey:sectionController];\n    [self.objectToSectionControllerMap setObject:sectionController forKey:object];\n    self.mObjects[section] = object;\n}\n\n- (void)enumerateUsingBlock:(void (^)(id object, IGListSectionController *sectionController, NSInteger section, BOOL *stop))block {\n    IGParameterAssert(block != nil);\n\n    BOOL stop = NO;\n    NSArray *objects = self.objects;\n    for (NSInteger section = 0; section < objects.count; section++) {\n        id object = objects[section];\n        IGListSectionController *sectionController = [self sectionControllerForObject:object];\n        block(object, sectionController, section, &stop);\n        if (stop) {\n            break;\n        }\n    }\n}\n\n\n#pragma mark - NSCopying\n\n- (id)copyWithZone:(NSZone *)zone {\n    IGListSectionMap *copy = [[IGListSectionMap allocWithZone:zone] initWithMapTable:self.objectToSectionControllerMap];\n    if (copy != nil) {\n        copy->_sectionControllerToSectionMap = [self.sectionControllerToSectionMap copy];\n        copy->_mObjects = [self.mObjects mutableCopy];\n    }\n    return copy;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListWorkingRangeHandler.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <Foundation/Foundation.h>\n\n@class IGListAdapter;\n\n@interface IGListWorkingRangeHandler : NSObject\n\n/**\n Initializes the working range handler.\n\n @param workingRangeSize the number of sections beyond the visible viewport that should be considered within the working\n range. Applies equally in both directions above and below the viewport.\n */\n- (instancetype)initWithWorkingRangeSize:(NSInteger)workingRangeSize;\n\n/**\n Tells the handler that a cell will be displayed in the IGListKit infra.\n\n @param indexPath The index path of the cell in the UICollectionView.\n @param listAdapter The adapter managing the infra.\n */\n- (void)willDisplayItemAtIndexPath:(NSIndexPath *)indexPath\n                    forListAdapter:(IGListAdapter *)listAdapter;\n\n/**\n Tells the handler that a cell did end display in the IGListKit infra.\n\n @param indexPath The index path of the cell in the UICollectionView.\n @param listAdapter The adapter managing the infra.\n */\n- (void)didEndDisplayingItemAtIndexPath:(NSIndexPath *)indexPath\n                         forListAdapter:(IGListAdapter *)listAdapter;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/IGListWorkingRangeHandler.mm",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"IGListWorkingRangeHandler.h\"\n\n#import <set>\n#import <unordered_set>\n\n#import <IGListDiffKit/IGListAssert.h>\n#import <IGListKit/IGListAdapter.h>\n#import <IGListKit/IGListSectionController.h>\n\nstruct _IGListWorkingRangeHandlerIndexPath {\n    NSInteger section;\n    NSInteger row;\n    size_t hash;\n\n    bool operator==(const _IGListWorkingRangeHandlerIndexPath &other) const {\n        return (section == other.section && row == other.row);\n    }\n};\n\nstruct _IGListWorkingRangeHandlerSectionControllerWrapper {\n    IGListSectionController *sectionController;\n\n    bool operator==(const _IGListWorkingRangeHandlerSectionControllerWrapper &other) const {\n        return (sectionController == other.sectionController);\n    }\n};\n\nstruct _IGListWorkingRangeHandlerIndexPathHash {\n    size_t operator()(const _IGListWorkingRangeHandlerIndexPath& o) const {\n        return (size_t)o.hash;\n    }\n};\n\nstruct _IGListWorkingRangeHashID {\n    size_t operator()(const _IGListWorkingRangeHandlerSectionControllerWrapper &o) const {\n        return (size_t)[o.sectionController hash];\n    }\n};\n\ntypedef std::unordered_set<_IGListWorkingRangeHandlerSectionControllerWrapper, _IGListWorkingRangeHashID> _IGListWorkingRangeSectionControllerSet;\ntypedef std::unordered_set<_IGListWorkingRangeHandlerIndexPath, _IGListWorkingRangeHandlerIndexPathHash> _IGListWorkingRangeIndexPathSet;\n\n@interface IGListWorkingRangeHandler ()\n\n@property (nonatomic, assign, readonly) NSInteger workingRangeSize;\n\n@end\n\n@implementation IGListWorkingRangeHandler {\n    _IGListWorkingRangeIndexPathSet _visibleSectionIndices;\n    _IGListWorkingRangeSectionControllerSet _workingRangeSectionControllers;\n}\n\n- (instancetype)initWithWorkingRangeSize:(NSInteger)workingRangeSize {\n    if (self = [super init]) {\n        _workingRangeSize = workingRangeSize;\n    }\n    return self;\n}\n\n- (void)willDisplayItemAtIndexPath:(NSIndexPath *)indexPath\n                    forListAdapter:(IGListAdapter *)listAdapter {\n    IGParameterAssert(indexPath != nil);\n    IGParameterAssert(listAdapter != nil);\n\n    _visibleSectionIndices.insert({\n        .section = indexPath.section,\n        .row = indexPath.row,\n        .hash = indexPath.hash\n    });\n\n    [self _updateWorkingRangesWithListAdapter:listAdapter];\n}\n\n- (void)didEndDisplayingItemAtIndexPath:(NSIndexPath *)indexPath\n                         forListAdapter:(IGListAdapter *)listAdapter {\n    IGParameterAssert(indexPath != nil);\n    IGParameterAssert(listAdapter != nil);\n\n    _visibleSectionIndices.erase({\n        .section = indexPath.section,\n        .row = indexPath.row,\n        .hash = indexPath.hash\n    });\n\n    [self _updateWorkingRangesWithListAdapter:listAdapter];\n}\n\n#pragma mark - Working Ranges\n\n- (void)_updateWorkingRangesWithListAdapter:(IGListAdapter *)listAdapter {\n    IGAssertMainThread();\n    // This method is optimized C++ to improve straight-line speed of these operations. Change at your peril.\n\n    // We use a std::set because it is ordered.\n    std::set<NSInteger> visibleSectionSet = std::set<NSInteger>();\n    for (const _IGListWorkingRangeHandlerIndexPath &indexPath : _visibleSectionIndices) {\n        visibleSectionSet.insert(indexPath.section);\n    }\n\n    NSInteger start;\n    NSInteger end;\n    if (visibleSectionSet.size() == 0) {\n        // We're now devoid of any visible sections. Bail\n        start = 0;\n        end = 0;\n    } else {\n        start = MAX(*visibleSectionSet.begin() - _workingRangeSize, 0);\n        end = MIN(*visibleSectionSet.rbegin() + 1 + _workingRangeSize, (NSInteger)listAdapter.objects.count);\n    }\n\n    // Build the current set of working range section controllers\n    _IGListWorkingRangeSectionControllerSet workingRangeSectionControllers (visibleSectionSet.size());\n    for (NSInteger idx = start; idx < end; idx++) {\n        id item = [listAdapter objectAtSection:idx];\n        IGListSectionController *sectionController = [listAdapter sectionControllerForObject:item];\n        workingRangeSectionControllers.insert({sectionController});\n    }\n\n    IGAssert(workingRangeSectionControllers.size() < 1000, @\"This algorithm is way too slow with so many objects:%lu\", workingRangeSectionControllers.size());\n\n    // Tell any new section controllers that they have entered the working range\n    for (const _IGListWorkingRangeHandlerSectionControllerWrapper &wrapper : workingRangeSectionControllers) {\n        // Check if the item exists in the old working range item array.\n        auto it = _workingRangeSectionControllers.find(wrapper);\n        if (it == _workingRangeSectionControllers.end()) {\n            // The section controller isn't in the existing list, so it's new.\n            id <IGListWorkingRangeDelegate> workingRangeDelegate = wrapper.sectionController.workingRangeDelegate;\n            [workingRangeDelegate listAdapter:listAdapter sectionControllerWillEnterWorkingRange:wrapper.sectionController];\n        }\n    }\n\n    // Tell any removed section controllers that they have exited the working range\n    for (const _IGListWorkingRangeHandlerSectionControllerWrapper &wrapper : _workingRangeSectionControllers) {\n        // Check if the item exists in the new list of section controllers\n        auto it = workingRangeSectionControllers.find(wrapper);\n        if (it == workingRangeSectionControllers.end()) {\n            // If the item does not exist in the new list, then it's been removed.\n            id <IGListWorkingRangeDelegate> workingRangeDelegate = wrapper.sectionController.workingRangeDelegate;\n            [workingRangeDelegate listAdapter:listAdapter sectionControllerDidExitWorkingRange:wrapper.sectionController];\n        }\n    }\n\n    _workingRangeSectionControllers = workingRangeSectionControllers;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UICollectionView+DebugDescription.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@interface UICollectionView (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UICollectionView+DebugDescription.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"UICollectionView+DebugDescription.h\"\n\n#import <IGListDiffKit/IGListMacros.h>\n\n@implementation UICollectionView (DebugDescription)\n\n- (NSArray<NSString *> *)debugDescriptionLines {\n    NSMutableArray *debug = [NSMutableArray new];\n#if IGLK_DEBUG_DESCRIPTION_ENABLED\n    [debug addObject:[NSString stringWithFormat:@\"Class: %@, instance: %p\", NSStringFromClass(self.class), self]];\n    [debug addObject:[NSString stringWithFormat:@\"Data source: %@\", self.dataSource]];\n    [debug addObject:[NSString stringWithFormat:@\"Delegate: %@\", self.delegate]];\n    [debug addObject:[NSString stringWithFormat:@\"Layout: %@\", self.collectionViewLayout]];\n    [debug addObject:[NSString stringWithFormat:@\"Frame: %@, bounds: %@\",\n                      NSStringFromCGRect(self.frame), NSStringFromCGRect(self.bounds)]];\n\n    const NSInteger sections = [self numberOfSections];\n    [debug addObject:[NSString stringWithFormat:@\"Number of sections: %lld\", (long long)sections]];\n\n    for (NSInteger section = 0; section < sections; section++) {\n        [debug addObject:[NSString stringWithFormat:@\"  %lld items in section %lld\",\n                          (long long)[self numberOfItemsInSection:section], (long long)section]];\n    }\n\n    [debug addObject:@\"Visible cell details:\"];\n    NSArray *visibleIndexPaths = [[self indexPathsForVisibleItems] sortedArrayUsingSelector:@selector(compare:)];\n    for (NSIndexPath *path in visibleIndexPaths) {\n        [debug addObject:[NSString stringWithFormat:@\"  Visible cell at section %lld, item %lld:\",\n         (long long)path.section, (long long)path.item]];\n        [debug addObject:[NSString stringWithFormat:@\"  %@\", [[self cellForItemAtIndexPath:path] description] ?: @\"\"]];\n    }\n#endif // #if IGLK_DEBUG_DESCRIPTION_ENABLED\n    return debug;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UICollectionView+IGListBatchUpdateData.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@class IGListBatchUpdateData;\n\n@interface UICollectionView (IGListBatchUpdateData)\n\n- (void)ig_applyBatchUpdateData:(IGListBatchUpdateData *)updateData;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UICollectionView+IGListBatchUpdateData.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"UICollectionView+IGListBatchUpdateData.h\"\n\n#import <IGListDiffKit/IGListBatchUpdateData.h>\n\n@implementation UICollectionView (IGListBatchUpdateData)\n\n- (void)ig_applyBatchUpdateData:(IGListBatchUpdateData *)updateData {    \n    [self deleteItemsAtIndexPaths:updateData.deleteIndexPaths];\n    [self insertItemsAtIndexPaths:updateData.insertIndexPaths];\n    [self reloadItemsAtIndexPaths:updateData.updateIndexPaths];\n\n    for (IGListMoveIndexPath *move in updateData.moveIndexPaths) {\n        [self moveItemAtIndexPath:move.from toIndexPath:move.to];\n    }\n\n    for (IGListMoveIndex *move in updateData.moveSections) {\n        [self moveSection:move.from toSection:move.to];\n    }\n\n    [self deleteSections:updateData.deleteSections];\n    [self insertSections:updateData.insertSections];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n#import <IGListKit/IGListAdapter.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UICollectionViewLayout (InteractiveReordering)\n\n- (void)ig_hijackLayoutInteractiveReorderingMethodForAdapter:(IGListAdapter *)adapter;\n\n- (nullable NSIndexPath *)updatedTargetForInteractivelyMovingItem:(NSIndexPath *)previousIndexPath\n                                                      toIndexPath:(NSIndexPath *)originalTarget\n                                                          adapter:(IGListAdapter *)adapter;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"UICollectionViewLayout+InteractiveReordering.h\"\n\n#import <objc/runtime.h>\n\n#import <IGListKit/IGListAdapterInternal.h>\n#import <IGListKit/IGListSectionController.h>\n\n@implementation UICollectionViewLayout (InteractiveReordering)\n\nstatic void * kIGListAdapterKey = &kIGListAdapterKey;\n\n+ (void)load\n{\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        Class layoutClass = [self class];\n\n        // override implementation for targetIndexPathForInteractivelyMovingItem:withPosition:\n        SEL userMoveSelector = @selector(targetIndexPathForInteractivelyMovingItem:withPosition:);\n        SEL overrideSelector = @selector(ig_targetIndexPathForInteractivelyMovingItem:withPosition:);\n        Method userLayoutMethod = class_getInstanceMethod(layoutClass, userMoveSelector);\n        Method overrideLayoutMethod = class_getInstanceMethod(layoutClass, overrideSelector);\n        method_exchangeImplementations(userLayoutMethod, overrideLayoutMethod);\n\n        // override implementation for\n        // invalidationContextForInteractivelyMovingItems:withTargetPosition:previousIndexPaths:previousPosition:\n        SEL userInvalidationSelector =\n        @selector(invalidationContextForInteractivelyMovingItems:withTargetPosition:previousIndexPaths:previousPosition:);\n        SEL overrideInvalidationSelector =\n        @selector(ig_invalidationContextForInteractivelyMovingItems:withTargetPosition:previousIndexPaths:previousPosition:);\n        Method userInvalidationMethod = class_getInstanceMethod(layoutClass, userInvalidationSelector);\n        Method overrideInvalidationMethod = class_getInstanceMethod(layoutClass, overrideInvalidationSelector);\n        method_exchangeImplementations(userInvalidationMethod, overrideInvalidationMethod);\n\n        // override implementation for\n        // invalidationContextForInteractivelyMovingItems:withTargetPosition:previousIndexPaths:previousPosition:\n        SEL userEndInvalidationSelector =\n        @selector(invalidationContextForEndingInteractiveMovementOfItemsToFinalIndexPaths:previousIndexPaths:movementCancelled:);\n        SEL overrideEndInvalidationSelector =\n        @selector(ig_invalidationContextForEndingInteractiveMovementOfItemsToFinalIndexPaths:previousIndexPaths:movementCancelled:);\n        Method userEndInvalidationMethod = class_getInstanceMethod(layoutClass, userEndInvalidationSelector);\n        Method overrideEndInvalidationMethod = class_getInstanceMethod(layoutClass, overrideEndInvalidationSelector);\n        method_exchangeImplementations(userEndInvalidationMethod, overrideEndInvalidationMethod);\n    });\n}\n\n- (void)ig_hijackLayoutInteractiveReorderingMethodForAdapter:(IGListAdapter *)adapter {\n    objc_setAssociatedObject(self, kIGListAdapterKey, adapter, OBJC_ASSOCIATION_ASSIGN);\n}\n\n- (NSIndexPath *)ig_targetIndexPathForInteractivelyMovingItem:(NSIndexPath *)previousIndexPath\n                                                 withPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0) {\n    // call looks recursive, but through swizzling is calling the original implementation for\n    // targetIndexPathForInteractivelyMovingItem:withPosition:\n    NSIndexPath *originalTarget = [self ig_targetIndexPathForInteractivelyMovingItem:previousIndexPath\n                                                                        withPosition:position];\n\n    IGListAdapter *adapter = (IGListAdapter *)objc_getAssociatedObject(self, kIGListAdapterKey);\n    if (adapter == nil) {\n        return originalTarget;\n    }\n\n    NSIndexPath *updatedTarget = [self updatedTargetForInteractivelyMovingItem:previousIndexPath\n                                                                   toIndexPath:originalTarget\n                                                                       adapter:adapter];\n    if (updatedTarget) {\n        return updatedTarget;\n    }\n    return originalTarget;\n}\n\n- (nullable NSIndexPath *)updatedTargetForInteractivelyMovingItem:(NSIndexPath *)previousIndexPath\n                                                      toIndexPath:(NSIndexPath *)originalTarget\n                                                          adapter:(IGListAdapter *)adapter {\n    const NSInteger sourceSectionIndex = previousIndexPath.section;\n    NSInteger destinationSectionIndex = originalTarget.section;\n    NSInteger destinationItemIndex = originalTarget.item;\n\n    IGListSectionController *sourceSectionController = [adapter sectionControllerForSection:sourceSectionIndex];\n    IGListSectionController *destinationSectionController = [adapter sectionControllerForSection:destinationSectionIndex];\n\n    adapter.isLastInteractiveMoveToLastSectionIndex = NO;\n\n    // this is a reordering of sections themselves\n    if ([sourceSectionController numberOfItems] == 1\n        && [destinationSectionController numberOfItems] == 1) {\n\n        if (destinationItemIndex == 1) {\n            // the \"item\" representing our section was dropped\n            // into the end of a destination section rather than the beginning\n            // so it really belongs one section after the section where it landed\n            if (destinationSectionIndex < [[adapter objects] count] - 1) {\n                destinationSectionIndex += 1;\n                destinationItemIndex = 0;\n            }\n            else {\n                // if we're moving an item to the last spot, our index would exceed the number of sections available\n                // so we have to special case this scenario. iOS doesnt allow an item move to \"create\" a new section\n                adapter.isLastInteractiveMoveToLastSectionIndex = YES;\n            }\n            NSIndexPath *updatedTarget = [NSIndexPath indexPathForItem:destinationItemIndex\n                                                             inSection:destinationSectionIndex];\n            return updatedTarget;\n        }\n    }\n\n    return nil;\n}\n\n- (UICollectionViewLayoutInvalidationContext *)ig_invalidationContextForInteractivelyMovingItems:(NSArray<NSIndexPath *> *)targetIndexPaths withTargetPosition:(CGPoint)targetPosition previousIndexPaths:(NSArray<NSIndexPath *> *)previousIndexPaths previousPosition:(CGPoint)previousPosition {\n\n    // call looks recursive, but through swizzling is calling the original implementation for\n    // invalidationContextForInteractivelyMovingItems:withTargetPosition:previousIndexPaths:previousPosition:\n    UICollectionViewLayoutInvalidationContext *originalContext =\n    [self ig_invalidationContextForInteractivelyMovingItems:targetIndexPaths withTargetPosition:targetPosition previousIndexPaths:previousIndexPaths previousPosition:previousPosition];\n\n    return [self ig_cleanupInvalidationContext:originalContext];\n}\n\n- (UICollectionViewLayoutInvalidationContext *)ig_invalidationContextForEndingInteractiveMovementOfItemsToFinalIndexPaths:(NSArray<NSIndexPath *> *)indexPaths previousIndexPaths:(NSArray<NSIndexPath *> *)previousIndexPaths movementCancelled:(BOOL)movementCancelled {\n\n    // call looks recursive, but through swizzling is calling the original implementation for\n    // invalidationContextForEndingInteractiveMovementOfItemsToFinalIndexPaths:previousIndexPaths:movementCancelled:\n    UICollectionViewLayoutInvalidationContext *originalContext =\n    [self ig_invalidationContextForEndingInteractiveMovementOfItemsToFinalIndexPaths:indexPaths previousIndexPaths:previousIndexPaths movementCancelled:movementCancelled];\n\n    return [self ig_cleanupInvalidationContext:originalContext];\n}\n\n- (UICollectionViewLayoutInvalidationContext *)ig_cleanupInvalidationContext:(UICollectionViewLayoutInvalidationContext *)originalContext {\n    IGListAdapter *adapter = (IGListAdapter *)objc_getAssociatedObject(self, kIGListAdapterKey);\n    if (adapter == nil || !self.collectionView) {\n        return originalContext;\n    }\n\n    const NSInteger numSections = [adapter numberOfSectionsInCollectionView:(UICollectionView * _Nonnull)self.collectionView];\n\n    // protect against invalidating an index path that no longer exists\n    // (like item 1 in the last section after interactively reordering an item to the end of a list of 1 item sections)\n    if ([originalContext.invalidatedItemIndexPaths count] > 0) {\n        NSUInteger indexToRemove = NSNotFound;\n\n        indexToRemove = [originalContext.invalidatedItemIndexPaths indexOfObjectPassingTest:\n                         ^BOOL(NSIndexPath * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n                             if (obj.section == numSections-1) {\n                                 IGListSectionController *section = [adapter sectionControllerForSection:obj.section];\n                                 return obj.item > [section numberOfItems] - 1;\n                             }\n                             return NO;\n                         }];\n\n        if (indexToRemove != NSNotFound) {\n            NSMutableArray<NSIndexPath *> *invalidatedItemIndexPaths = [originalContext.invalidatedItemIndexPaths mutableCopy];\n            [invalidatedItemIndexPaths removeObjectAtIndex:indexToRemove];\n\n            UICollectionViewLayoutInvalidationContext *modifiedContext;\n            if ([originalContext isKindOfClass:[UICollectionViewFlowLayoutInvalidationContext class]]) {\n                // UICollectionViewFlowLayout has a special invalidation context subclass\n                UICollectionViewFlowLayoutInvalidationContext *flowModifiedContext =\n                [[self.class invalidationContextClass] new];\n\n                flowModifiedContext.invalidateFlowLayoutDelegateMetrics =\n                [(UICollectionViewFlowLayoutInvalidationContext *)originalContext invalidateFlowLayoutDelegateMetrics];\n                flowModifiedContext.invalidateFlowLayoutAttributes =\n                [(UICollectionViewFlowLayoutInvalidationContext *)originalContext invalidateFlowLayoutAttributes];\n                modifiedContext = flowModifiedContext;\n            }\n            else {\n                modifiedContext = [[self.class invalidationContextClass] new];\n            }\n\n            [modifiedContext invalidateItemsAtIndexPaths:invalidatedItemIndexPaths];\n            [originalContext.invalidatedSupplementaryIndexPaths enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSArray<NSIndexPath *> * _Nonnull obj, BOOL * _Nonnull stop) {\n                [modifiedContext invalidateSupplementaryElementsOfKind:key atIndexPaths:obj];\n            }];\n            [originalContext.invalidatedDecorationIndexPaths enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSArray<NSIndexPath *> * _Nonnull obj, BOOL * _Nonnull stop) {\n                [modifiedContext invalidateDecorationElementsOfKind:key atIndexPaths:obj];\n            }];\n            modifiedContext.contentOffsetAdjustment = originalContext.contentOffsetAdjustment;\n            modifiedContext.contentSizeAdjustment = originalContext.contentSizeAdjustment;\n\n            return modifiedContext;\n        }\n    }\n    return originalContext;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UIScrollView+IGListKit.h",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import <UIKit/UIKit.h>\n\n@interface UIScrollView (IGListKit)\n\n- (UIEdgeInsets) ig_contentInset;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit/Source/IGListKit/Internal/UIScrollView+IGListKit.m",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n#import \"UIScrollView+IGListKit.h\"\n\n@implementation UIScrollView (IGListKit)\n\n- (UIEdgeInsets) ig_contentInset\n{\n    if (@available(iOS 11.0, tvOS 11.0, *)) {\n        return self.adjustedContentInset;\n    } else {\n        return self.contentInset;\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/IGListKit.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t00D8EECF24D59CAE6154030BA3DEE195 /* IGListDisplayDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = AE34A0AC11A6284D61E5EAF57F9E57C3 /* IGListDisplayDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t01E08BBED18704A4E678834927B164E5 /* IGListAdapterUpdater+DebugDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 3823BF42DF59AC3C268857B0546BBCA7 /* IGListAdapterUpdater+DebugDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t05E830839CDD81941193D642966F6864 /* IGListBindingSectionController+DebugDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = E0A3CEF4643766F24AA02213CB3E6C35 /* IGListBindingSectionController+DebugDescription.m */; };\n\t\t0F46EF0FB383BD634788C36C2D4F1ED6 /* IGListSectionController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE90137D1998AFD99452896AF7752F74 /* IGListSectionController.m */; };\n\t\t10CE3BED45EF90FB47CA51EB6EAC1D79 /* IGListArrayUtilsInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = E218631DD6734D657BFF89EBFEB60448 /* IGListArrayUtilsInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t15A0C8B73D68C30CBEFC9CEF16F2B992 /* IGListKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C8EF76A697528EEEE488BFA0F17F976E /* IGListKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t19284AE6E0FDB4AF8BDCA70EF9E0643E /* IGListWorkingRangeHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 63B4F603D8F363926716C5F2B5CCB36D /* IGListWorkingRangeHandler.mm */; };\n\t\t20678F0AA5EF8C4561671341AB213C68 /* IGListAdapterProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 35DFC4D5B375DE3C895B43210C2BE673 /* IGListAdapterProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t20A54B8CA1D62C9EF31AE7FCFE7182EE /* IGListBatchUpdates.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6BC88735C17BB24434BF8B8E5632A5 /* IGListBatchUpdates.m */; };\n\t\t23267ACF6633F832FE1FC2A82A245D9D /* IGListWorkingRangeHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B7F61CD007007796F94020CB59EB5D7 /* IGListWorkingRangeHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t25E6E52F611840941C6872C7317D9A65 /* IGListDisplayHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 51A7A797C2B5DBE959ED812736F04428 /* IGListDisplayHandler.m */; };\n\t\t287F7998F968B6FD12D39728F40AAA69 /* IGListKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = E91AC57F25B02C5F13C48C6C219A19DD /* IGListKit-dummy.m */; };\n\t\t291AD3AD4B64C989D6FDD75EC62F4200 /* IGListBatchContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F93019F1AEF22C00D37A24D075C2547 /* IGListBatchContext.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2C7D33CB0026884D5530951A4B4984B9 /* IGListAdapterPerformanceDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FFE667515CBADE23A2B69C59523FE355 /* IGListAdapterPerformanceDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2CBC483648CD891B4A3D6B109EFABA9D /* IGListSectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = E747EFC2F632F73BA77481E4DC2D7319 /* IGListSectionController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2F96DECCD2172DBD1BD18453A7E4AB1C /* IGListDisplayHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 272436B4C13EB52FBF53B123511BFCB1 /* IGListDisplayHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t2FCE5208B5FE11B36A1D20CC76477FB6 /* IGListCollectionViewLayoutCompatible.h in Headers */ = {isa = PBXBuildFile; fileRef = 23078DECFA8BB459564DE91C02447890 /* IGListCollectionViewLayoutCompatible.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t31FBA3D8B80DF597DD2117DC1BCFFF94 /* IGListReloadIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 65A86458078CCBE07FFE2F5BC3C47896 /* IGListReloadIndexPath.m */; };\n\t\t339CC7529A1CB7845AF899CBEA59790F /* IGListGenericSectionController.m in Sources */ = {isa = PBXBuildFile; fileRef = 80CA79323A56DED063EAE61EFA39E9F3 /* IGListGenericSectionController.m */; };\n\t\t35C03326F9E7CF9BA971E04A887602EB /* IGListDebuggingUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 90AC138465BD599D3B2BCE89ACE1752F /* IGListDebuggingUtilities.m */; };\n\t\t3A768ABD7CC269A78CF22785F210F7FF /* UICollectionView+DebugDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 47832CBECE03B2C33D3359F6972931AA /* UICollectionView+DebugDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t3D906418205B53287328F5D82152FA80 /* IGListBindingSectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 52714997587F48C24307AB7612F9CACA /* IGListBindingSectionController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t408AB729D6ABE8A01FDD99D349B2E4A4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA25A968128B1BFB14311354D251F7D1 /* Foundation.framework */; };\n\t\t412DB79BB7685882ECE4CD783E71CD37 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59AB62FE4BF490C9328C66C5CEE03395 /* UIKit.framework */; };\n\t\t4B3027D1216593F18734639D31C08604 /* IGListBatchUpdateData+DebugDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = DEE1BAAF6A9AC27405491E3347C14D12 /* IGListBatchUpdateData+DebugDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5071DCE1BB0BDBB81A41A7209B244894 /* IGListCollectionViewLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = CC6A0EDB95C12A26BFC07918A04339C2 /* IGListCollectionViewLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t524050F4143C30DCB448E3BB23F2751A /* IGListDebugger.m in Sources */ = {isa = PBXBuildFile; fileRef = 81846F252C9F2B471F26A812A1BC9EF7 /* IGListDebugger.m */; };\n\t\t54C9547BF6E7ABED2DDF80223B397E46 /* IGListAdapterMoveDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E7B4A287CD4489BA03728A7DC45CB480 /* IGListAdapterMoveDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5894D82734BCC132943F8D499303DE0A /* IGListBindingSectionControllerDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD9621C062F9C79A1DB0C4F0BA938B0 /* IGListBindingSectionControllerDataSource.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t590EB8DCC56FE067F14A7B45059C075C /* IGListCollectionViewLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = C628A8F96DB565469E515C8CCFCCB2E4 /* IGListCollectionViewLayout.mm */; };\n\t\t59CE90BD34A5275CDC7455692A8A3AF7 /* IGListSectionMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CC8A7F4FC5AF76CFFC2870E5385584A /* IGListSectionMap.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t5C81F6CF7FFF93C6FB11D58A8FDF3DB1 /* UICollectionViewLayout+InteractiveReordering.m in Sources */ = {isa = PBXBuildFile; fileRef = D5D41058691CD6A374A28AF4A5BCD6FD /* UICollectionViewLayout+InteractiveReordering.m */; };\n\t\t5CC045F50E7344D52F71E5187FB32A5D /* IGListBindingSectionControllerSelectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 380B9E1EC70CC3CA70EE0CE16B01AEE7 /* IGListBindingSectionControllerSelectionDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5F010BCB98B62E7DE25D4D01374DB423 /* IGListAdapterUpdaterInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = B930E3CD5DCECBC66891E0558197AE59 /* IGListAdapterUpdaterInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t66FC7655431ABAD92264A53171185724 /* IGListScrollDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 193B3D5854467EF50B686347B1288E60 /* IGListScrollDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t68056A58BB6CF71C0A261C82AB3D669F /* IGListAdapterDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 1426A8FE1BC8DA4B32B7311E1A6D4FF6 /* IGListAdapterDataSource.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6B1234AB83FF379FDC1653BA17121B73 /* IGListKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D0F6937220581929145C8B1B88CB4E51 /* IGListKit.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6BBA17D852117737A603C569AF074B5A /* IGListMoveIndexPathInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F287B0FF878E91B396F91CED8FB839 /* IGListMoveIndexPathInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t6D1F1FE148B459962FFB42635226E94A /* IGListIndexSetResultInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A54EB092063A06A598C0122BFF9D57 /* IGListIndexSetResultInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t6DE7CB794E88B822088773BABFBF83FF /* IGListAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 94F1D3844203726DA391D556D63191D5 /* IGListAdapter.m */; };\n\t\t6F90C02A0D0907BFFA5AE716BA58C90C /* IGListCollectionContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1A7A4E91924FB53983A7A3F0CD180B /* IGListCollectionContext.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t700AC00EFE11C06134A2DB32F0A5D6ED /* IGListAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 16908C4157F8C939FEE87B682394BC24 /* IGListAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t72C668484EB6F1E848B2787D395AB2A5 /* IGListAdapterDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 063A5988DABE4EFB6204EA3889A71ADB /* IGListAdapterDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t748999B5A01BDCDCB77E3BD60E49032C /* IGListAdapter+DebugDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DD4DED4A41189E3AE046E7B533D8C38 /* IGListAdapter+DebugDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t796B55F2170B8924B08FB1DF05BA09C6 /* IGListAdapterUpdaterDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FC8F99BB50EF1E40D2CA9EB4B6D34154 /* IGListAdapterUpdaterDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t837EF61F55713CA43E12FB6B8466E968 /* IGListReloadIndexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = CB4C7DD12F6A1855F89DE78D766AAA47 /* IGListReloadIndexPath.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t83D3CCECB9B772B5FC138B355AFE296D /* IGListIndexPathResultInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1350853F608218FBFE4BE1D84B950959 /* IGListIndexPathResultInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t85A10A32F13940714AE26AC7C8C4CDA2 /* UICollectionView+DebugDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = FA74A7979C82186A27B1A519E4AD79CB /* UICollectionView+DebugDescription.m */; };\n\t\t8964079800CA53BC7D0BE36413B1DA74 /* IGListBindingSectionController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC08D98EDCA81E34988B1E3E10B10348 /* IGListBindingSectionController.m */; };\n\t\t89FE92DBAF2183E4E65D5F78144331AA /* IGListCollectionScrollingTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 698190404480FED32681B4B5A3E55073 /* IGListCollectionScrollingTraits.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t968CFE27158615D5E5CE548459C40B5D /* IGListReloadDataUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = C2870D9D95104F5E65B2E13A46B22841 /* IGListReloadDataUpdater.m */; };\n\t\t9D674BE6F590F50914DEED68A3B7356D /* IGListAdapterUpdateListener.h in Headers */ = {isa = PBXBuildFile; fileRef = F6BF1C47ECB0912C3C500A94B5C5D140 /* IGListAdapterUpdateListener.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t9DA4EDCC87D1BD54E00F1849385B85EF /* IGListBatchUpdates.h in Headers */ = {isa = PBXBuildFile; fileRef = F72279261964733411540354FFE149F6 /* IGListBatchUpdates.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t9EDCC6FAA805C232557FB79DFB57DF7C /* IGListSectionMap+DebugDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 7FCADB39D5D4A99CF546F760FFFEEF61 /* IGListSectionMap+DebugDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tA02F17211658A92A69072350AFF7DD5F /* IGListDebuggingUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 5AE5852C99446C693B3D65FE32DE4054 /* IGListDebuggingUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tA3DCFBA9C5CD86C0704EFF03583B8900 /* IGListAdapter+DebugDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = 56086A29B27DE75D5A5EC7391825121C /* IGListAdapter+DebugDescription.m */; };\n\t\tA4CEF1AF773B6C67B57BD262391E0967 /* IGListSupplementaryViewSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 5250DF799124CFF01B7C8670AD305E52 /* IGListSupplementaryViewSource.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA61C1E6A4819E8FCF03053272B28E932 /* IGListTransitionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = ECBE67B083E813F8DC6E24C82BB83337 /* IGListTransitionDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA9D5B3D28EA5A5240821D109F5330919 /* IGListSectionControllerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 17708A1E8A80310069268E74C94EADBF /* IGListSectionControllerInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tACBA45C9A25507999B8F6FD03B270640 /* IGListBindingSectionController+DebugDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0AAB5D5FB600A592F32F757A8A42BA /* IGListBindingSectionController+DebugDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tB17CAEC48975381B521BB00AC3FA7688 /* IGListReloadDataUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A187F8E56255E0F0098361E1DF22A48 /* IGListReloadDataUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB6B10A8366E9F8CA95134F7FB5249B4B /* UICollectionView+IGListBatchUpdateData.h in Headers */ = {isa = PBXBuildFile; fileRef = E9045CCCDD512318ACEFEDDEA7FC5273 /* UICollectionView+IGListBatchUpdateData.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tB6FB268940FA4EB7426D9133A435A929 /* IGListGenericSectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = CEE80663C4D17068D06E64D3C13957A7 /* IGListGenericSectionController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB73068D4B3550EA0D7CA9A0960345C2B /* IGListBatchUpdateState.h in Headers */ = {isa = PBXBuildFile; fileRef = 81FAEBD87499AF65CC01B5043590F3A8 /* IGListBatchUpdateState.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tB994A61DF8AA246F263DD558728ADD71 /* IGListMoveIndexInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 62472F10BDA8D0CF1909B47DCEDB6041 /* IGListMoveIndexInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tBCF304EE58DBDBE7EB3860FE310B2C17 /* IGListAdapterUpdater+DebugDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = BC21B2C17D19027AC026ABB728721743 /* IGListAdapterUpdater+DebugDescription.m */; };\n\t\tC369067B04D5A03F396B35C1B070B603 /* IGListAdapter+UICollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = ABE0E4BD8B3D9A057E119D6024A9B7F9 /* IGListAdapter+UICollectionView.m */; };\n\t\tC6D659ED98FD91D6250BADADEC070190 /* IGListAdapterProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 97733A8BA453D5D4E25FB83EBA2B3961 /* IGListAdapterProxy.m */; };\n\t\tC8A13466974B3313D9B432CD82A83D0C /* UIScrollView+IGListKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C642F80CE617AEFB32CCA1186D59B6 /* UIScrollView+IGListKit.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tCAB21CB8CF3C59BAFC9A4FD68A810E39 /* UIScrollView+IGListKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D34987D98EC88A8DB5E128B8132443D /* UIScrollView+IGListKit.m */; };\n\t\tCB455F74F02B72C8692C1B389DAFD7DE /* IGListBindable.h in Headers */ = {isa = PBXBuildFile; fileRef = A62EEB3D608E944C7C3E292536A0B1D7 /* IGListBindable.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCD27C095B2D32203F0968C687FAA923C /* IGListAdapterUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = AD022F2E6AE27ACB3AF6EFDD734C5D68 /* IGListAdapterUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCEAB8C388D8DA8702987EE293B5D1340 /* IGListAdapter+UICollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 688296734A654AFD9960993818B27084 /* IGListAdapter+UICollectionView.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tCFA2DB1D9E4A741C47E055809F672853 /* IGListBatchUpdateData+DebugDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = EBADECFA857960F2329E14AC278DC7F9 /* IGListBatchUpdateData+DebugDescription.m */; };\n\t\tD111876D68620B70CD8DADBC808E397A /* UICollectionViewLayout+InteractiveReordering.h in Headers */ = {isa = PBXBuildFile; fileRef = 4494EE211F18FF3CBB86A10485F6B66B /* UICollectionViewLayout+InteractiveReordering.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tD150E49F4D65F964BF5F92CAC59855FF /* IGListCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B6A39C929A3E81DFF85DB578EC6D015 /* IGListCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD2ADEA8C2074604A21B513E30EA8ACA3 /* IGListSingleSectionController.m in Sources */ = {isa = PBXBuildFile; fileRef = 438474C77ECC1664F1BEE4EFD0BAD336 /* IGListSingleSectionController.m */; };\n\t\tD41DE3B1749E169822B166F1E26329A1 /* UICollectionView+IGListBatchUpdateData.m in Sources */ = {isa = PBXBuildFile; fileRef = 53F7FD263036347D36767921EE34E92D /* UICollectionView+IGListBatchUpdateData.m */; };\n\t\tD5D5819079EBA2A4AF83B670C09A5E24 /* IGListWorkingRangeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 59CFD541C9E1C7C9846907FD5B135F9A /* IGListWorkingRangeDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD940E0F5D90FF644A16219A2BACDC8DF /* IGListSingleSectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = DCBBC230FB9736A95CEBB36DCBBC55ED /* IGListSingleSectionController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD9ECF466EF530ACCB864BEB10ED2C656 /* IGListDebugger.h in Headers */ = {isa = PBXBuildFile; fileRef = FFCF97DA06E2CA95E0D391278754AFD7 /* IGListDebugger.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tDA31EB23253AD08E7EF77B30238828FA /* IGListCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 392727C2C656BBDBAA108A13947A9A63 /* IGListCollectionView.m */; };\n\t\tDDC86B48AAE2538DAB200D9FF8073E1E /* IGListAdapterUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6C88E72428CCA3F9D53A7C6A5E4255 /* IGListAdapterUpdater.m */; };\n\t\tDEB4FB4540A43D6B3CC2F22928887B3C /* IGListCollectionViewDelegateLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D38245CA903B41DD85BF637375D2A97 /* IGListCollectionViewDelegateLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDFC34C6C22A62E979CE48965DC7EC019 /* IGListAdapterInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 03BF964D9ADFF1437056716D779AAB09 /* IGListAdapterInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tE7185EC5ECC56BE56BB4890D7392A8C9 /* IGListSectionMap.m in Sources */ = {isa = PBXBuildFile; fileRef = D9728425465E444E5B6B43474BDE4A4E /* IGListSectionMap.m */; };\n\t\tF26498A7A947D54EB8A8800A6CFB0786 /* IGListCollectionViewLayoutInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 19E44DA2D0BF454144CFBB68316E4166 /* IGListCollectionViewLayoutInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tF94A8C7A4C3360D6C237C0EAAD133CDA /* IGListUpdatingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E72DD50A0DEFCD99CC89213D0E98C41 /* IGListUpdatingDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFB2C0646EF20359B5DD30DE172CF8BF2 /* IGListSectionMap+DebugDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = 832301249C38E290714D95EEF53FB3A8 /* IGListSectionMap+DebugDescription.m */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t62FF8776F5035EB9D871C3BBF79FB2E5 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 68BB7FFF06B526B638EAF3987F64CB1C /* IGListDiffKit.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 9074A5DFB260E6240F743D74D3F432DD;\n\t\t\tremoteInfo = IGListDiffKit;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t017682A1559F97D4B1A82EFCD9B40A09 /* IGListKit */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IGListKit; path = IGListKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t03BF964D9ADFF1437056716D779AAB09 /* IGListAdapterInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterInternal.h; path = Source/IGListKit/Internal/IGListAdapterInternal.h; sourceTree = \"<group>\"; };\n\t\t063A5988DABE4EFB6204EA3889A71ADB /* IGListAdapterDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterDelegate.h; path = Source/IGListKit/IGListAdapterDelegate.h; sourceTree = \"<group>\"; };\n\t\t099850C93EBB6DD568CC066921A40594 /* IGListKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"IGListKit-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t0E72DD50A0DEFCD99CC89213D0E98C41 /* IGListUpdatingDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListUpdatingDelegate.h; path = Source/IGListKit/IGListUpdatingDelegate.h; sourceTree = \"<group>\"; };\n\t\t1350853F608218FBFE4BE1D84B950959 /* IGListIndexPathResultInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListIndexPathResultInternal.h; path = Source/IGListDiffKit/Internal/IGListIndexPathResultInternal.h; sourceTree = \"<group>\"; };\n\t\t1426A8FE1BC8DA4B32B7311E1A6D4FF6 /* IGListAdapterDataSource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterDataSource.h; path = Source/IGListKit/IGListAdapterDataSource.h; sourceTree = \"<group>\"; };\n\t\t16908C4157F8C939FEE87B682394BC24 /* IGListAdapter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapter.h; path = Source/IGListKit/IGListAdapter.h; sourceTree = \"<group>\"; };\n\t\t17708A1E8A80310069268E74C94EADBF /* IGListSectionControllerInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListSectionControllerInternal.h; path = Source/IGListKit/Internal/IGListSectionControllerInternal.h; sourceTree = \"<group>\"; };\n\t\t193B3D5854467EF50B686347B1288E60 /* IGListScrollDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListScrollDelegate.h; path = Source/IGListKit/IGListScrollDelegate.h; sourceTree = \"<group>\"; };\n\t\t19E44DA2D0BF454144CFBB68316E4166 /* IGListCollectionViewLayoutInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCollectionViewLayoutInternal.h; path = Source/IGListKit/Internal/IGListCollectionViewLayoutInternal.h; sourceTree = \"<group>\"; };\n\t\t1AD9621C062F9C79A1DB0C4F0BA938B0 /* IGListBindingSectionControllerDataSource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBindingSectionControllerDataSource.h; path = Source/IGListKit/IGListBindingSectionControllerDataSource.h; sourceTree = \"<group>\"; };\n\t\t23078DECFA8BB459564DE91C02447890 /* IGListCollectionViewLayoutCompatible.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCollectionViewLayoutCompatible.h; path = Source/IGListKit/IGListCollectionViewLayoutCompatible.h; sourceTree = \"<group>\"; };\n\t\t272436B4C13EB52FBF53B123511BFCB1 /* IGListDisplayHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListDisplayHandler.h; path = Source/IGListKit/Internal/IGListDisplayHandler.h; sourceTree = \"<group>\"; };\n\t\t28A54EB092063A06A598C0122BFF9D57 /* IGListIndexSetResultInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListIndexSetResultInternal.h; path = Source/IGListDiffKit/Internal/IGListIndexSetResultInternal.h; sourceTree = \"<group>\"; };\n\t\t35DFC4D5B375DE3C895B43210C2BE673 /* IGListAdapterProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterProxy.h; path = Source/IGListKit/Internal/IGListAdapterProxy.h; sourceTree = \"<group>\"; };\n\t\t380B9E1EC70CC3CA70EE0CE16B01AEE7 /* IGListBindingSectionControllerSelectionDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBindingSectionControllerSelectionDelegate.h; path = Source/IGListKit/IGListBindingSectionControllerSelectionDelegate.h; sourceTree = \"<group>\"; };\n\t\t3823BF42DF59AC3C268857B0546BBCA7 /* IGListAdapterUpdater+DebugDescription.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"IGListAdapterUpdater+DebugDescription.h\"; path = \"Source/IGListKit/Internal/IGListAdapterUpdater+DebugDescription.h\"; sourceTree = \"<group>\"; };\n\t\t392727C2C656BBDBAA108A13947A9A63 /* IGListCollectionView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListCollectionView.m; path = Source/IGListKit/IGListCollectionView.m; sourceTree = \"<group>\"; };\n\t\t3CC8A7F4FC5AF76CFFC2870E5385584A /* IGListSectionMap.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListSectionMap.h; path = Source/IGListKit/Internal/IGListSectionMap.h; sourceTree = \"<group>\"; };\n\t\t3F93019F1AEF22C00D37A24D075C2547 /* IGListBatchContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBatchContext.h; path = Source/IGListKit/IGListBatchContext.h; sourceTree = \"<group>\"; };\n\t\t438474C77ECC1664F1BEE4EFD0BAD336 /* IGListSingleSectionController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListSingleSectionController.m; path = Source/IGListKit/IGListSingleSectionController.m; sourceTree = \"<group>\"; };\n\t\t4494EE211F18FF3CBB86A10485F6B66B /* UICollectionViewLayout+InteractiveReordering.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UICollectionViewLayout+InteractiveReordering.h\"; path = \"Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.h\"; sourceTree = \"<group>\"; };\n\t\t47832CBECE03B2C33D3359F6972931AA /* UICollectionView+DebugDescription.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UICollectionView+DebugDescription.h\"; path = \"Source/IGListKit/Internal/UICollectionView+DebugDescription.h\"; sourceTree = \"<group>\"; };\n\t\t4B6BC88735C17BB24434BF8B8E5632A5 /* IGListBatchUpdates.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListBatchUpdates.m; path = Source/IGListKit/Internal/IGListBatchUpdates.m; sourceTree = \"<group>\"; };\n\t\t4DD4DED4A41189E3AE046E7B533D8C38 /* IGListAdapter+DebugDescription.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"IGListAdapter+DebugDescription.h\"; path = \"Source/IGListKit/Internal/IGListAdapter+DebugDescription.h\"; sourceTree = \"<group>\"; };\n\t\t51A7A797C2B5DBE959ED812736F04428 /* IGListDisplayHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListDisplayHandler.m; path = Source/IGListKit/Internal/IGListDisplayHandler.m; sourceTree = \"<group>\"; };\n\t\t5250DF799124CFF01B7C8670AD305E52 /* IGListSupplementaryViewSource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListSupplementaryViewSource.h; path = Source/IGListKit/IGListSupplementaryViewSource.h; sourceTree = \"<group>\"; };\n\t\t52714997587F48C24307AB7612F9CACA /* IGListBindingSectionController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBindingSectionController.h; path = Source/IGListKit/IGListBindingSectionController.h; sourceTree = \"<group>\"; };\n\t\t53F7FD263036347D36767921EE34E92D /* UICollectionView+IGListBatchUpdateData.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UICollectionView+IGListBatchUpdateData.m\"; path = \"Source/IGListKit/Internal/UICollectionView+IGListBatchUpdateData.m\"; sourceTree = \"<group>\"; };\n\t\t56086A29B27DE75D5A5EC7391825121C /* IGListAdapter+DebugDescription.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"IGListAdapter+DebugDescription.m\"; path = \"Source/IGListKit/Internal/IGListAdapter+DebugDescription.m\"; sourceTree = \"<group>\"; };\n\t\t562F1B0AFBC215CCD48168B2F1BA5114 /* IGListKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IGListKit.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t59AB62FE4BF490C9328C66C5CEE03395 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };\n\t\t59CFD541C9E1C7C9846907FD5B135F9A /* IGListWorkingRangeDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListWorkingRangeDelegate.h; path = Source/IGListKit/IGListWorkingRangeDelegate.h; sourceTree = \"<group>\"; };\n\t\t5AE5852C99446C693B3D65FE32DE4054 /* IGListDebuggingUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListDebuggingUtilities.h; path = Source/IGListKit/Internal/IGListDebuggingUtilities.h; sourceTree = \"<group>\"; };\n\t\t5D1A7A4E91924FB53983A7A3F0CD180B /* IGListCollectionContext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCollectionContext.h; path = Source/IGListKit/IGListCollectionContext.h; sourceTree = \"<group>\"; };\n\t\t5D34987D98EC88A8DB5E128B8132443D /* UIScrollView+IGListKit.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIScrollView+IGListKit.m\"; path = \"Source/IGListKit/Internal/UIScrollView+IGListKit.m\"; sourceTree = \"<group>\"; };\n\t\t5D38245CA903B41DD85BF637375D2A97 /* IGListCollectionViewDelegateLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCollectionViewDelegateLayout.h; path = Source/IGListKit/IGListCollectionViewDelegateLayout.h; sourceTree = \"<group>\"; };\n\t\t62472F10BDA8D0CF1909B47DCEDB6041 /* IGListMoveIndexInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListMoveIndexInternal.h; path = Source/IGListDiffKit/Internal/IGListMoveIndexInternal.h; sourceTree = \"<group>\"; };\n\t\t63B4F603D8F363926716C5F2B5CCB36D /* IGListWorkingRangeHandler.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = IGListWorkingRangeHandler.mm; path = Source/IGListKit/Internal/IGListWorkingRangeHandler.mm; sourceTree = \"<group>\"; };\n\t\t65A86458078CCBE07FFE2F5BC3C47896 /* IGListReloadIndexPath.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListReloadIndexPath.m; path = Source/IGListKit/Internal/IGListReloadIndexPath.m; sourceTree = \"<group>\"; };\n\t\t688296734A654AFD9960993818B27084 /* IGListAdapter+UICollectionView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"IGListAdapter+UICollectionView.h\"; path = \"Source/IGListKit/Internal/IGListAdapter+UICollectionView.h\"; sourceTree = \"<group>\"; };\n\t\t68BB7FFF06B526B638EAF3987F64CB1C /* IGListDiffKit */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = IGListDiffKit; path = IGListDiffKit.xcodeproj; sourceTree = \"<group>\"; };\n\t\t698190404480FED32681B4B5A3E55073 /* IGListCollectionScrollingTraits.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCollectionScrollingTraits.h; path = Source/IGListKit/IGListCollectionScrollingTraits.h; sourceTree = \"<group>\"; };\n\t\t6A187F8E56255E0F0098361E1DF22A48 /* IGListReloadDataUpdater.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListReloadDataUpdater.h; path = Source/IGListKit/IGListReloadDataUpdater.h; sourceTree = \"<group>\"; };\n\t\t71F287B0FF878E91B396F91CED8FB839 /* IGListMoveIndexPathInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListMoveIndexPathInternal.h; path = Source/IGListDiffKit/Internal/IGListMoveIndexPathInternal.h; sourceTree = \"<group>\"; };\n\t\t7FCADB39D5D4A99CF546F760FFFEEF61 /* IGListSectionMap+DebugDescription.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"IGListSectionMap+DebugDescription.h\"; path = \"Source/IGListKit/Internal/IGListSectionMap+DebugDescription.h\"; sourceTree = \"<group>\"; };\n\t\t80CA79323A56DED063EAE61EFA39E9F3 /* IGListGenericSectionController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListGenericSectionController.m; path = Source/IGListKit/IGListGenericSectionController.m; sourceTree = \"<group>\"; };\n\t\t81846F252C9F2B471F26A812A1BC9EF7 /* IGListDebugger.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListDebugger.m; path = Source/IGListKit/Internal/IGListDebugger.m; sourceTree = \"<group>\"; };\n\t\t81FAEBD87499AF65CC01B5043590F3A8 /* IGListBatchUpdateState.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBatchUpdateState.h; path = Source/IGListKit/Internal/IGListBatchUpdateState.h; sourceTree = \"<group>\"; };\n\t\t82B3FEA19DB6F2D790DB5E72DE9BEAC0 /* IGListKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IGListKit.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t832301249C38E290714D95EEF53FB3A8 /* IGListSectionMap+DebugDescription.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"IGListSectionMap+DebugDescription.m\"; path = \"Source/IGListKit/Internal/IGListSectionMap+DebugDescription.m\"; sourceTree = \"<group>\"; };\n\t\t8C6C88E72428CCA3F9D53A7C6A5E4255 /* IGListAdapterUpdater.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListAdapterUpdater.m; path = Source/IGListKit/IGListAdapterUpdater.m; sourceTree = \"<group>\"; };\n\t\t90AC138465BD599D3B2BCE89ACE1752F /* IGListDebuggingUtilities.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListDebuggingUtilities.m; path = Source/IGListKit/Internal/IGListDebuggingUtilities.m; sourceTree = \"<group>\"; };\n\t\t94F1D3844203726DA391D556D63191D5 /* IGListAdapter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListAdapter.m; path = Source/IGListKit/IGListAdapter.m; sourceTree = \"<group>\"; };\n\t\t97733A8BA453D5D4E25FB83EBA2B3961 /* IGListAdapterProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListAdapterProxy.m; path = Source/IGListKit/Internal/IGListAdapterProxy.m; sourceTree = \"<group>\"; };\n\t\t97C642F80CE617AEFB32CCA1186D59B6 /* UIScrollView+IGListKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIScrollView+IGListKit.h\"; path = \"Source/IGListKit/Internal/UIScrollView+IGListKit.h\"; sourceTree = \"<group>\"; };\n\t\t9B6A39C929A3E81DFF85DB578EC6D015 /* IGListCollectionView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCollectionView.h; path = Source/IGListKit/IGListCollectionView.h; sourceTree = \"<group>\"; };\n\t\t9B7F61CD007007796F94020CB59EB5D7 /* IGListWorkingRangeHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListWorkingRangeHandler.h; path = Source/IGListKit/Internal/IGListWorkingRangeHandler.h; sourceTree = \"<group>\"; };\n\t\tA62EEB3D608E944C7C3E292536A0B1D7 /* IGListBindable.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBindable.h; path = Source/IGListKit/IGListBindable.h; sourceTree = \"<group>\"; };\n\t\tABE0E4BD8B3D9A057E119D6024A9B7F9 /* IGListAdapter+UICollectionView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"IGListAdapter+UICollectionView.m\"; path = \"Source/IGListKit/Internal/IGListAdapter+UICollectionView.m\"; sourceTree = \"<group>\"; };\n\t\tAD022F2E6AE27ACB3AF6EFDD734C5D68 /* IGListAdapterUpdater.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterUpdater.h; path = Source/IGListKit/IGListAdapterUpdater.h; sourceTree = \"<group>\"; };\n\t\tAE34A0AC11A6284D61E5EAF57F9E57C3 /* IGListDisplayDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListDisplayDelegate.h; path = Source/IGListKit/IGListDisplayDelegate.h; sourceTree = \"<group>\"; };\n\t\tB930E3CD5DCECBC66891E0558197AE59 /* IGListAdapterUpdaterInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterUpdaterInternal.h; path = Source/IGListKit/Internal/IGListAdapterUpdaterInternal.h; sourceTree = \"<group>\"; };\n\t\tBC08D98EDCA81E34988B1E3E10B10348 /* IGListBindingSectionController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListBindingSectionController.m; path = Source/IGListKit/IGListBindingSectionController.m; sourceTree = \"<group>\"; };\n\t\tBC0AAB5D5FB600A592F32F757A8A42BA /* IGListBindingSectionController+DebugDescription.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"IGListBindingSectionController+DebugDescription.h\"; path = \"Source/IGListKit/Internal/IGListBindingSectionController+DebugDescription.h\"; sourceTree = \"<group>\"; };\n\t\tBC21B2C17D19027AC026ABB728721743 /* IGListAdapterUpdater+DebugDescription.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"IGListAdapterUpdater+DebugDescription.m\"; path = \"Source/IGListKit/Internal/IGListAdapterUpdater+DebugDescription.m\"; sourceTree = \"<group>\"; };\n\t\tBF8F661B3B9DCBA4CF0A93E5AE3253FE /* IGListKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IGListKit.modulemap; sourceTree = \"<group>\"; };\n\t\tC2870D9D95104F5E65B2E13A46B22841 /* IGListReloadDataUpdater.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListReloadDataUpdater.m; path = Source/IGListKit/IGListReloadDataUpdater.m; sourceTree = \"<group>\"; };\n\t\tC628A8F96DB565469E515C8CCFCCB2E4 /* IGListCollectionViewLayout.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = IGListCollectionViewLayout.mm; path = Source/IGListKit/IGListCollectionViewLayout.mm; sourceTree = \"<group>\"; };\n\t\tC8EF76A697528EEEE488BFA0F17F976E /* IGListKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"IGListKit-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tCB4C7DD12F6A1855F89DE78D766AAA47 /* IGListReloadIndexPath.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListReloadIndexPath.h; path = Source/IGListKit/Internal/IGListReloadIndexPath.h; sourceTree = \"<group>\"; };\n\t\tCC6A0EDB95C12A26BFC07918A04339C2 /* IGListCollectionViewLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListCollectionViewLayout.h; path = Source/IGListKit/IGListCollectionViewLayout.h; sourceTree = \"<group>\"; };\n\t\tCE90137D1998AFD99452896AF7752F74 /* IGListSectionController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListSectionController.m; path = Source/IGListKit/IGListSectionController.m; sourceTree = \"<group>\"; };\n\t\tCEE80663C4D17068D06E64D3C13957A7 /* IGListGenericSectionController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListGenericSectionController.h; path = Source/IGListKit/IGListGenericSectionController.h; sourceTree = \"<group>\"; };\n\t\tD0F6937220581929145C8B1B88CB4E51 /* IGListKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListKit.h; path = Source/IGListKit/IGListKit.h; sourceTree = \"<group>\"; };\n\t\tD5D41058691CD6A374A28AF4A5BCD6FD /* UICollectionViewLayout+InteractiveReordering.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UICollectionViewLayout+InteractiveReordering.m\"; path = \"Source/IGListKit/Internal/UICollectionViewLayout+InteractiveReordering.m\"; sourceTree = \"<group>\"; };\n\t\tD9728425465E444E5B6B43474BDE4A4E /* IGListSectionMap.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IGListSectionMap.m; path = Source/IGListKit/Internal/IGListSectionMap.m; sourceTree = \"<group>\"; };\n\t\tDA25A968128B1BFB14311354D251F7D1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tDCBBC230FB9736A95CEBB36DCBBC55ED /* IGListSingleSectionController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListSingleSectionController.h; path = Source/IGListKit/IGListSingleSectionController.h; sourceTree = \"<group>\"; };\n\t\tDEE1BAAF6A9AC27405491E3347C14D12 /* IGListBatchUpdateData+DebugDescription.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"IGListBatchUpdateData+DebugDescription.h\"; path = \"Source/IGListKit/Internal/IGListBatchUpdateData+DebugDescription.h\"; sourceTree = \"<group>\"; };\n\t\tE0A3CEF4643766F24AA02213CB3E6C35 /* IGListBindingSectionController+DebugDescription.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"IGListBindingSectionController+DebugDescription.m\"; path = \"Source/IGListKit/Internal/IGListBindingSectionController+DebugDescription.m\"; sourceTree = \"<group>\"; };\n\t\tE1D8E9CC1E713664772DEE930321C3F7 /* IGListKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"IGListKit-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tE218631DD6734D657BFF89EBFEB60448 /* IGListArrayUtilsInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListArrayUtilsInternal.h; path = Source/IGListKit/Internal/IGListArrayUtilsInternal.h; sourceTree = \"<group>\"; };\n\t\tE747EFC2F632F73BA77481E4DC2D7319 /* IGListSectionController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListSectionController.h; path = Source/IGListKit/IGListSectionController.h; sourceTree = \"<group>\"; };\n\t\tE7B4A287CD4489BA03728A7DC45CB480 /* IGListAdapterMoveDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterMoveDelegate.h; path = Source/IGListKit/IGListAdapterMoveDelegate.h; sourceTree = \"<group>\"; };\n\t\tE9045CCCDD512318ACEFEDDEA7FC5273 /* UICollectionView+IGListBatchUpdateData.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UICollectionView+IGListBatchUpdateData.h\"; path = \"Source/IGListKit/Internal/UICollectionView+IGListBatchUpdateData.h\"; sourceTree = \"<group>\"; };\n\t\tE91AC57F25B02C5F13C48C6C219A19DD /* IGListKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"IGListKit-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tEBADECFA857960F2329E14AC278DC7F9 /* IGListBatchUpdateData+DebugDescription.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"IGListBatchUpdateData+DebugDescription.m\"; path = \"Source/IGListKit/Internal/IGListBatchUpdateData+DebugDescription.m\"; sourceTree = \"<group>\"; };\n\t\tECBE67B083E813F8DC6E24C82BB83337 /* IGListTransitionDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListTransitionDelegate.h; path = Source/IGListKit/IGListTransitionDelegate.h; sourceTree = \"<group>\"; };\n\t\tF6BF1C47ECB0912C3C500A94B5C5D140 /* IGListAdapterUpdateListener.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterUpdateListener.h; path = Source/IGListKit/IGListAdapterUpdateListener.h; sourceTree = \"<group>\"; };\n\t\tF72279261964733411540354FFE149F6 /* IGListBatchUpdates.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListBatchUpdates.h; path = Source/IGListKit/Internal/IGListBatchUpdates.h; sourceTree = \"<group>\"; };\n\t\tFA74A7979C82186A27B1A519E4AD79CB /* UICollectionView+DebugDescription.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UICollectionView+DebugDescription.m\"; path = \"Source/IGListKit/Internal/UICollectionView+DebugDescription.m\"; sourceTree = \"<group>\"; };\n\t\tFC8F99BB50EF1E40D2CA9EB4B6D34154 /* IGListAdapterUpdaterDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterUpdaterDelegate.h; path = Source/IGListKit/IGListAdapterUpdaterDelegate.h; sourceTree = \"<group>\"; };\n\t\tFFCF97DA06E2CA95E0D391278754AFD7 /* IGListDebugger.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListDebugger.h; path = Source/IGListKit/Internal/IGListDebugger.h; sourceTree = \"<group>\"; };\n\t\tFFE667515CBADE23A2B69C59523FE355 /* IGListAdapterPerformanceDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = IGListAdapterPerformanceDelegate.h; path = Source/IGListKit/IGListAdapterPerformanceDelegate.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tDEC09E6BD01E73B616D6EB3CE41AF16E /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t408AB729D6ABE8A01FDD99D349B2E4A4 /* Foundation.framework in Frameworks */,\n\t\t\t\t412DB79BB7685882ECE4CD783E71CD37 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2321ADD6EE282B76CD0B58A7E9FE6734 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t68BB7FFF06B526B638EAF3987F64CB1C /* IGListDiffKit */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t50C8EC082A9D41F0D2FAFA252A2D4CAA /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBF8F661B3B9DCBA4CF0A93E5AE3253FE /* IGListKit.modulemap */,\n\t\t\t\tE91AC57F25B02C5F13C48C6C219A19DD /* IGListKit-dummy.m */,\n\t\t\t\t099850C93EBB6DD568CC066921A40594 /* IGListKit-Info.plist */,\n\t\t\t\tE1D8E9CC1E713664772DEE930321C3F7 /* IGListKit-prefix.pch */,\n\t\t\t\tC8EF76A697528EEEE488BFA0F17F976E /* IGListKit-umbrella.h */,\n\t\t\t\t562F1B0AFBC215CCD48168B2F1BA5114 /* IGListKit.debug.xcconfig */,\n\t\t\t\t82B3FEA19DB6F2D790DB5E72DE9BEAC0 /* IGListKit.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/IGListKit\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t72A30D2CF979C03B7F1EF23616514CF0 /* IGListKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t16908C4157F8C939FEE87B682394BC24 /* IGListAdapter.h */,\n\t\t\t\t94F1D3844203726DA391D556D63191D5 /* IGListAdapter.m */,\n\t\t\t\t4DD4DED4A41189E3AE046E7B533D8C38 /* IGListAdapter+DebugDescription.h */,\n\t\t\t\t56086A29B27DE75D5A5EC7391825121C /* IGListAdapter+DebugDescription.m */,\n\t\t\t\t688296734A654AFD9960993818B27084 /* IGListAdapter+UICollectionView.h */,\n\t\t\t\tABE0E4BD8B3D9A057E119D6024A9B7F9 /* IGListAdapter+UICollectionView.m */,\n\t\t\t\t1426A8FE1BC8DA4B32B7311E1A6D4FF6 /* IGListAdapterDataSource.h */,\n\t\t\t\t063A5988DABE4EFB6204EA3889A71ADB /* IGListAdapterDelegate.h */,\n\t\t\t\t03BF964D9ADFF1437056716D779AAB09 /* IGListAdapterInternal.h */,\n\t\t\t\tE7B4A287CD4489BA03728A7DC45CB480 /* IGListAdapterMoveDelegate.h */,\n\t\t\t\tFFE667515CBADE23A2B69C59523FE355 /* IGListAdapterPerformanceDelegate.h */,\n\t\t\t\t35DFC4D5B375DE3C895B43210C2BE673 /* IGListAdapterProxy.h */,\n\t\t\t\t97733A8BA453D5D4E25FB83EBA2B3961 /* IGListAdapterProxy.m */,\n\t\t\t\tF6BF1C47ECB0912C3C500A94B5C5D140 /* IGListAdapterUpdateListener.h */,\n\t\t\t\tAD022F2E6AE27ACB3AF6EFDD734C5D68 /* IGListAdapterUpdater.h */,\n\t\t\t\t8C6C88E72428CCA3F9D53A7C6A5E4255 /* IGListAdapterUpdater.m */,\n\t\t\t\t3823BF42DF59AC3C268857B0546BBCA7 /* IGListAdapterUpdater+DebugDescription.h */,\n\t\t\t\tBC21B2C17D19027AC026ABB728721743 /* IGListAdapterUpdater+DebugDescription.m */,\n\t\t\t\tFC8F99BB50EF1E40D2CA9EB4B6D34154 /* IGListAdapterUpdaterDelegate.h */,\n\t\t\t\tB930E3CD5DCECBC66891E0558197AE59 /* IGListAdapterUpdaterInternal.h */,\n\t\t\t\tE218631DD6734D657BFF89EBFEB60448 /* IGListArrayUtilsInternal.h */,\n\t\t\t\t3F93019F1AEF22C00D37A24D075C2547 /* IGListBatchContext.h */,\n\t\t\t\tDEE1BAAF6A9AC27405491E3347C14D12 /* IGListBatchUpdateData+DebugDescription.h */,\n\t\t\t\tEBADECFA857960F2329E14AC278DC7F9 /* IGListBatchUpdateData+DebugDescription.m */,\n\t\t\t\tF72279261964733411540354FFE149F6 /* IGListBatchUpdates.h */,\n\t\t\t\t4B6BC88735C17BB24434BF8B8E5632A5 /* IGListBatchUpdates.m */,\n\t\t\t\t81FAEBD87499AF65CC01B5043590F3A8 /* IGListBatchUpdateState.h */,\n\t\t\t\tA62EEB3D608E944C7C3E292536A0B1D7 /* IGListBindable.h */,\n\t\t\t\t52714997587F48C24307AB7612F9CACA /* IGListBindingSectionController.h */,\n\t\t\t\tBC08D98EDCA81E34988B1E3E10B10348 /* IGListBindingSectionController.m */,\n\t\t\t\tBC0AAB5D5FB600A592F32F757A8A42BA /* IGListBindingSectionController+DebugDescription.h */,\n\t\t\t\tE0A3CEF4643766F24AA02213CB3E6C35 /* IGListBindingSectionController+DebugDescription.m */,\n\t\t\t\t1AD9621C062F9C79A1DB0C4F0BA938B0 /* IGListBindingSectionControllerDataSource.h */,\n\t\t\t\t380B9E1EC70CC3CA70EE0CE16B01AEE7 /* IGListBindingSectionControllerSelectionDelegate.h */,\n\t\t\t\t5D1A7A4E91924FB53983A7A3F0CD180B /* IGListCollectionContext.h */,\n\t\t\t\t698190404480FED32681B4B5A3E55073 /* IGListCollectionScrollingTraits.h */,\n\t\t\t\t9B6A39C929A3E81DFF85DB578EC6D015 /* IGListCollectionView.h */,\n\t\t\t\t392727C2C656BBDBAA108A13947A9A63 /* IGListCollectionView.m */,\n\t\t\t\t5D38245CA903B41DD85BF637375D2A97 /* IGListCollectionViewDelegateLayout.h */,\n\t\t\t\tCC6A0EDB95C12A26BFC07918A04339C2 /* IGListCollectionViewLayout.h */,\n\t\t\t\tC628A8F96DB565469E515C8CCFCCB2E4 /* IGListCollectionViewLayout.mm */,\n\t\t\t\t23078DECFA8BB459564DE91C02447890 /* IGListCollectionViewLayoutCompatible.h */,\n\t\t\t\t19E44DA2D0BF454144CFBB68316E4166 /* IGListCollectionViewLayoutInternal.h */,\n\t\t\t\tFFCF97DA06E2CA95E0D391278754AFD7 /* IGListDebugger.h */,\n\t\t\t\t81846F252C9F2B471F26A812A1BC9EF7 /* IGListDebugger.m */,\n\t\t\t\t5AE5852C99446C693B3D65FE32DE4054 /* IGListDebuggingUtilities.h */,\n\t\t\t\t90AC138465BD599D3B2BCE89ACE1752F /* IGListDebuggingUtilities.m */,\n\t\t\t\tAE34A0AC11A6284D61E5EAF57F9E57C3 /* IGListDisplayDelegate.h */,\n\t\t\t\t272436B4C13EB52FBF53B123511BFCB1 /* IGListDisplayHandler.h */,\n\t\t\t\t51A7A797C2B5DBE959ED812736F04428 /* IGListDisplayHandler.m */,\n\t\t\t\tCEE80663C4D17068D06E64D3C13957A7 /* IGListGenericSectionController.h */,\n\t\t\t\t80CA79323A56DED063EAE61EFA39E9F3 /* IGListGenericSectionController.m */,\n\t\t\t\t1350853F608218FBFE4BE1D84B950959 /* IGListIndexPathResultInternal.h */,\n\t\t\t\t28A54EB092063A06A598C0122BFF9D57 /* IGListIndexSetResultInternal.h */,\n\t\t\t\tD0F6937220581929145C8B1B88CB4E51 /* IGListKit.h */,\n\t\t\t\t62472F10BDA8D0CF1909B47DCEDB6041 /* IGListMoveIndexInternal.h */,\n\t\t\t\t71F287B0FF878E91B396F91CED8FB839 /* IGListMoveIndexPathInternal.h */,\n\t\t\t\t6A187F8E56255E0F0098361E1DF22A48 /* IGListReloadDataUpdater.h */,\n\t\t\t\tC2870D9D95104F5E65B2E13A46B22841 /* IGListReloadDataUpdater.m */,\n\t\t\t\tCB4C7DD12F6A1855F89DE78D766AAA47 /* IGListReloadIndexPath.h */,\n\t\t\t\t65A86458078CCBE07FFE2F5BC3C47896 /* IGListReloadIndexPath.m */,\n\t\t\t\t193B3D5854467EF50B686347B1288E60 /* IGListScrollDelegate.h */,\n\t\t\t\tE747EFC2F632F73BA77481E4DC2D7319 /* IGListSectionController.h */,\n\t\t\t\tCE90137D1998AFD99452896AF7752F74 /* IGListSectionController.m */,\n\t\t\t\t17708A1E8A80310069268E74C94EADBF /* IGListSectionControllerInternal.h */,\n\t\t\t\t3CC8A7F4FC5AF76CFFC2870E5385584A /* IGListSectionMap.h */,\n\t\t\t\tD9728425465E444E5B6B43474BDE4A4E /* IGListSectionMap.m */,\n\t\t\t\t7FCADB39D5D4A99CF546F760FFFEEF61 /* IGListSectionMap+DebugDescription.h */,\n\t\t\t\t832301249C38E290714D95EEF53FB3A8 /* IGListSectionMap+DebugDescription.m */,\n\t\t\t\tDCBBC230FB9736A95CEBB36DCBBC55ED /* IGListSingleSectionController.h */,\n\t\t\t\t438474C77ECC1664F1BEE4EFD0BAD336 /* IGListSingleSectionController.m */,\n\t\t\t\t5250DF799124CFF01B7C8670AD305E52 /* IGListSupplementaryViewSource.h */,\n\t\t\t\tECBE67B083E813F8DC6E24C82BB83337 /* IGListTransitionDelegate.h */,\n\t\t\t\t0E72DD50A0DEFCD99CC89213D0E98C41 /* IGListUpdatingDelegate.h */,\n\t\t\t\t59CFD541C9E1C7C9846907FD5B135F9A /* IGListWorkingRangeDelegate.h */,\n\t\t\t\t9B7F61CD007007796F94020CB59EB5D7 /* IGListWorkingRangeHandler.h */,\n\t\t\t\t63B4F603D8F363926716C5F2B5CCB36D /* IGListWorkingRangeHandler.mm */,\n\t\t\t\t47832CBECE03B2C33D3359F6972931AA /* UICollectionView+DebugDescription.h */,\n\t\t\t\tFA74A7979C82186A27B1A519E4AD79CB /* UICollectionView+DebugDescription.m */,\n\t\t\t\tE9045CCCDD512318ACEFEDDEA7FC5273 /* UICollectionView+IGListBatchUpdateData.h */,\n\t\t\t\t53F7FD263036347D36767921EE34E92D /* UICollectionView+IGListBatchUpdateData.m */,\n\t\t\t\t4494EE211F18FF3CBB86A10485F6B66B /* UICollectionViewLayout+InteractiveReordering.h */,\n\t\t\t\tD5D41058691CD6A374A28AF4A5BCD6FD /* UICollectionViewLayout+InteractiveReordering.m */,\n\t\t\t\t97C642F80CE617AEFB32CCA1186D59B6 /* UIScrollView+IGListKit.h */,\n\t\t\t\t5D34987D98EC88A8DB5E128B8132443D /* UIScrollView+IGListKit.m */,\n\t\t\t\t50C8EC082A9D41F0D2FAFA252A2D4CAA /* Support Files */,\n\t\t\t);\n\t\t\tname = IGListKit;\n\t\t\tpath = IGListKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t972FB1F3215716CBA8742AF423394F54 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2321ADD6EE282B76CD0B58A7E9FE6734 /* Dependencies */,\n\t\t\t\t97E1F7ECEAF7D5B088D961130DBE6316 /* Frameworks */,\n\t\t\t\t72A30D2CF979C03B7F1EF23616514CF0 /* IGListKit */,\n\t\t\t\tB727F9F06FDD92DE3FCEA5041DA1A12F /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t97E1F7ECEAF7D5B088D961130DBE6316 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF0113027A6AC3ABDB828CEB50D68D69D /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB727F9F06FDD92DE3FCEA5041DA1A12F /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t017682A1559F97D4B1A82EFCD9B40A09 /* IGListKit */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF0113027A6AC3ABDB828CEB50D68D69D /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDA25A968128B1BFB14311354D251F7D1 /* Foundation.framework */,\n\t\t\t\t59AB62FE4BF490C9328C66C5CEE03395 /* UIKit.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t95694B667489204AF5F823DAEA3681EB /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t700AC00EFE11C06134A2DB32F0A5D6ED /* IGListAdapter.h in Headers */,\n\t\t\t\t748999B5A01BDCDCB77E3BD60E49032C /* IGListAdapter+DebugDescription.h in Headers */,\n\t\t\t\tCEAB8C388D8DA8702987EE293B5D1340 /* IGListAdapter+UICollectionView.h in Headers */,\n\t\t\t\t68056A58BB6CF71C0A261C82AB3D669F /* IGListAdapterDataSource.h in Headers */,\n\t\t\t\t72C668484EB6F1E848B2787D395AB2A5 /* IGListAdapterDelegate.h in Headers */,\n\t\t\t\tDFC34C6C22A62E979CE48965DC7EC019 /* IGListAdapterInternal.h in Headers */,\n\t\t\t\t54C9547BF6E7ABED2DDF80223B397E46 /* IGListAdapterMoveDelegate.h in Headers */,\n\t\t\t\t2C7D33CB0026884D5530951A4B4984B9 /* IGListAdapterPerformanceDelegate.h in Headers */,\n\t\t\t\t20678F0AA5EF8C4561671341AB213C68 /* IGListAdapterProxy.h in Headers */,\n\t\t\t\t9D674BE6F590F50914DEED68A3B7356D /* IGListAdapterUpdateListener.h in Headers */,\n\t\t\t\tCD27C095B2D32203F0968C687FAA923C /* IGListAdapterUpdater.h in Headers */,\n\t\t\t\t01E08BBED18704A4E678834927B164E5 /* IGListAdapterUpdater+DebugDescription.h in Headers */,\n\t\t\t\t796B55F2170B8924B08FB1DF05BA09C6 /* IGListAdapterUpdaterDelegate.h in Headers */,\n\t\t\t\t5F010BCB98B62E7DE25D4D01374DB423 /* IGListAdapterUpdaterInternal.h in Headers */,\n\t\t\t\t10CE3BED45EF90FB47CA51EB6EAC1D79 /* IGListArrayUtilsInternal.h in Headers */,\n\t\t\t\t291AD3AD4B64C989D6FDD75EC62F4200 /* IGListBatchContext.h in Headers */,\n\t\t\t\t4B3027D1216593F18734639D31C08604 /* IGListBatchUpdateData+DebugDescription.h in Headers */,\n\t\t\t\t9DA4EDCC87D1BD54E00F1849385B85EF /* IGListBatchUpdates.h in Headers */,\n\t\t\t\tB73068D4B3550EA0D7CA9A0960345C2B /* IGListBatchUpdateState.h in Headers */,\n\t\t\t\tCB455F74F02B72C8692C1B389DAFD7DE /* IGListBindable.h in Headers */,\n\t\t\t\t3D906418205B53287328F5D82152FA80 /* IGListBindingSectionController.h in Headers */,\n\t\t\t\tACBA45C9A25507999B8F6FD03B270640 /* IGListBindingSectionController+DebugDescription.h in Headers */,\n\t\t\t\t5894D82734BCC132943F8D499303DE0A /* IGListBindingSectionControllerDataSource.h in Headers */,\n\t\t\t\t5CC045F50E7344D52F71E5187FB32A5D /* IGListBindingSectionControllerSelectionDelegate.h in Headers */,\n\t\t\t\t6F90C02A0D0907BFFA5AE716BA58C90C /* IGListCollectionContext.h in Headers */,\n\t\t\t\t89FE92DBAF2183E4E65D5F78144331AA /* IGListCollectionScrollingTraits.h in Headers */,\n\t\t\t\tD150E49F4D65F964BF5F92CAC59855FF /* IGListCollectionView.h in Headers */,\n\t\t\t\tDEB4FB4540A43D6B3CC2F22928887B3C /* IGListCollectionViewDelegateLayout.h in Headers */,\n\t\t\t\t5071DCE1BB0BDBB81A41A7209B244894 /* IGListCollectionViewLayout.h in Headers */,\n\t\t\t\t2FCE5208B5FE11B36A1D20CC76477FB6 /* IGListCollectionViewLayoutCompatible.h in Headers */,\n\t\t\t\tF26498A7A947D54EB8A8800A6CFB0786 /* IGListCollectionViewLayoutInternal.h in Headers */,\n\t\t\t\tD9ECF466EF530ACCB864BEB10ED2C656 /* IGListDebugger.h in Headers */,\n\t\t\t\tA02F17211658A92A69072350AFF7DD5F /* IGListDebuggingUtilities.h in Headers */,\n\t\t\t\t00D8EECF24D59CAE6154030BA3DEE195 /* IGListDisplayDelegate.h in Headers */,\n\t\t\t\t2F96DECCD2172DBD1BD18453A7E4AB1C /* IGListDisplayHandler.h in Headers */,\n\t\t\t\tB6FB268940FA4EB7426D9133A435A929 /* IGListGenericSectionController.h in Headers */,\n\t\t\t\t83D3CCECB9B772B5FC138B355AFE296D /* IGListIndexPathResultInternal.h in Headers */,\n\t\t\t\t6D1F1FE148B459962FFB42635226E94A /* IGListIndexSetResultInternal.h in Headers */,\n\t\t\t\t6B1234AB83FF379FDC1653BA17121B73 /* IGListKit.h in Headers */,\n\t\t\t\t15A0C8B73D68C30CBEFC9CEF16F2B992 /* IGListKit-umbrella.h in Headers */,\n\t\t\t\tB994A61DF8AA246F263DD558728ADD71 /* IGListMoveIndexInternal.h in Headers */,\n\t\t\t\t6BBA17D852117737A603C569AF074B5A /* IGListMoveIndexPathInternal.h in Headers */,\n\t\t\t\tB17CAEC48975381B521BB00AC3FA7688 /* IGListReloadDataUpdater.h in Headers */,\n\t\t\t\t837EF61F55713CA43E12FB6B8466E968 /* IGListReloadIndexPath.h in Headers */,\n\t\t\t\t66FC7655431ABAD92264A53171185724 /* IGListScrollDelegate.h in Headers */,\n\t\t\t\t2CBC483648CD891B4A3D6B109EFABA9D /* IGListSectionController.h in Headers */,\n\t\t\t\tA9D5B3D28EA5A5240821D109F5330919 /* IGListSectionControllerInternal.h in Headers */,\n\t\t\t\t59CE90BD34A5275CDC7455692A8A3AF7 /* IGListSectionMap.h in Headers */,\n\t\t\t\t9EDCC6FAA805C232557FB79DFB57DF7C /* IGListSectionMap+DebugDescription.h in Headers */,\n\t\t\t\tD940E0F5D90FF644A16219A2BACDC8DF /* IGListSingleSectionController.h in Headers */,\n\t\t\t\tA4CEF1AF773B6C67B57BD262391E0967 /* IGListSupplementaryViewSource.h in Headers */,\n\t\t\t\tA61C1E6A4819E8FCF03053272B28E932 /* IGListTransitionDelegate.h in Headers */,\n\t\t\t\tF94A8C7A4C3360D6C237C0EAAD133CDA /* IGListUpdatingDelegate.h in Headers */,\n\t\t\t\tD5D5819079EBA2A4AF83B670C09A5E24 /* IGListWorkingRangeDelegate.h in Headers */,\n\t\t\t\t23267ACF6633F832FE1FC2A82A245D9D /* IGListWorkingRangeHandler.h in Headers */,\n\t\t\t\t3A768ABD7CC269A78CF22785F210F7FF /* UICollectionView+DebugDescription.h in Headers */,\n\t\t\t\tB6B10A8366E9F8CA95134F7FB5249B4B /* UICollectionView+IGListBatchUpdateData.h in Headers */,\n\t\t\t\tD111876D68620B70CD8DADBC808E397A /* UICollectionViewLayout+InteractiveReordering.h in Headers */,\n\t\t\t\tC8A13466974B3313D9B432CD82A83D0C /* UIScrollView+IGListKit.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t6C5D6FE2744F299C4B5885492E7CFF8C /* IGListKit */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 2025E6AF3C16FA7CC6A4895B9A438EC5 /* Build configuration list for PBXNativeTarget \"IGListKit\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t95694B667489204AF5F823DAEA3681EB /* Headers */,\n\t\t\t\t0FA1EF6AAF807984D33F3F1759FF2443 /* Sources */,\n\t\t\t\tDEC09E6BD01E73B616D6EB3CE41AF16E /* Frameworks */,\n\t\t\t\t23E356D431C114E83CBF714786288593 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t13E7746DBCC3BB53CA2952C375607B97 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = IGListKit;\n\t\t\tproductName = IGListKit;\n\t\t\tproductReference = 017682A1559F97D4B1A82EFCD9B40A09 /* IGListKit */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tCAB46DA50D863A9116D12B2D36D7C68C /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = BE82EBF77FB73AAC8B39FB7783249946 /* Build configuration list for PBXProject \"IGListKit\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 972FB1F3215716CBA8742AF423394F54;\n\t\t\tproductRefGroup = B727F9F06FDD92DE3FCEA5041DA1A12F /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 68BB7FFF06B526B638EAF3987F64CB1C /* IGListDiffKit */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t6C5D6FE2744F299C4B5885492E7CFF8C /* IGListKit */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t23E356D431C114E83CBF714786288593 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t0FA1EF6AAF807984D33F3F1759FF2443 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t6DE7CB794E88B822088773BABFBF83FF /* IGListAdapter.m in Sources */,\n\t\t\t\tA3DCFBA9C5CD86C0704EFF03583B8900 /* IGListAdapter+DebugDescription.m in Sources */,\n\t\t\t\tC369067B04D5A03F396B35C1B070B603 /* IGListAdapter+UICollectionView.m in Sources */,\n\t\t\t\tC6D659ED98FD91D6250BADADEC070190 /* IGListAdapterProxy.m in Sources */,\n\t\t\t\tDDC86B48AAE2538DAB200D9FF8073E1E /* IGListAdapterUpdater.m in Sources */,\n\t\t\t\tBCF304EE58DBDBE7EB3860FE310B2C17 /* IGListAdapterUpdater+DebugDescription.m in Sources */,\n\t\t\t\tCFA2DB1D9E4A741C47E055809F672853 /* IGListBatchUpdateData+DebugDescription.m in Sources */,\n\t\t\t\t20A54B8CA1D62C9EF31AE7FCFE7182EE /* IGListBatchUpdates.m in Sources */,\n\t\t\t\t8964079800CA53BC7D0BE36413B1DA74 /* IGListBindingSectionController.m in Sources */,\n\t\t\t\t05E830839CDD81941193D642966F6864 /* IGListBindingSectionController+DebugDescription.m in Sources */,\n\t\t\t\tDA31EB23253AD08E7EF77B30238828FA /* IGListCollectionView.m in Sources */,\n\t\t\t\t590EB8DCC56FE067F14A7B45059C075C /* IGListCollectionViewLayout.mm in Sources */,\n\t\t\t\t524050F4143C30DCB448E3BB23F2751A /* IGListDebugger.m in Sources */,\n\t\t\t\t35C03326F9E7CF9BA971E04A887602EB /* IGListDebuggingUtilities.m in Sources */,\n\t\t\t\t25E6E52F611840941C6872C7317D9A65 /* IGListDisplayHandler.m in Sources */,\n\t\t\t\t339CC7529A1CB7845AF899CBEA59790F /* IGListGenericSectionController.m in Sources */,\n\t\t\t\t287F7998F968B6FD12D39728F40AAA69 /* IGListKit-dummy.m in Sources */,\n\t\t\t\t968CFE27158615D5E5CE548459C40B5D /* IGListReloadDataUpdater.m in Sources */,\n\t\t\t\t31FBA3D8B80DF597DD2117DC1BCFFF94 /* IGListReloadIndexPath.m in Sources */,\n\t\t\t\t0F46EF0FB383BD634788C36C2D4F1ED6 /* IGListSectionController.m in Sources */,\n\t\t\t\tE7185EC5ECC56BE56BB4890D7392A8C9 /* IGListSectionMap.m in Sources */,\n\t\t\t\tFB2C0646EF20359B5DD30DE172CF8BF2 /* IGListSectionMap+DebugDescription.m in Sources */,\n\t\t\t\tD2ADEA8C2074604A21B513E30EA8ACA3 /* IGListSingleSectionController.m in Sources */,\n\t\t\t\t19284AE6E0FDB4AF8BDCA70EF9E0643E /* IGListWorkingRangeHandler.mm in Sources */,\n\t\t\t\t85A10A32F13940714AE26AC7C8C4CDA2 /* UICollectionView+DebugDescription.m in Sources */,\n\t\t\t\tD41DE3B1749E169822B166F1E26329A1 /* UICollectionView+IGListBatchUpdateData.m in Sources */,\n\t\t\t\t5C81F6CF7FFF93C6FB11D58A8FDF3DB1 /* UICollectionViewLayout+InteractiveReordering.m in Sources */,\n\t\t\t\tCAB21CB8CF3C59BAFC9A4FD68A810E39 /* UIScrollView+IGListKit.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t13E7746DBCC3BB53CA2952C375607B97 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = IGListDiffKit;\n\t\t\ttargetProxy = 62FF8776F5035EB9D871C3BBF79FB2E5 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t494D3D979A75EA97849240E03EBCE047 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t509F57C4DEE72121D2EB0F3210F0EED2 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tB81D07816BD0445B0699506DD86D9238 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 562F1B0AFBC215CCD48168B2F1BA5114 /* IGListKit.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/IGListKit/IGListKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/IGListKit/IGListKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/IGListKit/IGListKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = IGListKit;\n\t\t\t\tPRODUCT_NAME = IGListKit;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE0EDBD9844827574388C2B602CDE3F7D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 82B3FEA19DB6F2D790DB5E72DE9BEAC0 /* IGListKit.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/IGListKit/IGListKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/IGListKit/IGListKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/IGListKit/IGListKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = IGListKit;\n\t\t\t\tPRODUCT_NAME = IGListKit;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t2025E6AF3C16FA7CC6A4895B9A438EC5 /* Build configuration list for PBXNativeTarget \"IGListKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tB81D07816BD0445B0699506DD86D9238 /* Debug */,\n\t\t\t\tE0EDBD9844827574388C2B602CDE3F7D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tBE82EBF77FB73AAC8B39FB7783249946 /* Build configuration list for PBXProject \"IGListKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t509F57C4DEE72121D2EB0F3210F0EED2 /* Debug */,\n\t\t\t\t494D3D979A75EA97849240E03EBCE047 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = CAB46DA50D863A9116D12B2D36D7C68C /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQNSArray+Sort.swift",
    "content": "//\n//  IQNSArray+Sort.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n/**\nUIView.subviews sorting category.\n*/\n@available(iOSApplicationExtension, unavailable)\ninternal extension Array where Element: UIView {\n\n    /**\n    Returns the array by sorting the UIView's by their tag property.\n    */\n    func sortedArrayByTag() -> [Element] {\n\n        return sorted(by: { (obj1: Element, obj2: Element) -> Bool in\n\n            return (obj1.tag < obj2.tag)\n        })\n    }\n\n    /**\n    Returns the array by sorting the UIView's by their tag property.\n    */\n    func sortedArrayByPosition() -> [Element] {\n\n        return sorted(by: { (obj1: Element, obj2: Element) -> Bool in\n            if obj1.frame.minY != obj2.frame.minY {\n                return obj1.frame.minY < obj2.frame.minY\n            } else {\n                return obj1.frame.minX < obj2.frame.minX\n            }\n        })\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIScrollView+Additions.swift",
    "content": "//\n//  IQUIScrollView+Additions.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\n@objc public extension UIScrollView {\n\n    private struct AssociatedKeys {\n        static var shouldIgnoreScrollingAdjustment = \"shouldIgnoreScrollingAdjustment\"\n        static var shouldIgnoreContentInsetAdjustment = \"shouldIgnoreContentInsetAdjustment\"\n        static var shouldRestoreScrollViewContentOffset = \"shouldRestoreScrollViewContentOffset\"\n    }\n\n    /**\n     If YES, then scrollview will ignore scrolling (simply not scroll it) for adjusting textfield position. Default is NO.\n     */\n    var shouldIgnoreScrollingAdjustment: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.shouldIgnoreScrollingAdjustment) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.shouldIgnoreScrollingAdjustment, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /**\n     If YES, then scrollview will ignore content inset adjustment (simply not updating it) when keyboard is shown. Default is NO.\n     */\n    var shouldIgnoreContentInsetAdjustment: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.shouldIgnoreContentInsetAdjustment) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.shouldIgnoreContentInsetAdjustment, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /**\n     To set customized distance from keyboard for textField/textView. Can't be less than zero\n     */\n    var shouldRestoreScrollViewContentOffset: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.shouldRestoreScrollViewContentOffset) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.shouldRestoreScrollViewContentOffset, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n}\n\n@available(iOSApplicationExtension, unavailable)\ninternal extension UITableView {\n\n    func previousIndexPath(of indexPath: IndexPath) -> IndexPath? {\n        var previousRow = indexPath.row - 1\n        var previousSection = indexPath.section\n\n        //Fixing indexPath\n        if previousRow < 0 {\n            previousSection -= 1\n            if previousSection >= 0 {\n                previousRow = self.numberOfRows(inSection: previousSection) - 1\n            }\n        }\n\n        if previousRow >= 0, previousSection >= 0 {\n            return IndexPath(row: previousRow, section: previousSection)\n        } else {\n            return nil\n        }\n    }\n}\n\n@available(iOSApplicationExtension, unavailable)\ninternal extension UICollectionView {\n\n    func previousIndexPath(of indexPath: IndexPath) -> IndexPath? {\n        var previousRow = indexPath.row - 1\n        var previousSection = indexPath.section\n\n        //Fixing indexPath\n        if previousRow < 0 {\n            previousSection -= 1\n            if previousSection >= 0 {\n                previousRow = self.numberOfItems(inSection: previousSection) - 1\n            }\n        }\n\n        if previousRow >= 0, previousSection >= 0 {\n            return IndexPath(item: previousRow, section: previousSection)\n        } else {\n            return nil\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUITextFieldView+Additions.swift",
    "content": "//\n//  IQUITextFieldView+Additions.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n/**\nUses default keyboard distance for textField.\n*/\n@available(iOSApplicationExtension, unavailable)\npublic let kIQUseDefaultKeyboardDistance = CGFloat.greatestFiniteMagnitude\n\n/**\nUIView category for managing UITextField/UITextView\n*/\n@available(iOSApplicationExtension, unavailable)\n@objc public extension UIView {\n\n    private struct AssociatedKeys {\n        static var keyboardDistanceFromTextField = \"keyboardDistanceFromTextField\"\n        static var ignoreSwitchingByNextPrevious = \"ignoreSwitchingByNextPrevious\"\n        static var enableMode = \"enableMode\"\n        static var shouldResignOnTouchOutsideMode = \"shouldResignOnTouchOutsideMode\"\n    }\n\n    /**\n     To set customized distance from keyboard for textField/textView. Can't be less than zero\n     */\n    var keyboardDistanceFromTextField: CGFloat {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.keyboardDistanceFromTextField) as? CGFloat ?? kIQUseDefaultKeyboardDistance\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.keyboardDistanceFromTextField, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /**\n     If shouldIgnoreSwitchingByNextPrevious is true then library will ignore this textField/textView while moving to other textField/textView using keyboard toolbar next previous buttons. Default is false\n     */\n    var ignoreSwitchingByNextPrevious: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.ignoreSwitchingByNextPrevious) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.ignoreSwitchingByNextPrevious, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /**\n     Override Enable/disable managing distance between keyboard and textField behaviour for this particular textField.\n     */\n    var enableMode: IQEnableMode {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.enableMode) as? IQEnableMode ?? .default\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.enableMode, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /**\n     Override resigns Keyboard on touching outside of UITextField/View behaviour for this particular textField.\n     */\n    var shouldResignOnTouchOutsideMode: IQEnableMode {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.shouldResignOnTouchOutsideMode) as? IQEnableMode ?? .default\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.shouldResignOnTouchOutsideMode, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIView+Hierarchy.swift",
    "content": "//\n//  IQUIView+Hierarchy.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n/**\nUIView hierarchy category.\n*/\n@available(iOSApplicationExtension, unavailable)\n@objc public extension UIView {\n\n    // MARK: viewControllers\n\n    /**\n    Returns the UIViewController object that manages the receiver.\n    */\n    func viewContainingController() -> UIViewController? {\n\n        var nextResponder: UIResponder? = self\n\n        repeat {\n            nextResponder = nextResponder?.next\n\n            if let viewController = nextResponder as? UIViewController {\n                return viewController\n            }\n\n        } while nextResponder != nil\n\n        return nil\n    }\n\n    /**\n    Returns the topMost UIViewController object in hierarchy.\n    */\n    func topMostController() -> UIViewController? {\n\n        var controllersHierarchy = [UIViewController]()\n\n        if var topController = window?.rootViewController {\n            controllersHierarchy.append(topController)\n\n            while let presented = topController.presentedViewController {\n\n                topController = presented\n\n                controllersHierarchy.append(presented)\n            }\n\n            var matchController: UIResponder? = viewContainingController()\n\n            while let mController = matchController as? UIViewController, controllersHierarchy.contains(mController) == false {\n\n                repeat {\n                    matchController = matchController?.next\n\n                } while matchController != nil && matchController is UIViewController == false\n            }\n\n            return matchController as? UIViewController\n\n        } else {\n            return viewContainingController()\n        }\n    }\n\n    /**\n     Returns the UIViewController object that is actually the parent of this object. Most of the time it's the viewController object which actually contains it, but result may be different if it's viewController is added as childViewController of another viewController.\n     */\n    func parentContainerViewController() -> UIViewController? {\n\n        var matchController = viewContainingController()\n        var parentContainerViewController: UIViewController?\n\n        if var navController = matchController?.navigationController {\n\n            while let parentNav = navController.navigationController {\n                navController = parentNav\n            }\n\n            var parentController: UIViewController = navController\n\n            while let parent = parentController.parent,\n                (parent.isKind(of: UINavigationController.self) == false &&\n                    parent.isKind(of: UITabBarController.self) == false &&\n                    parent.isKind(of: UISplitViewController.self) == false) {\n\n                        parentController = parent\n            }\n\n            if navController == parentController {\n                parentContainerViewController = navController.topViewController\n            } else {\n                parentContainerViewController = parentController\n            }\n        } else if let tabController = matchController?.tabBarController {\n\n            if let navController = tabController.selectedViewController as? UINavigationController {\n                parentContainerViewController = navController.topViewController\n            } else {\n                parentContainerViewController = tabController.selectedViewController\n            }\n        } else {\n            while let parentController = matchController?.parent,\n                (parentController.isKind(of: UINavigationController.self) == false &&\n                    parentController.isKind(of: UITabBarController.self) == false &&\n                    parentController.isKind(of: UISplitViewController.self) == false) {\n\n                        matchController = parentController\n            }\n\n            parentContainerViewController = matchController\n        }\n\n        let finalController = parentContainerViewController?.parentIQContainerViewController() ?? parentContainerViewController\n\n        return finalController\n\n    }\n\n    // MARK: Superviews/Subviews/Siglings\n\n    /**\n    Returns the superView of provided class type.\n\n     \n     @param classType class type of the object which is to be search in above hierarchy and return\n     \n     @param belowView view object in upper hierarchy where method should stop searching and return nil\n*/\n    func superviewOfClassType(_ classType: UIView.Type, belowView: UIView? = nil) -> UIView? {\n\n        var superView = superview\n\n        while let unwrappedSuperView = superView {\n\n            if unwrappedSuperView.isKind(of: classType) {\n\n                //If it's UIScrollView, then validating for special cases\n                if unwrappedSuperView.isKind(of: UIScrollView.self) {\n\n                    let classNameString = NSStringFromClass(type(of: unwrappedSuperView.self))\n\n                    //  If it's not UITableViewWrapperView class, this is internal class which is actually manage in UITableview. The speciality of this class is that it's superview is UITableView.\n                    //  If it's not UITableViewCellScrollView class, this is internal class which is actually manage in UITableviewCell. The speciality of this class is that it's superview is UITableViewCell.\n                    //If it's not _UIQueuingScrollView class, actually we validate for _ prefix which usually used by Apple internal classes\n                    if unwrappedSuperView.superview?.isKind(of: UITableView.self) == false,\n                        unwrappedSuperView.superview?.isKind(of: UITableViewCell.self) == false,\n                        classNameString.hasPrefix(\"_\") == false {\n                        return superView\n                    }\n                } else {\n                    return superView\n                }\n            } else if unwrappedSuperView == belowView {\n                return nil\n            }\n\n            superView = unwrappedSuperView.superview\n        }\n\n        return nil\n    }\n\n    /**\n    Returns all siblings of the receiver which canBecomeFirstResponder.\n    */\n    internal func responderSiblings() -> [UIView] {\n\n        //Array of (UITextField/UITextView's).\n        var tempTextFields = [UIView]()\n\n        //\tGetting all siblings\n        if let siblings = superview?.subviews {\n            for textField in siblings {\n                if (textField == self || textField.ignoreSwitchingByNextPrevious == false), textField.IQcanBecomeFirstResponder() {\n                    tempTextFields.append(textField)\n                }\n            }\n        }\n\n        return tempTextFields\n    }\n\n    /**\n    Returns all deep subViews of the receiver which canBecomeFirstResponder.\n    */\n    internal func deepResponderViews() -> [UIView] {\n\n        //Array of (UITextField/UITextView's).\n        var textfields = [UIView]()\n\n        for textField in subviews {\n\n            if (textField == self || textField.ignoreSwitchingByNextPrevious == false), textField.IQcanBecomeFirstResponder() {\n                textfields.append(textField)\n            }\n            //Sometimes there are hidden or disabled views and textField inside them still recorded, so we added some more validations here (Bug ID: #458)\n            //Uncommented else (Bug ID: #625)\n            else if textField.subviews.count != 0, isUserInteractionEnabled, !isHidden, alpha != 0.0 {\n                for deepView in textField.deepResponderViews() {\n                    textfields.append(deepView)\n                }\n            }\n        }\n\n        //subviews are returning in opposite order. Sorting according the frames 'y'.\n        return textfields.sorted(by: { (view1: UIView, view2: UIView) -> Bool in\n\n            let frame1 = view1.convert(view1.bounds, to: self)\n            let frame2 = view2.convert(view2.bounds, to: self)\n\n            if frame1.minY != frame2.minY {\n                return frame1.minY < frame2.minY\n            } else {\n                return frame1.minX < frame2.minX\n            }\n        })\n    }\n\n    private func IQcanBecomeFirstResponder() -> Bool {\n\n        var IQcanBecomeFirstResponder = false\n\n        if self.conforms(to: UITextInput.self) {\n            //  Setting toolbar to keyboard.\n            if let textView = self as? UITextView {\n                IQcanBecomeFirstResponder = textView.isEditable\n            } else if let textField = self as? UITextField {\n                IQcanBecomeFirstResponder = textField.isEnabled\n            }\n        }\n\n        if IQcanBecomeFirstResponder {\n            IQcanBecomeFirstResponder = isUserInteractionEnabled && !isHidden && alpha != 0.0 && !isAlertViewTextField() && textFieldSearchBar() == nil\n        }\n\n        return IQcanBecomeFirstResponder\n    }\n\n    // MARK: Special TextFields\n\n    /**\n     Returns searchBar if receiver object is UISearchBarTextField, otherwise return nil.\n    */\n    internal func textFieldSearchBar() -> UISearchBar? {\n\n        var responder: UIResponder? = self.next\n\n        while let bar = responder {\n\n            if let searchBar = bar as? UISearchBar {\n                return searchBar\n            } else if bar is UIViewController {\n                break\n            }\n\n            responder = bar.next\n        }\n\n        return nil\n    }\n\n    /**\n    Returns YES if the receiver object is UIAlertSheetTextField, otherwise return NO.\n    */\n    internal func isAlertViewTextField() -> Bool {\n\n        var alertViewController: UIResponder? = viewContainingController()\n\n        var isAlertViewTextField = false\n\n        while let controller = alertViewController, !isAlertViewTextField {\n\n            if controller.isKind(of: UIAlertController.self) {\n                isAlertViewTextField = true\n                break\n            }\n\n            alertViewController = controller.next\n        }\n\n        return isAlertViewTextField\n    }\n\n    private func depth() -> Int {\n        var depth: Int = 0\n\n        if let superView = superview {\n            depth = superView.depth()+1\n        }\n\n        return depth\n    }\n\n}\n\n@available(iOSApplicationExtension, unavailable)\nextension NSObject {\n\n    internal func _IQDescription() -> String {\n        return \"<\\(self) \\(Unmanaged.passUnretained(self).toOpaque())>\"\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIViewController+Additions.swift",
    "content": "//\n//  IQUIViewController+Additions.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\n@objc public extension UIViewController {\n\n    private struct AssociatedKeys {\n        static var IQLayoutGuideConstraint = \"IQLayoutGuideConstraint\"\n    }\n\n    /**\n     This method is provided to override by viewController's if the library lifts a viewController which you doesn't want to lift . This may happen if you have implemented side menu feature in your app and the library try to lift the side menu controller. Overriding this method in side menu class to return correct controller should fix the problem.\n    */\n    func parentIQContainerViewController() -> UIViewController? {\n        return self\n    }\n\n    /**\n    To set customized distance from keyboard for textField/textView. Can't be less than zero\n     \n     @deprecated    Due to change in core-logic of handling distance between textField and keyboard distance, this layout contraint tweak is no longer needed and things will just work out of the box regardless of constraint pinned with safeArea/layoutGuide/superview\n    */\n    @available(*, deprecated, message: \"Due to change in core-logic of handling distance between textField and keyboard distance, this layout contraint tweak is no longer needed and things will just work out of the box regardless of constraint pinned with safeArea/layoutGuide/superview.\")\n    @IBOutlet var IQLayoutGuideConstraint: NSLayoutConstraint? {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.IQLayoutGuideConstraint) as? NSLayoutConstraint\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.IQLayoutGuideConstraint, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstants.swift",
    "content": "//\n//  IQKeyboardManagerConstants.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport Foundation\n\n// MARK: IQAutoToolbarManageBehaviour\n\n/**\n`IQAutoToolbarBySubviews`\nCreates Toolbar according to subview's hirarchy of Textfield's in view.\n\n`IQAutoToolbarByTag`\nCreates Toolbar according to tag property of TextField's.\n\n`IQAutoToolbarByPosition`\nCreates Toolbar according to the y,x position of textField in it's superview coordinate.\n*/\n@available(iOSApplicationExtension, unavailable)\n@objc public enum IQAutoToolbarManageBehaviour: Int {\n    case bySubviews\n    case byTag\n    case byPosition\n}\n\n/**\n `IQPreviousNextDisplayModeDefault`\n Show NextPrevious when there are more than 1 textField otherwise hide.\n \n `IQPreviousNextDisplayModeAlwaysHide`\n Do not show NextPrevious buttons in any case.\n \n `IQPreviousNextDisplayModeAlwaysShow`\n Always show nextPrevious buttons, if there are more than 1 textField then both buttons will be visible but will be shown as disabled.\n */\n@available(iOSApplicationExtension, unavailable)\n@objc public enum IQPreviousNextDisplayMode: Int {\n    case `default`\n    case alwaysHide\n    case alwaysShow\n}\n\n/**\n `IQEnableModeDefault`\n Pick default settings.\n \n `IQEnableModeEnabled`\n setting is enabled.\n \n `IQEnableModeDisabled`\n setting is disabled.\n */\n@available(iOSApplicationExtension, unavailable)\n@objc public enum IQEnableMode: Int {\n    case `default`\n    case enabled\n    case disabled\n}\n\n/*\n /---------------------------------------------------------------------------------------------------\\\n \\---------------------------------------------------------------------------------------------------/\n |                                   iOS Notification Mechanism                                    |\n /---------------------------------------------------------------------------------------------------\\\n \\---------------------------------------------------------------------------------------------------/\n \n ------------------------------------------------------------\n When UITextField become first responder\n ------------------------------------------------------------\n - UITextFieldTextDidBeginEditingNotification (UITextField)\n - UIKeyboardWillShowNotification\n - UIKeyboardDidShowNotification\n \n ------------------------------------------------------------\n When UITextView become first responder\n ------------------------------------------------------------\n - UIKeyboardWillShowNotification\n - UITextViewTextDidBeginEditingNotification (UITextView)\n - UIKeyboardDidShowNotification\n \n ------------------------------------------------------------\n When switching focus from UITextField to another UITextField\n ------------------------------------------------------------\n - UITextFieldTextDidEndEditingNotification (UITextField1)\n - UITextFieldTextDidBeginEditingNotification (UITextField2)\n - UIKeyboardWillShowNotification\n - UIKeyboardDidShowNotification\n \n ------------------------------------------------------------\n When switching focus from UITextView to another UITextView\n ------------------------------------------------------------\n - UITextViewTextDidEndEditingNotification: (UITextView1)\n - UIKeyboardWillShowNotification\n - UITextViewTextDidBeginEditingNotification: (UITextView2)\n - UIKeyboardDidShowNotification\n \n ------------------------------------------------------------\n When switching focus from UITextField to UITextView\n ------------------------------------------------------------\n - UITextFieldTextDidEndEditingNotification (UITextField)\n - UIKeyboardWillShowNotification\n - UITextViewTextDidBeginEditingNotification (UITextView)\n - UIKeyboardDidShowNotification\n \n ------------------------------------------------------------\n When switching focus from UITextView to UITextField\n ------------------------------------------------------------\n - UITextViewTextDidEndEditingNotification (UITextView)\n - UITextFieldTextDidBeginEditingNotification (UITextField)\n - UIKeyboardWillShowNotification\n - UIKeyboardDidShowNotification\n \n ------------------------------------------------------------\n When opening/closing UIKeyboard Predictive bar\n ------------------------------------------------------------\n - UIKeyboardWillShowNotification\n - UIKeyboardDidShowNotification\n \n ------------------------------------------------------------\n On orientation change\n ------------------------------------------------------------\n - UIApplicationWillChangeStatusBarOrientationNotification\n - UIKeyboardWillHideNotification\n - UIKeyboardDidHideNotification\n - UIApplicationDidChangeStatusBarOrientationNotification\n - UIKeyboardWillShowNotification\n - UIKeyboardDidShowNotification\n - UIKeyboardWillShowNotification\n - UIKeyboardDidShowNotification\n \n */\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstantsInternal.swift",
    "content": "//\n//  IQKeyboardManagerConstantsInternal.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+Debug.swift",
    "content": "//\n//  IQKeyboardManager+Debug.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n// MARK: Debugging & Developer options\n@available(iOSApplicationExtension, unavailable)\npublic extension IQKeyboardManager {\n\n    private struct AssociatedKeys {\n        static var enableDebugging = \"enableDebugging\"\n    }\n\n    @objc var enableDebugging: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.enableDebugging) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.enableDebugging, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /**\n     @warning Use below methods to completely enable/disable notifications registered by library internally.\n     Please keep in mind that library is totally dependent on NSNotification of UITextField, UITextField, Keyboard etc.\n     If you do unregisterAllNotifications then library will not work at all. You should only use below methods if you want to completedly disable all library functions.\n     You should use below methods at your own risk.\n     */\n    @objc func registerAllNotifications() {\n\n        //  Registering for keyboard notification.\n        NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)\n        NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidShow(_:)), name: UIResponder.keyboardDidShowNotification, object: nil)\n        NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)\n        NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardDidHide(_:)), name: UIResponder.keyboardDidHideNotification, object: nil)\n\n        //  Registering for UITextField notification.\n        registerTextFieldViewClass(UITextField.self, didBeginEditingNotificationName: UITextField.textDidBeginEditingNotification.rawValue, didEndEditingNotificationName: UITextField.textDidEndEditingNotification.rawValue)\n\n        //  Registering for UITextView notification.\n        registerTextFieldViewClass(UITextView.self, didBeginEditingNotificationName: UITextView.textDidBeginEditingNotification.rawValue, didEndEditingNotificationName: UITextView.textDidEndEditingNotification.rawValue)\n\n        //  Registering for orientation changes notification\n        NotificationCenter.default.addObserver(self, selector: #selector(self.willChangeStatusBarOrientation(_:)), name: UIApplication.willChangeStatusBarOrientationNotification, object: UIApplication.shared)\n    }\n\n    @objc func unregisterAllNotifications() {\n\n        //  Unregistering for keyboard notification.\n        NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)\n        NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardDidShowNotification, object: nil)\n        NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)\n        NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardDidHideNotification, object: nil)\n\n        //  Unregistering for UITextField notification.\n        unregisterTextFieldViewClass(UITextField.self, didBeginEditingNotificationName: UITextField.textDidBeginEditingNotification.rawValue, didEndEditingNotificationName: UITextField.textDidEndEditingNotification.rawValue)\n\n        //  Unregistering for UITextView notification.\n        unregisterTextFieldViewClass(UITextView.self, didBeginEditingNotificationName: UITextView.textDidBeginEditingNotification.rawValue, didEndEditingNotificationName: UITextView.textDidEndEditingNotification.rawValue)\n\n        //  Unregistering for orientation changes notification\n        NotificationCenter.default.removeObserver(self, name: UIApplication.willChangeStatusBarOrientationNotification, object: UIApplication.shared)\n    }\n\n    struct Static {\n        static var indentation = 0\n    }\n\n    internal func showLog(_ logString: String, indentation: Int = 0) {\n\n        guard enableDebugging else {\n            return\n        }\n\n        if indentation < 0 {\n            Static.indentation = max(0, Static.indentation + indentation)\n        }\n\n        var preLog = \"IQKeyboardManager\"\n        for _ in 0 ... Static.indentation {\n            preLog += \"|\\t\"\n        }\n\n        print(preLog + logString)\n\n        if indentation > 0 {\n            Static.indentation += indentation\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+Internal.swift",
    "content": "//\n//  IQKeyboardManager+Internal.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\ninternal extension IQKeyboardManager {\n\n    /**    Get all UITextField/UITextView siblings of textFieldView. */\n    func responderViews() -> [UIView]? {\n\n        var superConsideredView: UIView?\n\n        //If find any consider responderView in it's upper hierarchy then will get deepResponderView.\n        for disabledClass in toolbarPreviousNextAllowedClasses {\n            superConsideredView = textFieldView?.superviewOfClassType(disabledClass)\n            if superConsideredView != nil {\n                break\n            }\n        }\n\n        //If there is a superConsideredView in view's hierarchy, then fetching all it's subview that responds. No sorting for superConsideredView, it's by subView position.    (Enhancement ID: #22)\n        if let view = superConsideredView {\n            return view.deepResponderViews()\n        } else {  //Otherwise fetching all the siblings\n\n            guard let textFields = textFieldView?.responderSiblings() else {\n                return nil\n            }\n\n            //Sorting textFields according to behaviour\n            switch toolbarManageBehaviour {\n            //If autoToolbar behaviour is bySubviews, then returning it.\n            case .bySubviews:   return textFields\n\n            //If autoToolbar behaviour is by tag, then sorting it according to tag property.\n            case .byTag:    return textFields.sortedArrayByTag()\n\n            //If autoToolbar behaviour is by tag, then sorting it according to tag property.\n            case .byPosition:    return textFields.sortedArrayByPosition()\n            }\n        }\n    }\n\n    func privateIsEnabled() -> Bool {\n\n        var isEnabled = enable\n\n        let enableMode = textFieldView?.enableMode\n\n        if enableMode == .enabled {\n            isEnabled = true\n        } else if enableMode == .disabled {\n            isEnabled = false\n        } else if var textFieldViewController = textFieldView?.viewContainingController() {\n\n            //If it is searchBar textField embedded in Navigation Bar\n            if textFieldView?.textFieldSearchBar() != nil, let navController = textFieldViewController as? UINavigationController, let topController = navController.topViewController {\n                textFieldViewController = topController\n            }\n\n            //If viewController is kind of enable viewController class, then assuming it's enabled.\n            if !isEnabled, enabledDistanceHandlingClasses.contains(where: { textFieldViewController.isKind(of: $0) }) {\n                isEnabled = true\n            }\n\n            if isEnabled {\n\n                //If viewController is kind of disabled viewController class, then assuming it's disabled.\n                if disabledDistanceHandlingClasses.contains(where: { textFieldViewController.isKind(of: $0) }) {\n                    isEnabled = false\n                }\n\n                //Special Controllers\n                if isEnabled {\n\n                    let classNameString = NSStringFromClass(type(of: textFieldViewController.self))\n\n                    //_UIAlertControllerTextFieldViewController\n                    if classNameString.contains(\"UIAlertController\"), classNameString.hasSuffix(\"TextFieldViewController\") {\n                        isEnabled = false\n                    }\n                }\n            }\n        }\n\n        return isEnabled\n    }\n\n    func privateIsEnableAutoToolbar() -> Bool {\n\n        guard var textFieldViewController = textFieldView?.viewContainingController() else {\n            return enableAutoToolbar\n        }\n\n        //If it is searchBar textField embedded in Navigation Bar\n        if textFieldView?.textFieldSearchBar() != nil, let navController = textFieldViewController as? UINavigationController, let topController = navController.topViewController {\n            textFieldViewController = topController\n        }\n\n        var enableToolbar = enableAutoToolbar\n\n        if !enableToolbar, enabledToolbarClasses.contains(where: { textFieldViewController.isKind(of: $0) }) {\n            enableToolbar = true\n        }\n\n        if enableToolbar {\n\n            //If found any toolbar disabled classes then return.\n            if disabledToolbarClasses.contains(where: { textFieldViewController.isKind(of: $0) }) {\n                enableToolbar = true\n            }\n\n            //Special Controllers\n            if enableToolbar {\n\n                let classNameString = NSStringFromClass(type(of: textFieldViewController.self))\n\n                //_UIAlertControllerTextFieldViewController\n                if classNameString.contains(\"UIAlertController\"), classNameString.hasSuffix(\"TextFieldViewController\") {\n                    enableToolbar = false\n                }\n            }\n        }\n\n        return enableToolbar\n    }\n\n    func privateShouldResignOnTouchOutside() -> Bool {\n\n        var shouldResign = shouldResignOnTouchOutside\n\n        let enableMode = textFieldView?.shouldResignOnTouchOutsideMode\n\n        if enableMode == .enabled {\n            shouldResign = true\n        } else if enableMode == .disabled {\n            shouldResign = false\n        } else if var textFieldViewController = textFieldView?.viewContainingController() {\n\n            //If it is searchBar textField embedded in Navigation Bar\n            if textFieldView?.textFieldSearchBar() != nil, let navController = textFieldViewController as? UINavigationController, let topController = navController.topViewController {\n                textFieldViewController = topController\n            }\n\n            //If viewController is kind of enable viewController class, then assuming shouldResignOnTouchOutside is enabled.\n            if !shouldResign, enabledTouchResignedClasses.contains(where: { textFieldViewController.isKind(of: $0) }) {\n                shouldResign = true\n            }\n\n            if shouldResign {\n\n                //If viewController is kind of disable viewController class, then assuming shouldResignOnTouchOutside is disable.\n                if disabledTouchResignedClasses.contains(where: { textFieldViewController.isKind(of: $0) }) {\n                    shouldResign = false\n                }\n\n                //Special Controllers\n                if shouldResign {\n\n                    let classNameString = NSStringFromClass(type(of: textFieldViewController.self))\n\n                    //_UIAlertControllerTextFieldViewController\n                    if classNameString.contains(\"UIAlertController\"), classNameString.hasSuffix(\"TextFieldViewController\") {\n                        shouldResign = false\n                    }\n                }\n            }\n        }\n        return shouldResign\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+OrientationNotification.swift",
    "content": "//\n//  IQKeyboardManager+OrientationNotification.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n// MARK: UIStatusBar Notification methods\n@available(iOSApplicationExtension, unavailable)\ninternal extension IQKeyboardManager {\n\n    /**  UIApplicationWillChangeStatusBarOrientationNotification. Need to set the textView to it's original position. If any frame changes made. (Bug ID: #92)*/\n    @objc func willChangeStatusBarOrientation(_ notification: Notification) {\n\n        let currentStatusBarOrientation: UIInterfaceOrientation\n        #if swift(>=5.1)\n        if #available(iOS 13, *) {\n            currentStatusBarOrientation = keyWindow()?.windowScene?.interfaceOrientation ?? UIInterfaceOrientation.unknown\n        } else {\n            currentStatusBarOrientation = UIApplication.shared.statusBarOrientation\n        }\n        #else\n        currentStatusBarOrientation = UIApplication.shared.statusBarOrientation\n        #endif\n\n        guard let statusBarOrientation = notification.userInfo?[UIApplication.statusBarOrientationUserInfoKey] as? Int, currentStatusBarOrientation.rawValue != statusBarOrientation else {\n            return\n        }\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        //If textViewContentInsetChanged is saved then restore it.\n        if let textView = textFieldView as? UITextView, textView.responds(to: #selector(getter: UITextView.isEditable)) {\n\n            if isTextViewContentInsetChanged {\n                self.isTextViewContentInsetChanged = false\n                if textView.contentInset != self.startingTextViewContentInsets {\n                    UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                        self.showLog(\"Restoring textView.contentInset to: \\(self.startingTextViewContentInsets)\")\n\n                        //Setting textField to it's initial contentInset\n                        textView.contentInset = self.startingTextViewContentInsets\n                        textView.scrollIndicatorInsets = self.startingTextViewScrollIndicatorInsets\n\n                    }, completion: { (_) -> Void in })\n                }\n            }\n        }\n\n        restorePosition()\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+Position.swift",
    "content": "//\n//  IQKeyboardManager+Position.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\npublic extension IQKeyboardManager {\n\n    private struct AssociatedKeys {\n        static var movedDistance = \"movedDistance\"\n        static var movedDistanceChanged = \"movedDistanceChanged\"\n        static var lastScrollView = \"lastScrollView\"\n        static var startingContentOffset = \"startingContentOffset\"\n        static var startingScrollIndicatorInsets = \"startingScrollIndicatorInsets\"\n        static var startingContentInsets = \"startingContentInsets\"\n        static var startingTextViewContentInsets = \"startingTextViewContentInsets\"\n        static var startingTextViewScrollIndicatorInsets = \"startingTextViewScrollIndicatorInsets\"\n        static var isTextViewContentInsetChanged = \"isTextViewContentInsetChanged\"\n        static var hasPendingAdjustRequest = \"hasPendingAdjustRequest\"\n    }\n\n    /**\n     moved distance to the top used to maintain distance between keyboard and textField. Most of the time this will be a positive value.\n     */\n    @objc private(set) var movedDistance: CGFloat {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.movedDistance) as? CGFloat ?? 0.0\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.movedDistance, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            movedDistanceChanged?(movedDistance)\n        }\n    }\n\n    /**\n    Will be called then movedDistance will be changed\n     */\n    @objc var movedDistanceChanged: ((CGFloat) -> Void)? {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.movedDistanceChanged) as? ((CGFloat) -> Void)\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.movedDistanceChanged, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            movedDistanceChanged?(movedDistance)\n        }\n    }\n\n    /** Variable to save lastScrollView that was scrolled. */\n    internal weak var lastScrollView: UIScrollView? {\n        get {\n            return (objc_getAssociatedObject(self, &AssociatedKeys.lastScrollView) as? WeakObjectContainer)?.object as? UIScrollView\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.lastScrollView, WeakObjectContainer(object: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** LastScrollView's initial contentOffset. */\n    internal var startingContentOffset: CGPoint {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.startingContentOffset) as? CGPoint ?? IQKeyboardManager.kIQCGPointInvalid\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.startingContentOffset, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** LastScrollView's initial scrollIndicatorInsets. */\n    internal var startingScrollIndicatorInsets: UIEdgeInsets {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.startingScrollIndicatorInsets) as? UIEdgeInsets ?? .init()\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.startingScrollIndicatorInsets, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** LastScrollView's initial contentInsets. */\n    internal var startingContentInsets: UIEdgeInsets {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.startingContentInsets) as? UIEdgeInsets ?? .init()\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.startingContentInsets, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** used to adjust contentInset of UITextView. */\n    internal var startingTextViewContentInsets: UIEdgeInsets {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.startingTextViewContentInsets) as? UIEdgeInsets ?? .init()\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.startingTextViewContentInsets, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** used to adjust scrollIndicatorInsets of UITextView. */\n    internal var startingTextViewScrollIndicatorInsets: UIEdgeInsets {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.startingTextViewScrollIndicatorInsets) as? UIEdgeInsets ?? .init()\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.startingTextViewScrollIndicatorInsets, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** used with textView to detect a textFieldView contentInset is changed or not. (Bug ID: #92)*/\n    internal var isTextViewContentInsetChanged: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.isTextViewContentInsetChanged) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.isTextViewContentInsetChanged, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** To know if we have any pending request to adjust view position. */\n    private var hasPendingAdjustRequest: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.hasPendingAdjustRequest) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.hasPendingAdjustRequest, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    internal func optimizedAdjustPosition() {\n        if !hasPendingAdjustRequest {\n            hasPendingAdjustRequest = true\n            OperationQueue.main.addOperation {\n                self.adjustPosition()\n                self.hasPendingAdjustRequest = false\n            }\n        }\n    }\n\n    /* Adjusting RootViewController's frame according to interface orientation. */\n    private func adjustPosition() {\n\n        //  We are unable to get textField object while keyboard showing on WKWebView's textField.  (Bug ID: #11)\n        guard hasPendingAdjustRequest,\n            let textFieldView = textFieldView,\n            let rootController = textFieldView.parentContainerViewController(),\n            let window = keyWindow(),\n            let textFieldViewRectInWindow = textFieldView.superview?.convert(textFieldView.frame, to: window),\n            let textFieldViewRectInRootSuperview = textFieldView.superview?.convert(textFieldView.frame, to: rootController.view?.superview) else {\n                return\n        }\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        //  Getting RootViewOrigin.\n        var rootViewOrigin = rootController.view.frame.origin\n\n        //Maintain keyboardDistanceFromTextField\n        var specialKeyboardDistanceFromTextField = textFieldView.keyboardDistanceFromTextField\n\n        if let searchBar = textFieldView.textFieldSearchBar() {\n            specialKeyboardDistanceFromTextField = searchBar.keyboardDistanceFromTextField\n        }\n\n        let newKeyboardDistanceFromTextField = (specialKeyboardDistanceFromTextField == kIQUseDefaultKeyboardDistance) ? keyboardDistanceFromTextField : specialKeyboardDistanceFromTextField\n\n        var kbSize = keyboardFrame.size\n\n        do {\n            var kbFrame = keyboardFrame\n\n            kbFrame.origin.y -= newKeyboardDistanceFromTextField\n            kbFrame.size.height += newKeyboardDistanceFromTextField\n\n            //Calculating actual keyboard covered size respect to window, keyboard frame may be different when hardware keyboard is attached (Bug ID: #469) (Bug ID: #381) (Bug ID: #1506)\n            let intersectRect = kbFrame.intersection(window.frame)\n\n            if intersectRect.isNull {\n                kbSize = CGSize(width: kbFrame.size.width, height: 0)\n            } else {\n                kbSize = intersectRect.size\n            }\n        }\n\n        let statusBarHeight: CGFloat\n\n        #if swift(>=5.1)\n        if #available(iOS 13, *) {\n            statusBarHeight = window.windowScene?.statusBarManager?.statusBarFrame.height ?? 0\n        } else {\n            statusBarHeight = UIApplication.shared.statusBarFrame.height\n        }\n        #else\n        statusBarHeight = UIApplication.shared.statusBarFrame.height\n        #endif\n\n        let navigationBarAreaHeight: CGFloat = statusBarHeight + ( rootController.navigationController?.navigationBar.frame.height ?? 0)\n        let layoutAreaHeight: CGFloat = rootController.view.layoutMargins.bottom\n\n        let topLayoutGuide: CGFloat = max(navigationBarAreaHeight, layoutAreaHeight) + 5\n        let bottomLayoutGuide: CGFloat = (textFieldView is UIScrollView && textFieldView.responds(to: #selector(getter: UITextView.isEditable))) ? 0 : rootController.view.layoutMargins.bottom  //Validation of textView for case where there is a tab bar at the bottom or running on iPhone X and textView is at the bottom.\n\n        //  Move positive = textField is hidden.\n        //  Move negative = textField is showing.\n        //  Calculating move position.\n        var move: CGFloat = min(textFieldViewRectInRootSuperview.minY-(topLayoutGuide), textFieldViewRectInWindow.maxY-(window.frame.height-kbSize.height)+bottomLayoutGuide)\n\n        showLog(\"Need to move: \\(move)\")\n\n        var superScrollView: UIScrollView?\n        var superView = textFieldView.superviewOfClassType(UIScrollView.self) as? UIScrollView\n\n        //Getting UIScrollView whose scrolling is enabled.    //  (Bug ID: #285)\n        while let view = superView {\n\n            if view.isScrollEnabled, !view.shouldIgnoreScrollingAdjustment {\n                superScrollView = view\n                break\n            } else {\n                //  Getting it's superScrollView.   //  (Enhancement ID: #21, #24)\n                superView = view.superviewOfClassType(UIScrollView.self) as? UIScrollView\n            }\n        }\n\n        //If there was a lastScrollView.    //  (Bug ID: #34)\n        if let lastScrollView = lastScrollView {\n            //If we can't find current superScrollView, then setting lastScrollView to it's original form.\n            if superScrollView == nil {\n\n                if lastScrollView.contentInset != self.startingContentInsets {\n                    showLog(\"Restoring contentInset to: \\(startingContentInsets)\")\n                    UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                        lastScrollView.contentInset = self.startingContentInsets\n                        lastScrollView.scrollIndicatorInsets = self.startingScrollIndicatorInsets\n                    })\n                }\n\n                if lastScrollView.shouldRestoreScrollViewContentOffset, !lastScrollView.contentOffset.equalTo(startingContentOffset) {\n                    showLog(\"Restoring contentOffset to: \\(startingContentOffset)\")\n\n                    let animatedContentOffset = textFieldView.superviewOfClassType(UIStackView.self, belowView: lastScrollView) != nil  //  (Bug ID: #1365, #1508, #1541)\n\n                    if animatedContentOffset {\n                        lastScrollView.setContentOffset(startingContentOffset, animated: UIView.areAnimationsEnabled)\n                    } else {\n                        lastScrollView.contentOffset = startingContentOffset\n                    }\n                }\n\n                startingContentInsets = UIEdgeInsets()\n                startingScrollIndicatorInsets = UIEdgeInsets()\n                startingContentOffset = CGPoint.zero\n                self.lastScrollView = nil\n            } else if superScrollView != lastScrollView {     //If both scrollView's are different, then reset lastScrollView to it's original frame and setting current scrollView as last scrollView.\n\n                if lastScrollView.contentInset != self.startingContentInsets {\n                    showLog(\"Restoring contentInset to: \\(startingContentInsets)\")\n                    UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                        lastScrollView.contentInset = self.startingContentInsets\n                        lastScrollView.scrollIndicatorInsets = self.startingScrollIndicatorInsets\n                    })\n                }\n\n                if lastScrollView.shouldRestoreScrollViewContentOffset, !lastScrollView.contentOffset.equalTo(startingContentOffset) {\n                    showLog(\"Restoring contentOffset to: \\(startingContentOffset)\")\n\n                    let animatedContentOffset = textFieldView.superviewOfClassType(UIStackView.self, belowView: lastScrollView) != nil  //  (Bug ID: #1365, #1508, #1541)\n\n                    if animatedContentOffset {\n                        lastScrollView.setContentOffset(startingContentOffset, animated: UIView.areAnimationsEnabled)\n                    } else {\n                        lastScrollView.contentOffset = startingContentOffset\n                    }\n                }\n\n                self.lastScrollView = superScrollView\n                if let scrollView = superScrollView {\n                    startingContentInsets = scrollView.contentInset\n                    startingContentOffset = scrollView.contentOffset\n\n                    #if swift(>=5.1)\n                    if #available(iOS 11.1, *) {\n                        startingScrollIndicatorInsets = scrollView.verticalScrollIndicatorInsets\n                    } else {\n                        startingScrollIndicatorInsets = scrollView.scrollIndicatorInsets\n                    }\n                    #else\n                    _startingScrollIndicatorInsets = scrollView.scrollIndicatorInsets\n                    #endif\n                }\n\n                showLog(\"Saving ScrollView New contentInset: \\(startingContentInsets) and contentOffset: \\(startingContentOffset)\")\n            }\n            //Else the case where superScrollView == lastScrollView means we are on same scrollView after switching to different textField. So doing nothing, going ahead\n        } else if let unwrappedSuperScrollView = superScrollView {    //If there was no lastScrollView and we found a current scrollView. then setting it as lastScrollView.\n            lastScrollView = unwrappedSuperScrollView\n            startingContentInsets = unwrappedSuperScrollView.contentInset\n            startingContentOffset = unwrappedSuperScrollView.contentOffset\n\n            #if swift(>=5.1)\n            if #available(iOS 11.1, *) {\n                startingScrollIndicatorInsets = unwrappedSuperScrollView.verticalScrollIndicatorInsets\n            } else {\n                startingScrollIndicatorInsets = unwrappedSuperScrollView.scrollIndicatorInsets\n            }\n            #else\n            _startingScrollIndicatorInsets = unwrappedSuperScrollView.scrollIndicatorInsets\n            #endif\n\n            showLog(\"Saving ScrollView contentInset: \\(startingContentInsets) and contentOffset: \\(startingContentOffset)\")\n        }\n\n        //  Special case for ScrollView.\n        //  If we found lastScrollView then setting it's contentOffset to show textField.\n        if let lastScrollView = lastScrollView {\n            //Saving\n            var lastView = textFieldView\n            var superScrollView = self.lastScrollView\n\n            while let scrollView = superScrollView {\n\n                var shouldContinue = false\n\n                if move > 0 {\n                    shouldContinue =  move > (-scrollView.contentOffset.y - scrollView.contentInset.top)\n\n                } else if let tableView = scrollView.superviewOfClassType(UITableView.self) as? UITableView {\n\n                    shouldContinue = scrollView.contentOffset.y > 0\n\n                    if shouldContinue, let tableCell = textFieldView.superviewOfClassType(UITableViewCell.self) as? UITableViewCell, let indexPath = tableView.indexPath(for: tableCell), let previousIndexPath = tableView.previousIndexPath(of: indexPath) {\n\n                        let previousCellRect = tableView.rectForRow(at: previousIndexPath)\n                        if !previousCellRect.isEmpty {\n                            let previousCellRectInRootSuperview = tableView.convert(previousCellRect, to: rootController.view.superview)\n\n                            move = min(0, previousCellRectInRootSuperview.maxY - topLayoutGuide)\n                        }\n                    }\n                } else if let collectionView = scrollView.superviewOfClassType(UICollectionView.self) as? UICollectionView {\n\n                    shouldContinue = scrollView.contentOffset.y > 0\n\n                    if shouldContinue, let collectionCell = textFieldView.superviewOfClassType(UICollectionViewCell.self) as? UICollectionViewCell, let indexPath = collectionView.indexPath(for: collectionCell), let previousIndexPath = collectionView.previousIndexPath(of: indexPath), let attributes = collectionView.layoutAttributesForItem(at: previousIndexPath) {\n\n                        let previousCellRect = attributes.frame\n                        if !previousCellRect.isEmpty {\n                            let previousCellRectInRootSuperview = collectionView.convert(previousCellRect, to: rootController.view.superview)\n\n                            move = min(0, previousCellRectInRootSuperview.maxY - topLayoutGuide)\n                        }\n                    }\n                } else {\n\n                    shouldContinue = textFieldViewRectInRootSuperview.origin.y < topLayoutGuide\n\n                    if shouldContinue {\n                        move = min(0, textFieldViewRectInRootSuperview.origin.y - topLayoutGuide)\n                    }\n                }\n\n                //Looping in upper hierarchy until we don't found any scrollView in it's upper hirarchy till UIWindow object.\n                if shouldContinue {\n\n                    var tempScrollView = scrollView.superviewOfClassType(UIScrollView.self) as? UIScrollView\n                    var nextScrollView: UIScrollView?\n                    while let view = tempScrollView {\n\n                        if view.isScrollEnabled, !view.shouldIgnoreScrollingAdjustment {\n                            nextScrollView = view\n                            break\n                        } else {\n                            tempScrollView = view.superviewOfClassType(UIScrollView.self) as? UIScrollView\n                        }\n                    }\n\n                    //Getting lastViewRect.\n                    if let lastViewRect = lastView.superview?.convert(lastView.frame, to: scrollView) {\n\n                        //Calculating the expected Y offset from move and scrollView's contentOffset.\n                        var shouldOffsetY = scrollView.contentOffset.y - min(scrollView.contentOffset.y, -move)\n\n                        //Rearranging the expected Y offset according to the view.\n                        shouldOffsetY = min(shouldOffsetY, lastViewRect.origin.y)\n\n                        //[_textFieldView isKindOfClass:[UITextView class]] If is a UITextView type\n                        //nextScrollView == nil    If processing scrollView is last scrollView in upper hierarchy (there is no other scrollView upper hierrchy.)\n                        //[_textFieldView isKindOfClass:[UITextView class]] If is a UITextView type\n                        //shouldOffsetY >= 0     shouldOffsetY must be greater than in order to keep distance from navigationBar (Bug ID: #92)\n                        if (textFieldView is UIScrollView && textFieldView.responds(to: #selector(getter: UITextView.isEditable))),\n                            nextScrollView == nil,\n                            shouldOffsetY >= 0 {\n\n                            //  Converting Rectangle according to window bounds.\n                            if let currentTextFieldViewRect = textFieldView.superview?.convert(textFieldView.frame, to: window) {\n\n                                //Calculating expected fix distance which needs to be managed from navigation bar\n                                let expectedFixDistance = currentTextFieldViewRect.minY - topLayoutGuide\n\n                                //Now if expectedOffsetY (superScrollView.contentOffset.y + expectedFixDistance) is lower than current shouldOffsetY, which means we're in a position where navigationBar up and hide, then reducing shouldOffsetY with expectedOffsetY (superScrollView.contentOffset.y + expectedFixDistance)\n                                shouldOffsetY = min(shouldOffsetY, scrollView.contentOffset.y + expectedFixDistance)\n\n                                //Setting move to 0 because now we don't want to move any view anymore (All will be managed by our contentInset logic.\n                                move = 0\n                            } else {\n                                //Subtracting the Y offset from the move variable, because we are going to change scrollView's contentOffset.y to shouldOffsetY.\n                                move -= (shouldOffsetY-scrollView.contentOffset.y)\n                            }\n                        } else {\n                            //Subtracting the Y offset from the move variable, because we are going to change scrollView's contentOffset.y to shouldOffsetY.\n                            move -= (shouldOffsetY-scrollView.contentOffset.y)\n                        }\n\n                        let newContentOffset = CGPoint(x: scrollView.contentOffset.x, y: shouldOffsetY)\n\n                        if scrollView.contentOffset.equalTo(newContentOffset) == false {\n\n                            showLog(\"old contentOffset: \\(scrollView.contentOffset) new contentOffset: \\(newContentOffset)\")\n                            self.showLog(\"Remaining Move: \\(move)\")\n\n                            //Getting problem while using `setContentOffset:animated:`, So I used animation API.\n                            UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                                let animatedContentOffset = textFieldView.superviewOfClassType(UIStackView.self, belowView: scrollView) != nil  //  (Bug ID: #1365, #1508, #1541)\n\n                                if animatedContentOffset {\n                                    scrollView.setContentOffset(newContentOffset, animated: UIView.areAnimationsEnabled)\n                                } else {\n                                    scrollView.contentOffset = newContentOffset\n                                }\n                            }, completion: { _ in\n\n                                if scrollView is UITableView || scrollView is UICollectionView {\n                                    //This will update the next/previous states\n                                    self.addToolbarIfRequired()\n                                }\n                            })\n                        }\n                    }\n\n                    //  Getting next lastView & superScrollView.\n                    lastView = scrollView\n                    superScrollView = nextScrollView\n                } else {\n                    move = 0\n                    break\n                }\n            }\n\n            //Updating contentInset\n            if let lastScrollViewRect = lastScrollView.superview?.convert(lastScrollView.frame, to: window),\n                lastScrollView.shouldIgnoreContentInsetAdjustment == false {\n\n                var bottomInset: CGFloat = (kbSize.height)-(window.frame.height-lastScrollViewRect.maxY)\n                var bottomScrollIndicatorInset = bottomInset - newKeyboardDistanceFromTextField\n\n                // Update the insets so that the scroll vew doesn't shift incorrectly when the offset is near the bottom of the scroll view.\n                bottomInset = max(startingContentInsets.bottom, bottomInset)\n                bottomScrollIndicatorInset = max(startingScrollIndicatorInsets.bottom, bottomScrollIndicatorInset)\n\n                if #available(iOS 11, *) {\n                    bottomInset -= lastScrollView.safeAreaInsets.bottom\n                    bottomScrollIndicatorInset -= lastScrollView.safeAreaInsets.bottom\n                }\n\n                var movedInsets = lastScrollView.contentInset\n                movedInsets.bottom = bottomInset\n\n                if lastScrollView.contentInset != movedInsets {\n                    showLog(\"old ContentInset: \\(lastScrollView.contentInset) new ContentInset: \\(movedInsets)\")\n\n                    UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n                        lastScrollView.contentInset = movedInsets\n\n                        var newScrollIndicatorInset: UIEdgeInsets\n\n                        #if swift(>=5.1)\n                        if #available(iOS 11.1, *) {\n                            newScrollIndicatorInset = lastScrollView.verticalScrollIndicatorInsets\n                        } else {\n                            newScrollIndicatorInset = lastScrollView.scrollIndicatorInsets\n                        }\n                        #else\n                        newScrollIndicatorInset = lastScrollView.scrollIndicatorInsets\n                        #endif\n\n                        newScrollIndicatorInset.bottom = bottomScrollIndicatorInset\n                        lastScrollView.scrollIndicatorInsets = newScrollIndicatorInset\n                    })\n                }\n            }\n        }\n        //Going ahead. No else if.\n\n        //Special case for UITextView(Readjusting textView.contentInset when textView hight is too big to fit on screen)\n        //_lastScrollView       If not having inside any scrollView, (now contentInset manages the full screen textView.\n        //[_textFieldView isKindOfClass:[UITextView class]] If is a UITextView type\n        if let textView = textFieldView as? UIScrollView, textView.isScrollEnabled, textFieldView.responds(to: #selector(getter: UITextView.isEditable)) {\n\n            //                CGRect rootSuperViewFrameInWindow = [_rootViewController.view.superview convertRect:_rootViewController.view.superview.bounds toView:keyWindow];\n            //\n            //                CGFloat keyboardOverlapping = CGRectGetMaxY(rootSuperViewFrameInWindow) - keyboardYPosition;\n            //\n            //                CGFloat textViewHeight = MIN(CGRectGetHeight(_textFieldView.frame), (CGRectGetHeight(rootSuperViewFrameInWindow)-topLayoutGuide-keyboardOverlapping));\n\n            let keyboardYPosition = window.frame.height - (kbSize.height-newKeyboardDistanceFromTextField)\n            var rootSuperViewFrameInWindow = window.frame\n            if let rootSuperview = rootController.view.superview {\n                rootSuperViewFrameInWindow = rootSuperview.convert(rootSuperview.bounds, to: window)\n            }\n\n            let keyboardOverlapping = rootSuperViewFrameInWindow.maxY - keyboardYPosition\n\n            let textViewHeight = min(textView.frame.height, rootSuperViewFrameInWindow.height-topLayoutGuide-keyboardOverlapping)\n\n            if textView.frame.size.height-textView.contentInset.bottom>textViewHeight {\n                //_isTextViewContentInsetChanged,  If frame is not change by library in past, then saving user textView properties  (Bug ID: #92)\n                if !self.isTextViewContentInsetChanged {\n                    self.startingTextViewContentInsets = textView.contentInset\n\n                    #if swift(>=5.1)\n                    if #available(iOS 11.1, *) {\n                        self.startingTextViewScrollIndicatorInsets = textView.verticalScrollIndicatorInsets\n                    } else {\n                        self.startingTextViewScrollIndicatorInsets = textView.scrollIndicatorInsets\n                    }\n                    #else\n                    self.startingTextViewScrollIndicatorInsets = textView.scrollIndicatorInsets\n                    #endif\n                }\n\n                self.isTextViewContentInsetChanged = true\n\n                var newContentInset = textView.contentInset\n                newContentInset.bottom = textView.frame.size.height-textViewHeight\n\n                if #available(iOS 11, *) {\n                    newContentInset.bottom -= textView.safeAreaInsets.bottom\n                }\n\n                if textView.contentInset != newContentInset {\n                    self.showLog(\"\\(textFieldView) Old UITextView.contentInset: \\(textView.contentInset) New UITextView.contentInset: \\(newContentInset)\")\n\n                    UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                        textView.contentInset = newContentInset\n                        textView.scrollIndicatorInsets = newContentInset\n                    }, completion: { (_) -> Void in })\n                }\n            }\n        }\n\n        //  +Positive or zero.\n        if move >= 0 {\n\n            rootViewOrigin.y = max(rootViewOrigin.y - move, min(0, -(kbSize.height-newKeyboardDistanceFromTextField)))\n\n            if rootController.view.frame.origin.equalTo(rootViewOrigin) == false {\n                showLog(\"Moving Upward\")\n\n                UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                    var rect = rootController.view.frame\n                    rect.origin = rootViewOrigin\n                    rootController.view.frame = rect\n\n                    //Animating content if needed (Bug ID: #204)\n                    if self.layoutIfNeededOnUpdate {\n                        //Animating content (Bug ID: #160)\n                        rootController.view.setNeedsLayout()\n                        rootController.view.layoutIfNeeded()\n                    }\n\n                    self.showLog(\"Set \\(rootController) origin to: \\(rootViewOrigin)\")\n                })\n            }\n\n            movedDistance = (topViewBeginOrigin.y-rootViewOrigin.y)\n        } else {  //  -Negative\n            let disturbDistance: CGFloat = rootViewOrigin.y-topViewBeginOrigin.y\n\n            //  disturbDistance Negative = frame disturbed.\n            //  disturbDistance positive = frame not disturbed.\n            if disturbDistance <= 0 {\n\n                rootViewOrigin.y -= max(move, disturbDistance)\n\n                if rootController.view.frame.origin.equalTo(rootViewOrigin) == false {\n                    showLog(\"Moving Downward\")\n                    //  Setting adjusted rootViewRect\n                    //  Setting adjusted rootViewRect\n\n                    UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                        var rect = rootController.view.frame\n                        rect.origin = rootViewOrigin\n                        rootController.view.frame = rect\n\n                        //Animating content if needed (Bug ID: #204)\n                        if self.layoutIfNeededOnUpdate {\n                            //Animating content (Bug ID: #160)\n                            rootController.view.setNeedsLayout()\n                            rootController.view.layoutIfNeeded()\n                        }\n\n                        self.showLog(\"Set \\(rootController) origin to: \\(rootViewOrigin)\")\n                    })\n                }\n\n                movedDistance = (topViewBeginOrigin.y-rootViewOrigin.y)\n            }\n        }\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n\n    internal func restorePosition() {\n\n        hasPendingAdjustRequest = false\n\n        //  Setting rootViewController frame to it's original position. //  (Bug ID: #18)\n        guard topViewBeginOrigin.equalTo(IQKeyboardManager.kIQCGPointInvalid) == false, let rootViewController = rootViewController else {\n            return\n        }\n\n        if rootViewController.view.frame.origin.equalTo(self.topViewBeginOrigin) == false {\n            //Used UIViewAnimationOptionBeginFromCurrentState to minimize strange animations.\n            UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                self.showLog(\"Restoring \\(rootViewController) origin to: \\(self.topViewBeginOrigin)\")\n\n                //  Setting it's new frame\n                var rect = rootViewController.view.frame\n                rect.origin = self.topViewBeginOrigin\n                rootViewController.view.frame = rect\n\n                //Animating content if needed (Bug ID: #204)\n                if self.layoutIfNeededOnUpdate {\n                    //Animating content (Bug ID: #160)\n                    rootViewController.view.setNeedsLayout()\n                    rootViewController.view.layoutIfNeeded()\n                }\n            })\n        }\n\n        self.movedDistance = 0\n\n        if rootViewController.navigationController?.interactivePopGestureRecognizer?.state == .began {\n            self.rootViewControllerWhilePopGestureRecognizerActive = rootViewController\n            self.topViewBeginOriginWhilePopGestureRecognizerActive = self.topViewBeginOrigin\n        }\n\n        self.rootViewController = nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+Toolbar.swift",
    "content": "//\n//  IQKeyboardManager+Toolbar.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\npublic extension IQKeyboardManager {\n\n    /**\n    Default tag for toolbar with Done button   -1002.\n    */\n    private static let  kIQDoneButtonToolbarTag         =   -1002\n\n    /**\n    Default tag for toolbar with Previous/Next buttons -1005.\n    */\n    private static let  kIQPreviousNextButtonToolbarTag =   -1005\n\n    /** Add toolbar if it is required to add on textFields and it's siblings. */\n    internal func addToolbarIfRequired() {\n\n        //Either there is no inputAccessoryView or if accessoryView is not appropriate for current situation(There is Previous/Next/Done toolbar).\n        guard let siblings = responderViews(), !siblings.isEmpty,\n              let textField = textFieldView, textField.responds(to: #selector(setter: UITextField.inputAccessoryView)),\n              (textField.inputAccessoryView == nil ||\n                textField.inputAccessoryView?.tag == IQKeyboardManager.kIQPreviousNextButtonToolbarTag ||\n                textField.inputAccessoryView?.tag == IQKeyboardManager.kIQDoneButtonToolbarTag) else {\n            return\n        }\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        showLog(\"Found \\(siblings.count) responder sibling(s)\")\n\n        let rightConfiguration: IQBarButtonItemConfiguration\n\n        if let doneBarButtonItemImage = toolbarDoneBarButtonItemImage {\n            rightConfiguration = IQBarButtonItemConfiguration(image: doneBarButtonItemImage, action: #selector(self.doneAction(_:)))\n        } else if let doneBarButtonItemText = toolbarDoneBarButtonItemText {\n            rightConfiguration = IQBarButtonItemConfiguration(title: doneBarButtonItemText, action: #selector(self.doneAction(_:)))\n        } else {\n            rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: #selector(self.doneAction(_:)))\n        }\n        rightConfiguration.accessibilityLabel = toolbarDoneBarButtonItemAccessibilityLabel ?? \"Done\"\n\n        //    If only one object is found, then adding only Done button.\n        if (siblings.count <= 1 && previousNextDisplayMode == .default) || previousNextDisplayMode == .alwaysHide {\n\n            textField.addKeyboardToolbarWithTarget(target: self, titleText: (shouldShowToolbarPlaceholder ? textField.drawingToolbarPlaceholder: nil), rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: nil, nextBarButtonConfiguration: nil)\n\n            textField.inputAccessoryView?.tag = IQKeyboardManager.kIQDoneButtonToolbarTag //  (Bug ID: #78)\n\n        } else if previousNextDisplayMode == .default || previousNextDisplayMode == .alwaysShow {\n\n            let prevConfiguration: IQBarButtonItemConfiguration\n\n            if let doneBarButtonItemImage = toolbarPreviousBarButtonItemImage {\n                prevConfiguration = IQBarButtonItemConfiguration(image: doneBarButtonItemImage, action: #selector(self.previousAction(_:)))\n            } else if let doneBarButtonItemText = toolbarPreviousBarButtonItemText {\n                prevConfiguration = IQBarButtonItemConfiguration(title: doneBarButtonItemText, action: #selector(self.previousAction(_:)))\n            } else {\n                prevConfiguration = IQBarButtonItemConfiguration(image: (UIImage.keyboardPreviousImage() ?? UIImage()), action: #selector(self.previousAction(_:)))\n            }\n            prevConfiguration.accessibilityLabel = toolbarPreviousBarButtonItemAccessibilityLabel ?? \"Previous\"\n\n            let nextConfiguration: IQBarButtonItemConfiguration\n\n            if let doneBarButtonItemImage = toolbarNextBarButtonItemImage {\n                nextConfiguration = IQBarButtonItemConfiguration(image: doneBarButtonItemImage, action: #selector(self.nextAction(_:)))\n            } else if let doneBarButtonItemText = toolbarNextBarButtonItemText {\n                nextConfiguration = IQBarButtonItemConfiguration(title: doneBarButtonItemText, action: #selector(self.nextAction(_:)))\n            } else {\n                nextConfiguration = IQBarButtonItemConfiguration(image: (UIImage.keyboardNextImage() ?? UIImage()), action: #selector(self.nextAction(_:)))\n            }\n            nextConfiguration.accessibilityLabel = toolbarNextBarButtonItemAccessibilityLabel ?? \"Next\"\n\n            textField.addKeyboardToolbarWithTarget(target: self, titleText: (shouldShowToolbarPlaceholder ? textField.drawingToolbarPlaceholder: nil), rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)\n\n            textField.inputAccessoryView?.tag = IQKeyboardManager.kIQPreviousNextButtonToolbarTag //  (Bug ID: #78)\n        }\n\n        let toolbar = textField.keyboardToolbar\n\n        //Setting toolbar tintColor //  (Enhancement ID: #30)\n        toolbar.tintColor = shouldToolbarUsesTextFieldTintColor ? textField.tintColor : toolbarTintColor\n\n        //  Setting toolbar to keyboard.\n        if let textFieldView = textField as? UITextInput {\n\n            //Bar style according to keyboard appearance\n            switch textFieldView.keyboardAppearance {\n\n            case .dark?:\n                toolbar.barStyle = .black\n                toolbar.barTintColor = nil\n            default:\n                toolbar.barStyle = .default\n                toolbar.barTintColor = toolbarBarTintColor\n            }\n        }\n\n        //Setting toolbar title font.   //  (Enhancement ID: #30)\n        if shouldShowToolbarPlaceholder, !textField.shouldHideToolbarPlaceholder {\n\n            //Updating placeholder font to toolbar.     //(Bug ID: #148, #272)\n            if toolbar.titleBarButton.title == nil ||\n                toolbar.titleBarButton.title != textField.drawingToolbarPlaceholder {\n                toolbar.titleBarButton.title = textField.drawingToolbarPlaceholder\n            }\n\n            //Setting toolbar title font.   //  (Enhancement ID: #30)\n            toolbar.titleBarButton.titleFont = placeholderFont\n\n            //Setting toolbar title color.   //  (Enhancement ID: #880)\n            toolbar.titleBarButton.titleColor = placeholderColor\n\n            //Setting toolbar button title color.   //  (Enhancement ID: #880)\n            toolbar.titleBarButton.selectableTitleColor = placeholderButtonColor\n\n        } else {\n            toolbar.titleBarButton.title = nil\n        }\n\n        //In case of UITableView (Special), the next/previous buttons has to be refreshed everytime.    (Bug ID: #56)\n\n        textField.keyboardToolbar.previousBarButton.isEnabled = (siblings.first != textField)   //    If firstTextField, then previous should not be enabled.\n        textField.keyboardToolbar.nextBarButton.isEnabled = (siblings.last != textField)        //    If lastTextField then next should not be enaled.\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n\n    /** Remove any toolbar if it is IQToolbar. */\n    internal func removeToolbarIfRequired() {    //  (Bug ID: #18)\n\n        guard let siblings = responderViews(), !siblings.isEmpty,\n              let textField = textFieldView, textField.responds(to: #selector(setter: UITextField.inputAccessoryView)),\n              (textField.inputAccessoryView == nil ||\n                textField.inputAccessoryView?.tag == IQKeyboardManager.kIQPreviousNextButtonToolbarTag ||\n                textField.inputAccessoryView?.tag == IQKeyboardManager.kIQDoneButtonToolbarTag) else {\n            return\n        }\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        showLog(\"Found \\(siblings.count) responder sibling(s)\")\n\n        for view in siblings {\n            if let toolbar = view.inputAccessoryView as? IQToolbar {\n\n                //setInputAccessoryView: check   (Bug ID: #307)\n                if view.responds(to: #selector(setter: UITextField.inputAccessoryView)),\n                    (toolbar.tag == IQKeyboardManager.kIQDoneButtonToolbarTag || toolbar.tag == IQKeyboardManager.kIQPreviousNextButtonToolbarTag) {\n\n                    if let textField = view as? UITextField {\n                        textField.inputAccessoryView = nil\n                    } else if let textView = view as? UITextView {\n                        textView.inputAccessoryView = nil\n                    }\n\n                    view.reloadInputViews()\n                }\n            }\n        }\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n\n    /**    reloadInputViews to reload toolbar buttons enable/disable state on the fly Enhancement ID #434. */\n    @objc func reloadInputViews() {\n\n        //If enabled then adding toolbar.\n        if privateIsEnableAutoToolbar() {\n            self.addToolbarIfRequired()\n        } else {\n            self.removeToolbarIfRequired()\n        }\n    }\n}\n\n// MARK: Previous next button actions\n@available(iOSApplicationExtension, unavailable)\npublic extension IQKeyboardManager {\n\n    /**\n    Returns YES if can navigate to previous responder textField/textView, otherwise NO.\n    */\n    @objc var canGoPrevious: Bool {\n        //If it is not first textField. then it's previous object canBecomeFirstResponder.\n        guard let textFields = responderViews(), let textFieldRetain = textFieldView, let index = textFields.firstIndex(of: textFieldRetain), index > 0 else {\n            return false\n        }\n        return true\n    }\n\n    /**\n    Returns YES if can navigate to next responder textField/textView, otherwise NO.\n    */\n    @objc var canGoNext: Bool {\n        //If it is not first textField. then it's previous object canBecomeFirstResponder.\n        guard let textFields = responderViews(), let textFieldRetain = textFieldView, let index = textFields.firstIndex(of: textFieldRetain), index < textFields.count-1 else {\n            return false\n        }\n        return true\n    }\n\n    /**\n    Navigate to previous responder textField/textView.\n    */\n    @objc @discardableResult func goPrevious() -> Bool {\n\n        //If it is not first textField. then it's previous object becomeFirstResponder.\n        guard let textFields = responderViews(), let textFieldRetain = textFieldView, let index = textFields.firstIndex(of: textFieldRetain), index > 0 else {\n            return false\n        }\n\n        let nextTextField = textFields[index-1]\n\n        let isAcceptAsFirstResponder = nextTextField.becomeFirstResponder()\n\n        //  If it refuses then becoming previous textFieldView as first responder again.    (Bug ID: #96)\n        if isAcceptAsFirstResponder == false {\n            //If next field refuses to become first responder then restoring old textField as first responder.\n            textFieldRetain.becomeFirstResponder()\n\n            showLog(\"Refuses to become first responder: \\(nextTextField)\")\n        }\n\n        return isAcceptAsFirstResponder    }\n\n    /**\n    Navigate to next responder textField/textView.\n    */\n    @objc @discardableResult func goNext() -> Bool {\n\n        //If it is not first textField. then it's previous object becomeFirstResponder.\n        guard let textFields = responderViews(), let textFieldRetain = textFieldView, let index = textFields.firstIndex(of: textFieldRetain), index < textFields.count-1 else {\n            return false\n        }\n\n        let nextTextField = textFields[index+1]\n\n        let isAcceptAsFirstResponder = nextTextField.becomeFirstResponder()\n\n        //  If it refuses then becoming previous textFieldView as first responder again.    (Bug ID: #96)\n        if isAcceptAsFirstResponder == false {\n            //If next field refuses to become first responder then restoring old textField as first responder.\n            textFieldRetain.becomeFirstResponder()\n\n            showLog(\"Refuses to become first responder: \\(nextTextField)\")\n        }\n\n        return isAcceptAsFirstResponder\n    }\n\n    /**    previousAction. */\n    @objc internal func previousAction (_ barButton: IQBarButtonItem) {\n\n        //If user wants to play input Click sound.\n        if shouldPlayInputClicks {\n            //Play Input Click Sound.\n            UIDevice.current.playInputClick()\n        }\n\n        guard canGoPrevious, let textFieldRetain = textFieldView else {\n            return\n        }\n\n        let isAcceptAsFirstResponder = goPrevious()\n\n        var invocation = barButton.invocation\n        var sender = textFieldRetain\n\n        //Handling search bar special case\n        do {\n            if let searchBar = textFieldRetain.textFieldSearchBar() {\n                invocation = searchBar.keyboardToolbar.previousBarButton.invocation\n                sender = searchBar\n            }\n        }\n\n        if isAcceptAsFirstResponder {\n            invocation?.invoke(from: sender)\n        }\n    }\n\n    /**    nextAction. */\n    @objc internal func nextAction (_ barButton: IQBarButtonItem) {\n\n        //If user wants to play input Click sound.\n        if shouldPlayInputClicks {\n            //Play Input Click Sound.\n            UIDevice.current.playInputClick()\n        }\n\n        guard canGoNext, let textFieldRetain = textFieldView else {\n            return\n        }\n\n        let isAcceptAsFirstResponder = goNext()\n\n        var invocation = barButton.invocation\n        var sender = textFieldRetain\n\n        //Handling search bar special case\n        do {\n            if let searchBar = textFieldRetain.textFieldSearchBar() {\n                invocation = searchBar.keyboardToolbar.nextBarButton.invocation\n                sender = searchBar\n            }\n        }\n\n        if isAcceptAsFirstResponder {\n            invocation?.invoke(from: sender)\n        }\n    }\n\n    /**    doneAction. Resigning current textField. */\n    @objc internal func doneAction (_ barButton: IQBarButtonItem) {\n\n        //If user wants to play input Click sound.\n        if shouldPlayInputClicks {\n            //Play Input Click Sound.\n            UIDevice.current.playInputClick()\n        }\n\n        guard let textFieldRetain = textFieldView else {\n            return\n        }\n\n        //Resign textFieldView.\n        let isResignedFirstResponder = resignFirstResponder()\n\n        var invocation = barButton.invocation\n        var sender = textFieldRetain\n\n        //Handling search bar special case\n        do {\n            if let searchBar = textFieldRetain.textFieldSearchBar() {\n                invocation = searchBar.keyboardToolbar.doneBarButton.invocation\n                sender = searchBar\n            }\n        }\n\n        if isResignedFirstResponder {\n            invocation?.invoke(from: sender)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+UIKeyboardNotification.swift",
    "content": "//\n//  IQKeyboardManager+UIKeyboardNotification.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n// MARK: UIKeyboard Notifications\n@available(iOSApplicationExtension, unavailable)\npublic extension IQKeyboardManager {\n\n    private struct AssociatedKeys {\n        static var keyboardShowing = \"keyboardShowing\"\n        static var keyboardShowNotification = \"keyboardShowNotification\"\n        static var keyboardFrame = \"keyboardFrame\"\n        static var animationDuration = \"animationDuration\"\n        static var animationCurve = \"animationCurve\"\n    }\n\n    /**\n     Boolean to know if keyboard is showing.\n     */\n    @objc private(set) var keyboardShowing: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.keyboardShowing) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.keyboardShowing, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** To save keyboardWillShowNotification. Needed for enable keyboard functionality. */\n    internal var keyboardShowNotification: Notification? {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.keyboardShowNotification) as? Notification\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.keyboardShowNotification, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** To save keyboard rame. */\n    internal var keyboardFrame: CGRect {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.keyboardFrame) as? CGRect ?? .zero\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.keyboardFrame, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** To save keyboard animation duration. */\n    internal var animationDuration: TimeInterval {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.animationDuration) as? TimeInterval ?? 0.25\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.animationDuration, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** To mimic the keyboard animation */\n    internal var animationCurve: UIView.AnimationOptions {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.animationCurve) as? UIView.AnimationOptions ?? .curveEaseOut\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.animationCurve, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /*  UIKeyboardWillShowNotification. */\n    @objc internal func keyboardWillShow(_ notification: Notification?) {\n\n        keyboardShowNotification = notification\n\n        //  Boolean to know keyboard is showing/hiding\n        keyboardShowing = true\n\n        let oldKBFrame = keyboardFrame\n\n        if let info = notification?.userInfo {\n\n            //  Getting keyboard animation.\n            if let curve = info[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt {\n                animationCurve = UIView.AnimationOptions(rawValue: curve).union(.beginFromCurrentState)\n            } else {\n                animationCurve = UIView.AnimationOptions.curveEaseOut.union(.beginFromCurrentState)\n            }\n\n            //  Getting keyboard animation duration\n            animationDuration = info[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval ?? 0.25\n\n            //  Getting UIKeyboardSize.\n            if let kbFrame = info[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect {\n\n                keyboardFrame = kbFrame\n                showLog(\"UIKeyboard Frame: \\(keyboardFrame)\")\n            }\n        }\n\n        guard privateIsEnabled() else {\n            restorePosition()\n            topViewBeginOrigin = IQKeyboardManager.kIQCGPointInvalid\n            return\n        }\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        //  (Bug ID: #5)\n        if let textFieldView = textFieldView, topViewBeginOrigin.equalTo(IQKeyboardManager.kIQCGPointInvalid) {\n\n            //  keyboard is not showing(At the beginning only). We should save rootViewRect.\n            rootViewController = textFieldView.parentContainerViewController()\n            if let controller = rootViewController {\n\n                if rootViewControllerWhilePopGestureRecognizerActive == controller {\n                    topViewBeginOrigin = topViewBeginOriginWhilePopGestureRecognizerActive\n                } else {\n                    topViewBeginOrigin = controller.view.frame.origin\n                }\n\n                rootViewControllerWhilePopGestureRecognizerActive = nil\n                topViewBeginOriginWhilePopGestureRecognizerActive = IQKeyboardManager.kIQCGPointInvalid\n\n                self.showLog(\"Saving \\(controller) beginning origin: \\(self.topViewBeginOrigin)\")\n            }\n        }\n\n        //If last restored keyboard size is different(any orientation accure), then refresh. otherwise not.\n        if keyboardFrame.equalTo(oldKBFrame) == false {\n\n            //If textFieldView is inside UITableViewController then let UITableViewController to handle it (Bug ID: #37) (Bug ID: #76) See note:- https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html If it is UIAlertView textField then do not affect anything (Bug ID: #70).\n\n            if keyboardShowing,\n                let textFieldView = textFieldView,\n                textFieldView.isAlertViewTextField() == false {\n\n                //  keyboard is already showing. adjust position.\n                optimizedAdjustPosition()\n            }\n        }\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n\n    /*  UIKeyboardDidShowNotification. */\n    @objc internal func keyboardDidShow(_ notification: Notification?) {\n\n        guard privateIsEnabled(),\n            let textFieldView = textFieldView,\n            let parentController = textFieldView.parentContainerViewController(), (parentController.modalPresentationStyle == UIModalPresentationStyle.formSheet || parentController.modalPresentationStyle == UIModalPresentationStyle.pageSheet),\n            textFieldView.isAlertViewTextField() == false else {\n                return\n        }\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        self.optimizedAdjustPosition()\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n\n    /*  UIKeyboardWillHideNotification. So setting rootViewController to it's default frame. */\n    @objc internal func keyboardWillHide(_ notification: Notification?) {\n\n        //If it's not a fake notification generated by [self setEnable:NO].\n        if notification != nil {\n            keyboardShowNotification = nil\n        }\n\n        //  Boolean to know keyboard is showing/hiding\n        keyboardShowing = false\n\n        if let info = notification?.userInfo {\n\n            //  Getting keyboard animation.\n            if let curve = info[UIResponder.keyboardAnimationCurveUserInfoKey] as? UInt {\n                animationCurve = UIView.AnimationOptions(rawValue: curve).union(.beginFromCurrentState)\n            } else {\n                animationCurve = UIView.AnimationOptions.curveEaseOut.union(.beginFromCurrentState)\n            }\n\n            //  Getting keyboard animation duration\n            animationDuration = info[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval ?? 0.25\n        }\n\n        //If not enabled then do nothing.\n        guard privateIsEnabled() else {\n            return\n        }\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        //Commented due to #56. Added all the conditions below to handle WKWebView's textFields.    (Bug ID: #56)\n        //  We are unable to get textField object while keyboard showing on WKWebView's textField.  (Bug ID: #11)\n        //    if (_textFieldView == nil)   return\n\n        //Restoring the contentOffset of the lastScrollView\n        if let lastScrollView = lastScrollView {\n\n            UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                if lastScrollView.contentInset != self.startingContentInsets {\n                    self.showLog(\"Restoring contentInset to: \\(self.startingContentInsets)\")\n                    lastScrollView.contentInset = self.startingContentInsets\n                    lastScrollView.scrollIndicatorInsets = self.startingScrollIndicatorInsets\n                }\n\n                if lastScrollView.shouldRestoreScrollViewContentOffset, !lastScrollView.contentOffset.equalTo(self.startingContentOffset) {\n                    self.showLog(\"Restoring contentOffset to: \\(self.startingContentOffset)\")\n\n                    let animatedContentOffset = self.textFieldView?.superviewOfClassType(UIStackView.self, belowView: lastScrollView) != nil  //  (Bug ID: #1365, #1508, #1541)\n\n                    if animatedContentOffset {\n                        lastScrollView.setContentOffset(self.startingContentOffset, animated: UIView.areAnimationsEnabled)\n                    } else {\n                        lastScrollView.contentOffset = self.startingContentOffset\n                    }\n                }\n\n                // TODO: restore scrollView state\n                // This is temporary solution. Have to implement the save and restore scrollView state\n                var superScrollView: UIScrollView? = lastScrollView\n\n                while let scrollView = superScrollView {\n\n                    let contentSize = CGSize(width: max(scrollView.contentSize.width, scrollView.frame.width), height: max(scrollView.contentSize.height, scrollView.frame.height))\n\n                    let minimumY = contentSize.height - scrollView.frame.height\n\n                    if minimumY < scrollView.contentOffset.y {\n\n                        let newContentOffset = CGPoint(x: scrollView.contentOffset.x, y: minimumY)\n                        if scrollView.contentOffset.equalTo(newContentOffset) == false {\n\n                            let animatedContentOffset = self.textFieldView?.superviewOfClassType(UIStackView.self, belowView: scrollView) != nil  //  (Bug ID: #1365, #1508, #1541)\n\n                            if animatedContentOffset {\n                                scrollView.setContentOffset(newContentOffset, animated: UIView.areAnimationsEnabled)\n                            } else {\n                                scrollView.contentOffset = newContentOffset\n                            }\n\n                            self.showLog(\"Restoring contentOffset to: \\(self.startingContentOffset)\")\n                        }\n                    }\n\n                    superScrollView = scrollView.superviewOfClassType(UIScrollView.self) as? UIScrollView\n                }\n            })\n        }\n\n        restorePosition()\n\n        //Reset all values\n        lastScrollView = nil\n        keyboardFrame = CGRect.zero\n        startingContentInsets = UIEdgeInsets()\n        startingScrollIndicatorInsets = UIEdgeInsets()\n        startingContentOffset = CGPoint.zero\n        //    topViewBeginRect = CGRectZero    //Commented due to #82\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n\n    @objc internal func keyboardDidHide(_ notification: Notification) {\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        topViewBeginOrigin = IQKeyboardManager.kIQCGPointInvalid\n\n        keyboardFrame = CGRect.zero\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager+UITextFieldViewNotification.swift",
    "content": "//\n//  IQKeyboardManager+UITextFieldViewNotification.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n// MARK: UITextField/UITextView Notifications\n@available(iOSApplicationExtension, unavailable)\ninternal extension IQKeyboardManager {\n\n    private struct AssociatedKeys {\n        static var textFieldView = \"textFieldView\"\n        static var topViewBeginOrigin = \"topViewBeginOrigin\"\n        static var rootViewController = \"rootViewController\"\n        static var rootViewControllerWhilePopGestureRecognizerActive = \"rootViewControllerWhilePopGestureRecognizerActive\"\n        static var topViewBeginOriginWhilePopGestureRecognizerActive = \"topViewBeginOriginWhilePopGestureRecognizerActive\"\n    }\n\n    /** To save UITextField/UITextView object voa textField/textView notifications. */\n    weak var textFieldView: UIView? {\n        get {\n            return (objc_getAssociatedObject(self, &AssociatedKeys.textFieldView) as? WeakObjectContainer)?.object as? UIView\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.textFieldView, WeakObjectContainer(object: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    var topViewBeginOrigin: CGPoint {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.topViewBeginOrigin) as? CGPoint ?? IQKeyboardManager.kIQCGPointInvalid\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.topViewBeginOrigin, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** To save rootViewController */\n    weak var rootViewController: UIViewController? {\n        get {\n            return (objc_getAssociatedObject(self, &AssociatedKeys.rootViewController) as? WeakObjectContainer)?.object as? UIViewController\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.rootViewController, WeakObjectContainer(object: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /** To overcome with popGestureRecognizer issue Bug ID: #1361 */\n    weak var rootViewControllerWhilePopGestureRecognizerActive: UIViewController? {\n        get {\n            return (objc_getAssociatedObject(self, &AssociatedKeys.rootViewControllerWhilePopGestureRecognizerActive) as? WeakObjectContainer)?.object as? UIViewController\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.rootViewControllerWhilePopGestureRecognizerActive, WeakObjectContainer(object: newValue), .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    var topViewBeginOriginWhilePopGestureRecognizerActive: CGPoint {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.topViewBeginOriginWhilePopGestureRecognizerActive) as? CGPoint ?? IQKeyboardManager.kIQCGPointInvalid\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.topViewBeginOriginWhilePopGestureRecognizerActive, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n    }\n\n    /**  UITextFieldTextDidBeginEditingNotification, UITextViewTextDidBeginEditingNotification. Fetching UITextFieldView object. */\n    @objc func textFieldViewDidBeginEditing(_ notification: Notification) {\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        //  Getting object\n        textFieldView = notification.object as? UIView\n\n        if overrideKeyboardAppearance, let textInput = textFieldView as? UITextInput, textInput.keyboardAppearance != keyboardAppearance {\n            //Setting textField keyboard appearance and reloading inputViews.\n            if let textFieldView = textFieldView as? UITextField {\n                textFieldView.keyboardAppearance = keyboardAppearance\n            } else if  let textFieldView = textFieldView as? UITextView {\n                textFieldView.keyboardAppearance = keyboardAppearance\n            }\n            textFieldView?.reloadInputViews()\n        }\n\n        //If autoToolbar enable, then add toolbar on all the UITextField/UITextView's if required.\n        if privateIsEnableAutoToolbar() {\n\n            //UITextView special case. Keyboard Notification is firing before textView notification so we need to resign it first and then again set it as first responder to add toolbar on it.\n            if let textView = textFieldView as? UIScrollView, textView.responds(to: #selector(getter: UITextView.isEditable)),\n                textView.inputAccessoryView == nil {\n\n                UIView.animate(withDuration: 0.00001, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                    self.addToolbarIfRequired()\n\n                }, completion: { (_) -> Void in\n\n                    //On textView toolbar didn't appear on first time, so forcing textView to reload it's inputViews.\n                    textView.reloadInputViews()\n                })\n            } else {\n                //Adding toolbar\n                addToolbarIfRequired()\n            }\n        } else {\n            removeToolbarIfRequired()\n        }\n\n        resignFirstResponderGesture.isEnabled = privateShouldResignOnTouchOutside()\n        textFieldView?.window?.addGestureRecognizer(resignFirstResponderGesture)    //   (Enhancement ID: #14)\n\n        if privateIsEnabled() == false {\n            restorePosition()\n            topViewBeginOrigin = IQKeyboardManager.kIQCGPointInvalid\n        } else {\n            if topViewBeginOrigin.equalTo(IQKeyboardManager.kIQCGPointInvalid) {    //  (Bug ID: #5)\n\n                rootViewController = textFieldView?.parentContainerViewController()\n\n                if let controller = rootViewController {\n\n                    if rootViewControllerWhilePopGestureRecognizerActive == controller {\n                        topViewBeginOrigin = topViewBeginOriginWhilePopGestureRecognizerActive\n                    } else {\n                        topViewBeginOrigin = controller.view.frame.origin\n                    }\n\n                    rootViewControllerWhilePopGestureRecognizerActive = nil\n                    topViewBeginOriginWhilePopGestureRecognizerActive = IQKeyboardManager.kIQCGPointInvalid\n\n                    self.showLog(\"Saving \\(controller) beginning origin: \\(self.topViewBeginOrigin)\")\n                }\n            }\n\n            //If textFieldView is inside ignored responder then do nothing. (Bug ID: #37, #74, #76)\n            //See notes:- https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html If it is UIAlertView textField then do not affect anything (Bug ID: #70).\n            if keyboardShowing,\n                let textFieldView = textFieldView,\n                textFieldView.isAlertViewTextField() == false {\n\n                //  keyboard is already showing. adjust position.\n                optimizedAdjustPosition()\n            }\n        }\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n\n    /**  UITextFieldTextDidEndEditingNotification, UITextViewTextDidEndEditingNotification. Removing fetched object. */\n    @objc func textFieldViewDidEndEditing(_ notification: Notification) {\n\n        let startTime = CACurrentMediaTime()\n        showLog(\"****** \\(#function) started ******\", indentation: 1)\n\n        //Removing gesture recognizer   (Enhancement ID: #14)\n        textFieldView?.window?.removeGestureRecognizer(resignFirstResponderGesture)\n\n        // We check if there's a change in original frame or not.\n\n        if let textView = textFieldView as? UIScrollView, textView.responds(to: #selector(getter: UITextView.isEditable)) {\n\n            if isTextViewContentInsetChanged {\n                self.isTextViewContentInsetChanged = false\n\n                if textView.contentInset != self.startingTextViewContentInsets {\n                    self.showLog(\"Restoring textView.contentInset to: \\(self.startingTextViewContentInsets)\")\n\n                    UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in\n\n                        //Setting textField to it's initial contentInset\n                        textView.contentInset = self.startingTextViewContentInsets\n                        textView.scrollIndicatorInsets = self.startingTextViewScrollIndicatorInsets\n\n                    }, completion: { (_) -> Void in })\n                }\n            }\n        }\n\n        //Setting object to nil\n        textFieldView = nil\n\n        let elapsedTime = CACurrentMediaTime() - startTime\n        showLog(\"****** \\(#function) ended: \\(elapsedTime) seconds ******\", indentation: -1)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager.swift",
    "content": "//\n//  IQKeyboardManager.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\nimport CoreGraphics\nimport QuartzCore\n\n// MARK: IQToolbar tags\n\n/**\nCodeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more. A generic version of KeyboardManagement. https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html\n*/\n\n@available(iOSApplicationExtension, unavailable)\n@objc public final class IQKeyboardManager: NSObject {\n\n    /**\n    Returns the default singleton instance.\n    */\n    @objc public static let shared = IQKeyboardManager()\n\n    /**\n     Invalid point value.\n     */\n    internal static let  kIQCGPointInvalid = CGPoint.init(x: CGFloat.greatestFiniteMagnitude, y: CGFloat.greatestFiniteMagnitude)\n\n    // MARK: UIKeyboard handling\n\n    /**\n    Enable/disable managing distance between keyboard and textField. Default is YES(Enabled when class loads in `+(void)load` method).\n    */\n    @objc public var enable = false {\n\n        didSet {\n            //If not enable, enable it.\n            if enable, !oldValue {\n                //If keyboard is currently showing. Sending a fake notification for keyboardWillHide to retain view's original position.\n                if let notification = keyboardShowNotification {\n                    keyboardWillShow(notification)\n                }\n                showLog(\"Enabled\")\n            } else if !enable, oldValue {   //If not disable, desable it.\n                keyboardWillHide(nil)\n                showLog(\"Disabled\")\n            }\n        }\n    }\n\n    /**\n    To set keyboard distance from textField. can't be less than zero. Default is 10.0.\n    */\n    @objc public var keyboardDistanceFromTextField: CGFloat = 10.0\n\n    // MARK: IQToolbar handling\n\n    /**\n    Automatic add the IQToolbar functionality. Default is YES.\n    */\n    @objc public var enableAutoToolbar = true {\n        didSet {\n            privateIsEnableAutoToolbar() ? addToolbarIfRequired() : removeToolbarIfRequired()\n\n            let enableToolbar = enableAutoToolbar ? \"Yes\" : \"NO\"\n\n            showLog(\"enableAutoToolbar: \\(enableToolbar)\")\n        }\n    }\n\n    /**\n     /**\n     IQAutoToolbarBySubviews:   Creates Toolbar according to subview's hirarchy of Textfield's in view.\n     IQAutoToolbarByTag:        Creates Toolbar according to tag property of TextField's.\n     IQAutoToolbarByPosition:   Creates Toolbar according to the y,x position of textField in it's superview coordinate.\n\n     Default is IQAutoToolbarBySubviews.\n     */\n    AutoToolbar managing behaviour. Default is IQAutoToolbarBySubviews.\n    */\n    @objc public var toolbarManageBehaviour = IQAutoToolbarManageBehaviour.bySubviews\n\n    /**\n    If YES, then uses textField's tintColor property for IQToolbar, otherwise tint color is default. Default is NO.\n    */\n    @objc public var shouldToolbarUsesTextFieldTintColor = false\n\n    /**\n    This is used for toolbar.tintColor when textfield.keyboardAppearance is UIKeyboardAppearanceDefault. If shouldToolbarUsesTextFieldTintColor is YES then this property is ignored. Default is nil and uses black color.\n    */\n    @objc public var toolbarTintColor: UIColor?\n\n    /**\n     This is used for toolbar.barTintColor. Default is nil.\n     */\n    @objc public var toolbarBarTintColor: UIColor?\n\n    /**\n     IQPreviousNextDisplayModeDefault:      Show NextPrevious when there are more than 1 textField otherwise hide.\n     IQPreviousNextDisplayModeAlwaysHide:   Do not show NextPrevious buttons in any case.\n     IQPreviousNextDisplayModeAlwaysShow:   Always show nextPrevious buttons, if there are more than 1 textField then both buttons will be visible but will be shown as disabled.\n     */\n    @objc public var previousNextDisplayMode = IQPreviousNextDisplayMode.default\n\n    /**\n     Toolbar previous/next/done button icon, If nothing is provided then check toolbarDoneBarButtonItemText to draw done button.\n     */\n    @objc public var toolbarPreviousBarButtonItemImage: UIImage?\n    @objc public var toolbarNextBarButtonItemImage: UIImage?\n    @objc public var toolbarDoneBarButtonItemImage: UIImage?\n\n    /**\n     Toolbar previous/next/done button text, If nothing is provided then system default 'UIBarButtonSystemItemDone' will be used.\n     */\n    @objc public var toolbarPreviousBarButtonItemText: String?\n    @objc public var toolbarPreviousBarButtonItemAccessibilityLabel: String?\n    @objc public var toolbarNextBarButtonItemText: String?\n    @objc public var toolbarNextBarButtonItemAccessibilityLabel: String?\n    @objc public var toolbarDoneBarButtonItemText: String?\n    @objc public var toolbarDoneBarButtonItemAccessibilityLabel: String?\n\n    /**\n    If YES, then it add the textField's placeholder text on IQToolbar. Default is YES.\n    */\n    @objc public var shouldShowToolbarPlaceholder = true\n\n    /**\n    Placeholder Font. Default is nil.\n    */\n    @objc public var placeholderFont: UIFont?\n\n    /**\n     Placeholder Color. Default is nil. Which means lightGray\n     */\n    @objc public var placeholderColor: UIColor?\n\n    /**\n     Placeholder Button Color when it's treated as button. Default is nil.\n     */\n    @objc public var placeholderButtonColor: UIColor?\n\n    // MARK: UIKeyboard appearance overriding\n\n    /**\n    Override the keyboardAppearance for all textField/textView. Default is NO.\n    */\n    @objc public var overrideKeyboardAppearance = false\n\n    /**\n    If overrideKeyboardAppearance is YES, then all the textField keyboardAppearance is set using this property.\n    */\n    @objc public var keyboardAppearance = UIKeyboardAppearance.default\n\n    // MARK: UITextField/UITextView Next/Previous/Resign handling\n\n    /**\n    Resigns Keyboard on touching outside of UITextField/View. Default is NO.\n    */\n    @objc public var shouldResignOnTouchOutside = false {\n\n        didSet {\n            resignFirstResponderGesture.isEnabled = privateShouldResignOnTouchOutside()\n\n            let shouldResign = shouldResignOnTouchOutside ? \"Yes\" : \"NO\"\n\n            showLog(\"shouldResignOnTouchOutside: \\(shouldResign)\")\n        }\n    }\n\n    /** TapGesture to resign keyboard on view's touch. It's a readonly property and exposed only for adding/removing dependencies if your added gesture does have collision with this one */\n    @objc lazy public var resignFirstResponderGesture: UITapGestureRecognizer = {\n\n        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.tapRecognized(_:)))\n        tapGesture.cancelsTouchesInView = false\n        tapGesture.delegate = self\n\n        return tapGesture\n    }()\n\n    /*******************************************/\n\n    /**\n    Resigns currently first responder field.\n    */\n    @objc @discardableResult public func resignFirstResponder() -> Bool {\n\n        guard let textFieldRetain = textFieldView else {\n            return false\n        }\n\n        //Resigning first responder\n        guard textFieldRetain.resignFirstResponder() else {\n            showLog(\"Refuses to resign first responder: \\(textFieldRetain)\")\n            //  If it refuses then becoming it as first responder again.    (Bug ID: #96)\n            //If it refuses to resign then becoming it first responder again for getting notifications callback.\n            textFieldRetain.becomeFirstResponder()\n            return false\n        }\n        return true\n    }\n\n    // MARK: UISound handling\n\n    /**\n    If YES, then it plays inputClick sound on next/previous/done click.\n    */\n    @objc public var shouldPlayInputClicks = true\n\n    // MARK: UIAnimation handling\n\n    /**\n    If YES, then calls 'setNeedsLayout' and 'layoutIfNeeded' on any frame update of to viewController's view.\n    */\n    @objc public var layoutIfNeededOnUpdate = false\n\n    // MARK: Class Level disabling methods\n\n    /**\n     Disable distance handling within the scope of disabled distance handling viewControllers classes. Within this scope, 'enabled' property is ignored. Class should be kind of UIViewController.\n     */\n    @objc public var disabledDistanceHandlingClasses  = [UIViewController.Type]()\n\n    /**\n     Enable distance handling within the scope of enabled distance handling viewControllers classes. Within this scope, 'enabled' property is ignored. Class should be kind of UIViewController. If same Class is added in disabledDistanceHandlingClasses list, then enabledDistanceHandlingClasses will be ignored.\n     */\n    @objc public var enabledDistanceHandlingClasses  = [UIViewController.Type]()\n\n    /**\n     Disable automatic toolbar creation within the scope of disabled toolbar viewControllers classes. Within this scope, 'enableAutoToolbar' property is ignored. Class should be kind of UIViewController.\n     */\n    @objc public var disabledToolbarClasses  = [UIViewController.Type]()\n\n    /**\n     Enable automatic toolbar creation within the scope of enabled toolbar viewControllers classes. Within this scope, 'enableAutoToolbar' property is ignored. Class should be kind of UIViewController. If same Class is added in disabledToolbarClasses list, then enabledToolbarClasses will be ignore.\n     */\n    @objc public var enabledToolbarClasses  = [UIViewController.Type]()\n\n    /**\n     Allowed subclasses of UIView to add all inner textField, this will allow to navigate between textField contains in different superview. Class should be kind of UIView.\n     */\n    @objc public var toolbarPreviousNextAllowedClasses  = [UIView.Type]()\n\n    /**\n     Disabled classes to ignore 'shouldResignOnTouchOutside' property, Class should be kind of UIViewController.\n     */\n    @objc public var disabledTouchResignedClasses  = [UIViewController.Type]()\n\n    /**\n     Enabled classes to forcefully enable 'shouldResignOnTouchOutsite' property. Class should be kind of UIViewController. If same Class is added in disabledTouchResignedClasses list, then enabledTouchResignedClasses will be ignored.\n     */\n    @objc public var enabledTouchResignedClasses  = [UIViewController.Type]()\n\n    /**\n     if shouldResignOnTouchOutside is enabled then you can customise the behaviour to not recognise gesture touches on some specific view subclasses. Class should be kind of UIView. Default is [UIControl, UINavigationBar]\n     */\n    @objc public var touchResignedGestureIgnoreClasses  = [UIView.Type]()\n\n    // MARK: Third Party Library support\n    /// Add TextField/TextView Notifications customised Notifications. For example while using YYTextView https://github.com/ibireme/YYText\n\n    /**\n    Add/Remove customised Notification for third party customised TextField/TextView. Please be aware that the Notification object must be idential to UITextField/UITextView Notification objects and customised TextField/TextView support must be idential to UITextField/UITextView.\n    @param didBeginEditingNotificationName This should be identical to UITextViewTextDidBeginEditingNotification\n    @param didEndEditingNotificationName This should be identical to UITextViewTextDidEndEditingNotification\n    */\n\n    @objc public func registerTextFieldViewClass(_ aClass: UIView.Type, didBeginEditingNotificationName: String, didEndEditingNotificationName: String) {\n\n        NotificationCenter.default.addObserver(self, selector: #selector(self.textFieldViewDidBeginEditing(_:)), name: Notification.Name(rawValue: didBeginEditingNotificationName), object: nil)\n        NotificationCenter.default.addObserver(self, selector: #selector(self.textFieldViewDidEndEditing(_:)), name: Notification.Name(rawValue: didEndEditingNotificationName), object: nil)\n    }\n\n    @objc public func unregisterTextFieldViewClass(_ aClass: UIView.Type, didBeginEditingNotificationName: String, didEndEditingNotificationName: String) {\n\n        NotificationCenter.default.removeObserver(self, name: Notification.Name(rawValue: didBeginEditingNotificationName), object: nil)\n        NotificationCenter.default.removeObserver(self, name: Notification.Name(rawValue: didEndEditingNotificationName), object: nil)\n    }\n\n    /**************************************************************************************/\n    internal struct WeakObjectContainer {\n        weak var object: AnyObject?\n    }\n\n    /**************************************************************************************/\n\n    // MARK: Initialization/Deinitialization\n\n    /*  Singleton Object Initialization. */\n    override init() {\n\n        super.init()\n\n        self.registerAllNotifications()\n\n        //Creating gesture for @shouldResignOnTouchOutside. (Enhancement ID: #14)\n        resignFirstResponderGesture.isEnabled = shouldResignOnTouchOutside\n\n        //Loading IQToolbar, IQTitleBarButtonItem, IQBarButtonItem to fix first time keyboard appearance delay (Bug ID: #550)\n        //If you experience exception breakpoint issue at below line then try these solutions https://stackoverflow.com/questions/27375640/all-exception-break-point-is-stopping-for-no-reason-on-simulator\n        let textField = UITextField()\n        textField.addDoneOnKeyboardWithTarget(nil, action: #selector(self.doneAction(_:)))\n        textField.addPreviousNextDoneOnKeyboardWithTarget(nil, previousAction: #selector(self.previousAction(_:)), nextAction: #selector(self.nextAction(_:)), doneAction: #selector(self.doneAction(_:)))\n\n        disabledDistanceHandlingClasses.append(UITableViewController.self)\n        disabledDistanceHandlingClasses.append(UIAlertController.self)\n        disabledToolbarClasses.append(UIAlertController.self)\n        disabledTouchResignedClasses.append(UIAlertController.self)\n        toolbarPreviousNextAllowedClasses.append(UITableView.self)\n        toolbarPreviousNextAllowedClasses.append(UICollectionView.self)\n        toolbarPreviousNextAllowedClasses.append(IQPreviousNextView.self)\n        touchResignedGestureIgnoreClasses.append(UIControl.self)\n        touchResignedGestureIgnoreClasses.append(UINavigationBar.self)\n    }\n\n    deinit {\n        //  Disable the keyboard manager.\n        enable = false\n    }\n\n    /** Getting keyWindow. */\n    internal func keyWindow() -> UIWindow? {\n\n        if let keyWindow = textFieldView?.window {\n            return keyWindow\n        } else {\n\n            struct Static {\n                /** @abstract   Save keyWindow object for reuse.\n                @discussion Sometimes [[UIApplication sharedApplication] keyWindow] is returning nil between the app.   */\n                static weak var keyWindow: UIWindow?\n            }\n\n            var originalKeyWindow: UIWindow?\n\n            #if swift(>=5.1)\n            if #available(iOS 13, *) {\n                originalKeyWindow = UIApplication.shared.connectedScenes\n                    .compactMap { $0 as? UIWindowScene }\n                    .flatMap { $0.windows }\n                    .first(where: { $0.isKeyWindow })\n            } else {\n                originalKeyWindow = UIApplication.shared.keyWindow\n            }\n            #else\n            originalKeyWindow = UIApplication.shared.keyWindow\n            #endif\n\n            //If original key window is not nil and the cached keywindow is also not original keywindow then changing keywindow.\n            if let originalKeyWindow = originalKeyWindow {\n                Static.keyWindow = originalKeyWindow\n            }\n\n            //Return KeyWindow\n            return Static.keyWindow\n        }\n    }\n\n    // MARK: Public Methods\n\n    /*  Refreshes textField/textView position if any external changes is explicitly made by user.   */\n    @objc public func reloadLayoutIfNeeded() {\n\n        guard privateIsEnabled(),\n            keyboardShowing,\n            topViewBeginOrigin.equalTo(IQKeyboardManager.kIQCGPointInvalid) == false, let textFieldView = textFieldView,\n            textFieldView.isAlertViewTextField() == false else {\n                return\n        }\n        optimizedAdjustPosition()\n    }\n}\n\n@available(iOSApplicationExtension, unavailable)\nextension IQKeyboardManager: UIGestureRecognizerDelegate {\n\n    /** Resigning on tap gesture.   (Enhancement ID: #14)*/\n    @objc internal func tapRecognized(_ gesture: UITapGestureRecognizer) {\n\n        if gesture.state == .ended {\n\n            //Resigning currently responder textField.\n            resignFirstResponder()\n        }\n    }\n\n    /** Note: returning YES is guaranteed to allow simultaneous recognition. returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES. */\n    @objc public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {\n        return false\n    }\n\n    /** To not detect touch events in a subclass of UIControl, these may have added their own selector for specific work */\n    @objc public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {\n        //  Should not recognize gesture if the clicked view is either UIControl or UINavigationBar(<Back button etc...)    (Bug ID: #145)\n\n        for ignoreClass in touchResignedGestureIgnoreClasses {\n\n            if touch.view?.isKind(of: ignoreClass) ?? false {\n                return false\n            }\n        }\n\n        return true\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardReturnKeyHandler.swift",
    "content": "//\n//  IQKeyboardReturnKeyHandler.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\nprivate final class IQTextFieldViewInfoModal: NSObject {\n\n    fileprivate weak var textFieldDelegate: UITextFieldDelegate?\n    fileprivate weak var textViewDelegate: UITextViewDelegate?\n    fileprivate weak var textFieldView: UIView?\n    fileprivate var originalReturnKeyType = UIReturnKeyType.default\n\n    init(textFieldView: UIView?, textFieldDelegate: UITextFieldDelegate?, textViewDelegate: UITextViewDelegate?, originalReturnKeyType: UIReturnKeyType = .default) {\n        self.textFieldView = textFieldView\n        self.textFieldDelegate = textFieldDelegate\n        self.textViewDelegate = textViewDelegate\n        self.originalReturnKeyType = originalReturnKeyType\n    }\n}\n\n/**\nManages the return key to work like next/done in a view hierarchy.\n*/\n@available(iOSApplicationExtension, unavailable)\npublic final class IQKeyboardReturnKeyHandler: NSObject {\n\n    // MARK: Settings\n\n    /**\n    Delegate of textField/textView.\n    */\n    @objc public weak var delegate: (UITextFieldDelegate & UITextViewDelegate)?\n\n    /**\n    Set the last textfield return key type. Default is UIReturnKeyDefault.\n    */\n    @objc public var lastTextFieldReturnKeyType: UIReturnKeyType = UIReturnKeyType.default {\n\n        didSet {\n\n            for modal in textFieldInfoCache {\n\n                if let view = modal.textFieldView {\n                    updateReturnKeyTypeOnTextField(view)\n                }\n            }\n        }\n    }\n\n    // MARK: Initialization/Deinitialization\n\n    @objc public override init() {\n        super.init()\n    }\n\n    /**\n    Add all the textFields available in UIViewController's view.\n    */\n    @objc public init(controller: UIViewController) {\n        super.init()\n\n        addResponderFromView(controller.view)\n    }\n\n    deinit {\n\n        for modal in textFieldInfoCache {\n\n            if let textField = modal.textFieldView as? UITextField {\n                textField.returnKeyType = modal.originalReturnKeyType\n\n                textField.delegate = modal.textFieldDelegate\n\n            } else if let textView = modal.textFieldView as? UITextView {\n\n                textView.returnKeyType = modal.originalReturnKeyType\n\n                textView.delegate = modal.textViewDelegate\n            }\n        }\n\n        textFieldInfoCache.removeAll()\n    }\n\n    // MARK: Private variables\n    private var textFieldInfoCache          =   [IQTextFieldViewInfoModal]()\n\n    // MARK: Private Functions\n    private func textFieldViewCachedInfo(_ textField: UIView) -> IQTextFieldViewInfoModal? {\n\n        for modal in textFieldInfoCache {\n\n            if let view = modal.textFieldView {\n\n                if view == textField {\n                    return modal\n                }\n            }\n        }\n\n        return nil\n    }\n\n    private func updateReturnKeyTypeOnTextField(_ view: UIView) {\n        var superConsideredView: UIView?\n\n        //If find any consider responderView in it's upper hierarchy then will get deepResponderView. (Bug ID: #347)\n        for disabledClass in IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses {\n\n            superConsideredView = view.superviewOfClassType(disabledClass)\n\n            if superConsideredView != nil {\n                break\n            }\n        }\n\n        var textFields = [UIView]()\n\n        //If there is a tableView in view's hierarchy, then fetching all it's subview that responds.\n        if let unwrappedTableView = superConsideredView {     //   (Enhancement ID: #22)\n            textFields = unwrappedTableView.deepResponderViews()\n        } else {  //Otherwise fetching all the siblings\n\n            textFields = view.responderSiblings()\n\n            //Sorting textFields according to behaviour\n            switch IQKeyboardManager.shared.toolbarManageBehaviour {\n                //If needs to sort it by tag\n            case .byTag:        textFields = textFields.sortedArrayByTag()\n                //If needs to sort it by Position\n            case .byPosition:   textFields = textFields.sortedArrayByPosition()\n            default:    break\n            }\n        }\n\n        if let lastView = textFields.last {\n\n            if let textField = view as? UITextField {\n\n                //If it's the last textField in responder view, else next\n                textField.returnKeyType = (view == lastView)    ?   lastTextFieldReturnKeyType: UIReturnKeyType.next\n            } else if let textView = view as? UITextView {\n\n                //If it's the last textField in responder view, else next\n                textView.returnKeyType = (view == lastView)    ?   lastTextFieldReturnKeyType: UIReturnKeyType.next\n            }\n        }\n    }\n\n    // MARK: Registering/Unregistering textFieldView\n\n    /**\n    Should pass UITextField/UITextView intance. Assign textFieldView delegate to self, change it's returnKeyType.\n    \n    @param view UITextField/UITextView object to register.\n    */\n    @objc public func addTextFieldView(_ view: UIView) {\n\n        let modal = IQTextFieldViewInfoModal(textFieldView: view, textFieldDelegate: nil, textViewDelegate: nil)\n\n        if let textField = view as? UITextField {\n\n            modal.originalReturnKeyType = textField.returnKeyType\n            modal.textFieldDelegate = textField.delegate\n            textField.delegate = self\n\n        } else if let textView = view as? UITextView {\n\n            modal.originalReturnKeyType = textView.returnKeyType\n            modal.textViewDelegate = textView.delegate\n            textView.delegate = self\n        }\n\n        textFieldInfoCache.append(modal)\n    }\n\n    /**\n    Should pass UITextField/UITextView intance. Restore it's textFieldView delegate and it's returnKeyType.\n    \n    @param view UITextField/UITextView object to unregister.\n    */\n    @objc public func removeTextFieldView(_ view: UIView) {\n\n        if let modal = textFieldViewCachedInfo(view) {\n\n            if let textField = view as? UITextField {\n\n                textField.returnKeyType = modal.originalReturnKeyType\n                textField.delegate = modal.textFieldDelegate\n            } else if let textView = view as? UITextView {\n\n                textView.returnKeyType = modal.originalReturnKeyType\n                textView.delegate = modal.textViewDelegate\n            }\n\n            if let index = textFieldInfoCache.firstIndex(where: { $0.textFieldView == view}) {\n\n                textFieldInfoCache.remove(at: index)\n            }\n        }\n    }\n\n    /**\n    Add all the UITextField/UITextView responderView's.\n    \n    @param view UIView object to register all it's responder subviews.\n    */\n    @objc public func addResponderFromView(_ view: UIView) {\n\n        let textFields = view.deepResponderViews()\n\n        for textField in textFields {\n\n            addTextFieldView(textField)\n        }\n    }\n\n    /**\n    Remove all the UITextField/UITextView responderView's.\n    \n    @param view UIView object to unregister all it's responder subviews.\n    */\n    @objc public func removeResponderFromView(_ view: UIView) {\n\n        let textFields = view.deepResponderViews()\n\n        for textField in textFields {\n\n            removeTextFieldView(textField)\n        }\n    }\n\n    @discardableResult private func goToNextResponderOrResign(_ view: UIView) -> Bool {\n\n        var superConsideredView: UIView?\n\n        //If find any consider responderView in it's upper hierarchy then will get deepResponderView. (Bug ID: #347)\n        for disabledClass in IQKeyboardManager.shared.toolbarPreviousNextAllowedClasses {\n\n            superConsideredView = view.superviewOfClassType(disabledClass)\n\n            if superConsideredView != nil {\n                break\n            }\n        }\n\n        var textFields = [UIView]()\n\n        //If there is a tableView in view's hierarchy, then fetching all it's subview that responds.\n        if let unwrappedTableView = superConsideredView {     //   (Enhancement ID: #22)\n            textFields = unwrappedTableView.deepResponderViews()\n        } else {  //Otherwise fetching all the siblings\n\n            textFields = view.responderSiblings()\n\n            //Sorting textFields according to behaviour\n            switch IQKeyboardManager.shared.toolbarManageBehaviour {\n                //If needs to sort it by tag\n            case .byTag:        textFields = textFields.sortedArrayByTag()\n                //If needs to sort it by Position\n            case .byPosition:   textFields = textFields.sortedArrayByPosition()\n            default:\n                break\n            }\n        }\n\n        //Getting index of current textField.\n        if let index = textFields.firstIndex(of: view) {\n            //If it is not last textField. then it's next object becomeFirstResponder.\n            if index < (textFields.count - 1) {\n\n                let nextTextField = textFields[index+1]\n                nextTextField.becomeFirstResponder()\n                return false\n            } else {\n\n                view.resignFirstResponder()\n                return true\n            }\n        } else {\n            return true\n        }\n    }\n}\n\n// MARK: UITextFieldDelegate\n@available(iOSApplicationExtension, unavailable)\nextension IQKeyboardReturnKeyHandler: UITextFieldDelegate {\n\n    @objc public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textField)?.textFieldDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextFieldDelegate.textFieldShouldBeginEditing(_:))) {\n                    return unwrapDelegate.textFieldShouldBeginEditing?(textField) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @objc public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textField)?.textFieldDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextFieldDelegate.textFieldShouldEndEditing(_:))) {\n                    return unwrapDelegate.textFieldShouldEndEditing?(textField) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @objc public func textFieldDidBeginEditing(_ textField: UITextField) {\n        updateReturnKeyTypeOnTextField(textField)\n\n        var aDelegate: UITextFieldDelegate? = delegate\n\n        if aDelegate == nil {\n\n            if let modal = textFieldViewCachedInfo(textField) {\n                aDelegate = modal.textFieldDelegate\n            }\n        }\n\n        aDelegate?.textFieldDidBeginEditing?(textField)\n    }\n\n    @objc public func textFieldDidEndEditing(_ textField: UITextField) {\n\n        var aDelegate: UITextFieldDelegate? = delegate\n\n        if aDelegate == nil {\n\n            if let modal = textFieldViewCachedInfo(textField) {\n                aDelegate = modal.textFieldDelegate\n            }\n        }\n\n        aDelegate?.textFieldDidEndEditing?(textField)\n    }\n\n    @available(iOS 10.0, *)\n    @objc public func textFieldDidEndEditing(_ textField: UITextField, reason: UITextField.DidEndEditingReason) {\n\n        var aDelegate: UITextFieldDelegate? = delegate\n\n        if aDelegate == nil {\n\n            if let modal = textFieldViewCachedInfo(textField) {\n                aDelegate = modal.textFieldDelegate\n            }\n        }\n\n        aDelegate?.textFieldDidEndEditing?(textField, reason: reason)\n    }\n\n    @objc public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textField)?.textFieldDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextFieldDelegate.textField(_:shouldChangeCharactersIn:replacementString:))) {\n                    return unwrapDelegate.textField?(textField, shouldChangeCharactersIn: range, replacementString: string) ?? false\n                }\n            }\n        }\n        return true\n    }\n\n    @objc public func textFieldShouldClear(_ textField: UITextField) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textField)?.textFieldDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextFieldDelegate.textFieldShouldClear(_:))) {\n                    return unwrapDelegate.textFieldShouldClear?(textField) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @objc public func textFieldShouldReturn(_ textField: UITextField) -> Bool {\n\n        var shouldReturn = true\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textField)?.textFieldDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextFieldDelegate.textFieldShouldReturn(_:))) {\n                    shouldReturn = unwrapDelegate.textFieldShouldReturn?(textField) ?? false\n                }\n            }\n        }\n\n        if shouldReturn {\n            goToNextResponderOrResign(textField)\n            return true\n        } else {\n            return goToNextResponderOrResign(textField)\n        }\n    }\n}\n\n// MARK: UITextViewDelegate\n@available(iOSApplicationExtension, unavailable)\nextension IQKeyboardReturnKeyHandler: UITextViewDelegate {\n\n    @objc public func textViewShouldBeginEditing(_ textView: UITextView) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textView)?.textViewDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextViewDelegate.textViewShouldBeginEditing(_:))) {\n                    return unwrapDelegate.textViewShouldBeginEditing?(textView) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @objc public func textViewShouldEndEditing(_ textView: UITextView) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textView)?.textViewDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextViewDelegate.textViewShouldEndEditing(_:))) {\n                    return unwrapDelegate.textViewShouldEndEditing?(textView) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @objc public func textViewDidBeginEditing(_ textView: UITextView) {\n        updateReturnKeyTypeOnTextField(textView)\n\n        var aDelegate: UITextViewDelegate? = delegate\n\n        if aDelegate == nil {\n\n            if let modal = textFieldViewCachedInfo(textView) {\n                aDelegate = modal.textViewDelegate\n            }\n        }\n\n        aDelegate?.textViewDidBeginEditing?(textView)\n    }\n\n    @objc public func textViewDidEndEditing(_ textView: UITextView) {\n\n        var aDelegate: UITextViewDelegate? = delegate\n\n        if aDelegate == nil {\n\n            if let modal = textFieldViewCachedInfo(textView) {\n                aDelegate = modal.textViewDelegate\n            }\n        }\n\n        aDelegate?.textViewDidEndEditing?(textView)\n    }\n\n    @objc public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {\n\n        var shouldReturn = true\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(textView)?.textViewDelegate {\n                if unwrapDelegate.responds(to: #selector(UITextViewDelegate.textView(_:shouldChangeTextIn:replacementText:))) {\n                    shouldReturn = (unwrapDelegate.textView?(textView, shouldChangeTextIn: range, replacementText: text)) ?? false\n                }\n            }\n        }\n\n        if shouldReturn, text == \"\\n\" {\n            shouldReturn = goToNextResponderOrResign(textView)\n        }\n\n        return shouldReturn\n    }\n\n    @objc public func textViewDidChange(_ textView: UITextView) {\n\n        var aDelegate: UITextViewDelegate? = delegate\n\n        if aDelegate == nil {\n\n            if let modal = textFieldViewCachedInfo(textView) {\n                aDelegate = modal.textViewDelegate\n            }\n        }\n\n        aDelegate?.textViewDidChange?(textView)\n    }\n\n    @objc public func textViewDidChangeSelection(_ textView: UITextView) {\n\n        var aDelegate: UITextViewDelegate? = delegate\n\n        if aDelegate == nil {\n\n            if let modal = textFieldViewCachedInfo(textView) {\n                aDelegate = modal.textViewDelegate\n            }\n        }\n\n        aDelegate?.textViewDidChangeSelection?(textView)\n    }\n\n    @available(iOS 10.0, *)\n    @objc public func textView(_ aTextView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(aTextView)?.textViewDelegate {\n                if unwrapDelegate.responds(to: #selector(textView as (UITextView, URL, NSRange, UITextItemInteraction) -> Bool)) {\n                    return unwrapDelegate.textView?(aTextView, shouldInteractWith: URL, in: characterRange, interaction: interaction) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @available(iOS 10.0, *)\n    @objc public func textView(_ aTextView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(aTextView)?.textViewDelegate {\n                if unwrapDelegate.responds(to: #selector(textView as (UITextView, NSTextAttachment, NSRange, UITextItemInteraction) -> Bool)) {\n                    return unwrapDelegate.textView?(aTextView, shouldInteractWith: textAttachment, in: characterRange, interaction: interaction) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @available(iOS, deprecated: 10.0)\n    @objc public func textView(_ aTextView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(aTextView)?.textViewDelegate {\n                if unwrapDelegate.responds(to: #selector(textView as (UITextView, URL, NSRange) -> Bool)) {\n                    return unwrapDelegate.textView?(aTextView, shouldInteractWith: URL, in: characterRange) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n\n    @available(iOS, deprecated: 10.0)\n    @objc public func textView(_ aTextView: UITextView, shouldInteractWith textAttachment: NSTextAttachment, in characterRange: NSRange) -> Bool {\n\n        if delegate == nil {\n\n            if let unwrapDelegate = textFieldViewCachedInfo(aTextView)?.textViewDelegate {\n                if unwrapDelegate.responds(to: #selector(textView as (UITextView, NSTextAttachment, NSRange) -> Bool)) {\n                    return unwrapDelegate.textView?(aTextView, shouldInteractWith: textAttachment, in: characterRange) ?? false\n                }\n            }\n        }\n\n        return true\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQTextView/IQTextView.swift",
    "content": "//\n//  IQTextView.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n/** @abstract UITextView with placeholder support   */\n@available(iOSApplicationExtension, unavailable)\nopen class IQTextView: UITextView {\n\n    @objc required public init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n        NotificationCenter.default.addObserver(self, selector: #selector(self.refreshPlaceholder), name: UITextView.textDidChangeNotification, object: self)\n    }\n\n    @objc override public init(frame: CGRect, textContainer: NSTextContainer?) {\n        super.init(frame: frame, textContainer: textContainer)\n        NotificationCenter.default.addObserver(self, selector: #selector(self.refreshPlaceholder), name: UITextView.textDidChangeNotification, object: self)\n    }\n\n    @objc override open func awakeFromNib() {\n        super.awakeFromNib()\n        NotificationCenter.default.addObserver(self, selector: #selector(self.refreshPlaceholder), name: UITextView.textDidChangeNotification, object: self)\n    }\n\n    deinit {\n        IQ_PlaceholderLabel.removeFromSuperview()\n    }\n\n    private var placeholderInsets: UIEdgeInsets {\n        return UIEdgeInsets(top: self.textContainerInset.top, left: self.textContainerInset.left + self.textContainer.lineFragmentPadding, bottom: self.textContainerInset.bottom, right: self.textContainerInset.right + self.textContainer.lineFragmentPadding)\n    }\n\n    private var placeholderExpectedFrame: CGRect {\n        let placeholderInsets = self.placeholderInsets\n        let maxWidth = self.frame.width-placeholderInsets.left-placeholderInsets.right\n        let expectedSize = IQ_PlaceholderLabel.sizeThatFits(CGSize(width: maxWidth, height: self.frame.height-placeholderInsets.top-placeholderInsets.bottom))\n\n        return CGRect(x: placeholderInsets.left, y: placeholderInsets.top, width: maxWidth, height: expectedSize.height)\n    }\n\n    lazy var IQ_PlaceholderLabel: UILabel = {\n        let label = UILabel()\n\n        label.autoresizingMask = [.flexibleWidth, .flexibleHeight]\n        label.lineBreakMode = .byWordWrapping\n        label.numberOfLines = 0\n        label.font = self.font\n        label.textAlignment = self.textAlignment\n        label.backgroundColor = UIColor.clear\n        #if swift(>=5.1)\n        label.textColor = UIColor.systemGray\n        #else\n        label.textColor = UIColor.lightText\n        #endif\n        label.alpha = 0\n        self.addSubview(label)\n\n        return label\n    }()\n\n    /** @abstract To set textView's placeholder text color. */\n    @IBInspectable open var placeholderTextColor: UIColor? {\n\n        get {\n            return IQ_PlaceholderLabel.textColor\n        }\n\n        set {\n            IQ_PlaceholderLabel.textColor = newValue\n        }\n    }\n\n    /** @abstract To set textView's placeholder text. Default is nil.    */\n    @IBInspectable open var placeholder: String? {\n\n        get {\n            return IQ_PlaceholderLabel.text\n        }\n\n        set {\n            IQ_PlaceholderLabel.text = newValue\n            refreshPlaceholder()\n        }\n    }\n\n    /** @abstract To set textView's placeholder attributed text. Default is nil.    */\n    open var attributedPlaceholder: NSAttributedString? {\n        get {\n            return IQ_PlaceholderLabel.attributedText\n        }\n\n        set {\n            IQ_PlaceholderLabel.attributedText = newValue\n            refreshPlaceholder()\n        }\n    }\n\n    @objc override open func layoutSubviews() {\n        super.layoutSubviews()\n\n        IQ_PlaceholderLabel.frame = placeholderExpectedFrame\n    }\n\n    @objc internal func refreshPlaceholder() {\n\n        if !text.isEmpty || !attributedText.string.isEmpty {\n            IQ_PlaceholderLabel.alpha = 0\n        } else {\n            IQ_PlaceholderLabel.alpha = 1\n        }\n    }\n\n    @objc override open var text: String! {\n\n        didSet {\n            refreshPlaceholder()\n        }\n    }\n\n    open override var attributedText: NSAttributedString! {\n\n        didSet {\n            refreshPlaceholder()\n        }\n    }\n\n    @objc override open var font: UIFont? {\n\n        didSet {\n\n            if let unwrappedFont = font {\n                IQ_PlaceholderLabel.font = unwrappedFont\n            } else {\n                IQ_PlaceholderLabel.font = UIFont.systemFont(ofSize: 12)\n            }\n        }\n    }\n\n    @objc override open var textAlignment: NSTextAlignment {\n        didSet {\n            IQ_PlaceholderLabel.textAlignment = textAlignment\n        }\n    }\n\n    @objc override weak open var delegate: UITextViewDelegate? {\n\n        get {\n            refreshPlaceholder()\n            return super.delegate\n        }\n\n        set {\n            super.delegate = newValue\n        }\n    }\n\n    @objc override open var intrinsicContentSize: CGSize {\n        guard !hasText else {\n            return super.intrinsicContentSize\n        }\n\n        var newSize = super.intrinsicContentSize\n        let placeholderInsets = self.placeholderInsets\n        newSize.height = placeholderExpectedFrame.height + placeholderInsets.top + placeholderInsets.bottom\n\n        return newSize\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQBarButtonItem.swift",
    "content": "//\n//  IQBarButtonItem.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// import Foundation - UIKit contains Foundation\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\nopen class IQBarButtonItem: UIBarButtonItem {\n\n    private static var _classInitialize: Void = classInitialize()\n\n    @objc public override init() {\n        _ = IQBarButtonItem._classInitialize\n          super.init()\n      }\n\n    @objc public required init?(coder aDecoder: NSCoder) {\n        _ = IQBarButtonItem._classInitialize\n           super.init(coder: aDecoder)\n       }\n\n    private class func classInitialize() {\n\n        let  appearanceProxy = self.appearance()\n\n        let states: [UIControl.State]\n\n        states = [.normal, .highlighted, .disabled, .selected, .application, .reserved]\n\n        for state in states {\n\n            appearanceProxy.setBackgroundImage(nil, for: state, barMetrics: .default)\n            appearanceProxy.setBackgroundImage(nil, for: state, style: .done, barMetrics: .default)\n            appearanceProxy.setBackgroundImage(nil, for: state, style: .plain, barMetrics: .default)\n            appearanceProxy.setBackButtonBackgroundImage(nil, for: state, barMetrics: .default)\n        }\n\n        appearanceProxy.setTitlePositionAdjustment(UIOffset(), for: .default)\n        appearanceProxy.setBackgroundVerticalPositionAdjustment(0, for: .default)\n        appearanceProxy.setBackButtonBackgroundVerticalPositionAdjustment(0, for: .default)\n    }\n\n    @objc override open var tintColor: UIColor? {\n        didSet {\n\n            var textAttributes = [NSAttributedString.Key: Any]()\n            textAttributes[.foregroundColor] = tintColor\n\n            if let attributes = titleTextAttributes(for: .normal) {\n                for (key, value) in attributes {\n                    textAttributes[key] = value\n                }\n            }\n\n            setTitleTextAttributes(textAttributes, for: .normal)\n        }\n    }\n\n    /**\n     Boolean to know if it's a system item or custom item, we are having a limitation that we cannot override a designated initializer, so we are manually setting this property once in initialization\n     */\n    @objc internal var isSystemItem = false\n\n    /**\n     Additional target & action to do get callback action. Note that setting custom target & selector doesn't affect native functionality, this is just an additional target to get a callback.\n     \n     @param target Target object.\n     @param action Target Selector.\n     */\n    @objc open func setTarget(_ target: AnyObject?, action: Selector?) {\n        if let target = target, let action = action {\n            invocation = IQInvocation(target, action)\n        } else {\n            invocation = nil\n        }\n    }\n\n    /**\n     Customized Invocation to be called when button is pressed. invocation is internally created using setTarget:action: method.\n     */\n    @objc open var invocation: IQInvocation?\n\n    deinit {\n        target = nil\n        invocation = nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQInvocation.swift",
    "content": "//\n//  IQInvocation.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\n@objc public final class IQInvocation: NSObject {\n    @objc public weak var target: AnyObject?\n    @objc public var action: Selector\n\n    @objc public init(_ target: AnyObject, _ action: Selector) {\n        self.target = target\n        self.action = action\n    }\n\n    @objc public func invoke(from: Any) {\n        if let target = target {\n            UIApplication.shared.sendAction(action, to: target, from: from, for: UIEvent())\n        }\n    }\n\n    deinit {\n        target = nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQPreviousNextView.swift",
    "content": "//\n// IQPreviousNextView.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\n@objc public class IQPreviousNextView: UIView {\n\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQTitleBarButtonItem.swift",
    "content": "//\n//  IQTitleBarButtonItem.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n@available(iOSApplicationExtension, unavailable)\nopen class IQTitleBarButtonItem: IQBarButtonItem {\n\n    @objc open var titleFont: UIFont? {\n\n        didSet {\n            if let unwrappedFont = titleFont {\n                titleButton?.titleLabel?.font = unwrappedFont\n            } else {\n                titleButton?.titleLabel?.font = UIFont.systemFont(ofSize: 13)\n            }\n        }\n    }\n\n    @objc override open var title: String? {\n        didSet {\n                titleButton?.setTitle(title, for: .normal)\n        }\n    }\n\n    /**\n     titleColor to be used for displaying button text when displaying title (disabled state).\n     */\n    @objc open var titleColor: UIColor? {\n\n        didSet {\n\n            if let color = titleColor {\n                titleButton?.setTitleColor(color, for: .disabled)\n            } else {\n                titleButton?.setTitleColor(UIColor.lightGray, for: .disabled)\n            }\n        }\n    }\n\n    /**\n     selectableTitleColor to be used for displaying button text when button is enabled.\n     */\n    @objc open var selectableTitleColor: UIColor? {\n\n        didSet {\n\n            if let color = selectableTitleColor {\n                titleButton?.setTitleColor(color, for: .normal)\n            } else {\n                #if swift(>=5.1)\n                titleButton?.setTitleColor(UIColor.systemBlue, for: .normal)\n                #else\n                titleButton?.setTitleColor(UIColor(red: 0.0, green: 0.5, blue: 1.0, alpha: 1), for: .normal)\n                #endif\n            }\n        }\n    }\n\n    /**\n     Customized Invocation to be called on title button action. titleInvocation is internally created using setTitleTarget:action: method.\n     */\n    @objc override open var invocation: IQInvocation? {\n\n        didSet {\n\n            if let target = invocation?.target, let action = invocation?.action {\n                self.isEnabled = true\n                titleButton?.isEnabled = true\n                titleButton?.addTarget(target, action: action, for: .touchUpInside)\n            } else {\n                self.isEnabled = false\n                titleButton?.isEnabled = false\n                titleButton?.removeTarget(nil, action: nil, for: .touchUpInside)\n            }\n        }\n    }\n\n    internal var titleButton: UIButton?\n    private var _titleView: UIView?\n\n    override init() {\n        super.init()\n    }\n\n    @objc public convenience init(title: String?) {\n\n        self.init(title: nil, style: .plain, target: nil, action: nil)\n\n        _titleView = UIView()\n        _titleView?.backgroundColor = UIColor.clear\n\n        titleButton = UIButton(type: .system)\n        titleButton?.isEnabled = false\n        titleButton?.titleLabel?.numberOfLines = 3\n        titleButton?.setTitleColor(UIColor.lightGray, for: .disabled)\n        #if swift(>=5.1)\n        titleButton?.setTitleColor(UIColor.systemBlue, for: .normal)\n        #else\n        titleButton?.setTitleColor(UIColor(red: 0.0, green: 0.5, blue: 1.0, alpha: 1), for: .normal)\n        #endif\n        titleButton?.backgroundColor = UIColor.clear\n        titleButton?.titleLabel?.textAlignment = .center\n        titleButton?.setTitle(title, for: .normal)\n        titleFont = UIFont.systemFont(ofSize: 13.0)\n        titleButton?.titleLabel?.font = self.titleFont\n        _titleView?.addSubview(titleButton!)\n\n        if #available(iOS 11, *) {\n\n            let layoutDefaultLowPriority = UILayoutPriority(rawValue: UILayoutPriority.defaultLow.rawValue-1)\n            let layoutDefaultHighPriority = UILayoutPriority(rawValue: UILayoutPriority.defaultHigh.rawValue-1)\n\n            _titleView?.translatesAutoresizingMaskIntoConstraints = false\n            _titleView?.setContentHuggingPriority(layoutDefaultLowPriority, for: .vertical)\n            _titleView?.setContentHuggingPriority(layoutDefaultLowPriority, for: .horizontal)\n            _titleView?.setContentCompressionResistancePriority(layoutDefaultHighPriority, for: .vertical)\n            _titleView?.setContentCompressionResistancePriority(layoutDefaultHighPriority, for: .horizontal)\n\n            titleButton?.translatesAutoresizingMaskIntoConstraints = false\n            titleButton?.setContentHuggingPriority(layoutDefaultLowPriority, for: .vertical)\n            titleButton?.setContentHuggingPriority(layoutDefaultLowPriority, for: .horizontal)\n            titleButton?.setContentCompressionResistancePriority(layoutDefaultHighPriority, for: .vertical)\n            titleButton?.setContentCompressionResistancePriority(layoutDefaultHighPriority, for: .horizontal)\n\n            let top = NSLayoutConstraint.init(item: titleButton!, attribute: .top, relatedBy: .equal, toItem: _titleView, attribute: .top, multiplier: 1, constant: 0)\n            let bottom = NSLayoutConstraint.init(item: titleButton!, attribute: .bottom, relatedBy: .equal, toItem: _titleView, attribute: .bottom, multiplier: 1, constant: 0)\n            let leading = NSLayoutConstraint.init(item: titleButton!, attribute: .leading, relatedBy: .equal, toItem: _titleView, attribute: .leading, multiplier: 1, constant: 0)\n            let trailing = NSLayoutConstraint.init(item: titleButton!, attribute: .trailing, relatedBy: .equal, toItem: _titleView, attribute: .trailing, multiplier: 1, constant: 0)\n\n            _titleView?.addConstraints([top, bottom, leading, trailing])\n        } else {\n            _titleView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]\n            titleButton?.autoresizingMask = [.flexibleWidth, .flexibleHeight]\n        }\n\n        customView = _titleView\n    }\n\n    @objc required public init?(coder aDecoder: NSCoder) {\n        super.init(coder: aDecoder)\n    }\n\n    deinit {\n        customView = nil\n        titleButton?.removeTarget(nil, action: nil, for: .touchUpInside)\n        _titleView = nil\n        titleButton = nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQToolbar.swift",
    "content": "//\n//  IQToolbar.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n/** @abstract   IQToolbar for IQKeyboardManager.    */\n@available(iOSApplicationExtension, unavailable)\nopen class IQToolbar: UIToolbar, UIInputViewAudioFeedback {\n\n    private static var _classInitialize: Void = classInitialize()\n\n    private class func classInitialize() {\n\n        let  appearanceProxy = self.appearance()\n\n        appearanceProxy.barTintColor = nil\n\n        let positions: [UIBarPosition] = [.any, .bottom, .top, .topAttached]\n\n        for position in positions {\n\n            appearanceProxy.setBackgroundImage(nil, forToolbarPosition: position, barMetrics: .default)\n            appearanceProxy.setShadowImage(nil, forToolbarPosition: .any)\n        }\n\n        //Background color\n        appearanceProxy.backgroundColor = nil\n    }\n\n    /**\n     Previous bar button of toolbar.\n     */\n    private var privatePreviousBarButton: IQBarButtonItem?\n    @objc open var previousBarButton: IQBarButtonItem {\n        get {\n            if privatePreviousBarButton == nil {\n                privatePreviousBarButton = IQBarButtonItem(image: nil, style: .plain, target: nil, action: nil)\n            }\n            return privatePreviousBarButton!\n        }\n\n        set (newValue) {\n            privatePreviousBarButton = newValue\n        }\n    }\n\n    /**\n     Next bar button of toolbar.\n     */\n    private var privateNextBarButton: IQBarButtonItem?\n    @objc open var nextBarButton: IQBarButtonItem {\n        get {\n            if privateNextBarButton == nil {\n                privateNextBarButton = IQBarButtonItem(image: nil, style: .plain, target: nil, action: nil)\n            }\n            return privateNextBarButton!\n        }\n\n        set (newValue) {\n            privateNextBarButton = newValue\n        }\n    }\n\n    /**\n     Title bar button of toolbar.\n     */\n    private var privateTitleBarButton: IQTitleBarButtonItem?\n    @objc open var titleBarButton: IQTitleBarButtonItem {\n        get {\n            if privateTitleBarButton == nil {\n                privateTitleBarButton = IQTitleBarButtonItem(title: nil)\n                privateTitleBarButton?.accessibilityLabel = \"Title\"\n            }\n            return privateTitleBarButton!\n        }\n\n        set (newValue) {\n            privateTitleBarButton = newValue\n        }\n    }\n\n    /**\n     Done bar button of toolbar.\n     */\n    private var privateDoneBarButton: IQBarButtonItem?\n    @objc open var doneBarButton: IQBarButtonItem {\n        get {\n            if privateDoneBarButton == nil {\n                privateDoneBarButton = IQBarButtonItem(title: nil, style: .done, target: nil, action: nil)\n            }\n            return privateDoneBarButton!\n        }\n\n        set (newValue) {\n            privateDoneBarButton = newValue\n        }\n    }\n\n    /**\n     Fixed space bar button of toolbar.\n     */\n    private var privateFixedSpaceBarButton: IQBarButtonItem?\n    @objc open var fixedSpaceBarButton: IQBarButtonItem {\n        get {\n            if privateFixedSpaceBarButton == nil {\n                privateFixedSpaceBarButton = IQBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)\n            }\n            privateFixedSpaceBarButton!.isSystemItem = true\n\n            if #available(iOS 10, *) {\n                privateFixedSpaceBarButton!.width = 6\n            } else {\n                privateFixedSpaceBarButton!.width = 20\n            }\n\n            return privateFixedSpaceBarButton!\n        }\n\n        set (newValue) {\n            privateFixedSpaceBarButton = newValue\n        }\n    }\n\n    override init(frame: CGRect) {\n        _ = IQToolbar._classInitialize\n        super.init(frame: frame)\n\n        sizeToFit()\n\n        autoresizingMask = .flexibleWidth\n        self.isTranslucent = true\n    }\n\n    @objc required public init?(coder aDecoder: NSCoder) {\n        _ = IQToolbar._classInitialize\n        super.init(coder: aDecoder)\n\n        sizeToFit()\n\n        autoresizingMask = .flexibleWidth\n        self.isTranslucent = true\n    }\n\n    @objc override open func sizeThatFits(_ size: CGSize) -> CGSize {\n        var sizeThatFit = super.sizeThatFits(size)\n        sizeThatFit.height = 44\n        return sizeThatFit\n    }\n\n    @objc override open var tintColor: UIColor! {\n\n        didSet {\n            if let unwrappedItems = items {\n                for item in unwrappedItems {\n                    item.tintColor = tintColor\n                }\n            }\n        }\n    }\n\n    @objc override open func layoutSubviews() {\n\n        super.layoutSubviews()\n\n        if #available(iOS 11, *) {\n            return\n        } else if let customTitleView = titleBarButton.customView {\n            var leftRect = CGRect.null\n            var rightRect = CGRect.null\n            var isTitleBarButtonFound = false\n\n            let sortedSubviews = self.subviews.sorted(by: { (view1: UIView, view2: UIView) -> Bool in\n                if view1.frame.minX != view2.frame.minX {\n                    return view1.frame.minX < view2.frame.minX\n                } else {\n                    return view1.frame.minY < view2.frame.minY\n                }\n            })\n\n            for barButtonItemView in sortedSubviews {\n\n                if isTitleBarButtonFound {\n                    rightRect = barButtonItemView.frame\n                    break\n                } else if barButtonItemView === customTitleView {\n                    isTitleBarButtonFound = true\n                    //If it's UIToolbarButton or UIToolbarTextButton (which actually UIBarButtonItem)\n                } else if barButtonItemView.isKind(of: UIControl.self) {\n                    leftRect = barButtonItemView.frame\n                }\n            }\n\n            let titleMargin: CGFloat = 16\n\n            let maxWidth: CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)\n            let maxHeight = self.frame.height\n\n            let sizeThatFits = customTitleView.sizeThatFits(CGSize(width: maxWidth, height: maxHeight))\n\n            var titleRect: CGRect\n\n            if sizeThatFits.width > 0, sizeThatFits.height > 0 {\n                let width = min(sizeThatFits.width, maxWidth)\n                let height = min(sizeThatFits.height, maxHeight)\n\n                var xPosition: CGFloat\n\n                if !leftRect.isNull {\n                    xPosition = titleMargin + leftRect.maxX + ((maxWidth - width)/2)\n                } else {\n                    xPosition = titleMargin\n                }\n\n                let yPosition = (maxHeight - height)/2\n\n                titleRect = CGRect(x: xPosition, y: yPosition, width: width, height: height)\n            } else {\n\n                var xPosition: CGFloat\n\n                if !leftRect.isNull {\n                    xPosition = titleMargin + leftRect.maxX\n                } else {\n                    xPosition = titleMargin\n                }\n\n                let width: CGFloat = self.frame.width - titleMargin*2 - (leftRect.isNull ? 0 : leftRect.maxX) - (rightRect.isNull ? 0 : self.frame.width - rightRect.minX)\n\n                titleRect = CGRect(x: xPosition, y: 0, width: width, height: maxHeight)\n            }\n\n            customTitleView.frame = titleRect\n        }\n    }\n\n    @objc open var enableInputClicksWhenVisible: Bool {\n        return true\n    }\n\n    deinit {\n\n        items = nil\n        privatePreviousBarButton = nil\n        privateNextBarButton = nil\n        privateTitleBarButton = nil\n        privateDoneBarButton = nil\n        privateFixedSpaceBarButton = nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift",
    "content": "//\n//  IQUIView+IQKeyboardToolbar.swift\n// https://github.com/hackiftekhar/IQKeyboardManager\n// Copyright (c) 2013-20 Iftekhar Qurashi.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport UIKit\n\n/**\n IQBarButtonItemConfiguration for creating toolbar with bar button items\n */\n@available(iOSApplicationExtension, unavailable)\n@objc public final class IQBarButtonItemConfiguration: NSObject {\n\n    @objc public init(barButtonSystemItem: UIBarButtonItem.SystemItem, action: Selector) {\n        self.barButtonSystemItem = barButtonSystemItem\n        self.image = nil\n        self.title = nil\n        self.action = action\n        super.init()\n    }\n\n    @objc public init(image: UIImage, action: Selector) {\n        self.barButtonSystemItem = nil\n        self.image = image\n        self.title = nil\n        self.action = action\n        super.init()\n    }\n\n    @objc public init(title: String, action: Selector) {\n        self.barButtonSystemItem = nil\n        self.image = nil\n        self.title = title\n        self.action = action\n        super.init()\n    }\n\n    public let barButtonSystemItem: UIBarButtonItem.SystemItem?    //System Item to be used to instantiate bar button.\n\n    @objc public let image: UIImage?    //Image to show on bar button item if it's not a system item.\n\n    @objc public let title: String?     //Title to show on bar button item if it's not a system item.\n\n    @objc public let action: Selector?  //action for bar button item. Usually 'doneAction:(IQBarButtonItem*)item'.\n}\n\n/**\n UIImage category methods to get next/prev images\n */\n// swiftlint:disable nesting\n// swiftlint:disable line_length\n@available(iOSApplicationExtension, unavailable)\n@objc public extension UIImage {\n\n    static func keyboardLeftImage() -> UIImage? {\n\n        struct Static {\n            static var keyboardLeftImage: UIImage?\n        }\n\n        if Static.keyboardLeftImage == nil {\n\n            let base64Data = \"iVBORw0KGgoAAAANSUhEUgAAACQAAAA/CAYAAACIEWrAAAAAAXNSR0IArs4c6QAABtFJREFUaAXFmV1oHFUUx++d3SSbj/0k6Uc2u7Ob7QeVSqBSP7AUm1JpS0tb+6nFYhELxfahDxVU9KmgD0UU7ENRLLRQodRqNbVJY5IGXwRBEPHBh2x2ZpPQaDC7W2qSzc5c/3ebDTN3d5Pd7Gw6L3PPOcM5vzn33I+5Q8gTvJqbm52RYPAdIEg5DFuusdz3dq/X7XA6ewiVTvrcnvBkMvE9GNgTAQoGg16pztFLKX02mwhKOrwe99rJZPL2sgO1tbX5aiWpDzDPGHuFEvq01+2ZpEZltdutra3NjpranxC0Q4zFCLsVVZRjdtFQLTmycuUKZq/pA8zGvBiM3IiqynHoM8sCFGoJrSIO1o9u2SDCIDPXAXMCeo3bqg4UCARaJYkMEELXiTCEkauAOQm9nrPNj/+cwso7aiZQS6VBdFMeDDLz1ZAaM8Hw2FXLUHj1apnaawYIpWHxJRkjl5GZ09Az0VYVIFmWw6iXAWRGFgMynV2KxpWzhWD4s5Z3GeaZNXZGeTflwzDyGWDOFIPhQJZmqN3vX0clG7qJtHLnpktnFwFz3qQrIFgGJK+WN+D1+jGaVolxGNM/jsbVd0V9IdkSoEggsJFJlE96K8Qgus4uDMfVD0R9MbniGgr7/R1YsXkB58FgEH04HFdKhuGQFWUIo2kTZaQXQ9snvjGG9nsY2h+J+sXkJQO1BwKbMYv0YNX2ikF0ws4Pq8pFUV+KvCSgkD/0PCaMbnSTWwyCzJwDzKeivlS5bCBsOV/EsL6LAE5jEMYvSs4C5pJRX267LKBwILAVw/oOgjQZAz1mYaejinrZqF9Ku+QdY0SWOzkMaqbRGAgwOjJzKqqqXxj1S22jDBa/wsHgDqxNtwFTb3w6C0PYyWFVvWrUV9JetMsibfIuRuktkDuMgQCjYRdzYnhEvW7UV9peEKg9GNyDOeYmYOpMgRjLYD9zHDA3THoLhKIzdSgQ2k+p9A1imGEImUXNHEM3WQ7D36dghlAzhyRKeFfU8IcMV1rTtSOxePy2QWdpMw8oEggdwxp0DVFE2wy66SBg+LCv2mUa9mFZfhORrmA0mWCwz5zWdW0/uolPiFW95msIMGckQr8EjAkSo2mKMH0vMtNTVZI559lMtAdC5zCSPhEDAuaRppG9yqg6INqqJVNk5m1k5nMxAGAYYLYro8qywXAGiWYyvYSxUREIXUdtdnIKelM9ic9ZLWeXDnxdRmppdnMeEAMgUTex0XoN+lnRVg05C8Qd828pW5FvKUwD3w0pylE8lq4GhNHnPBBX+v3+tjpbTT+lZK3xId5GprqQqUNozog2K2UTEHfMDwdqJBtOKsh6MRAmxru6Ql+Jkdi0aLNKzgPijvnxia2e9WFhfUoMhC1qb1rP7BsZGZkSbVbI8xOj0Vnsn9gDMjO9DcH/MOp5G925o1aydeFko0G0WSEXBOKOh8bH/57OpDuxbPwuBsKM0Omw195taWkxbWXF55YiFwXizsbGxibSWqYTFf2b6ByZ2uqsb+jmZ82irRK5YA2JDkOekEdykXuA2CzaMP5+YanUzujkZDLfVr6mJCDu1ufzubxOZzeq6AUxDGrtVz1FXo4lYgnRVq5cMhB3zLvH1dD4I2poS14gdOuMru3A6Ps3z1aGYsEaEv1MTEw8fDQzvRP6QdGG4bep1mbv52fRebYyFGUBcb/j4+OPpmbTuzFz4yzIfCHdHQ6cK/IzabOldKlsIO4ao++/tK7tQe3cE0OhOzcSh+N+9mxaNJYgl1VDBfzVtcsyvtnobtGG+euvWV3rjMfjY6JtIXlJGTI4nMH/iQPI1A8GXbaJN13Pz6j5gi3aFpIrBeK+01E1dhAL77d5gShd47DZB/mZdZ6tiKLSLjO6tUeCoes4qjlsVPI2uk/RCNumKMqwaBNlKzKU85nBr4JXkamvc4rcHW8t87NrvjPN6YrdrQTiMTTU1OtY+67lBaQk+9+Dn2Xn2QwKq4G4a21IVd5Apq4Y4jxuUuonNvv97Jl2nnHukSJ6K9Q0EpQvYwZ/S3SGmhrPMH27qqp/ijbTV6porFTGT90u/NxdgXnKtEtATTXZKD3scTb1JFKpcWOcqgLxQIC643F7fNi6PGcMjHYjZvUjrkZPb/Jh8kHOVnUgHiiRTHQjUy5kyrx1obSBSuSI1+Xqm0ylsjP6sgBxKGTqHn6D1yNTpq0LslSPXxNH3c6mAXTfqJUTI4+76IXT3AvY5L1f4MFUhrBdy5ahHAAy1e91uzD46Es53dydYv7qWnYgHhxQgx6XexZQ2+dgZojGDuCf2p0nAsQhEqnkzz63awpz0hacve+LjqjZA7H/AWSbJ/TPf3CuAAAAAElFTkSuQmCC\"\n\n            if let data = Data(base64Encoded: base64Data, options: .ignoreUnknownCharacters) {\n                Static.keyboardLeftImage = UIImage(data: data, scale: 3)\n            }\n\n            //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)\n            Static.keyboardLeftImage = Static.keyboardLeftImage?.imageFlippedForRightToLeftLayoutDirection()\n        }\n\n        return Static.keyboardLeftImage\n    }\n\n    static func keyboardRightImage() -> UIImage? {\n\n        struct Static {\n            static var keyboardRightImage: UIImage?\n        }\n\n        if Static.keyboardRightImage == nil {\n\n            let base64Data = \"iVBORw0KGgoAAAANSUhEUgAAACQAAAA/CAYAAACIEWrAAAAAAXNSR0IArs4c6QAABu5JREFUaAXFmXtsFEUcx2f3rj0Kvd29k9LHtXfXqyjGV2J8EF/hIQgp4VnahPgIxviH0ZgYNSbGmBg1McaYGGOM+o8k+EINMQjIo6UoBAVEEBGQXnvbS1ttw91epUDbu/E7lb3bm22Pu97uOQnszO+3ne/nvjM7sw9CMsXRFAi83jhnTnUmVPqacEXSGfIHPhMEoYUSejpJyKJIJNJfehxCRIiWwZktDIYBCESY56BCZ319ve9/AQr5/c8CY7VRXBDIXJfo6Kyrq2swxktRZ0NWFgoEPocza3lBDF9P6rKwsGegp4fP2dVmQzYWjkTaCCVf8iKADIou0un3+0N8zq42A2JlvEvt2QBHPv2vmfkfFvrLiNAZqq+fm4naV9OBmEISTj0MpzaZ5AShXhAd+xrr6q435SwO6Je9sVsRc+ojDNdjxiCrw8GBcUoXq6p6is9Z1TY6pPeZglOPQ/1DPaAfAVnjFMQODN/Neszqo2OqDmNa/DuPJM/G+nSn8RxYOgux9Upl5a748PBfxpwV9SmBWOexhLbdIyserEvzs8QEYSYRxFZJUfZommbpip4TaAJKi+/0SnIlEYS7jVBwqQJutXkkqT2WSPQZc8XUrwo0AZXQdntkaQYg7jWKYU4hJrZJlXKnNqxFjbnp1vMCmoDStL2KJDsBdT8n5hJFoRXAP8Q0TeVyBTfzBmI9xxNah1eRU9j7FnJKLrTbZLf7QDyRiHC5gpoFAbGe4cJ+TPRRTPTFRiU4V45/rV5FOYRzuo25QuoFA7HOsST8qCjyBcyhpUYxAJVRSloVSToMp7qMuXzr0wJincc17SCc0uDUMqMYg8JEb/W65aNYNs4Zc/nUpw3EOodTh+DUEFb15QDBKpAuTiJi8ZSl4wA/m47mUSkKiPUPwcNeWR6ghDRzUA60W+DUSTh1Og+WiVOKBmK9YBIfVRQlCqdW8FC4J16nyPJpgOe1IVsCxKAgeAxOReDUyiwoTCik13olz9lYIn6SnZurWAbERODUcY+idMGpVYBK30mwOm5d1sCpMMBPlAzoCtRvsiSdEdmDAweF/Go4pcKpX6eCstQhXQRr0O9w6hTWqTWIpTXYUMKpVXCqD079op9vPKZPNgatqGP4/pAl9wlRENnTTFqHQaG9wiN5/oZTR3it9Il8woo2nDrjUeRjcGod+nPqfTIoYDVjnToPp37W4+xoKxATgFN/ym7lCKZ4C6xJQ7EcqJZjsx7BOQdZmxXbgZhIPBE/h9uTn1BdD4gyFssUYQmgkoDaz2IlAWJCEAxLlcpBDFULoMpZLFOERdgXBWxF+4z7TyZvYy1YH1wginQvoNLrlC6XIvT5rDHVEzYeRYdINhrXJ10LK7yapPSbUgI58AC6CQAbdAj9SCntpmOjC9X+/kipgJxN/uBmALTqEOkjpecujY8t6uvv72WxUgBNvO6B1iSve8jxkdHLSwYGBgZ1QLuByuHMFoit1AUzR3psNJl8ADDnMzF7HXLhveXXuB9qNgqyOubMkXFCl0aj0Rifs8WhIAnOcPjJVsA8yAsC5xAZTixTYzHNnLPBIbwsrcA68y0u7Qd4QThzIDFyYflQLDbM5/S2pQ5VV1fPcjkc27BLLdAF9CMej/YPXxxpHhoa+kePTXa0DKiqqqpylqtiO0TuMwvRDlzaKwYHB0fMueyIJUBer1eSKmbuwJzJekPCpODM7tFUclVfX9/FbOnJW0UDhTwembil79H9XWYJujOlCmuiJHrJnJs8UhQQXhd7MF92YYe+ne8eE3hbWI20IH6Zz+Vqm3bcXCcbcz6f7xo8M7Nd2wSDgdoKGHaXWBAM639aDtXU1FS5nGV78Pe3sE6MBc58BRi2gY4Z4/nWCwZin6/EctdeCNxoEqHkC8A8hPi4KZdnoCCgQCBQi/nSjnkzj+8fzmwGzKOIJ/lcIe285xD7XOUgwj48QZhgUpR8AphHioVh4HkBsc9U7HMV3LnO9Gsp/bhb7dmIOF71FV+uOmSNtbUBwVnWgb2pkZejNPVBWFWfRBx3oNaUnEDssxTuxdvhTMAkl6LvhXvVp03xIgNTDhnmzLXss9RkMHg+f6erN2I5DPstkzrEPkOJoqMdw1TH/+AUpW91q5EX+LhVbRNQoDZwA54t2aVdYxahbwDmJXPcukgWUFNDw01UxHZAyBxeArv2q7i0X+HjVrfTQI0+3634wrMHMLPNIvRlwLxmjlsfmQDCCnwb3iTtxpzx8hK4tF/Epf0mH7er7Qw1NNyBzndh11Z4kVSKPtfdq77Nx+1sO7GiVeCNpBN3e9mFpp4BzLvZQftbExhNfv89mD87IOfGJollhjwV7o28b798DoWgLzgfD3bnAfdEjtNsT/0LGvgrBSkuN9gAAAAASUVORK5CYII=\"\n\n            if let data = Data(base64Encoded: base64Data, options: .ignoreUnknownCharacters) {\n                Static.keyboardRightImage = UIImage(data: data, scale: 3)\n            }\n\n            //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)\n            Static.keyboardRightImage = Static.keyboardRightImage?.imageFlippedForRightToLeftLayoutDirection()\n        }\n\n        return Static.keyboardRightImage\n    }\n\n    static func keyboardUpImage() -> UIImage? {\n\n        struct Static {\n            static var keyboardUpImage: UIImage?\n        }\n\n        if Static.keyboardUpImage == nil {\n\n            let base64Data = \"iVBORw0KGgoAAAANSUhEUgAAAD8AAAAkCAYAAAA+TuKHAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAAGmklEQVRoBd1ZWWwbRRie2bVz27s2adPGxzqxqAQCIRA3CDVJGxpKaEtRoSAVISQQggdeQIIHeIAHkOCBFyQeKlARhaYHvUJa0ksVoIgKUKFqKWqdeG2nR1Lsdeo0h73D54iku7NO6ySOk3alyPN//+zM/81/7MyEkDl66j2eJXWK8vocTT82rTgXk/t8vqBNEI9QSp9zOeVkPJnomgs7ik5eUZQ6OxGOEEq9WcKUksdlWbqU0LRfi70ARSXv8Xi8dkE8CsJ+I1FK6BNYgCgW4A8jPtvtopFHqNeWCLbDIF6fkxQjK91O1z9IgRM59bMAFoV8YEFgka1EyBJfMhkH5L9ACFstS9IpRMDJyfoVEp918sGamoVCme0QyN3GG87wAKcTOBYA4hrJKf+VSCb+nsBnqYHVnr2ntra2mpWWH0BVu52fhRH2XSZDmsA/xensokC21Pv9T3J4wcWrq17gob1er7tEhMcJuYsfGoS3hdTweuBpxaM0iCJph8fLuX7DJMPWnI2GOzi8YOKseD4gB+RSQezMRRx5vRPEn88Sz7IIx8KHgT3FCBniWJUyke6o8/uXc3jBxIKTd7vdTsFJfkSo38NbCY/vPRsOPwt81KgLqeoBXc+sBjZsxLF4ZfgM7goqSqMRL1S7oOSrq6sdLodjH0rYfbyByPEOePwZ4CO8Liv3RCL70Wctr8+mA2NkT53P91iu92aCFYx8TU1NpbOi8gfs2R7iDYLxnXqYPg3c5Fm+Xygcbs/omXXATZGBBagQqNAe9Psf4d+ZiVwQ8qjqFVVl5dmi9ShvDEL90IieXtVDevic5ruOyYiAXYiA9YSxsZow0YnSKkKFjoAn8OAENsPGjKs9qnp5iSDuBXFLXsLjR4fSIy29vb2DU7UThW4d8n0zxjXtRVAYNaJnlocikWNTHZPvP1PPl2LLujM3cfbzwJXUyukQzxrZraptRCcbEDm60Wh4S0IE7McByVJQjf3yac+EfEm9ouxAcWu2TsS6koOplr6+vstWXf5IKBrejBR4ybIAlLpE1JE6j8eyh8h/dEKmS95e7w9sy57G+MkQ6sdYMrmiv79/gNdNR0YEbGKUvIIFQMRffRBtbkG0HQj6fHdcRafWmg55Gzy+BR5vtUzF2O96kjSH4nHNopsB0B0Ob6SEvcYvAPYS1UwQDyqLFcu5IZ/pTMUkjxfEoD/wLVY9+z02PXDL8RE9s0y9qMZNigIJcU37TZblfj7aUAMqURLXuqqq9sQHBi5NZbqpkBfh8a9BPLtDMz3wyImh9GhTLBab0uSmQfIQcNQ95pJkDVG3wtgdC1KFA+HaSodjdzKZ/Neou1Y7X/JC0K98BeIvWAdjp+jwUKN6/nyfVVd4JK4lunDrkwJhc6Gl1GGjwhqnLO3UNC2Rz8z5kKfw+EYQf5EfEKF+Wh+kDd0XYxd43WzKiIBfEAEjiIAm0zyUSFiU1XJF+feJy5evW3euR57C41+A+MumSbICY2dGmd6gnlPPWXRFABABP7llCXsA2mCcDjVAJoK4qryycsfAwEDSqOPb1yQPj38O4q/yL4F4aCiTXhqNRmMWXREBFMGjslOywUbToQeyyy4IrVVO53bUgEk/uZOSr/MHPsOd0hs8F4R6mI2ONKi9vRFeNxdyIqkddknOMhA2nyuy+wAqtEol8rbEYCLnZisneXj8UxB/00KGkUiGsqU90WiPRTeHACLgoNsp4eBDHzaagRS4RbCzle6ysq3xVIq/LiMW8ti5fYRVfMs4yFibsdgI05eqqhqy6OYBEE9qnSiCLhRB7tRHFzDR1oIasBU1wHTAMpHHjcmHIP4OzwXf8XMkk24IR6NneN18klEE97mc0gJwuN9oF+SFNlF8vNJR1YYacGVcN0Eet6XvY6Pw3rhi/Bc5fiEzShp7eiOnx7H5/IsI6EAELEIE3Gu0EymwyCbQZocktWEfMHa3MEa+zqe8KwjCB8bO/7f70kxvVGPqyRy6eQshAtpdsuTDN/9us5F0MQ4zTS5BaIsPDQ3jO+5/G+fjj82dIDF2CZeKjd3R6J8W3Y0BYFca+JJQssFqLuvSUqlmESHSiZywGzsgx+OZNFnWE4scN+I3WJshAnYjAm5FBNxptp16y+y2hICLEtOVMXJcI0xvDveGi/ofU7NxBZN0XIpuIIy0mUZkZNNZVf1kDAt6lZagEhjGnxbweh8wdbw5hOwdxHbwY/j9BpTM9xi4MGzFvZhpk3Bz8J5gkb19ym7cJr5w/wEmUjzJqoNVhwAAAABJRU5ErkJggg==\"\n\n            if let data = Data(base64Encoded: base64Data, options: .ignoreUnknownCharacters) {\n                Static.keyboardUpImage = UIImage(data: data, scale: 3)\n            }\n\n            //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)\n            Static.keyboardUpImage = Static.keyboardUpImage?.imageFlippedForRightToLeftLayoutDirection()\n        }\n\n        return Static.keyboardUpImage\n    }\n\n    static func keyboardDownImage() -> UIImage? {\n\n        struct Static {\n            static var keyboardDownImage: UIImage?\n        }\n\n        if Static.keyboardDownImage == nil {\n\n            let base64Data = \"iVBORw0KGgoAAAANSUhEUgAAAD8AAAAkCAYAAAA+TuKHAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAAGp0lEQVRoBd1ZCWhcRRiemff25WrydmOtuXbfZlMo4lEpKkppm6TpZUovC4UqKlQoUhURqQcUBcWDIkhVUCuI9SpJa+2h0VZjUawUEUUUirLNXqmxSnc32WaT7O4bv0nd5R1bc+2maR8s7z9m5v+/+f/5Z94sIf89jW73Yp/bfUuWvwLfDp/H8zhwObLYmCCaPJ6FjLJPCWNHNU1bkFVeQW/Zp2l7KWUvNmlaB3DJAhvz1ntvI5R1EUpnUUKdEifHGuvr519BwKUmj/cDYNtwARNd5/NoH4GWKIhzlFKXCSzn/xCut/jD4V9N8suPYYj4ewC+2e46f55Rwp/geExKSmdzJn2l1WrXmuSXF8MQ8XfyAeeEn9KTyV3MHwq9RTh50IqLEjJHUkh3Y13dPKvuMuApIr6bUHKP1VeE+Y8MIa09Z8/+JQlltD/+Q7VaFcW6X2VsjFmbRRnbUFFZeai/v/+cUTeDaYqIv4GlfL/NR879I3qmORwOnxG6UfCCiMbjJ51VagKdlgs+91BaKVO6oVJVD8bj8WhOPkMJn1t7jTL6gNU9pHpgKJ1q7u3tjWR1OfBCEOuPf+9Sq4YwAW3ZBqNvSqsYpeuc5WUHYolE3KSbQYzP430FwB+yuoSCFtKHaXP4z3DIqDOBFwpkwHfVThXLgrYaG6IGOAmT1pZVVHw8MDDQb9TNBLrJre0E8EdtvnAeSRPeHOwN9lh1NvCiASbgG5fqRLDJEmMHsSU6GFuDGrAfNWDAqLuUNE5uL6A2bbf5wPkZrmdaAuGw36aDIC940TAajx1HBijIgEWmjpRWS4ytrnKq+1EDEibdJWAa3dqzjLGnrKaxxvt4OtXS09v7u1WX5S8KXjRABnQ7VbUCEV+Y7SDeWAJX4dfuLCnZFzt//rxRN500jqo74NvTVptY42fTnLcGI5FTVp2R/1/womEsHj/mwgxg27vd2BH8bCrLq0rKyjoTicSgUTcdNIrbkwD+nM2WOJ3qmaVI9d9sOotgTPCiPTLgi+oqdTbOAbea+lM6xyHLK8pnVXSiCCZNuiIyjZr2GArSS1YTOKie45n0UqT6L1ZdPn5c4EVHHIS6sA3WYLZvNg6E9L9GZmwZzgEdqAFDRl0xaET8EQB/2To21ngsQ0kbIv6zVXcxftzgxQDIgM+qVbUeGbDAPCCtxbfxUhdjHdGhoWGzrnAcIr4NwHflGbGf6PqyQCj0Yx7dRUUTAi9GwQQccapOL7bBm4yjIiPqSElpC5VYRzKZLPgE4M5hK0rt67CDZDM9A+k0XxmIhE6apONgJgxejBmLxw65VHUu/LjRaANeNZQpyhJZUToGBwdHjLqp0Ij4FgB/0wocaxw7DV8F4CcmM/6kwMMQRwYcrFad87DvXW8yTKlbkZVFSmlJB3bBlEk3CQYRvxfA3wbw0Vun7BAAPqjrmfaecPjbrGyib2sKTbS/LG5F4NhGe0d+fDiTuSMSiUx6F8Bn6V343N6TB3gSyb/aHwx22+2OX2KazfF3y7VMnw4FcUvCP8lJcgRtVph0yEu8pTnRBAiv270JwN+1AscQw5zr66YKXLgyVfBijBQc2YQ0PCIY4wPH2yQPERNTYpSPRSPid0qUvY/+1mU5QjJ8PVL96FhjjEdfCPDCzggyAKnPP7cZpWQFlsZ+yPGdMPaDiK/F6fEjbKeypXVK5/pGfyTYZZFPmi0UeOHAcCZI1+Oa6JjVG0SwHbcrnZDn7sytbQSPiLdLTBJXy+Z2nKcR8U09odDhfP0mKyskeBIggaERPb0WGfC1zSFK1gDcXsitER1t6m3wrkTEbRmC5ZTRCd+MiB+wjTlFwVSrfV7zdXV15aWy0oWKvNjWgJMOfyiAIklwYXLhwfd4G/47OAxnTMVRAKec3u0PB8SkFfyxFpSCGMBHTkpWHPsU2bEEKe8xDUrJdfhKnItzgiiEXKvXWhijR9CuzNgOwHWc1+87HQ5+aJQXki4KeOGgOOFJDkdnqeJowSGlweg00vsGHJAa1UpnTJKIAF5u1AM4R8S3APgeo7zQdFHS3uikz+VSSWXVlwBo+hoUbUR0ITfVHQEcEd+K4rbbOE4xaJPhYhg4HY3GcYG4HFB/so5vBT6q53TbdAAXtooe+SzghoaGakWSu2FwflZmfWMffxjAX7XKi8VPG3gBoKam5uoKpeQEDjBz7YD4dpwUd9rlxZMUPe2Nrvf19f2dTKdasap7jHIsiR3TDdxsfxq5xtpazad5g02al+Na6plpND0zTHk8Hp+4iLyU3vwLp0orLWXqrZQAAAAASUVORK5CYII=\"\n\n            if let data = Data(base64Encoded: base64Data, options: .ignoreUnknownCharacters) {\n                Static.keyboardDownImage = UIImage(data: data, scale: 3)\n            }\n\n            //Support for RTL languages like Arabic, Persia etc... (Bug ID: #448)\n            Static.keyboardDownImage = Static.keyboardDownImage?.imageFlippedForRightToLeftLayoutDirection()\n        }\n\n        return Static.keyboardDownImage\n    }\n\n    static func keyboardPreviousImage() -> UIImage? {\n\n        if #available(iOS 10, *) {\n            return keyboardUpImage()\n        } else {\n            return keyboardLeftImage()\n        }\n    }\n\n    static func keyboardNextImage() -> UIImage? {\n\n        if #available(iOS 10, *) {\n            return keyboardDownImage()\n        } else {\n            return keyboardRightImage()\n        }\n    }\n}\n\n/**\nUIView category methods to add IQToolbar on UIKeyboard.\n*/\n@available(iOSApplicationExtension, unavailable)\n@objc public extension UIView {\n\n    private struct AssociatedKeys {\n        static var keyboardToolbar = \"keyboardToolbar\"\n        static var shouldHideToolbarPlaceholder = \"shouldHideToolbarPlaceholder\"\n        static var toolbarPlaceholder = \"toolbarPlaceholder\"\n    }\n\n    // MARK: Toolbar\n\n    /**\n     IQToolbar references for better customization control.\n     */\n    var keyboardToolbar: IQToolbar {\n        var toolbar = inputAccessoryView as? IQToolbar\n\n        if toolbar == nil {\n            toolbar = objc_getAssociatedObject(self, &AssociatedKeys.keyboardToolbar) as? IQToolbar\n        }\n\n        if let unwrappedToolbar = toolbar {\n            return unwrappedToolbar\n        } else {\n\n            let frame = CGRect(origin: .zero, size: .init(width: UIScreen.main.bounds.width, height: 44))\n            let newToolbar = IQToolbar(frame: frame)\n\n            objc_setAssociatedObject(self, &AssociatedKeys.keyboardToolbar, newToolbar, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n\n            return newToolbar\n        }\n    }\n\n    // MARK: Toolbar title\n\n    /**\n    If `shouldHideToolbarPlaceholder` is YES, then title will not be added to the toolbar. Default to NO.\n    */\n    var shouldHideToolbarPlaceholder: Bool {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.shouldHideToolbarPlaceholder) as? Bool ?? false\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.shouldHideToolbarPlaceholder, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            self.keyboardToolbar.titleBarButton.title = self.drawingToolbarPlaceholder\n        }\n    }\n\n    /**\n     `toolbarPlaceholder` to override default `placeholder` text when drawing text on toolbar.\n     */\n    var toolbarPlaceholder: String? {\n        get {\n            return objc_getAssociatedObject(self, &AssociatedKeys.toolbarPlaceholder) as? String\n        }\n        set(newValue) {\n            objc_setAssociatedObject(self, &AssociatedKeys.toolbarPlaceholder, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            self.keyboardToolbar.titleBarButton.title = self.drawingToolbarPlaceholder\n        }\n    }\n\n    /**\n     `drawingToolbarPlaceholder` will be actual text used to draw on toolbar. This would either `placeholder` or `toolbarPlaceholder`.\n     */\n    var drawingToolbarPlaceholder: String? {\n\n        if self.shouldHideToolbarPlaceholder {\n            return nil\n        } else if self.toolbarPlaceholder?.isEmpty == false {\n            return self.toolbarPlaceholder\n        } else if self.responds(to: #selector(getter: UITextField.placeholder)) {\n\n            if let textField = self as? UITextField {\n                return textField.placeholder\n            } else if let textView = self as? IQTextView {\n                return textView.placeholder\n            } else {\n                return nil\n            }\n        } else {\n            return nil\n        }\n    }\n\n    // MARK: Private helper\n\n    // swiftlint:disable nesting\n    private static func flexibleBarButtonItem () -> IQBarButtonItem {\n\n        struct Static {\n\n            static let nilButton = IQBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)\n        }\n\n        Static.nilButton.isSystemItem = true\n        return Static.nilButton\n    }\n\n    // MARK: Common\n\n    func addKeyboardToolbarWithTarget(target: AnyObject?, titleText: String?, rightBarButtonConfiguration: IQBarButtonItemConfiguration?, previousBarButtonConfiguration: IQBarButtonItemConfiguration? = nil, nextBarButtonConfiguration: IQBarButtonItemConfiguration? = nil) {\n\n        //If can't set InputAccessoryView. Then return\n        if self.responds(to: #selector(setter: UITextField.inputAccessoryView)) {\n\n            //  Creating a toolBar for phoneNumber keyboard\n            let toolbar = self.keyboardToolbar\n\n            var items: [IQBarButtonItem] = []\n\n            if let prevConfig = previousBarButtonConfiguration {\n\n                var prev = toolbar.previousBarButton\n\n                if prevConfig.barButtonSystemItem == nil, !prev.isSystemItem {\n                    prev.title = prevConfig.title\n                    prev.accessibilityLabel = prevConfig.accessibilityLabel\n                    prev.image = prevConfig.image\n                    prev.target = target\n                    prev.action = prevConfig.action\n                } else {\n                    if let systemItem = prevConfig.barButtonSystemItem {\n                        prev = IQBarButtonItem(barButtonSystemItem: systemItem, target: target, action: prevConfig.action)\n                        prev.isSystemItem = true\n                    } else if let image = prevConfig.image {\n                        prev = IQBarButtonItem(image: image, style: .plain, target: target, action: prevConfig.action)\n                    } else {\n                        prev = IQBarButtonItem(title: prevConfig.title, style: .plain, target: target, action: prevConfig.action)\n                    }\n\n                    prev.invocation = toolbar.previousBarButton.invocation\n                    prev.accessibilityLabel = prevConfig.accessibilityLabel\n                    prev.isEnabled = toolbar.previousBarButton.isEnabled\n                    prev.tag = toolbar.previousBarButton.tag\n                    toolbar.previousBarButton = prev\n                }\n\n                items.append(prev)\n            }\n\n            if previousBarButtonConfiguration != nil, nextBarButtonConfiguration != nil {\n\n                items.append(toolbar.fixedSpaceBarButton)\n            }\n\n            if let nextConfig = nextBarButtonConfiguration {\n\n                var next = toolbar.nextBarButton\n\n                if nextConfig.barButtonSystemItem == nil, !next.isSystemItem {\n                    next.title = nextConfig.title\n                    next.accessibilityLabel = nextConfig.accessibilityLabel\n                    next.image = nextConfig.image\n                    next.target = target\n                    next.action = nextConfig.action\n                } else {\n                    if let systemItem = nextConfig.barButtonSystemItem {\n                        next = IQBarButtonItem(barButtonSystemItem: systemItem, target: target, action: nextConfig.action)\n                        next.isSystemItem = true\n                    } else if let image = nextConfig.image {\n                        next = IQBarButtonItem(image: image, style: .plain, target: target, action: nextConfig.action)\n                    } else {\n                        next = IQBarButtonItem(title: nextConfig.title, style: .plain, target: target, action: nextConfig.action)\n                    }\n\n                    next.invocation = toolbar.nextBarButton.invocation\n                    next.accessibilityLabel = nextConfig.accessibilityLabel\n                    next.isEnabled = toolbar.nextBarButton.isEnabled\n                    next.tag = toolbar.nextBarButton.tag\n                    toolbar.nextBarButton = next\n                }\n\n                items.append(next)\n            }\n\n            //Title bar button item\n            do {\n                //Flexible space\n                items.append(UIView.flexibleBarButtonItem())\n\n                //Title button\n                toolbar.titleBarButton.title = titleText\n\n                if #available(iOS 11, *) {} else {\n                    toolbar.titleBarButton.customView?.frame = CGRect.zero\n                }\n\n                items.append(toolbar.titleBarButton)\n\n                //Flexible space\n                items.append(UIView.flexibleBarButtonItem())\n            }\n\n            if let rightConfig = rightBarButtonConfiguration {\n\n                var done = toolbar.doneBarButton\n\n                if rightConfig.barButtonSystemItem == nil, !done.isSystemItem {\n                    done.title = rightConfig.title\n                    done.accessibilityLabel = rightConfig.accessibilityLabel\n                    done.image = rightConfig.image\n                    done.target = target\n                    done.action = rightConfig.action\n                } else {\n                    if let systemItem = rightConfig.barButtonSystemItem {\n                        done = IQBarButtonItem(barButtonSystemItem: systemItem, target: target, action: rightConfig.action)\n                        done.isSystemItem = true\n                    } else if let image = rightConfig.image {\n                        done = IQBarButtonItem(image: image, style: .plain, target: target, action: rightConfig.action)\n                    } else {\n                        done = IQBarButtonItem(title: rightConfig.title, style: .plain, target: target, action: rightConfig.action)\n                    }\n\n                    done.invocation = toolbar.doneBarButton.invocation\n                    done.accessibilityLabel = rightConfig.accessibilityLabel\n                    done.isEnabled = toolbar.doneBarButton.isEnabled\n                    done.tag = toolbar.doneBarButton.tag\n                    toolbar.doneBarButton = done\n                }\n\n                items.append(done)\n            }\n\n            //  Adding button to toolBar.\n            toolbar.items = items\n\n            if let textInput = self as? UITextInput {\n                switch textInput.keyboardAppearance {\n                case .dark?:\n                    toolbar.barStyle = .black\n                default:\n                    toolbar.barStyle = .default\n                }\n            }\n\n            //  Setting toolbar to keyboard.\n            if let textField = self as? UITextField {\n                textField.inputAccessoryView = toolbar\n            } else if let textView = self as? UITextView {\n                textView.inputAccessoryView = toolbar\n            }\n        }\n    }\n\n    // MARK: Right\n\n    func addDoneOnKeyboardWithTarget(_ target: AnyObject?, action: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addDoneOnKeyboardWithTarget(target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addDoneOnKeyboardWithTarget(_ target: AnyObject?, action: Selector, titleText: String?) {\n\n        let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: action)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration)\n    }\n\n    func addRightButtonOnKeyboardWithImage(_ image: UIImage, target: AnyObject?, action: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addRightButtonOnKeyboardWithImage(image, target: target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addRightButtonOnKeyboardWithImage(_ image: UIImage, target: AnyObject?, action: Selector, titleText: String?) {\n\n        let rightConfiguration = IQBarButtonItemConfiguration(image: image, action: action)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration)\n    }\n\n    func addRightButtonOnKeyboardWithText(_ text: String, target: AnyObject?, action: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addRightButtonOnKeyboardWithText(text, target: target, action: action, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addRightButtonOnKeyboardWithText(_ text: String, target: AnyObject?, action: Selector, titleText: String?) {\n\n        let rightConfiguration = IQBarButtonItemConfiguration(title: text, action: action)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration)\n    }\n\n    // MARK: Right/Left\n\n    func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?, cancelAction: Selector, doneAction: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addCancelDoneOnKeyboardWithTarget(target, cancelAction: cancelAction, doneAction: doneAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonTitle: String, rightButtonTitle: String, leftButtonAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addRightLeftOnKeyboardWithTarget(target, leftButtonTitle: leftButtonTitle, rightButtonTitle: rightButtonTitle, leftButtonAction: leftButtonAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonImage: UIImage, rightButtonImage: UIImage, leftButtonAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addRightLeftOnKeyboardWithTarget(target, leftButtonImage: leftButtonImage, rightButtonImage: rightButtonImage, leftButtonAction: leftButtonAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addCancelDoneOnKeyboardWithTarget(_ target: AnyObject?, cancelAction: Selector, doneAction: Selector, titleText: String?) {\n\n        let leftConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .cancel, action: cancelAction)\n        let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: doneAction)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: leftConfiguration)\n    }\n\n    func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonTitle: String, rightButtonTitle: String, leftButtonAction: Selector, rightButtonAction: Selector, titleText: String?) {\n\n        let leftConfiguration = IQBarButtonItemConfiguration(title: leftButtonTitle, action: leftButtonAction)\n        let rightConfiguration = IQBarButtonItemConfiguration(title: rightButtonTitle, action: rightButtonAction)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: leftConfiguration)\n    }\n\n    func addRightLeftOnKeyboardWithTarget(_ target: AnyObject?, leftButtonImage: UIImage, rightButtonImage: UIImage, leftButtonAction: Selector, rightButtonAction: Selector, titleText: String?) {\n\n        let leftConfiguration = IQBarButtonItemConfiguration(image: leftButtonImage, action: leftButtonAction)\n        let rightConfiguration = IQBarButtonItemConfiguration(image: rightButtonImage, action: rightButtonAction)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: leftConfiguration)\n    }\n\n    // MARK: Previous/Next/Right\n\n    func addPreviousNextDoneOnKeyboardWithTarget (_ target: AnyObject?, previousAction: Selector, nextAction: Selector, doneAction: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addPreviousNextDoneOnKeyboardWithTarget(target, previousAction: previousAction, nextAction: nextAction, doneAction: doneAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonImage: UIImage, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addPreviousNextRightOnKeyboardWithTarget(target, rightButtonImage: rightButtonImage, previousAction: previousAction, nextAction: nextAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonTitle: String, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, shouldShowPlaceholder: Bool = false) {\n\n        addPreviousNextRightOnKeyboardWithTarget(target, rightButtonTitle: rightButtonTitle, previousAction: previousAction, nextAction: nextAction, rightButtonAction: rightButtonAction, titleText: (shouldShowPlaceholder ? self.drawingToolbarPlaceholder: nil))\n    }\n\n    func addPreviousNextDoneOnKeyboardWithTarget (_ target: AnyObject?, previousAction: Selector, nextAction: Selector, doneAction: Selector, titleText: String?) {\n\n        let rightConfiguration = IQBarButtonItemConfiguration(barButtonSystemItem: .done, action: doneAction)\n        let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)\n        let prevConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardPreviousImage() ?? UIImage(), action: previousAction)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)\n    }\n\n    func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonImage: UIImage, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, titleText: String?) {\n\n        let rightConfiguration = IQBarButtonItemConfiguration(image: rightButtonImage, action: rightButtonAction)\n        let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)\n        let prevConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardPreviousImage() ?? UIImage(), action: previousAction)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)\n    }\n\n    func addPreviousNextRightOnKeyboardWithTarget(_ target: AnyObject?, rightButtonTitle: String, previousAction: Selector, nextAction: Selector, rightButtonAction: Selector, titleText: String?) {\n\n        let rightConfiguration = IQBarButtonItemConfiguration(title: rightButtonTitle, action: rightButtonAction)\n        let nextConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardNextImage() ?? UIImage(), action: nextAction)\n        let prevConfiguration = IQBarButtonItemConfiguration(image: UIImage.keyboardPreviousImage() ?? UIImage(), action: previousAction)\n\n        addKeyboardToolbarWithTarget(target: target, titleText: titleText, rightBarButtonConfiguration: rightConfiguration, previousBarButtonConfiguration: prevConfiguration, nextBarButtonConfiguration: nextConfiguration)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/LICENSE.md",
    "content": "MIT License\n\nCopyright (c) 2013-2017 Iftekhar Qurashi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift/README.md",
    "content": "<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Demo/Resources/icon.png\" alt=\"Icon\"/>\n</p>\n<H1 align=\"center\">IQKeyboardManager</H1>\n<p align=\"center\">\n  <img src=\"https://img.shields.io/github/license/hackiftekhar/IQKeyboardManager.svg\"\n  alt=\"GitHub license\"/>\n\n\n[![Build Status](https://travis-ci.org/hackiftekhar/IQKeyboardManager.svg)](https://travis-ci.org/hackiftekhar/IQKeyboardManager)\n\n\nWhile developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers the `UITextField/UITextView`. `IQKeyboardManager` allows you to prevent this issue of keyboard sliding up and covering `UITextField/UITextView` without needing you to write any code or make any additional setup. To use `IQKeyboardManager` you simply need to add source files to your project.\n\n\n#### Key Features\n\n1) `**CODELESS**, Zero Lines of Code`\n\n2) `Works Automatically`\n\n3) `No More UIScrollView`\n\n4) `No More Subclasses`\n\n5) `No More Manual Work`\n\n6) `No More #imports`\n\n`IQKeyboardManager` works on all orientations, and with the toolbar. It also has nice optional features allowing you to customize the distance from the text field, behaviour of previous, next and done buttons in the keyboard toolbar, play sound when the user navigates through the form and more.\n\n\n## Screenshot\n[![IQKeyboardManager](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManagerScreenshot.png)](http://youtu.be/6nhLw6hju2A)\n[![Settings](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManagerSettings.png)](http://youtu.be/6nhLw6hju2A)\n\n## GIF animation\n[![IQKeyboardManager](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManager.gif)](http://youtu.be/6nhLw6hju2A)\n\n## Video\n\n<a href=\"http://youtu.be/WAYc2Qj-OQg\" target=\"_blank\"><img src=\"http://img.youtube.com/vi/WAYc2Qj-OQg/0.jpg\"\nalt=\"IQKeyboardManager Demo Video\" width=\"480\" height=\"360\" border=\"10\" /></a>\n\n## Tutorial video by @rebeloper ([#1135](https://github.com/hackiftekhar/IQKeyboardManager/issues/1135))\n\n@rebeloper demonstrated two videos on how to implement **IQKeyboardManager** at it's core:\n\n<a href=\"https://www.youtube.com/playlist?list=PL_csAAO9PQ8aTL87XnueOXi3RpWE2m_8v\" target=\"_blank\"><img src=\"https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/ThirdPartyYoutubeTutorial.jpg\"\nalt=\"Youtube Tutorial Playlist\"/></a>\n\nhttps://www.youtube.com/playlist?list=PL_csAAO9PQ8aTL87XnueOXi3RpWE2m_8v\n\n## Warning\n\n- **If you're planning to build SDK/library/framework and want to handle UITextField/UITextView with IQKeyboardManager then you're totally going the wrong way.** I would never suggest to add **IQKeyboardManager** as **dependency/adding/shipping** with any third-party library. Instead of adding **IQKeyboardManager** you should implement your own solution to achieve same kind of results. **IQKeyboardManager** is totally designed for projects to help developers for their convenience, it's not designed for **adding/dependency/shipping** with any **third-party library**, because **doing this could block adoption by other developers for their projects as well (who are not using IQKeyboardManager and have implemented their custom solution to handle UITextField/UITextView in the project).**\n- If **IQKeyboardManager** conflicts with other **third-party library**, then it's **developer responsibility** to **enable/disable IQKeyboardManager** when **presenting/dismissing** third-party library UI. Third-party libraries are not responsible to handle IQKeyboardManager.\n\n## Requirements\n[![Platform iOS](https://img.shields.io/badge/Platform-iOS-blue.svg?style=fla)]()\n\n|                        | Language | Minimum iOS Target | Minimum Xcode Version |\n|------------------------|----------|--------------------|-----------------------|\n| IQKeyboardManager      | Obj-C    | iOS 8.0            | Xcode 9           |\n| IQKeyboardManagerSwift | Swift    | iOS 8.0            | Xcode 9           |\n| Demo Project           |          |                    | Xcode 11             |\n\n#### Swift versions support\n\n| Swift             | Xcode | IQKeyboardManagerSwift |\n|-------------------|-------|------------------------|\n| 5.1, 5.0, 4.2, 4.0, 3.2, 3.0| 11  | >= 6.5.0               |\n| 5.0,4.2, 4.0, 3.2, 3.0| 10.2  | >= 6.2.1               |\n| 4.2, 4.0, 3.2, 3.0| 10.0  | >= 6.0.4               |\n| 4.0, 3.2, 3.0     | 9.0   | 5.0.0                  |\n\nInstallation\n==========================\n\n#### Installation with CocoaPods\n\n[![CocoaPods](https://img.shields.io/cocoapods/v/IQKeyboardManager.svg)](http://cocoadocs.org/docsets/IQKeyboardManager)\n\n***IQKeyboardManager (Objective-C):*** IQKeyboardManager is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile: ([#9](https://github.com/hackiftekhar/IQKeyboardManager/issues/9))\n\n```ruby\npod 'IQKeyboardManager' #iOS8 and later\n```\n\n***IQKeyboardManager (Swift):*** IQKeyboardManagerSwift is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile: ([#236](https://github.com/hackiftekhar/IQKeyboardManager/issues/236))\n\n*Swift 5.1, 5.0, 4.2, 4.0, 3.2, 3.0 (Xcode 11)*\n\n```ruby\npod 'IQKeyboardManagerSwift'\n```\n\n*Or you can choose the version you need based on Swift support table from [Requirements](README.md#requirements)*\n\n```ruby\npod 'IQKeyboardManagerSwift', '6.3.0'\n```\n\nIn AppDelegate.swift, just import IQKeyboardManagerSwift framework and enable IQKeyboardManager.\n\n```swift\nimport IQKeyboardManagerSwift\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n\n      IQKeyboardManager.shared.enable = true\n\n      return true\n    }\n}\n```\n\n#### Installation with Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate `IQKeyboardManger` or `IQKeyboardManagerSwift` into your Xcode project using Carthage, add the following line to your `Cartfile`:\n\n```ogdl\ngithub \"hackiftekhar/IQKeyboardManager\"\n```\n\nRun `carthage` to build the frameworks and drag the appropriate framework (`IQKeyboardManager.framework` or `IQKeyboardManagerSwift.framework`) into your Xcode project based on your need. Make sure to add only one framework and not both.\n\n\n#### Installation with Source Code\n\n[![Github tag](https://img.shields.io/github/tag/hackiftekhar/iqkeyboardmanager.svg)]()\n\n\n\n***IQKeyboardManager (Objective-C):*** Just ***drag and drop*** `IQKeyboardManager` directory from demo project to your project. That's it.\n\n***IQKeyboardManager (Swift):*** ***Drag and drop*** `IQKeyboardManagerSwift` directory from demo project to your project\n\nIn AppDelegate.swift, just enable IQKeyboardManager.\n\n```swift\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n\n      IQKeyboardManager.shared.enable = true\n\n      return true\n    }\n}\n```\n\n#### Installation with Swift Package Manager\n\n[Swift Package Manager(SPM)](https://swift.org/package-manager/) is Apple's dependency manager tool. It is now supported in Xcode 11. So it can be used in all appleOS types of projects. It can be used alongside other tools like CocoaPods and Carthage as well. \n\nTo install IQKeyboardManager package into your packages, add a reference to IQKeyboardManager and a targeting release version in the dependencies section in `Package.swift` file:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    products: [],\n    dependencies: [\n        .package(url: \"https://github.com/hackiftekhar/IQKeyboardManager.git\", from: \"6.5.0\")\n    ]\n)\n```\n\nTo install IQKeyboardManager package via Xcode\n\n * Go to File -> Swift Packages -> Add Package Dependency...\n * Then search for https://github.com/hackiftekhar/IQKeyboardManager.git\n * And choose the version you want\n\nMigration Guide\n==========================\n- [IQKeyboardManager 6.0.0 Migration Guide](https://github.com/hackiftekhar/IQKeyboardManager/wiki/IQKeyboardManager-6.0.0-Migration-Guide)\n\nOther Links\n==========================\n\n- [Known Issues](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Known-Issues)\n- [Manual Management Tweaks](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Manual-Management)\n- [Properties and functions usage](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Properties-&-Functions)\n\n## Flow Diagram\n[![IQKeyboardManager CFD](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/IQKeyboardManagerFlowDiagram.jpg)](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/IQKeyboardManagerFlowDiagram.jpg)\n\nIf you would like to see detailed Flow diagram then check [Detailed Flow Diagram](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManagerCFD.jpg).\n\n\nLICENSE\n---\nDistributed under the MIT License.\n\nContributions\n---\nAny contribution is more than welcome! You can contribute through pull requests and issues on GitHub.\n\nAuthor\n---\nIf you wish to contact me, email at: hack.iftekhar@gmail.com\n"
  },
  {
    "path": "JetChat/Pods/IQKeyboardManagerSwift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t09F78371F70C68C71B694C323479D046 /* IQUIView+IQKeyboardToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10A6BBAC5E85397B6190ED993912E11F /* IQUIView+IQKeyboardToolbar.swift */; };\n\t\t0DC3549480F18768F124FA46A82DF1FA /* IQToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76C2C0372BCB3128DF6CA0C53A9E451A /* IQToolbar.swift */; };\n\t\t261F5BD0E587B7A6729F0C70C66D914B /* IQKeyboardManagerConstantsInternal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92C832DB42077D84C205249F9E997905 /* IQKeyboardManagerConstantsInternal.swift */; };\n\t\t2678EF9A64B7AC17B365DE0F0C4FA336 /* IQUIViewController+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA60EFCD6DA12DDF7AE96003860DDC9F /* IQUIViewController+Additions.swift */; };\n\t\t2D3468D1970863E4C141E7648F07DE07 /* IQKeyboardManager+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2353E46FF36871C1A382E58209C2512F /* IQKeyboardManager+Internal.swift */; };\n\t\t379ED1A166A1F1232501538158C3574B /* IQPreviousNextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A1FB9DC92897C5D1421E3C934A93822 /* IQPreviousNextView.swift */; };\n\t\t37B97479813D5149C1057A437E60E585 /* IQBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E03920B0B02D80596B3F67A97082AEF4 /* IQBarButtonItem.swift */; };\n\t\t40C78E974028D3242DC56B6E1EFA93F0 /* IQNSArray+Sort.swift in Sources */ = {isa = PBXBuildFile; fileRef = 661B78E184D4847D2EF59219CC3F5A9B /* IQNSArray+Sort.swift */; };\n\t\t47346AB31C29A468EA5D403432B8D3A6 /* IQTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0CA644EB9E5EC44C32C872B27BF5496 /* IQTextView.swift */; };\n\t\t51B4862EAB5231B79D95334697D349A9 /* IQUIScrollView+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10459AAF85BA8BD05D7A6DDBF42B5437 /* IQUIScrollView+Additions.swift */; };\n\t\t5E41FE2B5A6ECD2EDE8552238451631D /* IQUIView+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28D576980A1AC7CDCB8A72F07285D564 /* IQUIView+Hierarchy.swift */; };\n\t\t617358488245BCAAD55499E9116418FD /* IQInvocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB8AF5FBFCC6770E99358B4B672112 /* IQInvocation.swift */; };\n\t\t66A05923F602C527222EE0C304C2E850 /* IQUITextFieldView+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B914646B657819A80DE94151ED66AD98 /* IQUITextFieldView+Additions.swift */; };\n\t\t6F42942749B76F3D22B4D090BC5C2B91 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 946A9EDB57AE4614BB8937C72844BFE6 /* QuartzCore.framework */; };\n\t\t7EA80FFAA03DDE0AFCF4C6585D704928 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D680AA427A6A61493387E0A6E4E5029 /* UIKit.framework */; };\n\t\t8B4DE7CA92B312ABD57FAEC4A236B908 /* IQTitleBarButtonItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99089A30A3E333438B4B2466B97FF114 /* IQTitleBarButtonItem.swift */; };\n\t\t8EF2D582CF5564471E18B0A5FB92701D /* IQKeyboardManager+Position.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FCA4FD17F57944E5BEEBA0015885799 /* IQKeyboardManager+Position.swift */; };\n\t\t932EA9A4118FCB6C9AD7CB92452A7074 /* IQKeyboardManager+UIKeyboardNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F682DA676AD168D3091C5B133DA42D9F /* IQKeyboardManager+UIKeyboardNotification.swift */; };\n\t\t9701F2C0D0EB05C8F878BB29DA410C12 /* IQKeyboardManager+Toolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BEDD53D2B5D575373CB71E58A8AB12 /* IQKeyboardManager+Toolbar.swift */; };\n\t\t9D06E20FD926D170B925C0B5EE2BDCAD /* IQKeyboardManagerConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A9007D57C0B709E3AEE1DFE50874F32 /* IQKeyboardManagerConstants.swift */; };\n\t\tA2731AD5D558174D7B7FC76367CC65B7 /* IQKeyboardManager+OrientationNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A349561195FB92F21A65DB78F57AB13 /* IQKeyboardManager+OrientationNotification.swift */; };\n\t\tC250B91B22DD89802F9E23A910E052C5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0FA6DAC4FFD3027DA42EAE16FB5F47D /* CoreGraphics.framework */; };\n\t\tC3AB4C7196DF999E30027F5873C91611 /* IQKeyboardManager+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFD5ABB7FA590430552E190D99A750AB /* IQKeyboardManager+Debug.swift */; };\n\t\tD76E1452CEE7FB84E648900E86967C95 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E85534CACDFD728F3C94A3009624954A /* Foundation.framework */; };\n\t\tD96A987E1282E35ED8EB60C0E76F439A /* IQKeyboardReturnKeyHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AD77D1185EB62775EE3960141FCE996 /* IQKeyboardReturnKeyHandler.swift */; };\n\t\tEB7FB2AB0DD7EE8D7485DE2DA8DD4131 /* IQKeyboardManagerSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = ACD7538D01886F5C6399954BF036AED7 /* IQKeyboardManagerSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEBC0A418E7F2FAB2EF764B95A1B3843A /* IQKeyboardManagerSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B74594226A518BED96E389F0B28C6E3 /* IQKeyboardManagerSwift-dummy.m */; };\n\t\tF7F36074E1C10D486E34F4501E214BF0 /* IQKeyboardManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E8B098F97A55365762D8D2B7FA4E857 /* IQKeyboardManager.swift */; };\n\t\tF9079CF07AE7C8110F5E5AE403C1F0CD /* IQKeyboardManager+UITextFieldViewNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55CB5D81ABA6E4FBD1CF6B65226B391B /* IQKeyboardManager+UITextFieldViewNotification.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t0AD77D1185EB62775EE3960141FCE996 /* IQKeyboardReturnKeyHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardReturnKeyHandler.swift; path = IQKeyboardManagerSwift/IQKeyboardReturnKeyHandler.swift; sourceTree = \"<group>\"; };\n\t\t0D680AA427A6A61493387E0A6E4E5029 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };\n\t\t10459AAF85BA8BD05D7A6DDBF42B5437 /* IQUIScrollView+Additions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQUIScrollView+Additions.swift\"; path = \"IQKeyboardManagerSwift/Categories/IQUIScrollView+Additions.swift\"; sourceTree = \"<group>\"; };\n\t\t10A6BBAC5E85397B6190ED993912E11F /* IQUIView+IQKeyboardToolbar.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQUIView+IQKeyboardToolbar.swift\"; path = \"IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift\"; sourceTree = \"<group>\"; };\n\t\t1A349561195FB92F21A65DB78F57AB13 /* IQKeyboardManager+OrientationNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQKeyboardManager+OrientationNotification.swift\"; path = \"IQKeyboardManagerSwift/IQKeyboardManager+OrientationNotification.swift\"; sourceTree = \"<group>\"; };\n\t\t2353E46FF36871C1A382E58209C2512F /* IQKeyboardManager+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQKeyboardManager+Internal.swift\"; path = \"IQKeyboardManagerSwift/IQKeyboardManager+Internal.swift\"; sourceTree = \"<group>\"; };\n\t\t28D576980A1AC7CDCB8A72F07285D564 /* IQUIView+Hierarchy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQUIView+Hierarchy.swift\"; path = \"IQKeyboardManagerSwift/Categories/IQUIView+Hierarchy.swift\"; sourceTree = \"<group>\"; };\n\t\t2D7BA32644F54A1127B420AA6F6F2096 /* IQKeyboardManagerSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = IQKeyboardManagerSwift.modulemap; sourceTree = \"<group>\"; };\n\t\t2E8B098F97A55365762D8D2B7FA4E857 /* IQKeyboardManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardManager.swift; path = IQKeyboardManagerSwift/IQKeyboardManager.swift; sourceTree = \"<group>\"; };\n\t\t2FCA4FD17F57944E5BEEBA0015885799 /* IQKeyboardManager+Position.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQKeyboardManager+Position.swift\"; path = \"IQKeyboardManagerSwift/IQKeyboardManager+Position.swift\"; sourceTree = \"<group>\"; };\n\t\t3A1FB9DC92897C5D1421E3C934A93822 /* IQPreviousNextView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQPreviousNextView.swift; path = IQKeyboardManagerSwift/IQToolbar/IQPreviousNextView.swift; sourceTree = \"<group>\"; };\n\t\t3A2EA8E6127AE7662760044E338E4C84 /* IQKeyboardManagerSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"IQKeyboardManagerSwift-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t4A9007D57C0B709E3AEE1DFE50874F32 /* IQKeyboardManagerConstants.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardManagerConstants.swift; path = IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstants.swift; sourceTree = \"<group>\"; };\n\t\t4B74594226A518BED96E389F0B28C6E3 /* IQKeyboardManagerSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"IQKeyboardManagerSwift-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t4C008775202466506BDDE46A61D8BF41 /* IQKeyboardManagerSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardManagerSwift.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t55CB5D81ABA6E4FBD1CF6B65226B391B /* IQKeyboardManager+UITextFieldViewNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQKeyboardManager+UITextFieldViewNotification.swift\"; path = \"IQKeyboardManagerSwift/IQKeyboardManager+UITextFieldViewNotification.swift\"; sourceTree = \"<group>\"; };\n\t\t66191495FD45426E541C9C6A1C138E25 /* IQKeyboardManagerSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = IQKeyboardManagerSwift.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t661B78E184D4847D2EF59219CC3F5A9B /* IQNSArray+Sort.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQNSArray+Sort.swift\"; path = \"IQKeyboardManagerSwift/Categories/IQNSArray+Sort.swift\"; sourceTree = \"<group>\"; };\n\t\t76C2C0372BCB3128DF6CA0C53A9E451A /* IQToolbar.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQToolbar.swift; path = IQKeyboardManagerSwift/IQToolbar/IQToolbar.swift; sourceTree = \"<group>\"; };\n\t\t7A053AAF86A5B414C2A43A01BD0934FB /* IQKeyboardManagerSwift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = IQKeyboardManagerSwift; path = IQKeyboardManagerSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t88BEDD53D2B5D575373CB71E58A8AB12 /* IQKeyboardManager+Toolbar.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQKeyboardManager+Toolbar.swift\"; path = \"IQKeyboardManagerSwift/IQKeyboardManager+Toolbar.swift\"; sourceTree = \"<group>\"; };\n\t\t92C832DB42077D84C205249F9E997905 /* IQKeyboardManagerConstantsInternal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQKeyboardManagerConstantsInternal.swift; path = IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstantsInternal.swift; sourceTree = \"<group>\"; };\n\t\t946A9EDB57AE4614BB8937C72844BFE6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };\n\t\t99089A30A3E333438B4B2466B97FF114 /* IQTitleBarButtonItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTitleBarButtonItem.swift; path = IQKeyboardManagerSwift/IQToolbar/IQTitleBarButtonItem.swift; sourceTree = \"<group>\"; };\n\t\t9AF38034AC895F027F0F8AB8D608FD3D /* IQKeyboardManagerSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"IQKeyboardManagerSwift-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tACD7538D01886F5C6399954BF036AED7 /* IQKeyboardManagerSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"IQKeyboardManagerSwift-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tB914646B657819A80DE94151ED66AD98 /* IQUITextFieldView+Additions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQUITextFieldView+Additions.swift\"; path = \"IQKeyboardManagerSwift/Categories/IQUITextFieldView+Additions.swift\"; sourceTree = \"<group>\"; };\n\t\tC0FA6DAC4FFD3027DA42EAE16FB5F47D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };\n\t\tCA60EFCD6DA12DDF7AE96003860DDC9F /* IQUIViewController+Additions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQUIViewController+Additions.swift\"; path = \"IQKeyboardManagerSwift/Categories/IQUIViewController+Additions.swift\"; sourceTree = \"<group>\"; };\n\t\tCEEB8AF5FBFCC6770E99358B4B672112 /* IQInvocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQInvocation.swift; path = IQKeyboardManagerSwift/IQToolbar/IQInvocation.swift; sourceTree = \"<group>\"; };\n\t\tCFD5ABB7FA590430552E190D99A750AB /* IQKeyboardManager+Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQKeyboardManager+Debug.swift\"; path = \"IQKeyboardManagerSwift/IQKeyboardManager+Debug.swift\"; sourceTree = \"<group>\"; };\n\t\tE03920B0B02D80596B3F67A97082AEF4 /* IQBarButtonItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQBarButtonItem.swift; path = IQKeyboardManagerSwift/IQToolbar/IQBarButtonItem.swift; sourceTree = \"<group>\"; };\n\t\tE85534CACDFD728F3C94A3009624954A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tF0CA644EB9E5EC44C32C872B27BF5496 /* IQTextView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IQTextView.swift; path = IQKeyboardManagerSwift/IQTextView/IQTextView.swift; sourceTree = \"<group>\"; };\n\t\tF682DA676AD168D3091C5B133DA42D9F /* IQKeyboardManager+UIKeyboardNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IQKeyboardManager+UIKeyboardNotification.swift\"; path = \"IQKeyboardManagerSwift/IQKeyboardManager+UIKeyboardNotification.swift\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tEE9C193F8B9319E1878C2598247EC06D /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC250B91B22DD89802F9E23A910E052C5 /* CoreGraphics.framework in Frameworks */,\n\t\t\t\tD76E1452CEE7FB84E648900E86967C95 /* Foundation.framework in Frameworks */,\n\t\t\t\t6F42942749B76F3D22B4D090BC5C2B91 /* QuartzCore.framework in Frameworks */,\n\t\t\t\t7EA80FFAA03DDE0AFCF4C6585D704928 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0C62A8006B186CB47F899BB62E8BDF89 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7A053AAF86A5B414C2A43A01BD0934FB /* IQKeyboardManagerSwift */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t385CD504322E21A8AB187D1715528B45 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t9500A2775E8786D82A24E7A7AF32C5E0 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t705E4DC4E9C90DEA5E4C3C6F868F6023 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t385CD504322E21A8AB187D1715528B45 /* Frameworks */,\n\t\t\t\tBF14D39036C089F7E1B3F629DA08CE5B /* IQKeyboardManagerSwift */,\n\t\t\t\t0C62A8006B186CB47F899BB62E8BDF89 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t9500A2775E8786D82A24E7A7AF32C5E0 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC0FA6DAC4FFD3027DA42EAE16FB5F47D /* CoreGraphics.framework */,\n\t\t\t\tE85534CACDFD728F3C94A3009624954A /* Foundation.framework */,\n\t\t\t\t946A9EDB57AE4614BB8937C72844BFE6 /* QuartzCore.framework */,\n\t\t\t\t0D680AA427A6A61493387E0A6E4E5029 /* UIKit.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tBF14D39036C089F7E1B3F629DA08CE5B /* IQKeyboardManagerSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE03920B0B02D80596B3F67A97082AEF4 /* IQBarButtonItem.swift */,\n\t\t\t\tCEEB8AF5FBFCC6770E99358B4B672112 /* IQInvocation.swift */,\n\t\t\t\t2E8B098F97A55365762D8D2B7FA4E857 /* IQKeyboardManager.swift */,\n\t\t\t\tCFD5ABB7FA590430552E190D99A750AB /* IQKeyboardManager+Debug.swift */,\n\t\t\t\t2353E46FF36871C1A382E58209C2512F /* IQKeyboardManager+Internal.swift */,\n\t\t\t\t1A349561195FB92F21A65DB78F57AB13 /* IQKeyboardManager+OrientationNotification.swift */,\n\t\t\t\t2FCA4FD17F57944E5BEEBA0015885799 /* IQKeyboardManager+Position.swift */,\n\t\t\t\t88BEDD53D2B5D575373CB71E58A8AB12 /* IQKeyboardManager+Toolbar.swift */,\n\t\t\t\tF682DA676AD168D3091C5B133DA42D9F /* IQKeyboardManager+UIKeyboardNotification.swift */,\n\t\t\t\t55CB5D81ABA6E4FBD1CF6B65226B391B /* IQKeyboardManager+UITextFieldViewNotification.swift */,\n\t\t\t\t4A9007D57C0B709E3AEE1DFE50874F32 /* IQKeyboardManagerConstants.swift */,\n\t\t\t\t92C832DB42077D84C205249F9E997905 /* IQKeyboardManagerConstantsInternal.swift */,\n\t\t\t\t0AD77D1185EB62775EE3960141FCE996 /* IQKeyboardReturnKeyHandler.swift */,\n\t\t\t\t661B78E184D4847D2EF59219CC3F5A9B /* IQNSArray+Sort.swift */,\n\t\t\t\t3A1FB9DC92897C5D1421E3C934A93822 /* IQPreviousNextView.swift */,\n\t\t\t\tF0CA644EB9E5EC44C32C872B27BF5496 /* IQTextView.swift */,\n\t\t\t\t99089A30A3E333438B4B2466B97FF114 /* IQTitleBarButtonItem.swift */,\n\t\t\t\t76C2C0372BCB3128DF6CA0C53A9E451A /* IQToolbar.swift */,\n\t\t\t\t10459AAF85BA8BD05D7A6DDBF42B5437 /* IQUIScrollView+Additions.swift */,\n\t\t\t\tB914646B657819A80DE94151ED66AD98 /* IQUITextFieldView+Additions.swift */,\n\t\t\t\t28D576980A1AC7CDCB8A72F07285D564 /* IQUIView+Hierarchy.swift */,\n\t\t\t\t10A6BBAC5E85397B6190ED993912E11F /* IQUIView+IQKeyboardToolbar.swift */,\n\t\t\t\tCA60EFCD6DA12DDF7AE96003860DDC9F /* IQUIViewController+Additions.swift */,\n\t\t\t\tF9B87AFBA515A94071D76CADE8FF7150 /* Support Files */,\n\t\t\t);\n\t\t\tname = IQKeyboardManagerSwift;\n\t\t\tpath = IQKeyboardManagerSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF9B87AFBA515A94071D76CADE8FF7150 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2D7BA32644F54A1127B420AA6F6F2096 /* IQKeyboardManagerSwift.modulemap */,\n\t\t\t\t4B74594226A518BED96E389F0B28C6E3 /* IQKeyboardManagerSwift-dummy.m */,\n\t\t\t\t3A2EA8E6127AE7662760044E338E4C84 /* IQKeyboardManagerSwift-Info.plist */,\n\t\t\t\t9AF38034AC895F027F0F8AB8D608FD3D /* IQKeyboardManagerSwift-prefix.pch */,\n\t\t\t\tACD7538D01886F5C6399954BF036AED7 /* IQKeyboardManagerSwift-umbrella.h */,\n\t\t\t\t4C008775202466506BDDE46A61D8BF41 /* IQKeyboardManagerSwift.debug.xcconfig */,\n\t\t\t\t66191495FD45426E541C9C6A1C138E25 /* IQKeyboardManagerSwift.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/IQKeyboardManagerSwift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t59655A0626809782FAC9937796962C1C /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEB7FB2AB0DD7EE8D7485DE2DA8DD4131 /* IQKeyboardManagerSwift-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t29F73A40F1F145F65BBA049AC76AB585 /* IQKeyboardManagerSwift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 7E4427D52DC0676CBE97AF632BC16C36 /* Build configuration list for PBXNativeTarget \"IQKeyboardManagerSwift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t59655A0626809782FAC9937796962C1C /* Headers */,\n\t\t\t\t142F12A286285C7BC5D9F52175676DBC /* Sources */,\n\t\t\t\tEE9C193F8B9319E1878C2598247EC06D /* Frameworks */,\n\t\t\t\t5CF04424C320B7C8EB6665875DD40074 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = IQKeyboardManagerSwift;\n\t\t\tproductName = IQKeyboardManagerSwift;\n\t\t\tproductReference = 7A053AAF86A5B414C2A43A01BD0934FB /* IQKeyboardManagerSwift */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t620DDB51B2348FFA878131EB4C01AF83 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = B229E972215028783E93F53D1B10FF8F /* Build configuration list for PBXProject \"IQKeyboardManagerSwift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 705E4DC4E9C90DEA5E4C3C6F868F6023;\n\t\t\tproductRefGroup = 0C62A8006B186CB47F899BB62E8BDF89 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t29F73A40F1F145F65BBA049AC76AB585 /* IQKeyboardManagerSwift */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t5CF04424C320B7C8EB6665875DD40074 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t142F12A286285C7BC5D9F52175676DBC /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t37B97479813D5149C1057A437E60E585 /* IQBarButtonItem.swift in Sources */,\n\t\t\t\t617358488245BCAAD55499E9116418FD /* IQInvocation.swift in Sources */,\n\t\t\t\tF7F36074E1C10D486E34F4501E214BF0 /* IQKeyboardManager.swift in Sources */,\n\t\t\t\tC3AB4C7196DF999E30027F5873C91611 /* IQKeyboardManager+Debug.swift in Sources */,\n\t\t\t\t2D3468D1970863E4C141E7648F07DE07 /* IQKeyboardManager+Internal.swift in Sources */,\n\t\t\t\tA2731AD5D558174D7B7FC76367CC65B7 /* IQKeyboardManager+OrientationNotification.swift in Sources */,\n\t\t\t\t8EF2D582CF5564471E18B0A5FB92701D /* IQKeyboardManager+Position.swift in Sources */,\n\t\t\t\t9701F2C0D0EB05C8F878BB29DA410C12 /* IQKeyboardManager+Toolbar.swift in Sources */,\n\t\t\t\t932EA9A4118FCB6C9AD7CB92452A7074 /* IQKeyboardManager+UIKeyboardNotification.swift in Sources */,\n\t\t\t\tF9079CF07AE7C8110F5E5AE403C1F0CD /* IQKeyboardManager+UITextFieldViewNotification.swift in Sources */,\n\t\t\t\t9D06E20FD926D170B925C0B5EE2BDCAD /* IQKeyboardManagerConstants.swift in Sources */,\n\t\t\t\t261F5BD0E587B7A6729F0C70C66D914B /* IQKeyboardManagerConstantsInternal.swift in Sources */,\n\t\t\t\tEBC0A418E7F2FAB2EF764B95A1B3843A /* IQKeyboardManagerSwift-dummy.m in Sources */,\n\t\t\t\tD96A987E1282E35ED8EB60C0E76F439A /* IQKeyboardReturnKeyHandler.swift in Sources */,\n\t\t\t\t40C78E974028D3242DC56B6E1EFA93F0 /* IQNSArray+Sort.swift in Sources */,\n\t\t\t\t379ED1A166A1F1232501538158C3574B /* IQPreviousNextView.swift in Sources */,\n\t\t\t\t47346AB31C29A468EA5D403432B8D3A6 /* IQTextView.swift in Sources */,\n\t\t\t\t8B4DE7CA92B312ABD57FAEC4A236B908 /* IQTitleBarButtonItem.swift in Sources */,\n\t\t\t\t0DC3549480F18768F124FA46A82DF1FA /* IQToolbar.swift in Sources */,\n\t\t\t\t51B4862EAB5231B79D95334697D349A9 /* IQUIScrollView+Additions.swift in Sources */,\n\t\t\t\t66A05923F602C527222EE0C304C2E850 /* IQUITextFieldView+Additions.swift in Sources */,\n\t\t\t\t5E41FE2B5A6ECD2EDE8552238451631D /* IQUIView+Hierarchy.swift in Sources */,\n\t\t\t\t09F78371F70C68C71B694C323479D046 /* IQUIView+IQKeyboardToolbar.swift in Sources */,\n\t\t\t\t2678EF9A64B7AC17B365DE0F0C4FA336 /* IQUIViewController+Additions.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t55BDEF7D4E4129339FE32D2AE727C48D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 66191495FD45426E541C9C6A1C138E25 /* IQKeyboardManagerSwift.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = IQKeyboardManagerSwift;\n\t\t\t\tPRODUCT_NAME = IQKeyboardManagerSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.5;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t62806AFACBEC989EBB15092ACFD3D342 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 4C008775202466506BDDE46A61D8BF41 /* IQKeyboardManagerSwift.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = IQKeyboardManagerSwift;\n\t\t\t\tPRODUCT_NAME = IQKeyboardManagerSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.5;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t9BA584B11DDA731685E34764506D9981 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tF574F7E06A687B8215386CE16451C6D1 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t7E4427D52DC0676CBE97AF632BC16C36 /* Build configuration list for PBXNativeTarget \"IQKeyboardManagerSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t62806AFACBEC989EBB15092ACFD3D342 /* Debug */,\n\t\t\t\t55BDEF7D4E4129339FE32D2AE727C48D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tB229E972215028783E93F53D1B10FF8F /* Build configuration list for PBXProject \"IQKeyboardManagerSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t9BA584B11DDA731685E34764506D9981 /* Debug */,\n\t\t\t\tF574F7E06A687B8215386CE16451C6D1 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 620DDB51B2348FFA878131EB4C01AF83 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2019 Wei Wang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/README.md",
    "content": "<p align=\"center\">\n<img src=\"https://raw.githubusercontent.com/onevcat/Kingfisher/master/images/logo.png\" alt=\"Kingfisher\" title=\"Kingfisher\" width=\"557\"/>\n</p>\n\n<p align=\"center\">\n<a href=\"https://github.com/onevcat/Kingfisher/actions?query=workflow%3Abuild\"><img src=\"https://github.com/onevcat/kingfisher/workflows/build/badge.svg?branch=master\"></a>\n<a href=\"https://kingfisher.onevcat.com/\"><img src=\"https://img.shields.io/badge/Swift-Doc-DE5C43.svg?style=flat\"></a>\n<a href=\"https://cocoapods.org/pods/Kingfisher\"><img src=\"https://img.shields.io/cocoapods/v/Kingfisher.svg?style=flat\"></a>\n<a href=\"https://github.com/Carthage/Carthage/\"><img src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"></a>\n<a href=\"https://swift.org/package-manager/\"><img src=\"https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat\"></a>\n<br />\n<a href=\"https://raw.githubusercontent.com/onevcat/Kingfisher/master/LICENSE\"><img src=\"https://img.shields.io/cocoapods/l/Kingfisher.svg?style=flat\"></a>\n<a href=\"https://kingfisher.onevcat.com/\"><img src=\"https://img.shields.io/cocoapods/p/Kingfisher.svg?style=flat\"></a>\n</p>\n\nKingfisher is a powerful, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift way to work with remote images in your next app.\n\n## Features\n\n- [x] Asynchronous image downloading and caching.\n- [x] Loading image from either `URLSession`-based networking or local provided data.\n- [x] Useful image processors and filters provided.\n- [x] Multiple-layer hybrid cache for both memory and disk.\n- [x] Fine control on cache behavior. Customizable expiration date and size limit.\n- [x] Cancelable downloading and auto-reusing previous downloaded content to improve performance.\n- [x] Independent components. Use the downloader, caching system, and image processors separately as you need.\n- [x] Prefetching images and showing them from the cache to boost your app.\n- [x] View extensions for `UIImageView`, `NSImageView`, `NSButton` and `UIButton` to directly set an image from a URL.\n- [x] Built-in transition animation when setting images.\n- [x] Customizable placeholder and indicator while loading images.\n- [x] Extensible image processing and image format easily.\n- [x] Low Data Mode support.\n- [x] SwiftUI support.\n\n### Kingfisher 101\n\nThe simplest use-case is setting an image to an image view with the `UIImageView` extension:\n\n```swift\nimport Kingfisher\n\nlet url = URL(string: \"https://example.com/image.png\")\nimageView.kf.setImage(with: url)\n```\n\nKingfisher will download the image from `url`, send it to both memory cache and disk cache, and display it in `imageView`. \nWhen you set with the same URL later, the image will be retrieved from the cache and shown immediately.\n\nIt also works if you use SwiftUI:\n\n```swift\nvar body: some View {\n    KFImage(URL(string: \"https://example.com/image.png\")!)\n}\n```\n\n### A More Advanced Example\n\nWith the powerful options, you can do hard tasks with Kingfisher in a simple way. For example, the code below: \n\n1. Downloads a high-resolution image.\n2. Downsamples it to match the image view size.\n3. Makes it round cornered with a given radius.\n4. Shows a system indicator and a placeholder image while downloading.\n5. When prepared, it animates the small thumbnail image with a \"fade in\" effect. \n6. The original large image is also cached to disk for later use, to get rid of downloading it again in a detail view.\n7. A console log is printed when the task finishes, either for success or failure.\n\n```swift\nlet url = URL(string: \"https://example.com/high_resolution_image.png\")\nlet processor = DownsamplingImageProcessor(size: imageView.bounds.size)\n             |> RoundCornerImageProcessor(cornerRadius: 20)\nimageView.kf.indicatorType = .activity\nimageView.kf.setImage(\n    with: url,\n    placeholder: UIImage(named: \"placeholderImage\"),\n    options: [\n        .processor(processor),\n        .scaleFactor(UIScreen.main.scale),\n        .transition(.fade(1)),\n        .cacheOriginalImage\n    ])\n{\n    result in\n    switch result {\n    case .success(let value):\n        print(\"Task done for: \\(value.source.url?.absoluteString ?? \"\")\")\n    case .failure(let error):\n        print(\"Job failed: \\(error.localizedDescription)\")\n    }\n}\n```\n\nIt is a common situation I can meet in my daily work. Think about how many lines you need to write without\nKingfisher!\n\n### Method Chaining\n\nIf you are not a fan of the `kf` extension, you can also prefer to use the `KF` builder and chained the method \ninvocations. The code below is doing the same thing:\n\n```swift\n// Use `kf` extension\nimageView.kf.setImage(\n    with: url,\n    placeholder: placeholderImage,\n    options: [\n        .processor(processor),\n        .loadDiskFileSynchronously,\n        .cacheOriginalImage,\n        .transition(.fade(0.25)),\n        .lowDataMode(.network(lowResolutionURL))\n    ],\n    progressBlock: { receivedSize, totalSize in\n        // Progress updated\n    },\n    completionHandler: { result in\n        // Done\n    }\n)\n\n// Use `KF` builder\nKF.url(url)\n  .placeholder(placeholderImage)\n  .setProcessor(processor)\n  .loadDiskFileSynchronously()\n  .cacheMemoryOnly()\n  .fade(duration: 0.25)\n  .lowDataModeSource(.network(lowResolutionURL))\n  .onProgress { receivedSize, totalSize in  }\n  .onSuccess { result in  }\n  .onFailure { error in }\n  .set(to: imageView)\n```\n\nAnd even better, if later you want to switch to SwiftUI, just make some trivial changes and you've done.\n\n```swift\nstruct ContentView: View {\n    var body: some View {\n        KFImage.url(url)\n          .placeholder(placeholderImage)\n          .setProcessor(processor)\n          .loadDiskFileSynchronously()\n          .cacheMemoryOnly()\n          .fade(duration: 0.25)\n          .lowDataModeSource(.network(lowResolutionURL))\n          .onProgress { receivedSize, totalSize in  }\n          .onSuccess { result in  }\n          .onFailure { error in }\n    }\n}\n```\n\n### Learn More\n\nTo learn the use of Kingfisher by more examples, take a look at the well-prepared [Cheat Sheet](https://github.com/onevcat/Kingfisher/wiki/Cheat-Sheet). T\nhere we summarized the most common tasks in Kingfisher, you can get a better idea of what this framework can do. \nThere are also some performance tips, remember to check them too.\n\n## Requirements\n\n- iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+\n- Swift 4.0+\n\n### Installation\n\nA detailed guide for installation can be found in [Installation Guide](https://github.com/onevcat/Kingfisher/wiki/Installation-Guide).\n\n#### Swift Package Manager\n\n- File > Swift Packages > Add Package Dependency\n- Add `https://github.com/onevcat/Kingfisher.git`\n- Select \"Up to Next Major\" with \"6.0.0\"\n\n#### CocoaPods\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n  pod 'Kingfisher', '~> 6.0'\nend\n```\n\n#### Carthage\n\n```\ngithub \"onevcat/Kingfisher\" ~> 6.0\n```\n\n\n### Migrating\n\n[Kingfisher 6.0 Migration](https://github.com/onevcat/Kingfisher/wiki/Kingfisher-6.0-Migration-Guide) - Kingfisher 6.x is NOT fully compatible with the previous version. However, the migration is not difficult. Depending on your use cases, it may take no effect or several minutes to modify your existing code for the new version. Please follow the [migration guide](https://github.com/onevcat/Kingfisher/wiki/Kingfisher-6.0-Migration-Guide) when you prepare to upgrade Kingfisher in your project.\n\nIf you are using an even earlier version, see the guides below to know the steps for migrating.\n\n> - [Kingfisher 5.0 Migration](https://github.com/onevcat/Kingfisher/wiki/Kingfisher-5.0-Migration-Guide) - If you are upgrading to Kingfisher 5.x from 4.x, please read this for more information.\n> - Kingfisher 4.0 Migration - Kingfisher 3.x should be source compatible to Kingfisher 4. The reason for a major update is that we need to specify the Swift version explicitly for Xcode. All deprecated methods in Kingfisher 3 were removed, so please ensure you have no warning left before you migrate from Kingfisher 3 to Kingfisher 4. If you have any trouble when migrating, please open an issue to discuss.\n> - [Kingfisher 3.0 Migration](https://github.com/onevcat/Kingfisher/wiki/Kingfisher-3.0-Migration-Guide) - If you are upgrading to Kingfisher 3.x from an earlier version, please read this for more information.\n\n## Next Steps\n\nWe prepared a [wiki page](https://github.com/onevcat/Kingfisher/wiki). You can find tons of useful things there.\n\n* [Installation Guide](https://github.com/onevcat/Kingfisher/wiki/Installation-Guide) - Follow it to integrate Kingfisher into your project.\n* [Cheat Sheet](https://github.com/onevcat/Kingfisher/wiki/Cheat-Sheet)- Curious about what Kingfisher could do and how would it look like when used in your project? See this page for useful code snippets. If you are already familiar with Kingfisher, you could also learn new tricks to improve the way you use Kingfisher!\n* [API Reference](https://kingfisher.onevcat.com/) - Lastly, please remember to read the full whenever you may need a more detailed reference.\n\n## Other\n\n### Future of Kingfisher\n\nI want to keep Kingfisher lightweight. This framework focuses on providing a simple solution for downloading and caching images. This doesn’t mean the framework can’t be improved. Kingfisher is far from perfect, so necessary and useful updates will be made to make it better.\n\n### Developments and Tests\n\nAny contributing and pull requests are warmly welcome. However, before you plan to implement some features or try to fix an uncertain issue, it is recommended to open a discussion first. It would be appreciated if your pull requests could build and with all tests green. :)\n\n### About the logo\n\nThe logo of Kingfisher is inspired by [Tangram (七巧板)](http://en.wikipedia.org/wiki/Tangram), a dissection puzzle consisting of seven flat shapes from China. I believe she's a kingfisher bird instead of a swift, but someone insists that she is a pigeon. I guess I should give her a name. Hi, guys, do you have any suggestions?\n\n### Contact\n\nFollow and contact me on [Twitter](http://twitter.com/onevcat) or [Sina Weibo](http://weibo.com/onevcat). If you find an issue, [open a ticket](https://github.com/onevcat/Kingfisher/issues/new). Pull requests are warmly welcome as well.\n\n## Backers & Sponsors\n\nOpen-source projects cannot live long without your help. If you find Kingfisher is useful, please consider supporting this \nproject by becoming a sponsor. Your user icon or company logo shows up [on my blog](https://onevcat.com/tabs/about/) with a link to your home page. \n\nBecome a sponsor through [GitHub Sponsors](https://github.com/sponsors/onevcat) or [Open Collective](https://opencollective.com/kingfisher#sponsor). :heart:\n\n### License\n\nKingfisher is released under the MIT license. See LICENSE for details.\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Cache/CacheSerializer.swift",
    "content": "//\n//  CacheSerializer.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2016/09/02.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport CoreGraphics\n\n/// An `CacheSerializer` is used to convert some data to an image object after\n/// retrieving it from disk storage, and vice versa, to convert an image to data object\n/// for storing to the disk storage.\npublic protocol CacheSerializer {\n    \n    /// Gets the serialized data from a provided image\n    /// and optional original data for caching to disk.\n    ///\n    /// - Parameters:\n    ///   - image: The image needed to be serialized.\n    ///   - original: The original data which is just downloaded.\n    ///               If the image is retrieved from cache instead of\n    ///               downloaded, it will be `nil`.\n    /// - Returns: The data object for storing to disk, or `nil` when no valid\n    ///            data could be serialized.\n    func data(with image: KFCrossPlatformImage, original: Data?) -> Data?\n\n    /// Gets an image from provided serialized data.\n    ///\n    /// - Parameters:\n    ///   - data: The data from which an image should be deserialized.\n    ///   - options: The parsed options for deserialization.\n    /// - Returns: An image deserialized or `nil` when no valid image\n    ///            could be deserialized.\n    func image(with data: Data, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?\n}\n\n/// Represents a basic and default `CacheSerializer` used in Kingfisher disk cache system.\n/// It could serialize and deserialize images in PNG, JPEG and GIF format. For\n/// image other than these formats, a normalized `pngRepresentation` will be used.\npublic struct DefaultCacheSerializer: CacheSerializer {\n    \n    /// The default general cache serializer used across Kingfisher's cache.\n    public static let `default` = DefaultCacheSerializer()\n\n    /// The compression quality when converting image to a lossy format data. Default is 1.0.\n    public var compressionQuality: CGFloat = 1.0\n\n    /// Whether the original data should be preferred when serializing the image.\n    /// If `true`, the input original data will be checked first and used unless the data is `nil`.\n    /// In that case, the serialization will fall back to creating data from image.\n    public var preferCacheOriginalData: Bool = false\n\n    /// Creates a cache serializer that serialize and deserialize images in PNG, JPEG and GIF format.\n    ///\n    /// - Note:\n    /// Use `DefaultCacheSerializer.default` unless you need to specify your own properties.\n    ///\n    public init() { }\n\n    /// - Parameters:\n    ///   - image: The image needed to be serialized.\n    ///   - original: The original data which is just downloaded.\n    ///               If the image is retrieved from cache instead of\n    ///               downloaded, it will be `nil`.\n    /// - Returns: The data object for storing to disk, or `nil` when no valid\n    ///            data could be serialized.\n    ///\n    /// - Note:\n    /// Only when `original` contains valid PNG, JPEG and GIF format data, the `image` will be\n    /// converted to the corresponding data type. Otherwise, if the `original` is provided but it is not\n    /// If `original` is `nil`, the input `image` will be encoded as PNG data.\n    public func data(with image: KFCrossPlatformImage, original: Data?) -> Data? {\n        if preferCacheOriginalData {\n            return original ??\n                image.kf.data(\n                    format: original?.kf.imageFormat ?? .unknown,\n                    compressionQuality: compressionQuality\n                )\n        } else {\n            return image.kf.data(\n                format: original?.kf.imageFormat ?? .unknown,\n                compressionQuality: compressionQuality\n            )\n        }\n    }\n    \n    /// Gets an image deserialized from provided data.\n    ///\n    /// - Parameters:\n    ///   - data: The data from which an image should be deserialized.\n    ///   - options: Options for deserialization.\n    /// - Returns: An image deserialized or `nil` when no valid image\n    ///            could be deserialized.\n    public func image(with data: Data, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        return KingfisherWrapper.image(data: data, options: options.imageCreatingOptions)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Cache/DiskStorage.swift",
    "content": "//\n//  DiskStorage.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/10/15.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n\n/// Represents a set of conception related to storage which stores a certain type of value in disk.\n/// This is a namespace for the disk storage types. A `Backend` with a certain `Config` will be used to describe the\n/// storage. See these composed types for more information.\npublic enum DiskStorage {\n\n    /// Represents a storage back-end for the `DiskStorage`. The value is serialized to data\n    /// and stored as file in the file system under a specified location.\n    ///\n    /// You can config a `DiskStorage.Backend` in its initializer by passing a `DiskStorage.Config` value.\n    /// or modifying the `config` property after it being created. `DiskStorage` will use file's attributes to keep\n    /// track of a file for its expiration or size limitation.\n    public class Backend<T: DataTransformable> {\n        /// The config used for this disk storage.\n        public var config: Config\n\n        // The final storage URL on disk, with `name` and `cachePathBlock` considered.\n        public let directoryURL: URL\n\n        let metaChangingQueue: DispatchQueue\n\n        var maybeCached : Set<String>?\n        let maybeCachedCheckingQueue = DispatchQueue(label: \"com.onevcat.Kingfisher.maybeCachedCheckingQueue\")\n\n        // `false` if the storage initialized with an error. This prevents unexpected forcibly crash when creating\n        // storage in the default cache.\n        private var storageReady: Bool = true\n\n        /// Creates a disk storage with the given `DiskStorage.Config`.\n        ///\n        /// - Parameter config: The config used for this disk storage.\n        /// - Throws: An error if the folder for storage cannot be got or created.\n        public convenience init(config: Config) throws {\n            self.init(noThrowConfig: config, creatingDirectory: false)\n            try prepareDirectory()\n        }\n\n        // If `creatingDirectory` is `false`, the directory preparation will be skipped.\n        // We need to call `prepareDirectory` manually after this returns.\n        init(noThrowConfig config: Config, creatingDirectory: Bool) {\n            var config = config\n\n            let creation = Creation(config)\n            self.directoryURL = creation.directoryURL\n\n            // Break any possible retain cycle set by outside.\n            config.cachePathBlock = nil\n            self.config = config\n\n            metaChangingQueue = DispatchQueue(label: creation.cacheName)\n            setupCacheChecking()\n\n            if creatingDirectory {\n                try? prepareDirectory()\n            }\n        }\n\n        private func setupCacheChecking() {\n            maybeCachedCheckingQueue.async {\n                do {\n                    self.maybeCached = Set()\n                    try self.config.fileManager.contentsOfDirectory(atPath: self.directoryURL.path).forEach { fileName in\n                        self.maybeCached?.insert(fileName)\n                    }\n                } catch {\n                    // Just disable the functionality if we fail to initialize it properly. This will just revert to\n                    // the behavior which is to check file existence on disk directly.\n                    self.maybeCached = nil\n                }\n            }\n        }\n\n        // Creates the storage folder.\n        private func prepareDirectory() throws {\n            let fileManager = config.fileManager\n            let path = directoryURL.path\n\n            guard !fileManager.fileExists(atPath: path) else { return }\n\n            do {\n                try fileManager.createDirectory(\n                    atPath: path,\n                    withIntermediateDirectories: true,\n                    attributes: nil)\n            } catch {\n                self.storageReady = false\n                throw KingfisherError.cacheError(reason: .cannotCreateDirectory(path: path, error: error))\n            }\n        }\n\n        /// Stores a value to the storage under the specified key and expiration policy.\n        /// - Parameters:\n        ///   - value: The value to be stored.\n        ///   - key: The key to which the `value` will be stored. If there is already a value under the key,\n        ///          the old value will be overwritten by `value`.\n        ///   - expiration: The expiration policy used by this store action.\n        /// - Throws: An error during converting the value to a data format or during writing it to disk.\n        public func store(\n            value: T,\n            forKey key: String,\n            expiration: StorageExpiration? = nil) throws\n        {\n            guard storageReady else {\n                throw KingfisherError.cacheError(reason: .diskStorageIsNotReady(cacheURL: directoryURL))\n            }\n\n            let expiration = expiration ?? config.expiration\n            // The expiration indicates that already expired, no need to store.\n            guard !expiration.isExpired else { return }\n            \n            let data: Data\n            do {\n                data = try value.toData()\n            } catch {\n                throw KingfisherError.cacheError(reason: .cannotConvertToData(object: value, error: error))\n            }\n\n            let fileURL = cacheFileURL(forKey: key)\n            do {\n                try data.write(to: fileURL)\n            } catch {\n                throw KingfisherError.cacheError(\n                    reason: .cannotCreateCacheFile(fileURL: fileURL, key: key, data: data, error: error)\n                )\n            }\n\n            let now = Date()\n            let attributes: [FileAttributeKey : Any] = [\n                // The last access date.\n                .creationDate: now.fileAttributeDate,\n                // The estimated expiration date.\n                .modificationDate: expiration.estimatedExpirationSinceNow.fileAttributeDate\n            ]\n            do {\n                try config.fileManager.setAttributes(attributes, ofItemAtPath: fileURL.path)\n            } catch {\n                try? config.fileManager.removeItem(at: fileURL)\n                throw KingfisherError.cacheError(\n                    reason: .cannotSetCacheFileAttribute(\n                        filePath: fileURL.path,\n                        attributes: attributes,\n                        error: error\n                    )\n                )\n            }\n\n            maybeCachedCheckingQueue.async {\n                self.maybeCached?.insert(fileURL.lastPathComponent)\n            }\n        }\n\n        /// Gets a value from the storage.\n        /// - Parameters:\n        ///   - key: The cache key of value.\n        ///   - extendingExpiration: The expiration policy used by this getting action.\n        /// - Throws: An error during converting the data to a value or during operation of disk files.\n        /// - Returns: The value under `key` if it is valid and found in the storage. Otherwise, `nil`.\n        public func value(forKey key: String, extendingExpiration: ExpirationExtending = .cacheTime) throws -> T? {\n            return try value(forKey: key, referenceDate: Date(), actuallyLoad: true, extendingExpiration: extendingExpiration)\n        }\n\n        func value(\n            forKey key: String,\n            referenceDate: Date,\n            actuallyLoad: Bool,\n            extendingExpiration: ExpirationExtending) throws -> T?\n        {\n            guard storageReady else {\n                throw KingfisherError.cacheError(reason: .diskStorageIsNotReady(cacheURL: directoryURL))\n            }\n\n            let fileManager = config.fileManager\n            let fileURL = cacheFileURL(forKey: key)\n            let filePath = fileURL.path\n\n            let fileMaybeCached = maybeCachedCheckingQueue.sync {\n                return maybeCached?.contains(fileURL.lastPathComponent) ?? true\n            }\n            guard fileMaybeCached else {\n                return nil\n            }\n            guard fileManager.fileExists(atPath: filePath) else {\n                return nil\n            }\n\n            let meta: FileMeta\n            do {\n                let resourceKeys: Set<URLResourceKey> = [.contentModificationDateKey, .creationDateKey]\n                meta = try FileMeta(fileURL: fileURL, resourceKeys: resourceKeys)\n            } catch {\n                throw KingfisherError.cacheError(\n                    reason: .invalidURLResource(error: error, key: key, url: fileURL))\n            }\n\n            if meta.expired(referenceDate: referenceDate) {\n                return nil\n            }\n            if !actuallyLoad { return T.empty }\n\n            do {\n                let data = try Data(contentsOf: fileURL)\n                let obj = try T.fromData(data)\n                metaChangingQueue.async {\n                    meta.extendExpiration(with: fileManager, extendingExpiration: extendingExpiration)\n                }\n                return obj\n            } catch {\n                throw KingfisherError.cacheError(reason: .cannotLoadDataFromDisk(url: fileURL, error: error))\n            }\n        }\n\n        /// Whether there is valid cached data under a given key.\n        /// - Parameter key: The cache key of value.\n        /// - Returns: If there is valid data under the key, `true`. Otherwise, `false`.\n        ///\n        /// - Note:\n        /// This method does not actually load the data from disk, so it is faster than directly loading the cached value\n        /// by checking the nullability of `value(forKey:extendingExpiration:)` method.\n        ///\n        public func isCached(forKey key: String) -> Bool {\n            return isCached(forKey: key, referenceDate: Date())\n        }\n\n        /// Whether there is valid cached data under a given key and a reference date.\n        /// - Parameters:\n        ///   - key: The cache key of value.\n        ///   - referenceDate: A reference date to check whether the cache is still valid.\n        /// - Returns: If there is valid data under the key, `true`. Otherwise, `false`.\n        ///\n        /// - Note:\n        /// If you pass `Date()` to `referenceDate`, this method is identical to `isCached(forKey:)`. Use the\n        /// `referenceDate` to determine whether the cache is still valid for a future date.\n        public func isCached(forKey key: String, referenceDate: Date) -> Bool {\n            do {\n                let result = try value(\n                    forKey: key,\n                    referenceDate: referenceDate,\n                    actuallyLoad: false,\n                    extendingExpiration: .none\n                )\n                return result != nil\n            } catch {\n                return false\n            }\n        }\n\n        /// Removes a value from a specified key.\n        /// - Parameter key: The cache key of value.\n        /// - Throws: An error during removing the value.\n        public func remove(forKey key: String) throws {\n            let fileURL = cacheFileURL(forKey: key)\n            try removeFile(at: fileURL)\n        }\n\n        func removeFile(at url: URL) throws {\n            try config.fileManager.removeItem(at: url)\n        }\n\n        /// Removes all values in this storage.\n        /// - Throws: An error during removing the values.\n        public func removeAll() throws {\n            try removeAll(skipCreatingDirectory: false)\n        }\n\n        func removeAll(skipCreatingDirectory: Bool) throws {\n            try config.fileManager.removeItem(at: directoryURL)\n            if !skipCreatingDirectory {\n                try prepareDirectory()\n            }\n        }\n\n        /// The URL of the cached file with a given computed `key`.\n        ///\n        /// - Parameter key: The final computed key used when caching the image. Please note that usually this is not\n        /// the `cacheKey` of an image `Source`. It is the computed key with processor identifier considered.\n        ///\n        /// - Note:\n        /// This method does not guarantee there is an image already cached in the returned URL. It just gives your\n        /// the URL that the image should be if it exists in disk storage, with the give key.\n        ///\n        public func cacheFileURL(forKey key: String) -> URL {\n            let fileName = cacheFileName(forKey: key)\n            return directoryURL.appendingPathComponent(fileName, isDirectory: false)\n        }\n\n        func cacheFileName(forKey key: String) -> String {\n            if config.usesHashedFileName {\n                let hashedKey = key.kf.md5\n                if let ext = config.pathExtension {\n                    return \"\\(hashedKey).\\(ext)\"\n                } else if config.autoExtAfterHashedFileName,\n                          let ext = key.kf.ext {\n                    return \"\\(hashedKey).\\(ext)\"\n                }\n                return hashedKey\n            } else {\n                if let ext = config.pathExtension {\n                    return \"\\(key).\\(ext)\"\n                }\n                return key\n            }\n        }\n\n        func allFileURLs(for propertyKeys: [URLResourceKey]) throws -> [URL] {\n            let fileManager = config.fileManager\n\n            guard let directoryEnumerator = fileManager.enumerator(\n                at: directoryURL, includingPropertiesForKeys: propertyKeys, options: .skipsHiddenFiles) else\n            {\n                throw KingfisherError.cacheError(reason: .fileEnumeratorCreationFailed(url: directoryURL))\n            }\n\n            guard let urls = directoryEnumerator.allObjects as? [URL] else {\n                throw KingfisherError.cacheError(reason: .invalidFileEnumeratorContent(url: directoryURL))\n            }\n            return urls\n        }\n\n        /// Removes all expired values from this storage.\n        /// - Throws: A file manager error during removing the file.\n        /// - Returns: The URLs for removed files.\n        public func removeExpiredValues() throws -> [URL] {\n            return try removeExpiredValues(referenceDate: Date())\n        }\n\n        func removeExpiredValues(referenceDate: Date) throws -> [URL] {\n            let propertyKeys: [URLResourceKey] = [\n                .isDirectoryKey,\n                .contentModificationDateKey\n            ]\n\n            let urls = try allFileURLs(for: propertyKeys)\n            let keys = Set(propertyKeys)\n            let expiredFiles = urls.filter { fileURL in\n                do {\n                    let meta = try FileMeta(fileURL: fileURL, resourceKeys: keys)\n                    if meta.isDirectory {\n                        return false\n                    }\n                    return meta.expired(referenceDate: referenceDate)\n                } catch {\n                    return true\n                }\n            }\n            try expiredFiles.forEach { url in\n                try removeFile(at: url)\n            }\n            return expiredFiles\n        }\n\n        /// Removes all size exceeded values from this storage.\n        /// - Throws: A file manager error during removing the file.\n        /// - Returns: The URLs for removed files.\n        ///\n        /// - Note: This method checks `config.sizeLimit` and remove cached files in an LRU (Least Recently Used) way.\n        func removeSizeExceededValues() throws -> [URL] {\n\n            if config.sizeLimit == 0 { return [] } // Back compatible. 0 means no limit.\n\n            var size = try totalSize()\n            if size < config.sizeLimit { return [] }\n\n            let propertyKeys: [URLResourceKey] = [\n                .isDirectoryKey,\n                .creationDateKey,\n                .fileSizeKey\n            ]\n            let keys = Set(propertyKeys)\n\n            let urls = try allFileURLs(for: propertyKeys)\n            var pendings: [FileMeta] = urls.compactMap { fileURL in\n                guard let meta = try? FileMeta(fileURL: fileURL, resourceKeys: keys) else {\n                    return nil\n                }\n                return meta\n            }\n            // Sort by last access date. Most recent file first.\n            pendings.sort(by: FileMeta.lastAccessDate)\n\n            var removed: [URL] = []\n            let target = config.sizeLimit / 2\n            while size > target, let meta = pendings.popLast() {\n                size -= UInt(meta.fileSize)\n                try removeFile(at: meta.url)\n                removed.append(meta.url)\n            }\n            return removed\n        }\n\n        /// Gets the total file size of the folder in bytes.\n        public func totalSize() throws -> UInt {\n            let propertyKeys: [URLResourceKey] = [.fileSizeKey]\n            let urls = try allFileURLs(for: propertyKeys)\n            let keys = Set(propertyKeys)\n            let totalSize: UInt = urls.reduce(0) { size, fileURL in\n                do {\n                    let meta = try FileMeta(fileURL: fileURL, resourceKeys: keys)\n                    return size + UInt(meta.fileSize)\n                } catch {\n                    return size\n                }\n            }\n            return totalSize\n        }\n    }\n}\n\nextension DiskStorage {\n    /// Represents the config used in a `DiskStorage`.\n    public struct Config {\n\n        /// The file size limit on disk of the storage in bytes. 0 means no limit.\n        public var sizeLimit: UInt\n\n        /// The `StorageExpiration` used in this disk storage. Default is `.days(7)`,\n        /// means that the disk cache would expire in one week.\n        public var expiration: StorageExpiration = .days(7)\n\n        /// The preferred extension of cache item. It will be appended to the file name as its extension.\n        /// Default is `nil`, means that the cache file does not contain a file extension.\n        public var pathExtension: String? = nil\n\n        /// Default is `true`, means that the cache file name will be hashed before storing.\n        public var usesHashedFileName = true\n\n        /// Default is `false`\n        /// If set to `true`, image extension will be extracted from original file name and append to\n        /// the hased file name and used as the cache key on disk.\n        public var autoExtAfterHashedFileName = false\n\n        let name: String\n        let fileManager: FileManager\n        let directory: URL?\n\n        var cachePathBlock: ((_ directory: URL, _ cacheName: String) -> URL)! = {\n            (directory, cacheName) in\n            return directory.appendingPathComponent(cacheName, isDirectory: true)\n        }\n\n        /// Creates a config value based on given parameters.\n        ///\n        /// - Parameters:\n        ///   - name: The name of cache. It is used as a part of storage folder. It is used to identify the disk\n        ///           storage. Two storages with the same `name` would share the same folder in disk, and it should\n        ///           be prevented.\n        ///   - sizeLimit: The size limit in bytes for all existing files in the disk storage.\n        ///   - fileManager: The `FileManager` used to manipulate files on disk. Default is `FileManager.default`.\n        ///   - directory: The URL where the disk storage should live. The storage will use this as the root folder,\n        ///                and append a path which is constructed by input `name`. Default is `nil`, indicates that\n        ///                the cache directory under user domain mask will be used.\n        public init(\n            name: String,\n            sizeLimit: UInt,\n            fileManager: FileManager = .default,\n            directory: URL? = nil)\n        {\n            self.name = name\n            self.fileManager = fileManager\n            self.directory = directory\n            self.sizeLimit = sizeLimit\n        }\n    }\n}\n\nextension DiskStorage {\n    struct FileMeta {\n    \n        let url: URL\n        \n        let lastAccessDate: Date?\n        let estimatedExpirationDate: Date?\n        let isDirectory: Bool\n        let fileSize: Int\n        \n        static func lastAccessDate(lhs: FileMeta, rhs: FileMeta) -> Bool {\n            return lhs.lastAccessDate ?? .distantPast > rhs.lastAccessDate ?? .distantPast\n        }\n        \n        init(fileURL: URL, resourceKeys: Set<URLResourceKey>) throws {\n            let meta = try fileURL.resourceValues(forKeys: resourceKeys)\n            self.init(\n                fileURL: fileURL,\n                lastAccessDate: meta.creationDate,\n                estimatedExpirationDate: meta.contentModificationDate,\n                isDirectory: meta.isDirectory ?? false,\n                fileSize: meta.fileSize ?? 0)\n        }\n        \n        init(\n            fileURL: URL,\n            lastAccessDate: Date?,\n            estimatedExpirationDate: Date?,\n            isDirectory: Bool,\n            fileSize: Int)\n        {\n            self.url = fileURL\n            self.lastAccessDate = lastAccessDate\n            self.estimatedExpirationDate = estimatedExpirationDate\n            self.isDirectory = isDirectory\n            self.fileSize = fileSize\n        }\n\n        func expired(referenceDate: Date) -> Bool {\n            return estimatedExpirationDate?.isPast(referenceDate: referenceDate) ?? true\n        }\n        \n        func extendExpiration(with fileManager: FileManager, extendingExpiration: ExpirationExtending) {\n            guard let lastAccessDate = lastAccessDate,\n                  let lastEstimatedExpiration = estimatedExpirationDate else\n            {\n                return\n            }\n\n            let attributes: [FileAttributeKey : Any]\n\n            switch extendingExpiration {\n            case .none:\n                // not extending expiration time here\n                return\n            case .cacheTime:\n                let originalExpiration: StorageExpiration =\n                    .seconds(lastEstimatedExpiration.timeIntervalSince(lastAccessDate))\n                attributes = [\n                    .creationDate: Date().fileAttributeDate,\n                    .modificationDate: originalExpiration.estimatedExpirationSinceNow.fileAttributeDate\n                ]\n            case .expirationTime(let expirationTime):\n                attributes = [\n                    .creationDate: Date().fileAttributeDate,\n                    .modificationDate: expirationTime.estimatedExpirationSinceNow.fileAttributeDate\n                ]\n            }\n\n            try? fileManager.setAttributes(attributes, ofItemAtPath: url.path)\n        }\n    }\n}\n\nextension DiskStorage {\n    struct Creation {\n        let directoryURL: URL\n        let cacheName: String\n\n        init(_ config: Config) {\n            let url: URL\n            if let directory = config.directory {\n                url = directory\n            } else {\n                url = config.fileManager.urls(for: .cachesDirectory, in: .userDomainMask)[0]\n            }\n\n            cacheName = \"com.onevcat.Kingfisher.ImageCache.\\(config.name)\"\n            directoryURL = config.cachePathBlock(url, cacheName)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Cache/FormatIndicatedCacheSerializer.swift",
    "content": "//\n//  RequestModifier.swift\n//  Kingfisher\n//\n//  Created by Junyu Kuang on 5/28/17.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport CoreGraphics\n\n/// `FormatIndicatedCacheSerializer` lets you indicate an image format for serialized caches.\n///\n/// It could serialize and deserialize PNG, JPEG and GIF images. For\n/// image other than these formats, a normalized `pngRepresentation` will be used.\n///\n/// Example:\n/// ````\n/// let profileImageSize = CGSize(width: 44, height: 44)\n///\n/// // A round corner image.\n/// let imageProcessor = RoundCornerImageProcessor(\n///     cornerRadius: profileImageSize.width / 2, targetSize: profileImageSize)\n///\n/// let optionsInfo: KingfisherOptionsInfo = [\n///     .cacheSerializer(FormatIndicatedCacheSerializer.png), \n///     .processor(imageProcessor)]\n///\n/// A URL pointing to a JPEG image.\n/// let url = URL(string: \"https://example.com/image.jpg\")!\n///\n/// // Image will be always cached as PNG format to preserve alpha channel for round rectangle.\n/// // So when you load it from cache again later, it will be still round cornered.\n/// // Otherwise, the corner part would be filled by white color (since JPEG does not contain an alpha channel).\n/// imageView.kf.setImage(with: url, options: optionsInfo)\n/// ````\npublic struct FormatIndicatedCacheSerializer: CacheSerializer {\n    \n    /// A `FormatIndicatedCacheSerializer` which converts image from and to PNG format. If the image cannot be\n    /// represented by PNG format, it will fallback to its real format which is determined by `original` data.\n    public static let png = FormatIndicatedCacheSerializer(imageFormat: .PNG, jpegCompressionQuality: nil)\n    \n    /// A `FormatIndicatedCacheSerializer` which converts image from and to JPEG format. If the image cannot be\n    /// represented by JPEG format, it will fallback to its real format which is determined by `original` data.\n    /// The compression quality is 1.0 when using this serializer. If you need to set a customized compression quality,\n    /// use `jpeg(compressionQuality:)`.\n    public static let jpeg = FormatIndicatedCacheSerializer(imageFormat: .JPEG, jpegCompressionQuality: 1.0)\n\n    /// A `FormatIndicatedCacheSerializer` which converts image from and to JPEG format with a settable compression\n    /// quality. If the image cannot be represented by JPEG format, it will fallback to its real format which is\n    /// determined by `original` data.\n    /// - Parameter compressionQuality: The compression quality when converting image to JPEG data.\n    public static func jpeg(compressionQuality: CGFloat) -> FormatIndicatedCacheSerializer {\n        return FormatIndicatedCacheSerializer(imageFormat: .JPEG, jpegCompressionQuality: compressionQuality)\n    }\n    \n    /// A `FormatIndicatedCacheSerializer` which converts image from and to GIF format. If the image cannot be\n    /// represented by GIF format, it will fallback to its real format which is determined by `original` data.\n    public static let gif = FormatIndicatedCacheSerializer(imageFormat: .GIF, jpegCompressionQuality: nil)\n    \n    /// The indicated image format.\n    private let imageFormat: ImageFormat\n\n    /// The compression quality used for loss image format (like JPEG).\n    private let jpegCompressionQuality: CGFloat?\n    \n    /// Creates data which represents the given `image` under a format.\n    public func data(with image: KFCrossPlatformImage, original: Data?) -> Data? {\n        \n        func imageData(withFormat imageFormat: ImageFormat) -> Data? {\n            return autoreleasepool { () -> Data? in\n                switch imageFormat {\n                case .PNG: return image.kf.pngRepresentation()\n                case .JPEG: return image.kf.jpegRepresentation(compressionQuality: jpegCompressionQuality ?? 1.0)\n                case .GIF: return image.kf.gifRepresentation()\n                case .unknown: return nil\n                }\n            }\n        }\n        \n        // generate data with indicated image format\n        if let data = imageData(withFormat: imageFormat) {\n            return data\n        }\n        \n        let originalFormat = original?.kf.imageFormat ?? .unknown\n        \n        // generate data with original image's format\n        if originalFormat != imageFormat, let data = imageData(withFormat: originalFormat) {\n            return data\n        }\n        \n        return original ?? image.kf.normalized.kf.pngRepresentation()\n    }\n    \n    /// Same implementation as `DefaultCacheSerializer`.\n    public func image(with data: Data, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        return KingfisherWrapper.image(data: data, options: options.imageCreatingOptions)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Cache/ImageCache.swift",
    "content": "//\n//  ImageCache.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/4/6.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(macOS)\nimport AppKit\n#else\nimport UIKit\n#endif\n\nextension Notification.Name {\n    /// This notification will be sent when the disk cache got cleaned either there are cached files expired or the\n    /// total size exceeding the max allowed size. The manually invoking of `clearDiskCache` method will not trigger\n    /// this notification.\n    ///\n    /// The `object` of this notification is the `ImageCache` object which sends the notification.\n    /// A list of removed hashes (files) could be retrieved by accessing the array under\n    /// `KingfisherDiskCacheCleanedHashKey` key in `userInfo` of the notification object you received.\n    /// By checking the array, you could know the hash codes of files are removed.\n    public static let KingfisherDidCleanDiskCache =\n        Notification.Name(\"com.onevcat.Kingfisher.KingfisherDidCleanDiskCache\")\n}\n\n/// Key for array of cleaned hashes in `userInfo` of `KingfisherDidCleanDiskCacheNotification`.\npublic let KingfisherDiskCacheCleanedHashKey = \"com.onevcat.Kingfisher.cleanedHash\"\n\n/// Cache type of a cached image.\n/// - none: The image is not cached yet when retrieving it.\n/// - memory: The image is cached in memory.\n/// - disk: The image is cached in disk.\npublic enum CacheType {\n    /// The image is not cached yet when retrieving it.\n    case none\n    /// The image is cached in memory.\n    case memory\n    /// The image is cached in disk.\n    case disk\n    \n    /// Whether the cache type represents the image is already cached or not.\n    public var cached: Bool {\n        switch self {\n        case .memory, .disk: return true\n        case .none: return false\n        }\n    }\n}\n\n/// Represents the caching operation result.\npublic struct CacheStoreResult {\n    \n    /// The cache result for memory cache. Caching an image to memory will never fail.\n    public let memoryCacheResult: Result<(), Never>\n    \n    /// The cache result for disk cache. If an error happens during caching operation,\n    /// you can get it from `.failure` case of this `diskCacheResult`.\n    public let diskCacheResult: Result<(), KingfisherError>\n}\n\nextension KFCrossPlatformImage: CacheCostCalculable {\n    /// Cost of an image\n    public var cacheCost: Int { return kf.cost }\n}\n\nextension Data: DataTransformable {\n    public func toData() throws -> Data {\n        return self\n    }\n\n    public static func fromData(_ data: Data) throws -> Data {\n        return data\n    }\n\n    public static let empty = Data()\n}\n\n\n/// Represents the getting image operation from the cache.\n///\n/// - disk: The image can be retrieved from disk cache.\n/// - memory: The image can be retrieved memory cache.\n/// - none: The image does not exist in the cache.\npublic enum ImageCacheResult {\n    \n    /// The image can be retrieved from disk cache.\n    case disk(KFCrossPlatformImage)\n    \n    /// The image can be retrieved memory cache.\n    case memory(KFCrossPlatformImage)\n    \n    /// The image does not exist in the cache.\n    case none\n    \n    /// Extracts the image from cache result. It returns the associated `Image` value for\n    /// `.disk` and `.memory` case. For `.none` case, `nil` is returned.\n    public var image: KFCrossPlatformImage? {\n        switch self {\n        case .disk(let image): return image\n        case .memory(let image): return image\n        case .none: return nil\n        }\n    }\n    \n    /// Returns the corresponding `CacheType` value based on the result type of `self`.\n    public var cacheType: CacheType {\n        switch self {\n        case .disk: return .disk\n        case .memory: return .memory\n        case .none: return .none\n        }\n    }\n}\n\n/// Represents a hybrid caching system which is composed by a `MemoryStorage.Backend` and a `DiskStorage.Backend`.\n/// `ImageCache` is a high level abstract for storing an image as well as its data to disk memory and disk, and\n/// retrieving them back.\n///\n/// While a default image cache object will be used if you prefer the extension methods of Kingfisher, you can create\n/// your own cache object and configure its storages as your need. This class also provide an interface for you to set\n/// the memory and disk storage config.\nopen class ImageCache {\n\n    // MARK: Singleton\n    /// The default `ImageCache` object. Kingfisher will use this cache for its related methods if there is no\n    /// other cache specified. The `name` of this default cache is \"default\", and you should not use this name\n    /// for any of your customize cache.\n    public static let `default` = ImageCache(name: \"default\")\n\n\n    // MARK: Public Properties\n    /// The `MemoryStorage.Backend` object used in this cache. This storage holds loaded images in memory with a\n    /// reasonable expire duration and a maximum memory usage. To modify the configuration of a storage, just set\n    /// the storage `config` and its properties.\n    public let memoryStorage: MemoryStorage.Backend<KFCrossPlatformImage>\n    \n    /// The `DiskStorage.Backend` object used in this cache. This storage stores loaded images in disk with a\n    /// reasonable expire duration and a maximum disk usage. To modify the configuration of a storage, just set\n    /// the storage `config` and its properties.\n    public let diskStorage: DiskStorage.Backend<Data>\n    \n    private let ioQueue: DispatchQueue\n    \n    /// Closure that defines the disk cache path from a given path and cacheName.\n    public typealias DiskCachePathClosure = (URL, String) -> URL\n\n    // MARK: Initializers\n\n    /// Creates an `ImageCache` from a customized `MemoryStorage` and `DiskStorage`.\n    ///\n    /// - Parameters:\n    ///   - memoryStorage: The `MemoryStorage.Backend` object to use in the image cache.\n    ///   - diskStorage: The `DiskStorage.Backend` object to use in the image cache.\n    public init(\n        memoryStorage: MemoryStorage.Backend<KFCrossPlatformImage>,\n        diskStorage: DiskStorage.Backend<Data>)\n    {\n        self.memoryStorage = memoryStorage\n        self.diskStorage = diskStorage\n        let ioQueueName = \"com.onevcat.Kingfisher.ImageCache.ioQueue.\\(UUID().uuidString)\"\n        ioQueue = DispatchQueue(label: ioQueueName)\n\n        let notifications: [(Notification.Name, Selector)]\n        #if !os(macOS) && !os(watchOS)\n        notifications = [\n            (UIApplication.didReceiveMemoryWarningNotification, #selector(clearMemoryCache)),\n            (UIApplication.willTerminateNotification, #selector(cleanExpiredDiskCache)),\n            (UIApplication.didEnterBackgroundNotification, #selector(backgroundCleanExpiredDiskCache))\n        ]\n        #elseif os(macOS)\n        notifications = [\n            (NSApplication.willResignActiveNotification, #selector(cleanExpiredDiskCache)),\n        ]\n        #else\n        notifications = []\n        #endif\n        notifications.forEach {\n            NotificationCenter.default.addObserver(self, selector: $0.1, name: $0.0, object: nil)\n        }\n    }\n    \n    /// Creates an `ImageCache` with a given `name`. Both `MemoryStorage` and `DiskStorage` will be created\n    /// with a default config based on the `name`.\n    ///\n    /// - Parameter name: The name of cache object. It is used to setup disk cache directories and IO queue.\n    ///                   You should not use the same `name` for different caches, otherwise, the disk storage would\n    ///                   be conflicting to each other. The `name` should not be an empty string.\n    public convenience init(name: String) {\n        self.init(noThrowName: name, cacheDirectoryURL: nil, diskCachePathClosure: nil)\n    }\n\n    /// Creates an `ImageCache` with a given `name`, cache directory `path`\n    /// and a closure to modify the cache directory.\n    ///\n    /// - Parameters:\n    ///   - name: The name of cache object. It is used to setup disk cache directories and IO queue.\n    ///           You should not use the same `name` for different caches, otherwise, the disk storage would\n    ///           be conflicting to each other.\n    ///   - cacheDirectoryURL: Location of cache directory URL on disk. It will be internally pass to the\n    ///                        initializer of `DiskStorage` as the disk cache directory. If `nil`, the cache\n    ///                        directory under user domain mask will be used.\n    ///   - diskCachePathClosure: Closure that takes in an optional initial path string and generates\n    ///                           the final disk cache path. You could use it to fully customize your cache path.\n    /// - Throws: An error that happens during image cache creating, such as unable to create a directory at the given\n    ///           path.\n    public convenience init(\n        name: String,\n        cacheDirectoryURL: URL?,\n        diskCachePathClosure: DiskCachePathClosure? = nil\n    ) throws\n    {\n        if name.isEmpty {\n            fatalError(\"[Kingfisher] You should specify a name for the cache. A cache with empty name is not permitted.\")\n        }\n\n        let memoryStorage = ImageCache.createMemoryStorage()\n\n        let config = ImageCache.createConfig(\n            name: name, cacheDirectoryURL: cacheDirectoryURL, diskCachePathClosure: diskCachePathClosure\n        )\n        let diskStorage = try DiskStorage.Backend<Data>(config: config)\n        self.init(memoryStorage: memoryStorage, diskStorage: diskStorage)\n    }\n\n    convenience init(\n        noThrowName name: String,\n        cacheDirectoryURL: URL?,\n        diskCachePathClosure: DiskCachePathClosure?\n    )\n    {\n        if name.isEmpty {\n            fatalError(\"[Kingfisher] You should specify a name for the cache. A cache with empty name is not permitted.\")\n        }\n\n        let memoryStorage = ImageCache.createMemoryStorage()\n\n        let config = ImageCache.createConfig(\n            name: name, cacheDirectoryURL: cacheDirectoryURL, diskCachePathClosure: diskCachePathClosure\n        )\n        let diskStorage = DiskStorage.Backend<Data>(noThrowConfig: config, creatingDirectory: true)\n        self.init(memoryStorage: memoryStorage, diskStorage: diskStorage)\n    }\n\n    private static func createMemoryStorage() -> MemoryStorage.Backend<KFCrossPlatformImage> {\n        let totalMemory = ProcessInfo.processInfo.physicalMemory\n        let costLimit = totalMemory / 4\n        let memoryStorage = MemoryStorage.Backend<KFCrossPlatformImage>(config:\n            .init(totalCostLimit: (costLimit > Int.max) ? Int.max : Int(costLimit)))\n        return memoryStorage\n    }\n\n    private static func createConfig(\n        name: String,\n        cacheDirectoryURL: URL?,\n        diskCachePathClosure: DiskCachePathClosure? = nil\n    ) -> DiskStorage.Config\n    {\n        var diskConfig = DiskStorage.Config(\n            name: name,\n            sizeLimit: 0,\n            directory: cacheDirectoryURL\n        )\n        if let closure = diskCachePathClosure {\n            diskConfig.cachePathBlock = closure\n        }\n        return diskConfig\n    }\n    \n    deinit {\n        NotificationCenter.default.removeObserver(self)\n    }\n\n    // MARK: Storing Images\n\n    open func store(_ image: KFCrossPlatformImage,\n                    original: Data? = nil,\n                    forKey key: String,\n                    options: KingfisherParsedOptionsInfo,\n                    toDisk: Bool = true,\n                    completionHandler: ((CacheStoreResult) -> Void)? = nil)\n    {\n        let identifier = options.processor.identifier\n        let callbackQueue = options.callbackQueue\n        \n        let computedKey = key.computedKey(with: identifier)\n        // Memory storage should not throw.\n        memoryStorage.storeNoThrow(value: image, forKey: computedKey, expiration: options.memoryCacheExpiration)\n        \n        guard toDisk else {\n            if let completionHandler = completionHandler {\n                let result = CacheStoreResult(memoryCacheResult: .success(()), diskCacheResult: .success(()))\n                callbackQueue.execute { completionHandler(result) }\n            }\n            return\n        }\n        \n        ioQueue.async {\n            let serializer = options.cacheSerializer\n            if let data = serializer.data(with: image, original: original) {\n                self.syncStoreToDisk(\n                    data,\n                    forKey: key,\n                    processorIdentifier: identifier,\n                    callbackQueue: callbackQueue,\n                    expiration: options.diskCacheExpiration,\n                    completionHandler: completionHandler)\n            } else {\n                guard let completionHandler = completionHandler else { return }\n                \n                let diskError = KingfisherError.cacheError(\n                    reason: .cannotSerializeImage(image: image, original: original, serializer: serializer))\n                let result = CacheStoreResult(\n                    memoryCacheResult: .success(()),\n                    diskCacheResult: .failure(diskError))\n                callbackQueue.execute { completionHandler(result) }\n            }\n        }\n    }\n\n    /// Stores an image to the cache.\n    ///\n    /// - Parameters:\n    ///   - image: The image to be stored.\n    ///   - original: The original data of the image. This value will be forwarded to the provided `serializer` for\n    ///               further use. By default, Kingfisher uses a `DefaultCacheSerializer` to serialize the image to\n    ///               data for caching in disk, it checks the image format based on `original` data to determine in\n    ///               which image format should be used. For other types of `serializer`, it depends on their\n    ///               implementation detail on how to use this original data.\n    ///   - key: The key used for caching the image.\n    ///   - identifier: The identifier of processor being used for caching. If you are using a processor for the\n    ///                 image, pass the identifier of processor to this parameter.\n    ///   - serializer: The `CacheSerializer`\n    ///   - toDisk: Whether this image should be cached to disk or not. If `false`, the image is only cached in memory.\n    ///             Otherwise, it is cached in both memory storage and disk storage. Default is `true`.\n    ///   - callbackQueue: The callback queue on which `completionHandler` is invoked. Default is `.untouch`. For case\n    ///                    that `toDisk` is `false`, a `.untouch` queue means `callbackQueue` will be invoked from the\n    ///                    caller queue of this method. If `toDisk` is `true`, the `completionHandler` will be called\n    ///                    from an internal file IO queue. To change this behavior, specify another `CallbackQueue`\n    ///                    value.\n    ///   - completionHandler: A closure which is invoked when the cache operation finishes.\n    open func store(_ image: KFCrossPlatformImage,\n                      original: Data? = nil,\n                      forKey key: String,\n                      processorIdentifier identifier: String = \"\",\n                      cacheSerializer serializer: CacheSerializer = DefaultCacheSerializer.default,\n                      toDisk: Bool = true,\n                      callbackQueue: CallbackQueue = .untouch,\n                      completionHandler: ((CacheStoreResult) -> Void)? = nil)\n    {\n        struct TempProcessor: ImageProcessor {\n            let identifier: String\n            func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n                return nil\n            }\n        }\n        \n        let options = KingfisherParsedOptionsInfo([\n            .processor(TempProcessor(identifier: identifier)),\n            .cacheSerializer(serializer),\n            .callbackQueue(callbackQueue)\n        ])\n        store(image, original: original, forKey: key, options: options,\n              toDisk: toDisk, completionHandler: completionHandler)\n    }\n    \n    open func storeToDisk(\n        _ data: Data,\n        forKey key: String,\n        processorIdentifier identifier: String = \"\",\n        expiration: StorageExpiration? = nil,\n        callbackQueue: CallbackQueue = .untouch,\n        completionHandler: ((CacheStoreResult) -> Void)? = nil)\n    {\n        ioQueue.async {\n            self.syncStoreToDisk(\n                data,\n                forKey: key,\n                processorIdentifier: identifier,\n                callbackQueue: callbackQueue,\n                expiration: expiration,\n                completionHandler: completionHandler)\n        }\n    }\n    \n    private func syncStoreToDisk(\n        _ data: Data,\n        forKey key: String,\n        processorIdentifier identifier: String = \"\",\n        callbackQueue: CallbackQueue = .untouch,\n        expiration: StorageExpiration? = nil,\n        completionHandler: ((CacheStoreResult) -> Void)? = nil)\n    {\n        let computedKey = key.computedKey(with: identifier)\n        let result: CacheStoreResult\n        do {\n            try self.diskStorage.store(value: data, forKey: computedKey, expiration: expiration)\n            result = CacheStoreResult(memoryCacheResult: .success(()), diskCacheResult: .success(()))\n        } catch {\n            let diskError: KingfisherError\n            if let error = error as? KingfisherError {\n                diskError = error\n            } else {\n                diskError = .cacheError(reason: .cannotConvertToData(object: data, error: error))\n            }\n            \n            result = CacheStoreResult(\n                memoryCacheResult: .success(()),\n                diskCacheResult: .failure(diskError)\n            )\n        }\n        if let completionHandler = completionHandler {\n            callbackQueue.execute { completionHandler(result) }\n        }\n    }\n\n    // MARK: Removing Images\n\n    /// Removes the image for the given key from the cache.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - identifier: The identifier of processor being used for caching. If you are using a processor for the\n    ///                 image, pass the identifier of processor to this parameter.\n    ///   - fromMemory: Whether this image should be removed from memory storage or not.\n    ///                 If `false`, the image won't be removed from the memory storage. Default is `true`.\n    ///   - fromDisk: Whether this image should be removed from disk storage or not.\n    ///               If `false`, the image won't be removed from the disk storage. Default is `true`.\n    ///   - callbackQueue: The callback queue on which `completionHandler` is invoked. Default is `.untouch`.\n    ///   - completionHandler: A closure which is invoked when the cache removing operation finishes.\n    open func removeImage(forKey key: String,\n                          processorIdentifier identifier: String = \"\",\n                          fromMemory: Bool = true,\n                          fromDisk: Bool = true,\n                          callbackQueue: CallbackQueue = .untouch,\n                          completionHandler: (() -> Void)? = nil)\n    {\n        let computedKey = key.computedKey(with: identifier)\n\n        if fromMemory {\n            memoryStorage.remove(forKey: computedKey)\n        }\n        \n        if fromDisk {\n            ioQueue.async{\n                try? self.diskStorage.remove(forKey: computedKey)\n                if let completionHandler = completionHandler {\n                    callbackQueue.execute { completionHandler() }\n                }\n            }\n        } else {\n            if let completionHandler = completionHandler {\n                callbackQueue.execute { completionHandler() }\n            }\n        }\n    }\n\n    func retrieveImage(forKey key: String,\n                       options: KingfisherParsedOptionsInfo,\n                       callbackQueue: CallbackQueue = .mainCurrentOrAsync,\n                       completionHandler: ((Result<ImageCacheResult, KingfisherError>) -> Void)?)\n    {\n        // No completion handler. No need to start working and early return.\n        guard let completionHandler = completionHandler else { return }\n\n        // Try to check the image from memory cache first.\n        if let image = retrieveImageInMemoryCache(forKey: key, options: options) {\n            callbackQueue.execute { completionHandler(.success(.memory(image))) }\n        } else if options.fromMemoryCacheOrRefresh {\n            callbackQueue.execute { completionHandler(.success(.none)) }\n        } else {\n\n            // Begin to disk search.\n            self.retrieveImageInDiskCache(forKey: key, options: options, callbackQueue: callbackQueue) {\n                result in\n                switch result {\n                case .success(let image):\n\n                    guard let image = image else {\n                        // No image found in disk storage.\n                        callbackQueue.execute { completionHandler(.success(.none)) }\n                        return\n                    }\n\n                    // Cache the disk image to memory.\n                    // We are passing `false` to `toDisk`, the memory cache does not change\n                    // callback queue, we can call `completionHandler` without another dispatch.\n                    var cacheOptions = options\n                    cacheOptions.callbackQueue = .untouch\n                    self.store(\n                        image,\n                        forKey: key,\n                        options: cacheOptions,\n                        toDisk: false)\n                    {\n                        _ in\n                        callbackQueue.execute { completionHandler(.success(.disk(image))) }\n                    }\n                case .failure(let error):\n                    callbackQueue.execute { completionHandler(.failure(error)) }\n                }\n            }\n        }\n    }\n\n    // MARK: Getting Images\n\n    /// Gets an image for a given key from the cache, either from memory storage or disk storage.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - options: The `KingfisherOptionsInfo` options setting used for retrieving the image.\n    ///   - callbackQueue: The callback queue on which `completionHandler` is invoked. Default is `.mainCurrentOrAsync`.\n    ///   - completionHandler: A closure which is invoked when the image getting operation finishes. If the\n    ///                        image retrieving operation finishes without problem, an `ImageCacheResult` value\n    ///                        will be sent to this closure as result. Otherwise, a `KingfisherError` result\n    ///                        with detail failing reason will be sent.\n    open func retrieveImage(forKey key: String,\n                               options: KingfisherOptionsInfo? = nil,\n                        callbackQueue: CallbackQueue = .mainCurrentOrAsync,\n                     completionHandler: ((Result<ImageCacheResult, KingfisherError>) -> Void)?)\n    {\n        retrieveImage(\n            forKey: key,\n            options: KingfisherParsedOptionsInfo(options),\n            callbackQueue: callbackQueue,\n            completionHandler: completionHandler)\n    }\n\n    func retrieveImageInMemoryCache(\n        forKey key: String,\n        options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?\n    {\n        let computedKey = key.computedKey(with: options.processor.identifier)\n        return memoryStorage.value(forKey: computedKey, extendingExpiration: options.memoryCacheAccessExtendingExpiration)\n    }\n\n    /// Gets an image for a given key from the memory storage.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - options: The `KingfisherOptionsInfo` options setting used for retrieving the image.\n    /// - Returns: The image stored in memory cache, if exists and valid. Otherwise, if the image does not exist or\n    ///            has already expired, `nil` is returned.\n    open func retrieveImageInMemoryCache(\n        forKey key: String,\n        options: KingfisherOptionsInfo? = nil) -> KFCrossPlatformImage?\n    {\n        return retrieveImageInMemoryCache(forKey: key, options: KingfisherParsedOptionsInfo(options))\n    }\n\n    func retrieveImageInDiskCache(\n        forKey key: String,\n        options: KingfisherParsedOptionsInfo,\n        callbackQueue: CallbackQueue = .untouch,\n        completionHandler: @escaping (Result<KFCrossPlatformImage?, KingfisherError>) -> Void)\n    {\n        let computedKey = key.computedKey(with: options.processor.identifier)\n        let loadingQueue: CallbackQueue = options.loadDiskFileSynchronously ? .untouch : .dispatch(ioQueue)\n        loadingQueue.execute {\n            do {\n                var image: KFCrossPlatformImage? = nil\n                if let data = try self.diskStorage.value(forKey: computedKey, extendingExpiration: options.diskCacheAccessExtendingExpiration) {\n                    image = options.cacheSerializer.image(with: data, options: options)\n                }\n                callbackQueue.execute { completionHandler(.success(image)) }\n            } catch {\n                if let error = error as? KingfisherError {\n                    callbackQueue.execute { completionHandler(.failure(error)) }\n                } else {\n                    assertionFailure(\"The internal thrown error should be a `KingfisherError`.\")\n                }\n            }\n        }\n    }\n    \n    /// Gets an image for a given key from the disk storage.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - options: The `KingfisherOptionsInfo` options setting used for retrieving the image.\n    ///   - callbackQueue: The callback queue on which `completionHandler` is invoked. Default is `.untouch`.\n    ///   - completionHandler: A closure which is invoked when the operation finishes.\n    open func retrieveImageInDiskCache(\n        forKey key: String,\n        options: KingfisherOptionsInfo? = nil,\n        callbackQueue: CallbackQueue = .untouch,\n        completionHandler: @escaping (Result<KFCrossPlatformImage?, KingfisherError>) -> Void)\n    {\n        retrieveImageInDiskCache(\n            forKey: key,\n            options: KingfisherParsedOptionsInfo(options),\n            callbackQueue: callbackQueue,\n            completionHandler: completionHandler)\n    }\n\n    // MARK: Cleaning\n    /// Clears the memory & disk storage of this cache. This is an async operation.\n    ///\n    /// - Parameter handler: A closure which is invoked when the cache clearing operation finishes.\n    ///                      This `handler` will be called from the main queue.\n    public func clearCache(completion handler: (() -> Void)? = nil) {\n        clearMemoryCache()\n        clearDiskCache(completion: handler)\n    }\n    \n    /// Clears the memory storage of this cache.\n    @objc public func clearMemoryCache() {\n        memoryStorage.removeAll()\n    }\n    \n    /// Clears the disk storage of this cache. This is an async operation.\n    ///\n    /// - Parameter handler: A closure which is invoked when the cache clearing operation finishes.\n    ///                      This `handler` will be called from the main queue.\n    open func clearDiskCache(completion handler: (() -> Void)? = nil) {\n        ioQueue.async {\n            do {\n                try self.diskStorage.removeAll()\n            } catch _ { }\n            if let handler = handler {\n                DispatchQueue.main.async { handler() }\n            }\n        }\n    }\n    \n    /// Clears the expired images from memory & disk storage. This is an async operation.\n    open func cleanExpiredCache(completion handler: (() -> Void)? = nil) {\n        cleanExpiredMemoryCache()\n        cleanExpiredDiskCache(completion: handler)\n    }\n\n    /// Clears the expired images from disk storage.\n    open func cleanExpiredMemoryCache() {\n        memoryStorage.removeExpired()\n    }\n    \n    /// Clears the expired images from disk storage. This is an async operation.\n    @objc func cleanExpiredDiskCache() {\n        cleanExpiredDiskCache(completion: nil)\n    }\n\n    /// Clears the expired images from disk storage. This is an async operation.\n    ///\n    /// - Parameter handler: A closure which is invoked when the cache clearing operation finishes.\n    ///                      This `handler` will be called from the main queue.\n    open func cleanExpiredDiskCache(completion handler: (() -> Void)? = nil) {\n        ioQueue.async {\n            do {\n                var removed: [URL] = []\n                let removedExpired = try self.diskStorage.removeExpiredValues()\n                removed.append(contentsOf: removedExpired)\n\n                let removedSizeExceeded = try self.diskStorage.removeSizeExceededValues()\n                removed.append(contentsOf: removedSizeExceeded)\n\n                if !removed.isEmpty {\n                    DispatchQueue.main.async {\n                        let cleanedHashes = removed.map { $0.lastPathComponent }\n                        NotificationCenter.default.post(\n                            name: .KingfisherDidCleanDiskCache,\n                            object: self,\n                            userInfo: [KingfisherDiskCacheCleanedHashKey: cleanedHashes])\n                    }\n                }\n\n                if let handler = handler {\n                    DispatchQueue.main.async { handler() }\n                }\n            } catch {}\n        }\n    }\n\n#if !os(macOS) && !os(watchOS)\n    /// Clears the expired images from disk storage when app is in background. This is an async operation.\n    /// In most cases, you should not call this method explicitly.\n    /// It will be called automatically when `UIApplicationDidEnterBackgroundNotification` received.\n    @objc public func backgroundCleanExpiredDiskCache() {\n        // if 'sharedApplication()' is unavailable, then return\n        guard let sharedApplication = KingfisherWrapper<UIApplication>.shared else { return }\n\n        func endBackgroundTask(_ task: inout UIBackgroundTaskIdentifier) {\n            sharedApplication.endBackgroundTask(task)\n            task = UIBackgroundTaskIdentifier.invalid\n        }\n        \n        var backgroundTask: UIBackgroundTaskIdentifier!\n        backgroundTask = sharedApplication.beginBackgroundTask {\n            endBackgroundTask(&backgroundTask!)\n        }\n        \n        cleanExpiredDiskCache {\n            endBackgroundTask(&backgroundTask!)\n        }\n    }\n#endif\n\n    // MARK: Image Cache State\n\n    /// Returns the cache type for a given `key` and `identifier` combination.\n    /// This method is used for checking whether an image is cached in current cache.\n    /// It also provides information on which kind of cache can it be found in the return value.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - identifier: Processor identifier which used for this image. Default is the `identifier` of\n    ///                 `DefaultImageProcessor.default`.\n    /// - Returns: A `CacheType` instance which indicates the cache status.\n    ///            `.none` means the image is not in cache or it is already expired.\n    open func imageCachedType(\n        forKey key: String,\n        processorIdentifier identifier: String = DefaultImageProcessor.default.identifier) -> CacheType\n    {\n        let computedKey = key.computedKey(with: identifier)\n        if memoryStorage.isCached(forKey: computedKey) { return .memory }\n        if diskStorage.isCached(forKey: computedKey) { return .disk }\n        return .none\n    }\n    \n    /// Returns whether the file exists in cache for a given `key` and `identifier` combination.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - identifier: Processor identifier which used for this image. Default is the `identifier` of\n    ///                 `DefaultImageProcessor.default`.\n    /// - Returns: A `Bool` which indicates whether a cache could match the given `key` and `identifier` combination.\n    ///\n    /// - Note:\n    /// The return value does not contain information about from which kind of storage the cache matches.\n    /// To get the information about cache type according `CacheType`,\n    /// use `imageCachedType(forKey:processorIdentifier:)` instead.\n    public func isCached(\n        forKey key: String,\n        processorIdentifier identifier: String = DefaultImageProcessor.default.identifier) -> Bool\n    {\n        return imageCachedType(forKey: key, processorIdentifier: identifier).cached\n    }\n    \n    /// Gets the hash used as cache file name for the key.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - identifier: Processor identifier which used for this image. Default is the `identifier` of\n    ///                 `DefaultImageProcessor.default`.\n    /// - Returns: The hash which is used as the cache file name.\n    ///\n    /// - Note:\n    /// By default, for a given combination of `key` and `identifier`, `ImageCache` will use the value\n    /// returned by this method as the cache file name. You can use this value to check and match cache file\n    /// if you need.\n    open func hash(\n        forKey key: String,\n        processorIdentifier identifier: String = DefaultImageProcessor.default.identifier) -> String\n    {\n        let computedKey = key.computedKey(with: identifier)\n        return diskStorage.cacheFileName(forKey: computedKey)\n    }\n    \n    /// Calculates the size taken by the disk storage.\n    /// It is the total file size of all cached files in the `diskStorage` on disk in bytes.\n    ///\n    /// - Parameter handler: Called with the size calculating finishes. This closure is invoked from the main queue.\n    open func calculateDiskStorageSize(completion handler: @escaping ((Result<UInt, KingfisherError>) -> Void)) {\n        ioQueue.async {\n            do {\n                let size = try self.diskStorage.totalSize()\n                DispatchQueue.main.async { handler(.success(size)) }\n            } catch {\n                if let error = error as? KingfisherError {\n                    DispatchQueue.main.async { handler(.failure(error)) }\n                } else {\n                    assertionFailure(\"The internal thrown error should be a `KingfisherError`.\")\n                }\n                \n            }\n        }\n    }\n    \n    /// Gets the cache path for the key.\n    /// It is useful for projects with web view or anyone that needs access to the local file path.\n    ///\n    /// i.e. Replacing the `<img src='path_for_key'>` tag in your HTML.\n    ///\n    /// - Parameters:\n    ///   - key: The key used for caching the image.\n    ///   - identifier: Processor identifier which used for this image. Default is the `identifier` of\n    ///                 `DefaultImageProcessor.default`.\n    /// - Returns: The disk path of cached image under the given `key` and `identifier`.\n    ///\n    /// - Note:\n    /// This method does not guarantee there is an image already cached in the returned path. It just gives your\n    /// the path that the image should be, if it exists in disk storage.\n    ///\n    /// You could use `isCached(forKey:)` method to check whether the image is cached under that key in disk.\n    open func cachePath(\n        forKey key: String,\n        processorIdentifier identifier: String = DefaultImageProcessor.default.identifier) -> String\n    {\n        let computedKey = key.computedKey(with: identifier)\n        return diskStorage.cacheFileURL(forKey: computedKey).path\n    }\n}\n\nextension Dictionary {\n    func keysSortedByValue(_ isOrderedBefore: (Value, Value) -> Bool) -> [Key] {\n        return Array(self).sorted{ isOrderedBefore($0.1, $1.1) }.map{ $0.0 }\n    }\n}\n\n#if !os(macOS) && !os(watchOS)\n// MARK: - For App Extensions\nextension UIApplication: KingfisherCompatible { }\nextension KingfisherWrapper where Base: UIApplication {\n    public static var shared: UIApplication? {\n        let selector = NSSelectorFromString(\"sharedApplication\")\n        guard Base.responds(to: selector) else { return nil }\n        return Base.perform(selector).takeUnretainedValue() as? UIApplication\n    }\n}\n#endif\n\nextension String {\n    func computedKey(with identifier: String) -> String {\n        if identifier.isEmpty {\n            return self\n        } else {\n            return appending(\"@\\(identifier)\")\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Cache/MemoryStorage.swift",
    "content": "//\n//  MemoryStorage.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/10/15.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents a set of conception related to storage which stores a certain type of value in memory.\n/// This is a namespace for the memory storage types. A `Backend` with a certain `Config` will be used to describe the\n/// storage. See these composed types for more information.\npublic enum MemoryStorage {\n\n    /// Represents a storage which stores a certain type of value in memory. It provides fast access,\n    /// but limited storing size. The stored value type needs to conform to `CacheCostCalculable`,\n    /// and its `cacheCost` will be used to determine the cost of size for the cache item.\n    ///\n    /// You can config a `MemoryStorage.Backend` in its initializer by passing a `MemoryStorage.Config` value.\n    /// or modifying the `config` property after it being created. The backend of `MemoryStorage` has\n    /// upper limitation on cost size in memory and item count. All items in the storage has an expiration\n    /// date. When retrieved, if the target item is already expired, it will be recognized as it does not\n    /// exist in the storage. The `MemoryStorage` also contains a scheduled self clean task, to evict expired\n    /// items from memory.\n    public class Backend<T: CacheCostCalculable> {\n        let storage = NSCache<NSString, StorageObject<T>>()\n\n        // Keys trackes the objects once inside the storage. For object removing triggered by user, the corresponding\n        // key would be also removed. However, for the object removing triggered by cache rule/policy of system, the\n        // key will be remained there until next `removeExpired` happens.\n        //\n        // Breaking the strict tracking could save additional locking behaviors.\n        // See https://github.com/onevcat/Kingfisher/issues/1233\n        var keys = Set<String>()\n\n        private var cleanTimer: Timer? = nil\n        private let lock = NSLock()\n\n        /// The config used in this storage. It is a value you can set and\n        /// use to config the storage in air.\n        public var config: Config {\n            didSet {\n                storage.totalCostLimit = config.totalCostLimit\n                storage.countLimit = config.countLimit\n            }\n        }\n\n        /// Creates a `MemoryStorage` with a given `config`.\n        ///\n        /// - Parameter config: The config used to create the storage. It determines the max size limitation,\n        ///                     default expiration setting and more.\n        public init(config: Config) {\n            self.config = config\n            storage.totalCostLimit = config.totalCostLimit\n            storage.countLimit = config.countLimit\n\n            cleanTimer = .scheduledTimer(withTimeInterval: config.cleanInterval, repeats: true) { [weak self] _ in\n                guard let self = self else { return }\n                self.removeExpired()\n            }\n        }\n\n        /// Removes the expired values from the storage.\n        public func removeExpired() {\n            lock.lock()\n            defer { lock.unlock() }\n            for key in keys {\n                let nsKey = key as NSString\n                guard let object = storage.object(forKey: nsKey) else {\n                    // This could happen if the object is moved by cache `totalCostLimit` or `countLimit` rule.\n                    // We didn't remove the key yet until now, since we do not want to introduce additional lock.\n                    // See https://github.com/onevcat/Kingfisher/issues/1233\n                    keys.remove(key)\n                    continue\n                }\n                if object.estimatedExpiration.isPast {\n                    storage.removeObject(forKey: nsKey)\n                    keys.remove(key)\n                }\n            }\n        }\n\n        /// Stores a value to the storage under the specified key and expiration policy.\n        /// - Parameters:\n        ///   - value: The value to be stored.\n        ///   - key: The key to which the `value` will be stored.\n        ///   - expiration: The expiration policy used by this store action.\n        /// - Throws: No error will\n        public func store(\n            value: T,\n            forKey key: String,\n            expiration: StorageExpiration? = nil)\n        {\n            storeNoThrow(value: value, forKey: key, expiration: expiration)\n        }\n\n        // The no throw version for storing value in cache. Kingfisher knows the detail so it\n        // could use this version to make syntax simpler internally.\n        func storeNoThrow(\n            value: T,\n            forKey key: String,\n            expiration: StorageExpiration? = nil)\n        {\n            lock.lock()\n            defer { lock.unlock() }\n            let expiration = expiration ?? config.expiration\n            // The expiration indicates that already expired, no need to store.\n            guard !expiration.isExpired else { return }\n            \n            let object = StorageObject(value, key: key, expiration: expiration)\n            storage.setObject(object, forKey: key as NSString, cost: value.cacheCost)\n            keys.insert(key)\n        }\n        \n        /// Gets a value from the storage.\n        ///\n        /// - Parameters:\n        ///   - key: The cache key of value.\n        ///   - extendingExpiration: The expiration policy used by this getting action.\n        /// - Returns: The value under `key` if it is valid and found in the storage. Otherwise, `nil`.\n        public func value(forKey key: String, extendingExpiration: ExpirationExtending = .cacheTime) -> T? {\n            guard let object = storage.object(forKey: key as NSString) else {\n                return nil\n            }\n            if object.expired {\n                return nil\n            }\n            object.extendExpiration(extendingExpiration)\n            return object.value\n        }\n\n        /// Whether there is valid cached data under a given key.\n        /// - Parameter key: The cache key of value.\n        /// - Returns: If there is valid data under the key, `true`. Otherwise, `false`.\n        public func isCached(forKey key: String) -> Bool {\n            guard let _ = value(forKey: key, extendingExpiration: .none) else {\n                return false\n            }\n            return true\n        }\n\n        /// Removes a value from a specified key.\n        /// - Parameter key: The cache key of value.\n        public func remove(forKey key: String) {\n            lock.lock()\n            defer { lock.unlock() }\n            storage.removeObject(forKey: key as NSString)\n            keys.remove(key)\n        }\n\n        /// Removes all values in this storage.\n        public func removeAll() {\n            lock.lock()\n            defer { lock.unlock() }\n            storage.removeAllObjects()\n            keys.removeAll()\n        }\n    }\n}\n\nextension MemoryStorage {\n    /// Represents the config used in a `MemoryStorage`.\n    public struct Config {\n\n        /// Total cost limit of the storage in bytes.\n        public var totalCostLimit: Int\n\n        /// The item count limit of the memory storage.\n        public var countLimit: Int = .max\n\n        /// The `StorageExpiration` used in this memory storage. Default is `.seconds(300)`,\n        /// means that the memory cache would expire in 5 minutes.\n        public var expiration: StorageExpiration = .seconds(300)\n\n        /// The time interval between the storage do clean work for swiping expired items.\n        public let cleanInterval: TimeInterval\n\n        /// Creates a config from a given `totalCostLimit` value.\n        ///\n        /// - Parameters:\n        ///   - totalCostLimit: Total cost limit of the storage in bytes.\n        ///   - cleanInterval: The time interval between the storage do clean work for swiping expired items.\n        ///                    Default is 120, means the auto eviction happens once per two minutes.\n        ///\n        /// - Note:\n        /// Other members of `MemoryStorage.Config` will use their default values when created.\n        public init(totalCostLimit: Int, cleanInterval: TimeInterval = 120) {\n            self.totalCostLimit = totalCostLimit\n            self.cleanInterval = cleanInterval\n        }\n    }\n}\n\nextension MemoryStorage {\n    class StorageObject<T> {\n        let value: T\n        let expiration: StorageExpiration\n        let key: String\n        \n        private(set) var estimatedExpiration: Date\n        \n        init(_ value: T, key: String, expiration: StorageExpiration) {\n            self.value = value\n            self.key = key\n            self.expiration = expiration\n            \n            self.estimatedExpiration = expiration.estimatedExpirationSinceNow\n        }\n\n        func extendExpiration(_ extendingExpiration: ExpirationExtending = .cacheTime) {\n            switch extendingExpiration {\n            case .none:\n                return\n            case .cacheTime:\n                self.estimatedExpiration = expiration.estimatedExpirationSinceNow\n            case .expirationTime(let expirationTime):\n                self.estimatedExpiration = expirationTime.estimatedExpirationSinceNow\n            }\n        }\n        \n        var expired: Bool {\n            return estimatedExpiration.isPast\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Cache/Storage.swift",
    "content": "//\n//  Storage.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/10/15.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Constants for some time intervals\nstruct TimeConstants {\n    static let secondsInOneMinute = 60\n    static let minutesInOneHour = 60\n    static let hoursInOneDay = 24\n    static let secondsInOneDay = 86_400\n}\n\n/// Represents the expiration strategy used in storage.\n///\n/// - never: The item never expires.\n/// - seconds: The item expires after a time duration of given seconds from now.\n/// - days: The item expires after a time duration of given days from now.\n/// - date: The item expires after a given date.\npublic enum StorageExpiration {\n    /// The item never expires.\n    case never\n    /// The item expires after a time duration of given seconds from now.\n    case seconds(TimeInterval)\n    /// The item expires after a time duration of given days from now.\n    case days(Int)\n    /// The item expires after a given date.\n    case date(Date)\n    /// Indicates the item is already expired. Use this to skip cache.\n    case expired\n\n    func estimatedExpirationSince(_ date: Date) -> Date {\n        switch self {\n        case .never: return .distantFuture\n        case .seconds(let seconds):\n            return date.addingTimeInterval(seconds)\n        case .days(let days):\n            let duration: TimeInterval = TimeInterval(TimeConstants.secondsInOneDay) * TimeInterval(days)\n            return date.addingTimeInterval(duration)\n        case .date(let ref):\n            return ref\n        case .expired:\n            return .distantPast\n        }\n    }\n    \n    var estimatedExpirationSinceNow: Date {\n        return estimatedExpirationSince(Date())\n    }\n    \n    var isExpired: Bool {\n        return timeInterval <= 0\n    }\n\n    var timeInterval: TimeInterval {\n        switch self {\n        case .never: return .infinity\n        case .seconds(let seconds): return seconds\n        case .days(let days): return TimeInterval(TimeConstants.secondsInOneDay) * TimeInterval(days)\n        case .date(let ref): return ref.timeIntervalSinceNow\n        case .expired: return -(.infinity)\n        }\n    }\n}\n\n/// Represents the expiration extending strategy used in storage to after access.\n///\n/// - none: The item expires after the original time, without extending after access.\n/// - cacheTime: The item expiration extends by the original cache time after each access.\n/// - expirationTime: The item expiration extends by the provided time after each access.\npublic enum ExpirationExtending {\n    /// The item expires after the original time, without extending after access.\n    case none\n    /// The item expiration extends by the original cache time after each access.\n    case cacheTime\n    /// The item expiration extends by the provided time after each access.\n    case expirationTime(_ expiration: StorageExpiration)\n}\n\n/// Represents types which cost in memory can be calculated.\npublic protocol CacheCostCalculable {\n    var cacheCost: Int { get }\n}\n\n/// Represents types which can be converted to and from data.\npublic protocol DataTransformable {\n    func toData() throws -> Data\n    static func fromData(_ data: Data) throws -> Self\n    static var empty: Self { get }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Extensions/ImageView+Kingfisher.swift",
    "content": "//\n//  ImageView+Kingfisher.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/4/6.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if !os(watchOS)\n\n#if os(macOS)\nimport AppKit\n#else\nimport UIKit\n#endif\n\nextension KingfisherWrapper where Base: KFCrossPlatformImageView {\n\n    // MARK: Setting Image\n\n    /// Sets an image to the image view with a `Source`.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object defines data information from network or a data provider.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// This is the easiest way to use Kingfisher to boost the image setting process from a source. Since all parameters\n    /// have a default value except the `source`, you can set an image from a certain URL to an image view like this:\n    ///\n    /// ```\n    /// // Set image from a network source.\n    /// let url = URL(string: \"https://example.com/image.png\")!\n    /// imageView.kf.setImage(with: .network(url))\n    ///\n    /// // Or set image from a data provider.\n    /// let provider = LocalFileImageDataProvider(fileURL: fileURL)\n    /// imageView.kf.setImage(with: .provider(provider))\n    /// ```\n    ///\n    /// For both `.network` and `.provider` source, there are corresponding view extension methods. So the code\n    /// above is equivalent to:\n    ///\n    /// ```\n    /// imageView.kf.setImage(with: url)\n    /// imageView.kf.setImage(with: provider)\n    /// ```\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the source.\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        placeholder: Placeholder? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setImage(with: source, placeholder: placeholder, parsedOptions: options, progressBlock: progressBlock, completionHandler: completionHandler)\n    }\n\n    /// Sets an image to the image view with a `Source`.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object defines data information from network or a data provider.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// This is the easiest way to use Kingfisher to boost the image setting process from a source. Since all parameters\n    /// have a default value except the `source`, you can set an image from a certain URL to an image view like this:\n    ///\n    /// ```\n    /// // Set image from a network source.\n    /// let url = URL(string: \"https://example.com/image.png\")!\n    /// imageView.kf.setImage(with: .network(url))\n    ///\n    /// // Or set image from a data provider.\n    /// let provider = LocalFileImageDataProvider(fileURL: fileURL)\n    /// imageView.kf.setImage(with: .provider(provider))\n    /// ```\n    ///\n    /// For both `.network` and `.provider` source, there are corresponding view extension methods. So the code\n    /// above is equivalent to:\n    ///\n    /// ```\n    /// imageView.kf.setImage(with: url)\n    /// imageView.kf.setImage(with: provider)\n    /// ```\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the source.\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    /// The `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        placeholder: Placeholder? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: source,\n            placeholder: placeholder,\n            options: options,\n            progressBlock: nil,\n            completionHandler: completionHandler\n        )\n    }\n\n    /// Sets an image to the image view with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the resource.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// This is the easiest way to use Kingfisher to boost the image setting process from network. Since all parameters\n    /// have a default value except the `resource`, you can set an image from a certain URL to an image view like this:\n    ///\n    /// ```\n    /// let url = URL(string: \"https://example.com/image.png\")!\n    /// imageView.kf.setImage(with: url)\n    /// ```\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with resource: Resource?,\n        placeholder: Placeholder? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: resource?.convertToSource(),\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    /// Sets an image to the image view with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the resource.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// This is the easiest way to use Kingfisher to boost the image setting process from network. Since all parameters\n    /// have a default value except the `resource`, you can set an image from a certain URL to an image view like this:\n    ///\n    /// ```\n    /// let url = URL(string: \"https://example.com/image.png\")!\n    /// imageView.kf.setImage(with: url)\n    /// ```\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// The `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with resource: Resource?,\n        placeholder: Placeholder? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: resource,\n            placeholder: placeholder,\n            options: options,\n            progressBlock: nil,\n            completionHandler: completionHandler\n        )\n    }\n\n    /// Sets an image to the image view with a data provider.\n    ///\n    /// - Parameters:\n    ///   - provider: The `ImageDataProvider` object contains information about the data.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the image data, from either cache\n    /// or the data provider. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with provider: ImageDataProvider?,\n        placeholder: Placeholder? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: provider.map { .provider($0) },\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    /// Sets an image to the image view with a data provider.\n    ///\n    /// - Parameters:\n    ///   - provider: The `ImageDataProvider` object contains information about the data.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the image data, from either cache\n    /// or the data provider. Since this method will perform UI changes, you must call it from the main thread.\n    /// The `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with provider: ImageDataProvider?,\n        placeholder: Placeholder? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: provider,\n            placeholder: placeholder,\n            options: options,\n            progressBlock: nil,\n            completionHandler: completionHandler\n        )\n    }\n\n\n    func setImage(\n        with source: Source?,\n        placeholder: Placeholder? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var mutatingSelf = self\n        guard let source = source else {\n            mutatingSelf.placeholder = placeholder\n            mutatingSelf.taskIdentifier = nil\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n\n        let isEmptyImage = base.image == nil && self.placeholder == nil\n        if !options.keepCurrentImageWhileLoading || isEmptyImage {\n            // Always set placeholder while there is no image/placeholder yet.\n            mutatingSelf.placeholder = placeholder\n        }\n\n        let maybeIndicator = indicator\n        maybeIndicator?.startAnimatingView()\n\n        let issuedIdentifier = Source.Identifier.next()\n        mutatingSelf.taskIdentifier = issuedIdentifier\n\n        if base.shouldPreloadAllAnimation() {\n            options.preloadAllAnimationData = true\n        }\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.image = image\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.taskIdentifier }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            downloadTaskUpdated: { mutatingSelf.imageTask = $0 },\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    maybeIndicator?.stopAnimatingView()\n                    guard issuedIdentifier == self.taskIdentifier else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.imageTask = nil\n                    mutatingSelf.taskIdentifier = nil\n\n                    switch result {\n                    case .success(let value):\n                        guard self.needsTransition(options: options, cacheType: value.cacheType) else {\n                            mutatingSelf.placeholder = nil\n                            self.base.image = value.image\n                            completionHandler?(result)\n                            return\n                        }\n\n                        self.makeTransition(image: value.image, transition: options.transition) {\n                            completionHandler?(result)\n                        }\n\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.image = image\n                        }\n                        completionHandler?(result)\n                    }\n                }\n            }\n        )\n        mutatingSelf.imageTask = task\n        return task\n    }\n\n    // MARK: Cancelling Downloading Task\n\n    /// Cancels the image download task of the image view if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelDownloadTask() {\n        imageTask?.cancel()\n    }\n\n    private func needsTransition(options: KingfisherParsedOptionsInfo, cacheType: CacheType) -> Bool {\n        switch options.transition {\n        case .none:\n            return false\n        #if os(macOS)\n        case .fade: // Fade is only a placeholder for SwiftUI on macOS.\n            return false\n        #else\n        default:\n            if options.forceTransition { return true }\n            if cacheType == .none { return true }\n            return false\n        #endif\n        }\n    }\n\n    private func makeTransition(image: KFCrossPlatformImage, transition: ImageTransition, done: @escaping () -> Void) {\n        #if !os(macOS)\n        // Force hiding the indicator without transition first.\n        UIView.transition(\n            with: self.base,\n            duration: 0.0,\n            options: [],\n            animations: { self.indicator?.stopAnimatingView() },\n            completion: { _ in\n                var mutatingSelf = self\n                mutatingSelf.placeholder = nil\n                UIView.transition(\n                    with: self.base,\n                    duration: transition.duration,\n                    options: [transition.animationOptions, .allowUserInteraction],\n                    animations: { transition.animations?(self.base, image) },\n                    completion: { finished in\n                        transition.completion?(finished)\n                        done()\n                    }\n                )\n            }\n        )\n        #else\n        done()\n        #endif\n    }\n}\n\n// MARK: - Associated Object\nprivate var taskIdentifierKey: Void?\nprivate var indicatorKey: Void?\nprivate var indicatorTypeKey: Void?\nprivate var placeholderKey: Void?\nprivate var imageTaskKey: Void?\n\nextension KingfisherWrapper where Base: KFCrossPlatformImageView {\n\n    // MARK: Properties\n    public private(set) var taskIdentifier: Source.Identifier.Value? {\n        get {\n            let box: Box<Source.Identifier.Value>? = getAssociatedObject(base, &taskIdentifierKey)\n            return box?.value\n        }\n        set {\n            let box = newValue.map { Box($0) }\n            setRetainedAssociatedObject(base, &taskIdentifierKey, box)\n        }\n    }\n\n    /// Holds which indicator type is going to be used.\n    /// Default is `.none`, means no indicator will be shown while downloading.\n    public var indicatorType: IndicatorType {\n        get {\n            return getAssociatedObject(base, &indicatorTypeKey) ?? .none\n        }\n        \n        set {\n            switch newValue {\n            case .none: indicator = nil\n            case .activity: indicator = ActivityIndicator()\n            case .image(let data): indicator = ImageIndicator(imageData: data)\n            case .custom(let anIndicator): indicator = anIndicator\n            }\n\n            setRetainedAssociatedObject(base, &indicatorTypeKey, newValue)\n        }\n    }\n    \n    /// Holds any type that conforms to the protocol `Indicator`.\n    /// The protocol `Indicator` has a `view` property that will be shown when loading an image.\n    /// It will be `nil` if `indicatorType` is `.none`.\n    public private(set) var indicator: Indicator? {\n        get {\n            let box: Box<Indicator>? = getAssociatedObject(base, &indicatorKey)\n            return box?.value\n        }\n        \n        set {\n            // Remove previous\n            if let previousIndicator = indicator {\n                previousIndicator.view.removeFromSuperview()\n            }\n            \n            // Add new\n            if let newIndicator = newValue {\n                // Set default indicator layout\n                let view = newIndicator.view\n                \n                base.addSubview(view)\n                view.translatesAutoresizingMaskIntoConstraints = false\n                view.centerXAnchor.constraint(\n                    equalTo: base.centerXAnchor, constant: newIndicator.centerOffset.x).isActive = true\n                view.centerYAnchor.constraint(\n                    equalTo: base.centerYAnchor, constant: newIndicator.centerOffset.y).isActive = true\n\n                switch newIndicator.sizeStrategy(in: base) {\n                case .intrinsicSize:\n                    break\n                case .full:\n                    view.heightAnchor.constraint(equalTo: base.heightAnchor, constant: 0).isActive = true\n                    view.widthAnchor.constraint(equalTo: base.widthAnchor, constant: 0).isActive = true\n                case .size(let size):\n                    view.heightAnchor.constraint(equalToConstant: size.height).isActive = true\n                    view.widthAnchor.constraint(equalToConstant: size.width).isActive = true\n                }\n                \n                newIndicator.view.isHidden = true\n            }\n\n            // Save in associated object\n            // Wrap newValue with Box to workaround an issue that Swift does not recognize\n            // and casting protocol for associate object correctly. https://github.com/onevcat/Kingfisher/issues/872\n            setRetainedAssociatedObject(base, &indicatorKey, newValue.map(Box.init))\n        }\n    }\n    \n    private var imageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &imageTaskKey) }\n        set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}\n    }\n\n    /// Represents the `Placeholder` used for this image view. A `Placeholder` will be shown in the view while\n    /// it is downloading an image.\n    public private(set) var placeholder: Placeholder? {\n        get { return getAssociatedObject(base, &placeholderKey) }\n        set {\n            if let previousPlaceholder = placeholder {\n                previousPlaceholder.remove(from: base)\n            }\n            \n            if let newPlaceholder = newValue {\n                newPlaceholder.add(to: base)\n            } else {\n                base.image = nil\n            }\n            setRetainedAssociatedObject(base, &placeholderKey, newValue)\n        }\n    }\n}\n\n\nextension KFCrossPlatformImageView {\n    @objc func shouldPreloadAllAnimation() -> Bool { return true }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Extensions/NSButton+Kingfisher.swift",
    "content": "//\n//  NSButton+Kingfisher.swift\n//  Kingfisher\n//\n//  Created by Jie Zhang on 14/04/2016.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\n\nimport AppKit\n\nextension KingfisherWrapper where Base: NSButton {\n\n    // MARK: Setting Image\n\n    /// Sets an image to the button with a source.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object contains information about how to get the image.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// Internally, this method will use `KingfisherManager` to get the requested source.\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setImage(\n            with: source,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler\n        )\n    }\n\n    /// Sets an image to the button with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the resource.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with resource: Resource?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: resource?.convertToSource(),\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    func setImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var mutatingSelf = self\n        guard let source = source else {\n            base.image = placeholder\n            mutatingSelf.taskIdentifier = nil\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n        if !options.keepCurrentImageWhileLoading {\n            base.image = placeholder\n        }\n\n        let issuedIdentifier = Source.Identifier.next()\n        mutatingSelf.taskIdentifier = issuedIdentifier\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.image = image\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.taskIdentifier }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            downloadTaskUpdated: { mutatingSelf.imageTask = $0 },\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    guard issuedIdentifier == self.taskIdentifier else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.imageTask = nil\n                    mutatingSelf.taskIdentifier = nil\n\n                    switch result {\n                    case .success(let value):\n                        self.base.image = value.image\n                        completionHandler?(result)\n\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.image = image\n                        }\n                        completionHandler?(result)\n                    }\n                }\n            }\n        )\n\n        mutatingSelf.imageTask = task\n        return task\n    }\n\n    // MARK: Cancelling Downloading Task\n\n    /// Cancels the image download task of the button if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelImageDownloadTask() {\n        imageTask?.cancel()\n    }\n\n    // MARK: Setting Alternate Image\n\n    @discardableResult\n    public func setAlternateImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setAlternateImage(\n            with: source,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler\n        )\n    }\n\n    /// Sets an alternate image to the button with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the resource.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setAlternateImage(\n        with resource: Resource?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setAlternateImage(\n            with: resource?.convertToSource(),\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    func setAlternateImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var mutatingSelf = self\n        guard let source = source else {\n            base.alternateImage = placeholder\n            mutatingSelf.alternateTaskIdentifier = nil\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n        if !options.keepCurrentImageWhileLoading {\n            base.alternateImage = placeholder\n        }\n\n        let issuedIdentifier = Source.Identifier.next()\n        mutatingSelf.alternateTaskIdentifier = issuedIdentifier\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.alternateImage = image\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.alternateTaskIdentifier }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            downloadTaskUpdated: { mutatingSelf.alternateImageTask = $0 },\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    guard issuedIdentifier == self.alternateTaskIdentifier else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.alternateImageTask = nil\n                    mutatingSelf.alternateTaskIdentifier = nil\n\n                    switch result {\n                    case .success(let value):\n                        self.base.alternateImage = value.image\n                        completionHandler?(result)\n\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.alternateImage = image\n                        }\n                        completionHandler?(result)\n                    }\n                }\n            }\n        )\n\n        mutatingSelf.alternateImageTask = task\n        return task\n    }\n\n    // MARK: Cancelling Alternate Image Downloading Task\n\n    /// Cancels the alternate image download task of the button if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelAlternateImageDownloadTask() {\n        alternateImageTask?.cancel()\n    }\n}\n\n\n// MARK: - Associated Object\nprivate var taskIdentifierKey: Void?\nprivate var imageTaskKey: Void?\n\nprivate var alternateTaskIdentifierKey: Void?\nprivate var alternateImageTaskKey: Void?\n\nextension KingfisherWrapper where Base: NSButton {\n\n    // MARK: Properties\n    \n    public private(set) var taskIdentifier: Source.Identifier.Value? {\n        get {\n            let box: Box<Source.Identifier.Value>? = getAssociatedObject(base, &taskIdentifierKey)\n            return box?.value\n        }\n        set {\n            let box = newValue.map { Box($0) }\n            setRetainedAssociatedObject(base, &taskIdentifierKey, box)\n        }\n    }\n    \n    private var imageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &imageTaskKey) }\n        set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}\n    }\n\n    public private(set) var alternateTaskIdentifier: Source.Identifier.Value? {\n        get {\n            let box: Box<Source.Identifier.Value>? = getAssociatedObject(base, &alternateTaskIdentifierKey)\n            return box?.value\n        }\n        set {\n            let box = newValue.map { Box($0) }\n            setRetainedAssociatedObject(base, &alternateTaskIdentifierKey, box)\n        }\n    }\n\n    private var alternateImageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &alternateImageTaskKey) }\n        set { setRetainedAssociatedObject(base, &alternateImageTaskKey, newValue)}\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Extensions/NSTextAttachment+Kingfisher.swift",
    "content": "//\n//  NSTextAttachment+Kingfisher.swift\n//  Kingfisher\n//\n//  Created by Benjamin Briggs on 22/07/2019.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if !os(watchOS)\n\n#if os(macOS)\nimport AppKit\n#else\nimport UIKit\n#endif\n\nextension KingfisherWrapper where Base: NSTextAttachment {\n\n    // MARK: Setting Image\n\n    /// Sets an image to the text attachment with a source.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object defines data information from network or a data provider.\n    ///   - attributedView: The owner of the attributed string which this `NSTextAttachment` is added.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested source\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    ///\n    /// The retrieved image will be set to `NSTextAttachment.image` property. Because it is not an image view based\n    /// rendering, options related to view, such as `.transition`, are not supported.\n    ///\n    /// Kingfisher will call `setNeedsDisplay` on the `attributedView` when the image task done. It gives the view a\n    /// chance to render the attributed string again for displaying the downloaded image. For example, if you set an\n    /// attributed with this `NSTextAttachment` to a `UILabel` object, pass it as the `attributedView` parameter.\n    ///\n    /// Here is a typical use case:\n    ///\n    /// ```swift\n    /// let attributedText = NSMutableAttributedString(string: \"Hello World\")\n    /// let textAttachment = NSTextAttachment()\n    ///\n    /// textAttachment.kf.setImage(\n    ///     with: URL(string: \"https://onevcat.com/assets/images/avatar.jpg\")!,\n    ///     attributedView: label,\n    ///     options: [\n    ///        .processor(\n    ///            ResizingImageProcessor(referenceSize: .init(width: 30, height: 30))\n    ///            |> RoundCornerImageProcessor(cornerRadius: 15))\n    ///     ]\n    /// )\n    /// attributedText.replaceCharacters(in: NSRange(), with: NSAttributedString(attachment: textAttachment))\n    /// label.attributedText = attributedText\n    /// ```\n    ///\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        attributedView: KFCrossPlatformView,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setImage(\n            with: source,\n            attributedView: attributedView,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler\n        )\n    }\n\n    /// Sets an image to the text attachment with a source.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the resource.\n    ///   - attributedView: The owner of the attributed string which this `NSTextAttachment` is added.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested source\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    ///\n    /// The retrieved image will be set to `NSTextAttachment.image` property. Because it is not an image view based\n    /// rendering, options related to view, such as `.transition`, are not supported.\n    ///\n    /// Kingfisher will call `setNeedsDisplay` on the `attributedView` when the image task done. It gives the view a\n    /// chance to render the attributed string again for displaying the downloaded image. For example, if you set an\n    /// attributed with this `NSTextAttachment` to a `UILabel` object, pass it as the `attributedView` parameter.\n    ///\n    /// Here is a typical use case:\n    ///\n    /// ```swift\n    /// let attributedText = NSMutableAttributedString(string: \"Hello World\")\n    /// let textAttachment = NSTextAttachment()\n    ///\n    /// textAttachment.kf.setImage(\n    ///     with: URL(string: \"https://onevcat.com/assets/images/avatar.jpg\")!,\n    ///     attributedView: label,\n    ///     options: [\n    ///        .processor(\n    ///            ResizingImageProcessor(referenceSize: .init(width: 30, height: 30))\n    ///            |> RoundCornerImageProcessor(cornerRadius: 15))\n    ///     ]\n    /// )\n    /// attributedText.replaceCharacters(in: NSRange(), with: NSAttributedString(attachment: textAttachment))\n    /// label.attributedText = attributedText\n    /// ```\n    ///\n    @discardableResult\n    public func setImage(\n        with resource: Resource?,\n        attributedView: KFCrossPlatformView,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: resource.map { .network($0) },\n            attributedView: attributedView,\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    func setImage(\n        with source: Source?,\n        attributedView: KFCrossPlatformView,\n        placeholder: KFCrossPlatformImage? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var mutatingSelf = self\n        guard let source = source else {\n            base.image = placeholder\n            mutatingSelf.taskIdentifier = nil\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n        if !options.keepCurrentImageWhileLoading {\n            base.image = placeholder\n        }\n\n        let issuedIdentifier = Source.Identifier.next()\n        mutatingSelf.taskIdentifier = issuedIdentifier\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.image = image\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.taskIdentifier }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    guard issuedIdentifier == self.taskIdentifier else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.imageTask = nil\n                    mutatingSelf.taskIdentifier = nil\n\n                    switch result {\n                    case .success(let value):\n                        self.base.image = value.image\n                        #if canImport(UIKit)\n                        attributedView.setNeedsDisplay()\n                        #else\n                        attributedView.setNeedsDisplay(attributedView.bounds)\n                        #endif\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.image = image\n                        }\n                    }\n                    completionHandler?(result)\n                }\n        }\n        )\n\n        mutatingSelf.imageTask = task\n        return task\n    }\n\n    // MARK: Cancelling Image\n\n    /// Cancel the image download task bounded to the text attachment if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelDownloadTask() {\n        imageTask?.cancel()\n    }\n}\n\nprivate var taskIdentifierKey: Void?\nprivate var imageTaskKey: Void?\n\n// MARK: Properties\nextension KingfisherWrapper where Base: NSTextAttachment {\n\n    public private(set) var taskIdentifier: Source.Identifier.Value? {\n        get {\n            let box: Box<Source.Identifier.Value>? = getAssociatedObject(base, &taskIdentifierKey)\n            return box?.value\n        }\n        set {\n            let box = newValue.map { Box($0) }\n            setRetainedAssociatedObject(base, &taskIdentifierKey, box)\n        }\n    }\n\n    private var imageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &imageTaskKey) }\n        set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Extensions/TVMonogramView+Kingfisher.swift",
    "content": "//\n//  TVMonogramView+Kingfisher.swift\n//  Kingfisher\n//\n//  Created by Marvin Nazari on 2020-12-07.\n//\n//  Copyright (c) 2020 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n#if canImport(TVUIKit)\n\nimport TVUIKit\n\n@available(tvOS 12.0, *)\nextension KingfisherWrapper where Base: TVMonogramView {\n\n    // MARK: Setting Image\n\n    /// Sets an image to the image view with a source.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object contains information about the image.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested source\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setImage(\n            with: source,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler\n        )\n    }\n\n    func setImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var mutatingSelf = self\n        guard let source = source else {\n            base.image = placeholder\n            mutatingSelf.taskIdentifier = nil\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n        if !options.keepCurrentImageWhileLoading {\n            base.image = placeholder\n        }\n\n        let issuedIdentifier = Source.Identifier.next()\n        mutatingSelf.taskIdentifier = issuedIdentifier\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.image = image\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.taskIdentifier }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            downloadTaskUpdated: { mutatingSelf.imageTask = $0 },\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    guard issuedIdentifier == self.taskIdentifier else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.imageTask = nil\n                    mutatingSelf.taskIdentifier = nil\n\n                    switch result {\n                    case .success(let value):\n                        self.base.image = value.image\n                        completionHandler?(result)\n\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.image = image\n                        }\n                        completionHandler?(result)\n                    }\n                }\n            }\n        )\n\n        mutatingSelf.imageTask = task\n        return task\n    }\n    \n    /// Sets an image to the image view with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the image.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with resource: Resource?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: resource?.convertToSource(),\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    // MARK: Cancelling Image\n\n    /// Cancel the image download task bounded to the image view if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelDownloadTask() {\n        imageTask?.cancel()\n    }\n}\n\nprivate var taskIdentifierKey: Void?\nprivate var imageTaskKey: Void?\n\n// MARK: Properties\n@available(tvOS 12.0, *)\nextension KingfisherWrapper where Base: TVMonogramView {\n    \n    public private(set) var taskIdentifier: Source.Identifier.Value? {\n        get {\n            let box: Box<Source.Identifier.Value>? = getAssociatedObject(base, &taskIdentifierKey)\n            return box?.value\n        }\n        set {\n            let box = newValue.map { Box($0) }\n            setRetainedAssociatedObject(base, &taskIdentifierKey, box)\n        }\n    }\n\n    private var imageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &imageTaskKey) }\n        set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Extensions/UIButton+Kingfisher.swift",
    "content": "//\n//  UIButton+Kingfisher.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/4/13.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if !os(watchOS)\n\n#if canImport(UIKit)\nimport UIKit\n\nextension KingfisherWrapper where Base: UIButton {\n\n    // MARK: Setting Image\n    /// Sets an image to the button for a specified state with a source.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object contains information about the image.\n    ///   - state: The button state to which the image should be set.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// Internally, this method will use `KingfisherManager` to get the requested source, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        for state: UIControl.State,\n        placeholder: UIImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setImage(\n            with: source,\n            for: state,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler\n        )\n    }\n    \n    /// Sets an image to the button for a specified state with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the resource.\n    ///   - state: The button state to which the image should be set.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with resource: Resource?,\n        for state: UIControl.State,\n        placeholder: UIImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: resource?.convertToSource(),\n            for: state,\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        for state: UIControl.State,\n        placeholder: UIImage? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        guard let source = source else {\n            base.setImage(placeholder, for: state)\n            setTaskIdentifier(nil, for: state)\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n        if !options.keepCurrentImageWhileLoading {\n            base.setImage(placeholder, for: state)\n        }\n\n        var mutatingSelf = self\n        let issuedIdentifier = Source.Identifier.next()\n        setTaskIdentifier(issuedIdentifier, for: state)\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.setImage(image, for: state)\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.taskIdentifier(for: state) }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            downloadTaskUpdated: { mutatingSelf.imageTask = $0 },\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    guard issuedIdentifier == self.taskIdentifier(for: state) else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.imageTask = nil\n                    mutatingSelf.setTaskIdentifier(nil, for: state)\n\n                    switch result {\n                    case .success(let value):\n                        self.base.setImage(value.image, for: state)\n                        completionHandler?(result)\n\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.setImage(image, for: state)\n                        }\n                        completionHandler?(result)\n                    }\n                }\n            }\n        )\n\n        mutatingSelf.imageTask = task\n        return task\n    }\n\n    // MARK: Cancelling Downloading Task\n    \n    /// Cancels the image download task of the button if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelImageDownloadTask() {\n        imageTask?.cancel()\n    }\n\n    // MARK: Setting Background Image\n\n    /// Sets a background image to the button for a specified state with a source.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object contains information about the image.\n    ///   - state: The button state to which the image should be set.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// Internally, this method will use `KingfisherManager` to get the requested source\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setBackgroundImage(\n        with source: Source?,\n        for state: UIControl.State,\n        placeholder: UIImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setBackgroundImage(\n            with: source,\n            for: state,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler\n        )\n    }\n\n    /// Sets a background image to the button for a specified state with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the resource.\n    ///   - state: The button state to which the image should be set.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setBackgroundImage(\n        with resource: Resource?,\n        for state: UIControl.State,\n        placeholder: UIImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setBackgroundImage(\n            with: resource?.convertToSource(),\n            for: state,\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    func setBackgroundImage(\n        with source: Source?,\n        for state: UIControl.State,\n        placeholder: UIImage? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        guard let source = source else {\n            base.setBackgroundImage(placeholder, for: state)\n            setBackgroundTaskIdentifier(nil, for: state)\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n        if !options.keepCurrentImageWhileLoading {\n            base.setBackgroundImage(placeholder, for: state)\n        }\n\n        var mutatingSelf = self\n        let issuedIdentifier = Source.Identifier.next()\n        setBackgroundTaskIdentifier(issuedIdentifier, for: state)\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.setBackgroundImage(image, for: state)\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.backgroundTaskIdentifier(for: state) }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            downloadTaskUpdated: { mutatingSelf.backgroundImageTask = $0 },\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    guard issuedIdentifier == self.backgroundTaskIdentifier(for: state) else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.backgroundImageTask = nil\n                    mutatingSelf.setBackgroundTaskIdentifier(nil, for: state)\n\n                    switch result {\n                    case .success(let value):\n                        self.base.setBackgroundImage(value.image, for: state)\n                        completionHandler?(result)\n\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.setBackgroundImage(image, for: state)\n                        }\n                        completionHandler?(result)\n                    }\n                }\n            }\n        )\n\n        mutatingSelf.backgroundImageTask = task\n        return task\n    }\n\n    // MARK: Cancelling Background Downloading Task\n    \n    /// Cancels the background image download task of the button if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelBackgroundImageDownloadTask() {\n        backgroundImageTask?.cancel()\n    }\n}\n\n// MARK: - Associated Object\nprivate var taskIdentifierKey: Void?\nprivate var imageTaskKey: Void?\n\n// MARK: Properties\nextension KingfisherWrapper where Base: UIButton {\n\n    private typealias TaskIdentifier = Box<[UInt: Source.Identifier.Value]>\n    \n    public func taskIdentifier(for state: UIControl.State) -> Source.Identifier.Value? {\n        return taskIdentifierInfo.value[state.rawValue]\n    }\n\n    private func setTaskIdentifier(_ identifier: Source.Identifier.Value?, for state: UIControl.State) {\n        taskIdentifierInfo.value[state.rawValue] = identifier\n    }\n    \n    private var taskIdentifierInfo: TaskIdentifier {\n        return  getAssociatedObject(base, &taskIdentifierKey) ?? {\n            setRetainedAssociatedObject(base, &taskIdentifierKey, $0)\n            return $0\n        } (TaskIdentifier([:]))\n    }\n    \n    private var imageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &imageTaskKey) }\n        set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}\n    }\n}\n\n\nprivate var backgroundTaskIdentifierKey: Void?\nprivate var backgroundImageTaskKey: Void?\n\n// MARK: Background Properties\nextension KingfisherWrapper where Base: UIButton {\n    \n    public func backgroundTaskIdentifier(for state: UIControl.State) -> Source.Identifier.Value? {\n        return backgroundTaskIdentifierInfo.value[state.rawValue]\n    }\n    \n    private func setBackgroundTaskIdentifier(_ identifier: Source.Identifier.Value?, for state: UIControl.State) {\n        backgroundTaskIdentifierInfo.value[state.rawValue] = identifier\n    }\n    \n    private var backgroundTaskIdentifierInfo: TaskIdentifier {\n        return  getAssociatedObject(base, &backgroundTaskIdentifierKey) ?? {\n            setRetainedAssociatedObject(base, &backgroundTaskIdentifierKey, $0)\n            return $0\n        } (TaskIdentifier([:]))\n    }\n    \n    private var backgroundImageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &backgroundImageTaskKey) }\n        mutating set { setRetainedAssociatedObject(base, &backgroundImageTaskKey, newValue) }\n    }\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Extensions/WKInterfaceImage+Kingfisher.swift",
    "content": "//\n//  WKInterfaceImage+Kingfisher.swift\n//  Kingfisher\n//\n//  Created by Rodrigo Borges Soares on 04/05/18.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if canImport(WatchKit)\n\nimport WatchKit\n\nextension KingfisherWrapper where Base: WKInterfaceImage {\n\n    // MARK: Setting Image\n\n    /// Sets an image to the image view with a source.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object contains information about the image.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested source\n    /// Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        let options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions + (options ?? .empty))\n        return setImage(\n            with: source,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler\n        )\n    }\n    \n    /// Sets an image to the image view with a requested resource.\n    ///\n    /// - Parameters:\n    ///   - resource: The `Resource` object contains information about the image.\n    ///   - placeholder: A placeholder to show while retrieving the image from the given `resource`.\n    ///   - options: An options set to define image setting behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called.\n    ///   - completionHandler: Called when the image retrieved and set finished.\n    /// - Returns: A task represents the image downloading.\n    ///\n    /// - Note:\n    ///\n    /// Internally, this method will use `KingfisherManager` to get the requested resource, from either cache\n    /// or network. Since this method will perform UI changes, you must call it from the main thread.\n    /// Both `progressBlock` and `completionHandler` will be also executed in the main thread.\n    ///\n    @discardableResult\n    public func setImage(\n        with resource: Resource?,\n        placeholder: KFCrossPlatformImage? = nil,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        return setImage(\n            with: resource?.convertToSource(),\n            placeholder: placeholder,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    func setImage(\n        with source: Source?,\n        placeholder: KFCrossPlatformImage? = nil,\n        parsedOptions: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var mutatingSelf = self\n        guard let source = source else {\n            base.setImage(placeholder)\n            mutatingSelf.taskIdentifier = nil\n            completionHandler?(.failure(KingfisherError.imageSettingError(reason: .emptySource)))\n            return nil\n        }\n\n        var options = parsedOptions\n        if !options.keepCurrentImageWhileLoading {\n            base.setImage(placeholder)\n        }\n\n        let issuedIdentifier = Source.Identifier.next()\n        mutatingSelf.taskIdentifier = issuedIdentifier\n\n        if let block = progressBlock {\n            options.onDataReceived = (options.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n\n        if let provider = ImageProgressiveProvider(options, refresh: { image in\n            self.base.setImage(image)\n        }) {\n            options.onDataReceived = (options.onDataReceived ?? []) + [provider]\n        }\n\n        options.onDataReceived?.forEach {\n            $0.onShouldApply = { issuedIdentifier == self.taskIdentifier }\n        }\n\n        let task = KingfisherManager.shared.retrieveImage(\n            with: source,\n            options: options,\n            downloadTaskUpdated: { mutatingSelf.imageTask = $0 },\n            completionHandler: { result in\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    guard issuedIdentifier == self.taskIdentifier else {\n                        let reason: KingfisherError.ImageSettingErrorReason\n                        do {\n                            let value = try result.get()\n                            reason = .notCurrentSourceTask(result: value, error: nil, source: source)\n                        } catch {\n                            reason = .notCurrentSourceTask(result: nil, error: error, source: source)\n                        }\n                        let error = KingfisherError.imageSettingError(reason: reason)\n                        completionHandler?(.failure(error))\n                        return\n                    }\n\n                    mutatingSelf.imageTask = nil\n                    mutatingSelf.taskIdentifier = nil\n\n                    switch result {\n                    case .success(let value):\n                        self.base.setImage(value.image)\n                        completionHandler?(result)\n\n                    case .failure:\n                        if let image = options.onFailureImage {\n                            self.base.setImage(image)\n                        }\n                        completionHandler?(result)\n                    }\n                }\n            }\n        )\n\n        mutatingSelf.imageTask = task\n        return task\n    }\n\n    // MARK: Cancelling Image\n\n    /// Cancel the image download task bounded to the image view if it is running.\n    /// Nothing will happen if the downloading has already finished.\n    public func cancelDownloadTask() {\n        imageTask?.cancel()\n    }\n}\n\nprivate var taskIdentifierKey: Void?\nprivate var imageTaskKey: Void?\n\n// MARK: Properties\nextension KingfisherWrapper where Base: WKInterfaceImage {\n    \n    public private(set) var taskIdentifier: Source.Identifier.Value? {\n        get {\n            let box: Box<Source.Identifier.Value>? = getAssociatedObject(base, &taskIdentifierKey)\n            return box?.value\n        }\n        set {\n            let box = newValue.map { Box($0) }\n            setRetainedAssociatedObject(base, &taskIdentifierKey, box)\n        }\n    }\n\n    private var imageTask: DownloadTask? {\n        get { return getAssociatedObject(base, &imageTaskKey) }\n        set { setRetainedAssociatedObject(base, &imageTaskKey, newValue)}\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/ImageSource/AVAssetImageDataProvider.swift",
    "content": "//\n//  AVAssetImageDataProvider.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2020/08/09.\n//\n//  Copyright (c) 2020 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if !os(watchOS)\n\nimport Foundation\nimport AVKit\n\n#if canImport(MobileCoreServices)\nimport MobileCoreServices\n#else\nimport CoreServices\n#endif\n\n/// A data provider to provide thumbnail data from a given AVKit asset.\npublic struct AVAssetImageDataProvider: ImageDataProvider {\n\n    /// The possible error might be caused by the `AVAssetImageDataProvider`.\n    /// - userCancelled: The data provider process is cancelled.\n    /// - invalidImage: The retrieved image is invalid.\n    public enum AVAssetImageDataProviderError: Error {\n        case userCancelled\n        case invalidImage(_ image: CGImage?)\n    }\n\n    /// The asset image generator bound to `self`.\n    public let assetImageGenerator: AVAssetImageGenerator\n\n    /// The time at which the image should be generate in the asset.\n    public let time: CMTime\n\n    private var internalKey: String {\n        return (assetImageGenerator.asset as? AVURLAsset)?.url.absoluteString ?? UUID().uuidString\n    }\n\n    /// The cache key used by `self`.\n    public var cacheKey: String {\n        return \"\\(internalKey)_\\(time.seconds)\"\n    }\n\n    /// Creates an asset image data provider.\n    /// - Parameters:\n    ///   - assetImageGenerator: The asset image generator controls data providing behaviors.\n    ///   - time: At which time in the asset the image should be generated.\n    public init(assetImageGenerator: AVAssetImageGenerator, time: CMTime) {\n        self.assetImageGenerator = assetImageGenerator\n        self.time = time\n    }\n\n    /// Creates an asset image data provider.\n    /// - Parameters:\n    ///   - assetURL: The URL of asset for providing image data.\n    ///   - time: At which time in the asset the image should be generated.\n    ///\n    /// This method uses `assetURL` to create an `AVAssetImageGenerator` object and calls\n    /// the `init(assetImageGenerator:time:)` initializer.\n    ///\n    public init(assetURL: URL, time: CMTime) {\n        let asset = AVAsset(url: assetURL)\n        let generator = AVAssetImageGenerator(asset: asset)\n        self.init(assetImageGenerator: generator, time: time)\n    }\n\n    /// Creates an asset image data provider.\n    ///\n    /// - Parameters:\n    ///   - assetURL: The URL of asset for providing image data.\n    ///   - seconds: At which time in seconds in the asset the image should be generated.\n    ///\n    /// This method uses `assetURL` to create an `AVAssetImageGenerator` object, uses `seconds` to create a `CMTime`,\n    /// and calls the `init(assetImageGenerator:time:)` initializer.\n    ///\n    public init(assetURL: URL, seconds: TimeInterval) {\n        let time = CMTime(seconds: seconds, preferredTimescale: 600)\n        self.init(assetURL: assetURL, time: time)\n    }\n\n    public func data(handler: @escaping (Result<Data, Error>) -> Void) {\n        assetImageGenerator.generateCGImagesAsynchronously(forTimes: [NSValue(time: time)]) {\n            (requestedTime, image, imageTime, result, error) in\n            if let error = error {\n                handler(.failure(error))\n                return\n            }\n\n            if result == .cancelled {\n                handler(.failure(AVAssetImageDataProviderError.userCancelled))\n                return\n            }\n\n            guard let cgImage = image, let data = cgImage.jpegData else {\n                handler(.failure(AVAssetImageDataProviderError.invalidImage(image)))\n                return\n            }\n\n            handler(.success(data))\n        }\n    }\n}\n\nextension CGImage {\n    var jpegData: Data? {\n        guard let mutableData = CFDataCreateMutable(nil, 0),\n              let destination = CGImageDestinationCreateWithData(mutableData, kUTTypeJPEG, 1, nil)\n        else {\n            return nil\n        }\n        CGImageDestinationAddImage(destination, self, nil)\n        guard CGImageDestinationFinalize(destination) else { return nil }\n        return mutableData as Data\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/ImageSource/ImageDataProvider.swift",
    "content": "//\n//  ImageDataProvider.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/11/13.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents a data provider to provide image data to Kingfisher when setting with\n/// `Source.provider` source. Compared to `Source.network` member, it gives a chance\n/// to load some image data in your own way, as long as you can provide the data\n/// representation for the image.\npublic protocol ImageDataProvider {\n    \n    /// The key used in cache.\n    var cacheKey: String { get }\n    \n    /// Provides the data which represents image. Kingfisher uses the data you pass in the\n    /// handler to process images and caches it for later use.\n    ///\n    /// - Parameter handler: The handler you should call when you prepared your data.\n    ///                      If the data is loaded successfully, call the handler with\n    ///                      a `.success` with the data associated. Otherwise, call it\n    ///                      with a `.failure` and pass the error.\n    ///\n    /// - Note:\n    /// If the `handler` is called with a `.failure` with error, a `dataProviderError` of\n    /// `ImageSettingErrorReason` will be finally thrown out to you as the `KingfisherError`\n    /// from the framework.\n    func data(handler: @escaping (Result<Data, Error>) -> Void)\n\n    /// The content URL represents this provider, if exists.\n    var contentURL: URL? { get }\n}\n\npublic extension ImageDataProvider {\n    var contentURL: URL? { return nil }\n    func convertToSource() -> Source {\n        .provider(self)\n    }\n}\n\n/// Represents an image data provider for loading from a local file URL on disk.\n/// Uses this type for adding a disk image to Kingfisher. Compared to loading it\n/// directly, you can get benefit of using Kingfisher's extension methods, as well\n/// as applying `ImageProcessor`s and storing the image to `ImageCache` of Kingfisher.\npublic struct LocalFileImageDataProvider: ImageDataProvider {\n\n    // MARK: Public Properties\n\n    /// The file URL from which the image be loaded.\n    public let fileURL: URL\n\n    // MARK: Initializers\n\n    /// Creates an image data provider by supplying the target local file URL.\n    ///\n    /// - Parameters:\n    ///   - fileURL: The file URL from which the image be loaded.\n    ///   - cacheKey: The key is used for caching the image data. By default,\n    ///               the `absoluteString` of `fileURL` is used.\n    public init(fileURL: URL, cacheKey: String? = nil) {\n        self.fileURL = fileURL\n        self.cacheKey = cacheKey ?? fileURL.absoluteString\n    }\n\n    // MARK: Protocol Conforming\n\n    /// The key used in cache.\n    public var cacheKey: String\n\n    public func data(handler: (Result<Data, Error>) -> Void) {\n        handler(Result(catching: { try Data(contentsOf: fileURL) }))\n    }\n\n    /// The URL of the local file on the disk.\n    public var contentURL: URL? {\n        return fileURL\n    }\n}\n\n/// Represents an image data provider for loading image from a given Base64 encoded string.\npublic struct Base64ImageDataProvider: ImageDataProvider {\n\n    // MARK: Public Properties\n    /// The encoded Base64 string for the image.\n    public let base64String: String\n\n    // MARK: Initializers\n\n    /// Creates an image data provider by supplying the Base64 encoded string.\n    ///\n    /// - Parameters:\n    ///   - base64String: The Base64 encoded string for an image.\n    ///   - cacheKey: The key is used for caching the image data. You need a different key for any different image.\n    public init(base64String: String, cacheKey: String) {\n        self.base64String = base64String\n        self.cacheKey = cacheKey\n    }\n\n    // MARK: Protocol Conforming\n\n    /// The key used in cache.\n    public var cacheKey: String\n\n    public func data(handler: (Result<Data, Error>) -> Void) {\n        let data = Data(base64Encoded: base64String)!\n        handler(.success(data))\n    }\n}\n\n/// Represents an image data provider for a raw data object.\npublic struct RawImageDataProvider: ImageDataProvider {\n\n    // MARK: Public Properties\n\n    /// The raw data object to provide to Kingfisher image loader.\n    public let data: Data\n\n    // MARK: Initializers\n\n    /// Creates an image data provider by the given raw `data` value and a `cacheKey` be used in Kingfisher cache.\n    ///\n    /// - Parameters:\n    ///   - data: The raw data reprensents an image.\n    ///   - cacheKey: The key is used for caching the image data. You need a different key for any different image.\n    public init(data: Data, cacheKey: String) {\n        self.data = data\n        self.cacheKey = cacheKey\n    }\n\n    // MARK: Protocol Conforming\n    \n    /// The key used in cache.\n    public var cacheKey: String\n\n    public func data(handler: @escaping (Result<Data, Error>) -> Void) {\n        handler(.success(data))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/ImageSource/Resource.swift",
    "content": "//\n//  Resource.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/4/6.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents an image resource at a certain url and a given cache key.\n/// Kingfisher will use a `Resource` to download a resource from network and cache it with the cache key when\n/// using `Source.network` as its image setting source.\npublic protocol Resource {\n    \n    /// The key used in cache.\n    var cacheKey: String { get }\n    \n    /// The target image URL.\n    var downloadURL: URL { get }\n}\n\nextension Resource {\n\n    /// Converts `self` to a valid `Source` based on its `downloadURL` scheme. A `.provider` with\n    /// `LocalFileImageDataProvider` associated will be returned if the URL points to a local file. Otherwise,\n    /// `.network` is returned.\n    public func convertToSource(overrideCacheKey: String? = nil) -> Source {\n        return downloadURL.isFileURL ?\n            .provider(LocalFileImageDataProvider(fileURL: downloadURL, cacheKey: overrideCacheKey ?? cacheKey)) :\n            .network(ImageResource(downloadURL: downloadURL, cacheKey: overrideCacheKey ?? cacheKey))\n    }\n}\n\n/// ImageResource is a simple combination of `downloadURL` and `cacheKey`.\n/// When passed to image view set methods, Kingfisher will try to download the target\n/// image from the `downloadURL`, and then store it with the `cacheKey` as the key in cache.\npublic struct ImageResource: Resource {\n\n    // MARK: - Initializers\n\n    /// Creates an image resource.\n    ///\n    /// - Parameters:\n    ///   - downloadURL: The target image URL from where the image can be downloaded.\n    ///   - cacheKey: The cache key. If `nil`, Kingfisher will use the `absoluteString` of `downloadURL` as the key.\n    ///               Default is `nil`.\n    public init(downloadURL: URL, cacheKey: String? = nil) {\n        self.downloadURL = downloadURL\n        self.cacheKey = cacheKey ?? downloadURL.absoluteString\n    }\n\n    // MARK: Protocol Conforming\n    \n    /// The key used in cache.\n    public let cacheKey: String\n\n    /// The target image URL.\n    public let downloadURL: URL\n}\n\n/// URL conforms to `Resource` in Kingfisher.\n/// The `absoluteString` of this URL is used as `cacheKey`. And the URL itself will be used as `downloadURL`.\n/// If you need customize the url and/or cache key, use `ImageResource` instead.\nextension URL: Resource {\n    public var cacheKey: String { return absoluteString }\n    public var downloadURL: URL { return self }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/ImageSource/Source.swift",
    "content": "//\n//  Source.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/11/17.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents an image setting source for Kingfisher methods.\n///\n/// A `Source` value indicates the way how the target image can be retrieved and cached.\n///\n/// - network: The target image should be got from network remotely. The associated `Resource`\n///            value defines detail information like image URL and cache key.\n/// - provider: The target image should be provided in a data format. Normally, it can be an image\n///             from local storage or in any other encoding format (like Base64).\npublic enum Source {\n\n    /// Represents the source task identifier when setting an image to a view with extension methods.\n    public enum Identifier {\n\n        /// The underlying value type of source identifier.\n        public typealias Value = UInt\n        static var current: Value = 0\n        static func next() -> Value {\n            current += 1\n            return current\n        }\n    }\n\n    // MARK: Member Cases\n\n    /// The target image should be got from network remotely. The associated `Resource`\n    /// value defines detail information like image URL and cache key.\n    case network(Resource)\n    \n    /// The target image should be provided in a data format. Normally, it can be an image\n    /// from local storage or in any other encoding format (like Base64).\n    case provider(ImageDataProvider)\n\n    // MARK: Getting Properties\n\n    /// The cache key defined for this source value.\n    public var cacheKey: String {\n        switch self {\n        case .network(let resource): return resource.cacheKey\n        case .provider(let provider): return provider.cacheKey\n        }\n    }\n\n    /// The URL defined for this source value.\n    ///\n    /// For a `.network` source, it is the `downloadURL` of associated `Resource` instance.\n    /// For a `.provider` value, it is always `nil`.\n    public var url: URL? {\n        switch self {\n        case .network(let resource): return resource.downloadURL\n        case .provider(let provider): return provider.contentURL\n        }\n    }\n}\n\nextension Source: Hashable {\n    public static func == (lhs: Source, rhs: Source) -> Bool {\n        switch (lhs, rhs) {\n        case (.network(let r1), .network(let r2)):\n            return r1.cacheKey == r2.cacheKey && r1.downloadURL == r2.downloadURL\n        case (.provider(let p1), .provider(let p2)):\n            return p1.cacheKey == p2.cacheKey && p1.contentURL == p2.contentURL\n        case (.provider(_), .network(_)):\n            return false\n        case (.network(_), .provider(_)):\n            return false\n        }\n    }\n\n    public func hash(into hasher: inout Hasher) {\n        switch self {\n        case .network(let r):\n            hasher.combine(r.cacheKey)\n            hasher.combine(r.downloadURL)\n        case .provider(let p):\n            hasher.combine(p.cacheKey)\n            hasher.combine(p.contentURL)\n        }\n    }\n}\n\nextension Source {\n    var asResource: Resource? {\n        guard case .network(let resource) = self else {\n            return nil\n        }\n        return resource\n    }\n\n    var asProvider: ImageDataProvider? {\n        guard case .provider(let provider) = self else {\n            return nil\n        }\n        return provider\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/KF.swift",
    "content": "//\n//  KF.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2020/09/21.\n//\n//  Copyright (c) 2020 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if canImport(UIKit)\nimport UIKit\n#endif\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n#endif\n\n#if canImport(WatchKit)\nimport WatchKit\n#endif\n\n#if canImport(TVUIKit)\nimport TVUIKit\n#endif\n\n/// A helper type to create image setting tasks in a builder pattern.\n/// Use methods in this type to create a `KF.Builder` instance and configure image tasks there.\npublic enum KF {\n\n    /// Creates a builder for a given `Source`.\n    /// - Parameter source: The `Source` object defines data information from network or a data provider.\n    /// - Returns: A `KF.Builder` for future configuration. After configuring the builder, call `set(to:)`\n    ///            to start the image loading.\n    public static func source(_ source: Source?) -> KF.Builder {\n        Builder(source: source)\n    }\n\n    /// Creates a builder for a given `Resource`.\n    /// - Parameter resource: The `Resource` object defines data information like key or URL.\n    /// - Returns: A `KF.Builder` for future configuration. After configuring the builder, call `set(to:)`\n    ///            to start the image loading.\n    public static func resource(_ resource: Resource?) -> KF.Builder {\n        source(resource?.convertToSource())\n    }\n\n    /// Creates a builder for a given `URL` and an optional cache key.\n    /// - Parameters:\n    ///   - url: The URL where the image should be downloaded.\n    ///   - cacheKey: The key used to store the downloaded image in cache.\n    ///               If `nil`, the `absoluteString` of `url` is used as the cache key.\n    /// - Returns: A `KF.Builder` for future configuration. After configuring the builder, call `set(to:)`\n    ///            to start the image loading.\n    public static func url(_ url: URL?, cacheKey: String? = nil) -> KF.Builder {\n        source(url?.convertToSource(overrideCacheKey: cacheKey))\n    }\n\n    /// Creates a builder for a given `ImageDataProvider`.\n    /// - Parameter provider: The `ImageDataProvider` object contains information about the data.\n    /// - Returns: A `KF.Builder` for future configuration. After configuring the builder, call `set(to:)`\n    ///            to start the image loading.\n    public static func dataProvider(_ provider: ImageDataProvider?) -> KF.Builder {\n        source(provider?.convertToSource())\n    }\n\n    /// Creates a builder for some given raw data and a cache key.\n    /// - Parameters:\n    ///   - data: The data object from which the image should be created.\n    ///   - cacheKey: The key used to store the downloaded image in cache.\n    /// - Returns: A `KF.Builder` for future configuration. After configuring the builder, call `set(to:)`\n    ///            to start the image loading.\n    public static func data(_ data: Data?, cacheKey: String) -> KF.Builder {\n        if let data = data {\n            return dataProvider(RawImageDataProvider(data: data, cacheKey: cacheKey))\n        } else {\n            return dataProvider(nil)\n        }\n    }\n}\n\n\nextension KF {\n\n    /// A builder class to configure an image retrieving task and set it to a holder view or component.\n    public class Builder {\n        private let source: Source?\n\n        #if os(watchOS)\n        private var placeholder: KFCrossPlatformImage?\n        #else\n        private var placeholder: Placeholder?\n        #endif\n\n        public var options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions)\n\n        public let onFailureDelegate = Delegate<KingfisherError, Void>()\n        public let onSuccessDelegate = Delegate<RetrieveImageResult, Void>()\n        public let onProgressDelegate = Delegate<(Int64, Int64), Void>()\n\n        init(source: Source?) {\n            self.source = source\n        }\n\n        private var resultHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)? {\n            {\n                switch $0 {\n                case .success(let result):\n                    self.onSuccessDelegate(result)\n                case .failure(let error):\n                    self.onFailureDelegate(error)\n                }\n            }\n        }\n\n        private var progressBlock: DownloadProgressBlock {\n            { self.onProgressDelegate(($0, $1)) }\n        }\n    }\n}\n\nextension KF.Builder {\n    #if !os(watchOS)\n\n    /// Builds the image task request and sets it to an image view.\n    /// - Parameter imageView: The image view which loads the task and should be set with the image.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @discardableResult\n    public func set(to imageView: KFCrossPlatformImageView) -> DownloadTask? {\n        imageView.kf.setImage(\n            with: source,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n\n    /// Builds the image task request and sets it to an `NSTextAttachment` object.\n    /// - Parameters:\n    ///   - attachment: The text attachment object which loads the task and should be set with the image.\n    ///   - attributedView: The owner of the attributed string which this `NSTextAttachment` is added.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @discardableResult\n    public func set(to attachment: NSTextAttachment, attributedView: KFCrossPlatformView) -> DownloadTask? {\n        let placeholderImage = placeholder as? KFCrossPlatformImage ?? nil\n        return attachment.kf.setImage(\n            with: source,\n            attributedView: attributedView,\n            placeholder: placeholderImage,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n\n    #if canImport(UIKit)\n\n    /// Builds the image task request and sets it to a button.\n    /// - Parameters:\n    ///   - button: The button which loads the task and should be set with the image.\n    ///   - state: The button state to which the image should be set.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @discardableResult\n    public func set(to button: UIButton, for state: UIControl.State) -> DownloadTask? {\n        let placeholderImage = placeholder as? KFCrossPlatformImage ?? nil\n        return button.kf.setImage(\n            with: source,\n            for: state,\n            placeholder: placeholderImage,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n\n    /// Builds the image task request and sets it to the background image for a button.\n    /// - Parameters:\n    ///   - button: The button which loads the task and should be set with the image.\n    ///   - state: The button state to which the image should be set.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @discardableResult\n    public func setBackground(to button: UIButton, for state: UIControl.State) -> DownloadTask? {\n        let placeholderImage = placeholder as? KFCrossPlatformImage ?? nil\n        return button.kf.setBackgroundImage(\n            with: source,\n            for: state,\n            placeholder: placeholderImage,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n    #endif // end of canImport(UIKit)\n\n    #if canImport(AppKit) && !targetEnvironment(macCatalyst)\n    /// Builds the image task request and sets it to a button.\n    /// - Parameter button: The button which loads the task and should be set with the image.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @discardableResult\n    public func set(to button: NSButton) -> DownloadTask? {\n        let placeholderImage = placeholder as? KFCrossPlatformImage ?? nil\n        return button.kf.setImage(\n            with: source,\n            placeholder: placeholderImage,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n\n    /// Builds the image task request and sets it to the alternative image for a button.\n    /// - Parameter button: The button which loads the task and should be set with the image.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @discardableResult\n    public func setAlternative(to button: NSButton) -> DownloadTask? {\n        let placeholderImage = placeholder as? KFCrossPlatformImage ?? nil\n        return button.kf.setAlternateImage(\n            with: source,\n            placeholder: placeholderImage,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n    #endif // end of canImport(AppKit)\n    #endif // end of !os(watchOS)\n\n    #if canImport(WatchKit)\n    /// Builds the image task request and sets it to a `WKInterfaceImage` object.\n    /// - Parameter interfaceImage: The watch interface image which loads the task and should be set with the image.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @discardableResult\n    public func set(to interfaceImage: WKInterfaceImage) -> DownloadTask? {\n        return interfaceImage.kf.setImage(\n            with: source,\n            placeholder: placeholder,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n    #endif // end of canImport(WatchKit)\n\n    #if canImport(TVUIKit)\n    /// Builds the image task request and sets it to a TV monogram view.\n    /// - Parameter monogramView: The monogram view which loads the task and should be set with the image.\n    /// - Returns: A task represents the image downloading, if initialized.\n    ///            This value is `nil` if the image is being loaded from cache.\n    @available(tvOS 12.0, *)\n    @discardableResult\n    public func set(to monogramView: TVMonogramView) -> DownloadTask? {\n        let placeholderImage = placeholder as? KFCrossPlatformImage ?? nil\n        return monogramView.kf.setImage(\n            with: source,\n            placeholder: placeholderImage,\n            parsedOptions: options,\n            progressBlock: progressBlock,\n            completionHandler: resultHandler\n        )\n    }\n    #endif // end of canImport(TVUIKit)\n}\n\n#if !os(watchOS)\nextension KF.Builder {\n    #if os(iOS) || os(tvOS)\n\n    /// Sets a placeholder which is used while retrieving the image.\n    /// - Parameter placeholder: A placeholder to show while retrieving the image from its source.\n    /// - Returns: A `KF.Builder` with changes applied.\n    public func placeholder(_ placeholder: Placeholder?) -> Self {\n        self.placeholder = placeholder\n        return self\n    }\n    #endif\n\n    /// Sets a placeholder image which is used while retrieving the image.\n    /// - Parameter placeholder: An image to show while retrieving the image from its source.\n    /// - Returns: A `KF.Builder` with changes applied.\n    public func placeholder(_ image: KFCrossPlatformImage?) -> Self {\n        self.placeholder = image\n        return self\n    }\n}\n#endif\n\nextension KF.Builder {\n\n    #if os(iOS) || os(tvOS)\n    /// Sets the transition for the image task.\n    /// - Parameter transition: The desired transition effect when setting the image to image view.\n    /// - Returns: A `KF.Builder` with changes applied.\n    ///\n    /// Kingfisher will use the `transition` to animate the image in if it is downloaded from web.\n    /// The transition will not happen when the\n    /// image is retrieved from either memory or disk cache by default. If you need to do the transition even when\n    /// the image being retrieved from cache, also call `forceRefresh()` on the returned `KF.Builder`.\n    public func transition(_ transition: ImageTransition) -> Self {\n        options.transition = transition\n        return self\n    }\n\n    /// Sets a fade transition for the image task.\n    /// - Parameter duration: The duration of the fade transition.\n    /// - Returns: A `KF.Builder` with changes applied.\n    ///\n    /// Kingfisher will use the fade transition to animate the image in if it is downloaded from web.\n    /// The transition will not happen when the\n    /// image is retrieved from either memory or disk cache by default. If you need to do the transition even when\n    /// the image being retrieved from cache, also call `forceRefresh()` on the returned `KF.Builder`.\n    public func fade(duration: TimeInterval) -> Self {\n        options.transition = .fade(duration)\n        return self\n    }\n    #endif\n\n    /// Sets whether keeping the existing image of image view while setting another image to it.\n    /// - Parameter enabled: Whether the existing image should be kept.\n    /// - Returns: A `KF.Builder` with changes applied.\n    ///\n    /// By setting this option, the placeholder image parameter of image view extension method\n    /// will be ignored and the current image will be kept while loading or downloading the new image.\n    ///\n    public func keepCurrentImageWhileLoading(_ enabled: Bool = true) -> Self {\n        options.keepCurrentImageWhileLoading = enabled\n        return self\n    }\n\n    /// Sets whether only the first frame from an animated image file should be loaded as a single image.\n    /// - Parameter enabled: Whether the only the first frame should be loaded.\n    /// - Returns: A `KF.Builder` with changes applied.\n    ///\n    /// Loading an animated images may take too much memory. It will be useful when you want to display a\n    /// static preview of the first frame from an animated image.\n    ///\n    /// This option will be ignored if the target image is not animated image data.\n    ///\n    public func onlyLoadFirstFrame(_ enabled: Bool = true) -> Self {\n        options.onlyLoadFirstFrame = enabled\n        return self\n    }\n\n    /// Sets the image that will be used if an image retrieving task fails.\n    /// - Parameter image: The image that will be used when something goes wrong.\n    /// - Returns: A `KF.Builder` with changes applied.\n    ///\n    /// If set and an image retrieving error occurred Kingfisher will set provided image (or empty)\n    /// in place of requested one. It's useful when you don't want to show placeholder\n    /// during loading time but wants to use some default image when requests will be failed.\n    ///\n    public func onFailureImage(_ image: KFCrossPlatformImage?) -> Self {\n        options.onFailureImage = .some(image)\n        return self\n    }\n\n    /// Enables progressive image loading with a specified `ImageProgressive` setting to process the\n    /// progressive JPEG data and display it in a progressive way.\n    /// - Parameter progressive: The progressive settings which is used while loading.\n    /// - Returns: A `KF.Builder` with changes applied.\n    public func progressiveJPEG(_ progressive: ImageProgressive? = .default) -> Self {\n        options.progressiveJPEG = progressive\n        return self\n    }\n}\n\n// MARK: - Redirect Handler\nextension KF {\n\n    /// Represents the detail information when a task redirect happens. It is wrapping necessary information for a\n    /// `ImageDownloadRedirectHandler`. See that protocol for more information.\n    public struct RedirectPayload {\n\n        /// The related session data task when the redirect happens. It is\n        /// the current `SessionDataTask` which triggers this redirect.\n        public let task: SessionDataTask\n\n        /// The response received during redirection.\n        public let response: HTTPURLResponse\n\n        /// The request for redirection which can be modified.\n        public let newRequest: URLRequest\n\n        /// A closure for being called with modified request.\n        public let completionHandler: (URLRequest?) -> Void\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/KFOptionsSetter.swift",
    "content": "//\n//  KFOptionsSetter.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2020/12/22.\n//\n//  Copyright (c) 2020 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport CoreGraphics\n\npublic protocol KFOptionSetter {\n    var options: KingfisherParsedOptionsInfo { get nonmutating set }\n\n    var onFailureDelegate: Delegate<KingfisherError, Void> { get }\n    var onSuccessDelegate: Delegate<RetrieveImageResult, Void> { get }\n    var onProgressDelegate: Delegate<(Int64, Int64), Void> { get }\n\n    var delegateObserver: AnyObject { get }\n}\n\nextension KF.Builder: KFOptionSetter {\n    public var delegateObserver: AnyObject { self }\n}\n\n#if canImport(SwiftUI) && canImport(Combine)\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension KFImage: KFOptionSetter {\n    public var options: KingfisherParsedOptionsInfo {\n        get { context.binder.options }\n        nonmutating set { context.binder.options = newValue }\n    }\n\n    public var onFailureDelegate: Delegate<KingfisherError, Void> { context.binder.onFailureDelegate }\n    public var onSuccessDelegate: Delegate<RetrieveImageResult, Void> { context.binder.onSuccessDelegate }\n    public var onProgressDelegate: Delegate<(Int64, Int64), Void> { context.binder.onProgressDelegate }\n\n    public var delegateObserver: AnyObject { context.binder }\n}\n#endif\n\n// MARK: - Life cycles\nextension KFOptionSetter {\n    /// Sets the progress block to current builder.\n    /// - Parameter block: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called. If `block` is `nil`, the callback\n    ///                    will be reset.\n    /// - Returns: A `Self` value with changes applied.\n    public func onProgress(_ block: DownloadProgressBlock?) -> Self {\n        onProgressDelegate.delegate(on: delegateObserver) { (observer, result) in\n            block?(result.0, result.1)\n        }\n        return self\n    }\n\n    /// Sets the the done block to current builder.\n    /// - Parameter block: Called when the image task successfully completes and the the image set is done. If `block`\n    ///                    is `nil`, the callback will be reset.\n    /// - Returns: A `KF.Builder` with changes applied.\n    public func onSuccess(_ block: ((RetrieveImageResult) -> Void)?) -> Self {\n        onSuccessDelegate.delegate(on: delegateObserver) { (observer, result) in\n            block?(result)\n        }\n        return self\n    }\n\n    /// Sets the catch block to current builder.\n    /// - Parameter block: Called when an error happens during the image task. If `block`\n    ///                    is `nil`, the callback will be reset.\n    /// - Returns: A `KF.Builder` with changes applied.\n    public func onFailure(_ block: ((KingfisherError) -> Void)?) -> Self {\n        onFailureDelegate.delegate(on: delegateObserver) { (observer, error) in\n            block?(error)\n        }\n        return self\n    }\n}\n\n// MARK: - Basic options settings.\nextension KFOptionSetter {\n    /// Sets the target image cache for this task.\n    /// - Parameter cache: The target cache is about to be used for the task.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// Kingfisher will use the associated `ImageCache` object when handling related operations,\n    /// including trying to retrieve the cached images and store the downloaded image to it.\n    ///\n    public func targetCache(_ cache: ImageCache) -> Self {\n        options.targetCache = cache\n        return self\n    }\n\n    /// Sets the target image cache to store the original downloaded image for this task.\n    /// - Parameter cache: The target cache is about to be used for storing the original downloaded image from the task.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// The `ImageCache` for storing and retrieving original images. If `originalCache` is\n    /// contained in the options, it will be preferred for storing and retrieving original images.\n    /// If there is no `.originalCache` in the options, `.targetCache` will be used to store original images.\n    ///\n    /// When using KingfisherManager to download and store an image, if `cacheOriginalImage` is\n    /// applied in the option, the original image will be stored to this `originalCache`. At the\n    /// same time, if a requested final image (with processor applied) cannot be found in `targetCache`,\n    /// Kingfisher will try to search the original image to check whether it is already there. If found,\n    /// it will be used and applied with the given processor. It is an optimization for not downloading\n    /// the same image for multiple times.\n    ///\n    public func originalCache(_ cache: ImageCache) -> Self {\n        options.originalCache = cache\n        return self\n    }\n\n    /// Sets the downloader used to perform the image download task.\n    /// - Parameter downloader: The downloader which is about to be used for downloading.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// Kingfisher will use the set `ImageDownloader` object to download the requested images.\n    public func downloader(_ downloader: ImageDownloader) -> Self {\n        options.downloader = downloader\n        return self\n    }\n\n    /// Sets the download priority for the image task.\n    /// - Parameter priority: The download priority of image download task.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// The `priority` value will be set as the priority of the image download task. The value for it should be\n    /// between 0.0~1.0. You can choose a value between `URLSessionTask.defaultPriority`, `URLSessionTask.lowPriority`\n    /// or `URLSessionTask.highPriority`. If this option not set, the default value (`URLSessionTask.defaultPriority`)\n    /// will be used.\n    public func downloadPriority(_ priority: Float) -> Self {\n        options.downloadPriority = priority\n        return self\n    }\n\n    /// Sets whether Kingfisher should ignore the cache and try to start a download task for the image source.\n    /// - Parameter enabled: Enable the force refresh or not.\n    /// - Returns: A `Self` value with changes applied.\n    public func forceRefresh(_ enabled: Bool = true) -> Self {\n        options.forceRefresh = enabled\n        return self\n    }\n\n    /// Sets whether Kingfisher should try to retrieve the image from memory cache first. If not found, it ignores the\n    /// disk cache and starts a download task for the image source.\n    /// - Parameter enabled: Enable the memory-only cache searching or not.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// This is useful when you want to display a changeable image behind the same url at the same app session, while\n    /// avoiding download it for multiple times.\n    public func fromMemoryCacheOrRefresh(_ enabled: Bool = true) -> Self {\n        options.fromMemoryCacheOrRefresh = enabled\n        return self\n    }\n\n    /// Sets whether the image should only be cached in memory but not in disk.\n    /// - Parameter enabled: Whether the image should be only cache in memory or not.\n    /// - Returns: A `Self` value with changes applied.\n    public func cacheMemoryOnly(_ enabled: Bool = true) -> Self {\n        options.cacheMemoryOnly = enabled\n        return self\n    }\n\n    /// Sets whether Kingfisher should wait for caching operation to be completed before calling the\n    /// `onSuccess` or `onFailure` block.\n    /// - Parameter enabled: Whether Kingfisher should wait for caching operation.\n    /// - Returns: A `Self` value with changes applied.\n    public func waitForCache(_ enabled: Bool = true) -> Self {\n        options.waitForCache = enabled\n        return self\n    }\n\n    /// Sets whether Kingfisher should only try to retrieve the image from cache, but not from network.\n    /// - Parameter enabled: Whether Kingfisher should only try to retrieve the image from cache.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// If the image is not in cache, the image retrieving will fail with the\n    /// `KingfisherError.cacheError` with `.imageNotExisting` as its reason.\n    public func onlyFromCache(_ enabled: Bool = true) -> Self {\n        options.onlyFromCache = enabled\n        return self\n    }\n\n    /// Sets whether the image should be decoded in a background thread before using.\n    /// - Parameter enabled: Whether the image should be decoded in a background thread before using.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// Setting to `true` will decode the downloaded image data and do a off-screen rendering to extract pixel\n    /// information in background. This can speed up display, but will cost more time and memory to prepare the image\n    /// for using.\n    public func backgroundDecode(_ enabled: Bool = true) -> Self {\n        options.backgroundDecode = enabled\n        return self\n    }\n\n    /// Sets the callback queue which is used as the target queue of dispatch callbacks when retrieving images from\n    ///  cache. If not set, Kingfisher will use main queue for callbacks.\n    /// - Parameter queue: The target queue which the cache retrieving callback will be invoked on.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// - Note:\n    /// This option does not affect the callbacks for UI related extension methods or `KFImage` result handlers.\n    /// You will always get the callbacks called from main queue.\n    public func callbackQueue(_ queue: CallbackQueue) -> Self {\n        options.callbackQueue = queue\n        return self\n    }\n\n    /// Sets the scale factor value when converting retrieved data to an image.\n    /// - Parameter factor: The scale factor value.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// Specify the image scale, instead of your screen scale. You may need to set the correct scale when you dealing\n    /// with 2x or 3x retina images. Otherwise, Kingfisher will convert the data to image object at `scale` 1.0.\n    ///\n    public func scaleFactor(_ factor: CGFloat) -> Self {\n        options.scaleFactor = factor\n        return self\n    }\n\n    /// Sets whether the original image should be cached even when the original image has been processed by any other\n    /// `ImageProcessor`s.\n    /// - Parameter enabled: Whether the original image should be cached.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// If set and an `ImageProcessor` is used, Kingfisher will try to cache both the final result and original\n    /// image. Kingfisher will have a chance to use the original image when another processor is applied to the same\n    /// resource, instead of downloading it again. You can use `.originalCache` to specify a cache or the original\n    /// images if necessary.\n    ///\n    /// The original image will be only cached to disk storage.\n    ///\n    public func cacheOriginalImage(_ enabled: Bool = true) -> Self {\n        options.cacheOriginalImage = enabled\n        return self\n    }\n\n    /// Sets whether the disk storage loading should happen in the same calling queue.\n    /// - Parameter enabled: Whether the disk storage loading should happen in the same calling queue.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// By default, disk storage file loading\n    /// happens in its own queue with an asynchronous dispatch behavior. Although it provides better non-blocking disk\n    /// loading performance, it also causes a flickering when you reload an image from disk, if the image view already\n    /// has an image set.\n    ///\n    /// Set this options will stop that flickering by keeping all loading in the same queue (typically the UI queue\n    /// if you are using Kingfisher's extension methods to set an image), with a tradeoff of loading performance.\n    ///\n    public func loadDiskFileSynchronously(_ enabled: Bool = true) -> Self {\n        options.loadDiskFileSynchronously = enabled\n        return self\n    }\n\n    /// Sets a queue on which the image processing should happen.\n    /// - Parameter queue: The queue on which the image processing should happen.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// By default, Kingfisher uses a pre-defined serial\n    /// queue to process images. Use this option to change this behavior. For example, specify a `.mainCurrentOrAsync`\n    /// to let the image be processed in main queue to prevent a possible flickering (but with a possibility of\n    /// blocking the UI, especially if the processor needs a lot of time to run).\n    public func processingQueue(_ queue: CallbackQueue?) -> Self {\n        options.processingQueue = queue\n        return self\n    }\n\n    /// Sets the alternative sources that will be used when loading of the original input `Source` fails.\n    /// - Parameter sources: The alternative sources will be used.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// Values of the `sources` array will be used to start a new image loading task if the previous task\n    /// fails due to an error. The image source loading process will stop as soon as a source is loaded successfully.\n    /// If all `sources` are used but the loading is still failing, an `imageSettingError` with\n    /// `alternativeSourcesExhausted` as its reason will be given out in the `catch` block.\n    ///\n    /// This is useful if you want to implement a fallback solution for setting image.\n    ///\n    /// User cancellation will not trigger the alternative source loading.\n    public func alternativeSources(_ sources: [Source]?) -> Self {\n        options.alternativeSources = sources\n        return self\n    }\n\n    /// Sets a retry strategy that will be used when something gets wrong during the image retrieving.\n    /// - Parameter strategy: The provided strategy to define how the retrying should happen.\n    /// - Returns: A `Self` value with changes applied.\n    public func retry(_ strategy: RetryStrategy) -> Self {\n        options.retryStrategy = strategy\n        return self\n    }\n\n    /// Sets a retry strategy with a max retry count and retrying interval.\n    /// - Parameters:\n    ///   - maxCount: The maximum count before the retry stops.\n    ///   - interval: The time interval between each retry attempt.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// This defines the simplest retry strategy, which retry a failing request for several times, with some certain\n    /// interval between each time. For example, `.retry(maxCount: 3, interval: .second(3))` means attempt for at most\n    /// three times, and wait for 3 seconds if a previous retry attempt fails, then start a new attempt.\n    public func retry(maxCount: Int, interval: DelayRetryStrategy.Interval = .seconds(3)) -> Self {\n        let strategy = DelayRetryStrategy(maxRetryCount: maxCount, retryInterval: interval)\n        options.retryStrategy = strategy\n        return self\n    }\n\n    /// Sets the `Source` should be loaded when user enables Low Data Mode and the original source fails with an\n    /// `NSURLErrorNetworkUnavailableReason.constrained` error.\n    /// - Parameter source: The `Source` will be loaded under low data mode.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// When this option is set, the\n    /// `allowsConstrainedNetworkAccess` property of the request for the original source will be set to `false` and the\n    /// `Source` in associated value will be used to retrieve the image for low data mode. Usually, you can provide a\n    /// low-resolution version of your image or a local image provider to display a placeholder.\n    ///\n    /// If not set or the `source` is `nil`, the device Low Data Mode will be ignored and the original source will\n    /// be loaded following the system default behavior, in a normal way.\n    public func lowDataModeSource(_ source: Source?) -> Self {\n        options.lowDataModeSource = source\n        return self\n    }\n\n    /// Sets whether the image setting for an image view should happen with transition even when retrieved from cache.\n    /// - Parameter enabled: Enable the force transition or not.\n    /// - Returns: A `KF.Builder` with changes applied.\n    public func forceTransition(_ enabled: Bool = true) -> Self {\n        options.forceTransition = enabled\n        return self\n    }\n\n}\n\n// MARK: - Request Modifier\nextension KFOptionSetter {\n    /// Sets an `ImageDownloadRequestModifier` to change the image download request before it being sent.\n    /// - Parameter modifier: The modifier will be used to change the request before it being sent.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// This is the last chance you can modify the image download request. You can modify the request for some\n    /// customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url mapping.\n    ///\n    public func requestModifier(_ modifier: ImageDownloadRequestModifier) -> Self {\n        options.requestModifier = modifier\n        return self\n    }\n\n    /// Sets a block to change the image download request before it being sent.\n    /// - Parameter modifyBlock: The modifying block will be called to change the request before it being sent.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// This is the last chance you can modify the image download request. You can modify the request for some\n    /// customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url mapping.\n    ///\n    public func requestModifier(_ modifyBlock: @escaping (inout URLRequest) -> Void) -> Self {\n        options.requestModifier = AnyModifier { r -> URLRequest? in\n            var request = r\n            modifyBlock(&request)\n            return request\n        }\n        return self\n    }\n}\n\n// MARK: - Redirect Handler\nextension KFOptionSetter {\n    /// The `ImageDownloadRedirectHandler` argument will be used to change the request before redirection.\n    /// This is the possibility you can modify the image download request during redirect. You can modify the request for\n    /// some customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url\n    /// mapping.\n    /// The original redirection request will be sent without any modification by default.\n    /// - Parameter handler: The handler will be used for redirection.\n    /// - Returns: A `Self` value with changes applied.\n    public func redirectHandler(_ handler: ImageDownloadRedirectHandler) -> Self {\n        options.redirectHandler = handler\n        return self\n    }\n\n    /// The `block` will be used to change the request before redirection.\n    /// This is the possibility you can modify the image download request during redirect. You can modify the request for\n    /// some customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url\n    /// mapping.\n    /// The original redirection request will be sent without any modification by default.\n    /// - Parameter block: The block will be used for redirection.\n    /// - Returns: A `Self` value with changes applied.\n    public func redirectHandler(_ block: @escaping (KF.RedirectPayload) -> Void) -> Self {\n        let redirectHandler = AnyRedirectHandler { (task, response, request, handler) in\n            let payload = KF.RedirectPayload(\n                task: task, response: response, newRequest: request, completionHandler: handler\n            )\n            block(payload)\n        }\n        options.redirectHandler = redirectHandler\n        return self\n    }\n}\n\n// MARK: - Processor\nextension KFOptionSetter {\n\n    /// Sets an image processor for the image task. It replaces the current image processor settings.\n    ///\n    /// - Parameter processor: The processor you want to use to process the image after it is downloaded.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// - Note:\n    /// To append a processor to current ones instead of replacing them all, use `appendProcessor(_:)`.\n    public func setProcessor(_ processor: ImageProcessor) -> Self {\n        options.processor = processor\n        return self\n    }\n\n    /// Sets an array of image processors for the image task. It replaces the current image processor settings.\n    /// - Parameter processors: An array of processors. The processors inside this array will be concatenated one by one\n    ///                         to form a processor pipeline.\n    /// - Returns: A `Self` value with changes applied.\n    ///\n    /// - Note:\n    /// To append processors to current ones instead of replacing them all, concatenate them by `|>`, then use\n    /// `appendProcessor(_:)`.\n    public func setProcessors(_ processors: [ImageProcessor]) -> Self {\n        switch processors.count {\n        case 0:\n            options.processor = DefaultImageProcessor.default\n        case 1...:\n            options.processor = processors.dropFirst().reduce(processors[0]) { $0 |> $1 }\n        default:\n            assertionFailure(\"Never happen\")\n        }\n        return self\n    }\n\n    /// Appends a processor to the current set processors.\n    /// - Parameter processor: The processor which will be appended to current processor settings.\n    /// - Returns: A `Self` value with changes applied.\n    public func appendProcessor(_ processor: ImageProcessor) -> Self {\n        options.processor = options.processor |> processor\n        return self\n    }\n\n    /// Appends a `RoundCornerImageProcessor` to current processors.\n    /// - Parameters:\n    ///   - radius: The radius will be applied in processing. Specify a certain point value with `.point`, or a fraction\n    ///             of the target image with `.widthFraction`. or `.heightFraction`. For example, given a square image\n    ///             with width and height equals,  `.widthFraction(0.5)` means use half of the length of size and makes\n    ///             the final image a round one.\n    ///   - targetSize: Target size of output image should be. If `nil`, the image will keep its original size after processing.\n    ///   - corners: The target corners which will be applied rounding.\n    ///   - backgroundColor: Background color of the output image. If `nil`, it will use a transparent background.\n    /// - Returns: A `Self` value with changes applied.\n    public func roundCorner(\n        radius: RoundCornerImageProcessor.Radius,\n        targetSize: CGSize? = nil,\n        roundingCorners corners: RectCorner = .all,\n        backgroundColor: KFCrossPlatformColor? = nil\n    ) -> Self\n    {\n        let processor = RoundCornerImageProcessor(\n            radius: radius,\n            targetSize: targetSize,\n            roundingCorners: corners,\n            backgroundColor: backgroundColor\n        )\n        return appendProcessor(processor)\n    }\n\n    /// Appends a `BlurImageProcessor` to current processors.\n    /// - Parameter radius: Blur radius for the simulated Gaussian blur.\n    /// - Returns: A `Self` value with changes applied.\n    public func blur(radius: CGFloat) -> Self {\n        appendProcessor(\n            BlurImageProcessor(blurRadius: radius)\n        )\n    }\n\n    /// Appends a `OverlayImageProcessor` to current processors.\n    /// - Parameters:\n    ///   - color: Overlay color will be used to overlay the input image.\n    ///   - fraction: Fraction will be used when overlay the color to image.\n    /// - Returns: A `Self` value with changes applied.\n    public func overlay(color: KFCrossPlatformColor, fraction: CGFloat = 0.5) -> Self {\n        appendProcessor(\n            OverlayImageProcessor(overlay: color, fraction: fraction)\n        )\n    }\n\n    /// Appends a `TintImageProcessor` to current processors.\n    /// - Parameter color: Tint color will be used to tint the input image.\n    /// - Returns: A `Self` value with changes applied.\n    public func tint(color: KFCrossPlatformColor) -> Self {\n        appendProcessor(\n            TintImageProcessor(tint: color)\n        )\n    }\n\n    /// Appends a `BlackWhiteProcessor` to current processors.\n    /// - Returns: A `Self` value with changes applied.\n    public func blackWhite() -> Self {\n        appendProcessor(\n            BlackWhiteProcessor()\n        )\n    }\n\n    /// Appends a `CroppingImageProcessor` to current processors.\n    /// - Parameters:\n    ///   - size: Target size of output image should be.\n    ///   - anchor: Anchor point from which the output size should be calculate. The anchor point is consisted by two\n    ///             values between 0.0 and 1.0. It indicates a related point in current image.\n    ///             See `CroppingImageProcessor.init(size:anchor:)` for more.\n    /// - Returns: A `Self` value with changes applied.\n    public func cropping(size: CGSize, anchor: CGPoint = .init(x: 0.5, y: 0.5)) -> Self {\n        appendProcessor(\n            CroppingImageProcessor(size: size, anchor: anchor)\n        )\n    }\n\n    /// Appends a `DownsamplingImageProcessor` to current processors.\n    ///\n    /// Compared to `ResizingImageProcessor`, the `DownsamplingImageProcessor` does not render the original images and\n    /// then resize it. Instead, it downsamples the input data directly to a thumbnail image. So it is a more efficient\n    /// than `ResizingImageProcessor`. Prefer to use `DownsamplingImageProcessor` as possible\n    /// as you can than the `ResizingImageProcessor`.\n    ///\n    /// Only CG-based images are supported. Animated images (like GIF) is not supported.\n    ///\n    /// - Parameter size: Target size of output image should be. It should be smaller than the size of input image.\n    ///                   If it is larger, the result image will be the same size of input data without downsampling.\n    /// - Returns: A `Self` value with changes applied.\n    public func downsampling(size: CGSize) -> Self {\n        let processor = DownsamplingImageProcessor(size: size)\n        if options.processor == DefaultImageProcessor.default {\n            return setProcessor(processor)\n        } else {\n            return appendProcessor(processor)\n        }\n    }\n\n\n    /// Appends a `ResizingImageProcessor` to current processors.\n    ///\n    /// If you need to resize a data represented image to a smaller size, use `DownsamplingImageProcessor`\n    /// instead, which is more efficient and uses less memory.\n    ///\n    /// - Parameters:\n    ///   - referenceSize: The reference size for resizing operation in point.\n    ///   - mode: Target content mode of output image should be. Default is `.none`.\n    /// - Returns: A `Self` value with changes applied.\n    public func resizing(referenceSize: CGSize, mode: ContentMode = .none) -> Self {\n        appendProcessor(\n            ResizingImageProcessor(referenceSize: referenceSize, mode: mode)\n        )\n    }\n}\n\n// MARK: - Cache Serializer\nextension KFOptionSetter {\n\n    /// Uses a given `CacheSerializer` to convert some data to an image object for retrieving from disk cache or vice\n    /// versa for storing to disk cache.\n    /// - Parameter cacheSerializer: The `CacheSerializer` which will be used.\n    /// - Returns: A `Self` value with changes applied.\n    public func serialize(by cacheSerializer: CacheSerializer) -> Self {\n        options.cacheSerializer = cacheSerializer\n        return self\n    }\n\n    /// Uses a given format to serializer the image data to disk. It converts the image object to the give data format.\n    /// - Parameters:\n    ///   - format: The desired data encoding format when store the image on disk.\n    ///   - jpegCompressionQuality: If the format is `.JPEG`, it specify the compression quality when converting the\n    ///                             image to a JPEG data. Otherwise, it is ignored.\n    /// - Returns: A `Self` value with changes applied.\n    public func serialize(as format: ImageFormat, jpegCompressionQuality: CGFloat? = nil) -> Self {\n        let cacheSerializer: FormatIndicatedCacheSerializer\n        switch format {\n        case .JPEG:\n            cacheSerializer = .jpeg(compressionQuality: jpegCompressionQuality ?? 1.0)\n        case .PNG:\n            cacheSerializer = .png\n        case .GIF:\n            cacheSerializer = .gif\n        case .unknown:\n            cacheSerializer = .png\n        }\n        options.cacheSerializer = cacheSerializer\n        return self\n    }\n}\n\n// MARK: - Image Modifier\nextension KFOptionSetter {\n\n    /// Sets an `ImageModifier` to the image task. Use this to modify the fetched image object properties if needed.\n    ///\n    /// If the image was fetched directly from the downloader, the modifier will run directly after the\n    /// `ImageProcessor`. If the image is being fetched from a cache, the modifier will run after the `CacheSerializer`.\n    /// - Parameter modifier: The `ImageModifier` which will be used to modify the image object.\n    /// - Returns: A `Self` value with changes applied.\n    public func imageModifier(_ modifier: ImageModifier?) -> Self {\n        options.imageModifier = modifier\n        return self\n    }\n\n    /// Sets a block to modify the image object. Use this to modify the fetched image object properties if needed.\n    ///\n    /// If the image was fetched directly from the downloader, the modifier block will run directly after the\n    /// `ImageProcessor`. If the image is being fetched from a cache, the modifier will run after the `CacheSerializer`.\n    ///\n    /// - Parameter block: The block which is used to modify the image object.\n    /// - Returns: A `Self` value with changes applied.\n    public func imageModifier(_ block: @escaping (inout KFCrossPlatformImage) throws -> Void) -> Self {\n        let modifier = AnyImageModifier { image -> KFCrossPlatformImage in\n            var image = image\n            try block(&image)\n            return image\n        }\n        options.imageModifier = modifier\n        return self\n    }\n}\n\n\n// MARK: - Cache Expiration\nextension KFOptionSetter {\n\n    /// Sets the expiration setting for memory cache of this image task.\n    ///\n    /// By default, the underlying `MemoryStorage.Backend` uses the\n    /// expiration in its config for all items. If set, the `MemoryStorage.Backend` will use this value to overwrite\n    /// the config setting for this caching item.\n    ///\n    /// - Parameter expiration: The expiration setting used in cache storage.\n    /// - Returns: A `Self` value with changes applied.\n    public func memoryCacheExpiration(_ expiration: StorageExpiration?) -> Self {\n        options.memoryCacheExpiration = expiration\n        return self\n    }\n\n    /// Sets the expiration extending setting for memory cache. The item expiration time will be incremented by this\n    /// value after access.\n    ///\n    /// By default, the underlying `MemoryStorage.Backend` uses the initial cache expiration as extending\n    /// value: .cacheTime.\n    ///\n    /// To disable extending option at all, sets `.none` to it.\n    ///\n    /// - Parameter extending: The expiration extending setting used in cache storage.\n    /// - Returns: A `Self` value with changes applied.\n    public func memoryCacheAccessExtending(_ extending: ExpirationExtending) -> Self {\n        options.memoryCacheAccessExtendingExpiration = extending\n        return self\n    }\n\n    /// Sets the expiration setting for disk cache of this image task.\n    ///\n    /// By default, the underlying `DiskStorage.Backend` uses the expiration in its config for all items. If set,\n    /// the `DiskStorage.Backend` will use this value to overwrite the config setting for this caching item.\n    ///\n    /// - Parameter expiration: The expiration setting used in cache storage.\n    /// - Returns: A `Self` value with changes applied.\n    public func diskCacheExpiration(_ expiration: StorageExpiration?) -> Self {\n        options.diskCacheExpiration = expiration\n        return self\n    }\n\n    /// Sets the expiration extending setting for disk cache. The item expiration time will be incremented by this\n    /// value after access.\n    ///\n    /// By default, the underlying `DiskStorage.Backend` uses the initial cache expiration as extending\n    /// value: .cacheTime.\n    ///\n    /// To disable extending option at all, sets `.none` to it.\n    ///\n    /// - Parameter extending: The expiration extending setting used in cache storage.\n    /// - Returns: A `Self` value with changes applied.\n    public func diskCacheAccessExtending(_ extending: ExpirationExtending) -> Self {\n        options.diskCacheAccessExtendingExpiration = extending\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/Kingfisher.swift",
    "content": "//\n//  Kingfisher.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 16/9/14.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport ImageIO\n\n#if os(macOS)\nimport AppKit\npublic typealias KFCrossPlatformImage = NSImage\npublic typealias KFCrossPlatformView = NSView\npublic typealias KFCrossPlatformColor = NSColor\npublic typealias KFCrossPlatformImageView = NSImageView\npublic typealias KFCrossPlatformButton = NSButton\n#else\nimport UIKit\npublic typealias KFCrossPlatformImage = UIImage\npublic typealias KFCrossPlatformColor = UIColor\n#if !os(watchOS)\npublic typealias KFCrossPlatformImageView = UIImageView\npublic typealias KFCrossPlatformView = UIView\npublic typealias KFCrossPlatformButton = UIButton\n#if canImport(TVUIKit)\nimport TVUIKit\n#endif\n#else\nimport WatchKit\n#endif\n#endif\n\n/// Wrapper for Kingfisher compatible types. This type provides an extension point for\n/// connivence methods in Kingfisher.\npublic struct KingfisherWrapper<Base> {\n    public let base: Base\n    public init(_ base: Base) {\n        self.base = base\n    }\n}\n\n/// Represents an object type that is compatible with Kingfisher. You can use `kf` property to get a\n/// value in the namespace of Kingfisher.\npublic protocol KingfisherCompatible: AnyObject { }\n\n/// Represents a value type that is compatible with Kingfisher. You can use `kf` property to get a\n/// value in the namespace of Kingfisher.\npublic protocol KingfisherCompatibleValue {}\n\nextension KingfisherCompatible {\n    /// Gets a namespace holder for Kingfisher compatible types.\n    public var kf: KingfisherWrapper<Self> {\n        get { return KingfisherWrapper(self) }\n        set { }\n    }\n}\n\nextension KingfisherCompatibleValue {\n    /// Gets a namespace holder for Kingfisher compatible types.\n    public var kf: KingfisherWrapper<Self> {\n        get { return KingfisherWrapper(self) }\n        set { }\n    }\n}\n\nextension KFCrossPlatformImage: KingfisherCompatible { }\n#if !os(watchOS)\nextension KFCrossPlatformImageView: KingfisherCompatible { }\nextension KFCrossPlatformButton: KingfisherCompatible { }\nextension NSTextAttachment: KingfisherCompatible { }\n#else\nextension WKInterfaceImage: KingfisherCompatible { }\n#endif\n\n#if os(tvOS) && canImport(TVUIKit)\n@available(tvOS 12.0, *)\nextension TVMonogramView: KingfisherCompatible { }\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/KingfisherError.swift",
    "content": "//\n//  KingfisherError.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/09/26.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nextension Never {}\n\n/// Represents all the errors which can happen in Kingfisher framework.\n/// Kingfisher related methods always throw a `KingfisherError` or invoke the callback with `KingfisherError`\n/// as its error type. To handle errors from Kingfisher, you switch over the error to get a reason catalog,\n/// then switch over the reason to know error detail.\npublic enum KingfisherError: Error {\n\n    // MARK: Error Reason Types\n\n    /// Represents the error reason during networking request phase.\n    ///\n    /// - emptyRequest: The request is empty. Code 1001.\n    /// - invalidURL: The URL of request is invalid. Code 1002.\n    /// - taskCancelled: The downloading task is cancelled by user. Code 1003.\n    public enum RequestErrorReason {\n        \n        /// The request is empty. Code 1001.\n        case emptyRequest\n        \n        /// The URL of request is invalid. Code 1002.\n        /// - request: The request is tend to be sent but its URL is invalid.\n        case invalidURL(request: URLRequest)\n        \n        /// The downloading task is cancelled by user. Code 1003.\n        /// - task: The session data task which is cancelled.\n        /// - token: The cancel token which is used for cancelling the task.\n        case taskCancelled(task: SessionDataTask, token: SessionDataTask.CancelToken)\n    }\n    \n    /// Represents the error reason during networking response phase.\n    ///\n    /// - invalidURLResponse: The response is not a valid URL response. Code 2001.\n    /// - invalidHTTPStatusCode: The response contains an invalid HTTP status code. Code 2002.\n    /// - URLSessionError: An error happens in the system URL session. Code 2003.\n    /// - dataModifyingFailed: Data modifying fails on returning a valid data. Code 2004.\n    /// - noURLResponse: The task is done but no URL response found. Code 2005.\n    public enum ResponseErrorReason {\n        \n        /// The response is not a valid URL response. Code 2001.\n        /// - response: The received invalid URL response.\n        ///             The response is expected to be an HTTP response, but it is not.\n        case invalidURLResponse(response: URLResponse)\n        \n        /// The response contains an invalid HTTP status code. Code 2002.\n        /// - Note:\n        ///   By default, status code 200..<400 is recognized as valid. You can override\n        ///   this behavior by conforming to the `ImageDownloaderDelegate`.\n        /// - response: The received response.\n        case invalidHTTPStatusCode(response: HTTPURLResponse)\n        \n        /// An error happens in the system URL session. Code 2003.\n        /// - error: The underlying URLSession error object.\n        case URLSessionError(error: Error)\n        \n        /// Data modifying fails on returning a valid data. Code 2004.\n        /// - task: The failed task.\n        case dataModifyingFailed(task: SessionDataTask)\n        \n        /// The task is done but no URL response found. Code 2005.\n        /// - task: The failed task.\n        case noURLResponse(task: SessionDataTask)\n    }\n    \n    /// Represents the error reason during Kingfisher caching system.\n    ///\n    /// - fileEnumeratorCreationFailed: Cannot create a file enumerator for a certain disk URL. Code 3001.\n    /// - invalidFileEnumeratorContent: Cannot get correct file contents from a file enumerator. Code 3002.\n    /// - invalidURLResource: The file at target URL exists, but its URL resource is unavailable. Code 3003.\n    /// - cannotLoadDataFromDisk: The file at target URL exists, but the data cannot be loaded from it. Code 3004.\n    /// - cannotCreateDirectory: Cannot create a folder at a given path. Code 3005.\n    /// - imageNotExisting: The requested image does not exist in cache. Code 3006.\n    /// - cannotConvertToData: Cannot convert an object to data for storing. Code 3007.\n    /// - cannotSerializeImage: Cannot serialize an image to data for storing. Code 3008.\n    /// - cannotCreateCacheFile: Cannot create the cache file at a certain fileURL under a key. Code 3009.\n    /// - cannotSetCacheFileAttribute: Cannot set file attributes to a cached file. Code 3010.\n    public enum CacheErrorReason {\n        \n        /// Cannot create a file enumerator for a certain disk URL. Code 3001.\n        /// - url: The target disk URL from which the file enumerator should be created.\n        case fileEnumeratorCreationFailed(url: URL)\n        \n        /// Cannot get correct file contents from a file enumerator. Code 3002.\n        /// - url: The target disk URL from which the content of a file enumerator should be got.\n        case invalidFileEnumeratorContent(url: URL)\n        \n        /// The file at target URL exists, but its URL resource is unavailable. Code 3003.\n        /// - error: The underlying error thrown by file manager.\n        /// - key: The key used to getting the resource from cache.\n        /// - url: The disk URL where the target cached file exists.\n        case invalidURLResource(error: Error, key: String, url: URL)\n        \n        /// The file at target URL exists, but the data cannot be loaded from it. Code 3004.\n        /// - url: The disk URL where the target cached file exists.\n        /// - error: The underlying error which describes why this error happens.\n        case cannotLoadDataFromDisk(url: URL, error: Error)\n        \n        /// Cannot create a folder at a given path. Code 3005.\n        /// - path: The disk path where the directory creating operation fails.\n        /// - error: The underlying error which describes why this error happens.\n        case cannotCreateDirectory(path: String, error: Error)\n        \n        /// The requested image does not exist in cache. Code 3006.\n        /// - key: Key of the requested image in cache.\n        case imageNotExisting(key: String)\n        \n        /// Cannot convert an object to data for storing. Code 3007.\n        /// - object: The object which needs be convert to data.\n        case cannotConvertToData(object: Any, error: Error)\n        \n        /// Cannot serialize an image to data for storing. Code 3008.\n        /// - image: The input image needs to be serialized to cache.\n        /// - original: The original image data, if exists.\n        /// - serializer: The `CacheSerializer` used for the image serializing.\n        case cannotSerializeImage(image: KFCrossPlatformImage?, original: Data?, serializer: CacheSerializer)\n\n        /// Cannot create the cache file at a certain fileURL under a key. Code 3009.\n        /// - fileURL: The url where the cache file should be created.\n        /// - key: The cache key used for the cache. When caching a file through `KingfisherManager` and Kingfisher's\n        ///        extension method, it is the resolved cache key based on your input `Source` and the image processors.\n        /// - data: The data to be cached.\n        /// - error: The underlying error originally thrown by Foundation when writing the `data` to the disk file at\n        ///          `fileURL`.\n        case cannotCreateCacheFile(fileURL: URL, key: String, data: Data, error: Error)\n\n        /// Cannot set file attributes to a cached file. Code 3010.\n        /// - filePath: The path of target cache file.\n        /// - attributes: The file attribute to be set to the target file.\n        /// - error: The underlying error originally thrown by Foundation when setting the `attributes` to the disk\n        ///          file at `filePath`.\n        case cannotSetCacheFileAttribute(filePath: String, attributes: [FileAttributeKey : Any], error: Error)\n\n        /// The disk storage of cache is not ready. Code 3011.\n        ///\n        /// This is usually due to extremely lack of space on disk storage, and\n        /// Kingfisher failed even when creating the cache folder. The disk storage will be in unusable state. Normally,\n        /// ask user to free some spaces and restart the app to make the disk storage work again.\n        /// - cacheURL: The intended URL which should be the storage folder.\n        case diskStorageIsNotReady(cacheURL: URL)\n    }\n    \n    \n    /// Represents the error reason during image processing phase.\n    ///\n    /// - processingFailed: Image processing fails. There is no valid output image from the processor. Code 4001.\n    public enum ProcessorErrorReason {\n        /// Image processing fails. There is no valid output image from the processor. Code 4001.\n        /// - processor: The `ImageProcessor` used to process the image or its data in `item`.\n        /// - item: The image or its data content.\n        case processingFailed(processor: ImageProcessor, item: ImageProcessItem)\n    }\n\n    /// Represents the error reason during image setting in a view related class.\n    ///\n    /// - emptySource: The input resource is empty or `nil`. Code 5001.\n    /// - notCurrentSourceTask: The source task is finished, but it is not the one expected now. Code 5002.\n    /// - dataProviderError: An error happens during getting data from an `ImageDataProvider`. Code 5003.\n    public enum ImageSettingErrorReason {\n        \n        /// The input resource is empty or `nil`. Code 5001.\n        case emptySource\n        \n        /// The resource task is finished, but it is not the one expected now. This usually happens when you set another\n        /// resource on the view without cancelling the current on-going one. The previous setting task will fail with\n        /// this `.notCurrentSourceTask` error when a result got, regardless of it being successful or not for that task.\n        /// The result of this original task is contained in the associated value.\n        /// Code 5002.\n        /// - result: The `RetrieveImageResult` if the source task is finished without problem. `nil` if an error\n        ///           happens.\n        /// - error: The `Error` if an issue happens during image setting task. `nil` if the task finishes without\n        ///          problem.\n        /// - source: The original source value of the task.\n        case notCurrentSourceTask(result: RetrieveImageResult?, error: Error?, source: Source)\n\n        /// An error happens during getting data from an `ImageDataProvider`. Code 5003.\n        case dataProviderError(provider: ImageDataProvider, error: Error)\n\n        /// No more alternative `Source` can be used in current loading process. It means that the\n        /// `.alternativeSources` are used and Kingfisher tried to recovery from the original error, but still\n        /// fails for all the given alternative sources. The associated value holds all the errors encountered during\n        /// the load process, including the original source loading error and all the alternative sources errors.\n        /// Code 5004.\n        case alternativeSourcesExhausted([PropagationError])\n    }\n\n    // MARK: Member Cases\n    \n    /// Represents the error reason during networking request phase.\n    case requestError(reason: RequestErrorReason)\n    /// Represents the error reason during networking response phase.\n    case responseError(reason: ResponseErrorReason)\n    /// Represents the error reason during Kingfisher caching system.\n    case cacheError(reason: CacheErrorReason)\n    /// Represents the error reason during image processing phase.\n    case processorError(reason: ProcessorErrorReason)\n    /// Represents the error reason during image setting in a view related class.\n    case imageSettingError(reason: ImageSettingErrorReason)\n\n    // MARK: Helper Properties & Methods\n\n    /// Helper property to check whether this error is a `RequestErrorReason.taskCancelled` or not.\n    public var isTaskCancelled: Bool {\n        if case .requestError(reason: .taskCancelled) = self {\n            return true\n        }\n        return false\n    }\n\n    /// Helper method to check whether this error is a `ResponseErrorReason.invalidHTTPStatusCode` and the\n    /// associated value is a given status code.\n    ///\n    /// - Parameter code: The given status code.\n    /// - Returns: If `self` is a `ResponseErrorReason.invalidHTTPStatusCode` error\n    ///            and its status code equals to `code`, `true` is returned. Otherwise, `false`.\n    public func isInvalidResponseStatusCode(_ code: Int) -> Bool {\n        if case .responseError(reason: .invalidHTTPStatusCode(let response)) = self {\n            return response.statusCode == code\n        }\n        return false\n    }\n\n    public var isInvalidResponseStatusCode: Bool {\n        if case .responseError(reason: .invalidHTTPStatusCode) = self {\n            return true\n        }\n        return false\n    }\n\n    /// Helper property to check whether this error is a `ImageSettingErrorReason.notCurrentSourceTask` or not.\n    /// When a new image setting task starts while the old one is still running, the new task identifier will be\n    /// set and the old one is overwritten. A `.notCurrentSourceTask` error will be raised when the old task finishes\n    /// to let you know the setting process finishes with a certain result, but the image view or button is not set.\n    public var isNotCurrentTask: Bool {\n        if case .imageSettingError(reason: .notCurrentSourceTask(_, _, _)) = self {\n            return true\n        }\n        return false\n    }\n\n    var isLowDataModeConstrained: Bool {\n        if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *),\n           case .responseError(reason: .URLSessionError(let sessionError)) = self,\n           let urlError = sessionError as? URLError,\n           urlError.networkUnavailableReason == .constrained\n        {\n            return true\n        }\n        return false\n    }\n\n}\n\n// MARK: - LocalizedError Conforming\nextension KingfisherError: LocalizedError {\n    \n    /// A localized message describing what error occurred.\n    public var errorDescription: String? {\n        switch self {\n        case .requestError(let reason): return reason.errorDescription\n        case .responseError(let reason): return reason.errorDescription\n        case .cacheError(let reason): return reason.errorDescription\n        case .processorError(let reason): return reason.errorDescription\n        case .imageSettingError(let reason): return reason.errorDescription\n        }\n    }\n}\n\n\n// MARK: - CustomNSError Conforming\nextension KingfisherError: CustomNSError {\n\n    /// The error domain of `KingfisherError`. All errors from Kingfisher is under this domain.\n    public static let domain = \"com.onevcat.Kingfisher.Error\"\n\n    /// The error code within the given domain.\n    public var errorCode: Int {\n        switch self {\n        case .requestError(let reason): return reason.errorCode\n        case .responseError(let reason): return reason.errorCode\n        case .cacheError(let reason): return reason.errorCode\n        case .processorError(let reason): return reason.errorCode\n        case .imageSettingError(let reason): return reason.errorCode\n        }\n    }\n}\n\nextension KingfisherError.RequestErrorReason {\n    var errorDescription: String? {\n        switch self {\n        case .emptyRequest:\n            return \"The request is empty or `nil`.\"\n        case .invalidURL(let request):\n            return \"The request contains an invalid or empty URL. Request: \\(request).\"\n        case .taskCancelled(let task, let token):\n            return \"The session task was cancelled. Task: \\(task), cancel token: \\(token).\"\n        }\n    }\n    \n    var errorCode: Int {\n        switch self {\n        case .emptyRequest: return 1001\n        case .invalidURL: return 1002\n        case .taskCancelled: return 1003\n        }\n    }\n}\n\nextension KingfisherError.ResponseErrorReason {\n    var errorDescription: String? {\n        switch self {\n        case .invalidURLResponse(let response):\n            return \"The URL response is invalid: \\(response)\"\n        case .invalidHTTPStatusCode(let response):\n            return \"The HTTP status code in response is invalid. Code: \\(response.statusCode), response: \\(response).\"\n        case .URLSessionError(let error):\n            return \"A URL session error happened. The underlying error: \\(error)\"\n        case .dataModifyingFailed(let task):\n            return \"The data modifying delegate returned `nil` for the downloaded data. Task: \\(task).\"\n        case .noURLResponse(let task):\n            return \"No URL response received. Task: \\(task),\"\n        }\n    }\n    \n    var errorCode: Int {\n        switch self {\n        case .invalidURLResponse: return 2001\n        case .invalidHTTPStatusCode: return 2002\n        case .URLSessionError: return 2003\n        case .dataModifyingFailed: return 2004\n        case .noURLResponse: return 2005\n        }\n    }\n}\n\nextension KingfisherError.CacheErrorReason {\n    var errorDescription: String? {\n        switch self {\n        case .fileEnumeratorCreationFailed(let url):\n            return \"Cannot create file enumerator for URL: \\(url).\"\n        case .invalidFileEnumeratorContent(let url):\n            return \"Cannot get contents from the file enumerator at URL: \\(url).\"\n        case .invalidURLResource(let error, let key, let url):\n            return \"Cannot get URL resource values or data for the given URL: \\(url). \" +\n                   \"Cache key: \\(key). Underlying error: \\(error)\"\n        case .cannotLoadDataFromDisk(let url, let error):\n            return \"Cannot load data from disk at URL: \\(url). Underlying error: \\(error)\"\n        case .cannotCreateDirectory(let path, let error):\n            return \"Cannot create directory at given path: Path: \\(path). Underlying error: \\(error)\"\n        case .imageNotExisting(let key):\n            return \"The image is not in cache, but you requires it should only be \" +\n                   \"from cache by enabling the `.onlyFromCache` option. Key: \\(key).\"\n        case .cannotConvertToData(let object, let error):\n            return \"Cannot convert the input object to a `Data` object when storing it to disk cache. \" +\n                   \"Object: \\(object). Underlying error: \\(error)\"\n        case .cannotSerializeImage(let image, let originalData, let serializer):\n            return \"Cannot serialize an image due to the cache serializer returning `nil`. \" +\n                   \"Image: \\(String(describing:image)), original data: \\(String(describing: originalData)), \" +\n                   \"serializer: \\(serializer).\"\n        case .cannotCreateCacheFile(let fileURL, let key, let data, let error):\n            return \"Cannot create cache file at url: \\(fileURL), key: \\(key), data length: \\(data.count). \" +\n                   \"Underlying foundation error: \\(error).\"\n        case .cannotSetCacheFileAttribute(let filePath, let attributes, let error):\n            return \"Cannot set file attribute for the cache file at path: \\(filePath), attributes: \\(attributes).\" +\n                   \"Underlying foundation error: \\(error).\"\n        case .diskStorageIsNotReady(let cacheURL):\n            return \"The disk storage is not ready to use yet at URL: '\\(cacheURL)'. \" +\n                \"This is usually caused by extremely lack of disk space. Ask users to free up some space and restart the app.\"\n        }\n    }\n    \n    var errorCode: Int {\n        switch self {\n        case .fileEnumeratorCreationFailed: return 3001\n        case .invalidFileEnumeratorContent: return 3002\n        case .invalidURLResource: return 3003\n        case .cannotLoadDataFromDisk: return 3004\n        case .cannotCreateDirectory: return 3005\n        case .imageNotExisting: return 3006\n        case .cannotConvertToData: return 3007\n        case .cannotSerializeImage: return 3008\n        case .cannotCreateCacheFile: return 3009\n        case .cannotSetCacheFileAttribute: return 3010\n        case .diskStorageIsNotReady: return 3011\n        }\n    }\n}\n\nextension KingfisherError.ProcessorErrorReason {\n    var errorDescription: String? {\n        switch self {\n        case .processingFailed(let processor, let item):\n            return \"Processing image failed. Processor: \\(processor). Processing item: \\(item).\"\n        }\n    }\n    \n    var errorCode: Int {\n        switch self {\n        case .processingFailed: return 4001\n        }\n    }\n}\n\nextension KingfisherError.ImageSettingErrorReason {\n    var errorDescription: String? {\n        switch self {\n        case .emptySource:\n            return \"The input resource is empty.\"\n        case .notCurrentSourceTask(let result, let error, let resource):\n            if let result = result {\n                return \"Retrieving resource succeeded, but this source is \" +\n                       \"not the one currently expected. Result: \\(result). Resource: \\(resource).\"\n            } else if let error = error {\n                return \"Retrieving resource failed, and this resource is \" +\n                       \"not the one currently expected. Error: \\(error). Resource: \\(resource).\"\n            } else {\n                return nil\n            }\n        case .dataProviderError(let provider, let error):\n            return \"Image data provider fails to provide data. Provider: \\(provider), error: \\(error)\"\n        case .alternativeSourcesExhausted(let errors):\n            return \"Image setting from alternaive sources failed: \\(errors)\"\n        }\n    }\n    \n    var errorCode: Int {\n        switch self {\n        case .emptySource: return 5001\n        case .notCurrentSourceTask: return 5002\n        case .dataProviderError: return 5003\n        case .alternativeSourcesExhausted: return 5004\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/KingfisherManager.swift",
    "content": "//\n//  KingfisherManager.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/4/6.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n\nimport Foundation\n\n/// The downloading progress block type.\n/// The parameter value is the `receivedSize` of current response.\n/// The second parameter is the total expected data length from response's \"Content-Length\" header.\n/// If the expected length is not available, this block will not be called.\npublic typealias DownloadProgressBlock = ((_ receivedSize: Int64, _ totalSize: Int64) -> Void)\n\n/// Represents the result of a Kingfisher retrieving image task.\npublic struct RetrieveImageResult {\n\n    /// Gets the image object of this result.\n    public let image: KFCrossPlatformImage\n\n    /// Gets the cache source of the image. It indicates from which layer of cache this image is retrieved.\n    /// If the image is just downloaded from network, `.none` will be returned.\n    public let cacheType: CacheType\n\n    /// The `Source` which this result is related to. This indicated where the `image` of `self` is referring.\n    public let source: Source\n\n    /// The original `Source` from which the retrieve task begins. It can be different from the `source` property.\n    /// When an alternative source loading happened, the `source` will be the replacing loading target, while the\n    /// `originalSource` will be kept as the initial `source` which issued the image loading process.\n    public let originalSource: Source\n}\n\n/// A struct that stores some related information of an `KingfisherError`. It provides some context information for\n/// a pure error so you can identify the error easier.\npublic struct PropagationError {\n\n    /// The `Source` to which current `error` is bound.\n    public let source: Source\n\n    /// The actual error happens in framework.\n    public let error: KingfisherError\n}\n\n\n/// The downloading task updated block type. The parameter `newTask` is the updated new task of image setting process.\n/// It is a `nil` if the image loading does not require an image downloading process. If an image downloading is issued,\n/// this value will contain the actual `DownloadTask` for you to keep and cancel it later if you need.\npublic typealias DownloadTaskUpdatedBlock = ((_ newTask: DownloadTask?) -> Void)\n\n/// Main manager class of Kingfisher. It connects Kingfisher downloader and cache,\n/// to provide a set of convenience methods to use Kingfisher for tasks.\n/// You can use this class to retrieve an image via a specified URL from web or cache.\npublic class KingfisherManager {\n\n    /// Represents a shared manager used across Kingfisher.\n    /// Use this instance for getting or storing images with Kingfisher.\n    public static let shared = KingfisherManager()\n\n    // Mark: Public Properties\n    /// The `ImageCache` used by this manager. It is `ImageCache.default` by default.\n    /// If a cache is specified in `KingfisherManager.defaultOptions`, the value in `defaultOptions` will be\n    /// used instead.\n    public var cache: ImageCache\n    \n    /// The `ImageDownloader` used by this manager. It is `ImageDownloader.default` by default.\n    /// If a downloader is specified in `KingfisherManager.defaultOptions`, the value in `defaultOptions` will be\n    /// used instead.\n    public var downloader: ImageDownloader\n    \n    /// Default options used by the manager. This option will be used in\n    /// Kingfisher manager related methods, as well as all view extension methods.\n    /// You can also passing other options for each image task by sending an `options` parameter\n    /// to Kingfisher's APIs. The per image options will overwrite the default ones,\n    /// if the option exists in both.\n    public var defaultOptions = KingfisherOptionsInfo.empty\n    \n    // Use `defaultOptions` to overwrite the `downloader` and `cache`.\n    private var currentDefaultOptions: KingfisherOptionsInfo {\n        return [.downloader(downloader), .targetCache(cache)] + defaultOptions\n    }\n\n    private let processingQueue: CallbackQueue\n    \n    private convenience init() {\n        self.init(downloader: .default, cache: .default)\n    }\n\n    /// Creates an image setting manager with specified downloader and cache.\n    ///\n    /// - Parameters:\n    ///   - downloader: The image downloader used to download images.\n    ///   - cache: The image cache which stores memory and disk images.\n    public init(downloader: ImageDownloader, cache: ImageCache) {\n        self.downloader = downloader\n        self.cache = cache\n\n        let processQueueName = \"com.onevcat.Kingfisher.KingfisherManager.processQueue.\\(UUID().uuidString)\"\n        processingQueue = .dispatch(DispatchQueue(label: processQueueName))\n    }\n\n    // MARK: - Getting Images\n\n    /// Gets an image from a given resource.\n    /// - Parameters:\n    ///   - resource: The `Resource` object defines data information like key or URL.\n    ///   - options: Options to use when creating the image.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called. `progressBlock` is always called in\n    ///                    main queue.\n    ///   - downloadTaskUpdated: Called when a new image downloading task is created for current image retrieving. This\n    ///                          usually happens when an alternative source is used to replace the original (failed)\n    ///                          task. You can update your reference of `DownloadTask` if you want to manually `cancel`\n    ///                          the new task.\n    ///   - completionHandler: Called when the image retrieved and set finished. This completion handler will be invoked\n    ///                        from the `options.callbackQueue`. If not specified, the main queue will be used.\n    /// - Returns: A task represents the image downloading. If there is a download task starts for `.network` resource,\n    ///            the started `DownloadTask` is returned. Otherwise, `nil` is returned.\n    ///\n    /// - Note:\n    ///    This method will first check whether the requested `resource` is already in cache or not. If cached,\n    ///    it returns `nil` and invoke the `completionHandler` after the cached image retrieved. Otherwise, it\n    ///    will download the `resource`, store it in cache, then call `completionHandler`.\n    @discardableResult\n    public func retrieveImage(\n        with resource: Resource,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        downloadTaskUpdated: DownloadTaskUpdatedBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?) -> DownloadTask?\n    {\n        return retrieveImage(\n            with: resource.convertToSource(),\n            options: options,\n            progressBlock: progressBlock,\n            downloadTaskUpdated: downloadTaskUpdated,\n            completionHandler: completionHandler\n        )\n    }\n\n    /// Gets an image from a given resource.\n    ///\n    /// - Parameters:\n    ///   - source: The `Source` object defines data information from network or a data provider.\n    ///   - options: Options to use when creating the image.\n    ///   - progressBlock: Called when the image downloading progress gets updated. If the response does not contain an\n    ///                    `expectedContentLength`, this block will not be called. `progressBlock` is always called in\n    ///                    main queue.\n    ///   - downloadTaskUpdated: Called when a new image downloading task is created for current image retrieving. This\n    ///                          usually happens when an alternative source is used to replace the original (failed)\n    ///                          task. You can update your reference of `DownloadTask` if you want to manually `cancel`\n    ///                          the new task.\n    ///   - completionHandler: Called when the image retrieved and set finished. This completion handler will be invoked\n    ///                        from the `options.callbackQueue`. If not specified, the main queue will be used.\n    /// - Returns: A task represents the image downloading. If there is a download task starts for `.network` resource,\n    ///            the started `DownloadTask` is returned. Otherwise, `nil` is returned.\n    ///\n    /// - Note:\n    ///    This method will first check whether the requested `source` is already in cache or not. If cached,\n    ///    it returns `nil` and invoke the `completionHandler` after the cached image retrieved. Otherwise, it\n    ///    will try to load the `source`, store it in cache, then call `completionHandler`.\n    ///\n    public func retrieveImage(\n        with source: Source,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        downloadTaskUpdated: DownloadTaskUpdatedBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?) -> DownloadTask?\n    {\n        let options = currentDefaultOptions + (options ?? .empty)\n        let info = KingfisherParsedOptionsInfo(options)\n        return retrieveImage(\n            with: source,\n            options: info,\n            progressBlock: progressBlock,\n            downloadTaskUpdated: downloadTaskUpdated,\n            completionHandler: completionHandler)\n    }\n\n    func retrieveImage(\n        with source: Source,\n        options: KingfisherParsedOptionsInfo,\n        progressBlock: DownloadProgressBlock? = nil,\n        downloadTaskUpdated: DownloadTaskUpdatedBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?) -> DownloadTask?\n    {\n        var info = options\n        if let block = progressBlock {\n            info.onDataReceived = (info.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n        return retrieveImage(\n            with: source,\n            options: info,\n            downloadTaskUpdated: downloadTaskUpdated,\n            completionHandler: completionHandler)\n    }\n\n    func retrieveImage(\n        with source: Source,\n        options: KingfisherParsedOptionsInfo,\n        downloadTaskUpdated: DownloadTaskUpdatedBlock? = nil,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?) -> DownloadTask?\n    {\n        let retrievingContext = RetrievingContext(options: options, originalSource: source)\n        var retryContext: RetryContext?\n\n        func startNewRetrieveTask(\n            with source: Source,\n            downloadTaskUpdated: DownloadTaskUpdatedBlock?\n        ) {\n            let newTask = self.retrieveImage(with: source, context: retrievingContext) { result in\n                handler(currentSource: source, result: result)\n            }\n            downloadTaskUpdated?(newTask)\n        }\n\n        func failCurrentSource(_ source: Source, with error: KingfisherError) {\n            // Skip alternative sources if the user cancelled it.\n            guard !error.isTaskCancelled else {\n                completionHandler?(.failure(error))\n                return\n            }\n            // When low data mode constrained error, retry with the low data mode source instead of use alternative on fly.\n            guard !error.isLowDataModeConstrained else {\n                if let source = retrievingContext.options.lowDataModeSource {\n                    retrievingContext.options.lowDataModeSource = nil\n                    startNewRetrieveTask(with: source, downloadTaskUpdated: downloadTaskUpdated)\n                } else {\n                    // This should not happen.\n                    completionHandler?(.failure(error))\n                }\n                return\n            }\n            if let nextSource = retrievingContext.popAlternativeSource() {\n                retrievingContext.appendError(error, to: source)\n                startNewRetrieveTask(with: nextSource, downloadTaskUpdated: downloadTaskUpdated)\n            } else {\n                // No other alternative source. Finish with error.\n                if retrievingContext.propagationErrors.isEmpty {\n                    completionHandler?(.failure(error))\n                } else {\n                    retrievingContext.appendError(error, to: source)\n                    let finalError = KingfisherError.imageSettingError(\n                        reason: .alternativeSourcesExhausted(retrievingContext.propagationErrors)\n                    )\n                    completionHandler?(.failure(finalError))\n                }\n            }\n        }\n\n        func handler(currentSource: Source, result: (Result<RetrieveImageResult, KingfisherError>)) -> Void {\n            switch result {\n            case .success:\n                completionHandler?(result)\n            case .failure(let error):\n                if let retryStrategy = options.retryStrategy {\n                    let context = retryContext?.increaseRetryCount() ?? RetryContext(source: source, error: error)\n                    retryContext = context\n\n                    retryStrategy.retry(context: context) { decision in\n                        switch decision {\n                        case .retry(let userInfo):\n                            retryContext?.userInfo = userInfo\n                            startNewRetrieveTask(with: source, downloadTaskUpdated: downloadTaskUpdated)\n                        case .stop:\n                            failCurrentSource(currentSource, with: error)\n                        }\n                    }\n                } else {\n                    failCurrentSource(currentSource, with: error)\n                }\n            }\n        }\n\n        return retrieveImage(\n            with: source,\n            context: retrievingContext)\n        {\n            result in\n            handler(currentSource: source, result: result)\n        }\n\n    }\n    \n    private func retrieveImage(\n        with source: Source,\n        context: RetrievingContext,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?) -> DownloadTask?\n    {\n        let options = context.options\n        if options.forceRefresh {\n            return loadAndCacheImage(\n                source: source,\n                context: context,\n                completionHandler: completionHandler)?.value\n            \n        } else {\n            let loadedFromCache = retrieveImageFromCache(\n                source: source,\n                context: context,\n                completionHandler: completionHandler)\n            \n            if loadedFromCache {\n                return nil\n            }\n            \n            if options.onlyFromCache {\n                let error = KingfisherError.cacheError(reason: .imageNotExisting(key: source.cacheKey))\n                completionHandler?(.failure(error))\n                return nil\n            }\n            \n            return loadAndCacheImage(\n                source: source,\n                context: context,\n                completionHandler: completionHandler)?.value\n        }\n    }\n\n    func provideImage(\n        provider: ImageDataProvider,\n        options: KingfisherParsedOptionsInfo,\n        completionHandler: ((Result<ImageLoadingResult, KingfisherError>) -> Void)?)\n    {\n        guard let  completionHandler = completionHandler else { return }\n        provider.data { result in\n            switch result {\n            case .success(let data):\n                (options.processingQueue ?? self.processingQueue).execute {\n                    let processor = options.processor\n                    let processingItem = ImageProcessItem.data(data)\n                    guard let image = processor.process(item: processingItem, options: options) else {\n                        options.callbackQueue.execute {\n                            let error = KingfisherError.processorError(\n                                reason: .processingFailed(processor: processor, item: processingItem))\n                            completionHandler(.failure(error))\n                        }\n                        return\n                    }\n\n                    options.callbackQueue.execute {\n                        let result = ImageLoadingResult(image: image, url: nil, originalData: data)\n                        completionHandler(.success(result))\n                    }\n                }\n            case .failure(let error):\n                options.callbackQueue.execute {\n                    let error = KingfisherError.imageSettingError(\n                        reason: .dataProviderError(provider: provider, error: error))\n                    completionHandler(.failure(error))\n                }\n\n            }\n        }\n    }\n\n    private func cacheImage(\n        source: Source,\n        options: KingfisherParsedOptionsInfo,\n        context: RetrievingContext,\n        result: Result<ImageLoadingResult, KingfisherError>,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?\n    )\n    {\n        switch result {\n        case .success(let value):\n            let needToCacheOriginalImage = options.cacheOriginalImage &&\n                                           options.processor != DefaultImageProcessor.default\n            let coordinator = CacheCallbackCoordinator(\n                shouldWaitForCache: options.waitForCache, shouldCacheOriginal: needToCacheOriginalImage)\n            let result = RetrieveImageResult(\n                image: options.imageModifier?.modify(value.image) ?? value.image,\n                cacheType: .none,\n                source: source,\n                originalSource: context.originalSource\n            )\n            // Add image to cache.\n            let targetCache = options.targetCache ?? self.cache\n            targetCache.store(\n                value.image,\n                original: value.originalData,\n                forKey: source.cacheKey,\n                options: options,\n                toDisk: !options.cacheMemoryOnly)\n            {\n                _ in\n                coordinator.apply(.cachingImage) {\n                    completionHandler?(.success(result))\n                }\n            }\n\n            // Add original image to cache if necessary.\n\n            if needToCacheOriginalImage {\n                let originalCache = options.originalCache ?? targetCache\n                originalCache.storeToDisk(\n                    value.originalData,\n                    forKey: source.cacheKey,\n                    processorIdentifier: DefaultImageProcessor.default.identifier,\n                    expiration: options.diskCacheExpiration)\n                {\n                    _ in\n                    coordinator.apply(.cachingOriginalImage) {\n                        completionHandler?(.success(result))\n                    }\n                }\n            }\n\n            coordinator.apply(.cacheInitiated) {\n                completionHandler?(.success(result))\n            }\n\n        case .failure(let error):\n            completionHandler?(.failure(error))\n        }\n    }\n\n    @discardableResult\n    func loadAndCacheImage(\n        source: Source,\n        context: RetrievingContext,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?) -> DownloadTask.WrappedTask?\n    {\n        let options = context.options\n        func _cacheImage(_ result: Result<ImageLoadingResult, KingfisherError>) {\n            cacheImage(\n                source: source,\n                options: options,\n                context: context,\n                result: result,\n                completionHandler: completionHandler\n            )\n        }\n\n        switch source {\n        case .network(let resource):\n            let downloader = options.downloader ?? self.downloader\n            let task = downloader.downloadImage(\n                with: resource.downloadURL, options: options, completionHandler: _cacheImage\n            )\n\n\n            // The code below is neat, but it fails the Swift 5.2 compiler with a runtime crash when \n            // `BUILD_LIBRARY_FOR_DISTRIBUTION` is turned on. I believe it is a bug in the compiler. \n            // Let's fallback to a traditional style before it can be fixed in Swift.\n            //\n            // https://github.com/onevcat/Kingfisher/issues/1436\n            //\n            // return task.map(DownloadTask.WrappedTask.download)\n\n            if let task = task {\n                return .download(task)\n            } else {\n                return nil\n            }\n\n        case .provider(let provider):\n            provideImage(provider: provider, options: options, completionHandler: _cacheImage)\n            return .dataProviding\n        }\n    }\n    \n    /// Retrieves image from memory or disk cache.\n    ///\n    /// - Parameters:\n    ///   - source: The target source from which to get image.\n    ///   - key: The key to use when caching the image.\n    ///   - url: Image request URL. This is not used when retrieving image from cache. It is just used for\n    ///          `RetrieveImageResult` callback compatibility.\n    ///   - options: Options on how to get the image from image cache.\n    ///   - completionHandler: Called when the image retrieving finishes, either with succeeded\n    ///                        `RetrieveImageResult` or an error.\n    /// - Returns: `true` if the requested image or the original image before being processed is existing in cache.\n    ///            Otherwise, this method returns `false`.\n    ///\n    /// - Note:\n    ///    The image retrieving could happen in either memory cache or disk cache. The `.processor` option in\n    ///    `options` will be considered when searching in the cache. If no processed image is found, Kingfisher\n    ///    will try to check whether an original version of that image is existing or not. If there is already an\n    ///    original, Kingfisher retrieves it from cache and processes it. Then, the processed image will be store\n    ///    back to cache for later use.\n    func retrieveImageFromCache(\n        source: Source,\n        context: RetrievingContext,\n        completionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void)?) -> Bool\n    {\n        let options = context.options\n        // 1. Check whether the image was already in target cache. If so, just get it.\n        let targetCache = options.targetCache ?? cache\n        let key = source.cacheKey\n        let targetImageCached = targetCache.imageCachedType(\n            forKey: key, processorIdentifier: options.processor.identifier)\n        \n        let validCache = targetImageCached.cached &&\n            (options.fromMemoryCacheOrRefresh == false || targetImageCached == .memory)\n        if validCache {\n            targetCache.retrieveImage(forKey: key, options: options) { result in\n                guard let completionHandler = completionHandler else { return }\n                options.callbackQueue.execute {\n                    result.match(\n                        onSuccess: { cacheResult in\n                            let value: Result<RetrieveImageResult, KingfisherError>\n                            if let image = cacheResult.image {\n                                value = result.map {\n                                    RetrieveImageResult(\n                                        image: options.imageModifier?.modify(image) ?? image,\n                                        cacheType: $0.cacheType,\n                                        source: source,\n                                        originalSource: context.originalSource\n                                    )\n                                }\n                            } else {\n                                value = .failure(KingfisherError.cacheError(reason: .imageNotExisting(key: key)))\n                            }\n                            completionHandler(value)\n                        },\n                        onFailure: { _ in\n                            completionHandler(.failure(KingfisherError.cacheError(reason: .imageNotExisting(key: key))))\n                        }\n                    )\n                }\n            }\n            return true\n        }\n\n        // 2. Check whether the original image exists. If so, get it, process it, save to storage and return.\n        let originalCache = options.originalCache ?? targetCache\n        // No need to store the same file in the same cache again.\n        if originalCache === targetCache && options.processor == DefaultImageProcessor.default {\n            return false\n        }\n\n        // Check whether the unprocessed image existing or not.\n        let originalImageCacheType = originalCache.imageCachedType(\n            forKey: key, processorIdentifier: DefaultImageProcessor.default.identifier)\n        let canAcceptDiskCache = !options.fromMemoryCacheOrRefresh\n        \n        let canUseOriginalImageCache =\n            (canAcceptDiskCache && originalImageCacheType.cached) ||\n            (!canAcceptDiskCache && originalImageCacheType == .memory)\n        \n        if canUseOriginalImageCache {\n            // Now we are ready to get found the original image from cache. We need the unprocessed image, so remove\n            // any processor from options first.\n            var optionsWithoutProcessor = options\n            optionsWithoutProcessor.processor = DefaultImageProcessor.default\n            originalCache.retrieveImage(forKey: key, options: optionsWithoutProcessor) { result in\n\n                result.match(\n                    onSuccess: { cacheResult in\n                        guard let image = cacheResult.image else {\n                            assertionFailure(\"The image (under key: \\(key) should be existing in the original cache.\")\n                            return\n                        }\n\n                        let processor = options.processor\n                        (options.processingQueue ?? self.processingQueue).execute {\n                            let item = ImageProcessItem.image(image)\n                            guard let processedImage = processor.process(item: item, options: options) else {\n                                let error = KingfisherError.processorError(\n                                    reason: .processingFailed(processor: processor, item: item))\n                                options.callbackQueue.execute { completionHandler?(.failure(error)) }\n                                return\n                            }\n\n                            var cacheOptions = options\n                            cacheOptions.callbackQueue = .untouch\n\n                            let coordinator = CacheCallbackCoordinator(\n                                shouldWaitForCache: options.waitForCache, shouldCacheOriginal: false)\n\n                            let result = RetrieveImageResult(\n                                image: options.imageModifier?.modify(processedImage) ?? processedImage,\n                                cacheType: .none,\n                                source: source,\n                                originalSource: context.originalSource\n                            )\n\n                            targetCache.store(\n                                processedImage,\n                                forKey: key,\n                                options: cacheOptions,\n                                toDisk: !options.cacheMemoryOnly)\n                            {\n                                _ in\n                                coordinator.apply(.cachingImage) {\n                                    options.callbackQueue.execute { completionHandler?(.success(result)) }\n                                }\n                            }\n\n                            coordinator.apply(.cacheInitiated) {\n                                options.callbackQueue.execute { completionHandler?(.success(result)) }\n                            }\n                        }\n                    },\n                    onFailure: { _ in\n                        // This should not happen actually, since we already confirmed `originalImageCached` is `true`.\n                        // Just in case...\n                        options.callbackQueue.execute {\n                            completionHandler?(\n                                .failure(KingfisherError.cacheError(reason: .imageNotExisting(key: key)))\n                            )\n                        }\n                    }\n                )\n            }\n            return true\n        }\n\n        return false\n    }\n}\n\nclass RetrievingContext {\n\n    var options: KingfisherParsedOptionsInfo\n\n    let originalSource: Source\n    var propagationErrors: [PropagationError] = []\n\n    init(options: KingfisherParsedOptionsInfo, originalSource: Source) {\n        self.originalSource = originalSource\n        self.options = options\n    }\n\n    func popAlternativeSource() -> Source? {\n        guard var alternativeSources = options.alternativeSources, !alternativeSources.isEmpty else {\n            return nil\n        }\n        let nextSource = alternativeSources.removeFirst()\n        options.alternativeSources = alternativeSources\n        return nextSource\n    }\n\n    @discardableResult\n    func appendError(_ error: KingfisherError, to source: Source) -> [PropagationError] {\n        let item = PropagationError(source: source, error: error)\n        propagationErrors.append(item)\n        return propagationErrors\n    }\n}\n\nclass CacheCallbackCoordinator {\n\n    enum State {\n        case idle\n        case imageCached\n        case originalImageCached\n        case done\n    }\n\n    enum Action {\n        case cacheInitiated\n        case cachingImage\n        case cachingOriginalImage\n    }\n\n    private let shouldWaitForCache: Bool\n    private let shouldCacheOriginal: Bool\n    private let stateQueue: DispatchQueue\n    private var threadSafeState: State = .idle\n\n    private (set) var state: State {\n        set { stateQueue.sync { threadSafeState = newValue } }\n        get { stateQueue.sync { threadSafeState } }\n    }\n\n    init(shouldWaitForCache: Bool, shouldCacheOriginal: Bool) {\n        self.shouldWaitForCache = shouldWaitForCache\n        self.shouldCacheOriginal = shouldCacheOriginal\n        let stateQueueName = \"com.onevcat.Kingfisher.CacheCallbackCoordinator.stateQueue.\\(UUID().uuidString)\"\n        self.stateQueue = DispatchQueue(label: stateQueueName)\n    }\n\n    func apply(_ action: Action, trigger: () -> Void) {\n        switch (state, action) {\n        case (.done, _):\n            break\n\n        // From .idle\n        case (.idle, .cacheInitiated):\n            if !shouldWaitForCache {\n                state = .done\n                trigger()\n            }\n        case (.idle, .cachingImage):\n            if shouldCacheOriginal {\n                state = .imageCached\n            } else {\n                state = .done\n                trigger()\n            }\n        case (.idle, .cachingOriginalImage):\n            state = .originalImageCached\n\n        // From .imageCached\n        case (.imageCached, .cachingOriginalImage):\n            state = .done\n            trigger()\n\n        // From .originalImageCached\n        case (.originalImageCached, .cachingImage):\n            state = .done\n            trigger()\n\n        default:\n            assertionFailure(\"This case should not happen in CacheCallbackCoordinator: \\(state) - \\(action)\")\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/General/KingfisherOptionsInfo.swift",
    "content": "//\n//  KingfisherOptionsInfo.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/4/23.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(macOS)\nimport AppKit\n#else\nimport UIKit\n#endif\n    \n\n/// KingfisherOptionsInfo is a typealias for [KingfisherOptionsInfoItem].\n/// You can use the enum of option item with value to control some behaviors of Kingfisher.\npublic typealias KingfisherOptionsInfo = [KingfisherOptionsInfoItem]\n\nextension Array where Element == KingfisherOptionsInfoItem {\n    static let empty: KingfisherOptionsInfo = []\n}\n\n/// Represents the available option items could be used in `KingfisherOptionsInfo`.\npublic enum KingfisherOptionsInfoItem {\n    \n    /// Kingfisher will use the associated `ImageCache` object when handling related operations,\n    /// including trying to retrieve the cached images and store the downloaded image to it.\n    case targetCache(ImageCache)\n    \n    /// The `ImageCache` for storing and retrieving original images. If `originalCache` is\n    /// contained in the options, it will be preferred for storing and retrieving original images.\n    /// If there is no `.originalCache` in the options, `.targetCache` will be used to store original images.\n    ///\n    /// When using KingfisherManager to download and store an image, if `cacheOriginalImage` is\n    /// applied in the option, the original image will be stored to this `originalCache`. At the\n    /// same time, if a requested final image (with processor applied) cannot be found in `targetCache`,\n    /// Kingfisher will try to search the original image to check whether it is already there. If found,\n    /// it will be used and applied with the given processor. It is an optimization for not downloading\n    /// the same image for multiple times.\n    case originalCache(ImageCache)\n    \n    /// Kingfisher will use the associated `ImageDownloader` object to download the requested images.\n    case downloader(ImageDownloader)\n\n    /// Member for animation transition when using `UIImageView`. Kingfisher will use the `ImageTransition` of\n    /// this enum to animate the image in if it is downloaded from web. The transition will not happen when the\n    /// image is retrieved from either memory or disk cache by default. If you need to do the transition even when\n    /// the image being retrieved from cache, set `.forceRefresh` as well.\n    case transition(ImageTransition)\n    \n    /// Associated `Float` value will be set as the priority of image download task. The value for it should be\n    /// between 0.0~1.0. If this option not set, the default value (`URLSessionTask.defaultPriority`) will be used.\n    case downloadPriority(Float)\n    \n    /// If set, Kingfisher will ignore the cache and try to start a download task for the image source.\n    case forceRefresh\n\n    /// If set, Kingfisher will try to retrieve the image from memory cache first. If the image is not in memory\n    /// cache, then it will ignore the disk cache but download the image again from network. This is useful when\n    /// you want to display a changeable image behind the same url at the same app session, while avoiding download\n    /// it for multiple times.\n    case fromMemoryCacheOrRefresh\n    \n    /// If set, setting the image to an image view will happen with transition even when retrieved from cache.\n    /// See `.transition` option for more.\n    case forceTransition\n    \n    /// If set, Kingfisher will only cache the value in memory but not in disk.\n    case cacheMemoryOnly\n    \n    /// If set, Kingfisher will wait for caching operation to be completed before calling the completion block.\n    case waitForCache\n    \n    /// If set, Kingfisher will only try to retrieve the image from cache, but not from network. If the image is not in\n    /// cache, the image retrieving will fail with the `KingfisherError.cacheError` with `.imageNotExisting` as its\n    /// reason.\n    case onlyFromCache\n    \n    /// Decode the image in background thread before using. It will decode the downloaded image data and do a off-screen\n    /// rendering to extract pixel information in background. This can speed up display, but will cost more time to\n    /// prepare the image for using.\n    case backgroundDecode\n\n    /// The associated value will be used as the target queue of dispatch callbacks when retrieving images from\n    /// cache. If not set, Kingfisher will use `.mainCurrentOrAsync` for callbacks.\n    ///\n    /// - Note:\n    /// This option does not affect the callbacks for UI related extension methods. You will always get the\n    /// callbacks called from main queue.\n    case callbackQueue(CallbackQueue)\n    \n    /// The associated value will be used as the scale factor when converting retrieved data to an image.\n    /// Specify the image scale, instead of your screen scale. You may need to set the correct scale when you dealing\n    /// with 2x or 3x retina images. Otherwise, Kingfisher will convert the data to image object at `scale` 1.0.\n    case scaleFactor(CGFloat)\n\n    /// Whether all the animated image data should be preloaded. Default is `false`, which means only following frames\n    /// will be loaded on need. If `true`, all the animated image data will be loaded and decoded into memory.\n    ///\n    /// This option is mainly used for back compatibility internally. You should not set it directly. Instead,\n    /// you should choose the image view class to control the GIF data loading. There are two classes in Kingfisher\n    /// support to display a GIF image. `AnimatedImageView` does not preload all data, it takes much less memory, but\n    /// uses more CPU when display. While a normal image view (`UIImageView` or `NSImageView`) loads all data at once,\n    /// which uses more memory but only decode image frames once.\n    case preloadAllAnimationData\n    \n    /// The `ImageDownloadRequestModifier` contained will be used to change the request before it being sent.\n    /// This is the last chance you can modify the image download request. You can modify the request for some\n    /// customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url mapping.\n    /// The original request will be sent without any modification by default.\n    case requestModifier(AsyncImageDownloadRequestModifier)\n    \n    /// The `ImageDownloadRedirectHandler` contained will be used to change the request before redirection.\n    /// This is the possibility you can modify the image download request during redirect. You can modify the request for\n    /// some customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url\n    /// mapping.\n    /// The original redirection request will be sent without any modification by default.\n    case redirectHandler(ImageDownloadRedirectHandler)\n    \n    /// Processor for processing when the downloading finishes, a processor will convert the downloaded data to an image\n    /// and/or apply some filter on it. If a cache is connected to the downloader (it happens when you are using\n    /// KingfisherManager or any of the view extension methods), the converted image will also be sent to cache as well.\n    /// If not set, the `DefaultImageProcessor.default` will be used.\n    case processor(ImageProcessor)\n    \n    /// Provides a `CacheSerializer` to convert some data to an image object for\n    /// retrieving from disk cache or vice versa for storing to disk cache.\n    /// If not set, the `DefaultCacheSerializer.default` will be used.\n    case cacheSerializer(CacheSerializer)\n\n    /// An `ImageModifier` is for modifying an image as needed right before it is used. If the image was fetched\n    /// directly from the downloader, the modifier will run directly after the `ImageProcessor`. If the image is being\n    /// fetched from a cache, the modifier will run after the `CacheSerializer`.\n    ///\n    /// Use `ImageModifier` when you need to set properties that do not persist when caching the image on a concrete\n    /// type of `Image`, such as the `renderingMode` or the `alignmentInsets` of `UIImage`.\n    case imageModifier(ImageModifier)\n    \n    /// Keep the existing image of image view while setting another image to it.\n    /// By setting this option, the placeholder image parameter of image view extension method\n    /// will be ignored and the current image will be kept while loading or downloading the new image.\n    case keepCurrentImageWhileLoading\n    \n    /// If set, Kingfisher will only load the first frame from an animated image file as a single image.\n    /// Loading an animated images may take too much memory. It will be useful when you want to display a\n    /// static preview of the first frame from an animated image.\n    ///\n    /// This option will be ignored if the target image is not animated image data.\n    case onlyLoadFirstFrame\n    \n    /// If set and an `ImageProcessor` is used, Kingfisher will try to cache both the final result and original\n    /// image. Kingfisher will have a chance to use the original image when another processor is applied to the same\n    /// resource, instead of downloading it again. You can use `.originalCache` to specify a cache or the original\n    /// images if necessary.\n    ///\n    /// The original image will be only cached to disk storage.\n    case cacheOriginalImage\n    \n    /// If set and an image retrieving error occurred Kingfisher will set provided image (or empty)\n    /// in place of requested one. It's useful when you don't want to show placeholder\n    /// during loading time but wants to use some default image when requests will be failed.\n    case onFailureImage(KFCrossPlatformImage?)\n    \n    /// If set and used in `ImagePrefetcher`, the prefetching operation will load the images into memory storage\n    /// aggressively. By default this is not contained in the options, that means if the requested image is already\n    /// in disk cache, Kingfisher will not try to load it to memory.\n    case alsoPrefetchToMemory\n    \n    /// If set, the disk storage loading will happen in the same calling queue. By default, disk storage file loading\n    /// happens in its own queue with an asynchronous dispatch behavior. Although it provides better non-blocking disk\n    /// loading performance, it also causes a flickering when you reload an image from disk, if the image view already\n    /// has an image set.\n    ///\n    /// Set this options will stop that flickering by keeping all loading in the same queue (typically the UI queue\n    /// if you are using Kingfisher's extension methods to set an image), with a tradeoff of loading performance.\n    case loadDiskFileSynchronously\n    \n    /// The expiration setting for memory cache. By default, the underlying `MemoryStorage.Backend` uses the\n    /// expiration in its config for all items. If set, the `MemoryStorage.Backend` will use this associated\n    /// value to overwrite the config setting for this caching item.\n    case memoryCacheExpiration(StorageExpiration)\n    \n    /// The expiration extending setting for memory cache. The item expiration time will be incremented by this\n    /// value after access.\n    /// By default, the underlying `MemoryStorage.Backend` uses the initial cache expiration as extending\n    /// value: .cacheTime.\n    ///\n    /// To disable extending option at all add memoryCacheAccessExtendingExpiration(.none) to options.\n    case memoryCacheAccessExtendingExpiration(ExpirationExtending)\n    \n    /// The expiration setting for disk cache. By default, the underlying `DiskStorage.Backend` uses the\n    /// expiration in its config for all items. If set, the `DiskStorage.Backend` will use this associated\n    /// value to overwrite the config setting for this caching item.\n    case diskCacheExpiration(StorageExpiration)\n\n    /// The expiration extending setting for disk cache. The item expiration time will be incremented by this value after access.\n    /// By default, the underlying `DiskStorage.Backend` uses the initial cache expiration as extending value: .cacheTime.\n    /// To disable extending option at all add diskCacheAccessExtendingExpiration(.none) to options.\n    case diskCacheAccessExtendingExpiration(ExpirationExtending)\n    \n    /// Decides on which queue the image processing should happen. By default, Kingfisher uses a pre-defined serial\n    /// queue to process images. Use this option to change this behavior. For example, specify a `.mainCurrentOrAsync`\n    /// to let the image be processed in main queue to prevent a possible flickering (but with a possibility of\n    /// blocking the UI, especially if the processor needs a lot of time to run).\n    case processingQueue(CallbackQueue)\n    \n    /// Enable progressive image loading, Kingfisher will use the associated `ImageProgressive` value to process the\n    /// progressive JPEG data and display it in a progressive way.\n    case progressiveJPEG(ImageProgressive)\n\n    /// The alternative sources will be used when the original input `Source` fails. The `Source`s in the associated\n    /// array will be used to start a new image loading task if the previous task fails due to an error. The image\n    /// source loading process will stop as soon as a source is loaded successfully. If all `[Source]`s are used but\n    /// the loading is still failing, an `imageSettingError` with `alternativeSourcesExhausted` as its reason will be\n    /// thrown out.\n    ///\n    /// This option is useful if you want to implement a fallback solution for setting image.\n    ///\n    /// User cancellation will not trigger the alternative source loading.\n    case alternativeSources([Source])\n\n    /// Provide a retry strategy which will be used when something gets wrong during the image retrieving process from\n    /// `KingfisherManager`. You can define a strategy by create a type conforming to the `RetryStrategy` protocol.\n    ///\n    /// - Note:\n    ///\n    /// All extension methods of Kingfisher (`kf` extensions on `UIImageView` or `UIButton`) retrieve images through\n    /// `KingfisherManager`, so the retry strategy also applies when using them. However, this option does not apply\n    /// when pass to an `ImageDownloader` or `ImageCache`.\n    ///\n    case retryStrategy(RetryStrategy)\n\n    /// The `Source` should be loaded when user enables Low Data Mode and the original source fails with an\n    /// `NSURLErrorNetworkUnavailableReason.constrained` error. When this option is set, the\n    /// `allowsConstrainedNetworkAccess` property of the request for the original source will be set to `false` and the\n    /// `Source` in associated value will be used to retrieve the image for low data mode. Usually, you can provide a\n    /// low-resolution version of your image or a local image provider to display a placeholder.\n    ///\n    /// If not set or the `source` is `nil`, the device Low Data Mode will be ignored and the original source will\n    /// be loaded following the system default behavior, in a normal way.\n    case lowDataMode(Source?)\n}\n\n// Improve performance by parsing the input `KingfisherOptionsInfo` (self) first.\n// So we can prevent the iterating over the options array again and again.\n/// The parsed options info used across Kingfisher methods. Each property in this type corresponds a case member\n/// in `KingfisherOptionsInfoItem`. When a `KingfisherOptionsInfo` sent to Kingfisher related methods, it will be\n/// parsed and converted to a `KingfisherParsedOptionsInfo` first, and pass through the internal methods.\npublic struct KingfisherParsedOptionsInfo {\n\n    public var targetCache: ImageCache? = nil\n    public var originalCache: ImageCache? = nil\n    public var downloader: ImageDownloader? = nil\n    public var transition: ImageTransition = .none\n    public var downloadPriority: Float = URLSessionTask.defaultPriority\n    public var forceRefresh = false\n    public var fromMemoryCacheOrRefresh = false\n    public var forceTransition = false\n    public var cacheMemoryOnly = false\n    public var waitForCache = false\n    public var onlyFromCache = false\n    public var backgroundDecode = false\n    public var preloadAllAnimationData = false\n    public var callbackQueue: CallbackQueue = .mainCurrentOrAsync\n    public var scaleFactor: CGFloat = 1.0\n    public var requestModifier: AsyncImageDownloadRequestModifier? = nil\n    public var redirectHandler: ImageDownloadRedirectHandler? = nil\n    public var processor: ImageProcessor = DefaultImageProcessor.default\n    public var imageModifier: ImageModifier? = nil\n    public var cacheSerializer: CacheSerializer = DefaultCacheSerializer.default\n    public var keepCurrentImageWhileLoading = false\n    public var onlyLoadFirstFrame = false\n    public var cacheOriginalImage = false\n    public var onFailureImage: Optional<KFCrossPlatformImage?> = .none\n    public var alsoPrefetchToMemory = false\n    public var loadDiskFileSynchronously = false\n    public var memoryCacheExpiration: StorageExpiration? = nil\n    public var memoryCacheAccessExtendingExpiration: ExpirationExtending = .cacheTime\n    public var diskCacheExpiration: StorageExpiration? = nil\n    public var diskCacheAccessExtendingExpiration: ExpirationExtending = .cacheTime\n    public var processingQueue: CallbackQueue? = nil\n    public var progressiveJPEG: ImageProgressive? = nil\n    public var alternativeSources: [Source]? = nil\n    public var retryStrategy: RetryStrategy? = nil\n    public var lowDataModeSource: Source? = nil\n\n    var onDataReceived: [DataReceivingSideEffect]? = nil\n    \n    public init(_ info: KingfisherOptionsInfo?) {\n        guard let info = info else { return }\n        for option in info {\n            switch option {\n            case .targetCache(let value): targetCache = value\n            case .originalCache(let value): originalCache = value\n            case .downloader(let value): downloader = value\n            case .transition(let value): transition = value\n            case .downloadPriority(let value): downloadPriority = value\n            case .forceRefresh: forceRefresh = true\n            case .fromMemoryCacheOrRefresh: fromMemoryCacheOrRefresh = true\n            case .forceTransition: forceTransition = true\n            case .cacheMemoryOnly: cacheMemoryOnly = true\n            case .waitForCache: waitForCache = true\n            case .onlyFromCache: onlyFromCache = true\n            case .backgroundDecode: backgroundDecode = true\n            case .preloadAllAnimationData: preloadAllAnimationData = true\n            case .callbackQueue(let value): callbackQueue = value\n            case .scaleFactor(let value): scaleFactor = value\n            case .requestModifier(let value): requestModifier = value\n            case .redirectHandler(let value): redirectHandler = value\n            case .processor(let value): processor = value\n            case .imageModifier(let value): imageModifier = value\n            case .cacheSerializer(let value): cacheSerializer = value\n            case .keepCurrentImageWhileLoading: keepCurrentImageWhileLoading = true\n            case .onlyLoadFirstFrame: onlyLoadFirstFrame = true\n            case .cacheOriginalImage: cacheOriginalImage = true\n            case .onFailureImage(let value): onFailureImage = .some(value)\n            case .alsoPrefetchToMemory: alsoPrefetchToMemory = true\n            case .loadDiskFileSynchronously: loadDiskFileSynchronously = true\n            case .memoryCacheExpiration(let expiration): memoryCacheExpiration = expiration\n            case .memoryCacheAccessExtendingExpiration(let expirationExtending): memoryCacheAccessExtendingExpiration = expirationExtending\n            case .diskCacheExpiration(let expiration): diskCacheExpiration = expiration\n            case .diskCacheAccessExtendingExpiration(let expirationExtending): diskCacheAccessExtendingExpiration = expirationExtending\n            case .processingQueue(let queue): processingQueue = queue\n            case .progressiveJPEG(let value): progressiveJPEG = value\n            case .alternativeSources(let sources): alternativeSources = sources\n            case .retryStrategy(let strategy): retryStrategy = strategy\n            case .lowDataMode(let source): lowDataModeSource = source\n            }\n        }\n\n        if originalCache == nil {\n            originalCache = targetCache\n        }\n    }\n}\n\nextension KingfisherParsedOptionsInfo {\n    var imageCreatingOptions: ImageCreatingOptions {\n        return ImageCreatingOptions(\n            scale: scaleFactor,\n            duration: 0.0,\n            preloadAll: preloadAllAnimationData,\n            onlyFirstFrame: onlyLoadFirstFrame)\n    }\n}\n\nprotocol DataReceivingSideEffect: AnyObject {\n    var onShouldApply: () -> Bool { get set }\n    func onDataReceived(_ session: URLSession, task: SessionDataTask, data: Data)\n}\n\nclass ImageLoadingProgressSideEffect: DataReceivingSideEffect {\n\n    var onShouldApply: () -> Bool = { return true }\n    \n    let block: DownloadProgressBlock\n\n    init(_ block: @escaping DownloadProgressBlock) {\n        self.block = block\n    }\n\n    func onDataReceived(_ session: URLSession, task: SessionDataTask, data: Data) {\n        guard self.onShouldApply() else { return }\n        guard let expectedContentLength = task.task.response?.expectedContentLength,\n                  expectedContentLength != -1 else\n        {\n            return\n        }\n\n        let dataLength = Int64(task.mutableData.count)\n        DispatchQueue.main.async {\n            self.block(dataLength, expectedContentLength)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/Filter.swift",
    "content": "//\n//  Filter.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2016/08/31.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if !os(watchOS)\n\nimport CoreImage\n\n// Reuse the same CI Context for all CI drawing.\nprivate let ciContext = CIContext(options: nil)\n\n/// Represents the type of transformer method, which will be used in to provide a `Filter`.\npublic typealias Transformer = (CIImage) -> CIImage?\n\n/// Represents a processor based on a `CIImage` `Filter`.\n/// It requires a filter to create an `ImageProcessor`.\npublic protocol CIImageProcessor: ImageProcessor {\n    var filter: Filter { get }\n}\n\nextension CIImageProcessor {\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.apply(filter)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n/// A wrapper struct for a `Transformer` of CIImage filters. A `Filter`\n/// value could be used to create a `CIImage` processor.\npublic struct Filter {\n    \n    let transform: Transformer\n\n    public init(transform: @escaping Transformer) {\n        self.transform = transform\n    }\n    \n    /// Tint filter which will apply a tint color to images.\n    public static var tint: (KFCrossPlatformColor) -> Filter = {\n        color in\n        Filter {\n            input in\n            \n            let colorFilter = CIFilter(name: \"CIConstantColorGenerator\")!\n            colorFilter.setValue(CIColor(color: color), forKey: kCIInputColorKey)\n            \n            let filter = CIFilter(name: \"CISourceOverCompositing\")!\n            \n            let colorImage = colorFilter.outputImage\n            filter.setValue(colorImage, forKey: kCIInputImageKey)\n            filter.setValue(input, forKey: kCIInputBackgroundImageKey)\n            \n            return filter.outputImage?.cropped(to: input.extent)\n        }\n    }\n    \n    /// Represents color control elements. It is a tuple of\n    /// `(brightness, contrast, saturation, inputEV)`\n    public typealias ColorElement = (CGFloat, CGFloat, CGFloat, CGFloat)\n    \n    /// Color control filter which will apply color control change to images.\n    public static var colorControl: (ColorElement) -> Filter = { arg -> Filter in\n        let (brightness, contrast, saturation, inputEV) = arg\n        return Filter { input in\n            let paramsColor = [kCIInputBrightnessKey: brightness,\n                               kCIInputContrastKey: contrast,\n                               kCIInputSaturationKey: saturation]\n            let blackAndWhite = input.applyingFilter(\"CIColorControls\", parameters: paramsColor)\n            let paramsExposure = [kCIInputEVKey: inputEV]\n            return blackAndWhite.applyingFilter(\"CIExposureAdjust\", parameters: paramsExposure)\n        }\n    }\n}\n\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n\n    /// Applies a `Filter` containing `CIImage` transformer to `self`.\n    ///\n    /// - Parameter filter: The filter used to transform `self`.\n    /// - Returns: A transformed image by input `Filter`.\n    ///\n    /// - Note:\n    ///    Only CG-based images are supported. If any error happens\n    ///    during transforming, `self` will be returned.\n    public func apply(_ filter: Filter) -> KFCrossPlatformImage {\n        \n        guard let cgImage = cgImage else {\n            assertionFailure(\"[Kingfisher] Tint image only works for CG-based image.\")\n            return base\n        }\n        \n        let inputImage = CIImage(cgImage: cgImage)\n        guard let outputImage = filter.transform(inputImage) else {\n            return base\n        }\n\n        guard let result = ciContext.createCGImage(outputImage, from: outputImage.extent) else {\n            assertionFailure(\"[Kingfisher] Can not make an tint image within context.\")\n            return base\n        }\n        \n        #if os(macOS)\n            return fixedForRetinaPixel(cgImage: result, to: size)\n        #else\n            return KFCrossPlatformImage(cgImage: result, scale: base.scale, orientation: base.imageOrientation)\n        #endif\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/GIFAnimatedImage.swift",
    "content": "//\n//  AnimatedImage.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/09/26.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport ImageIO\n\n/// Represents a set of image creating options used in Kingfisher.\npublic struct ImageCreatingOptions {\n\n    /// The target scale of image needs to be created.\n    public let scale: CGFloat\n\n    /// The expected animation duration if an animated image being created.\n    public let duration: TimeInterval\n\n    /// For an animated image, whether or not all frames should be loaded before displaying.\n    public let preloadAll: Bool\n\n    /// For an animated image, whether or not only the first image should be\n    /// loaded as a static image. It is useful for preview purpose of an animated image.\n    public let onlyFirstFrame: Bool\n    \n    /// Creates an `ImageCreatingOptions` object.\n    ///\n    /// - Parameters:\n    ///   - scale: The target scale of image needs to be created. Default is `1.0`.\n    ///   - duration: The expected animation duration if an animated image being created.\n    ///               A value less or equal to `0.0` means the animated image duration will\n    ///               be determined by the frame data. Default is `0.0`.\n    ///   - preloadAll: For an animated image, whether or not all frames should be loaded before displaying.\n    ///                 Default is `false`.\n    ///   - onlyFirstFrame: For an animated image, whether or not only the first image should be\n    ///                     loaded as a static image. It is useful for preview purpose of an animated image.\n    ///                     Default is `false`.\n    public init(\n        scale: CGFloat = 1.0,\n        duration: TimeInterval = 0.0,\n        preloadAll: Bool = false,\n        onlyFirstFrame: Bool = false)\n    {\n        self.scale = scale\n        self.duration = duration\n        self.preloadAll = preloadAll\n        self.onlyFirstFrame = onlyFirstFrame\n    }\n}\n\n// Represents the decoding for a GIF image. This class extracts frames from an `imageSource`, then\n// hold the images for later use.\nclass GIFAnimatedImage {\n    let images: [KFCrossPlatformImage]\n    let duration: TimeInterval\n    \n    init?(from imageSource: CGImageSource, for info: [String: Any], options: ImageCreatingOptions) {\n        let frameCount = CGImageSourceGetCount(imageSource)\n        var images = [KFCrossPlatformImage]()\n        var gifDuration = 0.0\n        \n        for i in 0 ..< frameCount {\n            guard let imageRef = CGImageSourceCreateImageAtIndex(imageSource, i, info as CFDictionary) else {\n                return nil\n            }\n            \n            if frameCount == 1 {\n                gifDuration = .infinity\n            } else {\n                // Get current animated GIF frame duration\n                gifDuration += GIFAnimatedImage.getFrameDuration(from: imageSource, at: i)\n            }\n            images.append(KingfisherWrapper.image(cgImage: imageRef, scale: options.scale, refImage: nil))\n            if options.onlyFirstFrame { break }\n        }\n        self.images = images\n        self.duration = gifDuration\n    }\n    \n    // Calculates frame duration for a gif frame out of the kCGImagePropertyGIFDictionary dictionary.\n    static func getFrameDuration(from gifInfo: [String: Any]?) -> TimeInterval {\n        let defaultFrameDuration = 0.1\n        guard let gifInfo = gifInfo else { return defaultFrameDuration }\n        \n        let unclampedDelayTime = gifInfo[kCGImagePropertyGIFUnclampedDelayTime as String] as? NSNumber\n        let delayTime = gifInfo[kCGImagePropertyGIFDelayTime as String] as? NSNumber\n        let duration = unclampedDelayTime ?? delayTime\n        \n        guard let frameDuration = duration else { return defaultFrameDuration }\n        return frameDuration.doubleValue > 0.011 ? frameDuration.doubleValue : defaultFrameDuration\n    }\n\n    // Calculates frame duration at a specific index for a gif from an `imageSource`.\n    static func getFrameDuration(from imageSource: CGImageSource, at index: Int) -> TimeInterval {\n        guard let properties = CGImageSourceCopyPropertiesAtIndex(imageSource, index, nil)\n            as? [String: Any] else { return 0.0 }\n\n        let gifInfo = properties[kCGImagePropertyGIFDictionary as String] as? [String: Any]\n        return getFrameDuration(from: gifInfo)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/GraphicsContext.swift",
    "content": "//\n//  GraphicsContext.swift\n//  Kingfisher\n//\n//  Created by taras on 19/04/2021.\n//\n//  Copyright (c) 2021 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n#endif\n#if canImport(UIKit)\nimport UIKit\n#endif\n\nenum GraphicsContext {\n    static func begin(size: CGSize, scale: CGFloat) {\n        #if os(macOS)\n        NSGraphicsContext.saveGraphicsState()\n        #else\n        UIGraphicsBeginImageContextWithOptions(size, false, scale)\n        #endif\n    }\n    \n    static func current(size: CGSize, scale: CGFloat, inverting: Bool, cgImage: CGImage?) -> CGContext? {\n        #if os(macOS)\n        guard let rep = NSBitmapImageRep(\n            bitmapDataPlanes: nil,\n            pixelsWide: Int(size.width),\n            pixelsHigh: Int(size.height),\n            bitsPerSample: cgImage?.bitsPerComponent ?? 8,\n            samplesPerPixel: 4,\n            hasAlpha: true,\n            isPlanar: false,\n            colorSpaceName: .calibratedRGB,\n            bytesPerRow: 0,\n            bitsPerPixel: 0) else\n        {\n            assertionFailure(\"[Kingfisher] Image representation cannot be created.\")\n            return nil\n        }\n        rep.size = size\n        guard let context = NSGraphicsContext(bitmapImageRep: rep) else {\n            assertionFailure(\"[Kingfisher] Image context cannot be created.\")\n            return nil\n        }\n        \n        NSGraphicsContext.current = context\n        return context.cgContext\n        #else\n        guard let context = UIGraphicsGetCurrentContext() else {\n            return nil\n        }\n        if inverting { // If drawing a CGImage, we need to make context flipped.\n            context.scaleBy(x: 1.0, y: -1.0)\n            context.translateBy(x: 0, y: -size.height)\n        }\n        return context\n        #endif\n    }\n    \n    static func end() {\n        #if os(macOS)\n        NSGraphicsContext.restoreGraphicsState()\n        #else\n        UIGraphicsEndImageContext()\n        #endif\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/Image.swift",
    "content": "//\n//  Image.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 16/1/6.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n\n#if os(macOS)\nimport AppKit\nprivate var imagesKey: Void?\nprivate var durationKey: Void?\n#else\nimport UIKit\nimport MobileCoreServices\nprivate var imageSourceKey: Void?\n#endif\n\n#if !os(watchOS)\nimport CoreImage\n#endif\n\nimport CoreGraphics\nimport ImageIO\n\nprivate var animatedImageDataKey: Void?\nprivate var imageFrameCountKey: Void?\n\n// MARK: - Image Properties\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n    private(set) var animatedImageData: Data? {\n        get { return getAssociatedObject(base, &animatedImageDataKey) }\n        set { setRetainedAssociatedObject(base, &animatedImageDataKey, newValue) }\n    }\n    \n    public var imageFrameCount: Int? {\n        get { return getAssociatedObject(base, &imageFrameCountKey) }\n        set { setRetainedAssociatedObject(base, &imageFrameCountKey, newValue) }\n    }\n    \n    #if os(macOS)\n    var cgImage: CGImage? {\n        return base.cgImage(forProposedRect: nil, context: nil, hints: nil)\n    }\n    \n    var scale: CGFloat {\n        return 1.0\n    }\n    \n    private(set) var images: [KFCrossPlatformImage]? {\n        get { return getAssociatedObject(base, &imagesKey) }\n        set { setRetainedAssociatedObject(base, &imagesKey, newValue) }\n    }\n    \n    private(set) var duration: TimeInterval {\n        get { return getAssociatedObject(base, &durationKey) ?? 0.0 }\n        set { setRetainedAssociatedObject(base, &durationKey, newValue) }\n    }\n    \n    var size: CGSize {\n        return base.representations.reduce(.zero) { size, rep in\n            let width = max(size.width, CGFloat(rep.pixelsWide))\n            let height = max(size.height, CGFloat(rep.pixelsHigh))\n            return CGSize(width: width, height: height)\n        }\n    }\n    #else\n    var cgImage: CGImage? { return base.cgImage }\n    var scale: CGFloat { return base.scale }\n    var images: [KFCrossPlatformImage]? { return base.images }\n    var duration: TimeInterval { return base.duration }\n    var size: CGSize { return base.size }\n    \n    private(set) var imageSource: CGImageSource? {\n        get { return getAssociatedObject(base, &imageSourceKey) }\n        set { setRetainedAssociatedObject(base, &imageSourceKey, newValue) }\n    }\n    #endif\n\n    // Bitmap memory cost with bytes.\n    var cost: Int {\n        let pixel = Int(size.width * size.height * scale * scale)\n        guard let cgImage = cgImage else {\n            return pixel * 4\n        }\n        return pixel * cgImage.bitsPerPixel / 8\n    }\n}\n\n// MARK: - Image Conversion\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n    #if os(macOS)\n    static func image(cgImage: CGImage, scale: CGFloat, refImage: KFCrossPlatformImage?) -> KFCrossPlatformImage {\n        return KFCrossPlatformImage(cgImage: cgImage, size: .zero)\n    }\n    \n    /// Normalize the image. This getter does nothing on macOS but return the image itself.\n    public var normalized: KFCrossPlatformImage { return base }\n\n    #else\n    /// Creating an image from a give `CGImage` at scale and orientation for refImage. The method signature is for\n    /// compatibility of macOS version.\n    static func image(cgImage: CGImage, scale: CGFloat, refImage: KFCrossPlatformImage?) -> KFCrossPlatformImage {\n        return KFCrossPlatformImage(cgImage: cgImage, scale: scale, orientation: refImage?.imageOrientation ?? .up)\n    }\n    \n    /// Returns normalized image for current `base` image.\n    /// This method will try to redraw an image with orientation and scale considered.\n    public var normalized: KFCrossPlatformImage {\n        // prevent animated image (GIF) lose it's images\n        guard images == nil else { return base.copy() as! KFCrossPlatformImage }\n        // No need to do anything if already up\n        guard base.imageOrientation != .up else { return base.copy() as! KFCrossPlatformImage }\n\n        return draw(to: size, inverting: true, refImage: KFCrossPlatformImage()) {\n            fixOrientation(in: $0)\n            return true\n        }\n    }\n\n    func fixOrientation(in context: CGContext) {\n\n        var transform = CGAffineTransform.identity\n\n        let orientation = base.imageOrientation\n\n        switch orientation {\n        case .down, .downMirrored:\n            transform = transform.translatedBy(x: size.width, y: size.height)\n            transform = transform.rotated(by: .pi)\n        case .left, .leftMirrored:\n            transform = transform.translatedBy(x: size.width, y: 0)\n            transform = transform.rotated(by: .pi / 2.0)\n        case .right, .rightMirrored:\n            transform = transform.translatedBy(x: 0, y: size.height)\n            transform = transform.rotated(by: .pi / -2.0)\n        case .up, .upMirrored:\n            break\n        #if compiler(>=5)\n        @unknown default:\n            break\n        #endif\n        }\n\n        //Flip image one more time if needed to, this is to prevent flipped image\n        switch orientation {\n        case .upMirrored, .downMirrored:\n            transform = transform.translatedBy(x: size.width, y: 0)\n            transform = transform.scaledBy(x: -1, y: 1)\n        case .leftMirrored, .rightMirrored:\n            transform = transform.translatedBy(x: size.height, y: 0)\n            transform = transform.scaledBy(x: -1, y: 1)\n        case .up, .down, .left, .right:\n            break\n        #if compiler(>=5)\n        @unknown default:\n            break\n        #endif\n        }\n\n        context.concatenate(transform)\n        switch orientation {\n        case .left, .leftMirrored, .right, .rightMirrored:\n            context.draw(cgImage!, in: CGRect(x: 0, y: 0, width: size.height, height: size.width))\n        default:\n            context.draw(cgImage!, in: CGRect(x: 0, y: 0, width: size.width, height: size.height))\n        }\n    }\n    #endif\n}\n\n// MARK: - Image Representation\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n    /// Returns PNG representation of `base` image.\n    ///\n    /// - Returns: PNG data of image.\n    public func pngRepresentation() -> Data? {\n        #if os(macOS)\n            guard let cgImage = cgImage else {\n                return nil\n            }\n            let rep = NSBitmapImageRep(cgImage: cgImage)\n            return rep.representation(using: .png, properties: [:])\n        #else\n            return base.pngData()\n        #endif\n    }\n\n    /// Returns JPEG representation of `base` image.\n    ///\n    /// - Parameter compressionQuality: The compression quality when converting image to JPEG data.\n    /// - Returns: JPEG data of image.\n    public func jpegRepresentation(compressionQuality: CGFloat) -> Data? {\n        #if os(macOS)\n            guard let cgImage = cgImage else {\n                return nil\n            }\n            let rep = NSBitmapImageRep(cgImage: cgImage)\n            return rep.representation(using:.jpeg, properties: [.compressionFactor: compressionQuality])\n        #else\n            return base.jpegData(compressionQuality: compressionQuality)\n        #endif\n    }\n\n    /// Returns GIF representation of `base` image.\n    ///\n    /// - Returns: Original GIF data of image.\n    public func gifRepresentation() -> Data? {\n        return animatedImageData\n    }\n\n    /// Returns a data representation for `base` image, with the `format` as the format indicator.\n    ///\n    /// - Parameter format: The format in which the output data should be. If `unknown`, the `base` image will be\n    ///                     converted in the PNG representation.\n    ///\n    /// - Returns: The output data representing.\n\n    /// Returns a data representation for `base` image, with the `format` as the format indicator.\n    /// - Parameters:\n    ///   - format: The format in which the output data should be. If `unknown`, the `base` image will be\n    ///   converted in the PNG representation.\n    ///   - compressionQuality: The compression quality when converting image to a lossy format data.\n    public func data(format: ImageFormat, compressionQuality: CGFloat = 1.0) -> Data? {\n        return autoreleasepool { () -> Data? in\n            let data: Data?\n            switch format {\n            case .PNG: data = pngRepresentation()\n            case .JPEG: data = jpegRepresentation(compressionQuality: compressionQuality)\n            case .GIF: data = gifRepresentation()\n            case .unknown: data = normalized.kf.pngRepresentation()\n            }\n            \n            return data\n        }\n    }\n}\n\n// MARK: - Creating Images\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n\n    /// Creates an animated image from a given data and options. Currently only GIF data is supported.\n    ///\n    /// - Parameters:\n    ///   - data: The animated image data.\n    ///   - options: Options to use when creating the animated image.\n    /// - Returns: An `Image` object represents the animated image. It is in form of an array of image frames with a\n    ///            certain duration. `nil` if anything wrong when creating animated image.\n    public static func animatedImage(data: Data, options: ImageCreatingOptions) -> KFCrossPlatformImage? {\n        let info: [String: Any] = [\n            kCGImageSourceShouldCache as String: true,\n            kCGImageSourceTypeIdentifierHint as String: kUTTypeGIF\n        ]\n        \n        guard let imageSource = CGImageSourceCreateWithData(data as CFData, info as CFDictionary) else {\n            return nil\n        }\n        \n        #if os(macOS)\n        guard let animatedImage = GIFAnimatedImage(from: imageSource, for: info, options: options) else {\n            return nil\n        }\n        var image: KFCrossPlatformImage?\n        if options.onlyFirstFrame {\n            image = animatedImage.images.first\n        } else {\n            image = KFCrossPlatformImage(data: data)\n            var kf = image?.kf\n            kf?.images = animatedImage.images\n            kf?.duration = animatedImage.duration\n        }\n        image?.kf.animatedImageData = data\n        image?.kf.imageFrameCount = Int(CGImageSourceGetCount(imageSource))\n        return image\n        #else\n        \n        var image: KFCrossPlatformImage?\n        if options.preloadAll || options.onlyFirstFrame {\n            // Use `images` image if you want to preload all animated data\n            guard let animatedImage = GIFAnimatedImage(from: imageSource, for: info, options: options) else {\n                return nil\n            }\n            if options.onlyFirstFrame {\n                image = animatedImage.images.first\n            } else {\n                let duration = options.duration <= 0.0 ? animatedImage.duration : options.duration\n                image = .animatedImage(with: animatedImage.images, duration: duration)\n            }\n            image?.kf.animatedImageData = data\n        } else {\n            image = KFCrossPlatformImage(data: data, scale: options.scale)\n            var kf = image?.kf\n            kf?.imageSource = imageSource\n            kf?.animatedImageData = data\n        }\n        \n        image?.kf.imageFrameCount = Int(CGImageSourceGetCount(imageSource))\n        return image\n        #endif\n    }\n\n    /// Creates an image from a given data and options. `.JPEG`, `.PNG` or `.GIF` is supported. For other\n    /// image format, image initializer from system will be used. If no image object could be created from\n    /// the given `data`, `nil` will be returned.\n    ///\n    /// - Parameters:\n    ///   - data: The image data representation.\n    ///   - options: Options to use when creating the image.\n    /// - Returns: An `Image` object represents the image if created. If the `data` is invalid or not supported, `nil`\n    ///            will be returned.\n    public static func image(data: Data, options: ImageCreatingOptions) -> KFCrossPlatformImage? {\n        var image: KFCrossPlatformImage?\n        switch data.kf.imageFormat {\n        case .JPEG:\n            image = KFCrossPlatformImage(data: data, scale: options.scale)\n        case .PNG:\n            image = KFCrossPlatformImage(data: data, scale: options.scale)\n        case .GIF:\n            image = KingfisherWrapper.animatedImage(data: data, options: options)\n        case .unknown:\n            image = KFCrossPlatformImage(data: data, scale: options.scale)\n        }\n        return image\n    }\n    \n    /// Creates a downsampled image from given data to a certain size and scale.\n    ///\n    /// - Parameters:\n    ///   - data: The image data contains a JPEG or PNG image.\n    ///   - pointSize: The target size in point to which the image should be downsampled.\n    ///   - scale: The scale of result image.\n    /// - Returns: A downsampled `Image` object following the input conditions.\n    ///\n    /// - Note:\n    /// Different from image `resize` methods, downsampling will not render the original\n    /// input image in pixel format. It does downsampling from the image data, so it is much\n    /// more memory efficient and friendly. Choose to use downsampling as possible as you can.\n    ///\n    /// The input size should be smaller than the size of input image. If it is larger than the\n    /// original image size, the result image will be the same size of input without downsampling.\n    public static func downsampledImage(data: Data, to pointSize: CGSize, scale: CGFloat) -> KFCrossPlatformImage? {\n        let imageSourceOptions = [kCGImageSourceShouldCache: false] as CFDictionary\n        guard let imageSource = CGImageSourceCreateWithData(data as CFData, imageSourceOptions) else {\n            return nil\n        }\n        \n        let maxDimensionInPixels = max(pointSize.width, pointSize.height) * scale\n        let downsampleOptions = [\n            kCGImageSourceCreateThumbnailFromImageAlways: true,\n            kCGImageSourceShouldCacheImmediately: true,\n            kCGImageSourceCreateThumbnailWithTransform: true,\n            kCGImageSourceThumbnailMaxPixelSize: maxDimensionInPixels] as CFDictionary\n        guard let downsampledImage = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, downsampleOptions) else {\n            return nil\n        }\n        return KingfisherWrapper.image(cgImage: downsampledImage, scale: scale, refImage: nil)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/ImageDrawing.swift",
    "content": "//\n//  ImageDrawing.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/09/28.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Accelerate\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n#endif\n#if canImport(UIKit)\nimport UIKit\n#endif\n\n// MARK: - Image Transforming\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n    // MARK: Blend Mode\n    /// Create image from `base` image and apply blend mode.\n    ///\n    /// - parameter blendMode:       The blend mode of creating image.\n    /// - parameter alpha:           The alpha should be used for image.\n    /// - parameter backgroundColor: The background color for the output image.\n    ///\n    /// - returns: An image with blend mode applied.\n    ///\n    /// - Note: This method only works for CG-based image.\n    #if !os(macOS)\n    public func image(withBlendMode blendMode: CGBlendMode,\n                      alpha: CGFloat = 1.0,\n                      backgroundColor: KFCrossPlatformColor? = nil) -> KFCrossPlatformImage\n    {\n        guard let _ = cgImage else {\n            assertionFailure(\"[Kingfisher] Blend mode image only works for CG-based image.\")\n            return base\n        }\n        \n        let rect = CGRect(origin: .zero, size: size)\n        return draw(to: rect.size) { _ in\n            if let backgroundColor = backgroundColor {\n                backgroundColor.setFill()\n                UIRectFill(rect)\n            }\n            \n            base.draw(in: rect, blendMode: blendMode, alpha: alpha)\n            return false\n        }\n    }\n    #endif\n    \n    #if os(macOS)\n    // MARK: Compositing\n    /// Creates image from `base` image and apply compositing operation.\n    ///\n    /// - Parameters:\n    ///   - compositingOperation: The compositing operation of creating image.\n    ///   - alpha: The alpha should be used for image.\n    ///   - backgroundColor: The background color for the output image.\n    /// - Returns: An image with compositing operation applied.\n    ///\n    /// - Note: This method only works for CG-based image. For any non-CG-based image, `base` itself is returned.\n    public func image(withCompositingOperation compositingOperation: NSCompositingOperation,\n                      alpha: CGFloat = 1.0,\n                      backgroundColor: KFCrossPlatformColor? = nil) -> KFCrossPlatformImage\n    {\n        guard let _ = cgImage else {\n            assertionFailure(\"[Kingfisher] Compositing Operation image only works for CG-based image.\")\n            return base\n        }\n        \n        let rect = CGRect(origin: .zero, size: size)\n        return draw(to: rect.size) { _ in\n            if let backgroundColor = backgroundColor {\n                backgroundColor.setFill()\n                rect.fill()\n            }\n            base.draw(in: rect, from: .zero, operation: compositingOperation, fraction: alpha)\n            return false\n        }\n    }\n    #endif\n    \n    // MARK: Round Corner\n    /// Creates a round corner image from on `base` image.\n    ///\n    /// - Parameters:\n    ///   - radius: The round corner radius of creating image.\n    ///   - size: The target size of creating image.\n    ///   - corners: The target corners which will be applied rounding.\n    ///   - backgroundColor: The background color for the output image\n    /// - Returns: An image with round corner of `self`.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image, `base` itself is returned.\n    public func image(withRoundRadius radius: CGFloat,\n                      fit size: CGSize,\n                      roundingCorners corners: RectCorner = .all,\n                      backgroundColor: KFCrossPlatformColor? = nil) -> KFCrossPlatformImage\n    {\n        guard let _ = cgImage else {\n            assertionFailure(\"[Kingfisher] Round corner image only works for CG-based image.\")\n            return base\n        }\n        \n        let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: size)\n        return draw(to: size) { _ in\n            #if os(macOS)\n            if let backgroundColor = backgroundColor {\n                let rectPath = NSBezierPath(rect: rect)\n                backgroundColor.setFill()\n                rectPath.fill()\n            }\n            \n            let path = NSBezierPath(roundedRect: rect, byRoundingCorners: corners, radius: radius)\n            path.windingRule = .evenOdd\n            path.addClip()\n            base.draw(in: rect)\n            #else\n            guard let context = UIGraphicsGetCurrentContext() else {\n                assertionFailure(\"[Kingfisher] Failed to create CG context for image.\")\n                return false\n            }\n            \n            if let backgroundColor = backgroundColor {\n                let rectPath = UIBezierPath(rect: rect)\n                backgroundColor.setFill()\n                rectPath.fill()\n            }\n            \n            let path = UIBezierPath(\n                roundedRect: rect,\n                byRoundingCorners: corners.uiRectCorner,\n                cornerRadii: CGSize(width: radius, height: radius)\n            )\n            context.addPath(path.cgPath)\n            context.clip()\n            base.draw(in: rect)\n            #endif\n            return false\n        }\n    }\n    \n    #if os(iOS) || os(tvOS)\n    func resize(to size: CGSize, for contentMode: UIView.ContentMode) -> KFCrossPlatformImage {\n        switch contentMode {\n        case .scaleAspectFit:\n            return resize(to: size, for: .aspectFit)\n        case .scaleAspectFill:\n            return resize(to: size, for: .aspectFill)\n        default:\n            return resize(to: size)\n        }\n    }\n    #endif\n    \n    // MARK: Resizing\n    /// Resizes `base` image to an image with new size.\n    ///\n    /// - Parameter size: The target size in point.\n    /// - Returns: An image with new size.\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image, `base` itself is returned.\n    public func resize(to size: CGSize) -> KFCrossPlatformImage {\n        guard let _ = cgImage else {\n            assertionFailure(\"[Kingfisher] Resize only works for CG-based image.\")\n            return base\n        }\n        \n        let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: size)\n        return draw(to: size) { _ in\n            #if os(macOS)\n            base.draw(in: rect, from: .zero, operation: .copy, fraction: 1.0)\n            #else\n            base.draw(in: rect)\n            #endif\n            return false\n        }\n    }\n    \n    /// Resizes `base` image to an image of new size, respecting the given content mode.\n    ///\n    /// - Parameters:\n    ///   - targetSize: The target size in point.\n    ///   - contentMode: Content mode of output image should be.\n    /// - Returns: An image with new size.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image, `base` itself is returned.\n    public func resize(to targetSize: CGSize, for contentMode: ContentMode) -> KFCrossPlatformImage {\n        let newSize = size.kf.resize(to: targetSize, for: contentMode)\n        return resize(to: newSize)\n    }\n\n    // MARK: Cropping\n    /// Crops `base` image to a new size with a given anchor.\n    ///\n    /// - Parameters:\n    ///   - size: The target size.\n    ///   - anchor: The anchor point from which the size should be calculated.\n    /// - Returns: An image with new size.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image, `base` itself is returned.\n    public func crop(to size: CGSize, anchorOn anchor: CGPoint) -> KFCrossPlatformImage {\n        guard let cgImage = cgImage else {\n            assertionFailure(\"[Kingfisher] Crop only works for CG-based image.\")\n            return base\n        }\n        \n        let rect = self.size.kf.constrainedRect(for: size, anchor: anchor)\n        guard let image = cgImage.cropping(to: rect.scaled(scale)) else {\n            assertionFailure(\"[Kingfisher] Cropping image failed.\")\n            return base\n        }\n        \n        return KingfisherWrapper.image(cgImage: image, scale: scale, refImage: base)\n    }\n    \n    // MARK: Blur\n    /// Creates an image with blur effect based on `base` image.\n    ///\n    /// - Parameter radius: The blur radius should be used when creating blur effect.\n    /// - Returns: An image with blur effect applied.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image, `base` itself is returned.\n    public func blurred(withRadius radius: CGFloat) -> KFCrossPlatformImage {\n        \n        guard let cgImage = cgImage else {\n            assertionFailure(\"[Kingfisher] Blur only works for CG-based image.\")\n            return base\n        }\n        \n        // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement\n        // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5)\n        // if d is odd, use three box-blurs of size 'd', centered on the output pixel.\n        let s = max(radius, 2.0)\n        // We will do blur on a resized image (*0.5), so the blur radius could be half as well.\n        \n        // Fix the slow compiling time for Swift 3.\n        // See https://github.com/onevcat/Kingfisher/issues/611\n        let pi2 = 2 * CGFloat.pi\n        let sqrtPi2 = sqrt(pi2)\n        var targetRadius = floor(s * 3.0 * sqrtPi2 / 4.0 + 0.5)\n        \n        if targetRadius.isEven { targetRadius += 1 }\n\n        // Determine necessary iteration count by blur radius.\n        let iterations: Int\n        if radius < 0.5 {\n            iterations = 1\n        } else if radius < 1.5 {\n            iterations = 2\n        } else {\n            iterations = 3\n        }\n        \n        let w = Int(size.width)\n        let h = Int(size.height)\n        \n        func createEffectBuffer(_ context: CGContext) -> vImage_Buffer {\n            let data = context.data\n            let width = vImagePixelCount(context.width)\n            let height = vImagePixelCount(context.height)\n            let rowBytes = context.bytesPerRow\n            \n            return vImage_Buffer(data: data, height: height, width: width, rowBytes: rowBytes)\n        }\n        GraphicsContext.begin(size: size, scale: scale)\n        guard let context = GraphicsContext.current(size: size, scale: scale, inverting: true, cgImage: cgImage) else {\n            assertionFailure(\"[Kingfisher] Failed to create CG context for blurring image.\")\n            return base\n        }\n        context.draw(cgImage, in: CGRect(x: 0, y: 0, width: w, height: h))\n        GraphicsContext.end()\n        \n        var inBuffer = createEffectBuffer(context)\n        \n        GraphicsContext.begin(size: size, scale: scale)\n        guard let outContext = GraphicsContext.current(size: size, scale: scale, inverting: true, cgImage: cgImage) else {\n            assertionFailure(\"[Kingfisher] Failed to create CG context for blurring image.\")\n            return base\n        }\n        defer { GraphicsContext.end() }\n        var outBuffer = createEffectBuffer(outContext)\n        \n        for _ in 0 ..< iterations {\n            let flag = vImage_Flags(kvImageEdgeExtend)\n            vImageBoxConvolve_ARGB8888(\n                &inBuffer, &outBuffer, nil, 0, 0, UInt32(targetRadius), UInt32(targetRadius), nil, flag)\n            // Next inBuffer should be the outButter of current iteration\n            (inBuffer, outBuffer) = (outBuffer, inBuffer)\n        }\n        \n        #if os(macOS)\n        let result = outContext.makeImage().flatMap {\n            fixedForRetinaPixel(cgImage: $0, to: size)\n        }\n        #else\n        let result = outContext.makeImage().flatMap {\n            KFCrossPlatformImage(cgImage: $0, scale: base.scale, orientation: base.imageOrientation)\n        }\n        #endif\n        guard let blurredImage = result else {\n            assertionFailure(\"[Kingfisher] Can not make an blurred image within this context.\")\n            return base\n        }\n        \n        return blurredImage\n    }\n    \n    // MARK: Overlay\n    /// Creates an image from `base` image with a color overlay layer.\n    ///\n    /// - Parameters:\n    ///   - color: The color should be use to overlay.\n    ///   - fraction: Fraction of input color. From 0.0 to 1.0. 0.0 means solid color,\n    ///               1.0 means transparent overlay.\n    /// - Returns: An image with a color overlay applied.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image, `base` itself is returned.\n    public func overlaying(with color: KFCrossPlatformColor, fraction: CGFloat) -> KFCrossPlatformImage {\n        \n        guard let _ = cgImage else {\n            assertionFailure(\"[Kingfisher] Overlaying only works for CG-based image.\")\n            return base\n        }\n        \n        let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)\n        return draw(to: rect.size) { context in\n            #if os(macOS)\n            base.draw(in: rect)\n            if fraction > 0 {\n                color.withAlphaComponent(1 - fraction).set()\n                rect.fill(using: .sourceAtop)\n            }\n            #else\n            color.set()\n            UIRectFill(rect)\n            base.draw(in: rect, blendMode: .destinationIn, alpha: 1.0)\n            \n            if fraction > 0 {\n                base.draw(in: rect, blendMode: .sourceAtop, alpha: fraction)\n            }\n            #endif\n            return false\n        }\n    }\n    \n    // MARK: Tint\n    /// Creates an image from `base` image with a color tint.\n    ///\n    /// - Parameter color: The color should be used to tint `base`\n    /// - Returns: An image with a color tint applied.\n    public func tinted(with color: KFCrossPlatformColor) -> KFCrossPlatformImage {\n        #if os(watchOS)\n        return base\n        #else\n        return apply(.tint(color))\n        #endif\n    }\n    \n    // MARK: Color Control\n    \n    /// Create an image from `self` with color control.\n    ///\n    /// - Parameters:\n    ///   - brightness: Brightness changing to image.\n    ///   - contrast: Contrast changing to image.\n    ///   - saturation: Saturation changing to image.\n    ///   - inputEV: InputEV changing to image.\n    /// - Returns:  An image with color control applied.\n    public func adjusted(brightness: CGFloat, contrast: CGFloat, saturation: CGFloat, inputEV: CGFloat) -> KFCrossPlatformImage {\n        #if os(watchOS)\n        return base\n        #else\n        return apply(.colorControl((brightness, contrast, saturation, inputEV)))\n        #endif\n    }\n    \n    /// Return an image with given scale.\n    ///\n    /// - Parameter scale: Target scale factor the new image should have.\n    /// - Returns: The image with target scale. If the base image is already in the scale, `base` will be returned.\n    public func scaled(to scale: CGFloat) -> KFCrossPlatformImage {\n        guard scale != self.scale else {\n            return base\n        }\n        guard let cgImage = cgImage else {\n            assertionFailure(\"[Kingfisher] Scaling only works for CG-based image.\")\n            return base\n        }\n        return KingfisherWrapper.image(cgImage: cgImage, scale: scale, refImage: base)\n    }\n}\n\n// MARK: - Decoding Image\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n    \n    /// Returns the decoded image of the `base` image. It will draw the image in a plain context and return the data\n    /// from it. This could improve the drawing performance when an image is just created from data but not yet\n    /// displayed for the first time.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image or animated image, `base` itself is returned.\n    public var decoded: KFCrossPlatformImage { return decoded(scale: scale) }\n    \n    /// Returns decoded image of the `base` image at a given scale. It will draw the image in a plain context and\n    /// return the data from it. This could improve the drawing performance when an image is just created from\n    /// data but not yet displayed for the first time.\n    ///\n    /// - Parameter scale: The given scale of target image should be.\n    /// - Returns: The decoded image ready to be displayed.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image or animated image, `base` itself is returned.\n    public func decoded(scale: CGFloat) -> KFCrossPlatformImage {\n        // Prevent animated image (GIF) losing it's images\n        #if os(iOS)\n        if imageSource != nil { return base }\n        #else\n        if images != nil { return base }\n        #endif\n\n        guard let imageRef = cgImage else {\n            assertionFailure(\"[Kingfisher] Decoding only works for CG-based image.\")\n            return base\n        }\n\n        let size = CGSize(width: CGFloat(imageRef.width) / scale, height: CGFloat(imageRef.height) / scale)\n        return draw(to: size, inverting: true, scale: scale) { context in\n            context.draw(imageRef, in: CGRect(origin: .zero, size: size))\n            return true\n        }\n    }\n\n    /// Returns decoded image of the `base` image at a given scale. It will draw the image in a plain context and\n    /// return the data from it. This could improve the drawing performance when an image is just created from\n    /// data but not yet displayed for the first time.\n    ///\n    /// - Parameter context: The context for drawing.\n    /// - Returns: The decoded image ready to be displayed.\n    ///\n    /// - Note: This method only works for CG-based image. The current image scale is kept.\n    ///         For any non-CG-based image or animated image, `base` itself is returned.\n    public func decoded(on context: CGContext) -> KFCrossPlatformImage {\n        // Prevent animated image (GIF) losing it's images\n        #if os(iOS)\n        if imageSource != nil { return base }\n        #else\n        if images != nil { return base }\n        #endif\n\n        guard let refImage = cgImage else {\n            assertionFailure(\"[Kingfisher] Decoding only works for CG-based image.\")\n            return base\n        }\n\n        let size = CGSize(width: CGFloat(refImage.width) / scale, height: CGFloat(refImage.height) / scale)\n\n        context.draw(refImage, in: CGRect(origin: .zero, size: size))\n\n        guard let cgImage = context.makeImage() else {\n            return base\n        }\n\n        return KingfisherWrapper.image(cgImage: cgImage, scale: scale, refImage: base)\n    }\n}\n\nextension KingfisherWrapper where Base: KFCrossPlatformImage {\n    func draw(\n        to size: CGSize,\n        inverting: Bool = false,\n        scale: CGFloat? = nil,\n        refImage: KFCrossPlatformImage? = nil,\n        draw: (CGContext) -> Bool // Whether use the refImage (`true`) or ignore image orientation (`false`)\n    ) -> KFCrossPlatformImage\n    {\n        let targetScale = scale ?? self.scale\n        GraphicsContext.begin(size: size, scale: targetScale)\n        guard let context = GraphicsContext.current(size: size, scale: targetScale, inverting: inverting, cgImage: cgImage) else {\n            assertionFailure(\"[Kingfisher] Failed to create CG context for blurring image.\")\n            return base\n        }\n        defer { GraphicsContext.end() }\n        let useRefImage = draw(context)\n        guard let cgImage = context.makeImage() else {\n            return base\n        }\n        let ref = useRefImage ? (refImage ?? base) : nil\n        return KingfisherWrapper.image(cgImage: cgImage, scale: targetScale, refImage: ref)\n    }\n    \n    #if os(macOS)\n    func fixedForRetinaPixel(cgImage: CGImage, to size: CGSize) -> KFCrossPlatformImage {\n        \n        let image = KFCrossPlatformImage(cgImage: cgImage, size: base.size)\n        let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: size)\n        \n        return draw(to: self.size) { context in\n            image.draw(in: rect, from: .zero, operation: .copy, fraction: 1.0)\n            return false\n        }\n    }\n    #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/ImageFormat.swift",
    "content": "//\n//  ImageFormat.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/09/28.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents image format.\n///\n/// - unknown: The format cannot be recognized or not supported yet.\n/// - PNG: PNG image format.\n/// - JPEG: JPEG image format.\n/// - GIF: GIF image format.\npublic enum ImageFormat {\n    /// The format cannot be recognized or not supported yet.\n    case unknown\n    /// PNG image format.\n    case PNG\n    /// JPEG image format.\n    case JPEG\n    /// GIF image format.\n    case GIF\n    \n    struct HeaderData {\n        static var PNG: [UInt8] = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]\n        static var JPEG_SOI: [UInt8] = [0xFF, 0xD8]\n        static var JPEG_IF: [UInt8] = [0xFF]\n        static var GIF: [UInt8] = [0x47, 0x49, 0x46]\n    }\n    \n    /// https://en.wikipedia.org/wiki/JPEG\n    public enum JPEGMarker {\n        case SOF0           //baseline\n        case SOF2           //progressive\n        case DHT            //Huffman Table\n        case DQT            //Quantization Table\n        case DRI            //Restart Interval\n        case SOS            //Start Of Scan\n        case RSTn(UInt8)    //Restart\n        case APPn           //Application-specific\n        case COM            //Comment\n        case EOI            //End Of Image\n        \n        var bytes: [UInt8] {\n            switch self {\n            case .SOF0:         return [0xFF, 0xC0]\n            case .SOF2:         return [0xFF, 0xC2]\n            case .DHT:          return [0xFF, 0xC4]\n            case .DQT:          return [0xFF, 0xDB]\n            case .DRI:          return [0xFF, 0xDD]\n            case .SOS:          return [0xFF, 0xDA]\n            case .RSTn(let n):  return [0xFF, 0xD0 + n]\n            case .APPn:         return [0xFF, 0xE0]\n            case .COM:          return [0xFF, 0xFE]\n            case .EOI:          return [0xFF, 0xD9]\n            }\n        }\n    }\n}\n\n\nextension Data: KingfisherCompatibleValue {}\n\n// MARK: - Misc Helpers\nextension KingfisherWrapper where Base == Data {\n    /// Gets the image format corresponding to the data.\n    public var imageFormat: ImageFormat {\n        guard base.count > 8 else { return .unknown }\n        \n        var buffer = [UInt8](repeating: 0, count: 8)\n        base.copyBytes(to: &buffer, count: 8)\n        \n        if buffer == ImageFormat.HeaderData.PNG {\n            return .PNG\n            \n        } else if buffer[0] == ImageFormat.HeaderData.JPEG_SOI[0],\n            buffer[1] == ImageFormat.HeaderData.JPEG_SOI[1],\n            buffer[2] == ImageFormat.HeaderData.JPEG_IF[0]\n        {\n            return .JPEG\n            \n        } else if buffer[0] == ImageFormat.HeaderData.GIF[0],\n            buffer[1] == ImageFormat.HeaderData.GIF[1],\n            buffer[2] == ImageFormat.HeaderData.GIF[2]\n        {\n            return .GIF\n        }\n        \n        return .unknown\n    }\n    \n    public func contains(jpeg marker: ImageFormat.JPEGMarker) -> Bool {\n        guard imageFormat == .JPEG else {\n            return false\n        }\n        \n        var buffer = [UInt8](repeating: 0, count: base.count)\n        base.copyBytes(to: &buffer, count: base.count)\n        for (index, item) in buffer.enumerated() {\n            guard\n                item == marker.bytes.first,\n                buffer.count > index + 1,\n                buffer[index + 1] == marker.bytes[1] else {\n                continue\n            }\n            return true\n        }\n        return false\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/ImageProcessor.swift",
    "content": "//\n//  ImageProcessor.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2016/08/26.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport CoreGraphics\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n#endif\n\n/// Represents an item which could be processed by an `ImageProcessor`.\n///\n/// - image: Input image. The processor should provide a way to apply\n///          processing on this `image` and return the result image.\n/// - data:  Input data. The processor should provide a way to apply\n///          processing on this `image` and return the result image.\npublic enum ImageProcessItem {\n    \n    /// Input image. The processor should provide a way to apply\n    /// processing on this `image` and return the result image.\n    case image(KFCrossPlatformImage)\n    \n    /// Input data. The processor should provide a way to apply\n    /// processing on this `image` and return the result image.\n    case data(Data)\n}\n\n/// An `ImageProcessor` would be used to convert some downloaded data to an image.\npublic protocol ImageProcessor {\n    /// Identifier of the processor. It will be used to identify the processor when \n    /// caching and retrieving an image. You might want to make sure that processors with\n    /// same properties/functionality have the same identifiers, so correct processed images\n    /// could be retrieved with proper key.\n    /// \n    /// - Note: Do not supply an empty string for a customized processor, which is already reserved by\n    /// the `DefaultImageProcessor`. It is recommended to use a reverse domain name notation string of\n    /// your own for the identifier.\n    var identifier: String { get }\n\n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: The parsed options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: The return value should be `nil` if processing failed while converting an input item to image.\n    ///         If `nil` received by the processing caller, an error will be reported and the process flow stops.\n    ///         If the processing flow is not critical for your flow, then when the input item is already an image\n    ///         (`.image` case) and there is any errors in the processing, you could return the input image itself\n    ///         to keep the processing pipeline continuing.\n    /// - Note: Most processor only supports CG-based images. watchOS is not supported for processors containing\n    ///         a filter, the input image will be returned directly on watchOS.\n    func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?\n}\n\nextension ImageProcessor {\n    \n    /// Appends an `ImageProcessor` to another. The identifier of the new `ImageProcessor`\n    /// will be \"\\(self.identifier)|>\\(another.identifier)\".\n    ///\n    /// - Parameter another: An `ImageProcessor` you want to append to `self`.\n    /// - Returns: The new `ImageProcessor` will process the image in the order\n    ///            of the two processors concatenated.\n    public func append(another: ImageProcessor) -> ImageProcessor {\n        let newIdentifier = identifier.appending(\"|>\\(another.identifier)\")\n        return GeneralProcessor(identifier: newIdentifier) {\n            item, options in\n            if let image = self.process(item: item, options: options) {\n                return another.process(item: .image(image), options: options)\n            } else {\n                return nil\n            }\n        }\n    }\n}\n\nfunc ==(left: ImageProcessor, right: ImageProcessor) -> Bool {\n    return left.identifier == right.identifier\n}\n\nfunc !=(left: ImageProcessor, right: ImageProcessor) -> Bool {\n    return !(left == right)\n}\n\ntypealias ProcessorImp = ((ImageProcessItem, KingfisherParsedOptionsInfo) -> KFCrossPlatformImage?)\nstruct GeneralProcessor: ImageProcessor {\n    let identifier: String\n    let p: ProcessorImp\n    func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        return p(item, options)\n    }\n}\n\n/// The default processor. It converts the input data to a valid image.\n/// Images of .PNG, .JPEG and .GIF format are supported.\n/// If an image item is given as `.image` case, `DefaultImageProcessor` will\n/// do nothing on it and return the associated image.\npublic struct DefaultImageProcessor: ImageProcessor {\n    \n    /// A default `DefaultImageProcessor` could be used across.\n    public static let `default` = DefaultImageProcessor()\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier = \"\"\n    \n    /// Creates a `DefaultImageProcessor`. Use `DefaultImageProcessor.default` to get an instance,\n    /// if you do not have a good reason to create your own `DefaultImageProcessor`.\n    public init() {}\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n        case .data(let data):\n            return KingfisherWrapper.image(data: data, options: options.imageCreatingOptions)\n        }\n    }\n}\n\n/// Represents the rect corner setting when processing a round corner image.\npublic struct RectCorner: OptionSet {\n    \n    /// Raw value of the rect corner.\n    public let rawValue: Int\n    \n    /// Represents the top left corner.\n    public static let topLeft = RectCorner(rawValue: 1 << 0)\n    \n    /// Represents the top right corner.\n    public static let topRight = RectCorner(rawValue: 1 << 1)\n    \n    /// Represents the bottom left corner.\n    public static let bottomLeft = RectCorner(rawValue: 1 << 2)\n    \n    /// Represents the bottom right corner.\n    public static let bottomRight = RectCorner(rawValue: 1 << 3)\n    \n    /// Represents all corners.\n    public static let all: RectCorner = [.topLeft, .topRight, .bottomLeft, .bottomRight]\n    \n    /// Creates a `RectCorner` option set with a given value.\n    ///\n    /// - Parameter rawValue: The value represents a certain corner option.\n    public init(rawValue: Int) {\n        self.rawValue = rawValue\n    }\n    \n    var cornerIdentifier: String {\n        if self == .all {\n            return \"\"\n        }\n        return \"_corner(\\(rawValue))\"\n    }\n}\n\n#if !os(macOS)\n/// Processor for adding an blend mode to images. Only CG-based images are supported.\npublic struct BlendImageProcessor: ImageProcessor {\n\n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n\n    /// Blend Mode will be used to blend the input image.\n    public let blendMode: CGBlendMode\n\n    /// Alpha will be used when blend image.\n    public let alpha: CGFloat\n\n    /// Background color of the output image. If `nil`, it will stay transparent.\n    public let backgroundColor: KFCrossPlatformColor?\n\n    /// Creates a `BlendImageProcessor`.\n    ///\n    /// - Parameters:\n    ///   - blendMode: Blend Mode will be used to blend the input image.\n    ///   - alpha: Alpha will be used when blend image. From 0.0 to 1.0. 1.0 means solid image,\n    ///            0.0 means transparent image (not visible at all). Default is 1.0.\n    ///   - backgroundColor: Background color to apply for the output image. Default is `nil`.\n    public init(blendMode: CGBlendMode, alpha: CGFloat = 1.0, backgroundColor: KFCrossPlatformColor? = nil) {\n        self.blendMode = blendMode\n        self.alpha = alpha\n        self.backgroundColor = backgroundColor\n        var identifier = \"com.onevcat.Kingfisher.BlendImageProcessor(\\(blendMode.rawValue),\\(alpha))\"\n        if let color = backgroundColor {\n            identifier.append(\"_\\(color.hex)\")\n        }\n        self.identifier = identifier\n    }\n\n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.image(withBlendMode: blendMode, alpha: alpha, backgroundColor: backgroundColor)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n#endif\n\n#if os(macOS)\n/// Processor for adding an compositing operation to images. Only CG-based images are supported in macOS.\npublic struct CompositingImageProcessor: ImageProcessor {\n\n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n\n    /// Compositing operation will be used to the input image.\n    public let compositingOperation: NSCompositingOperation\n\n    /// Alpha will be used when compositing image.\n    public let alpha: CGFloat\n\n    /// Background color of the output image. If `nil`, it will stay transparent.\n    public let backgroundColor: KFCrossPlatformColor?\n\n    /// Creates a `CompositingImageProcessor`\n    ///\n    /// - Parameters:\n    ///   - compositingOperation: Compositing operation will be used to the input image.\n    ///   - alpha: Alpha will be used when compositing image.\n    ///            From 0.0 to 1.0. 1.0 means solid image, 0.0 means transparent image.\n    ///            Default is 1.0.\n    ///   - backgroundColor: Background color to apply for the output image. Default is `nil`.\n    public init(compositingOperation: NSCompositingOperation,\n                alpha: CGFloat = 1.0,\n                backgroundColor: KFCrossPlatformColor? = nil)\n    {\n        self.compositingOperation = compositingOperation\n        self.alpha = alpha\n        self.backgroundColor = backgroundColor\n        var identifier = \"com.onevcat.Kingfisher.CompositingImageProcessor(\\(compositingOperation.rawValue),\\(alpha))\"\n        if let color = backgroundColor {\n            identifier.append(\"_\\(color.hex)\")\n        }\n        self.identifier = identifier\n    }\n\n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.image(\n                            withCompositingOperation: compositingOperation,\n                            alpha: alpha,\n                            backgroundColor: backgroundColor)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n#endif\n\n/// Processor for making round corner images. Only CG-based images are supported in macOS, \n/// if a non-CG image passed in, the processor will do nothing.\n///\n/// - Note: The input image will be rendered with round corner pixels removed. If the image itself does not contain\n/// alpha channel (for example, a JPEG image), the processed image will contain an alpha channel in memory in order\n/// to show correctly. However, when cached to disk, Kingfisher respects the original image format by default. That\n/// means the alpha channel will be removed for these images. When you load the processed image from cache again, you\n/// will lose transparent corner.\n///\n/// You could use `FormatIndicatedCacheSerializer.png` to force Kingfisher to serialize the image to PNG format in this\n/// case.\n///\npublic struct RoundCornerImageProcessor: ImageProcessor {\n\n    /// Represents a radius specified in a `RoundCornerImageProcessor`.\n    public enum Radius {\n        /// The radius should be calculated as a fraction of the image width. Typically the associated value should be\n        /// between 0 and 0.5, where 0 represents no radius and 0.5 represents using half of the image width.\n        case widthFraction(CGFloat)\n        /// The radius should be calculated as a fraction of the image height. Typically the associated value should be\n        /// between 0 and 0.5, where 0 represents no radius and 0.5 represents using half of the image height.\n        case heightFraction(CGFloat)\n        /// Use a fixed point value as the round corner radius.\n        case point(CGFloat)\n\n        var radiusIdentifier: String {\n            switch self {\n            case .widthFraction(let f):\n                return \"w_frac_\\(f)\"\n            case .heightFraction(let f):\n                return \"h_frac_\\(f)\"\n            case .point(let p):\n                return p.description\n            }\n        }\n    }\n\n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n\n    /// The radius will be applied in processing. Specify a certain point value with `.point`, or a fraction of the\n    /// target image with `.widthFraction`. or `.heightFraction`. For example, given a square image with width and\n    /// height equals,  `.widthFraction(0.5)` means use half of the length of size and makes the final image a round one.\n    public let radius: Radius\n    \n    /// The target corners which will be applied rounding.\n    public let roundingCorners: RectCorner\n    \n    /// Target size of output image should be. If `nil`, the image will keep its original size after processing.\n    public let targetSize: CGSize?\n\n    /// Background color of the output image. If `nil`, it will use a transparent background.\n    public let backgroundColor: KFCrossPlatformColor?\n\n    /// Creates a `RoundCornerImageProcessor`.\n    ///\n    /// - Parameters:\n    ///   - cornerRadius: Corner radius in point will be applied in processing.\n    ///   - targetSize: Target size of output image should be. If `nil`,\n    ///                 the image will keep its original size after processing.\n    ///                 Default is `nil`.\n    ///   - corners: The target corners which will be applied rounding. Default is `.all`.\n    ///   - backgroundColor: Background color to apply for the output image. Default is `nil`.\n    ///\n    /// - Note:\n    ///\n    /// This initializer accepts a concrete point value for `cornerRadius`. If you do not know the image size, but still\n    /// want to apply a full round-corner (making the final image a round one), or specify the corner radius as a\n    /// fraction of one dimension of the target image, use the `Radius` version instead.\n    ///\n    public init(\n        cornerRadius: CGFloat,\n        targetSize: CGSize? = nil,\n        roundingCorners corners: RectCorner = .all,\n        backgroundColor: KFCrossPlatformColor? = nil\n    )\n    {\n        let radius = Radius.point(cornerRadius)\n        self.init(radius: radius, targetSize: targetSize, roundingCorners: corners, backgroundColor: backgroundColor)\n    }\n\n    /// Creates a `RoundCornerImageProcessor`.\n    ///\n    /// - Parameters:\n    ///   - radius: The radius will be applied in processing.\n    ///   - targetSize: Target size of output image should be. If `nil`,\n    ///                 the image will keep its original size after processing.\n    ///                 Default is `nil`.\n    ///   - corners: The target corners which will be applied rounding. Default is `.all`.\n    ///   - backgroundColor: Background color to apply for the output image. Default is `nil`.\n    public init(\n        radius: Radius,\n        targetSize: CGSize? = nil,\n        roundingCorners corners: RectCorner = .all,\n        backgroundColor: KFCrossPlatformColor? = nil\n    )\n    {\n        self.radius = radius\n        self.targetSize = targetSize\n        self.roundingCorners = corners\n        self.backgroundColor = backgroundColor\n\n        self.identifier = {\n            var identifier = \"\"\n\n            if let size = targetSize {\n                identifier = \"com.onevcat.Kingfisher.RoundCornerImageProcessor\" +\n                             \"(\\(radius.radiusIdentifier)_\\(size)\\(corners.cornerIdentifier))\"\n            } else {\n                identifier = \"com.onevcat.Kingfisher.RoundCornerImageProcessor\" +\n                             \"(\\(radius.radiusIdentifier)\\(corners.cornerIdentifier))\"\n            }\n            if let backgroundColor = backgroundColor {\n                identifier += \"_\\(backgroundColor)\"\n            }\n\n            return identifier\n        }()\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            let size = targetSize ?? image.kf.size\n\n            let cornerRadius: CGFloat\n            switch radius {\n            case .point(let point):\n                cornerRadius = point\n            case .widthFraction(let widthFraction):\n                cornerRadius = size.width * widthFraction\n            case .heightFraction(let heightFraction):\n                cornerRadius = size.height * heightFraction\n            }\n\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.image(\n                            withRoundRadius: cornerRadius,\n                            fit: size,\n                            roundingCorners: roundingCorners,\n                            backgroundColor: backgroundColor)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n\n/// Represents how a size adjusts itself to fit a target size.\n///\n/// - none: Not scale the content.\n/// - aspectFit: Scales the content to fit the size of the view by maintaining the aspect ratio.\n/// - aspectFill: Scales the content to fill the size of the view.\npublic enum ContentMode {\n    /// Not scale the content.\n    case none\n    /// Scales the content to fit the size of the view by maintaining the aspect ratio.\n    case aspectFit\n    /// Scales the content to fill the size of the view.\n    case aspectFill\n}\n\n/// Processor for resizing images.\n/// If you need to resize a data represented image to a smaller size, use `DownsamplingImageProcessor`\n/// instead, which is more efficient and uses less memory.\npublic struct ResizingImageProcessor: ImageProcessor {\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n    \n    /// The reference size for resizing operation in point.\n    public let referenceSize: CGSize\n    \n    /// Target content mode of output image should be.\n    /// Default is `.none`.\n    public let targetContentMode: ContentMode\n    \n    /// Creates a `ResizingImageProcessor`.\n    ///\n    /// - Parameters:\n    ///   - referenceSize: The reference size for resizing operation in point.\n    ///   - mode: Target content mode of output image should be.\n    ///\n    /// - Note:\n    ///   The instance of `ResizingImageProcessor` will follow its `mode` property\n    ///   and try to resizing the input images to fit or fill the `referenceSize`.\n    ///   That means if you are using a `mode` besides of `.none`, you may get an\n    ///   image with its size not be the same as the `referenceSize`.\n    ///\n    ///   **Example**: With input image size: {100, 200}, \n    ///   `referenceSize`: {100, 100}, `mode`: `.aspectFit`,\n    ///   you will get an output image with size of {50, 100}, which \"fit\"s\n    ///   the `referenceSize`.\n    ///\n    ///   If you need an output image exactly to be a specified size, append or use\n    ///   a `CroppingImageProcessor`.\n    public init(referenceSize: CGSize, mode: ContentMode = .none) {\n        self.referenceSize = referenceSize\n        self.targetContentMode = mode\n        \n        if mode == .none {\n            self.identifier = \"com.onevcat.Kingfisher.ResizingImageProcessor(\\(referenceSize))\"\n        } else {\n            self.identifier = \"com.onevcat.Kingfisher.ResizingImageProcessor(\\(referenceSize), \\(mode))\"\n        }\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.resize(to: referenceSize, for: targetContentMode)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n/// Processor for adding blur effect to images. `Accelerate.framework` is used underhood for \n/// a better performance. A simulated Gaussian blur with specified blur radius will be applied.\npublic struct BlurImageProcessor: ImageProcessor {\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n    \n    /// Blur radius for the simulated Gaussian blur.\n    public let blurRadius: CGFloat\n\n    /// Creates a `BlurImageProcessor`\n    ///\n    /// - parameter blurRadius: Blur radius for the simulated Gaussian blur.\n    public init(blurRadius: CGFloat) {\n        self.blurRadius = blurRadius\n        self.identifier = \"com.onevcat.Kingfisher.BlurImageProcessor(\\(blurRadius))\"\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            let radius = blurRadius * options.scaleFactor\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.blurred(withRadius: radius)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n/// Processor for adding an overlay to images. Only CG-based images are supported in macOS.\npublic struct OverlayImageProcessor: ImageProcessor {\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n    \n    /// Overlay color will be used to overlay the input image.\n    public let overlay: KFCrossPlatformColor\n    \n    /// Fraction will be used when overlay the color to image.\n    public let fraction: CGFloat\n    \n    /// Creates an `OverlayImageProcessor`\n    ///\n    /// - parameter overlay:  Overlay color will be used to overlay the input image.\n    /// - parameter fraction: Fraction will be used when overlay the color to image. \n    ///                       From 0.0 to 1.0. 0.0 means solid color, 1.0 means transparent overlay.\n    public init(overlay: KFCrossPlatformColor, fraction: CGFloat = 0.5) {\n        self.overlay = overlay\n        self.fraction = fraction\n        self.identifier = \"com.onevcat.Kingfisher.OverlayImageProcessor(\\(overlay.hex)_\\(fraction))\"\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.overlaying(with: overlay, fraction: fraction)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n/// Processor for tint images with color. Only CG-based images are supported.\npublic struct TintImageProcessor: ImageProcessor {\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n    \n    /// Tint color will be used to tint the input image.\n    public let tint: KFCrossPlatformColor\n    \n    /// Creates a `TintImageProcessor`\n    ///\n    /// - parameter tint: Tint color will be used to tint the input image.\n    public init(tint: KFCrossPlatformColor) {\n        self.tint = tint\n        self.identifier = \"com.onevcat.Kingfisher.TintImageProcessor(\\(tint.hex))\"\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.tinted(with: tint)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n/// Processor for applying some color control to images. Only CG-based images are supported.\n/// watchOS is not supported.\npublic struct ColorControlsProcessor: ImageProcessor {\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n    \n    /// Brightness changing to image.\n    public let brightness: CGFloat\n    \n    /// Contrast changing to image.\n    public let contrast: CGFloat\n    \n    /// Saturation changing to image.\n    public let saturation: CGFloat\n    \n    /// InputEV changing to image.\n    public let inputEV: CGFloat\n    \n    /// Creates a `ColorControlsProcessor`\n    ///\n    /// - Parameters:\n    ///   - brightness: Brightness changing to image.\n    ///   - contrast: Contrast changing to image.\n    ///   - saturation: Saturation changing to image.\n    ///   - inputEV: InputEV changing to image.\n    public init(brightness: CGFloat, contrast: CGFloat, saturation: CGFloat, inputEV: CGFloat) {\n        self.brightness = brightness\n        self.contrast = contrast\n        self.saturation = saturation\n        self.inputEV = inputEV\n        self.identifier = \"com.onevcat.Kingfisher.ColorControlsProcessor(\\(brightness)_\\(contrast)_\\(saturation)_\\(inputEV))\"\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.adjusted(brightness: brightness, contrast: contrast, saturation: saturation, inputEV: inputEV)\n        case .data:\n            return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n/// Processor for applying black and white effect to images. Only CG-based images are supported.\n/// watchOS is not supported.\npublic struct BlackWhiteProcessor: ImageProcessor {\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier = \"com.onevcat.Kingfisher.BlackWhiteProcessor\"\n    \n    /// Creates a `BlackWhiteProcessor`\n    public init() {}\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        return ColorControlsProcessor(brightness: 0.0, contrast: 1.0, saturation: 0.0, inputEV: 0.7)\n            .process(item: item, options: options)\n    }\n}\n\n/// Processor for cropping an image. Only CG-based images are supported.\n/// watchOS is not supported.\npublic struct CroppingImageProcessor: ImageProcessor {\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n    \n    /// Target size of output image should be.\n    public let size: CGSize\n    \n    /// Anchor point from which the output size should be calculate.\n    /// The anchor point is consisted by two values between 0.0 and 1.0.\n    /// It indicates a related point in current image. \n    /// See `CroppingImageProcessor.init(size:anchor:)` for more.\n    public let anchor: CGPoint\n    \n    /// Creates a `CroppingImageProcessor`.\n    ///\n    /// - Parameters:\n    ///   - size: Target size of output image should be.\n    ///   - anchor: The anchor point from which the size should be calculated.\n    ///             Default is `CGPoint(x: 0.5, y: 0.5)`, which means the center of input image.\n    /// - Note:\n    ///   The anchor point is consisted by two values between 0.0 and 1.0.\n    ///   It indicates a related point in current image, eg: (0.0, 0.0) for top-left\n    ///   corner, (0.5, 0.5) for center and (1.0, 1.0) for bottom-right corner.\n    ///   The `size` property of `CroppingImageProcessor` will be used along with\n    ///   `anchor` to calculate a target rectangle in the size of image.\n    ///    \n    ///   The target size will be automatically calculated with a reasonable behavior.\n    ///   For example, when you have an image size of `CGSize(width: 100, height: 100)`,\n    ///   and a target size of `CGSize(width: 20, height: 20)`: \n    ///   - with a (0.0, 0.0) anchor (top-left), the crop rect will be `{0, 0, 20, 20}`; \n    ///   - with a (0.5, 0.5) anchor (center), it will be `{40, 40, 20, 20}`\n    ///   - while with a (1.0, 1.0) anchor (bottom-right), it will be `{80, 80, 20, 20}`\n    public init(size: CGSize, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5)) {\n        self.size = size\n        self.anchor = anchor\n        self.identifier = \"com.onevcat.Kingfisher.CroppingImageProcessor(\\(size)_\\(anchor))\"\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            return image.kf.scaled(to: options.scaleFactor)\n                        .kf.crop(to: size, anchorOn: anchor)\n        case .data: return (DefaultImageProcessor.default |> self).process(item: item, options: options)\n        }\n    }\n}\n\n/// Processor for downsampling an image. Compared to `ResizingImageProcessor`, this processor\n/// does not render the images to resize. Instead, it downsamples the input data directly to an\n/// image. It is a more efficient than `ResizingImageProcessor`. Prefer to use `DownsamplingImageProcessor` as possible\n/// as you can than the `ResizingImageProcessor`.\n///\n/// Only CG-based images are supported. Animated images (like GIF) is not supported.\npublic struct DownsamplingImageProcessor: ImageProcessor {\n    \n    /// Target size of output image should be. It should be smaller than the size of\n    /// input image. If it is larger, the result image will be the same size of input\n    /// data without downsampling.\n    public let size: CGSize\n    \n    /// Identifier of the processor.\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public let identifier: String\n    \n    /// Creates a `DownsamplingImageProcessor`.\n    ///\n    /// - Parameter size: The target size of the downsample operation.\n    public init(size: CGSize) {\n        self.size = size\n        self.identifier = \"com.onevcat.Kingfisher.DownsamplingImageProcessor(\\(size))\"\n    }\n    \n    /// Processes the input `ImageProcessItem` with this processor.\n    ///\n    /// - Parameters:\n    ///   - item: Input item which will be processed by `self`.\n    ///   - options: Options when processing the item.\n    /// - Returns: The processed image.\n    ///\n    /// - Note: See documentation of `ImageProcessor` protocol for more.\n    public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {\n        switch item {\n        case .image(let image):\n            guard let data = image.kf.data(format: .unknown) else {\n                return nil\n            }\n            return KingfisherWrapper.downsampledImage(data: data, to: size, scale: options.scaleFactor)\n        case .data(let data):\n            return KingfisherWrapper.downsampledImage(data: data, to: size, scale: options.scaleFactor)\n        }\n    }\n}\n\ninfix operator |>: AdditionPrecedence\npublic func |>(left: ImageProcessor, right: ImageProcessor) -> ImageProcessor {\n    return left.append(another: right)\n}\n\nextension KFCrossPlatformColor {\n    var hex: String {\n        var r: CGFloat = 0\n        var g: CGFloat = 0\n        var b: CGFloat = 0\n        var a: CGFloat = 0\n\n        #if os(macOS)\n        (usingColorSpace(.sRGB) ?? self).getRed(&r, green: &g, blue: &b, alpha: &a)\n        #else\n        getRed(&r, green: &g, blue: &b, alpha: &a)\n        #endif\n\n        let rInt = Int(r * 255) << 24\n        let gInt = Int(g * 255) << 16\n        let bInt = Int(b * 255) << 8\n        let aInt = Int(a * 255)\n        \n        let rgba = rInt | gInt | bInt | aInt\n        \n        return String(format:\"#%08x\", rgba)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/ImageProgressive.swift",
    "content": "//\n//  ImageProgressive.swift\n//  Kingfisher\n//\n//  Created by lixiang on 2019/5/10.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport CoreGraphics\n\nprivate let sharedProcessingQueue: CallbackQueue =\n    .dispatch(DispatchQueue(label: \"com.onevcat.Kingfisher.ImageDownloader.Process\"))\n\npublic struct ImageProgressive {\n    \n    /// A default `ImageProgressive` could be used across. It blurs the progressive loading with the fastest\n    /// scan enabled and scan interval as 0.\n    public static let `default` = ImageProgressive(\n        isBlur: true,\n        isFastestScan: true,\n        scanInterval: 0\n    )\n    \n    /// Whether to enable blur effect processing\n    let isBlur: Bool\n    /// Whether to enable the fastest scan\n    let isFastestScan: Bool\n    /// Minimum time interval for each scan\n    let scanInterval: TimeInterval\n    \n    public init(isBlur: Bool,\n                isFastestScan: Bool,\n                scanInterval: TimeInterval\n    )\n    {\n        self.isBlur = isBlur\n        self.isFastestScan = isFastestScan\n        self.scanInterval = scanInterval\n    }\n}\n\nprotocol ImageSettable: AnyObject {\n    var image: KFCrossPlatformImage? { get set }\n}\n\nfinal class ImageProgressiveProvider: DataReceivingSideEffect {\n    \n    var onShouldApply: () -> Bool = { return true }\n    \n    func onDataReceived(_ session: URLSession, task: SessionDataTask, data: Data) {\n\n        DispatchQueue.main.async {\n            guard self.onShouldApply() else { return }\n            self.update(data: task.mutableData, with: task.callbacks)\n        }\n    }\n\n    private let option: ImageProgressive\n    private let refresh: (KFCrossPlatformImage) -> Void\n    \n    private let decoder: ImageProgressiveDecoder\n    private let queue = ImageProgressiveSerialQueue()\n    \n    init?(_ options: KingfisherParsedOptionsInfo,\n          refresh: @escaping (KFCrossPlatformImage) -> Void) {\n        guard let option = options.progressiveJPEG else { return nil }\n        \n        self.option = option\n        self.refresh = refresh\n        self.decoder = ImageProgressiveDecoder(\n            option,\n            processingQueue: options.processingQueue ?? sharedProcessingQueue,\n            creatingOptions: options.imageCreatingOptions\n        )\n    }\n    \n    func update(data: Data, with callbacks: [SessionDataTask.TaskCallback]) {\n        guard !data.isEmpty else { return }\n\n        queue.add(minimum: option.scanInterval) { completion in\n\n            func decode(_ data: Data) {\n                self.decoder.decode(data, with: callbacks) { image in\n                    defer { completion() }\n                    guard self.onShouldApply() else { return }\n                    guard let image = image else { return }\n                    self.refresh(image)\n                }\n            }\n            \n            let semaphore = DispatchSemaphore(value: 0)\n            var onShouldApply: Bool = false\n            \n            CallbackQueue.mainAsync.execute {\n                onShouldApply = self.onShouldApply()\n                semaphore.signal()\n            }\n            semaphore.wait()\n            guard onShouldApply else {\n                self.queue.clean()\n                completion()\n                return\n            }\n\n            if self.option.isFastestScan {\n                decode(self.decoder.scanning(data) ?? Data())\n            } else {\n                self.decoder.scanning(data).forEach { decode($0) }\n            }\n        }\n    }\n}\n\nprivate final class ImageProgressiveDecoder {\n    \n    private let option: ImageProgressive\n    private let processingQueue: CallbackQueue\n    private let creatingOptions: ImageCreatingOptions\n    private(set) var scannedCount = 0\n    private(set) var scannedIndex = -1\n    \n    init(_ option: ImageProgressive,\n         processingQueue: CallbackQueue,\n         creatingOptions: ImageCreatingOptions) {\n        self.option = option\n        self.processingQueue = processingQueue\n        self.creatingOptions = creatingOptions\n    }\n    \n    func scanning(_ data: Data) -> [Data] {\n        guard data.kf.contains(jpeg: .SOF2) else {\n            return []\n        }\n        guard scannedIndex + 1 < data.count else {\n            return []\n        }\n        \n        var datas: [Data] = []\n        var index = scannedIndex + 1\n        var count = scannedCount\n        \n        while index < data.count - 1 {\n            scannedIndex = index\n            // 0xFF, 0xDA - Start Of Scan\n            let SOS = ImageFormat.JPEGMarker.SOS.bytes\n            if data[index] == SOS[0], data[index + 1] == SOS[1] {\n                if count > 0 {\n                    datas.append(data[0 ..< index])\n                }\n                count += 1\n            }\n            index += 1\n        }\n        \n        // Found more scans this the previous time\n        guard count > scannedCount else { return [] }\n        scannedCount = count\n        \n        // `> 1` checks that we've received a first scan (SOS) and then received\n        // and also received a second scan (SOS). This way we know that we have\n        // at least one full scan available.\n        guard count > 1 else { return [] }\n        return datas\n    }\n    \n    func scanning(_ data: Data) -> Data? {\n        guard data.kf.contains(jpeg: .SOF2) else {\n            return nil\n        }\n        guard scannedIndex + 1 < data.count else {\n            return nil\n        }\n        \n        var index = scannedIndex + 1\n        var count = scannedCount\n        var lastSOSIndex = 0\n        \n        while index < data.count - 1 {\n            scannedIndex = index\n            // 0xFF, 0xDA - Start Of Scan\n            let SOS = ImageFormat.JPEGMarker.SOS.bytes\n            if data[index] == SOS[0], data[index + 1] == SOS[1] {\n                lastSOSIndex = index\n                count += 1\n            }\n            index += 1\n        }\n        \n        // Found more scans this the previous time\n        guard count > scannedCount else { return nil }\n        scannedCount = count\n        \n        // `> 1` checks that we've received a first scan (SOS) and then received\n        // and also received a second scan (SOS). This way we know that we have\n        // at least one full scan available.\n        guard count > 1 && lastSOSIndex > 0 else { return nil }\n        return data[0 ..< lastSOSIndex]\n    }\n    \n    func decode(_ data: Data,\n                with callbacks: [SessionDataTask.TaskCallback],\n                completion: @escaping (KFCrossPlatformImage?) -> Void) {\n        guard data.kf.contains(jpeg: .SOF2) else {\n            CallbackQueue.mainCurrentOrAsync.execute { completion(nil) }\n            return\n        }\n        \n        func processing(_ data: Data) {\n            let processor = ImageDataProcessor(\n                data: data,\n                callbacks: callbacks,\n                processingQueue: processingQueue\n            )\n            processor.onImageProcessed.delegate(on: self) { (self, result) in\n                guard let image = try? result.0.get() else {\n                    CallbackQueue.mainCurrentOrAsync.execute { completion(nil) }\n                    return\n                }\n                \n                CallbackQueue.mainCurrentOrAsync.execute { completion(image) }\n            }\n            processor.process()\n        }\n        \n        // Blur partial images.\n        let count = scannedCount\n        \n        if option.isBlur, count < 6 {\n            processingQueue.execute {\n                // Progressively reduce blur as we load more scans.\n                let image = KingfisherWrapper<KFCrossPlatformImage>.image(\n                    data: data,\n                    options: self.creatingOptions\n                )\n                let radius = max(2, 14 - count * 4)\n                let temp = image?.kf.blurred(withRadius: CGFloat(radius))\n                processing(temp?.kf.data(format: .JPEG) ?? data)\n            }\n            \n        } else {\n            processing(data)\n        }\n    }\n}\n\nprivate final class ImageProgressiveSerialQueue {\n    typealias ClosureCallback = ((@escaping () -> Void)) -> Void\n    \n    private let queue: DispatchQueue\n    private var items: [DispatchWorkItem] = []\n    private var notify: (() -> Void)?\n    private var lastTime: TimeInterval?\n    var count: Int { return items.count }\n\n    init() {\n        self.queue = DispatchQueue(label: \"com.onevcat.Kingfisher.ImageProgressive.SerialQueue\")\n    }\n    \n    func add(minimum interval: TimeInterval, closure: @escaping ClosureCallback) {\n        let completion = { [weak self] in\n            guard let self = self else { return }\n            \n            self.queue.async { [weak self] in\n                guard let self = self else { return }\n                guard !self.items.isEmpty else { return }\n                \n                self.items.removeFirst()\n                \n                if let next = self.items.first {\n                    self.queue.asyncAfter(\n                        deadline: .now() + interval,\n                        execute: next\n                    )\n                    \n                } else {\n                    self.lastTime = Date().timeIntervalSince1970\n                    self.notify?()\n                    self.notify = nil\n                }\n            }\n        }\n        \n        queue.async { [weak self] in\n            guard let self = self else { return }\n            \n            let item = DispatchWorkItem {\n                closure(completion)\n            }\n            if self.items.isEmpty {\n                let difference = Date().timeIntervalSince1970 - (self.lastTime ?? 0)\n                let delay = difference < interval ? interval - difference : 0\n                self.queue.asyncAfter(deadline: .now() + delay, execute: item)\n            }\n            self.items.append(item)\n        }\n    }\n    \n    func notify(_ closure: @escaping () -> Void) {\n        self.notify = closure\n    }\n    \n    func clean() {\n        queue.async { [weak self] in\n            guard let self = self else { return }\n            self.items.forEach { $0.cancel() }\n            self.items.removeAll()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/ImageTransition.swift",
    "content": "//\n//  ImageTransition.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/9/18.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n#if os(iOS) || os(tvOS)\nimport UIKit\n\n/// Transition effect which will be used when an image downloaded and set by `UIImageView`\n/// extension API in Kingfisher. You can assign an enum value with transition duration as\n/// an item in `KingfisherOptionsInfo` to enable the animation transition.\n///\n/// Apple's UIViewAnimationOptions is used under the hood.\n/// For custom transition, you should specified your own transition options, animations and\n/// completion handler as well.\n///\n/// - none: No animation transition.\n/// - fade: Fade in the loaded image in a given duration.\n/// - flipFromLeft: Flip from left transition.\n/// - flipFromRight: Flip from right transition.\n/// - flipFromTop: Flip from top transition.\n/// - flipFromBottom: Flip from bottom transition.\n/// - custom: Custom transition.\npublic enum ImageTransition {\n    /// No animation transition.\n    case none\n    /// Fade in the loaded image in a given duration.\n    case fade(TimeInterval)\n    /// Flip from left transition.\n    case flipFromLeft(TimeInterval)\n    /// Flip from right transition.\n    case flipFromRight(TimeInterval)\n    /// Flip from top transition.\n    case flipFromTop(TimeInterval)\n    /// Flip from bottom transition.\n    case flipFromBottom(TimeInterval)\n    /// Custom transition defined by a general animation block.\n    ///    - duration: The time duration of this custom transition.\n    ///    - options: `UIView.AnimationOptions` should be used in the transition.\n    ///    - animations: The animation block will be applied when setting image.\n    ///    - completion: A block called when the transition animation finishes.\n    case custom(duration: TimeInterval,\n                 options: UIView.AnimationOptions,\n              animations: ((UIImageView, UIImage) -> Void)?,\n              completion: ((Bool) -> Void)?)\n    \n    var duration: TimeInterval {\n        switch self {\n        case .none:                          return 0\n        case .fade(let duration):            return duration\n            \n        case .flipFromLeft(let duration):    return duration\n        case .flipFromRight(let duration):   return duration\n        case .flipFromTop(let duration):     return duration\n        case .flipFromBottom(let duration):  return duration\n            \n        case .custom(let duration, _, _, _): return duration\n        }\n    }\n    \n    var animationOptions: UIView.AnimationOptions {\n        switch self {\n        case .none:                         return []\n        case .fade:                         return .transitionCrossDissolve\n            \n        case .flipFromLeft:                 return .transitionFlipFromLeft\n        case .flipFromRight:                return .transitionFlipFromRight\n        case .flipFromTop:                  return .transitionFlipFromTop\n        case .flipFromBottom:               return .transitionFlipFromBottom\n            \n        case .custom(_, let options, _, _): return options\n        }\n    }\n    \n    var animations: ((UIImageView, UIImage) -> Void)? {\n        switch self {\n        case .custom(_, _, let animations, _): return animations\n        default: return { $0.image = $1 }\n        }\n    }\n    \n    var completion: ((Bool) -> Void)? {\n        switch self {\n        case .custom(_, _, _, let completion): return completion\n        default: return nil\n        }\n    }\n}\n#else\n// Just a placeholder for compiling on macOS.\npublic enum ImageTransition {\n    case none\n    /// This is a placeholder on macOS now. It is for SwiftUI (KFImage) to identify the fade option only.\n    case fade(TimeInterval)\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Image/Placeholder.swift",
    "content": "//\n//  Placeholder.swift\n//  Kingfisher\n//\n//  Created by Tieme van Veen on 28/08/2017.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if !os(watchOS)\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n#endif\n\n#if canImport(UIKit)\nimport UIKit\n#endif\n\n/// Represents a placeholder type which could be set while loading as well as\n/// loading finished without getting an image.\npublic protocol Placeholder {\n    \n    /// How the placeholder should be added to a given image view.\n    func add(to imageView: KFCrossPlatformImageView)\n    \n    /// How the placeholder should be removed from a given image view.\n    func remove(from imageView: KFCrossPlatformImageView)\n}\n\n/// Default implementation of an image placeholder. The image will be set or\n/// reset directly for `image` property of the image view.\nextension KFCrossPlatformImage: Placeholder {\n    /// How the placeholder should be added to a given image view.\n    public func add(to imageView: KFCrossPlatformImageView) { imageView.image = self }\n\n    /// How the placeholder should be removed from a given image view.\n    public func remove(from imageView: KFCrossPlatformImageView) { imageView.image = nil }\n}\n\n/// Default implementation of an arbitrary view as placeholder. The view will be \n/// added as a subview when adding and be removed from its super view when removing.\n///\n/// To use your customize View type as placeholder, simply let it conforming to \n/// `Placeholder` by `extension MyView: Placeholder {}`.\nextension Placeholder where Self: KFCrossPlatformView {\n    \n    /// How the placeholder should be added to a given image view.\n    public func add(to imageView: KFCrossPlatformImageView) {\n        imageView.addSubview(self)\n        translatesAutoresizingMaskIntoConstraints = false\n\n        centerXAnchor.constraint(equalTo: imageView.centerXAnchor).isActive = true\n        centerYAnchor.constraint(equalTo: imageView.centerYAnchor).isActive = true\n        heightAnchor.constraint(equalTo: imageView.heightAnchor).isActive = true\n        widthAnchor.constraint(equalTo: imageView.widthAnchor).isActive = true\n    }\n\n    /// How the placeholder should be removed from a given image view.\n    public func remove(from imageView: KFCrossPlatformImageView) {\n        removeFromSuperview()\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/AuthenticationChallengeResponsable.swift",
    "content": "//\n//  AuthenticationChallengeResponsable.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/10/11.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Protocol indicates that an authentication challenge could be handled.\npublic protocol AuthenticationChallengeResponsable: AnyObject {\n\n    /// Called when a session level authentication challenge is received.\n    /// This method provide a chance to handle and response to the authentication\n    /// challenge before downloading could start.\n    ///\n    /// - Parameters:\n    ///   - downloader: The downloader which receives this challenge.\n    ///   - challenge: An object that contains the request for authentication.\n    ///   - completionHandler: A handler that your delegate method must call.\n    ///\n    /// - Note: This method is a forward from `URLSessionDelegate.urlSession(:didReceiveChallenge:completionHandler:)`.\n    ///         Please refer to the document of it in `URLSessionDelegate`.\n    func downloader(\n        _ downloader: ImageDownloader,\n        didReceive challenge: URLAuthenticationChallenge,\n        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)\n\n    /// Called when a task level authentication challenge is received.\n    /// This method provide a chance to handle and response to the authentication\n    /// challenge before downloading could start.\n    ///\n    /// - Parameters:\n    ///   - downloader: The downloader which receives this challenge.\n    ///   - task: The task whose request requires authentication.\n    ///   - challenge: An object that contains the request for authentication.\n    ///   - completionHandler: A handler that your delegate method must call.\n    func downloader(\n        _ downloader: ImageDownloader,\n        task: URLSessionTask,\n        didReceive challenge: URLAuthenticationChallenge,\n        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)\n}\n\nextension AuthenticationChallengeResponsable {\n\n    public func downloader(\n        _ downloader: ImageDownloader,\n        didReceive challenge: URLAuthenticationChallenge,\n        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)\n    {\n        if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {\n            if let trustedHosts = downloader.trustedHosts, trustedHosts.contains(challenge.protectionSpace.host) {\n                let credential = URLCredential(trust: challenge.protectionSpace.serverTrust!)\n                completionHandler(.useCredential, credential)\n                return\n            }\n        }\n\n        completionHandler(.performDefaultHandling, nil)\n    }\n\n    public func downloader(\n        _ downloader: ImageDownloader,\n        task: URLSessionTask,\n        didReceive challenge: URLAuthenticationChallenge,\n        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)\n    {\n        completionHandler(.performDefaultHandling, nil)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/ImageDataProcessor.swift",
    "content": "//\n//  ImageDataProcessor.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/10/11.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nprivate let sharedProcessingQueue: CallbackQueue =\n    .dispatch(DispatchQueue(label: \"com.onevcat.Kingfisher.ImageDownloader.Process\"))\n\n// Handles image processing work on an own process queue.\nclass ImageDataProcessor {\n    let data: Data\n    let callbacks: [SessionDataTask.TaskCallback]\n    let queue: CallbackQueue\n\n    // Note: We have an optimization choice there, to reduce queue dispatch by checking callback\n    // queue settings in each option...\n    let onImageProcessed = Delegate<(Result<KFCrossPlatformImage, KingfisherError>, SessionDataTask.TaskCallback), Void>()\n\n    init(data: Data, callbacks: [SessionDataTask.TaskCallback], processingQueue: CallbackQueue?) {\n        self.data = data\n        self.callbacks = callbacks\n        self.queue = processingQueue ?? sharedProcessingQueue\n    }\n\n    func process() {\n        queue.execute(doProcess)\n    }\n\n    private func doProcess() {\n        var processedImages = [String: KFCrossPlatformImage]()\n        for callback in callbacks {\n            let processor = callback.options.processor\n            var image = processedImages[processor.identifier]\n            if image == nil {\n                image = processor.process(item: .data(data), options: callback.options)\n                processedImages[processor.identifier] = image\n            }\n\n            let result: Result<KFCrossPlatformImage, KingfisherError>\n            if let image = image {\n                let finalImage = callback.options.backgroundDecode ? image.kf.decoded : image\n                result = .success(finalImage)\n            } else {\n                let error = KingfisherError.processorError(\n                    reason: .processingFailed(processor: processor, item: .data(data)))\n                result = .failure(error)\n            }\n            onImageProcessed.call((result, callback))\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/ImageDownloader.swift",
    "content": "//\n//  ImageDownloader.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 15/4/6.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(macOS)\nimport AppKit\n#else\nimport UIKit\n#endif\n\ntypealias DownloadResult = Result<ImageLoadingResult, KingfisherError>\n\n/// Represents a success result of an image downloading progress.\npublic struct ImageLoadingResult {\n\n    /// The downloaded image.\n    public let image: KFCrossPlatformImage\n\n    /// Original URL of the image request.\n    public let url: URL?\n\n    /// The raw data received from downloader.\n    public let originalData: Data\n}\n\n/// Represents a task of an image downloading process.\npublic struct DownloadTask {\n\n    /// The `SessionDataTask` object bounded to this download task. Multiple `DownloadTask`s could refer\n    /// to a same `sessionTask`. This is an optimization in Kingfisher to prevent multiple downloading task\n    /// for the same URL resource at the same time.\n    ///\n    /// When you `cancel` a `DownloadTask`, this `SessionDataTask` and its cancel token will be pass through.\n    /// You can use them to identify the cancelled task.\n    public let sessionTask: SessionDataTask\n\n    /// The cancel token which is used to cancel the task. This is only for identify the task when it is cancelled.\n    /// To cancel a `DownloadTask`, use `cancel` instead.\n    public let cancelToken: SessionDataTask.CancelToken\n\n    /// Cancel this task if it is running. It will do nothing if this task is not running.\n    ///\n    /// - Note:\n    /// In Kingfisher, there is an optimization to prevent starting another download task if the target URL is being\n    /// downloading. However, even when internally no new session task created, a `DownloadTask` will be still created\n    /// and returned when you call related methods, but it will share the session downloading task with a previous task.\n    /// In this case, if multiple `DownloadTask`s share a single session download task, cancelling a `DownloadTask`\n    /// does not affect other `DownloadTask`s.\n    ///\n    /// If you need to cancel all `DownloadTask`s of a url, use `ImageDownloader.cancel(url:)`. If you need to cancel\n    /// all downloading tasks of an `ImageDownloader`, use `ImageDownloader.cancelAll()`.\n    public func cancel() {\n        sessionTask.cancel(token: cancelToken)\n    }\n}\n\nextension DownloadTask {\n    enum WrappedTask {\n        case download(DownloadTask)\n        case dataProviding\n\n        func cancel() {\n            switch self {\n            case .download(let task): task.cancel()\n            case .dataProviding: break\n            }\n        }\n\n        var value: DownloadTask? {\n            switch self {\n            case .download(let task): return task\n            case .dataProviding: return nil\n            }\n        }\n    }\n}\n\n/// Represents a downloading manager for requesting the image with a URL from server.\nopen class ImageDownloader {\n\n    // MARK: Singleton\n    /// The default downloader.\n    public static let `default` = ImageDownloader(name: \"default\")\n\n    // MARK: Public Properties\n    /// The duration before the downloading is timeout. Default is 15 seconds.\n    open var downloadTimeout: TimeInterval = 15.0\n    \n    /// A set of trusted hosts when receiving server trust challenges. A challenge with host name contained in this\n    /// set will be ignored. You can use this set to specify the self-signed site. It only will be used if you don't\n    /// specify the `authenticationChallengeResponder`.\n    ///\n    /// If `authenticationChallengeResponder` is set, this property will be ignored and the implementation of\n    /// `authenticationChallengeResponder` will be used instead.\n    open var trustedHosts: Set<String>?\n    \n    /// Use this to set supply a configuration for the downloader. By default,\n    /// NSURLSessionConfiguration.ephemeralSessionConfiguration() will be used.\n    ///\n    /// You could change the configuration before a downloading task starts.\n    /// A configuration without persistent storage for caches is requested for downloader working correctly.\n    open var sessionConfiguration = URLSessionConfiguration.ephemeral {\n        didSet {\n            session.invalidateAndCancel()\n            session = URLSession(configuration: sessionConfiguration, delegate: sessionDelegate, delegateQueue: nil)\n        }\n    }\n    open var sessionDelegate: SessionDelegate {\n        didSet {\n            session.invalidateAndCancel()\n            session = URLSession(configuration: sessionConfiguration, delegate: sessionDelegate, delegateQueue: nil)\n            setupSessionHandler()\n        }\n    }\n    \n    /// Whether the download requests should use pipeline or not. Default is false.\n    open var requestsUsePipelining = false\n\n    /// Delegate of this `ImageDownloader` object. See `ImageDownloaderDelegate` protocol for more.\n    open weak var delegate: ImageDownloaderDelegate?\n    \n    /// A responder for authentication challenge. \n    /// Downloader will forward the received authentication challenge for the downloading session to this responder.\n    open weak var authenticationChallengeResponder: AuthenticationChallengeResponsable?\n\n    private let name: String\n    private var session: URLSession\n\n    // MARK: Initializers\n\n    /// Creates a downloader with name.\n    ///\n    /// - Parameter name: The name for the downloader. It should not be empty.\n    public init(name: String) {\n        if name.isEmpty {\n            fatalError(\"[Kingfisher] You should specify a name for the downloader. \"\n                + \"A downloader with empty name is not permitted.\")\n        }\n\n        self.name = name\n\n        sessionDelegate = SessionDelegate()\n        session = URLSession(\n            configuration: sessionConfiguration,\n            delegate: sessionDelegate,\n            delegateQueue: nil)\n\n        authenticationChallengeResponder = self\n        setupSessionHandler()\n    }\n\n    deinit { session.invalidateAndCancel() }\n\n    private func setupSessionHandler() {\n        sessionDelegate.onReceiveSessionChallenge.delegate(on: self) { (self, invoke) in\n            self.authenticationChallengeResponder?.downloader(self, didReceive: invoke.1, completionHandler: invoke.2)\n        }\n        sessionDelegate.onReceiveSessionTaskChallenge.delegate(on: self) { (self, invoke) in\n            self.authenticationChallengeResponder?.downloader(\n                self, task: invoke.1, didReceive: invoke.2, completionHandler: invoke.3)\n        }\n        sessionDelegate.onValidStatusCode.delegate(on: self) { (self, code) in\n            return (self.delegate ?? self).isValidStatusCode(code, for: self)\n        }\n        sessionDelegate.onDownloadingFinished.delegate(on: self) { (self, value) in\n            let (url, result) = value\n            do {\n                let value = try result.get()\n                self.delegate?.imageDownloader(self, didFinishDownloadingImageForURL: url, with: value, error: nil)\n            } catch {\n                self.delegate?.imageDownloader(self, didFinishDownloadingImageForURL: url, with: nil, error: error)\n            }\n        }\n        sessionDelegate.onDidDownloadData.delegate(on: self) { (self, task) in\n            return (self.delegate ?? self).imageDownloader(self, didDownload: task.mutableData, with: task)\n        }\n    }\n\n    // Wraps `completionHandler` to `onCompleted` respectively.\n    private func createCompletionCallBack(_ completionHandler: ((DownloadResult) -> Void)?) -> Delegate<DownloadResult, Void>? {\n        return completionHandler.map { block -> Delegate<DownloadResult, Void> in\n\n            let delegate =  Delegate<Result<ImageLoadingResult, KingfisherError>, Void>()\n            delegate.delegate(on: self) { (self, callback) in\n                block(callback)\n            }\n            return delegate\n        }\n    }\n\n    private func createTaskCallback(\n        _ completionHandler: ((DownloadResult) -> Void)?,\n        options: KingfisherParsedOptionsInfo\n    ) -> SessionDataTask.TaskCallback\n    {\n        return SessionDataTask.TaskCallback(\n            onCompleted: createCompletionCallBack(completionHandler),\n            options: options\n        )\n    }\n\n    private func createDownloadContext(\n        with url: URL,\n        options: KingfisherParsedOptionsInfo,\n        done: @escaping ((Result<DownloadingContext, KingfisherError>) -> Void)\n    )\n    {\n        func checkRequestAndDone(r: URLRequest) {\n\n            // There is a possibility that request modifier changed the url to `nil` or empty.\n            // In this case, throw an error.\n            guard let url = r.url, !url.absoluteString.isEmpty else {\n                done(.failure(KingfisherError.requestError(reason: .invalidURL(request: r))))\n                return\n            }\n\n            done(.success(DownloadingContext(url: url, request: r, options: options)))\n        }\n\n        // Creates default request.\n        var request = URLRequest(url: url, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: downloadTimeout)\n        request.httpShouldUsePipelining = requestsUsePipelining\n        if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) , options.lowDataModeSource != nil {\n            request.allowsConstrainedNetworkAccess = false\n        }\n\n        if let requestModifier = options.requestModifier {\n            // Modifies request before sending.\n            requestModifier.modified(for: request) { result in\n                guard let finalRequest = result else {\n                    done(.failure(KingfisherError.requestError(reason: .emptyRequest)))\n                    return\n                }\n                checkRequestAndDone(r: finalRequest)\n            }\n        } else {\n            checkRequestAndDone(r: request)\n        }\n    }\n\n    private func addDownloadTask(\n        context: DownloadingContext,\n        callback: SessionDataTask.TaskCallback\n    ) -> DownloadTask\n    {\n        // Ready to start download. Add it to session task manager (`sessionHandler`)\n        let downloadTask: DownloadTask\n        if let existingTask = sessionDelegate.task(for: context.url) {\n            downloadTask = sessionDelegate.append(existingTask, url: context.url, callback: callback)\n        } else {\n            let sessionDataTask = session.dataTask(with: context.request)\n            sessionDataTask.priority = context.options.downloadPriority\n            downloadTask = sessionDelegate.add(sessionDataTask, url: context.url, callback: callback)\n        }\n        return downloadTask\n    }\n\n\n    private func reportWillDownloadImage(url: URL, request: URLRequest) {\n        delegate?.imageDownloader(self, willDownloadImageForURL: url, with: request)\n    }\n\n    private func reportDidDownloadImageData(result: Result<(Data, URLResponse?), KingfisherError>, url: URL) {\n        var response: URLResponse?\n        var err: Error?\n        do {\n            response = try result.get().1\n        } catch {\n            err = error\n        }\n        self.delegate?.imageDownloader(\n            self,\n            didFinishDownloadingImageForURL: url,\n            with: response,\n            error: err\n        )\n    }\n\n    private func reportDidProcessImage(\n        result: Result<KFCrossPlatformImage, KingfisherError>, url: URL, response: URLResponse?\n    )\n    {\n        if let image = try? result.get() {\n            self.delegate?.imageDownloader(self, didDownload: image, for: url, with: response)\n        }\n\n    }\n\n    private func startDownloadTask(\n        context: DownloadingContext,\n        callback: SessionDataTask.TaskCallback\n    ) -> DownloadTask\n    {\n\n        let downloadTask = addDownloadTask(context: context, callback: callback)\n\n        let sessionTask = downloadTask.sessionTask\n        guard !sessionTask.started else {\n            return downloadTask\n        }\n\n        sessionTask.onTaskDone.delegate(on: self) { (self, done) in\n            // Underlying downloading finishes.\n            // result: Result<(Data, URLResponse?)>, callbacks: [TaskCallback]\n            let (result, callbacks) = done\n\n            // Before processing the downloaded data.\n            self.reportDidDownloadImageData(result: result, url: context.url)\n\n            switch result {\n            // Download finished. Now process the data to an image.\n            case .success(let (data, response)):\n                let processor = ImageDataProcessor(\n                    data: data, callbacks: callbacks, processingQueue: context.options.processingQueue\n                )\n                processor.onImageProcessed.delegate(on: self) { (self, done) in\n                    // `onImageProcessed` will be called for `callbacks.count` times, with each\n                    // `SessionDataTask.TaskCallback` as the input parameter.\n                    // result: Result<Image>, callback: SessionDataTask.TaskCallback\n                    let (result, callback) = done\n\n                    self.reportDidProcessImage(result: result, url: context.url, response: response)\n\n                    let imageResult = result.map { ImageLoadingResult(image: $0, url: context.url, originalData: data) }\n                    let queue = callback.options.callbackQueue\n                    queue.execute { callback.onCompleted?.call(imageResult) }\n                }\n                processor.process()\n\n            case .failure(let error):\n                callbacks.forEach { callback in\n                    let queue = callback.options.callbackQueue\n                    queue.execute { callback.onCompleted?.call(.failure(error)) }\n                }\n            }\n        }\n\n        reportWillDownloadImage(url: context.url, request: context.request)\n        sessionTask.resume()\n        return downloadTask\n    }\n\n    // MARK: Downloading Task\n    /// Downloads an image with a URL and option. Invoked internally by Kingfisher. Subclasses must invoke super.\n    ///\n    /// - Parameters:\n    ///   - url: Target URL.\n    ///   - options: The options could control download behavior. See `KingfisherOptionsInfo`.\n    ///   - completionHandler: Called when the download progress finishes. This block will be called in the queue\n    ///                        defined in `.callbackQueue` in `options` parameter.\n    /// - Returns: A downloading task. You could call `cancel` on it to stop the download task.\n    @discardableResult\n    open func downloadImage(\n        with url: URL,\n        options: KingfisherParsedOptionsInfo,\n        completionHandler: ((Result<ImageLoadingResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var downloadTask: DownloadTask?\n        createDownloadContext(with: url, options: options) { result in\n            switch result {\n            case .success(let context):\n                // `downloadTask` will be set if the downloading started immediately. This is the case when no request\n                // modifier or a sync modifier (`ImageDownloadRequestModifier`) is used. Otherwise, when an\n                // `AsyncImageDownloadRequestModifier` is used the returned `downloadTask` of this method will be `nil`\n                // and the actual \"delayed\" task is given in `AsyncImageDownloadRequestModifier.onDownloadTaskStarted`\n                // callback.\n                downloadTask = self.startDownloadTask(\n                    context: context,\n                    callback: self.createTaskCallback(completionHandler, options: options)\n                )\n                if let modifier = options.requestModifier {\n                    modifier.onDownloadTaskStarted?(downloadTask)\n                }\n            case .failure(let error):\n                options.callbackQueue.execute {\n                    completionHandler?(.failure(error))\n                }\n            }\n        }\n\n        return downloadTask\n    }\n\n    /// Downloads an image with a URL and option.\n    ///\n    /// - Parameters:\n    ///   - url: Target URL.\n    ///   - options: The options could control download behavior. See `KingfisherOptionsInfo`.\n    ///   - progressBlock: Called when the download progress updated. This block will be always be called in main queue.\n    ///   - completionHandler: Called when the download progress finishes. This block will be called in the queue\n    ///                        defined in `.callbackQueue` in `options` parameter.\n    /// - Returns: A downloading task. You could call `cancel` on it to stop the download task.\n    @discardableResult\n    open func downloadImage(\n        with url: URL,\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: DownloadProgressBlock? = nil,\n        completionHandler: ((Result<ImageLoadingResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        var info = KingfisherParsedOptionsInfo(options)\n        if let block = progressBlock {\n            info.onDataReceived = (info.onDataReceived ?? []) + [ImageLoadingProgressSideEffect(block)]\n        }\n        return downloadImage(\n            with: url,\n            options: info,\n            completionHandler: completionHandler)\n    }\n\n    /// Downloads an image with a URL and option.\n    ///\n    /// - Parameters:\n    ///   - url: Target URL.\n    ///   - options: The options could control download behavior. See `KingfisherOptionsInfo`.\n    ///   - completionHandler: Called when the download progress finishes. This block will be called in the queue\n    ///                        defined in `.callbackQueue` in `options` parameter.\n    /// - Returns: A downloading task. You could call `cancel` on it to stop the download task.\n    @discardableResult\n    open func downloadImage(\n        with url: URL,\n        options: KingfisherOptionsInfo? = nil,\n        completionHandler: ((Result<ImageLoadingResult, KingfisherError>) -> Void)? = nil) -> DownloadTask?\n    {\n        downloadImage(\n            with: url,\n            options: KingfisherParsedOptionsInfo(options),\n            completionHandler: completionHandler\n        )\n    }\n}\n\n// MARK: Cancelling Task\nextension ImageDownloader {\n\n    /// Cancel all downloading tasks for this `ImageDownloader`. It will trigger the completion handlers\n    /// for all not-yet-finished downloading tasks.\n    ///\n    /// If you need to only cancel a certain task, call `cancel()` on the `DownloadTask`\n    /// returned by the downloading methods. If you need to cancel all `DownloadTask`s of a certain url,\n    /// use `ImageDownloader.cancel(url:)`.\n    public func cancelAll() {\n        sessionDelegate.cancelAll()\n    }\n\n    /// Cancel all downloading tasks for a given URL. It will trigger the completion handlers for\n    /// all not-yet-finished downloading tasks for the URL.\n    ///\n    /// - Parameter url: The URL which you want to cancel downloading.\n    public func cancel(url: URL) {\n        sessionDelegate.cancel(url: url)\n    }\n}\n\n// Use the default implementation from extension of `AuthenticationChallengeResponsable`.\nextension ImageDownloader: AuthenticationChallengeResponsable {}\n\n// Use the default implementation from extension of `ImageDownloaderDelegate`.\nextension ImageDownloader: ImageDownloaderDelegate {}\n\nextension ImageDownloader {\n    struct DownloadingContext {\n        let url: URL\n        let request: URLRequest\n        let options: KingfisherParsedOptionsInfo\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/ImageDownloaderDelegate.swift",
    "content": "//\n//  ImageDownloaderDelegate.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/10/11.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Protocol of `ImageDownloader`. This protocol provides a set of methods which are related to image downloader\n/// working stages and rules.\npublic protocol ImageDownloaderDelegate: AnyObject {\n\n    /// Called when the `ImageDownloader` object will start downloading an image from a specified URL.\n    ///\n    /// - Parameters:\n    ///   - downloader: The `ImageDownloader` object which is used for the downloading operation.\n    ///   - url: URL of the starting request.\n    ///   - request: The request object for the download process.\n    ///\n    func imageDownloader(_ downloader: ImageDownloader, willDownloadImageForURL url: URL, with request: URLRequest?)\n\n    /// Called when the `ImageDownloader` completes a downloading request with success or failure.\n    ///\n    /// - Parameters:\n    ///   - downloader: The `ImageDownloader` object which is used for the downloading operation.\n    ///   - url: URL of the original request URL.\n    ///   - response: The response object of the downloading process.\n    ///   - error: The error in case of failure.\n    ///\n    func imageDownloader(\n        _ downloader: ImageDownloader,\n        didFinishDownloadingImageForURL url: URL,\n        with response: URLResponse?,\n        error: Error?)\n\n    /// Called when the `ImageDownloader` object successfully downloaded image data from specified URL. This is\n    /// your last chance to verify or modify the downloaded data before Kingfisher tries to perform addition\n    /// processing on the image data.\n    ///\n    /// - Parameters:\n    ///   - downloader: The `ImageDownloader` object which is used for the downloading operation.\n    ///   - data: The original downloaded data.\n    ///   - dataTask: The data task contains request and response information of the download.\n    /// - Note:\n    ///   This can be used to pre-process raw image data before creation of `Image` instance (i.e.\n    ///   decrypting or verification). If `nil` returned, the processing is interrupted and a `KingfisherError` with\n    ///   `ResponseErrorReason.dataModifyingFailed` will be raised. You could use this fact to stop the image\n    ///   processing flow if you find the data is corrupted or malformed.\n    ///\n    ///  If this method is implemented, `imageDownloader(_:didDownload:for:)` will not be called anymore.\n    func imageDownloader(_ downloader: ImageDownloader, didDownload data: Data, with dataTask: SessionDataTask) -> Data?\n  \n    /// Called when the `ImageDownloader` object successfully downloaded image data from specified URL. This is\n    /// your last chance to verify or modify the downloaded data before Kingfisher tries to perform addition\n    /// processing on the image data.\n    ///\n    /// - Parameters:\n    ///   - downloader: The `ImageDownloader` object which is used for the downloading operation.\n    ///   - data: The original downloaded data.\n    ///   - url: The URL of the original request URL.\n    /// - Returns: The data from which Kingfisher should use to create an image. You need to provide valid data\n    ///            which content is one of the supported image file format. Kingfisher will perform process on this\n    ///            data and try to convert it to an image object.\n    /// - Note:\n    ///   This can be used to pre-process raw image data before creation of `Image` instance (i.e.\n    ///   decrypting or verification). If `nil` returned, the processing is interrupted and a `KingfisherError` with\n    ///   `ResponseErrorReason.dataModifyingFailed` will be raised. You could use this fact to stop the image\n    ///   processing flow if you find the data is corrupted or malformed.\n    ///\n    ///   If `imageDownloader(_:didDownload:with:)` is implemented, this method will not be called anymore.\n    func imageDownloader(_ downloader: ImageDownloader, didDownload data: Data, for url: URL) -> Data?\n\n    /// Called when the `ImageDownloader` object successfully downloads and processes an image from specified URL.\n    ///\n    /// - Parameters:\n    ///   - downloader: The `ImageDownloader` object which is used for the downloading operation.\n    ///   - image: The downloaded and processed image.\n    ///   - url: URL of the original request URL.\n    ///   - response: The original response object of the downloading process.\n    ///\n    func imageDownloader(\n        _ downloader: ImageDownloader,\n        didDownload image: KFCrossPlatformImage,\n        for url: URL,\n        with response: URLResponse?)\n\n    /// Checks if a received HTTP status code is valid or not.\n    /// By default, a status code in range 200..<400 is considered as valid.\n    /// If an invalid code is received, the downloader will raise an `KingfisherError` with\n    /// `ResponseErrorReason.invalidHTTPStatusCode` as its reason.\n    ///\n    /// - Parameters:\n    ///   - code: The received HTTP status code.\n    ///   - downloader: The `ImageDownloader` object asks for validate status code.\n    /// - Returns: Returns a value to indicate whether this HTTP status code is valid or not.\n    /// - Note: If the default 200 to 400 valid code does not suit your need,\n    ///         you can implement this method to change that behavior.\n    func isValidStatusCode(_ code: Int, for downloader: ImageDownloader) -> Bool\n}\n\n// Default implementation for `ImageDownloaderDelegate`.\nextension ImageDownloaderDelegate {\n    public func imageDownloader(\n        _ downloader: ImageDownloader,\n        willDownloadImageForURL url: URL,\n        with request: URLRequest?) {}\n\n    public func imageDownloader(\n        _ downloader: ImageDownloader,\n        didFinishDownloadingImageForURL url: URL,\n        with response: URLResponse?,\n        error: Error?) {}\n\n    public func imageDownloader(\n        _ downloader: ImageDownloader,\n        didDownload image: KFCrossPlatformImage,\n        for url: URL,\n        with response: URLResponse?) {}\n\n    public func isValidStatusCode(_ code: Int, for downloader: ImageDownloader) -> Bool {\n        return (200..<400).contains(code)\n    }\n  \n    public func imageDownloader(_ downloader: ImageDownloader, didDownload data: Data, with task: SessionDataTask) -> Data? {\n        guard let url = task.originalURL else {\n            return data\n        }\n        return imageDownloader(downloader, didDownload: data, for: url)\n    }\n  \n    public func imageDownloader(_ downloader: ImageDownloader, didDownload data: Data, for url: URL) -> Data? {\n        return data\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/ImageModifier.swift",
    "content": "//\n//  ImageModifier.swift\n//  Kingfisher\n//\n//  Created by Ethan Gill on 2017/11/28.\n//\n//  Copyright (c) 2019 Ethan Gill <ethan.gill@me.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// An `ImageModifier` can be used to change properties on an image between cache serialization and the actual use of\n/// the image. The `modify(_:)` method will be called after the image retrieved from its source and before it returned\n/// to the caller. This modified image is expected to be only used for rendering purpose, any changes applied by the\n/// `ImageModifier` will not be serialized or cached.\npublic protocol ImageModifier {\n    /// Modify an input `Image`.\n    ///\n    /// - parameter image:   Image which will be modified by `self`\n    ///\n    /// - returns: The modified image.\n    ///\n    /// - Note: The return value will be unmodified if modifying is not possible on\n    ///         the current platform.\n    /// - Note: Most modifiers support UIImage or NSImage, but not CGImage.\n    func modify(_ image: KFCrossPlatformImage) -> KFCrossPlatformImage\n}\n\n/// A wrapper for creating an `ImageModifier` easier.\n/// This type conforms to `ImageModifier` and wraps an image modify block.\n/// If the `block` throws an error, the original image will be used.\npublic struct AnyImageModifier: ImageModifier {\n\n    /// A block which modifies images, or returns the original image\n    /// if modification cannot be performed with an error.\n    let block: (KFCrossPlatformImage) throws -> KFCrossPlatformImage\n\n    /// Creates an `AnyImageModifier` with a given `modify` block.\n    public init(modify: @escaping (KFCrossPlatformImage) throws -> KFCrossPlatformImage) {\n        block = modify\n    }\n\n    /// Modify an input `Image`. See `ImageModifier` protocol for more.\n    public func modify(_ image: KFCrossPlatformImage) -> KFCrossPlatformImage {\n        return (try? block(image)) ?? image\n    }\n}\n\n#if os(iOS) || os(tvOS) || os(watchOS)\nimport UIKit\n\n/// Modifier for setting the rendering mode of images.\npublic struct RenderingModeImageModifier: ImageModifier {\n\n    /// The rendering mode to apply to the image.\n    public let renderingMode: UIImage.RenderingMode\n\n    /// Creates a `RenderingModeImageModifier`.\n    ///\n    /// - Parameter renderingMode: The rendering mode to apply to the image. Default is `.automatic`.\n    public init(renderingMode: UIImage.RenderingMode = .automatic) {\n        self.renderingMode = renderingMode\n    }\n\n    /// Modify an input `Image`. See `ImageModifier` protocol for more.\n    public func modify(_ image: KFCrossPlatformImage) -> KFCrossPlatformImage {\n        return image.withRenderingMode(renderingMode)\n    }\n}\n\n/// Modifier for setting the `flipsForRightToLeftLayoutDirection` property of images.\npublic struct FlipsForRightToLeftLayoutDirectionImageModifier: ImageModifier {\n\n    /// Creates a `FlipsForRightToLeftLayoutDirectionImageModifier`.\n    public init() {}\n\n    /// Modify an input `Image`. See `ImageModifier` protocol for more.\n    public func modify(_ image: KFCrossPlatformImage) -> KFCrossPlatformImage {\n        return image.imageFlippedForRightToLeftLayoutDirection()\n    }\n}\n\n/// Modifier for setting the `alignmentRectInsets` property of images.\npublic struct AlignmentRectInsetsImageModifier: ImageModifier {\n\n    /// The alignment insets to apply to the image\n    public let alignmentInsets: UIEdgeInsets\n\n    /// Creates an `AlignmentRectInsetsImageModifier`.\n    public init(alignmentInsets: UIEdgeInsets) {\n        self.alignmentInsets = alignmentInsets\n    }\n\n    /// Modify an input `Image`. See `ImageModifier` protocol for more.\n    public func modify(_ image: KFCrossPlatformImage) -> KFCrossPlatformImage {\n        return image.withAlignmentRectInsets(alignmentInsets)\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/ImagePrefetcher.swift",
    "content": "//\n//  ImagePrefetcher.swift\n//  Kingfisher\n//\n//  Created by Claire Knight <claire.knight@moggytech.co.uk> on 24/02/2016\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n\n#if os(macOS)\nimport AppKit\n#else\nimport UIKit\n#endif\n\n/// Progress update block of prefetcher when initialized with a list of resources.\n///\n/// - `skippedResources`: An array of resources that are already cached before the prefetching starting.\n/// - `failedResources`: An array of resources that fail to be downloaded. It could because of being cancelled while\n///                      downloading, encountered an error when downloading or the download not being started at all.\n/// - `completedResources`: An array of resources that are downloaded and cached successfully.\npublic typealias PrefetcherProgressBlock =\n    ((_ skippedResources: [Resource], _ failedResources: [Resource], _ completedResources: [Resource]) -> Void)\n\n/// Progress update block of prefetcher when initialized with a list of resources.\n///\n/// - `skippedSources`: An array of sources that are already cached before the prefetching starting.\n/// - `failedSources`: An array of sources that fail to be fetched.\n/// - `completedResources`: An array of sources that are fetched and cached successfully.\npublic typealias PrefetcherSourceProgressBlock =\n    ((_ skippedSources: [Source], _ failedSources: [Source], _ completedSources: [Source]) -> Void)\n\n/// Completion block of prefetcher when initialized with a list of sources.\n///\n/// - `skippedResources`: An array of resources that are already cached before the prefetching starting.\n/// - `failedResources`: An array of resources that fail to be downloaded. It could because of being cancelled while\n///                      downloading, encountered an error when downloading or the download not being started at all.\n/// - `completedResources`: An array of resources that are downloaded and cached successfully.\npublic typealias PrefetcherCompletionHandler =\n    ((_ skippedResources: [Resource], _ failedResources: [Resource], _ completedResources: [Resource]) -> Void)\n\n/// Completion block of prefetcher when initialized with a list of sources.\n///\n/// - `skippedSources`: An array of sources that are already cached before the prefetching starting.\n/// - `failedSources`: An array of sources that fail to be fetched.\n/// - `completedSources`: An array of sources that are fetched and cached successfully.\npublic typealias PrefetcherSourceCompletionHandler =\n    ((_ skippedSources: [Source], _ failedSources: [Source], _ completedSources: [Source]) -> Void)\n\n/// `ImagePrefetcher` represents a downloading manager for requesting many images via URLs, then caching them.\n/// This is useful when you know a list of image resources and want to download them before showing. It also works with\n/// some Cocoa prefetching mechanism like table view or collection view `prefetchDataSource`, to start image downloading\n/// and caching before they display on screen.\npublic class ImagePrefetcher: CustomStringConvertible {\n\n    public var description: String {\n        return \"\\(Unmanaged.passUnretained(self).toOpaque())\"\n    }\n    \n    /// The maximum concurrent downloads to use when prefetching images. Default is 5.\n    public var maxConcurrentDownloads = 5\n\n    private let prefetchSources: [Source]\n    private let optionsInfo: KingfisherParsedOptionsInfo\n\n    private var progressBlock: PrefetcherProgressBlock?\n    private var completionHandler: PrefetcherCompletionHandler?\n\n    private var progressSourceBlock: PrefetcherSourceProgressBlock?\n    private var completionSourceHandler: PrefetcherSourceCompletionHandler?\n    \n    private var tasks = [String: DownloadTask.WrappedTask]()\n    \n    private var pendingSources: ArraySlice<Source>\n    private var skippedSources = [Source]()\n    private var completedSources = [Source]()\n    private var failedSources = [Source]()\n    \n    private var stopped = false\n    \n    // A manager used for prefetching. We will use the helper methods in manager.\n    private let manager: KingfisherManager\n\n    private let pretchQueue = DispatchQueue(label: \"com.onevcat.Kingfisher.ImagePrefetcher.pretchQueue\")\n    private static let requestingQueue = DispatchQueue(label: \"com.onevcat.Kingfisher.ImagePrefetcher.requestingQueue\")\n\n    private var finished: Bool {\n        let totalFinished: Int = failedSources.count + skippedSources.count + completedSources.count\n        return totalFinished == prefetchSources.count && tasks.isEmpty\n    }\n\n    /// Creates an image prefetcher with an array of URLs.\n    ///\n    /// The prefetcher should be initiated with a list of prefetching targets. The URLs list is immutable.\n    /// After you get a valid `ImagePrefetcher` object, you call `start()` on it to begin the prefetching process.\n    /// The images which are already cached will be skipped without downloading again.\n    ///\n    /// - Parameters:\n    ///   - urls: The URLs which should be prefetched.\n    ///   - options: Options could control some behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called every time an resource is downloaded, skipped or cancelled.\n    ///   - completionHandler: Called when the whole prefetching process finished.\n    ///\n    /// - Note:\n    /// By default, the `ImageDownloader.defaultDownloader` and `ImageCache.defaultCache` will be used as\n    /// the downloader and cache target respectively. You can specify another downloader or cache by using\n    /// a customized `KingfisherOptionsInfo`. Both the progress and completion block will be invoked in\n    /// main thread. The `.callbackQueue` value in `optionsInfo` will be ignored in this method.\n    public convenience init(\n        urls: [URL],\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: PrefetcherProgressBlock? = nil,\n        completionHandler: PrefetcherCompletionHandler? = nil)\n    {\n        let resources: [Resource] = urls.map { $0 }\n        self.init(\n            resources: resources,\n            options: options,\n            progressBlock: progressBlock,\n            completionHandler: completionHandler)\n    }\n\n    /// Creates an image prefetcher with an array of URLs.\n    ///\n    /// The prefetcher should be initiated with a list of prefetching targets. The URLs list is immutable.\n    /// After you get a valid `ImagePrefetcher` object, you call `start()` on it to begin the prefetching process.\n    /// The images which are already cached will be skipped without downloading again.\n    ///\n    /// - Parameters:\n    ///   - urls: The URLs which should be prefetched.\n    ///   - options: Options could control some behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - completionHandler: Called when the whole prefetching process finished.\n    ///\n    /// - Note:\n    /// By default, the `ImageDownloader.defaultDownloader` and `ImageCache.defaultCache` will be used as\n    /// the downloader and cache target respectively. You can specify another downloader or cache by using\n    /// a customized `KingfisherOptionsInfo`. Both the progress and completion block will be invoked in\n    /// main thread. The `.callbackQueue` value in `optionsInfo` will be ignored in this method.\n    public convenience init(\n        urls: [URL],\n        options: KingfisherOptionsInfo? = nil,\n        completionHandler: PrefetcherCompletionHandler? = nil)\n    {\n        let resources: [Resource] = urls.map { $0 }\n        self.init(\n            resources: resources,\n            options: options,\n            progressBlock: nil,\n            completionHandler: completionHandler)\n    }\n\n    /// Creates an image prefetcher with an array of resources.\n    ///\n    /// - Parameters:\n    ///   - resources: The resources which should be prefetched. See `Resource` type for more.\n    ///   - options: Options could control some behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called every time an resource is downloaded, skipped or cancelled.\n    ///   - completionHandler: Called when the whole prefetching process finished.\n    ///\n    /// - Note:\n    /// By default, the `ImageDownloader.defaultDownloader` and `ImageCache.defaultCache` will be used as\n    /// the downloader and cache target respectively. You can specify another downloader or cache by using\n    /// a customized `KingfisherOptionsInfo`. Both the progress and completion block will be invoked in\n    /// main thread. The `.callbackQueue` value in `optionsInfo` will be ignored in this method.\n    public convenience init(\n        resources: [Resource],\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: PrefetcherProgressBlock? = nil,\n        completionHandler: PrefetcherCompletionHandler? = nil)\n    {\n        self.init(sources: resources.map { $0.convertToSource() }, options: options)\n        self.progressBlock = progressBlock\n        self.completionHandler = completionHandler\n    }\n\n    /// Creates an image prefetcher with an array of resources.\n    ///\n    /// - Parameters:\n    ///   - resources: The resources which should be prefetched. See `Resource` type for more.\n    ///   - options: Options could control some behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - completionHandler: Called when the whole prefetching process finished.\n    ///\n    /// - Note:\n    /// By default, the `ImageDownloader.defaultDownloader` and `ImageCache.defaultCache` will be used as\n    /// the downloader and cache target respectively. You can specify another downloader or cache by using\n    /// a customized `KingfisherOptionsInfo`. Both the progress and completion block will be invoked in\n    /// main thread. The `.callbackQueue` value in `optionsInfo` will be ignored in this method.\n    public convenience init(\n        resources: [Resource],\n        options: KingfisherOptionsInfo? = nil,\n        completionHandler: PrefetcherCompletionHandler? = nil)\n    {\n        self.init(sources: resources.map { $0.convertToSource() }, options: options)\n        self.completionHandler = completionHandler\n    }\n\n    /// Creates an image prefetcher with an array of sources.\n    ///\n    /// - Parameters:\n    ///   - sources: The sources which should be prefetched. See `Source` type for more.\n    ///   - options: Options could control some behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - progressBlock: Called every time an source fetching successes, fails, is skipped.\n    ///   - completionHandler: Called when the whole prefetching process finished.\n    ///\n    /// - Note:\n    /// By default, the `ImageDownloader.defaultDownloader` and `ImageCache.defaultCache` will be used as\n    /// the downloader and cache target respectively. You can specify another downloader or cache by using\n    /// a customized `KingfisherOptionsInfo`. Both the progress and completion block will be invoked in\n    /// main thread. The `.callbackQueue` value in `optionsInfo` will be ignored in this method.\n    public convenience init(sources: [Source],\n        options: KingfisherOptionsInfo? = nil,\n        progressBlock: PrefetcherSourceProgressBlock? = nil,\n        completionHandler: PrefetcherSourceCompletionHandler? = nil)\n    {\n        self.init(sources: sources, options: options)\n        self.progressSourceBlock = progressBlock\n        self.completionSourceHandler = completionHandler\n    }\n\n    /// Creates an image prefetcher with an array of sources.\n    ///\n    /// - Parameters:\n    ///   - sources: The sources which should be prefetched. See `Source` type for more.\n    ///   - options: Options could control some behaviors. See `KingfisherOptionsInfo` for more.\n    ///   - completionHandler: Called when the whole prefetching process finished.\n    ///\n    /// - Note:\n    /// By default, the `ImageDownloader.defaultDownloader` and `ImageCache.defaultCache` will be used as\n    /// the downloader and cache target respectively. You can specify another downloader or cache by using\n    /// a customized `KingfisherOptionsInfo`. Both the progress and completion block will be invoked in\n    /// main thread. The `.callbackQueue` value in `optionsInfo` will be ignored in this method.\n    public convenience init(sources: [Source],\n        options: KingfisherOptionsInfo? = nil,\n        completionHandler: PrefetcherSourceCompletionHandler? = nil)\n    {\n        self.init(sources: sources, options: options)\n        self.completionSourceHandler = completionHandler\n    }\n\n    init(sources: [Source], options: KingfisherOptionsInfo?) {\n        var options = KingfisherParsedOptionsInfo(options)\n        prefetchSources = sources\n        pendingSources = ArraySlice(sources)\n\n        // We want all callbacks from our prefetch queue, so we should ignore the callback queue in options.\n        // Add our own callback dispatch queue to make sure all internal callbacks are\n        // coming back in our expected queue.\n        options.callbackQueue = .dispatch(pretchQueue)\n        optionsInfo = options\n\n        let cache = optionsInfo.targetCache ?? .default\n        let downloader = optionsInfo.downloader ?? .default\n        manager = KingfisherManager(downloader: downloader, cache: cache)\n    }\n\n    /// Starts to download the resources and cache them. This can be useful for background downloading\n    /// of assets that are required for later use in an app. This code will not try and update any UI\n    /// with the results of the process.\n    public func start() {\n        pretchQueue.async {\n            guard !self.stopped else {\n                assertionFailure(\"You can not restart the same prefetcher. Try to create a new prefetcher.\")\n                self.handleComplete()\n                return\n            }\n\n            guard self.maxConcurrentDownloads > 0 else {\n                assertionFailure(\"There should be concurrent downloads value should be at least 1.\")\n                self.handleComplete()\n                return\n            }\n\n            // Empty case.\n            guard self.prefetchSources.count > 0 else {\n                self.handleComplete()\n                return\n            }\n\n            let initialConcurrentDownloads = min(self.prefetchSources.count, self.maxConcurrentDownloads)\n            for _ in 0 ..< initialConcurrentDownloads {\n                if let resource = self.pendingSources.popFirst() {\n                    self.startPrefetching(resource)\n                }\n            }\n        }\n    }\n\n    /// Stops current downloading progress, and cancel any future prefetching activity that might be occuring.\n    public func stop() {\n        pretchQueue.async {\n            if self.finished { return }\n            self.stopped = true\n            self.tasks.values.forEach { $0.cancel() }\n        }\n    }\n    \n    private func downloadAndCache(_ source: Source) {\n\n        let downloadTaskCompletionHandler: ((Result<RetrieveImageResult, KingfisherError>) -> Void) = { result in\n            self.tasks.removeValue(forKey: source.cacheKey)\n            do {\n                let _ = try result.get()\n                self.completedSources.append(source)\n            } catch {\n                self.failedSources.append(source)\n            }\n            \n            self.reportProgress()\n            if self.stopped {\n                if self.tasks.isEmpty {\n                    self.failedSources.append(contentsOf: self.pendingSources)\n                    self.handleComplete()\n                }\n            } else {\n                self.reportCompletionOrStartNext()\n            }\n        }\n\n        var downloadTask: DownloadTask.WrappedTask?\n        ImagePrefetcher.requestingQueue.sync {\n            let context = RetrievingContext(\n                options: optionsInfo, originalSource: source\n            )\n            downloadTask = manager.loadAndCacheImage(\n                source: source,\n                context: context,\n                completionHandler: downloadTaskCompletionHandler)\n        }\n\n        if let downloadTask = downloadTask {\n            tasks[source.cacheKey] = downloadTask\n        }\n    }\n    \n    private func append(cached source: Source) {\n        skippedSources.append(source)\n \n        reportProgress()\n        reportCompletionOrStartNext()\n    }\n    \n    private func startPrefetching(_ source: Source)\n    {\n        if optionsInfo.forceRefresh {\n            downloadAndCache(source)\n            return\n        }\n        \n        let cacheType = manager.cache.imageCachedType(\n            forKey: source.cacheKey,\n            processorIdentifier: optionsInfo.processor.identifier)\n        switch cacheType {\n        case .memory:\n            append(cached: source)\n        case .disk:\n            if optionsInfo.alsoPrefetchToMemory {\n                let context = RetrievingContext(options: optionsInfo, originalSource: source)\n                _ = manager.retrieveImageFromCache(\n                    source: source,\n                    context: context)\n                {\n                    _ in\n                    self.append(cached: source)\n                }\n            } else {\n                append(cached: source)\n            }\n        case .none:\n            downloadAndCache(source)\n        }\n    }\n    \n    private func reportProgress() {\n\n        if progressBlock == nil && progressSourceBlock == nil {\n            return\n        }\n\n        let skipped = self.skippedSources\n        let failed = self.failedSources\n        let completed = self.completedSources\n        CallbackQueue.mainCurrentOrAsync.execute {\n            self.progressSourceBlock?(skipped, failed, completed)\n            self.progressBlock?(\n                skipped.compactMap { $0.asResource },\n                failed.compactMap { $0.asResource },\n                completed.compactMap { $0.asResource }\n            )\n        }\n    }\n    \n    private func reportCompletionOrStartNext() {\n        if let resource = self.pendingSources.popFirst() {\n            // Loose call stack for huge ammount of sources.\n            pretchQueue.async { self.startPrefetching(resource) }\n        } else {\n            guard allFinished else { return }\n            self.handleComplete()\n        }\n    }\n\n    var allFinished: Bool {\n        return skippedSources.count + failedSources.count + completedSources.count == prefetchSources.count\n    }\n    \n    private func handleComplete() {\n\n        if completionHandler == nil && completionSourceHandler == nil {\n            return\n        }\n        \n        // The completion handler should be called on the main thread\n        CallbackQueue.mainCurrentOrAsync.execute {\n            self.completionSourceHandler?(self.skippedSources, self.failedSources, self.completedSources)\n            self.completionHandler?(\n                self.skippedSources.compactMap { $0.asResource },\n                self.failedSources.compactMap { $0.asResource },\n                self.completedSources.compactMap { $0.asResource }\n            )\n            self.completionHandler = nil\n            self.progressBlock = nil\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/RedirectHandler.swift",
    "content": "//\n//  RedirectHandler.swift\n//  Kingfisher\n//\n//  Created by Roman Maidanovych on 2018/12/10.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents and wraps a method for modifying request during an image download request redirection.\npublic protocol ImageDownloadRedirectHandler {\n\n    /// The `ImageDownloadRedirectHandler` contained will be used to change the request before redirection.\n    /// This is the posibility you can modify the image download request during redirection. You can modify the\n    /// request for some customizing purpose, such as adding auth token to the header, do basic HTTP auth or\n    /// something like url mapping.\n    ///\n    /// Usually, you pass an `ImageDownloadRedirectHandler` as the associated value of\n    /// `KingfisherOptionsInfoItem.redirectHandler` and use it as the `options` parameter in related methods.\n    ///\n    /// If you do nothing with the input `request` and return it as is, a downloading process will redirect with it.\n    ///\n    /// - Parameters:\n    ///   - task: The current `SessionDataTask` which triggers this redirect.\n    ///   - response: The response received during redirection.\n    ///   - newRequest: The request for redirection which can be modified.\n    ///   - completionHandler: A closure for being called with modified request.\n    func handleHTTPRedirection(\n        for task: SessionDataTask,\n        response: HTTPURLResponse,\n        newRequest: URLRequest,\n        completionHandler: @escaping (URLRequest?) -> Void)\n}\n\n/// A wrapper for creating an `ImageDownloadRedirectHandler` easier.\n/// This type conforms to `ImageDownloadRedirectHandler` and wraps a redirect request modify block.\npublic struct AnyRedirectHandler: ImageDownloadRedirectHandler {\n    \n    let block: (SessionDataTask, HTTPURLResponse, URLRequest, @escaping (URLRequest?) -> Void) -> Void\n\n    public func handleHTTPRedirection(\n        for task: SessionDataTask,\n        response: HTTPURLResponse,\n        newRequest: URLRequest,\n        completionHandler: @escaping (URLRequest?) -> Void)\n    {\n        block(task, response, newRequest, completionHandler)\n    }\n    \n    /// Creates a value of `ImageDownloadRedirectHandler` which runs `modify` block.\n    ///\n    /// - Parameter modify: The request modifying block runs when a request modifying task comes.\n    ///\n    public init(handle: @escaping (SessionDataTask, HTTPURLResponse, URLRequest, @escaping (URLRequest?) -> Void) -> Void) {\n        block = handle\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/RequestModifier.swift",
    "content": "//\n//  RequestModifier.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2016/09/05.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents and wraps a method for modifying request before an image download request starts in an asynchronous way.\npublic protocol AsyncImageDownloadRequestModifier {\n\n    /// This method will be called just before the `request` being sent.\n    /// This is the last chance you can modify the image download request. You can modify the request for some\n    /// customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url mapping.\n    /// When you have done with the modification, call the `reportModified` block with the modified request and the data\n    /// download will happen with this request.\n    ///\n    /// Usually, you pass an `AsyncImageDownloadRequestModifier` as the associated value of\n    /// `KingfisherOptionsInfoItem.requestModifier` and use it as the `options` parameter in related methods.\n    ///\n    /// If you do nothing with the input `request` and return it as is, a downloading process will start with it.\n    ///\n    /// - Parameters:\n    ///   - request: The input request contains necessary information like `url`. This request is generated\n    ///              according to your resource url as a GET request.\n    ///   - reportModified: The callback block you need to call after the asynchronous modifying done.\n    ///\n    func modified(for request: URLRequest, reportModified: @escaping (URLRequest?) -> Void)\n\n    /// A block will be called when the download task started.\n    ///\n    /// If an `AsyncImageDownloadRequestModifier` and the asynchronous modification happens before the download, the\n    /// related download method will not return a valid `DownloadTask` value. Instead, you can get one from this method.\n    var onDownloadTaskStarted: ((DownloadTask?) -> Void)? { get }\n}\n\n/// Represents and wraps a method for modifying request before an image download request starts.\npublic protocol ImageDownloadRequestModifier: AsyncImageDownloadRequestModifier {\n\n    /// This method will be called just before the `request` being sent.\n    /// This is the last chance you can modify the image download request. You can modify the request for some\n    /// customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url mapping.\n    ///\n    /// Usually, you pass an `ImageDownloadRequestModifier` as the associated value of\n    /// `KingfisherOptionsInfoItem.requestModifier` and use it as the `options` parameter in related methods.\n    ///\n    /// If you do nothing with the input `request` and return it as is, a downloading process will start with it.\n    ///\n    /// - Parameter request: The input request contains necessary information like `url`. This request is generated\n    ///                      according to your resource url as a GET request.\n    /// - Returns: A modified version of request, which you wish to use for downloading an image. If `nil` returned,\n    ///            a `KingfisherError.requestError` with `.emptyRequest` as its reason will occur.\n    ///\n    func modified(for request: URLRequest) -> URLRequest?\n}\n\nextension ImageDownloadRequestModifier {\n    public func modified(for request: URLRequest, reportModified: @escaping (URLRequest?) -> Void) {\n        let request = modified(for: request)\n        reportModified(request)\n    }\n\n    /// This is `nil` for a sync `ImageDownloadRequestModifier` by default. You can get the `DownloadTask` from the\n    /// return value of downloader method.\n    public var onDownloadTaskStarted: ((DownloadTask?) -> Void)? { return nil }\n}\n\n/// A wrapper for creating an `ImageDownloadRequestModifier` easier.\n/// This type conforms to `ImageDownloadRequestModifier` and wraps an image modify block.\npublic struct AnyModifier: ImageDownloadRequestModifier {\n    \n    let block: (URLRequest) -> URLRequest?\n\n    /// For `ImageDownloadRequestModifier` conformation.\n    public func modified(for request: URLRequest) -> URLRequest? {\n        return block(request)\n    }\n    \n    /// Creates a value of `ImageDownloadRequestModifier` which runs `modify` block.\n    ///\n    /// - Parameter modify: The request modifying block runs when a request modifying task comes.\n    ///                     The return `URLRequest?` value of this block will be used as the image download request.\n    ///                     If `nil` returned, a `KingfisherError.requestError` with `.emptyRequest` as its\n    ///                     reason will occur.\n    public init(modify: @escaping (URLRequest) -> URLRequest?) {\n        block = modify\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/RetryStrategy.swift",
    "content": "//\n//  RetryStrategy.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2020/05/04.\n//\n//  Copyright (c) 2020 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents a retry context which could be used to determine the current retry status.\npublic class RetryContext {\n\n    /// The source from which the target image should be retrieved.\n    public let source: Source\n\n    /// The last error which caused current retry behavior.\n    public let error: KingfisherError\n\n    /// The retried count before current retry happens. This value is `0` if the current retry is for the first time.\n    public var retriedCount: Int\n\n    /// A user set value for passing any other information during the retry. If you choose to use `RetryDecision.retry`\n    /// as the retry decision for `RetryStrategy.retry(context:retryHandler:)`, the associated value of\n    /// `RetryDecision.retry` will be delivered to you in the next retry.\n    public internal(set) var userInfo: Any? = nil\n\n    init(source: Source, error: KingfisherError) {\n        self.source = source\n        self.error = error\n        self.retriedCount = 0\n    }\n\n    @discardableResult\n    func increaseRetryCount() -> RetryContext {\n        retriedCount += 1\n        return self\n    }\n}\n\n/// Represents decision of behavior on the current retry.\npublic enum RetryDecision {\n    /// A retry should happen. The associated `userInfo` will be pass to the next retry in the `RetryContext` parameter.\n    case retry(userInfo: Any?)\n    /// There should be no more retry attempt. The image retrieving process will fail with an error.\n    case stop\n}\n\n/// Defines a retry strategy can be applied to a `.retryStrategy` option.\npublic protocol RetryStrategy {\n\n    /// Kingfisher calls this method if an error happens during the image retrieving process from a `KingfisherManager`.\n    /// You implement this method to provide necessary logic based on the `context` parameter. Then you need to call\n    /// `retryHandler` to pass the retry decision back to Kingfisher.\n    ///\n    /// - Parameters:\n    ///   - context: The retry context containing information of current retry attempt.\n    ///   - retryHandler: A block you need to call with a decision of whether the retry should happen or not.\n    func retry(context: RetryContext, retryHandler: @escaping (RetryDecision) -> Void)\n}\n\n/// A retry strategy that guides Kingfisher to retry when a `.responseError` happens, with a specified max retry count\n/// and a certain interval mechanism.\npublic struct DelayRetryStrategy: RetryStrategy {\n\n    /// Represents the interval mechanism which used in a `DelayRetryStrategy`.\n    public enum Interval {\n        /// The next retry attempt should happen in fixed seconds. For example, if the associated value is 3, the\n        /// attempts happens after 3 seconds after the previous decision is made.\n        case seconds(TimeInterval)\n        /// The next retry attempt should happen in an accumulated duration. For example, if the associated value is 3,\n        /// the attempts happens with interval of 3, 6, 9, 12, ... seconds.\n        case accumulated(TimeInterval)\n        /// Uses a block to determine the next interval. The current retry count is given as a parameter.\n        case custom(block: (_ retriedCount: Int) -> TimeInterval)\n\n        func timeInterval(for retriedCount: Int) -> TimeInterval {\n            let retryAfter: TimeInterval\n            switch self {\n            case .seconds(let interval):\n                retryAfter = interval\n            case .accumulated(let interval):\n                retryAfter = Double(retriedCount + 1) * interval\n            case .custom(let block):\n                retryAfter = block(retriedCount)\n            }\n            return retryAfter\n        }\n    }\n\n    /// The max retry count defined for the retry strategy\n    public let maxRetryCount: Int\n\n    /// The retry interval mechanism defined for the retry strategy.\n    public let retryInterval: Interval\n\n    /// Creates a delay retry strategy.\n    /// - Parameters:\n    ///   - maxRetryCount: The max retry count.\n    ///   - retryInterval: The retry interval mechanism. By default, `.seconds(3)` is used to provide a constant retry\n    ///   interval.\n    public init(maxRetryCount: Int, retryInterval: Interval = .seconds(3)) {\n        self.maxRetryCount = maxRetryCount\n        self.retryInterval = retryInterval\n    }\n\n    public func retry(context: RetryContext, retryHandler: @escaping (RetryDecision) -> Void) {\n        // Retry count exceeded.\n        guard context.retriedCount < maxRetryCount else {\n            retryHandler(.stop)\n            return\n        }\n\n        // User cancel the task. No retry.\n        guard !context.error.isTaskCancelled else {\n            retryHandler(.stop)\n            return\n        }\n\n        // Only retry for a response error.\n        guard case KingfisherError.responseError = context.error else {\n            retryHandler(.stop)\n            return\n        }\n\n        let interval = retryInterval.timeInterval(for: context.retriedCount)\n        if interval == 0 {\n            retryHandler(.retry(userInfo: nil))\n        } else {\n            DispatchQueue.main.asyncAfter(deadline: .now() + interval) {\n                retryHandler(.retry(userInfo: nil))\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/SessionDataTask.swift",
    "content": "//\n//  SessionDataTask.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/11/1.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents a session data task in `ImageDownloader`. It consists of an underlying `URLSessionDataTask` and\n/// an array of `TaskCallback`. Multiple `TaskCallback`s could be added for a single downloading data task.\npublic class SessionDataTask {\n\n    /// Represents the type of token which used for cancelling a task.\n    public typealias CancelToken = Int\n\n    struct TaskCallback {\n        let onCompleted: Delegate<Result<ImageLoadingResult, KingfisherError>, Void>?\n        let options: KingfisherParsedOptionsInfo\n    }\n\n    /// Downloaded raw data of current task.\n    public private(set) var mutableData: Data\n\n    // This is a copy of `task.originalRequest?.url`. It is for getting a race-safe behavior for a pitfall on iOS 13.\n    // Ref: https://github.com/onevcat/Kingfisher/issues/1511\n    public let originalURL: URL?\n\n    /// The underlying download task. It is only for debugging purpose when you encountered an error. You should not\n    /// modify the content of this task or start it yourself.\n    public let task: URLSessionDataTask\n    private var callbacksStore = [CancelToken: TaskCallback]()\n\n    var callbacks: [SessionDataTask.TaskCallback] {\n        lock.lock()\n        defer { lock.unlock() }\n        return Array(callbacksStore.values)\n    }\n\n    private var currentToken = 0\n    private let lock = NSLock()\n\n    let onTaskDone = Delegate<(Result<(Data, URLResponse?), KingfisherError>, [TaskCallback]), Void>()\n    let onCallbackCancelled = Delegate<(CancelToken, TaskCallback), Void>()\n\n    var started = false\n    var containsCallbacks: Bool {\n        // We should be able to use `task.state != .running` to check it.\n        // However, in some rare cases, cancelling the task does not change\n        // task state to `.cancelling` immediately, but still in `.running`.\n        // So we need to check callbacks count to for sure that it is safe to remove the\n        // task in delegate.\n        return !callbacks.isEmpty\n    }\n\n    init(task: URLSessionDataTask) {\n        self.task = task\n        self.originalURL = task.originalRequest?.url\n        mutableData = Data()\n    }\n\n    func addCallback(_ callback: TaskCallback) -> CancelToken {\n        lock.lock()\n        defer { lock.unlock() }\n        callbacksStore[currentToken] = callback\n        defer { currentToken += 1 }\n        return currentToken\n    }\n\n    func removeCallback(_ token: CancelToken) -> TaskCallback? {\n        lock.lock()\n        defer { lock.unlock() }\n        if let callback = callbacksStore[token] {\n            callbacksStore[token] = nil\n            return callback\n        }\n        return nil\n    }\n\n    func resume() {\n        guard !started else { return }\n        started = true\n        task.resume()\n    }\n\n    func cancel(token: CancelToken) {\n        guard let callback = removeCallback(token) else {\n            return\n        }\n        onCallbackCancelled.call((token, callback))\n    }\n\n    func forceCancel() {\n        for token in callbacksStore.keys {\n            cancel(token: token)\n        }\n    }\n\n    func didReceiveData(_ data: Data) {\n        mutableData.append(data)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Networking/SessionDelegate.swift",
    "content": "//\n//  SessionDelegate.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/11/1.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n// Represents the delegate object of downloader session. It also behave like a task manager for downloading.\n@objc(KFSessionDelegate) // Fix for ObjC header name conflicting. https://github.com/onevcat/Kingfisher/issues/1530\nopen class SessionDelegate: NSObject {\n\n    typealias SessionChallengeFunc = (\n        URLSession,\n        URLAuthenticationChallenge,\n        (URLSession.AuthChallengeDisposition, URLCredential?) -> Void\n    )\n\n    typealias SessionTaskChallengeFunc = (\n        URLSession,\n        URLSessionTask,\n        URLAuthenticationChallenge,\n        (URLSession.AuthChallengeDisposition, URLCredential?) -> Void\n    )\n\n    private var tasks: [URL: SessionDataTask] = [:]\n    private let lock = NSLock()\n\n    let onValidStatusCode = Delegate<Int, Bool>()\n    let onDownloadingFinished = Delegate<(URL, Result<URLResponse, KingfisherError>), Void>()\n    let onDidDownloadData = Delegate<SessionDataTask, Data?>()\n\n    let onReceiveSessionChallenge = Delegate<SessionChallengeFunc, Void>()\n    let onReceiveSessionTaskChallenge = Delegate<SessionTaskChallengeFunc, Void>()\n\n    func add(\n        _ dataTask: URLSessionDataTask,\n        url: URL,\n        callback: SessionDataTask.TaskCallback) -> DownloadTask\n    {\n        lock.lock()\n        defer { lock.unlock() }\n\n        // Create a new task if necessary.\n        let task = SessionDataTask(task: dataTask)\n        task.onCallbackCancelled.delegate(on: self) { [weak task] (self, value) in\n            guard let task = task else { return }\n\n            let (token, callback) = value\n\n            let error = KingfisherError.requestError(reason: .taskCancelled(task: task, token: token))\n            task.onTaskDone.call((.failure(error), [callback]))\n            // No other callbacks waiting, we can clear the task now.\n            if !task.containsCallbacks {\n                let dataTask = task.task\n\n                self.cancelTask(dataTask)\n                self.remove(task)\n            }\n        }\n        let token = task.addCallback(callback)\n        tasks[url] = task\n        return DownloadTask(sessionTask: task, cancelToken: token)\n    }\n\n    private func cancelTask(_ dataTask: URLSessionDataTask) {\n        lock.lock()\n        defer { lock.unlock() }\n        dataTask.cancel()\n    }\n\n    func append(\n        _ task: SessionDataTask,\n        url: URL,\n        callback: SessionDataTask.TaskCallback) -> DownloadTask\n    {\n        let token = task.addCallback(callback)\n        return DownloadTask(sessionTask: task, cancelToken: token)\n    }\n\n    private func remove(_ task: SessionDataTask) {\n        lock.lock()\n        defer { lock.unlock() }\n\n        guard let url = task.originalURL else {\n            return\n        }\n        tasks[url] = nil\n    }\n\n    private func task(for task: URLSessionTask) -> SessionDataTask? {\n        lock.lock()\n        defer { lock.unlock() }\n\n        guard let url = task.originalRequest?.url else {\n            return nil\n        }\n        guard let sessionTask = tasks[url] else {\n            return nil\n        }\n        guard sessionTask.task.taskIdentifier == task.taskIdentifier else {\n            return nil\n        }\n        return sessionTask\n    }\n\n    func task(for url: URL) -> SessionDataTask? {\n        lock.lock()\n        defer { lock.unlock() }\n        return tasks[url]\n    }\n\n    func cancelAll() {\n        lock.lock()\n        let taskValues = tasks.values\n        lock.unlock()\n        for task in taskValues {\n            task.forceCancel()\n        }\n    }\n\n    func cancel(url: URL) {\n        lock.lock()\n        let task = tasks[url]\n        lock.unlock()\n        task?.forceCancel()\n    }\n}\n\nextension SessionDelegate: URLSessionDataDelegate {\n\n    open func urlSession(\n        _ session: URLSession,\n        dataTask: URLSessionDataTask,\n        didReceive response: URLResponse,\n        completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)\n    {\n        guard let httpResponse = response as? HTTPURLResponse else {\n            let error = KingfisherError.responseError(reason: .invalidURLResponse(response: response))\n            onCompleted(task: dataTask, result: .failure(error))\n            completionHandler(.cancel)\n            return\n        }\n\n        let httpStatusCode = httpResponse.statusCode\n        guard onValidStatusCode.call(httpStatusCode) == true else {\n            let error = KingfisherError.responseError(reason: .invalidHTTPStatusCode(response: httpResponse))\n            onCompleted(task: dataTask, result: .failure(error))\n            completionHandler(.cancel)\n            return\n        }\n        completionHandler(.allow)\n    }\n\n    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {\n        guard let task = self.task(for: dataTask) else {\n            return\n        }\n        \n        task.didReceiveData(data)\n        \n        task.callbacks.forEach { callback in\n            callback.options.onDataReceived?.forEach { sideEffect in\n                sideEffect.onDataReceived(session, task: task, data: data)\n            }\n        }\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {\n        guard let sessionTask = self.task(for: task) else { return }\n\n        if let url = sessionTask.originalURL {\n            let result: Result<URLResponse, KingfisherError>\n            if let error = error {\n                result = .failure(KingfisherError.responseError(reason: .URLSessionError(error: error)))\n            } else if let response = task.response {\n                result = .success(response)\n            } else {\n                result = .failure(KingfisherError.responseError(reason: .noURLResponse(task: sessionTask)))\n            }\n            onDownloadingFinished.call((url, result))\n        }\n\n        let result: Result<(Data, URLResponse?), KingfisherError>\n        if let error = error {\n            result = .failure(KingfisherError.responseError(reason: .URLSessionError(error: error)))\n        } else {\n            if let data = onDidDownloadData.call(sessionTask) {\n                result = .success((data, task.response))\n            } else {\n                result = .failure(KingfisherError.responseError(reason: .dataModifyingFailed(task: sessionTask)))\n            }\n        }\n        onCompleted(task: task, result: result)\n    }\n\n    open func urlSession(\n        _ session: URLSession,\n        didReceive challenge: URLAuthenticationChallenge,\n        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)\n    {\n        onReceiveSessionChallenge.call((session, challenge, completionHandler))\n    }\n\n    open func urlSession(\n        _ session: URLSession,\n        task: URLSessionTask,\n        didReceive challenge: URLAuthenticationChallenge,\n        completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)\n    {\n        onReceiveSessionTaskChallenge.call((session, task, challenge, completionHandler))\n    }\n    \n    open func urlSession(\n        _ session: URLSession,\n        task: URLSessionTask,\n        willPerformHTTPRedirection response: HTTPURLResponse,\n        newRequest request: URLRequest,\n        completionHandler: @escaping (URLRequest?) -> Void)\n    {\n        guard let sessionDataTask = self.task(for: task),\n              let redirectHandler = Array(sessionDataTask.callbacks).last?.options.redirectHandler else\n        {\n            completionHandler(request)\n            return\n        }\n        \n        redirectHandler.handleHTTPRedirection(\n            for: sessionDataTask,\n            response: response,\n            newRequest: request,\n            completionHandler: completionHandler)\n    }\n\n    private func onCompleted(task: URLSessionTask, result: Result<(Data, URLResponse?), KingfisherError>) {\n        guard let sessionTask = self.task(for: task) else {\n            return\n        }\n        remove(sessionTask)\n        sessionTask.onTaskDone.call((result, sessionTask.callbacks))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/SwiftUI/ImageBinder.swift",
    "content": "//\n//  ImageBinder.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2019/06/27.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if canImport(SwiftUI) && canImport(Combine)\nimport Combine\nimport SwiftUI\n\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension KFImage {\n\n    /// Represents a binder for `KFImage`. It takes responsibility as an `ObjectBinding` and performs\n    /// image downloading and progress reporting based on `KingfisherManager`.\n    class ImageBinder: ObservableObject {\n\n        let source: Source?\n        var options = KingfisherParsedOptionsInfo(KingfisherManager.shared.defaultOptions)\n\n        var downloadTask: DownloadTask?\n\n        var loadingOrSucceeded: Bool {\n            return downloadTask != nil || loadedImage != nil\n        }\n\n        let onFailureDelegate = Delegate<KingfisherError, Void>()\n        let onSuccessDelegate = Delegate<RetrieveImageResult, Void>()\n        let onProgressDelegate = Delegate<(Int64, Int64), Void>()\n\n        var isLoaded: Binding<Bool>\n\n        var loaded = false {\n            willSet {\n                objectWillChange.send()\n            }\n        }\n        var loadedImage: KFCrossPlatformImage? = nil {\n            willSet {\n                objectWillChange.send()\n            }\n        }\n\n        @available(*, deprecated, message: \"The `options` version is deprecated And will be removed soon.\")\n        init(source: Source?, options: KingfisherOptionsInfo? = nil, isLoaded: Binding<Bool>) {\n            self.source = source\n            // The refreshing of `KFImage` would happen much more frequently then an `UIImageView`, even as a\n            // \"side-effect\". To prevent unintended flickering, add `.loadDiskFileSynchronously` as a default.\n            self.options = KingfisherParsedOptionsInfo(\n                KingfisherManager.shared.defaultOptions +\n                (options ?? []) +\n                [.loadDiskFileSynchronously]\n            )\n            self.isLoaded = isLoaded\n        }\n\n        init(source: Source?, isLoaded: Binding<Bool>) {\n            self.source = source\n            // The refreshing of `KFImage` would happen much more frequently then an `UIImageView`, even as a\n            // \"side-effect\". To prevent unintended flickering, add `.loadDiskFileSynchronously` as a default.\n            self.options = KingfisherParsedOptionsInfo(\n                KingfisherManager.shared.defaultOptions +\n                [.loadDiskFileSynchronously]\n            )\n            self.isLoaded = isLoaded\n        }\n\n        func start() {\n\n            guard !loadingOrSucceeded else { return }\n\n            guard let source = source else {\n                CallbackQueue.mainCurrentOrAsync.execute {\n                    self.onFailureDelegate.call(KingfisherError.imageSettingError(reason: .emptySource))\n                }\n                return\n            }\n\n            downloadTask = KingfisherManager.shared\n                .retrieveImage(\n                    with: source,\n                    options: options,\n                    progressBlock: { size, total in\n                        self.onProgressDelegate.call((size, total))\n                    },\n                    completionHandler: { [weak self] result in\n\n                        guard let self = self else { return }\n\n                        self.downloadTask = nil\n                        switch result {\n                        case .success(let value):\n\n                            CallbackQueue.mainCurrentOrAsync.execute {\n                                self.loadedImage = value.image\n                                self.isLoaded.wrappedValue = true\n                                let animation = self.fadeTransitionDuration(cacheType: value.cacheType)\n                                    .map { duration in Animation.linear(duration: duration) }\n                                withAnimation(animation) { self.loaded = true }\n                            }\n\n                            CallbackQueue.mainAsync.execute {\n                                self.onSuccessDelegate.call(value)\n                            }\n                        case .failure(let error):\n                            CallbackQueue.mainAsync.execute {\n                                self.onFailureDelegate.call(error)\n                            }\n                        }\n                })\n        }\n\n        /// Cancels the download task if it is in progress.\n        func cancel() {\n            downloadTask?.cancel()\n            downloadTask = nil\n        }\n\n        private func shouldApplyFade(cacheType: CacheType) -> Bool {\n            options.forceTransition || cacheType == .none\n        }\n\n        private func fadeTransitionDuration(cacheType: CacheType) -> TimeInterval? {\n            shouldApplyFade(cacheType: cacheType)\n                ? options.transition.fadeDuration\n                : nil\n        }\n    }\n}\n\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension KFImage.ImageBinder: Hashable {\n    static func == (lhs: KFImage.ImageBinder, rhs: KFImage.ImageBinder) -> Bool {\n        lhs.source == rhs.source && lhs.options.processor.identifier == rhs.options.processor.identifier\n    }\n\n    func hash(into hasher: inout Hasher) {\n        hasher.combine(source)\n        hasher.combine(options.processor.identifier)\n    }\n}\n\nextension ImageTransition {\n    // Only for fade effect in SwiftUI.\n    fileprivate var fadeDuration: TimeInterval? {\n        switch self {\n        case .fade(let duration):\n            return duration\n        default:\n            return nil\n        }\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/SwiftUI/KFImage.swift",
    "content": "//\n//  KFImage.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2019/06/26.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if canImport(SwiftUI) && canImport(Combine)\nimport Combine\nimport SwiftUI\n\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension Image {\n    // Creates an Image with either UIImage or NSImage.\n    init(crossPlatformImage: KFCrossPlatformImage) {\n        #if canImport(UIKit)\n        self.init(uiImage: crossPlatformImage)\n        #elseif canImport(AppKit)\n        self.init(nsImage: crossPlatformImage)\n        #endif\n    }\n}\n\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\npublic struct KFImage: View {\n\n    var context: Context\n\n    /// Creates a Kingfisher compatible image view to load image from the given `Source`.\n    /// - Parameter source: The image `Source` defining where to load the target image.\n    /// - Parameter options: The options should be applied when loading the image.\n    ///                      Some UIKit related options (such as `ImageTransition.flip`) are not supported.\n    /// - Parameter isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///                       state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///                       wrapped value from outside.\n    /// - Deprecated: Some options are not available in SwiftUI yet. Use `KFImage(source:isLoaded:)` to create a\n    ///               `KFImage` and configure the options through modifier instead. See methods of `KFOptionSetter`\n    ///               for more.\n    @available(*, deprecated, message: \"Some options are not available in SwiftUI yet. Use `KFImage(source:isLoaded:)` to create a `KFImage` and configure the options through modifier instead.\")\n    public init(source: Source?, options: KingfisherOptionsInfo? = nil, isLoaded: Binding<Bool> = .constant(false)) {\n        let binder = KFImage.ImageBinder(source: source, options: options, isLoaded: isLoaded)\n        self.init(binder: binder)\n    }\n\n    /// Creates a Kingfisher compatible image view to load image from the given `URL`.\n    /// - Parameter url: The image URL from where to load the target image.\n    /// - Parameter options: The options should be applied when loading the image.\n    ///                      Some UIKit related options (such as `ImageTransition.flip`) are not supported.\n    /// - Parameter isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///                       state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///                       wrapped value from outside.\n    /// - Deprecated: Some options are not available in SwiftUI yet. Use `KFImage(_:isLoaded:)` to create a\n    ///               `KFImage` and configure the options through modifier instead. See methods of `KFOptionSetter`\n    ///               for more.\n    @available(*, deprecated, message: \"Some options are not available in SwiftUI yet. Use `KFImage(_:isLoaded:)` to create a `KFImage` and configure the options through modifier instead.\")\n    init(_ url: URL?, options: KingfisherOptionsInfo? = nil, isLoaded: Binding<Bool> = .constant(false)) {\n        self.init(source: url?.convertToSource(), options: options, isLoaded: isLoaded)\n    }\n\n    /// Creates a Kingfisher compatible image view to load image from the given `Source`.\n    /// - Parameters:\n    ///   - source: The image `Source` defining where to load the target image.\n    ///   - isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///               state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///               wrapped value from outside.\n    public init(source: Source?, isLoaded: Binding<Bool> = .constant(false)) {\n        let binder = ImageBinder(source: source, isLoaded: isLoaded)\n        self.init(binder: binder)\n    }\n\n    /// Creates a Kingfisher compatible image view to load image from the given `URL`.\n    /// - Parameters:\n    ///   - source: The image `Source` defining where to load the target image.\n    ///   - isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///               state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///               wrapped value from outside.\n    public init(_ url: URL?, isLoaded: Binding<Bool> = .constant(false)) {\n        self.init(source: url?.convertToSource(), isLoaded: isLoaded)\n    }\n\n    init(binder: ImageBinder) {\n        self.context = Context(binder: binder)\n    }\n\n    public var body: some View {\n        KFImageRenderer(context)\n            .id(context.binder)\n    }\n\n    /// Starts the loading process of `self` immediately.\n    ///\n    /// By default, a `KFImage` will not load its source until the `onAppear` is called. This is a lazily loading\n    /// behavior and provides better performance. However, when you refresh the view, the lazy loading also causes a\n    /// flickering since the loading does not happen immediately. Call this method if you want to start the load at once\n    /// could help avoiding the flickering, with some performance trade-off.\n    ///\n    /// - Returns: The `Self` value with changes applied.\n    public func loadImmediately(_ start: Bool = true) -> KFImage {\n        if start {\n            context.binder.start()\n        }\n        return self\n    }\n}\n\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension KFImage {\n    struct Context {\n        var binder: ImageBinder\n        var configurations: [(Image) -> Image] = []\n        var cancelOnDisappear: Bool = false\n        var placeholder: AnyView? = nil\n\n        init(binder: ImageBinder) {\n            self.binder = binder\n        }\n    }\n}\n\n/// A Kingfisher compatible SwiftUI `View` to load an image from a `Source`.\n/// Declaring a `KFImage` in a `View`'s body to trigger loading from the given `Source`.\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nstruct KFImageRenderer: View {\n\n    /// An image binder that manages loading and cancelling image related task.\n    @ObservedObject var binder: KFImage.ImageBinder\n\n    // Acts as a placeholder when loading an image.\n    var placeholder: AnyView?\n\n    // Whether the download task should be cancelled when the view disappears.\n    let cancelOnDisappear: Bool\n\n    // Configurations should be performed on the image.\n    let configurations: [(Image) -> Image]\n\n    init(_ context: KFImage.Context) {\n        self.binder = context.binder\n        self.configurations = context.configurations\n        self.placeholder = context.placeholder\n        self.cancelOnDisappear = context.cancelOnDisappear\n    }\n\n    /// Declares the content and behavior of this view.\n    @ViewBuilder\n    var body: some View {\n        if let image = binder.loadedImage {\n            configurations\n                .reduce(imageFromResult(image)) {\n                    current, config in config(current)\n                }\n                .opacity(binder.loaded ? 1.0 : 0.0)\n        } else {\n            Group {\n                if placeholder != nil {\n                    placeholder\n                } else {\n                    Color.clear\n                }\n            }\n            .onAppear { [weak binder = self.binder] in\n                guard let binder = binder else {\n                    return\n                }\n                if !binder.loadingOrSucceeded {\n                    binder.start()\n                }\n            }\n            .onDisappear { [weak binder = self.binder] in\n                guard let binder = binder else {\n                    return\n                }\n                if self.cancelOnDisappear {\n                    binder.cancel()\n                }\n            }\n        }\n    }\n\n    private func imageFromResult(_ resultImage: KFCrossPlatformImage) -> Image {\n        if #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) {\n            return Image(crossPlatformImage: resultImage)\n        } else {\n            #if canImport(UIKit)\n            // The CG image is used to solve #1395\n            // It should be not necessary if SwiftUI.Image can handle resizing correctly when created\n            // by `Image.init(uiImage:)`. (The orientation information should be already contained in\n            // a `UIImage`)\n            // https://github.com/onevcat/Kingfisher/issues/1395\n            //\n            // This issue happens on iOS 13 and was fixed by Apple from iOS 14.\n            if let cgImage = resultImage.cgImage {\n                return Image(decorative: cgImage, scale: resultImage.scale, orientation: resultImage.imageOrientation.toSwiftUI())\n            } else {\n                return Image(crossPlatformImage: resultImage)\n            }\n            #else\n            return Image(crossPlatformImage: resultImage)\n            #endif\n\n        }\n    }\n}\n\n#if canImport(UIKit)\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension UIImage.Orientation {\n    func toSwiftUI() -> Image.Orientation {\n        switch self {\n        case .down: return .down\n        case .up: return .up\n        case .left: return .left\n        case .right: return .right\n        case .upMirrored: return .upMirrored\n        case .downMirrored: return .downMirrored\n        case .leftMirrored: return .leftMirrored\n        case .rightMirrored: return .rightMirrored\n        @unknown default: return .up\n        }\n    }\n}\n#endif\n\n// MARK: - Image compatibility.\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension KFImage {\n\n    /// Configures current image with a `block`. This block will be lazily applied when creating the final `Image`.\n    /// - Parameter block: The block applies to loaded image.\n    /// - Returns: A `KFImage` view that configures internal `Image` with `block`.\n    public func configure(_ block: @escaping (Image) -> Image) -> KFImage {\n        var result = self\n        result.context.configurations.append(block)\n        return result\n    }\n\n    public func resizable(\n        capInsets: EdgeInsets = EdgeInsets(),\n        resizingMode: Image.ResizingMode = .stretch) -> KFImage\n    {\n        configure { $0.resizable(capInsets: capInsets, resizingMode: resizingMode) }\n    }\n\n    public func renderingMode(_ renderingMode: Image.TemplateRenderingMode?) -> KFImage {\n        configure { $0.renderingMode(renderingMode) }\n    }\n\n    public func interpolation(_ interpolation: Image.Interpolation) -> KFImage {\n        configure { $0.interpolation(interpolation) }\n    }\n\n    public func antialiased(_ isAntialiased: Bool) -> KFImage {\n        configure { $0.antialiased(isAntialiased) }\n    }\n}\n\n#if DEBUG\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nstruct KFImage_Previews : PreviewProvider {\n    static var previews: some View {\n        Group {\n            KFImage(source: .network(URL(string: \"https://raw.githubusercontent.com/onevcat/Kingfisher/master/images/logo.png\")!))\n                .onSuccess { r in\n                    print(r)\n                }\n                .resizable()\n                .aspectRatio(contentMode: .fit)\n                .padding()\n        }\n    }\n}\n#endif\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/SwiftUI/KFImageOptions.swift",
    "content": "//\n//  KFImageOptions.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2020/12/20.\n//\n//  Copyright (c) 2020 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if canImport(SwiftUI) && canImport(Combine)\nimport SwiftUI\n\n// MARK: - KFImage creating.\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension KFImage {\n\n    /// Creates a `KFImage` for a given `Source`.\n    /// - Parameters:\n    ///   - source: The `Source` object defines data information from network or a data provider.\n    ///   - isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///               state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///               wrapped value from outside.\n    /// - Returns: A `KFImage` for future configuration or embedding to a `SwiftUI.View`.\n    public static func source(\n        _ source: Source?, isLoaded: Binding<Bool> = .constant(false)\n    ) -> KFImage\n    {\n        KFImage(source: source, isLoaded: isLoaded)\n    }\n\n    /// Creates a `KFImage` for a given `Resource`.\n    /// - Parameters:\n    ///   - source: The `Resource` object defines data information like key or URL.\n    ///   - isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///               state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///               wrapped value from outside.\n    /// - Returns: A `KFImage` for future configuration or embedding to a `SwiftUI.View`.\n    public static func resource(\n        _ resource: Resource?, isLoaded: Binding<Bool> = .constant(false)\n    ) -> KFImage\n    {\n        source(resource?.convertToSource(), isLoaded: isLoaded)\n    }\n\n    /// Creates a `KFImage` for a given `URL`.\n    /// - Parameters:\n    ///   - url: The URL where the image should be downloaded.\n    ///   - cacheKey: The key used to store the downloaded image in cache.\n    ///               If `nil`, the `absoluteString` of `url` is used as the cache key.\n    ///   - isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///               state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///               wrapped value from outside.\n    /// - Returns: A `KFImage` for future configuration or embedding to a `SwiftUI.View`.\n    public static func url(\n        _ url: URL?, cacheKey: String? = nil, isLoaded: Binding<Bool> = .constant(false)\n    ) -> KFImage\n    {\n        source(url?.convertToSource(overrideCacheKey: cacheKey), isLoaded: isLoaded)\n    }\n\n    /// Creates a `KFImage` for a given `ImageDataProvider`.\n    /// - Parameters:\n    ///   - provider: The `ImageDataProvider` object contains information about the data.\n    ///   - isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///               state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///               wrapped value from outside.\n    /// - Returns: A `KFImage` for future configuration or embedding to a `SwiftUI.View`.\n    public static func dataProvider(\n        _ provider: ImageDataProvider?, isLoaded: Binding<Bool> = .constant(false)\n    ) -> KFImage\n    {\n        source(provider?.convertToSource(), isLoaded: isLoaded)\n    }\n\n    /// Creates a builder for some given raw data and a cache key.\n    /// - Parameters:\n    ///   - data: The data object from which the image should be created.\n    ///   - cacheKey: The key used to store the downloaded image in cache.\n    ///   - isLoaded: Whether the image is loaded or not. This provides a way to inspect the internal loading\n    ///               state. `true` if the image is loaded successfully. Otherwise, `false`. Do not set the\n    ///               wrapped value from outside.\n    /// - Returns: A `KFImage` for future configuration or embedding to a `SwiftUI.View`.\n    public static func data(\n        _ data: Data?, cacheKey: String, isLoaded: Binding<Bool> = .constant(false)\n    ) -> KFImage\n    {\n        if let data = data {\n            return dataProvider(RawImageDataProvider(data: data, cacheKey: cacheKey), isLoaded: isLoaded)\n        } else {\n            return dataProvider(nil, isLoaded: isLoaded)\n        }\n    }\n}\n\n@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)\nextension KFImage {\n    /// Sets a placeholder `View` which shows when loading the image.\n    /// - Parameter content: A view that describes the placeholder.\n    /// - Returns: A `KFImage` view that contains `content` as its placeholder.\n    public func placeholder<Content: View>(@ViewBuilder _ content: () -> Content) -> KFImage {\n        let v = content()\n        var result = self\n        result.context.placeholder = AnyView(v)\n        return result\n    }\n\n    /// Sets cancelling the download task bound to `self` when the view disappearing.\n    /// - Parameter flag: Whether cancel the task or not.\n    /// - Returns: A `KFImage` view that cancels downloading task when disappears.\n    public func cancelOnDisappear(_ flag: Bool) -> KFImage {\n        var result = self\n        result.context.cancelOnDisappear = flag\n        return result\n    }\n\n    /// Sets a fade transition for the image task.\n    /// - Parameter duration: The duration of the fade transition.\n    /// - Returns: A `KFImage` with changes applied.\n    ///\n    /// Kingfisher will use the fade transition to animate the image in if it is downloaded from web.\n    /// The transition will not happen when the\n    /// image is retrieved from either memory or disk cache by default. If you need to do the transition even when\n    /// the image being retrieved from cache, also call `forceRefresh()` on the returned `KFImage`.\n    public func fade(duration: TimeInterval) -> KFImage {\n        context.binder.options.transition = .fade(duration)\n        return self\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/Box.swift",
    "content": "//\n//  Box.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/3/17.\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nclass Box<T> {\n    var value: T\n    \n    init(_ value: T) {\n        self.value = value\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/CallbackQueue.swift",
    "content": "//\n//  CallbackQueue.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/10/15.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n/// Represents callback queue behaviors when an calling of closure be dispatched.\n///\n/// - asyncMain: Dispatch the calling to `DispatchQueue.main` with an `async` behavior.\n/// - currentMainOrAsync: Dispatch the calling to `DispatchQueue.main` with an `async` behavior if current queue is not\n///                       `.main`. Otherwise, call the closure immediately in current main queue.\n/// - untouch: Do not change the calling queue for closure.\n/// - dispatch: Dispatches to a specified `DispatchQueue`.\npublic enum CallbackQueue {\n    /// Dispatch the calling to `DispatchQueue.main` with an `async` behavior.\n    case mainAsync\n    /// Dispatch the calling to `DispatchQueue.main` with an `async` behavior if current queue is not\n    /// `.main`. Otherwise, call the closure immediately in current main queue.\n    case mainCurrentOrAsync\n    /// Do not change the calling queue for closure.\n    case untouch\n    /// Dispatches to a specified `DispatchQueue`.\n    case dispatch(DispatchQueue)\n    \n    public func execute(_ block: @escaping () -> Void) {\n        switch self {\n        case .mainAsync:\n            DispatchQueue.main.async { block() }\n        case .mainCurrentOrAsync:\n            DispatchQueue.main.safeAsync { block() }\n        case .untouch:\n            block()\n        case .dispatch(let queue):\n            queue.async { block() }\n        }\n    }\n\n    var queue: DispatchQueue {\n        switch self {\n        case .mainAsync: return .main\n        case .mainCurrentOrAsync: return .main\n        case .untouch: return OperationQueue.current?.underlyingQueue ?? .main\n        case .dispatch(let queue): return queue\n        }\n    }\n}\n\nextension DispatchQueue {\n    // This method will dispatch the `block` to self.\n    // If `self` is the main queue, and current thread is main thread, the block\n    // will be invoked immediately instead of being dispatched.\n    func safeAsync(_ block: @escaping ()->()) {\n        if self === DispatchQueue.main && Thread.isMainThread {\n            block()\n        } else {\n            async { block() }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/Delegate.swift",
    "content": "//\n//  Delegate.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/10/10.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n/// A class that keeps a weakly reference for `self` when implementing `onXXX` behaviors.\n/// Instead of remembering to keep `self` as weak in a stored closure:\n///\n/// ```swift\n/// // MyClass.swift\n/// var onDone: (() -> Void)?\n/// func done() {\n///     onDone?()\n/// }\n///\n/// // ViewController.swift\n/// var obj: MyClass?\n///\n/// func doSomething() {\n///     obj = MyClass()\n///     obj!.onDone = { [weak self] in\n///         self?.reportDone()\n///     }\n/// }\n/// ```\n///\n/// You can create a `Delegate` and observe on `self`. Now, there is no retain cycle inside:\n///\n/// ```swift\n/// // MyClass.swift\n/// let onDone = Delegate<(), Void>()\n/// func done() {\n///     onDone.call()\n/// }\n///\n/// // ViewController.swift\n/// var obj: MyClass?\n///\n/// func doSomething() {\n///     obj = MyClass()\n///     obj!.onDone.delegate(on: self) { (self, _)\n///         // `self` here is shadowed and does not keep a strong ref.\n///         // So you can release both `MyClass` instance and `ViewController` instance.\n///         self.reportDone()\n///     }\n/// }\n/// ```\n///\npublic class Delegate<Input, Output> {\n    public init() {}\n\n    private var block: ((Input) -> Output?)?\n    public func delegate<T: AnyObject>(on target: T, block: ((T, Input) -> Output)?) {\n        self.block = { [weak target] input in\n            guard let target = target else { return nil }\n            return block?(target, input)\n        }\n    }\n\n    public func call(_ input: Input) -> Output? {\n        return block?(input)\n    }\n\n    public func callAsFunction(_ input: Input) -> Output? {\n        return call(input)\n    }\n}\n\nextension Delegate where Input == Void {\n    public func call() -> Output? {\n        return call(())\n    }\n\n    public func callAsFunction() -> Output? {\n        return call()\n    }\n}\n\nextension Delegate where Input == Void, Output: OptionalProtocol {\n    public func call() -> Output {\n        return call(())\n    }\n\n    public func callAsFunction() -> Output {\n        return call()\n    }\n}\n\nextension Delegate where Output: OptionalProtocol {\n    public func call(_ input: Input) -> Output {\n        if let result = block?(input) {\n            return result\n        } else {\n            return Output._createNil\n        }\n    }\n\n    public func callAsFunction(_ input: Input) -> Output {\n        return call(input)\n    }\n}\n\npublic protocol OptionalProtocol {\n    static var _createNil: Self { get }\n}\nextension Optional : OptionalProtocol {\n    public static var _createNil: Optional<Wrapped> {\n         return nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/ExtensionHelpers.swift",
    "content": "//\n//  ExtensionHelpers.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/09/28.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nextension CGFloat {\n    var isEven: Bool {\n        return truncatingRemainder(dividingBy: 2.0) == 0\n    }\n}\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\nextension NSBezierPath {\n    convenience init(roundedRect rect: NSRect, topLeftRadius: CGFloat, topRightRadius: CGFloat,\n                     bottomLeftRadius: CGFloat, bottomRightRadius: CGFloat)\n    {\n        self.init()\n        \n        let maxCorner = min(rect.width, rect.height) / 2\n        \n        let radiusTopLeft = min(maxCorner, max(0, topLeftRadius))\n        let radiusTopRight = min(maxCorner, max(0, topRightRadius))\n        let radiusBottomLeft = min(maxCorner, max(0, bottomLeftRadius))\n        let radiusBottomRight = min(maxCorner, max(0, bottomRightRadius))\n        \n        guard !rect.isEmpty else {\n            return\n        }\n        \n        let topLeft = NSPoint(x: rect.minX, y: rect.maxY)\n        let topRight = NSPoint(x: rect.maxX, y: rect.maxY)\n        let bottomRight = NSPoint(x: rect.maxX, y: rect.minY)\n        \n        move(to: NSPoint(x: rect.midX, y: rect.maxY))\n        appendArc(from: topLeft, to: rect.origin, radius: radiusTopLeft)\n        appendArc(from: rect.origin, to: bottomRight, radius: radiusBottomLeft)\n        appendArc(from: bottomRight, to: topRight, radius: radiusBottomRight)\n        appendArc(from: topRight, to: topLeft, radius: radiusTopRight)\n        close()\n    }\n    \n    convenience init(roundedRect rect: NSRect, byRoundingCorners corners: RectCorner, radius: CGFloat) {\n        let radiusTopLeft = corners.contains(.topLeft) ? radius : 0\n        let radiusTopRight = corners.contains(.topRight) ? radius : 0\n        let radiusBottomLeft = corners.contains(.bottomLeft) ? radius : 0\n        let radiusBottomRight = corners.contains(.bottomRight) ? radius : 0\n        \n        self.init(roundedRect: rect, topLeftRadius: radiusTopLeft, topRightRadius: radiusTopRight,\n                  bottomLeftRadius: radiusBottomLeft, bottomRightRadius: radiusBottomRight)\n    }\n}\n\nextension KFCrossPlatformImage {\n    // macOS does not support scale. This is just for code compatibility across platforms.\n    convenience init?(data: Data, scale: CGFloat) {\n        self.init(data: data)\n    }\n}\n#endif\n\n#if canImport(UIKit)\nimport UIKit\nextension RectCorner {\n    var uiRectCorner: UIRectCorner {\n        \n        var result: UIRectCorner = []\n        \n        if contains(.topLeft) { result.insert(.topLeft) }\n        if contains(.topRight) { result.insert(.topRight) }\n        if contains(.bottomLeft) { result.insert(.bottomLeft) }\n        if contains(.bottomRight) { result.insert(.bottomRight) }\n        \n        return result\n    }\n}\n#endif\n\nextension Date {\n    var isPast: Bool {\n        return isPast(referenceDate: Date())\n    }\n\n    var isFuture: Bool {\n        return !isPast\n    }\n\n    func isPast(referenceDate: Date) -> Bool {\n        return timeIntervalSince(referenceDate) <= 0\n    }\n\n    func isFuture(referenceDate: Date) -> Bool {\n        return !isPast(referenceDate: referenceDate)\n    }\n\n    // `Date` in memory is a wrap for `TimeInterval`. But in file attribute it can only accept `Int` number.\n    // By default the system will `round` it. But it is not friendly for testing purpose.\n    // So we always `ceil` the value when used for file attributes.\n    var fileAttributeDate: Date {\n        return Date(timeIntervalSince1970: ceil(timeIntervalSince1970))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/Result.swift",
    "content": "//\n//  Result.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/09/22.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n// These helper methods are not public since we do not want them to be exposed or cause any conflicting.\n// However, they are just wrapper of `ResultUtil` static methods.\nextension Result where Failure: Error {\n\n    /// Evaluates the given transform closures to create a single output value.\n    ///\n    /// - Parameters:\n    ///   - onSuccess: A closure that transforms the success value.\n    ///   - onFailure: A closure that transforms the error value.\n    /// - Returns: A single `Output` value.\n    func match<Output>(\n        onSuccess: (Success) -> Output,\n        onFailure: (Failure) -> Output) -> Output\n    {\n        switch self {\n        case let .success(value):\n            return onSuccess(value)\n        case let .failure(error):\n            return onFailure(error)\n        }\n    }\n\n    func matchSuccess<Output>(with folder: (Success?) -> Output) -> Output {\n        return match(\n            onSuccess: { value in return folder(value) },\n            onFailure: { _ in return folder(nil) }\n        )\n    }\n\n    func matchFailure<Output>(with folder: (Error?) -> Output) -> Output {\n        return match(\n            onSuccess: { _ in return folder(nil) },\n            onFailure: { error in return folder(error) }\n        )\n    }\n\n    func match<Output>(with folder: (Success?, Error?) -> Output) -> Output {\n        return match(\n            onSuccess: { return folder($0, nil) },\n            onFailure: { return folder(nil, $0) }\n        )\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/Runtime.swift",
    "content": "//\n//  Runtime.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 2018/10/12.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\nfunc getAssociatedObject<T>(_ object: Any, _ key: UnsafeRawPointer) -> T? {\n    return objc_getAssociatedObject(object, key) as? T\n}\n\nfunc setRetainedAssociatedObject<T>(_ object: Any, _ key: UnsafeRawPointer, _ value: T) {\n    objc_setAssociatedObject(object, key, value, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/SizeExtensions.swift",
    "content": "//\n//  SizeExtensions.swift\n//  Kingfisher\n//\n//  Created by onevcat on 2018/09/28.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport CoreGraphics\n\nextension CGSize: KingfisherCompatibleValue {}\nextension KingfisherWrapper where Base == CGSize {\n    \n    /// Returns a size by resizing the `base` size to a target size under a given content mode.\n    ///\n    /// - Parameters:\n    ///   - size: The target size to resize to.\n    ///   - contentMode: Content mode of the target size should be when resizing.\n    /// - Returns: The resized size under the given `ContentMode`.\n    public func resize(to size: CGSize, for contentMode: ContentMode) -> CGSize {\n        switch contentMode {\n        case .aspectFit:\n            return constrained(size)\n        case .aspectFill:\n            return filling(size)\n        case .none:\n            return size\n        }\n    }\n    \n    /// Returns a size by resizing the `base` size by making it aspect fitting the given `size`.\n    ///\n    /// - Parameter size: The size in which the `base` should fit in.\n    /// - Returns: The size fitted in by the input `size`, while keeps `base` aspect.\n    public func constrained(_ size: CGSize) -> CGSize {\n        let aspectWidth = round(aspectRatio * size.height)\n        let aspectHeight = round(size.width / aspectRatio)\n        \n        return aspectWidth > size.width ?\n            CGSize(width: size.width, height: aspectHeight) :\n            CGSize(width: aspectWidth, height: size.height)\n    }\n    \n    /// Returns a size by resizing the `base` size by making it aspect filling the given `size`.\n    ///\n    /// - Parameter size: The size in which the `base` should fill.\n    /// - Returns: The size be filled by the input `size`, while keeps `base` aspect.\n    public func filling(_ size: CGSize) -> CGSize {\n        let aspectWidth = round(aspectRatio * size.height)\n        let aspectHeight = round(size.width / aspectRatio)\n        \n        return aspectWidth < size.width ?\n            CGSize(width: size.width, height: aspectHeight) :\n            CGSize(width: aspectWidth, height: size.height)\n    }\n    \n    /// Returns a `CGRect` for which the `base` size is constrained to an input `size` at a given `anchor` point.\n    ///\n    /// - Parameters:\n    ///   - size: The size in which the `base` should be constrained to.\n    ///   - anchor: An anchor point in which the size constraint should happen.\n    /// - Returns: The result `CGRect` for the constraint operation.\n    public func constrainedRect(for size: CGSize, anchor: CGPoint) -> CGRect {\n        \n        let unifiedAnchor = CGPoint(x: anchor.x.clamped(to: 0.0...1.0),\n                                    y: anchor.y.clamped(to: 0.0...1.0))\n        \n        let x = unifiedAnchor.x * base.width - unifiedAnchor.x * size.width\n        let y = unifiedAnchor.y * base.height - unifiedAnchor.y * size.height\n        let r = CGRect(x: x, y: y, width: size.width, height: size.height)\n        \n        let ori = CGRect(origin: .zero, size: base)\n        return ori.intersection(r)\n    }\n    \n    private var aspectRatio: CGFloat {\n        return base.height == 0.0 ? 1.0 : base.width / base.height\n    }\n}\n\nextension CGRect {\n    func scaled(_ scale: CGFloat) -> CGRect {\n        return CGRect(x: origin.x * scale, y: origin.y * scale,\n                      width: size.width * scale, height: size.height * scale)\n    }\n}\n\nextension Comparable {\n    func clamped(to limits: ClosedRange<Self>) -> Self {\n        return min(max(self, limits.lowerBound), limits.upperBound)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Utility/String+MD5.swift",
    "content": "//\n//  String+MD5.swift\n//  Kingfisher\n//\n//  Created by Wei Wang on 18/09/25.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\nimport CommonCrypto\n\nextension String: KingfisherCompatibleValue { }\nextension KingfisherWrapper where Base == String {\n    var md5: String {\n        guard let data = base.data(using: .utf8) else {\n            return base\n        }\n\n        let message = data.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in\n            return [UInt8](bytes)\n        }\n\n        let MD5Calculator = MD5(message)\n        let MD5Data = MD5Calculator.calculate()\n\n        var MD5String = String()\n        for c in MD5Data {\n            MD5String += String(format: \"%02x\", c)\n        }\n        return MD5String\n    }\n\n    var ext: String? {\n        var ext = \"\"\n        if let index  = base.lastIndex(of: \".\") {\n            let extRange = base.index(index, offsetBy: 1)..<base.endIndex\n            ext = String(base[extRange])\n        }\n        guard let firstSeg = ext.split(separator: \"@\").first else {\n            return nil\n        }\n        return firstSeg.count > 0 ? String(firstSeg) : nil\n    }\n}\n\n// array of bytes, little-endian representation\nfunc arrayOfBytes<T>(_ value: T, length: Int? = nil) -> [UInt8] {\n    let totalBytes = length ?? (MemoryLayout<T>.size * 8)\n\n    let valuePointer = UnsafeMutablePointer<T>.allocate(capacity: 1)\n    valuePointer.pointee = value\n\n    let bytes = valuePointer.withMemoryRebound(to: UInt8.self, capacity: totalBytes) { (bytesPointer) -> [UInt8] in\n        var bytes = [UInt8](repeating: 0, count: totalBytes)\n        for j in 0..<min(MemoryLayout<T>.size, totalBytes) {\n            bytes[totalBytes - 1 - j] = (bytesPointer + j).pointee\n        }\n        return bytes\n    }\n    \n    valuePointer.deinitialize(count: 1)\n    valuePointer.deallocate()\n\n    return bytes\n}\n\nextension Int {\n    // Array of bytes with optional padding (little-endian)\n    func bytes(_ totalBytes: Int = MemoryLayout<Int>.size) -> [UInt8] {\n        return arrayOfBytes(self, length: totalBytes)\n    }\n\n}\n\nextension NSMutableData {\n\n    // Convenient way to append bytes\n    func appendBytes(_ arrayOfBytes: [UInt8]) {\n        append(arrayOfBytes, length: arrayOfBytes.count)\n    }\n\n}\n\nprotocol HashProtocol {\n    var message: [UInt8] { get }\n    // Common part for hash calculation. Prepare header data.\n    func prepare(_ len: Int) -> [UInt8]\n}\n\nextension HashProtocol {\n\n    func prepare(_ len: Int) -> [UInt8] {\n        var tmpMessage = message\n\n        // Step 1. Append Padding Bits\n        tmpMessage.append(0x80) // append one bit (UInt8 with one bit) to message\n\n        // append \"0\" bit until message length in bits ≡ 448 (mod 512)\n        var msgLength = tmpMessage.count\n        var counter = 0\n\n        while msgLength % len != (len - 8) {\n            counter += 1\n            msgLength += 1\n        }\n\n        tmpMessage += [UInt8](repeating: 0, count: counter)\n        return tmpMessage\n    }\n}\n\nfunc toUInt32Array(_ slice: ArraySlice<UInt8>) -> [UInt32] {\n    var result = [UInt32]()\n    result.reserveCapacity(16)\n\n    for idx in stride(from: slice.startIndex, to: slice.endIndex, by: MemoryLayout<UInt32>.size) {\n        let d0 = UInt32(slice[idx.advanced(by: 3)]) << 24\n        let d1 = UInt32(slice[idx.advanced(by: 2)]) << 16\n        let d2 = UInt32(slice[idx.advanced(by: 1)]) << 8\n        let d3 = UInt32(slice[idx])\n        let val: UInt32 = d0 | d1 | d2 | d3\n\n        result.append(val)\n    }\n    return result\n}\n\nstruct BytesIterator: IteratorProtocol {\n\n    let chunkSize: Int\n    let data: [UInt8]\n\n    init(chunkSize: Int, data: [UInt8]) {\n        self.chunkSize = chunkSize\n        self.data = data\n    }\n\n    var offset = 0\n\n    mutating func next() -> ArraySlice<UInt8>? {\n        let end = min(chunkSize, data.count - offset)\n        let result = data[offset..<offset + end]\n        offset += result.count\n        return result.count > 0 ? result : nil\n    }\n}\n\nstruct BytesSequence: Sequence {\n    let chunkSize: Int\n    let data: [UInt8]\n\n    func makeIterator() -> BytesIterator {\n        return BytesIterator(chunkSize: chunkSize, data: data)\n    }\n}\n\nfunc rotateLeft(_ value: UInt32, bits: UInt32) -> UInt32 {\n    return ((value << bits) & 0xFFFFFFFF) | (value >> (32 - bits))\n}\n\nclass MD5: HashProtocol {\n\n    static let size = 16 // 128 / 8\n    let message: [UInt8]\n\n    init (_ message: [UInt8]) {\n        self.message = message\n    }\n\n    // specifies the per-round shift amounts\n    private let shifts: [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,\n                                    5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,\n                                    4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,\n                                    6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]\n\n    // binary integer part of the sines of integers (Radians)\n    private let sines: [UInt32] = [0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,\n                                   0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,\n                                   0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,\n                                   0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,\n                                   0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,\n                                   0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,\n                                   0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,\n                                   0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,\n                                   0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,\n                                   0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,\n                                   0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x4881d05,\n                                   0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,\n                                   0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,\n                                   0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,\n                                   0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,\n                                   0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391]\n\n    private let hashes: [UInt32] = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]\n\n    func calculate() -> [UInt8] {\n        var tmpMessage = prepare(64)\n        tmpMessage.reserveCapacity(tmpMessage.count + 4)\n\n        // hash values\n        var hh = hashes\n\n        // Step 2. Append Length a 64-bit representation of lengthInBits\n        let lengthInBits = (message.count * 8)\n        let lengthBytes = lengthInBits.bytes(64 / 8)\n        tmpMessage += lengthBytes.reversed()\n\n        // Process the message in successive 512-bit chunks:\n        let chunkSizeBytes = 512 / 8 // 64\n\n        for chunk in BytesSequence(chunkSize: chunkSizeBytes, data: tmpMessage) {\n            // break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15\n            let M = toUInt32Array(chunk)\n            assert(M.count == 16, \"Invalid array\")\n\n            // Initialize hash value for this chunk:\n            var A: UInt32 = hh[0]\n            var B: UInt32 = hh[1]\n            var C: UInt32 = hh[2]\n            var D: UInt32 = hh[3]\n\n            var dTemp: UInt32 = 0\n\n            // Main loop\n            for j in 0 ..< sines.count {\n                var g = 0\n                var F: UInt32 = 0\n\n                switch j {\n                case 0...15:\n                    F = (B & C) | ((~B) & D)\n                    g = j\n                    break\n                case 16...31:\n                    F = (D & B) | (~D & C)\n                    g = (5 * j + 1) % 16\n                    break\n                case 32...47:\n                    F = B ^ C ^ D\n                    g = (3 * j + 5) % 16\n                    break\n                case 48...63:\n                    F = C ^ (B | (~D))\n                    g = (7 * j) % 16\n                    break\n                default:\n                    break\n                }\n                dTemp = D\n                D = C\n                C = B\n                B = B &+ rotateLeft((A &+ F &+ sines[j] &+ M[g]), bits: shifts[j])\n                A = dTemp\n            }\n\n            hh[0] = hh[0] &+ A\n            hh[1] = hh[1] &+ B\n            hh[2] = hh[2] &+ C\n            hh[3] = hh[3] &+ D\n        }\n        var result = [UInt8]()\n        result.reserveCapacity(hh.count / 4)\n\n        hh.forEach {\n            let itemLE = $0.littleEndian\n            let r1 = UInt8(itemLE & 0xff)\n            let r2 = UInt8((itemLE >> 8) & 0xff)\n            let r3 = UInt8((itemLE >> 16) & 0xff)\n            let r4 = UInt8((itemLE >> 24) & 0xff)\n            result += [r1, r2, r3, r4]\n        }\n        return result\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Views/AnimatedImageView.swift",
    "content": "//\n//  AnimatableImageView.swift\n//  Kingfisher\n//\n//  Created by bl4ckra1sond3tre on 4/22/16.\n//\n//  The AnimatableImageView, AnimatedFrame and Animator is a modified version of \n//  some classes from kaishin's Gifu project (https://github.com/kaishin/Gifu)\n//\n//  The MIT License (MIT)\n//\n//  Copyright (c) 2019 Reda Lemeden.\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy of\n//  this software and associated documentation files (the \"Software\"), to deal in\n//  the Software without restriction, including without limitation the rights to\n//  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n//  the Software, and to permit persons to whom the Software is furnished to do so,\n//  subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in all\n//  copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n//  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n//  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n//  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n//  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n//  The name and characters used in the demo of this software are property of their\n//  respective owners.\n\n#if !os(watchOS)\n#if canImport(UIKit)\nimport UIKit\nimport ImageIO\n\n/// Protocol of `AnimatedImageView`.\npublic protocol AnimatedImageViewDelegate: AnyObject {\n\n    /// Called after the animatedImageView has finished each animation loop.\n    ///\n    /// - Parameters:\n    ///   - imageView: The `AnimatedImageView` that is being animated.\n    ///   - count: The looped count.\n    func animatedImageView(_ imageView: AnimatedImageView, didPlayAnimationLoops count: UInt)\n\n    /// Called after the `AnimatedImageView` has reached the max repeat count.\n    ///\n    /// - Parameter imageView: The `AnimatedImageView` that is being animated.\n    func animatedImageViewDidFinishAnimating(_ imageView: AnimatedImageView)\n}\n\nextension AnimatedImageViewDelegate {\n    public func animatedImageView(_ imageView: AnimatedImageView, didPlayAnimationLoops count: UInt) {}\n    public func animatedImageViewDidFinishAnimating(_ imageView: AnimatedImageView) {}\n}\n\nlet KFRunLoopModeCommon = RunLoop.Mode.common\n\n/// Represents a subclass of `UIImageView` for displaying animated image.\n/// Different from showing animated image in a normal `UIImageView` (which load all frames at one time),\n/// `AnimatedImageView` only tries to load several frames (defined by `framePreloadCount`) to reduce memory usage.\n/// It provides a tradeoff between memory usage and CPU time. If you have a memory issue when using a normal image\n/// view to load GIF data, you could give this class a try.\n///\n/// Kingfisher supports setting GIF animated data to either `UIImageView` and `AnimatedImageView` out of box. So\n/// it would be fairly easy to switch between them.\nopen class AnimatedImageView: UIImageView {\n    \n    /// Proxy object for preventing a reference cycle between the `CADDisplayLink` and `AnimatedImageView`.\n    class TargetProxy {\n        private weak var target: AnimatedImageView?\n        \n        init(target: AnimatedImageView) {\n            self.target = target\n        }\n        \n        @objc func onScreenUpdate() {\n            target?.updateFrameIfNeeded()\n        }\n    }\n\n    /// Enumeration that specifies repeat count of GIF\n    public enum RepeatCount: Equatable {\n        case once\n        case finite(count: UInt)\n        case infinite\n\n        public static func ==(lhs: RepeatCount, rhs: RepeatCount) -> Bool {\n            switch (lhs, rhs) {\n            case let (.finite(l), .finite(r)):\n                return l == r\n            case (.once, .once),\n                 (.infinite, .infinite):\n                return true\n            case (.once, .finite(let count)),\n                 (.finite(let count), .once):\n                return count == 1\n            case (.once, _),\n                 (.infinite, _),\n                 (.finite, _):\n                return false\n            }\n        }\n    }\n    \n    // MARK: - Public property\n    /// Whether automatically play the animation when the view become visible. Default is `true`.\n    public var autoPlayAnimatedImage = true\n    \n    /// The count of the frames should be preloaded before shown.\n    public var framePreloadCount = 10\n    \n    /// Specifies whether the GIF frames should be pre-scaled to the image view's size or not.\n    /// If the downloaded image is larger than the image view's size, it will help to reduce some memory use.\n    /// Default is `true`.\n    public var needsPrescaling = true\n\n    /// Decode the GIF frames in background thread before using. It will decode frames data and do a off-screen\n    /// rendering to extract pixel information in background. This can reduce the main thread CPU usage.\n    public var backgroundDecode = true\n\n    /// The animation timer's run loop mode. Default is `RunLoop.Mode.common`.\n    /// Set this property to `RunLoop.Mode.default` will make the animation pause during UIScrollView scrolling.\n    public var runLoopMode = KFRunLoopModeCommon {\n        willSet {\n            guard runLoopMode != newValue else { return }\n            stopAnimating()\n            displayLink.remove(from: .main, forMode: runLoopMode)\n            displayLink.add(to: .main, forMode: newValue)\n            startAnimating()\n        }\n    }\n    \n    /// The repeat count. The animated image will keep animate until it the loop count reaches this value.\n    /// Setting this value to another one will reset current animation.\n    ///\n    /// Default is `.infinite`, which means the animation will last forever.\n    public var repeatCount = RepeatCount.infinite {\n        didSet {\n            if oldValue != repeatCount {\n                reset()\n                setNeedsDisplay()\n                layer.setNeedsDisplay()\n            }\n        }\n    }\n\n    /// Delegate of this `AnimatedImageView` object. See `AnimatedImageViewDelegate` protocol for more.\n    public weak var delegate: AnimatedImageViewDelegate?\n\n    /// The `Animator` instance that holds the frames of a specific image in memory.\n    public private(set) var animator: Animator?\n\n    // MARK: - Private property\n    // Dispatch queue used for preloading images.\n    private lazy var preloadQueue: DispatchQueue = {\n        return DispatchQueue(label: \"com.onevcat.Kingfisher.Animator.preloadQueue\")\n    }()\n    \n    // A flag to avoid invalidating the displayLink on deinit if it was never created, because displayLink is so lazy.\n    private var isDisplayLinkInitialized: Bool = false\n    \n    // A display link that keeps calling the `updateFrame` method on every screen refresh.\n    private lazy var displayLink: CADisplayLink = {\n        isDisplayLinkInitialized = true\n        let displayLink = CADisplayLink(target: TargetProxy(target: self), selector: #selector(TargetProxy.onScreenUpdate))\n        displayLink.add(to: .main, forMode: runLoopMode)\n        displayLink.isPaused = true\n        return displayLink\n    }()\n    \n    // MARK: - Override\n    override open var image: KFCrossPlatformImage? {\n        didSet {\n            if image != oldValue {\n                reset()\n            }\n            setNeedsDisplay()\n            layer.setNeedsDisplay()\n        }\n    }\n    \n    open override var isHighlighted: Bool {\n        get {\n            super.isHighlighted\n        }\n        set {\n            // Highlighted image is unsupported for animated images.\n            // See https://github.com/onevcat/Kingfisher/issues/1679\n            if displayLink.isPaused {\n                super.isHighlighted = newValue\n            }\n        }\n    }\n    \n    deinit {\n        if isDisplayLinkInitialized {\n            displayLink.invalidate()\n        }\n    }\n    \n    override open var isAnimating: Bool {\n        if isDisplayLinkInitialized {\n            return !displayLink.isPaused\n        } else {\n            return super.isAnimating\n        }\n    }\n    \n    /// Starts the animation.\n    override open func startAnimating() {\n        guard !isAnimating else { return }\n        guard let animator = animator else { return }\n        guard !animator.isReachMaxRepeatCount else { return }\n\n        displayLink.isPaused = false\n    }\n    \n    /// Stops the animation.\n    override open func stopAnimating() {\n        super.stopAnimating()\n        if isDisplayLinkInitialized {\n            displayLink.isPaused = true\n        }\n    }\n    \n    override open func display(_ layer: CALayer) {\n        if let currentFrame = animator?.currentFrameImage {\n            layer.contents = currentFrame.cgImage\n        } else {\n            layer.contents = image?.cgImage\n        }\n    }\n    \n    override open func didMoveToWindow() {\n        super.didMoveToWindow()\n        didMove()\n    }\n    \n    override open func didMoveToSuperview() {\n        super.didMoveToSuperview()\n        didMove()\n    }\n\n    // This is for back compatibility that using regular `UIImageView` to show animated image.\n    override func shouldPreloadAllAnimation() -> Bool {\n        return false\n    }\n\n    // Reset the animator.\n    private func reset() {\n        animator = nil\n        if let image = image, let imageSource = image.kf.imageSource {\n            let targetSize = bounds.scaled(UIScreen.main.scale).size\n            let animator = Animator(\n                imageSource: imageSource,\n                contentMode: contentMode,\n                size: targetSize,\n                imageSize: image.kf.size,\n                imageScale: image.kf.scale,\n                framePreloadCount: framePreloadCount,\n                repeatCount: repeatCount,\n                preloadQueue: preloadQueue)\n            animator.delegate = self\n            animator.needsPrescaling = needsPrescaling\n            animator.backgroundDecode = backgroundDecode\n            animator.prepareFramesAsynchronously()\n            self.animator = animator\n        }\n        didMove()\n    }\n    \n    private func didMove() {\n        if autoPlayAnimatedImage && animator != nil {\n            if let _ = superview, let _ = window {\n                startAnimating()\n            } else {\n                stopAnimating()\n            }\n        }\n    }\n    \n    /// Update the current frame with the displayLink duration.\n    private func updateFrameIfNeeded() {\n        guard let animator = animator else {\n            return\n        }\n\n        guard !animator.isFinished else {\n            stopAnimating()\n            delegate?.animatedImageViewDidFinishAnimating(self)\n            return\n        }\n\n        let duration: CFTimeInterval\n\n        // CA based display link is opt-out from ProMotion by default.\n        // So the duration and its FPS might not match. \n        // See [#718](https://github.com/onevcat/Kingfisher/issues/718)\n        // By setting CADisableMinimumFrameDuration to YES in Info.plist may\n        // cause the preferredFramesPerSecond being 0\n        let preferredFramesPerSecond = displayLink.preferredFramesPerSecond\n        if preferredFramesPerSecond == 0 {\n            duration = displayLink.duration\n        } else {\n            // Some devices (like iPad Pro 10.5) will have a different FPS.\n            duration = 1.0 / TimeInterval(preferredFramesPerSecond)\n        }\n\n        animator.shouldChangeFrame(with: duration) { [weak self] hasNewFrame in\n            if hasNewFrame {\n                self?.layer.setNeedsDisplay()\n            }\n        }\n    }\n}\n\nprotocol AnimatorDelegate: AnyObject {\n    func animator(_ animator: AnimatedImageView.Animator, didPlayAnimationLoops count: UInt)\n}\n\nextension AnimatedImageView: AnimatorDelegate {\n    func animator(_ animator: Animator, didPlayAnimationLoops count: UInt) {\n        delegate?.animatedImageView(self, didPlayAnimationLoops: count)\n    }\n}\n\nextension AnimatedImageView {\n\n    // Represents a single frame in a GIF.\n    struct AnimatedFrame {\n\n        // The image to display for this frame. Its value is nil when the frame is removed from the buffer.\n        let image: UIImage?\n\n        // The duration that this frame should remain active.\n        let duration: TimeInterval\n\n        // A placeholder frame with no image assigned.\n        // Used to replace frames that are no longer needed in the animation.\n        var placeholderFrame: AnimatedFrame {\n            return AnimatedFrame(image: nil, duration: duration)\n        }\n\n        // Whether this frame instance contains an image or not.\n        var isPlaceholder: Bool {\n            return image == nil\n        }\n\n        // Returns a new instance from an optional image.\n        //\n        // - parameter image: An optional `UIImage` instance to be assigned to the new frame.\n        // - returns: An `AnimatedFrame` instance.\n        func makeAnimatedFrame(image: UIImage?) -> AnimatedFrame {\n            return AnimatedFrame(image: image, duration: duration)\n        }\n    }\n}\n\nextension AnimatedImageView {\n\n    // MARK: - Animator\n\n    /// An animator which used to drive the data behind `AnimatedImageView`.\n    public class Animator {\n        private let size: CGSize\n\n        private let imageSize: CGSize\n        private let imageScale: CGFloat\n\n        /// The maximum count of image frames that needs preload.\n        public let maxFrameCount: Int\n\n        private let imageSource: CGImageSource\n        private let maxRepeatCount: RepeatCount\n\n        private let maxTimeStep: TimeInterval = 1.0\n        private let animatedFrames = SafeArray<AnimatedFrame>()\n        private var frameCount = 0\n        private var timeSinceLastFrameChange: TimeInterval = 0.0\n        private var currentRepeatCount: UInt = 0\n\n        var isFinished: Bool = false\n\n        var needsPrescaling = true\n\n        var backgroundDecode = true\n\n        weak var delegate: AnimatorDelegate?\n\n        // Total duration of one animation loop\n        var loopDuration: TimeInterval = 0\n\n        /// The image of the current frame.\n        public var currentFrameImage: UIImage? {\n            return frame(at: currentFrameIndex)\n        }\n\n        /// The duration of the current active frame duration.\n        public var currentFrameDuration: TimeInterval {\n            return duration(at: currentFrameIndex)\n        }\n\n        /// The index of the current animation frame.\n        public internal(set) var currentFrameIndex = 0 {\n            didSet {\n                previousFrameIndex = oldValue\n            }\n        }\n\n        var previousFrameIndex = 0 {\n            didSet {\n                preloadQueue.async {\n                    self.updatePreloadedFrames()\n                }\n            }\n        }\n\n        var isReachMaxRepeatCount: Bool {\n            switch maxRepeatCount {\n            case .once:\n                return currentRepeatCount >= 1\n            case .finite(let maxCount):\n                return currentRepeatCount >= maxCount\n            case .infinite:\n                return false\n            }\n        }\n\n        /// Whether the current frame is the last frame or not in the animation sequence.\n        public var isLastFrame: Bool {\n            return currentFrameIndex == frameCount - 1\n        }\n\n        var preloadingIsNeeded: Bool {\n            return maxFrameCount < frameCount - 1\n        }\n\n        var contentMode = UIView.ContentMode.scaleToFill\n\n        private lazy var preloadQueue: DispatchQueue = {\n            return DispatchQueue(label: \"com.onevcat.Kingfisher.Animator.preloadQueue\")\n        }()\n\n        /// Creates an animator with image source reference.\n        ///\n        /// - Parameters:\n        ///   - source: The reference of animated image.\n        ///   - mode: Content mode of the `AnimatedImageView`.\n        ///   - size: Size of the `AnimatedImageView`.\n        ///   - imageSize: Size of the `KingfisherWrapper`.\n        ///   - imageScale: Scale of the `KingfisherWrapper`.\n        ///   - count: Count of frames needed to be preloaded.\n        ///   - repeatCount: The repeat count should this animator uses.\n        ///   - preloadQueue: Dispatch queue used for preloading images.\n        init(imageSource source: CGImageSource,\n             contentMode mode: UIView.ContentMode,\n             size: CGSize,\n             imageSize: CGSize,\n             imageScale: CGFloat,\n             framePreloadCount count: Int,\n             repeatCount: RepeatCount,\n             preloadQueue: DispatchQueue) {\n            self.imageSource = source\n            self.contentMode = mode\n            self.size = size\n            self.imageSize = imageSize\n            self.imageScale = imageScale\n            self.maxFrameCount = count\n            self.maxRepeatCount = repeatCount\n            self.preloadQueue = preloadQueue\n            \n            GraphicsContext.begin(size: imageSize, scale: imageScale)\n        }\n        \n        deinit {\n            GraphicsContext.end()\n        }\n\n        /// Gets the image frame of a given index.\n        /// - Parameter index: The index of desired image.\n        /// - Returns: The decoded image at the frame. `nil` if the index is out of bound or the image is not yet loaded.\n        public func frame(at index: Int) -> KFCrossPlatformImage? {\n            return animatedFrames[index]?.image\n        }\n\n        public func duration(at index: Int) -> TimeInterval {\n            return animatedFrames[index]?.duration  ?? .infinity\n        }\n\n        func prepareFramesAsynchronously() {\n            frameCount = Int(CGImageSourceGetCount(imageSource))\n            animatedFrames.reserveCapacity(frameCount)\n            preloadQueue.async { [weak self] in\n                self?.setupAnimatedFrames()\n            }\n        }\n\n        func shouldChangeFrame(with duration: CFTimeInterval, handler: (Bool) -> Void) {\n            incrementTimeSinceLastFrameChange(with: duration)\n\n            if currentFrameDuration > timeSinceLastFrameChange {\n                handler(false)\n            } else {\n                resetTimeSinceLastFrameChange()\n                incrementCurrentFrameIndex()\n                handler(true)\n            }\n        }\n\n        private func setupAnimatedFrames() {\n            resetAnimatedFrames()\n\n            var duration: TimeInterval = 0\n\n            (0..<frameCount).forEach { index in\n                let frameDuration = GIFAnimatedImage.getFrameDuration(from: imageSource, at: index)\n                duration += min(frameDuration, maxTimeStep)\n                animatedFrames.append(AnimatedFrame(image: nil, duration: frameDuration))\n\n                if index > maxFrameCount { return }\n                animatedFrames[index] = animatedFrames[index]?.makeAnimatedFrame(image: loadFrame(at: index))\n            }\n\n            self.loopDuration = duration\n        }\n\n        private func resetAnimatedFrames() {\n            animatedFrames.removeAll()\n        }\n\n        private func loadFrame(at index: Int) -> UIImage? {\n            let resize = needsPrescaling && size != .zero\n            let options: [CFString: Any]?\n            if resize {\n                options = [\n                    kCGImageSourceCreateThumbnailFromImageIfAbsent: true,\n                    kCGImageSourceCreateThumbnailWithTransform: true,\n                    kCGImageSourceShouldCacheImmediately: true,\n                    kCGImageSourceThumbnailMaxPixelSize: max(size.width, size.height)\n                ]\n            } else {\n                options = nil\n            }\n\n            guard let cgImage = CGImageSourceCreateImageAtIndex(imageSource, index, options as CFDictionary?) else {\n                return nil\n            }\n\n            let image = KFCrossPlatformImage(cgImage: cgImage)\n            \n            guard let context = GraphicsContext.current(size: imageSize, scale: imageScale, inverting: true, cgImage: cgImage) else {\n                return image\n            }\n            \n            return backgroundDecode ? image.kf.decoded(on: context) : image\n        }\n        \n        private func updatePreloadedFrames() {\n            guard preloadingIsNeeded else {\n                return\n            }\n\n            animatedFrames[previousFrameIndex] = animatedFrames[previousFrameIndex]?.placeholderFrame\n\n            preloadIndexes(start: currentFrameIndex).forEach { index in\n                guard let currentAnimatedFrame = animatedFrames[index] else { return }\n                if !currentAnimatedFrame.isPlaceholder { return }\n                animatedFrames[index] = currentAnimatedFrame.makeAnimatedFrame(image: loadFrame(at: index))\n            }\n        }\n\n        private func incrementCurrentFrameIndex() {\n            currentFrameIndex = increment(frameIndex: currentFrameIndex)\n            if isLastFrame {\n                currentRepeatCount += 1\n                if isReachMaxRepeatCount {\n                    isFinished = true\n                }\n                delegate?.animator(self, didPlayAnimationLoops: currentRepeatCount)\n            }\n        }\n\n        private func incrementTimeSinceLastFrameChange(with duration: TimeInterval) {\n            timeSinceLastFrameChange += min(maxTimeStep, duration)\n        }\n\n        private func resetTimeSinceLastFrameChange() {\n            timeSinceLastFrameChange -= currentFrameDuration\n        }\n\n        private func increment(frameIndex: Int, by value: Int = 1) -> Int {\n            return (frameIndex + value) % frameCount\n        }\n\n        private func preloadIndexes(start index: Int) -> [Int] {\n            let nextIndex = increment(frameIndex: index)\n            let lastIndex = increment(frameIndex: index, by: maxFrameCount)\n\n            if lastIndex >= nextIndex {\n                return [Int](nextIndex...lastIndex)\n            } else {\n                return [Int](nextIndex..<frameCount) + [Int](0...lastIndex)\n            }\n        }\n    }\n}\n\nclass SafeArray<Element> {\n    private var array: Array<Element> = []\n    private let lock = NSLock()\n    \n    subscript(index: Int) -> Element? {\n        get {\n            lock.lock()\n            defer { lock.unlock() }\n            return array.indices ~= index ? array[index] : nil\n        }\n        \n        set {\n            lock.lock()\n            defer { lock.unlock() }\n            if let newValue = newValue, array.indices ~= index {\n                array[index] = newValue\n            }\n        }\n    }\n    \n    var count : Int {\n        lock.lock()\n        defer { lock.unlock() }\n        return array.count\n    }\n    \n    func reserveCapacity(_ count: Int) {\n        lock.lock()\n        defer { lock.unlock() }\n        array.reserveCapacity(count)\n    }\n    \n    func append(_ element: Element) {\n        lock.lock()\n        defer { lock.unlock() }\n        array += [element]\n    }\n    \n    func removeAll() {\n        lock.lock()\n        defer { lock.unlock() }\n        array = []\n    }\n}\n#endif\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher/Sources/Views/Indicator.swift",
    "content": "//\n//  Indicator.swift\n//  Kingfisher\n//\n//  Created by João D. Moreira on 30/08/16.\n//\n//  Copyright (c) 2019 Wei Wang <onevcat@gmail.com>\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if !os(watchOS)\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\npublic typealias IndicatorView = NSView\n#else\nimport UIKit\npublic typealias IndicatorView = UIView\n#endif\n\n/// Represents the activity indicator type which should be added to\n/// an image view when an image is being downloaded.\n///\n/// - none: No indicator.\n/// - activity: Uses the system activity indicator.\n/// - image: Uses an image as indicator. GIF is supported.\n/// - custom: Uses a custom indicator. The type of associated value should conform to the `Indicator` protocol.\npublic enum IndicatorType {\n    /// No indicator.\n    case none\n    /// Uses the system activity indicator.\n    case activity\n    /// Uses an image as indicator. GIF is supported.\n    case image(imageData: Data)\n    /// Uses a custom indicator. The type of associated value should conform to the `Indicator` protocol.\n    case custom(indicator: Indicator)\n}\n\n/// An indicator type which can be used to show the download task is in progress.\npublic protocol Indicator {\n    \n    /// Called when the indicator should start animating.\n    func startAnimatingView()\n    \n    /// Called when the indicator should stop animating.\n    func stopAnimatingView()\n\n    /// Center offset of the indicator. Kingfisher will use this value to determine the position of\n    /// indicator in the super view.\n    var centerOffset: CGPoint { get }\n    \n    /// The indicator view which would be added to the super view.\n    var view: IndicatorView { get }\n\n    /// The size strategy used when adding the indicator to image view.\n    /// - Parameter imageView: The super view of indicator.\n    func sizeStrategy(in imageView: KFCrossPlatformImageView) -> IndicatorSizeStrategy\n}\n\npublic enum IndicatorSizeStrategy {\n    case intrinsicSize\n    case full\n    case size(CGSize)\n}\n\nextension Indicator {\n    \n    /// Default implementation of `centerOffset` of `Indicator`. The default value is `.zero`, means that there is\n    /// no offset for the indicator view.\n    public var centerOffset: CGPoint { return .zero }\n\n\n    /// Default implementation of `centerOffset` of `Indicator`. The default value is `.full`, means that the indicator\n    /// will pin to the same height and width as the image view.\n    public func sizeStrategy(in imageView: KFCrossPlatformImageView) -> IndicatorSizeStrategy {\n        return .full\n    }\n}\n\n// Displays a NSProgressIndicator / UIActivityIndicatorView\nfinal class ActivityIndicator: Indicator {\n\n    #if os(macOS)\n    private let activityIndicatorView: NSProgressIndicator\n    #else\n    private let activityIndicatorView: UIActivityIndicatorView\n    #endif\n    private var animatingCount = 0\n\n    var view: IndicatorView {\n        return activityIndicatorView\n    }\n\n    func startAnimatingView() {\n        if animatingCount == 0 {\n            #if os(macOS)\n            activityIndicatorView.startAnimation(nil)\n            #else\n            activityIndicatorView.startAnimating()\n            #endif\n            activityIndicatorView.isHidden = false\n        }\n        animatingCount += 1\n    }\n\n    func stopAnimatingView() {\n        animatingCount = max(animatingCount - 1, 0)\n        if animatingCount == 0 {\n            #if os(macOS)\n                activityIndicatorView.stopAnimation(nil)\n            #else\n                activityIndicatorView.stopAnimating()\n            #endif\n            activityIndicatorView.isHidden = true\n        }\n    }\n\n    func sizeStrategy(in imageView: KFCrossPlatformImageView) -> IndicatorSizeStrategy {\n        return .intrinsicSize\n    }\n\n    init() {\n        #if os(macOS)\n            activityIndicatorView = NSProgressIndicator(frame: CGRect(x: 0, y: 0, width: 16, height: 16))\n            activityIndicatorView.controlSize = .small\n            activityIndicatorView.style = .spinning\n        #else\n            let indicatorStyle: UIActivityIndicatorView.Style\n\n            #if os(tvOS)\n            if #available(tvOS 13.0, *) {\n                indicatorStyle = UIActivityIndicatorView.Style.large\n            } else {\n                indicatorStyle = UIActivityIndicatorView.Style.white\n            }\n            #else\n            if #available(iOS 13.0, * ) {\n                indicatorStyle = UIActivityIndicatorView.Style.medium\n            } else {\n                indicatorStyle = UIActivityIndicatorView.Style.gray\n            }\n            #endif\n\n            activityIndicatorView = UIActivityIndicatorView(style: indicatorStyle)\n        #endif\n    }\n}\n\n#if canImport(UIKit)\nextension UIActivityIndicatorView.Style {\n    #if compiler(>=5.1)\n    #else\n    static let large = UIActivityIndicatorView.Style.white\n    #if !os(tvOS)\n    static let medium = UIActivityIndicatorView.Style.gray\n    #endif\n    #endif\n}\n#endif\n\n// MARK: - ImageIndicator\n// Displays an ImageView. Supports gif\nfinal class ImageIndicator: Indicator {\n    private let animatedImageIndicatorView: KFCrossPlatformImageView\n\n    var view: IndicatorView {\n        return animatedImageIndicatorView\n    }\n\n    init?(\n        imageData data: Data,\n        processor: ImageProcessor = DefaultImageProcessor.default,\n        options: KingfisherParsedOptionsInfo? = nil)\n    {\n        var options = options ?? KingfisherParsedOptionsInfo(nil)\n        // Use normal image view to show animations, so we need to preload all animation data.\n        if !options.preloadAllAnimationData {\n            options.preloadAllAnimationData = true\n        }\n        \n        guard let image = processor.process(item: .data(data), options: options) else {\n            return nil\n        }\n\n        animatedImageIndicatorView = KFCrossPlatformImageView()\n        animatedImageIndicatorView.image = image\n        \n        #if os(macOS)\n            // Need for gif to animate on macOS\n            animatedImageIndicatorView.imageScaling = .scaleNone\n            animatedImageIndicatorView.canDrawSubviewsIntoLayer = true\n        #else\n            animatedImageIndicatorView.contentMode = .center\n        #endif\n    }\n\n    func startAnimatingView() {\n        #if os(macOS)\n            animatedImageIndicatorView.animates = true\n        #else\n            animatedImageIndicatorView.startAnimating()\n        #endif\n        animatedImageIndicatorView.isHidden = false\n    }\n\n    func stopAnimatingView() {\n        #if os(macOS)\n            animatedImageIndicatorView.animates = false\n        #else\n            animatedImageIndicatorView.stopAnimating()\n        #endif\n        animatedImageIndicatorView.isHidden = true\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/Kingfisher.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t009A9E47D01F8A0C32F66F0B448F46CC /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E518CACDBAA22A0E0F7D6961DAC786B2 /* Accelerate.framework */; };\n\t\t01D91DEFCE943FE1652E281B20750557 /* KFImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48ED39E5A43BE5ED6F038D8A66347D4E /* KFImage.swift */; };\n\t\t036768B3E3DD45D26BA6E2A3CF5D4877 /* KF.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCF98A2E2B5A4ED5ACF144ACA59EAA5D /* KF.swift */; };\n\t\t116E8D4B27521314299F86B710B38EF4 /* TVMonogramView+Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBF81C72312B11BAA7F67F39B90FA725 /* TVMonogramView+Kingfisher.swift */; };\n\t\t15EFC8950D083FBE2FB3315A2716B612 /* SessionDataTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E9577EFC69E5728414BDFBDD74FD43 /* SessionDataTask.swift */; };\n\t\t18E98EFA5F90947B984F906B55A239E8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4A0AA97B763CD1C6C59DC16DDF1AB9E /* Foundation.framework */; };\n\t\t1D63FD969DA4E8DB4F8511884E1D5654 /* SessionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB538EAFED24250FDEE778B618A00E7 /* SessionDelegate.swift */; };\n\t\t20ABCD53B035203F866F73EA0B83731A /* ImageBinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 216DA7D5B16F73B3A52B0CB76305B4D5 /* ImageBinder.swift */; };\n\t\t2576D77E0980C2498D305E6BFB92438F /* NSButton+Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59C5FD04D3AB489CF738CBBFDFCE5645 /* NSButton+Kingfisher.swift */; };\n\t\t298717B4D8172E7075AE7FAF1E3E3B97 /* Kingfisher-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 1660797AA6A1A171FD765DE92799300F /* Kingfisher-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2FF3FBDC108FD38E9C99D01054084F39 /* MemoryStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FECBBB0A860F907D2BDDEA825274DC /* MemoryStorage.swift */; };\n\t\t33E477C91EDD27D85FF73F24D3EE0EFD /* AuthenticationChallengeResponsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BCBB00723EB97F178C77F2BFEBDD45 /* AuthenticationChallengeResponsable.swift */; };\n\t\t39E3A64C2EF9C5347686B57E4FC7AFB2 /* DiskStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5E0FF9F3BA7EE48060442B25E3923D1 /* DiskStorage.swift */; };\n\t\t3D980A610BE4423096BDC5E78E0EEAD0 /* Kingfisher-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 152D5D9EEE4D7712656A02D7C3B5FBB0 /* Kingfisher-dummy.m */; };\n\t\t40AE4A5231163E23BB5D2E120A0ED41B /* NSTextAttachment+Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE28E72CDEE4E7DB38DFC20F531F140B /* NSTextAttachment+Kingfisher.swift */; };\n\t\t439CC25AF8061ADA3B3559BD9C82C638 /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8F006D807C4BBE9DCDE95AFDCB75783 /* Indicator.swift */; };\n\t\t44A7662375A26C49CB4DFB3D545ECD5D /* ImageProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943D6B9A2FD53F71E3F8CEA1A382B188 /* ImageProcessor.swift */; };\n\t\t45B672CC51026E979C8897B02FBAE3AF /* ImagePrefetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB06E8B10338824390D5266D8EAE5E78 /* ImagePrefetcher.swift */; };\n\t\t4B27B0C61BD4559F8F1BB5AD52BBF5E6 /* RedirectHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2EB7FE01806F8598CC1B5C6C746469B /* RedirectHandler.swift */; };\n\t\t51BCC42FFEC8F3D53043A9B8A0BB4D37 /* Delegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6352786185F851F454BA7D97F1D6759 /* Delegate.swift */; };\n\t\t5276029CD6731C940503B2CFC9D93C7F /* GIFAnimatedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BBF545F6F083EE1DB1DE5D5B69BDCFC /* GIFAnimatedImage.swift */; };\n\t\t54CE1092A1E30C04AA7EC2A6DC2547B8 /* UIButton+Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C70F13ED40BD782B2FD171DBDFC7298D /* UIButton+Kingfisher.swift */; };\n\t\t59DD17E9A9A03043F2CBD1948E781769 /* CallbackQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8ABD31869B41A448550CA44602EE9EDC /* CallbackQueue.swift */; };\n\t\t5D6C540026B79ADC1E1E39B528E44604 /* KFOptionsSetter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC4B5542F3EFBD53D4FBF5E30E74CAB /* KFOptionsSetter.swift */; };\n\t\t6410E99320F5871A84099068A7365BDD /* ImageProgressive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88CCE5E028CED8E1C7C2B3C49C7CD302 /* ImageProgressive.swift */; };\n\t\t68C266999376A54A23E07826862DA440 /* CacheSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E97062F6396DBC3332A358BF00A05AB1 /* CacheSerializer.swift */; };\n\t\t747C1F3BECBC41CA56F392B033C24037 /* ImageDownloaderDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BF0E964FA29F866CD8B28277961591 /* ImageDownloaderDelegate.swift */; };\n\t\t74EBCC7C42D8BCA61F375D98F24EAA93 /* Box.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74C91878B1568D723465D0180ECE2DD3 /* Box.swift */; };\n\t\t7FA4133CEE22E228CFEDD8CF1C195F2B /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A02FF3EC55763EA593D42C89449A7B37 /* CFNetwork.framework */; };\n\t\t84124AD6027C6BD4D1C44E3570B1F47F /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1ABCFC660C8FFEE085F31A86BC1E5F4 /* Storage.swift */; };\n\t\t843DBEF3521809674AA4606A6ADA19A1 /* ImageDataProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5687F7E0F61D656A97BBA71BFF462011 /* ImageDataProcessor.swift */; };\n\t\t848AF3BDEF73627067D56F5B6620EDD1 /* Resource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF9789FE18E7B9F33CC543BA3CED2DA /* Resource.swift */; };\n\t\t89A86A6FFF5D108B731722F7311366A5 /* String+MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 870F0060843B0434250A105A568B47F7 /* String+MD5.swift */; };\n\t\t8A2977E80420FA65D97E80C29DEC35CB /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633AC15E4EE8A866A836986B762DB0B3 /* Kingfisher.swift */; };\n\t\t92D89759C2D5F6644DC7C2D2E03B2BDD /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 681A3D233AD8CB4CEBEFB3C2C8AE48F9 /* Filter.swift */; };\n\t\t97B0EC6E75F956435E01FA1B5BA0CE65 /* KingfisherError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 949C76451365A57DFFCF495B622A2238 /* KingfisherError.swift */; };\n\t\t9B80AC78167933EE0DBA568741114B7F /* ImageDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CFF10C376DEEF81E3DB5E6669A39693 /* ImageDataProvider.swift */; };\n\t\t9DEAC78AB2C941F250F6BDFCE43586B3 /* Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F51F760B52B5D5095A5BAF956EE8629 /* Image.swift */; };\n\t\t9E0229D37EB89FD1DCD5E67634E1A62B /* ExtensionHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8780C2E124F1D5FB5D997FB3AAE2AFC9 /* ExtensionHelpers.swift */; };\n\t\t9F8BC3E6AEA88EE0F633648B364BC9FB /* FormatIndicatedCacheSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC4ABF307D42FBBF32D6EF94C31169B /* FormatIndicatedCacheSerializer.swift */; };\n\t\tA0289CAD357E2176617F6AC5D88AAA48 /* Runtime.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAAA2DFD301775D3612D223AE20371D6 /* Runtime.swift */; };\n\t\tA540839A448152A428FA8F04E5B58D99 /* Placeholder.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02F7451A4E45E7584C83738A0B72256 /* Placeholder.swift */; };\n\t\tA6797F90FF228586D31EFCB007C04A5A /* ImageTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1307C8B64AE65B9C79418184E51060BD /* ImageTransition.swift */; };\n\t\tA6E4BF22B9D00E287EF8D8DBA0CF5BC2 /* ImageDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA3599A36919BB92EEE708D5E3778242 /* ImageDownloader.swift */; };\n\t\tB58856DD55C5EA413D70153C932F8EAB /* WKInterfaceImage+Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CB0E65E2B073BB78DB5564B879AB771 /* WKInterfaceImage+Kingfisher.swift */; };\n\t\tB8AB0023D19E13459FAFBCE711294EA8 /* KingfisherManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 813F3E11E4A16360D9AA5E0AF664776B /* KingfisherManager.swift */; };\n\t\tC2D7FC1E503179BD6E288403BEFB0513 /* SizeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF859DBAD5CFEAA9C43C167097CDADD8 /* SizeExtensions.swift */; };\n\t\tCBB91E6B72B26064566443681BB213AD /* ImageView+Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = F546F9DE30A288E045A1B84959FB6668 /* ImageView+Kingfisher.swift */; };\n\t\tD21DD561BCC0D2EF5B9B1319124C8D1A /* ImageDrawing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 879F4067EF153C14EC90AAE4EA118336 /* ImageDrawing.swift */; };\n\t\tD9590C17E41D62CC27A58AC2836C59DA /* RequestModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62DA59BB9E8A87141E073CE72BDD99BC /* RequestModifier.swift */; };\n\t\tDA9EEC18D35228922F194DA58B15AD5B /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCEB2213725FC494BDA16FA35849487 /* Result.swift */; };\n\t\tE218B986DC9BA5FC6CAA19C46F03697C /* AnimatedImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FE9F26A9A815F87AD017B9B0C7BC197 /* AnimatedImageView.swift */; };\n\t\tE2DCF4C882BBACD61228861C397BF296 /* Source.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE0AB9CCD2C4AFC6D8D50F9630647C3E /* Source.swift */; };\n\t\tE374AA3080D36EE4A62D9A4C7BE0E311 /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBFFD203F1BC694DEB46318F5988C2F9 /* ImageCache.swift */; };\n\t\tE8589C3E477B5F56BE06A672933BC3E3 /* ImageFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEA3F3E60C4F43651912DA787A64DAB6 /* ImageFormat.swift */; };\n\t\tEAC77AC658D564B79E0E9F7760AA23BC /* KFImageOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825F2BAAA183227414C87DF5F878FDDD /* KFImageOptions.swift */; };\n\t\tF7FE727CE285679D6737186EDABC362B /* ImageModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = F50932A7B3F44BDACD5C062F68544E0F /* ImageModifier.swift */; };\n\t\tF921BFCE551DF93CE51B08E0BA2938DA /* KingfisherOptionsInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430F086F35AD4204EBA7F74CBF9A9E1 /* KingfisherOptionsInfo.swift */; };\n\t\tFD9F6C848F43A7A6C85CA041C19A1EFD /* RetryStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07878660D9C440CC10E18A09434E4887 /* RetryStrategy.swift */; };\n\t\tFE6B55BC30EB3F494FA8046D4A378969 /* GraphicsContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EB79DDF0F8F366348DE09C405FC2FCF /* GraphicsContext.swift */; };\n\t\tFE718B42F18FBEE7F7F4558A4A2EAED4 /* AVAssetImageDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1060E0740C5ADF16A0F6D5574A42AA56 /* AVAssetImageDataProvider.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t07878660D9C440CC10E18A09434E4887 /* RetryStrategy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RetryStrategy.swift; path = Sources/Networking/RetryStrategy.swift; sourceTree = \"<group>\"; };\n\t\t0CFF10C376DEEF81E3DB5E6669A39693 /* ImageDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageDataProvider.swift; path = Sources/General/ImageSource/ImageDataProvider.swift; sourceTree = \"<group>\"; };\n\t\t0F51F760B52B5D5095A5BAF956EE8629 /* Image.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Image.swift; path = Sources/Image/Image.swift; sourceTree = \"<group>\"; };\n\t\t0FE9F26A9A815F87AD017B9B0C7BC197 /* AnimatedImageView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnimatedImageView.swift; path = Sources/Views/AnimatedImageView.swift; sourceTree = \"<group>\"; };\n\t\t1060E0740C5ADF16A0F6D5574A42AA56 /* AVAssetImageDataProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AVAssetImageDataProvider.swift; path = Sources/General/ImageSource/AVAssetImageDataProvider.swift; sourceTree = \"<group>\"; };\n\t\t1307C8B64AE65B9C79418184E51060BD /* ImageTransition.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageTransition.swift; path = Sources/Image/ImageTransition.swift; sourceTree = \"<group>\"; };\n\t\t152D5D9EEE4D7712656A02D7C3B5FBB0 /* Kingfisher-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"Kingfisher-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t1660797AA6A1A171FD765DE92799300F /* Kingfisher-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Kingfisher-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t1AF9789FE18E7B9F33CC543BA3CED2DA /* Resource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Resource.swift; path = Sources/General/ImageSource/Resource.swift; sourceTree = \"<group>\"; };\n\t\t1CB0E65E2B073BB78DB5564B879AB771 /* WKInterfaceImage+Kingfisher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"WKInterfaceImage+Kingfisher.swift\"; path = \"Sources/Extensions/WKInterfaceImage+Kingfisher.swift\"; sourceTree = \"<group>\"; };\n\t\t216DA7D5B16F73B3A52B0CB76305B4D5 /* ImageBinder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageBinder.swift; path = Sources/SwiftUI/ImageBinder.swift; sourceTree = \"<group>\"; };\n\t\t2CCEB2213725FC494BDA16FA35849487 /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Sources/Utility/Result.swift; sourceTree = \"<group>\"; };\n\t\t2EB79DDF0F8F366348DE09C405FC2FCF /* GraphicsContext.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GraphicsContext.swift; path = Sources/Image/GraphicsContext.swift; sourceTree = \"<group>\"; };\n\t\t33BF0E964FA29F866CD8B28277961591 /* ImageDownloaderDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageDownloaderDelegate.swift; path = Sources/Networking/ImageDownloaderDelegate.swift; sourceTree = \"<group>\"; };\n\t\t3430F086F35AD4204EBA7F74CBF9A9E1 /* KingfisherOptionsInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KingfisherOptionsInfo.swift; path = Sources/General/KingfisherOptionsInfo.swift; sourceTree = \"<group>\"; };\n\t\t39088D402ED82C4218E19B8EF8D280F4 /* Kingfisher.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Kingfisher.modulemap; sourceTree = \"<group>\"; };\n\t\t435D5BCE722A5F39DD54924CC255406F /* Kingfisher */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Kingfisher; path = Kingfisher.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t4748A76BE82A9DC1879F1A198128AC3E /* Kingfisher.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Kingfisher.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t48ED39E5A43BE5ED6F038D8A66347D4E /* KFImage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KFImage.swift; path = Sources/SwiftUI/KFImage.swift; sourceTree = \"<group>\"; };\n\t\t5687F7E0F61D656A97BBA71BFF462011 /* ImageDataProcessor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageDataProcessor.swift; path = Sources/Networking/ImageDataProcessor.swift; sourceTree = \"<group>\"; };\n\t\t59C5FD04D3AB489CF738CBBFDFCE5645 /* NSButton+Kingfisher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSButton+Kingfisher.swift\"; path = \"Sources/Extensions/NSButton+Kingfisher.swift\"; sourceTree = \"<group>\"; };\n\t\t62DA59BB9E8A87141E073CE72BDD99BC /* RequestModifier.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestModifier.swift; path = Sources/Networking/RequestModifier.swift; sourceTree = \"<group>\"; };\n\t\t633AC15E4EE8A866A836986B762DB0B3 /* Kingfisher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Kingfisher.swift; path = Sources/General/Kingfisher.swift; sourceTree = \"<group>\"; };\n\t\t63E9577EFC69E5728414BDFBDD74FD43 /* SessionDataTask.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionDataTask.swift; path = Sources/Networking/SessionDataTask.swift; sourceTree = \"<group>\"; };\n\t\t681A3D233AD8CB4CEBEFB3C2C8AE48F9 /* Filter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = Sources/Image/Filter.swift; sourceTree = \"<group>\"; };\n\t\t74C91878B1568D723465D0180ECE2DD3 /* Box.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Box.swift; path = Sources/Utility/Box.swift; sourceTree = \"<group>\"; };\n\t\t7AC4ABF307D42FBBF32D6EF94C31169B /* FormatIndicatedCacheSerializer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FormatIndicatedCacheSerializer.swift; path = Sources/Cache/FormatIndicatedCacheSerializer.swift; sourceTree = \"<group>\"; };\n\t\t7AC4B5542F3EFBD53D4FBF5E30E74CAB /* KFOptionsSetter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KFOptionsSetter.swift; path = Sources/General/KFOptionsSetter.swift; sourceTree = \"<group>\"; };\n\t\t7BB538EAFED24250FDEE778B618A00E7 /* SessionDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionDelegate.swift; path = Sources/Networking/SessionDelegate.swift; sourceTree = \"<group>\"; };\n\t\t813F3E11E4A16360D9AA5E0AF664776B /* KingfisherManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KingfisherManager.swift; path = Sources/General/KingfisherManager.swift; sourceTree = \"<group>\"; };\n\t\t825F2BAAA183227414C87DF5F878FDDD /* KFImageOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KFImageOptions.swift; path = Sources/SwiftUI/KFImageOptions.swift; sourceTree = \"<group>\"; };\n\t\t870F0060843B0434250A105A568B47F7 /* String+MD5.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"String+MD5.swift\"; path = \"Sources/Utility/String+MD5.swift\"; sourceTree = \"<group>\"; };\n\t\t8780C2E124F1D5FB5D997FB3AAE2AFC9 /* ExtensionHelpers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExtensionHelpers.swift; path = Sources/Utility/ExtensionHelpers.swift; sourceTree = \"<group>\"; };\n\t\t879F4067EF153C14EC90AAE4EA118336 /* ImageDrawing.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageDrawing.swift; path = Sources/Image/ImageDrawing.swift; sourceTree = \"<group>\"; };\n\t\t87FECBBB0A860F907D2BDDEA825274DC /* MemoryStorage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MemoryStorage.swift; path = Sources/Cache/MemoryStorage.swift; sourceTree = \"<group>\"; };\n\t\t88CCE5E028CED8E1C7C2B3C49C7CD302 /* ImageProgressive.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageProgressive.swift; path = Sources/Image/ImageProgressive.swift; sourceTree = \"<group>\"; };\n\t\t8ABD31869B41A448550CA44602EE9EDC /* CallbackQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CallbackQueue.swift; path = Sources/Utility/CallbackQueue.swift; sourceTree = \"<group>\"; };\n\t\t8BBF545F6F083EE1DB1DE5D5B69BDCFC /* GIFAnimatedImage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GIFAnimatedImage.swift; path = Sources/Image/GIFAnimatedImage.swift; sourceTree = \"<group>\"; };\n\t\t9419B8317819EC649DB926295C2A6030 /* Kingfisher-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"Kingfisher-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t943D6B9A2FD53F71E3F8CEA1A382B188 /* ImageProcessor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageProcessor.swift; path = Sources/Image/ImageProcessor.swift; sourceTree = \"<group>\"; };\n\t\t949C76451365A57DFFCF495B622A2238 /* KingfisherError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KingfisherError.swift; path = Sources/General/KingfisherError.swift; sourceTree = \"<group>\"; };\n\t\tA02FF3EC55763EA593D42C89449A7B37 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; };\n\t\tA4A0AA97B763CD1C6C59DC16DDF1AB9E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tAE5735A709E5B9B77B8C0F50A8A361A7 /* Kingfisher.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Kingfisher.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tAEA3F3E60C4F43651912DA787A64DAB6 /* ImageFormat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageFormat.swift; path = Sources/Image/ImageFormat.swift; sourceTree = \"<group>\"; };\n\t\tBB06E8B10338824390D5266D8EAE5E78 /* ImagePrefetcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImagePrefetcher.swift; path = Sources/Networking/ImagePrefetcher.swift; sourceTree = \"<group>\"; };\n\t\tBCF98A2E2B5A4ED5ACF144ACA59EAA5D /* KF.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KF.swift; path = Sources/General/KF.swift; sourceTree = \"<group>\"; };\n\t\tBE0AB9CCD2C4AFC6D8D50F9630647C3E /* Source.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Source.swift; path = Sources/General/ImageSource/Source.swift; sourceTree = \"<group>\"; };\n\t\tC70F13ED40BD782B2FD171DBDFC7298D /* UIButton+Kingfisher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIButton+Kingfisher.swift\"; path = \"Sources/Extensions/UIButton+Kingfisher.swift\"; sourceTree = \"<group>\"; };\n\t\tCF859DBAD5CFEAA9C43C167097CDADD8 /* SizeExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SizeExtensions.swift; path = Sources/Utility/SizeExtensions.swift; sourceTree = \"<group>\"; };\n\t\tD1ABCFC660C8FFEE085F31A86BC1E5F4 /* Storage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Storage.swift; path = Sources/Cache/Storage.swift; sourceTree = \"<group>\"; };\n\t\tD6352786185F851F454BA7D97F1D6759 /* Delegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Delegate.swift; path = Sources/Utility/Delegate.swift; sourceTree = \"<group>\"; };\n\t\tD6BCBB00723EB97F178C77F2BFEBDD45 /* AuthenticationChallengeResponsable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AuthenticationChallengeResponsable.swift; path = Sources/Networking/AuthenticationChallengeResponsable.swift; sourceTree = \"<group>\"; };\n\t\tDA3599A36919BB92EEE708D5E3778242 /* ImageDownloader.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageDownloader.swift; path = Sources/Networking/ImageDownloader.swift; sourceTree = \"<group>\"; };\n\t\tDBFFD203F1BC694DEB46318F5988C2F9 /* ImageCache.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageCache.swift; path = Sources/Cache/ImageCache.swift; sourceTree = \"<group>\"; };\n\t\tDE28E72CDEE4E7DB38DFC20F531F140B /* NSTextAttachment+Kingfisher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSTextAttachment+Kingfisher.swift\"; path = \"Sources/Extensions/NSTextAttachment+Kingfisher.swift\"; sourceTree = \"<group>\"; };\n\t\tE02F7451A4E45E7584C83738A0B72256 /* Placeholder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Placeholder.swift; path = Sources/Image/Placeholder.swift; sourceTree = \"<group>\"; };\n\t\tE518CACDBAA22A0E0F7D6961DAC786B2 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; };\n\t\tE5E0FF9F3BA7EE48060442B25E3923D1 /* DiskStorage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DiskStorage.swift; path = Sources/Cache/DiskStorage.swift; sourceTree = \"<group>\"; };\n\t\tE8F006D807C4BBE9DCDE95AFDCB75783 /* Indicator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Indicator.swift; path = Sources/Views/Indicator.swift; sourceTree = \"<group>\"; };\n\t\tE97062F6396DBC3332A358BF00A05AB1 /* CacheSerializer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CacheSerializer.swift; path = Sources/Cache/CacheSerializer.swift; sourceTree = \"<group>\"; };\n\t\tF2EB7FE01806F8598CC1B5C6C746469B /* RedirectHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RedirectHandler.swift; path = Sources/Networking/RedirectHandler.swift; sourceTree = \"<group>\"; };\n\t\tF50932A7B3F44BDACD5C062F68544E0F /* ImageModifier.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageModifier.swift; path = Sources/Networking/ImageModifier.swift; sourceTree = \"<group>\"; };\n\t\tF546F9DE30A288E045A1B84959FB6668 /* ImageView+Kingfisher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ImageView+Kingfisher.swift\"; path = \"Sources/Extensions/ImageView+Kingfisher.swift\"; sourceTree = \"<group>\"; };\n\t\tFAAA2DFD301775D3612D223AE20371D6 /* Runtime.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Runtime.swift; path = Sources/Utility/Runtime.swift; sourceTree = \"<group>\"; };\n\t\tFBF81C72312B11BAA7F67F39B90FA725 /* TVMonogramView+Kingfisher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"TVMonogramView+Kingfisher.swift\"; path = \"Sources/Extensions/TVMonogramView+Kingfisher.swift\"; sourceTree = \"<group>\"; };\n\t\tFD6F699AC27735BA88574D327D06C88D /* Kingfisher-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Kingfisher-prefix.pch\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tBE6AB1CD62FB670FAFEB33207A0B597E /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t009A9E47D01F8A0C32F66F0B448F46CC /* Accelerate.framework in Frameworks */,\n\t\t\t\t7FA4133CEE22E228CFEDD8CF1C195F2B /* CFNetwork.framework in Frameworks */,\n\t\t\t\t18E98EFA5F90947B984F906B55A239E8 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t079F20D08577B6F43BEA1CEFE96BEB9C /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8F013E1EAD5571A2A7CAABA9CC641BDA /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t20CA6EA7FB899863F7254E4183CC9A57 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t079F20D08577B6F43BEA1CEFE96BEB9C /* Frameworks */,\n\t\t\t\tF7D1741736415F44BA49769E6BDABE36 /* Kingfisher */,\n\t\t\t\tA755E2513C05448C4156B48674672668 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8F013E1EAD5571A2A7CAABA9CC641BDA /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE518CACDBAA22A0E0F7D6961DAC786B2 /* Accelerate.framework */,\n\t\t\t\tA02FF3EC55763EA593D42C89449A7B37 /* CFNetwork.framework */,\n\t\t\t\tA4A0AA97B763CD1C6C59DC16DDF1AB9E /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t93E68C97367E9D75A46CD5B186E40992 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t39088D402ED82C4218E19B8EF8D280F4 /* Kingfisher.modulemap */,\n\t\t\t\t152D5D9EEE4D7712656A02D7C3B5FBB0 /* Kingfisher-dummy.m */,\n\t\t\t\t9419B8317819EC649DB926295C2A6030 /* Kingfisher-Info.plist */,\n\t\t\t\tFD6F699AC27735BA88574D327D06C88D /* Kingfisher-prefix.pch */,\n\t\t\t\t1660797AA6A1A171FD765DE92799300F /* Kingfisher-umbrella.h */,\n\t\t\t\tAE5735A709E5B9B77B8C0F50A8A361A7 /* Kingfisher.debug.xcconfig */,\n\t\t\t\t4748A76BE82A9DC1879F1A198128AC3E /* Kingfisher.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/Kingfisher\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA755E2513C05448C4156B48674672668 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t435D5BCE722A5F39DD54924CC255406F /* Kingfisher */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF7D1741736415F44BA49769E6BDABE36 /* Kingfisher */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0FE9F26A9A815F87AD017B9B0C7BC197 /* AnimatedImageView.swift */,\n\t\t\t\tD6BCBB00723EB97F178C77F2BFEBDD45 /* AuthenticationChallengeResponsable.swift */,\n\t\t\t\t1060E0740C5ADF16A0F6D5574A42AA56 /* AVAssetImageDataProvider.swift */,\n\t\t\t\t74C91878B1568D723465D0180ECE2DD3 /* Box.swift */,\n\t\t\t\tE97062F6396DBC3332A358BF00A05AB1 /* CacheSerializer.swift */,\n\t\t\t\t8ABD31869B41A448550CA44602EE9EDC /* CallbackQueue.swift */,\n\t\t\t\tD6352786185F851F454BA7D97F1D6759 /* Delegate.swift */,\n\t\t\t\tE5E0FF9F3BA7EE48060442B25E3923D1 /* DiskStorage.swift */,\n\t\t\t\t8780C2E124F1D5FB5D997FB3AAE2AFC9 /* ExtensionHelpers.swift */,\n\t\t\t\t681A3D233AD8CB4CEBEFB3C2C8AE48F9 /* Filter.swift */,\n\t\t\t\t7AC4ABF307D42FBBF32D6EF94C31169B /* FormatIndicatedCacheSerializer.swift */,\n\t\t\t\t8BBF545F6F083EE1DB1DE5D5B69BDCFC /* GIFAnimatedImage.swift */,\n\t\t\t\t2EB79DDF0F8F366348DE09C405FC2FCF /* GraphicsContext.swift */,\n\t\t\t\t0F51F760B52B5D5095A5BAF956EE8629 /* Image.swift */,\n\t\t\t\t216DA7D5B16F73B3A52B0CB76305B4D5 /* ImageBinder.swift */,\n\t\t\t\tDBFFD203F1BC694DEB46318F5988C2F9 /* ImageCache.swift */,\n\t\t\t\t5687F7E0F61D656A97BBA71BFF462011 /* ImageDataProcessor.swift */,\n\t\t\t\t0CFF10C376DEEF81E3DB5E6669A39693 /* ImageDataProvider.swift */,\n\t\t\t\tDA3599A36919BB92EEE708D5E3778242 /* ImageDownloader.swift */,\n\t\t\t\t33BF0E964FA29F866CD8B28277961591 /* ImageDownloaderDelegate.swift */,\n\t\t\t\t879F4067EF153C14EC90AAE4EA118336 /* ImageDrawing.swift */,\n\t\t\t\tAEA3F3E60C4F43651912DA787A64DAB6 /* ImageFormat.swift */,\n\t\t\t\tF50932A7B3F44BDACD5C062F68544E0F /* ImageModifier.swift */,\n\t\t\t\tBB06E8B10338824390D5266D8EAE5E78 /* ImagePrefetcher.swift */,\n\t\t\t\t943D6B9A2FD53F71E3F8CEA1A382B188 /* ImageProcessor.swift */,\n\t\t\t\t88CCE5E028CED8E1C7C2B3C49C7CD302 /* ImageProgressive.swift */,\n\t\t\t\t1307C8B64AE65B9C79418184E51060BD /* ImageTransition.swift */,\n\t\t\t\tF546F9DE30A288E045A1B84959FB6668 /* ImageView+Kingfisher.swift */,\n\t\t\t\tE8F006D807C4BBE9DCDE95AFDCB75783 /* Indicator.swift */,\n\t\t\t\tBCF98A2E2B5A4ED5ACF144ACA59EAA5D /* KF.swift */,\n\t\t\t\t48ED39E5A43BE5ED6F038D8A66347D4E /* KFImage.swift */,\n\t\t\t\t825F2BAAA183227414C87DF5F878FDDD /* KFImageOptions.swift */,\n\t\t\t\t7AC4B5542F3EFBD53D4FBF5E30E74CAB /* KFOptionsSetter.swift */,\n\t\t\t\t633AC15E4EE8A866A836986B762DB0B3 /* Kingfisher.swift */,\n\t\t\t\t949C76451365A57DFFCF495B622A2238 /* KingfisherError.swift */,\n\t\t\t\t813F3E11E4A16360D9AA5E0AF664776B /* KingfisherManager.swift */,\n\t\t\t\t3430F086F35AD4204EBA7F74CBF9A9E1 /* KingfisherOptionsInfo.swift */,\n\t\t\t\t87FECBBB0A860F907D2BDDEA825274DC /* MemoryStorage.swift */,\n\t\t\t\t59C5FD04D3AB489CF738CBBFDFCE5645 /* NSButton+Kingfisher.swift */,\n\t\t\t\tDE28E72CDEE4E7DB38DFC20F531F140B /* NSTextAttachment+Kingfisher.swift */,\n\t\t\t\tE02F7451A4E45E7584C83738A0B72256 /* Placeholder.swift */,\n\t\t\t\tF2EB7FE01806F8598CC1B5C6C746469B /* RedirectHandler.swift */,\n\t\t\t\t62DA59BB9E8A87141E073CE72BDD99BC /* RequestModifier.swift */,\n\t\t\t\t1AF9789FE18E7B9F33CC543BA3CED2DA /* Resource.swift */,\n\t\t\t\t2CCEB2213725FC494BDA16FA35849487 /* Result.swift */,\n\t\t\t\t07878660D9C440CC10E18A09434E4887 /* RetryStrategy.swift */,\n\t\t\t\tFAAA2DFD301775D3612D223AE20371D6 /* Runtime.swift */,\n\t\t\t\t63E9577EFC69E5728414BDFBDD74FD43 /* SessionDataTask.swift */,\n\t\t\t\t7BB538EAFED24250FDEE778B618A00E7 /* SessionDelegate.swift */,\n\t\t\t\tCF859DBAD5CFEAA9C43C167097CDADD8 /* SizeExtensions.swift */,\n\t\t\t\tBE0AB9CCD2C4AFC6D8D50F9630647C3E /* Source.swift */,\n\t\t\t\tD1ABCFC660C8FFEE085F31A86BC1E5F4 /* Storage.swift */,\n\t\t\t\t870F0060843B0434250A105A568B47F7 /* String+MD5.swift */,\n\t\t\t\tFBF81C72312B11BAA7F67F39B90FA725 /* TVMonogramView+Kingfisher.swift */,\n\t\t\t\tC70F13ED40BD782B2FD171DBDFC7298D /* UIButton+Kingfisher.swift */,\n\t\t\t\t1CB0E65E2B073BB78DB5564B879AB771 /* WKInterfaceImage+Kingfisher.swift */,\n\t\t\t\t93E68C97367E9D75A46CD5B186E40992 /* Support Files */,\n\t\t\t);\n\t\t\tname = Kingfisher;\n\t\t\tpath = Kingfisher;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t36C09C6814A638531F3A051D6C6ED380 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t298717B4D8172E7075AE7FAF1E3E3B97 /* Kingfisher-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t05BB3BFEAA03766641420DCD88978468 /* Kingfisher */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = B6926DC4A63433720DB0689FB26B5A83 /* Build configuration list for PBXNativeTarget \"Kingfisher\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t36C09C6814A638531F3A051D6C6ED380 /* Headers */,\n\t\t\t\t96561980FB10934EF184955554212A9D /* Sources */,\n\t\t\t\tBE6AB1CD62FB670FAFEB33207A0B597E /* Frameworks */,\n\t\t\t\tEBC00B065C36DA88889E574C73984F4B /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Kingfisher;\n\t\t\tproductName = Kingfisher;\n\t\t\tproductReference = 435D5BCE722A5F39DD54924CC255406F /* Kingfisher */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tA17CCB4923D030263240808F7BC3C92D /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3E251839724B92B7A217EDE187B2C60F /* Build configuration list for PBXProject \"Kingfisher\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 20CA6EA7FB899863F7254E4183CC9A57;\n\t\t\tproductRefGroup = A755E2513C05448C4156B48674672668 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t05BB3BFEAA03766641420DCD88978468 /* Kingfisher */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tEBC00B065C36DA88889E574C73984F4B /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t96561980FB10934EF184955554212A9D /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE218B986DC9BA5FC6CAA19C46F03697C /* AnimatedImageView.swift in Sources */,\n\t\t\t\t33E477C91EDD27D85FF73F24D3EE0EFD /* AuthenticationChallengeResponsable.swift in Sources */,\n\t\t\t\tFE718B42F18FBEE7F7F4558A4A2EAED4 /* AVAssetImageDataProvider.swift in Sources */,\n\t\t\t\t74EBCC7C42D8BCA61F375D98F24EAA93 /* Box.swift in Sources */,\n\t\t\t\t68C266999376A54A23E07826862DA440 /* CacheSerializer.swift in Sources */,\n\t\t\t\t59DD17E9A9A03043F2CBD1948E781769 /* CallbackQueue.swift in Sources */,\n\t\t\t\t51BCC42FFEC8F3D53043A9B8A0BB4D37 /* Delegate.swift in Sources */,\n\t\t\t\t39E3A64C2EF9C5347686B57E4FC7AFB2 /* DiskStorage.swift in Sources */,\n\t\t\t\t9E0229D37EB89FD1DCD5E67634E1A62B /* ExtensionHelpers.swift in Sources */,\n\t\t\t\t92D89759C2D5F6644DC7C2D2E03B2BDD /* Filter.swift in Sources */,\n\t\t\t\t9F8BC3E6AEA88EE0F633648B364BC9FB /* FormatIndicatedCacheSerializer.swift in Sources */,\n\t\t\t\t5276029CD6731C940503B2CFC9D93C7F /* GIFAnimatedImage.swift in Sources */,\n\t\t\t\tFE6B55BC30EB3F494FA8046D4A378969 /* GraphicsContext.swift in Sources */,\n\t\t\t\t9DEAC78AB2C941F250F6BDFCE43586B3 /* Image.swift in Sources */,\n\t\t\t\t20ABCD53B035203F866F73EA0B83731A /* ImageBinder.swift in Sources */,\n\t\t\t\tE374AA3080D36EE4A62D9A4C7BE0E311 /* ImageCache.swift in Sources */,\n\t\t\t\t843DBEF3521809674AA4606A6ADA19A1 /* ImageDataProcessor.swift in Sources */,\n\t\t\t\t9B80AC78167933EE0DBA568741114B7F /* ImageDataProvider.swift in Sources */,\n\t\t\t\tA6E4BF22B9D00E287EF8D8DBA0CF5BC2 /* ImageDownloader.swift in Sources */,\n\t\t\t\t747C1F3BECBC41CA56F392B033C24037 /* ImageDownloaderDelegate.swift in Sources */,\n\t\t\t\tD21DD561BCC0D2EF5B9B1319124C8D1A /* ImageDrawing.swift in Sources */,\n\t\t\t\tE8589C3E477B5F56BE06A672933BC3E3 /* ImageFormat.swift in Sources */,\n\t\t\t\tF7FE727CE285679D6737186EDABC362B /* ImageModifier.swift in Sources */,\n\t\t\t\t45B672CC51026E979C8897B02FBAE3AF /* ImagePrefetcher.swift in Sources */,\n\t\t\t\t44A7662375A26C49CB4DFB3D545ECD5D /* ImageProcessor.swift in Sources */,\n\t\t\t\t6410E99320F5871A84099068A7365BDD /* ImageProgressive.swift in Sources */,\n\t\t\t\tA6797F90FF228586D31EFCB007C04A5A /* ImageTransition.swift in Sources */,\n\t\t\t\tCBB91E6B72B26064566443681BB213AD /* ImageView+Kingfisher.swift in Sources */,\n\t\t\t\t439CC25AF8061ADA3B3559BD9C82C638 /* Indicator.swift in Sources */,\n\t\t\t\t036768B3E3DD45D26BA6E2A3CF5D4877 /* KF.swift in Sources */,\n\t\t\t\t01D91DEFCE943FE1652E281B20750557 /* KFImage.swift in Sources */,\n\t\t\t\tEAC77AC658D564B79E0E9F7760AA23BC /* KFImageOptions.swift in Sources */,\n\t\t\t\t5D6C540026B79ADC1E1E39B528E44604 /* KFOptionsSetter.swift in Sources */,\n\t\t\t\t8A2977E80420FA65D97E80C29DEC35CB /* Kingfisher.swift in Sources */,\n\t\t\t\t3D980A610BE4423096BDC5E78E0EEAD0 /* Kingfisher-dummy.m in Sources */,\n\t\t\t\t97B0EC6E75F956435E01FA1B5BA0CE65 /* KingfisherError.swift in Sources */,\n\t\t\t\tB8AB0023D19E13459FAFBCE711294EA8 /* KingfisherManager.swift in Sources */,\n\t\t\t\tF921BFCE551DF93CE51B08E0BA2938DA /* KingfisherOptionsInfo.swift in Sources */,\n\t\t\t\t2FF3FBDC108FD38E9C99D01054084F39 /* MemoryStorage.swift in Sources */,\n\t\t\t\t2576D77E0980C2498D305E6BFB92438F /* NSButton+Kingfisher.swift in Sources */,\n\t\t\t\t40AE4A5231163E23BB5D2E120A0ED41B /* NSTextAttachment+Kingfisher.swift in Sources */,\n\t\t\t\tA540839A448152A428FA8F04E5B58D99 /* Placeholder.swift in Sources */,\n\t\t\t\t4B27B0C61BD4559F8F1BB5AD52BBF5E6 /* RedirectHandler.swift in Sources */,\n\t\t\t\tD9590C17E41D62CC27A58AC2836C59DA /* RequestModifier.swift in Sources */,\n\t\t\t\t848AF3BDEF73627067D56F5B6620EDD1 /* Resource.swift in Sources */,\n\t\t\t\tDA9EEC18D35228922F194DA58B15AD5B /* Result.swift in Sources */,\n\t\t\t\tFD9F6C848F43A7A6C85CA041C19A1EFD /* RetryStrategy.swift in Sources */,\n\t\t\t\tA0289CAD357E2176617F6AC5D88AAA48 /* Runtime.swift in Sources */,\n\t\t\t\t15EFC8950D083FBE2FB3315A2716B612 /* SessionDataTask.swift in Sources */,\n\t\t\t\t1D63FD969DA4E8DB4F8511884E1D5654 /* SessionDelegate.swift in Sources */,\n\t\t\t\tC2D7FC1E503179BD6E288403BEFB0513 /* SizeExtensions.swift in Sources */,\n\t\t\t\tE2DCF4C882BBACD61228861C397BF296 /* Source.swift in Sources */,\n\t\t\t\t84124AD6027C6BD4D1C44E3570B1F47F /* Storage.swift in Sources */,\n\t\t\t\t89A86A6FFF5D108B731722F7311366A5 /* String+MD5.swift in Sources */,\n\t\t\t\t116E8D4B27521314299F86B710B38EF4 /* TVMonogramView+Kingfisher.swift in Sources */,\n\t\t\t\t54CE1092A1E30C04AA7EC2A6DC2547B8 /* UIButton+Kingfisher.swift in Sources */,\n\t\t\t\tB58856DD55C5EA413D70153C932F8EAB /* WKInterfaceImage+Kingfisher.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t5760C9AC75169B9426B31209A4D6235B /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t7E3EAFE2FE67BDDA5058FBB2BFE6CABD /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = AE5735A709E5B9B77B8C0F50A8A361A7 /* Kingfisher.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Kingfisher/Kingfisher-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Kingfisher/Kingfisher-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Kingfisher/Kingfisher.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Kingfisher;\n\t\t\t\tPRODUCT_NAME = Kingfisher;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tBF9BD488678208045B4D71F7CE6EBBCF /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 4748A76BE82A9DC1879F1A198128AC3E /* Kingfisher.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Kingfisher/Kingfisher-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Kingfisher/Kingfisher-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Kingfisher/Kingfisher.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Kingfisher;\n\t\t\t\tPRODUCT_NAME = Kingfisher;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEE7961669F9E9DBEDA9BAFA8940E873C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3E251839724B92B7A217EDE187B2C60F /* Build configuration list for PBXProject \"Kingfisher\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEE7961669F9E9DBEDA9BAFA8940E873C /* Debug */,\n\t\t\t\t5760C9AC75169B9426B31209A4D6235B /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tB6926DC4A63433720DB0689FB26B5A83 /* Build configuration list for PBXNativeTarget \"Kingfisher\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7E3EAFE2FE67BDDA5058FBB2BFE6CABD /* Debug */,\n\t\t\t\tBF9BD488678208045B4D71F7CE6EBBCF /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = A17CCB4923D030263240808F7BC3C92D /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/LICENSE",
    "content": "Copyright (c) 2015 Roy Marmelstein (http://roysapps.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/README.md",
    "content": "[![Platform](https://img.shields.io/cocoapods/p/Localize-Swift.svg?maxAge=2592000)](http://cocoapods.org/?q=Localize-Swift)\n[![Version](http://img.shields.io/cocoapods/v/Localize-Swift.svg)](http://cocoapods.org/?q=Localize-Swift)\n[![Build Status](https://travis-ci.org/marmelroy/Localize-Swift.svg?branch=master)](https://travis-ci.org/marmelroy/Localize-Swift)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n# Localize-Swift\nLocalize-Swift is a simple framework that improves i18n and localization in Swift iOS apps - providing cleaner syntax and in-app language switching.\n\n<p align=\"center\"><img src=\"http://i.imgur.com/vsrpqBt.gif\" width=\"242\" height=\"425\"/></p>\n\n## Features\n\n- Keep the Localizable.strings file your app already uses.\n- Allow your users to change the app's language without changing their device language.\n- Use .localized() instead of NSLocalizedString(key,comment) - a more Swifty syntax.\n- Generate your strings with a new genstrings swift/python script that recognises .localized().\n\n## Usage\n\nImport Localize at the top of each Swift file that will contain localized text.\n\nIf CocoaPods -\n```swift\nimport Localize_Swift\n```\n\nAdd `.localized()` following any `String` object you want translated:\n```swift\ntextLabel.text = \"Hello World\".localized()\n```\n\nTo get an array of available localizations:\n```swift\nLocalize.availableLanguages()\n```\n\nTo change the current language:\n```swift\nLocalize.setCurrentLanguage(\"fr\")\n```\n\nTo update the UI in the view controller where a language change can take place, observe LCLLanguageChangeNotification:\n```swift\nNotificationCenter.default.addObserver(self, selector: #selector(setText), name: NSNotification.Name(LCLLanguageChangeNotification), object: nil)\n```\n\nTo reset back to the default app language:\n```swift\nLocalize.resetCurrentLanguageToDefault()\n```\n\n## genstrings\n\nTo support this new i18n syntax, Localize-Swift includes custom genstrings swift script.\n\nCopy the genstrings.swift file into your project's root folder and run with\n\n```bash\n./genstrings.swift\n```\n\nThis will print the collected strings in the terminal. Select and copy to your default Localizable.strings.\n\nThe script includes the ability to specify excluded directories and files (by editing the script).\n\n### [Preferrred] Setting up with [Swift Package Manager](https://swiftpm.co/?query=Localize-Swift)\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is now the preferred tool for distributing Localize-Swift. \n\nFrom Xcode 11+ :\n\n1. Select File > Swift Packages > Add Package Dependency. Enter `https://github.com/marmelroy/Localize-Swift.git` in the \"Choose Package Repository\" dialog.\n2. In the next page, specify the version resolving rule as \"Up to Next Major\" with \"3.2.0\".\n3. After Xcode checked out the source and resolving the version, you can choose the \"Localize-Swift\" library and add it to your app target.\n\nFor more info, read [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) from Apple.\n\nAlternatively, you can also add Localize-Swift to your `Package.swift` file:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/marmelroy/Localize-Swift.git\", .upToNextMajor(from: \"3.2.0\"))\n]\n```\n\n### Setting up with Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate Localize-Swift into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"marmelroy/Localize-Swift\"\n```\n\n### Setting up with [CocoaPods](http://cocoapods.org/?q=Localize-Swift)\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\npod 'Localize-Swift', '~> 3.2'\n```\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/Sources/Localize.swift",
    "content": "//\n//  Localize.swift\n//  Localize\n//\n//  Created by Roy Marmelstein on 05/08/2015.\n//  Copyright © 2015 Roy Marmelstein. All rights reserved.\n//\n\nimport Foundation\n\n/// Internal current language key\nlet LCLCurrentLanguageKey = \"LCLCurrentLanguageKey\"\n\n/// Default language. English. If English is unavailable defaults to base localization.\nlet LCLDefaultLanguage = \"en\"\n\n/// Base bundle as fallback.\nlet LCLBaseBundle = \"Base\"\n\n/// Name for language change notification\npublic let LCLLanguageChangeNotification = \"LCLLanguageChangeNotification\"\n\n// MARK: Localization Syntax\n\n/**\nSwift 1.x friendly localization syntax, replaces NSLocalizedString\n- Parameter string: Key to be localized.\n- Returns: The localized string.\n*/\npublic func Localized(_ string: String) -> String {\n    return string.localized()\n}\n\n/**\n Swift 1.x friendly localization syntax with format arguments, replaces String(format:NSLocalizedString)\n - Parameter string: Key to be localized.\n - Returns: The formatted localized string with arguments.\n */\npublic func Localized(_ string: String, arguments: CVarArg...) -> String {\n    return String(format: string.localized(), arguments: arguments)\n}\n\n/**\n Swift 1.x friendly plural localization syntax with a format argument\n \n - parameter string:   String to be formatted\n - parameter argument: Argument to determine pluralisation\n \n - returns: Pluralized localized string.\n */\npublic func LocalizedPlural(_ string: String, argument: CVarArg) -> String {\n    return string.localizedPlural(argument)\n}\n\n\npublic extension String {\n    /**\n     Swift 2 friendly localization syntax, replaces NSLocalizedString\n     - Returns: The localized string.\n     */\n    func localized() -> String {\n        return localized(using: nil, in: .main)\n    }\n\n    /**\n     Swift 2 friendly localization syntax with format arguments, replaces String(format:NSLocalizedString)\n     - Returns: The formatted localized string with arguments.\n     */\n    func localizedFormat(_ arguments: CVarArg...) -> String {\n        return String(format: localized(), arguments: arguments)\n    }\n    \n    /**\n     Swift 2 friendly plural localization syntax with a format argument\n     \n     - parameter argument: Argument to determine pluralisation\n     \n     - returns: Pluralized localized string.\n     */\n    func localizedPlural(_ argument: CVarArg) -> String {\n        return NSString.localizedStringWithFormat(localized() as NSString, argument) as String\n    }\n\n    /**\n     Add comment for NSLocalizedString\n     - Returns: The localized string.\n    */\n    func commented(_ argument: String) -> String {\n        return self\n    }\n}\n\n\n\n// MARK: Language Setting Functions\n\nopen class Localize: NSObject {\n    \n    /**\n     List available languages\n     - Returns: Array of available languages.\n     */\n    open class func availableLanguages(_ excludeBase: Bool = false) -> [String] {\n        var availableLanguages = Bundle.main.localizations\n        // If excludeBase = true, don't include \"Base\" in available languages\n        if let indexOfBase = availableLanguages.firstIndex(of: \"Base\") , excludeBase == true {\n            availableLanguages.remove(at: indexOfBase)\n        }\n        return availableLanguages\n    }\n    \n    /**\n     Current language\n     - Returns: The current language. String.\n     */\n    open class func currentLanguage() -> String {\n        if let currentLanguage = UserDefaults.standard.object(forKey: LCLCurrentLanguageKey) as? String {\n            return currentLanguage\n        }\n        return defaultLanguage()\n    }\n    \n    /**\n     Change the current language\n     - Parameter language: Desired language.\n     */\n    open class func setCurrentLanguage(_ language: String) {\n        let selectedLanguage = availableLanguages().contains(language) ? language : defaultLanguage()\n        if (selectedLanguage != currentLanguage()){\n            UserDefaults.standard.set(selectedLanguage, forKey: LCLCurrentLanguageKey)\n            UserDefaults.standard.synchronize()\n            NotificationCenter.default.post(name: Notification.Name(rawValue: LCLLanguageChangeNotification), object: nil)\n        }\n    }\n    \n    /**\n     Default language\n     - Returns: The app's default language. String.\n     */\n    open class func defaultLanguage() -> String {\n        var defaultLanguage: String = String()\n        guard let preferredLanguage = Bundle.main.preferredLocalizations.first else {\n            return LCLDefaultLanguage\n        }\n        let availableLanguages: [String] = self.availableLanguages()\n        if (availableLanguages.contains(preferredLanguage)) {\n            defaultLanguage = preferredLanguage\n        }\n        else {\n            defaultLanguage = LCLDefaultLanguage\n        }\n        return defaultLanguage\n    }\n    \n    /**\n     Resets the current language to the default\n     */\n    open class func resetCurrentLanguageToDefault() {\n        setCurrentLanguage(self.defaultLanguage())\n    }\n    \n    /**\n     Get the current language's display name for a language.\n     - Parameter language: Desired language.\n     - Returns: The localized string.\n     */\n    open class func displayNameForLanguage(_ language: String) -> String {\n        let locale : NSLocale = NSLocale(localeIdentifier: currentLanguage())\n        if let displayName = locale.displayName(forKey: NSLocale.Key.identifier, value: language) {\n            return displayName\n        }\n        return String()\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/Sources/Localize_Swift.h",
    "content": "//\n//  Localize_Swift.h\n//  Localize_Swift\n//\n//  Created by Roy Marmelstein on 21/01/2016.\n//  Copyright © 2020 Roy Marmelstein. All rights reserved.\n//\n\n@import Foundation;\n\n//! Project version number for Localize_Swift.\nFOUNDATION_EXPORT double Localize_SwiftVersionNumber;\n\n//! Project version string for Localize_Swift.\nFOUNDATION_EXPORT const unsigned char Localize_SwiftVersionString[];\n\n// In this header, you should import all the public headers of your framework using statements like #import <Localize_Swift/PublicHeader.h>\n\n\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/Sources/String+LocalizeBundle.swift",
    "content": "//\n//  String+LocalizeBundle.swift\n//  Localize_Swift\n//\n//  Copyright © 2020 Roy Marmelstein. All rights reserved.\n//\n\nimport Foundation\n\n/// bundle friendly extension\npublic extension String {\n    \n    /**\n     Swift 2 friendly localization syntax, replaces NSLocalizedString.\n     \n     - parameter bundle: The receiver’s bundle to search. If bundle is `nil`,\n     the method attempts to use main bundle.\n     \n     - returns: The localized string.\n     */\n    func localized(in bundle: Bundle?) -> String {\n        return localized(using: nil, in: bundle)\n    }\n    \n    /**\n     Swift 2 friendly localization syntax with format arguments, replaces String(format:NSLocalizedString).\n     \n     - parameter arguments: arguments values for temlpate (substituted according to the user’s default locale).\n     \n     - parameter bundle: The receiver’s bundle to search. If bundle is `nil`,\n     the method attempts to use main bundle.\n     \n     - returns: The formatted localized string with arguments.\n     */\n    func localizedFormat(arguments: CVarArg..., in bundle: Bundle?) -> String {\n        return String(format: localized(in: bundle), arguments: arguments)\n    }\n    \n    /**\n     Swift 2 friendly plural localization syntax with a format argument.\n     \n     - parameter argument: Argument to determine pluralisation.\n     \n     - parameter bundle: The receiver’s bundle to search. If bundle is `nil`,\n     the method attempts to use main bundle.\n     \n     - returns: Pluralized localized string.\n     */\n    func localizedPlural(argument: CVarArg, in bundle: Bundle?) -> String {\n        return NSString.localizedStringWithFormat(localized(in: bundle) as NSString, argument) as String\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/Sources/String+LocalizeTableName.swift",
    "content": "//\n//  String+LocalizeTableName.swift\n//  Localize_Swift\n//\n//  Copyright © 2020 Vitalii Budnik. All rights reserved.\n//\n\nimport Foundation\n\n/// tableName friendly extension\npublic extension String {\n    \n    /**\n     Swift 2 friendly localization syntax, replaces NSLocalizedString.\n     \n     - parameter tableName: The receiver’s string table to search. If tableName is `nil`\n     or is an empty string, the method attempts to use `Localizable.strings`.\n     \n     - returns: The localized string.\n     */\n    func localized(using tableName: String?) -> String {\n        return localized(using: tableName, in: .main)\n    }\n    \n    /**\n     Swift 2 friendly localization syntax with format arguments, replaces String(format:NSLocalizedString).\n     \n     - parameter arguments: arguments values for temlpate (substituted according to the user’s default locale).\n\n     - parameter tableName: The receiver’s string table to search. If tableName is `nil`\n     or is an empty string, the method attempts to use `Localizable.strings`.\n     \n     - returns: The formatted localized string with arguments.\n     */\n    func localizedFormat(arguments: CVarArg..., using tableName: String?) -> String {\n        return String(format: localized(using: tableName), arguments: arguments)\n    }\n    \n    /**\n     Swift 2 friendly plural localization syntax with a format argument.\n     \n     - parameter argument: Argument to determine pluralisation.\n\n     - parameter tableName: The receiver’s string table to search. If tableName is `nil`\n     or is an empty string, the method attempts to use `Localizable.strings`.\n     \n     - returns: Pluralized localized string.\n     */\n    func localizedPlural(argument: CVarArg, using tableName: String?) -> String {\n        return NSString.localizedStringWithFormat(localized(using: tableName) as NSString, argument) as String\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/Sources/String+LocalizedBundleTableName.swift",
    "content": "//\n//  String+LocalizedBundleTableName.swift\n//  Localize_Swift\n//\n//  Copyright © 2020 Roy Marmelstein. All rights reserved.\n//\n\nimport Foundation\n\n/// bundle & tableName friendly extension\npublic extension String {\n    \n    /**\n     Swift 2 friendly localization syntax, replaces NSLocalizedString.\n     \n     - parameter tableName: The receiver’s string table to search. If tableName is `nil`\n     or is an empty string, the method attempts to use `Localizable.strings`.\n     \n     - parameter bundle: The receiver’s bundle to search. If bundle is `nil`,\n     the method attempts to use main bundle.\n     \n     - returns: The localized string.\n     */\n    func localized(using tableName: String?, in bundle: Bundle?) -> String {\n        let bundle: Bundle = bundle ?? .main\n        if let path = bundle.path(forResource: Localize.currentLanguage(), ofType: \"lproj\"),\n            let bundle = Bundle(path: path) {\n            return bundle.localizedString(forKey: self, value: nil, table: tableName)\n        }\n        else if let path = bundle.path(forResource: LCLBaseBundle, ofType: \"lproj\"),\n            let bundle = Bundle(path: path) {\n            return bundle.localizedString(forKey: self, value: nil, table: tableName)\n        }\n        return self\n    }\n    \n    /**\n     Swift 2 friendly localization syntax with format arguments, replaces String(format:NSLocalizedString).\n     \n     - parameter arguments: arguments values for temlpate (substituted according to the user’s default locale).\n     \n     - parameter tableName: The receiver’s string table to search. If tableName is `nil`\n     or is an empty string, the method attempts to use `Localizable.strings`.\n     \n     - parameter bundle: The receiver’s bundle to search. If bundle is `nil`,\n     the method attempts to use main bundle.\n     \n     - returns: The formatted localized string with arguments.\n     */\n    func localizedFormat(arguments: CVarArg..., using tableName: String?, in bundle: Bundle?) -> String {\n        return String(format: localized(using: tableName, in: bundle), arguments: arguments)\n    }\n    \n    /**\n     Swift 2 friendly plural localization syntax with a format argument.\n     \n     - parameter argument: Argument to determine pluralisation.\n     \n     - parameter tableName: The receiver’s string table to search. If tableName is `nil`\n     or is an empty string, the method attempts to use `Localizable.strings`.\n     \n     - parameter bundle: The receiver’s bundle to search. If bundle is `nil`,\n     the method attempts to use main bundle.\n     \n     - returns: Pluralized localized string.\n     */\n    func localizedPlural(argument: CVarArg, using tableName: String?, in bundle: Bundle?) -> String {\n        return NSString.localizedStringWithFormat(localized(using: tableName, in: bundle) as NSString, argument) as String\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift/Sources/UI/IBDesignable+Localize.swift",
    "content": "//\n//  IBDesignable+Localize1.swift\n//  Localize-Swift\n//\n//  Copyright © 2020 Roy Marmelstein. All rights reserved.\n//\n\nimport Foundation\nimport UIKit\n\n// MARK: - UILabel localize Key extention for language in story board\n\n@IBDesignable public extension UILabel {\n    @IBInspectable var localizeKey: String? {\n        set {\n            // set new value from dictionary\n            DispatchQueue.main.async {\n                self.text = newValue?.localized()\n            }\n        }\n        get {\n            return self.text\n        }\n    }\n}\n\n// MARK: - UIButton localize Key extention for language in story board\n\n@IBDesignable public extension UIButton {\n\n    @IBInspectable var localizeKey: String? {\n        set {\n            // set new value from dictionary\n            DispatchQueue.main.async {\n                self.setTitle(newValue?.localized(), for: .normal)\n            }\n        }\n        get {\n            return self.titleLabel?.text\n        }\n    }\n}\n\n// MARK: - UITextView localize Key extention for language in story board\n\n@IBDesignable public extension UITextView {\n\n    @IBInspectable var localizeKey: String? {\n        set {\n            // set new value from dictionary\n            DispatchQueue.main.async {\n                self.text = newValue?.localized()\n            }\n        }\n        get {\n            return self.text\n        }\n    }\n}\n\n// MARK: - UITextField localize Key extention for language in story board\n\n@IBDesignable public extension UITextField {\n    @IBInspectable var localizeKey: String? {\n        set {\n            // set new value from dictionary\n            DispatchQueue.main.async {\n                self.placeholder = newValue?.localized()\n            }\n        }\n        get {\n            return self.placeholder\n        }\n    }\n}\n\n// MARK: - UINavigationItem localize Key extention for language in story board\n\n@IBDesignable public extension UINavigationItem {\n\n    @IBInspectable var localizeKey: String? {\n        set {\n            // set new value from dictionary\n            DispatchQueue.main.async {\n                self.title = newValue?.localized()\n            }\n        }\n        get {\n            return self.title\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Localize-Swift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t562526A350A3507214D3C248022FB091 /* String+LocalizedBundleTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CD8A1F339E0CAF64F2BC78E227D6CB /* String+LocalizedBundleTableName.swift */; };\n\t\t6B8BAF555A67FE32A7C71E265E38F0FE /* Localize.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D9DD3DDF1A73DDC70C590747D8BD71 /* Localize.swift */; };\n\t\t78BBE5569B4DB715BD90BDC5AA134151 /* Localize-Swift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D9BD93C04BE9C93E4A3D1033D4235DC /* Localize-Swift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB411877E8124EDB88B5D582067CD6B59 /* String+LocalizeBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA940ECA7A240A32F79EC87848CA6F90 /* String+LocalizeBundle.swift */; };\n\t\tC5F78ABF9F36CB943539E2E201C9F9BA /* Localize-Swift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 01147648C02CB56994428A2600F9208A /* Localize-Swift-dummy.m */; };\n\t\tCB86A43185D4CFBB866879904305717B /* Localize_Swift.h in Headers */ = {isa = PBXBuildFile; fileRef = E24A4FFF4D0A1FD3608740D4FFEB3E2D /* Localize_Swift.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD24B08C7B6F806622C5984D3D842A9A4 /* String+LocalizeTableName.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7689FCF052350A6D1C5525D60C155E /* String+LocalizeTableName.swift */; };\n\t\tE0BF16131EDF69B9B7313997FA0959BA /* IBDesignable+Localize.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4C057DE0BFD50CC0D7DFB3F87D7339F /* IBDesignable+Localize.swift */; };\n\t\tE76DAABA3904A3CD69C06E8C09C7DF05 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D299050059E30E53CD0769FFA27C6768 /* Foundation.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t002AAFD136E4C8B2E48B8C68210316F5 /* Localize-Swift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = \"Localize-Swift\"; path = Localize_Swift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t01147648C02CB56994428A2600F9208A /* Localize-Swift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"Localize-Swift-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t3B71C32C6D826D5CC8C63FCF82B2CBED /* Localize-Swift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"Localize-Swift-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t3D9BD93C04BE9C93E4A3D1033D4235DC /* Localize-Swift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Localize-Swift-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t4721524987FEC6C5BDB4A0366F0C7499 /* Localize-Swift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Localize-Swift-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t5440ABCAA9347E21354405211B81AE16 /* Localize-Swift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"Localize-Swift.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t84CD8A1F339E0CAF64F2BC78E227D6CB /* String+LocalizedBundleTableName.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"String+LocalizedBundleTableName.swift\"; path = \"Sources/String+LocalizedBundleTableName.swift\"; sourceTree = \"<group>\"; };\n\t\t84EC2E07DB1D4548029171AEA2EAFCF9 /* Localize-Swift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"Localize-Swift.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tAA0C561E6EB1FFA48C77CF4E53AAB4C5 /* Localize-Swift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = \"Localize-Swift.modulemap\"; sourceTree = \"<group>\"; };\n\t\tAA940ECA7A240A32F79EC87848CA6F90 /* String+LocalizeBundle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"String+LocalizeBundle.swift\"; path = \"Sources/String+LocalizeBundle.swift\"; sourceTree = \"<group>\"; };\n\t\tB8D9DD3DDF1A73DDC70C590747D8BD71 /* Localize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Localize.swift; path = Sources/Localize.swift; sourceTree = \"<group>\"; };\n\t\tBC7689FCF052350A6D1C5525D60C155E /* String+LocalizeTableName.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"String+LocalizeTableName.swift\"; path = \"Sources/String+LocalizeTableName.swift\"; sourceTree = \"<group>\"; };\n\t\tC4C057DE0BFD50CC0D7DFB3F87D7339F /* IBDesignable+Localize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"IBDesignable+Localize.swift\"; path = \"Sources/UI/IBDesignable+Localize.swift\"; sourceTree = \"<group>\"; };\n\t\tD299050059E30E53CD0769FFA27C6768 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tE24A4FFF4D0A1FD3608740D4FFEB3E2D /* Localize_Swift.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Localize_Swift.h; path = Sources/Localize_Swift.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t00D3A1E09722D209C11F74F00B60F521 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE76DAABA3904A3CD69C06E8C09C7DF05 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t133FDE709B55EF5E7A71C12F79E3A170 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA3555A78EB2EF0B12CE1B4D61D4C10B8 /* Frameworks */,\n\t\t\t\tCA73BBB67B807D9C9897AD34EF14B0E2 /* Localize-Swift */,\n\t\t\t\tAC877C340C697CE4125CA540C3A5A59A /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t60DADA81B85834ECB5E1AE7FBE062D38 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tAA0C561E6EB1FFA48C77CF4E53AAB4C5 /* Localize-Swift.modulemap */,\n\t\t\t\t01147648C02CB56994428A2600F9208A /* Localize-Swift-dummy.m */,\n\t\t\t\t3B71C32C6D826D5CC8C63FCF82B2CBED /* Localize-Swift-Info.plist */,\n\t\t\t\t4721524987FEC6C5BDB4A0366F0C7499 /* Localize-Swift-prefix.pch */,\n\t\t\t\t3D9BD93C04BE9C93E4A3D1033D4235DC /* Localize-Swift-umbrella.h */,\n\t\t\t\t84EC2E07DB1D4548029171AEA2EAFCF9 /* Localize-Swift.debug.xcconfig */,\n\t\t\t\t5440ABCAA9347E21354405211B81AE16 /* Localize-Swift.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/Localize-Swift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7DA4DCAC9825D9C14B7EE9C05FE423A8 /* UIKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC4C057DE0BFD50CC0D7DFB3F87D7339F /* IBDesignable+Localize.swift */,\n\t\t\t);\n\t\t\tname = UIKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA3555A78EB2EF0B12CE1B4D61D4C10B8 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD4278DF2AE209B5A1139F710A820BE42 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA740427EF45B02D297264BDC9DEC6587 /* LocalizeSwiftCore */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB8D9DD3DDF1A73DDC70C590747D8BD71 /* Localize.swift */,\n\t\t\t\tE24A4FFF4D0A1FD3608740D4FFEB3E2D /* Localize_Swift.h */,\n\t\t\t\tAA940ECA7A240A32F79EC87848CA6F90 /* String+LocalizeBundle.swift */,\n\t\t\t\t84CD8A1F339E0CAF64F2BC78E227D6CB /* String+LocalizedBundleTableName.swift */,\n\t\t\t\tBC7689FCF052350A6D1C5525D60C155E /* String+LocalizeTableName.swift */,\n\t\t\t);\n\t\t\tname = LocalizeSwiftCore;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tAC877C340C697CE4125CA540C3A5A59A /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t002AAFD136E4C8B2E48B8C68210316F5 /* Localize-Swift */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCA73BBB67B807D9C9897AD34EF14B0E2 /* Localize-Swift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA740427EF45B02D297264BDC9DEC6587 /* LocalizeSwiftCore */,\n\t\t\t\t60DADA81B85834ECB5E1AE7FBE062D38 /* Support Files */,\n\t\t\t\t7DA4DCAC9825D9C14B7EE9C05FE423A8 /* UIKit */,\n\t\t\t);\n\t\t\tname = \"Localize-Swift\";\n\t\t\tpath = \"Localize-Swift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD4278DF2AE209B5A1139F710A820BE42 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD299050059E30E53CD0769FFA27C6768 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tC806DE5A93110DB5C8D076787B0A117B /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t78BBE5569B4DB715BD90BDC5AA134151 /* Localize-Swift-umbrella.h in Headers */,\n\t\t\t\tCB86A43185D4CFBB866879904305717B /* Localize_Swift.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t6C27EEC63FEC06A9DAB03531B0989F47 /* Localize-Swift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 43AE869A729607C5FDE5CEB3341E886A /* Build configuration list for PBXNativeTarget \"Localize-Swift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tC806DE5A93110DB5C8D076787B0A117B /* Headers */,\n\t\t\t\t718D544A94F77CFF58BFDAC4214F9667 /* Sources */,\n\t\t\t\t00D3A1E09722D209C11F74F00B60F521 /* Frameworks */,\n\t\t\t\t71EE512872BE967A3321D215949A0B27 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"Localize-Swift\";\n\t\t\tproductName = Localize_Swift;\n\t\t\tproductReference = 002AAFD136E4C8B2E48B8C68210316F5 /* Localize-Swift */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tF452240E32906E5EF4F114447023D9FB /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 293D25F2BDA86DFC063B8C0C9B5881A4 /* Build configuration list for PBXProject \"Localize-Swift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 133FDE709B55EF5E7A71C12F79E3A170;\n\t\t\tproductRefGroup = AC877C340C697CE4125CA540C3A5A59A /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t6C27EEC63FEC06A9DAB03531B0989F47 /* Localize-Swift */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t71EE512872BE967A3321D215949A0B27 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t718D544A94F77CFF58BFDAC4214F9667 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE0BF16131EDF69B9B7313997FA0959BA /* IBDesignable+Localize.swift in Sources */,\n\t\t\t\t6B8BAF555A67FE32A7C71E265E38F0FE /* Localize.swift in Sources */,\n\t\t\t\tC5F78ABF9F36CB943539E2E201C9F9BA /* Localize-Swift-dummy.m in Sources */,\n\t\t\t\tB411877E8124EDB88B5D582067CD6B59 /* String+LocalizeBundle.swift in Sources */,\n\t\t\t\t562526A350A3507214D3C248022FB091 /* String+LocalizedBundleTableName.swift in Sources */,\n\t\t\t\tD24B08C7B6F806622C5984D3D842A9A4 /* String+LocalizeTableName.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\tA131D05C19BD446370EF28BF2AD2A0B9 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5440ABCAA9347E21354405211B81AE16 /* Localize-Swift.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Localize-Swift/Localize-Swift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Localize-Swift/Localize-Swift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Localize-Swift/Localize-Swift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Localize_Swift;\n\t\t\t\tPRODUCT_NAME = Localize_Swift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD4216941692F09DBB4495AC138CFB93E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 84EC2E07DB1D4548029171AEA2EAFCF9 /* Localize-Swift.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Localize-Swift/Localize-Swift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Localize-Swift/Localize-Swift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Localize-Swift/Localize-Swift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Localize_Swift;\n\t\t\t\tPRODUCT_NAME = Localize_Swift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEE37C7C4B8026456DDAC4325C66CEB5A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tF9C08840DEB3545189ED9FB3B9A104C9 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t293D25F2BDA86DFC063B8C0C9B5881A4 /* Build configuration list for PBXProject \"Localize-Swift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tF9C08840DEB3545189ED9FB3B9A104C9 /* Debug */,\n\t\t\t\tEE37C7C4B8026456DDAC4325C66CEB5A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t43AE869A729607C5FDE5CEB3341E886A /* Build configuration list for PBXNativeTarget \"Localize-Swift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD4216941692F09DBB4495AC138CFB93E /* Debug */,\n\t\t\t\tA131D05C19BD446370EF28BF2AD2A0B9 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = F452240E32906E5EF4F114447023D9FB /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/README.md",
    "content": "![Preview](https://cdn.lookin.work/public/style/images/independent/homepage/preview_en_1x.jpg \"Preview\")\n\nLookin 可以查看与修改 iOS App 里的 UI 对象，类似于 Xcode 自带的 UI Inspector 工具，或另一款叫做 Reveal 的软件。\n官网：https://lookin.work/\n\n如果这是你的 iOS 项目第一次使用 Lookin，则需要先把 Lookin 的 iOS Framework 嵌入到你的 iOS 项目中，教程：\nhttps://lookin.work/faq/integration-guide/\n\n----------\n\nYou can inspect and modify views in iOS app via Lookin, just like UI Inspector in Xcode, or another app called Reveal.\nWebsite：https://lookin.work/\n\nTo use Lookin, you need to embed the iOS Framework of Lookin into your iOS project. Tutorial:\nhttps://lookin.work/faq/integration-guide/\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/CALayer+LookinServer.h",
    "content": "//\n//  UIView+LookinMobile.h\n//  WeRead\n//\n//  Created by Li Kai on 2018/11/30.\n//  Copyright © 2018 tencent. All rights reserved.\n//\n\n#import \"LookinDefines.h\"\n#import \"TargetConditionals.h\"\n#import <UIKit/UIKit.h>\n\n@interface CALayer (LookinServer)\n\n@property(nonatomic, weak) UIView *lks_hostView;\n\n- (UIWindow *)lks_window;\n\n- (CGRect)lks_frameInWindow:(UIWindow *)window;\n\n@property(nonatomic, assign) BOOL lks_isLookinPrivateLayer;\n\n/// 如果该属性为 YES，则该 layer 及所有下级 layers 均不会被转为 LookinDisplayItem\n@property(nonatomic, assign) BOOL lks_avoidCapturing;\n\n- (UIImage *)lks_groupScreenshotWithLowQuality:(BOOL)lowQuality;\n/// 当没有 sublayers 时，该方法返回 nil\n- (UIImage *)lks_soloScreenshotWithLowQuality:(BOOL)lowQuality;\n\n/// 获取和该对象有关的对象的 Class 层级树\n- (NSArray<NSArray<NSString *> *> *)lks_relatedClassChainList;\n\n- (NSArray<NSString *> *)lks_selfRelation;\n\n@property(nonatomic, strong) UIColor *lks_backgroundColor;\n@property(nonatomic, strong) UIColor *lks_borderColor;\n@property(nonatomic, strong) UIColor *lks_shadowColor;\n@property(nonatomic, assign) CGFloat lks_shadowOffsetWidth;\n@property(nonatomic, assign) CGFloat lks_shadowOffsetHeight;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/CALayer+LookinServer.m",
    "content": "//\n//  UIView+LookinMobile.m\n//  WeRead\n//\n//  Created by Li Kai on 2018/11/30.\n//  Copyright © 2018 tencent. All rights reserved.\n//\n\n#import \"CALayer+LookinServer.h\"\n#import \"LKS_HierarchyDisplayItemsMaker.h\"\n#import \"LookinDisplayItem.h\"\n#import \"LKS_LocalInspectManager.h\"\n#import <objc/runtime.h>\n#import \"LKS_ConnectionManager.h\"\n#import \"LookinIvarTrace.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation CALayer (LookinServer)\n\n- (void)setLks_isLookinPrivateLayer:(BOOL)lks_isLookinPrivateLayer {\n    [self lookin_bindBOOL:lks_isLookinPrivateLayer forKey:@\"lks_isLookinPrivateLayer\"];\n}\n\n- (BOOL)lks_isLookinPrivateLayer {\n    return [self lookin_getBindBOOLForKey:@\"lks_isLookinPrivateLayer\"];\n}\n\n- (UIWindow *)lks_window {\n    CALayer *layer = self;\n    while (layer) {\n        UIView *hostView = layer.lks_hostView;\n        if (hostView.window) {\n            return hostView.window;\n        } else if ([hostView isKindOfClass:[UIWindow class]]) {\n            return (UIWindow *)hostView;\n        }\n        layer = layer.superlayer;\n    }\n    return nil;\n}\n\n- (BOOL)lks_inLookinPrivateHierarchy {\n    BOOL boolValue = NO;\n    CALayer *layer = self;\n    while (layer) {\n        if (layer.lks_isLookinPrivateLayer) {\n            boolValue = YES;\n            break;\n        }\n        layer = layer.superlayer;\n    }\n    return boolValue;\n}\n\n- (CGRect)lks_frameInWindow:(UIWindow *)window {\n    UIWindow *selfWindow = [self lks_window];\n    if (!selfWindow) {\n        return CGRectZero;\n    }\n    \n    CGRect rectInSelfWindow = [selfWindow.layer convertRect:self.frame fromLayer:self.superlayer];\n    CGRect rectInWindow = [window convertRect:rectInSelfWindow fromWindow:selfWindow];\n    return rectInWindow;\n}\n\n- (void)setLks_avoidCapturing:(BOOL)lks_avoidCapturing {\n    [self lookin_bindBOOL:lks_avoidCapturing forKey:@\"lks_avoidCapturing\"];\n}\n\n- (BOOL)lks_avoidCapturing {\n    return [self lookin_getBindBOOLForKey:@\"lks_avoidCapturing\"];\n}\n\n#pragma mark - Host View\n\n- (void)setLks_hostView:(UIView *)lks_hostView {\n    [self lookin_bindObjectWeakly:lks_hostView forKey:@\"lks_hostView\"];\n}\n\n- (UIView *)lks_hostView {\n    return [self lookin_getBindObjectForKey:@\"lks_hostView\"];\n}\n\n#pragma mark - Screenshot\n\n- (UIImage *)lks_groupScreenshotWithLowQuality:(BOOL)lowQuality {\n    \n    CGFloat screenScale = [UIScreen mainScreen].scale;\n    CGFloat pixelWidth = self.bounds.size.width * screenScale;\n    CGFloat pixelHeight = self.bounds.size.height * screenScale;\n    if (pixelWidth <= 0 || pixelHeight <= 0) {\n        return nil;\n    }\n    \n    CGFloat renderScale = lowQuality ? 1 : 0;\n    CGFloat maxLength = MAX(pixelWidth, pixelHeight);\n    if (maxLength > LookinNodeImageMaxLengthInPx) {\n        // 确保最终绘制出的图片长和宽都不能超过 LookinNodeImageMaxLengthInPx\n        // 如果算出的 renderScale 大于 1 则取 1，因为似乎用 1 渲染的速度要比一个别的奇怪的带小数点的数字要更快\n        renderScale = MIN(screenScale * LookinNodeImageMaxLengthInPx / maxLength, 1);\n    }\n    \n    UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, renderScale);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    if (self.lks_hostView && !self.lks_hostView.lks_isChildrenViewOfTabBar) {\n        [self.lks_hostView drawViewHierarchyInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) afterScreenUpdates:YES];\n    } else {\n        [self renderInContext:context];\n    }\n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n- (UIImage *)lks_soloScreenshotWithLowQuality:(BOOL)lowQuality {\n    if (!self.sublayers.count) {\n        return nil;\n    }\n    \n    CGFloat screenScale = [UIScreen mainScreen].scale;\n    CGFloat pixelWidth = self.bounds.size.width * screenScale;\n    CGFloat pixelHeight = self.bounds.size.height * screenScale;\n    if (pixelWidth <= 0 || pixelHeight <= 0) {\n        return nil;\n    }\n    \n    CGFloat renderScale = lowQuality ? 1 : 0;\n    CGFloat maxLength = MAX(pixelWidth, pixelHeight);\n    if (maxLength > LookinNodeImageMaxLengthInPx) {\n        // 确保最终绘制出的图片长和宽都不能超过 LookinNodeImageMaxLengthInPx\n        // 如果算出的 renderScale 大于 1 则取 1，因为似乎用 1 渲染的速度要比一个别的奇怪的带小数点的数字要更快\n        renderScale = MIN(screenScale * LookinNodeImageMaxLengthInPx / maxLength, 1);\n    }\n    \n    if (self.sublayers.count) {\n        NSArray<CALayer *> *sublayers = [self.sublayers copy];\n        NSMutableArray<CALayer *> *visibleSublayers = [NSMutableArray arrayWithCapacity:sublayers.count];\n        [sublayers enumerateObjectsUsingBlock:^(__kindof CALayer * _Nonnull sublayer, NSUInteger idx, BOOL * _Nonnull stop) {\n            if (!sublayer.hidden) {\n                sublayer.hidden = YES;\n                [visibleSublayers addObject:sublayer];\n            }\n        }];\n        \n        UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, renderScale);\n        CGContextRef context = UIGraphicsGetCurrentContext();\n        if (self.lks_hostView && !self.lks_hostView.lks_isChildrenViewOfTabBar) {\n            [self.lks_hostView drawViewHierarchyInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) afterScreenUpdates:YES];\n        } else {\n            [self renderInContext:context];\n        }\n        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        \n        [visibleSublayers enumerateObjectsUsingBlock:^(CALayer * _Nonnull sublayer, NSUInteger idx, BOOL * _Nonnull stop) {\n            sublayer.hidden = NO;\n        }];\n        \n        return image;\n    }\n    return nil;\n}\n\n- (NSArray<NSArray<NSString *> *> *)lks_relatedClassChainList {\n    NSMutableArray *array = [NSMutableArray arrayWithCapacity:2];\n    if (self.lks_hostView) {\n        [array addObject:[CALayer lks_getClassListOfObject:self.lks_hostView endingClass:@\"UIView\"]];\n        if (self.lks_hostView.lks_hostViewController) {\n            [array addObject:[CALayer lks_getClassListOfObject:self.lks_hostView.lks_hostViewController endingClass:@\"UIViewController\"]];\n        }\n    } else {\n        [array addObject:[CALayer lks_getClassListOfObject:self endingClass:@\"CALayer\"]];\n    }\n    return array.copy;\n}\n\n+ (NSArray<NSString *> *)lks_getClassListOfObject:(id)object endingClass:(NSString *)endingClass {\n    NSArray<NSString *> *completedList = [object lks_classChainListWithSwiftPrefix:NO];\n    NSUInteger endingIdx = [completedList indexOfObject:endingClass];\n    if (endingIdx != NSNotFound) {\n        completedList = [completedList subarrayWithRange:NSMakeRange(0, endingIdx + 1)];\n    }\n    return completedList;\n}\n\n- (NSArray<NSString *> *)lks_selfRelation {\n    NSMutableArray *array = [NSMutableArray array];\n    NSMutableArray<LookinIvarTrace *> *ivarTraces = [NSMutableArray array];\n    if (self.lks_hostView) {\n        if (self.lks_hostView.lks_hostViewController) {\n            [array addObject:[NSString stringWithFormat:@\"(%@ *).view\", NSStringFromClass(self.lks_hostView.lks_hostViewController.class)]];\n            \n            [ivarTraces addObjectsFromArray:self.lks_hostView.lks_hostViewController.lks_ivarTraces];\n        }\n        [ivarTraces addObjectsFromArray:self.lks_hostView.lks_ivarTraces];\n    } else {\n        [ivarTraces addObjectsFromArray:self.lks_ivarTraces];\n    }\n    if (ivarTraces.count) {\n        [array addObjectsFromArray:[ivarTraces lookin_map:^id(NSUInteger idx, LookinIvarTrace *value) {\n            return [NSString stringWithFormat:@\"(%@ *) -> %@\", value.hostClassName, value.ivarName];\n        }]];\n    }\n    return array.count ? array.copy : nil;\n}\n\n- (UIColor *)lks_backgroundColor {\n    return [UIColor colorWithCGColor:self.backgroundColor];\n}\n- (void)setLks_backgroundColor:(UIColor *)lks_backgroundColor {\n    self.backgroundColor = lks_backgroundColor.CGColor;\n}\n\n- (UIColor *)lks_borderColor {\n    return [UIColor colorWithCGColor:self.borderColor];\n}\n- (void)setLks_borderColor:(UIColor *)lks_borderColor {\n    self.borderColor = lks_borderColor.CGColor;\n}\n\n- (UIColor *)lks_shadowColor {\n    return [UIColor colorWithCGColor:self.shadowColor];\n}\n- (void)setLks_shadowColor:(UIColor *)lks_shadowColor {\n    self.shadowColor = lks_shadowColor.CGColor;\n}\n\n- (CGFloat)lks_shadowOffsetWidth {\n    return self.shadowOffset.width;\n}\n- (void)setLks_shadowOffsetWidth:(CGFloat)lks_shadowOffsetWidth {\n    self.shadowOffset = CGSizeMake(lks_shadowOffsetWidth, self.shadowOffset.height);\n}\n\n- (CGFloat)lks_shadowOffsetHeight {\n    return self.shadowOffset.height;\n}\n- (void)setLks_shadowOffsetHeight:(CGFloat)lks_shadowOffsetHeight {\n    self.shadowOffset = CGSizeMake(self.shadowOffset.width, lks_shadowOffsetHeight);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/NSObject+LookinServer.h",
    "content": "//\n//  NSObject+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/4/21.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n#import <Foundation/Foundation.h>\n\n@class LookinIvarTrace;\n\n@interface NSObject (LookinServer)\n\n#pragma mark - oid\n\n/// 如果 oid 不存在则会创建新的 oid\n- (unsigned long)lks_registerOid;\n\n/// 0 表示不存在\n@property(nonatomic, assign) unsigned long lks_oid;\n\n+ (NSObject *)lks_objectWithOid:(unsigned long)oid;\n\n#pragma mark - trace\n\n@property(nonatomic, copy) NSArray<LookinIvarTrace *> *lks_ivarTraces;\n\n@property(nonatomic, copy) NSString *lks_specialTrace;\n\n+ (void)lks_clearAllObjectsTraces;\n\n/**\n 获取当前对象的 Class 层级树，如 @[@\"UIView\", @\"UIResponder\", @\"NSObject\"]\n hasSwiftPrefix 决定了是否在 Swift 项目中显示类名前缀\n */\n- (NSArray<NSString *> *)lks_classChainListWithSwiftPrefix:(BOOL)hasSwiftPrefix;\n\n/// 返回当前类名，Swift 项目下将返回不带前缀的名称\n- (NSString *)lks_shortClassName;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/NSObject+LookinServer.m",
    "content": "//\n//  NSObject+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/4/21.\n//  https://lookin.work\n//\n\n#import \"NSObject+Lookin.h\"\n#import \"NSObject+LookinServer.h\"\n#import \"LookinServerDefines.h\"\n#import \"LKS_ObjectRegistry.h\"\n#import <objc/runtime.h>\n\n@implementation NSObject (LookinServer)\n\n#pragma mark - oid\n\n- (unsigned long)lks_registerOid {\n    if (!self.lks_oid) {\n        unsigned long oid = [[LKS_ObjectRegistry sharedInstance] addObject:self];\n        self.lks_oid = oid;\n    }\n    return self.lks_oid;\n}\n\n- (void)setLks_oid:(unsigned long)lks_oid {\n    [self lookin_bindObject:@(lks_oid) forKey:@\"lks_oid\"];\n}\n\n- (unsigned long)lks_oid {\n    NSNumber *number = [self lookin_getBindObjectForKey:@\"lks_oid\"];\n    return [number unsignedLongValue];\n}\n\n+ (NSObject *)lks_objectWithOid:(unsigned long)oid {\n    return [[LKS_ObjectRegistry sharedInstance] objectWithOid:oid];\n}\n\n#pragma mark - trace\n\n- (void)setLks_ivarTraces:(NSArray<LookinIvarTrace *> *)lks_ivarTraces {\n    [self lookin_bindObject:lks_ivarTraces.copy forKey:@\"lks_ivarTraces\"];\n    \n    if (lks_ivarTraces) {\n        [[NSObject lks_allObjectsWithTraces] addPointer:(void *)self];\n    }\n}\n\n- (NSArray<LookinIvarTrace *> *)lks_ivarTraces {\n    return [self lookin_getBindObjectForKey:@\"lks_ivarTraces\"];\n}\n\n- (void)setLks_specialTrace:(NSString *)lks_specialTrace {\n    [self lookin_bindObject:lks_specialTrace forKey:@\"lks_specialTrace\"];\n    if (lks_specialTrace) {\n        [[NSObject lks_allObjectsWithTraces] addPointer:(void *)self];\n    }\n}\n- (NSString *)lks_specialTrace {\n    return [self lookin_getBindObjectForKey:@\"lks_specialTrace\"];\n}\n\n+ (void)lks_clearAllObjectsTraces {\n    [[[NSObject lks_allObjectsWithTraces] allObjects] enumerateObjectsUsingBlock:^(NSObject * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        obj.lks_ivarTraces = nil;\n        obj.lks_specialTrace = nil;\n    }];\n    [NSObject lks_allObjectsWithTraces].count = 0;\n}\n\n+ (NSPointerArray *)lks_allObjectsWithTraces {\n    static dispatch_once_t onceToken;\n    static NSPointerArray *lks_allObjectsWithTraces = nil;\n    dispatch_once(&onceToken,^{\n        lks_allObjectsWithTraces = [NSPointerArray weakObjectsPointerArray];\n    });\n    return lks_allObjectsWithTraces;\n}\n\n- (NSArray<NSString *> *)lks_classChainListWithSwiftPrefix:(BOOL)hasSwiftPrefix {\n    NSMutableArray<NSString *> *classChainList = [NSMutableArray array];\n    Class currentClass = self.class;\n    \n    while (currentClass) {\n        NSString *rawClassName = NSStringFromClass(currentClass);\n        \n        NSString *currentClassName = hasSwiftPrefix ? rawClassName : [rawClassName lookin_shortClassNameString];\n        if (currentClassName) {\n            [classChainList addObject:currentClassName];\n        }\n        currentClass = [currentClass superclass];\n    }\n    return classChainList.copy;\n}\n\n- (NSString *)lks_shortClassName {\n    NSString *rawName = NSStringFromClass([self class]);\n    NSString *shortName = [rawName lookin_shortClassNameString];\n    return shortName;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIBlurEffect+LookinServer.h",
    "content": "//\n//  UIBlurEffect+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/10/8.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UIBlurEffect (LookinServer)\n\n/// 该 number 包装的对象是 UIBlurEffectStyle，之所以用 NSNumber 是因为想把 0 和 nil 区分开，毕竟这里是在 hook 系统，稳一点好。\n@property(nonatomic, strong) NSNumber *lks_effectStyleNumber;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIBlurEffect+LookinServer.m",
    "content": "//\n//  UIBlurEffect+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/10/8.\n//  https://lookin.work\n//\n\n#import \"UIBlurEffect+LookinServer.h\"\n#import \"NSObject+Lookin.h\"\n#import <objc/runtime.h>\n\n@implementation UIBlurEffect (LookinServer)\n\n+ (void)load {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        Method oriMethod = class_getClassMethod([self class], @selector(effectWithStyle:));\n        Method newMethod = class_getClassMethod([self class], @selector(lks_effectWithStyle:));\n        method_exchangeImplementations(oriMethod, newMethod);\n    });\n}\n\n+ (UIBlurEffect *)lks_effectWithStyle:(UIBlurEffectStyle)style {\n    id effect = [self lks_effectWithStyle:style];\n    if ([effect respondsToSelector:@selector(setLks_effectStyleNumber:)]) {\n        [effect setLks_effectStyleNumber:@(style)];\n    }\n    return effect;\n}\n\n- (void)setLks_effectStyleNumber:(NSNumber *)lks_effectStyleNumber {\n    [self lookin_bindObject:lks_effectStyleNumber forKey:@\"lks_effectStyleNumber\"];\n}\n\n- (NSNumber *)lks_effectStyleNumber {\n    return [self lookin_getBindObjectForKey:@\"lks_effectStyleNumber\"];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIColor+LookinServer.h",
    "content": "//\n//  UIColor+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/5.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UIColor (LookinServer)\n\n- (NSArray<NSNumber *> *)lks_rgbaComponents;\n+ (instancetype)lks_colorFromRGBAComponents:(NSArray<NSNumber *> *)components;\n\n- (NSString *)lks_rgbaString;\n- (NSString *)lks_hexString;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIColor+LookinServer.m",
    "content": "//\n//  UIColor+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/5.\n//  https://lookin.work\n//\n\n#import \"UIColor+LookinServer.h\"\n\n@implementation UIColor (LookinServer)\n\n- (NSArray<NSNumber *> *)lks_rgbaComponents {\n    CGFloat r, g, b, a;\n    CGColorRef cgColor = [self CGColor];\n    const CGFloat *components = CGColorGetComponents(cgColor);\n    if (CGColorGetNumberOfComponents(cgColor) == 4) {\n        r = components[0];\n        g = components[1];\n        b = components[2];\n        a = components[3];\n    } else if (CGColorGetNumberOfComponents(cgColor) == 2) {\n        r = components[0];\n        g = components[0];\n        b = components[0];\n        a = components[1];\n    } else if (CGColorGetNumberOfComponents(cgColor) == 1) {\n        r = components[0];\n        g = components[0];\n        b = components[0];\n        a = components[0];\n    } else {\n        r = 0;\n        g = 0;\n        b = 0;\n        a = 0;\n        NSAssert(NO, @\"\");\n    }\n    NSArray<NSNumber *> *rgba = @[@(r), @(g), @(b), @(a)];\n    return rgba;\n}\n\n+ (instancetype)lks_colorFromRGBAComponents:(NSArray<NSNumber *> *)components {\n    if (!components) {\n        return nil;\n    }\n    if (components.count != 4) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    UIColor *color = [UIColor colorWithRed:components[0].doubleValue green:components[1].doubleValue blue:components[2].doubleValue alpha:components[3].doubleValue];\n    return color;\n}\n\n- (NSString *)lks_rgbaString {\n    CGFloat r, g, b, a;\n    CGColorRef cgColor = [self CGColor];\n    const CGFloat *components = CGColorGetComponents(cgColor);\n    if (CGColorGetNumberOfComponents(cgColor) == 4) {\n        r = components[0];\n        g = components[1];\n        b = components[2];\n        a = components[3];\n    } else if (CGColorGetNumberOfComponents(cgColor) == 2) {\n        r = components[0];\n        g = components[0];\n        b = components[0];\n        a = components[1];\n    } else {\n        r = 0;\n        g = 0;\n        b = 0;\n        a = 0;\n        NSAssert(NO, @\"\");\n    }\n    \n    if (a >= 1) {\n        return [NSString stringWithFormat:@\"(%.0f, %.0f, %.0f)\", r * 255, g * 255, b * 255];\n    } else {\n        return [NSString stringWithFormat:@\"(%.0f, %.0f, %.0f, %.2f)\", r * 255, g * 255, b * 255, a];\n    }\n}\n\n- (NSString *)lks_hexString {\n    CGFloat r, g, b, a;\n    CGColorRef cgColor = [self CGColor];\n    const CGFloat *components = CGColorGetComponents(cgColor);\n    if (CGColorGetNumberOfComponents(cgColor) == 4) {\n        r = components[0];\n        g = components[1];\n        b = components[2];\n        a = components[3];\n    } else if (CGColorGetNumberOfComponents(cgColor) == 2) {\n        r = components[0];\n        g = components[0];\n        b = components[0];\n        a = components[1];\n    } else {\n        r = 0;\n        g = 0;\n        b = 0;\n        a = 0;\n        NSAssert(NO, @\"\");\n    }\n    \n    NSInteger red = r * 255;\n    NSInteger green = g * 255;\n    NSInteger blue = b * 255;\n    NSInteger alpha = a * 255;\n    \n    return [[NSString stringWithFormat:@\"#%@%@%@%@\",\n             [UIColor _alignColorHexStringLength:[UIColor _hexStringWithInteger:alpha]],\n             [UIColor _alignColorHexStringLength:[UIColor _hexStringWithInteger:red]],\n             [UIColor _alignColorHexStringLength:[UIColor _hexStringWithInteger:green]],\n             [UIColor _alignColorHexStringLength:[UIColor _hexStringWithInteger:blue]]] lowercaseString];\n}\n\n// 对于色值只有单位数的，在前面补一个0，例如“F”会补齐为“0F”\n+ (NSString *)_alignColorHexStringLength:(NSString *)hexString {\n    return hexString.length < 2 ? [@\"0\" stringByAppendingString:hexString] : hexString;\n}\n\n+ (NSString *)_hexStringWithInteger:(NSInteger)integer {\n    NSString *hexString = @\"\";\n    NSInteger remainder = 0;\n    for (NSInteger i = 0; i < 9; i++) {\n        remainder = integer % 16;\n        integer = integer / 16;\n        NSString *letter = [self _hexLetterStringWithInteger:remainder];\n        hexString = [letter stringByAppendingString:hexString];\n        if (integer == 0) {\n            break;\n        }\n        \n    }\n    return hexString;\n}\n\n+ (NSString *)_hexLetterStringWithInteger:(NSInteger)integer {\n    NSAssert(integer < 16, @\"要转换的数必须是16进制里的个位数，也即小于16，但你传给我是%@\", @(integer));\n    \n    NSString *letter = nil;\n    switch (integer) {\n        case 10:\n            letter = @\"A\";\n            break;\n        case 11:\n            letter = @\"B\";\n            break;\n        case 12:\n            letter = @\"C\";\n            break;\n        case 13:\n            letter = @\"D\";\n            break;\n        case 14:\n            letter = @\"E\";\n            break;\n        case 15:\n            letter = @\"F\";\n            break;\n        default:\n            letter = [[NSString alloc]initWithFormat:@\"%@\", @(integer)];\n            break;\n    }\n    return letter;\n}\n\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIGestureRecognizer+LookinServer.h",
    "content": "//\n//  UIGestureRecognizer+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/8/14.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@class LookinTwoTuple;\n\n@interface UIGestureRecognizer (LookinServer)\n\n/// tuple.first => LookinWeakContainer(包裹着 target)，tuple.second => action(方法名字符串)\n@property(nonatomic, strong) NSMutableArray<LookinTwoTuple *> *lks_targetActions;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIGestureRecognizer+LookinServer.m",
    "content": "//\n//  UIGestureRecognizer+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/8/14.\n//  https://lookin.work\n//\n\n#import \"UIGestureRecognizer+LookinServer.h\"\n#import <objc/runtime.h>\n#import \"NSObject+Lookin.h\"\n#import \"LookinTuple.h\"\n#import \"LookinWeakContainer.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation UIGestureRecognizer (LookinServer)\n\n#pragma mark - Hook\n\n+ (void)load {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        Method oriMethod = class_getInstanceMethod([self class], @selector(initWithTarget:action:));\n        Method newMethod = class_getInstanceMethod([self class], @selector(lks_initWithTarget:action:));\n        method_exchangeImplementations(oriMethod, newMethod);\n        \n        oriMethod = class_getInstanceMethod([self class], @selector(addTarget:action:));\n        newMethod = class_getInstanceMethod([self class], @selector(lks_addTarget:action:));\n        method_exchangeImplementations(oriMethod, newMethod);\n        \n        oriMethod = class_getInstanceMethod([self class], @selector(removeTarget:action:));\n        newMethod = class_getInstanceMethod([self class], @selector(lks_removeTarget:action:));\n        method_exchangeImplementations(oriMethod, newMethod);\n    });\n}\n\n- (instancetype)lks_initWithTarget:(nullable id)target action:(nullable SEL)action {\n    UIGestureRecognizer *instance = [self lks_initWithTarget:target action:action];\n    [instance lks_didAddTarget:target action:NSStringFromSelector(action)];\n    return instance;\n}\n\n- (void)lks_addTarget:(id)target action:(SEL)action {\n    [self lks_addTarget:target action:action];\n    [self lks_didAddTarget:target action:NSStringFromSelector(action)];\n}\n\n- (void)lks_removeTarget:(id)target action:(SEL)action {\n    [self lks_removeTarget:target action:action];\n    [self lks_didRemoveTarget:target action:NSStringFromSelector(action)];\n}\n\n#pragma mark - Main\n\n- (void)lks_didAddTarget:(id)target action:(NSString *)action {\n    if (!target || !action.length) {\n        return;\n    }\n    BOOL alreadyExist = [self.lks_targetActions lookin_any:^BOOL(LookinTwoTuple *obj) {\n        id existTarget = ((LookinWeakContainer *)obj.first).object;\n        NSString *existAction = (NSString *)obj.second;\n        if (target == existTarget && [action isEqualToString:existAction]) {\n            return YES;\n        }\n        return NO;\n    }];\n    if (alreadyExist) {\n        return;\n    }\n    LookinTwoTuple *newTuple = [LookinTwoTuple new];\n    newTuple.first = [LookinWeakContainer containerWithObject:target];\n    newTuple.second = action;\n    if (!self.lks_targetActions) {\n        self.lks_targetActions = [NSMutableArray array];\n    }\n    [self.lks_targetActions addObject:newTuple];\n}\n\n- (void)lks_didRemoveTarget:(id)target action:(NSString *)action {\n    if (target == nil && action == nil) {\n        // target 为 nil，action 为 nil 时，表示移除所有 target 的所有已注册监听方法\n        [self.lks_targetActions removeAllObjects];\n        return;\n    }\n    \n    if (target == nil) {\n        // target 为 nil，action 为 handleTap 时，表示移除所有 target 的名为 handleTap 的监听方法\n        [self.lks_targetActions lookin_removeObjectsPassingTest:^BOOL(NSUInteger idx, LookinTwoTuple *obj) {\n            NSString *currentAction = (NSString *)obj.second;\n            if ([currentAction isEqualToString:action]) {\n                return YES;\n            }\n            return NO;\n        }];\n        return;\n    }\n    \n    if (action == nil) {\n        // target 为 abc，action 为 nil 时，表示移除 abc 的所有已注册监听方法\n        [self.lks_targetActions lookin_removeObjectsPassingTest:^BOOL(NSUInteger idx, LookinTwoTuple *obj) {\n            id currentTarget = ((LookinWeakContainer *)obj.first).object;\n            if (currentTarget == target) {\n                return YES;\n            }\n            return NO;\n        }];\n        return;\n    }\n    \n    [self.lks_targetActions lookin_removeObjectsPassingTest:^BOOL(NSUInteger idx, LookinTwoTuple *obj) {\n        id currentTarget = ((LookinWeakContainer *)obj.first).object;\n        NSString *currentAction = (NSString *)obj.second;\n        if (currentTarget == target && [currentAction isEqualToString:action]) {\n            return YES;\n        }\n        return NO;\n    }];\n}\n\n- (void)setLks_targetActions:(NSMutableArray<LookinTwoTuple *> *)lks_targetActions {\n    [self lookin_bindObject:lks_targetActions forKey:@\"lks_targetActions\"];\n}\n\n- (NSMutableArray *)lks_targetActions {\n    return [self lookin_getBindObjectForKey:@\"lks_targetActions\"];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIImage+LookinServer.h",
    "content": "//\n//  UIImage+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/14.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UIImage (LookinServer)\n\n@property(nonatomic, copy) NSString *lks_imageSourceName;\n\n- (NSData *)lookin_data;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIImage+LookinServer.m",
    "content": "//\n//  UIImage+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/14.\n//  https://lookin.work\n//\n\n#import \"UIImage+LookinServer.h\"\n#import \"Objc/runtime.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation UIImage (LookinServer)\n\n+ (void)load {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        Method oriMethod = class_getClassMethod([self class], @selector(imageNamed:));\n        Method newMethod = class_getClassMethod([self class], @selector(lks_imageNamed:));\n        method_exchangeImplementations(oriMethod, newMethod);\n        \n        oriMethod = class_getClassMethod([self class], @selector(imageWithContentsOfFile:));\n        newMethod = class_getClassMethod([self class], @selector(lks_imageWithContentsOfFile:));\n        method_exchangeImplementations(oriMethod, newMethod);\n    });\n}\n\n+ (UIImage *)lks_imageNamed:(NSString *)name {\n    UIImage *image = [self lks_imageNamed:name];\n    image.lks_imageSourceName = name;\n    return image;\n}\n\n+ (UIImage *)lks_imageWithContentsOfFile:(NSString *)path {\n    UIImage *image = [self lks_imageWithContentsOfFile:path];\n    \n    NSString *fileName = [[path componentsSeparatedByString:@\"/\"].lastObject componentsSeparatedByString:@\".\"].firstObject;\n    image.lks_imageSourceName = fileName;\n    return image;\n}\n\n- (void)setLks_imageSourceName:(NSString *)lks_imageSourceName {\n    [self lookin_bindObject:lks_imageSourceName.copy forKey:@\"lks_imageSourceName\"];\n}\n\n- (NSString *)lks_imageSourceName {\n    return [self lookin_getBindObjectForKey:@\"lks_imageSourceName\"];\n}\n\n- (NSData *)lookin_data {\n    return UIImagePNGRepresentation(self);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIImageView+LookinServer.h",
    "content": "//\n//  UIImageView+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/9/18.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UIImageView (LookinServer)\n\n- (NSString *)lks_imageSourceName;\n- (NSNumber *)lks_imageViewOidIfHasImage;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIImageView+LookinServer.m",
    "content": "//\n//  UIImageView+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/9/18.\n//  https://lookin.work\n//\n\n#import \"UIImageView+LookinServer.h\"\n#import \"UIImage+LookinServer.h\"\n#import \"NSObject+LookinServer.h\"\n\n@implementation UIImageView (LookinServer)\n\n- (NSString *)lks_imageSourceName {\n    return self.image.lks_imageSourceName;\n}\n\n- (NSNumber *)lks_imageViewOidIfHasImage {\n    if (!self.image) {\n        return nil;\n    }\n    unsigned long oid = [self lks_registerOid];\n    return @(oid);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UILabel+LookinServer.h",
    "content": "//\n//  UILabel+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/26.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UILabel (LookinServer)\n\n@property(nonatomic, assign) CGFloat lks_fontSize;\n\n- (NSString *)lks_fontName;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UILabel+LookinServer.m",
    "content": "//\n//  UILabel+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/26.\n//  https://lookin.work\n//\n\n#import \"UILabel+LookinServer.h\"\n\n@implementation UILabel (LookinServer)\n\n- (CGFloat)lks_fontSize {\n    return self.font.pointSize;\n}\n- (void)setLks_fontSize:(CGFloat)lks_fontSize {\n    UIFont *font = [self.font fontWithSize:lks_fontSize];\n    self.font = font;\n}\n\n- (NSString *)lks_fontName {\n    return self.font.fontName;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UITableView+LookinServer.h",
    "content": "//\n//  UITableView+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/9/5.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UITableView (LookinServer)\n\n- (NSArray<NSNumber *> *)lks_numberOfRows;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UITableView+LookinServer.m",
    "content": "//\n//  UITableView+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/9/5.\n//  https://lookin.work\n//\n\n#import \"UITableView+LookinServer.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation UITableView (LookinServer)\n\n- (NSArray<NSNumber *> *)lks_numberOfRows {\n    NSUInteger sectionsCount = MIN(self.numberOfSections, 10);\n    NSArray<NSNumber *> *rowsCount = [NSArray lookin_arrayWithCount:sectionsCount block:^id(NSUInteger idx) {\n        return @([self numberOfRowsInSection:idx]);\n    }];\n    if (rowsCount.count == 0) {\n        return nil;\n    }\n    return rowsCount;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UITextField+LookinServer.h",
    "content": "//\n//  UITextField+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/26.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UITextField (LookinServer)\n\n@property(nonatomic, assign) CGFloat lks_fontSize;\n\n- (NSString *)lks_fontName;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UITextField+LookinServer.m",
    "content": "//\n//  UITextField+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/26.\n//  https://lookin.work\n//\n\n#import \"UITextField+LookinServer.h\"\n\n@implementation UITextField (LookinServer)\n\n- (CGFloat)lks_fontSize {\n    return self.font.pointSize;\n}\n- (void)setLks_fontSize:(CGFloat)lks_fontSize {\n    UIFont *font = [self.font fontWithSize:lks_fontSize];\n    self.font = font;\n}\n\n- (NSString *)lks_fontName {\n    return self.font.fontName;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UITextView+LookinServer.h",
    "content": "//\n//  UITextView+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/26.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UITextView (LookinServer)\n\n@property(nonatomic, assign) CGFloat lks_fontSize;\n\n- (NSString *)lks_fontName;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UITextView+LookinServer.m",
    "content": "//\n//  UITextView+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/26.\n//  https://lookin.work\n//\n\n#import \"UITextView+LookinServer.h\"\n\n@implementation UITextView (LookinServer)\n\n- (CGFloat)lks_fontSize {\n    return self.font.pointSize;\n}\n- (void)setLks_fontSize:(CGFloat)lks_fontSize {\n    UIFont *font = [self.font fontWithSize:lks_fontSize];\n    self.font = font;\n}\n\n- (NSString *)lks_fontName {\n    return self.font.fontName;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIView+LookinServer.h",
    "content": "//\n//  UIView+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/3/19.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n#import <UIKit/UIKit.h>\n\n@interface UIView (LookinServer)\n\n@property(nonatomic, weak) UIViewController *lks_hostViewController;\n\n/// 是否是 UITabBar 的 childrenView，如果是的话，则截图时需要强制使用 renderInContext: 的方式而非 drawViewHierarchyInRect:afterScreenUpdates: 否则在 iOS 13 上获取到的图像是空的不知道为什么\n@property(nonatomic, assign) BOOL lks_isChildrenViewOfTabBar;\n\n/// point 是相对于 receiver 自身的坐标系\n- (UIView *)lks_subviewAtPoint:(CGPoint)point preferredClasses:(NSArray<Class> *)preferredClasses;\n\n- (CGFloat)lks_bestWidth;\n- (CGFloat)lks_bestHeight;\n- (CGSize)lks_bestSize;\n\n@property(nonatomic, assign) float lks_horizontalContentHuggingPriority;\n@property(nonatomic, assign) float lks_verticalContentHuggingPriority;\n\n@property(nonatomic, assign) float lks_horizontalContentCompressionResistancePriority;\n@property(nonatomic, assign) float lks_verticalContentCompressionResistancePriority;\n\n/// 遍历全局的 view 并给他们设置 lks_involvedRawConstraints 属性\n+ (void)lks_rebuildGlobalInvolvedRawConstraints;\n/// 该属性保存了牵扯到当前 view 的所有 constraints，包括那些没有生效的\n@property(nonatomic, strong) NSMutableArray<NSLayoutConstraint *> *lks_involvedRawConstraints;\n\n- (NSArray<NSDictionary<NSString *, id> *> *)lks_constraints;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIView+LookinServer.m",
    "content": "//\n//  UIView+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/3/19.\n//  https://lookin.work\n//\n\n#import \"UIView+LookinServer.h\"\n#import <objc/runtime.h>\n#import \"LookinObject.h\"\n#import \"LookinAutoLayoutConstraint.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation UIView (LookinServer)\n\n+ (void)load {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        Method oriMethod = class_getInstanceMethod([self class], @selector(initWithFrame:));\n        Method newMethod = class_getInstanceMethod([self class], @selector(lks_initWithFrame:));\n        method_exchangeImplementations(oriMethod, newMethod);\n        \n        oriMethod = class_getInstanceMethod([self class], @selector(initWithCoder:));\n        newMethod = class_getInstanceMethod([self class], @selector(lks_initWithCoder:));\n        method_exchangeImplementations(oriMethod, newMethod);\n    });\n}\n\n- (instancetype)lks_initWithFrame:(CGRect)frame {\n    UIView *view = [self lks_initWithFrame:frame];\n    view.layer.lks_hostView = view;\n    return view;\n}\n\n- (instancetype)lks_initWithCoder:(NSCoder *)coder {\n    UIView *view = [self lks_initWithCoder:coder];\n    view.layer.lks_hostView = view;\n    return view;\n}\n\n- (void)setLks_hostViewController:(UIViewController *)lks_hostViewController {\n    [self lookin_bindObjectWeakly:lks_hostViewController forKey:@\"lks_hostViewController\"];\n}\n\n- (UIViewController *)lks_hostViewController {\n    return [self lookin_getBindObjectForKey:@\"lks_hostViewController\"];\n}\n\n- (UIView *)lks_subviewAtPoint:(CGPoint)point preferredClasses:(NSArray<Class> *)preferredClasses {\n    BOOL isPreferredClassForSelf = [preferredClasses lookin_any:^BOOL(Class obj) {\n        return [self isKindOfClass:obj];\n    }];\n    if (isPreferredClassForSelf) {\n        return self;\n    }\n    \n    UIView *targetView = [self.subviews lookin_lastFiltered:^BOOL(__kindof UIView *obj) {\n        if (obj.layer.lks_isLookinPrivateLayer) {\n            return NO;\n        }\n        if (obj.hidden || obj.alpha <= 0.01) {\n            return NO;\n        }\n        BOOL contains = CGRectContainsPoint(obj.frame, point);\n        return contains;\n    }];\n    \n    if (!targetView) {\n        return self;\n    }\n    \n    CGPoint newPoint = [targetView convertPoint:point fromView:self];\n    targetView = [targetView lks_subviewAtPoint:newPoint preferredClasses:preferredClasses];\n    return targetView;\n}\n\n- (CGSize)lks_bestSize {\n    return [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];\n}\n\n- (CGFloat)lks_bestWidth {\n    return self.lks_bestSize.width;\n}\n\n- (CGFloat)lks_bestHeight {\n    return self.lks_bestSize.height;\n}\n\n- (void)setLks_isChildrenViewOfTabBar:(BOOL)lks_isChildrenViewOfTabBar {\n    [self lookin_bindBOOL:lks_isChildrenViewOfTabBar forKey:@\"lks_isChildrenViewOfTabBar\"];\n}\n- (BOOL)lks_isChildrenViewOfTabBar {\n    return [self lookin_getBindBOOLForKey:@\"lks_isChildrenViewOfTabBar\"];\n}\n\n- (void)setLks_verticalContentHuggingPriority:(float)lks_verticalContentHuggingPriority {\n    [self setContentHuggingPriority:lks_verticalContentHuggingPriority forAxis:UILayoutConstraintAxisVertical];\n}\n- (float)lks_verticalContentHuggingPriority {\n    return [self contentHuggingPriorityForAxis:UILayoutConstraintAxisVertical];\n}\n\n- (void)setLks_horizontalContentHuggingPriority:(float)lks_horizontalContentHuggingPriority {\n    [self setContentHuggingPriority:lks_horizontalContentHuggingPriority forAxis:UILayoutConstraintAxisHorizontal];\n}\n- (float)lks_horizontalContentHuggingPriority {\n    return [self contentHuggingPriorityForAxis:UILayoutConstraintAxisHorizontal];\n}\n\n- (void)setLks_verticalContentCompressionResistancePriority:(float)lks_verticalContentCompressionResistancePriority {\n    [self setContentCompressionResistancePriority:lks_verticalContentCompressionResistancePriority forAxis:UILayoutConstraintAxisVertical];\n}\n- (float)lks_verticalContentCompressionResistancePriority {\n    return [self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisVertical];\n}\n\n- (void)setLks_horizontalContentCompressionResistancePriority:(float)lks_horizontalContentCompressionResistancePriority {\n    [self setContentCompressionResistancePriority:lks_horizontalContentCompressionResistancePriority forAxis:UILayoutConstraintAxisHorizontal];\n}\n- (float)lks_horizontalContentCompressionResistancePriority {\n    return [self contentCompressionResistancePriorityForAxis:UILayoutConstraintAxisHorizontal];\n}\n\n+ (void)lks_rebuildGlobalInvolvedRawConstraints {\n    [[[UIApplication sharedApplication].windows copy] enumerateObjectsUsingBlock:^(__kindof UIWindow * _Nonnull window, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self lks_removeInvolvedRawConstraintsForViewsRootedByView:window];\n    }];\n    [[[UIApplication sharedApplication].windows copy] enumerateObjectsUsingBlock:^(__kindof UIWindow * _Nonnull window, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self lks_addInvolvedRawConstraintsForViewsRootedByView:window];\n    }];\n}\n\n+ (void)lks_addInvolvedRawConstraintsForViewsRootedByView:(UIView *)rootView {\n    [rootView.constraints enumerateObjectsUsingBlock:^(__kindof NSLayoutConstraint * _Nonnull constraint, NSUInteger idx, BOOL * _Nonnull stop) {\n        UIView *firstView = constraint.firstItem;\n        if ([firstView isKindOfClass:[UIView class]] && ![firstView.lks_involvedRawConstraints containsObject:constraint]) {\n            if (!firstView.lks_involvedRawConstraints) {\n                firstView.lks_involvedRawConstraints = [NSMutableArray array];\n            }\n            [firstView.lks_involvedRawConstraints addObject:constraint];\n        }\n        \n        UIView *secondView = constraint.secondItem;\n        if ([secondView isKindOfClass:[UIView class]] && ![secondView.lks_involvedRawConstraints containsObject:constraint]) {\n            if (!secondView.lks_involvedRawConstraints) {\n                secondView.lks_involvedRawConstraints = [NSMutableArray array];\n            }\n            [secondView.lks_involvedRawConstraints addObject:constraint];\n        }\n    }];\n    \n    [rootView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull subview, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self lks_addInvolvedRawConstraintsForViewsRootedByView:subview];\n    }];\n}\n\n+ (void)lks_removeInvolvedRawConstraintsForViewsRootedByView:(UIView *)rootView {\n    [rootView.lks_involvedRawConstraints removeAllObjects];\n    [rootView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull subview, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self lks_removeInvolvedRawConstraintsForViewsRootedByView:subview];\n    }];\n}\n\n- (void)setLks_involvedRawConstraints:(NSMutableArray<NSLayoutConstraint *> *)lks_involvedRawConstraints {\n    [self lookin_bindObject:lks_involvedRawConstraints forKey:@\"lks_involvedRawConstraints\"];\n}\n\n- (NSMutableArray<NSLayoutConstraint *> *)lks_involvedRawConstraints {\n    return [self lookin_getBindObjectForKey:@\"lks_involvedRawConstraints\"];\n}\n\n- (NSArray<LookinAutoLayoutConstraint *> *)lks_constraints {\n    /**\n     - lks_involvedRawConstraints 保存了牵扯到了 self 的所有的 constraints（包括未生效的，但不包括 inactive 的，整个产品逻辑都是直接忽略 inactive 的 constraints）\n     - 通过 constraintsAffectingLayoutForAxis 可以拿到会影响 self 布局的所有已生效的 constraints（这里称之为 effectiveConstraints）\n     - 很多情况下，一条 constraint 会出现在 effectiveConstraints 里但不会出现在 lks_involvedRawConstraints 里，比如：\n        · UIWindow 拥有 minX, minY, width, height 四个 effectiveConstraints，但 lks_involvedRawConstraints 为空，因为它的 constraints 属性为空（这一点不知道为啥，但 Xcode Inspector 和 Reveal 确实也不会显示这四个 constraints）\n        · 如果设置了 View1 的 center 和 superview 的 center 保持一致，则 superview 的 width 和 height 也会出现在 effectiveConstraints 里，但不会出现在 lks_involvedRawConstraints 里（这点可以理解，毕竟这种场景下 superview 的 width 和 height 确实会影响到 View1）\n     */\n    NSMutableArray<NSLayoutConstraint *> *effectiveConstraints = [NSMutableArray array];\n    [effectiveConstraints addObjectsFromArray:[self constraintsAffectingLayoutForAxis:UILayoutConstraintAxisHorizontal]];\n    [effectiveConstraints addObjectsFromArray:[self constraintsAffectingLayoutForAxis:UILayoutConstraintAxisVertical]];\n    \n    NSArray<LookinAutoLayoutConstraint *> *lookinConstraints = [self.lks_involvedRawConstraints lookin_map:^id(NSUInteger idx, __kindof NSLayoutConstraint *constraint) {\n        BOOL isEffective = [effectiveConstraints containsObject:constraint];\n        LookinConstraintItemType firstItemType = [self _lks_constraintItemTypeForItem:constraint.firstItem];\n        LookinConstraintItemType secondItemType = [self _lks_constraintItemTypeForItem:constraint.secondItem];\n        \n        LookinAutoLayoutConstraint *lookinConstraint = [LookinAutoLayoutConstraint instanceFromNSConstraint:constraint isEffective:isEffective firstItemType:firstItemType secondItemType:secondItemType];\n        return lookinConstraint;\n    }];\n    return lookinConstraints.count ? lookinConstraints : nil;\n}\n\n- (LookinConstraintItemType)_lks_constraintItemTypeForItem:(id)item {\n    if (!item) {\n        return LookinConstraintItemTypeNil;\n    }\n    if (item == self) {\n        return LookinConstraintItemTypeSelf;\n    }\n    if (item == self.superview) {\n        return LookinConstraintItemTypeSuper;\n    }\n    \n    // 在 runtime 时，这里会遇到的 UILayoutGuide 和 _UILayoutGuide 居然是 UIView 的子类，不知道是看错了还是有什么玄机，所以在判断是否是 UIView 之前要先判断这个\n    if (@available(iOS 9.0, *)) {\n        if ([item isKindOfClass:[UILayoutGuide class]]) {\n            return LookinConstraintItemTypeLayoutGuide;\n        }\n    }\n    \n    if ([[item lks_shortClassName] isEqualToString:@\"_UILayoutGuide\"]) {\n        return LookinConstraintItemTypeLayoutGuide;\n    }\n    \n    if ([item isKindOfClass:[UIView class]]) {\n        return LookinConstraintItemTypeView;\n    }\n    \n    NSAssert(NO, @\"\");\n    return LookinConstraintItemTypeUnknown;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIViewController+LookinServer.h",
    "content": "//\n//  UIViewController+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/4/22.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UIViewController (LookinServer)\n\n+ (UIViewController *)lks_visibleViewController;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIViewController+LookinServer.m",
    "content": "//\n//  UIViewController+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/4/22.\n//  https://lookin.work\n//\n\n#import \"UIViewController+LookinServer.h\"\n#import \"UIView+LookinServer.h\"\n#import <objc/runtime.h>\n\n@implementation UIViewController (LookinServer)\n\n+ (void)load {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        Method oriMethod = class_getInstanceMethod([self class], @selector(viewDidLoad));\n        Method newMethod = class_getInstanceMethod([self class], @selector(lks_viewDidLoad));\n        method_exchangeImplementations(oriMethod, newMethod);\n    });\n}\n\n- (void)lks_viewDidLoad {\n    [self lks_viewDidLoad];\n    self.view.lks_hostViewController = self;\n}\n\n+ (nullable UIViewController *)lks_visibleViewController {\n    UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;\n    UIViewController *visibleViewController = [rootViewController lks_visibleViewControllerIfExist];\n    return visibleViewController;\n}\n\n- (UIViewController *)lks_visibleViewControllerIfExist {\n    \n    if (self.presentedViewController) {\n        return [self.presentedViewController lks_visibleViewControllerIfExist];\n    }\n    \n    if ([self isKindOfClass:[UINavigationController class]]) {\n        return [((UINavigationController *)self).visibleViewController lks_visibleViewControllerIfExist];\n    }\n    \n    if ([self isKindOfClass:[UITabBarController class]]) {\n        return [((UITabBarController *)self).selectedViewController lks_visibleViewControllerIfExist];\n    }\n    \n    if (self.isViewLoaded && !self.view.hidden && self.view.alpha > 0.01) {\n        return self;\n    } else {\n        return nil;\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIVisualEffectView+LookinServer.h",
    "content": "//\n//  UIVisualEffectView+LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/10/8.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface UIVisualEffectView (LookinServer)\n\n- (void)setLks_blurEffectStyleNumber:(NSNumber *)lks_blurEffectStyleNumber;\n\n- (NSNumber *)lks_blurEffectStyleNumber;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Category/UIVisualEffectView+LookinServer.m",
    "content": "//\n//  UIVisualEffectView+LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/10/8.\n//  https://lookin.work\n//\n\n#import \"UIVisualEffectView+LookinServer.h\"\n#import \"UIBlurEffect+LookinServer.h\"\n\n@implementation UIVisualEffectView (LookinServer)\n\n- (void)setLks_blurEffectStyleNumber:(NSNumber *)lks_blurEffectStyleNumber {\n    UIBlurEffectStyle style = [lks_blurEffectStyleNumber integerValue];\n    UIBlurEffect *effect = [UIBlurEffect effectWithStyle:style];\n    self.effect = effect;\n}\n\n- (NSNumber *)lks_blurEffectStyleNumber {\n    UIVisualEffect *effect = self.effect;\n    if (![effect isKindOfClass:[UIBlurEffect class]]) {\n        return nil;\n    }\n    UIBlurEffect *blurEffect = (UIBlurEffect *)effect;\n    return blurEffect.lks_effectStyleNumber;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/LKS_ConnectionManager.h",
    "content": "//\n//  Lookin.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/8/5.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\nextern NSString *const LKS_ConnectionDidEndNotificationName;\n\n@class LookinConnectionResponseAttachment;\n\n@interface LKS_ConnectionManager : NSObject\n\n+ (instancetype)sharedInstance;\n\n@property(nonatomic, assign) BOOL applicationIsActive;\n\n- (BOOL)isConnected;\n\n- (void)respond:(LookinConnectionResponseAttachment *)data requestType:(uint32_t)requestType tag:(uint32_t)tag;\n\n- (void)pushData:(NSObject *)data type:(uint32_t)type;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/LKS_ConnectionManager.m",
    "content": "//\n//  LookinServer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2018/8/5.\n//  https://lookin.work\n//\n\n#import \"LKS_ConnectionManager.h\"\n#import \"Lookin_PTChannel.h\"\n#import \"LKS_RequestHandler.h\"\n#import \"LookinConnectionResponseAttachment.h\"\n#import \"LKS_LocalInspectManager.h\"\n#import \"LKS_ExportManager.h\"\n#import \"LKS_PerspectiveManager.h\"\n#import \"LookinServerDefines.h\"\n\nNSString *const LKS_ConnectionDidEndNotificationName = @\"LKS_ConnectionDidEndNotificationName\";\n\n@interface LKS_ConnectionManager () <Lookin_PTChannelDelegate>\n\n@property(nonatomic, weak) Lookin_PTChannel *peerChannel_;\n\n@property(nonatomic, strong) LKS_RequestHandler *requestHandler;\n\n@end\n\n@implementation LKS_ConnectionManager\n\n+ (instancetype)sharedInstance {\n    static LKS_ConnectionManager *sharedInstance;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        sharedInstance = [[LKS_ConnectionManager alloc] init];\n    });\n    return sharedInstance;\n}\n\n+ (void)load {\n    // 触发 init 方法\n    [LKS_ConnectionManager sharedInstance];\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        NSLog(@\"LookinServer - Will launch. Framework version: %@\", LOOKIN_SERVER_READABLE_VERSION);\n        \n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleApplicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleWillResignActiveNotification) name:UIApplicationWillResignActiveNotification object:nil];\n        \n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleLocalInspectIn2D:) name:@\"Lookin_2D\" object:nil];\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleLocalInspectIn3D:) name:@\"Lookin_3D\" object:nil];\n        [[NSNotificationCenter defaultCenter] addObserverForName:@\"Lookin_Export\" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {\n            [[LKS_ExportManager sharedInstance] exportAndShare];\n        }];\n        \n        self.requestHandler = [LKS_RequestHandler new];\n    }\n    return self;\n}\n\n- (void)_handleWillResignActiveNotification {\n    self.applicationIsActive = NO;\n}\n\n- (void)_handleApplicationDidBecomeActive {\n//    NSLog(@\"LookinServer(0.8.0) - UIApplicationDidBecomeActiveNotification\");\n    self.applicationIsActive = YES;\n    if (self.peerChannel_ && (self.peerChannel_.isConnected || self.peerChannel_.isListening)) {\n        return;\n    }\n    NSLog(@\"LookinServer - Trying to connect ...\");\n    if ([self isiOSAppOnMac]) {\n        [self _tryToListenOnPortFrom:LookinSimulatorIPv4PortNumberStart to:LookinSimulatorIPv4PortNumberEnd current:LookinSimulatorIPv4PortNumberStart];\n    } else {\n        [self _tryToListenOnPortFrom:LookinUSBDeviceIPv4PortNumberStart to:LookinUSBDeviceIPv4PortNumberEnd current:LookinUSBDeviceIPv4PortNumberStart];\n    }\n}\n\n- (BOOL)isiOSAppOnMac {\n#if TARGET_OS_SIMULATOR\n    return YES;\n#endif\n\n#ifdef IOS14_SDK_ALLOWED\n    if (@available(iOS 14.0, *)) {\n        return [NSProcessInfo processInfo].isiOSAppOnMac || [NSProcessInfo processInfo].isMacCatalystApp;\n    }\n#endif\n    if (@available(iOS 13.0, tvOS 13.0, *)) {\n        return [NSProcessInfo processInfo].isMacCatalystApp;\n    }\n    return NO;\n}\n\n- (void)_tryToListenOnPortFrom:(int)fromPort to:(int)toPort current:(int)currentPort  {\n    Lookin_PTChannel *channel = [Lookin_PTChannel channelWithDelegate:self];\n    [channel listenOnPort:currentPort IPv4Address:INADDR_LOOPBACK callback:^(NSError *error) {\n        if (error) {\n            if (error.code == 48) {\n                // 该地址已被占用\n            } else {\n                // 未知失败\n            }\n            \n            if (currentPort < toPort) {\n                // 尝试下一个端口\n                NSLog(@\"LookinServer - 127.0.0.1:%d is unavailable(%@). Will try anothor address ...\", currentPort, error);\n                [self _tryToListenOnPortFrom:fromPort to:toPort current:(currentPort + 1)];\n            } else {\n                // 所有端口都尝试完毕，全部失败\n                NSLog(@\"LookinServer - 127.0.0.1:%d is unavailable(%@).\", currentPort, error);\n                NSLog(@\"LookinServer - Connect failed in the end. Ask for help: lookin@lookin.work\");\n            }\n            \n        } else {\n            // 成功\n            NSLog(@\"LookinServer - Connected successfully on 127.0.0.1:%d\", currentPort);\n        \n//            UIAlertController *alert = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:@\"%@\", @(currentPort)] message:nil preferredStyle:UIAlertControllerStyleAlert];\n//            [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alert animated:YES completion:nil];\n        }\n    }];\n}\n\n- (void)dealloc {\n    if (self.peerChannel_) {\n        [self.peerChannel_ close];\n    }\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n- (BOOL)isConnected {\n    return self.peerChannel_ && self.peerChannel_.isConnected;\n}\n\n- (void)respond:(LookinConnectionResponseAttachment *)data requestType:(uint32_t)requestType tag:(uint32_t)tag {\n    [self _sendData:data frameOfType:requestType tag:tag];\n}\n\n- (void)pushData:(NSObject *)data type:(uint32_t)type {\n    [self _sendData:data frameOfType:type tag:0];\n}\n\n- (void)_sendData:(NSObject *)data frameOfType:(uint32_t)frameOfType tag:(uint32_t)tag {\n    if (self.peerChannel_) {\n        NSData *archivedData = [NSKeyedArchiver archivedDataWithRootObject:data];\n        dispatch_data_t payload = [archivedData createReferencingDispatchData];\n        \n        [self.peerChannel_ sendFrameOfType:frameOfType tag:tag withPayload:payload callback:^(NSError *error) {\n            if (error) {\n            }\n        }];\n    }\n}\n\n#pragma mark - Lookin_PTChannelDelegate\n\n- (BOOL)ioFrameChannel:(Lookin_PTChannel*)channel shouldAcceptFrameOfType:(uint32_t)type tag:(uint32_t)tag payloadSize:(uint32_t)payloadSize {\n    if (channel != self.peerChannel_) {\n        return NO;\n    } else if ([self.requestHandler canHandleRequestType:type]) {\n        return YES;\n    } else {\n        [channel close];\n        return NO;\n    }\n}\n\n- (void)ioFrameChannel:(Lookin_PTChannel*)channel didReceiveFrameOfType:(uint32_t)type tag:(uint32_t)tag payload:(Lookin_PTData*)payload {\n    id object = nil;\n    if (payload) {\n        id unarchivedObject = [NSKeyedUnarchiver unarchiveObjectWithData:[NSData dataWithContentsOfDispatchData:payload.dispatchData]];\n        if ([unarchivedObject isKindOfClass:[LookinConnectionAttachment class]]) {\n            LookinConnectionAttachment *attachment = (LookinConnectionAttachment *)unarchivedObject;\n            object = attachment.data;\n        } else {\n            object = unarchivedObject;\n        }\n    }\n    [self.requestHandler handleRequestType:type tag:tag object:object];\n}\n\n/// 当连接过 Lookin 客户端，然后 Lookin 客户端又被关闭时，会走到这里\n- (void)ioFrameChannel:(Lookin_PTChannel*)channel didEndWithError:(NSError*)error {\n    [[NSNotificationCenter defaultCenter] postNotificationName:LKS_ConnectionDidEndNotificationName object:self];\n}\n\n- (void)ioFrameChannel:(Lookin_PTChannel*)channel didAcceptConnection:(Lookin_PTChannel*)otherChannel fromAddress:(Lookin_PTAddress*)address {\n    if (self.peerChannel_) {\n        [self.peerChannel_ cancel];\n    }\n    \n    self.peerChannel_ = otherChannel;\n    self.peerChannel_.userInfo = address;\n}\n\n#pragma mark - Handler\n\n- (void)_handleLocalInspectIn2D:(NSNotification *)note {\n    dispatch_async(dispatch_get_main_queue(), ^{\n        NSArray<UIWindow *> *includedWindows = nil;\n        NSArray<UIWindow *> *excludedWindows = nil;\n        [self parseUserInfo:note.userInfo toIncludedWindows:&includedWindows excludedWindows:&excludedWindows];\n\n        [[LKS_LocalInspectManager sharedInstance] startLocalInspectWithIncludedWindows:includedWindows excludedWindows:excludedWindows];\n    });\n}\n\n- (void)_handleLocalInspectIn3D:(NSNotification *)note {\n    NSArray<UIWindow *> *includedWindows = nil;\n    NSArray<UIWindow *> *excludedWindows = nil;\n    [self parseUserInfo:note.userInfo toIncludedWindows:&includedWindows excludedWindows:&excludedWindows];\n    \n    [[LKS_PerspectiveManager sharedInstance] showWithIncludedWindows:includedWindows excludedWindows:excludedWindows];\n}\n\n- (void)parseUserInfo:(NSDictionary *)info toIncludedWindows:(NSArray<UIWindow *> **)includedWindowsPtr excludedWindows:(NSArray<UIWindow *> **)excludedWindowsPtr {\n    if (info[@\"includedWindows\"] && info[@\"excludedWindows\"]) {\n        NSLog(@\"LookinServer - Do not pass 'includedWindows' and 'excludedWindows' in the same time. Learn more: https://lookin.work/faq/lookin-ios/\");\n    }\n    \n    [info enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {\n        if ([key isEqual:@\"includedWindows\"] || [key isEqual:@\"excludedWindows\"]) {\n            return;\n        }\n        NSLog(@\"LookinServer - The key '%@' you passed is not valid. Learn more: https://lookin.work/faq/lookin-ios/\", key);\n    }];\n    \n    NSArray<UIWindow *> *includedWindows = [info objectForKey:@\"includedWindows\"];\n    if (includedWindows) {\n        if ([includedWindows isKindOfClass:[NSArray class]]) {\n            includedWindows = [includedWindows lookin_filter:^BOOL(UIWindow *obj) {\n                if ([obj isKindOfClass:[UIWindow class]]) {\n                    return YES;\n                }\n                NSLog(@\"LookinServer - Error. The class of element in 'includedWindows' array must be UIWindow, but you've passed '%@'. Learn more: https://lookin.work/faq/lookin-ios/\", NSStringFromClass(obj.class));\n                return NO;\n            }];\n            \n        } else {\n            NSLog(@\"LookinServer - Error. The 'includedWindows' must be a NSArray, but you've passed '%@'. Learn more: https://lookin.work/faq/lookin-ios/\", NSStringFromClass([includedWindows class]));\n            includedWindows = nil;\n        }\n    }\n    \n    NSArray<UIWindow *> *excludedWindows = nil;\n    // 只有当 includedWindows 无效时，才会应用 excludedWindows\n    if (includedWindows.count == 0) {\n        excludedWindows = [info objectForKey:@\"excludedWindows\"];\n        if (excludedWindows) {\n            if ([excludedWindows isKindOfClass:[NSArray class]]) {\n                excludedWindows = [excludedWindows lookin_filter:^BOOL(UIWindow *obj) {\n                    if ([obj isKindOfClass:[UIWindow class]]) {\n                        return YES;\n                    }\n                    NSLog(@\"LookinServer - Error. The class of element in 'excludedWindows' array must be UIWindow, but you've passed '%@'. Learn more: https://lookin.work/faq/lookin-ios/\", NSStringFromClass(obj.class));\n                    return NO;\n                }];\n                \n            } else {\n                NSLog(@\"LookinServer - Error. The 'excludedWindows' must be a NSArray, but you've passed '%@'. Learn more: https://lookin.work/faq/lookin-ios/\", NSStringFromClass([excludedWindows class]));\n                excludedWindows = nil;\n            }\n        }\n    }\n    \n    if (includedWindowsPtr) {\n        *includedWindowsPtr = includedWindows;\n    }\n    if (excludedWindowsPtr) {\n        *excludedWindowsPtr = excludedWindows;\n    }\n}\n\n@end\n\n/// 这个类使得用户可以通过 NSClassFromString(@\"Lookin\") 来判断 LookinServer 是否被编译进了项目里\n\n@interface Lookin : NSObject\n\n@end\n\n@implementation Lookin\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/LKS_RequestHandler.h",
    "content": "//\n//  LKS_RequestHandler.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/1/15.\n//  https://lookin.work\n//\n\n#import <Foundation/Foundation.h>\n\n@interface LKS_RequestHandler : NSObject\n\n- (BOOL)canHandleRequestType:(uint32_t)requestType;\n\n- (void)handleRequestType:(uint32_t)requestType tag:(uint32_t)tag object:(id)object;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/LKS_RequestHandler.m",
    "content": "//\n//  LKS_RequestHandler.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/1/15.\n//  https://lookin.work\n//\n\n#import \"LKS_RequestHandler.h\"\n#import \"NSObject+LookinServer.h\"\n#import \"UIImage+LookinServer.h\"\n#import \"LKS_ConnectionManager.h\"\n#import \"LookinConnectionResponseAttachment.h\"\n#import \"LookinAttributeModification.h\"\n#import \"LookinDisplayItemDetail.h\"\n#import \"LookinHierarchyInfo.h\"\n#import \"LookinServerDefines.h\"\n#import <objc/runtime.h>\n#import \"LookinObject.h\"\n#import \"LKS_LocalInspectManager.h\"\n#import \"LookinAppInfo.h\"\n#import \"LKS_MethodTraceManager.h\"\n#import \"LKS_AttrGroupsMaker.h\"\n#import \"LKS_AttrModificationHandler.h\"\n#import \"LKS_AttrModificationPatchHandler.h\"\n#import \"LKS_HierarchyDetailsHandler.h\"\n#import \"LookinStaticAsyncUpdateTask.h\"\n\n@interface LKS_RequestHandler ()\n\n@end\n\n@implementation LKS_RequestHandler {\n    NSSet *_validRequestTypes;\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        _validRequestTypes = [NSSet setWithObjects:@(LookinRequestTypePing),\n                              @(LookinRequestTypeApp),\n                              @(LookinRequestTypeHierarchy),\n                              @(LookinRequestTypeModification),\n                              @(LookinRequestTypeAttrModificationPatch),\n                              @(LookinRequestTypeHierarchyDetails),\n                              @(LookinRequestTypeFetchObject),\n                              @(LookinRequestTypeAllAttrGroups),\n                              @(LookinRequestTypeAllSelectorNames),\n                              @(LookinRequestTypeAddMethodTrace),\n                              @(LookinRequestTypeDeleteMethodTrace),\n                              @(LookinRequestTypeClassesAndMethodTraceLit),\n                              @(LookinRequestTypeInvokeMethod),\n                              @(LookinRequestTypeFetchImageViewImage),\n                              @(LookinRequestTypeModifyRecognizerEnable),\n                              \n                              @(LookinPush_BringForwardScreenshotTask),\n                              @(LookinPush_CanceHierarchyDetails),\n                              nil];\n    }\n    return self;\n}\n\n- (BOOL)canHandleRequestType:(uint32_t)requestType {\n    if ([_validRequestTypes containsObject:@(requestType)]) {\n        return YES;\n    }\n    NSAssert(NO, @\"\");\n    return NO;\n}\n\n- (void)handleRequestType:(uint32_t)requestType tag:(uint32_t)tag object:(id)object {\n    if (requestType == LookinRequestTypePing) {\n        LookinConnectionResponseAttachment *responseAttachment = [LookinConnectionResponseAttachment new];\n        // 当 app 处于后台时，可能可以执行代码也可能不能执行代码，如果运气好了可以执行代码，则这里直接主动使用 appIsInBackground 标识 app 处于后台，不要让 Lookin 客户端傻傻地等待超时了\n        if (![LKS_ConnectionManager sharedInstance].applicationIsActive) {\n            responseAttachment.appIsInBackground = YES;            \n        }\n        [[LKS_ConnectionManager sharedInstance] respond:responseAttachment requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeApp) {\n        // 请求可用设备信息\n        NSDictionary<NSString *, id> *params = object;\n        BOOL needImages = ((NSNumber *)params[@\"needImages\"]).boolValue;\n        NSArray<NSNumber *> *localIdentifiers = params[@\"local\"];\n        \n        LookinAppInfo *appInfo = [LookinAppInfo currentInfoWithScreenshot:needImages icon:needImages localIdentifiers:localIdentifiers];\n        \n        LookinConnectionResponseAttachment *responseAttachment = [LookinConnectionResponseAttachment new];\n        responseAttachment.data = appInfo;\n        [[LKS_ConnectionManager sharedInstance] respond:responseAttachment requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeHierarchy) {\n        LookinConnectionResponseAttachment *responseAttachment = [LookinConnectionResponseAttachment new];\n        responseAttachment.data = [LookinHierarchyInfo staticInfo];\n        [[LKS_ConnectionManager sharedInstance] respond:responseAttachment requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeModification) {\n        // 请求修改某个属性\n        [LKS_AttrModificationHandler handleModification:object completion:^(LookinDisplayItemDetail *data, NSError *error) {\n            LookinConnectionResponseAttachment *attachment = [LookinConnectionResponseAttachment new];\n            if (error) {\n                attachment.error = error;\n            } else {\n                attachment.data = data;\n            }\n            [[LKS_ConnectionManager sharedInstance] respond:attachment requestType:requestType tag:tag];\n        }];\n        \n    } else if (requestType == LookinRequestTypeAttrModificationPatch) {\n        NSArray<LookinStaticAsyncUpdateTask *> *tasks = object;\n        NSUInteger dataTotalCount = tasks.count;\n        [LKS_AttrModificationHandler handlePatchWithTasks:tasks block:^(LookinDisplayItemDetail *data) {\n            LookinConnectionResponseAttachment *attrAttachment = [LookinConnectionResponseAttachment new];\n            attrAttachment.data = data;\n            attrAttachment.dataTotalCount = dataTotalCount;\n            attrAttachment.currentDataCount = 1;\n            [[LKS_ConnectionManager sharedInstance] respond:attrAttachment requestType:LookinRequestTypeAttrModificationPatch tag:tag];\n        }];\n        \n    } else if (requestType == LookinRequestTypeHierarchyDetails) {\n        NSArray<LookinStaticAsyncUpdateTasksPackage *> *packages = object;\n        NSUInteger responsesDataTotalCount = [packages lookin_reduceInteger:^NSInteger(NSInteger accumulator, NSUInteger idx, LookinStaticAsyncUpdateTasksPackage *package) {\n            accumulator += package.tasks.count;\n            return accumulator;\n        } initialAccumlator:0];\n        \n        [[LKS_HierarchyDetailsHandler sharedInstance] startWithPackages:packages block:^(NSArray<LookinDisplayItemDetail *> *details, NSError *error) {\n            LookinConnectionResponseAttachment *attachment = [LookinConnectionResponseAttachment new];\n            attachment.error = error;\n            attachment.data = details;\n            attachment.dataTotalCount = responsesDataTotalCount;\n            attachment.currentDataCount = details.count;\n            [[LKS_ConnectionManager sharedInstance] respond:attachment requestType:LookinRequestTypeHierarchyDetails tag:tag];\n        }];\n        \n    } else if (requestType == LookinRequestTypeFetchObject) {\n        unsigned long oid = ((NSNumber *)object).unsignedLongValue;\n        NSObject *object = [NSObject lks_objectWithOid:oid];\n        LookinObject *lookinObj = [LookinObject instanceWithObject:object];\n        \n        LookinConnectionResponseAttachment *attach = [LookinConnectionResponseAttachment new];\n        attach.data = lookinObj;\n        [[LKS_ConnectionManager sharedInstance] respond:attach requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeAllAttrGroups) {\n        unsigned long oid = ((NSNumber *)object).unsignedLongValue;\n        CALayer *layer = (CALayer *)[NSObject lks_objectWithOid:oid];\n        if (![layer isKindOfClass:[CALayer class]]) {\n            [self _submitResponseWithError:LookinErr_ObjNotFound requestType:LookinRequestTypeAllAttrGroups tag:tag];\n            return;\n        }\n        \n        NSArray<LookinAttributesGroup *> *list = [LKS_AttrGroupsMaker attrGroupsForLayer:layer];\n        [self _submitResponseWithData:list requestType:LookinRequestTypeAllAttrGroups tag:tag];\n        \n    } else if (requestType == LookinRequestTypeAllSelectorNames) {\n        NSDictionary *params = object;\n        Class targetClass = NSClassFromString(params[@\"className\"]);\n        BOOL hasArg = [(NSNumber *)params[@\"hasArg\"] boolValue];\n        if (!targetClass) {\n            NSString *errorMsg = [NSString stringWithFormat:LKS_Localized(@\"Didn't find the class named \\\"%@\\\". Please input another class and try again.\"), object];\n            [self _submitResponseWithError:LookinErrorMake(errorMsg, @\"\") requestType:requestType tag:tag];\n            return;\n        }\n        \n        NSArray<NSString *> *selNames = [self _methodNameListForClass:targetClass hasArg:hasArg];\n        [self _submitResponseWithData:selNames requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeAddMethodTrace) {\n        if (![object isKindOfClass:[NSDictionary class]]) {\n            [self _submitResponseWithError:LookinErr_Inner requestType:requestType tag:tag];\n            return;\n        }\n        NSDictionary *dict = object;\n        NSString *className = dict[@\"className\"];\n        NSString *selName = dict[@\"selName\"];\n        \n        Class targetClass = NSClassFromString(className);\n        if (!targetClass) {\n            NSString *errorMsg = [NSString stringWithFormat:LKS_Localized(@\"Didn't find the class named \\\"%@\\\". Please input another class and try again.\"), object];\n            [self _submitResponseWithError:LookinErrorMake(errorMsg, @\"\") requestType:requestType tag:tag];\n            return;\n        }\n        \n        SEL targetSelector = NSSelectorFromString(selName);\n        if (class_getInstanceMethod(targetClass, targetSelector) == NULL) {\n            NSString *errorMsg = [NSString stringWithFormat:LKS_Localized(@\"%@ doesn't have a method called \\\"%@\\\". Please input another method name and try again.\"), className, selName];\n            [self _submitResponseWithError:LookinErrorMake(errorMsg, @\"\") requestType:requestType tag:tag];\n            return;\n        }\n        \n        [[LKS_MethodTraceManager sharedInstance] addWithClassName:className selName:selName];\n        [self _submitResponseWithData:[LKS_MethodTraceManager sharedInstance].currentActiveTraceList requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeDeleteMethodTrace) {\n        if (![object isKindOfClass:[NSDictionary class]]) {\n            [self _submitResponseWithError:LookinErr_Inner requestType:requestType tag:tag];\n            return;\n        }\n        NSDictionary *dict = object;\n        NSString *className = dict[@\"className\"];\n        NSString *selName = dict[@\"selName\"];\n        \n        [[LKS_MethodTraceManager sharedInstance] removeWithClassName:className selName:selName];\n        [self _submitResponseWithData:[LKS_MethodTraceManager sharedInstance].currentActiveTraceList requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeClassesAndMethodTraceLit) {\n        LKS_MethodTraceManager *mng = [LKS_MethodTraceManager sharedInstance];\n        NSDictionary *dict = @{@\"classes\":mng.allClassesListInApp, @\"activeList\":mng.currentActiveTraceList};\n        [self _submitResponseWithData:dict requestType:requestType tag:tag];\n        \n    } else if (requestType == LookinRequestTypeInvokeMethod) {\n        NSDictionary *param = object;\n        unsigned long oid = [param[@\"oid\"] unsignedLongValue];\n        NSString *text = param[@\"text\"];\n        if (!text.length) {\n            [self _submitResponseWithError:LookinErr_Inner requestType:requestType tag:tag];\n            return;\n        }\n        NSObject *targerObj = [NSObject lks_objectWithOid:oid];\n        if (!targerObj) {\n            [self _submitResponseWithError:LookinErr_ObjNotFound requestType:requestType tag:tag];\n            return;\n        }\n        \n        SEL targetSelector = NSSelectorFromString(text);\n        if (targetSelector && [targerObj respondsToSelector:targetSelector]) {\n            NSString *resultDescription;\n            NSObject *resultObject;\n            NSError *error;\n            [self _handleInvokeWithObject:targerObj selector:targetSelector resultDescription:&resultDescription resultObject:&resultObject error:&error];\n            if (error) {\n                [self _submitResponseWithError:error requestType:requestType tag:tag];\n                return;\n            }\n            NSMutableDictionary *responseData = [NSMutableDictionary dictionaryWithCapacity:2];\n            if (resultDescription) {\n                responseData[@\"description\"] = resultDescription;\n            }\n            if (resultObject) {\n                responseData[@\"object\"] = resultObject;\n            }\n            [self _submitResponseWithData:responseData requestType:requestType tag:tag];\n        } else {\n            NSString *errMsg = [NSString stringWithFormat:LKS_Localized(@\"%@ doesn't have an instance method called \\\"%@\\\".\"), NSStringFromClass(targerObj.class), text];\n            [self _submitResponseWithError:LookinErrorMake(errMsg, @\"\") requestType:requestType tag:tag];\n        }\n        \n    } else if (requestType == LookinPush_BringForwardScreenshotTask) {\n        [[LKS_HierarchyDetailsHandler sharedInstance] bringForwardWithPackages:object];\n    \n    } else if (requestType == LookinPush_CanceHierarchyDetails) {\n        [[LKS_HierarchyDetailsHandler sharedInstance] cancel];\n        \n    } else if (requestType == LookinRequestTypeFetchImageViewImage) {\n        if (![object isKindOfClass:[NSNumber class]]) {\n            [self _submitResponseWithError:LookinErr_Inner requestType:requestType tag:tag];\n            return;\n        }\n        unsigned long imageViewOid = [(NSNumber *)object unsignedLongValue];\n        UIImageView *imageView = (UIImageView *)[NSObject lks_objectWithOid:imageViewOid];\n        if (!imageView) {\n            [self _submitResponseWithError:LookinErr_ObjNotFound requestType:requestType tag:tag];\n            return;\n        }\n        if (![imageView isKindOfClass:[UIImageView class]]) {\n            [self _submitResponseWithError:LookinErr_Inner requestType:requestType tag:tag];\n            return;\n        }\n        UIImage *image = imageView.image;\n        NSData *imageData = [image lookin_data];\n        [self _submitResponseWithData:imageData requestType:requestType tag:tag];\n    \n    } else if (requestType == LookinRequestTypeModifyRecognizerEnable) {\n        NSDictionary<NSString *, NSNumber *> *params = object;\n        unsigned long recognizerOid = ((NSNumber *)params[@\"oid\"]).unsignedLongValue;\n        BOOL shouldBeEnabled = ((NSNumber *)params[@\"enable\"]).boolValue;\n        \n        UIGestureRecognizer *recognizer = (UIGestureRecognizer *)[NSObject lks_objectWithOid:recognizerOid];\n        if (!recognizer) {\n            [self _submitResponseWithError:LookinErr_ObjNotFound requestType:requestType tag:tag];\n            return;\n        }\n        if (![recognizer isKindOfClass:[UIGestureRecognizer class]]) {\n            [self _submitResponseWithError:LookinErr_Inner requestType:requestType tag:tag];\n            return;\n        }\n        recognizer.enabled = shouldBeEnabled;\n        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n            // dispatch 以确保拿到的 enabled 是比较新的\n            [self _submitResponseWithData:@(recognizer.enabled) requestType:requestType tag:tag];\n        });\n    }\n}\n\n- (NSArray<NSString *> *)_methodNameListForClass:(Class)aClass hasArg:(BOOL)hasArg {\n    NSSet<NSString *> *prefixesToVoid = [NSSet setWithObjects:@\"_\", @\"CA_\", @\"cpl\", @\"mf_\", @\"vs_\", @\"pep_\", @\"isNS\", @\"avkit_\", @\"PG_\", @\"px_\", @\"pl_\", @\"nsli_\", @\"pu_\", @\"pxg_\", nil];\n    NSMutableArray<NSString *> *array = [NSMutableArray array];\n    \n    Class currentClass = aClass;\n    while (currentClass) {\n        NSString *className = NSStringFromClass(currentClass);\n        BOOL isSystemClass = ([className hasPrefix:@\"UI\"] || [className hasPrefix:@\"CA\"] || [className hasPrefix:@\"NS\"]);\n        \n        unsigned int methodCount = 0;\n        Method *methods = class_copyMethodList(currentClass, &methodCount);\n        for (unsigned int i = 0; i < methodCount; i++) {\n            NSString *selName = NSStringFromSelector(method_getName(methods[i]));\n            \n            if (!hasArg && [selName containsString:@\":\"]) {\n                continue;\n            }\n            \n            if (isSystemClass) {\n                BOOL invalid = [prefixesToVoid lookin_any:^BOOL(NSString *prefix) {\n                    return [selName hasPrefix:prefix];\n                }];\n                if (invalid) {\n                    continue;\n                }\n            }\n            if (selName.length && ![array containsObject:selName]) {\n                [array addObject:selName];\n            }\n        }\n        if (methods) free(methods);\n        currentClass = [currentClass superclass];\n    }\n\n    return [array lookin_sortedArrayByStringLength];\n}\n\n- (void)_handleInvokeWithObject:(NSObject *)obj selector:(SEL)selector resultDescription:(NSString **)description resultObject:(LookinObject **)resultObject error:(NSError **)error {\n    NSMethodSignature *signature = [obj methodSignatureForSelector:selector];\n    if (signature.numberOfArguments > 2) {\n        *error = LookinErrorMake(LKS_Localized(@\"Lookin doesn't support invoking methods with arguments yet.\"), @\"\");\n        return;\n    }\n    \n    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];\n    [invocation setTarget:obj];\n    [invocation setSelector:selector];\n    [invocation invoke];\n\n    const char *returnType = [signature methodReturnType];\n    \n    \n    if (strcmp(returnType, @encode(void)) == 0) {\n        //void, do nothing\n        *description = LookinStringFlag_VoidReturn;\n        \n    } else if (strcmp(returnType, @encode(char)) == 0) {\n        char charValue;\n        [invocation getReturnValue:&charValue];\n        *description = [NSString stringWithFormat:@\"%@\", @(charValue)];\n        \n    } else if (strcmp(returnType, @encode(int)) == 0) {\n        int intValue;\n        [invocation getReturnValue:&intValue];\n        if (intValue == INT_MAX) {\n            *description = @\"INT_MAX\";\n        } else if (intValue == INT_MIN) {\n            *description = @\"INT_MIN\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(intValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(short)) == 0) {\n        short shortValue;\n        [invocation getReturnValue:&shortValue];\n        if (shortValue == SHRT_MAX) {\n            *description = @\"SHRT_MAX\";\n        } else if (shortValue == SHRT_MIN) {\n            *description = @\"SHRT_MIN\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(shortValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(long)) == 0) {\n        long longValue;\n        [invocation getReturnValue:&longValue];\n        if (longValue == NSNotFound) {\n            *description = @\"NSNotFound\";\n        } else if (longValue == LONG_MAX) {\n            *description = @\"LONG_MAX\";\n        } else if (longValue == LONG_MIN) {\n            *description = @\"LONG_MAX\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(longValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(long long)) == 0) {\n        long long longLongValue;\n        [invocation getReturnValue:&longLongValue];\n        if (longLongValue == LLONG_MAX) {\n            *description = @\"LLONG_MAX\";\n        } else if (longLongValue == LLONG_MIN) {\n            *description = @\"LLONG_MIN\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(longLongValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(unsigned char)) == 0) {\n        unsigned char ucharValue;\n        [invocation getReturnValue:&ucharValue];\n        if (ucharValue == UCHAR_MAX) {\n            *description = @\"UCHAR_MAX\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(ucharValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(unsigned int)) == 0) {\n        unsigned int uintValue;\n        [invocation getReturnValue:&uintValue];\n        if (uintValue == UINT_MAX) {\n            *description = @\"UINT_MAX\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(uintValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(unsigned short)) == 0) {\n        unsigned short ushortValue;\n        [invocation getReturnValue:&ushortValue];\n        if (ushortValue == USHRT_MAX) {\n            *description = @\"USHRT_MAX\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(ushortValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(unsigned long)) == 0) {\n        unsigned long ulongValue;\n        [invocation getReturnValue:&ulongValue];\n        if (ulongValue == ULONG_MAX) {\n            *description = @\"ULONG_MAX\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(ulongValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(unsigned long long)) == 0) {\n        unsigned long long ulongLongValue;\n        [invocation getReturnValue:&ulongLongValue];\n        if (ulongLongValue == ULONG_LONG_MAX) {\n            *description = @\"ULONG_LONG_MAX\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(ulongLongValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(float)) == 0) {\n        float floatValue;\n        [invocation getReturnValue:&floatValue];\n        if (floatValue == FLT_MAX) {\n            *description = @\"FLT_MAX\";\n        } else if (floatValue == FLT_MIN) {\n            *description = @\"FLT_MIN\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(floatValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(double)) == 0) {\n        double doubleValue;\n        [invocation getReturnValue:&doubleValue];\n        if (doubleValue == DBL_MAX) {\n            *description = @\"DBL_MAX\";\n        } else if (doubleValue == DBL_MIN) {\n            *description = @\"DBL_MIN\";\n        } else {\n            *description = [NSString stringWithFormat:@\"%@\", @(doubleValue)];\n        }\n        \n    } else if (strcmp(returnType, @encode(BOOL)) == 0) {\n        BOOL boolValue;\n        [invocation getReturnValue:&boolValue];\n        *description = boolValue ? @\"YES\" : @\"NO\";\n        \n    } else if (strcmp(returnType, @encode(SEL)) == 0) {\n        SEL selValue;\n        [invocation getReturnValue:&selValue];\n        *description = [NSString stringWithFormat:@\"SEL(%@)\", NSStringFromSelector(selValue)];\n        \n    } else if (strcmp(returnType, @encode(Class)) == 0) {\n        Class classValue;\n        [invocation getReturnValue:&classValue];\n        *description = [NSString stringWithFormat:@\"<%@>\", NSStringFromClass(classValue)];\n        \n    } else if (strcmp(returnType, @encode(CGPoint)) == 0) {\n        CGPoint targetValue;\n        [invocation getReturnValue:&targetValue];\n        *description = NSStringFromCGPoint(targetValue);\n\n    } else if (strcmp(returnType, @encode(CGVector)) == 0) {\n        CGVector targetValue;\n        [invocation getReturnValue:&targetValue];\n        *description = NSStringFromCGVector(targetValue);\n\n    } else if (strcmp(returnType, @encode(CGSize)) == 0) {\n        CGSize targetValue;\n        [invocation getReturnValue:&targetValue];\n        *description = NSStringFromCGSize(targetValue);\n\n    } else if (strcmp(returnType, @encode(CGRect)) == 0) {\n        CGRect rectValue;\n        [invocation getReturnValue:&rectValue];\n        *description = NSStringFromCGRect(rectValue);\n        \n    } else if (strcmp(returnType, @encode(CGAffineTransform)) == 0) {\n        CGAffineTransform rectValue;\n        [invocation getReturnValue:&rectValue];\n        *description = NSStringFromCGAffineTransform(rectValue);\n        \n    } else if (strcmp(returnType, @encode(UIEdgeInsets)) == 0) {\n        UIEdgeInsets targetValue;\n        [invocation getReturnValue:&targetValue];\n        *description = NSStringFromUIEdgeInsets(targetValue);\n        \n    } else if (strcmp(returnType, @encode(UIOffset)) == 0) {\n        UIOffset targetValue;\n        [invocation getReturnValue:&targetValue];\n        *description = NSStringFromUIOffset(targetValue);\n        \n    } else {\n        if (@available(iOS 11.0, tvOS 11.0, *)) {\n            if (strcmp(returnType, @encode(NSDirectionalEdgeInsets)) == 0) {\n                NSDirectionalEdgeInsets targetValue;\n                [invocation getReturnValue:&targetValue];\n                *description = NSStringFromDirectionalEdgeInsets(targetValue);\n                return;\n            }\n        }\n        \n        NSString *argType_string = [[NSString alloc] lookin_safeInitWithUTF8String:returnType];\n        if ([argType_string hasPrefix:@\"@\"] || [argType_string hasPrefix:@\"^{\"]) {\n            __unsafe_unretained id returnObjValue;\n            [invocation getReturnValue:&returnObjValue];\n            \n            if (returnObjValue) {\n                *description = [NSString stringWithFormat:@\"%@\", returnObjValue];\n                \n                LookinObject *parsedLookinObj = [LookinObject instanceWithObject:returnObjValue];\n                *resultObject = parsedLookinObj;\n            } else {\n                *description = @\"nil\";\n            }\n        } else {\n            *description = [NSString stringWithFormat:LKS_Localized(@\"%@ was invoked successfully, but Lookin can't parse the return value:%@\"), NSStringFromSelector(selector), argType_string];\n        }\n    }\n}\n\n- (void)_submitResponseWithError:(NSError *)error requestType:(uint32_t)requestType tag:(uint32_t)tag {\n    LookinConnectionResponseAttachment *attachment = [LookinConnectionResponseAttachment new];\n    attachment.error = error;\n    [[LKS_ConnectionManager sharedInstance] respond:attachment requestType:requestType tag:tag];\n}\n\n- (void)_submitResponseWithData:(NSObject *)data requestType:(uint32_t)requestType tag:(uint32_t)tag {\n    LookinConnectionResponseAttachment *attachment = [LookinConnectionResponseAttachment new];\n    attachment.data = data;\n    [[LKS_ConnectionManager sharedInstance] respond:attachment requestType:requestType tag:tag];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/RequestHandler/LKS_AttrModificationHandler.h",
    "content": "//\n//  LKS_AttrModificationHandler.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/12.\n//  https://lookin.work\n//\n\n#import <Foundation/Foundation.h>\n\n@class LookinAttributeModification, LookinDisplayItemDetail, LookinStaticAsyncUpdateTask;\n\n@interface LKS_AttrModificationHandler : NSObject\n\n+ (void)handleModification:(LookinAttributeModification *)modification completion:(void (^)(LookinDisplayItemDetail *data, NSError *error))completion;\n\n+ (void)handlePatchWithTasks:(NSArray<LookinStaticAsyncUpdateTask *> *)tasks block:(void (^)(LookinDisplayItemDetail *data))block;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/RequestHandler/LKS_AttrModificationHandler.m",
    "content": "//\n//  LKS_AttrModificationHandler.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/12.\n//  https://lookin.work\n//\n\n#import \"LKS_AttrModificationHandler.h\"\n#import \"UIColor+LookinServer.h\"\n#import \"LookinAttributeModification.h\"\n#import \"LKS_AttrGroupsMaker.h\"\n#import \"LookinDisplayItemDetail.h\"\n#import \"LookinStaticAsyncUpdateTask.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation LKS_AttrModificationHandler\n\n+ (void)handleModification:(LookinAttributeModification *)modification completion:(void (^)(LookinDisplayItemDetail *data, NSError *error))completion {\n    if (!completion) {\n        NSAssert(NO, @\"\");\n        return;\n    }\n    if (!modification || ![modification isKindOfClass:[LookinAttributeModification class]]) {\n        completion(nil, LookinErr_Inner);\n        return;\n    }\n    \n    NSObject *receiver = [NSObject lks_objectWithOid:modification.targetOid];\n    if (!receiver) {\n        completion(nil, LookinErr_ObjNotFound);\n        return;\n    }\n    \n    NSMethodSignature *setterSignature = [receiver methodSignatureForSelector:modification.setterSelector];\n    NSInvocation *setterInvocation = [NSInvocation invocationWithMethodSignature:setterSignature];\n    setterInvocation.target = receiver;\n    setterInvocation.selector = modification.setterSelector;\n    \n    if (setterSignature.numberOfArguments != 3 || ![receiver respondsToSelector:modification.setterSelector]) {\n        completion(nil, LookinErr_Inner);\n        return;\n    }\n    \n    switch (modification.attrType) {\n        case LookinAttrTypeNone:\n        case LookinAttrTypeVoid: {\n            completion(nil, LookinErr_Inner);\n            return;\n        }\n        case LookinAttrTypeChar: {\n            char expectedValue = [(NSNumber *)modification.value charValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeInt:\n        case LookinAttrTypeEnumInt: {\n            int expectedValue = [(NSNumber *)modification.value intValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeShort: {\n            short expectedValue = [(NSNumber *)modification.value shortValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeLong:\n        case LookinAttrTypeEnumLong: {\n            long expectedValue = [(NSNumber *)modification.value longValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeLongLong: {\n            long long expectedValue = [(NSNumber *)modification.value longLongValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeUnsignedChar: {\n            unsigned char expectedValue = [(NSNumber *)modification.value unsignedCharValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeUnsignedInt: {\n            unsigned int expectedValue = [(NSNumber *)modification.value unsignedIntValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeUnsignedShort: {\n            unsigned short expectedValue = [(NSNumber *)modification.value unsignedShortValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeUnsignedLong: {\n            unsigned long expectedValue = [(NSNumber *)modification.value unsignedLongValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeUnsignedLongLong: {\n            unsigned long long expectedValue = [(NSNumber *)modification.value unsignedLongLongValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeFloat: {\n            float expectedValue = [(NSNumber *)modification.value floatValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeDouble: {\n            double expectedValue = [(NSNumber *)modification.value doubleValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeBOOL: {\n            BOOL expectedValue = [(NSNumber *)modification.value boolValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeSel: {\n            SEL expectedValue = NSSelectorFromString(modification.value);\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeClass: {\n            Class expectedValue = NSClassFromString(modification.value);\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeCGPoint: {\n            CGPoint expectedValue = [(NSValue *)modification.value CGPointValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeCGVector: {\n            CGVector expectedValue = [(NSValue *)modification.value CGVectorValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeCGSize: {\n            CGSize expectedValue = [(NSValue *)modification.value CGSizeValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeCGRect: {\n            CGRect expectedValue = [(NSValue *)modification.value CGRectValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeCGAffineTransform: {\n            CGAffineTransform expectedValue = [(NSValue *)modification.value CGAffineTransformValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeUIEdgeInsets: {\n            UIEdgeInsets expectedValue = [(NSValue *)modification.value UIEdgeInsetsValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeUIOffset: {\n            UIOffset expectedValue = [(NSValue *)modification.value UIOffsetValue];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            break;\n        }\n        case LookinAttrTypeCustomObj:\n        case LookinAttrTypeNSString: {\n            NSObject *expectedValue = modification.value;\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            [setterInvocation retainArguments];\n            break;\n        }\n        case LookinAttrTypeUIColor: {\n            NSArray<NSNumber *> *rgba = modification.value;\n            UIColor *expectedValue = [UIColor lks_colorFromRGBAComponents:rgba];\n            [setterInvocation setArgument:&expectedValue atIndex:2];\n            [setterInvocation retainArguments];\n            break;\n        }\n        default: {\n            completion(nil, LookinErr_Inner);\n            return;\n        }\n    }\n    \n    NSError *error = nil;\n    @try {\n        [setterInvocation invoke];\n    } @catch (NSException *exception) {\n        NSString *errorMsg = [NSString stringWithFormat:LKS_Localized(@\"<%@: %p>: an exception was raised when invoking %@. (%@)\"), NSStringFromClass(receiver.class), receiver, NSStringFromSelector(modification.setterSelector), exception.reason];\n        error = [NSError errorWithDomain:LookinErrorDomain code:LookinErrCode_Exception userInfo:@{NSLocalizedDescriptionKey:LKS_Localized(@\"The modification may failed.\"), NSLocalizedRecoverySuggestionErrorKey:errorMsg}];\n    } @finally {\n        \n    }\n    \n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        CALayer *layer = nil;\n        if ([receiver isKindOfClass:[CALayer class]]) {\n            layer = (CALayer *)receiver;\n        } else if ([receiver isKindOfClass:[UIView class]]) {\n            layer = ((UIView *)receiver).layer;\n        } else {\n            completion(nil, LookinErr_ObjNotFound);\n            return;\n        }\n        // 比如试图更改 frame 时，这个改动很有可能触发用户业务的 relayout，因此这时 dispatch 一下以确保拿到的 attrGroups 数据是最新的\n        LookinDisplayItemDetail *detail = [LookinDisplayItemDetail new];\n        detail.displayItemOid = modification.targetOid;\n        detail.attributesGroupList = [LKS_AttrGroupsMaker attrGroupsForLayer:layer];\n        detail.frameValue = [NSValue valueWithCGRect:layer.frame];\n        detail.boundsValue = [NSValue valueWithCGRect:layer.bounds];\n        detail.hiddenValue = [NSNumber numberWithBool:layer.isHidden];\n        detail.alphaValue = @(layer.opacity);\n        completion(detail, error);\n    });\n}\n\n\n+ (void)handlePatchWithTasks:(NSArray<LookinStaticAsyncUpdateTask *> *)tasks block:(void (^)(LookinDisplayItemDetail *data))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return;\n    }\n    [tasks enumerateObjectsUsingBlock:^(LookinStaticAsyncUpdateTask * _Nonnull task, NSUInteger idx, BOOL * _Nonnull stop) {\n        LookinDisplayItemDetail *itemDetail = [LookinDisplayItemDetail new];\n        itemDetail.displayItemOid = task.oid;\n        id object = [NSObject lks_objectWithOid:task.oid];\n        if (!object || ![object isKindOfClass:[CALayer class]]) {\n            block(itemDetail);\n            return;\n        }\n        \n        CALayer *layer = object;\n        if (task.taskType == LookinStaticAsyncUpdateTaskTypeSoloScreenshot) {\n            UIImage *image = [layer lks_soloScreenshotWithLowQuality:NO];\n            itemDetail.soloScreenshot = image;\n        } else if (task.taskType == LookinStaticAsyncUpdateTaskTypeGroupScreenshot) {\n            UIImage *image = [layer lks_groupScreenshotWithLowQuality:NO];\n            itemDetail.groupScreenshot = image;\n        }\n        block(itemDetail);\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/RequestHandler/LKS_AttrModificationPatchHandler.h",
    "content": "//\n//  LKS_AttrModificationPatchHandler.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/12.\n//  https://lookin.work\n//\n\n#import <Foundation/Foundation.h>\n\n@class LookinDisplayItemDetail;\n\n@interface LKS_AttrModificationPatchHandler : NSObject\n\n/**\n @param oids 数组内 idx 较小的应该为 displayItems 里的 subItem，idx 较大的应该为 superItem\n @param lowImageQuality 是否采用低图像质量\n @param block 该 block 会被多次调用，其中 tasksTotalCount 是总的调用次数（即可被用来作为 TotalResponseCount）\n */\n+ (void)handleLayerOids:(NSArray<NSNumber *> *)oids lowImageQuality:(BOOL)lowImageQuality block:(void (^)(LookinDisplayItemDetail *detail, NSUInteger tasksTotalCount, NSError *error))block;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/RequestHandler/LKS_AttrModificationPatchHandler.m",
    "content": "//\n//  LKS_AttrModificationPatchHandler.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/12.\n//  https://lookin.work\n//\n\n#import \"LKS_AttrModificationPatchHandler.h\"\n#import \"LookinDisplayItemDetail.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation LKS_AttrModificationPatchHandler\n\n+ (void)handleLayerOids:(NSArray<NSNumber *> *)oids lowImageQuality:(BOOL)lowImageQuality block:(void (^)(LookinDisplayItemDetail *detail, NSUInteger tasksTotalCount, NSError *error))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return;\n    }\n    if (![oids isKindOfClass:[NSArray class]]) {\n        block(nil, 1, LookinErr_Inner);\n        return;\n    }\n    \n    [oids enumerateObjectsUsingBlock:^(NSNumber * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        unsigned long oid = [obj unsignedLongValue];\n        LookinDisplayItemDetail *detail = [LookinDisplayItemDetail new];\n        detail.displayItemOid = oid;\n        \n        CALayer *layer = (CALayer *)[NSObject lks_objectWithOid:oid];\n        if (![layer isKindOfClass:[CALayer class]]) {\n            block(nil, idx + 1, LookinErr_ObjNotFound);\n            *stop = YES;\n            return;\n        }\n        \n        if (idx == 0) {\n            detail.soloScreenshot = [layer lks_soloScreenshotWithLowQuality:lowImageQuality];\n            detail.groupScreenshot = [layer lks_groupScreenshotWithLowQuality:lowImageQuality];\n        } else {\n            detail.groupScreenshot = [layer lks_groupScreenshotWithLowQuality:lowImageQuality];\n        }\n        block(detail, oids.count, nil);\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/RequestHandler/LKS_HierarchyDetailsHandler.h",
    "content": "//\n//  LKS_HierarchyDetailsHandler.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/20.\n//  https://lookin.work\n//\n\n#import <Foundation/Foundation.h>\n\n@class LookinDisplayItemDetail, LookinStaticAsyncUpdateTasksPackage;\n\ntypedef void (^LKS_HierarchyDetailsHandler_Block)(NSArray<LookinDisplayItemDetail *> *details, NSError *error);\n\n@interface LKS_HierarchyDetailsHandler : NSObject\n\n+ (instancetype)sharedInstance;\n\n/// packages 会按照 idx 从大到小的顺序被执行\n- (void)startWithPackages:(NSArray<LookinStaticAsyncUpdateTasksPackage *> *)packages block:(LKS_HierarchyDetailsHandler_Block)block;\n\n- (void)bringForwardWithPackages:(NSArray<LookinStaticAsyncUpdateTasksPackage *> *)packages;\n\n/// 取消所有任务\n- (void)cancel;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Connection/RequestHandler/LKS_HierarchyDetailsHandler.m",
    "content": "//\n//  LKS_HierarchyDetailsHandler.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/20.\n//  https://lookin.work\n//\n\n#import \"LKS_HierarchyDetailsHandler.h\"\n#import \"LookinDisplayItemDetail.h\"\n#import \"LKS_AttrGroupsMaker.h\"\n#import \"LookinStaticAsyncUpdateTask.h\"\n#import \"LKS_ConnectionManager.h\"\n#import \"LookinServerDefines.h\"\n\n@interface LKS_HierarchyDetailsHandler ()\n\n@property(nonatomic, strong) NSMutableArray<LookinStaticAsyncUpdateTasksPackage *> *taskPackages;\n@property(nonatomic, strong) NSMutableSet<LookinStaticAsyncUpdateTask *> *finishedTasks;\n/// 标识哪些 oid 已经拉取过 attrGroups 了\n@property(nonatomic, strong) NSMutableSet<NSNumber *> *attrGroupsSyncedOids;\n\n@property(nonatomic, copy) LKS_HierarchyDetailsHandler_Block handlerBlock;\n\n@property(nonatomic, assign) NSUInteger bbb;\n\n@end\n\n@implementation LKS_HierarchyDetailsHandler\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static LKS_HierarchyDetailsHandler *instance = nil;\n    dispatch_once(&onceToken,^{\n        instance = [[super allocWithZone:NULL] init];\n    });\n    return instance;\n}\n\n+ (id)allocWithZone:(struct _NSZone *)zone{\n    return [self sharedInstance];\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleConnectionDidEnd:) name:LKS_ConnectionDidEndNotificationName object:nil];\n        \n        self.attrGroupsSyncedOids = [NSMutableSet set];\n        self.finishedTasks = [NSMutableSet set];\n    }\n    return self;\n}\n\n- (void)startWithPackages:(NSArray<LookinStaticAsyncUpdateTasksPackage *> *)packages block:(LKS_HierarchyDetailsHandler_Block)block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return;\n    }\n    if (!packages.count) {\n        block(nil, LookinErr_Inner);\n        return;\n    }\n    [self.finishedTasks removeAllObjects];\n    [self.attrGroupsSyncedOids removeAllObjects];\n    self.taskPackages = [packages mutableCopy];\n    self.handlerBlock = block;\n    \n    [UIView lks_rebuildGlobalInvolvedRawConstraints];\n    \n    [self _dequeueAndHandlePackage];\n}\n\n- (void)bringForwardWithPackages:(NSArray<LookinStaticAsyncUpdateTasksPackage *> *)packages {\n    NSLog(@\"LookinServer - willBringForward\");\n    NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, packages.count)];\n    [self.taskPackages insertObjects:packages atIndexes:indexSet];\n}\n\n- (void)cancel {\n    [self.taskPackages removeAllObjects];\n}\n\n- (void)_dequeueAndHandlePackage {\n    dispatch_async(dispatch_get_main_queue(), ^{\n        LookinStaticAsyncUpdateTasksPackage *package = self.taskPackages.firstObject;\n        if (!package) {\n            return;\n        }\n        //        NSLog(@\"LookinServer - will handle tasks, count: %@\", @(tasks.count));\n        NSArray<LookinDisplayItemDetail *> *details = [package.tasks lookin_map:^id(NSUInteger idx, LookinStaticAsyncUpdateTask *task) {\n            if ([self.finishedTasks containsObject:task]) {\n                return nil;\n            }\n            [self.finishedTasks addObject:task];\n            \n            LookinDisplayItemDetail *itemDetail = [LookinDisplayItemDetail new];\n            itemDetail.displayItemOid = task.oid;\n            \n            id object = [NSObject lks_objectWithOid:task.oid];\n            if (!object || ![object isKindOfClass:[CALayer class]]) {\n                return itemDetail;\n            }\n            \n            CALayer *layer = object;\n            \n            if (![self.attrGroupsSyncedOids containsObject:@(task.oid)]) {\n                itemDetail.attributesGroupList = [LKS_AttrGroupsMaker attrGroupsForLayer:layer];\n                [self.attrGroupsSyncedOids addObject:@(task.oid)];\n            }\n            if (task.taskType == LookinStaticAsyncUpdateTaskTypeSoloScreenshot) {\n                UIImage *image = [layer lks_soloScreenshotWithLowQuality:NO];\n                itemDetail.soloScreenshot = image;\n            } else if (task.taskType == LookinStaticAsyncUpdateTaskTypeGroupScreenshot) {\n                UIImage *image = [layer lks_groupScreenshotWithLowQuality:NO];\n                itemDetail.groupScreenshot = image;\n            }\n            return itemDetail;\n        }];\n        self.handlerBlock(details, nil);\n        \n        [self.taskPackages removeObjectAtIndex:0];\n        [self _dequeueAndHandlePackage];\n    });\n}\n\n- (void)_handleConnectionDidEnd:(id)obj {\n    [self cancel];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Inspect/LKS_LocalInspectManager.h",
    "content": "//\n//  LKS_LocalInspectManager.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/8.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n@interface LKS_LocalInspectContainerWindow : UIWindow\n\n@end\n\n@interface LKS_LocalInspectManager : NSObject\n\n+ (instancetype)sharedInstance;\n\n- (void)startLocalInspectWithIncludedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Inspect/LKS_LocalInspectManager.m",
    "content": "//\n//  LKS_LocalInspectManager.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/8.\n//  https://lookin.work\n//\n\n#import \"LKS_LocalInspectManager.h\"\n#import \"LKS_ConnectionManager.h\"\n#import \"LKS_TraceManager.h\"\n#import \"LKS_LocalInspectViewController.h\"\n\n@implementation LKS_LocalInspectContainerWindow\n\n@end\n\n@interface LKS_LocalInspectManager ()\n\n@property(nonatomic, weak) UIWindow *previousKeyWindow;\n\n@property(nonatomic, strong) LKS_LocalInspectContainerWindow *inspectorWindow;\n\n@property(nonatomic, strong) LKS_LocalInspectViewController *viewController;\n\n@property(nonatomic, strong) UITapGestureRecognizer *tapRecognizer;\n\n@property(nonatomic, assign) BOOL isInspecting;\n\n@property(nonatomic, copy) NSArray<UIWindow *> *includedWindows;\n\n@end\n\n@implementation LKS_LocalInspectManager\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static LKS_LocalInspectManager *instance = nil;\n    dispatch_once(&onceToken,^{\n        instance = [[super allocWithZone:NULL] init];\n    });\n    return instance;\n}\n\n+ (id)allocWithZone:(struct _NSZone *)zone{\n    return [self sharedInstance];\n}\n\n- (void)startLocalInspectWithIncludedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows {\n    NSLog(@\"LookinServer - Will start inspecting in 2D\");\n    \n    [[NSNotificationCenter defaultCenter] postNotificationName:@\"Lookin_WillEnter2D\" object:nil];\n    \n    self.isInspecting = YES;\n\n    [[LKS_TraceManager sharedInstance] reload];\n\n    [self _setupWindowIfNeeded];\n    self.viewController.showTitleButton = YES;\n    self.inspectorWindow.userInteractionEnabled = YES;\n    [self.viewController clearContents];\n    self.viewController.prevKeyWindow = self.previousKeyWindow;\n    self.viewController.includedWindows = includedWindows;\n    self.viewController.excludedWindows = excludedWindows;\n    [self.viewController startTitleButtonAnimIfNeeded];\n}\n\n- (void)_endLocalInspect {\n    self.isInspecting = NO;\n    \n    self.viewController.showTitleButton = NO;\n    self.viewController.includedWindows = nil;\n    self.viewController.excludedWindows = nil;\n    [self _removeWindowIfNeeded];\n    self.inspectorWindow.userInteractionEnabled = NO;\n    \n    [[NSNotificationCenter defaultCenter] postNotificationName:@\"Lookin_DidExit2D\" object:nil];\n    NSLog(@\"LookinServer - Did end inspecting in 2D\");\n}\n\n- (void)_setupWindowIfNeeded {\n    if (!self.inspectorWindow) {\n        self.inspectorWindow = [LKS_LocalInspectContainerWindow new];\n        self.inspectorWindow.windowLevel = UIWindowLevelAlert - 1;\n        self.inspectorWindow.backgroundColor = [UIColor clearColor];\n    }\n    if (!self.viewController) {\n        self.viewController = [LKS_LocalInspectViewController new];\n        __weak __typeof(self)weakSelf = self;\n        self.viewController.didSelectExit = ^{\n            [weakSelf _endLocalInspect];\n        };\n        self.inspectorWindow.rootViewController = self.viewController;\n    }\n    if (!self.inspectorWindow.hidden) {\n        return;\n    }\n    self.previousKeyWindow = [UIApplication sharedApplication].keyWindow;\n    self.viewController.prevKeyWindow = self.previousKeyWindow;\n    [self.inspectorWindow makeKeyAndVisible];\n}\n\n- (void)_removeWindowIfNeeded {\n    if (!self.inspectorWindow || self.inspectorWindow.hidden) {\n        return;\n    }\n    \n    if ([[UIApplication sharedApplication] keyWindow] == self.inspectorWindow) {\n        if (self.previousKeyWindow.hidden) {\n            ///TODO 到底该用 keyWindow 还是 delegate.window\n            [[UIApplication sharedApplication].delegate.window makeKeyWindow];\n        } else {\n            [self.previousKeyWindow makeKeyWindow];\n        }\n    }\n    self.inspectorWindow.hidden = YES;\n    self.previousKeyWindow = nil;\n    self.viewController.prevKeyWindow = nil;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Inspect/LKS_LocalInspectPanelLabelView.h",
    "content": "//\n//  LKS_LocalInspectPanelLabelView.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/15.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface LKS_LocalInspectPanelLabelView : UIView\n\n@property(nonatomic, strong) UILabel *leftLabel;\n@property(nonatomic, strong) UILabel *rightLabel;\n@property(nonatomic, assign) CGFloat verInset;\n@property(nonatomic, assign) CGFloat interspace;\n@property(nonatomic, strong) CALayer *bottomBorderLayer;\n\n- (void)addBottomBorderLayer;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Inspect/LKS_LocalInspectPanelLabelView.m",
    "content": "//\n//  LKS_LocalInspectPanelLabelView.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/15.\n//  https://lookin.work\n//\n\n#import \"LKS_LocalInspectPanelLabelView.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation LKS_LocalInspectPanelLabelView {\n    CGFloat _horInset;\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if (self = [super initWithFrame:frame]) {\n        _horInset = 8;\n        _interspace = 10;\n        \n        self.userInteractionEnabled = NO;\n        \n        self.leftLabel = [UILabel new];\n        self.leftLabel.textAlignment = NSTextAlignmentLeft;\n        [self addSubview:self.leftLabel];\n        \n        self.rightLabel = [UILabel new];\n        self.rightLabel.textAlignment = NSTextAlignmentRight;\n        [self addSubview:self.rightLabel];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    self.leftLabel.frame = CGRectMake(_horInset, 0, self.leftLabel.lks_bestWidth, self.bounds.size.height);\n    \n    if (self.rightLabel.text.length) {\n        CGFloat rightLabelWidth = self.bounds.size.width - _horInset - _interspace - CGRectGetMaxX(self.leftLabel.frame);\n        if (rightLabelWidth <= 0) {\n            self.rightLabel.frame = CGRectZero;\n        } else {\n            self.rightLabel.frame = CGRectMake(CGRectGetMaxX(self.leftLabel.frame) + _interspace, 0, rightLabelWidth, self.bounds.size.height);\n        }\n    }\n    \n    self.bottomBorderLayer.frame = CGRectMake(_horInset, self.bounds.size.height, self.bounds.size.width - _horInset * 2, 1 / [[UIScreen mainScreen] scale]);\n}\n\n- (CGSize)sizeThatFits:(CGSize)size {\n    CGSize leftSize = [self.leftLabel sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];\n    size.height = leftSize.height + self.verInset;\n    size.width = _horInset * 2 + leftSize.width;\n    if (self.rightLabel.text.length) {\n        size.width += self.rightLabel.lks_bestWidth + _interspace;\n    }\n    return size;\n}\n\n- (void)addBottomBorderLayer {\n    if (self.bottomBorderLayer) {\n        return;\n    }\n    self.bottomBorderLayer = [CALayer new];\n    [self.bottomBorderLayer lookin_removeImplicitAnimations];\n    self.bottomBorderLayer.backgroundColor = [UIColor colorWithRed:222/255.0 green:224/255.0 blue:226/255.0 alpha:1].CGColor;\n    [self.layer addSublayer:self.bottomBorderLayer];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Inspect/LKS_LocalInspectViewController.h",
    "content": "//\n//  LKS_LocalInspectViewController.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/15.\n//  https://lookin.work\n//\n\n#import <UIKit/UIKit.h>\n\n@interface LKS_LocalInspectViewController : UIViewController\n\n/// 用户点击了“退出”\n@property(nonatomic, copy) void (^didSelectExit)(void);\n\n- (void)highlightLayer:(CALayer *)layer;\n\n@property(nonatomic, assign) BOOL showTitleButton;\n\n- (void)clearContents;\n\n- (void)startTitleButtonAnimIfNeeded;\n\n@property(nonatomic, copy) NSArray<UIWindow *> *includedWindows;\n@property(nonatomic, copy) NSArray<UIWindow *> *excludedWindows;\n\n@property(nonatomic, weak) UIWindow *prevKeyWindow;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Inspect/LKS_LocalInspectViewController.m",
    "content": "//\n//  LKS_LocalInspectViewController.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/15.\n//  https://lookin.work\n//\n\n#import \"LKS_LocalInspectViewController.h\"\n#import \"LKS_LocalInspectPanelLabelView.h\"\n#import \"LookinIvarTrace.h\"\n#import \"LookinHierarchyInfo.h\"\n#import \"UIImage+LookinServer.h\"\n#import \"LookinServerDefines.h\"\n\nstatic CGRect const kInvalidRect = (CGRect){-2, -2, 0, 0};\n\n@interface LKS_LocalInspectViewController ()\n\n@property(nonatomic, strong) CALayer *highlightLayer;\n@property(nonatomic, strong) CALayer *referLayer;\n\n@property(nonatomic, assign) CGRect highlightRect;\n@property(nonatomic, assign) CGRect referRect;\n\n@property(nonatomic, copy) NSArray<CALayer *> *rulerLayers;\n@property(nonatomic, copy) NSArray<UILabel *> *rulerLabels;\n\n@property(nonatomic, strong) UIButton *titleButton;\n\n@property(nonatomic, strong) UIView *panelView;\n@property(nonatomic, strong) LKS_LocalInspectPanelLabelView *titleLabelView;\n@property(nonatomic, strong) NSArray<LKS_LocalInspectPanelLabelView *> *contentLabelViews;\n\n@property(nonatomic, strong) UITapGestureRecognizer *tapRecognizer;\n@property(nonatomic, strong) UIPanGestureRecognizer *panRecognizer;\n\n@end\n\n@implementation LKS_LocalInspectViewController {\n    CGFloat _panelContentsMarginTop;\n    CGFloat _panelInsetTop;\n    CGFloat _panelInsetBottom;\n}\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    \n    _panelContentsMarginTop = 3;\n    _panelInsetTop = 1;\n    _panelInsetBottom = 5;\n    \n    self.view.layer.lks_isLookinPrivateLayer = YES;\n    \n    self.highlightLayer = [CALayer layer];\n    self.highlightLayer.backgroundColor = [UIColor colorWithRed:69/255.0 green:143/255.0 blue:208/255.0 alpha:.4].CGColor;\n    [self.highlightLayer lookin_removeImplicitAnimations];\n    [self.view.layer addSublayer:self.highlightLayer];\n    \n    self.referLayer = [CALayer layer];\n    self.referLayer.backgroundColor = [UIColor colorWithRed:69/255.0 green:143/255.0 blue:208/255.0 alpha:.09].CGColor;\n    [self.referLayer lookin_removeImplicitAnimations];\n    [self.view.layer addSublayer:self.referLayer];\n    \n    self.titleButton = [UIButton new];\n    self.titleButton.hidden = YES;\n    self.titleButton.clipsToBounds = YES;\n    self.titleButton.contentEdgeInsets = UIEdgeInsetsMake(6, 10, 6, 10);\n    self.titleButton.layer.backgroundColor = [UIColor colorWithRed:208/255.0 green:2/255.0 blue:27/255.0 alpha:9].CGColor;\n    [self.titleButton addTarget:self action:@selector(_handleExitButton) forControlEvents:UIControlEventTouchUpInside];\n    [self.titleButton setAttributedTitle:({\n        NSAttributedString *str1 = [[NSAttributedString alloc] initWithString:LKS_Localized(@\"Tap or swipe to inspect\") attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:13]}];\n        NSAttributedString *str2 = [[NSAttributedString alloc] initWithString:@\" | \" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithWhite:1 alpha:.5], NSFontAttributeName:[UIFont systemFontOfSize:13]}];\n        NSAttributedString *str3 = [[NSAttributedString alloc] initWithString:LKS_Localized(@\"Exit\") attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:13]}];\n        \n        NSMutableAttributedString *combinedStr = [NSMutableAttributedString new];\n        [combinedStr appendAttributedString:str1];\n        [combinedStr appendAttributedString:str2];\n        [combinedStr appendAttributedString:str3];\n        combinedStr;\n        \n    }) forState:UIControlStateNormal];\n    [self.view addSubview:self.titleButton];\n    \n    self.rulerLayers = [NSArray lookin_arrayWithCount:4 block:^id(NSUInteger idx) {\n        CALayer *layer = [CALayer new];\n        [layer lookin_removeImplicitAnimations];\n        layer.backgroundColor = [UIColor colorWithRed:69/255.0 green:143/255.0 blue:208/255.0 alpha:.4].CGColor;\n        [self.view.layer addSublayer:layer];\n        return layer;\n    }];\n    \n    self.rulerLabels = [NSArray lookin_arrayWithCount:4 block:^id(NSUInteger idx) {\n        UILabel *label = [UILabel new];\n        label.userInteractionEnabled = NO;\n        label.backgroundColor = [UIColor colorWithRed:26/255.0 green:154/255.0 blue:251/255.0 alpha:1];\n        label.font = [UIFont systemFontOfSize:10];\n        label.textColor = [UIColor whiteColor];\n        label.textAlignment = NSTextAlignmentCenter;\n        label.clipsToBounds = YES;\n        [self.view addSubview:label];\n        return label;\n    }];\n    \n    self.panelView = [UIView new];\n    self.panelView.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:.9];\n    self.panelView.layer.borderColor = [UIColor lightGrayColor].CGColor;\n    self.panelView.layer.borderWidth = 1 / [[UIScreen mainScreen] scale];\n    self.panelView.userInteractionEnabled = NO;\n    self.panelView.layer.cornerRadius = 5;\n    self.panelView.hidden = YES;\n    [self.view addSubview:self.panelView];\n    \n    self.titleLabelView = [LKS_LocalInspectPanelLabelView new];\n    self.titleLabelView.verInset = 10;\n    self.titleLabelView.leftLabel.font = [UIFont boldSystemFontOfSize:13];\n    self.titleLabelView.rightLabel.font = [UIFont systemFontOfSize:13];\n    self.titleLabelView.leftLabel.textColor = [UIColor blackColor];\n    self.titleLabelView.rightLabel.textColor = [UIColor blackColor];\n    self.titleLabelView.interspace = 20;\n    [self.titleLabelView addBottomBorderLayer];\n    [self.panelView addSubview:self.titleLabelView];\n    \n    self.contentLabelViews = [NSArray array];\n    \n    self.tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTapRecognizer:)];\n    [self.view addGestureRecognizer:self.tapRecognizer];\n    \n    self.panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_handlePanRecognizer:)];\n    [self.view addGestureRecognizer:self.panRecognizer];\n    \n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleEnterForegound) name:UIApplicationWillEnterForegroundNotification object:nil];\n}\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n\n    self.highlightLayer.frame = self.highlightRect;\n    self.referLayer.frame = self.referRect;\n    \n    if (!self.panelView.hidden) {\n        CGRect contentRect = CGRectEqualToRect(kInvalidRect, self.referRect) ? self.highlightRect : self.referRect;\n        [self _layoutPanelViewWithContentRect:contentRect];\n    }\n    \n    [self _renderAndLayoutRulersWithHighlightRect:self.highlightRect referRect:self.referRect];\n    \n    if (!self.titleButton.hidden) {\n        [self _layoutTitleButtonReferToPanelView];\n    }\n}\n\n- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {\n    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];\n    [self clearContents];\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n- (void)highlightLayer:(CALayer *)layer {\n    BOOL isValidLayer = ([layer isKindOfClass:[CALayer class]] && self.view.window && layer.lks_window);\n    if (!isValidLayer) {\n        self.highlightRect = kInvalidRect;\n        self.referRect = kInvalidRect;\n        self.panelView.hidden = YES;\n        [self.view setNeedsLayout];\n        return;\n    }\n    \n    self.highlightRect = [layer lks_frameInWindow:self.view.window];\n    self.referRect = ({\n        CALayer *referLayer = nil;\n        CALayer *temp_referLayer = layer.superlayer;\n        while (temp_referLayer) {\n            if (temp_referLayer && !CGRectEqualToRect(temp_referLayer.bounds, layer.frame)) {\n                referLayer = temp_referLayer;\n                break;\n            }\n            temp_referLayer = temp_referLayer.superlayer;\n        }\n        referLayer ? [referLayer lks_frameInWindow:self.view.window] : kInvalidRect;\n    });\n    \n    self.titleLabelView.leftLabel.text = [self _titleStringForLayer:layer];\n    self.titleLabelView.rightLabel.text = [self _subtitleStringForLayer:layer];\n    NSArray<NSArray<NSString *> *> *contents = [self _contentStringsForLayer:layer];\n    \n    self.contentLabelViews = [self.contentLabelViews lookin_resizeWithCount:contents.count add:^LKS_LocalInspectPanelLabelView *(NSUInteger idx) {\n        LKS_LocalInspectPanelLabelView *view = [LKS_LocalInspectPanelLabelView new];\n        view.verInset = 4;\n        view.leftLabel.font = [UIFont systemFontOfSize:13];\n        view.rightLabel.font = [UIFont systemFontOfSize:13];\n        view.leftLabel.textColor = [UIColor grayColor];\n        view.rightLabel.textColor = [UIColor blackColor];\n        [self.panelView addSubview:view];\n        return view;\n        \n    } remove:^(NSUInteger idx, LKS_LocalInspectPanelLabelView *obj) {\n        [obj removeFromSuperview];\n        \n    } doNext:^(NSUInteger idx, LKS_LocalInspectPanelLabelView *obj) {\n        NSArray<NSString *> *strings = contents[idx];\n        obj.leftLabel.text = strings.firstObject;\n        obj.rightLabel.text = strings.lastObject;\n    }];\n    self.panelView.hidden = NO;\n    \n    [self.view setNeedsLayout];\n}\n\n- (void)setShowTitleButton:(BOOL)showTitleButton {\n    _showTitleButton = showTitleButton;\n    if (showTitleButton) {\n        self.titleButton.hidden = NO;\n        [self _layoutTitleButtonReferToPanelView];\n    } else {\n        self.titleButton.hidden = YES;\n        [self.titleButton.layer removeAllAnimations];\n    }\n}\n\n- (void)startTitleButtonAnimIfNeeded {\n    if (self.titleButton.hidden) {\n        return;\n    }\n    CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@\"backgroundColor\"];\n    anim.fromValue = (id)[UIColor colorWithRed:208/255.0 green:2/255.0 blue:27/255.0 alpha:9].CGColor;\n    anim.toValue = (id)[UIColor colorWithRed:208/255.0 green:2/255.0 blue:27/255.0 alpha:.7].CGColor;\n    anim.duration = .8;\n    anim.repeatCount = HUGE_VALF;\n    anim.autoreverses = YES;\n    [self.titleButton.layer removeAllAnimations];\n    [self.titleButton.layer addAnimation:anim forKey:nil];\n}\n\n#pragma mark - Setter\n\n- (void)setReferRect:(CGRect)referRect {\n    _referRect = referRect;\n    [self _didSetReferOrHighlightLayer];\n}\n\n- (void)setHighlightRect:(CGRect)highlightRect {\n    _highlightRect = highlightRect;\n    [self _didSetReferOrHighlightLayer];\n}\n\n- (void)_didSetReferOrHighlightLayer {\n    if (!CGRectEqualToRect(kInvalidRect, self.referRect) && !CGRectIntersectsRect(self.referRect, self.highlightRect)) {\n        self.referLayer.backgroundColor = [UIColor colorWithRed:69/255.0 green:143/255.0 blue:208/255.0 alpha:.4].CGColor;\n    } else {\n        self.referLayer.backgroundColor = [UIColor colorWithRed:69/255.0 green:143/255.0 blue:208/255.0 alpha:.07].CGColor;\n    }\n}\n\n#pragma mark - Layout\n\n- (void)_layoutPanelViewWithContentRect:(CGRect)contentRect {\n    if (CGRectEqualToRect(contentRect, CGRectNull)) {\n        self.panelView.frame = kInvalidRect;\n        return;\n    }\n    \n    CGSize containerSize = self.view.bounds.size;\n    \n    CGFloat panelWidth = self.titleLabelView.lks_bestWidth;\n    panelWidth = [self.contentLabelViews lookin_reduceCGFloat:^CGFloat(CGFloat accumulator, NSUInteger idx, LKS_LocalInspectPanelLabelView *obj) {\n        return MAX(accumulator, obj.lks_bestWidth);\n    } initialAccumlator:panelWidth];\n    \n    CGFloat screenInset = 10;\n    panelWidth = MIN(panelWidth, containerSize.width - screenInset * 2);\n    \n    self.titleLabelView.frame = CGRectMake(0, _panelInsetTop, panelWidth, self.titleLabelView.lks_bestHeight);\n    __block CGFloat posY = CGRectGetMaxY(self.titleLabelView.frame) + _panelContentsMarginTop;\n    \n    [self.contentLabelViews enumerateObjectsUsingBlock:^(LKS_LocalInspectPanelLabelView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        obj.frame = CGRectMake(0, posY, panelWidth, obj.lks_bestHeight);\n        posY = CGRectGetMaxY(obj.frame);\n    }];\n    posY += _panelInsetBottom;\n    \n    CGSize panelSize = CGSizeMake(panelWidth, posY);\n    CGFloat panelMargin = 10;\n    \n    CGFloat panelY = ({\n        CGFloat y = 0;\n        \n        CGFloat panelMinY = screenInset;\n        if (@available(iOS 11.0, tvOS 11.0, *)) {\n            panelMinY = self.view.safeAreaInsets.top;\n        }\n        \n        CGFloat panelMinBottomNeeded = screenInset;\n        if (@available(iOS 11.0, tvOS 11.0, *)) {\n            panelMinBottomNeeded = self.view.safeAreaInsets.bottom;\n        }\n        panelMinBottomNeeded += panelSize.height;\n        \n        if (contentRect.origin.y - panelSize.height >= panelMinY) {\n            // 放到目标上方\n            y = contentRect.origin.y - panelMargin - panelSize.height;\n        } else {\n            CGFloat targetBottom = containerSize.height - CGRectGetMaxY(contentRect);\n            if (targetBottom > panelMinBottomNeeded) {\n                // 放到目标下方\n                y = CGRectGetMaxY(contentRect) + panelMargin;\n            } else {\n                // 放到目标内部的上方\n                y = contentRect.origin.y + panelMargin;\n                if (@available(iOS 11.0, tvOS 11.0, *)) {\n                    y = MAX(y, self.view.safeAreaInsets.top);\n                }\n            }\n        }\n        \n        y;\n    });\n    \n    CGFloat panelX = ({\n        CGFloat x = 0;\n        // 先尝试和目标居中\n        x = CGRectGetMidX(contentRect) - panelSize.width / 2.0;\n        if (x <= 0) {\n            // 如果超出了左边屏幕，则挪到距离屏幕左边\n            x = screenInset;\n        } else if (x + panelSize.width > containerSize.width) {\n            // 如果超出了右边屏幕，则挪到距离屏幕右边 labelMargin 的距离\n            x = containerSize.width - screenInset - panelSize.width;\n        }\n        x;\n    });\n    self.panelView.frame = CGRectMake(panelX, panelY, panelSize.width, panelSize.height);\n}\n\n- (void)_renderAndLayoutRulersWithHighlightRect:(CGRect)highlightRect referRect:(CGRect)referRect {\n    BOOL showRulers = !CGRectEqualToRect(highlightRect, kInvalidRect) && !CGRectEqualToRect(referRect, kInvalidRect);\n    if (!showRulers) {\n        [self.rulerLayers enumerateObjectsUsingBlock:^(CALayer * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n            obj.frame = CGRectZero;\n        }];\n        [self.rulerLabels enumerateObjectsUsingBlock:^(UILabel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n            obj.frame = CGRectZero;\n        }];\n        return;\n    }\n    \n    CGFloat horInset = 8;\n    CGFloat verInset = 4;\n    CALayer *layer = self.rulerLayers[0];\n    UILabel *label = self.rulerLabels[0];\n    \n    // top\n    if (CGRectGetMinY(highlightRect) > CGRectGetMinY(referRect)) {\n        \n        CGFloat value = 0;\n        if (CGRectGetMinY(highlightRect) > CGRectGetMaxY(referRect)) {\n            value = CGRectGetMinY(highlightRect) - CGRectGetMaxY(referRect);\n        } else {\n            value = CGRectGetMinY(highlightRect) - CGRectGetMinY(referRect);\n        }\n        layer.frame = CGRectMake(CGRectGetMidX(highlightRect), CGRectGetMinY(highlightRect) - value, 1, value);\n        label.text = [NSString lookin_stringFromDouble:value decimal:1];;\n        CGSize bestSize = label.lks_bestSize;\n        CGSize adjustedSize = CGSizeMake(bestSize.width + horInset, bestSize.height + verInset);\n        label.layer.cornerRadius = adjustedSize.height / 2.0;\n        label.frame = CGRectMake(CGRectGetMaxX(layer.frame) + 2, CGRectGetMidY(layer.frame) - adjustedSize.height / 2.0, adjustedSize.width, adjustedSize.height);\n    } else {\n        layer.frame = CGRectZero;\n        label.frame = CGRectZero;\n    }\n    \n    // left\n    layer = self.rulerLayers[1];\n    label = self.rulerLabels[1];\n    if (CGRectGetMinX(highlightRect) > CGRectGetMinX(referRect)) {\n        CGFloat value = 0;\n        if (CGRectGetMinX(highlightRect) > CGRectGetMaxX(referRect)) {\n            value = CGRectGetMinX(highlightRect) - CGRectGetMaxX(referRect);\n        } else {\n            value = CGRectGetMinX(highlightRect) - CGRectGetMinX(referRect);\n        }\n        layer.frame = CGRectMake(CGRectGetMinX(highlightRect) - value, CGRectGetMidY(highlightRect), value, 1);\n        label.text = [NSString lookin_stringFromDouble:value decimal:1];;\n        CGSize bestSize = label.lks_bestSize;\n        CGSize adjustedSize = CGSizeMake(bestSize.width + horInset, bestSize.height + verInset);\n        label.layer.cornerRadius = adjustedSize.height / 2.0;\n        label.frame = CGRectMake(CGRectGetMidX(layer.frame), CGRectGetMinY(layer.frame) - 2 - adjustedSize.height, adjustedSize.width, adjustedSize.height);\n    } else {\n        layer.frame = CGRectZero;\n        label.frame = CGRectZero;\n    }\n    \n    // bottom\n    layer = self.rulerLayers[2];\n    label = self.rulerLabels[2];\n    if (CGRectGetMaxY(highlightRect) < CGRectGetMaxY(referRect)) {\n        CGFloat value = 0;\n        if (CGRectGetMaxY(highlightRect) < CGRectGetMinY(referRect)) {\n            value = CGRectGetMinY(referRect) - CGRectGetMaxY(highlightRect);\n        } else {\n            value = CGRectGetMaxY(referRect) - CGRectGetMaxY(highlightRect);\n        }\n        layer.frame = CGRectMake(CGRectGetMidX(highlightRect), CGRectGetMaxY(highlightRect), 1, value);\n        label.text = [NSString lookin_stringFromDouble:value decimal:1];;\n        CGSize bestSize = label.lks_bestSize;\n        CGSize adjustedSize = CGSizeMake(bestSize.width + horInset, bestSize.height + verInset);\n        label.layer.cornerRadius = adjustedSize.height / 2.0;\n        label.frame = CGRectMake(CGRectGetMaxX(layer.frame) + 2, CGRectGetMidY(layer.frame) - adjustedSize.height / 2.0, adjustedSize.width, adjustedSize.height);\n    } else {\n        layer.frame = CGRectZero;\n        label.frame = CGRectZero;\n    }\n    \n    // right\n    layer = self.rulerLayers[3];\n    label = self.rulerLabels[3];\n    if (CGRectGetMaxX(highlightRect) < CGRectGetMaxX(referRect)) {\n        CGFloat value = 0;\n        if (CGRectGetMaxX(highlightRect) < CGRectGetMinX(referRect)) {\n            value = CGRectGetMinX(referRect) - CGRectGetMaxX(highlightRect);\n        } else {\n            value = CGRectGetMaxX(referRect) - CGRectGetMaxX(highlightRect);\n        }\n        layer.frame = CGRectMake(CGRectGetMaxX(highlightRect), CGRectGetMidY(highlightRect), value, 1);\n        label.text = [NSString lookin_stringFromDouble:value decimal:1];;\n        CGSize bestSize = label.lks_bestSize;\n        CGSize adjustedSize = CGSizeMake(bestSize.width + horInset, bestSize.height + verInset);\n        label.layer.cornerRadius = adjustedSize.height / 2.0;\n        label.frame = CGRectMake(CGRectGetMidX(layer.frame) - adjustedSize.width / 2.0, CGRectGetMinY(layer.frame) - 2 - adjustedSize.height, adjustedSize.width, adjustedSize.height);\n    } else {\n        layer.frame = CGRectZero;\n        label.frame = CGRectZero;\n    }\n}\n\n- (void)_layoutTitleButtonReferToPanelView {\n    /**\n     0: 放到屏幕顶部或底部都可以\n     1：需要放到屏幕底部\n     2: 需要放到屏幕顶部\n     */\n    NSUInteger positionType = 0;\n    \n    if (self.panelView.hidden) {\n        positionType = 0;\n    } else {\n        if (CGRectGetMinY(self.panelView.frame) <= 200) {\n            positionType = 1;\n        } else if (CGRectGetMaxY(self.panelView.frame) >= self.view.bounds.size.height - 200) {\n            positionType = 2;\n        } else {\n            positionType = 0;\n        }\n    }\n    \n    if (positionType == 0) {\n        if (self.titleButton.frame.origin.y <= 0 || self.titleButton.frame.origin.y > self.view.bounds.size.height / 2.0) {\n            positionType = 1;\n        } else {\n            positionType = 2;\n        }\n    }\n    \n    self.titleButton.frame = ({\n        CGSize size = [self.titleButton sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];\n        CGFloat x = self.view.bounds.size.width / 2.0 - size.width / 2.0;\n        CGFloat y;\n        if (positionType == 1) {\n            // 放到屏幕底部\n            if (@available(iOS 11.0, tvOS 11.0, *)) {\n                y = self.view.bounds.size.height - size.height - MAX(self.view.safeAreaInsets.bottom, 20);\n            } else {\n                y = self.view.bounds.size.height - size.height - 20;\n            }\n        } else {\n            NSAssert(positionType == 2, @\"\");\n            // 放到屏幕顶部\n            if (@available(iOS 11.0, tvOS 11.0, *)) {\n                y = MAX(self.view.safeAreaInsets.top, 20);\n            } else {\n                y = 20;\n            }\n        }\n        CGRectMake(x, y, size.width, size.height);\n    });\n    self.titleButton.layer.cornerRadius = self.titleButton.bounds.size.height / 2.0;\n}\n\n#pragma mark - Event Handler\n\n- (void)_handleTapRecognizer:(UITapGestureRecognizer *)recognizer {\n    CGPoint point = [recognizer locationInView:self.view];\n    UIView *view = [self _targetViewAtPoint:point];\n    if (view) {\n        [self highlightLayer:view.layer];\n    } else {\n        self.highlightRect = kInvalidRect;\n        self.referRect = kInvalidRect;\n        [self.view setNeedsLayout];\n        \n        NSLog(@\"LookinServer - No valid view was found at tap position %@ in 2D inspecting.\", NSStringFromCGPoint(point));\n    }\n}\n\n- (void)_handlePanRecognizer:(UIPanGestureRecognizer *)recognizer {\n    self.panelView.hidden = YES;\n    \n    if (recognizer.state == UIGestureRecognizerStateBegan) {\n        CGPoint point = [recognizer locationInView:self.view];\n        UIView *view = [self _targetViewAtPoint:point];\n        \n        if (view) {\n            CGRect newHighlightRect = [view.layer lks_frameInWindow:self.view.window];\n            CGFloat offsetX = ABS(CGRectGetMidX(self.highlightRect) - CGRectGetMidX(newHighlightRect));\n            CGFloat offsetY = ABS(CGRectGetMidY(self.highlightRect) - CGRectGetMidY(newHighlightRect));\n            if (offsetX > 200 || offsetY > 200) {\n                self.highlightRect = newHighlightRect;\n            }\n        }\n        self.referRect = kInvalidRect;\n        \n    } else if (recognizer.state == UIGestureRecognizerStateChanged) {\n        if (CGRectEqualToRect(kInvalidRect, self.highlightRect)) {\n            return;\n        }\n        \n        CGPoint point = [recognizer locationInView:self.view];\n        UIView *endView = [self _targetViewAtPoint:point];\n        if (endView) {\n            self.referRect = [endView.layer lks_frameInWindow:self.view.window];\n        } else {\n            self.referRect = kInvalidRect;\n        }\n        [self.view setNeedsLayout];\n    }\n}\n\n- (void)_handleExitButton {\n    if (self.didSelectExit) {\n        self.didSelectExit();\n    }\n}\n\n- (void)_handleEnterForegound {\n    [self startTitleButtonAnimIfNeeded];\n}\n\n#pragma mark - Others\n\n/// 该 point 是在 self.view 的坐标系下\n- (UIView *)_targetViewAtPoint:(CGPoint)point {\n    __block UIView *targetView = nil;\n    \n    [[UIApplication sharedApplication].windows enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(__kindof UIWindow * _Nonnull window, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (targetView) {\n            *stop = YES;\n            return;\n        }\n        if (self.includedWindows.count) {\n            if (![self.includedWindows containsObject:window]) {\n                return;\n            }\n        } else if ([self.excludedWindows containsObject:window]) {\n            return;\n        }\n        \n        if (window == self.view.window) {\n            return;\n        }\n        if (window.hidden) {\n            return;\n        }\n        \n        CGPoint newPoint = [window convertPoint:point fromWindow:self.view.window];\n        if (window == self.prevKeyWindow) {\n            targetView = [window lks_subviewAtPoint:newPoint preferredClasses:[self _preferredClassesInSelecting]];\n        } else {\n            targetView = [window hitTest:point withEvent:nil];\n        }\n    }];\n    \n    if (!targetView) {\n        return nil;\n    }\n    \n    // 特殊处理一下\n    if ([NSStringFromClass([targetView class]) isEqualToString:@\"UITableViewCellContentView\"] && [targetView.superview isKindOfClass:[UITableViewCell class]]) {\n        targetView = targetView.superview;\n        \n    } else if ([targetView.superview isKindOfClass:[UITableView class]] && targetView == ((UITableView *)targetView.superview).backgroundView) {\n        targetView = targetView.superview;\n    }\n    \n    return targetView;\n}\n\n- (NSArray<Class> *)_preferredClassesInSelecting {\n    static dispatch_once_t onceToken;\n    static NSArray<Class> *classes = nil;\n    dispatch_once(&onceToken,^{\n#if TARGET_OS_TV\n        NSMutableArray<Class> *array = @[[UILabel class], [UIProgressView class], [UIActivityIndicatorView class], [UITextView class], [UITextField class], [UIVisualEffectView class]].mutableCopy;\n#else\n        NSMutableArray<Class> *array = @[[UILabel class], [UIProgressView class], [UIActivityIndicatorView class], [UITextView class], [UITextField class], [UISlider class], [UISwitch class], [UIVisualEffectView class]].mutableCopy;\n#endif\n        NSArray<NSString *> *custom = [LookinHierarchyInfo collapsedClassList];\n        if (custom.count) {\n            NSArray<Class> *customClasses = [custom lookin_map:^id(NSUInteger idx, NSString *value) {\n                return NSClassFromString(value);\n            }];\n            [array addObjectsFromArray:customClasses];\n        }\n        classes = array;\n    });\n    return classes;\n}\n\n- (void)clearContents {\n    self.highlightRect = kInvalidRect;\n    self.referRect = kInvalidRect;\n    self.panelView.hidden = YES;\n    [self.view setNeedsLayout];\n}\n\n#pragma mark - Strings\n\n- (NSString *)_titleStringForLayer:(CALayer *)layer {\n    NSObject *targetObject = layer.lks_hostView ? : layer;\n    NSString *classNameString = NSStringFromClass([targetObject class]) ? : @\"\";\n    return classNameString;\n}\n\n- (NSString *)_subtitleStringForLayer:(CALayer *)layer {\n    NSString *traceString = nil;\n    \n    NSObject *targetObject = layer.lks_hostView ? : layer;\n    if (layer.lks_hostView.lks_hostViewController) {\n        traceString = [NSString stringWithFormat:@\"%@.view\", NSStringFromClass([layer.lks_hostView.lks_hostViewController class])];\n    } else {\n        if (targetObject.lks_specialTrace.length) {\n            traceString = targetObject.lks_specialTrace;\n        } else if (targetObject.lks_ivarTraces.count) {\n            traceString = [[[targetObject.lks_ivarTraces lookin_map:^id(NSUInteger idx, LookinIvarTrace *value) {\n                return value.ivarName;\n            }] lookin_nonredundantArray] componentsJoinedByString:@\", \"];\n        }\n    }\n    \n    return traceString;\n}\n\n- (NSArray<NSArray<NSString *> *> *)_contentStringsForLayer:(CALayer *)layer {\n    NSMutableArray<NSArray<NSString *> *> *resultArray = [NSMutableArray array];\n    \n    [resultArray addObject:@[@\"Frame\", [NSString lookin_stringFromRect:layer.frame]]];\n    \n    if (layer.backgroundColor) {\n        [resultArray addObject:@[@\"BackgroundColor\", [NSString lookin_rgbaStringFromColor:[UIColor colorWithCGColor:layer.backgroundColor]]]];\n    }\n    if ([layer.lks_hostView isKindOfClass:[UIImageView class]]) {\n        UIImage *image = ((UIImageView *)layer.lks_hostView).image;\n        if (image.lks_imageSourceName.length) {\n            [resultArray addObject:@[@\"ImageName\", [NSString stringWithFormat:@\"\\\"%@\\\"\", image.lks_imageSourceName]]];\n        }\n        \n    } else if ([layer.lks_hostView isKindOfClass:[UIButton class]]) {\n        UIButton *button = (UIButton *)layer.lks_hostView;\n        // 不要直接访问 button.titleLabel。因为如果 title 不存在的话，访问 button.titleLabel 会触发初始化 titleLabel 进而触发 dynamic hierarhy push\n        if ([button titleForState:UIControlStateNormal].length) {\n            [resultArray addObject:@[@\"FontSize\", [NSString lookin_stringFromDouble:button.titleLabel.font.pointSize decimal:2]]];\n            [resultArray addObject:@[@\"FontName\", button.titleLabel.font.fontName]];\n            [resultArray addObject:@[@\"TextColor\", [NSString lookin_rgbaStringFromColor:button.titleLabel.textColor]]];\n        }\n        // 不要直接访问 button.imageView。因为如果 image 不存在的话，访问 button.image 会触发初始化 imageView 进而触发 dynamic hierarhy push\n        if ([button imageForState:UIControlStateNormal]) {\n            NSString *imageSourceName = button.imageView.image.lks_imageSourceName;\n            if (imageSourceName.length) {\n                [resultArray addObject:@[@\"ImageName\", [NSString stringWithFormat:@\"\\\"%@\\\"\", imageSourceName]]];\n            }\n        }\n        \n    } else if ([layer.lks_hostView isKindOfClass:[UILabel class]]) {\n        UILabel *label = (UILabel *)layer.lks_hostView;\n        [resultArray addObject:@[@\"FontSize\", [NSString lookin_stringFromDouble:label.font.pointSize decimal:2]]];\n        [resultArray addObject:@[@\"FontName\", label.font.fontName]];\n        [resultArray addObject:@[@\"TextColor\", [NSString lookin_rgbaStringFromColor:label.textColor]]];\n        [resultArray addObject:@[@\"NumberOfLines\", [NSString stringWithFormat:@\"%@\", @(label.numberOfLines)]]];\n        \n    } else if ([layer.lks_hostView isKindOfClass:[UIScrollView class]]) {\n        UIScrollView *scrollView = (UIScrollView *)layer.lks_hostView;\n        [resultArray addObject:@[@\"ContentSize\", [NSString lookin_stringFromSize:scrollView.contentSize]]];\n        [resultArray addObject:@[@\"ContentOffset\", [NSString lookin_stringFromPoint:scrollView.contentOffset]]];\n        [resultArray addObject:@[@\"ContentInset\", [NSString lookin_stringFromInset:scrollView.contentInset]]];\n        if (@available(iOS 11.0, tvOS 11.0, *)) {\n            [resultArray addObject:@[@\"AdjustedContentInset\", [NSString lookin_stringFromInset:scrollView.adjustedContentInset]]];\n        }\n        \n        if ([scrollView isKindOfClass:[UITextView class]]) {\n            UITextView *textView = (UITextView *)scrollView;\n            [resultArray addObject:@[@\"FontSize\", [NSString lookin_stringFromDouble:textView.font.pointSize decimal:2]]];\n            [resultArray addObject:@[@\"FontName\", textView.font.fontName]];\n            [resultArray addObject:@[@\"TextColor\", [NSString lookin_rgbaStringFromColor:textView.textColor]]];\n        }\n        \n    } else if ([layer.lks_hostView isKindOfClass:[UITextField class]]) {\n        UITextField *textField = (UITextField *)layer.lks_hostView;\n        [resultArray addObject:@[@\"FontSize\", [NSString lookin_stringFromDouble:textField.font.pointSize decimal:2]]];\n        [resultArray addObject:@[@\"FontName\", textField.font.fontName]];\n        [resultArray addObject:@[@\"TextColor\", [NSString lookin_rgbaStringFromColor:textField.textColor]]];\n        \n    }\n    \n    if (layer.borderColor && layer.borderWidth > 0) {\n        [resultArray addObject:@[@\"BorderColor\", [NSString lookin_rgbaStringFromColor:[UIColor colorWithCGColor:layer.borderColor]]]];\n        [resultArray addObject:@[@\"BorderWidth\", [NSString lookin_stringFromDouble:layer.borderWidth decimal:2]]];\n    }\n    \n    if (layer.cornerRadius > 0) {\n        [resultArray addObject:@[@\"CornerRadius\", [NSString lookin_stringFromDouble:layer.cornerRadius decimal:2]]];\n    }\n    \n    if (layer.opacity < 1) {\n        [resultArray addObject:@[@\"Opacity\", [NSString lookin_stringFromDouble:layer.opacity decimal:2]]];\n    }\n    \n    if (layer.shadowColor && layer.shadowOpacity > 0) {\n        [resultArray addObject:@[@\"ShadowColor\", [NSString lookin_rgbaStringFromColor:[UIColor colorWithCGColor:layer.shadowColor]]]];\n        [resultArray addObject:@[@\"ShadowOpacity\", [NSString lookin_stringFromDouble:layer.shadowOpacity decimal:2]]];\n        [resultArray addObject:@[@\"ShadowOffset\", [NSString lookin_stringFromSize:layer.shadowOffset]]];\n        [resultArray addObject:@[@\"ShadowRadius\", [NSString lookin_stringFromDouble:layer.shadowRadius decimal:2]]];\n    }\n    \n    return resultArray;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/LookinServer.h",
    "content": "//\n//  LookinServer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/7/20.\n//  https://lookin.work\n//\n\n#ifndef LookinServer_h\n#define LookinServer_h\n\n\n#endif /* LookinServer_h */\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_AttrGroupsMaker.h",
    "content": "//\n//  LKS_AttrGroupsMaker.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/6.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n@class LookinAttributesGroup;\n\n@interface LKS_AttrGroupsMaker : NSObject\n\n+ (NSArray<LookinAttributesGroup *> *)attrGroupsForLayer:(CALayer *)layer;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_AttrGroupsMaker.m",
    "content": "//\n//  LKS_AttrGroupsMaker.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/6/6.\n//  https://lookin.work\n//\n\n#import \"LKS_AttrGroupsMaker.h\"\n#import \"LookinAttributesGroup.h\"\n#import \"LookinAttributesSection.h\"\n#import \"LookinAttribute.h\"\n#import \"LookinDashboardBlueprint.h\"\n#import \"LookinIvarTrace.h\"\n#import \"UIColor+LookinServer.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation LKS_AttrGroupsMaker\n\n+ (NSArray<LookinAttributesGroup *> *)attrGroupsForLayer:(CALayer *)layer {\n    if (!layer) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    NSArray<LookinAttributesGroup *> *groups = [[LookinDashboardBlueprint groupIDs] lookin_map:^id(NSUInteger idx, LookinAttrGroupIdentifier groupID) {\n        LookinAttributesGroup *group = [LookinAttributesGroup new];\n        group.identifier = groupID;\n\n        NSArray<LookinAttrSectionIdentifier> *secIDs = [LookinDashboardBlueprint sectionIDsForGroupID:groupID];\n        group.attrSections = [secIDs lookin_map:^id(NSUInteger idx, LookinAttrSectionIdentifier secID) {\n            LookinAttributesSection *sec = [LookinAttributesSection new];\n            sec.identifier = secID;\n            \n            NSArray<LookinAttrIdentifier> *attrIDs = [LookinDashboardBlueprint attrIDsForSectionID:secID];\n            sec.attributes = [attrIDs lookin_map:^id(NSUInteger idx, LookinAttrIdentifier attrID) {\n                NSInteger minAvailableVersion = [LookinDashboardBlueprint minAvailableOSVersionWithAttrID:attrID];\n                if (minAvailableVersion > 0 && (NSProcessInfo.processInfo.operatingSystemVersion.majorVersion < minAvailableVersion)) {\n                    // iOS 版本过低不支持该属性\n                    return nil;\n                }\n                \n                id targetObj = nil;\n                if ([LookinDashboardBlueprint isUIViewPropertyWithAttrID:attrID]) {\n                    targetObj = layer.lks_hostView;\n                } else {\n                    targetObj = layer;\n                }\n                \n                if (targetObj) {\n                    Class targetClass = NSClassFromString([LookinDashboardBlueprint classNameWithAttrID:attrID]);\n                    if (![targetObj isKindOfClass:targetClass]) {\n                        return nil;\n                    }\n                    \n                    LookinAttribute *attr = [self _attributeWithIdentifer:attrID targetObject:targetObj];\n                    return attr;\n                } else {\n                    return nil;\n                }\n            }];\n            \n            if (sec.attributes.count) {\n                return sec;\n            } else {\n                return nil;\n            }\n        }];\n        \n        if ([groupID isEqualToString:LookinAttrGroup_AutoLayout]) {\n            // 这里特殊处理一下，如果 AutoLayout 里面不包含 Constraints 的话（只有 Hugging 和 Resistance），就丢弃掉这整个 AutoLayout 不显示\n            BOOL hasConstraits = [group.attrSections lookin_any:^BOOL(LookinAttributesSection *obj) {\n                return [obj.identifier isEqualToString:LookinAttrSec_AutoLayout_Constraints];\n            }];\n            if (!hasConstraits) {\n                return nil;\n            }\n        }\n        \n        if (group.attrSections.count) {\n            return group;\n        } else {\n            return nil;\n        }\n    }];\n    \n    return groups;\n}\n\n+ (LookinAttribute *)_attributeWithIdentifer:(LookinAttrIdentifier)identifier targetObject:(id)target {\n    if (!target) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    LookinAttribute *attribute = [LookinAttribute new];\n    attribute.identifier = identifier;\n    \n    SEL getter = [LookinDashboardBlueprint getterWithAttrID:identifier];\n    if (!getter) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    if (![target respondsToSelector:getter]) {\n        // 比如某些 QMUI 的属性，不引入 QMUI 就会走到这个分支里\n        return nil;\n    }\n    NSMethodSignature *signature = [target methodSignatureForSelector:getter];\n    if (signature.numberOfArguments > 2) {\n        NSAssert(NO, @\"getter 不可以有参数\");\n        return nil;\n    }\n    if (strcmp([signature methodReturnType], @encode(void)) == 0) {\n        NSAssert(NO, @\"getter 返回值不能为 void\");\n        return nil;\n    }\n    \n    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];\n    invocation.target = target;\n    invocation.selector = getter;\n    [invocation invoke];\n    \n    const char *returnType = [signature methodReturnType];\n    \n    if (strcmp(returnType, @encode(char)) == 0) {\n        char targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeChar;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(int)) == 0) {\n        int targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.value = @(targetValue);\n        if ([LookinDashboardBlueprint enumListNameWithAttrID:identifier]) {\n            attribute.attrType = LookinAttrTypeEnumInt;\n        } else {\n            attribute.attrType = LookinAttrTypeInt;\n        }\n        \n    } else if (strcmp(returnType, @encode(short)) == 0) {\n        short targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeShort;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(long)) == 0) {\n        long targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.value = @(targetValue);\n        if ([LookinDashboardBlueprint enumListNameWithAttrID:identifier]) {\n            attribute.attrType = LookinAttrTypeEnumLong;\n        } else {\n            attribute.attrType = LookinAttrTypeLong;\n        }\n        \n    } else if (strcmp(returnType, @encode(long long)) == 0) {\n        long long targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeLongLong;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(unsigned char)) == 0) {\n        unsigned char targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeUnsignedChar;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(unsigned int)) == 0) {\n        unsigned int targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeUnsignedInt;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(unsigned short)) == 0) {\n        unsigned short targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeUnsignedShort;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(unsigned long)) == 0) {\n        unsigned long targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeUnsignedLong;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(unsigned long long)) == 0) {\n        unsigned long long targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeUnsignedLongLong;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(float)) == 0) {\n        float targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeFloat;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(double)) == 0) {\n        double targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeDouble;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(BOOL)) == 0) {\n        BOOL targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeBOOL;\n        attribute.value = @(targetValue);\n        \n    } else if (strcmp(returnType, @encode(SEL)) == 0) {\n        SEL targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeSel;\n        attribute.value = NSStringFromSelector(targetValue);\n        \n    } else if (strcmp(returnType, @encode(Class)) == 0) {\n        Class targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeClass;\n        attribute.value = NSStringFromClass(targetValue);\n        \n    } else if (strcmp(returnType, @encode(CGPoint)) == 0) {\n        CGPoint targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeCGPoint;\n        attribute.value = [NSValue valueWithCGPoint:targetValue];\n        \n    } else if (strcmp(returnType, @encode(CGVector)) == 0) {\n        CGVector targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeCGVector;\n        attribute.value = [NSValue valueWithCGVector:targetValue];\n        \n    } else if (strcmp(returnType, @encode(CGSize)) == 0) {\n        CGSize targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeCGSize;\n        attribute.value = [NSValue valueWithCGSize:targetValue];\n        \n    } else if (strcmp(returnType, @encode(CGRect)) == 0) {\n        CGRect targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeCGRect;\n        attribute.value = [NSValue valueWithCGRect:targetValue];\n        \n    } else if (strcmp(returnType, @encode(CGAffineTransform)) == 0) {\n        CGAffineTransform targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeCGAffineTransform;\n        attribute.value = [NSValue valueWithCGAffineTransform:targetValue];\n        \n    } else if (strcmp(returnType, @encode(UIEdgeInsets)) == 0) {\n        UIEdgeInsets targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeUIEdgeInsets;\n        attribute.value = [NSValue valueWithUIEdgeInsets:targetValue];\n        \n    } else if (strcmp(returnType, @encode(UIOffset)) == 0) {\n        UIOffset targetValue;\n        [invocation getReturnValue:&targetValue];\n        attribute.attrType = LookinAttrTypeUIOffset;\n        attribute.value = [NSValue valueWithUIOffset:targetValue];\n        \n    } else {\n        NSString *argType_string = [[NSString alloc] lookin_safeInitWithUTF8String:returnType];\n        if ([argType_string hasPrefix:@\"@\"]) {\n            __unsafe_unretained id returnObjValue;\n            [invocation getReturnValue:&returnObjValue];\n            \n            if (!returnObjValue && [LookinDashboardBlueprint hideIfNilWithAttrID:identifier]) {\n                // 对于某些属性，若 value 为 nil 则不显示\n                return nil;\n            }\n            \n            attribute.attrType = [LookinDashboardBlueprint objectAttrTypeWithAttrID:identifier];\n            if (attribute.attrType == LookinAttrTypeUIColor) {\n                attribute.value = [returnObjValue lks_rgbaComponents];\n            } else {\n                attribute.value = returnObjValue;\n            }\n            \n        } else {\n            NSAssert(NO, @\"不支持解析该类型的返回值\");\n            return nil;\n        }\n    }\n    \n    return attribute;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_EventHandlerMaker.h",
    "content": "//\n//  LKS_EventHandlerMaker.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/8/7.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n@class LookinEventHandler;\n\n@interface LKS_EventHandlerMaker : NSObject\n\n+ (NSArray<LookinEventHandler *> *)makeForView:(UIView *)view;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_EventHandlerMaker.m",
    "content": "//\n//  LKS_EventHandlerMaker.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/8/7.\n//  https://lookin.work\n//\n\n#import \"LKS_EventHandlerMaker.h\"\n#import \"LookinTuple.h\"\n#import \"LookinEventHandler.h\"\n#import \"LookinObject.h\"\n#import \"UIGestureRecognizer+LookinServer.h\"\n#import \"LookinWeakContainer.h\"\n#import \"LookinIvarTrace.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation LKS_EventHandlerMaker\n\n+ (NSArray<LookinEventHandler *> *)makeForView:(UIView *)view {\n    if (!view) {\n        return nil;\n    }\n    \n    NSMutableArray<LookinEventHandler *> *allHandlers = nil;\n    \n    if ([view isKindOfClass:[UIControl class]]) {\n        NSArray<LookinEventHandler *> *targetActionHandlers = [self _targetActionHandlersForControl:(UIControl *)view];\n        if (targetActionHandlers.count) {\n            if (!allHandlers) {\n                allHandlers = [NSMutableArray array];\n            }\n            [allHandlers addObjectsFromArray:targetActionHandlers];\n        }\n    }\n    \n    NSArray<LookinEventHandler *> *gestureHandlers = [self _gestureHandlersForView:view];\n    if (gestureHandlers.count) {\n        if (!allHandlers) {\n            allHandlers = [NSMutableArray array];\n        }\n        [allHandlers addObjectsFromArray:gestureHandlers];\n    }\n    \n    return allHandlers.copy;\n}\n\n+ (NSArray<LookinEventHandler *> *)_gestureHandlersForView:(UIView *)view {\n    if (view.gestureRecognizers.count == 0) {\n        return nil;\n    }\n    NSArray<LookinEventHandler *> *handlers = [view.gestureRecognizers lookin_map:^id(NSUInteger idx, __kindof UIGestureRecognizer *recognizer) {\n        LookinEventHandler *handler = [LookinEventHandler new];\n        handler.handlerType = LookinEventHandlerTypeGesture;\n        handler.eventName = [recognizer lks_shortClassName];\n        handler.targetActions = [[recognizer lks_targetActions] lookin_map:^id(NSUInteger idx, LookinTwoTuple *rawTuple) {\n            NSObject *target = ((LookinWeakContainer *)rawTuple.first).object;\n            if (!target) {\n                // 该 target 已被释放\n                return nil;\n            }\n            LookinStringTwoTuple *newTuple = [LookinStringTwoTuple new];\n            newTuple.first = [LKS_Helper descriptionOfObject:target];\n            newTuple.second = (NSString *)rawTuple.second;\n            return newTuple;\n        }];\n        handler.inheritedRecognizerName = [self _inheritedRecognizerNameForRecognizer:recognizer];\n        handler.gestureRecognizerIsEnabled = recognizer.enabled;\n        if (recognizer.delegate) {\n            handler.gestureRecognizerDelegator = [LKS_Helper descriptionOfObject:recognizer.delegate];\n        }\n        handler.recognizerIvarTraces = [recognizer.lks_ivarTraces lookin_map:^id(NSUInteger idx, LookinIvarTrace *trace) {\n            return [NSString stringWithFormat:@\"(%@ *) -> %@\", trace.hostClassName, trace.ivarName];\n        }];\n        \n        handler.recognizerOid = [recognizer lks_registerOid];\n        return handler;\n    }];\n    return handlers;\n}\n\n+ (NSString *)_inheritedRecognizerNameForRecognizer:(UIGestureRecognizer *)recognizer {\n    if (!recognizer) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    static NSArray<Class> *baseRecognizers;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        // 注意这里 UIScreenEdgePanGestureRecognizer 在 UIPanGestureRecognizer 前面，因为 UIScreenEdgePanGestureRecognizer 继承于 UIPanGestureRecognizer\n#if TARGET_OS_TV\n        baseRecognizers = @[[UILongPressGestureRecognizer class],\n                            [UIPanGestureRecognizer class],\n                            [UISwipeGestureRecognizer class],\n                            [UITapGestureRecognizer class]];\n#else\n        baseRecognizers = @[[UILongPressGestureRecognizer class],\n                            [UIScreenEdgePanGestureRecognizer class],\n                            [UIPanGestureRecognizer class],\n                            [UISwipeGestureRecognizer class],\n                            [UIRotationGestureRecognizer class],\n                            [UIPinchGestureRecognizer class],\n                            [UITapGestureRecognizer class]];\n#endif\n\n    });\n    \n    __block NSString *result = @\"UIGestureRecognizer\";\n    [baseRecognizers enumerateObjectsUsingBlock:^(Class  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if ([recognizer isMemberOfClass:obj]) {\n            // 自身就是基本款，则直接置为 nil\n            result = nil;\n            *stop = YES;\n            return;\n        }\n        if ([recognizer isKindOfClass:obj]) {\n            result = NSStringFromClass(obj);\n            *stop = YES;\n            return;\n        }\n    }];\n    return result;\n}\n\n+ (NSArray<LookinEventHandler *> *)_targetActionHandlersForControl:(UIControl *)control {\n    static dispatch_once_t onceToken;\n    static NSArray<NSNumber *> *allEvents = nil;\n    dispatch_once(&onceToken,^{\n        allEvents = @[@(UIControlEventTouchDown), @(UIControlEventTouchDownRepeat), @(UIControlEventTouchDragInside), @(UIControlEventTouchDragOutside), @(UIControlEventTouchDragEnter), @(UIControlEventTouchDragExit), @(UIControlEventTouchUpInside), @(UIControlEventTouchUpOutside), @(UIControlEventTouchCancel), @(UIControlEventValueChanged), @(UIControlEventEditingDidBegin), @(UIControlEventEditingChanged), @(UIControlEventEditingDidEnd), @(UIControlEventEditingDidEndOnExit)];\n        if (@available(iOS 9.0, *)) {\n            allEvents = [allEvents arrayByAddingObject:@(UIControlEventPrimaryActionTriggered)];\n        }\n    });\n\n    NSSet *allTargets = control.allTargets;\n    \n    if (!allTargets.count) {\n        return nil;\n    }\n    \n    NSMutableArray<LookinEventHandler *> *handlers = [NSMutableArray array];\n    \n    [allEvents enumerateObjectsUsingBlock:^(NSNumber * _Nonnull eventNum, NSUInteger idx, BOOL * _Nonnull stop) {\n        UIControlEvents event = [eventNum unsignedIntegerValue];\n        \n        NSMutableArray<LookinStringTwoTuple *> *targetActions = [NSMutableArray array];\n        \n        [allTargets enumerateObjectsUsingBlock:^(id  _Nonnull target, BOOL * _Nonnull stop) {\n            NSArray<NSString *> *actions = [control actionsForTarget:target forControlEvent:event];\n            [actions enumerateObjectsUsingBlock:^(NSString * _Nonnull action, NSUInteger idx, BOOL * _Nonnull stop) {\n                LookinStringTwoTuple *tuple = [LookinStringTwoTuple new];\n                tuple.first = [LKS_Helper descriptionOfObject:target];\n                tuple.second = action;\n                [targetActions addObject:tuple];\n            }];\n        }];\n        \n        if (targetActions.count) {\n            LookinEventHandler *handler = [LookinEventHandler new];\n            handler.handlerType = LookinEventHandlerTypeTargetAction;\n            handler.eventName = [self _nameFromControlEvent:event];\n            handler.targetActions = targetActions.copy;\n            [handlers addObject:handler];\n        }\n    }];\n    \n    return handlers;\n}\n\n+ (NSString *)_nameFromControlEvent:(UIControlEvents)event {\n    static dispatch_once_t onceToken;\n    static NSDictionary<NSNumber *, NSString *> *eventsAndNames = nil;\n    dispatch_once(&onceToken,^{\n        NSMutableDictionary<NSNumber *, NSString *> *eventsAndNames_m = @{\n            @(UIControlEventTouchDown): @\"UIControlEventTouchDown\",\n            @(UIControlEventTouchDownRepeat): @\"UIControlEventTouchDownRepeat\",\n            @(UIControlEventTouchDragInside): @\"UIControlEventTouchDragInside\",\n            @(UIControlEventTouchDragOutside): @\"UIControlEventTouchDragOutside\",\n            @(UIControlEventTouchDragEnter): @\"UIControlEventTouchDragEnter\",\n            @(UIControlEventTouchDragExit): @\"UIControlEventTouchDragExit\",\n            @(UIControlEventTouchUpInside): @\"UIControlEventTouchUpInside\",\n            @(UIControlEventTouchUpOutside): @\"UIControlEventTouchUpOutside\",\n            @(UIControlEventTouchCancel): @\"UIControlEventTouchCancel\",\n            @(UIControlEventValueChanged): @\"UIControlEventValueChanged\",\n            @(UIControlEventEditingDidBegin): @\"UIControlEventEditingDidBegin\",\n            @(UIControlEventEditingChanged): @\"UIControlEventEditingChanged\",\n            @(UIControlEventEditingDidEnd): @\"UIControlEventEditingDidEnd\",\n            @(UIControlEventEditingDidEndOnExit): @\"UIControlEventEditingDidEndOnExit\",\n        }.mutableCopy;\n        if (@available(iOS 9.0, *)) {\n            eventsAndNames_m[@(UIControlEventPrimaryActionTriggered)] = @\"UIControlEventPrimaryActionTriggered\";\n        }\n        eventsAndNames = eventsAndNames_m.copy;\n    });\n    \n    NSString *name = eventsAndNames[@(event)];\n    return name;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_ExportManager.h",
    "content": "//\n//  LKS_ExportManager.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/13.\n//  https://lookin.work\n//\n\n#import <Foundation/Foundation.h>\n\n@interface LKS_ExportManager : NSObject\n\n+ (instancetype)sharedInstance;\n\n- (void)exportAndShare;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_ExportManager.m",
    "content": "//\n//  LKS_ExportManager.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/13.\n//  https://lookin.work\n//\n\n#import \"LKS_ExportManager.h\"\n#import \"UIViewController+LookinServer.h\"\n#import \"LookinHierarchyInfo.h\"\n#import \"LookinHierarchyFile.h\"\n#import \"LookinAppInfo.h\"\n#import \"LookinServerDefines.h\"\n\n@interface LKS_ExportManagerMaskView : UIView\n\n@property(nonatomic, strong) UIView *tipsView;\n@property(nonatomic, strong) UILabel *firstLabel;\n@property(nonatomic, strong) UILabel *secondLabel;\n@property(nonatomic, strong) UILabel *thirdLabel;\n\n@end\n\n@implementation LKS_ExportManagerMaskView\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if (self = [super initWithFrame:frame]) {\n        self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.35];\n        self.layer.lks_isLookinPrivateLayer = YES;\n        self.layer.lks_avoidCapturing = YES;\n        \n        self.tipsView = [UIView new];\n        self.tipsView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.88];\n        self.tipsView.layer.cornerRadius = 6;\n        self.tipsView.layer.masksToBounds = YES;\n        [self addSubview:self.tipsView];\n        \n        self.firstLabel = [UILabel new];\n        self.firstLabel.text = LKS_Localized(@\"Creating File…\");\n        self.firstLabel.textColor = [UIColor whiteColor];\n        self.firstLabel.font = [UIFont boldSystemFontOfSize:14];\n        self.firstLabel.textAlignment = NSTextAlignmentCenter;\n        self.firstLabel.numberOfLines = 0;\n        [self.tipsView addSubview:self.firstLabel];\n        \n        self.secondLabel = [UILabel new];\n        self.secondLabel.text = LKS_Localized(@\"May take 8 or more seconds according to the UI complexity.\");\n        self.secondLabel.textColor = [UIColor colorWithRed:173/255.0 green:180/255.0 blue:190/255.0 alpha:1];\n        self.secondLabel.font = [UIFont systemFontOfSize:12];\n        self.secondLabel.textAlignment = NSTextAlignmentLeft;\n        self.secondLabel.numberOfLines = 0;\n        [self.tipsView addSubview:self.secondLabel];\n        \n        self.thirdLabel = [UILabel new];\n        self.thirdLabel.text = LKS_Localized(@\"The file can be opend by Lookin.app in macOS.\");\n        self.thirdLabel.textColor = [UIColor colorWithRed:173/255.0 green:180/255.0 blue:190/255.0 alpha:1];\n        self.thirdLabel.font = [UIFont systemFontOfSize:12];\n        self.thirdLabel.textAlignment = NSTextAlignmentCenter;\n        self.thirdLabel.numberOfLines = 0;\n        [self.tipsView addSubview:self.thirdLabel];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    \n    UIEdgeInsets insets = UIEdgeInsetsMake(8, 10, 8, 10);\n    CGFloat maxLabelWidth = self.bounds.size.width * .8 - insets.left - insets.right;\n    \n    CGSize firstSize = [self.firstLabel sizeThatFits:CGSizeMake(maxLabelWidth, CGFLOAT_MAX)];\n    CGSize secondSize = [self.secondLabel sizeThatFits:CGSizeMake(maxLabelWidth, CGFLOAT_MAX)];\n    CGSize thirdSize = [self.thirdLabel sizeThatFits:CGSizeMake(maxLabelWidth, CGFLOAT_MAX)];\n\n    CGFloat tipsWidth = MAX(MAX(firstSize.width, secondSize.width), thirdSize.width) + insets.left + insets.right;\n\n    self.firstLabel.frame = CGRectMake(tipsWidth / 2.0 - firstSize.width / 2.0, insets.top, firstSize.width, firstSize.height);\n    self.secondLabel.frame = CGRectMake(tipsWidth / 2.0 - secondSize.width / 2.0, CGRectGetMaxY(self.firstLabel.frame) + 10, secondSize.width, secondSize.height);\n    self.thirdLabel.frame = CGRectMake(tipsWidth / 2.0 - thirdSize.width / 2.0, CGRectGetMaxY(self.secondLabel.frame) + 5, thirdSize.width, thirdSize.height);\n\n    self.tipsView.frame = ({\n        CGFloat height = CGRectGetMaxY(self.thirdLabel.frame) + insets.bottom;\n        CGRectMake(self.bounds.size.width / 2.0 - tipsWidth / 2.0, self.bounds.size.height / 2.0 - height / 2.0, tipsWidth, height);\n    });\n}\n\n@end\n\n@interface LKS_ExportManager ()\n\n#if TARGET_OS_TV\n#else\n@property(nonatomic, strong) UIDocumentInteractionController *documentController;\n#endif\n\n@property(nonatomic, strong) LKS_ExportManagerMaskView *maskView;\n\n@end\n\n@implementation LKS_ExportManager\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static LKS_ExportManager *instance = nil;\n    dispatch_once(&onceToken,^{\n        instance = [[super allocWithZone:NULL] init];\n    });\n    return instance;\n}\n\n+ (id)allocWithZone:(struct _NSZone *)zone{\n    return [self sharedInstance];\n}\n\n#if TARGET_OS_TV\n- (void)exportAndShare {\n    NSAssert(NO, @\"not supported\");\n}\n#else\n- (void)exportAndShare {\n    \n    UIViewController *visibleVc = [UIViewController lks_visibleViewController];\n    if (!visibleVc) {\n        NSLog(@\"LookinServer - Failed to export because we didn't find any visible view controller.\");\n        return;\n    }\n    \n    [[NSNotificationCenter defaultCenter] postNotificationName:@\"Lookin_WillExport\" object:nil];\n    \n    if (!self.maskView) {\n        self.maskView = [LKS_ExportManagerMaskView new];\n    }\n    [visibleVc.view.window addSubview:self.maskView];\n    self.maskView.frame = visibleVc.view.window.bounds;\n\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        LookinHierarchyInfo *info = [LookinHierarchyInfo exportedInfo];\n        LookinHierarchyFile *file = [LookinHierarchyFile new];\n        file.serverVersion = info.serverVersion;\n        file.hierarchyInfo = info;\n        NSData *data = [NSKeyedArchiver archivedDataWithRootObject:file];\n        if (!data) {\n            return;\n        }\n        \n        NSString *fileName = ({\n            NSString *timeString = ({\n                NSDate *date = [NSDate date];\n                NSDateFormatter *formatter = [[NSDateFormatter alloc] init];\n                [formatter setDateFormat:@\"MMddHHmm\"];\n                [formatter stringFromDate:date];\n            });\n            NSString *iOSVersion = ({\n                NSString *str = info.appInfo.osDescription;\n                NSUInteger dotIdx = [str rangeOfString:@\".\"].location;\n                if (dotIdx != NSNotFound) {\n                    str = [str substringToIndex:dotIdx];\n                }\n                str;\n            });\n            [NSString stringWithFormat:@\"%@_ios%@_%@.lookin\", info.appInfo.appName, iOSVersion, timeString];\n        });\n        NSString *path = [NSString stringWithFormat:@\"%@%@\", NSTemporaryDirectory(), fileName];\n        [data writeToFile:path atomically:YES];\n        \n        [self.maskView removeFromSuperview];\n        \n        if (!self.documentController) {\n            self.documentController = [UIDocumentInteractionController new];\n        }\n        self.documentController.URL = [NSURL fileURLWithPath:path];\n        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {\n            [self.documentController presentOpenInMenuFromRect:CGRectMake(0, 0, 1, 1) inView:visibleVc.view animated:YES];\n        } else {\n            [self.documentController presentOpenInMenuFromRect:visibleVc.view.bounds inView:visibleVc.view animated:YES];\n        }\n        \n        [[NSNotificationCenter defaultCenter] postNotificationName:@\"Lookin_DidFinishExport\" object:nil];\n        \n//        [self.documentController presentOptionsMenuFromRect:visibleVc.view.bounds inView:visibleVc.view animated:YES];\n        \n//        CFTimeInterval endTime = CACurrentMediaTime();\n//        CFTimeInterval consumingTime = endTime - startTime;\n//        NSLog(@\"LookinServer - 导出 UI 结构耗时：%@\", @(consumingTime));\n    });\n}\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_Helper.h",
    "content": "//\n//  LKS_Helper.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/7/20.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n\n\n#import <Foundation/Foundation.h>\n\n#define LKS_Localized(stringKey) NSLocalizedStringFromTableInBundle(stringKey, nil, [NSBundle bundleForClass:self.class], nil)\n\n@interface LKS_Helper : NSObject\n\n/// 如果 object 为 nil 则返回字符串 “nil”，否则返回字符串格式类似于 (UIView *)\n+ (NSString *)descriptionOfObject:(id)object;\n\n/// 返回当前的bundle\n+ (NSBundle *)bundle;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_Helper.m",
    "content": "//\n//  LKS_Helper.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/7/20.\n//  https://lookin.work\n//\n\n#import \"LKS_Helper.h\"\n#import \"NSObject+LookinServer.h\"\n\n@implementation LKS_Helper\n\n+ (NSString *)descriptionOfObject:(id)object {\n    if (!object) {\n        return @\"nil\";\n    }\n    NSString *className;\n    if ([object respondsToSelector:@selector(lks_shortClassName)]) {\n        className = [object lks_shortClassName];\n    } else {\n        className = NSStringFromClass([object class]);\n    }\n    \n    return [NSString stringWithFormat:@\"(%@ *)\", className];\n}\n\n+ (NSBundle *)bundle {\n    static id bundle = nil;\n    if (bundle != nil) {\n#ifdef SPM_RESOURCE_BUNDLE_IDENTIFITER\n        bundle = [NSBundle bundleWithIdentifier:SPM_RESOURCE_BUNDLE_IDENTIFITER];\n#else\n        bundle = [NSBundle bundleForClass:self.class];\n#endif\n    }\n    return bundle;\n}\n    \n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_HierarchyDisplayItemsMaker.h",
    "content": "//\n//  LKS_HierarchyDisplayItemsMaker.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/19.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDefines.h\"\n\n@class LookinDisplayItem;\n\n@interface LKS_HierarchyDisplayItemsMaker : NSObject\n\n/// @param hasScreenshots 是否包含 soloScreenshots 和 groupScreenshot 属性\n/// @param hasAttrList 是否包含 attributesGroupList 属性\n/// @param lowQuality screenshots 是否为低质量（当 hasScreenshots 为 NO 时，该属性无意义）\n/// @param includedWindows 当传入的该参数有效时（即 count 大于 0），将仅抓取该数组指定的 window 的数据\n/// @param excludedWindows 当 includedWindows 无效时，将不抓取 excludedWindows 指定的 window 的数据\n+ (NSArray<LookinDisplayItem *> *)itemsWithScreenshots:(BOOL)hasScreenshots attrList:(BOOL)hasAttrList lowImageQuality:(BOOL)lowQuality includedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_HierarchyDisplayItemsMaker.m",
    "content": "//\n//  LKS_HierarchyDisplayItemsMaker.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/2/19.\n//  https://lookin.work\n//\n\n#import \"LKS_HierarchyDisplayItemsMaker.h\"\n\n\n\n#import \"LookinDisplayItem.h\"\n#import \"LKS_TraceManager.h\"\n#import \"LKS_AttrGroupsMaker.h\"\n#import \"LKS_EventHandlerMaker.h\"\n#import \"LookinServerDefines.h\"\n\n@implementation LKS_HierarchyDisplayItemsMaker\n\n+ (NSArray<LookinDisplayItem *> *)itemsWithScreenshots:(BOOL)hasScreenshots attrList:(BOOL)hasAttrList lowImageQuality:(BOOL)lowQuality includedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows {\n    [[LKS_TraceManager sharedInstance] reload];\n    \n    NSArray<UIWindow *> *windows = [[UIApplication sharedApplication].windows copy];\n    NSMutableArray *resultArray = [NSMutableArray arrayWithCapacity:windows.count];\n    [windows enumerateObjectsUsingBlock:^(__kindof UIWindow * _Nonnull window, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (includedWindows.count) {\n            if (![includedWindows containsObject:window]) {\n                return;\n            }\n        } else if ([excludedWindows containsObject:window]) {\n            return;\n        }\n        LookinDisplayItem *item = [self _displayItemWithLayer:window.layer screenshots:hasScreenshots attrList:hasAttrList lowImageQuality:lowQuality];\n        item.representedAsKeyWindow = window.isKeyWindow;\n        if (item) {\n            [resultArray addObject:item];\n        }\n    }];\n    \n    return [resultArray copy];\n}\n\n+ (LookinDisplayItem *)_displayItemWithLayer:(CALayer *)layer screenshots:(BOOL)hasScreenshots attrList:(BOOL)hasAttrList lowImageQuality:(BOOL)lowQuality {\n    if (!layer || layer.lks_avoidCapturing) {\n        return nil;\n    }\n    \n    LookinDisplayItem *item = [LookinDisplayItem new];\n    if ([self validateFrame:layer.frame]) {\n        item.frame = layer.frame;\n    } else {\n        NSLog(@\"LookinServer - 该 layer 的 frame(%@) 不太寻常，可能导致 Lookin 客户端中图像渲染错误，因此这里暂时将其视为 CGRectZero\", NSStringFromCGRect(layer.frame));\n        item.frame = CGRectZero;\n    }\n    item.bounds = layer.bounds;\n    if (hasScreenshots) {\n        item.soloScreenshot = [layer lks_soloScreenshotWithLowQuality:lowQuality];\n        item.groupScreenshot = [layer lks_groupScreenshotWithLowQuality:lowQuality];\n        item.screenshotEncodeType = LookinDisplayItemImageEncodeTypeNSData;\n    }\n    \n    if (hasAttrList) {\n        item.attributesGroupList = [LKS_AttrGroupsMaker attrGroupsForLayer:layer];\n    }\n    \n    item.isHidden = layer.isHidden;\n    item.alpha = layer.opacity;\n    item.layerObject = [LookinObject instanceWithObject:layer];\n    \n    if (layer.lks_hostView) {\n        UIView *view = layer.lks_hostView;\n        item.viewObject = [LookinObject instanceWithObject:view];\n        item.eventHandlers = [LKS_EventHandlerMaker makeForView:view];\n        item.backgroundColor = view.backgroundColor;\n        \n        if (view.lks_hostViewController) {\n            item.hostViewControllerObject = [LookinObject instanceWithObject:view.lks_hostViewController];\n        }\n    } else {\n        item.backgroundColor = [UIColor colorWithCGColor:layer.backgroundColor];\n    }\n    \n    if (layer.sublayers.count) {\n        NSArray<CALayer *> *sublayers = [layer.sublayers copy];\n        NSMutableArray<LookinDisplayItem *> *array = [NSMutableArray arrayWithCapacity:sublayers.count];\n        [sublayers enumerateObjectsUsingBlock:^(__kindof CALayer * _Nonnull sublayer, NSUInteger idx, BOOL * _Nonnull stop) {\n            LookinDisplayItem *sublayer_item = [self _displayItemWithLayer:sublayer screenshots:hasScreenshots attrList:hasAttrList lowImageQuality:lowQuality];\n            if (sublayer_item) {\n                [array addObject:sublayer_item];\n            }\n        }];\n        item.subitems = [array copy];\n    }\n    \n    return item;\n}\n\n+ (BOOL)validateFrame:(CGRect)frame {\n    return !CGRectIsNull(frame) && !CGRectIsInfinite(frame) && ![self cgRectIsNaN:frame] && ![self cgRectIsInf:frame] && ![self cgRectIsUnreasonable:frame];\n}\n\n+ (BOOL)cgRectIsNaN:(CGRect)rect {\n    return isnan(rect.origin.x) || isnan(rect.origin.y) || isnan(rect.size.width) || isnan(rect.size.height);\n}\n\n+ (BOOL)cgRectIsInf:(CGRect)rect {\n    return isinf(rect.origin.x) || isinf(rect.origin.y) || isinf(rect.size.width) || isinf(rect.size.height);\n}\n\n+ (BOOL)cgRectIsUnreasonable:(CGRect)rect {\n    return ABS(rect.origin.x) > 100000 || ABS(rect.origin.y) > 100000 || rect.size.width < 0 || rect.size.height < 0 || rect.size.width > 100000 || rect.size.height > 100000;\n}\n\n\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_MethodTraceManager.h",
    "content": "//\n//  LKS_MethodTraceManager.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/22.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@interface LKS_MethodTraceManager : NSObject\n\n+ (instancetype)sharedInstance;\n\n/// selName 不可以是 \"dealloc\"\n- (void)addWithClassName:(NSString *)className selName:(NSString *)selName;\n\n- (void)removeWithClassName:(NSString *)className selName:(NSString *)selName;\n\n/**\n @[\n    @{@\"class\": @\"UIViewController\", @\"sels\": @[@\"init\", @\"viewDidAppear:\"]},\n    @{@\"class\": @\"UIView\", @\"sels\": @[@\"init\", @\"layoutSubviews\"]}\n ];\n */\n- (NSArray<NSDictionary<NSString *, id> *> *)currentActiveTraceList;\n\n- (NSArray<NSString *> *)allClassesListInApp;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_MethodTraceManager.m",
    "content": "//\n//  LKS_MethodTraceManager.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/22.\n//  https://lookin.work\n//\n\n#import \"LKS_MethodTraceManager.h\"\n\n\n\n#import <objc/message.h>\n#import <objc/runtime.h>\n#import \"LKS_ConnectionManager.h\"\n#import \"LookinMethodTraceRecord.h\"\n#import \"LookinServerDefines.h\"\n\nstatic NSString * const kActiveListKey_Class = @\"class\";\nstatic NSString * const kActiveListKey_Sels = @\"sels\";\n\nstatic NSArray<NSString *> *LKS_ArgumentsDescriptionsFromInvocation(NSInvocation *invocation) {\n    NSMethodSignature *signature = [invocation methodSignature];\n    NSUInteger argsCount = signature.numberOfArguments;\n    \n    NSArray<NSString *> *strings = [NSArray lookin_arrayWithCount:(argsCount - 2) block:^id(NSUInteger idx) {\n        NSUInteger argIdx = idx + 2;\n        \n        const char *argType = [signature getArgumentTypeAtIndex:argIdx];\n        \n        ///TODO:v, *, , [array type], {name=type...}, (name=type...), bnum, ^type, ?\n        // https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html#//apple_ref/doc/uid/TP40008048-CH100\n        if (strcmp(argType, @encode(char)) == 0) {\n            char charValue;\n            [invocation getArgument:&charValue atIndex:argIdx];\n            return [NSString stringWithFormat:@\"%@\", @(charValue)];\n            \n        } else if (strcmp(argType, @encode(int)) == 0) {\n            int intValue;\n            [invocation getArgument:&intValue atIndex:argIdx];\n            if (intValue == INT_MAX) {\n                return @\"INT_MAX\";\n            } else if (intValue == INT_MIN) {\n                return @\"INT_MIN\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(intValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(short)) == 0) {\n            short shortValue;\n            [invocation getArgument:&shortValue atIndex:argIdx];\n            if (shortValue == SHRT_MAX) {\n                return @\"SHRT_MAX\";\n            } else if (shortValue == SHRT_MIN) {\n                return @\"SHRT_MIN\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(shortValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(long)) == 0) {\n            long longValue;\n            [invocation getArgument:&longValue atIndex:argIdx];\n            if (longValue == NSNotFound) {\n                return @\"NSNotFound\";\n            } else if (longValue == LONG_MAX) {\n                return @\"LONG_MAX\";\n            } else if (longValue == LONG_MIN) {\n                return @\"LONG_MAX\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(longValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(long long)) == 0) {\n            long long longLongValue;\n            [invocation getArgument:&longLongValue atIndex:argIdx];\n            if (longLongValue == LLONG_MAX) {\n                return @\"LLONG_MAX\";\n            } else if (longLongValue == LLONG_MIN) {\n                return @\"LLONG_MIN\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(longLongValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(unsigned char)) == 0) {\n            unsigned char ucharValue;\n            [invocation getArgument:&ucharValue atIndex:argIdx];\n            if (ucharValue == UCHAR_MAX) {\n                return @\"UCHAR_MAX\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(ucharValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(unsigned int)) == 0) {\n            unsigned int uintValue;\n            [invocation getArgument:&uintValue atIndex:argIdx];\n            if (uintValue == UINT_MAX) {\n                return @\"UINT_MAX\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(uintValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(unsigned short)) == 0) {\n            unsigned short ushortValue;\n            [invocation getArgument:&ushortValue atIndex:argIdx];\n            if (ushortValue == USHRT_MAX) {\n                return @\"USHRT_MAX\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(ushortValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(unsigned long)) == 0) {\n            unsigned long ulongValue;\n            [invocation getArgument:&ulongValue atIndex:argIdx];\n            if (ulongValue == ULONG_MAX) {\n                return @\"ULONG_MAX\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(ulongValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(unsigned long long)) == 0) {\n            unsigned long long ulongLongValue;\n            [invocation getArgument:&ulongLongValue atIndex:argIdx];\n            if (ulongLongValue == ULONG_LONG_MAX) {\n                return @\"ULONG_LONG_MAX\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(ulongLongValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(float)) == 0) {\n            float floatValue;\n            [invocation getArgument:&floatValue atIndex:argIdx];\n            if (floatValue == FLT_MAX) {\n                return @\"FLT_MAX\";\n            } else if (floatValue == FLT_MIN) {\n                return @\"FLT_MIN\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(floatValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(double)) == 0) {\n            double doubleValue;\n            [invocation getArgument:&doubleValue atIndex:argIdx];\n            if (doubleValue == DBL_MAX) {\n                return @\"DBL_MAX\";\n            } else if (doubleValue == DBL_MIN) {\n                return @\"DBL_MIN\";\n            } else {\n                return [NSString stringWithFormat:@\"%@\", @(doubleValue)];\n            }\n            \n        } else if (strcmp(argType, @encode(BOOL)) == 0) {\n            BOOL boolValue;\n            [invocation getArgument:&boolValue atIndex:argIdx];\n            return boolValue ? @\"YES\" : @\"NO\";\n            \n        } else if (strcmp(argType, @encode(SEL)) == 0) {\n            SEL selValue;\n            [invocation getArgument:&selValue atIndex:argIdx];\n            return [NSString stringWithFormat:@\"SEL(%@)\", NSStringFromSelector(selValue)];\n            \n        } else if (strcmp(argType, @encode(Class)) == 0) {\n            Class classValue;\n            [invocation getArgument:&classValue atIndex:argIdx];\n            return [NSString stringWithFormat:@\"<%@>\", NSStringFromClass(classValue)];\n            \n        } else if (strcmp(argType, @encode(CGPoint)) == 0) {\n            CGPoint targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromCGPoint(targetValue);\n            \n        } else if (strcmp(argType, @encode(CGVector)) == 0) {\n            CGVector targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromCGVector(targetValue);\n            \n        } else if (strcmp(argType, @encode(CGSize)) == 0) {\n            CGSize targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromCGSize(targetValue);\n            \n        } else if (strcmp(argType, @encode(CGRect)) == 0) {\n            CGRect targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromCGRect(targetValue);\n            \n        } else if (strcmp(argType, @encode(CGAffineTransform)) == 0) {\n            CGAffineTransform targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromCGAffineTransform(targetValue);\n            \n        } else if (strcmp(argType, @encode(UIEdgeInsets)) == 0) {\n            UIEdgeInsets targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromUIEdgeInsets(targetValue);\n            \n        } else if (strcmp(argType, @encode(UIOffset)) == 0) {\n            UIOffset targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromUIOffset(targetValue);\n            \n        } else if (strcmp(argType, @encode(NSRange)) == 0) {\n            NSRange targetValue;\n            [invocation getArgument:&targetValue atIndex:argIdx];\n            return NSStringFromRange(targetValue);\n            \n        } else {\n            if (@available(iOS 11.0, tvOS 11.0, *)) {\n                if (strcmp(argType, @encode(NSDirectionalEdgeInsets)) == 0) {\n                    NSDirectionalEdgeInsets targetValue;\n                    [invocation getArgument:&targetValue atIndex:argIdx];\n                    return NSStringFromDirectionalEdgeInsets(targetValue);\n                }\n            }\n            \n            NSString *argType_string = [[NSString alloc] lookin_safeInitWithUTF8String:argType];\n            if ([argType_string hasPrefix:@\"@\"]) {\n                __unsafe_unretained id objValue;\n                [invocation getArgument:&objValue atIndex:argIdx];\n                \n                if (objValue) {\n                    if ([objValue isKindOfClass:[NSString class]]) {\n                        return [NSString stringWithFormat:@\"\\\"%@\\\"\", objValue];\n                    }\n                    \n                    NSString *objDescription = [objValue description];\n                    if (objDescription.length > 20) {\n                        return [NSString stringWithFormat:@\"(%@ *)%p\", NSStringFromClass([objValue class]), objValue];\n                    } else {\n                        return objDescription;\n                    }\n                } else {\n                    return @\"nil\";\n                }\n            }\n        }\n        return @\"?\";\n    }];\n    \n    return strings.copy;\n}\n\n\nstatic SEL LKS_AltSelectorFromSelector(SEL originalSelector) {\n    NSString *selectorName = NSStringFromSelector(originalSelector);\n    return NSSelectorFromString([@\"lks_alt_\" stringByAppendingString:selectorName]);\n}\n\nstatic NSMutableDictionary<NSString *, NSMutableSet<NSString *> *> *LKS_HookedDict() {\n    static NSMutableDictionary *dict;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        dict = [NSMutableDictionary dictionary];\n    });\n    return dict;\n}\n\nstatic NSMutableArray<NSDictionary<NSString *, id> *> *LKS_ActiveList() {\n    static NSMutableArray *list;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        list = [NSMutableArray array];\n    });\n    return list;\n}\n\nstatic void Lookin_PleaseRemoveMethodTraceInLookinAppIfCrashHere(Class targetClass) {\n    SEL forwardInvocationSel = @selector(forwardInvocation:);\n    Method forwardInvocationMethod = class_getInstanceMethod(targetClass, forwardInvocationSel);\n    \n    void (*originalForwardInvocation)(id, SEL, NSInvocation *) = NULL;\n    if (forwardInvocationMethod != NULL) {\n        originalForwardInvocation = (__typeof__(originalForwardInvocation))method_getImplementation(forwardInvocationMethod);\n    }\n    \n    id newForwardInvocation = ^(id target, NSInvocation *invocation) {\n        __block BOOL isHookedSel = NO;\n        __block BOOL shouldNotify = NO;\n        [LKS_HookedDict() enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull enumeratedClassName, NSMutableSet<NSString *> * _Nonnull obj, BOOL * _Nonnull stop) {\n            if ([target isKindOfClass:NSClassFromString(enumeratedClassName)]) {\n                NSString *invocationSelName = NSStringFromSelector(invocation.selector);\n                isHookedSel = [obj containsObject:invocationSelName];\n                \n                NSArray<NSString *> *activeSels = [[LKS_ActiveList() lookin_firstFiltered:^BOOL(NSDictionary<NSString *,id> *obj) {\n                    return [obj[kActiveListKey_Class] isEqualToString:enumeratedClassName];\n                }] objectForKey:kActiveListKey_Sels];\n                shouldNotify = [activeSels lookin_any:^BOOL(NSString *obj) {\n                    return [obj isEqualToString:invocationSelName];\n                }];\n                \n                *stop = YES;\n            }\n        }];\n        if (isHookedSel) {\n            if (shouldNotify) {\n                LookinMethodTraceRecord *record = [LookinMethodTraceRecord new];\n                record.targetAddress = [NSString stringWithFormat:@\"%p\", invocation.target];\n                record.selClassName = NSStringFromClass([invocation.target class]);\n                record.selName = NSStringFromSelector(invocation.selector);\n                record.callStacks = [NSThread callStackSymbols];\n                record.args = LKS_ArgumentsDescriptionsFromInvocation(invocation);\n                record.date = [NSDate date];\n                [[LKS_ConnectionManager sharedInstance] pushData:record type:LookinPush_MethodTraceRecord];\n            }\n            invocation.selector = LKS_AltSelectorFromSelector(invocation.selector);\n            [invocation invoke];\n            return;\n        }\n        if (originalForwardInvocation == NULL) {\n            [target doesNotRecognizeSelector:invocation.selector];\n        } else {\n            originalForwardInvocation(target, forwardInvocationSel, invocation);\n        }\n    };\n    class_replaceMethod(targetClass, forwardInvocationSel, imp_implementationWithBlock(newForwardInvocation), \"v@:@\");\n    \n    [LKS_HookedDict() setValue:[NSMutableSet set] forKey:NSStringFromClass(targetClass)];\n}\n\n@interface LKS_MethodTraceManager ()\n\n@end\n\n@implementation LKS_MethodTraceManager\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static LKS_MethodTraceManager *instance = nil;\n    dispatch_once(&onceToken,^{\n        instance = [[super allocWithZone:NULL] init];\n    });\n    return instance;\n}\n\n+ (id)allocWithZone:(struct _NSZone *)zone{\n    return [self sharedInstance];\n}\n\n- (void)removeWithClassName:(NSString *)className selName:(NSString *)selName {\n    if (!className.length) {\n        return;\n    }\n    NSUInteger classIdx = [LKS_ActiveList() indexOfObjectPassingTest:^BOOL(NSDictionary<NSString *,id> * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        return [obj[kActiveListKey_Class] isEqualToString:className];\n    }];\n    if (classIdx == NSNotFound) {\n        return;\n    }\n    if (selName) {\n        NSDictionary<NSString *, id> *classDict = [LKS_ActiveList() objectAtIndex:classIdx];\n        NSMutableArray<NSString *> *sels = classDict[kActiveListKey_Sels];\n        [sels removeObject:selName];\n        if (sels.count == 0) {\n            [LKS_ActiveList() removeObjectAtIndex:classIdx];\n        }\n        \n    } else {\n        [LKS_ActiveList() removeObjectAtIndex:classIdx];\n    }\n}\n\n- (void)addWithClassName:(NSString *)targetClassName selName:(NSString *)targetSelName {\n    BOOL isValid = [self _isValidWithClassName:targetClassName selName:targetSelName];\n    if (!isValid) {\n        return;\n    }\n    \n    BOOL addSucc = [self _addToActiveListWithClassName:targetClassName selName:targetSelName];\n    if (!addSucc) {\n        return;\n    }\n    \n    Class targetClass = NSClassFromString(targetClassName);\n    SEL targetSel = NSSelectorFromString(targetSelName);\n    Method targetMethod = class_getInstanceMethod(targetClass, targetSel);\n    \n    @synchronized (self) {\n        if (![LKS_HookedDict() valueForKey:targetClassName]) {\n            Lookin_PleaseRemoveMethodTraceInLookinAppIfCrashHere(targetClass);\n        }\n        \n        NSMutableSet<NSString *> *hookedSelNames = [LKS_HookedDict() objectForKey:targetClassName];\n        if ([hookedSelNames containsObject:targetSelName]) {\n            return;\n        }\n        class_addMethod(targetClass, LKS_AltSelectorFromSelector(targetSel), method_getImplementation(targetMethod), method_getTypeEncoding(targetMethod));\n        if (method_getImplementation(targetMethod) != _objc_msgForward) {\n            class_replaceMethod(targetClass, targetSel, _objc_msgForward, method_getTypeEncoding(targetMethod));\n        }\n        [hookedSelNames addObject:targetSelName];\n    }\n}\n\n- (BOOL)_addToActiveListWithClassName:(NSString *)targetClassName selName:(NSString *)targetSelName {\n    __block BOOL addSuccessfully = YES;\n    \n    NSDictionary *activeList_dict = [LKS_ActiveList() lookin_firstFiltered:^BOOL(NSDictionary<NSString *,id> *obj) {\n        return [obj[kActiveListKey_Class] isEqualToString:targetClassName];\n    }];\n    if (activeList_dict) {\n        NSMutableArray *sels = activeList_dict[kActiveListKey_Sels];\n        if ([sels containsObject:targetSelName]) {\n            addSuccessfully = NO;\n        } else {\n            [sels addObject:targetSelName];\n        }\n    } else {\n        activeList_dict = @{kActiveListKey_Class:targetClassName, kActiveListKey_Sels: @[targetSelName].mutableCopy};\n        [LKS_ActiveList() addObject:activeList_dict];\n    }\n    \n    return addSuccessfully;\n}\n\n- (BOOL)_isValidWithClassName:(NSString *)targetClassName selName:(NSString *)targetSelName {\n    if ([targetSelName isEqualToString:@\"dealloc\"]) {\n        return NO;\n    }\n    Class targetClass = NSClassFromString(targetClassName);\n    if (!targetClass) {\n        return NO;\n    }\n    SEL targetSel = NSSelectorFromString(targetSelName);\n    Method targetMethod = class_getInstanceMethod(targetClass, targetSel);\n    if (targetSel == NULL || targetMethod == NULL) {\n        return NO;\n    }\n    return YES;\n}\n\n- (NSArray<NSDictionary<NSString *, id> *> *)currentActiveTraceList {\n    return LKS_ActiveList();\n}\n\n- (NSArray<NSString *> *)allClassesListInApp {\n    NSSet<NSString *> *prefixesToAvoid = [NSSet setWithObjects:@\"OS_\", @\"IBA\", @\"SKUI\", @\"HM\", @\"WBS\", @\"CDP\", @\"DMF\", @\"TimerSupport\", @\"Swift.\", @\"Foundation\", @\"CEM\", @\"PSUI\", @\"CPL\", @\"IPA\", @\"NSKeyValue\", @\"ICS\", @\"INIntent\", @\"NWConcrete\", @\"NSSQL\", @\"SASetting\", @\"SAM\", @\"GEO\", @\"PBBProto\", @\"AWD\", @\"MTL\", @\"PKPhysics\", @\"TIKeyEvent\", @\"TITypologyRecord\", @\"IDS\", @\"AVCapture\", @\"AVAsset\", @\"AVContent\", nil];\n    \n    int numClasses;\n    Class * classes = NULL;\n    \n    classes = NULL;\n    numClasses = objc_getClassList(NULL, 0);\n    \n    NSMutableArray<NSString *> *array = [NSMutableArray array];\n    if (numClasses > 0) {\n        classes = (__unsafe_unretained Class *)malloc(sizeof(Class) * numClasses);\n        numClasses = objc_getClassList(classes, numClasses);\n        for (int i = 0; i < numClasses; i++) {\n            Class c = classes[i];\n            NSString *className = NSStringFromClass(c);\n            if (className) {\n                BOOL shouldAvoid = [prefixesToAvoid lookin_any:^BOOL(NSString *prefix) {\n                    return [className hasPrefix:prefix];\n                }];\n                if (!shouldAvoid) {\n                    [array addObject:className];\n                }\n            }\n        }\n        free(classes);\n    }\n    return array.copy;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_ObjectRegistry.h",
    "content": "//\n//  LKS_ObjectRegistry.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/4/21.\n//  https://lookin.work\n//\n\n#import <Foundation/Foundation.h>\n\n@interface LKS_ObjectRegistry : NSObject\n\n+ (instancetype)sharedInstance;\n\n- (unsigned long)addObject:(NSObject *)object;\n\n- (NSObject *)objectWithOid:(unsigned long)oid;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_ObjectRegistry.m",
    "content": "//\n//  LKS_ObjectRegistry.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/4/21.\n//  https://lookin.work\n//\n\n#import \"LKS_ObjectRegistry.h\"\n\n\n\n#import <objc/runtime.h>\n\n@interface LKS_ObjectRegistry ()\n\n@property(nonatomic, strong) NSPointerArray *data;\n\n@end\n\n@implementation LKS_ObjectRegistry\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static LKS_ObjectRegistry *instance = nil;\n    dispatch_once(&onceToken,^{\n        instance = [[super allocWithZone:NULL] init];\n    });\n    return instance;\n}\n\n+ (id)allocWithZone:(struct _NSZone *)zone{\n    return [self sharedInstance];\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        self.data = [NSPointerArray weakObjectsPointerArray];\n        // index 为 0 用 Null 填充\n        self.data.count = 1;\n    }\n    return self;\n}\n\n- (unsigned long)addObject:(NSObject *)object {\n    if (!object) {\n        return 0;\n    }\n    [self.data addPointer:(void *)object];\n    return self.data.count - 1;\n}\n\n- (NSObject *)objectWithOid:(unsigned long)oid {\n    if (self.data.count <= oid) {\n        return nil;\n    }\n    id object = [self.data pointerAtIndex:oid];\n    return object;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_TraceManager.h",
    "content": "//\n//  LKS_TraceManager.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/5.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@class LookinIvarTrace;\n\n@interface LKS_TraceManager : NSObject\n\n+ (instancetype)sharedInstance;\n\n- (void)reload;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LKS_TraceManager.m",
    "content": "//\n//  LKS_TraceManager.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/5.\n//  https://lookin.work\n//\n\n#import \"LKS_TraceManager.h\"\n\n\n\n#import <Objc/runtime.h>\n#import \"LookinIvarTrace.h\"\n#import \"LookinServerDefines.h\"\n#import \"LKS_LocalInspectManager.h\"\n\n@implementation LKS_TraceManager\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static LKS_TraceManager *instance = nil;\n    dispatch_once(&onceToken,^{\n        instance = [[super allocWithZone:NULL] init];\n    });\n    return instance;\n}\n\n+ (id)allocWithZone:(struct _NSZone *)zone {\n    return [self sharedInstance];\n}\n\n- (void)reload {\n    // 把旧的先都清理掉\n    [NSObject lks_clearAllObjectsTraces];\n    \n    [[[UIApplication sharedApplication].windows copy] enumerateObjectsUsingBlock:^(__kindof UIWindow * _Nonnull window, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self _addTraceForLayersRootedByLayer:window.layer];\n    }];  \n}\n\n- (void)_addTraceForLayersRootedByLayer:(CALayer *)layer {\n    UIView *view = layer.lks_hostView;\n    \n    if ([view.superview lks_isChildrenViewOfTabBar]) {\n        view.lks_isChildrenViewOfTabBar = YES;\n    } else if ([view isKindOfClass:[UITabBar class]]) {\n        view.lks_isChildrenViewOfTabBar = YES;\n    }\n    \n    if (view) {\n        [self _markIVarsInAllClassLevelsOfObject:view];\n        if (view.lks_hostViewController) {\n            [self _markIVarsInAllClassLevelsOfObject:view.lks_hostViewController];\n        }\n        \n        [self _buildSpecialTraceForView:view];\n    } else {\n        [self _markIVarsInAllClassLevelsOfObject:layer];\n    }\n    \n    [[layer.sublayers copy] enumerateObjectsUsingBlock:^(__kindof CALayer * _Nonnull sublayer, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self _addTraceForLayersRootedByLayer:sublayer];\n    }];\n}\n\n- (void)_buildSpecialTraceForView:(UIView *)view {\n    if (view.lks_hostViewController) {\n        view.lks_specialTrace = [NSString stringWithFormat:@\"%@.view\", NSStringFromClass(view.lks_hostViewController.class)];\n        \n    } else if ([view isKindOfClass:[UIWindow class]]) {\n        CGFloat currentWindowLevel = ((UIWindow *)view).windowLevel;\n        \n        if ([view isKindOfClass:[LKS_LocalInspectContainerWindow class]]) {\n            view.lks_specialTrace = [NSString stringWithFormat:@\"Lookin Private Window ( Level: %@ )\", @(currentWindowLevel)];\n        } else if (((UIWindow *)view).isKeyWindow) {\n            view.lks_specialTrace = [NSString stringWithFormat:@\"KeyWindow ( Level: %@ )\", @(currentWindowLevel)];\n        } else {\n            view.lks_specialTrace = [NSString stringWithFormat:@\"WindowLevel: %@\", @(currentWindowLevel)];\n        }\n    } else if ([view isKindOfClass:[UITableViewCell class]]) {\n        ((UITableViewCell *)view).backgroundView.lks_specialTrace = @\"cell.backgroundView\";\n        ((UITableViewCell *)view).accessoryView.lks_specialTrace = @\"cell.accessoryView\";\n    \n    } else if ([view isKindOfClass:[UITableView class]]) {\n        UITableView *tableView = (UITableView *)view;\n        \n        NSMutableArray<NSNumber *> *relatedSectionIdx = [NSMutableArray array];\n        [[tableView visibleCells] enumerateObjectsUsingBlock:^(__kindof UITableViewCell * _Nonnull cell, NSUInteger idx, BOOL * _Nonnull stop) {\n            NSIndexPath *indexPath = [tableView indexPathForCell:cell];\n            cell.lks_specialTrace = [NSString stringWithFormat:@\"{ sec:%@, row:%@ }\", @(indexPath.section), @(indexPath.row)];\n            \n            if (![relatedSectionIdx containsObject:@(indexPath.section)]) {\n                [relatedSectionIdx addObject:@(indexPath.section)];\n            }\n        }];\n        \n        [relatedSectionIdx enumerateObjectsUsingBlock:^(NSNumber * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n            NSUInteger secIdx = [obj unsignedIntegerValue];\n            UIView *secHeaderView = [tableView headerViewForSection:secIdx];\n            secHeaderView.lks_specialTrace = [NSString stringWithFormat:@\"sectionHeader { sec: %@ }\", @(secIdx)];\n            \n            UIView *secFooterView = [tableView footerViewForSection:secIdx];\n            secFooterView.lks_specialTrace = [NSString stringWithFormat:@\"sectionFooter { sec: %@ }\", @(secIdx)];\n        }];\n        \n    } else if ([view isKindOfClass:[UICollectionView class]]) {\n        UICollectionView *collectionView = (UICollectionView *)view;\n        collectionView.backgroundView.lks_specialTrace = @\"collectionView.backgroundView\";\n        \n        if (@available(iOS 9.0, *)) {\n            [[collectionView indexPathsForVisibleSupplementaryElementsOfKind:UICollectionElementKindSectionHeader] enumerateObjectsUsingBlock:^(NSIndexPath * _Nonnull indexPath, NSUInteger idx, BOOL * _Nonnull stop) {\n                UIView *headerView = [collectionView supplementaryViewForElementKind:UICollectionElementKindSectionHeader atIndexPath:indexPath];\n                headerView.lks_specialTrace = [NSString stringWithFormat:@\"sectionHeader { sec:%@ }\", @(indexPath.section)];\n            }];\n            [[collectionView indexPathsForVisibleSupplementaryElementsOfKind:UICollectionElementKindSectionFooter] enumerateObjectsUsingBlock:^(NSIndexPath * _Nonnull indexPath, NSUInteger idx, BOOL * _Nonnull stop) {\n                UIView *footerView = [collectionView supplementaryViewForElementKind:UICollectionElementKindSectionFooter atIndexPath:indexPath];\n                footerView.lks_specialTrace = [NSString stringWithFormat:@\"sectionFooter { sec:%@ }\", @(indexPath.section)];\n            }];\n        }\n        \n        [[collectionView visibleCells] enumerateObjectsUsingBlock:^(__kindof UICollectionViewCell * _Nonnull cell, NSUInteger idx, BOOL * _Nonnull stop) {\n            NSIndexPath *indexPath = [collectionView indexPathForCell:cell];\n            cell.lks_specialTrace = [NSString stringWithFormat:@\"{ item:%@, sec:%@ }\", @(indexPath.item), @(indexPath.section)];\n        }];\n        \n    } else if ([view isKindOfClass:[UITableViewHeaderFooterView class]]) {\n        UITableViewHeaderFooterView *headerFooterView = (UITableViewHeaderFooterView *)view;\n        headerFooterView.textLabel.lks_specialTrace = @\"sectionHeaderFooter.textLabel\";\n        headerFooterView.detailTextLabel.lks_specialTrace = @\"sectionHeaderFooter.detailTextLabel\";\n    }\n}\n\n- (void)_markIVarsInAllClassLevelsOfObject:(NSObject *)object {\n    [self _markIVarsOfObject:object class:object.class];\n}\n\n- (void)_markIVarsOfObject:(NSObject *)hostObject class:(Class)targetClass {\n    if (!targetClass) {\n        return;\n    }\n\n    NSArray<NSString *> *prefixesToTerminateRecursion = @[@\"NSObject\", @\"UIResponder\", @\"UIButton\", @\"UIButtonLabel\"];\n    BOOL hasPrefix = [prefixesToTerminateRecursion lookin_any:^BOOL(NSString *prefix) {\n        return [NSStringFromClass(targetClass) hasPrefix:prefix];\n    }];\n    if (hasPrefix) {\n        return;\n    }\n    \n    unsigned int outCount = 0;\n    Ivar *ivars = class_copyIvarList(targetClass, &outCount);\n    for (unsigned int i = 0; i < outCount; i ++) {\n        Ivar ivar = ivars[i];\n        NSString *ivarType = [[NSString alloc] lookin_safeInitWithUTF8String:ivar_getTypeEncoding(ivar)];\n        if (![ivarType hasPrefix:@\"@\"] || ivarType.length <= 3) {\n            continue;\n        }\n        NSString *ivarClassName = [ivarType substringWithRange:NSMakeRange(2, ivarType.length - 3)];\n        Class ivarClass = NSClassFromString(ivarClassName);\n        if (![ivarClass isSubclassOfClass:[UIView class]]\n            && ![ivarClass isSubclassOfClass:[CALayer class]]\n            && ![ivarClass isSubclassOfClass:[UIViewController class]]\n            && ![ivarClass isSubclassOfClass:[UIGestureRecognizer class]]) {\n            continue;\n        }\n        const char * ivarNameChar = ivar_getName(ivar);\n        if (!ivarNameChar) {\n            continue;\n        }\n        // 这个 ivarObject 可能的类型：UIView, CALayer, UIViewController, UIGestureRecognizer\n        NSObject *ivarObject = object_getIvar(hostObject, ivar);\n        if (!ivarObject) {\n            continue;\n        }\n\n        LookinIvarTrace *ivarTrace = [LookinIvarTrace new];\n        ivarTrace.hostObject = hostObject;\n        ivarTrace.hostClassName = NSStringFromClass(targetClass);\n        ivarTrace.ivarName = [[NSString alloc] lookin_safeInitWithUTF8String:ivarNameChar];\n        \n        if (hostObject == ivarObject) {\n            ivarTrace.relation = LookinIvarTraceRelationValue_Self;\n        } else if ([hostObject isKindOfClass:[UIView class]]) {\n            CALayer *ivarLayer = nil;\n            if ([ivarObject isKindOfClass:[CALayer class]]) {\n                ivarLayer = (CALayer *)ivarObject;\n            } else if ([ivarObject isKindOfClass:[UIView class]]) {\n                ivarLayer = ((UIView *)ivarObject).layer;\n            }\n            if (ivarLayer && (ivarLayer.superlayer == ((UIView *)hostObject).layer)) {\n                ivarTrace.relation = @\"superview\";\n            }\n        }\n\n        if ([LKS_InvalidIvarTraces() containsObject:ivarTrace]) {\n            continue;\n        }\n        \n        if (!ivarObject.lks_ivarTraces) {\n            ivarObject.lks_ivarTraces = [NSArray array];\n        }\n        if (![ivarObject.lks_ivarTraces containsObject:ivarTrace]) {\n            ivarObject.lks_ivarTraces = [ivarObject.lks_ivarTraces arrayByAddingObject:ivarTrace];\n        }\n    }\n    free(ivars);\n    \n    Class superClass = [targetClass superclass];\n    [self _markIVarsOfObject:hostObject class:superClass];\n}\n\nstatic NSSet<LookinIvarTrace *> *LKS_InvalidIvarTraces() {\n    static NSSet *list;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSMutableSet *set = [NSMutableSet set];\n        \n        [set addObject:({\n            LookinIvarTrace *trace = [LookinIvarTrace new];\n            trace.hostClassName = @\"UIView\";\n            trace.ivarName = @\"_window\";\n            trace;\n        })];\n        [set addObject:({\n            LookinIvarTrace *trace = [LookinIvarTrace new];\n            trace.hostClassName = @\"UIViewController\";\n            trace.ivarName = @\"_view\";\n            trace;\n        })];\n        [set addObject:({\n            LookinIvarTrace *trace = [LookinIvarTrace new];\n            trace.hostClassName = @\"UIView\";\n            trace.ivarName = @\"_viewDelegate\";\n            trace;\n        })];\n        [set addObject:({\n            LookinIvarTrace *trace = [LookinIvarTrace new];\n            trace.hostClassName = @\"UIViewController\";\n            trace.ivarName = @\"_parentViewController\";\n            trace;\n        })];\n        list = set.copy;\n    });\n    return list;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Others/LookinServerDefines.h",
    "content": "//\n//  LookinServer_PrefixHeader.pch\n//  LookinServer\n//\n//  Created by Li Kai on 2018/12/21.\n//  https://lookin.work\n//\n\n#import \"TargetConditionals.h\"\n#import \"LookinDefines.h\"\n#import \"LKS_Helper.h\"\n#import \"NSObject+LookinServer.h\"\n#import \"NSArray+Lookin.h\"\n#import \"NSSet+Lookin.h\"\n#import \"CALayer+Lookin.h\"\n#import \"UIView+LookinServer.h\"\n#import \"CALayer+LookinServer.h\"\n#import \"NSObject+Lookin.h\"\n#import \"NSString+Lookin.h\"\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveDataSource.h",
    "content": "//\n//  LKS_PerspectiveDataSource.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDefines.h\"\n\n@class LookinHierarchyInfo, LookinDisplayItem, LKS_PerspectiveDataSource;\n\n@protocol LKS_PerspectiveDataSourceDelegate <NSObject>\n\n@optional\n\n- (void)dataSourceDidChangeSelectedItem:(LKS_PerspectiveDataSource *)dataSource;\n\n- (void)dataSourceDidChangeDisplayItems:(LKS_PerspectiveDataSource *)dataSource;\n\n- (void)dataSourceDidChangeNoPreview:(LKS_PerspectiveDataSource *)dataSource;\n\n@end\n\n@interface LKS_PerspectiveDataSource : NSObject\n\n@property(nonatomic, weak) id<LKS_PerspectiveDataSourceDelegate> perspectiveLayer;\n@property(nonatomic, weak) id<LKS_PerspectiveDataSourceDelegate> hierarchyView;\n\n- (instancetype)initWithHierarchyInfo:(LookinHierarchyInfo *)info;\n\n/// 一维数组，包含所有 hierarchy 树中可见和不可见的 displayItems\n@property(nonatomic, copy, readonly) NSArray<LookinDisplayItem *> *flatItems;\n\n/// 一维数组，只包括在 hierarchy 树中可见的 displayItems\n@property(nonatomic, copy, readonly) NSArray<LookinDisplayItem *> *displayingFlatItems;\n\n/// 当前应该被显示的 rows 行数\n- (NSInteger)numberOfRows;\n\n/// 获取指定行的 item\n- (LookinDisplayItem *)itemAtRow:(NSInteger)index;\n\n/// 获取指定 item 的 row，可能为 NSNotFound\n- (NSInteger)rowForItem:(LookinDisplayItem *)item;\n\n/// 当前选中的 item\n@property(nonatomic, weak) LookinDisplayItem *selectedItem;\n\n/// 将 item 折叠起来，如果该 item 没有 subitems 或已经被折叠，则该方法不起任何作用\n- (void)collapseItem:(LookinDisplayItem *)item;\n\n/// 将 item 展开，如果该 item 没有 subitems 或已经被展开，则该方法不起任何作用\n- (void)expandItem:(LookinDisplayItem *)item;\n\n/// 某个颜色的业务别名，如果不存在则返回 nil\n- (NSArray<NSString *> *)aliasForColor:(UIColor *)color;\n\n@property(nonatomic, strong, readonly) LookinHierarchyInfo *rawHierarchyInfo;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveDataSource.m",
    "content": "//\n//  LKS_PerspectiveDataSource.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n#import \"LKS_PerspectiveDataSource.h\"\n\n\n\n#import \"UIColor+LookinServer.h\"\n#import \"LookinDisplayItem.h\"\n#import \"LookinHierarchyInfo.h\"\n#import \"LookinServerDefines.h\"\n#import \"LKS_PerspectiveLayer.h\"\n\n@interface LKS_PerspectiveDataSource ()\n\n@property(nonatomic, copy, readwrite) NSArray<LookinDisplayItem *> *flatItems;\n@property(nonatomic, copy, readwrite) NSArray<LookinDisplayItem *> *displayingFlatItems;\n\n/**\n key 是 rgba 字符串，value 是 alias 字符串数组，比如：\n \n @{\n @\"(255, 255, 255, 1)\": @[@\"MyWhite\", @\"MainThemeWhite\"],\n @\"(255, 0, 0, 0.5)\": @[@\"BestRed\", @\"TransparentRed\"]\n };\n \n */\n@property(nonatomic, strong) NSDictionary<NSString *, NSArray<NSString *> *> *colorToAliasMap;\n\n@end\n\n@implementation LKS_PerspectiveDataSource\n\n- (instancetype)initWithHierarchyInfo:(LookinHierarchyInfo *)info {\n    if (self = [self init]) {\n        _rawHierarchyInfo = info;\n        \n//        [self _setUpColors];\n        \n        // 打平为二维数组\n        self.flatItems = [LookinDisplayItem flatItemsFromHierarchicalItems:info.displayItems];\n        \n        // 设置 preferToBeCollapsed 属性\n        NSSet<NSString *> *classesPreferredToCollapse = [NSSet setWithObjects:@\"UILabel\", @\"UIPickerView\", @\"UIProgressView\", @\"UIActivityIndicatorView\", @\"UIAlertView\", @\"UIActionSheet\", @\"UISearchBar\", @\"UIButton\", @\"UITextView\", @\"UIDatePicker\", @\"UIPageControl\", @\"UISegmentedControl\", @\"UITextField\", @\"UISlider\", @\"UISwitch\", @\"UIVisualEffectView\", @\"UIImageView\", @\"WKCommonWebView\", @\"UITextEffectsWindow\", @\"LKS_LocalInspectContainerWindow\", nil];\n        if (info.collapsedClassList.count) {\n            classesPreferredToCollapse = [classesPreferredToCollapse setByAddingObjectsFromArray:info.collapsedClassList];\n        }\n        // no preview\n        NSSet<NSString *> *classesWithNoPreview = [NSSet setWithArray:@[@\"UITextEffectsWindow\", @\"UIRemoteKeyboardWindow\", @\"LKS_LocalInspectContainerWindow\"]];\n        \n        [self.flatItems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n            if ([obj itemIsKindOfClassesWithNames:classesPreferredToCollapse]) {\n                [obj enumerateSelfAndChildren:^(LookinDisplayItem *item) {\n                    item.preferToBeCollapsed = YES;\n                }];\n            }\n            \n            if (obj.indentLevel == 0) {\n                if ([obj itemIsKindOfClassesWithNames:classesWithNoPreview]) {\n                    obj.noPreview = YES;\n                }\n            }\n        }];\n        \n        // 设置展开和折叠\n        LookinDisplayItem *shouldSelectedItem;\n        [self _adjustExpansionWithPreferedSelectedItem:&shouldSelectedItem];\n        \n        // 设置选中\n        if (!shouldSelectedItem) {\n            shouldSelectedItem = self.flatItems.firstObject;\n        }\n        self.selectedItem = shouldSelectedItem;\n    }\n    return self;\n}\n\n- (NSInteger)numberOfRows {\n    return self.displayingFlatItems.count;\n}\n\n- (LookinDisplayItem *)itemAtRow:(NSInteger)index {\n    return [self.displayingFlatItems lookin_safeObjectAtIndex:index];\n}\n\n- (NSInteger)rowForItem:(LookinDisplayItem *)item {\n    NSInteger row = [self.displayingFlatItems indexOfObject:item];\n    return row;\n}\n\n- (void)setSelectedItem:(LookinDisplayItem *)selectedItem {\n    if (_selectedItem == selectedItem) {\n        return;\n    }\n    _selectedItem.isSelected = NO;\n    _selectedItem = selectedItem;\n    _selectedItem.isSelected = YES;\n    \n    if ([self.hierarchyView respondsToSelector:@selector(dataSourceDidChangeSelectedItem:)]) {\n        [self.hierarchyView dataSourceDidChangeSelectedItem:self];\n    }\n    if ([self.perspectiveLayer respondsToSelector:@selector(dataSourceDidChangeSelectedItem:)]) {\n        [self.perspectiveLayer dataSourceDidChangeSelectedItem:self];\n    }\n}\n\n- (void)collapseItem:(LookinDisplayItem *)item {\n    if (!item.isExpandable) {\n        return;\n    }\n    if (!item.isExpanded) {\n        return;\n    }\n    item.isExpanded = NO;\n    [self _updateDisplayingFlatItems];\n}\n\n- (void)expandItem:(LookinDisplayItem *)item {\n    if (!item.isExpandable) {\n        return;\n    }\n    if (item.isExpanded) {\n        return;\n    }\n    item.isExpanded = YES;\n    [self _updateDisplayingFlatItems];\n}\n\n#pragma mark - Colors\n\n- (NSArray<NSString *> *)aliasForColor:(UIColor *)color {\n    if (!color) {\n        return nil;\n    }\n    NSString *rgbaString = color.lks_rgbaString;\n    NSArray<NSString *> *names = self.colorToAliasMap[rgbaString];\n    return names;\n}\n\n//- (void)_setUpColors {\n//    NSMutableDictionary<NSString *, NSMutableArray<NSString *> *> *colorToAliasMap = [NSMutableDictionary dictionary];\n//\n//    /**\n//     hierarchyInfo.colorAlias 可以有三种结构：\n//     1）key 是颜色别名，value 是 UIColor/UIColor。即 <NSString *, Color *>\n//     2）key 是一组颜色的标题，value 是 NSDictionary，而这个 NSDictionary 的 key 是颜色别名，value 是 UIColor / UIColor。即 <NSString *, NSDictionary<NSString *, Color *> *>\n//     3）以上两者混在一起\n//     */\n//    [self.rawHierarchyInfo.colorAlias enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, id _Nonnull colorOrDict, BOOL * _Nonnull stop) {\n//        if ([colorOrDict isKindOfClass:[UIColor class]]) {\n//            NSString *colorDesc = [((UIColor *)colorOrDict) lks_rgbaString];\n//            if (colorDesc) {\n//                if (!colorToAliasMap[colorDesc]) {\n//                    colorToAliasMap[colorDesc] = [NSMutableArray array];\n//                }\n//                [colorToAliasMap[colorDesc] addObject:key];\n//            }\n//\n//        } else if ([colorOrDict isKindOfClass:[NSDictionary class]]) {\n//            [((NSDictionary *)colorOrDict) enumerateKeysAndObjectsUsingBlock:^(NSString *colorAliaName, UIColor *colorObj, BOOL * _Nonnull stop) {\n//                NSString *colorDesc = colorObj.lks_rgbaString;\n//                if (colorDesc) {\n//                    if (!colorToAliasMap[colorDesc]) {\n//                        colorToAliasMap[colorDesc] = [NSMutableArray array];\n//                    }\n//                    [colorToAliasMap[colorDesc] addObject:colorAliaName];\n//                }\n//            }];\n//\n//        } else {\n//            NSAssert(NO, @\"\");\n//        }\n//    }];\n//    self.colorToAliasMap = colorToAliasMap;\n//}\n\n#pragma mark - Others\n\n- (void)_adjustExpansionWithPreferedSelectedItem:(LookinDisplayItem **)selectedItem {\n    [self.flatItems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        obj.hasDeterminedExpansion = NO;\n        \n        if (!obj.isExpandable) {\n            obj.hasDeterminedExpansion = YES;\n            return;\n        }\n    }];\n    \n    LookinDisplayItem *keyWindowItem = [self.rawHierarchyInfo.displayItems lookin_firstFiltered:^BOOL(LookinDisplayItem *windowItem) {\n        return windowItem.representedAsKeyWindow;\n    }];\n    if (!keyWindowItem) {\n        keyWindowItem = self.rawHierarchyInfo.displayItems.firstObject;\n    }\n    [self.rawHierarchyInfo.displayItems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull windowItem, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (windowItem == keyWindowItem) {\n            return;\n        }\n        // 非 keyWindow 上的都折叠起来\n        [[LookinDisplayItem flatItemsFromHierarchicalItems:@[windowItem]] enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n            if (obj.hasDeterminedExpansion) {\n                return;\n            }\n            obj.isExpanded = NO;\n            obj.hasDeterminedExpansion = YES;\n        }];\n    }];\n    \n    NSArray<LookinDisplayItem *> *UITransitionViewItems = [keyWindowItem.subitems lookin_filter:^BOOL(LookinDisplayItem *obj) {\n        return [obj.title isEqualToString:@\"UITransitionView\"];\n    }];\n    [UITransitionViewItems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (obj.hasDeterminedExpansion) {\n            return;\n        }\n        if (idx == (UITransitionViewItems.count - 1)) {\n            // 展开最后一个 UITransitionView\n            obj.isExpanded = YES;\n        } else {\n            // 折叠前几个 UITransitionView\n            obj.isExpanded = NO;\n        }\n        obj.hasDeterminedExpansion = YES;\n    }];\n    \n    NSMutableArray<LookinDisplayItem *> *viewControllerItems = [NSMutableArray array];\n    [[LookinDisplayItem flatItemsFromHierarchicalItems:@[keyWindowItem]] enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (!!obj.hostViewControllerObject) {\n            [viewControllerItems addObject:obj];\n            return;\n        }\n        if (obj.hasDeterminedExpansion) {\n            return;\n        }\n        if (obj.inNoPreviewHierarchy || obj.preferToBeCollapsed || obj.inHiddenHierarchy) {\n            // 把 noPreview 和 UIButton 之类常用控件叠起来\n            obj.isExpanded = NO;\n            obj.hasDeterminedExpansion = YES;\n            return;\n        }\n        if ([obj itemIsKindOfClassesWithNames:[NSSet setWithObjects:@\"UINavigationBar\", @\"UITabBar\", nil]]) {\n            // 把 NavigationBar 和 TabBar 折叠起来\n            [obj enumerateSelfAndChildren:^(LookinDisplayItem *item) {\n                if (item.hasDeterminedExpansion) {\n                    return;\n                }\n                item.isExpanded = NO;\n                item.hasDeterminedExpansion = YES;\n            }];\n            return;\n        }\n    }];\n    \n    // 从 viewController 开始算向 leaf 多推 3 层\n    [viewControllerItems enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(LookinDisplayItem * _Nonnull viewControllerItem, NSUInteger idx, BOOL * _Nonnull stop) {\n        [viewControllerItem enumerateAncestors:^(LookinDisplayItem *item, BOOL *stop) {\n            // 把 viewController 的 ancestors 都展开\n            if (item.hasDeterminedExpansion) {\n                return;\n            }\n            item.isExpanded = YES;\n            item.hasDeterminedExpansion = YES;\n        }];\n        \n        BOOL hasTableOrCollectionView = [viewControllerItem.subitems.firstObject itemIsKindOfClassesWithNames:[NSSet setWithObjects:@\"UITableView\", @\"UICollectionView\", nil]];\n        // 如果是那种典型的 UITableView 或 UICollectionView 的话，则向 leaf 方向推进 2 层（这样就可以让 cell 恰好露出来而不露出来 cell 的 contentView），否则就推 3 层\n        NSUInteger indentsForward = hasTableOrCollectionView ? 2 : 3;\n        \n        [viewControllerItem enumerateSelfAndChildren:^(LookinDisplayItem *item) {\n            if (item.hasDeterminedExpansion) {\n                return;\n            }\n            // 向 leaf 方向推 2 或 3 层\n            if (item.indentLevel < viewControllerItem.indentLevel + indentsForward) {\n                item.isExpanded = YES;\n                item.hasDeterminedExpansion = YES;\n            }\n        }];\n    }];\n    \n    // 剩下未处理的都折叠\n    [self.flatItems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (obj.hasDeterminedExpansion) {\n            return;\n        }\n        obj.isExpanded = NO;\n    }];\n    \n    if (selectedItem) {\n        *selectedItem = viewControllerItems.lastObject;\n    }\n    \n    [self _updateDisplayingFlatItems];\n}\n\n- (void)_updateDisplayingFlatItems {\n    __block NSInteger maxIndentationLevel = 0;\n    NSMutableArray<LookinDisplayItem *> *displayingItems = [NSMutableArray array];\n    [self.flatItems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (obj.displayingInHierarchy) {\n            maxIndentationLevel = MAX(maxIndentationLevel, obj.indentLevel);\n            [displayingItems addObject:obj];\n        }\n    }];\n    self.displayingFlatItems = displayingItems;\n    \n    if ([self.hierarchyView respondsToSelector:@selector(dataSourceDidChangeDisplayItems:)]) {\n        [self.hierarchyView dataSourceDidChangeDisplayItems:self];\n    }\n    if ([self.perspectiveLayer respondsToSelector:@selector(dataSourceDidChangeDisplayItems:)]) {\n        [self.perspectiveLayer dataSourceDidChangeDisplayItems:self];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveHierarchyCell.h",
    "content": "//\n//  LKS_PerspectiveHierarchyCell.h\n//  LookinServer\n//\n//  Created by Li Kai on 2018/12/24.\n//  https://lookin.work\n//\n\n\n\n#import <UIKit/UIKit.h>\n\n@class LookinDisplayItem;\n\n@interface LKS_PerspectiveHierarchyCell : UITableViewCell\n\n@property(nonatomic, strong) LookinDisplayItem *displayItem;\n\n- (void)reRender;\n\n@property(nonatomic, strong, readonly) UIButton *indicatorButton;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveHierarchyCell.m",
    "content": "//\n//  LKS_PerspectiveHierarchyCell.m\n//  LookinServer\n//\n//  Created by Li Kai on 2018/12/24.\n//  https://lookin.work\n//\n\n#import \"LKS_PerspectiveHierarchyCell.h\"\n\n\n\n#import \"LookinDisplayItem.h\"\n#import \"LookinIvarTrace.h\"\n#import \"LookinServerDefines.h\"\n\n@interface LKS_PerspectiveHierarchyCell ()\n\n@property(nonatomic, strong) UILabel *titleLabel;\n@property(nonatomic, strong) UILabel *subtitleLabel;\n@property(nonatomic, strong) CALayer *strikethroughLayer;\n\n@property(nonatomic, assign) CGFloat cachedContentWidth;\n\n@end\n\n@implementation LKS_PerspectiveHierarchyCell {\n    CGFloat _horInset;\n    CGFloat _indicatorWidth;\n    CGFloat _iconImageMarginLeft;\n    CGFloat _indentUnitWidth;\n    CGFloat _titleLeft;\n    CGFloat _subtitleLeft;\n}\n\n- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {\n    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {\n        _horInset = 10;\n        _indicatorWidth = 15;\n        _iconImageMarginLeft = 5;\n        _indentUnitWidth = 10;\n        _titleLeft = 6;\n        _subtitleLeft = 10;\n        \n        _indicatorButton = [UIButton new];\n        [self.contentView addSubview:self.indicatorButton];\n        \n        self.titleLabel = [UILabel new];\n        self.titleLabel.font = [UIFont systemFontOfSize:12];\n        [self.contentView addSubview:self.titleLabel];\n        \n        self.subtitleLabel = [UILabel new];\n        self.subtitleLabel.font = [UIFont systemFontOfSize:11];\n        [self.contentView addSubview:self.subtitleLabel];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    self.indicatorButton.frame = ({\n        CGFloat x = self.displayItem.indentLevel * _indentUnitWidth + _horInset;\n        CGRectMake(x, 0, _indicatorWidth, self.bounds.size.height);\n    });\n        \n    self.titleLabel.frame = ({\n        CGFloat width = self.titleLabel.lks_bestWidth;\n        CGRectMake(CGRectGetMaxX(self.indicatorButton.frame) + _titleLeft, 0, width, self.bounds.size.height);\n    });\n    CGFloat labelMaxX = CGRectGetMaxX(self.titleLabel.frame);\n    \n    if (!self.subtitleLabel.hidden) {\n        self.subtitleLabel.frame = ({\n            CGFloat width = self.subtitleLabel.lks_bestWidth;\n            CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + _subtitleLeft, 0, width, self.bounds.size.height);\n        });\n        labelMaxX = CGRectGetMaxX(self.subtitleLabel.frame);\n    }\n    if (self.strikethroughLayer && !self.strikethroughLayer.hidden) {\n        self.strikethroughLayer.frame = ({\n            CGFloat x = CGRectGetMinX(self.titleLabel.frame) - 2;\n            CGFloat maxX = self.subtitleLabel.hidden ? (CGRectGetMaxX(self.titleLabel.frame) + 2) : (CGRectGetMaxX(self.subtitleLabel.frame) + 2);\n            CGFloat width = maxX - x;\n            CGRectMake(x, CGRectGetMidY(self.bounds), width, 1);\n        });\n    }\n}\n\n- (CGSize)sizeThatFits:(CGSize)size {\n    size.width = self.cachedContentWidth;\n    return size;\n}\n\n- (void)setDisplayItem:(LookinDisplayItem *)displayItem {\n    _displayItem = displayItem;\n    [self reRender];\n}\n\n- (void)reRender {\n    // text\n    self.titleLabel.text = self.displayItem.title;\n    \n    // subtitle\n    self.subtitleLabel.text = self.displayItem.subtitle;\n    self.subtitleLabel.hidden = (self.displayItem.subtitle.length == 0);\n    \n    // select\n    if (self.displayItem.isSelected) {\n        self.backgroundColor = LookinColorRGBAMake(172, 177, 191, .4);\n        self.subtitleLabel.textColor = [UIColor whiteColor];\n    } else {\n        self.backgroundColor = [UIColor clearColor];\n        self.subtitleLabel.textColor = LookinColorMake(133, 140, 150);\n    }\n \n    // icon\n    if (!self.displayItem.isExpandable) {\n        self.indicatorButton.hidden = YES;\n    } else if (self.displayItem.isExpanded) {\n        [self.indicatorButton setImage:[self _arrowDownImage] forState:UIControlStateNormal];\n        self.indicatorButton.hidden = NO;\n    } else {\n        [self.indicatorButton setImage:[self _arrowRightImage] forState:UIControlStateNormal];\n        self.indicatorButton.hidden = NO;\n    }\n    \n    // strike\n    if (self.displayItem.inNoPreviewHierarchy) {\n        if (!self.strikethroughLayer) {\n            self.strikethroughLayer = [CALayer layer];\n            [self.strikethroughLayer lookin_removeImplicitAnimations];\n            self.strikethroughLayer.backgroundColor = LookinColorRGBAMake(255, 255, 255, .3).CGColor;\n            [self.layer addSublayer:self.strikethroughLayer];\n        }\n        self.strikethroughLayer.hidden = NO;\n        \n        if (self.displayItem.isSelected) {\n            self.titleLabel.textColor = [UIColor whiteColor];\n        } else {\n            self.titleLabel.textColor = LookinColorMake(113, 120, 130);\n        }\n    } else {\n        self.strikethroughLayer.hidden = YES;\n        self.titleLabel.textColor = [UIColor whiteColor];\n    }\n    \n    [self setNeedsLayout];\n\n    self.cachedContentWidth = ({\n        CGFloat width = 0;\n        width = _horInset + self.displayItem.indentLevel * _indentUnitWidth + _indicatorWidth + _iconImageMarginLeft + _titleLeft + self.titleLabel.lks_bestWidth + _horInset;\n        if (!self.subtitleLabel.hidden) {\n            width += self.subtitleLabel.lks_bestWidth + _subtitleLeft;\n        }\n        width;\n    });\n}\n\n- (UIImage *)_arrowRightImage {\n    static UIImage *image = nil;\n    if (image) {\n        return image;\n    }\n    \n    CGFloat width = 10;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, width), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    UIBezierPath *path = [UIBezierPath bezierPath];\n    [path moveToPoint:CGPointMake(0, 0)];\n    [path addLineToPoint:CGPointMake(width - 2, width / 2.0)];\n    [path addLineToPoint:CGPointMake(0, width)];\n    [path closePath];\n    \n    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path fill];\n    \n    image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n- (UIImage *)_arrowDownImage {\n    static UIImage *image = nil;\n    if (image) {\n        return image;\n    }\n    \n    CGFloat width = 10;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, width), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    UIBezierPath *path = [UIBezierPath bezierPath];\n    [path moveToPoint:CGPointMake(0, 0)];\n    [path addLineToPoint:CGPointMake(width, 0)];\n    [path addLineToPoint:CGPointMake(width / 2.0, width - 2)];\n    [path closePath];\n    \n    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path fill];\n    \n    image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveHierarchyView.h",
    "content": "//\n//  LKS_PerspectiveHierarchyView.h\n//  LookinServer\n//\n//  Created by Li Kai on 2018/12/24.\n//  https://lookin.work\n//\n\n\n\n#import <UIKit/UIKit.h>\n#import \"LKS_PerspectiveDataSource.h\"\n\n@interface LKS_PerspectiveHierarchyView : UIView <LKS_PerspectiveDataSourceDelegate>\n\n- (instancetype)initWithDataSource:(LKS_PerspectiveDataSource *)dataSource;\n\n@property(nonatomic, assign) BOOL isHorizontalLayout;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveHierarchyView.m",
    "content": "//\n//  LKS_PerspectiveHierarchyView.m\n//  LookinServer\n//\n//  Created by Li Kai on 2018/12/24.\n//  https://lookin.work\n//\n\n#import \"LKS_PerspectiveHierarchyView.h\"\n\n\n\n#import \"LKS_PerspectiveHierarchyCell.h\"\n#import \"LookinDisplayItem.h\"\n#import \"LookinServerDefines.h\"\n\n@interface LKS_PerspectiveHierarchyView () <UITableViewDelegate, UITableViewDataSource>\n\n@property(nonatomic, strong) UIVisualEffectView *effectBgView;\n@property(nonatomic, strong) UIScrollView *scrollView;\n@property(nonatomic, strong) UITableView *tableView;\n@property(nonatomic, strong) LKS_PerspectiveDataSource *dataSource;\n@property(nonatomic, strong) CALayer *dragHintLayer;\n\n@property(nonatomic, assign) CGFloat currentMaxCellWidth;\n\n@property(nonatomic, weak) LKS_PerspectiveHierarchyCell *selectedCell;\n\n@end\n\n@implementation LKS_PerspectiveHierarchyView\n\n- (instancetype)initWithDataSource:(LKS_PerspectiveDataSource *)dataSource {\n    if (self = [self initWithFrame:CGRectZero]) {\n        self.dataSource = dataSource;\n        self.dataSource.hierarchyView = self;\n        \n        self.clipsToBounds = YES;\n        \n        UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];\n        self.effectBgView = [[UIVisualEffectView alloc] initWithEffect:effect];\n        [self addSubview:self.effectBgView];\n        \n        self.dragHintLayer = [CALayer layer];\n        self.dragHintLayer.backgroundColor = LookinColorMake(70, 70, 70).CGColor;\n        [self.dragHintLayer lookin_removeImplicitAnimations];\n        [self.layer addSublayer:self.dragHintLayer];\n        \n        self.scrollView = [UIScrollView new];\n        self.scrollView.bounces = YES;\n        [self addSubview:self.scrollView];\n        \n        self.tableView = [[UITableView alloc] init];\n        self.tableView.backgroundColor = [UIColor clearColor];\n#if TARGET_OS_TV\n#else\n        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;\n#endif\n        self.tableView.delegate = self;\n        self.tableView.dataSource = self;\n        [self.scrollView addSubview:self.tableView];\n        \n//        [self _updateCurrentMaxCellWidth];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    self.effectBgView.frame = self.effectBgView.superview.bounds;\n    \n    // 留出一部分区域用来上下拖拽\n    CGFloat dragAreaLength = 26;\n    if (self.isHorizontalLayout) {\n        self.dragHintLayer.frame = ({\n            CGFloat width = 5;\n            CGFloat height = 38;\n            CGRectMake(self.layer.bounds.size.width - dragAreaLength / 2.0 - width / 2.0, self.layer.bounds.size.height / 2.0 - height / 2.0, width, height);\n        });\n        self.dragHintLayer.cornerRadius = self.dragHintLayer.bounds.size.width / 2.0;\n        \n        self.scrollView.frame = CGRectMake(0, 0, self.layer.bounds.size.width - dragAreaLength, self.layer.bounds.size.height);\n        \n    } else {\n        self.dragHintLayer.frame = ({\n            CGFloat width = 38;\n            CGFloat height = 5;\n            CGRectMake(self.layer.bounds.size.width / 2.0 - width / 2.0, dragAreaLength / 2.0 - height / 2.0, width, height);\n        });\n        self.dragHintLayer.cornerRadius = self.dragHintLayer.bounds.size.height / 2.0;\n\n        self.scrollView.frame = CGRectMake(0, dragAreaLength, self.layer.bounds.size.width, self.layer.bounds.size.height - dragAreaLength);\n    }\n    \n    CGSize tableSize = CGSizeMake(MAX(self.currentMaxCellWidth, self.scrollView.bounds.size.width), self.scrollView.bounds.size.height);\n    self.scrollView.contentSize = tableSize;\n    self.tableView.frame = CGRectMake(0, 0, tableSize.width, tableSize.height);\n}\n\n- (void)setIsHorizontalLayout:(BOOL)isHorizontalLayout {\n    _isHorizontalLayout = isHorizontalLayout;\n    if (isHorizontalLayout) {\n        // 顶部给 menu 留一点位置\n        self.tableView.contentInset = UIEdgeInsetsMake(40, 0, 0, 0);\n    } else {\n        self.tableView.contentInset = UIEdgeInsetsZero;\n    }\n    [self setNeedsLayout];\n}\n\n#pragma mark - UITableView\n\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {\n    return [self.dataSource numberOfRows];\n}\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n    LKS_PerspectiveHierarchyCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"cell\"];\n    if (!cell) {\n        cell = [[LKS_PerspectiveHierarchyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@\"cell\"];\n        cell.selectionStyle = UITableViewCellSelectionStyleNone;\n        [cell.indicatorButton addTarget:self action:@selector(_handleCellExpansionButton:) forControlEvents:UIControlEventTouchUpInside];\n    }\n    LookinDisplayItem *item = [self.dataSource itemAtRow:indexPath.row];\n    cell.displayItem = item;\n    cell.indicatorButton.tag = indexPath.row;\n    if (item.isSelected) {\n        self.selectedCell = cell;\n    }\n    \n    CGFloat cellWidth = [cell sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)].width;\n    if (self.currentMaxCellWidth < cellWidth) {\n        self.currentMaxCellWidth = cellWidth;\n        [self setNeedsLayout];\n    }\n    \n    return cell;\n}\n\n- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {\n    return 26;\n}\n\n- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {\n    return 0;\n}\n\n- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {\n    return 0;\n}\n\n- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {\n    LookinDisplayItem *item = [self.dataSource itemAtRow:indexPath.row];\n    if (self.dataSource.selectedItem != item) {\n        self.dataSource.selectedItem = item;\n    }\n}\n\n#pragma mark - <LKS_PerspectiveDataSourceDelegate>\n\n- (void)dataSourceDidChangeDisplayItems:(LKS_PerspectiveDataSource *)dataSource {\n    [self _tableViewReloadData];\n}\n\n- (void)dataSourceDidChangeSelectedItem:(LKS_PerspectiveDataSource *)dataSource {\n    NSInteger row = [dataSource rowForItem:dataSource.selectedItem];\n    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:0];\n    [self.selectedCell reRender];\n    \n    if (!indexPath) {\n        return;\n    }\n    // 去掉旧的 cell 的点击态\n    [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];\n    \n    \n    NSArray<NSIndexPath *> *visibleIndexPaths = [self.tableView indexPathsForVisibleRows];\n    if (![visibleIndexPaths containsObject:indexPath]) {\n        [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];\n    }\n}\n\n#pragma mark - Others\n\n- (void)_tableViewReloadData {\n    self.currentMaxCellWidth = 0;\n    [self.tableView reloadData];\n}\n\n- (void)_handleCellExpansionButton:(UIButton *)button {\n    NSUInteger row = button.tag;\n    LookinDisplayItem *item = [self.dataSource itemAtRow:row];\n    if (!item) {\n        return;\n    }\n    if (!item.isExpandable) {\n        return;\n    }\n    if (item.isExpanded) {\n        [self.dataSource collapseItem:item];\n    } else {\n        [self.dataSource expandItem:item];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveItemLayer.h",
    "content": "//\n//  LKS_PerspectiveItemLayer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n\n\n#import <QuartzCore/QuartzCore.h>\n#import \"LookinDisplayItem.h\"\n\n@interface LKS_PerspectiveItemLayer : CALayer\n\n@property(nonatomic, strong) LookinDisplayItem *displayItem;\n\n- (void)reRender;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveItemLayer.m",
    "content": "//\n//  LKS_PerspectiveItemLayer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n#import \"LKS_PerspectiveItemLayer.h\"\n\n\n\n@interface LKS_PerspectiveItemUnselectableLayer : CALayer\n\n@end\n\n@implementation LKS_PerspectiveItemUnselectableLayer\n\n- (CALayer *)hitTest:(CGPoint)p {\n    return nil;\n}\n\n@end\n\n@interface LKS_PerspectiveItemLayer ()\n\n@property(nonatomic, strong) LKS_PerspectiveItemUnselectableLayer *selectedMaskLayer;\n@property(nonatomic, strong) LKS_PerspectiveItemUnselectableLayer *contentLayer;\n\n@end\n\n@implementation LKS_PerspectiveItemLayer\n\n- (instancetype)init {\n    if (self = [super init]) {\n        self.borderWidth = 1;\n        \n        self.contentLayer = [LKS_PerspectiveItemUnselectableLayer layer];\n        [self addSublayer:self.contentLayer];\n        \n        self.selectedMaskLayer = [LKS_PerspectiveItemUnselectableLayer layer];\n        self.selectedMaskLayer.backgroundColor = LookinColorRGBAMake(74, 144, 226, .25).CGColor;\n        self.selectedMaskLayer.opacity = 0;\n        [self addSublayer:self.selectedMaskLayer];\n        \n        NSDictionary<NSString *, id<CAAction>> *actions = @{NSStringFromSelector(@selector(bounds)) : [NSNull null],\n                                                            NSStringFromSelector(@selector(position)) : [NSNull null],\n                                                            NSStringFromSelector(@selector(borderColor)) : [NSNull null],\n                                                            };\n        self.actions = actions;\n    }\n    return self;\n}\n\n- (void)layoutSublayers {\n    [super layoutSublayers];\n    self.selectedMaskLayer.frame = self.bounds;\n    self.contentLayer.frame = self.bounds;\n}\n\n- (void)setDisplayItem:(LookinDisplayItem *)displayItem {\n    _displayItem = displayItem;\n    [self reRender];\n}\n\n- (void)reRender {\n    if (!self.displayItem) {\n        NSAssert(NO, @\"\");\n        return;\n    }\n    \n    if (self.displayItem.isExpandable && self.displayItem.isExpanded) {\n        self.contentLayer.contents = (__bridge id)(self.displayItem.soloScreenshot.CGImage);\n    } else {\n        self.contentLayer.contents = (__bridge id)(self.displayItem.groupScreenshot.CGImage);\n    }\n    \n    if (self.displayItem.isSelected) {\n        self.selectedMaskLayer.opacity = 1;\n        self.borderColor = LookinColorRGBAMake(74, 144, 226, 1).CGColor;\n    } else {\n        self.selectedMaskLayer.opacity = 0;\n        self.borderColor = LookinColorRGBAMake(160, 168, 189, .6).CGColor;\n    }\n    \n    if (self.displayItem.displayingInHierarchy && !self.displayItem.inHiddenHierarchy) {\n        self.contentLayer.opacity = 1;\n        self.opacity = 1;\n    } else {\n        self.opacity = 0;\n        self.contentLayer.opacity = 0;\n    }\n}\n\n- (CALayer *)hitTest:(CGPoint)p {\n    if (self.hidden || self.opacity == 0) {\n        return nil;\n    }\n    return [super hitTest:p];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveLayer.h",
    "content": "//\n//  LKS_PerspectiveLayer.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n\n\n#import <QuartzCore/QuartzCore.h>\n#import \"LKS_PerspectiveDataSource.h\"\n\ntypedef NS_ENUM (NSUInteger, LKS_PerspectiveDimension) {\n    LKS_PerspectiveDimension2D,\n    LKS_PerspectiveDimension3D\n};\n\n@interface LKS_PerspectiveLayer : CALayer <LKS_PerspectiveDataSourceDelegate>\n\n- (instancetype)initWithDataSource:(LKS_PerspectiveDataSource *)dataSource;\n\n/// 2D 还是 3D\n@property(nonatomic, assign) LKS_PerspectiveDimension dimension;\n\n/// 旋转的角度\n@property(nonatomic, assign, readonly) CGFloat rotation;\n- (void)setRotation:(CGFloat)rotation animated:(BOOL)animated completion:(void (^)(void))completionBlock;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveLayer.m",
    "content": "//\n//  LKS_PerspectiveLayer.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n#import \"LKS_PerspectiveLayer.h\"\n\n\n\n#import \"LKS_PerspectiveDataSource.h\"\n#import \"LKS_PerspectiveItemLayer.h\"\n#import \"LookinAppInfo.h\"\n#import \"LookinHierarchyInfo.h\"\n#import \"LookinServerDefines.h\"\n\n@interface LookinDisplayItem (LKS_PerspectiveLayer)\n\n@property(nonatomic, weak) LKS_PerspectiveItemLayer *lks_itemLayer;\n\n@end\n\n@implementation LookinDisplayItem (LKS_PerspectiveLayer)\n\n- (void)setLks_itemLayer:(LKS_PerspectiveItemLayer *)lks_itemLayer {\n    [self lookin_bindObjectWeakly:lks_itemLayer forKey:@\"lks_itemLayer\"];\n}\n\n- (LKS_PerspectiveItemLayer *)lks_itemLayer {\n    return [self lookin_getBindObjectForKey:@\"lks_itemLayer\"];\n}\n\n@end\n\n@interface LKS_PerspectiveLayer ()\n\n@property(nonatomic, strong) CALayer *rotateLayer;\n\n@property(nonatomic, copy) NSArray<LKS_PerspectiveItemLayer *> *itemLayers;\n\n@property(nonatomic, strong) LKS_PerspectiveDataSource *dataSource;\n\n@property(nonatomic, strong) LKS_PerspectiveItemLayer *selectedLayer;\n\n@end\n\n@implementation LKS_PerspectiveLayer\n\n- (instancetype)initWithDataSource:(LKS_PerspectiveDataSource *)dataSource {\n    if (self = [self init]) {\n        self.dataSource = dataSource;\n        dataSource.perspectiveLayer = self;\n        \n//        [self lookin_removeImplicitAnimations];\n        \n        self.rotateLayer = [CALayer layer];\n        [self addSublayer:self.rotateLayer];\n        \n        self.itemLayers = [NSArray array];\n        \n        [self _rebuildPreviewLayers];\n    }\n    return self;\n}\n\n- (void)layoutSublayers {\n    [super layoutSublayers];\n    LookinAppInfo *appInfo = self.dataSource.rawHierarchyInfo.appInfo;\n    CGSize size = CGSizeMake(appInfo.screenWidth, appInfo.screenHeight);\n    self.rotateLayer.bounds = CGRectMake(0, 0, size.width, size.height);\n    self.rotateLayer.anchorPoint = CGPointMake(.5, .5);\n    self.rotateLayer.position = CGPointMake(self.rotateLayer.superlayer.bounds.size.width / 2.0, self.rotateLayer.superlayer.bounds.size.height / 2.0);\n}\n\n- (void)setDimension:(LKS_PerspectiveDimension)dimension {\n    _dimension = dimension;\n    if (dimension == LKS_PerspectiveDimension2D) {\n        self.rotateLayer.sublayerTransform = CATransform3DIdentity;\n        [self.itemLayers enumerateObjectsUsingBlock:^(LKS_PerspectiveItemLayer * _Nonnull layer, NSUInteger idx, BOOL * _Nonnull stop) {\n            layer.transform = CATransform3DIdentity;\n        }];\n        \n    } else if (dimension == LKS_PerspectiveDimension3D) {\n        CGFloat targetRotation = (self.rotation == 0 ? .6 : self.rotation);\n        [self setRotation:targetRotation animated:YES completion:nil];\n        [self _updateZIndex];\n        \n    } else {\n        NSAssert(NO, @\"\");\n    }\n}\n\n- (void)setRotation:(CGFloat)rotation {\n    _rotation = rotation;\n    CATransform3D transform = CATransform3DIdentity;\n    transform.m34 = - 1 / 3000.0;\n    transform = CATransform3DRotate(transform, rotation, 0, 1, 0);\n    self.rotateLayer.sublayerTransform = transform;\n}\n\n- (void)setRotation:(CGFloat)rotation animated:(BOOL)animated completion:(void (^)(void))completionBlock {\n    [CATransaction begin];\n    [CATransaction setCompletionBlock:completionBlock];\n    [CATransaction setDisableActions:!animated];\n    [self setRotation:rotation];\n    [CATransaction commit];\n}\n\n- (void)_rebuildPreviewLayers {\n    NSArray<LookinDisplayItem *> *validItems = [self.dataSource.flatItems lookin_filter:^BOOL(LookinDisplayItem *obj) {\n        return !obj.inNoPreviewHierarchy;\n    }];\n    self.itemLayers = [self.itemLayers lookin_resizeWithCount:validItems.count add:^LKS_PerspectiveItemLayer *(NSUInteger idx) {\n        LKS_PerspectiveItemLayer *layer = [LKS_PerspectiveItemLayer new];\n        [self.rotateLayer addSublayer:layer];\n        return layer;\n        \n    } remove:^(NSUInteger idx, LKS_PerspectiveItemLayer *layer) {\n        [layer removeFromSuperlayer];\n        \n    } doNext:^(NSUInteger idx, LKS_PerspectiveItemLayer *layer) {\n        LookinDisplayItem *item = validItems[idx];\n        layer.displayItem = item;\n        layer.frame = item.frameToRoot;\n        item.lks_itemLayer = layer;\n        \n        if (item.isSelected) {\n            self.selectedLayer = layer;\n        }\n    }];\n    \n    [self _updateZIndex];\n}\n\n/**\n 重新计算每个 item 的 zIndex，并依 zIndex 设置对应的图层在 z 轴上的 translation。同时根据 fold 等属性来显示或隐藏图层。\n */\n- (void)_updateZIndex {\n    [[self.dataSource.flatItems lookin_filter:^BOOL(LookinDisplayItem *obj) {\n        return !obj.inNoPreviewHierarchy;\n    }] enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [self _updateZIndexForItem:obj];\n    }];\n    \n    [self _updateZTranslationByZIndex];\n}\n\n- (void)_updateZIndexForItem:(LookinDisplayItem *)item {\n    item.previewZIndex = -1;\n    if (item.displayingInHierarchy) {\n        LookinDisplayItem *referenceItem = [self _maxZIndexForOverlappedItemUnderItem:item];\n        if (referenceItem) {\n            // 如果 item 和另一个 itemA 重叠了，则 item.previewZIndex 应该比 itemA.previewZIndex 高一级\n            item.previewZIndex = referenceItem.previewZIndex + 1;\n        } else {\n            item.previewZIndex = 0;\n        }\n        \n    } else {\n        if (item.superItem) {\n            item.previewZIndex = item.superItem.previewZIndex;\n        } else {\n            NSAssert(NO, @\"\");\n        }\n    }\n    \n    if (item.previewZIndex < 0) {\n        NSAssert(NO, @\"\");\n        item.previewZIndex = 0;\n    }\n}\n\n- (void)_updateZTranslationByZIndex {\n    CGFloat interspace = 20;\n    \n    // key 是 zIndex，value 是该 zIndex 下有多少 item，作用是避免下文提到的 offsetToAvoidOverlapBug\n    NSMutableDictionary<NSNumber *, NSNumber *> *zIndexAndCountDict = [NSMutableDictionary dictionary];\n    \n    __block NSUInteger maxZIndex = 0;\n    [self.itemLayers enumerateObjectsUsingBlock:^(LKS_PerspectiveItemLayer * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        maxZIndex = MAX(maxZIndex, obj.displayItem.previewZIndex);\n    }];\n    [self.itemLayers enumerateObjectsUsingBlock:^(LKS_PerspectiveItemLayer * _Nonnull layer, NSUInteger idx, BOOL * _Nonnull stop) {\n        LookinDisplayItem *item = layer.displayItem;\n        // 将 \"1, 2, 3, 4, 5 ...\" 这样的 zIndex 排序调整为 “-2，-1，0，1，2 ...”，这样旋转时 Y 轴就会位于 zIndex 为中间值的那个 layer 的位置\n        NSInteger adjustedZIndex = item.previewZIndex - round(maxZIndex / 2.0);\n        \n        NSUInteger countOfCurrentZIndex = [[zIndexAndCountDict objectForKey:@(adjustedZIndex)] unsignedIntegerValue];\n        countOfCurrentZIndex++;\n        [zIndexAndCountDict setObject:@(countOfCurrentZIndex) forKey:@(adjustedZIndex)];\n        \n        /// 当两个重叠的 layer 在 z 轴上具有相同的 translate 时，理论上更远离用户的那个 layer 应该被遮住，但不知道为什么某些旋转角度下会出现不合理论的情况，感觉是系统 bug，因此这里把更靠近用户的那个 layer 的 translate 增大一丁点，避免两个 layer 有完全相同的 translate 从而避免这个 bug\n        CGFloat offsetToAvoidOverlapBug = countOfCurrentZIndex * 0.01;\n        \n        layer.transform = CATransform3DTranslate(CATransform3DIdentity, 0, 0, interspace * adjustedZIndex + offsetToAvoidOverlapBug);\n    }];\n}\n\n/**\n 传入 itemA，返回另一个 itemB，itemB 满足以下条件：\n - itemB 在 preview 中可见\n - itemB 的层级比 itemA 要低（即 itemB 在 flatItems 里的 index 要比 itemA 小）\n - itemB 和 itemA 的 frameToRoot 有重叠，即视觉上它们是彼此遮挡的\n - itemB 是满足以上两个条件中的所有 items 里的 zIndex 值最高的\n \n @note 如果没有找到任何符合条件的 itemB，则返回 nil\n */\n- (LookinDisplayItem *)_maxZIndexForOverlappedItemUnderItem:(LookinDisplayItem *)item {\n    NSArray<LookinDisplayItem *> *flatItems = [self.dataSource.flatItems lookin_filter:^BOOL(LookinDisplayItem *obj) {\n        return !obj.inNoPreviewHierarchy;\n    }];\n    NSUInteger itemIndex = [flatItems indexOfObject:item];\n    if (itemIndex == 0) {\n        return nil;\n    }\n    if (itemIndex == NSNotFound) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    NSIndexSet *indexesBelow = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, itemIndex)];\n    __block LookinDisplayItem *targetItem = nil;\n    [flatItems enumerateObjectsAtIndexes:indexesBelow options:NSEnumerationReverse usingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (!obj.inHiddenHierarchy) {\n            if (CGRectIntersectsRect(item.frameToRoot, obj.frameToRoot)) {\n                if (!targetItem) {\n                    targetItem = obj;\n                } else {\n                    if (obj.previewZIndex > targetItem.previewZIndex) {\n                        targetItem = obj;\n                    }\n                }\n            }\n        }\n    }];\n    return targetItem;\n}\n\n#pragma mark - <LKS_PerspectiveDataSourceDelegate>\n\n- (void)dataSourceDidChangeSelectedItem:(LKS_PerspectiveDataSource *)dataSource {\n    [self.selectedLayer reRender];\n    \n    LookinDisplayItem *item = dataSource.selectedItem;\n    [item.lks_itemLayer reRender];\n    self.selectedLayer = item.lks_itemLayer;\n}\n\n- (void)dataSourceDidChangeDisplayItems:(LKS_PerspectiveDataSource *)dataSource {\n    [self _updateZIndex];\n    [self.itemLayers enumerateObjectsUsingBlock:^(LKS_PerspectiveItemLayer * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [obj reRender];\n    }];\n}\n\n- (void)dataSourceDidChangeNoPreview:(LKS_PerspectiveDataSource *)dataSource {\n    [self _rebuildPreviewLayers];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveManager.h",
    "content": "//\n//  LKS_PerspectiveManager.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDefines.h\"\n\n@interface LKS_PerspectiveContainerWindow : UIWindow\n\n@end\n\n@interface LKS_PerspectiveManager : NSObject\n\n+ (instancetype)sharedInstance;\n\n- (void)showWithIncludedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveManager.m",
    "content": "//\n//  LKS_PerspectiveManager.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n#import \"LKS_PerspectiveManager.h\"\n\n\n\n#import \"LKS_PerspectiveViewController.h\"\n#import \"UIViewController+LookinServer.h\"\n#import \"LookinHierarchyInfo.h\"\n#import \"LookinServerDefines.h\"\n#import \"LKS_PerspectiveToolbarButtons.h\"\n\n@interface LKS_PerspectiveLoadingMaskView : UIView\n\n@property(nonatomic, strong) UIView *tipsView;\n@property(nonatomic, strong) UILabel *firstLabel;\n@property(nonatomic, strong) UILabel *secondLabel;\n\n@end\n\n@implementation LKS_PerspectiveLoadingMaskView\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if (self = [super initWithFrame:frame]) {\n        self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.35];\n        self.layer.lks_isLookinPrivateLayer = YES;\n        self.layer.lks_avoidCapturing = YES;\n        \n        self.tipsView = [UIView new];\n        self.tipsView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.88];\n        self.tipsView.layer.cornerRadius = 6;\n        self.tipsView.layer.masksToBounds = YES;\n        [self addSubview:self.tipsView];\n        \n        self.firstLabel = [UILabel new];\n        self.firstLabel.text = LKS_Localized(@\"Building…\");\n        self.firstLabel.textColor = [UIColor whiteColor];\n        self.firstLabel.font = [UIFont boldSystemFontOfSize:14];\n        self.firstLabel.textAlignment = NSTextAlignmentCenter;\n        [self.tipsView addSubview:self.firstLabel];\n        \n        self.secondLabel = [UILabel new];\n        self.secondLabel.numberOfLines = 0;\n        self.secondLabel.textAlignment = NSTextAlignmentCenter;\n        self.secondLabel.text =  LKS_Localized(@\"May take 8 or more seconds according to the UI complexity.\");\n        self.secondLabel.textColor = [UIColor colorWithRed:173/255.0 green:180/255.0 blue:190/255.0 alpha:1];\n        self.secondLabel.font = [UIFont systemFontOfSize:12];\n        self.secondLabel.textAlignment = NSTextAlignmentLeft;\n        [self.tipsView addSubview:self.secondLabel];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    \n    UIEdgeInsets insets = UIEdgeInsetsMake(8, 10, 8, 10);\n    CGFloat maxLabelWidth = self.bounds.size.width * .8 - insets.left - insets.right;\n    \n    CGSize firstSize = [self.firstLabel sizeThatFits:CGSizeMake(maxLabelWidth, CGFLOAT_MAX)];\n    CGSize secondSize = [self.secondLabel sizeThatFits:CGSizeMake(maxLabelWidth, CGFLOAT_MAX)];\n    \n    CGFloat tipsWidth = MAX(firstSize.width, secondSize.width) + insets.left + insets.right;\n    \n    self.firstLabel.frame = CGRectMake(tipsWidth / 2.0 - firstSize.width / 2.0, insets.top, firstSize.width, firstSize.height);\n    self.secondLabel.frame = CGRectMake(tipsWidth / 2.0 - secondSize.width / 2.0, CGRectGetMaxY(self.firstLabel.frame) + 7, secondSize.width, secondSize.height);\n    \n    self.tipsView.frame = ({\n        CGFloat height = CGRectGetMaxY(self.secondLabel.frame) + insets.bottom;\n        CGRectMake(self.bounds.size.width / 2.0 - tipsWidth / 2.0, self.bounds.size.height / 2.0 - height / 2.0, tipsWidth, height);\n    });\n}\n\n@end\n\n@implementation LKS_PerspectiveContainerWindow\n\n@end\n\n@interface LKS_PerspectiveManager ()\n\n@property(nonatomic, strong) LKS_PerspectiveLoadingMaskView *loadingView;\n\n@property(nonatomic, weak) UIWindow *previousKeyWindow;\n\n@property(nonatomic, strong) LKS_PerspectiveContainerWindow *contentWindow;\n\n@property(nonatomic, strong) LKS_PerspectiveViewController *viewController;\n\n@end\n\n@implementation LKS_PerspectiveManager\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static LKS_PerspectiveManager *instance = nil;\n    dispatch_once(&onceToken,^{\n        instance = [[super allocWithZone:NULL] init];\n    });\n    return instance;\n}\n\n+ (id)allocWithZone:(struct _NSZone *)zone{\n    return [self sharedInstance];\n}\n\n- (void)showWithIncludedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows {\n    UIViewController *visibleVc = [UIViewController lks_visibleViewController];\n    if (!visibleVc) {\n        NSLog(@\"LookinServer - Failed to start inspecting in 3D because we didn't find any visible view controller.\");\n        return;\n    }\n    \n    [[NSNotificationCenter defaultCenter] postNotificationName:@\"Lookin_WillEnter3D\" object:nil];\n    \n    if (!self.loadingView) {\n        self.loadingView = [LKS_PerspectiveLoadingMaskView new];\n    }\n    [visibleVc.view.window addSubview:self.loadingView];\n    self.loadingView.frame = visibleVc.view.window.bounds;\n    \n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        LookinHierarchyInfo *info = [LookinHierarchyInfo perspectiveInfoWithIncludedWindows:includedWindows excludedWindows:excludedWindows];\n        \n        [self.loadingView removeFromSuperview];\n        self.loadingView = nil;\n\n        self.contentWindow = [LKS_PerspectiveContainerWindow new];\n        self.contentWindow.windowLevel = UIWindowLevelAlert - 2;\n        self.contentWindow.backgroundColor = [UIColor clearColor];\n\n        self.viewController = [[LKS_PerspectiveViewController alloc] initWithHierarchyInfo:info];\n        self.contentWindow.rootViewController = self.viewController;\n\n        self.previousKeyWindow = [UIApplication sharedApplication].keyWindow;\n        [self.contentWindow makeKeyAndVisible];\n\n        [self.viewController.closeButton addTarget:self action:@selector(_exit) forControlEvents:UIControlEventTouchUpInside];\n    });\n}\n\n- (void)_exit {\n    if (!self.contentWindow) {\n        return;\n    }\n    \n    if ([[UIApplication sharedApplication] keyWindow] == self.contentWindow) {\n        if (self.previousKeyWindow.hidden) {\n            [[UIApplication sharedApplication].delegate.window makeKeyWindow];\n        } else {\n            [self.previousKeyWindow makeKeyWindow];\n        }\n    }\n    self.contentWindow.hidden = YES;\n    self.contentWindow = nil;\n    self.viewController = nil;\n    self.previousKeyWindow = nil;\n    \n    [[NSNotificationCenter defaultCenter] postNotificationName:@\"Lookin_DidExit3D\" object:nil];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveToolbarButtons.h",
    "content": "//\n//  LKS_PerspectiveToolbarButtons.h\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/12/20.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n\n\n#import <UIKit/UIKit.h>\n\n@interface LKS_PerspectiveToolbarCloseButton : UIButton\n\n@end\n\n@interface LKS_PerspectiveToolbarDimensionButtonsView : UIView\n\n@property(nonatomic, strong, readonly) UIButton *button2D;\n@property(nonatomic, strong, readonly) UIButton *button3D;\n\n@end\n\n@interface LKS_PerspectiveToolbarLayoutButtonsView : UIView\n\n@property(nonatomic, strong, readonly) UIButton *verticalLayoutButton;\n@property(nonatomic, strong, readonly) UIButton *horizontalLayoutButton;\n\n@end\n\n@interface LKS_PerspectiveToolbarPropertyButton : UIButton\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveToolbarButtons.m",
    "content": "//\n//  LKS_PerspectiveToolbarButtons.m\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/12/20.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n#import \"LKS_PerspectiveToolbarButtons.h\"\n\n\n\nstatic CGFloat const kConerRadius = 6;\n\n@implementation LKS_PerspectiveToolbarCloseButton\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if (self = [super initWithFrame:frame]) {\n        [self setImage:[self _image] forState:UIControlStateNormal];\n        self.backgroundColor = [UIColor blackColor];\n        self.layer.cornerRadius = kConerRadius;\n    }\n    return self;\n}\n\n- (UIImage *)_image {\n    CGFloat width = 13;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, width), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    UIBezierPath *path = [UIBezierPath bezierPath];\n    [path moveToPoint:CGPointMake(0, 0)];\n    [path addLineToPoint:CGPointMake(width, width)];\n    [path moveToPoint:CGPointMake(width, 0)];\n    [path addLineToPoint:CGPointMake(0, width)];\n    \n    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path setLineWidth:1];\n    [path stroke];\n    \n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n@end\n\n@implementation LKS_PerspectiveToolbarDimensionButtonsView\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if (self = [super initWithFrame:frame]) {\n        self.backgroundColor = [UIColor blackColor];\n        self.layer.cornerRadius = kConerRadius;\n        self.clipsToBounds = YES;\n\n        _button2D = [UIButton new];\n        [self.button2D setImage:[self _image2D] forState:UIControlStateNormal];\n        [self addSubview:self.button2D];\n\n        _button3D = [UIButton new];\n        [self.button3D setImage:[self _image3D] forState:UIControlStateNormal];\n        [self addSubview:self.button3D];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    CGFloat halfWidth = self.bounds.size.width / 2.0;\n    CGFloat height = self.bounds.size.height;\n    self.button2D.frame = CGRectMake(0, 0, halfWidth, height);\n    self.button3D.frame = CGRectMake(halfWidth, 0, halfWidth, height);\n}\n\n- (UIImage *)_image2D {\n    CGFloat width = 16;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, width), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    UIBezierPath *path = [UIBezierPath bezierPath];\n    [path moveToPoint:CGPointMake(1, 1)];\n    [path addLineToPoint:CGPointMake(width - 1, 1)];\n    [path addLineToPoint:CGPointMake(width - 1, width - 1)];\n    [path addLineToPoint:CGPointMake(1, width - 1)];\n    [path closePath];\n    \n    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path setLineWidth:1];\n    [path stroke];\n    \n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n- (UIImage *)_image3D {\n    CGFloat width = 16;\n    CGFloat height = 18;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    UIBezierPath *path = [UIBezierPath bezierPath];\n    [path moveToPoint:CGPointMake(width / 2.0, 1)];\n    [path addLineToPoint:CGPointMake(width - 1, 4)];\n    [path addLineToPoint:CGPointMake(width / 2.0, 7)];\n    [path addLineToPoint:CGPointMake(1, 4)];\n    [path closePath];\n    \n    [path moveToPoint:CGPointMake(1, 4)];\n    [path addLineToPoint:CGPointMake(1, height - 4)];\n    [path addLineToPoint:CGPointMake(width / 2.0, height - 1)];\n    [path addLineToPoint:CGPointMake(width - 1, height - 4)];\n    [path addLineToPoint:CGPointMake(width - 1, 4)];\n    \n    [path moveToPoint:CGPointMake(width / 2.0, 7)];\n    [path addLineToPoint:CGPointMake(width / 2.0, height - 1)];\n    \n    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path setLineWidth:1];\n    [path stroke];\n    \n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n@end\n\n@implementation LKS_PerspectiveToolbarLayoutButtonsView\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if (self = [super initWithFrame:frame]) {\n        self.backgroundColor = [UIColor blackColor];\n        self.layer.cornerRadius = kConerRadius;\n        self.clipsToBounds = YES;\n        \n        _verticalLayoutButton = [UIButton new];\n        [self.verticalLayoutButton setImage:[self _imageVertical] forState:UIControlStateNormal];\n        [self addSubview:self.verticalLayoutButton];\n        \n        _horizontalLayoutButton = [UIButton new];\n        [self.horizontalLayoutButton setImage:[self _imageHorizontal] forState:UIControlStateNormal];\n        [self addSubview:self.horizontalLayoutButton];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    CGFloat halfWidth = self.bounds.size.width / 2.0;\n    CGFloat height = self.bounds.size.height;\n    self.verticalLayoutButton.frame = CGRectMake(0, 0, halfWidth, height);\n    self.horizontalLayoutButton.frame = CGRectMake(halfWidth, 0, halfWidth, height);\n}\n\n- (UIImage *)_imageHorizontal {\n    CGFloat width = 19;\n    CGFloat height = 17;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    CGRect outRect = CGRectMake(1, 1, width - 2, height - 2);\n    UIBezierPath *path = [UIBezierPath bezierPathWithRect:outRect];\n    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path setLineWidth:1];\n    [path stroke];\n\n    path = [UIBezierPath bezierPathWithRect:CGRectMake(CGRectGetMinX(outRect) + 3, CGRectGetMinY(outRect) + 3, 2, CGRectGetHeight(outRect) - 6)];\n    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path fill];\n\n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n- (UIImage *)_imageVertical {\n    CGFloat width = 19;\n    CGFloat height = 17;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    CGRect outRect = CGRectMake(1, 1, width - 2, height - 2);\n    UIBezierPath *path = [UIBezierPath bezierPathWithRect:outRect];\n    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path setLineWidth:1];\n    [path stroke];\n    \n    path = [UIBezierPath bezierPathWithRect:CGRectMake(CGRectGetMinX(outRect) + 3, CGRectGetMaxY(outRect) - 5, CGRectGetWidth(outRect) - 6, 2)];\n    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path fill];\n    \n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n@end\n\n@implementation LKS_PerspectiveToolbarPropertyButton\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if (self = [super initWithFrame:frame]) {\n        [self setImage:[self _image] forState:UIControlStateNormal];\n        self.backgroundColor = [UIColor blackColor];\n        self.layer.cornerRadius = kConerRadius;\n    }\n    return self;\n}\n\n- (UIImage *)_image {\n    CGFloat width = 20;\n    \n    UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, width), NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    \n    CGFloat ovalRadius = 3;\n    UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(width / 2.0 - ovalRadius / 2.0, 4, ovalRadius, ovalRadius)];\n    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path fill];\n  \n    path = [UIBezierPath bezierPath];\n    [path moveToPoint:CGPointMake(width / 2.0, 9)];\n    [path addLineToPoint:CGPointMake(width / 2.0, width - 4)];\n    [path setLineWidth:2];\n    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n    [path stroke];\n    \n    path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(1, 1, width - 2, width - 2)];\n    [path setLineWidth:1];\n    [path stroke];\n    \n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveViewController.h",
    "content": "//\n//  LKS_PerspectiveViewController.h\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n\n\n#import <UIKit/UIKit.h>\n\n@class LookinHierarchyInfo, LKS_PerspectiveToolbarCloseButton;\n\n@interface LKS_PerspectiveViewController : UIViewController\n\n- (instancetype)initWithHierarchyInfo:(LookinHierarchyInfo *)info;\n\n@property(nonatomic, strong, readonly) LKS_PerspectiveToolbarCloseButton *closeButton;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Server/Perspective/LKS_PerspectiveViewController.m",
    "content": "//\n//  LKS_PerspectiveViewController.m\n//  LookinServer\n//\n//  Created by Li Kai on 2019/5/17.\n//  https://lookin.work\n//\n\n#import \"LKS_PerspectiveViewController.h\"\n\n\n\n#import \"LKS_PerspectiveDataSource.h\"\n#import \"LKS_PerspectiveLayer.h\"\n#import \"LKS_PerspectiveHierarchyView.h\"\n#import \"LKS_PerspectiveToolbarButtons.h\"\n#import \"LKS_PerspectiveItemLayer.h\"\n\n#import \"LookinServerDefines.h\"\n\ntypedef NS_ENUM(NSUInteger, LKS_PerspectiveLayout) {\n    LKS_PerspectiveLayoutFullScreen,\n    LKS_PerspectiveLayoutHorizontal,\n    LKS_PerspectiveLayoutVertical\n};\n\n@interface LKS_PerspectiveViewController () <UIGestureRecognizerDelegate>\n\n@property(nonatomic, strong) LKS_PerspectiveLayer *previewLayer;\n@property(nonatomic, strong) LKS_PerspectiveHierarchyView *hierarchyView;\n@property(nonatomic, strong) LKS_PerspectiveToolbarDimensionButtonsView *dimensionButtonsView;\n@property(nonatomic, strong) LKS_PerspectiveToolbarLayoutButtonsView *layoutButtonsView;\n@property(nonatomic, strong) LKS_PerspectiveToolbarPropertyButton *propertyButton;\n\n@property(nonatomic, strong) LKS_PerspectiveDataSource *dataSource;\n\n@property(nonatomic, assign) LKS_PerspectiveLayout layoutType;\n\n@property(nonatomic, strong) UITapGestureRecognizer *tapGestureRecognizer;\n@property(nonatomic, strong) UIPanGestureRecognizer *rotationGestureRecognizer;\n@property(nonatomic, strong) UIPanGestureRecognizer *hierarchyDragGestureRecognizer;\n@property(nonatomic, strong) UIPanGestureRecognizer *twoFingersGestureRecognizer;\n\n/**\n 当 layout 为 horizontal 时，该值表示 hierarchyView 最右侧的位置。\n 当 layout 为 vertical 时，该值表示 hierarchyView 的最顶部的位置。\n 当 layout 为 fullscreen 时，该值无意义\n */\n@property(nonatomic, assign) CGFloat previewAndHierarchySepPosition;\n\n@property(nonatomic, assign) CGFloat scale;\n@property(nonatomic, assign) CGPoint translation;\n\n@end\n\n@implementation LKS_PerspectiveViewController {\n    UIColor *_selectedButtonColor;\n}\n\n- (instancetype)initWithHierarchyInfo:(LookinHierarchyInfo *)info {\n    if (self = [self initWithNibName:nil bundle:nil]) {\n        self.dataSource = [[LKS_PerspectiveDataSource alloc] initWithHierarchyInfo:info];\n    }\n    return self;\n}\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    \n    _selectedButtonColor = LookinColorMake(59, 130, 183);\n    \n    self.view.backgroundColor = LookinColorMake(31, 32, 34);\n    \n    self.previewLayer = [[LKS_PerspectiveLayer alloc] initWithDataSource:self.dataSource];\n    [self.view.layer addSublayer:self.previewLayer];\n    \n    self.hierarchyView = [[LKS_PerspectiveHierarchyView alloc] initWithDataSource:self.dataSource];\n    [self.view addSubview:self.hierarchyView];\n    \n    _closeButton = [LKS_PerspectiveToolbarCloseButton new];\n    [self.view addSubview:self.closeButton];\n    \n    self.dimensionButtonsView = [LKS_PerspectiveToolbarDimensionButtonsView new];\n    [self.dimensionButtonsView.button2D addTarget:self action:@selector(_handle2D) forControlEvents:UIControlEventTouchUpInside];\n    [self.dimensionButtonsView.button3D addTarget:self action:@selector(_handle3D) forControlEvents:UIControlEventTouchUpInside];\n    [self.view addSubview:self.dimensionButtonsView];\n    \n    self.layoutButtonsView = [LKS_PerspectiveToolbarLayoutButtonsView new];\n    [self.layoutButtonsView.verticalLayoutButton addTarget:self action:@selector(_handleVerticalLayout) forControlEvents:UIControlEventTouchUpInside];\n    [self.layoutButtonsView.horizontalLayoutButton addTarget:self action:@selector(_handleHorizontalLayout) forControlEvents:UIControlEventTouchUpInside];\n    [self.view addSubview:self.layoutButtonsView];\n    \n    self.propertyButton = [LKS_PerspectiveToolbarPropertyButton new];\n//    [self.view addSubview:self.propertyButton];\n    \n    self.tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTapGesture:)];\n    self.tapGestureRecognizer.delegate = self;\n    [self.view addGestureRecognizer:self.tapGestureRecognizer];\n    \n    self.hierarchyDragGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_handleHierarchyDragGestureRecognizer:)];\n#if TARGET_OS_TV\n#else\n    self.hierarchyDragGestureRecognizer.maximumNumberOfTouches = 1;\n#endif\n    self.hierarchyDragGestureRecognizer.delegate = self;\n    [self.view addGestureRecognizer:self.hierarchyDragGestureRecognizer];\n    \n    self.rotationGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_handleRotationGestureRecognizer:)];\n#if TARGET_OS_TV\n#else\n    self.rotationGestureRecognizer.maximumNumberOfTouches = 1;\n#endif\n    self.rotationGestureRecognizer.delegate = self;\n    [self.rotationGestureRecognizer requireGestureRecognizerToFail:self.hierarchyDragGestureRecognizer];\n    [self.view addGestureRecognizer:self.rotationGestureRecognizer];\n    \n    self.twoFingersGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTwoFingersGestureRecognizer:)];\n#if TARGET_OS_TV\n#else\n    self.twoFingersGestureRecognizer.minimumNumberOfTouches = 2;\n    self.twoFingersGestureRecognizer.maximumNumberOfTouches = 2;\n#endif\n    [self.view addGestureRecognizer:self.twoFingersGestureRecognizer];\n    \n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        [self _startEnterAnim];\n    });\n}\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n    self.previewLayer.bounds = [UIScreen mainScreen].bounds;\n    self.previewLayer.anchorPoint = CGPointMake(.5, .5);\n    self.previewLayer.position = CGPointMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0);\n    \n    CGFloat buttonHeight = 30;\n    CGFloat y = 20;\n    if (@available(iOS 11, tvOS 11.0, *)) {\n        y = MAX(self.view.safeAreaInsets.top, 20);\n    }\n    \n    self.closeButton.frame = ({\n        CGFloat x = 20;\n        if (@available(iOS 11, tvOS 11.0, *)) {\n            x = MAX(self.view.safeAreaInsets.left, 20);\n        }\n        CGRectMake(x, y, buttonHeight, buttonHeight);\n    });\n    \n    CGFloat buttonGroupWidth = 70;\n    self.layoutButtonsView.frame = ({\n        CGFloat right = 20;\n        if (@available(iOS 11, tvOS 11.0, *)) {\n            right = MAX(self.view.safeAreaInsets.right, 20);\n        }\n        CGRectMake(self.view.bounds.size.width - right - buttonGroupWidth, y, buttonGroupWidth, buttonHeight);\n    });\n    self.dimensionButtonsView.frame = CGRectMake(CGRectGetMinX(self.layoutButtonsView.frame) - 15 - buttonGroupWidth, CGRectGetMinY(self.layoutButtonsView.frame), buttonGroupWidth, buttonHeight);\n//    self.propertyButton.frame = CGRectMake(CGRectGetMinX(self.layoutButtonsView.frame) + 15, y, buttonHeight, buttonHeight);\n    \n    if (self.layoutType == LKS_PerspectiveLayoutFullScreen) {\n        // preview 全屏\n        self.hierarchyView.frame = CGRectZero;\n        \n    } else if (self.layoutType == LKS_PerspectiveLayoutVertical) {\n        // 上下布局\n        CGFloat width = self.view.bounds.size.width;\n        self.hierarchyView.frame = CGRectMake(0, self.previewAndHierarchySepPosition, width, self.view.bounds.size.height - self.previewAndHierarchySepPosition);\n        \n    } else if (self.layoutType == LKS_PerspectiveLayoutHorizontal) {\n        // 左右布局\n        CGFloat height = self.view.bounds.size.height;\n        self.hierarchyView.frame = CGRectMake(0, 0, self.previewAndHierarchySepPosition, height);\n        \n    } else {\n        NSAssert(NO, @\"\");\n    }\n}\n\n#pragma mark - Event Handler\n\n- (void)_handleTapGesture:(UITapGestureRecognizer *)recognizer {\n    CGPoint point = [recognizer locationInView:self.view];\n    CALayer *layer = [self.view.layer hitTest:point];\n    if ([layer isKindOfClass:[LKS_PerspectiveItemLayer class]]) {\n        LookinDisplayItem *item = ((LKS_PerspectiveItemLayer *)layer).displayItem;\n        if (self.dataSource.selectedItem != item) {\n            self.dataSource.selectedItem = item;\n        }\n    }\n}\n\n- (void)_handleRotationGestureRecognizer:(UIPanGestureRecognizer *)recognizer {\n    if (recognizer.state == UIGestureRecognizerStateBegan) {\n        CGFloat initialRotation = self.previewLayer.rotation;\n        [recognizer lookin_bindDouble:initialRotation forKey:@\"initialRotation\"];\n        \n    } else if (recognizer.state == UIGestureRecognizerStateChanged) {\n        CGFloat rotationVelocity = 0.01;\n        CGFloat gestureRotationOffset = [recognizer translationInView:self.view].x * rotationVelocity;\n        CGFloat initialRotation = [recognizer lookin_getBindDoubleForKey:@\"initialRotation\"];\n        CGFloat currentRotation = initialRotation + gestureRotationOffset;\n        [self.previewLayer setRotation:currentRotation animated:NO completion:nil];\n    }\n}\n\n- (void)_handleHierarchyDragGestureRecognizer:(UIPanGestureRecognizer *)recognizer {\n    if (recognizer.state == UIGestureRecognizerStateBegan) {\n        if (self.layoutType == LKS_PerspectiveLayoutFullScreen) {\n            self.layoutType = LKS_PerspectiveLayoutVertical;\n//            self.layoutButtonsView.verticalLayoutButton.selected = YES;\n            self.previewAndHierarchySepPosition = self.view.bounds.size.height;\n        }\n        [self.hierarchyView lookin_bindDouble:self.previewAndHierarchySepPosition forKey:@\"initialSepPosition\"];\n        \n    } else if (recognizer.state == UIGestureRecognizerStateChanged) {\n        CGFloat initialSepPosition = [self.hierarchyView lookin_getBindDoubleForKey:@\"initialSepPosition\"];\n        if (self.layoutType == LKS_PerspectiveLayoutHorizontal) {\n            CGFloat translationX = [recognizer translationInView:self.view].x;\n            CGFloat maxSepPosition = self.view.bounds.size.width * .7;\n            self.previewAndHierarchySepPosition = MIN(MAX(initialSepPosition + translationX, 0), maxSepPosition);\n            \n        } else {\n            CGFloat translationY = [recognizer translationInView:self.view].y;\n            CGFloat minSepPosition = self.view.bounds.size.height * .3;\n            self.previewAndHierarchySepPosition = MAX(MIN(initialSepPosition + translationY, self.view.bounds.size.height), minSepPosition);\n        }\n        [self.view setNeedsLayout];\n        \n    } else {\n        if (self.layoutType == LKS_PerspectiveLayoutHorizontal) {\n            CGFloat minXToHideHierarchy = 100;\n            if (self.previewAndHierarchySepPosition <= minXToHideHierarchy) {\n                self.previewAndHierarchySepPosition = 0;\n//                self.layoutButtonsView.horizontalLayoutButton.selected = NO;\n                [UIView animateWithDuration:.2 animations:^{\n                    [self.view setNeedsLayout];\n                    [self.view layoutIfNeeded];\n                } completion:^(BOOL finished) {\n                    self.layoutType = LKS_PerspectiveLayoutFullScreen;\n                }];\n            }\n            \n        } else if (self.layoutType == LKS_PerspectiveLayoutVertical) {\n            // 当距离屏幕底部的值小于该值时，hierarchy 将自动隐藏\n            CGFloat minBottomToHideHierarchy = 100;\n            if (self.previewAndHierarchySepPosition >= self.view.bounds.size.height - minBottomToHideHierarchy) {\n                self.previewAndHierarchySepPosition = self.view.bounds.size.height;\n//                self.layoutButtonsView.verticalLayoutButton.selected = NO;\n                [UIView animateWithDuration:.2 animations:^{\n                    [self.view setNeedsLayout];\n                    [self.view layoutIfNeeded];\n                } completion:^(BOOL finished) {\n                    self.layoutType = LKS_PerspectiveLayoutFullScreen;\n                }];\n            }\n        }\n    }\n}\n\n- (void)_handleTwoFingersGestureRecognizer:(UIPanGestureRecognizer *)recognizer {\n    if (recognizer.state == UIGestureRecognizerStateBegan) {\n        if (recognizer.numberOfTouches != 2) {\n            NSAssert(NO, @\"\");\n            return;\n        }\n        CGPoint initialLoc0 = [recognizer locationOfTouch:0 inView:self.view];\n        CGPoint initialLoc1 = [recognizer locationOfTouch:1 inView:self.view];\n        \n        [recognizer lookin_bindPoint:initialLoc0 forKey:@\"initialLoc0\"];\n        [recognizer lookin_bindPoint:initialLoc1 forKey:@\"initialLoc1\"];\n        [recognizer lookin_bindPoint:self.translation forKey:@\"initialTranslation\"];\n        [recognizer lookin_bindDouble:self.scale forKey:@\"initialScale\"];\n        \n    } else if (recognizer.state == UIGestureRecognizerStateChanged) {\n        if ([recognizer numberOfTouches] != 2) {\n            return;\n        }\n        CGPoint initialLoc0 = [recognizer lookin_getBindPointForKey:@\"initialLoc0\"];\n        CGPoint initialLoc1 = [recognizer lookin_getBindPointForKey:@\"initialLoc1\"];\n        CGPoint initialCenter = CGPointMake((initialLoc1.x - initialLoc0.x) / 2.0 + initialLoc0.x, (initialLoc1.y - initialLoc0.y) / 2.0 + initialLoc0.y);\n        \n        CGPoint currentLoc0 = [recognizer locationOfTouch:0 inView:self.view];\n        CGPoint currentLoc1 = [recognizer locationOfTouch:1 inView:self.view];\n        CGPoint currentCenter = CGPointMake((currentLoc1.x - currentLoc0.x) / 2.0 + currentLoc0.x, (currentLoc1.y - currentLoc0.y) / 2.0 + currentLoc0.y);\n        \n        CGPoint initialTranslation = [recognizer lookin_getBindPointForKey:@\"initialTranslation\"];\n        CGPoint translationOffset = CGPointMake(currentCenter.x - initialCenter.x, currentCenter.y - initialCenter.y);\n        [self setTranslation:CGPointMake(initialTranslation.x + translationOffset.x, initialTranslation.y + translationOffset.y) animated:NO];\n        \n        CGFloat initialTouchesDistance = hypot(ABS(initialLoc1.x - initialLoc0.x), ABS(initialLoc1.y - initialLoc0.y));\n        CGFloat currentTouchesDistance = hypot(ABS(currentLoc1.x - currentLoc0.x), ABS(currentLoc1.y - currentLoc0.y));\n        CGFloat initialScale = [recognizer lookin_getBindDoubleForKey:@\"initialScale\"];\n        CGFloat currentScale = initialScale * (currentTouchesDistance / MAX(initialTouchesDistance, 1));\n        [self setScale:currentScale animated:NO];\n    } else {\n        [recognizer lookin_clearBindForKey:@\"initialLoc0\"];\n        [recognizer lookin_clearBindForKey:@\"initialLoc1\"];\n    }\n}\n\n- (void)_handle2D { \n    [self.dimensionButtonsView.button2D setBackgroundColor:_selectedButtonColor];\n    [self.dimensionButtonsView.button3D setBackgroundColor:nil];\n    self.previewLayer.dimension = LKS_PerspectiveDimension2D;\n}\n\n- (void)_handle3D {\n    [self.dimensionButtonsView.button2D setBackgroundColor:nil];\n    [self.dimensionButtonsView.button3D setBackgroundColor:_selectedButtonColor];\n    self.previewLayer.dimension = LKS_PerspectiveDimension3D;\n}\n\n- (void)_handleVerticalLayout {\n    if (self.layoutType == LKS_PerspectiveLayoutVertical) {\n        return;\n    }\n    self.layoutType = LKS_PerspectiveLayoutVertical;\n    self.previewAndHierarchySepPosition = self.view.bounds.size.height - 300;\n    [self.view setNeedsLayout];\n}\n\n- (void)_handleHorizontalLayout {\n    if (self.layoutType == LKS_PerspectiveLayoutHorizontal) {\n        return;\n    }\n    self.layoutType = LKS_PerspectiveLayoutHorizontal;\n    self.previewAndHierarchySepPosition = 200;\n    [self.view setNeedsLayout];\n}\n\n- (void)setLayoutType:(LKS_PerspectiveLayout)layoutType {\n    _layoutType = layoutType;\n    if (layoutType == LKS_PerspectiveLayoutHorizontal) {\n        self.hierarchyView.isHorizontalLayout = YES;\n    } else {\n        self.hierarchyView.isHorizontalLayout = NO;\n    }\n    \n    [self.layoutButtonsView.verticalLayoutButton setBackgroundColor:nil];\n    [self.layoutButtonsView.horizontalLayoutButton setBackgroundColor:nil];\n    if (layoutType == LKS_PerspectiveLayoutHorizontal) {\n        [self.layoutButtonsView.horizontalLayoutButton setBackgroundColor:_selectedButtonColor];\n    } else if (layoutType == LKS_PerspectiveLayoutVertical) {\n        [self.layoutButtonsView.verticalLayoutButton setBackgroundColor:_selectedButtonColor];\n    }\n}\n\n#pragma mark - <UIGestureRecognizerDelegate>\n\n- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {\n    if (gestureRecognizer == self.rotationGestureRecognizer) {\n        BOOL canRotate = (self.previewLayer.dimension == LKS_PerspectiveDimension3D);\n        return canRotate;\n\n    } else if (gestureRecognizer == self.hierarchyDragGestureRecognizer) {\n        if (self.layoutType == LKS_PerspectiveLayoutHorizontal) {\n            CGFloat touchX = [touch locationInView:self.view].x;\n            if (touchX > self.previewAndHierarchySepPosition) {\n                return NO;\n            }\n        } else if (self.layoutType == LKS_PerspectiveLayoutVertical) {\n            CGFloat touchY = [touch locationInView:self.view].y;\n            if (touchY < self.previewAndHierarchySepPosition) {\n                return NO;\n            }\n        }\n    }\n    return YES;\n}\n\n- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {\n    if (gestureRecognizer == self.hierarchyDragGestureRecognizer) {\n        if (self.layoutType == LKS_PerspectiveLayoutFullScreen) {\n            CGPoint translation = [self.hierarchyDragGestureRecognizer translationInView:self.view];\n            if (ABS(translation.x) >= 1) {\n                return NO;\n            }\n        }\n    \n    } else if (gestureRecognizer == self.twoFingersGestureRecognizer) {\n        if (gestureRecognizer.numberOfTouches != 2) {\n            return NO;\n        }\n    \n    } else if (gestureRecognizer == self.tapGestureRecognizer) {\n        CGPoint location = [self.tapGestureRecognizer locationInView:self.view];\n        if (CGRectContainsPoint(self.hierarchyView.frame, location)) {\n            return NO;\n        }\n    }\n    \n    return YES;\n}\n\n#pragma mark - Others\n\n- (void)_startEnterAnim {\n    [self _handle3D];\n    [self.previewLayer setRotation:0 animated:NO completion:nil];\n    self.closeButton.alpha = 0;\n    self.dimensionButtonsView.alpha = 0;\n    self.layoutButtonsView.alpha = 0;\n    \n#if TARGET_OS_TV\n    BOOL isLandScape = YES;\n#else\n    BOOL isLandScape = UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]);\n#endif\n    if (isLandScape) {\n        self.layoutType = LKS_PerspectiveLayoutHorizontal;\n        self.previewAndHierarchySepPosition = 0;\n    } else {\n        self.layoutType = LKS_PerspectiveLayoutVertical;\n        self.previewAndHierarchySepPosition = self.view.bounds.size.height;\n    }\n    [self.view setNeedsLayout];\n    [self.view layoutIfNeeded];\n    \n    [self setScale:.6 animated:YES];\n    [self setTranslation:CGPointMake(0, -60) animated:YES];\n    [UIView animateWithDuration:.25 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{\n        self.closeButton.alpha = 1;\n        self.dimensionButtonsView.alpha = 1;\n        self.layoutButtonsView.alpha = 1;\n\n        if (isLandScape) {\n            self.previewAndHierarchySepPosition = 200;\n        } else {\n            self.previewAndHierarchySepPosition = self.view.bounds.size.height - 130;\n        }\n\n        [self.view setNeedsLayout];\n        [self.view layoutIfNeeded];\n    } completion:^(BOOL finished) {\n        [self.previewLayer setRotation:.5 animated:YES completion:nil];\n    }];\n}\n\n- (void)setScale:(CGFloat)scale animated:(BOOL)animated {\n    _scale = scale;\n    [self _updateTransformAnimated:animated];\n}\n\n- (void)setTranslation:(CGPoint)translation animated:(BOOL)animated {\n    _translation = translation;\n    [self _updateTransformAnimated:animated];\n}\n\n- (void)_updateTransformAnimated:(BOOL)animated {\n    CATransform3D transform = CATransform3DTranslate(CATransform3DIdentity, self.translation.x, self.translation.y, 0);\n    transform = CATransform3DScale(transform, self.scale, self.scale, 1);\n    \n    [CATransaction begin];\n    [CATransaction setDisableActions:!animated];\n    self.previewLayer.transform = transform;\n    [CATransaction commit];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/CALayer+Lookin.h",
    "content": "//\n//  CALayer+Lookin.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/8/4.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n\n\n#import <QuartzCore/QuartzCore.h>\n\n@interface CALayer (Lookin)\n\n- (void)lookin_removeImplicitAnimations;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/CALayer+Lookin.m",
    "content": "//\n//  CALayer+Lookin.m\n//  Lookin\n//\n//  Created by Li Kai on 2018/8/4.\n//  https://lookin.work\n//\n\n\n\n#import \"CALayer+Lookin.h\"\n\n@implementation CALayer (Lookin)\n\n- (void)lookin_removeImplicitAnimations {\n    NSMutableDictionary<NSString *, id<CAAction>> *actions = @{NSStringFromSelector(@selector(bounds)): [NSNull null],\n                                                               NSStringFromSelector(@selector(position)): [NSNull null],\n                                                               NSStringFromSelector(@selector(zPosition)): [NSNull null],\n                                                               NSStringFromSelector(@selector(anchorPoint)): [NSNull null],\n                                                               NSStringFromSelector(@selector(anchorPointZ)): [NSNull null],\n                                                               NSStringFromSelector(@selector(transform)): [NSNull null],\n                                                               NSStringFromSelector(@selector(sublayerTransform)): [NSNull null],\n                                                               NSStringFromSelector(@selector(masksToBounds)): [NSNull null],\n                                                               NSStringFromSelector(@selector(contents)): [NSNull null],\n                                                               NSStringFromSelector(@selector(contentsRect)): [NSNull null],\n                                                               NSStringFromSelector(@selector(contentsScale)): [NSNull null],\n                                                               NSStringFromSelector(@selector(contentsCenter)): [NSNull null],\n                                                               NSStringFromSelector(@selector(minificationFilterBias)): [NSNull null],\n                                                               NSStringFromSelector(@selector(backgroundColor)): [NSNull null],\n                                                               NSStringFromSelector(@selector(cornerRadius)): [NSNull null],\n                                                               NSStringFromSelector(@selector(borderWidth)): [NSNull null],\n                                                               NSStringFromSelector(@selector(borderColor)): [NSNull null],\n                                                               NSStringFromSelector(@selector(opacity)): [NSNull null],\n                                                               NSStringFromSelector(@selector(compositingFilter)): [NSNull null],\n                                                               NSStringFromSelector(@selector(filters)): [NSNull null],\n                                                               NSStringFromSelector(@selector(backgroundFilters)): [NSNull null],\n                                                               NSStringFromSelector(@selector(shouldRasterize)): [NSNull null],\n                                                               NSStringFromSelector(@selector(rasterizationScale)): [NSNull null],\n                                                               NSStringFromSelector(@selector(shadowColor)): [NSNull null],\n                                                               NSStringFromSelector(@selector(shadowOpacity)): [NSNull null],\n                                                               NSStringFromSelector(@selector(shadowOffset)): [NSNull null],\n                                                               NSStringFromSelector(@selector(shadowRadius)): [NSNull null],\n                                                               NSStringFromSelector(@selector(shadowPath)): [NSNull null]}.mutableCopy;\n    \n    if ([self isKindOfClass:[CAShapeLayer class]]) {\n        [actions addEntriesFromDictionary:@{NSStringFromSelector(@selector(path)): [NSNull null],\n                                            NSStringFromSelector(@selector(fillColor)): [NSNull null],\n                                            NSStringFromSelector(@selector(strokeColor)): [NSNull null],\n                                            NSStringFromSelector(@selector(strokeStart)): [NSNull null],\n                                            NSStringFromSelector(@selector(strokeEnd)): [NSNull null],\n                                            NSStringFromSelector(@selector(lineWidth)): [NSNull null],\n                                            NSStringFromSelector(@selector(miterLimit)): [NSNull null],\n                                            NSStringFromSelector(@selector(lineDashPhase)): [NSNull null]}];\n    }\n    \n    if ([self isKindOfClass:[CAGradientLayer class]]) {\n        [actions addEntriesFromDictionary:@{NSStringFromSelector(@selector(colors)): [NSNull null],\n                                            NSStringFromSelector(@selector(locations)): [NSNull null],\n                                            NSStringFromSelector(@selector(startPoint)): [NSNull null],\n                                            NSStringFromSelector(@selector(endPoint)): [NSNull null]}];\n    }\n    \n    self.actions = actions;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSArray+Lookin.h",
    "content": "//\n//  NSArray+Lookin.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/9/3.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n\n\n#import <Foundation/Foundation.h>\n#import <CoreGraphics/CoreGraphics.h>\n\n@interface NSArray<__covariant ValueType> (Lookin)\n\n/**\n 初始化一个新的 NSArray 并返回，新数组的长度为 count，如果当前数组长度比 count 小则会补充新元素（被补充的元素由 addBlock 返回），如果当前数组长度比 count 大则会舍弃多余的元素，被舍弃的元素会作为参数传入 removeBlock。最终，新数组的所有元素均会作为参数被传入 doBlock。\n */\n- (NSArray<ValueType> *)lookin_resizeWithCount:(NSUInteger)count add:(ValueType (^)(NSUInteger idx))addBlock remove:(void (^)(NSUInteger idx, ValueType obj))removeBlock doNext:(void (^)(NSUInteger idx, ValueType obj))doBlock __attribute__((warn_unused_result));\n\n+ (NSArray *)lookin_arrayWithCount:(NSUInteger)count block:(id (^)(NSUInteger idx))block;\n\n/**\n 检查 index 位置是否有元素存在\n */\n- (BOOL)lookin_hasIndex:(NSInteger)index;\n\n- (NSArray *)lookin_map:(id (^)(NSUInteger idx, ValueType value))block;\n\n- (NSArray<ValueType> *)lookin_filter:(BOOL (^)( ValueType obj))block;\n\n- (ValueType)lookin_firstFiltered:(BOOL (^)(ValueType obj))block;\n\n/// 返回最后一个 block 返回 YES 的元素\n- (ValueType)lookin_lastFiltered:(BOOL (^)(ValueType obj))block;\n\n- (id)lookin_reduce:(id (^)(id accumulator, NSUInteger idx, ValueType obj))block;\n\n- (CGFloat)lookin_reduceCGFloat:(CGFloat (^)(CGFloat accumulator, NSUInteger idx, ValueType obj))block initialAccumlator:(CGFloat)initialAccumlator;\n- (NSInteger)lookin_reduceInteger:(NSInteger (^)(NSInteger accumulator, NSUInteger idx, ValueType obj))block initialAccumlator:(NSInteger)initialAccumlator;\n\n- (BOOL)lookin_all:(BOOL (^)(ValueType obj))block;\n\n- (BOOL)lookin_any:(BOOL (^)(ValueType obj))block;\n\n- (NSArray<ValueType> *)lookin_arrayByRemovingObject:(ValueType)obj;\n\n- (NSArray<ValueType> *)lookin_nonredundantArray;\n\n- (ValueType)lookin_safeObjectAtIndex:(NSInteger)idx;\n\n/// 字符串长度从短到长，即 length 小的字符串的 idx 更小\n- (NSArray<ValueType> *)lookin_sortedArrayByStringLength;\n\n@end\n\n@interface NSMutableArray<ValueType> (Lookin)\n\n/**\n 如果当前数组长度比 count 小则会补充新元素（被补充的元素由 addBlock 返回），如果当前数组长度比 count 大则多余的元素会被作为参数传入 notDequeued。然后从 idx 为 0 算起，前 count 个元素会被作为参数传入 doBlock\n */\n- (void)lookin_dequeueWithCount:(NSUInteger)count add:(ValueType (^)(NSUInteger idx))addBlock notDequeued:(void (^)(NSUInteger idx, ValueType obj))notDequeuedBlock doNext:(void (^)(NSUInteger idx, ValueType obj))doBlock;\n\n- (void)lookin_removeObjectsPassingTest:(BOOL (^)(NSUInteger idx, ValueType obj))block;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSArray+Lookin.m",
    "content": "//\n//  NSArray+Lookin.m\n//  Lookin\n//\n//  Created by Li Kai on 2018/9/3.\n//  https://lookin.work\n//\n\n\n\n#import \"NSArray+Lookin.h\"\n\n@implementation NSArray (Lookin)\n\n- (NSArray *)lookin_resizeWithCount:(NSUInteger)count add:(id (^)(NSUInteger idx))addBlock remove:(void (^)(NSUInteger idx, id obj))removeBlock doNext:(void (^)(NSUInteger idx, id obj))doBlock {\n    NSMutableArray *resultArray = [NSMutableArray arrayWithCapacity:count];\n    \n    for (NSUInteger i = 0; i < count; i++) {\n        if (self.count > i) {\n            id obj = [self objectAtIndex:i];\n            [resultArray addObject:obj];\n            if (doBlock) {\n                doBlock(i, obj);\n            }\n        } else {\n            if (addBlock) {\n                id newObj = addBlock(i);\n                if (newObj) {\n                    [resultArray addObject:newObj];\n                    if (doBlock) {\n                        doBlock(i, newObj);\n                    }\n                } else {\n                    NSAssert(NO, @\"\");\n                }\n            } else {\n                NSAssert(NO, @\"\");\n            }\n        }\n    }\n    \n    if (removeBlock) {\n        if (self.count > count) {\n            for (NSUInteger i = count; i < self.count; i++) {\n                id obj = [self objectAtIndex:i];\n                removeBlock(i, obj);\n            }\n        }\n    }\n    \n    return [resultArray copy];\n}\n\n+ (NSArray *)lookin_arrayWithCount:(NSUInteger)count block:(id (^)(NSUInteger idx))block {\n    NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];\n    for (NSUInteger i = 0; i < count; i++) {\n        id obj = block(i);\n        if (obj) {\n            [array addObject:obj];\n        }\n    }\n    return [array copy];\n}\n\n- (BOOL)lookin_hasIndex:(NSInteger)index {\n    if (index == NSNotFound || index < 0) {\n        return NO;\n    }\n    return self.count > index;\n}\n\n- (NSArray *)lookin_map:(id (^)(NSUInteger , id))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:self.count];\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        id newObj = block(idx, obj);\n        if (newObj) {\n            [array addObject:newObj];\n        }\n    }];\n    return [array copy];\n}\n\n- (NSArray *)lookin_filter:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    NSMutableArray *mArray = [NSMutableArray array];\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (block(obj)) {\n            [mArray addObject:obj];\n        }\n    }];\n    return [mArray copy];\n}\n\n- (id)lookin_firstFiltered:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    __block id targetObj = nil;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (block(obj)) {\n            targetObj = obj;\n            *stop = YES;\n        }\n    }];\n    return targetObj;\n}\n\n- (id)lookin_lastFiltered:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    __block id targetObj = nil;\n    [self enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (block(obj)) {\n            targetObj = obj;\n            *stop = YES;\n        }\n    }];\n    return targetObj;\n}\n\n- (id)lookin_reduce:(id (^)(id accumulator, NSUInteger idx, id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    __block id accumulator = nil;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        accumulator = block(accumulator, idx, obj);\n    }];\n    return accumulator;\n}\n\n- (CGFloat)lookin_reduceCGFloat:(CGFloat (^)(CGFloat accumulator, NSUInteger idx, id obj))block initialAccumlator:(CGFloat)initialAccumlator {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return initialAccumlator;\n    }\n    \n    __block CGFloat accumulator = initialAccumlator;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        accumulator = block(accumulator, idx, obj);\n    }];\n    return accumulator;\n}\n\n- (NSInteger)lookin_reduceInteger:(NSInteger (^)(NSInteger, NSUInteger, id))block initialAccumlator:(NSInteger)initialAccumlator {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return initialAccumlator;\n    }\n    \n    __block NSInteger accumulator = initialAccumlator;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        accumulator = block(accumulator, idx, obj);\n    }];\n    return accumulator;\n}\n\n- (BOOL)lookin_all:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return NO;\n    }\n    __block BOOL allPass = YES;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        BOOL boolValue = block(obj);\n        if (!boolValue) {\n            allPass = NO;\n            *stop = YES;\n        }\n    }];\n    return allPass;\n}\n\n- (BOOL)lookin_any:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return NO;\n    }\n    __block BOOL anyPass = NO;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        BOOL boolValue = block(obj);\n        if (boolValue) {\n            anyPass = YES;\n            *stop = YES;\n        }\n    }];\n    return anyPass;\n}\n\n- (NSArray *)lookin_arrayByRemovingObject:(id)obj {\n    if (!obj || ![self containsObject:obj]) {\n        return self;\n    }\n    NSMutableArray *mutableArray = self.mutableCopy;\n    [mutableArray removeObject:obj];\n    return mutableArray.copy;\n}\n\n- (NSArray *)lookin_nonredundantArray {\n    NSSet *set = [NSSet setWithArray:self];\n    NSArray *newArray = [set allObjects];\n    return newArray;\n}\n\n- (id)lookin_safeObjectAtIndex:(NSInteger)idx {\n    if (idx == NSNotFound || idx < 0) {\n        return nil;\n    }\n    if (self.count <= idx) {\n        return nil;\n    }\n    return [self objectAtIndex:idx];\n}\n\n- (NSArray *)lookin_sortedArrayByStringLength {\n    NSArray<NSString *> *sortedArray = [self sortedArrayUsingComparator:^NSComparisonResult(NSString *obj1, NSString *obj2) {\n        if (obj1.length > obj2.length) {\n            return NSOrderedDescending;\n        } else if (obj1.length == obj2.length) {\n            return NSOrderedSame;\n        } else {\n            return NSOrderedAscending;\n        }\n    }];\n    return sortedArray;\n}\n\n@end\n\n@implementation NSMutableArray (Lookin)\n\n- (void)lookin_dequeueWithCount:(NSUInteger)count add:(id (^)(NSUInteger idx))addBlock notDequeued:(void (^)(NSUInteger idx, id obj))notDequeuedBlock doNext:(void (^)(NSUInteger idx, id obj))doBlock {\n    for (NSUInteger i = 0; i < count; i++) {\n        if ([self lookin_hasIndex:i]) {\n            id obj = [self objectAtIndex:i];\n            if (doBlock) {\n                doBlock(i, obj);\n            }\n        } else {\n            if (addBlock) {\n                id newObj = addBlock(i);\n                if (newObj) {\n                    [self addObject:newObj];\n                    if (doBlock) {\n                        doBlock(i, newObj);\n                    }\n                } else {\n                    NSAssert(NO, @\"\");\n                }\n            } else {\n                NSAssert(NO, @\"\");\n            }\n        }\n    }\n    \n    if (notDequeuedBlock) {\n        if (self.count > count) {\n            for (NSUInteger i = count; i < self.count; i++) {\n                id obj = [self objectAtIndex:i];\n                notDequeuedBlock(i, obj);\n            }\n        }\n    }\n}\n\n- (void)lookin_removeObjectsPassingTest:(BOOL (^)(NSUInteger idx, id obj))block {\n    if (!block) {\n        return;\n    }\n    NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull currentObj, NSUInteger idx, BOOL * _Nonnull stop) {\n        BOOL boolValue = block(idx, currentObj);\n        if (boolValue) {\n            [indexSet addIndex:idx];\n        }\n    }];\n    [self removeObjectsAtIndexes:indexSet];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSObject+Lookin.h",
    "content": "//\n//  NSObject+Lookin.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/12/22.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n\n\n#import <Foundation/Foundation.h>\n#import \"LookinCodingValueType.h\"\n\n@interface NSObject (Lookin)\n\n#pragma mark - Data Bind\n\n/**\n 给对象绑定上另一个对象以供后续取出使用，如果 object 传入 nil 则会清除该 key 之前绑定的对象\n \n @attention 被绑定的对象会被 strong 强引用\n @note 内部是使用 objc_setAssociatedObject / objc_getAssociatedObject 来实现\n \n @code\n - (UITableViewCell *)cellForIndexPath:(NSIndexPath *)indexPath {\n // 1）在这里给 button 绑定上 indexPath 对象\n [cell lookin_bindObject:indexPath forKey:@\"indexPath\"];\n }\n \n - (void)didTapButton:(UIButton *)button {\n // 2）在这里取出被点击的 button 的 indexPath 对象\n NSIndexPath *indexPathTapped = [button lookin_getBindObjectForKey:@\"indexPath\"];\n }\n @endcode\n */\n- (void)lookin_bindObject:(id)object forKey:(NSString *)key;\n\n/**\n 给对象绑定上另一个对象以供后续取出使用，但相比于 lookin_bindObject:forKey:，该方法不会 strong 强引用传入的 object\n */\n- (void)lookin_bindObjectWeakly:(id)object forKey:(NSString *)key;\n\n/**\n 取出之前使用 bind 方法绑定的对象\n */\n- (id)lookin_getBindObjectForKey:(NSString *)key;\n\n/**\n 给对象绑定上一个 double 值以供后续取出使用\n */\n- (void)lookin_bindDouble:(double)doubleValue forKey:(NSString *)key;\n\n/**\n 取出之前用 lookin_bindDouble:forKey: 绑定的值\n */\n- (double)lookin_getBindDoubleForKey:(NSString *)key;\n\n/**\n 给对象绑定上一个 BOOL 值以供后续取出使用\n */\n- (void)lookin_bindBOOL:(BOOL)boolValue forKey:(NSString *)key;\n\n/**\n 取出之前用 lookin_bindBOOL:forKey: 绑定的值\n */\n- (BOOL)lookin_getBindBOOLForKey:(NSString *)key;\n\n/**\n 给对象绑定上一个 long 值以供后续取出使用\n */\n- (void)lookin_bindLong:(long)longValue forKey:(NSString *)key;\n\n/**\n 取出之前用 lookin_bindLong:forKey: 绑定的值\n */\n- (long)lookin_getBindLongForKey:(NSString *)key;\n\n/**\n 给对象绑定上一个 CGPoint 值以供后续取出使用\n */\n- (void)lookin_bindPoint:(CGPoint)pointValue forKey:(NSString *)key;\n\n/**\n 取出之前用 lookin_bindPoint:forKey: 绑定的值\n */\n- (CGPoint)lookin_getBindPointForKey:(NSString *)key;\n\n/**\n 移除之前使用 bind 方法绑定的对象\n */\n- (void)lookin_clearBindForKey:(NSString *)key;\n\n@end\n\n@interface NSObject (Lookin_Coding)\n\n/// 会把 NSImage/UIImage 转换为 NSData，把 NSColor/UIColor 转换回 NSNumber 数组(rgba)\n- (id)lookin_encodedObjectWithType:(LookinCodingValueType)type;\n/// 会把 NSData 转换回 NSImage/UIImage，把 NSNumber 数组(rgba) 转换为 NSColor/UIColor\n- (id)lookin_decodedObjectWithType:(LookinCodingValueType)type;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSObject+Lookin.m",
    "content": "//\n//  NSObject+Lookin.m\n//  Lookin\n//\n//  Created by Li Kai on 2018/12/22.\n//  https://lookin.work\n//\n\n\n\n#import \"NSObject+Lookin.h\"\n#import <Objc/runtime.h>\n#import \"TargetConditionals.h\"\n#import \"LookinWeakContainer.h\"\n\n@implementation NSObject (Lookin)\n\n#pragma mark - Data Bind\n\nstatic char kAssociatedObjectKey_LookinAllBindObjects;\n- (NSMutableDictionary<id, id> *)lookin_allBindObjects {\n    NSMutableDictionary<id, id> *dict = objc_getAssociatedObject(self, &kAssociatedObjectKey_LookinAllBindObjects);\n    if (!dict) {\n        dict = [NSMutableDictionary dictionary];\n        objc_setAssociatedObject(self, &kAssociatedObjectKey_LookinAllBindObjects, dict, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return dict;\n}\n\n- (void)lookin_bindObject:(id)object forKey:(NSString *)key {\n    if (!key.length) {\n        NSAssert(NO, @\"\");\n        return;\n    }\n    @synchronized (self) {\n        if (object) {\n            [[self lookin_allBindObjects] setObject:object forKey:key];\n        } else {\n            [[self lookin_allBindObjects] removeObjectForKey:key];\n        }\n    }\n}\n\n- (id)lookin_getBindObjectForKey:(NSString *)key {\n    if (!key.length) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    @synchronized (self) {\n        id storedObj = [[self lookin_allBindObjects] objectForKey:key];\n        if ([storedObj isKindOfClass:[LookinWeakContainer class]]) {\n            storedObj = [(LookinWeakContainer *)storedObj object];\n        }\n        return storedObj;\n    }\n}\n\n- (void)lookin_bindObjectWeakly:(id)object forKey:(NSString *)key {\n    if (!key.length) {\n        NSAssert(NO, @\"\");\n        return;\n    }\n    if (object) {\n        LookinWeakContainer *container = [[LookinWeakContainer alloc] init];\n        container.object = object;\n        [self lookin_bindObject:container forKey:key];\n    } else {\n        [self lookin_bindObject:nil forKey:key];\n    }\n}\n\n- (void)lookin_bindDouble:(double)doubleValue forKey:(NSString *)key {\n    [self lookin_bindObject:@(doubleValue) forKey:key];\n}\n\n- (double)lookin_getBindDoubleForKey:(NSString *)key {\n    id object = [self lookin_getBindObjectForKey:key];\n    if ([object isKindOfClass:[NSNumber class]]) {\n        double doubleValue = [(NSNumber *)object doubleValue];\n        return doubleValue;\n        \n    } else {\n        return 0.0;\n    }\n}\n\n- (void)lookin_bindBOOL:(BOOL)boolValue forKey:(NSString *)key {\n    [self lookin_bindObject:@(boolValue) forKey:key];\n}\n\n- (BOOL)lookin_getBindBOOLForKey:(NSString *)key {\n    id object = [self lookin_getBindObjectForKey:key];\n    if ([object isKindOfClass:[NSNumber class]]) {\n        BOOL boolValue = [(NSNumber *)object boolValue];\n        return boolValue;\n        \n    } else {\n        return NO;\n    }\n}\n\n- (void)lookin_bindLong:(long)longValue forKey:(NSString *)key {\n    [self lookin_bindObject:@(longValue) forKey:key];\n}\n\n- (long)lookin_getBindLongForKey:(NSString *)key {\n    id object = [self lookin_getBindObjectForKey:key];\n    if ([object isKindOfClass:[NSNumber class]]) {\n        long longValue = [(NSNumber *)object longValue];\n        return longValue;\n        \n    } else {\n        return 0;\n    }\n}\n\n- (void)lookin_bindPoint:(CGPoint)pointValue forKey:(NSString *)key {\n#if TARGET_OS_IPHONE\n    [self lookin_bindObject:[NSValue valueWithCGPoint:pointValue] forKey:key];\n#elif TARGET_OS_MAC\n    NSPoint nsPoint = NSMakePoint(pointValue.x, pointValue.y);\n    [self lookin_bindObject:[NSValue valueWithPoint:nsPoint] forKey:key];\n#endif\n}\n\n- (CGPoint)lookin_getBindPointForKey:(NSString *)key {\n    id object = [self lookin_getBindObjectForKey:key];\n    if ([object isKindOfClass:[NSValue class]]) {\n#if TARGET_OS_IPHONE\n        CGPoint pointValue = [(NSValue *)object CGPointValue];\n#elif TARGET_OS_MAC\n        NSPoint nsPointValue = [(NSValue *)object pointValue];\n        CGPoint pointValue = CGPointMake(nsPointValue.x, nsPointValue.y);\n#endif\n        return pointValue;\n    } else {\n        return CGPointZero;\n    }\n}\n\n- (void)lookin_clearBindForKey:(NSString *)key {\n    [self lookin_bindObject:nil forKey:key];\n}\n\n@end\n\n@implementation NSObject (Lookin_Coding)\n\n- (id)lookin_encodedObjectWithType:(LookinCodingValueType)type {\n    if (type == LookinCodingValueTypeColor) {\n        if ([self isKindOfClass:[LookinColor class]]) {\n            CGFloat r, g, b, a;\n#if TARGET_OS_IPHONE\n            CGFloat white;\n            if ([(UIColor *)self getRed:&r green:&g blue:&b alpha:&a]) {\n                // valid\n            } else if ([(UIColor *)self getWhite:&white alpha:&a]) {\n                r = white;\n                g = white;\n                b = white;\n            } else {\n                NSAssert(NO, @\"\");\n                r = 0;\n                g = 0;\n                b = 0;\n                a = 0;\n            }\n#elif TARGET_OS_MAC\n            NSColor *color = [((NSColor *)self) colorUsingColorSpace:NSColorSpace.sRGBColorSpace];\n            [color getRed:&r green:&g blue:&b alpha:&a];\n#endif\n            NSArray<NSNumber *> *rgba = @[@(r), @(g), @(b), @(a)];\n            return rgba;\n            \n        } else {\n            NSAssert(NO, @\"\");\n            return nil;\n        }\n        \n    } else if (type == LookinCodingValueTypeImage) {\n#if TARGET_OS_IPHONE\n        if ([self isKindOfClass:[UIImage class]]) {\n            UIImage *image = (UIImage *)self;\n            return UIImagePNGRepresentation(image);\n            \n        } else {\n            NSAssert(NO, @\"\");\n            return nil;\n        }\n#elif TARGET_OS_MAC\n        if ([self isKindOfClass:[NSImage class]]) {\n            NSImage *image = (NSImage *)self;\n            return [image TIFFRepresentation];\n            \n        } else {\n            NSAssert(NO, @\"\");\n            return nil;\n        }\n#endif\n        \n    } else {\n        return self;\n    }\n}\n\n- (id)lookin_decodedObjectWithType:(LookinCodingValueType)type {\n    if (type == LookinCodingValueTypeColor) {\n        if ([self isKindOfClass:[NSArray class]]) {\n            NSArray<NSNumber *> *rgba = (NSArray *)self;\n            CGFloat r = [rgba[0] doubleValue];\n            CGFloat g = [rgba[1] doubleValue];\n            CGFloat b = [rgba[2] doubleValue];\n            CGFloat a = [rgba[3] doubleValue];\n            LookinColor *color = [LookinColor colorWithRed:r green:g blue:b alpha:a];\n            return color;\n            \n        } else {\n            NSAssert(NO, @\"\");\n            return nil;\n        }\n        \n    } else if (type == LookinCodingValueTypeImage) {\n        if ([self isKindOfClass:[NSData class]]) {\n            LookinImage *image = [[LookinImage alloc] initWithData:(NSData *)self];\n            return image;\n        } else {\n            NSAssert(NO, @\"\");\n            return nil;\n        }\n            \n    } else {\n        return self;\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSSet+Lookin.h",
    "content": "//\n//  NSSet+Lookin.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/1/13.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n\n\n#import \"TargetConditionals.h\"\n#if TARGET_OS_IPHONE\n#import <UIKit/UIKit.h>\n#elif TARGET_OS_MAC\n#import <Appkit/Appkit.h>\n#endif\n\n@interface NSSet<__covariant ValueType> (Lookin)\n\n- (NSSet *)lookin_map:(id (^)(ValueType obj))block;\n\n- (ValueType)lookin_firstFiltered:(BOOL (^)(ValueType obj))block;\n\n- (NSSet<ValueType> *)lookin_filter:(BOOL (^)(ValueType obj))block;\n\n\n/**\n 是否有任何一个元素满足某条件\n @note 元素将被依次传入 block 里，如果任何一个 block 返回 YES，则该方法返回 YES。如果所有 block 均返回 NO，则该方法返回 NO。\n */\n- (BOOL)lookin_any:(BOOL (^)(ValueType obj))block;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSSet+Lookin.m",
    "content": "//\n//  NSSet+Lookin.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/1/13.\n//  https://lookin.work\n//\n\n\n\n#import \"NSSet+Lookin.h\"\n\n@implementation NSSet (Lookin)\n\n- (NSSet *)lookin_map:(id (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    NSMutableSet *newSet = [NSMutableSet setWithCapacity:self.count];\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, BOOL * _Nonnull stop) {\n        id newObj = block(obj);\n        if (newObj) {\n            [newSet addObject:newObj];\n        }\n    }];\n    return [newSet copy];\n}\n\n- (id)lookin_firstFiltered:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    __block id targetObj = nil;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, BOOL * _Nonnull stop) {\n        if (block(obj)) {\n            targetObj = obj;\n            *stop = YES;\n        }\n    }];\n    return targetObj;\n}\n\n- (NSSet *)lookin_filter:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return nil;\n    }\n    \n    NSMutableSet *mSet = [NSMutableSet set];\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, BOOL * _Nonnull stop) {\n        if (block(obj)) {\n            [mSet addObject:obj];\n        }\n    }];\n    return [mSet copy];\n}\n\n- (BOOL)lookin_any:(BOOL (^)(id obj))block {\n    if (!block) {\n        NSAssert(NO, @\"\");\n        return NO;\n    }\n    __block BOOL boolValue = NO;\n    [self enumerateObjectsUsingBlock:^(id  _Nonnull obj, BOOL * _Nonnull stop) {\n        if (block(obj)) {\n            boolValue = YES;\n            *stop = YES;\n        }\n    }];\n    return boolValue;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSString+Lookin.h",
    "content": "//\n//  NSString+Lookin.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/5/11.\n//  https://lookin.work\n//\n\n#import \"LookinDefines.h\"\n\n\n\n#import <Foundation/Foundation.h>\n\n@interface NSString (Lookin)\n\n/**\n 把 CGFloat 转成字符串，最多保留 3 位小数，转换后末尾的 0 会被删除\n 如：1.2341 => @\"1.234\", 2.1002 => @\"2.1\", 3.000 => @\"3\"\n */\n+ (NSString *)lookin_stringFromDouble:(double)doubleValue decimal:(NSUInteger)decimal;\n\n+ (NSString *)lookin_stringFromRect:(CGRect)rect;\n\n+ (NSString *)lookin_stringFromInset:(LookinInsets)insets;\n\n+ (NSString *)lookin_stringFromSize:(CGSize)size;\n\n+ (NSString *)lookin_stringFromPoint:(CGPoint)point;\n\n+ (NSString *)lookin_rgbaStringFromColor:(LookinColor *)color;\n\n- (NSString *)lookin_safeInitWithUTF8String:(const char *)string;\n\n/// 在 swift 中，类名可能会被加前缀，比如 MyApp.MyView 或 _TtC5MyApp8TestView 这种，该方法会返回简化后的末尾的类名，比如 MyView\n- (NSString *)lookin_shortClassNameString;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Category/NSString+Lookin.m",
    "content": "//\n//  NSString+Lookin.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/5/11.\n//  https://lookin.work\n//\n\n\n\n#import \"NSString+Lookin.h\"\n\n@implementation NSString (Lookin)\n\n+ (NSString *)lookin_stringFromDouble:(double)doubleValue decimal:(NSUInteger)decimal {\n    NSString *formatString = [NSString stringWithFormat:@\"%%.%@f\", @(decimal)];\n    NSString *string = [NSString stringWithFormat:formatString, doubleValue];\n    for (int i = 0; i < decimal; i++) {\n        if ([[string substringFromIndex:string.length - 1] isEqualToString:@\"0\"]) {\n            string = [string substringToIndex:string.length - 1];\n        }\n    }\n    if ([[string substringFromIndex:string.length - 1] isEqualToString:@\".\"]) {\n        string = [string substringToIndex:string.length - 1];\n    }\n    return string;\n}\n\n+ (NSString *)lookin_stringFromInset:(LookinInsets)insets {\n    return [NSString stringWithFormat:@\"{%@, %@, %@, %@}\",\n            [NSString lookin_stringFromDouble:insets.top decimal:2],\n            [NSString lookin_stringFromDouble:insets.left decimal:2],\n            [NSString lookin_stringFromDouble:insets.bottom decimal:2],\n            [NSString lookin_stringFromDouble:insets.right decimal:2]];\n}\n\n+ (NSString *)lookin_stringFromSize:(CGSize)size {\n    return [NSString stringWithFormat:@\"{%@, %@}\",\n            [NSString lookin_stringFromDouble:size.width decimal:2],\n            [NSString lookin_stringFromDouble:size.height decimal:2]];\n}\n\n\n+ (NSString *)lookin_stringFromPoint:(CGPoint)point {\n    return [NSString stringWithFormat:@\"{%@, %@}\",\n            [NSString lookin_stringFromDouble:point.x decimal:2],\n            [NSString lookin_stringFromDouble:point.y decimal:2]];\n}\n\n+ (NSString *)lookin_stringFromRect:(CGRect)rect {\n    return [NSString stringWithFormat:@\"{%@, %@, %@, %@}\",\n            [NSString lookin_stringFromDouble:rect.origin.x decimal:2],\n            [NSString lookin_stringFromDouble:rect.origin.y decimal:2],\n            [NSString lookin_stringFromDouble:rect.size.width decimal:2],\n            [NSString lookin_stringFromDouble:rect.size.height decimal:2]];\n}\n\n+ (NSString *)lookin_rgbaStringFromColor:(LookinColor *)color {\n    if (!color) {\n        return @\"nil\";\n    }\n    \n#if TARGET_OS_IPHONE\n    UIColor *rgbColor = color;\n#elif TARGET_OS_MAC\n    NSColor *rgbColor = [color colorUsingColorSpace:NSColorSpace.sRGBColorSpace];\n#endif\n    \n    CGFloat r, g, b, a;\n    [rgbColor getRed:&r green:&g blue:&b alpha:&a];\n    \n    NSString *colorDesc;\n    if (a >= 1) {\n        colorDesc = [NSString stringWithFormat:@\"(%.0f, %.0f, %.0f)\", r * 255, g * 255, b * 255];\n    } else {\n        colorDesc = [NSString stringWithFormat:@\"(%.0f, %.0f, %.0f, %@)\", r * 255, g * 255, b * 255, [NSString lookin_stringFromDouble:a decimal:2]];\n        \n    }\n    \n    return colorDesc;\n}\n\n- (NSString *)lookin_safeInitWithUTF8String:(const char *)string {\n    if (NULL != string) {\n        return [self initWithUTF8String:string];\n    }\n    return nil;\n}\n\n- (NSString *)lookin_shortClassNameString {\n    if ([self containsString:@\".\"]) {\n        // Swift 中，class 可能会被加前缀，比如 Weread.AvatarView，此时返回后半部分即可\n        NSString *shortName = [self componentsSeparatedByString:@\".\"].lastObject;\n        return shortName;\n    }\n    if ([self hasPrefix:@\"_Tt\"]) {\n        // Swift 中，private class 可能会被加前缀，比如 MyApp 里一个叫 TestView 的 private class，这里获取到的可能是：_TtC5MyAppP33_6BC07D230B8F25989003315CA1D8100B8TestView\n        // 这里规则比较复杂，可以参考这里的讨论：https://stackoverflow.com/questions/24062957/swift-objective-c-runtime-class-naming\n        // _Tt 开头则认为是这种类型\n        for (NSInteger i = self.length - 1; i >= 0; i--) {\n            // 比如上面的注释里的例子，末尾的 TestView 即我们想截取的字符串，而它前面的那个数字 8 则是分隔符，8 在这里表示 TestView 字符串的长度是 8\n            // 这里是倒序从最后一个字母向前遍历，i 为当前被遍历到的字符串的 idx，比如遍历到 \"_\" 时则 i 为 0\n            \n            // 当前已经被遍历到的末尾字符串的数量，比如第八次执行该循环时，enumeratedStringLength 为 8\n            NSInteger enumeratedStringLength = self.length - i;\n            \n            // 我们此刻检查下一次将会被遍历到的那一个（或两个）字符串是否是对应的数字 8，如果是，则认为当前被遍历过的字符串是我们要找的类名\n            \n            // 要检查接下来多少位的字符串是否是数字，比如 enumeratedStringLength 为 8 时则检查接下来的 1 位字符串是否是 8，如果 enumeratedStringLength 为 12 则检查接下来的 2 位数字是否是 12\n            NSInteger numberLengthToCheck = 1;\n            if (enumeratedStringLength >= 10) {\n                numberLengthToCheck = 2;\n            } else if (enumeratedStringLength >= 100) {\n                numberLengthToCheck = 3;\n            }\n            \n            if (i < numberLengthToCheck) {\n                // 全部检查完了，失败，直接返回自身吧\n                return self;\n            }\n            \n            NSRange checkRange = NSMakeRange(i - numberLengthToCheck, numberLengthToCheck);\n            NSString *stringToCheck = [self substringWithRange:checkRange];\n            NSInteger scannedNumber = [stringToCheck integerValue];\n            if (scannedNumber == enumeratedStringLength) {\n                // 比如我们已经遍历到了 “TextView”，而下一个字母确实就是数字 8，则这里我们认为找到了目标字符串\n                NSString *targetString = [self substringFromIndex:i];\n                return targetString;\n            }\n            // 继续遍历\n        }\n    }\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAppInfo.h",
    "content": "//\n//  LookinAppInfo.h\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/11/3.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n\n\n#import \"LookinDefines.h\"\n\ntypedef NS_ENUM(NSInteger, LookinAppInfoDevice) {\n    LookinAppInfoDeviceSimulator,   // 模拟器\n    LookinAppInfoDeviceIPad,    // iPad 真机\n    LookinAppInfoDeviceOthers   // 应该视为 iPhone 真机\n};\n\n@interface LookinAppInfo : NSObject <NSSecureCoding, NSCopying>\n\n/// 每次启动 app 时都会随机生成一个 appInfoIdentifier 直到 app 被 kill 掉\n@property(nonatomic, assign) NSUInteger appInfoIdentifier;\n/// mac 端应该先读取该属性，如果为 YES 则表示应该使用之前保存的旧 appInfo 对象即可\n@property(nonatomic, assign) BOOL shouldUseCache;\n/// LookinServer 的版本\n@property(nonatomic, assign) int serverVersion;\n/// app 的当前截图\n@property(nonatomic, strong) LookinImage *screenshot;\n/// 可能为 nil，比如新建的 iOS 空项目\n@property(nonatomic, strong) LookinImage *appIcon;\n/// @\"微信读书\"\n@property(nonatomic, copy) NSString *appName;\n/// hughkli.lookin\n@property(nonatomic, copy) NSString *appBundleIdentifier;\n/// @\"iPhone X\"\n@property(nonatomic, copy) NSString *deviceDescription;\n/// @\"12.1\"\n@property(nonatomic, copy) NSString *osDescription;\n/// 返回 os 的主版本号，比如 iOS 12.1 的设备将返回 12，iOS 13.2.1 的设备将返回 13\n@property(nonatomic, assign) NSUInteger osMainVersion;\n/// 设备类型\n@property(nonatomic, assign) LookinAppInfoDevice deviceType;\n/// 屏幕的宽度\n@property(nonatomic, assign) double screenWidth;\n/// 屏幕的高度\n@property(nonatomic, assign) double screenHeight;\n/// 是几倍的屏幕\n@property(nonatomic, assign) double screenScale;\n\n- (BOOL)isEqualToAppInfo:(LookinAppInfo *)info;\n\n#if TARGET_OS_IPHONE\n\n+ (LookinAppInfo *)currentInfoWithScreenshot:(BOOL)hasScreenshot icon:(BOOL)hasIcon localIdentifiers:(NSArray<NSNumber *> *)localIdentifiers;\n\n#else\n\n@property(nonatomic, assign) NSTimeInterval cachedTimestamp;\n\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAppInfo.m",
    "content": "//\n//  LookinAppInfo.m\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/11/3.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n\n\n#import \"LookinAppInfo.h\"\n\nstatic NSString * const CodingKey_AppIcon = @\"1\";\nstatic NSString * const CodingKey_Screenshot = @\"2\";\nstatic NSString * const CodingKey_DeviceDescription = @\"3\";\nstatic NSString * const CodingKey_OsDescription = @\"4\";\nstatic NSString * const CodingKey_AppName = @\"5\";\nstatic NSString * const CodingKey_ScreenWidth = @\"6\";\nstatic NSString * const CodingKey_ScreenHeight = @\"7\";\nstatic NSString * const CodingKey_DeviceType = @\"8\";\n\n@implementation LookinAppInfo\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinAppInfo *newAppInfo = [[LookinAppInfo allocWithZone:zone] init];\n    newAppInfo.appIcon = self.appIcon;\n    newAppInfo.appName = self.appName;\n    newAppInfo.deviceDescription = self.deviceDescription;\n    newAppInfo.osDescription = self.osDescription;\n    newAppInfo.osMainVersion = self.osMainVersion;\n    newAppInfo.deviceType = self.deviceType;\n    newAppInfo.screenWidth = self.screenWidth;\n    newAppInfo.screenHeight = self.screenHeight;\n    newAppInfo.screenScale = self.screenScale;\n    newAppInfo.appInfoIdentifier = self.appInfoIdentifier;\n    return newAppInfo;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        \n        self.serverVersion = [aDecoder decodeIntForKey:@\"serverVersion\"];\n\n        NSData *screenshotData = [aDecoder decodeObjectForKey:CodingKey_Screenshot];\n        self.screenshot = [[LookinImage alloc] initWithData:screenshotData];\n        \n        NSData *appIconData = [aDecoder decodeObjectForKey:CodingKey_AppIcon];\n        self.appIcon = [[LookinImage alloc] initWithData:appIconData];\n        \n        self.appName = [aDecoder decodeObjectForKey:CodingKey_AppName];\n        self.appBundleIdentifier = [aDecoder decodeObjectForKey:@\"appBundleIdentifier\"];\n        self.deviceDescription = [aDecoder decodeObjectForKey:CodingKey_DeviceDescription];\n        self.osDescription = [aDecoder decodeObjectForKey:CodingKey_OsDescription];\n        self.osMainVersion = [aDecoder decodeIntegerForKey:@\"osMainVersion\"];\n        self.deviceType = [aDecoder decodeIntegerForKey:CodingKey_DeviceType];\n        self.screenWidth = [aDecoder decodeDoubleForKey:CodingKey_ScreenWidth];\n        self.screenHeight = [aDecoder decodeDoubleForKey:CodingKey_ScreenHeight];\n        self.screenScale = [aDecoder decodeDoubleForKey:@\"screenScale\"];\n        self.appInfoIdentifier = [aDecoder decodeIntegerForKey:@\"appInfoIdentifier\"];\n        self.shouldUseCache = [aDecoder decodeBoolForKey:@\"shouldUseCache\"];\n    }\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeInt:self.serverVersion forKey:@\"serverVersion\"];\n    \n#if TARGET_OS_IPHONE\n    NSData *screenshotData = UIImagePNGRepresentation(self.screenshot);\n    [aCoder encodeObject:screenshotData forKey:CodingKey_Screenshot];\n    \n    NSData *appIconData = UIImagePNGRepresentation(self.appIcon);\n    [aCoder encodeObject:appIconData forKey:CodingKey_AppIcon];\n#elif TARGET_OS_MAC\n    NSData *screenshotData = [self.screenshot TIFFRepresentation];\n    [aCoder encodeObject:screenshotData forKey:CodingKey_Screenshot];\n    \n    NSData *appIconData = [self.appIcon TIFFRepresentation];\n    [aCoder encodeObject:appIconData forKey:CodingKey_AppIcon];\n#endif\n    \n    [aCoder encodeObject:self.appName forKey:CodingKey_AppName];\n    [aCoder encodeObject:self.appBundleIdentifier forKey:@\"appBundleIdentifier\"];\n    [aCoder encodeObject:self.deviceDescription forKey:CodingKey_DeviceDescription];\n    [aCoder encodeObject:self.osDescription forKey:CodingKey_OsDescription];\n    [aCoder encodeInteger:self.osMainVersion forKey:@\"osMainVersion\"];\n    [aCoder encodeInteger:self.deviceType forKey:CodingKey_DeviceType];\n    [aCoder encodeDouble:self.screenWidth forKey:CodingKey_ScreenWidth];\n    [aCoder encodeDouble:self.screenHeight forKey:CodingKey_ScreenHeight];\n    [aCoder encodeDouble:self.screenScale forKey:@\"screenScale\"];\n    [aCoder encodeInteger:self.appInfoIdentifier forKey:@\"appInfoIdentifier\"];\n    [aCoder encodeBool:self.shouldUseCache forKey:@\"shouldUseCache\"];\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) {\n        return YES;\n    }\n    if (![object isKindOfClass:[LookinAppInfo class]]) {\n        return NO;\n    }\n    if ([self isEqualToAppInfo:object]) {\n        return YES;\n    }\n    return NO;\n}\n\n- (NSUInteger)hash {\n    return self.appName.hash ^ self.deviceDescription.hash ^ self.osDescription.hash ^ self.deviceType;\n}\n\n- (BOOL)isEqualToAppInfo:(LookinAppInfo *)info {\n    if (!info) {\n        return NO;\n    }\n    if ([self.appName isEqualToString:info.appName] && [self.deviceDescription isEqualToString:info.deviceDescription] && [self.osDescription isEqualToString:info.osDescription] && self.deviceType == info.deviceType) {\n        return YES;\n    }\n    return NO;\n}\n\n#if TARGET_OS_IPHONE\n\n+ (LookinAppInfo *)currentInfoWithScreenshot:(BOOL)hasScreenshot icon:(BOOL)hasIcon localIdentifiers:(NSArray<NSNumber *> *)localIdentifiers {\n    NSInteger selfIdentifier = [self getAppInfoIdentifier];\n    if ([localIdentifiers containsObject:@(selfIdentifier)]) {\n        LookinAppInfo *info = [LookinAppInfo new];\n        info.appInfoIdentifier = selfIdentifier;\n        info.shouldUseCache = YES;\n        return info;\n    }\n    \n    LookinAppInfo *info = [[LookinAppInfo alloc] init];\n    info.appInfoIdentifier = selfIdentifier;\n    info.appName = [self appName];\n    info.deviceDescription = [UIDevice currentDevice].name;\n    info.appBundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];\n    if ([self isSimulator]) {\n        info.deviceType = LookinAppInfoDeviceSimulator;\n    } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {\n        info.deviceType = LookinAppInfoDeviceIPad;\n    } else {\n        info.deviceType = LookinAppInfoDeviceOthers;\n    }\n    \n    info.osDescription = [UIDevice currentDevice].systemVersion;\n    \n    NSString *mainVersionStr = [[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@\".\"].firstObject;\n    info.osMainVersion = [mainVersionStr integerValue];\n    \n    CGSize screenSize = [UIScreen mainScreen].bounds.size;\n    info.screenWidth = screenSize.width;\n    info.screenHeight = screenSize.height;\n    info.screenScale = [UIScreen mainScreen].scale;\n\n    if (hasScreenshot) {\n        info.screenshot = [self screenshotImage];\n    }\n    if (hasIcon) {\n        info.appIcon = [self appIcon];\n    }\n    \n    return info;\n}\n\n+ (NSString *)appName {\n    NSDictionary *info = [[NSBundle mainBundle] infoDictionary];\n    NSString *displayName = [info objectForKey:@\"CFBundleDisplayName\"];\n    NSString *name = [info objectForKey:@\"CFBundleName\"];\n    return displayName.length ? displayName : name;\n}\n\n+ (UIImage *)appIcon {\n#if TARGET_OS_TV\n    return nil;\n#else\n    NSString *imageName = [[[[[[NSBundle mainBundle] infoDictionary] objectForKey:@\"CFBundleIcons\"] objectForKey:@\"CFBundlePrimaryIcon\"] objectForKey:@\"CFBundleIconFiles\"] lastObject];\n    if (!imageName.length) {\n        // 正常情况下拿到的 name 可能比如 “AppIcon60x60”。但某些情况可能为 nil，此时直接 return 否则 [UIImage imageNamed:nil] 可能导致 console 报 \"CUICatalog: Invalid asset name supplied: '(null)'\" 的错误信息\n        return nil;\n    }\n    return [UIImage imageNamed:imageName];\n#endif\n}\n\n+ (UIImage *)screenshotImage {\n    UIWindow *window = [UIApplication sharedApplication].keyWindow;\n    if (!window) {\n        return nil;\n    }\n    UIGraphicsBeginImageContextWithOptions(window.bounds.size, YES, 0.4);\n    [window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES];\n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    \n    return image;\n}\n\n+ (BOOL)isSimulator {\n    if (TARGET_OS_SIMULATOR) {\n        return YES;\n    }\n    return NO;\n}\n\n#endif\n\n+ (NSInteger)getAppInfoIdentifier {\n    static dispatch_once_t onceToken;\n    static NSInteger identifier = 0;\n    dispatch_once(&onceToken,^{\n        identifier = [[NSDate date] timeIntervalSince1970];\n    });\n    return identifier;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttrIdentifiers.h",
    "content": "//\n//  LookinAttrIdentifiers.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/9/18.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n#pragma mark - Group\n\ntypedef NSString * LookinAttrGroupIdentifier;\n\nextern LookinAttrGroupIdentifier const LookinAttrGroup_None;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_Class;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_Relation;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_Layout;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_AutoLayout;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_ViewLayer;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UIImageView;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UILabel;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UIControl;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UIButton;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UIScrollView;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UITableView;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UITextView;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UITextField;\nextern LookinAttrGroupIdentifier const LookinAttrGroup_UIVisualEffectView;\n\n\n#pragma mark - Section\n\ntypedef NSString * LookinAttrSectionIdentifier;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_None;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_Class_Class;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_Relation_Relation;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_Layout_Frame;\nextern LookinAttrSectionIdentifier const LookinAttrSec_Layout_Bounds;\nextern LookinAttrSectionIdentifier const LookinAttrSec_Layout_SafeArea;\nextern LookinAttrSectionIdentifier const LookinAttrSec_Layout_Position;\nextern LookinAttrSectionIdentifier const LookinAttrSec_Layout_AnchorPoint;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_Hugging;\nextern LookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_Resistance;\nextern LookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_Constraints;\nextern LookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_IntrinsicSize;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Visibility;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_InterationAndMasks;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Corner;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_BgColor;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Border;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Shadow;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_ContentMode;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_TintColor;\nextern LookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Tag;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIImageView_Name;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIImageView_Open;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UILabel_Text;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UILabel_Font;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UILabel_NumberOfLines;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UILabel_TextColor;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UILabel_BreakMode;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UILabel_Alignment;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UILabel_CanAdjustFont;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIControl_EnabledSelected;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIControl_VerAlignment;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIControl_HorAlignment;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIControl_QMUIOutsideEdge;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIButton_ContentInsets;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIButton_TitleInsets;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIButton_ImageInsets;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ContentInset;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_AdjustedInset;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_IndicatorInset;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Offset;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ContentSize;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Behavior;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ShowsIndicator;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Bounce;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ScrollPaging;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ContentTouches;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Zoom;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_QMUIInitialInset;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITableView_Style;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITableView_SectionsNumber;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITableView_RowsNumber;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITableView_SeparatorStyle;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITableView_SeparatorColor;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITableView_SeparatorInset;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextView_Basic;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextView_Text;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextView_Font;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextView_TextColor;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextView_Alignment;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextView_ContainerInset;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_Text;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_Placeholder;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_Font;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_TextColor;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_Alignment;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_Clears;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_CanAdjustFont;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UITextField_ClearButtonMode;\n\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIVisualEffectView_Style;\nextern LookinAttrSectionIdentifier const LookinAttrSec_UIVisualEffectView_QMUIForegroundColor;\n\n#pragma mark - Attr\n\ntypedef NSString * LookinAttrIdentifier;\n\nextern LookinAttrIdentifier const LookinAttr_None;\n\nextern LookinAttrIdentifier const LookinAttr_Class_Class_Class;\n\nextern LookinAttrIdentifier const LookinAttr_Relation_Relation_Relation;\n\nextern LookinAttrIdentifier const LookinAttr_Layout_Frame_Frame;\nextern LookinAttrIdentifier const LookinAttr_Layout_Bounds_Bounds;\nextern LookinAttrIdentifier const LookinAttr_Layout_SafeArea_SafeArea;\nextern LookinAttrIdentifier const LookinAttr_Layout_Position_Position;\nextern LookinAttrIdentifier const LookinAttr_Layout_AnchorPoint_AnchorPoint;\n\nextern LookinAttrIdentifier const LookinAttr_AutoLayout_Hugging_Hor;\nextern LookinAttrIdentifier const LookinAttr_AutoLayout_Hugging_Ver;\nextern LookinAttrIdentifier const LookinAttr_AutoLayout_Resistance_Hor;\nextern LookinAttrIdentifier const LookinAttr_AutoLayout_Resistance_Ver;\nextern LookinAttrIdentifier const LookinAttr_AutoLayout_Constraints_Constraints;\nextern LookinAttrIdentifier const LookinAttr_AutoLayout_IntrinsicSize_Size;\n\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Visibility_Hidden;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Visibility_Opacity;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_InterationAndMasks_Interaction;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_InterationAndMasks_MasksToBounds;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Corner_Radius;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_BgColor_BgColor;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Border_Color;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Border_Width;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_Color;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_Opacity;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_Radius;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_OffsetW;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_OffsetH;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_ContentMode_Mode;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_TintColor_Color;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_TintColor_Mode;\nextern LookinAttrIdentifier const LookinAttr_ViewLayer_Tag_Tag;\n\nextern LookinAttrIdentifier const LookinAttr_UIImageView_Name_Name;\nextern LookinAttrIdentifier const LookinAttr_UIImageView_Open_Open;\n\nextern LookinAttrIdentifier const LookinAttr_UILabel_Text_Text;\nextern LookinAttrIdentifier const LookinAttr_UILabel_Font_Name;\nextern LookinAttrIdentifier const LookinAttr_UILabel_Font_Size;\nextern LookinAttrIdentifier const LookinAttr_UILabel_NumberOfLines_NumberOfLines;\nextern LookinAttrIdentifier const LookinAttr_UILabel_TextColor_Color;\nextern LookinAttrIdentifier const LookinAttr_UILabel_Alignment_Alignment;\nextern LookinAttrIdentifier const LookinAttr_UILabel_BreakMode_Mode;\nextern LookinAttrIdentifier const LookinAttr_UILabel_CanAdjustFont_CanAdjustFont;\n\nextern LookinAttrIdentifier const LookinAttr_UIControl_EnabledSelected_Enabled;\nextern LookinAttrIdentifier const LookinAttr_UIControl_EnabledSelected_Selected;\nextern LookinAttrIdentifier const LookinAttr_UIControl_VerAlignment_Alignment;\nextern LookinAttrIdentifier const LookinAttr_UIControl_HorAlignment_Alignment;\nextern LookinAttrIdentifier const LookinAttr_UIControl_QMUIOutsideEdge_Edge;\n\nextern LookinAttrIdentifier const LookinAttr_UIButton_ContentInsets_Insets;\nextern LookinAttrIdentifier const LookinAttr_UIButton_TitleInsets_Insets;\nextern LookinAttrIdentifier const LookinAttr_UIButton_ImageInsets_Insets;\n\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Offset_Offset;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ContentSize_Size;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ContentInset_Inset;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_AdjustedInset_Inset;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Behavior_Behavior;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_IndicatorInset_Inset;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ScrollPaging_ScrollEnabled;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ScrollPaging_PagingEnabled;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Bounce_Ver;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Bounce_Hor;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ShowsIndicator_Hor;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ShowsIndicator_Ver;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ContentTouches_Delay;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_ContentTouches_CanCancel;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_MinScale;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_MaxScale;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_Scale;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_Bounce;\nextern LookinAttrIdentifier const LookinAttr_UIScrollView_QMUIInitialInset_Inset;\n\nextern LookinAttrIdentifier const LookinAttr_UITableView_Style_Style;\nextern LookinAttrIdentifier const LookinAttr_UITableView_SectionsNumber_Number;\nextern LookinAttrIdentifier const LookinAttr_UITableView_RowsNumber_Number;\nextern LookinAttrIdentifier const LookinAttr_UITableView_SeparatorInset_Inset;\nextern LookinAttrIdentifier const LookinAttr_UITableView_SeparatorColor_Color;\nextern LookinAttrIdentifier const LookinAttr_UITableView_SeparatorStyle_Style;\n\nextern LookinAttrIdentifier const LookinAttr_UITextView_Font_Name;\nextern LookinAttrIdentifier const LookinAttr_UITextView_Font_Size;\nextern LookinAttrIdentifier const LookinAttr_UITextView_Basic_Editable;\nextern LookinAttrIdentifier const LookinAttr_UITextView_Basic_Selectable;\nextern LookinAttrIdentifier const LookinAttr_UITextView_Text_Text;\nextern LookinAttrIdentifier const LookinAttr_UITextView_TextColor_Color;\nextern LookinAttrIdentifier const LookinAttr_UITextView_Alignment_Alignment;\nextern LookinAttrIdentifier const LookinAttr_UITextView_ContainerInset_Inset;\n\nextern LookinAttrIdentifier const LookinAttr_UITextField_Text_Text;\nextern LookinAttrIdentifier const LookinAttr_UITextField_Placeholder_Placeholder;\nextern LookinAttrIdentifier const LookinAttr_UITextField_Font_Name;\nextern LookinAttrIdentifier const LookinAttr_UITextField_Font_Size;\nextern LookinAttrIdentifier const LookinAttr_UITextField_TextColor_Color;\nextern LookinAttrIdentifier const LookinAttr_UITextField_Alignment_Alignment;\nextern LookinAttrIdentifier const LookinAttr_UITextField_Clears_ClearsOnBeginEditing;\nextern LookinAttrIdentifier const LookinAttr_UITextField_Clears_ClearsOnInsertion;\nextern LookinAttrIdentifier const LookinAttr_UITextField_CanAdjustFont_CanAdjustFont;\nextern LookinAttrIdentifier const LookinAttr_UITextField_CanAdjustFont_MinSize;\nextern LookinAttrIdentifier const LookinAttr_UITextField_ClearButtonMode_Mode;\n\nextern LookinAttrIdentifier const LookinAttr_UIVisualEffectView_Style_Style;\nextern LookinAttrIdentifier const LookinAttr_UIVisualEffectView_QMUIForegroundColor_Color;\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttrIdentifiers.m",
    "content": "//\n//  LookinAttrIdentifiers.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/9/18.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinAttrIdentifiers.h\"\n\n// value 不能重复（AppDelegate 里的 runTests 有相关 test）\n// 如果要去掉某一项可以考虑注释掉而非直接删除，以防止新项和旧项的 value 相同而引发 preference 错乱（这些 value 会被存储到 userDefaults 里）\n\n#pragma mark - Group\n\nLookinAttrGroupIdentifier const LookinAttrGroup_None = @\"n\";\nLookinAttrGroupIdentifier const LookinAttrGroup_Class = @\"c\";\nLookinAttrGroupIdentifier const LookinAttrGroup_Relation = @\"r\";\nLookinAttrGroupIdentifier const LookinAttrGroup_Layout = @\"l\";\nLookinAttrGroupIdentifier const LookinAttrGroup_AutoLayout = @\"a\";\nLookinAttrGroupIdentifier const LookinAttrGroup_ViewLayer = @\"vl\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UIImageView = @\"i\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UILabel = @\"la\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UIControl = @\"co\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UIButton = @\"b\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UIScrollView = @\"s\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UITableView = @\"ta\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UITextView = @\"te\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UITextField = @\"tf\";\nLookinAttrGroupIdentifier const LookinAttrGroup_UIVisualEffectView = @\"ve\";\n\n\n#pragma mark - Section\n\nLookinAttrSectionIdentifier const LookinAttrSec_None = @\"n\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_Class_Class = @\"cl_c\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_Relation_Relation = @\"r_r\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_Layout_Frame = @\"l_f\";\nLookinAttrSectionIdentifier const LookinAttrSec_Layout_Bounds = @\"l_b\";\nLookinAttrSectionIdentifier const LookinAttrSec_Layout_SafeArea = @\"l_s\";\nLookinAttrSectionIdentifier const LookinAttrSec_Layout_Position = @\"l_p\";\nLookinAttrSectionIdentifier const LookinAttrSec_Layout_AnchorPoint = @\"l_a\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_Hugging = @\"a_h\";\nLookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_Resistance = @\"a_r\";\nLookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_Constraints = @\"a_c\";\nLookinAttrSectionIdentifier const LookinAttrSec_AutoLayout_IntrinsicSize = @\"a_i\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Visibility = @\"v_v\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_InterationAndMasks = @\"v_i\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Corner = @\"v_c\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_BgColor = @\"v_b\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Border = @\"v_bo\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Shadow = @\"v_s\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_ContentMode = @\"v_co\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_TintColor = @\"v_t\";\nLookinAttrSectionIdentifier const LookinAttrSec_ViewLayer_Tag = @\"v_ta\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UIImageView_Name = @\"i_n\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIImageView_Open = @\"i_o\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UILabel_Text = @\"lb_t\";\nLookinAttrSectionIdentifier const LookinAttrSec_UILabel_Font = @\"lb_f\";\nLookinAttrSectionIdentifier const LookinAttrSec_UILabel_NumberOfLines = @\"lb_n\";\nLookinAttrSectionIdentifier const LookinAttrSec_UILabel_TextColor = @\"lb_tc\";\nLookinAttrSectionIdentifier const LookinAttrSec_UILabel_BreakMode = @\"lb_b\";\nLookinAttrSectionIdentifier const LookinAttrSec_UILabel_Alignment = @\"lb_a\";\nLookinAttrSectionIdentifier const LookinAttrSec_UILabel_CanAdjustFont = @\"lb_c\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UIControl_EnabledSelected = @\"c_e\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIControl_VerAlignment = @\"c_v\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIControl_HorAlignment = @\"c_h\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIControl_QMUIOutsideEdge = @\"c_o\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UIButton_ContentInsets = @\"b_c\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIButton_TitleInsets = @\"b_t\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIButton_ImageInsets = @\"b_i\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ContentInset = @\"s_c\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_AdjustedInset = @\"s_a\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_IndicatorInset = @\"s_i\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Offset = @\"s_o\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ContentSize = @\"s_cs\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Behavior = @\"s_b\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ShowsIndicator = @\"s_si\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Bounce = @\"s_bo\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ScrollPaging = @\"s_s\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_ContentTouches = @\"s_ct\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_Zoom = @\"s_z\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIScrollView_QMUIInitialInset = @\"s_ii\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UITableView_Style = @\"t_s\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITableView_SectionsNumber = @\"t_sn\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITableView_RowsNumber = @\"t_r\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITableView_SeparatorStyle = @\"t_ss\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITableView_SeparatorColor = @\"t_sc\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITableView_SeparatorInset = @\"t_si\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UITextView_Basic = @\"tv_b\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextView_Text = @\"tv_t\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextView_Font = @\"tv_f\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextView_TextColor = @\"tv_tc\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextView_Alignment = @\"tv_a\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextView_ContainerInset = @\"tv_c\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_Text = @\"tf_t\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_Placeholder = @\"tf_p\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_Font = @\"tf_f\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_TextColor = @\"tf_tc\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_Alignment = @\"tf_a\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_Clears = @\"tf_c\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_CanAdjustFont = @\"tf_ca\";\nLookinAttrSectionIdentifier const LookinAttrSec_UITextField_ClearButtonMode = @\"tf_cb\";\n\nLookinAttrSectionIdentifier const LookinAttrSec_UIVisualEffectView_Style = @\"ve_s\";\nLookinAttrSectionIdentifier const LookinAttrSec_UIVisualEffectView_QMUIForegroundColor = @\"ve_f\";\n\n#pragma mark - Attr\n\nLookinAttrIdentifier const LookinAttr_None = @\"n\";\n\nLookinAttrIdentifier const LookinAttr_Class_Class_Class = @\"c_c_c\";\n\nLookinAttrIdentifier const LookinAttr_Relation_Relation_Relation = @\"r_r_r\";\n\nLookinAttrIdentifier const LookinAttr_Layout_Frame_Frame = @\"l_f_f\";\nLookinAttrIdentifier const LookinAttr_Layout_Bounds_Bounds = @\"l_b_b\";\nLookinAttrIdentifier const LookinAttr_Layout_SafeArea_SafeArea = @\"l_s_s\";\nLookinAttrIdentifier const LookinAttr_Layout_Position_Position = @\"l_p_p\";\nLookinAttrIdentifier const LookinAttr_Layout_AnchorPoint_AnchorPoint = @\"l_a_a\";\n\nLookinAttrIdentifier const LookinAttr_AutoLayout_Hugging_Hor = @\"al_h_h\";\nLookinAttrIdentifier const LookinAttr_AutoLayout_Hugging_Ver = @\"al_h_v\";\nLookinAttrIdentifier const LookinAttr_AutoLayout_Resistance_Hor = @\"al_r_h\";\nLookinAttrIdentifier const LookinAttr_AutoLayout_Resistance_Ver = @\"al_r_v\";\nLookinAttrIdentifier const LookinAttr_AutoLayout_Constraints_Constraints = @\"al_c_c\";\nLookinAttrIdentifier const LookinAttr_AutoLayout_IntrinsicSize_Size = @\"cl_i_s\";\n\nLookinAttrIdentifier const LookinAttr_ViewLayer_Visibility_Hidden = @\"vl_v_h\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Visibility_Opacity = @\"vl_v_o\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_InterationAndMasks_Interaction = @\"vl_i_i\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_InterationAndMasks_MasksToBounds = @\"vl_i_m\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Corner_Radius = @\"vl_c_r\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_BgColor_BgColor = @\"vl_b_b\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Border_Color = @\"vl_b_c\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Border_Width = @\"vl_b_w\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_Color = @\"vl_s_c\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_Opacity = @\"vl_s_o\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_Radius = @\"vl_s_r\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_OffsetW = @\"vl_s_ow\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Shadow_OffsetH = @\"vl_s_oh\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_ContentMode_Mode = @\"vl_c_m\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_TintColor_Color = @\"vl_t_c\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_TintColor_Mode = @\"vl_t_m\";\nLookinAttrIdentifier const LookinAttr_ViewLayer_Tag_Tag = @\"vl_t_t\";\n\nLookinAttrIdentifier const LookinAttr_UIImageView_Name_Name = @\"iv_n_n\";\nLookinAttrIdentifier const LookinAttr_UIImageView_Open_Open = @\"iv_o_o\";\n\nLookinAttrIdentifier const LookinAttr_UILabel_Text_Text = @\"lb_t_t\";\nLookinAttrIdentifier const LookinAttr_UILabel_Font_Name = @\"lb_f_n\";\nLookinAttrIdentifier const LookinAttr_UILabel_Font_Size = @\"lb_f_s\";\nLookinAttrIdentifier const LookinAttr_UILabel_NumberOfLines_NumberOfLines = @\"lb_n_n\";\nLookinAttrIdentifier const LookinAttr_UILabel_TextColor_Color = @\"lb_t_c\";\nLookinAttrIdentifier const LookinAttr_UILabel_Alignment_Alignment = @\"lb_a_a\";\nLookinAttrIdentifier const LookinAttr_UILabel_BreakMode_Mode = @\"lb_b_m\";\nLookinAttrIdentifier const LookinAttr_UILabel_CanAdjustFont_CanAdjustFont = @\"lb_c_c\";\n\nLookinAttrIdentifier const LookinAttr_UIControl_EnabledSelected_Enabled = @\"ct_e_e\";\nLookinAttrIdentifier const LookinAttr_UIControl_EnabledSelected_Selected = @\"ct_e_s\";\nLookinAttrIdentifier const LookinAttr_UIControl_VerAlignment_Alignment = @\"ct_v_a\";\nLookinAttrIdentifier const LookinAttr_UIControl_HorAlignment_Alignment = @\"ct_h_a\";\nLookinAttrIdentifier const LookinAttr_UIControl_QMUIOutsideEdge_Edge = @\"ct_o_e\";\n\nLookinAttrIdentifier const LookinAttr_UIButton_ContentInsets_Insets = @\"bt_c_i\";\nLookinAttrIdentifier const LookinAttr_UIButton_TitleInsets_Insets = @\"bt_t_i\";\nLookinAttrIdentifier const LookinAttr_UIButton_ImageInsets_Insets = @\"bt_i_i\";\n\nLookinAttrIdentifier const LookinAttr_UIScrollView_Offset_Offset = @\"sv_o_o\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ContentSize_Size = @\"sv_c_s\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ContentInset_Inset = @\"sv_c_i\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_AdjustedInset_Inset = @\"sv_a_i\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_Behavior_Behavior = @\"sv_b_b\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_IndicatorInset_Inset = @\"sv_i_i\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ScrollPaging_ScrollEnabled = @\"sv_s_s\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ScrollPaging_PagingEnabled = @\"sv_s_p\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_Bounce_Ver = @\"sv_b_v\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_Bounce_Hor = @\"sv_b_h\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ShowsIndicator_Hor = @\"sv_h_h\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ShowsIndicator_Ver = @\"sv_s_v\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ContentTouches_Delay = @\"sv_c_d\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_ContentTouches_CanCancel = @\"sv_c_c\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_MinScale = @\"sv_z_mi\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_MaxScale = @\"sv_z_ma\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_Scale = @\"sv_z_s\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_Zoom_Bounce = @\"sv_z_b\";\nLookinAttrIdentifier const LookinAttr_UIScrollView_QMUIInitialInset_Inset = @\"sv_qi_i\";\n\nLookinAttrIdentifier const LookinAttr_UITableView_Style_Style = @\"tv_s_s\";\nLookinAttrIdentifier const LookinAttr_UITableView_SectionsNumber_Number = @\"tv_s_n\";\nLookinAttrIdentifier const LookinAttr_UITableView_RowsNumber_Number = @\"tv_r_n\";\nLookinAttrIdentifier const LookinAttr_UITableView_SeparatorInset_Inset = @\"tv_s_i\";\nLookinAttrIdentifier const LookinAttr_UITableView_SeparatorColor_Color = @\"tv_s_c\";\nLookinAttrIdentifier const LookinAttr_UITableView_SeparatorStyle_Style = @\"tv_ss_s\";\n\nLookinAttrIdentifier const LookinAttr_UITextView_Font_Name = @\"te_f_n\";\nLookinAttrIdentifier const LookinAttr_UITextView_Font_Size = @\"te_f_s\";\nLookinAttrIdentifier const LookinAttr_UITextView_Basic_Editable = @\"te_b_e\";\nLookinAttrIdentifier const LookinAttr_UITextView_Basic_Selectable = @\"te_b_s\";\nLookinAttrIdentifier const LookinAttr_UITextView_Text_Text = @\"te_t_t\";\nLookinAttrIdentifier const LookinAttr_UITextView_TextColor_Color = @\"te_t_c\";\nLookinAttrIdentifier const LookinAttr_UITextView_Alignment_Alignment = @\"te_a_a\";\nLookinAttrIdentifier const LookinAttr_UITextView_ContainerInset_Inset = @\"te_c_i\";\n\nLookinAttrIdentifier const LookinAttr_UITextField_Text_Text = @\"tf_t_t\";\nLookinAttrIdentifier const LookinAttr_UITextField_Placeholder_Placeholder = @\"tf_p_p\";\nLookinAttrIdentifier const LookinAttr_UITextField_Font_Name = @\"tf_f_n\";\nLookinAttrIdentifier const LookinAttr_UITextField_Font_Size = @\"tf_f_s\";\nLookinAttrIdentifier const LookinAttr_UITextField_TextColor_Color = @\"tf_t_c\";\nLookinAttrIdentifier const LookinAttr_UITextField_Alignment_Alignment = @\"tf_a_a\";\nLookinAttrIdentifier const LookinAttr_UITextField_Clears_ClearsOnBeginEditing = @\"tf_c_c\";\nLookinAttrIdentifier const LookinAttr_UITextField_Clears_ClearsOnInsertion = @\"tf_c_co\";\nLookinAttrIdentifier const LookinAttr_UITextField_CanAdjustFont_CanAdjustFont = @\"tf_c_ca\";\nLookinAttrIdentifier const LookinAttr_UITextField_CanAdjustFont_MinSize = @\"tf_c_m\";\nLookinAttrIdentifier const LookinAttr_UITextField_ClearButtonMode_Mode = @\"tf_cb_m\";\n\nLookinAttrIdentifier const LookinAttr_UIVisualEffectView_Style_Style = @\"ve_s_s\";\nLookinAttrIdentifier const LookinAttr_UIVisualEffectView_QMUIForegroundColor_Color = @\"ve_f_c\";\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttrType.h",
    "content": "//\n//  LookinAttrIdentifiers.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/12/1.\n//  https://lookin.work\n//\n\n\n\ntypedef NS_ENUM(NSInteger, LookinAttrType) {\n    LookinAttrTypeNone,\n    LookinAttrTypeVoid,\n    LookinAttrTypeChar,\n    LookinAttrTypeInt,\n    LookinAttrTypeShort,\n    LookinAttrTypeLong,\n    LookinAttrTypeLongLong,\n    LookinAttrTypeUnsignedChar,\n    LookinAttrTypeUnsignedInt,\n    LookinAttrTypeUnsignedShort,\n    LookinAttrTypeUnsignedLong,\n    LookinAttrTypeUnsignedLongLong,\n    LookinAttrTypeFloat,\n    LookinAttrTypeDouble,\n    LookinAttrTypeBOOL,\n    LookinAttrTypeSel,\n    LookinAttrTypeClass,\n    LookinAttrTypeCGPoint,\n    LookinAttrTypeCGVector,\n    LookinAttrTypeCGSize,\n    LookinAttrTypeCGRect,\n    LookinAttrTypeCGAffineTransform,\n    LookinAttrTypeUIEdgeInsets,\n    LookinAttrTypeUIOffset,\n    LookinAttrTypeNSString,\n    LookinAttrTypeEnumInt,\n    LookinAttrTypeEnumLong,\n    /// value 实际为 RGBA 数组，即 @[NSNumber, NSNumber, NSNumber, NSNumber]，NSNumber 范围是 0 ~ 1\n    LookinAttrTypeUIColor,\n    /// 业务需要根据具体的 AttrIdentifier 来解析\n    LookinAttrTypeCustomObj,\n};\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttribute.h",
    "content": "//\n//  LookinAttribute.h\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/11/17.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n\n\n#import \"LookinAttrIdentifiers.h\"\n#import \"LookinCodingValueType.h\"\n#import \"LookinAttrType.h\"\n\n@class LookinDisplayItem;\n\n@interface LookinAttribute : NSObject <NSSecureCoding, NSCopying>\n\n@property(nonatomic, copy) LookinAttrIdentifier identifier;\n\n/// 具体的值，需配合 attrType 属性来解析它\n@property(nonatomic, strong) id value;\n\n/// 标识 value 的具体类型（如 double / NSString /...）\n@property(nonatomic, assign) LookinAttrType attrType;\n\n#pragma mark - 以下属性不会参与 encode/decode\n\n/// 标识该 LookinAttribute 对象隶属于哪一个 LookinDisplayItem\n@property(nonatomic, weak) LookinDisplayItem *targetDisplayItem;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttribute.m",
    "content": "//\n//  LookinAttribute.m\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/11/17.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n\n\n#import \"LookinAttribute.h\"\n#import \"LookinDisplayItem.h\"\n\n@implementation LookinAttribute\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinAttribute *newAttr = [[LookinAttribute allocWithZone:zone] init];\n    newAttr.identifier = self.identifier;\n    newAttr.value = self.value;\n    newAttr.attrType = self.attrType;\n    return newAttr;\n}\n\n#pragma mark - <NSCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.identifier forKey:@\"identifier\"];\n    [aCoder encodeInteger:self.attrType forKey:@\"attrType\"];\n    [aCoder encodeObject:self.value forKey:@\"value\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.identifier = [aDecoder decodeObjectForKey:@\"identifier\"];\n        self.attrType = [aDecoder decodeIntegerForKey:@\"attrType\"];\n        self.value = [aDecoder decodeObjectForKey:@\"value\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttributeModification.h",
    "content": "//\n//  LookinAttributeModification.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/11/20.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n#import \"LookinAttrType.h\"\n\n@interface LookinAttributeModification : NSObject <NSSecureCoding>\n\n@property(nonatomic, assign) unsigned long targetOid;\n\n@property(nonatomic, assign) SEL setterSelector;\n@property(nonatomic, assign) SEL getterSelector;\n\n@property(nonatomic, assign) LookinAttrType attrType;\n@property(nonatomic, strong) id value;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttributeModification.m",
    "content": "//\n//  LookinAttributeModification.m\n//  Lookin\n//\n//  Created by Li Kai on 2018/11/20.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinAttributeModification.h\"\n\n@implementation LookinAttributeModification\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(self.targetOid) forKey:@\"targetOid\"];\n    [aCoder encodeObject:NSStringFromSelector(self.setterSelector) forKey:@\"setterSelector\"];\n    [aCoder encodeInteger:self.attrType forKey:@\"attrType\"];\n    [aCoder encodeObject:self.value forKey:@\"value\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.targetOid = [[aDecoder decodeObjectForKey:@\"targetOid\"] unsignedLongValue];\n        self.setterSelector = NSSelectorFromString([aDecoder decodeObjectForKey:@\"setterSelector\"]);\n        self.attrType = [aDecoder decodeIntegerForKey:@\"attrType\"];\n        self.value = [aDecoder decodeObjectForKey:@\"value\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttributesGroup.h",
    "content": "//\n//  LookinAttributesGroup.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/11/19.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n#import \"LookinAttrIdentifiers.h\"\n\n@class LookinAttributesSection;\n\n/**\n 在 Lookin 中，一个 LookinAttributesGroup 会被对应渲染为一张卡片\n \n 如果两个 attrGroup 有相同的 LookinAttrGroupIdentifier，则 isEqual: 返回 YES\n */\n@interface LookinAttributesGroup : NSObject <NSSecureCoding, NSCopying>\n\n@property(nonatomic, copy) LookinAttrGroupIdentifier identifier;\n\n@property(nonatomic, copy) NSArray<LookinAttributesSection *> *attrSections;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttributesGroup.m",
    "content": "//\n//  LookinAttributesGroup.m\n//  Lookin\n//\n//  Created by Li Kai on 2018/11/19.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinAttributesGroup.h\"\n#import \"LookinAttribute.h\"\n#import \"LookinAttributesSection.h\"\n\n#import \"NSArray+Lookin.h\"\n\n@implementation LookinAttributesGroup\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinAttributesGroup *newGroup = [[LookinAttributesGroup allocWithZone:zone] init];\n    newGroup.identifier = self.identifier;\n    newGroup.attrSections = [self.attrSections lookin_map:^id(NSUInteger idx, LookinAttributesSection *value) {\n        return value.copy;\n    }];\n    return newGroup;\n}\n\n#pragma mark - <NSCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.identifier forKey:@\"identifier\"];\n    [aCoder encodeObject:self.attrSections forKey:@\"attrSections\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.identifier = [aDecoder decodeObjectForKey:@\"identifier\"];\n        self.attrSections = [aDecoder decodeObjectForKey:@\"attrSections\"];\n    }\n    return self;\n}\n\n- (NSUInteger)hash {\n    return self.identifier.hash;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) {\n        return YES;\n    }\n    if (![object isKindOfClass:[LookinAttributesGroup class]]) {\n        return NO;\n    }\n    if (self.identifier == ((LookinAttributesGroup *)object).identifier) {\n        return YES;\n    }\n    return NO;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttributesSection.h",
    "content": "//\n//  LookinAttributesSection.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/3/2.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n#import \"LookinAttrIdentifiers.h\"\n\n@class LookinAttribute;\n\ntypedef NS_ENUM (NSInteger, LookinAttributesSectionStyle) {\n    LookinAttributesSectionStyleDefault,    // 每个 attr 独占一行\n    LookinAttributesSectionStyle0,  // frame 等卡片使用，前 4 个 attr 每行两个，之后每个 attr 在同一排，每个宽度为 1/4\n    LookinAttributesSectionStyle1,  // 第一个 attr 在第一排靠左，第二个 attr 在第一排靠右，之后的 attr 每个独占一行\n    LookinAttributesSectionStyle2   // 第一排独占一行，剩下的在同一行且均分宽度\n};\n\n@interface LookinAttributesSection : NSObject <NSSecureCoding, NSCopying>\n\n@property(nonatomic, copy) LookinAttrSectionIdentifier identifier;\n\n@property(nonatomic, copy) NSArray<LookinAttribute *> *attributes;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAttributesSection.m",
    "content": "//\n//  LookinAttributesSection.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/3/2.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinAttributesSection.h\"\n#import \"LookinAttribute.h\"\n\n#import \"NSArray+Lookin.h\"\n\n@implementation LookinAttributesSection\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinAttributesSection *newSection = [[LookinAttributesSection allocWithZone:zone] init];\n    newSection.identifier = self.identifier;\n    newSection.attributes = [self.attributes lookin_map:^id(NSUInteger idx, LookinAttribute *value) {\n        return value.copy;\n    }];\n    return newSection;\n}\n\n#pragma mark - <NSCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.identifier forKey:@\"identifier\"];\n    [aCoder encodeObject:self.attributes forKey:@\"attributes\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.identifier = [aDecoder decodeObjectForKey:@\"identifier\"];\n        self.attributes = [aDecoder decodeObjectForKey:@\"attributes\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAutoLayoutConstraint.h",
    "content": "//\n//  LookinAutoLayoutConstraint.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/9/28.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDefines.h\"\n\n@class LookinObject;\n\ntypedef NS_ENUM(NSInteger, LookinConstraintItemType) {\n    LookinConstraintItemTypeUnknown,\n    LookinConstraintItemTypeNil,\n    LookinConstraintItemTypeView,\n    LookinConstraintItemTypeSelf,\n    LookinConstraintItemTypeSuper,\n    LookinConstraintItemTypeLayoutGuide\n};\n\n@interface LookinAutoLayoutConstraint : NSObject <NSSecureCoding>\n\n#if TARGET_OS_IPHONE\n+ (instancetype)instanceFromNSConstraint:(NSLayoutConstraint *)constraint isEffective:(BOOL)isEffective firstItemType:(LookinConstraintItemType)firstItemType secondItemType:(LookinConstraintItemType)secondItemType;\n#endif\n\n@property(nonatomic, assign) BOOL effective;\n@property(nonatomic, assign) BOOL active;\n@property(nonatomic, assign) BOOL shouldBeArchived;\n@property(nonatomic, strong) LookinObject *firstItem;\n@property(nonatomic, assign) LookinConstraintItemType firstItemType;\n@property(nonatomic, assign) NSLayoutAttribute firstAttribute;\n@property(nonatomic, assign) NSLayoutRelation relation;\n@property(nonatomic, strong) LookinObject *secondItem;\n@property(nonatomic, assign) LookinConstraintItemType secondItemType;\n@property(nonatomic, assign) NSLayoutAttribute secondAttribute;\n@property(nonatomic, assign) CGFloat multiplier;\n@property(nonatomic, assign) CGFloat constant;\n@property(nonatomic, assign) CGFloat priority;\n@property(nonatomic, copy) NSString *identifier;\n\n+ (NSString *)descriptionWithItemObject:(LookinObject *)object type:(LookinConstraintItemType)type detailed:(BOOL)detailed;\n+ (NSString *)descriptionWithAttribute:(NSLayoutAttribute)attribute;\n+ (NSString *)symbolWithRelation:(NSLayoutRelation)relation;\n+ (NSString *)descriptionWithRelation:(NSLayoutRelation)relation;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinAutoLayoutConstraint.m",
    "content": "//\n//  LookinAutoLayoutConstraint.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/9/28.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinAutoLayoutConstraint.h\"\n#import \"LookinObject.h\"\n\n@implementation LookinAutoLayoutConstraint\n\n#if TARGET_OS_IPHONE\n\n+ (instancetype)instanceFromNSConstraint:(NSLayoutConstraint *)constraint isEffective:(BOOL)isEffective firstItemType:(LookinConstraintItemType)firstItemType secondItemType:(LookinConstraintItemType)secondItemType {\n    LookinAutoLayoutConstraint *instance = [LookinAutoLayoutConstraint new];\n    instance.effective = isEffective;\n    instance.active = constraint.active;\n    instance.shouldBeArchived = constraint.shouldBeArchived;\n    instance.firstItem = [LookinObject instanceWithObject:constraint.firstItem];\n    instance.firstItemType = firstItemType;\n    instance.firstAttribute = constraint.firstAttribute;\n    instance.relation = constraint.relation;\n    instance.secondItem = [LookinObject instanceWithObject:constraint.secondItem];\n    instance.secondItemType = secondItemType;\n    instance.secondAttribute = constraint.secondAttribute;\n    instance.multiplier = constraint.multiplier;\n    instance.constant = constraint.constant;\n    instance.priority = constraint.priority;\n    instance.identifier = constraint.identifier;\n    \n    return instance;\n}\n\n- (void)setFirstAttribute:(NSLayoutAttribute)firstAttribute {\n    _firstAttribute = firstAttribute;\n    [self _assertUnknownAttribute:firstAttribute];\n}\n\n- (void)setSecondAttribute:(NSLayoutAttribute)secondAttribute {\n    _secondAttribute = secondAttribute;\n    [self _assertUnknownAttribute:secondAttribute];\n}\n\n- (void)_assertUnknownAttribute:(NSLayoutAttribute)attribute {\n    // 以下几个 assert 用来帮助发现那些系统私有的定义，正式发布时应该去掉这几个 assert\n    if (attribute > 21 && attribute < 32) {\n        NSAssert(NO, nil);\n    }\n    if (attribute > 37) {\n        NSAssert(NO, nil);\n    }\n}\n\n#endif\n\n+ (NSString *)descriptionWithItemObject:(LookinObject *)object type:(LookinConstraintItemType)type detailed:(BOOL)detailed {\n    switch (type) {\n        case LookinConstraintItemTypeNil:\n            return detailed ? @\"Nil\" : @\"nil\";\n            \n        case LookinConstraintItemTypeSelf:\n            return detailed ? @\"Self\" : @\"self\";\n            \n        case LookinConstraintItemTypeSuper:\n            return detailed ? @\"Superview\" : @\"super\";\n            \n        case LookinConstraintItemTypeView:\n        case LookinConstraintItemTypeLayoutGuide:\n            return detailed ? [NSString stringWithFormat:@\"<%@: %@>\", object.shortSelfClassName, object.memoryAddress] : [NSString stringWithFormat:@\"(%@*)\", object.shortSelfClassName];\n            \n        default:\n            NSAssert(NO, @\"\");\n            return detailed ? [NSString stringWithFormat:@\"<%@: %@>\", object.shortSelfClassName, object.memoryAddress] : [NSString stringWithFormat:@\"(%@*)\", object.shortSelfClassName];\n    }\n}\n\n+ (NSString *)descriptionWithAttribute:(NSLayoutAttribute)attribute {\n    switch (attribute) {\n        case 0 :\n            // 在某些业务里确实会出现这种情况，在 Reveal 和 UI Debugger 里也是这么显示的\n            return @\"notAnAttribute\";\n        case 1:\n            return @\"left\";\n        case 2:\n            return @\"right\";\n        case 3:\n            return @\"top\";\n        case 4:\n            return @\"bottom\";\n        case 5:\n            return @\"leading\";\n        case 6:\n            return @\"trailing\";\n        case 7:\n            return @\"width\";\n        case 8:\n            return @\"height\";\n        case 9:\n            return @\"centerX\";\n        case 10:\n            return @\"centerY\";\n        case 11:\n            return @\"lastBaseline\";\n        case 12:\n            return @\"baseline\";\n        case 13:\n            return @\"firstBaseline\";\n        case 14:\n            return @\"leftMargin\";\n        case 15:\n            return @\"rightMargin\";\n        case 16:\n            return @\"topMargin\";\n        case 17:\n            return @\"bottomMargin\";\n        case 18:\n            return @\"leadingMargin\";\n        case 19:\n            return @\"trailingMargin\";\n        case 20:\n            return @\"centerXWithinMargins\";\n        case 21:\n            return @\"centerYWithinMargins\";\n            \n            // 以下都是和 AutoResizingMask 有关的，这里的定义是从系统 UI Debugger 里抄过来的，暂时没在官方文档里发现它们的公开定义\n        case 32:\n            return @\"minX\";\n        case 33:\n            return @\"minY\";\n        case 34:\n            return @\"midX\";\n        case 35:\n            return @\"midY\";\n        case 36:\n            return @\"maxX\";\n        case 37:\n            return @\"maxY\";\n        default:\n            NSAssert(NO, @\"\");\n            return [NSString stringWithFormat:@\"unknownAttr(%@)\", @(attribute)];\n    }\n}\n\n+ (NSString *)symbolWithRelation:(NSLayoutRelation)relation {\n    switch (relation) {\n        case -1:\n            return @\"<=\";\n        case 0:\n            return @\"=\";\n        case 1:\n            return @\">=\";\n        default:\n            NSAssert(NO, @\"\");\n            return @\"?\";\n    }\n}\n\n+ (NSString *)descriptionWithRelation:(NSLayoutRelation)relation {\n    switch (relation) {\n        case -1:\n            return @\"LessThanOrEqual\";\n        case 0:\n            return @\"Equal\";\n        case 1:\n            return @\"GreaterThanOrEqual\";\n        default:\n            NSAssert(NO, @\"\");\n            return @\"?\";\n    }\n}\n\n#pragma mark - <NSSecureCoding>\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeBool:self.effective forKey:@\"effective\"];\n    [aCoder encodeBool:self.active forKey:@\"active\"];\n    [aCoder encodeBool:self.shouldBeArchived forKey:@\"shouldBeArchived\"];\n    [aCoder encodeObject:self.firstItem forKey:@\"firstItem\"];\n    [aCoder encodeInteger:self.firstItemType forKey:@\"firstItemType\"];\n    [aCoder encodeInteger:self.firstAttribute forKey:@\"firstAttribute\"];\n    [aCoder encodeInteger:self.relation forKey:@\"relation\"];\n    [aCoder encodeObject:self.secondItem forKey:@\"secondItem\"];\n    [aCoder encodeInteger:self.secondItemType forKey:@\"secondItemType\"];\n    [aCoder encodeInteger:self.secondAttribute forKey:@\"secondAttribute\"];\n    [aCoder encodeDouble:self.multiplier forKey:@\"multiplier\"];\n    [aCoder encodeDouble:self.constant forKey:@\"constant\"];\n    [aCoder encodeDouble:self.priority forKey:@\"priority\"];\n    [aCoder encodeObject:self.identifier forKey:@\"identifier\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.effective = [aDecoder decodeBoolForKey:@\"effective\"];\n        self.active = [aDecoder decodeBoolForKey:@\"active\"];\n        self.shouldBeArchived = [aDecoder decodeBoolForKey:@\"shouldBeArchived\"];\n        self.firstItem = [aDecoder decodeObjectForKey:@\"firstItem\"];\n        self.firstItemType = [aDecoder decodeIntegerForKey:@\"firstItemType\"];\n        self.firstAttribute = [aDecoder decodeIntegerForKey:@\"firstAttribute\"];\n        self.relation = [aDecoder decodeIntegerForKey:@\"relation\"];\n        self.secondItem = [aDecoder decodeObjectForKey:@\"secondItem\"];\n        self.secondItemType = [aDecoder decodeIntegerForKey:@\"secondItemType\"];\n        self.secondAttribute = [aDecoder decodeIntegerForKey:@\"secondAttribute\"];\n        self.multiplier = [aDecoder decodeDoubleForKey:@\"multiplier\"];\n        self.constant = [aDecoder decodeDoubleForKey:@\"constant\"];\n        self.priority = [aDecoder decodeDoubleForKey:@\"priority\"];\n        self.identifier = [aDecoder decodeObjectForKey:@\"identifier\"];\n    }\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinCodingValueType.h",
    "content": "//\n//  LookinCodingValueType.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/2/13.\n//  https://lookin.work\n//\n\ntypedef NS_ENUM(NSInteger, LookinCodingValueType) {\n    LookinCodingValueTypeUnknown,\n    LookinCodingValueTypeChar,\n    LookinCodingValueTypeDouble,\n    LookinCodingValueTypeFloat,\n    LookinCodingValueTypeLongLong,\n//    LookinCodingValueTypePoint,\n//    LookinCodingValueTypeString,\n//    LookinCodingValueTypeStringArray,\n//    LookinCodingValueTypeEdgeInsets,\n//    LookinCodingValueTypeRect,\n    LookinCodingValueTypeBOOL,\n//    LookinCodingValueTypeSize,\n    LookinCodingValueTypeColor,\n    LookinCodingValueTypeEnum,\n//    LookinCodingValueTypeRange,\n    LookinCodingValueTypeImage\n};\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinConnectionAttachment.h",
    "content": "//\n//  LookinConnectionAttachment.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/2/15.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n#import \"LookinCodingValueType.h\"\n\n@interface LookinConnectionAttachment : NSObject <NSSecureCoding>\n\n@property(nonatomic, assign) LookinCodingValueType dataType;\n\n@property(nonatomic, strong) id data;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinConnectionAttachment.m",
    "content": "//\n//  LookinConnectionAttachment.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/2/15.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinConnectionAttachment.h\"\n#import \"LookinDefines.h\"\n#import \"NSObject+Lookin.h\"\n\nstatic NSString * const Key_Data = @\"0\";\nstatic NSString * const Key_DataType = @\"1\";\n\n@interface LookinConnectionAttachment ()\n\n@end\n\n@implementation LookinConnectionAttachment\n\n- (instancetype)init {\n    if (self = [super init]) {\n    }\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    \n    [aCoder encodeObject:[self.data lookin_encodedObjectWithType:self.dataType] forKey:Key_Data];\n    [aCoder encodeInteger:self.dataType forKey:Key_DataType];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.dataType = [aDecoder decodeIntegerForKey:Key_DataType];\n        self.data = [[aDecoder decodeObjectForKey:Key_Data] lookin_decodedObjectWithType:self.dataType];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinConnectionResponseAttachment.h",
    "content": "//\n//  LookinConnectionResponse.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/1/15.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n#import \"LookinConnectionAttachment.h\"\n\n@interface LookinConnectionResponseAttachment : LookinConnectionAttachment\n\n+ (instancetype)attachmentWithError:(NSError *)error;\n\n@property(nonatomic, assign) int lookinServerVersion;\n@property(nonatomic, assign) BOOL lookinServerIsExprimental;\n\n@property(nonatomic, strong) NSError *error;\n\n/// 如果为 YES，则表示 app 正处于后台模式，默认为 NO\n@property(nonatomic, assign) BOOL appIsInBackground;\n\n/**\n dataTotalCount 为 0 时表示仅有这一个 response，默认为 0\n dataTotalCount 大于 0 时表示可能有多个 response，当所有 response 的 currentDataCount 的总和大于 dataTotalCount 即表示所有 response 已接收完毕\n */\n@property(nonatomic, assign) NSUInteger dataTotalCount;\n@property(nonatomic, assign) NSUInteger currentDataCount;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinConnectionResponseAttachment.m",
    "content": "//\n//  LookinConnectionResponse.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/1/15.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinConnectionResponseAttachment.h\"\n#import \"LookinDefines.h\"\n\n@interface LookinConnectionResponseAttachment ()\n\n@end\n\n@implementation LookinConnectionResponseAttachment\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [super encodeWithCoder:aCoder];\n    [aCoder encodeInt:self.lookinServerVersion forKey:@\"lookinServerVersion\"];\n    [aCoder encodeObject:self.error forKey:@\"error\"];\n    [aCoder encodeObject:@(self.dataTotalCount) forKey:@\"dataTotalCount\"];\n    [aCoder encodeObject:@(self.currentDataCount) forKey:@\"currentDataCount\"];\n    [aCoder encodeBool:self.lookinServerIsExprimental forKey:@\"lookinServerIsExprimental\"];\n    [aCoder encodeBool:self.appIsInBackground forKey:@\"appIsInBackground\"];\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        self.lookinServerVersion = LOOKIN_SERVER_VERSION;\n        self.dataTotalCount = 0;\n        self.lookinServerIsExprimental = LOOKIN_SERVER_IS_EXPERIMENTAL;\n    }\n    return self;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super initWithCoder:aDecoder]) {\n        self.lookinServerVersion = [aDecoder decodeIntForKey:@\"lookinServerVersion\"];\n        self.lookinServerIsExprimental = [aDecoder decodeBoolForKey:@\"lookinServerIsExprimental\"];\n        self.error = [aDecoder decodeObjectForKey:@\"error\"];\n        self.dataTotalCount = [[aDecoder decodeObjectForKey:@\"dataTotalCount\"] unsignedIntegerValue];\n        self.currentDataCount = [[aDecoder decodeObjectForKey:@\"currentDataCount\"] unsignedIntegerValue];\n        self.appIsInBackground = [aDecoder decodeBoolForKey:@\"appIsInBackground\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n+ (instancetype)attachmentWithError:(NSError *)error {\n    LookinConnectionResponseAttachment *attachment = [LookinConnectionResponseAttachment new];\n    attachment.error = error;\n    return attachment;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinDashboardBlueprint.h",
    "content": "//\n//  LookinDashboardBlueprint.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/6/5.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n#import \"LookinAttrIdentifiers.h\"\n#import \"LookinAttrType.h\"\n\n/**\n 该对象定义了：\n - 每一个 Attr 的信息\n - 哪些 GroupID, SectionID, AttrID 是合法的\n - 这些 ID 的父子顺序，比如 LookinAttrGroup_Frame 包含哪些 Section\n - 这些 ID 展示顺序（比如哪个 Group 在前、哪个 Group 在后）\n */\n@interface LookinDashboardBlueprint : NSObject\n\n+ (NSArray<LookinAttrGroupIdentifier> *)groupIDs;\n\n+ (NSArray<LookinAttrSectionIdentifier> *)sectionIDsForGroupID:(LookinAttrGroupIdentifier)groupID;\n\n+ (NSArray<LookinAttrIdentifier> *)attrIDsForSectionID:(LookinAttrSectionIdentifier)sectionID;\n\n/// 返回包含目标 attr 的 groupID 和 sectionID\n+ (void)getHostGroupID:(inout LookinAttrGroupIdentifier *)groupID sectionID:(inout LookinAttrSectionIdentifier *)sectionID fromAttrID:(LookinAttrIdentifier)attrID;\n\n/// 返回某个 group 的标题\n+ (NSString *)groupTitleWithGroupID:(LookinAttrGroupIdentifier)groupID;\n\n/// 返回某个 section 的标题，nil 则表示不显示标题\n+ (NSString *)sectionTitleWithSectionID:(LookinAttrSectionIdentifier)secID;\n\n/// 当某个 LookinAttribute 确定是 NSObject 类型时，该方法返回它具体是什么对象，比如 UIColor 等\n+ (LookinAttrType)objectAttrTypeWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 返回某个 LookinAttribute 代表的属性是哪一个类拥有的，比如 LookinAttrSec_UILabel_TextColor 是 UILabel 才有的\n+ (NSString *)classNameWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 一个 attr 要么属于 UIView 要么属于 CALayer，如果它属于 UIView 那么该方法返回 YES\n+ (BOOL)isUIViewPropertyWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 如果某个 attribute 是 enum，则这里会返回相应的 enum 的名称（如 @\"NSTextAlignment\"），进而可通过这个名称查询可用的枚举值列表\n+ (NSString *)enumListNameWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 如果返回 YES，则说明用户在 Lookin 里修改了该 Attribute 的值后，应该重新拉取和更新相关图层的位置、截图等信息\n+ (BOOL)needPatchAfterModificationWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 完整的名字\n+ (NSString *)fullTitleWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 在某些 textField 和 checkbox 里会显示这里返回的 title\n+ (NSString *)briefTitleWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 获取 getter 方法\n+ (SEL)getterWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 获取 setter 方法\n+ (SEL)setterWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 获取 “hideIfNil” 的值。如果为 YES，则当读取 getter 获取的 value 为 nil 时，Lookin 不会传输该 attr\n/// 如果为 NO，则即使 value 为 nil 也会传输（比如 label 的 text 属性，即使它是 nil 我们也要显示，所以它的 hideIfNil 应该为 NO）\n+ (BOOL)hideIfNilWithAttrID:(LookinAttrIdentifier)attrID;\n\n/// 该属性需要的最低的 iOS 版本，比如 safeAreaInsets 从 iOS 11.0 开始出现，则该方法返回 11，如果返回 0 则表示不限制 iOS 版本（注意 Lookin 项目仅支持 iOS 8.0+）\n+ (NSInteger)minAvailableOSVersionWithAttrID:(LookinAttrIdentifier)attrID;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinDashboardBlueprint.m",
    "content": "//\n//  LookinDashboardBlueprint.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/6/5.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDashboardBlueprint.h\"\n\n@implementation LookinDashboardBlueprint\n\n+ (NSArray<LookinAttrGroupIdentifier> *)groupIDs {\n    static NSArray<LookinAttrGroupIdentifier> *array;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken,^{\n        array = @[\n                  LookinAttrGroup_Class,\n                  LookinAttrGroup_Relation,\n                  LookinAttrGroup_Layout,\n                  LookinAttrGroup_AutoLayout,\n                  LookinAttrGroup_ViewLayer,\n                  LookinAttrGroup_UIVisualEffectView,\n                  LookinAttrGroup_UIImageView,\n                  LookinAttrGroup_UILabel,\n                  LookinAttrGroup_UIControl,\n                  LookinAttrGroup_UIButton,\n                  LookinAttrGroup_UIScrollView,\n                  LookinAttrGroup_UITableView,\n                  LookinAttrGroup_UITextView,\n                  LookinAttrGroup_UITextField\n                  ];\n    });\n    return array;\n}\n\n+ (NSArray<LookinAttrSectionIdentifier> *)sectionIDsForGroupID:(LookinAttrGroupIdentifier)groupID {\n    static NSDictionary<LookinAttrGroupIdentifier, NSArray<LookinAttrSectionIdentifier> *> *dict;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken,^{\n        dict = @{\n                 LookinAttrGroup_Class: @[LookinAttrSec_Class_Class],\n                 \n                 LookinAttrGroup_Relation: @[LookinAttrSec_Relation_Relation],\n                 \n                 LookinAttrGroup_Layout: @[LookinAttrSec_Layout_Frame,\n                                           LookinAttrSec_Layout_Bounds,\n                                           LookinAttrSec_Layout_SafeArea,\n                                           LookinAttrSec_Layout_Position,\n                                           LookinAttrSec_Layout_AnchorPoint],\n                 \n                 LookinAttrGroup_AutoLayout: @[LookinAttrSec_AutoLayout_Constraints,\n                                               LookinAttrSec_AutoLayout_IntrinsicSize,\n                                               LookinAttrSec_AutoLayout_Hugging,\n                                               LookinAttrSec_AutoLayout_Resistance],\n                 \n                 LookinAttrGroup_ViewLayer: @[\n                         LookinAttrSec_ViewLayer_Visibility,\n                         LookinAttrSec_ViewLayer_InterationAndMasks,\n                         LookinAttrSec_ViewLayer_BgColor,\n                         LookinAttrSec_ViewLayer_Border,\n                         LookinAttrSec_ViewLayer_Corner,\n                         LookinAttrSec_ViewLayer_Shadow,\n                         LookinAttrSec_ViewLayer_ContentMode,\n                         LookinAttrSec_ViewLayer_TintColor,\n                         LookinAttrSec_ViewLayer_Tag\n                         ],\n                 \n                 LookinAttrGroup_UIVisualEffectView: @[\n                         LookinAttrSec_UIVisualEffectView_Style,\n                         LookinAttrSec_UIVisualEffectView_QMUIForegroundColor\n                 ],\n                 \n                 LookinAttrGroup_UIImageView: @[LookinAttrSec_UIImageView_Name,\n                                                LookinAttrSec_UIImageView_Open],\n                 \n                 LookinAttrGroup_UILabel: @[\n                         LookinAttrSec_UILabel_Text,\n                         LookinAttrSec_UILabel_Font,\n                         LookinAttrSec_UILabel_NumberOfLines,\n                         LookinAttrSec_UILabel_TextColor,\n                         LookinAttrSec_UILabel_BreakMode,\n                         LookinAttrSec_UILabel_Alignment,\n                         LookinAttrSec_UILabel_CanAdjustFont],\n                 \n                 LookinAttrGroup_UIControl: @[LookinAttrSec_UIControl_EnabledSelected,\n                                              LookinAttrSec_UIControl_QMUIOutsideEdge,\n                                              LookinAttrSec_UIControl_VerAlignment,\n                                              LookinAttrSec_UIControl_HorAlignment],\n                 \n                 LookinAttrGroup_UIButton: @[LookinAttrSec_UIButton_ContentInsets,\n                                             LookinAttrSec_UIButton_TitleInsets,\n                                             LookinAttrSec_UIButton_ImageInsets],\n                 \n                 LookinAttrGroup_UIScrollView: @[LookinAttrSec_UIScrollView_ContentInset,\n                                                 LookinAttrSec_UIScrollView_AdjustedInset,\n                                                 LookinAttrSec_UIScrollView_QMUIInitialInset,\n                                                 LookinAttrSec_UIScrollView_IndicatorInset,\n                                                 LookinAttrSec_UIScrollView_Offset,\n                                                 LookinAttrSec_UIScrollView_ContentSize,\n                                                 LookinAttrSec_UIScrollView_Behavior,\n                                                 LookinAttrSec_UIScrollView_ShowsIndicator,\n                                                 LookinAttrSec_UIScrollView_Bounce,\n                                                 LookinAttrSec_UIScrollView_ScrollPaging,\n                                                 LookinAttrSec_UIScrollView_ContentTouches,\n                                                 LookinAttrSec_UIScrollView_Zoom],\n                 \n                 LookinAttrGroup_UITableView: @[LookinAttrSec_UITableView_Style,\n                                                LookinAttrSec_UITableView_SectionsNumber,\n                                                LookinAttrSec_UITableView_RowsNumber,\n                                                LookinAttrSec_UITableView_SeparatorStyle,\n                                                LookinAttrSec_UITableView_SeparatorColor,\n                                                LookinAttrSec_UITableView_SeparatorInset],\n                 \n                 LookinAttrGroup_UITextView: @[LookinAttrSec_UITextView_Basic,\n                                               LookinAttrSec_UITextView_Text,\n                                               LookinAttrSec_UITextView_Font,\n                                               LookinAttrSec_UITextView_TextColor,\n                                               LookinAttrSec_UITextView_Alignment,\n                                               LookinAttrSec_UITextView_ContainerInset],\n                 \n                 LookinAttrGroup_UITextField: @[LookinAttrSec_UITextField_Text,\n                                                LookinAttrSec_UITextField_Placeholder,\n                                                LookinAttrSec_UITextField_Font,\n                                                LookinAttrSec_UITextField_TextColor,\n                                                LookinAttrSec_UITextField_Alignment,\n                                                LookinAttrSec_UITextField_Clears,\n                                                LookinAttrSec_UITextField_CanAdjustFont,\n                                                LookinAttrSec_UITextField_ClearButtonMode],\n                 \n                 };\n    });\n    return dict[groupID];\n}\n\n+ (NSArray<LookinAttrIdentifier> *)attrIDsForSectionID:(LookinAttrSectionIdentifier)sectionID {\n    static NSDictionary<LookinAttrSectionIdentifier, NSArray<LookinAttrIdentifier> *> *dict;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken,^{\n        dict = @{\n                 LookinAttrSec_Class_Class: @[LookinAttr_Class_Class_Class],\n                 \n                 LookinAttrSec_Relation_Relation: @[LookinAttr_Relation_Relation_Relation],\n                 \n                 LookinAttrSec_Layout_Frame: @[LookinAttr_Layout_Frame_Frame],\n                 LookinAttrSec_Layout_Bounds: @[LookinAttr_Layout_Bounds_Bounds],\n                 LookinAttrSec_Layout_SafeArea: @[LookinAttr_Layout_SafeArea_SafeArea],\n                 LookinAttrSec_Layout_Position: @[LookinAttr_Layout_Position_Position],\n                 LookinAttrSec_Layout_AnchorPoint: @[LookinAttr_Layout_AnchorPoint_AnchorPoint],\n                 \n                 LookinAttrSec_AutoLayout_Hugging: @[LookinAttr_AutoLayout_Hugging_Hor,\n                                                     LookinAttr_AutoLayout_Hugging_Ver],\n                 LookinAttrSec_AutoLayout_Resistance: @[LookinAttr_AutoLayout_Resistance_Hor,\n                                                        LookinAttr_AutoLayout_Resistance_Ver],\n                 LookinAttrSec_AutoLayout_Constraints: @[LookinAttr_AutoLayout_Constraints_Constraints],\n                 LookinAttrSec_AutoLayout_IntrinsicSize: @[LookinAttr_AutoLayout_IntrinsicSize_Size],\n                 \n                 LookinAttrSec_ViewLayer_Visibility: @[LookinAttr_ViewLayer_Visibility_Hidden,\n                                                       LookinAttr_ViewLayer_Visibility_Opacity],\n                 \n                 LookinAttrSec_ViewLayer_InterationAndMasks: @[LookinAttr_ViewLayer_InterationAndMasks_Interaction,\n                                                               LookinAttr_ViewLayer_InterationAndMasks_MasksToBounds],\n                 \n                 LookinAttrSec_ViewLayer_Corner: @[LookinAttr_ViewLayer_Corner_Radius],\n                 \n                 LookinAttrSec_ViewLayer_BgColor: @[LookinAttr_ViewLayer_BgColor_BgColor],\n                 \n                 LookinAttrSec_ViewLayer_Border: @[LookinAttr_ViewLayer_Border_Color,\n                                                   LookinAttr_ViewLayer_Border_Width],\n                 \n                 LookinAttrSec_ViewLayer_Shadow: @[LookinAttr_ViewLayer_Shadow_Color,\n                                                   LookinAttr_ViewLayer_Shadow_Opacity,\n                                                   LookinAttr_ViewLayer_Shadow_Radius,\n                                                   LookinAttr_ViewLayer_Shadow_OffsetW,\n                                                   LookinAttr_ViewLayer_Shadow_OffsetH],\n                 \n                 LookinAttrSec_ViewLayer_ContentMode: @[LookinAttr_ViewLayer_ContentMode_Mode],\n                 \n                 LookinAttrSec_ViewLayer_TintColor: @[LookinAttr_ViewLayer_TintColor_Color,\n                                                      LookinAttr_ViewLayer_TintColor_Mode],\n                 \n                 LookinAttrSec_ViewLayer_Tag: @[LookinAttr_ViewLayer_Tag_Tag],\n                 \n                 LookinAttrSec_UIVisualEffectView_Style: @[LookinAttr_UIVisualEffectView_Style_Style],\n                 \n                 LookinAttrSec_UIVisualEffectView_QMUIForegroundColor: @[LookinAttr_UIVisualEffectView_QMUIForegroundColor_Color],\n                 \n                 LookinAttrSec_UIImageView_Name: @[LookinAttr_UIImageView_Name_Name],\n                 \n                 LookinAttrSec_UIImageView_Open: @[LookinAttr_UIImageView_Open_Open],\n                 \n                 LookinAttrSec_UILabel_Font: @[LookinAttr_UILabel_Font_Name,\n                                               LookinAttr_UILabel_Font_Size],\n                 \n                 LookinAttrSec_UILabel_NumberOfLines: @[LookinAttr_UILabel_NumberOfLines_NumberOfLines],\n                 \n                 LookinAttrSec_UILabel_Text: @[LookinAttr_UILabel_Text_Text],\n                 \n                 LookinAttrSec_UILabel_TextColor: @[LookinAttr_UILabel_TextColor_Color],\n                 \n                 LookinAttrSec_UILabel_BreakMode: @[LookinAttr_UILabel_BreakMode_Mode],\n                 \n                 LookinAttrSec_UILabel_Alignment: @[LookinAttr_UILabel_Alignment_Alignment],\n                 \n                 LookinAttrSec_UILabel_CanAdjustFont: @[LookinAttr_UILabel_CanAdjustFont_CanAdjustFont],\n                 \n                 LookinAttrSec_UIControl_EnabledSelected: @[LookinAttr_UIControl_EnabledSelected_Enabled,\n                                                            LookinAttr_UIControl_EnabledSelected_Selected],\n                 \n                 LookinAttrSec_UIControl_QMUIOutsideEdge: @[LookinAttr_UIControl_QMUIOutsideEdge_Edge],\n                 \n                 LookinAttrSec_UIControl_VerAlignment: @[LookinAttr_UIControl_VerAlignment_Alignment],\n                 \n                 LookinAttrSec_UIControl_HorAlignment: @[LookinAttr_UIControl_HorAlignment_Alignment],\n                 \n                 LookinAttrSec_UIButton_ContentInsets: @[LookinAttr_UIButton_ContentInsets_Insets],\n                 \n                 LookinAttrSec_UIButton_TitleInsets: @[LookinAttr_UIButton_TitleInsets_Insets],\n                 \n                 LookinAttrSec_UIButton_ImageInsets: @[LookinAttr_UIButton_ImageInsets_Insets],\n                 \n                 LookinAttrSec_UIScrollView_ContentInset: @[LookinAttr_UIScrollView_ContentInset_Inset],\n                 \n                 LookinAttrSec_UIScrollView_AdjustedInset: @[LookinAttr_UIScrollView_AdjustedInset_Inset],\n                 \n                 LookinAttrSec_UIScrollView_QMUIInitialInset: @[LookinAttr_UIScrollView_QMUIInitialInset_Inset],\n                 \n                 LookinAttrSec_UIScrollView_IndicatorInset: @[LookinAttr_UIScrollView_IndicatorInset_Inset],\n                 \n                 LookinAttrSec_UIScrollView_Offset: @[LookinAttr_UIScrollView_Offset_Offset],\n                 \n                 LookinAttrSec_UIScrollView_ContentSize: @[LookinAttr_UIScrollView_ContentSize_Size],\n                 \n                 LookinAttrSec_UIScrollView_Behavior: @[LookinAttr_UIScrollView_Behavior_Behavior],\n                 \n                 LookinAttrSec_UIScrollView_ShowsIndicator: @[LookinAttr_UIScrollView_ShowsIndicator_Hor,\n                                                              LookinAttr_UIScrollView_ShowsIndicator_Ver],\n                 \n                 LookinAttrSec_UIScrollView_Bounce: @[LookinAttr_UIScrollView_Bounce_Hor,\n                                                      LookinAttr_UIScrollView_Bounce_Ver],\n                 \n                 LookinAttrSec_UIScrollView_ScrollPaging: @[LookinAttr_UIScrollView_ScrollPaging_ScrollEnabled,\n                                                            LookinAttr_UIScrollView_ScrollPaging_PagingEnabled],\n                 \n                 LookinAttrSec_UIScrollView_ContentTouches: @[LookinAttr_UIScrollView_ContentTouches_Delay,\n                                                              LookinAttr_UIScrollView_ContentTouches_CanCancel],\n                 \n                 LookinAttrSec_UIScrollView_Zoom: @[LookinAttr_UIScrollView_Zoom_Bounce,\n                                                    LookinAttr_UIScrollView_Zoom_Scale,\n                                                    LookinAttr_UIScrollView_Zoom_MinScale,\n                                                    LookinAttr_UIScrollView_Zoom_MaxScale],\n                 \n                 LookinAttrSec_UITableView_Style: @[LookinAttr_UITableView_Style_Style],\n                 \n                 LookinAttrSec_UITableView_SectionsNumber: @[LookinAttr_UITableView_SectionsNumber_Number],\n                 \n                 LookinAttrSec_UITableView_RowsNumber: @[LookinAttr_UITableView_RowsNumber_Number],\n                 \n                 LookinAttrSec_UITableView_SeparatorInset: @[LookinAttr_UITableView_SeparatorInset_Inset],\n                 \n                 LookinAttrSec_UITableView_SeparatorColor: @[LookinAttr_UITableView_SeparatorColor_Color],\n                 \n                 LookinAttrSec_UITableView_SeparatorStyle: @[LookinAttr_UITableView_SeparatorStyle_Style],\n                 \n                 LookinAttrSec_UITextView_Basic: @[LookinAttr_UITextView_Basic_Editable,\n                                                   LookinAttr_UITextView_Basic_Selectable],\n                 \n                 LookinAttrSec_UITextView_Text: @[LookinAttr_UITextView_Text_Text],\n                 \n                 LookinAttrSec_UITextView_Font: @[LookinAttr_UITextView_Font_Name,\n                                                  LookinAttr_UITextView_Font_Size],\n                 \n                 LookinAttrSec_UITextView_TextColor: @[LookinAttr_UITextView_TextColor_Color],\n                 \n                 LookinAttrSec_UITextView_Alignment: @[LookinAttr_UITextView_Alignment_Alignment],\n                 \n                 LookinAttrSec_UITextView_ContainerInset: @[LookinAttr_UITextView_ContainerInset_Inset],\n                 \n                 LookinAttrSec_UITextField_Text: @[LookinAttr_UITextField_Text_Text],\n                 \n                 LookinAttrSec_UITextField_Placeholder: @[LookinAttr_UITextField_Placeholder_Placeholder],\n                 \n                 LookinAttrSec_UITextField_Font: @[LookinAttr_UITextField_Font_Name,\n                                                   LookinAttr_UITextField_Font_Size],\n                 \n                 LookinAttrSec_UITextField_TextColor: @[LookinAttr_UITextField_TextColor_Color],\n                 \n                 LookinAttrSec_UITextField_Alignment: @[LookinAttr_UITextField_Alignment_Alignment],\n                 \n                 LookinAttrSec_UITextField_Clears: @[LookinAttr_UITextField_Clears_ClearsOnBeginEditing,\n                                                     LookinAttr_UITextField_Clears_ClearsOnInsertion],\n                 \n                 LookinAttrSec_UITextField_CanAdjustFont: @[LookinAttr_UITextField_CanAdjustFont_CanAdjustFont,\n                                                            LookinAttr_UITextField_CanAdjustFont_MinSize],\n                 \n                 LookinAttrSec_UITextField_ClearButtonMode: @[LookinAttr_UITextField_ClearButtonMode_Mode]\n                 };\n    });\n    return dict[sectionID];\n}\n\n+ (void)getHostGroupID:(inout LookinAttrGroupIdentifier *)groupID_inout sectionID:(inout LookinAttrSectionIdentifier *)sectionID_inout fromAttrID:(LookinAttrIdentifier)targetAttrID {\n    __block LookinAttrGroupIdentifier targetGroupID = nil;\n    __block LookinAttrSectionIdentifier targetSecID = nil;\n    [[self groupIDs] enumerateObjectsUsingBlock:^(LookinAttrGroupIdentifier _Nonnull groupID, NSUInteger idx, BOOL * _Nonnull stop0) {\n        [[self sectionIDsForGroupID:groupID] enumerateObjectsUsingBlock:^(LookinAttrSectionIdentifier _Nonnull secID, NSUInteger idx, BOOL * _Nonnull stop1) {\n            [[self attrIDsForSectionID:secID] enumerateObjectsUsingBlock:^(LookinAttrIdentifier _Nonnull attrID, NSUInteger idx, BOOL * _Nonnull stop2) {\n                if ([attrID isEqualToString:targetAttrID]) {\n                    targetGroupID = groupID;\n                    targetSecID = secID;\n                    *stop0 = YES;\n                    *stop1 = YES;\n                    *stop2 = YES;\n                }\n            }];\n        }];\n    }];\n    \n    if (groupID_inout && targetGroupID) {\n        *groupID_inout = targetGroupID;\n    }\n    if (sectionID_inout && targetSecID) {\n        *sectionID_inout = targetSecID;\n    }\n}\n\n+ (NSString *)groupTitleWithGroupID:(LookinAttrGroupIdentifier)groupID {\n    static dispatch_once_t onceToken;\n    static NSDictionary *rawInfo = nil;\n    dispatch_once(&onceToken,^{\n        rawInfo = @{\n                    LookinAttrGroup_Class: @\"Class\",\n                    LookinAttrGroup_Relation: @\"Relation\",\n                    LookinAttrGroup_Layout: @\"Layout\",\n                    LookinAttrGroup_AutoLayout: @\"AutoLayout\",\n                    LookinAttrGroup_ViewLayer: @\"CALayer / UIView\",\n                    LookinAttrGroup_UIImageView: @\"UIImageView\",\n                    LookinAttrGroup_UILabel: @\"UILabel\",\n                    LookinAttrGroup_UIControl: @\"UIControl\",\n                    LookinAttrGroup_UIButton: @\"UIButton\",\n                    LookinAttrGroup_UIScrollView: @\"UIScrollView\",\n                    LookinAttrGroup_UITableView: @\"UITableView\",\n                    LookinAttrGroup_UITextView: @\"UITextView\",\n                    LookinAttrGroup_UITextField: @\"UITextField\",\n                    LookinAttrGroup_UIVisualEffectView: @\"UIVisualEffectView\"\n                    };\n    });\n    NSString *title = rawInfo[groupID];\n    NSAssert(title.length, @\"\");\n    return title;\n}\n\n+ (NSString *)sectionTitleWithSectionID:(LookinAttrSectionIdentifier)secID {\n    static dispatch_once_t onceToken;\n    static NSDictionary *rawInfo = nil;\n    dispatch_once(&onceToken,^{\n        rawInfo = @{\n                    LookinAttrSec_Layout_Frame: @\"Frame\",\n                    LookinAttrSec_Layout_Bounds: @\"Bounds\",\n                    LookinAttrSec_Layout_SafeArea: @\"SafeArea\",\n                    LookinAttrSec_Layout_Position: @\"Position\",\n                    LookinAttrSec_Layout_AnchorPoint: @\"AnchorPoint\",\n                    LookinAttrSec_AutoLayout_Hugging: @\"HuggingPriority\",\n                    LookinAttrSec_AutoLayout_Resistance: @\"ResistancePriority\",\n                    LookinAttrSec_AutoLayout_IntrinsicSize: @\"IntrinsicSize\",\n                    LookinAttrSec_ViewLayer_Corner: @\"CornerRadius\",\n                    LookinAttrSec_ViewLayer_BgColor: @\"BackgroundColor\",\n                    LookinAttrSec_ViewLayer_Border: @\"Border\",\n                    LookinAttrSec_ViewLayer_Shadow: @\"Shadow\",\n                    LookinAttrSec_ViewLayer_ContentMode: @\"ContentMode\",\n                    LookinAttrSec_ViewLayer_TintColor: @\"TintColor\",\n                    LookinAttrSec_ViewLayer_Tag: @\"Tag\",\n                    LookinAttrSec_UIVisualEffectView_Style: @\"Style\",\n                    LookinAttrSec_UIVisualEffectView_QMUIForegroundColor: @\"ForegroundColor\",\n                    LookinAttrSec_UIImageView_Name: @\"ImageName\",\n                    LookinAttrSec_UILabel_TextColor: @\"TextColor\",\n                    LookinAttrSec_UITextView_TextColor: @\"TextColor\",\n                    LookinAttrSec_UITextField_TextColor: @\"TextColor\",\n                    LookinAttrSec_UILabel_BreakMode: @\"LineBreakMode\",\n                    LookinAttrSec_UILabel_NumberOfLines: @\"NumberOfLines\",\n                    LookinAttrSec_UILabel_Text: @\"Text\",\n                    LookinAttrSec_UITextView_Text: @\"Text\",\n                    LookinAttrSec_UITextField_Text: @\"Text\",\n                    LookinAttrSec_UITextField_Placeholder: @\"Placeholder\",\n                    LookinAttrSec_UILabel_Alignment: @\"TextAlignment\",\n                    LookinAttrSec_UITextView_Alignment: @\"TextAlignment\",\n                    LookinAttrSec_UITextField_Alignment: @\"TextAlignment\",\n                    LookinAttrSec_UIControl_HorAlignment: @\"HorizontalAlignment\",\n                    LookinAttrSec_UIControl_VerAlignment: @\"VerticalAlignment\",\n                    LookinAttrSec_UIControl_QMUIOutsideEdge: @\"QMUI_outsideEdge\",\n                    LookinAttrSec_UIButton_ContentInsets: @\"ContentInsets\",\n                    LookinAttrSec_UIButton_TitleInsets: @\"TitleInsets\",\n                    LookinAttrSec_UIButton_ImageInsets: @\"ImageInsets\",\n                    LookinAttrSec_UIScrollView_QMUIInitialInset: @\"QMUI_initialContentInset\",\n                    LookinAttrSec_UIScrollView_ContentInset: @\"ContentInset\",\n                    LookinAttrSec_UIScrollView_AdjustedInset: @\"AdjustedContentInset\",\n                    LookinAttrSec_UIScrollView_IndicatorInset: @\"ScrollIndicatorInsets\",\n                    LookinAttrSec_UIScrollView_Offset: @\"ContentOffset\",\n                    LookinAttrSec_UIScrollView_ContentSize: @\"ContentSize\",\n                    LookinAttrSec_UIScrollView_Behavior: @\"InsetAdjustmentBehavior\",\n                    LookinAttrSec_UIScrollView_ShowsIndicator: @\"ShowsScrollIndicator\",\n                    LookinAttrSec_UIScrollView_Bounce: @\"AlwaysBounce\",\n                    LookinAttrSec_UIScrollView_Zoom: @\"Zoom\",\n                    LookinAttrSec_UITableView_Style: @\"Style\",\n                    LookinAttrSec_UITableView_SectionsNumber: @\"NumberOfSections\",\n                    LookinAttrSec_UITableView_RowsNumber: @\"NumberOfRows\",\n                    LookinAttrSec_UITableView_SeparatorColor: @\"SeparatorColor\",\n                    LookinAttrSec_UITableView_SeparatorInset: @\"SeparatorInset\",\n                    LookinAttrSec_UITableView_SeparatorStyle: @\"SeparatorStyle\",\n                    LookinAttrSec_UILabel_Font: @\"Font\",\n                    LookinAttrSec_UITextField_Font: @\"Font\",\n                    LookinAttrSec_UITextView_Font: @\"Font\",\n                    LookinAttrSec_UITextView_ContainerInset: @\"ContainerInset\",\n                    LookinAttrSec_UITextField_ClearButtonMode: @\"ClearButtonMode\",\n                    };\n    });\n    return rawInfo[secID];\n}\n\n/**\n className: 必填项，标识该属性是哪一个类拥有的\n \n fullTitle: 完整的名字，将作为搜索的 keywords，也会展示在搜索结果中，如果为 nil 则不会被搜索到\n \n briefTitle：简略的名字，仅 checkbox 和那种自带标题的 input 才需要这个属性，如果需要该属性但该属性又为空，则会读取 fullTitle\n \n setterString：用户试图修改属性值时会用到，若该字段为空字符串（即 @“”）则该属性不可修改，若该字段为 nil 则会在 fullTitle 的基础上自动生成（自动改首字母大小写、加前缀后缀，比如 alpha 会被转换为 setAlpha:）\n \n getterString：必填项，业务中读取属性值时会用到。如果该字段为 nil ，则会在 fullTitle 的基础上自动生成（自动把 fullTitle 的第一个字母改成小写，比如 Alpha 会被转换为 alpha）。如果该字段为空字符串（比如 image_open_open）则属性值会被固定为 nil，attrType 会被指为 LookinAttrTypeCustomObj\n \n typeIfObj：当某个 LookinAttribute 确定是 NSObject 类型时，该方法返回它具体是什么对象，比如 UIColor、NSString\n \n enumList：如果某个 attribute 是 enum，则这里标识了相应的 enum 的名称（如 \"NSTextAlignment\"），业务可通过这个名称进而查询可用的枚举值列表\n \n patch：如果为 YES，则用户修改了该 Attribute 的值后，Lookin 会重新拉取和更新相关图层的位置、截图等信息，如果为 nil 则默认是 NO\n \n hideIfNil：如果为 YES，则当获取的 value 为 nil 时，Lookin 不会传输该 attr。如果为 NO，则即使 value 为 nil 也会传输（比如 label 的 text 属性，即使它是 nil 我们也要显示，所以它的 hideIfNil 应该为 NO）。如果该字段为 nil 则默认是 NO\n \n osVersion: 该属性需要的最低的 iOS 版本，比如 safeAreaInsets 从 iOS 11.0 开始出现，则该属性应该为 @11，如果为 nil 则表示不限制 iOS 版本（注意 Lookin 项目仅支持 iOS 8.0+）\n \n */\n+ (NSDictionary<NSString *, id> *)_infoForAttrID:(LookinAttrIdentifier)attrID {\n    static NSDictionary<LookinAttrIdentifier, NSDictionary<NSString *, id> *> *dict;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken,^{\n        dict = @{\n                 LookinAttr_Class_Class_Class: @{\n                         @\"className\": @\"CALayer\",\n                         @\"getterString\": @\"lks_relatedClassChainList\",\n                         @\"setterString\": @\"\",\n                         @\"typeIfObj\": @(LookinAttrTypeCustomObj)\n                         },\n                 \n                 LookinAttr_Relation_Relation_Relation: @{\n                         @\"className\": @\"CALayer\",\n                         @\"getterString\": @\"lks_selfRelation\",\n                         @\"setterString\": @\"\",\n                         @\"typeIfObj\": @(LookinAttrTypeCustomObj),\n                         @\"hideIfNil\": @(YES)\n                         },\n                 \n                 LookinAttr_Layout_Frame_Frame: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"Frame\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_Layout_Bounds_Bounds: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"Bounds\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_Layout_SafeArea_SafeArea: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"SafeAreaInsets\",\n                         @\"setterString\": @\"\",\n                         @\"osVersion\": @(11)\n                         },\n                 LookinAttr_Layout_Position_Position: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"Position\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_Layout_AnchorPoint_AnchorPoint: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"AnchorPoint\",\n                         @\"patch\": @(YES)\n                         },\n                 \n                 LookinAttr_AutoLayout_Hugging_Hor: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"ContentHuggingPriority(Horizontal)\",\n                         @\"getterString\": @\"lks_horizontalContentHuggingPriority\",\n                         @\"setterString\": @\"setLks_horizontalContentHuggingPriority:\",\n                         @\"briefTitle\": @\"H\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_AutoLayout_Hugging_Ver: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"ContentHuggingPriority(Vertical)\",\n                         @\"getterString\": @\"lks_verticalContentHuggingPriority\",\n                         @\"setterString\": @\"setLks_verticalContentHuggingPriority:\",\n                         @\"briefTitle\": @\"V\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_AutoLayout_Resistance_Hor: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"ContentCompressionResistancePriority(Horizontal)\",\n                         @\"getterString\": @\"lks_horizontalContentCompressionResistancePriority\",\n                         @\"setterString\": @\"setLks_horizontalContentCompressionResistancePriority:\",\n                         @\"briefTitle\": @\"H\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_AutoLayout_Resistance_Ver: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"ContentCompressionResistancePriority(Vertical)\",\n                         @\"getterString\": @\"lks_verticalContentCompressionResistancePriority\",\n                         @\"setterString\": @\"setLks_verticalContentCompressionResistancePriority:\",\n                         @\"briefTitle\": @\"V\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_AutoLayout_Constraints_Constraints: @{\n                         @\"className\": @\"UIView\",\n                         @\"getterString\": @\"lks_constraints\",\n                         @\"setterString\": @\"\",\n                         @\"typeIfObj\": @(LookinAttrTypeCustomObj),\n                         @\"hideIfNil\": @(YES)\n                         },\n                 LookinAttr_AutoLayout_IntrinsicSize_Size: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"IntrinsicContentSize\",\n                         @\"setterString\": @\"\"\n                 },\n                 \n                 LookinAttr_ViewLayer_Visibility_Hidden: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"Hidden\",\n                         @\"getterString\": @\"isHidden\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Visibility_Opacity: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"Opacity / Alpha\",\n                         @\"setterString\": @\"setOpacity:\",\n                         @\"getterString\": @\"opacity\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_InterationAndMasks_Interaction: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"UserInteractionEnabled\",\n                         @\"getterString\": @\"isUserInteractionEnabled\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_ViewLayer_InterationAndMasks_MasksToBounds: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"MasksToBounds / ClipsToBounds\",\n                         @\"briefTitle\": @\"MasksToBounds\",\n                         @\"setterString\": @\"setMasksToBounds:\",\n                         @\"getterString\": @\"masksToBounds\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Corner_Radius: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"CornerRadius\",\n                         @\"briefTitle\": @\"\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_BgColor_BgColor: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"BackgroundColor\",\n                         @\"setterString\": @\"setLks_backgroundColor:\",\n                         @\"getterString\": @\"lks_backgroundColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Border_Color: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"BorderColor\",\n                         @\"setterString\": @\"setLks_borderColor:\",\n                         @\"getterString\": @\"lks_borderColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Border_Width: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"BorderWidth\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Shadow_Color: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"ShadowColor\",\n                         @\"setterString\": @\"setLks_shadowColor:\",\n                         @\"getterString\": @\"lks_shadowColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Shadow_Opacity: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"ShadowOpacity\",\n                         @\"briefTitle\": @\"Opacity\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Shadow_Radius: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"ShadowRadius\",\n                         @\"briefTitle\": @\"Radius\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Shadow_OffsetW: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"ShadowOffsetWidth\",\n                         @\"briefTitle\": @\"OffsetW\",\n                         @\"setterString\": @\"setLks_shadowOffsetWidth:\",\n                         @\"getterString\": @\"lks_shadowOffsetWidth\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Shadow_OffsetH: @{\n                         @\"className\": @\"CALayer\",\n                         @\"fullTitle\": @\"ShadowOffsetHeight\",\n                         @\"briefTitle\": @\"OffsetH\",\n                         @\"setterString\": @\"setLks_shadowOffsetHeight:\",\n                         @\"getterString\": @\"lks_shadowOffsetHeight\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_ContentMode_Mode: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"ContentMode\",\n                         @\"enumList\": @\"UIViewContentMode\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_TintColor_Color: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"TintColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_TintColor_Mode: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"TintAdjustmentMode\",\n                         @\"enumList\": @\"UIViewTintAdjustmentMode\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_ViewLayer_Tag_Tag: @{\n                         @\"className\": @\"UIView\",\n                         @\"fullTitle\": @\"Tag\",\n                         @\"briefTitle\": @\"\",\n                         @\"patch\": @(NO)\n                         },\n                 \n                 LookinAttr_UIVisualEffectView_Style_Style: @{\n                     @\"className\": @\"UIVisualEffectView\",\n                     @\"setterString\": @\"setLks_blurEffectStyleNumber:\",\n                     @\"getterString\": @\"lks_blurEffectStyleNumber\",\n                     @\"enumList\": @\"UIBlurEffectStyle\",\n                     @\"typeIfObj\": @(LookinAttrTypeCustomObj),\n                     @\"patch\": @(YES),\n                     @\"hideIfNil\": @(YES)\n                 },\n                 \n                 LookinAttr_UIVisualEffectView_QMUIForegroundColor_Color: @{\n                         @\"className\": @\"QMUIVisualEffectView\",\n                         @\"fullTitle\": @\"ForegroundColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES),\n                 },\n                 \n                 LookinAttr_UIImageView_Name_Name: @{\n                         @\"className\": @\"UIImageView\",\n                         @\"fullTitle\": @\"ImageName\",\n                         @\"setterString\": @\"\",\n                         @\"getterString\": @\"lks_imageSourceName\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"hideIfNil\": @(YES)\n                 },\n                 LookinAttr_UIImageView_Open_Open: @{\n                         @\"className\": @\"UIImageView\",\n                         @\"setterString\": @\"\",\n                         @\"getterString\": @\"lks_imageViewOidIfHasImage\",\n                         @\"typeIfObj\": @(LookinAttrTypeCustomObj),\n                         @\"hideIfNil\": @(YES)\n                 },\n                 \n                 LookinAttr_UILabel_Text_Text: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"Text\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UILabel_NumberOfLines_NumberOfLines: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"NumberOfLines\",\n                         @\"briefTitle\": @\"\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UILabel_Font_Size: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"FontSize\",\n                         @\"briefTitle\": @\"FontSize\",\n                         @\"setterString\": @\"setLks_fontSize:\",\n                         @\"getterString\": @\"lks_fontSize\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UILabel_Font_Name: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"FontName\",\n                         @\"setterString\": @\"\",\n                         @\"getterString\": @\"lks_fontName\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UILabel_TextColor_Color: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"TextColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UILabel_Alignment_Alignment: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"TextAlignment\",\n                         @\"enumList\": @\"NSTextAlignment\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UILabel_BreakMode_Mode: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"LineBreakMode\",\n                         @\"enumList\": @\"NSLineBreakMode\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UILabel_CanAdjustFont_CanAdjustFont: @{\n                         @\"className\": @\"UILabel\",\n                         @\"fullTitle\": @\"AdjustsFontSizeToFitWidth\",\n                         @\"patch\": @(YES)\n                         },\n                 \n                 LookinAttr_UIControl_EnabledSelected_Enabled: @{\n                         @\"className\": @\"UIControl\",\n                         @\"fullTitle\": @\"Enabled\",\n                         @\"getterString\": @\"isEnabled\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIControl_EnabledSelected_Selected: @{\n                         @\"className\": @\"UIControl\",\n                         @\"fullTitle\": @\"Selected\",\n                         @\"getterString\": @\"isSelected\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIControl_VerAlignment_Alignment: @{\n                         @\"className\": @\"UIControl\",\n                         @\"fullTitle\": @\"ContentVerticalAlignment\",\n                         @\"enumList\": @\"UIControlContentVerticalAlignment\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIControl_HorAlignment_Alignment: @{\n                         @\"className\": @\"UIControl\",\n                         @\"fullTitle\": @\"ContentHorizontalAlignment\",\n                         @\"enumList\": @\"UIControlContentHorizontalAlignment\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIControl_QMUIOutsideEdge_Edge: @{\n                         @\"className\": @\"UIControl\",\n                         @\"fullTitle\": @\"qmui_outsideEdge\"\n                         },\n                 \n                 LookinAttr_UIButton_ContentInsets_Insets: @{\n                         @\"className\": @\"UIButton\",\n                         @\"fullTitle\": @\"ContentEdgeInsets\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIButton_TitleInsets_Insets: @{\n                         @\"className\": @\"UIButton\",\n                         @\"fullTitle\": @\"TitleEdgeInsets\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIButton_ImageInsets_Insets: @{\n                         @\"className\": @\"UIButton\",\n                         @\"fullTitle\": @\"ImageEdgeInsets\",\n                         @\"patch\": @(YES)\n                         },\n                 \n                 LookinAttr_UIScrollView_Offset_Offset: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ContentOffset\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIScrollView_ContentSize_Size: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ContentSize\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIScrollView_ContentInset_Inset: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ContentInset\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIScrollView_QMUIInitialInset_Inset: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"qmui_initialContentInset\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIScrollView_AdjustedInset_Inset: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"AdjustedContentInset\",\n                         @\"setterString\": @\"\",\n                         @\"osVersion\": @(11)\n                         },\n                 LookinAttr_UIScrollView_Behavior_Behavior: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ContentInsetAdjustmentBehavior\",\n                         @\"enumList\": @\"UIScrollViewContentInsetAdjustmentBehavior\",\n                         @\"patch\": @(YES),\n                         @\"osVersion\": @(11)\n                         },\n                 LookinAttr_UIScrollView_IndicatorInset_Inset: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ScrollIndicatorInsets\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_ScrollPaging_ScrollEnabled: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ScrollEnabled\",\n                         @\"getterString\": @\"isScrollEnabled\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_ScrollPaging_PagingEnabled: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"PagingEnabled\",\n                         @\"getterString\": @\"isPagingEnabled\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_Bounce_Ver: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"AlwaysBounceVertical\",\n                         @\"briefTitle\": @\"Vertical\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_Bounce_Hor: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"AlwaysBounceHorizontal\",\n                         @\"briefTitle\": @\"Horizontal\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_ShowsIndicator_Hor: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ShowsHorizontalScrollIndicator\",\n                         @\"briefTitle\": @\"Horizontal\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_ShowsIndicator_Ver: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ShowsVerticalScrollIndicator\",\n                         @\"briefTitle\": @\"Vertical\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_ContentTouches_Delay: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"DelaysContentTouches\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_ContentTouches_CanCancel: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"CanCancelContentTouches\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_Zoom_MinScale: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"MinimumZoomScale\",\n                         @\"briefTitle\": @\"MinScale\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_Zoom_MaxScale: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"MaximumZoomScale\",\n                         @\"briefTitle\": @\"MaxScale\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UIScrollView_Zoom_Scale: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"ZoomScale\",\n                         @\"briefTitle\": @\"Scale\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UIScrollView_Zoom_Bounce: @{\n                         @\"className\": @\"UIScrollView\",\n                         @\"fullTitle\": @\"BouncesZoom\",\n                         @\"patch\": @(NO)\n                         },\n                 \n                 LookinAttr_UITableView_Style_Style: @{\n                         @\"className\": @\"UITableView\",\n                         @\"fullTitle\": @\"Style\",\n                         @\"setterString\": @\"\",\n                         @\"enumList\": @\"UITableViewStyle\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITableView_SectionsNumber_Number: @{\n                         @\"className\": @\"UITableView\",\n                         @\"fullTitle\": @\"NumberOfSections\",\n                         @\"setterString\": @\"\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITableView_RowsNumber_Number: @{\n                         @\"className\": @\"UITableView\",\n                         @\"setterString\": @\"\",\n                         @\"getterString\": @\"lks_numberOfRows\",\n                         @\"typeIfObj\": @(LookinAttrTypeCustomObj)\n                         },\n                 LookinAttr_UITableView_SeparatorInset_Inset: @{\n                         @\"className\": @\"UITableView\",\n                         @\"fullTitle\": @\"SeparatorInset\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UITableView_SeparatorColor_Color: @{\n                         @\"className\": @\"UITableView\",\n                         @\"fullTitle\": @\"SeparatorColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITableView_SeparatorStyle_Style: @{\n                         @\"className\": @\"UITableView\",\n                         @\"fullTitle\": @\"SeparatorStyle\",\n                         @\"enumList\": @\"UITableViewCellSeparatorStyle\",\n                         @\"patch\": @(YES)\n                         },\n                 \n                 LookinAttr_UITextView_Text_Text: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"Text\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextView_Font_Name: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"FontName\",\n                         @\"setterString\": @\"\",\n                         @\"getterString\": @\"lks_fontName\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UITextView_Font_Size: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"FontSize\",\n                         @\"setterString\": @\"setLks_fontSize:\",\n                         @\"getterString\": @\"lks_fontSize\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextView_Basic_Editable: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"Editable\",\n                         @\"getterString\": @\"isEditable\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UITextView_Basic_Selectable: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"Selectable\",\n                         @\"getterString\": @\"isSelectable\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UITextView_TextColor_Color: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"TextColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextView_Alignment_Alignment: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"TextAlignment\",\n                         @\"enumList\": @\"NSTextAlignment\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextView_ContainerInset_Inset: @{\n                         @\"className\": @\"UITextView\",\n                         @\"fullTitle\": @\"TextContainerInset\",\n                         @\"patch\": @(YES)\n                         },\n                 \n                 LookinAttr_UITextField_Font_Name: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"FontName\",\n                         @\"setterString\": @\"\",\n                         @\"getterString\": @\"lks_fontName\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UITextField_Font_Size: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"FontSize\",\n                         @\"setterString\": @\"setLks_fontSize:\",\n                         @\"getterString\": @\"lks_fontSize\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextField_TextColor_Color: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"TextColor\",\n                         @\"typeIfObj\": @(LookinAttrTypeUIColor),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextField_Alignment_Alignment: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"TextAlignment\",\n                         @\"enumList\": @\"NSTextAlignment\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextField_Text_Text: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"Text\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextField_Placeholder_Placeholder: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"Placeholder\",\n                         @\"typeIfObj\": @(LookinAttrTypeNSString),\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextField_Clears_ClearsOnBeginEditing: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"ClearsOnBeginEditing\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UITextField_Clears_ClearsOnInsertion: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"ClearsOnInsertion\",\n                         @\"patch\": @(NO)\n                         },\n                 LookinAttr_UITextField_CanAdjustFont_CanAdjustFont: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"AdjustsFontSizeToFitWidth\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextField_CanAdjustFont_MinSize: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"MinimumFontSize\",\n                         @\"patch\": @(YES)\n                         },\n                 LookinAttr_UITextField_ClearButtonMode_Mode: @{\n                         @\"className\": @\"UITextField\",\n                         @\"fullTitle\": @\"ClearButtonMode\",\n                         @\"enumList\": @\"UITextFieldViewMode\",\n                         @\"patch\": @(NO)\n                         },\n                 };\n    });\n    \n    NSDictionary<NSString *, id> *targetInfo = dict[attrID];\n    return targetInfo;\n}\n\n+ (LookinAttrType)objectAttrTypeWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSNumber *typeIfObj = attrInfo[@\"typeIfObj\"];\n    return [typeIfObj integerValue];\n}\n\n+ (NSString *)classNameWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSString *className = attrInfo[@\"className\"];\n    \n    NSAssert(className.length > 0, @\"\");\n    \n    return className;\n}\n\n+ (BOOL)isUIViewPropertyWithAttrID:(LookinAttrIdentifier)attrID {\n    NSString *className = [self classNameWithAttrID:attrID];\n    \n    if ([className isEqualToString:@\"CALayer\"]) {\n        return NO;\n    }\n    return YES;\n}\n\n+ (NSString *)enumListNameWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSString *name = attrInfo[@\"enumList\"];\n    return name;\n}\n\n+ (BOOL)needPatchAfterModificationWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSNumber *needPatch = attrInfo[@\"patch\"];\n    return [needPatch boolValue];\n}\n\n+ (NSString *)fullTitleWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSString *fullTitle = attrInfo[@\"fullTitle\"];\n    return fullTitle;\n}\n\n+ (NSString *)briefTitleWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSString *briefTitle = attrInfo[@\"briefTitle\"];\n    if (!briefTitle) {\n        briefTitle = attrInfo[@\"fullTitle\"];\n    }\n    return briefTitle;\n}\n\n+ (SEL)getterWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSString *getterString = attrInfo[@\"getterString\"];\n    if (getterString && getterString.length == 0) {\n        // 空字符串，比如 image_open_open\n        return nil;\n    }\n    if (!getterString) {\n        NSString *fullTitle = attrInfo[@\"fullTitle\"];\n        NSAssert(fullTitle.length > 0, @\"\");\n        \n        getterString = [NSString stringWithFormat:@\"%@%@\", [fullTitle substringToIndex:1].lowercaseString, [fullTitle substringFromIndex:1]].copy;\n    }\n    return NSSelectorFromString(getterString);\n}\n\n+ (SEL)setterWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSString *setterString = attrInfo[@\"setterString\"];\n    if ([setterString isEqualToString:@\"\"]) {\n        // 该属性不可在 Lookin 客户端中被修改\n        return nil;\n    }\n    if (!setterString) {\n        NSString *fullTitle = attrInfo[@\"fullTitle\"];\n        NSAssert(fullTitle.length > 0, @\"\");\n        \n        setterString = [NSString stringWithFormat:@\"set%@%@:\", [fullTitle substringToIndex:1].uppercaseString, [fullTitle substringFromIndex:1]];\n    }\n    return NSSelectorFromString(setterString);\n}\n\n+ (BOOL)hideIfNilWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSNumber *boolValue = attrInfo[@\"hideIfNil\"];\n    return boolValue.boolValue;\n}\n\n+ (NSInteger)minAvailableOSVersionWithAttrID:(LookinAttrIdentifier)attrID {\n    NSDictionary<NSString *, id> *attrInfo = [self _infoForAttrID:attrID];\n    NSNumber *minVerNum = attrInfo[@\"osVersion\"];\n    NSInteger minVer = [minVerNum integerValue];\n    return minVer;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinDefines.h",
    "content": "//\n//  LookinMessageProtocol.h\n//  Lookin\n//\n//  Created by Li Kai on 2018/8/6.\n//  https://lookin.work\n//\n\n#import \"TargetConditionals.h\"\n#if TARGET_OS_IPHONE\n#import <UIKit/UIKit.h>\n#elif TARGET_OS_MAC\n#import <Appkit/Appkit.h>\n#endif\n\n#include <stdint.h>\n\n#pragma mark - Version\n\n/// 当前 LookinServer 的版本\nstatic const int LOOKIN_SERVER_VERSION = 7;\nstatic NSString * const LOOKIN_SERVER_READABLE_VERSION = @\"1.0.5\";\n\n/// 当前 LookinClient 的版本\nstatic const int LOOKIN_CLIENT_VERSION = 7;\n\n/// 当前 LookinServer 和 LookinClient 是否是内部实验版本\nstatic BOOL LOOKIN_SERVER_IS_EXPERIMENTAL = NO;\nstatic BOOL LOOKIN_CLIENT_IS_EXPERIMENTAL = NO;\n\n/// 当前 Lookin 客户端所支持的 LookinServer 的最低版本\nstatic const int LOOKIN_SUPPORTED_SERVER_MIN = 7;\n/// 当前 Lookin 客户端所支持的 LookinServer 的最高版本\nstatic const int LOOKIN_SUPPORTED_SERVER_MAX = 7;\n\n/// 标记该 LookinServer 是通过什么方式安装的，0:未知，1:CocoaPods，2:手动，3:源代码，4:断点\nstatic const int LOOKIN_SERVER_SETUP_TYPE = 1;\n\n#pragma mark - Links\n\nstatic NSString * const LOOKIN_SERVER_FRAMEWORK_URL = @\"https://lookin.work/download/framework/LookinServer-1-0-0.zip\";\n\n#pragma mark - Connection\n\n/// LookinServer 在真机上会依次尝试监听 47175 ~ 47179 这几个端口\nstatic const int LookinUSBDeviceIPv4PortNumberStart = 47175;\nstatic const int LookinUSBDeviceIPv4PortNumberEnd = 47179;\n\n/// LookinServer 在模拟器中会依次尝试监听 47164 ~ 47169 这几个端口\nstatic const int LookinSimulatorIPv4PortNumberStart = 47164;\nstatic const int LookinSimulatorIPv4PortNumberEnd = 47169;\n\nenum {\n    /// 确认两端是否可以响应通讯\n    LookinRequestTypePing = 200,\n    /// 请求 App 的截图、设备型号等信息\n    LookinRequestTypeApp = 201,\n    /// 请求 Hierarchy 信息\n    LookinRequestTypeHierarchy = 202,\n    /// 请求 screenshots 和 attrGroups 信息\n    LookinRequestTypeHierarchyDetails = 203,\n    /// 请求修改某个 Attribute 的值\n    LookinRequestTypeModification = 204,\n    /// 修改某个 attr 后，请求一系列最新的 Screenshots、属性值等信息\n    LookinRequestTypeAttrModificationPatch = 205,\n    /// 执行某个方法\n    LookinRequestTypeInvokeMethod = 206,\n    /**\n     @request: @{@\"oid\":}\n     @response: LookinObject *\n     */\n    LookinRequestTypeFetchObject = 207,\n    \n    LookinRequestTypeFetchImageViewImage = 208,\n    \n    LookinRequestTypeModifyRecognizerEnable = 209,\n    \n    /// 请求 attribute group list\n    LookinRequestTypeAllAttrGroups = 210,\n    \n    /// 请求 iOS App 里所有的 class 名字列表和监听中的方法列表\n    LookinRequestTypeClassesAndMethodTraceLit = 212,\n    \n    /// 请求 iOS App 里某个 class 的所有 selector 名字列表（包括 superclass）\n    LookinRequestTypeAllSelectorNames = 213,\n    \n    // 增加 methodTrace\n    LookinRequestTypeAddMethodTrace = 214,\n    // 删除 methodTrace\n    LookinRequestTypeDeleteMethodTrace = 215,\n\n    LookinPush_BringForwardScreenshotTask = 303,\n    // 用户在 Lookin 客户端取消了之前 HierarchyDetails 的拉取\n    LookinPush_CanceHierarchyDetails = 304,\n    \n    /// iOS 端推送 method trace 信息\n    LookinPush_MethodTraceRecord = 403\n};\n\nstatic NSString * const LookinParam_ViewLayerTag = @\"tag\";\n\nstatic NSString * const LookinParam_SelectorName = @\"sn\";\nstatic NSString * const LookinParam_MethodType = @\"mt\";\nstatic NSString * const LookinParam_SelectorClassName = @\"scn\";\n\nstatic NSString * const LookinStringFlag_VoidReturn = @\"LOOKIN_TAG_RETURN_VALUE_VOID\";\n\n#pragma mark - Error\n\nstatic NSString * const LookinErrorDomain = @\"LookinError\";\n\nenum {\n    LookinErrCode_Default = -400,\n    /// Lookin 内部业务逻辑错误\n    LookinErrCode_Inner = -401,\n    /// PeerTalk 内部错误\n    LookinErrCode_PeerTalk = -402,\n    /// 连接不存在或已断开\n    LookinErrCode_NoConnect = -403,\n    /// ping 失败了，原因是 ping 请求超时\n    LookinErrCode_PingFailForTimeout = -404,\n    /// 请求超时未返回\n    LookinErrCode_Timeout = -405,\n    /// 有相同 Type 的新请求被发出，因此旧请求被丢弃\n    LookinErrCode_Discard = -406,\n    /// ping 失败了，原因是 app 主动报告自身正处于后台模式\n    LookinErrCode_PingFailForBackgroundState = -407,\n    \n    /// 没有找到对应的对象，可能已被释放\n    LookinErrCode_ObjectNotFound = -500,\n    /// 不支持修改当前类型的 LookinCodingValueType\n    LookinErrCode_ModifyValueTypeInvalid = -501,\n    LookinErrCode_Exception = -502,\n    \n    // LookinServer 版本过高，要升级 client\n    LookinErrCode_ServerVersionTooHigh = -600,\n    // LookinServer 版本过低，要升级 server\n    LookinErrCode_ServerVersionTooLow = -601,\n    // LookinServer 是私有版本，但 client 是现网版本\n    LookinErrCode_ServerIsPrivate = -602,\n    // LookinServer 是现网版本，但 client 是私有版本\n    LookinErrCode_ClientIsPrivate = - 603,\n    \n    // 不支持的文件类型\n    LookinErrCode_UnsupportedFileType = -700,\n};\n\n#define LookinErr_ObjNotFound [NSError errorWithDomain:LookinErrorDomain code:LookinErrCode_ObjectNotFound userInfo:@{NSLocalizedDescriptionKey:NSLocalizedString(@\"Failed to get target object in iOS app\", nil), NSLocalizedRecoverySuggestionErrorKey:NSLocalizedString(@\"Perhaps the related object was deallocated. You can reload Lookin to get newest data.\", nil)}]\n\n#define LookinErr_NoConnect [NSError errorWithDomain:LookinErrorDomain code:LookinErrCode_NoConnect userInfo:@{NSLocalizedDescriptionKey:NSLocalizedString(@\"The operation failed due to disconnection with the iOS app.\", nil)}]\n\n#define LookinErr_Inner [NSError errorWithDomain:LookinErrorDomain code:LookinErrCode_Inner userInfo:@{NSLocalizedDescriptionKey:NSLocalizedString(@\"The operation failed due to an inner error.\", nil)}]\n\n#define LookinErrorMake(errorTitle, errorDetail) [NSError errorWithDomain:LookinErrorDomain code:LookinErrCode_Default userInfo:@{NSLocalizedDescriptionKey:errorTitle, NSLocalizedRecoverySuggestionErrorKey:errorDetail}]\n\n#define LookinErrorText_Timeout NSLocalizedString(@\"Perhaps your iOS app is paused with breakpoint in Xcode, blocked by other tasks in main thread, or moved to background state.\", nil)\n\n#pragma mark - Colors\n\n#if TARGET_OS_IPHONE\n#define LookinColor UIColor\n#define LookinInsets UIEdgeInsets\n#define LookinImage UIImage\n#elif TARGET_OS_MAC\n#define LookinColor NSColor\n#define LookinInsets NSEdgeInsets\n#define LookinImage NSImage\n#endif\n\n#define LookinColorRGBAMake(r, g, b, a) [LookinColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]\n#define LookinColorMake(r, g, b) [LookinColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]\n\n#pragma mark - Preview\n\n/// SCNNode 所允许的图片的最大的长和宽，单位是 px，这个值是 Scenekit 自身指定的\nstatic const double LookinNodeImageMaxLengthInPx = 16384;\n\ntypedef NS_OPTIONS(NSUInteger, LookinPreviewBitMask) {\n    LookinPreviewBitMask_None = 0,\n    \n    LookinPreviewBitMask_Selectable = 1 << 1,\n    LookinPreviewBitMask_Unselectable = 1 << 2,\n    \n    LookinPreviewBitMask_HasLight = 1 << 3,\n    LookinPreviewBitMask_NoLight = 1 << 4\n};\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinDisplayItem.h",
    "content": "//\n//  LookinDisplayItem.h\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/11/15.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n\n\n#import \"TargetConditionals.h\"\n#import \"LookinObject.h\"\n#import \"LookinDefines.h\"\n#if TARGET_OS_IPHONE\n#import <UIKit/UIKit.h>\n#elif TARGET_OS_MAC\n#import <Appkit/Appkit.h>\n#endif\n\n@class LookinAttributesGroup, LookinIvarTrace, LookinPreviewItemLayer, LookinEventHandler, LookinDisplayItemNode, LookinDisplayItem;\n\ntypedef NS_ENUM(NSUInteger, LookinDisplayItemImageEncodeType) {\n    LookinDisplayItemImageEncodeTypeNone,   // 不进行 encode\n    LookinDisplayItemImageEncodeTypeNSData, // 转换为 NSData\n    LookinDisplayItemImageEncodeTypeImage   // 使用 NSImage / UIImage 自身的 encode 方法\n};\n\ntypedef NS_ENUM(NSUInteger, LookinDisplayItemProperty) {\n    // 当初次设置 delegate 对象时，会立即以该值触发一次 displayItem:propertyDidChange:\n    LookinDisplayItemProperty_None,\n    LookinDisplayItemProperty_FrameToRoot,\n    LookinDisplayItemProperty_DisplayingInHierarchy,\n    LookinDisplayItemProperty_InHiddenHierarchy,\n    LookinDisplayItemProperty_IsExpandable,\n    LookinDisplayItemProperty_IsExpanded,\n    LookinDisplayItemProperty_SoloScreenshot,\n    LookinDisplayItemProperty_GroupScreenshot,\n    LookinDisplayItemProperty_IsSelected,\n    LookinDisplayItemProperty_IsHovered,\n    LookinDisplayItemProperty_AvoidSyncScreenshot,\n    LookinDisplayItemProperty_InNoPreviewHierarchy,\n    LookinDisplayItemProperty_IsInSearch,\n    LookinDisplayItemProperty_HighlightedSearchString,\n};\n\n@protocol LookinDisplayItemDelegate <NSObject>\n\n- (void)displayItem:(LookinDisplayItem *)displayItem propertyDidChange:(LookinDisplayItemProperty)property;\n\n@end\n\n@interface LookinDisplayItem : NSObject <NSSecureCoding, NSCopying>\n\n@property(nonatomic, copy) NSArray<LookinDisplayItem *> *subitems;\n\n@property(nonatomic, assign) BOOL isHidden;\n\n@property(nonatomic, assign) float alpha;\n\n@property(nonatomic, assign) CGRect frame;\n\n@property(nonatomic, assign) CGRect bounds;\n\n/// 不存在 subitems 时，该属性的值为 nil\n@property(nonatomic, strong) LookinImage *soloScreenshot;\n/// 无论是否存在 subitems，该属性始终存在\n@property(nonatomic, strong) LookinImage *groupScreenshot;\n\n@property(nonatomic, strong) LookinObject *viewObject;\n@property(nonatomic, strong) LookinObject *layerObject;\n@property(nonatomic, strong) LookinObject *hostViewControllerObject;\n\n/// attrGroups 列表\n@property(nonatomic, copy) NSArray<LookinAttributesGroup *> *attributesGroupList;\n\n@property(nonatomic, copy) NSArray<LookinEventHandler *> *eventHandlers;\n\n// 如果当前 item 代表 UIWindow 且是 keyWindow，则该属性为 YES\n@property(nonatomic, assign) BOOL representedAsKeyWindow;\n\n@property(nonatomic, weak) id<LookinDisplayItemDelegate> previewItemDelegate;\n@property(nonatomic, weak) id<LookinDisplayItemDelegate> rowViewDelegate;\n\n/// view 或 layer 的 backgroundColor，利用该属性来提前渲染 node 的背景色，使得用户感觉加载的快一点\n/// 注意有一个缺点是，理论上应该像 screenshot 一样拆成 soloBackgroundColor 和 groupBackgroundColor，这里的 backgroundColor 实际上是 soloBackgroundColor，因此某些场景的显示会有瑕疵\n@property(nonatomic, strong) LookinColor *backgroundColor;\n\n#pragma mark - No Encode/Decode\n\n/// 父节点\n@property(nonatomic, weak) LookinDisplayItem *superItem;\n\n/// 如果存在 viewObject 则返回 viewObject，否则返回 layerObject\n- (LookinObject *)displayingObject;\n\n/// 该 item 在左侧 hierarchy 中显示的字符串，现在则返回其 ShortClassName\n@property(nonatomic, copy, readonly) NSString *title;\n@property(nonatomic, copy, readonly) NSString *subtitle;\n\n/// 在 hierarchy 中的层级，比如顶层的 UIWindow.indentLevel 为 0，UIWindow 的 subitem 的 indentLevel 为 1\n- (NSInteger)indentLevel;\n\n/// className 以 “UI”、“CA” 等开头时认为是系统类，该属性将返回 YES\n@property(nonatomic, assign, readonly) BOOL representedForSystemClass;\n\n/**\n 该项是否被展开\n @note 假如自己没有被折叠，但是 superItem 被折叠了，则自己仍然不会被看到，但是 self.isExpanded 值仍然为 NO\n @note 如果 item 没有 subitems，则该值没有意义\n */\n@property(nonatomic, assign) BOOL isExpanded;\n\n/// 如果有 subitems，则该属性返回 YES，否则返回 NO\n@property(nonatomic, assign, readonly) BOOL isExpandable;\n\n/**\n 是否能在 hierarchy panel 上被看到，假如有任意一层的父级元素的 isExpanded 为 NO，则 displayingInHierarchy 为 NO。如果所有父级元素的 isExpanded 均为 YES，则 displayingInHierarchy 为 YES\n */\n@property(nonatomic, assign, readonly) BOOL displayingInHierarchy;\n\n/**\n 如果自身或任意一个上层元素的 isHidden 为 YES 或 alpha 为 0，则该属性返回 YES\n */\n@property(nonatomic, assign, readonly) BOOL inHiddenHierarchy;\n\n/// 返回 soloScreenshot 或 groupScreenshot\n- (LookinImage *)appropriateScreenshot;\n\n@property(nonatomic, assign) LookinDisplayItemImageEncodeType screenshotEncodeType;\n\n/// 如果该属性为 YES 则不会自动同步该 item 的图像（比如该 item 尺寸过大）\n@property(nonatomic, assign) BOOL avoidSyncScreenshot;\n\n@property(nonatomic, weak) LookinPreviewItemLayer *previewLayer;\n\n@property(nonatomic, weak) LookinDisplayItemNode *previewNode;\n\n/// 如果该值为 YES，则该 item 及所有子 item 均不会在 preview 中被显示出来，只能在 hierarchy 中选择。默认为 NO\n@property(nonatomic, assign) BOOL noPreview;\n\n/// 如果自身或某个上级元素的 noPreview 值为 YES，则该方法返回 YES\n@property(nonatomic, assign, readonly) BOOL inNoPreviewHierarchy;\n\n/// 当小于 0 时表示未被设置\n@property(nonatomic, assign) NSInteger previewZIndex;\n\n/**\n 在当前 hierarchy 的最顶层的 item 的坐标系中，该 item 的 frame 值\n */\n@property(nonatomic, assign, readonly) CGRect frameToRoot;\n\n/// 遍历自身和所有上级元素\n- (void)enumerateSelfAndAncestors:(void (^)(LookinDisplayItem *item, BOOL *stop))block;\n\n- (void)enumerateAncestors:(void (^)(LookinDisplayItem *item, BOOL *stop))block;\n\n/// 遍历自身后所有下级元素\n- (void)enumerateSelfAndChildren:(void (^)(LookinDisplayItem *item))block;\n\n@property(nonatomic, assign) BOOL preferToBeCollapsed;\n\n@property(nonatomic, assign) BOOL isSelected;\n\n@property(nonatomic, assign) BOOL isHovered;\n\n- (BOOL)itemIsKindOfClassWithName:(NSString *)className;\n- (BOOL)itemIsKindOfClassesWithNames:(NSSet<NSString *> *)classNames;\n\n/// 根据 subItems 属性将 items 打平为一维数组\n+ (NSArray<LookinDisplayItem *> *)flatItemsFromHierarchicalItems:(NSArray<LookinDisplayItem *> *)items;\n\n@property(nonatomic, assign) BOOL hasDeterminedExpansion;\n\n/// 在 string 这个搜索词下，如果该 displayItem 应该被搜索到，则该方法返回 YES。\n/// string 字段不能为 nil 或空字符串\n- (BOOL)isMatchedWithSearchString:(NSString *)string;\n\n/// 设置当前是否处于搜索状态\n@property(nonatomic, assign) BOOL isInSearch;\n/// 因为搜索而应该被高亮的字符串\n@property(nonatomic, copy) NSString *highlightedSearchString;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinDisplayItem.m",
    "content": "//\n//  LookinDisplayItem.m\n//  qmuidemo\n//\n//  Created by Li Kai on 2018/11/15.\n//  Copyright © 2018 QMUI Team. All rights reserved.\n//\n\n\n\n#import \"LookinDisplayItem.h\"\n#import \"LookinAttributesGroup.h\"\n#import \"LookinAttributesSection.h\"\n#import \"LookinAttribute.h\"\n#import \"LookinEventHandler.h\"\n#import \"LookinIvarTrace.h\"\n\n#import \"NSArray+Lookin.h\"\n#import \"NSObject+Lookin.h\"\n\n#if TARGET_OS_IPHONE\n#import \"UIColor+LookinServer.h\"\n#import \"UIImage+LookinServer.h\"\n#elif TARGET_OS_MAC\n#ifdef DEBUG\n#import \"LKEfficiencyMonitor.h\"\n#endif\n#endif\n\n@interface LookinDisplayItem ()\n\n@property(nonatomic, assign, readwrite) CGRect frameToRoot;\n@property(nonatomic, assign, readwrite) BOOL inNoPreviewHierarchy;\n@property(nonatomic, assign) NSInteger indentLevel;\n@property(nonatomic, assign, readwrite) BOOL isExpandable;\n@property(nonatomic, assign, readwrite) BOOL inHiddenHierarchy;\n@property(nonatomic, assign, readwrite) BOOL displayingInHierarchy;\n\n@end\n\n@implementation LookinDisplayItem\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinDisplayItem *newDisplayItem = [[LookinDisplayItem allocWithZone:zone] init];\n    newDisplayItem.subitems = [self.subitems lookin_map:^id(NSUInteger idx, LookinDisplayItem *value) {\n        return value.copy;\n    }];\n    newDisplayItem.isHidden = self.isHidden;\n    newDisplayItem.alpha = self.alpha;\n    newDisplayItem.frame = self.frame;\n    newDisplayItem.bounds = self.bounds;\n    newDisplayItem.soloScreenshot = self.soloScreenshot;\n    newDisplayItem.groupScreenshot = self.groupScreenshot;\n    newDisplayItem.viewObject = self.viewObject.copy;\n    newDisplayItem.layerObject = self.layerObject.copy;\n    newDisplayItem.hostViewControllerObject = self.hostViewControllerObject.copy;\n    newDisplayItem.attributesGroupList = [self.attributesGroupList lookin_map:^id(NSUInteger idx, LookinAttributesGroup *value) {\n        return value.copy;\n    }];\n    newDisplayItem.eventHandlers = [self.eventHandlers lookin_map:^id(NSUInteger idx, LookinEventHandler *value) {\n        return value.copy;\n    }];\n    newDisplayItem.representedAsKeyWindow = self.representedAsKeyWindow;\n    [newDisplayItem _updateDisplayingInHierarchyProperty];\n    return newDisplayItem;\n}\n#pragma mark - <NSCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.subitems forKey:@\"subitems\"];\n    [aCoder encodeBool:self.isHidden forKey:@\"hidden\"];\n    [aCoder encodeFloat:self.alpha forKey:@\"alpha\"];\n    [aCoder encodeObject:self.viewObject forKey:@\"viewObject\"];\n    [aCoder encodeObject:self.layerObject forKey:@\"layerObject\"];\n    [aCoder encodeObject:self.hostViewControllerObject forKey:@\"hostViewControllerObject\"];\n    [aCoder encodeObject:self.attributesGroupList forKey:@\"attributesGroupList\"];\n    [aCoder encodeBool:self.representedAsKeyWindow forKey:@\"representedAsKeyWindow\"];\n    [aCoder encodeObject:self.eventHandlers forKey:@\"eventHandlers\"];\n    if (self.screenshotEncodeType == LookinDisplayItemImageEncodeTypeNSData) {\n        [aCoder encodeObject:[self.soloScreenshot lookin_encodedObjectWithType:LookinCodingValueTypeImage] forKey:@\"soloScreenshot\"];\n        [aCoder encodeObject:[self.groupScreenshot lookin_encodedObjectWithType:LookinCodingValueTypeImage] forKey:@\"groupScreenshot\"];\n    } else if (self.screenshotEncodeType == LookinDisplayItemImageEncodeTypeImage) {\n        [aCoder encodeObject:self.soloScreenshot forKey:@\"soloScreenshot\"];\n        [aCoder encodeObject:self.groupScreenshot forKey:@\"groupScreenshot\"];\n    }\n#if TARGET_OS_IPHONE\n    [aCoder encodeCGRect:self.frame forKey:@\"frame\"];\n    [aCoder encodeCGRect:self.bounds forKey:@\"bounds\"];\n    [aCoder encodeObject:self.backgroundColor.lks_rgbaComponents forKey:@\"backgroundColor\"];\n    \n#elif TARGET_OS_MAC\n    [aCoder encodeRect:self.frame forKey:@\"frame\"];\n    [aCoder encodeRect:self.bounds forKey:@\"bounds\"];\n    [aCoder encodeObject:self.backgroundColor.lk_rgbaComponents forKey:@\"backgroundColor\"];\n#endif\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.subitems = [aDecoder decodeObjectForKey:@\"subitems\"];\n        self.isHidden = [aDecoder decodeBoolForKey:@\"hidden\"];\n        self.alpha = [aDecoder decodeFloatForKey:@\"alpha\"];\n        self.viewObject = [aDecoder decodeObjectForKey:@\"viewObject\"];\n        self.layerObject = [aDecoder decodeObjectForKey:@\"layerObject\"];\n        self.hostViewControllerObject = [aDecoder decodeObjectForKey:@\"hostViewControllerObject\"];\n        self.attributesGroupList = [aDecoder decodeObjectForKey:@\"attributesGroupList\"];\n        self.representedAsKeyWindow = [aDecoder decodeBoolForKey:@\"representedAsKeyWindow\"];\n        \n        id soloScreenshotObj = [aDecoder decodeObjectForKey:@\"soloScreenshot\"];\n        if (soloScreenshotObj) {\n            if ([soloScreenshotObj isKindOfClass:[NSData class]]) {\n                self.soloScreenshot = [soloScreenshotObj lookin_decodedObjectWithType:LookinCodingValueTypeImage];\n            } else if ([soloScreenshotObj isKindOfClass:[LookinImage class]]) {\n                self.soloScreenshot = soloScreenshotObj;\n            } else {\n                NSAssert(NO, @\"\");\n            }\n        }\n        \n        id groupScreenshotObj = [aDecoder decodeObjectForKey:@\"groupScreenshot\"];\n        if (groupScreenshotObj) {\n            if ([groupScreenshotObj isKindOfClass:[NSData class]]) {\n                self.groupScreenshot = [groupScreenshotObj lookin_decodedObjectWithType:LookinCodingValueTypeImage];\n            } else if ([groupScreenshotObj isKindOfClass:[LookinImage class]]) {\n                self.groupScreenshot = groupScreenshotObj;\n            } else {\n                NSAssert(NO, @\"\");\n            }            \n        }\n        \n        self.eventHandlers = [aDecoder decodeObjectForKey:@\"eventHandlers\"];\n#if TARGET_OS_IPHONE\n        self.frame = [aDecoder decodeCGRectForKey:@\"frame\"];\n        self.bounds = [aDecoder decodeCGRectForKey:@\"bounds\"];\n        self.backgroundColor = [UIColor lks_colorFromRGBAComponents:[aDecoder decodeObjectForKey:@\"backgroundColor\"]];\n#elif TARGET_OS_MAC\n        self.frame = [aDecoder decodeRectForKey:@\"frame\"];\n        self.bounds = [aDecoder decodeRectForKey:@\"bounds\"];\n        self.backgroundColor = [NSColor lk_colorFromRGBAComponents:[aDecoder decodeObjectForKey:@\"backgroundColor\"]];\n        \n#ifdef DEBUG\n        [[LKEfficiencyMonitor sharedInstance] displayItemDidInit];\n#endif\n        \n#endif\n        [self _updateDisplayingInHierarchyProperty];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        /// 在手机端，displayItem 被创建时会调用这个方法\n        [self _updateDisplayingInHierarchyProperty];\n        \n#ifdef DEBUG\n#if TARGET_OS_IPHONE\n#elif TARGET_OS_MAC\n        [[LKEfficiencyMonitor sharedInstance] displayItemDidInit];\n#endif\n#endif\n    }\n    return self;\n}\n\n- (LookinObject *)displayingObject {\n    return self.viewObject ? : self.layerObject;\n}\n\n- (void)setAttributesGroupList:(NSSet<LookinAttributesGroup *> *)attributesGroupList {\n    _attributesGroupList = [attributesGroupList copy];\n    [attributesGroupList enumerateObjectsUsingBlock:^(LookinAttributesGroup * _Nonnull group, BOOL * _Nonnull stop) {\n        [group.attrSections enumerateObjectsUsingBlock:^(LookinAttributesSection * _Nonnull section, NSUInteger idx, BOOL * _Nonnull stop) {\n            [section.attributes enumerateObjectsUsingBlock:^(LookinAttribute * _Nonnull attr, NSUInteger idx, BOOL * _Nonnull stop) {\n                attr.targetDisplayItem = self;\n            }];\n        }];\n    }];\n}\n\n- (BOOL)representedForSystemClass {\n    return [self.title hasPrefix:@\"UI\"] || [self.title hasPrefix:@\"CA\"] || [self.title hasPrefix:@\"_\"];\n}\n\n- (BOOL)itemIsKindOfClassWithName:(NSString *)className {\n    if (!className) {\n        NSAssert(NO, @\"\");\n        return NO;\n    }\n    return [self itemIsKindOfClassesWithNames:[NSSet setWithObject:className]];\n}\n\n- (BOOL)itemIsKindOfClassesWithNames:(NSSet<NSString *> *)targetClassNames {\n    if (!targetClassNames.count) {\n        return NO;\n    }\n    LookinObject *selfObj = self.viewObject ? : self.layerObject;\n    if (!selfObj) {\n        return NO;\n    }\n    \n    __block BOOL boolValue = NO;\n    [targetClassNames enumerateObjectsUsingBlock:^(NSString * _Nonnull targetClassName, BOOL * _Nonnull stop_outer) {\n        [selfObj.classChainList enumerateObjectsUsingBlock:^(NSString * _Nonnull selfClass, NSUInteger idx, BOOL * _Nonnull stop_inner) {\n            NSString *nonPrefixSelfClass = [selfClass componentsSeparatedByString:@\".\"].lastObject;\n            if ([nonPrefixSelfClass isEqualToString:targetClassName]) {\n                boolValue = YES;\n                *stop_inner = YES;\n            }\n        }];\n        if (boolValue) {\n            *stop_outer = YES;\n        }\n    }];\n    \n    return boolValue;\n}\n\n- (void)setSubitems:(NSArray<LookinDisplayItem *> *)subitems {\n    [_subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        obj.superItem = nil;\n    }];\n    \n    _subitems = subitems;\n    \n    self.isExpandable = (subitems.count > 0);\n    \n    [subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        NSAssert(!obj.superItem, @\"\");\n        obj.superItem = self;\n        \n        [obj _updateInHiddenHierarchyProperty];\n        [obj _updateDisplayingInHierarchyProperty];\n        [obj _updateFrameToRoot];\n    }];\n}\n\n- (void)setIsExpandable:(BOOL)isExpandable {\n    if (_isExpandable == isExpandable) {\n        return;\n    }\n    _isExpandable = isExpandable;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_IsExpandable];\n}\n\n- (void)setIsExpanded:(BOOL)isExpanded {\n    if (_isExpanded == isExpanded) {\n        return;\n    }\n    _isExpanded = isExpanded;\n    [self.subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [obj _updateDisplayingInHierarchyProperty];\n    }];\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_IsExpanded];\n}\n\n- (void)setSoloScreenshot:(LookinImage *)soloScreenshot {\n    if (_soloScreenshot == soloScreenshot) {\n        return;\n    }\n    _soloScreenshot = soloScreenshot;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_SoloScreenshot];\n}\n\n- (void)setIsSelected:(BOOL)isSelected {\n    if (_isSelected == isSelected) {\n        return;\n    }\n    _isSelected = isSelected;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_IsSelected];\n}\n\n- (void)setAvoidSyncScreenshot:(BOOL)avoidSyncScreenshot {\n    if (_avoidSyncScreenshot == avoidSyncScreenshot) {\n        return;\n    }\n    _avoidSyncScreenshot = avoidSyncScreenshot;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_AvoidSyncScreenshot];\n}\n\n- (void)setIsHovered:(BOOL)isHovered {\n    if (_isHovered == isHovered) {\n        return;\n    }\n    _isHovered = isHovered;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_IsHovered];\n}\n\n- (void)setGroupScreenshot:(LookinImage *)groupScreenshot {\n    if (_groupScreenshot == groupScreenshot) {\n        return;\n    }\n    _groupScreenshot = groupScreenshot;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_GroupScreenshot];\n}\n\n- (void)setDisplayingInHierarchy:(BOOL)displayingInHierarchy {\n    if (_displayingInHierarchy == displayingInHierarchy) {\n        return;\n    }\n    _displayingInHierarchy = displayingInHierarchy;\n    [self.subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [obj _updateDisplayingInHierarchyProperty];\n    }];\n    \n    [self _notifyDelegatesWith:LookinDisplayItemProperty_DisplayingInHierarchy];\n}\n\n- (void)_updateDisplayingInHierarchyProperty {\n    if (self.superItem && (!self.superItem.displayingInHierarchy || !self.superItem.isExpanded)) {\n        self.displayingInHierarchy = NO;\n    } else {\n        self.displayingInHierarchy = YES;\n    }\n}\n\n- (void)setIsHidden:(BOOL)isHidden {\n    _isHidden = isHidden;\n    [self _updateInHiddenHierarchyProperty];\n}\n\n- (void)setAlpha:(float)alpha {\n    _alpha = alpha;\n    [self _updateInHiddenHierarchyProperty];\n}\n\n- (void)setInHiddenHierarchy:(BOOL)inHiddenHierarchy {\n    if (_inHiddenHierarchy == inHiddenHierarchy) {\n        return;\n    }\n    _inHiddenHierarchy = inHiddenHierarchy;\n    [self.subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [obj _updateInHiddenHierarchyProperty];\n    }];\n    \n    [self _notifyDelegatesWith:LookinDisplayItemProperty_InHiddenHierarchy];\n}\n\n- (void)_updateInHiddenHierarchyProperty {\n    if (self.superItem.inHiddenHierarchy || self.isHidden || self.alpha <= 0) {\n        self.inHiddenHierarchy = YES;\n    } else {\n        self.inHiddenHierarchy = NO;\n    }\n}\n\n- (void)enumerateSelfAndAncestors:(void (^)(LookinDisplayItem *, BOOL *))block {\n    if (!block) {\n        return;\n    }\n    LookinDisplayItem *item = self;\n    while (item) {\n        BOOL shouldStop = NO;\n        block(item, &shouldStop);\n        if (shouldStop) {\n            break;\n        }\n        item = item.superItem;\n    }\n}\n\n- (void)enumerateAncestors:(void (^)(LookinDisplayItem *, BOOL *))block {\n    [self.superItem enumerateSelfAndAncestors:block];\n}\n\n- (void)enumerateSelfAndChildren:(void (^)(LookinDisplayItem *item))block {\n    if (!block) {\n        return;\n    }\n    \n    block(self);\n    [self.subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull subitem, NSUInteger idx, BOOL * _Nonnull stop) {\n        [subitem enumerateSelfAndChildren:block];\n    }];\n}\n\n+ (NSArray<LookinDisplayItem *> *)flatItemsFromHierarchicalItems:(NSArray<LookinDisplayItem *> *)items {\n    NSMutableArray *resultArray = [NSMutableArray array];\n    \n    [items enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if (obj.superItem) {\n            obj.indentLevel = obj.superItem.indentLevel + 1;\n        }\n        [resultArray addObject:obj];\n        if (obj.subitems.count) {\n            [resultArray addObjectsFromArray:[self flatItemsFromHierarchicalItems:obj.subitems]];\n        }\n    }];\n    \n    return resultArray;\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"%@\", self.title];\n}\n\n- (void)setFrameToRoot:(CGRect)frameToRoot {\n    if (CGRectEqualToRect(_frameToRoot, frameToRoot)) {\n        return;\n    }\n    _frameToRoot = frameToRoot;\n    [(NSArray<LookinDisplayItem *> *)self.subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [obj _updateFrameToRoot];\n        [obj _updateInNoPreviewHierarchy];\n    }];\n    \n    [self _notifyDelegatesWith:LookinDisplayItemProperty_FrameToRoot];\n}\n\n- (void)setPreviewItemDelegate:(id<LookinDisplayItemDelegate>)previewItemDelegate {\n    _previewItemDelegate = previewItemDelegate;\n    \n    if (![previewItemDelegate respondsToSelector:@selector(displayItem:propertyDidChange:)]) {\n        NSAssert(NO, @\"\");\n        _previewItemDelegate = nil;\n        return;\n    }\n    [self.previewItemDelegate displayItem:self propertyDidChange:LookinDisplayItemProperty_None];\n}\n\n- (void)setRowViewDelegate:(id<LookinDisplayItemDelegate>)rowViewDelegate {\n    if (_rowViewDelegate == rowViewDelegate) {\n        return;\n    }\n    _rowViewDelegate = rowViewDelegate;\n    \n    if (![rowViewDelegate respondsToSelector:@selector(displayItem:propertyDidChange:)]) {\n        NSAssert(NO, @\"\");\n        _rowViewDelegate = nil;\n        return;\n    }\n    [self.rowViewDelegate displayItem:self propertyDidChange:LookinDisplayItemProperty_None];\n}\n\n- (void)setFrame:(CGRect)frame {\n    _frame = frame;\n    [self _updateFrameToRoot];\n}\n\n- (void)setBounds:(CGRect)bounds {\n    _bounds = bounds;\n    [(NSArray<LookinDisplayItem *> *)self.subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [obj _updateFrameToRoot];\n    }];\n}\n\n- (void)_updateFrameToRoot {\n    if (!self.superItem) {\n        self.frameToRoot = self.frame;\n        return;\n    }\n    CGRect superFrameToRoot = self.superItem.frameToRoot;\n    CGRect superBounds = self.superItem.bounds;\n    CGRect selfFrame = self.frame;\n    \n    CGFloat x = selfFrame.origin.x - superBounds.origin.x + superFrameToRoot.origin.x;\n    CGFloat y = selfFrame.origin.y - superBounds.origin.y + superFrameToRoot.origin.y;\n    \n    CGFloat width = selfFrame.size.width;\n    CGFloat height = selfFrame.size.height;\n    self.frameToRoot = CGRectMake(x, y, width, height);\n}\n\n- (void)setInNoPreviewHierarchy:(BOOL)inNoPreviewHierarchy {\n    if (_inNoPreviewHierarchy == inNoPreviewHierarchy) {\n        return;\n    }\n    _inNoPreviewHierarchy = inNoPreviewHierarchy;\n    [self.subitems enumerateObjectsUsingBlock:^(LookinDisplayItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        [obj _updateInNoPreviewHierarchy];\n    }];\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_InNoPreviewHierarchy];\n}\n\n- (void)setNoPreview:(BOOL)noPreview {\n    _noPreview = noPreview;\n    [self _updateInNoPreviewHierarchy];\n}\n\n- (void)_updateInNoPreviewHierarchy {\n    if (self.superItem.inNoPreviewHierarchy || self.noPreview) {\n        self.inNoPreviewHierarchy = YES;\n    } else {\n        self.inNoPreviewHierarchy = NO;\n    }\n}\n\n- (LookinImage *)appropriateScreenshot {\n    if (self.isExpandable && self.isExpanded) {\n        return self.soloScreenshot;\n    }\n    return self.groupScreenshot;\n}\n\n- (void)_notifyDelegatesWith:(LookinDisplayItemProperty)property {\n    [self.previewItemDelegate displayItem:self propertyDidChange:property];\n    [self.rowViewDelegate displayItem:self propertyDidChange:property];\n}\n\n- (BOOL)isMatchedWithSearchString:(NSString *)string {\n    if (string.length == 0) {\n        NSAssert(NO, @\"\");\n        return NO;\n    }\n    if ([self.title.lowercaseString containsString:string.lowercaseString]) {\n        return YES;\n    }\n    if ([self.subtitle.lowercaseString containsString:string.lowercaseString]) {\n        return YES;\n    }\n    return NO;\n}\n\n- (void)setIsInSearch:(BOOL)isInSearch {\n    _isInSearch = isInSearch;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_IsInSearch];\n}\n\n- (void)setHighlightedSearchString:(NSString *)highlightedSearchString {\n    _highlightedSearchString = highlightedSearchString;\n    [self _notifyDelegatesWith:LookinDisplayItemProperty_HighlightedSearchString];\n}\n\n- (void)setHostViewControllerObject:(LookinObject *)hostViewControllerObject {\n    _hostViewControllerObject = hostViewControllerObject;\n    [self _updateSubtitleProperty];\n}\n\n- (void)setViewObject:(LookinObject *)viewObject {\n    _viewObject = viewObject;\n    [self _updateSubtitleProperty];\n    [self _updateTitleProperty];\n}\n\n- (void)setLayerObject:(LookinObject *)layerObject {\n    _layerObject = layerObject;\n    [self _updateSubtitleProperty];\n    [self _updateTitleProperty];\n}\n\n- (void)_updateTitleProperty {\n    if (self.viewObject) {\n        _title = self.viewObject.shortSelfClassName;\n    } else if (self.layerObject) {\n        _title = self.layerObject.shortSelfClassName;\n    } else {\n        _title = nil;\n    }\n}\n\n- (void)_updateSubtitleProperty {\n    NSString *subtitle = @\"\";\n    if (self.hostViewControllerObject.shortSelfClassName.length) {\n        subtitle = [NSString stringWithFormat:@\"%@.view\", self.hostViewControllerObject.shortSelfClassName];\n        \n    } else {\n        LookinObject *representedObject = self.viewObject ? : self.layerObject;\n        if (representedObject.specialTrace.length) {\n            subtitle = representedObject.specialTrace;\n            \n        } else if (representedObject.ivarTraces.count) {\n            NSArray<NSString *> *ivarNameList = [representedObject.ivarTraces lookin_map:^id(NSUInteger idx, LookinIvarTrace *value) {\n                return value.ivarName;\n            }];\n            subtitle = [[[NSSet setWithArray:ivarNameList] allObjects] componentsJoinedByString:@\"   \"];\n        }\n    }\n    _subtitle = subtitle;\n}\n\n- (void)dealloc {\n#if TARGET_OS_IPHONE\n#elif TARGET_OS_MAC\n#ifdef DEBUG\n    [[LKEfficiencyMonitor sharedInstance] displayItemDidDealloc];\n#endif\n#endif\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinDisplayItemDetail.h",
    "content": "//\n//  LookinDisplayItemDetail.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/2/19.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDefines.h\"\n\n@class LookinAttributesGroup;\n\n@interface LookinDisplayItemDetail : NSObject <NSSecureCoding>\n\n@property(nonatomic, assign) unsigned long displayItemOid;\n\n@property(nonatomic, strong) LookinImage *groupScreenshot;\n\n@property(nonatomic, strong) LookinImage *soloScreenshot;\n\n@property(nonatomic, strong) NSValue *frameValue;\n\n@property(nonatomic, strong) NSValue *boundsValue;\n\n@property(nonatomic, strong) NSNumber *hiddenValue;\n\n@property(nonatomic, strong) NSNumber *alphaValue;\n\n@property(nonatomic, copy) NSArray<LookinAttributesGroup *> *attributesGroupList;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinDisplayItemDetail.m",
    "content": "//\n//  LookinDisplayItemDetail.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/2/19.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDisplayItemDetail.h\"\n\n#if TARGET_OS_IPHONE\n#import \"UIImage+LookinServer.h\"\n#endif\n\n@implementation LookinDisplayItemDetail\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(self.displayItemOid) forKey:@\"displayItemOid\"];\n    [aCoder encodeObject:self.groupScreenshot.lookin_data forKey:@\"groupScreenshot\"];\n    [aCoder encodeObject:self.soloScreenshot.lookin_data forKey:@\"soloScreenshot\"];\n    [aCoder encodeObject:self.frameValue forKey:@\"frameValue\"];\n    [aCoder encodeObject:self.boundsValue forKey:@\"boundsValue\"];\n    [aCoder encodeObject:self.hiddenValue forKey:@\"hiddenValue\"];\n    [aCoder encodeObject:self.alphaValue forKey:@\"alphaValue\"];\n    [aCoder encodeObject:self.attributesGroupList forKey:@\"attributesGroupList\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.displayItemOid = [[aDecoder decodeObjectForKey:@\"displayItemOid\"] unsignedLongValue];\n        self.groupScreenshot = [[LookinImage alloc] initWithData:[aDecoder decodeObjectForKey:@\"groupScreenshot\"]];\n        self.soloScreenshot = [[LookinImage alloc] initWithData:[aDecoder decodeObjectForKey:@\"soloScreenshot\"]];\n        self.frameValue = [aDecoder decodeObjectForKey:@\"frameValue\"];\n        self.boundsValue = [aDecoder decodeObjectForKey:@\"boundsValue\"];\n        self.hiddenValue = [aDecoder decodeObjectForKey:@\"hiddenValue\"];\n        self.alphaValue = [aDecoder decodeObjectForKey:@\"alphaValue\"];\n        self.attributesGroupList = [aDecoder decodeObjectForKey:@\"attributesGroupList\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinEventHandler.h",
    "content": "//\n//  LookinEventHandler.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/7.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@class LookinObject, LookinIvarTrace, LookinStringTwoTuple;\n\ntypedef NS_ENUM(NSInteger, LookinEventHandlerType) {\n    LookinEventHandlerTypeTargetAction,\n    LookinEventHandlerTypeGesture\n};\n\n@interface LookinEventHandler : NSObject <NSSecureCoding>\n\n@property(nonatomic, assign) LookinEventHandlerType handlerType;\n\n/// 比如 \"UIControlEventTouchUpInside\", \"UITapGestureRecognizer\"\n@property(nonatomic, copy) NSString *eventName;\n/// tuple.first => @\"<WRHomeView: 0xff>\"，tuple.second => @\"handleTap\"\n@property(nonatomic, copy) NSArray<LookinStringTwoTuple *> *targetActions;\n\n/// 返回当前 recognizer 是继承自哪一个基本款 recognizer。\n/// 基本款 recognizer 指的是 TapRecognizer, PinchRecognizer 之类的常见 recognizer\n/// 如果当前 recognizer 本身就是基本款 recognizer，则该属性为 nil\n@property(nonatomic, copy) NSString *inheritedRecognizerName;\n@property(nonatomic, assign) BOOL gestureRecognizerIsEnabled;\n@property(nonatomic, copy) NSString *gestureRecognizerDelegator;\n@property(nonatomic, copy) NSArray<NSString *> *recognizerIvarTraces;\n/// recognizer 对象\n@property(nonatomic, assign) unsigned long long recognizerOid;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinEventHandler.m",
    "content": "//\n//  LookinEventHandler.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/7.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinEventHandler.h\"\n#import \"LookinObject.h\"\n#import \"LookinTuple.h\"\n\n#import \"NSArray+Lookin.h\"\n\n@implementation LookinEventHandler\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinEventHandler *newHandler = [[LookinEventHandler allocWithZone:zone] init];\n    newHandler.handlerType = self.handlerType;\n    newHandler.eventName = self.eventName;\n    newHandler.targetActions = [self.targetActions lookin_map:^id(NSUInteger idx, LookinStringTwoTuple *value) {\n        return value.copy;\n    }];\n    newHandler.gestureRecognizerIsEnabled = self.gestureRecognizerIsEnabled;\n    newHandler.gestureRecognizerDelegator = self.gestureRecognizerDelegator;\n    newHandler.inheritedRecognizerName = self.inheritedRecognizerName;\n    newHandler.recognizerIvarTraces = self.recognizerIvarTraces.copy;\n    newHandler.recognizerOid = self.recognizerOid;\n    return newHandler;\n}\n\n#pragma mark - <NSSecureCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeInteger:self.handlerType forKey:@\"handlerType\"];\n    [aCoder encodeBool:self.gestureRecognizerIsEnabled forKey:@\"gestureRecognizerIsEnabled\"];\n    [aCoder encodeObject:self.eventName forKey:@\"eventName\"];\n    [aCoder encodeObject:self.gestureRecognizerDelegator forKey:@\"gestureRecognizerDelegator\"];\n    [aCoder encodeObject:self.targetActions forKey:@\"targetActions\"];\n    [aCoder encodeObject:self.inheritedRecognizerName forKey:@\"inheritedRecognizerName\"];\n    [aCoder encodeObject:self.recognizerIvarTraces forKey:@\"recognizerIvarTraces\"];\n    [aCoder encodeObject:@(self.recognizerOid) forKey:@\"recognizerOid\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.handlerType = [aDecoder decodeIntegerForKey:@\"handlerType\"];\n        self.gestureRecognizerIsEnabled = [aDecoder decodeBoolForKey:@\"gestureRecognizerIsEnabled\"];\n        self.eventName = [aDecoder decodeObjectForKey:@\"eventName\"];\n        self.gestureRecognizerDelegator = [aDecoder decodeObjectForKey:@\"gestureRecognizerDelegator\"];\n        self.targetActions = [aDecoder decodeObjectForKey:@\"targetActions\"];\n        self.inheritedRecognizerName = [aDecoder decodeObjectForKey:@\"inheritedRecognizerName\"];\n        self.recognizerIvarTraces = [aDecoder decodeObjectForKey:@\"recognizerIvarTraces\"];\n        self.recognizerOid = ((NSNumber *)[aDecoder decodeObjectForKey:@\"recognizerOid\"]).unsignedLongValue;\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinHierarchyFile.h",
    "content": "//\n//  LookinHierarchyFile.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/5/12.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@class LookinHierarchyInfo;\n\n@interface LookinHierarchyFile : NSObject <NSSecureCoding>\n\n/// 记录创建该文件的 LookinServer 的版本\n@property(nonatomic, assign) int serverVersion;\n\n@property(nonatomic, strong) LookinHierarchyInfo *hierarchyInfo;\n\n@property(nonatomic, copy) NSDictionary<NSNumber *, NSData *> *soloScreenshots;\n@property(nonatomic, copy) NSDictionary<NSNumber *, NSData *> *groupScreenshots;\n\n/// 验证 file 的版本之类的是否和当前 Lookin 客户端匹配，如果没有问题则返回 nil，如果有问题则返回 error\n+ (NSError *)verifyHierarchyFile:(LookinHierarchyFile *)file;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinHierarchyFile.m",
    "content": "//\n//  LookinHierarchyFile.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/5/12.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinHierarchyFile.h\"\n\n#import \"NSArray+Lookin.h\"\n\n@implementation LookinHierarchyFile\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeInt:self.serverVersion forKey:@\"serverVersion\"];\n    [aCoder encodeObject:self.hierarchyInfo forKey:@\"hierarchyInfo\"];\n    [aCoder encodeObject:self.soloScreenshots forKey:@\"soloScreenshots\"];\n    [aCoder encodeObject:self.groupScreenshots forKey:@\"groupScreenshots\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.serverVersion = [aDecoder decodeIntForKey:@\"serverVersion\"];\n        self.hierarchyInfo = [aDecoder decodeObjectForKey:@\"hierarchyInfo\"];\n        self.soloScreenshots = [aDecoder decodeObjectForKey:@\"soloScreenshots\"];\n        self.groupScreenshots = [aDecoder decodeObjectForKey:@\"groupScreenshots\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n+ (NSError *)verifyHierarchyFile:(LookinHierarchyFile *)hierarchyFile {\n    if (![hierarchyFile isKindOfClass:[LookinHierarchyFile class]]) {\n        return LookinErr_Inner;\n    }\n    \n    if (hierarchyFile.serverVersion < LOOKIN_SUPPORTED_SERVER_MIN) {\n        // 文件版本太旧\n        // 如果不存在 serverVersion 这个字段，说明版本是 6\n        int fileVersion = hierarchyFile.serverVersion ? : 6;\n        NSString *detail = [NSString stringWithFormat:NSLocalizedString(@\"The document was created by a Lookin app with too old version. Current Lookin app version is %@, but the document version is %@.\", nil), @(LOOKIN_CLIENT_VERSION), @(fileVersion)];\n        return [NSError errorWithDomain:LookinErrorDomain code:LookinErrCode_ServerVersionTooLow userInfo:@{NSLocalizedDescriptionKey:NSLocalizedString(@\"Failed to open the document.\", nil), NSLocalizedRecoverySuggestionErrorKey:detail}];\n    }\n    \n    if (hierarchyFile.serverVersion > LOOKIN_SUPPORTED_SERVER_MAX) {\n        // 文件版本太新\n        NSString *detail = [NSString stringWithFormat:NSLocalizedString(@\"Current Lookin app is too old to open this document. Current Lookin app version is %@, but the document version is %@.\", nil), @(LOOKIN_CLIENT_VERSION), @(hierarchyFile.serverVersion)];\n        return [NSError errorWithDomain:LookinErrorDomain code:LookinErrCode_ServerVersionTooHigh userInfo:@{NSLocalizedDescriptionKey:NSLocalizedString(@\"Failed to open the document.\", nil), NSLocalizedRecoverySuggestionErrorKey:detail}];\n    }\n    \n    return nil;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinHierarchyInfo.h",
    "content": "//\n//  LookinDisplayInfo.h\n//  WeRead\n//\n//  Created by Li Kai on 2018/10/22.\n//  Copyright © 2018年 tencent. All rights reserved.\n//\n\n\n\n#import \"LookinDefines.h\"\n#import \"TargetConditionals.h\"\n#if TARGET_OS_IPHONE\n#import <UIKit/UIKit.h>\n#elif TARGET_OS_MAC\n#import <Appkit/Appkit.h>\n#endif\n\n@class LookinDisplayItem, LookinAttributesGroup, LookinAppInfo;\n\n@interface LookinHierarchyInfo : NSObject <NSSecureCoding, NSCopying>\n\n#if TARGET_OS_IPHONE\n\n+ (instancetype)staticInfo;\n\n+ (instancetype)exportedInfo;\n\n+ (instancetype)perspectiveInfoWithIncludedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows;\n\n+ (NSArray<NSString *> *)collapsedClassList;\n\n#endif\n\n/// 这里其实就是顶端的那几个 UIWindow\n@property(nonatomic, copy) NSArray<LookinDisplayItem *> *displayItems;\n\n@property(nonatomic, copy) NSDictionary<NSString *, id> *colorAlias;\n\n@property(nonatomic, copy) NSArray<NSString *> *collapsedClassList;\n\n@property(nonatomic, strong) LookinAppInfo *appInfo;\n\n/// 标记该 LookinServer 是通过什么方式安装的，0:未知，1:CocoaPods，2:手动，3:源代码，4:断点\n@property(nonatomic, assign) int serverVersion;\n\n@property(nonatomic, assign) int serverSetupType;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinHierarchyInfo.m",
    "content": "//\n//  LookinDisplayInfo.m\n//  WeRead\n//\n//  Created by Li Kai on 2018/10/22.\n//  Copyright © 2018年 tencent. All rights reserved.\n//\n\n#import <objc/runtime.h>\n\n\n\n#import \"LookinHierarchyInfo.h\"\n#import \"LookinAttributesGroup.h\"\n#import \"LookinDisplayItem.h\"\n#import \"LookinAppInfo.h\"\n\n#import \"NSArray+Lookin.h\"\n\n#if TARGET_OS_IPHONE\n#import \"LKS_HierarchyDisplayItemsMaker.h\"\n#endif\n\n@implementation LookinHierarchyInfo\n\n#if TARGET_OS_IPHONE\n\n+ (Class)configClass {\n    static dispatch_once_t onceToken;\n    static Class configClass = NULL;\n    dispatch_once(&onceToken,^{\n        NSString *rawName = @\"LookinConfig\";\n        \n        configClass = NSClassFromString(rawName);\n        if (!configClass) {\n            int numberOfClasses = objc_getClassList(NULL, 0);\n            if (numberOfClasses > 0) {\n                Class *classes = (__unsafe_unretained Class *)malloc(sizeof(Class) * numberOfClasses);\n                numberOfClasses = objc_getClassList(classes, numberOfClasses);\n                for (int i = 0; i < numberOfClasses; i++) {\n                    Class class = classes[i];\n                    if ([NSStringFromClass(class) hasSuffix:@\"LookinConfig\"]) {\n                        configClass = class;\n                        break;\n                    }\n                }\n                free(classes);\n            }\n        }\n    });\n    return configClass;\n}\n\n+ (instancetype)staticInfo {\n    LookinHierarchyInfo *info = [LookinHierarchyInfo new];\n    info.serverVersion = LOOKIN_SERVER_VERSION;\n    info.displayItems = [LKS_HierarchyDisplayItemsMaker itemsWithScreenshots:NO attrList:NO lowImageQuality:NO includedWindows:nil excludedWindows:nil];\n    info.appInfo = [LookinAppInfo currentInfoWithScreenshot:NO icon:YES localIdentifiers:nil];\n    info.collapsedClassList = [self collapsedClassList];\n    info.colorAlias = [self colorAlias];\n    info.serverSetupType = LOOKIN_SERVER_SETUP_TYPE;\n    return info;\n}\n\n+ (instancetype)exportedInfo {\n    LookinHierarchyInfo *info = [LookinHierarchyInfo new];\n    info.serverVersion = LOOKIN_SERVER_VERSION;\n    info.displayItems = [LKS_HierarchyDisplayItemsMaker itemsWithScreenshots:YES attrList:YES lowImageQuality:YES includedWindows:nil excludedWindows:nil];\n    info.appInfo = [LookinAppInfo currentInfoWithScreenshot:NO icon:YES localIdentifiers:nil];\n    info.collapsedClassList = [self collapsedClassList];\n    info.colorAlias = [self colorAlias];\n    info.serverSetupType = LOOKIN_SERVER_SETUP_TYPE;\n    return info;\n}\n\n+ (instancetype)perspectiveInfoWithIncludedWindows:(NSArray<UIWindow *> *)includedWindows excludedWindows:(NSArray<UIWindow *> *)excludedWindows {\n    LookinHierarchyInfo *info = [LookinHierarchyInfo new];\n    info.serverVersion = LOOKIN_SERVER_VERSION;\n    info.displayItems = [LKS_HierarchyDisplayItemsMaker itemsWithScreenshots:YES attrList:YES lowImageQuality:NO includedWindows:includedWindows excludedWindows:excludedWindows];\n    info.appInfo = [LookinAppInfo currentInfoWithScreenshot:NO icon:YES localIdentifiers:nil];\n    info.collapsedClassList = [self collapsedClassList];\n    info.colorAlias = [self colorAlias];\n    info.serverSetupType = LOOKIN_SERVER_SETUP_TYPE;\n    return info;\n}\n\n+ (NSArray<NSString *> *)collapsedClassList {\n    Class configClass = [self configClass];\n    if (!configClass) {\n        return nil;\n    }\n    SEL selector = NSSelectorFromString(@\"collapsedClasses\");\n    if (![configClass respondsToSelector:selector]) {\n        return nil;\n    }\n    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[configClass methodSignatureForSelector:selector]];\n    [invocation setTarget:configClass];\n    [invocation setSelector:selector];\n    [invocation invoke];\n    void *arrayValue;\n    [invocation getReturnValue:&arrayValue];\n    id classList = (__bridge id)(arrayValue);\n    \n    if ([classList isKindOfClass:[NSArray class]]) {\n        NSArray *validClassList = [((NSArray *)classList) lookin_filter:^BOOL(id obj) {\n            return [obj isKindOfClass:[NSString class]];\n        }];\n        return [validClassList copy];\n    }\n    return nil;\n}\n\n+ (NSDictionary<NSString *, UIColor *> *)colorAlias {\n    Class configClass = [self configClass];\n    if (!configClass) {\n        return nil;\n    }\n    SEL selector = NSSelectorFromString(@\"colors\");\n    if (![configClass respondsToSelector:selector]) {\n        return nil;\n    }\n    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[configClass methodSignatureForSelector:selector]];\n    [invocation setTarget:configClass];\n    [invocation setSelector:selector];\n    [invocation invoke];\n    void *dictValue;\n    [invocation getReturnValue:&dictValue];\n    id colorAlias = (__bridge id)(dictValue);\n    \n    if ([colorAlias isKindOfClass:[NSDictionary class]]) {\n        NSMutableDictionary *validDictionary = [NSMutableDictionary dictionary];\n        [(NSDictionary *)colorAlias enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {\n            if ([key isKindOfClass:[NSString class]]) {\n                if ([obj isKindOfClass:[UIColor class]]) {\n                    [validDictionary setObject:obj forKey:key];\n                    \n                } else if ([obj isKindOfClass:[NSDictionary class]]) {\n                    __block BOOL isValidSubDict = YES;\n                    [((NSDictionary *)obj) enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull subKey, id  _Nonnull subObj, BOOL * _Nonnull stop) {\n                        if (![subKey isKindOfClass:[NSString class]] || ![subObj isKindOfClass:[UIColor class]]) {\n                            isValidSubDict = NO;\n                            *stop = YES;\n                        }\n                    }];\n                    if (isValidSubDict) {\n                        [validDictionary setObject:obj forKey:key];\n                    }\n                }\n            }\n        }];\n        return [validDictionary copy];\n    }\n    return nil;\n}\n\n#endif\n\n#pragma mark - <NSSecureCoding>\n\nstatic NSString * const LookinHierarchyInfoCodingKey_DisplayItems = @\"1\";\nstatic NSString * const LookinHierarchyInfoCodingKey_AppInfo = @\"2\";\nstatic NSString * const LookinHierarchyInfoCodingKey_ColorAlias = @\"3\";\nstatic NSString * const LookinHierarchyInfoCodingKey_CollapsedClassList = @\"4\";\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.displayItems forKey:LookinHierarchyInfoCodingKey_DisplayItems];\n    [aCoder encodeObject:self.colorAlias forKey:LookinHierarchyInfoCodingKey_ColorAlias];\n    [aCoder encodeObject:self.collapsedClassList forKey:LookinHierarchyInfoCodingKey_CollapsedClassList];\n    [aCoder encodeObject:self.appInfo forKey:LookinHierarchyInfoCodingKey_AppInfo];\n    [aCoder encodeInt:self.serverVersion forKey:@\"serverVersion\"];\n    [aCoder encodeInt:self.serverSetupType forKey:@\"serverSetupType\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.displayItems = [aDecoder decodeObjectForKey:LookinHierarchyInfoCodingKey_DisplayItems];\n        self.colorAlias = [aDecoder decodeObjectForKey:LookinHierarchyInfoCodingKey_ColorAlias];\n        self.collapsedClassList = [aDecoder decodeObjectForKey:LookinHierarchyInfoCodingKey_CollapsedClassList];\n        self.appInfo = [aDecoder decodeObjectForKey:LookinHierarchyInfoCodingKey_AppInfo];\n        self.serverVersion = [aDecoder decodeIntForKey:@\"serverVersion\"];\n        self.serverSetupType = [aDecoder decodeIntForKey:@\"serverSetupType\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinHierarchyInfo *newAppInfo = [[LookinHierarchyInfo allocWithZone:zone] init];\n    newAppInfo.serverVersion = self.serverVersion;\n    newAppInfo.appInfo = self.appInfo.copy;\n    newAppInfo.collapsedClassList = self.collapsedClassList;\n    newAppInfo.colorAlias = self.colorAlias;\n    newAppInfo.serverSetupType = self.serverSetupType;\n    newAppInfo.displayItems = [self.displayItems lookin_map:^id(NSUInteger idx, LookinDisplayItem *oldItem) {\n        return oldItem.copy;\n    }];\n    \n    return newAppInfo;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinIvarTrace.h",
    "content": "//\n//  LookinIvarTrace.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/4/30.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\nextern NSString *const LookinIvarTraceRelationValue_Self;\n\n/// 如果 hostClassName 和 ivarName 均 equal，则认为两个 LookinIvarTrace 对象彼此 equal\n/// 比如 A 是 B 的 superview，且 A 的 \"_stageView\" 指向 B，则 B 会有一个 LookinIvarTrace：hostType 为 “superview”，hostClassName 为 A 的 class，ivarName 为 “_stageView”\n@interface LookinIvarTrace : NSObject <NSSecureCoding, NSCopying>\n\n/// 该值可能是 \"superview\"、\"superlayer\"、“self” 或 nil\n@property(nonatomic, copy) NSString *relation;\n\n@property(nonatomic, copy) NSString *hostClassName;\n\n@property(nonatomic, copy) NSString *ivarName;\n\n#pragma mark - No Coding\n\n#if TARGET_OS_IPHONE\n@property(nonatomic, weak) id hostObject;\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinIvarTrace.m",
    "content": "//\n//  LookinIvarTrace.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/4/30.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinIvarTrace.h\"\n\nNSString *const LookinIvarTraceRelationValue_Self = @\"self\";\n\n@implementation LookinIvarTrace\n\n#pragma mark - Equal\n\n- (NSUInteger)hash {\n    return self.hostClassName.hash ^ self.ivarName.hash;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) {\n        return YES;\n    }\n    if (![object isKindOfClass:[LookinIvarTrace class]]) {\n        return NO;\n    }\n    LookinIvarTrace *comparedObj = object;\n    if ([self.hostClassName isEqualToString:comparedObj.hostClassName] && [self.ivarName isEqualToString:comparedObj.ivarName]) {\n        return YES;\n    }\n    return NO;\n}\n\n#pragma mark - <NSCopying>\n    \n- (id)copyWithZone:(NSZone *)zone {\n    LookinIvarTrace *newTrace = [[LookinIvarTrace allocWithZone:zone] init];\n    newTrace.relation = self.relation;\n    newTrace.hostClassName = self.hostClassName;\n    newTrace.ivarName = self.ivarName;\n    return newTrace;\n}\n\n#pragma mark - <NSCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.relation forKey:@\"relation\"];\n    [aCoder encodeObject:self.hostClassName forKey:@\"hostClassName\"];\n    [aCoder encodeObject:self.ivarName forKey:@\"ivarName\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.relation = [aDecoder decodeObjectForKey:@\"relation\"];\n        self.hostClassName = [aDecoder decodeObjectForKey:@\"hostClassName\"];\n        self.ivarName = [aDecoder decodeObjectForKey:@\"ivarName\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinMethodTraceRecord.h",
    "content": "//\n//  LookinMethodTraceRecord.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/5/27.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@interface LookinMethodTraceRecordStackItem : NSObject\n\n@property(nonatomic, assign) NSUInteger idx;\n\n@property(nonatomic, copy) NSString *category;\n\n@property(nonatomic, copy) NSString *detail;\n\n@property(nonatomic, assign) BOOL isSystemSeriesEnding;\n\n@property(nonatomic, assign) BOOL isSystemItem;\n\n@end\n\n@interface LookinMethodTraceRecord : NSObject <NSSecureCoding>\n\n@property(nonatomic, copy) NSString *targetAddress;\n\n@property(nonatomic, copy) NSString *selClassName;\n\n@property(nonatomic, copy) NSString *selName;\n\n@property(nonatomic, copy) NSArray<NSString *> *args;\n\n@property(nonatomic, copy) NSArray<NSString *> *callStacks;\n\n\n@property(nonatomic, strong) NSDate *date;\n\n#pragma mark - Non Coding\n\n@property(nonatomic, copy, readonly) NSString *combinedTitle;\n\n- (NSArray<LookinMethodTraceRecordStackItem *> *)briefFormattedCallStacks;\n\n- (NSArray<LookinMethodTraceRecordStackItem *> *)completeFormattedCallStacks;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinMethodTraceRecord.m",
    "content": "//\n//  LookinMethodTraceRecord.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/5/27.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinMethodTraceRecord.h\"\n\n#import \"NSArray+Lookin.h\"\n\n@implementation LookinMethodTraceRecordStackItem\n\n@end\n\n@implementation LookinMethodTraceRecord\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.targetAddress forKey:@\"targetAddress\"];\n    [aCoder encodeObject:self.selClassName forKey:@\"selClassName\"];\n    [aCoder encodeObject:self.selName forKey:@\"selName\"];\n    [aCoder encodeObject:self.args forKey:@\"args\"];\n    [aCoder encodeObject:self.callStacks forKey:@\"callStacks\"];\n    [aCoder encodeObject:self.date forKey:@\"date\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.targetAddress = [aDecoder decodeObjectForKey:@\"targetAddress\"];\n        self.selClassName = [aDecoder decodeObjectForKey:@\"selClassName\"];\n        self.selName = [aDecoder decodeObjectForKey:@\"selName\"];\n        self.args = [aDecoder decodeObjectForKey:@\"args\"];\n        self.callStacks = [aDecoder decodeObjectForKey:@\"callStacks\"];\n        self.date = [aDecoder decodeObjectForKey:@\"date\"];\n        \n        _combinedTitle = [self _makeCombinedTitle];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (NSArray<LookinMethodTraceRecordStackItem *> *)briefFormattedCallStacks {\n    return [self _formattedStacksFromRawStacks:self.callStacks brief:YES];\n}\n\n- (NSArray<LookinMethodTraceRecordStackItem *> *)completeFormattedCallStacks {\n    return [self _formattedStacksFromRawStacks:self.callStacks brief:NO];\n}\n\n- (NSString *)_makeCombinedTitle {\n    NSString *selString;\n    if (self.args.count) {\n        NSArray<NSString *> *selParts = [[self.selName componentsSeparatedByString:@\":\"] lookin_filter:^BOOL(NSString *obj) {\n            return obj.length > 0;\n        }];\n        NSMutableString *mutableSelString = [NSMutableString string];\n        [selParts enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n            [mutableSelString appendString:obj];\n            NSString *arg = [self.args lookin_safeObjectAtIndex:idx];\n            if (arg) {\n                [mutableSelString appendFormat:@\":%@\", arg];\n            } else {\n                [mutableSelString appendString:@\":?\"];\n            }\n            if (idx < selParts.count - 1) {\n                [mutableSelString appendString:@\" \"];\n            }\n        }];\n        selString = mutableSelString.copy;\n    } else {\n        selString = self.selName;\n    }\n    \n    NSString *combinedTitle = [NSString stringWithFormat:@\"[(%@ *)%@ %@]\", self.selClassName, self.targetAddress, selString];\n    return combinedTitle;\n}\n\n- (NSArray<LookinMethodTraceRecordStackItem *> *)_formattedStacksFromRawStacks:(NSArray<NSString *> *)strings brief:(BOOL)brief {\n    NSMutableArray<LookinMethodTraceRecordStackItem *> *items = [NSMutableArray array];\n    [items addObject:({\n        LookinMethodTraceRecordStackItem *item = [LookinMethodTraceRecordStackItem new];\n        item.idx = 0;\n        item.detail = [NSString stringWithFormat:@\"-[%@ %@]\", self.selClassName, self.selName];\n        item;\n    })];\n    [items addObjectsFromArray:[strings lookin_map:^id(NSUInteger idx, NSString *value) {\n        if (idx <= 2) {\n            // 过滤掉 Lookin 相关\n            return nil;\n        }\n        LookinMethodTraceRecordStackItem *item = [self _formattedStackItemFromRawString:value];\n        item.idx = idx - 2;\n        return item;\n    }]];\n    \n    if (!brief) {\n        return items.copy;\n    }\n    \n    NSMutableArray<LookinMethodTraceRecordStackItem *> *briefItems = [NSMutableArray array];\n    [items enumerateObjectsUsingBlock:^(LookinMethodTraceRecordStackItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        if ([obj.category isEqualToString:@\"???\"]) {\n            return;\n        }\n        if (!obj.isSystemItem) {\n            [briefItems addObject:obj];\n            return;\n        }\n        if (!briefItems.lastObject.isSystemItem) {\n            [briefItems addObject:obj];\n            return;\n        }\n        \n        LookinMethodTraceRecordStackItem *nextItem = [items lookin_safeObjectAtIndex:idx + 1];\n        if (!nextItem || !nextItem.isSystemItem) {\n            [briefItems addObject:obj];\n            \n            LookinMethodTraceRecordStackItem *prevItem = [items lookin_safeObjectAtIndex:idx - 1];\n            LookinMethodTraceRecordStackItem *prevPrevItem = [items lookin_safeObjectAtIndex:idx - 2];\n            if (prevItem && prevPrevItem && prevItem.isSystemItem && prevPrevItem.isSystemItem) {\n                obj.isSystemSeriesEnding = YES;\n            }\n        }\n    }];\n    return briefItems.copy;\n}\n\n- (LookinMethodTraceRecordStackItem *)_formattedStackItemFromRawString:(NSString *)string {\n    LookinMethodTraceRecordStackItem *item = [LookinMethodTraceRecordStackItem new];\n    item.category = ({\n        NSArray<NSString *> *strs = [[string componentsSeparatedByString:@\" \"] lookin_filter:^BOOL(NSString *obj) {\n            return obj.length > 0;\n        }];\n        strs[1];\n    });\n    item.detail = ({\n        NSString *tmpStr = [[string componentsSeparatedByString:@\"    \"].lastObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];\n        NSUInteger loc0 = [tmpStr rangeOfString:@\" \"].location;\n        NSUInteger loc1 = [tmpStr rangeOfString:@\" + \"].location;\n        NSString *str = [tmpStr substringWithRange:NSMakeRange(loc0 + 1, loc1 - loc0)];\n        str;\n    });\n    if ([item.category isEqualToString:@\"UIKitCore\"] ||\n        [item.category isEqualToString:@\"libdyld.dylib\"] ||\n        [item.category isEqualToString:@\"CoreFoundation\"]) {\n        item.isSystemItem = YES;\n    }\n    return item;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinObject.h",
    "content": "//\n//  LookinObject.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/4/20.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@class LookinObjectIvar, LookinIvarTrace;\n\n@interface LookinObject : NSObject <NSSecureCoding, NSCopying>\n\n#if TARGET_OS_IPHONE\n+ (instancetype)instanceWithObject:(NSObject *)object;\n#endif\n\n@property(nonatomic, assign) unsigned long oid;\n\n@property(nonatomic, copy) NSString *memoryAddress;\n\n/**\n 比如有一个 UILabel 对象，则它的 classChainList 为 @[@\"UILabel\", @\"UIView\", @\"UIResponder\", @\"NSObject\"]，而它的 ivarList 长度为 4，idx 从小到大分别是 UILabel 层级的 ivars, UIView 层级的 ivars.....\n */\n@property(nonatomic, copy) NSArray<NSString *> *classChainList;\n\n@property(nonatomic, copy) NSString *specialTrace;\n\n@property(nonatomic, copy) NSArray<LookinIvarTrace *> *ivarTraces;\n\n#pragma mark - Non Coding\n\n/// 在 OC 中，completedSelfClassName 和 shortSelfClassName 返回值一样。在 Swift 中，completedSelfClassName 返回的是带命名空间的（比如 LBFM_Swift.LBFMHomeController 或 _TtC 11TestRuntime14ViewController），而 shortSelfClassName 返回的是没有命名空间的（比如 LBFMHomeController）\n@property(nonatomic, copy, readonly) NSString *completedSelfClassName;\n@property(nonatomic, copy, readonly) NSString *shortSelfClassName;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinObject.m",
    "content": "//\n//  LookinObject.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/4/20.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinObject.h\"\n#import \"LookinIvarTrace.h\"\n\n#import \"NSArray+Lookin.h\"\n#import \"NSString+Lookin.h\"\n\n#import \"NSObject+LookinServer.h\"\n\n@implementation LookinObject\n\n#if TARGET_OS_IPHONE\n+ (instancetype)instanceWithObject:(NSObject *)object {\n    LookinObject *lookinObj = [LookinObject new];\n    lookinObj.oid = [object lks_registerOid];\n    \n    lookinObj.memoryAddress = [NSString stringWithFormat:@\"%p\", object];\n    lookinObj.classChainList = [object lks_classChainListWithSwiftPrefix:YES];\n    \n    lookinObj.specialTrace = object.lks_specialTrace;\n    lookinObj.ivarTraces = object.lks_ivarTraces;\n    \n    return lookinObj;\n}\n#endif\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinObject *newObject = [[LookinObject allocWithZone:zone] init];\n    newObject.oid = self.oid;\n    newObject.memoryAddress = self.memoryAddress;\n    newObject.classChainList = self.classChainList;\n    newObject.specialTrace = self.specialTrace;\n    newObject.ivarTraces = [self.ivarTraces lookin_map:^id(NSUInteger idx, LookinIvarTrace *value) {\n        return value.copy;\n    }];\n    return newObject;\n}\n\n#pragma mark - <NSSecureCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(self.oid) forKey:@\"oid\"];\n    [aCoder encodeObject:self.memoryAddress forKey:@\"memoryAddress\"];\n    [aCoder encodeObject:self.classChainList forKey:@\"classChainList\"];\n    [aCoder encodeObject:self.specialTrace forKey:@\"specialTrace\"];\n    [aCoder encodeObject:self.ivarTraces forKey:@\"ivarTraces\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.oid = [(NSNumber *)[aDecoder decodeObjectForKey:@\"oid\"] unsignedLongValue];\n        self.memoryAddress = [aDecoder decodeObjectForKey:@\"memoryAddress\"];\n        self.classChainList = [aDecoder decodeObjectForKey:@\"classChainList\"];\n        self.specialTrace = [aDecoder decodeObjectForKey:@\"specialTrace\"];\n        self.ivarTraces = [aDecoder decodeObjectForKey:@\"ivarTraces\"];\n    }\n    return self;\n}\n\n- (void)setClassChainList:(NSArray<NSString *> *)classChainList {\n    _classChainList = classChainList;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (NSString *)completedSelfClassName {\n    return self.classChainList.firstObject;\n}\n\n- (NSString *)shortSelfClassName {\n    return [[self completedSelfClassName] lookin_shortClassNameString];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinScreenshotFetchManager.h",
    "content": "//\n//  LKImageFetchManager.h\n//  Lookin_macOS\n//\n//  Created by 李凯 on 2019/1/15.\n//  Copyright © 2019 hughkli. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n@class LookinDisplayItem;\n\n@interface LkScreenshotFetchManager : NSObject\n\n+ (instancetype)sharedInstance;\n\n- (void)prepare;\n\n/// 拉取 item 的所有 ancestor 的 groupScreenshot\n- (void)fetchGroupScreenshotForAncestorsOfItem:(LookinDisplayItem *)item;\n/// 拉取 item 的 soloScreenshot\n- (void)fetchSoloScreenshotForItem:(LookinDisplayItem *)item;\n/// 拉取 item 的 groupScreenshot\n- (void)fetchGroupScreenshotForItem:(LookinDisplayItem *)item;\n\n- (void)submitTasks;\n\n/// 拉取 items 的 soloScreenshot 和 groupScreenshot\n- (void)fetchAndUpdateScreenshotsForItems:(NSArray<LookinDisplayItem *> *)items;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinStaticAsyncUpdateTask.h",
    "content": "//\n//  LookinStaticAsyncUpdateTask.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/6/21.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDefines.h\"\n\ntypedef NS_ENUM(NSInteger, LookinStaticAsyncUpdateTaskType) {\n    LookinStaticAsyncUpdateTaskTypeNoScreenshot,\n    LookinStaticAsyncUpdateTaskTypeSoloScreenshot,\n    LookinStaticAsyncUpdateTaskTypeGroupScreenshot\n};\n\n/// 如果两个 Task 对象的 oid 和 taskType 均相同，则二者 equal\n@interface LookinStaticAsyncUpdateTask : NSObject <NSSecureCoding>\n\n@property(nonatomic, assign) unsigned long oid;\n\n@property(nonatomic, assign) LookinStaticAsyncUpdateTaskType taskType;\n\n#pragma mark - Non Coding\n\n@property(nonatomic, assign) CGSize frameSize;\n\n@end\n\n@interface LookinStaticAsyncUpdateTasksPackage : NSObject <NSSecureCoding>\n\n@property(nonatomic, copy) NSArray<LookinStaticAsyncUpdateTask *> *tasks;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinStaticAsyncUpdateTask.m",
    "content": "//\n//  LookinStaticAsyncUpdateTask.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/6/21.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinStaticAsyncUpdateTask.h\"\n\n@implementation LookinStaticAsyncUpdateTask\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(self.oid) forKey:@\"oid\"];\n    [aCoder encodeInteger:self.taskType forKey:@\"taskType\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.oid = [[aDecoder decodeObjectForKey:@\"oid\"] unsignedLongValue];\n        self.taskType = [aDecoder decodeIntegerForKey:@\"taskType\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (NSUInteger)hash {\n    return self.oid ^ self.taskType;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) {\n        return YES;\n    }\n    if (![object isKindOfClass:[LookinStaticAsyncUpdateTask class]]) {\n        return NO;\n    }\n    LookinStaticAsyncUpdateTask *targetTask = object;\n    if (self.oid == targetTask.oid && self.taskType == targetTask.taskType) {\n        return YES;\n    }\n    return NO;\n}\n\n@end\n\n@implementation LookinStaticAsyncUpdateTasksPackage\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.tasks forKey:@\"tasks\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.tasks = [aDecoder decodeObjectForKey:@\"tasks\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinTuple.h",
    "content": "//\n//  LookinTuples.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/14.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@interface LookinTwoTuple : NSObject <NSSecureCoding>\n\n@property(nonatomic, strong) NSObject *first;\n@property(nonatomic, strong) NSObject *second;\n\n@end\n\n@interface LookinStringTwoTuple : NSObject <NSSecureCoding, NSCopying>\n\n+ (instancetype)tupleWithFirst:(NSString *)firstString second:(NSString *)secondString;\n\n@property(nonatomic, copy) NSString *first;\n@property(nonatomic, copy) NSString *second;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinTuple.m",
    "content": "//\n//  LookinTuples.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/14.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinTuple.h\"\n\n@implementation LookinTwoTuple\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.first forKey:@\"first\"];\n    [aCoder encodeObject:self.second forKey:@\"second\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.first = [aDecoder decodeObjectForKey:@\"first\"];\n        self.second = [aDecoder decodeObjectForKey:@\"second\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n- (NSUInteger)hash {\n    return self.first.hash ^ self.second.hash;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) {\n        return YES;\n    }\n    if (![object isKindOfClass:[LookinTwoTuple class]]) {\n        return NO;\n    }\n    LookinTwoTuple *comparedObj = object;\n    if ([self.first isEqual:comparedObj.first] && [self.second isEqual:comparedObj.second]) {\n        return YES;\n    }\n    return NO;\n}\n\n@end\n\n@implementation LookinStringTwoTuple\n\n+ (instancetype)tupleWithFirst:(NSString *)firstString second:(NSString *)secondString {\n    LookinStringTwoTuple *tuple = [LookinStringTwoTuple new];\n    tuple.first = firstString;\n    tuple.second = secondString;\n    return tuple;\n}\n\n#pragma mark - <NSCopying>\n\n- (id)copyWithZone:(NSZone *)zone {\n    LookinStringTwoTuple *newTuple = [[LookinStringTwoTuple allocWithZone:zone] init];\n    newTuple.first = self.first;\n    newTuple.second = self.second;\n    return newTuple;\n}\n\n#pragma mark - <NSCoding>\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.first forKey:@\"first\"];\n    [aCoder encodeObject:self.second forKey:@\"second\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if (self = [super init]) {\n        self.first = [aDecoder decodeObjectForKey:@\"first\"];\n        self.second = [aDecoder decodeObjectForKey:@\"second\"];\n    }\n    return self;\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinWeakContainer.h",
    "content": "//\n//  LookinWeakContainer.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/14.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n@interface LookinWeakContainer : NSObject\n\n+ (instancetype)containerWithObject:(id)object;\n\n@property (nonatomic, weak) id object;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/LookinWeakContainer.m",
    "content": "//\n//  LookinWeakContainer.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/14.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinWeakContainer.h\"\n\n@implementation LookinWeakContainer\n\n+ (instancetype)containerWithObject:(id)object {\n    LookinWeakContainer *container = [LookinWeakContainer new];\n    container.object = object;\n    return container;\n}\n\n- (NSUInteger)hash {\n    return [self.object hash];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) {\n        return YES;\n    }\n    if (![object isKindOfClass:[LookinWeakContainer class]]) {\n        return NO;\n    }\n    LookinWeakContainer *comparedObj = object;\n    if ([self.object isEqual:comparedObj.object]) {\n        return YES;\n    }\n    return NO;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Message/LookinMsgAttribute.h",
    "content": "//\n//  LookinMsgAttribute.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/19.\n//  https://lookin.work\n//\n\n\n\n#import \"LookinDefines.h\"\n\n@interface LookinMsgActionParams : NSObject\n\n@property(nonatomic, strong) id value;\n@property(nonatomic, assign) double doubleValue;\n@property(nonatomic, assign) NSInteger integerValue;\n@property(nonatomic, assign) BOOL boolValue;\n\n@property(nonatomic, weak) id relatedObject;\n@property(nonatomic, strong) id userInfo;\n\n@end\n\n@interface LookinMsgAttribute : NSObject\n\n/// 创建一个示例并给予一个初始值\n+ (instancetype)attributeWithValue:(id)value;\n\n/// 当前的值\n@property(nonatomic, strong, readonly) id currentValue;\n\n/**\n 使用 value 作为 currentValue 属性的值\n 调用该方法后，所有此前通过 subscribe:action: 相关方法注册的 subscriber 的 action 都会被调用，参数是一个 LookinMsgActionParams 对象\n 如果传入了 ignoreSubscriber，则 ignoreSubscriber 这个对象不会收到这次通知\n 如果传入的 value 和之前已有的 value 是 equal 的，则该方法不会产生任何效果\n 传入的 userInfo 对象可在 LookinMsgActionParams 中被读取\n */\n- (void)setValue:(id)value ignoreSubscriber:(id)ignoreSubscriber userInfo:(id)userInfo;\n\n/// target, relatedObject 均不会被强引用，action 方法的参数是一个 LookinMsgActionParams\n/// 即使多次调用该方法添加同一个 target，target 也只会收到一次通知\n- (void)subscribe:(id)target action:(SEL)action relatedObject:(id)relatedObject;\n\n/// 如果 sendAtOnce 为 YES，则在该方法调用后，会立即收到一条消息\n- (void)subscribe:(id)target action:(SEL)action relatedObject:(id)relatedObject sendAtOnce:(BOOL)sendAtOnce;\n\n@end\n\n@interface LookinDoubleMsgAttribute : LookinMsgAttribute\n\n@property(nonatomic, assign, readonly) double currentDoubleValue;\n\n+ (instancetype)attributeWithDouble:(double)value;\n\n- (void)setDoubleValue:(double)doubleValue ignoreSubscriber:(id)ignoreSubscriber;\n\n@end\n\n@interface LookinIntegerMsgAttribute : LookinMsgAttribute\n\n@property(nonatomic, assign, readonly) NSInteger currentIntegerValue;\n\n+ (instancetype)attributeWithInteger:(NSInteger)value;\n\n- (void)setIntegerValue:(NSInteger)integerValue ignoreSubscriber:(id)ignoreSubscriber;\n\n@end\n\n@interface LookinBOOLMsgAttribute : LookinMsgAttribute\n\n@property(nonatomic, assign, readonly) BOOL currentBOOLValue;\n\n+ (instancetype)attributeWithBOOL:(BOOL)value;\n\n- (void)setBOOLValue:(BOOL)BOOLValue ignoreSubscriber:(id)ignoreSubscriber;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Message/LookinMsgAttribute.m",
    "content": "//\n//  LookinMsgAttribute.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/19.\n//  https://lookin.work\n//\n\n#import \"LookinMsgAttribute.h\"\n\n\n\n#import \"LookinMsgTargetAction.h\"\n\n@implementation LookinMsgActionParams\n\n- (double)doubleValue {\n    if (![self.value isKindOfClass:[NSNumber class]]) {\n        NSAssert(NO, @\"\");\n        return 0;\n    }\n    return ((NSNumber *)self.value).doubleValue;\n}\n\n- (NSInteger)integerValue {\n    if (![self.value isKindOfClass:[NSNumber class]]) {\n        NSAssert(NO, @\"\");\n        return 0;\n    }\n    return ((NSNumber *)self.value).integerValue;\n}\n\n- (BOOL)boolValue {\n    if (![self.value isKindOfClass:[NSNumber class]]) {\n        NSAssert(NO, @\"\");\n        return 0;\n    }\n    return ((NSNumber *)self.value).boolValue;\n}\n\n@end\n\n@interface LookinMsgAttribute ()\n\n@property(nonatomic, strong, readwrite) id currentValue;\n\n@property(nonatomic, strong) NSMutableArray<LookinMsgTargetAction *> *subscribers;\n\n@end\n\n@implementation LookinMsgAttribute\n\n+ (instancetype)attributeWithValue:(id)value {\n    LookinMsgAttribute *attr = [LookinMsgAttribute new];\n    attr.currentValue = value;\n    return attr;\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        self.subscribers = [NSMutableArray array];\n    }\n    return self;\n}\n\n- (void)setValue:(id)value ignoreSubscriber:(id)ignoreSubscriber userInfo:(id)userInfo {\n    if ([self.currentValue isEqual:value]) {\n        // value 相等的话直接拒绝\n        return;\n    }\n    self.currentValue = value;\n    \n    __block NSMutableIndexSet *invalidIdxs = nil;\n    [self.subscribers enumerateObjectsUsingBlock:^(LookinMsgTargetAction * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        id subscriberTarget = obj.target;\n        SEL subscriberAction = obj.action;\n        \n        if (!subscriberTarget) {\n            // target 已被释放，删掉这组 target-action 吧\n            if (!invalidIdxs) {\n                invalidIdxs = [NSMutableIndexSet indexSet];\n            }\n            [invalidIdxs addIndex:idx];\n            return;\n        }\n        \n        if (subscriberTarget == ignoreSubscriber) {\n            // 不要通知 ignoreSubscriber\n            return;\n        }\n        \n        LookinMsgActionParams *params = [LookinMsgActionParams new];\n        params.userInfo = userInfo;\n        params.value = value;\n        params.relatedObject = obj.relatedObject;\n#if TARGET_OS_IPHONE\n        [[UIApplication sharedApplication] sendAction:subscriberAction to:subscriberTarget from:params forEvent:nil];\n#elif TARGET_OS_MAC\n        [NSApp sendAction:subscriberAction to:subscriberTarget from:params];\n#endif\n    }];\n    \n    if (invalidIdxs.count) {\n        [self.subscribers removeObjectsAtIndexes:invalidIdxs];\n    }\n}\n\n- (void)subscribe:(id)target action:(SEL)action relatedObject:(id)relatedObject {\n    [self subscribe:target action:action relatedObject:relatedObject sendAtOnce:NO];\n}\n\n- (void)subscribe:(id)target action:(SEL)action relatedObject:(id)relatedObject sendAtOnce:(BOOL)sendAtOnce {\n    if (!target || !action) {\n        return;\n    }\n    LookinMsgTargetAction *newOne = [LookinMsgTargetAction new];\n    newOne.target = target;\n    newOne.action = action;\n    newOne.relatedObject = relatedObject;\n    if ([self.subscribers containsObject:newOne]) {\n        return;\n    }\n    [self.subscribers addObject:newOne];\n    \n    if (sendAtOnce) {\n        LookinMsgActionParams *params = [LookinMsgActionParams new];\n        params.value = self.currentValue;\n        params.relatedObject = relatedObject;\n#if TARGET_OS_IPHONE\n        [[UIApplication sharedApplication] sendAction:action to:target from:params forEvent:nil];\n#elif TARGET_OS_MAC\n        [NSApp sendAction:action to:target from:params];\n#endif\n    }\n}\n\n@end\n\n@implementation LookinDoubleMsgAttribute\n\n+ (instancetype)attributeWithDouble:(double)value {\n    LookinDoubleMsgAttribute *attr = [LookinDoubleMsgAttribute new];\n    attr.currentValue = @(value);\n    return attr;\n}\n\n- (void)setDoubleValue:(double)doubleValue ignoreSubscriber:(id)ignoreSubscriber {\n    [self setValue:@(doubleValue) ignoreSubscriber:ignoreSubscriber userInfo:nil];\n}\n\n- (double)currentDoubleValue {\n    return ((NSNumber *)self.currentValue).doubleValue;\n}\n\n@end\n\n@implementation LookinIntegerMsgAttribute\n\n+ (instancetype)attributeWithInteger:(NSInteger)value {\n    LookinIntegerMsgAttribute *attr = [LookinIntegerMsgAttribute new];\n    attr.currentValue = @(value);\n    return attr;\n}\n\n- (void)setIntegerValue:(NSInteger)integerValue ignoreSubscriber:(id)ignoreSubscriber {\n    [self setValue:@(integerValue) ignoreSubscriber:ignoreSubscriber userInfo:nil];\n}\n\n- (NSInteger)currentIntegerValue {\n    return ((NSNumber *)self.currentValue).integerValue;\n}\n\n@end\n\n@implementation LookinBOOLMsgAttribute\n\n+ (instancetype)attributeWithBOOL:(BOOL)value {\n    LookinBOOLMsgAttribute *attr = [LookinBOOLMsgAttribute new];\n    attr.currentValue = @(value);\n    return attr;\n}\n\n- (void)setBOOLValue:(BOOL)BOOLValue ignoreSubscriber:(id)ignoreSubscriber {\n    [self setValue:@(BOOLValue) ignoreSubscriber:ignoreSubscriber userInfo:nil];\n}\n\n- (BOOL)currentBOOLValue {\n    return ((NSNumber *)self.currentValue).boolValue;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Message/LookinMsgTargetAction.h",
    "content": "//\n//  LookinMsgTargetAction.h\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/19.\n//  https://lookin.work\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n/// target 和 relatedObject 相等，action 名字相同则认为 equal\n@interface LookinMsgTargetAction : NSObject\n\n@property(nonatomic, weak) id target;\n\n@property(nonatomic, assign) SEL action;\n\n@property(nonatomic, weak) id relatedObject;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Message/LookinMsgTargetAction.m",
    "content": "//\n//  LookinMsgTargetAction.m\n//  Lookin\n//\n//  Created by Li Kai on 2019/8/19.\n//  https://lookin.work\n//\n\n#import \"LookinMsgTargetAction.h\"\n\n\n\n@implementation LookinMsgTargetAction\n\n- (NSUInteger)hash {\n    return [self.target hash] ^ NSStringFromSelector(self.action).hash ^ [self.relatedObject hash];\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) {\n        return YES;\n    }\n    if (![object isKindOfClass:[LookinMsgTargetAction class]]) {\n        return NO;\n    }\n    LookinMsgTargetAction *comparedObj = object;\n    if (self.target == comparedObj.target && [NSStringFromSelector(self.action) isEqual:NSStringFromSelector(comparedObj.action)] && self.relatedObject == comparedObj.relatedObject) {\n        return YES;\n    }\n    return NO;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Lookin_PTChannel.h",
    "content": "\n\n//\n// Represents a communication channel between two endpoints talking the same\n// Lookin_PTProtocol.\n//\n#import <Foundation/Foundation.h>\n#import <dispatch/dispatch.h>\n#import <netinet/in.h>\n#import <sys/socket.h>\n\n#import \"Lookin_PTProtocol.h\"\n#import \"Lookin_PTUSBHub.h\"\n\n@class Lookin_PTData, Lookin_PTAddress;\n@protocol Lookin_PTChannelDelegate;\n\n@interface Lookin_PTChannel : NSObject\n\n// Delegate\n@property (strong) id<Lookin_PTChannelDelegate> delegate;\n\n// Communication protocol. Must not be nil.\n@property Lookin_PTProtocol *protocol;\n\n// YES if this channel is a listening server\n@property (readonly) BOOL isListening;\n\n// YES if this channel is a connected peer\n@property (readonly) BOOL isConnected;\n\n// Arbitrary attachment. Note that if you set this, the object will grow by\n// 8 bytes (64 bits).\n@property (strong) id userInfo;\n\n// Create a new channel using the shared Lookin_PTProtocol for the current dispatch\n// queue, with *delegate*.\n+ (Lookin_PTChannel*)channelWithDelegate:(id<Lookin_PTChannelDelegate>)delegate;\n\n\n// Initialize a new frame channel, configuring it to use the calling queue's\n// protocol instance (as returned by [Lookin_PTProtocol sharedProtocolForQueue:\n//   dispatch_get_current_queue()])\n- (id)init;\n\n// Initialize a new frame channel with a specific protocol.\n- (id)initWithProtocol:(Lookin_PTProtocol*)protocol;\n\n// Initialize a new frame channel with a specific protocol and delegate.\n- (id)initWithProtocol:(Lookin_PTProtocol*)protocol delegate:(id<Lookin_PTChannelDelegate>)delegate;\n\n\n// Connect to a TCP port on a device connected over USB\n- (void)connectToPort:(int)port overUSBHub:(Lookin_PTUSBHub*)usbHub deviceID:(NSNumber*)deviceID callback:(void(^)(NSError *error))callback;\n\n// Connect to a TCP port at IPv4 address. Provided port must NOT be in network\n// byte order. Provided in_addr_t must NOT be in network byte order. A value returned\n// from inet_aton() will be in network byte order. You can use a value of inet_aton()\n// as the address parameter here, but you must flip the byte order before passing the\n// in_addr_t to this function.\n- (void)connectToPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error, Lookin_PTAddress *address))callback;\n\n// Listen for connections on port and address, effectively starting a socket\n// server. Provided port must NOT be in network byte order. Provided in_addr_t\n// must NOT be in network byte order.\n// For this to make sense, you should provide a onAccept block handler\n// or a delegate implementing ioFrameChannel:didAcceptConnection:.\n- (void)listenOnPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error))callback;\n\n// Send a frame with an optional payload and optional callback.\n// If *callback* is not NULL, the block is invoked when either an error occured\n// or when the frame (and payload, if any) has been completely sent.\n- (void)sendFrameOfType:(uint32_t)frameType tag:(uint32_t)tag withPayload:(dispatch_data_t)payload callback:(void(^)(NSError *error))callback;\n\n// Lower-level method to assign a connected dispatch IO channel to this channel\n- (BOOL)startReadingFromConnectedChannel:(dispatch_io_t)channel error:(__autoreleasing NSError**)error;\n\n// Close the channel, preventing further reading and writing. Any ongoing and\n// queued reads and writes will be aborted.\n- (void)close;\n\n// \"graceful\" close -- any ongoing and queued reads and writes will complete\n// before the channel ends.\n- (void)cancel;\n\n@end\n\n\n// Wraps a mapped dispatch_data_t object. The memory pointed to by *data* is\n// valid until *dispatchData* is deallocated (normally when the receiver is\n// deallocated).\n@interface Lookin_PTData : NSObject\n@property (readonly) dispatch_data_t dispatchData;\n@property (readonly) void *data;\n@property (readonly) size_t length;\n@end\n\n\n// Represents a peer's address\n@interface Lookin_PTAddress : NSObject\n// For network addresses, this is the IP address in textual format\n@property (readonly) NSString *name;\n// For network addresses, this is the port number. Otherwise 0 (zero).\n@property (readonly) NSInteger port;\n@end\n\n\n// Protocol for Lookin_PTChannel delegates\n@protocol Lookin_PTChannelDelegate <NSObject>\n\n@required\n// Invoked when a new frame has arrived on a channel.\n- (void)ioFrameChannel:(Lookin_PTChannel*)channel didReceiveFrameOfType:(uint32_t)type tag:(uint32_t)tag payload:(Lookin_PTData*)payload;\n\n@optional\n// Invoked to accept an incoming frame on a channel. Reply NO ignore the\n// incoming frame. If not implemented by the delegate, all frames are accepted.\n- (BOOL)ioFrameChannel:(Lookin_PTChannel*)channel shouldAcceptFrameOfType:(uint32_t)type tag:(uint32_t)tag payloadSize:(uint32_t)payloadSize;\n\n// Invoked when the channel closed. If it closed because of an error, *error* is\n// a non-nil NSError object.\n- (void)ioFrameChannel:(Lookin_PTChannel*)channel didEndWithError:(NSError*)error;\n\n// For listening channels, this method is invoked when a new connection has been\n// accepted.\n- (void)ioFrameChannel:(Lookin_PTChannel*)channel didAcceptConnection:(Lookin_PTChannel*)otherChannel fromAddress:(Lookin_PTAddress*)address;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Lookin_PTChannel.m",
    "content": "#import \"Lookin_PTChannel.h\"\n\n\n\n#import \"Lookin_PTPrivate.h\"\n\n#include <sys/ioctl.h>\n#include <sys/un.h>\n#include <err.h>\n#include <fcntl.h>\n#include <arpa/inet.h>\n#import <objc/runtime.h>\n\n// Read member of sockaddr_in without knowing the family\n#define PT_SOCKADDR_ACCESS(ss, member4, member6) \\\n  (((ss)->ss_family == AF_INET) ? ( \\\n    ((const struct sockaddr_in *)(ss))->member4 \\\n  ) : ( \\\n    ((const struct sockaddr_in6 *)(ss))->member6 \\\n  ))\n\n// Connection state (storage: uint8_t)\n#define kConnStateNone 0\n#define kConnStateConnecting 1\n#define kConnStateConnected 2\n#define kConnStateListening 3\n\n// Delegate support optimization (storage: uint8_t)\n#define kDelegateFlagImplements_ioFrameChannel_shouldAcceptFrameOfType_tag_payloadSize 1\n#define kDelegateFlagImplements_ioFrameChannel_didEndWithError 2\n#define kDelegateFlagImplements_ioFrameChannel_didAcceptConnection_fromAddress 4\n\n\n#pragma mark -\n// Note: We are careful about the size of this struct as each connected peer\n// implies one allocation of this struct.\n@interface Lookin_PTChannel () {\n  dispatch_io_t dispatchObj_channel_;\n  dispatch_source_t dispatchObj_source_;\n  NSError *endError_;              // 64 bit\n@public  // here be hacks\n  id<Lookin_PTChannelDelegate> delegate_; // 64 bit\n  uint8_t delegateFlags_;             // 8 bit\n@private\n  uint8_t connState_;                 // 8 bit\n  //char padding_[6];              // 48 bit -- only if allocation speed is important\n}\n- (id)initWithProtocol:(Lookin_PTProtocol*)protocol delegate:(id<Lookin_PTChannelDelegate>)delegate;\n- (BOOL)acceptIncomingConnection:(dispatch_fd_t)serverSocketFD;\n@end\nstatic const uint8_t kUserInfoKey;\n\n#pragma mark -\n@interface Lookin_PTData ()\n- (id)initWithMappedDispatchData:(dispatch_data_t)mappedContiguousData data:(void*)data length:(size_t)length;\n@end\n\n#pragma mark -\n@interface Lookin_PTAddress () {\n  struct sockaddr_storage sockaddr_;\n}\n- (id)initWithSockaddr:(const struct sockaddr_storage*)addr;\n@end\n\n#pragma mark -\n@implementation Lookin_PTChannel\n\n@synthesize protocol = protocol_;\n\n\n+ (Lookin_PTChannel*)channelWithDelegate:(id<Lookin_PTChannelDelegate>)delegate {\n  return [[Lookin_PTChannel alloc] initWithProtocol:[Lookin_PTProtocol sharedProtocolForQueue:dispatch_get_main_queue()] delegate:delegate];\n}\n\n\n- (id)initWithProtocol:(Lookin_PTProtocol*)protocol delegate:(id<Lookin_PTChannelDelegate>)delegate {\n  if (!(self = [super init])) return nil;\n  protocol_ = protocol;\n  self.delegate = delegate;\n  return self;\n}\n\n\n- (id)initWithProtocol:(Lookin_PTProtocol*)protocol {\n  if (!(self = [super init])) return nil;\n  protocol_ = protocol;\n  return self;\n}\n\n\n- (id)init {\n  return [self initWithProtocol:[Lookin_PTProtocol sharedProtocolForQueue:dispatch_get_main_queue()]];\n}\n\n\n- (void)dealloc {\n#if PT_DISPATCH_RETAIN_RELEASE\n  if (dispatchObj_channel_) dispatch_release(dispatchObj_channel_);\n  else if (dispatchObj_source_) dispatch_release(dispatchObj_source_);\n#endif\n}\n\n\n- (BOOL)isConnected {\n  return connState_ == kConnStateConnecting || connState_ == kConnStateConnected;\n}\n\n\n- (BOOL)isListening {\n  return connState_ == kConnStateListening;\n}\n\n\n- (id)userInfo {\n  return objc_getAssociatedObject(self, (void*)&kUserInfoKey);\n}\n\n- (void)setUserInfo:(id)userInfo {\n  objc_setAssociatedObject(self, (const void*)&kUserInfoKey, userInfo, OBJC_ASSOCIATION_RETAIN);\n}\n\n\n- (void)setConnState:(char)connState {\n  connState_ = connState;\n}\n\n\n- (void)setDispatchChannel:(dispatch_io_t)channel {\n  assert(connState_ == kConnStateConnecting || connState_ == kConnStateConnected || connState_ == kConnStateNone);\n  dispatch_io_t prevChannel = dispatchObj_channel_;\n  if (prevChannel != channel) {\n    dispatchObj_channel_ = channel;\n#if PT_DISPATCH_RETAIN_RELEASE\n    if (dispatchObj_channel_) dispatch_retain(dispatchObj_channel_);\n    if (prevChannel) dispatch_release(prevChannel);\n#endif\n    if (!dispatchObj_channel_ && !dispatchObj_source_) {\n      connState_ = kConnStateNone;\n    }\n  }\n}\n\n\n- (void)setDispatchSource:(dispatch_source_t)source {\n  assert(connState_ == kConnStateListening || connState_ == kConnStateNone);\n  dispatch_source_t prevSource = dispatchObj_source_;\n  if (prevSource != source) {\n    dispatchObj_source_ = source;\n#if PT_DISPATCH_RETAIN_RELEASE\n    if (dispatchObj_source_) dispatch_retain(dispatchObj_source_);\n    if (prevSource) dispatch_release(prevSource);\n#endif\n    if (!dispatchObj_channel_ && !dispatchObj_source_) {\n      connState_ = kConnStateNone;\n    }\n  }\n}\n\n\n- (id<Lookin_PTChannelDelegate>)delegate {\n  return delegate_;\n}\n\n\n- (void)setDelegate:(id<Lookin_PTChannelDelegate>)delegate {\n  delegate_ = delegate;\n  delegateFlags_ = 0;\n  if (!delegate_) {\n    return;\n  }\n  \n  if ([delegate respondsToSelector:@selector(ioFrameChannel:shouldAcceptFrameOfType:tag:payloadSize:)]) {\n    delegateFlags_ |= kDelegateFlagImplements_ioFrameChannel_shouldAcceptFrameOfType_tag_payloadSize;\n  }\n  \n  if (delegate_ && [delegate respondsToSelector:@selector(ioFrameChannel:didEndWithError:)]) {\n    delegateFlags_ |= kDelegateFlagImplements_ioFrameChannel_didEndWithError;\n  }\n  \n  if (delegate_ && [delegate respondsToSelector:@selector(ioFrameChannel:didAcceptConnection:fromAddress:)]) {\n    delegateFlags_ |= kDelegateFlagImplements_ioFrameChannel_didAcceptConnection_fromAddress;\n  }\n}\n\n\n//- (void)setFileDescriptor:(dispatch_fd_t)fd {\n//  [self setDispatchChannel:dispatch_io_create(DISPATCH_IO_STREAM, fd, protocol_.queue, ^(int error) {\n//    close(fd);\n//  })];\n//}\n\n\n#pragma mark - Connecting\n\n\n- (void)connectToPort:(int)port overUSBHub:(Lookin_PTUSBHub*)usbHub deviceID:(NSNumber*)deviceID callback:(void(^)(NSError *error))callback {\n  assert(protocol_ != NULL);\n  if (connState_ != kConnStateNone) {\n    if (callback) callback([NSError errorWithDomain:NSPOSIXErrorDomain code:EPERM userInfo:nil]);\n    return;\n  }\n  connState_ = kConnStateConnecting;\n  [usbHub connectToDevice:deviceID port:port onStart:^(NSError *err, dispatch_io_t dispatchChannel) {\n    NSError *error = err;\n    if (!error) {\n      [self startReadingFromConnectedChannel:dispatchChannel error:&error];\n    } else {\n        self->connState_ = kConnStateNone;\n    }\n    if (callback) callback(error);\n  } onEnd:^(NSError *error) {\n      if (self->delegateFlags_ & kDelegateFlagImplements_ioFrameChannel_didEndWithError) {\n          [self->delegate_ ioFrameChannel:self didEndWithError:error];\n    }\n      self->endError_ = nil;\n  }];\n}\n\n\n- (void)connectToPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error, Lookin_PTAddress *address))callback {\n  assert(protocol_ != NULL);\n  if (connState_ != kConnStateNone) {\n    if (callback) callback([NSError errorWithDomain:NSPOSIXErrorDomain code:EPERM userInfo:nil], nil);\n    return;\n  }\n  connState_ = kConnStateConnecting;\n  \n  int error = 0;\n  \n  // Create socket\n  dispatch_fd_t fd = socket(AF_INET, SOCK_STREAM, 0);\n  if (fd == -1) {\n    perror(\"socket(AF_INET, SOCK_STREAM, 0) failed\");\n    error = errno;\n    if (callback) callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil], nil);\n    return;\n  }\n  \n  // Connect socket\n  struct sockaddr_in addr;\n  bzero((char *)&addr, sizeof(addr));\n  \n  addr.sin_len = sizeof(addr);\n  addr.sin_family = AF_INET;\n  addr.sin_port = htons(port);\n  //addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\n  //addr.sin_addr.s_addr = htonl(INADDR_ANY);\n  addr.sin_addr.s_addr = htonl(address);\n  \n  // prevent SIGPIPE\n\tint on = 1;\n\tsetsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on));\n  \n  // int socket, const struct sockaddr *address, socklen_t address_len\n  if (connect(fd, (const struct sockaddr *)&addr, addr.sin_len) == -1) {\n    //perror(\"connect\");\n    error = errno;\n    close(fd);\n    if (callback) callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], nil);\n    return;\n  }\n  \n  // get actual address\n  //if (getsockname(fd, (struct sockaddr*)&addr, (socklen_t*)&addr.sin_len) == -1) {\n  //  error = errno;\n  //  close(fd);\n  //  if (callback) callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], nil);\n  //  return;\n  //}\n  \n  dispatch_io_t dispatchChannel = dispatch_io_create(DISPATCH_IO_STREAM, fd, protocol_.queue, ^(int error) {\n    close(fd);\n      if (self->delegateFlags_ & kDelegateFlagImplements_ioFrameChannel_didEndWithError) {\n          NSError *err = error == 0 ? self->endError_ : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil];\n          [self->delegate_ ioFrameChannel:self didEndWithError:err];\n          self->endError_ = nil;\n    }\n  });\n  \n  if (!dispatchChannel) {\n    close(fd);\n    if (callback) callback([[NSError alloc] initWithDomain:@\"PTError\" code:0 userInfo:nil], nil);\n    return;\n  }\n  \n  // Success\n  NSError *err = nil;\n  Lookin_PTAddress *ptAddr = [[Lookin_PTAddress alloc] initWithSockaddr:(struct sockaddr_storage*)&addr];\n  [self startReadingFromConnectedChannel:dispatchChannel error:&err];\n  if (callback) callback(err, ptAddr);\n}\n\n\n#pragma mark - Listening and serving\n\n\n- (void)listenOnPort:(in_port_t)port IPv4Address:(in_addr_t)address callback:(void(^)(NSError *error))callback {\n  assert(dispatchObj_source_ == nil);\n  \n  // Create socket\n  dispatch_fd_t fd = socket(AF_INET, SOCK_STREAM, 0);\n  if (fd == -1) {\n    if (callback) callback([NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil]);\n    return;\n  }\n  \n  // Connect socket\n  struct sockaddr_in addr;\n  bzero((char *)&addr, sizeof(addr));\n  \n  addr.sin_family = AF_INET;\n  addr.sin_port = htons(port);\n  //addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\n  //addr.sin_addr.s_addr = htonl(INADDR_ANY);\n  addr.sin_addr.s_addr = htonl(address);\n  \n  socklen_t socklen = sizeof(addr);\n  \n  int on = 1;\n  \n  if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {\n    close(fd);\n    if (callback) callback([NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil]);\n    return;\n  }\n  \n  if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {\n    close(fd);\n    if (callback) callback([NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil]);\n    return;\n  }\n  \n  if (bind(fd, (struct sockaddr*)&addr, socklen) != 0) {\n    close(fd);\n    if (callback) callback([NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil]);\n    return;\n  }\n  \n  if (listen(fd, 512) != 0) {\n    close(fd);\n    if (callback) callback([NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil]);\n    return;\n  }\n  \n  [self setDispatchSource:dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, fd, 0, protocol_.queue)];\n  \n  dispatch_source_set_event_handler(dispatchObj_source_, ^{\n      unsigned long nconns = dispatch_source_get_data(self->dispatchObj_source_);\n    while ([self acceptIncomingConnection:fd] && --nconns);\n  });\n  \n  dispatch_source_set_cancel_handler(dispatchObj_source_, ^{\n    // Captures *self*, effectively holding a reference to *self* until cancelled.\n      self->dispatchObj_source_ = nil;\n    close(fd);\n      if (self->delegateFlags_ & kDelegateFlagImplements_ioFrameChannel_didEndWithError) {\n          [self->delegate_ ioFrameChannel:self didEndWithError:self->endError_];\n          self->endError_ = nil;\n    }\n  });\n  \n  dispatch_resume(dispatchObj_source_);\n  //NSLog(@\"%@ opened on fd #%d\", self, fd);\n  \n  connState_ = kConnStateListening;\n  if (callback) callback(nil);\n}\n\n\n- (BOOL)acceptIncomingConnection:(dispatch_fd_t)serverSocketFD {\n  struct sockaddr_in addr;\n  socklen_t addrLen = sizeof(addr);\n  dispatch_fd_t clientSocketFD = accept(serverSocketFD, (struct sockaddr*)&addr, &addrLen);\n  \n  if (clientSocketFD == -1) {\n    perror(\"accept()\");\n    return NO;\n  }\n  \n  // prevent SIGPIPE\n\tint on = 1;\n\tsetsockopt(clientSocketFD, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on));\n  \n  if (fcntl(clientSocketFD, F_SETFL, O_NONBLOCK) == -1) {\n    perror(\"fcntl(.. O_NONBLOCK)\");\n    close(clientSocketFD);\n    return NO;\n  }\n  \n  if (delegateFlags_ & kDelegateFlagImplements_ioFrameChannel_didAcceptConnection_fromAddress) {\n    Lookin_PTChannel *peerChannel = [[Lookin_PTChannel alloc] initWithProtocol:protocol_ delegate:delegate_];\n    __block Lookin_PTChannel *localChannelRef = self;\n    dispatch_io_t dispatchChannel = dispatch_io_create(DISPATCH_IO_STREAM, clientSocketFD, protocol_.queue, ^(int error) {\n      // Important note: This block captures *self*, thus a reference is held to\n      // *self* until the fd is truly closed.\n      localChannelRef = nil;\n\n      close(clientSocketFD);\n      \n      if (peerChannel->delegateFlags_ & kDelegateFlagImplements_ioFrameChannel_didEndWithError) {\n        NSError *err = error == 0 ? peerChannel->endError_ : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil];\n        [peerChannel->delegate_ ioFrameChannel:peerChannel didEndWithError:err];\n        peerChannel->endError_ = nil;\n      }\n    });\n    \n    [peerChannel setConnState:kConnStateConnected];\n    [peerChannel setDispatchChannel:dispatchChannel];\n    \n    assert(((struct sockaddr_storage*)&addr)->ss_len == addrLen);\n    Lookin_PTAddress *address = [[Lookin_PTAddress alloc] initWithSockaddr:(struct sockaddr_storage*)&addr];\n    [delegate_ ioFrameChannel:self didAcceptConnection:peerChannel fromAddress:address];\n    \n    NSError *err = nil;\n    if (![peerChannel startReadingFromConnectedChannel:dispatchChannel error:&err]) {\n      NSLog(@\"startReadingFromConnectedChannel failed in accept: %@\", err);\n    }\n  } else {\n    close(clientSocketFD);\n  }\n  return YES;\n}\n\n\n#pragma mark - Closing the channel\n\n\n- (void)close {\n  if ((connState_ == kConnStateConnecting || connState_ == kConnStateConnected) && dispatchObj_channel_) {\n    dispatch_io_close(dispatchObj_channel_, DISPATCH_IO_STOP);\n    [self setDispatchChannel:NULL];\n  } else if (connState_ == kConnStateListening && dispatchObj_source_) {\n    dispatch_source_cancel(dispatchObj_source_);\n  }\n}\n\n\n- (void)cancel {\n  if ((connState_ == kConnStateConnecting || connState_ == kConnStateConnected) && dispatchObj_channel_) {\n    dispatch_io_close(dispatchObj_channel_, 0);\n    [self setDispatchChannel:NULL];\n  } else if (connState_ == kConnStateListening && dispatchObj_source_) {\n    dispatch_source_cancel(dispatchObj_source_);\n  }\n}\n\n\n#pragma mark - Reading\n\n\n- (BOOL)startReadingFromConnectedChannel:(dispatch_io_t)channel error:(__autoreleasing NSError**)error {\n  if (connState_ != kConnStateNone && connState_ != kConnStateConnecting && connState_ != kConnStateConnected) {\n    if (error) *error = [NSError errorWithDomain:NSPOSIXErrorDomain code:EPERM userInfo:nil];\n    return NO;\n  }\n  \n  if (dispatchObj_channel_ != channel) {\n    [self close];\n    [self setDispatchChannel:channel];\n  }\n  \n  connState_ = kConnStateConnected;\n  \n  // helper\n  BOOL(^handleError)(NSError*,BOOL) = ^BOOL(NSError *error, BOOL isEOS) {\n    if (error) {\n      //NSLog(@\"Error while communicating: %@\", error);\n        self->endError_ = error;\n      [self close];\n      return YES;\n    } else if (isEOS) {\n      [self cancel];\n      return YES;\n    }\n    return NO;\n  };\n  \n  [protocol_ readFramesOverChannel:channel onFrame:^(NSError *error, uint32_t type, uint32_t tag, uint32_t payloadSize, dispatch_block_t resumeReadingFrames) {\n    if (handleError(error, type == PTFrameTypeEndOfStream)) {\n      return;\n    }\n    \n      BOOL accepted = (channel == self->dispatchObj_channel_);\n      if (accepted && (self->delegateFlags_ & kDelegateFlagImplements_ioFrameChannel_shouldAcceptFrameOfType_tag_payloadSize)) {\n          accepted = [self->delegate_ ioFrameChannel:self shouldAcceptFrameOfType:type tag:tag payloadSize:payloadSize];\n    }\n    \n    if (payloadSize == 0) {\n        if (accepted && self->delegate_) {\n            [self->delegate_ ioFrameChannel:self didReceiveFrameOfType:type tag:tag payload:nil];\n      } else {\n        // simply ignore the frame\n      }\n      resumeReadingFrames();\n    } else {\n      // has payload\n      if (!accepted) {\n        // Read and discard payload, ignoring frame\n          [self->protocol_ readAndDiscardDataOfSize:payloadSize overChannel:channel callback:^(NSError *error, BOOL endOfStream) {\n          if (!handleError(error, endOfStream)) {\n            resumeReadingFrames();\n          }\n        }];\n      } else {\n          [self->protocol_ readPayloadOfSize:payloadSize overChannel:channel callback:^(NSError *error, dispatch_data_t contiguousData, const uint8_t *buffer, size_t bufferSize) {\n          if (handleError(error, bufferSize == 0)) {\n            return;\n          }\n          \n              if (self->delegate_) {\n            Lookin_PTData *payload = [[Lookin_PTData alloc] initWithMappedDispatchData:contiguousData data:(void*)buffer length:bufferSize];\n                  [self->delegate_ ioFrameChannel:self didReceiveFrameOfType:type tag:tag payload:payload];\n          }\n          \n          resumeReadingFrames();\n        }];\n      }\n    }\n  }];\n  \n  return YES;\n}\n\n\n#pragma mark - Sending\n\n- (void)sendFrameOfType:(uint32_t)frameType tag:(uint32_t)tag withPayload:(dispatch_data_t)payload callback:(void(^)(NSError *error))callback {\n  if (connState_ == kConnStateConnecting || connState_ == kConnStateConnected) {\n    [protocol_ sendFrameOfType:frameType tag:tag withPayload:payload overChannel:dispatchObj_channel_ callback:callback];\n  } else if (callback) {\n    callback([NSError errorWithDomain:NSPOSIXErrorDomain code:EPERM userInfo:nil]);\n  }\n}\n\n#pragma mark - NSObject\n\n- (NSString*)description {\n  id userInfo = objc_getAssociatedObject(self, (void*)&kUserInfoKey);\n  return [NSString stringWithFormat:@\"<Lookin_PTChannel: %p (%@)%s%@>\", self, (  connState_ == kConnStateConnecting ? @\"connecting\"\n                                                                    : connState_ == kConnStateConnected  ? @\"connected\" \n                                                                    : connState_ == kConnStateListening  ? @\"listening\"\n                                                                    :                                      @\"closed\"),\n          userInfo ? \" \" : \"\", userInfo ? userInfo : @\"\"];\n}\n\n\n@end\n\n\n#pragma mark -\n@implementation Lookin_PTAddress\n\n- (id)initWithSockaddr:(const struct sockaddr_storage*)addr {\n  if (!(self = [super init])) return nil;\n  assert(addr);\n  memcpy((void*)&sockaddr_, (const void*)addr, addr->ss_len);  \n  return self;\n}\n\n\n- (NSString*)name {\n  if (sockaddr_.ss_len) {\n    const void *sin_addr = NULL;\n    size_t bufsize = 0;\n    if (sockaddr_.ss_family == AF_INET6) {\n      bufsize = INET6_ADDRSTRLEN;\n      sin_addr = (const void *)&((const struct sockaddr_in6*)&sockaddr_)->sin6_addr;\n    } else {\n      bufsize = INET_ADDRSTRLEN;\n      sin_addr = (const void *)&((const struct sockaddr_in*)&sockaddr_)->sin_addr;\n    }\n    char *buf = CFAllocatorAllocate(kCFAllocatorDefault, bufsize+1, 0);\n    if (inet_ntop(sockaddr_.ss_family, sin_addr, buf, (unsigned int)bufsize-1) == NULL) {\n      CFAllocatorDeallocate(kCFAllocatorDefault, buf);\n      return nil;\n    }\n    return [[NSString alloc] initWithBytesNoCopy:(void*)buf length:strlen(buf) encoding:NSUTF8StringEncoding freeWhenDone:YES];\n  } else {\n    return nil;\n  }\n}\n\n\n- (NSInteger)port {\n  if (sockaddr_.ss_len) {\n    return ntohs(PT_SOCKADDR_ACCESS(&sockaddr_, sin_port, sin6_port));\n  } else {\n    return 0;\n  }\n}\n\n\n- (NSString*)description {\n  if (sockaddr_.ss_len) {\n    return [NSString stringWithFormat:@\"%@:%u\", self.name, (unsigned)self.port];\n  } else {\n    return @\"(?)\";\n  }\n}\n\n@end\n\n\n#pragma mark -\n@implementation Lookin_PTData\n\n@synthesize dispatchData = dispatchData_;\n@synthesize data = data_;\n@synthesize length = length_;\n\n- (id)initWithMappedDispatchData:(dispatch_data_t)mappedContiguousData data:(void*)data length:(size_t)length {\n  if (!(self = [super init])) return nil;\n  dispatchData_ = mappedContiguousData;\n#if PT_DISPATCH_RETAIN_RELEASE\n  if (dispatchData_) dispatch_retain(dispatchData_);\n#endif\n  data_ = data;\n  length_ = length;\n  return self;\n}\n\n- (void)dealloc {\n#if PT_DISPATCH_RETAIN_RELEASE\n  if (dispatchData_) dispatch_release(dispatchData_);\n#endif\n  data_ = NULL;\n  length_ = 0;\n}\n\n#pragma mark - NSObject\n\n- (NSString*)description {\n  return [NSString stringWithFormat:@\"<Lookin_PTData: %p (%zu bytes)>\", self, length_];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Lookin_PTPrivate.h",
    "content": "\n\n#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \\\n    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8))\n#define PT_DISPATCH_RETAIN_RELEASE 1\n#else\n#define PT_DISPATCH_RETAIN_RELEASE 0\n#endif\n\n#if PT_DISPATCH_RETAIN_RELEASE\n#define PT_PRECISE_LIFETIME\n#define PT_PRECISE_LIFETIME_UNUSED\n#else\n#define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime))\n#define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused))\n#endif\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Lookin_PTProtocol.h",
    "content": "\n\n//\n// A universal frame-based communication protocol which can be used to exchange\n// arbitrary structured data.\n//\n// In short:\n//\n// - Each transmission is comprised by one fixed-size frame.\n// - Each frame contains a protocol version number.\n// - Each frame contains an application frame type.\n// - Each frame can contain an identifying tag.\n// - Each frame can have application-specific data of up to UINT32_MAX size.\n// - Transactions style messaging can be modeled on top using frame tags.\n// - Lightweight API on top of libdispatch (aka GCD) -- close to the metal.\n//\n#include <dispatch/dispatch.h>\n#import <Foundation/Foundation.h>\n\n// Special frame tag that signifies \"no tag\". Your implementation should never\n// create a reply for a frame with this tag.\nstatic const uint32_t PTFrameNoTag = 0;\n\n// Special frame type that signifies that the stream has ended.\nstatic const uint32_t PTFrameTypeEndOfStream = 0;\n\n// NSError domain\nFOUNDATION_EXPORT NSString * const Lookin_PTProtocolErrorDomain;\n\n\n@interface Lookin_PTProtocol : NSObject\n\n// Queue on which to run data processing blocks.\n@property dispatch_queue_t queue;\n\n// Get the shared protocol object for *queue*\n+ (Lookin_PTProtocol*)sharedProtocolForQueue:(dispatch_queue_t)queue;\n\n// Initialize a new protocol object to use a specific queue.\n- (id)initWithDispatchQueue:(dispatch_queue_t)queue;\n\n// Initialize a new protocol object to use the current calling queue.\n- (id)init;\n\n#pragma mark Sending frames\n\n// Generate a new tag that is unique within this protocol object.\n- (uint32_t)newTag;\n\n// Send a frame over *channel* with an optional payload and optional callback.\n// If *callback* is not NULL, the block is invoked when either an error occured\n// or when the frame (and payload, if any) has been completely sent.\n- (void)sendFrameOfType:(uint32_t)frameType\n                    tag:(uint32_t)tag\n            withPayload:(dispatch_data_t)payload\n            overChannel:(dispatch_io_t)channel\n               callback:(void(^)(NSError *error))callback;\n\n#pragma mark Receiving frames\n\n// Read frames over *channel* as they arrive.\n// The onFrame handler is responsible for reading (or discarding) any payload\n// and call *resumeReadingFrames* afterwards to resume reading frames.\n// To stop reading frames, simply do not invoke *resumeReadingFrames*.\n// When the stream ends, a frame of type PTFrameTypeEndOfStream is received.\n- (void)readFramesOverChannel:(dispatch_io_t)channel\n                      onFrame:(void(^)(NSError *error,\n                                       uint32_t type,\n                                       uint32_t tag,\n                                       uint32_t payloadSize,\n                                       dispatch_block_t resumeReadingFrames))onFrame;\n\n// Read a single frame over *channel*. A frame of type PTFrameTypeEndOfStream\n// denotes the stream has ended.\n- (void)readFrameOverChannel:(dispatch_io_t)channel\n                    callback:(void(^)(NSError *error,\n                                      uint32_t frameType,\n                                      uint32_t frameTag,\n                                      uint32_t payloadSize))callback;\n\n#pragma mark Receiving frame payloads\n\n// Read a complete payload. It's the callers responsibility to make sure\n// payloadSize is not too large since memory will be automatically allocated\n// where only payloadSize is the limit.\n// The returned dispatch_data_t object owns *buffer* and thus you need to call\n// dispatch_retain on *contiguousData* if you plan to keep *buffer* around after\n// returning from the callback.\n- (void)readPayloadOfSize:(size_t)payloadSize\n              overChannel:(dispatch_io_t)channel\n                 callback:(void(^)(NSError *error,\n                                   dispatch_data_t contiguousData,\n                                   const uint8_t *buffer,\n                                   size_t bufferSize))callback;\n\n// Discard data of *size* waiting on *channel*. *callback* can be NULL.\n- (void)readAndDiscardDataOfSize:(size_t)size\n                     overChannel:(dispatch_io_t)channel\n                        callback:(void(^)(NSError *error, BOOL endOfStream))callback;\n\n@end\n\n@interface NSData (Lookin_PTProtocol)\n// Creates a new dispatch_data_t object which references the receiver and uses\n// the receivers bytes as its backing data. The returned dispatch_data_t object\n// holds a reference to the recevier. It's the callers responsibility to call\n// dispatch_release on the returned object when done.\n- (dispatch_data_t)createReferencingDispatchData;\n+ (NSData *)dataWithContentsOfDispatchData:(dispatch_data_t)data;\n@end\n\n@interface NSDictionary (Lookin_PTProtocol)\n// See description of -[NSData(Lookin_PTProtocol) createReferencingDispatchData]\n- (dispatch_data_t)createReferencingDispatchData;\n\n// Decode *data* as a peroperty list-encoded dictionary. Returns nil on failure.\n+ (NSDictionary*)dictionaryWithContentsOfDispatchData:(dispatch_data_t)data;\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Lookin_PTProtocol.m",
    "content": "#import \"Lookin_PTProtocol.h\"\n\n\n\n#import \"Lookin_PTPrivate.h\"\n#import <objc/runtime.h>\n\nstatic const uint32_t PTProtocolVersion1 = 1;\n\nNSString * const Lookin_PTProtocolErrorDomain = @\"PTProtocolError\";\n\n// This is what we send as the header for each frame.\ntypedef struct _PTFrame {\n  // The version of the frame and protocol.\n  uint32_t version;\n\n  // Type of frame\n  uint32_t type;\n\n  // Unless zero, a tag is retained in frames that are responses to previous\n  // frames. Applications can use this to build transactions or request-response\n  // logic.\n  uint32_t tag;\n\n  // If payloadSize is larger than zero, *payloadSize* number of bytes are\n  // following, constituting application-specific data.\n  uint32_t payloadSize;\n\n} PTFrame;\n\n\n@interface Lookin_PTProtocol () {\n  uint32_t nextFrameTag_;\n  @public\n  dispatch_queue_t queue_;\n}\n- (dispatch_data_t)createDispatchDataWithFrameOfType:(uint32_t)type frameTag:(uint32_t)frameTag payload:(dispatch_data_t)payload;\n@end\n\n\nstatic void _release_queue_local_protocol(void *objcobj) {\n  if (objcobj) {\n    Lookin_PTProtocol *protocol = (__bridge_transfer id)objcobj;\n    protocol->queue_ = NULL;\n  }\n}\n\n\n@interface Lookin_RQueueLocalIOFrameProtocol : Lookin_PTProtocol\n@end\n@implementation Lookin_RQueueLocalIOFrameProtocol\n- (void)setQueue:(dispatch_queue_t)queue {\n}\n@end\n\n\n@implementation Lookin_PTProtocol\n\n\n+ (Lookin_PTProtocol*)sharedProtocolForQueue:(dispatch_queue_t)queue {\n  static const char currentQueueFrameProtocolKey;\n  //dispatch_queue_t queue = dispatch_get_current_queue();\n  Lookin_PTProtocol *currentQueueFrameProtocol = (__bridge Lookin_PTProtocol*)dispatch_queue_get_specific(queue, &currentQueueFrameProtocolKey);\n  if (!currentQueueFrameProtocol) {\n    currentQueueFrameProtocol = [[Lookin_RQueueLocalIOFrameProtocol alloc] initWithDispatchQueue:NULL];\n    currentQueueFrameProtocol->queue_ = queue; // reference, no retain, since we would create cyclic references\n    dispatch_queue_set_specific(queue, &currentQueueFrameProtocolKey, (__bridge_retained void*)currentQueueFrameProtocol, &_release_queue_local_protocol);\n    return (__bridge Lookin_PTProtocol*)dispatch_queue_get_specific(queue, &currentQueueFrameProtocolKey); // to avoid race conds\n  } else {\n    return currentQueueFrameProtocol;\n  }\n}\n\n\n- (id)initWithDispatchQueue:(dispatch_queue_t)queue {\n  if (!(self = [super init])) return nil;\n  queue_ = queue;\n#if PT_DISPATCH_RETAIN_RELEASE\n  if (queue_) dispatch_retain(queue_);\n#endif\n  return self;\n}\n\n- (id)init {\n  return [self initWithDispatchQueue:dispatch_get_main_queue()];\n}\n\n- (void)dealloc {\n  if (queue_) {\n#if PT_DISPATCH_RETAIN_RELEASE\n    dispatch_release(queue_);\n#endif\n  }\n}\n\n- (dispatch_queue_t)queue {\n  return queue_;\n}\n\n- (void)setQueue:(dispatch_queue_t)queue {\n#if PT_DISPATCH_RETAIN_RELEASE\n  dispatch_queue_t prev_queue = queue_;\n  queue_ = queue;\n  if (queue_) dispatch_retain(queue_);\n  if (prev_queue) dispatch_release(prev_queue);\n#else\n  queue_ = queue;\n#endif\n}\n\n\n- (uint32_t)newTag {\n  return ++nextFrameTag_;\n}\n\n\n#pragma mark -\n#pragma mark Creating frames\n\n\n- (dispatch_data_t)createDispatchDataWithFrameOfType:(uint32_t)type frameTag:(uint32_t)frameTag payload:(dispatch_data_t)payload {\n  PTFrame *frame = CFAllocatorAllocate(kCFAllocatorDefault, sizeof(PTFrame), 0);\n  frame->version = htonl(PTProtocolVersion1);\n  frame->type = htonl(type);\n  frame->tag = htonl(frameTag);\n  \n  if (payload) {\n    size_t payloadSize = dispatch_data_get_size(payload);\n    assert(payloadSize <= UINT32_MAX);\n    frame->payloadSize = htonl((uint32_t)payloadSize);\n  } else {\n    frame->payloadSize = 0;\n  }\n  \n  dispatch_data_t frameData = dispatch_data_create((const void*)frame, sizeof(PTFrame), queue_, ^{\n    CFAllocatorDeallocate(kCFAllocatorDefault, (void*)frame);\n  });\n  \n  if (payload && frame->payloadSize != 0) {\n    // chain frame + payload\n    dispatch_data_t data = dispatch_data_create_concat(frameData, payload);\n#if PT_DISPATCH_RETAIN_RELEASE\n    dispatch_release(frameData);\n#endif\n    frameData = data;\n  }\n  \n  return frameData;\n}\n\n\n#pragma mark -\n#pragma mark Sending frames\n\n\n- (void)sendFrameOfType:(uint32_t)frameType tag:(uint32_t)tag withPayload:(dispatch_data_t)payload overChannel:(dispatch_io_t)channel callback:(void(^)(NSError*))callback {\n  dispatch_data_t frame = [self createDispatchDataWithFrameOfType:frameType frameTag:tag payload:payload];\n  dispatch_io_write(channel, 0, frame, queue_, ^(bool done, dispatch_data_t data, int _errno) {\n    if (done && callback) {\n      callback(_errno == 0 ? nil : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:_errno userInfo:nil]);\n    }\n  });\n#if PT_DISPATCH_RETAIN_RELEASE\n  dispatch_release(frame);\n#endif\n}\n\n\n#pragma mark -\n#pragma mark Receiving frames\n\n\n- (void)readFrameOverChannel:(dispatch_io_t)channel callback:(void(^)(NSError *error, uint32_t frameType, uint32_t frameTag, uint32_t payloadSize))callback {\n  __block dispatch_data_t allData = NULL;\n  \n  dispatch_io_read(channel, 0, sizeof(PTFrame), queue_, ^(bool done, dispatch_data_t data, int error) {\n    //NSLog(@\"dispatch_io_read: done=%d data=%p error=%d\", done, data, error);\n    size_t dataSize = data ? dispatch_data_get_size(data) : 0;\n    \n    if (dataSize) {\n      if (!allData) {\n        allData = data;\n#if PT_DISPATCH_RETAIN_RELEASE\n        dispatch_retain(allData);\n#endif\n      } else {\n#if PT_DISPATCH_RETAIN_RELEASE\n        dispatch_data_t allDataPrev = allData;\n        allData = dispatch_data_create_concat(allData, data);\n        dispatch_release(allDataPrev);\n#else\n        allData = dispatch_data_create_concat(allData, data);\n#endif\n      }\n    }\n    \n    if (done) {\n      if (error != 0) {\n        callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], 0, 0, 0);\n        return;\n      }\n      \n      if (dataSize == 0) {\n        callback(nil, PTFrameTypeEndOfStream, 0, 0);\n        return;\n      }\n      \n      if (!allData || dispatch_data_get_size(allData) < sizeof(PTFrame)) {\n#if PT_DISPATCH_RETAIN_RELEASE\n        if (allData) dispatch_release(allData);\n#endif\n        callback([[NSError alloc] initWithDomain:Lookin_PTProtocolErrorDomain code:0 userInfo:nil], 0, 0, 0);\n        return;\n      }\n      \n      PTFrame *frame = NULL;\n      size_t size = 0;\n      \n      PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(allData, (const void **)&frame, &size); // precise lifetime guarantees bytes in frame will stay valid till the end of scope\n#if PT_DISPATCH_RETAIN_RELEASE\n      dispatch_release(allData);\n#endif\n      if (!contiguousData) {\n        callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:ENOMEM userInfo:nil], 0, 0, 0);\n        return;\n      }\n      \n      frame->version = ntohl(frame->version);\n      if (frame->version != PTProtocolVersion1) {\n        callback([[NSError alloc] initWithDomain:Lookin_PTProtocolErrorDomain code:0 userInfo:nil], 0, 0, 0);\n      } else {\n        frame->type = ntohl(frame->type);\n        frame->tag = ntohl(frame->tag);\n        frame->payloadSize = ntohl(frame->payloadSize);\n        callback(nil, frame->type, frame->tag, frame->payloadSize);\n      }\n      \n#if PT_DISPATCH_RETAIN_RELEASE\n      dispatch_release(contiguousData);\n#endif\n    }\n  });\n}\n\n\n- (void)readPayloadOfSize:(size_t)payloadSize overChannel:(dispatch_io_t)channel callback:(void(^)(NSError *error, dispatch_data_t contiguousData, const uint8_t *buffer, size_t bufferSize))callback {\n  __block dispatch_data_t allData = NULL;\n  dispatch_io_read(channel, 0, payloadSize, queue_, ^(bool done, dispatch_data_t data, int error) {\n    //NSLog(@\"dispatch_io_read: done=%d data=%p error=%d\", done, data, error);\n    size_t dataSize = dispatch_data_get_size(data);\n    \n    if (dataSize) {\n      if (!allData) {\n        allData = data;\n#if PT_DISPATCH_RETAIN_RELEASE\n        dispatch_retain(allData);\n#endif\n      } else {\n#if PT_DISPATCH_RETAIN_RELEASE\n        dispatch_data_t allDataPrev = allData;\n        allData = dispatch_data_create_concat(allData, data);\n        dispatch_release(allDataPrev);\n#else\n        allData = dispatch_data_create_concat(allData, data);\n#endif\n      }\n    }\n    \n    if (done) {\n      if (error != 0) {\n#if PT_DISPATCH_RETAIN_RELEASE\n        if (allData) dispatch_release(allData);\n#endif\n        callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], NULL, NULL, 0);\n        return;\n      }\n      \n      if (dataSize == 0) {\n#if PT_DISPATCH_RETAIN_RELEASE\n        if (allData) dispatch_release(allData);\n#endif\n        callback(nil, NULL, NULL, 0);\n        return;\n      }\n      \n      uint8_t *buffer = NULL;\n      size_t bufferSize = 0;\n      PT_PRECISE_LIFETIME dispatch_data_t contiguousData = NULL;\n      \n      if (allData) {\n        contiguousData = dispatch_data_create_map(allData, (const void **)&buffer, &bufferSize);\n#if PT_DISPATCH_RETAIN_RELEASE\n        dispatch_release(allData); allData = NULL;\n#endif\n        if (!contiguousData) {\n          callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:ENOMEM userInfo:nil], NULL, NULL, 0);\n          return;\n        }\n      }\n      \n      callback(nil, contiguousData, buffer, bufferSize);\n#if PT_DISPATCH_RETAIN_RELEASE\n      if (contiguousData) dispatch_release(contiguousData);\n#endif\n    }\n  });\n}\n\n\n- (void)readAndDiscardDataOfSize:(size_t)size overChannel:(dispatch_io_t)channel callback:(void(^)(NSError*, BOOL))callback {\n  dispatch_io_read(channel, 0, size, queue_, ^(bool done, dispatch_data_t data, int error) {\n    if (done && callback) {\n      size_t dataSize = data ? dispatch_data_get_size(data) : 0;\n      callback(error == 0 ? nil : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], dataSize == 0);\n    }\n  });\n}\n\n\n- (void)readFramesOverChannel:(dispatch_io_t)channel onFrame:(void(^)(NSError*, uint32_t, uint32_t, uint32_t, dispatch_block_t))onFrame {\n  [self readFrameOverChannel:channel callback:^(NSError *error, uint32_t type, uint32_t tag, uint32_t payloadSize) {\n    onFrame(error, type, tag, payloadSize, ^{\n      if (type != PTFrameTypeEndOfStream) {\n        [self readFramesOverChannel:channel onFrame:onFrame];\n      }\n    });\n  }];\n}\n\n\n@end\n\n\n@interface Lookin_PTDispatchData : NSObject {\n  dispatch_data_t dispatchData_;\n}\n@end\n@implementation Lookin_PTDispatchData\n- (id)initWithDispatchData:(dispatch_data_t)dispatchData {\n  if (!(self = [super init])) return nil;\n  dispatchData_ = dispatchData;\n#if PT_DISPATCH_RETAIN_RELEASE\n  dispatch_retain(dispatchData_);\n#endif\n  return self;\n}\n- (void)dealloc {\n#if PT_DISPATCH_RETAIN_RELEASE\n  if (dispatchData_) dispatch_release(dispatchData_);\n#endif\n}\n@end\n\n@implementation NSData (Lookin_PTProtocol)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-getter-return-value\"\n\n- (dispatch_data_t)createReferencingDispatchData {\n  // Note: The queue is used to submit the destructor. Since we only perform an\n  // atomic release of self, it doesn't really matter which queue is used, thus\n  // we use the current calling queue.\n  return dispatch_data_create((const void*)self.bytes, self.length, dispatch_get_main_queue(), ^{\n    // trick to have the block capture the data, thus retain/releasing\n    [self length];\n  });\n}\n\n#pragma clang diagnostic pop\n\n+ (NSData *)dataWithContentsOfDispatchData:(dispatch_data_t)data {\n  if (!data) {\n    return nil;\n  }\n  uint8_t *buffer = NULL;\n  size_t bufferSize = 0;\n  PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(data, (const void **)&buffer, &bufferSize);\n  if (!contiguousData) {\n    return nil;\n  }\n  \n  Lookin_PTDispatchData *dispatchDataRef = [[Lookin_PTDispatchData alloc] initWithDispatchData:contiguousData];\n  NSData *newData = [NSData dataWithBytesNoCopy:(void*)buffer length:bufferSize freeWhenDone:NO];\n#if PT_DISPATCH_RETAIN_RELEASE\n  dispatch_release(contiguousData);\n#endif\n  static const bool kDispatchDataRefKey;\n  objc_setAssociatedObject(newData, (const void*)kDispatchDataRefKey, dispatchDataRef, OBJC_ASSOCIATION_RETAIN);\n  \n  return newData;\n}\n\n@end\n\n\n@implementation NSDictionary (Lookin_PTProtocol)\n\n- (dispatch_data_t)createReferencingDispatchData {\n  NSError *error = nil;\n  NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:self format:NSPropertyListBinaryFormat_v1_0 options:0 error:&error];\n  if (!plistData) {\n    NSLog(@\"Failed to serialize property list: %@\", error);\n    return nil;\n  } else {\n    return [plistData createReferencingDispatchData];\n  }\n}\n\n// Decode *data* as a peroperty list-encoded dictionary. Returns nil on failure.\n+ (NSDictionary*)dictionaryWithContentsOfDispatchData:(dispatch_data_t)data {\n  if (!data) {\n    return nil;\n  }\n  uint8_t *buffer = NULL;\n  size_t bufferSize = 0;\n  PT_PRECISE_LIFETIME dispatch_data_t contiguousData = dispatch_data_create_map(data, (const void **)&buffer, &bufferSize);\n  if (!contiguousData) {\n    return nil;\n  }\n  NSDictionary *dict = [NSPropertyListSerialization propertyListWithData:[NSData dataWithBytesNoCopy:(void*)buffer length:bufferSize freeWhenDone:NO] options:NSPropertyListImmutable format:NULL error:nil];\n#if PT_DISPATCH_RETAIN_RELEASE\n  dispatch_release(contiguousData);\n#endif\n  return dict;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Lookin_PTUSBHub.h",
    "content": "\n\n#include <dispatch/dispatch.h>\n#import <Foundation/Foundation.h>\n\n// Lookin_PTUSBDeviceDidAttachNotification\n// Posted when a device has been attached. Also posted for each device that is\n// already attached when the Lookin_PTUSBHub starts listening.\n//\n//  .userInfo = {\n//    DeviceID = 3;\n//    MessageType = Attached;\n//    Properties = {\n//      ConnectionSpeed = 480000000;\n//      ConnectionType = USB;\n//      DeviceID = 3;\n//      LocationID = 1234567890;\n//      ProductID = 1234;\n//      SerialNumber = 0123456789abcdef0123456789abcdef01234567;\n//    };\n//  }\n//\nFOUNDATION_EXPORT NSString * const Lookin_PTUSBDeviceDidAttachNotification;\n\n// Lookin_PTUSBDeviceDidDetachNotification\n// Posted when a device has been detached.\n//\n//  .userInfo = {\n//    DeviceID = 3;\n//    MessageType = Detached;\n//  }\n//\nFOUNDATION_EXPORT NSString * const Lookin_PTUSBDeviceDidDetachNotification;\n\n// NSError domain\nFOUNDATION_EXPORT NSString * const Lookin_PTUSBHubErrorDomain;\n\n// Error codes returned with NSError.code for NSError domain Lookin_PTUSBHubErrorDomain\ntypedef enum {\n  PTUSBHubErrorBadDevice = 2,\n  PTUSBHubErrorConnectionRefused = 3,\n} PTUSBHubError;\n\n@interface Lookin_PTUSBHub : NSObject\n\n// Shared, implicitly opened hub.\n+ (Lookin_PTUSBHub*)sharedHub;\n\n// Connect to a TCP *port* on a device, while the actual transport is over USB.\n// Upon success, *error* is nil and *channel* is a duplex I/O channel.\n// You can retrieve the underlying file descriptor using\n// dispatch_io_get_descriptor(channel). The dispatch_io_t channel behaves just\n// like any stream type dispatch_io_t, making it possible to use the same logic\n// for both USB bridged connections and e.g. ethernet-based connections.\n//\n// *onStart* is called either when a connection failed, in which case the error\n// argument is non-nil, or when the connection was successfully established (the\n// error argument is nil). Must not be NULL.\n//\n// *onEnd* is called when a connection was open and just did close. If the error\n// argument is non-nil, the channel closed because of an error. Pass NULL for no\n// callback.\n//\n- (void)connectToDevice:(NSNumber*)deviceID\n                   port:(int)port\n                onStart:(void(^)(NSError *error, dispatch_io_t channel))onStart\n                  onEnd:(void(^)(NSError *error))onEnd;\n\n// Start listening for devices. You only need to invoke this method on custom\n// instances to start receiving notifications. The shared instance returned from\n// +sharedHub is always in listening mode.\n//\n// *onStart* is called either when the system failed to start listening, in\n// which case the error argument is non-nil, or when the receiver is listening.\n// Pass NULL for no callback.\n//\n// *onEnd* is called when listening stopped. If the error argument is non-nil,\n// listening stopped because of an error. Pass NULL for no callback.\n//\n- (void)listenOnQueue:(dispatch_queue_t)queue\n              onStart:(void(^)(NSError*))onStart\n                onEnd:(void(^)(NSError*))onEnd;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Lookin_PTUSBHub.m",
    "content": "#import \"Lookin_PTUSBHub.h\"\n\n\n\n#import \"Lookin_PTPrivate.h\"\n\n#include <netinet/in.h>\n#include <sys/socket.h>\n#include <sys/ioctl.h>\n#include <sys/un.h>\n#include <err.h>\n\nNSString * const Lookin_PTUSBHubErrorDomain = @\"PTUSBHubError\";\n\ntypedef uint32_t USBMuxPacketType;\nenum {\n  USBMuxPacketTypeResult = 1,\n\tUSBMuxPacketTypeConnect = 2,\n\tUSBMuxPacketTypeListen = 3,\n  USBMuxPacketTypeDeviceAdd = 4,\n  USBMuxPacketTypeDeviceRemove = 5,\n  // ? = 6,\n  // ? = 7,\n  USBMuxPacketTypePlistPayload = 8,\n};\n\ntypedef uint32_t USBMuxPacketProtocol;\nenum {\n  USBMuxPacketProtocolBinary = 0,\n  USBMuxPacketProtocolPlist = 1,\n};\n\ntypedef uint32_t USBMuxReplyCode;\nenum {\n  USBMuxReplyCodeOK = 0,\n  USBMuxReplyCodeBadCommand = 1,\n  USBMuxReplyCodeBadDevice = 2,\n  USBMuxReplyCodeConnectionRefused = 3,\n  // ? = 4,\n  // ? = 5,\n  USBMuxReplyCodeBadVersion = 6,\n};\n\n\ntypedef struct usbmux_packet {\n  uint32_t size;\n  USBMuxPacketProtocol protocol;\n  USBMuxPacketType type;\n  uint32_t tag;\n  char data[0];\n} __attribute__((__packed__)) usbmux_packet_t;\n\nstatic const uint32_t kUsbmuxPacketMaxPayloadSize = UINT32_MAX - (uint32_t)sizeof(usbmux_packet_t);\n\n\nstatic uint32_t usbmux_packet_payload_size(usbmux_packet_t *upacket) {\n  return upacket->size - sizeof(usbmux_packet_t);\n}\n\n\nstatic void *usbmux_packet_payload(usbmux_packet_t *upacket) {\n  return (void*)upacket->data;\n}\n\n\nstatic void usbmux_packet_set_payload(usbmux_packet_t *upacket,\n                                      const void *payload,\n                                      uint32_t payloadLength)\n{\n  memcpy(usbmux_packet_payload(upacket), payload, payloadLength);\n}\n\n\nstatic usbmux_packet_t *usbmux_packet_alloc(uint32_t payloadSize) {\n  assert(payloadSize <= kUsbmuxPacketMaxPayloadSize);\n  uint32_t upacketSize = sizeof(usbmux_packet_t) + payloadSize;\n  usbmux_packet_t *upacket = CFAllocatorAllocate(kCFAllocatorDefault, upacketSize, 0);\n  memset(upacket, 0, sizeof(usbmux_packet_t));\n  upacket->size = upacketSize;\n  return upacket;\n}\n\n\nstatic usbmux_packet_t *usbmux_packet_create(USBMuxPacketProtocol protocol,\n                                             USBMuxPacketType type,\n                                             uint32_t tag,\n                                             const void *payload,\n                                             uint32_t payloadSize)\n{\n  usbmux_packet_t *upacket = usbmux_packet_alloc(payloadSize);\n  if (!upacket) {\n    return NULL;\n  }\n  \n  upacket->protocol = protocol;\n  upacket->type = type;\n  upacket->tag = tag;\n  \n  if (payload && payloadSize) {\n    usbmux_packet_set_payload(upacket, payload, (uint32_t)payloadSize);\n  }\n  \n  return upacket;\n}\n\n\nstatic void usbmux_packet_free(usbmux_packet_t *upacket) {\n  CFAllocatorDeallocate(kCFAllocatorDefault, upacket);\n}\n\n\nNSString * const Lookin_PTUSBDeviceDidAttachNotification = @\"Lookin_PTUSBDeviceDidAttachNotification\";\nNSString * const Lookin_PTUSBDeviceDidDetachNotification = @\"Lookin_PTUSBDeviceDidDetachNotification\";\n\nstatic NSString *kPlistPacketTypeListen = @\"Listen\";\nstatic NSString *kPlistPacketTypeConnect = @\"Connect\";\n\n\n// Represents a channel of communication between the host process and a remote\n// (device) system. In practice, a Lookin_PTUSBChannel is connected to a usbmuxd\n// endpoint which is configured to either listen for device changes (the\n// PTUSBHub's channel is usually configured as a device notification listener) or\n// configured as a TCP bridge (e.g. channels returned from PTUSBHub's\n// connectToDevice:port:callback:). You should not create channels yourself, but\n// let Lookin_PTUSBHub provide you with already configured channels.\n@interface Lookin_PTUSBChannel : NSObject {\n  dispatch_io_t channel_;\n  dispatch_queue_t queue_;\n  uint32_t nextPacketTag_;\n  NSMutableDictionary *responseQueue_;\n  BOOL autoReadPackets_;\n  BOOL isReadingPackets_;\n}\n\n// The underlying dispatch I/O channel. This is handy if you want to handle your\n// own I/O logic without Lookin_PTUSBChannel. Remember to dispatch_retain() the channel\n// if you plan on using it as it might be released from the Lookin_PTUSBChannel at any\n// point in time.\n@property (readonly) dispatch_io_t dispatchChannel;\n\n// The underlying file descriptor.\n@property (readonly) dispatch_fd_t fileDescriptor;\n\n// Send data\n- (void)sendDispatchData:(dispatch_data_t)data callback:(void(^)(NSError*))callback;\n- (void)sendData:(NSData*)data callback:(void(^)(NSError*))callback;\n\n// Read data\n- (void)readFromOffset:(off_t)offset length:(size_t)length callback:(void(^)(NSError *error, dispatch_data_t data))callback;\n\n// Close the channel, preventing further reads and writes, but letting currently\n// queued reads and writes finish.\n- (void)cancel;\n\n// Close the channel, preventing further reads and writes, immediately\n// terminating any ongoing reads and writes.\n- (void)stop;\n\n@end\n\n\n@interface Lookin_PTUSBChannel (Private)\n\n+ (NSDictionary*)packetDictionaryWithPacketType:(NSString*)messageType payload:(NSDictionary*)payload;\n- (BOOL)openOnQueue:(dispatch_queue_t)queue error:(NSError**)error onEnd:(void(^)(NSError *error))onEnd;\n- (void)listenWithBroadcastHandler:(void(^)(NSDictionary *packet))broadcastHandler callback:(void(^)(NSError*))callback;\n- (BOOL)errorFromPlistResponse:(NSDictionary*)packet error:(NSError**)error;\n- (uint32_t)nextPacketTag;\n- (void)sendPacketOfType:(USBMuxPacketType)type overProtocol:(USBMuxPacketProtocol)protocol tag:(uint32_t)tag payload:(NSData*)payload callback:(void(^)(NSError*))callback;\n- (void)sendPacket:(NSDictionary*)packet tag:(uint32_t)tag callback:(void(^)(NSError *error))callback;\n- (void)sendRequest:(NSDictionary*)packet callback:(void(^)(NSError *error, NSDictionary *responsePacket))callback;\n- (void)scheduleReadPacketWithCallback:(void(^)(NSError *error, NSDictionary *packet, uint32_t packetTag))callback;\n- (void)scheduleReadPacketWithBroadcastHandler:(void(^)(NSDictionary *packet))broadcastHandler;\n- (void)setNeedsReadingPacket;\n@end\n\n\n@interface Lookin_PTUSBHub () {\n  Lookin_PTUSBChannel *channel_;\n}\n- (void)handleBroadcastPacket:(NSDictionary*)packet;\n@end\n\n\n@implementation Lookin_PTUSBHub\n\n\n+ (Lookin_PTUSBHub*)sharedHub {\n  static Lookin_PTUSBHub *gSharedHub;\n  static dispatch_once_t onceToken;\n  dispatch_once(&onceToken, ^{\n    gSharedHub = [Lookin_PTUSBHub new];\n    [gSharedHub listenOnQueue:dispatch_get_main_queue() onStart:^(NSError *error) {\n      if (error) {\n        NSLog(@\"Lookin_PTUSBHub failed to initialize: %@\", error);\n      }\n    } onEnd:nil];\n  });\n  return gSharedHub;\n}\n\n\n- (id)init {\n  if (!(self = [super init])) return nil;\n  \n  return self;\n}\n\n\n- (void)listenOnQueue:(dispatch_queue_t)queue onStart:(void(^)(NSError*))onStart onEnd:(void(^)(NSError*))onEnd {\n  if (channel_) {\n    if (onStart) onStart(nil);\n    return;\n  }\n  channel_ = [Lookin_PTUSBChannel new];\n  NSError *error = nil;\n  if ([channel_ openOnQueue:queue error:&error onEnd:onEnd]) {\n    [channel_ listenWithBroadcastHandler:^(NSDictionary *packet) { [self handleBroadcastPacket:packet]; } callback:onStart];\n  } else if (onStart) {\n    onStart(error);\n  }\n}\n\n\n- (void)connectToDevice:(NSNumber*)deviceID port:(int)port onStart:(void(^)(NSError*, dispatch_io_t))onStart onEnd:(void(^)(NSError*))onEnd {\n  Lookin_PTUSBChannel *channel = [Lookin_PTUSBChannel new];\n  NSError *error = nil;\n  \n  if (![channel openOnQueue:dispatch_get_main_queue() error:&error onEnd:onEnd]) {\n    onStart(error, nil);\n    return;\n  }\n  \n  port = ((port<<8) & 0xFF00) | (port>>8); // limit\n  \n  NSDictionary *packet = [Lookin_PTUSBChannel packetDictionaryWithPacketType:kPlistPacketTypeConnect\n                                                             payload:[NSDictionary dictionaryWithObjectsAndKeys:\n                                                                      deviceID, @\"DeviceID\",\n                                                                      [NSNumber numberWithInt:port], @\"PortNumber\",\n                                                                      nil]];\n  \n  [channel sendRequest:packet callback:^(NSError *error_, NSDictionary *responsePacket) {\n    NSError *error = error_;\n    [channel errorFromPlistResponse:responsePacket error:&error];\n    onStart(error, (error ? nil : channel.dispatchChannel) );\n  }];\n}\n\n\n- (void)handleBroadcastPacket:(NSDictionary*)packet {\n  NSString *messageType = [packet objectForKey:@\"MessageType\"];\n  \n  if ([@\"Attached\" isEqualToString:messageType]) {\n    [[NSNotificationCenter defaultCenter] postNotificationName:Lookin_PTUSBDeviceDidAttachNotification object:self userInfo:packet];\n  } else if ([@\"Detached\" isEqualToString:messageType]) {\n    [[NSNotificationCenter defaultCenter] postNotificationName:Lookin_PTUSBDeviceDidDetachNotification object:self userInfo:packet];\n  } else {\n    NSLog(@\"Warning: Unhandled broadcast message: %@\", packet);\n  }\n}\n\n\n@end\n\n#pragma mark -\n\n@implementation Lookin_PTUSBChannel\n\n+ (NSDictionary*)packetDictionaryWithPacketType:(NSString*)messageType payload:(NSDictionary*)payload {\n  NSDictionary *packet = nil;\n  \n  static NSString *bundleName = nil;\n  static NSString *bundleVersion = nil;\n  static dispatch_once_t onceToken;\n  dispatch_once(&onceToken, ^{\n    NSDictionary *infoDict = [NSBundle mainBundle].infoDictionary;\n    if (infoDict) {\n      bundleName = [infoDict objectForKey:@\"CFBundleName\"];\n      bundleVersion = [[infoDict objectForKey:@\"CFBundleVersion\"] description];\n    }\n  });\n  \n  if (bundleName) {\n    packet = [NSDictionary dictionaryWithObjectsAndKeys:\n              messageType, @\"MessageType\",\n              bundleName, @\"ProgName\",\n              bundleVersion, @\"ClientVersionString\",\n              nil];\n  } else {\n    packet = [NSDictionary dictionaryWithObjectsAndKeys:messageType, @\"MessageType\", nil];\n  }\n  \n  if (payload) {\n    NSMutableDictionary *mpacket = [NSMutableDictionary dictionaryWithDictionary:payload];\n    [mpacket addEntriesFromDictionary:packet];\n    packet = mpacket;\n  }\n  \n  return packet;\n}\n\n\n- (id)init {\n  if (!(self = [super init])) return nil;\n  \n  return self;\n}\n\n\n- (void)dealloc {\n  //NSLog(@\"dealloc %@\", self);\n  if (channel_) {\n#if PT_DISPATCH_RETAIN_RELEASE\n    dispatch_release(channel_);\n#endif\n    channel_ = nil;\n  }\n}\n\n\n- (BOOL)valid {\n  return !!channel_;\n}\n\n\n- (dispatch_io_t)dispatchChannel {\n  return channel_;\n}\n\n\n- (dispatch_fd_t)fileDescriptor {\n  return dispatch_io_get_descriptor(channel_);\n}\n\n\n- (BOOL)openOnQueue:(dispatch_queue_t)queue error:(NSError**)error onEnd:(void(^)(NSError*))onEnd {\n  assert(queue != nil);\n  assert(channel_ == nil);\n  queue_ = queue;\n  \n  // Create socket\n  dispatch_fd_t fd = socket(AF_UNIX, SOCK_STREAM, 0);\n  if (fd == -1) {\n    if (error) *error = [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil];\n    return NO;\n  }\n  \n  // prevent SIGPIPE\n\tint on = 1;\n\tsetsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &on, sizeof(on));\n  \n  // Connect socket\n  struct sockaddr_un addr;\n  addr.sun_family = AF_UNIX;\n  strcpy(addr.sun_path, \"/var/run/usbmuxd\");\n  socklen_t socklen = sizeof(addr);\n  if (connect(fd, (struct sockaddr*)&addr, socklen) == -1) {\n    if (error) *error = [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil];\n    return NO;\n  }\n  \n  channel_ = dispatch_io_create(DISPATCH_IO_STREAM, fd, queue_, ^(int error) {\n    close(fd);\n    if (onEnd) {\n      onEnd(error == 0 ? nil : [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil]);\n    }\n  });\n\n  return YES;\n}\n\n\n- (void)listenWithBroadcastHandler:(void(^)(NSDictionary *packet))broadcastHandler callback:(void(^)(NSError*))callback {\n  autoReadPackets_ = YES;\n  [self scheduleReadPacketWithBroadcastHandler:broadcastHandler];\n  \n  NSDictionary *packet = [Lookin_PTUSBChannel packetDictionaryWithPacketType:kPlistPacketTypeListen payload:nil];\n  \n  [self sendRequest:packet callback:^(NSError *error_, NSDictionary *responsePacket) {\n    if (!callback)\n      return;\n    \n    NSError *error = error_;\n    [self errorFromPlistResponse:responsePacket error:&error];\n    \n    callback(error);\n  }];\n}\n\n\n- (BOOL)errorFromPlistResponse:(NSDictionary*)packet error:(NSError**)error {\n  if (!*error) {\n    NSNumber *n = [packet objectForKey:@\"Number\"];\n    \n    if (!n) {\n      *error = [NSError errorWithDomain:Lookin_PTUSBHubErrorDomain code:(n ? n.integerValue : 0) userInfo:nil];\n      return NO;\n    }\n    \n    USBMuxReplyCode replyCode = (USBMuxReplyCode)n.integerValue;\n    if (replyCode != 0) {\n      NSString *errmessage = @\"Unspecified error\";\n      switch (replyCode) {\n        case USBMuxReplyCodeBadCommand: errmessage = @\"illegal command\"; break;\n        case USBMuxReplyCodeBadDevice: errmessage = @\"unknown device\"; break;\n        case USBMuxReplyCodeConnectionRefused: errmessage = @\"connection refused\"; break;\n        case USBMuxReplyCodeBadVersion: errmessage = @\"invalid version\"; break;\n        default: break;\n      }\n      *error = [NSError errorWithDomain:Lookin_PTUSBHubErrorDomain code:replyCode userInfo:[NSDictionary dictionaryWithObject:errmessage forKey:NSLocalizedDescriptionKey]];\n      return NO;\n    }\n  }\n  return YES;\n}\n\n\n- (uint32_t)nextPacketTag {\n  return ++nextPacketTag_;\n}\n\n\n- (void)sendRequest:(NSDictionary*)packet callback:(void(^)(NSError*, NSDictionary*))callback {\n  uint32_t tag = [self nextPacketTag];\n  [self sendPacket:packet tag:tag callback:^(NSError *error) {\n    if (error) {\n      callback(error, nil);\n      return;\n    }\n    // TODO: timeout un-triggered callbacks in responseQueue_\n      if (!self->responseQueue_) self->responseQueue_ = [NSMutableDictionary new];\n      [self->responseQueue_ setObject:callback forKey:[NSNumber numberWithUnsignedInt:tag]];\n  }];\n  \n  // We are awaiting a response\n  [self setNeedsReadingPacket];\n}\n\n\n- (void)setNeedsReadingPacket {\n  if (!isReadingPackets_) {\n    [self scheduleReadPacketWithBroadcastHandler:nil];\n  }\n}\n\n\n- (void)scheduleReadPacketWithBroadcastHandler:(void(^)(NSDictionary *packet))broadcastHandler {\n  assert(isReadingPackets_ == NO);\n  \n  [self scheduleReadPacketWithCallback:^(NSError *error, NSDictionary *packet, uint32_t packetTag) {\n    // Interpret the package we just received\n    if (packetTag == 0) {\n      // Broadcast message\n      //NSLog(@\"Received broadcast: %@\", packet);\n      if (broadcastHandler) broadcastHandler(packet);\n    } else if (self->responseQueue_) {\n      // Reply\n      NSNumber *key = [NSNumber numberWithUnsignedInt:packetTag];\n        void(^requestCallback)(NSError*,NSDictionary*) = [self->responseQueue_ objectForKey:key];\n      if (requestCallback) {\n          [self->responseQueue_ removeObjectForKey:key];\n        requestCallback(error, packet);\n      } else {\n        NSLog(@\"Warning: Ignoring reply packet for which there is no registered callback. Packet => %@\", packet);\n      }\n    }\n    \n    // Schedule reading another incoming package\n      if (self->autoReadPackets_) {\n      [self scheduleReadPacketWithBroadcastHandler:broadcastHandler];\n    }\n  }];\n}\n\n\n- (void)scheduleReadPacketWithCallback:(void(^)(NSError*, NSDictionary*, uint32_t))callback {\n  static usbmux_packet_t ref_upacket;\n  isReadingPackets_ = YES;\n\n  // Read the first `sizeof(ref_upacket.size)` bytes off the channel_\n  dispatch_io_read(channel_, 0, sizeof(ref_upacket.size), queue_, ^(bool done, dispatch_data_t data, int error) {\n    //NSLog(@\"dispatch_io_read 0,4: done=%d data=%p error=%d\", done, data, error);\n    \n    if (!done)\n      return;\n    \n    if (error) {\n        self->isReadingPackets_ = NO;\n      callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], nil, 0);\n      return;\n    }\n    \n    // Read size of incoming usbmux_packet_t\n    uint32_t upacket_len = 0;\n    char *buffer = NULL;\n    size_t buffer_size = 0;\n    PT_PRECISE_LIFETIME_UNUSED dispatch_data_t map_data = dispatch_data_create_map(data, (const void **)&buffer, &buffer_size); // objc_precise_lifetime guarantees 'map_data' isn't released before memcpy has a chance to do its thing\n    assert(buffer_size == sizeof(ref_upacket.size));\n    assert(sizeof(upacket_len) == sizeof(ref_upacket.size));\n    memcpy((void *)&(upacket_len), (const void *)buffer, buffer_size);\n#if PT_DISPATCH_RETAIN_RELEASE\n    dispatch_release(map_data);\n#endif\n\n    // Allocate a new usbmux_packet_t for the expected size\n    uint32_t payloadLength = upacket_len - (uint32_t)sizeof(usbmux_packet_t);\n    usbmux_packet_t *upacket = usbmux_packet_alloc(payloadLength);\n    \n    // Read rest of the incoming usbmux_packet_t\n    off_t offset = sizeof(ref_upacket.size);\n      dispatch_io_read(self->channel_, offset, (size_t)(upacket->size - offset), self->queue_, ^(bool done, dispatch_data_t data, int error) {\n      //NSLog(@\"dispatch_io_read X,Y: done=%d data=%p error=%d\", done, data, error);\n      \n      if (!done) {\n        return;\n      }\n      \n          self->isReadingPackets_ = NO;\n      \n      if (error) {\n        callback([[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:error userInfo:nil], nil, 0);\n        usbmux_packet_free(upacket);\n        return;\n      }\n\n      if (upacket_len > kUsbmuxPacketMaxPayloadSize) {\n        callback(\n          [[NSError alloc] initWithDomain:Lookin_PTUSBHubErrorDomain code:1 userInfo:@{\n            NSLocalizedDescriptionKey:@\"Received a packet that is too large\"}],\n          nil,\n          0\n        );\n        usbmux_packet_free(upacket);\n        return;\n      }\n      \n      // Copy read bytes onto our usbmux_packet_t\n      char *buffer = NULL;\n      size_t buffer_size = 0;\n      PT_PRECISE_LIFETIME_UNUSED dispatch_data_t map_data = dispatch_data_create_map(data, (const void **)&buffer, &buffer_size);\n      assert(buffer_size == upacket->size - offset);\n      memcpy(((void *)(upacket))+offset, (const void *)buffer, buffer_size);\n#if PT_DISPATCH_RETAIN_RELEASE\n      dispatch_release(map_data);\n#endif\n      \n      // We only support plist protocol\n      if (upacket->protocol != USBMuxPacketProtocolPlist) {\n        callback([[NSError alloc] initWithDomain:Lookin_PTUSBHubErrorDomain code:0 userInfo:[NSDictionary dictionaryWithObject:@\"Unexpected package protocol\" forKey:NSLocalizedDescriptionKey]], nil, upacket->tag);\n        usbmux_packet_free(upacket);\n        return;\n      }\n      \n      // Only one type of packet in the plist protocol\n      if (upacket->type != USBMuxPacketTypePlistPayload) {\n        callback([[NSError alloc] initWithDomain:Lookin_PTUSBHubErrorDomain code:0 userInfo:[NSDictionary dictionaryWithObject:@\"Unexpected package type\" forKey:NSLocalizedDescriptionKey]], nil, upacket->tag);\n        usbmux_packet_free(upacket);\n        return;\n      }\n      \n      // Try to decode any payload as plist\n      NSError *err = nil;\n      NSDictionary *dict = nil;\n      if (usbmux_packet_payload_size(upacket)) {\n        dict = [NSPropertyListSerialization propertyListWithData:[NSData dataWithBytesNoCopy:usbmux_packet_payload(upacket) length:usbmux_packet_payload_size(upacket) freeWhenDone:NO] options:NSPropertyListImmutable format:NULL error:&err];\n      }\n      \n      // Invoke callback\n      callback(err, dict, upacket->tag);\n      usbmux_packet_free(upacket);\n    });\n  });\n}\n\n\n- (void)sendPacketOfType:(USBMuxPacketType)type\n            overProtocol:(USBMuxPacketProtocol)protocol\n                     tag:(uint32_t)tag\n                 payload:(NSData*)payload\n                callback:(void(^)(NSError*))callback\n{\n  assert(payload.length <= kUsbmuxPacketMaxPayloadSize);\n  usbmux_packet_t *upacket = usbmux_packet_create(\n    protocol,\n    type,\n    tag,\n    payload ? payload.bytes : nil,\n    (uint32_t)(payload ? payload.length : 0)\n  );\n  dispatch_data_t data = dispatch_data_create((const void*)upacket, upacket->size, queue_, ^{\n    // Free packet when data is freed\n    usbmux_packet_free(upacket);\n  });\n  //NSData *data1 = [NSData dataWithBytesNoCopy:(void*)upacket length:upacket->size freeWhenDone:NO];\n  //[data1 writeToFile:[NSString stringWithFormat:@\"/Users/rsms/c-packet-%u.data\", tag] atomically:NO];\n  [self sendDispatchData:data callback:callback];\n}\n\n\n- (void)sendPacket:(NSDictionary*)packet tag:(uint32_t)tag callback:(void(^)(NSError*))callback {\n  NSError *error = nil;\n  // NSPropertyListBinaryFormat_v1_0\n  NSData *plistData = [NSPropertyListSerialization dataWithPropertyList:packet format:NSPropertyListXMLFormat_v1_0 options:0 error:&error];\n  if (!plistData) {\n    callback(error);\n  } else {\n    [self sendPacketOfType:USBMuxPacketTypePlistPayload overProtocol:USBMuxPacketProtocolPlist tag:tag payload:plistData callback:callback];\n  }\n}\n\n\n- (void)sendDispatchData:(dispatch_data_t)data callback:(void(^)(NSError*))callback {\n  off_t offset = 0;\n  dispatch_io_write(channel_, offset, data, queue_, ^(bool done, dispatch_data_t data, int _errno) {\n    //NSLog(@\"dispatch_io_write: done=%d data=%p error=%d\", done, data, error);\n    if (!done)\n      return;\n    if (callback) {\n      NSError *err = nil;\n      if (_errno) err = [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:_errno userInfo:nil];\n      callback(err);\n    }\n  });\n#if PT_DISPATCH_RETAIN_RELEASE\n  dispatch_release(data); // Release our ref. A ref is still held by dispatch_io_write\n#endif\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-getter-return-value\"\n\n- (void)sendData:(NSData*)data callback:(void(^)(NSError*))callback {\n  dispatch_data_t ddata = dispatch_data_create((const void*)data.bytes, data.length, queue_, ^{\n    // trick to have the block capture and retain the data\n    [data length];\n  });\n  [self sendDispatchData:ddata callback:callback];\n}\n\n#pragma clang diagnostic pop\n\n- (void)readFromOffset:(off_t)offset length:(size_t)length callback:(void(^)(NSError *error, dispatch_data_t data))callback {\n  dispatch_io_read(channel_, offset, length, queue_, ^(bool done, dispatch_data_t data, int _errno) {\n    if (!done)\n      return;\n    \n    NSError *error = nil;\n    if (_errno != 0) {\n      error = [[NSError alloc] initWithDomain:NSPOSIXErrorDomain code:_errno userInfo:nil];\n    }\n\n    callback(error, data);\n  });\n}\n\n\n- (void)cancel {\n  if (channel_) {\n    dispatch_io_close(channel_, 0);\n  }\n}\n\n\n- (void)stop {\n  if (channel_) {\n    dispatch_io_close(channel_, DISPATCH_IO_STOP);\n  }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/LookinServer/Src/Shared/Peertalk/Peertalk.h",
    "content": "//\n//  Peertalk.h\n//  Peertalk\n//\n//  Created by Marek Cirkos on 12/04/2016.\n//\n//\n\n\n\n#import <Foundation/Foundation.h>\n\n//! Project version number for Peertalk.\nFOUNDATION_EXPORT double PeertalkVersionNumber;\n\n//! Project version string for Peertalk.\nFOUNDATION_EXPORT const unsigned char PeertalkVersionString[];\n\n// In this header, you should import all the public headers of your framework using statements like #import <Peertalk/PublicHeader.h>\n\n\n#import \"Lookin_PTChannel.h\"\n#import \"Lookin_PTProtocol.h\"\n#import \"Lookin_PTUSBHub.h\"\n"
  },
  {
    "path": "JetChat/Pods/LookinServer.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t002AFEB451777DB9A3DC1418A64FDAEB /* UIImageView+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = BBB9FB08942E7D1C225B340C732C8423 /* UIImageView+LookinServer.m */; };\n\t\t00A917F15A02C36E85016A1EC5151F48 /* LKS_PerspectiveHierarchyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E9E73467EA12C21865FE8795FBCCC7B /* LKS_PerspectiveHierarchyCell.m */; };\n\t\t03BF733EE0CCA34067BE750A86CB4FE3 /* UIView+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 56E60FA565B2F3D48818431F6A85B480 /* UIView+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t05DE3FCE3B92E2C903FA0A27C2949E5C /* NSString+Lookin.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BE23A84D94F58A983283437C76B01EA /* NSString+Lookin.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t0A5D6BE168F45534389D58B0E5C402F2 /* LKS_RequestHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A99B3B51A5DA2F5F3FFA7A193677A0 /* LKS_RequestHandler.m */; };\n\t\t0B19793D921F29CA064CF7CFEC4DACFF /* LookinAttrIdentifiers.m in Sources */ = {isa = PBXBuildFile; fileRef = 2F0724A757C4E810ADCA40BF3CE53E06 /* LookinAttrIdentifiers.m */; };\n\t\t0B38FBE4A49B85218C8BB54696D057F7 /* UIView+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F2894DDD0E7CDB23764E9BACDF09E09 /* UIView+LookinServer.m */; };\n\t\t0ED01054EF8DFC123A9AD872AFC9CD15 /* UILabel+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E191CE81EFBC8BCBEB3FB1BA5BA26C5 /* UILabel+LookinServer.m */; };\n\t\t0F44787643816923BAC087056C4A2080 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 529308949481ABD4AB88E1E73E3E257A /* Foundation.framework */; };\n\t\t162B974D5CFAA781469962B3E3452586 /* LookinServerDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 6152D80B4CE36E418A4B43B6BC0659F1 /* LookinServerDefines.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1A07C183B19438380EC391F638EAB6C4 /* LKS_TraceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 941BD4B62238E984825C8E89087A91F4 /* LKS_TraceManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1C33FC41BC4C4A2BF858360886B333F4 /* LookinEventHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6212748693A9421890641FD76646BA /* LookinEventHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1DF8E0315478D3C7360E2E6A1175A234 /* LKS_LocalInspectPanelLabelView.h in Headers */ = {isa = PBXBuildFile; fileRef = 022AE5FFEC8ED71480F4495D0C937D05 /* LKS_LocalInspectPanelLabelView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1FAE39D41FE1F9741E04003A6C903582 /* CALayer+Lookin.m in Sources */ = {isa = PBXBuildFile; fileRef = C7D818A123DBDDE9CD05E9C12841308A /* CALayer+Lookin.m */; };\n\t\t226CDFCBA1E5B2AFC1C73CEEBF4C3B9D /* NSObject+Lookin.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A048573D79E53B8ED42A1FE066C1EA2 /* NSObject+Lookin.m */; };\n\t\t243F6946BE59EA71989BE9CC0E4395CE /* UILabel+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = DF9096D9A2FD6A999E61346368CAA7ED /* UILabel+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t244E750327B0F3772822E822AE74C4B1 /* LKS_RequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 42A2DA1C4547F338D0840E159B27BBC1 /* LKS_RequestHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t24788392D96B78DACD52C327D7C81588 /* LookinScreenshotFetchManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 465E6E3CA198A46580FAB98EDF3A4650 /* LookinScreenshotFetchManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t25D304D758958B0D9C27B8FC8EB0ACBB /* UITableView+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = F29C8C8AF671DD8AD6A6F71861EA1879 /* UITableView+LookinServer.m */; };\n\t\t26C1AA2A72BA4911E95AEC4B218892F4 /* UIBlurEffect+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 29885A010A1ED17B3073AC278B9CD638 /* UIBlurEffect+LookinServer.m */; };\n\t\t282C55A16088154CC5A1D5DEDA5496BD /* LookinAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = C20376EF9715E89F9FAB805E395FC794 /* LookinAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t28D119755232554E19AF0D22A47E9A6D /* LookinServer-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B18EB5F410154612C3DBD3105D53A343 /* LookinServer-dummy.m */; };\n\t\t29BEE3561388B64AF95D3514D5D06A04 /* LKS_PerspectiveToolbarButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = AC84153F310DFC708D8164A5A577F77B /* LKS_PerspectiveToolbarButtons.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2AC92219E8826061D9670134CF8D9834 /* UIGestureRecognizer+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = E27C154D81D31A232159AB57767C52AE /* UIGestureRecognizer+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2CF42A33A3EFB7E758A00EAE88CA48A6 /* LookinDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 3909A6FD0C3D8CEB54CAAEB9D79DC25C /* LookinDefines.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2D76B474884CE186A953AB361C3A0754 /* LookinHierarchyInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FEC7FD91328A4C8DC0E6D7BCE863BF81 /* LookinHierarchyInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2F15C8851FC095F0E86485957577397D /* LKS_PerspectiveManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 515D40D758457E6B5B1173030C01612F /* LKS_PerspectiveManager.m */; };\n\t\t2FE5520BE07DDA2734D019A4CB043F70 /* LKS_PerspectiveViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 637189BE5F1131ED2B6238784DCD7D27 /* LKS_PerspectiveViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t323CCED73BD97CE6A7061AB9DCF29ABD /* NSArray+Lookin.h in Headers */ = {isa = PBXBuildFile; fileRef = 40557903743DD96F426AD2B887B19435 /* NSArray+Lookin.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3387D7AE3F4445B00FBC375F19A1C1E3 /* LKS_PerspectiveItemLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = F77E54FD0F6D7095EE92036D9B822191 /* LKS_PerspectiveItemLayer.m */; };\n\t\t37773027F74EDBAF1EBEA0F49D0736B8 /* LookinMsgTargetAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 0EC9DA8B816F7ACB2A377E14F2B2742E /* LookinMsgTargetAction.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t38584E6F140A852D0FC933C6453DC727 /* LKS_HierarchyDisplayItemsMaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A57D122B6D3D68B27A0801624E11D79 /* LKS_HierarchyDisplayItemsMaker.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t395FC03D4A5C78FEBF6B71C65915FE25 /* UITableView+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 92F6252A0756D75A03CE9423F3290EE9 /* UITableView+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3AE087196930BBC5B29288CC6FC012A8 /* LKS_LocalInspectPanelLabelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E443763A7FABE91F240735CAA10A8EC /* LKS_LocalInspectPanelLabelView.m */; };\n\t\t3B3AEA75418D1246AA27FAD925A55D9F /* UITextView+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = B034E538DC0BB5FECD524A9C5C4D13D7 /* UITextView+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3BEC9A7C9CC95CAF7EA103FC4ABD6958 /* LKS_MethodTraceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = B08F267BE32A0116787F7BB24B80E175 /* LKS_MethodTraceManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4062F9C27D84C7947F3ECE1EF54F8105 /* Peertalk.h in Headers */ = {isa = PBXBuildFile; fileRef = 224D485BBB4E6CC4AAF6953AEEBE11A2 /* Peertalk.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4101D5C79944A7EE20D39C305E3925E7 /* LookinAttributesSection.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FE713547D1B7A6F064D3C459B11643D /* LookinAttributesSection.m */; };\n\t\t41E1BB7BA9DD30BEA8B2CA1878BD08E8 /* LKS_HierarchyDetailsHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 21F08BBDCB1DE1C436221C396C470AD9 /* LKS_HierarchyDetailsHandler.m */; };\n\t\t45E3043648A92DBD685AE0C864652A67 /* LKS_PerspectiveItemLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = EF7E557AED816E41355C82D9B01503E8 /* LKS_PerspectiveItemLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4CA8C1C4D57F45A59342E14A03B8F05B /* LookinServer-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = EDA3ADE695F2893B80C54B136A905F4E /* LookinServer-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4FC57AC9601D64119D70C2D753D9C2AE /* Lookin_PTChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 21F862FE51621788FE3B5B10B9658E14 /* Lookin_PTChannel.m */; };\n\t\t5220A06D70DA6E2E50C4A6947923C228 /* LKS_ExportManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A8B0FC1B422235EFC24A5C70F1D78072 /* LKS_ExportManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t52AD271308B525C3896B492C90B04041 /* LookinAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F20D43D8013D763C2F1557F458A5878 /* LookinAttribute.m */; };\n\t\t5388ABE101FDE4B892036F8CDF6D244F /* LKS_AttrModificationPatchHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 51D4F1461926A74C5F2355B790ED8C4C /* LKS_AttrModificationPatchHandler.m */; };\n\t\t5392E9741A719C21EC773F166E4CC320 /* LookinEventHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 551E524A4439B10891291D09502E75F9 /* LookinEventHandler.m */; };\n\t\t5415C8359379460B1C0973DFFAA43BC1 /* LKS_PerspectiveLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = F25DC14B557F5D850EB4B9EC29125151 /* LKS_PerspectiveLayer.m */; };\n\t\t58483A17890415B06F360903F67C0A9B /* LookinHierarchyFile.m in Sources */ = {isa = PBXBuildFile; fileRef = CB13006AA2FDB3AE3E4B22D3D9F5489D /* LookinHierarchyFile.m */; };\n\t\t588F4168AD89A508BB0443FC637EA740 /* LKS_ConnectionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DDA8A26682379CB80FC5F701737A35 /* LKS_ConnectionManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t59D9096FFE602883B44BE1490A401BA3 /* LKS_ObjectRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A84F074D462823887DC12C48CF1A23D /* LKS_ObjectRegistry.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5A4663B94CB417B32F89C525235FA8B6 /* UIColor+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = ECABCAA9FECE7257B4267ADB213E3283 /* UIColor+LookinServer.m */; };\n\t\t5C9E1A1CBF7201E4AAE584DD0D9303D0 /* LookinAttributeModification.h in Headers */ = {isa = PBXBuildFile; fileRef = F860090A54E794DBDDE6230A75E4739F /* LookinAttributeModification.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5EA56E8AABB0D5BD07ED6A782DA8B1AC /* UIViewController+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = DBBB0BD8EE0599FB15FBA352E0A04D30 /* UIViewController+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5F1D8D32B4FF5122EBDF3C8DA4F29C16 /* LKS_PerspectiveDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B106512A34844A36D1126D046386C11 /* LKS_PerspectiveDataSource.m */; };\n\t\t61A82B81A37C4EF0DE9245DF03BCC0B2 /* LKS_AttrModificationHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2456EC8212C2D2646BF28F0307667A /* LKS_AttrModificationHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t637D22A34CDB36C98E7251295D61F38D /* UIBlurEffect+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 40E4E28CD8268379C395F944C80E5D24 /* UIBlurEffect+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t66ACB4C67161227890538AB1D296E2D9 /* LookinConnectionAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 2232E67A42835952B7296F474DBE7E5C /* LookinConnectionAttachment.m */; };\n\t\t676EEFF596210E09477FD56A7A00A413 /* LKS_LocalInspectManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D43309255489FF7F10A373E13EBAECCB /* LKS_LocalInspectManager.m */; };\n\t\t686B63A2DB1582BA86FD2474862A55A2 /* Lookin_PTProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 219AA6511B5F17D2215297AA9D40FA0F /* Lookin_PTProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7031600C6E773A7B7DD831B7936CBB38 /* LookinAppInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4215DBA0FCC1E7DBED9F012AE258EEF7 /* LookinAppInfo.m */; };\n\t\t718515A9A80108D18EA957F3F1D2737C /* LKS_PerspectiveToolbarButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = C6609C187DF26848E8C472E1D75F3C91 /* LKS_PerspectiveToolbarButtons.m */; };\n\t\t71B30263D74D639BF4E4691B8A13D8F1 /* LKS_PerspectiveHierarchyCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CBCB52C0DEB35E82AF29E260674BEC9 /* LKS_PerspectiveHierarchyCell.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t73E919F3A51CE449FF8ADD8DE5F31166 /* NSSet+Lookin.h in Headers */ = {isa = PBXBuildFile; fileRef = AEC483F02167148745A30C09435FB5CF /* NSSet+Lookin.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t75AA7C8E605783943689788D6E0613DE /* NSString+Lookin.m in Sources */ = {isa = PBXBuildFile; fileRef = D83BF3E2881F2D2FFE4AFC22771FCE36 /* NSString+Lookin.m */; };\n\t\t75C4F601BA3E44DED010203F2FA45C2A /* UITextField+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8309B1276C55989BB2E4DFB8CECBEC85 /* UITextField+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7666D4A2B5B913494C898D0C480C1361 /* LKS_ConnectionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 18267B21FB282FB0B18EC75340C86FA3 /* LKS_ConnectionManager.m */; };\n\t\t773059DF5A7F7830A39BDEC5F5E592EA /* LookinHierarchyInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = BB6373DF2DC64B584B8CF09C4150C433 /* LookinHierarchyInfo.m */; };\n\t\t7B9FEF91BA9C3F85EE09C3CC4E2A8704 /* LKS_HierarchyDetailsHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 173E783D805E674CA7CABEF6EB38D617 /* LKS_HierarchyDetailsHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7BC0882A3A100DB0ADDDEC34A7E9226A /* LKS_PerspectiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E3525E795CBB069BECBB66727A9040B7 /* LKS_PerspectiveViewController.m */; };\n\t\t7C294DC14AFC7D036D4A44F755187029 /* LookinHierarchyFile.h in Headers */ = {isa = PBXBuildFile; fileRef = ED0BE4AA53E1F0B4CEFB210EB072B5B8 /* LookinHierarchyFile.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7D796BD98330217929ED6786E25D328E /* LKS_EventHandlerMaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 81F4FD3C4B4EA45A4F30C40F3439154D /* LKS_EventHandlerMaker.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7E6EB0135FFE02705D5953A6EDD53670 /* LookinAutoLayoutConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 36B7DA9575C5ACE426132494D8083ED2 /* LookinAutoLayoutConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7F37B6373DE062C9B0B24DD8E7AE11F5 /* LKS_HierarchyDisplayItemsMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = 656101743950D6F3B29B041FABBABBBA /* LKS_HierarchyDisplayItemsMaker.m */; };\n\t\t7FD7C3C2E6628BD153FBE19EE0B862C6 /* LookinMsgAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = FD83B9BC258C8DE9140CD28149D90C8F /* LookinMsgAttribute.m */; };\n\t\t80B065E4294688AEE94640333908E2D5 /* UIImage+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 246618B47B4E7B3A98F764EE2AB3D655 /* UIImage+LookinServer.m */; };\n\t\t81031A88AF1A82C8CA05312E921AD20F /* LookinMsgTargetAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E62B8AF634F85D998245B5DD74B9A7B /* LookinMsgTargetAction.m */; };\n\t\t817F906E97C8BDC685735D7ACA16BF67 /* LookinObject.h in Headers */ = {isa = PBXBuildFile; fileRef = C407FEBCA96257041F34657CB4E402A6 /* LookinObject.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8287DC67E9027000D2FAF4BC8C47900F /* LookinDisplayItemDetail.m in Sources */ = {isa = PBXBuildFile; fileRef = F4EE9799E4B8DF680C384F179C7DEA96 /* LookinDisplayItemDetail.m */; };\n\t\t85A8B0F6DE99D2661790D9587DE88ACB /* LKS_PerspectiveManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E85CC932DE80B014D9094D2EAB34A2BB /* LKS_PerspectiveManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t86260B5E519495CBA470ADD62F5F7EFE /* LookinCodingValueType.h in Headers */ = {isa = PBXBuildFile; fileRef = D9AB931C6A78ED2A1999B2FBFE1B2058 /* LookinCodingValueType.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t88303415F115915F79C2A03F5BE82076 /* LookinDisplayItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CD1D33AA0DDB360941DF2F6E823CAF5 /* LookinDisplayItem.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8852CB988A3DEC15C36D642391B16F79 /* UIImageView+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7469939E6B32E3BE277DF6CD1809B0C4 /* UIImageView+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t89A793565D3DA2487F0400F51E97E51A /* LKS_Helper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E7FEAAFC6B39DC7F79F3474722C57CD /* LKS_Helper.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8DA545D912C08215993B294F79A135D7 /* LookinWeakContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 78021CFD427249E79E99A44F636233A4 /* LookinWeakContainer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t90B9E88EB07332D674B580EA9523D778 /* LookinIvarTrace.h in Headers */ = {isa = PBXBuildFile; fileRef = C2242704AF70D5C582CC2B6198FD68E0 /* LookinIvarTrace.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t929990A7CD2FA0F831E363B1575D342D /* Lookin_PTUSBHub.m in Sources */ = {isa = PBXBuildFile; fileRef = CF2D7FC011FE161AC8F55805FF17FA56 /* Lookin_PTUSBHub.m */; };\n\t\t938AB95A69CB2DBC5586C7BB9A6FB3C4 /* LookinStaticAsyncUpdateTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EED9D3B1A085A02A5DA4405DC471C06 /* LookinStaticAsyncUpdateTask.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t93CE3C05AC802BDD1E4DACC8AD1D04FB /* NSObject+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 15624D3BC8B0BBC6561F583620D5503A /* NSObject+LookinServer.m */; };\n\t\t96D3B5E4BF637A8C58E69ADD0F7466F7 /* LookinAttributesGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 87003642A2A1C6CC8D560F23C205ED96 /* LookinAttributesGroup.m */; };\n\t\t9723A5322855C2CE944B6ADA7144AF3D /* LookinAutoLayoutConstraint.m in Sources */ = {isa = PBXBuildFile; fileRef = E74AA900536DACC16713277804225CFF /* LookinAutoLayoutConstraint.m */; };\n\t\t9AE34167B727AB574413F989BBD79C55 /* UIVisualEffectView+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 49591CFFFE70FE73881333F76E3E0D63 /* UIVisualEffectView+LookinServer.m */; };\n\t\tA0DE3EA47497800844AF034DB6F24252 /* LKS_PerspectiveHierarchyView.h in Headers */ = {isa = PBXBuildFile; fileRef = 430091E00751A8309CBEFCB975D628B2 /* LKS_PerspectiveHierarchyView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA2C5F8D1319F000A4952F3752DD43A58 /* LKS_LocalInspectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F2232DD63EB754EAC74ABEFFF76FE5A /* LKS_LocalInspectViewController.m */; };\n\t\tA66B08B83E58ED25DE9F62F7860A0B83 /* LookinAttrType.h in Headers */ = {isa = PBXBuildFile; fileRef = EB6D809DF947CA72C9E61926B4EB3428 /* LookinAttrType.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA8203C32C9F49EAC14E3EF4F7AAA2F1B /* LookinDashboardBlueprint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0EC99F32DAB1371DC1BC2B4DE054EBB1 /* LookinDashboardBlueprint.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA8ABD68C212B85DBF0DB98B6BE93771E /* LookinConnectionResponseAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B8C4C1259B87ADA2BA1155FD8682977 /* LookinConnectionResponseAttachment.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tAB72691991AB2233825ABF6562E75ABC /* LookinObject.m in Sources */ = {isa = PBXBuildFile; fileRef = B4807F2269356902D5229A64D3702476 /* LookinObject.m */; };\n\t\tAD3B97F3C235643CC0BF3FAA024282DF /* LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 182681E841B47CA3389B60AB51ED6557 /* LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tAD8129C7689DB229DA465BD6C4100D21 /* LKS_AttrModificationPatchHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = D9AB342FF6C5A234675B5A531C1139CE /* LKS_AttrModificationPatchHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tAF2E535AFA72186438117A4E70BCFD50 /* LookinStaticAsyncUpdateTask.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D84A4451E510F809149A89ECD44325B /* LookinStaticAsyncUpdateTask.m */; };\n\t\tAFE7D8A53068BF01D48B797654F8D432 /* LKS_PerspectiveHierarchyView.m in Sources */ = {isa = PBXBuildFile; fileRef = EE4C7F689F691D2932E6C966D2FF4D79 /* LKS_PerspectiveHierarchyView.m */; };\n\t\tB1D0A281262122304BEB8EE4D8656B89 /* NSObject+Lookin.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F3B972C5B0BC04A7DD297F63757AE18 /* NSObject+Lookin.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB21BD55B46BD2A28CF186366F7B20E2E /* LKS_LocalInspectViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE764CE3893B37689C0BC44ECA3B4B91 /* LKS_LocalInspectViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB29549D4F3B66555C98D8181395290C3 /* LookinAttributesSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 7493D9CF640ACB6E2372474DA69C4DBE /* LookinAttributesSection.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB39AE573AC30734EC60348DD0B533DA4 /* NSArray+Lookin.m in Sources */ = {isa = PBXBuildFile; fileRef = 92BE346C95BF1CD82EE3A572BAE514F3 /* NSArray+Lookin.m */; };\n\t\tB45B85409AE28EDE3532938ECB54301E /* LookinTuple.m in Sources */ = {isa = PBXBuildFile; fileRef = 16CE2F8C86820C423CE6BE2AE6F52F46 /* LookinTuple.m */; };\n\t\tB466251D9036F2EFC186A34E76524780 /* LookinAppInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 867C4CCA7408106ED81C200C0923172A /* LookinAppInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB4BFA1A5E58FCDD2BA5D4261D71302A9 /* CALayer+Lookin.h in Headers */ = {isa = PBXBuildFile; fileRef = EA12ACB760FC94D0D4DA39BA6AF7E6B5 /* CALayer+Lookin.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB54C6FB5A76EDC47073B283362FB7469 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 070553B20C0DF9A38585E6C4EAD989AE /* UIKit.framework */; };\n\t\tB94FD9A94D4B58CB9EC9C3E323E1B96C /* LookinTuple.h in Headers */ = {isa = PBXBuildFile; fileRef = C530A07C10CC3C497B8AA6BD6DE8052D /* LookinTuple.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tBBECE031D3606D9AEF902AC02B5D6B2A /* LookinConnectionResponseAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = E4F03438230841C57C8CCE5423D89E3E /* LookinConnectionResponseAttachment.m */; };\n\t\tBDA4B3D5927885B71F129F17B4D68949 /* Lookin_PTPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E97A80192FBDADDC55188CF6091D5E3 /* Lookin_PTPrivate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tBDC2179794DF128F9C6B76E79688ED7A /* LookinWeakContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9988BB7C7CD4DB52B5C26669B32EDEB6 /* LookinWeakContainer.m */; };\n\t\tBE1853E860F777A2557B51C90A4B777E /* LookinAttrIdentifiers.h in Headers */ = {isa = PBXBuildFile; fileRef = 30A15219ABF51508E1B5E7F41021FCF3 /* LookinAttrIdentifiers.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tBEE3F7679AECC5605C87AC2CC57F642B /* NSSet+Lookin.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B4800BE9AA6A7DBFDF9F166216FE328 /* NSSet+Lookin.m */; };\n\t\tC1D8A55A4355FACAC236D48FBB55B106 /* UITextField+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3361441F9DE5F0C1FF71ED1246DE1347 /* UITextField+LookinServer.m */; };\n\t\tC3090402C42FEE35E46BE9ACA62E59D5 /* LookinMethodTraceRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6B5A8BA9AB2C7289B5C3AF5CE7637D /* LookinMethodTraceRecord.m */; };\n\t\tC65099DD0C74F8C6DAEB416D5CB78ABF /* LKS_Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = EA38C1286D76AB74A0A3F07249310FE4 /* LKS_Helper.m */; };\n\t\tC6D113E45DF8A85A2417FBA19976723D /* LookinDisplayItemDetail.h in Headers */ = {isa = PBXBuildFile; fileRef = 7479CE957173AC886F78C2AC7C84AE5E /* LookinDisplayItemDetail.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tC77C105596399C54E4ACDB7081069F09 /* LookinDisplayItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 46288120050C8C2D6841B9477D8CB3AC /* LookinDisplayItem.m */; };\n\t\tCA8EA2FE75BC0DA7F5598CA0632CDFFE /* LKS_ObjectRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8AD05BE1E641DD05378CDD1790D19A /* LKS_ObjectRegistry.m */; };\n\t\tCDFC89C87D324B64B7499DD1604348AA /* LKS_PerspectiveDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A11CB612DBE8B848DB0A4FDE2FE0AC4 /* LKS_PerspectiveDataSource.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCEF0CBC49993952ED1604A188D1563AB /* CALayer+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = DE9E6B913EEB5F5A1C9A7A85856175D1 /* CALayer+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCF0933DBA480911BF4C1108EAC878BDA /* NSObject+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B76BDD53364E83F98E635EB179731A /* NSObject+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCFBCC88A4F3DEF0CE69E543801EBA607 /* LookinDashboardBlueprint.m in Sources */ = {isa = PBXBuildFile; fileRef = BDC348B013DE04566F37F77372AC0051 /* LookinDashboardBlueprint.m */; };\n\t\tD4240909C3EB581AAD9D4F30A54D5060 /* LookinAttributeModification.m in Sources */ = {isa = PBXBuildFile; fileRef = FB6A511D0F970464D508C64B44400C49 /* LookinAttributeModification.m */; };\n\t\tD4398BC5DF54688C6A49EA7644C2AA85 /* UIColor+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C0ACC09086E7B9ABB0D6E23122FBC38 /* UIColor+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD835AB44CED4D20B062627054BBFCCBD /* LKS_TraceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = AB4C8818C35EE45FF37BA06805CD7D8E /* LKS_TraceManager.m */; };\n\t\tD8391668AAC27BE0089925F58E3D948F /* LKS_EventHandlerMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FC48F9F883D5F0A27890E9C02AF37B7 /* LKS_EventHandlerMaker.m */; };\n\t\tD85F1AEDA79F234519A58954C3663A17 /* UIGestureRecognizer+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = F5AA9A2709B8E14E300CA2BC507F5C40 /* UIGestureRecognizer+LookinServer.m */; };\n\t\tD8A570C0CFDCF761E580B74116D85154 /* LookinMethodTraceRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 60445E6794C31E0A2C99993647C024EC /* LookinMethodTraceRecord.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE3EE06E9F651979DBE44DE18CBC537AA /* Lookin_PTProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = D8B765FF61800231762A18FFE0F6B382 /* Lookin_PTProtocol.m */; };\n\t\tE432E79F5333083DA305D61EE51357C6 /* UITextView+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = C5A40322BA2B1C0B2B5F7CABD8A212F2 /* UITextView+LookinServer.m */; };\n\t\tE4FDE57E1B38FCAE9B3884F4A4F863FC /* LKS_MethodTraceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FCAC034F412FE0127C5A680672CF74AE /* LKS_MethodTraceManager.m */; };\n\t\tE81887F5984EF9D94B822A01D1D84B22 /* LookinAttributesGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = E3DEC557F4FBE7C86105D097E474E510 /* LookinAttributesGroup.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEAF37F0CADDFB6B59F3537F1C4345A41 /* LKS_AttrGroupsMaker.m in Sources */ = {isa = PBXBuildFile; fileRef = FF0F6F9E63946A3F858110F6F4A7960E /* LKS_AttrGroupsMaker.m */; };\n\t\tEBDBD9E36412D0FA1E2780ED9765E6B6 /* LKS_PerspectiveLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A038A6A3CA099582D1CDBF695869B04 /* LKS_PerspectiveLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tED22780431607AF0AC5178858EE9B47D /* Lookin_PTChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C5E5E31A936D294D1C60BCD4CB9F702 /* Lookin_PTChannel.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEDB75BEDB97A0DCA8AC5925B5A630763 /* Lookin_PTUSBHub.h in Headers */ = {isa = PBXBuildFile; fileRef = 179A2FE851754AACFEEDCF6AB4C759E7 /* Lookin_PTUSBHub.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEEF5224101D9FB9215C83192D9FFA475 /* CALayer+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 700AAE793D800E8DD0EB6BC4B0ADBBF7 /* CALayer+LookinServer.m */; };\n\t\tEEF7475AA070A169E5479462C4D7E441 /* LKS_LocalInspectManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2772D6A405FA998F1381C4FFC69BBCB6 /* LKS_LocalInspectManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEF592766200A98B22B45A7FE854418CE /* LookinMsgAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = EABC1F238084414A9438F0EDD1898DB5 /* LookinMsgAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF2809BD02FFD2D96AFF92F909DD11088 /* UIImage+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 64244C3B0B7A8712804C5B3E3B1E6739 /* UIImage+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF2967247DC7D19DDCEBEE97D626741D8 /* LKS_AttrGroupsMaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BFF5A0B9A97313479A5ACC0713BBB88 /* LKS_AttrGroupsMaker.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF731001E2F0512B9FD9C46DA0D9B7CB3 /* LKS_AttrModificationHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 991728F74F4232B04DA2F7EF601817A0 /* LKS_AttrModificationHandler.m */; };\n\t\tFAACFEE16C085FB5F6D2F9D24C97D0F2 /* LookinConnectionAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DAB7747E848BF750F935DB1509AF889 /* LookinConnectionAttachment.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFADA811653EE71E91BB62922879788D5 /* LKS_ExportManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 87A73AAFE241AE1A9B0B1ECC3637BB09 /* LKS_ExportManager.m */; };\n\t\tFBE0905907E8A2E96C60D614BE7AD96B /* UIVisualEffectView+LookinServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E6A258A86907EBBDB399A0A13A4BBE5 /* UIVisualEffectView+LookinServer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFECE5A4ACEDF90AC48C93974E4D14E98 /* UIViewController+LookinServer.m in Sources */ = {isa = PBXBuildFile; fileRef = B4F1E7E5E9079471F411ED35B385AF1C /* UIViewController+LookinServer.m */; };\n\t\tFF00082EEA92F5B850C4EBAC6052065B /* LookinIvarTrace.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8A797C14470C70649EE63152213162 /* LookinIvarTrace.m */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t022AE5FFEC8ED71480F4495D0C937D05 /* LKS_LocalInspectPanelLabelView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_LocalInspectPanelLabelView.h; path = Src/Server/Inspect/LKS_LocalInspectPanelLabelView.h; sourceTree = \"<group>\"; };\n\t\t070553B20C0DF9A38585E6C4EAD989AE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };\n\t\t0A57D122B6D3D68B27A0801624E11D79 /* LKS_HierarchyDisplayItemsMaker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_HierarchyDisplayItemsMaker.h; path = Src/Server/Others/LKS_HierarchyDisplayItemsMaker.h; sourceTree = \"<group>\"; };\n\t\t0BFF5A0B9A97313479A5ACC0713BBB88 /* LKS_AttrGroupsMaker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_AttrGroupsMaker.h; path = Src/Server/Others/LKS_AttrGroupsMaker.h; sourceTree = \"<group>\"; };\n\t\t0E7FEAAFC6B39DC7F79F3474722C57CD /* LKS_Helper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_Helper.h; path = Src/Server/Others/LKS_Helper.h; sourceTree = \"<group>\"; };\n\t\t0EC99F32DAB1371DC1BC2B4DE054EBB1 /* LookinDashboardBlueprint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinDashboardBlueprint.h; path = Src/Shared/LookinDashboardBlueprint.h; sourceTree = \"<group>\"; };\n\t\t0EC9DA8B816F7ACB2A377E14F2B2742E /* LookinMsgTargetAction.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinMsgTargetAction.h; path = Src/Shared/Message/LookinMsgTargetAction.h; sourceTree = \"<group>\"; };\n\t\t0F20D43D8013D763C2F1557F458A5878 /* LookinAttribute.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinAttribute.m; path = Src/Shared/LookinAttribute.m; sourceTree = \"<group>\"; };\n\t\t0FE713547D1B7A6F064D3C459B11643D /* LookinAttributesSection.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinAttributesSection.m; path = Src/Shared/LookinAttributesSection.m; sourceTree = \"<group>\"; };\n\t\t15624D3BC8B0BBC6561F583620D5503A /* NSObject+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSObject+LookinServer.m\"; path = \"Src/Server/Category/NSObject+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t16CE2F8C86820C423CE6BE2AE6F52F46 /* LookinTuple.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinTuple.m; path = Src/Shared/LookinTuple.m; sourceTree = \"<group>\"; };\n\t\t173E783D805E674CA7CABEF6EB38D617 /* LKS_HierarchyDetailsHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_HierarchyDetailsHandler.h; path = Src/Server/Connection/RequestHandler/LKS_HierarchyDetailsHandler.h; sourceTree = \"<group>\"; };\n\t\t179A2FE851754AACFEEDCF6AB4C759E7 /* Lookin_PTUSBHub.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Lookin_PTUSBHub.h; path = Src/Shared/Peertalk/Lookin_PTUSBHub.h; sourceTree = \"<group>\"; };\n\t\t18267B21FB282FB0B18EC75340C86FA3 /* LKS_ConnectionManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_ConnectionManager.m; path = Src/Server/Connection/LKS_ConnectionManager.m; sourceTree = \"<group>\"; };\n\t\t182681E841B47CA3389B60AB51ED6557 /* LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinServer.h; path = Src/Server/LookinServer.h; sourceTree = \"<group>\"; };\n\t\t1A038A6A3CA099582D1CDBF695869B04 /* LKS_PerspectiveLayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveLayer.h; path = Src/Server/Perspective/LKS_PerspectiveLayer.h; sourceTree = \"<group>\"; };\n\t\t1A11CB612DBE8B848DB0A4FDE2FE0AC4 /* LKS_PerspectiveDataSource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveDataSource.h; path = Src/Server/Perspective/LKS_PerspectiveDataSource.h; sourceTree = \"<group>\"; };\n\t\t1D84A4451E510F809149A89ECD44325B /* LookinStaticAsyncUpdateTask.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinStaticAsyncUpdateTask.m; path = Src/Shared/LookinStaticAsyncUpdateTask.m; sourceTree = \"<group>\"; };\n\t\t1DAB7747E848BF750F935DB1509AF889 /* LookinConnectionAttachment.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinConnectionAttachment.h; path = Src/Shared/LookinConnectionAttachment.h; sourceTree = \"<group>\"; };\n\t\t1EED9D3B1A085A02A5DA4405DC471C06 /* LookinStaticAsyncUpdateTask.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinStaticAsyncUpdateTask.h; path = Src/Shared/LookinStaticAsyncUpdateTask.h; sourceTree = \"<group>\"; };\n\t\t219AA6511B5F17D2215297AA9D40FA0F /* Lookin_PTProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Lookin_PTProtocol.h; path = Src/Shared/Peertalk/Lookin_PTProtocol.h; sourceTree = \"<group>\"; };\n\t\t21F08BBDCB1DE1C436221C396C470AD9 /* LKS_HierarchyDetailsHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_HierarchyDetailsHandler.m; path = Src/Server/Connection/RequestHandler/LKS_HierarchyDetailsHandler.m; sourceTree = \"<group>\"; };\n\t\t21F862FE51621788FE3B5B10B9658E14 /* Lookin_PTChannel.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = Lookin_PTChannel.m; path = Src/Shared/Peertalk/Lookin_PTChannel.m; sourceTree = \"<group>\"; };\n\t\t2232E67A42835952B7296F474DBE7E5C /* LookinConnectionAttachment.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinConnectionAttachment.m; path = Src/Shared/LookinConnectionAttachment.m; sourceTree = \"<group>\"; };\n\t\t224D485BBB4E6CC4AAF6953AEEBE11A2 /* Peertalk.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Peertalk.h; path = Src/Shared/Peertalk/Peertalk.h; sourceTree = \"<group>\"; };\n\t\t246618B47B4E7B3A98F764EE2AB3D655 /* UIImage+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+LookinServer.m\"; path = \"Src/Server/Category/UIImage+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t2772D6A405FA998F1381C4FFC69BBCB6 /* LKS_LocalInspectManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_LocalInspectManager.h; path = Src/Server/Inspect/LKS_LocalInspectManager.h; sourceTree = \"<group>\"; };\n\t\t29885A010A1ED17B3073AC278B9CD638 /* UIBlurEffect+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIBlurEffect+LookinServer.m\"; path = \"Src/Server/Category/UIBlurEffect+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t2C0ACC09086E7B9ABB0D6E23122FBC38 /* UIColor+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIColor+LookinServer.h\"; path = \"Src/Server/Category/UIColor+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\t2CBCB52C0DEB35E82AF29E260674BEC9 /* LKS_PerspectiveHierarchyCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveHierarchyCell.h; path = Src/Server/Perspective/LKS_PerspectiveHierarchyCell.h; sourceTree = \"<group>\"; };\n\t\t2D1FAE0CBF86AD8A024D1773DEFB7138 /* LookinServer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = LookinServer.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t2F0724A757C4E810ADCA40BF3CE53E06 /* LookinAttrIdentifiers.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinAttrIdentifiers.m; path = Src/Shared/LookinAttrIdentifiers.m; sourceTree = \"<group>\"; };\n\t\t30A15219ABF51508E1B5E7F41021FCF3 /* LookinAttrIdentifiers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAttrIdentifiers.h; path = Src/Shared/LookinAttrIdentifiers.h; sourceTree = \"<group>\"; };\n\t\t3361441F9DE5F0C1FF71ED1246DE1347 /* UITextField+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UITextField+LookinServer.m\"; path = \"Src/Server/Category/UITextField+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t36B7DA9575C5ACE426132494D8083ED2 /* LookinAutoLayoutConstraint.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAutoLayoutConstraint.h; path = Src/Shared/LookinAutoLayoutConstraint.h; sourceTree = \"<group>\"; };\n\t\t3909A6FD0C3D8CEB54CAAEB9D79DC25C /* LookinDefines.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinDefines.h; path = Src/Shared/LookinDefines.h; sourceTree = \"<group>\"; };\n\t\t3E97A80192FBDADDC55188CF6091D5E3 /* Lookin_PTPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Lookin_PTPrivate.h; path = Src/Shared/Peertalk/Lookin_PTPrivate.h; sourceTree = \"<group>\"; };\n\t\t40557903743DD96F426AD2B887B19435 /* NSArray+Lookin.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSArray+Lookin.h\"; path = \"Src/Shared/Category/NSArray+Lookin.h\"; sourceTree = \"<group>\"; };\n\t\t40E4E28CD8268379C395F944C80E5D24 /* UIBlurEffect+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIBlurEffect+LookinServer.h\"; path = \"Src/Server/Category/UIBlurEffect+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\t4215DBA0FCC1E7DBED9F012AE258EEF7 /* LookinAppInfo.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinAppInfo.m; path = Src/Shared/LookinAppInfo.m; sourceTree = \"<group>\"; };\n\t\t42A2DA1C4547F338D0840E159B27BBC1 /* LKS_RequestHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_RequestHandler.h; path = Src/Server/Connection/LKS_RequestHandler.h; sourceTree = \"<group>\"; };\n\t\t430091E00751A8309CBEFCB975D628B2 /* LKS_PerspectiveHierarchyView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveHierarchyView.h; path = Src/Server/Perspective/LKS_PerspectiveHierarchyView.h; sourceTree = \"<group>\"; };\n\t\t46288120050C8C2D6841B9477D8CB3AC /* LookinDisplayItem.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinDisplayItem.m; path = Src/Shared/LookinDisplayItem.m; sourceTree = \"<group>\"; };\n\t\t465E6E3CA198A46580FAB98EDF3A4650 /* LookinScreenshotFetchManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinScreenshotFetchManager.h; path = Src/Shared/LookinScreenshotFetchManager.h; sourceTree = \"<group>\"; };\n\t\t49591CFFFE70FE73881333F76E3E0D63 /* UIVisualEffectView+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIVisualEffectView+LookinServer.m\"; path = \"Src/Server/Category/UIVisualEffectView+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t4C5E5E31A936D294D1C60BCD4CB9F702 /* Lookin_PTChannel.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Lookin_PTChannel.h; path = Src/Shared/Peertalk/Lookin_PTChannel.h; sourceTree = \"<group>\"; };\n\t\t515D40D758457E6B5B1173030C01612F /* LKS_PerspectiveManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveManager.m; path = Src/Server/Perspective/LKS_PerspectiveManager.m; sourceTree = \"<group>\"; };\n\t\t51D4F1461926A74C5F2355B790ED8C4C /* LKS_AttrModificationPatchHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_AttrModificationPatchHandler.m; path = Src/Server/Connection/RequestHandler/LKS_AttrModificationPatchHandler.m; sourceTree = \"<group>\"; };\n\t\t529308949481ABD4AB88E1E73E3E257A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t551E524A4439B10891291D09502E75F9 /* LookinEventHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinEventHandler.m; path = Src/Shared/LookinEventHandler.m; sourceTree = \"<group>\"; };\n\t\t56E60FA565B2F3D48818431F6A85B480 /* UIView+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIView+LookinServer.h\"; path = \"Src/Server/Category/UIView+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\t57C8F91060EB0C2BE160F350E73A8D0C /* LookinServer-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"LookinServer-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t5E62B8AF634F85D998245B5DD74B9A7B /* LookinMsgTargetAction.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinMsgTargetAction.m; path = Src/Shared/Message/LookinMsgTargetAction.m; sourceTree = \"<group>\"; };\n\t\t5E9E73467EA12C21865FE8795FBCCC7B /* LKS_PerspectiveHierarchyCell.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveHierarchyCell.m; path = Src/Server/Perspective/LKS_PerspectiveHierarchyCell.m; sourceTree = \"<group>\"; };\n\t\t60445E6794C31E0A2C99993647C024EC /* LookinMethodTraceRecord.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinMethodTraceRecord.h; path = Src/Shared/LookinMethodTraceRecord.h; sourceTree = \"<group>\"; };\n\t\t6152D80B4CE36E418A4B43B6BC0659F1 /* LookinServerDefines.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinServerDefines.h; path = Src/Server/Others/LookinServerDefines.h; sourceTree = \"<group>\"; };\n\t\t637189BE5F1131ED2B6238784DCD7D27 /* LKS_PerspectiveViewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveViewController.h; path = Src/Server/Perspective/LKS_PerspectiveViewController.h; sourceTree = \"<group>\"; };\n\t\t64244C3B0B7A8712804C5B3E3B1E6739 /* UIImage+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+LookinServer.h\"; path = \"Src/Server/Category/UIImage+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\t656101743950D6F3B29B041FABBABBBA /* LKS_HierarchyDisplayItemsMaker.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_HierarchyDisplayItemsMaker.m; path = Src/Server/Others/LKS_HierarchyDisplayItemsMaker.m; sourceTree = \"<group>\"; };\n\t\t6B106512A34844A36D1126D046386C11 /* LKS_PerspectiveDataSource.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveDataSource.m; path = Src/Server/Perspective/LKS_PerspectiveDataSource.m; sourceTree = \"<group>\"; };\n\t\t6B4800BE9AA6A7DBFDF9F166216FE328 /* NSSet+Lookin.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSSet+Lookin.m\"; path = \"Src/Shared/Category/NSSet+Lookin.m\"; sourceTree = \"<group>\"; };\n\t\t6E191CE81EFBC8BCBEB3FB1BA5BA26C5 /* UILabel+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UILabel+LookinServer.m\"; path = \"Src/Server/Category/UILabel+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t6F2232DD63EB754EAC74ABEFFF76FE5A /* LKS_LocalInspectViewController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_LocalInspectViewController.m; path = Src/Server/Inspect/LKS_LocalInspectViewController.m; sourceTree = \"<group>\"; };\n\t\t6F3B972C5B0BC04A7DD297F63757AE18 /* NSObject+Lookin.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSObject+Lookin.h\"; path = \"Src/Shared/Category/NSObject+Lookin.h\"; sourceTree = \"<group>\"; };\n\t\t700AAE793D800E8DD0EB6BC4B0ADBBF7 /* CALayer+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"CALayer+LookinServer.m\"; path = \"Src/Server/Category/CALayer+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t70A99B3B51A5DA2F5F3FFA7A193677A0 /* LKS_RequestHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_RequestHandler.m; path = Src/Server/Connection/LKS_RequestHandler.m; sourceTree = \"<group>\"; };\n\t\t71205DCD6C69B060581558DEB238117D /* LookinServer-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"LookinServer-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t7469939E6B32E3BE277DF6CD1809B0C4 /* UIImageView+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImageView+LookinServer.h\"; path = \"Src/Server/Category/UIImageView+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\t7479CE957173AC886F78C2AC7C84AE5E /* LookinDisplayItemDetail.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinDisplayItemDetail.h; path = Src/Shared/LookinDisplayItemDetail.h; sourceTree = \"<group>\"; };\n\t\t7493D9CF640ACB6E2372474DA69C4DBE /* LookinAttributesSection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAttributesSection.h; path = Src/Shared/LookinAttributesSection.h; sourceTree = \"<group>\"; };\n\t\t78021CFD427249E79E99A44F636233A4 /* LookinWeakContainer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinWeakContainer.h; path = Src/Shared/LookinWeakContainer.h; sourceTree = \"<group>\"; };\n\t\t7C2456EC8212C2D2646BF28F0307667A /* LKS_AttrModificationHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_AttrModificationHandler.h; path = Src/Server/Connection/RequestHandler/LKS_AttrModificationHandler.h; sourceTree = \"<group>\"; };\n\t\t7E443763A7FABE91F240735CAA10A8EC /* LKS_LocalInspectPanelLabelView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_LocalInspectPanelLabelView.m; path = Src/Server/Inspect/LKS_LocalInspectPanelLabelView.m; sourceTree = \"<group>\"; };\n\t\t7E6212748693A9421890641FD76646BA /* LookinEventHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinEventHandler.h; path = Src/Shared/LookinEventHandler.h; sourceTree = \"<group>\"; };\n\t\t7F2894DDD0E7CDB23764E9BACDF09E09 /* UIView+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIView+LookinServer.m\"; path = \"Src/Server/Category/UIView+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\t7FC48F9F883D5F0A27890E9C02AF37B7 /* LKS_EventHandlerMaker.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_EventHandlerMaker.m; path = Src/Server/Others/LKS_EventHandlerMaker.m; sourceTree = \"<group>\"; };\n\t\t81F4FD3C4B4EA45A4F30C40F3439154D /* LKS_EventHandlerMaker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_EventHandlerMaker.h; path = Src/Server/Others/LKS_EventHandlerMaker.h; sourceTree = \"<group>\"; };\n\t\t8309B1276C55989BB2E4DFB8CECBEC85 /* UITextField+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UITextField+LookinServer.h\"; path = \"Src/Server/Category/UITextField+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\t867C4CCA7408106ED81C200C0923172A /* LookinAppInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAppInfo.h; path = Src/Shared/LookinAppInfo.h; sourceTree = \"<group>\"; };\n\t\t87003642A2A1C6CC8D560F23C205ED96 /* LookinAttributesGroup.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinAttributesGroup.m; path = Src/Shared/LookinAttributesGroup.m; sourceTree = \"<group>\"; };\n\t\t87A73AAFE241AE1A9B0B1ECC3637BB09 /* LKS_ExportManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_ExportManager.m; path = Src/Server/Others/LKS_ExportManager.m; sourceTree = \"<group>\"; };\n\t\t8A048573D79E53B8ED42A1FE066C1EA2 /* NSObject+Lookin.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSObject+Lookin.m\"; path = \"Src/Shared/Category/NSObject+Lookin.m\"; sourceTree = \"<group>\"; };\n\t\t8B8C4C1259B87ADA2BA1155FD8682977 /* LookinConnectionResponseAttachment.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinConnectionResponseAttachment.h; path = Src/Shared/LookinConnectionResponseAttachment.h; sourceTree = \"<group>\"; };\n\t\t8BE23A84D94F58A983283437C76B01EA /* NSString+Lookin.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSString+Lookin.h\"; path = \"Src/Shared/Category/NSString+Lookin.h\"; sourceTree = \"<group>\"; };\n\t\t8CD1D33AA0DDB360941DF2F6E823CAF5 /* LookinDisplayItem.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinDisplayItem.h; path = Src/Shared/LookinDisplayItem.h; sourceTree = \"<group>\"; };\n\t\t92BE346C95BF1CD82EE3A572BAE514F3 /* NSArray+Lookin.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSArray+Lookin.m\"; path = \"Src/Shared/Category/NSArray+Lookin.m\"; sourceTree = \"<group>\"; };\n\t\t92F6252A0756D75A03CE9423F3290EE9 /* UITableView+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UITableView+LookinServer.h\"; path = \"Src/Server/Category/UITableView+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\t941BD4B62238E984825C8E89087A91F4 /* LKS_TraceManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_TraceManager.h; path = Src/Server/Others/LKS_TraceManager.h; sourceTree = \"<group>\"; };\n\t\t991728F74F4232B04DA2F7EF601817A0 /* LKS_AttrModificationHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_AttrModificationHandler.m; path = Src/Server/Connection/RequestHandler/LKS_AttrModificationHandler.m; sourceTree = \"<group>\"; };\n\t\t9988BB7C7CD4DB52B5C26669B32EDEB6 /* LookinWeakContainer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinWeakContainer.m; path = Src/Shared/LookinWeakContainer.m; sourceTree = \"<group>\"; };\n\t\t9A84F074D462823887DC12C48CF1A23D /* LKS_ObjectRegistry.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_ObjectRegistry.h; path = Src/Server/Others/LKS_ObjectRegistry.h; sourceTree = \"<group>\"; };\n\t\t9B8AD05BE1E641DD05378CDD1790D19A /* LKS_ObjectRegistry.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_ObjectRegistry.m; path = Src/Server/Others/LKS_ObjectRegistry.m; sourceTree = \"<group>\"; };\n\t\t9DA9FD79B390D311AB61B8493E143F18 /* LookinServer */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = LookinServer; path = LookinServer.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t9E6A258A86907EBBDB399A0A13A4BBE5 /* UIVisualEffectView+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIVisualEffectView+LookinServer.h\"; path = \"Src/Server/Category/UIVisualEffectView+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\tA7DDA8A26682379CB80FC5F701737A35 /* LKS_ConnectionManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_ConnectionManager.h; path = Src/Server/Connection/LKS_ConnectionManager.h; sourceTree = \"<group>\"; };\n\t\tA8B0FC1B422235EFC24A5C70F1D78072 /* LKS_ExportManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_ExportManager.h; path = Src/Server/Others/LKS_ExportManager.h; sourceTree = \"<group>\"; };\n\t\tAB4C8818C35EE45FF37BA06805CD7D8E /* LKS_TraceManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_TraceManager.m; path = Src/Server/Others/LKS_TraceManager.m; sourceTree = \"<group>\"; };\n\t\tAC84153F310DFC708D8164A5A577F77B /* LKS_PerspectiveToolbarButtons.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveToolbarButtons.h; path = Src/Server/Perspective/LKS_PerspectiveToolbarButtons.h; sourceTree = \"<group>\"; };\n\t\tAEC483F02167148745A30C09435FB5CF /* NSSet+Lookin.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSSet+Lookin.h\"; path = \"Src/Shared/Category/NSSet+Lookin.h\"; sourceTree = \"<group>\"; };\n\t\tB034E538DC0BB5FECD524A9C5C4D13D7 /* UITextView+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UITextView+LookinServer.h\"; path = \"Src/Server/Category/UITextView+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\tB08F267BE32A0116787F7BB24B80E175 /* LKS_MethodTraceManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_MethodTraceManager.h; path = Src/Server/Others/LKS_MethodTraceManager.h; sourceTree = \"<group>\"; };\n\t\tB18EB5F410154612C3DBD3105D53A343 /* LookinServer-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"LookinServer-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tB4807F2269356902D5229A64D3702476 /* LookinObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinObject.m; path = Src/Shared/LookinObject.m; sourceTree = \"<group>\"; };\n\t\tB4F1E7E5E9079471F411ED35B385AF1C /* UIViewController+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIViewController+LookinServer.m\"; path = \"Src/Server/Category/UIViewController+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\tBB6373DF2DC64B584B8CF09C4150C433 /* LookinHierarchyInfo.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinHierarchyInfo.m; path = Src/Shared/LookinHierarchyInfo.m; sourceTree = \"<group>\"; };\n\t\tBBB9FB08942E7D1C225B340C732C8423 /* UIImageView+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImageView+LookinServer.m\"; path = \"Src/Server/Category/UIImageView+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\tBD6B5A8BA9AB2C7289B5C3AF5CE7637D /* LookinMethodTraceRecord.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinMethodTraceRecord.m; path = Src/Shared/LookinMethodTraceRecord.m; sourceTree = \"<group>\"; };\n\t\tBDC348B013DE04566F37F77372AC0051 /* LookinDashboardBlueprint.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinDashboardBlueprint.m; path = Src/Shared/LookinDashboardBlueprint.m; sourceTree = \"<group>\"; };\n\t\tC20376EF9715E89F9FAB805E395FC794 /* LookinAttribute.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAttribute.h; path = Src/Shared/LookinAttribute.h; sourceTree = \"<group>\"; };\n\t\tC2242704AF70D5C582CC2B6198FD68E0 /* LookinIvarTrace.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinIvarTrace.h; path = Src/Shared/LookinIvarTrace.h; sourceTree = \"<group>\"; };\n\t\tC407FEBCA96257041F34657CB4E402A6 /* LookinObject.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinObject.h; path = Src/Shared/LookinObject.h; sourceTree = \"<group>\"; };\n\t\tC530A07C10CC3C497B8AA6BD6DE8052D /* LookinTuple.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinTuple.h; path = Src/Shared/LookinTuple.h; sourceTree = \"<group>\"; };\n\t\tC5A40322BA2B1C0B2B5F7CABD8A212F2 /* UITextView+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UITextView+LookinServer.m\"; path = \"Src/Server/Category/UITextView+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\tC6609C187DF26848E8C472E1D75F3C91 /* LKS_PerspectiveToolbarButtons.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveToolbarButtons.m; path = Src/Server/Perspective/LKS_PerspectiveToolbarButtons.m; sourceTree = \"<group>\"; };\n\t\tC7D818A123DBDDE9CD05E9C12841308A /* CALayer+Lookin.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"CALayer+Lookin.m\"; path = \"Src/Shared/Category/CALayer+Lookin.m\"; sourceTree = \"<group>\"; };\n\t\tCB13006AA2FDB3AE3E4B22D3D9F5489D /* LookinHierarchyFile.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinHierarchyFile.m; path = Src/Shared/LookinHierarchyFile.m; sourceTree = \"<group>\"; };\n\t\tCC8747E5B43F011547141A5E7D968B8E /* LookinServer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = LookinServer.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tCE764CE3893B37689C0BC44ECA3B4B91 /* LKS_LocalInspectViewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_LocalInspectViewController.h; path = Src/Server/Inspect/LKS_LocalInspectViewController.h; sourceTree = \"<group>\"; };\n\t\tCE8A797C14470C70649EE63152213162 /* LookinIvarTrace.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinIvarTrace.m; path = Src/Shared/LookinIvarTrace.m; sourceTree = \"<group>\"; };\n\t\tCF2D7FC011FE161AC8F55805FF17FA56 /* Lookin_PTUSBHub.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = Lookin_PTUSBHub.m; path = Src/Shared/Peertalk/Lookin_PTUSBHub.m; sourceTree = \"<group>\"; };\n\t\tD43309255489FF7F10A373E13EBAECCB /* LKS_LocalInspectManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_LocalInspectManager.m; path = Src/Server/Inspect/LKS_LocalInspectManager.m; sourceTree = \"<group>\"; };\n\t\tD4CD73A1E50A101687814F7ABF04265E /* LookinServer.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = LookinServer.modulemap; sourceTree = \"<group>\"; };\n\t\tD83BF3E2881F2D2FFE4AFC22771FCE36 /* NSString+Lookin.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSString+Lookin.m\"; path = \"Src/Shared/Category/NSString+Lookin.m\"; sourceTree = \"<group>\"; };\n\t\tD8B765FF61800231762A18FFE0F6B382 /* Lookin_PTProtocol.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = Lookin_PTProtocol.m; path = Src/Shared/Peertalk/Lookin_PTProtocol.m; sourceTree = \"<group>\"; };\n\t\tD9AB342FF6C5A234675B5A531C1139CE /* LKS_AttrModificationPatchHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_AttrModificationPatchHandler.h; path = Src/Server/Connection/RequestHandler/LKS_AttrModificationPatchHandler.h; sourceTree = \"<group>\"; };\n\t\tD9AB931C6A78ED2A1999B2FBFE1B2058 /* LookinCodingValueType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinCodingValueType.h; path = Src/Shared/LookinCodingValueType.h; sourceTree = \"<group>\"; };\n\t\tDBBB0BD8EE0599FB15FBA352E0A04D30 /* UIViewController+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIViewController+LookinServer.h\"; path = \"Src/Server/Category/UIViewController+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\tDE9E6B913EEB5F5A1C9A7A85856175D1 /* CALayer+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"CALayer+LookinServer.h\"; path = \"Src/Server/Category/CALayer+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\tDF9096D9A2FD6A999E61346368CAA7ED /* UILabel+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UILabel+LookinServer.h\"; path = \"Src/Server/Category/UILabel+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\tE27C154D81D31A232159AB57767C52AE /* UIGestureRecognizer+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIGestureRecognizer+LookinServer.h\"; path = \"Src/Server/Category/UIGestureRecognizer+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\tE3525E795CBB069BECBB66727A9040B7 /* LKS_PerspectiveViewController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveViewController.m; path = Src/Server/Perspective/LKS_PerspectiveViewController.m; sourceTree = \"<group>\"; };\n\t\tE3B76BDD53364E83F98E635EB179731A /* NSObject+LookinServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSObject+LookinServer.h\"; path = \"Src/Server/Category/NSObject+LookinServer.h\"; sourceTree = \"<group>\"; };\n\t\tE3DEC557F4FBE7C86105D097E474E510 /* LookinAttributesGroup.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAttributesGroup.h; path = Src/Shared/LookinAttributesGroup.h; sourceTree = \"<group>\"; };\n\t\tE4F03438230841C57C8CCE5423D89E3E /* LookinConnectionResponseAttachment.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinConnectionResponseAttachment.m; path = Src/Shared/LookinConnectionResponseAttachment.m; sourceTree = \"<group>\"; };\n\t\tE74AA900536DACC16713277804225CFF /* LookinAutoLayoutConstraint.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinAutoLayoutConstraint.m; path = Src/Shared/LookinAutoLayoutConstraint.m; sourceTree = \"<group>\"; };\n\t\tE85CC932DE80B014D9094D2EAB34A2BB /* LKS_PerspectiveManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveManager.h; path = Src/Server/Perspective/LKS_PerspectiveManager.h; sourceTree = \"<group>\"; };\n\t\tEA12ACB760FC94D0D4DA39BA6AF7E6B5 /* CALayer+Lookin.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"CALayer+Lookin.h\"; path = \"Src/Shared/Category/CALayer+Lookin.h\"; sourceTree = \"<group>\"; };\n\t\tEA38C1286D76AB74A0A3F07249310FE4 /* LKS_Helper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_Helper.m; path = Src/Server/Others/LKS_Helper.m; sourceTree = \"<group>\"; };\n\t\tEABC1F238084414A9438F0EDD1898DB5 /* LookinMsgAttribute.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinMsgAttribute.h; path = Src/Shared/Message/LookinMsgAttribute.h; sourceTree = \"<group>\"; };\n\t\tEB6D809DF947CA72C9E61926B4EB3428 /* LookinAttrType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAttrType.h; path = Src/Shared/LookinAttrType.h; sourceTree = \"<group>\"; };\n\t\tECABCAA9FECE7257B4267ADB213E3283 /* UIColor+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIColor+LookinServer.m\"; path = \"Src/Server/Category/UIColor+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\tED0BE4AA53E1F0B4CEFB210EB072B5B8 /* LookinHierarchyFile.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinHierarchyFile.h; path = Src/Shared/LookinHierarchyFile.h; sourceTree = \"<group>\"; };\n\t\tEDA3ADE695F2893B80C54B136A905F4E /* LookinServer-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"LookinServer-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tEE4C7F689F691D2932E6C966D2FF4D79 /* LKS_PerspectiveHierarchyView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveHierarchyView.m; path = Src/Server/Perspective/LKS_PerspectiveHierarchyView.m; sourceTree = \"<group>\"; };\n\t\tEF7E557AED816E41355C82D9B01503E8 /* LKS_PerspectiveItemLayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LKS_PerspectiveItemLayer.h; path = Src/Server/Perspective/LKS_PerspectiveItemLayer.h; sourceTree = \"<group>\"; };\n\t\tF25DC14B557F5D850EB4B9EC29125151 /* LKS_PerspectiveLayer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveLayer.m; path = Src/Server/Perspective/LKS_PerspectiveLayer.m; sourceTree = \"<group>\"; };\n\t\tF29C8C8AF671DD8AD6A6F71861EA1879 /* UITableView+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UITableView+LookinServer.m\"; path = \"Src/Server/Category/UITableView+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\tF4EE9799E4B8DF680C384F179C7DEA96 /* LookinDisplayItemDetail.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinDisplayItemDetail.m; path = Src/Shared/LookinDisplayItemDetail.m; sourceTree = \"<group>\"; };\n\t\tF5AA9A2709B8E14E300CA2BC507F5C40 /* UIGestureRecognizer+LookinServer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIGestureRecognizer+LookinServer.m\"; path = \"Src/Server/Category/UIGestureRecognizer+LookinServer.m\"; sourceTree = \"<group>\"; };\n\t\tF77E54FD0F6D7095EE92036D9B822191 /* LKS_PerspectiveItemLayer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_PerspectiveItemLayer.m; path = Src/Server/Perspective/LKS_PerspectiveItemLayer.m; sourceTree = \"<group>\"; };\n\t\tF860090A54E794DBDDE6230A75E4739F /* LookinAttributeModification.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinAttributeModification.h; path = Src/Shared/LookinAttributeModification.h; sourceTree = \"<group>\"; };\n\t\tFB6A511D0F970464D508C64B44400C49 /* LookinAttributeModification.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinAttributeModification.m; path = Src/Shared/LookinAttributeModification.m; sourceTree = \"<group>\"; };\n\t\tFCAC034F412FE0127C5A680672CF74AE /* LKS_MethodTraceManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_MethodTraceManager.m; path = Src/Server/Others/LKS_MethodTraceManager.m; sourceTree = \"<group>\"; };\n\t\tFD83B9BC258C8DE9140CD28149D90C8F /* LookinMsgAttribute.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LookinMsgAttribute.m; path = Src/Shared/Message/LookinMsgAttribute.m; sourceTree = \"<group>\"; };\n\t\tFEC7FD91328A4C8DC0E6D7BCE863BF81 /* LookinHierarchyInfo.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LookinHierarchyInfo.h; path = Src/Shared/LookinHierarchyInfo.h; sourceTree = \"<group>\"; };\n\t\tFF0F6F9E63946A3F858110F6F4A7960E /* LKS_AttrGroupsMaker.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = LKS_AttrGroupsMaker.m; path = Src/Server/Others/LKS_AttrGroupsMaker.m; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t5787DF1786916C6CB4C51CC3328B719B /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t0F44787643816923BAC087056C4A2080 /* Foundation.framework in Frameworks */,\n\t\t\t\tB54C6FB5A76EDC47073B283362FB7469 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t3862AB1009CF14A102E76F02E5C20C34 /* LookinServer */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEA12ACB760FC94D0D4DA39BA6AF7E6B5 /* CALayer+Lookin.h */,\n\t\t\t\tC7D818A123DBDDE9CD05E9C12841308A /* CALayer+Lookin.m */,\n\t\t\t\tDE9E6B913EEB5F5A1C9A7A85856175D1 /* CALayer+LookinServer.h */,\n\t\t\t\t700AAE793D800E8DD0EB6BC4B0ADBBF7 /* CALayer+LookinServer.m */,\n\t\t\t\t0BFF5A0B9A97313479A5ACC0713BBB88 /* LKS_AttrGroupsMaker.h */,\n\t\t\t\tFF0F6F9E63946A3F858110F6F4A7960E /* LKS_AttrGroupsMaker.m */,\n\t\t\t\t7C2456EC8212C2D2646BF28F0307667A /* LKS_AttrModificationHandler.h */,\n\t\t\t\t991728F74F4232B04DA2F7EF601817A0 /* LKS_AttrModificationHandler.m */,\n\t\t\t\tD9AB342FF6C5A234675B5A531C1139CE /* LKS_AttrModificationPatchHandler.h */,\n\t\t\t\t51D4F1461926A74C5F2355B790ED8C4C /* LKS_AttrModificationPatchHandler.m */,\n\t\t\t\tA7DDA8A26682379CB80FC5F701737A35 /* LKS_ConnectionManager.h */,\n\t\t\t\t18267B21FB282FB0B18EC75340C86FA3 /* LKS_ConnectionManager.m */,\n\t\t\t\t81F4FD3C4B4EA45A4F30C40F3439154D /* LKS_EventHandlerMaker.h */,\n\t\t\t\t7FC48F9F883D5F0A27890E9C02AF37B7 /* LKS_EventHandlerMaker.m */,\n\t\t\t\tA8B0FC1B422235EFC24A5C70F1D78072 /* LKS_ExportManager.h */,\n\t\t\t\t87A73AAFE241AE1A9B0B1ECC3637BB09 /* LKS_ExportManager.m */,\n\t\t\t\t0E7FEAAFC6B39DC7F79F3474722C57CD /* LKS_Helper.h */,\n\t\t\t\tEA38C1286D76AB74A0A3F07249310FE4 /* LKS_Helper.m */,\n\t\t\t\t173E783D805E674CA7CABEF6EB38D617 /* LKS_HierarchyDetailsHandler.h */,\n\t\t\t\t21F08BBDCB1DE1C436221C396C470AD9 /* LKS_HierarchyDetailsHandler.m */,\n\t\t\t\t0A57D122B6D3D68B27A0801624E11D79 /* LKS_HierarchyDisplayItemsMaker.h */,\n\t\t\t\t656101743950D6F3B29B041FABBABBBA /* LKS_HierarchyDisplayItemsMaker.m */,\n\t\t\t\t2772D6A405FA998F1381C4FFC69BBCB6 /* LKS_LocalInspectManager.h */,\n\t\t\t\tD43309255489FF7F10A373E13EBAECCB /* LKS_LocalInspectManager.m */,\n\t\t\t\t022AE5FFEC8ED71480F4495D0C937D05 /* LKS_LocalInspectPanelLabelView.h */,\n\t\t\t\t7E443763A7FABE91F240735CAA10A8EC /* LKS_LocalInspectPanelLabelView.m */,\n\t\t\t\tCE764CE3893B37689C0BC44ECA3B4B91 /* LKS_LocalInspectViewController.h */,\n\t\t\t\t6F2232DD63EB754EAC74ABEFFF76FE5A /* LKS_LocalInspectViewController.m */,\n\t\t\t\tB08F267BE32A0116787F7BB24B80E175 /* LKS_MethodTraceManager.h */,\n\t\t\t\tFCAC034F412FE0127C5A680672CF74AE /* LKS_MethodTraceManager.m */,\n\t\t\t\t9A84F074D462823887DC12C48CF1A23D /* LKS_ObjectRegistry.h */,\n\t\t\t\t9B8AD05BE1E641DD05378CDD1790D19A /* LKS_ObjectRegistry.m */,\n\t\t\t\t1A11CB612DBE8B848DB0A4FDE2FE0AC4 /* LKS_PerspectiveDataSource.h */,\n\t\t\t\t6B106512A34844A36D1126D046386C11 /* LKS_PerspectiveDataSource.m */,\n\t\t\t\t2CBCB52C0DEB35E82AF29E260674BEC9 /* LKS_PerspectiveHierarchyCell.h */,\n\t\t\t\t5E9E73467EA12C21865FE8795FBCCC7B /* LKS_PerspectiveHierarchyCell.m */,\n\t\t\t\t430091E00751A8309CBEFCB975D628B2 /* LKS_PerspectiveHierarchyView.h */,\n\t\t\t\tEE4C7F689F691D2932E6C966D2FF4D79 /* LKS_PerspectiveHierarchyView.m */,\n\t\t\t\tEF7E557AED816E41355C82D9B01503E8 /* LKS_PerspectiveItemLayer.h */,\n\t\t\t\tF77E54FD0F6D7095EE92036D9B822191 /* LKS_PerspectiveItemLayer.m */,\n\t\t\t\t1A038A6A3CA099582D1CDBF695869B04 /* LKS_PerspectiveLayer.h */,\n\t\t\t\tF25DC14B557F5D850EB4B9EC29125151 /* LKS_PerspectiveLayer.m */,\n\t\t\t\tE85CC932DE80B014D9094D2EAB34A2BB /* LKS_PerspectiveManager.h */,\n\t\t\t\t515D40D758457E6B5B1173030C01612F /* LKS_PerspectiveManager.m */,\n\t\t\t\tAC84153F310DFC708D8164A5A577F77B /* LKS_PerspectiveToolbarButtons.h */,\n\t\t\t\tC6609C187DF26848E8C472E1D75F3C91 /* LKS_PerspectiveToolbarButtons.m */,\n\t\t\t\t637189BE5F1131ED2B6238784DCD7D27 /* LKS_PerspectiveViewController.h */,\n\t\t\t\tE3525E795CBB069BECBB66727A9040B7 /* LKS_PerspectiveViewController.m */,\n\t\t\t\t42A2DA1C4547F338D0840E159B27BBC1 /* LKS_RequestHandler.h */,\n\t\t\t\t70A99B3B51A5DA2F5F3FFA7A193677A0 /* LKS_RequestHandler.m */,\n\t\t\t\t941BD4B62238E984825C8E89087A91F4 /* LKS_TraceManager.h */,\n\t\t\t\tAB4C8818C35EE45FF37BA06805CD7D8E /* LKS_TraceManager.m */,\n\t\t\t\t4C5E5E31A936D294D1C60BCD4CB9F702 /* Lookin_PTChannel.h */,\n\t\t\t\t21F862FE51621788FE3B5B10B9658E14 /* Lookin_PTChannel.m */,\n\t\t\t\t3E97A80192FBDADDC55188CF6091D5E3 /* Lookin_PTPrivate.h */,\n\t\t\t\t219AA6511B5F17D2215297AA9D40FA0F /* Lookin_PTProtocol.h */,\n\t\t\t\tD8B765FF61800231762A18FFE0F6B382 /* Lookin_PTProtocol.m */,\n\t\t\t\t179A2FE851754AACFEEDCF6AB4C759E7 /* Lookin_PTUSBHub.h */,\n\t\t\t\tCF2D7FC011FE161AC8F55805FF17FA56 /* Lookin_PTUSBHub.m */,\n\t\t\t\t867C4CCA7408106ED81C200C0923172A /* LookinAppInfo.h */,\n\t\t\t\t4215DBA0FCC1E7DBED9F012AE258EEF7 /* LookinAppInfo.m */,\n\t\t\t\tC20376EF9715E89F9FAB805E395FC794 /* LookinAttribute.h */,\n\t\t\t\t0F20D43D8013D763C2F1557F458A5878 /* LookinAttribute.m */,\n\t\t\t\tF860090A54E794DBDDE6230A75E4739F /* LookinAttributeModification.h */,\n\t\t\t\tFB6A511D0F970464D508C64B44400C49 /* LookinAttributeModification.m */,\n\t\t\t\tE3DEC557F4FBE7C86105D097E474E510 /* LookinAttributesGroup.h */,\n\t\t\t\t87003642A2A1C6CC8D560F23C205ED96 /* LookinAttributesGroup.m */,\n\t\t\t\t7493D9CF640ACB6E2372474DA69C4DBE /* LookinAttributesSection.h */,\n\t\t\t\t0FE713547D1B7A6F064D3C459B11643D /* LookinAttributesSection.m */,\n\t\t\t\t30A15219ABF51508E1B5E7F41021FCF3 /* LookinAttrIdentifiers.h */,\n\t\t\t\t2F0724A757C4E810ADCA40BF3CE53E06 /* LookinAttrIdentifiers.m */,\n\t\t\t\tEB6D809DF947CA72C9E61926B4EB3428 /* LookinAttrType.h */,\n\t\t\t\t36B7DA9575C5ACE426132494D8083ED2 /* LookinAutoLayoutConstraint.h */,\n\t\t\t\tE74AA900536DACC16713277804225CFF /* LookinAutoLayoutConstraint.m */,\n\t\t\t\tD9AB931C6A78ED2A1999B2FBFE1B2058 /* LookinCodingValueType.h */,\n\t\t\t\t1DAB7747E848BF750F935DB1509AF889 /* LookinConnectionAttachment.h */,\n\t\t\t\t2232E67A42835952B7296F474DBE7E5C /* LookinConnectionAttachment.m */,\n\t\t\t\t8B8C4C1259B87ADA2BA1155FD8682977 /* LookinConnectionResponseAttachment.h */,\n\t\t\t\tE4F03438230841C57C8CCE5423D89E3E /* LookinConnectionResponseAttachment.m */,\n\t\t\t\t0EC99F32DAB1371DC1BC2B4DE054EBB1 /* LookinDashboardBlueprint.h */,\n\t\t\t\tBDC348B013DE04566F37F77372AC0051 /* LookinDashboardBlueprint.m */,\n\t\t\t\t3909A6FD0C3D8CEB54CAAEB9D79DC25C /* LookinDefines.h */,\n\t\t\t\t8CD1D33AA0DDB360941DF2F6E823CAF5 /* LookinDisplayItem.h */,\n\t\t\t\t46288120050C8C2D6841B9477D8CB3AC /* LookinDisplayItem.m */,\n\t\t\t\t7479CE957173AC886F78C2AC7C84AE5E /* LookinDisplayItemDetail.h */,\n\t\t\t\tF4EE9799E4B8DF680C384F179C7DEA96 /* LookinDisplayItemDetail.m */,\n\t\t\t\t7E6212748693A9421890641FD76646BA /* LookinEventHandler.h */,\n\t\t\t\t551E524A4439B10891291D09502E75F9 /* LookinEventHandler.m */,\n\t\t\t\tED0BE4AA53E1F0B4CEFB210EB072B5B8 /* LookinHierarchyFile.h */,\n\t\t\t\tCB13006AA2FDB3AE3E4B22D3D9F5489D /* LookinHierarchyFile.m */,\n\t\t\t\tFEC7FD91328A4C8DC0E6D7BCE863BF81 /* LookinHierarchyInfo.h */,\n\t\t\t\tBB6373DF2DC64B584B8CF09C4150C433 /* LookinHierarchyInfo.m */,\n\t\t\t\tC2242704AF70D5C582CC2B6198FD68E0 /* LookinIvarTrace.h */,\n\t\t\t\tCE8A797C14470C70649EE63152213162 /* LookinIvarTrace.m */,\n\t\t\t\t60445E6794C31E0A2C99993647C024EC /* LookinMethodTraceRecord.h */,\n\t\t\t\tBD6B5A8BA9AB2C7289B5C3AF5CE7637D /* LookinMethodTraceRecord.m */,\n\t\t\t\tEABC1F238084414A9438F0EDD1898DB5 /* LookinMsgAttribute.h */,\n\t\t\t\tFD83B9BC258C8DE9140CD28149D90C8F /* LookinMsgAttribute.m */,\n\t\t\t\t0EC9DA8B816F7ACB2A377E14F2B2742E /* LookinMsgTargetAction.h */,\n\t\t\t\t5E62B8AF634F85D998245B5DD74B9A7B /* LookinMsgTargetAction.m */,\n\t\t\t\tC407FEBCA96257041F34657CB4E402A6 /* LookinObject.h */,\n\t\t\t\tB4807F2269356902D5229A64D3702476 /* LookinObject.m */,\n\t\t\t\t465E6E3CA198A46580FAB98EDF3A4650 /* LookinScreenshotFetchManager.h */,\n\t\t\t\t182681E841B47CA3389B60AB51ED6557 /* LookinServer.h */,\n\t\t\t\t6152D80B4CE36E418A4B43B6BC0659F1 /* LookinServerDefines.h */,\n\t\t\t\t1EED9D3B1A085A02A5DA4405DC471C06 /* LookinStaticAsyncUpdateTask.h */,\n\t\t\t\t1D84A4451E510F809149A89ECD44325B /* LookinStaticAsyncUpdateTask.m */,\n\t\t\t\tC530A07C10CC3C497B8AA6BD6DE8052D /* LookinTuple.h */,\n\t\t\t\t16CE2F8C86820C423CE6BE2AE6F52F46 /* LookinTuple.m */,\n\t\t\t\t78021CFD427249E79E99A44F636233A4 /* LookinWeakContainer.h */,\n\t\t\t\t9988BB7C7CD4DB52B5C26669B32EDEB6 /* LookinWeakContainer.m */,\n\t\t\t\t40557903743DD96F426AD2B887B19435 /* NSArray+Lookin.h */,\n\t\t\t\t92BE346C95BF1CD82EE3A572BAE514F3 /* NSArray+Lookin.m */,\n\t\t\t\t6F3B972C5B0BC04A7DD297F63757AE18 /* NSObject+Lookin.h */,\n\t\t\t\t8A048573D79E53B8ED42A1FE066C1EA2 /* NSObject+Lookin.m */,\n\t\t\t\tE3B76BDD53364E83F98E635EB179731A /* NSObject+LookinServer.h */,\n\t\t\t\t15624D3BC8B0BBC6561F583620D5503A /* NSObject+LookinServer.m */,\n\t\t\t\tAEC483F02167148745A30C09435FB5CF /* NSSet+Lookin.h */,\n\t\t\t\t6B4800BE9AA6A7DBFDF9F166216FE328 /* NSSet+Lookin.m */,\n\t\t\t\t8BE23A84D94F58A983283437C76B01EA /* NSString+Lookin.h */,\n\t\t\t\tD83BF3E2881F2D2FFE4AFC22771FCE36 /* NSString+Lookin.m */,\n\t\t\t\t224D485BBB4E6CC4AAF6953AEEBE11A2 /* Peertalk.h */,\n\t\t\t\t40E4E28CD8268379C395F944C80E5D24 /* UIBlurEffect+LookinServer.h */,\n\t\t\t\t29885A010A1ED17B3073AC278B9CD638 /* UIBlurEffect+LookinServer.m */,\n\t\t\t\t2C0ACC09086E7B9ABB0D6E23122FBC38 /* UIColor+LookinServer.h */,\n\t\t\t\tECABCAA9FECE7257B4267ADB213E3283 /* UIColor+LookinServer.m */,\n\t\t\t\tE27C154D81D31A232159AB57767C52AE /* UIGestureRecognizer+LookinServer.h */,\n\t\t\t\tF5AA9A2709B8E14E300CA2BC507F5C40 /* UIGestureRecognizer+LookinServer.m */,\n\t\t\t\t64244C3B0B7A8712804C5B3E3B1E6739 /* UIImage+LookinServer.h */,\n\t\t\t\t246618B47B4E7B3A98F764EE2AB3D655 /* UIImage+LookinServer.m */,\n\t\t\t\t7469939E6B32E3BE277DF6CD1809B0C4 /* UIImageView+LookinServer.h */,\n\t\t\t\tBBB9FB08942E7D1C225B340C732C8423 /* UIImageView+LookinServer.m */,\n\t\t\t\tDF9096D9A2FD6A999E61346368CAA7ED /* UILabel+LookinServer.h */,\n\t\t\t\t6E191CE81EFBC8BCBEB3FB1BA5BA26C5 /* UILabel+LookinServer.m */,\n\t\t\t\t92F6252A0756D75A03CE9423F3290EE9 /* UITableView+LookinServer.h */,\n\t\t\t\tF29C8C8AF671DD8AD6A6F71861EA1879 /* UITableView+LookinServer.m */,\n\t\t\t\t8309B1276C55989BB2E4DFB8CECBEC85 /* UITextField+LookinServer.h */,\n\t\t\t\t3361441F9DE5F0C1FF71ED1246DE1347 /* UITextField+LookinServer.m */,\n\t\t\t\tB034E538DC0BB5FECD524A9C5C4D13D7 /* UITextView+LookinServer.h */,\n\t\t\t\tC5A40322BA2B1C0B2B5F7CABD8A212F2 /* UITextView+LookinServer.m */,\n\t\t\t\t56E60FA565B2F3D48818431F6A85B480 /* UIView+LookinServer.h */,\n\t\t\t\t7F2894DDD0E7CDB23764E9BACDF09E09 /* UIView+LookinServer.m */,\n\t\t\t\tDBBB0BD8EE0599FB15FBA352E0A04D30 /* UIViewController+LookinServer.h */,\n\t\t\t\tB4F1E7E5E9079471F411ED35B385AF1C /* UIViewController+LookinServer.m */,\n\t\t\t\t9E6A258A86907EBBDB399A0A13A4BBE5 /* UIVisualEffectView+LookinServer.h */,\n\t\t\t\t49591CFFFE70FE73881333F76E3E0D63 /* UIVisualEffectView+LookinServer.m */,\n\t\t\t\t5357AFB086BDEE64E71C9543E4307A0D /* Support Files */,\n\t\t\t);\n\t\t\tname = LookinServer;\n\t\t\tpath = LookinServer;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5357AFB086BDEE64E71C9543E4307A0D /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD4CD73A1E50A101687814F7ABF04265E /* LookinServer.modulemap */,\n\t\t\t\tB18EB5F410154612C3DBD3105D53A343 /* LookinServer-dummy.m */,\n\t\t\t\t57C8F91060EB0C2BE160F350E73A8D0C /* LookinServer-Info.plist */,\n\t\t\t\t71205DCD6C69B060581558DEB238117D /* LookinServer-prefix.pch */,\n\t\t\t\tEDA3ADE695F2893B80C54B136A905F4E /* LookinServer-umbrella.h */,\n\t\t\t\t2D1FAE0CBF86AD8A024D1773DEFB7138 /* LookinServer.debug.xcconfig */,\n\t\t\t\tCC8747E5B43F011547141A5E7D968B8E /* LookinServer.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/LookinServer\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t68B88F80396E7A15666152A59954A48D = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE3873160BD2B7D5D67CE5F8482938AF8 /* Frameworks */,\n\t\t\t\t3862AB1009CF14A102E76F02E5C20C34 /* LookinServer */,\n\t\t\t\tB40ADCBD0EA03356A98C1B8AAB71581C /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB40ADCBD0EA03356A98C1B8AAB71581C /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t9DA9FD79B390D311AB61B8493E143F18 /* LookinServer */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCE5076082FA56FA206F54AA30BBDBA13 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t529308949481ABD4AB88E1E73E3E257A /* Foundation.framework */,\n\t\t\t\t070553B20C0DF9A38585E6C4EAD989AE /* UIKit.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE3873160BD2B7D5D67CE5F8482938AF8 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCE5076082FA56FA206F54AA30BBDBA13 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t17D08EE89475C5AD85D1262B059C5B04 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB4BFA1A5E58FCDD2BA5D4261D71302A9 /* CALayer+Lookin.h in Headers */,\n\t\t\t\tCEF0CBC49993952ED1604A188D1563AB /* CALayer+LookinServer.h in Headers */,\n\t\t\t\tF2967247DC7D19DDCEBEE97D626741D8 /* LKS_AttrGroupsMaker.h in Headers */,\n\t\t\t\t61A82B81A37C4EF0DE9245DF03BCC0B2 /* LKS_AttrModificationHandler.h in Headers */,\n\t\t\t\tAD8129C7689DB229DA465BD6C4100D21 /* LKS_AttrModificationPatchHandler.h in Headers */,\n\t\t\t\t588F4168AD89A508BB0443FC637EA740 /* LKS_ConnectionManager.h in Headers */,\n\t\t\t\t7D796BD98330217929ED6786E25D328E /* LKS_EventHandlerMaker.h in Headers */,\n\t\t\t\t5220A06D70DA6E2E50C4A6947923C228 /* LKS_ExportManager.h in Headers */,\n\t\t\t\t89A793565D3DA2487F0400F51E97E51A /* LKS_Helper.h in Headers */,\n\t\t\t\t7B9FEF91BA9C3F85EE09C3CC4E2A8704 /* LKS_HierarchyDetailsHandler.h in Headers */,\n\t\t\t\t38584E6F140A852D0FC933C6453DC727 /* LKS_HierarchyDisplayItemsMaker.h in Headers */,\n\t\t\t\tEEF7475AA070A169E5479462C4D7E441 /* LKS_LocalInspectManager.h in Headers */,\n\t\t\t\t1DF8E0315478D3C7360E2E6A1175A234 /* LKS_LocalInspectPanelLabelView.h in Headers */,\n\t\t\t\tB21BD55B46BD2A28CF186366F7B20E2E /* LKS_LocalInspectViewController.h in Headers */,\n\t\t\t\t3BEC9A7C9CC95CAF7EA103FC4ABD6958 /* LKS_MethodTraceManager.h in Headers */,\n\t\t\t\t59D9096FFE602883B44BE1490A401BA3 /* LKS_ObjectRegistry.h in Headers */,\n\t\t\t\tCDFC89C87D324B64B7499DD1604348AA /* LKS_PerspectiveDataSource.h in Headers */,\n\t\t\t\t71B30263D74D639BF4E4691B8A13D8F1 /* LKS_PerspectiveHierarchyCell.h in Headers */,\n\t\t\t\tA0DE3EA47497800844AF034DB6F24252 /* LKS_PerspectiveHierarchyView.h in Headers */,\n\t\t\t\t45E3043648A92DBD685AE0C864652A67 /* LKS_PerspectiveItemLayer.h in Headers */,\n\t\t\t\tEBDBD9E36412D0FA1E2780ED9765E6B6 /* LKS_PerspectiveLayer.h in Headers */,\n\t\t\t\t85A8B0F6DE99D2661790D9587DE88ACB /* LKS_PerspectiveManager.h in Headers */,\n\t\t\t\t29BEE3561388B64AF95D3514D5D06A04 /* LKS_PerspectiveToolbarButtons.h in Headers */,\n\t\t\t\t2FE5520BE07DDA2734D019A4CB043F70 /* LKS_PerspectiveViewController.h in Headers */,\n\t\t\t\t244E750327B0F3772822E822AE74C4B1 /* LKS_RequestHandler.h in Headers */,\n\t\t\t\t1A07C183B19438380EC391F638EAB6C4 /* LKS_TraceManager.h in Headers */,\n\t\t\t\tED22780431607AF0AC5178858EE9B47D /* Lookin_PTChannel.h in Headers */,\n\t\t\t\tBDA4B3D5927885B71F129F17B4D68949 /* Lookin_PTPrivate.h in Headers */,\n\t\t\t\t686B63A2DB1582BA86FD2474862A55A2 /* Lookin_PTProtocol.h in Headers */,\n\t\t\t\tEDB75BEDB97A0DCA8AC5925B5A630763 /* Lookin_PTUSBHub.h in Headers */,\n\t\t\t\tB466251D9036F2EFC186A34E76524780 /* LookinAppInfo.h in Headers */,\n\t\t\t\t282C55A16088154CC5A1D5DEDA5496BD /* LookinAttribute.h in Headers */,\n\t\t\t\t5C9E1A1CBF7201E4AAE584DD0D9303D0 /* LookinAttributeModification.h in Headers */,\n\t\t\t\tE81887F5984EF9D94B822A01D1D84B22 /* LookinAttributesGroup.h in Headers */,\n\t\t\t\tB29549D4F3B66555C98D8181395290C3 /* LookinAttributesSection.h in Headers */,\n\t\t\t\tBE1853E860F777A2557B51C90A4B777E /* LookinAttrIdentifiers.h in Headers */,\n\t\t\t\tA66B08B83E58ED25DE9F62F7860A0B83 /* LookinAttrType.h in Headers */,\n\t\t\t\t7E6EB0135FFE02705D5953A6EDD53670 /* LookinAutoLayoutConstraint.h in Headers */,\n\t\t\t\t86260B5E519495CBA470ADD62F5F7EFE /* LookinCodingValueType.h in Headers */,\n\t\t\t\tFAACFEE16C085FB5F6D2F9D24C97D0F2 /* LookinConnectionAttachment.h in Headers */,\n\t\t\t\tA8ABD68C212B85DBF0DB98B6BE93771E /* LookinConnectionResponseAttachment.h in Headers */,\n\t\t\t\tA8203C32C9F49EAC14E3EF4F7AAA2F1B /* LookinDashboardBlueprint.h in Headers */,\n\t\t\t\t2CF42A33A3EFB7E758A00EAE88CA48A6 /* LookinDefines.h in Headers */,\n\t\t\t\t88303415F115915F79C2A03F5BE82076 /* LookinDisplayItem.h in Headers */,\n\t\t\t\tC6D113E45DF8A85A2417FBA19976723D /* LookinDisplayItemDetail.h in Headers */,\n\t\t\t\t1C33FC41BC4C4A2BF858360886B333F4 /* LookinEventHandler.h in Headers */,\n\t\t\t\t7C294DC14AFC7D036D4A44F755187029 /* LookinHierarchyFile.h in Headers */,\n\t\t\t\t2D76B474884CE186A953AB361C3A0754 /* LookinHierarchyInfo.h in Headers */,\n\t\t\t\t90B9E88EB07332D674B580EA9523D778 /* LookinIvarTrace.h in Headers */,\n\t\t\t\tD8A570C0CFDCF761E580B74116D85154 /* LookinMethodTraceRecord.h in Headers */,\n\t\t\t\tEF592766200A98B22B45A7FE854418CE /* LookinMsgAttribute.h in Headers */,\n\t\t\t\t37773027F74EDBAF1EBEA0F49D0736B8 /* LookinMsgTargetAction.h in Headers */,\n\t\t\t\t817F906E97C8BDC685735D7ACA16BF67 /* LookinObject.h in Headers */,\n\t\t\t\t24788392D96B78DACD52C327D7C81588 /* LookinScreenshotFetchManager.h in Headers */,\n\t\t\t\tAD3B97F3C235643CC0BF3FAA024282DF /* LookinServer.h in Headers */,\n\t\t\t\t4CA8C1C4D57F45A59342E14A03B8F05B /* LookinServer-umbrella.h in Headers */,\n\t\t\t\t162B974D5CFAA781469962B3E3452586 /* LookinServerDefines.h in Headers */,\n\t\t\t\t938AB95A69CB2DBC5586C7BB9A6FB3C4 /* LookinStaticAsyncUpdateTask.h in Headers */,\n\t\t\t\tB94FD9A94D4B58CB9EC9C3E323E1B96C /* LookinTuple.h in Headers */,\n\t\t\t\t8DA545D912C08215993B294F79A135D7 /* LookinWeakContainer.h in Headers */,\n\t\t\t\t323CCED73BD97CE6A7061AB9DCF29ABD /* NSArray+Lookin.h in Headers */,\n\t\t\t\tB1D0A281262122304BEB8EE4D8656B89 /* NSObject+Lookin.h in Headers */,\n\t\t\t\tCF0933DBA480911BF4C1108EAC878BDA /* NSObject+LookinServer.h in Headers */,\n\t\t\t\t73E919F3A51CE449FF8ADD8DE5F31166 /* NSSet+Lookin.h in Headers */,\n\t\t\t\t05DE3FCE3B92E2C903FA0A27C2949E5C /* NSString+Lookin.h in Headers */,\n\t\t\t\t4062F9C27D84C7947F3ECE1EF54F8105 /* Peertalk.h in Headers */,\n\t\t\t\t637D22A34CDB36C98E7251295D61F38D /* UIBlurEffect+LookinServer.h in Headers */,\n\t\t\t\tD4398BC5DF54688C6A49EA7644C2AA85 /* UIColor+LookinServer.h in Headers */,\n\t\t\t\t2AC92219E8826061D9670134CF8D9834 /* UIGestureRecognizer+LookinServer.h in Headers */,\n\t\t\t\tF2809BD02FFD2D96AFF92F909DD11088 /* UIImage+LookinServer.h in Headers */,\n\t\t\t\t8852CB988A3DEC15C36D642391B16F79 /* UIImageView+LookinServer.h in Headers */,\n\t\t\t\t243F6946BE59EA71989BE9CC0E4395CE /* UILabel+LookinServer.h in Headers */,\n\t\t\t\t395FC03D4A5C78FEBF6B71C65915FE25 /* UITableView+LookinServer.h in Headers */,\n\t\t\t\t75C4F601BA3E44DED010203F2FA45C2A /* UITextField+LookinServer.h in Headers */,\n\t\t\t\t3B3AEA75418D1246AA27FAD925A55D9F /* UITextView+LookinServer.h in Headers */,\n\t\t\t\t03BF733EE0CCA34067BE750A86CB4FE3 /* UIView+LookinServer.h in Headers */,\n\t\t\t\t5EA56E8AABB0D5BD07ED6A782DA8B1AC /* UIViewController+LookinServer.h in Headers */,\n\t\t\t\tFBE0905907E8A2E96C60D614BE7AD96B /* UIVisualEffectView+LookinServer.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t648108237631EEA52299D347ABDCA30C /* LookinServer */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = A81AC9CE73467B43AFA824E7E87A9E35 /* Build configuration list for PBXNativeTarget \"LookinServer\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t17D08EE89475C5AD85D1262B059C5B04 /* Headers */,\n\t\t\t\t9331766519D21B4E8A7DDF6D1C1D68D9 /* Sources */,\n\t\t\t\t5787DF1786916C6CB4C51CC3328B719B /* Frameworks */,\n\t\t\t\t10F81DFF86A758A46DACAEA081EAD365 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = LookinServer;\n\t\t\tproductName = LookinServer;\n\t\t\tproductReference = 9DA9FD79B390D311AB61B8493E143F18 /* LookinServer */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tEE0D1B414354E75CF24F6A71E4A0DDCD /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 5BC541B16AE882BD8254D3EA82BA48C0 /* Build configuration list for PBXProject \"LookinServer\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 68B88F80396E7A15666152A59954A48D;\n\t\t\tproductRefGroup = B40ADCBD0EA03356A98C1B8AAB71581C /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t648108237631EEA52299D347ABDCA30C /* LookinServer */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t10F81DFF86A758A46DACAEA081EAD365 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t9331766519D21B4E8A7DDF6D1C1D68D9 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t1FAE39D41FE1F9741E04003A6C903582 /* CALayer+Lookin.m in Sources */,\n\t\t\t\tEEF5224101D9FB9215C83192D9FFA475 /* CALayer+LookinServer.m in Sources */,\n\t\t\t\tEAF37F0CADDFB6B59F3537F1C4345A41 /* LKS_AttrGroupsMaker.m in Sources */,\n\t\t\t\tF731001E2F0512B9FD9C46DA0D9B7CB3 /* LKS_AttrModificationHandler.m in Sources */,\n\t\t\t\t5388ABE101FDE4B892036F8CDF6D244F /* LKS_AttrModificationPatchHandler.m in Sources */,\n\t\t\t\t7666D4A2B5B913494C898D0C480C1361 /* LKS_ConnectionManager.m in Sources */,\n\t\t\t\tD8391668AAC27BE0089925F58E3D948F /* LKS_EventHandlerMaker.m in Sources */,\n\t\t\t\tFADA811653EE71E91BB62922879788D5 /* LKS_ExportManager.m in Sources */,\n\t\t\t\tC65099DD0C74F8C6DAEB416D5CB78ABF /* LKS_Helper.m in Sources */,\n\t\t\t\t41E1BB7BA9DD30BEA8B2CA1878BD08E8 /* LKS_HierarchyDetailsHandler.m in Sources */,\n\t\t\t\t7F37B6373DE062C9B0B24DD8E7AE11F5 /* LKS_HierarchyDisplayItemsMaker.m in Sources */,\n\t\t\t\t676EEFF596210E09477FD56A7A00A413 /* LKS_LocalInspectManager.m in Sources */,\n\t\t\t\t3AE087196930BBC5B29288CC6FC012A8 /* LKS_LocalInspectPanelLabelView.m in Sources */,\n\t\t\t\tA2C5F8D1319F000A4952F3752DD43A58 /* LKS_LocalInspectViewController.m in Sources */,\n\t\t\t\tE4FDE57E1B38FCAE9B3884F4A4F863FC /* LKS_MethodTraceManager.m in Sources */,\n\t\t\t\tCA8EA2FE75BC0DA7F5598CA0632CDFFE /* LKS_ObjectRegistry.m in Sources */,\n\t\t\t\t5F1D8D32B4FF5122EBDF3C8DA4F29C16 /* LKS_PerspectiveDataSource.m in Sources */,\n\t\t\t\t00A917F15A02C36E85016A1EC5151F48 /* LKS_PerspectiveHierarchyCell.m in Sources */,\n\t\t\t\tAFE7D8A53068BF01D48B797654F8D432 /* LKS_PerspectiveHierarchyView.m in Sources */,\n\t\t\t\t3387D7AE3F4445B00FBC375F19A1C1E3 /* LKS_PerspectiveItemLayer.m in Sources */,\n\t\t\t\t5415C8359379460B1C0973DFFAA43BC1 /* LKS_PerspectiveLayer.m in Sources */,\n\t\t\t\t2F15C8851FC095F0E86485957577397D /* LKS_PerspectiveManager.m in Sources */,\n\t\t\t\t718515A9A80108D18EA957F3F1D2737C /* LKS_PerspectiveToolbarButtons.m in Sources */,\n\t\t\t\t7BC0882A3A100DB0ADDDEC34A7E9226A /* LKS_PerspectiveViewController.m in Sources */,\n\t\t\t\t0A5D6BE168F45534389D58B0E5C402F2 /* LKS_RequestHandler.m in Sources */,\n\t\t\t\tD835AB44CED4D20B062627054BBFCCBD /* LKS_TraceManager.m in Sources */,\n\t\t\t\t4FC57AC9601D64119D70C2D753D9C2AE /* Lookin_PTChannel.m in Sources */,\n\t\t\t\tE3EE06E9F651979DBE44DE18CBC537AA /* Lookin_PTProtocol.m in Sources */,\n\t\t\t\t929990A7CD2FA0F831E363B1575D342D /* Lookin_PTUSBHub.m in Sources */,\n\t\t\t\t7031600C6E773A7B7DD831B7936CBB38 /* LookinAppInfo.m in Sources */,\n\t\t\t\t52AD271308B525C3896B492C90B04041 /* LookinAttribute.m in Sources */,\n\t\t\t\tD4240909C3EB581AAD9D4F30A54D5060 /* LookinAttributeModification.m in Sources */,\n\t\t\t\t96D3B5E4BF637A8C58E69ADD0F7466F7 /* LookinAttributesGroup.m in Sources */,\n\t\t\t\t4101D5C79944A7EE20D39C305E3925E7 /* LookinAttributesSection.m in Sources */,\n\t\t\t\t0B19793D921F29CA064CF7CFEC4DACFF /* LookinAttrIdentifiers.m in Sources */,\n\t\t\t\t9723A5322855C2CE944B6ADA7144AF3D /* LookinAutoLayoutConstraint.m in Sources */,\n\t\t\t\t66ACB4C67161227890538AB1D296E2D9 /* LookinConnectionAttachment.m in Sources */,\n\t\t\t\tBBECE031D3606D9AEF902AC02B5D6B2A /* LookinConnectionResponseAttachment.m in Sources */,\n\t\t\t\tCFBCC88A4F3DEF0CE69E543801EBA607 /* LookinDashboardBlueprint.m in Sources */,\n\t\t\t\tC77C105596399C54E4ACDB7081069F09 /* LookinDisplayItem.m in Sources */,\n\t\t\t\t8287DC67E9027000D2FAF4BC8C47900F /* LookinDisplayItemDetail.m in Sources */,\n\t\t\t\t5392E9741A719C21EC773F166E4CC320 /* LookinEventHandler.m in Sources */,\n\t\t\t\t58483A17890415B06F360903F67C0A9B /* LookinHierarchyFile.m in Sources */,\n\t\t\t\t773059DF5A7F7830A39BDEC5F5E592EA /* LookinHierarchyInfo.m in Sources */,\n\t\t\t\tFF00082EEA92F5B850C4EBAC6052065B /* LookinIvarTrace.m in Sources */,\n\t\t\t\tC3090402C42FEE35E46BE9ACA62E59D5 /* LookinMethodTraceRecord.m in Sources */,\n\t\t\t\t7FD7C3C2E6628BD153FBE19EE0B862C6 /* LookinMsgAttribute.m in Sources */,\n\t\t\t\t81031A88AF1A82C8CA05312E921AD20F /* LookinMsgTargetAction.m in Sources */,\n\t\t\t\tAB72691991AB2233825ABF6562E75ABC /* LookinObject.m in Sources */,\n\t\t\t\t28D119755232554E19AF0D22A47E9A6D /* LookinServer-dummy.m in Sources */,\n\t\t\t\tAF2E535AFA72186438117A4E70BCFD50 /* LookinStaticAsyncUpdateTask.m in Sources */,\n\t\t\t\tB45B85409AE28EDE3532938ECB54301E /* LookinTuple.m in Sources */,\n\t\t\t\tBDC2179794DF128F9C6B76E79688ED7A /* LookinWeakContainer.m in Sources */,\n\t\t\t\tB39AE573AC30734EC60348DD0B533DA4 /* NSArray+Lookin.m in Sources */,\n\t\t\t\t226CDFCBA1E5B2AFC1C73CEEBF4C3B9D /* NSObject+Lookin.m in Sources */,\n\t\t\t\t93CE3C05AC802BDD1E4DACC8AD1D04FB /* NSObject+LookinServer.m in Sources */,\n\t\t\t\tBEE3F7679AECC5605C87AC2CC57F642B /* NSSet+Lookin.m in Sources */,\n\t\t\t\t75AA7C8E605783943689788D6E0613DE /* NSString+Lookin.m in Sources */,\n\t\t\t\t26C1AA2A72BA4911E95AEC4B218892F4 /* UIBlurEffect+LookinServer.m in Sources */,\n\t\t\t\t5A4663B94CB417B32F89C525235FA8B6 /* UIColor+LookinServer.m in Sources */,\n\t\t\t\tD85F1AEDA79F234519A58954C3663A17 /* UIGestureRecognizer+LookinServer.m in Sources */,\n\t\t\t\t80B065E4294688AEE94640333908E2D5 /* UIImage+LookinServer.m in Sources */,\n\t\t\t\t002AFEB451777DB9A3DC1418A64FDAEB /* UIImageView+LookinServer.m in Sources */,\n\t\t\t\t0ED01054EF8DFC123A9AD872AFC9CD15 /* UILabel+LookinServer.m in Sources */,\n\t\t\t\t25D304D758958B0D9C27B8FC8EB0ACBB /* UITableView+LookinServer.m in Sources */,\n\t\t\t\tC1D8A55A4355FACAC236D48FBB55B106 /* UITextField+LookinServer.m in Sources */,\n\t\t\t\tE432E79F5333083DA305D61EE51357C6 /* UITextView+LookinServer.m in Sources */,\n\t\t\t\t0B38FBE4A49B85218C8BB54696D057F7 /* UIView+LookinServer.m in Sources */,\n\t\t\t\tFECE5A4ACEDF90AC48C93974E4D14E98 /* UIViewController+LookinServer.m in Sources */,\n\t\t\t\t9AE34167B727AB574413F989BBD79C55 /* UIVisualEffectView+LookinServer.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t0AE2F4FA72B3D9098AB15DB55BBD123D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4F31189115124CC56D0AF2644D76DD43 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 2D1FAE0CBF86AD8A024D1773DEFB7138 /* LookinServer.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/LookinServer/LookinServer-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/LookinServer/LookinServer-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/LookinServer/LookinServer.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = LookinServer;\n\t\t\t\tPRODUCT_NAME = LookinServer;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t65C066F2C67D9C397F800693D050AA79 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t9477D9AEE95C738BAEA920AAF3E4D8A6 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = CC8747E5B43F011547141A5E7D968B8E /* LookinServer.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/LookinServer/LookinServer-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/LookinServer/LookinServer-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/LookinServer/LookinServer.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = LookinServer;\n\t\t\t\tPRODUCT_NAME = LookinServer;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t5BC541B16AE882BD8254D3EA82BA48C0 /* Build configuration list for PBXProject \"LookinServer\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t65C066F2C67D9C397F800693D050AA79 /* Debug */,\n\t\t\t\t0AE2F4FA72B3D9098AB15DB55BBD123D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tA81AC9CE73467B43AFA824E7E87A9E35 /* Build configuration list for PBXNativeTarget \"LookinServer\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4F31189115124CC56D0AF2644D76DD43 /* Debug */,\n\t\t\t\t9477D9AEE95C738BAEA920AAF3E4D8A6 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = EE0D1B414354E75CF24F6A71E4A0DDCD /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/MBProgressHUD/LICENSE",
    "content": "Copyright © 2009-2020 Matej Bukovinski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE."
  },
  {
    "path": "JetChat/Pods/MBProgressHUD/MBProgressHUD.h",
    "content": "//\n//  MBProgressHUD.h\n//  Version 1.2.0\n//  Created by Matej Bukovinski on 2.4.09.\n//\n\n// This code is distributed under the terms and conditions of the MIT license.\n\n// Copyright © 2009-2016 Matej Bukovinski\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n#import <CoreGraphics/CoreGraphics.h>\n\n@class MBBackgroundView;\n@protocol MBProgressHUDDelegate;\n\n\nextern CGFloat const MBProgressMaxOffset;\n\ntypedef NS_ENUM(NSInteger, MBProgressHUDMode) {\n    /// UIActivityIndicatorView.\n    MBProgressHUDModeIndeterminate,\n    /// A round, pie-chart like, progress view.\n    MBProgressHUDModeDeterminate,\n    /// Horizontal progress bar.\n    MBProgressHUDModeDeterminateHorizontalBar,\n    /// Ring-shaped progress view.\n    MBProgressHUDModeAnnularDeterminate,\n    /// Shows a custom view.\n    MBProgressHUDModeCustomView,\n    /// Shows only labels.\n    MBProgressHUDModeText\n};\n\ntypedef NS_ENUM(NSInteger, MBProgressHUDAnimation) {\n    /// Opacity animation\n    MBProgressHUDAnimationFade,\n    /// Opacity + scale animation (zoom in when appearing zoom out when disappearing)\n    MBProgressHUDAnimationZoom,\n    /// Opacity + scale animation (zoom out style)\n    MBProgressHUDAnimationZoomOut,\n    /// Opacity + scale animation (zoom in style)\n    MBProgressHUDAnimationZoomIn\n};\n\ntypedef NS_ENUM(NSInteger, MBProgressHUDBackgroundStyle) {\n    /// Solid color background\n    MBProgressHUDBackgroundStyleSolidColor,\n    /// UIVisualEffectView or UIToolbar.layer background view\n    MBProgressHUDBackgroundStyleBlur\n};\n\ntypedef void (^MBProgressHUDCompletionBlock)(void);\n\n\nNS_ASSUME_NONNULL_BEGIN\n\n\n/**\n * Displays a simple HUD window containing a progress indicator and two optional labels for short messages.\n *\n * This is a simple drop-in class for displaying a progress HUD view similar to Apple's private UIProgressHUD class.\n * The MBProgressHUD window spans over the entire space given to it by the initWithFrame: constructor and catches all\n * user input on this region, thereby preventing the user operations on components below the view.\n *\n * @note To still allow touches to pass through the HUD, you can set hud.userInteractionEnabled = NO.\n * @attention MBProgressHUD is a UI class and should therefore only be accessed on the main thread.\n */\n@interface MBProgressHUD : UIView\n\n/**\n * Creates a new HUD, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:.\n *\n * @note This method sets removeFromSuperViewOnHide. The HUD will automatically be removed from the view hierarchy when hidden.\n *\n * @param view The view that the HUD will be added to\n * @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use\n * animations while appearing.\n * @return A reference to the created HUD.\n *\n * @see hideHUDForView:animated:\n * @see animationType\n */\n+ (instancetype)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;\n\n/// @name Showing and hiding\n\n/**\n * Finds the top-most HUD subview that hasn't finished and hides it. The counterpart to this method is showHUDAddedTo:animated:.\n *\n * @note This method sets removeFromSuperViewOnHide. The HUD will automatically be removed from the view hierarchy when hidden.\n *\n * @param view The view that is going to be searched for a HUD subview.\n * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use\n * animations while disappearing.\n * @return YES if a HUD was found and removed, NO otherwise.\n *\n * @see showHUDAddedTo:animated:\n * @see animationType\n */\n+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;\n\n/**\n * Finds the top-most HUD subview that hasn't finished and returns it.\n *\n * @param view The view that is going to be searched.\n * @return A reference to the last HUD subview discovered.\n */\n+ (nullable MBProgressHUD *)HUDForView:(UIView *)view NS_SWIFT_NAME(forView(_:));\n\n/**\n * A convenience constructor that initializes the HUD with the view's bounds. Calls the designated constructor with\n * view.bounds as the parameter.\n *\n * @param view The view instance that will provide the bounds for the HUD. Should be the same instance as\n * the HUD's superview (i.e., the view that the HUD will be added to).\n */\n- (instancetype)initWithView:(UIView *)view;\n\n/**\n * Displays the HUD.\n *\n * @note You need to make sure that the main thread completes its run loop soon after this method call so that\n * the user interface can be updated. Call this method when your task is already set up to be executed in a new thread\n * (e.g., when using something like NSOperation or making an asynchronous call like NSURLRequest).\n *\n * @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use\n * animations while appearing.\n *\n * @see animationType\n */\n- (void)showAnimated:(BOOL)animated;\n\n/**\n * Hides the HUD. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to\n * hide the HUD when your task completes.\n *\n * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use\n * animations while disappearing.\n *\n * @see animationType\n */\n- (void)hideAnimated:(BOOL)animated;\n\n/**\n * Hides the HUD after a delay. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to\n * hide the HUD when your task completes.\n *\n * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use\n * animations while disappearing.\n * @param delay Delay in seconds until the HUD is hidden.\n *\n * @see animationType\n */\n- (void)hideAnimated:(BOOL)animated afterDelay:(NSTimeInterval)delay;\n\n/**\n * The HUD delegate object. Receives HUD state notifications.\n */\n@property (weak, nonatomic) id<MBProgressHUDDelegate> delegate;\n\n/**\n * Called after the HUD is hidden.\n */\n@property (copy, nullable) MBProgressHUDCompletionBlock completionBlock;\n\n/**\n * Grace period is the time (in seconds) that the invoked method may be run without\n * showing the HUD. If the task finishes before the grace time runs out, the HUD will\n * not be shown at all.\n * This may be used to prevent HUD display for very short tasks.\n * Defaults to 0 (no grace time).\n * @note The graceTime needs to be set before the hud is shown. You thus can't use `showHUDAddedTo:animated:`,\n * but instead need to alloc / init the HUD, configure the grace time and than show it manually.\n */\n@property (assign, nonatomic) NSTimeInterval graceTime;\n\n/**\n * The minimum time (in seconds) that the HUD is shown.\n * This avoids the problem of the HUD being shown and than instantly hidden.\n * Defaults to 0 (no minimum show time).\n */\n@property (assign, nonatomic) NSTimeInterval minShowTime;\n\n/**\n * Removes the HUD from its parent view when hidden.\n * Defaults to NO.\n */\n@property (assign, nonatomic) BOOL removeFromSuperViewOnHide;\n\n/// @name Appearance\n\n/**\n * MBProgressHUD operation mode. The default is MBProgressHUDModeIndeterminate.\n */\n@property (assign, nonatomic) MBProgressHUDMode mode;\n\n/**\n * A color that gets forwarded to all labels and supported indicators. Also sets the tintColor\n * for custom views on iOS 7+. Set to nil to manage color individually.\n * Defaults to semi-translucent black on iOS 7 and later and white on earlier iOS versions.\n */\n@property (strong, nonatomic, nullable) UIColor *contentColor UI_APPEARANCE_SELECTOR;\n\n/**\n * The animation type that should be used when the HUD is shown and hidden.\n */\n@property (assign, nonatomic) MBProgressHUDAnimation animationType UI_APPEARANCE_SELECTOR;\n\n/**\n * The bezel offset relative to the center of the view. You can use MBProgressMaxOffset\n * and -MBProgressMaxOffset to move the HUD all the way to the screen edge in each direction.\n * E.g., CGPointMake(0.f, MBProgressMaxOffset) would position the HUD centered on the bottom edge.\n */\n@property (assign, nonatomic) CGPoint offset UI_APPEARANCE_SELECTOR;\n\n/**\n * The amount of space between the HUD edge and the HUD elements (labels, indicators or custom views).\n * This also represents the minimum bezel distance to the edge of the HUD view.\n * Defaults to 20.f\n */\n@property (assign, nonatomic) CGFloat margin UI_APPEARANCE_SELECTOR;\n\n/**\n * The minimum size of the HUD bezel. Defaults to CGSizeZero (no minimum size).\n */\n@property (assign, nonatomic) CGSize minSize UI_APPEARANCE_SELECTOR;\n\n/**\n * Force the HUD dimensions to be equal if possible.\n */\n@property (assign, nonatomic, getter = isSquare) BOOL square UI_APPEARANCE_SELECTOR;\n\n/**\n * When enabled, the bezel center gets slightly affected by the device accelerometer data.\n * Defaults to NO.\n *\n * @note This can cause main thread checker assertions on certain devices. https://github.com/jdg/MBProgressHUD/issues/552\n */\n@property (assign, nonatomic, getter=areDefaultMotionEffectsEnabled) BOOL defaultMotionEffectsEnabled UI_APPEARANCE_SELECTOR;\n\n/// @name Progress\n\n/**\n * The progress of the progress indicator, from 0.0 to 1.0. Defaults to 0.0.\n */\n@property (assign, nonatomic) float progress;\n\n/// @name ProgressObject\n\n/**\n * The NSProgress object feeding the progress information to the progress indicator.\n */\n@property (strong, nonatomic, nullable) NSProgress *progressObject;\n\n/// @name Views\n\n/**\n * The view containing the labels and indicator (or customView).\n */\n@property (strong, nonatomic, readonly) MBBackgroundView *bezelView;\n\n/**\n * View covering the entire HUD area, placed behind bezelView.\n */\n@property (strong, nonatomic, readonly) MBBackgroundView *backgroundView;\n\n/**\n * The UIView (e.g., a UIImageView) to be shown when the HUD is in MBProgressHUDModeCustomView.\n * The view should implement intrinsicContentSize for proper sizing. For best results use approximately 37 by 37 pixels.\n */\n@property (strong, nonatomic, nullable) UIView *customView;\n\n/**\n * A label that holds an optional short message to be displayed below the activity indicator. The HUD is automatically resized to fit\n * the entire text.\n */\n@property (strong, nonatomic, readonly) UILabel *label;\n\n/**\n * A label that holds an optional details message displayed below the labelText message. The details text can span multiple lines.\n */\n@property (strong, nonatomic, readonly) UILabel *detailsLabel;\n\n/**\n * A button that is placed below the labels. Visible only if a target / action is added and a title is assigned..\n */\n@property (strong, nonatomic, readonly) UIButton *button;\n\n@end\n\n\n@protocol MBProgressHUDDelegate <NSObject>\n\n@optional\n\n/**\n * Called after the HUD was fully hidden from the screen.\n */\n- (void)hudWasHidden:(MBProgressHUD *)hud;\n\n@end\n\n\n/**\n * A progress view for showing definite progress by filling up a circle (pie chart).\n */\n@interface MBRoundProgressView : UIView\n\n/**\n * Progress (0.0 to 1.0)\n */\n@property (nonatomic, assign) float progress;\n\n/**\n * Indicator progress color.\n * Defaults to white [UIColor whiteColor].\n */\n@property (nonatomic, strong) UIColor *progressTintColor;\n\n/**\n * Indicator background (non-progress) color.\n * Only applicable on iOS versions older than iOS 7.\n * Defaults to translucent white (alpha 0.1).\n */\n@property (nonatomic, strong) UIColor *backgroundTintColor;\n\n/*\n * Display mode - NO = round or YES = annular. Defaults to round.\n */\n@property (nonatomic, assign, getter = isAnnular) BOOL annular;\n\n@end\n\n\n/**\n * A flat bar progress view.\n */\n@interface MBBarProgressView : UIView\n\n/**\n * Progress (0.0 to 1.0)\n */\n@property (nonatomic, assign) float progress;\n\n/**\n * Bar border line color.\n * Defaults to white [UIColor whiteColor].\n */\n@property (nonatomic, strong) UIColor *lineColor;\n\n/**\n * Bar background color.\n * Defaults to clear [UIColor clearColor];\n */\n@property (nonatomic, strong) UIColor *progressRemainingColor;\n\n/**\n * Bar progress color.\n * Defaults to white [UIColor whiteColor].\n */\n@property (nonatomic, strong) UIColor *progressColor;\n\n@end\n\n\n@interface MBBackgroundView : UIView\n\n/**\n * The background style.\n * Defaults to MBProgressHUDBackgroundStyleBlur.\n */\n@property (nonatomic) MBProgressHUDBackgroundStyle style;\n\n/**\n * The blur effect style, when using MBProgressHUDBackgroundStyleBlur.\n * Defaults to UIBlurEffectStyleLight.\n */\n@property (nonatomic) UIBlurEffectStyle blurEffectStyle;\n\n/**\n * The background color or the blur tint color.\n *\n * Defaults to nil on iOS 13 and later and\n * `[UIColor colorWithWhite:0.8f alpha:0.6f]`\n * on older systems.\n */\n@property (nonatomic, strong, nullable) UIColor *color;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MBProgressHUD/MBProgressHUD.m",
    "content": "//\n// MBProgressHUD.m\n// Version 1.2.0\n// Created by Matej Bukovinski on 2.4.09.\n//\n\n#import \"MBProgressHUD.h\"\n#import <tgmath.h>\n\n#define MBMainThreadAssert() NSAssert([NSThread isMainThread], @\"MBProgressHUD needs to be accessed on the main thread.\");\n\nCGFloat const MBProgressMaxOffset = 1000000.f;\n\nstatic const CGFloat MBDefaultPadding = 4.f;\nstatic const CGFloat MBDefaultLabelFontSize = 16.f;\nstatic const CGFloat MBDefaultDetailsLabelFontSize = 12.f;\n\n\n@interface MBProgressHUD ()\n\n@property (nonatomic, assign) BOOL useAnimation;\n@property (nonatomic, assign, getter=hasFinished) BOOL finished;\n@property (nonatomic, strong) UIView *indicator;\n@property (nonatomic, strong) NSDate *showStarted;\n@property (nonatomic, strong) NSArray *paddingConstraints;\n@property (nonatomic, strong) NSArray *bezelConstraints;\n@property (nonatomic, strong) UIView *topSpacer;\n@property (nonatomic, strong) UIView *bottomSpacer;\n@property (nonatomic, strong) UIMotionEffectGroup *bezelMotionEffects;\n@property (nonatomic, weak) NSTimer *graceTimer;\n@property (nonatomic, weak) NSTimer *minShowTimer;\n@property (nonatomic, weak) NSTimer *hideDelayTimer;\n@property (nonatomic, weak) CADisplayLink *progressObjectDisplayLink;\n\n@end\n\n\n@interface MBProgressHUDRoundedButton : UIButton\n@end\n\n\n@implementation MBProgressHUD\n\n#pragma mark - Class methods\n\n+ (instancetype)showHUDAddedTo:(UIView *)view animated:(BOOL)animated {\n    MBProgressHUD *hud = [[self alloc] initWithView:view];\n    hud.removeFromSuperViewOnHide = YES;\n    [view addSubview:hud];\n    [hud showAnimated:animated];\n    return hud;\n}\n\n+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated {\n    MBProgressHUD *hud = [self HUDForView:view];\n    if (hud != nil) {\n        hud.removeFromSuperViewOnHide = YES;\n        [hud hideAnimated:animated];\n        return YES;\n    }\n    return NO;\n}\n\n+ (MBProgressHUD *)HUDForView:(UIView *)view {\n    NSEnumerator *subviewsEnum = [view.subviews reverseObjectEnumerator];\n    for (UIView *subview in subviewsEnum) {\n        if ([subview isKindOfClass:self]) {\n            MBProgressHUD *hud = (MBProgressHUD *)subview;\n            if (hud.hasFinished == NO) {\n                return hud;\n            }\n        }\n    }\n    return nil;\n}\n\n#pragma mark - Lifecycle\n\n- (void)commonInit {\n    // Set default values for properties\n    _animationType = MBProgressHUDAnimationFade;\n    _mode = MBProgressHUDModeIndeterminate;\n    _margin = 20.0f;\n    _defaultMotionEffectsEnabled = NO;\n\n    if (@available(iOS 13.0, tvOS 13, *)) {\n       _contentColor = [[UIColor labelColor] colorWithAlphaComponent:0.7f];\n    } else {\n        _contentColor = [UIColor colorWithWhite:0.f alpha:0.7f];\n    }\n\n    // Transparent background\n    self.opaque = NO;\n    self.backgroundColor = [UIColor clearColor];\n    // Make it invisible for now\n    self.alpha = 0.0f;\n    self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n    self.layer.allowsGroupOpacity = NO;\n\n    [self setupViews];\n    [self updateIndicators];\n    [self registerForNotifications];\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if ((self = [super initWithFrame:frame])) {\n        [self commonInit];\n    }\n    return self;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    if ((self = [super initWithCoder:aDecoder])) {\n        [self commonInit];\n    }\n    return self;\n}\n\n- (id)initWithView:(UIView *)view {\n    NSAssert(view, @\"View must not be nil.\");\n    return [self initWithFrame:view.bounds];\n}\n\n- (void)dealloc {\n    [self unregisterFromNotifications];\n}\n\n#pragma mark - Show & hide\n\n- (void)showAnimated:(BOOL)animated {\n    MBMainThreadAssert();\n    [self.minShowTimer invalidate];\n    self.useAnimation = animated;\n    self.finished = NO;\n    // If the grace time is set, postpone the HUD display\n    if (self.graceTime > 0.0) {\n        NSTimer *timer = [NSTimer timerWithTimeInterval:self.graceTime target:self selector:@selector(handleGraceTimer:) userInfo:nil repeats:NO];\n        [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];\n        self.graceTimer = timer;\n    }\n    // ... otherwise show the HUD immediately\n    else {\n        [self showUsingAnimation:self.useAnimation];\n    }\n}\n\n- (void)hideAnimated:(BOOL)animated {\n    MBMainThreadAssert();\n    [self.graceTimer invalidate];\n    self.useAnimation = animated;\n    self.finished = YES;\n    // If the minShow time is set, calculate how long the HUD was shown,\n    // and postpone the hiding operation if necessary\n    if (self.minShowTime > 0.0 && self.showStarted) {\n        NSTimeInterval interv = [[NSDate date] timeIntervalSinceDate:self.showStarted];\n        if (interv < self.minShowTime) {\n            NSTimer *timer = [NSTimer timerWithTimeInterval:(self.minShowTime - interv) target:self selector:@selector(handleMinShowTimer:) userInfo:nil repeats:NO];\n            [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];\n            self.minShowTimer = timer;\n            return;\n        }\n    }\n    // ... otherwise hide the HUD immediately\n    [self hideUsingAnimation:self.useAnimation];\n}\n\n- (void)hideAnimated:(BOOL)animated afterDelay:(NSTimeInterval)delay {\n    // Cancel any scheduled hideAnimated:afterDelay: calls\n    [self.hideDelayTimer invalidate];\n\n    NSTimer *timer = [NSTimer timerWithTimeInterval:delay target:self selector:@selector(handleHideTimer:) userInfo:@(animated) repeats:NO];\n    [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];\n    self.hideDelayTimer = timer;\n}\n\n#pragma mark - Timer callbacks\n\n- (void)handleGraceTimer:(NSTimer *)theTimer {\n    // Show the HUD only if the task is still running\n    if (!self.hasFinished) {\n        [self showUsingAnimation:self.useAnimation];\n    }\n}\n\n- (void)handleMinShowTimer:(NSTimer *)theTimer {\n    [self hideUsingAnimation:self.useAnimation];\n}\n\n- (void)handleHideTimer:(NSTimer *)timer {\n    [self hideAnimated:[timer.userInfo boolValue]];\n}\n\n#pragma mark - View Hierrarchy\n\n- (void)didMoveToSuperview {\n    [self updateForCurrentOrientationAnimated:NO];\n}\n\n#pragma mark - Internal show & hide operations\n\n- (void)showUsingAnimation:(BOOL)animated {\n    // Cancel any previous animations\n    [self.bezelView.layer removeAllAnimations];\n    [self.backgroundView.layer removeAllAnimations];\n\n    // Cancel any scheduled hideAnimated:afterDelay: calls\n    [self.hideDelayTimer invalidate];\n\n    self.showStarted = [NSDate date];\n    self.alpha = 1.f;\n\n    // Needed in case we hide and re-show with the same NSProgress object attached.\n    [self setNSProgressDisplayLinkEnabled:YES];\n\n    // Set up motion effects only at this point to avoid needlessly\n    // creating the effect if it was disabled after initialization.\n    [self updateBezelMotionEffects];\n\n    if (animated) {\n        [self animateIn:YES withType:self.animationType completion:NULL];\n    } else {\n        self.bezelView.alpha = 1.f;\n        self.backgroundView.alpha = 1.f;\n    }\n}\n\n- (void)hideUsingAnimation:(BOOL)animated {\n    // Cancel any scheduled hideAnimated:afterDelay: calls.\n    // This needs to happen here instead of in done,\n    // to avoid races if another hideAnimated:afterDelay:\n    // call comes in while the HUD is animating out.\n    [self.hideDelayTimer invalidate];\n\n    if (animated && self.showStarted) {\n        self.showStarted = nil;\n        [self animateIn:NO withType:self.animationType completion:^(BOOL finished) {\n            [self done];\n        }];\n    } else {\n        self.showStarted = nil;\n        self.bezelView.alpha = 0.f;\n        self.backgroundView.alpha = 1.f;\n        [self done];\n    }\n}\n\n- (void)animateIn:(BOOL)animatingIn withType:(MBProgressHUDAnimation)type completion:(void(^)(BOOL finished))completion {\n    // Automatically determine the correct zoom animation type\n    if (type == MBProgressHUDAnimationZoom) {\n        type = animatingIn ? MBProgressHUDAnimationZoomIn : MBProgressHUDAnimationZoomOut;\n    }\n\n    CGAffineTransform small = CGAffineTransformMakeScale(0.5f, 0.5f);\n    CGAffineTransform large = CGAffineTransformMakeScale(1.5f, 1.5f);\n\n    // Set starting state\n    UIView *bezelView = self.bezelView;\n    if (animatingIn && bezelView.alpha == 0.f && type == MBProgressHUDAnimationZoomIn) {\n        bezelView.transform = small;\n    } else if (animatingIn && bezelView.alpha == 0.f && type == MBProgressHUDAnimationZoomOut) {\n        bezelView.transform = large;\n    }\n\n    // Perform animations\n    dispatch_block_t animations = ^{\n        if (animatingIn) {\n            bezelView.transform = CGAffineTransformIdentity;\n        } else if (!animatingIn && type == MBProgressHUDAnimationZoomIn) {\n            bezelView.transform = large;\n        } else if (!animatingIn && type == MBProgressHUDAnimationZoomOut) {\n            bezelView.transform = small;\n        }\n        CGFloat alpha = animatingIn ? 1.f : 0.f;\n        bezelView.alpha = alpha;\n        self.backgroundView.alpha = alpha;\n    };\n    [UIView animateWithDuration:0.3 delay:0. usingSpringWithDamping:1.f initialSpringVelocity:0.f options:UIViewAnimationOptionBeginFromCurrentState animations:animations completion:completion];\n}\n\n- (void)done {\n    [self setNSProgressDisplayLinkEnabled:NO];\n\n    if (self.hasFinished) {\n        self.alpha = 0.0f;\n        if (self.removeFromSuperViewOnHide) {\n            [self removeFromSuperview];\n        }\n    }\n    MBProgressHUDCompletionBlock completionBlock = self.completionBlock;\n    if (completionBlock) {\n        completionBlock();\n    }\n    id<MBProgressHUDDelegate> delegate = self.delegate;\n    if ([delegate respondsToSelector:@selector(hudWasHidden:)]) {\n        [delegate performSelector:@selector(hudWasHidden:) withObject:self];\n    }\n}\n\n#pragma mark - UI\n\n- (void)setupViews {\n    UIColor *defaultColor = self.contentColor;\n\n    MBBackgroundView *backgroundView = [[MBBackgroundView alloc] initWithFrame:self.bounds];\n    backgroundView.style = MBProgressHUDBackgroundStyleSolidColor;\n    backgroundView.backgroundColor = [UIColor clearColor];\n    backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n    backgroundView.alpha = 0.f;\n    [self addSubview:backgroundView];\n    _backgroundView = backgroundView;\n\n    MBBackgroundView *bezelView = [MBBackgroundView new];\n    bezelView.translatesAutoresizingMaskIntoConstraints = NO;\n    bezelView.layer.cornerRadius = 5.f;\n    bezelView.alpha = 0.f;\n    [self addSubview:bezelView];\n    _bezelView = bezelView;\n\n    UILabel *label = [UILabel new];\n    label.adjustsFontSizeToFitWidth = NO;\n    label.textAlignment = NSTextAlignmentCenter;\n    label.textColor = defaultColor;\n    label.font = [UIFont boldSystemFontOfSize:MBDefaultLabelFontSize];\n    label.opaque = NO;\n    label.backgroundColor = [UIColor clearColor];\n    _label = label;\n\n    UILabel *detailsLabel = [UILabel new];\n    detailsLabel.adjustsFontSizeToFitWidth = NO;\n    detailsLabel.textAlignment = NSTextAlignmentCenter;\n    detailsLabel.textColor = defaultColor;\n    detailsLabel.numberOfLines = 0;\n    detailsLabel.font = [UIFont boldSystemFontOfSize:MBDefaultDetailsLabelFontSize];\n    detailsLabel.opaque = NO;\n    detailsLabel.backgroundColor = [UIColor clearColor];\n    _detailsLabel = detailsLabel;\n\n    UIButton *button = [MBProgressHUDRoundedButton buttonWithType:UIButtonTypeCustom];\n    button.titleLabel.textAlignment = NSTextAlignmentCenter;\n    button.titleLabel.font = [UIFont boldSystemFontOfSize:MBDefaultDetailsLabelFontSize];\n    [button setTitleColor:defaultColor forState:UIControlStateNormal];\n    _button = button;\n\n    for (UIView *view in @[label, detailsLabel, button]) {\n        view.translatesAutoresizingMaskIntoConstraints = NO;\n        [view setContentCompressionResistancePriority:998.f forAxis:UILayoutConstraintAxisHorizontal];\n        [view setContentCompressionResistancePriority:998.f forAxis:UILayoutConstraintAxisVertical];\n        [bezelView addSubview:view];\n    }\n\n    UIView *topSpacer = [UIView new];\n    topSpacer.translatesAutoresizingMaskIntoConstraints = NO;\n    topSpacer.hidden = YES;\n    [bezelView addSubview:topSpacer];\n    _topSpacer = topSpacer;\n\n    UIView *bottomSpacer = [UIView new];\n    bottomSpacer.translatesAutoresizingMaskIntoConstraints = NO;\n    bottomSpacer.hidden = YES;\n    [bezelView addSubview:bottomSpacer];\n    _bottomSpacer = bottomSpacer;\n}\n\n- (void)updateIndicators {\n    UIView *indicator = self.indicator;\n    BOOL isActivityIndicator = [indicator isKindOfClass:[UIActivityIndicatorView class]];\n    BOOL isRoundIndicator = [indicator isKindOfClass:[MBRoundProgressView class]];\n\n    MBProgressHUDMode mode = self.mode;\n    if (mode == MBProgressHUDModeIndeterminate) {\n        if (!isActivityIndicator) {\n            // Update to indeterminate indicator\n            UIActivityIndicatorView *activityIndicator;\n            [indicator removeFromSuperview];\n#if !TARGET_OS_MACCATALYST\n            if (@available(iOS 13.0, tvOS 13.0, *)) {\n#endif\n                activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];\n                activityIndicator.color = [UIColor whiteColor];\n#if !TARGET_OS_MACCATALYST\n            } else {\n               activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];\n            }\n#endif\n            [activityIndicator startAnimating];\n            indicator = activityIndicator;\n            [self.bezelView addSubview:indicator];\n        }\n    }\n    else if (mode == MBProgressHUDModeDeterminateHorizontalBar) {\n        // Update to bar determinate indicator\n        [indicator removeFromSuperview];\n        indicator = [[MBBarProgressView alloc] init];\n        [self.bezelView addSubview:indicator];\n    }\n    else if (mode == MBProgressHUDModeDeterminate || mode == MBProgressHUDModeAnnularDeterminate) {\n        if (!isRoundIndicator) {\n            // Update to determinante indicator\n            [indicator removeFromSuperview];\n            indicator = [[MBRoundProgressView alloc] init];\n            [self.bezelView addSubview:indicator];\n        }\n        if (mode == MBProgressHUDModeAnnularDeterminate) {\n            [(MBRoundProgressView *)indicator setAnnular:YES];\n        }\n    }\n    else if (mode == MBProgressHUDModeCustomView && self.customView != indicator) {\n        // Update custom view indicator\n        [indicator removeFromSuperview];\n        indicator = self.customView;\n        [self.bezelView addSubview:indicator];\n    }\n    else if (mode == MBProgressHUDModeText) {\n        [indicator removeFromSuperview];\n        indicator = nil;\n    }\n    indicator.translatesAutoresizingMaskIntoConstraints = NO;\n    self.indicator = indicator;\n\n    if ([indicator respondsToSelector:@selector(setProgress:)]) {\n        [(id)indicator setValue:@(self.progress) forKey:@\"progress\"];\n    }\n\n    [indicator setContentCompressionResistancePriority:998.f forAxis:UILayoutConstraintAxisHorizontal];\n    [indicator setContentCompressionResistancePriority:998.f forAxis:UILayoutConstraintAxisVertical];\n\n    [self updateViewsForColor:self.contentColor];\n    [self setNeedsUpdateConstraints];\n}\n\n- (void)updateViewsForColor:(UIColor *)color {\n    if (!color) return;\n\n    self.label.textColor = color;\n    self.detailsLabel.textColor = color;\n    [self.button setTitleColor:color forState:UIControlStateNormal];\n\n    // UIAppearance settings are prioritized. If they are preset the set color is ignored.\n\n    UIView *indicator = self.indicator;\n    if ([indicator isKindOfClass:[UIActivityIndicatorView class]]) {\n        UIActivityIndicatorView *appearance = nil;\n#if __IPHONE_OS_VERSION_MIN_REQUIRED < 90000\n        appearance = [UIActivityIndicatorView appearanceWhenContainedIn:[MBProgressHUD class], nil];\n#else\n        // For iOS 9+\n        appearance = [UIActivityIndicatorView appearanceWhenContainedInInstancesOfClasses:@[[MBProgressHUD class]]];\n#endif\n\n        if (appearance.color == nil) {\n            ((UIActivityIndicatorView *)indicator).color = color;\n        }\n    } else if ([indicator isKindOfClass:[MBRoundProgressView class]]) {\n        MBRoundProgressView *appearance = nil;\n#if __IPHONE_OS_VERSION_MIN_REQUIRED < 90000\n        appearance = [MBRoundProgressView appearanceWhenContainedIn:[MBProgressHUD class], nil];\n#else\n        appearance = [MBRoundProgressView appearanceWhenContainedInInstancesOfClasses:@[[MBProgressHUD class]]];\n#endif\n        if (appearance.progressTintColor == nil) {\n            ((MBRoundProgressView *)indicator).progressTintColor = color;\n        }\n        if (appearance.backgroundTintColor == nil) {\n            ((MBRoundProgressView *)indicator).backgroundTintColor = [color colorWithAlphaComponent:0.1];\n        }\n    } else if ([indicator isKindOfClass:[MBBarProgressView class]]) {\n        MBBarProgressView *appearance = nil;\n#if __IPHONE_OS_VERSION_MIN_REQUIRED < 90000\n        appearance = [MBBarProgressView appearanceWhenContainedIn:[MBProgressHUD class], nil];\n#else\n        appearance = [MBBarProgressView appearanceWhenContainedInInstancesOfClasses:@[[MBProgressHUD class]]];\n#endif\n        if (appearance.progressColor == nil) {\n            ((MBBarProgressView *)indicator).progressColor = color;\n        }\n        if (appearance.lineColor == nil) {\n            ((MBBarProgressView *)indicator).lineColor = color;\n        }\n    } else {\n        [indicator setTintColor:color];\n    }\n}\n\n- (void)updateBezelMotionEffects {\n    MBBackgroundView *bezelView = self.bezelView;\n    UIMotionEffectGroup *bezelMotionEffects = self.bezelMotionEffects;\n\n    if (self.defaultMotionEffectsEnabled && !bezelMotionEffects) {\n        CGFloat effectOffset = 10.f;\n        UIInterpolatingMotionEffect *effectX = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@\"center.x\" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];\n        effectX.maximumRelativeValue = @(effectOffset);\n        effectX.minimumRelativeValue = @(-effectOffset);\n\n        UIInterpolatingMotionEffect *effectY = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@\"center.y\" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];\n        effectY.maximumRelativeValue = @(effectOffset);\n        effectY.minimumRelativeValue = @(-effectOffset);\n\n        UIMotionEffectGroup *group = [[UIMotionEffectGroup alloc] init];\n        group.motionEffects = @[effectX, effectY];\n\n        self.bezelMotionEffects = group;\n        [bezelView addMotionEffect:group];\n    } else if (bezelMotionEffects) {\n        self.bezelMotionEffects = nil;\n        [bezelView removeMotionEffect:bezelMotionEffects];\n    }\n}\n\n#pragma mark - Layout\n\n- (void)updateConstraints {\n    UIView *bezel = self.bezelView;\n    UIView *topSpacer = self.topSpacer;\n    UIView *bottomSpacer = self.bottomSpacer;\n    CGFloat margin = self.margin;\n    NSMutableArray *bezelConstraints = [NSMutableArray array];\n    NSDictionary *metrics = @{@\"margin\": @(margin)};\n\n    NSMutableArray *subviews = [NSMutableArray arrayWithObjects:self.topSpacer, self.label, self.detailsLabel, self.button, self.bottomSpacer, nil];\n    if (self.indicator) [subviews insertObject:self.indicator atIndex:1];\n\n    // Remove existing constraints\n    [self removeConstraints:self.constraints];\n    [topSpacer removeConstraints:topSpacer.constraints];\n    [bottomSpacer removeConstraints:bottomSpacer.constraints];\n    if (self.bezelConstraints) {\n        [bezel removeConstraints:self.bezelConstraints];\n        self.bezelConstraints = nil;\n    }\n\n    // Center bezel in container (self), applying the offset if set\n    CGPoint offset = self.offset;\n    NSMutableArray *centeringConstraints = [NSMutableArray array];\n    [centeringConstraints addObject:[NSLayoutConstraint constraintWithItem:bezel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.f constant:offset.x]];\n    [centeringConstraints addObject:[NSLayoutConstraint constraintWithItem:bezel attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.f constant:offset.y]];\n    [self applyPriority:998.f toConstraints:centeringConstraints];\n    [self addConstraints:centeringConstraints];\n\n    // Ensure minimum side margin is kept\n    NSMutableArray *sideConstraints = [NSMutableArray array];\n    [sideConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@\"|-(>=margin)-[bezel]-(>=margin)-|\" options:0 metrics:metrics views:NSDictionaryOfVariableBindings(bezel)]];\n    [sideConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@\"V:|-(>=margin)-[bezel]-(>=margin)-|\" options:0 metrics:metrics views:NSDictionaryOfVariableBindings(bezel)]];\n    [self applyPriority:999.f toConstraints:sideConstraints];\n    [self addConstraints:sideConstraints];\n\n    // Minimum bezel size, if set\n    CGSize minimumSize = self.minSize;\n    if (!CGSizeEqualToSize(minimumSize, CGSizeZero)) {\n        NSMutableArray *minSizeConstraints = [NSMutableArray array];\n        [minSizeConstraints addObject:[NSLayoutConstraint constraintWithItem:bezel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:minimumSize.width]];\n        [minSizeConstraints addObject:[NSLayoutConstraint constraintWithItem:bezel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:minimumSize.height]];\n        [self applyPriority:997.f toConstraints:minSizeConstraints];\n        [bezelConstraints addObjectsFromArray:minSizeConstraints];\n    }\n\n    // Square aspect ratio, if set\n    if (self.square) {\n        NSLayoutConstraint *square = [NSLayoutConstraint constraintWithItem:bezel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:bezel attribute:NSLayoutAttributeWidth multiplier:1.f constant:0];\n        square.priority = 997.f;\n        [bezelConstraints addObject:square];\n    }\n\n    // Top and bottom spacing\n    [topSpacer addConstraint:[NSLayoutConstraint constraintWithItem:topSpacer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:margin]];\n    [bottomSpacer addConstraint:[NSLayoutConstraint constraintWithItem:bottomSpacer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:margin]];\n    // Top and bottom spaces should be equal\n    [bezelConstraints addObject:[NSLayoutConstraint constraintWithItem:topSpacer attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:bottomSpacer attribute:NSLayoutAttributeHeight multiplier:1.f constant:0.f]];\n\n    // Layout subviews in bezel\n    NSMutableArray *paddingConstraints = [NSMutableArray new];\n    [subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {\n        // Center in bezel\n        [bezelConstraints addObject:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:bezel attribute:NSLayoutAttributeCenterX multiplier:1.f constant:0.f]];\n        // Ensure the minimum edge margin is kept\n        [bezelConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@\"|-(>=margin)-[view]-(>=margin)-|\" options:0 metrics:metrics views:NSDictionaryOfVariableBindings(view)]];\n        // Element spacing\n        if (idx == 0) {\n            // First, ensure spacing to bezel edge\n            [bezelConstraints addObject:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:bezel attribute:NSLayoutAttributeTop multiplier:1.f constant:0.f]];\n        } else if (idx == subviews.count - 1) {\n            // Last, ensure spacing to bezel edge\n            [bezelConstraints addObject:[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:bezel attribute:NSLayoutAttributeBottom multiplier:1.f constant:0.f]];\n        }\n        if (idx > 0) {\n            // Has previous\n            NSLayoutConstraint *padding = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:subviews[idx - 1] attribute:NSLayoutAttributeBottom multiplier:1.f constant:0.f];\n            [bezelConstraints addObject:padding];\n            [paddingConstraints addObject:padding];\n        }\n    }];\n\n    [bezel addConstraints:bezelConstraints];\n    self.bezelConstraints = bezelConstraints;\n\n    self.paddingConstraints = [paddingConstraints copy];\n    [self updatePaddingConstraints];\n\n    [super updateConstraints];\n}\n\n- (void)layoutSubviews {\n    // There is no need to update constraints if they are going to\n    // be recreated in [super layoutSubviews] due to needsUpdateConstraints being set.\n    // This also avoids an issue on iOS 8, where updatePaddingConstraints\n    // would trigger a zombie object access.\n    if (!self.needsUpdateConstraints) {\n        [self updatePaddingConstraints];\n    }\n    [super layoutSubviews];\n}\n\n- (void)updatePaddingConstraints {\n    // Set padding dynamically, depending on whether the view is visible or not\n    __block BOOL hasVisibleAncestors = NO;\n    [self.paddingConstraints enumerateObjectsUsingBlock:^(NSLayoutConstraint *padding, NSUInteger idx, BOOL *stop) {\n        UIView *firstView = (UIView *)padding.firstItem;\n        UIView *secondView = (UIView *)padding.secondItem;\n        BOOL firstVisible = !firstView.hidden && !CGSizeEqualToSize(firstView.intrinsicContentSize, CGSizeZero);\n        BOOL secondVisible = !secondView.hidden && !CGSizeEqualToSize(secondView.intrinsicContentSize, CGSizeZero);\n        // Set if both views are visible or if there's a visible view on top that doesn't have padding\n        // added relative to the current view yet\n        padding.constant = (firstVisible && (secondVisible || hasVisibleAncestors)) ? MBDefaultPadding : 0.f;\n        hasVisibleAncestors |= secondVisible;\n    }];\n}\n\n- (void)applyPriority:(UILayoutPriority)priority toConstraints:(NSArray *)constraints {\n    for (NSLayoutConstraint *constraint in constraints) {\n        constraint.priority = priority;\n    }\n}\n\n#pragma mark - Properties\n\n- (void)setMode:(MBProgressHUDMode)mode {\n    if (mode != _mode) {\n        _mode = mode;\n        [self updateIndicators];\n    }\n}\n\n- (void)setCustomView:(UIView *)customView {\n    if (customView != _customView) {\n        _customView = customView;\n        if (self.mode == MBProgressHUDModeCustomView) {\n            [self updateIndicators];\n        }\n    }\n}\n\n- (void)setOffset:(CGPoint)offset {\n    if (!CGPointEqualToPoint(offset, _offset)) {\n        _offset = offset;\n        [self setNeedsUpdateConstraints];\n    }\n}\n\n- (void)setMargin:(CGFloat)margin {\n    if (margin != _margin) {\n        _margin = margin;\n        [self setNeedsUpdateConstraints];\n    }\n}\n\n- (void)setMinSize:(CGSize)minSize {\n    if (!CGSizeEqualToSize(minSize, _minSize)) {\n        _minSize = minSize;\n        [self setNeedsUpdateConstraints];\n    }\n}\n\n- (void)setSquare:(BOOL)square {\n    if (square != _square) {\n        _square = square;\n        [self setNeedsUpdateConstraints];\n    }\n}\n\n- (void)setProgressObjectDisplayLink:(CADisplayLink *)progressObjectDisplayLink {\n    if (progressObjectDisplayLink != _progressObjectDisplayLink) {\n        [_progressObjectDisplayLink invalidate];\n\n        _progressObjectDisplayLink = progressObjectDisplayLink;\n\n        [_progressObjectDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];\n    }\n}\n\n- (void)setProgressObject:(NSProgress *)progressObject {\n    if (progressObject != _progressObject) {\n        _progressObject = progressObject;\n        [self setNSProgressDisplayLinkEnabled:YES];\n    }\n}\n\n- (void)setProgress:(float)progress {\n    if (progress != _progress) {\n        _progress = progress;\n        UIView *indicator = self.indicator;\n        if ([indicator respondsToSelector:@selector(setProgress:)]) {\n            [(id)indicator setValue:@(self.progress) forKey:@\"progress\"];\n        }\n    }\n}\n\n- (void)setContentColor:(UIColor *)contentColor {\n    if (contentColor != _contentColor && ![contentColor isEqual:_contentColor]) {\n        _contentColor = contentColor;\n        [self updateViewsForColor:contentColor];\n    }\n}\n\n- (void)setDefaultMotionEffectsEnabled:(BOOL)defaultMotionEffectsEnabled {\n    if (defaultMotionEffectsEnabled != _defaultMotionEffectsEnabled) {\n        _defaultMotionEffectsEnabled = defaultMotionEffectsEnabled;\n        [self updateBezelMotionEffects];\n    }\n}\n\n#pragma mark - NSProgress\n\n- (void)setNSProgressDisplayLinkEnabled:(BOOL)enabled {\n    // We're using CADisplayLink, because NSProgress can change very quickly and observing it may starve the main thread,\n    // so we're refreshing the progress only every frame draw\n    if (enabled && self.progressObject) {\n        // Only create if not already active.\n        if (!self.progressObjectDisplayLink) {\n            self.progressObjectDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(updateProgressFromProgressObject)];\n        }\n    } else {\n        self.progressObjectDisplayLink = nil;\n    }\n}\n\n- (void)updateProgressFromProgressObject {\n    self.progress = self.progressObject.fractionCompleted;\n}\n\n#pragma mark - Notifications\n\n- (void)registerForNotifications {\n#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST\n    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];\n\n    [nc addObserver:self selector:@selector(statusBarOrientationDidChange:)\n               name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];\n#endif\n}\n\n- (void)unregisterFromNotifications {\n#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST\n    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];\n    [nc removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];\n#endif\n}\n\n#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST\n- (void)statusBarOrientationDidChange:(NSNotification *)notification {\n    UIView *superview = self.superview;\n    if (!superview) {\n        return;\n    } else {\n        [self updateForCurrentOrientationAnimated:YES];\n    }\n}\n#endif\n\n- (void)updateForCurrentOrientationAnimated:(BOOL)animated {\n    // Stay in sync with the superview in any case\n    if (self.superview) {\n        self.frame = self.superview.bounds;\n    }\n\n    // Not needed on iOS 8+, compile out when the deployment target allows,\n    // to avoid sharedApplication problems on extension targets\n#if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000\n    // Only needed pre iOS 8 when added to a window\n    BOOL iOS8OrLater = kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0;\n    if (iOS8OrLater || ![self.superview isKindOfClass:[UIWindow class]]) return;\n\n    // Make extension friendly. Will not get called on extensions (iOS 8+) due to the above check.\n    // This just ensures we don't get a warning about extension-unsafe API.\n    Class UIApplicationClass = NSClassFromString(@\"UIApplication\");\n    if (!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) return;\n\n    UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)];\n    UIInterfaceOrientation orientation = application.statusBarOrientation;\n    CGFloat radians = 0;\n\n    if (UIInterfaceOrientationIsLandscape(orientation)) {\n        radians = orientation == UIInterfaceOrientationLandscapeLeft ? -(CGFloat)M_PI_2 : (CGFloat)M_PI_2;\n        // Window coordinates differ!\n        self.bounds = CGRectMake(0, 0, self.bounds.size.height, self.bounds.size.width);\n    } else {\n        radians = orientation == UIInterfaceOrientationPortraitUpsideDown ? (CGFloat)M_PI : 0.f;\n    }\n\n    if (animated) {\n        [UIView animateWithDuration:0.3 animations:^{\n            self.transform = CGAffineTransformMakeRotation(radians);\n        }];\n    } else {\n        self.transform = CGAffineTransformMakeRotation(radians);\n    }\n#endif\n}\n\n@end\n\n\n@implementation MBRoundProgressView\n\n#pragma mark - Lifecycle\n\n- (id)init {\n    return [self initWithFrame:CGRectMake(0.f, 0.f, 37.f, 37.f)];\n}\n\n- (id)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        self.backgroundColor = [UIColor clearColor];\n        self.opaque = NO;\n        _progress = 0.f;\n        _annular = NO;\n        _progressTintColor = [[UIColor alloc] initWithWhite:1.f alpha:1.f];\n        _backgroundTintColor = [[UIColor alloc] initWithWhite:1.f alpha:.1f];\n    }\n    return self;\n}\n\n#pragma mark - Layout\n\n- (CGSize)intrinsicContentSize {\n    return CGSizeMake(37.f, 37.f);\n}\n\n#pragma mark - Properties\n\n- (void)setProgress:(float)progress {\n    if (progress != _progress) {\n        _progress = progress;\n        [self setNeedsDisplay];\n    }\n}\n\n- (void)setProgressTintColor:(UIColor *)progressTintColor {\n    NSAssert(progressTintColor, @\"The color should not be nil.\");\n    if (progressTintColor != _progressTintColor && ![progressTintColor isEqual:_progressTintColor]) {\n        _progressTintColor = progressTintColor;\n        [self setNeedsDisplay];\n    }\n}\n\n- (void)setBackgroundTintColor:(UIColor *)backgroundTintColor {\n    NSAssert(backgroundTintColor, @\"The color should not be nil.\");\n    if (backgroundTintColor != _backgroundTintColor && ![backgroundTintColor isEqual:_backgroundTintColor]) {\n        _backgroundTintColor = backgroundTintColor;\n        [self setNeedsDisplay];\n    }\n}\n\n#pragma mark - Drawing\n\n- (void)drawRect:(CGRect)rect {\n    CGContextRef context = UIGraphicsGetCurrentContext();\n\n    if (_annular) {\n        // Draw background\n        CGFloat lineWidth = 2.f;\n        UIBezierPath *processBackgroundPath = [UIBezierPath bezierPath];\n        processBackgroundPath.lineWidth = lineWidth;\n        processBackgroundPath.lineCapStyle = kCGLineCapButt;\n        CGPoint center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));\n        CGFloat radius = (self.bounds.size.width - lineWidth)/2;\n        CGFloat startAngle = - ((float)M_PI / 2); // 90 degrees\n        CGFloat endAngle = (2 * (float)M_PI) + startAngle;\n        [processBackgroundPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];\n        [_backgroundTintColor set];\n        [processBackgroundPath stroke];\n        // Draw progress\n        UIBezierPath *processPath = [UIBezierPath bezierPath];\n        processPath.lineCapStyle = kCGLineCapSquare;\n        processPath.lineWidth = lineWidth;\n        endAngle = (self.progress * 2 * (float)M_PI) + startAngle;\n        [processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];\n        [_progressTintColor set];\n        [processPath stroke];\n    } else {\n        // Draw background\n        CGFloat lineWidth = 2.f;\n        CGRect allRect = self.bounds;\n        CGRect circleRect = CGRectInset(allRect, lineWidth/2.f, lineWidth/2.f);\n        CGPoint center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));\n        [_progressTintColor setStroke];\n        [_backgroundTintColor setFill];\n        CGContextSetLineWidth(context, lineWidth);\n        CGContextStrokeEllipseInRect(context, circleRect);\n        // 90 degrees\n        CGFloat startAngle = - ((float)M_PI / 2.f);\n        // Draw progress\n        UIBezierPath *processPath = [UIBezierPath bezierPath];\n        processPath.lineCapStyle = kCGLineCapButt;\n        processPath.lineWidth = lineWidth * 2.f;\n        CGFloat radius = (CGRectGetWidth(self.bounds) / 2.f) - (processPath.lineWidth / 2.f);\n        CGFloat endAngle = (self.progress * 2.f * (float)M_PI) + startAngle;\n        [processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];\n        // Ensure that we don't get color overlapping when _progressTintColor alpha < 1.f.\n        CGContextSetBlendMode(context, kCGBlendModeCopy);\n        [_progressTintColor set];\n        [processPath stroke];\n    }\n}\n\n@end\n\n\n@implementation MBBarProgressView\n\n#pragma mark - Lifecycle\n\n- (id)init {\n    return [self initWithFrame:CGRectMake(.0f, .0f, 120.0f, 20.0f)];\n}\n\n- (id)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        _progress = 0.f;\n        _lineColor = [UIColor whiteColor];\n        _progressColor = [UIColor whiteColor];\n        _progressRemainingColor = [UIColor clearColor];\n        self.backgroundColor = [UIColor clearColor];\n        self.opaque = NO;\n    }\n    return self;\n}\n\n#pragma mark - Layout\n\n- (CGSize)intrinsicContentSize {\n    return CGSizeMake(120.f, 10.f);\n}\n\n#pragma mark - Properties\n\n- (void)setProgress:(float)progress {\n    if (progress != _progress) {\n        _progress = progress;\n        [self setNeedsDisplay];\n    }\n}\n\n- (void)setProgressColor:(UIColor *)progressColor {\n    NSAssert(progressColor, @\"The color should not be nil.\");\n    if (progressColor != _progressColor && ![progressColor isEqual:_progressColor]) {\n        _progressColor = progressColor;\n        [self setNeedsDisplay];\n    }\n}\n\n- (void)setProgressRemainingColor:(UIColor *)progressRemainingColor {\n    NSAssert(progressRemainingColor, @\"The color should not be nil.\");\n    if (progressRemainingColor != _progressRemainingColor && ![progressRemainingColor isEqual:_progressRemainingColor]) {\n        _progressRemainingColor = progressRemainingColor;\n        [self setNeedsDisplay];\n    }\n}\n\n#pragma mark - Drawing\n\n- (void)drawRect:(CGRect)rect {\n    CGContextRef context = UIGraphicsGetCurrentContext();\n\n    CGContextSetLineWidth(context, 2);\n    CGContextSetStrokeColorWithColor(context,[_lineColor CGColor]);\n    CGContextSetFillColorWithColor(context, [_progressRemainingColor CGColor]);\n\n    // Draw background and Border\n    CGFloat radius = (rect.size.height / 2) - 2;\n    CGContextMoveToPoint(context, 2, rect.size.height/2);\n    CGContextAddArcToPoint(context, 2, 2, radius + 2, 2, radius);\n    CGContextAddArcToPoint(context, rect.size.width - 2, 2, rect.size.width - 2, rect.size.height / 2, radius);\n    CGContextAddArcToPoint(context, rect.size.width - 2, rect.size.height - 2, rect.size.width - radius - 2, rect.size.height - 2, radius);\n    CGContextAddArcToPoint(context, 2, rect.size.height - 2, 2, rect.size.height/2, radius);\n    CGContextDrawPath(context, kCGPathFillStroke);\n\n    CGContextSetFillColorWithColor(context, [_progressColor CGColor]);\n    radius = radius - 2;\n    CGFloat amount = self.progress * rect.size.width;\n\n    // Progress in the middle area\n    if (amount >= radius + 4 && amount <= (rect.size.width - radius - 4)) {\n        CGContextMoveToPoint(context, 4, rect.size.height/2);\n        CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius);\n        CGContextAddLineToPoint(context, amount, 4);\n        CGContextAddLineToPoint(context, amount, radius + 4);\n\n        CGContextMoveToPoint(context, 4, rect.size.height/2);\n        CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);\n        CGContextAddLineToPoint(context, amount, rect.size.height - 4);\n        CGContextAddLineToPoint(context, amount, radius + 4);\n\n        CGContextFillPath(context);\n    }\n\n    // Progress in the right arc\n    else if (amount > radius + 4) {\n        CGFloat x = amount - (rect.size.width - radius - 4);\n\n        CGContextMoveToPoint(context, 4, rect.size.height/2);\n        CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius);\n        CGContextAddLineToPoint(context, rect.size.width - radius - 4, 4);\n        CGFloat angle = -acos(x/radius);\n        if (isnan(angle)) angle = 0;\n        CGContextAddArc(context, rect.size.width - radius - 4, rect.size.height/2, radius, M_PI, angle, 0);\n        CGContextAddLineToPoint(context, amount, rect.size.height/2);\n\n        CGContextMoveToPoint(context, 4, rect.size.height/2);\n        CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);\n        CGContextAddLineToPoint(context, rect.size.width - radius - 4, rect.size.height - 4);\n        angle = acos(x/radius);\n        if (isnan(angle)) angle = 0;\n        CGContextAddArc(context, rect.size.width - radius - 4, rect.size.height/2, radius, -M_PI, angle, 1);\n        CGContextAddLineToPoint(context, amount, rect.size.height/2);\n\n        CGContextFillPath(context);\n    }\n\n    // Progress is in the left arc\n    else if (amount < radius + 4 && amount > 0) {\n        CGContextMoveToPoint(context, 4, rect.size.height/2);\n        CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius);\n        CGContextAddLineToPoint(context, radius + 4, rect.size.height/2);\n\n        CGContextMoveToPoint(context, 4, rect.size.height/2);\n        CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);\n        CGContextAddLineToPoint(context, radius + 4, rect.size.height/2);\n\n        CGContextFillPath(context);\n    }\n}\n\n@end\n\n\n@interface MBBackgroundView ()\n\n@property UIVisualEffectView *effectView;\n\n@end\n\n\n@implementation MBBackgroundView\n\n#pragma mark - Lifecycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    if ((self = [super initWithFrame:frame])) {\n        _style = MBProgressHUDBackgroundStyleBlur;\n        if (@available(iOS 13.0, *)) {\n            #if TARGET_OS_TV\n            _blurEffectStyle = UIBlurEffectStyleRegular;\n            #else\n            _blurEffectStyle = UIBlurEffectStyleSystemThickMaterial;\n            #endif\n            // Leaving the color unassigned yields best results.\n        } else {\n            _blurEffectStyle = UIBlurEffectStyleLight;\n            _color = [UIColor colorWithWhite:0.8f alpha:0.6f];\n        }\n\n        self.clipsToBounds = YES;\n\n        [self updateForBackgroundStyle];\n    }\n    return self;\n}\n\n#pragma mark - Layout\n\n- (CGSize)intrinsicContentSize {\n    // Smallest size possible. Content pushes against this.\n    return CGSizeZero;\n}\n\n#pragma mark - Appearance\n\n- (void)setStyle:(MBProgressHUDBackgroundStyle)style {\n    if (_style != style) {\n        _style = style;\n        [self updateForBackgroundStyle];\n    }\n}\n\n- (void)setColor:(UIColor *)color {\n    NSAssert(color, @\"The color should not be nil.\");\n    if (color != _color && ![color isEqual:_color]) {\n        _color = color;\n        [self updateViewsForColor:color];\n    }\n}\n\n- (void)setBlurEffectStyle:(UIBlurEffectStyle)blurEffectStyle {\n    if (_blurEffectStyle == blurEffectStyle) {\n        return;\n    }\n\n    _blurEffectStyle = blurEffectStyle;\n\n    [self updateForBackgroundStyle];\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n#pragma mark - Views\n\n- (void)updateForBackgroundStyle {\n    [self.effectView removeFromSuperview];\n    self.effectView = nil;\n\n    MBProgressHUDBackgroundStyle style = self.style;\n    if (style == MBProgressHUDBackgroundStyleBlur) {\n        UIBlurEffect *effect =  [UIBlurEffect effectWithStyle:self.blurEffectStyle];\n        UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];\n        [self insertSubview:effectView atIndex:0];\n        effectView.frame = self.bounds;\n        effectView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;\n        self.backgroundColor = self.color;\n        self.layer.allowsGroupOpacity = NO;\n        self.effectView = effectView;\n    } else {\n        self.backgroundColor = self.color;\n    }\n}\n\n- (void)updateViewsForColor:(UIColor *)color {\n    if (self.style == MBProgressHUDBackgroundStyleBlur) {\n        self.backgroundColor = self.color;\n    } else {\n        self.backgroundColor = self.color;\n    }\n}\n\n@end\n\n\n@implementation MBProgressHUDRoundedButton\n\n#pragma mark - Lifecycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        CALayer *layer = self.layer;\n        layer.borderWidth = 1.f;\n    }\n    return self;\n}\n\n#pragma mark - Layout\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    // Fully rounded corners\n    CGFloat height = CGRectGetHeight(self.bounds);\n    self.layer.cornerRadius = ceil(height / 2.f);\n}\n\n- (CGSize)intrinsicContentSize {\n    // Only show if we have associated control events and a title\n    if ((self.allControlEvents == 0) || ([self titleForState:UIControlStateNormal].length == 0))\n\t\treturn CGSizeZero;\n    CGSize size = [super intrinsicContentSize];\n    // Add some side padding\n    size.width += 20.f;\n    return size;\n}\n\n#pragma mark - Color\n\n- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state {\n    [super setTitleColor:color forState:state];\n    // Update related colors\n    [self setHighlighted:self.highlighted];\n    self.layer.borderColor = color.CGColor;\n}\n\n- (void)setHighlighted:(BOOL)highlighted {\n    [super setHighlighted:highlighted];\n    UIColor *baseColor = [self titleColorForState:UIControlStateSelected];\n    self.backgroundColor = highlighted ? [baseColor colorWithAlphaComponent:0.1f] : [UIColor clearColor];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MBProgressHUD/README.mdown",
    "content": "# MBProgressHUD\n\n[![Build Status](https://travis-ci.org/matej/MBProgressHUD.svg?branch=master)](https://travis-ci.org/matej/MBProgressHUD) [![codecov.io](https://codecov.io/github/matej/MBProgressHUD/coverage.svg?branch=master)](https://codecov.io/github/matej/MBProgressHUD?branch=master)\n [![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) [![Accio supported](https://img.shields.io/badge/Accio-supported-0A7CF5.svg?style=flat)](https://github.com/JamitLabs/Accio) [![CocoaPods compatible](https://img.shields.io/cocoapods/v/MBProgressHUD.svg?style=flat)](https://cocoapods.org/pods/MBProgressHUD) [![License: MIT](https://img.shields.io/cocoapods/l/MBProgressHUD.svg?style=flat)](http://opensource.org/licenses/MIT)\n\n`MBProgressHUD` is an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private `UIKit` `UIProgressHUD` with some additional features.\n\n[![](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/1-small.png)](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/1.png)\n[![](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/2-small.png)](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/2.png)\n[![](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/3-small.png)](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/3.png)\n[![](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/4-small.png)](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/4.png)\n[![](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/5-small.png)](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/5.png)\n[![](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/6-small.png)](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/6.png)\n[![](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/7-small.png)](https://raw.githubusercontent.com/wiki/matej/MBProgressHUD/Screenshots/7.png)\n\n**NOTE:** The class has recently undergone a major rewrite. The old version is available in the [legacy](https://github.com/jdg/MBProgressHUD/tree/legacy) branch, should you need it.\n\n## Requirements\n\n`MBProgressHUD` works on iOS 9.0+. It depends on the following Apple frameworks, which should already be included with most Xcode templates:\n\n* Foundation.framework\n* UIKit.framework\n* CoreGraphics.framework\n\nYou will need the latest developer tools in order to build `MBProgressHUD`. Old Xcode versions might work, but compatibility will not be explicitly maintained.\n\n## Adding MBProgressHUD to your project\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is the recommended way to add MBProgressHUD to your project.\n\n1. Add a pod entry for MBProgressHUD to your Podfile `pod 'MBProgressHUD', '~> 1.2.0'`\n2. Install the pod(s) by running `pod install`.\n3. Include MBProgressHUD wherever you need it with `#import \"MBProgressHUD.h\"`.\n\n### Carthage\n\n1. Add MBProgressHUD to your Cartfile. e.g., `github \"jdg/MBProgressHUD\" ~> 1.2.0`\n2. Run `carthage update`\n3. Follow the rest of the [standard Carthage installation instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application) to add MBProgressHUD to your project.\n\n### SwiftPM / Accio\n\n1. Add the following to your `Package.swift`:\n\t```swift\n\t.package(url: \"https://github.com/jdg/MBProgressHUD.git\", .upToNextMajor(from: \"1.2.0\")),\n\t```\n2. Next, add `MBProgressHUD` to your App targets dependencies like so:\n\t```swift\n\t.target(name: \"App\", dependencies: [\"MBProgressHUD\"]),\n\t```\n3. Then open your project in Xcode 11+ (SwiftPM) or run `accio update` (Accio).\n\n### Source files\n\nAlternatively you can directly add the `MBProgressHUD.h` and `MBProgressHUD.m` source files to your project.\n\n1. Download the [latest code version](https://github.com/matej/MBProgressHUD/archive/master.zip) or add the repository as a git submodule to your git-tracked project.\n2. Open your project in Xcode, then drag and drop `MBProgressHUD.h` and `MBProgressHUD.m` onto your project (use the \"Product Navigator view\"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.\n3. Include MBProgressHUD wherever you need it with `#import \"MBProgressHUD.h\"`.\n\n### Static library\n\nYou can also add MBProgressHUD as a static library to your project or workspace.\n\n1. Download the [latest code version](https://github.com/matej/MBProgressHUD/downloads) or add the repository as a git submodule to your git-tracked project.\n2. Open your project in Xcode, then drag and drop `MBProgressHUD.xcodeproj` onto your project or workspace (use the \"Product Navigator view\").\n3. Select your target and go to the Build phases tab. In the Link Binary With Libraries section select the add button. On the sheet find and add `libMBProgressHUD.a`. You might also need to add `MBProgressHUD` to the Target Dependencies list.\n4. Include MBProgressHUD wherever you need it with `#import <MBProgressHUD/MBProgressHUD.h>`.\n\n## Usage\n\nThe main guideline you need to follow when dealing with MBProgressHUD while running long-running tasks is keeping the main thread work-free, so the UI can be updated promptly. The recommended way of using MBProgressHUD is therefore to set it up on the main thread and then spinning the task, that you want to perform, off onto a new thread.\n\n```objective-c\n[MBProgressHUD showHUDAddedTo:self.view animated:YES];\ndispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{\n\t// Do something...\n\tdispatch_async(dispatch_get_main_queue(), ^{\n\t\t[MBProgressHUD hideHUDForView:self.view animated:YES];\n\t});\n});\n```\n\nYou can add the HUD on any view or window. It is however a good idea to avoid adding the HUD to certain `UIKit` views with complex view hierarchies - like `UITableView` or `UICollectionView`. Those can mutate their subviews in unexpected ways and thereby break HUD display.\n\nIf you need to configure the HUD you can do this by using the MBProgressHUD reference that showHUDAddedTo:animated: returns.\n\n```objective-c\nMBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];\nhud.mode = MBProgressHUDModeAnnularDeterminate;\nhud.label.text = @\"Loading\";\n[self doSomethingInBackgroundWithProgressCallback:^(float progress) {\n\thud.progress = progress;\n} completionCallback:^{\n\t[hud hideAnimated:YES];\n}];\n```\n\nYou can also use a `NSProgress` object and MBProgressHUD will update itself when there is progress reported through that object.\n\n```objective-c\nMBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];\nhud.mode = MBProgressHUDModeAnnularDeterminate;\nhud.label.text = @\"Loading\";\nNSProgress *progress = [self doSomethingInBackgroundCompletion:^{\n\t[hud hideAnimated:YES];\n}];\nhud.progressObject = progress;\n```\n\nKeep in mind that UI updates, inclining calls to MBProgressHUD should always be done on the main thread.\n\nIf you need to run your long-running task in the main thread, you should perform it with a slight delay, so UIKit will have enough time to update the UI (i.e., draw the HUD) before you block the main thread with your task.\n\n```objective-c\n[MBProgressHUD showHUDAddedTo:self.view animated:YES];\ndispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.01 * NSEC_PER_SEC);\ndispatch_after(popTime, dispatch_get_main_queue(), ^(void){\n\t// Do something...\n\t[MBProgressHUD hideHUDForView:self.view animated:YES];\n});\n```\n\nYou should be aware that any HUD updates issued inside the above block won't be displayed until the block completes.\n\nFor more examples, including how to use MBProgressHUD with asynchronous operations such as NSURLConnection, take a look at the bundled demo project. Extensive API documentation is provided in the header file (MBProgressHUD.h).\n\n\n## License\n\nThis code is distributed under the terms and conditions of the [MIT license](LICENSE).\n\n## Change-log\n\nA brief summary of each MBProgressHUD release can be found in the [CHANGELOG](CHANGELOG.mdown).\n"
  },
  {
    "path": "JetChat/Pods/MBProgressHUD.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t037073A136B0C073EB5F52424D6B1BB8 /* MBProgressHUD-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 42C47F506901F394A6B87B52C93CBB29 /* MBProgressHUD-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t076D27D6B05F23750F64BDF401E5A782 /* MBProgressHUD-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 86513DA5686F0CB9D2C6B8C43DC08509 /* MBProgressHUD-dummy.m */; };\n\t\t25967011F83F124E0594BACE3EF96BBF /* MBProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = 2493CC838F0DEEA55BB32A493E1B22CA /* MBProgressHUD.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t48CB33CBFC9DA157F7ECB042BBA81F4B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C8CB644149EBA15FE2799824117D13 /* Foundation.framework */; };\n\t\tB627A1CE9CE836750B74FBA065FD364B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A964DCE9349768E5D973DA9C163909 /* QuartzCore.framework */; };\n\t\tC3BF696D1161E0137930872CE216B500 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B758965F453BD454319ECB6E388E20 /* MBProgressHUD.m */; };\n\t\tE059FD66FD5A17A75010D00F3BB5FFBA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40FC7CFC05C7B0963F209ED15D260C1B /* CoreGraphics.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t2493CC838F0DEEA55BB32A493E1B22CA /* MBProgressHUD.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = \"<group>\"; };\n\t\t34B758965F453BD454319ECB6E388E20 /* MBProgressHUD.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = MBProgressHUD.m; sourceTree = \"<group>\"; };\n\t\t40FC7CFC05C7B0963F209ED15D260C1B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };\n\t\t42C47F506901F394A6B87B52C93CBB29 /* MBProgressHUD-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"MBProgressHUD-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t5451F7443D5044D3386A2D7761A7C0CE /* MBProgressHUD.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = MBProgressHUD.modulemap; sourceTree = \"<group>\"; };\n\t\t85171AE1C36A580DE4A0F0DBC84D7256 /* MBProgressHUD.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = MBProgressHUD.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t86513DA5686F0CB9D2C6B8C43DC08509 /* MBProgressHUD-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"MBProgressHUD-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tC1C8CB644149EBA15FE2799824117D13 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tD4D0090781C017225C10FE4EA74951C6 /* MBProgressHUD */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = MBProgressHUD; path = MBProgressHUD.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tE4EA42E7EE4F36B816B49A46E042DA84 /* MBProgressHUD-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"MBProgressHUD-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tF3A964DCE9349768E5D973DA9C163909 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };\n\t\tFA293FAE958AA319ADD3D932CFE3D158 /* MBProgressHUD.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = MBProgressHUD.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tFA978DD72B4F2901ED0C996435F2B863 /* MBProgressHUD-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"MBProgressHUD-prefix.pch\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t0748F7A3E92A4F6896C3AD7979D66A55 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE059FD66FD5A17A75010D00F3BB5FFBA /* CoreGraphics.framework in Frameworks */,\n\t\t\t\t48CB33CBFC9DA157F7ECB042BBA81F4B /* Foundation.framework in Frameworks */,\n\t\t\t\tB627A1CE9CE836750B74FBA065FD364B /* QuartzCore.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t7C6264ED89D8125FF43CE634A9019CBC /* MBProgressHUD */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2493CC838F0DEEA55BB32A493E1B22CA /* MBProgressHUD.h */,\n\t\t\t\t34B758965F453BD454319ECB6E388E20 /* MBProgressHUD.m */,\n\t\t\t\tCCC56EC139C744ED28E902661A74996A /* Support Files */,\n\t\t\t);\n\t\t\tname = MBProgressHUD;\n\t\t\tpath = MBProgressHUD;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8231109976E16F0571AEC2597787EB54 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD4D0090781C017225C10FE4EA74951C6 /* MBProgressHUD */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA476C4BC7FF34ECF35F26C8EDF7BE888 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tFFCAC7BB148282CF51B872C2C78FB057 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCCC56EC139C744ED28E902661A74996A /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5451F7443D5044D3386A2D7761A7C0CE /* MBProgressHUD.modulemap */,\n\t\t\t\t86513DA5686F0CB9D2C6B8C43DC08509 /* MBProgressHUD-dummy.m */,\n\t\t\t\tE4EA42E7EE4F36B816B49A46E042DA84 /* MBProgressHUD-Info.plist */,\n\t\t\t\tFA978DD72B4F2901ED0C996435F2B863 /* MBProgressHUD-prefix.pch */,\n\t\t\t\t42C47F506901F394A6B87B52C93CBB29 /* MBProgressHUD-umbrella.h */,\n\t\t\t\tFA293FAE958AA319ADD3D932CFE3D158 /* MBProgressHUD.debug.xcconfig */,\n\t\t\t\t85171AE1C36A580DE4A0F0DBC84D7256 /* MBProgressHUD.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/MBProgressHUD\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD69CAE501A86EBF20792505E5C334F2F = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA476C4BC7FF34ECF35F26C8EDF7BE888 /* Frameworks */,\n\t\t\t\t7C6264ED89D8125FF43CE634A9019CBC /* MBProgressHUD */,\n\t\t\t\t8231109976E16F0571AEC2597787EB54 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tFFCAC7BB148282CF51B872C2C78FB057 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t40FC7CFC05C7B0963F209ED15D260C1B /* CoreGraphics.framework */,\n\t\t\t\tC1C8CB644149EBA15FE2799824117D13 /* Foundation.framework */,\n\t\t\t\tF3A964DCE9349768E5D973DA9C163909 /* QuartzCore.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t31FE7E1086FF4501A1534DC21B365F07 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t25967011F83F124E0594BACE3EF96BBF /* MBProgressHUD.h in Headers */,\n\t\t\t\t037073A136B0C073EB5F52424D6B1BB8 /* MBProgressHUD-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t0F48A71D28991325602E8C8A19DF1F64 /* MBProgressHUD */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 1AE3AE988920231457E6DBFE7928C499 /* Build configuration list for PBXNativeTarget \"MBProgressHUD\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t31FE7E1086FF4501A1534DC21B365F07 /* Headers */,\n\t\t\t\tCCE5D85924611FB041516193B2F22542 /* Sources */,\n\t\t\t\t0748F7A3E92A4F6896C3AD7979D66A55 /* Frameworks */,\n\t\t\t\t0283BE74DDF9BCB3BCAFB59454BA2E83 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = MBProgressHUD;\n\t\t\tproductName = MBProgressHUD;\n\t\t\tproductReference = D4D0090781C017225C10FE4EA74951C6 /* MBProgressHUD */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tF188521B0503F3EA13576724215C91CE /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 0C7F9D1463AF7697929CDB5D4F017753 /* Build configuration list for PBXProject \"MBProgressHUD\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = D69CAE501A86EBF20792505E5C334F2F;\n\t\t\tproductRefGroup = 8231109976E16F0571AEC2597787EB54 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t0F48A71D28991325602E8C8A19DF1F64 /* MBProgressHUD */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t0283BE74DDF9BCB3BCAFB59454BA2E83 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tCCE5D85924611FB041516193B2F22542 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC3BF696D1161E0137930872CE216B500 /* MBProgressHUD.m in Sources */,\n\t\t\t\t076D27D6B05F23750F64BDF401E5A782 /* MBProgressHUD-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t32DC9FCF6095105967F82F5DEB7C1A0C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tAF6AFA87438CEA1FEBEF364E9921BDA1 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 85171AE1C36A580DE4A0F0DBC84D7256 /* MBProgressHUD.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/MBProgressHUD/MBProgressHUD-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/MBProgressHUD/MBProgressHUD-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/MBProgressHUD/MBProgressHUD.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = MBProgressHUD;\n\t\t\t\tPRODUCT_NAME = MBProgressHUD;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD834483A97A711EB4DAF4CD859DACD7D /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE877CA7A315A749543DCA94F93164AB2 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = FA293FAE958AA319ADD3D932CFE3D158 /* MBProgressHUD.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/MBProgressHUD/MBProgressHUD-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/MBProgressHUD/MBProgressHUD-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/MBProgressHUD/MBProgressHUD.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = MBProgressHUD;\n\t\t\t\tPRODUCT_NAME = MBProgressHUD;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t0C7F9D1463AF7697929CDB5D4F017753 /* Build configuration list for PBXProject \"MBProgressHUD\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD834483A97A711EB4DAF4CD859DACD7D /* Debug */,\n\t\t\t\t32DC9FCF6095105967F82F5DEB7C1A0C /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t1AE3AE988920231457E6DBFE7928C499 /* Build configuration list for PBXNativeTarget \"MBProgressHUD\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE877CA7A315A749543DCA94F93164AB2 /* Debug */,\n\t\t\t\tAF6AFA87438CEA1FEBEF364E9921BDA1 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = F188521B0503F3EA13576724215C91CE /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/LICENSE",
    "content": "Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.h",
    "content": "//\n//  MJRefreshAutoFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshFooter.h>)\n#import <MJRefresh/MJRefreshFooter.h>\n#else\n#import \"MJRefreshFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshAutoFooter : MJRefreshFooter\n/** 是否自动刷新(默认为YES) */\n@property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh;\n\n/** 当底部控件出现多少时就自动刷新(默认为1.0，也就是底部控件完全出现时，才会自动刷新) */\n@property (assign, nonatomic) CGFloat appearencePercentTriggerAutoRefresh MJRefreshDeprecated(\"请使用triggerAutomaticallyRefreshPercent属性\");\n\n/** 当底部控件出现多少时就自动刷新(默认为1.0，也就是底部控件完全出现时，才会自动刷新) */\n@property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent;\n\n/** 自动触发次数, 默认为 1, 仅在拖拽 ScrollView 时才生效,\n \n 如果为 -1, 则为无限触发\n */\n@property (nonatomic) NSInteger autoTriggerTimes;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshAutoFooter.m",
    "content": "//\n//  MJRefreshAutoFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshAutoFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n\n@interface MJRefreshAutoFooter()\n/** 一个新的拖拽 */\n@property (nonatomic) BOOL triggerByDrag;\n@property (nonatomic) NSInteger leftTriggerTimes;\n@end\n\n@implementation MJRefreshAutoFooter\n\n#pragma mark - 初始化\n- (void)willMoveToSuperview:(UIView *)newSuperview\n{\n    [super willMoveToSuperview:newSuperview];\n    \n    if (newSuperview) { // 新的父控件\n        if (self.hidden == NO) {\n            self.scrollView.mj_insetB += self.mj_h;\n        }\n        \n        // 设置位置\n        self.mj_y = _scrollView.mj_contentH;\n    } else { // 被移除了\n        if (self.hidden == NO) {\n            self.scrollView.mj_insetB -= self.mj_h;\n        }\n    }\n}\n\n#pragma mark - 过期方法\n- (void)setAppearencePercentTriggerAutoRefresh:(CGFloat)appearencePercentTriggerAutoRefresh\n{\n    self.triggerAutomaticallyRefreshPercent = appearencePercentTriggerAutoRefresh;\n}\n\n- (CGFloat)appearencePercentTriggerAutoRefresh\n{\n    return self.triggerAutomaticallyRefreshPercent;\n}\n\n#pragma mark - 实现父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 默认底部控件100%出现时才会自动刷新\n    self.triggerAutomaticallyRefreshPercent = 1.0;\n    \n    // 设置为默认状态\n    self.automaticallyRefresh = YES;\n    \n    self.autoTriggerTimes = 1;\n}\n\n- (void)scrollViewContentSizeDidChange:(NSDictionary *)change\n{\n    [super scrollViewContentSizeDidChange:change];\n    \n    CGSize size = [change[NSKeyValueChangeNewKey] CGSizeValue];\n    CGFloat contentHeight = size.height == 0 ? self.scrollView.mj_contentH : size.height;\n    // 设置位置\n    CGFloat y = contentHeight + self.ignoredScrollViewContentInsetBottom;\n    if (self.mj_y != y) {\n        self.mj_y = y;\n    }\n}\n\n- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change\n{\n    [super scrollViewContentOffsetDidChange:change];\n    \n    if (self.state != MJRefreshStateIdle || !self.automaticallyRefresh || self.mj_y == 0) return;\n    \n    if (_scrollView.mj_insetT + _scrollView.mj_contentH > _scrollView.mj_h) { // 内容超过一个屏幕\n        // 这里的_scrollView.mj_contentH替换掉self.mj_y更为合理\n        if (_scrollView.mj_offsetY >= _scrollView.mj_contentH - _scrollView.mj_h + self.mj_h * self.triggerAutomaticallyRefreshPercent + _scrollView.mj_insetB - self.mj_h) {\n            // 防止手松开时连续调用\n            CGPoint old = [change[@\"old\"] CGPointValue];\n            CGPoint new = [change[@\"new\"] CGPointValue];\n            if (new.y <= old.y) return;\n            \n            if (_scrollView.isDragging) {\n                self.triggerByDrag = YES;\n            }\n            // 当底部刷新控件完全出现时，才刷新\n            [self beginRefreshing];\n        }\n    }\n}\n\n- (void)scrollViewPanStateDidChange:(NSDictionary *)change\n{\n    [super scrollViewPanStateDidChange:change];\n    \n    if (self.state != MJRefreshStateIdle) return;\n    \n    UIGestureRecognizerState panState = _scrollView.panGestureRecognizer.state;\n    \n    switch (panState) {\n        // 手松开\n        case UIGestureRecognizerStateEnded: {\n            if (_scrollView.mj_insetT + _scrollView.mj_contentH <= _scrollView.mj_h) {  // 不够一个屏幕\n                if (_scrollView.mj_offsetY >= - _scrollView.mj_insetT) { // 向上拽\n                    self.triggerByDrag = YES;\n                    [self beginRefreshing];\n                }\n            } else { // 超出一个屏幕\n                if (_scrollView.mj_offsetY >= _scrollView.mj_contentH + _scrollView.mj_insetB - _scrollView.mj_h) {\n                    self.triggerByDrag = YES;\n                    [self beginRefreshing];\n                }\n            }\n        }\n            break;\n            \n        case UIGestureRecognizerStateBegan: {\n            [self resetTriggerTimes];\n        }\n            break;\n            \n        default:\n            break;\n    }\n}\n\n- (BOOL)unlimitedTrigger {\n    return self.leftTriggerTimes == -1;\n}\n\n- (void)beginRefreshing\n{\n    if (self.triggerByDrag && self.leftTriggerTimes <= 0 && !self.unlimitedTrigger) {\n        return;\n    }\n    \n    [super beginRefreshing];\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    if (state == MJRefreshStateRefreshing) {\n        [self executeRefreshingCallback];\n    } else if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) {\n        if (self.triggerByDrag) {\n            if (!self.unlimitedTrigger) {\n                self.leftTriggerTimes -= 1;\n            }\n            self.triggerByDrag = NO;\n        }\n        \n        if (MJRefreshStateRefreshing == oldState) {\n            if (self.scrollView.pagingEnabled) {\n                CGPoint offset = self.scrollView.contentOffset;\n                offset.y -= self.scrollView.mj_insetB;\n                [UIView animateWithDuration:self.slowAnimationDuration animations:^{\n                    self.scrollView.contentOffset = offset;\n                    \n                    if (self.endRefreshingAnimationBeginAction) {\n                        self.endRefreshingAnimationBeginAction();\n                    }\n                } completion:^(BOOL finished) {\n                    if (self.endRefreshingCompletionBlock) {\n                        self.endRefreshingCompletionBlock();\n                    }\n                }];\n                return;\n            }\n            \n            if (self.endRefreshingCompletionBlock) {\n                self.endRefreshingCompletionBlock();\n            }\n        }\n    }\n}\n\n- (void)resetTriggerTimes {\n    self.leftTriggerTimes = self.autoTriggerTimes;\n}\n\n- (void)setHidden:(BOOL)hidden\n{\n    BOOL lastHidden = self.isHidden;\n    \n    [super setHidden:hidden];\n    \n    if (!lastHidden && hidden) {\n        self.state = MJRefreshStateIdle;\n        \n        self.scrollView.mj_insetB -= self.mj_h;\n    } else if (lastHidden && !hidden) {\n        self.scrollView.mj_insetB += self.mj_h;\n        \n        // 设置位置\n        self.mj_y = _scrollView.mj_contentH;\n    }\n}\n\n- (void)setAutoTriggerTimes:(NSInteger)autoTriggerTimes {\n    _autoTriggerTimes = autoTriggerTimes;\n    self.leftTriggerTimes = autoTriggerTimes;\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshBackFooter.h",
    "content": "//\n//  MJRefreshBackFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshFooter.h>)\n#import <MJRefresh/MJRefreshFooter.h>\n#else\n#import \"MJRefreshFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshBackFooter : MJRefreshFooter\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshBackFooter.m",
    "content": "//\n//  MJRefreshBackFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshBackFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n\n@interface MJRefreshBackFooter()\n@property (assign, nonatomic) NSInteger lastRefreshCount;\n@property (assign, nonatomic) CGFloat lastBottomDelta;\n@end\n\n@implementation MJRefreshBackFooter\n\n#pragma mark - 初始化\n- (void)willMoveToSuperview:(UIView *)newSuperview\n{\n    [super willMoveToSuperview:newSuperview];\n    \n    [self scrollViewContentSizeDidChange:nil];\n}\n\n#pragma mark - 实现父类的方法\n- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change\n{\n    [super scrollViewContentOffsetDidChange:change];\n    \n    // 如果正在刷新，直接返回\n    if (self.state == MJRefreshStateRefreshing) return;\n    \n    _scrollViewOriginalInset = self.scrollView.mj_inset;\n    \n    // 当前的contentOffset\n    CGFloat currentOffsetY = self.scrollView.mj_offsetY;\n    // 尾部控件刚好出现的offsetY\n    CGFloat happenOffsetY = [self happenOffsetY];\n    // 如果是向下滚动到看不见尾部控件，直接返回\n    if (currentOffsetY <= happenOffsetY) return;\n    \n    CGFloat pullingPercent = (currentOffsetY - happenOffsetY) / self.mj_h;\n    \n    // 如果已全部加载，仅设置pullingPercent，然后返回\n    if (self.state == MJRefreshStateNoMoreData) {\n        self.pullingPercent = pullingPercent;\n        return;\n    }\n    \n    if (self.scrollView.isDragging) {\n        self.pullingPercent = pullingPercent;\n        // 普通 和 即将刷新 的临界点\n        CGFloat normal2pullingOffsetY = happenOffsetY + self.mj_h;\n        \n        if (self.state == MJRefreshStateIdle && currentOffsetY > normal2pullingOffsetY) {\n            // 转为即将刷新状态\n            self.state = MJRefreshStatePulling;\n        } else if (self.state == MJRefreshStatePulling && currentOffsetY <= normal2pullingOffsetY) {\n            // 转为普通状态\n            self.state = MJRefreshStateIdle;\n        }\n    } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开\n        // 开始刷新\n        [self beginRefreshing];\n    } else if (pullingPercent < 1) {\n        self.pullingPercent = pullingPercent;\n    }\n}\n\n- (void)scrollViewContentSizeDidChange:(NSDictionary *)change\n{\n    [super scrollViewContentSizeDidChange:change];\n    \n    CGSize size = [change[NSKeyValueChangeNewKey] CGSizeValue];\n    CGFloat contentHeight = size.height == 0 ? self.scrollView.mj_contentH : size.height;\n    // 内容的高度\n    contentHeight += self.ignoredScrollViewContentInsetBottom;\n    // 表格的高度\n    CGFloat scrollHeight = self.scrollView.mj_h - self.scrollViewOriginalInset.top - self.scrollViewOriginalInset.bottom + self.ignoredScrollViewContentInsetBottom;\n    // 设置位置\n    CGFloat y = MAX(contentHeight, scrollHeight);\n    if (self.mj_y != y) {\n        self.mj_y = y;\n    }\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态来设置属性\n    if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) {\n        // 刷新完毕\n        if (MJRefreshStateRefreshing == oldState) {\n            [UIView animateWithDuration:self.slowAnimationDuration animations:^{\n                if (self.endRefreshingAnimationBeginAction) {\n                    self.endRefreshingAnimationBeginAction();\n                }\n                \n                self.scrollView.mj_insetB -= self.lastBottomDelta;\n                // 自动调整透明度\n                if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0;\n            } completion:^(BOOL finished) {\n                self.pullingPercent = 0.0;\n                \n                if (self.endRefreshingCompletionBlock) {\n                    self.endRefreshingCompletionBlock();\n                }\n            }];\n        }\n        \n        CGFloat deltaH = [self heightForContentBreakView];\n        // 刚刷新完毕\n        if (MJRefreshStateRefreshing == oldState && deltaH > 0 && self.scrollView.mj_totalDataCount != self.lastRefreshCount) {\n            self.scrollView.mj_offsetY = self.scrollView.mj_offsetY;\n        }\n    } else if (state == MJRefreshStateRefreshing) {\n        // 记录刷新前的数量\n        self.lastRefreshCount = self.scrollView.mj_totalDataCount;\n        \n        [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n            CGFloat bottom = self.mj_h + self.scrollViewOriginalInset.bottom;\n            CGFloat deltaH = [self heightForContentBreakView];\n            if (deltaH < 0) { // 如果内容高度小于view的高度\n                bottom -= deltaH;\n            }\n            self.lastBottomDelta = bottom - self.scrollView.mj_insetB;\n            self.scrollView.mj_insetB = bottom;\n            self.scrollView.mj_offsetY = [self happenOffsetY] + self.mj_h;\n        } completion:^(BOOL finished) {\n            [self executeRefreshingCallback];\n        }];\n    }\n}\n#pragma mark - 私有方法\n#pragma mark 获得scrollView的内容 超出 view 的高度\n- (CGFloat)heightForContentBreakView\n{\n    CGFloat h = self.scrollView.frame.size.height - self.scrollViewOriginalInset.bottom - self.scrollViewOriginalInset.top;\n    return self.scrollView.contentSize.height - h;\n}\n\n#pragma mark 刚好看到上拉刷新控件时的contentOffset.y\n- (CGFloat)happenOffsetY\n{\n    CGFloat deltaH = [self heightForContentBreakView];\n    if (deltaH > 0) {\n        return deltaH - self.scrollViewOriginalInset.top;\n    } else {\n        return - self.scrollViewOriginalInset.top;\n    }\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshComponent.h",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  MJRefreshComponent.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/4.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//  刷新控件的基类\n\n#import <UIKit/UIKit.h>\n#if __has_include(<MJRefresh/MJRefreshConst.h>)\n#import <MJRefresh/MJRefreshConst.h>\n#else\n#import \"MJRefreshConst.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/** 刷新控件的状态 */\ntypedef NS_ENUM(NSInteger, MJRefreshState) {\n    /** 普通闲置状态 */\n    MJRefreshStateIdle = 1,\n    /** 松开就可以进行刷新的状态 */\n    MJRefreshStatePulling,\n    /** 正在刷新中的状态 */\n    MJRefreshStateRefreshing,\n    /** 即将刷新的状态 */\n    MJRefreshStateWillRefresh,\n    /** 所有数据加载完毕，没有更多的数据了 */\n    MJRefreshStateNoMoreData\n};\n\n/** 进入刷新状态的回调 */\ntypedef void (^MJRefreshComponentRefreshingBlock)(void) MJRefreshDeprecated(\"first deprecated in 3.3.0 - Use `MJRefreshComponentAction` instead\");\n/** 开始刷新后的回调(进入刷新状态后的回调) */\ntypedef void (^MJRefreshComponentBeginRefreshingCompletionBlock)(void) MJRefreshDeprecated(\"first deprecated in 3.3.0 - Use `MJRefreshComponentAction` instead\");\n/** 结束刷新后的回调 */\ntypedef void (^MJRefreshComponentEndRefreshingCompletionBlock)(void) MJRefreshDeprecated(\"first deprecated in 3.3.0 - Use `MJRefreshComponentAction` instead\");\n\n/** 刷新用到的回调类型 */\ntypedef void (^MJRefreshComponentAction)(void);\n\n/** 刷新控件的基类 */\n@interface MJRefreshComponent : UIView\n{\n    /** 记录scrollView刚开始的inset */\n    UIEdgeInsets _scrollViewOriginalInset;\n    /** 父控件 */\n    __weak UIScrollView *_scrollView;\n}\n\n#pragma mark - 刷新动画时间控制\n/** 快速动画时间(一般用在刷新开始的回弹动画), 默认 0.25 */\n@property (nonatomic) NSTimeInterval fastAnimationDuration;\n/** 慢速动画时间(一般用在刷新结束后的回弹动画), 默认 0.4*/\n@property (nonatomic) NSTimeInterval slowAnimationDuration;\n/** 关闭全部默认动画效果, 可以简单粗暴地解决 CollectionView 的回弹动画 bug */\n- (instancetype)setAnimationDisabled;\n\n#pragma mark - 刷新回调\n/** 正在刷新的回调 */\n@property (copy, nonatomic, nullable) MJRefreshComponentAction refreshingBlock;\n/** 设置回调对象和回调方法 */\n- (void)setRefreshingTarget:(id)target refreshingAction:(SEL)action;\n\n/** 回调对象 */\n@property (weak, nonatomic) id refreshingTarget;\n/** 回调方法 */\n@property (assign, nonatomic) SEL refreshingAction;\n/** 触发回调（交给子类去调用） */\n- (void)executeRefreshingCallback;\n\n#pragma mark - 刷新状态控制\n/** 进入刷新状态 */\n- (void)beginRefreshing;\n- (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock;\n/** 开始刷新后的回调(进入刷新状态后的回调) */\n@property (copy, nonatomic, nullable) MJRefreshComponentAction beginRefreshingCompletionBlock;\n/** 带动画的结束刷新的回调 */\n@property (copy, nonatomic, nullable) MJRefreshComponentAction endRefreshingAnimateCompletionBlock MJRefreshDeprecated(\"first deprecated in 3.3.0 - Use `endRefreshingAnimationBeginAction` instead\");\n@property (copy, nonatomic, nullable) MJRefreshComponentAction endRefreshingAnimationBeginAction;\n/** 结束刷新的回调 */\n@property (copy, nonatomic, nullable) MJRefreshComponentAction endRefreshingCompletionBlock;\n/** 结束刷新状态 */\n- (void)endRefreshing;\n- (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock;\n/** 是否正在刷新 */\n@property (assign, nonatomic, readonly, getter=isRefreshing) BOOL refreshing;\n\n/** 刷新状态 一般交给子类内部实现 */\n@property (assign, nonatomic) MJRefreshState state;\n\n#pragma mark - 交给子类去访问\n/** 记录scrollView刚开始的inset */\n@property (assign, nonatomic, readonly) UIEdgeInsets scrollViewOriginalInset;\n/** 父控件 */\n@property (weak, nonatomic, readonly) UIScrollView *scrollView;\n\n#pragma mark - 交给子类们去实现\n/** 初始化 */\n- (void)prepare NS_REQUIRES_SUPER;\n/** 摆放子控件frame */\n- (void)placeSubviews NS_REQUIRES_SUPER;\n/** 当scrollView的contentOffset发生改变的时候调用 */\n- (void)scrollViewContentOffsetDidChange:(nullable NSDictionary *)change NS_REQUIRES_SUPER;\n/** 当scrollView的contentSize发生改变的时候调用 */\n- (void)scrollViewContentSizeDidChange:(nullable NSDictionary *)change NS_REQUIRES_SUPER;\n/** 当scrollView的拖拽状态发生改变的时候调用 */\n- (void)scrollViewPanStateDidChange:(nullable NSDictionary *)change NS_REQUIRES_SUPER;\n\n/** 多语言配置 language 发生变化时调用\n \n `MJRefreshConfig.defaultConfig.language` 发生改变时调用.\n \n ⚠️ 父类会调用 `placeSubviews` 方法, 请勿在 placeSubviews 中调用本方法, 造成死循环. 子类在需要重新布局时, 在配置完修改后, 最后再调用 super 方法, 否则可能导致配置修改后, 定位先于修改执行.\n */\n- (void)i18nDidChange NS_REQUIRES_SUPER;\n\n#pragma mark - 其他\n/** 拉拽的百分比(交给子类重写) */\n@property (assign, nonatomic) CGFloat pullingPercent;\n/** 根据拖拽比例自动切换透明度 */\n@property (assign, nonatomic, getter=isAutoChangeAlpha) BOOL autoChangeAlpha MJRefreshDeprecated(\"请使用automaticallyChangeAlpha属性\");\n/** 根据拖拽比例自动切换透明度 */\n@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;\n@end\n\n@interface UILabel(MJRefresh)\n+ (instancetype)mj_label;\n- (CGFloat)mj_textWidth;\n@end\n\n@interface MJRefreshComponent (ChainingGrammar)\n\n#pragma mark - <<< 为 Swift 扩展链式语法 >>> -\n/// 自动变化透明度\n- (instancetype)autoChangeTransparency:(BOOL)isAutoChange;\n/// 刷新开始后立即调用的回调\n- (instancetype)afterBeginningAction:(MJRefreshComponentAction)action;\n/// 刷新动画开始后立即调用的回调\n- (instancetype)endingAnimationBeginningAction:(MJRefreshComponentAction)action;\n/// 刷新结束后立即调用的回调\n- (instancetype)afterEndingAction:(MJRefreshComponentAction)action;\n\n\n/// 需要子类必须实现\n/// @param scrollView 赋值给的 ScrollView 的 Header/Footer/Trailer\n- (instancetype)linkTo:(UIScrollView *)scrollView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshComponent.m",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  MJRefreshComponent.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/4.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshComponent.h\"\n#import \"MJRefreshConst.h\"\n#import \"MJRefreshConfig.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n#import \"NSBundle+MJRefresh.h\"\n\n@interface MJRefreshComponent()\n@property (strong, nonatomic) UIPanGestureRecognizer *pan;\n@end\n\n@implementation MJRefreshComponent\n#pragma mark - 初始化\n- (instancetype)initWithFrame:(CGRect)frame\n{\n    if (self = [super initWithFrame:frame]) {\n        // 准备工作\n        [self prepare];\n        \n        // 默认是普通状态\n        self.state = MJRefreshStateIdle;\n        self.fastAnimationDuration = 0.25;\n        self.slowAnimationDuration = 0.4;\n    }\n    return self;\n}\n\n- (void)prepare\n{\n    // 基本属性\n    self.autoresizingMask = UIViewAutoresizingFlexibleWidth;\n    self.backgroundColor = [UIColor clearColor];\n}\n\n- (void)layoutSubviews\n{\n    [self placeSubviews];\n    \n    [super layoutSubviews];\n}\n\n- (void)placeSubviews{}\n\n- (void)willMoveToSuperview:(UIView *)newSuperview\n{\n    [super willMoveToSuperview:newSuperview];\n    \n    // 如果不是UIScrollView，不做任何事情\n    if (newSuperview && ![newSuperview isKindOfClass:[UIScrollView class]]) return;\n    \n    // 旧的父控件移除监听\n    [self removeObservers];\n    \n    if (newSuperview) { // 新的父控件\n        // 记录UIScrollView\n        _scrollView = (UIScrollView *)newSuperview;\n        \n        // 设置宽度\n        self.mj_w = _scrollView.mj_w;\n        // 设置位置\n        self.mj_x = -_scrollView.mj_insetL;\n    \n        // 设置永远支持垂直弹簧效果\n        _scrollView.alwaysBounceVertical = YES;\n        // 记录UIScrollView最开始的contentInset\n        _scrollViewOriginalInset = _scrollView.mj_inset;\n        \n        // 添加监听\n        [self addObservers];\n    }\n}\n\n- (void)drawRect:(CGRect)rect\n{\n    [super drawRect:rect];\n    \n    if (self.state == MJRefreshStateWillRefresh) {\n        // 预防view还没显示出来就调用了beginRefreshing\n        self.state = MJRefreshStateRefreshing;\n    }\n}\n\n#pragma mark - KVO监听\n- (void)addObservers\n{\n    NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld;\n    [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentOffset options:options context:nil];\n    [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentSize options:options context:nil];\n    self.pan = self.scrollView.panGestureRecognizer;\n    [self.pan addObserver:self forKeyPath:MJRefreshKeyPathPanState options:options context:nil];\n    \n    [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(i18nDidChange) name:MJRefreshDidChangeLanguageNotification object:MJRefreshConfig.defaultConfig];\n}\n\n- (void)removeObservers\n{\n    [self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentOffset];\n    [self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentSize];\n    [self.pan removeObserver:self forKeyPath:MJRefreshKeyPathPanState];\n    self.pan = nil;\n}\n\n- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context\n{\n    // 遇到这些情况就直接返回\n    if (!self.userInteractionEnabled) return;\n    \n    // 这个就算看不见也需要处理\n    if ([keyPath isEqualToString:MJRefreshKeyPathContentSize]) {\n        [self scrollViewContentSizeDidChange:change];\n    }\n    \n    // 看不见\n    if (self.hidden) return;\n    if ([keyPath isEqualToString:MJRefreshKeyPathContentOffset]) {\n        [self scrollViewContentOffsetDidChange:change];\n    } else if ([keyPath isEqualToString:MJRefreshKeyPathPanState]) {\n        [self scrollViewPanStateDidChange:change];\n    }\n}\n\n- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change{}\n- (void)scrollViewContentSizeDidChange:(NSDictionary *)change{}\n- (void)scrollViewPanStateDidChange:(NSDictionary *)change{}\n\n- (void)i18nDidChange {\n    [self placeSubviews];\n}\n\n#pragma mark - 公共方法\n#pragma mark 设置回调对象和回调方法\n- (void)setRefreshingTarget:(id)target refreshingAction:(SEL)action\n{\n    self.refreshingTarget = target;\n    self.refreshingAction = action;\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    _state = state;\n    \n    // 加入主队列的目的是等setState:方法调用完毕、设置完文字后再去布局子控件\n    MJRefreshDispatchAsyncOnMainQueue([self setNeedsLayout];)\n}\n\n#pragma mark 进入刷新状态\n- (void)beginRefreshing\n{\n    [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n        self.alpha = 1.0;\n    }];\n    self.pullingPercent = 1.0;\n    // 只要正在刷新，就完全显示\n    if (self.window) {\n        self.state = MJRefreshStateRefreshing;\n    } else {\n        // 预防正在刷新中时，调用本方法使得header inset回置失败\n        if (self.state != MJRefreshStateRefreshing) {\n            self.state = MJRefreshStateWillRefresh;\n            // 刷新(预防从另一个控制器回到这个控制器的情况，回来要重新刷新一下)\n            [self setNeedsDisplay];\n        }\n    }\n}\n\n- (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock\n{\n    self.beginRefreshingCompletionBlock = completionBlock;\n    \n    [self beginRefreshing];\n}\n\n#pragma mark 结束刷新状态\n- (void)endRefreshing\n{\n    MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateIdle;)\n}\n\n- (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock\n{\n    self.endRefreshingCompletionBlock = completionBlock;\n    \n    [self endRefreshing];\n}\n\n#pragma mark 是否正在刷新\n- (BOOL)isRefreshing\n{\n    return self.state == MJRefreshStateRefreshing || self.state == MJRefreshStateWillRefresh;\n}\n\n#pragma mark 自动切换透明度\n- (void)setAutoChangeAlpha:(BOOL)autoChangeAlpha\n{\n    self.automaticallyChangeAlpha = autoChangeAlpha;\n}\n\n- (BOOL)isAutoChangeAlpha\n{\n    return self.isAutomaticallyChangeAlpha;\n}\n\n- (void)setAutomaticallyChangeAlpha:(BOOL)automaticallyChangeAlpha\n{\n    _automaticallyChangeAlpha = automaticallyChangeAlpha;\n    \n    if (self.isRefreshing) return;\n    \n    if (automaticallyChangeAlpha) {\n        self.alpha = self.pullingPercent;\n    } else {\n        self.alpha = 1.0;\n    }\n}\n\n#pragma mark 根据拖拽进度设置透明度\n- (void)setPullingPercent:(CGFloat)pullingPercent\n{\n    _pullingPercent = pullingPercent;\n    \n    if (self.isRefreshing) return;\n    \n    if (self.isAutomaticallyChangeAlpha) {\n        self.alpha = pullingPercent;\n    }\n}\n\n#pragma mark - 内部方法\n- (void)executeRefreshingCallback\n{\n    if (self.refreshingBlock) {\n        self.refreshingBlock();\n    }\n    if ([self.refreshingTarget respondsToSelector:self.refreshingAction]) {\n        MJRefreshMsgSend(MJRefreshMsgTarget(self.refreshingTarget), self.refreshingAction, self);\n    }\n    if (self.beginRefreshingCompletionBlock) {\n        self.beginRefreshingCompletionBlock();\n    }\n}\n\n#pragma mark - 刷新动画时间控制\n- (instancetype)setAnimationDisabled {\n    self.fastAnimationDuration = 0;\n    self.slowAnimationDuration = 0;\n    \n    return self;\n}\n\n#pragma mark - <<< Deprecation compatible function >>> -\n- (void)setEndRefreshingAnimateCompletionBlock:(MJRefreshComponentEndRefreshingCompletionBlock)endRefreshingAnimateCompletionBlock {\n    _endRefreshingAnimationBeginAction = endRefreshingAnimateCompletionBlock;\n}\n@end\n\n@implementation UILabel(MJRefresh)\n+ (instancetype)mj_label\n{\n    UILabel *label = [[self alloc] init];\n    label.font = MJRefreshLabelFont;\n    label.textColor = MJRefreshLabelTextColor;\n    label.autoresizingMask = UIViewAutoresizingFlexibleWidth;\n    label.textAlignment = NSTextAlignmentCenter;\n    label.backgroundColor = [UIColor clearColor];\n    return label;\n}\n\n- (CGFloat)mj_textWidth {\n    CGFloat stringWidth = 0;\n    CGSize size = CGSizeMake(MAXFLOAT, MAXFLOAT);\n    \n    if (self.attributedText) {\n        if (self.attributedText.length == 0) { return 0; }\n        stringWidth = [self.attributedText boundingRectWithSize:size\n                                                        options:NSStringDrawingUsesLineFragmentOrigin\n                                                        context:nil].size.width;\n    } else {\n        if (self.text.length == 0) { return 0; }\n        NSAssert(self.font != nil, @\"请检查 mj_label's `font` 是否设置正确\");\n        stringWidth = [self.text boundingRectWithSize:size\n                                              options:NSStringDrawingUsesLineFragmentOrigin\n                                           attributes:@{NSFontAttributeName:self.font}\n                                              context:nil].size.width;\n    }\n    return stringWidth;\n}\n@end\n\n\n#pragma mark - <<< 为 Swift 扩展链式语法 >>> -\n@implementation MJRefreshComponent (ChainingGrammar)\n\n- (instancetype)autoChangeTransparency:(BOOL)isAutoChange {\n    self.automaticallyChangeAlpha = isAutoChange;\n    return self;\n}\n- (instancetype)afterBeginningAction:(MJRefreshComponentAction)action {\n    self.beginRefreshingCompletionBlock = action;\n    return self;\n}\n- (instancetype)endingAnimationBeginningAction:(MJRefreshComponentAction)action {\n    self.endRefreshingAnimationBeginAction = action;\n    return self;\n}\n- (instancetype)afterEndingAction:(MJRefreshComponentAction)action {\n    self.endRefreshingCompletionBlock = action;\n    return self;\n}\n\n- (instancetype)linkTo:(UIScrollView *)scrollView {\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshFooter.h",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  MJRefreshFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/5.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//  上拉刷新控件\n\n#if __has_include(<MJRefresh/MJRefreshComponent.h>)\n#import <MJRefresh/MJRefreshComponent.h>\n#else\n#import \"MJRefreshComponent.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshFooter : MJRefreshComponent\n/** 创建footer */\n+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock;\n/** 创建footer */\n+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;\n\n/** 提示没有更多的数据 */\n- (void)endRefreshingWithNoMoreData;\n- (void)noticeNoMoreData MJRefreshDeprecated(\"使用endRefreshingWithNoMoreData\");\n\n/** 重置没有更多的数据（消除没有更多数据的状态） */\n- (void)resetNoMoreData;\n\n/** 忽略多少scrollView的contentInset的bottom */\n@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;\n\n/** 自动根据有无数据来显示和隐藏（有数据就显示，没有数据隐藏。默认是NO） */\n@property (assign, nonatomic, getter=isAutomaticallyHidden) BOOL automaticallyHidden MJRefreshDeprecated(\"已废弃此属性，开发者请自行控制footer的显示和隐藏\");\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshFooter.m",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  MJRefreshFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/5.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshFooter.h\"\n#import \"UIScrollView+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n\n@interface MJRefreshFooter()\n\n@end\n\n@implementation MJRefreshFooter\n#pragma mark - 构造方法\n+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock\n{\n    MJRefreshFooter *cmp = [[self alloc] init];\n    cmp.refreshingBlock = refreshingBlock;\n    return cmp;\n}\n+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action\n{\n    MJRefreshFooter *cmp = [[self alloc] init];\n    [cmp setRefreshingTarget:target refreshingAction:action];\n    return cmp;\n}\n\n#pragma mark - 重写父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 设置自己的高度\n    self.mj_h = MJRefreshFooterHeight;\n    \n    // 默认不会自动隐藏\n//    self.automaticallyHidden = NO;\n}\n\n#pragma mark . 链式语法部分 .\n\n- (instancetype)linkTo:(UIScrollView *)scrollView {\n    scrollView.mj_footer = self;\n    return self;\n}\n\n#pragma mark - 公共方法\n- (void)endRefreshingWithNoMoreData\n{\n    MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateNoMoreData;)\n}\n\n- (void)noticeNoMoreData\n{\n    [self endRefreshingWithNoMoreData];\n}\n\n- (void)resetNoMoreData\n{\n    MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateIdle;)\n}\n\n- (void)setAutomaticallyHidden:(BOOL)automaticallyHidden\n{\n    _automaticallyHidden = automaticallyHidden;\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshHeader.h",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  MJRefreshHeader.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/4.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//  下拉刷新控件:负责监控用户下拉的状态\n\n#if __has_include(<MJRefresh/MJRefreshComponent.h>)\n#import <MJRefresh/MJRefreshComponent.h>\n#else\n#import \"MJRefreshComponent.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshHeader : MJRefreshComponent\n/** 创建header */\n+ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock;\n/** 创建header */\n+ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;\n\n/** 这个key用来存储上一次下拉刷新成功的时间 */\n@property (copy, nonatomic) NSString *lastUpdatedTimeKey;\n/** 上一次下拉刷新成功的时间 */\n@property (strong, nonatomic, readonly, nullable) NSDate *lastUpdatedTime;\n\n/** 忽略多少scrollView的contentInset的top */\n@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop;\n\n/** 默认是关闭状态, 如果遇到 CollectionView 的动画异常问题可以尝试打开 */\n@property (nonatomic) BOOL isCollectionViewAnimationBug;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshHeader.m",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  MJRefreshHeader.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/4.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshHeader.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n\nNSString * const MJRefreshHeaderRefreshing2IdleBoundsKey = @\"MJRefreshHeaderRefreshing2IdleBounds\";\nNSString * const MJRefreshHeaderRefreshingBoundsKey = @\"MJRefreshHeaderRefreshingBounds\";\n\n@interface MJRefreshHeader() <CAAnimationDelegate>\n@property (assign, nonatomic) CGFloat insetTDelta;\n@end\n\n@implementation MJRefreshHeader\n#pragma mark - 构造方法\n+ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock\n{\n    MJRefreshHeader *cmp = [[self alloc] init];\n    cmp.refreshingBlock = refreshingBlock;\n    return cmp;\n}\n+ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action\n{\n    MJRefreshHeader *cmp = [[self alloc] init];\n    [cmp setRefreshingTarget:target refreshingAction:action];\n    return cmp;\n}\n\n#pragma mark - 覆盖父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 设置key\n    self.lastUpdatedTimeKey = MJRefreshHeaderLastUpdatedTimeKey;\n    \n    // 设置高度\n    self.mj_h = MJRefreshHeaderHeight;\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    // 设置y值(当自己的高度发生改变了，肯定要重新调整Y值，所以放到placeSubviews方法中设置y值)\n    self.mj_y = - self.mj_h - self.ignoredScrollViewContentInsetTop;\n}\n\n- (void)resetInset {\n    if (@available(iOS 11.0, *)) {\n    } else {\n        // 如果 iOS 10 及以下系统在刷新时, push 新的 VC, 等待刷新完成后回来, 会导致顶部 Insets.top 异常, 不能 resetInset, 检查一下这种特殊情况\n        if (!self.window) { return; }\n    }\n    \n    // sectionheader停留解决\n    CGFloat insetT = - self.scrollView.mj_offsetY > _scrollViewOriginalInset.top ? - self.scrollView.mj_offsetY : _scrollViewOriginalInset.top;\n    insetT = insetT > self.mj_h + _scrollViewOriginalInset.top ? self.mj_h + _scrollViewOriginalInset.top : insetT;\n    self.insetTDelta = _scrollViewOriginalInset.top - insetT;\n    // 避免 CollectionView 在使用根据 Autolayout 和 内容自动伸缩 Cell, 刷新时导致的 Layout 异常渲染问题\n    if (self.scrollView.mj_insetT != insetT) {\n        self.scrollView.mj_insetT = insetT;\n    }\n}\n\n- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change\n{\n    [super scrollViewContentOffsetDidChange:change];\n    \n    // 在刷新的refreshing状态\n    if (self.state == MJRefreshStateRefreshing) {\n        [self resetInset];\n        return;\n    }\n    \n    // 跳转到下一个控制器时，contentInset可能会变\n    _scrollViewOriginalInset = self.scrollView.mj_inset;\n    \n    // 当前的contentOffset\n    CGFloat offsetY = self.scrollView.mj_offsetY;\n    // 头部控件刚好出现的offsetY\n    CGFloat happenOffsetY = - self.scrollViewOriginalInset.top;\n    \n    // 如果是向上滚动到看不见头部控件，直接返回\n    // >= -> >\n    if (offsetY > happenOffsetY) return;\n    \n    // 普通 和 即将刷新 的临界点\n    CGFloat normal2pullingOffsetY = happenOffsetY - self.mj_h;\n    CGFloat pullingPercent = (happenOffsetY - offsetY) / self.mj_h;\n    \n    if (self.scrollView.isDragging) { // 如果正在拖拽\n        self.pullingPercent = pullingPercent;\n        if (self.state == MJRefreshStateIdle && offsetY < normal2pullingOffsetY) {\n            // 转为即将刷新状态\n            self.state = MJRefreshStatePulling;\n        } else if (self.state == MJRefreshStatePulling && offsetY >= normal2pullingOffsetY) {\n            // 转为普通状态\n            self.state = MJRefreshStateIdle;\n        }\n    } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开\n        // 开始刷新\n        [self beginRefreshing];\n    } else if (pullingPercent < 1) {\n        self.pullingPercent = pullingPercent;\n    }\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态做事情\n    if (state == MJRefreshStateIdle) {\n        if (oldState != MJRefreshStateRefreshing) return;\n        \n        [self headerEndingAction];\n    } else if (state == MJRefreshStateRefreshing) {\n        [self headerRefreshingAction];\n    }\n}\n\n- (void)headerEndingAction {\n    // 保存刷新时间\n    [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:self.lastUpdatedTimeKey];\n    [[NSUserDefaults standardUserDefaults] synchronize];\n    \n    // 默认使用 UIViewAnimation 动画\n    if (!self.isCollectionViewAnimationBug) {\n        // 恢复inset和offset\n        [UIView animateWithDuration:self.slowAnimationDuration animations:^{\n            self.scrollView.mj_insetT += self.insetTDelta;\n            \n            if (self.endRefreshingAnimationBeginAction) {\n                self.endRefreshingAnimationBeginAction();\n            }\n            // 自动调整透明度\n            if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0;\n        } completion:^(BOOL finished) {\n            self.pullingPercent = 0.0;\n            \n            if (self.endRefreshingCompletionBlock) {\n                self.endRefreshingCompletionBlock();\n            }\n        }];\n        \n        return;\n    }\n    \n    /**\n     这个解决方法的思路出自 https://github.com/CoderMJLee/MJRefresh/pull/844\n     修改了用+ [UIView animateWithDuration: animations:]实现的修改contentInset的动画\n     fix issue#225 https://github.com/CoderMJLee/MJRefresh/issues/225\n     另一种解法 pull#737 https://github.com/CoderMJLee/MJRefresh/pull/737\n     \n     同时, 处理了 Refreshing 中的动画替换.\n    */\n    \n    // 由于修改 Inset 会导致 self.pullingPercent 联动设置 self.alpha, 故提前获取 alpha 值, 后续用于还原 alpha 动画\n    CGFloat viewAlpha = self.alpha;\n    \n    self.scrollView.mj_insetT += self.insetTDelta;\n    // 禁用交互, 如果不禁用可能会引起渲染问题.\n    self.scrollView.userInteractionEnabled = NO;\n\n    //CAAnimation keyPath 不支持 contentInset 用Bounds的动画代替\n    CABasicAnimation *boundsAnimation = [CABasicAnimation animationWithKeyPath:@\"bounds\"];\n    boundsAnimation.fromValue = [NSValue valueWithCGRect:CGRectOffset(self.scrollView.bounds, 0, self.insetTDelta)];\n    boundsAnimation.duration = self.slowAnimationDuration;\n    //在delegate里移除\n    boundsAnimation.removedOnCompletion = NO;\n    boundsAnimation.fillMode = kCAFillModeBoth;\n    boundsAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];\n    boundsAnimation.delegate = self;\n    [boundsAnimation setValue:MJRefreshHeaderRefreshing2IdleBoundsKey forKey:@\"identity\"];\n\n    [self.scrollView.layer addAnimation:boundsAnimation forKey:MJRefreshHeaderRefreshing2IdleBoundsKey];\n    \n    if (self.endRefreshingAnimationBeginAction) {\n        self.endRefreshingAnimationBeginAction();\n    }\n    // 自动调整透明度的动画\n    if (self.isAutomaticallyChangeAlpha) {\n        CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@\"opacity\"];\n        opacityAnimation.fromValue = @(viewAlpha);\n        opacityAnimation.toValue = @(0.0);\n        opacityAnimation.duration = self.slowAnimationDuration;\n        opacityAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];\n        [self.layer addAnimation:opacityAnimation forKey:@\"MJRefreshHeaderRefreshing2IdleOpacity\"];\n\n        // 由于修改了 inset 导致, pullingPercent 被设置值, alpha 已经被提前修改为 0 了. 所以这里不用置 0, 但为了代码的严谨性, 不依赖其他的特殊实现方式, 这里还是置 0.\n        self.alpha = 0;\n    }\n}\n\n- (void)headerRefreshingAction {\n    // 默认使用 UIViewAnimation 动画\n    if (!self.isCollectionViewAnimationBug) {\n        [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n            if (self.scrollView.panGestureRecognizer.state != UIGestureRecognizerStateCancelled) {\n                CGFloat top = self.scrollViewOriginalInset.top + self.mj_h;\n                // 增加滚动区域top\n                self.scrollView.mj_insetT = top;\n                // 设置滚动位置\n                CGPoint offset = self.scrollView.contentOffset;\n                offset.y = -top;\n                [self.scrollView setContentOffset:offset animated:NO];\n            }\n        } completion:^(BOOL finished) {\n            [self executeRefreshingCallback];\n        }];\n        return;\n    }\n    \n    if (self.scrollView.panGestureRecognizer.state != UIGestureRecognizerStateCancelled) {\n        CGFloat top = self.scrollViewOriginalInset.top + self.mj_h;\n        // 禁用交互, 如果不禁用可能会引起渲染问题.\n        self.scrollView.userInteractionEnabled = NO;\n\n        // CAAnimation keyPath不支持 contentOffset 用Bounds的动画代替\n        CABasicAnimation *boundsAnimation = [CABasicAnimation animationWithKeyPath:@\"bounds\"];\n        CGRect bounds = self.scrollView.bounds;\n        bounds.origin.y = -top;\n        boundsAnimation.fromValue = [NSValue valueWithCGRect:self.scrollView.bounds];\n        boundsAnimation.toValue = [NSValue valueWithCGRect:bounds];\n        boundsAnimation.duration = self.fastAnimationDuration;\n        //在delegate里移除\n        boundsAnimation.removedOnCompletion = NO;\n        boundsAnimation.fillMode = kCAFillModeBoth;\n        boundsAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];\n        boundsAnimation.delegate = self;\n        [boundsAnimation setValue:MJRefreshHeaderRefreshingBoundsKey forKey:@\"identity\"];\n        [self.scrollView.layer addAnimation:boundsAnimation forKey:MJRefreshHeaderRefreshingBoundsKey];\n    } else {\n        [self executeRefreshingCallback];\n    }\n}\n\n#pragma mark . 链式语法部分 .\n\n- (instancetype)linkTo:(UIScrollView *)scrollView {\n    scrollView.mj_header = self;\n    return self;\n}\n\n#pragma mark - CAAnimationDelegate\n- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {\n    NSString *identity = [anim valueForKey:@\"identity\"];\n    if ([identity isEqualToString:MJRefreshHeaderRefreshing2IdleBoundsKey]) {\n        self.pullingPercent = 0.0;\n        self.scrollView.userInteractionEnabled = YES;\n        if (self.endRefreshingCompletionBlock) {\n            self.endRefreshingCompletionBlock();\n        }\n    } else if ([identity isEqualToString:MJRefreshHeaderRefreshingBoundsKey]) {\n        // 避免出现 end 先于 Refreshing 状态\n        if (self.state != MJRefreshStateIdle) {\n            CGFloat top = self.scrollViewOriginalInset.top + self.mj_h;\n            self.scrollView.mj_insetT = top;\n            // 设置最终滚动位置\n            CGPoint offset = self.scrollView.contentOffset;\n            offset.y = -top;\n            [self.scrollView setContentOffset:offset animated:NO];\n         }\n        self.scrollView.userInteractionEnabled = YES;\n        [self executeRefreshingCallback];\n    }\n    \n    if ([self.scrollView.layer animationForKey:MJRefreshHeaderRefreshing2IdleBoundsKey]) {\n        [self.scrollView.layer removeAnimationForKey:MJRefreshHeaderRefreshing2IdleBoundsKey];\n    }\n    \n    if ([self.scrollView.layer animationForKey:MJRefreshHeaderRefreshingBoundsKey]) {\n        [self.scrollView.layer removeAnimationForKey:MJRefreshHeaderRefreshingBoundsKey];\n    }\n}\n\n#pragma mark - 公共方法\n- (NSDate *)lastUpdatedTime\n{\n    return [[NSUserDefaults standardUserDefaults] objectForKey:self.lastUpdatedTimeKey];\n}\n\n- (void)setIgnoredScrollViewContentInsetTop:(CGFloat)ignoredScrollViewContentInsetTop {\n    _ignoredScrollViewContentInsetTop = ignoredScrollViewContentInsetTop;\n    \n    self.mj_y = - self.mj_h - _ignoredScrollViewContentInsetTop;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshTrailer.h",
    "content": "//\n//  MJRefreshTrailer.h\n//  MJRefresh\n//\n//  Created by kinarobin on 2020/5/3.\n//  Copyright © 2020 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshComponent.h>)\n#import <MJRefresh/MJRefreshComponent.h>\n#else\n#import \"MJRefreshComponent.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshTrailer : MJRefreshComponent\n\n/** 创建trailer*/\n+ (instancetype)trailerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock;\n/** 创建trailer */\n+ (instancetype)trailerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;\n\n/** 忽略多少scrollView的contentInset的right */\n@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetRight;\n\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Base/MJRefreshTrailer.m",
    "content": "//\n//  MJRefreshTrailer.m\n//  MJRefresh\n//\n//  Created by kinarobin on 2020/5/3.\n//  Copyright © 2020 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshTrailer.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n#import \"UIScrollView+MJExtension.h\"\n\n@interface MJRefreshTrailer()\n@property (assign, nonatomic) NSInteger lastRefreshCount;\n@property (assign, nonatomic) CGFloat lastRightDelta;\n@end\n\n@implementation MJRefreshTrailer\n\n#pragma mark - 构造方法\n+ (instancetype)trailerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock {\n    MJRefreshTrailer *cmp = [[self alloc] init];\n    cmp.refreshingBlock = refreshingBlock;\n    return cmp;\n}\n\n+ (instancetype)trailerWithRefreshingTarget:(id)target refreshingAction:(SEL)action {\n    MJRefreshTrailer *cmp = [[self alloc] init];\n    [cmp setRefreshingTarget:target refreshingAction:action];\n    return cmp;\n}\n\n- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change {\n    [super scrollViewContentOffsetDidChange:change];\n    \n    // 如果正在刷新，直接返回\n    if (self.state == MJRefreshStateRefreshing) return;\n    \n    _scrollViewOriginalInset = self.scrollView.mj_inset;\n    \n    // 当前的contentOffset\n    CGFloat currentOffsetX = self.scrollView.mj_offsetX;\n    // 尾部控件刚好出现的offsetX\n    CGFloat happenOffsetX = [self happenOffsetX];\n    // 如果是向右滚动到看不见右边控件，直接返回\n    if (currentOffsetX <= happenOffsetX) return;\n    \n    CGFloat pullingPercent = (currentOffsetX - happenOffsetX) / self.mj_w;\n    \n    // 如果已全部加载，仅设置pullingPercent，然后返回\n    if (self.state == MJRefreshStateNoMoreData) {\n        self.pullingPercent = pullingPercent;\n        return;\n    }\n    \n    if (self.scrollView.isDragging) {\n        self.pullingPercent = pullingPercent;\n        // 普通 和 即将刷新 的临界点\n        CGFloat normal2pullingOffsetX = happenOffsetX + self.mj_w;\n        \n        if (self.state == MJRefreshStateIdle && currentOffsetX > normal2pullingOffsetX) {\n            self.state = MJRefreshStatePulling;\n        } else if (self.state == MJRefreshStatePulling && currentOffsetX <= normal2pullingOffsetX) {\n            // 转为普通状态\n            self.state = MJRefreshStateIdle;\n        }\n    } else if (self.state == MJRefreshStatePulling) {// 即将刷新 && 手松开\n        // 开始刷新\n        [self beginRefreshing];\n    } else if (pullingPercent < 1) {\n        self.pullingPercent = pullingPercent;\n    }\n}\n\n- (void)setState:(MJRefreshState)state {\n    MJRefreshCheckState\n    // 根据状态来设置属性\n    if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) {\n        // 刷新完毕\n        if (MJRefreshStateRefreshing == oldState) {\n            [UIView animateWithDuration:self.slowAnimationDuration animations:^{\n                if (self.endRefreshingAnimationBeginAction) {\n                    self.endRefreshingAnimationBeginAction();\n                }\n                \n                self.scrollView.mj_insetR -= self.lastRightDelta;\n                // 自动调整透明度\n                if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0;\n            } completion:^(BOOL finished) {\n                self.pullingPercent = 0.0;\n                \n                if (self.endRefreshingCompletionBlock) {\n                    self.endRefreshingCompletionBlock();\n                }\n            }];\n        }\n        \n        CGFloat deltaW = [self widthForContentBreakView];\n        // 刚刷新完毕\n        if (MJRefreshStateRefreshing == oldState && deltaW > 0 && self.scrollView.mj_totalDataCount != self.lastRefreshCount) {\n            self.scrollView.mj_offsetX = self.scrollView.mj_offsetX;\n        }\n    } else if (state == MJRefreshStateRefreshing) {\n        // 记录刷新前的数量\n        self.lastRefreshCount = self.scrollView.mj_totalDataCount;\n        \n        [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n            CGFloat right = self.mj_w + self.scrollViewOriginalInset.right;\n            CGFloat deltaW = [self widthForContentBreakView];\n            if (deltaW < 0) { // 如果内容宽度小于view的宽度\n                right -= deltaW;\n            }\n            self.lastRightDelta = right - self.scrollView.mj_insetR;\n            self.scrollView.mj_insetR = right;\n            \n            // 设置滚动位置\n            CGPoint offset = self.scrollView.contentOffset;\n            offset.x = [self happenOffsetX] + self.mj_w;\n            [self.scrollView setContentOffset:offset animated:NO];\n        } completion:^(BOOL finished) {\n            [self executeRefreshingCallback];\n        }];\n    }\n}\n\n- (void)scrollViewContentSizeDidChange:(NSDictionary *)change {\n    [super scrollViewContentSizeDidChange:change];\n    \n    // 内容的宽度\n    CGFloat contentWidth = self.scrollView.mj_contentW + self.ignoredScrollViewContentInsetRight;\n    // 表格的宽度\n    CGFloat scrollWidth = self.scrollView.mj_w - self.scrollViewOriginalInset.left - self.scrollViewOriginalInset.right + self.ignoredScrollViewContentInsetRight;\n    // 设置位置和尺寸\n    self.mj_x = MAX(contentWidth, scrollWidth);\n}\n\n- (void)placeSubviews {\n    [super placeSubviews];\n    \n    self.mj_h = _scrollView.mj_h;\n    // 设置自己的宽度\n    self.mj_w = MJRefreshTrailWidth;\n}\n\n- (void)willMoveToSuperview:(UIView *)newSuperview {\n    [super willMoveToSuperview:newSuperview];\n    \n    if (newSuperview) {\n        // 设置支持水平弹簧效果\n        _scrollView.alwaysBounceHorizontal = YES;\n        _scrollView.alwaysBounceVertical = NO;\n    }\n}\n\n#pragma mark . 链式语法部分 .\n\n- (instancetype)linkTo:(UIScrollView *)scrollView {\n    scrollView.mj_trailer = self;\n    return self;\n}\n\n#pragma mark - 刚好看到上拉刷新控件时的contentOffset.x\n- (CGFloat)happenOffsetX {\n    CGFloat deltaW = [self widthForContentBreakView];\n    if (deltaW > 0) {\n        return deltaW - self.scrollViewOriginalInset.left;\n    } else {\n        return - self.scrollViewOriginalInset.left;\n    }\n}\n\n#pragma mark 获得scrollView的内容 超出 view 的宽度\n- (CGFloat)widthForContentBreakView {\n    CGFloat w = self.scrollView.frame.size.width - self.scrollViewOriginalInset.right - self.scrollViewOriginalInset.left;\n    return self.scrollView.contentSize.width - w;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h",
    "content": "//\n//  MJRefreshAutoGifFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshAutoStateFooter.h>)\n#import <MJRefresh/MJRefreshAutoStateFooter.h>\n#else\n#import \"MJRefreshAutoStateFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshAutoGifFooter : MJRefreshAutoStateFooter\n@property (weak, nonatomic, readonly) UIImageView *gifView;\n\n/** 设置state状态下的动画图片images 动画持续时间duration*/\n- (instancetype)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;\n- (instancetype)setImages:(NSArray *)images forState:(MJRefreshState)state;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.m",
    "content": "//\n//  MJRefreshAutoGifFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshAutoGifFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n\n@interface MJRefreshAutoGifFooter()\n{\n    __unsafe_unretained UIImageView *_gifView;\n}\n/** 所有状态对应的动画图片 */\n@property (strong, nonatomic) NSMutableDictionary *stateImages;\n/** 所有状态对应的动画时间 */\n@property (strong, nonatomic) NSMutableDictionary *stateDurations;\n@end\n\n@implementation MJRefreshAutoGifFooter\n#pragma mark - 懒加载\n- (UIImageView *)gifView\n{\n    if (!_gifView) {\n        UIImageView *gifView = [[UIImageView alloc] init];\n        [self addSubview:_gifView = gifView];\n    }\n    return _gifView;\n}\n\n- (NSMutableDictionary *)stateImages\n{\n    if (!_stateImages) {\n        self.stateImages = [NSMutableDictionary dictionary];\n    }\n    return _stateImages;\n}\n\n- (NSMutableDictionary *)stateDurations\n{\n    if (!_stateDurations) {\n        self.stateDurations = [NSMutableDictionary dictionary];\n    }\n    return _stateDurations;\n}\n\n#pragma mark - 公共方法\n- (instancetype)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state\n{\n    if (images == nil) return self;\n    \n    self.stateImages[@(state)] = images;\n    self.stateDurations[@(state)] = @(duration);\n    \n    /* 根据图片设置控件的高度 */\n    UIImage *image = [images firstObject];\n    if (image.size.height > self.mj_h) {\n        self.mj_h = image.size.height;\n    }\n    return self;\n}\n\n- (instancetype)setImages:(NSArray *)images forState:(MJRefreshState)state\n{\n    return [self setImages:images duration:images.count * 0.1 forState:state];\n}\n\n#pragma mark - 实现父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 初始化间距\n    self.labelLeftInset = 20;\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    if (self.gifView.constraints.count) return;\n    \n    self.gifView.frame = self.bounds;\n    if (self.isRefreshingTitleHidden) {\n        self.gifView.contentMode = UIViewContentModeCenter;\n    } else {\n        self.gifView.contentMode = UIViewContentModeRight;\n        self.gifView.mj_w = self.mj_w * 0.5 - self.labelLeftInset - self.stateLabel.mj_textWidth * 0.5;\n    }\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态做事情\n    if (state == MJRefreshStateRefreshing) {\n        NSArray *images = self.stateImages[@(state)];\n        if (images.count == 0) return;\n        [self.gifView stopAnimating];\n        \n        self.gifView.hidden = NO;\n        if (images.count == 1) { // 单张图片\n            self.gifView.image = [images lastObject];\n        } else { // 多张图片\n            self.gifView.animationImages = images;\n            self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue];\n            [self.gifView startAnimating];\n        }\n    } else if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) {\n        [self.gifView stopAnimating];\n        self.gifView.hidden = YES;\n    }\n}\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h",
    "content": "//\n//  MJRefreshAutoNormalFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshAutoStateFooter.h>)\n#import <MJRefresh/MJRefreshAutoStateFooter.h>\n#else\n#import \"MJRefreshAutoStateFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshAutoNormalFooter : MJRefreshAutoStateFooter\n@property (weak, nonatomic, readonly) UIActivityIndicatorView *loadingView;\n\n/** 菊花的样式 */\n@property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle MJRefreshDeprecated(\"first deprecated in 3.2.2 - Use `loadingView` property\");\n@end\n\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.m",
    "content": "//\n//  MJRefreshAutoNormalFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshAutoNormalFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n\n@interface MJRefreshAutoNormalFooter()\n@property (weak, nonatomic) UIActivityIndicatorView *loadingView;\n@end\n\n@implementation MJRefreshAutoNormalFooter\n#pragma mark - 懒加载子控件\n- (UIActivityIndicatorView *)loadingView\n{\n    if (!_loadingView) {\n        UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:_activityIndicatorViewStyle];\n        loadingView.hidesWhenStopped = YES;\n        [self addSubview:_loadingView = loadingView];\n    }\n    return _loadingView;\n}\n\n- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle\n{\n    _activityIndicatorViewStyle = activityIndicatorViewStyle;\n    \n    [self.loadingView removeFromSuperview];\n    self.loadingView = nil;\n    [self setNeedsLayout];\n}\n#pragma mark - 重写父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000\n    if (@available(iOS 13.0, *)) {\n        _activityIndicatorViewStyle = UIActivityIndicatorViewStyleMedium;\n        return;\n    }\n#endif\n        \n    _activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    if (self.loadingView.constraints.count) return;\n    \n    // 圈圈\n    CGFloat loadingCenterX = self.mj_w * 0.5;\n    if (!self.isRefreshingTitleHidden) {\n        loadingCenterX -= self.stateLabel.mj_textWidth * 0.5 + self.labelLeftInset;\n    }\n    CGFloat loadingCenterY = self.mj_h * 0.5;\n    self.loadingView.center = CGPointMake(loadingCenterX, loadingCenterY);\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态做事情\n    if (state == MJRefreshStateNoMoreData || state == MJRefreshStateIdle) {\n        [self.loadingView stopAnimating];\n    } else if (state == MJRefreshStateRefreshing) {\n        [self.loadingView startAnimating];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h",
    "content": "//\n//  MJRefreshAutoStateFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/6/13.\n//  Copyright © 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshAutoFooter.h>)\n#import <MJRefresh/MJRefreshAutoFooter.h>\n#else\n#import \"MJRefreshAutoFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshAutoStateFooter : MJRefreshAutoFooter\n/** 文字距离圈圈、箭头的距离 */\n@property (assign, nonatomic) CGFloat labelLeftInset;\n/** 显示刷新状态的label */\n@property (weak, nonatomic, readonly) UILabel *stateLabel;\n\n/** 设置state状态下的文字 */\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state;\n\n/** 隐藏刷新状态的文字 */\n@property (assign, nonatomic, getter=isRefreshingTitleHidden) BOOL refreshingTitleHidden;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.m",
    "content": "//\n//  MJRefreshAutoStateFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/6/13.\n//  Copyright © 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshAutoStateFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n\n@interface MJRefreshAutoFooter (TapTriggerFix)\n\n- (void)beginRefreshingWithoutValidation;\n@end\n\n\n@implementation MJRefreshAutoFooter (TapTriggerFix)\n\n- (void)beginRefreshingWithoutValidation {\n    [super beginRefreshing];\n}\n\n@end\n\n@interface MJRefreshAutoStateFooter()\n{\n    /** 显示刷新状态的label */\n    __unsafe_unretained UILabel *_stateLabel;\n}\n/** 所有状态对应的文字 */\n@property (strong, nonatomic) NSMutableDictionary *stateTitles;\n@end\n\n@implementation MJRefreshAutoStateFooter\n#pragma mark - 懒加载\n- (NSMutableDictionary *)stateTitles\n{\n    if (!_stateTitles) {\n        self.stateTitles = [NSMutableDictionary dictionary];\n    }\n    return _stateTitles;\n}\n\n- (UILabel *)stateLabel\n{\n    if (!_stateLabel) {\n        [self addSubview:_stateLabel = [UILabel mj_label]];\n    }\n    return _stateLabel;\n}\n\n#pragma mark - 公共方法\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state\n{\n    if (title == nil) return self;\n    self.stateTitles[@(state)] = title;\n    self.stateLabel.text = self.stateTitles[@(self.state)];\n    return self;\n}\n\n#pragma mark - 私有方法\n- (void)stateLabelClick\n{\n    if (self.state == MJRefreshStateIdle) {\n        [super beginRefreshingWithoutValidation];\n    }\n}\n\n- (void)textConfiguration {\n    // 初始化文字\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterIdleText] forState:MJRefreshStateIdle];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterRefreshingText] forState:MJRefreshStateRefreshing];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshAutoFooterNoMoreDataText] forState:MJRefreshStateNoMoreData];\n}\n\n#pragma mark - 重写父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 初始化间距\n    self.labelLeftInset = MJRefreshLabelLeftInset;\n    \n    [self textConfiguration];\n    \n    // 监听label\n    self.stateLabel.userInteractionEnabled = YES;\n    [self.stateLabel addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(stateLabelClick)]];\n}\n\n- (void)i18nDidChange {\n    [self textConfiguration];\n    \n    [super i18nDidChange];\n}\n\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    if (self.stateLabel.constraints.count) return;\n    \n    // 状态标签\n    self.stateLabel.frame = self.bounds;\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    if (self.isRefreshingTitleHidden && state == MJRefreshStateRefreshing) {\n        self.stateLabel.text = nil;\n    } else {\n        self.stateLabel.text = self.stateTitles[@(state)];\n    }\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h",
    "content": "//\n//  MJRefreshBackGifFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshBackStateFooter.h>)\n#import <MJRefresh/MJRefreshBackStateFooter.h>\n#else\n#import \"MJRefreshBackStateFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshBackGifFooter : MJRefreshBackStateFooter\n@property (weak, nonatomic, readonly) UIImageView *gifView;\n\n/** 设置state状态下的动画图片images 动画持续时间duration*/\n- (instancetype)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;\n- (instancetype)setImages:(NSArray *)images forState:(MJRefreshState)state;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.m",
    "content": "//\n//  MJRefreshBackGifFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshBackGifFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n\n@interface MJRefreshBackGifFooter()\n{\n    __unsafe_unretained UIImageView *_gifView;\n}\n/** 所有状态对应的动画图片 */\n@property (strong, nonatomic) NSMutableDictionary *stateImages;\n/** 所有状态对应的动画时间 */\n@property (strong, nonatomic) NSMutableDictionary *stateDurations;\n@end\n\n@implementation MJRefreshBackGifFooter\n#pragma mark - 懒加载\n- (UIImageView *)gifView\n{\n    if (!_gifView) {\n        UIImageView *gifView = [[UIImageView alloc] init];\n        [self addSubview:_gifView = gifView];\n    }\n    return _gifView;\n}\n\n- (NSMutableDictionary *)stateImages\n{\n    if (!_stateImages) {\n        self.stateImages = [NSMutableDictionary dictionary];\n    }\n    return _stateImages;\n}\n\n- (NSMutableDictionary *)stateDurations\n{\n    if (!_stateDurations) {\n        self.stateDurations = [NSMutableDictionary dictionary];\n    }\n    return _stateDurations;\n}\n\n#pragma mark - 公共方法\n- (instancetype)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state\n{\n    if (images == nil) return self;\n    \n    self.stateImages[@(state)] = images;\n    self.stateDurations[@(state)] = @(duration);\n    \n    /* 根据图片设置控件的高度 */\n    UIImage *image = [images firstObject];\n    if (image.size.height > self.mj_h) {\n        self.mj_h = image.size.height;\n    }\n    return self;\n}\n\n- (instancetype)setImages:(NSArray *)images forState:(MJRefreshState)state\n{\n    return [self setImages:images duration:images.count * 0.1 forState:state];\n}\n\n#pragma mark - 实现父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 初始化间距\n    self.labelLeftInset = 20;\n}\n\n- (void)setPullingPercent:(CGFloat)pullingPercent\n{\n    [super setPullingPercent:pullingPercent];\n    NSArray *images = self.stateImages[@(MJRefreshStateIdle)];\n    if (self.state != MJRefreshStateIdle || images.count == 0) return;\n    [self.gifView stopAnimating];\n    NSUInteger index =  images.count * pullingPercent;\n    if (index >= images.count) index = images.count - 1;\n    self.gifView.image = images[index];\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    if (self.gifView.constraints.count) return;\n    \n    self.gifView.frame = self.bounds;\n    if (self.stateLabel.hidden) {\n        self.gifView.contentMode = UIViewContentModeCenter;\n    } else {\n        self.gifView.contentMode = UIViewContentModeRight;\n        self.gifView.mj_w = self.mj_w * 0.5 - self.labelLeftInset - self.stateLabel.mj_textWidth * 0.5;\n    }\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态做事情\n    if (state == MJRefreshStatePulling || state == MJRefreshStateRefreshing) {\n        NSArray *images = self.stateImages[@(state)];\n        if (images.count == 0) return;\n        \n        self.gifView.hidden = NO;\n        [self.gifView stopAnimating];\n        if (images.count == 1) { // 单张图片\n            self.gifView.image = [images lastObject];\n        } else { // 多张图片\n            self.gifView.animationImages = images;\n            self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue];\n            [self.gifView startAnimating];\n        }\n    } else if (state == MJRefreshStateIdle) {\n        self.gifView.hidden = NO;\n    } else if (state == MJRefreshStateNoMoreData) {\n        self.gifView.hidden = YES;\n    }\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h",
    "content": "//\n//  MJRefreshBackNormalFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshBackStateFooter.h>)\n#import <MJRefresh/MJRefreshBackStateFooter.h>\n#else\n#import \"MJRefreshBackStateFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshBackNormalFooter : MJRefreshBackStateFooter\n@property (weak, nonatomic, readonly) UIImageView *arrowView;\n@property (weak, nonatomic, readonly) UIActivityIndicatorView *loadingView;\n\n/** 菊花的样式 */\n@property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle MJRefreshDeprecated(\"first deprecated in 3.2.2 - Use `loadingView` property\");\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.m",
    "content": "//\n//  MJRefreshBackNormalFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshBackNormalFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n\n@interface MJRefreshBackNormalFooter()\n{\n    __unsafe_unretained UIImageView *_arrowView;\n}\n@property (weak, nonatomic) UIActivityIndicatorView *loadingView;\n@end\n\n@implementation MJRefreshBackNormalFooter\n#pragma mark - 懒加载子控件\n- (UIImageView *)arrowView\n{\n    if (!_arrowView) {\n        UIImageView *arrowView = [[UIImageView alloc] initWithImage:[NSBundle mj_arrowImage]];\n        [self addSubview:_arrowView = arrowView];\n    }\n    return _arrowView;\n}\n\n\n- (UIActivityIndicatorView *)loadingView\n{\n    if (!_loadingView) {\n        UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:_activityIndicatorViewStyle];\n        loadingView.hidesWhenStopped = YES;\n        [self addSubview:_loadingView = loadingView];\n    }\n    return _loadingView;\n}\n\n- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle\n{\n    _activityIndicatorViewStyle = activityIndicatorViewStyle;\n    \n    [self.loadingView removeFromSuperview];\n    self.loadingView = nil;\n    [self setNeedsLayout];\n}\n#pragma mark - 重写父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000\n    if (@available(iOS 13.0, *)) {\n        _activityIndicatorViewStyle = UIActivityIndicatorViewStyleMedium;\n        return;\n    }\n#endif\n        \n    _activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    // 箭头的中心点\n    CGFloat arrowCenterX = self.mj_w * 0.5;\n    if (!self.stateLabel.hidden) {\n        arrowCenterX -= self.labelLeftInset + self.stateLabel.mj_textWidth * 0.5;\n    }\n    CGFloat arrowCenterY = self.mj_h * 0.5;\n    CGPoint arrowCenter = CGPointMake(arrowCenterX, arrowCenterY);\n    \n    // 箭头\n    if (self.arrowView.constraints.count == 0) {\n        self.arrowView.mj_size = self.arrowView.image.size;\n        self.arrowView.center = arrowCenter;\n    }\n    \n    // 圈圈\n    if (self.loadingView.constraints.count == 0) {\n        self.loadingView.center = arrowCenter;\n    }\n    \n    self.arrowView.tintColor = self.stateLabel.textColor;\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态做事情\n    if (state == MJRefreshStateIdle) {\n        if (oldState == MJRefreshStateRefreshing) {\n            self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI);\n            [UIView animateWithDuration:self.slowAnimationDuration animations:^{\n                self.loadingView.alpha = 0.0;\n            } completion:^(BOOL finished) {\n                // 防止动画结束后，状态已经不是MJRefreshStateIdle\n                if (self.state != MJRefreshStateIdle) return;\n                \n                self.loadingView.alpha = 1.0;\n                [self.loadingView stopAnimating];\n                \n                self.arrowView.hidden = NO;\n            }];\n        } else {\n            self.arrowView.hidden = NO;\n            [self.loadingView stopAnimating];\n            [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n                self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI);\n            }];\n        }\n    } else if (state == MJRefreshStatePulling) {\n        self.arrowView.hidden = NO;\n        [self.loadingView stopAnimating];\n        [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n            self.arrowView.transform = CGAffineTransformIdentity;\n        }];\n    } else if (state == MJRefreshStateRefreshing) {\n        self.arrowView.hidden = YES;\n        [self.loadingView startAnimating];\n    } else if (state == MJRefreshStateNoMoreData) {\n        self.arrowView.hidden = YES;\n        [self.loadingView stopAnimating];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h",
    "content": "//\n//  MJRefreshBackStateFooter.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/6/13.\n//  Copyright © 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshBackFooter.h>)\n#import <MJRefresh/MJRefreshBackFooter.h>\n#else\n#import \"MJRefreshBackFooter.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshBackStateFooter : MJRefreshBackFooter\n/** 文字距离圈圈、箭头的距离 */\n@property (assign, nonatomic) CGFloat labelLeftInset;\n/** 显示刷新状态的label */\n@property (weak, nonatomic, readonly) UILabel *stateLabel;\n/** 设置state状态下的文字 */\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state;\n\n/** 获取state状态下的title */\n- (NSString *)titleForState:(MJRefreshState)state;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.m",
    "content": "//\n//  MJRefreshBackStateFooter.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/6/13.\n//  Copyright © 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshBackStateFooter.h\"\n#import \"NSBundle+MJRefresh.h\"\n\n@interface MJRefreshBackStateFooter()\n{\n    /** 显示刷新状态的label */\n    __unsafe_unretained UILabel *_stateLabel;\n}\n/** 所有状态对应的文字 */\n@property (strong, nonatomic) NSMutableDictionary *stateTitles;\n@end\n\n@implementation MJRefreshBackStateFooter\n#pragma mark - 懒加载\n- (NSMutableDictionary *)stateTitles\n{\n    if (!_stateTitles) {\n        self.stateTitles = [NSMutableDictionary dictionary];\n    }\n    return _stateTitles;\n}\n\n- (UILabel *)stateLabel\n{\n    if (!_stateLabel) {\n        [self addSubview:_stateLabel = [UILabel mj_label]];\n    }\n    return _stateLabel;\n}\n\n#pragma mark - 公共方法\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state\n{\n    if (title == nil) return self;\n    self.stateTitles[@(state)] = title;\n    self.stateLabel.text = self.stateTitles[@(self.state)];\n    return self;\n}\n\n- (NSString *)titleForState:(MJRefreshState)state {\n  return self.stateTitles[@(state)];\n}\n\n- (void)textConfiguration {\n    // 初始化文字\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterIdleText] forState:MJRefreshStateIdle];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterPullingText] forState:MJRefreshStatePulling];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterRefreshingText] forState:MJRefreshStateRefreshing];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshBackFooterNoMoreDataText] forState:MJRefreshStateNoMoreData];\n}\n\n#pragma mark - 重写父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 初始化间距\n    self.labelLeftInset = MJRefreshLabelLeftInset;\n    [self textConfiguration];\n}\n\n- (void)i18nDidChange {\n    [self textConfiguration];\n    \n    [super i18nDidChange];\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    if (self.stateLabel.constraints.count) return;\n    \n    // 状态标签\n    self.stateLabel.frame = self.bounds;\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 设置状态文字\n    self.stateLabel.text = self.stateTitles[@(state)];\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.h",
    "content": "//\n//  MJRefreshGifHeader.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshStateHeader.h>)\n#import <MJRefresh/MJRefreshStateHeader.h>\n#else\n#import \"MJRefreshStateHeader.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshGifHeader : MJRefreshStateHeader\n@property (weak, nonatomic, readonly) UIImageView *gifView;\n\n/** 设置state状态下的动画图片images 动画持续时间duration*/\n- (instancetype)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;\n- (instancetype)setImages:(NSArray *)images forState:(MJRefreshState)state;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshGifHeader.m",
    "content": "//\n//  MJRefreshGifHeader.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshGifHeader.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n\n@interface MJRefreshGifHeader()\n{\n    __unsafe_unretained UIImageView *_gifView;\n}\n/** 所有状态对应的动画图片 */\n@property (strong, nonatomic) NSMutableDictionary *stateImages;\n/** 所有状态对应的动画时间 */\n@property (strong, nonatomic) NSMutableDictionary *stateDurations;\n@end\n\n@implementation MJRefreshGifHeader\n#pragma mark - 懒加载\n- (UIImageView *)gifView\n{\n    if (!_gifView) { \n        UIImageView *gifView = [[UIImageView alloc] init]; \n        [self addSubview:_gifView = gifView]; \n    } \n    return _gifView; \n}\n\n- (NSMutableDictionary *)stateImages \n{ \n    if (!_stateImages) { \n        self.stateImages = [NSMutableDictionary dictionary]; \n    } \n    return _stateImages; \n}\n\n- (NSMutableDictionary *)stateDurations \n{ \n    if (!_stateDurations) { \n        self.stateDurations = [NSMutableDictionary dictionary]; \n    } \n    return _stateDurations; \n}\n\n#pragma mark - 公共方法\n- (instancetype)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state {\n    if (images == nil) return self;\n    \n    self.stateImages[@(state)] = images;\n    self.stateDurations[@(state)] = @(duration);\n    \n    /* 根据图片设置控件的高度 */ \n    UIImage *image = [images firstObject];\n    if (image.size.height > self.mj_h) {\n        self.mj_h = image.size.height;\n    }\n    return self;\n}\n\n- (instancetype)setImages:(NSArray *)images forState:(MJRefreshState)state \n{ \n    return [self setImages:images duration:images.count * 0.1 forState:state];\n}\n\n#pragma mark - 实现父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 初始化间距\n    self.labelLeftInset = 20;\n}\n\n- (void)setPullingPercent:(CGFloat)pullingPercent\n{\n    [super setPullingPercent:pullingPercent];\n    NSArray *images = self.stateImages[@(MJRefreshStateIdle)];\n    if (self.state != MJRefreshStateIdle || images.count == 0) return;\n    // 停止动画\n    [self.gifView stopAnimating];\n    // 设置当前需要显示的图片\n    NSUInteger index =  images.count * pullingPercent;\n    if (index >= images.count) index = images.count - 1;\n    self.gifView.image = images[index];\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    if (self.gifView.constraints.count) return;\n    \n    self.gifView.frame = self.bounds;\n    if (self.stateLabel.hidden && self.lastUpdatedTimeLabel.hidden) {\n        self.gifView.contentMode = UIViewContentModeCenter;\n    } else {\n        self.gifView.contentMode = UIViewContentModeRight;\n        \n        CGFloat stateWidth = self.stateLabel.mj_textWidth;\n        CGFloat timeWidth = 0.0;\n        if (!self.lastUpdatedTimeLabel.hidden) {\n            timeWidth = self.lastUpdatedTimeLabel.mj_textWidth;\n        }\n        CGFloat textWidth = MAX(stateWidth, timeWidth);\n        self.gifView.mj_w = self.mj_w * 0.5 - textWidth * 0.5 - self.labelLeftInset;\n    }\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态做事情\n    if (state == MJRefreshStatePulling || state == MJRefreshStateRefreshing) {\n        NSArray *images = self.stateImages[@(state)];\n        if (images.count == 0) return;\n        \n        [self.gifView stopAnimating];\n        if (images.count == 1) { // 单张图片\n            self.gifView.image = [images lastObject];\n        } else { // 多张图片\n            self.gifView.animationImages = images;\n            self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue];\n            [self.gifView startAnimating];\n        }\n    } else if (state == MJRefreshStateIdle) {\n        [self.gifView stopAnimating];\n    }\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.h",
    "content": "//\n//  MJRefreshNormalHeader.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshStateHeader.h>)\n#import <MJRefresh/MJRefreshStateHeader.h>\n#else\n#import \"MJRefreshStateHeader.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshNormalHeader : MJRefreshStateHeader\n@property (weak, nonatomic, readonly) UIImageView *arrowView;\n@property (weak, nonatomic, readonly) UIActivityIndicatorView *loadingView;\n\n\n/** 菊花的样式 */\n@property (assign, nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle MJRefreshDeprecated(\"first deprecated in 3.2.2 - Use `loadingView` property\");\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshNormalHeader.m",
    "content": "//\n//  MJRefreshNormalHeader.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshNormalHeader.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIScrollView+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n\n@interface MJRefreshNormalHeader()\n{\n    __unsafe_unretained UIImageView *_arrowView;\n}\n@property (weak, nonatomic) UIActivityIndicatorView *loadingView;\n@end\n\n@implementation MJRefreshNormalHeader\n#pragma mark - 懒加载子控件\n- (UIImageView *)arrowView\n{\n    if (!_arrowView) {\n        UIImageView *arrowView = [[UIImageView alloc] initWithImage:[NSBundle mj_arrowImage]];\n        [self addSubview:_arrowView = arrowView];\n    }\n    return _arrowView;\n}\n\n- (UIActivityIndicatorView *)loadingView\n{\n    if (!_loadingView) {\n        UIActivityIndicatorView *loadingView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:_activityIndicatorViewStyle];\n        loadingView.hidesWhenStopped = YES;\n        [self addSubview:_loadingView = loadingView];\n    }\n    return _loadingView;\n}\n\n#pragma mark - 公共方法\n- (void)setActivityIndicatorViewStyle:(UIActivityIndicatorViewStyle)activityIndicatorViewStyle\n{\n    _activityIndicatorViewStyle = activityIndicatorViewStyle;\n    \n    [self.loadingView removeFromSuperview];\n    self.loadingView = nil;\n    [self setNeedsLayout];\n}\n\n#pragma mark - 重写父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000\n    if (@available(iOS 13.0, *)) {\n        _activityIndicatorViewStyle = UIActivityIndicatorViewStyleMedium;\n        return;\n    }\n#endif\n    \n    _activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    // 箭头的中心点\n    CGFloat arrowCenterX = self.mj_w * 0.5;\n    if (!self.stateLabel.hidden) {\n        CGFloat stateWidth = self.stateLabel.mj_textWidth;\n        CGFloat timeWidth = 0.0;\n        if (!self.lastUpdatedTimeLabel.hidden) {\n            timeWidth = self.lastUpdatedTimeLabel.mj_textWidth;\n        }\n        CGFloat textWidth = MAX(stateWidth, timeWidth);\n        arrowCenterX -= textWidth / 2 + self.labelLeftInset;\n    }\n    CGFloat arrowCenterY = self.mj_h * 0.5;\n    CGPoint arrowCenter = CGPointMake(arrowCenterX, arrowCenterY);\n    \n    // 箭头\n    if (self.arrowView.constraints.count == 0) {\n        self.arrowView.mj_size = self.arrowView.image.size;\n        self.arrowView.center = arrowCenter;\n    }\n        \n    // 圈圈\n    if (self.loadingView.constraints.count == 0) {\n        self.loadingView.center = arrowCenter;\n    }\n    \n    self.arrowView.tintColor = self.stateLabel.textColor;\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 根据状态做事情\n    if (state == MJRefreshStateIdle) {\n        if (oldState == MJRefreshStateRefreshing) {\n            self.arrowView.transform = CGAffineTransformIdentity;\n            \n            [UIView animateWithDuration:self.slowAnimationDuration animations:^{\n                self.loadingView.alpha = 0.0;\n            } completion:^(BOOL finished) {\n                // 如果执行完动画发现不是idle状态，就直接返回，进入其他状态\n                if (self.state != MJRefreshStateIdle) return;\n                \n                self.loadingView.alpha = 1.0;\n                [self.loadingView stopAnimating];\n                self.arrowView.hidden = NO;\n            }];\n        } else {\n            [self.loadingView stopAnimating];\n            self.arrowView.hidden = NO;\n            [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n                self.arrowView.transform = CGAffineTransformIdentity;\n            }];\n        }\n    } else if (state == MJRefreshStatePulling) {\n        [self.loadingView stopAnimating];\n        self.arrowView.hidden = NO;\n        [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n            self.arrowView.transform = CGAffineTransformMakeRotation(0.000001 - M_PI);\n        }];\n    } else if (state == MJRefreshStateRefreshing) {\n        self.loadingView.alpha = 1.0; // 防止refreshing -> idle的动画完毕动作没有被执行\n        [self.loadingView startAnimating];\n        self.arrowView.hidden = YES;\n    }\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.h",
    "content": "//\n//  MJRefreshStateHeader.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshHeader.h>)\n#import <MJRefresh/MJRefreshHeader.h>\n#else\n#import \"MJRefreshHeader.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshStateHeader : MJRefreshHeader\n#pragma mark - 刷新时间相关\n/** 利用这个block来决定显示的更新时间文字 */\n@property (copy, nonatomic, nullable) NSString *(^lastUpdatedTimeText)(NSDate * _Nullable lastUpdatedTime);\n/** 显示上一次刷新时间的label */\n@property (weak, nonatomic, readonly) UILabel *lastUpdatedTimeLabel;\n\n#pragma mark - 状态相关\n/** 文字距离圈圈、箭头的距离 */\n@property (assign, nonatomic) CGFloat labelLeftInset;\n/** 显示刷新状态的label */\n@property (weak, nonatomic, readonly) UILabel *stateLabel;\n/** 设置state状态下的文字 */\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state;\n@end\n\n@interface MJRefreshStateHeader (ChainingGrammar)\n\n- (instancetype)modifyLastUpdatedTimeText:(NSString * (^)(NSDate * _Nullable lastUpdatedTime))handler;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Header/MJRefreshStateHeader.m",
    "content": "//\n//  MJRefreshStateHeader.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/4/24.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshStateHeader.h\"\n#import \"MJRefreshConst.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n#import \"UIScrollView+MJExtension.h\"\n\n@interface MJRefreshStateHeader()\n{\n    /** 显示上一次刷新时间的label */\n    __unsafe_unretained UILabel *_lastUpdatedTimeLabel;\n    /** 显示刷新状态的label */\n    __unsafe_unretained UILabel *_stateLabel;\n}\n/** 所有状态对应的文字 */\n@property (strong, nonatomic) NSMutableDictionary *stateTitles;\n@end\n\n@implementation MJRefreshStateHeader\n#pragma mark - 懒加载\n- (NSMutableDictionary *)stateTitles\n{\n    if (!_stateTitles) {\n        self.stateTitles = [NSMutableDictionary dictionary];\n    }\n    return _stateTitles;\n}\n\n- (UILabel *)stateLabel\n{\n    if (!_stateLabel) {\n        [self addSubview:_stateLabel = [UILabel mj_label]];\n    }\n    return _stateLabel;\n}\n\n- (UILabel *)lastUpdatedTimeLabel\n{\n    if (!_lastUpdatedTimeLabel) {\n        [self addSubview:_lastUpdatedTimeLabel = [UILabel mj_label]];\n    }\n    return _lastUpdatedTimeLabel;\n}\n\n- (void)setLastUpdatedTimeText:(NSString * _Nonnull (^)(NSDate * _Nullable))lastUpdatedTimeText{\n    _lastUpdatedTimeText = lastUpdatedTimeText;\n    // 重新设置key（重新显示时间）\n    self.lastUpdatedTimeKey = self.lastUpdatedTimeKey;\n}\n\n#pragma mark - 公共方法\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state\n{\n    if (title == nil) return self;\n    self.stateTitles[@(state)] = title;\n    self.stateLabel.text = self.stateTitles[@(self.state)];\n    return self;\n}\n\n#pragma mark key的处理\n- (void)setLastUpdatedTimeKey:(NSString *)lastUpdatedTimeKey\n{\n    [super setLastUpdatedTimeKey:lastUpdatedTimeKey];\n    \n    // 如果label隐藏了，就不用再处理\n    if (self.lastUpdatedTimeLabel.hidden) return;\n    \n    NSDate *lastUpdatedTime = [[NSUserDefaults standardUserDefaults] objectForKey:lastUpdatedTimeKey];\n    \n    // 如果有block\n    if (self.lastUpdatedTimeText) {\n        self.lastUpdatedTimeLabel.text = self.lastUpdatedTimeText(lastUpdatedTime);\n        return;\n    }\n    \n    if (lastUpdatedTime) {\n        // 1.获得年月日\n        NSCalendar *calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];\n        NSUInteger unitFlags = NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute;\n        NSDateComponents *cmp1 = [calendar components:unitFlags fromDate:lastUpdatedTime];\n        NSDateComponents *cmp2 = [calendar components:unitFlags fromDate:[NSDate date]];\n        \n        // 2.格式化日期\n        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];\n        BOOL isToday = NO;\n        if ([cmp1 day] == [cmp2 day]) { // 今天\n            formatter.dateFormat = @\" HH:mm\";\n            isToday = YES;\n        } else if ([cmp1 year] == [cmp2 year]) { // 今年\n            formatter.dateFormat = @\"MM-dd HH:mm\";\n        } else {\n            formatter.dateFormat = @\"yyyy-MM-dd HH:mm\";\n        }\n        NSString *time = [formatter stringFromDate:lastUpdatedTime];\n        \n        // 3.显示日期\n        self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@\"%@%@%@\",\n                                          [NSBundle mj_localizedStringForKey:MJRefreshHeaderLastTimeText],\n                                          isToday ? [NSBundle mj_localizedStringForKey:MJRefreshHeaderDateTodayText] : @\"\",\n                                          time];\n    } else {\n        self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@\"%@%@\",\n                                          [NSBundle mj_localizedStringForKey:MJRefreshHeaderLastTimeText],\n                                          [NSBundle mj_localizedStringForKey:MJRefreshHeaderNoneLastDateText]];\n    }\n}\n\n\n- (void)textConfiguration {\n    // 初始化文字\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderIdleText] forState:MJRefreshStateIdle];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderPullingText] forState:MJRefreshStatePulling];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshHeaderRefreshingText] forState:MJRefreshStateRefreshing];\n    self.lastUpdatedTimeKey = MJRefreshHeaderLastUpdatedTimeKey;\n}\n\n#pragma mark - 覆盖父类的方法\n- (void)prepare\n{\n    [super prepare];\n    \n    // 初始化间距\n    self.labelLeftInset = MJRefreshLabelLeftInset;\n    [self textConfiguration];\n}\n\n- (void)i18nDidChange {\n    [self textConfiguration];\n    \n    [super i18nDidChange];\n}\n\n- (void)placeSubviews\n{\n    [super placeSubviews];\n    \n    if (self.stateLabel.hidden) return;\n    \n    BOOL noConstrainsOnStatusLabel = self.stateLabel.constraints.count == 0;\n    \n    if (self.lastUpdatedTimeLabel.hidden) {\n        // 状态\n        if (noConstrainsOnStatusLabel) self.stateLabel.frame = self.bounds;\n    } else {\n        CGFloat stateLabelH = self.mj_h * 0.5;\n        // 状态\n        if (noConstrainsOnStatusLabel) {\n            self.stateLabel.mj_x = 0;\n            self.stateLabel.mj_y = 0;\n            self.stateLabel.mj_w = self.mj_w;\n            self.stateLabel.mj_h = stateLabelH;\n        }\n        \n        // 更新时间\n        if (self.lastUpdatedTimeLabel.constraints.count == 0) {\n            self.lastUpdatedTimeLabel.mj_x = 0;\n            self.lastUpdatedTimeLabel.mj_y = stateLabelH;\n            self.lastUpdatedTimeLabel.mj_w = self.mj_w;\n            self.lastUpdatedTimeLabel.mj_h = self.mj_h - self.lastUpdatedTimeLabel.mj_y;\n        }\n    }\n}\n\n- (void)setState:(MJRefreshState)state\n{\n    MJRefreshCheckState\n    \n    // 设置状态文字\n    self.stateLabel.text = self.stateTitles[@(state)];\n    \n    // 重新设置key（重新显示时间）\n    self.lastUpdatedTimeKey = self.lastUpdatedTimeKey;\n}\n@end\n\n#pragma mark - <<< 为 Swift 扩展链式语法 >>> -\n@implementation MJRefreshStateHeader (ChainingGrammar)\n\n- (instancetype)modifyLastUpdatedTimeText:(NSString * _Nonnull (^)(NSDate * _Nullable))handler {\n    self.lastUpdatedTimeText = handler;\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Trailer/MJRefreshNormalTrailer.h",
    "content": "//\n//  MJRefreshNormalTrailer.h\n//  MJRefresh\n//\n//  Created by kinarobin on 2020/5/3.\n//  Copyright © 2020 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshStateTrailer.h>)\n#import <MJRefresh/MJRefreshStateTrailer.h>\n#else\n#import \"MJRefreshStateTrailer.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshNormalTrailer : MJRefreshStateTrailer\n\n@property (weak, nonatomic, readonly) UIImageView *arrowView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Trailer/MJRefreshNormalTrailer.m",
    "content": "//\n//  MJRefreshNormalTrailer.m\n//  MJRefresh\n//\n//  Created by kinarobin on 2020/5/3.\n//  Copyright © 2020 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshNormalTrailer.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n\n@interface MJRefreshNormalTrailer() {\n    __unsafe_unretained UIImageView *_arrowView;\n}\n@end\n\n@implementation MJRefreshNormalTrailer\n#pragma mark - 懒加载子控件\n- (UIImageView *)arrowView {\n    if (!_arrowView) {\n        UIImageView *arrowView = [[UIImageView alloc] initWithImage:[NSBundle mj_trailArrowImage]];\n        [self addSubview:_arrowView = arrowView];\n    }\n    return _arrowView;\n}\n\n- (void)placeSubviews {\n    [super placeSubviews];\n\n    CGSize arrowSize = self.arrowView.image.size;\n    // 箭头的中心点\n    CGPoint selfCenter = CGPointMake(self.mj_w * 0.5, self.mj_h * 0.5);\n    CGPoint arrowCenter = CGPointMake(arrowSize.width * 0.5 + 5, self.mj_h * 0.5);\n    BOOL stateHidden = self.stateLabel.isHidden;\n    \n    if (self.arrowView.constraints.count == 0) {\n        self.arrowView.mj_size = self.arrowView.image.size;\n        self.arrowView.center = stateHidden ?  selfCenter : arrowCenter ;\n    }\n    self.arrowView.tintColor = self.stateLabel.textColor;\n    \n    if (stateHidden) return;\n    \n    BOOL noConstrainsOnStatusLabel = self.stateLabel.constraints.count == 0;\n    CGFloat stateLabelW = ceil(self.stateLabel.font.pointSize);\n    // 状态\n    if (noConstrainsOnStatusLabel) {\n        BOOL arrowHidden = self.arrowView.isHidden;\n        CGFloat stateCenterX = (self.mj_w + arrowSize.width) * 0.5;\n        self.stateLabel.center = arrowHidden ? selfCenter : CGPointMake(stateCenterX, self.mj_h * 0.5);\n        self.stateLabel.mj_size = CGSizeMake(stateLabelW, self.mj_h) ;\n    }\n}\n\n- (void)setState:(MJRefreshState)state {\n    MJRefreshCheckState\n    // 根据状态做事情\n    if (state == MJRefreshStateIdle) {\n        if (oldState == MJRefreshStateRefreshing) {\n            [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n                self.arrowView.transform = CGAffineTransformMakeRotation(M_PI);\n            } completion:^(BOOL finished) {\n                self.arrowView.transform = CGAffineTransformIdentity;\n            }];\n        } else {\n            [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n                self.arrowView.transform = CGAffineTransformIdentity;\n            }];\n        }\n    } else if (state == MJRefreshStatePulling) {\n        [UIView animateWithDuration:self.fastAnimationDuration animations:^{\n            self.arrowView.transform = CGAffineTransformMakeRotation(M_PI);\n        }];\n    }\n}\n\n\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Trailer/MJRefreshStateTrailer.h",
    "content": "//\n//  MJRefreshStateTrailer.h\n//  MJRefresh\n//\n//  Created by kinarobin on 2020/5/3.\n//  Copyright © 2020 小码哥. All rights reserved.\n//\n\n#if __has_include(<MJRefresh/MJRefreshTrailer.h>)\n#import <MJRefresh/MJRefreshTrailer.h>\n#else\n#import \"MJRefreshTrailer.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n\n@interface MJRefreshStateTrailer : MJRefreshTrailer\n\n#pragma mark - 状态相关\n/** 显示刷新状态的label */\n@property (weak, nonatomic, readonly) UILabel *stateLabel;\n/** 设置state状态下的文字 */\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/Custom/Trailer/MJRefreshStateTrailer.m",
    "content": "//\n//  MJRefreshStateTrailer.m\n//  MJRefresh\n//\n//  Created by kinarobin on 2020/5/3.\n//  Copyright © 2020 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshStateTrailer.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n\n@interface MJRefreshStateTrailer() {\n    /** 显示刷新状态的label */\n    __unsafe_unretained UILabel *_stateLabel;\n}\n/** 所有状态对应的文字 */\n@property (strong, nonatomic) NSMutableDictionary *stateTitles;\n@end\n\n@implementation MJRefreshStateTrailer\n#pragma mark - 懒加载\n- (NSMutableDictionary *)stateTitles {\n    if (!_stateTitles) {\n        self.stateTitles = [NSMutableDictionary dictionary];\n    }\n    return _stateTitles;\n}\n\n- (UILabel *)stateLabel {\n    if (!_stateLabel) {\n        UILabel *stateLabel = [UILabel mj_label];\n        stateLabel.numberOfLines = 0;\n        [self addSubview:_stateLabel = stateLabel];\n    }\n    return _stateLabel;\n}\n\n#pragma mark - 公共方法\n- (instancetype)setTitle:(NSString *)title forState:(MJRefreshState)state {\n    if (title == nil) return self;\n    self.stateTitles[@(state)] = title;\n    self.stateLabel.text = self.stateTitles[@(self.state)];\n    return self;\n}\n\n- (void)textConfiguration {\n    // 初始化文字\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshTrailerIdleText] forState:MJRefreshStateIdle];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshTrailerPullingText] forState:MJRefreshStatePulling];\n    [self setTitle:[NSBundle mj_localizedStringForKey:MJRefreshTrailerPullingText] forState:MJRefreshStateRefreshing];\n}\n\n#pragma mark - 覆盖父类的方法\n- (void)prepare {\n    [super prepare];\n    \n    [self textConfiguration];\n}\n\n- (void)i18nDidChange {\n    [self textConfiguration];\n    \n    [super i18nDidChange];\n}\n\n- (void)setState:(MJRefreshState)state {\n    MJRefreshCheckState\n    // 设置状态文字\n    self.stateLabel.text = self.stateTitles[@(state)];\n}\n\n- (void)placeSubviews {\n    [super placeSubviews];\n    \n    if (self.stateLabel.hidden) return;\n    \n    BOOL noConstrainsOnStatusLabel = self.stateLabel.constraints.count == 0;\n    CGFloat stateLabelW = ceil(self.stateLabel.font.pointSize);\n    // 状态\n    if (noConstrainsOnStatusLabel) {\n        self.stateLabel.center = CGPointMake(self.mj_w * 0.5, self.mj_h * 0.5);\n        self.stateLabel.mj_size = CGSizeMake(stateLabelW, self.mj_h) ;\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/ko.lproj/Localizable.strings",
    "content": "\"MJRefreshHeaderIdleText\" = \"아래로 당겨 새로고침\";\n\"MJRefreshHeaderPullingText\" = \"놓으면 새로고침\";\n\"MJRefreshHeaderRefreshingText\" = \"로딩중...\";\n\n\"MJRefreshAutoFooterIdleText\" = \"탭 또는 위로 당겨 로드함\";\n\"MJRefreshAutoFooterRefreshingText\" = \"로딩중...\";\n\"MJRefreshAutoFooterNoMoreDataText\" = \"더이상 데이터 없음\";\n\n\"MJRefreshBackFooterIdleText\" = \"위로 당겨 더 로드 가능\";\n\"MJRefreshBackFooterPullingText\" = \"놓으면 더 로드됨.\";\n\"MJRefreshBackFooterRefreshingText\" = \"로딩중...\";\n\"MJRefreshBackFooterNoMoreDataText\" = \"더이상 데이터 없음\";\n\n\"MJRefreshHeaderLastTimeText\" = \"마지막 업데이트: \";\n\"MJRefreshHeaderDateTodayText\" = \"오늘\";\n\"MJRefreshHeaderNoneLastDateText\" = \"기록 없음\";\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/MJRefresh.bundle/zh-Hant.lproj/Localizable.strings",
    "content": "\"MJRefreshHeaderIdleText\" = \"下拉可以刷新\";\n\"MJRefreshHeaderPullingText\" = \"鬆開立即刷新\";\n\"MJRefreshHeaderRefreshingText\" = \"正在刷新數據中...\";\n\n\"MJRefreshTrailerIdleText\" = \"滑動查看圖文詳情\";\n\"MJRefreshTrailerPullingText\" = \"釋放查看圖文詳情\";\n\n\"MJRefreshAutoFooterIdleText\" = \"點擊或上拉加載更多\";\n\"MJRefreshAutoFooterRefreshingText\" = \"正在加載更多的數據...\";\n\"MJRefreshAutoFooterNoMoreDataText\" = \"已經全部加載完畢\";\n\n\"MJRefreshBackFooterIdleText\" = \"上拉可以加載更多\";\n\"MJRefreshBackFooterPullingText\" = \"鬆開立即加載更多\";\n\"MJRefreshBackFooterRefreshingText\" = \"正在加載更多的數據...\";\n\"MJRefreshBackFooterNoMoreDataText\" = \"已經全部加載完畢\";\n\n\"MJRefreshHeaderLastTimeText\" = \"最後更新：\";\n\"MJRefreshHeaderDateTodayText\" = \"今天\";\n\"MJRefreshHeaderNoneLastDateText\" = \"無記錄\";\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/MJRefresh.h",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n\n#import <Foundation/Foundation.h>\n\n#if __has_include(<MJRefresh/MJRefresh.h>)\nFOUNDATION_EXPORT double MJRefreshVersionNumber;\nFOUNDATION_EXPORT const unsigned char MJRefreshVersionString[];\n\n#import <MJRefresh/UIScrollView+MJRefresh.h>\n#import <MJRefresh/UIScrollView+MJExtension.h>\n#import <MJRefresh/UIView+MJExtension.h>\n\n#import <MJRefresh/MJRefreshNormalHeader.h>\n#import <MJRefresh/MJRefreshGifHeader.h>\n\n#import <MJRefresh/MJRefreshBackNormalFooter.h>\n#import <MJRefresh/MJRefreshBackGifFooter.h>\n#import <MJRefresh/MJRefreshAutoNormalFooter.h>\n#import <MJRefresh/MJRefreshAutoGifFooter.h>\n\n#import <MJRefresh/MJRefreshNormalTrailer.h>\n#import <MJRefresh/MJRefreshConfig.h>\n#import <MJRefresh/NSBundle+MJRefresh.h>\n#import <MJRefresh/MJRefreshConst.h>\n#else\n#import \"UIScrollView+MJRefresh.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIView+MJExtension.h\"\n\n#import \"MJRefreshNormalHeader.h\"\n#import \"MJRefreshGifHeader.h\"\n\n#import \"MJRefreshBackNormalFooter.h\"\n#import \"MJRefreshBackGifFooter.h\"\n#import \"MJRefreshAutoNormalFooter.h\"\n#import \"MJRefreshAutoGifFooter.h\"\n\n#import \"MJRefreshNormalTrailer.h\"\n#import \"MJRefreshConfig.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"MJRefreshConst.h\"\n#endif\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/MJRefreshConfig.h",
    "content": "//\n//  MJRefreshConfig.h\n//\n//  Created by Frank on 2018/11/27.\n//  Copyright © 2018 小码哥. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface MJRefreshConfig : NSObject\n\n/** 默认使用的语言版本, 默认为 nil. 将随系统的语言自动改变 */\n@property (copy, nonatomic, nullable) NSString *languageCode;\n\n/** 默认使用的语言资源文件名, 默认为 nil, 即默认的 Localizable.strings.\n \n - Attention: 文件名不包含后缀.strings\n */\n@property (copy, nonatomic, nullable) NSString *i18nFilename;\n/** i18n 多语言资源加载自定义 Bundle.\n \n - Attention: 默认为 nil 采用内置逻辑. 这里设置后将忽略内置逻辑的多语言模式, 采用自定义的多语言 bundle\n */\n@property (nonatomic, nullable) NSBundle *i18nBundle;\n\n/** Singleton Config instance */\n@property (class, nonatomic, readonly) MJRefreshConfig *defaultConfig;\n\n- (instancetype)init NS_UNAVAILABLE;\n+ (instancetype)new NS_UNAVAILABLE;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/MJRefreshConfig.m",
    "content": "//\n//  MJRefreshConfig.m\n//\n//  Created by Frank on 2018/11/27.\n//  Copyright © 2018 小码哥. All rights reserved.\n//\n\n#import \"MJRefreshConfig.h\"\n#import \"MJRefreshConst.h\"\n#import \"NSBundle+MJRefresh.h\"\n\n@interface MJRefreshConfig (Bundle)\n\n+ (void)resetLanguageResourceCache;\n\n@end\n\n@implementation MJRefreshConfig\n\nstatic MJRefreshConfig *mj_RefreshConfig = nil;\n\n+ (instancetype)defaultConfig {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        mj_RefreshConfig = [[self alloc] init];\n    });\n    return mj_RefreshConfig;\n}\n\n- (void)setLanguageCode:(NSString *)languageCode {\n    if ([languageCode isEqualToString:_languageCode]) {\n        return;\n    }\n    \n    _languageCode = languageCode;\n    // 重置语言资源\n    [MJRefreshConfig resetLanguageResourceCache];\n    [NSNotificationCenter.defaultCenter\n     postNotificationName:MJRefreshDidChangeLanguageNotification object:self];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/MJRefreshConst.h",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n#import <UIKit/UIKit.h>\n#import <objc/message.h>\n#import <objc/runtime.h>\n\n// 弱引用\n#define MJWeakSelf __weak typeof(self) weakSelf = self;\n\n// 日志输出\n#ifdef DEBUG\n#define MJRefreshLog(...) NSLog(__VA_ARGS__)\n#else\n#define MJRefreshLog(...)\n#endif\n\n// 过期提醒\n#define MJRefreshDeprecated(DESCRIPTION) __attribute__((deprecated(DESCRIPTION)))\n\n// 运行时objc_msgSend\n#define MJRefreshMsgSend(...) ((void (*)(void *, SEL, UIView *))objc_msgSend)(__VA_ARGS__)\n#define MJRefreshMsgTarget(target) (__bridge void *)(target)\n\n// RGB颜色\n#define MJRefreshColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]\n\n// 文字颜色\n#define MJRefreshLabelTextColor MJRefreshColor(90, 90, 90)\n\n// 字体大小\n#define MJRefreshLabelFont [UIFont boldSystemFontOfSize:14]\n\n// 常量\nUIKIT_EXTERN const CGFloat MJRefreshLabelLeftInset;\nUIKIT_EXTERN const CGFloat MJRefreshHeaderHeight;\nUIKIT_EXTERN const CGFloat MJRefreshFooterHeight;\nUIKIT_EXTERN const CGFloat MJRefreshTrailWidth;\nUIKIT_EXTERN const CGFloat MJRefreshFastAnimationDuration;\nUIKIT_EXTERN const CGFloat MJRefreshSlowAnimationDuration;\n\n\nUIKIT_EXTERN NSString *const MJRefreshKeyPathContentOffset;\nUIKIT_EXTERN NSString *const MJRefreshKeyPathContentSize;\nUIKIT_EXTERN NSString *const MJRefreshKeyPathContentInset;\nUIKIT_EXTERN NSString *const MJRefreshKeyPathPanState;\n\nUIKIT_EXTERN NSString *const MJRefreshHeaderLastUpdatedTimeKey;\n\nUIKIT_EXTERN NSString *const MJRefreshHeaderIdleText;\nUIKIT_EXTERN NSString *const MJRefreshHeaderPullingText;\nUIKIT_EXTERN NSString *const MJRefreshHeaderRefreshingText;\n\nUIKIT_EXTERN NSString *const MJRefreshTrailerIdleText;\nUIKIT_EXTERN NSString *const MJRefreshTrailerPullingText;\n\nUIKIT_EXTERN NSString *const MJRefreshAutoFooterIdleText;\nUIKIT_EXTERN NSString *const MJRefreshAutoFooterRefreshingText;\nUIKIT_EXTERN NSString *const MJRefreshAutoFooterNoMoreDataText;\n\nUIKIT_EXTERN NSString *const MJRefreshBackFooterIdleText;\nUIKIT_EXTERN NSString *const MJRefreshBackFooterPullingText;\nUIKIT_EXTERN NSString *const MJRefreshBackFooterRefreshingText;\nUIKIT_EXTERN NSString *const MJRefreshBackFooterNoMoreDataText;\n\nUIKIT_EXTERN NSString *const MJRefreshHeaderLastTimeText;\nUIKIT_EXTERN NSString *const MJRefreshHeaderDateTodayText;\nUIKIT_EXTERN NSString *const MJRefreshHeaderNoneLastDateText;\n\nUIKIT_EXTERN NSString *const MJRefreshDidChangeLanguageNotification;\n\n// 状态检查\n#define MJRefreshCheckState \\\nMJRefreshState oldState = self.state; \\\nif (state == oldState) return; \\\n[super setState:state];\n\n// 异步主线程执行，不强持有Self\n#define MJRefreshDispatchAsyncOnMainQueue(x) \\\n__weak typeof(self) weakSelf = self; \\\ndispatch_async(dispatch_get_main_queue(), ^{ \\\ntypeof(weakSelf) self = weakSelf; \\\n{x} \\\n});\n\n/// 替换方法实现\n/// @param _fromClass 源类\n/// @param _originSelector 源类的 Selector\n/// @param _toClass  目标类\n/// @param _newSelector 目标类的 Selector\nCG_INLINE BOOL MJRefreshExchangeImplementations(\n                                                Class _fromClass, SEL _originSelector,\n                                                Class _toClass, SEL _newSelector) {\n    if (!_fromClass || !_toClass) {\n        return NO;\n    }\n    \n    Method oriMethod = class_getInstanceMethod(_fromClass, _originSelector);\n    Method newMethod = class_getInstanceMethod(_toClass, _newSelector);\n    if (!newMethod) {\n        return NO;\n    }\n    \n    BOOL isAddedMethod = class_addMethod(_fromClass, _originSelector,\n                                         method_getImplementation(newMethod),\n                                         method_getTypeEncoding(newMethod));\n    if (isAddedMethod) {\n        // 如果 class_addMethod 成功了，说明之前 fromClass 里并不存在 originSelector，所以要用一个空的方法代替它，以避免 class_replaceMethod 后，后续 toClass 的这个方法被调用时可能会 crash\n        IMP emptyIMP = imp_implementationWithBlock(^(id selfObject) {});\n        IMP oriMethodIMP = method_getImplementation(oriMethod) ?: emptyIMP;\n        const char *oriMethodTypeEncoding = method_getTypeEncoding(oriMethod) ?: \"v@:\";\n        class_replaceMethod(_toClass, _newSelector, oriMethodIMP, oriMethodTypeEncoding);\n    } else {\n        method_exchangeImplementations(oriMethod, newMethod);\n    }\n    return YES;\n}\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/MJRefreshConst.m",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n#import <UIKit/UIKit.h>\n\nconst CGFloat MJRefreshLabelLeftInset = 25;\nconst CGFloat MJRefreshHeaderHeight = 54.0;\nconst CGFloat MJRefreshFooterHeight = 44.0;\nconst CGFloat MJRefreshTrailWidth = 60.0;\nconst CGFloat MJRefreshFastAnimationDuration = 0.25;\nconst CGFloat MJRefreshSlowAnimationDuration = 0.4;\n\n\nNSString *const MJRefreshKeyPathContentOffset = @\"contentOffset\";\nNSString *const MJRefreshKeyPathContentInset = @\"contentInset\";\nNSString *const MJRefreshKeyPathContentSize = @\"contentSize\";\nNSString *const MJRefreshKeyPathPanState = @\"state\";\n\nNSString *const MJRefreshHeaderLastUpdatedTimeKey = @\"MJRefreshHeaderLastUpdatedTimeKey\";\n\nNSString *const MJRefreshHeaderIdleText = @\"MJRefreshHeaderIdleText\";\nNSString *const MJRefreshHeaderPullingText = @\"MJRefreshHeaderPullingText\";\nNSString *const MJRefreshHeaderRefreshingText = @\"MJRefreshHeaderRefreshingText\";\n\nNSString *const MJRefreshTrailerIdleText = @\"MJRefreshTrailerIdleText\";\nNSString *const MJRefreshTrailerPullingText = @\"MJRefreshTrailerPullingText\";\n\nNSString *const MJRefreshAutoFooterIdleText = @\"MJRefreshAutoFooterIdleText\";\nNSString *const MJRefreshAutoFooterRefreshingText = @\"MJRefreshAutoFooterRefreshingText\";\nNSString *const MJRefreshAutoFooterNoMoreDataText = @\"MJRefreshAutoFooterNoMoreDataText\";\n\nNSString *const MJRefreshBackFooterIdleText = @\"MJRefreshBackFooterIdleText\";\nNSString *const MJRefreshBackFooterPullingText = @\"MJRefreshBackFooterPullingText\";\nNSString *const MJRefreshBackFooterRefreshingText = @\"MJRefreshBackFooterRefreshingText\";\nNSString *const MJRefreshBackFooterNoMoreDataText = @\"MJRefreshBackFooterNoMoreDataText\";\n\nNSString *const MJRefreshHeaderLastTimeText = @\"MJRefreshHeaderLastTimeText\";\nNSString *const MJRefreshHeaderDateTodayText = @\"MJRefreshHeaderDateTodayText\";\nNSString *const MJRefreshHeaderNoneLastDateText = @\"MJRefreshHeaderNoneLastDateText\";\n\nNSString *const MJRefreshDidChangeLanguageNotification = @\"MJRefreshDidChangeLanguageNotification\";\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/NSBundle+MJRefresh.h",
    "content": "//\n//  NSBundle+MJRefresh.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 16/6/13.\n//  Copyright © 2016年 小码哥. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface NSBundle (MJRefresh)\n+ (instancetype)mj_refreshBundle;\n+ (UIImage *)mj_arrowImage;\n+ (UIImage *)mj_trailArrowImage;\n+ (NSString *)mj_localizedStringForKey:(NSString *)key value:(nullable NSString *)value;\n+ (NSString *)mj_localizedStringForKey:(NSString *)key;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/NSBundle+MJRefresh.m",
    "content": "//\n//  NSBundle+MJRefresh.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 16/6/13.\n//  Copyright © 2016年 小码哥. All rights reserved.\n//\n\n#import \"NSBundle+MJRefresh.h\"\n#import \"MJRefreshComponent.h\"\n#import \"MJRefreshConfig.h\"\n\nstatic NSBundle *mj_defaultI18nBundle = nil;\nstatic NSBundle *mj_systemI18nBundle = nil;\n\n@implementation NSBundle (MJRefresh)\n+ (instancetype)mj_refreshBundle\n{\n    static NSBundle *refreshBundle = nil;\n    if (refreshBundle == nil) {\n#ifdef SWIFT_PACKAGE\n        NSBundle *containnerBundle = SWIFTPM_MODULE_BUNDLE;\n#else\n        NSBundle *containnerBundle = [NSBundle bundleForClass:[MJRefreshComponent class]];\n#endif\n        refreshBundle = [NSBundle bundleWithPath:[containnerBundle pathForResource:@\"MJRefresh\" ofType:@\"bundle\"]];\n    }\n    return refreshBundle;\n}\n\n+ (UIImage *)mj_arrowImage\n{\n    static UIImage *arrowImage = nil;\n    if (arrowImage == nil) {\n        arrowImage = [[UIImage imageWithContentsOfFile:[[self mj_refreshBundle] pathForResource:@\"arrow@2x\" ofType:@\"png\"]] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];\n    }\n    return arrowImage;\n}\n\n+ (UIImage *)mj_trailArrowImage {\n    static UIImage *arrowImage = nil;\n    if (arrowImage == nil) {\n        arrowImage = [[UIImage imageWithContentsOfFile:[[self mj_refreshBundle] pathForResource:@\"trail_arrow@2x\" ofType:@\"png\"]] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];\n    }\n    return arrowImage;\n}\n\n+ (NSString *)mj_localizedStringForKey:(NSString *)key\n{\n    return [self mj_localizedStringForKey:key value:nil];\n}\n\n+ (NSString *)mj_localizedStringForKey:(NSString *)key value:(NSString *)value\n{\n    NSString *table = MJRefreshConfig.defaultConfig.i18nFilename;\n    \n    // 如果没有缓存, 则走初始化逻辑\n    if (mj_defaultI18nBundle == nil) {\n        NSString *language = MJRefreshConfig.defaultConfig.languageCode;\n        // 如果配置中没有配置语言\n        if (!language) {\n            language = [NSLocale preferredLanguages].firstObject;\n        }\n        NSBundle *bundle = MJRefreshConfig.defaultConfig.i18nBundle;\n        // 首先优先使用公共配置中的 i18nBundle, 如果为空则使用 mainBundle\n        bundle = bundle ? bundle : NSBundle.mainBundle;\n        // 按语言选取语言包\n        NSString *i18nFolderPath = [bundle pathForResource:language ofType:@\"lproj\"];\n        mj_defaultI18nBundle = [NSBundle bundleWithPath:i18nFolderPath];\n        // 检查语言包, 如果没有查找到, 则默认使用 mainBundle\n        mj_defaultI18nBundle = mj_defaultI18nBundle ? mj_defaultI18nBundle : NSBundle.mainBundle;\n        \n        // 获取 MJRefresh 自有的语言包\n        if (mj_systemI18nBundle == nil) {\n            mj_systemI18nBundle = [self mj_defaultI18nBundleWithLanguage:language];\n        }\n    }\n    // 首先在 MJRefresh 内置语言文件中寻找\n    value = [mj_systemI18nBundle localizedStringForKey:key value:value table:nil];\n    // 然后在 MainBundle 对应语言文件中寻找\n    value = [mj_defaultI18nBundle localizedStringForKey:key value:value table:table];\n    return value;\n}\n\n+ (NSBundle *)mj_defaultI18nBundleWithLanguage:(NSString *)language {\n    if ([language hasPrefix:@\"en\"]) {\n        language = @\"en\";\n    } else if ([language hasPrefix:@\"zh\"]) {\n        if ([language rangeOfString:@\"Hans\"].location != NSNotFound) {\n            language = @\"zh-Hans\"; // 简体中文\n        } else { // zh-Hant\\zh-HK\\zh-TW\n            language = @\"zh-Hant\"; // 繁體中文\n        }\n    } else if ([language hasPrefix:@\"ko\"]) {\n        language = @\"ko\";\n    } else if ([language hasPrefix:@\"ru\"]) {\n        language = @\"ru\";\n    } else if ([language hasPrefix:@\"uk\"]) {\n        language = @\"uk\";\n    } else {\n        language = @\"en\";\n    }\n    \n    // 从MJRefresh.bundle中查找资源\n    return [NSBundle bundleWithPath:[[NSBundle mj_refreshBundle] pathForResource:language ofType:@\"lproj\"]];\n}\n@end\n\n@implementation MJRefreshConfig (Bundle)\n\n+ (void)resetLanguageResourceCache {\n    mj_defaultI18nBundle = nil;\n    mj_systemI18nBundle = nil;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UICollectionViewLayout+MJRefresh.h",
    "content": "//\n//  UICollectionViewLayout+MJRefresh.h\n//  \n//  该类是用来解决 Footer 在底端加载完成后, 仍停留在原处的 bug.\n//  此问题出现在 iOS 14 及以下系统上.\n//  Reference: https://github.com/CoderMJLee/MJRefresh/issues/1552\n//\n//  Created by jiasong on 2021/11/15.\n//  Copyright © 2021 小码哥. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UICollectionViewLayout (MJRefresh)\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UICollectionViewLayout+MJRefresh.m",
    "content": "//\n//  UICollectionViewLayout+MJRefresh.m\n//\n//  该类是用来解决 Footer 在底端加载完成后, 仍停留在原处的 bug.\n//  此问题出现在 iOS 14 及以下系统上.\n//  Reference: https://github.com/CoderMJLee/MJRefresh/issues/1552\n//\n//  Created by jiasong on 2021/11/15.\n//  Copyright © 2021 小码哥. All rights reserved.\n//\n\n#import \"UICollectionViewLayout+MJRefresh.h\"\n#import \"MJRefreshConst.h\"\n#import \"MJRefreshFooter.h\"\n#import \"UIScrollView+MJRefresh.h\"\n\n@implementation UICollectionViewLayout (MJRefresh)\n\n+ (void)load {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        MJRefreshExchangeImplementations(self.class, @selector(finalizeCollectionViewUpdates),\n                                         self.class, @selector(mj_finalizeCollectionViewUpdates));\n    });\n}\n\n- (void)mj_finalizeCollectionViewUpdates {\n    [self mj_finalizeCollectionViewUpdates];\n    \n    __kindof MJRefreshFooter *footer = self.collectionView.mj_footer;\n    CGSize newSize = self.collectionViewContentSize;\n    CGSize oldSize = self.collectionView.contentSize;\n    if (footer != nil && !CGSizeEqualToSize(newSize, oldSize)) {\n        NSDictionary *changed = @{\n            NSKeyValueChangeNewKey: [NSValue valueWithCGSize:newSize],\n            NSKeyValueChangeOldKey: [NSValue valueWithCGSize:oldSize],\n        };\n        [CATransaction begin];\n        [CATransaction setDisableActions:YES];\n        [footer scrollViewContentSizeDidChange:changed];\n        [CATransaction commit];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UIScrollView+MJExtension.h",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  UIScrollView+Extension.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 14-5-28.\n//  Copyright (c) 2014年 小码哥. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UIScrollView (MJExtension)\n@property (readonly, nonatomic) UIEdgeInsets mj_inset;\n\n@property (assign, nonatomic) CGFloat mj_insetT;\n@property (assign, nonatomic) CGFloat mj_insetB;\n@property (assign, nonatomic) CGFloat mj_insetL;\n@property (assign, nonatomic) CGFloat mj_insetR;\n\n@property (assign, nonatomic) CGFloat mj_offsetX;\n@property (assign, nonatomic) CGFloat mj_offsetY;\n\n@property (assign, nonatomic) CGFloat mj_contentW;\n@property (assign, nonatomic) CGFloat mj_contentH;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UIScrollView+MJExtension.m",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  UIScrollView+Extension.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 14-5-28.\n//  Copyright (c) 2014年 小码哥. All rights reserved.\n//\n\n#import \"UIScrollView+MJExtension.h\"\n#import <objc/runtime.h>\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunguarded-availability-new\"\n\n@implementation UIScrollView (MJExtension)\n\nstatic BOOL respondsToAdjustedContentInset_;\n\n+ (void)load\n{\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        respondsToAdjustedContentInset_ = [self instancesRespondToSelector:@selector(adjustedContentInset)];\n    });\n}\n\n- (UIEdgeInsets)mj_inset\n{\n#ifdef __IPHONE_11_0\n    if (respondsToAdjustedContentInset_) {\n        return self.adjustedContentInset;\n    }\n#endif\n    return self.contentInset;\n}\n\n- (void)setMj_insetT:(CGFloat)mj_insetT\n{\n    UIEdgeInsets inset = self.contentInset;\n    inset.top = mj_insetT;\n#ifdef __IPHONE_11_0\n    if (respondsToAdjustedContentInset_) {\n        inset.top -= (self.adjustedContentInset.top - self.contentInset.top);\n    }\n#endif\n    self.contentInset = inset;\n}\n\n- (CGFloat)mj_insetT\n{\n    return self.mj_inset.top;\n}\n\n- (void)setMj_insetB:(CGFloat)mj_insetB\n{\n    UIEdgeInsets inset = self.contentInset;\n    inset.bottom = mj_insetB;\n#ifdef __IPHONE_11_0\n    if (respondsToAdjustedContentInset_) {\n        inset.bottom -= (self.adjustedContentInset.bottom - self.contentInset.bottom);\n    }\n#endif\n    self.contentInset = inset;\n}\n\n- (CGFloat)mj_insetB\n{\n    return self.mj_inset.bottom;\n}\n\n- (void)setMj_insetL:(CGFloat)mj_insetL\n{\n    UIEdgeInsets inset = self.contentInset;\n    inset.left = mj_insetL;\n#ifdef __IPHONE_11_0\n    if (respondsToAdjustedContentInset_) {\n        inset.left -= (self.adjustedContentInset.left - self.contentInset.left);\n    }\n#endif\n    self.contentInset = inset;\n}\n\n- (CGFloat)mj_insetL\n{\n    return self.mj_inset.left;\n}\n\n- (void)setMj_insetR:(CGFloat)mj_insetR\n{\n    UIEdgeInsets inset = self.contentInset;\n    inset.right = mj_insetR;\n#ifdef __IPHONE_11_0\n    if (respondsToAdjustedContentInset_) {\n        inset.right -= (self.adjustedContentInset.right - self.contentInset.right);\n    }\n#endif\n    self.contentInset = inset;\n}\n\n- (CGFloat)mj_insetR\n{\n    return self.mj_inset.right;\n}\n\n- (void)setMj_offsetX:(CGFloat)mj_offsetX\n{\n    CGPoint offset = self.contentOffset;\n    offset.x = mj_offsetX;\n    self.contentOffset = offset;\n}\n\n- (CGFloat)mj_offsetX\n{\n    return self.contentOffset.x;\n}\n\n- (void)setMj_offsetY:(CGFloat)mj_offsetY\n{\n    CGPoint offset = self.contentOffset;\n    offset.y = mj_offsetY;\n    self.contentOffset = offset;\n}\n\n- (CGFloat)mj_offsetY\n{\n    return self.contentOffset.y;\n}\n\n- (void)setMj_contentW:(CGFloat)mj_contentW\n{\n    CGSize size = self.contentSize;\n    size.width = mj_contentW;\n    self.contentSize = size;\n}\n\n- (CGFloat)mj_contentW\n{\n    return self.contentSize.width;\n}\n\n- (void)setMj_contentH:(CGFloat)mj_contentH\n{\n    CGSize size = self.contentSize;\n    size.height = mj_contentH;\n    self.contentSize = size;\n}\n\n- (CGFloat)mj_contentH\n{\n    return self.contentSize.height;\n}\n@end\n#pragma clang diagnostic pop\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UIScrollView+MJRefresh.h",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  UIScrollView+MJRefresh.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/4.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//  给ScrollView增加下拉刷新、上拉刷新、 左滑刷新的功能\n\n#import <UIKit/UIKit.h>\n#if __has_include(<MJRefresh/MJRefreshConst.h>)\n#import <MJRefresh/MJRefreshConst.h>\n#else\n#import \"MJRefreshConst.h\"\n#endif\n\n@class MJRefreshHeader, MJRefreshFooter, MJRefreshTrailer;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UIScrollView (MJRefresh)\n/** 下拉刷新控件 */\n@property (strong, nonatomic, nullable) MJRefreshHeader *mj_header;\n@property (strong, nonatomic, nullable) MJRefreshHeader *header MJRefreshDeprecated(\"使用mj_header\");\n/** 上拉刷新控件 */\n@property (strong, nonatomic, nullable) MJRefreshFooter *mj_footer;\n@property (strong, nonatomic, nullable) MJRefreshFooter *footer MJRefreshDeprecated(\"使用mj_footer\");\n\n/** 左滑刷新控件 */\n@property (strong, nonatomic, nullable) MJRefreshTrailer *mj_trailer;\n\n#pragma mark - other\n- (NSInteger)mj_totalDataCount;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UIScrollView+MJRefresh.m",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  UIScrollView+MJRefresh.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 15/3/4.\n//  Copyright (c) 2015年 小码哥. All rights reserved.\n//\n\n#import \"UIScrollView+MJRefresh.h\"\n#import \"MJRefreshHeader.h\"\n#import \"MJRefreshFooter.h\"\n#import \"MJRefreshTrailer.h\"\n#import <objc/runtime.h>\n\n@implementation UIScrollView (MJRefresh)\n\n#pragma mark - header\nstatic const char MJRefreshHeaderKey = '\\0';\n- (void)setMj_header:(MJRefreshHeader *)mj_header\n{\n    if (mj_header != self.mj_header) {\n        // 删除旧的，添加新的\n        [self.mj_header removeFromSuperview];\n        \n        if (mj_header) {\n            [self insertSubview:mj_header atIndex:0];\n        }\n        // 存储新的\n        objc_setAssociatedObject(self, &MJRefreshHeaderKey,\n                                 mj_header, OBJC_ASSOCIATION_RETAIN);\n    }\n}\n\n- (MJRefreshHeader *)mj_header\n{\n    return objc_getAssociatedObject(self, &MJRefreshHeaderKey);\n}\n\n#pragma mark - footer\nstatic const char MJRefreshFooterKey = '\\0';\n- (void)setMj_footer:(MJRefreshFooter *)mj_footer\n{\n    if (mj_footer != self.mj_footer) {\n        // 删除旧的，添加新的\n        [self.mj_footer removeFromSuperview];\n        if (mj_footer) {\n            [self insertSubview:mj_footer atIndex:0];\n        }\n        // 存储新的\n        objc_setAssociatedObject(self, &MJRefreshFooterKey,\n                                 mj_footer, OBJC_ASSOCIATION_RETAIN);\n    }\n}\n\n- (MJRefreshFooter *)mj_footer\n{\n    return objc_getAssociatedObject(self, &MJRefreshFooterKey);\n}\n\n#pragma mark - footer\nstatic const char MJRefreshTrailerKey = '\\0';\n- (void)setMj_trailer:(MJRefreshTrailer *)mj_trailer {\n    if (mj_trailer != self.mj_trailer) {\n        // 删除旧的，添加新的\n        [self.mj_trailer removeFromSuperview];\n        if (mj_trailer) {\n            [self insertSubview:mj_trailer atIndex:0];\n        }\n        // 存储新的\n        objc_setAssociatedObject(self, &MJRefreshTrailerKey,\n                                 mj_trailer, OBJC_ASSOCIATION_RETAIN);\n    }\n}\n\n- (MJRefreshTrailer *)mj_trailer {\n    return objc_getAssociatedObject(self, &MJRefreshTrailerKey);\n}\n\n#pragma mark - 过期\n- (void)setFooter:(MJRefreshFooter *)footer\n{\n    self.mj_footer = footer;\n}\n\n- (MJRefreshFooter *)footer\n{\n    return self.mj_footer;\n}\n\n- (void)setHeader:(MJRefreshHeader *)header\n{\n    self.mj_header = header;\n}\n\n- (MJRefreshHeader *)header\n{\n    return self.mj_header;\n}\n\n#pragma mark - other\n- (NSInteger)mj_totalDataCount\n{\n    NSInteger totalCount = 0;\n    if ([self isKindOfClass:[UITableView class]]) {\n        UITableView *tableView = (UITableView *)self;\n\n        for (NSInteger section = 0; section < tableView.numberOfSections; section++) {\n            totalCount += [tableView numberOfRowsInSection:section];\n        }\n    } else if ([self isKindOfClass:[UICollectionView class]]) {\n        UICollectionView *collectionView = (UICollectionView *)self;\n\n        for (NSInteger section = 0; section < collectionView.numberOfSections; section++) {\n            totalCount += [collectionView numberOfItemsInSection:section];\n        }\n    }\n    return totalCount;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UIView+MJExtension.h",
    "content": "// 代码地址: https://github.com/CoderMJLee/MJRefresh\n//  UIView+Extension.h\n//  MJRefresh\n//\n//  Created by MJ Lee on 14-5-28.\n//  Copyright (c) 2014年 小码哥. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UIView (MJExtension)\n@property (assign, nonatomic) CGFloat mj_x;\n@property (assign, nonatomic) CGFloat mj_y;\n@property (assign, nonatomic) CGFloat mj_w;\n@property (assign, nonatomic) CGFloat mj_h;\n@property (assign, nonatomic) CGSize mj_size;\n@property (assign, nonatomic) CGPoint mj_origin;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/MJRefresh/UIView+MJExtension.m",
    "content": "//  代码地址: https://github.com/CoderMJLee/MJRefresh\n//  UIView+Extension.m\n//  MJRefresh\n//\n//  Created by MJ Lee on 14-5-28.\n//  Copyright (c) 2014年 小码哥. All rights reserved.\n//\n\n#import \"UIView+MJExtension.h\"\n\n@implementation UIView (MJExtension)\n- (void)setMj_x:(CGFloat)mj_x\n{\n    CGRect frame = self.frame;\n    frame.origin.x = mj_x;\n    self.frame = frame;\n}\n\n- (CGFloat)mj_x\n{\n    return self.frame.origin.x;\n}\n\n- (void)setMj_y:(CGFloat)mj_y\n{\n    CGRect frame = self.frame;\n    frame.origin.y = mj_y;\n    self.frame = frame;\n}\n\n- (CGFloat)mj_y\n{\n    return self.frame.origin.y;\n}\n\n- (void)setMj_w:(CGFloat)mj_w\n{\n    CGRect frame = self.frame;\n    frame.size.width = mj_w;\n    self.frame = frame;\n}\n\n- (CGFloat)mj_w\n{\n    return self.frame.size.width;\n}\n\n- (void)setMj_h:(CGFloat)mj_h\n{\n    CGRect frame = self.frame;\n    frame.size.height = mj_h;\n    self.frame = frame;\n}\n\n- (CGFloat)mj_h\n{\n    return self.frame.size.height;\n}\n\n- (void)setMj_size:(CGSize)mj_size\n{\n    CGRect frame = self.frame;\n    frame.size = mj_size;\n    self.frame = frame;\n}\n\n- (CGSize)mj_size\n{\n    return self.frame.size;\n}\n\n- (void)setMj_origin:(CGPoint)mj_origin\n{\n    CGRect frame = self.frame;\n    frame.origin = mj_origin;\n    self.frame = frame;\n}\n\n- (CGPoint)mj_origin\n{\n    return self.frame.origin;\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh/README.md",
    "content": "## MJRefresh\n[![SPM supported](https://img.shields.io/badge/SPM-supported-4BC51D.svg?style=flat)](https://github.com/apple/swift-package-manager)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![podversion](https://img.shields.io/cocoapods/v/MJRefresh.svg)](https://cocoapods.org/pods/MJRefresh)\n\n* An easy way to use pull-to-refresh\n\n[📜✍🏻**Release Notes**: more details](https://github.com/CoderMJLee/MJRefresh/releases)\n\n## Contents\n\n- New Features\n    - [Dynamic i18n Switching](#dynamic_i18n_switching)\n    - [SPM Supported](#spm_supported)\n    - [Swift Chaining Grammar Supported](#swift_chaining_grammar_supported)\n\n* Getting Started\n    * [Features【Support what kinds of controls to refresh】](#Support_what_kinds_of_controls_to_refresh)\n    * [Installation【How to use MJRefresh】](#How_to_use_MJRefresh)\n    * [Who's using【More than hundreds of Apps are using MJRefresh】](#More_than_hundreds_of_Apps_are_using_MJRefresh)\n    * [Classes【The Class Structure Chart of MJRefresh】](#The_Class_Structure_Chart_of_MJRefresh)\n* Comment API\n\t* [MJRefreshComponent.h](#MJRefreshComponent.h)\n\t* [MJRefreshHeader.h](#MJRefreshHeader.h)\n\t* [MJRefreshFooter.h](#MJRefreshFooter.h)\n\t* [MJRefreshAutoFooter.h](#MJRefreshAutoFooter.h)\n\t* [MJRefreshTrailer.h](#MJRefreshTrailer.h)\n* Examples\n    * [Reference](#Reference)\n    * [The drop-down refresh 01-Default](#The_drop-down_refresh_01-Default)\n    * [The drop-down refresh 02-Animation image](#The_drop-down_refresh_02-Animation_image)\n    * [The drop-down refresh 03-Hide the time](#The_drop-down_refresh_03-Hide_the_time)\n    * [The drop-down refresh 04-Hide status and time](#The_drop-down_refresh_04-Hide_status_and_time)\n    * [The drop-down refresh 05-DIY title](#The_drop-down_refresh_05-DIY_title)\n    * [The drop-down refresh 06-DIY the control of refresh](#The_drop-down_refresh_06-DIY_the_control_of_refresh)\n    * [The pull to refresh 01-Default](#The_pull_to_refresh_01-Default)\n    * [The pull to refresh 02-Animation image](#The_pull_to_refresh_02-Animation_image)\n    * [The pull to refresh 03-Hide the title of refresh status](#The_pull_to_refresh_03-Hide_the_title_of_refresh_status)\n    * [The pull to refresh 04-All loaded](#The_pull_to_refresh_04-All_loaded)\n    * [The pull to refresh 05-DIY title](#The_pull_to_refresh_05-DIY_title)\n    * [The pull to refresh 06-Hidden After loaded](#The_pull_to_refresh_06-Hidden_After_loaded)\n    * [The pull to refresh 07-Automatic back of the pull01](#The_pull_to_refresh_07-Automatic_back_of_the_pull01)\n    * [The pull to refresh 08-Automatic back of the pull02](#The_pull_to_refresh_08-Automatic_back_of_the_pull02)\n    * [The pull to refresh 09-DIY the control of refresh(Automatic refresh)](#The_pull_to_refresh_09-DIY_the_control_of_refresh(Automatic_refresh))\n    * [The pull to refresh 10-DIY the control of refresh(Automatic back)](#The_pull_to_refresh_10-DIY_the_control_of_refresh(Automatic_back))\n    * [UICollectionView01-The pull and drop-down refresh](#UICollectionView01-The_pull_and_drop-down_refresh)\n    * [UICollectionView02-The trailer refresh](#UICollectionView02-The_trailer_refresh)\n    * [WKWebView01-The drop-down refresh](#WKWebView01-The_drop-down_refresh)\n* [Hope](#Hope)\n\n## New Features\n### <a id=\"dynamic_i18n_switching\"></a>Dynamic i18n Switching\n\nNow `MJRefresh components` will be rerendered automatically with `MJRefreshConfig.default.language` setting.\n\n#### Example\n\nGo `i18n` folder and see lots of cases. Simulator example is behind `i18n tab` in right-top corner.\n\n#### Setting language\n\n```swift\nMJRefreshConfig.default.language = \"zh-hans\"\n```\n\n#### Setting i18n file name\n\n```swift\nMJRefreshConfig.default.i18nFilename = \"i18n File Name(not include type<.strings>)\"\n```\n\n#### Setting i18n language bundle\n\n```swift\nMJRefreshConfig.default.i18nBundle = <i18n Bundle>\n```\n\n#### Adopting the feature in your DIY component\n\n1. Just override `i18nDidChange` function and reset texts.\n\n```swift\n// must use this localization methods\nBundle.mj_localizedString(forKey: \"\")\n// or\nBundle.mj_localizedString(forKey: \"\", value:\"\")\n\noverride func i18nDidChange() {\n    // Reset texts function\n    setupTexts()\n    // Make sure to call super after resetting texts. It will call placeSubViews for applying new layout.\n    super.i18nDidChange()\n}\n```\n\n2. Receiving `MJRefreshDidChangeLanguageNotification` notification.\n\n### <a id=\"spm_supported\"></a>SPM Supported\n\nReleased from [`3.7.1`](https://github.com/CoderMJLee/MJRefresh/releases/tag/3.7.1)\n\n### <a id=\"swift_chaining_grammar_supported\"></a>Swift Chaining Grammar Supported\n\n```swift\n  // Example as MJRefreshNormalHeader\n  func addRefreshHeader() {\n      MJRefreshNormalHeader { [weak self] in\n  \t  // load some data\n      }.autoChangeTransparency(true)\n      .link(to: tableView)\n  }\n```\n\n## <a id=\"Support_what_kinds_of_controls_to_refresh\"></a>Support what kinds of controls to refresh\n\n* `UIScrollView`、`UITableView`、`UICollectionView`、`WKWebView`\n\n## <a id=\"How_to_use_MJRefresh\"></a>How to use MJRefresh\n* Installation with CocoaPods：`pod 'MJRefresh'`\n* Installation with [Carthage](https://github.com/Carthage/Carthage)：`github \"CoderMJLee/MJRefresh\"`\n* Manual import：\n    * Drag All files in the `MJRefresh` folder to project\n    * Import the main file：`#import \"MJRefresh.h\"`\n\n```objc\nBase                        Custom\nMJRefresh.bundle            MJRefresh.h\nMJRefreshConst.h            MJRefreshConst.m\nUIScrollView+MJExtension.h  UIScrollView+MJExtension.m\nUIScrollView+MJRefresh.h    UIScrollView+MJRefresh.m\nUIView+MJExtension.h        UIView+MJExtension.m\n```\n\n## <a id=\"More_than_hundreds_of_Apps_are_using_MJRefresh\"></a>More than hundreds of Apps are using MJRefresh\n<img src=\"http://images0.cnblogs.com/blog2015/497279/201506/141212365041650.png\" width=\"200\" height=\"300\">\n* More information of App can focus on：[M了个J-博客园](http://www.cnblogs.com/mjios/p/4409853.html)\n\n## <a id=\"The_Class_Structure_Chart_of_MJRefresh\"></a>The Class Structure Chart of MJRefresh\n![](http://images0.cnblogs.com/blog2015/497279/201506/132232456139177.png)\n- `The class of red text` in the chart：You can use them directly\n    - The drop-down refresh control types\n        - Normal：`MJRefreshNormalHeader`\n        - Gif：`MJRefreshGifHeader`\n    - The pull to refresh control types\n        - Auto refresh\n            - Normal：`MJRefreshAutoNormalFooter`\n            - Gif：`MJRefreshAutoGifFooter`\n        - Auto Back\n            - Normal：`MJRefreshBackNormalFooter`\n            - Gif：`MJRefreshBackGifFooter`\n    \n- `The class of non-red text` in the chart：For inheritance，to use DIY the control of refresh\n\n- About how to DIY the control of refresh，You can refer the Class in below Chart<br>\n\n  <img src=\"http://images0.cnblogs.com/blog2015/497279/201506/141358159107893.png\" width=\"30%\" height=\"30%\">\n\n## <a id=\"MJRefreshComponent.h\"></a>MJRefreshComponent.h\n```objc\n/** The Base Class of refresh control */\n@interface MJRefreshComponent : UIView\n#pragma mark -  Control the state of Refresh \n\n/** BeginRefreshing */\n- (void)beginRefreshing;\n/** EndRefreshing */\n- (void)endRefreshing; \n/** IsRefreshing */\n- (BOOL)isRefreshing;\n\n#pragma mark - Other\n/** According to the drag ratio to change alpha automatically */\n@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;\n@end\n```\n\n## <a id=\"MJRefreshHeader.h\"></a>MJRefreshHeader.h\n```objc\n@interface MJRefreshHeader : MJRefreshComponent\n/** Creat header */\n+ (instancetype)headerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;\n/** Creat header */\n+ (instancetype)headerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;\n\n/** This key is used to storage the time that the last time of drown-down successfully */\n@property (copy, nonatomic) NSString *lastUpdatedTimeKey;\n/** The last time of drown-down successfully */\n@property (strong, nonatomic, readonly) NSDate *lastUpdatedTime;\n\n/** Ignored scrollView contentInset top */\n@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetTop;\n@end\n```\n\n## <a id=\"MJRefreshFooter.h\"></a>MJRefreshFooter.h\n```objc\n@interface MJRefreshFooter : MJRefreshComponent\n/** Creat footer */\n+ (instancetype)footerWithRefreshingBlock:(MJRefreshComponentRefreshingBlock)refreshingBlock;\n/** Creat footer */\n+ (instancetype)footerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;\n\n/** NoticeNoMoreData */\n- (void)noticeNoMoreData;\n/** ResetNoMoreData（Clear the status of NoMoreData ） */\n- (void)resetNoMoreData;\n\n/** Ignored scrollView contentInset bottom */\n@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetBottom;\n@end\n```\n\n## <a id=\"MJRefreshAutoFooter.h\"></a>MJRefreshAutoFooter.h\n```objc\n@interface MJRefreshAutoFooter : MJRefreshFooter\n/** Is Automatically Refresh(Default is Yes) */\n@property (assign, nonatomic, getter=isAutomaticallyRefresh) BOOL automaticallyRefresh;\n\n/** When there is much at the bottom of the control is automatically refresh(Default is 1.0，Is at the bottom of the control appears in full, will refresh automatically) */\n@property (assign, nonatomic) CGFloat triggerAutomaticallyRefreshPercent;\n@end\n```\n\n## <a id=\"MJRefreshTrailer.h\"></a> MJRefreshTrailer.h\n```objc\n@interface MJRefreshTrailer : MJRefreshComponent\n\n/** 创建trailer */\n+ (instancetype)trailerWithRefreshingBlock:(MJRefreshComponentAction)refreshingBlock;\n/** 创建trailer */\n+ (instancetype)trailerWithRefreshingTarget:(id)target refreshingAction:(SEL)action;\n\n/** 忽略多少scrollView的contentInset的right */\n@property (assign, nonatomic) CGFloat ignoredScrollViewContentInsetRight;\n\n@end\n```\n\n## <a id=\"Reference\"></a>Reference\n```objc\n* Due to there are more functions of this framework，Don't write specific text describe its usage\n* You can directly reference examples MJTableViewController、MJCollectionViewController、MJWebViewController，More intuitive and fast.\n```\n<img src=\"http://images0.cnblogs.com/blog2015/497279/201506/141345470048120.png\" width=\"30%\" height=\"30%\">\n\n## <a id=\"The_drop-down_refresh_01-Default\"></a>The drop-down refresh 01-Default\n\n```objc\nself.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{\n   //Call this Block When enter the refresh status automatically \n}];\n或\n// Set the callback（Once you enter the refresh status，then call the action of target，that is call [self loadNewData]）\nself.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];\n\n// Enter the refresh status immediately\n[self.tableView.mj_header beginRefreshing];\n```\n![(下拉刷新01-普通)](http://images0.cnblogs.com/blog2015/497279/201506/141204343486151.gif)\n\n## <a id=\"The_drop-down_refresh_02-Animation_image\"></a>The drop-down refresh 02-Animation image\n```objc\n// Set the callback（一Once you enter the refresh status，then call the action of target，that is call [self loadNewData]）\nMJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];\n// Set the ordinary state of animated images\n[header setImages:idleImages forState:MJRefreshStateIdle];\n// Set the pulling state of animated images（Enter the status of refreshing as soon as loosen）\n[header setImages:pullingImages forState:MJRefreshStatePulling];\n// Set the refreshing state of animated images\n[header setImages:refreshingImages forState:MJRefreshStateRefreshing];\n// Set header\nself.tableView.mj_header = header;\n```\n![(下拉刷新02-动画图片)](http://images0.cnblogs.com/blog2015/497279/201506/141204402238389.gif)\n\n## <a id=\"The_drop-down_refresh_03-Hide_the_time\"></a>The drop-down refresh 03-Hide the time\n```objc\n// Hide the time\nheader.lastUpdatedTimeLabel.hidden = YES;\n```\n![(下拉刷新03-隐藏时间)](http://images0.cnblogs.com/blog2015/497279/201506/141204456132944.gif)\n\n## <a id=\"The_drop-down_refresh_04-Hide_status_and_time\"></a>The drop-down refresh 04-Hide status and time\n```objc\n// Hide the time\nheader.lastUpdatedTimeLabel.hidden = YES;\n\n// Hide the status\nheader.stateLabel.hidden = YES;\n```\n![(下拉刷新04-隐藏状态和时间0)](http://images0.cnblogs.com/blog2015/497279/201506/141204508639539.gif)\n\n## <a id=\"The_drop-down_refresh_05-DIY_title\"></a>The drop-down refresh 05-DIY title\n```objc\n// Set title\n[header setTitle:@\"Pull down to refresh\" forState:MJRefreshStateIdle];\n[header setTitle:@\"Release to refresh\" forState:MJRefreshStatePulling];\n[header setTitle:@\"Loading ...\" forState:MJRefreshStateRefreshing];\n\n// Set font\nheader.stateLabel.font = [UIFont systemFontOfSize:15];\nheader.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:14];\n\n// Set textColor\nheader.stateLabel.textColor = [UIColor redColor];\nheader.lastUpdatedTimeLabel.textColor = [UIColor blueColor];\n```\n![(下拉刷新05-自定义文字)](http://images0.cnblogs.com/blog2015/497279/201506/141204563633593.gif)\n\n## <a id=\"The_drop-down_refresh_06-DIY_the_control_of_refresh\"></a>The drop-down refresh 06-DIY the control of refresh\n```objc\nself.tableView.mj_header = [MJDIYHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];\n// Implementation reference to MJDIYHeader.h和MJDIYHeader.m\n```\n![(下拉刷新06-自定义刷新控件)](http://images0.cnblogs.com/blog2015/497279/201506/141205019261159.gif)\n\n## <a id=\"The_pull_to_refresh_01-Default\"></a>The pull to refresh 01-Default\n```objc\nself.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{\n    //Call this Block When enter the refresh status automatically\n}];\n或\n// Set the callback（Once you enter the refresh status，then call the action of target，that is call [self loadMoreData]）\nself.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];\n```\n![(上拉刷新01-默认)](http://images0.cnblogs.com/blog2015/497279/201506/141205090047696.gif)\n\n## <a id=\"The_pull_to_refresh_02-Animation_image\"></a>The pull to refresh 02-Animation image\n```objc\n// Set the callback（Once you enter the refresh status，then call the action of target，that is call [self loadMoreData]）\nMJRefreshAutoGifFooter *footer = [MJRefreshAutoGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];\n\n// Set the refresh image\n[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];\n\n// Set footer\nself.tableView.mj_footer = footer;\n```\n![(上拉刷新02-动画图片)](http://images0.cnblogs.com/blog2015/497279/201506/141205141445793.gif)\n\n## <a id=\"The_pull_to_refresh_03-Hide_the_title_of_refresh_status\"></a>The pull to refresh 03-Hide the title of refresh status\n```objc\n// Hide the title of refresh status\nfooter.refreshingTitleHidden = YES;\n// If does have not above method，then use footer.stateLabel.hidden = YES;\n```\n![(上拉刷新03-隐藏刷新状态的文字)](http://images0.cnblogs.com/blog2015/497279/201506/141205200985774.gif)\n\n## <a id=\"The_pull_to_refresh_04-All_loaded\"></a>The pull to refresh 04-All loaded\n```objc\n//Become the status of NoMoreData\n[footer noticeNoMoreData];\n```\n![(上拉刷新04-全部加载完毕)](http://images0.cnblogs.com/blog2015/497279/201506/141205248634686.gif)\n\n## <a id=\"The_pull_to_refresh_05-DIY_title\"></a>The pull to refresh 05-DIY title\n```objc\n// Set title\n[footer setTitle:@\"Click or drag up to refresh\" forState:MJRefreshStateIdle];\n[footer setTitle:@\"Loading more ...\" forState:MJRefreshStateRefreshing];\n[footer setTitle:@\"No more data\" forState:MJRefreshStateNoMoreData];\n\n// Set font\nfooter.stateLabel.font = [UIFont systemFontOfSize:17];\n\n// Set textColor\nfooter.stateLabel.textColor = [UIColor blueColor];\n```\n![(上拉刷新05-自定义文字)](http://images0.cnblogs.com/blog2015/497279/201506/141205295511153.gif)\n\n## <a id=\"The_pull_to_refresh_06-Hidden_After_loaded\"></a>The pull to refresh 06-Hidden After loaded\n```objc\n//Hidden current control of the pull to refresh\nself.tableView.mj_footer.hidden = YES;\n```\n![(上拉刷新06-加载后隐藏)](http://images0.cnblogs.com/blog2015/497279/201506/141205343481821.gif)\n\n## <a id=\"The_pull_to_refresh_07-Automatic_back_of_the_pull01\"></a>The pull to refresh 07-Automatic back of the pull01\n```objc\nself.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];\n```\n![(上拉刷新07-自动回弹的上拉01)](http://images0.cnblogs.com/blog2015/497279/201506/141205392239231.gif)\n\n## <a id=\"The_pull_to_refresh_08-Automatic_back_of_the_pull02\"></a>The pull to refresh 08-Automatic back of the pull02\n```objc\nMJRefreshBackGifFooter *footer = [MJRefreshBackGifFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];\n\n// Set the normal state of the animated image\n[footer setImages:idleImages forState:MJRefreshStateIdle];\n//  Set the pulling state of animated images（Enter the status of refreshing as soon as loosen）\n[footer setImages:pullingImages forState:MJRefreshStatePulling];\n// Set the refreshing state of animated images\n[footer setImages:refreshingImages forState:MJRefreshStateRefreshing];\n\n// Set footer\nself.tableView.mj_footer = footer;\n```\n![(上拉刷新07-自动回弹的上拉02)](http://images0.cnblogs.com/blog2015/497279/201506/141205441443628.gif)\n\n## <a id=\"The_pull_to_refresh_09-DIY_the_control_of_refresh(Automatic_refresh)\"></a>The pull to refresh 09-DIY the control of refresh(Automatic refresh)\n```objc\nself.tableView.mj_footer = [MJDIYAutoFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];\n// Implementation reference to MJDIYAutoFooter.h和MJDIYAutoFooter.m\n```\n![(上拉刷新09-自定义刷新控件(自动刷新))](http://images0.cnblogs.com/blog2015/497279/201506/141205500195866.gif)\n\n## <a id=\"The_pull_to_refresh_10-DIY_the_control_of_refresh(Automatic_back)\"></a>The pull to refresh 10-DIY the control of refresh(Automatic back)\n```objc\nself.tableView.mj_footer = [MJDIYBackFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];\n// Implementation reference to MJDIYBackFooter.h和MJDIYBackFooter.m\n```\n![(上拉刷新10-自定义刷新控件(自动回弹))](http://images0.cnblogs.com/blog2015/497279/201506/141205560666819.gif)\n\n## <a id=\"UICollectionView01-The_pull_and_drop-down_refresh\"></a>UICollectionView01-The pull and drop-down refresh\n```objc\n// The drop-down refresh\nself.collectionView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{\n   //Call this Block When enter the refresh status automatically \n}];\n\n// The pull to refresh\nself.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{\n   //Call this Block When enter the refresh status automatically\n}];\n```\n![(UICollectionView01-上下拉刷新)](http://images0.cnblogs.com/blog2015/497279/201506/141206021603758.gif)\n\n## <a id=\"UICollectionView02-The_trailer_refresh\"></a>UICollectionView02-The trailer refresh\n```objc\n// The trailer refresh\nself.collectionView.mj_trailer = [MJRefreshNormalTrailer trailerWithRefreshingBlock:^{\n   //Call this Block When enter the refresh status automatically \n}];\n\n```\n![(UICollectionView02-左拉刷新)](Gif/trailer_refresh.gif)\n\n## <a id=\"WKWebView01-The_drop-down_refresh\"></a>WKWebView01-The drop-down refresh\n```objc\n//Add the control of The drop-down refresh\nself.webView.scrollView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{\n   //Call this Block When enter the refresh status automatically\n}];\n```\n![(UICollectionView01-上下拉刷新)](http://images0.cnblogs.com/blog2015/497279/201506/141206080514524.gif)\n\n## Remind\n* ARC\n* iOS>=9.0\n* iPhone \\ iPad screen anyway\n\n## 寻求志同道合的小伙伴\n\n- 因本人工作忙，没有太多时间去维护MJRefresh，在此向广大框架使用者说声：非常抱歉！😞\n- 现寻求志同道合的小伙伴一起维护此框架，有兴趣的小伙伴可以[发邮件](mailto:richermj123go@vip.qq.com)给我，非常感谢😊\n- 如果一切OK，我将开放框架维护权限（github、pod等）\n- 目前已经找到3位小伙伴(＾－＾)V\n"
  },
  {
    "path": "JetChat/Pods/MJRefresh.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t044148683535C16980608537C5F57641 /* MJRefresh-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 88EC9CDE1F38CB917F06B8581C40EF9F /* MJRefresh-dummy.m */; };\n\t\t04B982CA09C3EEC1C2721A0E17FEFA70 /* MJRefreshConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 84717A5BABFB2F8DFEC12A963CB8E84F /* MJRefreshConfig.m */; };\n\t\t0631A6359C6E0AB9CDC7FC7494712B41 /* MJRefreshBackGifFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F1254624CFFF20A5BC1FDDD2A11C783 /* MJRefreshBackGifFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t064E4EBD8AFD0B1A8F4A19FF79877BDF /* NSBundle+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = AF153425B43C3B63B24DA04B5B549B35 /* NSBundle+MJRefresh.m */; };\n\t\t09AD0E8B43AD6A78D977BF2602E04C21 /* MJRefreshBackFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E4A7B3C28E83362DF5773769836CB50 /* MJRefreshBackFooter.m */; };\n\t\t0F6291F10BC74C816845A043FC23643B /* MJRefreshGifHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 552A5870302CAFBAE47233C5A1CEE886 /* MJRefreshGifHeader.m */; };\n\t\t1494B3436E9A256649430FAFFEC77A06 /* UICollectionViewLayout+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 41C870F0D2AED6473935AA49880C2FBB /* UICollectionViewLayout+MJRefresh.m */; };\n\t\t2A49BBFE0A0F2409103843EBED4DC163 /* MJRefreshFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = 440DE16BCA9050A295451626E295365A /* MJRefreshFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2A5BF80AE6E38DBE4E6ACB42DFF32BD7 /* MJRefreshBackStateFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = 38399A9DA3D4E0AD430E5B1DB845BF30 /* MJRefreshBackStateFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2E72898ECF760143B0E6B2E5ED3D899E /* UIScrollView+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C7F1661904FE1AA3D857A55203E7A8A /* UIScrollView+MJRefresh.m */; };\n\t\t30E921FD58AEA234351DB4E819F3D901 /* MJRefreshHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 597AFD62EE4F27A5EC3366F19A56C486 /* MJRefreshHeader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t36A174F76D6235A04247AE2A7286A47C /* MJRefresh.h in Headers */ = {isa = PBXBuildFile; fileRef = 43FA5A3519983D874088BA091F8D2F31 /* MJRefresh.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t39A26AE6B330EB17FB5C5DFF5D8DDDDA /* MJRefreshBackNormalFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 110B6CB3BB90F69D8C666D0D5622E987 /* MJRefreshBackNormalFooter.m */; };\n\t\t39BFB68E73BF53D708803B87FD7EE9A3 /* UICollectionViewLayout+MJRefresh.h in Headers */ = {isa = PBXBuildFile; fileRef = 4843F0AB9CD66A398982860B23DB8C08 /* UICollectionViewLayout+MJRefresh.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4BFBB6C5DB5AE5FB828BAC90B317A15D /* MJRefreshBackNormalFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2441D5ABF56275A2DDBB085CCBAD07F8 /* MJRefreshBackNormalFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4EF86F05B9601FC15CCF4630366E7DB5 /* MJRefreshAutoNormalFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = B93B60E92B5B06E2C169CBDF109FCF25 /* MJRefreshAutoNormalFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t55C88F53D787B5CD219A75F911348CFA /* MJRefresh.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 4FFC6CA961AC0BC2EDA9DAF248E20F9F /* MJRefresh.bundle */; };\n\t\t5BB11ECE71AA55DE558749834197A18F /* MJRefreshComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 20C8C276C58BA33F0BE612A66EBB0F4F /* MJRefreshComponent.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5FDDC41638DAB5526DB83EEDDE765480 /* MJRefreshTrailer.m in Sources */ = {isa = PBXBuildFile; fileRef = F24D5737E23F380E2A898E0A06A24144 /* MJRefreshTrailer.m */; };\n\t\t5FE13741788A0F1F3BBE358AF43D2D54 /* MJRefreshBackGifFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = C104589F417DBD4B9991FA27E7B1FC77 /* MJRefreshBackGifFooter.m */; };\n\t\t62282E81A85F9B3AAC8E63B35E04D120 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 44D8D7E522F43A834BE87B11A1631010 /* Foundation.framework */; };\n\t\t64CE5823916F5ABB5BC2C233C2BE615F /* UIView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E49F183B4188644E8AAFCC9362BA03 /* UIView+MJExtension.m */; };\n\t\t6FE3402231E508D0BB1E65B214C33F3B /* MJRefreshNormalTrailer.m in Sources */ = {isa = PBXBuildFile; fileRef = 16B1D7318E43E810EA1C3FBC6B593BF6 /* MJRefreshNormalTrailer.m */; };\n\t\t70FFB5A7DB70F9CFF7E21C1DA3E17E01 /* MJRefreshStateHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CF168181A20529F6423699D107E0F9 /* MJRefreshStateHeader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7723A9E9155267D7906448928958642B /* MJRefreshFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8E6FDB2DB5C2983705FBFC2E8A72394 /* MJRefreshFooter.m */; };\n\t\t7964435863CAB2D78592AC59D8B2BFFD /* MJRefreshAutoGifFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = 18525C2DF514DEAA9058936A4733DA89 /* MJRefreshAutoGifFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7CB29F84EBD91E4205E150D4D7D62B49 /* UIScrollView+MJExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = F72920975A4445262D665FD6A1A5C709 /* UIScrollView+MJExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7DA723284870CA3E34FBF8E5CD7D496A /* MJRefreshAutoFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = C8B3AEB9B5686FD63BCE2C766262199D /* MJRefreshAutoFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t84FF04545FA08788AB79B3CF82C6EC2A /* UIScrollView+MJExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = FBE581D901FAEA98EE7A5F00053AF99F /* UIScrollView+MJExtension.m */; };\n\t\t856CCDC34B8E6ADDCD58C5DA33DB804D /* MJRefreshNormalTrailer.h in Headers */ = {isa = PBXBuildFile; fileRef = F22B891B577B7F5B3314DFAE6C8F082B /* MJRefreshNormalTrailer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8814B3AF495A5C5F49BD2EF60E34F7C0 /* MJRefreshConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = BE5D1E958F378B4FF7DB66A35205E336 /* MJRefreshConfig.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t99D22CDEEEC491ED6107FD2C8DC86C1A /* MJRefreshStateTrailer.m in Sources */ = {isa = PBXBuildFile; fileRef = F48BDC185FCBDCD47E715F70771286B0 /* MJRefreshStateTrailer.m */; };\n\t\t9DA915A8839FC6E659B1DBD64C2B2919 /* MJRefreshAutoNormalFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 86B31BFE09FEC0B110DA2C00E4BB1491 /* MJRefreshAutoNormalFooter.m */; };\n\t\t9FCF9642A629338D1436C5BEB2F92C7A /* MJRefreshComponent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4384FFAF81B615AF96CD7F645DB137D7 /* MJRefreshComponent.m */; };\n\t\tA3B657B524C1284D2A568DB9D90CEFE0 /* MJRefreshBackStateFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C0591EB1CAB9072FA9ECC6202998D3 /* MJRefreshBackStateFooter.m */; };\n\t\tA6DECF9EB28B651518899B0D9809C662 /* MJRefreshHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 79AB405B86F044A6AFA279EC64CB6107 /* MJRefreshHeader.m */; };\n\t\tB799C6B90D9CCF7806DF237000BD3270 /* MJRefreshConst.m in Sources */ = {isa = PBXBuildFile; fileRef = A11834F399DA22FD7A2B0B202430F9F5 /* MJRefreshConst.m */; };\n\t\tC2803AF134E94E3647FE96BE84DAB3F0 /* MJRefreshAutoFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 58470DEE9A8470EFE8266E1993A05241 /* MJRefreshAutoFooter.m */; };\n\t\tCDCCA13F77984F0FF6942C457143B29B /* NSBundle+MJRefresh.h in Headers */ = {isa = PBXBuildFile; fileRef = 49196E29F6B3E998F36BD98B35A02A5F /* NSBundle+MJRefresh.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCEFD08B2DCC67D97459F709E346C1853 /* UIScrollView+MJRefresh.h in Headers */ = {isa = PBXBuildFile; fileRef = BB2C25B72655E400E5ADB28F6E184252 /* UIScrollView+MJRefresh.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCF01414B77A82D421A354D1E10EC86E4 /* MJRefreshNormalHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 57228039DF831E66B3DE48538A815CCB /* MJRefreshNormalHeader.m */; };\n\t\tD330BC4099A8F1F02238E366602FE30B /* MJRefreshNormalHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = A8F0E60501D4E6514FAF4931A03DEB8C /* MJRefreshNormalHeader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD3C3C611A329269A156F45DFDF9A8E91 /* MJRefreshTrailer.h in Headers */ = {isa = PBXBuildFile; fileRef = C4AECE341F3334977C288F281B85B8F1 /* MJRefreshTrailer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDDC4F011871F4BC739261E836E57AA0D /* MJRefreshStateTrailer.h in Headers */ = {isa = PBXBuildFile; fileRef = EDFABDED2A4C1393CAAD1AFE0F9F7150 /* MJRefreshStateTrailer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE1ED067CC110CA06D142331F4DB11006 /* MJRefreshAutoStateFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AB49BB3F3F31BAB69A28EA8AA6E3AF /* MJRefreshAutoStateFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE408AB9C050888D7D1464B48BAEA1A48 /* MJRefreshBackFooter.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5B4D3371949F610ADDD9FC67D4B6C4 /* MJRefreshBackFooter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEA4AC451B3B3F5C04A5F579A0B6FC13D /* MJRefreshStateHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ADEC2938E2C9610A0A5A75219C3F346 /* MJRefreshStateHeader.m */; };\n\t\tEAB0EC8F738FB7DF533ACDB36EABB695 /* MJRefreshConst.h in Headers */ = {isa = PBXBuildFile; fileRef = C5E2F2E4535C8E281B04CD110E070B2A /* MJRefreshConst.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF0E39A057D909F1CB663FF2E9F575D88 /* MJRefreshGifHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FB69DE6E8D5CCB134C4D8CF5056E190 /* MJRefreshGifHeader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF178D39A3D452970EE18BB815C051392 /* MJRefreshAutoGifFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = B7D65C0208542BE8CD4EF41E85425CA2 /* MJRefreshAutoGifFooter.m */; };\n\t\tF3296330F194054B2141781FD74C899D /* MJRefreshAutoStateFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F96527B02271AA11CB11E6C013A4D2F /* MJRefreshAutoStateFooter.m */; };\n\t\tF7DA170322BA81CFF80856A20AD7270F /* MJRefresh-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = CC82BD11EEC7A008772DBE988ED5B703 /* MJRefresh-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFA78E940165504DE8B6E1B2749D74007 /* UIView+MJExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = A5529E7753E36B8C344544368027B253 /* UIView+MJExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t07CF168181A20529F6423699D107E0F9 /* MJRefreshStateHeader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshStateHeader.h; path = MJRefresh/Custom/Header/MJRefreshStateHeader.h; sourceTree = \"<group>\"; };\n\t\t080FA0AC5E996B54E16C34A29EFFCE82 /* MJRefresh.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = MJRefresh.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t110B6CB3BB90F69D8C666D0D5622E987 /* MJRefreshBackNormalFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshBackNormalFooter.m; path = MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.m; sourceTree = \"<group>\"; };\n\t\t13E49F183B4188644E8AAFCC9362BA03 /* UIView+MJExtension.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIView+MJExtension.m\"; path = \"MJRefresh/UIView+MJExtension.m\"; sourceTree = \"<group>\"; };\n\t\t16B1D7318E43E810EA1C3FBC6B593BF6 /* MJRefreshNormalTrailer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshNormalTrailer.m; path = MJRefresh/Custom/Trailer/MJRefreshNormalTrailer.m; sourceTree = \"<group>\"; };\n\t\t18525C2DF514DEAA9058936A4733DA89 /* MJRefreshAutoGifFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshAutoGifFooter.h; path = MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.h; sourceTree = \"<group>\"; };\n\t\t1F5E209BD12893261ED8A11DD32E1213 /* MJRefresh-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"MJRefresh-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t1FB69DE6E8D5CCB134C4D8CF5056E190 /* MJRefreshGifHeader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshGifHeader.h; path = MJRefresh/Custom/Header/MJRefreshGifHeader.h; sourceTree = \"<group>\"; };\n\t\t20C8C276C58BA33F0BE612A66EBB0F4F /* MJRefreshComponent.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshComponent.h; path = MJRefresh/Base/MJRefreshComponent.h; sourceTree = \"<group>\"; };\n\t\t2441D5ABF56275A2DDBB085CCBAD07F8 /* MJRefreshBackNormalFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshBackNormalFooter.h; path = MJRefresh/Custom/Footer/Back/MJRefreshBackNormalFooter.h; sourceTree = \"<group>\"; };\n\t\t2E4A7B3C28E83362DF5773769836CB50 /* MJRefreshBackFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshBackFooter.m; path = MJRefresh/Base/MJRefreshBackFooter.m; sourceTree = \"<group>\"; };\n\t\t38399A9DA3D4E0AD430E5B1DB845BF30 /* MJRefreshBackStateFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshBackStateFooter.h; path = MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.h; sourceTree = \"<group>\"; };\n\t\t41C870F0D2AED6473935AA49880C2FBB /* UICollectionViewLayout+MJRefresh.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UICollectionViewLayout+MJRefresh.m\"; path = \"MJRefresh/UICollectionViewLayout+MJRefresh.m\"; sourceTree = \"<group>\"; };\n\t\t4384FFAF81B615AF96CD7F645DB137D7 /* MJRefreshComponent.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshComponent.m; path = MJRefresh/Base/MJRefreshComponent.m; sourceTree = \"<group>\"; };\n\t\t43FA5A3519983D874088BA091F8D2F31 /* MJRefresh.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefresh.h; path = MJRefresh/MJRefresh.h; sourceTree = \"<group>\"; };\n\t\t440DE16BCA9050A295451626E295365A /* MJRefreshFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshFooter.h; path = MJRefresh/Base/MJRefreshFooter.h; sourceTree = \"<group>\"; };\n\t\t44D8D7E522F43A834BE87B11A1631010 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t4843F0AB9CD66A398982860B23DB8C08 /* UICollectionViewLayout+MJRefresh.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UICollectionViewLayout+MJRefresh.h\"; path = \"MJRefresh/UICollectionViewLayout+MJRefresh.h\"; sourceTree = \"<group>\"; };\n\t\t49196E29F6B3E998F36BD98B35A02A5F /* NSBundle+MJRefresh.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSBundle+MJRefresh.h\"; path = \"MJRefresh/NSBundle+MJRefresh.h\"; sourceTree = \"<group>\"; };\n\t\t4FFC6CA961AC0BC2EDA9DAF248E20F9F /* MJRefresh.bundle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = \"wrapper.plug-in\"; name = MJRefresh.bundle; path = MJRefresh/MJRefresh.bundle; sourceTree = \"<group>\"; };\n\t\t552A5870302CAFBAE47233C5A1CEE886 /* MJRefreshGifHeader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshGifHeader.m; path = MJRefresh/Custom/Header/MJRefreshGifHeader.m; sourceTree = \"<group>\"; };\n\t\t57228039DF831E66B3DE48538A815CCB /* MJRefreshNormalHeader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshNormalHeader.m; path = MJRefresh/Custom/Header/MJRefreshNormalHeader.m; sourceTree = \"<group>\"; };\n\t\t58470DEE9A8470EFE8266E1993A05241 /* MJRefreshAutoFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshAutoFooter.m; path = MJRefresh/Base/MJRefreshAutoFooter.m; sourceTree = \"<group>\"; };\n\t\t597AFD62EE4F27A5EC3366F19A56C486 /* MJRefreshHeader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshHeader.h; path = MJRefresh/Base/MJRefreshHeader.h; sourceTree = \"<group>\"; };\n\t\t5C7F1661904FE1AA3D857A55203E7A8A /* UIScrollView+MJRefresh.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIScrollView+MJRefresh.m\"; path = \"MJRefresh/UIScrollView+MJRefresh.m\"; sourceTree = \"<group>\"; };\n\t\t5F96527B02271AA11CB11E6C013A4D2F /* MJRefreshAutoStateFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshAutoStateFooter.m; path = MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.m; sourceTree = \"<group>\"; };\n\t\t6F1254624CFFF20A5BC1FDDD2A11C783 /* MJRefreshBackGifFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshBackGifFooter.h; path = MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.h; sourceTree = \"<group>\"; };\n\t\t79AB405B86F044A6AFA279EC64CB6107 /* MJRefreshHeader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshHeader.m; path = MJRefresh/Base/MJRefreshHeader.m; sourceTree = \"<group>\"; };\n\t\t7ADEC2938E2C9610A0A5A75219C3F346 /* MJRefreshStateHeader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshStateHeader.m; path = MJRefresh/Custom/Header/MJRefreshStateHeader.m; sourceTree = \"<group>\"; };\n\t\t7F7EA281EE487F53B98FE21ADE26B2D0 /* MJRefresh */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = MJRefresh; path = MJRefresh.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t84717A5BABFB2F8DFEC12A963CB8E84F /* MJRefreshConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshConfig.m; path = MJRefresh/MJRefreshConfig.m; sourceTree = \"<group>\"; };\n\t\t86B31BFE09FEC0B110DA2C00E4BB1491 /* MJRefreshAutoNormalFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshAutoNormalFooter.m; path = MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.m; sourceTree = \"<group>\"; };\n\t\t88EC9CDE1F38CB917F06B8581C40EF9F /* MJRefresh-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"MJRefresh-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t8C70348EC26F3798A336467D302EB516 /* MJRefresh.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = MJRefresh.modulemap; sourceTree = \"<group>\"; };\n\t\tA11834F399DA22FD7A2B0B202430F9F5 /* MJRefreshConst.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshConst.m; path = MJRefresh/MJRefreshConst.m; sourceTree = \"<group>\"; };\n\t\tA1955EA45E021BB2F8316773BDF4A81A /* MJRefresh-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"MJRefresh-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tA5529E7753E36B8C344544368027B253 /* UIView+MJExtension.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIView+MJExtension.h\"; path = \"MJRefresh/UIView+MJExtension.h\"; sourceTree = \"<group>\"; };\n\t\tA8C0591EB1CAB9072FA9ECC6202998D3 /* MJRefreshBackStateFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshBackStateFooter.m; path = MJRefresh/Custom/Footer/Back/MJRefreshBackStateFooter.m; sourceTree = \"<group>\"; };\n\t\tA8E6FDB2DB5C2983705FBFC2E8A72394 /* MJRefreshFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshFooter.m; path = MJRefresh/Base/MJRefreshFooter.m; sourceTree = \"<group>\"; };\n\t\tA8F0E60501D4E6514FAF4931A03DEB8C /* MJRefreshNormalHeader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshNormalHeader.h; path = MJRefresh/Custom/Header/MJRefreshNormalHeader.h; sourceTree = \"<group>\"; };\n\t\tAF153425B43C3B63B24DA04B5B549B35 /* NSBundle+MJRefresh.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSBundle+MJRefresh.m\"; path = \"MJRefresh/NSBundle+MJRefresh.m\"; sourceTree = \"<group>\"; };\n\t\tB7D65C0208542BE8CD4EF41E85425CA2 /* MJRefreshAutoGifFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshAutoGifFooter.m; path = MJRefresh/Custom/Footer/Auto/MJRefreshAutoGifFooter.m; sourceTree = \"<group>\"; };\n\t\tB93B60E92B5B06E2C169CBDF109FCF25 /* MJRefreshAutoNormalFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshAutoNormalFooter.h; path = MJRefresh/Custom/Footer/Auto/MJRefreshAutoNormalFooter.h; sourceTree = \"<group>\"; };\n\t\tBB2C25B72655E400E5ADB28F6E184252 /* UIScrollView+MJRefresh.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIScrollView+MJRefresh.h\"; path = \"MJRefresh/UIScrollView+MJRefresh.h\"; sourceTree = \"<group>\"; };\n\t\tBD928A31DF7414D699D39C07A7D4D90D /* MJRefresh.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = MJRefresh.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tBE5D1E958F378B4FF7DB66A35205E336 /* MJRefreshConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshConfig.h; path = MJRefresh/MJRefreshConfig.h; sourceTree = \"<group>\"; };\n\t\tC104589F417DBD4B9991FA27E7B1FC77 /* MJRefreshBackGifFooter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshBackGifFooter.m; path = MJRefresh/Custom/Footer/Back/MJRefreshBackGifFooter.m; sourceTree = \"<group>\"; };\n\t\tC4AECE341F3334977C288F281B85B8F1 /* MJRefreshTrailer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshTrailer.h; path = MJRefresh/Base/MJRefreshTrailer.h; sourceTree = \"<group>\"; };\n\t\tC5E2F2E4535C8E281B04CD110E070B2A /* MJRefreshConst.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshConst.h; path = MJRefresh/MJRefreshConst.h; sourceTree = \"<group>\"; };\n\t\tC8B3AEB9B5686FD63BCE2C766262199D /* MJRefreshAutoFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshAutoFooter.h; path = MJRefresh/Base/MJRefreshAutoFooter.h; sourceTree = \"<group>\"; };\n\t\tCC82BD11EEC7A008772DBE988ED5B703 /* MJRefresh-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"MJRefresh-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tCD5B4D3371949F610ADDD9FC67D4B6C4 /* MJRefreshBackFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshBackFooter.h; path = MJRefresh/Base/MJRefreshBackFooter.h; sourceTree = \"<group>\"; };\n\t\tE4AB49BB3F3F31BAB69A28EA8AA6E3AF /* MJRefreshAutoStateFooter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshAutoStateFooter.h; path = MJRefresh/Custom/Footer/Auto/MJRefreshAutoStateFooter.h; sourceTree = \"<group>\"; };\n\t\tEDFABDED2A4C1393CAAD1AFE0F9F7150 /* MJRefreshStateTrailer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshStateTrailer.h; path = MJRefresh/Custom/Trailer/MJRefreshStateTrailer.h; sourceTree = \"<group>\"; };\n\t\tF22B891B577B7F5B3314DFAE6C8F082B /* MJRefreshNormalTrailer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshNormalTrailer.h; path = MJRefresh/Custom/Trailer/MJRefreshNormalTrailer.h; sourceTree = \"<group>\"; };\n\t\tF24D5737E23F380E2A898E0A06A24144 /* MJRefreshTrailer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshTrailer.m; path = MJRefresh/Base/MJRefreshTrailer.m; sourceTree = \"<group>\"; };\n\t\tF48BDC185FCBDCD47E715F70771286B0 /* MJRefreshStateTrailer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MJRefreshStateTrailer.m; path = MJRefresh/Custom/Trailer/MJRefreshStateTrailer.m; sourceTree = \"<group>\"; };\n\t\tF72920975A4445262D665FD6A1A5C709 /* UIScrollView+MJExtension.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIScrollView+MJExtension.h\"; path = \"MJRefresh/UIScrollView+MJExtension.h\"; sourceTree = \"<group>\"; };\n\t\tFBE581D901FAEA98EE7A5F00053AF99F /* UIScrollView+MJExtension.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIScrollView+MJExtension.m\"; path = \"MJRefresh/UIScrollView+MJExtension.m\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tECF6A1047F7BFDF799E9A4E555BA6DFB /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t62282E81A85F9B3AAC8E63B35E04D120 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2241B6329EAC3709B00192C907CC6349 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7F7EA281EE487F53B98FE21ADE26B2D0 /* MJRefresh */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4404FFA44EAF8A2EF28D46697C23A1B7 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8C70348EC26F3798A336467D302EB516 /* MJRefresh.modulemap */,\n\t\t\t\t88EC9CDE1F38CB917F06B8581C40EF9F /* MJRefresh-dummy.m */,\n\t\t\t\tA1955EA45E021BB2F8316773BDF4A81A /* MJRefresh-Info.plist */,\n\t\t\t\t1F5E209BD12893261ED8A11DD32E1213 /* MJRefresh-prefix.pch */,\n\t\t\t\tCC82BD11EEC7A008772DBE988ED5B703 /* MJRefresh-umbrella.h */,\n\t\t\t\tBD928A31DF7414D699D39C07A7D4D90D /* MJRefresh.debug.xcconfig */,\n\t\t\t\t080FA0AC5E996B54E16C34A29EFFCE82 /* MJRefresh.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/MJRefresh\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t9E19B62BAB71AD8BD42C1EC23B18FCFA /* MJRefresh */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t43FA5A3519983D874088BA091F8D2F31 /* MJRefresh.h */,\n\t\t\t\tC8B3AEB9B5686FD63BCE2C766262199D /* MJRefreshAutoFooter.h */,\n\t\t\t\t58470DEE9A8470EFE8266E1993A05241 /* MJRefreshAutoFooter.m */,\n\t\t\t\t18525C2DF514DEAA9058936A4733DA89 /* MJRefreshAutoGifFooter.h */,\n\t\t\t\tB7D65C0208542BE8CD4EF41E85425CA2 /* MJRefreshAutoGifFooter.m */,\n\t\t\t\tB93B60E92B5B06E2C169CBDF109FCF25 /* MJRefreshAutoNormalFooter.h */,\n\t\t\t\t86B31BFE09FEC0B110DA2C00E4BB1491 /* MJRefreshAutoNormalFooter.m */,\n\t\t\t\tE4AB49BB3F3F31BAB69A28EA8AA6E3AF /* MJRefreshAutoStateFooter.h */,\n\t\t\t\t5F96527B02271AA11CB11E6C013A4D2F /* MJRefreshAutoStateFooter.m */,\n\t\t\t\tCD5B4D3371949F610ADDD9FC67D4B6C4 /* MJRefreshBackFooter.h */,\n\t\t\t\t2E4A7B3C28E83362DF5773769836CB50 /* MJRefreshBackFooter.m */,\n\t\t\t\t6F1254624CFFF20A5BC1FDDD2A11C783 /* MJRefreshBackGifFooter.h */,\n\t\t\t\tC104589F417DBD4B9991FA27E7B1FC77 /* MJRefreshBackGifFooter.m */,\n\t\t\t\t2441D5ABF56275A2DDBB085CCBAD07F8 /* MJRefreshBackNormalFooter.h */,\n\t\t\t\t110B6CB3BB90F69D8C666D0D5622E987 /* MJRefreshBackNormalFooter.m */,\n\t\t\t\t38399A9DA3D4E0AD430E5B1DB845BF30 /* MJRefreshBackStateFooter.h */,\n\t\t\t\tA8C0591EB1CAB9072FA9ECC6202998D3 /* MJRefreshBackStateFooter.m */,\n\t\t\t\t20C8C276C58BA33F0BE612A66EBB0F4F /* MJRefreshComponent.h */,\n\t\t\t\t4384FFAF81B615AF96CD7F645DB137D7 /* MJRefreshComponent.m */,\n\t\t\t\tBE5D1E958F378B4FF7DB66A35205E336 /* MJRefreshConfig.h */,\n\t\t\t\t84717A5BABFB2F8DFEC12A963CB8E84F /* MJRefreshConfig.m */,\n\t\t\t\tC5E2F2E4535C8E281B04CD110E070B2A /* MJRefreshConst.h */,\n\t\t\t\tA11834F399DA22FD7A2B0B202430F9F5 /* MJRefreshConst.m */,\n\t\t\t\t440DE16BCA9050A295451626E295365A /* MJRefreshFooter.h */,\n\t\t\t\tA8E6FDB2DB5C2983705FBFC2E8A72394 /* MJRefreshFooter.m */,\n\t\t\t\t1FB69DE6E8D5CCB134C4D8CF5056E190 /* MJRefreshGifHeader.h */,\n\t\t\t\t552A5870302CAFBAE47233C5A1CEE886 /* MJRefreshGifHeader.m */,\n\t\t\t\t597AFD62EE4F27A5EC3366F19A56C486 /* MJRefreshHeader.h */,\n\t\t\t\t79AB405B86F044A6AFA279EC64CB6107 /* MJRefreshHeader.m */,\n\t\t\t\tA8F0E60501D4E6514FAF4931A03DEB8C /* MJRefreshNormalHeader.h */,\n\t\t\t\t57228039DF831E66B3DE48538A815CCB /* MJRefreshNormalHeader.m */,\n\t\t\t\tF22B891B577B7F5B3314DFAE6C8F082B /* MJRefreshNormalTrailer.h */,\n\t\t\t\t16B1D7318E43E810EA1C3FBC6B593BF6 /* MJRefreshNormalTrailer.m */,\n\t\t\t\t07CF168181A20529F6423699D107E0F9 /* MJRefreshStateHeader.h */,\n\t\t\t\t7ADEC2938E2C9610A0A5A75219C3F346 /* MJRefreshStateHeader.m */,\n\t\t\t\tEDFABDED2A4C1393CAAD1AFE0F9F7150 /* MJRefreshStateTrailer.h */,\n\t\t\t\tF48BDC185FCBDCD47E715F70771286B0 /* MJRefreshStateTrailer.m */,\n\t\t\t\tC4AECE341F3334977C288F281B85B8F1 /* MJRefreshTrailer.h */,\n\t\t\t\tF24D5737E23F380E2A898E0A06A24144 /* MJRefreshTrailer.m */,\n\t\t\t\t49196E29F6B3E998F36BD98B35A02A5F /* NSBundle+MJRefresh.h */,\n\t\t\t\tAF153425B43C3B63B24DA04B5B549B35 /* NSBundle+MJRefresh.m */,\n\t\t\t\t4843F0AB9CD66A398982860B23DB8C08 /* UICollectionViewLayout+MJRefresh.h */,\n\t\t\t\t41C870F0D2AED6473935AA49880C2FBB /* UICollectionViewLayout+MJRefresh.m */,\n\t\t\t\tF72920975A4445262D665FD6A1A5C709 /* UIScrollView+MJExtension.h */,\n\t\t\t\tFBE581D901FAEA98EE7A5F00053AF99F /* UIScrollView+MJExtension.m */,\n\t\t\t\tBB2C25B72655E400E5ADB28F6E184252 /* UIScrollView+MJRefresh.h */,\n\t\t\t\t5C7F1661904FE1AA3D857A55203E7A8A /* UIScrollView+MJRefresh.m */,\n\t\t\t\tA5529E7753E36B8C344544368027B253 /* UIView+MJExtension.h */,\n\t\t\t\t13E49F183B4188644E8AAFCC9362BA03 /* UIView+MJExtension.m */,\n\t\t\t\tCE1B93330A01D9F3EA6C1D248E41A976 /* Resources */,\n\t\t\t\t4404FFA44EAF8A2EF28D46697C23A1B7 /* Support Files */,\n\t\t\t);\n\t\t\tname = MJRefresh;\n\t\t\tpath = MJRefresh;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tAEAEFC226C911DF65796EF36956BD39F /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t44D8D7E522F43A834BE87B11A1631010 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB95AE787CE3B21DBD82B3F8B8758A70C = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE7C90B4B2955B2339B9E591667727EE3 /* Frameworks */,\n\t\t\t\t9E19B62BAB71AD8BD42C1EC23B18FCFA /* MJRefresh */,\n\t\t\t\t2241B6329EAC3709B00192C907CC6349 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCE1B93330A01D9F3EA6C1D248E41A976 /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4FFC6CA961AC0BC2EDA9DAF248E20F9F /* MJRefresh.bundle */,\n\t\t\t);\n\t\t\tname = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE7C90B4B2955B2339B9E591667727EE3 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tAEAEFC226C911DF65796EF36956BD39F /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t97436D20B895DD989F1F9F9E8431826C /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t36A174F76D6235A04247AE2A7286A47C /* MJRefresh.h in Headers */,\n\t\t\t\tF7DA170322BA81CFF80856A20AD7270F /* MJRefresh-umbrella.h in Headers */,\n\t\t\t\t7DA723284870CA3E34FBF8E5CD7D496A /* MJRefreshAutoFooter.h in Headers */,\n\t\t\t\t7964435863CAB2D78592AC59D8B2BFFD /* MJRefreshAutoGifFooter.h in Headers */,\n\t\t\t\t4EF86F05B9601FC15CCF4630366E7DB5 /* MJRefreshAutoNormalFooter.h in Headers */,\n\t\t\t\tE1ED067CC110CA06D142331F4DB11006 /* MJRefreshAutoStateFooter.h in Headers */,\n\t\t\t\tE408AB9C050888D7D1464B48BAEA1A48 /* MJRefreshBackFooter.h in Headers */,\n\t\t\t\t0631A6359C6E0AB9CDC7FC7494712B41 /* MJRefreshBackGifFooter.h in Headers */,\n\t\t\t\t4BFBB6C5DB5AE5FB828BAC90B317A15D /* MJRefreshBackNormalFooter.h in Headers */,\n\t\t\t\t2A5BF80AE6E38DBE4E6ACB42DFF32BD7 /* MJRefreshBackStateFooter.h in Headers */,\n\t\t\t\t5BB11ECE71AA55DE558749834197A18F /* MJRefreshComponent.h in Headers */,\n\t\t\t\t8814B3AF495A5C5F49BD2EF60E34F7C0 /* MJRefreshConfig.h in Headers */,\n\t\t\t\tEAB0EC8F738FB7DF533ACDB36EABB695 /* MJRefreshConst.h in Headers */,\n\t\t\t\t2A49BBFE0A0F2409103843EBED4DC163 /* MJRefreshFooter.h in Headers */,\n\t\t\t\tF0E39A057D909F1CB663FF2E9F575D88 /* MJRefreshGifHeader.h in Headers */,\n\t\t\t\t30E921FD58AEA234351DB4E819F3D901 /* MJRefreshHeader.h in Headers */,\n\t\t\t\tD330BC4099A8F1F02238E366602FE30B /* MJRefreshNormalHeader.h in Headers */,\n\t\t\t\t856CCDC34B8E6ADDCD58C5DA33DB804D /* MJRefreshNormalTrailer.h in Headers */,\n\t\t\t\t70FFB5A7DB70F9CFF7E21C1DA3E17E01 /* MJRefreshStateHeader.h in Headers */,\n\t\t\t\tDDC4F011871F4BC739261E836E57AA0D /* MJRefreshStateTrailer.h in Headers */,\n\t\t\t\tD3C3C611A329269A156F45DFDF9A8E91 /* MJRefreshTrailer.h in Headers */,\n\t\t\t\tCDCCA13F77984F0FF6942C457143B29B /* NSBundle+MJRefresh.h in Headers */,\n\t\t\t\t39BFB68E73BF53D708803B87FD7EE9A3 /* UICollectionViewLayout+MJRefresh.h in Headers */,\n\t\t\t\t7CB29F84EBD91E4205E150D4D7D62B49 /* UIScrollView+MJExtension.h in Headers */,\n\t\t\t\tCEFD08B2DCC67D97459F709E346C1853 /* UIScrollView+MJRefresh.h in Headers */,\n\t\t\t\tFA78E940165504DE8B6E1B2749D74007 /* UIView+MJExtension.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tE94AEF767442EDAAAAB2129CDFA2C2ED /* MJRefresh */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = FF85C1B78EA845501A2D609AC51AE61F /* Build configuration list for PBXNativeTarget \"MJRefresh\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t97436D20B895DD989F1F9F9E8431826C /* Headers */,\n\t\t\t\tDDA7CA5162DB1F2930B422FA2BAFB1B8 /* Sources */,\n\t\t\t\tECF6A1047F7BFDF799E9A4E555BA6DFB /* Frameworks */,\n\t\t\t\t658B29EBF202D32FFE881C4071D1EBDA /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = MJRefresh;\n\t\t\tproductName = MJRefresh;\n\t\t\tproductReference = 7F7EA281EE487F53B98FE21ADE26B2D0 /* MJRefresh */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t3B10AF78032EF059DE917055F34E9117 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3C89D7681CC38E9662853C5EFE32E911 /* Build configuration list for PBXProject \"MJRefresh\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = B95AE787CE3B21DBD82B3F8B8758A70C;\n\t\t\tproductRefGroup = 2241B6329EAC3709B00192C907CC6349 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tE94AEF767442EDAAAAB2129CDFA2C2ED /* MJRefresh */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t658B29EBF202D32FFE881C4071D1EBDA /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t55C88F53D787B5CD219A75F911348CFA /* MJRefresh.bundle in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tDDA7CA5162DB1F2930B422FA2BAFB1B8 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t044148683535C16980608537C5F57641 /* MJRefresh-dummy.m in Sources */,\n\t\t\t\tC2803AF134E94E3647FE96BE84DAB3F0 /* MJRefreshAutoFooter.m in Sources */,\n\t\t\t\tF178D39A3D452970EE18BB815C051392 /* MJRefreshAutoGifFooter.m in Sources */,\n\t\t\t\t9DA915A8839FC6E659B1DBD64C2B2919 /* MJRefreshAutoNormalFooter.m in Sources */,\n\t\t\t\tF3296330F194054B2141781FD74C899D /* MJRefreshAutoStateFooter.m in Sources */,\n\t\t\t\t09AD0E8B43AD6A78D977BF2602E04C21 /* MJRefreshBackFooter.m in Sources */,\n\t\t\t\t5FE13741788A0F1F3BBE358AF43D2D54 /* MJRefreshBackGifFooter.m in Sources */,\n\t\t\t\t39A26AE6B330EB17FB5C5DFF5D8DDDDA /* MJRefreshBackNormalFooter.m in Sources */,\n\t\t\t\tA3B657B524C1284D2A568DB9D90CEFE0 /* MJRefreshBackStateFooter.m in Sources */,\n\t\t\t\t9FCF9642A629338D1436C5BEB2F92C7A /* MJRefreshComponent.m in Sources */,\n\t\t\t\t04B982CA09C3EEC1C2721A0E17FEFA70 /* MJRefreshConfig.m in Sources */,\n\t\t\t\tB799C6B90D9CCF7806DF237000BD3270 /* MJRefreshConst.m in Sources */,\n\t\t\t\t7723A9E9155267D7906448928958642B /* MJRefreshFooter.m in Sources */,\n\t\t\t\t0F6291F10BC74C816845A043FC23643B /* MJRefreshGifHeader.m in Sources */,\n\t\t\t\tA6DECF9EB28B651518899B0D9809C662 /* MJRefreshHeader.m in Sources */,\n\t\t\t\tCF01414B77A82D421A354D1E10EC86E4 /* MJRefreshNormalHeader.m in Sources */,\n\t\t\t\t6FE3402231E508D0BB1E65B214C33F3B /* MJRefreshNormalTrailer.m in Sources */,\n\t\t\t\tEA4AC451B3B3F5C04A5F579A0B6FC13D /* MJRefreshStateHeader.m in Sources */,\n\t\t\t\t99D22CDEEEC491ED6107FD2C8DC86C1A /* MJRefreshStateTrailer.m in Sources */,\n\t\t\t\t5FDDC41638DAB5526DB83EEDDE765480 /* MJRefreshTrailer.m in Sources */,\n\t\t\t\t064E4EBD8AFD0B1A8F4A19FF79877BDF /* NSBundle+MJRefresh.m in Sources */,\n\t\t\t\t1494B3436E9A256649430FAFFEC77A06 /* UICollectionViewLayout+MJRefresh.m in Sources */,\n\t\t\t\t84FF04545FA08788AB79B3CF82C6EC2A /* UIScrollView+MJExtension.m in Sources */,\n\t\t\t\t2E72898ECF760143B0E6B2E5ED3D899E /* UIScrollView+MJRefresh.m in Sources */,\n\t\t\t\t64CE5823916F5ABB5BC2C233C2BE615F /* UIView+MJExtension.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2F102BB15FD3318862EC4E8411079D72 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 080FA0AC5E996B54E16C34A29EFFCE82 /* MJRefresh.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/MJRefresh/MJRefresh-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/MJRefresh/MJRefresh-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/MJRefresh/MJRefresh.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = MJRefresh;\n\t\t\t\tPRODUCT_NAME = MJRefresh;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t7B1B74251A3504D935018B581CBFE811 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tB8FA03E562237675A30E4C9C55BFEEA6 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tCE858A41F8CE91C60CA080FCFBA7C8EA /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = BD928A31DF7414D699D39C07A7D4D90D /* MJRefresh.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/MJRefresh/MJRefresh-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/MJRefresh/MJRefresh-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/MJRefresh/MJRefresh.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = MJRefresh;\n\t\t\t\tPRODUCT_NAME = MJRefresh;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3C89D7681CC38E9662853C5EFE32E911 /* Build configuration list for PBXProject \"MJRefresh\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7B1B74251A3504D935018B581CBFE811 /* Debug */,\n\t\t\t\tB8FA03E562237675A30E4C9C55BFEEA6 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tFF85C1B78EA845501A2D609AC51AE61F /* Build configuration list for PBXNativeTarget \"MJRefresh\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tCE858A41F8CE91C60CA080FCFBA7C8EA /* Debug */,\n\t\t\t\t2F102BB15FD3318862EC4E8411079D72 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 3B10AF78032EF059DE917055F34E9117 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/License.md",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014-present Artsy, Ash Furrow\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/Moya/Readme.md",
    "content": "<p align=\"center\">\n  <img height=\"160\" src=\"web/logo_github.png\" />\n</p>\n\n# Moya 15.0.0\n\n[![CircleCI](https://img.shields.io/circleci/project/github/Moya/Moya/master.svg)](https://circleci.com/gh/Moya/Moya/tree/master)\n[![codecov.io](https://codecov.io/github/Moya/Moya/coverage.svg?branch=master)](https://codecov.io/github/Moya/Moya?branch=master)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Accio supported](https://img.shields.io/badge/Accio-supported-0A7CF5.svg?style=flat)](https://github.com/JamitLabs/Accio)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/Moya.svg)](https://cocoapods.org/pods/Moya)\n[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n\n*A Chinese version of this document can be found [here](https://github.com/Moya/Moya/blob/master/Readme_CN.md).*\n\nYou're a smart developer. You probably use [Alamofire](https://github.com/Alamofire/Alamofire) to abstract away access to\n`URLSession` and all those nasty details you don't really care about. But then,\nlike lots of smart developers, you write ad hoc network abstraction layers. They\nare probably called \"APIManager\" or \"NetworkModel\", and they always end in tears.\n\n![Moya Overview](web/diagram.png)\n\nAd hoc network layers are common in iOS apps. They're bad for a few reasons:\n\n- Makes it hard to write new apps (\"where do I begin?\")\n- Makes it hard to maintain existing apps (\"oh my god, this mess...\")\n- Makes it hard to write unit tests (\"how do I do this again?\")\n\nSo the basic idea of Moya is that we want some network abstraction layer that\nsufficiently encapsulates actually calling Alamofire directly. It should be simple\nenough that common things are easy, but comprehensive enough that complicated things\nare also easy.\n\n> If you use Alamofire to abstract away `URLSession`, why not use something\nto abstract away the nitty gritty of URLs, parameters, etc?\n\nSome awesome features of Moya:\n\n- Compile-time checking for correct API endpoint accesses.\n- Lets you define a clear usage of different endpoints with associated enum values.\n- Treats test stubs as first-class citizens so unit testing is super-easy.\n\nYou can check out more about the project direction in the [vision document](https://github.com/Moya/Moya/blob/master/Vision.md).\n\n## Sample Projects\n\nWe have provided two sample projects in the repository. To use it download the repo, run `carthage update` to download the required libraries and  open [Moya.xcodeproj](https://github.com/Moya/Moya/tree/master/Moya.xcodeproj). You'll see two schemes: `Basic` and `Multi-Target` - select one and then build & run! Source files for these are in the `Examples` directory in project navigator. Have fun!\n\n## Project Status\n\nThis project is actively under development, and is being used in [Artsy's\nnew auction app](https://github.com/Artsy/eidolon). We consider it\nready for production use.\n\n## Installation\n\n### Moya version vs Swift version.\n\nBelow is a table that shows which version of Moya you should use for\nyour Swift version.\n\n| Swift | Moya           | RxMoya          | ReactiveMoya   |\n| ----- | -------------- |---------------- |--------------- |\n| 5.X   | >= 13.0.0      | >= 13.0.0       | >= 13.0.0      |\n| 4.X   | 9.0.0 - 12.0.1 | 10.0.0 - 12.0.1 | 9.0.0 - 12.0.1 |\n| 3.X   | 8.0.0 - 8.0.5  | 8.0.0 - 8.0.5   | 8.0.0 - 8.0.5  |\n| 2.3   | 7.0.2 - 7.0.4  | 7.0.2 - 7.0.4   | 7.0.2 - 7.0.4  |\n| 2.2   | <= 7.0.1       | <= 7.0.1        | <= 7.0.1       |\n\n_Note: If you are using Swift 4.2 in your project, but you are using Xcode 10.2, Moya 13 should work correctly even though we use Swift 5.0._\n\n**Upgrading to a new major version of Moya? Check out our [migration guides](https://github.com/Moya/Moya/blob/master/docs/MigrationGuides).**\n\n### Swift Package Manager\n\n_Note: Instructions below are for using **SwiftPM** without the Xcode UI. It's the easiest to go to your Project Settings -> Swift Packages and add Moya from there._\n\nTo integrate using Apple's Swift package manager, without Xcode integration, add the following as a dependency to your `Package.swift`:\n\n```swift\n.package(url: \"https://github.com/Moya/Moya.git\", .upToNextMajor(from: \"15.0.0\"))\n```\n\nand then specify `\"Moya\"` as a dependency of the Target in which you wish to use Moya.\nIf you want to use reactive extensions, add also `\"ReactiveMoya\"`, `\"RxMoya\"` or\n`\"CombineMoya\"` as your target dependency respectively.\nHere's an example `PackageDescription`:\n\n```swift\n// swift-tools-version:5.3\nimport PackageDescription\n\nlet package = Package(\n    name: \"MyPackage\",\n    products: [\n        .library(\n            name: \"MyPackage\",\n            targets: [\"MyPackage\"]),\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/Moya/Moya.git\", .upToNextMajor(from: \"15.0.0\"))\n    ],\n    targets: [\n        .target(\n            name: \"MyPackage\",\n            dependencies: [\"ReactiveMoya\"])\n    ]\n)\n```\n\nNote: If you are using **ReactiveMoya**, we are using [our own fork of ReactiveSwift](https://github.com/Moya/ReactiveSwift). This fork adds 2 commits to remove testing dependencies on releases (starting 6.1.0). This is to prevent Xcode Previews on Xcode 11/11.1 to build testing dependencies (FB7316430). If you don't want to use our fork, you can just add another dependency to your SPM package list: `git@github.com:ReactiveCocoa/ReactiveSwift.git` and it should fetch the original repository.\n\nCombine note: if you're using **CombineMoya**, make sure that you use Xcode 11.5.0 \nor later. With earlier versions of Xcode you will have to manually add Combine as\na weakly linked framework to your application target.\n\n### Accio\n\n[Accio](https://github.com/JamitLabs/Accio) is a dependency manager based on SwiftPM which can build frameworks for iOS/macOS/tvOS/watchOS. Therefore the integration steps of Moya are exactly the same as described above. Once your `Package.swift` file is configured, run `accio update` instead of `swift package update`.\n\n### CocoaPods\n\nFor Moya, use the following entry in your Podfile:\n\n```rb\npod 'Moya', '~> 15.0'\n\n# or \n\npod 'Moya/RxSwift', '~> 15.0'\n\n# or\n\npod 'Moya/ReactiveSwift', '~> 15.0'\n\n#or\n\npod 'Moya/Combine', '~> 15.0'\n```\n\nThen run `pod install`.\n\nIn any file you'd like to use Moya in, don't forget to\nimport the framework with `import Moya`.\n\n### Carthage\n\nCarthage users can point to this repository and use whichever\ngenerated framework they'd like, `Moya`, `RxMoya`, `ReactiveMoya`, or\n`CombineMoya`.\n\nMake the following entry in your Cartfile:\n\n```\ngithub \"Moya/Moya\" ~> 15.0\n```\n\nThen run `carthage update --use-xcframeworks`.\n\nIf this is your first time using Carthage in the project, you'll need to go through some additional steps as explained [over at Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application).\n\n> NOTE: At this time, Carthage does not provide a way to build only specific repository submodules. All submodules and their dependencies will be built with the above command. However, you don't need to copy frameworks you aren't using into your project. For instance, if you aren't using `ReactiveSwift`, feel free to delete that framework along with `ReactiveMoya` from the Carthage Build directory after `carthage update` completes. Or if you are using `ReactiveSwift` but not `RxSwift` or `Combine`, then `RxMoya`, `RxTest`, `RxCocoa`, `CombineMoya` etc. can safely be deleted.\n\n### Manually\n\n- Open up Terminal, `cd` into your top-level project directory, and run the following command *if* your project is not initialized as a git repository:\n\n```bash\n$ git init\n```\n\n- Add Alamofire & Moya as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following commands:\n\n```bash\n$ git submodule add https://github.com/Alamofire/Alamofire.git\n$ git submodule add https://github.com/Moya/Moya.git\n```\n\n- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project. Do the same with the `Moya.xcodeproj` in the `Moya` folder.\n\n> They should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.\n\n- Verify that the deployment targets of the `xcodeproj`s match that of your application target in the Project Navigator.\n- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the \"Targets\" heading in the sidebar.\n- In the tab bar at the top of that window, open the \"General\" panel.\n- Click on the `+` button under the \"Embedded Binaries\" section.\n- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder.\n\n> It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`.\n\n- Select the top `Alamofire.framework` for iOS and the bottom one for macOS.\n\n> You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as either `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS` or `Alamofire watchOS`.\n\n- Click on the `+` button under \"Embedded Binaries\" again and add the correct build target for `Moya`.\n\n- And that's it!\n\n> The three frameworks are automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.\n\n## Usage\n\nAfter [some setup](https://github.com/Moya/Moya/blob/master/docs/Examples/Basic.md), using Moya is really simple. You can access an API like this:\n\n```swift\nprovider = MoyaProvider<GitHub>()\nprovider.request(.zen) { result in\n    switch result {\n    case let .success(moyaResponse):\n        let data = moyaResponse.data\n        let statusCode = moyaResponse.statusCode\n        // do something with the response data or statusCode\n    case let .failure(error):\n        // this means there was a network failure - either the request\n        // wasn't sent (connectivity), or no response was received (server\n        // timed out).  If the server responds with a 4xx or 5xx error, that\n        // will be sent as a \".success\"-ful response.\n    }\n}\n```\n\nThat's a basic example. Many API requests need parameters. Moya encodes these\ninto the enum you use to access the endpoint, like this:\n\n```swift\nprovider = MoyaProvider<GitHub>()\nprovider.request(.userProfile(\"ashfurrow\")) { result in\n    // do something with the result\n}\n```\n\nNo more typos in URLs. No more missing parameter values. No more messing with\nparameter encoding.\n\nFor more examples, see the [documentation](https://github.com/Moya/Moya/blob/master/docs/Examples).\n\n## Reactive Extensions\n\nEven cooler are the reactive extensions. Moya provides reactive extensions for\n[ReactiveSwift](https://github.com/ReactiveCocoa/ReactiveSwift),\n[RxSwift](https://github.com/ReactiveX/RxSwift), and \n[Combine](https://developer.apple.com/documentation/combine).\n\n### ReactiveSwift\n\n[`ReactiveSwift` extension](https://github.com/Moya/Moya/blob/master/docs/ReactiveSwift.md) provides both `reactive.request(:callbackQueue:)` and \n`reactive.requestWithProgress(:callbackQueue:)` methods that immediately return\n`SignalProducer`s that you can start, bind, map, or whatever you want to do.\nTo handle errors, for instance, we could do the following:\n\n```swift\nprovider = MoyaProvider<GitHub>()\nprovider.reactive.request(.userProfile(\"ashfurrow\")).start { event in\n    switch event {\n    case let .value(response):\n        image = UIImage(data: response.data)\n    case let .failed(error):\n        print(error)\n    default:\n        break\n    }\n}\n```\n\n### RxSwift\n\n[`RxSwift` extension](https://github.com/Moya/Moya/blob/master/docs/RxSwift.md) also provide both `rx.request(:callbackQueue:)` and\n`rx.requestWithProgress(:callbackQueue:)` methods, but return type is\ndifferent for both. In case of a normal `rx.request(:callbackQueue)`, the\nreturn type is `Single<Response>` which emits either single element or an\nerror. In case of a `rx.requestWithProgress(:callbackQueue:)`, the return \ntype is `Observable<ProgressResponse>`, since we may get multiple events\nfrom progress and one last event which is a response.\n\nTo handle errors, for instance, we could do the following:\n\n```swift\nprovider = MoyaProvider<GitHub>()\nprovider.rx.request(.userProfile(\"ashfurrow\")).subscribe { event in\n    switch event {\n    case let .success(response):\n        image = UIImage(data: response.data)\n    case let .error(error):\n        print(error)\n    }\n}\n```\n\nIn addition to the option of using signals instead of callback blocks, there are\nalso a series of signal operators for RxSwift and ReactiveSwift that will attempt\nto map the data received from the network response into either an image, some JSON,\nor a string, with `mapImage()`, `mapJSON()`, and `mapString()`, respectively. If the mapping is unsuccessful, you'll get an error on the signal. You also get handy methods\nfor filtering out certain status codes. This means that you can place your code for\nhandling API errors like 400's in the same places as code for handling invalid\nresponses.\n\n### Combine\n\n`Combine` extension provides `requestPublisher(:callbackQueue:)` and\n`requestWithProgressPublisher(:callbackQueue)` returning \n`AnyPublisher<Response, MoyaError>` and `AnyPublisher<ProgressResponse, MoyaError>`\nrespectively.\n\nHere's an example of `requestPublisher` usage:\n\n```swift\nprovider = MoyaProvider<GitHub>()\nlet cancellable = provider.requestPublisher(.userProfile(\"ashfurrow\"))\n    .sink(receiveCompletion: { completion in\n        guard case let .failure(error) = completion else { return }\n\n        print(error)\n    }, receiveValue: { response in\n        image = UIImage(data: response.data)\n    })\n```\n\n## Community Projects\n\n[Moya has a great community around it and some people have created some very helpful extensions](https://github.com/Moya/Moya/blob/master/docs/CommunityProjects.md).\n\n## Contributing\n\nHey! Do you like Moya? Awesome! We could actually really use your help!\n\nOpen source isn't just writing code. Moya could use your help with any of the\nfollowing:\n\n- Finding (and reporting!) bugs.\n- New feature suggestions.\n- Answering questions on issues.\n- Documentation improvements.\n- Reviewing pull requests.\n- Helping to manage issue priorities.\n- Fixing bugs/new features.\n\nIf any of that sounds cool to you, send a pull request! After your first\ncontribution, we will add you as a member to the repo so you can merge pull\nrequests and help steer the ship :ship: You can read more details about that [in our contributor guidelines](https://github.com/Moya/Moya/blob/master/Contributing.md).\n\nMoya's community has a tremendous positive energy, and the maintainers are committed to keeping things awesome. Like [in the CocoaPods community](https://github.com/CocoaPods/CocoaPods/wiki/Communication-&-Design-Rules), always assume positive intent; even if a comment sounds mean-spirited, give the person the benefit of the doubt.\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by [its terms](https://github.com/Moya/Moya/blob/master/Code%20of%20Conduct.md).\n\n### Adding new source files\n\nIf you add or remove a source file from Moya, a corresponding change needs to be made to the `Moya.xcodeproj` project at the root of this repository. This project is used for Carthage. Don't worry, you'll get an automated warning when submitting a pull request if you forget.\n\n### Help us improve Moya documentation\nWhether you’re a core member or a user trying it out for the first time, you can make a valuable contribution to Moya by improving the documentation. Help us by:\n\n- sending us feedback about something you thought was confusing or simply missing\n- suggesting better wording or ways of explaining certain topics\n- sending us a pull request via GitHub\n- improving the [Chinese documentation](https://github.com/Moya/Moya/blob/master/Readme_CN.md)\n\n\n## License\n\nMoya is released under an MIT license. See [License.md](https://github.com/Moya/Moya/blob/master/License.md) for more information.\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/AnyEncodable.swift",
    "content": "import Foundation\n\nstruct AnyEncodable: Encodable {\n\n    private let encodable: Encodable\n\n    public init(_ encodable: Encodable) {\n        self.encodable = encodable\n    }\n\n    func encode(to encoder: Encoder) throws {\n        try encodable.encode(to: encoder)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Atomic.swift",
    "content": "//\n//  Atomic.swift\n//  Moya\n//\n//  Created by Luciano Almeida on 15/12/19.\n//\n\nimport Foundation\n\n@propertyWrapper\nfinal class Atomic<Value> {\n    private var lock: NSRecursiveLock = NSRecursiveLock()\n\n    private var value: Value\n\n    var wrappedValue: Value {\n        get {\n            lock.lock(); defer { lock.unlock() }\n            return value\n        }\n\n        set {\n            lock.lock(); defer { lock.unlock() }\n            value = newValue\n        }\n    }\n\n    init(wrappedValue value: Value) {\n        self.value = value\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Cancellable.swift",
    "content": "/// Protocol to define the opaque type returned from a request.\npublic protocol Cancellable {\n\n    /// A Boolean value stating whether a request is cancelled.\n    var isCancelled: Bool { get }\n\n    /// Cancels the represented request.\n    func cancel()\n}\n\ninternal class CancellableWrapper: Cancellable {\n    internal var innerCancellable: Cancellable = SimpleCancellable()\n\n    var isCancelled: Bool { innerCancellable.isCancelled }\n\n    internal func cancel() {\n        innerCancellable.cancel()\n    }\n}\n\ninternal class SimpleCancellable: Cancellable {\n    var isCancelled = false\n    func cancel() {\n        isCancelled = true\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Endpoint.swift",
    "content": "import Foundation\n\n/// Used for stubbing responses.\npublic enum EndpointSampleResponse {\n\n    /// The network returned a response, including status code and data.\n    case networkResponse(Int, Data)\n\n    /// The network returned response which can be fully customized.\n    case response(HTTPURLResponse, Data)\n\n    /// The network failed to send the request, or failed to retrieve a response (eg a timeout).\n    case networkError(NSError)\n}\n\n/// Class for reifying a target of the `Target` enum unto a concrete `Endpoint`.\n/// - Note: As of Moya 11.0.0 Endpoint is no longer generic.\n///   Existing code should work as is after removing the generic.\n///   See #1529 and #1524 for the discussion.\nopen class Endpoint {\n    public typealias SampleResponseClosure = () -> EndpointSampleResponse\n\n    /// A string representation of the URL for the request.\n    public let url: String\n\n    /// A closure responsible for returning an `EndpointSampleResponse`.\n    public let sampleResponseClosure: SampleResponseClosure\n\n    /// The HTTP method for the request.\n    public let method: Moya.Method\n\n    /// The `Task` for the request.\n    public let task: Task\n\n    /// The HTTP header fields for the request.\n    public let httpHeaderFields: [String: String]?\n\n    public init(url: String,\n                sampleResponseClosure: @escaping SampleResponseClosure,\n                method: Moya.Method,\n                task: Task,\n                httpHeaderFields: [String: String]?) {\n\n        self.url = url\n        self.sampleResponseClosure = sampleResponseClosure\n        self.method = method\n        self.task = task\n        self.httpHeaderFields = httpHeaderFields\n    }\n\n    /// Convenience method for creating a new `Endpoint` with the same properties as the receiver, but with added HTTP header fields.\n    open func adding(newHTTPHeaderFields: [String: String]) -> Endpoint {\n        Endpoint(url: url, sampleResponseClosure: sampleResponseClosure, method: method, task: task, httpHeaderFields: add(httpHeaderFields: newHTTPHeaderFields))\n    }\n\n    /// Convenience method for creating a new `Endpoint` with the same properties as the receiver, but with replaced `task` parameter.\n    open func replacing(task: Task) -> Endpoint {\n        Endpoint(url: url, sampleResponseClosure: sampleResponseClosure, method: method, task: task, httpHeaderFields: httpHeaderFields)\n    }\n\n    fileprivate func add(httpHeaderFields headers: [String: String]?) -> [String: String]? {\n        guard let unwrappedHeaders = headers, unwrappedHeaders.isEmpty == false else {\n            return self.httpHeaderFields\n        }\n\n        var newHTTPHeaderFields = self.httpHeaderFields ?? [:]\n        unwrappedHeaders.forEach { key, value in\n            newHTTPHeaderFields[key] = value\n        }\n        return newHTTPHeaderFields\n    }\n}\n\n/// Extension for converting an `Endpoint` into a `URLRequest`.\npublic extension Endpoint {\n    // swiftlint:disable cyclomatic_complexity\n    /// Returns the `Endpoint` converted to a `URLRequest` if valid. Throws an error otherwise.\n    func urlRequest() throws -> URLRequest {\n        guard let requestURL = Foundation.URL(string: url) else {\n            throw MoyaError.requestMapping(url)\n        }\n\n        var request = URLRequest(url: requestURL)\n        request.httpMethod = method.rawValue\n        request.allHTTPHeaderFields = httpHeaderFields\n\n        switch task {\n        case .requestPlain, .uploadFile, .uploadMultipart, .downloadDestination:\n            return request\n        case .requestData(let data):\n            request.httpBody = data\n            return request\n        case let .requestJSONEncodable(encodable):\n            return try request.encoded(encodable: encodable)\n        case let .requestCustomJSONEncodable(encodable, encoder: encoder):\n            return try request.encoded(encodable: encodable, encoder: encoder)\n        case let .requestParameters(parameters, parameterEncoding):\n            return try request.encoded(parameters: parameters, parameterEncoding: parameterEncoding)\n        case let .uploadCompositeMultipart(_, urlParameters):\n            let parameterEncoding = URLEncoding(destination: .queryString)\n            return try request.encoded(parameters: urlParameters, parameterEncoding: parameterEncoding)\n        case let .downloadParameters(parameters, parameterEncoding, _):\n            return try request.encoded(parameters: parameters, parameterEncoding: parameterEncoding)\n        case let .requestCompositeData(bodyData: bodyData, urlParameters: urlParameters):\n            request.httpBody = bodyData\n            let parameterEncoding = URLEncoding(destination: .queryString)\n            return try request.encoded(parameters: urlParameters, parameterEncoding: parameterEncoding)\n        case let .requestCompositeParameters(bodyParameters: bodyParameters, bodyEncoding: bodyParameterEncoding, urlParameters: urlParameters):\n            if let bodyParameterEncoding = bodyParameterEncoding as? URLEncoding, bodyParameterEncoding.destination != .httpBody {\n                fatalError(\"Only URLEncoding that `bodyEncoding` accepts is URLEncoding.httpBody. Others like `default`, `queryString` or `methodDependent` are prohibited - if you want to use them, add your parameters to `urlParameters` instead.\")\n            }\n            let bodyfulRequest = try request.encoded(parameters: bodyParameters, parameterEncoding: bodyParameterEncoding)\n            let urlEncoding = URLEncoding(destination: .queryString)\n            return try bodyfulRequest.encoded(parameters: urlParameters, parameterEncoding: urlEncoding)\n        }\n    }\n    // swiftlint:enable cyclomatic_complexity\n}\n\n/// Required for using `Endpoint` as a key type in a `Dictionary`.\nextension Endpoint: Equatable, Hashable {\n    public func hash(into hasher: inout Hasher) {\n        switch task {\n        case let .uploadFile(file):\n            hasher.combine(file)\n        case let .uploadMultipart(multipartData), let .uploadCompositeMultipart(multipartData, _):\n            hasher.combine(multipartData)\n        default:\n            break\n        }\n\n        if let request = try? urlRequest() {\n            hasher.combine(request)\n        } else {\n            hasher.combine(url)\n        }\n    }\n\n    /// Note: If both Endpoints fail to produce a URLRequest the comparison will\n    /// fall back to comparing each Endpoint's hashValue.\n    public static func == (lhs: Endpoint, rhs: Endpoint) -> Bool {\n        let areEndpointsEqualInAdditionalProperties: Bool = {\n            switch (lhs.task, rhs.task) {\n            case (let .uploadFile(file1), let .uploadFile(file2)):\n                return file1 == file2\n            case (let .uploadMultipart(multipartData1), let .uploadMultipart(multipartData2)),\n                 (let .uploadCompositeMultipart(multipartData1, _), let .uploadCompositeMultipart(multipartData2, _)):\n                return multipartData1 == multipartData2\n            default:\n                return true\n            }\n        }()\n        let lhsRequest = try? lhs.urlRequest()\n        let rhsRequest = try? rhs.urlRequest()\n        if lhsRequest != nil, rhsRequest == nil { return false }\n        if lhsRequest == nil, rhsRequest != nil { return false }\n        if lhsRequest == nil, rhsRequest == nil { return lhs.hashValue == rhs.hashValue && areEndpointsEqualInAdditionalProperties }\n        return lhsRequest == rhsRequest && areEndpointsEqualInAdditionalProperties\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Image.swift",
    "content": "#if canImport(UIKit)\n    import UIKit.UIImage\n    public typealias ImageType = UIImage\n#elseif canImport(AppKit)\n    import AppKit.NSImage\n    public typealias ImageType = NSImage\n#endif\n\n/// An alias for the SDK's image type.\npublic typealias Image = ImageType\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Moya+Alamofire.swift",
    "content": "import Foundation\nimport Alamofire\n\npublic typealias Session = Alamofire.Session\ninternal typealias Request = Alamofire.Request\ninternal typealias DownloadRequest = Alamofire.DownloadRequest\ninternal typealias UploadRequest = Alamofire.UploadRequest\ninternal typealias DataRequest = Alamofire.DataRequest\n\ninternal typealias URLRequestConvertible = Alamofire.URLRequestConvertible\n\n/// Represents an HTTP method.\npublic typealias Method = Alamofire.HTTPMethod\n\n/// Choice of parameter encoding.\npublic typealias ParameterEncoding = Alamofire.ParameterEncoding\npublic typealias JSONEncoding = Alamofire.JSONEncoding\npublic typealias URLEncoding = Alamofire.URLEncoding\n\n/// Multipart form.\npublic typealias RequestMultipartFormData = Alamofire.MultipartFormData\n\n/// Multipart form data encoding result.\npublic typealias DownloadDestination = Alamofire.DownloadRequest.Destination\n\n/// Make the Alamofire Request type conform to our type, to prevent leaking Alamofire to plugins.\nextension Request: RequestType {\n    public var sessionHeaders: [String: String] {\n        delegate?.sessionConfiguration.httpAdditionalHeaders as? [String: String] ?? [:]\n    }\n}\n\n/// Represents Request interceptor type that can modify/act on Request\npublic typealias RequestInterceptor = Alamofire.RequestInterceptor\n\n/// Internal token that can be used to cancel requests\npublic final class CancellableToken: Cancellable, CustomDebugStringConvertible {\n    let cancelAction: () -> Void\n    let request: Request?\n\n    public fileprivate(set) var isCancelled = false\n\n    fileprivate var lock: DispatchSemaphore = DispatchSemaphore(value: 1)\n\n    public func cancel() {\n        _ = lock.wait(timeout: DispatchTime.distantFuture)\n        defer { lock.signal() }\n        guard !isCancelled else { return }\n        isCancelled = true\n        cancelAction()\n    }\n\n    public init(action: @escaping () -> Void) {\n        self.cancelAction = action\n        self.request = nil\n    }\n\n    init(request: Request) {\n        self.request = request\n        self.cancelAction = {\n            request.cancel()\n        }\n    }\n\n    /// A textual representation of this instance, suitable for debugging.\n    public var debugDescription: String {\n        guard let request = self.request else {\n            return \"Empty Request\"\n        }\n        return request.cURLDescription()\n    }\n\n}\n\ninternal typealias RequestableCompletion = (HTTPURLResponse?, URLRequest?, Data?, Swift.Error?) -> Void\n\ninternal protocol Requestable {\n    func response(callbackQueue: DispatchQueue?, completionHandler: @escaping RequestableCompletion) -> Self\n}\n\nextension DataRequest: Requestable {\n    internal func response(callbackQueue: DispatchQueue?, completionHandler: @escaping RequestableCompletion) -> Self {\n        if let callbackQueue = callbackQueue {\n            return response(queue: callbackQueue) { handler  in\n                completionHandler(handler.response, handler.request, handler.data, handler.error)\n            }\n        } else {\n            return response { handler  in\n                completionHandler(handler.response, handler.request, handler.data, handler.error)\n            }\n        }\n    }\n}\n\nextension DownloadRequest: Requestable {\n    internal func response(callbackQueue: DispatchQueue?, completionHandler: @escaping RequestableCompletion) -> Self {\n        if let callbackQueue = callbackQueue {\n            return response(queue: callbackQueue) { handler  in\n                completionHandler(handler.response, handler.request, nil, handler.error)\n            }\n        } else {\n            return response { handler  in\n                completionHandler(handler.response, handler.request, nil, handler.error)\n            }\n        }\n    }\n}\n\nfinal class MoyaRequestInterceptor: RequestInterceptor {\n    var prepare: ((URLRequest) -> URLRequest)?\n\n    @Atomic\n    var willSend: ((URLRequest) -> Void)?\n\n    init(prepare: ((URLRequest) -> URLRequest)? = nil, willSend: ((URLRequest) -> Void)? = nil) {\n        self.prepare = prepare\n        self.willSend = willSend\n    }\n\n    func adapt(_ urlRequest: URLRequest, for session: Alamofire.Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        let request = prepare?(urlRequest) ?? urlRequest\n        willSend?(request)\n        completion(.success(request))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/MoyaError.swift",
    "content": "import Foundation\n\n/// A type representing possible errors Moya can throw.\npublic enum MoyaError: Swift.Error {\n\n    /// Indicates a response failed to map to an image.\n    case imageMapping(Response)\n\n    /// Indicates a response failed to map to a JSON structure.\n    case jsonMapping(Response)\n\n    /// Indicates a response failed to map to a String.\n    case stringMapping(Response)\n\n    /// Indicates a response failed to map to a Decodable object.\n    case objectMapping(Swift.Error, Response)\n\n    /// Indicates that Encodable couldn't be encoded into Data\n    case encodableMapping(Swift.Error)\n\n    /// Indicates a response failed with an invalid HTTP status code.\n    case statusCode(Response)\n\n    /// Indicates a response failed due to an underlying `Error`.\n    case underlying(Swift.Error, Response?)\n\n    /// Indicates that an `Endpoint` failed to map to a `URLRequest`.\n    case requestMapping(String)\n\n    /// Indicates that an `Endpoint` failed to encode the parameters for the `URLRequest`.\n    case parameterEncoding(Swift.Error)\n}\n\npublic extension MoyaError {\n    /// Depending on error type, returns a `Response` object.\n    var response: Moya.Response? {\n        switch self {\n        case .imageMapping(let response): return response\n        case .jsonMapping(let response): return response\n        case .stringMapping(let response): return response\n        case .objectMapping(_, let response): return response\n        case .encodableMapping: return nil\n        case .statusCode(let response): return response\n        case .underlying(_, let response): return response\n        case .requestMapping: return nil\n        case .parameterEncoding: return nil\n        }\n    }\n\n    /// Depending on error type, returns an underlying `Error`.\n    internal var underlyingError: Swift.Error? {\n        switch self {\n        case .imageMapping: return nil\n        case .jsonMapping: return nil\n        case .stringMapping: return nil\n        case .objectMapping(let error, _): return error\n        case .encodableMapping(let error): return error\n        case .statusCode: return nil\n        case .underlying(let error, _): return error\n        case .requestMapping: return nil\n        case .parameterEncoding(let error): return error\n        }\n    }\n}\n\n// MARK: - Error Descriptions\n\nextension MoyaError: LocalizedError {\n    public var errorDescription: String? {\n        switch self {\n        case .imageMapping:\n            return \"Failed to map data to an Image.\"\n        case .jsonMapping:\n            return \"Failed to map data to JSON.\"\n        case .stringMapping:\n            return \"Failed to map data to a String.\"\n        case .objectMapping:\n            return \"Failed to map data to a Decodable object.\"\n        case .encodableMapping:\n            return \"Failed to encode Encodable object into data.\"\n        case .statusCode:\n            return \"Status code didn't fall within the given range.\"\n        case .underlying(let error, _):\n            return error.localizedDescription\n        case .requestMapping:\n            return \"Failed to map Endpoint to a URLRequest.\"\n        case .parameterEncoding(let error):\n            return \"Failed to encode parameters for URLRequest. \\(error.localizedDescription)\"\n        }\n    }\n}\n\n// MARK: - Error User Info\n\nextension MoyaError: CustomNSError {\n    public var errorUserInfo: [String: Any] {\n        var userInfo: [String: Any] = [:]\n        userInfo[NSLocalizedDescriptionKey] = errorDescription\n        userInfo[NSUnderlyingErrorKey] = underlyingError\n        return userInfo\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/MoyaProvider+Defaults.swift",
    "content": "import Foundation\n\n/// These functions are default mappings to `MoyaProvider`'s properties: endpoints, requests, session etc.\npublic extension MoyaProvider {\n    final class func defaultEndpointMapping(for target: Target) -> Endpoint {\n        Endpoint(\n            url: URL(target: target).absoluteString,\n            sampleResponseClosure: { .networkResponse(200, target.sampleData) },\n            method: target.method,\n            task: target.task,\n            httpHeaderFields: target.headers\n        )\n    }\n\n    final class func defaultRequestMapping(for endpoint: Endpoint, closure: RequestResultClosure) {\n        do {\n            let urlRequest = try endpoint.urlRequest()\n            closure(.success(urlRequest))\n        } catch MoyaError.requestMapping(let url) {\n            closure(.failure(MoyaError.requestMapping(url)))\n        } catch MoyaError.parameterEncoding(let error) {\n            closure(.failure(MoyaError.parameterEncoding(error)))\n        } catch {\n            closure(.failure(MoyaError.underlying(error, nil)))\n        }\n    }\n\n    final class func defaultAlamofireSession() -> Session {\n        let configuration = URLSessionConfiguration.default\n        configuration.headers = .default\n\n        return Session(configuration: configuration, startRequestsImmediately: false)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/MoyaProvider+Internal.swift",
    "content": "import Foundation\n\n// MARK: - Method\n\npublic extension Method {\n    /// A Boolean value determining whether the request supports multipart.\n    var supportsMultipart: Bool {\n        switch self {\n        case .post, .put, .patch, .connect:\n            return true\n        default:\n            return false\n        }\n    }\n}\n\n// MARK: - MoyaProvider\n\n/// Internal extension to keep the inner-workings outside the main Moya.swift file.\npublic extension MoyaProvider {\n    /// Performs normal requests.\n    func requestNormal(_ target: Target, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> Cancellable {\n        let endpoint = self.endpoint(target)\n        let stubBehavior = self.stubClosure(target)\n        let cancellableToken = CancellableWrapper()\n\n        // Allow plugins to modify response\n        let pluginsWithCompletion: Moya.Completion = { result in\n            let processedResult = self.plugins.reduce(result) { $1.process($0, target: target) }\n            completion(processedResult)\n        }\n\n        if trackInflights {\n            var inflightCompletionBlocks = self.inflightRequests[endpoint]\n            inflightCompletionBlocks?.append(pluginsWithCompletion)\n            self.internalInflightRequests[endpoint] = inflightCompletionBlocks\n\n            if inflightCompletionBlocks != nil {\n                return cancellableToken\n            } else {\n                self.internalInflightRequests[endpoint] = [pluginsWithCompletion]\n            }\n        }\n\n        let performNetworking = { (requestResult: Result<URLRequest, MoyaError>) in\n            if cancellableToken.isCancelled {\n                self.cancelCompletion(pluginsWithCompletion, target: target)\n                return\n            }\n\n            var request: URLRequest!\n\n            switch requestResult {\n            case .success(let urlRequest):\n                request = urlRequest\n            case .failure(let error):\n                pluginsWithCompletion(.failure(error))\n                return\n            }\n\n            let networkCompletion: Moya.Completion = { result in\n              if self.trackInflights {\n                self.inflightRequests[endpoint]?.forEach { $0(result) }\n                self.internalInflightRequests.removeValue(forKey: endpoint)\n              } else {\n                pluginsWithCompletion(result)\n              }\n            }\n\n            cancellableToken.innerCancellable = self.performRequest(target, request: request, callbackQueue: callbackQueue, progress: progress, completion: networkCompletion, endpoint: endpoint, stubBehavior: stubBehavior)\n        }\n\n        requestClosure(endpoint, performNetworking)\n\n        return cancellableToken\n    }\n\n    // swiftlint:disable:next function_parameter_count\n    private func performRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion, endpoint: Endpoint, stubBehavior: Moya.StubBehavior) -> Cancellable {\n        switch stubBehavior {\n        case .never:\n            switch endpoint.task {\n            case .requestPlain, .requestData, .requestJSONEncodable, .requestCustomJSONEncodable, .requestParameters, .requestCompositeData, .requestCompositeParameters:\n                return self.sendRequest(target, request: request, callbackQueue: callbackQueue, progress: progress, completion: completion)\n            case .uploadFile(let file):\n                return self.sendUploadFile(target, request: request, callbackQueue: callbackQueue, file: file, progress: progress, completion: completion)\n            case .uploadMultipart(let multipartBody), .uploadCompositeMultipart(let multipartBody, _):\n                guard !multipartBody.isEmpty && endpoint.method.supportsMultipart else {\n                    fatalError(\"\\(target) is not a multipart upload target.\")\n                }\n                return self.sendUploadMultipart(target, request: request, callbackQueue: callbackQueue, multipartBody: multipartBody, progress: progress, completion: completion)\n            case .downloadDestination(let destination), .downloadParameters(_, _, let destination):\n                return self.sendDownloadRequest(target, request: request, callbackQueue: callbackQueue, destination: destination, progress: progress, completion: completion)\n            }\n        default:\n            return self.stubRequest(target, request: request, callbackQueue: callbackQueue, completion: completion, endpoint: endpoint, stubBehavior: stubBehavior)\n        }\n    }\n\n    func cancelCompletion(_ completion: Moya.Completion, target: Target) {\n        let error = MoyaError.underlying(NSError(domain: NSURLErrorDomain, code: NSURLErrorCancelled, userInfo: nil), nil)\n        plugins.forEach { $0.didReceive(.failure(error), target: target) }\n        completion(.failure(error))\n    }\n\n    /// Creates a function which, when called, executes the appropriate stubbing behavior for the given parameters.\n    final func createStubFunction(_ token: CancellableToken, forTarget target: Target, withCompletion completion: @escaping Moya.Completion, endpoint: Endpoint, plugins: [PluginType], request: URLRequest) -> (() -> Void) { // swiftlint:disable:this function_parameter_count\n        return {\n            if token.isCancelled {\n                self.cancelCompletion(completion, target: target)\n                return\n            }\n\n            let validate = { (response: Moya.Response) -> Result<Moya.Response, MoyaError> in\n                let validCodes = target.validationType.statusCodes\n                guard !validCodes.isEmpty else { return .success(response) }\n                if validCodes.contains(response.statusCode) {\n                    return .success(response)\n                } else {\n                    let statusError = MoyaError.statusCode(response)\n                    let error = MoyaError.underlying(statusError, response)\n                    return .failure(error)\n                }\n            }\n\n            switch endpoint.sampleResponseClosure() {\n            case .networkResponse(let statusCode, let data):\n                let response = Moya.Response(statusCode: statusCode, data: data, request: request, response: nil)\n                let result = validate(response)\n                plugins.forEach { $0.didReceive(result, target: target) }\n                completion(result)\n            case .response(let customResponse, let data):\n                let response = Moya.Response(statusCode: customResponse.statusCode, data: data, request: request, response: customResponse)\n                let result = validate(response)\n                plugins.forEach { $0.didReceive(result, target: target) }\n                completion(result)\n            case .networkError(let error):\n                let error = MoyaError.underlying(error, nil)\n                plugins.forEach { $0.didReceive(.failure(error), target: target) }\n                completion(.failure(error))\n            }\n        }\n    }\n\n    /// Notify all plugins that a stub is about to be performed. You must call this if overriding `stubRequest`.\n    final func notifyPluginsOfImpendingStub(for request: URLRequest, target: Target) -> URLRequest {\n        let alamoRequest = session.request(request)\n        alamoRequest.cancel()\n\n        let preparedRequest = plugins.reduce(request) { $1.prepare($0, target: target) }\n\n        let stubbedAlamoRequest = RequestTypeWrapper(request: alamoRequest, urlRequest: preparedRequest)\n        plugins.forEach { $0.willSend(stubbedAlamoRequest, target: target) }\n\n        return preparedRequest\n    }\n}\n\nprivate extension MoyaProvider {\n    private func interceptor(target: Target) -> MoyaRequestInterceptor {\n        return MoyaRequestInterceptor(prepare: { [weak self] urlRequest in\n            return self?.plugins.reduce(urlRequest) { $1.prepare($0, target: target) } ?? urlRequest\n       })\n    }\n\n    private func setup(interceptor: MoyaRequestInterceptor, with target: Target, and request: Request) {\n        interceptor.willSend = { [weak self, weak request] urlRequest in\n            guard let self = self, let request = request else { return }\n\n            let stubbedAlamoRequest = RequestTypeWrapper(request: request, urlRequest: urlRequest)\n            self.plugins.forEach { $0.willSend(stubbedAlamoRequest, target: target) }\n        }\n    }\n\n    func sendUploadMultipart(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, multipartBody: [MultipartFormData], progress: Moya.ProgressBlock? = nil, completion: @escaping Moya.Completion) -> CancellableToken {\n        let formData = RequestMultipartFormData()\n        formData.applyMoyaMultipartFormData(multipartBody)\n\n        let interceptor = self.interceptor(target: target)\n        let uploadRequest: UploadRequest = session.requestQueue.sync {\n            let uploadRequest = session.upload(multipartFormData: formData, with: request, interceptor: interceptor)\n            setup(interceptor: interceptor, with: target, and: uploadRequest)\n\n            return uploadRequest\n        }\n\n        let validationCodes = target.validationType.statusCodes\n        let validatedRequest = validationCodes.isEmpty ? uploadRequest : uploadRequest.validate(statusCode: validationCodes)\n        return sendAlamofireRequest(validatedRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion)\n    }\n\n    func sendUploadFile(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, file: URL, progress: ProgressBlock? = nil, completion: @escaping Completion) -> CancellableToken {\n        let interceptor = self.interceptor(target: target)\n        let uploadRequest: UploadRequest = session.requestQueue.sync {\n            let uploadRequest = session.upload(file, with: request, interceptor: interceptor)\n            setup(interceptor: interceptor, with: target, and: uploadRequest)\n\n            return uploadRequest\n        }\n\n        let validationCodes = target.validationType.statusCodes\n        let alamoRequest = validationCodes.isEmpty ? uploadRequest : uploadRequest.validate(statusCode: validationCodes)\n        return sendAlamofireRequest(alamoRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion)\n    }\n\n    func sendDownloadRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, destination: @escaping DownloadDestination, progress: ProgressBlock? = nil, completion: @escaping Completion) -> CancellableToken {\n        let interceptor = self.interceptor(target: target)\n        let downloadRequest: DownloadRequest = session.requestQueue.sync {\n            let downloadRequest = session.download(request, interceptor: interceptor, to: destination)\n            setup(interceptor: interceptor, with: target, and: downloadRequest)\n\n            return downloadRequest\n        }\n\n        let validationCodes = target.validationType.statusCodes\n        let alamoRequest = validationCodes.isEmpty ? downloadRequest : downloadRequest.validate(statusCode: validationCodes)\n        return sendAlamofireRequest(alamoRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion)\n    }\n\n    func sendRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> CancellableToken {\n        let interceptor = self.interceptor(target: target)\n        let initialRequest: DataRequest = session.requestQueue.sync {\n            let initialRequest = session.request(request, interceptor: interceptor)\n            setup(interceptor: interceptor, with: target, and: initialRequest)\n\n            return initialRequest\n        }\n\n        let validationCodes = target.validationType.statusCodes\n        let alamoRequest = validationCodes.isEmpty ? initialRequest : initialRequest.validate(statusCode: validationCodes)\n        return sendAlamofireRequest(alamoRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion)\n    }\n\n    // swiftlint:disable:next cyclomatic_complexity\n    func sendAlamofireRequest<T>(_ alamoRequest: T, target: Target, callbackQueue: DispatchQueue?, progress progressCompletion: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> CancellableToken where T: Requestable, T: Request {\n        // Give plugins the chance to alter the outgoing request\n        let plugins = self.plugins\n        var progressAlamoRequest = alamoRequest\n        let progressClosure: (Progress) -> Void = { progress in\n            let sendProgress: () -> Void = {\n                progressCompletion?(ProgressResponse(progress: progress))\n            }\n\n            if let callbackQueue = callbackQueue {\n                callbackQueue.async(execute: sendProgress)\n            } else {\n                sendProgress()\n            }\n        }\n\n        // Perform the actual request\n        if progressCompletion != nil {\n            switch progressAlamoRequest {\n            case let downloadRequest as DownloadRequest:\n                if let downloadRequest = downloadRequest.downloadProgress(closure: progressClosure) as? T {\n                    progressAlamoRequest = downloadRequest\n                }\n            case let uploadRequest as UploadRequest:\n                if let uploadRequest = uploadRequest.uploadProgress(closure: progressClosure) as? T {\n                    progressAlamoRequest = uploadRequest\n                }\n            case let dataRequest as DataRequest:\n                if let dataRequest = dataRequest.downloadProgress(closure: progressClosure) as? T {\n                    progressAlamoRequest = dataRequest\n                }\n            default: break\n            }\n        }\n\n        let completionHandler: RequestableCompletion = { response, request, data, error in\n            let result = convertResponseToResult(response, request: request, data: data, error: error)\n            // Inform all plugins about the response\n            plugins.forEach { $0.didReceive(result, target: target) }\n            if let progressCompletion = progressCompletion {\n                let value = try? result.get()\n                switch progressAlamoRequest {\n                case let downloadRequest as DownloadRequest:\n                    progressCompletion(ProgressResponse(progress: downloadRequest.downloadProgress, response: value))\n                case let uploadRequest as UploadRequest:\n                    progressCompletion(ProgressResponse(progress: uploadRequest.uploadProgress, response: value))\n                case let dataRequest as DataRequest:\n                    progressCompletion(ProgressResponse(progress: dataRequest.downloadProgress, response: value))\n                default:\n                    progressCompletion(ProgressResponse(response: value))\n                }\n            }\n            completion(result)\n        }\n\n        progressAlamoRequest = progressAlamoRequest.response(callbackQueue: callbackQueue, completionHandler: completionHandler)\n\n        progressAlamoRequest.resume()\n\n        return CancellableToken(request: progressAlamoRequest)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/MoyaProvider.swift",
    "content": "import Foundation\n\n/// Closure to be executed when a request has completed.\npublic typealias Completion = (_ result: Result<Moya.Response, MoyaError>) -> Void\n\n/// Closure to be executed when progress changes.\npublic typealias ProgressBlock = (_ progress: ProgressResponse) -> Void\n\n/// A type representing the progress of a request.\npublic struct ProgressResponse {\n\n    /// The optional response of the request.\n    public let response: Response?\n\n    /// An object that conveys ongoing progress for a given request.\n    public let progressObject: Progress?\n\n    /// Initializes a `ProgressResponse`.\n    public init(progress: Progress? = nil, response: Response? = nil) {\n        self.progressObject = progress\n        self.response = response\n    }\n\n    /// The fraction of the overall work completed by the progress object.\n    public var progress: Double {\n        if completed {\n            return 1.0\n        } else if let progressObject = progressObject, progressObject.totalUnitCount > 0 {\n            // if the Content-Length is specified we can rely on `fractionCompleted`\n            return progressObject.fractionCompleted\n        } else {\n            // if the Content-Length is not specified, return progress 0.0 until it's completed\n            return 0.0\n        }\n    }\n\n    /// A Boolean value stating whether the request is completed.\n    public var completed: Bool { response != nil }\n}\n\n/// A protocol representing a minimal interface for a MoyaProvider.\n/// Used by the reactive provider extensions.\npublic protocol MoyaProviderType: AnyObject {\n\n    associatedtype Target: TargetType\n\n    /// Designated request-making method. Returns a `Cancellable` token to cancel the request later.\n    func request(_ target: Target, callbackQueue: DispatchQueue?, progress: Moya.ProgressBlock?, completion: @escaping Moya.Completion) -> Cancellable\n}\n\n/// Request provider class. Requests should be made through this class only.\nopen class MoyaProvider<Target: TargetType>: MoyaProviderType {\n\n    /// Closure that defines the endpoints for the provider.\n    public typealias EndpointClosure = (Target) -> Endpoint\n\n    /// Closure that decides if and what request should be performed.\n    public typealias RequestResultClosure = (Result<URLRequest, MoyaError>) -> Void\n\n    /// Closure that resolves an `Endpoint` into a `RequestResult`.\n    public typealias RequestClosure = (Endpoint, @escaping RequestResultClosure) -> Void\n\n    /// Closure that decides if/how a request should be stubbed.\n    public typealias StubClosure = (Target) -> Moya.StubBehavior\n\n    /// A closure responsible for mapping a `TargetType` to an `EndPoint`.\n    public let endpointClosure: EndpointClosure\n\n    /// A closure deciding if and what request should be performed.\n    public let requestClosure: RequestClosure\n\n    /// A closure responsible for determining the stubbing behavior\n    /// of a request for a given `TargetType`.\n    public let stubClosure: StubClosure\n\n    public let session: Session\n\n    /// A list of plugins.\n    /// e.g. for logging, network activity indicator or credentials.\n    public let plugins: [PluginType]\n\n    public let trackInflights: Bool\n\n    open var inflightRequests: [Endpoint: [Moya.Completion]] { internalInflightRequests }\n\n    @Atomic\n    var internalInflightRequests: [Endpoint: [Moya.Completion]] = [:]\n\n    /// Propagated to Alamofire as callback queue. If nil - the Alamofire default (as of their API in 2017 - the main queue) will be used.\n    let callbackQueue: DispatchQueue?\n\n    let lock: NSRecursiveLock = NSRecursiveLock()\n\n    /// Initializes a provider.\n    public init(endpointClosure: @escaping EndpointClosure = MoyaProvider.defaultEndpointMapping,\n                requestClosure: @escaping RequestClosure = MoyaProvider.defaultRequestMapping,\n                stubClosure: @escaping StubClosure = MoyaProvider.neverStub,\n                callbackQueue: DispatchQueue? = nil,\n                session: Session = MoyaProvider<Target>.defaultAlamofireSession(),\n                plugins: [PluginType] = [],\n                trackInflights: Bool = false) {\n\n        self.endpointClosure = endpointClosure\n        self.requestClosure = requestClosure\n        self.stubClosure = stubClosure\n        self.session = session\n        self.plugins = plugins\n        self.trackInflights = trackInflights\n        self.callbackQueue = callbackQueue\n    }\n\n    /// Returns an `Endpoint` based on the token, method, and parameters by invoking the `endpointClosure`.\n    open func endpoint(_ token: Target) -> Endpoint {\n        endpointClosure(token)\n    }\n\n    /// Designated request-making method. Returns a `Cancellable` token to cancel the request later.\n    @discardableResult\n    open func request(_ target: Target,\n                      callbackQueue: DispatchQueue? = .none,\n                      progress: ProgressBlock? = .none,\n                      completion: @escaping Completion) -> Cancellable {\n\n        let callbackQueue = callbackQueue ?? self.callbackQueue\n        return requestNormal(target, callbackQueue: callbackQueue, progress: progress, completion: completion)\n    }\n\n    // swiftlint:disable function_parameter_count\n    /// When overriding this method, call `notifyPluginsOfImpendingStub` to prepare your request\n    /// and then use the returned `URLRequest` in the `createStubFunction` method.\n    /// Note: this was previously in an extension, however it must be in the original class declaration to allow subclasses to override.\n    @discardableResult\n    open func stubRequest(_ target: Target, request: URLRequest, callbackQueue: DispatchQueue?, completion: @escaping Moya.Completion, endpoint: Endpoint, stubBehavior: Moya.StubBehavior) -> CancellableToken {\n        let callbackQueue = callbackQueue ?? self.callbackQueue\n        let cancellableToken = CancellableToken { }\n        let preparedRequest = notifyPluginsOfImpendingStub(for: request, target: target)\n        let plugins = self.plugins\n        let stub: () -> Void = createStubFunction(cancellableToken, forTarget: target, withCompletion: completion, endpoint: endpoint, plugins: plugins, request: preparedRequest)\n        switch stubBehavior {\n        case .immediate:\n            switch callbackQueue {\n            case .none:\n                stub()\n            case .some(let callbackQueue):\n                callbackQueue.async(execute: stub)\n            }\n        case .delayed(let delay):\n            let killTimeOffset = Int64(CDouble(delay) * CDouble(NSEC_PER_SEC))\n            let killTime = DispatchTime.now() + Double(killTimeOffset) / Double(NSEC_PER_SEC)\n            (callbackQueue ?? DispatchQueue.main).asyncAfter(deadline: killTime) {\n                stub()\n            }\n        case .never:\n            fatalError(\"Method called to stub request when stubbing is disabled.\")\n        }\n\n        return cancellableToken\n    }\n    // swiftlint:enable function_parameter_count\n}\n\n// MARK: Stubbing\n\n/// Controls how stub responses are returned.\npublic enum StubBehavior {\n\n    /// Do not stub.\n    case never\n\n    /// Return a response immediately.\n    case immediate\n\n    /// Return a response after a delay.\n    case delayed(seconds: TimeInterval)\n}\n\npublic extension MoyaProvider {\n\n    // Swift won't let us put the StubBehavior enum inside the provider class, so we'll\n    // at least add some class functions to allow easy access to common stubbing closures.\n\n    /// Do not stub.\n    final class func neverStub(_: Target) -> Moya.StubBehavior { .never }\n\n    /// Return a response immediately.\n    final class func immediatelyStub(_: Target) -> Moya.StubBehavior { .immediate }\n\n    /// Return a response after a delay.\n    final class func delayedStub(_ seconds: TimeInterval) -> (Target) -> Moya.StubBehavior {\n        return { _ in .delayed(seconds: seconds) }\n    }\n}\n\n/// A public function responsible for converting the result of a `URLRequest` to a Result<Moya.Response, MoyaError>.\npublic func convertResponseToResult(_ response: HTTPURLResponse?, request: URLRequest?, data: Data?, error: Swift.Error?) ->\n    Result<Moya.Response, MoyaError> {\n        switch (response, data, error) {\n        case let (.some(response), data, .none):\n            let response = Moya.Response(statusCode: response.statusCode, data: data ?? Data(), request: request, response: response)\n            return .success(response)\n        case let (.some(response), _, .some(error)):\n            let response = Moya.Response(statusCode: response.statusCode, data: data ?? Data(), request: request, response: response)\n            let error = MoyaError.underlying(error, response)\n            return .failure(error)\n        case let (_, _, .some(error)):\n            let error = MoyaError.underlying(error, nil)\n            return .failure(error)\n        default:\n            let error = MoyaError.underlying(NSError(domain: NSURLErrorDomain, code: NSURLErrorUnknown, userInfo: nil), nil)\n            return .failure(error)\n        }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/MultiTarget.swift",
    "content": "import Foundation\n\n/// A `TargetType` used to enable `MoyaProvider` to process multiple `TargetType`s.\npublic enum MultiTarget: TargetType {\n    /// The embedded `TargetType`.\n    case target(TargetType)\n\n    /// Initializes a `MultiTarget`.\n    public init(_ target: TargetType) {\n        self = MultiTarget.target(target)\n    }\n\n    /// The embedded target's base `URL`.\n    public var path: String { target.path }\n\n    /// The baseURL of the embedded target.\n    public var baseURL: URL { target.baseURL }\n\n    /// The HTTP method of the embedded target.\n    public var method: Moya.Method { target.method }\n\n    /// The sampleData of the embedded target.\n    public var sampleData: Data { target.sampleData }\n\n    /// The `Task` of the embedded target.\n    public var task: Task { target.task }\n\n    /// The `ValidationType` of the embedded target.\n    public var validationType: ValidationType { target.validationType }\n\n    /// The headers of the embedded target.\n    public var headers: [String: String]? { target.headers }\n\n    /// The embedded `TargetType`.\n    public var target: TargetType {\n        switch self {\n        case .target(let target): return target\n        }\n    }\n}\n\nextension MultiTarget: AccessTokenAuthorizable {\n    public var authorizationType: AuthorizationType? {\n        guard let authorizableTarget = target as? AccessTokenAuthorizable else { return nil }\n        return authorizableTarget.authorizationType\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/MultipartFormData.swift",
    "content": "import Foundation\nimport Alamofire\n\n/// Represents \"multipart/form-data\" for an upload.\npublic struct MultipartFormData: Hashable {\n\n    /// Method to provide the form data.\n    public enum FormDataProvider: Hashable {\n        case data(Foundation.Data)\n        case file(URL)\n        case stream(InputStream, UInt64)\n    }\n\n    public init(provider: FormDataProvider, name: String, fileName: String? = nil, mimeType: String? = nil) {\n        self.provider = provider\n        self.name = name\n        self.fileName = fileName\n        self.mimeType = mimeType\n    }\n\n    /// The method being used for providing form data.\n    public let provider: FormDataProvider\n\n    /// The name.\n    public let name: String\n\n    /// The file name.\n    public let fileName: String?\n\n    /// The MIME type\n    public let mimeType: String?\n\n}\n\n// MARK: RequestMultipartFormData appending\ninternal extension RequestMultipartFormData {\n    func append(data: Data, bodyPart: MultipartFormData) {\n        append(data, withName: bodyPart.name, fileName: bodyPart.fileName, mimeType: bodyPart.mimeType)\n    }\n\n    func append(fileURL url: URL, bodyPart: MultipartFormData) {\n        if let fileName = bodyPart.fileName, let mimeType = bodyPart.mimeType {\n            append(url, withName: bodyPart.name, fileName: fileName, mimeType: mimeType)\n        } else {\n            append(url, withName: bodyPart.name)\n        }\n    }\n\n    func append(stream: InputStream, length: UInt64, bodyPart: MultipartFormData) {\n        append(stream, withLength: length, name: bodyPart.name, fileName: bodyPart.fileName ?? \"\", mimeType: bodyPart.mimeType ?? \"\")\n    }\n\n    func applyMoyaMultipartFormData(_ multipartBody: [Moya.MultipartFormData]) {\n        for bodyPart in multipartBody {\n            switch bodyPart.provider {\n            case .data(let data):\n                append(data: data, bodyPart: bodyPart)\n            case .file(let url):\n                append(fileURL: url, bodyPart: bodyPart)\n            case .stream(let stream, let length):\n                append(stream: stream, length: length, bodyPart: bodyPart)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Plugin.swift",
    "content": "import Foundation\n\n/// A Moya Plugin receives callbacks to perform side effects wherever a request is sent or received.\n///\n/// for example, a plugin may be used to\n///     - log network requests\n///     - hide and show a network activity indicator\n///     - inject additional information into a request\npublic protocol PluginType {\n    /// Called to modify a request before sending.\n    func prepare(_ request: URLRequest, target: TargetType) -> URLRequest\n\n    /// Called immediately before a request is sent over the network (or stubbed).\n    func willSend(_ request: RequestType, target: TargetType)\n\n    /// Called after a response has been received, but before the MoyaProvider has invoked its completion handler.\n    func didReceive(_ result: Result<Moya.Response, MoyaError>, target: TargetType)\n\n    /// Called to modify a result before completion.\n    func process(_ result: Result<Moya.Response, MoyaError>, target: TargetType) -> Result<Moya.Response, MoyaError>\n}\n\npublic extension PluginType {\n    func prepare(_ request: URLRequest, target: TargetType) -> URLRequest { request }\n    func willSend(_ request: RequestType, target: TargetType) { }\n    func didReceive(_ result: Result<Moya.Response, MoyaError>, target: TargetType) { }\n    func process(_ result: Result<Moya.Response, MoyaError>, target: TargetType) -> Result<Moya.Response, MoyaError> { result }\n}\n\n/// Request type used by `willSend` plugin function.\npublic protocol RequestType {\n\n    // Note:\n    //\n    // We use this protocol instead of the Alamofire request to avoid leaking that abstraction.\n    // A plugin should not know about Alamofire at all.\n\n    /// Retrieve an `NSURLRequest` representation.\n    var request: URLRequest? { get }\n\n    ///  Additional headers appended to the request when added to the session.\n    var sessionHeaders: [String: String] { get }\n\n    /// Authenticates the request with a username and password.\n    func authenticate(username: String, password: String, persistence: URLCredential.Persistence) -> Self\n\n    /// Authenticates the request with an `NSURLCredential` instance.\n    func authenticate(with credential: URLCredential) -> Self\n\n    /// cURL representation of the instance.\n    ///\n    /// - Returns: The cURL equivalent of the instance.\n    func cURLDescription(calling handler: @escaping (String) -> Void) -> Self\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Plugins/AccessTokenPlugin.swift",
    "content": "import Foundation\n\n// MARK: - AccessTokenAuthorizable\n\n/// A protocol for controlling the behavior of `AccessTokenPlugin`.\npublic protocol AccessTokenAuthorizable {\n\n    /// Represents the authorization header to use for requests.\n    var authorizationType: AuthorizationType? { get }\n}\n\n// MARK: - AuthorizationType\n\n/// An enum representing the header to use with an `AccessTokenPlugin`\npublic enum AuthorizationType {\n\n    /// The `\"Basic\"` header.\n    case basic\n\n    /// The `\"Bearer\"` header.\n    case bearer\n\n    /// Custom header implementation.\n    case custom(String)\n\n    public var value: String {\n        switch self {\n        case .basic: return \"Basic\"\n        case .bearer: return \"Bearer\"\n        case .custom(let customValue): return customValue\n        }\n    }\n}\n\nextension AuthorizationType: Equatable {\n    public static func == (lhs: AuthorizationType, rhs: AuthorizationType) -> Bool {\n        switch (lhs, rhs) {\n        case (.basic, .basic),\n             (.bearer, .bearer):\n            return true\n\n        case let (.custom(value1), .custom(value2)):\n            return value1 == value2\n\n        default:\n            return false\n        }\n    }\n}\n\n// MARK: - AccessTokenPlugin\n\n/**\n A plugin for adding basic or bearer-type authorization headers to requests. Example:\n\n ```\n Authorization: Basic <token>\n Authorization: Bearer <token>\n Authorization: <Сustom> <token>\n ```\n\n */\npublic struct AccessTokenPlugin: PluginType {\n\n    public typealias TokenClosure = (TargetType) -> String\n\n    /// A closure returning the access token to be applied in the header.\n    public let tokenClosure: TokenClosure\n\n    /**\n     Initialize a new `AccessTokenPlugin`.\n\n     - parameters:\n     - tokenClosure: A closure returning the token to be applied in the pattern `Authorization: <AuthorizationType> <token>`\n     */\n    public init(tokenClosure: @escaping TokenClosure) {\n        self.tokenClosure = tokenClosure\n    }\n\n    /**\n     Prepare a request by adding an authorization header if necessary.\n\n     - parameters:\n     - request: The request to modify.\n     - target: The target of the request.\n     - returns: The modified `URLRequest`.\n     */\n    public func prepare(_ request: URLRequest, target: TargetType) -> URLRequest {\n\n        guard let authorizable = target as? AccessTokenAuthorizable,\n            let authorizationType = authorizable.authorizationType\n            else { return request }\n\n        var request = request\n        let realTarget = (target as? MultiTarget)?.target ?? target\n        let authValue = authorizationType.value + \" \" + tokenClosure(realTarget)\n        request.addValue(authValue, forHTTPHeaderField: \"Authorization\")\n\n        return request\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Plugins/CredentialsPlugin.swift",
    "content": "import Foundation\n\n/// Provides each request with optional URLCredentials.\npublic final class CredentialsPlugin: PluginType {\n\n    public typealias CredentialClosure = (TargetType) -> URLCredential?\n    let credentialsClosure: CredentialClosure\n\n    /// Initializes a CredentialsPlugin.\n    public init(credentialsClosure: @escaping CredentialClosure) {\n        self.credentialsClosure = credentialsClosure\n    }\n\n    // MARK: Plugin\n\n    public func willSend(_ request: RequestType, target: TargetType) {\n        if let credentials = credentialsClosure(target) {\n            _ = request.authenticate(with: credentials)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Plugins/NetworkActivityPlugin.swift",
    "content": "import Foundation\n\n/// Network activity change notification type.\npublic enum NetworkActivityChangeType {\n    case began, ended\n}\n\n/// Notify a request's network activity changes (request begins or ends).\npublic final class NetworkActivityPlugin: PluginType {\n\n    public typealias NetworkActivityClosure = (_ change: NetworkActivityChangeType, _ target: TargetType) -> Void\n    let networkActivityClosure: NetworkActivityClosure\n\n    /// Initializes a NetworkActivityPlugin.\n    public init(networkActivityClosure: @escaping NetworkActivityClosure) {\n        self.networkActivityClosure = networkActivityClosure\n    }\n\n    // MARK: Plugin\n\n    /// Called by the provider as soon as the request is about to start\n    public func willSend(_ request: RequestType, target: TargetType) {\n        networkActivityClosure(.began, target)\n    }\n\n    /// Called by the provider as soon as a response arrives, even if the request is canceled.\n    public func didReceive(_ result: Result<Moya.Response, MoyaError>, target: TargetType) {\n        networkActivityClosure(.ended, target)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Plugins/NetworkLoggerPlugin.swift",
    "content": "import Foundation\n\n/// Logs network activity (outgoing requests and incoming responses).\npublic final class NetworkLoggerPlugin {\n\n    public var configuration: Configuration\n\n    /// Initializes a NetworkLoggerPlugin.\n    public init(configuration: Configuration = Configuration()) {\n        self.configuration = configuration\n    }\n}\n\n// MARK: - PluginType\nextension NetworkLoggerPlugin: PluginType {\n    public func willSend(_ request: RequestType, target: TargetType) {\n        logNetworkRequest(request, target: target) { [weak self] output in\n            self?.configuration.output(target, output)\n        }\n    }\n\n    public func didReceive(_ result: Result<Moya.Response, MoyaError>, target: TargetType) {\n        switch result {\n        case .success(let response):\n            configuration.output(target, logNetworkResponse(response, target: target, isFromError: false))\n        case let .failure(error):\n            configuration.output(target, logNetworkError(error, target: target))\n        }\n    }\n}\n\n// MARK: - Logging\nprivate extension NetworkLoggerPlugin {\n\n    func logNetworkRequest(_ request: RequestType, target: TargetType, completion: @escaping ([String]) -> Void) {\n        //cURL formatting\n        if configuration.logOptions.contains(.formatRequestAscURL) {\n            _ = request.cURLDescription { [weak self] output in\n                guard let self = self else { return }\n\n                completion([self.configuration.formatter.entry(\"Request\", output, target)])\n            }\n            return\n        }\n\n        //Request presence check\n        guard let httpRequest = request.request else {\n            completion([configuration.formatter.entry(\"Request\", \"(invalid request)\", target)])\n            return\n        }\n\n        // Adding log entries for each given log option\n        var output = [String]()\n\n        output.append(configuration.formatter.entry(\"Request\", httpRequest.description, target))\n\n        if configuration.logOptions.contains(.requestHeaders) {\n            var allHeaders = request.sessionHeaders\n            if let httpRequestHeaders = httpRequest.allHTTPHeaderFields {\n                allHeaders.merge(httpRequestHeaders) { $1 }\n            }\n            output.append(configuration.formatter.entry(\"Request Headers\", allHeaders.description, target))\n        }\n\n        if configuration.logOptions.contains(.requestBody) {\n            if let bodyStream = httpRequest.httpBodyStream {\n                output.append(configuration.formatter.entry(\"Request Body Stream\", bodyStream.description, target))\n            }\n\n            if let body = httpRequest.httpBody {\n                let stringOutput = configuration.formatter.requestData(body)\n                output.append(configuration.formatter.entry(\"Request Body\", stringOutput, target))\n            }\n        }\n\n        if configuration.logOptions.contains(.requestMethod),\n            let httpMethod = httpRequest.httpMethod {\n            output.append(configuration.formatter.entry(\"HTTP Request Method\", httpMethod, target))\n        }\n\n        completion(output)\n    }\n\n    func logNetworkResponse(_ response: Response, target: TargetType, isFromError: Bool) -> [String] {\n        // Adding log entries for each given log option\n        var output = [String]()\n\n        //Response presence check\n        if let httpResponse = response.response {\n            output.append(configuration.formatter.entry(\"Response\", httpResponse.description, target))\n        } else {\n            output.append(configuration.formatter.entry(\"Response\", \"Received empty network response for \\(target).\", target))\n        }\n\n        if (isFromError && configuration.logOptions.contains(.errorResponseBody))\n            || configuration.logOptions.contains(.successResponseBody) {\n\n            let stringOutput = configuration.formatter.responseData(response.data)\n            output.append(configuration.formatter.entry(\"Response Body\", stringOutput, target))\n        }\n\n        return output\n    }\n\n    func logNetworkError(_ error: MoyaError, target: TargetType) -> [String] {\n        //Some errors will still have a response, like errors due to Alamofire's HTTP code validation.\n        if let moyaResponse = error.response {\n            return logNetworkResponse(moyaResponse, target: target, isFromError: true)\n        }\n\n        //Errors without an HTTPURLResponse are those due to connectivity, time-out and such.\n        return [configuration.formatter.entry(\"Error\", \"Error calling \\(target) : \\(error)\", target)]\n    }\n}\n\n// MARK: - Configuration\npublic extension NetworkLoggerPlugin {\n    struct Configuration {\n\n        // MARK: - Typealiases\n        // swiftlint:disable nesting\n        public typealias OutputType = (_ target: TargetType, _ items: [String]) -> Void\n        // swiftlint:enable nesting\n\n        // MARK: - Properties\n\n        public var formatter: Formatter\n        public var output: OutputType\n        public var logOptions: LogOptions\n\n        /// The designated way to instantiate a Configuration.\n        ///\n        /// - Parameters:\n        ///   - formatter: An object holding all formatter closures available for customization.\n        ///   - output: A closure responsible for writing the given log entries into your log system.\n        ///                    The default value writes entries to the debug console.\n        ///   - logOptions: A set of options you can use to customize which request component is logged.\n        public init(formatter: Formatter = Formatter(),\n                    output: @escaping OutputType = defaultOutput,\n                    logOptions: LogOptions = .default) {\n            self.formatter = formatter\n            self.output = output\n            self.logOptions = logOptions\n        }\n\n        // MARK: - Defaults\n\n        public static func defaultOutput(target: TargetType, items: [String]) {\n            for item in items {\n                print(item, separator: \",\", terminator: \"\\n\")\n            }\n        }\n    }\n}\n\npublic extension NetworkLoggerPlugin.Configuration {\n    struct LogOptions: OptionSet {\n        public let rawValue: Int\n        public init(rawValue: Int) { self.rawValue = rawValue }\n\n        /// The request's method will be logged.\n        public static let requestMethod: LogOptions = LogOptions(rawValue: 1 << 0)\n        /// The request's body will be logged.\n        public static let requestBody: LogOptions = LogOptions(rawValue: 1 << 1)\n        /// The request's headers will be logged.\n        public static let requestHeaders: LogOptions = LogOptions(rawValue: 1 << 2)\n        /// The request will be logged in the cURL format.\n        ///\n        /// If this option is used, the following components will be logged regardless of their respective options being set:\n        /// - request's method\n        /// - request's headers\n        /// - request's body.\n        public static let formatRequestAscURL: LogOptions = LogOptions(rawValue: 1 << 3)\n        /// The body of a response that is a success will be logged.\n        public static let successResponseBody: LogOptions = LogOptions(rawValue: 1 << 4)\n        /// The body of a response that is an error will be logged.\n        public static let errorResponseBody: LogOptions = LogOptions(rawValue: 1 << 5)\n\n        //Aggregate options\n        /// Only basic components will be logged.\n        public static let `default`: LogOptions = [requestMethod, requestHeaders]\n        /// All components will be logged.\n        public static let verbose: LogOptions = [requestMethod, requestHeaders, requestBody,\n                                                 successResponseBody, errorResponseBody]\n    }\n}\n\npublic extension NetworkLoggerPlugin.Configuration {\n    struct Formatter {\n\n        // MARK: Typealiases\n        // swiftlint:disable nesting\n        public typealias DataFormatterType = (Data) -> (String)\n        public typealias EntryFormatterType = (_ identifier: String, _ message: String, _ target: TargetType) -> String\n        // swiftlint:enable nesting\n\n        // MARK: Properties\n\n        public var entry: EntryFormatterType\n        public var requestData: DataFormatterType\n        public var responseData: DataFormatterType\n\n        /// The designated way to instantiate a Formatter.\n        ///\n        /// - Parameters:\n        ///   - entry: The closure formatting a message into a new log entry.\n        ///   - requestData: The closure converting HTTP request's body into a String.\n        ///     The default value assumes the body's data is an utf8 String.\n        ///   - responseData: The closure converting HTTP response's body into a String.\n        ///     The default value assumes the body's data is an utf8 String.\n        public init(entry: @escaping EntryFormatterType = defaultEntryFormatter,\n                    requestData: @escaping DataFormatterType = defaultDataFormatter,\n                    responseData: @escaping DataFormatterType = defaultDataFormatter) {\n            self.entry = entry\n            self.requestData = requestData\n            self.responseData = responseData\n        }\n\n        // MARK: Defaults\n\n        public static func defaultDataFormatter(_ data: Data) -> String {\n            return String(data: data, encoding: .utf8) ?? \"## Cannot map data to String ##\"\n        }\n\n        public static func defaultEntryFormatter(identifier: String, message: String, target: TargetType) -> String {\n            let date = defaultEntryDateFormatter.string(from: Date())\n            return \"Moya_Logger: [\\(date)] \\(identifier): \\(message)\"\n        }\n\n        static var defaultEntryDateFormatter: DateFormatter = {\n            let formatter = DateFormatter()\n            formatter.timeStyle = .short\n            formatter.dateStyle = .short\n            return formatter\n        }()\n    }\n}\n\npublic extension NetworkLoggerPlugin {\n    /// Returns the default logger plugin\n    class var `default`: NetworkLoggerPlugin {\n        return NetworkLoggerPlugin(configuration: Configuration(logOptions: .default))\n    }\n\n    /// Returns the default verbose logger plugin\n    class var verbose: NetworkLoggerPlugin {\n        return NetworkLoggerPlugin(configuration: Configuration(logOptions: .verbose))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/RequestTypeWrapper.swift",
    "content": "import Foundation\n\n// Workaround for new asynchronous handling of Alamofire's request creation.\nstruct RequestTypeWrapper: RequestType {\n\n    var request: URLRequest? { _urlRequest }\n\n    var sessionHeaders: [String: String] { _request.sessionHeaders }\n\n    private var _request: Request\n    private var _urlRequest: URLRequest?\n\n    init(request: Request, urlRequest: URLRequest?) {\n        self._request = request\n        self._urlRequest = urlRequest\n    }\n\n    func authenticate(username: String, password: String, persistence: URLCredential.Persistence) -> RequestTypeWrapper {\n        let newRequest = _request.authenticate(username: username, password: password, persistence: persistence)\n        return RequestTypeWrapper(request: newRequest, urlRequest: _urlRequest)\n    }\n\n    func authenticate(with credential: URLCredential) -> RequestTypeWrapper {\n        let newRequest = _request.authenticate(with: credential)\n        return RequestTypeWrapper(request: newRequest, urlRequest: _urlRequest)\n    }\n\n    func cURLDescription(calling handler: @escaping (String) -> Void) -> RequestTypeWrapper {\n        _request.cURLDescription(calling: handler)\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Response.swift",
    "content": "import Foundation\n\n/// Represents a response to a `MoyaProvider.request`.\npublic final class Response: CustomDebugStringConvertible, Equatable {\n\n    /// The status code of the response.\n    public let statusCode: Int\n\n    /// The response data.\n    public let data: Data\n\n    /// The original URLRequest for the response.\n    public let request: URLRequest?\n\n    /// The HTTPURLResponse object.\n    public let response: HTTPURLResponse?\n\n    public init(statusCode: Int, data: Data, request: URLRequest? = nil, response: HTTPURLResponse? = nil) {\n        self.statusCode = statusCode\n        self.data = data\n        self.request = request\n        self.response = response\n    }\n\n    /// A text description of the `Response`.\n    public var description: String {\n        \"Status Code: \\(statusCode), Data Length: \\(data.count)\"\n    }\n\n    /// A text description of the `Response`. Suitable for debugging.\n    public var debugDescription: String { description }\n\n    public static func == (lhs: Response, rhs: Response) -> Bool {\n        lhs.statusCode == rhs.statusCode\n            && lhs.data == rhs.data\n            && lhs.response == rhs.response\n    }\n}\n\npublic extension Response {\n\n    /**\n     Returns the `Response` if the `statusCode` falls within the specified range.\n\n     - parameters:\n        - statusCodes: The range of acceptable status codes.\n     - throws: `MoyaError.statusCode` when others are encountered.\n    */\n    func filter<R: RangeExpression>(statusCodes: R) throws -> Response where R.Bound == Int {\n        guard statusCodes.contains(statusCode) else {\n            throw MoyaError.statusCode(self)\n        }\n        return self\n    }\n\n    /**\n     Returns the `Response` if it has the specified `statusCode`.\n\n     - parameters:\n        - statusCode: The acceptable status code.\n     - throws: `MoyaError.statusCode` when others are encountered.\n    */\n    func filter(statusCode: Int) throws -> Response {\n        try filter(statusCodes: statusCode...statusCode)\n    }\n\n    /**\n     Returns the `Response` if the `statusCode` falls within the range 200 - 299.\n\n     - throws: `MoyaError.statusCode` when others are encountered.\n    */\n    func filterSuccessfulStatusCodes() throws -> Response {\n        try filter(statusCodes: 200...299)\n    }\n\n    /**\n     Returns the `Response` if the `statusCode` falls within the range 200 - 399.\n\n     - throws: `MoyaError.statusCode` when others are encountered.\n    */\n    func filterSuccessfulStatusAndRedirectCodes() throws -> Response {\n        try filter(statusCodes: 200...399)\n    }\n\n    /// Maps data received from the signal into an Image.\n    func mapImage() throws -> Image {\n        guard let image = Image(data: data) else {\n            throw MoyaError.imageMapping(self)\n        }\n        return image\n    }\n\n    /// Maps data received from the signal into a JSON object.\n    ///\n    /// - parameter failsOnEmptyData: A Boolean value determining\n    /// whether the mapping should fail if the data is empty.\n    func mapJSON(failsOnEmptyData: Bool = true) throws -> Any {\n        do {\n            return try JSONSerialization.jsonObject(with: data, options: .allowFragments)\n        } catch {\n            if data.isEmpty && !failsOnEmptyData {\n                return NSNull()\n            }\n            throw MoyaError.jsonMapping(self)\n        }\n    }\n\n    /// Maps data received from the signal into a String.\n    ///\n    /// - parameter atKeyPath: Optional key path at which to parse string.\n    func mapString(atKeyPath keyPath: String? = nil) throws -> String {\n        if let keyPath = keyPath {\n            // Key path was provided, try to parse string at key path\n            guard let jsonDictionary = try mapJSON() as? NSDictionary,\n                let string = jsonDictionary.value(forKeyPath: keyPath) as? String else {\n                    throw MoyaError.stringMapping(self)\n            }\n            return string\n        } else {\n            // Key path was not provided, parse entire response as string\n            guard let string = String(data: data, encoding: .utf8) else {\n                throw MoyaError.stringMapping(self)\n            }\n            return string\n        }\n    }\n\n    /// Maps data received from the signal into a Decodable object.\n    ///\n    /// - parameter atKeyPath: Optional key path at which to parse object.\n    /// - parameter using: A `JSONDecoder` instance which is used to decode data to an object.\n    func map<D: Decodable>(_ type: D.Type, atKeyPath keyPath: String? = nil, using decoder: JSONDecoder = JSONDecoder(), failsOnEmptyData: Bool = true) throws -> D {\n        let serializeToData: (Any) throws -> Data? = { (jsonObject) in\n            guard JSONSerialization.isValidJSONObject(jsonObject) else {\n                return nil\n            }\n            do {\n                return try JSONSerialization.data(withJSONObject: jsonObject)\n            } catch {\n                throw MoyaError.jsonMapping(self)\n            }\n        }\n        let jsonData: Data\n        keyPathCheck: if let keyPath = keyPath {\n            guard let jsonObject = (try mapJSON(failsOnEmptyData: failsOnEmptyData) as? NSDictionary)?.value(forKeyPath: keyPath) else {\n                if failsOnEmptyData {\n                    throw MoyaError.jsonMapping(self)\n                } else {\n                    jsonData = data\n                    break keyPathCheck\n                }\n            }\n\n            if let data = try serializeToData(jsonObject) {\n                jsonData = data\n            } else {\n                let wrappedJsonObject = [\"value\": jsonObject]\n                let wrappedJsonData: Data\n                if let data = try serializeToData(wrappedJsonObject) {\n                    wrappedJsonData = data\n                } else {\n                    throw MoyaError.jsonMapping(self)\n                }\n                do {\n                    return try decoder.decode(DecodableWrapper<D>.self, from: wrappedJsonData).value\n                } catch let error {\n                    throw MoyaError.objectMapping(error, self)\n                }\n            }\n        } else {\n            jsonData = data\n        }\n        do {\n            if jsonData.isEmpty && !failsOnEmptyData {\n                if let emptyJSONObjectData = \"{}\".data(using: .utf8), let emptyDecodableValue = try? decoder.decode(D.self, from: emptyJSONObjectData) {\n                    return emptyDecodableValue\n                } else if let emptyJSONArrayData = \"[{}]\".data(using: .utf8), let emptyDecodableValue = try? decoder.decode(D.self, from: emptyJSONArrayData) {\n                    return emptyDecodableValue\n                }\n            }\n            return try decoder.decode(D.self, from: jsonData)\n        } catch let error {\n            throw MoyaError.objectMapping(error, self)\n        }\n    }\n}\n\nprivate struct DecodableWrapper<T: Decodable>: Decodable {\n    let value: T\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/TargetType.swift",
    "content": "import Foundation\n\n/// The protocol used to define the specifications necessary for a `MoyaProvider`.\npublic protocol TargetType {\n\n    /// The target's base `URL`.\n    var baseURL: URL { get }\n\n    /// The path to be appended to `baseURL` to form the full `URL`.\n    var path: String { get }\n\n    /// The HTTP method used in the request.\n    var method: Moya.Method { get }\n\n    /// Provides stub data for use in testing. Default is `Data()`.\n    var sampleData: Data { get }\n\n    /// The type of HTTP task to be performed.\n    var task: Task { get }\n\n    /// The type of validation to perform on the request. Default is `.none`.\n    var validationType: ValidationType { get }\n\n    /// The headers to be used in the request.\n    var headers: [String: String]? { get }\n}\n\npublic extension TargetType {\n\n    /// The type of validation to perform on the request. Default is `.none`.\n    var validationType: ValidationType { .none }\n\n    /// Provides stub data for use in testing. Default is `Data()`.\n    var sampleData: Data { Data() }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/Task.swift",
    "content": "import Foundation\n\n/// Represents an HTTP task.\npublic enum Task {\n\n    /// A request with no additional data.\n    case requestPlain\n\n    /// A requests body set with data.\n    case requestData(Data)\n\n    /// A request body set with `Encodable` type\n    case requestJSONEncodable(Encodable)\n\n    /// A request body set with `Encodable` type and custom encoder\n    case requestCustomJSONEncodable(Encodable, encoder: JSONEncoder)\n\n    /// A requests body set with encoded parameters.\n    case requestParameters(parameters: [String: Any], encoding: ParameterEncoding)\n\n    /// A requests body set with data, combined with url parameters.\n    case requestCompositeData(bodyData: Data, urlParameters: [String: Any])\n\n    /// A requests body set with encoded parameters combined with url parameters.\n    case requestCompositeParameters(bodyParameters: [String: Any], bodyEncoding: ParameterEncoding, urlParameters: [String: Any])\n\n    /// A file upload task.\n    case uploadFile(URL)\n\n    /// A \"multipart/form-data\" upload task.\n    case uploadMultipart([MultipartFormData])\n\n    /// A \"multipart/form-data\" upload task  combined with url parameters.\n    case uploadCompositeMultipart([MultipartFormData], urlParameters: [String: Any])\n\n    /// A file download task to a destination.\n    case downloadDestination(DownloadDestination)\n\n    /// A file download task to a destination with extra parameters using the given encoding.\n    case downloadParameters(parameters: [String: Any], encoding: ParameterEncoding, destination: DownloadDestination)\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/URL+Moya.swift",
    "content": "import Foundation\n\npublic extension URL {\n\n    /// Initialize URL from Moya's `TargetType`.\n    init<T: TargetType>(target: T) {\n        // When a TargetType's path is empty, URL.appendingPathComponent may introduce trailing /, which may not be wanted in some cases\n        // See: https://github.com/Moya/Moya/pull/1053\n        // And: https://github.com/Moya/Moya/issues/1049\n        let targetPath = target.path\n        if targetPath.isEmpty {\n            self = target.baseURL\n        } else {\n            self = target.baseURL.appendingPathComponent(targetPath)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/URLRequest+Encoding.swift",
    "content": "import Foundation\n\ninternal extension URLRequest {\n\n    mutating func encoded(encodable: Encodable, encoder: JSONEncoder = JSONEncoder()) throws -> URLRequest {\n        do {\n            let encodable = AnyEncodable(encodable)\n            httpBody = try encoder.encode(encodable)\n\n            let contentTypeHeaderName = \"Content-Type\"\n            if value(forHTTPHeaderField: contentTypeHeaderName) == nil {\n                setValue(\"application/json\", forHTTPHeaderField: contentTypeHeaderName)\n            }\n\n            return self\n        } catch {\n            throw MoyaError.encodableMapping(error)\n        }\n    }\n\n    func encoded(parameters: [String: Any], parameterEncoding: ParameterEncoding) throws -> URLRequest {\n        do {\n            return try parameterEncoding.encode(self, with: parameters)\n        } catch {\n            throw MoyaError.parameterEncoding(error)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/Moya/ValidationType.swift",
    "content": "import Foundation\n\n/// Represents the status codes to validate through Alamofire.\npublic enum ValidationType {\n\n    /// No validation.\n    case none\n\n    /// Validate success codes (only 2xx).\n    case successCodes\n\n    /// Validate success codes and redirection codes (only 2xx and 3xx).\n    case successAndRedirectCodes\n\n    /// Validate only the given status codes.\n    case customCodes([Int])\n\n    /// The list of HTTP status codes to validate.\n    var statusCodes: [Int] {\n        switch self {\n        case .successCodes:\n            return Array(200..<300)\n        case .successAndRedirectCodes:\n            return Array(200..<400)\n        case .customCodes(let codes):\n            return codes\n        case .none:\n            return []\n        }\n    }\n}\n\nextension ValidationType: Equatable {\n\n    public static func == (lhs: ValidationType, rhs: ValidationType) -> Bool {\n        switch (lhs, rhs) {\n        case (.none, .none),\n             (.successCodes, .successCodes),\n             (.successAndRedirectCodes, .successAndRedirectCodes):\n            return true\n        case (.customCodes(let code1), .customCodes(let code2)):\n            return code1 == code2\n        default:\n            return false\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/RxMoya/MoyaProvider+Rx.swift",
    "content": "import Foundation\nimport RxSwift\n#if !COCOAPODS\nimport Moya\n#endif\n\nextension MoyaProvider: ReactiveCompatible {}\n\npublic extension Reactive where Base: MoyaProviderType {\n\n    /// Designated request-making method.\n    ///\n    /// - Parameters:\n    ///   - token: Entity, which provides specifications necessary for a `MoyaProvider`.\n    ///   - callbackQueue: Callback queue. If nil - queue from provider initializer will be used.\n    /// - Returns: Single response object.\n    func request(_ token: Base.Target, callbackQueue: DispatchQueue? = nil) -> Single<Response> {\n        Single.create { [weak base] single in\n            let cancellableToken = base?.request(token, callbackQueue: callbackQueue, progress: nil) { result in\n                switch result {\n                case let .success(response):\n                    single(.success(response))\n                case let .failure(error):\n                    single(.failure(error))\n                }\n            }\n\n            return Disposables.create {\n                cancellableToken?.cancel()\n            }\n        }\n    }\n\n    /// Designated request-making method with progress.\n    func requestWithProgress(_ token: Base.Target, callbackQueue: DispatchQueue? = nil) -> Observable<ProgressResponse> {\n\n        let progressBlock = AnyObserver<ProgressResponse>.onNext\n        let response: Observable<ProgressResponse> = Observable.create { [weak base] observer in\n            let cancellableToken = base?.request(token, callbackQueue: callbackQueue, progress: progressBlock(observer)) { result in\n                switch result {\n                case .success:\n                    observer.onCompleted()\n                case let .failure(error):\n                    observer.onError(error)\n                }\n            }\n\n            return Disposables.create {\n                cancellableToken?.cancel()\n            }\n        }\n\n        // Accumulate all progress and combine them when the result comes\n        return response.scan(ProgressResponse()) { last, progress in\n            let progressObject = progress.progressObject ?? last.progressObject\n            let response = progress.response ?? last.response\n            return ProgressResponse(progress: progressObject, response: response)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/RxMoya/Observable+Response.swift",
    "content": "import Foundation\nimport RxSwift\n#if !COCOAPODS\n    import Moya\n#endif\n\n#if canImport(UIKit)\n    import UIKit.UIImage\n#elseif canImport(AppKit)\n    import AppKit.NSImage\n#endif\n\n/// Extension for processing raw NSData generated by network access.\npublic extension ObservableType where Element == Response {\n\n    /// Filters out responses that don't fall within the given range, generating errors when others are encountered.\n    func filter<R: RangeExpression>(statusCodes: R) -> Observable<Element> where R.Bound == Int {\n        flatMap { Observable.just(try $0.filter(statusCodes: statusCodes)) }\n    }\n\n    /// Filters out responses that has the specified `statusCode`.\n    func filter(statusCode: Int) -> Observable<Element> {\n        flatMap { Observable.just(try $0.filter(statusCode: statusCode)) }\n    }\n\n    /// Filters out responses where `statusCode` falls within the range 200 - 299.\n    func filterSuccessfulStatusCodes() -> Observable<Element> {\n        flatMap { Observable.just(try $0.filterSuccessfulStatusCodes()) }\n    }\n\n    /// Filters out responses where `statusCode` falls within the range 200 - 399\n    func filterSuccessfulStatusAndRedirectCodes() -> Observable<Element> {\n        flatMap { Observable.just(try $0.filterSuccessfulStatusAndRedirectCodes()) }\n    }\n\n    /// Maps data received from the signal into an Image. If the conversion fails, the signal errors.\n    func mapImage() -> Observable<Image> {\n        flatMap { Observable.just(try $0.mapImage()) }\n    }\n\n    /// Maps data received from the signal into a JSON object. If the conversion fails, the signal errors.\n    func mapJSON(failsOnEmptyData: Bool = true) -> Observable<Any> {\n        flatMap { Observable.just(try $0.mapJSON(failsOnEmptyData: failsOnEmptyData)) }\n    }\n\n    /// Maps received data at key path into a String. If the conversion fails, the signal errors.\n    func mapString(atKeyPath keyPath: String? = nil) -> Observable<String> {\n        flatMap { Observable.just(try $0.mapString(atKeyPath: keyPath)) }\n    }\n\n    /// Maps received data at key path into a Decodable object. If the conversion fails, the signal errors.\n    func map<D: Decodable>(_ type: D.Type, atKeyPath keyPath: String? = nil, using decoder: JSONDecoder = JSONDecoder(), failsOnEmptyData: Bool = true) -> Observable<D> {\n        flatMap { Observable.just(try $0.map(type, atKeyPath: keyPath, using: decoder, failsOnEmptyData: failsOnEmptyData)) }\n    }\n}\n\npublic extension ObservableType where Element == ProgressResponse {\n\n    /**\n     Filter completed progress response and maps to actual response\n\n     - returns: response associated with ProgressResponse object\n     */\n    func filterCompleted() -> Observable<Response> {\n        self\n            .filter { $0.completed }\n            .flatMap { progress -> Observable<Response> in\n                // Just a formatlity to satisfy the compiler (completed progresses have responses).\n                switch progress.response {\n                case .some(let response): return .just(response)\n                case .none: return .empty()\n                }\n            }\n    }\n\n    /**\n     Filter progress events of current ProgressResponse\n\n     - returns: observable of progress events\n     */\n    func filterProgress() -> Observable<Double> {\n        self.filter { !$0.completed }.map { $0.progress }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya/Sources/RxMoya/Single+Response.swift",
    "content": "import Foundation\nimport RxSwift\n#if !COCOAPODS\n    import Moya\n#endif\n\n#if canImport(UIKit)\n    import UIKit.UIImage\n#elseif canImport(AppKit)\n    import AppKit.NSImage\n#endif\n\n/// Extension for processing raw NSData generated by network access.\npublic extension PrimitiveSequence where Trait == SingleTrait, Element == Response {\n\n    /// Filters out responses that don't fall within the given closed range, generating errors when others are encountered.\n    func filter<R: RangeExpression>(statusCodes: R) -> Single<Element> where R.Bound == Int {\n        flatMap { .just(try $0.filter(statusCodes: statusCodes)) }\n    }\n\n    /// Filters out responses that have the specified `statusCode`.\n    func filter(statusCode: Int) -> Single<Element> {\n        flatMap { .just(try $0.filter(statusCode: statusCode)) }\n    }\n\n    /// Filters out responses where `statusCode` falls within the range 200 - 299.\n    func filterSuccessfulStatusCodes() -> Single<Element> {\n        flatMap { .just(try $0.filterSuccessfulStatusCodes()) }\n    }\n\n    /// Filters out responses where `statusCode` falls within the range 200 - 399\n    func filterSuccessfulStatusAndRedirectCodes() -> Single<Element> {\n        flatMap { .just(try $0.filterSuccessfulStatusAndRedirectCodes()) }\n    }\n\n    /// Maps data received from the signal into an Image. If the conversion fails, the signal errors.\n    func mapImage() -> Single<Image> {\n        flatMap { .just(try $0.mapImage()) }\n    }\n\n    /// Maps data received from the signal into a JSON object. If the conversion fails, the signal errors.\n    func mapJSON(failsOnEmptyData: Bool = true) -> Single<Any> {\n        flatMap { .just(try $0.mapJSON(failsOnEmptyData: failsOnEmptyData)) }\n    }\n\n    /// Maps received data at key path into a String. If the conversion fails, the signal errors.\n    func mapString(atKeyPath keyPath: String? = nil) -> Single<String> {\n        flatMap { .just(try $0.mapString(atKeyPath: keyPath)) }\n    }\n\n    /// Maps received data at key path into a Decodable object. If the conversion fails, the signal errors.\n    func map<D: Decodable>(_ type: D.Type, atKeyPath keyPath: String? = nil, using decoder: JSONDecoder = JSONDecoder(), failsOnEmptyData: Bool = true) -> Single<D> {\n        flatMap { .just(try $0.map(type, atKeyPath: keyPath, using: decoder, failsOnEmptyData: failsOnEmptyData)) }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/Moya.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t01ACEE699FC085F136296B8AF6F8C5BA /* URL+Moya.swift in Sources */ = {isa = PBXBuildFile; fileRef = E22B2672AC76D960574E34455D3979ED /* URL+Moya.swift */; };\n\t\t0302602ADB2109C3A2004E8B2811F276 /* NetworkLoggerPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 455650A9BC6B3ED7C27BC2C7E0A572AD /* NetworkLoggerPlugin.swift */; };\n\t\t0F3C744CD0C4D4524C00C7F0C3791314 /* AccessTokenPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56AB7D214D4C939D8153AF5E413C4F5D /* AccessTokenPlugin.swift */; };\n\t\t1344DC962B9844581A18007FFAE3B45C /* ValidationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D65AFF7FF59C2BF2742EAF5D9E5372 /* ValidationType.swift */; };\n\t\t18AC2A11EAFC249655D85CFAB438A1F3 /* Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0930724F640D30ED5B8FDEB02C59D726 /* Image.swift */; };\n\t\t311E3E420E8C6A0A9E6D503C3F057C96 /* AnyEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8A8404F2BA7B789C6879241DF73D194 /* AnyEncodable.swift */; };\n\t\t31B3E128E1791C83C0535E7BC5C93C1D /* NetworkActivityPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72B403A110D85D565053678943D11760 /* NetworkActivityPlugin.swift */; };\n\t\t4979BBB77EC19AAEA695BB4FE7EB5ACC /* RequestTypeWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A96E4FA301B2939EA1583DC7556E4B7D /* RequestTypeWrapper.swift */; };\n\t\t4A76A84DABEEF02B7A85F0DC76F6171A /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F9887241C539F81F61EA94B0B6DC929 /* Atomic.swift */; };\n\t\t5CBF7D836203ED03102037FD3303C300 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 745292EDA4E444D97BEA7411B338C934 /* MultipartFormData.swift */; };\n\t\t6E76F2A7F7EB752FDDD86B9939590B08 /* MoyaProvider+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02C4E078DE8E935212BB2A44DB36EFC /* MoyaProvider+Rx.swift */; };\n\t\t6F5B6A3F67B3991D3177380FA5344CC5 /* Moya-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66B936530A151070C4F3782347FF3A /* Moya-dummy.m */; };\n\t\t762C5D8C6A2DD6CE0B6C72BCEFBE4EF7 /* Observable+Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE9D642D21C0182E2D823E5B97AA0011 /* Observable+Response.swift */; };\n\t\t7AA7FFCDB46EAADF5181A69AC07F0693 /* Single+Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF064AF468CC6BB296BD3D4C569C6943 /* Single+Response.swift */; };\n\t\t7E7D7BC74B429DDE17F02F7FF4EAE1AC /* MoyaError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DC9C3C16C166CD6E59848DB27FC2E68 /* MoyaError.swift */; };\n\t\t8B7DFB253746CF099F8F6EC7133702B4 /* CredentialsPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22F3D548EB954A3BA0AE96E711C46A17 /* CredentialsPlugin.swift */; };\n\t\t91CB3C5770C0587A46B42A878E6EE516 /* Cancellable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7FE29C05F22DDF7AC39480190F477A1 /* Cancellable.swift */; };\n\t\t9A835D6B46CCB959A699B358192DBAB5 /* MoyaProvider+Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4750FC01F2640CE9933DA8D1996B9563 /* MoyaProvider+Internal.swift */; };\n\t\t9ACF0060CA686ADC85597CDFAFDDD058 /* Endpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62ECA418A654EDBE2BDB8EA056C2D152 /* Endpoint.swift */; };\n\t\tB30635295B9DC522CBDD2E2788EBB935 /* MultiTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E93D266A34448D4B011E99E5163534F /* MultiTarget.swift */; };\n\t\tC116B02D65F79E7DA2F94A4FFCC44E36 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD5694A301807D84A68CE794C9E4357B /* Foundation.framework */; };\n\t\tC1B3397C440D9FAD31FCB8F6B0F4D39F /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEA479B62AF5CCF05E529E0B2818E04 /* Response.swift */; };\n\t\tD5595E3AD2110BD80FC16C070A8306BF /* TargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322F1FC668F5F47BC8070D6FDA43D8B5 /* TargetType.swift */; };\n\t\tD6EA82E37384787484A5FFA8E260DA33 /* Plugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6991DD35A37DD66E0A7E37106E406FB1 /* Plugin.swift */; };\n\t\tD9EA2DB8AE053EC0A5A96EC9973C05E7 /* URLRequest+Encoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01C9F3B317CE0190D7190524197B3AD5 /* URLRequest+Encoding.swift */; };\n\t\tEF6E0AC790D632AE16F26D861D9309A7 /* MoyaProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23F077C9D5023003534866465083DD3F /* MoyaProvider.swift */; };\n\t\tF502EB630B2446DA5488F06CDA079486 /* MoyaProvider+Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 170932A7DCC736CFA7A22734F5F8A909 /* MoyaProvider+Defaults.swift */; };\n\t\tF612B75A56482B9A205C69A86C419D2D /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C2839779150E6C10039B42954D57AC /* Task.swift */; };\n\t\tFB154C1C7A52D62FB33721C51D172B3A /* Moya+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 107C25A90F8501C0A722E99DF04A5B90 /* Moya+Alamofire.swift */; };\n\t\tFFF5C95C1AD83705533380A1CC1C5805 /* Moya-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C2A6449AB68B8FB134B4339E41BFB629 /* Moya-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t0ADB2CE98FCDBC252875C901E472F24D /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = BC26EC028809C4983780807EBA8CE40B /* RxSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = F0179EE061353B7A322F596E97844774;\n\t\t\tremoteInfo = RxSwift;\n\t\t};\n\t\t77867E18D02DDCAF00F23052C1CAD358 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = B31881F91D3ED2AEF947D94FC5632461 /* Alamofire.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 81B7E9B7CD0CADA087A4BB042FBA92E7;\n\t\t\tremoteInfo = Alamofire;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t01C9F3B317CE0190D7190524197B3AD5 /* URLRequest+Encoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"URLRequest+Encoding.swift\"; path = \"Sources/Moya/URLRequest+Encoding.swift\"; sourceTree = \"<group>\"; };\n\t\t0930724F640D30ED5B8FDEB02C59D726 /* Image.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Image.swift; path = Sources/Moya/Image.swift; sourceTree = \"<group>\"; };\n\t\t0F9887241C539F81F61EA94B0B6DC929 /* Atomic.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Atomic.swift; path = Sources/Moya/Atomic.swift; sourceTree = \"<group>\"; };\n\t\t107C25A90F8501C0A722E99DF04A5B90 /* Moya+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Moya+Alamofire.swift\"; path = \"Sources/Moya/Moya+Alamofire.swift\"; sourceTree = \"<group>\"; };\n\t\t170932A7DCC736CFA7A22734F5F8A909 /* MoyaProvider+Defaults.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"MoyaProvider+Defaults.swift\"; path = \"Sources/Moya/MoyaProvider+Defaults.swift\"; sourceTree = \"<group>\"; };\n\t\t22F3D548EB954A3BA0AE96E711C46A17 /* CredentialsPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CredentialsPlugin.swift; path = Sources/Moya/Plugins/CredentialsPlugin.swift; sourceTree = \"<group>\"; };\n\t\t23F077C9D5023003534866465083DD3F /* MoyaProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MoyaProvider.swift; path = Sources/Moya/MoyaProvider.swift; sourceTree = \"<group>\"; };\n\t\t2DC9C3C16C166CD6E59848DB27FC2E68 /* MoyaError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MoyaError.swift; path = Sources/Moya/MoyaError.swift; sourceTree = \"<group>\"; };\n\t\t2E93D266A34448D4B011E99E5163534F /* MultiTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultiTarget.swift; path = Sources/Moya/MultiTarget.swift; sourceTree = \"<group>\"; };\n\t\t322F1FC668F5F47BC8070D6FDA43D8B5 /* TargetType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TargetType.swift; path = Sources/Moya/TargetType.swift; sourceTree = \"<group>\"; };\n\t\t39C2839779150E6C10039B42954D57AC /* Task.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Task.swift; path = Sources/Moya/Task.swift; sourceTree = \"<group>\"; };\n\t\t455650A9BC6B3ED7C27BC2C7E0A572AD /* NetworkLoggerPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkLoggerPlugin.swift; path = Sources/Moya/Plugins/NetworkLoggerPlugin.swift; sourceTree = \"<group>\"; };\n\t\t4750FC01F2640CE9933DA8D1996B9563 /* MoyaProvider+Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"MoyaProvider+Internal.swift\"; path = \"Sources/Moya/MoyaProvider+Internal.swift\"; sourceTree = \"<group>\"; };\n\t\t56AB7D214D4C939D8153AF5E413C4F5D /* AccessTokenPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AccessTokenPlugin.swift; path = Sources/Moya/Plugins/AccessTokenPlugin.swift; sourceTree = \"<group>\"; };\n\t\t5AB31CE0659B2C4383AA8842C4D8D0CC /* Moya-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"Moya-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t62ECA418A654EDBE2BDB8EA056C2D152 /* Endpoint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Endpoint.swift; path = Sources/Moya/Endpoint.swift; sourceTree = \"<group>\"; };\n\t\t6991DD35A37DD66E0A7E37106E406FB1 /* Plugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Plugin.swift; path = Sources/Moya/Plugin.swift; sourceTree = \"<group>\"; };\n\t\t72B403A110D85D565053678943D11760 /* NetworkActivityPlugin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkActivityPlugin.swift; path = Sources/Moya/Plugins/NetworkActivityPlugin.swift; sourceTree = \"<group>\"; };\n\t\t745292EDA4E444D97BEA7411B338C934 /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Sources/Moya/MultipartFormData.swift; sourceTree = \"<group>\"; };\n\t\t77593F03666F30314EA6446091382B1E /* Moya.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Moya.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t7D66B936530A151070C4F3782347FF3A /* Moya-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"Moya-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t81D65AFF7FF59C2BF2742EAF5D9E5372 /* ValidationType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ValidationType.swift; path = Sources/Moya/ValidationType.swift; sourceTree = \"<group>\"; };\n\t\t8BFA7D2DA40B9A14C5B9C9CAC5EB34BB /* Moya.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Moya.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t9EEA479B62AF5CCF05E529E0B2818E04 /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Sources/Moya/Response.swift; sourceTree = \"<group>\"; };\n\t\tA96E4FA301B2939EA1583DC7556E4B7D /* RequestTypeWrapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestTypeWrapper.swift; path = Sources/Moya/RequestTypeWrapper.swift; sourceTree = \"<group>\"; };\n\t\tAF7E5DC3831B61C2FBE59D819B1F2D1E /* Moya-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Moya-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tB31881F91D3ED2AEF947D94FC5632461 /* Alamofire */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = Alamofire; path = Alamofire.xcodeproj; sourceTree = \"<group>\"; };\n\t\tB913CC622BDCDE02506DA5B3E230F6E9 /* Moya */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Moya; path = Moya.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tBC26EC028809C4983780807EBA8CE40B /* RxSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxSwift; path = RxSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\tC2A6449AB68B8FB134B4339E41BFB629 /* Moya-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Moya-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tDF064AF468CC6BB296BD3D4C569C6943 /* Single+Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Single+Response.swift\"; path = \"Sources/RxMoya/Single+Response.swift\"; sourceTree = \"<group>\"; };\n\t\tE02C4E078DE8E935212BB2A44DB36EFC /* MoyaProvider+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"MoyaProvider+Rx.swift\"; path = \"Sources/RxMoya/MoyaProvider+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tE22B2672AC76D960574E34455D3979ED /* URL+Moya.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"URL+Moya.swift\"; path = \"Sources/Moya/URL+Moya.swift\"; sourceTree = \"<group>\"; };\n\t\tE74A0370A09CCE8E84DD46397800F65C /* Moya.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Moya.modulemap; sourceTree = \"<group>\"; };\n\t\tE7FE29C05F22DDF7AC39480190F477A1 /* Cancellable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Cancellable.swift; path = Sources/Moya/Cancellable.swift; sourceTree = \"<group>\"; };\n\t\tEE9D642D21C0182E2D823E5B97AA0011 /* Observable+Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Observable+Response.swift\"; path = \"Sources/RxMoya/Observable+Response.swift\"; sourceTree = \"<group>\"; };\n\t\tF8A8404F2BA7B789C6879241DF73D194 /* AnyEncodable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyEncodable.swift; path = Sources/Moya/AnyEncodable.swift; sourceTree = \"<group>\"; };\n\t\tFD5694A301807D84A68CE794C9E4357B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t69F62A8CE4DFA122FE8EA8D426BB2F80 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC116B02D65F79E7DA2F94A4FFCC44E36 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2DF07B8FB1A3978673712826AE750E6F /* Core */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t56AB7D214D4C939D8153AF5E413C4F5D /* AccessTokenPlugin.swift */,\n\t\t\t\tF8A8404F2BA7B789C6879241DF73D194 /* AnyEncodable.swift */,\n\t\t\t\t0F9887241C539F81F61EA94B0B6DC929 /* Atomic.swift */,\n\t\t\t\tE7FE29C05F22DDF7AC39480190F477A1 /* Cancellable.swift */,\n\t\t\t\t22F3D548EB954A3BA0AE96E711C46A17 /* CredentialsPlugin.swift */,\n\t\t\t\t62ECA418A654EDBE2BDB8EA056C2D152 /* Endpoint.swift */,\n\t\t\t\t0930724F640D30ED5B8FDEB02C59D726 /* Image.swift */,\n\t\t\t\t107C25A90F8501C0A722E99DF04A5B90 /* Moya+Alamofire.swift */,\n\t\t\t\t2DC9C3C16C166CD6E59848DB27FC2E68 /* MoyaError.swift */,\n\t\t\t\t23F077C9D5023003534866465083DD3F /* MoyaProvider.swift */,\n\t\t\t\t170932A7DCC736CFA7A22734F5F8A909 /* MoyaProvider+Defaults.swift */,\n\t\t\t\t4750FC01F2640CE9933DA8D1996B9563 /* MoyaProvider+Internal.swift */,\n\t\t\t\t745292EDA4E444D97BEA7411B338C934 /* MultipartFormData.swift */,\n\t\t\t\t2E93D266A34448D4B011E99E5163534F /* MultiTarget.swift */,\n\t\t\t\t72B403A110D85D565053678943D11760 /* NetworkActivityPlugin.swift */,\n\t\t\t\t455650A9BC6B3ED7C27BC2C7E0A572AD /* NetworkLoggerPlugin.swift */,\n\t\t\t\t6991DD35A37DD66E0A7E37106E406FB1 /* Plugin.swift */,\n\t\t\t\tA96E4FA301B2939EA1583DC7556E4B7D /* RequestTypeWrapper.swift */,\n\t\t\t\t9EEA479B62AF5CCF05E529E0B2818E04 /* Response.swift */,\n\t\t\t\t322F1FC668F5F47BC8070D6FDA43D8B5 /* TargetType.swift */,\n\t\t\t\t39C2839779150E6C10039B42954D57AC /* Task.swift */,\n\t\t\t\tE22B2672AC76D960574E34455D3979ED /* URL+Moya.swift */,\n\t\t\t\t01C9F3B317CE0190D7190524197B3AD5 /* URLRequest+Encoding.swift */,\n\t\t\t\t81D65AFF7FF59C2BF2742EAF5D9E5372 /* ValidationType.swift */,\n\t\t\t);\n\t\t\tname = Core;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t35410AE0F28BB13B09C00ED07E54DA3A /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tFD5694A301807D84A68CE794C9E4357B /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5049A226E14881347E5B46C65C0664EC /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB31881F91D3ED2AEF947D94FC5632461 /* Alamofire */,\n\t\t\t\tBC26EC028809C4983780807EBA8CE40B /* RxSwift */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t54D8FDF739D96D66577AF7FFAADA014F = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5049A226E14881347E5B46C65C0664EC /* Dependencies */,\n\t\t\t\tC0CAE840C1DDF0C57692603935B67F7E /* Frameworks */,\n\t\t\t\t625D8FA31E44B50132A5ADC023F7A6BC /* Moya */,\n\t\t\t\t853923AD88EFC428ED98DA662CCD4C07 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t625D8FA31E44B50132A5ADC023F7A6BC /* Moya */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2DF07B8FB1A3978673712826AE750E6F /* Core */,\n\t\t\t\tF8DBCA15239525FBBCBED5779C9C441F /* RxSwift */,\n\t\t\t\tD7D2D0D46DB20DF3ABA73FF89B9633C8 /* Support Files */,\n\t\t\t);\n\t\t\tname = Moya;\n\t\t\tpath = Moya;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t853923AD88EFC428ED98DA662CCD4C07 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB913CC622BDCDE02506DA5B3E230F6E9 /* Moya */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tC0CAE840C1DDF0C57692603935B67F7E /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t35410AE0F28BB13B09C00ED07E54DA3A /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD7D2D0D46DB20DF3ABA73FF89B9633C8 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE74A0370A09CCE8E84DD46397800F65C /* Moya.modulemap */,\n\t\t\t\t7D66B936530A151070C4F3782347FF3A /* Moya-dummy.m */,\n\t\t\t\t5AB31CE0659B2C4383AA8842C4D8D0CC /* Moya-Info.plist */,\n\t\t\t\tAF7E5DC3831B61C2FBE59D819B1F2D1E /* Moya-prefix.pch */,\n\t\t\t\tC2A6449AB68B8FB134B4339E41BFB629 /* Moya-umbrella.h */,\n\t\t\t\t8BFA7D2DA40B9A14C5B9C9CAC5EB34BB /* Moya.debug.xcconfig */,\n\t\t\t\t77593F03666F30314EA6446091382B1E /* Moya.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/Moya\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF8DBCA15239525FBBCBED5779C9C441F /* RxSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE02C4E078DE8E935212BB2A44DB36EFC /* MoyaProvider+Rx.swift */,\n\t\t\t\tEE9D642D21C0182E2D823E5B97AA0011 /* Observable+Response.swift */,\n\t\t\t\tDF064AF468CC6BB296BD3D4C569C6943 /* Single+Response.swift */,\n\t\t\t);\n\t\t\tname = RxSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tAB2103F3E187BB60D6F7C52FF7BAD7FD /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tFFF5C95C1AD83705533380A1CC1C5805 /* Moya-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t42D4D39F3084C8EA060DE1C283323B37 /* Moya */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 989E9C42556F7F28CBAB27E22200C5CC /* Build configuration list for PBXNativeTarget \"Moya\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tAB2103F3E187BB60D6F7C52FF7BAD7FD /* Headers */,\n\t\t\t\tB71F88D36B606022CFA113DE70C9FB7D /* Sources */,\n\t\t\t\t69F62A8CE4DFA122FE8EA8D426BB2F80 /* Frameworks */,\n\t\t\t\t70362EE3D80710CEC9EE17EBB94A6EFD /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tA89C00DB97D516E7F74AF5BB86B22DB9 /* PBXTargetDependency */,\n\t\t\t\tFA022B88AB0D39B3DE461061D06619AA /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = Moya;\n\t\t\tproductName = Moya;\n\t\t\tproductReference = B913CC622BDCDE02506DA5B3E230F6E9 /* Moya */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tF6493C42A559A775EEFF8688503009C6 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = BD717B0E9ADA70AE4911AE9DB1298E78 /* Build configuration list for PBXProject \"Moya\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 54D8FDF739D96D66577AF7FFAADA014F;\n\t\t\tproductRefGroup = 853923AD88EFC428ED98DA662CCD4C07 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = B31881F91D3ED2AEF947D94FC5632461 /* Alamofire */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = BC26EC028809C4983780807EBA8CE40B /* RxSwift */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t42D4D39F3084C8EA060DE1C283323B37 /* Moya */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t70362EE3D80710CEC9EE17EBB94A6EFD /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tB71F88D36B606022CFA113DE70C9FB7D /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t0F3C744CD0C4D4524C00C7F0C3791314 /* AccessTokenPlugin.swift in Sources */,\n\t\t\t\t311E3E420E8C6A0A9E6D503C3F057C96 /* AnyEncodable.swift in Sources */,\n\t\t\t\t4A76A84DABEEF02B7A85F0DC76F6171A /* Atomic.swift in Sources */,\n\t\t\t\t91CB3C5770C0587A46B42A878E6EE516 /* Cancellable.swift in Sources */,\n\t\t\t\t8B7DFB253746CF099F8F6EC7133702B4 /* CredentialsPlugin.swift in Sources */,\n\t\t\t\t9ACF0060CA686ADC85597CDFAFDDD058 /* Endpoint.swift in Sources */,\n\t\t\t\t18AC2A11EAFC249655D85CFAB438A1F3 /* Image.swift in Sources */,\n\t\t\t\tFB154C1C7A52D62FB33721C51D172B3A /* Moya+Alamofire.swift in Sources */,\n\t\t\t\t6F5B6A3F67B3991D3177380FA5344CC5 /* Moya-dummy.m in Sources */,\n\t\t\t\t7E7D7BC74B429DDE17F02F7FF4EAE1AC /* MoyaError.swift in Sources */,\n\t\t\t\tEF6E0AC790D632AE16F26D861D9309A7 /* MoyaProvider.swift in Sources */,\n\t\t\t\tF502EB630B2446DA5488F06CDA079486 /* MoyaProvider+Defaults.swift in Sources */,\n\t\t\t\t9A835D6B46CCB959A699B358192DBAB5 /* MoyaProvider+Internal.swift in Sources */,\n\t\t\t\t6E76F2A7F7EB752FDDD86B9939590B08 /* MoyaProvider+Rx.swift in Sources */,\n\t\t\t\t5CBF7D836203ED03102037FD3303C300 /* MultipartFormData.swift in Sources */,\n\t\t\t\tB30635295B9DC522CBDD2E2788EBB935 /* MultiTarget.swift in Sources */,\n\t\t\t\t31B3E128E1791C83C0535E7BC5C93C1D /* NetworkActivityPlugin.swift in Sources */,\n\t\t\t\t0302602ADB2109C3A2004E8B2811F276 /* NetworkLoggerPlugin.swift in Sources */,\n\t\t\t\t762C5D8C6A2DD6CE0B6C72BCEFBE4EF7 /* Observable+Response.swift in Sources */,\n\t\t\t\tD6EA82E37384787484A5FFA8E260DA33 /* Plugin.swift in Sources */,\n\t\t\t\t4979BBB77EC19AAEA695BB4FE7EB5ACC /* RequestTypeWrapper.swift in Sources */,\n\t\t\t\tC1B3397C440D9FAD31FCB8F6B0F4D39F /* Response.swift in Sources */,\n\t\t\t\t7AA7FFCDB46EAADF5181A69AC07F0693 /* Single+Response.swift in Sources */,\n\t\t\t\tD5595E3AD2110BD80FC16C070A8306BF /* TargetType.swift in Sources */,\n\t\t\t\tF612B75A56482B9A205C69A86C419D2D /* Task.swift in Sources */,\n\t\t\t\t01ACEE699FC085F136296B8AF6F8C5BA /* URL+Moya.swift in Sources */,\n\t\t\t\tD9EA2DB8AE053EC0A5A96EC9973C05E7 /* URLRequest+Encoding.swift in Sources */,\n\t\t\t\t1344DC962B9844581A18007FFAE3B45C /* ValidationType.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\tA89C00DB97D516E7F74AF5BB86B22DB9 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = Alamofire;\n\t\t\ttargetProxy = 77867E18D02DDCAF00F23052C1CAD358 /* PBXContainerItemProxy */;\n\t\t};\n\t\tFA022B88AB0D39B3DE461061D06619AA /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxSwift;\n\t\t\ttargetProxy = 0ADB2CE98FCDBC252875C901E472F24D /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t178FE4C0DD2DB78431ABC56EA39ACC7E /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 77593F03666F30314EA6446091382B1E /* Moya.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Moya/Moya-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Moya/Moya-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Moya/Moya.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Moya;\n\t\t\t\tPRODUCT_NAME = Moya;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.3;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t38BC10FF3030FD9CDA398BCA2C029FBD /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tB8F8B8C3A939E5051966A770EF0DB546 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 8BFA7D2DA40B9A14C5B9C9CAC5EB34BB /* Moya.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/Moya/Moya-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Moya/Moya-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Moya/Moya.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Moya;\n\t\t\t\tPRODUCT_NAME = Moya;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.3;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEC7ACE4D2D5EE967F30A92C8331BB34D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t989E9C42556F7F28CBAB27E22200C5CC /* Build configuration list for PBXNativeTarget \"Moya\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tB8F8B8C3A939E5051966A770EF0DB546 /* Debug */,\n\t\t\t\t178FE4C0DD2DB78431ABC56EA39ACC7E /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tBD717B0E9ADA70AE4911AE9DB1298E78 /* Build configuration list for PBXProject \"Moya\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t38BC10FF3030FD9CDA398BCA2C029FBD /* Debug */,\n\t\t\t\tEC7ACE4D2D5EE967F30A92C8331BB34D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = F6493C42A559A775EEFF8688503009C6 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/NSObject+Rx/HasDisposeBag.swift",
    "content": "import Foundation\nimport RxSwift\nimport ObjectiveC\n\nfileprivate var disposeBagContext: UInt8 = 0\n\n/// each HasDisposeBag offers a unique RxSwift DisposeBag instance\npublic protocol HasDisposeBag: class {\n\n    /// a unique RxSwift DisposeBag instance\n    var disposeBag: DisposeBag { get set }\n}\n\nextension HasDisposeBag {\n\n    func synchronizedBag<T>( _ action: () -> T) -> T {\n        objc_sync_enter(self)\n        let result = action()\n        objc_sync_exit(self)\n        return result\n    }\n\n    public var disposeBag: DisposeBag {\n        get {\n            return synchronizedBag {\n                if let disposeObject = objc_getAssociatedObject(self, &disposeBagContext) as? DisposeBag {\n                    return disposeObject\n                }\n                let disposeObject = DisposeBag()\n                objc_setAssociatedObject(self, &disposeBagContext, disposeObject, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n                return disposeObject\n            }\n        }\n\n        set {\n            synchronizedBag {\n                objc_setAssociatedObject(self, &disposeBagContext, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            }\n        }\n    }\n}\n\n\n\n"
  },
  {
    "path": "JetChat/Pods/NSObject+Rx/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Ash Furrow\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/NSObject+Rx/NSObject+Rx.swift",
    "content": "import Foundation\nimport RxSwift\nimport ObjectiveC\n\nfileprivate var disposeBagContext: UInt8 = 0\n\nextension Reactive where Base: AnyObject {\n    func synchronizedBag<T>( _ action: () -> T) -> T {\n        objc_sync_enter(self.base)\n        let result = action()\n        objc_sync_exit(self.base)\n        return result\n    }\n}\n\npublic extension Reactive where Base: AnyObject {\n\n    /// a unique DisposeBag that is related to the Reactive.Base instance only for Reference type\n    var disposeBag: DisposeBag {\n        get {\n            return synchronizedBag {\n                if let disposeObject = objc_getAssociatedObject(base, &disposeBagContext) as? DisposeBag {\n                    return disposeObject\n                }\n                let disposeObject = DisposeBag()\n                objc_setAssociatedObject(base, &disposeBagContext, disposeObject, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n                return disposeObject\n            }\n        }\n        \n        set {\n            synchronizedBag {\n                objc_setAssociatedObject(base, &disposeBagContext, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/NSObject+Rx/Readme.md",
    "content": "[![CircleCI](https://circleci.com/gh/RxSwiftCommunity/NSObject-Rx/tree/master.svg?style=svg)](https://circleci.com/gh/RxSwiftCommunity/NSObject-Rx/tree/master)\n\nNSObject+Rx\n===========\n\nIf you're using [RxSwift](https://github.com/ReactiveX/RxSwift), you've probably encountered the following code more than a few times.\n\n```swift\nclass MyObject: Whatever {\n\tlet disposeBag = DisposeBag()\n\n\t...\n}\n```\n\nYou're actually not the only one; it has been typed many, many times.\n\n[![Search screenshot showing many, many results.](assets/screenshot.png)](https://github.com/search?q=let+disposeBag+%3D+DisposeBag%28%29&type=Code&utf8=✓)\n\nInstead of adding a new property to every object, use this library to add it for you, to any subclass of `NSObject`.\n\n```swift\nthing\n  .bind(to: otherThing)\n  .disposed(by: rx.disposeBag)\n```\n\nSweet.\n\nIt'll work just like a property: when the instance is deinit'd, the `DisposeBag` gets disposed. It's also a read/write property, so you can use your own, too.\n\nIf you want to add a DisposeBag to an Object that does not inherit from NSObject, you can also implement the protocol `HasDisposeBag`, and you're good to go. This protocol provides a default DisposeBag called `disposeBag`.\n\nInstalling\n----------\n\n#### CocoaPods\n\nAdd to your `Podfile`:\n\n```ruby\npod 'NSObject+Rx'\n```\n\nAnd that'll be 👌\n\n#### Carthage\n\nAdd to `Cartfile`:\n```\ngithub \"RxSwiftCommunity/NSObject-Rx\"\n```\nAdd frameworks to your project (no need to \"copy items if needed\")\n\nRun `carthage update` or `carthage update --platform ios` if you target iOS only\n\nAdd run script build phase `/usr/local/bin/carthage copy-frameworks`\nwith input files being:\n\n```\n$(SRCROOT)/Carthage/Build/iOS/RxSwift.framework\n$(SRCROOT)/Carthage/Build/iOS/NSObject_Rx.framework\n```\n\nAnd rule ✌️\n\nContributing\n------------\n\nSource files are in the root directory. We use CocoaPods to develop, check out the unit tests in the Demo project.\n\nLicense\n-------\n\nMIT obvs.\n\n![Tim Cook dancing to the sound of a permissive license.](http://i.imgur.com/mONiWzj.gif)\n"
  },
  {
    "path": "JetChat/Pods/NSObject+Rx.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t2F15069A540A8F8683A071A55D15C74A /* NSObject+Rx-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = ACFEC35DC574FF78440AE16F120DF03F /* NSObject+Rx-dummy.m */; };\n\t\t8B653D760D57786D334AAC97EE0C7456 /* NSObject+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E1D27A2FD8318296ED63050631BA638 /* NSObject+Rx.swift */; };\n\t\tA256A93934A30F4C1B895088807361B3 /* HasDisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81F56ABCA60272CFF67E49C9E1FE9ED7 /* HasDisposeBag.swift */; };\n\t\tE34AEB36CB2AFD9877382205C698033D /* NSObject+Rx-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EFE9F2B7DF6AAE13005A7D0D682308C /* NSObject+Rx-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFECE79771828D5513D79BE66335B0AAC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F8B994F4C475906D73B6BF8185B8329 /* Foundation.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t2DD8E42D8D553CDF1033EC0F25AB9CD3 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 4E9AAB33597B354282A06A67390FD33E /* RxSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = F0179EE061353B7A322F596E97844774;\n\t\t\tremoteInfo = RxSwift;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t18BC41B01F45E49EE0B4E32F31BCF76D /* NSObject+Rx-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"NSObject+Rx-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t3E1D27A2FD8318296ED63050631BA638 /* NSObject+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = \"NSObject+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t4E9AAB33597B354282A06A67390FD33E /* RxSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxSwift; path = RxSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t4EFE9F2B7DF6AAE13005A7D0D682308C /* NSObject+Rx-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"NSObject+Rx-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t5F8B994F4C475906D73B6BF8185B8329 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t7A73EB54F353715C79AB18937C14A9EF /* NSObject+Rx-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"NSObject+Rx-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t7D2BED888BA052199CA8FB44128D4F0F /* NSObject+Rx.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"NSObject+Rx.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t81F56ABCA60272CFF67E49C9E1FE9ED7 /* HasDisposeBag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = HasDisposeBag.swift; sourceTree = \"<group>\"; };\n\t\tA5BDF849DF6103DCB0FFA98879260BBC /* NSObject+Rx.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"NSObject+Rx.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tACFEC35DC574FF78440AE16F120DF03F /* NSObject+Rx-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"NSObject+Rx-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tBAC07ECF2A074705EB181BEC8227C5D1 /* NSObject+Rx.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = \"NSObject+Rx.modulemap\"; sourceTree = \"<group>\"; };\n\t\tD2A8ACD43E3AA5097A118F0258AD5521 /* NSObject+Rx */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = \"NSObject+Rx\"; path = NSObject_Rx.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t2DB776BD7C1B801780EB9F49832A14B8 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tFECE79771828D5513D79BE66335B0AAC /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t287CB4D8109BE99B083DA9127E0C84C5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tED68B683AA0B251ED3AC6F1A1EEDD64A /* Dependencies */,\n\t\t\t\tEB5D211BEA57E5DACE46A43C553DB96C /* Frameworks */,\n\t\t\t\tEAB2EEC93D0B6A95E1FA507BA530DA52 /* NSObject+Rx */,\n\t\t\t\tF2414054AD26CAB8A2FF13E30FF8357F /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5F7BA46112A8D4C24A0792683692C383 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5F8B994F4C475906D73B6BF8185B8329 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE5D734131881FA289812E66B8267837E /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBAC07ECF2A074705EB181BEC8227C5D1 /* NSObject+Rx.modulemap */,\n\t\t\t\tACFEC35DC574FF78440AE16F120DF03F /* NSObject+Rx-dummy.m */,\n\t\t\t\t18BC41B01F45E49EE0B4E32F31BCF76D /* NSObject+Rx-Info.plist */,\n\t\t\t\t7A73EB54F353715C79AB18937C14A9EF /* NSObject+Rx-prefix.pch */,\n\t\t\t\t4EFE9F2B7DF6AAE13005A7D0D682308C /* NSObject+Rx-umbrella.h */,\n\t\t\t\t7D2BED888BA052199CA8FB44128D4F0F /* NSObject+Rx.debug.xcconfig */,\n\t\t\t\tA5BDF849DF6103DCB0FFA98879260BBC /* NSObject+Rx.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/NSObject+Rx\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEAB2EEC93D0B6A95E1FA507BA530DA52 /* NSObject+Rx */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t81F56ABCA60272CFF67E49C9E1FE9ED7 /* HasDisposeBag.swift */,\n\t\t\t\t3E1D27A2FD8318296ED63050631BA638 /* NSObject+Rx.swift */,\n\t\t\t\tE5D734131881FA289812E66B8267837E /* Support Files */,\n\t\t\t);\n\t\t\tname = \"NSObject+Rx\";\n\t\t\tpath = \"NSObject+Rx\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEB5D211BEA57E5DACE46A43C553DB96C /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5F7BA46112A8D4C24A0792683692C383 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tED68B683AA0B251ED3AC6F1A1EEDD64A /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4E9AAB33597B354282A06A67390FD33E /* RxSwift */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF2414054AD26CAB8A2FF13E30FF8357F /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD2A8ACD43E3AA5097A118F0258AD5521 /* NSObject+Rx */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tE8FBA7CEEEB108877386BFBCC4273865 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tE34AEB36CB2AFD9877382205C698033D /* NSObject+Rx-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t8959B62B3AF892ED95EA44BE841842BD /* NSObject+Rx */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 6A77C790DB08A8445E887E14012A1047 /* Build configuration list for PBXNativeTarget \"NSObject+Rx\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE8FBA7CEEEB108877386BFBCC4273865 /* Headers */,\n\t\t\t\tB605DDE5DF78A056BF1A5FEA5B25AF77 /* Sources */,\n\t\t\t\t2DB776BD7C1B801780EB9F49832A14B8 /* Frameworks */,\n\t\t\t\t2DC6E76C62FF5AC6DDD3008DDA4393D9 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tDFF4E5964CCC76A3E6E7BB5FF92EAD58 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"NSObject+Rx\";\n\t\t\tproductName = NSObject_Rx;\n\t\t\tproductReference = D2A8ACD43E3AA5097A118F0258AD5521 /* NSObject+Rx */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tBD587980CBF20EAB86A9CBBEC227E77A /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 1A0C0A92F14C00D31616EEBA600D2ADD /* Build configuration list for PBXProject \"NSObject+Rx\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 287CB4D8109BE99B083DA9127E0C84C5;\n\t\t\tproductRefGroup = F2414054AD26CAB8A2FF13E30FF8357F /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 4E9AAB33597B354282A06A67390FD33E /* RxSwift */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t8959B62B3AF892ED95EA44BE841842BD /* NSObject+Rx */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t2DC6E76C62FF5AC6DDD3008DDA4393D9 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tB605DDE5DF78A056BF1A5FEA5B25AF77 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tA256A93934A30F4C1B895088807361B3 /* HasDisposeBag.swift in Sources */,\n\t\t\t\t8B653D760D57786D334AAC97EE0C7456 /* NSObject+Rx.swift in Sources */,\n\t\t\t\t2F15069A540A8F8683A071A55D15C74A /* NSObject+Rx-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\tDFF4E5964CCC76A3E6E7BB5FF92EAD58 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxSwift;\n\t\t\ttargetProxy = 2DD8E42D8D553CDF1033EC0F25AB9CD3 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t7D13F9A7B14A0A352BF931DBEE97A644 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tB957FFDE0FE3CA464163C506F8F3F695 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = A5BDF849DF6103DCB0FFA98879260BBC /* NSObject+Rx.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/NSObject+Rx/NSObject+Rx-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/NSObject+Rx/NSObject+Rx-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/NSObject+Rx/NSObject+Rx.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = NSObject_Rx;\n\t\t\t\tPRODUCT_NAME = NSObject_Rx;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD4359E2EA93D80560746DFF5960E0E45 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD6380C87853A06170AA6B4B21D2B63EE /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7D2BED888BA052199CA8FB44128D4F0F /* NSObject+Rx.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/NSObject+Rx/NSObject+Rx-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/NSObject+Rx/NSObject+Rx-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/NSObject+Rx/NSObject+Rx.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = NSObject_Rx;\n\t\t\t\tPRODUCT_NAME = NSObject_Rx;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t1A0C0A92F14C00D31616EEBA600D2ADD /* Build configuration list for PBXProject \"NSObject+Rx\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7D13F9A7B14A0A352BF931DBEE97A644 /* Debug */,\n\t\t\t\tD4359E2EA93D80560746DFF5960E0E45 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t6A77C790DB08A8445E887E14012A1047 /* Build configuration list for PBXNativeTarget \"NSObject+Rx\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD6380C87853A06170AA6B4B21D2B63EE /* Debug */,\n\t\t\t\tB957FFDE0FE3CA464163C506F8F3F695 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = BD587980CBF20EAB86A9CBBEC227E77A /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/Pods.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t59659CE0366CC5E00255421847A4D9E5 /* Pods-FY-IMChat-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C61FD2BA6F5AA699823B33298FC60CB /* Pods-FY-IMChat-dummy.m */; };\n\t\tAB889899087A022F9CDC807FD8FDD58E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; };\n\t\tF45523F3401BB4CA0CB62234B6205D3A /* Pods-FY-IMChat-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 98FC81A49A355E0476EF6F20062425D1 /* Pods-FY-IMChat-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t179EE28B34EF9DFDDE20E7557E721E93 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = CA7DE2133F5A597608F2965178D3A58B /* SwifterSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 480FE5A632FE83D1C34E3D143792B43C;\n\t\t\tremoteInfo = SwifterSwift;\n\t\t};\n\t\t20E4979136D7BEF8A2A2246AF45C3095 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E5D2CCA1CBD9E9DBABE5E4AF29D0256B /* RxTheme.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 642CE8A56D477528D9E8BCDD0A6FEBB8;\n\t\t\tremoteInfo = RxTheme;\n\t\t};\n\t\t2729CC999F664F831C5427C679442B70 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 857C0E24CF40B7B3DA2BD6FA5647577B /* RxSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = F0179EE061353B7A322F596E97844774;\n\t\t\tremoteInfo = RxSwift;\n\t\t};\n\t\t27A7FA3CF9A7F44C66A4CBA3B3BABEA1 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = B17FBD4BAE6C8F56AF2C17EBA67635D2 /* R.swift.Library.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 61AC8FF22886EA444144B44F9AC733B8;\n\t\t\tremoteInfo = R.swift.Library;\n\t\t};\n\t\t2BD3BFA0F60EC170B8BD78DF4A02BF73 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 581C8733EC6B49617C9E986DEC414849 /* Kingfisher.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 05BB3BFEAA03766641420DCD88978468;\n\t\t\tremoteInfo = Kingfisher;\n\t\t};\n\t\t34A4839299095B0C0EC28D32E1EA8631 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = C52B01BAA3BA7AD7306D321A5D0CA43E /* YYImage.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 79A687989E871964747CED931C10657C;\n\t\t\tremoteInfo = YYImage;\n\t\t};\n\t\t38C8E84E0C6BC9A02E472775186B8674 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 80768DA22DD40A31E5CBFB00A0C907E3 /* RxRelay.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 564FA919E05BFD512DA9163BAB640EEE;\n\t\t\tremoteInfo = RxRelay;\n\t\t};\n\t\t3E9D67A07F0A886FF6004CA2144BF4DF /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 11BCE9367A626F89920B14671B71FF07 /* WCDB.swift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4EAAAD4A9736C05D0B4707614E368B84;\n\t\t\tremoteInfo = WCDB.swift;\n\t\t};\n\t\t4730D86AD92E3133810CDADE979D323E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = FA089FB2D3E623384DBE92B4E7C61590 /* SDWebImage.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4ECF4E662EEBE4FA58102FF984D920CC;\n\t\t\tremoteInfo = SDWebImage;\n\t\t};\n\t\t515CA3968C8D75CEE2C174CF752AA174 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E19F7217AA5D518ED2D03F5DBD9318DE /* SnapKit.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 6913FCF4B90C224E55FE5C821AFB90D2;\n\t\t\tremoteInfo = SnapKit;\n\t\t};\n\t\t556A154513D26F324D5B6296BC0BCF04 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = FBAF30105A714565F2E375AAC158147A /* SQLiteRepairKit.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 1A6A317D19224BA6C654767A5DA5460D;\n\t\t\tremoteInfo = SQLiteRepairKit;\n\t\t};\n\t\t5C992C3ACA732AEBCFBFF28EB96BFC16 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 514DEE95CF54879F0F065FD68F04AF6F /* R.swift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = FF6ED22E1CDAF83ADE98360601DC4DE5;\n\t\t\tremoteInfo = R.swift;\n\t\t};\n\t\t5D0925AC06BF098BA82FACCBEEC72D21 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = CF2B2063A9DEB48D730473BC03C4B9F6 /* WCDBOptimizedSQLCipher.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8820E4661B26990965C45655F51ED18B;\n\t\t\tremoteInfo = WCDBOptimizedSQLCipher;\n\t\t};\n\t\t6D11C13A84D5B7C485A3851E27D6C31B /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = EAF7D9CF742B5974293716634CFEB658 /* Alamofire.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 81B7E9B7CD0CADA087A4BB042FBA92E7;\n\t\t\tremoteInfo = Alamofire;\n\t\t};\n\t\t6E93F34FB70EAEDF8C5B59AC54221BA6 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 7D092B25BF1B9DB2B5DECE236780D189 /* Moya.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 42D4D39F3084C8EA060DE1C283323B37;\n\t\t\tremoteInfo = Moya;\n\t\t};\n\t\t70EC061318C69C673D7B3745D2B4DCDE /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 374284FE69290B23B7ED62FF180A1C71 /* HandyJSON.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 42160F46A22E1CA007076183E782CF4B;\n\t\t\tremoteInfo = HandyJSON;\n\t\t};\n\t\t78550796E8A69A97F34F540E81E61AEB /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E74166EC76A656C80377A9C7631815CC /* YBImageBrowser.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = A13069CD227D6C648A6A2BF33159B4FA;\n\t\t\tremoteInfo = YBImageBrowser;\n\t\t};\n\t\t82FDE8BA4002CA5EA9A25C40FCABCF79 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 499E620EA4999D9FF1E3234277C2CF2A /* MBProgressHUD.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 0F48A71D28991325602E8C8A19DF1F64;\n\t\t\tremoteInfo = MBProgressHUD;\n\t\t};\n\t\t89DB88F1490B277041804DF46504434E /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = D9A216D78F694506A7F33ADF7C6AB76B /* FDFullscreenPopGesture.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = A8BAA0D80184552CA0F0647BF03C3D1B;\n\t\t\tremoteInfo = FDFullscreenPopGesture;\n\t\t};\n\t\t8D0C130FFDEECBB71CA8FA4FAC8DB832 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = D128140CC9E76B5402DC0A1A6F50EAFB /* SwiftyJSON.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = AD1A79042DA54FF6DCBF6C015B0E27B5;\n\t\t\tremoteInfo = SwiftyJSON;\n\t\t};\n\t\t8D1DAC5546C4AB3C02A4050206695DA5 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 10543E34CEFC1213E9B0EB7AA4DF255E /* UIView+FDCollapsibleConstraints.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = F254007166B3EB42A09DBC736355B678;\n\t\t\tremoteInfo = \"UIView+FDCollapsibleConstraints\";\n\t\t};\n\t\t9E3434EE805C22588545C3FDE0209F81 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = A50B9332B0F888D2D5A5DA753F626655 /* YYText.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 40E4DD13C21C218AB8CF84FBB29F3285;\n\t\t\tremoteInfo = YYText;\n\t\t};\n\t\tB116771450CA88BD525EECBFB296E62D /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 9B99FEFC29E8CDDB98C169ACEEA30F06 /* MJRefresh.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = E94AEF767442EDAAAAB2129CDFA2C2ED;\n\t\t\tremoteInfo = MJRefresh;\n\t\t};\n\t\tB3FA85EF66D6498A6F10E79323E5ABCA /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0438DBF2C110FB4EE71FC78F51DDDF6A /* IGListDiffKit.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 9074A5DFB260E6240F743D74D3F432DD;\n\t\t\tremoteInfo = IGListDiffKit;\n\t\t};\n\t\tB9D62E0742962486B4247FDE82DED067 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 1D9901AF1E23811CFB54AEA4ECD942BF /* UITableView+FDTemplateLayoutCell.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = A5CF12962AE63218F7BCE07569CE36DE;\n\t\t\tremoteInfo = \"UITableView+FDTemplateLayoutCell\";\n\t\t};\n\t\tC7C6BBCA61141E4541F59E23A3E90255 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E13BAFCAD1DCB54A76BAB39718907ED5 /* IGListKit.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 6C5D6FE2744F299C4B5885492E7CFF8C;\n\t\t\tremoteInfo = IGListKit;\n\t\t};\n\t\tD5EAA56F1E50EE55FD279F29B2B59634 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = BF81471569EFE4A56814D0A7D1C24EC3 /* Localize-Swift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 6C27EEC63FEC06A9DAB03531B0989F47;\n\t\t\tremoteInfo = \"Localize-Swift\";\n\t\t};\n\t\tDF5B3C1CAE37761B2C05A85CAE10DAB2 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 46C770FB65D3D309792127CFD56FD9B8 /* LookinServer.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 648108237631EEA52299D347ABDCA30C;\n\t\t\tremoteInfo = LookinServer;\n\t\t};\n\t\tE617B6696E88F6BF79E54EE80D8CA84F /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = AF90DD2CA388D1789BAC140781F36FA1 /* SwiftDate.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 084C1733B4DEB4359B4EFB893E424972;\n\t\t\tremoteInfo = SwiftDate;\n\t\t};\n\t\tE93988DDA9311B8385BB8950396A866B /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 80F2A5AD23DCFB1AF4994707D2649ED2 /* NSObject+Rx.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8959B62B3AF892ED95EA44BE841842BD;\n\t\t\tremoteInfo = \"NSObject+Rx\";\n\t\t};\n\t\tEF09737501CBDA7963CF2A90C03DB14D /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 09DDDFAE034F2B7BEBFD89569E59AFFB /* ReachabilitySwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 02AAC45BCBE8F4C196016B6D96C7A992;\n\t\t\tremoteInfo = ReachabilitySwift;\n\t\t};\n\t\tF8A3327D7F399134FE2388E99FAE6543 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 2ACBC9CE9A3FA36127A8E2A104F3FDFB /* RxCocoa.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = BC5183FBB16A06C1D86620B00CFE6269;\n\t\t\tremoteInfo = RxCocoa;\n\t\t};\n\t\tF913E5D1C9AEE1E2A723435FC667138F /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 0A3C1132C414C38CFDBF4556F1A58678 /* IQKeyboardManagerSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 29F73A40F1F145F65BBA049AC76AB585;\n\t\t\tremoteInfo = IQKeyboardManagerSwift;\n\t\t};\n\t\tFFA99A43553494A820BCD3EC55843B14 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = D36D5E926088FE66266C81634BF0A649 /* TZImagePickerController.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 6090C91802307673CBF0A57EF1608978;\n\t\t\tremoteInfo = TZImagePickerController;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t0438DBF2C110FB4EE71FC78F51DDDF6A /* IGListDiffKit */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = IGListDiffKit; path = IGListDiffKit.xcodeproj; sourceTree = \"<group>\"; };\n\t\t09DDDFAE034F2B7BEBFD89569E59AFFB /* ReachabilitySwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = ReachabilitySwift; path = ReachabilitySwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t0A3C1132C414C38CFDBF4556F1A58678 /* IQKeyboardManagerSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = IQKeyboardManagerSwift; path = IQKeyboardManagerSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t0C61FD2BA6F5AA699823B33298FC60CB /* Pods-FY-IMChat-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"Pods-FY-IMChat-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t10543E34CEFC1213E9B0EB7AA4DF255E /* UIView+FDCollapsibleConstraints */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = \"UIView+FDCollapsibleConstraints\"; path = \"UIView+FDCollapsibleConstraints.xcodeproj\"; sourceTree = \"<group>\"; };\n\t\t11BCE9367A626F89920B14671B71FF07 /* WCDB.swift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = WCDB.swift; path = WCDB.swift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t1BB93459E605BC8D21A4FE01CCCA1C0C /* Pods-FY-IMChat-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = \"Pods-FY-IMChat-frameworks.sh\"; sourceTree = \"<group>\"; };\n\t\t1D9901AF1E23811CFB54AEA4ECD942BF /* UITableView+FDTemplateLayoutCell */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = \"UITableView+FDTemplateLayoutCell\"; path = \"UITableView+FDTemplateLayoutCell.xcodeproj\"; sourceTree = \"<group>\"; };\n\t\t2ACBC9CE9A3FA36127A8E2A104F3FDFB /* RxCocoa */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxCocoa; path = RxCocoa.xcodeproj; sourceTree = \"<group>\"; };\n\t\t374284FE69290B23B7ED62FF180A1C71 /* HandyJSON */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = HandyJSON; path = HandyJSON.xcodeproj; sourceTree = \"<group>\"; };\n\t\t46C770FB65D3D309792127CFD56FD9B8 /* LookinServer */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = LookinServer; path = LookinServer.xcodeproj; sourceTree = \"<group>\"; };\n\t\t499E620EA4999D9FF1E3234277C2CF2A /* MBProgressHUD */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = MBProgressHUD; path = MBProgressHUD.xcodeproj; sourceTree = \"<group>\"; };\n\t\t514DEE95CF54879F0F065FD68F04AF6F /* R.swift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = R.swift; path = R.swift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t561081F080F0DA8ABA0C1588011B8FDF /* Pods-FY-IMChat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"Pods-FY-IMChat.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t581C8733EC6B49617C9E986DEC414849 /* Kingfisher */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = Kingfisher; path = Kingfisher.xcodeproj; sourceTree = \"<group>\"; };\n\t\t607F4C3B2B91E2F189EAE1547F5860ED /* Pods-FY-IMChat-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"Pods-FY-IMChat-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t6C40E1643E4BD3784E41115E09146137 /* Pods-FY-IMChat.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = \"Pods-FY-IMChat.modulemap\"; sourceTree = \"<group>\"; };\n\t\t73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t73510C8E62D698B63C49990AA2405BE8 /* Pods-FY-IMChat-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = \"Pods-FY-IMChat-acknowledgements.markdown\"; sourceTree = \"<group>\"; };\n\t\t7C3E7FE59E7584693361B440BF0409A8 /* Pods-FY-IMChat.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"Pods-FY-IMChat.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t7D092B25BF1B9DB2B5DECE236780D189 /* Moya */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = Moya; path = Moya.xcodeproj; sourceTree = \"<group>\"; };\n\t\t80768DA22DD40A31E5CBFB00A0C907E3 /* RxRelay */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxRelay; path = RxRelay.xcodeproj; sourceTree = \"<group>\"; };\n\t\t80F2A5AD23DCFB1AF4994707D2649ED2 /* NSObject+Rx */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = \"NSObject+Rx\"; path = \"NSObject+Rx.xcodeproj\"; sourceTree = \"<group>\"; };\n\t\t857C0E24CF40B7B3DA2BD6FA5647577B /* RxSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxSwift; path = RxSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t98FC81A49A355E0476EF6F20062425D1 /* Pods-FY-IMChat-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"Pods-FY-IMChat-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t9B99FEFC29E8CDDB98C169ACEEA30F06 /* MJRefresh */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = MJRefresh; path = MJRefresh.xcodeproj; sourceTree = \"<group>\"; };\n\t\t9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };\n\t\tA50B9332B0F888D2D5A5DA753F626655 /* YYText */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = YYText; path = YYText.xcodeproj; sourceTree = \"<group>\"; };\n\t\tAA88F6F88491C368B6255613C73CE925 /* Pods-FY-IMChat-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"Pods-FY-IMChat-acknowledgements.plist\"; sourceTree = \"<group>\"; };\n\t\tAF90DD2CA388D1789BAC140781F36FA1 /* SwiftDate */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SwiftDate; path = SwiftDate.xcodeproj; sourceTree = \"<group>\"; };\n\t\tB17FBD4BAE6C8F56AF2C17EBA67635D2 /* R.swift.Library */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = R.swift.Library; path = R.swift.Library.xcodeproj; sourceTree = \"<group>\"; };\n\t\tB2822B632C9B73C1341CAE612EFB90CC /* Pods-FY-IMChat */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = \"Pods-FY-IMChat\"; path = Pods_FY_IMChat.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tBF81471569EFE4A56814D0A7D1C24EC3 /* Localize-Swift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = \"Localize-Swift\"; path = \"Localize-Swift.xcodeproj\"; sourceTree = \"<group>\"; };\n\t\tC52B01BAA3BA7AD7306D321A5D0CA43E /* YYImage */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = YYImage; path = YYImage.xcodeproj; sourceTree = \"<group>\"; };\n\t\tCA7DE2133F5A597608F2965178D3A58B /* SwifterSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SwifterSwift; path = SwifterSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\tCF2B2063A9DEB48D730473BC03C4B9F6 /* WCDBOptimizedSQLCipher */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = WCDBOptimizedSQLCipher; path = WCDBOptimizedSQLCipher.xcodeproj; sourceTree = \"<group>\"; };\n\t\tD128140CC9E76B5402DC0A1A6F50EAFB /* SwiftyJSON */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SwiftyJSON; path = SwiftyJSON.xcodeproj; sourceTree = \"<group>\"; };\n\t\tD36D5E926088FE66266C81634BF0A649 /* TZImagePickerController */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = TZImagePickerController; path = TZImagePickerController.xcodeproj; sourceTree = \"<group>\"; };\n\t\tD9A216D78F694506A7F33ADF7C6AB76B /* FDFullscreenPopGesture */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = FDFullscreenPopGesture; path = FDFullscreenPopGesture.xcodeproj; sourceTree = \"<group>\"; };\n\t\tE13BAFCAD1DCB54A76BAB39718907ED5 /* IGListKit */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = IGListKit; path = IGListKit.xcodeproj; sourceTree = \"<group>\"; };\n\t\tE19F7217AA5D518ED2D03F5DBD9318DE /* SnapKit */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SnapKit; path = SnapKit.xcodeproj; sourceTree = \"<group>\"; };\n\t\tE5D2CCA1CBD9E9DBABE5E4AF29D0256B /* RxTheme */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxTheme; path = RxTheme.xcodeproj; sourceTree = \"<group>\"; };\n\t\tE74166EC76A656C80377A9C7631815CC /* YBImageBrowser */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = YBImageBrowser; path = YBImageBrowser.xcodeproj; sourceTree = \"<group>\"; };\n\t\tEAF7D9CF742B5974293716634CFEB658 /* Alamofire */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = Alamofire; path = Alamofire.xcodeproj; sourceTree = \"<group>\"; };\n\t\tFA089FB2D3E623384DBE92B4E7C61590 /* SDWebImage */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SDWebImage; path = SDWebImage.xcodeproj; sourceTree = \"<group>\"; };\n\t\tFBAF30105A714565F2E375AAC158147A /* SQLiteRepairKit */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SQLiteRepairKit; path = SQLiteRepairKit.xcodeproj; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t9A5A975A9130CA8F6A446E120E4B844F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tAB889899087A022F9CDC807FD8FDD58E /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0C39A08F310CC034632690BEE4EB14EF /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB2822B632C9B73C1341CAE612EFB90CC /* Pods-FY-IMChat */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t35829EBE3BB4C12753FC61D4001AACDA /* Targets Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8E65A30BE3E971541F6A5A9409FBBFA5 /* Pods-FY-IMChat */,\n\t\t\t);\n\t\t\tname = \"Targets Support Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53B0E9973AA05354C2BB6F89AD290C1E /* Pods */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEAF7D9CF742B5974293716634CFEB658 /* Alamofire */,\n\t\t\t\tD9A216D78F694506A7F33ADF7C6AB76B /* FDFullscreenPopGesture */,\n\t\t\t\t374284FE69290B23B7ED62FF180A1C71 /* HandyJSON */,\n\t\t\t\t0438DBF2C110FB4EE71FC78F51DDDF6A /* IGListDiffKit */,\n\t\t\t\tE13BAFCAD1DCB54A76BAB39718907ED5 /* IGListKit */,\n\t\t\t\t0A3C1132C414C38CFDBF4556F1A58678 /* IQKeyboardManagerSwift */,\n\t\t\t\t581C8733EC6B49617C9E986DEC414849 /* Kingfisher */,\n\t\t\t\tBF81471569EFE4A56814D0A7D1C24EC3 /* Localize-Swift */,\n\t\t\t\t46C770FB65D3D309792127CFD56FD9B8 /* LookinServer */,\n\t\t\t\t499E620EA4999D9FF1E3234277C2CF2A /* MBProgressHUD */,\n\t\t\t\t9B99FEFC29E8CDDB98C169ACEEA30F06 /* MJRefresh */,\n\t\t\t\t7D092B25BF1B9DB2B5DECE236780D189 /* Moya */,\n\t\t\t\t80F2A5AD23DCFB1AF4994707D2649ED2 /* NSObject+Rx */,\n\t\t\t\t514DEE95CF54879F0F065FD68F04AF6F /* R.swift */,\n\t\t\t\tB17FBD4BAE6C8F56AF2C17EBA67635D2 /* R.swift.Library */,\n\t\t\t\t09DDDFAE034F2B7BEBFD89569E59AFFB /* ReachabilitySwift */,\n\t\t\t\t2ACBC9CE9A3FA36127A8E2A104F3FDFB /* RxCocoa */,\n\t\t\t\t80768DA22DD40A31E5CBFB00A0C907E3 /* RxRelay */,\n\t\t\t\t857C0E24CF40B7B3DA2BD6FA5647577B /* RxSwift */,\n\t\t\t\tE5D2CCA1CBD9E9DBABE5E4AF29D0256B /* RxTheme */,\n\t\t\t\tFA089FB2D3E623384DBE92B4E7C61590 /* SDWebImage */,\n\t\t\t\tE19F7217AA5D518ED2D03F5DBD9318DE /* SnapKit */,\n\t\t\t\tFBAF30105A714565F2E375AAC158147A /* SQLiteRepairKit */,\n\t\t\t\tAF90DD2CA388D1789BAC140781F36FA1 /* SwiftDate */,\n\t\t\t\tCA7DE2133F5A597608F2965178D3A58B /* SwifterSwift */,\n\t\t\t\tD128140CC9E76B5402DC0A1A6F50EAFB /* SwiftyJSON */,\n\t\t\t\tD36D5E926088FE66266C81634BF0A649 /* TZImagePickerController */,\n\t\t\t\t1D9901AF1E23811CFB54AEA4ECD942BF /* UITableView+FDTemplateLayoutCell */,\n\t\t\t\t10543E34CEFC1213E9B0EB7AA4DF255E /* UIView+FDCollapsibleConstraints */,\n\t\t\t\t11BCE9367A626F89920B14671B71FF07 /* WCDB.swift */,\n\t\t\t\tCF2B2063A9DEB48D730473BC03C4B9F6 /* WCDBOptimizedSQLCipher */,\n\t\t\t\tE74166EC76A656C80377A9C7631815CC /* YBImageBrowser */,\n\t\t\t\tC52B01BAA3BA7AD7306D321A5D0CA43E /* YYImage */,\n\t\t\t\tA50B9332B0F888D2D5A5DA753F626655 /* YYText */,\n\t\t\t);\n\t\t\tname = Pods;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t578452D2E740E91742655AC8F1636D1F /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8E65A30BE3E971541F6A5A9409FBBFA5 /* Pods-FY-IMChat */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6C40E1643E4BD3784E41115E09146137 /* Pods-FY-IMChat.modulemap */,\n\t\t\t\t73510C8E62D698B63C49990AA2405BE8 /* Pods-FY-IMChat-acknowledgements.markdown */,\n\t\t\t\tAA88F6F88491C368B6255613C73CE925 /* Pods-FY-IMChat-acknowledgements.plist */,\n\t\t\t\t0C61FD2BA6F5AA699823B33298FC60CB /* Pods-FY-IMChat-dummy.m */,\n\t\t\t\t1BB93459E605BC8D21A4FE01CCCA1C0C /* Pods-FY-IMChat-frameworks.sh */,\n\t\t\t\t607F4C3B2B91E2F189EAE1547F5860ED /* Pods-FY-IMChat-Info.plist */,\n\t\t\t\t98FC81A49A355E0476EF6F20062425D1 /* Pods-FY-IMChat-umbrella.h */,\n\t\t\t\t7C3E7FE59E7584693361B440BF0409A8 /* Pods-FY-IMChat.debug.xcconfig */,\n\t\t\t\t561081F080F0DA8ABA0C1588011B8FDF /* Pods-FY-IMChat.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Pods-FY-IMChat\";\n\t\t\tpath = \"Target Support Files/Pods-FY-IMChat\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCF1408CF629C7361332E53B88F7BD30C = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t9D940727FF8FB9C785EB98E56350EF41 /* Podfile */,\n\t\t\t\tD210D550F4EA176C3123ED886F8F87F5 /* Frameworks */,\n\t\t\t\t53B0E9973AA05354C2BB6F89AD290C1E /* Pods */,\n\t\t\t\t0C39A08F310CC034632690BEE4EB14EF /* Products */,\n\t\t\t\t35829EBE3BB4C12753FC61D4001AACDA /* Targets Support Files */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD210D550F4EA176C3123ED886F8F87F5 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t578452D2E740E91742655AC8F1636D1F /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t7BF3C67E7CE338E84571CCC495C056D3 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tF45523F3401BB4CA0CB62234B6205D3A /* Pods-FY-IMChat-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t7394B44837E9030821120642706837CD /* Pods-FY-IMChat */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E885209C405A81CB7F3B05CEED29662E /* Build configuration list for PBXNativeTarget \"Pods-FY-IMChat\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t7BF3C67E7CE338E84571CCC495C056D3 /* Headers */,\n\t\t\t\t7A47863E30B7CCED86A168314FF71521 /* Sources */,\n\t\t\t\t9A5A975A9130CA8F6A446E120E4B844F /* Frameworks */,\n\t\t\t\tD27ACF4C42F532800C4161C08388526A /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t4ABD7FE1017F402FD2489137159A4919 /* PBXTargetDependency */,\n\t\t\t\tA5DF7A3B8C7FE020FF127BA5F0EBFF77 /* PBXTargetDependency */,\n\t\t\t\tC319839666DE0DAC31D627A95874EC14 /* PBXTargetDependency */,\n\t\t\t\t837433F707F97A0E488D560144C59412 /* PBXTargetDependency */,\n\t\t\t\tCEE4D8572E1848FEED3FD8AE36934ABA /* PBXTargetDependency */,\n\t\t\t\t2A71AEFDC8C50A610ACD43F383DCB162 /* PBXTargetDependency */,\n\t\t\t\tC60C0B6E4EEABCA7F78AEF0E8EE8B052 /* PBXTargetDependency */,\n\t\t\t\t74890EBBDA8BF24181A654E540E2CB31 /* PBXTargetDependency */,\n\t\t\t\tE0195A72AA40DA30C91C7B637ABE0C82 /* PBXTargetDependency */,\n\t\t\t\t6C877032B4FF9440AE9EA9554A10E4EE /* PBXTargetDependency */,\n\t\t\t\t7B34F4F8BF792B699A636594A1F2ED8C /* PBXTargetDependency */,\n\t\t\t\t70306294EE6F0F32D999B8CF86C34E78 /* PBXTargetDependency */,\n\t\t\t\t8ABCF92BB74D229B3FD6B5D97AFD5936 /* PBXTargetDependency */,\n\t\t\t\t2A158B5869F39181E0AD6808311AF40C /* PBXTargetDependency */,\n\t\t\t\tC42C582C55336AB8D3FAC94BFEC3C469 /* PBXTargetDependency */,\n\t\t\t\t58322AA353B72A30C74C3930A97C1C75 /* PBXTargetDependency */,\n\t\t\t\tDD818123A4461F7628D1266E9F85A40B /* PBXTargetDependency */,\n\t\t\t\t381D9D805D4EC8B97ABA0B1A00E0FF2E /* PBXTargetDependency */,\n\t\t\t\t83C987B3610025033541CDF14C0D9623 /* PBXTargetDependency */,\n\t\t\t\t3944C46835A0A64B5D07415E6C3BC503 /* PBXTargetDependency */,\n\t\t\t\t2F1FDC8D9F185F6420C7420607259EBE /* PBXTargetDependency */,\n\t\t\t\tB9D96AAC085423C5A960C025DC9C56FA /* PBXTargetDependency */,\n\t\t\t\t00FC4471B64A3AAA7F20B084271FAD2F /* PBXTargetDependency */,\n\t\t\t\tC46A1F437E0E06DFC05C76A2217ACA85 /* PBXTargetDependency */,\n\t\t\t\t437C95191B6121D44F33352D78506090 /* PBXTargetDependency */,\n\t\t\t\t8D3AE9674B22F455C8DA6644BB9D73E0 /* PBXTargetDependency */,\n\t\t\t\t0929409EEF98DEF97A2DCADAB5CB6A1A /* PBXTargetDependency */,\n\t\t\t\t8CAC0DC656DEDC926C69CEE8B14074A6 /* PBXTargetDependency */,\n\t\t\t\tD3F6FBF11E7136888E9C42DA1D5BE7DB /* PBXTargetDependency */,\n\t\t\t\t0C7AE0F2D7942D11D9D8DA15A18C9F50 /* PBXTargetDependency */,\n\t\t\t\t458E77858CB03B88A00B12BD69B8EC21 /* PBXTargetDependency */,\n\t\t\t\t0C7F2C4FE236F9D69728EB2B8F373783 /* PBXTargetDependency */,\n\t\t\t\tA0D3AB8ADFF5FA70CD19CB5205A98645 /* PBXTargetDependency */,\n\t\t\t\tC3D84EDE1633317CB1A5805352FD2F7E /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"Pods-FY-IMChat\";\n\t\t\tproductName = Pods_FY_IMChat;\n\t\t\tproductReference = B2822B632C9B73C1341CAE612EFB90CC /* Pods-FY-IMChat */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tBFDFE7DC352907FC980B868725387E98 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject \"Pods\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = CF1408CF629C7361332E53B88F7BD30C;\n\t\t\tproductRefGroup = 0C39A08F310CC034632690BEE4EB14EF /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = EAF7D9CF742B5974293716634CFEB658 /* Alamofire */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = D9A216D78F694506A7F33ADF7C6AB76B /* FDFullscreenPopGesture */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 374284FE69290B23B7ED62FF180A1C71 /* HandyJSON */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 0438DBF2C110FB4EE71FC78F51DDDF6A /* IGListDiffKit */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = E13BAFCAD1DCB54A76BAB39718907ED5 /* IGListKit */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 0A3C1132C414C38CFDBF4556F1A58678 /* IQKeyboardManagerSwift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 581C8733EC6B49617C9E986DEC414849 /* Kingfisher */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = BF81471569EFE4A56814D0A7D1C24EC3 /* Localize-Swift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 46C770FB65D3D309792127CFD56FD9B8 /* LookinServer */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 499E620EA4999D9FF1E3234277C2CF2A /* MBProgressHUD */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 9B99FEFC29E8CDDB98C169ACEEA30F06 /* MJRefresh */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 7D092B25BF1B9DB2B5DECE236780D189 /* Moya */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 80F2A5AD23DCFB1AF4994707D2649ED2 /* NSObject+Rx */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 514DEE95CF54879F0F065FD68F04AF6F /* R.swift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = B17FBD4BAE6C8F56AF2C17EBA67635D2 /* R.swift.Library */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 09DDDFAE034F2B7BEBFD89569E59AFFB /* ReachabilitySwift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 2ACBC9CE9A3FA36127A8E2A104F3FDFB /* RxCocoa */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 80768DA22DD40A31E5CBFB00A0C907E3 /* RxRelay */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 857C0E24CF40B7B3DA2BD6FA5647577B /* RxSwift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = E5D2CCA1CBD9E9DBABE5E4AF29D0256B /* RxTheme */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = FA089FB2D3E623384DBE92B4E7C61590 /* SDWebImage */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = FBAF30105A714565F2E375AAC158147A /* SQLiteRepairKit */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = E19F7217AA5D518ED2D03F5DBD9318DE /* SnapKit */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = AF90DD2CA388D1789BAC140781F36FA1 /* SwiftDate */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = CA7DE2133F5A597608F2965178D3A58B /* SwifterSwift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = D128140CC9E76B5402DC0A1A6F50EAFB /* SwiftyJSON */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = D36D5E926088FE66266C81634BF0A649 /* TZImagePickerController */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 1D9901AF1E23811CFB54AEA4ECD942BF /* UITableView+FDTemplateLayoutCell */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 10543E34CEFC1213E9B0EB7AA4DF255E /* UIView+FDCollapsibleConstraints */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 11BCE9367A626F89920B14671B71FF07 /* WCDB.swift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = CF2B2063A9DEB48D730473BC03C4B9F6 /* WCDBOptimizedSQLCipher */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = E74166EC76A656C80377A9C7631815CC /* YBImageBrowser */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = C52B01BAA3BA7AD7306D321A5D0CA43E /* YYImage */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = A50B9332B0F888D2D5A5DA753F626655 /* YYText */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t7394B44837E9030821120642706837CD /* Pods-FY-IMChat */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tD27ACF4C42F532800C4161C08388526A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t7A47863E30B7CCED86A168314FF71521 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t59659CE0366CC5E00255421847A4D9E5 /* Pods-FY-IMChat-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t00FC4471B64A3AAA7F20B084271FAD2F /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SnapKit;\n\t\t\ttargetProxy = 515CA3968C8D75CEE2C174CF752AA174 /* PBXContainerItemProxy */;\n\t\t};\n\t\t0929409EEF98DEF97A2DCADAB5CB6A1A /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = TZImagePickerController;\n\t\t\ttargetProxy = FFA99A43553494A820BCD3EC55843B14 /* PBXContainerItemProxy */;\n\t\t};\n\t\t0C7AE0F2D7942D11D9D8DA15A18C9F50 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = WCDB.swift;\n\t\t\ttargetProxy = 3E9D67A07F0A886FF6004CA2144BF4DF /* PBXContainerItemProxy */;\n\t\t};\n\t\t0C7F2C4FE236F9D69728EB2B8F373783 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = YBImageBrowser;\n\t\t\ttargetProxy = 78550796E8A69A97F34F540E81E61AEB /* PBXContainerItemProxy */;\n\t\t};\n\t\t2A158B5869F39181E0AD6808311AF40C /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = R.swift;\n\t\t\ttargetProxy = 5C992C3ACA732AEBCFBFF28EB96BFC16 /* PBXContainerItemProxy */;\n\t\t};\n\t\t2A71AEFDC8C50A610ACD43F383DCB162 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = IQKeyboardManagerSwift;\n\t\t\ttargetProxy = F913E5D1C9AEE1E2A723435FC667138F /* PBXContainerItemProxy */;\n\t\t};\n\t\t2F1FDC8D9F185F6420C7420607259EBE /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SDWebImage;\n\t\t\ttargetProxy = 4730D86AD92E3133810CDADE979D323E /* PBXContainerItemProxy */;\n\t\t};\n\t\t381D9D805D4EC8B97ABA0B1A00E0FF2E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxRelay;\n\t\t\ttargetProxy = 38C8E84E0C6BC9A02E472775186B8674 /* PBXContainerItemProxy */;\n\t\t};\n\t\t3944C46835A0A64B5D07415E6C3BC503 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxTheme;\n\t\t\ttargetProxy = 20E4979136D7BEF8A2A2246AF45C3095 /* PBXContainerItemProxy */;\n\t\t};\n\t\t437C95191B6121D44F33352D78506090 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SwifterSwift;\n\t\t\ttargetProxy = 179EE28B34EF9DFDDE20E7557E721E93 /* PBXContainerItemProxy */;\n\t\t};\n\t\t458E77858CB03B88A00B12BD69B8EC21 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = WCDBOptimizedSQLCipher;\n\t\t\ttargetProxy = 5D0925AC06BF098BA82FACCBEEC72D21 /* PBXContainerItemProxy */;\n\t\t};\n\t\t4ABD7FE1017F402FD2489137159A4919 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = Alamofire;\n\t\t\ttargetProxy = 6D11C13A84D5B7C485A3851E27D6C31B /* PBXContainerItemProxy */;\n\t\t};\n\t\t58322AA353B72A30C74C3930A97C1C75 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = ReachabilitySwift;\n\t\t\ttargetProxy = EF09737501CBDA7963CF2A90C03DB14D /* PBXContainerItemProxy */;\n\t\t};\n\t\t6C877032B4FF9440AE9EA9554A10E4EE /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = MBProgressHUD;\n\t\t\ttargetProxy = 82FDE8BA4002CA5EA9A25C40FCABCF79 /* PBXContainerItemProxy */;\n\t\t};\n\t\t70306294EE6F0F32D999B8CF86C34E78 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = Moya;\n\t\t\ttargetProxy = 6E93F34FB70EAEDF8C5B59AC54221BA6 /* PBXContainerItemProxy */;\n\t\t};\n\t\t74890EBBDA8BF24181A654E540E2CB31 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = \"Localize-Swift\";\n\t\t\ttargetProxy = D5EAA56F1E50EE55FD279F29B2B59634 /* PBXContainerItemProxy */;\n\t\t};\n\t\t7B34F4F8BF792B699A636594A1F2ED8C /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = MJRefresh;\n\t\t\ttargetProxy = B116771450CA88BD525EECBFB296E62D /* PBXContainerItemProxy */;\n\t\t};\n\t\t837433F707F97A0E488D560144C59412 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = IGListDiffKit;\n\t\t\ttargetProxy = B3FA85EF66D6498A6F10E79323E5ABCA /* PBXContainerItemProxy */;\n\t\t};\n\t\t83C987B3610025033541CDF14C0D9623 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxSwift;\n\t\t\ttargetProxy = 2729CC999F664F831C5427C679442B70 /* PBXContainerItemProxy */;\n\t\t};\n\t\t8ABCF92BB74D229B3FD6B5D97AFD5936 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = \"NSObject+Rx\";\n\t\t\ttargetProxy = E93988DDA9311B8385BB8950396A866B /* PBXContainerItemProxy */;\n\t\t};\n\t\t8CAC0DC656DEDC926C69CEE8B14074A6 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = \"UITableView+FDTemplateLayoutCell\";\n\t\t\ttargetProxy = B9D62E0742962486B4247FDE82DED067 /* PBXContainerItemProxy */;\n\t\t};\n\t\t8D3AE9674B22F455C8DA6644BB9D73E0 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SwiftyJSON;\n\t\t\ttargetProxy = 8D0C130FFDEECBB71CA8FA4FAC8DB832 /* PBXContainerItemProxy */;\n\t\t};\n\t\tA0D3AB8ADFF5FA70CD19CB5205A98645 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = YYImage;\n\t\t\ttargetProxy = 34A4839299095B0C0EC28D32E1EA8631 /* PBXContainerItemProxy */;\n\t\t};\n\t\tA5DF7A3B8C7FE020FF127BA5F0EBFF77 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = FDFullscreenPopGesture;\n\t\t\ttargetProxy = 89DB88F1490B277041804DF46504434E /* PBXContainerItemProxy */;\n\t\t};\n\t\tB9D96AAC085423C5A960C025DC9C56FA /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SQLiteRepairKit;\n\t\t\ttargetProxy = 556A154513D26F324D5B6296BC0BCF04 /* PBXContainerItemProxy */;\n\t\t};\n\t\tC319839666DE0DAC31D627A95874EC14 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = HandyJSON;\n\t\t\ttargetProxy = 70EC061318C69C673D7B3745D2B4DCDE /* PBXContainerItemProxy */;\n\t\t};\n\t\tC3D84EDE1633317CB1A5805352FD2F7E /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = YYText;\n\t\t\ttargetProxy = 9E3434EE805C22588545C3FDE0209F81 /* PBXContainerItemProxy */;\n\t\t};\n\t\tC42C582C55336AB8D3FAC94BFEC3C469 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = R.swift.Library;\n\t\t\ttargetProxy = 27A7FA3CF9A7F44C66A4CBA3B3BABEA1 /* PBXContainerItemProxy */;\n\t\t};\n\t\tC46A1F437E0E06DFC05C76A2217ACA85 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SwiftDate;\n\t\t\ttargetProxy = E617B6696E88F6BF79E54EE80D8CA84F /* PBXContainerItemProxy */;\n\t\t};\n\t\tC60C0B6E4EEABCA7F78AEF0E8EE8B052 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = Kingfisher;\n\t\t\ttargetProxy = 2BD3BFA0F60EC170B8BD78DF4A02BF73 /* PBXContainerItemProxy */;\n\t\t};\n\t\tCEE4D8572E1848FEED3FD8AE36934ABA /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = IGListKit;\n\t\t\ttargetProxy = C7C6BBCA61141E4541F59E23A3E90255 /* PBXContainerItemProxy */;\n\t\t};\n\t\tD3F6FBF11E7136888E9C42DA1D5BE7DB /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = \"UIView+FDCollapsibleConstraints\";\n\t\t\ttargetProxy = 8D1DAC5546C4AB3C02A4050206695DA5 /* PBXContainerItemProxy */;\n\t\t};\n\t\tDD818123A4461F7628D1266E9F85A40B /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxCocoa;\n\t\t\ttargetProxy = F8A3327D7F399134FE2388E99FAE6543 /* PBXContainerItemProxy */;\n\t\t};\n\t\tE0195A72AA40DA30C91C7B637ABE0C82 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = LookinServer;\n\t\t\ttargetProxy = DF5B3C1CAE37761B2C05A85CAE10DAB2 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2B9E26EAE2CD392AD762421F663075A1 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t63FAF33E1C55B71A5F5A8B3CC8749F99 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD888A6EFDDE7368AD5C0AE529C8B26B3 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 561081F080F0DA8ABA0C1588011B8FDF /* Pods-FY-IMChat.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMACH_O_TYPE = staticlib;\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat.modulemap\";\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tOTHER_LIBTOOLFLAGS = \"\";\n\t\t\t\tPODS_ROOT = \"$(SRCROOT)\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEC829709B58FDA79E74C857A0A3AC401 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7C3E7FE59E7584693361B440BF0409A8 /* Pods-FY-IMChat.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMACH_O_TYPE = staticlib;\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat.modulemap\";\n\t\t\t\tOTHER_LDFLAGS = \"\";\n\t\t\t\tOTHER_LIBTOOLFLAGS = \"\";\n\t\t\t\tPODS_ROOT = \"$(SRCROOT)\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME:c99extidentifier)\";\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject \"Pods\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2B9E26EAE2CD392AD762421F663075A1 /* Debug */,\n\t\t\t\t63FAF33E1C55B71A5F5A8B3CC8749F99 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE885209C405A81CB7F3B05CEED29662E /* Build configuration list for PBXNativeTarget \"Pods-FY-IMChat\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEC829709B58FDA79E74C857A0A3AC401 /* Debug */,\n\t\t\t\tD888A6EFDDE7368AD5C0AE529C8B26B3 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift/License",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014-2020 Mathijs Kadijk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/ColorResource.swift",
    "content": "//\n//  ColorResource.swift\n//  R.swift.Library\n//\n//  Created by Tom Lokhorst on 2016-03-13.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic protocol ColorResourceType {\n\n  /// Bundle this color is in\n  var bundle: Bundle { get }\n\n  /// Name of the color\n  var name: String { get }\n}\n\npublic struct ColorResource: ColorResourceType {\n\n  /// Bundle this color is in\n  public let bundle: Bundle\n\n  /// Name of the color\n  public let name: String\n\n  public init(bundle: Bundle, name: String) {\n    self.bundle = bundle\n    self.name = name\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/FileResource.swift",
    "content": "//\n//  FileResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 06-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic protocol FileResourceType {\n\n  /// Bundle this file is in\n  var bundle: Bundle { get }\n\n  /// Name of the file file on disk\n  var name: String { get }\n\n  /// Extension of the file on disk\n  var pathExtension: String { get }\n}\n\npublic extension FileResourceType {\n  /// Name of the file on disk with the pathExtension\n  var fullName: String {\n    return [name, pathExtension].joined(separator: \".\")\n  }\n\n  /**\n   Returns the full pathname for this resource.\n\n   - returns: The full pathname for this resource or nil if the file could not be located.\n   */\n  func path() -> String? {\n    return bundle.path(forResource: self)\n  }\n\n  /**\n   Returns the file URL for this resource.\n\n   - returns: The file URL for this resource or nil if the file could not be located.\n   */\n  func url() -> URL? {\n    return bundle.url(forResource: self)\n  }\n}\n\npublic struct FileResource: FileResourceType {\n  /// Bundle this file is in\n  public let bundle: Bundle\n\n  /// Name of the file on disk, without the pathExtension\n  public let name: String\n\n  /// Extension of the file on disk\n  public let pathExtension: String\n\n  public init(bundle: Bundle, name: String, pathExtension: String) {\n    self.bundle = bundle\n    self.name = name\n    self.pathExtension = pathExtension\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/FontResource.swift",
    "content": "//\n//  FontResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 06-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic protocol FontResourceType {\n  /// Name of the font\n  var fontName: String { get }\n}\n\npublic struct FontResource: FontResourceType {\n  /// Name of the font\n  public let fontName: String\n\n  public init(fontName: String) {\n    self.fontName = fontName\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/Identifier.swift",
    "content": "//\n//  Identifier.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\n/// Base protocol for all identifiers\npublic protocol IdentifierType: CustomStringConvertible {\n  /// Identifier string\n  var identifier: String { get }\n}\n\nextension IdentifierType {\n  /// CustomStringConvertible implementation, returns the identifier\n  public var description: String {\n    return identifier\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/ImageResource.swift",
    "content": "//\n//  ImageResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 11-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic protocol ImageResourceType {\n\n  /// Bundle this image is in\n  var bundle: Bundle { get }\n\n  /// Name of the image\n  var name: String { get }\n}\n\npublic struct ImageResource: ImageResourceType {\n\n  /// Bundle this image is in\n  public let bundle: Bundle\n\n  /// Name of the image\n  public let name: String\n\n  public init(bundle: Bundle, name: String) {\n    self.bundle = bundle\n    self.name = name\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/NibResource.swift",
    "content": "//\n//  NibResource.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\n/// Represents a nib file on disk\npublic protocol NibResourceType {\n\n  /// Bundle this nib is in or nil for main bundle\n  var bundle: Bundle { get }\n\n  /// Name of the nib file on disk\n  var name: String { get }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/ReuseIdentifierProtocol.swift",
    "content": "//\n//  ReuseIdentifierProtocol.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\n/// Reuse identifier protocol\npublic protocol ReuseIdentifierType: IdentifierType {\n  /// Type of this reuseable\n  associatedtype ReusableType\n}\n\n/// Reuse identifier\npublic struct ReuseIdentifier<Reusable>: ReuseIdentifierType {\n  /// Type of this reuseable\n  public typealias ReusableType = Reusable\n\n  /// String identifier of this reusable\n  public let identifier: String\n\n  /**\n   Create a new ReuseIdentifier based on the string identifier\n   \n   - parameter identifier: The string identifier for this reusable\n\n   - returns: A new ReuseIdentifier\n  */\n  public init(identifier: String) {\n    self.identifier = identifier\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/StoryboardResource.swift",
    "content": "//\n//  StoryboardResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 07-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic protocol StoryboardResourceType {\n\n  /// Bundle this storyboard is in\n  var bundle: Bundle { get }\n\n  /// Name of the storyboard file on disk\n  var name: String { get }\n}\n\npublic protocol StoryboardResourceWithInitialControllerType: StoryboardResourceType {\n\n  /// Type of the inital controller\n  associatedtype InitialController\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/StoryboardSegueIdentifierProtocol.swift",
    "content": "//\n//  StoryboardSegueIdentifierProtocol.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\n/// Segue identifier protocol\npublic protocol StoryboardSegueIdentifierType: IdentifierType {\n  /// Type of the segue itself\n  associatedtype SegueType\n\n  /// Type of the source view controller\n  associatedtype SourceType\n\n  /// Type of the destination view controller\n  associatedtype DestinationType\n}\n\n/// Segue identifier\npublic struct StoryboardSegueIdentifier<Segue, Source, Destination>: StoryboardSegueIdentifierType {\n  /// Type of the segue itself\n  public typealias SegueType = Segue\n\n  /// Type of the source view controller\n  public typealias SourceType = Source\n\n  /// Type of the destination view controller\n  public typealias DestinationType = Destination\n\n  /// Identifier string of this segue\n  public let identifier: String\n\n  /**\n   Create a new identifier based on the identifier string\n   \n   - returns: A new StoryboardSegueIdentifier\n  */\n  public init(identifier: String) {\n    self.identifier = identifier\n  }\n\n  /// Create a new StoryboardSegue based on the identifier and source view controller\n  public func storyboardSegue(withSource source: Source)\n    -> StoryboardSegue<Segue, Source, Destination>\n  {\n    return StoryboardSegue(identifier: self, source: source)\n  }\n}\n\n/// Typed segue information\npublic struct TypedStoryboardSegueInfo<Segue, Source, Destination>: StoryboardSegueIdentifierType {\n  /// Type of the segue itself\n  public typealias SegueType = Segue\n\n  /// Type of the source view controller\n  public typealias SourceType = Source\n\n  /// Type of the destination view controller\n  public typealias DestinationType = Destination\n\n  /// Segue destination view controller\n  public let destination: Destination\n\n  /// Segue identifier\n  public let identifier: String\n\n  /// The original segue\n  public let segue: Segue\n\n  /// Segue source view controller\n  public let source: Source\n}\n\n/// Segue with identifier and source view controller\npublic struct StoryboardSegue<Segue, Source, Destination> {\n  /// Identifier of this segue\n  public let identifier: StoryboardSegueIdentifier<Segue, Source, Destination>\n\n  /// Segue source view controller\n  public let source: Source\n\n  /**\n   Create a new segue based on the identifier and source view controller\n\n   - returns: A new StoryboardSegue\n   */\n  public init(identifier: StoryboardSegueIdentifier<Segue, Source, Destination>, source: Source) {\n    self.identifier = identifier\n    self.source = source\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/StoryboardViewControllerResource.swift",
    "content": "//\n//  StoryboardViewControllerResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 13-03-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic protocol StoryboardViewControllerResourceType: IdentifierType {\n  associatedtype ViewControllerType\n}\n\npublic struct StoryboardViewControllerResource<ViewController>: StoryboardViewControllerResourceType {\n  public typealias ViewControllerType = ViewController\n\n  /// Storyboard identifier of this view controller\n  public let identifier: String\n\n  public init(identifier: String) {\n    self.identifier = identifier\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/StringResource.swift",
    "content": "//\n//  StringResource.swift\n//  R.swift.Library\n//\n//  Created by Tom Lokhorst on 2016-04-23.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic protocol StringResourceType {\n\n  /// Key for the string\n  var key: String { get }\n\n  /// File in containing the string\n  var tableName: String { get }\n\n  /// Bundle this string is in\n  var bundle: Bundle { get }\n\n  /// Locales of the a localizable string\n  var locales: [String] { get }\n  \n  /// Comment directly before and/or after the string, if any\n  var comment: String? { get }\n}\n\npublic struct StringResource: StringResourceType {\n\n  /// Key for the string\n  public let key: String\n\n  /// File in containing the string\n  public let tableName: String\n\n  /// Bundle this string is in\n  public let bundle: Bundle\n\n  /// Locales of the a localizable string\n  public let locales: [String]\n  \n  /// Comment directly before and/or after the string, if any\n  public let comment: String?\n\n  public init(key: String, tableName: String, bundle: Bundle, locales: [String], comment: String?) {\n    self.key = key\n    self.tableName = tableName\n    self.bundle = bundle\n    self.locales = locales\n    self.comment = comment\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Core/Validatable.swift",
    "content": "//\n//  Validatable.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 17-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\n/// Error thrown during validation\npublic struct ValidationError: Error, CustomStringConvertible {\n  /// Human readable description\n  public let description: String\n\n  public init(description: String) {\n    self.description = description\n  }\n}\n\npublic protocol Validatable {\n  /**\n   Validates this entity and throws if it encounters an invalid situation, a validatable should also validate it sub-validatables if it has any.\n\n   - throws: If there the configuration error a ValidationError is thrown\n   */\n  static func validate() throws\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Foundation/Bundle+FileResource.swift",
    "content": "//\n//  Bundle+FileResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 10-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic extension Bundle {\n  /**\n   Returns the file URL for the given resource (R.file.*).\n\n   - parameter resource: The resource to get the file URL for (R.file.*).\n\n   - returns: The file URL for the resource file (R.file.*) or nil if the file could not be located.\n   */\n  func url(forResource resource: FileResourceType) -> URL? {\n    return url(forResource: resource.name, withExtension: resource.pathExtension)\n  }\n\n  /**\n   Returns the full pathname for the resource (R.file.*).\n\n   - parameter resource: The resource file to get the path for (R.file.*).\n\n   - returns: The full pathname for the resource file (R.file.*) or nil if the file could not be located.\n   */\n  func path(forResource resource: FileResourceType) -> String? {\n    return path(forResource: resource.name, ofType: resource.pathExtension)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/Foundation/Data+FileResource.swift",
    "content": "//\n//  Data+FileResource.swift\n//  R.swift.Library\n//\n//  Created by Tom Lokhorst on 2016-03-11.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\n\npublic struct NoUrlForResourceError: Error {}\n\npublic extension Data {\n\n  /**\n   Creates and returns NSData with the contents of the specified file resource (R.file.*).\n\n   - parameter resource: The file resource (R.file.*)\n\n   - returns: A NSData object with the contents of the specified file.\n   */\n  init(resource: FileResourceType) throws {\n    guard let url = resource.url() else { throw NoUrlForResourceError() }\n    try self.init(contentsOf: url)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/NibResource+UIKit.swift",
    "content": "//\n//  NibResource+UIKit.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 06-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic extension NibResourceType {\n  /**\n   Instantiate the nib to get the top-level objects from this nib\n\n   - parameter ownerOrNil: The owner, if the owner parameter is nil, connections to File's Owner are not permitted.\n   - parameter options: Options are identical to the options specified with -[NSBundle loadNibNamed:owner:options:]\n\n   - returns: An array containing the top-level objects from the NIB\n   */\n  func instantiate(withOwner ownerOrNil: Any?, options optionsOrNil: [UINib.OptionsKey : Any]? = [:]) -> [Any] {\n    return UINib(resource: self).instantiate(withOwner: ownerOrNil, options: optionsOrNil)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/StoryboardResourceWithInitialController+UIKit.swift",
    "content": "//\n//  StoryboardResourceWithInitialController+UIKit.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 07-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic extension StoryboardResourceWithInitialControllerType {\n  /**\n   Instantiates and returns the initial view controller in the view controller graph.\n\n   - returns: The initial view controller in the storyboard.\n   */\n  func instantiateInitialViewController() -> InitialController? {\n    return UIStoryboard(resource: self).instantiateInitialViewController() as? InitialController\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/TypedStoryboardSegueInfo+UIStoryboardSegue.swift",
    "content": "//\n//  TypedStoryboardSegueInfo+UIStoryboardSegue.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\nextension TypedStoryboardSegueInfo {\n  /**\n   Returns typed information about the given segue, fails if the segue types don't exactly match types.\n   \n   - returns: A newly initialized TypedStoryboardSegueInfo object or nil.\n  */\n  public init?<SegueIdentifier: StoryboardSegueIdentifierType>(segueIdentifier: SegueIdentifier, segue: UIStoryboardSegue)\n    where SegueIdentifier.SegueType == Segue, SegueIdentifier.SourceType == Source, SegueIdentifier.DestinationType == Destination\n  {\n    guard let identifier = segue.identifier,\n      let source = segue.source as? SegueIdentifier.SourceType,\n      let destination = segue.destination as? SegueIdentifier.DestinationType,\n      let segue = segue as? SegueIdentifier.SegueType, identifier == segueIdentifier.identifier\n    else {\n      return nil\n    }\n\n    self.segue = segue\n    self.identifier = identifier\n    self.source = source\n    self.destination = destination\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UICollectionView+ReuseIdentifierProtocol.swift",
    "content": "//\n//  UICollectionView+ReuseIdentifierProtocol.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic extension UICollectionView {\n  /**\n   Returns a typed reusable cell object located by its identifier\n   \n   - parameter identifier: The R.reuseIdentifier.* value for the specified cell.\n   - parameter indexPath: The index path specifying the location of the cell. The data source receives this information when it is asked for the cell and should just pass it along. This method uses the index path to perform additional configuration based on the cell’s position in the collection view.\n   \n   - returns: A subclass of UICollectionReusableView or nil if the cast fails.\n  */\n  func dequeueReusableCell<Identifier: ReuseIdentifierType>(withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType?\n    where Identifier.ReusableType: UICollectionReusableView\n  {\n    return dequeueReusableCell(withReuseIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType\n  }\n\n  /**\n   Returns a typed reusable supplementary view located by its identifier and kind.\n   \n   - parameter elementKind: The kind of supplementary view to retrieve. This value is defined by the layout object.\n   - parameter identifier: The R.reuseIdentifier.* value for the specified view.\n   - parameter indexPath: The index path specifying the location of the cell. The data source receives this information when it is asked for the cell and should just pass it along. This method uses the index path to perform additional configuration based on the cell’s position in the collection view.\n   \n   - returns: A subclass of UICollectionReusableView or nil if the cast fails.\n  */\n  func dequeueReusableSupplementaryView<Identifier: ReuseIdentifierType>(ofKind elementKind: String, withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType?\n    where Identifier.ReusableType: UICollectionReusableView\n  {\n    return dequeueReusableSupplementaryView(ofKind: elementKind, withReuseIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType\n  }\n\n  /**\n   Register a R.nib.* for use in creating new collection view cells.\n\n   - parameter nibResource: A nib resource (R.nib.*) containing a object of type UICollectionViewCell that has a reuse identifier\n   */\n  func register<Resource: NibResourceType & ReuseIdentifierType>(_ nibResource: Resource)\n    where Resource.ReusableType: UICollectionViewCell\n  {\n    register(UINib(resource: nibResource), forCellWithReuseIdentifier: nibResource.identifier)\n  }\n\n  /**\n   Register a R.nib.* for use in creating supplementary views for the collection view.\n\n   - parameter nibResource: A nib resource (R.nib.*) containing a object of type UICollectionReusableView. that has a reuse identifier\n   */\n  func register<Resource: NibResourceType & ReuseIdentifierType>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String)\n    where Resource.ReusableType: UICollectionReusableView\n  {\n    register(UINib(resource: nibResource), forSupplementaryViewOfKind: kind, withReuseIdentifier: nibResource.identifier)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UIColor+ColorResource.swift",
    "content": "//\n//  UIColor+ColorResource.swift\n//  R.swift.Library\n//\n//  Created by Tom Lokhorst on 2017-06-06.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport UIKit\n\n@available(iOS 11.0, *)\n@available(tvOS 11.0, *)\npublic extension UIColor {\n\n  #if os(iOS) || os(tvOS)\n  /**\n   Returns the color from this resource (R.color.*) that is compatible with the trait collection.\n\n   - parameter resource: The resource you want the image of (R.color.*)\n   - parameter traitCollection: Traits that describe the desired color to retrieve, pass nil to use traits that describe the main screen.\n\n   - returns: A color that exactly or best matches the desired traits with the given resource (R.color.*), or nil if no suitable color was found.\n   */\n  convenience init?(resource: ColorResourceType, compatibleWith traitCollection: UITraitCollection? = nil) {\n    self.init(named: resource.name, in: resource.bundle, compatibleWith: traitCollection)\n  }\n  #endif\n\n  #if os(watchOS)\n  /**\n   Returns the color from this resource (R.color.*) that is compatible with the trait collection.\n\n   - parameter resource: The resource you want the image of (R.color.*)\n\n   - returns: A color that exactly or best matches the desired traits with the given resource (R.color.*), or nil if no suitable color was found.\n   */\n  @available(watchOSApplicationExtension 4.0, *)\n  convenience init?(resource: ColorResourceType) {\n    self.init(named: resource.name)\n  }\n  #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UIFont+FontResource.swift",
    "content": "//\n//  UIFont+FontResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 06-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic extension UIFont {\n  /**\n   Creates and returns a font object for the specified font resource (R.font.*) and size.\n\n   - parameter resource: The font resource (R.font.*) for the specific font to load\n   - parameter size: The size (in points) to which the font is scaled. This value must be greater than 0.0.\n\n   - returns: A font object of the specified font resource and size.\n   */\n  convenience init?(resource: FontResourceType, size: CGFloat) {\n    self.init(name: resource.fontName, size: size)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UIImage+ImageResource.swift",
    "content": "//\n//  UIImage+ImageResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 11-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport UIKit\n\npublic extension UIImage {\n\n  #if os(iOS) || os(tvOS)\n  /**\n   Returns the image from this resource (R.image.*) that is compatible with the trait collection.\n\n   - parameter resource: The resource you want the image of (R.image.*)\n   - parameter traitCollection: Traits that describe the desired image to retrieve, pass nil to use traits that describe the main screen.\n\n   - returns: An image that exactly or best matches the desired traits with the given resource (R.image.*), or nil if no suitable image was found.\n  */\n  convenience init?(resource: ImageResourceType, compatibleWith traitCollection: UITraitCollection? = nil) {\n    self.init(named: resource.name, in: resource.bundle, compatibleWith: traitCollection)\n  }\n  #endif\n\n  #if os(watchOS)\n  /**\n   Returns the image from this resource (R.image.*) that is compatible with the trait collection.\n\n   - parameter resource: The resource you want the image of (R.image.*)\n\n   - returns: An image that exactly or best matches the desired traits with the given resource (R.image.*), or nil if no suitable image was found.\n   */\n  convenience init?(resource: ImageResourceType) {\n    self.init(named: resource.name)\n  }\n  #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UINib+NibResource.swift",
    "content": "//\n//  UINib+NibResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 08-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport UIKit\n\npublic extension UINib {\n  /**\n   Returns a UINib object initialized to the nib file of the specified resource (R.nib.*).\n\n   - parameter resource: The resource (R.nib.*) to load\n\n   - returns: The initialized UINib object. An exception is thrown if there were errors during initialization or the nib file could not be located.\n   */\n  convenience init(resource: NibResourceType) {\n    self.init(nibName: resource.name, bundle: resource.bundle)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UIStoryboard+StoryboardResource.swift",
    "content": "//\n//  UIStoryboard+StoryboardResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 07-01-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport UIKit\n\npublic extension UIStoryboard {\n  /**\n   Creates and returns a storyboard object for the specified storyboard resource (R.storyboard.*) file.\n\n   - parameter resource: The storyboard resource (R.storyboard.*) for the specific storyboard to load\n\n   - returns: A storyboard object for the specified file. If no storyboard resource file matching name exists, an exception is thrown with description: `Could not find a storyboard named 'XXXXXX' in bundle....`\n   */\n  convenience init(resource: StoryboardResourceType) {\n    self.init(name: resource.name, bundle: resource.bundle)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UIStoryboard+StoryboardViewControllerResource.swift",
    "content": "//\n//  UIViewController+StoryboardViewControllerResource.swift\n//  R.swift.Library\n//\n//  Created by Mathijs Kadijk on 13-03-16.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic extension UIStoryboard {\n  /**\n   Instantiates and returns the view controller with the specified resource (R.storyboard.*.*).\n\n   - parameter resource: An resource (R.storyboard.*.*) that uniquely identifies the view controller in the storyboard file. If the specified resource does not exist in the storyboard file, this method raises an exception.\n\n   - returns: The view controller corresponding to the specified resource (R.storyboard.*.*). If no view controller is associated, this method throws an exception.\n   */\n  func instantiateViewController<ViewControllerResource: StoryboardViewControllerResourceType>(withResource resource: ViewControllerResource) -> ViewControllerResource.ViewControllerType?  {\n    return self.instantiateViewController(withIdentifier: resource.identifier) as? ViewControllerResource.ViewControllerType\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UITableView+ReuseIdentifierProtocol.swift",
    "content": "//\n//  UITableView+ReuseIdentifierProtocol.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic extension UITableView {\n  /**\n   Returns a typed reusable table-view cell object for the specified reuse identifier and adds it to the table.\n   \n   - parameter identifier: A R.reuseIdentifier.* value identifying the cell object to be reused.\n   - parameter indexPath: The index path specifying the location of the cell. The data source receives this information when it is asked for the cell and should just pass it along. This method uses the index path to perform additional configuration based on the cell’s position in the table view.\n   \n   - returns: The UITableViewCell subclass with the associated reuse identifier or nil if it couldn't be casted correctly.\n   \n   - precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.\n  */\n  func dequeueReusableCell<Identifier: ReuseIdentifierType>(withIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType?\n    where Identifier.ReusableType: UITableViewCell\n  {\n    return dequeueReusableCell(withIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType\n  }\n\n  @available(*, unavailable, message: \"Use dequeueReusableCell(withIdentifier:for:) instead\")\n  func dequeueReusableCell<Identifier: ReuseIdentifierType>(withIdentifier identifier: Identifier) -> Identifier.ReusableType?\n    where Identifier.ReusableType: UITableViewCell\n  {\n    fatalError()\n  }\n\n  /**\n   Returns a typed reusable header or footer view located by its identifier.\n   \n   - parameter identifier: A R.reuseIdentifier.* value identifying the header or footer view to be reused.\n   \n   - returns: A UITableViewHeaderFooterView object with the associated identifier or nil if no such object exists in the reusable view queue or if it couldn't be cast correctly.\n   */\n  func dequeueReusableHeaderFooterView<Identifier: ReuseIdentifierType>(withIdentifier identifier: Identifier) -> Identifier.ReusableType?\n    where Identifier.ReusableType: UITableViewHeaderFooterView\n  {\n    return dequeueReusableHeaderFooterView(withIdentifier: identifier.identifier) as? Identifier.ReusableType\n  }\n\n  /**\n   Register a R.nib.* containing a cell with the table view under it's contained identifier.\n   \n   - parameter nibResource: A nib resource (R.nib.*) containing a table view cell that has a reuse identifier\n  */\n  func register<Resource: NibResourceType & ReuseIdentifierType>(_ nibResource: Resource) where Resource.ReusableType: UITableViewCell {\n    register(UINib(resource: nibResource), forCellReuseIdentifier: nibResource.identifier)\n  }\n\n  /**\n   Register a R.nib.* containing a header or footer with the table view under it's contained identifier.\n\n   - parameter nibResource: A nib resource (R.nib.*) containing a view that has a reuse identifier\n   */\n  func registerHeaderFooterView<Resource: NibResourceType>(_ nibResource: Resource) where Resource: ReuseIdentifierType, Resource.ReusableType: UIView {\n    register(UINib(resource: nibResource), forHeaderFooterViewReuseIdentifier: nibResource.identifier)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UIViewController+NibResource.swift",
    "content": "//\n//  UIViewController+NibResource.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic extension UIViewController {\n  /**\n   Returns a newly initialized view controller with the nib resource (R.nib.*).\n   \n   - parameter nib: The nib resource (R.nib.*) to associate with the view controller.\n   \n   - returns: A newly initialized UIViewController object.\n  */\n  convenience init(nib: NibResourceType) {\n    self.init(nibName: nib.name, bundle: nib.bundle)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Library/UIKit/UIViewController+StoryboardSegueIdentifierProtocol.swift",
    "content": "//\n//  UIViewController+StoryboardSegueIdentifierProtocol.swift\n//  R.swift Library\n//\n//  Created by Mathijs Kadijk on 06-12-15.\n//  From: https://github.com/mac-cain13/R.swift.Library\n//  License: MIT License\n//\n\nimport Foundation\nimport UIKit\n\npublic protocol SeguePerformerType {\n  func performSegue(withIdentifier identifier: String, sender: Any?)\n}\n\nextension UIViewController: SeguePerformerType {}\n\npublic extension SeguePerformerType {\n  /**\n   Initiates the segue with the specified identifier (R.segue.*) from the current view controller's storyboard file.\n   - parameter identifier: The R.segue.* that identifies the triggered segue.\n   - parameter sender: The object that you want to use to initiate the segue. This object is made available for informational purposes during the actual segue.\n   - SeeAlso: Library for typed block based segues: [tomlokhorst/SegueManager](https://github.com/tomlokhorst/SegueManager)\n   */\n  func performSegue<Segue, Destination>(withIdentifier identifier: StoryboardSegueIdentifier<Segue, Self, Destination>, sender: Any?) {\n    performSegue(withIdentifier: identifier.identifier, sender: sender)\n  }\n}\n\npublic extension StoryboardSegue where Source : UIViewController {\n  /**\n   Performs this segue on the source view controller\n   - parameter sender: The object that you want to use to initiate the segue. This object is made available for informational purposes during the actual segue.\n   */\n  func performSegue(sender: Any? = nil) {\n    source.performSegue(withIdentifier: identifier.identifier, sender: sender)\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/License",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Mathijs Kadijk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library/Readme.md",
    "content": "# R.swift.Library [![Version](https://img.shields.io/cocoapods/v/R.swift.Library.svg?style=flat)](https://cocoapods.org/pods/R.swift) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![License](https://img.shields.io/cocoapods/l/R.swift.Library.svg?style=flat)](blob/master/License) ![Platform](https://img.shields.io/cocoapods/p/R.swift.Library.svg?style=flat)\n\n_Library containing types supporting code generated by [R.swift](https://github.com/mac-cain13/R.swift)_\n\n## Why use this?\n\nRegular users probably want to include this library to use [R.swift](https://github.com/mac-cain13/R.swift). Developers of other libraries can use this library to extend upon the types and code R.swift generates and uses.\n\n## Installation\n\n### CocoaPods (recommended)\n\n_**Be aware:** If you just want to use R.swift follow the [installation instructions for R.swift](https://github.com/mac-cain13/R.swift#Installation)._\n\n1. Add `pod 'R.swift.Library'` to your [Podfile](http://cocoapods.org/#get_started)\n2. Run `pod install`\n\n### Carthage\n\n1. Add `github \"mac-cain13/R.swift.Library\"` to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile)\n2. Run `carthage`\n\n### Swift Package Manager (Requires Xcode 11)\n\n1. Open your Xcode project.\n2. Select `File > Swift Packages > Add Package Dependency...`\n3. Paste `https://github.com/mac-cain13/R.swift.Library` to the text field and click on the `Next` button.\n4. Choose appropriate version and click on the `Next` button. (If you need latest one, just click on the `Next` button.)\n5. Confirm that `Rswift` in the Package Product column is checked and your app's name is selected in the Add to Target column.\n6. Click on the `Next` button.\n\n### Manually\n\n_As an embedded framework using git submodules._\n\n0. If your project is not yet a git repository, run `git init`\n1. Add R.swift.Library as a submodule by running: `git submodule add https://github.com/mac-cain13/R.swift.Library.git`\n3. Open the new `R.swift.Library` folder, and drag the `R.swift.Library.xcodeproj` into the Project Navigator of your application's Xcode project.\n4. Select the `R.swift.Library.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.\n5. Select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the \"Targets\" heading in the sidebar.\n6. In the tab bar at the top of that window, open the \"General\" panel.\n7. Click on the `+` button under the \"Embedded Binaries\" section.\n8. Choose the `Rswift.framework`\n\n> The `Rswift.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.\n\n## License\n\n[R.swift](https://github.com/mac-cain13/R.swift) and [R.swift.Library](https://github.com/mac-cain13/R.swift.Library) are created by [Mathijs Kadijk](https://github.com/mac-cain13) and released under a [MIT License](License).\n"
  },
  {
    "path": "JetChat/Pods/R.swift.Library.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t0BBF1068BB3B41A7FFF880B05795E07B /* UIColor+ColorResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E2628B93B8AFA10A0EC55DA4CE2BCBB /* UIColor+ColorResource.swift */; };\n\t\t0C4F5BFE6D00473694426D27ABC11A28 /* FontResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AB623CD96D0DA2D748EB71A1086CA2A /* FontResource.swift */; };\n\t\t0E95BD610EF45AE5B515DE2AD5F7C823 /* NibResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2669DF823AC7148ACC6995A6BC2CAD5D /* NibResource.swift */; };\n\t\t0FA820A1092C3DB17A3F2C82FD4AFB84 /* Data+FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82A0D6FE6B14AEC444352733B74E7620 /* Data+FileResource.swift */; };\n\t\t1B200E79A464C91233A77074C903F8FD /* UIImage+ImageResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 916EEF0BE2CEE80B92E1DEC528ABE162 /* UIImage+ImageResource.swift */; };\n\t\t2411AE419A24BE790B3B65B0196FB594 /* StoryboardResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE5EFD9BAE662D567150C610DB558709 /* StoryboardResource.swift */; };\n\t\t244D3CDB2966D6AE7DE44051806017AC /* UICollectionView+ReuseIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18EF2A8F8DBE5CCC0E46AE3DCCC8F6E0 /* UICollectionView+ReuseIdentifierProtocol.swift */; };\n\t\t2B29A243062C9F66198908EBDB0017B5 /* Bundle+FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AA3E281812FBE3BCAE65081B7F1C59 /* Bundle+FileResource.swift */; };\n\t\t2D5B0E39AB3DE7F5D3F4F2A8A1C1D4C5 /* R.swift.Library-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 5863C260841B827CD6DAF3EFBDF63C78 /* R.swift.Library-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t56AF519A31089CF99A2DD85043ACA13D /* ReuseIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA4FFF574DA865FFE4A38141EA3C0552 /* ReuseIdentifierProtocol.swift */; };\n\t\t6BD87E05828E5C090225001E9B8EB67A /* UITableView+ReuseIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EEB92F64982D56632206A7D19F4C2F /* UITableView+ReuseIdentifierProtocol.swift */; };\n\t\t6F40C3134AE58DD8AE0406CF871AFB95 /* UIViewController+StoryboardSegueIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E9D902025BE9976A24616DBA7D08F3A /* UIViewController+StoryboardSegueIdentifierProtocol.swift */; };\n\t\t79502ECF650046C5EBE8CF980A04ACDC /* TypedStoryboardSegueInfo+UIStoryboardSegue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53F17BB1DD05264547C1615E7CCC84BA /* TypedStoryboardSegueInfo+UIStoryboardSegue.swift */; };\n\t\t8008F98F930079E0F9F24D9E85BDA499 /* StringResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE830BC62069D8306382C4B4EC279834 /* StringResource.swift */; };\n\t\t81A621AEE3152C6832D13641CDE233FF /* UIViewController+NibResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3AE537895379CBE833189C9A4FA127 /* UIViewController+NibResource.swift */; };\n\t\t957CDE1D86CFE23AEDB433A90BCAE96E /* StoryboardSegueIdentifierProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D868A4318827ECCF8582C4F549BE0472 /* StoryboardSegueIdentifierProtocol.swift */; };\n\t\t993EA04440B376A09BCD2126F1E771EE /* NibResource+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2543FB18DD737F2D7DEAAF3DB67F582E /* NibResource+UIKit.swift */; };\n\t\t9C7E9D17673F02C3A73662BB6FA5F1CC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBE17BA66F3F0333EE62DFAA8B512C9C /* Foundation.framework */; };\n\t\t9CD6C8AA7FE288C087651EAC8F86E0D4 /* ImageResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D35D43CE7071E6A0413834D9A02964 /* ImageResource.swift */; };\n\t\t9D42E7890E9FBCC3B108880C280764A5 /* Validatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27E86EFB28CE1FDAC538CC87BA85AFE0 /* Validatable.swift */; };\n\t\tA125B00D13C3964FA4FDB94F684D1E8E /* StoryboardResourceWithInitialController+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 266E5651CC84B1071D707AEDB5DB1945 /* StoryboardResourceWithInitialController+UIKit.swift */; };\n\t\tA82DA5F7B9ED116C03CD180DBDE21433 /* UIStoryboard+StoryboardViewControllerResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2985B8304D310B87F3A02632595E69A /* UIStoryboard+StoryboardViewControllerResource.swift */; };\n\t\tA89B8795FA80A6C452B134AC46853AB3 /* FileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = A082CC0C4276FC2C5302AD09AB6700BD /* FileResource.swift */; };\n\t\tAB019015428DF9B980679F1AD4C5C8B9 /* UINib+NibResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACAA2DF16AF41EEAF3D192317F4CB8FD /* UINib+NibResource.swift */; };\n\t\tB70B88A4F9B8B1F30813E3EA2651FCD6 /* Identifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6345E58BA358AE234137F8649BB47E0 /* Identifier.swift */; };\n\t\tBB05F14C113E866C307E21CF6E827315 /* ColorResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C3AF7420033891FE325E22BF08CF46 /* ColorResource.swift */; };\n\t\tC974C044A5122FEE8B85026C2358DF28 /* UIStoryboard+StoryboardResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C411A1FD05163B4A9F300AC428C26CF2 /* UIStoryboard+StoryboardResource.swift */; };\n\t\tD337D77F3D3A6FFE2E8A2041FE4175D0 /* R.swift.Library-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 241C64CE32764417C660E090E4681BE7 /* R.swift.Library-dummy.m */; };\n\t\tDAF38AE55A5BC5B9399D2A7FDCB3D558 /* StoryboardViewControllerResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BDBE4BAE53D934DB55228EDC721FF79 /* StoryboardViewControllerResource.swift */; };\n\t\tDC00B4068B6F85EBB1FD9E01F93921AD /* UIFont+FontResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5C39B2E711E276B2D126EF242DD982 /* UIFont+FontResource.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t05D35D43CE7071E6A0413834D9A02964 /* ImageResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageResource.swift; path = Library/Core/ImageResource.swift; sourceTree = \"<group>\"; };\n\t\t06A4C248292207C3A8654DF0F5819F5B /* R.swift.Library.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = R.swift.Library.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t0BDBE4BAE53D934DB55228EDC721FF79 /* StoryboardViewControllerResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StoryboardViewControllerResource.swift; path = Library/Core/StoryboardViewControllerResource.swift; sourceTree = \"<group>\"; };\n\t\t18EF2A8F8DBE5CCC0E46AE3DCCC8F6E0 /* UICollectionView+ReuseIdentifierProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UICollectionView+ReuseIdentifierProtocol.swift\"; path = \"Library/UIKit/UICollectionView+ReuseIdentifierProtocol.swift\"; sourceTree = \"<group>\"; };\n\t\t241C64CE32764417C660E090E4681BE7 /* R.swift.Library-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"R.swift.Library-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t2543FB18DD737F2D7DEAAF3DB67F582E /* NibResource+UIKit.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NibResource+UIKit.swift\"; path = \"Library/UIKit/NibResource+UIKit.swift\"; sourceTree = \"<group>\"; };\n\t\t2669DF823AC7148ACC6995A6BC2CAD5D /* NibResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NibResource.swift; path = Library/Core/NibResource.swift; sourceTree = \"<group>\"; };\n\t\t266E5651CC84B1071D707AEDB5DB1945 /* StoryboardResourceWithInitialController+UIKit.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"StoryboardResourceWithInitialController+UIKit.swift\"; path = \"Library/UIKit/StoryboardResourceWithInitialController+UIKit.swift\"; sourceTree = \"<group>\"; };\n\t\t27E86EFB28CE1FDAC538CC87BA85AFE0 /* Validatable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validatable.swift; path = Library/Core/Validatable.swift; sourceTree = \"<group>\"; };\n\t\t35C1286245B5987BF5C5B2207FC517AC /* R.swift.Library.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = R.swift.Library.modulemap; sourceTree = \"<group>\"; };\n\t\t37C3AF7420033891FE325E22BF08CF46 /* ColorResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColorResource.swift; path = Library/Core/ColorResource.swift; sourceTree = \"<group>\"; };\n\t\t53F17BB1DD05264547C1615E7CCC84BA /* TypedStoryboardSegueInfo+UIStoryboardSegue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"TypedStoryboardSegueInfo+UIStoryboardSegue.swift\"; path = \"Library/UIKit/TypedStoryboardSegueInfo+UIStoryboardSegue.swift\"; sourceTree = \"<group>\"; };\n\t\t5863C260841B827CD6DAF3EFBDF63C78 /* R.swift.Library-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"R.swift.Library-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t5F3AE537895379CBE833189C9A4FA127 /* UIViewController+NibResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIViewController+NibResource.swift\"; path = \"Library/UIKit/UIViewController+NibResource.swift\"; sourceTree = \"<group>\"; };\n\t\t6AB623CD96D0DA2D748EB71A1086CA2A /* FontResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FontResource.swift; path = Library/Core/FontResource.swift; sourceTree = \"<group>\"; };\n\t\t6E2628B93B8AFA10A0EC55DA4CE2BCBB /* UIColor+ColorResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIColor+ColorResource.swift\"; path = \"Library/UIKit/UIColor+ColorResource.swift\"; sourceTree = \"<group>\"; };\n\t\t82A0D6FE6B14AEC444352733B74E7620 /* Data+FileResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Data+FileResource.swift\"; path = \"Library/Foundation/Data+FileResource.swift\"; sourceTree = \"<group>\"; };\n\t\t916EEF0BE2CEE80B92E1DEC528ABE162 /* UIImage+ImageResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIImage+ImageResource.swift\"; path = \"Library/UIKit/UIImage+ImageResource.swift\"; sourceTree = \"<group>\"; };\n\t\t9E9D902025BE9976A24616DBA7D08F3A /* UIViewController+StoryboardSegueIdentifierProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIViewController+StoryboardSegueIdentifierProtocol.swift\"; path = \"Library/UIKit/UIViewController+StoryboardSegueIdentifierProtocol.swift\"; sourceTree = \"<group>\"; };\n\t\tA082CC0C4276FC2C5302AD09AB6700BD /* FileResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FileResource.swift; path = Library/Core/FileResource.swift; sourceTree = \"<group>\"; };\n\t\tACAA2DF16AF41EEAF3D192317F4CB8FD /* UINib+NibResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UINib+NibResource.swift\"; path = \"Library/UIKit/UINib+NibResource.swift\"; sourceTree = \"<group>\"; };\n\t\tAE5EFD9BAE662D567150C610DB558709 /* StoryboardResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StoryboardResource.swift; path = Library/Core/StoryboardResource.swift; sourceTree = \"<group>\"; };\n\t\tAE830BC62069D8306382C4B4EC279834 /* StringResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StringResource.swift; path = Library/Core/StringResource.swift; sourceTree = \"<group>\"; };\n\t\tAF7D442E40E485397B9B0ADCFE3200AB /* R.swift.Library-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"R.swift.Library-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tB0EEB92F64982D56632206A7D19F4C2F /* UITableView+ReuseIdentifierProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITableView+ReuseIdentifierProtocol.swift\"; path = \"Library/UIKit/UITableView+ReuseIdentifierProtocol.swift\"; sourceTree = \"<group>\"; };\n\t\tBA4FFF574DA865FFE4A38141EA3C0552 /* ReuseIdentifierProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReuseIdentifierProtocol.swift; path = Library/Core/ReuseIdentifierProtocol.swift; sourceTree = \"<group>\"; };\n\t\tBA7C479A8FB69F0F707E933476011DBB /* R.swift.Library.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = R.swift.Library.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tC411A1FD05163B4A9F300AC428C26CF2 /* UIStoryboard+StoryboardResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIStoryboard+StoryboardResource.swift\"; path = \"Library/UIKit/UIStoryboard+StoryboardResource.swift\"; sourceTree = \"<group>\"; };\n\t\tCB5C39B2E711E276B2D126EF242DD982 /* UIFont+FontResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIFont+FontResource.swift\"; path = \"Library/UIKit/UIFont+FontResource.swift\"; sourceTree = \"<group>\"; };\n\t\tD47EE99420FF1B9743FE39A55976A653 /* R.swift.Library-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"R.swift.Library-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tD5AA3E281812FBE3BCAE65081B7F1C59 /* Bundle+FileResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Bundle+FileResource.swift\"; path = \"Library/Foundation/Bundle+FileResource.swift\"; sourceTree = \"<group>\"; };\n\t\tD6345E58BA358AE234137F8649BB47E0 /* Identifier.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Identifier.swift; path = Library/Core/Identifier.swift; sourceTree = \"<group>\"; };\n\t\tD868A4318827ECCF8582C4F549BE0472 /* StoryboardSegueIdentifierProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StoryboardSegueIdentifierProtocol.swift; path = Library/Core/StoryboardSegueIdentifierProtocol.swift; sourceTree = \"<group>\"; };\n\t\tDA372BB34DA343967CD088D04B5B527C /* R.swift.Library */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = R.swift.Library; path = Rswift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tDBE17BA66F3F0333EE62DFAA8B512C9C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tE2985B8304D310B87F3A02632595E69A /* UIStoryboard+StoryboardViewControllerResource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIStoryboard+StoryboardViewControllerResource.swift\"; path = \"Library/UIKit/UIStoryboard+StoryboardViewControllerResource.swift\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t78DBDA50406DF789F1E142DA9A8CCCF2 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t9C7E9D17673F02C3A73662BB6FA5F1CC /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t06B46FBFEC8FEE4E57B5B1EDA5809371 /* R.swift.Library */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD5AA3E281812FBE3BCAE65081B7F1C59 /* Bundle+FileResource.swift */,\n\t\t\t\t37C3AF7420033891FE325E22BF08CF46 /* ColorResource.swift */,\n\t\t\t\t82A0D6FE6B14AEC444352733B74E7620 /* Data+FileResource.swift */,\n\t\t\t\tA082CC0C4276FC2C5302AD09AB6700BD /* FileResource.swift */,\n\t\t\t\t6AB623CD96D0DA2D748EB71A1086CA2A /* FontResource.swift */,\n\t\t\t\tD6345E58BA358AE234137F8649BB47E0 /* Identifier.swift */,\n\t\t\t\t05D35D43CE7071E6A0413834D9A02964 /* ImageResource.swift */,\n\t\t\t\t2669DF823AC7148ACC6995A6BC2CAD5D /* NibResource.swift */,\n\t\t\t\t2543FB18DD737F2D7DEAAF3DB67F582E /* NibResource+UIKit.swift */,\n\t\t\t\tBA4FFF574DA865FFE4A38141EA3C0552 /* ReuseIdentifierProtocol.swift */,\n\t\t\t\tAE5EFD9BAE662D567150C610DB558709 /* StoryboardResource.swift */,\n\t\t\t\t266E5651CC84B1071D707AEDB5DB1945 /* StoryboardResourceWithInitialController+UIKit.swift */,\n\t\t\t\tD868A4318827ECCF8582C4F549BE0472 /* StoryboardSegueIdentifierProtocol.swift */,\n\t\t\t\t0BDBE4BAE53D934DB55228EDC721FF79 /* StoryboardViewControllerResource.swift */,\n\t\t\t\tAE830BC62069D8306382C4B4EC279834 /* StringResource.swift */,\n\t\t\t\t53F17BB1DD05264547C1615E7CCC84BA /* TypedStoryboardSegueInfo+UIStoryboardSegue.swift */,\n\t\t\t\t18EF2A8F8DBE5CCC0E46AE3DCCC8F6E0 /* UICollectionView+ReuseIdentifierProtocol.swift */,\n\t\t\t\t6E2628B93B8AFA10A0EC55DA4CE2BCBB /* UIColor+ColorResource.swift */,\n\t\t\t\tCB5C39B2E711E276B2D126EF242DD982 /* UIFont+FontResource.swift */,\n\t\t\t\t916EEF0BE2CEE80B92E1DEC528ABE162 /* UIImage+ImageResource.swift */,\n\t\t\t\tACAA2DF16AF41EEAF3D192317F4CB8FD /* UINib+NibResource.swift */,\n\t\t\t\tC411A1FD05163B4A9F300AC428C26CF2 /* UIStoryboard+StoryboardResource.swift */,\n\t\t\t\tE2985B8304D310B87F3A02632595E69A /* UIStoryboard+StoryboardViewControllerResource.swift */,\n\t\t\t\tB0EEB92F64982D56632206A7D19F4C2F /* UITableView+ReuseIdentifierProtocol.swift */,\n\t\t\t\t5F3AE537895379CBE833189C9A4FA127 /* UIViewController+NibResource.swift */,\n\t\t\t\t9E9D902025BE9976A24616DBA7D08F3A /* UIViewController+StoryboardSegueIdentifierProtocol.swift */,\n\t\t\t\t27E86EFB28CE1FDAC538CC87BA85AFE0 /* Validatable.swift */,\n\t\t\t\tBFA565699E9B4AA9429146592B2A8F11 /* Support Files */,\n\t\t\t);\n\t\t\tname = R.swift.Library;\n\t\t\tpath = R.swift.Library;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t0B7ADC8C6AC5A3271201CB8102BAF2DD /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDA372BB34DA343967CD088D04B5B527C /* R.swift.Library */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2893F64AED50DBE6DB16812B556C2820 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t28FF557BD0499D81261BE99BB5A0B2DF /* Frameworks */,\n\t\t\t\t0B7ADC8C6AC5A3271201CB8102BAF2DD /* Products */,\n\t\t\t\t06B46FBFEC8FEE4E57B5B1EDA5809371 /* R.swift.Library */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t28FF557BD0499D81261BE99BB5A0B2DF /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA3AFFD767F2F438CA4D7383747D6F9E3 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA3AFFD767F2F438CA4D7383747D6F9E3 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDBE17BA66F3F0333EE62DFAA8B512C9C /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tBFA565699E9B4AA9429146592B2A8F11 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t35C1286245B5987BF5C5B2207FC517AC /* R.swift.Library.modulemap */,\n\t\t\t\t241C64CE32764417C660E090E4681BE7 /* R.swift.Library-dummy.m */,\n\t\t\t\tD47EE99420FF1B9743FE39A55976A653 /* R.swift.Library-Info.plist */,\n\t\t\t\tAF7D442E40E485397B9B0ADCFE3200AB /* R.swift.Library-prefix.pch */,\n\t\t\t\t5863C260841B827CD6DAF3EFBDF63C78 /* R.swift.Library-umbrella.h */,\n\t\t\t\tBA7C479A8FB69F0F707E933476011DBB /* R.swift.Library.debug.xcconfig */,\n\t\t\t\t06A4C248292207C3A8654DF0F5819F5B /* R.swift.Library.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/R.swift.Library\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tC1C6706916C3FE78C93E163A222397A8 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2D5B0E39AB3DE7F5D3F4F2A8A1C1D4C5 /* R.swift.Library-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t61AC8FF22886EA444144B44F9AC733B8 /* R.swift.Library */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = A77F7EE736F0593FC072E7F26B6D964F /* Build configuration list for PBXNativeTarget \"R.swift.Library\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tC1C6706916C3FE78C93E163A222397A8 /* Headers */,\n\t\t\t\t3B716177F69D55261B51559C3E80BF6D /* Sources */,\n\t\t\t\t78DBDA50406DF789F1E142DA9A8CCCF2 /* Frameworks */,\n\t\t\t\tBAC153C1A57131A33DF20ECA5D6BCDD3 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = R.swift.Library;\n\t\t\tproductName = Rswift;\n\t\t\tproductReference = DA372BB34DA343967CD088D04B5B527C /* R.swift.Library */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tABB5B165FDD7803A1A5EECC1198E8E0C /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = DDE7173D388F6F202D31CE4ECC5F20F7 /* Build configuration list for PBXProject \"R.swift.Library\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 2893F64AED50DBE6DB16812B556C2820;\n\t\t\tproductRefGroup = 0B7ADC8C6AC5A3271201CB8102BAF2DD /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t61AC8FF22886EA444144B44F9AC733B8 /* R.swift.Library */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tBAC153C1A57131A33DF20ECA5D6BCDD3 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3B716177F69D55261B51559C3E80BF6D /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2B29A243062C9F66198908EBDB0017B5 /* Bundle+FileResource.swift in Sources */,\n\t\t\t\tBB05F14C113E866C307E21CF6E827315 /* ColorResource.swift in Sources */,\n\t\t\t\t0FA820A1092C3DB17A3F2C82FD4AFB84 /* Data+FileResource.swift in Sources */,\n\t\t\t\tA89B8795FA80A6C452B134AC46853AB3 /* FileResource.swift in Sources */,\n\t\t\t\t0C4F5BFE6D00473694426D27ABC11A28 /* FontResource.swift in Sources */,\n\t\t\t\tB70B88A4F9B8B1F30813E3EA2651FCD6 /* Identifier.swift in Sources */,\n\t\t\t\t9CD6C8AA7FE288C087651EAC8F86E0D4 /* ImageResource.swift in Sources */,\n\t\t\t\t0E95BD610EF45AE5B515DE2AD5F7C823 /* NibResource.swift in Sources */,\n\t\t\t\t993EA04440B376A09BCD2126F1E771EE /* NibResource+UIKit.swift in Sources */,\n\t\t\t\tD337D77F3D3A6FFE2E8A2041FE4175D0 /* R.swift.Library-dummy.m in Sources */,\n\t\t\t\t56AF519A31089CF99A2DD85043ACA13D /* ReuseIdentifierProtocol.swift in Sources */,\n\t\t\t\t2411AE419A24BE790B3B65B0196FB594 /* StoryboardResource.swift in Sources */,\n\t\t\t\tA125B00D13C3964FA4FDB94F684D1E8E /* StoryboardResourceWithInitialController+UIKit.swift in Sources */,\n\t\t\t\t957CDE1D86CFE23AEDB433A90BCAE96E /* StoryboardSegueIdentifierProtocol.swift in Sources */,\n\t\t\t\tDAF38AE55A5BC5B9399D2A7FDCB3D558 /* StoryboardViewControllerResource.swift in Sources */,\n\t\t\t\t8008F98F930079E0F9F24D9E85BDA499 /* StringResource.swift in Sources */,\n\t\t\t\t79502ECF650046C5EBE8CF980A04ACDC /* TypedStoryboardSegueInfo+UIStoryboardSegue.swift in Sources */,\n\t\t\t\t244D3CDB2966D6AE7DE44051806017AC /* UICollectionView+ReuseIdentifierProtocol.swift in Sources */,\n\t\t\t\t0BBF1068BB3B41A7FFF880B05795E07B /* UIColor+ColorResource.swift in Sources */,\n\t\t\t\tDC00B4068B6F85EBB1FD9E01F93921AD /* UIFont+FontResource.swift in Sources */,\n\t\t\t\t1B200E79A464C91233A77074C903F8FD /* UIImage+ImageResource.swift in Sources */,\n\t\t\t\tAB019015428DF9B980679F1AD4C5C8B9 /* UINib+NibResource.swift in Sources */,\n\t\t\t\tC974C044A5122FEE8B85026C2358DF28 /* UIStoryboard+StoryboardResource.swift in Sources */,\n\t\t\t\tA82DA5F7B9ED116C03CD180DBDE21433 /* UIStoryboard+StoryboardViewControllerResource.swift in Sources */,\n\t\t\t\t6BD87E05828E5C090225001E9B8EB67A /* UITableView+ReuseIdentifierProtocol.swift in Sources */,\n\t\t\t\t81A621AEE3152C6832D13641CDE233FF /* UIViewController+NibResource.swift in Sources */,\n\t\t\t\t6F40C3134AE58DD8AE0406CF871AFB95 /* UIViewController+StoryboardSegueIdentifierProtocol.swift in Sources */,\n\t\t\t\t9D42E7890E9FBCC3B108880C280764A5 /* Validatable.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t33FFA6B6349F346422F1FDA57C5D7714 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = BA7C479A8FB69F0F707E933476011DBB /* R.swift.Library.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/R.swift.Library/R.swift.Library-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/R.swift.Library/R.swift.Library-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/R.swift.Library/R.swift.Library.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Rswift;\n\t\t\t\tPRODUCT_NAME = Rswift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t61BBA37DE0995CA27F7F5A0AF2CF3ADE /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 06A4C248292207C3A8654DF0F5819F5B /* R.swift.Library.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/R.swift.Library/R.swift.Library-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/R.swift.Library/R.swift.Library-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/R.swift.Library/R.swift.Library.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Rswift;\n\t\t\t\tPRODUCT_NAME = Rswift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t823476EC2DC66913C28D30D9370F91E6 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t9720202A3553F6A7C9E53D981C25096B /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tA77F7EE736F0593FC072E7F26B6D964F /* Build configuration list for PBXNativeTarget \"R.swift.Library\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t33FFA6B6349F346422F1FDA57C5D7714 /* Debug */,\n\t\t\t\t61BBA37DE0995CA27F7F5A0AF2CF3ADE /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDDE7173D388F6F202D31CE4ECC5F20F7 /* Build configuration list for PBXProject \"R.swift.Library\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t823476EC2DC66913C28D30D9370F91E6 /* Debug */,\n\t\t\t\t9720202A3553F6A7C9E53D981C25096B /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = ABB5B165FDD7803A1A5EECC1198E8E0C /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/R.swift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXAggregateTarget section */\n\t\tFF6ED22E1CDAF83ADE98360601DC4DE5 /* R.swift */ = {\n\t\t\tisa = PBXAggregateTarget;\n\t\t\tbuildConfigurationList = 448BEE38A7C2EB9792FC71C13C333B25 /* Build configuration list for PBXAggregateTarget \"R.swift\" */;\n\t\t\tbuildPhases = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tF31639E6F1AFA516CA853F5C385B62B6 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = R.swift;\n\t\t};\n/* End PBXAggregateTarget section */\n\n/* Begin PBXContainerItemProxy section */\n\t\tD1DEDFB1F2644C4E7A1B8588E2C33CE9 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = EA0D0955105E64F697BFE3333E95EB01 /* R.swift.Library.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 61AC8FF22886EA444144B44F9AC733B8;\n\t\t\tremoteInfo = R.swift.Library;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t0ACB86BA17B7AF5C7475F48C47EBCBA4 /* R.swift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = R.swift.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tA7FE24C116568454DDF763AAE78B510D /* R.swift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = R.swift.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tEA0D0955105E64F697BFE3333E95EB01 /* R.swift.Library */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = R.swift.Library; path = R.swift.Library.xcodeproj; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXGroup section */\n\t\t013C9EA4ED630FBD546ECCA8A8E24FCD /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA7FE24C116568454DDF763AAE78B510D /* R.swift.debug.xcconfig */,\n\t\t\t\t0ACB86BA17B7AF5C7475F48C47EBCBA4 /* R.swift.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/R.swift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t377F583B1B038B3E26B9E10CBA580814 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEA0D0955105E64F697BFE3333E95EB01 /* R.swift.Library */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t955BBF8B76891C1979D0E584713B1394 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA227BCAB473C80EF4383E1AC6529B361 /* R.swift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t013C9EA4ED630FBD546ECCA8A8E24FCD /* Support Files */,\n\t\t\t);\n\t\t\tname = R.swift;\n\t\t\tpath = R.swift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCE8978BB2824B28944F03B530D10726E /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF2E3357DA00E89877D9F37B70946C357 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t377F583B1B038B3E26B9E10CBA580814 /* Dependencies */,\n\t\t\t\t955BBF8B76891C1979D0E584713B1394 /* Frameworks */,\n\t\t\t\tCE8978BB2824B28944F03B530D10726E /* Products */,\n\t\t\t\tA227BCAB473C80EF4383E1AC6529B361 /* R.swift */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXProject section */\n\t\tB90D616832CAB42E650F12B59C2EA780 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 8A41CD8E4C679AC7247793EA23D1CDD6 /* Build configuration list for PBXProject \"R.swift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = F2E3357DA00E89877D9F37B70946C357;\n\t\t\tproductRefGroup = CE8978BB2824B28944F03B530D10726E /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = EA0D0955105E64F697BFE3333E95EB01 /* R.swift.Library */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tFF6ED22E1CDAF83ADE98360601DC4DE5 /* R.swift */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXTargetDependency section */\n\t\tF31639E6F1AFA516CA853F5C385B62B6 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = R.swift.Library;\n\t\t\ttargetProxy = D1DEDFB1F2644C4E7A1B8588E2C33CE9 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t00AB0073A7B305943362DA7D21E24B75 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 0ACB86BA17B7AF5C7475F48C47EBCBA4 /* R.swift.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t379EF0260A372F3690E8F6DD7A9F6022 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t4DD87E629DB5CBE6E957B37E993B79A2 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEA13933170815E225ECE50BDA2D9B730 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = A7FE24C116568454DDF763AAE78B510D /* R.swift.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t448BEE38A7C2EB9792FC71C13C333B25 /* Build configuration list for PBXAggregateTarget \"R.swift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEA13933170815E225ECE50BDA2D9B730 /* Debug */,\n\t\t\t\t00AB0073A7B305943362DA7D21E24B75 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t8A41CD8E4C679AC7247793EA23D1CDD6 /* Build configuration list for PBXProject \"R.swift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t379EF0260A372F3690E8F6DD7A9F6022 /* Debug */,\n\t\t\t\t4DD87E629DB5CBE6E957B37E993B79A2 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = B90D616832CAB42E650F12B59C2EA780 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/ReachabilitySwift/LICENSE",
    "content": "Copyright (c) 2016 Ashley Mills\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/ReachabilitySwift/README.md",
    "content": "# Reachability.swift\n\nReachability.swift is a replacement for Apple's Reachability sample, re-written in Swift with closures.\n\nIt is compatible with **iOS** (8.0 - 12.0), **OSX** (10.9 - 10.14) and **tvOS** (9.0 - 12.0)\n\nInspired by https://github.com/tonymillion/Reachability\n\n## Supporting **Reachability.swift**\nKeeping **Reachability.swift** up-to-date is a time consuming task. Making updates, reviewing pull requests, responding to issues and answering emails all take time. \n\nIf you're an iOS developer who's looking for a quick and easy way to create App Store screenshots, please try out my app [Screenshot Producer](https://itunes.apple.com/app/apple-store/id1252374855?pt=215893&ct=reachability&mt=8)…\n\n Devices | Layout | Copy | Localize | Export      \n:------:|:------:|:------:|:------:|:------:\n![](http://is2.mzstatic.com/image/thumb/Purple118/v4/64/af/55/64af55bc-2ef0-691c-f5f3-4963685f7f63/source/552x414bb.jpg) |  ![](http://is4.mzstatic.com/image/thumb/Purple128/v4/fb/4c/bd/fb4cbd2f-dd04-22ba-4fdf-5ac652693fb8/source/552x414bb.jpg) |  ![](http://is1.mzstatic.com/image/thumb/Purple118/v4/5a/4f/cf/5a4fcfdf-ca04-0307-9f2e-83178e8ad90d/source/552x414bb.jpg) |  ![](http://is4.mzstatic.com/image/thumb/Purple128/v4/17/ea/56/17ea562e-e045-96e7-fcac-cfaaf4f499fd/source/552x414bb.jpg) |  ![](http://is4.mzstatic.com/image/thumb/Purple118/v4/59/9e/dd/599edd50-f05c-f413-8e88-e614731fd828/source/552x414bb.jpg)\n\nAnd don't forget to **★** the repo. This increases its visibility and encourages others to contribute.\n\nThanks\nAsh\n\n\n## Got a problem?\n\nPlease read https://github.com/ashleymills/Reachability.swift/blob/master/CONTRIBUTING.md before raising an issue.\n\n## Installation\n### Manual\nJust drop the **Reachability.swift** file into your project. That's it!\n\n### CocoaPods\n[CocoaPods][] is a dependency manager for Cocoa projects. To install Reachability.swift with CocoaPods:\n\n 1. Make sure CocoaPods is [installed][CocoaPods Installation].\n\n 2. Update your Podfile to include the following:\n\n    ``` ruby\n    use_frameworks!\n    pod 'ReachabilitySwift'\n    ```\n\n 3. Run `pod install`.\n\n[CocoaPods]: https://cocoapods.org\n[CocoaPods Installation]: https://guides.cocoapods.org/using/getting-started.html#getting-started\n \n 4. In your code import Reachability like so:\n   `import Reachability`\n\n### Carthage\n[Carthage][] is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\nTo install Reachability.swift with Carthage:\n\n1. Install Carthage via [Homebrew][]\n  ```bash\n  $ brew update\n  $ brew install carthage\n  ```\n\n2. Add `github \"ashleymills/Reachability.swift\"` to your Cartfile.\n\n3. Run `carthage update`.\n\n4. Drag `Reachability.framework` from the `Carthage/Build/iOS/` directory to the `Linked Frameworks and Libraries` section of your Xcode project’s `General` settings.\n\n5. Add `$(SRCROOT)/Carthage/Build/iOS/Reachability.framework` to `Input Files` of Run Script Phase for Carthage.\n\n6. In your code import Reachability like so:\n`import Reachability`\n\n\n[Carthage]: https://github.com/Carthage/Carthage\n[Homebrew]: http://brew.sh\n[Photo Flipper]: https://itunes.apple.com/app/apple-store/id749627884?pt=215893&ct=GitHubReachability&mt=8\n\n## Example - closures\n\nNOTE: All closures are run on the **main queue**.\n\n```swift\n//declare this property where it won't go out of scope relative to your listener\nlet reachability = Reachability()!\n\nreachability.whenReachable = { reachability in\n    if reachability.connection == .wifi {\n        print(\"Reachable via WiFi\")\n    } else {\n        print(\"Reachable via Cellular\")\n    }\n}\nreachability.whenUnreachable = { _ in\n    print(\"Not reachable\")\n}\n\ndo {\n    try reachability.startNotifier()\n} catch {\n    print(\"Unable to start notifier\")\n}\n```\n\nand for stopping notifications\n\n```swift\nreachability.stopNotifier()\n```\n\n## Example - notifications\n\nNOTE: All notifications are delivered on the **main queue**.\n\n```swift\n//declare this property where it won't go out of scope relative to your listener\nlet reachability = Reachability()!\n\n//declare this inside of viewWillAppear\n\n     NotificationCenter.default.addObserver(self, selector: #selector(reachabilityChanged(note:)), name: .reachabilityChanged, object: reachability)\n    do{\n      try reachability.startNotifier()\n    }catch{\n      print(\"could not start reachability notifier\")\n    }\n```\n\nand\n\n```swift\n@objc func reachabilityChanged(note: Notification) {\n\n  let reachability = note.object as! Reachability\n\n  switch reachability.connection {\n  case .wifi:\n      print(\"Reachable via WiFi\")\n  case .cellular:\n      print(\"Reachable via Cellular\")\n  case .unavailable:\n    print(\"Network not reachable\")\n  }\n}\n```\n\nand for stopping notifications\n\n```swift\nreachability.stopNotifier()\nNotificationCenter.default.removeObserver(self, name: .reachabilityChanged, object: reachability)\n```\n\n## Want to help?\n\nGot a bug fix, or a new feature? Create a pull request and go for it!\n\n## Let me know!\n\nIf you use **Reachability.swift**, please let me know about your app and I'll put a link [here…](https://github.com/ashleymills/Reachability.swift/wiki/Apps-using-Reachability.swift) and tell your friends!\n\nCheers,\nAsh\n"
  },
  {
    "path": "JetChat/Pods/ReachabilitySwift/Sources/Reachability.swift",
    "content": "/*\nCopyright (c) 2014, Ashley Mills\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\nthis list of conditions and the following disclaimer in the documentation\nand/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n*/\n\nimport SystemConfiguration\nimport Foundation\n\npublic enum ReachabilityError: Error {\n    case failedToCreateWithAddress(sockaddr, Int32)\n    case failedToCreateWithHostname(String, Int32)\n    case unableToSetCallback(Int32)\n    case unableToSetDispatchQueue(Int32)\n    case unableToGetFlags(Int32)\n}\n\n@available(*, unavailable, renamed: \"Notification.Name.reachabilityChanged\")\npublic let ReachabilityChangedNotification = NSNotification.Name(\"ReachabilityChangedNotification\")\n\npublic extension Notification.Name {\n    static let reachabilityChanged = Notification.Name(\"reachabilityChanged\")\n}\n\npublic class Reachability {\n\n    public typealias NetworkReachable = (Reachability) -> ()\n    public typealias NetworkUnreachable = (Reachability) -> ()\n\n    @available(*, unavailable, renamed: \"Connection\")\n    public enum NetworkStatus: CustomStringConvertible {\n        case notReachable, reachableViaWiFi, reachableViaWWAN\n        public var description: String {\n            switch self {\n            case .reachableViaWWAN: return \"Cellular\"\n            case .reachableViaWiFi: return \"WiFi\"\n            case .notReachable: return \"No Connection\"\n            }\n        }\n    }\n\n    public enum Connection: CustomStringConvertible {\n        @available(*, deprecated, renamed: \"unavailable\")\n        case none\n        case unavailable, wifi, cellular\n        public var description: String {\n            switch self {\n            case .cellular: return \"Cellular\"\n            case .wifi: return \"WiFi\"\n            case .unavailable: return \"No Connection\"\n            case .none: return \"unavailable\"\n            }\n        }\n    }\n\n    public var whenReachable: NetworkReachable?\n    public var whenUnreachable: NetworkUnreachable?\n\n    @available(*, deprecated, renamed: \"allowsCellularConnection\")\n    public let reachableOnWWAN: Bool = true\n\n    /// Set to `false` to force Reachability.connection to .none when on cellular connection (default value `true`)\n    public var allowsCellularConnection: Bool\n\n    // The notification center on which \"reachability changed\" events are being posted\n    public var notificationCenter: NotificationCenter = NotificationCenter.default\n\n    @available(*, deprecated, renamed: \"connection.description\")\n    public var currentReachabilityString: String {\n        return \"\\(connection)\"\n    }\n\n    @available(*, unavailable, renamed: \"connection\")\n    public var currentReachabilityStatus: Connection {\n        return connection\n    }\n\n    public var connection: Connection {\n        if flags == nil {\n            try? setReachabilityFlags()\n        }\n        \n        switch flags?.connection {\n        case .unavailable?, nil: return .unavailable\n        case .none?: return .unavailable\n        case .cellular?: return allowsCellularConnection ? .cellular : .unavailable\n        case .wifi?: return .wifi\n        }\n    }\n\n    fileprivate var isRunningOnDevice: Bool = {\n        #if targetEnvironment(simulator)\n            return false\n        #else\n            return true\n        #endif\n    }()\n\n    fileprivate(set) var notifierRunning = false\n    fileprivate let reachabilityRef: SCNetworkReachability\n    fileprivate let reachabilitySerialQueue: DispatchQueue\n    fileprivate let notificationQueue: DispatchQueue?\n    fileprivate(set) var flags: SCNetworkReachabilityFlags? {\n        didSet {\n            guard flags != oldValue else { return }\n            notifyReachabilityChanged()\n        }\n    }\n\n    required public init(reachabilityRef: SCNetworkReachability,\n                         queueQoS: DispatchQoS = .default,\n                         targetQueue: DispatchQueue? = nil,\n                         notificationQueue: DispatchQueue? = .main) {\n        self.allowsCellularConnection = true\n        self.reachabilityRef = reachabilityRef\n        self.reachabilitySerialQueue = DispatchQueue(label: \"uk.co.ashleymills.reachability\", qos: queueQoS, target: targetQueue)\n        self.notificationQueue = notificationQueue\n    }\n\n    public convenience init(hostname: String,\n                            queueQoS: DispatchQoS = .default,\n                            targetQueue: DispatchQueue? = nil,\n                            notificationQueue: DispatchQueue? = .main) throws {\n        guard let ref = SCNetworkReachabilityCreateWithName(nil, hostname) else {\n            throw ReachabilityError.failedToCreateWithHostname(hostname, SCError())\n        }\n        self.init(reachabilityRef: ref, queueQoS: queueQoS, targetQueue: targetQueue, notificationQueue: notificationQueue)\n    }\n\n    public convenience init(queueQoS: DispatchQoS = .default,\n                            targetQueue: DispatchQueue? = nil,\n                            notificationQueue: DispatchQueue? = .main) throws {\n        var zeroAddress = sockaddr()\n        zeroAddress.sa_len = UInt8(MemoryLayout<sockaddr>.size)\n        zeroAddress.sa_family = sa_family_t(AF_INET)\n\n        guard let ref = SCNetworkReachabilityCreateWithAddress(nil, &zeroAddress) else {\n            throw ReachabilityError.failedToCreateWithAddress(zeroAddress, SCError())\n        }\n\n        self.init(reachabilityRef: ref, queueQoS: queueQoS, targetQueue: targetQueue, notificationQueue: notificationQueue)\n    }\n\n    deinit {\n        stopNotifier()\n    }\n}\n\npublic extension Reachability {\n\n    // MARK: - *** Notifier methods ***\n    func startNotifier() throws {\n        guard !notifierRunning else { return }\n\n        let callback: SCNetworkReachabilityCallBack = { (reachability, flags, info) in\n            guard let info = info else { return }\n\n            // `weakifiedReachability` is guaranteed to exist by virtue of our\n            // retain/release callbacks which we provided to the `SCNetworkReachabilityContext`.\n            let weakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info).takeUnretainedValue()\n\n            // The weak `reachability` _may_ no longer exist if the `Reachability`\n            // object has since been deallocated but a callback was already in flight.\n            weakifiedReachability.reachability?.flags = flags\n        }\n\n        let weakifiedReachability = ReachabilityWeakifier(reachability: self)\n        let opaqueWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.passUnretained(weakifiedReachability).toOpaque()\n\n        var context = SCNetworkReachabilityContext(\n            version: 0,\n            info: UnsafeMutableRawPointer(opaqueWeakifiedReachability),\n            retain: { (info: UnsafeRawPointer) -> UnsafeRawPointer in\n                let unmanagedWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info)\n                _ = unmanagedWeakifiedReachability.retain()\n                return UnsafeRawPointer(unmanagedWeakifiedReachability.toOpaque())\n            },\n            release: { (info: UnsafeRawPointer) -> Void in\n                let unmanagedWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info)\n                unmanagedWeakifiedReachability.release()\n            },\n            copyDescription: { (info: UnsafeRawPointer) -> Unmanaged<CFString> in\n                let unmanagedWeakifiedReachability = Unmanaged<ReachabilityWeakifier>.fromOpaque(info)\n                let weakifiedReachability = unmanagedWeakifiedReachability.takeUnretainedValue()\n                let description = weakifiedReachability.reachability?.description ?? \"nil\"\n                return Unmanaged.passRetained(description as CFString)\n            }\n        )\n\n        if !SCNetworkReachabilitySetCallback(reachabilityRef, callback, &context) {\n            stopNotifier()\n            throw ReachabilityError.unableToSetCallback(SCError())\n        }\n\n        if !SCNetworkReachabilitySetDispatchQueue(reachabilityRef, reachabilitySerialQueue) {\n            stopNotifier()\n            throw ReachabilityError.unableToSetDispatchQueue(SCError())\n        }\n\n        // Perform an initial check\n        try setReachabilityFlags()\n\n        notifierRunning = true\n    }\n\n    func stopNotifier() {\n        defer { notifierRunning = false }\n\n        SCNetworkReachabilitySetCallback(reachabilityRef, nil, nil)\n        SCNetworkReachabilitySetDispatchQueue(reachabilityRef, nil)\n    }\n\n    // MARK: - *** Connection test methods ***\n    @available(*, deprecated, message: \"Please use `connection != .none`\")\n    var isReachable: Bool {\n        return connection != .unavailable\n    }\n\n    @available(*, deprecated, message: \"Please use `connection == .cellular`\")\n    var isReachableViaWWAN: Bool {\n        // Check we're not on the simulator, we're REACHABLE and check we're on WWAN\n        return connection == .cellular\n    }\n\n   @available(*, deprecated, message: \"Please use `connection == .wifi`\")\n    var isReachableViaWiFi: Bool {\n        return connection == .wifi\n    }\n\n    var description: String {\n        return flags?.description ?? \"unavailable flags\"\n    }\n}\n\nfileprivate extension Reachability {\n\n    func setReachabilityFlags() throws {\n        try reachabilitySerialQueue.sync { [unowned self] in\n            var flags = SCNetworkReachabilityFlags()\n            if !SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags) {\n                self.stopNotifier()\n                throw ReachabilityError.unableToGetFlags(SCError())\n            }\n            \n            self.flags = flags\n        }\n    }\n    \n\n    func notifyReachabilityChanged() {\n        let notify = { [weak self] in\n            guard let self = self else { return }\n            self.connection != .unavailable ? self.whenReachable?(self) : self.whenUnreachable?(self)\n            self.notificationCenter.post(name: .reachabilityChanged, object: self)\n        }\n\n        // notify on the configured `notificationQueue`, or the caller's (i.e. `reachabilitySerialQueue`)\n        notificationQueue?.async(execute: notify) ?? notify()\n    }\n}\n\nextension SCNetworkReachabilityFlags {\n\n    typealias Connection = Reachability.Connection\n\n    var connection: Connection {\n        guard isReachableFlagSet else { return .unavailable }\n\n        // If we're reachable, but not on an iOS device (i.e. simulator), we must be on WiFi\n        #if targetEnvironment(simulator)\n        return .wifi\n        #else\n        var connection = Connection.unavailable\n\n        if !isConnectionRequiredFlagSet {\n            connection = .wifi\n        }\n\n        if isConnectionOnTrafficOrDemandFlagSet {\n            if !isInterventionRequiredFlagSet {\n                connection = .wifi\n            }\n        }\n\n        if isOnWWANFlagSet {\n            connection = .cellular\n        }\n\n        return connection\n        #endif\n    }\n\n    var isOnWWANFlagSet: Bool {\n        #if os(iOS)\n        return contains(.isWWAN)\n        #else\n        return false\n        #endif\n    }\n    var isReachableFlagSet: Bool {\n        return contains(.reachable)\n    }\n    var isConnectionRequiredFlagSet: Bool {\n        return contains(.connectionRequired)\n    }\n    var isInterventionRequiredFlagSet: Bool {\n        return contains(.interventionRequired)\n    }\n    var isConnectionOnTrafficFlagSet: Bool {\n        return contains(.connectionOnTraffic)\n    }\n    var isConnectionOnDemandFlagSet: Bool {\n        return contains(.connectionOnDemand)\n    }\n    var isConnectionOnTrafficOrDemandFlagSet: Bool {\n        return !intersection([.connectionOnTraffic, .connectionOnDemand]).isEmpty\n    }\n    var isTransientConnectionFlagSet: Bool {\n        return contains(.transientConnection)\n    }\n    var isLocalAddressFlagSet: Bool {\n        return contains(.isLocalAddress)\n    }\n    var isDirectFlagSet: Bool {\n        return contains(.isDirect)\n    }\n    var isConnectionRequiredAndTransientFlagSet: Bool {\n        return intersection([.connectionRequired, .transientConnection]) == [.connectionRequired, .transientConnection]\n    }\n\n    var description: String {\n        let W = isOnWWANFlagSet ? \"W\" : \"-\"\n        let R = isReachableFlagSet ? \"R\" : \"-\"\n        let c = isConnectionRequiredFlagSet ? \"c\" : \"-\"\n        let t = isTransientConnectionFlagSet ? \"t\" : \"-\"\n        let i = isInterventionRequiredFlagSet ? \"i\" : \"-\"\n        let C = isConnectionOnTrafficFlagSet ? \"C\" : \"-\"\n        let D = isConnectionOnDemandFlagSet ? \"D\" : \"-\"\n        let l = isLocalAddressFlagSet ? \"l\" : \"-\"\n        let d = isDirectFlagSet ? \"d\" : \"-\"\n\n        return \"\\(W)\\(R) \\(c)\\(t)\\(i)\\(C)\\(D)\\(l)\\(d)\"\n    }\n}\n\n/**\n `ReachabilityWeakifier` weakly wraps the `Reachability` class\n in order to break retain cycles when interacting with CoreFoundation.\n\n CoreFoundation callbacks expect a pair of retain/release whenever an\n opaque `info` parameter is provided. These callbacks exist to guard\n against memory management race conditions when invoking the callbacks.\n\n #### Race Condition\n\n If we passed `SCNetworkReachabilitySetCallback` a direct reference to our\n `Reachability` class without also providing corresponding retain/release\n callbacks, then a race condition can lead to crashes when:\n - `Reachability` is deallocated on thread X\n - A `SCNetworkReachability` callback(s) is already in flight on thread Y\n\n #### Retain Cycle\n\n If we pass `Reachability` to CoreFoundtion while also providing retain/\n release callbacks, we would create a retain cycle once CoreFoundation\n retains our `Reachability` class. This fixes the crashes and his how\n CoreFoundation expects the API to be used, but doesn't play nicely with\n Swift/ARC. This cycle would only be broken after manually calling\n `stopNotifier()` — `deinit` would never be called.\n\n #### ReachabilityWeakifier\n\n By providing both retain/release callbacks and wrapping `Reachability` in\n a weak wrapper, we:\n - interact correctly with CoreFoundation, thereby avoiding a crash.\n See \"Memory Management Programming Guide for Core Foundation\".\n - don't alter the public API of `Reachability.swift` in any way\n - still allow for automatic stopping of the notifier on `deinit`.\n */\nprivate class ReachabilityWeakifier {\n    weak var reachability: Reachability?\n    init(reachability: Reachability) {\n        self.reachability = reachability\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/ReachabilitySwift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t01CD1EDA7E57C97906ADE5964B0910F6 /* ReachabilitySwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = AC6C6CFA3000B2D74897C5D2DD471762 /* ReachabilitySwift-dummy.m */; };\n\t\t84F68FC89F423DBC6C21B0F84BB5AEDF /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA696B5637595F81FD13D907D4F78F7 /* Reachability.swift */; };\n\t\t8931A2D6A5F9BED6C18623CFF4BEE7B6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D32CCE574946C4E7500B01AF98B4252 /* Foundation.framework */; };\n\t\t8D68BEE088299DCD3EB7FAD69915D2EB /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BD0A9A85A3FCE0671509CC9AE79B6823 /* SystemConfiguration.framework */; };\n\t\t8E05891A4FE392B3B8930AA82032447B /* ReachabilitySwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 110FFED695F4EA03F5BC65A329FE8FE8 /* ReachabilitySwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB0431E9C78BFE6CAB37E09BB3A06A69B /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFEA48ECD4F43A2D24DEB0757BF87FB3 /* CoreTelephony.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t110FFED695F4EA03F5BC65A329FE8FE8 /* ReachabilitySwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"ReachabilitySwift-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t185105C5AD318DA1B77778AB3DA8FF2C /* ReachabilitySwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = ReachabilitySwift.modulemap; sourceTree = \"<group>\"; };\n\t\t1C88F27212A758844644A2D33A27E0C4 /* ReachabilitySwift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = ReachabilitySwift; path = Reachability.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t5D32CCE574946C4E7500B01AF98B4252 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t687776155C4F788053D389E9E8EB6377 /* ReachabilitySwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = ReachabilitySwift.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tAC6C6CFA3000B2D74897C5D2DD471762 /* ReachabilitySwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"ReachabilitySwift-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tBD0A9A85A3FCE0671509CC9AE79B6823 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = DEVELOPER_DIR; };\n\t\tBFEA48ECD4F43A2D24DEB0757BF87FB3 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreTelephony.framework; sourceTree = DEVELOPER_DIR; };\n\t\tC59285C666B48ACBBD00314517E2A88E /* ReachabilitySwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"ReachabilitySwift-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tCEA696B5637595F81FD13D907D4F78F7 /* Reachability.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Reachability.swift; path = Sources/Reachability.swift; sourceTree = \"<group>\"; };\n\t\tD4A0922B45BB3F8071269ED265846AA5 /* ReachabilitySwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = ReachabilitySwift.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tD93A25026F8B01BA041F5A3814703E11 /* ReachabilitySwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"ReachabilitySwift-Info.plist\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t3C0640714DE05F6D3C72B7DD4C9F9CFB /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB0431E9C78BFE6CAB37E09BB3A06A69B /* CoreTelephony.framework in Frameworks */,\n\t\t\t\t8931A2D6A5F9BED6C18623CFF4BEE7B6 /* Foundation.framework in Frameworks */,\n\t\t\t\t8D68BEE088299DCD3EB7FAD69915D2EB /* SystemConfiguration.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t177DC929419C3ECD41CE7A7BC8AE7298 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t185105C5AD318DA1B77778AB3DA8FF2C /* ReachabilitySwift.modulemap */,\n\t\t\t\tAC6C6CFA3000B2D74897C5D2DD471762 /* ReachabilitySwift-dummy.m */,\n\t\t\t\tD93A25026F8B01BA041F5A3814703E11 /* ReachabilitySwift-Info.plist */,\n\t\t\t\tC59285C666B48ACBBD00314517E2A88E /* ReachabilitySwift-prefix.pch */,\n\t\t\t\t110FFED695F4EA03F5BC65A329FE8FE8 /* ReachabilitySwift-umbrella.h */,\n\t\t\t\tD4A0922B45BB3F8071269ED265846AA5 /* ReachabilitySwift.debug.xcconfig */,\n\t\t\t\t687776155C4F788053D389E9E8EB6377 /* ReachabilitySwift.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/ReachabilitySwift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1B7F44A38EBDA5628B0C2C85A433808A = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE5D78BB6C542A315DB038ED0EC7A0E5F /* Frameworks */,\n\t\t\t\tDB7FCBACC30A5F71DBC3E29843AA5E69 /* Products */,\n\t\t\t\tF7EC0502B22FA2221FDFECD065685EA7 /* ReachabilitySwift */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t80DDF05F30B8ACBF29668CCCCBCB85FD /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBFEA48ECD4F43A2D24DEB0757BF87FB3 /* CoreTelephony.framework */,\n\t\t\t\t5D32CCE574946C4E7500B01AF98B4252 /* Foundation.framework */,\n\t\t\t\tBD0A9A85A3FCE0671509CC9AE79B6823 /* SystemConfiguration.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDB7FCBACC30A5F71DBC3E29843AA5E69 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1C88F27212A758844644A2D33A27E0C4 /* ReachabilitySwift */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE5D78BB6C542A315DB038ED0EC7A0E5F /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t80DDF05F30B8ACBF29668CCCCBCB85FD /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF7EC0502B22FA2221FDFECD065685EA7 /* ReachabilitySwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tCEA696B5637595F81FD13D907D4F78F7 /* Reachability.swift */,\n\t\t\t\t177DC929419C3ECD41CE7A7BC8AE7298 /* Support Files */,\n\t\t\t);\n\t\t\tname = ReachabilitySwift;\n\t\t\tpath = ReachabilitySwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tE2C80CCE896005BA72B96A51772F457B /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t8E05891A4FE392B3B8930AA82032447B /* ReachabilitySwift-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t02AAC45BCBE8F4C196016B6D96C7A992 /* ReachabilitySwift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 0494A6CB46A5367AEE58E0611EAB1599 /* Build configuration list for PBXNativeTarget \"ReachabilitySwift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE2C80CCE896005BA72B96A51772F457B /* Headers */,\n\t\t\t\tC85BE21108523B3A772BDD91A4862CFF /* Sources */,\n\t\t\t\t3C0640714DE05F6D3C72B7DD4C9F9CFB /* Frameworks */,\n\t\t\t\t984495E9FEB5E24CE92D8043B7CD9126 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = ReachabilitySwift;\n\t\t\tproductName = Reachability;\n\t\t\tproductReference = 1C88F27212A758844644A2D33A27E0C4 /* ReachabilitySwift */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t1708B285359A2088AFDF81A03009D27F /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = A51B311C4D5D3C71C913DE9FF391CD1C /* Build configuration list for PBXProject \"ReachabilitySwift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 1B7F44A38EBDA5628B0C2C85A433808A;\n\t\t\tproductRefGroup = DB7FCBACC30A5F71DBC3E29843AA5E69 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t02AAC45BCBE8F4C196016B6D96C7A992 /* ReachabilitySwift */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t984495E9FEB5E24CE92D8043B7CD9126 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tC85BE21108523B3A772BDD91A4862CFF /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t84F68FC89F423DBC6C21B0F84BB5AEDF /* Reachability.swift in Sources */,\n\t\t\t\t01CD1EDA7E57C97906ADE5964B0910F6 /* ReachabilitySwift-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t1E65F0B2CD0AF3B39460442A45347031 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = D4A0922B45BB3F8071269ED265846AA5 /* ReachabilitySwift.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/ReachabilitySwift/ReachabilitySwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/ReachabilitySwift/ReachabilitySwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/ReachabilitySwift/ReachabilitySwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Reachability;\n\t\t\t\tPRODUCT_NAME = Reachability;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t227C0C4BEE65FC0E2B4F4AD78F11E93B /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD4EA4F9E0AF98D6AD03F3B5DD49859EB /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDC8A54872B99A2914754A6D4E5E5AC0A /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 687776155C4F788053D389E9E8EB6377 /* ReachabilitySwift.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/ReachabilitySwift/ReachabilitySwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/ReachabilitySwift/ReachabilitySwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/ReachabilitySwift/ReachabilitySwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = Reachability;\n\t\t\t\tPRODUCT_NAME = Reachability;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t0494A6CB46A5367AEE58E0611EAB1599 /* Build configuration list for PBXNativeTarget \"ReachabilitySwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t1E65F0B2CD0AF3B39460442A45347031 /* Debug */,\n\t\t\t\tDC8A54872B99A2914754A6D4E5E5AC0A /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tA51B311C4D5D3C71C913DE9FF391CD1C /* Build configuration list for PBXProject \"ReachabilitySwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD4EA4F9E0AF98D6AD03F3B5DD49859EB /* Debug */,\n\t\t\t\t227C0C4BEE65FC0E2B4F4AD78F11E93B /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 1708B285359A2088AFDF81A03009D27F /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/LICENSE.md",
    "content": "**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/DataStructures/Bag.swift",
    "content": "//\n//  Bag.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 2/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Swift\n\nlet arrayDictionaryMaxSize = 30\n\nstruct BagKey {\n    /**\n    Unique identifier for object added to `Bag`.\n     \n    It's underlying type is UInt64. If we assume there in an idealized CPU that works at 4GHz,\n     it would take ~150 years of continuous running time for it to overflow.\n    */\n    fileprivate let rawValue: UInt64\n}\n\n/**\nData structure that represents a bag of elements typed `T`.\n\nSingle element can be stored multiple times.\n\nTime and space complexity of insertion and deletion is O(n). \n\nIt is suitable for storing small number of elements.\n*/\nstruct Bag<T> : CustomDebugStringConvertible {\n    /// Type of identifier for inserted elements.\n    typealias KeyType = BagKey\n    \n    typealias Entry = (key: BagKey, value: T)\n \n    private var _nextKey: BagKey = BagKey(rawValue: 0)\n\n    // data\n\n    // first fill inline variables\n    var _key0: BagKey?\n    var _value0: T?\n\n    // then fill \"array dictionary\"\n    var _pairs = ContiguousArray<Entry>()\n\n    // last is sparse dictionary\n    var _dictionary: [BagKey: T]?\n\n    var _onlyFastPath = true\n\n    /// Creates new empty `Bag`.\n    init() {\n    }\n    \n    /**\n    Inserts `value` into bag.\n    \n    - parameter element: Element to insert.\n    - returns: Key that can be used to remove element from bag.\n    */\n    mutating func insert(_ element: T) -> BagKey {\n        let key = _nextKey\n\n        _nextKey = BagKey(rawValue: _nextKey.rawValue &+ 1)\n\n        if _key0 == nil {\n            _key0 = key\n            _value0 = element\n            return key\n        }\n\n        _onlyFastPath = false\n\n        if _dictionary != nil {\n            _dictionary![key] = element\n            return key\n        }\n\n        if _pairs.count < arrayDictionaryMaxSize {\n            _pairs.append((key: key, value: element))\n            return key\n        }\n        \n        _dictionary = [key: element]\n        \n        return key\n    }\n    \n    /// - returns: Number of elements in bag.\n    var count: Int {\n        let dictionaryCount: Int = _dictionary?.count ?? 0\n        return (_value0 != nil ? 1 : 0) + _pairs.count + dictionaryCount\n    }\n    \n    /// Removes all elements from bag and clears capacity.\n    mutating func removeAll() {\n        _key0 = nil\n        _value0 = nil\n\n        _pairs.removeAll(keepingCapacity: false)\n        _dictionary?.removeAll(keepingCapacity: false)\n    }\n    \n    /**\n    Removes element with a specific `key` from bag.\n    \n    - parameter key: Key that identifies element to remove from bag.\n    - returns: Element that bag contained, or nil in case element was already removed.\n    */\n    mutating func removeKey(_ key: BagKey) -> T? {\n        if _key0 == key {\n            _key0 = nil\n            let value = _value0!\n            _value0 = nil\n            return value\n        }\n\n        if let existingObject = _dictionary?.removeValue(forKey: key) {\n            return existingObject\n        }\n\n        for i in 0 ..< _pairs.count where _pairs[i].key == key {\n            let value = _pairs[i].value\n            _pairs.remove(at: i)\n            return value\n        }\n\n        return nil\n    }\n}\n\nextension Bag {\n    /// A textual representation of `self`, suitable for debugging.\n    var debugDescription : String {\n        \"\\(self.count) elements in Bag\"\n    }\n}\n\nextension Bag {\n    /// Enumerates elements inside the bag.\n    ///\n    /// - parameter action: Enumeration closure.\n    func forEach(_ action: (T) -> Void) {\n        if _onlyFastPath {\n            if let value0 = _value0 {\n                action(value0)\n            }\n            return\n        }\n\n        let value0 = _value0\n        let dictionary = _dictionary\n\n        if let value0 = value0 {\n            action(value0)\n        }\n\n        for i in 0 ..< _pairs.count {\n            action(_pairs[i].value)\n        }\n\n        if dictionary?.count ?? 0 > 0 {\n            for element in dictionary!.values {\n                action(element)\n            }\n        }\n    }\n}\n\nextension BagKey: Hashable {\n    func hash(into hasher: inout Hasher) {\n        hasher.combine(rawValue)\n    }\n}\n\nfunc ==(lhs: BagKey, rhs: BagKey) -> Bool {\n    lhs.rawValue == rhs.rawValue\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/DataStructures/InfiniteSequence.swift",
    "content": "//\n//  InfiniteSequence.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 6/13/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Sequence that repeats `repeatedValue` infinite number of times.\nstruct InfiniteSequence<Element> : Sequence {\n    typealias Iterator = AnyIterator<Element>\n    \n    private let repeatedValue: Element\n    \n    init(repeatedValue: Element) {\n        self.repeatedValue = repeatedValue\n    }\n    \n    func makeIterator() -> Iterator {\n        let repeatedValue = self.repeatedValue\n        return AnyIterator { repeatedValue }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/DataStructures/PriorityQueue.swift",
    "content": "//\n//  PriorityQueue.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/27/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nstruct PriorityQueue<Element> {\n    private let hasHigherPriority: (Element, Element) -> Bool\n    private let isEqual: (Element, Element) -> Bool\n\n    private var elements = [Element]()\n\n    init(hasHigherPriority: @escaping (Element, Element) -> Bool, isEqual: @escaping (Element, Element) -> Bool) {\n        self.hasHigherPriority = hasHigherPriority\n        self.isEqual = isEqual\n    }\n\n    mutating func enqueue(_ element: Element) {\n        elements.append(element)\n        bubbleToHigherPriority(elements.count - 1)\n    }\n\n    func peek() -> Element? {\n        elements.first\n    }\n\n    var isEmpty: Bool {\n        elements.count == 0\n    }\n\n    mutating func dequeue() -> Element? {\n        guard let front = peek() else {\n            return nil\n        }\n\n        removeAt(0)\n\n        return front\n    }\n\n    mutating func remove(_ element: Element) {\n        for i in 0 ..< elements.count {\n            if self.isEqual(elements[i], element) {\n                removeAt(i)\n                return\n            }\n        }\n    }\n\n    private mutating func removeAt(_ index: Int) {\n        let removingLast = index == elements.count - 1\n        if !removingLast {\n            elements.swapAt(index, elements.count - 1)\n        }\n\n        _ = elements.popLast()\n\n        if !removingLast {\n            bubbleToHigherPriority(index)\n            bubbleToLowerPriority(index)\n        }\n    }\n\n    private mutating func bubbleToHigherPriority(_ initialUnbalancedIndex: Int) {\n        precondition(initialUnbalancedIndex >= 0)\n        precondition(initialUnbalancedIndex < elements.count)\n\n        var unbalancedIndex = initialUnbalancedIndex\n\n        while unbalancedIndex > 0 {\n            let parentIndex = (unbalancedIndex - 1) / 2\n            guard self.hasHigherPriority(elements[unbalancedIndex], elements[parentIndex]) else { break }\n            elements.swapAt(unbalancedIndex, parentIndex)\n            unbalancedIndex = parentIndex\n        }\n    }\n\n    private mutating func bubbleToLowerPriority(_ initialUnbalancedIndex: Int) {\n        precondition(initialUnbalancedIndex >= 0)\n        precondition(initialUnbalancedIndex < elements.count)\n\n        var unbalancedIndex = initialUnbalancedIndex\n        while true {\n            let leftChildIndex = unbalancedIndex * 2 + 1\n            let rightChildIndex = unbalancedIndex * 2 + 2\n\n            var highestPriorityIndex = unbalancedIndex\n\n            if leftChildIndex < elements.count && self.hasHigherPriority(elements[leftChildIndex], elements[highestPriorityIndex]) {\n                highestPriorityIndex = leftChildIndex\n            }\n\n            if rightChildIndex < elements.count && self.hasHigherPriority(elements[rightChildIndex], elements[highestPriorityIndex]) {\n                highestPriorityIndex = rightChildIndex\n            }\n\n            guard highestPriorityIndex != unbalancedIndex else { break }\n            elements.swapAt(highestPriorityIndex, unbalancedIndex)\n\n            unbalancedIndex = highestPriorityIndex\n        }\n    }\n}\n\nextension PriorityQueue : CustomDebugStringConvertible {\n    var debugDescription: String {\n        elements.debugDescription\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/DataStructures/Queue.swift",
    "content": "//\n//  Queue.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 3/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/**\nData structure that represents queue.\n\nComplexity of `enqueue`, `dequeue` is O(1) when number of operations is\naveraged over N operations.\n\nComplexity of `peek` is O(1).\n*/\nstruct Queue<T>: Sequence {\n    /// Type of generator.\n    typealias Generator = AnyIterator<T>\n\n    private let resizeFactor = 2\n    \n    private var storage: ContiguousArray<T?>\n    private var innerCount = 0\n    private var pushNextIndex = 0\n    private let initialCapacity: Int\n\n    /**\n    Creates new queue.\n    \n    - parameter capacity: Capacity of newly created queue.\n    */\n    init(capacity: Int) {\n        initialCapacity = capacity\n\n        storage = ContiguousArray<T?>(repeating: nil, count: capacity)\n    }\n    \n    private var dequeueIndex: Int {\n        let index = pushNextIndex - count\n        return index < 0 ? index + storage.count : index\n    }\n    \n    /// - returns: Is queue empty.\n    var isEmpty: Bool { count == 0 }\n    \n    /// - returns: Number of elements inside queue.\n    var count: Int { innerCount }\n    \n    /// - returns: Element in front of a list of elements to `dequeue`.\n    func peek() -> T {\n        precondition(count > 0)\n        \n        return storage[dequeueIndex]!\n    }\n    \n    mutating private func resizeTo(_ size: Int) {\n        var newStorage = ContiguousArray<T?>(repeating: nil, count: size)\n        \n        let count = self.count\n        \n        let dequeueIndex = self.dequeueIndex\n        let spaceToEndOfQueue = storage.count - dequeueIndex\n        \n        // first batch is from dequeue index to end of array\n        let countElementsInFirstBatch = Swift.min(count, spaceToEndOfQueue)\n        // second batch is wrapped from start of array to end of queue\n        let numberOfElementsInSecondBatch = count - countElementsInFirstBatch\n        \n        newStorage[0 ..< countElementsInFirstBatch] = storage[dequeueIndex ..< (dequeueIndex + countElementsInFirstBatch)]\n        newStorage[countElementsInFirstBatch ..< (countElementsInFirstBatch + numberOfElementsInSecondBatch)] = storage[0 ..< numberOfElementsInSecondBatch]\n        \n        self.innerCount = count\n        pushNextIndex = count\n        storage = newStorage\n    }\n    \n    /// Enqueues `element`.\n    ///\n    /// - parameter element: Element to enqueue.\n    mutating func enqueue(_ element: T) {\n        if count == storage.count {\n            resizeTo(Swift.max(storage.count, 1) * resizeFactor)\n        }\n        \n        storage[pushNextIndex] = element\n        pushNextIndex += 1\n        innerCount += 1\n        \n        if pushNextIndex >= storage.count {\n            pushNextIndex -= storage.count\n        }\n    }\n    \n    private mutating func dequeueElementOnly() -> T {\n        precondition(count > 0)\n        \n        let index = dequeueIndex\n\n        defer {\n            storage[index] = nil\n            innerCount -= 1\n        }\n\n        return storage[index]!\n    }\n\n    /// Dequeues element or throws an exception in case queue is empty.\n    ///\n    /// - returns: Dequeued element.\n    mutating func dequeue() -> T? {\n        if self.count == 0 {\n            return nil\n        }\n\n        defer {\n            let downsizeLimit = storage.count / (resizeFactor * resizeFactor)\n            if count < downsizeLimit && downsizeLimit >= initialCapacity {\n                resizeTo(storage.count / resizeFactor)\n            }\n        }\n\n        return dequeueElementOnly()\n    }\n    \n    /// - returns: Generator of contained elements.\n    func makeIterator() -> AnyIterator<T> {\n        var i = dequeueIndex\n        var innerCount = count\n\n        return AnyIterator {\n            if innerCount == 0 {\n                return nil\n            }\n\n            defer {\n                innerCount -= 1\n                i += 1\n            }\n\n            if i >= self.storage.count {\n                i -= self.storage.count\n            }\n\n            return self.storage[i]\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/DispatchQueue+Extensions.swift",
    "content": "//\n//  DispatchQueue+Extensions.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 10/22/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\n\nextension DispatchQueue {\n    private static var token: DispatchSpecificKey<()> = {\n        let key = DispatchSpecificKey<()>()\n        DispatchQueue.main.setSpecific(key: key, value: ())\n        return key\n    }()\n\n    static var isMain: Bool {\n        DispatchQueue.getSpecific(key: token) != nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/Platform.Darwin.swift",
    "content": "//\n//  Platform.Darwin.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)\n\n    import Darwin\n    import Foundation\n\n    extension Thread {\n        static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: NSCopying) {\n            let currentThread = Thread.current\n            let threadDictionary = currentThread.threadDictionary\n\n            if let newValue = value {\n                threadDictionary[key] = newValue\n            }\n            else {\n                threadDictionary[key] = nil\n            }\n        }\n\n        static func getThreadLocalStorageValueForKey<T>(_ key: NSCopying) -> T? {\n            let currentThread = Thread.current\n            let threadDictionary = currentThread.threadDictionary\n            \n            return threadDictionary[key] as? T\n        }\n    }\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/Platform.Linux.swift",
    "content": "//\n//  Platform.Linux.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(Linux)\n\n    import Foundation\n\n    extension Thread {\n\n        static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: String) {\n            if let newValue = value {\n                Thread.current.threadDictionary[key] = newValue\n            }\n            else {\n                Thread.current.threadDictionary[key] = nil\n            }\n        }\n\n        static func getThreadLocalStorageValueForKey<T: AnyObject>(_ key: String) -> T? {\n            let currentThread = Thread.current\n            let threadDictionary = currentThread.threadDictionary\n\n            return threadDictionary[key] as? T\n        }\n    }\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/Platform/RecursiveLock.swift",
    "content": "//\n//  RecursiveLock.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/18/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n#if TRACE_RESOURCES\n    class RecursiveLock: NSRecursiveLock {\n        override init() {\n            _ = Resources.incrementTotal()\n            super.init()\n        }\n\n        override func lock() {\n            super.lock()\n            _ = Resources.incrementTotal()\n        }\n\n        override func unlock() {\n            super.unlock()\n            _ = Resources.decrementTotal()\n        }\n\n        deinit {\n            _ = Resources.decrementTotal()\n        }\n    }\n#else\n    typealias RecursiveLock = NSRecursiveLock\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/README.md",
    "content": "<p align=\"center\">\n<img src=\"assets/RxSwift_Logo.png\" width=\"35%\" alt=\"RxSwift Logo\" />\n<br />\n<a href=\"https://actions-badge.atrox.dev/ReactiveX/RxSwift/goto\" target=\"_blank\"><img src=\"https://github.com/ReactiveX/RxSwift/workflows/RxSwift/badge.svg?branch=main\" alt=\"Build Status\" /></a>\n<img src=\"https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg\" alt=\"Supported Platforms: iOS, macOS, tvOS, watchOS & Linux\" />\n<br />\n<a href=\"https://cocoapods.org/pods/RxSwift\" alt=\"RxSwift on CocoaPods\" title=\"RxSwift on CocoaPods\"><img src=\"https://img.shields.io/cocoapods/v/RxSwift.svg\" /></a>\n<a href=\"https://github.com/Carthage/Carthage\" alt=\"RxSwift on Carthage\" title=\"RxSwift on Carthage\"><img src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\" /></a>\n<a href=\"https://github.com/apple/swift-package-manager\" alt=\"RxSwift on Swift Package Manager\" title=\"RxSwift on Swift Package Manager\"><img src=\"https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg\" /></a>\n</p>\n\nRx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable<Element>` interface, which lets you broadcast and subscribe to values and other events from an `Observable` stream.  \n\nRxSwift is the Swift-specific implementation of the [Reactive Extensions](http://reactivex.io) standard.\n\n<p align=\"center\"><img src=\"assets/example.png\" width=\"55%\" alt=\"RxSwift Observable Example of a price constantly changing and updating the app's UI\" /></p>\n\nWhile this version aims to stay true to the original spirit and naming conventions of Rx, this projects also aims to provide a true Swift-first API for Rx APIs.\n\nCross platform documentation can be found on [ReactiveX.io](http://reactivex.io/).\n\nLike other Rx implementation, RxSwift's intention is to enable easy composition of asynchronous operations and streams of data in the form of `Observable` objects and a suite of methods to transform and compose these pieces of asynchronous work.\n\nKVO observation, async operations, UI Events and other streams of data are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful.\n\n## I came here because I want to ...\n\n###### ... understand\n\n* [why use rx?](Documentation/Why.md)\n* [the basics, getting started with RxSwift](Documentation/GettingStarted.md)\n* [traits](Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, and `ControlProperty` ... and why do they exist?\n* [testing](Documentation/UnitTests.md)\n* [tips and common errors](Documentation/Tips.md)\n* [debugging](Documentation/GettingStarted.md#debugging)\n* [the math behind Rx](Documentation/MathBehindRx.md)\n* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md)\n\n###### ... install\n\n* Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation)\n\n###### ... hack around\n\n* with the example app. [Running Example App](Documentation/ExampleApp.md)\n* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md)\n\n###### ... interact\n\n* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[Join Slack Channel](http://slack.rxswift.org)\n* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)\n* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)\n* Help out [Check out contribution guide](CONTRIBUTING.md)\n\n###### ... compare\n\n* [with Combine and ReactiveSwift](Documentation/ComparisonWithOtherLibraries.md).\n\n###### ... understand the structure\n\nRxSwift is as compositional as the asynchronous work it drives. The core unit is RxSwift itself, while other dependencies can be added for UI Work, testing, and more.\n\nIt comprises five separate components depending on each other in the following way:\n\n```none\n┌──────────────┐    ┌──────────────┐\n│   RxCocoa    ├────▶   RxRelay    │\n└───────┬──────┘    └──────┬───────┘\n        │                  │        \n┌───────▼──────────────────▼───────┐\n│             RxSwift              │\n└───────▲──────────────────▲───────┘\n        │                  │        \n┌───────┴──────┐    ┌──────┴───────┐\n│    RxTest    │    │  RxBlocking  │\n└──────────────┘    └──────────────┘\n```\n\n* **RxSwift**: The core of RxSwift, providing the Rx standard as (mostly) defined by [ReactiveX](https://reactivex.io). It has no other dependencies.\n* **RxCocoa**: Provides Cocoa-specific capabilities for general iOS/macOS/watchOS & tvOS app development, such as Shared Sequences, Traits, and much more. It depends on both `RxSwift` and `RxRelay`.\n* **RxRelay**: Provides `PublishRelay`, `BehaviorRelay` and `ReplayRelay`, three [simple wrappers around Subjects](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Subjects.md#relays). It depends on `RxSwift`. \n* **RxTest** and **RxBlocking**: Provides testing capabilities for Rx-based systems. It depends on `RxSwift`.\n\n## Usage\n\n<table>\n  <tr>\n    <th width=\"30%\">Here's an example</th>\n    <th width=\"30%\">In Action</th>\n  </tr>\n  <tr>\n    <td>Define search for GitHub repositories ...</td>\n    <th rowspan=\"9\"><img src=\"https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/GithubSearch.gif\"></th>\n  </tr>\n  <tr>\n    <td><div class=\"highlight highlight-source-swift\"><pre>\nlet searchResults = searchBar.rx.text.orEmpty\n    .throttle(.milliseconds(300), scheduler: MainScheduler.instance)\n    .distinctUntilChanged()\n    .flatMapLatest { query -> Observable&lt;[Repository]&gt; in\n        if query.isEmpty {\n            return .just([])\n        }\n        return searchGitHub(query)\n            .catchAndReturn([])\n    }\n    .observe(on: MainScheduler.instance)</pre></div></td>\n  </tr>\n  <tr>\n    <td>... then bind the results to your tableview</td>\n  </tr>\n  <tr>\n    <td width=\"30%\"><div class=\"highlight highlight-source-swift\"><pre>\nsearchResults\n    .bind(to: tableView.rx.items(cellIdentifier: \"Cell\")) {\n        (index, repository: Repository, cell) in\n        cell.textLabel?.text = repository.name\n        cell.detailTextLabel?.text = repository.url\n    }\n    .disposed(by: disposeBag)</pre></div></td>\n  </tr>\n</table>\n\n\n## Requirements\n\n* Xcode 12.x\n* Swift 5.x\n\nFor Xcode 11 and below, [use RxSwift 5.x](https://github.com/ReactiveX/RxSwift/releases/tag/5.1.1).\n\n## Installation\n\nRxSwift doesn't contain any external dependencies.\n\nThese are currently the supported installation options:\n\n### Manual\n\nOpen Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app\n\n### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)\n\n```ruby\n# Podfile\nuse_frameworks!\n\ntarget 'YOUR_TARGET_NAME' do\n    pod 'RxSwift', '6.5.0'\n    pod 'RxCocoa', '6.5.0'\nend\n\n# RxTest and RxBlocking make the most sense in the context of unit/integration tests\ntarget 'YOUR_TESTING_TARGET' do\n    pod 'RxBlocking', '6.5.0'\n    pod 'RxTest', '6.5.0'\nend\n```\n\nReplace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:\n\n```bash\n$ pod install\n```\n\n### XCFrameworks\n\nEach release starting with RxSwift 6 includes `*.xcframework` framework binaries.\n\nSimply drag the needed framework binaries to your **Frameworks, Libraries, and Embedded Content** section under your target's **General** tab.\n\n> **Note**: If you're using `RxCocoa`, be sure to also drag **RxCocoaRuntime.xcframework** before importing `RxCocoa`.\n\n<img src=\"https://raw.githubusercontent.com/ReactiveX/RxSwift/main/assets/xcframeworks.png\" alt=\"XCFrameworks instructions\" width=\"65%\">\n\n### [Carthage](https://github.com/Carthage/Carthage)\n\nAdd this to `Cartfile`\n\n```\ngithub \"ReactiveX/RxSwift\" \"6.5.0\"\n```\n\n```bash\n$ carthage update\n```\n\n#### Carthage as a Static Library\n\nCarthage defaults to building RxSwift as a Dynamic Library. \n\nIf you wish to build RxSwift as a Static Library using Carthage you may use the script below to manually modify the framework type before building with Carthage:\n\n```bash\ncarthage update RxSwift --platform iOS --no-build\nsed -i -e 's/MACH_O_TYPE = mh_dylib/MACH_O_TYPE = staticlib/g' Carthage/Checkouts/RxSwift/Rx.xcodeproj/project.pbxproj\ncarthage build RxSwift --platform iOS\n```\n\n### [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\n> **Note**: There is a critical cross-dependency bug affecting many projects including RxSwift in Swift Package Manager. We've [filed a bug (SR-12303)](https://bugs.swift.org/browse/SR-12303) in early 2020 but have no answer yet. Your mileage may vary. A partial workaround can be found [here](https://github.com/ReactiveX/RxSwift/issues/2127#issuecomment-717830502).\n\nCreate a `Package.swift` file.\n\n```swift\n// swift-tools-version:5.0\n\nimport PackageDescription\n\nlet package = Package(\n  name: \"RxTestProject\",\n  dependencies: [\n    .package(url: \"https://github.com/ReactiveX/RxSwift.git\", .exact(\"6.5.0\"))\n  ],\n  targets: [\n    .target(name: \"RxTestProject\", dependencies: [\"RxSwift\", \"RxCocoa\"])\n  ]\n)\n```\n\n```bash\n$ swift build\n```\n\nTo build or test a module with RxTest dependency, set `TEST=1`.\n\n```bash\n$ TEST=1 swift test\n```\n\n### Manually using git submodules\n\n* Add RxSwift as a submodule\n\n```bash\n$ git submodule add git@github.com:ReactiveX/RxSwift.git\n```\n\n* Drag `Rx.xcodeproj` into Project Navigator\n* Go to `Project > Targets > Build Phases > Link Binary With Libraries`, click `+` and select `RxSwift`, `RxCocoa` and `RxRelay` targets\n\n## References\n\n* [http://reactivex.io/](http://reactivex.io/)\n* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions)\n* [RxSwift RayWenderlich.com Book](https://store.raywenderlich.com/products/rxswift-reactive-programming-with-swift)\n* [RxSwift: Debunking the myth of hard (YouTube)](https://www.youtube.com/watch?v=GdvLP0ZAhhc)\n* [Boxue.io RxSwift Online Course](https://boxueio.com/series/rxswift-101) (Chinese 🇨🇳)\n* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY)\n* [Reactive Programming Overview (Jafar Husain from Netflix)](https://youtu.be/-8Y1-lE6NSA)\n* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf)\n* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/)\n* [Haskell](https://www.haskell.org/)\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/ControlTarget.swift",
    "content": "//\n//  ControlTarget.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS) || os(macOS)\n\nimport RxSwift\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n\n    typealias Control = UIKit.UIControl\n#elseif os(macOS)\n    import Cocoa\n\n    typealias Control = Cocoa.NSControl\n#endif\n\n// This should be only used from `MainScheduler`\nfinal class ControlTarget: RxTarget {\n    typealias Callback = (Control) -> Void\n\n    let selector: Selector = #selector(ControlTarget.eventHandler(_:))\n\n    weak var control: Control?\n#if os(iOS) || os(tvOS)\n    let controlEvents: UIControl.Event\n#endif\n    var callback: Callback?\n    #if os(iOS) || os(tvOS)\n    init(control: Control, controlEvents: UIControl.Event, callback: @escaping Callback) {\n        MainScheduler.ensureRunningOnMainThread()\n\n        self.control = control\n        self.controlEvents = controlEvents\n        self.callback = callback\n\n        super.init()\n\n        control.addTarget(self, action: selector, for: controlEvents)\n\n        let method = self.method(for: selector)\n        if method == nil {\n            rxFatalError(\"Can't find method\")\n        }\n    }\n#elseif os(macOS)\n    init(control: Control, callback: @escaping Callback) {\n        MainScheduler.ensureRunningOnMainThread()\n\n        self.control = control\n        self.callback = callback\n\n        super.init()\n\n        control.target = self\n        control.action = self.selector\n\n        let method = self.method(for: self.selector)\n        if method == nil {\n            rxFatalError(\"Can't find method\")\n        }\n    }\n#endif\n\n    @objc func eventHandler(_ sender: Control!) {\n        if let callback = self.callback, let control = self.control {\n            callback(control)\n        }\n    }\n\n    override func dispose() {\n        super.dispose()\n#if os(iOS) || os(tvOS)\n        self.control?.removeTarget(self, action: self.selector, for: self.controlEvents)\n#elseif os(macOS)\n        self.control?.target = nil\n        self.control?.action = nil\n#endif\n        self.callback = nil\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/DelegateProxy.swift",
    "content": "//\n//  DelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if !os(Linux)\n\n    import RxSwift\n    #if SWIFT_PACKAGE && !os(Linux)\n        import RxCocoaRuntime\n    #endif\n\n    /// Base class for `DelegateProxyType` protocol.\n    ///\n    /// This implementation is not thread safe and can be used only from one thread (Main thread).\n    open class DelegateProxy<P: AnyObject, D>: _RXDelegateProxy {\n        public typealias ParentObject = P\n        public typealias Delegate = D\n\n        private var _sentMessageForSelector = [Selector: MessageDispatcher]()\n        private var _methodInvokedForSelector = [Selector: MessageDispatcher]()\n\n        /// Parent object associated with delegate proxy.\n        private weak var _parentObject: ParentObject?\n\n        private let _currentDelegateFor: (ParentObject) -> AnyObject?\n        private let _setCurrentDelegateTo: (AnyObject?, ParentObject) -> Void\n\n        /// Initializes new instance.\n        ///\n        /// - parameter parentObject: Optional parent object that owns `DelegateProxy` as associated object.\n        public init<Proxy: DelegateProxyType>(parentObject: ParentObject, delegateProxy: Proxy.Type)\n            where Proxy: DelegateProxy<ParentObject, Delegate>, Proxy.ParentObject == ParentObject, Proxy.Delegate == Delegate {\n            self._parentObject = parentObject\n            self._currentDelegateFor = delegateProxy._currentDelegate\n            self._setCurrentDelegateTo = delegateProxy._setCurrentDelegate\n\n            MainScheduler.ensureRunningOnMainThread()\n            #if TRACE_RESOURCES\n                _ = Resources.incrementTotal()\n            #endif\n            super.init()\n        }\n\n        /**\n         Returns observable sequence of invocations of delegate methods. Elements are sent *before method is invoked*.\n\n         Only methods that have `void` return value can be observed using this method because\n         those methods are used as a notification mechanism. It doesn't matter if they are optional\n         or not. Observing is performed by installing a hidden associated `PublishSubject` that is\n         used to dispatch messages to observers.\n\n         Delegate methods that have non `void` return value can't be observed directly using this method\n         because:\n         * those methods are not intended to be used as a notification mechanism, but as a behavior customization mechanism\n         * there is no sensible automatic way to determine a default return value\n\n         In case observing of delegate methods that have return type is required, it can be done by\n         manually installing a `PublishSubject` or `BehaviorSubject` and implementing delegate method.\n\n         e.g.\n\n             // delegate proxy part (RxScrollViewDelegateProxy)\n\n             let internalSubject = PublishSubject<CGPoint>\n\n             public func requiredDelegateMethod(scrollView: UIScrollView, arg1: CGPoint) -> Bool {\n                 internalSubject.on(.next(arg1))\n                 return self._forwardToDelegate?.requiredDelegateMethod?(scrollView, arg1: arg1) ?? defaultReturnValue\n             }\n\n         ....\n\n             // reactive property implementation in a real class (`UIScrollView`)\n             public var property: Observable<CGPoint> {\n                 let proxy = RxScrollViewDelegateProxy.proxy(for: base)\n                 return proxy.internalSubject.asObservable()\n             }\n\n         **In case calling this method prints \"Delegate proxy is already implementing `\\(selector)`,\n         a more performant way of registering might exist.\", that means that manual observing method\n         is required analog to the example above because delegate method has already been implemented.**\n\n         - parameter selector: Selector used to filter observed invocations of delegate methods.\n         - returns: Observable sequence of arguments passed to `selector` method.\n         */\n        open func sentMessage(_ selector: Selector) -> Observable<[Any]> {\n            MainScheduler.ensureRunningOnMainThread()\n\n            let subject = self._sentMessageForSelector[selector]\n\n            if let subject = subject {\n                return subject.asObservable()\n            }\n            else {\n                let subject = MessageDispatcher(selector: selector, delegateProxy: self)\n                self._sentMessageForSelector[selector] = subject\n                return subject.asObservable()\n            }\n        }\n\n        /**\n         Returns observable sequence of invoked delegate methods. Elements are sent *after method is invoked*.\n\n         Only methods that have `void` return value can be observed using this method because\n         those methods are used as a notification mechanism. It doesn't matter if they are optional\n         or not. Observing is performed by installing a hidden associated `PublishSubject` that is\n         used to dispatch messages to observers.\n\n         Delegate methods that have non `void` return value can't be observed directly using this method\n         because:\n         * those methods are not intended to be used as a notification mechanism, but as a behavior customization mechanism\n         * there is no sensible automatic way to determine a default return value\n\n         In case observing of delegate methods that have return type is required, it can be done by\n         manually installing a `PublishSubject` or `BehaviorSubject` and implementing delegate method.\n\n         e.g.\n\n             // delegate proxy part (RxScrollViewDelegateProxy)\n\n             let internalSubject = PublishSubject<CGPoint>\n\n             public func requiredDelegateMethod(scrollView: UIScrollView, arg1: CGPoint) -> Bool {\n                 internalSubject.on(.next(arg1))\n                 return self._forwardToDelegate?.requiredDelegateMethod?(scrollView, arg1: arg1) ?? defaultReturnValue\n             }\n\n         ....\n\n             // reactive property implementation in a real class (`UIScrollView`)\n             public var property: Observable<CGPoint> {\n                 let proxy = RxScrollViewDelegateProxy.proxy(for: base)\n                 return proxy.internalSubject.asObservable()\n             }\n\n         **In case calling this method prints \"Delegate proxy is already implementing `\\(selector)`,\n         a more performant way of registering might exist.\", that means that manual observing method\n         is required analog to the example above because delegate method has already been implemented.**\n\n         - parameter selector: Selector used to filter observed invocations of delegate methods.\n         - returns: Observable sequence of arguments passed to `selector` method.\n         */\n        open func methodInvoked(_ selector: Selector) -> Observable<[Any]> {\n            MainScheduler.ensureRunningOnMainThread()\n\n            let subject = self._methodInvokedForSelector[selector]\n\n            if let subject = subject {\n                return subject.asObservable()\n            }\n            else {\n                let subject = MessageDispatcher(selector: selector, delegateProxy: self)\n                self._methodInvokedForSelector[selector] = subject\n                return subject.asObservable()\n            }\n        }\n\n        fileprivate func checkSelectorIsObservable(_ selector: Selector) {\n            MainScheduler.ensureRunningOnMainThread()\n\n            if self.hasWiredImplementation(for: selector) {\n                print(\"⚠️ Delegate proxy is already implementing `\\(selector)`, a more performant way of registering might exist.\")\n                return\n            }\n\n            if self.voidDelegateMethodsContain(selector) {\n                return\n            }\n\n            // In case `_forwardToDelegate` is `nil`, it is assumed the check is being done prematurely.\n            if !(self._forwardToDelegate?.responds(to: selector) ?? true) {\n                print(\"⚠️ Using delegate proxy dynamic interception method but the target delegate object doesn't respond to the requested selector. \" +\n                    \"In case pure Swift delegate proxy is being used please use manual observing method by using`PublishSubject`s. \" +\n                    \" (selector: `\\(selector)`, forwardToDelegate: `\\(self._forwardToDelegate ?? self)`)\")\n            }\n        }\n\n        // proxy\n\n        open override func _sentMessage(_ selector: Selector, withArguments arguments: [Any]) {\n            self._sentMessageForSelector[selector]?.on(.next(arguments))\n        }\n\n        open override func _methodInvoked(_ selector: Selector, withArguments arguments: [Any]) {\n            self._methodInvokedForSelector[selector]?.on(.next(arguments))\n        }\n\n        /// Returns reference of normal delegate that receives all forwarded messages\n        /// through `self`.\n        ///\n        /// - returns: Value of reference if set or nil.\n        open func forwardToDelegate() -> Delegate? {\n            return castOptionalOrFatalError(self._forwardToDelegate)\n        }\n\n        /// Sets reference of normal delegate that receives all forwarded messages\n        /// through `self`.\n        ///\n        /// - parameter delegate: Reference of delegate that receives all messages through `self`.\n        /// - parameter retainDelegate: Should `self` retain `forwardToDelegate`.\n        open func setForwardToDelegate(_ delegate: Delegate?, retainDelegate: Bool) {\n            #if DEBUG // 4.0 all configurations\n                MainScheduler.ensureRunningOnMainThread()\n            #endif\n            self._setForwardToDelegate(delegate, retainDelegate: retainDelegate)\n\n            let sentSelectors: [Selector] = self._sentMessageForSelector.values.filter { $0.hasObservers }.map { $0.selector }\n            let invokedSelectors: [Selector] = self._methodInvokedForSelector.values.filter { $0.hasObservers }.map { $0.selector }\n            let allUsedSelectors = sentSelectors + invokedSelectors\n\n            for selector in Set(allUsedSelectors) {\n                self.checkSelectorIsObservable(selector)\n            }\n\n            self.reset()\n        }\n\n        private func hasObservers(selector: Selector) -> Bool {\n            return (self._sentMessageForSelector[selector]?.hasObservers ?? false)\n                || (self._methodInvokedForSelector[selector]?.hasObservers ?? false)\n        }\n\n        override open func responds(to aSelector: Selector!) -> Bool {\n            guard let aSelector = aSelector else { return false }\n            return super.responds(to: aSelector)\n                || (self._forwardToDelegate?.responds(to: aSelector) ?? false)\n                || (self.voidDelegateMethodsContain(aSelector) && self.hasObservers(selector: aSelector))\n        }\n\n        fileprivate func reset() {\n            guard let parentObject = self._parentObject else { return }\n\n            let maybeCurrentDelegate = self._currentDelegateFor(parentObject)\n\n            if maybeCurrentDelegate === self {\n                self._setCurrentDelegateTo(nil, parentObject)\n                self._setCurrentDelegateTo(castOrFatalError(self), parentObject)\n            }\n        }\n\n        deinit {\n            for v in self._sentMessageForSelector.values {\n                v.on(.completed)\n            }\n            for v in self._methodInvokedForSelector.values {\n                v.on(.completed)\n            }\n            #if TRACE_RESOURCES\n                _ = Resources.decrementTotal()\n            #endif\n        }\n    \n\n    }\n\n    private let mainScheduler = MainScheduler()\n\n    private final class MessageDispatcher {\n        private let dispatcher: PublishSubject<[Any]>\n        private let result: Observable<[Any]>\n\n        fileprivate let selector: Selector\n\n        init<P, D>(selector: Selector, delegateProxy _delegateProxy: DelegateProxy<P, D>) {\n            weak var weakDelegateProxy = _delegateProxy\n\n            let dispatcher = PublishSubject<[Any]>()\n            self.dispatcher = dispatcher\n            self.selector = selector\n\n            self.result = dispatcher\n                .do(onSubscribed: { weakDelegateProxy?.checkSelectorIsObservable(selector); weakDelegateProxy?.reset() }, onDispose: { weakDelegateProxy?.reset() })\n                .share()\n                .subscribe(on: mainScheduler)\n        }\n\n        var on: (Event<[Any]>) -> Void {\n            return self.dispatcher.on\n        }\n\n        var hasObservers: Bool {\n            return self.dispatcher.hasObservers\n        }\n\n        func asObservable() -> Observable<[Any]> {\n            return self.result\n        }\n    }\n    \n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/DelegateProxyType.swift",
    "content": "//\n//  DelegateProxyType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if !os(Linux)\n\n    import Foundation\n    import RxSwift\n\n/**\n`DelegateProxyType` protocol enables using both normal delegates and Rx observable sequences with\nviews that can have only one delegate/datasource registered.\n\n`Proxies` store information about observers, subscriptions and delegates\nfor specific views.\n\nType implementing `DelegateProxyType` should never be initialized directly.\n\nTo fetch initialized instance of type implementing `DelegateProxyType`, `proxy` method\nshould be used.\n\nThis is more or less how it works.\n\n\n\n      +-------------------------------------------+\n      |                                           |                           \n      | UIView subclass (UIScrollView)            |                           \n      |                                           |\n      +-----------+-------------------------------+                           \n                  |                                                           \n                  | Delegate                                                  \n                  |                                                           \n                  |                                                           \n      +-----------v-------------------------------+                           \n      |                                           |                           \n      | Delegate proxy : DelegateProxyType        +-----+---->  Observable<T1>\n      |                , UIScrollViewDelegate     |     |\n      +-----------+-------------------------------+     +---->  Observable<T2>\n                  |                                     |                     \n                  |                                     +---->  Observable<T3>\n                  |                                     |                     \n                  | forwards events                     |\n                  | to custom delegate                  |\n                  |                                     v                     \n      +-----------v-------------------------------+                           \n      |                                           |                           \n      | Custom delegate (UIScrollViewDelegate)    |                           \n      |                                           |\n      +-------------------------------------------+                           \n\n\nSince RxCocoa needs to automagically create those Proxies and because views that have delegates can be hierarchical\n\n     UITableView : UIScrollView : UIView\n\n.. and corresponding delegates are also hierarchical\n\n     UITableViewDelegate : UIScrollViewDelegate : NSObject\n\n... this mechanism can be extended by using the following snippet in `registerKnownImplementations` or in some other\n     part of your app that executes before using `rx.*` (e.g. appDidFinishLaunching).\n\n    RxScrollViewDelegateProxy.register { RxTableViewDelegateProxy(parentObject: $0) }\n\n*/\npublic protocol DelegateProxyType: AnyObject {\n    associatedtype ParentObject: AnyObject\n    associatedtype Delegate\n    \n    /// It is require that enumerate call `register` of the extended DelegateProxy subclasses here.\n    static func registerKnownImplementations()\n\n    /// Unique identifier for delegate\n    static var identifier: UnsafeRawPointer { get }\n\n    /// Returns designated delegate property for object.\n    ///\n    /// Objects can have multiple delegate properties.\n    ///\n    /// Each delegate property needs to have it's own type implementing `DelegateProxyType`.\n    ///\n    /// It's abstract method.\n    ///\n    /// - parameter object: Object that has delegate property.\n    /// - returns: Value of delegate property.\n    static func currentDelegate(for object: ParentObject) -> Delegate?\n\n    /// Sets designated delegate property for object.\n    ///\n    /// Objects can have multiple delegate properties.\n    ///\n    /// Each delegate property needs to have it's own type implementing `DelegateProxyType`.\n    ///\n    /// It's abstract method.\n    ///\n    /// - parameter delegate: Delegate value.\n    /// - parameter object: Object that has delegate property.\n    static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject)\n\n    /// Returns reference of normal delegate that receives all forwarded messages\n    /// through `self`.\n    ///\n    /// - returns: Value of reference if set or nil.\n    func forwardToDelegate() -> Delegate?\n\n    /// Sets reference of normal delegate that receives all forwarded messages\n    /// through `self`.\n    ///\n    /// - parameter forwardToDelegate: Reference of delegate that receives all messages through `self`.\n    /// - parameter retainDelegate: Should `self` retain `forwardToDelegate`.\n    func setForwardToDelegate(_ forwardToDelegate: Delegate?, retainDelegate: Bool)\n}\n\n// default implementations\nextension DelegateProxyType {\n    /// Unique identifier for delegate\n    public static var identifier: UnsafeRawPointer {\n        let delegateIdentifier = ObjectIdentifier(Delegate.self)\n        let integerIdentifier = Int(bitPattern: delegateIdentifier)\n        return UnsafeRawPointer(bitPattern: integerIdentifier)!\n    }\n}\n\n// workaround of Delegate: class\nextension DelegateProxyType {\n    static func _currentDelegate(for object: ParentObject) -> AnyObject? {\n        currentDelegate(for: object).map { $0 as AnyObject }\n    }\n    \n    static func _setCurrentDelegate(_ delegate: AnyObject?, to object: ParentObject) {\n        setCurrentDelegate(castOptionalOrFatalError(delegate), to: object)\n    }\n    \n    func _forwardToDelegate() -> AnyObject? {\n        self.forwardToDelegate().map { $0 as AnyObject }\n    }\n    \n    func _setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) {\n        self.setForwardToDelegate(castOptionalOrFatalError(forwardToDelegate), retainDelegate: retainDelegate)\n    }\n}\n\nextension DelegateProxyType {\n\n    /// Store DelegateProxy subclass to factory.\n    /// When make 'Rx*DelegateProxy' subclass, call 'Rx*DelegateProxySubclass.register(for:_)' 1 time, or use it in DelegateProxyFactory\n    /// 'Rx*DelegateProxy' can have one subclass implementation per concrete ParentObject type.\n    /// Should call it from concrete DelegateProxy type, not generic.\n    public static func register<Parent>(make: @escaping (Parent) -> Self) {\n        self.factory.extend(make: make)\n    }\n\n    /// Creates new proxy for target object.\n    /// Should not call this function directory, use 'DelegateProxy.proxy(for:)'\n    public static func createProxy(for object: AnyObject) -> Self {\n        castOrFatalError(factory.createProxy(for: object))\n    }\n\n    /// Returns existing proxy for object or installs new instance of delegate proxy.\n    ///\n    /// - parameter object: Target object on which to install delegate proxy.\n    /// - returns: Installed instance of delegate proxy.\n    ///\n    ///\n    ///     extension Reactive where Base: UISearchBar {\n    ///\n    ///         public var delegate: DelegateProxy<UISearchBar, UISearchBarDelegate> {\n    ///            return RxSearchBarDelegateProxy.proxy(for: base)\n    ///         }\n    ///\n    ///         public var text: ControlProperty<String> {\n    ///             let source: Observable<String> = self.delegate.observe(#selector(UISearchBarDelegate.searchBar(_:textDidChange:)))\n    ///             ...\n    ///         }\n    ///     }\n    public static func proxy(for object: ParentObject) -> Self {\n        MainScheduler.ensureRunningOnMainThread()\n\n        let maybeProxy = self.assignedProxy(for: object)\n\n        let proxy: AnyObject\n        if let existingProxy = maybeProxy {\n            proxy = existingProxy\n        }\n        else {\n            proxy = castOrFatalError(self.createProxy(for: object))\n            self.assignProxy(proxy, toObject: object)\n            assert(self.assignedProxy(for: object) === proxy)\n        }\n        let currentDelegate = self._currentDelegate(for: object)\n        let delegateProxy: Self = castOrFatalError(proxy)\n\n        if currentDelegate !== delegateProxy {\n            delegateProxy._setForwardToDelegate(currentDelegate, retainDelegate: false)\n            assert(delegateProxy._forwardToDelegate() === currentDelegate)\n            self._setCurrentDelegate(proxy, to: object)\n            assert(self._currentDelegate(for: object) === proxy)\n            assert(delegateProxy._forwardToDelegate() === currentDelegate)\n        }\n\n        return delegateProxy\n    }\n\n    /// Sets forward delegate for `DelegateProxyType` associated with a specific object and return disposable that can be used to unset the forward to delegate.\n    /// Using this method will also make sure that potential original object cached selectors are cleared and will report any accidental forward delegate mutations.\n    ///\n    /// - parameter forwardDelegate: Delegate object to set.\n    /// - parameter retainDelegate: Retain `forwardDelegate` while it's being set.\n    /// - parameter onProxyForObject: Object that has `delegate` property.\n    /// - returns: Disposable object that can be used to clear forward delegate.\n    public static func installForwardDelegate(_ forwardDelegate: Delegate, retainDelegate: Bool, onProxyForObject object: ParentObject) -> Disposable {\n        weak var weakForwardDelegate: AnyObject? = forwardDelegate as AnyObject\n        let proxy = self.proxy(for: object)\n\n        assert(proxy._forwardToDelegate() === nil, \"This is a feature to warn you that there is already a delegate (or data source) set somewhere previously. The action you are trying to perform will clear that delegate (data source) and that means that some of your features that depend on that delegate (data source) being set will likely stop working.\\n\" +\n            \"If you are ok with this, try to set delegate (data source) to `nil` in front of this operation.\\n\" +\n            \" This is the source object value: \\(object)\\n\" +\n            \" This is the original delegate (data source) value: \\(proxy.forwardToDelegate()!)\\n\" +\n            \"Hint: Maybe delegate was already set in xib or storyboard and now it's being overwritten in code.\\n\")\n\n        proxy.setForwardToDelegate(forwardDelegate, retainDelegate: retainDelegate)\n\n        return Disposables.create {\n            MainScheduler.ensureRunningOnMainThread()\n\n            let delegate: AnyObject? = weakForwardDelegate\n\n            assert(delegate == nil || proxy._forwardToDelegate() === delegate, \"Delegate was changed from time it was first set. Current \\(String(describing: proxy.forwardToDelegate())), and it should have been \\(proxy)\")\n\n            proxy.setForwardToDelegate(nil, retainDelegate: retainDelegate)\n        }\n    }\n}\n\n\n// private extensions\nextension DelegateProxyType {\n    private static var factory: DelegateProxyFactory {\n        DelegateProxyFactory.sharedFactory(for: self)\n    }\n\n    private static func assignedProxy(for object: ParentObject) -> AnyObject? {\n        let maybeDelegate = objc_getAssociatedObject(object, self.identifier)\n        return castOptionalOrFatalError(maybeDelegate)\n    }\n\n    private static func assignProxy(_ proxy: AnyObject, toObject object: ParentObject) {\n        objc_setAssociatedObject(object, self.identifier, proxy, .OBJC_ASSOCIATION_RETAIN)\n    }\n}\n\n/// Describes an object that has a delegate.\npublic protocol HasDelegate: AnyObject {\n    /// Delegate type\n    associatedtype Delegate\n\n    /// Delegate\n    var delegate: Delegate? { get set }\n}\n\nextension DelegateProxyType where ParentObject: HasDelegate, Self.Delegate == ParentObject.Delegate {\n    public static func currentDelegate(for object: ParentObject) -> Delegate? {\n        object.delegate\n    }\n\n    public static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) {\n        object.delegate = delegate\n    }\n}\n\n/// Describes an object that has a data source.\npublic protocol HasDataSource: AnyObject {\n    /// Data source type\n    associatedtype DataSource\n\n    /// Data source\n    var dataSource: DataSource? { get set }\n}\n\nextension DelegateProxyType where ParentObject: HasDataSource, Self.Delegate == ParentObject.DataSource {\n    public static func currentDelegate(for object: ParentObject) -> Delegate? {\n        object.dataSource\n    }\n\n    public static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) {\n        object.dataSource = delegate\n    }\n}\n\n/// Describes an object that has a prefetch data source.\n@available(iOS 10.0, tvOS 10.0, *)\npublic protocol HasPrefetchDataSource: AnyObject {\n    /// Prefetch data source type\n    associatedtype PrefetchDataSource\n\n    /// Prefetch data source\n    var prefetchDataSource: PrefetchDataSource? { get set }\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nextension DelegateProxyType where ParentObject: HasPrefetchDataSource, Self.Delegate == ParentObject.PrefetchDataSource {\n    public static func currentDelegate(for object: ParentObject) -> Delegate? {\n        object.prefetchDataSource\n    }\n\n    public static func setCurrentDelegate(_ delegate: Delegate?, to object: ParentObject) {\n        object.prefetchDataSource = delegate\n    }\n}\n\n    #if os(iOS) || os(tvOS)\n        import UIKit\n\n        extension ObservableType {\n            func subscribeProxyDataSource<DelegateProxy: DelegateProxyType>(ofObject object: DelegateProxy.ParentObject, dataSource: DelegateProxy.Delegate, retainDataSource: Bool, binding: @escaping (DelegateProxy, Event<Element>) -> Void)\n                -> Disposable\n                where DelegateProxy.ParentObject: UIView\n                , DelegateProxy.Delegate: AnyObject {\n                let proxy = DelegateProxy.proxy(for: object)\n                let unregisterDelegate = DelegateProxy.installForwardDelegate(dataSource, retainDelegate: retainDataSource, onProxyForObject: object)\n\n                // Do not perform layoutIfNeeded if the object is still not in the view hierarchy\n                if object.window != nil {\n                    // this is needed to flush any delayed old state (https://github.com/RxSwiftCommunity/RxDataSources/pull/75)\n                    object.layoutIfNeeded()\n                }\n\n                let subscription = self.asObservable()\n                    .observe(on:MainScheduler())\n                    .catch { error in\n                        bindingError(error)\n                        return Observable.empty()\n                    }\n                    // source can never end, otherwise it would release the subscriber, and deallocate the data source\n                    .concat(Observable.never())\n                    .take(until: object.rx.deallocated)\n                    .subscribe { [weak object] (event: Event<Element>) in\n\n                        if let object = object {\n                            assert(proxy === DelegateProxy.currentDelegate(for: object), \"Proxy changed from the time it was first set.\\nOriginal: \\(proxy)\\nExisting: \\(String(describing: DelegateProxy.currentDelegate(for: object)))\")\n                        }\n                        \n                        binding(proxy, event)\n                        \n                        switch event {\n                        case .error(let error):\n                            bindingError(error)\n                            unregisterDelegate.dispose()\n                        case .completed:\n                            unregisterDelegate.dispose()\n                        default:\n                            break\n                        }\n                    }\n                    \n                return Disposables.create { [weak object] in\n                    subscription.dispose()\n\n                    if object?.window != nil {\n                        object?.layoutIfNeeded()\n                    }\n\n                    unregisterDelegate.dispose()\n                }\n            }\n        }\n\n    #endif\n\n    /**\n\n     To add delegate proxy subclasses call `DelegateProxySubclass.register()` in `registerKnownImplementations` or in some other\n     part of your app that executes before using `rx.*` (e.g. appDidFinishLaunching).\n\n         class RxScrollViewDelegateProxy: DelegateProxy {\n             public static func registerKnownImplementations() {\n                 self.register { RxTableViewDelegateProxy(parentObject: $0) }\n         }\n         ...\n\n\n     */\n    private class DelegateProxyFactory {\n        private static var _sharedFactories: [UnsafeRawPointer: DelegateProxyFactory] = [:]\n\n        fileprivate static func sharedFactory<DelegateProxy: DelegateProxyType>(for proxyType: DelegateProxy.Type) -> DelegateProxyFactory {\n            MainScheduler.ensureRunningOnMainThread()\n            let identifier = DelegateProxy.identifier\n            if let factory = _sharedFactories[identifier] {\n                return factory\n            }\n            let factory = DelegateProxyFactory(for: proxyType)\n            _sharedFactories[identifier] = factory\n            DelegateProxy.registerKnownImplementations()\n            return factory\n        }\n\n        private var _factories: [ObjectIdentifier: ((AnyObject) -> AnyObject)]\n        private var _delegateProxyType: Any.Type\n        private var _identifier: UnsafeRawPointer\n\n        private init<DelegateProxy: DelegateProxyType>(for proxyType: DelegateProxy.Type) {\n            self._factories = [:]\n            self._delegateProxyType = proxyType\n            self._identifier = proxyType.identifier\n        }\n\n        fileprivate func extend<DelegateProxy: DelegateProxyType, ParentObject>(make: @escaping (ParentObject) -> DelegateProxy) {\n                MainScheduler.ensureRunningOnMainThread()\n                precondition(self._identifier == DelegateProxy.identifier, \"Delegate proxy has inconsistent identifier\")\n                guard self._factories[ObjectIdentifier(ParentObject.self)] == nil else {\n                    rxFatalError(\"The factory of \\(ParentObject.self) is duplicated. DelegateProxy is not allowed of duplicated base object type.\")\n                }\n                self._factories[ObjectIdentifier(ParentObject.self)] = { make(castOrFatalError($0)) }\n        }\n\n        fileprivate func createProxy(for object: AnyObject) -> AnyObject {\n            MainScheduler.ensureRunningOnMainThread()\n            var maybeMirror: Mirror? = Mirror(reflecting: object)\n            while let mirror = maybeMirror {\n                if let factory = self._factories[ObjectIdentifier(mirror.subjectType)] {\n                    return factory(object)\n                }\n                maybeMirror = mirror.superclassMirror\n            }\n            rxFatalError(\"DelegateProxy has no factory of \\(object). Implement DelegateProxy subclass for \\(object) first.\")\n        }\n    }\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/Infallible+Bind.swift",
    "content": "//\n//  Infallible+Bind.swift\n//  RxCocoa\n//\n//  Created by Shai Mishali on 27/08/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension InfallibleType {\n    /**\n     Creates new subscription and sends elements to observer(s).\n     In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables\n     writing more consistent binding code.\n     - parameter observers: Observers to receives events.\n     - returns: Disposable object that can be used to unsubscribe the observers.\n     */\n    public func bind<Observer: ObserverType>(to observers: Observer...) -> Disposable where Observer.Element == Element {\n        self.subscribe { event in\n            observers.forEach { $0.on(event) }\n        }\n    }\n\n    /**\n     Creates new subscription and sends elements to observer(s).\n     In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables\n     writing more consistent binding code.\n     - parameter observers: Observers to receives events.\n     - returns: Disposable object that can be used to unsubscribe the observers.\n     */\n    public func bind<Observer: ObserverType>(to observers: Observer...) -> Disposable where Observer.Element == Element? {\n        self.map { $0 as Element? }\n            .subscribe { event in\n                observers.forEach { $0.on(event) }\n            }\n    }\n\n    /**\n    Subscribes to observable sequence using custom binder function.\n\n    - parameter binder: Function used to bind elements from `self`.\n    - returns: Object representing subscription.\n    */\n    public func bind<Result>(to binder: (Self) -> Result) -> Result {\n        binder(self)\n    }\n\n    /**\n    Subscribes to observable sequence using custom binder function and final parameter passed to binder function\n    after `self` is passed.\n\n        public func bind<R1, R2>(to binder: Self -> R1 -> R2, curriedArgument: R1) -> R2 {\n            return binder(self)(curriedArgument)\n        }\n\n    - parameter binder: Function used to bind elements from `self`.\n    - parameter curriedArgument: Final argument passed to `binder` to finish binding process.\n    - returns: Object representing subscription.\n    */\n    public func bind<R1, R2>(to binder: (Self) -> (R1) -> R2, curriedArgument: R1) -> R2 {\n        binder(self)(curriedArgument)\n    }\n\n    /**\n    Subscribes an element handler to an observable sequence.\n    In case error occurs in debug mode, `fatalError` will be raised.\n    In case error occurs in release mode, `error` will be logged.\n\n    - parameter onNext: Action to invoke for each element in the observable sequence.\n    - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func bind(onNext: @escaping (Element) -> Void) -> Disposable {\n        self.subscribe(onNext: onNext)\n    }\n\n    /**\n    Creates new subscription and sends elements to `BehaviorRelay`.\n\n    - parameter relays: Target relay for sequence elements.\n    - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n    */\n    public func bind(to relays: BehaviorRelay<Element>...) -> Disposable {\n        return self.subscribe(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `BehaviorRelay`.\n\n     - parameter relays: Target relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func bind(to relays: BehaviorRelay<Element?>...) -> Disposable {\n        return self.subscribe(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n    Creates new subscription and sends elements to `PublishRelay`.\n\n    - parameter relays: Target relay for sequence elements.\n    - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n    */\n    public func bind(to relays: PublishRelay<Element>...) -> Disposable {\n        return self.subscribe(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `PublishRelay`.\n\n     - parameter relays: Target relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func bind(to relays: PublishRelay<Element?>...) -> Disposable {\n        return self.subscribe(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n    Creates new subscription and sends elements to `ReplayRelay`.\n\n    - parameter relays: Target relay for sequence elements.\n    - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n    */\n    public func bind(to relays: ReplayRelay<Element>...) -> Disposable {\n        return self.subscribe(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `ReplayRelay`.\n\n     - parameter relays: Target relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func bind(to relays: ReplayRelay<Element?>...) -> Disposable {\n        return self.subscribe(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/Observable+Bind.swift",
    "content": "//\n//  Observable+Bind.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension ObservableType {\n    /**\n     Creates new subscription and sends elements to observer(s).\n     In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables\n     writing more consistent binding code.\n     - parameter observers: Observers to receives events.\n     - returns: Disposable object that can be used to unsubscribe the observers.\n     */\n    public func bind<Observer: ObserverType>(to observers: Observer...) -> Disposable where Observer.Element == Element {\n        self.subscribe { event in\n            observers.forEach { $0.on(event) }\n        }\n    }\n\n    /**\n     Creates new subscription and sends elements to observer(s).\n     In this form, it's equivalent to the `subscribe` method, but it better conveys intent, and enables\n     writing more consistent binding code.\n     - parameter observers: Observers to receives events.\n     - returns: Disposable object that can be used to unsubscribe the observers.\n     */\n    public func bind<Observer: ObserverType>(to observers: Observer...) -> Disposable where Observer.Element == Element? {\n        self.map { $0 as Element? }\n            .subscribe { event in\n                observers.forEach { $0.on(event) }\n            }\n    }\n\n    /**\n    Subscribes to observable sequence using custom binder function.\n\n    - parameter binder: Function used to bind elements from `self`.\n    - returns: Object representing subscription.\n    */\n    public func bind<Result>(to binder: (Self) -> Result) -> Result {\n        binder(self)\n    }\n\n    /**\n    Subscribes to observable sequence using custom binder function and final parameter passed to binder function\n    after `self` is passed.\n\n        public func bind<R1, R2>(to binder: Self -> R1 -> R2, curriedArgument: R1) -> R2 {\n            return binder(self)(curriedArgument)\n        }\n\n    - parameter binder: Function used to bind elements from `self`.\n    - parameter curriedArgument: Final argument passed to `binder` to finish binding process.\n    - returns: Object representing subscription.\n    */\n    public func bind<R1, R2>(to binder: (Self) -> (R1) -> R2, curriedArgument: R1) -> R2 {\n        binder(self)(curriedArgument)\n    }\n    \n    /**\n    Subscribes an element handler to an observable sequence.\n    In case error occurs in debug mode, `fatalError` will be raised.\n    In case error occurs in release mode, `error` will be logged.\n\n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n    - parameter object: The object to provide an unretained reference on.\n    - parameter onNext: Action to invoke for each element in the observable sequence.\n    - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func bind<Object: AnyObject>(\n        with object: Object,\n        onNext: @escaping (Object, Element) -> Void\n    ) -> Disposable {\n        self.subscribe(onNext: { [weak object] in\n            guard let object = object else { return }\n            onNext(object, $0)\n        },\n        onError: { error in\n            rxFatalErrorInDebug(\"Binding error: \\(error)\")\n        })\n    }\n    \n    /**\n    Subscribes an element handler to an observable sequence.\n    In case error occurs in debug mode, `fatalError` will be raised.\n    In case error occurs in release mode, `error` will be logged.\n\n    - parameter onNext: Action to invoke for each element in the observable sequence.\n    - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func bind(onNext: @escaping (Element) -> Void) -> Disposable {\n        self.subscribe(onNext: onNext,\n                       onError: { error in\n                        rxFatalErrorInDebug(\"Binding error: \\(error)\")\n                       })\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift",
    "content": "//\n//  RxCocoaObjCRuntimeError+Extensions.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 10/9/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if SWIFT_PACKAGE && !DISABLE_SWIZZLING && !os(Linux)\n    import RxCocoaRuntime\n#endif\n\n#if !DISABLE_SWIZZLING && !os(Linux)\n    /// RxCocoa ObjC runtime interception mechanism.\n    public enum RxCocoaInterceptionMechanism {\n        /// Unknown message interception mechanism.\n        case unknown\n        /// Key value observing interception mechanism.\n        case kvo\n    }\n\n    /// RxCocoa ObjC runtime modification errors.\n    public enum RxCocoaObjCRuntimeError\n        : Swift.Error\n        , CustomDebugStringConvertible {\n        /// Unknown error has occurred.\n        case unknown(target: AnyObject)\n\n        /**\n        If the object is reporting a different class then it's real class, that means that there is probably\n        already some interception mechanism in place or something weird is happening.\n\n        The most common case when this would happen is when using a combination of KVO (`observe`) and `sentMessage`.\n\n        This error is easily resolved by just using `sentMessage` observing before `observe`.\n\n        The reason why the other way around could create issues is because KVO will unregister it's interceptor\n        class and restore original class. Unfortunately that will happen no matter was there another interceptor\n        subclass registered in hierarchy or not.\n\n        Failure scenario:\n        * KVO sets class to be `__KVO__OriginalClass` (subclass of `OriginalClass`)\n        * `sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`)\n        * then unobserving with KVO will restore class to be `OriginalClass` -> failure point (possibly a bug in KVO)\n\n        The reason why changing order of observing works is because any interception method on unregistration \n        should return object's original real class (if that doesn't happen then it's really easy to argue that's a bug\n        in that interception mechanism).\n\n        This library won't remove registered interceptor even if there aren't any observers left because\n        it's highly unlikely it would have any benefit in real world use cases, and it's even more\n        dangerous.\n        */\n        case objectMessagesAlreadyBeingIntercepted(target: AnyObject, interceptionMechanism: RxCocoaInterceptionMechanism)\n\n        /// Trying to observe messages for selector that isn't implemented.\n        case selectorNotImplemented(target: AnyObject)\n\n        /// Core Foundation classes are usually toll free bridged. Those classes crash the program in case\n        /// `object_setClass` is performed on them.\n        ///\n        /// There is a possibility to just swizzle methods on original object, but since those won't be usual use\n        /// cases for this library, then an error will just be reported for now.\n        case cantInterceptCoreFoundationTollFreeBridgedObjects(target: AnyObject)\n\n        /// Two libraries have simultaneously tried to modify ObjC runtime and that was detected. This can only\n        /// happen in scenarios where multiple interception libraries are used.\n        ///\n        /// To synchronize other libraries intercepting messages for an object, use `synchronized` on target object and\n        /// it's meta-class.\n        case threadingCollisionWithOtherInterceptionMechanism(target: AnyObject)\n\n        /// For some reason saving original method implementation under RX namespace failed.\n        case savingOriginalForwardingMethodFailed(target: AnyObject)\n\n        /// Intercepting a sent message by replacing a method implementation with `_objc_msgForward` failed for some reason.\n        case replacingMethodWithForwardingImplementation(target: AnyObject)\n\n        /// Attempt to intercept one of the performance sensitive methods:\n        ///    * class\n        ///    * respondsToSelector:\n        ///    * methodSignatureForSelector:\n        ///    * forwardingTargetForSelector:\n        case observingPerformanceSensitiveMessages(target: AnyObject)\n\n        /// Message implementation has unsupported return type (for example large struct). The reason why this is a error\n        /// is because in some cases intercepting sent messages requires replacing implementation with `_objc_msgForward_stret`\n        /// instead of `_objc_msgForward`.\n        ///\n        /// The unsupported cases should be fairly uncommon.\n        case observingMessagesWithUnsupportedReturnType(target: AnyObject)\n    }\n\n    extension RxCocoaObjCRuntimeError {\n        /// A textual representation of `self`, suitable for debugging.\n        public var debugDescription: String {\n            switch self {\n            case let .unknown(target):\n                return \"Unknown error occurred.\\nTarget: `\\(target)`\"\n            case let .objectMessagesAlreadyBeingIntercepted(target, interceptionMechanism):\n                let interceptionMechanismDescription = interceptionMechanism == .kvo ? \"KVO\" : \"other interception mechanism\"\n                return \"Collision between RxCocoa interception mechanism and \\(interceptionMechanismDescription).\"\n                    + \" To resolve this conflict please use this interception mechanism first.\\nTarget: \\(target)\"\n            case let .selectorNotImplemented(target):\n                return \"Trying to observe messages for selector that isn't implemented.\\nTarget: \\(target)\"\n            case let .cantInterceptCoreFoundationTollFreeBridgedObjects(target):\n                return \"Interception of messages sent to Core Foundation isn't supported.\\nTarget: \\(target)\"\n            case let .threadingCollisionWithOtherInterceptionMechanism(target):\n                return \"Detected a conflict while modifying ObjC runtime.\\nTarget: \\(target)\"\n            case let .savingOriginalForwardingMethodFailed(target):\n                return \"Saving original method implementation failed.\\nTarget: \\(target)\"\n            case let .replacingMethodWithForwardingImplementation(target):\n                return \"Intercepting a sent message by replacing a method implementation with `_objc_msgForward` failed for some reason.\\nTarget: \\(target)\"\n            case let .observingPerformanceSensitiveMessages(target):\n                return \"Attempt to intercept one of the performance sensitive methods. \\nTarget: \\(target)\"\n            case let .observingMessagesWithUnsupportedReturnType(target):\n                return \"Attempt to intercept a method with unsupported return type. \\nTarget: \\(target)\"\n            }\n        }\n    }\n    \n    // MARK: Conversions `NSError` > `RxCocoaObjCRuntimeError`\n\n    extension Error {\n        func rxCocoaErrorForTarget(_ target: AnyObject) -> RxCocoaObjCRuntimeError {\n            let error = self as NSError\n            \n            if error.domain == RXObjCRuntimeErrorDomain {\n                let errorCode = RXObjCRuntimeError(rawValue: error.code) ?? .unknown\n                \n                switch errorCode {\n                case .unknown:\n                    return .unknown(target: target)\n                case .objectMessagesAlreadyBeingIntercepted:\n                    let isKVO = (error.userInfo[RXObjCRuntimeErrorIsKVOKey] as? NSNumber)?.boolValue ?? false\n                    return .objectMessagesAlreadyBeingIntercepted(target: target, interceptionMechanism: isKVO ? .kvo : .unknown)\n                case .selectorNotImplemented:\n                    return .selectorNotImplemented(target: target)\n                case .cantInterceptCoreFoundationTollFreeBridgedObjects:\n                    return .cantInterceptCoreFoundationTollFreeBridgedObjects(target: target)\n                case .threadingCollisionWithOtherInterceptionMechanism:\n                    return .threadingCollisionWithOtherInterceptionMechanism(target: target)\n                case .savingOriginalForwardingMethodFailed:\n                    return .savingOriginalForwardingMethodFailed(target: target)\n                case .replacingMethodWithForwardingImplementation:\n                    return .replacingMethodWithForwardingImplementation(target: target)\n                case .observingPerformanceSensitiveMessages:\n                    return .observingPerformanceSensitiveMessages(target: target)\n                case .observingMessagesWithUnsupportedReturnType:\n                    return .observingMessagesWithUnsupportedReturnType(target: target)\n                @unknown default:\n                    fatalError(\"Unhandled Objective C Runtime Error\")\n                }\n            }\n            \n            return RxCocoaObjCRuntimeError.unknown(target: target)\n        }\n    }\n\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/RxTarget.swift",
    "content": "//\n//  RxTarget.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\nimport RxSwift\n\nclass RxTarget : NSObject\n               , Disposable {\n    \n    private var retainSelf: RxTarget?\n    \n    override init() {\n        super.init()\n        self.retainSelf = self\n\n#if TRACE_RESOURCES\n        _ = Resources.incrementTotal()\n#endif\n\n#if DEBUG\n        MainScheduler.ensureRunningOnMainThread()\n#endif\n    }\n    \n    func dispose() {\n#if DEBUG\n        MainScheduler.ensureRunningOnMainThread()\n#endif\n        self.retainSelf = nil\n    }\n\n#if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n    }\n#endif\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/SectionedViewDataSourceType.swift",
    "content": "//\n//  SectionedViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 1/10/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n/// Data source with access to underlying sectioned model.\npublic protocol SectionedViewDataSourceType {\n    /// Returns model at index path.\n    ///\n    /// In case data source doesn't contain any sections when this method is being called, `RxCocoaError.ItemsNotYetBound(object: self)` is thrown.\n\n    /// - parameter indexPath: Model index path\n    /// - returns: Model at index path.\n    func model(at indexPath: IndexPath) throws -> Any\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Common/TextInput.swift",
    "content": "//\n//  TextInput.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/12/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n\n    /// Represents text input with reactive extensions.\n    public struct TextInput<Base: UITextInput> {\n        /// Base text input to extend.\n        public let base: Base\n\n        /// Reactive wrapper for `text` property.\n        public let text: ControlProperty<String?>\n\n        /// Initializes new text input.\n        ///\n        /// - parameter base: Base object.\n        /// - parameter text: Textual control property.\n        public init(base: Base, text: ControlProperty<String?>) {\n            self.base = base\n            self.text = text\n        }\n    }\n\n    extension Reactive where Base: UITextField {\n        /// Reactive text input.\n        public var textInput: TextInput<Base> {\n            return TextInput(base: base, text: self.text)\n        }\n    }\n\n    extension Reactive where Base: UITextView {\n        /// Reactive text input.\n        public var textInput: TextInput<Base> {\n            return TextInput(base: base, text: self.text)\n        }\n    }\n\n#endif\n\n#if os(macOS)\n    import Cocoa\n\n    /// Represents text input with reactive extensions.\n    public struct TextInput<Base: NSTextInputClient> {\n        /// Base text input to extend.\n        public let base: Base\n\n        /// Reactive wrapper for `text` property.\n        public let text: ControlProperty<String?>\n\n        /// Initializes new text input.\n        ///\n        /// - parameter base: Base object.\n        /// - parameter text: Textual control property.\n        public init(base: Base, text: ControlProperty<String?>) {\n            self.base = base\n            self.text = text\n        }\n    }\n\n    extension Reactive where Base: NSTextField, Base: NSTextInputClient {\n        /// Reactive text input.\n        public var textInput: TextInput<Base> {\n            return TextInput(base: self.base, text: self.text)\n        }\n    }\n\n#endif\n\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift",
    "content": "//\n//  KVORepresentable+CoreGraphics.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if !os(Linux)\n\nimport RxSwift\nimport CoreGraphics\n\nimport Foundation\n\n#if arch(x86_64) || arch(arm64)\n\tlet CGRectType = \"{CGRect={CGPoint=dd}{CGSize=dd}}\"\n    let CGSizeType = \"{CGSize=dd}\"\n    let CGPointType = \"{CGPoint=dd}\"\n#elseif arch(i386) || arch(arm) || os(watchOS)\n    let CGRectType = \"{CGRect={CGPoint=ff}{CGSize=ff}}\"\n    let CGSizeType = \"{CGSize=ff}\"\n    let CGPointType = \"{CGPoint=ff}\"\n#endif\n\nextension CGRect : KVORepresentable {\n    public typealias KVOType = NSValue\n\n    /// Constructs self from `NSValue`.\n    public init?(KVOValue: KVOType) {\n        if strcmp(KVOValue.objCType, CGRectType) != 0 {\n            return nil\n        }\n        var typedValue = CGRect(x: 0, y: 0, width: 0, height: 0)\n        KVOValue.getValue(&typedValue)\n        self = typedValue\n    }\n}\n\nextension CGPoint : KVORepresentable {\n    public typealias KVOType = NSValue\n\n    /// Constructs self from `NSValue`.\n    public init?(KVOValue: KVOType) {\n        if strcmp(KVOValue.objCType, CGPointType) != 0 {\n            return nil\n        }\n        var typedValue = CGPoint(x: 0, y: 0)\n        KVOValue.getValue(&typedValue)\n        self = typedValue\n    }\n}\n\nextension CGSize : KVORepresentable {\n    public typealias KVOType = NSValue\n\n    /// Constructs self from `NSValue`.\n    public init?(KVOValue: KVOType) {\n        if strcmp(KVOValue.objCType, CGSizeType) != 0 {\n            return nil\n        }\n        var typedValue = CGSize(width: 0, height: 0)\n        KVOValue.getValue(&typedValue)\n        self = typedValue\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable+Swift.swift",
    "content": "//\n//  KVORepresentable+Swift.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\nextension Int : KVORepresentable {\n    public typealias KVOType = NSNumber\n\n    /// Constructs `Self` using KVO value.\n    public init?(KVOValue: KVOType) {\n        self.init(KVOValue.int32Value)\n    }\n}\n\nextension Int32 : KVORepresentable {\n    public typealias KVOType = NSNumber\n\n    /// Constructs `Self` using KVO value.\n    public init?(KVOValue: KVOType) {\n        self.init(KVOValue.int32Value)\n    }\n}\n\nextension Int64 : KVORepresentable {\n    public typealias KVOType = NSNumber\n\n    /// Constructs `Self` using KVO value.\n    public init?(KVOValue: KVOType) {\n        self.init(KVOValue.int64Value)\n    }\n}\n\nextension UInt : KVORepresentable {\n    public typealias KVOType = NSNumber\n\n    /// Constructs `Self` using KVO value.\n    public init?(KVOValue: KVOType) {\n        self.init(KVOValue.uintValue)\n    }\n}\n\nextension UInt32 : KVORepresentable {\n    public typealias KVOType = NSNumber\n\n    /// Constructs `Self` using KVO value.\n    public init?(KVOValue: KVOType) {\n        self.init(KVOValue.uint32Value)\n    }\n}\n\nextension UInt64 : KVORepresentable {\n    public typealias KVOType = NSNumber\n\n    /// Constructs `Self` using KVO value.\n    public init?(KVOValue: KVOType) {\n        self.init(KVOValue.uint64Value)\n    }\n}\n\nextension Bool : KVORepresentable {\n    public typealias KVOType = NSNumber\n\n    /// Constructs `Self` using KVO value.\n    public init?(KVOValue: KVOType) {\n        self.init(KVOValue.boolValue)\n    }\n}\n\n\nextension RawRepresentable where RawValue: KVORepresentable {\n    /// Constructs `Self` using optional KVO value.\n    init?(KVOValue: RawValue.KVOType?) {\n        guard let KVOValue = KVOValue else {\n            return nil\n        }\n\n        guard let rawValue = RawValue(KVOValue: KVOValue) else {\n            return nil\n        }\n\n        self.init(rawValue: rawValue)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/KVORepresentable.swift",
    "content": "//\n//  KVORepresentable.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Type that is KVO representable (KVO mechanism can be used to observe it).\npublic protocol KVORepresentable {\n    /// Associated KVO type.\n    associatedtype KVOType\n\n    /// Constructs `Self` using KVO value.\n    init?(KVOValue: KVOType)\n}\n\nextension KVORepresentable {\n    /// Initializes `KVORepresentable` with optional value.\n    init?(KVOValue: KVOType?) {\n        guard let KVOValue = KVOValue else {\n            return nil\n        }\n\n        self.init(KVOValue: KVOValue)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift",
    "content": "//\n//  NSObject+Rx+KVORepresentable.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if !os(Linux)\n\nimport Foundation\nimport RxSwift\n\n/// Key value observing options\npublic struct KeyValueObservingOptions: OptionSet {\n    /// Raw value\n    public let rawValue: UInt\n\n    public init(rawValue: UInt) {\n        self.rawValue = rawValue\n    }\n\n    /// Whether a sequence element should be sent to the observer immediately, before the subscribe method even returns.\n    public static let initial = KeyValueObservingOptions(rawValue: 1 << 0)\n    /// Whether to send updated values.\n    public static let new = KeyValueObservingOptions(rawValue: 1 << 1)\n}\n\nextension Reactive where Base: NSObject {\n\n    /**\n     Specialization of generic `observe` method.\n\n     This is a special overload because to observe values of some type (for example `Int`), first values of KVO type\n     need to be observed (`NSNumber`), and then converted to result type.\n\n     For more information take a look at `observe` method.\n     */\n    public func observe<Element: KVORepresentable>(_ type: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable<Element?> {\n        return self.observe(Element.KVOType.self, keyPath, options: options, retainSelf: retainSelf)\n            .map(Element.init)\n    }\n}\n\n#if !DISABLE_SWIZZLING && !os(Linux)\n    // KVO\n    extension Reactive where Base: NSObject {\n        /**\n        Specialization of generic `observeWeakly` method.\n\n        For more information take a look at `observeWeakly` method.\n        */\n        public func observeWeakly<Element: KVORepresentable>(_ type: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable<Element?> {\n            return self.observeWeakly(Element.KVOType.self, keyPath, options: options)\n                .map(Element.init)\n        }\n    }\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift",
    "content": "//\n//  NSObject+Rx+RawRepresentable.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/9/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if !os(Linux)\n\nimport RxSwift\n\nimport Foundation\n\nextension Reactive where Base: NSObject {\n    /**\n     Specialization of generic `observe` method.\n\n     This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value.\n     \n     It is useful for observing bridged ObjC enum values.\n\n     For more information take a look at `observe` method.\n     */\n    public func observe<Element: RawRepresentable>(_ type: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial], retainSelf: Bool = true) -> Observable<Element?> where Element.RawValue: KVORepresentable {\n        return self.observe(Element.RawValue.KVOType.self, keyPath, options: options, retainSelf: retainSelf)\n            .map(Element.init)\n    }\n}\n\n#if !DISABLE_SWIZZLING\n\n    // observeWeakly + RawRepresentable\n    extension Reactive where Base: NSObject {\n\n        /**\n         Specialization of generic `observeWeakly` method.\n\n         This specialization first observes `KVORepresentable` value and then converts it to `RawRepresentable` value.\n     \n         It is useful for observing bridged ObjC enum values.\n\n         For more information take a look at `observeWeakly` method.\n         */\n        public func observeWeakly<Element: RawRepresentable>(_ type: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable<Element?> where Element.RawValue: KVORepresentable {\n            return self.observeWeakly(Element.RawValue.KVOType.self, keyPath, options: options)\n                .map(Element.init)\n        }\n    }\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/NSObject+Rx.swift",
    "content": "//\n//  NSObject+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if !os(Linux)\n\nimport Foundation\nimport RxSwift\n#if SWIFT_PACKAGE && !DISABLE_SWIZZLING && !os(Linux)\n    import RxCocoaRuntime\n#endif\n\n#if !DISABLE_SWIZZLING && !os(Linux)\nprivate var deallocatingSubjectTriggerContext: UInt8 = 0\nprivate var deallocatingSubjectContext: UInt8 = 0\n#endif\nprivate var deallocatedSubjectTriggerContext: UInt8 = 0\nprivate var deallocatedSubjectContext: UInt8 = 0\n\n#if !os(Linux)\n\n/**\nKVO is a tricky mechanism.\n\nWhen observing child in a ownership hierarchy, usually retaining observing target is wanted behavior.\nWhen observing parent in a ownership hierarchy, usually retaining target isn't wanter behavior.\n\nKVO with weak references is especially tricky. For it to work, some kind of swizzling is required.\nThat can be done by\n    * replacing object class dynamically (like KVO does)\n    * by swizzling `dealloc` method on all instances for a class.\n    * some third method ...\n\nBoth approaches can fail in certain scenarios:\n    * problems arise when swizzlers return original object class (like KVO does when nobody is observing)\n    * Problems can arise because replacing dealloc method isn't atomic operation (get implementation,\n    set implementation).\n\nSecond approach is chosen. It can fail in case there are multiple libraries dynamically trying\nto replace dealloc method. In case that isn't the case, it should be ok.\n*/\nextension Reactive where Base: NSObject {\n\n\n    /**\n     Observes values on `keyPath` starting from `self` with `options` and retains `self` if `retainSelf` is set.\n\n     `observe` is just a simple and performant wrapper around KVO mechanism.\n\n     * it can be used to observe paths starting from `self` or from ancestors in ownership graph (`retainSelf = false`)\n     * it can be used to observe paths starting from descendants in ownership graph (`retainSelf = true`)\n     * the paths have to consist only of `strong` properties, otherwise you are risking crashing the system by not unregistering KVO observer before dealloc.\n\n     If support for weak properties is needed or observing arbitrary or unknown relationships in the\n     ownership tree, `observeWeakly` is the preferred option.\n     - parameter type: Optional type hint of the observed sequence elements.\n     - parameter keyPath: Key path of property names to observe.\n     - parameter options: KVO mechanism notification options.\n     - parameter retainSelf: Retains self during observation if set `true`.\n     - returns: Observable sequence of objects on `keyPath`.\n     */\n    public func observe<Element>(_ type: Element.Type,\n                                 _ keyPath: String,\n                                 options: KeyValueObservingOptions = [.new, .initial],\n                                 retainSelf: Bool = true) -> Observable<Element?> {\n        KVOObservable(object: self.base, keyPath: keyPath, options: options, retainTarget: retainSelf).asObservable()\n    }\n\n    /**\n    Observes values at the provided key path using the provided options.\n\n     - parameter keyPath: A key path between the object and one of its properties.\n     - parameter options: Key-value observation options, defaults to `.new` and `.initial`.\n\n     - note: When the object is deallocated, a completion event is emitted.\n\n     - returns: An observable emitting value changes at the provided key path.\n    */\n    public func observe<Element>(_ keyPath: KeyPath<Base, Element>,\n                                 options: NSKeyValueObservingOptions = [.new, .initial]) -> Observable<Element> {\n        Observable<Element>.create { [weak base] observer in\n            let observation = base?.observe(keyPath, options: options) { obj, _ in\n                observer.on(.next(obj[keyPath: keyPath]))\n            }\n\n            return Disposables.create { observation?.invalidate() }\n        }\n        .take(until: base.rx.deallocated)\n    }\n}\n\n#endif\n\n#if !DISABLE_SWIZZLING && !os(Linux)\n// KVO\nextension Reactive where Base: NSObject {\n    /**\n     Observes values on `keyPath` starting from `self` with `options` and doesn't retain `self`.\n\n     It can be used in all cases where `observe` can be used and additionally\n\n     * because it won't retain observed target, it can be used to observe arbitrary object graph whose ownership relation is unknown\n     * it can be used to observe `weak` properties\n\n     **Since it needs to intercept object deallocation process it needs to perform swizzling of `dealloc` method on observed object.**\n     - parameter type: Optional type hint of the observed sequence elements.\n     - parameter keyPath: Key path of property names to observe.\n     - parameter options: KVO mechanism notification options.\n     - returns: Observable sequence of objects on `keyPath`.\n     */\n    public func observeWeakly<Element>(_ type: Element.Type, _ keyPath: String, options: KeyValueObservingOptions = [.new, .initial]) -> Observable<Element?> {\n        return observeWeaklyKeyPathFor(self.base, keyPath: keyPath, options: options)\n            .map { n in\n                return n as? Element\n            }\n    }\n}\n#endif\n\n// Dealloc\nextension Reactive where Base: AnyObject {\n    \n    /**\n    Observable sequence of object deallocated events.\n    \n    After object is deallocated one `()` element will be produced and sequence will immediately complete.\n    \n    - returns: Observable sequence of object deallocated events.\n    */\n    public var deallocated: Observable<Void> {\n        return self.synchronized {\n            if let deallocObservable = objc_getAssociatedObject(self.base, &deallocatedSubjectContext) as? DeallocObservable {\n                return deallocObservable.subject\n            }\n\n            let deallocObservable = DeallocObservable()\n\n            objc_setAssociatedObject(self.base, &deallocatedSubjectContext, deallocObservable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n            return deallocObservable.subject\n        }\n    }\n\n#if !DISABLE_SWIZZLING && !os(Linux)\n\n    /**\n     Observable sequence of message arguments that completes when object is deallocated.\n     \n     Each element is produced before message is invoked on target object. `methodInvoked`\n     exists in case observing of invoked messages is needed.\n\n     In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`.\n     \n     In case some argument is `nil`, instance of `NSNull()` will be sent.\n\n     - returns: Observable sequence of arguments passed to `selector` method.\n     */\n    public func sentMessage(_ selector: Selector) -> Observable<[Any]> {\n        return self.synchronized {\n            // in case of dealloc selector replay subject behavior needs to be used\n            if selector == deallocSelector {\n                return self.deallocating.map { _ in [] }\n            }\n\n            do {\n                let proxy: MessageSentProxy = try self.registerMessageInterceptor(selector)\n                return proxy.messageSent.asObservable()\n            }\n            catch let e {\n                return Observable.error(e)\n            }\n        }\n    }\n\n    /**\n     Observable sequence of message arguments that completes when object is deallocated.\n\n     Each element is produced after message is invoked on target object. `sentMessage`\n     exists in case interception of sent messages before they were invoked is needed.\n\n     In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`.\n\n     In case some argument is `nil`, instance of `NSNull()` will be sent.\n\n     - returns: Observable sequence of arguments passed to `selector` method.\n     */\n    public func methodInvoked(_ selector: Selector) -> Observable<[Any]> {\n        return self.synchronized {\n            // in case of dealloc selector replay subject behavior needs to be used\n            if selector == deallocSelector {\n                return self.deallocated.map { _ in [] }\n            }\n\n\n            do {\n                let proxy: MessageSentProxy = try self.registerMessageInterceptor(selector)\n                return proxy.methodInvoked.asObservable()\n            }\n            catch let e {\n                return Observable.error(e)\n            }\n        }\n    }\n\n    /**\n    Observable sequence of object deallocating events.\n    \n    When `dealloc` message is sent to `self` one `()` element will be produced and after object is deallocated sequence\n    will immediately complete.\n     \n    In case an error occurs sequence will fail with `RxCocoaObjCRuntimeError`.\n    \n    - returns: Observable sequence of object deallocating events.\n    */\n    public var deallocating: Observable<()> {\n        return self.synchronized {\n            do {\n                let proxy: DeallocatingProxy = try self.registerMessageInterceptor(deallocSelector)\n                return proxy.messageSent.asObservable()\n            }\n            catch let e {\n                return Observable.error(e)\n            }\n        }\n    }\n\n    private func registerMessageInterceptor<T: MessageInterceptorSubject>(_ selector: Selector) throws -> T {\n        let rxSelector = RX_selector(selector)\n        let selectorReference = RX_reference_from_selector(rxSelector)\n\n        let subject: T\n        if let existingSubject = objc_getAssociatedObject(self.base, selectorReference) as? T {\n            subject = existingSubject\n        }\n        else {\n            subject = T()\n            objc_setAssociatedObject(\n                self.base,\n                selectorReference,\n                subject,\n                .OBJC_ASSOCIATION_RETAIN_NONATOMIC\n            )\n        }\n\n        if subject.isActive {\n            return subject\n        }\n\n        var error: NSError?\n        let targetImplementation = RX_ensure_observing(self.base, selector, &error)\n        if targetImplementation == nil {\n            throw error?.rxCocoaErrorForTarget(self.base) ?? RxCocoaError.unknown\n        }\n\n        subject.targetImplementation = targetImplementation!\n\n        return subject\n    }\n#endif\n}\n\n// MARK: Message interceptors\n\n#if !DISABLE_SWIZZLING && !os(Linux)\n\n    private protocol MessageInterceptorSubject: AnyObject {\n        init()\n\n        var isActive: Bool {\n            get\n        }\n\n        var targetImplementation: IMP { get set }\n    }\n\n    private final class DeallocatingProxy\n        : MessageInterceptorSubject\n        , RXDeallocatingObserver {\n        typealias Element = ()\n\n        let messageSent = ReplaySubject<()>.create(bufferSize: 1)\n\n        @objc var targetImplementation: IMP = RX_default_target_implementation()\n\n        var isActive: Bool {\n            return self.targetImplementation != RX_default_target_implementation()\n        }\n\n        init() {\n        }\n\n        @objc func deallocating() {\n            self.messageSent.on(.next(()))\n        }\n\n        deinit {\n            self.messageSent.on(.completed)\n        }\n    }\n\n    private final class MessageSentProxy\n        : MessageInterceptorSubject\n        , RXMessageSentObserver {\n        typealias Element = [AnyObject]\n\n        let messageSent = PublishSubject<[Any]>()\n        let methodInvoked = PublishSubject<[Any]>()\n\n        @objc var targetImplementation: IMP = RX_default_target_implementation()\n\n        var isActive: Bool {\n            return self.targetImplementation != RX_default_target_implementation()\n        }\n\n        init() {\n        }\n\n        @objc func messageSent(withArguments arguments: [Any]) {\n            self.messageSent.on(.next(arguments))\n        }\n\n        @objc func methodInvoked(withArguments arguments: [Any]) {\n            self.methodInvoked.on(.next(arguments))\n        }\n\n        deinit {\n            self.messageSent.on(.completed)\n            self.methodInvoked.on(.completed)\n        }\n    }\n\n#endif\n\n\nprivate final class DeallocObservable {\n    let subject = ReplaySubject<Void>.create(bufferSize:1)\n\n    init() {\n    }\n\n    deinit {\n        self.subject.on(.next(()))\n        self.subject.on(.completed)\n    }\n}\n\n// MARK: KVO\n\n#if !os(Linux)\n\nprivate protocol KVOObservableProtocol {\n    var target: AnyObject { get }\n    var keyPath: String { get }\n    var retainTarget: Bool { get }\n    var options: KeyValueObservingOptions { get }\n}\n\nprivate final class KVOObserver\n    : _RXKVOObserver\n    , Disposable {\n    typealias Callback = (Any?) -> Void\n\n    var retainSelf: KVOObserver?\n\n    init(parent: KVOObservableProtocol, callback: @escaping Callback) {\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n\n        super.init(target: parent.target, retainTarget: parent.retainTarget, keyPath: parent.keyPath, options: parent.options.nsOptions, callback: callback)\n        self.retainSelf = self\n    }\n\n    override func dispose() {\n        super.dispose()\n        self.retainSelf = nil\n    }\n\n    deinit {\n        #if TRACE_RESOURCES\n            _ = Resources.decrementTotal()\n        #endif\n    }\n}\n\nprivate final class KVOObservable<Element>\n    : ObservableType\n    , KVOObservableProtocol {\n    typealias Element = Element?\n\n    unowned var target: AnyObject\n    var strongTarget: AnyObject?\n\n    var keyPath: String\n    var options: KeyValueObservingOptions\n    var retainTarget: Bool\n\n    init(object: AnyObject, keyPath: String, options: KeyValueObservingOptions, retainTarget: Bool) {\n        self.target = object\n        self.keyPath = keyPath\n        self.options = options\n        self.retainTarget = retainTarget\n        if retainTarget {\n            self.strongTarget = object\n        }\n    }\n\n    func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element? {\n        let observer = KVOObserver(parent: self) { value in\n            if value as? NSNull != nil {\n                observer.on(.next(nil))\n                return\n            }\n            observer.on(.next(value as? Element))\n        }\n\n        return Disposables.create(with: observer.dispose)\n    }\n\n}\n\nprivate extension KeyValueObservingOptions {\n    var nsOptions: NSKeyValueObservingOptions {\n        var result: UInt = 0\n        if self.contains(.new) {\n            result |= NSKeyValueObservingOptions.new.rawValue\n        }\n        if self.contains(.initial) {\n            result |= NSKeyValueObservingOptions.initial.rawValue\n        }\n        \n        return NSKeyValueObservingOptions(rawValue: result)\n    }\n}\n\n#endif\n\n#if !DISABLE_SWIZZLING && !os(Linux)\n\n    private func observeWeaklyKeyPathFor(_ target: NSObject, keyPath: String, options: KeyValueObservingOptions) -> Observable<AnyObject?> {\n        let components = keyPath.components(separatedBy: \".\").filter { $0 != \"self\" }\n\n        let observable = observeWeaklyKeyPathFor(target, keyPathSections: components, options: options)\n            .finishWithNilWhenDealloc(target)\n\n        if !options.isDisjoint(with: .initial) {\n            return observable\n        }\n        else {\n            return observable\n                .skip(1)\n        }\n    }\n\n    // This should work correctly\n    // Identifiers can't contain `,`, so the only place where `,` can appear\n    // is as a delimiter.\n    // This means there is `W` as element in an array of property attributes.\n    private func isWeakProperty(_ properyRuntimeInfo: String) -> Bool {\n        properyRuntimeInfo.range(of: \",W,\") != nil\n    }\n\n    private extension ObservableType where Element == AnyObject? {\n        func finishWithNilWhenDealloc(_ target: NSObject)\n            -> Observable<AnyObject?> {\n                let deallocating = target.rx.deallocating\n\n                return deallocating\n                    .map { _ in\n                        return Observable.just(nil)\n                    }\n                    .startWith(self.asObservable())\n                    .switchLatest()\n        }\n    }\n\n    private func observeWeaklyKeyPathFor(\n        _ target: NSObject,\n        keyPathSections: [String],\n        options: KeyValueObservingOptions\n        ) -> Observable<AnyObject?> {\n\n        weak var weakTarget: AnyObject? = target\n\n        let propertyName = keyPathSections[0]\n        let remainingPaths = Array(keyPathSections[1..<keyPathSections.count])\n\n        let property = class_getProperty(object_getClass(target), propertyName)\n        if property == nil {\n            return Observable.error(RxCocoaError.invalidPropertyName(object: target, propertyName: propertyName))\n        }\n        let propertyAttributes = property_getAttributes(property!)\n\n        // should dealloc hook be in place if week property, or just create strong reference because it doesn't matter\n        let isWeak = isWeakProperty(propertyAttributes.map(String.init) ?? \"\")\n        let propertyObservable = KVOObservable(object: target, keyPath: propertyName, options: options.union(.initial), retainTarget: false) as KVOObservable<AnyObject>\n\n        // KVO recursion for value changes\n        return propertyObservable\n            .flatMapLatest { (nextTarget: AnyObject?) -> Observable<AnyObject?> in\n                if nextTarget == nil {\n                    return Observable.just(nil)\n                }\n                let nextObject = nextTarget! as? NSObject\n\n                let strongTarget: AnyObject? = weakTarget\n\n                if nextObject == nil {\n                    return Observable.error(RxCocoaError.invalidObjectOnKeyPath(object: nextTarget!, sourceObject: strongTarget ?? NSNull(), propertyName: propertyName))\n                }\n\n                // if target is alive, then send change\n                // if it's deallocated, don't send anything\n                if strongTarget == nil {\n                    return Observable.empty()\n                }\n\n                let nextElementsObservable = keyPathSections.count == 1\n                    ? Observable.just(nextTarget)\n                    : observeWeaklyKeyPathFor(nextObject!, keyPathSections: remainingPaths, options: options)\n                \n                if isWeak {\n                    return nextElementsObservable\n                        .finishWithNilWhenDealloc(nextObject!)\n                }\n                else {\n                    return nextElementsObservable\n                }\n        }\n    }\n#endif\n\n// MARK: Constants\n\nprivate let deallocSelector = NSSelectorFromString(\"dealloc\")\n\n// MARK: AnyObject + Reactive\n\nextension Reactive where Base: AnyObject {\n    func synchronized<T>( _ action: () -> T) -> T {\n        objc_sync_enter(self.base)\n        let result = action()\n        objc_sync_exit(self.base)\n        return result\n    }\n}\n\nextension Reactive where Base: AnyObject {\n    /**\n     Helper to make sure that `Observable` returned from `createCachedObservable` is only created once.\n     This is important because there is only one `target` and `action` properties on `NSControl` or `UIBarButtonItem`.\n     */\n    func lazyInstanceObservable<T: AnyObject>(_ key: UnsafeRawPointer, createCachedObservable: () -> T) -> T {\n        if let value = objc_getAssociatedObject(self.base, key) {\n            return value as! T\n        }\n        \n        let observable = createCachedObservable()\n        \n        objc_setAssociatedObject(self.base, key, observable, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        \n        return observable\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/NotificationCenter+Rx.swift",
    "content": "//\n//  NotificationCenter+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/2/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\nimport RxSwift\n\nextension Reactive where Base: NotificationCenter {\n    /**\n    Transforms notifications posted to notification center to observable sequence of notifications.\n    \n    - parameter name: Optional name used to filter notifications.\n    - parameter object: Optional object used to filter notifications.\n    - returns: Observable sequence of posted notifications.\n    */\n    public func notification(_ name: Notification.Name?, object: AnyObject? = nil) -> Observable<Notification> {\n        return Observable.create { [weak object] observer in\n            let nsObserver = self.base.addObserver(forName: name, object: object, queue: nil) { notification in\n                observer.on(.next(notification))\n            }\n            \n            return Disposables.create {\n                self.base.removeObserver(nsObserver)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Foundation/URLSession+Rx.swift",
    "content": "//\n//  URLSession+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 3/23/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\nimport RxSwift\n\n#if canImport(FoundationNetworking)\nimport FoundationNetworking\n#endif\n\n/// RxCocoa URL errors.\npublic enum RxCocoaURLError\n    : Swift.Error {\n    /// Unknown error occurred.\n    case unknown\n    /// Response is not NSHTTPURLResponse\n    case nonHTTPResponse(response: URLResponse)\n    /// Response is not successful. (not in `200 ..< 300` range)\n    case httpRequestFailed(response: HTTPURLResponse, data: Data?)\n    /// Deserialization error.\n    case deserializationError(error: Swift.Error)\n}\n\nextension RxCocoaURLError\n    : CustomDebugStringConvertible {\n    /// A textual representation of `self`, suitable for debugging.\n    public var debugDescription: String {\n        switch self {\n        case .unknown:\n            return \"Unknown error has occurred.\"\n        case let .nonHTTPResponse(response):\n            return \"Response is not NSHTTPURLResponse `\\(response)`.\"\n        case let .httpRequestFailed(response, _):\n            return \"HTTP request failed with `\\(response.statusCode)`.\"\n        case let .deserializationError(error):\n            return \"Error during deserialization of the response: \\(error)\"\n        }\n    }\n}\n\nprivate func escapeTerminalString(_ value: String) -> String {\n    return value.replacingOccurrences(of: \"\\\"\", with: \"\\\\\\\"\", options:[], range: nil)\n}\n\nprivate func convertURLRequestToCurlCommand(_ request: URLRequest) -> String {\n    let method = request.httpMethod ?? \"GET\"\n    var returnValue = \"curl -X \\(method) \"\n\n    if let httpBody = request.httpBody {\n        let maybeBody = String(data: httpBody, encoding: String.Encoding.utf8)\n        if let body = maybeBody {\n            returnValue += \"-d \\\"\\(escapeTerminalString(body))\\\" \"\n        }\n    }\n\n    for (key, value) in request.allHTTPHeaderFields ?? [:] {\n        let escapedKey = escapeTerminalString(key as String)\n        let escapedValue = escapeTerminalString(value as String)\n        returnValue += \"\\n    -H \\\"\\(escapedKey): \\(escapedValue)\\\" \"\n    }\n\n    let URLString = request.url?.absoluteString ?? \"<unknown url>\"\n\n    returnValue += \"\\n\\\"\\(escapeTerminalString(URLString))\\\"\"\n\n    returnValue += \" -i -v\"\n\n    return returnValue\n}\n\nprivate func convertResponseToString(_ response: URLResponse?, _ error: NSError?, _ interval: TimeInterval) -> String {\n    let ms = Int(interval * 1000)\n\n    if let response = response as? HTTPURLResponse {\n        if 200 ..< 300 ~= response.statusCode {\n            return \"Success (\\(ms)ms): Status \\(response.statusCode)\"\n        }\n        else {\n            return \"Failure (\\(ms)ms): Status \\(response.statusCode)\"\n        }\n    }\n\n    if let error = error {\n        if error.domain == NSURLErrorDomain && error.code == NSURLErrorCancelled {\n            return \"Canceled (\\(ms)ms)\"\n        }\n        return \"Failure (\\(ms)ms): NSError > \\(error)\"\n    }\n\n    return \"<Unhandled response from server>\"\n}\n\nextension Reactive where Base: URLSession {\n    /**\n    Observable sequence of responses for URL request.\n    \n    Performing of request starts after observer is subscribed and not after invoking this method.\n    \n    **URL requests will be performed per subscribed observer.**\n    \n    Any error during fetching of the response will cause observed sequence to terminate with error.\n    \n    - parameter request: URL request.\n    - returns: Observable sequence of URL responses.\n    */\n    public func response(request: URLRequest) -> Observable<(response: HTTPURLResponse, data: Data)> {\n        return Observable.create { observer in\n\n            // smart compiler should be able to optimize this out\n            let d: Date?\n\n            if URLSession.rx.shouldLogRequest(request) {\n                d = Date()\n            }\n            else {\n               d = nil\n            }\n\n            let task = self.base.dataTask(with: request) { data, response, error in\n\n                if URLSession.rx.shouldLogRequest(request) {\n                    let interval = Date().timeIntervalSince(d ?? Date())\n                    print(convertURLRequestToCurlCommand(request))\n                    #if os(Linux)\n                        print(convertResponseToString(response, error.flatMap { $0 as NSError }, interval))\n                    #else\n                        print(convertResponseToString(response, error.map { $0 as NSError }, interval))\n                    #endif\n                }\n                \n                guard let response = response, let data = data else {\n                    observer.on(.error(error ?? RxCocoaURLError.unknown))\n                    return\n                }\n\n                guard let httpResponse = response as? HTTPURLResponse else {\n                    observer.on(.error(RxCocoaURLError.nonHTTPResponse(response: response)))\n                    return\n                }\n\n                observer.on(.next((httpResponse, data)))\n                observer.on(.completed)\n            }\n\n            task.resume()\n\n            return Disposables.create(with: task.cancel)\n        }\n    }\n\n    /**\n    Observable sequence of response data for URL request.\n    \n    Performing of request starts after observer is subscribed and not after invoking this method.\n    \n    **URL requests will be performed per subscribed observer.**\n    \n    Any error during fetching of the response will cause observed sequence to terminate with error.\n    \n    If response is not HTTP response with status code in the range of `200 ..< 300`, sequence\n    will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`.\n    \n    - parameter request: URL request.\n    - returns: Observable sequence of response data.\n    */\n    public func data(request: URLRequest) -> Observable<Data> {\n        return self.response(request: request).map { pair -> Data in\n            if 200 ..< 300 ~= pair.0.statusCode {\n                return pair.1\n            }\n            else {\n                throw RxCocoaURLError.httpRequestFailed(response: pair.0, data: pair.1)\n            }\n        }\n    }\n\n    /**\n    Observable sequence of response JSON for URL request.\n    \n    Performing of request starts after observer is subscribed and not after invoking this method.\n    \n    **URL requests will be performed per subscribed observer.**\n    \n    Any error during fetching of the response will cause observed sequence to terminate with error.\n    \n    If response is not HTTP response with status code in the range of `200 ..< 300`, sequence\n    will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`.\n    \n    If there is an error during JSON deserialization observable sequence will fail with that error.\n    \n    - parameter request: URL request.\n    - returns: Observable sequence of response JSON.\n    */\n    public func json(request: URLRequest, options: JSONSerialization.ReadingOptions = []) -> Observable<Any> {\n        return self.data(request: request).map { data -> Any in\n            do {\n                return try JSONSerialization.jsonObject(with: data, options: options)\n            } catch let error {\n                throw RxCocoaURLError.deserializationError(error: error)\n            }\n        }\n    }\n\n    /**\n    Observable sequence of response JSON for GET request with `URL`.\n     \n    Performing of request starts after observer is subscribed and not after invoking this method.\n    \n    **URL requests will be performed per subscribed observer.**\n    \n    Any error during fetching of the response will cause observed sequence to terminate with error.\n    \n    If response is not HTTP response with status code in the range of `200 ..< 300`, sequence\n    will terminate with `(RxCocoaErrorDomain, RxCocoaError.NetworkError)`.\n    \n    If there is an error during JSON deserialization observable sequence will fail with that error.\n    \n    - parameter url: URL of `NSURLRequest` request.\n    - returns: Observable sequence of response JSON.\n    */\n    public func json(url: Foundation.URL) -> Observable<Any> {\n        self.json(request: URLRequest(url: url))\n    }\n}\n\nextension Reactive where Base == URLSession {\n    /// Log URL requests to standard output in curl format.\n    public static var shouldLogRequest: (URLRequest) -> Bool = { _ in\n        #if DEBUG\n            return true\n        #else\n            return false\n        #endif\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/_RX.m",
    "content": "//\n//  _RX.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import \"include/_RX.h\"\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/_RXDelegateProxy.m",
    "content": "//\n//  _RXDelegateProxy.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/4/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import \"include/_RXDelegateProxy.h\"\n#import \"include/_RX.h\"\n#import \"include/_RXObjCRuntime.h\"\n\n@interface _RXDelegateProxy () {\n    id __weak __forwardToDelegate;\n}\n\n@property (nonatomic, strong) id strongForwardDelegate;\n\n@end\n\nstatic NSMutableDictionary *voidSelectorsPerClass = nil;\n\n@implementation _RXDelegateProxy\n\n+(NSSet*)collectVoidSelectorsForProtocol:(Protocol *)protocol {\n    NSMutableSet *selectors = [NSMutableSet set];\n\n    unsigned int protocolMethodCount = 0;\n    struct objc_method_description *pMethods = protocol_copyMethodDescriptionList(protocol, NO, YES, &protocolMethodCount);\n\n    for (unsigned int i = 0; i < protocolMethodCount; ++i) {\n        struct objc_method_description method = pMethods[i];\n        if (RX_is_method_with_description_void(method)) {\n            [selectors addObject:SEL_VALUE(method.name)];\n        }\n    }\n            \n    free(pMethods);\n\n    unsigned int numberOfBaseProtocols = 0;\n    Protocol * __unsafe_unretained * pSubprotocols = protocol_copyProtocolList(protocol, &numberOfBaseProtocols);\n\n    for (unsigned int i = 0; i < numberOfBaseProtocols; ++i) {\n        [selectors unionSet:[self collectVoidSelectorsForProtocol:pSubprotocols[i]]];\n    }\n    \n    free(pSubprotocols);\n\n    return selectors;\n}\n\n+(void)initialize {\n    @synchronized (_RXDelegateProxy.class) {\n        if (voidSelectorsPerClass == nil) {\n            voidSelectorsPerClass = [[NSMutableDictionary alloc] init];\n        }\n\n        NSMutableSet *voidSelectors = [NSMutableSet set];\n\n#define CLASS_HIERARCHY_MAX_DEPTH 100\n\n        NSInteger  classHierarchyDepth = 0;\n        Class      targetClass         = NULL;\n\n        for (classHierarchyDepth = 0, targetClass = self;\n             classHierarchyDepth < CLASS_HIERARCHY_MAX_DEPTH && targetClass != nil;\n             ++classHierarchyDepth, targetClass = class_getSuperclass(targetClass)\n        ) {\n            unsigned int count;\n            Protocol *__unsafe_unretained *pProtocols = class_copyProtocolList(targetClass, &count);\n            \n            for (unsigned int i = 0; i < count; i++) {\n                NSSet *selectorsForProtocol = [self collectVoidSelectorsForProtocol:pProtocols[i]];\n                [voidSelectors unionSet:selectorsForProtocol];\n            }\n            \n            free(pProtocols);\n        }\n\n        if (classHierarchyDepth == CLASS_HIERARCHY_MAX_DEPTH) {\n            NSLog(@\"Detected weird class hierarchy with depth over %d. Starting with this class -> %@\", CLASS_HIERARCHY_MAX_DEPTH, self);\n#if DEBUG\n            abort();\n#endif\n        }\n        \n        voidSelectorsPerClass[CLASS_VALUE(self)] = voidSelectors;\n    }\n}\n\n-(id)_forwardToDelegate {\n    return __forwardToDelegate;\n}\n\n-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate {\n    __forwardToDelegate = forwardToDelegate;\n    if (retainDelegate) {\n        self.strongForwardDelegate = forwardToDelegate;\n    }\n    else {\n        self.strongForwardDelegate = nil;\n    }\n}\n\n-(BOOL)hasWiredImplementationForSelector:(SEL)selector {\n    return [super respondsToSelector:selector];\n}\n\n-(BOOL)voidDelegateMethodsContain:(SEL)selector {\n    @synchronized(_RXDelegateProxy.class) {\n        NSSet *voidSelectors = voidSelectorsPerClass[CLASS_VALUE(self.class)];\n        NSAssert(voidSelectors != nil, @\"Set of allowed methods not initialized\");\n        return [voidSelectors containsObject:SEL_VALUE(selector)];\n    }\n}\n\n-(void)forwardInvocation:(NSInvocation *)anInvocation {\n    BOOL isVoid = RX_is_method_signature_void(anInvocation.methodSignature);\n    NSArray *arguments = nil;\n    if (isVoid) {\n        arguments = RX_extract_arguments(anInvocation);\n        [self _sentMessage:anInvocation.selector withArguments:arguments];\n    }\n    \n    if (self._forwardToDelegate && [self._forwardToDelegate respondsToSelector:anInvocation.selector]) {\n        [anInvocation invokeWithTarget:self._forwardToDelegate];\n    }\n\n    if (isVoid) {\n        [self _methodInvoked:anInvocation.selector withArguments:arguments];\n    }\n}\n\n// abstract method\n-(void)_sentMessage:(SEL)selector withArguments:(NSArray *)arguments {\n\n}\n\n// abstract method\n-(void)_methodInvoked:(SEL)selector withArguments:(NSArray *)arguments {\n\n}\n\n-(void)dealloc {\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/_RXKVOObserver.m",
    "content": "//\n//  _RXKVOObserver.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import \"include/_RXKVOObserver.h\"\n\n@interface _RXKVOObserver ()\n\n@property (nonatomic, unsafe_unretained) id            target;\n@property (nonatomic, strong           ) id            retainedTarget;\n@property (nonatomic, copy             ) NSString     *keyPath;\n@property (nonatomic, copy             ) void (^callback)(id);\n\n@end\n\n@implementation _RXKVOObserver\n\n-(instancetype)initWithTarget:(id)target\n                 retainTarget:(BOOL)retainTarget\n                      keyPath:(NSString*)keyPath\n                      options:(NSKeyValueObservingOptions)options\n                     callback:(void (^)(id))callback {\n    self = [super init];\n    if (!self) return nil;\n    \n    self.target = target;\n    if (retainTarget) {\n        self.retainedTarget = target;\n    }\n    self.keyPath = keyPath;\n    self.callback = callback;\n    \n    [self.target addObserver:self forKeyPath:self.keyPath options:options context:nil];\n    \n    return self;\n}\n\n-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {\n    @synchronized(self) {\n        self.callback(change[NSKeyValueChangeNewKey]);\n    }\n}\n\n-(void)dispose {\n    [self.target removeObserver:self forKeyPath:self.keyPath context:nil];\n    self.target = nil;\n    self.retainedTarget = nil;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/_RXObjCRuntime.m",
    "content": "//\n//  _RXObjCRuntime.m\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import <pthread.h>\n#import <Foundation/Foundation.h>\n#import <objc/runtime.h>\n#import <objc/message.h>\n#import <libkern/OSAtomic.h>\n#import <stdatomic.h>\n\n#import \"include/_RX.h\"\n#import \"include/_RXObjCRuntime.h\"\n\n// self + cmd\n#define HIDDEN_ARGUMENT_COUNT   2\n\n#if !DISABLE_SWIZZLING\n\n#define NSErrorParam NSError *__autoreleasing __nullable * __nullable\n\n@class RXObjCRuntime;\n\nBOOL RXAbortOnThreadingHazard = NO;\n\ntypedef NSInvocation       *NSInvocationRef;\ntypedef NSMethodSignature  *NSMethodSignatureRef;\ntypedef unsigned char       rx_uchar;\ntypedef unsigned short      rx_ushort;\ntypedef unsigned int        rx_uint;\ntypedef unsigned long       rx_ulong;\ntypedef id (^rx_block)(id);\ntypedef BOOL (^RXInterceptWithOptimizedObserver)(RXObjCRuntime * __nonnull self, Class __nonnull class, SEL __nonnull selector, NSErrorParam error);\n\nstatic CFTypeID  defaultTypeID;\nstatic SEL       deallocSelector;\n\nstatic int RxSwizzlingTargetClassKey = 0;\n\n#if TRACE_RESOURCES\n_Atomic static int32_t numberOInterceptedMethods = 0;\n_Atomic static int32_t numberOfForwardedMethods = 0;\n#endif\n\n#define THREADING_HAZARD(class) \\\n    NSLog(@\"There was a problem swizzling on `%@`.\\nYou have probably two libraries performing swizzling in runtime.\\nWe didn't want to crash your program, but this is not good ...\\nYou an solve this problem by either not using swizzling in this library, removing one of those other libraries, or making sure that swizzling parts are synchronized (only perform them on main thread).\\nAnd yes, this message will self destruct when you clear the console, and since it's non deterministic, the problem could still exist and it will be hard for you to reproduce it.\", NSStringFromClass(class)); ABORT_IN_DEBUG if (RXAbortOnThreadingHazard) { abort(); }\n\n#define ALWAYS(condition, message) if (!(condition)) { [NSException raise:@\"RX Invalid Operator\" format:@\"%@\", message]; }\n#define ALWAYS_WITH_INFO(condition, message) NSAssert((condition), @\"%@ [%@] > %@\", NSStringFromClass(class), NSStringFromSelector(selector), (message))\n#define C_ALWAYS(condition, message) NSCAssert((condition), @\"%@ [%@] > %@\", NSStringFromClass(class), NSStringFromSelector(selector), (message))\n\n#define RX_PREFIX @\"_RX_namespace_\"\n\n#define RX_ARG_id(value)           ((value) ?: [NSNull null])\n#define RX_ARG_char(value)         [NSNumber numberWithChar:value]\n#define RX_ARG_short(value)        [NSNumber numberWithShort:value]\n#define RX_ARG_int(value)          [NSNumber numberWithInt:value]\n#define RX_ARG_long(value)         [NSNumber numberWithLong:value]\n#define RX_ARG_BOOL(value)         [NSNumber numberWithBool:value]\n#define RX_ARG_SEL(value)          [NSNumber valueWithPointer:value]\n#define RX_ARG_rx_uchar(value)     [NSNumber numberWithUnsignedInt:value]\n#define RX_ARG_rx_ushort(value)    [NSNumber numberWithUnsignedInt:value]\n#define RX_ARG_rx_uint(value)      [NSNumber numberWithUnsignedInt:value]\n#define RX_ARG_rx_ulong(value)     [NSNumber numberWithUnsignedLong:value]\n#define RX_ARG_rx_block(value)     ((id)(value) ?: [NSNull null])\n#define RX_ARG_float(value)        [NSNumber numberWithFloat:value]\n#define RX_ARG_double(value)       [NSNumber numberWithDouble:value]\n\ntypedef struct supported_type {\n    const char *encoding;\n} supported_type_t;\n\nstatic supported_type_t supported_types[] = {\n    { .encoding = @encode(void)},\n    { .encoding = @encode(id)},\n    { .encoding = @encode(Class)},\n    { .encoding = @encode(void (^)(void))},\n    { .encoding = @encode(char)},\n    { .encoding = @encode(short)},\n    { .encoding = @encode(int)},\n    { .encoding = @encode(long)},\n    { .encoding = @encode(long long)},\n    { .encoding = @encode(unsigned char)},\n    { .encoding = @encode(unsigned short)},\n    { .encoding = @encode(unsigned int)},\n    { .encoding = @encode(unsigned long)},\n    { .encoding = @encode(unsigned long long)},\n    { .encoding = @encode(float)},\n    { .encoding = @encode(double)},\n    { .encoding = @encode(BOOL)},\n    { .encoding = @encode(const char*)},\n};\n\nNSString * __nonnull const RXObjCRuntimeErrorDomain   = @\"RXObjCRuntimeErrorDomain\";\nNSString * __nonnull const RXObjCRuntimeErrorIsKVOKey = @\"RXObjCRuntimeErrorIsKVOKey\";\n\nBOOL RX_return_type_is_supported(const char *type) {\n    if (type == nil) {\n        return NO;\n    }\n\n    for (int i = 0; i < sizeof(supported_types) / sizeof(supported_type_t); ++i) {\n        if (supported_types[i].encoding[0] != type[0]) {\n            continue;\n        }\n        if (strcmp(supported_types[i].encoding, type) == 0) {\n            return YES;\n        }\n    }\n\n    return NO;\n}\n\nstatic BOOL RX_method_has_supported_return_type(Method method) {\n    const char *rawEncoding = method_getTypeEncoding(method);\n    ALWAYS(rawEncoding != nil, @\"Example encoding method is nil.\");\n\n    NSMethodSignature *methodSignature = [NSMethodSignature signatureWithObjCTypes:rawEncoding];\n    ALWAYS(methodSignature != nil, @\"Method signature method is nil.\");\n\n    return RX_return_type_is_supported(methodSignature.methodReturnType);\n}\n\nSEL __nonnull RX_selector(SEL __nonnull selector) {\n    NSString *selectorString = NSStringFromSelector(selector);\n    return NSSelectorFromString([RX_PREFIX stringByAppendingString:selectorString]);\n}\n\n#endif\n\nBOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature) {\n    const char *methodReturnType = methodSignature.methodReturnType;\n    return strcmp(methodReturnType, @encode(void)) == 0;\n}\n\nBOOL RX_is_method_with_description_void(struct objc_method_description method) {\n    return strncmp(method.types, @encode(void), 1) == 0;\n}\n\nid __nonnull RX_extract_argument_at_index(NSInvocation * __nonnull invocation, NSUInteger index) {\n    const char *argumentType = [invocation.methodSignature getArgumentTypeAtIndex:index];\n    \n#define RETURN_VALUE(type) \\\n    else if (strcmp(argumentType, @encode(type)) == 0) {\\\n        type val = 0; \\\n        [invocation getArgument:&val atIndex:index]; \\\n        return @(val); \\\n    }\n\n    // Skip const type qualifier.\n    if (argumentType[0] == 'r') {\n        argumentType++;\n    }\n    \n    if (strcmp(argumentType, @encode(id)) == 0\n        || strcmp(argumentType, @encode(Class)) == 0\n        || strcmp(argumentType, @encode(void (^)(void))) == 0\n    ) {\n        __unsafe_unretained id argument = nil;\n        [invocation getArgument:&argument atIndex:index];\n        return argument;\n    }\n    RETURN_VALUE(char)\n    RETURN_VALUE(short)\n    RETURN_VALUE(int)\n    RETURN_VALUE(long)\n    RETURN_VALUE(long long)\n    RETURN_VALUE(unsigned char)\n    RETURN_VALUE(unsigned short)\n    RETURN_VALUE(unsigned int)\n    RETURN_VALUE(unsigned long)\n    RETURN_VALUE(unsigned long long)\n    RETURN_VALUE(float)\n    RETURN_VALUE(double)\n    RETURN_VALUE(BOOL)\n    RETURN_VALUE(const char *)\n    else {\n        NSUInteger size = 0;\n        NSGetSizeAndAlignment(argumentType, &size, NULL);\n        NSCParameterAssert(size > 0);\n        uint8_t data[size];\n        [invocation getArgument:&data atIndex:index];\n        \n        return [NSValue valueWithBytes:&data objCType:argumentType];\n    }\n}\n\nNSArray *RX_extract_arguments(NSInvocation *invocation) {\n    NSUInteger numberOfArguments = invocation.methodSignature.numberOfArguments;\n    NSUInteger numberOfVisibleArguments = numberOfArguments - HIDDEN_ARGUMENT_COUNT;\n    \n    NSCParameterAssert(numberOfVisibleArguments >= 0);\n    \n    NSMutableArray *arguments = [NSMutableArray arrayWithCapacity:numberOfVisibleArguments];\n    \n    for (NSUInteger index = HIDDEN_ARGUMENT_COUNT; index < numberOfArguments; ++index) {\n        [arguments addObject:RX_extract_argument_at_index(invocation, index) ?: [NSNull null]];\n    }\n    \n    return arguments;\n}\n\nIMP __nonnull RX_default_target_implementation(void) {\n    return _objc_msgForward;\n}\n\n#if !DISABLE_SWIZZLING\n\nvoid * __nonnull RX_reference_from_selector(SEL __nonnull selector) {\n    return selector;\n}\n\nstatic BOOL RX_forward_invocation(id __nonnull __unsafe_unretained self, NSInvocation *invocation) {\n    SEL originalSelector = RX_selector(invocation.selector);\n\n    id<RXMessageSentObserver> messageSentObserver = objc_getAssociatedObject(self, originalSelector);\n\n    if (messageSentObserver != nil) {\n        NSArray *arguments = RX_extract_arguments(invocation);\n        [messageSentObserver messageSentWithArguments:arguments];\n    }\n\n    if ([self respondsToSelector:originalSelector]) {\n        invocation.selector = originalSelector;\n        [invocation invokeWithTarget:self];\n\n        if (messageSentObserver != nil) {\n            NSArray *arguments = RX_extract_arguments(invocation);\n            [messageSentObserver methodInvokedWithArguments:arguments];\n        }\n\n        return YES;\n    }\n\n    return NO;\n}\n\nstatic BOOL RX_responds_to_selector(id __nonnull __unsafe_unretained self, SEL selector) {\n    Class class = object_getClass(self);\n    if (class == nil) { return NO; }\n\n    Method m = class_getInstanceMethod(class, selector);\n    return m != nil;\n\n}\n\nstatic NSMethodSignatureRef RX_method_signature(id __nonnull __unsafe_unretained self, SEL selector) {\n    Class class = object_getClass(self);\n    if (class == nil) { return nil; }\n\n    Method method = class_getInstanceMethod(class, selector);\n    if (method == nil) { return nil; }\n\n    const char *encoding = method_getTypeEncoding(method);\n    if (encoding == nil) { return nil; }\n\n    return [NSMethodSignature signatureWithObjCTypes:encoding];\n}\n\nstatic NSString * __nonnull RX_method_encoding(Method __nonnull method) {\n    const char *typeEncoding = method_getTypeEncoding(method);\n    ALWAYS(typeEncoding != nil, @\"Method encoding is nil.\");\n\n    NSString *encoding = [NSString stringWithCString:typeEncoding encoding:NSASCIIStringEncoding];\n    ALWAYS(encoding != nil, @\"Can't convert encoding to NSString.\");\n    return encoding;\n}\n\n@interface RXObjCRuntime: NSObject\n\n@property (nonatomic, assign) pthread_mutex_t lock;\n\n@property (nonatomic, strong) NSMutableSet<NSValue *> *classesThatSupportObservingByForwarding;\n@property (nonatomic, strong) NSMutableDictionary<NSValue *, NSMutableSet<NSValue*> *> *forwardedSelectorsByClass;\n\n@property (nonatomic, strong) NSMutableDictionary<NSValue *, Class> *dynamicSubclassByRealClass;\n@property (nonatomic, strong) NSMutableDictionary<NSValue *, NSMutableDictionary<NSValue*, NSValue *>*> *interceptorIMPbySelectorsByClass;\n\n+(RXObjCRuntime*)instance;\n\n-(void)performLocked:(void (^)(RXObjCRuntime* __nonnull))action;\n-(IMP __nullable)ensurePrepared:(id __nonnull)target forObserving:(SEL __nonnull)selector error:(NSErrorParam)error;\n-(BOOL)ensureSwizzledSelector:(SEL __nonnull)selector\n                      ofClass:(Class __nonnull)class\n   newImplementationGenerator:(IMP(^)(void))newImplementationGenerator\nreplacementImplementationGenerator:(IMP (^)(IMP originalImplementation))replacementImplementationGenerator\n                        error:(NSErrorParam)error;\n\n\n+(void)registerOptimizedObserver:(RXInterceptWithOptimizedObserver)registration encodedAs:(SEL)selector;\n\n@end\n\n/**\n All API methods perform work on locked instance of `RXObjCRuntime`. In that way it's easy to prove\n that every action is properly locked.\n */\nIMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSErrorParam error) {\n    __block IMP targetImplementation = nil;\n    // Target is the second object that needs to be synchronized to TRY to make sure other swizzling framework\n    // won't do something in parallel.\n    // Even though this is too fine grained locking and more coarse grained locks should exist, this is just in case\n    // someone calls this method directly without any external lock.\n    @synchronized(target) {\n        // The only other resource that all other swizzling libraries have in common without introducing external\n        // dependencies is class object.\n        //\n        // It is polite to try to synchronize it in hope other unknown entities will also attempt to do so.\n        // It's like trying to figure out how to communicate with aliens without actually communicating,\n        // save for the fact that aliens are people, programmers, authors of swizzling libraries.\n        @synchronized([target class]) {\n            [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) {\n                targetImplementation = [self ensurePrepared:target\n                                               forObserving:selector\n                                                      error:error];\n            }];\n        }\n    }\n\n    return targetImplementation;\n}\n\n// bodies\n\n#define FORWARD_BODY(invocation)                        if (RX_forward_invocation(self, NAME_CAT(_, 0, invocation))) { return; }\n\n#define RESPONDS_TO_SELECTOR_BODY(selector)             if (RX_responds_to_selector(self, NAME_CAT(_, 0, selector))) return YES;\n\n#define CLASS_BODY(...)                                 return actAsClass;\n\n#define METHOD_SIGNATURE_FOR_SELECTOR_BODY(selector)                                            \\\n    NSMethodSignatureRef methodSignature = RX_method_signature(self, NAME_CAT(_, 0, selector)); \\\n    if (methodSignature != nil) {                                                               \\\n        return methodSignature;                                                                 \\\n    }\n\n#define DEALLOCATING_BODY(...)                                                        \\\n    id<RXDeallocatingObserver> observer = objc_getAssociatedObject(self, rxSelector); \\\n    if (observer != nil && observer.targetImplementation == thisIMP) {                \\\n        [observer deallocating];                                                      \\\n    }\n\n#define OBSERVE_BODY(...)                                                              \\\n    id<RXMessageSentObserver> observer = objc_getAssociatedObject(self, rxSelector);   \\\n                                                                                       \\\n    if (observer != nil && observer.targetImplementation == thisIMP) {                 \\\n        [observer messageSentWithArguments:@[COMMA_DELIMITED_ARGUMENTS(__VA_ARGS__)]]; \\\n    }                                                                                  \\\n\n\n#define OBSERVE_INVOKED_BODY(...)                                                        \\\n    if (observer != nil && observer.targetImplementation == thisIMP) {                   \\\n        [observer methodInvokedWithArguments:@[COMMA_DELIMITED_ARGUMENTS(__VA_ARGS__)]]; \\\n    }                                                                                    \\\n\n\n#define BUILD_ARG_WRAPPER(type)                   RX_ARG_ ## type                                                     //RX_ARG_ ## type\n\n#define CAT(_1, _2, head, tail)                   RX_CAT2(head, tail)\n#define SEPARATE_BY_COMMA(_1, _2, head, tail)     head, tail\n#define SEPARATE_BY_SPACE(_1, _2, head, tail)     head tail\n#define SEPARATE_BY_UNDERSCORE(head, tail)        RX_CAT2(RX_CAT2(head, _), tail)\n\n#define UNDERSCORE_TYPE_CAT(_1, index, type)      RX_CAT2(_, type)                                                    // generates -> _type\n#define NAME_CAT(_1, index, type)                 SEPARATE_BY_UNDERSCORE(type, index)                                 // generates -> type_0\n#define TYPE_AND_NAME_CAT(_1, index, type)        type SEPARATE_BY_UNDERSCORE(type, index)                            // generates -> type type_0\n#define NOT_NULL_ARGUMENT_CAT(_1, index, type)    BUILD_ARG_WRAPPER(type)(NAME_CAT(_1, index, type))                  // generates -> ((id)(type_0) ?: [NSNull null])\n#define EXAMPLE_PARAMETER(_1, index, type)        RX_CAT2(_, type):(type)SEPARATE_BY_UNDERSCORE(type, index)          // generates -> _type:(type)type_0\n#define SELECTOR_PART(_1, index, type)            RX_CAT2(_, type:)                                                   // generates -> _type:\n\n#define COMMA_DELIMITED_ARGUMENTS(...)            RX_FOREACH(_, SEPARATE_BY_COMMA, NOT_NULL_ARGUMENT_CAT, ## __VA_ARGS__)\n#define ARGUMENTS(...)                            RX_FOREACH_COMMA(_, NAME_CAT, ## __VA_ARGS__)\n#define DECLARE_ARGUMENTS(...)                    RX_FOREACH_COMMA(_, TYPE_AND_NAME_CAT, ## __VA_ARGS__)\n\n// optimized observe methods\n\n#define GENERATE_SELECTOR_IDENTIFIER(...)         RX_CAT2(exampleSelector, RX_FOREACH(_, CAT, UNDERSCORE_TYPE_CAT, ## __VA_ARGS__))\n\n#define GENERATE_METHOD_IDENTIFIER(...)           RX_CAT2(swizzle, RX_FOREACH(_, CAT, UNDERSCORE_TYPE_CAT, ## __VA_ARGS__))\n\n#define GENERATE_OBSERVE_METHOD_DECLARATION(...)                                 \\\n    -(BOOL)GENERATE_METHOD_IDENTIFIER(__VA_ARGS__):(Class __nonnull)class        \\\n                                          selector:(SEL)selector                 \\\n                                             error:(NSErrorParam)error {         \\\n\n\n#define BUILD_EXAMPLE_METHOD(return_value, ...) \\\n    +(return_value)RX_CAT2(RX_CAT2(example_, return_value), RX_FOREACH(_, SEPARATE_BY_SPACE, EXAMPLE_PARAMETER, ## __VA_ARGS__)) {}\n\n#define BUILD_EXAMPLE_METHOD_SELECTOR(return_value, ...) \\\n    RX_CAT2(RX_CAT2(example_, return_value), RX_FOREACH(_, SEPARATE_BY_SPACE, SELECTOR_PART, ## __VA_ARGS__))\n\n#define SWIZZLE_OBSERVE_METHOD_DEFINITIONS(return_value, ...) \\\n    BUILD_EXAMPLE_METHOD(return_value, ## __VA_ARGS__)                                                                                                  \\\n    SWIZZLE_METHOD(return_value, GENERATE_OBSERVE_METHOD_DECLARATION(return_value, ## __VA_ARGS__), OBSERVE_BODY, OBSERVE_INVOKED_BODY, ## __VA_ARGS__) \\\n\n#define SWIZZLE_OBSERVE_METHOD_BODY(return_value, ...)                                                                                                       \\\n       __unused SEL GENERATE_SELECTOR_IDENTIFIER(return_value, ## __VA_ARGS__) = @selector(BUILD_EXAMPLE_METHOD_SELECTOR(return_value, ## __VA_ARGS__));                                           \\\n       [self registerOptimizedObserver:^BOOL(RXObjCRuntime * __nonnull self, Class __nonnull class,                                                     \\\n            SEL __nonnull selector, NSErrorParam error) {                                                                                               \\\n            return [self GENERATE_METHOD_IDENTIFIER(return_value, ## __VA_ARGS__):class selector:selector error:error];                                 \\\n       } encodedAs:GENERATE_SELECTOR_IDENTIFIER(return_value, ## __VA_ARGS__)];                                                                                                                    \\\n\n// infrastructure method\n\n#define NO_BODY(...)\n\n#define SWIZZLE_INFRASTRUCTURE_METHOD(return_value, method_name, parameters, method_selector, body, ...)               \\\n    SWIZZLE_METHOD(return_value, -(BOOL)method_name:(Class __nonnull)class parameters error:(NSErrorParam)error        \\\n        {                                                                                                              \\\n            SEL selector = method_selector; , body, NO_BODY, __VA_ARGS__)                                              \\\n\n\n// common base\n\n#define SWIZZLE_METHOD(return_value, method_prototype, body, invoked_body, ...)                                          \\\nmethod_prototype                                                                                                         \\\n    __unused SEL rxSelector = RX_selector(selector);                                                                     \\\n    IMP (^newImplementationGenerator)(void) = ^() {                                                                      \\\n        __block IMP thisIMP = nil;                                                                                       \\\n        id newImplementation = ^return_value(__unsafe_unretained id self DECLARE_ARGUMENTS(__VA_ARGS__)) {               \\\n            body(__VA_ARGS__)                                                                                            \\\n                                                                                                                         \\\n            struct objc_super superInfo = {                                                                              \\\n                .receiver = self,                                                                                        \\\n                .super_class = class_getSuperclass(class)                                                                \\\n            };                                                                                                           \\\n                                                                                                                         \\\n            return_value (*msgSend)(struct objc_super *, SEL DECLARE_ARGUMENTS(__VA_ARGS__))                             \\\n                = (__typeof__(msgSend))objc_msgSendSuper;                                                                \\\n            @try {                                                                                                       \\\n              return msgSend(&superInfo, selector ARGUMENTS(__VA_ARGS__));                                               \\\n            }                                                                                                            \\\n            @finally { invoked_body(__VA_ARGS__) }                                                                       \\\n        };                                                                                                               \\\n                                                                                                                         \\\n        thisIMP = imp_implementationWithBlock(newImplementation);                                                        \\\n        return thisIMP;                                                                                                  \\\n    };                                                                                                                   \\\n                                                                                                                         \\\n    IMP (^replacementImplementationGenerator)(IMP) = ^(IMP originalImplementation) {                                     \\\n        __block return_value (*originalImplementationTyped)(__unsafe_unretained id, SEL DECLARE_ARGUMENTS(__VA_ARGS__) ) \\\n            = (__typeof__(originalImplementationTyped))(originalImplementation);                                         \\\n                                                                                                                         \\\n        __block IMP thisIMP = nil;                                                                                       \\\n        id implementationReplacement = ^return_value(__unsafe_unretained id self DECLARE_ARGUMENTS(__VA_ARGS__) ) {      \\\n            body(__VA_ARGS__)                                                                                            \\\n            @try {                                                                                                       \\\n                return originalImplementationTyped(self, selector ARGUMENTS(__VA_ARGS__));                               \\\n            }                                                                                                            \\\n            @finally { invoked_body(__VA_ARGS__) }                                                                       \\\n        };                                                                                                               \\\n                                                                                                                         \\\n        thisIMP = imp_implementationWithBlock(implementationReplacement);                                                \\\n        return thisIMP;                                                                                                  \\\n    };                                                                                                                   \\\n                                                                                                                         \\\n    return [self ensureSwizzledSelector:selector                                                                         \\\n                                ofClass:class                                                                            \\\n             newImplementationGenerator:newImplementationGenerator                                                       \\\n     replacementImplementationGenerator:replacementImplementationGenerator                                               \\\n                                  error:error];                                                                          \\\n }                                                                                                                       \\\n\n\n@interface RXObjCRuntime (InfrastructureMethods)\n@end\n\n// MARK: Infrastructure Methods\n\n@implementation RXObjCRuntime (InfrastructureMethods)\n\nSWIZZLE_INFRASTRUCTURE_METHOD(\n    void,\n    swizzleForwardInvocation,\n    ,\n    @selector(forwardInvocation:),\n    FORWARD_BODY,\n    NSInvocationRef\n)\nSWIZZLE_INFRASTRUCTURE_METHOD(\n    BOOL,\n    swizzleRespondsToSelector,\n    ,\n    @selector(respondsToSelector:),\n    RESPONDS_TO_SELECTOR_BODY,\n    SEL\n)\nSWIZZLE_INFRASTRUCTURE_METHOD(\n    Class __nonnull,\n    swizzleClass,\n    toActAs:(Class)actAsClass,\n    @selector(class),\n    CLASS_BODY\n)\nSWIZZLE_INFRASTRUCTURE_METHOD(\n    NSMethodSignatureRef,\n    swizzleMethodSignatureForSelector,\n    ,\n    @selector(methodSignatureForSelector:),\n    METHOD_SIGNATURE_FOR_SELECTOR_BODY,\n    SEL\n)\nSWIZZLE_INFRASTRUCTURE_METHOD(\n    void,\n    swizzleDeallocating,\n    ,\n    deallocSelector,\n    DEALLOCATING_BODY\n)\n\n@end\n\n// MARK: Optimized intercepting methods for specific combination of parameter types\n\n@interface RXObjCRuntime (swizzle)\n\n@end\n\n@implementation RXObjCRuntime(swizzle)\n\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void)\n\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, char)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, short)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, int)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, long)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_uchar)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_ushort)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_uint)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_ulong)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, rx_block)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, float)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, double)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, SEL)\n\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, id)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, char)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, short)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, int)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, long)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_uchar)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_ushort)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_uint)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_ulong)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, rx_block)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, float)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, double)\nSWIZZLE_OBSERVE_METHOD_DEFINITIONS(void, id, SEL)\n\n+(void)load {\n    SWIZZLE_OBSERVE_METHOD_BODY(void)\n\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, char)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, short)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, int)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, long)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, rx_uchar)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, rx_ushort)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, rx_uint)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, rx_ulong)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, rx_block)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, float)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, double)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, SEL)\n\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, id)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, char)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, short)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, int)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, long)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_uchar)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_ushort)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_uint)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_ulong)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, rx_block)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, float)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, double)\n    SWIZZLE_OBSERVE_METHOD_BODY(void, id, SEL)\n}\n\n@end\n\n// MARK: RXObjCRuntime\n\n@implementation RXObjCRuntime\n\nstatic RXObjCRuntime *_instance = nil;\nstatic NSMutableDictionary<NSString *, RXInterceptWithOptimizedObserver> *optimizedObserversByMethodEncoding = nil;\n\n+(RXObjCRuntime*)instance {\n    return _instance;\n}\n\n+(void)initialize {\n    _instance = [[RXObjCRuntime alloc] init];\n    defaultTypeID = CFGetTypeID((CFTypeRef)RXObjCRuntime.class); // just need a reference of some object not from CF\n    deallocSelector = NSSelectorFromString(@\"dealloc\");\n    NSAssert(_instance != nil, @\"Failed to initialize swizzling\");\n}\n\n-(instancetype)init {\n    self = [super init];\n    if (!self) return nil;\n\n    self.classesThatSupportObservingByForwarding = [NSMutableSet set];\n    self.forwardedSelectorsByClass = [NSMutableDictionary dictionary];\n\n    self.dynamicSubclassByRealClass = [NSMutableDictionary dictionary];\n    self.interceptorIMPbySelectorsByClass = [NSMutableDictionary dictionary];\n\n    pthread_mutexattr_t lock_attr;\n    pthread_mutexattr_init(&lock_attr);\n    pthread_mutexattr_settype(&lock_attr, PTHREAD_MUTEX_RECURSIVE);\n    pthread_mutex_init(&_lock, &lock_attr);\n    pthread_mutexattr_destroy(&lock_attr);\n    \n    return self;\n}\n\n-(void)performLocked:(void (^)(RXObjCRuntime* __nonnull))action {\n    pthread_mutex_lock(&_lock);\n    action(self);\n    pthread_mutex_unlock(&_lock);\n}\n\n+(void)registerOptimizedObserver:(RXInterceptWithOptimizedObserver)registration encodedAs:(SEL)selector {\n    Method exampleEncodingMethod = class_getClassMethod(self, selector);\n    ALWAYS(exampleEncodingMethod != nil, @\"Example encoding method is nil.\");\n\n    NSString *methodEncoding = RX_method_encoding(exampleEncodingMethod);\n\n    if (optimizedObserversByMethodEncoding == nil) {\n        optimizedObserversByMethodEncoding = [NSMutableDictionary dictionary];\n    }\n\n    DLOG(@\"Added optimized method: %@ (%@)\", methodEncoding, NSStringFromSelector(selector));\n    ALWAYS(optimizedObserversByMethodEncoding[methodEncoding] == nil, @\"Optimized observer already registered\")\n    optimizedObserversByMethodEncoding[methodEncoding] = registration;\n}\n\n/**\n This is the main entry point for observing messages sent to arbitrary objects.\n */\n-(IMP __nullable)ensurePrepared:(id __nonnull)target forObserving:(SEL __nonnull)selector error:(NSErrorParam)error {\n    Method instanceMethod = class_getInstanceMethod([target class], selector);\n    if (instanceMethod == nil) {\n        RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                           code:RXObjCRuntimeErrorSelectorNotImplemented\n                                       userInfo:nil], nil);\n    }\n\n    if (selector == @selector(class)\n    ||  selector == @selector(forwardingTargetForSelector:)\n    ||  selector == @selector(methodSignatureForSelector:)\n    ||  selector == @selector(respondsToSelector:)) {\n        RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                           code:RXObjCRuntimeErrorObservingPerformanceSensitiveMessages\n                                       userInfo:nil], nil);\n    }\n\n    // For `dealloc` message, original implementation will be swizzled.\n    // This is a special case because observing `dealloc` message is performed when `observeWeakly` is used.\n    //\n    // Some toll free bridged classes don't handle `object_setClass` well and cause crashes.\n    //\n    // To make `deallocating` as robust as possible, original implementation will be replaced.\n    if (selector == deallocSelector) {\n        Class __nonnull deallocSwizzingTarget = [target class];\n        IMP interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:deallocSwizzingTarget];\n        if (interceptorIMPForSelector != nil) {\n            return interceptorIMPForSelector;\n        }\n\n        if (![self swizzleDeallocating:deallocSwizzingTarget error:error]) {\n            return nil;\n        }\n\n        interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:deallocSwizzingTarget];\n        if (interceptorIMPForSelector != nil) {\n            return interceptorIMPForSelector;\n        }\n    }\n    else {\n        Class __nullable swizzlingImplementorClass = [self prepareTargetClassForObserving:target error:error];\n        if (swizzlingImplementorClass == nil) {\n            return nil;\n        }\n\n        NSString *methodEncoding = RX_method_encoding(instanceMethod);\n        RXInterceptWithOptimizedObserver optimizedIntercept = optimizedObserversByMethodEncoding[methodEncoding];\n\n        if (!RX_method_has_supported_return_type(instanceMethod)) {\n            RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                               code:RXObjCRuntimeErrorObservingMessagesWithUnsupportedReturnType\n                                           userInfo:nil], nil);\n        }\n\n        // optimized interception method\n        if (optimizedIntercept != nil) {\n            IMP interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:swizzlingImplementorClass];\n            if (interceptorIMPForSelector != nil) {\n                return interceptorIMPForSelector;\n            }\n\n            if (!optimizedIntercept(self, swizzlingImplementorClass, selector, error)) {\n                return nil;\n            }\n\n            interceptorIMPForSelector = [self interceptorImplementationForSelector:selector forClass:swizzlingImplementorClass];\n            if (interceptorIMPForSelector != nil) {\n                return interceptorIMPForSelector;\n            }\n        }\n        // default fallback to observing by forwarding messages\n        else {\n            if ([self forwardingSelector:selector forClass:swizzlingImplementorClass]) {\n                return RX_default_target_implementation();\n            }\n\n            if (![self observeByForwardingMessages:swizzlingImplementorClass\n                                          selector:selector\n                                            target:target\n                                             error:error]) {\n                return nil;\n            }\n\n            if ([self forwardingSelector:selector forClass:swizzlingImplementorClass]) {\n                return RX_default_target_implementation();\n            }\n        }\n    }\n\n    RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                       code:RXObjCRuntimeErrorUnknown\n                                   userInfo:nil], nil);\n}\n\n-(Class __nullable)prepareTargetClassForObserving:(id __nonnull)target error:(NSErrorParam)error {\n    Class swizzlingClass = objc_getAssociatedObject(target, &RxSwizzlingTargetClassKey);\n    if (swizzlingClass != nil) {\n        return swizzlingClass;\n    }\n\n    Class __nonnull wannaBeClass = [target class];\n    /**\n     Core Foundation classes are usually toll free bridged. Those classes crash the program in case\n     `object_setClass` is performed on them.\n\n     There is a possibility to just swizzle methods on original object, but since those won't be usual use\n     cases for this library, then an error will just be reported for now.\n     */\n    BOOL isThisTollFreeFoundationClass = CFGetTypeID((CFTypeRef)target) != defaultTypeID;\n\n    if (isThisTollFreeFoundationClass) {\n        RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                           code:RXObjCRuntimeErrorCantInterceptCoreFoundationTollFreeBridgedObjects\n                                       userInfo:nil], nil);\n    }\n\n    /**\n     If the object is reporting a different class then what it's real class, that means that there is probably\n     already some interception mechanism in place or something weird is happening.\n     \n     Most common case when this would happen is when using KVO (`observe`) and `sentMessage`.\n\n     This error is easily resolved by just using `sentMessage` observing before `observe`.\n     \n     The reason why other way around could create issues is because KVO will unregister it's interceptor \n     class and restore original class. Unfortunately that will happen no matter was there another interceptor\n     subclass registered in hierarchy or not.\n     \n     Failure scenario:\n     * KVO sets class to be `__KVO__OriginalClass` (subclass of `OriginalClass`)\n     * `sentMessage` sets object class to be `_RX_namespace___KVO__OriginalClass` (subclass of `__KVO__OriginalClass`)\n     * then unobserving with KVO will restore class to be `OriginalClass` -> failure point\n\n     The reason why changing order of observing works is because any interception method should return\n     object's original real class (if that doesn't happen then it's really easy to argue that's a bug\n     in that other library).\n     \n     This library won't remove registered interceptor even if there aren't any observers left because\n     it's highly unlikely it would have any benefit in real world use cases, and it's even more\n     dangerous.\n     */\n    if ([target class] != object_getClass(target)) {\n        BOOL isKVO = [target respondsToSelector:NSSelectorFromString(@\"_isKVOA\")];\n\n        RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                           code:RXObjCRuntimeErrorObjectMessagesAlreadyBeingIntercepted\n                                       userInfo:@{\n                                                  RXObjCRuntimeErrorIsKVOKey : @(isKVO)\n                                                  }], nil);\n    }\n\n    Class __nullable dynamicFakeSubclass = [self ensureHasDynamicFakeSubclass:wannaBeClass error:error];\n\n    if (dynamicFakeSubclass == nil) {\n        return nil;\n    }\n\n    Class previousClass = object_setClass(target, dynamicFakeSubclass);\n    if (previousClass != wannaBeClass) {\n        THREADING_HAZARD(wannaBeClass);\n        RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                           code:RXObjCRuntimeErrorThreadingCollisionWithOtherInterceptionMechanism\n                                       userInfo:nil], nil);\n    }\n\n    objc_setAssociatedObject(target, &RxSwizzlingTargetClassKey, dynamicFakeSubclass, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    return dynamicFakeSubclass;\n}\n\n\n-(BOOL)forwardingSelector:(SEL)selector forClass:(Class __nonnull)class {\n    return [self.forwardedSelectorsByClass[CLASS_VALUE(class)] containsObject:SEL_VALUE(selector)];\n}\n\n-(void)registerForwardedSelector:(SEL)selector forClass:(Class __nonnull)class {\n    NSValue *classValue = CLASS_VALUE(class);\n\n    NSMutableSet<NSValue *> *forwardedSelectors = self.forwardedSelectorsByClass[classValue];\n\n    if (forwardedSelectors == nil) {\n        forwardedSelectors = [NSMutableSet set];\n        self.forwardedSelectorsByClass[classValue] = forwardedSelectors;\n    }\n\n    [forwardedSelectors addObject:SEL_VALUE(selector)];\n}\n\n-(BOOL)observeByForwardingMessages:(Class __nonnull)swizzlingImplementorClass\n                          selector:(SEL)selector\n                            target:(id __nonnull)target\n                             error:(NSErrorParam)error {\n    if (![self ensureForwardingMethodsAreSwizzled:swizzlingImplementorClass error:error]) {\n        return NO;\n    }\n\n    ALWAYS(![self forwardingSelector:selector forClass:swizzlingImplementorClass], @\"Already observing selector for class\");\n\n#if TRACE_RESOURCES\n    atomic_fetch_add(&numberOfForwardedMethods, 1);\n#endif\n    SEL rxSelector = RX_selector(selector);\n\n    Method instanceMethod = class_getInstanceMethod(swizzlingImplementorClass, selector);\n    ALWAYS(instanceMethod != nil, @\"Instance method is nil\");\n\n    const char* methodEncoding = method_getTypeEncoding(instanceMethod);\n    ALWAYS(methodEncoding != nil, @\"Method encoding is nil.\");\n    NSMethodSignature *methodSignature = [NSMethodSignature signatureWithObjCTypes:methodEncoding];\n    ALWAYS(methodSignature != nil, @\"Method signature is invalid.\");\n\n    IMP implementation = method_getImplementation(instanceMethod);\n\n    if (implementation == nil) {\n        RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                           code:RXObjCRuntimeErrorSelectorNotImplemented\n                                       userInfo:nil], NO);\n    }\n\n    if (!class_addMethod(swizzlingImplementorClass, rxSelector, implementation, methodEncoding)) {\n        RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                           code:RXObjCRuntimeErrorSavingOriginalForwardingMethodFailed\n                                       userInfo:nil], NO);\n    }\n\n    if (!class_addMethod(swizzlingImplementorClass, selector, _objc_msgForward, methodEncoding)) {\n        if (implementation != method_setImplementation(instanceMethod, _objc_msgForward)) {\n            THREADING_HAZARD(swizzlingImplementorClass);\n            RX_THROW_ERROR([NSError errorWithDomain:RXObjCRuntimeErrorDomain\n                                               code:RXObjCRuntimeErrorReplacingMethodWithForwardingImplementation\n                                           userInfo:nil], NO);\n        }\n    }\n\n    DLOG(@\"Rx uses forwarding to observe `%@` for `%@`.\", NSStringFromSelector(selector), swizzlingImplementorClass);\n    [self registerForwardedSelector:selector forClass:swizzlingImplementorClass];\n\n    return YES;\n}\n\n/**\n If object don't have some weird behavior, claims it's the same class that runtime shows,\n then dynamic subclass is created (only this instance will have performance hit).\n \n In case something weird is detected, then original base class is being swizzled and all instances\n will have somewhat reduced performance.\n \n This is especially handy optimization for weak KVO. Nobody will swizzle for example `NSString`,\n but to know when instance of a `NSString` was deallocated, performance hit will be only felt on a \n single instance of `NSString`, not all instances of `NSString`s.\n */\n-(Class __nullable)ensureHasDynamicFakeSubclass:(Class __nonnull)class error:(NSErrorParam)error {\n    Class dynamicFakeSubclass = self.dynamicSubclassByRealClass[CLASS_VALUE(class)];\n    if (dynamicFakeSubclass != nil) {\n        return dynamicFakeSubclass;\n    }\n\n    NSString *dynamicFakeSubclassName = [RX_PREFIX stringByAppendingString:NSStringFromClass(class)];\n    const char *dynamicFakeSubclassNameRaw = dynamicFakeSubclassName.UTF8String;\n    dynamicFakeSubclass = objc_allocateClassPair(class, dynamicFakeSubclassNameRaw, 0);\n    ALWAYS(dynamicFakeSubclass != nil, @\"Class not generated\");\n\n    if (![self swizzleClass:dynamicFakeSubclass toActAs:class error:error]) {\n        return nil;\n    }\n\n    objc_registerClassPair(dynamicFakeSubclass);\n\n    [self.dynamicSubclassByRealClass setObject:dynamicFakeSubclass forKey:CLASS_VALUE(class)];\n    ALWAYS(self.dynamicSubclassByRealClass[CLASS_VALUE(class)] != nil, @\"Class not registered\");\n\n    return dynamicFakeSubclass;\n}\n\n-(BOOL)ensureForwardingMethodsAreSwizzled:(Class __nonnull)class error:(NSErrorParam)error {\n    NSValue *classValue = CLASS_VALUE(class);\n    if ([self.classesThatSupportObservingByForwarding containsObject:classValue]) {\n        return YES;\n    }\n\n    if (![self swizzleForwardInvocation:class error:error]) { return NO; }\n    if (![self swizzleMethodSignatureForSelector:class error:error]) { return NO; }\n    if (![self swizzleRespondsToSelector:class error:error]) { return NO; }\n\n    [self.classesThatSupportObservingByForwarding addObject:classValue];\n\n    return YES;\n}\n\n-(void)registerInterceptedSelector:(SEL)selector implementation:(IMP)implementation forClass:(Class)class {\n    NSValue * __nonnull classValue = CLASS_VALUE(class);\n    NSValue * __nonnull selectorValue = SEL_VALUE(selector);\n\n    NSMutableDictionary *swizzledIMPBySelectorsForClass = self.interceptorIMPbySelectorsByClass[classValue];\n\n    if (swizzledIMPBySelectorsForClass == nil) {\n        swizzledIMPBySelectorsForClass = [NSMutableDictionary dictionary];\n        self.interceptorIMPbySelectorsByClass[classValue] = swizzledIMPBySelectorsForClass;\n    }\n\n    swizzledIMPBySelectorsForClass[selectorValue] = IMP_VALUE(implementation);\n\n    ALWAYS([self interceptorImplementationForSelector:selector forClass:class] != nil, @\"Class should have been swizzled\");\n}\n\n-(IMP)interceptorImplementationForSelector:(SEL)selector forClass:(Class)class {\n    NSValue * __nonnull classValue = CLASS_VALUE(class);\n    NSValue * __nonnull selectorValue = SEL_VALUE(selector);\n\n    NSMutableDictionary *swizzledIMPBySelectorForClass = self.interceptorIMPbySelectorsByClass[classValue];\n\n    NSValue *impValue = swizzledIMPBySelectorForClass[selectorValue];\n    return impValue.pointerValue;\n}\n\n-(BOOL)ensureSwizzledSelector:(SEL __nonnull)selector\n                      ofClass:(Class __nonnull)class\n   newImplementationGenerator:(IMP(^)(void))newImplementationGenerator\nreplacementImplementationGenerator:(IMP (^)(IMP originalImplementation))replacementImplementationGenerator\n                        error:(NSErrorParam)error {\n    if ([self interceptorImplementationForSelector:selector forClass:class] != nil) {\n        DLOG(@\"Trying to register same intercept at least once, this sounds like a possible bug\");\n        return YES;\n    }\n\n#if TRACE_RESOURCES\n    atomic_fetch_add(&numberOInterceptedMethods, 1);\n#endif\n    \n    DLOG(@\"Rx is swizzling `%@` for `%@`\", NSStringFromSelector(selector), class);\n\n    Method existingMethod = class_getInstanceMethod(class, selector);\n    ALWAYS(existingMethod != nil, @\"Method doesn't exist\");\n\n    const char *encoding = method_getTypeEncoding(existingMethod);\n    ALWAYS(encoding != nil, @\"Encoding is nil\");\n\n    IMP newImplementation = newImplementationGenerator();\n\n    if (class_addMethod(class, selector, newImplementation, encoding)) {\n        // new method added, job done\n        [self registerInterceptedSelector:selector implementation:newImplementation forClass:class];\n\n        return YES;\n    }\n\n    imp_removeBlock(newImplementation);\n\n    // if add fails, that means that method already exists on targetClass\n    Method existingMethodOnTargetClass = existingMethod;\n\n    IMP originalImplementation = method_getImplementation(existingMethodOnTargetClass);\n    ALWAYS(originalImplementation != nil, @\"Method must exist.\");\n    IMP implementationReplacementIMP = replacementImplementationGenerator(originalImplementation);\n    ALWAYS(implementationReplacementIMP != nil, @\"Method must exist.\");\n    IMP originalImplementationAfterChange = method_setImplementation(existingMethodOnTargetClass, implementationReplacementIMP);\n    ALWAYS(originalImplementation != nil, @\"Method must exist.\");\n\n    // If method replacing failed, who knows what happened, better not trying again, otherwise program can get\n    // corrupted.\n    [self registerInterceptedSelector:selector implementation:implementationReplacementIMP forClass:class];\n\n    // ¯\\_(ツ)_/¯\n    if (originalImplementationAfterChange != originalImplementation) {\n        THREADING_HAZARD(class);\n        return NO;\n    }\n\n    return YES;\n}\n\n@end\n\n#if TRACE_RESOURCES\n\nNSInteger RX_number_of_dynamic_subclasses(void) {\n    __block NSInteger count = 0;\n    [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) {\n        count = self.dynamicSubclassByRealClass.count;\n    }];\n\n    return count;\n}\n\nNSInteger RX_number_of_forwarding_enabled_classes(void) {\n    __block NSInteger count = 0;\n    [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) {\n        count = self.classesThatSupportObservingByForwarding.count;\n    }];\n\n    return count;\n}\n\nNSInteger RX_number_of_intercepting_classes(void) {\n    __block NSInteger count = 0;\n    [[RXObjCRuntime instance] performLocked:^(RXObjCRuntime * __nonnull self) {\n        count = self.interceptorIMPbySelectorsByClass.count;\n    }];\n\n    return count;\n}\n\nNSInteger RX_number_of_forwarded_methods(void) {\n    return numberOfForwardedMethods;\n}\n\nNSInteger RX_number_of_swizzled_methods(void) {\n    return numberOInterceptedMethods;\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h",
    "content": "//\n//  RxCocoaRuntime.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import \"_RX.h\"\n#import \"_RXDelegateProxy.h\"\n#import \"_RXKVOObserver.h\"\n#import \"_RXObjCRuntime.h\"\n\n//! Project version number for RxCocoa.\nFOUNDATION_EXPORT double RxCocoaVersionNumber;\n\n//! Project version string for RxCocoa.\nFOUNDATION_EXPORT const unsigned char RxCocoaVersionString[];\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h",
    "content": "//\n//  _RX.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <objc/runtime.h>\n\n/**\n ################################################################################\n This file is part of RX private API\n ################################################################################\n */\n\n#if        TRACE_RESOURCES >= 2\n#   define DLOG(...)         NSLog(__VA_ARGS__)\n#else\n#   define DLOG(...)\n#endif\n\n#if        DEBUG\n#   define ABORT_IN_DEBUG    abort();\n#else\n#   define ABORT_IN_DEBUG\n#endif\n\n\n#define SEL_VALUE(x)      [NSValue valueWithPointer:(x)]\n#define CLASS_VALUE(x)    [NSValue valueWithNonretainedObject:(x)]\n#define IMP_VALUE(x)      [NSValue valueWithPointer:(x)]\n\n/**\n Checks that the local `error` instance exists before assigning it's value by reference.\n This macro exists to work around static analysis warnings — `NSError` is always assumed to be `nullable`, even though we explicitly define the method parameter as `nonnull`. See http://www.openradar.me/21766176 for more details.\n */\n#define RX_THROW_ERROR(errorValue, returnValue) if (error != nil) { *error = (errorValue); } return (returnValue);\n\n#define RX_CAT2(_1, _2) _RX_CAT2(_1, _2)\n#define _RX_CAT2(_1, _2) _1 ## _2\n\n#define RX_ELEMENT_AT(n, ...) RX_CAT2(_RX_ELEMENT_AT_, n)(__VA_ARGS__)\n#define _RX_ELEMENT_AT_0(x, ...) x\n#define _RX_ELEMENT_AT_1(_0, x, ...) x\n#define _RX_ELEMENT_AT_2(_0, _1, x, ...) x\n#define _RX_ELEMENT_AT_3(_0, _1, _2, x, ...) x\n#define _RX_ELEMENT_AT_4(_0, _1, _2, _3, x, ...) x\n#define _RX_ELEMENT_AT_5(_0, _1, _2, _3, _4, x, ...) x\n#define _RX_ELEMENT_AT_6(_0, _1, _2, _3, _4, _5, x, ...) x\n\n#define RX_COUNT(...) RX_ELEMENT_AT(6, ## __VA_ARGS__, 6, 5, 4, 3, 2, 1, 0)\n#define RX_EMPTY(...) RX_ELEMENT_AT(6, ## __VA_ARGS__, 0, 0, 0, 0, 0, 0, 1)\n\n/**\n #define SUM(context, index, head, tail) head + tail\n #define MAP(context, index, element) (context)[index] * (element)\n\n RX_FOR(numbers, SUM, MAP, b0, b1, b2);\n\n (numbers)[0] * (b0) + (numbers)[1] * (b1) + (numbers[2]) * (b2)\n */\n\n#define RX_FOREACH(context, concat, map, ...) RX_FOR_MAX(RX_COUNT(__VA_ARGS__), _RX_FOREACH_CONCAT, _RX_FOREACH_MAP, context, concat, map, __VA_ARGS__)\n#define _RX_FOREACH_CONCAT(index, head, tail, context, concat, map, ...) concat(context, index, head, tail)\n#define _RX_FOREACH_MAP(index, context, concat, map, ...) map(context, index, RX_ELEMENT_AT(index, __VA_ARGS__))\n\n/**\n #define MAP(context, index, item) (context)[index] * (item)\n\n RX_FOR_COMMA(numbers, MAP, b0, b1);\n\n ,(numbers)[0] * b0, (numbers)[1] * b1\n */\n#define RX_FOREACH_COMMA(context, map, ...) RX_CAT2(_RX_FOREACH_COMMA_EMPTY_, RX_EMPTY(__VA_ARGS__))(context, map, ## __VA_ARGS__)\n#define _RX_FOREACH_COMMA_EMPTY_1(context, map, ...)\n#define _RX_FOREACH_COMMA_EMPTY_0(context, map, ...) , RX_FOR_MAX(RX_COUNT(__VA_ARGS__), _RX_FOREACH_COMMA_CONCAT, _RX_FOREACH_COMMA_MAP, context, map, __VA_ARGS__)\n#define _RX_FOREACH_COMMA_CONCAT(index, head, tail, context, map, ...) head, tail\n#define _RX_FOREACH_COMMA_MAP(index, context, map, ...) map(context, index, RX_ELEMENT_AT(index, __VA_ARGS__))\n\n// rx for\n\n#define RX_FOR_MAX(max, concat, map, ...) RX_CAT2(RX_FOR_, max)(concat, map, ## __VA_ARGS__)\n\n#define RX_FOR_0(concat, map, ...)\n#define RX_FOR_1(concat, map, ...) map(0, __VA_ARGS__)\n#define RX_FOR_2(concat, map, ...) concat(1, RX_FOR_1(concat, map, ## __VA_ARGS__), map(1, __VA_ARGS__), __VA_ARGS__)\n#define RX_FOR_3(concat, map, ...) concat(2, RX_FOR_2(concat, map, ## __VA_ARGS__), map(2, __VA_ARGS__), __VA_ARGS__)\n#define RX_FOR_4(concat, map, ...) concat(3, RX_FOR_3(concat, map, ## __VA_ARGS__), map(3, __VA_ARGS__), __VA_ARGS__)\n#define RX_FOR_5(concat, map, ...) concat(4, RX_FOR_4(concat, map, ## __VA_ARGS__), map(4, __VA_ARGS__), __VA_ARGS__)\n#define RX_FOR_6(concat, map, ...) concat(5, RX_FOR_5(concat, map, ## __VA_ARGS__), map(5, __VA_ARGS__), __VA_ARGS__)\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h",
    "content": "//\n//  _RXDelegateProxy.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/4/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface _RXDelegateProxy : NSObject\n\n@property (nonatomic, weak, readonly) id _forwardToDelegate;\n\n-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate NS_SWIFT_NAME(_setForwardToDelegate(_:retainDelegate:)) ;\n\n-(BOOL)hasWiredImplementationForSelector:(SEL)selector;\n-(BOOL)voidDelegateMethodsContain:(SEL)selector;\n\n-(void)_sentMessage:(SEL)selector withArguments:(NSArray*)arguments;\n-(void)_methodInvoked:(SEL)selector withArguments:(NSArray*)arguments;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h",
    "content": "//\n//  _RXKVOObserver.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n/**\n ################################################################################\n This file is part of RX private API\n ################################################################################\n */\n\n// Exists because if written in Swift, reading unowned is disabled during dealloc process\n@interface _RXKVOObserver : NSObject\n\n-(instancetype)initWithTarget:(id)target\n                 retainTarget:(BOOL)retainTarget\n                      keyPath:(NSString*)keyPath\n                      options:(NSKeyValueObservingOptions)options\n                     callback:(void (^)(id))callback;\n\n-(void)dispose;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h",
    "content": "//\n//  _RXObjCRuntime.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/11/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n#if !DISABLE_SWIZZLING\n\n/**\n ################################################################################\n This file is part of RX private API\n ################################################################################\n */\n\n/**\n This flag controls `RELEASE` configuration behavior in case race was detecting while modifying\n ObjC runtime.\n\n In case this value is set to `YES`, after runtime race is detected, `abort()` will be called.\n Otherwise, only error will be reported using normal error reporting mechanism.\n\n In `DEBUG` mode `abort` will be always called in case race is detected.\n \n Races can't happen in case this is the only library modifying ObjC runtime, but in case there are multiple libraries\n changing ObjC runtime, race conditions can occur because there is no way to synchronize multiple libraries unaware of\n each other.\n\n To help remedy this situation this library will use `synchronized` on target object and it's meta-class, but\n there aren't any guarantees of how other libraries will behave.\n\n Default value is `NO`.\n\n */\nextern BOOL RXAbortOnThreadingHazard;\n\n/// Error domain for RXObjCRuntime.\nextern NSString * __nonnull const RXObjCRuntimeErrorDomain;\n\n/// `userInfo` key with additional information is interceptor probably KVO.\nextern NSString * __nonnull const RXObjCRuntimeErrorIsKVOKey;\n\ntypedef NS_ENUM(NSInteger, RXObjCRuntimeError) {\n    RXObjCRuntimeErrorUnknown                                           = 1,\n    RXObjCRuntimeErrorObjectMessagesAlreadyBeingIntercepted             = 2,\n    RXObjCRuntimeErrorSelectorNotImplemented                            = 3,\n    RXObjCRuntimeErrorCantInterceptCoreFoundationTollFreeBridgedObjects = 4,\n    RXObjCRuntimeErrorThreadingCollisionWithOtherInterceptionMechanism  = 5,\n    RXObjCRuntimeErrorSavingOriginalForwardingMethodFailed              = 6,\n    RXObjCRuntimeErrorReplacingMethodWithForwardingImplementation       = 7,\n    RXObjCRuntimeErrorObservingPerformanceSensitiveMessages             = 8,\n    RXObjCRuntimeErrorObservingMessagesWithUnsupportedReturnType        = 9,\n};\n\n/// Transforms normal selector into a selector with RX prefix.\nSEL _Nonnull RX_selector(SEL _Nonnull selector);\n\n/// Transforms selector into a unique pointer (because of Swift conversion rules)\nvoid * __nonnull RX_reference_from_selector(SEL __nonnull selector);\n\n/// Protocol that interception observers must implement.\n@protocol RXMessageSentObserver\n\n/// In case the same selector is being intercepted for a pair of base/sub classes,\n/// this property will differentiate between interceptors that need to fire.\n@property (nonatomic, assign, readonly) IMP __nonnull targetImplementation;\n\n-(void)messageSentWithArguments:(NSArray* __nonnull)arguments;\n-(void)methodInvokedWithArguments:(NSArray* __nonnull)arguments;\n\n@end\n\n/// Protocol that deallocating observer must implement.\n@protocol RXDeallocatingObserver\n\n/// In case the same selector is being intercepted for a pair of base/sub classes,\n/// this property will differentiate between interceptors that need to fire.\n@property (nonatomic, assign, readonly) IMP __nonnull targetImplementation;\n\n-(void)deallocating;\n\n@end\n\n/// Ensures interceptor is installed on target object.\nIMP __nullable RX_ensure_observing(id __nonnull target, SEL __nonnull selector, NSError *__autoreleasing __nullable * __nullable error);\n\n#endif\n\n/// Extracts arguments for `invocation`.\nNSArray * __nonnull RX_extract_arguments(NSInvocation * __nonnull invocation);\n\n/// Returns `YES` in case method has `void` return type.\nBOOL RX_is_method_with_description_void(struct objc_method_description method);\n\n/// Returns `YES` in case methodSignature has `void` return type.\nBOOL RX_is_method_signature_void(NSMethodSignature * __nonnull methodSignature);\n\n/// Default value for `RXInterceptionObserver.targetImplementation`.\nIMP __nonnull RX_default_target_implementation(void);\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/RxCocoa.h",
    "content": "//\n//  RxCocoa.h\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <RxCocoa/_RX.h>\n#import <RxCocoa/_RXDelegateProxy.h>\n#import <RxCocoa/_RXKVOObserver.h>\n#import <RxCocoa/_RXObjCRuntime.h>\n\n//! Project version number for RxCocoa.\nFOUNDATION_EXPORT double RxCocoaVersionNumber;\n\n//! Project version string for RxCocoa.\nFOUNDATION_EXPORT const unsigned char RxCocoaVersionString[];\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/RxCocoa.swift",
    "content": "//\n//  RxCocoa.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n// Importing RxCocoa also imports RxRelay\n@_exported import RxRelay\n\nimport RxSwift\n#if os(iOS)\n    import UIKit\n#endif\n\n/// RxCocoa errors.\npublic enum RxCocoaError\n    : Swift.Error\n    , CustomDebugStringConvertible {\n    /// Unknown error has occurred.\n    case unknown\n    /// Invalid operation was attempted.\n    case invalidOperation(object: Any)\n    /// Items are not yet bound to user interface but have been requested.\n    case itemsNotYetBound(object: Any)\n    /// Invalid KVO Path.\n    case invalidPropertyName(object: Any, propertyName: String)\n    /// Invalid object on key path.\n    case invalidObjectOnKeyPath(object: Any, sourceObject: AnyObject, propertyName: String)\n    /// Error during swizzling.\n    case errorDuringSwizzling\n    /// Casting error.\n    case castingError(object: Any, targetType: Any.Type)\n}\n\n\n// MARK: Debug descriptions\n\nextension RxCocoaError {\n    /// A textual representation of `self`, suitable for debugging.\n    public var debugDescription: String {\n        switch self {\n        case .unknown:\n            return \"Unknown error occurred.\"\n        case let .invalidOperation(object):\n            return \"Invalid operation was attempted on `\\(object)`.\"\n        case let .itemsNotYetBound(object):\n            return \"Data source is set, but items are not yet bound to user interface for `\\(object)`.\"\n        case let .invalidPropertyName(object, propertyName):\n            return \"Object `\\(object)` doesn't have a property named `\\(propertyName)`.\"\n        case let .invalidObjectOnKeyPath(object, sourceObject, propertyName):\n            return \"Unobservable object `\\(object)` was observed as `\\(propertyName)` of `\\(sourceObject)`.\"\n        case .errorDuringSwizzling:\n            return \"Error during swizzling.\"\n        case let .castingError(object, targetType):\n            return \"Error casting `\\(object)` to `\\(targetType)`\"\n        }\n    }\n}\n\n\n\n// MARK: Error binding policies\n\nfunc bindingError(_ error: Swift.Error) {\n    let error = \"Binding error: \\(error)\"\n#if DEBUG\n    rxFatalError(error)\n#else\n    print(error)\n#endif\n}\n\n/// Swift does not implement abstract methods. This method is used as a runtime check to ensure that methods which intended to be abstract (i.e., they should be implemented in subclasses) are not called directly on the superclass.\nfunc rxAbstractMethod(message: String = \"Abstract method\", file: StaticString = #file, line: UInt = #line) -> Swift.Never {\n    rxFatalError(message, file: file, line: line)\n}\n\nfunc rxFatalError(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Swift.Never  {\n    // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours.\n    fatalError(lastMessage(), file: file, line: line)\n}\n\nfunc rxFatalErrorInDebug(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) {\n    #if DEBUG\n        fatalError(lastMessage(), file: file, line: line)\n    #else\n        print(\"\\(file):\\(line): \\(lastMessage())\")\n    #endif\n}\n\n// MARK: casts or fatal error\n\n// workaround for Swift compiler bug, cheers compiler team :)\nfunc castOptionalOrFatalError<T>(_ value: Any?) -> T? {\n    if value == nil {\n        return nil\n    }\n    let v: T = castOrFatalError(value)\n    return v\n}\n\nfunc castOrThrow<T>(_ resultType: T.Type, _ object: Any) throws -> T {\n    guard let returnValue = object as? T else {\n        throw RxCocoaError.castingError(object: object, targetType: resultType)\n    }\n\n    return returnValue\n}\n\nfunc castOptionalOrThrow<T>(_ resultType: T.Type, _ object: AnyObject) throws -> T? {\n    if NSNull().isEqual(object) {\n        return nil\n    }\n\n    guard let returnValue = object as? T else {\n        throw RxCocoaError.castingError(object: object, targetType: resultType)\n    }\n\n    return returnValue\n}\n\nfunc castOrFatalError<T>(_ value: AnyObject!, message: String) -> T {\n    let maybeResult: T? = value as? T\n    guard let result = maybeResult else {\n        rxFatalError(message)\n    }\n    \n    return result\n}\n\nfunc castOrFatalError<T>(_ value: Any!) -> T {\n    let maybeResult: T? = value as? T\n    guard let result = maybeResult else {\n        rxFatalError(\"Failure converting from \\(String(describing: value)) to \\(T.self)\")\n    }\n    \n    return result\n}\n\n// MARK: Error messages\n\nlet dataSourceNotSet = \"DataSource not set\"\nlet delegateNotSet = \"Delegate not set\"\n\n// MARK: Shared with RxSwift\n\nfunc rxFatalError(_ lastMessage: String) -> Never  {\n    // The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours.\n    fatalError(lastMessage)\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/ControlEvent.swift",
    "content": "//\n//  ControlEvent.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/// A protocol that extends `ControlEvent`.\npublic protocol ControlEventType : ObservableType {\n\n    /// - returns: `ControlEvent` interface\n    func asControlEvent() -> ControlEvent<Element>\n}\n\n/**\n    A trait for `Observable`/`ObservableType` that represents an event on a UI element.\n\n    Properties:\n\n    - it doesn’t send any initial value on subscription,\n    - it `Complete`s the sequence when the control deallocates,\n    - it never errors out\n    - it delivers events on `MainScheduler.instance`.\n\n    **The implementation of `ControlEvent` will ensure that sequence of events is being subscribed on main scheduler\n     (`subscribe(on: ConcurrentMainScheduler.instance)` behavior).**\n\n    **It is the implementor’s responsibility to make sure that all other properties enumerated above are satisfied.**\n\n    **If they aren’t, using this trait will communicate wrong properties, and could potentially break someone’s code.**\n\n    **If the `events` observable sequence passed into the initializer doesn’t satisfy all enumerated\n     properties, don’t use this trait.**\n*/\npublic struct ControlEvent<PropertyType> : ControlEventType {\n    public typealias Element = PropertyType\n\n    let events: Observable<PropertyType>\n\n    /// Initializes control event with a observable sequence that represents events.\n    ///\n    /// - parameter events: Observable sequence that represents events.\n    /// - returns: Control event created with a observable sequence of events.\n    public init<Ev: ObservableType>(events: Ev) where Ev.Element == Element {\n        self.events = events.subscribe(on: ConcurrentMainScheduler.instance)\n    }\n\n    /// Subscribes an observer to control events.\n    ///\n    /// - parameter observer: Observer to subscribe to events.\n    /// - returns: Disposable object that can be used to unsubscribe the observer from receiving control events.\n    public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.events.subscribe(observer)\n    }\n\n    /// - returns: `Observable` interface.\n    public func asObservable() -> Observable<Element> {\n        self.events\n    }\n\n    /// - returns: `ControlEvent` interface.\n    public func asControlEvent() -> ControlEvent<Element> {\n        self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/ControlProperty.swift",
    "content": "//\n//  ControlProperty.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/// Protocol that enables extension of `ControlProperty`.\npublic protocol ControlPropertyType : ObservableType, ObserverType {\n\n    /// - returns: `ControlProperty` interface\n    func asControlProperty() -> ControlProperty<Element>\n}\n\n/**\n    Trait for `Observable`/`ObservableType` that represents property of UI element.\n \n    Sequence of values only represents initial control value and user initiated value changes.\n    Programmatic value changes won't be reported.\n\n    It's properties are:\n\n    - `shareReplay(1)` behavior\n        - it's stateful, upon subscription (calling subscribe) last element is immediately replayed if it was produced\n    - it will `Complete` sequence on control being deallocated\n    - it never errors out\n    - it delivers events on `MainScheduler.instance`\n\n    **The implementation of `ControlProperty` will ensure that sequence of values is being subscribed on main scheduler\n    (`subscribe(on: ConcurrentMainScheduler.instance)` behavior).**\n\n    **It is implementor's responsibility to make sure that that all other properties enumerated above are satisfied.**\n\n    **If they aren't, then using this trait communicates wrong properties and could potentially break someone's code.**\n\n    **In case `values` observable sequence that is being passed into initializer doesn't satisfy all enumerated\n    properties, please don't use this trait.**\n*/\npublic struct ControlProperty<PropertyType> : ControlPropertyType {\n    public typealias Element = PropertyType\n\n    let values: Observable<PropertyType>\n    let valueSink: AnyObserver<PropertyType>\n\n    /// Initializes control property with a observable sequence that represents property values and observer that enables\n    /// binding values to property.\n    ///\n    /// - parameter values: Observable sequence that represents property values.\n    /// - parameter valueSink: Observer that enables binding values to control property.\n    /// - returns: Control property created with a observable sequence of values and an observer that enables binding values\n    /// to property.\n    public init<Values: ObservableType, Sink: ObserverType>(values: Values, valueSink: Sink) where Element == Values.Element, Element == Sink.Element {\n        self.values = values.subscribe(on: ConcurrentMainScheduler.instance)\n        self.valueSink = valueSink.asObserver()\n    }\n\n    /// Subscribes an observer to control property values.\n    ///\n    /// - parameter observer: Observer to subscribe to property values.\n    /// - returns: Disposable object that can be used to unsubscribe the observer from receiving control property values.\n    public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.values.subscribe(observer)\n    }\n\n    /// `ControlEvent` of user initiated value changes. Every time user updates control value change event\n    /// will be emitted from `changed` event.\n    ///\n    /// Programmatic changes to control value won't be reported.\n    ///\n    /// It contains all control property values except for first one.\n    ///\n    /// The name only implies that sequence element will be generated once user changes a value and not that\n    /// adjacent sequence values need to be different (e.g. because of interaction between programmatic and user updates,\n    /// or for any other reason).\n    public var changed: ControlEvent<PropertyType> {\n        ControlEvent(events: self.values.skip(1))\n    }\n\n    /// - returns: `Observable` interface.\n    public func asObservable() -> Observable<Element> {\n        self.values\n    }\n\n    /// - returns: `ControlProperty` interface.\n    public func asControlProperty() -> ControlProperty<Element> {\n        self\n    }\n\n    /// Binds event to user interface.\n    ///\n    /// - In case next element is received, it is being set to control value.\n    /// - In case error is received, DEBUG builds raise fatal error, RELEASE builds log event to standard output.\n    /// - In case sequence completes, nothing happens.\n    public func on(_ event: Event<Element>) {\n        switch event {\n        case .error(let error):\n            bindingError(error)\n        case .next:\n            self.valueSink.on(event)\n        case .completed:\n            self.valueSink.on(event)\n        }\n    }\n}\n\nextension ControlPropertyType where Element == String? {\n    /// Transforms control property of type `String?` into control property of type `String`.\n    public var orEmpty: ControlProperty<String> {\n        let original: ControlProperty<String?> = self.asControlProperty()\n\n        let values: Observable<String> = original.values.map { $0 ?? \"\" }\n        let valueSink: AnyObserver<String> = original.valueSink.mapObserver { $0 }\n        return ControlProperty<String>(values: values, valueSink: valueSink)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift",
    "content": "//\n//  BehaviorRelay+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 10/7/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\nimport RxRelay\n\nextension BehaviorRelay {\n    /// Converts `BehaviorRelay` to `Driver`.\n    ///\n    /// - returns: Observable sequence.\n    public func asDriver() -> Driver<Element> {\n        let source = self.asObservable()\n            .observe(on:DriverSharingStrategy.scheduler)\n        return SharedSequence(source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlEvent+Driver.swift",
    "content": "//\n//  ControlEvent+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n    \nextension ControlEvent {\n    /// Converts `ControlEvent` to `Driver` trait.\n    ///\n    /// `ControlEvent` already can't fail, so no special case needs to be handled.\n    public func asDriver() -> Driver<Element> {\n        return self.asDriver { _ -> Driver<Element> in\n            #if DEBUG\n                rxFatalError(\"Somehow driver received error from a source that shouldn't fail.\")\n            #else\n                return Driver.empty()\n            #endif\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Driver/ControlProperty+Driver.swift",
    "content": "//\n//  ControlProperty+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension ControlProperty {\n    /// Converts `ControlProperty` to `Driver` trait.\n    ///\n    /// `ControlProperty` already can't fail, so no special case needs to be handled.\n    public func asDriver() -> Driver<Element> {\n        return self.asDriver { _ -> Driver<Element> in\n            #if DEBUG\n                rxFatalError(\"Somehow driver received error from a source that shouldn't fail.\")\n            #else\n                return Driver.empty()\n            #endif\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver+Subscription.swift",
    "content": "//\n//  Driver+Subscription.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\nimport RxRelay\n\nprivate let errorMessage = \"`drive*` family of methods can be only called from `MainThread`.\\n\" +\n\"This is required to ensure that the last replayed `Driver` element is delivered on `MainThread`.\\n\"\n\nextension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy {\n    /**\n    Creates new subscription and sends elements to observer.\n    This method can be only called from `MainThread`.\n\n    In this form it's equivalent to `subscribe` method, but it communicates intent better.\n\n    - parameter observers: Observers that receives events.\n    - returns: Disposable object that can be used to unsubscribe the observer from the subject.\n    */\n    public func drive<Observer: ObserverType>(_ observers: Observer...) -> Disposable where Observer.Element == Element {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.asSharedSequence()\n                   .asObservable()\n                   .subscribe { e in\n                    observers.forEach { $0.on(e) }\n                   }\n    }\n\n    /**\n     Creates new subscription and sends elements to observer.\n     This method can be only called from `MainThread`.\n\n     In this form it's equivalent to `subscribe` method, but it communicates intent better.\n\n     - parameter observers: Observers that receives events.\n     - returns: Disposable object that can be used to unsubscribe the observer from the subject.\n     */\n    public func drive<Observer: ObserverType>(_ observers: Observer...) -> Disposable where Observer.Element == Element? {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.asSharedSequence()\n                   .asObservable()\n                   .map { $0 as Element? }\n                   .subscribe { e in\n                    observers.forEach { $0.on(e) }\n                   }\n    }\n\n    /**\n    Creates new subscription and sends elements to `BehaviorRelay`.\n    This method can be only called from `MainThread`.\n\n    - parameter relays: Target relays for sequence elements.\n    - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n    */\n    public func drive(_ relays: BehaviorRelay<Element>...) -> Disposable {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.drive(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `BehaviorRelay`.\n     This method can be only called from `MainThread`.\n\n     - parameter relays: Target relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func drive(_ relays: BehaviorRelay<Element?>...) -> Disposable {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.drive(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n    Creates new subscription and sends elements to `ReplayRelay`.\n    This method can be only called from `MainThread`.\n\n    - parameter relays: Target relays for sequence elements.\n    - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n    */\n    public func drive(_ relays: ReplayRelay<Element>...) -> Disposable {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.drive(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `ReplayRelay`.\n     This method can be only called from `MainThread`.\n\n     - parameter relays: Target relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func drive(_ relays: ReplayRelay<Element?>...) -> Disposable {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.drive(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n    Subscribes to observable sequence using custom binder function.\n    This method can be only called from `MainThread`.\n\n    - parameter transformation: Function used to bind elements from `self`.\n    - returns: Object representing subscription.\n    */\n    public func drive<Result>(_ transformation: (Observable<Element>) -> Result) -> Result {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return transformation(self.asObservable())\n    }\n\n    /**\n    Subscribes to observable sequence using custom binder function and final parameter passed to binder function\n    after `self` is passed.\n\n        public func drive<R1, R2>(with: Self -> R1 -> R2, curriedArgument: R1) -> R2 {\n            return with(self)(curriedArgument)\n        }\n\n    This method can be only called from `MainThread`.\n\n    - parameter with: Function used to bind elements from `self`.\n    - parameter curriedArgument: Final argument passed to `binder` to finish binding process.\n    - returns: Object representing subscription.\n    */\n    public func drive<R1, R2>(_ with: (Observable<Element>) -> (R1) -> R2, curriedArgument: R1) -> R2 {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return with(self.asObservable())(curriedArgument)\n    }\n    \n    /**\n    Subscribes an element handler, a completion handler and disposed handler to an observable sequence.\n    This method can be only called from `MainThread`.\n     \n    Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.\n    \n    Error callback is not exposed because `Driver` can't error out.\n     \n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n    - parameter object: The object to provide an unretained reference on.\n    - parameter onNext: Action to invoke for each element in the observable sequence.\n    - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n    gracefully completed, errored, or if the generation is canceled by disposing subscription)\n    - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n    gracefully completed, errored, or if the generation is canceled by disposing subscription)\n    - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func drive<Object: AnyObject>(\n        with object: Object,\n        onNext: ((Object, Element) -> Void)? = nil,\n        onCompleted: ((Object) -> Void)? = nil,\n        onDisposed: ((Object) -> Void)? = nil\n    ) -> Disposable {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.asObservable().subscribe(with: object, onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed)\n    }\n    \n    /**\n    Subscribes an element handler, a completion handler and disposed handler to an observable sequence.\n    This method can be only called from `MainThread`.\n    \n    Error callback is not exposed because `Driver` can't error out.\n    \n    - parameter onNext: Action to invoke for each element in the observable sequence.\n    - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n    gracefully completed, errored, or if the generation is canceled by disposing subscription)\n    - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n    gracefully completed, errored, or if the generation is canceled by disposing subscription)\n    - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func drive(\n        onNext: ((Element) -> Void)? = nil,\n        onCompleted: (() -> Void)? = nil,\n        onDisposed: (() -> Void)? = nil\n    ) -> Disposable {\n        MainScheduler.ensureRunningOnMainThread(errorMessage: errorMessage)\n        return self.asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed)\n    }\n\n    /**\n    Subscribes to this `Driver` with a no-op.\n    This method can be only called from `MainThread`.\n\n    - note: This is an alias of `drive(onNext: nil, onCompleted: nil, onDisposed: nil)` used to fix an ambiguity bug in Swift: https://bugs.swift.org/browse/SR-13657\n\n    - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func drive() -> Disposable {\n        drive(onNext: nil, onCompleted: nil, onDisposed: nil)\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Driver/Driver.swift",
    "content": "//\n//  Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/26/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/**\n Trait that represents observable sequence with following properties:\n\n - it never fails\n - it delivers events on `MainScheduler.instance`\n - `share(replay: 1, scope: .whileConnected)` sharing strategy\n \n Additional explanation:\n - all observers share sequence computation resources\n - it's stateful, upon subscription (calling subscribe) last element is immediately replayed if it was produced\n - computation of elements is reference counted with respect to the number of observers\n - if there are no subscribers, it will release sequence computation resources\n\n In case trait that models event bus is required, please check `Signal`.\n\n `Driver<Element>` can be considered a builder pattern for observable sequences that drive the application.\n\n If observable sequence has produced at least one element, after new subscription is made last produced element will be\n immediately replayed on the same thread on which the subscription was made.\n\n When using `drive*`, `subscribe*` and `bind*` family of methods, they should always be called from main thread.\n\n If `drive*`, `subscribe*` and `bind*` are called from background thread, it is possible that initial replay\n will happen on background thread, and subsequent events will arrive on main thread.\n\n To find out more about traits and how to use them, please visit `Documentation/Traits.md`.\n */\npublic typealias Driver<Element> = SharedSequence<DriverSharingStrategy, Element>\n\npublic struct DriverSharingStrategy: SharingStrategyProtocol {\n    public static var scheduler: SchedulerType { SharingScheduler.make() }\n    public static func share<Element>(_ source: Observable<Element>) -> Observable<Element> {\n        source.share(replay: 1, scope: .whileConnected)\n    }\n}\n\nextension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy {\n    /// Adds `asDriver` to `SharingSequence` with `DriverSharingStrategy`.\n    public func asDriver() -> Driver<Element> {\n        self.asSharedSequence()\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift",
    "content": "//\n//  ObservableConvertibleType+Driver.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension ObservableConvertibleType {\n    /**\n    Converts observable sequence to `Driver` trait.\n    \n    - parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence.\n    - returns: Driver trait.\n    */\n    public func asDriver(onErrorJustReturn: Element) -> Driver<Element> {\n        let source = self\n            .asObservable()\n            .observe(on:DriverSharingStrategy.scheduler)\n            .catchAndReturn(onErrorJustReturn)\n        return Driver(source)\n    }\n    \n    /**\n    Converts observable sequence to `Driver` trait.\n    \n    - parameter onErrorDriveWith: Driver that continues to drive the sequence in case of error.\n    - returns: Driver trait.\n    */\n    public func asDriver(onErrorDriveWith: Driver<Element>) -> Driver<Element> {\n        let source = self\n            .asObservable()\n            .observe(on:DriverSharingStrategy.scheduler)\n            .catch { _ in\n                onErrorDriveWith.asObservable()\n            }\n        return Driver(source)\n    }\n\n    /**\n    Converts observable sequence to `Driver` trait.\n    \n    - parameter onErrorRecover: Calculates driver that continues to drive the sequence in case of error.\n    - returns: Driver trait.\n    */\n    public func asDriver(onErrorRecover: @escaping (_ error: Swift.Error) -> Driver<Element>) -> Driver<Element> {\n        let source = self\n            .asObservable()\n            .observe(on:DriverSharingStrategy.scheduler)\n            .catch { error in\n                onErrorRecover(error).asObservable()\n            }\n        return Driver(source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift",
    "content": "//\n//  ObservableConvertibleType+SharedSequence.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/1/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension ObservableConvertibleType {\n    /**\n     Converts anything convertible to `Observable` to `SharedSequence` unit.\n\n     - parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence.\n     - returns: Driving observable sequence.\n     */\n    public func asSharedSequence<S>(sharingStrategy: S.Type = S.self, onErrorJustReturn: Element) -> SharedSequence<S, Element> {\n        let source = self\n            .asObservable()\n            .observe(on:S.scheduler)\n            .catchAndReturn(onErrorJustReturn)\n        return SharedSequence(source)\n    }\n\n    /**\n     Converts anything convertible to `Observable` to `SharedSequence` unit.\n\n     - parameter onErrorDriveWith: SharedSequence that provides elements of the sequence in case of error.\n     - returns: Driving observable sequence.\n     */\n    public func asSharedSequence<S>(sharingStrategy: S.Type = S.self, onErrorDriveWith: SharedSequence<S, Element>) -> SharedSequence<S, Element> {\n        let source = self\n            .asObservable()\n            .observe(on:S.scheduler)\n            .catch { _ in\n                onErrorDriveWith.asObservable()\n            }\n        return SharedSequence(source)\n    }\n\n    /**\n     Converts anything convertible to `Observable` to `SharedSequence` unit.\n\n     - parameter onErrorRecover: Calculates driver that continues to drive the sequence in case of error.\n     - returns: Driving observable sequence.\n     */\n    public func asSharedSequence<S>(sharingStrategy: S.Type = S.self, onErrorRecover: @escaping (_ error: Swift.Error) -> SharedSequence<S, Element>) -> SharedSequence<S, Element> {\n        let source = self\n            .asObservable()\n            .observe(on:S.scheduler)\n            .catch { error in\n                onErrorRecover(error).asObservable()\n            }\n        return SharedSequence(source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift",
    "content": "//\n//  SchedulerType+SharedSequence.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/27/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\npublic enum SharingScheduler {\n    /// Default scheduler used in SharedSequence based traits.\n    public private(set) static var make: () -> SchedulerType = { MainScheduler() }\n\n    /**\n     This method can be used in unit tests to ensure that built in shared sequences are using mock schedulers instead\n     of main schedulers.\n\n     **This shouldn't be used in normal release builds.**\n    */\n    static public func mock(scheduler: SchedulerType, action: () throws -> Void) rethrows {\n        return try mock(makeScheduler: { scheduler }, action: action)\n    }\n\n    /**\n     This method can be used in unit tests to ensure that built in shared sequences are using mock schedulers instead\n     of main schedulers.\n\n     **This shouldn't be used in normal release builds.**\n     */\n    static public func mock(makeScheduler: @escaping () -> SchedulerType, action: () throws -> Void) rethrows {\n        let originalMake = make\n        make = makeScheduler\n        defer {\n            make = originalMake\n        }\n\n        try action()\n\n        // If you remove this line , compiler buggy optimizations will change behavior of this code\n        _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(makeScheduler)\n        // Scary, I know\n    }\n}\n\n#if os(Linux)\n    import Glibc\n#else\n    import Foundation\n#endif\n\nfunc _forceCompilerToStopDoingInsaneOptimizationsThatBreakCode(_ scheduler: () -> SchedulerType) {\n    let a: Int32 = 1\n#if os(Linux)\n    let b = 314 + Int32(Glibc.random() & 1)\n#else\n    let b = 314 + Int32(arc4random() & 1)\n#endif\n    if a == b {\n        print(scheduler())\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Concurrency.swift",
    "content": "//\n//  SharedSequence+Concurrency.swift\n//  RxCocoa\n//\n//  Created by Shai Mishali on 22/09/2021.\n//  Copyright © 2021 Krunoslav Zaher. All rights reserved.\n//\n\n#if swift(>=5.5.2) && canImport(_Concurrency) && !os(Linux)\nimport Foundation\n\n// MARK: - Shared Sequence\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic extension SharedSequence {\n    /// Allows iterating over the values of this Shared Sequence\n    /// asynchronously via Swift's concurrency features (`async/await`)\n    ///\n    /// A sample usage would look like so:\n    ///\n    /// ```swift\n    /// for await value in driver.values {\n    ///     // Handle emitted values\n    /// }\n    /// ```\n    @MainActor var values: AsyncStream<Element> {\n        AsyncStream { continuation in\n            // It is safe to ignore the `onError` closure here since\n            // Shared Sequences (`Driver` and `Signal`) cannot fail\n            let disposable = self.asObservable()\n                .subscribe(\n                    onNext: { value in continuation.yield(value) },\n                    onCompleted: { continuation.finish() },\n                    onDisposed: { continuation.onTermination?(.cancelled) }\n                )\n\n            continuation.onTermination = { @Sendable _ in\n                disposable.dispose()\n            }\n        }\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift",
    "content": "// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \n//\n//  SharedSequence+Operators+arity.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 10/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n\n\n// 2\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)\n        -> SharedSequence<O1.SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(),\n            resultSelector: resultSelector\n        )\n\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2)\n        -> SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable()\n        )\n\n        return SharedSequence<SharingStrategy, (O1.Element, O2.Element)>(source)\n    }\n}\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)\n        -> SharedSequence<SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(),\n                resultSelector: resultSelector\n            )\n\n        return SharedSequence<O1.SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2)\n        -> SharedSequence<SharingStrategy, (O1.Element, O2.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable()\n            )\n\n        return SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element)>(source)\n    }\n}\n\n\n\n// 3\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)\n        -> SharedSequence<O1.SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(),\n            resultSelector: resultSelector\n        )\n\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3)\n        -> SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable()\n        )\n\n        return SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element)>(source)\n    }\n}\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)\n        -> SharedSequence<SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(),\n                resultSelector: resultSelector\n            )\n\n        return SharedSequence<O1.SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3)\n        -> SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable()\n            )\n\n        return SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element)>(source)\n    }\n}\n\n\n\n// 4\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)\n        -> SharedSequence<O1.SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(),\n            resultSelector: resultSelector\n        )\n\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)\n        -> SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable()\n        )\n\n        return SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element)>(source)\n    }\n}\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)\n        -> SharedSequence<SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(),\n                resultSelector: resultSelector\n            )\n\n        return SharedSequence<O1.SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)\n        -> SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable()\n            )\n\n        return SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element)>(source)\n    }\n}\n\n\n\n// 5\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)\n        -> SharedSequence<O1.SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(),\n            resultSelector: resultSelector\n        )\n\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)\n        -> SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable()\n        )\n\n        return SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)>(source)\n    }\n}\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)\n        -> SharedSequence<SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(),\n                resultSelector: resultSelector\n            )\n\n        return SharedSequence<O1.SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)\n        -> SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable()\n            )\n\n        return SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)>(source)\n    }\n}\n\n\n\n// 6\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)\n        -> SharedSequence<O1.SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(),\n            resultSelector: resultSelector\n        )\n\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)\n        -> SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable()\n        )\n\n        return SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)>(source)\n    }\n}\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)\n        -> SharedSequence<SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(),\n                resultSelector: resultSelector\n            )\n\n        return SharedSequence<O1.SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)\n        -> SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable()\n            )\n\n        return SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)>(source)\n    }\n}\n\n\n\n// 7\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)\n        -> SharedSequence<O1.SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(),\n            resultSelector: resultSelector\n        )\n\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)\n        -> SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable()\n        )\n\n        return SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)>(source)\n    }\n}\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)\n        -> SharedSequence<SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(),\n                resultSelector: resultSelector\n            )\n\n        return SharedSequence<O1.SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)\n        -> SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable()\n            )\n\n        return SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)>(source)\n    }\n}\n\n\n\n// 8\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType, O8: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)\n        -> SharedSequence<O1.SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy,\n            SharingStrategy == O8.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable(),\n            resultSelector: resultSelector\n        )\n\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType, O8: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)\n        -> SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy,\n            SharingStrategy == O8.SharingStrategy {\n        let source = Observable.zip(\n            source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable()\n        )\n\n        return SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)>(source)\n    }\n}\n\nextension SharedSequence {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType, O8: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)\n        -> SharedSequence<SharingStrategy, Element> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy,\n            SharingStrategy == O8.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable(),\n                resultSelector: resultSelector\n            )\n\n        return SharedSequence<O1.SharingStrategy, Element>(source)\n    }\n}\n\nextension SharedSequenceConvertibleType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of element tuples whenever any of the observable sequences produces an element.\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: SharedSequenceConvertibleType, O2: SharedSequenceConvertibleType, O3: SharedSequenceConvertibleType, O4: SharedSequenceConvertibleType, O5: SharedSequenceConvertibleType, O6: SharedSequenceConvertibleType, O7: SharedSequenceConvertibleType, O8: SharedSequenceConvertibleType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)\n        -> SharedSequence<SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)> where SharingStrategy == O1.SharingStrategy,\n            SharingStrategy == O2.SharingStrategy,\n            SharingStrategy == O3.SharingStrategy,\n            SharingStrategy == O4.SharingStrategy,\n            SharingStrategy == O5.SharingStrategy,\n            SharingStrategy == O6.SharingStrategy,\n            SharingStrategy == O7.SharingStrategy,\n            SharingStrategy == O8.SharingStrategy {\n        let source = Observable.combineLatest(\n                source1.asSharedSequence().asObservable(), source2.asSharedSequence().asObservable(), source3.asSharedSequence().asObservable(), source4.asSharedSequence().asObservable(), source5.asSharedSequence().asObservable(), source6.asSharedSequence().asObservable(), source7.asSharedSequence().asObservable(), source8.asSharedSequence().asObservable()\n            )\n\n        return SharedSequence<O1.SharingStrategy, (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)>(source)\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift",
    "content": "//\n//  SharedSequence+Operators.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n// MARK: map\nextension SharedSequenceConvertibleType {\n    \n    /**\n    Projects each element of an observable sequence into a new form.\n    \n    - parameter selector: A transform function to apply to each source element.\n    - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.\n    */\n    public func map<Result>(_ selector: @escaping (Element) -> Result) -> SharedSequence<SharingStrategy, Result> {\n        let source = self\n            .asObservable()\n            .map(selector)\n        return SharedSequence<SharingStrategy, Result>(source)\n    }\n}\n\n// MARK: compactMap\nextension SharedSequenceConvertibleType {\n    \n    /**\n     Projects each element of an observable sequence into an optional form and filters all optional results.\n     \n     - parameter selector: A transform function to apply to each source element and which returns an element or nil.\n     - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source.\n     \n     */\n    public func compactMap<Result>(_ selector: @escaping (Element) -> Result?) -> SharedSequence<SharingStrategy, Result> {\n        let source = self\n            .asObservable()\n            .compactMap(selector)\n        return SharedSequence<SharingStrategy, Result>(source)\n    }\n}\n\n// MARK: filter\nextension SharedSequenceConvertibleType {\n    /**\n    Filters the elements of an observable sequence based on a predicate.\n    \n    - parameter predicate: A function to test each source element for a condition.\n    - returns: An observable sequence that contains elements from the input sequence that satisfy the condition.\n    */\n    public func filter(_ predicate: @escaping (Element) -> Bool) -> SharedSequence<SharingStrategy, Element> {\n        let source = self\n            .asObservable()\n            .filter(predicate)\n        return SharedSequence(source)\n    }\n}\n\n// MARK: switchLatest\nextension SharedSequenceConvertibleType where Element: SharedSequenceConvertibleType {\n    \n    /**\n    Transforms an observable sequence of observable sequences into an observable sequence\n    producing values only from the most recent observable sequence.\n    \n    Each time a new inner observable sequence is received, unsubscribe from the\n    previous inner observable sequence.\n    \n    - returns: The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.\n    */\n    public func switchLatest() -> SharedSequence<Element.SharingStrategy, Element.Element> {\n        let source: Observable<Element.Element> = self\n            .asObservable()\n            .map { $0.asSharedSequence() }\n            .switchLatest()\n        return SharedSequence<Element.SharingStrategy, Element.Element>(source)\n    }\n}\n\n// MARK: flatMapLatest\nextension SharedSequenceConvertibleType {\n    /**\n     Projects each element of an observable sequence into a new sequence of observable sequences and then\n     transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.\n\n     It is a combination of `map` + `switchLatest` operator\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an\n     Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.\n     */\n    public func flatMapLatest<Sharing, Result>(_ selector: @escaping (Element) -> SharedSequence<Sharing, Result>)\n        -> SharedSequence<Sharing, Result> {\n        let source: Observable<Result> = self\n            .asObservable()\n            .flatMapLatest(selector)\n        return SharedSequence<Sharing, Result>(source)\n    }\n}\n\n// MARK: flatMapFirst\nextension SharedSequenceConvertibleType {\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n     If element is received while there is some projected observable sequence being merged it will simply be ignored.\n\n     - parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated.\n     */\n    public func flatMapFirst<Sharing, Result>(_ selector: @escaping (Element) -> SharedSequence<Sharing, Result>)\n        -> SharedSequence<Sharing, Result> {\n        let source: Observable<Result> = self\n            .asObservable()\n            .flatMapFirst(selector)\n        return SharedSequence<Sharing, Result>(source)\n    }\n}\n\n// MARK: do\nextension SharedSequenceConvertibleType {\n    /**\n     Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.\n\n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter afterNext: Action to invoke for each element after the observable has passed an onNext event along to its downstream.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter afterCompleted: Action to invoke after graceful termination of the observable sequence.\n     - parameter onSubscribe: Action to invoke before subscribing to source observable sequence.\n     - parameter onSubscribed: Action to invoke after subscribing to source observable sequence.\n     - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.\n     - returns: The source sequence with the side-effecting behavior applied.\n     */\n    public func `do`(onNext: ((Element) -> Void)? = nil, afterNext: ((Element) -> Void)? = nil, onCompleted: (() -> Void)? = nil, afterCompleted: (() -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil)\n        -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .do(onNext: onNext, afterNext: afterNext, onCompleted: onCompleted, afterCompleted: afterCompleted, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose)\n\n        return SharedSequence(source)\n    }\n}\n\n// MARK: debug\nextension SharedSequenceConvertibleType {\n    \n    /**\n    Prints received events for all observers on standard output.\n    \n    - parameter identifier: Identifier that is printed together with event description to standard output.\n    - returns: An observable sequence whose events are printed to standard output.\n    */\n    public func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function) -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .debug(identifier, trimOutput: trimOutput, file: file, line: line, function: function)\n        return SharedSequence(source)\n    }\n}\n\n// MARK: distinctUntilChanged\nextension SharedSequenceConvertibleType where Element: Equatable {\n    \n    /**\n    Returns an observable sequence that contains only distinct contiguous elements according to equality operator.\n    \n    - returns: An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence.\n    */\n    public func distinctUntilChanged()\n        -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .distinctUntilChanged({ $0 }, comparer: { ($0 == $1) })\n            \n        return SharedSequence(source)\n    }\n}\n\nextension SharedSequenceConvertibleType {\n    \n    /**\n    Returns an observable sequence that contains only distinct contiguous elements according to the `keySelector`.\n    \n    - parameter keySelector: A function to compute the comparison key for each element.\n    - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.\n    */\n    public func distinctUntilChanged<Key: Equatable>(_ keySelector: @escaping (Element) -> Key) -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .distinctUntilChanged(keySelector, comparer: { $0 == $1 })\n        return SharedSequence(source)\n    }\n   \n    /**\n    Returns an observable sequence that contains only distinct contiguous elements according to the `comparer`.\n    \n    - parameter comparer: Equality comparer for computed key values.\n    - returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence.\n    */\n    public func distinctUntilChanged(_ comparer: @escaping (Element, Element) -> Bool) -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .distinctUntilChanged({ $0 }, comparer: comparer)\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n    \n    /**\n    Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.\n    \n    - parameter keySelector: A function to compute the comparison key for each element.\n    - parameter comparer: Equality comparer for computed key values.\n    - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.\n    */\n    public func distinctUntilChanged<K>(_ keySelector: @escaping (Element) -> K, comparer: @escaping (K, K) -> Bool) -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .distinctUntilChanged(keySelector, comparer: comparer)\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\n\n// MARK: flatMap\nextension SharedSequenceConvertibleType {\n    \n    /**\n    Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n    \n    - parameter selector: A transform function to apply to each element.\n    - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.\n    */\n    public func flatMap<Sharing, Result>(_ selector: @escaping (Element) -> SharedSequence<Sharing, Result>) -> SharedSequence<Sharing, Result> {\n        let source = self.asObservable()\n            .flatMap(selector)\n        \n        return SharedSequence(source)\n    }\n}\n\n// MARK: merge\nextension SharedSequenceConvertibleType {\n    /**\n     Merges elements from all observable sequences from collection into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Collection of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func merge<Collection: Swift.Collection>(_ sources: Collection) -> SharedSequence<SharingStrategy, Element>\n        where Collection.Element == SharedSequence<SharingStrategy, Element> {\n        let source = Observable.merge(sources.map { $0.asObservable() })\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n\n    /**\n     Merges elements from all observable sequences from array into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Array of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func merge(_ sources: [SharedSequence<SharingStrategy, Element>]) -> SharedSequence<SharingStrategy, Element> {\n        let source = Observable.merge(sources.map { $0.asObservable() })\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n\n    /**\n     Merges elements from all observable sequences into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Collection of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func merge(_ sources: SharedSequence<SharingStrategy, Element>...) -> SharedSequence<SharingStrategy, Element> {\n        let source = Observable.merge(sources.map { $0.asObservable() })\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n    \n}\n\n// MARK: merge\nextension SharedSequenceConvertibleType where Element: SharedSequenceConvertibleType {\n    /**\n    Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.\n    \n    - returns: The observable sequence that merges the elements of the observable sequences.\n    */\n    public func merge() -> SharedSequence<Element.SharingStrategy, Element.Element> {\n        let source = self.asObservable()\n            .map { $0.asSharedSequence() }\n            .merge()\n        return SharedSequence<Element.SharingStrategy, Element.Element>(source)\n    }\n    \n    /**\n    Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.\n    \n    - parameter maxConcurrent: Maximum number of inner observable sequences being subscribed to concurrently.\n    - returns: The observable sequence that merges the elements of the inner sequences.\n    */\n    public func merge(maxConcurrent: Int)\n        -> SharedSequence<Element.SharingStrategy, Element.Element> {\n        let source = self.asObservable()\n            .map { $0.asSharedSequence() }\n            .merge(maxConcurrent: maxConcurrent)\n        return SharedSequence<Element.SharingStrategy, Element.Element>(source)\n    }\n}\n\n// MARK: throttle\nextension SharedSequenceConvertibleType {\n    \n    /**\n     Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration.\n\n     This operator makes sure that no two elements are emitted in less then dueTime.\n\n     - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html)\n\n     - parameter dueTime: Throttling duration for each element.\n     - parameter latest: Should latest element received in a dueTime wide time window since last element emission be emitted.\n     - returns: The throttled sequence.\n    */\n    public func throttle(_ dueTime: RxTimeInterval, latest: Bool = true)\n        -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .throttle(dueTime, latest: latest, scheduler: SharingStrategy.scheduler)\n\n        return SharedSequence(source)\n    }\n\n    /**\n    Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers.\n    \n    - parameter dueTime: Throttling duration for each element.\n    - returns: The throttled sequence.\n    */\n    public func debounce(_ dueTime: RxTimeInterval)\n        -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .debounce(dueTime, scheduler: SharingStrategy.scheduler)\n\n        return SharedSequence(source)\n    }\n}\n\n// MARK: scan\nextension SharedSequenceConvertibleType {\n    /**\n    Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.\n    \n    For aggregation behavior with no intermediate results, see `reduce`.\n    \n    - parameter seed: The initial accumulator value.\n    - parameter accumulator: An accumulator function to be invoked on each element.\n    - returns: An observable sequence containing the accumulated values.\n    */\n    public func scan<A>(_ seed: A, accumulator: @escaping (A, Element) -> A)\n        -> SharedSequence<SharingStrategy, A> {\n        let source = self.asObservable()\n            .scan(seed, accumulator: accumulator)\n        return SharedSequence<SharingStrategy, A>(source)\n    }\n}\n\n// MARK: concat\n\nextension SharedSequence {\n    /**\n     Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> SharedSequence<SharingStrategy, Element>\n        where Sequence.Element == SharedSequence<SharingStrategy, Element> {\n            let source = Observable.concat(sequence.lazy.map { $0.asObservable() })\n            return SharedSequence<SharingStrategy, Element>(source)\n    }\n\n    /**\n     Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Collection: Swift.Collection>(_ collection: Collection) -> SharedSequence<SharingStrategy, Element>\n        where Collection.Element == SharedSequence<SharingStrategy, Element> {\n        let source = Observable.concat(collection.map { $0.asObservable() })\n        return SharedSequence<SharingStrategy, Element>(source)\n    }\n}\n\n// MARK: zip\n\nextension SharedSequence {\n    /**\n     Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n     - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n     - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n     */\n    public static func zip<Collection: Swift.Collection, Result>(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> SharedSequence<SharingStrategy, Result>\n        where Collection.Element == SharedSequence<SharingStrategy, Element> {\n        let source = Observable.zip(collection.map { $0.asSharedSequence().asObservable() }, resultSelector: resultSelector)\n        return SharedSequence<SharingStrategy, Result>(source)\n    }\n\n    /**\n     Merges the specified observable sequences into one observable sequence all of the observable sequences have produced an element at a corresponding index.\n\n     - returns: An observable sequence containing the result of combining elements of the sources.\n     */\n    public static func zip<Collection: Swift.Collection>(_ collection: Collection) -> SharedSequence<SharingStrategy, [Element]>\n        where Collection.Element == SharedSequence<SharingStrategy, Element> {\n            let source = Observable.zip(collection.map { $0.asSharedSequence().asObservable() })\n            return SharedSequence<SharingStrategy, [Element]>(source)\n    }\n}\n\n// MARK: combineLatest\n\nextension SharedSequence {\n    /**\n     Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n     - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n     - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n     */\n    public static func combineLatest<Collection: Swift.Collection, Result>(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> SharedSequence<SharingStrategy, Result>\n        where Collection.Element == SharedSequence<SharingStrategy, Element> {\n        let source = Observable.combineLatest(collection.map { $0.asObservable() }, resultSelector: resultSelector)\n        return SharedSequence<SharingStrategy, Result>(source)\n    }\n\n    /**\n     Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.\n\n     - returns: An observable sequence containing the result of combining elements of the sources.\n     */\n    public static func combineLatest<Collection: Swift.Collection>(_ collection: Collection) -> SharedSequence<SharingStrategy, [Element]>\n        where Collection.Element == SharedSequence<SharingStrategy, Element> {\n        let source = Observable.combineLatest(collection.map { $0.asObservable() })\n        return SharedSequence<SharingStrategy, [Element]>(source)\n    }\n}\n\n// MARK: - withUnretained\nextension SharedSequenceConvertibleType where SharingStrategy == SignalSharingStrategy {\n    /**\n     Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.\n     \n     In the case the provided object cannot be retained successfully, the sequence will complete.\n     \n     - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.\n     \n     - parameter obj: The object to provide an unretained reference on.\n     - parameter resultSelector: A function to combine the unretained referenced on `obj` and the value of the observable sequence.\n     - returns: An observable sequence that contains the result of `resultSelector` being called with an unretained reference on `obj` and the values of the original sequence.\n     */\n    public func withUnretained<Object: AnyObject, Out>(\n        _ obj: Object,\n        resultSelector: @escaping (Object, Element) -> Out\n    ) -> SharedSequence<SharingStrategy, Out> {\n        SharedSequence(self.asObservable().withUnretained(obj, resultSelector: resultSelector))\n    }\n\n    /**\n     Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.\n     \n     In the case the provided object cannot be retained successfully, the sequence will complete.\n     \n     - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.\n     \n     - parameter obj: The object to provide an unretained reference on.\n     - returns: An observable sequence of tuples that contains both an unretained reference on `obj` and the values of the original sequence.\n     */\n    public func withUnretained<Object: AnyObject>(_ obj: Object) -> SharedSequence<SharingStrategy, (Object, Element)> {\n        withUnretained(obj) { ($0, $1) }\n    }\n}\n\nextension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy {\n    @available(*, message: \"withUnretained has been deprecated for Driver. Consider using `drive(with:onNext:onCompleted:onDisposed:)`, instead\", unavailable)\n    public func withUnretained<Object: AnyObject, Out>(\n        _ obj: Object,\n        resultSelector: @escaping (Object, Element) -> Out\n    ) -> SharedSequence<SharingStrategy, Out> {\n        SharedSequence(self.asObservable().withUnretained(obj, resultSelector: resultSelector))\n    }\n    \n    @available(*, message: \"withUnretained has been deprecated for Driver. Consider using `drive(with:onNext:onCompleted:onDisposed:)`, instead\", unavailable)\n    public func withUnretained<Object: AnyObject>(_ obj: Object) -> SharedSequence<SharingStrategy, (Object, Element)> {\n        SharedSequence(self.asObservable().withUnretained(obj) { ($0, $1) })\n    }\n}\n\n// MARK: withLatestFrom\nextension SharedSequenceConvertibleType {\n\n    /**\n    Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.\n\n    - parameter second: Second observable source.\n    - parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.\n    - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.\n    */\n    public func withLatestFrom<SecondO: SharedSequenceConvertibleType, ResultType>(_ second: SecondO, resultSelector: @escaping (Element, SecondO.Element) -> ResultType) -> SharedSequence<SharingStrategy, ResultType> where SecondO.SharingStrategy == SharingStrategy {\n        let source = self.asObservable()\n            .withLatestFrom(second.asSharedSequence(), resultSelector: resultSelector)\n\n        return SharedSequence<SharingStrategy, ResultType>(source)\n    }\n\n    /**\n    Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emits an element.\n\n    - parameter second: Second observable source.\n    - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.\n    */\n    public func withLatestFrom<SecondO: SharedSequenceConvertibleType>(_ second: SecondO) -> SharedSequence<SharingStrategy, SecondO.Element> {\n        let source = self.asObservable()\n            .withLatestFrom(second.asSharedSequence())\n\n        return SharedSequence<SharingStrategy, SecondO.Element>(source)\n    }\n}\n\n// MARK: skip\nextension SharedSequenceConvertibleType {\n\n    /**\n     Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.\n\n     - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html)\n\n     - parameter count: The number of elements to skip before returning the remaining elements.\n     - returns: An observable sequence that contains the elements that occur after the specified index in the input sequence.\n     */\n    public func skip(_ count: Int)\n        -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .skip(count)\n        return SharedSequence(source)\n    }\n}\n\n// MARK: startWith\nextension SharedSequenceConvertibleType {\n    \n    /**\n    Prepends a value to an observable sequence.\n\n    - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html)\n    \n    - parameter element: Element to prepend to the specified sequence.\n    - returns: The source sequence prepended with the specified values.\n    */\n    public func startWith(_ element: Element)\n        -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n                .startWith(element)\n\n        return SharedSequence(source)\n    }\n}\n\n// MARK: delay\nextension SharedSequenceConvertibleType {\n\n    /**\n     Returns an observable sequence by the source observable sequence shifted forward in time by a specified delay. Error events from the source observable sequence are not delayed.\n\n     - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html)\n\n     - parameter dueTime: Relative time shift of the source by.\n     - returns: the source Observable shifted in time by the specified delay.\n     */\n    public func delay(_ dueTime: RxTimeInterval)\n        -> SharedSequence<SharingStrategy, Element> {\n        let source = self.asObservable()\n            .delay(dueTime, scheduler: SharingStrategy.scheduler)\n\n        return SharedSequence(source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/SharedSequence/SharedSequence.swift",
    "content": "//\n//  SharedSequence.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 8/27/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/**\n    Trait that represents observable sequence that shares computation resources with following properties:\n\n    - it never fails\n    - it delivers events on `SharingStrategy.scheduler`\n    - sharing strategy is customizable using `SharingStrategy.share` behavior\n\n    `SharedSequence<Element>` can be considered a builder pattern for observable sequences that share computation resources.\n\n    To find out more about units and how to use them, please visit `Documentation/Traits.md`.\n*/\npublic struct SharedSequence<SharingStrategy: SharingStrategyProtocol, Element> : SharedSequenceConvertibleType, ObservableConvertibleType {\n    let source: Observable<Element>\n\n    init(_ source: Observable<Element>) {\n        self.source = SharingStrategy.share(source)\n    }\n\n    init(raw: Observable<Element>) {\n        self.source = raw\n    }\n\n    #if EXPANDABLE_SHARED_SEQUENCE\n    /**\n     This method is extension hook in case this unit needs to extended from outside the library.\n     \n     By defining `EXPANDABLE_SHARED_SEQUENCE` one agrees that it's up to them to ensure shared sequence\n     properties are preserved after extension.\n    */\n    public static func createUnsafe<Source: ObservableType>(source: Source) -> SharedSequence<SharingStrategy, Source.Element> {\n        SharedSequence<SharingStrategy, Source.Element>(raw: source.asObservable())\n    }\n    #endif\n\n    /**\n    - returns: Built observable sequence.\n    */\n    public func asObservable() -> Observable<Element> {\n        self.source\n    }\n\n    /**\n    - returns: `self`\n    */\n    public func asSharedSequence() -> SharedSequence<SharingStrategy, Element> {\n        self\n    }\n}\n\n/**\n Different `SharedSequence` sharing strategies must conform to this protocol.\n */\npublic protocol SharingStrategyProtocol {\n    /**\n     Scheduled on which all sequence events will be delivered.\n    */\n    static var scheduler: SchedulerType { get }\n\n    /**\n     Computation resources sharing strategy for multiple sequence observers.\n     \n     E.g. One can choose `share(replay:scope:)`\n     as sequence event sharing strategies, but also do something more exotic, like\n     implementing promises or lazy loading chains.\n    */\n    static func share<Element>(_ source: Observable<Element>) -> Observable<Element>\n}\n\n/**\nA type that can be converted to `SharedSequence`.\n*/\npublic protocol SharedSequenceConvertibleType : ObservableConvertibleType {\n    associatedtype SharingStrategy: SharingStrategyProtocol\n\n    /**\n    Converts self to `SharedSequence`.\n    */\n    func asSharedSequence() -> SharedSequence<SharingStrategy, Element>\n}\n\nextension SharedSequenceConvertibleType {\n    public func asObservable() -> Observable<Element> {\n        self.asSharedSequence().asObservable()\n    }\n}\n\n\nextension SharedSequence {\n\n    /**\n    Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message.\n\n    - returns: An observable sequence with no elements.\n    */\n    public static func empty() -> SharedSequence<SharingStrategy, Element> {\n        SharedSequence(raw: Observable.empty().subscribe(on: SharingStrategy.scheduler))\n    }\n\n    /**\n    Returns a non-terminating observable sequence, which can be used to denote an infinite duration.\n\n    - returns: An observable sequence whose observers will never get called.\n    */\n    public static func never() -> SharedSequence<SharingStrategy, Element> {\n        SharedSequence(raw: Observable.never())\n    }\n\n    /**\n    Returns an observable sequence that contains a single element.\n\n    - parameter element: Single element in the resulting observable sequence.\n    - returns: An observable sequence containing the single specified element.\n    */\n    public static func just(_ element: Element) -> SharedSequence<SharingStrategy, Element> {\n        SharedSequence(raw: Observable.just(element).subscribe(on: SharingStrategy.scheduler))\n    }\n\n    /**\n     Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.\n\n     - parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence.\n     - returns: An observable sequence whose observers trigger an invocation of the given observable factory function.\n     */\n    public static func deferred(_ observableFactory: @escaping () -> SharedSequence<SharingStrategy, Element>)\n        -> SharedSequence<SharingStrategy, Element> {\n        SharedSequence(Observable.deferred { observableFactory().asObservable() })\n    }\n\n    /**\n    This method creates a new Observable instance with a variable number of elements.\n\n    - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n    - parameter elements: Elements to generate.\n    - returns: The observable sequence whose elements are pulled from the given arguments.\n    */\n    public static func of(_ elements: Element ...) -> SharedSequence<SharingStrategy, Element> {\n        let source = Observable.from(elements, scheduler: SharingStrategy.scheduler)\n        return SharedSequence(raw: source)\n    }\n}\n\nextension SharedSequence {\n    \n    /**\n    This method converts an array to an observable sequence.\n     \n    - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n     \n    - returns: The observable sequence whose elements are pulled from the given enumerable sequence.\n     */\n    public static func from(_ array: [Element]) -> SharedSequence<SharingStrategy, Element> {\n        let source = Observable.from(array, scheduler: SharingStrategy.scheduler)\n        return SharedSequence(raw: source)\n    }\n    \n    /**\n     This method converts a sequence to an observable sequence.\n     \n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n     \n     - returns: The observable sequence whose elements are pulled from the given enumerable sequence.\n    */\n    public static func from<Sequence: Swift.Sequence>(_ sequence: Sequence) -> SharedSequence<SharingStrategy, Element> where Sequence.Element == Element {\n        let source = Observable.from(sequence, scheduler: SharingStrategy.scheduler)\n        return SharedSequence(raw: source)\n    }\n    \n    /**\n     This method converts a optional to an observable sequence.\n     \n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n     \n     - parameter optional: Optional element in the resulting observable sequence.\n     \n     - returns: An observable sequence containing the wrapped value or not from given optional.\n     */\n    public static func from(optional: Element?) -> SharedSequence<SharingStrategy, Element> {\n        let source = Observable.from(optional: optional, scheduler: SharingStrategy.scheduler)\n        return SharedSequence(raw: source)\n    }\n}\n\nextension SharedSequence where Element: RxAbstractInteger {\n    /**\n     Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.\n\n     - seealso: [interval operator on reactivex.io](http://reactivex.io/documentation/operators/interval.html)\n\n     - parameter period: Period for producing the values in the resulting sequence.\n     - returns: An observable sequence that produces a value after each period.\n     */\n    public static func interval(_ period: RxTimeInterval)\n        -> SharedSequence<SharingStrategy, Element> {\n        SharedSequence(Observable.interval(period, scheduler: SharingStrategy.scheduler))\n    }\n}\n\n// MARK: timer\n\nextension SharedSequence where Element: RxAbstractInteger {\n    /**\n     Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.\n\n     - seealso: [timer operator on reactivex.io](http://reactivex.io/documentation/operators/timer.html)\n\n     - parameter dueTime: Relative time at which to produce the first value.\n     - parameter period: Period to produce subsequent values.\n     - returns: An observable sequence that produces a value after due time has elapsed and then each period.\n     */\n    public static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval)\n        -> SharedSequence<SharingStrategy, Element> {\n        SharedSequence(Observable.timer(dueTime, period: period, scheduler: SharingStrategy.scheduler))\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Signal/ControlEvent+Signal.swift",
    "content": "//\n//  ControlEvent+Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 11/1/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension ControlEvent {\n    /// Converts `ControlEvent` to `Signal` trait.\n    ///\n    /// `ControlEvent` already can't fail, so no special case needs to be handled.\n    public func asSignal() -> Signal<Element> {\n        return self.asSignal { _ -> Signal<Element> in\n            #if DEBUG\n                rxFatalError(\"Somehow signal received error from a source that shouldn't fail.\")\n            #else\n                return Signal.empty()\n            #endif\n        }\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift",
    "content": "//\n//  ObservableConvertibleType+Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension ObservableConvertibleType {\n    /**\n     Converts observable sequence to `Signal` trait.\n\n     - parameter onErrorJustReturn: Element to return in case of error and after that complete the sequence.\n     - returns: Signal trait.\n     */\n    public func asSignal(onErrorJustReturn: Element) -> Signal<Element> {\n        let source = self\n            .asObservable()\n            .observe(on: SignalSharingStrategy.scheduler)\n            .catchAndReturn(onErrorJustReturn)\n        return Signal(source)\n    }\n\n    /**\n     Converts observable sequence to `Signal` trait.\n\n     - parameter onErrorSignalWith: Signal that continues to emit the sequence in case of error.\n     - returns: Signal trait.\n     */\n    public func asSignal(onErrorSignalWith: Signal<Element>) -> Signal<Element> {\n        let source = self\n            .asObservable()\n            .observe(on: SignalSharingStrategy.scheduler)\n            .catch { _ in\n                onErrorSignalWith.asObservable()\n            }\n        return Signal(source)\n    }\n\n    /**\n     Converts observable sequence to `Signal` trait.\n\n     - parameter onErrorRecover: Calculates signal that continues to emit the sequence in case of error.\n     - returns: Signal trait.\n     */\n    public func asSignal(onErrorRecover: @escaping (_ error: Swift.Error) -> Signal<Element>) -> Signal<Element> {\n        let source = self\n            .asObservable()\n            .observe(on: SignalSharingStrategy.scheduler)\n            .catch { error in\n                onErrorRecover(error).asObservable()\n            }\n        return Signal(source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Signal/PublishRelay+Signal.swift",
    "content": "//\n//  PublishRelay+Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 12/28/15.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\nimport RxRelay\n\nextension PublishRelay {\n    /// Converts `PublishRelay` to `Signal`.\n    ///\n    /// - returns: Observable sequence.\n    public func asSignal() -> Signal<Element> {\n        let source = self.asObservable()\n            .observe(on:SignalSharingStrategy.scheduler)\n        return SharedSequence(source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal+Subscription.swift",
    "content": "//\n//  Signal+Subscription.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\nimport RxRelay\n\nextension SharedSequenceConvertibleType where SharingStrategy == SignalSharingStrategy {\n    /**\n     Creates new subscription and sends elements to observer.\n\n     In this form it's equivalent to `subscribe` method, but it communicates intent better.\n\n     - parameter observers: Observers that receives events.\n     - returns: Disposable object that can be used to unsubscribe the observer from the subject.\n     */\n    public func emit<Observer: ObserverType>(to observers: Observer...) -> Disposable where Observer.Element == Element {\n        return self.asSharedSequence()\n                   .asObservable()\n                   .subscribe { event in\n                    observers.forEach { $0.on(event) }\n                   }\n    }\n\n    /**\n     Creates new subscription and sends elements to observer.\n\n     In this form it's equivalent to `subscribe` method, but it communicates intent better.\n\n     - parameter observers: Observers that receives events.\n     - returns: Disposable object that can be used to unsubscribe the observer from the subject.\n     */\n    public func emit<Observer: ObserverType>(to observers: Observer...) -> Disposable where Observer.Element == Element? {\n        return self.asSharedSequence()\n                   .asObservable()\n                   .map { $0 as Element? }\n                   .subscribe { event in\n                       observers.forEach { $0.on(event) }\n                   }\n    }\n\n    /**\n     Creates new subscription and sends elements to `BehaviorRelay`.\n     - parameter relays: Target relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func emit(to relays: BehaviorRelay<Element>...) -> Disposable {\n        return self.emit(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n    \n    /**\n     Creates new subscription and sends elements to `BehaviorRelay`.\n     - parameter relays: Target relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func emit(to relays: BehaviorRelay<Element?>...) -> Disposable {\n        return self.emit(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n    \n    /**\n     Creates new subscription and sends elements to `PublishRelay`.\n\n     - parameter relays: Target relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func emit(to relays: PublishRelay<Element>...) -> Disposable {\n        return self.emit(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `PublishRelay`.\n\n     - parameter relays: Target relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func emit(to relays: PublishRelay<Element?>...) -> Disposable {\n        return self.emit(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `ReplayRelay`.\n\n     - parameter relays: Target relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func emit(to relays: ReplayRelay<Element>...) -> Disposable {\n        return self.emit(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n\n    /**\n     Creates new subscription and sends elements to `ReplayRelay`.\n\n     - parameter relays: Target relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer from the relay.\n     */\n    public func emit(to relays: ReplayRelay<Element?>...) -> Disposable {\n        return self.emit(onNext: { e in\n            relays.forEach { $0.accept(e) }\n        })\n    }\n    \n    /**\n     Subscribes an element handler, a completion handler and disposed handler to an observable sequence.\n\n     Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.\n\n     Error callback is not exposed because `Signal` can't error out.\n\n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n     - parameter object: The object to provide an unretained reference on.\n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func emit<Object: AnyObject>(\n        with object: Object,\n        onNext: ((Object, Element) -> Void)? = nil,\n        onCompleted: ((Object) -> Void)? = nil,\n        onDisposed: ((Object) -> Void)? = nil\n    ) -> Disposable {\n        self.asObservable().subscribe(\n            with: object,\n            onNext: onNext,\n            onCompleted: onCompleted,\n            onDisposed: onDisposed\n        )\n    }\n\n    /**\n     Subscribes an element handler, a completion handler and disposed handler to an observable sequence.\n\n     Error callback is not exposed because `Signal` can't error out.\n     \n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func emit(\n        onNext: ((Element) -> Void)? = nil,\n        onCompleted: (() -> Void)? = nil,\n        onDisposed: (() -> Void)? = nil\n    ) -> Disposable {\n        self.asObservable().subscribe(onNext: onNext, onCompleted: onCompleted, onDisposed: onDisposed)\n    }\n\n    /**\n    Subscribes to this `Signal` with a no-op.\n    This method can be only called from `MainThread`.\n\n    - note: This is an alias of `emit(onNext: nil, onCompleted: nil, onDisposed: nil)` used to fix an ambiguity bug in Swift: https://bugs.swift.org/browse/SR-13657\n\n    - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func emit() -> Disposable {\n        emit(onNext: nil, onCompleted: nil, onDisposed: nil)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/Traits/Signal/Signal.swift",
    "content": "//\n//  Signal.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 9/26/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/**\n Trait that represents observable sequence with following properties:\n \n - it never fails\n - it delivers events on `MainScheduler.instance`\n - `share(scope: .whileConnected)` sharing strategy\n\n Additional explanation:\n - all observers share sequence computation resources\n - there is no replaying of sequence elements on new observer subscription\n - computation of elements is reference counted with respect to the number of observers\n - if there are no subscribers, it will release sequence computation resources\n\n In case trait that models state propagation is required, please check `Driver`.\n\n `Signal<Element>` can be considered a builder pattern for observable sequences that model imperative events part of the application.\n \n To find out more about units and how to use them, please visit `Documentation/Traits.md`.\n */\npublic typealias Signal<Element> = SharedSequence<SignalSharingStrategy, Element>\n\npublic struct SignalSharingStrategy: SharingStrategyProtocol {\n    public static var scheduler: SchedulerType { SharingScheduler.make() }\n    \n    public static func share<Element>(_ source: Observable<Element>) -> Observable<Element> {\n        source.share(scope: .whileConnected)\n    }\n}\n\nextension SharedSequenceConvertibleType where SharingStrategy == SignalSharingStrategy {\n    /// Adds `asPublisher` to `SharingSequence` with `PublishSharingStrategy`.\n    public func asSignal() -> Signal<Element> {\n        self.asSharedSequence()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift",
    "content": "//\n//  RxCollectionViewReactiveArrayDataSource.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n// objc monkey business\nclass _RxCollectionViewReactiveArrayDataSource\n    : NSObject\n    , UICollectionViewDataSource {\n    \n    @objc(numberOfSectionsInCollectionView:)\n    func numberOfSections(in: UICollectionView) -> Int {\n        1\n    }\n\n    func _collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        0\n    }\n    \n    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        _collectionView(collectionView, numberOfItemsInSection: section)\n    }\n\n    fileprivate func _collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        rxAbstractMethod()\n    }\n\n    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        _collectionView(collectionView, cellForItemAt: indexPath)\n    }\n}\n\nclass RxCollectionViewReactiveArrayDataSourceSequenceWrapper<Sequence: Swift.Sequence>\n    : RxCollectionViewReactiveArrayDataSource<Sequence.Element>\n    , RxCollectionViewDataSourceType {\n    typealias Element = Sequence\n\n    override init(cellFactory: @escaping CellFactory) {\n        super.init(cellFactory: cellFactory)\n    }\n    \n    func collectionView(_ collectionView: UICollectionView, observedEvent: Event<Sequence>) {\n        Binder(self) { collectionViewDataSource, sectionModels in\n            let sections = Array(sectionModels)\n            collectionViewDataSource.collectionView(collectionView, observedElements: sections)\n        }.on(observedEvent)\n    }\n}\n\n\n// Please take a look at `DelegateProxyType.swift`\nclass RxCollectionViewReactiveArrayDataSource<Element>\n    : _RxCollectionViewReactiveArrayDataSource\n    , SectionedViewDataSourceType {\n    \n    typealias CellFactory = (UICollectionView, Int, Element) -> UICollectionViewCell\n    \n    var itemModels: [Element]?\n    \n    func modelAtIndex(_ index: Int) -> Element? {\n        itemModels?[index]\n    }\n\n    func model(at indexPath: IndexPath) throws -> Any {\n        precondition(indexPath.section == 0)\n        guard let item = itemModels?[indexPath.item] else {\n            throw RxCocoaError.itemsNotYetBound(object: self)\n        }\n        return item\n    }\n    \n    var cellFactory: CellFactory\n    \n    init(cellFactory: @escaping CellFactory) {\n        self.cellFactory = cellFactory\n    }\n    \n    // data source\n    \n    override func _collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        itemModels?.count ?? 0\n    }\n    \n    override func _collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        cellFactory(collectionView, indexPath.item, itemModels![indexPath.item])\n    }\n    \n    // reactive\n    \n    func collectionView(_ collectionView: UICollectionView, observedElements: [Element]) {\n        self.itemModels = observedElements\n        \n        collectionView.reloadData()\n\n        // workaround for http://stackoverflow.com/questions/39867325/ios-10-bug-uicollectionview-received-layout-attributes-for-a-cell-with-an-index\n        collectionView.collectionViewLayout.invalidateLayout()\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift",
    "content": "//\n//  RxPickerViewAdapter.swift\n//  RxCocoa\n//\n//  Created by Sergey Shulga on 12/07/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\n\nclass RxPickerViewArrayDataSource<T>: NSObject, UIPickerViewDataSource, SectionedViewDataSourceType {\n    fileprivate var items: [T] = []\n    \n    func model(at indexPath: IndexPath) throws -> Any {\n        guard items.indices ~= indexPath.row else {\n            throw RxCocoaError.itemsNotYetBound(object: self)\n        }\n        return items[indexPath.row]\n    }\n\n    func numberOfComponents(in pickerView: UIPickerView) -> Int {\n        1\n    }\n    \n    func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {\n        items.count\n    }\n}\n\nclass RxPickerViewSequenceDataSource<Sequence: Swift.Sequence>\n    : RxPickerViewArrayDataSource<Sequence.Element>\n    , RxPickerViewDataSourceType {\n    typealias Element = Sequence\n\n    func pickerView(_ pickerView: UIPickerView, observedEvent: Event<Sequence>) {\n        Binder(self) { dataSource, items in\n            dataSource.items = items\n            pickerView.reloadAllComponents()\n        }\n        .on(observedEvent.map(Array.init))\n    }\n}\n\nfinal class RxStringPickerViewAdapter<Sequence: Swift.Sequence>\n    : RxPickerViewSequenceDataSource<Sequence>\n    , UIPickerViewDelegate {\n    \n    typealias TitleForRow = (Int, Sequence.Element) -> String?\n    private let titleForRow: TitleForRow\n    \n    init(titleForRow: @escaping TitleForRow) {\n        self.titleForRow = titleForRow\n        super.init()\n    }\n    \n    func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {\n        titleForRow(row, items[row])\n    }\n}\n\nfinal class RxAttributedStringPickerViewAdapter<Sequence: Swift.Sequence>: RxPickerViewSequenceDataSource<Sequence>, UIPickerViewDelegate {\n    typealias AttributedTitleForRow = (Int, Sequence.Element) -> NSAttributedString?\n    private let attributedTitleForRow: AttributedTitleForRow\n    \n    init(attributedTitleForRow: @escaping AttributedTitleForRow) {\n        self.attributedTitleForRow = attributedTitleForRow\n        super.init()\n    }\n    \n    func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? {\n        attributedTitleForRow(row, items[row])\n    }\n}\n\nfinal class RxPickerViewAdapter<Sequence: Swift.Sequence>: RxPickerViewSequenceDataSource<Sequence>, UIPickerViewDelegate {\n    typealias ViewForRow = (Int, Sequence.Element, UIView?) -> UIView\n    private let viewForRow: ViewForRow\n    \n    init(viewForRow: @escaping ViewForRow) {\n        self.viewForRow = viewForRow\n        super.init()\n    }\n    \n    func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {\n        viewForRow(row, items[row], view)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift",
    "content": "//\n//  RxTableViewReactiveArrayDataSource.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/26/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n// objc monkey business\nclass _RxTableViewReactiveArrayDataSource\n    : NSObject\n    , UITableViewDataSource {\n    \n    func numberOfSections(in tableView: UITableView) -> Int {\n        1\n    }\n   \n    func _tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        0\n    }\n    \n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        _tableView(tableView, numberOfRowsInSection: section)\n    }\n\n    fileprivate func _tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        rxAbstractMethod()\n    }\n\n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        _tableView(tableView, cellForRowAt: indexPath)\n    }\n}\n\n\nclass RxTableViewReactiveArrayDataSourceSequenceWrapper<Sequence: Swift.Sequence>\n    : RxTableViewReactiveArrayDataSource<Sequence.Element>\n    , RxTableViewDataSourceType {\n    typealias Element = Sequence\n\n    override init(cellFactory: @escaping CellFactory) {\n        super.init(cellFactory: cellFactory)\n    }\n\n    func tableView(_ tableView: UITableView, observedEvent: Event<Sequence>) {\n        Binder(self) { tableViewDataSource, sectionModels in\n            let sections = Array(sectionModels)\n            tableViewDataSource.tableView(tableView, observedElements: sections)\n        }.on(observedEvent)\n    }\n}\n\n// Please take a look at `DelegateProxyType.swift`\nclass RxTableViewReactiveArrayDataSource<Element>\n    : _RxTableViewReactiveArrayDataSource\n    , SectionedViewDataSourceType {\n    typealias CellFactory = (UITableView, Int, Element) -> UITableViewCell\n    \n    var itemModels: [Element]?\n    \n    func modelAtIndex(_ index: Int) -> Element? {\n        itemModels?[index]\n    }\n\n    func model(at indexPath: IndexPath) throws -> Any {\n        precondition(indexPath.section == 0)\n        guard let item = itemModels?[indexPath.item] else {\n            throw RxCocoaError.itemsNotYetBound(object: self)\n        }\n        return item\n    }\n\n    let cellFactory: CellFactory\n    \n    init(cellFactory: @escaping CellFactory) {\n        self.cellFactory = cellFactory\n    }\n    \n    override func _tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        itemModels?.count ?? 0\n    }\n    \n    override func _tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        cellFactory(tableView, indexPath.item, itemModels![indexPath.row])\n    }\n    \n    // reactive\n    \n    func tableView(_ tableView: UITableView, observedElements: [Element]) {\n        self.itemModels = observedElements\n        \n        tableView.reloadData()\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Events/ItemEvents.swift",
    "content": "//\n//  ItemEvents.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/20/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\nimport UIKit\n\npublic typealias ItemMovedEvent = (sourceIndex: IndexPath, destinationIndex: IndexPath)\npublic typealias WillDisplayCellEvent = (cell: UITableViewCell, indexPath: IndexPath)\npublic typealias DidEndDisplayingCellEvent = (cell: UITableViewCell, indexPath: IndexPath)\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/NSTextStorage+Rx.swift",
    "content": "//\n//  NSTextStorage+Rx.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 12/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n    import RxSwift\n    import UIKit\n    \n    extension Reactive where Base: NSTextStorage {\n\n        /// Reactive wrapper for `delegate`.\n        ///\n        /// For more information take a look at `DelegateProxyType` protocol documentation.\n        public var delegate: DelegateProxy<NSTextStorage, NSTextStorageDelegate> {\n            return RxTextStorageDelegateProxy.proxy(for: base)\n        }\n\n        /// Reactive wrapper for `delegate` message.\n        public var didProcessEditingRangeChangeInLength: Observable<(editedMask: NSTextStorage.EditActions, editedRange: NSRange, delta: Int)> {\n            return delegate\n                .methodInvoked(#selector(NSTextStorageDelegate.textStorage(_:didProcessEditing:range:changeInLength:)))\n                .map { a in\n                    let editedMask = NSTextStorage.EditActions(rawValue: try castOrThrow(UInt.self, a[1]) )\n                    let editedRange = try castOrThrow(NSValue.self, a[2]).rangeValue\n                    let delta = try castOrThrow(Int.self, a[3])\n                    \n                    return (editedMask, editedRange, delta)\n                }\n        }\n    }\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift",
    "content": "//\n//  RxCollectionViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n/// Marks data source as `UICollectionView` reactive data source enabling it to be used with one of the `bindTo` methods.\npublic protocol RxCollectionViewDataSourceType /*: UICollectionViewDataSource*/ {\n    \n    /// Type of elements that can be bound to collection view.\n    associatedtype Element\n    \n    /// New observable sequence event observed.\n    ///\n    /// - parameter collectionView: Bound collection view.\n    /// - parameter observedEvent: Event\n    func collectionView(_ collectionView: UICollectionView, observedEvent: Event<Element>)\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift",
    "content": "//\n//  RxPickerViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Sergey Shulga on 05/07/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n    \nimport UIKit\nimport RxSwift\n\n/// Marks data source as `UIPickerView` reactive data source enabling it to be used with one of the `bindTo` methods.\npublic protocol RxPickerViewDataSourceType {\n    /// Type of elements that can be bound to picker view.\n    associatedtype Element\n    \n    /// New observable sequence event observed.\n    ///\n    /// - parameter pickerView: Bound picker view.\n    /// - parameter observedEvent: Event\n    func pickerView(_ pickerView: UIPickerView, observedEvent: Event<Element>)\n}\n    \n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift",
    "content": "//\n//  RxTableViewDataSourceType.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/26/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n/// Marks data source as `UITableView` reactive data source enabling it to be used with one of the `bindTo` methods.\npublic protocol RxTableViewDataSourceType /*: UITableViewDataSource*/ {\n    \n    /// Type of elements that can be bound to table view.\n    associatedtype Element\n    \n    /// New observable sequence event observed.\n    ///\n    /// - parameter tableView: Bound table view.\n    /// - parameter observedEvent: Event\n    func tableView(_ tableView: UITableView, observedEvent: Event<Element>)\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourcePrefetchingProxy.swift",
    "content": "//\n//  RxCollectionViewDataSourcePrefetchingProxy.swift\n//  RxCocoa\n//\n//  Created by Rowan Livingstone on 2/15/18.\n//  Copyright © 2018 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n@available(iOS 10.0, tvOS 10.0, *)\nextension UICollectionView: HasPrefetchDataSource {\n    public typealias PrefetchDataSource = UICollectionViewDataSourcePrefetching\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nprivate let collectionViewPrefetchDataSourceNotSet = CollectionViewPrefetchDataSourceNotSet()\n\n@available(iOS 10.0, tvOS 10.0, *)\nprivate final class CollectionViewPrefetchDataSourceNotSet\n    : NSObject\n    , UICollectionViewDataSourcePrefetching {\n\n    func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) {}\n\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nopen class RxCollectionViewDataSourcePrefetchingProxy\n    : DelegateProxy<UICollectionView, UICollectionViewDataSourcePrefetching>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var collectionView: UICollectionView?\n\n    /// - parameter collectionView: Parent object for delegate proxy.\n    public init(collectionView: ParentObject) {\n        self.collectionView = collectionView\n        super.init(parentObject: collectionView, delegateProxy: RxCollectionViewDataSourcePrefetchingProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxCollectionViewDataSourcePrefetchingProxy(collectionView: $0) }\n    }\n\n    private var _prefetchItemsPublishSubject: PublishSubject<[IndexPath]>?\n\n    /// Optimized version used for observing prefetch items callbacks.\n    internal var prefetchItemsPublishSubject: PublishSubject<[IndexPath]> {\n        if let subject = _prefetchItemsPublishSubject {\n            return subject\n        }\n\n        let subject = PublishSubject<[IndexPath]>()\n        _prefetchItemsPublishSubject = subject\n\n        return subject\n    }\n\n    private weak var _requiredMethodsPrefetchDataSource: UICollectionViewDataSourcePrefetching? = collectionViewPrefetchDataSourceNotSet\n\n    /// For more information take a look at `DelegateProxyType`.\n    open override func setForwardToDelegate(_ forwardToDelegate: UICollectionViewDataSourcePrefetching?, retainDelegate: Bool) {\n        _requiredMethodsPrefetchDataSource = forwardToDelegate ?? collectionViewPrefetchDataSourceNotSet\n        super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate)\n    }\n\n    deinit {\n        if let subject = _prefetchItemsPublishSubject {\n            subject.on(.completed)\n        }\n    }\n\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nextension RxCollectionViewDataSourcePrefetchingProxy: UICollectionViewDataSourcePrefetching {\n    /// Required delegate method implementation.\n    public func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) {\n        if let subject = _prefetchItemsPublishSubject {\n            subject.on(.next(indexPaths))\n        }\n\n        (_requiredMethodsPrefetchDataSource ?? collectionViewPrefetchDataSourceNotSet).collectionView(collectionView, prefetchItemsAt: indexPaths)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift",
    "content": "//\n//  RxCollectionViewDataSourceProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nextension UICollectionView: HasDataSource {\n    public typealias DataSource = UICollectionViewDataSource\n}\n\nprivate let collectionViewDataSourceNotSet = CollectionViewDataSourceNotSet()\n\nprivate final class CollectionViewDataSourceNotSet\n    : NSObject\n    , UICollectionViewDataSource {\n\n    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        0\n    }\n    \n    // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:\n    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        rxAbstractMethod(message: dataSourceNotSet)\n    }\n    \n}\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxCollectionViewDataSourceProxy\n    : DelegateProxy<UICollectionView, UICollectionViewDataSource>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var collectionView: UICollectionView?\n\n    /// - parameter collectionView: Parent object for delegate proxy.\n    public init(collectionView: ParentObject) {\n        self.collectionView = collectionView\n        super.init(parentObject: collectionView, delegateProxy: RxCollectionViewDataSourceProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxCollectionViewDataSourceProxy(collectionView: $0) }\n    }\n\n    private weak var _requiredMethodsDataSource: UICollectionViewDataSource? = collectionViewDataSourceNotSet\n\n    /// For more information take a look at `DelegateProxyType`.\n    open override func setForwardToDelegate(_ forwardToDelegate: UICollectionViewDataSource?, retainDelegate: Bool) {\n        _requiredMethodsDataSource = forwardToDelegate ?? collectionViewDataSourceNotSet\n        super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate)\n    }\n}\n\nextension RxCollectionViewDataSourceProxy: UICollectionViewDataSource {\n    /// Required delegate method implementation.\n    public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {\n        (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, numberOfItemsInSection: section)\n    }\n\n    /// Required delegate method implementation.\n    public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {\n        (_requiredMethodsDataSource ?? collectionViewDataSourceNotSet).collectionView(collectionView, cellForItemAt: indexPath)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift",
    "content": "//\n//  RxCollectionViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxCollectionViewDelegateProxy\n    : RxScrollViewDelegateProxy {\n\n    /// Typed parent object.\n    public weak private(set) var collectionView: UICollectionView?\n\n    /// Initializes `RxCollectionViewDelegateProxy`\n    ///\n    /// - parameter collectionView: Parent object for delegate proxy.\n    public init(collectionView: UICollectionView) {\n        self.collectionView = collectionView\n        super.init(scrollView: collectionView)\n    }\n}\n\nextension RxCollectionViewDelegateProxy: UICollectionViewDelegateFlowLayout {}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift",
    "content": "//\n//  RxNavigationControllerDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Diogo on 13/04/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\n    import UIKit\n    import RxSwift\n\n    extension UINavigationController: HasDelegate {\n        public typealias Delegate = UINavigationControllerDelegate\n    }\n\n    /// For more information take a look at `DelegateProxyType`.\n    open class RxNavigationControllerDelegateProxy\n        : DelegateProxy<UINavigationController, UINavigationControllerDelegate>\n        , DelegateProxyType {\n\n        /// Typed parent object.\n        public weak private(set) var navigationController: UINavigationController?\n\n        /// - parameter navigationController: Parent object for delegate proxy.\n        public init(navigationController: ParentObject) {\n            self.navigationController = navigationController\n            super.init(parentObject: navigationController, delegateProxy: RxNavigationControllerDelegateProxy.self)\n        }\n\n        // Register known implementations\n        public static func registerKnownImplementations() {\n            self.register { RxNavigationControllerDelegateProxy(navigationController: $0) }\n        }\n    }\n\n    extension RxNavigationControllerDelegateProxy: UINavigationControllerDelegate {}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift",
    "content": "//\n//  RxPickerViewDataSourceProxy.swift\n//  RxCocoa\n//\n//  Created by Sergey Shulga on 05/07/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\n\nextension UIPickerView: HasDataSource {\n    public typealias DataSource = UIPickerViewDataSource\n}\n\nprivate let pickerViewDataSourceNotSet = PickerViewDataSourceNotSet()\n\nfinal private class PickerViewDataSourceNotSet: NSObject, UIPickerViewDataSource {\n    func numberOfComponents(in pickerView: UIPickerView) -> Int {\n        0\n    }\n    \n    func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {\n        0\n    }\n}\n\n/// For more information take a look at `DelegateProxyType`.\npublic class RxPickerViewDataSourceProxy\n    : DelegateProxy<UIPickerView, UIPickerViewDataSource>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var pickerView: UIPickerView?\n\n    /// - parameter pickerView: Parent object for delegate proxy.\n    public init(pickerView: ParentObject) {\n        self.pickerView = pickerView\n        super.init(parentObject: pickerView, delegateProxy: RxPickerViewDataSourceProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxPickerViewDataSourceProxy(pickerView: $0) }\n    }\n\n    private weak var _requiredMethodsDataSource: UIPickerViewDataSource? = pickerViewDataSourceNotSet\n\n    /// For more information take a look at `DelegateProxyType`.\n    public override func setForwardToDelegate(_ forwardToDelegate: UIPickerViewDataSource?, retainDelegate: Bool) {\n        _requiredMethodsDataSource = forwardToDelegate ?? pickerViewDataSourceNotSet\n        super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate)\n    }\n}\n\n// MARK: UIPickerViewDataSource\n\nextension RxPickerViewDataSourceProxy: UIPickerViewDataSource {\n    /// Required delegate method implementation.\n    public func numberOfComponents(in pickerView: UIPickerView) -> Int {\n        (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).numberOfComponents(in: pickerView)\n    }\n\n    /// Required delegate method implementation.\n    public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {\n        (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).pickerView(pickerView, numberOfRowsInComponent: component)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift",
    "content": "//\n//  RxPickerViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 5/12/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\n    import RxSwift\n    import UIKit\n\n    extension UIPickerView: HasDelegate {\n        public typealias Delegate = UIPickerViewDelegate\n    }\n\n    open class RxPickerViewDelegateProxy\n        : DelegateProxy<UIPickerView, UIPickerViewDelegate>\n        , DelegateProxyType {\n\n        /// Typed parent object.\n        public weak private(set) var pickerView: UIPickerView?\n\n        /// - parameter pickerView: Parent object for delegate proxy.\n        public init(pickerView: ParentObject) {\n            self.pickerView = pickerView\n            super.init(parentObject: pickerView, delegateProxy: RxPickerViewDelegateProxy.self)\n        }\n\n        // Register known implementations\n        public static func registerKnownImplementations() {\n            self.register { RxPickerViewDelegateProxy(pickerView: $0) }\n        }\n    }\n\n    extension RxPickerViewDelegateProxy: UIPickerViewDelegate {}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift",
    "content": "//\n//  RxScrollViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n    \nextension UIScrollView: HasDelegate {\n    public typealias Delegate = UIScrollViewDelegate\n}\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxScrollViewDelegateProxy\n    : DelegateProxy<UIScrollView, UIScrollViewDelegate>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var scrollView: UIScrollView?\n\n    /// - parameter scrollView: Parent object for delegate proxy.\n    public init(scrollView: ParentObject) {\n        self.scrollView = scrollView\n        super.init(parentObject: scrollView, delegateProxy: RxScrollViewDelegateProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxScrollViewDelegateProxy(scrollView: $0) }\n        self.register { RxTableViewDelegateProxy(tableView: $0) }\n        self.register { RxCollectionViewDelegateProxy(collectionView: $0) }\n        self.register { RxTextViewDelegateProxy(textView: $0) }\n    }\n\n    private var _contentOffsetBehaviorSubject: BehaviorSubject<CGPoint>?\n    private var _contentOffsetPublishSubject: PublishSubject<()>?\n\n    /// Optimized version used for observing content offset changes.\n    internal var contentOffsetBehaviorSubject: BehaviorSubject<CGPoint> {\n        if let subject = _contentOffsetBehaviorSubject {\n            return subject\n        }\n\n        let subject = BehaviorSubject<CGPoint>(value: self.scrollView?.contentOffset ?? CGPoint.zero)\n        _contentOffsetBehaviorSubject = subject\n\n        return subject\n    }\n\n    /// Optimized version used for observing content offset changes.\n    internal var contentOffsetPublishSubject: PublishSubject<()> {\n        if let subject = _contentOffsetPublishSubject {\n            return subject\n        }\n\n        let subject = PublishSubject<()>()\n        _contentOffsetPublishSubject = subject\n\n        return subject\n    }\n    \n    deinit {\n        if let subject = _contentOffsetBehaviorSubject {\n            subject.on(.completed)\n        }\n\n        if let subject = _contentOffsetPublishSubject {\n            subject.on(.completed)\n        }\n    }\n}\n\nextension RxScrollViewDelegateProxy: UIScrollViewDelegate {\n    /// For more information take a look at `DelegateProxyType`.\n    public func scrollViewDidScroll(_ scrollView: UIScrollView) {\n        if let subject = _contentOffsetBehaviorSubject {\n            subject.on(.next(scrollView.contentOffset))\n        }\n        if let subject = _contentOffsetPublishSubject {\n            subject.on(.next(()))\n        }\n        self._forwardToDelegate?.scrollViewDidScroll?(scrollView)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift",
    "content": "//\n//  RxSearchBarDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 7/4/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nextension UISearchBar: HasDelegate {\n    public typealias Delegate = UISearchBarDelegate\n}\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxSearchBarDelegateProxy\n    : DelegateProxy<UISearchBar, UISearchBarDelegate>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var searchBar: UISearchBar?\n\n    /// - parameter searchBar: Parent object for delegate proxy.\n    public init(searchBar: ParentObject) {\n        self.searchBar = searchBar\n        super.init(parentObject: searchBar, delegateProxy: RxSearchBarDelegateProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxSearchBarDelegateProxy(searchBar: $0) }\n    }\n}\n\nextension RxSearchBarDelegateProxy: UISearchBarDelegate {}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift",
    "content": "//\n//  RxSearchControllerDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 3/17/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport RxSwift\nimport UIKit\n\nextension UISearchController: HasDelegate {\n    public typealias Delegate = UISearchControllerDelegate\n}\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxSearchControllerDelegateProxy\n    : DelegateProxy<UISearchController, UISearchControllerDelegate>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var searchController: UISearchController?\n\n    /// - parameter searchController: Parent object for delegate proxy.\n    public init(searchController: UISearchController) {\n        self.searchController = searchController\n        super.init(parentObject: searchController, delegateProxy: RxSearchControllerDelegateProxy.self)\n    }\n    \n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxSearchControllerDelegateProxy(searchController: $0) }\n    }\n}\n\nextension RxSearchControllerDelegateProxy: UISearchControllerDelegate {}\n   \n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift",
    "content": "//\n//  RxTabBarControllerDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Yusuke Kita on 2016/12/07.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nextension UITabBarController: HasDelegate {\n    public typealias Delegate = UITabBarControllerDelegate\n}\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxTabBarControllerDelegateProxy\n    : DelegateProxy<UITabBarController, UITabBarControllerDelegate>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var tabBar: UITabBarController?\n\n    /// - parameter tabBar: Parent object for delegate proxy.\n    public init(tabBar: ParentObject) {\n        self.tabBar = tabBar\n        super.init(parentObject: tabBar, delegateProxy: RxTabBarControllerDelegateProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxTabBarControllerDelegateProxy(tabBar: $0) }\n    }\n}\n\nextension RxTabBarControllerDelegateProxy: UITabBarControllerDelegate {}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift",
    "content": "//\n//  RxTabBarDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Jesse Farless on 5/14/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nextension UITabBar: HasDelegate {\n    public typealias Delegate = UITabBarDelegate\n}\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxTabBarDelegateProxy\n    : DelegateProxy<UITabBar, UITabBarDelegate>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var tabBar: UITabBar?\n\n    /// - parameter tabBar: Parent object for delegate proxy.\n    public init(tabBar: ParentObject) {\n        self.tabBar = tabBar\n        super.init(parentObject: tabBar, delegateProxy: RxTabBarDelegateProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxTabBarDelegateProxy(tabBar: $0) }\n    }\n\n    /// For more information take a look at `DelegateProxyType`.\n    open class func currentDelegate(for object: ParentObject) -> UITabBarDelegate? {\n        object.delegate\n    }\n\n    /// For more information take a look at `DelegateProxyType`.\n    open class func setCurrentDelegate(_ delegate: UITabBarDelegate?, to object: ParentObject) {\n        object.delegate = delegate\n    }\n}\n\nextension RxTabBarDelegateProxy: UITabBarDelegate {}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourcePrefetchingProxy.swift",
    "content": "//\n//  RxTableViewDataSourcePrefetchingProxy.swift\n//  RxCocoa\n//\n//  Created by Rowan Livingstone on 2/15/18.\n//  Copyright © 2018 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n@available(iOS 10.0, tvOS 10.0, *)\nextension UITableView: HasPrefetchDataSource {\n    public typealias PrefetchDataSource = UITableViewDataSourcePrefetching\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nprivate let tableViewPrefetchDataSourceNotSet = TableViewPrefetchDataSourceNotSet()\n\n@available(iOS 10.0, tvOS 10.0, *)\nprivate final class TableViewPrefetchDataSourceNotSet\n    : NSObject\n    , UITableViewDataSourcePrefetching {\n\n    func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {}\n\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nopen class RxTableViewDataSourcePrefetchingProxy\n    : DelegateProxy<UITableView, UITableViewDataSourcePrefetching>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var tableView: UITableView?\n\n    /// - parameter tableView: Parent object for delegate proxy.\n    public init(tableView: ParentObject) {\n        self.tableView = tableView\n        super.init(parentObject: tableView, delegateProxy: RxTableViewDataSourcePrefetchingProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxTableViewDataSourcePrefetchingProxy(tableView: $0) }\n    }\n\n    private var _prefetchRowsPublishSubject: PublishSubject<[IndexPath]>?\n\n    /// Optimized version used for observing prefetch rows callbacks.\n    internal var prefetchRowsPublishSubject: PublishSubject<[IndexPath]> {\n        if let subject = _prefetchRowsPublishSubject {\n            return subject\n        }\n\n        let subject = PublishSubject<[IndexPath]>()\n        _prefetchRowsPublishSubject = subject\n\n        return subject\n    }\n\n    private weak var _requiredMethodsPrefetchDataSource: UITableViewDataSourcePrefetching? = tableViewPrefetchDataSourceNotSet\n\n    /// For more information take a look at `DelegateProxyType`.\n    open override func setForwardToDelegate(_ forwardToDelegate: UITableViewDataSourcePrefetching?, retainDelegate: Bool) {\n        _requiredMethodsPrefetchDataSource = forwardToDelegate ?? tableViewPrefetchDataSourceNotSet\n        super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate)\n    }\n\n    deinit {\n        if let subject = _prefetchRowsPublishSubject {\n            subject.on(.completed)\n        }\n    }\n\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nextension RxTableViewDataSourcePrefetchingProxy: UITableViewDataSourcePrefetching {\n    /// Required delegate method implementation.\n    public func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {\n        if let subject = _prefetchRowsPublishSubject {\n            subject.on(.next(indexPaths))\n        }\n\n        (_requiredMethodsPrefetchDataSource ?? tableViewPrefetchDataSourceNotSet).tableView(tableView, prefetchRowsAt: indexPaths)\n    }\n}\n\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift",
    "content": "//\n//  RxTableViewDataSourceProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n    \nextension UITableView: HasDataSource {\n    public typealias DataSource = UITableViewDataSource\n}\n\nprivate let tableViewDataSourceNotSet = TableViewDataSourceNotSet()\n\nprivate final class TableViewDataSourceNotSet\n    : NSObject\n    , UITableViewDataSource {\n\n    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        0\n    }\n    \n    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        rxAbstractMethod(message: dataSourceNotSet)\n    }\n}\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxTableViewDataSourceProxy\n    : DelegateProxy<UITableView, UITableViewDataSource>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var tableView: UITableView?\n\n    /// - parameter tableView: Parent object for delegate proxy.\n    public init(tableView: UITableView) {\n        self.tableView = tableView\n        super.init(parentObject: tableView, delegateProxy: RxTableViewDataSourceProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxTableViewDataSourceProxy(tableView: $0) }\n    }\n\n    private weak var _requiredMethodsDataSource: UITableViewDataSource? = tableViewDataSourceNotSet\n\n    /// For more information take a look at `DelegateProxyType`.\n    open override func setForwardToDelegate(_ forwardToDelegate: UITableViewDataSource?, retainDelegate: Bool) {\n        _requiredMethodsDataSource = forwardToDelegate  ?? tableViewDataSourceNotSet\n        super.setForwardToDelegate(forwardToDelegate, retainDelegate: retainDelegate)\n    }\n}\n\nextension RxTableViewDataSourceProxy: UITableViewDataSource {\n    /// Required delegate method implementation.\n    public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, numberOfRowsInSection: section)\n    }\n\n    /// Required delegate method implementation.\n    public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        (_requiredMethodsDataSource ?? tableViewDataSourceNotSet).tableView(tableView, cellForRowAt: indexPath)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift",
    "content": "//\n//  RxTableViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 6/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxTableViewDelegateProxy\n    : RxScrollViewDelegateProxy {\n\n    /// Typed parent object.\n    public weak private(set) var tableView: UITableView?\n\n    /// - parameter tableView: Parent object for delegate proxy.\n    public init(tableView: UITableView) {\n        self.tableView = tableView\n        super.init(scrollView: tableView)\n    }\n\n}\n\nextension RxTableViewDelegateProxy: UITableViewDelegate {}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift",
    "content": "//\n//  RxTextStorageDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 12/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\n    import RxSwift\n    import UIKit\n\n    extension NSTextStorage: HasDelegate {\n        public typealias Delegate = NSTextStorageDelegate\n    }\n\n    open class RxTextStorageDelegateProxy\n        : DelegateProxy<NSTextStorage, NSTextStorageDelegate>\n        , DelegateProxyType {\n\n        /// Typed parent object.\n        public weak private(set) var textStorage: NSTextStorage?\n\n        /// - parameter textStorage: Parent object for delegate proxy.\n        public init(textStorage: NSTextStorage) {\n            self.textStorage = textStorage\n            super.init(parentObject: textStorage, delegateProxy: RxTextStorageDelegateProxy.self)\n        }\n\n        // Register known implementations\n        public static func registerKnownImplementations() {\n            self.register { RxTextStorageDelegateProxy(textStorage: $0) }\n        }\n    }\n\n    extension RxTextStorageDelegateProxy: NSTextStorageDelegate {}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift",
    "content": "//\n//  RxTextViewDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Yuta ToKoRo on 7/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n/// For more information take a look at `DelegateProxyType`.\nopen class RxTextViewDelegateProxy\n    : RxScrollViewDelegateProxy {\n\n    /// Typed parent object.\n    public weak private(set) var textView: UITextView?\n\n    /// - parameter textview: Parent object for delegate proxy.\n    public init(textView: UITextView) {\n        self.textView = textView\n        super.init(scrollView: textView)\n    }\n}\n\nextension RxTextViewDelegateProxy: UITextViewDelegate {\n    /// For more information take a look at `DelegateProxyType`.\n    @objc open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {\n        /**\n         We've had some issues with observing text changes. This is here just in case we need the same hack in future and that\n         we wouldn't need to change the public interface.\n        */\n        let forwardToDelegate = self.forwardToDelegate() as? UITextViewDelegate\n        return forwardToDelegate?.textView?(textView,\n            shouldChangeTextIn: range,\n            replacementText: text) ?? true\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/Proxies/RxWKNavigationDelegateProxy.swift",
    "content": "//\n//  RxWKNavigationDelegateProxy.swift\n//  RxCocoa\n//\n//  Created by Giuseppe Lanza on 14/02/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(macOS)\n\nimport RxSwift\nimport WebKit\n\n@available(iOS 8.0, OSX 10.10, OSXApplicationExtension 10.10, *)\nopen class RxWKNavigationDelegateProxy\n    : DelegateProxy<WKWebView, WKNavigationDelegate>\n    , DelegateProxyType {\n\n    /// Typed parent object.\n    public weak private(set) var webView: WKWebView?\n\n    /// - parameter webView: Parent object for delegate proxy.\n    public init(webView: ParentObject) {\n        self.webView = webView\n        super.init(parentObject: webView, delegateProxy: RxWKNavigationDelegateProxy.self)\n    }\n\n    // Register known implementations\n    public static func registerKnownImplementations() {\n        self.register { RxWKNavigationDelegateProxy(webView: $0) }\n    }\n    \n    public static func currentDelegate(for object: WKWebView) -> WKNavigationDelegate? {\n        object.navigationDelegate\n    }\n    \n    public static func setCurrentDelegate(_ delegate: WKNavigationDelegate?, to object: WKWebView) {\n        object.navigationDelegate = delegate\n    }\n}\n\n@available(iOS 8.0, OSX 10.10, OSXApplicationExtension 10.10, *)\nextension RxWKNavigationDelegateProxy: WKNavigationDelegate {}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIActivityIndicatorView+Rx.swift",
    "content": "//\n//  UIActivityIndicatorView+Rx.swift\n//  RxCocoa\n//\n//  Created by Ivan Persidskiy on 02/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nextension Reactive where Base: UIActivityIndicatorView {\n    /// Bindable sink for `startAnimating()`, `stopAnimating()` methods.\n    public var isAnimating: Binder<Bool> {\n        Binder(self.base) { activityIndicator, active in\n            if active {\n                activityIndicator.startAnimating()\n            } else {\n                activityIndicator.stopAnimating()\n            }\n        }\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIApplication+Rx.swift",
    "content": "//\n//  UIApplication+Rx.swift\n//  RxCocoa\n//\n//  Created by Mads Bøgeskov on 18/01/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\n\nextension Reactive where Base: UIApplication {\n    /// Bindable sink for `isNetworkActivityIndicatorVisible`.\n    public var isNetworkActivityIndicatorVisible: Binder<Bool> {\n        return Binder(self.base) { application, active in\n            application.isNetworkActivityIndicatorVisible = active\n        }\n    }\n    \n    /// Reactive wrapper for `UIApplication.didEnterBackgroundNotification`\n    public static var didEnterBackground: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.didEnterBackgroundNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.willEnterForegroundNotification`\n    public static var willEnterForeground: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.willEnterForegroundNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.didFinishLaunchingNotification`\n    public static var didFinishLaunching: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.didFinishLaunchingNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.didBecomeActiveNotification`\n    public static var didBecomeActive: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.didBecomeActiveNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.willResignActiveNotification`\n    public static var willResignActive: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.willResignActiveNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.didReceiveMemoryWarningNotification`\n    public static var didReceiveMemoryWarning: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.didReceiveMemoryWarningNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.willTerminateNotification`\n    public static var willTerminate: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.willTerminateNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.significantTimeChangeNotification`\n    public static var significantTimeChange: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.significantTimeChangeNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.backgroundRefreshStatusDidChangeNotification`\n    public static var backgroundRefreshStatusDidChange: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.backgroundRefreshStatusDidChangeNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.protectedDataWillBecomeUnavailableNotification`\n    public static var protectedDataWillBecomeUnavailable: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.protectedDataWillBecomeUnavailableNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.protectedDataDidBecomeAvailableNotification`\n    public static var protectedDataDidBecomeAvailable: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.protectedDataDidBecomeAvailableNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `UIApplication.userDidTakeScreenshotNotification`\n    public static var userDidTakeScreenshot: ControlEvent<Void> {\n        let source = NotificationCenter.default.rx.notification(UIApplication.userDidTakeScreenshotNotification).map { _ in }\n        \n        return ControlEvent(events: source)\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIBarButtonItem+Rx.swift",
    "content": "//\n//  UIBarButtonItem+Rx.swift\n//  RxCocoa\n//\n//  Created by Daniel Tartaglia on 5/31/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nprivate var rx_tap_key: UInt8 = 0\n\nextension Reactive where Base: UIBarButtonItem {\n    /// Reactive wrapper for target action pattern on `self`.\n    public var tap: ControlEvent<()> {\n        let source = lazyInstanceObservable(&rx_tap_key) { () -> Observable<()> in\n            Observable.create { [weak control = self.base] observer in\n                guard let control = control else {\n                    observer.on(.completed)\n                    return Disposables.create()\n                }\n                let target = BarButtonItemTarget(barButtonItem: control) {\n                    observer.on(.next(()))\n                }\n                return target\n            }\n            .take(until: self.deallocated)\n            .share()\n        }\n        \n        return ControlEvent(events: source)\n    }\n}\n\n\n@objc\nfinal class BarButtonItemTarget: RxTarget {\n    typealias Callback = () -> Void\n    \n    weak var barButtonItem: UIBarButtonItem?\n    var callback: Callback!\n    \n    init(barButtonItem: UIBarButtonItem, callback: @escaping () -> Void) {\n        self.barButtonItem = barButtonItem\n        self.callback = callback\n        super.init()\n        barButtonItem.target = self\n        barButtonItem.action = #selector(BarButtonItemTarget.action(_:))\n    }\n    \n    override func dispose() {\n        super.dispose()\n#if DEBUG\n        MainScheduler.ensureRunningOnMainThread()\n#endif\n        \n        barButtonItem?.target = nil\n        barButtonItem?.action = nil\n        \n        callback = nil\n    }\n    \n    @objc func action(_ sender: AnyObject) {\n        callback()\n    }\n    \n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIButton+Rx.swift",
    "content": "//\n//  UIButton+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 3/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UIButton {\n    \n    /// Reactive wrapper for `TouchUpInside` control event.\n    public var tap: ControlEvent<Void> {\n        controlEvent(.touchUpInside)\n    }\n}\n\n#endif\n\n#if os(tvOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UIButton {\n\n    /// Reactive wrapper for `PrimaryActionTriggered` control event.\n    public var primaryAction: ControlEvent<Void> {\n        controlEvent(.primaryActionTriggered)\n    }\n\n}\n\n#endif\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UIButton {\n    /// Reactive wrapper for `setTitle(_:for:)`\n    public func title(for controlState: UIControl.State = []) -> Binder<String?> {\n        Binder(self.base) { button, title in\n            button.setTitle(title, for: controlState)\n        }\n    }\n\n    /// Reactive wrapper for `setImage(_:for:)`\n    public func image(for controlState: UIControl.State = []) -> Binder<UIImage?> {\n        Binder(self.base) { button, image in\n            button.setImage(image, for: controlState)\n        }\n    }\n\n    /// Reactive wrapper for `setBackgroundImage(_:for:)`\n    public func backgroundImage(for controlState: UIControl.State = []) -> Binder<UIImage?> {\n        Binder(self.base) { button, image in\n            button.setBackgroundImage(image, for: controlState)\n        }\n    }\n    \n}\n#endif\n\n#if os(iOS) || os(tvOS)\n    import RxSwift\n    import UIKit\n    \n    extension Reactive where Base: UIButton {\n        /// Reactive wrapper for `setAttributedTitle(_:controlState:)`\n        public func attributedTitle(for controlState: UIControl.State = []) -> Binder<NSAttributedString?> {\n            return Binder(self.base) { button, attributedTitle -> Void in\n                button.setAttributedTitle(attributedTitle, for: controlState)\n            }\n        }\n    }\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UICollectionView+Rx.swift",
    "content": "//\n//  UICollectionView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 4/2/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n\n// Items\n\nextension Reactive where Base: UICollectionView {\n\n    /**\n    Binds sequences of elements to collection view items.\n    \n    - parameter source: Observable sequence of items.\n    - parameter cellFactory: Transform between sequence elements and view cells.\n    - returns: Disposable object that can be used to unbind.\n     \n     Example\n    \n         let items = Observable.just([\n             1,\n             2,\n             3\n         ])\n\n         items\n         .bind(to: collectionView.rx.items) { (collectionView, row, element) in\n            let indexPath = IndexPath(row: row, section: 0)\n            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: \"Cell\", for: indexPath) as! NumberCell\n             cell.value?.text = \"\\(element) @ \\(row)\"\n             return cell\n         }\n         .disposed(by: disposeBag)\n    */\n    public func items<Sequence: Swift.Sequence, Source: ObservableType>\n        (_ source: Source)\n        -> (_ cellFactory: @escaping (UICollectionView, Int, Sequence.Element) -> UICollectionViewCell)\n        -> Disposable where Source.Element == Sequence {\n        return { cellFactory in\n            let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper<Sequence>(cellFactory: cellFactory)\n            return self.items(dataSource: dataSource)(source)\n        }\n        \n    }\n    \n    /**\n    Binds sequences of elements to collection view items.\n    \n    - parameter cellIdentifier: Identifier used to dequeue cells.\n    - parameter source: Observable sequence of items.\n    - parameter configureCell: Transform between sequence elements and view cells.\n    - parameter cellType: Type of collection view cell.\n    - returns: Disposable object that can be used to unbind.\n     \n     Example\n\n         let items = Observable.just([\n             1,\n             2,\n             3\n         ])\n\n         items\n             .bind(to: collectionView.rx.items(cellIdentifier: \"Cell\", cellType: NumberCell.self)) { (row, element, cell) in\n                cell.value?.text = \"\\(element) @ \\(row)\"\n             }\n             .disposed(by: disposeBag)\n    */\n    public func items<Sequence: Swift.Sequence, Cell: UICollectionViewCell, Source: ObservableType>\n        (cellIdentifier: String, cellType: Cell.Type = Cell.self)\n        -> (_ source: Source)\n        -> (_ configureCell: @escaping (Int, Sequence.Element, Cell) -> Void)\n        -> Disposable where Source.Element == Sequence {\n        return { source in\n            return { configureCell in\n                let dataSource = RxCollectionViewReactiveArrayDataSourceSequenceWrapper<Sequence> { cv, i, item in\n                    let indexPath = IndexPath(item: i, section: 0)\n                    let cell = cv.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! Cell\n                    configureCell(i, item, cell)\n                    return cell\n                }\n                    \n                return self.items(dataSource: dataSource)(source)\n            }\n        }\n    }\n\n    \n    /**\n    Binds sequences of elements to collection view items using a custom reactive data used to perform the transformation.\n    \n    - parameter dataSource: Data source used to transform elements to view cells.\n    - parameter source: Observable sequence of items.\n    - returns: Disposable object that can be used to unbind.\n     \n     Example\n     \n         let dataSource = RxCollectionViewSectionedReloadDataSource<SectionModel<String, Double>>()\n\n         let items = Observable.just([\n             SectionModel(model: \"First section\", items: [\n                 1.0,\n                 2.0,\n                 3.0\n             ]),\n             SectionModel(model: \"Second section\", items: [\n                 1.0,\n                 2.0,\n                 3.0\n             ]),\n             SectionModel(model: \"Third section\", items: [\n                 1.0,\n                 2.0,\n                 3.0\n             ])\n         ])\n\n         dataSource.configureCell = { (dataSource, cv, indexPath, element) in\n             let cell = cv.dequeueReusableCell(withReuseIdentifier: \"Cell\", for: indexPath) as! NumberCell\n             cell.value?.text = \"\\(element) @ row \\(indexPath.row)\"\n             return cell\n         }\n\n         items\n            .bind(to: collectionView.rx.items(dataSource: dataSource))\n            .disposed(by: disposeBag)\n    */\n    public func items<\n            DataSource: RxCollectionViewDataSourceType & UICollectionViewDataSource,\n            Source: ObservableType>\n        (dataSource: DataSource)\n        -> (_ source: Source)\n        -> Disposable where DataSource.Element == Source.Element\n          {\n        return { source in\n            // This is called for side effects only, and to make sure delegate proxy is in place when\n            // data source is being bound.\n            // This is needed because theoretically the data source subscription itself might\n            // call `self.rx.delegate`. If that happens, it might cause weird side effects since\n            // setting data source will set delegate, and UICollectionView might get into a weird state.\n            // Therefore it's better to set delegate proxy first, just to be sure.\n            _ = self.delegate\n            // Strong reference is needed because data source is in use until result subscription is disposed\n            return source.subscribeProxyDataSource(ofObject: self.base, dataSource: dataSource, retainDataSource: true) { [weak collectionView = self.base] (_: RxCollectionViewDataSourceProxy, event) -> Void in\n                guard let collectionView = collectionView else {\n                    return\n                }\n                dataSource.collectionView(collectionView, observedEvent: event)\n            }\n        }\n    }\n}\n\nextension Reactive where Base: UICollectionView {\n    public typealias DisplayCollectionViewCellEvent = (cell: UICollectionViewCell, at: IndexPath)\n    public typealias DisplayCollectionViewSupplementaryViewEvent = (supplementaryView: UICollectionReusableView, elementKind: String, at: IndexPath)\n\n    /// Reactive wrapper for `dataSource`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var dataSource: DelegateProxy<UICollectionView, UICollectionViewDataSource> {\n        RxCollectionViewDataSourceProxy.proxy(for: base)\n    }\n    \n    /// Installs data source as forwarding delegate on `rx.dataSource`.\n    /// Data source won't be retained.\n    ///\n    /// It enables using normal delegate mechanism with reactive delegate mechanism.\n    ///\n    /// - parameter dataSource: Data source object.\n    /// - returns: Disposable object that can be used to unbind the data source.\n    public func setDataSource(_ dataSource: UICollectionViewDataSource)\n        -> Disposable {\n        RxCollectionViewDataSourceProxy.installForwardDelegate(dataSource, retainDelegate: false, onProxyForObject: self.base)\n    }\n   \n    /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`.\n    public var itemSelected: ControlEvent<IndexPath> {\n        let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didSelectItemAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n        \n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView(_:didDeselectItemAtIndexPath:)`.\n    public var itemDeselected: ControlEvent<IndexPath> {\n        let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didDeselectItemAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n        }\n\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView(_:didHighlightItemAt:)`.\n    public var itemHighlighted: ControlEvent<IndexPath> {\n        let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didHighlightItemAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n        \n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView(_:didUnhighlightItemAt:)`.\n    public var itemUnhighlighted: ControlEvent<IndexPath> {\n        let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didUnhighlightItemAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n        \n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView:willDisplay:forItemAt:`.\n    public var willDisplayCell: ControlEvent<DisplayCollectionViewCellEvent> {\n        let source: Observable<DisplayCollectionViewCellEvent> = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:willDisplay:forItemAt:)))\n            .map { a in\n                return (try castOrThrow(UICollectionViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2]))\n            }\n        \n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView(_:willDisplaySupplementaryView:forElementKind:at:)`.\n    public var willDisplaySupplementaryView: ControlEvent<DisplayCollectionViewSupplementaryViewEvent> {\n        let source: Observable<DisplayCollectionViewSupplementaryViewEvent> = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:willDisplaySupplementaryView:forElementKind:at:)))\n            .map { a in\n                return (try castOrThrow(UICollectionReusableView.self, a[1]),\n                        try castOrThrow(String.self, a[2]),\n                        try castOrThrow(IndexPath.self, a[3]))\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView:didEndDisplaying:forItemAt:`.\n    public var didEndDisplayingCell: ControlEvent<DisplayCollectionViewCellEvent> {\n        let source: Observable<DisplayCollectionViewCellEvent> = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didEndDisplaying:forItemAt:)))\n            .map { a in\n                return (try castOrThrow(UICollectionViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2]))\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:)`.\n    public var didEndDisplayingSupplementaryView: ControlEvent<DisplayCollectionViewSupplementaryViewEvent> {\n        let source: Observable<DisplayCollectionViewSupplementaryViewEvent> = self.delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didEndDisplayingSupplementaryView:forElementOfKind:at:)))\n            .map { a in\n                return (try castOrThrow(UICollectionReusableView.self, a[1]),\n                        try castOrThrow(String.self, a[2]),\n                        try castOrThrow(IndexPath.self, a[3]))\n            }\n\n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`.\n    ///\n    /// It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence,\n    /// or any other data source conforming to `SectionedViewDataSourceType` protocol.\n    ///\n    /// ```\n    ///     collectionView.rx.modelSelected(MyModel.self)\n    ///        .map { ...\n    /// ```\n    public func modelSelected<T>(_ modelType: T.Type) -> ControlEvent<T> {\n        let source: Observable<T> = itemSelected.flatMap { [weak view = self.base as UICollectionView] indexPath -> Observable<T> in\n            guard let view = view else {\n                return Observable.empty()\n            }\n\n            return Observable.just(try view.rx.model(at: indexPath))\n        }\n        \n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `collectionView(_:didSelectItemAtIndexPath:)`.\n    ///\n    /// It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence,\n    /// or any other data source conforming to `SectionedViewDataSourceType` protocol.\n    ///\n    /// ```\n    ///     collectionView.rx.modelDeselected(MyModel.self)\n    ///        .map { ...\n    /// ```\n    public func modelDeselected<T>(_ modelType: T.Type) -> ControlEvent<T> {\n        let source: Observable<T> = itemDeselected.flatMap { [weak view = self.base as UICollectionView] indexPath -> Observable<T> in\n            guard let view = view else {\n                return Observable.empty()\n            }\n\n            return Observable.just(try view.rx.model(at: indexPath))\n        }\n\n        return ControlEvent(events: source)\n    }\n    \n    /// Synchronous helper method for retrieving a model at indexPath through a reactive data source\n    public func model<T>(at indexPath: IndexPath) throws -> T {\n        let dataSource: SectionedViewDataSourceType = castOrFatalError(self.dataSource.forwardToDelegate(), message: \"This method only works in case one of the `rx.itemsWith*` methods was used.\")\n        \n        let element = try dataSource.model(at: indexPath)\n\n        return try castOrThrow(T.self, element)\n    }\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nextension Reactive where Base: UICollectionView {\n\n    /// Reactive wrapper for `prefetchDataSource`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var prefetchDataSource: DelegateProxy<UICollectionView, UICollectionViewDataSourcePrefetching> {\n        RxCollectionViewDataSourcePrefetchingProxy.proxy(for: base)\n    }\n\n    /**\n     Installs prefetch data source as forwarding delegate on `rx.prefetchDataSource`.\n     Prefetch data source won't be retained.\n\n     It enables using normal delegate mechanism with reactive delegate mechanism.\n\n     - parameter prefetchDataSource: Prefetch data source object.\n     - returns: Disposable object that can be used to unbind the data source.\n     */\n    public func setPrefetchDataSource(_ prefetchDataSource: UICollectionViewDataSourcePrefetching)\n        -> Disposable {\n            return RxCollectionViewDataSourcePrefetchingProxy.installForwardDelegate(prefetchDataSource, retainDelegate: false, onProxyForObject: self.base)\n    }\n\n    /// Reactive wrapper for `prefetchDataSource` message `collectionView(_:prefetchItemsAt:)`.\n    public var prefetchItems: ControlEvent<[IndexPath]> {\n        let source = RxCollectionViewDataSourcePrefetchingProxy.proxy(for: base).prefetchItemsPublishSubject\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `prefetchDataSource` message `collectionView(_:cancelPrefetchingForItemsAt:)`.\n    public var cancelPrefetchingForItems: ControlEvent<[IndexPath]> {\n        let source = prefetchDataSource.methodInvoked(#selector(UICollectionViewDataSourcePrefetching.collectionView(_:cancelPrefetchingForItemsAt:)))\n            .map { a in\n                return try castOrThrow(Array<IndexPath>.self, a[1])\n        }\n\n        return ControlEvent(events: source)\n    }\n\n}\n#endif\n\n#if os(tvOS)\n\nextension Reactive where Base: UICollectionView {\n    \n    /// Reactive wrapper for `delegate` message `collectionView(_:didUpdateFocusInContext:withAnimationCoordinator:)`.\n    public var didUpdateFocusInContextWithAnimationCoordinator: ControlEvent<(context: UICollectionViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator)> {\n\n        let source = delegate.methodInvoked(#selector(UICollectionViewDelegate.collectionView(_:didUpdateFocusIn:with:)))\n            .map { a -> (context: UICollectionViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator) in\n                let context = try castOrThrow(UICollectionViewFocusUpdateContext.self, a[1])\n                let animationCoordinator = try castOrThrow(UIFocusAnimationCoordinator.self, a[2])\n                return (context: context, animationCoordinator: animationCoordinator)\n            }\n\n        return ControlEvent(events: source)\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIControl+Rx.swift",
    "content": "//\n//  UIControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Daniel Tartaglia on 5/23/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UIControl {\n    /// Reactive wrapper for target action pattern.\n    ///\n    /// - parameter controlEvents: Filter for observed event types.\n    public func controlEvent(_ controlEvents: UIControl.Event) -> ControlEvent<()> {\n        let source: Observable<Void> = Observable.create { [weak control = self.base] observer in\n                MainScheduler.ensureRunningOnMainThread()\n\n                guard let control = control else {\n                    observer.on(.completed)\n                    return Disposables.create()\n                }\n\n                let controlTarget = ControlTarget(control: control, controlEvents: controlEvents) { _ in\n                    observer.on(.next(()))\n                }\n\n                return Disposables.create(with: controlTarget.dispose)\n            }\n            .take(until: deallocated)\n\n        return ControlEvent(events: source)\n    }\n\n    /// Creates a `ControlProperty` that is triggered by target/action pattern value updates.\n    ///\n    /// - parameter controlEvents: Events that trigger value update sequence elements.\n    /// - parameter getter: Property value getter.\n    /// - parameter setter: Property value setter.\n    public func controlProperty<T>(\n        editingEvents: UIControl.Event,\n        getter: @escaping (Base) -> T,\n        setter: @escaping (Base, T) -> Void\n    ) -> ControlProperty<T> {\n        let source: Observable<T> = Observable.create { [weak weakControl = base] observer in\n                guard let control = weakControl else {\n                    observer.on(.completed)\n                    return Disposables.create()\n                }\n\n                observer.on(.next(getter(control)))\n\n                let controlTarget = ControlTarget(control: control, controlEvents: editingEvents) { _ in\n                    if let control = weakControl {\n                        observer.on(.next(getter(control)))\n                    }\n                }\n                \n                return Disposables.create(with: controlTarget.dispose)\n            }\n            .take(until: deallocated)\n\n        let bindingObserver = Binder(base, binding: setter)\n\n        return ControlProperty<T>(values: source, valueSink: bindingObserver)\n    }\n\n    /// This is a separate method to better communicate to public consumers that\n    /// an `editingEvent` needs to fire for control property to be updated.\n    internal func controlPropertyWithDefaultEvents<T>(\n        editingEvents: UIControl.Event = [.allEditingEvents, .valueChanged],\n        getter: @escaping (Base) -> T,\n        setter: @escaping (Base, T) -> Void\n        ) -> ControlProperty<T> {\n        return controlProperty(\n            editingEvents: editingEvents,\n            getter: getter,\n            setter: setter\n        )\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIDatePicker+Rx.swift",
    "content": "//\n//  UIDatePicker+Rx.swift\n//  RxCocoa\n//\n//  Created by Daniel Tartaglia on 5/31/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UIDatePicker {\n    /// Reactive wrapper for `date` property.\n    public var date: ControlProperty<Date> {\n        value\n    }\n\n    /// Reactive wrapper for `date` property.\n    public var value: ControlProperty<Date> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { datePicker in\n                datePicker.date\n            }, setter: { datePicker, value in\n                datePicker.date = value\n            }\n        )\n    }\n\n    /// Reactive wrapper for `countDownDuration` property.\n    public var countDownDuration: ControlProperty<TimeInterval> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { datePicker in\n                datePicker.countDownDuration\n            }, setter: { datePicker, value in\n                datePicker.countDownDuration = value\n            }\n        )\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIGestureRecognizer+Rx.swift",
    "content": "//\n//  UIGestureRecognizer+Rx.swift\n//  RxCocoa\n//\n//  Created by Carlos García on 10/6/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n// This should be only used from `MainScheduler`\nfinal class GestureTarget<Recognizer: UIGestureRecognizer>: RxTarget {\n    typealias Callback = (Recognizer) -> Void\n    \n    let selector = #selector(ControlTarget.eventHandler(_:))\n    \n    weak var gestureRecognizer: Recognizer?\n    var callback: Callback?\n    \n    init(_ gestureRecognizer: Recognizer, callback: @escaping Callback) {\n        self.gestureRecognizer = gestureRecognizer\n        self.callback = callback\n        \n        super.init()\n        \n        gestureRecognizer.addTarget(self, action: selector)\n\n        let method = self.method(for: selector)\n        if method == nil {\n            fatalError(\"Can't find method\")\n        }\n    }\n    \n    @objc func eventHandler(_ sender: UIGestureRecognizer) {\n        if let callback = self.callback, let gestureRecognizer = self.gestureRecognizer {\n            callback(gestureRecognizer)\n        }\n    }\n    \n    override func dispose() {\n        super.dispose()\n        \n        self.gestureRecognizer?.removeTarget(self, action: self.selector)\n        self.callback = nil\n    }\n}\n\nextension Reactive where Base: UIGestureRecognizer {\n    \n    /// Reactive wrapper for gesture recognizer events.\n    public var event: ControlEvent<Base> {\n        let source: Observable<Base> = Observable.create { [weak control = self.base] observer in\n            MainScheduler.ensureRunningOnMainThread()\n\n            guard let control = control else {\n                observer.on(.completed)\n                return Disposables.create()\n            }\n            \n            let observer = GestureTarget(control) { control in\n                observer.on(.next(control))\n            }\n            \n            return observer\n        }.take(until: deallocated)\n        \n        return ControlEvent(events: source)\n    }\n    \n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UINavigationController+Rx.swift",
    "content": "//\n//  UINavigationController+Rx.swift\n//  RxCocoa\n//\n//  Created by Diogo on 13/04/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UINavigationController {\n    public typealias ShowEvent = (viewController: UIViewController, animated: Bool)\n\n    /// Reactive wrapper for `delegate`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var delegate: DelegateProxy<UINavigationController, UINavigationControllerDelegate> {\n        RxNavigationControllerDelegateProxy.proxy(for: base)\n    }\n\n    /// Reactive wrapper for delegate method `navigationController(:willShow:animated:)`.\n    public var willShow: ControlEvent<ShowEvent> {\n        let source: Observable<ShowEvent> = delegate\n            .methodInvoked(#selector(UINavigationControllerDelegate.navigationController(_:willShow:animated:)))\n            .map { arg in\n                let viewController = try castOrThrow(UIViewController.self, arg[1])\n                let animated = try castOrThrow(Bool.self, arg[2])\n                return (viewController, animated)\n        }\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for delegate method `navigationController(:didShow:animated:)`.\n    public var didShow: ControlEvent<ShowEvent> {\n        let source: Observable<ShowEvent> = delegate\n            .methodInvoked(#selector(UINavigationControllerDelegate.navigationController(_:didShow:animated:)))\n            .map { arg in\n                let viewController = try castOrThrow(UIViewController.self, arg[1])\n                let animated = try castOrThrow(Bool.self, arg[2])\n                return (viewController, animated)\n        }\n        return ControlEvent(events: source)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIPickerView+Rx.swift",
    "content": "//\n//  UIPickerView+Rx.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 5/12/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n    \n    import RxSwift\n    import UIKit\n\n    extension Reactive where Base: UIPickerView {\n\n        /// Reactive wrapper for `delegate`.\n        /// For more information take a look at `DelegateProxyType` protocol documentation.\n        public var delegate: DelegateProxy<UIPickerView, UIPickerViewDelegate> {\n            return RxPickerViewDelegateProxy.proxy(for: base)\n        }\n        \n        /// Installs delegate as forwarding delegate on `delegate`.\n        /// Delegate won't be retained.\n        ///\n        /// It enables using normal delegate mechanism with reactive delegate mechanism.\n        ///\n        /// - parameter delegate: Delegate object.\n        /// - returns: Disposable object that can be used to unbind the delegate.\n        public func setDelegate(_ delegate: UIPickerViewDelegate)\n            -> Disposable {\n                return RxPickerViewDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base)\n        }\n        \n        /**\n         Reactive wrapper for `dataSource`.\n         \n         For more information take a look at `DelegateProxyType` protocol documentation.\n         */\n        public var dataSource: DelegateProxy<UIPickerView, UIPickerViewDataSource> {\n            return RxPickerViewDataSourceProxy.proxy(for: base)\n        }\n        \n        /**\n         Reactive wrapper for `delegate` message `pickerView:didSelectRow:inComponent:`.\n         */\n        public var itemSelected: ControlEvent<(row: Int, component: Int)> {\n            let source = delegate\n                .methodInvoked(#selector(UIPickerViewDelegate.pickerView(_:didSelectRow:inComponent:)))\n                .map {\n                    return (row: try castOrThrow(Int.self, $0[1]), component: try castOrThrow(Int.self, $0[2]))\n                }\n            return ControlEvent(events: source)\n        }\n        \n        /**\n         Reactive wrapper for `delegate` message `pickerView:didSelectRow:inComponent:`.\n         \n         It can be only used when one of the `rx.itemTitles, rx.itemAttributedTitles, items(_ source: O)` methods is used to bind observable sequence,\n         or any other data source conforming to a `ViewDataSourceType` protocol.\n         \n         ```\n         pickerView.rx.modelSelected(MyModel.self)\n         .map { ...\n         ```\n         - parameter modelType: Type of a Model which bound to the dataSource\n         */\n        public func modelSelected<T>(_ modelType: T.Type) -> ControlEvent<[T]> {\n            let source = itemSelected.flatMap { [weak view = self.base as UIPickerView] _, component -> Observable<[T]> in\n                guard let view = view else {\n                    return Observable.empty()\n                }\n\n                let model: [T] = try (0 ..< view.numberOfComponents).map { component in\n                    let row = view.selectedRow(inComponent: component)\n                    return try view.rx.model(at: IndexPath(row: row, section: component))\n                }\n\n                return Observable.just(model)\n            }\n            \n            return ControlEvent(events: source)\n        }\n        \n        /**\n         Binds sequences of elements to picker view rows.\n         \n         - parameter source: Observable sequence of items.\n         - parameter titleForRow: Transform between sequence elements and row titles.\n         - returns: Disposable object that can be used to unbind.\n         \n         Example:\n         \n            let items = Observable.just([\n                    \"First Item\",\n                    \"Second Item\",\n                    \"Third Item\"\n                ])\n         \n            items\n                .bind(to: pickerView.rx.itemTitles) { (row, element) in\n                    return element.title\n                }\n                .disposed(by: disposeBag)\n         \n         */\n        \n        public func itemTitles<Sequence: Swift.Sequence, Source: ObservableType>\n            (_ source: Source)\n            -> (_ titleForRow: @escaping (Int, Sequence.Element) -> String?)\n            -> Disposable where Source.Element == Sequence {\n                return { titleForRow in\n                    let adapter = RxStringPickerViewAdapter<Sequence>(titleForRow: titleForRow)\n                    return self.items(adapter: adapter)(source)\n                }\n        }\n        \n        /**\n         Binds sequences of elements to picker view rows.\n         \n         - parameter source: Observable sequence of items.\n         - parameter attributedTitleForRow: Transform between sequence elements and row attributed titles.\n         - returns: Disposable object that can be used to unbind.\n         \n         Example:\n         \n         let items = Observable.just([\n                \"First Item\",\n                \"Second Item\",\n                \"Third Item\"\n            ])\n         \n         items\n            .bind(to: pickerView.rx.itemAttributedTitles) { (row, element) in\n                return NSAttributedString(string: element.title)\n            }\n            .disposed(by: disposeBag)\n        \n         */\n\n        public func itemAttributedTitles<Sequence: Swift.Sequence, Source: ObservableType>\n            (_ source: Source)\n            -> (_ attributedTitleForRow: @escaping (Int, Sequence.Element) -> NSAttributedString?)\n            -> Disposable where Source.Element == Sequence {\n                return { attributedTitleForRow in\n                    let adapter = RxAttributedStringPickerViewAdapter<Sequence>(attributedTitleForRow: attributedTitleForRow)\n                    return self.items(adapter: adapter)(source)\n                }\n        }\n        \n        /**\n         Binds sequences of elements to picker view rows.\n         \n         - parameter source: Observable sequence of items.\n         - parameter viewForRow: Transform between sequence elements and row views.\n         - returns: Disposable object that can be used to unbind.\n         \n         Example:\n         \n         let items = Observable.just([\n                \"First Item\",\n                \"Second Item\",\n                \"Third Item\"\n            ])\n         \n         items\n            .bind(to: pickerView.rx.items) { (row, element, view) in\n                guard let myView = view as? MyView else {\n                    let view = MyView()\n                    view.configure(with: element)\n                    return view\n                }\n                myView.configure(with: element)\n                return myView\n            }\n            .disposed(by: disposeBag)\n         \n         */\n\n        public func items<Sequence: Swift.Sequence, Source: ObservableType>\n            (_ source: Source)\n            -> (_ viewForRow: @escaping (Int, Sequence.Element, UIView?) -> UIView)\n            -> Disposable where Source.Element == Sequence {\n                return { viewForRow in\n                    let adapter = RxPickerViewAdapter<Sequence>(viewForRow: viewForRow)\n                    return self.items(adapter: adapter)(source)\n                }\n        }\n        \n        /**\n         Binds sequences of elements to picker view rows using a custom reactive adapter used to perform the transformation.\n         This method will retain the adapter for as long as the subscription isn't disposed (result `Disposable`\n         being disposed).\n         In case `source` observable sequence terminates successfully, the adapter will present latest element\n         until the subscription isn't disposed.\n         \n         - parameter adapter: Adapter used to transform elements to picker components.\n         - parameter source: Observable sequence of items.\n         - returns: Disposable object that can be used to unbind.\n         */\n        public func items<Source: ObservableType,\n                          Adapter: RxPickerViewDataSourceType & UIPickerViewDataSource & UIPickerViewDelegate>(adapter: Adapter)\n            -> (_ source: Source)\n            -> Disposable where Source.Element == Adapter.Element {\n                return { source in\n                    let delegateSubscription = self.setDelegate(adapter)\n                    let dataSourceSubscription = source.subscribeProxyDataSource(ofObject: self.base, dataSource: adapter, retainDataSource: true, binding: { [weak pickerView = self.base] (_: RxPickerViewDataSourceProxy, event) in\n                        guard let pickerView = pickerView else { return }\n                        adapter.pickerView(pickerView, observedEvent: event)\n                    })\n                    return Disposables.create(delegateSubscription, dataSourceSubscription)\n                }\n        }\n        \n        /**\n         Synchronous helper method for retrieving a model at indexPath through a reactive data source.\n         */\n        public func model<T>(at indexPath: IndexPath) throws -> T {\n            let dataSource: SectionedViewDataSourceType = castOrFatalError(self.dataSource.forwardToDelegate(), message: \"This method only works in case one of the `rx.itemTitles, rx.itemAttributedTitles, items(_ source: O)` methods was used.\")\n            \n            return castOrFatalError(try dataSource.model(at: indexPath))\n        }\n    }\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIRefreshControl+Rx.swift",
    "content": "//\n//  UIRefreshControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Yosuke Ishikawa on 1/31/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\n\nextension Reactive where Base: UIRefreshControl {\n    /// Bindable sink for `beginRefreshing()`, `endRefreshing()` methods.\n    public var isRefreshing: Binder<Bool> {\n        return Binder(self.base) { refreshControl, refresh in\n            if refresh {\n                refreshControl.beginRefreshing()\n            } else {\n                refreshControl.endRefreshing()\n            }\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIScrollView+Rx.swift",
    "content": "//\n//  UIScrollView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 4/3/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\n    import RxSwift\n    import UIKit\n\n    extension Reactive where Base: UIScrollView {\n        public typealias EndZoomEvent = (view: UIView?, scale: CGFloat)\n        public typealias WillEndDraggingEvent = (velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>)\n\n        /// Reactive wrapper for `delegate`.\n        ///\n        /// For more information take a look at `DelegateProxyType` protocol documentation.\n        public var delegate: DelegateProxy<UIScrollView, UIScrollViewDelegate> {\n            return RxScrollViewDelegateProxy.proxy(for: base)\n        }\n        \n        /// Reactive wrapper for `contentOffset`.\n        public var contentOffset: ControlProperty<CGPoint> {\n            let proxy = RxScrollViewDelegateProxy.proxy(for: base)\n\n            let bindingObserver = Binder(self.base) { scrollView, contentOffset in\n                scrollView.contentOffset = contentOffset\n            }\n\n            return ControlProperty(values: proxy.contentOffsetBehaviorSubject, valueSink: bindingObserver)\n        }\n\n        /// Reactive wrapper for delegate method `scrollViewDidScroll`\n        public var didScroll: ControlEvent<Void> {\n            let source = RxScrollViewDelegateProxy.proxy(for: base).contentOffsetPublishSubject\n            return ControlEvent(events: source)\n        }\n        \n        /// Reactive wrapper for delegate method `scrollViewWillBeginDecelerating`\n        public var willBeginDecelerating: ControlEvent<Void> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginDecelerating(_:))).map { _ in }\n            return ControlEvent(events: source)\n        }\n    \t\n    \t/// Reactive wrapper for delegate method `scrollViewDidEndDecelerating`\n    \tpublic var didEndDecelerating: ControlEvent<Void> {\n    \t\tlet source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndDecelerating(_:))).map { _ in }\n    \t\treturn ControlEvent(events: source)\n    \t}\n    \t\n        /// Reactive wrapper for delegate method `scrollViewWillBeginDragging`\n        public var willBeginDragging: ControlEvent<Void> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginDragging(_:))).map { _ in }\n            return ControlEvent(events: source)\n        }\n        \n        /// Reactive wrapper for delegate method `scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)`\n        public var willEndDragging: ControlEvent<WillEndDraggingEvent> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)))\n                .map { value -> WillEndDraggingEvent in\n                    let velocity = try castOrThrow(CGPoint.self, value[1])\n                    let targetContentOffsetValue = try castOrThrow(NSValue.self, value[2])\n\n                    guard let rawPointer = targetContentOffsetValue.pointerValue else { throw RxCocoaError.unknown }\n                    let typedPointer = rawPointer.bindMemory(to: CGPoint.self, capacity: MemoryLayout<CGPoint>.size)\n\n                    return (velocity, typedPointer)\n            }\n            return ControlEvent(events: source)\n        }\n        \n    \t/// Reactive wrapper for delegate method `scrollViewDidEndDragging(_:willDecelerate:)`\n        public var didEndDragging: ControlEvent<Bool> {\n    \t\tlet source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndDragging(_:willDecelerate:))).map { value -> Bool in\n    \t\t\treturn try castOrThrow(Bool.self, value[1])\n    \t\t}\n    \t\treturn ControlEvent(events: source)\n    \t}\n\n        /// Reactive wrapper for delegate method `scrollViewDidZoom`\n        public var didZoom: ControlEvent<Void> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidZoom)).map { _ in }\n            return ControlEvent(events: source)\n        }\n\n\n        /// Reactive wrapper for delegate method `scrollViewDidScrollToTop`\n        public var didScrollToTop: ControlEvent<Void> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidScrollToTop(_:))).map { _ in }\n            return ControlEvent(events: source)\n        }\n        \n        /// Reactive wrapper for delegate method `scrollViewDidEndScrollingAnimation`\n        public var didEndScrollingAnimation: ControlEvent<Void> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndScrollingAnimation(_:))).map { _ in }\n            return ControlEvent(events: source)\n        }\n        \n        /// Reactive wrapper for delegate method `scrollViewWillBeginZooming(_:with:)`\n        public var willBeginZooming: ControlEvent<UIView?> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewWillBeginZooming(_:with:))).map { value -> UIView? in\n                return try castOptionalOrThrow(UIView.self, value[1] as AnyObject)\n            }\n            return ControlEvent(events: source)\n        }\n        \n        /// Reactive wrapper for delegate method `scrollViewDidEndZooming(_:with:atScale:)`\n        public var didEndZooming: ControlEvent<EndZoomEvent> {\n            let source = delegate.methodInvoked(#selector(UIScrollViewDelegate.scrollViewDidEndZooming(_:with:atScale:))).map { value -> EndZoomEvent in\n                return (try castOptionalOrThrow(UIView.self, value[1] as AnyObject), try castOrThrow(CGFloat.self, value[2]))\n            }\n            return ControlEvent(events: source)\n        }\n\n        /// Installs delegate as forwarding delegate on `delegate`.\n        /// Delegate won't be retained.\n        ///\n        /// It enables using normal delegate mechanism with reactive delegate mechanism.\n        ///\n        /// - parameter delegate: Delegate object.\n        /// - returns: Disposable object that can be used to unbind the delegate.\n        public func setDelegate(_ delegate: UIScrollViewDelegate)\n            -> Disposable {\n            return RxScrollViewDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base)\n        }\n    }\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UISearchBar+Rx.swift",
    "content": "//\n//  UISearchBar+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 3/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UISearchBar {\n\n    /// Reactive wrapper for `delegate`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var delegate: DelegateProxy<UISearchBar, UISearchBarDelegate> {\n        RxSearchBarDelegateProxy.proxy(for: base)\n    }\n\n    /// Reactive wrapper for `text` property.\n    public var text: ControlProperty<String?> {\n        value\n    }\n    \n    /// Reactive wrapper for `text` property.\n    public var value: ControlProperty<String?> {\n        let source: Observable<String?> = Observable.deferred { [weak searchBar = self.base as UISearchBar] () -> Observable<String?> in\n            let text = searchBar?.text\n\n            let textDidChange = (searchBar?.rx.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBar(_:textDidChange:))) ?? Observable.empty())\n            let didEndEditing = (searchBar?.rx.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidEndEditing(_:))) ?? Observable.empty())\n            \n            return Observable.merge(textDidChange, didEndEditing)\n                    .map { _ in searchBar?.text ?? \"\" }\n                    .startWith(text)\n        }\n        \n        let bindingObserver = Binder(self.base) { (searchBar, text: String?) in\n            searchBar.text = text\n        }\n\n        return ControlProperty(values: source, valueSink: bindingObserver)\n    }\n    \n    /// Reactive wrapper for `selectedScopeButtonIndex` property.\n    public var selectedScopeButtonIndex: ControlProperty<Int> {\n        let source: Observable<Int> = Observable.deferred { [weak source = self.base as UISearchBar] () -> Observable<Int> in\n            let index = source?.selectedScopeButtonIndex ?? 0\n            \n            return (source?.rx.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBar(_:selectedScopeButtonIndexDidChange:))) ?? Observable.empty())\n                .map { a in\n                    return try castOrThrow(Int.self, a[1])\n                }\n                .startWith(index)\n        }\n        \n        let bindingObserver = Binder(self.base) { (searchBar, index: Int) in\n            searchBar.selectedScopeButtonIndex = index\n        }\n        \n        return ControlProperty(values: source, valueSink: bindingObserver)\n    }\n    \n#if os(iOS)\n    /// Reactive wrapper for delegate method `searchBarCancelButtonClicked`.\n    public var cancelButtonClicked: ControlEvent<Void> {\n        let source: Observable<Void> = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarCancelButtonClicked(_:)))\n            .map { _ in\n                return ()\n            }\n        return ControlEvent(events: source)\n    }\n\n\t/// Reactive wrapper for delegate method `searchBarBookmarkButtonClicked`.\n\tpublic var bookmarkButtonClicked: ControlEvent<Void> {\n\t\tlet source: Observable<Void> = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarBookmarkButtonClicked(_:)))\n\t\t\t.map { _ in\n\t\t\t\treturn ()\n\t\t\t}\n\t\treturn ControlEvent(events: source)\n\t}\n\n\t/// Reactive wrapper for delegate method `searchBarResultsListButtonClicked`.\n\tpublic var resultsListButtonClicked: ControlEvent<Void> {\n\t\tlet source: Observable<Void> = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarResultsListButtonClicked(_:)))\n\t\t\t.map { _ in\n\t\t\t\treturn ()\n\t\t}\n\t\treturn ControlEvent(events: source)\n\t}\n#endif\n\t\n    /// Reactive wrapper for delegate method `searchBarSearchButtonClicked`.\n    public var searchButtonClicked: ControlEvent<Void> {\n        let source: Observable<Void> = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarSearchButtonClicked(_:)))\n            .map { _ in\n                return ()\n        }\n        return ControlEvent(events: source)\n    }\n\t\n\t/// Reactive wrapper for delegate method `searchBarTextDidBeginEditing`.\n\tpublic var textDidBeginEditing: ControlEvent<Void> {\n\t\tlet source: Observable<Void> = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidBeginEditing(_:)))\n\t\t\t.map { _ in\n\t\t\t\treturn ()\n\t\t}\n\t\treturn ControlEvent(events: source)\n\t}\n\t\n\t/// Reactive wrapper for delegate method `searchBarTextDidEndEditing`.\n\tpublic var textDidEndEditing: ControlEvent<Void> {\n\t\tlet source: Observable<Void> = self.delegate.methodInvoked(#selector(UISearchBarDelegate.searchBarTextDidEndEditing(_:)))\n\t\t\t.map { _ in\n\t\t\t\treturn ()\n\t\t}\n\t\treturn ControlEvent(events: source)\n\t}\n  \n    /// Installs delegate as forwarding delegate on `delegate`.\n    /// Delegate won't be retained.\n    ///\n    /// It enables using normal delegate mechanism with reactive delegate mechanism.\n    ///\n    /// - parameter delegate: Delegate object.\n    /// - returns: Disposable object that can be used to unbind the delegate.\n    public func setDelegate(_ delegate: UISearchBarDelegate)\n        -> Disposable {\n        RxSearchBarDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UISearchController+Rx.swift",
    "content": "//\n//  UISearchController+Rx.swift\n//  RxCocoa\n//\n//  Created by Segii Shulga on 3/17/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n    \n    import RxSwift\n    import UIKit\n    \n    extension Reactive where Base: UISearchController {\n        /// Reactive wrapper for `delegate`.\n        /// For more information take a look at `DelegateProxyType` protocol documentation.\n        public var delegate: DelegateProxy<UISearchController, UISearchControllerDelegate> {\n            return RxSearchControllerDelegateProxy.proxy(for: base)\n        }\n\n        /// Reactive wrapper for `delegate` message.\n        public var didDismiss: Observable<Void> {\n            return delegate\n                .methodInvoked( #selector(UISearchControllerDelegate.didDismissSearchController(_:)))\n                .map { _ in }\n        }\n\n        /// Reactive wrapper for `delegate` message.\n        public var didPresent: Observable<Void> {\n            return delegate\n                .methodInvoked(#selector(UISearchControllerDelegate.didPresentSearchController(_:)))\n                .map { _ in }\n        }\n\n        /// Reactive wrapper for `delegate` message.\n        public var present: Observable<Void> {\n            return delegate\n                .methodInvoked( #selector(UISearchControllerDelegate.presentSearchController(_:)))\n                .map { _ in }\n        }\n\n        /// Reactive wrapper for `delegate` message.\n        public var willDismiss: Observable<Void> {\n            return delegate\n                .methodInvoked(#selector(UISearchControllerDelegate.willDismissSearchController(_:)))\n                .map { _ in }\n        }\n        \n        /// Reactive wrapper for `delegate` message.\n        public var willPresent: Observable<Void> {\n            return delegate\n                .methodInvoked( #selector(UISearchControllerDelegate.willPresentSearchController(_:)))\n                .map { _ in }\n        }\n        \n    }\n    \n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UISegmentedControl+Rx.swift",
    "content": "//\n//  UISegmentedControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Carlos García on 8/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nextension Reactive where Base: UISegmentedControl {\n    /// Reactive wrapper for `selectedSegmentIndex` property.\n    public var selectedSegmentIndex: ControlProperty<Int> {\n        value\n    }\n    \n    /// Reactive wrapper for `selectedSegmentIndex` property.\n    public var value: ControlProperty<Int> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { segmentedControl in\n                segmentedControl.selectedSegmentIndex\n            }, setter: { segmentedControl, value in\n                segmentedControl.selectedSegmentIndex = value\n            }\n        )\n    }\n    \n    /// Reactive wrapper for `setEnabled(_:forSegmentAt:)`\n    public func enabledForSegment(at index: Int) -> Binder<Bool> {\n        return Binder(self.base) { segmentedControl, segmentEnabled -> Void in\n            segmentedControl.setEnabled(segmentEnabled, forSegmentAt: index)\n        }\n    }\n    \n    /// Reactive wrapper for `setTitle(_:forSegmentAt:)`\n    public func titleForSegment(at index: Int) -> Binder<String?> {\n        return Binder(self.base) { segmentedControl, title -> Void in\n            segmentedControl.setTitle(title, forSegmentAt: index)\n        }\n    }\n    \n    /// Reactive wrapper for `setImage(_:forSegmentAt:)`\n    public func imageForSegment(at index: Int) -> Binder<UIImage?> {\n        return Binder(self.base) { segmentedControl, image -> Void in\n            segmentedControl.setImage(image, forSegmentAt: index)\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UISlider+Rx.swift",
    "content": "//\n//  UISlider+Rx.swift\n//  RxCocoa\n//\n//  Created by Alexander van der Werff on 28/05/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UISlider {\n    \n    /// Reactive wrapper for `value` property.\n    public var value: ControlProperty<Float> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { slider in\n                slider.value\n            }, setter: { slider, value in\n                slider.value = value\n            }\n        )\n    }\n    \n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UIStepper+Rx.swift",
    "content": "//\n//  UIStepper+Rx.swift\n//  RxCocoa\n//\n//  Created by Yuta ToKoRo on 9/1/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\n\nextension Reactive where Base: UIStepper {\n    \n    /// Reactive wrapper for `value` property.\n    public var value: ControlProperty<Double> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { stepper in\n                stepper.value\n            }, setter: { stepper, value in\n                stepper.value = value\n            }\n        )\n    }\n}\n\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UISwitch+Rx.swift",
    "content": "//\n//  UISwitch+Rx.swift\n//  RxCocoa\n//\n//  Created by Carlos García on 8/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\n\nextension Reactive where Base: UISwitch {\n\n    /// Reactive wrapper for `isOn` property.\n    public var isOn: ControlProperty<Bool> {\n        value\n    }\n\n    /// Reactive wrapper for `isOn` property.\n    ///\n    /// ⚠️ Versions prior to iOS 10.2 were leaking `UISwitch`'s, so on those versions\n    /// underlying observable sequence won't complete when nothing holds a strong reference\n    /// to `UISwitch`.\n    public var value: ControlProperty<Bool> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { uiSwitch in\n                uiSwitch.isOn\n            }, setter: { uiSwitch, value in\n                uiSwitch.isOn = value\n            }\n        )\n    }\n    \n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UITabBar+Rx.swift",
    "content": "//\n//  UITabBar+Rx.swift\n//  RxCocoa\n//\n//  Created by Jesse Farless on 5/13/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\n/**\n iOS only\n */\n#if os(iOS)\nextension Reactive where Base: UITabBar {\n\n    /// Reactive wrapper for `delegate` message `tabBar(_:willBeginCustomizing:)`.\n    public var willBeginCustomizing: ControlEvent<[UITabBarItem]> {\n        \n        let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:willBeginCustomizing:)))\n            .map { a in\n                return try castOrThrow([UITabBarItem].self, a[1])\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `tabBar(_:didBeginCustomizing:)`.\n    public var didBeginCustomizing: ControlEvent<[UITabBarItem]> {\n        let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didBeginCustomizing:)))\n            .map { a in\n                return try castOrThrow([UITabBarItem].self, a[1])\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `tabBar(_:willEndCustomizing:changed:)`.\n    public var willEndCustomizing: ControlEvent<([UITabBarItem], Bool)> {\n        let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:willEndCustomizing:changed:)))\n            .map { (a: [Any]) -> (([UITabBarItem], Bool)) in\n                let items = try castOrThrow([UITabBarItem].self, a[1])\n                let changed = try castOrThrow(Bool.self, a[2])\n                return (items, changed)\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `delegate` message `tabBar(_:didEndCustomizing:changed:)`.\n    public var didEndCustomizing: ControlEvent<([UITabBarItem], Bool)> {\n        let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didEndCustomizing:changed:)))\n            .map { (a: [Any]) -> (([UITabBarItem], Bool)) in\n                let items = try castOrThrow([UITabBarItem].self, a[1])\n                let changed = try castOrThrow(Bool.self, a[2])\n                return (items, changed)\n            }\n\n        return ControlEvent(events: source)\n    }\n\n}\n#endif\n\n/**\n iOS and tvOS\n */\n    \nextension Reactive where Base: UITabBar {\n    /// Reactive wrapper for `delegate`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var delegate: DelegateProxy<UITabBar, UITabBarDelegate> {\n        RxTabBarDelegateProxy.proxy(for: base)\n    }\n\n    /// Reactive wrapper for `delegate` message `tabBar(_:didSelect:)`.\n    public var didSelectItem: ControlEvent<UITabBarItem> {\n        let source = delegate.methodInvoked(#selector(UITabBarDelegate.tabBar(_:didSelect:)))\n            .map { a in\n                return try castOrThrow(UITabBarItem.self, a[1])\n            }\n\n        return ControlEvent(events: source)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UITabBarController+Rx.swift",
    "content": "//\n//  UITabBarController+Rx.swift\n//  RxCocoa\n//\n//  Created by Yusuke Kita on 2016/12/07.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n    \n/**\n iOS only\n */\n#if os(iOS)\nextension Reactive where Base: UITabBarController {\n    \n    /// Reactive wrapper for `delegate` message `tabBarController:willBeginCustomizing:`.\n    public var willBeginCustomizing: ControlEvent<[UIViewController]> {\n        let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:willBeginCustomizing:)))\n            .map { a in\n                return try castOrThrow([UIViewController].self, a[1])\n        }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `delegate` message `tabBarController:willEndCustomizing:changed:`.\n    public var willEndCustomizing: ControlEvent<(viewControllers: [UIViewController], changed: Bool)> {\n        let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:willEndCustomizing:changed:)))\n            .map { (a: [Any]) -> (viewControllers: [UIViewController], changed: Bool) in\n                let viewControllers = try castOrThrow([UIViewController].self, a[1])\n                let changed = try castOrThrow(Bool.self, a[2])\n                return (viewControllers, changed)\n        }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /// Reactive wrapper for `delegate` message `tabBarController:didEndCustomizing:changed:`.\n    public var didEndCustomizing: ControlEvent<(viewControllers: [UIViewController], changed: Bool)> {\n        let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:didEndCustomizing:changed:)))\n            .map { (a: [Any]) -> (viewControllers: [UIViewController], changed: Bool) in\n                let viewControllers = try castOrThrow([UIViewController].self, a[1])\n                let changed = try castOrThrow(Bool.self, a[2])\n                return (viewControllers, changed)\n        }\n        \n        return ControlEvent(events: source)\n    }\n}\n#endif\n    \n/**\n iOS and tvOS\n */\n\n    extension Reactive where Base: UITabBarController {\n    /// Reactive wrapper for `delegate`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var delegate: DelegateProxy<UITabBarController, UITabBarControllerDelegate> {\n        RxTabBarControllerDelegateProxy.proxy(for: base)\n    }\n    \n    /// Reactive wrapper for `delegate` message `tabBarController:didSelect:`.\n    public var didSelect: ControlEvent<UIViewController> {\n        let source = delegate.methodInvoked(#selector(UITabBarControllerDelegate.tabBarController(_:didSelect:)))\n            .map { a in\n                return try castOrThrow(UIViewController.self, a[1])\n        }\n        \n        return ControlEvent(events: source)\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UITableView+Rx.swift",
    "content": "//\n//  UITableView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 4/2/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n\n// Items\n\nextension Reactive where Base: UITableView {\n\n    /**\n    Binds sequences of elements to table view rows.\n    \n    - parameter source: Observable sequence of items.\n    - parameter cellFactory: Transform between sequence elements and view cells.\n    - returns: Disposable object that can be used to unbind.\n     \n     Example:\n    \n         let items = Observable.just([\n             \"First Item\",\n             \"Second Item\",\n             \"Third Item\"\n         ])\n\n         items\n         .bind(to: tableView.rx.items) { (tableView, row, element) in\n             let cell = tableView.dequeueReusableCell(withIdentifier: \"Cell\")!\n             cell.textLabel?.text = \"\\(element) @ row \\(row)\"\n             return cell\n         }\n         .disposed(by: disposeBag)\n\n     */\n    public func items<Sequence: Swift.Sequence, Source: ObservableType>\n        (_ source: Source)\n        -> (_ cellFactory: @escaping (UITableView, Int, Sequence.Element) -> UITableViewCell)\n        -> Disposable\n        where Source.Element == Sequence {\n            return { cellFactory in\n                let dataSource = RxTableViewReactiveArrayDataSourceSequenceWrapper<Sequence>(cellFactory: cellFactory)\n                return self.items(dataSource: dataSource)(source)\n            }\n    }\n\n    /**\n    Binds sequences of elements to table view rows.\n    \n    - parameter cellIdentifier: Identifier used to dequeue cells.\n    - parameter source: Observable sequence of items.\n    - parameter configureCell: Transform between sequence elements and view cells.\n    - parameter cellType: Type of table view cell.\n    - returns: Disposable object that can be used to unbind.\n     \n     Example:\n\n         let items = Observable.just([\n             \"First Item\",\n             \"Second Item\",\n             \"Third Item\"\n         ])\n\n         items\n             .bind(to: tableView.rx.items(cellIdentifier: \"Cell\", cellType: UITableViewCell.self)) { (row, element, cell) in\n                cell.textLabel?.text = \"\\(element) @ row \\(row)\"\n             }\n             .disposed(by: disposeBag)\n    */\n    public func items<Sequence: Swift.Sequence, Cell: UITableViewCell, Source: ObservableType>\n        (cellIdentifier: String, cellType: Cell.Type = Cell.self)\n        -> (_ source: Source)\n        -> (_ configureCell: @escaping (Int, Sequence.Element, Cell) -> Void)\n        -> Disposable\n        where Source.Element == Sequence {\n        return { source in\n            return { configureCell in\n                let dataSource = RxTableViewReactiveArrayDataSourceSequenceWrapper<Sequence> { tv, i, item in\n                    let indexPath = IndexPath(item: i, section: 0)\n                    let cell = tv.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! Cell\n                    configureCell(i, item, cell)\n                    return cell\n                }\n                return self.items(dataSource: dataSource)(source)\n            }\n        }\n    }\n\n\n    /**\n    Binds sequences of elements to table view rows using a custom reactive data used to perform the transformation.\n    This method will retain the data source for as long as the subscription isn't disposed (result `Disposable` \n    being disposed).\n    In case `source` observable sequence terminates successfully, the data source will present latest element\n    until the subscription isn't disposed.\n    \n    - parameter dataSource: Data source used to transform elements to view cells.\n    - parameter source: Observable sequence of items.\n    - returns: Disposable object that can be used to unbind.\n    */\n    public func items<\n            DataSource: RxTableViewDataSourceType & UITableViewDataSource,\n            Source: ObservableType>\n        (dataSource: DataSource)\n        -> (_ source: Source)\n        -> Disposable\n        where DataSource.Element == Source.Element {\n        return { source in\n            // This is called for side effects only, and to make sure delegate proxy is in place when\n            // data source is being bound.\n            // This is needed because theoretically the data source subscription itself might\n            // call `self.rx.delegate`. If that happens, it might cause weird side effects since\n            // setting data source will set delegate, and UITableView might get into a weird state.\n            // Therefore it's better to set delegate proxy first, just to be sure.\n            _ = self.delegate\n            // Strong reference is needed because data source is in use until result subscription is disposed\n            return source.subscribeProxyDataSource(ofObject: self.base, dataSource: dataSource as UITableViewDataSource, retainDataSource: true) { [weak tableView = self.base] (_: RxTableViewDataSourceProxy, event) -> Void in\n                guard let tableView = tableView else {\n                    return\n                }\n                dataSource.tableView(tableView, observedEvent: event)\n            }\n        }\n    }\n\n}\n\nextension Reactive where Base: UITableView {\n    /**\n    Reactive wrapper for `dataSource`.\n    \n    For more information take a look at `DelegateProxyType` protocol documentation.\n    */\n    public var dataSource: DelegateProxy<UITableView, UITableViewDataSource> {\n        RxTableViewDataSourceProxy.proxy(for: base)\n    }\n   \n    /**\n    Installs data source as forwarding delegate on `rx.dataSource`.\n    Data source won't be retained.\n    \n    It enables using normal delegate mechanism with reactive delegate mechanism.\n     \n    - parameter dataSource: Data source object.\n    - returns: Disposable object that can be used to unbind the data source.\n    */\n    public func setDataSource(_ dataSource: UITableViewDataSource)\n        -> Disposable {\n        RxTableViewDataSourceProxy.installForwardDelegate(dataSource, retainDelegate: false, onProxyForObject: self.base)\n    }\n    \n    // events\n    \n    /**\n    Reactive wrapper for `delegate` message `tableView:didSelectRowAtIndexPath:`.\n    */\n    public var itemSelected: ControlEvent<IndexPath> {\n        let source = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didSelectRowAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /**\n     Reactive wrapper for `delegate` message `tableView:didDeselectRowAtIndexPath:`.\n     */\n    public var itemDeselected: ControlEvent<IndexPath> {\n        let source = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didDeselectRowAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n\n        return ControlEvent(events: source)\n    }\n    \n    /**\n     Reactive wrapper for `delegate` message `tableView:didHighlightRowAt:`.\n     */\n    public var itemHighlighted: ControlEvent<IndexPath> {\n        let source = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didHighlightRowAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /**\n     Reactive wrapper for `delegate` message `tableView:didUnhighlightRowAt:`.\n     */\n    public var itemUnhighlighted: ControlEvent<IndexPath> {\n        let source = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didUnhighlightRowAt:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /**\n     Reactive wrapper for `delegate` message `tableView:accessoryButtonTappedForRowWithIndexPath:`.\n     */\n    public var itemAccessoryButtonTapped: ControlEvent<IndexPath> {\n        let source: Observable<IndexPath> = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:accessoryButtonTappedForRowWith:)))\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[1])\n            }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /**\n    Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`.\n    */\n    public var itemInserted: ControlEvent<IndexPath> {\n        let source = self.dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:commit:forRowAt:)))\n            .filter { a in\n                return UITableViewCell.EditingStyle(rawValue: (try castOrThrow(NSNumber.self, a[1])).intValue) == .insert\n            }\n            .map { a in\n                return (try castOrThrow(IndexPath.self, a[2]))\n        }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /**\n    Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`.\n    */\n    public var itemDeleted: ControlEvent<IndexPath> {\n        let source = self.dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:commit:forRowAt:)))\n            .filter { a in\n                return UITableViewCell.EditingStyle(rawValue: (try castOrThrow(NSNumber.self, a[1])).intValue) == .delete\n            }\n            .map { a in\n                return try castOrThrow(IndexPath.self, a[2])\n            }\n        \n        return ControlEvent(events: source)\n    }\n    \n    /**\n    Reactive wrapper for `delegate` message `tableView:moveRowAtIndexPath:toIndexPath:`.\n    */\n    public var itemMoved: ControlEvent<ItemMovedEvent> {\n        let source: Observable<ItemMovedEvent> = self.dataSource.methodInvoked(#selector(UITableViewDataSource.tableView(_:moveRowAt:to:)))\n            .map { a in\n                return (try castOrThrow(IndexPath.self, a[1]), try castOrThrow(IndexPath.self, a[2]))\n            }\n        \n        return ControlEvent(events: source)\n    }\n\n    /**\n    Reactive wrapper for `delegate` message `tableView:willDisplayCell:forRowAtIndexPath:`.\n    */\n    public var willDisplayCell: ControlEvent<WillDisplayCellEvent> {\n        let source: Observable<WillDisplayCellEvent> = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:willDisplay:forRowAt:)))\n            .map { a in\n                return (try castOrThrow(UITableViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2]))\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /**\n    Reactive wrapper for `delegate` message `tableView:didEndDisplayingCell:forRowAtIndexPath:`.\n    */\n    public var didEndDisplayingCell: ControlEvent<DidEndDisplayingCellEvent> {\n        let source: Observable<DidEndDisplayingCellEvent> = self.delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didEndDisplaying:forRowAt:)))\n            .map { a in\n                return (try castOrThrow(UITableViewCell.self, a[1]), try castOrThrow(IndexPath.self, a[2]))\n            }\n\n        return ControlEvent(events: source)\n    }\n\n    /**\n    Reactive wrapper for `delegate` message `tableView:didSelectRowAtIndexPath:`.\n    \n    It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence,\n    or any other data source conforming to `SectionedViewDataSourceType` protocol.\n    \n     ```\n        tableView.rx.modelSelected(MyModel.self)\n            .map { ...\n     ```\n    */\n    public func modelSelected<T>(_ modelType: T.Type) -> ControlEvent<T> {\n        let source: Observable<T> = self.itemSelected.flatMap { [weak view = self.base as UITableView] indexPath -> Observable<T> in\n            guard let view = view else {\n                return Observable.empty()\n            }\n\n            return Observable.just(try view.rx.model(at: indexPath))\n        }\n        \n        return ControlEvent(events: source)\n    }\n\n    /**\n     Reactive wrapper for `delegate` message `tableView:didDeselectRowAtIndexPath:`.\n\n     It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence,\n     or any other data source conforming to `SectionedViewDataSourceType` protocol.\n\n     ```\n        tableView.rx.modelDeselected(MyModel.self)\n            .map { ...\n     ```\n     */\n    public func modelDeselected<T>(_ modelType: T.Type) -> ControlEvent<T> {\n         let source: Observable<T> = self.itemDeselected.flatMap { [weak view = self.base as UITableView] indexPath -> Observable<T> in\n             guard let view = view else {\n                 return Observable.empty()\n             }\n\n            return Observable.just(try view.rx.model(at: indexPath))\n        }\n\n        return ControlEvent(events: source)\n    }\n    \n    /**\n     Reactive wrapper for `delegate` message `tableView:commitEditingStyle:forRowAtIndexPath:`.\n     \n     It can be only used when one of the `rx.itemsWith*` methods is used to bind observable sequence,\n     or any other data source conforming to `SectionedViewDataSourceType` protocol.\n     \n     ```\n        tableView.rx.modelDeleted(MyModel.self)\n            .map { ...\n     ```\n     */\n    public func modelDeleted<T>(_ modelType: T.Type) -> ControlEvent<T> {\n        let source: Observable<T> = self.itemDeleted.flatMap { [weak view = self.base as UITableView] indexPath -> Observable<T> in\n            guard let view = view else {\n                return Observable.empty()\n            }\n            \n            return Observable.just(try view.rx.model(at: indexPath))\n        }\n        \n        return ControlEvent(events: source)\n    }\n\n    /**\n     Synchronous helper method for retrieving a model at indexPath through a reactive data source.\n     */\n    public func model<T>(at indexPath: IndexPath) throws -> T {\n        let dataSource: SectionedViewDataSourceType = castOrFatalError(self.dataSource.forwardToDelegate(), message: \"This method only works in case one of the `rx.items*` methods was used.\")\n        \n        let element = try dataSource.model(at: indexPath)\n\n        return castOrFatalError(element)\n    }\n}\n\n@available(iOS 10.0, tvOS 10.0, *)\nextension Reactive where Base: UITableView {\n\n    /// Reactive wrapper for `prefetchDataSource`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var prefetchDataSource: DelegateProxy<UITableView, UITableViewDataSourcePrefetching> {\n        RxTableViewDataSourcePrefetchingProxy.proxy(for: base)\n    }\n\n    /**\n     Installs prefetch data source as forwarding delegate on `rx.prefetchDataSource`.\n     Prefetch data source won't be retained.\n\n     It enables using normal delegate mechanism with reactive delegate mechanism.\n\n     - parameter prefetchDataSource: Prefetch data source object.\n     - returns: Disposable object that can be used to unbind the data source.\n     */\n    public func setPrefetchDataSource(_ prefetchDataSource: UITableViewDataSourcePrefetching)\n        -> Disposable {\n            return RxTableViewDataSourcePrefetchingProxy.installForwardDelegate(prefetchDataSource, retainDelegate: false, onProxyForObject: self.base)\n    }\n\n    /// Reactive wrapper for `prefetchDataSource` message `tableView(_:prefetchRowsAt:)`.\n    public var prefetchRows: ControlEvent<[IndexPath]> {\n        let source = RxTableViewDataSourcePrefetchingProxy.proxy(for: base).prefetchRowsPublishSubject\n        return ControlEvent(events: source)\n    }\n\n    /// Reactive wrapper for `prefetchDataSource` message `tableView(_:cancelPrefetchingForRowsAt:)`.\n    public var cancelPrefetchingForRows: ControlEvent<[IndexPath]> {\n        let source = prefetchDataSource.methodInvoked(#selector(UITableViewDataSourcePrefetching.tableView(_:cancelPrefetchingForRowsAt:)))\n            .map { a in\n                return try castOrThrow(Array<IndexPath>.self, a[1])\n        }\n\n        return ControlEvent(events: source)\n    }\n\n}\n#endif\n\n#if os(tvOS)\n    \n    extension Reactive where Base: UITableView {\n        \n        /**\n         Reactive wrapper for `delegate` message `tableView:didUpdateFocusInContext:withAnimationCoordinator:`.\n         */\n        public var didUpdateFocusInContextWithAnimationCoordinator: ControlEvent<(context: UITableViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator)> {\n            \n            let source = delegate.methodInvoked(#selector(UITableViewDelegate.tableView(_:didUpdateFocusIn:with:)))\n                .map { a -> (context: UITableViewFocusUpdateContext, animationCoordinator: UIFocusAnimationCoordinator) in\n                    let context = try castOrThrow(UITableViewFocusUpdateContext.self, a[1])\n                    let animationCoordinator = try castOrThrow(UIFocusAnimationCoordinator.self, a[2])\n                    return (context: context, animationCoordinator: animationCoordinator)\n            }\n            \n            return ControlEvent(events: source)\n        }\n    }\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UITextField+Rx.swift",
    "content": "//\n//  UITextField+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport RxSwift\nimport UIKit\n\nextension Reactive where Base: UITextField {\n    /// Reactive wrapper for `text` property.\n    public var text: ControlProperty<String?> {\n        value\n    }\n    \n    /// Reactive wrapper for `text` property.\n    public var value: ControlProperty<String?> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { textField in\n                textField.text\n            },\n            setter: { textField, value in\n                // This check is important because setting text value always clears control state\n                // including marked text selection which is important for proper input\n                // when IME input method is used.\n                if textField.text != value {\n                    textField.text = value\n                }\n            }\n        )\n    }\n    \n    /// Bindable sink for `attributedText` property.\n    public var attributedText: ControlProperty<NSAttributedString?> {\n        return base.rx.controlPropertyWithDefaultEvents(\n            getter: { textField in\n                textField.attributedText\n            },\n            setter: { textField, value in\n                // This check is important because setting text value always clears control state\n                // including marked text selection which is important for proper input\n                // when IME input method is used.\n                if textField.attributedText != value {\n                    textField.attributedText = value\n                }\n            }\n        )\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/UITextView+Rx.swift",
    "content": "//\n//  UITextView+Rx.swift\n//  RxCocoa\n//\n//  Created by Yuta ToKoRo on 7/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\n\nextension Reactive where Base: UITextView {\n    /// Reactive wrapper for `text` property\n    public var text: ControlProperty<String?> {\n        value\n    }\n    \n    /// Reactive wrapper for `text` property.\n    public var value: ControlProperty<String?> {\n        let source: Observable<String?> = Observable.deferred { [weak textView = self.base] in\n            let text = textView?.text\n            \n            let textChanged = textView?.textStorage\n                // This project uses text storage notifications because\n                // that's the only way to catch autocorrect changes\n                // in all cases. Other suggestions are welcome.\n                .rx.didProcessEditingRangeChangeInLength\n                // This observe on is here because text storage\n                // will emit event while process is not completely done,\n                // so rebinding a value will cause an exception to be thrown.\n                .observe(on:MainScheduler.asyncInstance)\n                .map { _ in\n                    return textView?.textStorage.string\n                }\n                ?? Observable.empty()\n            \n            return textChanged\n                .startWith(text)\n        }\n\n        let bindingObserver = Binder(self.base) { (textView, text: String?) in\n            // This check is important because setting text value always clears control state\n            // including marked text selection which is important for proper input\n            // when IME input method is used.\n            if textView.text != text {\n                textView.text = text\n            }\n        }\n        \n        return ControlProperty(values: source, valueSink: bindingObserver)\n    }\n    \n    \n    /// Reactive wrapper for `attributedText` property.\n    public var attributedText: ControlProperty<NSAttributedString?> {\n        let source: Observable<NSAttributedString?> = Observable.deferred { [weak textView = self.base] in\n            let attributedText = textView?.attributedText\n            \n            let textChanged: Observable<NSAttributedString?> = textView?.textStorage\n                // This project uses text storage notifications because\n                // that's the only way to catch autocorrect changes\n                // in all cases. Other suggestions are welcome.\n                .rx.didProcessEditingRangeChangeInLength\n                // This observe on is here because attributedText storage\n                // will emit event while process is not completely done,\n                // so rebinding a value will cause an exception to be thrown.\n                .observe(on:MainScheduler.asyncInstance)\n                .map { _ in\n                    return textView?.attributedText\n                }\n                ?? Observable.empty()\n            \n            return textChanged\n                .startWith(attributedText)\n        }\n        \n        let bindingObserver = Binder(self.base) { (textView, attributedText: NSAttributedString?) in\n            // This check is important because setting text value always clears control state\n            // including marked text selection which is important for proper input\n            // when IME input method is used.\n            if textView.attributedText != attributedText {\n                textView.attributedText = attributedText\n            }\n        }\n        \n        return ControlProperty(values: source, valueSink: bindingObserver)\n    }\n\n    /// Reactive wrapper for `delegate` message.\n    public var didBeginEditing: ControlEvent<()> {\n       return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidBeginEditing(_:)))\n            .map { _ in\n                return ()\n            })\n    }\n\n    /// Reactive wrapper for `delegate` message.\n    public var didEndEditing: ControlEvent<()> {\n        return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidEndEditing(_:)))\n            .map { _ in\n                return ()\n            })\n    }\n\n    /// Reactive wrapper for `delegate` message.\n    public var didChange: ControlEvent<()> {\n        return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidChange(_:)))\n            .map { _ in\n                return ()\n            })\n    }\n\n    /// Reactive wrapper for `delegate` message.\n    public var didChangeSelection: ControlEvent<()> {\n        return ControlEvent<()>(events: self.delegate.methodInvoked(#selector(UITextViewDelegate.textViewDidChangeSelection(_:)))\n            .map { _ in\n                return ()\n            })\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/iOS/WKWebView+Rx.swift",
    "content": "//\n//  WKWebView+Rx.swift\n//  RxCocoa\n//\n//  Created by Giuseppe Lanza on 14/02/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(iOS) || os(macOS)\n\nimport RxSwift\nimport WebKit\n\n@available(iOS 8.0, OSX 10.10, OSXApplicationExtension 10.10, *)\nextension Reactive where Base: WKWebView {\n    \n    /// Reactive wrapper for `navigationDelegate`.\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var navigationDelegate: DelegateProxy<WKWebView, WKNavigationDelegate> {\n        RxWKNavigationDelegateProxy.proxy(for: base)\n    }\n    \n    /// Reactive wrapper for `navigationDelegate` message.\n    public var didCommit: Observable<WKNavigation> {\n        navigationDelegate\n            .methodInvoked(#selector(WKNavigationDelegate.webView(_:didCommit:)))\n            .map { a in try castOrThrow(WKNavigation.self, a[1]) }\n    }\n    \n    /// Reactive wrapper for `navigationDelegate` message.\n    public var didStartLoad: Observable<WKNavigation> {\n        navigationDelegate\n            .methodInvoked(#selector(WKNavigationDelegate.webView(_:didStartProvisionalNavigation:)))\n            .map { a in try castOrThrow(WKNavigation.self, a[1]) }\n    }\n\n    /// Reactive wrapper for `navigationDelegate` message.\n    public var didFinishLoad: Observable<WKNavigation> {\n        navigationDelegate\n            .methodInvoked(#selector(WKNavigationDelegate.webView(_:didFinish:)))\n            .map { a in try castOrThrow(WKNavigation.self, a[1]) }\n    }\n\n    /// Reactive wrapper for `navigationDelegate` message.\n    public var didFailLoad: Observable<(WKNavigation, Error)> {\n        navigationDelegate\n            .methodInvoked(#selector(WKNavigationDelegate.webView(_:didFail:withError:)))\n            .map { a in\n                (\n                    try castOrThrow(WKNavigation.self, a[1]),\n                    try castOrThrow(Error.self, a[2])\n                )\n            }\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/macOS/NSButton+Rx.swift",
    "content": "//\n//  NSButton+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/17/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS)\n\nimport RxSwift\nimport Cocoa\n\nextension Reactive where Base: NSButton {\n    \n    /// Reactive wrapper for control event.\n    public var tap: ControlEvent<Void> {\n        self.controlEvent\n    }\n    \n    /// Reactive wrapper for `state` property`.\n    public var state: ControlProperty<NSControl.StateValue> {\n        return self.base.rx.controlProperty(\n            getter: { control in\n                return control.state\n            }, setter: { (control: NSButton, state: NSControl.StateValue) in\n                control.state = state\n            }\n        )\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/macOS/NSControl+Rx.swift",
    "content": "//\n//  NSControl+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/31/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS)\n\nimport Cocoa\nimport RxSwift\n\nprivate var rx_value_key: UInt8 = 0\nprivate var rx_control_events_key: UInt8 = 0\n\nextension Reactive where Base: NSControl {\n\n    /// Reactive wrapper for control event.\n    public var controlEvent: ControlEvent<()> {\n        MainScheduler.ensureRunningOnMainThread()\n\n        let source = self.lazyInstanceObservable(&rx_control_events_key) { () -> Observable<Void> in\n            Observable.create { [weak control = self.base] observer in\n                MainScheduler.ensureRunningOnMainThread()\n\n                guard let control = control else {\n                    observer.on(.completed)\n                    return Disposables.create()\n                }\n\n                let observer = ControlTarget(control: control) { _ in\n                    observer.on(.next(()))\n                }\n                \n                return observer\n            }\n            .take(until: self.deallocated)\n\t\t\t.share()\n        }\n\n        return ControlEvent(events: source)\n    }\n\n    /// Creates a `ControlProperty` that is triggered by target/action pattern value updates.\n    ///\n    /// - parameter getter: Property value getter.\n    /// - parameter setter: Property value setter.\n    public func controlProperty<T>(\n        getter: @escaping (Base) -> T,\n        setter: @escaping (Base, T) -> Void\n    ) -> ControlProperty<T> {\n        MainScheduler.ensureRunningOnMainThread()\n\n        let source = self.base.rx.lazyInstanceObservable(&rx_value_key) { () -> Observable<()> in\n                return Observable.create { [weak weakControl = self.base] (observer: AnyObserver<()>) in\n                    guard let control = weakControl else {\n                        observer.on(.completed)\n                        return Disposables.create()\n                    }\n\n                    observer.on(.next(()))\n\n                    let observer = ControlTarget(control: control) { _ in\n                        if weakControl != nil {\n                            observer.on(.next(()))\n                        }\n                    }\n\n                    return observer\n                }\n                .take(until: self.deallocated)\n                .share(replay: 1, scope: .whileConnected)\n            }\n            .flatMap { [weak base] _ -> Observable<T> in\n                guard let control = base else { return Observable.empty() }\n                return Observable.just(getter(control))\n            }\n\n        let bindingObserver = Binder(self.base, binding: setter)\n\n        return ControlProperty(values: source, valueSink: bindingObserver)\n    }\n}\n\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/macOS/NSSlider+Rx.swift",
    "content": "//\n//  NSSlider+Rx.swift\n//  RxCocoa\n//\n//  Created by Junior B. on 24/05/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS)\n\nimport RxSwift\nimport Cocoa\n\nextension Reactive where Base: NSSlider {\n    \n    /// Reactive wrapper for `value` property.\n    public var value: ControlProperty<Double> {\n        return self.base.rx.controlProperty(\n            getter: { control -> Double in\n                return control.doubleValue\n            },\n            setter: { control, value in\n                control.doubleValue = value\n            }\n        )\n    }\n    \n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/macOS/NSTextField+Rx.swift",
    "content": "//\n//  NSTextField+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 5/17/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS)\n\nimport Cocoa\nimport RxSwift\n\n/// Delegate proxy for `NSTextField`.\n///\n/// For more information take a look at `DelegateProxyType`.\nopen class RxTextFieldDelegateProxy\n    : DelegateProxy<NSTextField, NSTextFieldDelegate>\n    , DelegateProxyType \n    , NSTextFieldDelegate {\n\n    /// Typed parent object.\n    public weak private(set) var textField: NSTextField?\n\n    /// Initializes `RxTextFieldDelegateProxy`\n    ///\n    /// - parameter textField: Parent object for delegate proxy.\n    init(textField: NSTextField) {\n        self.textField = textField\n        super.init(parentObject: textField, delegateProxy: RxTextFieldDelegateProxy.self)\n    }\n\n    public static func registerKnownImplementations() {\n        self.register { RxTextFieldDelegateProxy(textField: $0) }\n    }\n\n    fileprivate let textSubject = PublishSubject<String?>()\n\n    // MARK: Delegate methods\n    open func controlTextDidChange(_ notification: Notification) {\n        let textField: NSTextField = castOrFatalError(notification.object)\n        let nextValue = textField.stringValue\n        self.textSubject.on(.next(nextValue))\n        _forwardToDelegate?.controlTextDidChange?(notification)\n    }\n    \n    // MARK: Delegate proxy methods\n\n    /// For more information take a look at `DelegateProxyType`.\n    open class func currentDelegate(for object: ParentObject) -> NSTextFieldDelegate? {\n        object.delegate\n    }\n\n    /// For more information take a look at `DelegateProxyType`.\n    open class func setCurrentDelegate(_ delegate: NSTextFieldDelegate?, to object: ParentObject) {\n        object.delegate = delegate\n    }\n    \n}\n\nextension Reactive where Base: NSTextField {\n\n    /// Reactive wrapper for `delegate`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var delegate: DelegateProxy<NSTextField, NSTextFieldDelegate> {\n        RxTextFieldDelegateProxy.proxy(for: self.base)\n    }\n    \n    /// Reactive wrapper for `text` property.\n    public var text: ControlProperty<String?> {\n        let delegate = RxTextFieldDelegateProxy.proxy(for: self.base)\n        \n        let source = Observable.deferred { [weak textField = self.base] in\n            delegate.textSubject.startWith(textField?.stringValue)\n        }.take(until: self.deallocated)\n\n        let observer = Binder(self.base) { (control, value: String?) in\n            control.stringValue = value ?? \"\"\n        }\n\n        return ControlProperty(values: source, valueSink: observer.asObserver())\n    }\n    \n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/macOS/NSTextView+Rx.swift",
    "content": "//\n//  NSTextView+Rx.swift\n//  RxCocoa\n//\n//  Created by Cee on 8/5/18.\n//  Copyright © 2018 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS)\n\nimport Cocoa\nimport RxSwift\n\n/// Delegate proxy for `NSTextView`.\n///\n/// For more information take a look at `DelegateProxyType`.\nopen class RxTextViewDelegateProxy: DelegateProxy<NSTextView, NSTextViewDelegate>, DelegateProxyType, NSTextViewDelegate {\n\n    #if compiler(>=5.2)\n    /// Typed parent object.\n    /// \n    /// - note: Since Swift 5.2 and Xcode 11.4, Apple have suddenly\n    ///         disallowed using `weak` for NSTextView. For more details\n    ///         see this GitHub Issue: https://git.io/JvSRn\n    public private(set) var textView: NSTextView?\n    #else\n    /// Typed parent object.\n    public weak private(set) var textView: NSTextView?\n    #endif\n\n    /// Initializes `RxTextViewDelegateProxy`\n    ///\n    /// - parameter textView: Parent object for delegate proxy.\n    init(textView: NSTextView) {\n        self.textView = textView\n        super.init(parentObject: textView, delegateProxy: RxTextViewDelegateProxy.self)\n    }\n\n    public static func registerKnownImplementations() {\n        self.register { RxTextViewDelegateProxy(textView: $0) }\n    }\n\n    fileprivate let textSubject = PublishSubject<String>()\n\n    // MARK: Delegate methods\n\n    open func textDidChange(_ notification: Notification) {\n        let textView: NSTextView = castOrFatalError(notification.object)\n        let nextValue = textView.string\n        self.textSubject.on(.next(nextValue))\n        self._forwardToDelegate?.textDidChange?(notification)\n    }\n\n    // MARK: Delegate proxy methods\n\n    /// For more information take a look at `DelegateProxyType`.\n    open class func currentDelegate(for object: ParentObject) -> NSTextViewDelegate? {\n        object.delegate\n    }\n\n    /// For more information take a look at `DelegateProxyType`.\n    open class func setCurrentDelegate(_ delegate: NSTextViewDelegate?, to object: ParentObject) {\n        object.delegate = delegate\n    }\n\n}\n\nextension Reactive where Base: NSTextView {\n\n    /// Reactive wrapper for `delegate`.\n    ///\n    /// For more information take a look at `DelegateProxyType` protocol documentation.\n    public var delegate: DelegateProxy<NSTextView, NSTextViewDelegate> {\n        RxTextViewDelegateProxy.proxy(for: self.base)\n    }\n\n    /// Reactive wrapper for `string` property.\n    public var string: ControlProperty<String> {\n        let delegate = RxTextViewDelegateProxy.proxy(for: self.base)\n\n        let source = Observable.deferred { [weak textView = self.base] in\n            delegate.textSubject.startWith(textView?.string ?? \"\")\n        }.take(until: self.deallocated)\n\n        let observer = Binder(self.base) { control, value in\n            control.string = value\n        }\n\n        return ControlProperty(values: source, valueSink: observer.asObserver())\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa/RxCocoa/macOS/NSView+Rx.swift",
    "content": "//\n//  NSView+Rx.swift\n//  RxCocoa\n//\n//  Created by Krunoslav Zaher on 12/6/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS)\n    import Cocoa\n    import RxSwift\n\n    extension Reactive where Base: NSView {\n        /// Bindable sink for `alphaValue` property.\n        public var alpha: Binder<CGFloat> {\n            return Binder(self.base) { view, value in\n                view.alphaValue = value\n            }\n        }\n    }\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxCocoa.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t098A7E7AEC6AD385CF5A0FB8D79C27AF /* ObservableConvertibleType+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E21BC876BBD95A73D1EC5F17668884C /* ObservableConvertibleType+Driver.swift */; };\n\t\t0A9FE8B6140805209AF83AE31A3D3B6E /* UICollectionView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0C3C2A6E813EF1CA4D4B015C3C04D07 /* UICollectionView+Rx.swift */; };\n\t\t0D7383E630C64114395423715ACCA2E5 /* ControlProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 364B76EDCB5520C0CF711280AFE58D0D /* ControlProperty.swift */; };\n\t\t0E3AF17E3F196488AA3B62DA4B066364 /* RxTabBarControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C425D080D0597579029EC0D51F19DF00 /* RxTabBarControllerDelegateProxy.swift */; };\n\t\t104C4A2E0EC23EDBB767A554F6D4BDCB /* UIActivityIndicatorView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C613FB8772A83708CBFE18F0662884D /* UIActivityIndicatorView+Rx.swift */; };\n\t\t11829AC72691F541D37C1A23E1EE8D1A /* PublishRelay+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F1696842F8126DAFFF7EE21C7238BDE /* PublishRelay+Signal.swift */; };\n\t\t12E43AD74AA0903AB456553B5D1DD056 /* NotificationCenter+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC3B22F521A2DC59774E3F8EFCDEE0A1 /* NotificationCenter+Rx.swift */; };\n\t\t1A3A10A66FDBF09522B7C0F7276B3AC5 /* _RXKVOObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = DEDFA0E387E4A54E10D45D4D817F3963 /* _RXKVOObserver.m */; };\n\t\t1C10D4BE70FE89EC0324B23716FA45E5 /* KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F8FA3820805E40887076EA198C911FF /* KVORepresentable.swift */; };\n\t\t1EEA54B15BC5E6CD7F18AA8EF8924539 /* UIStepper+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 531E900C9C6EDF756BB0587BD3E66D48 /* UIStepper+Rx.swift */; };\n\t\t1FAD000D7AED20DE6556288476BC1955 /* WKWebView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848F1E559C3EB5AEE85C30CEE47E92F7 /* WKWebView+Rx.swift */; };\n\t\t1FE825E92010BE5DDCD0D97CED70A236 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F35E934D8630CDE840A2C882F51752F8 /* RxCollectionViewDataSourcePrefetchingProxy.swift */; };\n\t\t226FB079685A350A7522F6FDB772FC86 /* Observable+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABD8109B80E17857201D7A5F69440810 /* Observable+Bind.swift */; };\n\t\t237497A83B83D8551FD4DCCA2DBA2BCE /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E38136CEABB768390D4C30D6697F86E /* TextInput.swift */; };\n\t\t23AB7E0B2F1F9F0B4604A98829734FDB /* RxNavigationControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C220743F207DB71B5DA783A5D37A0A1 /* RxNavigationControllerDelegateProxy.swift */; };\n\t\t27A7914471BBC1D85B251B95772859EC /* Signal+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519DECE1EAC0267F012AD1445738C0D6 /* Signal+Subscription.swift */; };\n\t\t28CC4ED3D89BB23506B287F8F5BCECD8 /* KVORepresentable+CoreGraphics.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF622DAFEBB22E624B4168E567EA2CAD /* KVORepresentable+CoreGraphics.swift */; };\n\t\t2B3CE62E5D8CCC3E9214740D10E20AAB /* UISwitch+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BB19EDA15250FCB1DA9BB0CAB0C3721 /* UISwitch+Rx.swift */; };\n\t\t2CD803DA7E83C82D290FE98FEEE687B8 /* RxCocoa.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF18C550B17C6FBACF466F5B7841071 /* RxCocoa.swift */; };\n\t\t3252EA71C9B932A7A6620770F5056F50 /* _RXObjCRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = 03DCE6BFF4FC3E84051394961B87F5F2 /* _RXObjCRuntime.m */; };\n\t\t33AE29CCD4F54BC43937521134A12BAC /* NSView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7F2F0FF7B85FF1F26D58EADD67F0ECD /* NSView+Rx.swift */; };\n\t\t342DEFDAF94AF1FC29BF33F4651A18E2 /* NSObject+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E06E293B1F7E2E1E3CD617B5BF5C0A5F /* NSObject+Rx.swift */; };\n\t\t34B59D20C08209AA4BE18CA222723515 /* RxCocoaRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 0DEDB5AB3CD0EB4A98D3B8B4C7E1A0FB /* RxCocoaRuntime.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t381853F4D9C66B4FC877241753B77369 /* RxTableViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D844436D5AF4452273B8A6BA3FCDF06C /* RxTableViewDataSourceType.swift */; };\n\t\t3936A1BCFFCDB03BE54CAAE0D33A6659 /* RxTextStorageDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D6AFB2824027E4237941DA2B22ADBA4 /* RxTextStorageDelegateProxy.swift */; };\n\t\t3F2A44ED7330BA5E28225DA7D48529FD /* NSSlider+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F5872C5E8D07CECF1A4BBF15CA45385 /* NSSlider+Rx.swift */; };\n\t\t41C1AD8E7712BB584CB989ABFBEF6BF2 /* RxTableViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 418F4B3851F74B10CEF9AC009087B6C9 /* RxTableViewDelegateProxy.swift */; };\n\t\t41CFFA76A5135FF4625D2E83CDA490D0 /* RxScrollViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664622FC7ADCA72F0188296E5537FD1A /* RxScrollViewDelegateProxy.swift */; };\n\t\t434B3976E3B3FC68F8A405A2ACCAEB3F /* RxCollectionViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48E833FFD59608576FC073396E1D62A /* RxCollectionViewDataSourceProxy.swift */; };\n\t\t4A92C2186902E5B4A9BA5B268CEDC80A /* NSTextView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28093455FDEDA9AA6D5053A875A18CB9 /* NSTextView+Rx.swift */; };\n\t\t4F89F7E3A2286DB442688011E556D93B /* ControlEvent+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 002DFBB49F24FB32815F1779DC131C18 /* ControlEvent+Signal.swift */; };\n\t\t51B2FF394C94C6D6688CC055A546811D /* UIDatePicker+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDC3176741A679B0CC60C74A031F7AE8 /* UIDatePicker+Rx.swift */; };\n\t\t5239D3EE3DDD3BC875FE100C4A83A1A5 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D41DEB883AE5CAD6354F7DD5012C234 /* RxCocoaObjCRuntimeError+Extensions.swift */; };\n\t\t5274CF9FA22FC8DA1FC5AECFCE0847A5 /* RxWKNavigationDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31D389EEC4E01BCB0880E351F5705832 /* RxWKNavigationDelegateProxy.swift */; };\n\t\t56962A5B70E43CC0D3219B7FBCD1DC88 /* ControlTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B516B9479F21A0B64D3D1C011E4F007 /* ControlTarget.swift */; };\n\t\t5778FB7C831F04053D46B6FEC03CE4D2 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = C39B9734D96B948154C3D494FA0388A4 /* Platform.Darwin.swift */; };\n\t\t58383C193D1A398E965E3EF654586DB0 /* SectionedViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A189D909EA9E19138D228488FC2D42D /* SectionedViewDataSourceType.swift */; };\n\t\t58A0BA435F851165449E98CA422FA05E /* SharedSequence+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49F491FDB7F0E421975C083447433964 /* SharedSequence+Operators.swift */; };\n\t\t5A154D2ECAEFB42367BE0C0DDC87CF26 /* NSTextStorage+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F910B81C7E63912873F4A0CB790557C /* NSTextStorage+Rx.swift */; };\n\t\t5CE91A95754610E4A2BFE209EB19655A /* Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = D53333A480DFFD4501326625E9BDD166 /* Signal.swift */; };\n\t\t5DECCA3CB0C27DD1C88182731DA7FCD1 /* Driver+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B40407506F8044F716981DBD7B8E42 /* Driver+Subscription.swift */; };\n\t\t605192772D1262EAB3805CB53A090FF4 /* RxTextViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A5BBDABEB49C515059594CBEDC6E03 /* RxTextViewDelegateProxy.swift */; };\n\t\t607B3B2367464B8EA3A3C129F9BC9468 /* RxCocoa-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = FAD8268E6FA199796F9CED85C6624B82 /* RxCocoa-dummy.m */; };\n\t\t60A953C8972283706C082AC42947B043 /* RxPickerViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 160361F87DBC37A623A47DCDFD551051 /* RxPickerViewDataSourceType.swift */; };\n\t\t60D9FA5934ECE047A78B009B4888CF2E /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 064483EEE715AA1F53F6516AB100D7F0 /* RxTableViewDataSourcePrefetchingProxy.swift */; };\n\t\t6234FE7ABB908DE1D812CA427861A9C8 /* _RX.h in Headers */ = {isa = PBXBuildFile; fileRef = D61A7E9765A1E785BBB9D6457FFD21BB /* _RX.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6264AC44995FE0034C5DFA936FF52CE6 /* NSObject+Rx+RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE5274DDB216BCF5961D86E4257DEC1D /* NSObject+Rx+RawRepresentable.swift */; };\n\t\t647650CB9D07A93E652BA2A36BC98ED3 /* _RXDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 45C1493C3A5D8FEDFDF3CCD4AB6E51D7 /* _RXDelegateProxy.m */; };\n\t\t65415D025EF91EAC5D577949B9BBF972 /* DelegateProxyType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A03F4B96AFF29858BC629A8B090AF5F /* DelegateProxyType.swift */; };\n\t\t666CF8DCC50F87DC5EA2A002F3090744 /* UIButton+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D4561C808ADF530A19D9A9B103112FD /* UIButton+Rx.swift */; };\n\t\t6E0C2A2B9AD3209FB63014447F03605C /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2ECEDC46A3E62964188CCF3C40F65F9E /* Queue.swift */; };\n\t\t6EE5697BB276A22553C7E15791D4E63E /* BehaviorRelay+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2ADF1BD6894EF0BE74BE76DDC9ACBDA /* BehaviorRelay+Driver.swift */; };\n\t\t780A538787419596D0E84C16733D8F5B /* _RXObjCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DB7F55D959F20D25DD4C487EFC07F72 /* _RXObjCRuntime.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7890261401D11E41D489E7482DBF27D3 /* RxCocoa-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = CC4B95EB13B3EBEB41456A72C0BB2467 /* RxCocoa-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t798D7D484A939598FDF66594BFA7D093 /* RxCollectionViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46BF695D0C14E8B8995BF9104A32852A /* RxCollectionViewReactiveArrayDataSource.swift */; };\n\t\t7B174FB45E0D3D1E40E0DF4690CB567A /* Infallible+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39945FB894651B6D6CEE5B5CCAAB39B6 /* Infallible+Bind.swift */; };\n\t\t7B63B576043243A784D88F7B3F4980AA /* UIScrollView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1CC66C39B05567BA11DEC2FE46A3C /* UIScrollView+Rx.swift */; };\n\t\t810634A222994C7706F54EB4E230AA77 /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB095AD6C8E6A1B417AF4068D21CE94D /* UIRefreshControl+Rx.swift */; };\n\t\t84C5FB7908E9B5BC31D1CDD7B0055805 /* UIPickerView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 419D52CCFA192A27DB66AD5331BD53C1 /* UIPickerView+Rx.swift */; };\n\t\t881222EC54152E2C917B423BA4F05B4A /* UISearchBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 199341CFC396D4182CDEA0352FBA0001 /* UISearchBar+Rx.swift */; };\n\t\t8920F6CDD4B32D5FD864B1BD114E99C5 /* SharedSequence+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A1602013F4297A124AB8D6C252987EE /* SharedSequence+Concurrency.swift */; };\n\t\t8A8CAA4924CBEB16B47B0C21BB10F623 /* UIApplication+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1F54EDF8F559354284407AE8B231E4F /* UIApplication+Rx.swift */; };\n\t\t8B462AD8B0FF3AD90F432B4F3236E34C /* NSTextField+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8331A4F50B27E9830F697D6EB50A099C /* NSTextField+Rx.swift */; };\n\t\t8E51BF06D1533DD52DDC610CD7522C44 /* SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5BA09836FD1C6B89C5F8F649426AE81 /* SharedSequence.swift */; };\n\t\t900AD968BCEE5F2F560F1DECBEA60E77 /* NSControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E11BF10DFB0DAAC7E666F5D52735373 /* NSControl+Rx.swift */; };\n\t\t920D988553573899A3531BB5A924F059 /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54B6DB006DDCBCA6D9A9FD6BDD03ED16 /* DispatchQueue+Extensions.swift */; };\n\t\t9CBE76516E6A66842938813791692F8D /* SharedSequence+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFCED2D97BAF3C4B699DD3A0C9287D92 /* SharedSequence+Operators+arity.swift */; };\n\t\tA6C4D383F553AF4A6C535AA1E948E16C /* RxTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAD3185464CAFF993AD6D374FC8C227C /* RxTarget.swift */; };\n\t\tA7A6FAD8807FE23F758FE42188BE2CC4 /* _RX.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B76D72DD56052E44CEFE0B3AA89D935 /* _RX.m */; };\n\t\tA85FB63BBE89ED14C5C79525503E19D2 /* ObservableConvertibleType+Signal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 435AEB2A0B5B2F6DAAF62CBCB1AC1CA5 /* ObservableConvertibleType+Signal.swift */; };\n\t\tAAEF72AB3F54C300BE8A0E38B3EDD165 /* RxCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 682547DE5125E9609B59C399B1E6B860 /* RxCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tACFDAD9114D6CE2C55EBE8426596EE03 /* UITextField+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0725D3878B41FCB41B109CE751E1DBAE /* UITextField+Rx.swift */; };\n\t\tAE968A1E6D48CBA335CA1A6E979F112A /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA6D6085B836402880B91BCC16B290E1 /* Platform.Linux.swift */; };\n\t\tB17237829E251D14EB3961E3D4111D26 /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 642329CE16BB5D97FF83D8A8DC7E7899 /* PriorityQueue.swift */; };\n\t\tB2C23D0F3CE1CFA87F382088A313D8B7 /* UITableView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FFF141041D1685F1C9404791CDA4C3 /* UITableView+Rx.swift */; };\n\t\tB51FB88512FC3402BECBB139D70DA558 /* RxTabBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D57C0432CC83B41777EB7DF59040003A /* RxTabBarDelegateProxy.swift */; };\n\t\tB580A3541C6CA867B7139B900EF9F75B /* ItemEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4823EAF482A906EAEA94EF6579A8D682 /* ItemEvents.swift */; };\n\t\tB8F4EC2BFB70D9447D321CEF6626CE30 /* UITabBarController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC05DA808CF63858796C3557E883FBE2 /* UITabBarController+Rx.swift */; };\n\t\tBABD8E634362EE8DF08ED2E16E85E122 /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5710FCD7A158BC8E8C6A852C2974BE8 /* InfiniteSequence.swift */; };\n\t\tBE891F57CB396F57AE5F8E5EC8B5DCEA /* UINavigationController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9008D761B0B91DEE6FB43DCA293C6FE /* UINavigationController+Rx.swift */; };\n\t\tBE9FDA452BDAD32EC3B6235C21DA652C /* NSButton+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E969FEA40002C8156106DDEAD17D8FE0 /* NSButton+Rx.swift */; };\n\t\tBF97E194A860C80412D21C0F058B9B8B /* RxPickerViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 427C577BD2573F07758287D082600505 /* RxPickerViewDelegateProxy.swift */; };\n\t\tC00A1498C51F71DB962DD96A8DAEADDF /* UITextView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B6C8E9CB55596433FE8E363E97628BD /* UITextView+Rx.swift */; };\n\t\tC1A7217E02B3A958E081EAB51F824577 /* UIBarButtonItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C48F713F8C3FA312E772280EC6AAF9A /* UIBarButtonItem+Rx.swift */; };\n\t\tC1AB3FB67E9B02A6D0E71212BF83E22E /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0A82E54E00A2DBB8FDE2F9525F0E0C7 /* Bag.swift */; };\n\t\tCA7AD2946482A548E39CA56E04FDC743 /* UIGestureRecognizer+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21298B0D540B9CB92F0C3DEBD33B016B /* UIGestureRecognizer+Rx.swift */; };\n\t\tCF833DDB131A18936EC27CFFF43D1102 /* _RXKVOObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 63736DB5341B4E027C44BAEFF63790B5 /* _RXKVOObserver.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCFE47AF2009EB38458461514FB0EA80D /* URLSession+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0160F85C822771F39C19B748C52FB70 /* URLSession+Rx.swift */; };\n\t\tD3ECD252F47B0B568380545AB3315BFD /* UIControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C397DCC6A23E6AFBC349ABFEE20D8210 /* UIControl+Rx.swift */; };\n\t\tD4C17E628FA568CB8C0AFF6C071E1A46 /* ObservableConvertibleType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = A955B40E10C4A2CC03056F178EBF471F /* ObservableConvertibleType+SharedSequence.swift */; };\n\t\tD53DFBA3A74839F6F6CA09D1E2A38AEF /* UISearchController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F6A164298AD5E5E27AC9AE27BC6CA30 /* UISearchController+Rx.swift */; };\n\t\tD55339C30DC44456301E17FADC3BFEE4 /* NSObject+Rx+KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A56E2AE05C83A12A3AA5767567AB81F /* NSObject+Rx+KVORepresentable.swift */; };\n\t\tD573349235F40BF450B7EFFED85A339E /* RxPickerViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB1379A7CB1CF86817672243D4D703F2 /* RxPickerViewDataSourceProxy.swift */; };\n\t\tD78C66D3E918EDAA8FB5F78ECA2855EE /* RxCollectionViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE1A28ADD74DE82E6DB496EF57DB900 /* RxCollectionViewDelegateProxy.swift */; };\n\t\tDB9E212AEFC7DACF8049A37761258191 /* RxCollectionViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98F3E7D5B2B2FF8F63550E9D4F191E4 /* RxCollectionViewDataSourceType.swift */; };\n\t\tDE46057EDAAA20C49528797F2DDAD2D5 /* UITabBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD69E9E256BF488F303ADBBB67722394 /* UITabBar+Rx.swift */; };\n\t\tDF0F55E4FD7E166EE7CF403791853F75 /* SchedulerType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 118A6499476B7A7590891826623777F7 /* SchedulerType+SharedSequence.swift */; };\n\t\tE07AB03B47E4D40F97533A356F1675BE /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E23ACB29FD0FE6D7D106E295629070D4 /* RecursiveLock.swift */; };\n\t\tE14154C07AF7A39E264BC3B3EFD733CE /* KVORepresentable+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29DBA2166BAA4EC8BB5AB8F711CC5444 /* KVORepresentable+Swift.swift */; };\n\t\tE2E71C3F1C12D2802B7FEC8E2CBFD3F4 /* UISlider+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EBDED56BB6BB2CD023E58D505E36020 /* UISlider+Rx.swift */; };\n\t\tE4AF4B810C37B0A44DB48E8E472FA9B9 /* RxSearchControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAEE11976EFF2FA8C6C9451A10C69626 /* RxSearchControllerDelegateProxy.swift */; };\n\t\tE7EEF5D1E774B075FA2F6ECD002AB132 /* RxPickerViewAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 029F591961A328578AD2F9BD8F332452 /* RxPickerViewAdapter.swift */; };\n\t\tED71233AE263ADAB4695DEEE5E5FD0B2 /* RxTableViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A9554911A17B58C5ECC56B07E92F260 /* RxTableViewDataSourceProxy.swift */; };\n\t\tEEA18CC5BFD9765A32B4857C1463DD2A /* _RXDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 32925EFF911A8E65BCE578CD3299DA32 /* _RXDelegateProxy.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF1A4496340CA70A2E1F78812B253F059 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7ED23069B43EDF96192D3FB8B679306 /* Foundation.framework */; };\n\t\tF2E24C1A4ADFC8EB439A52429A813EC6 /* ControlEvent+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FABEC166FCD2446B0A67318C6514007 /* ControlEvent+Driver.swift */; };\n\t\tF59650BAB5B15DCA84C5A18D012D2A96 /* RxTableViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D25B52211A53D8D4EABDF123365709FD /* RxTableViewReactiveArrayDataSource.swift */; };\n\t\tF64781CDBF7D029AB322BF643522ED09 /* Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8CEA274E713D9A7EF90A08C93BBC999 /* Driver.swift */; };\n\t\tF6850C0AC55C3AB12EF44EFF135E604F /* RxSearchBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = E795BF02AF222B9D68D5E733EC29F028 /* RxSearchBarDelegateProxy.swift */; };\n\t\tF765EC6C8B3CF42BE713A1AE101BBFF0 /* UISegmentedControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E9361181FD3DA8B4B15F01EF23DA8EB /* UISegmentedControl+Rx.swift */; };\n\t\tFA8F9FC104EDDCD9A0C9C5CD129A37EF /* ControlProperty+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F10A6C30715483935DB493E75BFD2571 /* ControlProperty+Driver.swift */; };\n\t\tFBEC656E28425F77C5BA0CC5B8DD25BE /* DelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2E4CB5B55FDD57BEC362A034CA25D87 /* DelegateProxy.swift */; };\n\t\tFFAAD7E296C63EF8E8CF0A6BEA125298 /* ControlEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AE39D31B3302D7BE844917ACE4B2F39 /* ControlEvent.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t1A3FDE601F76A95F98A9A45A56E6C6BB /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = E190A0F56A6754915E4B6306E4B5826A /* RxSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = F0179EE061353B7A322F596E97844774;\n\t\t\tremoteInfo = RxSwift;\n\t\t};\n\t\t55C2E4D31EBDBBE38DCC9FD538A9C78A /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 5829B97DAB1D9A2C7BBEA71AC48E4228 /* RxRelay.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 564FA919E05BFD512DA9163BAB640EEE;\n\t\t\tremoteInfo = RxRelay;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t002DFBB49F24FB32815F1779DC131C18 /* ControlEvent+Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ControlEvent+Signal.swift\"; path = \"RxCocoa/Traits/Signal/ControlEvent+Signal.swift\"; sourceTree = \"<group>\"; };\n\t\t029F591961A328578AD2F9BD8F332452 /* RxPickerViewAdapter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewAdapter.swift; path = RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift; sourceTree = \"<group>\"; };\n\t\t03DCE6BFF4FC3E84051394961B87F5F2 /* _RXObjCRuntime.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXObjCRuntime.m; path = RxCocoa/Runtime/_RXObjCRuntime.m; sourceTree = \"<group>\"; };\n\t\t064483EEE715AA1F53F6516AB100D7F0 /* RxTableViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDataSourcePrefetchingProxy.swift; path = RxCocoa/iOS/Proxies/RxTableViewDataSourcePrefetchingProxy.swift; sourceTree = \"<group>\"; };\n\t\t0725D3878B41FCB41B109CE751E1DBAE /* UITextField+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITextField+Rx.swift\"; path = \"RxCocoa/iOS/UITextField+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t0DEDB5AB3CD0EB4A98D3B8B4C7E1A0FB /* RxCocoaRuntime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RxCocoaRuntime.h; path = RxCocoa/Runtime/include/RxCocoaRuntime.h; sourceTree = \"<group>\"; };\n\t\t0E21BC876BBD95A73D1EC5F17668884C /* ObservableConvertibleType+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ObservableConvertibleType+Driver.swift\"; path = \"RxCocoa/Traits/Driver/ObservableConvertibleType+Driver.swift\"; sourceTree = \"<group>\"; };\n\t\t0EBDED56BB6BB2CD023E58D505E36020 /* UISlider+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISlider+Rx.swift\"; path = \"RxCocoa/iOS/UISlider+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t10FFF141041D1685F1C9404791CDA4C3 /* UITableView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITableView+Rx.swift\"; path = \"RxCocoa/iOS/UITableView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t118A6499476B7A7590891826623777F7 /* SchedulerType+SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"SchedulerType+SharedSequence.swift\"; path = \"RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift\"; sourceTree = \"<group>\"; };\n\t\t160361F87DBC37A623A47DCDFD551051 /* RxPickerViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift; sourceTree = \"<group>\"; };\n\t\t199341CFC396D4182CDEA0352FBA0001 /* UISearchBar+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISearchBar+Rx.swift\"; path = \"RxCocoa/iOS/UISearchBar+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t1AE39D31B3302D7BE844917ACE4B2F39 /* ControlEvent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlEvent.swift; path = RxCocoa/Traits/ControlEvent.swift; sourceTree = \"<group>\"; };\n\t\t1CF18C550B17C6FBACF466F5B7841071 /* RxCocoa.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCocoa.swift; path = RxCocoa/RxCocoa.swift; sourceTree = \"<group>\"; };\n\t\t1D41DEB883AE5CAD6354F7DD5012C234 /* RxCocoaObjCRuntimeError+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"RxCocoaObjCRuntimeError+Extensions.swift\"; path = \"RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t1FABEC166FCD2446B0A67318C6514007 /* ControlEvent+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ControlEvent+Driver.swift\"; path = \"RxCocoa/Traits/Driver/ControlEvent+Driver.swift\"; sourceTree = \"<group>\"; };\n\t\t21298B0D540B9CB92F0C3DEBD33B016B /* UIGestureRecognizer+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIGestureRecognizer+Rx.swift\"; path = \"RxCocoa/iOS/UIGestureRecognizer+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t28093455FDEDA9AA6D5053A875A18CB9 /* NSTextView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSTextView+Rx.swift\"; path = \"RxCocoa/macOS/NSTextView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t29DBA2166BAA4EC8BB5AB8F711CC5444 /* KVORepresentable+Swift.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"KVORepresentable+Swift.swift\"; path = \"RxCocoa/Foundation/KVORepresentable+Swift.swift\"; sourceTree = \"<group>\"; };\n\t\t2ECEDC46A3E62964188CCF3C40F65F9E /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = \"<group>\"; };\n\t\t31D389EEC4E01BCB0880E351F5705832 /* RxWKNavigationDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxWKNavigationDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxWKNavigationDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t32925EFF911A8E65BCE578CD3299DA32 /* _RXDelegateProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXDelegateProxy.h; path = RxCocoa/Runtime/include/_RXDelegateProxy.h; sourceTree = \"<group>\"; };\n\t\t364B76EDCB5520C0CF711280AFE58D0D /* ControlProperty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlProperty.swift; path = RxCocoa/Traits/ControlProperty.swift; sourceTree = \"<group>\"; };\n\t\t39945FB894651B6D6CEE5B5CCAAB39B6 /* Infallible+Bind.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Infallible+Bind.swift\"; path = \"RxCocoa/Common/Infallible+Bind.swift\"; sourceTree = \"<group>\"; };\n\t\t3A1602013F4297A124AB8D6C252987EE /* SharedSequence+Concurrency.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"SharedSequence+Concurrency.swift\"; path = \"RxCocoa/Traits/SharedSequence/SharedSequence+Concurrency.swift\"; sourceTree = \"<group>\"; };\n\t\t3A56E2AE05C83A12A3AA5767567AB81F /* NSObject+Rx+KVORepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSObject+Rx+KVORepresentable.swift\"; path = \"RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift\"; sourceTree = \"<group>\"; };\n\t\t3B6C8E9CB55596433FE8E363E97628BD /* UITextView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITextView+Rx.swift\"; path = \"RxCocoa/iOS/UITextView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t3BB19EDA15250FCB1DA9BB0CAB0C3721 /* UISwitch+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISwitch+Rx.swift\"; path = \"RxCocoa/iOS/UISwitch+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t3F8FA3820805E40887076EA198C911FF /* KVORepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KVORepresentable.swift; path = RxCocoa/Foundation/KVORepresentable.swift; sourceTree = \"<group>\"; };\n\t\t418F4B3851F74B10CEF9AC009087B6C9 /* RxTableViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t419D52CCFA192A27DB66AD5331BD53C1 /* UIPickerView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIPickerView+Rx.swift\"; path = \"RxCocoa/iOS/UIPickerView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t427C577BD2573F07758287D082600505 /* RxPickerViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t435AEB2A0B5B2F6DAAF62CBCB1AC1CA5 /* ObservableConvertibleType+Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ObservableConvertibleType+Signal.swift\"; path = \"RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift\"; sourceTree = \"<group>\"; };\n\t\t45C1493C3A5D8FEDFDF3CCD4AB6E51D7 /* _RXDelegateProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXDelegateProxy.m; path = RxCocoa/Runtime/_RXDelegateProxy.m; sourceTree = \"<group>\"; };\n\t\t46BF695D0C14E8B8995BF9104A32852A /* RxCollectionViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewReactiveArrayDataSource.swift; path = RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift; sourceTree = \"<group>\"; };\n\t\t4823EAF482A906EAEA94EF6579A8D682 /* ItemEvents.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ItemEvents.swift; path = RxCocoa/iOS/Events/ItemEvents.swift; sourceTree = \"<group>\"; };\n\t\t49F491FDB7F0E421975C083447433964 /* SharedSequence+Operators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"SharedSequence+Operators.swift\"; path = \"RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift\"; sourceTree = \"<group>\"; };\n\t\t4C220743F207DB71B5DA783A5D37A0A1 /* RxNavigationControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxNavigationControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxNavigationControllerDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t4D4561C808ADF530A19D9A9B103112FD /* UIButton+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIButton+Rx.swift\"; path = \"RxCocoa/iOS/UIButton+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t4F6A164298AD5E5E27AC9AE27BC6CA30 /* UISearchController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISearchController+Rx.swift\"; path = \"RxCocoa/iOS/UISearchController+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t519DECE1EAC0267F012AD1445738C0D6 /* Signal+Subscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Signal+Subscription.swift\"; path = \"RxCocoa/Traits/Signal/Signal+Subscription.swift\"; sourceTree = \"<group>\"; };\n\t\t531E900C9C6EDF756BB0587BD3E66D48 /* UIStepper+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIStepper+Rx.swift\"; path = \"RxCocoa/iOS/UIStepper+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t546FC66ECA46E6D8B26DE8D7B529667C /* RxCocoa.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxCocoa.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t54B6DB006DDCBCA6D9A9FD6BDD03ED16 /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DispatchQueue+Extensions.swift\"; path = \"Platform/DispatchQueue+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t5829B97DAB1D9A2C7BBEA71AC48E4228 /* RxRelay */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxRelay; path = RxRelay.xcodeproj; sourceTree = \"<group>\"; };\n\t\t5B76D72DD56052E44CEFE0B3AA89D935 /* _RX.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RX.m; path = RxCocoa/Runtime/_RX.m; sourceTree = \"<group>\"; };\n\t\t5C79F9EACD23B1AF09974E693F7CD6EA /* RxCocoa.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = RxCocoa.modulemap; sourceTree = \"<group>\"; };\n\t\t5E9361181FD3DA8B4B15F01EF23DA8EB /* UISegmentedControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISegmentedControl+Rx.swift\"; path = \"RxCocoa/iOS/UISegmentedControl+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t5ED1CC66C39B05567BA11DEC2FE46A3C /* UIScrollView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIScrollView+Rx.swift\"; path = \"RxCocoa/iOS/UIScrollView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t5F5872C5E8D07CECF1A4BBF15CA45385 /* NSSlider+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSSlider+Rx.swift\"; path = \"RxCocoa/macOS/NSSlider+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t5F910B81C7E63912873F4A0CB790557C /* NSTextStorage+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSTextStorage+Rx.swift\"; path = \"RxCocoa/iOS/NSTextStorage+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t63736DB5341B4E027C44BAEFF63790B5 /* _RXKVOObserver.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXKVOObserver.h; path = RxCocoa/Runtime/include/_RXKVOObserver.h; sourceTree = \"<group>\"; };\n\t\t642329CE16BB5D97FF83D8A8DC7E7899 /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = \"<group>\"; };\n\t\t664622FC7ADCA72F0188296E5537FD1A /* RxScrollViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxScrollViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t682547DE5125E9609B59C399B1E6B860 /* RxCocoa.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RxCocoa.h; path = RxCocoa/RxCocoa.h; sourceTree = \"<group>\"; };\n\t\t6A03F4B96AFF29858BC629A8B090AF5F /* DelegateProxyType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelegateProxyType.swift; path = RxCocoa/Common/DelegateProxyType.swift; sourceTree = \"<group>\"; };\n\t\t6A189D909EA9E19138D228488FC2D42D /* SectionedViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SectionedViewDataSourceType.swift; path = RxCocoa/Common/SectionedViewDataSourceType.swift; sourceTree = \"<group>\"; };\n\t\t6A9554911A17B58C5ECC56B07E92F260 /* RxTableViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift; sourceTree = \"<group>\"; };\n\t\t7AE1A28ADD74DE82E6DB496EF57DB900 /* RxCollectionViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t7B516B9479F21A0B64D3D1C011E4F007 /* ControlTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlTarget.swift; path = RxCocoa/Common/ControlTarget.swift; sourceTree = \"<group>\"; };\n\t\t7DB7F55D959F20D25DD4C487EFC07F72 /* _RXObjCRuntime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXObjCRuntime.h; path = RxCocoa/Runtime/include/_RXObjCRuntime.h; sourceTree = \"<group>\"; };\n\t\t8331A4F50B27E9830F697D6EB50A099C /* NSTextField+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSTextField+Rx.swift\"; path = \"RxCocoa/macOS/NSTextField+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t848F1E559C3EB5AEE85C30CEE47E92F7 /* WKWebView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"WKWebView+Rx.swift\"; path = \"RxCocoa/iOS/WKWebView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t85A5BBDABEB49C515059594CBEDC6E03 /* RxTextViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTextViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t8C48F713F8C3FA312E772280EC6AAF9A /* UIBarButtonItem+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIBarButtonItem+Rx.swift\"; path = \"RxCocoa/iOS/UIBarButtonItem+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t8D6AFB2824027E4237941DA2B22ADBA4 /* RxTextStorageDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTextStorageDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\t8E38136CEABB768390D4C30D6697F86E /* TextInput.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextInput.swift; path = RxCocoa/Common/TextInput.swift; sourceTree = \"<group>\"; };\n\t\t9C613FB8772A83708CBFE18F0662884D /* UIActivityIndicatorView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIActivityIndicatorView+Rx.swift\"; path = \"RxCocoa/iOS/UIActivityIndicatorView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t9E11BF10DFB0DAAC7E666F5D52735373 /* NSControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSControl+Rx.swift\"; path = \"RxCocoa/macOS/NSControl+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t9F1696842F8126DAFFF7EE21C7238BDE /* PublishRelay+Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"PublishRelay+Signal.swift\"; path = \"RxCocoa/Traits/Signal/PublishRelay+Signal.swift\"; sourceTree = \"<group>\"; };\n\t\tA0160F85C822771F39C19B748C52FB70 /* URLSession+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"URLSession+Rx.swift\"; path = \"RxCocoa/Foundation/URLSession+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tA1B40407506F8044F716981DBD7B8E42 /* Driver+Subscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Driver+Subscription.swift\"; path = \"RxCocoa/Traits/Driver/Driver+Subscription.swift\"; sourceTree = \"<group>\"; };\n\t\tA5BA09836FD1C6B89C5F8F649426AE81 /* SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SharedSequence.swift; path = RxCocoa/Traits/SharedSequence/SharedSequence.swift; sourceTree = \"<group>\"; };\n\t\tA9008D761B0B91DEE6FB43DCA293C6FE /* UINavigationController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UINavigationController+Rx.swift\"; path = \"RxCocoa/iOS/UINavigationController+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tA955B40E10C4A2CC03056F178EBF471F /* ObservableConvertibleType+SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ObservableConvertibleType+SharedSequence.swift\"; path = \"RxCocoa/Traits/SharedSequence/ObservableConvertibleType+SharedSequence.swift\"; sourceTree = \"<group>\"; };\n\t\tAAD3185464CAFF993AD6D374FC8C227C /* RxTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTarget.swift; path = RxCocoa/Common/RxTarget.swift; sourceTree = \"<group>\"; };\n\t\tABD8109B80E17857201D7A5F69440810 /* Observable+Bind.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Observable+Bind.swift\"; path = \"RxCocoa/Common/Observable+Bind.swift\"; sourceTree = \"<group>\"; };\n\t\tAC05DA808CF63858796C3557E883FBE2 /* UITabBarController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITabBarController+Rx.swift\"; path = \"RxCocoa/iOS/UITabBarController+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tAC85B53F47EEFA85FBD54111AD218FFE /* RxCocoa.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxCocoa.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tB5710FCD7A158BC8E8C6A852C2974BE8 /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = \"<group>\"; };\n\t\tB8CEA274E713D9A7EF90A08C93BBC999 /* Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Driver.swift; path = RxCocoa/Traits/Driver/Driver.swift; sourceTree = \"<group>\"; };\n\t\tBAEE11976EFF2FA8C6C9451A10C69626 /* RxSearchControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxSearchControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\tBB095AD6C8E6A1B417AF4068D21CE94D /* UIRefreshControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIRefreshControl+Rx.swift\"; path = \"RxCocoa/iOS/UIRefreshControl+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tBC3B22F521A2DC59774E3F8EFCDEE0A1 /* NotificationCenter+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NotificationCenter+Rx.swift\"; path = \"RxCocoa/Foundation/NotificationCenter+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tC00ED7A94C67870E506FB3DEB1E0BC81 /* RxCocoa-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"RxCocoa-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tC397DCC6A23E6AFBC349ABFEE20D8210 /* UIControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIControl+Rx.swift\"; path = \"RxCocoa/iOS/UIControl+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tC39B9734D96B948154C3D494FA0388A4 /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = \"<group>\"; };\n\t\tC425D080D0597579029EC0D51F19DF00 /* RxTabBarControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTabBarControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\tC7ED23069B43EDF96192D3FB8B679306 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tC98F3E7D5B2B2FF8F63550E9D4F191E4 /* RxCollectionViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift; sourceTree = \"<group>\"; };\n\t\tCA6D6085B836402880B91BCC16B290E1 /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = \"<group>\"; };\n\t\tCC4B95EB13B3EBEB41456A72C0BB2467 /* RxCocoa-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxCocoa-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tCE5274DDB216BCF5961D86E4257DEC1D /* NSObject+Rx+RawRepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSObject+Rx+RawRepresentable.swift\"; path = \"RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift\"; sourceTree = \"<group>\"; };\n\t\tD25B52211A53D8D4EABDF123365709FD /* RxTableViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewReactiveArrayDataSource.swift; path = RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift; sourceTree = \"<group>\"; };\n\t\tD2ADF1BD6894EF0BE74BE76DDC9ACBDA /* BehaviorRelay+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"BehaviorRelay+Driver.swift\"; path = \"RxCocoa/Traits/Driver/BehaviorRelay+Driver.swift\"; sourceTree = \"<group>\"; };\n\t\tD53333A480DFFD4501326625E9BDD166 /* Signal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Signal.swift; path = RxCocoa/Traits/Signal/Signal.swift; sourceTree = \"<group>\"; };\n\t\tD57C0432CC83B41777EB7DF59040003A /* RxTabBarDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTabBarDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\tD614C716A0210E767055886DB071EC83 /* RxCocoa-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxCocoa-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tD61A7E9765A1E785BBB9D6457FFD21BB /* _RX.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RX.h; path = RxCocoa/Runtime/include/_RX.h; sourceTree = \"<group>\"; };\n\t\tD844436D5AF4452273B8A6BA3FCDF06C /* RxTableViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift; sourceTree = \"<group>\"; };\n\t\tDEDFA0E387E4A54E10D45D4D817F3963 /* _RXKVOObserver.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXKVOObserver.m; path = RxCocoa/Runtime/_RXKVOObserver.m; sourceTree = \"<group>\"; };\n\t\tE06E293B1F7E2E1E3CD617B5BF5C0A5F /* NSObject+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSObject+Rx.swift\"; path = \"RxCocoa/Foundation/NSObject+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tE0A82E54E00A2DBB8FDE2F9525F0E0C7 /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = \"<group>\"; };\n\t\tE0C3C2A6E813EF1CA4D4B015C3C04D07 /* UICollectionView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UICollectionView+Rx.swift\"; path = \"RxCocoa/iOS/UICollectionView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tE190A0F56A6754915E4B6306E4B5826A /* RxSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxSwift; path = RxSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\tE23ACB29FD0FE6D7D106E295629070D4 /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = \"<group>\"; };\n\t\tE795BF02AF222B9D68D5E733EC29F028 /* RxSearchBarDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxSearchBarDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\tE7F2F0FF7B85FF1F26D58EADD67F0ECD /* NSView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSView+Rx.swift\"; path = \"RxCocoa/macOS/NSView+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tE969FEA40002C8156106DDEAD17D8FE0 /* NSButton+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"NSButton+Rx.swift\"; path = \"RxCocoa/macOS/NSButton+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tEB1379A7CB1CF86817672243D4D703F2 /* RxPickerViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift; sourceTree = \"<group>\"; };\n\t\tEF622DAFEBB22E624B4168E567EA2CAD /* KVORepresentable+CoreGraphics.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"KVORepresentable+CoreGraphics.swift\"; path = \"RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift\"; sourceTree = \"<group>\"; };\n\t\tF10A6C30715483935DB493E75BFD2571 /* ControlProperty+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ControlProperty+Driver.swift\"; path = \"RxCocoa/Traits/Driver/ControlProperty+Driver.swift\"; sourceTree = \"<group>\"; };\n\t\tF1F54EDF8F559354284407AE8B231E4F /* UIApplication+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIApplication+Rx.swift\"; path = \"RxCocoa/iOS/UIApplication+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tF2E4CB5B55FDD57BEC362A034CA25D87 /* DelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelegateProxy.swift; path = RxCocoa/Common/DelegateProxy.swift; sourceTree = \"<group>\"; };\n\t\tF35E934D8630CDE840A2C882F51752F8 /* RxCollectionViewDataSourcePrefetchingProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDataSourcePrefetchingProxy.swift; path = RxCocoa/iOS/Proxies/RxCollectionViewDataSourcePrefetchingProxy.swift; sourceTree = \"<group>\"; };\n\t\tF48E833FFD59608576FC073396E1D62A /* RxCollectionViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift; sourceTree = \"<group>\"; };\n\t\tF49FD34447716E9C149BEC0B4BF25379 /* RxCocoa */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxCocoa; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tFAD8268E6FA199796F9CED85C6624B82 /* RxCocoa-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"RxCocoa-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tFD69E9E256BF488F303ADBBB67722394 /* UITabBar+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITabBar+Rx.swift\"; path = \"RxCocoa/iOS/UITabBar+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tFDC3176741A679B0CC60C74A031F7AE8 /* UIDatePicker+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIDatePicker+Rx.swift\"; path = \"RxCocoa/iOS/UIDatePicker+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\tFFCED2D97BAF3C4B699DD3A0C9287D92 /* SharedSequence+Operators+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"SharedSequence+Operators+arity.swift\"; path = \"RxCocoa/Traits/SharedSequence/SharedSequence+Operators+arity.swift\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tF98EE57E25923546DDDF354BC054BB3D /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tF1A4496340CA70A2E1F78812B253F059 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t069D72AED8E2051A22B1EA4BBCA2C236 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5829B97DAB1D9A2C7BBEA71AC48E4228 /* RxRelay */,\n\t\t\t\tE190A0F56A6754915E4B6306E4B5826A /* RxSwift */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t351129349E28D54DF7A90F3CFC798AE9 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC7ED23069B43EDF96192D3FB8B679306 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t58962E70A647EBABB00A8A8B1EA4530C /* RxCocoa */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD61A7E9765A1E785BBB9D6457FFD21BB /* _RX.h */,\n\t\t\t\t5B76D72DD56052E44CEFE0B3AA89D935 /* _RX.m */,\n\t\t\t\t32925EFF911A8E65BCE578CD3299DA32 /* _RXDelegateProxy.h */,\n\t\t\t\t45C1493C3A5D8FEDFDF3CCD4AB6E51D7 /* _RXDelegateProxy.m */,\n\t\t\t\t63736DB5341B4E027C44BAEFF63790B5 /* _RXKVOObserver.h */,\n\t\t\t\tDEDFA0E387E4A54E10D45D4D817F3963 /* _RXKVOObserver.m */,\n\t\t\t\t7DB7F55D959F20D25DD4C487EFC07F72 /* _RXObjCRuntime.h */,\n\t\t\t\t03DCE6BFF4FC3E84051394961B87F5F2 /* _RXObjCRuntime.m */,\n\t\t\t\tE0A82E54E00A2DBB8FDE2F9525F0E0C7 /* Bag.swift */,\n\t\t\t\tD2ADF1BD6894EF0BE74BE76DDC9ACBDA /* BehaviorRelay+Driver.swift */,\n\t\t\t\t1AE39D31B3302D7BE844917ACE4B2F39 /* ControlEvent.swift */,\n\t\t\t\t1FABEC166FCD2446B0A67318C6514007 /* ControlEvent+Driver.swift */,\n\t\t\t\t002DFBB49F24FB32815F1779DC131C18 /* ControlEvent+Signal.swift */,\n\t\t\t\t364B76EDCB5520C0CF711280AFE58D0D /* ControlProperty.swift */,\n\t\t\t\tF10A6C30715483935DB493E75BFD2571 /* ControlProperty+Driver.swift */,\n\t\t\t\t7B516B9479F21A0B64D3D1C011E4F007 /* ControlTarget.swift */,\n\t\t\t\tF2E4CB5B55FDD57BEC362A034CA25D87 /* DelegateProxy.swift */,\n\t\t\t\t6A03F4B96AFF29858BC629A8B090AF5F /* DelegateProxyType.swift */,\n\t\t\t\t54B6DB006DDCBCA6D9A9FD6BDD03ED16 /* DispatchQueue+Extensions.swift */,\n\t\t\t\tB8CEA274E713D9A7EF90A08C93BBC999 /* Driver.swift */,\n\t\t\t\tA1B40407506F8044F716981DBD7B8E42 /* Driver+Subscription.swift */,\n\t\t\t\t39945FB894651B6D6CEE5B5CCAAB39B6 /* Infallible+Bind.swift */,\n\t\t\t\tB5710FCD7A158BC8E8C6A852C2974BE8 /* InfiniteSequence.swift */,\n\t\t\t\t4823EAF482A906EAEA94EF6579A8D682 /* ItemEvents.swift */,\n\t\t\t\t3F8FA3820805E40887076EA198C911FF /* KVORepresentable.swift */,\n\t\t\t\tEF622DAFEBB22E624B4168E567EA2CAD /* KVORepresentable+CoreGraphics.swift */,\n\t\t\t\t29DBA2166BAA4EC8BB5AB8F711CC5444 /* KVORepresentable+Swift.swift */,\n\t\t\t\tBC3B22F521A2DC59774E3F8EFCDEE0A1 /* NotificationCenter+Rx.swift */,\n\t\t\t\tE969FEA40002C8156106DDEAD17D8FE0 /* NSButton+Rx.swift */,\n\t\t\t\t9E11BF10DFB0DAAC7E666F5D52735373 /* NSControl+Rx.swift */,\n\t\t\t\tE06E293B1F7E2E1E3CD617B5BF5C0A5F /* NSObject+Rx.swift */,\n\t\t\t\t3A56E2AE05C83A12A3AA5767567AB81F /* NSObject+Rx+KVORepresentable.swift */,\n\t\t\t\tCE5274DDB216BCF5961D86E4257DEC1D /* NSObject+Rx+RawRepresentable.swift */,\n\t\t\t\t5F5872C5E8D07CECF1A4BBF15CA45385 /* NSSlider+Rx.swift */,\n\t\t\t\t8331A4F50B27E9830F697D6EB50A099C /* NSTextField+Rx.swift */,\n\t\t\t\t5F910B81C7E63912873F4A0CB790557C /* NSTextStorage+Rx.swift */,\n\t\t\t\t28093455FDEDA9AA6D5053A875A18CB9 /* NSTextView+Rx.swift */,\n\t\t\t\tE7F2F0FF7B85FF1F26D58EADD67F0ECD /* NSView+Rx.swift */,\n\t\t\t\tABD8109B80E17857201D7A5F69440810 /* Observable+Bind.swift */,\n\t\t\t\t0E21BC876BBD95A73D1EC5F17668884C /* ObservableConvertibleType+Driver.swift */,\n\t\t\t\tA955B40E10C4A2CC03056F178EBF471F /* ObservableConvertibleType+SharedSequence.swift */,\n\t\t\t\t435AEB2A0B5B2F6DAAF62CBCB1AC1CA5 /* ObservableConvertibleType+Signal.swift */,\n\t\t\t\tC39B9734D96B948154C3D494FA0388A4 /* Platform.Darwin.swift */,\n\t\t\t\tCA6D6085B836402880B91BCC16B290E1 /* Platform.Linux.swift */,\n\t\t\t\t642329CE16BB5D97FF83D8A8DC7E7899 /* PriorityQueue.swift */,\n\t\t\t\t9F1696842F8126DAFFF7EE21C7238BDE /* PublishRelay+Signal.swift */,\n\t\t\t\t2ECEDC46A3E62964188CCF3C40F65F9E /* Queue.swift */,\n\t\t\t\tE23ACB29FD0FE6D7D106E295629070D4 /* RecursiveLock.swift */,\n\t\t\t\t682547DE5125E9609B59C399B1E6B860 /* RxCocoa.h */,\n\t\t\t\t1CF18C550B17C6FBACF466F5B7841071 /* RxCocoa.swift */,\n\t\t\t\t1D41DEB883AE5CAD6354F7DD5012C234 /* RxCocoaObjCRuntimeError+Extensions.swift */,\n\t\t\t\t0DEDB5AB3CD0EB4A98D3B8B4C7E1A0FB /* RxCocoaRuntime.h */,\n\t\t\t\tF35E934D8630CDE840A2C882F51752F8 /* RxCollectionViewDataSourcePrefetchingProxy.swift */,\n\t\t\t\tF48E833FFD59608576FC073396E1D62A /* RxCollectionViewDataSourceProxy.swift */,\n\t\t\t\tC98F3E7D5B2B2FF8F63550E9D4F191E4 /* RxCollectionViewDataSourceType.swift */,\n\t\t\t\t7AE1A28ADD74DE82E6DB496EF57DB900 /* RxCollectionViewDelegateProxy.swift */,\n\t\t\t\t46BF695D0C14E8B8995BF9104A32852A /* RxCollectionViewReactiveArrayDataSource.swift */,\n\t\t\t\t4C220743F207DB71B5DA783A5D37A0A1 /* RxNavigationControllerDelegateProxy.swift */,\n\t\t\t\t029F591961A328578AD2F9BD8F332452 /* RxPickerViewAdapter.swift */,\n\t\t\t\tEB1379A7CB1CF86817672243D4D703F2 /* RxPickerViewDataSourceProxy.swift */,\n\t\t\t\t160361F87DBC37A623A47DCDFD551051 /* RxPickerViewDataSourceType.swift */,\n\t\t\t\t427C577BD2573F07758287D082600505 /* RxPickerViewDelegateProxy.swift */,\n\t\t\t\t664622FC7ADCA72F0188296E5537FD1A /* RxScrollViewDelegateProxy.swift */,\n\t\t\t\tE795BF02AF222B9D68D5E733EC29F028 /* RxSearchBarDelegateProxy.swift */,\n\t\t\t\tBAEE11976EFF2FA8C6C9451A10C69626 /* RxSearchControllerDelegateProxy.swift */,\n\t\t\t\tC425D080D0597579029EC0D51F19DF00 /* RxTabBarControllerDelegateProxy.swift */,\n\t\t\t\tD57C0432CC83B41777EB7DF59040003A /* RxTabBarDelegateProxy.swift */,\n\t\t\t\t064483EEE715AA1F53F6516AB100D7F0 /* RxTableViewDataSourcePrefetchingProxy.swift */,\n\t\t\t\t6A9554911A17B58C5ECC56B07E92F260 /* RxTableViewDataSourceProxy.swift */,\n\t\t\t\tD844436D5AF4452273B8A6BA3FCDF06C /* RxTableViewDataSourceType.swift */,\n\t\t\t\t418F4B3851F74B10CEF9AC009087B6C9 /* RxTableViewDelegateProxy.swift */,\n\t\t\t\tD25B52211A53D8D4EABDF123365709FD /* RxTableViewReactiveArrayDataSource.swift */,\n\t\t\t\tAAD3185464CAFF993AD6D374FC8C227C /* RxTarget.swift */,\n\t\t\t\t8D6AFB2824027E4237941DA2B22ADBA4 /* RxTextStorageDelegateProxy.swift */,\n\t\t\t\t85A5BBDABEB49C515059594CBEDC6E03 /* RxTextViewDelegateProxy.swift */,\n\t\t\t\t31D389EEC4E01BCB0880E351F5705832 /* RxWKNavigationDelegateProxy.swift */,\n\t\t\t\t118A6499476B7A7590891826623777F7 /* SchedulerType+SharedSequence.swift */,\n\t\t\t\t6A189D909EA9E19138D228488FC2D42D /* SectionedViewDataSourceType.swift */,\n\t\t\t\tA5BA09836FD1C6B89C5F8F649426AE81 /* SharedSequence.swift */,\n\t\t\t\t3A1602013F4297A124AB8D6C252987EE /* SharedSequence+Concurrency.swift */,\n\t\t\t\t49F491FDB7F0E421975C083447433964 /* SharedSequence+Operators.swift */,\n\t\t\t\tFFCED2D97BAF3C4B699DD3A0C9287D92 /* SharedSequence+Operators+arity.swift */,\n\t\t\t\tD53333A480DFFD4501326625E9BDD166 /* Signal.swift */,\n\t\t\t\t519DECE1EAC0267F012AD1445738C0D6 /* Signal+Subscription.swift */,\n\t\t\t\t8E38136CEABB768390D4C30D6697F86E /* TextInput.swift */,\n\t\t\t\t9C613FB8772A83708CBFE18F0662884D /* UIActivityIndicatorView+Rx.swift */,\n\t\t\t\tF1F54EDF8F559354284407AE8B231E4F /* UIApplication+Rx.swift */,\n\t\t\t\t8C48F713F8C3FA312E772280EC6AAF9A /* UIBarButtonItem+Rx.swift */,\n\t\t\t\t4D4561C808ADF530A19D9A9B103112FD /* UIButton+Rx.swift */,\n\t\t\t\tE0C3C2A6E813EF1CA4D4B015C3C04D07 /* UICollectionView+Rx.swift */,\n\t\t\t\tC397DCC6A23E6AFBC349ABFEE20D8210 /* UIControl+Rx.swift */,\n\t\t\t\tFDC3176741A679B0CC60C74A031F7AE8 /* UIDatePicker+Rx.swift */,\n\t\t\t\t21298B0D540B9CB92F0C3DEBD33B016B /* UIGestureRecognizer+Rx.swift */,\n\t\t\t\tA9008D761B0B91DEE6FB43DCA293C6FE /* UINavigationController+Rx.swift */,\n\t\t\t\t419D52CCFA192A27DB66AD5331BD53C1 /* UIPickerView+Rx.swift */,\n\t\t\t\tBB095AD6C8E6A1B417AF4068D21CE94D /* UIRefreshControl+Rx.swift */,\n\t\t\t\t5ED1CC66C39B05567BA11DEC2FE46A3C /* UIScrollView+Rx.swift */,\n\t\t\t\t199341CFC396D4182CDEA0352FBA0001 /* UISearchBar+Rx.swift */,\n\t\t\t\t4F6A164298AD5E5E27AC9AE27BC6CA30 /* UISearchController+Rx.swift */,\n\t\t\t\t5E9361181FD3DA8B4B15F01EF23DA8EB /* UISegmentedControl+Rx.swift */,\n\t\t\t\t0EBDED56BB6BB2CD023E58D505E36020 /* UISlider+Rx.swift */,\n\t\t\t\t531E900C9C6EDF756BB0587BD3E66D48 /* UIStepper+Rx.swift */,\n\t\t\t\t3BB19EDA15250FCB1DA9BB0CAB0C3721 /* UISwitch+Rx.swift */,\n\t\t\t\tFD69E9E256BF488F303ADBBB67722394 /* UITabBar+Rx.swift */,\n\t\t\t\tAC05DA808CF63858796C3557E883FBE2 /* UITabBarController+Rx.swift */,\n\t\t\t\t10FFF141041D1685F1C9404791CDA4C3 /* UITableView+Rx.swift */,\n\t\t\t\t0725D3878B41FCB41B109CE751E1DBAE /* UITextField+Rx.swift */,\n\t\t\t\t3B6C8E9CB55596433FE8E363E97628BD /* UITextView+Rx.swift */,\n\t\t\t\tA0160F85C822771F39C19B748C52FB70 /* URLSession+Rx.swift */,\n\t\t\t\t848F1E559C3EB5AEE85C30CEE47E92F7 /* WKWebView+Rx.swift */,\n\t\t\t\tAD2044CD3328CC34408C6610B149D731 /* Support Files */,\n\t\t\t);\n\t\t\tname = RxCocoa;\n\t\t\tpath = RxCocoa;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t72AE6DBF7BF6FDD000607B8900842CF0 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t351129349E28D54DF7A90F3CFC798AE9 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t95A220A7205294D013A843080C3AA9A1 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t069D72AED8E2051A22B1EA4BBCA2C236 /* Dependencies */,\n\t\t\t\t72AE6DBF7BF6FDD000607B8900842CF0 /* Frameworks */,\n\t\t\t\tD68E3A95B23F66ABCAA48719832C977E /* Products */,\n\t\t\t\t58962E70A647EBABB00A8A8B1EA4530C /* RxCocoa */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tAD2044CD3328CC34408C6610B149D731 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5C79F9EACD23B1AF09974E693F7CD6EA /* RxCocoa.modulemap */,\n\t\t\t\tFAD8268E6FA199796F9CED85C6624B82 /* RxCocoa-dummy.m */,\n\t\t\t\tC00ED7A94C67870E506FB3DEB1E0BC81 /* RxCocoa-Info.plist */,\n\t\t\t\tD614C716A0210E767055886DB071EC83 /* RxCocoa-prefix.pch */,\n\t\t\t\tCC4B95EB13B3EBEB41456A72C0BB2467 /* RxCocoa-umbrella.h */,\n\t\t\t\t546FC66ECA46E6D8B26DE8D7B529667C /* RxCocoa.debug.xcconfig */,\n\t\t\t\tAC85B53F47EEFA85FBD54111AD218FFE /* RxCocoa.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/RxCocoa\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD68E3A95B23F66ABCAA48719832C977E /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF49FD34447716E9C149BEC0B4BF25379 /* RxCocoa */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t1796ACC221DBBB273A84DF2D3DF74BA6 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t6234FE7ABB908DE1D812CA427861A9C8 /* _RX.h in Headers */,\n\t\t\t\tEEA18CC5BFD9765A32B4857C1463DD2A /* _RXDelegateProxy.h in Headers */,\n\t\t\t\tCF833DDB131A18936EC27CFFF43D1102 /* _RXKVOObserver.h in Headers */,\n\t\t\t\t780A538787419596D0E84C16733D8F5B /* _RXObjCRuntime.h in Headers */,\n\t\t\t\tAAEF72AB3F54C300BE8A0E38B3EDD165 /* RxCocoa.h in Headers */,\n\t\t\t\t7890261401D11E41D489E7482DBF27D3 /* RxCocoa-umbrella.h in Headers */,\n\t\t\t\t34B59D20C08209AA4BE18CA222723515 /* RxCocoaRuntime.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tBC5183FBB16A06C1D86620B00CFE6269 /* RxCocoa */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 49BB90FE41B8F40F74D59310A4D9CDDF /* Build configuration list for PBXNativeTarget \"RxCocoa\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t1796ACC221DBBB273A84DF2D3DF74BA6 /* Headers */,\n\t\t\t\t920E8009C2EF8FD47499EA88D46EC369 /* Sources */,\n\t\t\t\tF98EE57E25923546DDDF354BC054BB3D /* Frameworks */,\n\t\t\t\t688453866F7C40908D34EAE91AA8C99E /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t64577F91726E1F8952B73156517BF76C /* PBXTargetDependency */,\n\t\t\t\tD3BB07EC7DCBED892310633CA5E6A7EC /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = RxCocoa;\n\t\t\tproductName = RxCocoa;\n\t\t\tproductReference = F49FD34447716E9C149BEC0B4BF25379 /* RxCocoa */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tBC13E29019356DA02577B1A44DC8F73B /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 81CC78A99DBC0B0E1EA5A5CE2AA3515E /* Build configuration list for PBXProject \"RxCocoa\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 95A220A7205294D013A843080C3AA9A1;\n\t\t\tproductRefGroup = D68E3A95B23F66ABCAA48719832C977E /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = E190A0F56A6754915E4B6306E4B5826A /* RxSwift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 5829B97DAB1D9A2C7BBEA71AC48E4228 /* RxRelay */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tBC5183FBB16A06C1D86620B00CFE6269 /* RxCocoa */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t688453866F7C40908D34EAE91AA8C99E /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t920E8009C2EF8FD47499EA88D46EC369 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tA7A6FAD8807FE23F758FE42188BE2CC4 /* _RX.m in Sources */,\n\t\t\t\t647650CB9D07A93E652BA2A36BC98ED3 /* _RXDelegateProxy.m in Sources */,\n\t\t\t\t1A3A10A66FDBF09522B7C0F7276B3AC5 /* _RXKVOObserver.m in Sources */,\n\t\t\t\t3252EA71C9B932A7A6620770F5056F50 /* _RXObjCRuntime.m in Sources */,\n\t\t\t\tC1AB3FB67E9B02A6D0E71212BF83E22E /* Bag.swift in Sources */,\n\t\t\t\t6EE5697BB276A22553C7E15791D4E63E /* BehaviorRelay+Driver.swift in Sources */,\n\t\t\t\tFFAAD7E296C63EF8E8CF0A6BEA125298 /* ControlEvent.swift in Sources */,\n\t\t\t\tF2E24C1A4ADFC8EB439A52429A813EC6 /* ControlEvent+Driver.swift in Sources */,\n\t\t\t\t4F89F7E3A2286DB442688011E556D93B /* ControlEvent+Signal.swift in Sources */,\n\t\t\t\t0D7383E630C64114395423715ACCA2E5 /* ControlProperty.swift in Sources */,\n\t\t\t\tFA8F9FC104EDDCD9A0C9C5CD129A37EF /* ControlProperty+Driver.swift in Sources */,\n\t\t\t\t56962A5B70E43CC0D3219B7FBCD1DC88 /* ControlTarget.swift in Sources */,\n\t\t\t\tFBEC656E28425F77C5BA0CC5B8DD25BE /* DelegateProxy.swift in Sources */,\n\t\t\t\t65415D025EF91EAC5D577949B9BBF972 /* DelegateProxyType.swift in Sources */,\n\t\t\t\t920D988553573899A3531BB5A924F059 /* DispatchQueue+Extensions.swift in Sources */,\n\t\t\t\tF64781CDBF7D029AB322BF643522ED09 /* Driver.swift in Sources */,\n\t\t\t\t5DECCA3CB0C27DD1C88182731DA7FCD1 /* Driver+Subscription.swift in Sources */,\n\t\t\t\t7B174FB45E0D3D1E40E0DF4690CB567A /* Infallible+Bind.swift in Sources */,\n\t\t\t\tBABD8E634362EE8DF08ED2E16E85E122 /* InfiniteSequence.swift in Sources */,\n\t\t\t\tB580A3541C6CA867B7139B900EF9F75B /* ItemEvents.swift in Sources */,\n\t\t\t\t1C10D4BE70FE89EC0324B23716FA45E5 /* KVORepresentable.swift in Sources */,\n\t\t\t\t28CC4ED3D89BB23506B287F8F5BCECD8 /* KVORepresentable+CoreGraphics.swift in Sources */,\n\t\t\t\tE14154C07AF7A39E264BC3B3EFD733CE /* KVORepresentable+Swift.swift in Sources */,\n\t\t\t\t12E43AD74AA0903AB456553B5D1DD056 /* NotificationCenter+Rx.swift in Sources */,\n\t\t\t\tBE9FDA452BDAD32EC3B6235C21DA652C /* NSButton+Rx.swift in Sources */,\n\t\t\t\t900AD968BCEE5F2F560F1DECBEA60E77 /* NSControl+Rx.swift in Sources */,\n\t\t\t\t342DEFDAF94AF1FC29BF33F4651A18E2 /* NSObject+Rx.swift in Sources */,\n\t\t\t\tD55339C30DC44456301E17FADC3BFEE4 /* NSObject+Rx+KVORepresentable.swift in Sources */,\n\t\t\t\t6264AC44995FE0034C5DFA936FF52CE6 /* NSObject+Rx+RawRepresentable.swift in Sources */,\n\t\t\t\t3F2A44ED7330BA5E28225DA7D48529FD /* NSSlider+Rx.swift in Sources */,\n\t\t\t\t8B462AD8B0FF3AD90F432B4F3236E34C /* NSTextField+Rx.swift in Sources */,\n\t\t\t\t5A154D2ECAEFB42367BE0C0DDC87CF26 /* NSTextStorage+Rx.swift in Sources */,\n\t\t\t\t4A92C2186902E5B4A9BA5B268CEDC80A /* NSTextView+Rx.swift in Sources */,\n\t\t\t\t33AE29CCD4F54BC43937521134A12BAC /* NSView+Rx.swift in Sources */,\n\t\t\t\t226FB079685A350A7522F6FDB772FC86 /* Observable+Bind.swift in Sources */,\n\t\t\t\t098A7E7AEC6AD385CF5A0FB8D79C27AF /* ObservableConvertibleType+Driver.swift in Sources */,\n\t\t\t\tD4C17E628FA568CB8C0AFF6C071E1A46 /* ObservableConvertibleType+SharedSequence.swift in Sources */,\n\t\t\t\tA85FB63BBE89ED14C5C79525503E19D2 /* ObservableConvertibleType+Signal.swift in Sources */,\n\t\t\t\t5778FB7C831F04053D46B6FEC03CE4D2 /* Platform.Darwin.swift in Sources */,\n\t\t\t\tAE968A1E6D48CBA335CA1A6E979F112A /* Platform.Linux.swift in Sources */,\n\t\t\t\tB17237829E251D14EB3961E3D4111D26 /* PriorityQueue.swift in Sources */,\n\t\t\t\t11829AC72691F541D37C1A23E1EE8D1A /* PublishRelay+Signal.swift in Sources */,\n\t\t\t\t6E0C2A2B9AD3209FB63014447F03605C /* Queue.swift in Sources */,\n\t\t\t\tE07AB03B47E4D40F97533A356F1675BE /* RecursiveLock.swift in Sources */,\n\t\t\t\t2CD803DA7E83C82D290FE98FEEE687B8 /* RxCocoa.swift in Sources */,\n\t\t\t\t607B3B2367464B8EA3A3C129F9BC9468 /* RxCocoa-dummy.m in Sources */,\n\t\t\t\t5239D3EE3DDD3BC875FE100C4A83A1A5 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */,\n\t\t\t\t1FE825E92010BE5DDCD0D97CED70A236 /* RxCollectionViewDataSourcePrefetchingProxy.swift in Sources */,\n\t\t\t\t434B3976E3B3FC68F8A405A2ACCAEB3F /* RxCollectionViewDataSourceProxy.swift in Sources */,\n\t\t\t\tDB9E212AEFC7DACF8049A37761258191 /* RxCollectionViewDataSourceType.swift in Sources */,\n\t\t\t\tD78C66D3E918EDAA8FB5F78ECA2855EE /* RxCollectionViewDelegateProxy.swift in Sources */,\n\t\t\t\t798D7D484A939598FDF66594BFA7D093 /* RxCollectionViewReactiveArrayDataSource.swift in Sources */,\n\t\t\t\t23AB7E0B2F1F9F0B4604A98829734FDB /* RxNavigationControllerDelegateProxy.swift in Sources */,\n\t\t\t\tE7EEF5D1E774B075FA2F6ECD002AB132 /* RxPickerViewAdapter.swift in Sources */,\n\t\t\t\tD573349235F40BF450B7EFFED85A339E /* RxPickerViewDataSourceProxy.swift in Sources */,\n\t\t\t\t60A953C8972283706C082AC42947B043 /* RxPickerViewDataSourceType.swift in Sources */,\n\t\t\t\tBF97E194A860C80412D21C0F058B9B8B /* RxPickerViewDelegateProxy.swift in Sources */,\n\t\t\t\t41CFFA76A5135FF4625D2E83CDA490D0 /* RxScrollViewDelegateProxy.swift in Sources */,\n\t\t\t\tF6850C0AC55C3AB12EF44EFF135E604F /* RxSearchBarDelegateProxy.swift in Sources */,\n\t\t\t\tE4AF4B810C37B0A44DB48E8E472FA9B9 /* RxSearchControllerDelegateProxy.swift in Sources */,\n\t\t\t\t0E3AF17E3F196488AA3B62DA4B066364 /* RxTabBarControllerDelegateProxy.swift in Sources */,\n\t\t\t\tB51FB88512FC3402BECBB139D70DA558 /* RxTabBarDelegateProxy.swift in Sources */,\n\t\t\t\t60D9FA5934ECE047A78B009B4888CF2E /* RxTableViewDataSourcePrefetchingProxy.swift in Sources */,\n\t\t\t\tED71233AE263ADAB4695DEEE5E5FD0B2 /* RxTableViewDataSourceProxy.swift in Sources */,\n\t\t\t\t381853F4D9C66B4FC877241753B77369 /* RxTableViewDataSourceType.swift in Sources */,\n\t\t\t\t41C1AD8E7712BB584CB989ABFBEF6BF2 /* RxTableViewDelegateProxy.swift in Sources */,\n\t\t\t\tF59650BAB5B15DCA84C5A18D012D2A96 /* RxTableViewReactiveArrayDataSource.swift in Sources */,\n\t\t\t\tA6C4D383F553AF4A6C535AA1E948E16C /* RxTarget.swift in Sources */,\n\t\t\t\t3936A1BCFFCDB03BE54CAAE0D33A6659 /* RxTextStorageDelegateProxy.swift in Sources */,\n\t\t\t\t605192772D1262EAB3805CB53A090FF4 /* RxTextViewDelegateProxy.swift in Sources */,\n\t\t\t\t5274CF9FA22FC8DA1FC5AECFCE0847A5 /* RxWKNavigationDelegateProxy.swift in Sources */,\n\t\t\t\tDF0F55E4FD7E166EE7CF403791853F75 /* SchedulerType+SharedSequence.swift in Sources */,\n\t\t\t\t58383C193D1A398E965E3EF654586DB0 /* SectionedViewDataSourceType.swift in Sources */,\n\t\t\t\t8E51BF06D1533DD52DDC610CD7522C44 /* SharedSequence.swift in Sources */,\n\t\t\t\t8920F6CDD4B32D5FD864B1BD114E99C5 /* SharedSequence+Concurrency.swift in Sources */,\n\t\t\t\t58A0BA435F851165449E98CA422FA05E /* SharedSequence+Operators.swift in Sources */,\n\t\t\t\t9CBE76516E6A66842938813791692F8D /* SharedSequence+Operators+arity.swift in Sources */,\n\t\t\t\t5CE91A95754610E4A2BFE209EB19655A /* Signal.swift in Sources */,\n\t\t\t\t27A7914471BBC1D85B251B95772859EC /* Signal+Subscription.swift in Sources */,\n\t\t\t\t237497A83B83D8551FD4DCCA2DBA2BCE /* TextInput.swift in Sources */,\n\t\t\t\t104C4A2E0EC23EDBB767A554F6D4BDCB /* UIActivityIndicatorView+Rx.swift in Sources */,\n\t\t\t\t8A8CAA4924CBEB16B47B0C21BB10F623 /* UIApplication+Rx.swift in Sources */,\n\t\t\t\tC1A7217E02B3A958E081EAB51F824577 /* UIBarButtonItem+Rx.swift in Sources */,\n\t\t\t\t666CF8DCC50F87DC5EA2A002F3090744 /* UIButton+Rx.swift in Sources */,\n\t\t\t\t0A9FE8B6140805209AF83AE31A3D3B6E /* UICollectionView+Rx.swift in Sources */,\n\t\t\t\tD3ECD252F47B0B568380545AB3315BFD /* UIControl+Rx.swift in Sources */,\n\t\t\t\t51B2FF394C94C6D6688CC055A546811D /* UIDatePicker+Rx.swift in Sources */,\n\t\t\t\tCA7AD2946482A548E39CA56E04FDC743 /* UIGestureRecognizer+Rx.swift in Sources */,\n\t\t\t\tBE891F57CB396F57AE5F8E5EC8B5DCEA /* UINavigationController+Rx.swift in Sources */,\n\t\t\t\t84C5FB7908E9B5BC31D1CDD7B0055805 /* UIPickerView+Rx.swift in Sources */,\n\t\t\t\t810634A222994C7706F54EB4E230AA77 /* UIRefreshControl+Rx.swift in Sources */,\n\t\t\t\t7B63B576043243A784D88F7B3F4980AA /* UIScrollView+Rx.swift in Sources */,\n\t\t\t\t881222EC54152E2C917B423BA4F05B4A /* UISearchBar+Rx.swift in Sources */,\n\t\t\t\tD53DFBA3A74839F6F6CA09D1E2A38AEF /* UISearchController+Rx.swift in Sources */,\n\t\t\t\tF765EC6C8B3CF42BE713A1AE101BBFF0 /* UISegmentedControl+Rx.swift in Sources */,\n\t\t\t\tE2E71C3F1C12D2802B7FEC8E2CBFD3F4 /* UISlider+Rx.swift in Sources */,\n\t\t\t\t1EEA54B15BC5E6CD7F18AA8EF8924539 /* UIStepper+Rx.swift in Sources */,\n\t\t\t\t2B3CE62E5D8CCC3E9214740D10E20AAB /* UISwitch+Rx.swift in Sources */,\n\t\t\t\tDE46057EDAAA20C49528797F2DDAD2D5 /* UITabBar+Rx.swift in Sources */,\n\t\t\t\tB8F4EC2BFB70D9447D321CEF6626CE30 /* UITabBarController+Rx.swift in Sources */,\n\t\t\t\tB2C23D0F3CE1CFA87F382088A313D8B7 /* UITableView+Rx.swift in Sources */,\n\t\t\t\tACFDAD9114D6CE2C55EBE8426596EE03 /* UITextField+Rx.swift in Sources */,\n\t\t\t\tC00A1498C51F71DB962DD96A8DAEADDF /* UITextView+Rx.swift in Sources */,\n\t\t\t\tCFE47AF2009EB38458461514FB0EA80D /* URLSession+Rx.swift in Sources */,\n\t\t\t\t1FAD000D7AED20DE6556288476BC1955 /* WKWebView+Rx.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t64577F91726E1F8952B73156517BF76C /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxRelay;\n\t\t\ttargetProxy = 55C2E4D31EBDBBE38DCC9FD538A9C78A /* PBXContainerItemProxy */;\n\t\t};\n\t\tD3BB07EC7DCBED892310633CA5E6A7EC /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxSwift;\n\t\t\ttargetProxy = 1A3FDE601F76A95F98A9A45A56E6C6BB /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t7A03F8A886B2A34B3B1F4B2D5468D564 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t844180D45F2EF00EA04FD68917672A3D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = AC85B53F47EEFA85FBD54111AD218FFE /* RxCocoa.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxCocoa/RxCocoa-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxCocoa/RxCocoa-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxCocoa/RxCocoa.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxCocoa;\n\t\t\t\tPRODUCT_NAME = RxCocoa;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tAE18049A515F339995CB5C61E7A58AD2 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 546FC66ECA46E6D8B26DE8D7B529667C /* RxCocoa.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxCocoa/RxCocoa-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxCocoa/RxCocoa-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxCocoa/RxCocoa.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxCocoa;\n\t\t\t\tPRODUCT_NAME = RxCocoa;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE6A1D73D45653B3B146897E8D9978E54 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t49BB90FE41B8F40F74D59310A4D9CDDF /* Build configuration list for PBXNativeTarget \"RxCocoa\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tAE18049A515F339995CB5C61E7A58AD2 /* Debug */,\n\t\t\t\t844180D45F2EF00EA04FD68917672A3D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t81CC78A99DBC0B0E1EA5A5CE2AA3515E /* Build configuration list for PBXProject \"RxCocoa\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7A03F8A886B2A34B3B1F4B2D5468D564 /* Debug */,\n\t\t\t\tE6A1D73D45653B3B146897E8D9978E54 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = BC13E29019356DA02577B1A44DC8F73B /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/RxRelay/LICENSE.md",
    "content": "**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/RxRelay/README.md",
    "content": "<p align=\"center\">\n<img src=\"assets/RxSwift_Logo.png\" width=\"35%\" alt=\"RxSwift Logo\" />\n<br />\n<a href=\"https://actions-badge.atrox.dev/ReactiveX/RxSwift/goto\" target=\"_blank\"><img src=\"https://github.com/ReactiveX/RxSwift/workflows/RxSwift/badge.svg?branch=main\" alt=\"Build Status\" /></a>\n<img src=\"https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg\" alt=\"Supported Platforms: iOS, macOS, tvOS, watchOS & Linux\" />\n<br />\n<a href=\"https://cocoapods.org/pods/RxSwift\" alt=\"RxSwift on CocoaPods\" title=\"RxSwift on CocoaPods\"><img src=\"https://img.shields.io/cocoapods/v/RxSwift.svg\" /></a>\n<a href=\"https://github.com/Carthage/Carthage\" alt=\"RxSwift on Carthage\" title=\"RxSwift on Carthage\"><img src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\" /></a>\n<a href=\"https://github.com/apple/swift-package-manager\" alt=\"RxSwift on Swift Package Manager\" title=\"RxSwift on Swift Package Manager\"><img src=\"https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg\" /></a>\n</p>\n\nRx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable<Element>` interface, which lets you broadcast and subscribe to values and other events from an `Observable` stream.  \n\nRxSwift is the Swift-specific implementation of the [Reactive Extensions](http://reactivex.io) standard.\n\n<p align=\"center\"><img src=\"assets/example.png\" width=\"55%\" alt=\"RxSwift Observable Example of a price constantly changing and updating the app's UI\" /></p>\n\nWhile this version aims to stay true to the original spirit and naming conventions of Rx, this projects also aims to provide a true Swift-first API for Rx APIs.\n\nCross platform documentation can be found on [ReactiveX.io](http://reactivex.io/).\n\nLike other Rx implementation, RxSwift's intention is to enable easy composition of asynchronous operations and streams of data in the form of `Observable` objects and a suite of methods to transform and compose these pieces of asynchronous work.\n\nKVO observation, async operations, UI Events and other streams of data are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful.\n\n## I came here because I want to ...\n\n###### ... understand\n\n* [why use rx?](Documentation/Why.md)\n* [the basics, getting started with RxSwift](Documentation/GettingStarted.md)\n* [traits](Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, and `ControlProperty` ... and why do they exist?\n* [testing](Documentation/UnitTests.md)\n* [tips and common errors](Documentation/Tips.md)\n* [debugging](Documentation/GettingStarted.md#debugging)\n* [the math behind Rx](Documentation/MathBehindRx.md)\n* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md)\n\n###### ... install\n\n* Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation)\n\n###### ... hack around\n\n* with the example app. [Running Example App](Documentation/ExampleApp.md)\n* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md)\n\n###### ... interact\n\n* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[Join Slack Channel](http://slack.rxswift.org)\n* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)\n* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)\n* Help out [Check out contribution guide](CONTRIBUTING.md)\n\n###### ... compare\n\n* [with Combine and ReactiveSwift](Documentation/ComparisonWithOtherLibraries.md).\n\n###### ... understand the structure\n\nRxSwift is as compositional as the asynchronous work it drives. The core unit is RxSwift itself, while other dependencies can be added for UI Work, testing, and more.\n\nIt comprises five separate components depending on each other in the following way:\n\n```none\n┌──────────────┐    ┌──────────────┐\n│   RxCocoa    ├────▶   RxRelay    │\n└───────┬──────┘    └──────┬───────┘\n        │                  │        \n┌───────▼──────────────────▼───────┐\n│             RxSwift              │\n└───────▲──────────────────▲───────┘\n        │                  │        \n┌───────┴──────┐    ┌──────┴───────┐\n│    RxTest    │    │  RxBlocking  │\n└──────────────┘    └──────────────┘\n```\n\n* **RxSwift**: The core of RxSwift, providing the Rx standard as (mostly) defined by [ReactiveX](https://reactivex.io). It has no other dependencies.\n* **RxCocoa**: Provides Cocoa-specific capabilities for general iOS/macOS/watchOS & tvOS app development, such as Shared Sequences, Traits, and much more. It depends on both `RxSwift` and `RxRelay`.\n* **RxRelay**: Provides `PublishRelay`, `BehaviorRelay` and `ReplayRelay`, three [simple wrappers around Subjects](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Subjects.md#relays). It depends on `RxSwift`. \n* **RxTest** and **RxBlocking**: Provides testing capabilities for Rx-based systems. It depends on `RxSwift`.\n\n## Usage\n\n<table>\n  <tr>\n    <th width=\"30%\">Here's an example</th>\n    <th width=\"30%\">In Action</th>\n  </tr>\n  <tr>\n    <td>Define search for GitHub repositories ...</td>\n    <th rowspan=\"9\"><img src=\"https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/GithubSearch.gif\"></th>\n  </tr>\n  <tr>\n    <td><div class=\"highlight highlight-source-swift\"><pre>\nlet searchResults = searchBar.rx.text.orEmpty\n    .throttle(.milliseconds(300), scheduler: MainScheduler.instance)\n    .distinctUntilChanged()\n    .flatMapLatest { query -> Observable&lt;[Repository]&gt; in\n        if query.isEmpty {\n            return .just([])\n        }\n        return searchGitHub(query)\n            .catchAndReturn([])\n    }\n    .observe(on: MainScheduler.instance)</pre></div></td>\n  </tr>\n  <tr>\n    <td>... then bind the results to your tableview</td>\n  </tr>\n  <tr>\n    <td width=\"30%\"><div class=\"highlight highlight-source-swift\"><pre>\nsearchResults\n    .bind(to: tableView.rx.items(cellIdentifier: \"Cell\")) {\n        (index, repository: Repository, cell) in\n        cell.textLabel?.text = repository.name\n        cell.detailTextLabel?.text = repository.url\n    }\n    .disposed(by: disposeBag)</pre></div></td>\n  </tr>\n</table>\n\n\n## Requirements\n\n* Xcode 12.x\n* Swift 5.x\n\nFor Xcode 11 and below, [use RxSwift 5.x](https://github.com/ReactiveX/RxSwift/releases/tag/5.1.1).\n\n## Installation\n\nRxSwift doesn't contain any external dependencies.\n\nThese are currently the supported installation options:\n\n### Manual\n\nOpen Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app\n\n### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)\n\n```ruby\n# Podfile\nuse_frameworks!\n\ntarget 'YOUR_TARGET_NAME' do\n    pod 'RxSwift', '6.5.0'\n    pod 'RxCocoa', '6.5.0'\nend\n\n# RxTest and RxBlocking make the most sense in the context of unit/integration tests\ntarget 'YOUR_TESTING_TARGET' do\n    pod 'RxBlocking', '6.5.0'\n    pod 'RxTest', '6.5.0'\nend\n```\n\nReplace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:\n\n```bash\n$ pod install\n```\n\n### XCFrameworks\n\nEach release starting with RxSwift 6 includes `*.xcframework` framework binaries.\n\nSimply drag the needed framework binaries to your **Frameworks, Libraries, and Embedded Content** section under your target's **General** tab.\n\n> **Note**: If you're using `RxCocoa`, be sure to also drag **RxCocoaRuntime.xcframework** before importing `RxCocoa`.\n\n<img src=\"https://raw.githubusercontent.com/ReactiveX/RxSwift/main/assets/xcframeworks.png\" alt=\"XCFrameworks instructions\" width=\"65%\">\n\n### [Carthage](https://github.com/Carthage/Carthage)\n\nAdd this to `Cartfile`\n\n```\ngithub \"ReactiveX/RxSwift\" \"6.5.0\"\n```\n\n```bash\n$ carthage update\n```\n\n#### Carthage as a Static Library\n\nCarthage defaults to building RxSwift as a Dynamic Library. \n\nIf you wish to build RxSwift as a Static Library using Carthage you may use the script below to manually modify the framework type before building with Carthage:\n\n```bash\ncarthage update RxSwift --platform iOS --no-build\nsed -i -e 's/MACH_O_TYPE = mh_dylib/MACH_O_TYPE = staticlib/g' Carthage/Checkouts/RxSwift/Rx.xcodeproj/project.pbxproj\ncarthage build RxSwift --platform iOS\n```\n\n### [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\n> **Note**: There is a critical cross-dependency bug affecting many projects including RxSwift in Swift Package Manager. We've [filed a bug (SR-12303)](https://bugs.swift.org/browse/SR-12303) in early 2020 but have no answer yet. Your mileage may vary. A partial workaround can be found [here](https://github.com/ReactiveX/RxSwift/issues/2127#issuecomment-717830502).\n\nCreate a `Package.swift` file.\n\n```swift\n// swift-tools-version:5.0\n\nimport PackageDescription\n\nlet package = Package(\n  name: \"RxTestProject\",\n  dependencies: [\n    .package(url: \"https://github.com/ReactiveX/RxSwift.git\", .exact(\"6.5.0\"))\n  ],\n  targets: [\n    .target(name: \"RxTestProject\", dependencies: [\"RxSwift\", \"RxCocoa\"])\n  ]\n)\n```\n\n```bash\n$ swift build\n```\n\nTo build or test a module with RxTest dependency, set `TEST=1`.\n\n```bash\n$ TEST=1 swift test\n```\n\n### Manually using git submodules\n\n* Add RxSwift as a submodule\n\n```bash\n$ git submodule add git@github.com:ReactiveX/RxSwift.git\n```\n\n* Drag `Rx.xcodeproj` into Project Navigator\n* Go to `Project > Targets > Build Phases > Link Binary With Libraries`, click `+` and select `RxSwift`, `RxCocoa` and `RxRelay` targets\n\n## References\n\n* [http://reactivex.io/](http://reactivex.io/)\n* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions)\n* [RxSwift RayWenderlich.com Book](https://store.raywenderlich.com/products/rxswift-reactive-programming-with-swift)\n* [RxSwift: Debunking the myth of hard (YouTube)](https://www.youtube.com/watch?v=GdvLP0ZAhhc)\n* [Boxue.io RxSwift Online Course](https://boxueio.com/series/rxswift-101) (Chinese 🇨🇳)\n* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY)\n* [Reactive Programming Overview (Jafar Husain from Netflix)](https://youtu.be/-8Y1-lE6NSA)\n* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf)\n* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/)\n* [Haskell](https://www.haskell.org/)\n"
  },
  {
    "path": "JetChat/Pods/RxRelay/RxRelay/BehaviorRelay.swift",
    "content": "//\n//  BehaviorRelay.swift\n//  RxRelay\n//\n//  Created by Krunoslav Zaher on 10/7/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/// BehaviorRelay is a wrapper for `BehaviorSubject`.\n///\n/// Unlike `BehaviorSubject` it can't terminate with error or completed.\npublic final class BehaviorRelay<Element>: ObservableType {\n    private let subject: BehaviorSubject<Element>\n\n    /// Accepts `event` and emits it to subscribers\n    public func accept(_ event: Element) {\n        self.subject.onNext(event)\n    }\n\n    /// Current value of behavior subject\n    public var value: Element {\n        // this try! is ok because subject can't error out or be disposed\n        return try! self.subject.value()\n    }\n\n    /// Initializes behavior relay with initial value.\n    public init(value: Element) {\n        self.subject = BehaviorSubject(value: value)\n    }\n\n    /// Subscribes observer\n    public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.subject.subscribe(observer)\n    }\n\n    /// - returns: Canonical interface for push style sequence\n    public func asObservable() -> Observable<Element> {\n        self.subject.asObservable()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxRelay/RxRelay/Observable+Bind.swift",
    "content": "//\n//  Observable+Bind.swift\n//  RxRelay\n//\n//  Created by Shai Mishali on 09/04/2019.\n//  Copyright © 2019 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\nextension ObservableType {\n    /**\n     Creates new subscription and sends elements to publish relay(s).\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n     - parameter relays: Target publish relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    public func bind(to relays: PublishRelay<Element>...) -> Disposable {\n        bind(to: relays)\n    }\n\n    /**\n     Creates new subscription and sends elements to publish relay(s).\n\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n\n     - parameter relays: Target publish relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    public func bind(to relays: PublishRelay<Element?>...) -> Disposable {\n        self.map { $0 as Element? }.bind(to: relays)\n    }\n\n    /**\n     Creates new subscription and sends elements to publish relay(s).\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n     - parameter relays: Target publish relays for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    private func bind(to relays: [PublishRelay<Element>]) -> Disposable {\n        subscribe { e in\n            switch e {\n            case let .next(element):\n                relays.forEach {\n                    $0.accept(element)\n                }\n            case let .error(error):\n                rxFatalErrorInDebug(\"Binding error to publish relay: \\(error)\")\n            case .completed:\n                break\n            }\n        }\n    }\n\n    /**\n     Creates new subscription and sends elements to behavior relay(s).\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n     - parameter relays: Target behavior relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    public func bind(to relays: BehaviorRelay<Element>...) -> Disposable {\n        self.bind(to: relays)\n    }\n\n    /**\n     Creates new subscription and sends elements to behavior relay(s).\n\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n\n     - parameter relays: Target behavior relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    public func bind(to relays: BehaviorRelay<Element?>...) -> Disposable {\n        self.map { $0 as Element? }.bind(to: relays)\n    }\n\n    /**\n     Creates new subscription and sends elements to behavior relay(s).\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n     - parameter relays: Target behavior relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    private func bind(to relays: [BehaviorRelay<Element>]) -> Disposable {\n        subscribe { e in\n            switch e {\n            case let .next(element):\n                relays.forEach {\n                    $0.accept(element)\n                }\n            case let .error(error):\n                rxFatalErrorInDebug(\"Binding error to behavior relay: \\(error)\")\n            case .completed:\n                break\n            }\n        }\n    }\n\n    /**\n     Creates new subscription and sends elements to replay relay(s).\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n     - parameter relays: Target replay relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    public func bind(to relays: ReplayRelay<Element>...) -> Disposable {\n        self.bind(to: relays)\n    }\n\n    /**\n     Creates new subscription and sends elements to replay relay(s).\n\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n\n     - parameter relays: Target replay relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    public func bind(to relays: ReplayRelay<Element?>...) -> Disposable {\n        self.map { $0 as Element? }.bind(to: relays)\n    }\n\n    /**\n     Creates new subscription and sends elements to replay relay(s).\n     In case error occurs in debug mode, `fatalError` will be raised.\n     In case error occurs in release mode, `error` will be logged.\n     - parameter relays: Target replay relay for sequence elements.\n     - returns: Disposable object that can be used to unsubscribe the observer.\n     */\n    private func bind(to relays: [ReplayRelay<Element>]) -> Disposable {\n        subscribe { e in\n            switch e {\n            case let .next(element):\n                relays.forEach {\n                    $0.accept(element)\n                }\n            case let .error(error):\n                rxFatalErrorInDebug(\"Binding error to behavior relay: \\(error)\")\n            case .completed:\n                break\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxRelay/RxRelay/PublishRelay.swift",
    "content": "//\n//  PublishRelay.swift\n//  RxRelay\n//\n//  Created by Krunoslav Zaher on 3/28/15.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/// PublishRelay is a wrapper for `PublishSubject`.\n///\n/// Unlike `PublishSubject` it can't terminate with error or completed.\npublic final class PublishRelay<Element>: ObservableType {\n    private let subject: PublishSubject<Element>\n    \n    // Accepts `event` and emits it to subscribers\n    public func accept(_ event: Element) {\n        self.subject.onNext(event)\n    }\n    \n    /// Initializes with internal empty subject.\n    public init() {\n        self.subject = PublishSubject()\n    }\n\n    /// Subscribes observer\n    public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.subject.subscribe(observer)\n    }\n    \n    /// - returns: Canonical interface for push style sequence\n    public func asObservable() -> Observable<Element> {\n        self.subject.asObservable()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxRelay/RxRelay/ReplayRelay.swift",
    "content": "//\n//  ReplayRelay.swift\n//  RxRelay\n//\n//  Created by Zsolt Kovacs on 12/22/19.\n//  Copyright © 2019 Krunoslav Zaher. All rights reserved.\n//\n\nimport RxSwift\n\n/// ReplayRelay is a wrapper for `ReplaySubject`.\n///\n/// Unlike `ReplaySubject` it can't terminate with an error or complete.\npublic final class ReplayRelay<Element>: ObservableType {\n    private let subject: ReplaySubject<Element>\n\n    // Accepts `event` and emits it to subscribers\n    public func accept(_ event: Element) {\n        self.subject.onNext(event)\n    }\n\n    private init(subject: ReplaySubject<Element>) {\n        self.subject = subject\n    }\n\n    /// Creates new instance of `ReplayRelay` that replays at most `bufferSize` last elements sent to it.\n    ///\n    /// - parameter bufferSize: Maximal number of elements to replay to observers after subscription.\n    /// - returns: New instance of replay relay.\n    public static func create(bufferSize: Int) -> ReplayRelay<Element> {\n        ReplayRelay(subject: ReplaySubject.create(bufferSize: bufferSize))\n    }\n\n    /// Creates a new instance of `ReplayRelay` that buffers all the sent to it.\n    /// To avoid filling up memory, developer needs to make sure that the use case will only ever store a 'reasonable'\n    /// number of elements.\n    public static func createUnbound() -> ReplayRelay<Element> {\n        ReplayRelay(subject: ReplaySubject.createUnbounded())\n    }\n\n    /// Subscribes observer\n    public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.subject.subscribe(observer)\n    }\n\n    /// - returns: Canonical interface for push style sequence\n    public func asObservable() -> Observable<Element> {\n        self.subject.asObserver()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxRelay/RxRelay/Utils.swift",
    "content": "//\n//  Utils.swift\n//  RxRelay\n//\n//  Created by Shai Mishali on 09/04/2019.\n//  Copyright © 2019 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\nfunc rxFatalErrorInDebug(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) {\n    #if DEBUG\n    fatalError(lastMessage(), file: file, line: line)\n    #else\n    print(\"\\(file):\\(line): \\(lastMessage())\")\n    #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/RxRelay.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t056A93B10A15D20355DEB8F3697616BF /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E84CD13BBFD583AA9136D1B7E46C5B4 /* Utils.swift */; };\n\t\t1B240D27253BEEF148EE5164A6F40682 /* RxRelay-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 66C06BF32A9C9BF9542C07BACDD98E12 /* RxRelay-dummy.m */; };\n\t\t3DC67EC304BFA615A55DA6EEF602F814 /* BehaviorRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 662251FB3592F2E7FC84D05CB4B5A1F4 /* BehaviorRelay.swift */; };\n\t\t43F4BF92F27667275BBD17C15A6135D8 /* ReplayRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F1EB673CFD1E3F0678C69C26AE74188 /* ReplayRelay.swift */; };\n\t\t5CE6FCBF1770EE758D88202BEDBED54E /* RxRelay-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = E85F5C980FF8AB5BDDB8A079AB8D6DCF /* RxRelay-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA5869B0D2382E0FB54B8C52DEF9FC9F8 /* PublishRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61680D5052F6BB28F54E1CF70B2E07E9 /* PublishRelay.swift */; };\n\t\tA63C03DE2E632FC4A2AA2C43791D681C /* Observable+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87446FFDA976E3069C74F26929DA29B8 /* Observable+Bind.swift */; };\n\t\tB8113D4F5119EE9FB2BAE829F70C638E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11FDCA3EBE361C9E7904D776C9E5C900 /* Foundation.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t430BBCAD0F0EA4745FE9E3BA856575A7 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 869F01310E427726268AB4C7B3FF922D /* RxSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = F0179EE061353B7A322F596E97844774;\n\t\t\tremoteInfo = RxSwift;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t11FDCA3EBE361C9E7904D776C9E5C900 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t1F1EB673CFD1E3F0678C69C26AE74188 /* ReplayRelay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReplayRelay.swift; path = RxRelay/ReplayRelay.swift; sourceTree = \"<group>\"; };\n\t\t3E84CD13BBFD583AA9136D1B7E46C5B4 /* Utils.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Utils.swift; path = RxRelay/Utils.swift; sourceTree = \"<group>\"; };\n\t\t4D37CF8715A815DC60F75EB7F730B314 /* RxRelay.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxRelay.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t61680D5052F6BB28F54E1CF70B2E07E9 /* PublishRelay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PublishRelay.swift; path = RxRelay/PublishRelay.swift; sourceTree = \"<group>\"; };\n\t\t662251FB3592F2E7FC84D05CB4B5A1F4 /* BehaviorRelay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BehaviorRelay.swift; path = RxRelay/BehaviorRelay.swift; sourceTree = \"<group>\"; };\n\t\t66C06BF32A9C9BF9542C07BACDD98E12 /* RxRelay-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"RxRelay-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t6C045753EE2C4C1CA434A974162F6FC6 /* RxRelay-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"RxRelay-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t869F01310E427726268AB4C7B3FF922D /* RxSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxSwift; path = RxSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t87446FFDA976E3069C74F26929DA29B8 /* Observable+Bind.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Observable+Bind.swift\"; path = \"RxRelay/Observable+Bind.swift\"; sourceTree = \"<group>\"; };\n\t\t89ABB905FAE747B9F5105F54157BFECA /* RxRelay-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxRelay-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tB546861C56544DEBBDF2AD71F1BDF8F2 /* RxRelay */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxRelay; path = RxRelay.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tC449609859F9F00F9994D3CFFA87347E /* RxRelay.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxRelay.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tE85F5C980FF8AB5BDDB8A079AB8D6DCF /* RxRelay-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxRelay-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tFCA95D24B192AD464328515165460764 /* RxRelay.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = RxRelay.modulemap; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t9EA96926B60F6965AF872CC7D7D3A232 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB8113D4F5119EE9FB2BAE829F70C638E /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t15A7FF4C1504433D353269213557AA3B /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB546861C56544DEBBDF2AD71F1BDF8F2 /* RxRelay */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3C95B9B7E356A90CDFC189D5E6FD6A2E = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tAA8CAAE9561BB37539B14170AB4A7D24 /* Dependencies */,\n\t\t\t\tF60856D28D548F8DE584AE0A7D942C4E /* Frameworks */,\n\t\t\t\t15A7FF4C1504433D353269213557AA3B /* Products */,\n\t\t\t\tE5755840E79CEA46DAE6981304421B69 /* RxRelay */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t48085DE583C0316E3DFD71FF7D17FE32 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t11FDCA3EBE361C9E7904D776C9E5C900 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tAA8CAAE9561BB37539B14170AB4A7D24 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t869F01310E427726268AB4C7B3FF922D /* RxSwift */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDE38E1D20A8AED0345DEBBA0FCA2584E /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tFCA95D24B192AD464328515165460764 /* RxRelay.modulemap */,\n\t\t\t\t66C06BF32A9C9BF9542C07BACDD98E12 /* RxRelay-dummy.m */,\n\t\t\t\t6C045753EE2C4C1CA434A974162F6FC6 /* RxRelay-Info.plist */,\n\t\t\t\t89ABB905FAE747B9F5105F54157BFECA /* RxRelay-prefix.pch */,\n\t\t\t\tE85F5C980FF8AB5BDDB8A079AB8D6DCF /* RxRelay-umbrella.h */,\n\t\t\t\tC449609859F9F00F9994D3CFFA87347E /* RxRelay.debug.xcconfig */,\n\t\t\t\t4D37CF8715A815DC60F75EB7F730B314 /* RxRelay.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/RxRelay\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE5755840E79CEA46DAE6981304421B69 /* RxRelay */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t662251FB3592F2E7FC84D05CB4B5A1F4 /* BehaviorRelay.swift */,\n\t\t\t\t87446FFDA976E3069C74F26929DA29B8 /* Observable+Bind.swift */,\n\t\t\t\t61680D5052F6BB28F54E1CF70B2E07E9 /* PublishRelay.swift */,\n\t\t\t\t1F1EB673CFD1E3F0678C69C26AE74188 /* ReplayRelay.swift */,\n\t\t\t\t3E84CD13BBFD583AA9136D1B7E46C5B4 /* Utils.swift */,\n\t\t\t\tDE38E1D20A8AED0345DEBBA0FCA2584E /* Support Files */,\n\t\t\t);\n\t\t\tname = RxRelay;\n\t\t\tpath = RxRelay;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF60856D28D548F8DE584AE0A7D942C4E /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t48085DE583C0316E3DFD71FF7D17FE32 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t92F15476B199E5203689CE2C82910E73 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t5CE6FCBF1770EE758D88202BEDBED54E /* RxRelay-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t564FA919E05BFD512DA9163BAB640EEE /* RxRelay */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 140C2DB6CCF6ACA018A47C30C9C0C236 /* Build configuration list for PBXNativeTarget \"RxRelay\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t92F15476B199E5203689CE2C82910E73 /* Headers */,\n\t\t\t\tBF771E8C8BD97B7D99FA77D7BBD436A4 /* Sources */,\n\t\t\t\t9EA96926B60F6965AF872CC7D7D3A232 /* Frameworks */,\n\t\t\t\tB9A8E7262A4C7EF4FBADC699646D22FB /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tC572E404D447CDD5847C8F97E6C2B3B1 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = RxRelay;\n\t\t\tproductName = RxRelay;\n\t\t\tproductReference = B546861C56544DEBBDF2AD71F1BDF8F2 /* RxRelay */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tACF0932BA2A502AF6DF97FEB57C23FB9 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 9234695EF8CA2CCC67C337DE7A7F64E2 /* Build configuration list for PBXProject \"RxRelay\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 3C95B9B7E356A90CDFC189D5E6FD6A2E;\n\t\t\tproductRefGroup = 15A7FF4C1504433D353269213557AA3B /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 869F01310E427726268AB4C7B3FF922D /* RxSwift */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t564FA919E05BFD512DA9163BAB640EEE /* RxRelay */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tB9A8E7262A4C7EF4FBADC699646D22FB /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tBF771E8C8BD97B7D99FA77D7BBD436A4 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3DC67EC304BFA615A55DA6EEF602F814 /* BehaviorRelay.swift in Sources */,\n\t\t\t\tA63C03DE2E632FC4A2AA2C43791D681C /* Observable+Bind.swift in Sources */,\n\t\t\t\tA5869B0D2382E0FB54B8C52DEF9FC9F8 /* PublishRelay.swift in Sources */,\n\t\t\t\t43F4BF92F27667275BBD17C15A6135D8 /* ReplayRelay.swift in Sources */,\n\t\t\t\t1B240D27253BEEF148EE5164A6F40682 /* RxRelay-dummy.m in Sources */,\n\t\t\t\t056A93B10A15D20355DEB8F3697616BF /* Utils.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\tC572E404D447CDD5847C8F97E6C2B3B1 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxSwift;\n\t\t\ttargetProxy = 430BBCAD0F0EA4745FE9E3BA856575A7 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t4C9DF352DF8D6A9E4127CDE07D109ADC /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tCC39B756EA8ACFAC4BDCB81FF0163A52 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 4D37CF8715A815DC60F75EB7F730B314 /* RxRelay.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxRelay/RxRelay-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxRelay/RxRelay-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxRelay/RxRelay.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxRelay;\n\t\t\t\tPRODUCT_NAME = RxRelay;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD009D5FC3AF2B20FADF3FFFEABFC568C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = C449609859F9F00F9994D3CFFA87347E /* RxRelay.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxRelay/RxRelay-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxRelay/RxRelay-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxRelay/RxRelay.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxRelay;\n\t\t\t\tPRODUCT_NAME = RxRelay;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDDC4F0402179834578B9E993293F1B70 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t140C2DB6CCF6ACA018A47C30C9C0C236 /* Build configuration list for PBXNativeTarget \"RxRelay\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD009D5FC3AF2B20FADF3FFFEABFC568C /* Debug */,\n\t\t\t\tCC39B756EA8ACFAC4BDCB81FF0163A52 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t9234695EF8CA2CCC67C337DE7A7F64E2 /* Build configuration list for PBXProject \"RxRelay\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4C9DF352DF8D6A9E4127CDE07D109ADC /* Debug */,\n\t\t\t\tDDC4F0402179834578B9E993293F1B70 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = ACF0932BA2A502AF6DF97FEB57C23FB9 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/LICENSE.md",
    "content": "**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/AtomicInt.swift",
    "content": "//\n//  AtomicInt.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 10/28/18.\n//  Copyright © 2018 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\nfinal class AtomicInt: NSLock {\n    fileprivate var value: Int32\n    public init(_ value: Int32 = 0) {\n        self.value = value\n    }\n}\n\n@discardableResult\n@inline(__always)\nfunc add(_ this: AtomicInt, _ value: Int32) -> Int32 {\n    this.lock()\n    let oldValue = this.value\n    this.value += value\n    this.unlock()\n    return oldValue\n}\n\n@discardableResult\n@inline(__always)\nfunc sub(_ this: AtomicInt, _ value: Int32) -> Int32 {\n    this.lock()\n    let oldValue = this.value\n    this.value -= value\n    this.unlock()\n    return oldValue\n}\n\n@discardableResult\n@inline(__always)\nfunc fetchOr(_ this: AtomicInt, _ mask: Int32) -> Int32 {\n    this.lock()\n    let oldValue = this.value\n    this.value |= mask\n    this.unlock()\n    return oldValue\n}\n\n@inline(__always)\nfunc load(_ this: AtomicInt) -> Int32 {\n    this.lock()\n    let oldValue = this.value\n    this.unlock()\n    return oldValue\n}\n\n@discardableResult\n@inline(__always)\nfunc increment(_ this: AtomicInt) -> Int32 {\n    add(this, 1)\n}\n\n@discardableResult\n@inline(__always)\nfunc decrement(_ this: AtomicInt) -> Int32 {\n    sub(this, 1)\n}\n\n@inline(__always)\nfunc isFlagSet(_ this: AtomicInt, _ mask: Int32) -> Bool {\n    (load(this) & mask) != 0\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/DataStructures/Bag.swift",
    "content": "//\n//  Bag.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 2/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Swift\n\nlet arrayDictionaryMaxSize = 30\n\nstruct BagKey {\n    /**\n    Unique identifier for object added to `Bag`.\n     \n    It's underlying type is UInt64. If we assume there in an idealized CPU that works at 4GHz,\n     it would take ~150 years of continuous running time for it to overflow.\n    */\n    fileprivate let rawValue: UInt64\n}\n\n/**\nData structure that represents a bag of elements typed `T`.\n\nSingle element can be stored multiple times.\n\nTime and space complexity of insertion and deletion is O(n). \n\nIt is suitable for storing small number of elements.\n*/\nstruct Bag<T> : CustomDebugStringConvertible {\n    /// Type of identifier for inserted elements.\n    typealias KeyType = BagKey\n    \n    typealias Entry = (key: BagKey, value: T)\n \n    private var _nextKey: BagKey = BagKey(rawValue: 0)\n\n    // data\n\n    // first fill inline variables\n    var _key0: BagKey?\n    var _value0: T?\n\n    // then fill \"array dictionary\"\n    var _pairs = ContiguousArray<Entry>()\n\n    // last is sparse dictionary\n    var _dictionary: [BagKey: T]?\n\n    var _onlyFastPath = true\n\n    /// Creates new empty `Bag`.\n    init() {\n    }\n    \n    /**\n    Inserts `value` into bag.\n    \n    - parameter element: Element to insert.\n    - returns: Key that can be used to remove element from bag.\n    */\n    mutating func insert(_ element: T) -> BagKey {\n        let key = _nextKey\n\n        _nextKey = BagKey(rawValue: _nextKey.rawValue &+ 1)\n\n        if _key0 == nil {\n            _key0 = key\n            _value0 = element\n            return key\n        }\n\n        _onlyFastPath = false\n\n        if _dictionary != nil {\n            _dictionary![key] = element\n            return key\n        }\n\n        if _pairs.count < arrayDictionaryMaxSize {\n            _pairs.append((key: key, value: element))\n            return key\n        }\n        \n        _dictionary = [key: element]\n        \n        return key\n    }\n    \n    /// - returns: Number of elements in bag.\n    var count: Int {\n        let dictionaryCount: Int = _dictionary?.count ?? 0\n        return (_value0 != nil ? 1 : 0) + _pairs.count + dictionaryCount\n    }\n    \n    /// Removes all elements from bag and clears capacity.\n    mutating func removeAll() {\n        _key0 = nil\n        _value0 = nil\n\n        _pairs.removeAll(keepingCapacity: false)\n        _dictionary?.removeAll(keepingCapacity: false)\n    }\n    \n    /**\n    Removes element with a specific `key` from bag.\n    \n    - parameter key: Key that identifies element to remove from bag.\n    - returns: Element that bag contained, or nil in case element was already removed.\n    */\n    mutating func removeKey(_ key: BagKey) -> T? {\n        if _key0 == key {\n            _key0 = nil\n            let value = _value0!\n            _value0 = nil\n            return value\n        }\n\n        if let existingObject = _dictionary?.removeValue(forKey: key) {\n            return existingObject\n        }\n\n        for i in 0 ..< _pairs.count where _pairs[i].key == key {\n            let value = _pairs[i].value\n            _pairs.remove(at: i)\n            return value\n        }\n\n        return nil\n    }\n}\n\nextension Bag {\n    /// A textual representation of `self`, suitable for debugging.\n    var debugDescription : String {\n        \"\\(self.count) elements in Bag\"\n    }\n}\n\nextension Bag {\n    /// Enumerates elements inside the bag.\n    ///\n    /// - parameter action: Enumeration closure.\n    func forEach(_ action: (T) -> Void) {\n        if _onlyFastPath {\n            if let value0 = _value0 {\n                action(value0)\n            }\n            return\n        }\n\n        let value0 = _value0\n        let dictionary = _dictionary\n\n        if let value0 = value0 {\n            action(value0)\n        }\n\n        for i in 0 ..< _pairs.count {\n            action(_pairs[i].value)\n        }\n\n        if dictionary?.count ?? 0 > 0 {\n            for element in dictionary!.values {\n                action(element)\n            }\n        }\n    }\n}\n\nextension BagKey: Hashable {\n    func hash(into hasher: inout Hasher) {\n        hasher.combine(rawValue)\n    }\n}\n\nfunc ==(lhs: BagKey, rhs: BagKey) -> Bool {\n    lhs.rawValue == rhs.rawValue\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/DataStructures/InfiniteSequence.swift",
    "content": "//\n//  InfiniteSequence.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 6/13/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Sequence that repeats `repeatedValue` infinite number of times.\nstruct InfiniteSequence<Element> : Sequence {\n    typealias Iterator = AnyIterator<Element>\n    \n    private let repeatedValue: Element\n    \n    init(repeatedValue: Element) {\n        self.repeatedValue = repeatedValue\n    }\n    \n    func makeIterator() -> Iterator {\n        let repeatedValue = self.repeatedValue\n        return AnyIterator { repeatedValue }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/DataStructures/PriorityQueue.swift",
    "content": "//\n//  PriorityQueue.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/27/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nstruct PriorityQueue<Element> {\n    private let hasHigherPriority: (Element, Element) -> Bool\n    private let isEqual: (Element, Element) -> Bool\n\n    private var elements = [Element]()\n\n    init(hasHigherPriority: @escaping (Element, Element) -> Bool, isEqual: @escaping (Element, Element) -> Bool) {\n        self.hasHigherPriority = hasHigherPriority\n        self.isEqual = isEqual\n    }\n\n    mutating func enqueue(_ element: Element) {\n        elements.append(element)\n        bubbleToHigherPriority(elements.count - 1)\n    }\n\n    func peek() -> Element? {\n        elements.first\n    }\n\n    var isEmpty: Bool {\n        elements.count == 0\n    }\n\n    mutating func dequeue() -> Element? {\n        guard let front = peek() else {\n            return nil\n        }\n\n        removeAt(0)\n\n        return front\n    }\n\n    mutating func remove(_ element: Element) {\n        for i in 0 ..< elements.count {\n            if self.isEqual(elements[i], element) {\n                removeAt(i)\n                return\n            }\n        }\n    }\n\n    private mutating func removeAt(_ index: Int) {\n        let removingLast = index == elements.count - 1\n        if !removingLast {\n            elements.swapAt(index, elements.count - 1)\n        }\n\n        _ = elements.popLast()\n\n        if !removingLast {\n            bubbleToHigherPriority(index)\n            bubbleToLowerPriority(index)\n        }\n    }\n\n    private mutating func bubbleToHigherPriority(_ initialUnbalancedIndex: Int) {\n        precondition(initialUnbalancedIndex >= 0)\n        precondition(initialUnbalancedIndex < elements.count)\n\n        var unbalancedIndex = initialUnbalancedIndex\n\n        while unbalancedIndex > 0 {\n            let parentIndex = (unbalancedIndex - 1) / 2\n            guard self.hasHigherPriority(elements[unbalancedIndex], elements[parentIndex]) else { break }\n            elements.swapAt(unbalancedIndex, parentIndex)\n            unbalancedIndex = parentIndex\n        }\n    }\n\n    private mutating func bubbleToLowerPriority(_ initialUnbalancedIndex: Int) {\n        precondition(initialUnbalancedIndex >= 0)\n        precondition(initialUnbalancedIndex < elements.count)\n\n        var unbalancedIndex = initialUnbalancedIndex\n        while true {\n            let leftChildIndex = unbalancedIndex * 2 + 1\n            let rightChildIndex = unbalancedIndex * 2 + 2\n\n            var highestPriorityIndex = unbalancedIndex\n\n            if leftChildIndex < elements.count && self.hasHigherPriority(elements[leftChildIndex], elements[highestPriorityIndex]) {\n                highestPriorityIndex = leftChildIndex\n            }\n\n            if rightChildIndex < elements.count && self.hasHigherPriority(elements[rightChildIndex], elements[highestPriorityIndex]) {\n                highestPriorityIndex = rightChildIndex\n            }\n\n            guard highestPriorityIndex != unbalancedIndex else { break }\n            elements.swapAt(highestPriorityIndex, unbalancedIndex)\n\n            unbalancedIndex = highestPriorityIndex\n        }\n    }\n}\n\nextension PriorityQueue : CustomDebugStringConvertible {\n    var debugDescription: String {\n        elements.debugDescription\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/DataStructures/Queue.swift",
    "content": "//\n//  Queue.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 3/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/**\nData structure that represents queue.\n\nComplexity of `enqueue`, `dequeue` is O(1) when number of operations is\naveraged over N operations.\n\nComplexity of `peek` is O(1).\n*/\nstruct Queue<T>: Sequence {\n    /// Type of generator.\n    typealias Generator = AnyIterator<T>\n\n    private let resizeFactor = 2\n    \n    private var storage: ContiguousArray<T?>\n    private var innerCount = 0\n    private var pushNextIndex = 0\n    private let initialCapacity: Int\n\n    /**\n    Creates new queue.\n    \n    - parameter capacity: Capacity of newly created queue.\n    */\n    init(capacity: Int) {\n        initialCapacity = capacity\n\n        storage = ContiguousArray<T?>(repeating: nil, count: capacity)\n    }\n    \n    private var dequeueIndex: Int {\n        let index = pushNextIndex - count\n        return index < 0 ? index + storage.count : index\n    }\n    \n    /// - returns: Is queue empty.\n    var isEmpty: Bool { count == 0 }\n    \n    /// - returns: Number of elements inside queue.\n    var count: Int { innerCount }\n    \n    /// - returns: Element in front of a list of elements to `dequeue`.\n    func peek() -> T {\n        precondition(count > 0)\n        \n        return storage[dequeueIndex]!\n    }\n    \n    mutating private func resizeTo(_ size: Int) {\n        var newStorage = ContiguousArray<T?>(repeating: nil, count: size)\n        \n        let count = self.count\n        \n        let dequeueIndex = self.dequeueIndex\n        let spaceToEndOfQueue = storage.count - dequeueIndex\n        \n        // first batch is from dequeue index to end of array\n        let countElementsInFirstBatch = Swift.min(count, spaceToEndOfQueue)\n        // second batch is wrapped from start of array to end of queue\n        let numberOfElementsInSecondBatch = count - countElementsInFirstBatch\n        \n        newStorage[0 ..< countElementsInFirstBatch] = storage[dequeueIndex ..< (dequeueIndex + countElementsInFirstBatch)]\n        newStorage[countElementsInFirstBatch ..< (countElementsInFirstBatch + numberOfElementsInSecondBatch)] = storage[0 ..< numberOfElementsInSecondBatch]\n        \n        self.innerCount = count\n        pushNextIndex = count\n        storage = newStorage\n    }\n    \n    /// Enqueues `element`.\n    ///\n    /// - parameter element: Element to enqueue.\n    mutating func enqueue(_ element: T) {\n        if count == storage.count {\n            resizeTo(Swift.max(storage.count, 1) * resizeFactor)\n        }\n        \n        storage[pushNextIndex] = element\n        pushNextIndex += 1\n        innerCount += 1\n        \n        if pushNextIndex >= storage.count {\n            pushNextIndex -= storage.count\n        }\n    }\n    \n    private mutating func dequeueElementOnly() -> T {\n        precondition(count > 0)\n        \n        let index = dequeueIndex\n\n        defer {\n            storage[index] = nil\n            innerCount -= 1\n        }\n\n        return storage[index]!\n    }\n\n    /// Dequeues element or throws an exception in case queue is empty.\n    ///\n    /// - returns: Dequeued element.\n    mutating func dequeue() -> T? {\n        if self.count == 0 {\n            return nil\n        }\n\n        defer {\n            let downsizeLimit = storage.count / (resizeFactor * resizeFactor)\n            if count < downsizeLimit && downsizeLimit >= initialCapacity {\n                resizeTo(storage.count / resizeFactor)\n            }\n        }\n\n        return dequeueElementOnly()\n    }\n    \n    /// - returns: Generator of contained elements.\n    func makeIterator() -> AnyIterator<T> {\n        var i = dequeueIndex\n        var innerCount = count\n\n        return AnyIterator {\n            if innerCount == 0 {\n                return nil\n            }\n\n            defer {\n                innerCount -= 1\n                i += 1\n            }\n\n            if i >= self.storage.count {\n                i -= self.storage.count\n            }\n\n            return self.storage[i]\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/DispatchQueue+Extensions.swift",
    "content": "//\n//  DispatchQueue+Extensions.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 10/22/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\n\nextension DispatchQueue {\n    private static var token: DispatchSpecificKey<()> = {\n        let key = DispatchSpecificKey<()>()\n        DispatchQueue.main.setSpecific(key: key, value: ())\n        return key\n    }()\n\n    static var isMain: Bool {\n        DispatchQueue.getSpecific(key: token) != nil\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/Platform.Darwin.swift",
    "content": "//\n//  Platform.Darwin.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)\n\n    import Darwin\n    import Foundation\n\n    extension Thread {\n        static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: NSCopying) {\n            let currentThread = Thread.current\n            let threadDictionary = currentThread.threadDictionary\n\n            if let newValue = value {\n                threadDictionary[key] = newValue\n            }\n            else {\n                threadDictionary[key] = nil\n            }\n        }\n\n        static func getThreadLocalStorageValueForKey<T>(_ key: NSCopying) -> T? {\n            let currentThread = Thread.current\n            let threadDictionary = currentThread.threadDictionary\n            \n            return threadDictionary[key] as? T\n        }\n    }\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/Platform.Linux.swift",
    "content": "//\n//  Platform.Linux.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(Linux)\n\n    import Foundation\n\n    extension Thread {\n\n        static func setThreadLocalStorageValue<T: AnyObject>(_ value: T?, forKey key: String) {\n            if let newValue = value {\n                Thread.current.threadDictionary[key] = newValue\n            }\n            else {\n                Thread.current.threadDictionary[key] = nil\n            }\n        }\n\n        static func getThreadLocalStorageValueForKey<T: AnyObject>(_ key: String) -> T? {\n            let currentThread = Thread.current\n            let threadDictionary = currentThread.threadDictionary\n\n            return threadDictionary[key] as? T\n        }\n    }\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/Platform/RecursiveLock.swift",
    "content": "//\n//  RecursiveLock.swift\n//  Platform\n//\n//  Created by Krunoslav Zaher on 12/18/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n#if TRACE_RESOURCES\n    class RecursiveLock: NSRecursiveLock {\n        override init() {\n            _ = Resources.incrementTotal()\n            super.init()\n        }\n\n        override func lock() {\n            super.lock()\n            _ = Resources.incrementTotal()\n        }\n\n        override func unlock() {\n            super.unlock()\n            _ = Resources.decrementTotal()\n        }\n\n        deinit {\n            _ = Resources.decrementTotal()\n        }\n    }\n#else\n    typealias RecursiveLock = NSRecursiveLock\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/README.md",
    "content": "<p align=\"center\">\n<img src=\"assets/RxSwift_Logo.png\" width=\"35%\" alt=\"RxSwift Logo\" />\n<br />\n<a href=\"https://actions-badge.atrox.dev/ReactiveX/RxSwift/goto\" target=\"_blank\"><img src=\"https://github.com/ReactiveX/RxSwift/workflows/RxSwift/badge.svg?branch=main\" alt=\"Build Status\" /></a>\n<img src=\"https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg\" alt=\"Supported Platforms: iOS, macOS, tvOS, watchOS & Linux\" />\n<br />\n<a href=\"https://cocoapods.org/pods/RxSwift\" alt=\"RxSwift on CocoaPods\" title=\"RxSwift on CocoaPods\"><img src=\"https://img.shields.io/cocoapods/v/RxSwift.svg\" /></a>\n<a href=\"https://github.com/Carthage/Carthage\" alt=\"RxSwift on Carthage\" title=\"RxSwift on Carthage\"><img src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\" /></a>\n<a href=\"https://github.com/apple/swift-package-manager\" alt=\"RxSwift on Swift Package Manager\" title=\"RxSwift on Swift Package Manager\"><img src=\"https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg\" /></a>\n</p>\n\nRx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable<Element>` interface, which lets you broadcast and subscribe to values and other events from an `Observable` stream.  \n\nRxSwift is the Swift-specific implementation of the [Reactive Extensions](http://reactivex.io) standard.\n\n<p align=\"center\"><img src=\"assets/example.png\" width=\"55%\" alt=\"RxSwift Observable Example of a price constantly changing and updating the app's UI\" /></p>\n\nWhile this version aims to stay true to the original spirit and naming conventions of Rx, this projects also aims to provide a true Swift-first API for Rx APIs.\n\nCross platform documentation can be found on [ReactiveX.io](http://reactivex.io/).\n\nLike other Rx implementation, RxSwift's intention is to enable easy composition of asynchronous operations and streams of data in the form of `Observable` objects and a suite of methods to transform and compose these pieces of asynchronous work.\n\nKVO observation, async operations, UI Events and other streams of data are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful.\n\n## I came here because I want to ...\n\n###### ... understand\n\n* [why use rx?](Documentation/Why.md)\n* [the basics, getting started with RxSwift](Documentation/GettingStarted.md)\n* [traits](Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, and `ControlProperty` ... and why do they exist?\n* [testing](Documentation/UnitTests.md)\n* [tips and common errors](Documentation/Tips.md)\n* [debugging](Documentation/GettingStarted.md#debugging)\n* [the math behind Rx](Documentation/MathBehindRx.md)\n* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md)\n\n###### ... install\n\n* Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation)\n\n###### ... hack around\n\n* with the example app. [Running Example App](Documentation/ExampleApp.md)\n* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md)\n\n###### ... interact\n\n* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[Join Slack Channel](http://slack.rxswift.org)\n* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)\n* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)\n* Help out [Check out contribution guide](CONTRIBUTING.md)\n\n###### ... compare\n\n* [with Combine and ReactiveSwift](Documentation/ComparisonWithOtherLibraries.md).\n\n###### ... understand the structure\n\nRxSwift is as compositional as the asynchronous work it drives. The core unit is RxSwift itself, while other dependencies can be added for UI Work, testing, and more.\n\nIt comprises five separate components depending on each other in the following way:\n\n```none\n┌──────────────┐    ┌──────────────┐\n│   RxCocoa    ├────▶   RxRelay    │\n└───────┬──────┘    └──────┬───────┘\n        │                  │        \n┌───────▼──────────────────▼───────┐\n│             RxSwift              │\n└───────▲──────────────────▲───────┘\n        │                  │        \n┌───────┴──────┐    ┌──────┴───────┐\n│    RxTest    │    │  RxBlocking  │\n└──────────────┘    └──────────────┘\n```\n\n* **RxSwift**: The core of RxSwift, providing the Rx standard as (mostly) defined by [ReactiveX](https://reactivex.io). It has no other dependencies.\n* **RxCocoa**: Provides Cocoa-specific capabilities for general iOS/macOS/watchOS & tvOS app development, such as Shared Sequences, Traits, and much more. It depends on both `RxSwift` and `RxRelay`.\n* **RxRelay**: Provides `PublishRelay`, `BehaviorRelay` and `ReplayRelay`, three [simple wrappers around Subjects](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Subjects.md#relays). It depends on `RxSwift`. \n* **RxTest** and **RxBlocking**: Provides testing capabilities for Rx-based systems. It depends on `RxSwift`.\n\n## Usage\n\n<table>\n  <tr>\n    <th width=\"30%\">Here's an example</th>\n    <th width=\"30%\">In Action</th>\n  </tr>\n  <tr>\n    <td>Define search for GitHub repositories ...</td>\n    <th rowspan=\"9\"><img src=\"https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/GithubSearch.gif\"></th>\n  </tr>\n  <tr>\n    <td><div class=\"highlight highlight-source-swift\"><pre>\nlet searchResults = searchBar.rx.text.orEmpty\n    .throttle(.milliseconds(300), scheduler: MainScheduler.instance)\n    .distinctUntilChanged()\n    .flatMapLatest { query -> Observable&lt;[Repository]&gt; in\n        if query.isEmpty {\n            return .just([])\n        }\n        return searchGitHub(query)\n            .catchAndReturn([])\n    }\n    .observe(on: MainScheduler.instance)</pre></div></td>\n  </tr>\n  <tr>\n    <td>... then bind the results to your tableview</td>\n  </tr>\n  <tr>\n    <td width=\"30%\"><div class=\"highlight highlight-source-swift\"><pre>\nsearchResults\n    .bind(to: tableView.rx.items(cellIdentifier: \"Cell\")) {\n        (index, repository: Repository, cell) in\n        cell.textLabel?.text = repository.name\n        cell.detailTextLabel?.text = repository.url\n    }\n    .disposed(by: disposeBag)</pre></div></td>\n  </tr>\n</table>\n\n\n## Requirements\n\n* Xcode 12.x\n* Swift 5.x\n\nFor Xcode 11 and below, [use RxSwift 5.x](https://github.com/ReactiveX/RxSwift/releases/tag/5.1.1).\n\n## Installation\n\nRxSwift doesn't contain any external dependencies.\n\nThese are currently the supported installation options:\n\n### Manual\n\nOpen Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app\n\n### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)\n\n```ruby\n# Podfile\nuse_frameworks!\n\ntarget 'YOUR_TARGET_NAME' do\n    pod 'RxSwift', '6.5.0'\n    pod 'RxCocoa', '6.5.0'\nend\n\n# RxTest and RxBlocking make the most sense in the context of unit/integration tests\ntarget 'YOUR_TESTING_TARGET' do\n    pod 'RxBlocking', '6.5.0'\n    pod 'RxTest', '6.5.0'\nend\n```\n\nReplace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:\n\n```bash\n$ pod install\n```\n\n### XCFrameworks\n\nEach release starting with RxSwift 6 includes `*.xcframework` framework binaries.\n\nSimply drag the needed framework binaries to your **Frameworks, Libraries, and Embedded Content** section under your target's **General** tab.\n\n> **Note**: If you're using `RxCocoa`, be sure to also drag **RxCocoaRuntime.xcframework** before importing `RxCocoa`.\n\n<img src=\"https://raw.githubusercontent.com/ReactiveX/RxSwift/main/assets/xcframeworks.png\" alt=\"XCFrameworks instructions\" width=\"65%\">\n\n### [Carthage](https://github.com/Carthage/Carthage)\n\nAdd this to `Cartfile`\n\n```\ngithub \"ReactiveX/RxSwift\" \"6.5.0\"\n```\n\n```bash\n$ carthage update\n```\n\n#### Carthage as a Static Library\n\nCarthage defaults to building RxSwift as a Dynamic Library. \n\nIf you wish to build RxSwift as a Static Library using Carthage you may use the script below to manually modify the framework type before building with Carthage:\n\n```bash\ncarthage update RxSwift --platform iOS --no-build\nsed -i -e 's/MACH_O_TYPE = mh_dylib/MACH_O_TYPE = staticlib/g' Carthage/Checkouts/RxSwift/Rx.xcodeproj/project.pbxproj\ncarthage build RxSwift --platform iOS\n```\n\n### [Swift Package Manager](https://github.com/apple/swift-package-manager)\n\n> **Note**: There is a critical cross-dependency bug affecting many projects including RxSwift in Swift Package Manager. We've [filed a bug (SR-12303)](https://bugs.swift.org/browse/SR-12303) in early 2020 but have no answer yet. Your mileage may vary. A partial workaround can be found [here](https://github.com/ReactiveX/RxSwift/issues/2127#issuecomment-717830502).\n\nCreate a `Package.swift` file.\n\n```swift\n// swift-tools-version:5.0\n\nimport PackageDescription\n\nlet package = Package(\n  name: \"RxTestProject\",\n  dependencies: [\n    .package(url: \"https://github.com/ReactiveX/RxSwift.git\", .exact(\"6.5.0\"))\n  ],\n  targets: [\n    .target(name: \"RxTestProject\", dependencies: [\"RxSwift\", \"RxCocoa\"])\n  ]\n)\n```\n\n```bash\n$ swift build\n```\n\nTo build or test a module with RxTest dependency, set `TEST=1`.\n\n```bash\n$ TEST=1 swift test\n```\n\n### Manually using git submodules\n\n* Add RxSwift as a submodule\n\n```bash\n$ git submodule add git@github.com:ReactiveX/RxSwift.git\n```\n\n* Drag `Rx.xcodeproj` into Project Navigator\n* Go to `Project > Targets > Build Phases > Link Binary With Libraries`, click `+` and select `RxSwift`, `RxCocoa` and `RxRelay` targets\n\n## References\n\n* [http://reactivex.io/](http://reactivex.io/)\n* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions)\n* [RxSwift RayWenderlich.com Book](https://store.raywenderlich.com/products/rxswift-reactive-programming-with-swift)\n* [RxSwift: Debunking the myth of hard (YouTube)](https://www.youtube.com/watch?v=GdvLP0ZAhhc)\n* [Boxue.io RxSwift Online Course](https://boxueio.com/series/rxswift-101) (Chinese 🇨🇳)\n* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY)\n* [Reactive Programming Overview (Jafar Husain from Netflix)](https://youtu.be/-8Y1-lE6NSA)\n* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf)\n* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/)\n* [Haskell](https://www.haskell.org/)\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/AnyObserver.swift",
    "content": "//\n//  AnyObserver.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// A type-erased `ObserverType`.\n///\n/// Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type.\npublic struct AnyObserver<Element> : ObserverType {\n    /// Anonymous event handler type.\n    public typealias EventHandler = (Event<Element>) -> Void\n\n    private let observer: EventHandler\n\n    /// Construct an instance whose `on(event)` calls `eventHandler(event)`\n    ///\n    /// - parameter eventHandler: Event handler that observes sequences events.\n    public init(eventHandler: @escaping EventHandler) {\n        self.observer = eventHandler\n    }\n    \n    /// Construct an instance whose `on(event)` calls `observer.on(event)`\n    ///\n    /// - parameter observer: Observer that receives sequence events.\n    public init<Observer: ObserverType>(_ observer: Observer) where Observer.Element == Element {\n        self.observer = observer.on\n    }\n    \n    /// Send `event` to this observer.\n    ///\n    /// - parameter event: Event instance.\n    public func on(_ event: Event<Element>) {\n        self.observer(event)\n    }\n\n    /// Erases type of observer and returns canonical observer.\n    ///\n    /// - returns: type erased observer.\n    public func asObserver() -> AnyObserver<Element> {\n        self\n    }\n}\n\nextension AnyObserver {\n    /// Collection of `AnyObserver`s\n    typealias s = Bag<(Event<Element>) -> Void>\n}\n\nextension ObserverType {\n    /// Erases type of observer and returns canonical observer.\n    ///\n    /// - returns: type erased observer.\n    public func asObserver() -> AnyObserver<Element> {\n        AnyObserver(self)\n    }\n\n    /// Transforms observer of type R to type E using custom transform method.\n    /// Each event sent to result observer is transformed and sent to `self`.\n    ///\n    /// - returns: observer that transforms events.\n    public func mapObserver<Result>(_ transform: @escaping (Result) throws -> Element) -> AnyObserver<Result> {\n        AnyObserver { e in\n            self.on(e.map(transform))\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Binder.swift",
    "content": "//\n//  Binder.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/17/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n/**\n Observer that enforces interface binding rules:\n * can't bind errors (in debug builds binding of errors causes `fatalError` in release builds errors are being logged)\n * ensures binding is performed on a specific scheduler\n\n `Binder` doesn't retain target and in case target is released, element isn't bound.\n \n By default it binds elements on main scheduler.\n */\npublic struct Binder<Value>: ObserverType {\n    public typealias Element = Value\n    \n    private let binding: (Event<Value>) -> Void\n\n    /// Initializes `Binder`\n    ///\n    /// - parameter target: Target object.\n    /// - parameter scheduler: Scheduler used to bind the events.\n    /// - parameter binding: Binding logic.\n    public init<Target: AnyObject>(_ target: Target, scheduler: ImmediateSchedulerType = MainScheduler(), binding: @escaping (Target, Value) -> Void) {\n        weak var weakTarget = target\n\n        self.binding = { event in\n            switch event {\n            case .next(let element):\n                _ = scheduler.schedule(element) { element in\n                    if let target = weakTarget {\n                        binding(target, element)\n                    }\n                    return Disposables.create()\n                }\n            case .error(let error):\n                rxFatalErrorInDebug(\"Binding error: \\(error)\")\n            case .completed:\n                break\n            }\n        }\n    }\n\n    /// Binds next element to owner view as described in `binding`.\n    public func on(_ event: Event<Value>) {\n        self.binding(event)\n    }\n\n    /// Erases type of observer.\n    ///\n    /// - returns: type erased observer.\n    public func asObserver() -> AnyObserver<Value> {\n        AnyObserver(eventHandler: self.on)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Cancelable.swift",
    "content": "//\n//  Cancelable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents disposable resource with state tracking.\npublic protocol Cancelable : Disposable {\n    /// Was resource disposed.\n    var isDisposed: Bool { get }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Concurrency/AsyncLock.swift",
    "content": "//\n//  AsyncLock.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/**\nIn case nobody holds this lock, the work will be queued and executed immediately\non thread that is requesting lock.\n\nIn case there is somebody currently holding that lock, action will be enqueued.\nWhen owned of the lock finishes with it's processing, it will also execute\nand pending work.\n\nThat means that enqueued work could possibly be executed later on a different thread.\n*/\nfinal class AsyncLock<I: InvocableType>\n    : Disposable\n    , Lock\n    , SynchronizedDisposeType {\n    typealias Action = () -> Void\n    \n    private var _lock = SpinLock()\n    \n    private var queue: Queue<I> = Queue(capacity: 0)\n\n    private var isExecuting: Bool = false\n    private var hasFaulted: Bool = false\n\n    // lock {\n    func lock() {\n        self._lock.lock()\n    }\n\n    func unlock() {\n        self._lock.unlock()\n    }\n    // }\n\n    private func enqueue(_ action: I) -> I? {\n        self.lock(); defer { self.unlock() }\n        if self.hasFaulted {\n            return nil\n        }\n        \n        if self.isExecuting {\n            self.queue.enqueue(action)\n            return nil\n        }\n        \n        self.isExecuting = true\n        \n        return action\n    }\n\n    private func dequeue() -> I? {\n        self.lock(); defer { self.unlock() }\n        if !self.queue.isEmpty {\n            return self.queue.dequeue()\n        }\n        else {\n            self.isExecuting = false\n            return nil\n        }\n    }\n\n    func invoke(_ action: I) {\n        let firstEnqueuedAction = self.enqueue(action)\n        \n        if let firstEnqueuedAction = firstEnqueuedAction {\n            firstEnqueuedAction.invoke()\n        }\n        else {\n            // action is enqueued, it's somebody else's concern now\n            return\n        }\n        \n        while true {\n            let nextAction = self.dequeue()\n\n            if let nextAction = nextAction {\n                nextAction.invoke()\n            }\n            else {\n                return\n            }\n        }\n    }\n    \n    func dispose() {\n        self.synchronizedDispose()\n    }\n\n    func synchronized_dispose() {\n        self.queue = Queue(capacity: 0)\n        self.hasFaulted = true\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Concurrency/Lock.swift",
    "content": "//\n//  Lock.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/31/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol Lock {\n    func lock()\n    func unlock()\n}\n\n// https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000321.html\ntypealias SpinLock = RecursiveLock\n\nextension RecursiveLock : Lock {\n    @inline(__always)\n    final func performLocked<T>(_ action: () -> T) -> T {\n        self.lock(); defer { self.unlock() }\n        return action()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Concurrency/LockOwnerType.swift",
    "content": "//\n//  LockOwnerType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 10/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol LockOwnerType: AnyObject, Lock {\n    var lock: RecursiveLock { get }\n}\n\nextension LockOwnerType {\n    func lock() { self.lock.lock() }\n    func unlock() { self.lock.unlock() }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Concurrency/SynchronizedDisposeType.swift",
    "content": "//\n//  SynchronizedDisposeType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 10/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol SynchronizedDisposeType: AnyObject, Disposable, Lock {\n    func synchronized_dispose()\n}\n\nextension SynchronizedDisposeType {\n    func synchronizedDispose() {\n        self.lock(); defer { self.unlock() }\n        self.synchronized_dispose()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Concurrency/SynchronizedOnType.swift",
    "content": "//\n//  SynchronizedOnType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 10/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol SynchronizedOnType: AnyObject, ObserverType, Lock {\n    func synchronized_on(_ event: Event<Element>)\n}\n\nextension SynchronizedOnType {\n    func synchronizedOn(_ event: Event<Element>) {\n        self.lock(); defer { self.unlock() }\n        self.synchronized_on(event)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Concurrency/SynchronizedUnsubscribeType.swift",
    "content": "//\n//  SynchronizedUnsubscribeType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 10/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol SynchronizedUnsubscribeType: AnyObject {\n    associatedtype DisposeKey\n\n    func synchronizedUnsubscribe(_ disposeKey: DisposeKey)\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/ConnectableObservableType.swift",
    "content": "//\n//  ConnectableObservableType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/1/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/**\nRepresents an observable sequence wrapper that can be connected and disconnected from its underlying observable sequence.\n*/\npublic protocol ConnectableObservableType : ObservableType {\n    /**\n    Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established.\n    \n    - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence.\n    */\n    func connect() -> Disposable\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Date+Dispatch.swift",
    "content": "//\n//  Date+Dispatch.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/14/19.\n//  Copyright © 2019 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\nextension DispatchTimeInterval {\n    var convertToSecondsFactor: Double {\n        switch self {\n        case .nanoseconds: return 1_000_000_000.0\n        case .microseconds: return 1_000_000.0\n        case .milliseconds: return 1_000.0\n        case .seconds: return 1.0\n        case .never: fatalError()\n        @unknown default: fatalError()\n        }\n    }\n \n    func map(_ transform: (Int, Double) -> Int) -> DispatchTimeInterval {\n        switch self {\n        case .nanoseconds(let value): return .nanoseconds(transform(value, 1_000_000_000.0))\n        case .microseconds(let value): return .microseconds(transform(value, 1_000_000.0))\n        case .milliseconds(let value): return .milliseconds(transform(value, 1_000.0))\n        case .seconds(let value): return .seconds(transform(value, 1.0))\n        case .never: return .never\n        @unknown default: fatalError()\n        }\n    }\n    \n    var isNow: Bool {\n        switch self {\n        case .nanoseconds(let value), .microseconds(let value), .milliseconds(let value), .seconds(let value): return value == 0\n        case .never: return false\n        @unknown default: fatalError()\n        }\n    }\n    \n    internal func reduceWithSpanBetween(earlierDate: Date, laterDate: Date) -> DispatchTimeInterval {\n        return self.map { value, factor in\n            let interval = laterDate.timeIntervalSince(earlierDate)\n            let remainder = Double(value) - interval * factor\n            guard remainder > 0 else { return 0 }\n            return Int(remainder.rounded(.toNearestOrAwayFromZero))\n        }\n    }\n}\n\nextension Date {\n\n    internal func addingDispatchInterval(_ dispatchInterval: DispatchTimeInterval) -> Date {\n        switch dispatchInterval {\n        case .nanoseconds(let value), .microseconds(let value), .milliseconds(let value), .seconds(let value):\n            return self.addingTimeInterval(TimeInterval(value) / dispatchInterval.convertToSecondsFactor)\n        case .never: return Date.distantFuture\n        @unknown default: fatalError()\n        }\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposable.swift",
    "content": "//\n//  Disposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a disposable resource.\npublic protocol Disposable {\n    /// Dispose resource.\n    func dispose()\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/AnonymousDisposable.swift",
    "content": "//\n//  AnonymousDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents an Action-based disposable.\n///\n/// When dispose method is called, disposal action will be dereferenced.\nprivate final class AnonymousDisposable : DisposeBase, Cancelable {\n    public typealias DisposeAction = () -> Void\n\n    private let disposed = AtomicInt(0)\n    private var disposeAction: DisposeAction?\n\n    /// - returns: Was resource disposed.\n    public var isDisposed: Bool {\n        isFlagSet(self.disposed, 1)\n    }\n\n    /// Constructs a new disposable with the given action used for disposal.\n    ///\n    /// - parameter disposeAction: Disposal action which will be run upon calling `dispose`.\n    private init(_ disposeAction: @escaping DisposeAction) {\n        self.disposeAction = disposeAction\n        super.init()\n    }\n\n    // Non-deprecated version of the constructor, used by `Disposables.create(with:)`\n    fileprivate init(disposeAction: @escaping DisposeAction) {\n        self.disposeAction = disposeAction\n        super.init()\n    }\n\n    /// Calls the disposal action if and only if the current instance hasn't been disposed yet.\n    ///\n    /// After invoking disposal action, disposal action will be dereferenced.\n    fileprivate func dispose() {\n        if fetchOr(self.disposed, 1) == 0 {\n            if let action = self.disposeAction {\n                self.disposeAction = nil\n                action()\n            }\n        }\n    }\n}\n\nextension Disposables {\n\n    /// Constructs a new disposable with the given action used for disposal.\n    ///\n    /// - parameter dispose: Disposal action which will be run upon calling `dispose`.\n    public static func create(with dispose: @escaping () -> Void) -> Cancelable {\n        AnonymousDisposable(disposeAction: dispose)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/BinaryDisposable.swift",
    "content": "//\n//  BinaryDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents two disposable resources that are disposed together.\nprivate final class BinaryDisposable : DisposeBase, Cancelable {\n\n    private let disposed = AtomicInt(0)\n\n    // state\n    private var disposable1: Disposable?\n    private var disposable2: Disposable?\n\n    /// - returns: Was resource disposed.\n    var isDisposed: Bool {\n        isFlagSet(self.disposed, 1)\n    }\n\n    /// Constructs new binary disposable from two disposables.\n    ///\n    /// - parameter disposable1: First disposable\n    /// - parameter disposable2: Second disposable\n    init(_ disposable1: Disposable, _ disposable2: Disposable) {\n        self.disposable1 = disposable1\n        self.disposable2 = disposable2\n        super.init()\n    }\n\n    /// Calls the disposal action if and only if the current instance hasn't been disposed yet.\n    ///\n    /// After invoking disposal action, disposal action will be dereferenced.\n    func dispose() {\n        if fetchOr(self.disposed, 1) == 0 {\n            self.disposable1?.dispose()\n            self.disposable2?.dispose()\n            self.disposable1 = nil\n            self.disposable2 = nil\n        }\n    }\n}\n\nextension Disposables {\n\n    /// Creates a disposable with the given disposables.\n    public static func create(_ disposable1: Disposable, _ disposable2: Disposable) -> Cancelable {\n        BinaryDisposable(disposable1, disposable2)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/BooleanDisposable.swift",
    "content": "//\n//  BooleanDisposable.swift\n//  RxSwift\n//\n//  Created by Junior B. on 10/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a disposable resource that can be checked for disposal status.\npublic final class BooleanDisposable : Cancelable {\n\n    internal static let BooleanDisposableTrue = BooleanDisposable(isDisposed: true)\n    private var disposed = false\n    \n    /// Initializes a new instance of the `BooleanDisposable` class\n    public init() {\n    }\n    \n    /// Initializes a new instance of the `BooleanDisposable` class with given value\n    public init(isDisposed: Bool) {\n        self.disposed = isDisposed\n    }\n    \n    /// - returns: Was resource disposed.\n    public var isDisposed: Bool {\n        self.disposed\n    }\n    \n    /// Sets the status to disposed, which can be observer through the `isDisposed` property.\n    public func dispose() {\n        self.disposed = true\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/CompositeDisposable.swift",
    "content": "//\n//  CompositeDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/20/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a group of disposable resources that are disposed together.\npublic final class CompositeDisposable : DisposeBase, Cancelable {\n    /// Key used to remove disposable from composite disposable\n    public struct DisposeKey {\n        fileprivate let key: BagKey\n        fileprivate init(key: BagKey) {\n            self.key = key\n        }\n    }\n\n    private var lock = SpinLock()\n    \n    // state\n    private var disposables: Bag<Disposable>? = Bag()\n\n    public var isDisposed: Bool {\n        self.lock.performLocked { self.disposables == nil }\n    }\n    \n    public override init() {\n    }\n    \n    /// Initializes a new instance of composite disposable with the specified number of disposables.\n    public init(_ disposable1: Disposable, _ disposable2: Disposable) {\n        // This overload is here to make sure we are using optimized version up to 4 arguments.\n        _ = self.disposables!.insert(disposable1)\n        _ = self.disposables!.insert(disposable2)\n    }\n    \n    /// Initializes a new instance of composite disposable with the specified number of disposables.\n    public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable) {\n        // This overload is here to make sure we are using optimized version up to 4 arguments.\n        _ = self.disposables!.insert(disposable1)\n        _ = self.disposables!.insert(disposable2)\n        _ = self.disposables!.insert(disposable3)\n    }\n    \n    /// Initializes a new instance of composite disposable with the specified number of disposables.\n    public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable, _ disposable4: Disposable, _ disposables: Disposable...) {\n        // This overload is here to make sure we are using optimized version up to 4 arguments.\n        _ = self.disposables!.insert(disposable1)\n        _ = self.disposables!.insert(disposable2)\n        _ = self.disposables!.insert(disposable3)\n        _ = self.disposables!.insert(disposable4)\n        \n        for disposable in disposables {\n            _ = self.disposables!.insert(disposable)\n        }\n    }\n    \n    /// Initializes a new instance of composite disposable with the specified number of disposables.\n    public init(disposables: [Disposable]) {\n        for disposable in disposables {\n            _ = self.disposables!.insert(disposable)\n        }\n    }\n\n    /**\n     Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.\n     \n     - parameter disposable: Disposable to add.\n     - returns: Key that can be used to remove disposable from composite disposable. In case dispose bag was already\n     disposed `nil` will be returned.\n     */\n    public func insert(_ disposable: Disposable) -> DisposeKey? {\n        let key = self._insert(disposable)\n        \n        if key == nil {\n            disposable.dispose()\n        }\n        \n        return key\n    }\n    \n    private func _insert(_ disposable: Disposable) -> DisposeKey? {\n        self.lock.performLocked {\n            let bagKey = self.disposables?.insert(disposable)\n            return bagKey.map(DisposeKey.init)\n        }\n    }\n    \n    /// - returns: Gets the number of disposables contained in the `CompositeDisposable`.\n    public var count: Int {\n        self.lock.performLocked { self.disposables?.count ?? 0 }\n    }\n    \n    /// Removes and disposes the disposable identified by `disposeKey` from the CompositeDisposable.\n    ///\n    /// - parameter disposeKey: Key used to identify disposable to be removed.\n    public func remove(for disposeKey: DisposeKey) {\n        self._remove(for: disposeKey)?.dispose()\n    }\n    \n    private func _remove(for disposeKey: DisposeKey) -> Disposable? {\n        self.lock.performLocked { self.disposables?.removeKey(disposeKey.key) }\n    }\n    \n    /// Disposes all disposables in the group and removes them from the group.\n    public func dispose() {\n        if let disposables = self._dispose() {\n            disposeAll(in: disposables)\n        }\n    }\n\n    private func _dispose() -> Bag<Disposable>? {\n        self.lock.performLocked {\n            let current = self.disposables\n            self.disposables = nil\n            return current\n        }\n    }\n}\n\nextension Disposables {\n\n    /// Creates a disposable with the given disposables.\n    public static func create(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable) -> Cancelable {\n        CompositeDisposable(disposable1, disposable2, disposable3)\n    }\n    \n    /// Creates a disposable with the given disposables.\n    public static func create(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable, _ disposables: Disposable ...) -> Cancelable {\n        var disposables = disposables\n        disposables.append(disposable1)\n        disposables.append(disposable2)\n        disposables.append(disposable3)\n        return CompositeDisposable(disposables: disposables)\n    }\n    \n    /// Creates a disposable with the given disposables.\n    public static func create(_ disposables: [Disposable]) -> Cancelable {\n        switch disposables.count {\n        case 2:\n            return Disposables.create(disposables[0], disposables[1])\n        default:\n            return CompositeDisposable(disposables: disposables)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/Disposables.swift",
    "content": "//\n//  Disposables.swift\n//  RxSwift\n//\n//  Created by Mohsen Ramezanpoor on 01/08/2016.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n/// A collection of utility methods for common disposable operations.\npublic struct Disposables {\n    private init() {}\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/DisposeBag.swift",
    "content": "//\n//  DisposeBag.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension Disposable {\n    /// Adds `self` to `bag`\n    ///\n    /// - parameter bag: `DisposeBag` to add `self` to.\n    public func disposed(by bag: DisposeBag) {\n        bag.insert(self)\n    }\n}\n\n/**\nThread safe bag that disposes added disposables on `deinit`.\n\nThis returns ARC (RAII) like resource management to `RxSwift`.\n\nIn case contained disposables need to be disposed, just put a different dispose bag\nor create a new one in its place.\n\n    self.existingDisposeBag = DisposeBag()\n\nIn case explicit disposal is necessary, there is also `CompositeDisposable`.\n*/\npublic final class DisposeBag: DisposeBase {\n    \n    private var lock = SpinLock()\n    \n    // state\n    private var disposables = [Disposable]()\n    private var isDisposed = false\n    \n    /// Constructs new empty dispose bag.\n    public override init() {\n        super.init()\n    }\n\n    /// Adds `disposable` to be disposed when dispose bag is being deinited.\n    ///\n    /// - parameter disposable: Disposable to add.\n    public func insert(_ disposable: Disposable) {\n        self._insert(disposable)?.dispose()\n    }\n    \n    private func _insert(_ disposable: Disposable) -> Disposable? {\n        self.lock.performLocked {\n            if self.isDisposed {\n                return disposable\n            }\n\n            self.disposables.append(disposable)\n\n            return nil\n        }\n    }\n\n    /// This is internal on purpose, take a look at `CompositeDisposable` instead.\n    private func dispose() {\n        let oldDisposables = self._dispose()\n\n        for disposable in oldDisposables {\n            disposable.dispose()\n        }\n    }\n\n    private func _dispose() -> [Disposable] {\n        self.lock.performLocked {\n            let disposables = self.disposables\n            \n            self.disposables.removeAll(keepingCapacity: false)\n            self.isDisposed = true\n            \n            return disposables\n        }\n    }\n    \n    deinit {\n        self.dispose()\n    }\n}\n\nextension DisposeBag {\n    /// Convenience init allows a list of disposables to be gathered for disposal.\n    public convenience init(disposing disposables: Disposable...) {\n        self.init()\n        self.disposables += disposables\n    }\n\n    /// Convenience init which utilizes a function builder to let you pass in a list of\n    /// disposables to make a DisposeBag of.\n    public convenience init(@DisposableBuilder builder: () -> [Disposable]) {\n      self.init(disposing: builder())\n    }\n\n    /// Convenience init allows an array of disposables to be gathered for disposal.\n    public convenience init(disposing disposables: [Disposable]) {\n        self.init()\n        self.disposables += disposables\n    }\n\n    /// Convenience function allows a list of disposables to be gathered for disposal.\n    public func insert(_ disposables: Disposable...) {\n        self.insert(disposables)\n    }\n\n    /// Convenience function allows a list of disposables to be gathered for disposal.\n    public func insert(@DisposableBuilder builder: () -> [Disposable]) {\n        self.insert(builder())\n    }\n\n    /// Convenience function allows an array of disposables to be gathered for disposal.\n    public func insert(_ disposables: [Disposable]) {\n        self.lock.performLocked {\n            if self.isDisposed {\n                disposables.forEach { $0.dispose() }\n            } else {\n                self.disposables += disposables\n            }\n        }\n    }\n\n    /// A function builder accepting a list of Disposables and returning them as an array.\n    #if swift(>=5.4)\n    @resultBuilder\n    public struct DisposableBuilder {\n      public static func buildBlock(_ disposables: Disposable...) -> [Disposable] {\n        return disposables\n      }\n    }\n    #else\n    @_functionBuilder\n    public struct DisposableBuilder {\n      public static func buildBlock(_ disposables: Disposable...) -> [Disposable] {\n        return disposables\n      }\n    }\n    #endif\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/DisposeBase.swift",
    "content": "//\n//  DisposeBase.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/4/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Base class for all disposables.\npublic class DisposeBase {\n    init() {\n#if TRACE_RESOURCES\n    _ = Resources.incrementTotal()\n#endif\n    }\n    \n    deinit {\n#if TRACE_RESOURCES\n    _ = Resources.decrementTotal()\n#endif\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/NopDisposable.swift",
    "content": "//\n//  NopDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a disposable that does nothing on disposal.\n///\n/// Nop = No Operation\nprivate struct NopDisposable : Disposable {\n \n    fileprivate static let noOp: Disposable = NopDisposable()\n    \n    private init() {\n        \n    }\n    \n    /// Does nothing.\n    public func dispose() {\n    }\n}\n\nextension Disposables {\n    /**\n     Creates a disposable that does nothing on disposal.\n     */\n    static public func create() -> Disposable { NopDisposable.noOp }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/RefCountDisposable.swift",
    "content": "//\n//  RefCountDisposable.swift\n//  RxSwift\n//\n//  Created by Junior B. on 10/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.\npublic final class RefCountDisposable : DisposeBase, Cancelable {\n    private var lock = SpinLock()\n    private var disposable = nil as Disposable?\n    private var primaryDisposed = false\n    private var count = 0\n\n    /// - returns: Was resource disposed.\n    public var isDisposed: Bool {\n        self.lock.performLocked { self.disposable == nil }\n    }\n\n    /// Initializes a new instance of the `RefCountDisposable`.\n    public init(disposable: Disposable) {\n        self.disposable = disposable\n        super.init()\n    }\n\n    /**\n     Holds a dependent disposable that when disposed decreases the refcount on the underlying disposable.\n\n     When getter is called, a dependent disposable contributing to the reference count that manages the underlying disposable's lifetime is returned.\n     */\n    public func retain() -> Disposable {\n        self.lock.performLocked {\n            if self.disposable != nil {\n                do {\n                    _ = try incrementChecked(&self.count)\n                } catch {\n                    rxFatalError(\"RefCountDisposable increment failed\")\n                }\n\n                return RefCountInnerDisposable(self)\n            } else {\n                return Disposables.create()\n            }\n        }\n    }\n\n    /// Disposes the underlying disposable only when all dependent disposables have been disposed.\n    public func dispose() {\n        let oldDisposable: Disposable? = self.lock.performLocked {\n            if let oldDisposable = self.disposable, !self.primaryDisposed {\n                self.primaryDisposed = true\n\n                if self.count == 0 {\n                    self.disposable = nil\n                    return oldDisposable\n                }\n            }\n\n            return nil\n        }\n\n        if let disposable = oldDisposable {\n            disposable.dispose()\n        }\n    }\n\n    fileprivate func release() {\n        let oldDisposable: Disposable? = self.lock.performLocked {\n            if let oldDisposable = self.disposable {\n                do {\n                    _ = try decrementChecked(&self.count)\n                } catch {\n                    rxFatalError(\"RefCountDisposable decrement on release failed\")\n                }\n\n                guard self.count >= 0 else {\n                    rxFatalError(\"RefCountDisposable counter is lower than 0\")\n                }\n\n                if self.primaryDisposed && self.count == 0 {\n                    self.disposable = nil\n                    return oldDisposable\n                }\n            }\n\n            return nil\n        }\n\n        if let disposable = oldDisposable {\n            disposable.dispose()\n        }\n    }\n}\n\ninternal final class RefCountInnerDisposable: DisposeBase, Disposable\n{\n    private let parent: RefCountDisposable\n    private let isDisposed = AtomicInt(0)\n\n    init(_ parent: RefCountDisposable) {\n        self.parent = parent\n        super.init()\n    }\n\n    internal func dispose()\n    {\n        if fetchOr(self.isDisposed, 1) == 0 {\n            self.parent.release()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/ScheduledDisposable.swift",
    "content": "//\n//  ScheduledDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/13/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprivate let disposeScheduledDisposable: (ScheduledDisposable) -> Disposable = { sd in\n    sd.disposeInner()\n    return Disposables.create()\n}\n\n/// Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler.\npublic final class ScheduledDisposable : Cancelable {\n    public let scheduler: ImmediateSchedulerType\n\n    private let disposed = AtomicInt(0)\n\n    // state\n    private var disposable: Disposable?\n\n    /// - returns: Was resource disposed.\n    public var isDisposed: Bool {\n        isFlagSet(self.disposed, 1)\n    }\n\n    /**\n    Initializes a new instance of the `ScheduledDisposable` that uses a `scheduler` on which to dispose the `disposable`.\n\n    - parameter scheduler: Scheduler where the disposable resource will be disposed on.\n    - parameter disposable: Disposable resource to dispose on the given scheduler.\n    */\n    public init(scheduler: ImmediateSchedulerType, disposable: Disposable) {\n        self.scheduler = scheduler\n        self.disposable = disposable\n    }\n\n    /// Disposes the wrapped disposable on the provided scheduler.\n    public func dispose() {\n        _ = self.scheduler.schedule(self, action: disposeScheduledDisposable)\n    }\n\n    func disposeInner() {\n        if fetchOr(self.disposed, 1) == 0 {\n            self.disposable!.dispose()\n            self.disposable = nil\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/SerialDisposable.swift",
    "content": "//\n//  SerialDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.\npublic final class SerialDisposable : DisposeBase, Cancelable {\n    private var lock = SpinLock()\n    \n    // state\n    private var current = nil as Disposable?\n    private var disposed = false\n    \n    /// - returns: Was resource disposed.\n    public var isDisposed: Bool {\n        self.disposed\n    }\n    \n    /// Initializes a new instance of the `SerialDisposable`.\n    override public init() {\n        super.init()\n    }\n    \n    /**\n    Gets or sets the underlying disposable.\n    \n    Assigning this property disposes the previous disposable object.\n    \n    If the `SerialDisposable` has already been disposed, assignment to this property causes immediate disposal of the given disposable object.\n    */\n    public var disposable: Disposable {\n        get {\n            self.lock.performLocked {\n                self.current ?? Disposables.create()\n            }\n        }\n        set (newDisposable) {\n            let disposable: Disposable? = self.lock.performLocked {\n                if self.isDisposed {\n                    return newDisposable\n                }\n                else {\n                    let toDispose = self.current\n                    self.current = newDisposable\n                    return toDispose\n                }\n            }\n            \n            if let disposable = disposable {\n                disposable.dispose()\n            }\n        }\n    }\n    \n    /// Disposes the underlying disposable as well as all future replacements.\n    public func dispose() {\n        self._dispose()?.dispose()\n    }\n\n    private func _dispose() -> Disposable? {\n        self.lock.performLocked {\n            guard !self.isDisposed else { return nil }\n\n            self.disposed = true\n            let current = self.current\n            self.current = nil\n            return current\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/SingleAssignmentDisposable.swift",
    "content": "//\n//  SingleAssignmentDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/**\nRepresents a disposable resource which only allows a single assignment of its underlying disposable resource.\n\nIf an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an exception.\n*/\npublic final class SingleAssignmentDisposable : DisposeBase, Cancelable {\n\n    private struct DisposeState: OptionSet {\n        let rawValue: Int32\n        \n        static let disposed = DisposeState(rawValue: 1 << 0)\n        static let disposableSet = DisposeState(rawValue: 1 << 1)\n    }\n\n    // state\n    private let state = AtomicInt(0)\n    private var disposable = nil as Disposable?\n\n    /// - returns: A value that indicates whether the object is disposed.\n    public var isDisposed: Bool {\n        isFlagSet(self.state, DisposeState.disposed.rawValue)\n    }\n\n    /// Initializes a new instance of the `SingleAssignmentDisposable`.\n    public override init() {\n        super.init()\n    }\n\n    /// Gets or sets the underlying disposable. After disposal, the result of getting this property is undefined.\n    ///\n    /// **Throws exception if the `SingleAssignmentDisposable` has already been assigned to.**\n    public func setDisposable(_ disposable: Disposable) {\n        self.disposable = disposable\n\n        let previousState = fetchOr(self.state, DisposeState.disposableSet.rawValue)\n\n        if (previousState & DisposeState.disposableSet.rawValue) != 0 {\n            rxFatalError(\"oldState.disposable != nil\")\n        }\n\n        if (previousState & DisposeState.disposed.rawValue) != 0 {\n            disposable.dispose()\n            self.disposable = nil\n        }\n    }\n\n    /// Disposes the underlying disposable.\n    public func dispose() {\n        let previousState = fetchOr(self.state, DisposeState.disposed.rawValue)\n\n        if (previousState & DisposeState.disposed.rawValue) != 0 {\n            return\n        }\n\n        if (previousState & DisposeState.disposableSet.rawValue) != 0 {\n            guard let disposable = self.disposable else {\n                rxFatalError(\"Disposable not set\")\n            }\n            disposable.dispose()\n            self.disposable = nil\n        }\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Disposables/SubscriptionDisposable.swift",
    "content": "//\n//  SubscriptionDisposable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 10/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nstruct SubscriptionDisposable<T: SynchronizedUnsubscribeType> : Disposable {\n    private let key: T.DisposeKey\n    private weak var owner: T?\n\n    init(owner: T, key: T.DisposeKey) {\n        self.owner = owner\n        self.key = key\n    }\n\n    func dispose() {\n        self.owner?.synchronizedUnsubscribe(self.key)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Errors.swift",
    "content": "//\n//  Errors.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nlet RxErrorDomain       = \"RxErrorDomain\"\nlet RxCompositeFailures = \"RxCompositeFailures\"\n\n/// Generic Rx error codes.\npublic enum RxError\n    : Swift.Error\n    , CustomDebugStringConvertible {\n    /// Unknown error occurred.\n    case unknown\n    /// Performing an action on disposed object.\n    case disposed(object: AnyObject)\n    /// Arithmetic overflow error.\n    case overflow\n    /// Argument out of range error.\n    case argumentOutOfRange\n    /// Sequence doesn't contain any elements.\n    case noElements\n    /// Sequence contains more than one element.\n    case moreThanOneElement\n    /// Timeout error.\n    case timeout\n}\n\nextension RxError {\n    /// A textual representation of `self`, suitable for debugging.\n    public var debugDescription: String {\n        switch self {\n        case .unknown:\n            return \"Unknown error occurred.\"\n        case .disposed(let object):\n            return \"Object `\\(object)` was already disposed.\"\n        case .overflow:\n            return \"Arithmetic overflow occurred.\"\n        case .argumentOutOfRange:\n            return \"Argument out of range.\"\n        case .noElements:\n            return \"Sequence doesn't contain any elements.\"\n        case .moreThanOneElement:\n            return \"Sequence contains more than one element.\"\n        case .timeout:\n            return \"Sequence timeout.\"\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Event.swift",
    "content": "//\n//  Event.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a sequence event.\n///\n/// Sequence grammar: \n/// **next\\* (error | completed)**\n@frozen public enum Event<Element> {\n    /// Next element is produced.\n    case next(Element)\n\n    /// Sequence terminated with an error.\n    case error(Swift.Error)\n\n    /// Sequence completed successfully.\n    case completed\n}\n\nextension Event: CustomDebugStringConvertible {\n    /// Description of event.\n    public var debugDescription: String {\n        switch self {\n        case .next(let value):\n            return \"next(\\(value))\"\n        case .error(let error):\n            return \"error(\\(error))\"\n        case .completed:\n            return \"completed\"\n        }\n    }\n}\n\nextension Event {\n    /// Is `completed` or `error` event.\n    public var isStopEvent: Bool {\n        switch self {\n        case .next: return false\n        case .error, .completed: return true\n        }\n    }\n\n    /// If `next` event, returns element value.\n    public var element: Element? {\n        if case .next(let value) = self {\n            return value\n        }\n        return nil\n    }\n\n    /// If `error` event, returns error.\n    public var error: Swift.Error? {\n        if case .error(let error) = self {\n            return error\n        }\n        return nil\n    }\n\n    /// If `completed` event, returns `true`.\n    public var isCompleted: Bool {\n        if case .completed = self {\n            return true\n        }\n        return false\n    }\n}\n\nextension Event {\n    /// Maps sequence elements using transform. If error happens during the transform, `.error`\n    /// will be returned as value.\n    public func map<Result>(_ transform: (Element) throws -> Result) -> Event<Result> {\n        do {\n            switch self {\n            case let .next(element):\n                return .next(try transform(element))\n            case let .error(error):\n                return .error(error)\n            case .completed:\n                return .completed\n            }\n        }\n        catch let e {\n            return .error(e)\n        }\n    }\n}\n\n/// A type that can be converted to `Event<Element>`.\npublic protocol EventConvertible {\n    /// Type of element in event\n    associatedtype Element\n\n    /// Event representation of this instance\n    var event: Event<Element> { get }\n}\n\nextension Event: EventConvertible {\n    /// Event representation of this instance\n    public var event: Event<Element> { self }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Extensions/Bag+Rx.swift",
    "content": "//\n//  Bag+Rx.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 10/19/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n\n// MARK: forEach\n\n@inline(__always)\nfunc dispatch<Element>(_ bag: Bag<(Event<Element>) -> Void>, _ event: Event<Element>) {\n    bag._value0?(event)\n\n    if bag._onlyFastPath {\n        return\n    }\n\n    let pairs = bag._pairs\n    for i in 0 ..< pairs.count {\n        pairs[i].value(event)\n    }\n\n    if let dictionary = bag._dictionary {\n        for element in dictionary.values {\n            element(event)\n        }\n    }\n}\n\n/// Dispatches `dispose` to all disposables contained inside bag.\nfunc disposeAll(in bag: Bag<Disposable>) {\n    bag._value0?.dispose()\n\n    if bag._onlyFastPath {\n        return\n    }\n\n    let pairs = bag._pairs\n    for i in 0 ..< pairs.count {\n        pairs[i].value.dispose()\n    }\n\n    if let dictionary = bag._dictionary {\n        for element in dictionary.values {\n            element.dispose()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/GroupedObservable.swift",
    "content": "//\n//  GroupedObservable.swift\n//  RxSwift\n//\n//  Created by Tomi Koskinen on 01/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents an observable sequence of elements that have a common key.\npublic struct GroupedObservable<Key, Element> : ObservableType {\n    /// Gets the common key.\n    public let key: Key\n\n    private let source: Observable<Element>\n\n    /// Initializes grouped observable sequence with key and source observable sequence.\n    ///\n    /// - parameter key: Grouped observable sequence key\n    /// - parameter source: Observable sequence that represents sequence of elements for the key\n    /// - returns: Grouped observable sequence of elements for the specific key\n    public init(key: Key, source: Observable<Element>) {\n        self.key = key\n        self.source = source\n    }\n\n    /// Subscribes `observer` to receive events for this sequence.\n    public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.source.subscribe(observer)\n    }\n\n    /// Converts `self` to `Observable` sequence. \n    public func asObservable() -> Observable<Element> {\n        self.source\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/ImmediateSchedulerType.swift",
    "content": "//\n//  ImmediateSchedulerType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/31/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents an object that immediately schedules units of work.\npublic protocol ImmediateSchedulerType {\n    /**\n    Schedules an action to be executed immediately.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable\n}\n\nextension ImmediateSchedulerType {\n    /**\n    Schedules an action to be executed recursively.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func scheduleRecursive<State>(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> Void) -> Void) -> Disposable {\n        let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self)\n        \n        recursiveScheduler.schedule(state)\n        \n        return Disposables.create(with: recursiveScheduler.dispose)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observable+Concurrency.swift",
    "content": "//\n//  Observable+Concurrency.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 22/09/2021.\n//  Copyright © 2021 Krunoslav Zaher. All rights reserved.\n//\n\n#if swift(>=5.5.2) && canImport(_Concurrency)\nimport Foundation\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic extension ObservableConvertibleType {\n    /// Allows iterating over the values of an Observable\n    /// asynchronously via Swift's concurrency features (`async/await`)\n    ///\n    /// A sample usage would look like so:\n    ///\n    /// ```swift\n    /// do {\n    ///     for try await value in observable.values {\n    ///         // Handle emitted values\n    ///     }\n    /// } catch {\n    ///     // Handle error\n    /// }\n    /// ```\n    var values: AsyncThrowingStream<Element, Error> {\n        AsyncThrowingStream<Element, Error> { continuation in\n            let disposable = asObservable().subscribe(\n                onNext: { value in continuation.yield(value) },\n                onError: { error in continuation.finish(throwing: error) },\n                onCompleted: { continuation.finish() },\n                onDisposed: { continuation.onTermination?(.cancelled) }\n            )\n\n            continuation.onTermination = { @Sendable _ in\n                disposable.dispose()\n            }\n        }\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic extension AsyncSequence {\n    /// Convert an `AsyncSequence` to an `Observable` emitting\n    /// values of the asynchronous sequence's type\n    ///\n    /// - returns: An `Observable` of the async sequence's type\n    func asObservable() -> Observable<Element> {\n        Observable.create { observer in\n            let task = Task {\n                do {\n                    for try await value in self {\n                        observer.onNext(value)\n                    }\n\n                    observer.onCompleted()\n                } catch {\n                    observer.onError(error)\n                }\n            }\n\n            return Disposables.create { task.cancel() }\n        }\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observable.swift",
    "content": "//\n//  Observable.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// A type-erased `ObservableType`. \n///\n/// It represents a push style sequence.\npublic class Observable<Element> : ObservableType {\n    init() {\n#if TRACE_RESOURCES\n        _ = Resources.incrementTotal()\n#endif\n    }\n    \n    public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        rxAbstractMethod()\n    }\n    \n    public func asObservable() -> Observable<Element> { self }\n    \n    deinit {\n#if TRACE_RESOURCES\n        _ = Resources.decrementTotal()\n#endif\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/ObservableConvertibleType.swift",
    "content": "//\n//  ObservableConvertibleType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/17/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Type that can be converted to observable sequence (`Observable<Element>`).\npublic protocol ObservableConvertibleType {\n    /// Type of elements in sequence.\n    associatedtype Element\n\n    /// Converts `self` to `Observable` sequence.\n    ///\n    /// - returns: Observable sequence that represents `self`.\n    func asObservable() -> Observable<Element>\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/ObservableType+Extensions.swift",
    "content": "//\n//  ObservableType+Extensions.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if DEBUG\n    import Foundation\n#endif\n\nextension ObservableType {\n    /**\n     Subscribes an event handler to an observable sequence.\n     \n     - parameter on: Action to invoke for each event in the observable sequence.\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe(_ on: @escaping (Event<Element>) -> Void) -> Disposable {\n        let observer = AnonymousObserver { e in\n            on(e)\n        }\n        return self.asObservable().subscribe(observer)\n    }\n    \n    /**\n     Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.\n     \n     Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.\n     \n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n     - parameter object: The object to provide an unretained reference on.\n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe<Object: AnyObject>(\n        with object: Object,\n        onNext: ((Object, Element) -> Void)? = nil,\n        onError: ((Object, Swift.Error) -> Void)? = nil,\n        onCompleted: ((Object) -> Void)? = nil,\n        onDisposed: ((Object) -> Void)? = nil\n    ) -> Disposable {\n        subscribe(\n            onNext: { [weak object] in\n                guard let object = object else { return }\n                onNext?(object, $0)\n            },\n            onError: { [weak object] in\n                guard let object = object else { return }\n                onError?(object, $0)\n            },\n            onCompleted: { [weak object] in\n                guard let object = object else { return }\n                onCompleted?(object)\n            },\n            onDisposed: { [weak object] in\n                guard let object = object else { return }\n                onDisposed?(object)\n            }\n        )\n    }\n    \n    /**\n     Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.\n     \n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe(\n        onNext: ((Element) -> Void)? = nil,\n        onError: ((Swift.Error) -> Void)? = nil,\n        onCompleted: (() -> Void)? = nil,\n        onDisposed: (() -> Void)? = nil\n    ) -> Disposable {\n            let disposable: Disposable\n            \n            if let disposed = onDisposed {\n                disposable = Disposables.create(with: disposed)\n            }\n            else {\n                disposable = Disposables.create()\n            }\n            \n            #if DEBUG\n                let synchronizationTracker = SynchronizationTracker()\n            #endif\n            \n            let callStack = Hooks.recordCallStackOnError ? Hooks.customCaptureSubscriptionCallstack() : []\n            \n            let observer = AnonymousObserver<Element> { event in\n                \n                #if DEBUG\n                    synchronizationTracker.register(synchronizationErrorMessage: .default)\n                    defer { synchronizationTracker.unregister() }\n                #endif\n                \n                switch event {\n                case .next(let value):\n                    onNext?(value)\n                case .error(let error):\n                    if let onError = onError {\n                        onError(error)\n                    }\n                    else {\n                        Hooks.defaultErrorHandler(callStack, error)\n                    }\n                    disposable.dispose()\n                case .completed:\n                    onCompleted?()\n                    disposable.dispose()\n                }\n            }\n            return Disposables.create(\n                self.asObservable().subscribe(observer),\n                disposable\n            )\n    }\n}\n\nimport Foundation\n\nextension Hooks {\n    public typealias DefaultErrorHandler = (_ subscriptionCallStack: [String], _ error: Error) -> Void\n    public typealias CustomCaptureSubscriptionCallstack = () -> [String]\n\n    private static let lock = RecursiveLock()\n    private static var _defaultErrorHandler: DefaultErrorHandler = { subscriptionCallStack, error in\n        #if DEBUG\n            let serializedCallStack = subscriptionCallStack.joined(separator: \"\\n\")\n            print(\"Unhandled error happened: \\(error)\")\n            if !serializedCallStack.isEmpty {\n                print(\"subscription called from:\\n\\(serializedCallStack)\")\n            }\n        #endif\n    }\n    private static var _customCaptureSubscriptionCallstack: CustomCaptureSubscriptionCallstack = {\n        #if DEBUG\n            return Thread.callStackSymbols\n        #else\n            return []\n        #endif\n    }\n\n    /// Error handler called in case onError handler wasn't provided.\n    public static var defaultErrorHandler: DefaultErrorHandler {\n        get {\n            lock.performLocked { _defaultErrorHandler }\n        }\n        set {\n            lock.performLocked { _defaultErrorHandler = newValue }\n        }\n    }\n    \n    /// Subscription callstack block to fetch custom callstack information.\n    public static var customCaptureSubscriptionCallstack: CustomCaptureSubscriptionCallstack {\n        get {\n            lock.performLocked { _customCaptureSubscriptionCallstack }\n        }\n        set {\n            lock.performLocked { _customCaptureSubscriptionCallstack = newValue }\n        }\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/ObservableType.swift",
    "content": "//\n//  ObservableType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a push style sequence.\npublic protocol ObservableType: ObservableConvertibleType {\n    /**\n    Subscribes `observer` to receive events for this sequence.\n    \n    ### Grammar\n    \n    **Next\\* (Error | Completed)?**\n    \n    * sequences can produce zero or more elements so zero or more `Next` events can be sent to `observer`\n    * once an `Error` or `Completed` event is sent, the sequence terminates and can't produce any other elements\n    \n    It is possible that events are sent from different threads, but no two events can be sent concurrently to\n    `observer`.\n    \n    ### Resource Management\n    \n    When sequence sends `Complete` or `Error` event all internal resources that compute sequence elements\n    will be freed.\n    \n    To cancel production of sequence elements and free resources immediately, call `dispose` on returned\n    subscription.\n    \n    - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources.\n    */\n    func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element\n}\n\nextension ObservableType {\n    \n    /// Default implementation of converting `ObservableType` to `Observable`.\n    public func asObservable() -> Observable<Element> {\n        // temporary workaround\n        //return Observable.create(subscribe: self.subscribe)\n        Observable.create { o in self.subscribe(o) }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/AddRef.swift",
    "content": "//\n//  AddRef.swift\n//  RxSwift\n//\n//  Created by Junior B. on 30/10/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nfinal class AddRefSink<Observer: ObserverType> : Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    \n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.forwardOn(event)\n        case .completed, .error:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n}\n\nfinal class AddRef<Element> : Producer<Element> {\n    \n    private let source: Observable<Element>\n    private let refCount: RefCountDisposable\n    \n    init(source: Observable<Element>, refCount: RefCountDisposable) {\n        self.source = source\n        self.refCount = refCount\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let releaseDisposable = self.refCount.retain()\n        let sink = AddRefSink(observer: observer, cancel: cancel)\n        let subscription = Disposables.create(releaseDisposable, self.source.subscribe(sink))\n\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Amb.swift",
    "content": "//\n//  Amb.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Propagates the observable sequence that reacts first.\n\n     - seealso: [amb operator on reactivex.io](http://reactivex.io/documentation/operators/amb.html)\n\n     - returns: An observable sequence that surfaces any of the given sequences, whichever reacted first.\n     */\n    public static func amb<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>\n        where Sequence.Element == Observable<Element> {\n        sequence.reduce(Observable<Sequence.Element.Element>.never()) { a, o in\n            a.amb(o.asObservable())\n        }\n    }\n}\n\nextension ObservableType {\n\n    /**\n     Propagates the observable sequence that reacts first.\n\n     - seealso: [amb operator on reactivex.io](http://reactivex.io/documentation/operators/amb.html)\n\n     - parameter right: Second observable sequence.\n     - returns: An observable sequence that surfaces either of the given sequences, whichever reacted first.\n     */\n    public func amb<O2: ObservableType>\n        (_ right: O2)\n        -> Observable<Element> where O2.Element == Element {\n        Amb(left: self.asObservable(), right: right.asObservable())\n    }\n}\n\nprivate enum AmbState {\n    case neither\n    case left\n    case right\n}\n\nfinal private class AmbObserver<Observer: ObserverType>: ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = AmbSink<Observer>\n    typealias This = AmbObserver<Observer>\n    typealias Sink = (This, Event<Element>) -> Void\n    \n    private let parent: Parent\n    fileprivate var sink: Sink\n    fileprivate var cancel: Disposable\n    \n    init(parent: Parent, cancel: Disposable, sink: @escaping Sink) {\n#if TRACE_RESOURCES\n        _ = Resources.incrementTotal()\n#endif\n        \n        self.parent = parent\n        self.sink = sink\n        self.cancel = cancel\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.sink(self, event)\n        if event.isStopEvent {\n            self.cancel.dispose()\n        }\n    }\n    \n    deinit {\n#if TRACE_RESOURCES\n        _ = Resources.decrementTotal()\n#endif\n    }\n}\n\nfinal private class AmbSink<Observer: ObserverType>: Sink<Observer> {\n    typealias Element = Observer.Element\n    typealias Parent = Amb<Element>\n    typealias AmbObserverType = AmbObserver<Observer>\n\n    private let parent: Parent\n    \n    private let lock = RecursiveLock()\n    // state\n    private var choice = AmbState.neither\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let disposeAll = Disposables.create(subscription1, subscription2)\n        \n        let forwardEvent = { (o: AmbObserverType, event: Event<Element>) -> Void in\n            self.forwardOn(event)\n            if event.isStopEvent {\n                self.dispose()\n            }\n        }\n\n        let decide = { (o: AmbObserverType, event: Event<Element>, me: AmbState, otherSubscription: Disposable) in\n            self.lock.performLocked {\n                if self.choice == .neither {\n                    self.choice = me\n                    o.sink = forwardEvent\n                    o.cancel = disposeAll\n                    otherSubscription.dispose()\n                }\n                \n                if self.choice == me {\n                    self.forwardOn(event)\n                    if event.isStopEvent {\n                        self.dispose()\n                    }\n                }\n            }\n        }\n        \n        let sink1 = AmbObserver(parent: self, cancel: subscription1) { o, e in\n            decide(o, e, .left, subscription2)\n        }\n        \n        let sink2 = AmbObserver(parent: self, cancel: subscription1) { o, e in\n            decide(o, e, .right, subscription1)\n        }\n        \n        subscription1.setDisposable(self.parent.left.subscribe(sink1))\n        subscription2.setDisposable(self.parent.right.subscribe(sink2))\n        \n        return disposeAll\n    }\n}\n\nfinal private class Amb<Element>: Producer<Element> {\n    fileprivate let left: Observable<Element>\n    fileprivate let right: Observable<Element>\n    \n    init(left: Observable<Element>, right: Observable<Element>) {\n        self.left = left\n        self.right = right\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = AmbSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/AsMaybe.swift",
    "content": "//\n//  AsMaybe.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/12/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nprivate final class AsMaybeSink<Observer: ObserverType> : Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element\n\n    private var element: Event<Element>?\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            if self.element != nil {\n                self.forwardOn(.error(RxError.moreThanOneElement))\n                self.dispose()\n            }\n\n            self.element = event\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            if let element = self.element {\n                self.forwardOn(element)\n            }\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal class AsMaybe<Element>: Producer<Element> {\n    private let source: Observable<Element>\n\n    init(source: Observable<Element>) {\n        self.source = source\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = AsMaybeSink(observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/AsSingle.swift",
    "content": "//\n//  AsSingle.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/12/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nprivate final class AsSingleSink<Observer: ObserverType> : Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element\n\n    private var element: Event<Element>?\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            if self.element != nil {\n                self.forwardOn(.error(RxError.moreThanOneElement))\n                self.dispose()\n            }\n\n            self.element = event\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            if let element = self.element {\n                self.forwardOn(element)\n                self.forwardOn(.completed)\n            }\n            else {\n                self.forwardOn(.error(RxError.noElements))\n            }\n            self.dispose()\n        }\n    }\n}\n\nfinal class AsSingle<Element>: Producer<Element> {\n    private let source: Observable<Element>\n\n    init(source: Observable<Element>) {\n        self.source = source\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = AsSingleSink(observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Buffer.swift",
    "content": "//\n//  Buffer.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/13/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Projects each element of an observable sequence into a buffer that's sent out when either it's full or a given amount of time has elapsed, using the specified scheduler to run timers.\n\n     A useful real-world analogy of this overload is the behavior of a ferry leaving the dock when all seats are taken, or at the scheduled time of departure, whichever event occurs first.\n\n     - seealso: [buffer operator on reactivex.io](http://reactivex.io/documentation/operators/buffer.html)\n\n     - parameter timeSpan: Maximum time length of a buffer.\n     - parameter count: Maximum element count of a buffer.\n     - parameter scheduler: Scheduler to run buffering timers on.\n     - returns: An observable sequence of buffers.\n     */\n    public func buffer(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType)\n        -> Observable<[Element]> {\n        BufferTimeCount(source: self.asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler)\n    }\n}\n\nfinal private class BufferTimeCount<Element>: Producer<[Element]> {\n    \n    fileprivate let timeSpan: RxTimeInterval\n    fileprivate let count: Int\n    fileprivate let scheduler: SchedulerType\n    fileprivate let source: Observable<Element>\n    \n    init(source: Observable<Element>, timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) {\n        self.source = source\n        self.timeSpan = timeSpan\n        self.count = count\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == [Element] {\n        let sink = BufferTimeCountSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class BufferTimeCountSink<Element, Observer: ObserverType>\n    : Sink<Observer>\n    , LockOwnerType\n    , ObserverType\n    , SynchronizedOnType where Observer.Element == [Element] {\n    typealias Parent = BufferTimeCount<Element>\n    \n    private let parent: Parent\n    \n    let lock = RecursiveLock()\n    \n    // state\n    private let timerD = SerialDisposable()\n    private var buffer = [Element]()\n    private var windowID = 0\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n \n    func run() -> Disposable {\n        self.createTimer(self.windowID)\n        return Disposables.create(timerD, parent.source.subscribe(self))\n    }\n    \n    func startNewWindowAndSendCurrentOne() {\n        self.windowID = self.windowID &+ 1\n        let windowID = self.windowID\n        \n        let buffer = self.buffer\n        self.buffer = []\n        self.forwardOn(.next(buffer))\n        \n        self.createTimer(windowID)\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next(let element):\n            self.buffer.append(element)\n            \n            if self.buffer.count == self.parent.count {\n                self.startNewWindowAndSendCurrentOne()\n            }\n            \n        case .error(let error):\n            self.buffer = []\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.forwardOn(.next(self.buffer))\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n    \n    func createTimer(_ windowID: Int) {\n        if self.timerD.isDisposed {\n            return\n        }\n        \n        if self.windowID != windowID {\n            return\n        }\n\n        let nextTimer = SingleAssignmentDisposable()\n        \n        self.timerD.disposable = nextTimer\n\n        let disposable = self.parent.scheduler.scheduleRelative(windowID, dueTime: self.parent.timeSpan) { previousWindowID in\n            self.lock.performLocked {\n                if previousWindowID != self.windowID {\n                    return\n                }\n             \n                self.startNewWindowAndSendCurrentOne()\n            }\n            \n            return Disposables.create()\n        }\n\n        nextTimer.setDisposable(disposable)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Catch.swift",
    "content": "//\n//  Catch.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter handler: Error handler function, producing another observable sequence.\n     - returns: An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an error occurred.\n     */\n    public func `catch`(_ handler: @escaping (Swift.Error) throws -> Observable<Element>)\n        -> Observable<Element> {\n        Catch(source: self.asObservable(), handler: handler)\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter handler: Error handler function, producing another observable sequence.\n     - returns: An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an error occurred.\n     */\n    @available(*, deprecated, renamed: \"catch(_:)\")\n    public func catchError(_ handler: @escaping (Swift.Error) throws -> Observable<Element>)\n        -> Observable<Element> {\n        `catch`(handler)\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with a single element.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter element: Last element in an observable sequence in case error occurs.\n     - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred.\n     */\n    public func catchAndReturn(_ element: Element)\n        -> Observable<Element> {\n        Catch(source: self.asObservable(), handler: { _ in Observable.just(element) })\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with a single element.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter element: Last element in an observable sequence in case error occurs.\n     - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred.\n     */\n    @available(*, deprecated, renamed: \"catchAndReturn(_:)\")\n    public func catchErrorJustReturn(_ element: Element)\n        -> Observable<Element> {\n        catchAndReturn(element)\n    }\n}\n\nextension ObservableType {\n    /**\n     Continues an observable sequence that is terminated by an error with the next observable sequence.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - returns: An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.\n     */\n    @available(*, deprecated, renamed: \"catch(onSuccess:onFailure:onDisposed:)\")\n    public static func catchError<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>\n        where Sequence.Element == Observable<Element> {\n        `catch`(sequence: sequence)\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with the next observable sequence.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - returns: An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.\n     */\n    public static func `catch`<Sequence: Swift.Sequence>(sequence: Sequence) -> Observable<Element>\n        where Sequence.Element == Observable<Element> {\n        CatchSequence(sources: sequence)\n    }\n}\n\nextension ObservableType {\n\n    /**\n     Repeats the source observable sequence until it successfully terminates.\n\n     **This could potentially create an infinite sequence.**\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - returns: Observable sequence to repeat until it successfully terminates.\n     */\n    public func retry() -> Observable<Element> {\n        CatchSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()))\n    }\n\n    /**\n     Repeats the source observable sequence the specified number of times in case of an error or until it successfully terminates.\n\n     If you encounter an error and want it to retry once, then you must use `retry(2)`\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter maxAttemptCount: Maximum number of times to repeat the sequence.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.\n     */\n    public func retry(_ maxAttemptCount: Int)\n        -> Observable<Element> {\n        CatchSequence(sources: Swift.repeatElement(self.asObservable(), count: maxAttemptCount))\n    }\n}\n\n// catch with callback\n\nfinal private class CatchSinkProxy<Observer: ObserverType>: ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = CatchSink<Observer>\n    \n    private let parent: Parent\n    \n    init(parent: Parent) {\n        self.parent = parent\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.parent.forwardOn(event)\n        \n        switch event {\n        case .next:\n            break\n        case .error, .completed:\n            self.parent.dispose()\n        }\n    }\n}\n\nfinal private class CatchSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = Catch<Element>\n    \n    private let parent: Parent\n    private let subscription = SerialDisposable()\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        let d1 = SingleAssignmentDisposable()\n        self.subscription.disposable = d1\n        d1.setDisposable(self.parent.source.subscribe(self))\n\n        return self.subscription\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.forwardOn(event)\n        case .completed:\n            self.forwardOn(event)\n            self.dispose()\n        case .error(let error):\n            do {\n                let catchSequence = try self.parent.handler(error)\n\n                let observer = CatchSinkProxy(parent: self)\n                \n                self.subscription.disposable = catchSequence.subscribe(observer)\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        }\n    }\n}\n\nfinal private class Catch<Element>: Producer<Element> {\n    typealias Handler = (Swift.Error) throws -> Observable<Element>\n    \n    fileprivate let source: Observable<Element>\n    fileprivate let handler: Handler\n    \n    init(source: Observable<Element>, handler: @escaping Handler) {\n        self.source = source\n        self.handler = handler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = CatchSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n// catch enumerable\n\nfinal private class CatchSequenceSink<Sequence: Swift.Sequence, Observer: ObserverType>\n    : TailRecursiveSink<Sequence, Observer>\n    , ObserverType where Sequence.Element: ObservableConvertibleType, Sequence.Element.Element == Observer.Element {\n    typealias Element = Observer.Element\n    typealias Parent = CatchSequence<Sequence>\n\n    private var lastError: Swift.Error?\n    \n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.forwardOn(event)\n        case .error(let error):\n            self.lastError = error\n            self.schedule(.moveNext)\n        case .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n\n    override func subscribeToNext(_ source: Observable<Element>) -> Disposable {\n        source.subscribe(self)\n    }\n    \n    override func done() {\n        if let lastError = self.lastError {\n            self.forwardOn(.error(lastError))\n        }\n        else {\n            self.forwardOn(.completed)\n        }\n        \n        self.dispose()\n    }\n    \n    override func extract(_ observable: Observable<Element>) -> SequenceGenerator? {\n        if let onError = observable as? CatchSequence<Sequence> {\n            return (onError.sources.makeIterator(), nil)\n        }\n        else {\n            return nil\n        }\n    }\n}\n\nfinal private class CatchSequence<Sequence: Swift.Sequence>: Producer<Sequence.Element.Element> where Sequence.Element: ObservableConvertibleType {\n    typealias Element = Sequence.Element.Element\n    \n    let sources: Sequence\n    \n    init(sources: Sequence) {\n        self.sources = sources\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = CatchSequenceSink<Sequence, Observer>(observer: observer, cancel: cancel)\n        let subscription = sink.run((self.sources.makeIterator(), nil))\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/CombineLatest+Collection.swift",
    "content": "//\n//  CombineLatest+Collection.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/29/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n     - seealso: [combinelatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n     - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n     - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n     */\n    public static func combineLatest<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable<Element>\n        where Collection.Element: ObservableType {\n        CombineLatestCollectionType(sources: collection, resultSelector: resultSelector)\n    }\n\n    /**\n     Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.\n\n     - seealso: [combinelatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n     - returns: An observable sequence containing the result of combining elements of the sources.\n     */\n    public static func combineLatest<Collection: Swift.Collection>(_ collection: Collection) -> Observable<[Element]>\n        where Collection.Element: ObservableType, Collection.Element.Element == Element {\n        CombineLatestCollectionType(sources: collection, resultSelector: { $0 })\n    }\n}\n\nfinal private class CombineLatestCollectionTypeSink<Collection: Swift.Collection, Observer: ObserverType>\n    : Sink<Observer> where Collection.Element: ObservableConvertibleType {\n    typealias Result = Observer.Element \n    typealias Parent = CombineLatestCollectionType<Collection, Result>\n    typealias SourceElement = Collection.Element.Element\n    \n    let parent: Parent\n    \n    let lock = RecursiveLock()\n\n    // state\n    var numberOfValues = 0\n    var values: [SourceElement?]\n    var isDone: [Bool]\n    var numberOfDone = 0\n    var subscriptions: [SingleAssignmentDisposable]\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.values = [SourceElement?](repeating: nil, count: parent.count)\n        self.isDone = [Bool](repeating: false, count: parent.count)\n        self.subscriptions = [SingleAssignmentDisposable]()\n        self.subscriptions.reserveCapacity(parent.count)\n        \n        for _ in 0 ..< parent.count {\n            self.subscriptions.append(SingleAssignmentDisposable())\n        }\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<SourceElement>, atIndex: Int) {\n        self.lock.lock(); defer { self.lock.unlock() }\n        switch event {\n        case .next(let element):\n            if self.values[atIndex] == nil {\n                self.numberOfValues += 1\n            }\n            \n            self.values[atIndex] = element\n            \n            if self.numberOfValues < self.parent.count {\n                let numberOfOthersThatAreDone = self.numberOfDone - (self.isDone[atIndex] ? 1 : 0)\n                if numberOfOthersThatAreDone == self.parent.count - 1 {\n                    self.forwardOn(.completed)\n                    self.dispose()\n                }\n                return\n            }\n            \n            do {\n                let result = try self.parent.resultSelector(self.values.map { $0! })\n                self.forwardOn(.next(result))\n            }\n            catch let error {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n            \n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            if self.isDone[atIndex] {\n                return\n            }\n            \n            self.isDone[atIndex] = true\n            self.numberOfDone += 1\n            \n            if self.numberOfDone == self.parent.count {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n            else {\n                self.subscriptions[atIndex].dispose()\n            }\n        }\n    }\n    \n    func run() -> Disposable {\n        var j = 0\n        for i in self.parent.sources {\n            let index = j\n            let source = i.asObservable()\n            let disposable = source.subscribe(AnyObserver { event in\n                self.on(event, atIndex: index)\n            })\n\n            self.subscriptions[j].setDisposable(disposable)\n            \n            j += 1\n        }\n\n        if self.parent.sources.isEmpty {\n            do {\n                let result = try self.parent.resultSelector([])\n                self.forwardOn(.next(result))\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n            catch let error {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n        }\n        \n        return Disposables.create(subscriptions)\n    }\n}\n\nfinal private class CombineLatestCollectionType<Collection: Swift.Collection, Result>: Producer<Result> where Collection.Element: ObservableConvertibleType {\n    typealias ResultSelector = ([Collection.Element.Element]) throws -> Result\n    \n    let sources: Collection\n    let resultSelector: ResultSelector\n    let count: Int\n\n    init(sources: Collection, resultSelector: @escaping ResultSelector) {\n        self.sources = sources\n        self.resultSelector = resultSelector\n        self.count = self.sources.count\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestCollectionTypeSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/CombineLatest+arity.swift",
    "content": "// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \n//\n//  CombineLatest+arity.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/22/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n\n\n// 2\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType>\n        (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)\n            -> Observable<Element> {\n        return CombineLatest2(\n            source1: source1.asObservable(), source2: source2.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType>\n        (_ source1: O1, _ source2: O2)\n            -> Observable<(O1.Element, O2.Element)> {\n        return CombineLatest2(\n            source1: source1.asObservable(), source2: source2.asObservable(),\n            resultSelector: { ($0, $1) }\n        )\n    }\n}\n\nfinal class CombineLatestSink2_<E1, E2, Observer: ObserverType> : CombineLatestSink<Observer> {\n    typealias Result = Observer.Element\n    typealias Parent = CombineLatest2<E1, E2, Result>\n\n    let parent: Parent\n\n    var latestElement1: E1! = nil\n    var latestElement2: E2! = nil\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 2, observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n\n        let observer1 = CombineLatestObserver(lock: self.lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self.latestElement1 = e }, this: subscription1)\n        let observer2 = CombineLatestObserver(lock: self.lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self.latestElement2 = e }, this: subscription2)\n\n         subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n         subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n\n        return Disposables.create([\n                subscription1,\n                subscription2\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.latestElement1, self.latestElement2)\n    }\n}\n\nfinal class CombineLatest2<E1, E2, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestSink2_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 3\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)\n            -> Observable<Element> {\n        return CombineLatest3(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3)\n            -> Observable<(O1.Element, O2.Element, O3.Element)> {\n        return CombineLatest3(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(),\n            resultSelector: { ($0, $1, $2) }\n        )\n    }\n}\n\nfinal class CombineLatestSink3_<E1, E2, E3, Observer: ObserverType> : CombineLatestSink<Observer> {\n    typealias Result = Observer.Element\n    typealias Parent = CombineLatest3<E1, E2, E3, Result>\n\n    let parent: Parent\n\n    var latestElement1: E1! = nil\n    var latestElement2: E2! = nil\n    var latestElement3: E3! = nil\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 3, observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n\n        let observer1 = CombineLatestObserver(lock: self.lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self.latestElement1 = e }, this: subscription1)\n        let observer2 = CombineLatestObserver(lock: self.lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self.latestElement2 = e }, this: subscription2)\n        let observer3 = CombineLatestObserver(lock: self.lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self.latestElement3 = e }, this: subscription3)\n\n         subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n         subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n         subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n\n        return Disposables.create([\n                subscription1,\n                subscription2,\n                subscription3\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.latestElement1, self.latestElement2, self.latestElement3)\n    }\n}\n\nfinal class CombineLatest3<E1, E2, E3, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestSink3_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 4\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)\n            -> Observable<Element> {\n        return CombineLatest4(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)\n            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)> {\n        return CombineLatest4(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(),\n            resultSelector: { ($0, $1, $2, $3) }\n        )\n    }\n}\n\nfinal class CombineLatestSink4_<E1, E2, E3, E4, Observer: ObserverType> : CombineLatestSink<Observer> {\n    typealias Result = Observer.Element\n    typealias Parent = CombineLatest4<E1, E2, E3, E4, Result>\n\n    let parent: Parent\n\n    var latestElement1: E1! = nil\n    var latestElement2: E2! = nil\n    var latestElement3: E3! = nil\n    var latestElement4: E4! = nil\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 4, observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n\n        let observer1 = CombineLatestObserver(lock: self.lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self.latestElement1 = e }, this: subscription1)\n        let observer2 = CombineLatestObserver(lock: self.lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self.latestElement2 = e }, this: subscription2)\n        let observer3 = CombineLatestObserver(lock: self.lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self.latestElement3 = e }, this: subscription3)\n        let observer4 = CombineLatestObserver(lock: self.lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self.latestElement4 = e }, this: subscription4)\n\n         subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n         subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n         subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n         subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n\n        return Disposables.create([\n                subscription1,\n                subscription2,\n                subscription3,\n                subscription4\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.latestElement1, self.latestElement2, self.latestElement3, self.latestElement4)\n    }\n}\n\nfinal class CombineLatest4<E1, E2, E3, E4, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestSink4_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 5\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)\n            -> Observable<Element> {\n        return CombineLatest5(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)\n            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)> {\n        return CombineLatest5(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4) }\n        )\n    }\n}\n\nfinal class CombineLatestSink5_<E1, E2, E3, E4, E5, Observer: ObserverType> : CombineLatestSink<Observer> {\n    typealias Result = Observer.Element\n    typealias Parent = CombineLatest5<E1, E2, E3, E4, E5, Result>\n\n    let parent: Parent\n\n    var latestElement1: E1! = nil\n    var latestElement2: E2! = nil\n    var latestElement3: E3! = nil\n    var latestElement4: E4! = nil\n    var latestElement5: E5! = nil\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 5, observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n\n        let observer1 = CombineLatestObserver(lock: self.lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self.latestElement1 = e }, this: subscription1)\n        let observer2 = CombineLatestObserver(lock: self.lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self.latestElement2 = e }, this: subscription2)\n        let observer3 = CombineLatestObserver(lock: self.lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self.latestElement3 = e }, this: subscription3)\n        let observer4 = CombineLatestObserver(lock: self.lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self.latestElement4 = e }, this: subscription4)\n        let observer5 = CombineLatestObserver(lock: self.lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self.latestElement5 = e }, this: subscription5)\n\n         subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n         subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n         subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n         subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n         subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n\n        return Disposables.create([\n                subscription1,\n                subscription2,\n                subscription3,\n                subscription4,\n                subscription5\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.latestElement1, self.latestElement2, self.latestElement3, self.latestElement4, self.latestElement5)\n    }\n}\n\nfinal class CombineLatest5<E1, E2, E3, E4, E5, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestSink5_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 6\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)\n            -> Observable<Element> {\n        return CombineLatest6(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)\n            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)> {\n        return CombineLatest6(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4, $5) }\n        )\n    }\n}\n\nfinal class CombineLatestSink6_<E1, E2, E3, E4, E5, E6, Observer: ObserverType> : CombineLatestSink<Observer> {\n    typealias Result = Observer.Element\n    typealias Parent = CombineLatest6<E1, E2, E3, E4, E5, E6, Result>\n\n    let parent: Parent\n\n    var latestElement1: E1! = nil\n    var latestElement2: E2! = nil\n    var latestElement3: E3! = nil\n    var latestElement4: E4! = nil\n    var latestElement5: E5! = nil\n    var latestElement6: E6! = nil\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 6, observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n        let subscription6 = SingleAssignmentDisposable()\n\n        let observer1 = CombineLatestObserver(lock: self.lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self.latestElement1 = e }, this: subscription1)\n        let observer2 = CombineLatestObserver(lock: self.lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self.latestElement2 = e }, this: subscription2)\n        let observer3 = CombineLatestObserver(lock: self.lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self.latestElement3 = e }, this: subscription3)\n        let observer4 = CombineLatestObserver(lock: self.lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self.latestElement4 = e }, this: subscription4)\n        let observer5 = CombineLatestObserver(lock: self.lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self.latestElement5 = e }, this: subscription5)\n        let observer6 = CombineLatestObserver(lock: self.lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self.latestElement6 = e }, this: subscription6)\n\n         subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n         subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n         subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n         subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n         subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n         subscription6.setDisposable(self.parent.source6.subscribe(observer6))\n\n        return Disposables.create([\n                subscription1,\n                subscription2,\n                subscription3,\n                subscription4,\n                subscription5,\n                subscription6\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.latestElement1, self.latestElement2, self.latestElement3, self.latestElement4, self.latestElement5, self.latestElement6)\n    }\n}\n\nfinal class CombineLatest6<E1, E2, E3, E4, E5, E6, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5, E6) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n    let source6: Observable<E6>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, source6: Observable<E6>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n        self.source6 = source6\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestSink6_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 7\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)\n            -> Observable<Element> {\n        return CombineLatest7(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)\n            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)> {\n        return CombineLatest7(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4, $5, $6) }\n        )\n    }\n}\n\nfinal class CombineLatestSink7_<E1, E2, E3, E4, E5, E6, E7, Observer: ObserverType> : CombineLatestSink<Observer> {\n    typealias Result = Observer.Element\n    typealias Parent = CombineLatest7<E1, E2, E3, E4, E5, E6, E7, Result>\n\n    let parent: Parent\n\n    var latestElement1: E1! = nil\n    var latestElement2: E2! = nil\n    var latestElement3: E3! = nil\n    var latestElement4: E4! = nil\n    var latestElement5: E5! = nil\n    var latestElement6: E6! = nil\n    var latestElement7: E7! = nil\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 7, observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n        let subscription6 = SingleAssignmentDisposable()\n        let subscription7 = SingleAssignmentDisposable()\n\n        let observer1 = CombineLatestObserver(lock: self.lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self.latestElement1 = e }, this: subscription1)\n        let observer2 = CombineLatestObserver(lock: self.lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self.latestElement2 = e }, this: subscription2)\n        let observer3 = CombineLatestObserver(lock: self.lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self.latestElement3 = e }, this: subscription3)\n        let observer4 = CombineLatestObserver(lock: self.lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self.latestElement4 = e }, this: subscription4)\n        let observer5 = CombineLatestObserver(lock: self.lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self.latestElement5 = e }, this: subscription5)\n        let observer6 = CombineLatestObserver(lock: self.lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self.latestElement6 = e }, this: subscription6)\n        let observer7 = CombineLatestObserver(lock: self.lock, parent: self, index: 6, setLatestValue: { (e: E7) -> Void in self.latestElement7 = e }, this: subscription7)\n\n         subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n         subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n         subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n         subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n         subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n         subscription6.setDisposable(self.parent.source6.subscribe(observer6))\n         subscription7.setDisposable(self.parent.source7.subscribe(observer7))\n\n        return Disposables.create([\n                subscription1,\n                subscription2,\n                subscription3,\n                subscription4,\n                subscription5,\n                subscription6,\n                subscription7\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.latestElement1, self.latestElement2, self.latestElement3, self.latestElement4, self.latestElement5, self.latestElement6, self.latestElement7)\n    }\n}\n\nfinal class CombineLatest7<E1, E2, E3, E4, E5, E6, E7, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n    let source6: Observable<E6>\n    let source7: Observable<E7>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, source6: Observable<E6>, source7: Observable<E7>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n        self.source6 = source6\n        self.source7 = source7\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestSink7_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 8\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)\n            -> Observable<Element> {\n        return CombineLatest8(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func combineLatest<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)\n            -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)> {\n        return CombineLatest8(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4, $5, $6, $7) }\n        )\n    }\n}\n\nfinal class CombineLatestSink8_<E1, E2, E3, E4, E5, E6, E7, E8, Observer: ObserverType> : CombineLatestSink<Observer> {\n    typealias Result = Observer.Element\n    typealias Parent = CombineLatest8<E1, E2, E3, E4, E5, E6, E7, E8, Result>\n\n    let parent: Parent\n\n    var latestElement1: E1! = nil\n    var latestElement2: E2! = nil\n    var latestElement3: E3! = nil\n    var latestElement4: E4! = nil\n    var latestElement5: E5! = nil\n    var latestElement6: E6! = nil\n    var latestElement7: E7! = nil\n    var latestElement8: E8! = nil\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 8, observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n        let subscription6 = SingleAssignmentDisposable()\n        let subscription7 = SingleAssignmentDisposable()\n        let subscription8 = SingleAssignmentDisposable()\n\n        let observer1 = CombineLatestObserver(lock: self.lock, parent: self, index: 0, setLatestValue: { (e: E1) -> Void in self.latestElement1 = e }, this: subscription1)\n        let observer2 = CombineLatestObserver(lock: self.lock, parent: self, index: 1, setLatestValue: { (e: E2) -> Void in self.latestElement2 = e }, this: subscription2)\n        let observer3 = CombineLatestObserver(lock: self.lock, parent: self, index: 2, setLatestValue: { (e: E3) -> Void in self.latestElement3 = e }, this: subscription3)\n        let observer4 = CombineLatestObserver(lock: self.lock, parent: self, index: 3, setLatestValue: { (e: E4) -> Void in self.latestElement4 = e }, this: subscription4)\n        let observer5 = CombineLatestObserver(lock: self.lock, parent: self, index: 4, setLatestValue: { (e: E5) -> Void in self.latestElement5 = e }, this: subscription5)\n        let observer6 = CombineLatestObserver(lock: self.lock, parent: self, index: 5, setLatestValue: { (e: E6) -> Void in self.latestElement6 = e }, this: subscription6)\n        let observer7 = CombineLatestObserver(lock: self.lock, parent: self, index: 6, setLatestValue: { (e: E7) -> Void in self.latestElement7 = e }, this: subscription7)\n        let observer8 = CombineLatestObserver(lock: self.lock, parent: self, index: 7, setLatestValue: { (e: E8) -> Void in self.latestElement8 = e }, this: subscription8)\n\n         subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n         subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n         subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n         subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n         subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n         subscription6.setDisposable(self.parent.source6.subscribe(observer6))\n         subscription7.setDisposable(self.parent.source7.subscribe(observer7))\n         subscription8.setDisposable(self.parent.source8.subscribe(observer8))\n\n        return Disposables.create([\n                subscription1,\n                subscription2,\n                subscription3,\n                subscription4,\n                subscription5,\n                subscription6,\n                subscription7,\n                subscription8\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.latestElement1, self.latestElement2, self.latestElement3, self.latestElement4, self.latestElement5, self.latestElement6, self.latestElement7, self.latestElement8)\n    }\n}\n\nfinal class CombineLatest8<E1, E2, E3, E4, E5, E6, E7, E8, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n    let source6: Observable<E6>\n    let source7: Observable<E7>\n    let source8: Observable<E8>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, source6: Observable<E6>, source7: Observable<E7>, source8: Observable<E8>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n        self.source6 = source6\n        self.source7 = source7\n        self.source8 = source8\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = CombineLatestSink8_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/CombineLatest.swift",
    "content": "//\n//  CombineLatest.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol CombineLatestProtocol: AnyObject {\n    func next(_ index: Int)\n    func fail(_ error: Swift.Error)\n    func done(_ index: Int)\n}\n\nclass CombineLatestSink<Observer: ObserverType>\n    : Sink<Observer>\n    , CombineLatestProtocol {\n    typealias Element = Observer.Element \n   \n    let lock = RecursiveLock()\n\n    private let arity: Int\n    private var numberOfValues = 0\n    private var numberOfDone = 0\n    private var hasValue: [Bool]\n    private var isDone: [Bool]\n   \n    init(arity: Int, observer: Observer, cancel: Cancelable) {\n        self.arity = arity\n        self.hasValue = [Bool](repeating: false, count: arity)\n        self.isDone = [Bool](repeating: false, count: arity)\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func getResult() throws -> Element {\n        rxAbstractMethod()\n    }\n    \n    func next(_ index: Int) {\n        if !self.hasValue[index] {\n            self.hasValue[index] = true\n            self.numberOfValues += 1\n        }\n\n        if self.numberOfValues == self.arity {\n            do {\n                let result = try self.getResult()\n                self.forwardOn(.next(result))\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        }\n        else {\n            var allOthersDone = true\n\n            for i in 0 ..< self.arity {\n                if i != index && !self.isDone[i] {\n                    allOthersDone = false\n                    break\n                }\n            }\n            \n            if allOthersDone {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n        }\n    }\n    \n    func fail(_ error: Swift.Error) {\n        self.forwardOn(.error(error))\n        self.dispose()\n    }\n    \n    func done(_ index: Int) {\n        if self.isDone[index] {\n            return\n        }\n\n        self.isDone[index] = true\n        self.numberOfDone += 1\n\n        if self.numberOfDone == self.arity {\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal class CombineLatestObserver<Element>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias ValueSetter = (Element) -> Void\n    \n    private let parent: CombineLatestProtocol\n    \n    let lock: RecursiveLock\n    private let index: Int\n    private let this: Disposable\n    private let setLatestValue: ValueSetter\n    \n    init(lock: RecursiveLock, parent: CombineLatestProtocol, index: Int, setLatestValue: @escaping ValueSetter, this: Disposable) {\n        self.lock = lock\n        self.parent = parent\n        self.index = index\n        self.this = this\n        self.setLatestValue = setLatestValue\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            self.setLatestValue(value)\n            self.parent.next(self.index)\n        case .error(let error):\n            self.this.dispose()\n            self.parent.fail(error)\n        case .completed:\n            self.this.dispose()\n            self.parent.done(self.index)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/CompactMap.swift",
    "content": "//\n//  CompactMap.swift\n//  RxSwift\n//\n//  Created by Michael Long on 04/09/2019.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Projects each element of an observable sequence into an optional form and filters all optional results.\n\n     - parameter transform: A transform function to apply to each source element and which returns an element or nil.\n     - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source.\n\n     */\n    public func compactMap<Result>(_ transform: @escaping (Element) throws -> Result?)\n        -> Observable<Result> {\n        CompactMap(source: self.asObservable(), transform: transform)\n    }\n}\n\nfinal private class CompactMapSink<SourceType, Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Transform = (SourceType) throws -> ResultType?\n\n    typealias ResultType = Observer.Element \n    typealias Element = SourceType\n\n    private let transform: Transform\n\n    init(transform: @escaping Transform, observer: Observer, cancel: Cancelable) {\n        self.transform = transform\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func on(_ event: Event<SourceType>) {\n        switch event {\n        case .next(let element):\n            do {\n                if let mappedElement = try self.transform(element) {\n                    self.forwardOn(.next(mappedElement))\n                }\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class CompactMap<SourceType, ResultType>: Producer<ResultType> {\n    typealias Transform = (SourceType) throws -> ResultType?\n\n    private let source: Observable<SourceType>\n\n    private let transform: Transform\n\n    init(source: Observable<SourceType>, transform: @escaping Transform) {\n        self.source = source\n        self.transform = transform\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType {\n        let sink = CompactMapSink(transform: self.transform, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Concat.swift",
    "content": "//\n//  Concat.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Concatenates the second observable sequence to `self` upon successful termination of `self`.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - parameter second: Second observable sequence.\n     - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.\n     */\n    public func concat<Source: ObservableConvertibleType>(_ second: Source) -> Observable<Element> where Source.Element == Element {\n        Observable.concat([self.asObservable(), second.asObservable()])\n    }\n}\n\nextension ObservableType {\n    /**\n     Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.\n\n     This operator has tail recursive optimizations that will prevent stack overflow.\n\n     Optimizations will be performed in cases equivalent to following:\n\n     [1, [2, [3, .....].concat()].concat].concat()\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Observable<Element>\n        where Sequence.Element == Observable<Element> {\n            return Concat(sources: sequence, count: nil)\n    }\n\n    /**\n     Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.\n\n     This operator has tail recursive optimizations that will prevent stack overflow.\n\n     Optimizations will be performed in cases equivalent to following:\n\n     [1, [2, [3, .....].concat()].concat].concat()\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Observable<Element>\n        where Collection.Element == Observable<Element> {\n            return Concat(sources: collection, count: Int64(collection.count))\n    }\n\n    /**\n     Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.\n\n     This operator has tail recursive optimizations that will prevent stack overflow.\n\n     Optimizations will be performed in cases equivalent to following:\n\n     [1, [2, [3, .....].concat()].concat].concat()\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat(_ sources: Observable<Element> ...) -> Observable<Element> {\n        Concat(sources: sources, count: Int64(sources.count))\n    }\n}\n\nfinal private class ConcatSink<Sequence: Swift.Sequence, Observer: ObserverType>\n    : TailRecursiveSink<Sequence, Observer>\n    , ObserverType where Sequence.Element: ObservableConvertibleType, Sequence.Element.Element == Observer.Element {\n    typealias Element = Observer.Element \n    \n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>){\n        switch event {\n        case .next:\n            self.forwardOn(event)\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            self.schedule(.moveNext)\n        }\n    }\n\n    override func subscribeToNext(_ source: Observable<Element>) -> Disposable {\n        source.subscribe(self)\n    }\n    \n    override func extract(_ observable: Observable<Element>) -> SequenceGenerator? {\n        if let source = observable as? Concat<Sequence> {\n            return (source.sources.makeIterator(), source.count)\n        }\n        else {\n            return nil\n        }\n    }\n}\n\nfinal private class Concat<Sequence: Swift.Sequence>: Producer<Sequence.Element.Element> where Sequence.Element: ObservableConvertibleType {\n    typealias Element = Sequence.Element.Element\n    \n    fileprivate let sources: Sequence\n    fileprivate let count: IntMax?\n\n    init(sources: Sequence, count: IntMax?) {\n        self.sources = sources\n        self.count = count\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = ConcatSink<Sequence, Observer>(observer: observer, cancel: cancel)\n        let subscription = sink.run((self.sources.makeIterator(), self.count))\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Create.swift",
    "content": "//\n//  Create.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    // MARK: create\n\n    /**\n     Creates an observable sequence from a specified subscribe method implementation.\n\n     - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html)\n\n     - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method.\n     - returns: The observable sequence with the specified implementation for the `subscribe` method.\n     */\n    public static func create(_ subscribe: @escaping (AnyObserver<Element>) -> Disposable) -> Observable<Element> {\n        AnonymousObservable(subscribe)\n    }\n}\n\nfinal private class AnonymousObservableSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = AnonymousObservable<Element>\n\n    // state\n    private let isStopped = AtomicInt(0)\n\n    #if DEBUG\n        private let synchronizationTracker = SynchronizationTracker()\n    #endif\n\n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func on(_ event: Event<Element>) {\n        #if DEBUG\n            self.synchronizationTracker.register(synchronizationErrorMessage: .default)\n            defer { self.synchronizationTracker.unregister() }\n        #endif\n        switch event {\n        case .next:\n            if load(self.isStopped) == 1 {\n                return\n            }\n            self.forwardOn(event)\n        case .error, .completed:\n            if fetchOr(self.isStopped, 1) == 0 {\n                self.forwardOn(event)\n                self.dispose()\n            }\n        }\n    }\n\n    func run(_ parent: Parent) -> Disposable {\n        parent.subscribeHandler(AnyObserver(self))\n    }\n}\n\nfinal private class AnonymousObservable<Element>: Producer<Element> {\n    typealias SubscribeHandler = (AnyObserver<Element>) -> Disposable\n\n    let subscribeHandler: SubscribeHandler\n\n    init(_ subscribeHandler: @escaping SubscribeHandler) {\n        self.subscribeHandler = subscribeHandler\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = AnonymousObservableSink(observer: observer, cancel: cancel)\n        let subscription = sink.run(self)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Debounce.swift",
    "content": "//\n//  Debounce.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/11/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers.\n\n     - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html)\n\n     - parameter dueTime: Throttling duration for each element.\n     - parameter scheduler: Scheduler to run the throttle timers on.\n     - returns: The throttled sequence.\n     */\n    public func debounce(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n            return Debounce(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler)\n    }\n}\n\nfinal private class DebounceSink<Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias Element = Observer.Element \n    typealias ParentType = Debounce<Element>\n\n    private let parent: ParentType\n\n    let lock = RecursiveLock()\n\n    // state\n    private var id = 0 as UInt64\n    private var value: Element?\n\n    let cancellable = SerialDisposable()\n\n    init(parent: ParentType, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription = self.parent.source.subscribe(self)\n\n        return Disposables.create(subscription, cancellable)\n    }\n\n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next(let element):\n            self.id = self.id &+ 1\n            let currentId = self.id\n            self.value = element\n\n\n            let scheduler = self.parent.scheduler\n            let dueTime = self.parent.dueTime\n\n            let d = SingleAssignmentDisposable()\n            self.cancellable.disposable = d\n            d.setDisposable(scheduler.scheduleRelative(currentId, dueTime: dueTime, action: self.propagate))\n        case .error:\n            self.value = nil\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            if let value = self.value {\n                self.value = nil\n                self.forwardOn(.next(value))\n            }\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n\n    func propagate(_ currentId: UInt64) -> Disposable {\n        self.lock.performLocked {\n            let originalValue = self.value\n\n            if let value = originalValue, self.id == currentId {\n                self.value = nil\n                self.forwardOn(.next(value))\n            }\n\n            return Disposables.create()\n        }\n    }\n}\n\nfinal private class Debounce<Element>: Producer<Element> {\n    fileprivate let source: Observable<Element>\n    fileprivate let dueTime: RxTimeInterval\n    fileprivate let scheduler: SchedulerType\n\n    init(source: Observable<Element>, dueTime: RxTimeInterval, scheduler: SchedulerType) {\n        self.source = source\n        self.dueTime = dueTime\n        self.scheduler = scheduler\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = DebounceSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Debug.swift",
    "content": "//\n//  Debug.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/2/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\nextension ObservableType {\n\n    /**\n     Prints received events for all observers on standard output.\n\n     - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html)\n\n     - parameter identifier: Identifier that is printed together with event description to standard output.\n     - parameter trimOutput: Should output be trimmed to max 40 characters.\n     - returns: An observable sequence whose events are printed to standard output.\n     */\n    public func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function)\n        -> Observable<Element> {\n            return Debug(source: self, identifier: identifier, trimOutput: trimOutput, file: file, line: line, function: function)\n    }\n}\n\nprivate let dateFormat = \"yyyy-MM-dd HH:mm:ss.SSS\"\n\nprivate func logEvent(_ identifier: String, dateFormat: DateFormatter, content: String) {\n    print(\"\\(dateFormat.string(from: Date())): \\(identifier) -> \\(content)\")\n}\n\nfinal private class DebugSink<Source: ObservableType, Observer: ObserverType>: Sink<Observer>, ObserverType where Observer.Element == Source.Element {\n    typealias Element = Observer.Element \n    typealias Parent = Debug<Source>\n    \n    private let parent: Parent\n    private let timestampFormatter = DateFormatter()\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.timestampFormatter.dateFormat = dateFormat\n\n        logEvent(self.parent.identifier, dateFormat: self.timestampFormatter, content: \"subscribed\")\n\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        let maxEventTextLength = 40\n        let eventText = \"\\(event)\"\n\n        let eventNormalized = (eventText.count > maxEventTextLength) && self.parent.trimOutput\n            ? String(eventText.prefix(maxEventTextLength / 2)) + \"...\" + String(eventText.suffix(maxEventTextLength / 2))\n            : eventText\n\n        logEvent(self.parent.identifier, dateFormat: self.timestampFormatter, content: \"Event \\(eventNormalized)\")\n\n        self.forwardOn(event)\n        if event.isStopEvent {\n            self.dispose()\n        }\n    }\n    \n    override func dispose() {\n        if !self.isDisposed {\n            logEvent(self.parent.identifier, dateFormat: self.timestampFormatter, content: \"isDisposed\")\n        }\n        super.dispose()\n    }\n}\n\nfinal private class Debug<Source: ObservableType>: Producer<Source.Element> {\n    fileprivate let identifier: String\n    fileprivate let trimOutput: Bool\n    private let source: Source\n\n    init(source: Source, identifier: String?, trimOutput: Bool, file: String, line: UInt, function: String) {\n        self.trimOutput = trimOutput\n        if let identifier = identifier {\n            self.identifier = identifier\n        }\n        else {\n            let trimmedFile: String\n            if let lastIndex = file.lastIndex(of: \"/\") {\n                trimmedFile = String(file[file.index(after: lastIndex) ..< file.endIndex])\n            }\n            else {\n                trimmedFile = file\n            }\n            self.identifier = \"\\(trimmedFile):\\(line) (\\(function))\"\n        }\n        self.source = source\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Source.Element {\n        let sink = DebugSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Decode.swift",
    "content": "//\n//  Decode.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 24/07/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\npublic extension ObservableType where Element == Data {\n  /// Attempt to decode the emitted `Data` using a provided decoder.\n  ///\n  /// - parameter type: A `Decodable`-conforming type to attempt to decode to\n  /// - parameter decoder: A capable decoder, e.g. `JSONDecoder` or `PropertyListDecoder`\n  ///\n  /// - note: If using a custom decoder, it must conform to the `DataDecoder` protocol.\n  ///\n  /// - returns: An `Observable` of the decoded type\n  func decode<Item: Decodable,\n              Decoder: DataDecoder>(type: Item.Type,\n                                    decoder: Decoder) -> Observable<Item> {\n    map { try decoder.decode(type, from: $0) }\n  }\n}\n\n/// Represents an entity capable of decoding raw `Data`\n/// into a concrete `Decodable` type\npublic protocol DataDecoder {\n  func decode<Item: Decodable>(_ type: Item.Type, from data: Data) throws -> Item\n}\n\nextension JSONDecoder: DataDecoder {}\nextension PropertyListDecoder: DataDecoder {}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/DefaultIfEmpty.swift",
    "content": "//\n//  DefaultIfEmpty.swift\n//  RxSwift\n//\n//  Created by sergdort on 23/12/2016.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Emits elements from the source observable sequence, or a default element if the source observable sequence is empty.\n\n     - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html)\n\n     - parameter default: Default element to be sent if the source does not emit any elements\n     - returns: An observable sequence which emits default element end completes in case the original sequence is empty\n     */\n    public func ifEmpty(default: Element) -> Observable<Element> {\n        DefaultIfEmpty(source: self.asObservable(), default: `default`)\n    }\n}\n\nfinal private class DefaultIfEmptySink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    private let `default`: Element\n    private var isEmpty = true\n    \n    init(default: Element, observer: Observer, cancel: Cancelable) {\n        self.default = `default`\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.isEmpty = false\n            self.forwardOn(event)\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            if self.isEmpty {\n                self.forwardOn(.next(self.default))\n            }\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class DefaultIfEmpty<SourceType>: Producer<SourceType> {\n    private let source: Observable<SourceType>\n    private let `default`: SourceType\n    \n    init(source: Observable<SourceType>, `default`: SourceType) {\n        self.source = source\n        self.default = `default`\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceType {\n        let sink = DefaultIfEmptySink(default: self.default, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Deferred.swift",
    "content": "//\n//  Deferred.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.\n\n     - seealso: [defer operator on reactivex.io](http://reactivex.io/documentation/operators/defer.html)\n\n     - parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence.\n     - returns: An observable sequence whose observers trigger an invocation of the given observable factory function.\n     */\n    public static func deferred(_ observableFactory: @escaping () throws -> Observable<Element>)\n        -> Observable<Element> {\n        Deferred(observableFactory: observableFactory)\n    }\n}\n\nfinal private class DeferredSink<Source: ObservableType, Observer: ObserverType>: Sink<Observer>, ObserverType where Source.Element == Observer.Element {\n    typealias Element = Observer.Element \n\n    private let observableFactory: () throws -> Source\n\n    init(observableFactory: @escaping () throws -> Source, observer: Observer, cancel: Cancelable) {\n        self.observableFactory = observableFactory\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        do {\n            let result = try self.observableFactory()\n            return result.subscribe(self)\n        }\n        catch let e {\n            self.forwardOn(.error(e))\n            self.dispose()\n            return Disposables.create()\n        }\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.forwardOn(event)\n        \n        switch event {\n        case .next:\n            break\n        case .error:\n            self.dispose()\n        case .completed:\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Deferred<Source: ObservableType>: Producer<Source.Element> {\n    typealias Factory = () throws -> Source\n    \n    private let observableFactory : Factory\n    \n    init(observableFactory: @escaping Factory) {\n        self.observableFactory = observableFactory\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable)\n             where Observer.Element == Source.Element {\n        let sink = DeferredSink(observableFactory: self.observableFactory, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Delay.swift",
    "content": "//\n//  Delay.swift\n//  RxSwift\n//\n//  Created by tarunon on 2016/02/09.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\nextension ObservableType {\n\n    /**\n     Returns an observable sequence by the source observable sequence shifted forward in time by a specified delay. Error events from the source observable sequence are not delayed.\n\n     - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html)\n\n     - parameter dueTime: Relative time shift of the source by.\n     - parameter scheduler: Scheduler to run the subscription delay timer on.\n     - returns: the source Observable shifted in time by the specified delay.\n     */\n    public func delay(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n            return Delay(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler)\n    }\n}\n\nfinal private class DelaySink<Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType {\n    typealias Element = Observer.Element \n    typealias Source = Observable<Element>\n    typealias DisposeKey = Bag<Disposable>.KeyType\n    \n    private let lock = RecursiveLock()\n\n    private let dueTime: RxTimeInterval\n    private let scheduler: SchedulerType\n    \n    private let sourceSubscription = SingleAssignmentDisposable()\n    private let cancelable = SerialDisposable()\n\n    // is scheduled some action\n    private var active = false\n    // is \"run loop\" on different scheduler running\n    private var running = false\n    private var errorEvent: Event<Element>?\n\n    // state\n    private var queue = Queue<(eventTime: RxTime, event: Event<Element>)>(capacity: 0)\n    \n    init(observer: Observer, dueTime: RxTimeInterval, scheduler: SchedulerType, cancel: Cancelable) {\n        self.dueTime = dueTime\n        self.scheduler = scheduler\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    // All of these complications in this method are caused by the fact that \n    // error should be propagated immediately. Error can be potentially received on different\n    // scheduler so this process needs to be synchronized somehow.\n    //\n    // Another complication is that scheduler is potentially concurrent so internal queue is used.\n    func drainQueue(state: (), scheduler: AnyRecursiveScheduler<()>) {\n        self.lock.lock()    \n        let hasFailed = self.errorEvent != nil\n        if !hasFailed {\n            self.running = true\n        }\n        self.lock.unlock()  \n\n        if hasFailed {\n            return\n        }\n\n        var ranAtLeastOnce = false\n\n        while true {\n            self.lock.lock() \n            let errorEvent = self.errorEvent\n\n            let eventToForwardImmediately = ranAtLeastOnce ? nil : self.queue.dequeue()?.event\n            let nextEventToScheduleOriginalTime: Date? = ranAtLeastOnce && !self.queue.isEmpty ? self.queue.peek().eventTime : nil\n\n            if errorEvent == nil {\n                if eventToForwardImmediately != nil {\n                }\n                else if nextEventToScheduleOriginalTime != nil {\n                    self.running = false\n                }\n                else {\n                    self.running = false\n                    self.active = false\n                }\n            }\n            self.lock.unlock() \n\n            if let errorEvent = errorEvent {\n                self.forwardOn(errorEvent)\n                self.dispose()\n                return\n            }\n            else {\n                if let eventToForwardImmediately = eventToForwardImmediately {\n                    ranAtLeastOnce = true\n                    self.forwardOn(eventToForwardImmediately)\n                    if case .completed = eventToForwardImmediately {\n                        self.dispose()\n                        return\n                    }\n                }\n                else if let nextEventToScheduleOriginalTime = nextEventToScheduleOriginalTime {\n                    scheduler.schedule((), dueTime: self.dueTime.reduceWithSpanBetween(earlierDate: nextEventToScheduleOriginalTime, laterDate: self.scheduler.now))\n                    return\n                }\n                else {\n                    return\n                }\n            }\n        }\n    }\n    \n    func on(_ event: Event<Element>) {\n        if event.isStopEvent {\n            self.sourceSubscription.dispose()\n        }\n\n        switch event {\n        case .error:\n            self.lock.lock()    \n            let shouldSendImmediately = !self.running\n            self.queue = Queue(capacity: 0)\n            self.errorEvent = event\n            self.lock.unlock()  \n\n            if shouldSendImmediately {\n                self.forwardOn(event)\n                self.dispose()\n            }\n        default:\n            self.lock.lock()    \n            let shouldSchedule = !self.active\n            self.active = true\n            self.queue.enqueue((self.scheduler.now, event))\n            self.lock.unlock()  \n\n            if shouldSchedule {\n                self.cancelable.disposable = self.scheduler.scheduleRecursive((), dueTime: self.dueTime, action: self.drainQueue)\n            }\n        }\n    }\n    \n    func run(source: Observable<Element>) -> Disposable {\n        self.sourceSubscription.setDisposable(source.subscribe(self))\n        return Disposables.create(sourceSubscription, cancelable)\n    }\n}\n\nfinal private class Delay<Element>: Producer<Element> {\n    private let source: Observable<Element>\n    private let dueTime: RxTimeInterval\n    private let scheduler: SchedulerType\n    \n    init(source: Observable<Element>, dueTime: RxTimeInterval, scheduler: SchedulerType) {\n        self.source = source\n        self.dueTime = dueTime\n        self.scheduler = scheduler\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = DelaySink(observer: observer, dueTime: self.dueTime, scheduler: self.scheduler, cancel: cancel)\n        let subscription = sink.run(source: self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/DelaySubscription.swift",
    "content": "//\n//  DelaySubscription.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.\n\n     - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html)\n\n     - parameter dueTime: Relative time shift of the subscription.\n     - parameter scheduler: Scheduler to run the subscription delay timer on.\n     - returns: Time-shifted sequence.\n     */\n    public func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n        DelaySubscription(source: self.asObservable(), dueTime: dueTime, scheduler: scheduler)\n    }\n}\n\nfinal private class DelaySubscriptionSink<Observer: ObserverType>\n    : Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    \n    func on(_ event: Event<Element>) {\n        self.forwardOn(event)\n        if event.isStopEvent {\n            self.dispose()\n        }\n    }\n    \n}\n\nfinal private class DelaySubscription<Element>: Producer<Element> {\n    private let source: Observable<Element>\n    private let dueTime: RxTimeInterval\n    private let scheduler: SchedulerType\n    \n    init(source: Observable<Element>, dueTime: RxTimeInterval, scheduler: SchedulerType) {\n        self.source = source\n        self.dueTime = dueTime\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = DelaySubscriptionSink(observer: observer, cancel: cancel)\n        let subscription = self.scheduler.scheduleRelative((), dueTime: self.dueTime) { _ in\n            return self.source.subscribe(sink)\n        }\n\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Dematerialize.swift",
    "content": "//\n//  Dematerialize.swift\n//  RxSwift\n//\n//  Created by Jamie Pinkham on 3/13/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType where Element: EventConvertible {\n    /**\n     Convert any previously materialized Observable into it's original form.\n     - seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html)\n     - returns: The dematerialized observable sequence.\n     */\n    public func dematerialize() -> Observable<Element.Element> {\n        Dematerialize(source: self.asObservable())\n    }\n\n}\n\nprivate final class DematerializeSink<T: EventConvertible, Observer: ObserverType>: Sink<Observer>, ObserverType where Observer.Element == T.Element {\n    fileprivate func on(_ event: Event<T>) {\n        switch event {\n        case .next(let element):\n            self.forwardOn(element.event)\n            if element.event.isStopEvent {\n                self.dispose()\n            }\n        case .completed:\n            self.forwardOn(.completed)\n            self.dispose()\n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Dematerialize<T: EventConvertible>: Producer<T.Element> {\n    private let source: Observable<T>\n\n    init(source: Observable<T>) {\n        self.source = source\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == T.Element {\n        let sink = DematerializeSink<T, Observer>(observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/DistinctUntilChanged.swift",
    "content": "//\n//  DistinctUntilChanged.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType where Element: Equatable {\n\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to equality operator.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - returns: An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence.\n     */\n    public func distinctUntilChanged()\n        -> Observable<Element> {\n        self.distinctUntilChanged({ $0 }, comparer: { ($0 == $1) })\n    }\n}\n\nextension ObservableType {\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to the `keySelector`.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - parameter keySelector: A function to compute the comparison key for each element.\n     - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.\n     */\n    public func distinctUntilChanged<Key: Equatable>(_ keySelector: @escaping (Element) throws -> Key)\n        -> Observable<Element> {\n        self.distinctUntilChanged(keySelector, comparer: { $0 == $1 })\n    }\n\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to the `comparer`.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - parameter comparer: Equality comparer for computed key values.\n     - returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence.\n     */\n    public func distinctUntilChanged(_ comparer: @escaping (Element, Element) throws -> Bool)\n        -> Observable<Element> {\n        self.distinctUntilChanged({ $0 }, comparer: comparer)\n    }\n\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - parameter keySelector: A function to compute the comparison key for each element.\n     - parameter comparer: Equality comparer for computed key values.\n     - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.\n     */\n    public func distinctUntilChanged<K>(_ keySelector: @escaping (Element) throws -> K, comparer: @escaping (K, K) throws -> Bool)\n        -> Observable<Element> {\n            return DistinctUntilChanged(source: self.asObservable(), selector: keySelector, comparer: comparer)\n    }\n\n    /**\n    Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object.\n\n    - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n    - returns: An observable sequence only containing the distinct contiguous elements, based on equality operator on the provided key path\n    */\n    public func distinctUntilChanged<Property: Equatable>(at keyPath: KeyPath<Element, Property>) ->\n        Observable<Element> {\n        self.distinctUntilChanged { $0[keyPath: keyPath] == $1[keyPath: keyPath] }\n    }\n}\n\nfinal private class DistinctUntilChangedSink<Observer: ObserverType, Key>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    \n    private let parent: DistinctUntilChanged<Element, Key>\n    private var currentKey: Key?\n    \n    init(parent: DistinctUntilChanged<Element, Key>, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            do {\n                let key = try self.parent.selector(value)\n                var areEqual = false\n                if let currentKey = self.currentKey {\n                    areEqual = try self.parent.comparer(currentKey, key)\n                }\n                \n                if areEqual {\n                    return\n                }\n                \n                self.currentKey = key\n                \n                self.forwardOn(event)\n            }\n            catch let error {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n        case .error, .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class DistinctUntilChanged<Element, Key>: Producer<Element> {\n    typealias KeySelector = (Element) throws -> Key\n    typealias EqualityComparer = (Key, Key) throws -> Bool\n    \n    private let source: Observable<Element>\n    fileprivate let selector: KeySelector\n    fileprivate let comparer: EqualityComparer\n    \n    init(source: Observable<Element>, selector: @escaping KeySelector, comparer: @escaping EqualityComparer) {\n        self.source = source\n        self.selector = selector\n        self.comparer = comparer\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = DistinctUntilChangedSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Do.swift",
    "content": "//\n//  Do.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.\n\n     - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html)\n\n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter afterNext: Action to invoke for each element after the observable has passed an onNext event along to its downstream.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter afterError: Action to invoke after errored termination of the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter afterCompleted: Action to invoke after graceful termination of the observable sequence.\n     - parameter onSubscribe: Action to invoke before subscribing to source observable sequence.\n     - parameter onSubscribed: Action to invoke after subscribing to source observable sequence.\n     - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.\n     - returns: The source sequence with the side-effecting behavior applied.\n     */\n    public func `do`(onNext: ((Element) throws -> Void)? = nil, afterNext: ((Element) throws -> Void)? = nil, onError: ((Swift.Error) throws -> Void)? = nil, afterError: ((Swift.Error) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, afterCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil)\n        -> Observable<Element> {\n            return Do(source: self.asObservable(), eventHandler: { e in\n                switch e {\n                case .next(let element):\n                    try onNext?(element)\n                case .error(let e):\n                    try onError?(e)\n                case .completed:\n                    try onCompleted?()\n                }\n            }, afterEventHandler: { e in\n                switch e {\n                case .next(let element):\n                    try afterNext?(element)\n                case .error(let e):\n                    try afterError?(e)\n                case .completed:\n                    try afterCompleted?()\n                }\n            }, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose)\n    }\n}\n\nfinal private class DoSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias EventHandler = (Event<Element>) throws -> Void\n    typealias AfterEventHandler = (Event<Element>) throws -> Void\n    \n    private let eventHandler: EventHandler\n    private let afterEventHandler: AfterEventHandler\n    \n    init(eventHandler: @escaping EventHandler, afterEventHandler: @escaping AfterEventHandler, observer: Observer, cancel: Cancelable) {\n        self.eventHandler = eventHandler\n        self.afterEventHandler = afterEventHandler\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        do {\n            try self.eventHandler(event)\n            self.forwardOn(event)\n            try self.afterEventHandler(event)\n            if event.isStopEvent {\n                self.dispose()\n            }\n        }\n        catch let error {\n            self.forwardOn(.error(error))\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Do<Element>: Producer<Element> {\n    typealias EventHandler = (Event<Element>) throws -> Void\n    typealias AfterEventHandler = (Event<Element>) throws -> Void\n    \n    private let source: Observable<Element>\n    private let eventHandler: EventHandler\n    private let afterEventHandler: AfterEventHandler\n    private let onSubscribe: (() -> Void)?\n    private let onSubscribed: (() -> Void)?\n    private let onDispose: (() -> Void)?\n    \n    init(source: Observable<Element>, eventHandler: @escaping EventHandler, afterEventHandler: @escaping AfterEventHandler, onSubscribe: (() -> Void)?, onSubscribed: (() -> Void)?, onDispose: (() -> Void)?) {\n        self.source = source\n        self.eventHandler = eventHandler\n        self.afterEventHandler = afterEventHandler\n        self.onSubscribe = onSubscribe\n        self.onSubscribed = onSubscribed\n        self.onDispose = onDispose\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        self.onSubscribe?()\n        let sink = DoSink(eventHandler: self.eventHandler, afterEventHandler: self.afterEventHandler, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        self.onSubscribed?()\n        let onDispose = self.onDispose\n        let allSubscriptions = Disposables.create {\n            subscription.dispose()\n            onDispose?()\n        }\n        return (sink: sink, subscription: allSubscriptions)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/ElementAt.swift",
    "content": "//\n//  ElementAt.swift\n//  RxSwift\n//\n//  Created by Junior B. on 21/10/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns a sequence emitting only element _n_ emitted by an Observable\n\n     - seealso: [elementAt operator on reactivex.io](http://reactivex.io/documentation/operators/elementat.html)\n\n     - parameter index: The index of the required element (starting from 0).\n     - returns: An observable sequence that emits the desired element as its own sole emission.\n     */\n    @available(*, deprecated, renamed: \"element(at:)\")\n    public func elementAt(_ index: Int)\n        -> Observable<Element> {\n        element(at: index)\n    }\n\n    /**\n     Returns a sequence emitting only element _n_ emitted by an Observable\n\n     - seealso: [elementAt operator on reactivex.io](http://reactivex.io/documentation/operators/elementat.html)\n\n     - parameter index: The index of the required element (starting from 0).\n     - returns: An observable sequence that emits the desired element as its own sole emission.\n     */\n    public func element(at index: Int)\n        -> Observable<Element> {\n        ElementAt(source: self.asObservable(), index: index, throwOnEmpty: true)\n    }\n}\n\nfinal private class ElementAtSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias SourceType = Observer.Element\n    typealias Parent = ElementAt<SourceType>\n    \n    let parent: Parent\n    var i: Int\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.i = parent.index\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<SourceType>) {\n        switch event {\n        case .next:\n\n            if self.i == 0 {\n                self.forwardOn(event)\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n            \n            do {\n                _ = try decrementChecked(&self.i)\n            } catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n                return\n            }\n            \n        case .error(let e):\n            self.forwardOn(.error(e))\n            self.dispose()\n        case .completed:\n            if self.parent.throwOnEmpty {\n                self.forwardOn(.error(RxError.argumentOutOfRange))\n            } else {\n                self.forwardOn(.completed)\n            }\n            \n            self.dispose()\n        }\n    }\n}\n\nfinal private class ElementAt<SourceType>: Producer<SourceType> {\n    let source: Observable<SourceType>\n    let throwOnEmpty: Bool\n    let index: Int\n    \n    init(source: Observable<SourceType>, index: Int, throwOnEmpty: Bool) {\n        if index < 0 {\n            rxFatalError(\"index can't be negative\")\n        }\n\n        self.source = source\n        self.index = index\n        self.throwOnEmpty = throwOnEmpty\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceType {\n        let sink = ElementAtSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Empty.swift",
    "content": "//\n//  Empty.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message.\n\n     - seealso: [empty operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An observable sequence with no elements.\n     */\n    public static func empty() -> Observable<Element> {\n        EmptyProducer<Element>()\n    }\n}\n\nfinal private class EmptyProducer<Element>: Producer<Element> {\n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        observer.on(.completed)\n        return Disposables.create()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Enumerated.swift",
    "content": "//\n//  Enumerated.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/6/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Enumerates the elements of an observable sequence.\n\n     - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html)\n\n     - returns: An observable sequence that contains tuples of source sequence elements and their indexes.\n     */\n    public func enumerated()\n        -> Observable<(index: Int, element: Element)> {\n        Enumerated(source: self.asObservable())\n    }\n}\n\nfinal private class EnumeratedSink<Element, Observer: ObserverType>: Sink<Observer>, ObserverType where Observer.Element == (index: Int, element: Element) {\n    var index = 0\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            do {\n                let nextIndex = try incrementChecked(&self.index)\n                let next = (index: nextIndex, element: value)\n                self.forwardOn(.next(next))\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        case .completed:\n            self.forwardOn(.completed)\n            self.dispose()\n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Enumerated<Element>: Producer<(index: Int, element: Element)> {\n    private let source: Observable<Element>\n\n    init(source: Observable<Element>) {\n        self.source = source\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == (index: Int, element: Element) {\n        let sink = EnumeratedSink<Element, Observer>(observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Error.swift",
    "content": "//\n//  Error.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns an observable sequence that terminates with an `error`.\n\n     - seealso: [throw operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: The observable sequence that terminates with specified error.\n     */\n    public static func error(_ error: Swift.Error) -> Observable<Element> {\n        ErrorProducer(error: error)\n    }\n}\n\nfinal private class ErrorProducer<Element>: Producer<Element> {\n    private let error: Swift.Error\n    \n    init(error: Swift.Error) {\n        self.error = error\n    }\n    \n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        observer.on(.error(self.error))\n        return Disposables.create()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Filter.swift",
    "content": "//\n//  Filter.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/17/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Filters the elements of an observable sequence based on a predicate.\n\n     - seealso: [filter operator on reactivex.io](http://reactivex.io/documentation/operators/filter.html)\n\n     - parameter predicate: A function to test each source element for a condition.\n     - returns: An observable sequence that contains elements from the input sequence that satisfy the condition.\n     */\n    public func filter(_ predicate: @escaping (Element) throws -> Bool)\n        -> Observable<Element> {\n        Filter(source: self.asObservable(), predicate: predicate)\n    }\n}\n\nextension ObservableType {\n    /**\n     Skips elements and completes (or errors) when the observable sequence completes (or errors). Equivalent to filter that always returns false.\n\n     - seealso: [ignoreElements operator on reactivex.io](http://reactivex.io/documentation/operators/ignoreelements.html)\n\n     - returns: An observable sequence that skips all elements of the source sequence.\n     */\n    public func ignoreElements()\n        -> Observable<Never> {\n        self.flatMap { _ in Observable<Never>.empty() }\n    }\n}\n\nfinal private class FilterSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Predicate = (Element) throws -> Bool\n    typealias Element = Observer.Element\n    \n    private let predicate: Predicate\n    \n    init(predicate: @escaping Predicate, observer: Observer, cancel: Cancelable) {\n        self.predicate = predicate\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            do {\n                let satisfies = try self.predicate(value)\n                if satisfies {\n                    self.forwardOn(.next(value))\n                }\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        case .completed, .error:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Filter<Element>: Producer<Element> {\n    typealias Predicate = (Element) throws -> Bool\n    \n    private let source: Observable<Element>\n    private let predicate: Predicate\n    \n    init(source: Observable<Element>, predicate: @escaping Predicate) {\n        self.source = source\n        self.predicate = predicate\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = FilterSink(predicate: self.predicate, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/First.swift",
    "content": "//\n//  First.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 7/31/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nprivate final class FirstSink<Element, Observer: ObserverType> : Sink<Observer>, ObserverType where Observer.Element == Element? {\n    typealias Parent = First<Element>\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            self.forwardOn(.next(value))\n            self.forwardOn(.completed)\n            self.dispose()\n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.forwardOn(.next(nil))\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal class First<Element>: Producer<Element?> {\n    private let source: Observable<Element>\n\n    init(source: Observable<Element>) {\n        self.source = source\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element? {\n        let sink = FirstSink(observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Generate.swift",
    "content": "//\n//  Generate.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/2/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler\n     to run the loop send out observer messages.\n\n     - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html)\n\n     - parameter initialState: Initial state.\n     - parameter condition: Condition to terminate generation (upon returning `false`).\n     - parameter iterate: Iteration step function.\n     - parameter scheduler: Scheduler on which to run the generator loop.\n     - returns: The generated sequence.\n     */\n    public static func generate(initialState: Element, condition: @escaping (Element) throws -> Bool, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance, iterate: @escaping (Element) throws -> Element) -> Observable<Element> {\n        Generate(initialState: initialState, condition: condition, iterate: iterate, resultSelector: { $0 }, scheduler: scheduler)\n    }\n}\n\nfinal private class GenerateSink<Sequence, Observer: ObserverType>: Sink<Observer> {\n    typealias Parent = Generate<Sequence, Observer.Element>\n    \n    private let parent: Parent\n    \n    private var state: Sequence\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.state = parent.initialState\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        return self.parent.scheduler.scheduleRecursive(true) { isFirst, recurse -> Void in\n            do {\n                if !isFirst {\n                    self.state = try self.parent.iterate(self.state)\n                }\n                \n                if try self.parent.condition(self.state) {\n                    let result = try self.parent.resultSelector(self.state)\n                    self.forwardOn(.next(result))\n                    \n                    recurse(false)\n                }\n                else {\n                    self.forwardOn(.completed)\n                    self.dispose()\n                }\n            }\n            catch let error {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n        }\n    }\n}\n\nfinal private class Generate<Sequence, Element>: Producer<Element> {\n    fileprivate let initialState: Sequence\n    fileprivate let condition: (Sequence) throws -> Bool\n    fileprivate let iterate: (Sequence) throws -> Sequence\n    fileprivate let resultSelector: (Sequence) throws -> Element\n    fileprivate let scheduler: ImmediateSchedulerType\n    \n    init(initialState: Sequence, condition: @escaping (Sequence) throws -> Bool, iterate: @escaping (Sequence) throws -> Sequence, resultSelector: @escaping (Sequence) throws -> Element, scheduler: ImmediateSchedulerType) {\n        self.initialState = initialState\n        self.condition = condition\n        self.iterate = iterate\n        self.resultSelector = resultSelector\n        self.scheduler = scheduler\n        super.init()\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = GenerateSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/GroupBy.swift",
    "content": "//\n//  GroupBy.swift\n//  RxSwift\n//\n//  Created by Tomi Koskinen on 01/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /*\n     Groups the elements of an observable sequence according to a specified key selector function.\n\n     - seealso: [groupBy operator on reactivex.io](http://reactivex.io/documentation/operators/groupby.html)\n\n     - parameter keySelector: A function to extract the key for each element.\n     - returns: A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.\n     */\n    public func groupBy<Key: Hashable>(keySelector: @escaping (Element) throws -> Key)\n        -> Observable<GroupedObservable<Key, Element>> {\n        GroupBy(source: self.asObservable(), selector: keySelector)\n    }\n}\n\nfinal private class GroupedObservableImpl<Element>: Observable<Element> {\n    private var subject: PublishSubject<Element>\n    private var refCount: RefCountDisposable\n    \n    init(subject: PublishSubject<Element>, refCount: RefCountDisposable) {\n        self.subject = subject\n        self.refCount = refCount\n    }\n\n    override public func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        let release = self.refCount.retain()\n        let subscription = self.subject.subscribe(observer)\n        return Disposables.create(release, subscription)\n    }\n}\n\n\nfinal private class GroupBySink<Key: Hashable, Element, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType where Observer.Element == GroupedObservable<Key, Element> {\n    typealias ResultType = Observer.Element \n    typealias Parent = GroupBy<Key, Element>\n\n    private let parent: Parent\n    private let subscription = SingleAssignmentDisposable()\n    private var refCountDisposable: RefCountDisposable!\n    private var groupedSubjectTable: [Key: PublishSubject<Element>]\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.groupedSubjectTable = [Key: PublishSubject<Element>]()\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        self.refCountDisposable = RefCountDisposable(disposable: self.subscription)\n        \n        self.subscription.setDisposable(self.parent.source.subscribe(self))\n        \n        return self.refCountDisposable\n    }\n    \n    private func onGroupEvent(key: Key, value: Element) {\n        if let writer = self.groupedSubjectTable[key] {\n            writer.on(.next(value))\n        } else {\n            let writer = PublishSubject<Element>()\n            self.groupedSubjectTable[key] = writer\n            \n            let group = GroupedObservable(\n                key: key,\n                source: GroupedObservableImpl(subject: writer, refCount: refCountDisposable)\n            )\n            \n            self.forwardOn(.next(group))\n            writer.on(.next(value))\n        }\n    }\n\n    final func on(_ event: Event<Element>) {\n        switch event {\n        case let .next(value):\n            do {\n                let groupKey = try self.parent.selector(value)\n                self.onGroupEvent(key: groupKey, value: value)\n            }\n            catch let e {\n                self.error(e)\n                return\n            }\n        case let .error(e):\n            self.error(e)\n        case .completed:\n            self.forwardOnGroups(event: .completed)\n            self.forwardOn(.completed)\n            self.subscription.dispose()\n            self.dispose()\n        }\n    }\n\n    final func error(_ error: Swift.Error) {\n        self.forwardOnGroups(event: .error(error))\n        self.forwardOn(.error(error))\n        self.subscription.dispose()\n        self.dispose()\n    }\n    \n    final func forwardOnGroups(event: Event<Element>) {\n        for writer in self.groupedSubjectTable.values {\n            writer.on(event)\n        }\n    }\n}\n\nfinal private class GroupBy<Key: Hashable, Element>: Producer<GroupedObservable<Key,Element>> {\n    typealias KeySelector = (Element) throws -> Key\n\n    fileprivate let source: Observable<Element>\n    fileprivate let selector: KeySelector\n    \n    init(source: Observable<Element>, selector: @escaping KeySelector) {\n        self.source = source\n        self.selector = selector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == GroupedObservable<Key,Element> {\n        let sink = GroupBySink(parent: self, observer: observer, cancel: cancel)\n        return (sink: sink, subscription: sink.run())\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Just.swift",
    "content": "//\n//  Just.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns an observable sequence that contains a single element.\n\n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n\n     - parameter element: Single element in the resulting observable sequence.\n     - returns: An observable sequence containing the single specified element.\n     */\n    public static func just(_ element: Element) -> Observable<Element> {\n        Just(element: element)\n    }\n\n    /**\n     Returns an observable sequence that contains a single element.\n\n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n\n     - parameter element: Single element in the resulting observable sequence.\n     - parameter scheduler: Scheduler to send the single element on.\n     - returns: An observable sequence containing the single specified element.\n     */\n    public static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Observable<Element> {\n        JustScheduled(element: element, scheduler: scheduler)\n    }\n}\n\nfinal private class JustScheduledSink<Observer: ObserverType>: Sink<Observer> {\n    typealias Parent = JustScheduled<Observer.Element>\n\n    private let parent: Parent\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let scheduler = self.parent.scheduler\n        return scheduler.schedule(self.parent.element) { element in\n            self.forwardOn(.next(element))\n            return scheduler.schedule(()) { _ in\n                self.forwardOn(.completed)\n                self.dispose()\n                return Disposables.create()\n            }\n        }\n    }\n}\n\nfinal private class JustScheduled<Element>: Producer<Element> {\n    fileprivate let scheduler: ImmediateSchedulerType\n    fileprivate let element: Element\n\n    init(element: Element, scheduler: ImmediateSchedulerType) {\n        self.scheduler = scheduler\n        self.element = element\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = JustScheduledSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class Just<Element>: Producer<Element> {\n    private let element: Element\n    \n    init(element: Element) {\n        self.element = element\n    }\n    \n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        observer.on(.next(self.element))\n        observer.on(.completed)\n        return Disposables.create()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Map.swift",
    "content": "//\n//  Map.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Projects each element of an observable sequence into a new form.\n\n     - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html)\n\n     - parameter transform: A transform function to apply to each source element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.\n\n     */\n    public func map<Result>(_ transform: @escaping (Element) throws -> Result)\n        -> Observable<Result> {\n        Map(source: self.asObservable(), transform: transform)\n    }\n}\n\nfinal private class MapSink<SourceType, Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Transform = (SourceType) throws -> ResultType\n\n    typealias ResultType = Observer.Element \n    typealias Element = SourceType\n\n    private let transform: Transform\n\n    init(transform: @escaping Transform, observer: Observer, cancel: Cancelable) {\n        self.transform = transform\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func on(_ event: Event<SourceType>) {\n        switch event {\n        case .next(let element):\n            do {\n                let mappedElement = try self.transform(element)\n                self.forwardOn(.next(mappedElement))\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Map<SourceType, ResultType>: Producer<ResultType> {\n    typealias Transform = (SourceType) throws -> ResultType\n\n    private let source: Observable<SourceType>\n\n    private let transform: Transform\n\n    init(source: Observable<SourceType>, transform: @escaping Transform) {\n        self.source = source\n        self.transform = transform\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType {\n        let sink = MapSink(transform: self.transform, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Materialize.swift",
    "content": "//\n//  Materialize.swift\n//  RxSwift\n//\n//  Created by sergdort on 08/03/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Convert any Observable into an Observable of its events.\n     - seealso: [materialize operator on reactivex.io](http://reactivex.io/documentation/operators/materialize-dematerialize.html)\n     - returns: An observable sequence that wraps events in an Event<E>. The returned Observable never errors, but it does complete after observing all of the events of the underlying Observable.\n     */\n    public func materialize() -> Observable<Event<Element>> {\n        Materialize(source: self.asObservable())\n    }\n}\n\nprivate final class MaterializeSink<Element, Observer: ObserverType>: Sink<Observer>, ObserverType where Observer.Element == Event<Element> {\n\n    func on(_ event: Event<Element>) {\n        self.forwardOn(.next(event))\n        if event.isStopEvent {\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Materialize<T>: Producer<Event<T>> {\n    private let source: Observable<T>\n\n    init(source: Observable<T>) {\n        self.source = source\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = MaterializeSink(observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Merge.swift",
    "content": "//\n//  Merge.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/28/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n\n     - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.\n     */\n    public func flatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)\n        -> Observable<Source.Element> {\n            return FlatMap(source: self.asObservable(), selector: selector)\n    }\n\n}\n\nextension ObservableType {\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n     If element is received while there is some projected observable sequence being merged it will simply be ignored.\n\n     - seealso: [flatMapFirst operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated.\n     */\n    public func flatMapFirst<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)\n        -> Observable<Source.Element> {\n            return FlatMapFirst(source: self.asObservable(), selector: selector)\n    }\n}\n\nextension ObservableType where Element: ObservableConvertibleType {\n\n    /**\n     Merges elements from all observable sequences in the given enumerable sequence into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public func merge() -> Observable<Element.Element> {\n        Merge(source: self.asObservable())\n    }\n\n    /**\n     Merges elements from all inner observable sequences into a single observable sequence, limiting the number of concurrent subscriptions to inner sequences.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter maxConcurrent: Maximum number of inner observable sequences being subscribed to concurrently.\n     - returns: The observable sequence that merges the elements of the inner sequences.\n     */\n    public func merge(maxConcurrent: Int)\n        -> Observable<Element.Element> {\n        MergeLimited(source: self.asObservable(), maxConcurrent: maxConcurrent)\n    }\n}\n\nextension ObservableType where Element: ObservableConvertibleType {\n\n    /**\n     Concatenates all inner observable sequences, as long as the previous observable sequence terminated successfully.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each observed inner sequence, in sequential order.\n     */\n    public func concat() -> Observable<Element.Element> {\n        self.merge(maxConcurrent: 1)\n    }\n}\n\nextension ObservableType {\n    /**\n     Merges elements from all observable sequences from collection into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Collection of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func merge<Collection: Swift.Collection>(_ sources: Collection) -> Observable<Element> where Collection.Element == Observable<Element> {\n        MergeArray(sources: Array(sources))\n    }\n\n    /**\n     Merges elements from all observable sequences from array into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Array of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func merge(_ sources: [Observable<Element>]) -> Observable<Element> {\n        MergeArray(sources: sources)\n    }\n\n    /**\n     Merges elements from all observable sequences into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Collection of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func merge(_ sources: Observable<Element>...) -> Observable<Element> {\n        MergeArray(sources: sources)\n    }\n}\n\n// MARK: concatMap\n\nextension ObservableType {\n    /**\n     Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.\n     \n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n     \n     - returns: An observable sequence that contains the elements of each observed inner sequence, in sequential order.\n     */\n    \n    public func concatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)\n        -> Observable<Source.Element> {\n        return ConcatMap(source: self.asObservable(), selector: selector)\n    }\n}\n\nprivate final class MergeLimitedSinkIter<SourceElement, SourceSequence: ObservableConvertibleType, Observer: ObserverType>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType where SourceSequence.Element == Observer.Element {\n    typealias Element = Observer.Element\n    typealias DisposeKey = CompositeDisposable.DisposeKey\n    typealias Parent = MergeLimitedSink<SourceElement, SourceSequence, Observer>\n    \n    private let parent: Parent\n    private let disposeKey: DisposeKey\n\n    var lock: RecursiveLock {\n        self.parent.lock\n    }\n    \n    init(parent: Parent, disposeKey: DisposeKey) {\n        self.parent = parent\n        self.disposeKey = disposeKey\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.parent.forwardOn(event)\n        case .error:\n            self.parent.forwardOn(event)\n            self.parent.dispose()\n        case .completed:\n            self.parent.group.remove(for: self.disposeKey)\n            if let next = self.parent.queue.dequeue() {\n                self.parent.subscribe(next, group: self.parent.group)\n            }\n            else {\n                self.parent.activeCount -= 1\n                \n                if self.parent.stopped && self.parent.activeCount == 0 {\n                    self.parent.forwardOn(.completed)\n                    self.parent.dispose()\n                }\n            }\n        }\n    }\n}\n\nprivate final class ConcatMapSink<SourceElement, SourceSequence: ObservableConvertibleType, Observer: ObserverType>: MergeLimitedSink<SourceElement, SourceSequence, Observer> where Observer.Element == SourceSequence.Element {\n    typealias Selector = (SourceElement) throws -> SourceSequence\n    \n    private let selector: Selector\n    \n    init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) {\n        self.selector = selector\n        super.init(maxConcurrent: 1, observer: observer, cancel: cancel)\n    }\n    \n    override func performMap(_ element: SourceElement) throws -> SourceSequence {\n        try self.selector(element)\n    }\n}\n\nprivate final class MergeLimitedBasicSink<SourceSequence: ObservableConvertibleType, Observer: ObserverType>: MergeLimitedSink<SourceSequence, SourceSequence, Observer> where Observer.Element == SourceSequence.Element {\n    \n    override func performMap(_ element: SourceSequence) throws -> SourceSequence {\n        element\n    }\n}\n\nprivate class MergeLimitedSink<SourceElement, SourceSequence: ObservableConvertibleType, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType where Observer.Element == SourceSequence.Element {\n    typealias QueueType = Queue<SourceSequence>\n\n    let maxConcurrent: Int\n\n    let lock = RecursiveLock()\n\n    // state\n    var stopped = false\n    var activeCount = 0\n    var queue = QueueType(capacity: 2)\n    \n    let sourceSubscription = SingleAssignmentDisposable()\n    let group = CompositeDisposable()\n    \n    init(maxConcurrent: Int, observer: Observer, cancel: Cancelable) {\n        self.maxConcurrent = maxConcurrent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run(_ source: Observable<SourceElement>) -> Disposable {\n        _ = self.group.insert(self.sourceSubscription)\n        \n        let disposable = source.subscribe(self)\n        self.sourceSubscription.setDisposable(disposable)\n        return self.group\n    }\n    \n    func subscribe(_ innerSource: SourceSequence, group: CompositeDisposable) {\n        let subscription = SingleAssignmentDisposable()\n        \n        let key = group.insert(subscription)\n        \n        if let key = key {\n            let observer = MergeLimitedSinkIter(parent: self, disposeKey: key)\n            \n            let disposable = innerSource.asObservable().subscribe(observer)\n            subscription.setDisposable(disposable)\n        }\n    }\n    \n    func performMap(_ element: SourceElement) throws -> SourceSequence {\n        rxAbstractMethod()\n    }\n\n    @inline(__always)\n    final private func nextElementArrived(element: SourceElement) -> SourceSequence? {\n        self.lock.performLocked {\n            let subscribe: Bool\n            if self.activeCount < self.maxConcurrent {\n                self.activeCount += 1\n                subscribe = true\n            }\n            else {\n                do {\n                    let value = try self.performMap(element)\n                    self.queue.enqueue(value)\n                } catch {\n                    self.forwardOn(.error(error))\n                    self.dispose()\n                }\n                subscribe = false\n            }\n\n            if subscribe {\n                do {\n                    return try self.performMap(element)\n                } catch {\n                    self.forwardOn(.error(error))\n                    self.dispose()\n                }\n            }\n\n            return nil\n        }\n    }\n\n    func on(_ event: Event<SourceElement>) {\n        switch event {\n        case .next(let element):\n            if let sequence = self.nextElementArrived(element: element) {\n                self.subscribe(sequence, group: self.group)\n            }\n        case .error(let error):\n            self.lock.performLocked {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n        case .completed:\n            self.lock.performLocked {\n                if self.activeCount == 0 {\n                    self.forwardOn(.completed)\n                    self.dispose()\n                }\n                else {\n                    self.sourceSubscription.dispose()\n                }\n\n                self.stopped = true\n            }\n        }\n    }\n}\n\nfinal private class MergeLimited<SourceSequence: ObservableConvertibleType>: Producer<SourceSequence.Element> {\n    private let source: Observable<SourceSequence>\n    private let maxConcurrent: Int\n    \n    init(source: Observable<SourceSequence>, maxConcurrent: Int) {\n        self.source = source\n        self.maxConcurrent = maxConcurrent\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element {\n        let sink = MergeLimitedBasicSink<SourceSequence, Observer>(maxConcurrent: self.maxConcurrent, observer: observer, cancel: cancel)\n        let subscription = sink.run(self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n// MARK: Merge\n\nprivate final class MergeBasicSink<Source: ObservableConvertibleType, Observer: ObserverType> : MergeSink<Source, Source, Observer> where Observer.Element == Source.Element {\n    override func performMap(_ element: Source) throws -> Source {\n        element\n    }\n}\n\n// MARK: flatMap\n\nprivate final class FlatMapSink<SourceElement, SourceSequence: ObservableConvertibleType, Observer: ObserverType> : MergeSink<SourceElement, SourceSequence, Observer> where Observer.Element == SourceSequence.Element {\n    typealias Selector = (SourceElement) throws -> SourceSequence\n\n    private let selector: Selector\n\n    init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) {\n        self.selector = selector\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    override func performMap(_ element: SourceElement) throws -> SourceSequence {\n        try self.selector(element)\n    }\n}\n\n// MARK: FlatMapFirst\n\nprivate final class FlatMapFirstSink<SourceElement, SourceSequence: ObservableConvertibleType, Observer: ObserverType> : MergeSink<SourceElement, SourceSequence, Observer> where Observer.Element == SourceSequence.Element {\n    typealias Selector = (SourceElement) throws -> SourceSequence\n\n    private let selector: Selector\n\n    override var subscribeNext: Bool {\n        self.activeCount == 0\n    }\n\n    init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) {\n        self.selector = selector\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    override func performMap(_ element: SourceElement) throws -> SourceSequence {\n        try self.selector(element)\n    }\n}\n\nprivate final class MergeSinkIter<SourceElement, SourceSequence: ObservableConvertibleType, Observer: ObserverType> : ObserverType where Observer.Element == SourceSequence.Element {\n    typealias Parent = MergeSink<SourceElement, SourceSequence, Observer>\n    typealias DisposeKey = CompositeDisposable.DisposeKey\n    typealias Element = Observer.Element\n    \n    private let parent: Parent\n    private let disposeKey: DisposeKey\n\n    init(parent: Parent, disposeKey: DisposeKey) {\n        self.parent = parent\n        self.disposeKey = disposeKey\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.parent.lock.performLocked {\n            switch event {\n            case .next(let value):\n                self.parent.forwardOn(.next(value))\n            case .error(let error):\n                self.parent.forwardOn(.error(error))\n                self.parent.dispose()\n            case .completed:\n                self.parent.group.remove(for: self.disposeKey)\n                self.parent.activeCount -= 1\n                self.parent.checkCompleted()\n            }\n        }\n    }\n}\n\n\nprivate class MergeSink<SourceElement, SourceSequence: ObservableConvertibleType, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType where Observer.Element == SourceSequence.Element {\n    typealias ResultType = Observer.Element\n    typealias Element = SourceElement\n\n    let lock = RecursiveLock()\n\n    var subscribeNext: Bool {\n        true\n    }\n\n    // state\n    let group = CompositeDisposable()\n    let sourceSubscription = SingleAssignmentDisposable()\n\n    var activeCount = 0\n    var stopped = false\n\n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func performMap(_ element: SourceElement) throws -> SourceSequence {\n        rxAbstractMethod()\n    }\n\n    @inline(__always)\n    final private func nextElementArrived(element: SourceElement) -> SourceSequence? {\n        self.lock.performLocked {\n            if !self.subscribeNext {\n                return nil\n            }\n\n            do {\n                let value = try self.performMap(element)\n                self.activeCount += 1\n                return value\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n                return nil\n            }\n        }\n    }\n    \n    func on(_ event: Event<SourceElement>) {\n        switch event {\n        case .next(let element):\n            if let value = self.nextElementArrived(element: element) {\n                self.subscribeInner(value.asObservable())\n            }\n        case .error(let error):\n            self.lock.performLocked {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n        case .completed:\n            self.lock.performLocked {\n                self.stopped = true\n                self.sourceSubscription.dispose()\n                self.checkCompleted()\n            }\n        }\n    }\n\n    func subscribeInner(_ source: Observable<Observer.Element>) {\n        let iterDisposable = SingleAssignmentDisposable()\n        if let disposeKey = self.group.insert(iterDisposable) {\n            let iter = MergeSinkIter(parent: self, disposeKey: disposeKey)\n            let subscription = source.subscribe(iter)\n            iterDisposable.setDisposable(subscription)\n        }\n    }\n\n    func run(_ sources: [Observable<Observer.Element>]) -> Disposable {\n        self.activeCount += sources.count\n\n        for source in sources {\n            self.subscribeInner(source)\n        }\n\n        self.stopped = true\n\n        self.checkCompleted()\n\n        return self.group\n    }\n\n    @inline(__always)\n    func checkCompleted() {\n        if self.stopped && self.activeCount == 0 {\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n    \n    func run(_ source: Observable<SourceElement>) -> Disposable {\n        _ = self.group.insert(self.sourceSubscription)\n\n        let subscription = source.subscribe(self)\n        self.sourceSubscription.setDisposable(subscription)\n        \n        return self.group\n    }\n}\n\n// MARK: Producers\n\nfinal private class FlatMap<SourceElement, SourceSequence: ObservableConvertibleType>: Producer<SourceSequence.Element> {\n    typealias Selector = (SourceElement) throws -> SourceSequence\n\n    private let source: Observable<SourceElement>\n    \n    private let selector: Selector\n\n    init(source: Observable<SourceElement>, selector: @escaping Selector) {\n        self.source = source\n        self.selector = selector\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element {\n        let sink = FlatMapSink(selector: self.selector, observer: observer, cancel: cancel)\n        let subscription = sink.run(self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class FlatMapFirst<SourceElement, SourceSequence: ObservableConvertibleType>: Producer<SourceSequence.Element> {\n    typealias Selector = (SourceElement) throws -> SourceSequence\n\n    private let source: Observable<SourceElement>\n\n    private let selector: Selector\n\n    init(source: Observable<SourceElement>, selector: @escaping Selector) {\n        self.source = source\n        self.selector = selector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element {\n        let sink = FlatMapFirstSink<SourceElement, SourceSequence, Observer>(selector: self.selector, observer: observer, cancel: cancel)\n        let subscription = sink.run(self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal class ConcatMap<SourceElement, SourceSequence: ObservableConvertibleType>: Producer<SourceSequence.Element> {\n    typealias Selector = (SourceElement) throws -> SourceSequence\n    \n    private let source: Observable<SourceElement>\n    private let selector: Selector\n    \n    init(source: Observable<SourceElement>, selector: @escaping Selector) {\n        self.source = source\n        self.selector = selector\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element {\n        let sink = ConcatMapSink<SourceElement, SourceSequence, Observer>(selector: self.selector, observer: observer, cancel: cancel)\n        let subscription = sink.run(self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal class Merge<SourceSequence: ObservableConvertibleType> : Producer<SourceSequence.Element> {\n    private let source: Observable<SourceSequence>\n\n    init(source: Observable<SourceSequence>) {\n        self.source = source\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == SourceSequence.Element {\n        let sink = MergeBasicSink<SourceSequence, Observer>(observer: observer, cancel: cancel)\n        let subscription = sink.run(self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class MergeArray<Element>: Producer<Element> {\n    private let sources: [Observable<Element>]\n\n    init(sources: [Observable<Element>]) {\n        self.sources = sources\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = MergeBasicSink<Observable<Element>, Observer>(observer: observer, cancel: cancel)\n        let subscription = sink.run(self.sources)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Multicast.swift",
    "content": "//\n//  Multicast.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/27/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/**\n Represents an observable wrapper that can be connected and disconnected from its underlying observable sequence.\n */\npublic class ConnectableObservable<Element>\n    : Observable<Element>\n    , ConnectableObservableType {\n\n    /**\n     Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established.\n\n     - returns: Disposable used to disconnect the observable wrapper from its source, causing subscribed observer to stop receiving values from the underlying observable sequence.\n     */\n    public func connect() -> Disposable {\n        rxAbstractMethod()\n    }\n}\n\nextension ObservableType {\n\n    /**\n    Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function.\n\n    Each subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's invocation.\n\n    For specializations with fixed subject types, see `publish` and `replay`.\n\n    - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html)\n\n    - parameter subjectSelector: Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.\n    - parameter selector: Selector function which can use the multicasted source sequence subject to the policies enforced by the created subject.\n    - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.\n    */\n    public func multicast<Subject: SubjectType, Result>(_ subjectSelector: @escaping () throws -> Subject, selector: @escaping (Observable<Subject.Element>) throws -> Observable<Result>)\n        -> Observable<Result> where Subject.Observer.Element == Element {\n        return Multicast(\n            source: self.asObservable(),\n            subjectSelector: subjectSelector,\n            selector: selector\n        )\n    }\n}\n\nextension ObservableType {\n\n    /**\n    Returns a connectable observable sequence that shares a single subscription to the underlying sequence.\n\n    This operator is a specialization of `multicast` using a `PublishSubject`.\n\n    - seealso: [publish operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html)\n\n    - returns: A connectable observable sequence that shares a single subscription to the underlying sequence.\n    */\n    public func publish() -> ConnectableObservable<Element> {\n        self.multicast { PublishSubject() }\n    }\n}\n\nextension ObservableType {\n\n    /**\n     Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying bufferSize elements.\n\n     This operator is a specialization of `multicast` using a `ReplaySubject`.\n\n     - seealso: [replay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html)\n\n     - parameter bufferSize: Maximum element count of the replay buffer.\n     - returns: A connectable observable sequence that shares a single subscription to the underlying sequence.\n     */\n    public func replay(_ bufferSize: Int)\n        -> ConnectableObservable<Element> {\n        self.multicast { ReplaySubject.create(bufferSize: bufferSize) }\n    }\n\n    /**\n     Returns a connectable observable sequence that shares a single subscription to the underlying sequence replaying all elements.\n\n     This operator is a specialization of `multicast` using a `ReplaySubject`.\n\n     - seealso: [replay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html)\n\n     - returns: A connectable observable sequence that shares a single subscription to the underlying sequence.\n     */\n    public func replayAll()\n        -> ConnectableObservable<Element> {\n        self.multicast { ReplaySubject.createUnbounded() }\n    }\n}\n\nextension ConnectableObservableType {\n\n    /**\n    Returns an observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.\n\n    - seealso: [refCount operator on reactivex.io](http://reactivex.io/documentation/operators/refcount.html)\n\n    - returns: An observable sequence that stays connected to the source as long as there is at least one subscription to the observable sequence.\n    */\n    public func refCount() -> Observable<Element> {\n        RefCount(source: self)\n    }\n}\n\nextension ObservableType {\n\n    /**\n     Multicasts the source sequence notifications through the specified subject to the resulting connectable observable.\n\n     Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable.\n\n     For specializations with fixed subject types, see `publish` and `replay`.\n\n     - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html)\n\n     - parameter subject: Subject to push source elements into.\n     - returns: A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.\n     */\n    public func multicast<Subject: SubjectType>(_ subject: Subject)\n        -> ConnectableObservable<Subject.Element> where Subject.Observer.Element == Element {\n        ConnectableObservableAdapter(source: self.asObservable(), makeSubject: { subject })\n    }\n\n    /**\n     Multicasts the source sequence notifications through an instantiated subject to the resulting connectable observable.\n\n     Upon connection of the connectable observable, the subject is subscribed to the source exactly one, and messages are forwarded to the observers registered with the connectable observable.\n\n     Subject is cleared on connection disposal or in case source sequence produces terminal event.\n\n     - seealso: [multicast operator on reactivex.io](http://reactivex.io/documentation/operators/publish.html)\n\n     - parameter makeSubject: Factory function used to instantiate a subject for each connection.\n     - returns: A connectable observable sequence that upon connection causes the source sequence to push results into the specified subject.\n     */\n    public func multicast<Subject: SubjectType>(makeSubject: @escaping () -> Subject)\n        -> ConnectableObservable<Subject.Element> where Subject.Observer.Element == Element {\n        ConnectableObservableAdapter(source: self.asObservable(), makeSubject: makeSubject)\n    }\n}\n\nfinal private class Connection<Subject: SubjectType>: ObserverType, Disposable {\n    typealias Element = Subject.Observer.Element\n\n    private var lock: RecursiveLock\n    // state\n    private var parent: ConnectableObservableAdapter<Subject>?\n    private var subscription : Disposable?\n    private var subjectObserver: Subject.Observer\n\n    private let disposed = AtomicInt(0)\n\n    init(parent: ConnectableObservableAdapter<Subject>, subjectObserver: Subject.Observer, lock: RecursiveLock, subscription: Disposable) {\n        self.parent = parent\n        self.subscription = subscription\n        self.lock = lock\n        self.subjectObserver = subjectObserver\n    }\n\n    func on(_ event: Event<Subject.Observer.Element>) {\n        if isFlagSet(self.disposed, 1) {\n            return\n        }\n        if event.isStopEvent {\n            self.dispose()\n        }\n        self.subjectObserver.on(event)\n    }\n\n    func dispose() {\n        lock.lock(); defer { lock.unlock() }\n        fetchOr(self.disposed, 1)\n        guard let parent = self.parent else {\n            return\n        }\n\n        if parent.connection === self {\n            parent.connection = nil\n            parent.subject = nil\n        }\n        self.parent = nil\n\n        self.subscription?.dispose()\n        self.subscription = nil\n    }\n}\n\nfinal private class ConnectableObservableAdapter<Subject: SubjectType>\n    : ConnectableObservable<Subject.Element> {\n    typealias ConnectionType = Connection<Subject>\n\n    private let source: Observable<Subject.Observer.Element>\n    private let makeSubject: () -> Subject\n\n    fileprivate let lock = RecursiveLock()\n    fileprivate var subject: Subject?\n\n    // state\n    fileprivate var connection: ConnectionType?\n\n    init(source: Observable<Subject.Observer.Element>, makeSubject: @escaping () -> Subject) {\n        self.source = source\n        self.makeSubject = makeSubject\n        self.subject = nil\n        self.connection = nil\n    }\n\n    override func connect() -> Disposable {\n        return self.lock.performLocked {\n            if let connection = self.connection {\n                return connection\n            }\n\n            let singleAssignmentDisposable = SingleAssignmentDisposable()\n            let connection = Connection(parent: self, subjectObserver: self.lazySubject.asObserver(), lock: self.lock, subscription: singleAssignmentDisposable)\n            self.connection = connection\n            let subscription = self.source.subscribe(connection)\n            singleAssignmentDisposable.setDisposable(subscription)\n            return connection\n        }\n    }\n\n    private var lazySubject: Subject {\n        if let subject = self.subject {\n            return subject\n        }\n\n        let subject = self.makeSubject()\n        self.subject = subject\n        return subject\n    }\n\n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Subject.Element {\n        self.lazySubject.subscribe(observer)\n    }\n}\n\nfinal private class RefCountSink<ConnectableSource: ConnectableObservableType, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType where ConnectableSource.Element == Observer.Element {\n    typealias Element = Observer.Element \n    typealias Parent = RefCount<ConnectableSource>\n\n    private let parent: Parent\n\n    private var connectionIdSnapshot: Int64 = -1\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        let subscription = self.parent.source.subscribe(self)\n        self.parent.lock.lock(); defer { self.parent.lock.unlock() }\n\n        self.connectionIdSnapshot = self.parent.connectionId\n\n        if self.isDisposed {\n            return Disposables.create()\n        }\n\n        if self.parent.count == 0 {\n            self.parent.count = 1\n            self.parent.connectableSubscription = self.parent.source.connect()\n        }\n        else {\n            self.parent.count += 1\n        }\n\n        return Disposables.create {\n            subscription.dispose()\n            self.parent.lock.lock(); defer { self.parent.lock.unlock() }\n            if self.parent.connectionId != self.connectionIdSnapshot {\n                return\n            }\n            if self.parent.count == 1 {\n                self.parent.count = 0\n                guard let connectableSubscription = self.parent.connectableSubscription else {\n                    return\n                }\n\n                connectableSubscription.dispose()\n                self.parent.connectableSubscription = nil\n            }\n            else if self.parent.count > 1 {\n                self.parent.count -= 1\n            }\n            else {\n                rxFatalError(\"Something went wrong with RefCount disposing mechanism\")\n            }\n        }\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.forwardOn(event)\n        case .error, .completed:\n            self.parent.lock.lock()\n            if self.parent.connectionId == self.connectionIdSnapshot {\n                let connection = self.parent.connectableSubscription\n                defer { connection?.dispose() }\n                self.parent.count = 0\n                self.parent.connectionId = self.parent.connectionId &+ 1\n                self.parent.connectableSubscription = nil\n            }\n            self.parent.lock.unlock()\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class RefCount<ConnectableSource: ConnectableObservableType>: Producer<ConnectableSource.Element> {\n    fileprivate let lock = RecursiveLock()\n\n    // state\n    fileprivate var count = 0\n    fileprivate var connectionId: Int64 = 0\n    fileprivate var connectableSubscription = nil as Disposable?\n\n    fileprivate let source: ConnectableSource\n\n    init(source: ConnectableSource) {\n        self.source = source\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable)\n             where Observer.Element == ConnectableSource.Element {\n        let sink = RefCountSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class MulticastSink<Subject: SubjectType, Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias ResultType = Element\n    typealias MutlicastType = Multicast<Subject, Observer.Element>\n\n    private let parent: MutlicastType\n\n    init(parent: MutlicastType, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        do {\n            let subject = try self.parent.subjectSelector()\n            let connectable = ConnectableObservableAdapter(source: self.parent.source, makeSubject: { subject })\n\n            let observable = try self.parent.selector(connectable)\n\n            let subscription = observable.subscribe(self)\n            let connection = connectable.connect()\n\n            return Disposables.create(subscription, connection)\n        }\n        catch let e {\n            self.forwardOn(.error(e))\n            self.dispose()\n            return Disposables.create()\n        }\n    }\n\n    func on(_ event: Event<ResultType>) {\n        self.forwardOn(event)\n        switch event {\n        case .next: break\n        case .error, .completed:\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Multicast<Subject: SubjectType, Result>: Producer<Result> {\n    typealias SubjectSelectorType = () throws -> Subject\n    typealias SelectorType = (Observable<Subject.Element>) throws -> Observable<Result>\n\n    fileprivate let source: Observable<Subject.Observer.Element>\n    fileprivate let subjectSelector: SubjectSelectorType\n    fileprivate let selector: SelectorType\n\n    init(source: Observable<Subject.Observer.Element>, subjectSelector: @escaping SubjectSelectorType, selector: @escaping SelectorType) {\n        self.source = source\n        self.subjectSelector = subjectSelector\n        self.selector = selector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = MulticastSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Never.swift",
    "content": "//\n//  Never.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Returns a non-terminating observable sequence, which can be used to denote an infinite duration.\n\n     - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An observable sequence whose observers will never get called.\n     */\n    public static func never() -> Observable<Element> {\n        NeverProducer()\n    }\n}\n\nfinal private class NeverProducer<Element>: Producer<Element> {\n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        Disposables.create()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/ObserveOn.swift",
    "content": "//\n//  ObserveOn.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 7/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Wraps the source sequence in order to run its observer callbacks on the specified scheduler.\n\n     This only invokes observer callbacks on a `scheduler`. In case the subscription and/or unsubscription\n     actions have side-effects that require to be run on a scheduler, use `subscribeOn`.\n\n     - seealso: [observeOn operator on reactivex.io](http://reactivex.io/documentation/operators/observeon.html)\n\n     - parameter scheduler: Scheduler to notify observers on.\n     - returns: The source sequence whose observations happen on the specified scheduler.\n     */\n    public func observe(on scheduler: ImmediateSchedulerType)\n        -> Observable<Element> {\n        guard let serialScheduler = scheduler as? SerialDispatchQueueScheduler else {\n            return ObserveOn(source: self.asObservable(), scheduler: scheduler)\n        }\n\n        return ObserveOnSerialDispatchQueue(source: self.asObservable(),\n                                            scheduler: serialScheduler)\n    }\n\n    /**\n     Wraps the source sequence in order to run its observer callbacks on the specified scheduler.\n\n     This only invokes observer callbacks on a `scheduler`. In case the subscription and/or unsubscription\n     actions have side-effects that require to be run on a scheduler, use `subscribeOn`.\n\n     - seealso: [observeOn operator on reactivex.io](http://reactivex.io/documentation/operators/observeon.html)\n\n     - parameter scheduler: Scheduler to notify observers on.\n     - returns: The source sequence whose observations happen on the specified scheduler.\n     */\n    @available(*, deprecated, renamed: \"observe(on:)\")\n    public func observeOn(_ scheduler: ImmediateSchedulerType)\n        -> Observable<Element> {\n        observe(on: scheduler)\n    }\n}\n\nfinal private class ObserveOn<Element>: Producer<Element> {\n    let scheduler: ImmediateSchedulerType\n    let source: Observable<Element>\n\n    init(source: Observable<Element>, scheduler: ImmediateSchedulerType) {\n        self.scheduler = scheduler\n        self.source = source\n\n#if TRACE_RESOURCES\n        _ = Resources.incrementTotal()\n#endif\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = ObserveOnSink(scheduler: self.scheduler, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n\n#if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n    }\n#endif\n}\n\nenum ObserveOnState : Int32 {\n    // pump is not running\n    case stopped = 0\n    // pump is running\n    case running = 1\n}\n\nfinal private class ObserveOnSink<Observer: ObserverType>: ObserverBase<Observer.Element> {\n    typealias Element = Observer.Element \n\n    let scheduler: ImmediateSchedulerType\n\n    var lock = SpinLock()\n    let observer: Observer\n\n    // state\n    var state = ObserveOnState.stopped\n    var queue = Queue<Event<Element>>(capacity: 10)\n\n    let scheduleDisposable = SerialDisposable()\n    let cancel: Cancelable\n\n    init(scheduler: ImmediateSchedulerType, observer: Observer, cancel: Cancelable) {\n        self.scheduler = scheduler\n        self.observer = observer\n        self.cancel = cancel\n    }\n\n    override func onCore(_ event: Event<Element>) {\n        let shouldStart = self.lock.performLocked { () -> Bool in\n            self.queue.enqueue(event)\n\n            switch self.state {\n            case .stopped:\n                self.state = .running\n                return true\n            case .running:\n                return false\n            }\n        }\n\n        if shouldStart {\n            self.scheduleDisposable.disposable = self.scheduler.scheduleRecursive((), action: self.run)\n        }\n    }\n\n    func run(_ state: (), _ recurse: (()) -> Void) {\n        let (nextEvent, observer) = self.lock.performLocked { () -> (Event<Element>?, Observer) in\n            if !self.queue.isEmpty {\n                return (self.queue.dequeue(), self.observer)\n            }\n            else {\n                self.state = .stopped\n                return (nil, self.observer)\n            }\n        }\n\n        if let nextEvent = nextEvent, !self.cancel.isDisposed {\n            observer.on(nextEvent)\n            if nextEvent.isStopEvent {\n                self.dispose()\n            }\n        }\n        else {\n            return\n        }\n\n        let shouldContinue = self.shouldContinue_synchronized()\n\n        if shouldContinue {\n            recurse(())\n        }\n    }\n\n    func shouldContinue_synchronized() -> Bool {\n        self.lock.performLocked {\n            let isEmpty = self.queue.isEmpty\n            if isEmpty { self.state = .stopped }\n            return !isEmpty\n        }\n    }\n\n    override func dispose() {\n        super.dispose()\n\n        self.cancel.dispose()\n        self.scheduleDisposable.dispose()\n    }\n}\n\n#if TRACE_RESOURCES\n    private let numberOfSerialDispatchObservables = AtomicInt(0)\n    extension Resources {\n        /**\n         Counts number of `SerialDispatchQueueObservables`.\n\n         Purposed for unit tests.\n         */\n        public static var numberOfSerialDispatchQueueObservables: Int32 {\n            return load(numberOfSerialDispatchObservables)\n        }\n    }\n#endif\n\nfinal private class ObserveOnSerialDispatchQueueSink<Observer: ObserverType>: ObserverBase<Observer.Element> {\n    let scheduler: SerialDispatchQueueScheduler\n    let observer: Observer\n\n    let cancel: Cancelable\n\n    var cachedScheduleLambda: (((sink: ObserveOnSerialDispatchQueueSink<Observer>, event: Event<Element>)) -> Disposable)!\n\n    init(scheduler: SerialDispatchQueueScheduler, observer: Observer, cancel: Cancelable) {\n        self.scheduler = scheduler\n        self.observer = observer\n        self.cancel = cancel\n        super.init()\n\n        self.cachedScheduleLambda = { pair in\n            guard !cancel.isDisposed else { return Disposables.create() }\n\n            pair.sink.observer.on(pair.event)\n\n            if pair.event.isStopEvent {\n                pair.sink.dispose()\n            }\n\n            return Disposables.create()\n        }\n    }\n\n    override func onCore(_ event: Event<Element>) {\n        _ = self.scheduler.schedule((self, event), action: self.cachedScheduleLambda!)\n    }\n\n    override func dispose() {\n        super.dispose()\n\n        self.cancel.dispose()\n    }\n}\n\nfinal private class ObserveOnSerialDispatchQueue<Element>: Producer<Element> {\n    let scheduler: SerialDispatchQueueScheduler\n    let source: Observable<Element>\n\n    init(source: Observable<Element>, scheduler: SerialDispatchQueueScheduler) {\n        self.scheduler = scheduler\n        self.source = source\n\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n            _ = increment(numberOfSerialDispatchObservables)\n        #endif\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = ObserveOnSerialDispatchQueueSink(scheduler: self.scheduler, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n\n    #if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n        _ = decrement(numberOfSerialDispatchObservables)\n    }\n    #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Optional.swift",
    "content": "//\n//  Optional.swift\n//  RxSwift\n//\n//  Created by tarunon on 2016/12/13.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Converts a optional to an observable sequence.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - parameter optional: Optional element in the resulting observable sequence.\n     - returns: An observable sequence containing the wrapped value or not from given optional.\n     */\n    public static func from(optional: Element?) -> Observable<Element> {\n        ObservableOptional(optional: optional)\n    }\n\n    /**\n     Converts a optional to an observable sequence.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - parameter optional: Optional element in the resulting observable sequence.\n     - parameter scheduler: Scheduler to send the optional element on.\n     - returns: An observable sequence containing the wrapped value or not from given optional.\n     */\n    public static func from(optional: Element?, scheduler: ImmediateSchedulerType) -> Observable<Element> {\n        ObservableOptionalScheduled(optional: optional, scheduler: scheduler)\n    }\n}\n\nfinal private class ObservableOptionalScheduledSink<Observer: ObserverType>: Sink<Observer> {\n    typealias Element = Observer.Element \n    typealias Parent = ObservableOptionalScheduled<Element>\n\n    private let parent: Parent\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        return self.parent.scheduler.schedule(self.parent.optional) { (optional: Element?) -> Disposable in\n            if let next = optional {\n                self.forwardOn(.next(next))\n                return self.parent.scheduler.schedule(()) { _ in\n                    self.forwardOn(.completed)\n                    self.dispose()\n                    return Disposables.create()\n                }\n            } else {\n                self.forwardOn(.completed)\n                self.dispose()\n                return Disposables.create()\n            }\n        }\n    }\n}\n\nfinal private class ObservableOptionalScheduled<Element>: Producer<Element> {\n    fileprivate let optional: Element?\n    fileprivate let scheduler: ImmediateSchedulerType\n\n    init(optional: Element?, scheduler: ImmediateSchedulerType) {\n        self.optional = optional\n        self.scheduler = scheduler\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = ObservableOptionalScheduledSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class ObservableOptional<Element>: Producer<Element> {\n    private let optional: Element?\n    \n    init(optional: Element?) {\n        self.optional = optional\n    }\n    \n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        if let element = self.optional {\n            observer.on(.next(element))\n        }\n        observer.on(.completed)\n        return Disposables.create()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Producer.swift",
    "content": "//\n//  Producer.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/20/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nclass Producer<Element>: Observable<Element> {\n    override init() {\n        super.init()\n    }\n\n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        if !CurrentThreadScheduler.isScheduleRequired {\n            // The returned disposable needs to release all references once it was disposed.\n            let disposer = SinkDisposer()\n            let sinkAndSubscription = self.run(observer, cancel: disposer)\n            disposer.setSinkAndSubscription(sink: sinkAndSubscription.sink, subscription: sinkAndSubscription.subscription)\n\n            return disposer\n        }\n        else {\n            return CurrentThreadScheduler.instance.schedule(()) { _ in\n                let disposer = SinkDisposer()\n                let sinkAndSubscription = self.run(observer, cancel: disposer)\n                disposer.setSinkAndSubscription(sink: sinkAndSubscription.sink, subscription: sinkAndSubscription.subscription)\n\n                return disposer\n            }\n        }\n    }\n\n    func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        rxAbstractMethod()\n    }\n}\n\nprivate final class SinkDisposer: Cancelable {\n    private enum DisposeState: Int32 {\n        case disposed = 1\n        case sinkAndSubscriptionSet = 2\n    }\n\n    private let state = AtomicInt(0)\n    private var sink: Disposable?\n    private var subscription: Disposable?\n\n    var isDisposed: Bool {\n        isFlagSet(self.state, DisposeState.disposed.rawValue)\n    }\n\n    func setSinkAndSubscription(sink: Disposable, subscription: Disposable) {\n        self.sink = sink\n        self.subscription = subscription\n\n        let previousState = fetchOr(self.state, DisposeState.sinkAndSubscriptionSet.rawValue)\n        if (previousState & DisposeState.sinkAndSubscriptionSet.rawValue) != 0 {\n            rxFatalError(\"Sink and subscription were already set\")\n        }\n\n        if (previousState & DisposeState.disposed.rawValue) != 0 {\n            sink.dispose()\n            subscription.dispose()\n            self.sink = nil\n            self.subscription = nil\n        }\n    }\n\n    func dispose() {\n        let previousState = fetchOr(self.state, DisposeState.disposed.rawValue)\n\n        if (previousState & DisposeState.disposed.rawValue) != 0 {\n            return\n        }\n\n        if (previousState & DisposeState.sinkAndSubscriptionSet.rawValue) != 0 {\n            guard let sink = self.sink else {\n                rxFatalError(\"Sink not set\")\n            }\n            guard let subscription = self.subscription else {\n                rxFatalError(\"Subscription not set\")\n            }\n\n            sink.dispose()\n            subscription.dispose()\n\n            self.sink = nil\n            self.subscription = nil\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Range.swift",
    "content": "//\n//  Range.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/13/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType where Element: RxAbstractInteger {\n    /**\n     Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to generate and send out observer messages.\n\n     - seealso: [range operator on reactivex.io](http://reactivex.io/documentation/operators/range.html)\n\n     - parameter start: The value of the first integer in the sequence.\n     - parameter count: The number of sequential integers to generate.\n     - parameter scheduler: Scheduler to run the generator loop on.\n     - returns: An observable sequence that contains a range of sequential integral numbers.\n     */\n    public static func range(start: Element, count: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element> {\n        RangeProducer<Element>(start: start, count: count, scheduler: scheduler)\n    }\n}\n\nfinal private class RangeProducer<Element: RxAbstractInteger>: Producer<Element> {\n    fileprivate let start: Element\n    fileprivate let count: Element\n    fileprivate let scheduler: ImmediateSchedulerType\n\n    init(start: Element, count: Element, scheduler: ImmediateSchedulerType) {\n        guard count >= 0 else {\n            rxFatalError(\"count can't be negative\")\n        }\n\n        guard start &+ (count - 1) >= start || count == 0 else {\n            rxFatalError(\"overflow of count\")\n        }\n\n        self.start = start\n        self.count = count\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = RangeSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class RangeSink<Observer: ObserverType>: Sink<Observer> where Observer.Element: RxAbstractInteger {\n    typealias Parent = RangeProducer<Observer.Element>\n    \n    private let parent: Parent\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        return self.parent.scheduler.scheduleRecursive(0 as Observer.Element) { i, recurse in\n            if i < self.parent.count {\n                self.forwardOn(.next(self.parent.start + i))\n                recurse(i + 1)\n            }\n            else {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Reduce.swift",
    "content": "//\n//  Reduce.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/1/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n\nextension ObservableType {\n    /**\n    Applies an `accumulator` function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified `seed` value is used as the initial accumulator value.\n\n    For aggregation behavior with incremental intermediate results, see `scan`.\n\n    - seealso: [reduce operator on reactivex.io](http://reactivex.io/documentation/operators/reduce.html)\n\n    - parameter seed: The initial accumulator value.\n    - parameter accumulator: A accumulator function to be invoked on each element.\n    - parameter mapResult: A function to transform the final accumulator value into the result value.\n    - returns: An observable sequence containing a single element with the final accumulator value.\n    */\n    public func reduce<A, Result>(_ seed: A, accumulator: @escaping (A, Element) throws -> A, mapResult: @escaping (A) throws -> Result)\n        -> Observable<Result> {\n        Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: mapResult)\n    }\n\n    /**\n    Applies an `accumulator` function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified `seed` value is used as the initial accumulator value.\n    \n    For aggregation behavior with incremental intermediate results, see `scan`.\n\n    - seealso: [reduce operator on reactivex.io](http://reactivex.io/documentation/operators/reduce.html)\n    \n    - parameter seed: The initial accumulator value.\n    - parameter accumulator: A accumulator function to be invoked on each element.\n    - returns: An observable sequence containing a single element with the final accumulator value.\n    */\n    public func reduce<A>(_ seed: A, accumulator: @escaping (A, Element) throws -> A)\n        -> Observable<A> {\n        Reduce(source: self.asObservable(), seed: seed, accumulator: accumulator, mapResult: { $0 })\n    }\n}\n\nfinal private class ReduceSink<SourceType, AccumulateType, Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias ResultType = Observer.Element \n    typealias Parent = Reduce<SourceType, AccumulateType, ResultType>\n    \n    private let parent: Parent\n    private var accumulation: AccumulateType\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.accumulation = parent.seed\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<SourceType>) {\n        switch event {\n        case .next(let value):\n            do {\n                self.accumulation = try self.parent.accumulator(self.accumulation, value)\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        case .error(let e):\n            self.forwardOn(.error(e))\n            self.dispose()\n        case .completed:\n            do {\n                let result = try self.parent.mapResult(self.accumulation)\n                self.forwardOn(.next(result))\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        }\n    }\n}\n\nfinal private class Reduce<SourceType, AccumulateType, ResultType>: Producer<ResultType> {\n    typealias AccumulatorType = (AccumulateType, SourceType) throws -> AccumulateType\n    typealias ResultSelectorType = (AccumulateType) throws -> ResultType\n    \n    private let source: Observable<SourceType>\n    fileprivate let seed: AccumulateType\n    fileprivate let accumulator: AccumulatorType\n    fileprivate let mapResult: ResultSelectorType\n    \n    init(source: Observable<SourceType>, seed: AccumulateType, accumulator: @escaping AccumulatorType, mapResult: @escaping ResultSelectorType) {\n        self.source = source\n        self.seed = seed\n        self.accumulator = accumulator\n        self.mapResult = mapResult\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType {\n        let sink = ReduceSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Repeat.swift",
    "content": "//\n//  Repeat.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/13/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Generates an observable sequence that repeats the given element infinitely, using the specified scheduler to send out observer messages.\n\n     - seealso: [repeat operator on reactivex.io](http://reactivex.io/documentation/operators/repeat.html)\n\n     - parameter element: Element to repeat.\n     - parameter scheduler: Scheduler to run the producer loop on.\n     - returns: An observable sequence that repeats the given element infinitely.\n     */\n    public static func repeatElement(_ element: Element, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element> {\n        RepeatElement(element: element, scheduler: scheduler)\n    }\n}\n\nfinal private class RepeatElement<Element>: Producer<Element> {\n    fileprivate let element: Element\n    fileprivate let scheduler: ImmediateSchedulerType\n    \n    init(element: Element, scheduler: ImmediateSchedulerType) {\n        self.element = element\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = RepeatElementSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class RepeatElementSink<Observer: ObserverType>: Sink<Observer> {\n    typealias Parent = RepeatElement<Observer.Element>\n    \n    private let parent: Parent\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        return self.parent.scheduler.scheduleRecursive(self.parent.element) { e, recurse in\n            self.forwardOn(.next(e))\n            recurse(e)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/RetryWhen.swift",
    "content": "//\n//  RetryWhen.swift\n//  RxSwift\n//\n//  Created by Junior B. on 06/10/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    public func retry<TriggerObservable: ObservableType, Error: Swift.Error>(when notificationHandler: @escaping (Observable<Error>) -> TriggerObservable)\n        -> Observable<Element> {\n        RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler)\n    }\n\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    @available(*, deprecated, renamed: \"retry(when:)\")\n    public func retryWhen<TriggerObservable: ObservableType, Error: Swift.Error>(_ notificationHandler: @escaping (Observable<Error>) -> TriggerObservable)\n        -> Observable<Element> {\n        retry(when: notificationHandler)\n    }\n\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    public func retry<TriggerObservable: ObservableType>(when notificationHandler: @escaping (Observable<Swift.Error>) -> TriggerObservable)\n        -> Observable<Element> {\n        RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler)\n    }\n\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    @available(*, deprecated, renamed: \"retry(when:)\")\n    public func retryWhen<TriggerObservable: ObservableType>(_ notificationHandler: @escaping (Observable<Swift.Error>) -> TriggerObservable)\n        -> Observable<Element> {\n        RetryWhenSequence(sources: InfiniteSequence(repeatedValue: self.asObservable()), notificationHandler: notificationHandler)\n    }\n}\n\nfinal private class RetryTriggerSink<Sequence: Swift.Sequence, Observer: ObserverType, TriggerObservable: ObservableType, Error>\n    : ObserverType where Sequence.Element: ObservableType, Sequence.Element.Element == Observer.Element {\n    typealias Element = TriggerObservable.Element\n    \n    typealias Parent = RetryWhenSequenceSinkIter<Sequence, Observer, TriggerObservable, Error>\n    \n    private let parent: Parent\n\n    init(parent: Parent) {\n        self.parent = parent\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.parent.parent.lastError = nil\n            self.parent.parent.schedule(.moveNext)\n        case .error(let e):\n            self.parent.parent.forwardOn(.error(e))\n            self.parent.parent.dispose()\n        case .completed:\n            self.parent.parent.forwardOn(.completed)\n            self.parent.parent.dispose()\n        }\n    }\n}\n\nfinal private class RetryWhenSequenceSinkIter<Sequence: Swift.Sequence, Observer: ObserverType, TriggerObservable: ObservableType, Error>\n    : ObserverType\n    , Disposable where Sequence.Element: ObservableType, Sequence.Element.Element == Observer.Element {\n    typealias Element = Observer.Element \n    typealias Parent = RetryWhenSequenceSink<Sequence, Observer, TriggerObservable, Error>\n\n    fileprivate let parent: Parent\n    private let errorHandlerSubscription = SingleAssignmentDisposable()\n    private let subscription: Disposable\n\n    init(parent: Parent, subscription: Disposable) {\n        self.parent = parent\n        self.subscription = subscription\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.parent.forwardOn(event)\n        case .error(let error):\n            self.parent.lastError = error\n\n            if let failedWith = error as? Error {\n                // dispose current subscription\n                self.subscription.dispose()\n\n                let errorHandlerSubscription = self.parent.notifier.subscribe(RetryTriggerSink(parent: self))\n                self.errorHandlerSubscription.setDisposable(errorHandlerSubscription)\n                self.parent.errorSubject.on(.next(failedWith))\n            }\n            else {\n                self.parent.forwardOn(.error(error))\n                self.parent.dispose()\n            }\n        case .completed:\n            self.parent.forwardOn(event)\n            self.parent.dispose()\n        }\n    }\n\n    final func dispose() {\n        self.subscription.dispose()\n        self.errorHandlerSubscription.dispose()\n    }\n}\n\nfinal private class RetryWhenSequenceSink<Sequence: Swift.Sequence, Observer: ObserverType, TriggerObservable: ObservableType, Error>\n    : TailRecursiveSink<Sequence, Observer> where Sequence.Element: ObservableType, Sequence.Element.Element == Observer.Element {\n    typealias Element = Observer.Element \n    typealias Parent = RetryWhenSequence<Sequence, TriggerObservable, Error>\n    \n    let lock = RecursiveLock()\n    \n    private let parent: Parent\n    \n    fileprivate var lastError: Swift.Error?\n    fileprivate let errorSubject = PublishSubject<Error>()\n    private let handler: Observable<TriggerObservable.Element>\n    fileprivate let notifier = PublishSubject<TriggerObservable.Element>()\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.handler = parent.notificationHandler(self.errorSubject).asObservable()\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    override func done() {\n        if let lastError = self.lastError {\n            self.forwardOn(.error(lastError))\n            self.lastError = nil\n        }\n        else {\n            self.forwardOn(.completed)\n        }\n\n        self.dispose()\n    }\n    \n    override func extract(_ observable: Observable<Element>) -> SequenceGenerator? {\n        // It is important to always return `nil` here because there are side effects in the `run` method\n        // that are dependant on particular `retryWhen` operator so single operator stack can't be reused in this\n        // case.\n        return nil\n    }\n\n    override func subscribeToNext(_ source: Observable<Element>) -> Disposable {\n        let subscription = SingleAssignmentDisposable()\n        let iter = RetryWhenSequenceSinkIter(parent: self, subscription: subscription)\n        subscription.setDisposable(source.subscribe(iter))\n        return iter\n    }\n\n    override func run(_ sources: SequenceGenerator) -> Disposable {\n        let triggerSubscription = self.handler.subscribe(self.notifier.asObserver())\n        let superSubscription = super.run(sources)\n        return Disposables.create(superSubscription, triggerSubscription)\n    }\n}\n\nfinal private class RetryWhenSequence<Sequence: Swift.Sequence, TriggerObservable: ObservableType, Error>: Producer<Sequence.Element.Element> where Sequence.Element: ObservableType {\n    typealias Element = Sequence.Element.Element\n    \n    private let sources: Sequence\n    fileprivate let notificationHandler: (Observable<Error>) -> TriggerObservable\n    \n    init(sources: Sequence, notificationHandler: @escaping (Observable<Error>) -> TriggerObservable) {\n        self.sources = sources\n        self.notificationHandler = notificationHandler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = RetryWhenSequenceSink<Sequence, Observer, TriggerObservable, Error>(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run((self.sources.makeIterator(), nil))\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Sample.swift",
    "content": "//\n//  Sample.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/1/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Samples the source observable sequence using a sampler observable sequence producing sampling ticks.\n\n     Upon each sampling tick, the latest element (if any) in the source sequence during the last sampling interval is sent to the resulting sequence.\n\n     **In case there were no new elements between sampler ticks, you may provide a default value to be emitted, instead\n       to the resulting sequence otherwise no element is sent.**\n\n     - seealso: [sample operator on reactivex.io](http://reactivex.io/documentation/operators/sample.html)\n\n     - parameter sampler: Sampling tick sequence.\n     - parameter defaultValue: a value to return if there are no new elements between sampler ticks\n     - returns: Sampled observable sequence.\n     */\n    public func sample<Source: ObservableType>(_ sampler: Source, defaultValue: Element? = nil)\n        -> Observable<Element> {\n            return Sample(source: self.asObservable(), sampler: sampler.asObservable(), defaultValue: defaultValue)\n    }\n}\n\nfinal private class SamplerSink<Observer: ObserverType, SampleType>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias Element = SampleType\n    \n    typealias Parent = SampleSequenceSink<Observer, SampleType>\n    \n    private let parent: Parent\n\n    var lock: RecursiveLock {\n        self.parent.lock\n    }\n    \n    init(parent: Parent) {\n        self.parent = parent\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next, .completed:\n            if let element = parent.element ?? self.parent.defaultValue {\n                self.parent.element = nil\n                self.parent.forwardOn(.next(element))\n            }\n\n            if self.parent.atEnd {\n                self.parent.forwardOn(.completed)\n                self.parent.dispose()\n            }\n        case .error(let e):\n            self.parent.forwardOn(.error(e))\n            self.parent.dispose()\n        }\n    }\n}\n\nfinal private class SampleSequenceSink<Observer: ObserverType, SampleType>\n    : Sink<Observer>\n    , ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias Element = Observer.Element \n    typealias Parent = Sample<Element, SampleType>\n    \n    fileprivate let parent: Parent\n    fileprivate let defaultValue: Element?\n\n    let lock = RecursiveLock()\n    \n    // state\n    fileprivate var element = nil as Element?\n    fileprivate var atEnd = false\n    \n    private let sourceSubscription = SingleAssignmentDisposable()\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable, defaultValue: Element? = nil) {\n        self.parent = parent\n        self.defaultValue = defaultValue\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        self.sourceSubscription.setDisposable(self.parent.source.subscribe(self))\n        let samplerSubscription = self.parent.sampler.subscribe(SamplerSink(parent: self))\n        \n        return Disposables.create(sourceSubscription, samplerSubscription)\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next(let element):\n            self.element = element\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            self.atEnd = true\n            self.sourceSubscription.dispose()\n        }\n    }\n    \n}\n\nfinal private class Sample<Element, SampleType>: Producer<Element> {\n    fileprivate let source: Observable<Element>\n    fileprivate let sampler: Observable<SampleType>\n    fileprivate let defaultValue: Element?\n    \n    init(source: Observable<Element>, sampler: Observable<SampleType>, defaultValue: Element? = nil) {\n        self.source = source\n        self.sampler = sampler\n        self.defaultValue = defaultValue\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = SampleSequenceSink(parent: self, observer: observer, cancel: cancel, defaultValue: self.defaultValue)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Scan.swift",
    "content": "//\n//  Scan.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.\n\n     For aggregation behavior with no intermediate results, see `reduce`.\n\n     - seealso: [scan operator on reactivex.io](http://reactivex.io/documentation/operators/scan.html)\n\n     - parameter seed: The initial accumulator value.\n     - parameter accumulator: An accumulator function to be invoked on each element.\n     - returns: An observable sequence containing the accumulated values.\n     */\n    public func scan<A>(into seed: A, accumulator: @escaping (inout A, Element) throws -> Void)\n        -> Observable<A> {\n        Scan(source: self.asObservable(), seed: seed, accumulator: accumulator)\n    }\n\n    /**\n     Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.\n\n     For aggregation behavior with no intermediate results, see `reduce`.\n\n     - seealso: [scan operator on reactivex.io](http://reactivex.io/documentation/operators/scan.html)\n\n     - parameter seed: The initial accumulator value.\n     - parameter accumulator: An accumulator function to be invoked on each element.\n     - returns: An observable sequence containing the accumulated values.\n     */\n    public func scan<A>(_ seed: A, accumulator: @escaping (A, Element) throws -> A)\n        -> Observable<A> {\n        return Scan(source: self.asObservable(), seed: seed) { acc, element in\n            let currentAcc = acc\n            acc = try accumulator(currentAcc, element)\n        }\n    }\n}\n\nfinal private class ScanSink<Element, Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Accumulate = Observer.Element \n    typealias Parent = Scan<Element, Accumulate>\n\n    private let parent: Parent\n    private var accumulate: Accumulate\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.accumulate = parent.seed\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let element):\n            do {\n                try self.parent.accumulator(&self.accumulate, element)\n                self.forwardOn(.next(self.accumulate))\n            }\n            catch let error {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n    \n}\n\nfinal private class Scan<Element, Accumulate>: Producer<Accumulate> {\n    typealias Accumulator = (inout Accumulate, Element) throws -> Void\n    \n    private let source: Observable<Element>\n    fileprivate let seed: Accumulate\n    fileprivate let accumulator: Accumulator\n    \n    init(source: Observable<Element>, seed: Accumulate, accumulator: @escaping Accumulator) {\n        self.source = source\n        self.seed = seed\n        self.accumulator = accumulator\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Accumulate {\n        let sink = ScanSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Sequence.swift",
    "content": "//\n//  Sequence.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 11/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    // MARK: of\n\n    /**\n     This method creates a new Observable instance with a variable number of elements.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - parameter elements: Elements to generate.\n     - parameter scheduler: Scheduler to send elements on. If `nil`, elements are sent immediately on subscription.\n     - returns: The observable sequence whose elements are pulled from the given arguments.\n     */\n    public static func of(_ elements: Element ..., scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element> {\n        ObservableSequence(elements: elements, scheduler: scheduler)\n    }\n}\n\nextension ObservableType {\n    /**\n     Converts an array to an observable sequence.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - returns: The observable sequence whose elements are pulled from the given enumerable sequence.\n     */\n    public static func from(_ array: [Element], scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element> {\n        ObservableSequence(elements: array, scheduler: scheduler)\n    }\n\n    /**\n     Converts a sequence to an observable sequence.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - returns: The observable sequence whose elements are pulled from the given enumerable sequence.\n     */\n    public static func from<Sequence: Swift.Sequence>(_ sequence: Sequence, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Observable<Element> where Sequence.Element == Element {\n        ObservableSequence(elements: sequence, scheduler: scheduler)\n    }\n}\n\nfinal private class ObservableSequenceSink<Sequence: Swift.Sequence, Observer: ObserverType>: Sink<Observer> where Sequence.Element == Observer.Element {\n    typealias Parent = ObservableSequence<Sequence>\n\n    private let parent: Parent\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        return self.parent.scheduler.scheduleRecursive(self.parent.elements.makeIterator()) { iterator, recurse in\n            var mutableIterator = iterator\n            if let next = mutableIterator.next() {\n                self.forwardOn(.next(next))\n                recurse(mutableIterator)\n            }\n            else {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n        }\n    }\n}\n\nfinal private class ObservableSequence<Sequence: Swift.Sequence>: Producer<Sequence.Element> {\n    fileprivate let elements: Sequence\n    fileprivate let scheduler: ImmediateSchedulerType\n\n    init(elements: Sequence, scheduler: ImmediateSchedulerType) {\n        self.elements = elements\n        self.scheduler = scheduler\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = ObservableSequenceSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/ShareReplayScope.swift",
    "content": "//\n//  ShareReplayScope.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/28/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n/// Subject lifetime scope\npublic enum SubjectLifetimeScope {\n    /**\n     **Each connection will have it's own subject instance to store replay events.**\n     **Connections will be isolated from each another.**\n\n     Configures the underlying implementation to behave equivalent to.\n     \n     ```\n     source.multicast(makeSubject: { MySubject() }).refCount()\n     ```\n\n     **This is the recommended default.**\n\n     This has the following consequences:\n     * `retry` or `concat` operators will function as expected because terminating the sequence will clear internal state.\n     * Each connection to source observable sequence will use it's own subject.\n     * When the number of subscribers drops from 1 to 0 and connection to source sequence is disposed, subject will be cleared.\n\n     \n     ```\n     let xs = Observable.deferred { () -> Observable<TimeInterval> in\n             print(\"Performing work ...\")\n             return Observable.just(Date().timeIntervalSince1970)\n         }\n         .share(replay: 1, scope: .whileConnected)\n\n     _ = xs.subscribe(onNext: { print(\"next \\($0)\") }, onCompleted: { print(\"completed\\n\") })\n     _ = xs.subscribe(onNext: { print(\"next \\($0)\") }, onCompleted: { print(\"completed\\n\") })\n     _ = xs.subscribe(onNext: { print(\"next \\($0)\") }, onCompleted: { print(\"completed\\n\") })\n\n     ```\n\n     Notice how time interval is different and `Performing work ...` is printed each time)\n     \n     ```\n     Performing work ...\n     next 1495998900.82141\n     completed\n\n     Performing work ...\n     next 1495998900.82359\n     completed\n\n     Performing work ...\n     next 1495998900.82444\n     completed\n\n\n     ```\n     \n     */\n    case whileConnected\n\n    /**\n     **One subject will store replay events for all connections to source.**\n     **Connections won't be isolated from each another.**\n\n     Configures the underlying implementation behave equivalent to.\n\n     ```\n     source.multicast(MySubject()).refCount()\n     ```\n     \n     This has the following consequences:\n     * Using `retry` or `concat` operators after this operator usually isn't advised.\n     * Each connection to source observable sequence will share the same subject.\n     * After number of subscribers drops from 1 to 0 and connection to source observable sequence is dispose, this operator will \n       continue holding a reference to the same subject.\n       If at some later moment a new observer initiates a new connection to source it can potentially receive\n       some of the stale events received during previous connection.\n     * After source sequence terminates any new observer will always immediately receive replayed elements and terminal event.\n       No new subscriptions to source observable sequence will be attempted.\n\n     ```\n     let xs = Observable.deferred { () -> Observable<TimeInterval> in\n             print(\"Performing work ...\")\n             return Observable.just(Date().timeIntervalSince1970)\n         }\n         .share(replay: 1, scope: .forever)\n\n     _ = xs.subscribe(onNext: { print(\"next \\($0)\") }, onCompleted: { print(\"completed\\n\") })\n     _ = xs.subscribe(onNext: { print(\"next \\($0)\") }, onCompleted: { print(\"completed\\n\") })\n     _ = xs.subscribe(onNext: { print(\"next \\($0)\") }, onCompleted: { print(\"completed\\n\") })\n     ```\n     \n     Notice how time interval is the same, replayed, and `Performing work ...` is printed only once\n     \n     ```\n     Performing work ...\n     next 1495999013.76356\n     completed\n\n     next 1495999013.76356\n     completed\n\n     next 1495999013.76356\n     completed\n     ```\n     \n    */\n    case forever\n}\n\nextension ObservableType {\n\n    /**\n     Returns an observable sequence that **shares a single subscription to the underlying sequence**, and immediately upon subscription replays  elements in buffer.\n     \n     This operator is equivalent to:\n     * `.whileConnected`\n     ```\n     // Each connection will have it's own subject instance to store replay events.\n     // Connections will be isolated from each another.\n     source.multicast(makeSubject: { Replay.create(bufferSize: replay) }).refCount()\n     ```\n     * `.forever`\n     ```\n     // One subject will store replay events for all connections to source.\n     // Connections won't be isolated from each another.\n     source.multicast(Replay.create(bufferSize: replay)).refCount()\n     ```\n     \n     It uses optimized versions of the operators for most common operations.\n\n     - parameter replay: Maximum element count of the replay buffer.\n     - parameter scope: Lifetime scope of sharing subject. For more information see `SubjectLifetimeScope` enum.\n\n     - seealso: [shareReplay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html)\n\n     - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\n     */\n    public func share(replay: Int = 0, scope: SubjectLifetimeScope = .whileConnected)\n        -> Observable<Element> {\n        switch scope {\n        case .forever:\n            switch replay {\n            case 0: return self.multicast(PublishSubject()).refCount()\n            default: return self.multicast(ReplaySubject.create(bufferSize: replay)).refCount()\n            }\n        case .whileConnected:\n            switch replay {\n            case 0: return ShareWhileConnected(source: self.asObservable())\n            case 1: return ShareReplay1WhileConnected(source: self.asObservable())\n            default: return self.multicast(makeSubject: { ReplaySubject.create(bufferSize: replay) }).refCount()\n            }\n        }\n    }\n}\n\nprivate final class ShareReplay1WhileConnectedConnection<Element>\n    : ObserverType\n    , SynchronizedUnsubscribeType {\n    typealias Observers = AnyObserver<Element>.s\n    typealias DisposeKey = Observers.KeyType\n\n    typealias Parent = ShareReplay1WhileConnected<Element>\n    private let parent: Parent\n    private let subscription = SingleAssignmentDisposable()\n\n    private let lock: RecursiveLock\n    private var disposed: Bool = false\n    fileprivate var observers = Observers()\n    private var element: Element?\n\n    init(parent: Parent, lock: RecursiveLock) {\n        self.parent = parent\n        self.lock = lock\n\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n    }\n\n    final func on(_ event: Event<Element>) {\n        let observers = self.lock.performLocked { self.synchronized_on(event) }\n        dispatch(observers, event)\n    }\n\n    final private func synchronized_on(_ event: Event<Element>) -> Observers {\n        if self.disposed {\n            return Observers()\n        }\n\n        switch event {\n        case .next(let element):\n            self.element = element\n            return self.observers\n        case .error, .completed:\n            let observers = self.observers\n            self.synchronized_dispose()\n            return observers\n        }\n    }\n\n    final func connect() {\n        self.subscription.setDisposable(self.parent.source.subscribe(self))\n    }\n\n    final func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.performLocked {\n            if let element = self.element {\n                observer.on(.next(element))\n            }\n\n            let disposeKey = self.observers.insert(observer.on)\n\n            return SubscriptionDisposable(owner: self, key: disposeKey)\n        }\n    }\n\n    final private func synchronized_dispose() {\n        self.disposed = true\n        if self.parent.connection === self {\n            self.parent.connection = nil\n        }\n        self.observers = Observers()\n    }\n\n    final func synchronizedUnsubscribe(_ disposeKey: DisposeKey) {\n        if self.lock.performLocked({ self.synchronized_unsubscribe(disposeKey) }) {\n            self.subscription.dispose()\n        }\n    }\n\n    @inline(__always)\n    final private func synchronized_unsubscribe(_ disposeKey: DisposeKey) -> Bool {\n        // if already unsubscribed, just return\n        if self.observers.removeKey(disposeKey) == nil {\n            return false\n        }\n\n        if self.observers.count == 0 {\n            self.synchronized_dispose()\n            return true\n        }\n\n        return false\n    }\n\n    #if TRACE_RESOURCES\n        deinit {\n            _ = Resources.decrementTotal()\n        }\n    #endif\n}\n\n// optimized version of share replay for most common case\nfinal private class ShareReplay1WhileConnected<Element>\n    : Observable<Element> {\n\n    fileprivate typealias Connection = ShareReplay1WhileConnectedConnection<Element>\n\n    fileprivate let source: Observable<Element>\n\n    private let lock = RecursiveLock()\n\n    fileprivate var connection: Connection?\n\n    init(source: Observable<Element>) {\n        self.source = source\n    }\n\n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.lock()\n        let connection = self.synchronized_subscribe(observer)\n        let count = connection.observers.count\n\n        let disposable = connection.synchronized_subscribe(observer)\n        self.lock.unlock()\n        \n        if count == 0 {\n            connection.connect()\n        }\n\n        return disposable\n    }\n\n    @inline(__always)\n    private func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Connection where Observer.Element == Element {\n        let connection: Connection\n\n        if let existingConnection = self.connection {\n            connection = existingConnection\n        }\n        else {\n            connection = ShareReplay1WhileConnectedConnection<Element>(\n                parent: self,\n                lock: self.lock)\n            self.connection = connection\n        }\n\n        return connection\n    }\n}\n\nprivate final class ShareWhileConnectedConnection<Element>\n    : ObserverType\n    , SynchronizedUnsubscribeType {\n    typealias Observers = AnyObserver<Element>.s\n    typealias DisposeKey = Observers.KeyType\n\n    typealias Parent = ShareWhileConnected<Element>\n    private let parent: Parent\n    private let subscription = SingleAssignmentDisposable()\n\n    private let lock: RecursiveLock\n    private var disposed: Bool = false\n    fileprivate var observers = Observers()\n\n    init(parent: Parent, lock: RecursiveLock) {\n        self.parent = parent\n        self.lock = lock\n\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n    }\n\n    final func on(_ event: Event<Element>) {\n        let observers = self.lock.performLocked { self.synchronized_on(event) }\n        dispatch(observers, event)\n    }\n\n    final private func synchronized_on(_ event: Event<Element>) -> Observers {\n        if self.disposed {\n            return Observers()\n        }\n\n        switch event {\n        case .next:\n            return self.observers\n        case .error, .completed:\n            let observers = self.observers\n            self.synchronized_dispose()\n            return observers\n        }\n    }\n\n    final func connect() {\n        self.subscription.setDisposable(self.parent.source.subscribe(self))\n    }\n\n    final func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.performLocked {\n            let disposeKey = self.observers.insert(observer.on)\n\n            return SubscriptionDisposable(owner: self, key: disposeKey)\n        }\n    }\n\n    final private func synchronized_dispose() {\n        self.disposed = true\n        if self.parent.connection === self {\n            self.parent.connection = nil\n        }\n        self.observers = Observers()\n    }\n\n    final func synchronizedUnsubscribe(_ disposeKey: DisposeKey) {\n        if self.lock.performLocked({ self.synchronized_unsubscribe(disposeKey) }) {\n            self.subscription.dispose()\n        }\n    }\n\n    @inline(__always)\n    final private func synchronized_unsubscribe(_ disposeKey: DisposeKey) -> Bool {\n        // if already unsubscribed, just return\n        if self.observers.removeKey(disposeKey) == nil {\n            return false\n        }\n\n        if self.observers.count == 0 {\n            self.synchronized_dispose()\n            return true\n        }\n\n        return false\n    }\n\n    #if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n    }\n    #endif\n}\n\n// optimized version of share replay for most common case\nfinal private class ShareWhileConnected<Element>\n    : Observable<Element> {\n\n    fileprivate typealias Connection = ShareWhileConnectedConnection<Element>\n\n    fileprivate let source: Observable<Element>\n\n    private let lock = RecursiveLock()\n\n    fileprivate var connection: Connection?\n\n    init(source: Observable<Element>) {\n        self.source = source\n    }\n\n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.lock()\n        let connection = self.synchronized_subscribe(observer)\n        let count = connection.observers.count\n\n        let disposable = connection.synchronized_subscribe(observer)\n        self.lock.unlock()\n\n        if count == 0 {\n            connection.connect()\n        }\n\n        return disposable\n    }\n\n    @inline(__always)\n    private func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Connection where Observer.Element == Element {\n        let connection: Connection\n\n        if let existingConnection = self.connection {\n            connection = existingConnection\n        }\n        else {\n            connection = ShareWhileConnectedConnection<Element>(\n                parent: self,\n                lock: self.lock)\n            self.connection = connection\n        }\n        \n        return connection\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/SingleAsync.swift",
    "content": "//\n//  SingleAsync.swift\n//  RxSwift\n//\n//  Created by Junior B. on 09/11/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     The single operator is similar to first, but throws a `RxError.noElements` or `RxError.moreThanOneElement`\n     if the source Observable does not emit exactly one element before successfully completing.\n\n     - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html)\n\n     - returns: An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted.\n     */\n    public func single()\n        -> Observable<Element> {\n        SingleAsync(source: self.asObservable())\n    }\n\n    /**\n     The single operator is similar to first, but throws a `RxError.NoElements` or `RxError.MoreThanOneElement`\n     if the source Observable does not emit exactly one element before successfully completing.\n\n     - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html)\n\n     - parameter predicate: A function to test each source element for a condition.\n     - returns: An observable sequence that emits a single element or throws an exception if more (or none) of them are emitted.\n     */\n    public func single(_ predicate: @escaping (Element) throws -> Bool)\n        -> Observable<Element> {\n        SingleAsync(source: self.asObservable(), predicate: predicate)\n    }\n}\n\nprivate final class SingleAsyncSink<Observer: ObserverType> : Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element\n    typealias Parent = SingleAsync<Element>\n    \n    private let parent: Parent\n    private var seenValue: Bool = false\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            do {\n                let forward = try self.parent.predicate?(value) ?? true\n                if !forward {\n                    return\n                }\n            }\n            catch let error {\n                self.forwardOn(.error(error as Swift.Error))\n                self.dispose()\n                return\n            }\n\n            if self.seenValue {\n                self.forwardOn(.error(RxError.moreThanOneElement))\n                self.dispose()\n                return\n            }\n\n            self.seenValue = true\n            self.forwardOn(.next(value))\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            if self.seenValue {\n                self.forwardOn(.completed)\n            } else {\n                self.forwardOn(.error(RxError.noElements))\n            }\n            self.dispose()\n        }\n    }\n}\n\nfinal class SingleAsync<Element>: Producer<Element> {\n    typealias Predicate = (Element) throws -> Bool\n    \n    private let source: Observable<Element>\n    fileprivate let predicate: Predicate?\n    \n    init(source: Observable<Element>, predicate: Predicate? = nil) {\n        self.source = source\n        self.predicate = predicate\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = SingleAsyncSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Sink.swift",
    "content": "//\n//  Sink.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nclass Sink<Observer: ObserverType>: Disposable {\n    fileprivate let observer: Observer\n    fileprivate let cancel: Cancelable\n    private let disposed = AtomicInt(0)\n\n    #if DEBUG\n        private let synchronizationTracker = SynchronizationTracker()\n    #endif\n\n    init(observer: Observer, cancel: Cancelable) {\n#if TRACE_RESOURCES\n        _ = Resources.incrementTotal()\n#endif\n        self.observer = observer\n        self.cancel = cancel\n    }\n\n    final func forwardOn(_ event: Event<Observer.Element>) {\n        #if DEBUG\n            self.synchronizationTracker.register(synchronizationErrorMessage: .default)\n            defer { self.synchronizationTracker.unregister() }\n        #endif\n        if isFlagSet(self.disposed, 1) {\n            return\n        }\n        self.observer.on(event)\n    }\n\n    final func forwarder() -> SinkForward<Observer> {\n        SinkForward(forward: self)\n    }\n\n    final var isDisposed: Bool {\n        isFlagSet(self.disposed, 1)\n    }\n\n    func dispose() {\n        fetchOr(self.disposed, 1)\n        self.cancel.dispose()\n    }\n\n    deinit {\n#if TRACE_RESOURCES\n       _ =  Resources.decrementTotal()\n#endif\n    }\n}\n\nfinal class SinkForward<Observer: ObserverType>: ObserverType {\n    typealias Element = Observer.Element \n\n    private let forward: Sink<Observer>\n\n    init(forward: Sink<Observer>) {\n        self.forward = forward\n    }\n\n    final func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.forward.observer.on(event)\n        case .error, .completed:\n            self.forward.observer.on(event)\n            self.forward.cancel.dispose()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Skip.swift",
    "content": "//\n//  Skip.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/25/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.\n\n     - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html)\n\n     - parameter count: The number of elements to skip before returning the remaining elements.\n     - returns: An observable sequence that contains the elements that occur after the specified index in the input sequence.\n     */\n    public func skip(_ count: Int)\n        -> Observable<Element> {\n        SkipCount(source: self.asObservable(), count: count)\n    }\n}\n\nextension ObservableType {\n\n    /**\n     Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.\n\n     - seealso: [skip operator on reactivex.io](http://reactivex.io/documentation/operators/skip.html)\n\n     - parameter duration: Duration for skipping elements from the start of the sequence.\n     - parameter scheduler: Scheduler to run the timer on.\n     - returns: An observable sequence with the elements skipped during the specified duration from the start of the source sequence.\n     */\n    public func skip(_ duration: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n        SkipTime(source: self.asObservable(), duration: duration, scheduler: scheduler)\n    }\n}\n\n// count version\n\nfinal private class SkipCountSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = SkipCount<Element>\n    \n    let parent: Parent\n    \n    var remaining: Int\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.remaining = parent.count\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            \n            if self.remaining <= 0 {\n                self.forwardOn(.next(value))\n            }\n            else {\n                self.remaining -= 1\n            }\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n    \n}\n\nfinal private class SkipCount<Element>: Producer<Element> {\n    let source: Observable<Element>\n    let count: Int\n    \n    init(source: Observable<Element>, count: Int) {\n        self.source = source\n        self.count = count\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = SkipCountSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n// time version\n\nfinal private class SkipTimeSink<Element, Observer: ObserverType>: Sink<Observer>, ObserverType where Observer.Element == Element {\n    typealias Parent = SkipTime<Element>\n\n    let parent: Parent\n    \n    // state\n    var open = false\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            if self.open {\n                self.forwardOn(.next(value))\n            }\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n    \n    func tick() {\n        self.open = true\n    }\n    \n    func run() -> Disposable {\n        let disposeTimer = self.parent.scheduler.scheduleRelative((), dueTime: self.parent.duration) { _ in \n            self.tick()\n            return Disposables.create()\n        }\n        \n        let disposeSubscription = self.parent.source.subscribe(self)\n        \n        return Disposables.create(disposeTimer, disposeSubscription)\n    }\n}\n\nfinal private class SkipTime<Element>: Producer<Element> {\n    let source: Observable<Element>\n    let duration: RxTimeInterval\n    let scheduler: SchedulerType\n    \n    init(source: Observable<Element>, duration: RxTimeInterval, scheduler: SchedulerType) {\n        self.source = source\n        self.scheduler = scheduler\n        self.duration = duration\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = SkipTimeSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/SkipUntil.swift",
    "content": "//\n//  SkipUntil.swift\n//  RxSwift\n//\n//  Created by Yury Korolev on 10/3/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.\n\n     - seealso: [skipUntil operator on reactivex.io](http://reactivex.io/documentation/operators/skipuntil.html)\n\n     - parameter other: Observable sequence that starts propagation of elements of the source sequence.\n     - returns: An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.\n     */\n    public func skip<Source: ObservableType>(until other: Source)\n        -> Observable<Element> {\n        SkipUntil(source: self.asObservable(), other: other.asObservable())\n    }\n\n    /**\n     Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.\n\n     - seealso: [skipUntil operator on reactivex.io](http://reactivex.io/documentation/operators/skipuntil.html)\n\n     - parameter other: Observable sequence that starts propagation of elements of the source sequence.\n     - returns: An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.\n     */\n    @available(*, deprecated, renamed: \"skip(until:)\")\n    public func skipUntil<Source: ObservableType>(_ other: Source)\n        -> Observable<Element> {\n        skip(until: other)\n    }\n}\n\nfinal private class SkipUntilSinkOther<Other, Observer: ObserverType>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias Parent = SkipUntilSink<Other, Observer>\n    typealias Element = Other\n    \n    private let parent: Parent\n\n    var lock: RecursiveLock {\n        self.parent.lock\n    }\n    \n    let subscription = SingleAssignmentDisposable()\n\n    init(parent: Parent) {\n        self.parent = parent\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n    }\n\n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.parent.forwardElements = true\n            self.subscription.dispose()\n        case .error(let e):\n            self.parent.forwardOn(.error(e))\n            self.parent.dispose()\n        case .completed:\n            self.subscription.dispose()\n        }\n    }\n    \n    #if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n    }\n    #endif\n\n}\n\n\nfinal private class SkipUntilSink<Other, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias Element = Observer.Element \n    typealias Parent = SkipUntil<Element, Other>\n    \n    let lock = RecursiveLock()\n    private let parent: Parent\n    fileprivate var forwardElements = false\n    \n    private let sourceSubscription = SingleAssignmentDisposable()\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            if self.forwardElements {\n                self.forwardOn(event)\n            }\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            if self.forwardElements {\n                self.forwardOn(event)\n            }\n            self.dispose()\n        }\n    }\n    \n    func run() -> Disposable {\n        let sourceSubscription = self.parent.source.subscribe(self)\n        let otherObserver = SkipUntilSinkOther(parent: self)\n        let otherSubscription = self.parent.other.subscribe(otherObserver)\n        self.sourceSubscription.setDisposable(sourceSubscription)\n        otherObserver.subscription.setDisposable(otherSubscription)\n        \n        return Disposables.create(sourceSubscription, otherObserver.subscription)\n    }\n}\n\nfinal private class SkipUntil<Element, Other>: Producer<Element> {\n    \n    fileprivate let source: Observable<Element>\n    fileprivate let other: Observable<Other>\n    \n    init(source: Observable<Element>, other: Observable<Other>) {\n        self.source = source\n        self.other = other\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = SkipUntilSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/SkipWhile.swift",
    "content": "//\n//  SkipWhile.swift\n//  RxSwift\n//\n//  Created by Yury Korolev on 10/9/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.\n\n     - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.\n     */\n    public func skip(while predicate: @escaping (Element) throws -> Bool) -> Observable<Element> {\n        SkipWhile(source: self.asObservable(), predicate: predicate)\n    }\n\n    /**\n     Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.\n\n     - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - returns: An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.\n     */\n    @available(*, deprecated, renamed: \"skip(while:)\")\n    public func skipWhile(_ predicate: @escaping (Element) throws -> Bool) -> Observable<Element> {\n        SkipWhile(source: self.asObservable(), predicate: predicate)\n    }\n}\n\nfinal private class SkipWhileSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = SkipWhile<Element>\n\n    private let parent: Parent\n    private var running = false\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            if !self.running {\n                do {\n                    self.running = try !self.parent.predicate(value)\n                } catch let e {\n                    self.forwardOn(.error(e))\n                    self.dispose()\n                    return\n                }\n            }\n\n            if self.running {\n                self.forwardOn(.next(value))\n            }\n        case .error, .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class SkipWhile<Element>: Producer<Element> {\n    typealias Predicate = (Element) throws -> Bool\n\n    private let source: Observable<Element>\n    fileprivate let predicate: Predicate\n\n    init(source: Observable<Element>, predicate: @escaping Predicate) {\n        self.source = source\n        self.predicate = predicate\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = SkipWhileSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/StartWith.swift",
    "content": "//\n//  StartWith.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/6/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Prepends a sequence of values to an observable sequence.\n\n     - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html)\n\n     - parameter elements: Elements to prepend to the specified sequence.\n     - returns: The source sequence prepended with the specified values.\n     */\n    public func startWith(_ elements: Element ...)\n        -> Observable<Element> {\n            return StartWith(source: self.asObservable(), elements: elements)\n    }\n}\n\nfinal private class StartWith<Element>: Producer<Element> {\n    let elements: [Element]\n    let source: Observable<Element>\n\n    init(source: Observable<Element>, elements: [Element]) {\n        self.source = source\n        self.elements = elements\n        super.init()\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        for e in self.elements {\n            observer.on(.next(e))\n        }\n\n        return (sink: Disposables.create(), subscription: self.source.subscribe(observer))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/SubscribeOn.swift",
    "content": "//\n//  SubscribeOn.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Wraps the source sequence in order to run its subscription and unsubscription logic on the specified\n     scheduler.\n\n     This operation is not commonly used.\n\n     This only performs the side-effects of subscription and unsubscription on the specified scheduler.\n\n     In order to invoke observer callbacks on a `scheduler`, use `observeOn`.\n\n     - seealso: [subscribeOn operator on reactivex.io](http://reactivex.io/documentation/operators/subscribeon.html)\n\n     - parameter scheduler: Scheduler to perform subscription and unsubscription actions on.\n     - returns: The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.\n     */\n    public func subscribe(on scheduler: ImmediateSchedulerType)\n        -> Observable<Element> {\n        SubscribeOn(source: self, scheduler: scheduler)\n    }\n\n    /**\n     Wraps the source sequence in order to run its subscription and unsubscription logic on the specified\n     scheduler.\n\n     This operation is not commonly used.\n\n     This only performs the side-effects of subscription and unsubscription on the specified scheduler.\n\n     In order to invoke observer callbacks on a `scheduler`, use `observeOn`.\n\n     - seealso: [subscribeOn operator on reactivex.io](http://reactivex.io/documentation/operators/subscribeon.html)\n\n     - parameter scheduler: Scheduler to perform subscription and unsubscription actions on.\n     - returns: The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.\n     */\n    @available(*, deprecated, renamed: \"subscribe(on:)\")\n    public func subscribeOn(_ scheduler: ImmediateSchedulerType)\n        -> Observable<Element> {\n        subscribe(on: scheduler)\n    }\n}\n\nfinal private class SubscribeOnSink<Ob: ObservableType, Observer: ObserverType>: Sink<Observer>, ObserverType where Ob.Element == Observer.Element {\n    typealias Element = Observer.Element \n    typealias Parent = SubscribeOn<Ob>\n    \n    let parent: Parent\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.forwardOn(event)\n        \n        if event.isStopEvent {\n            self.dispose()\n        }\n    }\n    \n    func run() -> Disposable {\n        let disposeEverything = SerialDisposable()\n        let cancelSchedule = SingleAssignmentDisposable()\n        \n        disposeEverything.disposable = cancelSchedule\n        \n        let disposeSchedule = self.parent.scheduler.schedule(()) { _ -> Disposable in\n            let subscription = self.parent.source.subscribe(self)\n            disposeEverything.disposable = ScheduledDisposable(scheduler: self.parent.scheduler, disposable: subscription)\n            return Disposables.create()\n        }\n\n        cancelSchedule.setDisposable(disposeSchedule)\n    \n        return disposeEverything\n    }\n}\n\nfinal private class SubscribeOn<Ob: ObservableType>: Producer<Ob.Element> {\n    let source: Ob\n    let scheduler: ImmediateSchedulerType\n    \n    init(source: Ob, scheduler: ImmediateSchedulerType) {\n        self.source = source\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Ob.Element {\n        let sink = SubscribeOnSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Switch.swift",
    "content": "//\n//  Switch.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Projects each element of an observable sequence into a new sequence of observable sequences and then\n     transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.\n\n     It is a combination of `map` + `switchLatest` operator\n\n     - seealso: [flatMapLatest operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an\n     Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.\n     */\n    public func flatMapLatest<Source: ObservableConvertibleType>(_ selector: @escaping (Element) throws -> Source)\n        -> Observable<Source.Element> {\n        return FlatMapLatest(source: self.asObservable(), selector: selector)\n    }\n\n    /**\n     Projects each element of an observable sequence into a new sequence of observable sequences and then\n     transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.\n\n     It is a combination of `map` + `switchLatest` operator\n\n     - seealso: [flatMapLatest operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an\n     Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.\n     */\n    public func flatMapLatest<Source: InfallibleType>(_ selector: @escaping (Element) throws -> Source)\n        -> Infallible<Source.Element> {\n        return Infallible(flatMapLatest(selector))\n    }\n}\n\nextension ObservableType where Element: ObservableConvertibleType {\n\n    /**\n     Transforms an observable sequence of observable sequences into an observable sequence\n     producing values only from the most recent observable sequence.\n\n     Each time a new inner observable sequence is received, unsubscribe from the\n     previous inner observable sequence.\n\n     - seealso: [switch operator on reactivex.io](http://reactivex.io/documentation/operators/switch.html)\n\n     - returns: The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.\n     */\n    public func switchLatest() -> Observable<Element.Element> {\n        Switch(source: self.asObservable())\n    }\n}\n\nprivate class SwitchSink<SourceType, Source: ObservableConvertibleType, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType where Source.Element == Observer.Element {\n    typealias Element = SourceType\n\n    private let subscriptions: SingleAssignmentDisposable = SingleAssignmentDisposable()\n    private let innerSubscription: SerialDisposable = SerialDisposable()\n\n    let lock = RecursiveLock()\n    \n    // state\n    fileprivate var stopped = false\n    fileprivate var latest = 0\n    fileprivate var hasLatest = false\n    \n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run(_ source: Observable<SourceType>) -> Disposable {\n        let subscription = source.subscribe(self)\n        self.subscriptions.setDisposable(subscription)\n        return Disposables.create(subscriptions, innerSubscription)\n    }\n\n    func performMap(_ element: SourceType) throws -> Source {\n        rxAbstractMethod()\n    }\n\n    @inline(__always)\n    final private func nextElementArrived(element: Element) -> (Int, Observable<Source.Element>)? {\n        self.lock.lock(); defer { self.lock.unlock() }\n\n        do {\n            let observable = try self.performMap(element).asObservable()\n            self.hasLatest = true\n            self.latest = self.latest &+ 1\n            return (self.latest, observable)\n        }\n        catch let error {\n            self.forwardOn(.error(error))\n            self.dispose()\n        }\n\n        return nil\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let element):\n            if let (latest, observable) = self.nextElementArrived(element: element) {\n                let d = SingleAssignmentDisposable()\n                self.innerSubscription.disposable = d\n                   \n                let observer = SwitchSinkIter(parent: self, id: latest, this: d)\n                let disposable = observable.subscribe(observer)\n                d.setDisposable(disposable)\n            }\n        case .error(let error):\n            self.lock.lock(); defer { self.lock.unlock() }\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.lock.lock(); defer { self.lock.unlock() }\n            self.stopped = true\n            \n            self.subscriptions.dispose()\n            \n            if !self.hasLatest {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n        }\n    }\n}\n\nfinal private class SwitchSinkIter<SourceType, Source: ObservableConvertibleType, Observer: ObserverType>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType where Source.Element == Observer.Element {\n    typealias Element = Source.Element\n    typealias Parent = SwitchSink<SourceType, Source, Observer>\n    \n    private let parent: Parent\n    private let id: Int\n    private let this: Disposable\n\n    var lock: RecursiveLock {\n        self.parent.lock\n    }\n\n    init(parent: Parent, id: Int, this: Disposable) {\n        self.parent = parent\n        self.id = id\n        self.this = this\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next: break\n        case .error, .completed:\n            self.this.dispose()\n        }\n        \n        if self.parent.latest != self.id {\n            return\n        }\n       \n        switch event {\n        case .next:\n            self.parent.forwardOn(event)\n        case .error:\n            self.parent.forwardOn(event)\n            self.parent.dispose()\n        case .completed:\n            self.parent.hasLatest = false\n            if self.parent.stopped {\n                self.parent.forwardOn(event)\n                self.parent.dispose()\n            }\n        }\n    }\n}\n\n// MARK: Specializations\n\nfinal private class SwitchIdentitySink<Source: ObservableConvertibleType, Observer: ObserverType>: SwitchSink<Source, Source, Observer>\n    where Observer.Element == Source.Element {\n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    override func performMap(_ element: Source) throws -> Source {\n        element\n    }\n}\n\nfinal private class MapSwitchSink<SourceType, Source: ObservableConvertibleType, Observer: ObserverType>: SwitchSink<SourceType, Source, Observer> where Observer.Element == Source.Element {\n    typealias Selector = (SourceType) throws -> Source\n\n    private let selector: Selector\n\n    init(selector: @escaping Selector, observer: Observer, cancel: Cancelable) {\n        self.selector = selector\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    override func performMap(_ element: SourceType) throws -> Source {\n        try self.selector(element)\n    }\n}\n\n// MARK: Producers\n\nfinal private class Switch<Source: ObservableConvertibleType>: Producer<Source.Element> {\n    private let source: Observable<Source>\n    \n    init(source: Observable<Source>) {\n        self.source = source\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Source.Element {\n        let sink = SwitchIdentitySink<Source, Observer>(observer: observer, cancel: cancel)\n        let subscription = sink.run(self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class FlatMapLatest<SourceType, Source: ObservableConvertibleType>: Producer<Source.Element> {\n    typealias Selector = (SourceType) throws -> Source\n\n    private let source: Observable<SourceType>\n    private let selector: Selector\n\n    init(source: Observable<SourceType>, selector: @escaping Selector) {\n        self.source = source\n        self.selector = selector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Source.Element {\n        let sink = MapSwitchSink<SourceType, Source, Observer>(selector: self.selector, observer: observer, cancel: cancel)\n        let subscription = sink.run(self.source)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/SwitchIfEmpty.swift",
    "content": "//\n//  SwitchIfEmpty.swift\n//  RxSwift\n//\n//  Created by sergdort on 23/12/2016.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns the elements of the specified sequence or `switchTo` sequence if the sequence is empty.\n\n     - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html)\n\n     - parameter other: Observable sequence being returned when source sequence is empty.\n     - returns: Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.\n     */\n    public func ifEmpty(switchTo other: Observable<Element>) -> Observable<Element> {\n        SwitchIfEmpty(source: self.asObservable(), ifEmpty: other)\n    }\n}\n\nfinal private class SwitchIfEmpty<Element>: Producer<Element> {\n    \n    private let source: Observable<Element>\n    private let ifEmpty: Observable<Element>\n    \n    init(source: Observable<Element>, ifEmpty: Observable<Element>) {\n        self.source = source\n        self.ifEmpty = ifEmpty\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = SwitchIfEmptySink(ifEmpty: self.ifEmpty,\n                                     observer: observer,\n                                     cancel: cancel)\n        let subscription = sink.run(self.source.asObservable())\n        \n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class SwitchIfEmptySink<Observer: ObserverType>: Sink<Observer>\n    , ObserverType {\n    typealias Element = Observer.Element\n    \n    private let ifEmpty: Observable<Element>\n    private var isEmpty = true\n    private let ifEmptySubscription = SingleAssignmentDisposable()\n    \n    init(ifEmpty: Observable<Element>, observer: Observer, cancel: Cancelable) {\n        self.ifEmpty = ifEmpty\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run(_ source: Observable<Observer.Element>) -> Disposable {\n        let subscription = source.subscribe(self)\n        return Disposables.create(subscription, ifEmptySubscription)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.isEmpty = false\n            self.forwardOn(event)\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            guard self.isEmpty else {\n                self.forwardOn(.completed)\n                self.dispose()\n                return\n            }\n            let ifEmptySink = SwitchIfEmptySinkIter(parent: self)\n            self.ifEmptySubscription.setDisposable(self.ifEmpty.subscribe(ifEmptySink))\n        }\n    }\n}\n\nfinal private class SwitchIfEmptySinkIter<Observer: ObserverType>\n    : ObserverType {\n    typealias Element = Observer.Element\n    typealias Parent = SwitchIfEmptySink<Observer>\n    \n    private let parent: Parent\n\n    init(parent: Parent) {\n        self.parent = parent\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.parent.forwardOn(event)\n        case .error:\n            self.parent.forwardOn(event)\n            self.parent.dispose()\n        case .completed:\n            self.parent.forwardOn(event)\n            self.parent.dispose()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Take.swift",
    "content": "//\n//  Take.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/12/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Returns a specified number of contiguous elements from the start of an observable sequence.\n\n     - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html)\n\n     - parameter count: The number of elements to return.\n     - returns: An observable sequence that contains the specified number of elements from the start of the input sequence.\n     */\n    public func take(_ count: Int)\n        -> Observable<Element> {\n        if count == 0 {\n            return Observable.empty()\n        }\n        else {\n            return TakeCount(source: self.asObservable(), count: count)\n        }\n    }\n}\n\nextension ObservableType {\n    /**\n     Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.\n\n     - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html)\n\n     - parameter duration: Duration for taking elements from the start of the sequence.\n     - parameter scheduler: Scheduler to run the timer on.\n     - returns: An observable sequence with the elements taken during the specified duration from the start of the source sequence.\n     */\n    public func take(for duration: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n        TakeTime(source: self.asObservable(), duration: duration, scheduler: scheduler)\n    }\n\n    /**\n     Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.\n\n     - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html)\n\n     - parameter duration: Duration for taking elements from the start of the sequence.\n     - parameter scheduler: Scheduler to run the timer on.\n     - returns: An observable sequence with the elements taken during the specified duration from the start of the source sequence.\n     */\n    @available(*, deprecated, renamed: \"take(for:scheduler:)\")\n    public func take(_ duration: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n        take(for: duration, scheduler: scheduler)\n    }\n}\n\n// count version\n\nfinal private class TakeCountSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = TakeCount<Element>\n    \n    private let parent: Parent\n    \n    private var remaining: Int\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.remaining = parent.count\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            \n            if self.remaining > 0 {\n                self.remaining -= 1\n                \n                self.forwardOn(.next(value))\n            \n                if self.remaining == 0 {\n                    self.forwardOn(.completed)\n                    self.dispose()\n                }\n            }\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n    \n}\n\nfinal private class TakeCount<Element>: Producer<Element> {\n    private let source: Observable<Element>\n    fileprivate let count: Int\n    \n    init(source: Observable<Element>, count: Int) {\n        if count < 0 {\n            rxFatalError(\"count can't be negative\")\n        }\n        self.source = source\n        self.count = count\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = TakeCountSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n// time version\n\nfinal private class TakeTimeSink<Element, Observer: ObserverType>\n    : Sink<Observer>\n    , LockOwnerType\n    , ObserverType\n    , SynchronizedOnType where Observer.Element == Element {\n    typealias Parent = TakeTime<Element>\n\n    private let parent: Parent\n    \n    let lock = RecursiveLock()\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            self.forwardOn(.next(value))\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n    \n    func tick() {\n        self.lock.performLocked {\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n    \n    func run() -> Disposable {\n        let disposeTimer = self.parent.scheduler.scheduleRelative((), dueTime: self.parent.duration) { _ in\n            self.tick()\n            return Disposables.create()\n        }\n        \n        let disposeSubscription = self.parent.source.subscribe(self)\n        \n        return Disposables.create(disposeTimer, disposeSubscription)\n    }\n}\n\nfinal private class TakeTime<Element>: Producer<Element> {\n    typealias TimeInterval = RxTimeInterval\n    \n    fileprivate let source: Observable<Element>\n    fileprivate let duration: TimeInterval\n    fileprivate let scheduler: SchedulerType\n    \n    init(source: Observable<Element>, duration: TimeInterval, scheduler: SchedulerType) {\n        self.source = source\n        self.scheduler = scheduler\n        self.duration = duration\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = TakeTimeSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/TakeLast.swift",
    "content": "//\n//  TakeLast.swift\n//  RxSwift\n//\n//  Created by Tomi Koskinen on 25/10/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Returns a specified number of contiguous elements from the end of an observable sequence.\n\n     This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.\n\n     - seealso: [takeLast operator on reactivex.io](http://reactivex.io/documentation/operators/takelast.html)\n\n     - parameter count: Number of elements to take from the end of the source sequence.\n     - returns: An observable sequence containing the specified number of elements from the end of the source sequence.\n     */\n    public func takeLast(_ count: Int)\n        -> Observable<Element> {\n        TakeLast(source: self.asObservable(), count: count)\n    }\n}\n\nfinal private class TakeLastSink<Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = TakeLast<Element>\n    \n    private let parent: Parent\n    \n    private var elements: Queue<Element>\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.elements = Queue<Element>(capacity: parent.count + 1)\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            self.elements.enqueue(value)\n            if self.elements.count > self.parent.count {\n                _ = self.elements.dequeue()\n            }\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            for e in self.elements {\n                self.forwardOn(.next(e))\n            }\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class TakeLast<Element>: Producer<Element> {\n    private let source: Observable<Element>\n    fileprivate let count: Int\n    \n    init(source: Observable<Element>, count: Int) {\n        if count < 0 {\n            rxFatalError(\"count can't be negative\")\n        }\n        self.source = source\n        self.count = count\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = TakeLastSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/TakeWithPredicate.swift",
    "content": "//\n//  TakeWithPredicate.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Returns the elements from the source observable sequence until the other observable sequence produces an element.\n\n     - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html)\n\n     - parameter other: Observable sequence that terminates propagation of elements of the source sequence.\n     - returns: An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.\n     */\n    public func take<Source: ObservableType>(until other: Source)\n        -> Observable<Element> {\n        TakeUntil(source: self.asObservable(), other: other.asObservable())\n    }\n\n    /**\n     Returns elements from an observable sequence until the specified condition is true.\n\n     - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - parameter behavior: Whether or not to include the last element matching the predicate. Defaults to `exclusive`.\n\n     - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.\n     */\n    public func take(until predicate: @escaping (Element) throws -> Bool,\n                     behavior: TakeBehavior = .exclusive)\n        -> Observable<Element> {\n        TakeUntilPredicate(source: self.asObservable(),\n                           behavior: behavior,\n                           predicate: predicate)\n    }\n\n    /**\n     Returns elements from an observable sequence as long as a specified condition is true.\n\n     - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.\n     */\n    public func take(while predicate: @escaping (Element) throws -> Bool,\n                     behavior: TakeBehavior = .exclusive)\n        -> Observable<Element> {\n        take(until: { try !predicate($0) }, behavior: behavior)\n    }\n\n    /**\n     Returns the elements from the source observable sequence until the other observable sequence produces an element.\n\n     - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html)\n\n     - parameter other: Observable sequence that terminates propagation of elements of the source sequence.\n     - returns: An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.\n     */\n    @available(*, deprecated, renamed: \"take(until:)\")\n    public func takeUntil<Source: ObservableType>(_ other: Source)\n        -> Observable<Element> {\n        take(until: other)\n    }\n\n    /**\n     Returns elements from an observable sequence until the specified condition is true.\n\n     - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html)\n\n     - parameter behavior: Whether or not to include the last element matching the predicate.\n     - parameter predicate: A function to test each element for a condition.\n     - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.\n     */\n    @available(*, deprecated, renamed: \"take(until:behavior:)\")\n    public func takeUntil(_ behavior: TakeBehavior,\n                          predicate: @escaping (Element) throws -> Bool)\n        -> Observable<Element> {\n        take(until: predicate, behavior: behavior)\n    }\n\n    /**\n     Returns elements from an observable sequence as long as a specified condition is true.\n\n     - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.\n     */\n    @available(*, deprecated, renamed: \"take(while:)\")\n    public func takeWhile(_ predicate: @escaping (Element) throws -> Bool)\n        -> Observable<Element> {\n        take(until: { try !predicate($0) }, behavior: .exclusive)\n    }\n}\n\n/// Behaviors for the take operator family.\npublic enum TakeBehavior {\n    /// Include the last element matching the predicate.\n    case inclusive\n\n    /// Exclude the last element matching the predicate.\n    case exclusive\n}\n\n// MARK: - TakeUntil Observable\nfinal private class TakeUntilSinkOther<Other, Observer: ObserverType>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias Parent = TakeUntilSink<Other, Observer>\n    typealias Element = Other\n    \n    private let parent: Parent\n\n    var lock: RecursiveLock {\n        self.parent.lock\n    }\n    \n    fileprivate let subscription = SingleAssignmentDisposable()\n    \n    init(parent: Parent) {\n        self.parent = parent\n#if TRACE_RESOURCES\n        _ = Resources.incrementTotal()\n#endif\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.parent.forwardOn(.completed)\n            self.parent.dispose()\n        case .error(let e):\n            self.parent.forwardOn(.error(e))\n            self.parent.dispose()\n        case .completed:\n            self.subscription.dispose()\n        }\n    }\n    \n#if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n    }\n#endif\n}\n\nfinal private class TakeUntilSink<Other, Observer: ObserverType>\n    : Sink<Observer>\n    , LockOwnerType\n    , ObserverType\n    , SynchronizedOnType {\n    typealias Element = Observer.Element \n    typealias Parent = TakeUntil<Element, Other>\n    \n    private let parent: Parent\n \n    let lock = RecursiveLock()\n    \n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            self.forwardOn(event)\n        case .error:\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n    \n    func run() -> Disposable {\n        let otherObserver = TakeUntilSinkOther(parent: self)\n        let otherSubscription = self.parent.other.subscribe(otherObserver)\n        otherObserver.subscription.setDisposable(otherSubscription)\n        let sourceSubscription = self.parent.source.subscribe(self)\n        \n        return Disposables.create(sourceSubscription, otherObserver.subscription)\n    }\n}\n\nfinal private class TakeUntil<Element, Other>: Producer<Element> {\n    \n    fileprivate let source: Observable<Element>\n    fileprivate let other: Observable<Other>\n    \n    init(source: Observable<Element>, other: Observable<Other>) {\n        self.source = source\n        self.other = other\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = TakeUntilSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n// MARK: - TakeUntil Predicate\nfinal private class TakeUntilPredicateSink<Observer: ObserverType>\n    : Sink<Observer>, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = TakeUntilPredicate<Element>\n\n    private let parent: Parent\n    private var running = true\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next(let value):\n            if !self.running {\n                return\n            }\n\n            do {\n                self.running = try !self.parent.predicate(value)\n            } catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n                return\n            }\n\n            if self.running {\n                self.forwardOn(.next(value))\n            } else {\n                if self.parent.behavior == .inclusive {\n                    self.forwardOn(.next(value))\n                }\n\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n        case .error, .completed:\n            self.forwardOn(event)\n            self.dispose()\n        }\n    }\n\n}\n\nfinal private class TakeUntilPredicate<Element>: Producer<Element> {\n    typealias Predicate = (Element) throws -> Bool\n\n    private let source: Observable<Element>\n    fileprivate let predicate: Predicate\n    fileprivate let behavior: TakeBehavior\n\n    init(source: Observable<Element>,\n         behavior: TakeBehavior,\n         predicate: @escaping Predicate) {\n        self.source = source\n        self.behavior = behavior\n        self.predicate = predicate\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = TakeUntilPredicateSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Throttle.swift",
    "content": "//\n//  Throttle.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/22/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\nextension ObservableType {\n\n    /**\n     Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration.\n\n     This operator makes sure that no two elements are emitted in less then dueTime.\n\n     - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html)\n\n     - parameter dueTime: Throttling duration for each element.\n     - parameter latest: Should latest element received in a dueTime wide time window since last element emission be emitted.\n     - parameter scheduler: Scheduler to run the throttle timers on.\n     - returns: The throttled sequence.\n     */\n    public func throttle(_ dueTime: RxTimeInterval, latest: Bool = true, scheduler: SchedulerType)\n        -> Observable<Element> {\n        Throttle(source: self.asObservable(), dueTime: dueTime, latest: latest, scheduler: scheduler)\n    }\n}\n\nfinal private class ThrottleSink<Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias Element = Observer.Element \n    typealias ParentType = Throttle<Element>\n    \n    private let parent: ParentType\n    \n    let lock = RecursiveLock()\n    \n    // state\n    private var lastUnsentElement: Element?\n    private var lastSentTime: Date?\n    private var completed: Bool = false\n\n    let cancellable = SerialDisposable()\n    \n    init(parent: ParentType, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        let subscription = self.parent.source.subscribe(self)\n        \n        return Disposables.create(subscription, cancellable)\n    }\n\n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case .next(let element):\n            let now = self.parent.scheduler.now\n\n            let reducedScheduledTime: RxTimeInterval\n\n            if let lastSendingTime = self.lastSentTime {\n                reducedScheduledTime = self.parent.dueTime.reduceWithSpanBetween(earlierDate: lastSendingTime, laterDate: now)\n            }\n            else {\n                reducedScheduledTime = .nanoseconds(0)\n            }\n\n            if reducedScheduledTime.isNow {\n                self.sendNow(element: element)\n                return\n            }\n\n            if !self.parent.latest {\n                return\n            }\n\n            let isThereAlreadyInFlightRequest = self.lastUnsentElement != nil\n            \n            self.lastUnsentElement = element\n\n            if isThereAlreadyInFlightRequest {\n                return\n            }\n\n            let scheduler = self.parent.scheduler\n\n            let d = SingleAssignmentDisposable()\n            self.cancellable.disposable = d\n\n            d.setDisposable(scheduler.scheduleRelative(0, dueTime: reducedScheduledTime, action: self.propagate))\n        case .error:\n            self.lastUnsentElement = nil\n            self.forwardOn(event)\n            self.dispose()\n        case .completed:\n            if self.lastUnsentElement != nil {\n                self.completed = true\n            }\n            else {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n        }\n    }\n\n    private func sendNow(element: Element) {\n        self.lastUnsentElement = nil\n        self.forwardOn(.next(element))\n        // in case element processing takes a while, this should give some more room\n        self.lastSentTime = self.parent.scheduler.now\n    }\n    \n    func propagate(_: Int) -> Disposable {\n        self.lock.performLocked {\n            if let lastUnsentElement = self.lastUnsentElement {\n                self.sendNow(element: lastUnsentElement)\n            }\n\n            if self.completed {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n        }\n\n        return Disposables.create()\n    }\n}\n\nfinal private class Throttle<Element>: Producer<Element> {\n    fileprivate let source: Observable<Element>\n    fileprivate let dueTime: RxTimeInterval\n    fileprivate let latest: Bool\n    fileprivate let scheduler: SchedulerType\n\n    init(source: Observable<Element>, dueTime: RxTimeInterval, latest: Bool, scheduler: SchedulerType) {\n        self.source = source\n        self.dueTime = dueTime\n        self.latest = latest\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = ThrottleSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Timeout.swift",
    "content": "//\n//  Timeout.swift\n//  RxSwift\n//\n//  Created by Tomi Koskinen on 13/11/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Applies a timeout policy for each element in the observable sequence. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutError is propagated to the observer.\n\n     - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html)\n\n     - parameter dueTime: Maximum duration between values before a timeout occurs.\n     - parameter scheduler: Scheduler to run the timeout timer on.\n     - returns: An observable sequence with a `RxError.timeout` in case of a timeout.\n     */\n    public func timeout(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n            return Timeout(source: self.asObservable(), dueTime: dueTime, other: Observable.error(RxError.timeout), scheduler: scheduler)\n    }\n\n    /**\n     Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.\n\n     - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html)\n\n     - parameter dueTime: Maximum duration between values before a timeout occurs.\n     - parameter other: Sequence to return in case of a timeout.\n     - parameter scheduler: Scheduler to run the timeout timer on.\n     - returns: The source sequence switching to the other sequence in case of a timeout.\n     */\n    public func timeout<Source: ObservableConvertibleType>(_ dueTime: RxTimeInterval, other: Source, scheduler: SchedulerType)\n        -> Observable<Element> where Element == Source.Element {\n            return Timeout(source: self.asObservable(), dueTime: dueTime, other: other.asObservable(), scheduler: scheduler)\n    }\n}\n\nfinal private class TimeoutSink<Observer: ObserverType>: Sink<Observer>, LockOwnerType, ObserverType {\n    typealias Element = Observer.Element \n    typealias Parent = Timeout<Element>\n    \n    private let parent: Parent\n    \n    let lock = RecursiveLock()\n\n    private let timerD = SerialDisposable()\n    private let subscription = SerialDisposable()\n    \n    private var id = 0\n    private var switched = false\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        let original = SingleAssignmentDisposable()\n        self.subscription.disposable = original\n        \n        self.createTimeoutTimer()\n        \n        original.setDisposable(self.parent.source.subscribe(self))\n        \n        return Disposables.create(subscription, timerD)\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            var onNextWins = false\n            \n            self.lock.performLocked {\n                onNextWins = !self.switched\n                if onNextWins {\n                    self.id = self.id &+ 1\n                }\n            }\n            \n            if onNextWins {\n                self.forwardOn(event)\n                self.createTimeoutTimer()\n            }\n        case .error, .completed:\n            var onEventWins = false\n            \n            self.lock.performLocked {\n                onEventWins = !self.switched\n                if onEventWins {\n                    self.id = self.id &+ 1\n                }\n            }\n            \n            if onEventWins {\n                self.forwardOn(event)\n                self.dispose()\n            }\n        }\n    }\n    \n    private func createTimeoutTimer() {\n        if self.timerD.isDisposed {\n            return\n        }\n        \n        let nextTimer = SingleAssignmentDisposable()\n        self.timerD.disposable = nextTimer\n        \n        let disposeSchedule = self.parent.scheduler.scheduleRelative(self.id, dueTime: self.parent.dueTime) { state in\n            \n            var timerWins = false\n            \n            self.lock.performLocked {\n                self.switched = (state == self.id)\n                timerWins = self.switched\n            }\n            \n            if timerWins {\n                self.subscription.disposable = self.parent.other.subscribe(self.forwarder())\n            }\n            \n            return Disposables.create()\n        }\n\n        nextTimer.setDisposable(disposeSchedule)\n    }\n}\n\n\nfinal private class Timeout<Element>: Producer<Element> {\n    fileprivate let source: Observable<Element>\n    fileprivate let dueTime: RxTimeInterval\n    fileprivate let other: Observable<Element>\n    fileprivate let scheduler: SchedulerType\n    \n    init(source: Observable<Element>, dueTime: RxTimeInterval, other: Observable<Element>, scheduler: SchedulerType) {\n        self.source = source\n        self.dueTime = dueTime\n        self.other = other\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = TimeoutSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Timer.swift",
    "content": "//\n//  Timer.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType where Element: RxAbstractInteger {\n    /**\n     Returns an observable sequence that produces a value after each period, using the specified scheduler to run timers and to send out observer messages.\n\n     - seealso: [interval operator on reactivex.io](http://reactivex.io/documentation/operators/interval.html)\n\n     - parameter period: Period for producing the values in the resulting sequence.\n     - parameter scheduler: Scheduler to run the timer on.\n     - returns: An observable sequence that produces a value after each period.\n     */\n    public static func interval(_ period: RxTimeInterval, scheduler: SchedulerType)\n        -> Observable<Element> {\n        return Timer(\n            dueTime: period,\n            period: period,\n            scheduler: scheduler\n        )\n    }\n}\n\nextension ObservableType where Element: RxAbstractInteger {\n    /**\n     Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.\n\n     - seealso: [timer operator on reactivex.io](http://reactivex.io/documentation/operators/timer.html)\n\n     - parameter dueTime: Relative time at which to produce the first value.\n     - parameter period: Period to produce subsequent values.\n     - parameter scheduler: Scheduler to run timers on.\n     - returns: An observable sequence that produces a value after due time has elapsed and then each period.\n     */\n    public static func timer(_ dueTime: RxTimeInterval, period: RxTimeInterval? = nil, scheduler: SchedulerType)\n        -> Observable<Element> {\n        return Timer(\n            dueTime: dueTime,\n            period: period,\n            scheduler: scheduler\n        )\n    }\n}\n\nimport Foundation\n\nfinal private class TimerSink<Observer: ObserverType> : Sink<Observer> where Observer.Element : RxAbstractInteger  {\n    typealias Parent = Timer<Observer.Element>\n\n    private let parent: Parent\n    private let lock = RecursiveLock()\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        return self.parent.scheduler.schedulePeriodic(0 as Observer.Element, startAfter: self.parent.dueTime, period: self.parent.period!) { state in\n            self.lock.performLocked {\n                self.forwardOn(.next(state))\n                return state &+ 1\n            }\n        }\n    }\n}\n\nfinal private class TimerOneOffSink<Observer: ObserverType>: Sink<Observer> where Observer.Element: RxAbstractInteger {\n    typealias Parent = Timer<Observer.Element>\n\n    private let parent: Parent\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run() -> Disposable {\n        return self.parent.scheduler.scheduleRelative(self, dueTime: self.parent.dueTime) { [unowned self] _ -> Disposable in\n            self.forwardOn(.next(0))\n            self.forwardOn(.completed)\n            self.dispose()\n\n            return Disposables.create()\n        }\n    }\n}\n\nfinal private class Timer<Element: RxAbstractInteger>: Producer<Element> {\n    fileprivate let scheduler: SchedulerType\n    fileprivate let dueTime: RxTimeInterval\n    fileprivate let period: RxTimeInterval?\n\n    init(dueTime: RxTimeInterval, period: RxTimeInterval?, scheduler: SchedulerType) {\n        self.scheduler = scheduler\n        self.dueTime = dueTime\n        self.period = period\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        if self.period != nil {\n            let sink = TimerSink(parent: self, observer: observer, cancel: cancel)\n            let subscription = sink.run()\n            return (sink: sink, subscription: subscription)\n        }\n        else {\n            let sink = TimerOneOffSink(parent: self, observer: observer, cancel: cancel)\n            let subscription = sink.run()\n            return (sink: sink, subscription: subscription)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/ToArray.swift",
    "content": "//\n//  ToArray.swift\n//  RxSwift\n//\n//  Created by Junior B. on 20/10/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n    Converts an Observable into a Single that emits the whole sequence as a single array and then terminates.\n    \n    For aggregation behavior see `reduce`.\n\n    - seealso: [toArray operator on reactivex.io](http://reactivex.io/documentation/operators/to.html)\n    \n    - returns: A Single sequence containing all the emitted elements as array.\n    */\n    public func toArray()\n        -> Single<[Element]> {\n        PrimitiveSequence(raw: ToArray(source: self.asObservable()))\n    }\n}\n\nfinal private class ToArraySink<SourceType, Observer: ObserverType>: Sink<Observer>, ObserverType where Observer.Element == [SourceType] {\n    typealias Parent = ToArray<SourceType>\n    \n    let parent: Parent\n    var list = [SourceType]()\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<SourceType>) {\n        switch event {\n        case .next(let value):\n            self.list.append(value)\n        case .error(let e):\n            self.forwardOn(.error(e))\n            self.dispose()\n        case .completed:\n            self.forwardOn(.next(self.list))\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class ToArray<SourceType>: Producer<[SourceType]> {\n    let source: Observable<SourceType>\n\n    init(source: Observable<SourceType>) {\n        self.source = source\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == [SourceType] {\n        let sink = ToArraySink(parent: self, observer: observer, cancel: cancel)\n        let subscription = self.source.subscribe(sink)\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Using.swift",
    "content": "//\n//  Using.swift\n//  RxSwift\n//\n//  Created by Yury Korolev on 10/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.\n\n     - seealso: [using operator on reactivex.io](http://reactivex.io/documentation/operators/using.html)\n\n     - parameter resourceFactory: Factory function to obtain a resource object.\n     - parameter observableFactory: Factory function to obtain an observable sequence that depends on the obtained resource.\n     - returns: An observable sequence whose lifetime controls the lifetime of the dependent resource object.\n     */\n    public static func using<Resource: Disposable>(_ resourceFactory: @escaping () throws -> Resource, observableFactory: @escaping (Resource) throws -> Observable<Element>) -> Observable<Element> {\n        Using(resourceFactory: resourceFactory, observableFactory: observableFactory)\n    }\n}\n\nfinal private class UsingSink<ResourceType: Disposable, Observer: ObserverType>: Sink<Observer>, ObserverType {\n    typealias SourceType = Observer.Element \n    typealias Parent = Using<SourceType, ResourceType>\n\n    private let parent: Parent\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        var disposable = Disposables.create()\n        \n        do {\n            let resource = try self.parent.resourceFactory()\n            disposable = resource\n            let source = try self.parent.observableFactory(resource)\n            \n            return Disposables.create(\n                source.subscribe(self),\n                disposable\n            )\n        } catch let error {\n            return Disposables.create(\n                Observable.error(error).subscribe(self),\n                disposable\n            )\n        }\n    }\n    \n    func on(_ event: Event<SourceType>) {\n        switch event {\n        case let .next(value):\n            self.forwardOn(.next(value))\n        case let .error(error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal private class Using<SourceType, ResourceType: Disposable>: Producer<SourceType> {\n    \n    typealias Element = SourceType\n    \n    typealias ResourceFactory = () throws -> ResourceType\n    typealias ObservableFactory = (ResourceType) throws -> Observable<SourceType>\n    \n    fileprivate let resourceFactory: ResourceFactory\n    fileprivate let observableFactory: ObservableFactory\n    \n    \n    init(resourceFactory: @escaping ResourceFactory, observableFactory: @escaping ObservableFactory) {\n        self.resourceFactory = resourceFactory\n        self.observableFactory = observableFactory\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = UsingSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Window.swift",
    "content": "//\n//  Window.swift\n//  RxSwift\n//\n//  Created by Junior B. on 29/10/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Projects each element of an observable sequence into a window that is completed when either it’s full or a given amount of time has elapsed.\n\n     - seealso: [window operator on reactivex.io](http://reactivex.io/documentation/operators/window.html)\n\n     - parameter timeSpan: Maximum time length of a window.\n     - parameter count: Maximum element count of a window.\n     - parameter scheduler: Scheduler to run windowing timers on.\n     - returns: An observable sequence of windows (instances of `Observable`).\n     */\n    public func window(timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType)\n        -> Observable<Observable<Element>> {\n            return WindowTimeCount(source: self.asObservable(), timeSpan: timeSpan, count: count, scheduler: scheduler)\n    }\n}\n\nfinal private class WindowTimeCountSink<Element, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType\n    , LockOwnerType\n    , SynchronizedOnType where Observer.Element == Observable<Element> {\n    typealias Parent = WindowTimeCount<Element>\n    \n    private let parent: Parent\n    \n    let lock = RecursiveLock()\n    \n    private var subject = PublishSubject<Element>()\n    private var count = 0\n    private var windowId = 0\n    \n    private let timerD = SerialDisposable()\n    private let refCountDisposable: RefCountDisposable\n    private let groupDisposable = CompositeDisposable()\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        \n        _ = self.groupDisposable.insert(self.timerD)\n        \n        self.refCountDisposable = RefCountDisposable(disposable: self.groupDisposable)\n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        \n        self.forwardOn(.next(AddRef(source: self.subject, refCount: self.refCountDisposable).asObservable()))\n        self.createTimer(self.windowId)\n        \n        _ = self.groupDisposable.insert(self.parent.source.subscribe(self))\n        return self.refCountDisposable\n    }\n    \n    func startNewWindowAndCompleteCurrentOne() {\n        self.subject.on(.completed)\n        self.subject = PublishSubject<Element>()\n        \n        self.forwardOn(.next(AddRef(source: self.subject, refCount: self.refCountDisposable).asObservable()))\n    }\n\n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        var newWindow = false\n        var newId = 0\n        \n        switch event {\n        case .next(let element):\n            self.subject.on(.next(element))\n            \n            do {\n                _ = try incrementChecked(&self.count)\n            } catch let e {\n                self.subject.on(.error(e as Swift.Error))\n                self.dispose()\n            }\n            \n            if self.count == self.parent.count {\n                newWindow = true\n                self.count = 0\n                self.windowId += 1\n                newId = self.windowId\n                self.startNewWindowAndCompleteCurrentOne()\n            }\n            \n        case .error(let error):\n            self.subject.on(.error(error))\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            self.subject.on(.completed)\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n\n        if newWindow {\n            self.createTimer(newId)\n        }\n    }\n    \n    func createTimer(_ windowId: Int) {\n        if self.timerD.isDisposed {\n            return\n        }\n        \n        if self.windowId != windowId {\n            return\n        }\n\n        let nextTimer = SingleAssignmentDisposable()\n\n        self.timerD.disposable = nextTimer\n\n        let scheduledRelative = self.parent.scheduler.scheduleRelative(windowId, dueTime: self.parent.timeSpan) { previousWindowId in\n            \n            var newId = 0\n            \n            self.lock.performLocked {\n                if previousWindowId != self.windowId {\n                    return\n                }\n                \n                self.count = 0\n                self.windowId = self.windowId &+ 1\n                newId = self.windowId\n                self.startNewWindowAndCompleteCurrentOne()\n            }\n            \n            self.createTimer(newId)\n            \n            return Disposables.create()\n        }\n\n        nextTimer.setDisposable(scheduledRelative)\n    }\n}\n\nfinal private class WindowTimeCount<Element>: Producer<Observable<Element>> {\n    fileprivate let timeSpan: RxTimeInterval\n    fileprivate let count: Int\n    fileprivate let scheduler: SchedulerType\n    fileprivate let source: Observable<Element>\n    \n    init(source: Observable<Element>, timeSpan: RxTimeInterval, count: Int, scheduler: SchedulerType) {\n        self.source = source\n        self.timeSpan = timeSpan\n        self.count = count\n        self.scheduler = scheduler\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Observable<Element> {\n        let sink = WindowTimeCountSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/WithLatestFrom.swift",
    "content": "//\n//  WithLatestFrom.swift\n//  RxSwift\n//\n//  Created by Yury Korolev on 10/19/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n\n    /**\n     Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.\n\n     - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n     - note: Elements emitted by self before the second source has emitted any values will be omitted.\n\n     - parameter second: Second observable source.\n     - parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.\n     - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.\n     */\n    public func withLatestFrom<Source: ObservableConvertibleType, ResultType>(_ second: Source, resultSelector: @escaping (Element, Source.Element) throws -> ResultType) -> Observable<ResultType> {\n        WithLatestFrom(first: self.asObservable(), second: second.asObservable(), resultSelector: resultSelector)\n    }\n\n    /**\n     Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emits an element.\n\n     - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n     - note: Elements emitted by self before the second source has emitted any values will be omitted.\n\n     - parameter second: Second observable source.\n     - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.\n     */\n    public func withLatestFrom<Source: ObservableConvertibleType>(_ second: Source) -> Observable<Source.Element> {\n        WithLatestFrom(first: self.asObservable(), second: second.asObservable(), resultSelector: { $1 })\n    }\n}\n\nfinal private class WithLatestFromSink<FirstType, SecondType, Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias ResultType = Observer.Element\n    typealias Parent = WithLatestFrom<FirstType, SecondType, ResultType>\n    typealias Element = FirstType\n    \n    private let parent: Parent\n    \n    fileprivate var lock = RecursiveLock()\n    fileprivate var latest: SecondType?\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func run() -> Disposable {\n        let sndSubscription = SingleAssignmentDisposable()\n        let sndO = WithLatestFromSecond(parent: self, disposable: sndSubscription)\n        \n        sndSubscription.setDisposable(self.parent.second.subscribe(sndO))\n        let fstSubscription = self.parent.first.subscribe(self)\n\n        return Disposables.create(fstSubscription, sndSubscription)\n    }\n\n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case let .next(value):\n            guard let latest = self.latest else { return }\n            do {\n                let res = try self.parent.resultSelector(value, latest)\n                \n                self.forwardOn(.next(res))\n            } catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        case .completed:\n            self.forwardOn(.completed)\n            self.dispose()\n        case let .error(error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        }\n    }\n}\n\nfinal private class WithLatestFromSecond<FirstType, SecondType, Observer: ObserverType>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    \n    typealias ResultType = Observer.Element\n    typealias Parent = WithLatestFromSink<FirstType, SecondType, Observer>\n    typealias Element = SecondType\n    \n    private let parent: Parent\n    private let disposable: Disposable\n\n    var lock: RecursiveLock {\n        self.parent.lock\n    }\n\n    init(parent: Parent, disposable: Disposable) {\n        self.parent = parent\n        self.disposable = disposable\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        switch event {\n        case let .next(value):\n            self.parent.latest = value\n        case .completed:\n            self.disposable.dispose()\n        case let .error(error):\n            self.parent.forwardOn(.error(error))\n            self.parent.dispose()\n        }\n    }\n}\n\nfinal private class WithLatestFrom<FirstType, SecondType, ResultType>: Producer<ResultType> {\n    typealias ResultSelector = (FirstType, SecondType) throws -> ResultType\n    \n    fileprivate let first: Observable<FirstType>\n    fileprivate let second: Observable<SecondType>\n    fileprivate let resultSelector: ResultSelector\n\n    init(first: Observable<FirstType>, second: Observable<SecondType>, resultSelector: @escaping ResultSelector) {\n        self.first = first\n        self.second = second\n        self.resultSelector = resultSelector\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == ResultType {\n        let sink = WithLatestFromSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/WithUnretained.swift",
    "content": "//\n//  WithUnretained.swift\n//  RxSwift\n//\n//  Created by Vincent Pradeilles on 01/01/2021.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.\n     \n     In the case the provided object cannot be retained successfully, the sequence will complete.\n     \n     - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.\n     \n     - parameter obj: The object to provide an unretained reference on.\n     - parameter resultSelector: A function to combine the unretained referenced on `obj` and the value of the observable sequence.\n     - returns: An observable sequence that contains the result of `resultSelector` being called with an unretained reference on `obj` and the values of the original sequence.\n     */\n    public func withUnretained<Object: AnyObject, Out>(\n        _ obj: Object,\n        resultSelector: @escaping (Object, Element) -> Out\n    ) -> Observable<Out> {\n        map { [weak obj] element -> Out in\n            guard let obj = obj else { throw UnretainedError.failedRetaining }\n\n            return resultSelector(obj, element)\n        }\n        .catch{ error -> Observable<Out> in\n            guard let unretainedError = error as? UnretainedError,\n                  unretainedError == .failedRetaining else {\n                return .error(error)\n            }\n\n            return .empty()\n        }\n    }\n\n    \n    /**\n     Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.\n     \n     In the case the provided object cannot be retained successfully, the sequence will complete.\n     \n     - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.\n     \n     - parameter obj: The object to provide an unretained reference on.\n     - returns: An observable sequence of tuples that contains both an unretained reference on `obj` and the values of the original sequence.\n     */\n    public func withUnretained<Object: AnyObject>(_ obj: Object) -> Observable<(Object, Element)> {\n        return withUnretained(obj) { ($0, $1) }\n    }\n}\n\nprivate enum UnretainedError: Swift.Error {\n    case failedRetaining\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Zip+Collection.swift",
    "content": "//\n//  Zip+Collection.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n     - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n     - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n     - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n     */\n    public static func zip<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Observable<Element>\n        where Collection.Element: ObservableType {\n        ZipCollectionType(sources: collection, resultSelector: resultSelector)\n    }\n\n    /**\n     Merges the specified observable sequences into one observable sequence whenever all of the observable sequences have produced an element at a corresponding index.\n\n     - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n     - returns: An observable sequence containing the result of combining elements of the sources.\n     */\n    public static func zip<Collection: Swift.Collection>(_ collection: Collection) -> Observable<[Element]>\n        where Collection.Element: ObservableType, Collection.Element.Element == Element {\n        ZipCollectionType(sources: collection, resultSelector: { $0 })\n    }\n    \n}\n\nfinal private class ZipCollectionTypeSink<Collection: Swift.Collection, Observer: ObserverType>\n    : Sink<Observer> where Collection.Element: ObservableConvertibleType {\n    typealias Result = Observer.Element \n    typealias Parent = ZipCollectionType<Collection, Result>\n    typealias SourceElement = Collection.Element.Element\n    \n    private let parent: Parent\n    \n    private let lock = RecursiveLock()\n    \n    // state\n    private var numberOfValues = 0\n    private var values: [Queue<SourceElement>]\n    private var isDone: [Bool]\n    private var numberOfDone = 0\n    private var subscriptions: [SingleAssignmentDisposable]\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        self.values = [Queue<SourceElement>](repeating: Queue(capacity: 4), count: parent.count)\n        self.isDone = [Bool](repeating: false, count: parent.count)\n        self.subscriptions = [SingleAssignmentDisposable]()\n        self.subscriptions.reserveCapacity(parent.count)\n        \n        for _ in 0 ..< parent.count {\n            self.subscriptions.append(SingleAssignmentDisposable())\n        }\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n    \n    func on(_ event: Event<SourceElement>, atIndex: Int) {\n        self.lock.lock(); defer { self.lock.unlock() }\n        switch event {\n        case .next(let element):\n            self.values[atIndex].enqueue(element)\n            \n            if self.values[atIndex].count == 1 {\n                self.numberOfValues += 1\n            }\n            \n            if self.numberOfValues < self.parent.count {\n                if self.numberOfDone == self.parent.count - 1 {\n                    self.forwardOn(.completed)\n                    self.dispose()\n                }\n                return\n            }\n            \n            do {\n                var arguments = [SourceElement]()\n                arguments.reserveCapacity(self.parent.count)\n                \n                // recalculate number of values\n                self.numberOfValues = 0\n                \n                for i in 0 ..< self.values.count {\n                    arguments.append(self.values[i].dequeue()!)\n                    if !self.values[i].isEmpty {\n                        self.numberOfValues += 1\n                    }\n                }\n                \n                let result = try self.parent.resultSelector(arguments)\n                self.forwardOn(.next(result))\n            }\n            catch let error {\n                self.forwardOn(.error(error))\n                self.dispose()\n            }\n            \n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .completed:\n            if self.isDone[atIndex] {\n                return\n            }\n            \n            self.isDone[atIndex] = true\n            self.numberOfDone += 1\n            \n            if self.numberOfDone == self.parent.count {\n                self.forwardOn(.completed)\n                self.dispose()\n            }\n            else {\n                self.subscriptions[atIndex].dispose()\n            }\n        }\n    }\n    \n    func run() -> Disposable {\n        var j = 0\n        for i in self.parent.sources {\n            let index = j\n            let source = i.asObservable()\n\n            let disposable = source.subscribe(AnyObserver { event in\n                self.on(event, atIndex: index)\n                })\n            self.subscriptions[j].setDisposable(disposable)\n            j += 1\n        }\n\n        if self.parent.sources.isEmpty {\n            self.forwardOn(.completed)\n        }\n        \n        return Disposables.create(subscriptions)\n    }\n}\n\nfinal private class ZipCollectionType<Collection: Swift.Collection, Result>: Producer<Result> where Collection.Element: ObservableConvertibleType {\n    typealias ResultSelector = ([Collection.Element.Element]) throws -> Result\n    \n    let sources: Collection\n    let resultSelector: ResultSelector\n    let count: Int\n    \n    init(sources: Collection, resultSelector: @escaping ResultSelector) {\n        self.sources = sources\n        self.resultSelector = resultSelector\n        self.count = self.sources.count\n    }\n    \n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipCollectionTypeSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Zip+arity.swift",
    "content": "// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \n//\n//  Zip+arity.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/23/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n\n\n// 2\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType>\n        (_ source1: O1, _ source2: O2, resultSelector: @escaping (O1.Element, O2.Element) throws -> Element)\n        -> Observable<Element> {\n        return Zip2(\n            source1: source1.asObservable(), source2: source2.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType>\n        (_ source1: O1, _ source2: O2)\n        -> Observable<(O1.Element, O2.Element)> {\n        return Zip2(\n            source1: source1.asObservable(), source2: source2.asObservable(),\n            resultSelector: { ($0, $1) }\n        )\n    }\n}\n\nfinal class ZipSink2_<E1, E2, Observer: ObserverType> : ZipSink<Observer> {\n    typealias Result = Observer.Element \n    typealias Parent = Zip2<E1, E2, Result>\n\n    let parent: Parent\n\n    var values1: Queue<E1> = Queue(capacity: 2)\n    var values2: Queue<E2> = Queue(capacity: 2)\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 2, observer: observer, cancel: cancel)\n    }\n\n    override func hasElements(_ index: Int) -> Bool {\n        switch index {\n        case 0: return !self.values1.isEmpty\n        case 1: return !self.values2.isEmpty\n\n        default:\n            rxFatalError(\"Unhandled case (Function)\")\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n\n        let observer1 = ZipObserver(lock: self.lock, parent: self, index: 0, setNextValue: { self.values1.enqueue($0) }, this: subscription1)\n        let observer2 = ZipObserver(lock: self.lock, parent: self, index: 1, setNextValue: { self.values2.enqueue($0) }, this: subscription2)\n\n        subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n        subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n\n        return Disposables.create([\n           subscription1,\n           subscription2\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.values1.dequeue()!, self.values2.dequeue()!)\n    }\n}\n\nfinal class Zip2<E1, E2, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipSink2_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 3\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, resultSelector: @escaping (O1.Element, O2.Element, O3.Element) throws -> Element)\n        -> Observable<Element> {\n        return Zip3(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3)\n        -> Observable<(O1.Element, O2.Element, O3.Element)> {\n        return Zip3(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(),\n            resultSelector: { ($0, $1, $2) }\n        )\n    }\n}\n\nfinal class ZipSink3_<E1, E2, E3, Observer: ObserverType> : ZipSink<Observer> {\n    typealias Result = Observer.Element \n    typealias Parent = Zip3<E1, E2, E3, Result>\n\n    let parent: Parent\n\n    var values1: Queue<E1> = Queue(capacity: 2)\n    var values2: Queue<E2> = Queue(capacity: 2)\n    var values3: Queue<E3> = Queue(capacity: 2)\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 3, observer: observer, cancel: cancel)\n    }\n\n    override func hasElements(_ index: Int) -> Bool {\n        switch index {\n        case 0: return !self.values1.isEmpty\n        case 1: return !self.values2.isEmpty\n        case 2: return !self.values3.isEmpty\n\n        default:\n            rxFatalError(\"Unhandled case (Function)\")\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n\n        let observer1 = ZipObserver(lock: self.lock, parent: self, index: 0, setNextValue: { self.values1.enqueue($0) }, this: subscription1)\n        let observer2 = ZipObserver(lock: self.lock, parent: self, index: 1, setNextValue: { self.values2.enqueue($0) }, this: subscription2)\n        let observer3 = ZipObserver(lock: self.lock, parent: self, index: 2, setNextValue: { self.values3.enqueue($0) }, this: subscription3)\n\n        subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n        subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n        subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n\n        return Disposables.create([\n           subscription1,\n           subscription2,\n           subscription3\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.values1.dequeue()!, self.values2.dequeue()!, self.values3.dequeue()!)\n    }\n}\n\nfinal class Zip3<E1, E2, E3, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipSink3_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 4\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element) throws -> Element)\n        -> Observable<Element> {\n        return Zip4(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4)\n        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element)> {\n        return Zip4(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(),\n            resultSelector: { ($0, $1, $2, $3) }\n        )\n    }\n}\n\nfinal class ZipSink4_<E1, E2, E3, E4, Observer: ObserverType> : ZipSink<Observer> {\n    typealias Result = Observer.Element \n    typealias Parent = Zip4<E1, E2, E3, E4, Result>\n\n    let parent: Parent\n\n    var values1: Queue<E1> = Queue(capacity: 2)\n    var values2: Queue<E2> = Queue(capacity: 2)\n    var values3: Queue<E3> = Queue(capacity: 2)\n    var values4: Queue<E4> = Queue(capacity: 2)\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 4, observer: observer, cancel: cancel)\n    }\n\n    override func hasElements(_ index: Int) -> Bool {\n        switch index {\n        case 0: return !self.values1.isEmpty\n        case 1: return !self.values2.isEmpty\n        case 2: return !self.values3.isEmpty\n        case 3: return !self.values4.isEmpty\n\n        default:\n            rxFatalError(\"Unhandled case (Function)\")\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n\n        let observer1 = ZipObserver(lock: self.lock, parent: self, index: 0, setNextValue: { self.values1.enqueue($0) }, this: subscription1)\n        let observer2 = ZipObserver(lock: self.lock, parent: self, index: 1, setNextValue: { self.values2.enqueue($0) }, this: subscription2)\n        let observer3 = ZipObserver(lock: self.lock, parent: self, index: 2, setNextValue: { self.values3.enqueue($0) }, this: subscription3)\n        let observer4 = ZipObserver(lock: self.lock, parent: self, index: 3, setNextValue: { self.values4.enqueue($0) }, this: subscription4)\n\n        subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n        subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n        subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n        subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n\n        return Disposables.create([\n           subscription1,\n           subscription2,\n           subscription3,\n           subscription4\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.values1.dequeue()!, self.values2.dequeue()!, self.values3.dequeue()!, self.values4.dequeue()!)\n    }\n}\n\nfinal class Zip4<E1, E2, E3, E4, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipSink4_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 5\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element) throws -> Element)\n        -> Observable<Element> {\n        return Zip5(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5)\n        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element)> {\n        return Zip5(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4) }\n        )\n    }\n}\n\nfinal class ZipSink5_<E1, E2, E3, E4, E5, Observer: ObserverType> : ZipSink<Observer> {\n    typealias Result = Observer.Element \n    typealias Parent = Zip5<E1, E2, E3, E4, E5, Result>\n\n    let parent: Parent\n\n    var values1: Queue<E1> = Queue(capacity: 2)\n    var values2: Queue<E2> = Queue(capacity: 2)\n    var values3: Queue<E3> = Queue(capacity: 2)\n    var values4: Queue<E4> = Queue(capacity: 2)\n    var values5: Queue<E5> = Queue(capacity: 2)\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 5, observer: observer, cancel: cancel)\n    }\n\n    override func hasElements(_ index: Int) -> Bool {\n        switch index {\n        case 0: return !self.values1.isEmpty\n        case 1: return !self.values2.isEmpty\n        case 2: return !self.values3.isEmpty\n        case 3: return !self.values4.isEmpty\n        case 4: return !self.values5.isEmpty\n\n        default:\n            rxFatalError(\"Unhandled case (Function)\")\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n\n        let observer1 = ZipObserver(lock: self.lock, parent: self, index: 0, setNextValue: { self.values1.enqueue($0) }, this: subscription1)\n        let observer2 = ZipObserver(lock: self.lock, parent: self, index: 1, setNextValue: { self.values2.enqueue($0) }, this: subscription2)\n        let observer3 = ZipObserver(lock: self.lock, parent: self, index: 2, setNextValue: { self.values3.enqueue($0) }, this: subscription3)\n        let observer4 = ZipObserver(lock: self.lock, parent: self, index: 3, setNextValue: { self.values4.enqueue($0) }, this: subscription4)\n        let observer5 = ZipObserver(lock: self.lock, parent: self, index: 4, setNextValue: { self.values5.enqueue($0) }, this: subscription5)\n\n        subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n        subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n        subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n        subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n        subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n\n        return Disposables.create([\n           subscription1,\n           subscription2,\n           subscription3,\n           subscription4,\n           subscription5\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.values1.dequeue()!, self.values2.dequeue()!, self.values3.dequeue()!, self.values4.dequeue()!, self.values5.dequeue()!)\n    }\n}\n\nfinal class Zip5<E1, E2, E3, E4, E5, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipSink5_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 6\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element) throws -> Element)\n        -> Observable<Element> {\n        return Zip6(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6)\n        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element)> {\n        return Zip6(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4, $5) }\n        )\n    }\n}\n\nfinal class ZipSink6_<E1, E2, E3, E4, E5, E6, Observer: ObserverType> : ZipSink<Observer> {\n    typealias Result = Observer.Element \n    typealias Parent = Zip6<E1, E2, E3, E4, E5, E6, Result>\n\n    let parent: Parent\n\n    var values1: Queue<E1> = Queue(capacity: 2)\n    var values2: Queue<E2> = Queue(capacity: 2)\n    var values3: Queue<E3> = Queue(capacity: 2)\n    var values4: Queue<E4> = Queue(capacity: 2)\n    var values5: Queue<E5> = Queue(capacity: 2)\n    var values6: Queue<E6> = Queue(capacity: 2)\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 6, observer: observer, cancel: cancel)\n    }\n\n    override func hasElements(_ index: Int) -> Bool {\n        switch index {\n        case 0: return !self.values1.isEmpty\n        case 1: return !self.values2.isEmpty\n        case 2: return !self.values3.isEmpty\n        case 3: return !self.values4.isEmpty\n        case 4: return !self.values5.isEmpty\n        case 5: return !self.values6.isEmpty\n\n        default:\n            rxFatalError(\"Unhandled case (Function)\")\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n        let subscription6 = SingleAssignmentDisposable()\n\n        let observer1 = ZipObserver(lock: self.lock, parent: self, index: 0, setNextValue: { self.values1.enqueue($0) }, this: subscription1)\n        let observer2 = ZipObserver(lock: self.lock, parent: self, index: 1, setNextValue: { self.values2.enqueue($0) }, this: subscription2)\n        let observer3 = ZipObserver(lock: self.lock, parent: self, index: 2, setNextValue: { self.values3.enqueue($0) }, this: subscription3)\n        let observer4 = ZipObserver(lock: self.lock, parent: self, index: 3, setNextValue: { self.values4.enqueue($0) }, this: subscription4)\n        let observer5 = ZipObserver(lock: self.lock, parent: self, index: 4, setNextValue: { self.values5.enqueue($0) }, this: subscription5)\n        let observer6 = ZipObserver(lock: self.lock, parent: self, index: 5, setNextValue: { self.values6.enqueue($0) }, this: subscription6)\n\n        subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n        subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n        subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n        subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n        subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n        subscription6.setDisposable(self.parent.source6.subscribe(observer6))\n\n        return Disposables.create([\n           subscription1,\n           subscription2,\n           subscription3,\n           subscription4,\n           subscription5,\n           subscription6\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.values1.dequeue()!, self.values2.dequeue()!, self.values3.dequeue()!, self.values4.dequeue()!, self.values5.dequeue()!, self.values6.dequeue()!)\n    }\n}\n\nfinal class Zip6<E1, E2, E3, E4, E5, E6, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5, E6) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n    let source6: Observable<E6>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, source6: Observable<E6>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n        self.source6 = source6\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipSink6_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 7\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element) throws -> Element)\n        -> Observable<Element> {\n        return Zip7(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7)\n        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element)> {\n        return Zip7(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4, $5, $6) }\n        )\n    }\n}\n\nfinal class ZipSink7_<E1, E2, E3, E4, E5, E6, E7, Observer: ObserverType> : ZipSink<Observer> {\n    typealias Result = Observer.Element \n    typealias Parent = Zip7<E1, E2, E3, E4, E5, E6, E7, Result>\n\n    let parent: Parent\n\n    var values1: Queue<E1> = Queue(capacity: 2)\n    var values2: Queue<E2> = Queue(capacity: 2)\n    var values3: Queue<E3> = Queue(capacity: 2)\n    var values4: Queue<E4> = Queue(capacity: 2)\n    var values5: Queue<E5> = Queue(capacity: 2)\n    var values6: Queue<E6> = Queue(capacity: 2)\n    var values7: Queue<E7> = Queue(capacity: 2)\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 7, observer: observer, cancel: cancel)\n    }\n\n    override func hasElements(_ index: Int) -> Bool {\n        switch index {\n        case 0: return !self.values1.isEmpty\n        case 1: return !self.values2.isEmpty\n        case 2: return !self.values3.isEmpty\n        case 3: return !self.values4.isEmpty\n        case 4: return !self.values5.isEmpty\n        case 5: return !self.values6.isEmpty\n        case 6: return !self.values7.isEmpty\n\n        default:\n            rxFatalError(\"Unhandled case (Function)\")\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n        let subscription6 = SingleAssignmentDisposable()\n        let subscription7 = SingleAssignmentDisposable()\n\n        let observer1 = ZipObserver(lock: self.lock, parent: self, index: 0, setNextValue: { self.values1.enqueue($0) }, this: subscription1)\n        let observer2 = ZipObserver(lock: self.lock, parent: self, index: 1, setNextValue: { self.values2.enqueue($0) }, this: subscription2)\n        let observer3 = ZipObserver(lock: self.lock, parent: self, index: 2, setNextValue: { self.values3.enqueue($0) }, this: subscription3)\n        let observer4 = ZipObserver(lock: self.lock, parent: self, index: 3, setNextValue: { self.values4.enqueue($0) }, this: subscription4)\n        let observer5 = ZipObserver(lock: self.lock, parent: self, index: 4, setNextValue: { self.values5.enqueue($0) }, this: subscription5)\n        let observer6 = ZipObserver(lock: self.lock, parent: self, index: 5, setNextValue: { self.values6.enqueue($0) }, this: subscription6)\n        let observer7 = ZipObserver(lock: self.lock, parent: self, index: 6, setNextValue: { self.values7.enqueue($0) }, this: subscription7)\n\n        subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n        subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n        subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n        subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n        subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n        subscription6.setDisposable(self.parent.source6.subscribe(observer6))\n        subscription7.setDisposable(self.parent.source7.subscribe(observer7))\n\n        return Disposables.create([\n           subscription1,\n           subscription2,\n           subscription3,\n           subscription4,\n           subscription5,\n           subscription6,\n           subscription7\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.values1.dequeue()!, self.values2.dequeue()!, self.values3.dequeue()!, self.values4.dequeue()!, self.values5.dequeue()!, self.values6.dequeue()!, self.values7.dequeue()!)\n    }\n}\n\nfinal class Zip7<E1, E2, E3, E4, E5, E6, E7, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n    let source6: Observable<E6>\n    let source7: Observable<E7>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, source6: Observable<E6>, source7: Observable<E7>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n        self.source6 = source6\n        self.source7 = source7\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipSink7_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n\n// 8\n\nextension ObservableType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8, resultSelector: @escaping (O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element) throws -> Element)\n        -> Observable<Element> {\n        return Zip8(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(),\n            resultSelector: resultSelector\n        )\n    }\n}\n\nextension ObservableType where Element == Any {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources.\n    */\n    public static func zip<O1: ObservableType, O2: ObservableType, O3: ObservableType, O4: ObservableType, O5: ObservableType, O6: ObservableType, O7: ObservableType, O8: ObservableType>\n        (_ source1: O1, _ source2: O2, _ source3: O3, _ source4: O4, _ source5: O5, _ source6: O6, _ source7: O7, _ source8: O8)\n        -> Observable<(O1.Element, O2.Element, O3.Element, O4.Element, O5.Element, O6.Element, O7.Element, O8.Element)> {\n        return Zip8(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(),\n            resultSelector: { ($0, $1, $2, $3, $4, $5, $6, $7) }\n        )\n    }\n}\n\nfinal class ZipSink8_<E1, E2, E3, E4, E5, E6, E7, E8, Observer: ObserverType> : ZipSink<Observer> {\n    typealias Result = Observer.Element \n    typealias Parent = Zip8<E1, E2, E3, E4, E5, E6, E7, E8, Result>\n\n    let parent: Parent\n\n    var values1: Queue<E1> = Queue(capacity: 2)\n    var values2: Queue<E2> = Queue(capacity: 2)\n    var values3: Queue<E3> = Queue(capacity: 2)\n    var values4: Queue<E4> = Queue(capacity: 2)\n    var values5: Queue<E5> = Queue(capacity: 2)\n    var values6: Queue<E6> = Queue(capacity: 2)\n    var values7: Queue<E7> = Queue(capacity: 2)\n    var values8: Queue<E8> = Queue(capacity: 2)\n\n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(arity: 8, observer: observer, cancel: cancel)\n    }\n\n    override func hasElements(_ index: Int) -> Bool {\n        switch index {\n        case 0: return !self.values1.isEmpty\n        case 1: return !self.values2.isEmpty\n        case 2: return !self.values3.isEmpty\n        case 3: return !self.values4.isEmpty\n        case 4: return !self.values5.isEmpty\n        case 5: return !self.values6.isEmpty\n        case 6: return !self.values7.isEmpty\n        case 7: return !self.values8.isEmpty\n\n        default:\n            rxFatalError(\"Unhandled case (Function)\")\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription1 = SingleAssignmentDisposable()\n        let subscription2 = SingleAssignmentDisposable()\n        let subscription3 = SingleAssignmentDisposable()\n        let subscription4 = SingleAssignmentDisposable()\n        let subscription5 = SingleAssignmentDisposable()\n        let subscription6 = SingleAssignmentDisposable()\n        let subscription7 = SingleAssignmentDisposable()\n        let subscription8 = SingleAssignmentDisposable()\n\n        let observer1 = ZipObserver(lock: self.lock, parent: self, index: 0, setNextValue: { self.values1.enqueue($0) }, this: subscription1)\n        let observer2 = ZipObserver(lock: self.lock, parent: self, index: 1, setNextValue: { self.values2.enqueue($0) }, this: subscription2)\n        let observer3 = ZipObserver(lock: self.lock, parent: self, index: 2, setNextValue: { self.values3.enqueue($0) }, this: subscription3)\n        let observer4 = ZipObserver(lock: self.lock, parent: self, index: 3, setNextValue: { self.values4.enqueue($0) }, this: subscription4)\n        let observer5 = ZipObserver(lock: self.lock, parent: self, index: 4, setNextValue: { self.values5.enqueue($0) }, this: subscription5)\n        let observer6 = ZipObserver(lock: self.lock, parent: self, index: 5, setNextValue: { self.values6.enqueue($0) }, this: subscription6)\n        let observer7 = ZipObserver(lock: self.lock, parent: self, index: 6, setNextValue: { self.values7.enqueue($0) }, this: subscription7)\n        let observer8 = ZipObserver(lock: self.lock, parent: self, index: 7, setNextValue: { self.values8.enqueue($0) }, this: subscription8)\n\n        subscription1.setDisposable(self.parent.source1.subscribe(observer1))\n        subscription2.setDisposable(self.parent.source2.subscribe(observer2))\n        subscription3.setDisposable(self.parent.source3.subscribe(observer3))\n        subscription4.setDisposable(self.parent.source4.subscribe(observer4))\n        subscription5.setDisposable(self.parent.source5.subscribe(observer5))\n        subscription6.setDisposable(self.parent.source6.subscribe(observer6))\n        subscription7.setDisposable(self.parent.source7.subscribe(observer7))\n        subscription8.setDisposable(self.parent.source8.subscribe(observer8))\n\n        return Disposables.create([\n           subscription1,\n           subscription2,\n           subscription3,\n           subscription4,\n           subscription5,\n           subscription6,\n           subscription7,\n           subscription8\n        ])\n    }\n\n    override func getResult() throws -> Result {\n        try self.parent.resultSelector(self.values1.dequeue()!, self.values2.dequeue()!, self.values3.dequeue()!, self.values4.dequeue()!, self.values5.dequeue()!, self.values6.dequeue()!, self.values7.dequeue()!, self.values8.dequeue()!)\n    }\n}\n\nfinal class Zip8<E1, E2, E3, E4, E5, E6, E7, E8, Result> : Producer<Result> {\n    typealias ResultSelector = (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Result\n\n    let source1: Observable<E1>\n    let source2: Observable<E2>\n    let source3: Observable<E3>\n    let source4: Observable<E4>\n    let source5: Observable<E5>\n    let source6: Observable<E6>\n    let source7: Observable<E7>\n    let source8: Observable<E8>\n\n    let resultSelector: ResultSelector\n\n    init(source1: Observable<E1>, source2: Observable<E2>, source3: Observable<E3>, source4: Observable<E4>, source5: Observable<E5>, source6: Observable<E6>, source7: Observable<E7>, source8: Observable<E8>, resultSelector: @escaping ResultSelector) {\n        self.source1 = source1\n        self.source2 = source2\n        self.source3 = source3\n        self.source4 = source4\n        self.source5 = source5\n        self.source6 = source6\n        self.source7 = source7\n        self.source8 = source8\n\n        self.resultSelector = resultSelector\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Result {\n        let sink = ZipSink8_(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observables/Zip.swift",
    "content": "//\n//  Zip.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/23/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol ZipSinkProtocol: AnyObject {\n    func next(_ index: Int)\n    func fail(_ error: Swift.Error)\n    func done(_ index: Int)\n}\n\nclass ZipSink<Observer: ObserverType> : Sink<Observer>, ZipSinkProtocol {\n    typealias Element = Observer.Element\n    \n    let arity: Int\n\n    let lock = RecursiveLock()\n\n    // state\n    private var isDone: [Bool]\n    \n    init(arity: Int, observer: Observer, cancel: Cancelable) {\n        self.isDone = [Bool](repeating: false, count: arity)\n        self.arity = arity\n        \n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func getResult() throws -> Element {\n        rxAbstractMethod()\n    }\n    \n    func hasElements(_ index: Int) -> Bool {\n        rxAbstractMethod()\n    }\n    \n    func next(_ index: Int) {\n        var hasValueAll = true\n        \n        for i in 0 ..< self.arity {\n            if !self.hasElements(i) {\n                hasValueAll = false\n                break\n            }\n        }\n        \n        if hasValueAll {\n            do {\n                let result = try self.getResult()\n                self.forwardOn(.next(result))\n            }\n            catch let e {\n                self.forwardOn(.error(e))\n                self.dispose()\n            }\n        }\n    }\n    \n    func fail(_ error: Swift.Error) {\n        self.forwardOn(.error(error))\n        self.dispose()\n    }\n    \n    func done(_ index: Int) {\n        self.isDone[index] = true\n        \n        var allDone = true\n        \n        for done in self.isDone where !done {\n            allDone = false\n            break\n        }\n        \n        if allDone {\n            self.forwardOn(.completed)\n            self.dispose()\n        }\n    }\n}\n\nfinal class ZipObserver<Element>\n    : ObserverType\n    , LockOwnerType\n    , SynchronizedOnType {\n    typealias ValueSetter = (Element) -> Void\n\n    private var parent: ZipSinkProtocol?\n    \n    let lock: RecursiveLock\n    \n    // state\n    private let index: Int\n    private let this: Disposable\n    private let setNextValue: ValueSetter\n    \n    init(lock: RecursiveLock, parent: ZipSinkProtocol, index: Int, setNextValue: @escaping ValueSetter, this: Disposable) {\n        self.lock = lock\n        self.parent = parent\n        self.index = index\n        self.this = this\n        self.setNextValue = setNextValue\n    }\n    \n    func on(_ event: Event<Element>) {\n        self.synchronizedOn(event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) {\n        if self.parent != nil {\n            switch event {\n            case .next:\n                break\n            case .error:\n                self.this.dispose()\n            case .completed:\n                self.this.dispose()\n            }\n        }\n        \n        if let parent = self.parent {\n            switch event {\n            case .next(let value):\n                self.setNextValue(value)\n                parent.next(self.index)\n            case .error(let error):\n                parent.fail(error)\n            case .completed:\n                parent.done(self.index)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/ObserverType.swift",
    "content": "//\n//  ObserverType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Supports push-style iteration over an observable sequence.\npublic protocol ObserverType {\n    /// The type of elements in sequence that observer can observe.\n    associatedtype Element\n\n    /// Notify observer about sequence event.\n    ///\n    /// - parameter event: Event that occurred.\n    func on(_ event: Event<Element>)\n}\n\n/// Convenience API extensions to provide alternate next, error, completed events\nextension ObserverType {\n    \n    /// Convenience method equivalent to `on(.next(element: Element))`\n    ///\n    /// - parameter element: Next element to send to observer(s)\n    public func onNext(_ element: Element) {\n        self.on(.next(element))\n    }\n    \n    /// Convenience method equivalent to `on(.completed)`\n    public func onCompleted() {\n        self.on(.completed)\n    }\n    \n    /// Convenience method equivalent to `on(.error(Swift.Error))`\n    /// - parameter error: Swift.Error to send to observer(s)\n    public func onError(_ error: Swift.Error) {\n        self.on(.error(error))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observers/AnonymousObserver.swift",
    "content": "//\n//  AnonymousObserver.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nfinal class AnonymousObserver<Element>: ObserverBase<Element> {\n    typealias EventHandler = (Event<Element>) -> Void\n    \n    private let eventHandler : EventHandler\n    \n    init(_ eventHandler: @escaping EventHandler) {\n#if TRACE_RESOURCES\n        _ = Resources.incrementTotal()\n#endif\n        self.eventHandler = eventHandler\n    }\n\n    override func onCore(_ event: Event<Element>) {\n        self.eventHandler(event)\n    }\n    \n#if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n    }\n#endif\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observers/ObserverBase.swift",
    "content": "//\n//  ObserverBase.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/15/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nclass ObserverBase<Element> : Disposable, ObserverType {\n    private let isStopped = AtomicInt(0)\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .next:\n            if load(self.isStopped) == 0 {\n                self.onCore(event)\n            }\n        case .error, .completed:\n            if fetchOr(self.isStopped, 1) == 0 {\n                self.onCore(event)\n            }\n        }\n    }\n\n    func onCore(_ event: Event<Element>) {\n        rxAbstractMethod()\n    }\n\n    func dispose() {\n        fetchOr(self.isStopped, 1)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Observers/TailRecursiveSink.swift",
    "content": "//\n//  TailRecursiveSink.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/21/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nenum TailRecursiveSinkCommand {\n    case moveNext\n    case dispose\n}\n\n#if DEBUG || TRACE_RESOURCES\n    public var maxTailRecursiveSinkStackSize = 0\n#endif\n\n/// This class is usually used with `Generator` version of the operators.\nclass TailRecursiveSink<Sequence: Swift.Sequence, Observer: ObserverType>\n    : Sink<Observer>\n    , InvocableWithValueType where Sequence.Element: ObservableConvertibleType, Sequence.Element.Element == Observer.Element {\n    typealias Value = TailRecursiveSinkCommand\n    typealias Element = Observer.Element \n    typealias SequenceGenerator = (generator: Sequence.Iterator, remaining: IntMax?)\n\n    var generators: [SequenceGenerator] = []\n    var disposed = false\n    var subscription = SerialDisposable()\n\n    // this is thread safe object\n    var gate = AsyncLock<InvocableScheduledItem<TailRecursiveSink<Sequence, Observer>>>()\n\n    override init(observer: Observer, cancel: Cancelable) {\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func run(_ sources: SequenceGenerator) -> Disposable {\n        self.generators.append(sources)\n\n        self.schedule(.moveNext)\n\n        return self.subscription\n    }\n\n    func invoke(_ command: TailRecursiveSinkCommand) {\n        switch command {\n        case .dispose:\n            self.disposeCommand()\n        case .moveNext:\n            self.moveNextCommand()\n        }\n    }\n\n    // simple implementation for now\n    func schedule(_ command: TailRecursiveSinkCommand) {\n        self.gate.invoke(InvocableScheduledItem(invocable: self, state: command))\n    }\n\n    func done() {\n        self.forwardOn(.completed)\n        self.dispose()\n    }\n\n    func extract(_ observable: Observable<Element>) -> SequenceGenerator? {\n        rxAbstractMethod()\n    }\n\n    // should be done on gate locked\n\n    private func moveNextCommand() {\n        var next: Observable<Element>?\n\n        repeat {\n            guard let (g, left) = self.generators.last else {\n                break\n            }\n            \n            if self.isDisposed {\n                return\n            }\n\n            self.generators.removeLast()\n            \n            var e = g\n\n            guard let nextCandidate = e.next()?.asObservable() else {\n                continue\n            }\n\n            // `left` is a hint of how many elements are left in generator.\n            // In case this is the last element, then there is no need to push\n            // that generator on stack.\n            //\n            // This is an optimization used to make sure in tail recursive case\n            // there is no memory leak in case this operator is used to generate non terminating\n            // sequence.\n\n            if let knownOriginalLeft = left {\n                // `- 1` because generator.next() has just been called\n                if knownOriginalLeft - 1 >= 1 {\n                    self.generators.append((e, knownOriginalLeft - 1))\n                }\n            }\n            else {\n                self.generators.append((e, nil))\n            }\n\n            let nextGenerator = self.extract(nextCandidate)\n\n            if let nextGenerator = nextGenerator {\n                self.generators.append(nextGenerator)\n                #if DEBUG || TRACE_RESOURCES\n                    if maxTailRecursiveSinkStackSize < self.generators.count {\n                        maxTailRecursiveSinkStackSize = self.generators.count\n                    }\n                #endif\n            }\n            else {\n                next = nextCandidate\n            }\n        } while next == nil\n\n        guard let existingNext = next else {\n            self.done()\n            return\n        }\n\n        let disposable = SingleAssignmentDisposable()\n        self.subscription.disposable = disposable\n        disposable.setDisposable(self.subscribeToNext(existingNext))\n    }\n\n    func subscribeToNext(_ source: Observable<Element>) -> Disposable {\n        rxAbstractMethod()\n    }\n\n    func disposeCommand() {\n        self.disposed = true\n        self.generators.removeAll(keepingCapacity: false)\n    }\n\n    override func dispose() {\n        super.dispose()\n        \n        self.subscription.dispose()\n        self.gate.dispose()\n        \n        self.schedule(.dispose)\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Reactive.swift",
    "content": "//\n//  Reactive.swift\n//  RxSwift\n//\n//  Created by Yury Korolev on 5/2/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\n/**\n Use `Reactive` proxy as customization point for constrained protocol extensions.\n\n General pattern would be:\n\n // 1. Extend Reactive protocol with constrain on Base\n // Read as: Reactive Extension where Base is a SomeType\n extension Reactive where Base: SomeType {\n // 2. Put any specific reactive extension for SomeType here\n }\n\n With this approach we can have more specialized methods and properties using\n `Base` and not just specialized on common base type.\n\n `Binder`s are also automatically synthesized using `@dynamicMemberLookup` for writable reference properties of the reactive base.\n */\n\n@dynamicMemberLookup\npublic struct Reactive<Base> {\n    /// Base object to extend.\n    public let base: Base\n\n    /// Creates extensions with base object.\n    ///\n    /// - parameter base: Base object.\n    public init(_ base: Base) {\n        self.base = base\n    }\n\n    /// Automatically synthesized binder for a key path between the reactive\n    /// base and one of its properties\n    public subscript<Property>(dynamicMember keyPath: ReferenceWritableKeyPath<Base, Property>) -> Binder<Property> where Base: AnyObject {\n        Binder(self.base) { base, value in\n            base[keyPath: keyPath] = value\n        }\n    }\n}\n\n/// A type that has reactive extensions.\npublic protocol ReactiveCompatible {\n    /// Extended type\n    associatedtype ReactiveBase\n\n    /// Reactive extensions.\n    static var rx: Reactive<ReactiveBase>.Type { get set }\n\n    /// Reactive extensions.\n    var rx: Reactive<ReactiveBase> { get set }\n}\n\nextension ReactiveCompatible {\n    /// Reactive extensions.\n    public static var rx: Reactive<Self>.Type {\n        get { Reactive<Self>.self }\n        // this enables using Reactive to \"mutate\" base type\n        // swiftlint:disable:next unused_setter_value\n        set { }\n    }\n\n    /// Reactive extensions.\n    public var rx: Reactive<Self> {\n        get { Reactive(self) }\n        // this enables using Reactive to \"mutate\" base object\n        // swiftlint:disable:next unused_setter_value\n        set { }\n    }\n}\n\nimport Foundation\n\n/// Extend NSObject with `rx` proxy.\nextension NSObject: ReactiveCompatible { }\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Rx.swift",
    "content": "//\n//  Rx.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if TRACE_RESOURCES\n    private let resourceCount = AtomicInt(0)\n\n    /// Resource utilization information\n    public struct Resources {\n        /// Counts internal Rx resource allocations (Observables, Observers, Disposables, etc.). This provides a simple way to detect leaks during development.\n        public static var total: Int32 {\n            load(resourceCount)\n        }\n\n        /// Increments `Resources.total` resource count.\n        ///\n        /// - returns: New resource count\n        public static func incrementTotal() -> Int32 {\n            increment(resourceCount)\n        }\n\n        /// Decrements `Resources.total` resource count\n        ///\n        /// - returns: New resource count\n        public static func decrementTotal() -> Int32 {\n            decrement(resourceCount)\n        }\n    }\n#endif\n\n/// Swift does not implement abstract methods. This method is used as a runtime check to ensure that methods which intended to be abstract (i.e., they should be implemented in subclasses) are not called directly on the superclass.\nfunc rxAbstractMethod(file: StaticString = #file, line: UInt = #line) -> Swift.Never {\n    rxFatalError(\"Abstract method\", file: file, line: line)\n}\n\nfunc rxFatalError(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Swift.Never  {\n    fatalError(lastMessage(), file: file, line: line)\n}\n\nfunc rxFatalErrorInDebug(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) {\n    #if DEBUG\n        fatalError(lastMessage(), file: file, line: line)\n    #else\n        print(\"\\(file):\\(line): \\(lastMessage())\")\n    #endif\n}\n\nfunc incrementChecked(_ i: inout Int) throws -> Int {\n    if i == Int.max {\n        throw RxError.overflow\n    }\n    defer { i += 1 }\n    return i\n}\n\nfunc decrementChecked(_ i: inout Int) throws -> Int {\n    if i == Int.min {\n        throw RxError.overflow\n    }\n    defer { i -= 1 }\n    return i\n}\n\n#if DEBUG\n    import Foundation\n    final class SynchronizationTracker {\n        private let lock = RecursiveLock()\n\n        public enum SynchronizationErrorMessages: String {\n            case variable = \"Two different threads are trying to assign the same `Variable.value` unsynchronized.\\n    This is undefined behavior because the end result (variable value) is nondeterministic and depends on the \\n    operating system thread scheduler. This will cause random behavior of your program.\\n\"\n            case `default` = \"Two different unsynchronized threads are trying to send some event simultaneously.\\n    This is undefined behavior because the ordering of the effects caused by these events is nondeterministic and depends on the \\n    operating system thread scheduler. This will result in a random behavior of your program.\\n\"\n        }\n\n        private var threads = [UnsafeMutableRawPointer: Int]()\n\n        private func synchronizationError(_ message: String) {\n            #if FATAL_SYNCHRONIZATION\n                rxFatalError(message)\n            #else\n                print(message)\n            #endif\n        }\n        \n        func register(synchronizationErrorMessage: SynchronizationErrorMessages) {\n            self.lock.lock(); defer { self.lock.unlock() }\n            let pointer = Unmanaged.passUnretained(Thread.current).toOpaque()\n            let count = (self.threads[pointer] ?? 0) + 1\n\n            if count > 1 {\n                self.synchronizationError(\n                    \"⚠️ Reentrancy anomaly was detected.\\n\" +\n                    \"  > Debugging: To debug this issue you can set a breakpoint in \\(#file):\\(#line) and observe the call stack.\\n\" +\n                    \"  > Problem: This behavior is breaking the observable sequence grammar. `next (error | completed)?`\\n\" +\n                    \"    This behavior breaks the grammar because there is overlapping between sequence events.\\n\" +\n                    \"    Observable sequence is trying to send an event before sending of previous event has finished.\\n\" +\n                    \"  > Interpretation: This could mean that there is some kind of unexpected cyclic dependency in your code,\\n\" +\n                    \"    or that the system is not behaving in the expected way.\\n\" +\n                    \"  > Remedy: If this is the expected behavior this message can be suppressed by adding `.observe(on:MainScheduler.asyncInstance)`\\n\" +\n                    \"    or by enqueuing sequence events in some other way.\\n\"\n                )\n            }\n            \n            self.threads[pointer] = count\n\n            if self.threads.count > 1 {\n                self.synchronizationError(\n                    \"⚠️ Synchronization anomaly was detected.\\n\" +\n                    \"  > Debugging: To debug this issue you can set a breakpoint in \\(#file):\\(#line) and observe the call stack.\\n\" +\n                    \"  > Problem: This behavior is breaking the observable sequence grammar. `next (error | completed)?`\\n\" +\n                    \"    This behavior breaks the grammar because there is overlapping between sequence events.\\n\" +\n                    \"    Observable sequence is trying to send an event before sending of previous event has finished.\\n\" +\n                    \"  > Interpretation: \" + synchronizationErrorMessage.rawValue +\n                    \"  > Remedy: If this is the expected behavior this message can be suppressed by adding `.observe(on:MainScheduler.asyncInstance)`\\n\" +\n                    \"    or by synchronizing sequence events in some other way.\\n\"\n                )\n            }\n        }\n\n        func unregister() {\n            self.lock.performLocked { \n                let pointer = Unmanaged.passUnretained(Thread.current).toOpaque()\n                self.threads[pointer] = (self.threads[pointer] ?? 1) - 1\n                if self.threads[pointer] == 0 {\n                    self.threads[pointer] = nil\n                }\n            }\n        }\n    }\n\n#endif\n\n/// RxSwift global hooks\npublic enum Hooks {\n    \n    // Should capture call stack\n    public static var recordCallStackOnError: Bool = false\n\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/RxMutableBox.swift",
    "content": "//\n//  RxMutableBox.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/22/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n#if os(Linux)\n/// As Swift 5 was released, A patch to `Thread` for Linux\n/// changed `threadDictionary` to a `NSMutableDictionary` instead of\n/// a `Dictionary<String, Any>`: https://github.com/apple/swift-corelibs-foundation/pull/1762/files\n///\n/// This means that on Linux specifically, `RxMutableBox` must be a `NSObject`\n/// or it won't be possible to store it in `Thread.threadDictionary`.\n///\n/// For more information, read the discussion at:\n/// https://github.com/ReactiveX/RxSwift/issues/1911#issuecomment-479723298\nimport Foundation\n\n/// Creates mutable reference wrapper for any type.\nfinal class RxMutableBox<T>: NSObject {\n    /// Wrapped value\n    var value: T\n\n    /// Creates reference wrapper for `value`.\n    ///\n    /// - parameter value: Value to wrap.\n    init (_ value: T) {\n        self.value = value\n    }\n}\n#else\n/// Creates mutable reference wrapper for any type.\nfinal class RxMutableBox<T>: CustomDebugStringConvertible {\n    /// Wrapped value\n    var value: T\n    \n    /// Creates reference wrapper for `value`.\n    ///\n    /// - parameter value: Value to wrap.\n    init (_ value: T) {\n        self.value = value\n    }\n}\n\nextension RxMutableBox {\n    /// - returns: Box description.\n    var debugDescription: String {\n        \"MutatingBox(\\(self.value))\"\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/SchedulerType.swift",
    "content": "//\n//  SchedulerType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\n// Type that represents time interval in the context of RxSwift.\npublic typealias RxTimeInterval = DispatchTimeInterval\n\n/// Type that represents absolute time in the context of RxSwift.\npublic typealias RxTime = Date\n\n/// Represents an object that schedules units of work.\npublic protocol SchedulerType: ImmediateSchedulerType {\n\n    /// - returns: Current time.\n    var now : RxTime {\n        get\n    }\n\n    /**\n    Schedules an action to be executed.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter dueTime: Relative time after which to execute the action.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable\n \n    /**\n    Schedules a periodic piece of work.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter startAfter: Period after which initial work should be run.\n    - parameter period: Period for running the work periodically.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable\n}\n\nextension SchedulerType {\n\n    /**\n    Periodic task will be emulated using recursive scheduling.\n\n    - parameter state: Initial state passed to the action upon the first iteration.\n    - parameter startAfter: Period after which initial work should be run.\n    - parameter period: Period for running the work periodically.\n    - returns: The disposable object used to cancel the scheduled recurring action (best effort).\n    */\n    public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {\n        let schedule = SchedulePeriodicRecursive(scheduler: self, startAfter: startAfter, period: period, action: action, state: state)\n            \n        return schedule.start()\n    }\n\n    func scheduleRecursive<State>(_ state: State, dueTime: RxTimeInterval, action: @escaping (State, AnyRecursiveScheduler<State>) -> Void) -> Disposable {\n        let scheduler = AnyRecursiveScheduler(scheduler: self, action: action)\n         \n        scheduler.schedule(state, dueTime: dueTime)\n            \n        return Disposables.create(with: scheduler.dispose)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift",
    "content": "//\n//  ConcurrentDispatchQueueScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 7/5/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\n/// Abstracts the work that needs to be performed on a specific `dispatch_queue_t`. You can also pass a serial dispatch queue, it shouldn't cause any problems.\n///\n/// This scheduler is suitable when some work needs to be performed in background.\npublic class ConcurrentDispatchQueueScheduler: SchedulerType {\n    public typealias TimeInterval = Foundation.TimeInterval\n    public typealias Time = Date\n    \n    public var now : Date {\n        Date()\n    }\n\n    let configuration: DispatchQueueConfiguration\n    \n    /// Constructs new `ConcurrentDispatchQueueScheduler` that wraps `queue`.\n    ///\n    /// - parameter queue: Target dispatch queue.\n    /// - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer.\n    public init(queue: DispatchQueue, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) {\n        self.configuration = DispatchQueueConfiguration(queue: queue, leeway: leeway)\n    }\n    \n    /// Convenience init for scheduler that wraps one of the global concurrent dispatch queues.\n    ///\n    /// - parameter qos: Target global dispatch queue, by quality of service class.\n    /// - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer.\n    public convenience init(qos: DispatchQoS, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) {\n        self.init(queue: DispatchQueue(\n            label: \"rxswift.queue.\\(qos)\",\n            qos: qos,\n            attributes: [DispatchQueue.Attributes.concurrent],\n            target: nil),\n            leeway: leeway\n        )\n    }\n\n    /**\n    Schedules an action to be executed immediately.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public final func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        self.configuration.schedule(state, action: action)\n    }\n    \n    /**\n    Schedules an action to be executed.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter dueTime: Relative time after which to execute the action.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public final func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {\n        self.configuration.scheduleRelative(state, dueTime: dueTime, action: action)\n    }\n    \n    /**\n    Schedules a periodic piece of work.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter startAfter: Period after which initial work should be run.\n    - parameter period: Period for running the work periodically.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {\n        self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/ConcurrentMainScheduler.swift",
    "content": "//\n//  ConcurrentMainScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 10/17/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\n/**\nAbstracts work that needs to be performed on `MainThread`. In case `schedule` methods are called from main thread, it will perform action immediately without scheduling.\n\nThis scheduler is optimized for `subscribeOn` operator. If you want to observe observable sequence elements on main thread using `observeOn` operator,\n`MainScheduler` is more suitable for that purpose.\n*/\npublic final class ConcurrentMainScheduler : SchedulerType {\n    public typealias TimeInterval = Foundation.TimeInterval\n    public typealias Time = Date\n\n    private let mainScheduler: MainScheduler\n    private let mainQueue: DispatchQueue\n\n    /// - returns: Current time.\n    public var now: Date {\n        self.mainScheduler.now as Date\n    }\n\n    private init(mainScheduler: MainScheduler) {\n        self.mainQueue = DispatchQueue.main\n        self.mainScheduler = mainScheduler\n    }\n\n    /// Singleton instance of `ConcurrentMainScheduler`\n    public static let instance = ConcurrentMainScheduler(mainScheduler: MainScheduler.instance)\n\n    /**\n    Schedules an action to be executed immediately.\n\n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        if DispatchQueue.isMain {\n            return action(state)\n        }\n\n        let cancel = SingleAssignmentDisposable()\n\n        self.mainQueue.async {\n            if cancel.isDisposed {\n                return\n            }\n\n            cancel.setDisposable(action(state))\n        }\n\n        return cancel\n    }\n\n    /**\n    Schedules an action to be executed.\n\n    - parameter state: State passed to the action to be executed.\n    - parameter dueTime: Relative time after which to execute the action.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public final func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {\n        self.mainScheduler.scheduleRelative(state, dueTime: dueTime, action: action)\n    }\n\n    /**\n    Schedules a periodic piece of work.\n\n    - parameter state: State passed to the action to be executed.\n    - parameter startAfter: Period after which initial work should be run.\n    - parameter period: Period for running the work periodically.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {\n        self.mainScheduler.schedulePeriodic(state, startAfter: startAfter, period: period, action: action)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/CurrentThreadScheduler.swift",
    "content": "//\n//  CurrentThreadScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 8/30/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\n#if os(Linux)\n    fileprivate enum CurrentThreadSchedulerQueueKey {\n        fileprivate static let instance = \"RxSwift.CurrentThreadScheduler.Queue\"\n    }\n#else\n    private class CurrentThreadSchedulerQueueKey: NSObject, NSCopying {\n        static let instance = CurrentThreadSchedulerQueueKey()\n        private override init() {\n            super.init()\n        }\n\n        override var hash: Int {\n            return 0\n        }\n\n        public func copy(with zone: NSZone? = nil) -> Any {\n            return self\n        }\n    }\n#endif\n\n/// Represents an object that schedules units of work on the current thread.\n///\n/// This is the default scheduler for operators that generate elements.\n///\n/// This scheduler is also sometimes called `trampoline scheduler`.\npublic class CurrentThreadScheduler : ImmediateSchedulerType {\n    typealias ScheduleQueue = RxMutableBox<Queue<ScheduledItemType>>\n\n    /// The singleton instance of the current thread scheduler.\n    public static let instance = CurrentThreadScheduler()\n\n    private static var isScheduleRequiredKey: pthread_key_t = { () -> pthread_key_t in\n        let key = UnsafeMutablePointer<pthread_key_t>.allocate(capacity: 1)\n        defer { key.deallocate() }\n                                                               \n        guard pthread_key_create(key, nil) == 0 else {\n            rxFatalError(\"isScheduleRequired key creation failed\")\n        }\n\n        return key.pointee\n    }()\n\n    private static var scheduleInProgressSentinel: UnsafeRawPointer = { () -> UnsafeRawPointer in\n        return UnsafeRawPointer(UnsafeMutablePointer<Int>.allocate(capacity: 1))\n    }()\n\n    static var queue : ScheduleQueue? {\n        get {\n            return Thread.getThreadLocalStorageValueForKey(CurrentThreadSchedulerQueueKey.instance)\n        }\n        set {\n            Thread.setThreadLocalStorageValue(newValue, forKey: CurrentThreadSchedulerQueueKey.instance)\n        }\n    }\n\n    /// Gets a value that indicates whether the caller must call a `schedule` method.\n    public static private(set) var isScheduleRequired: Bool {\n        get {\n            return pthread_getspecific(CurrentThreadScheduler.isScheduleRequiredKey) == nil\n        }\n        set(isScheduleRequired) {\n            if pthread_setspecific(CurrentThreadScheduler.isScheduleRequiredKey, isScheduleRequired ? nil : scheduleInProgressSentinel) != 0 {\n                rxFatalError(\"pthread_setspecific failed\")\n            }\n        }\n    }\n\n    /**\n    Schedules an action to be executed as soon as possible on current thread.\n\n    If this method is called on some thread that doesn't have `CurrentThreadScheduler` installed, scheduler will be\n    automatically installed and uninstalled after all work is performed.\n\n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        if CurrentThreadScheduler.isScheduleRequired {\n            CurrentThreadScheduler.isScheduleRequired = false\n\n            let disposable = action(state)\n\n            defer {\n                CurrentThreadScheduler.isScheduleRequired = true\n                CurrentThreadScheduler.queue = nil\n            }\n\n            guard let queue = CurrentThreadScheduler.queue else {\n                return disposable\n            }\n\n            while let latest = queue.value.dequeue() {\n                if latest.isDisposed {\n                    continue\n                }\n                latest.invoke()\n            }\n\n            return disposable\n        }\n\n        let existingQueue = CurrentThreadScheduler.queue\n\n        let queue: RxMutableBox<Queue<ScheduledItemType>>\n        if let existingQueue = existingQueue {\n            queue = existingQueue\n        }\n        else {\n            queue = RxMutableBox(Queue<ScheduledItemType>(capacity: 1))\n            CurrentThreadScheduler.queue = queue\n        }\n\n        let scheduledItem = ScheduledItem(action: action, state: state)\n        queue.value.enqueue(scheduledItem)\n\n        return scheduledItem\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/HistoricalScheduler.swift",
    "content": "//\n//  HistoricalScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 12/27/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n/// Provides a virtual time scheduler that uses `Date` for absolute time and `NSTimeInterval` for relative time.\npublic class HistoricalScheduler : VirtualTimeScheduler<HistoricalSchedulerTimeConverter> {\n\n    /**\n      Creates a new historical scheduler with initial clock value.\n     \n     - parameter initialClock: Initial value for virtual clock.\n    */\n    public init(initialClock: RxTime = Date(timeIntervalSince1970: 0)) {\n        super.init(initialClock: initialClock, converter: HistoricalSchedulerTimeConverter())\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift",
    "content": "//\n//  HistoricalSchedulerTimeConverter.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 12/27/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n/// Converts historical virtual time into real time.\n///\n/// Since historical virtual time is also measured in `Date`, this converter is identity function.\npublic struct HistoricalSchedulerTimeConverter : VirtualTimeConverterType {\n    /// Virtual time unit used that represents ticks of virtual clock.\n    public typealias VirtualTimeUnit = RxTime\n\n    /// Virtual time unit used to represent differences of virtual times.\n    public typealias VirtualTimeIntervalUnit = TimeInterval\n\n    /// Returns identical value of argument passed because historical virtual time is equal to real time, just\n    /// decoupled from local machine clock.\n    public func convertFromVirtualTime(_ virtualTime: VirtualTimeUnit) -> RxTime {\n        virtualTime\n    }\n\n    /// Returns identical value of argument passed because historical virtual time is equal to real time, just\n    /// decoupled from local machine clock.\n    public func convertToVirtualTime(_ time: RxTime) -> VirtualTimeUnit {\n        time\n    }\n\n    /// Returns identical value of argument passed because historical virtual time is equal to real time, just\n    /// decoupled from local machine clock.\n    public func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> TimeInterval {\n        virtualTimeInterval\n    }\n\n    /// Returns identical value of argument passed because historical virtual time is equal to real time, just\n    /// decoupled from local machine clock.\n    public func convertToVirtualTimeInterval(_ timeInterval: TimeInterval) -> VirtualTimeIntervalUnit {\n        timeInterval\n    }\n\n    /**\n     Offsets `Date` by time interval.\n     \n     - parameter time: Time.\n     - parameter timeInterval: Time interval offset.\n     - returns: Time offsetted by time interval.\n    */\n    public func offsetVirtualTime(_ time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit {\n        time.addingTimeInterval(offset)\n    }\n\n    /// Compares two `Date`s.\n    public func compareVirtualTime(_ lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison {\n        switch lhs.compare(rhs as Date) {\n        case .orderedAscending:\n            return .lessThan\n        case .orderedSame:\n            return .equal\n        case .orderedDescending:\n            return .greaterThan\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift",
    "content": "//\n//  DispatchQueueConfiguration.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 7/23/16.\n//  Copyright © 2016 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\nstruct DispatchQueueConfiguration {\n    let queue: DispatchQueue\n    let leeway: DispatchTimeInterval\n}\n\nextension DispatchQueueConfiguration {\n    func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        let cancel = SingleAssignmentDisposable()\n\n        self.queue.async {\n            if cancel.isDisposed {\n                return\n            }\n\n\n            cancel.setDisposable(action(state))\n        }\n\n        return cancel\n    }\n\n    func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {\n        let deadline = DispatchTime.now() + dueTime\n\n        let compositeDisposable = CompositeDisposable()\n\n        let timer = DispatchSource.makeTimerSource(queue: self.queue)\n        timer.schedule(deadline: deadline, leeway: self.leeway)\n\n        // TODO:\n        // This looks horrible, and yes, it is.\n        // It looks like Apple has made a conceptual change here, and I'm unsure why.\n        // Need more info on this.\n        // It looks like just setting timer to fire and not holding a reference to it\n        // until deadline causes timer cancellation.\n        var timerReference: DispatchSourceTimer? = timer\n        let cancelTimer = Disposables.create {\n            timerReference?.cancel()\n            timerReference = nil\n        }\n\n        timer.setEventHandler(handler: {\n            if compositeDisposable.isDisposed {\n                return\n            }\n            _ = compositeDisposable.insert(action(state))\n            cancelTimer.dispose()\n        })\n        timer.resume()\n\n        _ = compositeDisposable.insert(cancelTimer)\n\n        return compositeDisposable\n    }\n\n    func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {\n        let initial = DispatchTime.now() + startAfter\n\n        var timerState = state\n\n        let timer = DispatchSource.makeTimerSource(queue: self.queue)\n        timer.schedule(deadline: initial, repeating: period, leeway: self.leeway)\n        \n        // TODO:\n        // This looks horrible, and yes, it is.\n        // It looks like Apple has made a conceptual change here, and I'm unsure why.\n        // Need more info on this.\n        // It looks like just setting timer to fire and not holding a reference to it\n        // until deadline causes timer cancellation.\n        var timerReference: DispatchSourceTimer? = timer\n        let cancelTimer = Disposables.create {\n            timerReference?.cancel()\n            timerReference = nil\n        }\n\n        timer.setEventHandler(handler: {\n            if cancelTimer.isDisposed {\n                return\n            }\n            timerState = action(timerState)\n        })\n        timer.resume()\n        \n        return cancelTimer\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableScheduledItem.swift",
    "content": "//\n//  InvocableScheduledItem.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 11/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nstruct InvocableScheduledItem<I: InvocableWithValueType> : InvocableType {\n\n    let invocable: I\n    let state: I.Value\n\n    init(invocable: I, state: I.Value) {\n        self.invocable = invocable\n        self.state = state\n    }\n\n    func invoke() {\n        self.invocable.invoke(self.state)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/Internal/InvocableType.swift",
    "content": "//\n//  InvocableType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 11/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol InvocableType {\n    func invoke()\n}\n\nprotocol InvocableWithValueType {\n    associatedtype Value\n\n    func invoke(_ value: Value)\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItem.swift",
    "content": "//\n//  ScheduledItem.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/2/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nstruct ScheduledItem<T>\n    : ScheduledItemType\n    , InvocableType {\n    typealias Action = (T) -> Disposable\n    \n    private let action: Action\n    private let state: T\n\n    private let disposable = SingleAssignmentDisposable()\n\n    var isDisposed: Bool {\n        self.disposable.isDisposed\n    }\n    \n    init(action: @escaping Action, state: T) {\n        self.action = action\n        self.state = state\n    }\n    \n    func invoke() {\n         self.disposable.setDisposable(self.action(self.state))\n    }\n    \n    func dispose() {\n        self.disposable.dispose()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/Internal/ScheduledItemType.swift",
    "content": "//\n//  ScheduledItemType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 11/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprotocol ScheduledItemType\n    : Cancelable\n    , InvocableType {\n    func invoke()\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/MainScheduler.swift",
    "content": "//\n//  MainScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\n#if !os(Linux)\n    import Foundation\n#endif\n\n/**\nAbstracts work that needs to be performed on `DispatchQueue.main`. In case `schedule` methods are called from `DispatchQueue.main`, it will perform action immediately without scheduling.\n\nThis scheduler is usually used to perform UI work.\n\nMain scheduler is a specialization of `SerialDispatchQueueScheduler`.\n\nThis scheduler is optimized for `observeOn` operator. To ensure observable sequence is subscribed on main thread using `subscribeOn`\noperator please use `ConcurrentMainScheduler` because it is more optimized for that purpose.\n*/\npublic final class MainScheduler : SerialDispatchQueueScheduler {\n\n    private let mainQueue: DispatchQueue\n\n    let numberEnqueued = AtomicInt(0)\n\n    /// Initializes new instance of `MainScheduler`.\n    public init() {\n        self.mainQueue = DispatchQueue.main\n        super.init(serialQueue: self.mainQueue)\n    }\n\n    /// Singleton instance of `MainScheduler`\n    public static let instance = MainScheduler()\n\n    /// Singleton instance of `MainScheduler` that always schedules work asynchronously\n    /// and doesn't perform optimizations for calls scheduled from main queue.\n    public static let asyncInstance = SerialDispatchQueueScheduler(serialQueue: DispatchQueue.main)\n\n    /// In case this method is called on a background thread it will throw an exception.\n    public static func ensureExecutingOnScheduler(errorMessage: String? = nil) {\n        if !DispatchQueue.isMain {\n            rxFatalError(errorMessage ?? \"Executing on background thread. Please use `MainScheduler.instance.schedule` to schedule work on main thread.\")\n        }\n    }\n\n    /// In case this method is running on a background thread it will throw an exception.\n    public static func ensureRunningOnMainThread(errorMessage: String? = nil) {\n        #if !os(Linux) // isMainThread is not implemented in Linux Foundation\n            guard Thread.isMainThread else {\n                rxFatalError(errorMessage ?? \"Running on background thread.\")\n            }\n        #endif\n    }\n\n    override func scheduleInternal<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        let previousNumberEnqueued = increment(self.numberEnqueued)\n\n        if DispatchQueue.isMain && previousNumberEnqueued == 0 {\n            let disposable = action(state)\n            decrement(self.numberEnqueued)\n            return disposable\n        }\n\n        let cancel = SingleAssignmentDisposable()\n\n        self.mainQueue.async {\n            if !cancel.isDisposed {\n                cancel.setDisposable(action(state))\n            }\n\n            decrement(self.numberEnqueued)\n        }\n\n        return cancel\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/OperationQueueScheduler.swift",
    "content": "//\n//  OperationQueueScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/4/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\n/// Abstracts the work that needs to be performed on a specific `NSOperationQueue`.\n///\n/// This scheduler is suitable for cases when there is some bigger chunk of work that needs to be performed in background and you want to fine tune concurrent processing using `maxConcurrentOperationCount`.\npublic class OperationQueueScheduler: ImmediateSchedulerType {\n    public let operationQueue: OperationQueue\n    public let queuePriority: Operation.QueuePriority\n    \n    /// Constructs new instance of `OperationQueueScheduler` that performs work on `operationQueue`.\n    ///\n    /// - parameter operationQueue: Operation queue targeted to perform work on.\n    /// - parameter queuePriority: Queue priority which will be assigned to new operations.\n    public init(operationQueue: OperationQueue, queuePriority: Operation.QueuePriority = .normal) {\n        self.operationQueue = operationQueue\n        self.queuePriority = queuePriority\n    }\n    \n    /**\n    Schedules an action to be executed recursively.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        let cancel = SingleAssignmentDisposable()\n\n        let operation = BlockOperation {\n            if cancel.isDisposed {\n                return\n            }\n\n\n            cancel.setDisposable(action(state))\n        }\n\n        operation.queuePriority = self.queuePriority\n\n        self.operationQueue.addOperation(operation)\n        \n        return cancel\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/RecursiveScheduler.swift",
    "content": "//\n//  RecursiveScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/7/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nprivate enum ScheduleState {\n    case initial\n    case added(CompositeDisposable.DisposeKey)\n    case done\n}\n\n/// Type erased recursive scheduler.\nfinal class AnyRecursiveScheduler<State> {\n    \n    typealias Action =  (State, AnyRecursiveScheduler<State>) -> Void\n\n    private let lock = RecursiveLock()\n    \n    // state\n    private let group = CompositeDisposable()\n\n    private var scheduler: SchedulerType\n    private var action: Action?\n    \n    init(scheduler: SchedulerType, action: @escaping Action) {\n        self.action = action\n        self.scheduler = scheduler\n    }\n\n    /**\n    Schedules an action to be executed recursively.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter dueTime: Relative time after which to execute the recursive action.\n    */\n    func schedule(_ state: State, dueTime: RxTimeInterval) {\n        var scheduleState: ScheduleState = .initial\n\n        let d = self.scheduler.scheduleRelative(state, dueTime: dueTime) { state -> Disposable in\n            // best effort\n            if self.group.isDisposed {\n                return Disposables.create()\n            }\n            \n            let action = self.lock.performLocked { () -> Action? in\n                switch scheduleState {\n                case let .added(removeKey):\n                    self.group.remove(for: removeKey)\n                case .initial:\n                    break\n                case .done:\n                    break\n                }\n\n                scheduleState = .done\n\n                return self.action\n            }\n            \n            if let action = action {\n                action(state, self)\n            }\n            \n            return Disposables.create()\n        }\n            \n        self.lock.performLocked {\n            switch scheduleState {\n            case .added:\n                rxFatalError(\"Invalid state\")\n            case .initial:\n                if let removeKey = self.group.insert(d) {\n                    scheduleState = .added(removeKey)\n                }\n                else {\n                    scheduleState = .done\n                }\n            case .done:\n                break\n            }\n        }\n    }\n\n    /// Schedules an action to be executed recursively.\n    ///\n    /// - parameter state: State passed to the action to be executed.\n    func schedule(_ state: State) {\n        var scheduleState: ScheduleState = .initial\n\n        let d = self.scheduler.schedule(state) { state -> Disposable in\n            // best effort\n            if self.group.isDisposed {\n                return Disposables.create()\n            }\n            \n            let action = self.lock.performLocked { () -> Action? in\n                switch scheduleState {\n                case let .added(removeKey):\n                    self.group.remove(for: removeKey)\n                case .initial:\n                    break\n                case .done:\n                    break\n                }\n\n                scheduleState = .done\n                \n                return self.action\n            }\n           \n            if let action = action {\n                action(state, self)\n            }\n            \n            return Disposables.create()\n        }\n        \n        self.lock.performLocked {\n            switch scheduleState {\n            case .added:\n                rxFatalError(\"Invalid state\")\n            case .initial:\n                if let removeKey = self.group.insert(d) {\n                    scheduleState = .added(removeKey)\n                }\n                else {\n                    scheduleState = .done\n                }\n            case .done:\n                break\n            }\n        }\n    }\n    \n    func dispose() {\n        self.lock.performLocked {\n            self.action = nil\n        }\n        self.group.dispose()\n    }\n}\n\n/// Type erased recursive scheduler.\nfinal class RecursiveImmediateScheduler<State> {\n    typealias Action =  (_ state: State, _ recurse: (State) -> Void) -> Void\n    \n    private var lock = SpinLock()\n    private let group = CompositeDisposable()\n    \n    private var action: Action?\n    private let scheduler: ImmediateSchedulerType\n    \n    init(action: @escaping Action, scheduler: ImmediateSchedulerType) {\n        self.action = action\n        self.scheduler = scheduler\n    }\n    \n    // immediate scheduling\n    \n    /// Schedules an action to be executed recursively.\n    ///\n    /// - parameter state: State passed to the action to be executed.\n    func schedule(_ state: State) {\n        var scheduleState: ScheduleState = .initial\n\n        let d = self.scheduler.schedule(state) { state -> Disposable in\n            // best effort\n            if self.group.isDisposed {\n                return Disposables.create()\n            }\n            \n            let action = self.lock.performLocked { () -> Action? in\n                switch scheduleState {\n                case let .added(removeKey):\n                    self.group.remove(for: removeKey)\n                case .initial:\n                    break\n                case .done:\n                    break\n                }\n\n                scheduleState = .done\n\n                return self.action\n            }\n            \n            if let action = action {\n                action(state, self.schedule)\n            }\n            \n            return Disposables.create()\n        }\n        \n        self.lock.performLocked {\n            switch scheduleState {\n            case .added:\n                rxFatalError(\"Invalid state\")\n            case .initial:\n                if let removeKey = self.group.insert(d) {\n                    scheduleState = .added(removeKey)\n                }\n                else {\n                    scheduleState = .done\n                }\n            case .done:\n                break\n            }\n        }\n    }\n    \n    func dispose() {\n        self.lock.performLocked {\n            self.action = nil\n        }\n        self.group.dispose()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/SchedulerServices+Emulation.swift",
    "content": "//\n//  SchedulerServices+Emulation.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 6/6/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nenum SchedulePeriodicRecursiveCommand {\n    case tick\n    case dispatchStart\n}\n\nfinal class SchedulePeriodicRecursive<State> {\n    typealias RecursiveAction = (State) -> State\n    typealias RecursiveScheduler = AnyRecursiveScheduler<SchedulePeriodicRecursiveCommand>\n\n    private let scheduler: SchedulerType\n    private let startAfter: RxTimeInterval\n    private let period: RxTimeInterval\n    private let action: RecursiveAction\n\n    private var state: State\n    private let pendingTickCount = AtomicInt(0)\n\n    init(scheduler: SchedulerType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping RecursiveAction, state: State) {\n        self.scheduler = scheduler\n        self.startAfter = startAfter\n        self.period = period\n        self.action = action\n        self.state = state\n    }\n\n    func start() -> Disposable {\n        self.scheduler.scheduleRecursive(SchedulePeriodicRecursiveCommand.tick, dueTime: self.startAfter, action: self.tick)\n    }\n\n    func tick(_ command: SchedulePeriodicRecursiveCommand, scheduler: RecursiveScheduler) {\n        // Tries to emulate periodic scheduling as best as possible.\n        // The problem that could arise is if handling periodic ticks take too long, or\n        // tick interval is short.\n        switch command {\n        case .tick:\n            scheduler.schedule(.tick, dueTime: self.period)\n\n            // The idea is that if on tick there wasn't any item enqueued, schedule to perform work immediately.\n            // Else work will be scheduled after previous enqueued work completes.\n            if increment(self.pendingTickCount) == 0 {\n                self.tick(.dispatchStart, scheduler: scheduler)\n            }\n\n        case .dispatchStart:\n            self.state = self.action(self.state)\n            // Start work and schedule check is this last batch of work\n            if decrement(self.pendingTickCount) > 1 {\n                // This gives priority to scheduler emulation, it's not perfect, but helps\n                scheduler.schedule(SchedulePeriodicRecursiveCommand.dispatchStart)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/SerialDispatchQueueScheduler.swift",
    "content": "//\n//  SerialDispatchQueueScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/8/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Dispatch\nimport Foundation\n\n/**\nAbstracts the work that needs to be performed on a specific `dispatch_queue_t`. It will make sure \nthat even if concurrent dispatch queue is passed, it's transformed into a serial one.\n\nIt is extremely important that this scheduler is serial, because\ncertain operator perform optimizations that rely on that property.\n\nBecause there is no way of detecting is passed dispatch queue serial or\nconcurrent, for every queue that is being passed, worst case (concurrent)\nwill be assumed, and internal serial proxy dispatch queue will be created.\n\nThis scheduler can also be used with internal serial queue alone.\n\nIn case some customization need to be made on it before usage,\ninternal serial queue can be customized using `serialQueueConfiguration`\ncallback.\n*/\npublic class SerialDispatchQueueScheduler : SchedulerType {\n    public typealias TimeInterval = Foundation.TimeInterval\n    public typealias Time = Date\n    \n    /// - returns: Current time.\n    public var now : Date {\n        Date()\n    }\n\n    let configuration: DispatchQueueConfiguration\n    \n    /**\n    Constructs new `SerialDispatchQueueScheduler` that wraps `serialQueue`.\n\n    - parameter serialQueue: Target dispatch queue.\n    - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer.\n    */\n    init(serialQueue: DispatchQueue, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) {\n        self.configuration = DispatchQueueConfiguration(queue: serialQueue, leeway: leeway)\n    }\n\n    /**\n    Constructs new `SerialDispatchQueueScheduler` with internal serial queue named `internalSerialQueueName`.\n    \n    Additional dispatch queue properties can be set after dispatch queue is created using `serialQueueConfiguration`.\n    \n    - parameter internalSerialQueueName: Name of internal serial dispatch queue.\n    - parameter serialQueueConfiguration: Additional configuration of internal serial dispatch queue.\n    - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer.\n    */\n    public convenience init(internalSerialQueueName: String, serialQueueConfiguration: ((DispatchQueue) -> Void)? = nil, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) {\n        let queue = DispatchQueue(label: internalSerialQueueName, attributes: [])\n        serialQueueConfiguration?(queue)\n        self.init(serialQueue: queue, leeway: leeway)\n    }\n    \n    /**\n    Constructs new `SerialDispatchQueueScheduler` named `internalSerialQueueName` that wraps `queue`.\n    \n    - parameter queue: Possibly concurrent dispatch queue used to perform work.\n    - parameter internalSerialQueueName: Name of internal serial dispatch queue proxy.\n    - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer.\n    */\n    public convenience init(queue: DispatchQueue, internalSerialQueueName: String, leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) {\n        // Swift 3.0 IUO\n        let serialQueue = DispatchQueue(label: internalSerialQueueName,\n                                        attributes: [],\n                                        target: queue)\n        self.init(serialQueue: serialQueue, leeway: leeway)\n    }\n\n    /**\n     Constructs new `SerialDispatchQueueScheduler` that wraps one of the global concurrent dispatch queues.\n     \n     - parameter qos: Identifier for global dispatch queue with specified quality of service class.\n     - parameter internalSerialQueueName: Custom name for internal serial dispatch queue proxy.\n     - parameter leeway: The amount of time, in nanoseconds, that the system will defer the timer.\n     */\n    @available(macOS 10.10, *)\n    public convenience init(qos: DispatchQoS, internalSerialQueueName: String = \"rx.global_dispatch_queue.serial\", leeway: DispatchTimeInterval = DispatchTimeInterval.nanoseconds(0)) {\n        self.init(queue: DispatchQueue.global(qos: qos.qosClass), internalSerialQueueName: internalSerialQueueName, leeway: leeway)\n    }\n    \n    /**\n    Schedules an action to be executed immediately.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public final func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        self.scheduleInternal(state, action: action)\n    }\n\n    func scheduleInternal<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        self.configuration.schedule(state, action: action)\n    }\n\n    /**\n    Schedules an action to be executed.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter dueTime: Relative time after which to execute the action.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public final func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {\n        self.configuration.scheduleRelative(state, dueTime: dueTime, action: action)\n    }\n    \n    /**\n    Schedules a periodic piece of work.\n    \n    - parameter state: State passed to the action to be executed.\n    - parameter startAfter: Period after which initial work should be run.\n    - parameter period: Period for running the work periodically.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func schedulePeriodic<StateType>(_ state: StateType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping (StateType) -> StateType) -> Disposable {\n        self.configuration.schedulePeriodic(state, startAfter: startAfter, period: period, action: action)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeConverterType.swift",
    "content": "//\n//  VirtualTimeConverterType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 12/23/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n/// Parametrization for virtual time used by `VirtualTimeScheduler`s.\npublic protocol VirtualTimeConverterType {\n    /// Virtual time unit used that represents ticks of virtual clock.\n    associatedtype VirtualTimeUnit\n\n    /// Virtual time unit used to represent differences of virtual times.\n    associatedtype VirtualTimeIntervalUnit\n\n    /**\n     Converts virtual time to real time.\n     \n     - parameter virtualTime: Virtual time to convert to `Date`.\n     - returns: `Date` corresponding to virtual time.\n    */\n    func convertFromVirtualTime(_ virtualTime: VirtualTimeUnit) -> RxTime\n\n    /**\n     Converts real time to virtual time.\n     \n     - parameter time: `Date` to convert to virtual time.\n     - returns: Virtual time corresponding to `Date`.\n    */\n    func convertToVirtualTime(_ time: RxTime) -> VirtualTimeUnit\n\n    /**\n     Converts from virtual time interval to `NSTimeInterval`.\n     \n     - parameter virtualTimeInterval: Virtual time interval to convert to `NSTimeInterval`.\n     - returns: `NSTimeInterval` corresponding to virtual time interval.\n    */\n    func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> TimeInterval\n\n    /**\n     Converts from `NSTimeInterval` to virtual time interval.\n     \n     - parameter timeInterval: `NSTimeInterval` to convert to virtual time interval.\n     - returns: Virtual time interval corresponding to time interval.\n    */\n    func convertToVirtualTimeInterval(_ timeInterval: TimeInterval) -> VirtualTimeIntervalUnit\n\n    /**\n     Offsets virtual time by virtual time interval.\n     \n     - parameter time: Virtual time.\n     - parameter offset: Virtual time interval.\n     - returns: Time corresponding to time offsetted by virtual time interval.\n    */\n    func offsetVirtualTime(_ time: VirtualTimeUnit, offset: VirtualTimeIntervalUnit) -> VirtualTimeUnit\n\n    /**\n     This is additional abstraction because `Date` is unfortunately not comparable.\n     Extending `Date` with `Comparable` would be too risky because of possible collisions with other libraries.\n    */\n    func compareVirtualTime(_ lhs: VirtualTimeUnit, _ rhs: VirtualTimeUnit) -> VirtualTimeComparison\n}\n\n/**\n Virtual time comparison result.\n\n This is additional abstraction because `Date` is unfortunately not comparable.\n Extending `Date` with `Comparable` would be too risky because of possible collisions with other libraries.\n*/\npublic enum VirtualTimeComparison {\n    /// lhs < rhs.\n    case lessThan\n    /// lhs == rhs.\n    case equal\n    /// lhs > rhs.\n    case greaterThan\n}\n\nextension VirtualTimeComparison {\n    /// lhs < rhs.\n    var lessThen: Bool {\n        self == .lessThan\n    }\n\n    /// lhs > rhs\n    var greaterThan: Bool {\n        self == .greaterThan\n    }\n\n    /// lhs == rhs\n    var equal: Bool {\n        self == .equal\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Schedulers/VirtualTimeScheduler.swift",
    "content": "//\n//  VirtualTimeScheduler.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Base class for virtual time schedulers using a priority queue for scheduled items.\nopen class VirtualTimeScheduler<Converter: VirtualTimeConverterType>\n    : SchedulerType {\n\n    public typealias VirtualTime = Converter.VirtualTimeUnit\n    public typealias VirtualTimeInterval = Converter.VirtualTimeIntervalUnit\n\n    private var running : Bool\n\n    private var currentClock: VirtualTime\n\n    private var schedulerQueue : PriorityQueue<VirtualSchedulerItem<VirtualTime>>\n    private var converter: Converter\n\n    private var nextId = 0\n\n    /// - returns: Current time.\n    public var now: RxTime {\n        self.converter.convertFromVirtualTime(self.clock)\n    }\n\n    /// - returns: Scheduler's absolute time clock value.\n    public var clock: VirtualTime {\n        self.currentClock\n    }\n\n    /// Creates a new virtual time scheduler.\n    ///\n    /// - parameter initialClock: Initial value for the clock.\n    public init(initialClock: VirtualTime, converter: Converter) {\n        self.currentClock = initialClock\n        self.running = false\n        self.converter = converter\n        self.schedulerQueue = PriorityQueue(hasHigherPriority: {\n            switch converter.compareVirtualTime($0.time, $1.time) {\n            case .lessThan:\n                return true\n            case .equal:\n                return $0.id < $1.id\n            case .greaterThan:\n                return false\n            }\n        }, isEqual: { $0 === $1 })\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n    }\n\n    /**\n    Schedules an action to be executed immediately.\n\n    - parameter state: State passed to the action to be executed.\n    - parameter action: Action to be executed.\n    - returns: The disposable object used to cancel the scheduled action (best effort).\n    */\n    public func schedule<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {\n        return self.scheduleRelative(state, dueTime: .microseconds(0)) { a in\n            return action(a)\n        }\n    }\n\n    /**\n     Schedules an action to be executed.\n\n     - parameter state: State passed to the action to be executed.\n     - parameter dueTime: Relative time after which to execute the action.\n     - parameter action: Action to be executed.\n     - returns: The disposable object used to cancel the scheduled action (best effort).\n     */\n    public func scheduleRelative<StateType>(_ state: StateType, dueTime: RxTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {\n        let time = self.now.addingDispatchInterval(dueTime)\n        let absoluteTime = self.converter.convertToVirtualTime(time)\n        let adjustedTime = self.adjustScheduledTime(absoluteTime)\n        return self.scheduleAbsoluteVirtual(state, time: adjustedTime, action: action)\n    }\n\n    /**\n     Schedules an action to be executed after relative time has passed.\n\n     - parameter state: State passed to the action to be executed.\n     - parameter time: Absolute time when to execute the action. If this is less or equal then `now`, `now + 1`  will be used.\n     - parameter action: Action to be executed.\n     - returns: The disposable object used to cancel the scheduled action (best effort).\n     */\n    public func scheduleRelativeVirtual<StateType>(_ state: StateType, dueTime: VirtualTimeInterval, action: @escaping (StateType) -> Disposable) -> Disposable {\n        let time = self.converter.offsetVirtualTime(self.clock, offset: dueTime)\n        return self.scheduleAbsoluteVirtual(state, time: time, action: action)\n    }\n\n    /**\n     Schedules an action to be executed at absolute virtual time.\n\n     - parameter state: State passed to the action to be executed.\n     - parameter time: Absolute time when to execute the action.\n     - parameter action: Action to be executed.\n     - returns: The disposable object used to cancel the scheduled action (best effort).\n     */\n    public func scheduleAbsoluteVirtual<StateType>(_ state: StateType, time: VirtualTime, action: @escaping (StateType) -> Disposable) -> Disposable {\n        MainScheduler.ensureExecutingOnScheduler()\n\n        let compositeDisposable = CompositeDisposable()\n\n        let item = VirtualSchedulerItem(action: {\n            return action(state)\n        }, time: time, id: self.nextId)\n\n        self.nextId += 1\n\n        self.schedulerQueue.enqueue(item)\n        \n        _ = compositeDisposable.insert(item)\n        \n        return compositeDisposable\n    }\n\n    /// Adjusts time of scheduling before adding item to schedule queue.\n    open func adjustScheduledTime(_ time: VirtualTime) -> VirtualTime {\n        time\n    }\n\n    /// Starts the virtual time scheduler.\n    public func start() {\n        MainScheduler.ensureExecutingOnScheduler()\n\n        if self.running {\n            return\n        }\n\n        self.running = true\n        repeat {\n            guard let next = self.findNext() else {\n                break\n            }\n\n            if self.converter.compareVirtualTime(next.time, self.clock).greaterThan {\n                self.currentClock = next.time\n            }\n\n            next.invoke()\n            self.schedulerQueue.remove(next)\n        } while self.running\n\n        self.running = false\n    }\n\n    func findNext() -> VirtualSchedulerItem<VirtualTime>? {\n        while let front = self.schedulerQueue.peek() {\n            if front.isDisposed {\n                self.schedulerQueue.remove(front)\n                continue\n            }\n\n            return front\n        }\n\n        return nil\n    }\n\n    /// Advances the scheduler's clock to the specified time, running all work till that point.\n    ///\n    /// - parameter virtualTime: Absolute time to advance the scheduler's clock to.\n    public func advanceTo(_ virtualTime: VirtualTime) {\n        MainScheduler.ensureExecutingOnScheduler()\n\n        if self.running {\n            fatalError(\"Scheduler is already running\")\n        }\n\n        self.running = true\n        repeat {\n            guard let next = self.findNext() else {\n                break\n            }\n\n            if self.converter.compareVirtualTime(next.time, virtualTime).greaterThan {\n                break\n            }\n\n            if self.converter.compareVirtualTime(next.time, self.clock).greaterThan {\n                self.currentClock = next.time\n            }\n            next.invoke()\n            self.schedulerQueue.remove(next)\n        } while self.running\n\n        self.currentClock = virtualTime\n        self.running = false\n    }\n\n    /// Advances the scheduler's clock by the specified relative time.\n    public func sleep(_ virtualInterval: VirtualTimeInterval) {\n        MainScheduler.ensureExecutingOnScheduler()\n\n        let sleepTo = self.converter.offsetVirtualTime(self.clock, offset: virtualInterval)\n        if self.converter.compareVirtualTime(sleepTo, self.clock).lessThen {\n            fatalError(\"Can't sleep to past.\")\n        }\n\n        self.currentClock = sleepTo\n    }\n\n    /// Stops the virtual time scheduler.\n    public func stop() {\n        MainScheduler.ensureExecutingOnScheduler()\n\n        self.running = false\n    }\n\n    #if TRACE_RESOURCES\n        deinit {\n            _ = Resources.decrementTotal()\n        }\n    #endif\n}\n\n// MARK: description\n\nextension VirtualTimeScheduler: CustomDebugStringConvertible {\n    /// A textual representation of `self`, suitable for debugging.\n    public var debugDescription: String {\n        self.schedulerQueue.debugDescription\n    }\n}\n\nfinal class VirtualSchedulerItem<Time>\n    : Disposable {\n    typealias Action = () -> Disposable\n    \n    let action: Action\n    let time: Time\n    let id: Int\n\n    var isDisposed: Bool {\n        self.disposable.isDisposed\n    }\n    \n    var disposable = SingleAssignmentDisposable()\n    \n    init(action: @escaping Action, time: Time, id: Int) {\n        self.action = action\n        self.time = time\n        self.id = id\n    }\n\n    func invoke() {\n         self.disposable.setDisposable(self.action())\n    }\n    \n    func dispose() {\n        self.disposable.dispose()\n    }\n}\n\nextension VirtualSchedulerItem\n    : CustomDebugStringConvertible {\n    var debugDescription: String {\n        \"\\(self.time)\"\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Subjects/AsyncSubject.swift",
    "content": "//\n//  AsyncSubject.swift\n//  RxSwift\n//\n//  Created by Victor Galán on 07/01/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n/// An AsyncSubject emits the last value (and only the last value) emitted by the source Observable,\n/// and only after that source Observable completes.\n///\n/// (If the source Observable does not emit any values, the AsyncSubject also completes without emitting any values.)\npublic final class AsyncSubject<Element>\n    : Observable<Element>\n    , SubjectType\n    , ObserverType\n    , SynchronizedUnsubscribeType {\n    public typealias SubjectObserverType = AsyncSubject<Element>\n\n    typealias Observers = AnyObserver<Element>.s\n    typealias DisposeKey = Observers.KeyType\n\n    /// Indicates whether the subject has any observers\n    public var hasObservers: Bool {\n        self.lock.performLocked {\n            self.observers.count > 0\n        }\n    }\n\n    let lock = RecursiveLock()\n\n    // state\n    private var observers = Observers()\n    private var isStopped = false\n    private var stoppedEvent = nil as Event<Element>? {\n        didSet {\n            self.isStopped = self.stoppedEvent != nil\n        }\n    }\n    private var lastElement: Element?\n\n    #if DEBUG\n        private let synchronizationTracker = SynchronizationTracker()\n    #endif\n\n\n    /// Creates a subject.\n    public override init() {\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n        super.init()\n    }\n\n    /// Notifies all subscribed observers about next event.\n    ///\n    /// - parameter event: Event to send to the observers.\n    public func on(_ event: Event<Element>) {\n        #if DEBUG\n            self.synchronizationTracker.register(synchronizationErrorMessage: .default)\n            defer { self.synchronizationTracker.unregister() }\n        #endif\n        let (observers, event) = self.synchronized_on(event)\n        switch event {\n        case .next:\n            dispatch(observers, event)\n            dispatch(observers, .completed)\n        case .completed:\n            dispatch(observers, event)\n        case .error:\n            dispatch(observers, event)\n        }\n    }\n\n    func synchronized_on(_ event: Event<Element>) -> (Observers, Event<Element>) {\n        self.lock.lock(); defer { self.lock.unlock() }\n        if self.isStopped {\n            return (Observers(), .completed)\n        }\n\n        switch event {\n        case .next(let element):\n            self.lastElement = element\n            return (Observers(), .completed)\n        case .error:\n            self.stoppedEvent = event\n\n            let observers = self.observers\n            self.observers.removeAll()\n\n            return (observers, event)\n        case .completed:\n\n            let observers = self.observers\n            self.observers.removeAll()\n\n            if let lastElement = self.lastElement {\n                self.stoppedEvent = .next(lastElement)\n                return (observers, .next(lastElement))\n            }\n            else {\n                self.stoppedEvent = event\n                return (observers, .completed)\n            }\n        }\n    }\n\n    /// Subscribes an observer to the subject.\n    ///\n    /// - parameter observer: Observer to subscribe to the subject.\n    /// - returns: Disposable object that can be used to unsubscribe the observer from the subject.\n    public override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.performLocked { self.synchronized_subscribe(observer) }\n    }\n\n    func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        if let stoppedEvent = self.stoppedEvent {\n            switch stoppedEvent {\n            case .next:\n                observer.on(stoppedEvent)\n                observer.on(.completed)\n            case .completed:\n                observer.on(stoppedEvent)\n            case .error:\n                observer.on(stoppedEvent)\n            }\n            return Disposables.create()\n        }\n\n        let key = self.observers.insert(observer.on)\n\n        return SubscriptionDisposable(owner: self, key: key)\n    }\n\n    func synchronizedUnsubscribe(_ disposeKey: DisposeKey) {\n        self.lock.performLocked { self.synchronized_unsubscribe(disposeKey) }\n    }\n    \n    func synchronized_unsubscribe(_ disposeKey: DisposeKey) {\n        _ = self.observers.removeKey(disposeKey)\n    }\n    \n    /// Returns observer interface for subject.\n    public func asObserver() -> AsyncSubject<Element> {\n        self\n    }\n\n    #if TRACE_RESOURCES\n    deinit {\n        _ = Resources.decrementTotal()\n    }\n    #endif\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Subjects/BehaviorSubject.swift",
    "content": "//\n//  BehaviorSubject.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/23/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents a value that changes over time.\n///\n/// Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.\npublic final class BehaviorSubject<Element>\n    : Observable<Element>\n    , SubjectType\n    , ObserverType\n    , SynchronizedUnsubscribeType\n    , Cancelable {\n    public typealias SubjectObserverType = BehaviorSubject<Element>\n\n    typealias Observers = AnyObserver<Element>.s\n    typealias DisposeKey = Observers.KeyType\n    \n    /// Indicates whether the subject has any observers\n    public var hasObservers: Bool {\n        self.lock.performLocked { self.observers.count > 0 }\n    }\n    \n    let lock = RecursiveLock()\n    \n    // state\n    private var disposed = false\n    private var element: Element\n    private var observers = Observers()\n    private var stoppedEvent: Event<Element>?\n\n    #if DEBUG\n        private let synchronizationTracker = SynchronizationTracker()\n    #endif\n\n    /// Indicates whether the subject has been disposed.\n    public var isDisposed: Bool {\n        self.disposed\n    }\n \n    /// Initializes a new instance of the subject that caches its last value and starts with the specified value.\n    ///\n    /// - parameter value: Initial value sent to observers when no other value has been received by the subject yet.\n    public init(value: Element) {\n        self.element = value\n\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n    }\n    \n    /// Gets the current value or throws an error.\n    ///\n    /// - returns: Latest value.\n    public func value() throws -> Element {\n        self.lock.lock(); defer { self.lock.unlock() }\n        if self.isDisposed {\n            throw RxError.disposed(object: self)\n        }\n        \n        if let error = self.stoppedEvent?.error {\n            // intentionally throw exception\n            throw error\n        }\n        else {\n            return self.element\n        }\n    }\n    \n    /// Notifies all subscribed observers about next event.\n    ///\n    /// - parameter event: Event to send to the observers.\n    public func on(_ event: Event<Element>) {\n        #if DEBUG\n            self.synchronizationTracker.register(synchronizationErrorMessage: .default)\n            defer { self.synchronizationTracker.unregister() }\n        #endif\n        dispatch(self.synchronized_on(event), event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) -> Observers {\n        self.lock.lock(); defer { self.lock.unlock() }\n        if self.stoppedEvent != nil || self.isDisposed {\n            return Observers()\n        }\n        \n        switch event {\n        case .next(let element):\n            self.element = element\n        case .error, .completed:\n            self.stoppedEvent = event\n        }\n        \n        return self.observers\n    }\n    \n    /// Subscribes an observer to the subject.\n    ///\n    /// - parameter observer: Observer to subscribe to the subject.\n    /// - returns: Disposable object that can be used to unsubscribe the observer from the subject.\n    public override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.performLocked { self.synchronized_subscribe(observer) }\n    }\n\n    func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        if self.isDisposed {\n            observer.on(.error(RxError.disposed(object: self)))\n            return Disposables.create()\n        }\n        \n        if let stoppedEvent = self.stoppedEvent {\n            observer.on(stoppedEvent)\n            return Disposables.create()\n        }\n        \n        let key = self.observers.insert(observer.on)\n        observer.on(.next(self.element))\n    \n        return SubscriptionDisposable(owner: self, key: key)\n    }\n\n    func synchronizedUnsubscribe(_ disposeKey: DisposeKey) {\n        self.lock.performLocked { self.synchronized_unsubscribe(disposeKey) }\n    }\n\n    func synchronized_unsubscribe(_ disposeKey: DisposeKey) {\n        if self.isDisposed {\n            return\n        }\n\n        _ = self.observers.removeKey(disposeKey)\n    }\n\n    /// Returns observer interface for subject.\n    public func asObserver() -> BehaviorSubject<Element> {\n        self\n    }\n\n    /// Unsubscribe all observers and release resources.\n    public func dispose() {\n        self.lock.performLocked {\n            self.disposed = true\n            self.observers.removeAll()\n            self.stoppedEvent = nil\n        }\n    }\n\n    #if TRACE_RESOURCES\n        deinit {\n        _ = Resources.decrementTotal()\n        }\n    #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Subjects/PublishSubject.swift",
    "content": "//\n//  PublishSubject.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 2/11/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents an object that is both an observable sequence as well as an observer.\n///\n/// Each notification is broadcasted to all subscribed observers.\npublic final class PublishSubject<Element>\n    : Observable<Element>\n    , SubjectType\n    , Cancelable\n    , ObserverType\n    , SynchronizedUnsubscribeType {\n    public typealias SubjectObserverType = PublishSubject<Element>\n\n    typealias Observers = AnyObserver<Element>.s\n    typealias DisposeKey = Observers.KeyType\n    \n    /// Indicates whether the subject has any observers\n    public var hasObservers: Bool {\n        self.lock.performLocked { self.observers.count > 0 }\n    }\n    \n    private let lock = RecursiveLock()\n    \n    // state\n    private var disposed = false\n    private var observers = Observers()\n    private var stopped = false\n    private var stoppedEvent = nil as Event<Element>?\n\n    #if DEBUG\n        private let synchronizationTracker = SynchronizationTracker()\n    #endif\n\n    /// Indicates whether the subject has been isDisposed.\n    public var isDisposed: Bool {\n        self.disposed\n    }\n    \n    /// Creates a subject.\n    public override init() {\n        super.init()\n        #if TRACE_RESOURCES\n            _ = Resources.incrementTotal()\n        #endif\n    }\n    \n    /// Notifies all subscribed observers about next event.\n    ///\n    /// - parameter event: Event to send to the observers.\n    public func on(_ event: Event<Element>) {\n        #if DEBUG\n            self.synchronizationTracker.register(synchronizationErrorMessage: .default)\n            defer { self.synchronizationTracker.unregister() }\n        #endif\n        dispatch(self.synchronized_on(event), event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) -> Observers {\n        self.lock.lock(); defer { self.lock.unlock() }\n        switch event {\n        case .next:\n            if self.isDisposed || self.stopped {\n                return Observers()\n            }\n            \n            return self.observers\n        case .completed, .error:\n            if self.stoppedEvent == nil {\n                self.stoppedEvent = event\n                self.stopped = true\n                let observers = self.observers\n                self.observers.removeAll()\n                return observers\n            }\n\n            return Observers()\n        }\n    }\n    \n    /**\n    Subscribes an observer to the subject.\n    \n    - parameter observer: Observer to subscribe to the subject.\n    - returns: Disposable object that can be used to unsubscribe the observer from the subject.\n    */\n    public override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.performLocked { self.synchronized_subscribe(observer) }\n    }\n\n    func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        if let stoppedEvent = self.stoppedEvent {\n            observer.on(stoppedEvent)\n            return Disposables.create()\n        }\n        \n        if self.isDisposed {\n            observer.on(.error(RxError.disposed(object: self)))\n            return Disposables.create()\n        }\n        \n        let key = self.observers.insert(observer.on)\n        return SubscriptionDisposable(owner: self, key: key)\n    }\n\n    func synchronizedUnsubscribe(_ disposeKey: DisposeKey) {\n        self.lock.performLocked { self.synchronized_unsubscribe(disposeKey) }\n    }\n\n    func synchronized_unsubscribe(_ disposeKey: DisposeKey) {\n        _ = self.observers.removeKey(disposeKey)\n    }\n    \n    /// Returns observer interface for subject.\n    public func asObserver() -> PublishSubject<Element> {\n        self\n    }\n    \n    /// Unsubscribe all observers and release resources.\n    public func dispose() {\n        self.lock.performLocked { self.synchronized_dispose() }\n    }\n\n    final func synchronized_dispose() {\n        self.disposed = true\n        self.observers.removeAll()\n        self.stoppedEvent = nil\n    }\n\n    #if TRACE_RESOURCES\n        deinit {\n            _ = Resources.decrementTotal()\n        }\n    #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Subjects/ReplaySubject.swift",
    "content": "//\n//  ReplaySubject.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 4/14/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents an object that is both an observable sequence as well as an observer.\n///\n/// Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.\npublic class ReplaySubject<Element>\n    : Observable<Element>\n    , SubjectType\n    , ObserverType\n    , Disposable {\n    public typealias SubjectObserverType = ReplaySubject<Element>\n\n    typealias Observers = AnyObserver<Element>.s\n    typealias DisposeKey = Observers.KeyType\n\n    /// Indicates whether the subject has any observers\n    public var hasObservers: Bool {\n        self.lock.performLocked { self.observers.count > 0 }\n    }\n    \n    fileprivate let lock = RecursiveLock()\n    \n    // state\n    fileprivate var isDisposed = false\n    fileprivate var stopped = false\n    fileprivate var stoppedEvent = nil as Event<Element>? {\n        didSet {\n            self.stopped = self.stoppedEvent != nil\n        }\n    }\n    fileprivate var observers = Observers()\n\n    #if DEBUG\n        fileprivate let synchronizationTracker = SynchronizationTracker()\n    #endif\n\n    func unsubscribe(_ key: DisposeKey) {\n        rxAbstractMethod()\n    }\n\n    final var isStopped: Bool {\n        self.stopped\n    }\n    \n    /// Notifies all subscribed observers about next event.\n    ///\n    /// - parameter event: Event to send to the observers.\n    public func on(_ event: Event<Element>) {\n        rxAbstractMethod()\n    }\n    \n    /// Returns observer interface for subject.\n    public func asObserver() -> ReplaySubject<Element> {\n        self\n    }\n    \n    /// Unsubscribe all observers and release resources.\n    public func dispose() {\n    }\n\n    /// Creates new instance of `ReplaySubject` that replays at most `bufferSize` last elements of sequence.\n    ///\n    /// - parameter bufferSize: Maximal number of elements to replay to observer after subscription.\n    /// - returns: New instance of replay subject.\n    public static func create(bufferSize: Int) -> ReplaySubject<Element> {\n        if bufferSize == 1 {\n            return ReplayOne()\n        }\n        else {\n            return ReplayMany(bufferSize: bufferSize)\n        }\n    }\n\n    /// Creates a new instance of `ReplaySubject` that buffers all the elements of a sequence.\n    /// To avoid filling up memory, developer needs to make sure that the use case will only ever store a 'reasonable'\n    /// number of elements.\n    public static func createUnbounded() -> ReplaySubject<Element> {\n        ReplayAll()\n    }\n\n    #if TRACE_RESOURCES\n        override init() {\n            _ = Resources.incrementTotal()\n        }\n\n        deinit {\n            _ = Resources.decrementTotal()\n        }\n    #endif\n}\n\nprivate class ReplayBufferBase<Element>\n    : ReplaySubject<Element>\n    , SynchronizedUnsubscribeType {\n    \n    func trim() {\n        rxAbstractMethod()\n    }\n    \n    func addValueToBuffer(_ value: Element) {\n        rxAbstractMethod()\n    }\n    \n    func replayBuffer<Observer: ObserverType>(_ observer: Observer) where Observer.Element == Element {\n        rxAbstractMethod()\n    }\n    \n    override func on(_ event: Event<Element>) {\n        #if DEBUG\n            self.synchronizationTracker.register(synchronizationErrorMessage: .default)\n            defer { self.synchronizationTracker.unregister() }\n        #endif\n        dispatch(self.synchronized_on(event), event)\n    }\n\n    func synchronized_on(_ event: Event<Element>) -> Observers {\n        self.lock.lock(); defer { self.lock.unlock() }\n        if self.isDisposed {\n            return Observers()\n        }\n        \n        if self.isStopped {\n            return Observers()\n        }\n        \n        switch event {\n        case .next(let element):\n            self.addValueToBuffer(element)\n            self.trim()\n            return self.observers\n        case .error, .completed:\n            self.stoppedEvent = event\n            self.trim()\n            let observers = self.observers\n            self.observers.removeAll()\n            return observers\n        }\n    }\n    \n    override func subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        self.lock.performLocked { self.synchronized_subscribe(observer) }\n    }\n\n    func synchronized_subscribe<Observer: ObserverType>(_ observer: Observer) -> Disposable where Observer.Element == Element {\n        if self.isDisposed {\n            observer.on(.error(RxError.disposed(object: self)))\n            return Disposables.create()\n        }\n     \n        let anyObserver = observer.asObserver()\n        \n        self.replayBuffer(anyObserver)\n        if let stoppedEvent = self.stoppedEvent {\n            observer.on(stoppedEvent)\n            return Disposables.create()\n        }\n        else {\n            let key = self.observers.insert(observer.on)\n            return SubscriptionDisposable(owner: self, key: key)\n        }\n    }\n\n    func synchronizedUnsubscribe(_ disposeKey: DisposeKey) {\n        self.lock.performLocked { self.synchronized_unsubscribe(disposeKey) }\n    }\n\n    func synchronized_unsubscribe(_ disposeKey: DisposeKey) {\n        if self.isDisposed {\n            return\n        }\n        \n        _ = self.observers.removeKey(disposeKey)\n    }\n    \n    override func dispose() {\n        super.dispose()\n\n        self.synchronizedDispose()\n    }\n\n    func synchronizedDispose() {\n        self.lock.performLocked { self.synchronized_dispose() }\n    }\n\n    func synchronized_dispose() {\n        self.isDisposed = true\n        self.observers.removeAll()\n    }\n}\n\nprivate final class ReplayOne<Element> : ReplayBufferBase<Element> {\n    private var value: Element?\n    \n    override init() {\n        super.init()\n    }\n    \n    override func trim() {\n        \n    }\n    \n    override func addValueToBuffer(_ value: Element) {\n        self.value = value\n    }\n\n    override func replayBuffer<Observer: ObserverType>(_ observer: Observer) where Observer.Element == Element {\n        if let value = self.value {\n            observer.on(.next(value))\n        }\n    }\n\n    override func synchronized_dispose() {\n        super.synchronized_dispose()\n        self.value = nil\n    }\n}\n\nprivate class ReplayManyBase<Element>: ReplayBufferBase<Element> {\n    fileprivate var queue: Queue<Element>\n    \n    init(queueSize: Int) {\n        self.queue = Queue(capacity: queueSize + 1)\n    }\n    \n    override func addValueToBuffer(_ value: Element) {\n        self.queue.enqueue(value)\n    }\n\n    override func replayBuffer<Observer: ObserverType>(_ observer: Observer) where Observer.Element == Element {\n        for item in self.queue {\n            observer.on(.next(item))\n        }\n    }\n\n    override func synchronized_dispose() {\n        super.synchronized_dispose()\n        self.queue = Queue(capacity: 0)\n    }\n}\n\nprivate final class ReplayMany<Element> : ReplayManyBase<Element> {\n    private let bufferSize: Int\n    \n    init(bufferSize: Int) {\n        self.bufferSize = bufferSize\n        \n        super.init(queueSize: bufferSize)\n    }\n    \n    override func trim() {\n        while self.queue.count > self.bufferSize {\n            _ = self.queue.dequeue()\n        }\n    }\n}\n\nprivate final class ReplayAll<Element> : ReplayManyBase<Element> {\n    init() {\n        super.init(queueSize: 0)\n    }\n    \n    override func trim() {\n        \n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Subjects/SubjectType.swift",
    "content": "//\n//  SubjectType.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/1/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n/// Represents an object that is both an observable sequence as well as an observer.\npublic protocol SubjectType : ObservableType {\n    /// The type of the observer that represents this subject.\n    ///\n    /// Usually this type is type of subject itself, but it doesn't have to be.\n    associatedtype Observer: ObserverType\n\n    /// Returns observer interface for subject.\n    ///\n    /// - returns: Observer interface for subject.\n    func asObserver() -> Observer\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/SwiftSupport/SwiftSupport.swift",
    "content": "//\n//  SwiftSupport.swift\n//  RxSwift\n//\n//  Created by Volodymyr  Gorbenko on 3/6/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\ntypealias IntMax = Int64\npublic typealias RxAbstractInteger = FixedWidthInteger\n\nextension SignedInteger {\n    func toIntMax() -> IntMax {\n        IntMax(self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/Infallible/Infallible+CombineLatest+arity.swift",
    "content": "// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \n//\n//  Infallible+CombineLatest+arity.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 27/08/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\n// MARK: - Combine Latest\n\n// 2\nextension Infallible {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<I1: InfallibleType, I2: InfallibleType>\n        (_ source1: I1, _ source2: I2, resultSelector: @escaping (I1.Element, I2.Element) throws -> Element)\n            -> Infallible<Element> {\n        Infallible(CombineLatest2(\n            source1: source1.asObservable(), source2: source2.asObservable(),\n            resultSelector: resultSelector\n        ))\n    }\n}\n\n// 3\nextension Infallible {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType>\n        (_ source1: I1, _ source2: I2, _ source3: I3, resultSelector: @escaping (I1.Element, I2.Element, I3.Element) throws -> Element)\n            -> Infallible<Element> {\n        Infallible(CombineLatest3(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(),\n            resultSelector: resultSelector\n        ))\n    }\n}\n\n// 4\nextension Infallible {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType>\n        (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element) throws -> Element)\n            -> Infallible<Element> {\n        Infallible(CombineLatest4(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(),\n            resultSelector: resultSelector\n        ))\n    }\n}\n\n// 5\nextension Infallible {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType>\n        (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element) throws -> Element)\n            -> Infallible<Element> {\n        Infallible(CombineLatest5(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(),\n            resultSelector: resultSelector\n        ))\n    }\n}\n\n// 6\nextension Infallible {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType, I6: InfallibleType>\n        (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, _ source6: I6, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element, I6.Element) throws -> Element)\n            -> Infallible<Element> {\n        Infallible(CombineLatest6(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(),\n            resultSelector: resultSelector\n        ))\n    }\n}\n\n// 7\nextension Infallible {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType, I6: InfallibleType, I7: InfallibleType>\n        (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, _ source6: I6, _ source7: I7, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element, I6.Element, I7.Element) throws -> Element)\n            -> Infallible<Element> {\n        Infallible(CombineLatest7(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(),\n            resultSelector: resultSelector\n        ))\n    }\n}\n\n// 8\nextension Infallible {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.\n\n    - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n\n    - parameter resultSelector: Function to invoke whenever any of the sources produces an element.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func combineLatest<I1: InfallibleType, I2: InfallibleType, I3: InfallibleType, I4: InfallibleType, I5: InfallibleType, I6: InfallibleType, I7: InfallibleType, I8: InfallibleType>\n        (_ source1: I1, _ source2: I2, _ source3: I3, _ source4: I4, _ source5: I5, _ source6: I6, _ source7: I7, _ source8: I8, resultSelector: @escaping (I1.Element, I2.Element, I3.Element, I4.Element, I5.Element, I6.Element, I7.Element, I8.Element) throws -> Element)\n            -> Infallible<Element> {\n        Infallible(CombineLatest8(\n            source1: source1.asObservable(), source2: source2.asObservable(), source3: source3.asObservable(), source4: source4.asObservable(), source5: source5.asObservable(), source6: source6.asObservable(), source7: source7.asObservable(), source8: source8.asObservable(),\n            resultSelector: resultSelector\n        ))\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/Infallible/Infallible+Concurrency.swift",
    "content": "//\n//  Infallible+Concurrency.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 22/09/2021.\n//  Copyright © 2021 Krunoslav Zaher. All rights reserved.\n//\n\n#if swift(>=5.5.2) && canImport(_Concurrency) && !os(Linux)\n// MARK: - Infallible\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic extension InfallibleType {\n    /// Allows iterating over the values of an Infallible\n    /// asynchronously via Swift's concurrency features (`async/await`)\n    ///\n    /// A sample usage would look like so:\n    ///\n    /// ```swift\n    /// for await value in observable.values {\n    ///     // Handle emitted values\n    /// }\n    /// ```\n    var values: AsyncStream<Element> {\n        AsyncStream<Element> { continuation in\n            let disposable = subscribe(\n                onNext: { value in continuation.yield(value) },\n                onCompleted: { continuation.finish() },\n                onDisposed: { continuation.onTermination?(.cancelled) }\n            )\n\n            continuation.onTermination = { @Sendable _ in\n                disposable.dispose()\n            }\n        }\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/Infallible/Infallible+Create.swift",
    "content": "//\n//  Infallible+Create.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 27/08/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\npublic enum InfallibleEvent<Element> {\n    /// Next element is produced.\n    case next(Element)\n\n    /// Sequence completed successfully.\n    case completed\n}\n\nextension Infallible {\n    public typealias InfallibleObserver = (InfallibleEvent<Element>) -> Void\n\n    /**\n     Creates an observable sequence from a specified subscribe method implementation.\n\n     - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html)\n\n     - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method.\n     - returns: The observable sequence with the specified implementation for the `subscribe` method.\n     */\n    public static func create(subscribe: @escaping (@escaping InfallibleObserver) -> Disposable) -> Infallible<Element> {\n        let source = Observable<Element>.create { observer in\n            subscribe { event in\n                switch event {\n                case .next(let element):\n                    observer.onNext(element)\n                case .completed:\n                    observer.onCompleted()\n                }\n            }\n        }\n\n        return Infallible(source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/Infallible/Infallible+Operators.swift",
    "content": "//\n//  Infallible+Operators.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 27/08/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\n// MARK: - Static allocation\nextension InfallibleType {\n    /**\n     Returns an infallible sequence that contains a single element.\n\n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n\n     - parameter element: Single element in the resulting infallible sequence.\n\n     - returns: An infallible sequence containing the single specified element.\n     */\n    public static func just(_ element: Element) -> Infallible<Element> {\n        Infallible(.just(element))\n    }\n\n    /**\n     Returns an infallible sequence that contains a single element.\n\n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n\n     - parameter element: Single element in the resulting infallible sequence.\n     - parameter scheduler: Scheduler to send the single element on.\n     - returns: An infallible sequence containing the single specified element.\n     */\n    public static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Infallible<Element> {\n        Infallible(.just(element, scheduler: scheduler))\n    }\n\n    /**\n     Returns a non-terminating infallible sequence, which can be used to denote an infinite duration.\n\n     - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An infallible sequence whose observers will never get called.\n     */\n    public static func never() -> Infallible<Element> {\n        Infallible(.never())\n    }\n\n    /**\n     Returns an empty infallible sequence, using the specified scheduler to send out the single `Completed` message.\n\n     - seealso: [empty operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An infallible sequence with no elements.\n     */\n    public static func empty() -> Infallible<Element> {\n        Infallible(.empty())\n    }\n\n    /**\n     Returns an infallible sequence that invokes the specified factory function whenever a new observer subscribes.\n\n     - seealso: [defer operator on reactivex.io](http://reactivex.io/documentation/operators/defer.html)\n\n     - parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence.\n     - returns: An observable sequence whose observers trigger an invocation of the given observable factory function.\n     */\n    public static func deferred(_ observableFactory: @escaping () throws -> Infallible<Element>)\n        -> Infallible<Element> {\n        Infallible(.deferred { try observableFactory().asObservable() })\n    }\n}\n\n// MARK: From & Of\n\nextension Infallible {\n    /**\n     This method creates a new Infallible instance with a variable number of elements.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - parameter elements: Elements to generate.\n     - parameter scheduler: Scheduler to send elements on. If `nil`, elements are sent immediately on subscription.\n     - returns: The Infallible sequence whose elements are pulled from the given arguments.\n     */\n    public static func of(_ elements: Element ..., scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Infallible<Element> {\n        Infallible(Observable.from(elements, scheduler: scheduler))\n    }\n}\n\nextension Infallible {\n    /**\n     Converts an array to an Infallible sequence.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - returns: The Infallible sequence whose elements are pulled from the given enumerable sequence.\n     */\n    public static func from(_ array: [Element], scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Infallible<Element> {\n        Infallible(Observable.from(array, scheduler: scheduler))\n    }\n\n    /**\n     Converts a sequence to an Infallible sequence.\n\n     - seealso: [from operator on reactivex.io](http://reactivex.io/documentation/operators/from.html)\n\n     - returns: The Infallible sequence whose elements are pulled from the given enumerable sequence.\n     */\n    public static func from<Sequence: Swift.Sequence>(_ sequence: Sequence, scheduler: ImmediateSchedulerType = CurrentThreadScheduler.instance) -> Infallible<Element> where Sequence.Element == Element {\n        Infallible(Observable.from(sequence, scheduler: scheduler))\n    }\n}\n\n// MARK: - Filter\nextension InfallibleType {\n    /**\n     Filters the elements of an observable sequence based on a predicate.\n\n     - seealso: [filter operator on reactivex.io](http://reactivex.io/documentation/operators/filter.html)\n\n     - parameter predicate: A function to test each source element for a condition.\n     - returns: An observable sequence that contains elements from the input sequence that satisfy the condition.\n     */\n    public func filter(_ predicate: @escaping (Element) -> Bool)\n        -> Infallible<Element> {\n        Infallible(asObservable().filter(predicate))\n    }\n}\n\n// MARK: - Map\nextension InfallibleType {\n    /**\n     Projects each element of an observable sequence into a new form.\n\n     - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html)\n\n     - parameter transform: A transform function to apply to each source element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.\n\n     */\n    public func map<Result>(_ transform: @escaping (Element) -> Result)\n        -> Infallible<Result> {\n        Infallible(asObservable().map(transform))\n    }\n\n    /**\n     Projects each element of an observable sequence into an optional form and filters all optional results.\n\n     - parameter transform: A transform function to apply to each source element and which returns an element or nil.\n     - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source.\n\n     */\n    public func compactMap<Result>(_ transform: @escaping (Element) -> Result?)\n        -> Infallible<Result> {\n        Infallible(asObservable().compactMap(transform))\n    }\n}\n\n// MARK: - Distinct\n\nextension InfallibleType where Element: Comparable {\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to equality operator.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - returns: An observable sequence only containing the distinct contiguous elements, based on equality operator, from the source sequence.\n     */\n    public func distinctUntilChanged()\n        -> Infallible<Element> {\n        Infallible(asObservable().distinctUntilChanged())\n    }\n}\n\nextension InfallibleType {\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to the `keySelector`.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - parameter keySelector: A function to compute the comparison key for each element.\n     - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.\n     */\n    public func distinctUntilChanged<Key: Equatable>(_ keySelector: @escaping (Element) throws -> Key)\n        -> Infallible<Element> {\n        Infallible(self.asObservable().distinctUntilChanged(keySelector, comparer: { $0 == $1 }))\n    }\n\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to the `comparer`.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - parameter comparer: Equality comparer for computed key values.\n     - returns: An observable sequence only containing the distinct contiguous elements, based on `comparer`, from the source sequence.\n     */\n    public func distinctUntilChanged(_ comparer: @escaping (Element, Element) throws -> Bool)\n        -> Infallible<Element> {\n        Infallible(self.asObservable().distinctUntilChanged({ $0 }, comparer: comparer))\n    }\n\n    /**\n     Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.\n\n     - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n     - parameter keySelector: A function to compute the comparison key for each element.\n     - parameter comparer: Equality comparer for computed key values.\n     - returns: An observable sequence only containing the distinct contiguous elements, based on a computed key value and the comparer, from the source sequence.\n     */\n    public func distinctUntilChanged<K>(_ keySelector: @escaping (Element) throws -> K, comparer: @escaping (K, K) throws -> Bool)\n        -> Infallible<Element> {\n        Infallible(asObservable().distinctUntilChanged(keySelector, comparer: comparer))\n    }\n\n    /**\n    Returns an observable sequence that contains only contiguous elements with distinct values in the provided key path on each object.\n\n    - seealso: [distinct operator on reactivex.io](http://reactivex.io/documentation/operators/distinct.html)\n\n    - returns: An observable sequence only containing the distinct contiguous elements, based on equality operator on the provided key path\n    */\n    public func distinctUntilChanged<Property: Equatable>(at keyPath: KeyPath<Element, Property>) ->\n        Infallible<Element> {\n        Infallible(asObservable().distinctUntilChanged { $0[keyPath: keyPath] == $1[keyPath: keyPath] })\n    }\n}\n\n// MARK: - Throttle\nextension InfallibleType {\n    /**\n     Ignores elements from an observable sequence which are followed by another element within a specified relative time duration, using the specified scheduler to run throttling timers.\n\n     - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html)\n\n     - parameter dueTime: Throttling duration for each element.\n     - parameter scheduler: Scheduler to run the throttle timers on.\n     - returns: The throttled sequence.\n     */\n    public func debounce(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> Infallible<Element> {\n        Infallible(asObservable().debounce(dueTime, scheduler: scheduler))\n    }\n\n    /**\n     Returns an Observable that emits the first and the latest item emitted by the source Observable during sequential time windows of a specified duration.\n\n     This operator makes sure that no two elements are emitted in less then dueTime.\n\n     - seealso: [debounce operator on reactivex.io](http://reactivex.io/documentation/operators/debounce.html)\n\n     - parameter dueTime: Throttling duration for each element.\n     - parameter latest: Should latest element received in a dueTime wide time window since last element emission be emitted.\n     - parameter scheduler: Scheduler to run the throttle timers on.\n     - returns: The throttled sequence.\n     */\n    public func throttle(_ dueTime: RxTimeInterval, latest: Bool = true, scheduler: SchedulerType)\n        -> Infallible<Element> {\n        Infallible(asObservable().throttle(dueTime, latest: latest, scheduler: scheduler))\n    }\n}\n\n// MARK: - FlatMap\nextension InfallibleType {\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n\n     - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.\n     */\n    public func flatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)\n        -> Infallible<Source.Element> {\n        Infallible(asObservable().flatMap(selector))\n    }\n\n    /**\n     Projects each element of an observable sequence into a new sequence of observable sequences and then\n     transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.\n\n     It is a combination of `map` + `switchLatest` operator\n\n     - seealso: [flatMapLatest operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source producing an\n     Observable of Observable sequences and that at any point in time produces the elements of the most recent inner observable sequence that has been received.\n     */\n    public func flatMapLatest<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)\n        -> Infallible<Source.Element> {\n        Infallible(asObservable().flatMapLatest(selector))\n    }\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n     If element is received while there is some projected observable sequence being merged it will simply be ignored.\n\n     - seealso: [flatMapFirst operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to element that was observed while no observable is executing in parallel.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence that was received while no other sequence was being calculated.\n     */\n    public func flatMapFirst<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)\n        -> Infallible<Source.Element> {\n        Infallible(asObservable().flatMapFirst(selector))\n    }\n}\n\n// MARK: - Concat\nextension InfallibleType {\n    /**\n     Concatenates the second observable sequence to `self` upon successful termination of `self`.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - parameter second: Second observable sequence.\n     - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.\n     */\n    public func concat<Source: ObservableConvertibleType>(_ second: Source) -> Infallible<Element> where Source.Element == Element {\n        Infallible(Observable.concat([self.asObservable(), second.asObservable()]))\n    }\n\n    /**\n     Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.\n\n     This operator has tail recursive optimizations that will prevent stack overflow.\n\n     Optimizations will be performed in cases equivalent to following:\n\n     [1, [2, [3, .....].concat()].concat].concat()\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Infallible<Element>\n        where Sequence.Element == Infallible<Element> {\n        Infallible(Observable.concat(sequence.map { $0.asObservable() }))\n    }\n\n    /**\n     Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.\n\n     This operator has tail recursive optimizations that will prevent stack overflow.\n\n     Optimizations will be performed in cases equivalent to following:\n\n     [1, [2, [3, .....].concat()].concat].concat()\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Infallible<Element>\n        where Collection.Element == Infallible<Element> {\n        Infallible(Observable.concat(collection.map { $0.asObservable() }))\n    }\n\n    /**\n     Concatenates all observable sequences in the given collection, as long as the previous observable sequence terminated successfully.\n\n     This operator has tail recursive optimizations that will prevent stack overflow.\n\n     Optimizations will be performed in cases equivalent to following:\n\n     [1, [2, [3, .....].concat()].concat].concat()\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat(_ sources: Infallible<Element> ...) -> Infallible<Element> {\n        Infallible(Observable.concat(sources.map { $0.asObservable() }))\n    }\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and concatenates the resulting observable sequences into one observable sequence.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - returns: An observable sequence that contains the elements of each observed inner sequence, in sequential order.\n     */\n    public func concatMap<Source: ObservableConvertibleType>(_ selector: @escaping (Element) -> Source)\n        -> Infallible<Source.Element> {\n        Infallible(asObservable().concatMap(selector))\n    }\n}\n\n// MARK: - Merge\nextension InfallibleType {\n    /**\n     Merges elements from all observable sequences from collection into a single observable sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Collection of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func merge<Collection: Swift.Collection>(_ sources: Collection) -> Infallible<Element> where Collection.Element == Infallible<Element> {\n        Infallible(Observable.concat(sources.map { $0.asObservable() }))\n    }\n\n    /**\n     Merges elements from all infallible sequences from array into a single infallible sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Array of infallible sequences to merge.\n     - returns: The infallible sequence that merges the elements of the infallible sequences.\n     */\n    public static func merge(_ sources: [Infallible<Element>]) -> Infallible<Element> {\n        Infallible(Observable.merge(sources.map { $0.asObservable() }))\n    }\n\n    /**\n     Merges elements from all infallible sequences into a single infallible sequence.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n\n     - parameter sources: Collection of infallible sequences to merge.\n     - returns: The infallible sequence that merges the elements of the infallible sequences.\n     */\n    public static func merge(_ sources: Infallible<Element>...) -> Infallible<Element> {\n        Infallible(Observable.merge(sources.map { $0.asObservable() }))\n    }\n}\n\n// MARK: - Do\n\nextension Infallible {\n    /**\n     Invokes an action for each event in the infallible sequence, and propagates all observer messages through the result sequence.\n\n     - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html)\n\n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter afterNext: Action to invoke for each element after the observable has passed an onNext event along to its downstream.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter afterCompleted: Action to invoke after graceful termination of the observable sequence.\n     - parameter onSubscribe: Action to invoke before subscribing to source observable sequence.\n     - parameter onSubscribed: Action to invoke after subscribing to source observable sequence.\n     - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.\n     - returns: The source sequence with the side-effecting behavior applied.\n     */\n    public func `do`(onNext: ((Element) throws -> Void)? = nil, afterNext: ((Element) throws -> Void)? = nil, onCompleted: (() throws -> Void)? = nil, afterCompleted: (() throws -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil) -> Infallible<Element> {\n        Infallible(asObservable().do(onNext: onNext, afterNext: afterNext, onCompleted: onCompleted, afterCompleted: afterCompleted, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose))\n    }\n}\n\n// MARK: - Scan\nextension InfallibleType {\n    /**\n     Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.\n\n     For aggregation behavior with no intermediate results, see `reduce`.\n\n     - seealso: [scan operator on reactivex.io](http://reactivex.io/documentation/operators/scan.html)\n\n     - parameter seed: The initial accumulator value.\n     - parameter accumulator: An accumulator function to be invoked on each element.\n     - returns: An observable sequence containing the accumulated values.\n     */\n    public func scan<Seed>(into seed: Seed, accumulator: @escaping (inout Seed, Element) -> Void)\n        -> Infallible<Seed> {\n        Infallible(asObservable().scan(into: seed, accumulator: accumulator))\n    }\n\n    /**\n     Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value.\n\n     For aggregation behavior with no intermediate results, see `reduce`.\n\n     - seealso: [scan operator on reactivex.io](http://reactivex.io/documentation/operators/scan.html)\n\n     - parameter seed: The initial accumulator value.\n     - parameter accumulator: An accumulator function to be invoked on each element.\n     - returns: An observable sequence containing the accumulated values.\n     */\n    public func scan<Seed>(_ seed: Seed, accumulator: @escaping (Seed, Element) -> Seed)\n        -> Infallible<Seed> {\n        Infallible(asObservable().scan(seed, accumulator: accumulator))\n    }\n}\n\n// MARK: - Start with\n\nextension InfallibleType {\n    /**\n    Prepends a value to an observable sequence.\n\n    - seealso: [startWith operator on reactivex.io](http://reactivex.io/documentation/operators/startwith.html)\n\n    - parameter element: Element to prepend to the specified sequence.\n    - returns: The source sequence prepended with the specified values.\n    */\n    public func startWith(_ element: Element) -> Infallible<Element> {\n        Infallible(asObservable().startWith(element))\n    }\n}\n\n\n\n// MARK: - Take and Skip {\nextension InfallibleType {\n    /**\n     Returns the elements from the source observable sequence until the other observable sequence produces an element.\n\n     - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html)\n\n     - parameter other: Observable sequence that terminates propagation of elements of the source sequence.\n     - returns: An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.\n     */\n    public func take<Source: InfallibleType>(until other: Source)\n        -> Infallible<Element> {\n        Infallible(asObservable().take(until: other.asObservable()))\n    }\n\n    /**\n     Returns the elements from the source observable sequence until the other observable sequence produces an element.\n\n     - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html)\n\n     - parameter other: Observable sequence that terminates propagation of elements of the source sequence.\n     - returns: An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.\n     */\n    public func take<Source: ObservableType>(until other: Source)\n        -> Infallible<Element> {\n        Infallible(asObservable().take(until: other))\n    }\n\n    /**\n     Returns elements from an observable sequence until the specified condition is true.\n\n     - seealso: [takeUntil operator on reactivex.io](http://reactivex.io/documentation/operators/takeuntil.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - parameter behavior: Whether or not to include the last element matching the predicate. Defaults to `exclusive`.\n\n     - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test passes.\n     */\n    public func take(until predicate: @escaping (Element) throws -> Bool,\n                     behavior: TakeBehavior = .exclusive)\n        -> Infallible<Element> {\n        Infallible(asObservable().take(until: predicate, behavior: behavior))\n    }\n\n    /**\n     Returns elements from an observable sequence as long as a specified condition is true.\n\n     - seealso: [takeWhile operator on reactivex.io](http://reactivex.io/documentation/operators/takewhile.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - returns: An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.\n     */\n    public func take(while predicate: @escaping (Element) throws -> Bool,\n                     behavior: TakeBehavior = .exclusive)\n        -> Infallible<Element> {\n        Infallible(asObservable().take(while: predicate, behavior: behavior))\n    }\n\n    /**\n     Returns a specified number of contiguous elements from the start of an observable sequence.\n\n     - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html)\n\n     - parameter count: The number of elements to return.\n     - returns: An observable sequence that contains the specified number of elements from the start of the input sequence.\n     */\n    public func take(_ count: Int) -> Infallible<Element> {\n        Infallible(asObservable().take(count))\n    }\n\n    /**\n     Takes elements for the specified duration from the start of the infallible source sequence, using the specified scheduler to run timers.\n\n     - seealso: [take operator on reactivex.io](http://reactivex.io/documentation/operators/take.html)\n\n     - parameter duration: Duration for taking elements from the start of the sequence.\n     - parameter scheduler: Scheduler to run the timer on.\n     - returns: An infallible sequence with the elements taken during the specified duration from the start of the source sequence.\n     */\n    public func take(for duration: RxTimeInterval, scheduler: SchedulerType)\n        -> Infallible<Element> {\n        Infallible(asObservable().take(for: duration, scheduler: scheduler))\n    }\n\n    /**\n     Bypasses elements in an infallible sequence as long as a specified condition is true and then returns the remaining elements.\n\n     - seealso: [skipWhile operator on reactivex.io](http://reactivex.io/documentation/operators/skipwhile.html)\n\n     - parameter predicate: A function to test each element for a condition.\n     - returns: An infallible sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.\n     */\n    public func skip(while predicate: @escaping (Element) throws -> Bool) -> Infallible<Element> {\n        Infallible(asObservable().skip(while: predicate))\n    }\n\n    /**\n     Returns the elements from the source infallible sequence that are emitted after the other infallible sequence produces an element.\n\n     - seealso: [skipUntil operator on reactivex.io](http://reactivex.io/documentation/operators/skipuntil.html)\n\n     - parameter other: Infallible sequence that starts propagation of elements of the source sequence.\n     - returns: An infallible sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.\n     */\n    public func skip<Source: ObservableType>(until other: Source)\n        -> Infallible<Element> {\n        Infallible(asObservable().skip(until: other))\n    }\n}\n\n// MARK: - Share\nextension InfallibleType {\n    /**\n     Returns an observable sequence that **shares a single subscription to the underlying sequence**, and immediately upon subscription replays  elements in buffer.\n\n     This operator is equivalent to:\n     * `.whileConnected`\n     ```\n     // Each connection will have it's own subject instance to store replay events.\n     // Connections will be isolated from each another.\n     source.multicast(makeSubject: { Replay.create(bufferSize: replay) }).refCount()\n     ```\n     * `.forever`\n     ```\n     // One subject will store replay events for all connections to source.\n     // Connections won't be isolated from each another.\n     source.multicast(Replay.create(bufferSize: replay)).refCount()\n     ```\n\n     It uses optimized versions of the operators for most common operations.\n\n     - parameter replay: Maximum element count of the replay buffer.\n     - parameter scope: Lifetime scope of sharing subject. For more information see `SubjectLifetimeScope` enum.\n\n     - seealso: [shareReplay operator on reactivex.io](http://reactivex.io/documentation/operators/replay.html)\n\n     - returns: An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.\n     */\n    public func share(replay: Int = 0, scope: SubjectLifetimeScope = .whileConnected)\n        -> Infallible<Element> {\n        Infallible(asObservable().share(replay: replay, scope: scope))\n    }\n}\n\n// MARK: - withUnretained\nextension InfallibleType {\n    /**\n     Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.\n     \n     In the case the provided object cannot be retained successfully, the sequence will complete.\n     \n     - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.\n     \n     - parameter obj: The object to provide an unretained reference on.\n     - parameter resultSelector: A function to combine the unretained referenced on `obj` and the value of the observable sequence.\n     - returns: An observable sequence that contains the result of `resultSelector` being called with an unretained reference on `obj` and the values of the original sequence.\n     */\n    public func withUnretained<Object: AnyObject, Out>(\n        _ obj: Object,\n        resultSelector: @escaping (Object, Element) -> Out\n    ) -> Infallible<Out> {\n        Infallible(self.asObservable().withUnretained(obj, resultSelector: resultSelector))\n    }\n    \n    /**\n     Provides an unretained, safe to use (i.e. not implicitly unwrapped), reference to an object along with the events emitted by the sequence.\n     \n     In the case the provided object cannot be retained successfully, the sequence will complete.\n     \n     - note: Be careful when using this operator in a sequence that has a buffer or replay, for example `share(replay: 1)`, as the sharing buffer will also include the provided object, which could potentially cause a retain cycle.\n     \n     - parameter obj: The object to provide an unretained reference on.\n     - returns: An observable sequence of tuples that contains both an unretained reference on `obj` and the values of the original sequence.\n     */\n    public func withUnretained<Object: AnyObject>(_ obj: Object) -> Infallible<(Object, Element)> {\n        withUnretained(obj) { ($0, $1) }\n    }\n}\n\nextension InfallibleType {\n    // MARK: - withLatestFrom\n    /**\n     Merges two observable sequences into one observable sequence by combining each element from self with the latest element from the second source, if any.\n\n     - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n     - note: Elements emitted by self before the second source has emitted any values will be omitted.\n\n     - parameter second: Second observable source.\n     - parameter resultSelector: Function to invoke for each element from the self combined with the latest element from the second source, if any.\n     - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.\n     */\n    public func withLatestFrom<Source: InfallibleType, ResultType>(_ second: Source, resultSelector: @escaping (Element, Source.Element) throws -> ResultType) -> Infallible<ResultType> {\n        Infallible(self.asObservable().withLatestFrom(second.asObservable(), resultSelector: resultSelector))\n    }\n\n    /**\n     Merges two observable sequences into one observable sequence by using latest element from the second sequence every time when `self` emits an element.\n\n     - seealso: [combineLatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)\n     - note: Elements emitted by self before the second source has emitted any values will be omitted.\n\n     - parameter second: Second observable source.\n     - returns: An observable sequence containing the result of combining each element of the self  with the latest element from the second source, if any, using the specified result selector function.\n     */\n    public func withLatestFrom<Source: InfallibleType>(_ second: Source) -> Infallible<Source.Element> {\n        withLatestFrom(second) { $1 }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/Infallible/Infallible+Zip+arity.swift",
    "content": "// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \n//\n//  Infallible+Zip+arity.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 27/8/20.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n// MARK: - Zip\n\n\n// 2\nextension InfallibleType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, resultSelector: @escaping (E1, E2) throws -> Element)\n        -> Infallible<Element> {\n        Infallible(\n            Observable.zip(source1.asObservable(), source2.asObservable(), resultSelector: resultSelector)\n        )\n    }\n}\n\n// 3\nextension InfallibleType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)\n        -> Infallible<Element> {\n        Infallible(\n            Observable.zip(source1.asObservable(), source2.asObservable(), source3.asObservable(), resultSelector: resultSelector)\n        )\n    }\n}\n\n// 4\nextension InfallibleType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> Element)\n        -> Infallible<Element> {\n        Infallible(\n            Observable.zip(source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), resultSelector: resultSelector)\n        )\n    }\n}\n\n// 5\nextension InfallibleType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> Element)\n        -> Infallible<Element> {\n        Infallible(\n            Observable.zip(source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), resultSelector: resultSelector)\n        )\n    }\n}\n\n// 6\nextension InfallibleType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, _ source6: Infallible<E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> Element)\n        -> Infallible<Element> {\n        Infallible(\n            Observable.zip(source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), resultSelector: resultSelector)\n        )\n    }\n}\n\n// 7\nextension InfallibleType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, _ source6: Infallible<E6>, _ source7: Infallible<E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> Element)\n        -> Infallible<Element> {\n        Infallible(\n            Observable.zip(source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(), resultSelector: resultSelector)\n        )\n    }\n}\n\n// 8\nextension InfallibleType {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: Infallible<E1>, _ source2: Infallible<E2>, _ source3: Infallible<E3>, _ source4: Infallible<E4>, _ source5: Infallible<E5>, _ source6: Infallible<E6>, _ source7: Infallible<E7>, _ source8: Infallible<E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Element)\n        -> Infallible<Element> {\n        Infallible(\n            Observable.zip(source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(), source8.asObservable(), resultSelector: resultSelector)\n        )\n    }\n}\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/Infallible/Infallible.swift",
    "content": "//\n//  Infallible.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 27/08/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\n/// `Infallible` is an `Observable`-like push-style interface\n/// which is guaranteed to not emit error events.\n///\n/// Unlike `SharedSequence`, it does not share its resources or\n/// replay its events, but acts as a standard `Observable`.\npublic protocol InfallibleType: ObservableConvertibleType {}\n\n/// `Infallible` is an `Observable`-like push-style interface\n/// which is guaranteed to not emit error events.\n///\n/// Unlike `SharedSequence`, it does not share its resources or\n/// replay its events, but acts as a standard `Observable`.\npublic struct Infallible<Element>: InfallibleType {\n    private let source: Observable<Element>\n\n    init(_ source: Observable<Element>) {\n        self.source = source\n    }\n\n    public func asObservable() -> Observable<Element> { source }\n}\n\nextension InfallibleType {\n    /**\n     Subscribes an element handler, a completion handler and disposed handler to an observable sequence.\n     \n     Error callback is not exposed because `Infallible` can't error out.\n     \n     Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.\n     \n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n     - parameter object: The object to provide an unretained reference on.\n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe<Object: AnyObject>(\n        with object: Object,\n        onNext: ((Object, Element) -> Void)? = nil,\n        onCompleted: ((Object) -> Void)? = nil,\n        onDisposed: ((Object) -> Void)? = nil\n    ) -> Disposable {\n        self.asObservable().subscribe(\n            with: object,\n            onNext: onNext,\n            onCompleted: onCompleted,\n            onDisposed: onDisposed\n        )\n    }\n    \n    /**\n     Subscribes an element handler, a completion handler and disposed handler to an observable sequence.\n     \n     Error callback is not exposed because `Infallible` can't error out.\n     \n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription)\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n    */\n    public func subscribe(onNext: ((Element) -> Void)? = nil,\n                          onCompleted: (() -> Void)? = nil,\n                          onDisposed: (() -> Void)? = nil) -> Disposable {\n        self.asObservable().subscribe(onNext: onNext,\n                                      onCompleted: onCompleted,\n                                      onDisposed: onDisposed)\n    }\n\n    /**\n     Subscribes an event handler to an observable sequence.\n     \n     - parameter on: Action to invoke for each event in the observable sequence.\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe(_ on: @escaping (Event<Element>) -> Void) -> Disposable {\n        self.asObservable().subscribe(on)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/Infallible/ObservableConvertibleType+Infallible.swift",
    "content": "//\n//  ObservableConvertibleType+Infallible.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 27/08/2020.\n//  Copyright © 2020 Krunoslav Zaher. All rights reserved.\n//\n\npublic extension ObservableConvertibleType {\n    /// Convert to an `Infallible`\n    ///\n    /// - returns: `Infallible<Element>`\n    func asInfallible(onErrorJustReturn element: Element) -> Infallible<Element> {\n        Infallible(self.asObservable().catchAndReturn(element))\n    }\n\n    /// Convert to an `Infallible`\n    ///\n    /// - parameter infallible: Fall back to this provided infallible on error\n    ///\n    ///\n    /// - returns: `Infallible<Element>`\n    func asInfallible(onErrorFallbackTo infallible: Infallible<Element>) -> Infallible<Element> {\n        Infallible(self.asObservable().catch { _ in infallible.asObservable() })\n    }\n\n    /// Convert to an `Infallible`\n    ///\n    /// - parameter onErrorRecover: Recover with the this infallible closure\n    ///\n    /// - returns: `Infallible<Element>`\n    func asInfallible(onErrorRecover: @escaping (Swift.Error) -> Infallible<Element>) -> Infallible<Element> {\n        Infallible(asObservable().catch { onErrorRecover($0).asObservable() })\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/Completable+AndThen.swift",
    "content": "//\n//  Completable+AndThen.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 7/2/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nextension PrimitiveSequenceType where Trait == CompletableTrait, Element == Never {\n    /**\n     Concatenates the second observable sequence to `self` upon successful termination of `self`.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - parameter second: Second observable sequence.\n     - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.\n     */\n    public func andThen<Element>(_ second: Single<Element>) -> Single<Element> {\n        let completable = self.primitiveSequence.asObservable()\n        return Single(raw: ConcatCompletable(completable: completable, second: second.asObservable()))\n    }\n\n    /**\n     Concatenates the second observable sequence to `self` upon successful termination of `self`.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - parameter second: Second observable sequence.\n     - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.\n     */\n    public func andThen<Element>(_ second: Maybe<Element>) -> Maybe<Element> {\n        let completable = self.primitiveSequence.asObservable()\n        return Maybe(raw: ConcatCompletable(completable: completable, second: second.asObservable()))\n    }\n\n    /**\n     Concatenates the second observable sequence to `self` upon successful termination of `self`.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - parameter second: Second observable sequence.\n     - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.\n     */\n    public func andThen(_ second: Completable) -> Completable {\n        let completable = self.primitiveSequence.asObservable()\n        return Completable(raw: ConcatCompletable(completable: completable, second: second.asObservable()))\n    }\n\n    /**\n     Concatenates the second observable sequence to `self` upon successful termination of `self`.\n\n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n\n     - parameter second: Second observable sequence.\n     - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.\n     */\n    public func andThen<Element>(_ second: Observable<Element>) -> Observable<Element> {\n        let completable = self.primitiveSequence.asObservable()\n        return ConcatCompletable(completable: completable, second: second.asObservable())\n    }\n}\n\nfinal private class ConcatCompletable<Element>: Producer<Element> {\n    fileprivate let completable: Observable<Never>\n    fileprivate let second: Observable<Element>\n\n    init(completable: Observable<Never>, second: Observable<Element>) {\n        self.completable = completable\n        self.second = second\n    }\n\n    override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {\n        let sink = ConcatCompletableSink(parent: self, observer: observer, cancel: cancel)\n        let subscription = sink.run()\n        return (sink: sink, subscription: subscription)\n    }\n}\n\nfinal private class ConcatCompletableSink<Observer: ObserverType>\n    : Sink<Observer>\n    , ObserverType {\n    typealias Element = Never\n    typealias Parent = ConcatCompletable<Observer.Element>\n\n    private let parent: Parent\n    private let subscription = SerialDisposable()\n    \n    init(parent: Parent, observer: Observer, cancel: Cancelable) {\n        self.parent = parent\n        super.init(observer: observer, cancel: cancel)\n    }\n\n    func on(_ event: Event<Element>) {\n        switch event {\n        case .error(let error):\n            self.forwardOn(.error(error))\n            self.dispose()\n        case .next:\n            break\n        case .completed:\n            let otherSink = ConcatCompletableSinkOther(parent: self)\n            self.subscription.disposable = self.parent.second.subscribe(otherSink)\n        }\n    }\n\n    func run() -> Disposable {\n        let subscription = SingleAssignmentDisposable()\n        self.subscription.disposable = subscription\n        subscription.setDisposable(self.parent.completable.subscribe(self))\n        return self.subscription\n    }\n}\n\nfinal private class ConcatCompletableSinkOther<Observer: ObserverType>\n    : ObserverType {\n    typealias Element = Observer.Element \n\n    typealias Parent = ConcatCompletableSink<Observer>\n    \n    private let parent: Parent\n\n    init(parent: Parent) {\n        self.parent = parent\n    }\n\n    func on(_ event: Event<Observer.Element>) {\n        self.parent.forwardOn(event)\n        if event.isStopEvent {\n            self.parent.dispose()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/Completable.swift",
    "content": "//\n//  Completable.swift\n//  RxSwift\n//\n//  Created by sergdort on 19/08/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if DEBUG\nimport Foundation\n#endif\n\n/// Sequence containing 0 elements\npublic enum CompletableTrait { }\n/// Represents a push style sequence containing 0 elements.\npublic typealias Completable = PrimitiveSequence<CompletableTrait, Swift.Never>\n\n@frozen public enum CompletableEvent {\n    /// Sequence terminated with an error. (underlying observable sequence emits: `.error(Error)`)\n    case error(Swift.Error)\n    \n    /// Sequence completed successfully.\n    case completed\n}\n\nextension PrimitiveSequenceType where Trait == CompletableTrait, Element == Swift.Never {\n    public typealias CompletableObserver = (CompletableEvent) -> Void\n    \n    /**\n     Creates an observable sequence from a specified subscribe method implementation.\n     \n     - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html)\n     \n     - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method.\n     - returns: The observable sequence with the specified implementation for the `subscribe` method.\n     */\n    public static func create(subscribe: @escaping (@escaping CompletableObserver) -> Disposable) -> PrimitiveSequence<Trait, Element> {\n        let source = Observable<Element>.create { observer in\n            return subscribe { event in\n                switch event {\n                case .error(let error):\n                    observer.on(.error(error))\n                case .completed:\n                    observer.on(.completed)\n                }\n            }\n        }\n        \n        return PrimitiveSequence(raw: source)\n    }\n    \n    /**\n     Subscribes `observer` to receive events for this sequence.\n     \n     - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources.\n     */\n    public func subscribe(_ observer: @escaping (CompletableEvent) -> Void) -> Disposable {\n        var stopped = false\n        return self.primitiveSequence.asObservable().subscribe { event in\n            if stopped { return }\n            stopped = true\n            \n            switch event {\n            case .next:\n                rxFatalError(\"Completables can't emit values\")\n            case .error(let error):\n                observer(.error(error))\n            case .completed:\n                observer(.completed)\n            }\n        }\n    }\n    \n    /**\n     Subscribes a completion handler and an error handler for this sequence.\n     \n     Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.\n     \n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n     - parameter object: The object to provide an unretained reference on.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe<Object: AnyObject>(\n        with object: Object,\n        onCompleted: ((Object) -> Void)? = nil,\n        onError: ((Object, Swift.Error) -> Void)? = nil,\n        onDisposed: ((Object) -> Void)? = nil\n    ) -> Disposable {\n        subscribe(\n            onCompleted: { [weak object] in\n                guard let object = object else { return }\n                onCompleted?(object)\n            }, onError: { [weak object] in\n                guard let object = object else { return }\n                onError?(object, $0)\n            }, onDisposed: { [weak object] in\n                guard let object = object else { return }\n                onDisposed?(object)\n            }\n        )\n    }\n    \n    /**\n     Subscribes a completion handler and an error handler for this sequence.\n     \n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe(onCompleted: (() -> Void)? = nil,\n                          onError: ((Swift.Error) -> Void)? = nil,\n                          onDisposed: (() -> Void)? = nil) -> Disposable {\n        #if DEBUG\n                let callStack = Hooks.recordCallStackOnError ? Thread.callStackSymbols : []\n        #else\n                let callStack = [String]()\n        #endif\n\n        let disposable: Disposable\n        if let onDisposed = onDisposed {\n            disposable = Disposables.create(with: onDisposed)\n        } else {\n            disposable = Disposables.create()\n        }\n\n        let observer: CompletableObserver = { event in\n            switch event {\n            case .error(let error):\n                if let onError = onError {\n                    onError(error)\n                } else {\n                    Hooks.defaultErrorHandler(callStack, error)\n                }\n                disposable.dispose()\n            case .completed:\n                onCompleted?()\n                disposable.dispose()\n            }\n        }\n\n        return Disposables.create(\n            self.primitiveSequence.subscribe(observer),\n            disposable\n        )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == CompletableTrait, Element == Swift.Never {\n    /**\n     Returns an observable sequence that terminates with an `error`.\n\n     - seealso: [throw operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: The observable sequence that terminates with specified error.\n     */\n    public static func error(_ error: Swift.Error) -> Completable {\n        PrimitiveSequence(raw: Observable.error(error))\n    }\n\n    /**\n     Returns a non-terminating observable sequence, which can be used to denote an infinite duration.\n\n     - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An observable sequence whose observers will never get called.\n     */\n    public static func never() -> Completable {\n        PrimitiveSequence(raw: Observable.never())\n    }\n\n    /**\n     Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message.\n\n     - seealso: [empty operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An observable sequence with no elements.\n     */\n    public static func empty() -> Completable {\n        Completable(raw: Observable.empty())\n    }\n\n}\n\nextension PrimitiveSequenceType where Trait == CompletableTrait, Element == Swift.Never {\n    /**\n     Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.\n     \n     - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html)\n     \n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter afterError: Action to invoke after errored termination of the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter afterCompleted: Action to invoke after graceful termination of the observable sequence.\n     - parameter onSubscribe: Action to invoke before subscribing to source observable sequence.\n     - parameter onSubscribed: Action to invoke after subscribing to source observable sequence.\n     - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.\n     - returns: The source sequence with the side-effecting behavior applied.\n     */\n    public func `do`(onError: ((Swift.Error) throws -> Void)? = nil,\n                     afterError: ((Swift.Error) throws -> Void)? = nil,\n                     onCompleted: (() throws -> Void)? = nil,\n                     afterCompleted: (() throws -> Void)? = nil,\n                     onSubscribe: (() -> Void)? = nil,\n                     onSubscribed: (() -> Void)? = nil,\n                     onDispose: (() -> Void)? = nil)\n        -> Completable {\n            return Completable(raw: self.primitiveSequence.source.do(\n                onError: onError,\n                afterError: afterError,\n                onCompleted: onCompleted,\n                afterCompleted: afterCompleted,\n                onSubscribe: onSubscribe,\n                onSubscribed: onSubscribed,\n                onDispose: onDispose)\n            )\n    }\n\n\n\n    /**\n     Concatenates the second observable sequence to `self` upon successful termination of `self`.\n     \n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n     \n     - parameter second: Second observable sequence.\n     - returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.\n     */\n    public func concat(_ second: Completable) -> Completable {\n        Completable.concat(self.primitiveSequence, second)\n    }\n    \n    /**\n     Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.\n     \n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n     \n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Sequence: Swift.Sequence>(_ sequence: Sequence) -> Completable\n        where Sequence.Element == Completable {\n            let source = Observable.concat(sequence.lazy.map { $0.asObservable() })\n            return Completable(raw: source)\n    }\n    \n    /**\n     Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.\n     \n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n     \n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat<Collection: Swift.Collection>(_ collection: Collection) -> Completable\n        where Collection.Element == Completable {\n            let source = Observable.concat(collection.map { $0.asObservable() })\n            return Completable(raw: source)\n    }\n    \n    /**\n     Concatenates all observable sequences in the given sequence, as long as the previous observable sequence terminated successfully.\n     \n     - seealso: [concat operator on reactivex.io](http://reactivex.io/documentation/operators/concat.html)\n     \n     - returns: An observable sequence that contains the elements of each given sequence, in sequential order.\n     */\n    public static func concat(_ sources: Completable ...) -> Completable {\n        let source = Observable.concat(sources.map { $0.asObservable() })\n        return Completable(raw: source)\n    }\n\n    /**\n     Merges the completion of all Completables from a collection into a single Completable.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n     - note: For `Completable`, `zip` is an alias for `merge`.\n\n     - parameter sources: Collection of Completables to merge.\n     - returns: A Completable that merges the completion of all Completables.\n     */\n    public static func zip<Collection: Swift.Collection>(_ sources: Collection) -> Completable\n           where Collection.Element == Completable {\n        let source = Observable.merge(sources.map { $0.asObservable() })\n        return Completable(raw: source)\n    }\n\n    /**\n     Merges the completion of all Completables from an array into a single Completable.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n     - note: For `Completable`, `zip` is an alias for `merge`.\n\n     - parameter sources: Array of observable sequences to merge.\n     - returns: A Completable that merges the completion of all Completables.\n     */\n    public static func zip(_ sources: [Completable]) -> Completable {\n        let source = Observable.merge(sources.map { $0.asObservable() })\n        return Completable(raw: source)\n    }\n\n    /**\n     Merges the completion of all Completables into a single Completable.\n\n     - seealso: [merge operator on reactivex.io](http://reactivex.io/documentation/operators/merge.html)\n     - note: For `Completable`, `zip` is an alias for `merge`.\n\n     - parameter sources: Collection of observable sequences to merge.\n     - returns: The observable sequence that merges the elements of the observable sequences.\n     */\n    public static func zip(_ sources: Completable...) -> Completable {\n        let source = Observable.merge(sources.map { $0.asObservable() })\n        return Completable(raw: source)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/Maybe.swift",
    "content": "//\n//  Maybe.swift\n//  RxSwift\n//\n//  Created by sergdort on 19/08/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if DEBUG\nimport Foundation\n#endif\n\n/// Sequence containing 0 or 1 elements\npublic enum MaybeTrait { }\n/// Represents a push style sequence containing 0 or 1 element.\npublic typealias Maybe<Element> = PrimitiveSequence<MaybeTrait, Element>\n\n@frozen public enum MaybeEvent<Element> {\n    /// One and only sequence element is produced. (underlying observable sequence emits: `.next(Element)`, `.completed`)\n    case success(Element)\n    \n    /// Sequence terminated with an error. (underlying observable sequence emits: `.error(Error)`)\n    case error(Swift.Error)\n    \n    /// Sequence completed successfully.\n    case completed\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    public typealias MaybeObserver = (MaybeEvent<Element>) -> Void\n    \n    /**\n     Creates an observable sequence from a specified subscribe method implementation.\n     \n     - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html)\n     \n     - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method.\n     - returns: The observable sequence with the specified implementation for the `subscribe` method.\n     */\n    public static func create(subscribe: @escaping (@escaping MaybeObserver) -> Disposable) -> PrimitiveSequence<Trait, Element> {\n        let source = Observable<Element>.create { observer in\n            return subscribe { event in\n                switch event {\n                case .success(let element):\n                    observer.on(.next(element))\n                    observer.on(.completed)\n                case .error(let error):\n                    observer.on(.error(error))\n                case .completed:\n                    observer.on(.completed)\n                }\n            }\n        }\n        \n        return PrimitiveSequence(raw: source)\n    }\n    \n    /**\n     Subscribes `observer` to receive events for this sequence.\n     \n     - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources.\n     */\n    public func subscribe(_ observer: @escaping (MaybeEvent<Element>) -> Void) -> Disposable {\n        var stopped = false\n        return self.primitiveSequence.asObservable().subscribe { event in\n            if stopped { return }\n            stopped = true\n            \n            switch event {\n            case .next(let element):\n                observer(.success(element))\n            case .error(let error):\n                observer(.error(error))\n            case .completed:\n                observer(.completed)\n            }\n        }\n    }\n    \n    /**\n     Subscribes a success handler, an error handler, and a completion handler for this sequence.\n     \n     Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.\n     \n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n     - parameter object: The object to provide an unretained reference on.\n     - parameter onSuccess: Action to invoke for each element in the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe<Object: AnyObject>(\n        with object: Object,\n        onSuccess: ((Object, Element) -> Void)? = nil,\n        onError: ((Object, Swift.Error) -> Void)? = nil,\n        onCompleted: ((Object) -> Void)? = nil,\n        onDisposed: ((Object) -> Void)? = nil\n    ) -> Disposable {\n        subscribe(\n            onSuccess: { [weak object] in\n                guard let object = object else { return }\n                onSuccess?(object, $0)\n            },\n            onError: { [weak object] in\n                guard let object = object else { return }\n                onError?(object, $0)\n            },\n            onCompleted: { [weak object] in\n                guard let object = object else { return }\n                onCompleted?(object)\n            },\n            onDisposed: { [weak object] in\n                guard let object = object else { return }\n                onDisposed?(object)\n            }\n        )\n    }\n    \n    /**\n     Subscribes a success handler, an error handler, and a completion handler for this sequence.\n     \n     - parameter onSuccess: Action to invoke for each element in the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe(onSuccess: ((Element) -> Void)? = nil,\n                          onError: ((Swift.Error) -> Void)? = nil,\n                          onCompleted: (() -> Void)? = nil,\n                          onDisposed: (() -> Void)? = nil) -> Disposable {\n        #if DEBUG\n            let callStack = Hooks.recordCallStackOnError ? Thread.callStackSymbols : []\n        #else\n            let callStack = [String]()\n        #endif\n        let disposable: Disposable\n        if let onDisposed = onDisposed {\n            disposable = Disposables.create(with: onDisposed)\n        } else {\n            disposable = Disposables.create()\n        }\n\n        let observer: MaybeObserver = { event in\n            switch event {\n            case .success(let element):\n                onSuccess?(element)\n                disposable.dispose()\n            case .error(let error):\n                if let onError = onError {\n                    onError(error)\n                } else {\n                    Hooks.defaultErrorHandler(callStack, error)\n                }\n                disposable.dispose()\n            case .completed:\n                onCompleted?()\n                disposable.dispose()\n            }\n        }\n\n        return Disposables.create(\n            self.primitiveSequence.subscribe(observer),\n            disposable\n        )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n     Returns an observable sequence that contains a single element.\n     \n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n     \n     - parameter element: Single element in the resulting observable sequence.\n     - returns: An observable sequence containing the single specified element.\n     */\n    public static func just(_ element: Element) -> Maybe<Element> {\n        Maybe(raw: Observable.just(element))\n    }\n    \n    /**\n     Returns an observable sequence that contains a single element.\n     \n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n     \n     - parameter element: Single element in the resulting observable sequence.\n     - parameter scheduler: Scheduler to send the single element on.\n     - returns: An observable sequence containing the single specified element.\n     */\n    public static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Maybe<Element> {\n        Maybe(raw: Observable.just(element, scheduler: scheduler))\n    }\n\n    /**\n     Returns an observable sequence that terminates with an `error`.\n\n     - seealso: [throw operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: The observable sequence that terminates with specified error.\n     */\n    public static func error(_ error: Swift.Error) -> Maybe<Element> {\n        PrimitiveSequence(raw: Observable.error(error))\n    }\n\n    /**\n     Returns a non-terminating observable sequence, which can be used to denote an infinite duration.\n\n     - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An observable sequence whose observers will never get called.\n     */\n    public static func never() -> Maybe<Element> {\n        PrimitiveSequence(raw: Observable.never())\n    }\n\n    /**\n     Returns an empty observable sequence, using the specified scheduler to send out the single `Completed` message.\n\n     - seealso: [empty operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An observable sequence with no elements.\n     */\n    public static func empty() -> Maybe<Element> {\n        Maybe(raw: Observable.empty())\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n     Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.\n     \n     - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html)\n     \n     - parameter onNext: Action to invoke for each element in the observable sequence.\n     - parameter afterNext: Action to invoke for each element after the observable has passed an onNext event along to its downstream.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter afterError: Action to invoke after errored termination of the observable sequence.\n     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.\n     - parameter afterCompleted: Action to invoke after graceful termination of the observable sequence.\n     - parameter onSubscribe: Action to invoke before subscribing to source observable sequence.\n     - parameter onSubscribed: Action to invoke after subscribing to source observable sequence.\n     - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.\n     - returns: The source sequence with the side-effecting behavior applied.\n     */\n    public func `do`(onNext: ((Element) throws -> Void)? = nil,\n                     afterNext: ((Element) throws -> Void)? = nil,\n                     onError: ((Swift.Error) throws -> Void)? = nil,\n                     afterError: ((Swift.Error) throws -> Void)? = nil,\n                     onCompleted: (() throws -> Void)? = nil,\n                     afterCompleted: (() throws -> Void)? = nil,\n                     onSubscribe: (() -> Void)? = nil,\n                     onSubscribed: (() -> Void)? = nil,\n                     onDispose: (() -> Void)? = nil)\n        -> Maybe<Element> {\n            return Maybe(raw: self.primitiveSequence.source.do(\n                onNext: onNext,\n                afterNext: afterNext,\n                onError: onError,\n                afterError: afterError,\n                onCompleted: onCompleted,\n                afterCompleted: afterCompleted,\n                onSubscribe: onSubscribe,\n                onSubscribed: onSubscribed,\n                onDispose: onDispose)\n            )\n    }\n    \n    /**\n     Filters the elements of an observable sequence based on a predicate.\n     \n     - seealso: [filter operator on reactivex.io](http://reactivex.io/documentation/operators/filter.html)\n     \n     - parameter predicate: A function to test each source element for a condition.\n     - returns: An observable sequence that contains elements from the input sequence that satisfy the condition.\n     */\n    public func filter(_ predicate: @escaping (Element) throws -> Bool)\n        -> Maybe<Element> {\n            return Maybe(raw: self.primitiveSequence.source.filter(predicate))\n    }\n    \n    /**\n     Projects each element of an observable sequence into a new form.\n     \n     - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html)\n     \n     - parameter transform: A transform function to apply to each source element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.\n     \n     */\n    public func map<Result>(_ transform: @escaping (Element) throws -> Result)\n        -> Maybe<Result> {\n            return Maybe(raw: self.primitiveSequence.source.map(transform))\n    }\n\n    /**\n     Projects each element of an observable sequence into an optional form and filters all optional results.\n     \n     - parameter transform: A transform function to apply to each source element.\n     - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source.\n     \n     */\n    public func compactMap<Result>(_ transform: @escaping (Element) throws -> Result?)\n        -> Maybe<Result> {\n        Maybe(raw: self.primitiveSequence.source.compactMap(transform))\n    }\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n\n     - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.\n     */\n    public func flatMap<Result>(_ selector: @escaping (Element) throws -> Maybe<Result>)\n        -> Maybe<Result> {\n            return Maybe<Result>(raw: self.primitiveSequence.source.flatMap(selector))\n    }\n\n    /**\n     Emits elements from the source observable sequence, or a default element if the source observable sequence is empty.\n\n     - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html)\n\n     - parameter default: Default element to be sent if the source does not emit any elements\n     - returns: An observable sequence which emits default element end completes in case the original sequence is empty\n     */\n    public func ifEmpty(default: Element) -> Single<Element> {\n        Single(raw: self.primitiveSequence.source.ifEmpty(default: `default`))\n    }\n\n    /**\n     Returns the elements of the specified sequence or `other` sequence if the sequence is empty.\n\n     - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html)\n\n     - parameter other: Observable sequence being returned when source sequence is empty.\n     - returns: Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.\n     */\n    public func ifEmpty(switchTo other: Maybe<Element>) -> Maybe<Element> {\n        Maybe(raw: self.primitiveSequence.source.ifEmpty(switchTo: other.primitiveSequence.source))\n    }\n\n    /**\n     Returns the elements of the specified sequence or `other` sequence if the sequence is empty.\n\n     - seealso: [DefaultIfEmpty operator on reactivex.io](http://reactivex.io/documentation/operators/defaultifempty.html)\n\n     - parameter other: Observable sequence being returned when source sequence is empty.\n     - returns: Observable sequence that contains elements from switchTo sequence if source is empty, otherwise returns source sequence elements.\n     */\n    public func ifEmpty(switchTo other: Single<Element>) -> Single<Element> {\n        Single(raw: self.primitiveSequence.source.ifEmpty(switchTo: other.primitiveSequence.source))\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with a single element.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter element: Last element in an observable sequence in case error occurs.\n     - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred.\n     */\n    public func catchAndReturn(_ element: Element)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.primitiveSequence.source.catchAndReturn(element))\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with a single element.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter element: Last element in an observable sequence in case error occurs.\n     - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred.\n     */\n    @available(*, deprecated, renamed: \"catchAndReturn(_:)\")\n    public func catchErrorJustReturn(_ element: Element)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.primitiveSequence.source.catchAndReturn(element))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/ObservableType+PrimitiveSequence.swift",
    "content": "//\n//  ObservableType+PrimitiveSequence.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 9/17/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\nextension ObservableType {\n    /**\n     The `asSingle` operator throws a `RxError.noElements` or `RxError.moreThanOneElement`\n     if the source Observable does not emit exactly one element before successfully completing.\n\n     - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html)\n\n     - returns: An observable sequence that emits a single element when the source Observable has completed, or throws an exception if more (or none) of them are emitted.\n     */\n    public func asSingle() -> Single<Element> {\n        PrimitiveSequence(raw: AsSingle(source: self.asObservable()))\n    }\n    \n    /**\n     The `first` operator emits only the very first item emitted by this Observable,\n     or nil if this Observable completes without emitting anything.\n     \n     - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html)\n     \n     - returns: An observable sequence that emits a single element or nil if the source observable sequence completes without emitting any items.\n     */\n    public func first() -> Single<Element?> {\n        PrimitiveSequence(raw: First(source: self.asObservable()))\n    }\n\n    /**\n     The `asMaybe` operator throws a `RxError.moreThanOneElement`\n     if the source Observable does not emit at most one element before successfully completing.\n\n     - seealso: [single operator on reactivex.io](http://reactivex.io/documentation/operators/first.html)\n\n     - returns: An observable sequence that emits a single element, completes when the source Observable has completed, or throws an exception if more of them are emitted.\n     */\n    public func asMaybe() -> Maybe<Element> {\n        PrimitiveSequence(raw: AsMaybe(source: self.asObservable()))\n    }\n}\n\nextension ObservableType where Element == Never {\n    /**\n     - returns: An observable sequence that completes.\n     */\n    public func asCompletable()\n        -> Completable {\n            return PrimitiveSequence(raw: self.asObservable())\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/PrimitiveSequence+Concurrency.swift",
    "content": "//\n//  PrimitiveSequence+Concurrency.swift\n//  RxSwift\n//\n//  Created by Shai Mishali on 22/09/2021.\n//  Copyright © 2021 Krunoslav Zaher. All rights reserved.\n//\n\nimport Foundation\n\n#if swift(>=5.5.2) && canImport(_Concurrency) && !os(Linux)\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic extension PrimitiveSequenceType where Trait == SingleTrait {\n    /// Allows awaiting the success or failure of this `Single`\n    /// asynchronously via Swift's concurrency features (`async/await`)\n    ///\n    /// A sample usage would look like so:\n    ///\n    /// ```swift\n    /// do {\n    ///     let value = try await single.value\n    /// } catch {\n    ///     // Handle error\n    /// }\n    /// ```\n    var value: Element {\n        get async throws {\n            let disposable = SingleAssignmentDisposable()\n            return try await withTaskCancellationHandler(\n                operation: {\n                    try await withCheckedThrowingContinuation { continuation in\n                        disposable.setDisposable(\n                            self.subscribe(\n                                onSuccess: { continuation.resume(returning: $0) },\n                                onFailure: { continuation.resume(throwing: $0) }\n                            )\n                        )\n                    }\n                },\n                onCancel: { [disposable] in\n                    disposable.dispose()\n                }\n            )\n        }\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic extension PrimitiveSequenceType where Trait == MaybeTrait {\n    /// Allows awaiting the success or failure of this `Maybe`\n    /// asynchronously via Swift's concurrency features (`async/await`)\n    ///\n    /// If the `Maybe` completes without emitting a value, it would return\n    /// a `nil` value to indicate so.\n    ///\n    /// A sample usage would look like so:\n    ///\n    /// ```swift\n    /// do {\n    ///     let value = try await maybe.value // Element?\n    /// } catch {\n    ///     // Handle error\n    /// }\n    /// ```\n    var value: Element? {\n        get async throws {\n            let disposable = SingleAssignmentDisposable()\n            return try await withTaskCancellationHandler(\n                operation: {\n                    try await withCheckedThrowingContinuation { continuation in\n                        var didEmit = false\n                        disposable.setDisposable(\n                            self.subscribe(\n                                onSuccess: { value in\n                                    didEmit = true\n                                    continuation.resume(returning: value)\n                                },\n                                onError: { error in continuation.resume(throwing: error) },\n                                onCompleted: {\n                                    guard !didEmit else { return }\n                                    continuation.resume(returning: nil)\n                                }\n                            )\n                        )\n                    }\n                },\n                onCancel: { [disposable] in\n                    disposable.dispose()\n                }\n            )\n        }\n    }\n}\n\n@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)\npublic extension PrimitiveSequenceType where Trait == CompletableTrait, Element == Never {\n    /// Allows awaiting the success or failure of this `Completable`\n    /// asynchronously via Swift's concurrency features (`async/await`)\n    ///\n    /// Upon completion, a `Void` will be returned\n    ///\n    /// A sample usage would look like so:\n    ///\n    /// ```swift\n    /// do {\n    ///     let value = try await completable.value // Void\n    /// } catch {\n    ///     // Handle error\n    /// }\n    /// ```\n    var value: Void {\n        get async throws {\n            let disposable = SingleAssignmentDisposable()\n            return try await withTaskCancellationHandler(\n                operation: {\n                    try await withCheckedThrowingContinuation { continuation in\n                        disposable.setDisposable(\n                            self.subscribe(\n                                onCompleted: { continuation.resume() },\n                                onError: { error in continuation.resume(throwing: error) }\n                            )\n                        )\n                    }\n                },\n                onCancel: { [disposable] in\n                    disposable.dispose()\n                }\n            )\n        }\n    }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/PrimitiveSequence+Zip+arity.swift",
    "content": "// This file is autogenerated. Take a look at `Preprocessor` target in RxSwift project \n//\n//  PrimitiveSequence+Zip+arity.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 5/23/15.\n//  Copyright © 2015 Krunoslav Zaher. All rights reserved.\n//\n\n\n\n// 2\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>)\n        -> PrimitiveSequence<Trait, (E1, E2)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable())\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, resultSelector: @escaping (E1, E2) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>)\n        -> PrimitiveSequence<Trait, (E1, E2)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable())\n            )\n    }\n}\n\n\n\n\n// 3\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable())\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, resultSelector: @escaping (E1, E2, E3) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable())\n            )\n    }\n}\n\n\n\n\n// 4\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable())\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, resultSelector: @escaping (E1, E2, E3, E4) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable())\n            )\n    }\n}\n\n\n\n\n// 5\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable())\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, resultSelector: @escaping (E1, E2, E3, E4, E5) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable())\n            )\n    }\n}\n\n\n\n\n// 6\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable())\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable())\n            )\n    }\n}\n\n\n\n\n// 7\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable())\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable())\n            )\n    }\n}\n\n\n\n\n// 8\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(), source8.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == SingleTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7, E8)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(), source8.asObservable())\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>, resultSelector: @escaping (E1, E2, E3, E4, E5, E6, E7, E8) throws -> Element)\n        -> PrimitiveSequence<Trait, Element> {\n            return PrimitiveSequence(raw: Observable.zip(\n            source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(), source8.asObservable(),\n                resultSelector: resultSelector)\n            )\n    }\n}\n\nextension PrimitiveSequenceType where Element == Any, Trait == MaybeTrait {\n    /**\n    Merges the specified observable sequences into one observable sequence of tuples whenever all of the observable sequences have produced an element at a corresponding index.\n\n    - seealso: [zip operator on reactivex.io](http://reactivex.io/documentation/operators/zip.html)\n\n    - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n    */\n    public static func zip<E1, E2, E3, E4, E5, E6, E7, E8>(_ source1: PrimitiveSequence<Trait, E1>, _ source2: PrimitiveSequence<Trait, E2>, _ source3: PrimitiveSequence<Trait, E3>, _ source4: PrimitiveSequence<Trait, E4>, _ source5: PrimitiveSequence<Trait, E5>, _ source6: PrimitiveSequence<Trait, E6>, _ source7: PrimitiveSequence<Trait, E7>, _ source8: PrimitiveSequence<Trait, E8>)\n        -> PrimitiveSequence<Trait, (E1, E2, E3, E4, E5, E6, E7, E8)> {\n        return PrimitiveSequence(raw: Observable.zip(\n                source1.asObservable(), source2.asObservable(), source3.asObservable(), source4.asObservable(), source5.asObservable(), source6.asObservable(), source7.asObservable(), source8.asObservable())\n            )\n    }\n}\n\n\n\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/PrimitiveSequence.swift",
    "content": "//\n//  PrimitiveSequence.swift\n//  RxSwift\n//\n//  Created by Krunoslav Zaher on 3/5/17.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n/// Observable sequences containing 0 or 1 element.\npublic struct PrimitiveSequence<Trait, Element> {\n    let source: Observable<Element>\n\n    init(raw: Observable<Element>) {\n        self.source = raw\n    }\n}\n\n/// Observable sequences containing 0 or 1 element\npublic protocol PrimitiveSequenceType {\n    /// Additional constraints\n    associatedtype Trait\n\n    /// Sequence element type\n    associatedtype Element\n\n    // Converts `self` to primitive sequence.\n    ///\n    /// - returns: Observable sequence that represents `self`.\n    var primitiveSequence: PrimitiveSequence<Trait, Element> { get }\n}\n\nextension PrimitiveSequence: PrimitiveSequenceType {\n    // Converts `self` to primitive sequence.\n    ///\n    /// - returns: Observable sequence that represents `self`.\n    public var primitiveSequence: PrimitiveSequence<Trait, Element> {\n        self\n    }\n}\n\nextension PrimitiveSequence: ObservableConvertibleType {\n    /// Converts `self` to `Observable` sequence.\n    ///\n    /// - returns: Observable sequence that represents `self`.\n    public func asObservable() -> Observable<Element> {\n        self.source\n    }\n}\n\nextension PrimitiveSequence {\n    /**\n     Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.\n\n     - seealso: [defer operator on reactivex.io](http://reactivex.io/documentation/operators/defer.html)\n\n     - parameter observableFactory: Observable factory function to invoke for each observer that subscribes to the resulting sequence.\n     - returns: An observable sequence whose observers trigger an invocation of the given observable factory function.\n     */\n    public static func deferred(_ observableFactory: @escaping () throws -> PrimitiveSequence<Trait, Element>)\n        -> PrimitiveSequence<Trait, Element> {\n        return PrimitiveSequence(raw: Observable.deferred {\n            try observableFactory().asObservable()\n        })\n    }\n\n    /**\n     Returns an observable sequence by the source observable sequence shifted forward in time by a specified delay. Error events from the source observable sequence are not delayed.\n\n     - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html)\n\n     - parameter dueTime: Relative time shift of the source by.\n     - parameter scheduler: Scheduler to run the subscription delay timer on.\n     - returns: the source Observable shifted in time by the specified delay.\n     */\n    public func delay(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.primitiveSequence.source.delay(dueTime, scheduler: scheduler))\n    }\n\n    /**\n     Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.\n\n     - seealso: [delay operator on reactivex.io](http://reactivex.io/documentation/operators/delay.html)\n\n     - parameter dueTime: Relative time shift of the subscription.\n     - parameter scheduler: Scheduler to run the subscription delay timer on.\n     - returns: Time-shifted sequence.\n     */\n    public func delaySubscription(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.delaySubscription(dueTime, scheduler: scheduler))\n    }\n    \n    /**\n     Wraps the source sequence in order to run its observer callbacks on the specified scheduler.\n\n     This only invokes observer callbacks on a `scheduler`. In case the subscription and/or unsubscription\n     actions have side-effects that require to be run on a scheduler, use `subscribeOn`.\n\n     - seealso: [observeOn operator on reactivex.io](http://reactivex.io/documentation/operators/observeon.html)\n\n     - parameter scheduler: Scheduler to notify observers on.\n     - returns: The source sequence whose observations happen on the specified scheduler.\n     */\n    public func observe(on scheduler: ImmediateSchedulerType)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.observe(on: scheduler))\n    }\n\n    /**\n     Wraps the source sequence in order to run its observer callbacks on the specified scheduler.\n\n     This only invokes observer callbacks on a `scheduler`. In case the subscription and/or unsubscription\n     actions have side-effects that require to be run on a scheduler, use `subscribeOn`.\n\n     - seealso: [observeOn operator on reactivex.io](http://reactivex.io/documentation/operators/observeon.html)\n\n     - parameter scheduler: Scheduler to notify observers on.\n     - returns: The source sequence whose observations happen on the specified scheduler.\n     */\n    @available(*, deprecated, renamed: \"observe(on:)\")\n    public func observeOn(_ scheduler: ImmediateSchedulerType)\n        -> PrimitiveSequence<Trait, Element> {\n        observe(on: scheduler)\n    }\n\n    /**\n    Wraps the source sequence in order to run its subscription and unsubscription logic on the specified \n    scheduler. \n    \n    This operation is not commonly used.\n    \n    This only performs the side-effects of subscription and unsubscription on the specified scheduler. \n    \n    In order to invoke observer callbacks on a `scheduler`, use `observeOn`.\n\n    - seealso: [subscribeOn operator on reactivex.io](http://reactivex.io/documentation/operators/subscribeon.html)\n    \n    - parameter scheduler: Scheduler to perform subscription and unsubscription actions on.\n    - returns: The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.\n    */\n    public func subscribe(on scheduler: ImmediateSchedulerType)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.subscribe(on: scheduler))\n    }\n\n    /**\n    Wraps the source sequence in order to run its subscription and unsubscription logic on the specified\n    scheduler.\n\n    This operation is not commonly used.\n\n    This only performs the side-effects of subscription and unsubscription on the specified scheduler.\n\n    In order to invoke observer callbacks on a `scheduler`, use `observeOn`.\n\n    - seealso: [subscribeOn operator on reactivex.io](http://reactivex.io/documentation/operators/subscribeon.html)\n\n    - parameter scheduler: Scheduler to perform subscription and unsubscription actions on.\n    - returns: The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.\n    */\n    @available(*, deprecated, renamed: \"subscribe(on:)\")\n    public func subscribeOn(_ scheduler: ImmediateSchedulerType)\n        -> PrimitiveSequence<Trait, Element> {\n        subscribe(on: scheduler)\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter handler: Error handler function, producing another observable sequence.\n     - returns: An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an error occurred.\n     */\n    @available(*, deprecated, renamed: \"catch(_:)\")\n    public func catchError(_ handler: @escaping (Swift.Error) throws -> PrimitiveSequence<Trait, Element>)\n        -> PrimitiveSequence<Trait, Element> {\n        `catch`(handler)\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with the observable sequence produced by the handler.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter handler: Error handler function, producing another observable sequence.\n     - returns: An observable sequence containing the source sequence's elements, followed by the elements produced by the handler's resulting observable sequence in case an error occurred.\n     */\n    public func `catch`(_ handler: @escaping (Swift.Error) throws -> PrimitiveSequence<Trait, Element>)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.catch { try handler($0).asObservable() })\n    }\n\n    /**\n     If the initial subscription to the observable sequence emits an error event, try repeating it up to the specified number of attempts (inclusive of the initial attempt) or until is succeeds. For example, if you want to retry a sequence once upon failure, you should use retry(2) (once for the initial attempt, and once for the retry).\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter maxAttemptCount: Maximum number of times to attempt the sequence subscription.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.\n     */\n    public func retry(_ maxAttemptCount: Int)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.retry(maxAttemptCount))\n    }\n\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    public func retry<TriggerObservable: ObservableType, Error: Swift.Error>(when notificationHandler: @escaping (Observable<Error>) -> TriggerObservable)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.retry(when: notificationHandler))\n    }\n\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    @available(*, deprecated, renamed: \"retry(when:)\")\n    public func retryWhen<TriggerObservable: ObservableType, Error: Swift.Error>(_ notificationHandler: @escaping (Observable<Error>) -> TriggerObservable)\n        -> PrimitiveSequence<Trait, Element> {\n        retry(when: notificationHandler)\n    }\n\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    public func retry<TriggerObservable: ObservableType>(when notificationHandler: @escaping (Observable<Swift.Error>) -> TriggerObservable)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.retry(when: notificationHandler))\n    }\n\n    /**\n     Repeats the source observable sequence on error when the notifier emits a next value.\n     If the source observable errors and the notifier completes, it will complete the source sequence.\n\n     - seealso: [retry operator on reactivex.io](http://reactivex.io/documentation/operators/retry.html)\n\n     - parameter notificationHandler: A handler that is passed an observable sequence of errors raised by the source observable and returns and observable that either continues, completes or errors. This behavior is then applied to the source observable.\n     - returns: An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully or is notified to error or complete.\n     */\n    @available(*, deprecated, renamed: \"retry(when:)\")\n    public func retryWhen<TriggerObservable: ObservableType>(_ notificationHandler: @escaping (Observable<Swift.Error>) -> TriggerObservable)\n        -> PrimitiveSequence<Trait, Element> {\n        retry(when: notificationHandler)\n    }\n\n    /**\n     Prints received events for all observers on standard output.\n\n     - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html)\n\n     - parameter identifier: Identifier that is printed together with event description to standard output.\n     - parameter trimOutput: Should output be trimmed to max 40 characters.\n     - returns: An observable sequence whose events are printed to standard output.\n     */\n    public func debug(_ identifier: String? = nil, trimOutput: Bool = false, file: String = #file, line: UInt = #line, function: String = #function)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.source.debug(identifier, trimOutput: trimOutput, file: file, line: line, function: function))\n    }\n    \n    /**\n     Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.\n     \n     - seealso: [using operator on reactivex.io](http://reactivex.io/documentation/operators/using.html)\n     \n     - parameter resourceFactory: Factory function to obtain a resource object.\n     - parameter primitiveSequenceFactory: Factory function to obtain an observable sequence that depends on the obtained resource.\n     - returns: An observable sequence whose lifetime controls the lifetime of the dependent resource object.\n     */\n    public static func using<Resource: Disposable>(_ resourceFactory: @escaping () throws -> Resource, primitiveSequenceFactory: @escaping (Resource) throws -> PrimitiveSequence<Trait, Element>)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: Observable.using(resourceFactory, observableFactory: { (resource: Resource) throws -> Observable<Element> in\n            return try primitiveSequenceFactory(resource).asObservable()\n        }))\n    }\n\n    /**\n     Applies a timeout policy for each element in the observable sequence. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutError is propagated to the observer.\n     \n     - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html)\n     \n     - parameter dueTime: Maximum duration between values before a timeout occurs.\n     - parameter scheduler: Scheduler to run the timeout timer on.\n     - returns: An observable sequence with a `RxError.timeout` in case of a timeout.\n     */\n    public func timeout(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence<Trait, Element>(raw: self.primitiveSequence.source.timeout(dueTime, scheduler: scheduler))\n    }\n    \n    /**\n     Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.\n     \n     - seealso: [timeout operator on reactivex.io](http://reactivex.io/documentation/operators/timeout.html)\n     \n     - parameter dueTime: Maximum duration between values before a timeout occurs.\n     - parameter other: Sequence to return in case of a timeout.\n     - parameter scheduler: Scheduler to run the timeout timer on.\n     - returns: The source sequence switching to the other sequence in case of a timeout.\n     */\n    public func timeout(_ dueTime: RxTimeInterval,\n                        other: PrimitiveSequence<Trait, Element>,\n                        scheduler: SchedulerType) -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence<Trait, Element>(raw: self.primitiveSequence.source.timeout(dueTime, other: other.source, scheduler: scheduler))\n    }\n}\n\nextension PrimitiveSequenceType where Element: RxAbstractInteger\n{\n    /**\n     Returns an observable sequence that periodically produces a value after the specified initial relative due time has elapsed, using the specified scheduler to run timers.\n\n     - seealso: [timer operator on reactivex.io](http://reactivex.io/documentation/operators/timer.html)\n\n     - parameter dueTime: Relative time at which to produce the first value.\n     - parameter scheduler: Scheduler to run timers on.\n     - returns: An observable sequence that produces a value after due time has elapsed and then each period.\n     */\n    public static func timer(_ dueTime: RxTimeInterval, scheduler: SchedulerType)\n        -> PrimitiveSequence<Trait, Element>  {\n        PrimitiveSequence(raw: Observable<Element>.timer(dueTime, scheduler: scheduler))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift/RxSwift/Traits/PrimitiveSequence/Single.swift",
    "content": "//\n//  Single.swift\n//  RxSwift\n//\n//  Created by sergdort on 19/08/2017.\n//  Copyright © 2017 Krunoslav Zaher. All rights reserved.\n//\n\n#if DEBUG\nimport Foundation\n#endif\n\n/// Sequence containing exactly 1 element\npublic enum SingleTrait { }\n/// Represents a push style sequence containing 1 element.\npublic typealias Single<Element> = PrimitiveSequence<SingleTrait, Element>\npublic typealias SingleEvent<Element> = Result<Element, Swift.Error>\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    public typealias SingleObserver = (SingleEvent<Element>) -> Void\n    \n    /**\n     Creates an observable sequence from a specified subscribe method implementation.\n     \n     - seealso: [create operator on reactivex.io](http://reactivex.io/documentation/operators/create.html)\n     \n     - parameter subscribe: Implementation of the resulting observable sequence's `subscribe` method.\n     - returns: The observable sequence with the specified implementation for the `subscribe` method.\n     */\n    public static func create(subscribe: @escaping (@escaping SingleObserver) -> Disposable) -> Single<Element> {\n        let source = Observable<Element>.create { observer in\n            return subscribe { event in\n                switch event {\n                case .success(let element):\n                    observer.on(.next(element))\n                    observer.on(.completed)\n                case .failure(let error):\n                    observer.on(.error(error))\n                }\n            }\n        }\n        \n        return PrimitiveSequence(raw: source)\n    }\n    \n    /**\n     Subscribes `observer` to receive events for this sequence.\n     \n     - returns: Subscription for `observer` that can be used to cancel production of sequence elements and free resources.\n     */\n    public func subscribe(_ observer: @escaping (SingleEvent<Element>) -> Void) -> Disposable {\n        var stopped = false\n        return self.primitiveSequence.asObservable().subscribe { event in\n            if stopped { return }\n            stopped = true\n            \n            switch event {\n            case .next(let element):\n                observer(.success(element))\n            case .error(let error):\n                observer(.failure(error))\n            case .completed:\n                rxFatalErrorInDebug(\"Singles can't emit a completion event\")\n            }\n        }\n    }\n\n    /**\n     Subscribes a success handler, and an error handler for this sequence.\n\n     - parameter onSuccess: Action to invoke for each element in the observable sequence.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    @available(*, deprecated, renamed: \"subscribe(onSuccess:onFailure:onDisposed:)\")\n    public func subscribe(onSuccess: ((Element) -> Void)? = nil,\n                          onError: @escaping ((Swift.Error) -> Void),\n                          onDisposed: (() -> Void)? = nil) -> Disposable {\n        subscribe(onSuccess: onSuccess, onFailure: onError, onDisposed: onDisposed)\n    }\n    \n    /**\n     Subscribes a success handler, and an error handler for this sequence.\n     \n     Also, take in an object and provide an unretained, safe to use (i.e. not implicitly unwrapped), reference to it along with the events emitted by the sequence.\n     \n     - Note: If `object` can't be retained, none of the other closures will be invoked.\n     \n     - parameter object: The object to provide an unretained reference on.\n     - parameter onSuccess: Action to invoke for each element in the observable sequence.\n     - parameter onFailure: Action to invoke upon errored termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe<Object: AnyObject>(\n        with object: Object,\n        onSuccess: ((Object, Element) -> Void)? = nil,\n        onFailure: ((Object, Swift.Error) -> Void)? = nil,\n        onDisposed: ((Object) -> Void)? = nil\n    ) -> Disposable {\n        subscribe(\n            onSuccess: { [weak object] in\n                guard let object = object else { return }\n                onSuccess?(object, $0)\n            },\n            onFailure: { [weak object] in\n                guard let object = object else { return }\n                onFailure?(object, $0)\n            },\n            onDisposed: { [weak object] in\n                guard let object = object else { return }\n                onDisposed?(object)\n            }\n        )\n    }\n    \n    /**\n     Subscribes a success handler, and an error handler for this sequence.\n     \n     - parameter onSuccess: Action to invoke for each element in the observable sequence.\n     - parameter onFailure: Action to invoke upon errored termination of the observable sequence.\n     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has\n     gracefully completed, errored, or if the generation is canceled by disposing subscription).\n     - returns: Subscription object used to unsubscribe from the observable sequence.\n     */\n    public func subscribe(onSuccess: ((Element) -> Void)? = nil,\n                          onFailure: ((Swift.Error) -> Void)? = nil,\n                          onDisposed: (() -> Void)? = nil) -> Disposable {\n        #if DEBUG\n            let callStack = Hooks.recordCallStackOnError ? Thread.callStackSymbols : []\n        #else\n            let callStack = [String]()\n        #endif\n\n        let disposable: Disposable\n        if let onDisposed = onDisposed {\n            disposable = Disposables.create(with: onDisposed)\n        } else {\n            disposable = Disposables.create()\n        }\n\n        let observer: SingleObserver = { event in\n            switch event {\n            case .success(let element):\n                onSuccess?(element)\n                disposable.dispose()\n            case .failure(let error):\n                if let onFailure = onFailure {\n                    onFailure(error)\n                } else {\n                    Hooks.defaultErrorHandler(callStack, error)\n                }\n                disposable.dispose()\n            }\n        }\n\n        return Disposables.create(\n            self.primitiveSequence.subscribe(observer),\n            disposable\n        )\n    }\n}\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n    /**\n     Returns an observable sequence that contains a single element.\n     \n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n     \n     - parameter element: Single element in the resulting observable sequence.\n     - returns: An observable sequence containing the single specified element.\n     */\n    public static func just(_ element: Element) -> Single<Element> {\n        Single(raw: Observable.just(element))\n    }\n    \n    /**\n     Returns an observable sequence that contains a single element.\n     \n     - seealso: [just operator on reactivex.io](http://reactivex.io/documentation/operators/just.html)\n     \n     - parameter element: Single element in the resulting observable sequence.\n     - parameter scheduler: Scheduler to send the single element on.\n     - returns: An observable sequence containing the single specified element.\n     */\n    public static func just(_ element: Element, scheduler: ImmediateSchedulerType) -> Single<Element> {\n        Single(raw: Observable.just(element, scheduler: scheduler))\n    }\n\n    /**\n     Returns an observable sequence that terminates with an `error`.\n\n     - seealso: [throw operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: The observable sequence that terminates with specified error.\n     */\n    public static func error(_ error: Swift.Error) -> Single<Element> {\n        PrimitiveSequence(raw: Observable.error(error))\n    }\n\n    /**\n     Returns a non-terminating observable sequence, which can be used to denote an infinite duration.\n\n     - seealso: [never operator on reactivex.io](http://reactivex.io/documentation/operators/empty-never-throw.html)\n\n     - returns: An observable sequence whose observers will never get called.\n     */\n    public static func never() -> Single<Element> {\n        PrimitiveSequence(raw: Observable.never())\n    }\n}\n\nextension PrimitiveSequenceType where Trait == SingleTrait {\n\n    /**\n     Invokes an action for each event in the observable sequence, and propagates all observer messages through the result sequence.\n\n     - seealso: [do operator on reactivex.io](http://reactivex.io/documentation/operators/do.html)\n\n     - parameter onSuccess: Action to invoke for each element in the observable sequence.\n     - parameter afterSuccess: Action to invoke for each element after the observable has passed an onNext event along to its downstream.\n     - parameter onError: Action to invoke upon errored termination of the observable sequence.\n     - parameter afterError: Action to invoke after errored termination of the observable sequence.\n     - parameter onSubscribe: Action to invoke before subscribing to source observable sequence.\n     - parameter onSubscribed: Action to invoke after subscribing to source observable sequence.\n     - parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.\n     - returns: The source sequence with the side-effecting behavior applied.\n     */\n    public func `do`(onSuccess: ((Element) throws -> Void)? = nil,\n                     afterSuccess: ((Element) throws -> Void)? = nil,\n                     onError: ((Swift.Error) throws -> Void)? = nil,\n                     afterError: ((Swift.Error) throws -> Void)? = nil,\n                     onSubscribe: (() -> Void)? = nil,\n                     onSubscribed: (() -> Void)? = nil,\n                     onDispose: (() -> Void)? = nil)\n        -> Single<Element> {\n            return Single(raw: self.primitiveSequence.source.do(\n                onNext: onSuccess,\n                afterNext: afterSuccess,\n                onError: onError,\n                afterError: afterError,\n                onSubscribe: onSubscribe,\n                onSubscribed: onSubscribed,\n                onDispose: onDispose)\n            )\n    }\n\n    /**\n     Filters the elements of an observable sequence based on a predicate.\n     \n     - seealso: [filter operator on reactivex.io](http://reactivex.io/documentation/operators/filter.html)\n     \n     - parameter predicate: A function to test each source element for a condition.\n     - returns: An observable sequence that contains elements from the input sequence that satisfy the condition.\n     */\n    public func filter(_ predicate: @escaping (Element) throws -> Bool)\n        -> Maybe<Element> {\n            return Maybe(raw: self.primitiveSequence.source.filter(predicate))\n    }\n\n    /**\n     Projects each element of an observable sequence into a new form.\n     \n     - seealso: [map operator on reactivex.io](http://reactivex.io/documentation/operators/map.html)\n     \n     - parameter transform: A transform function to apply to each source element.\n     - returns: An observable sequence whose elements are the result of invoking the transform function on each element of source.\n     \n     */\n    public func map<Result>(_ transform: @escaping (Element) throws -> Result)\n        -> Single<Result> {\n            return Single(raw: self.primitiveSequence.source.map(transform))\n    }\n    \n    /**\n     Projects each element of an observable sequence into an optional form and filters all optional results.\n\n     - parameter transform: A transform function to apply to each source element.\n     - returns: An observable sequence whose elements are the result of filtering the transform function for each element of the source.\n\n     */\n    public func compactMap<Result>(_ transform: @escaping (Element) throws -> Result?)\n        -> Maybe<Result> {\n        Maybe(raw: self.primitiveSequence.source.compactMap(transform))\n    }\n    \n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n     \n     - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n     \n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.\n     */\n    public func flatMap<Result>(_ selector: @escaping (Element) throws -> Single<Result>)\n        -> Single<Result> {\n            return Single<Result>(raw: self.primitiveSequence.source.flatMap(selector))\n    }\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n\n     - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.\n     */\n    public func flatMapMaybe<Result>(_ selector: @escaping (Element) throws -> Maybe<Result>)\n        -> Maybe<Result> {\n            return Maybe<Result>(raw: self.primitiveSequence.source.flatMap(selector))\n    }\n\n    /**\n     Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.\n\n     - seealso: [flatMap operator on reactivex.io](http://reactivex.io/documentation/operators/flatmap.html)\n\n     - parameter selector: A transform function to apply to each element.\n     - returns: An observable sequence whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.\n     */\n    public func flatMapCompletable(_ selector: @escaping (Element) throws -> Completable)\n        -> Completable {\n            return Completable(raw: self.primitiveSequence.source.flatMap(selector))\n    }\n\n    /**\n     Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.\n     \n     - parameter resultSelector: Function to invoke for each series of elements at corresponding indexes in the sources.\n     - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.\n     */\n    public static func zip<Collection: Swift.Collection, Result>(_ collection: Collection, resultSelector: @escaping ([Element]) throws -> Result) -> PrimitiveSequence<Trait, Result> where Collection.Element == PrimitiveSequence<Trait, Element> {\n        \n        if collection.isEmpty {\n            return PrimitiveSequence<Trait, Result>.deferred {\n                return PrimitiveSequence<Trait, Result>(raw: .just(try resultSelector([])))\n            }\n        }\n        \n        let raw = Observable.zip(collection.map { $0.asObservable() }, resultSelector: resultSelector)\n        return PrimitiveSequence<Trait, Result>(raw: raw)\n    }\n    \n    /**\n     Merges the specified observable sequences into one observable sequence all of the observable sequences have produced an element at a corresponding index.\n     \n     - returns: An observable sequence containing the result of combining elements of the sources.\n     */\n    public static func zip<Collection: Swift.Collection>(_ collection: Collection) -> PrimitiveSequence<Trait, [Element]> where Collection.Element == PrimitiveSequence<Trait, Element> {\n        \n        if collection.isEmpty {\n            return PrimitiveSequence<Trait, [Element]>(raw: .just([]))\n        }\n        \n        let raw = Observable.zip(collection.map { $0.asObservable() })\n        return PrimitiveSequence(raw: raw)\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with a single element.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter element: Last element in an observable sequence in case error occurs.\n     - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred.\n     */\n    public func catchAndReturn(_ element: Element)\n        -> PrimitiveSequence<Trait, Element> {\n        PrimitiveSequence(raw: self.primitiveSequence.source.catchAndReturn(element))\n    }\n\n    /**\n     Continues an observable sequence that is terminated by an error with a single element.\n\n     - seealso: [catch operator on reactivex.io](http://reactivex.io/documentation/operators/catch.html)\n\n     - parameter element: Last element in an observable sequence in case error occurs.\n     - returns: An observable sequence containing the source sequence's elements, followed by the `element` in case an error occurred.\n     */\n    @available(*, deprecated, renamed: \"catchAndReturn(_:)\")\n    public func catchErrorJustReturn(_ element: Element)\n        -> PrimitiveSequence<Trait, Element> {\n        catchAndReturn(element)\n    }\n\n    /// Converts `self` to `Maybe` trait.\n    ///\n    /// - returns: Maybe trait that represents `self`.\n    public func asMaybe() -> Maybe<Element> {\n        Maybe(raw: self.primitiveSequence.source)\n    }\n\n    /// Converts `self` to `Completable` trait, ignoring its emitted value if\n    /// one exists.\n    /// \n    /// - returns: Completable trait that represents `self`.\n    public func asCompletable() -> Completable {\n        self.primitiveSequence.source.ignoreElements().asCompletable()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxSwift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t019899346ED81F4573AB0A3CB9164641 /* Completable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8FA35ED041E0D556064480FF0E51D65 /* Completable.swift */; };\n\t\t01D23591462DC8DCA05ED97B49994B1B /* Single.swift in Sources */ = {isa = PBXBuildFile; fileRef = 913D1D51B63C727D0A5FB1BD77C85F67 /* Single.swift */; };\n\t\t06F6E04B59CEC84DF49096AFAD86C6BD /* Catch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F8CCF0158ADFB1892D235AF948937B2 /* Catch.swift */; };\n\t\t086C1BBC078D07B513726C29DDBE89F9 /* AtomicInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9222A770791B2EBB102465A7E7EB00AA /* AtomicInt.swift */; };\n\t\t08F9C51060FD0A28DA37E280FC64CE4F /* PublishSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4A0868043C5BC77A2DC222B14ACE05F /* PublishSubject.swift */; };\n\t\t0A5318AC866A98385F0B8A7C0C94708F /* Multicast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 828FC8A5C5DFA8382BDB5EC7088E1A79 /* Multicast.swift */; };\n\t\t0D4FF0B01DDB04ACD457A6152F318AF6 /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6624BA1515ABF8CBB8CBD382A5BE4B8D /* ObservableType+Extensions.swift */; };\n\t\t0F1EEEA275F08A0D52A234619B8BE11D /* RefCountDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85D3377D4F6DE195E50C7981252107B0 /* RefCountDisposable.swift */; };\n\t\t11C8A9F94E68A9809D20916C96CCDDF6 /* Zip+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 457B0DB19F96A3FE26CD903EBE32B403 /* Zip+Collection.swift */; };\n\t\t11DF514DCC5B5D1E9D743195039D3C5D /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372CA74FD5FB927C23DFD0B1B89F9627 /* Platform.Linux.swift */; };\n\t\t12CF9C56FDFA0DBA916C91E7DE791632 /* InvocableScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86A3B69C60B1415D7EFACB4AC87FC192 /* InvocableScheduledItem.swift */; };\n\t\t134077B0292900713522F8CB9A61E18F /* SubscribeOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72EAB741B4B06EC3D025B47CD68FB644 /* SubscribeOn.swift */; };\n\t\t1452D00AF7A9643A2EEFBFA29FA4E749 /* Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = E095558419F15445B00EDE173B85AE0F /* Zip+arity.swift */; };\n\t\t15E713F4897AA101FA1E6570FD594701 /* ObserverBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5F7EF697C4A6F030C2755C0A53E5C9B /* ObserverBase.swift */; };\n\t\t1A8A1A8CA78D0CBE9F8FFDE4A8C9C6DB /* TailRecursiveSink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C0718AB8BFF75B7A4153E4BEA44C36 /* TailRecursiveSink.swift */; };\n\t\t1B6D0B5C8D50557BA362EADF160B031A /* WithLatestFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FC57D0F69947131B322E3F163DB445B /* WithLatestFrom.swift */; };\n\t\t1C84AE9CF71E774F7374B3F9344E7CE2 /* CompositeDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E52DF9943C3CF80D78E2C8A12114B1D /* CompositeDisposable.swift */; };\n\t\t226F2EADEC4AF7F6B2FE8EF31D5CC02B /* CurrentThreadScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF014BB7B837F2A81B6F32487F5FB98D /* CurrentThreadScheduler.swift */; };\n\t\t22E660E81CD084696CECA5522D13727B /* First.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14A6DEDFBF8EA2AFBD4724D73EBB2F54 /* First.swift */; };\n\t\t24C24E8FA042FB69CB26B0DAC7FB5AC4 /* Scan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F2B494CA299B8E5BDF7CF902C097F9E /* Scan.swift */; };\n\t\t26309E380687E17AC365A969B0D40273 /* HistoricalSchedulerTimeConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1BCB3E7FD05766A7A410C999DDA2CC4 /* HistoricalSchedulerTimeConverter.swift */; };\n\t\t298E4BD1F88890FB0308EFC735894E65 /* Take.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9358CE4DA5674AC8E0C904B7DD9BACA /* Take.swift */; };\n\t\t2CADB9CEDFCBFB51298A0F180F528943 /* Timer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5958FB9316312650DBBF3B8684DE5FC /* Timer.swift */; };\n\t\t2D77F6B3727F5ADDE2C04D7981DFCF75 /* Buffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A65C9BEDF5D76BA130F41A6E0619B82 /* Buffer.swift */; };\n\t\t2E01EA4D665B4681E6635D79C8582ECF /* Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = E65257A733C08F50E16495A11737ADE2 /* Reactive.swift */; };\n\t\t31B23D9E34F65F2463991217F0485921 /* SchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF02F4A025996FB90BDE36031387D29C /* SchedulerType.swift */; };\n\t\t3296D977065426CC53BE9CEAF947D9A5 /* AnyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07B901C7C7FE3E251B080B57F2186907 /* AnyObserver.swift */; };\n\t\t339EA339C67B8CB4875EB0892A941443 /* SynchronizedUnsubscribeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB98FFD5D7C9C835CE062EE655DF4FF /* SynchronizedUnsubscribeType.swift */; };\n\t\t35B80F5760F79B7C4D9E593278D9BD1B /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D6C8DA37ACBFE46CF8E3B98E83E670C /* Switch.swift */; };\n\t\t35BC9E8D1C55A8E930A903F826C4A1C2 /* Sample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3331A80D8160095B9EDEFC659E7754 /* Sample.swift */; };\n\t\t35DC586B423CD703AA701A9649FF0633 /* Producer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926380597C801B4D05BD2B6EB67076F2 /* Producer.swift */; };\n\t\t36C8E03F40EBD1C1880DDAB95AE8988C /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28C911648408A33BE68A8A86F500E252 /* Optional.swift */; };\n\t\t38C65444BAB2232F172CBBC24525C35C /* ConcurrentMainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B7B1820AAEFCC1DF667934F8D5878C8 /* ConcurrentMainScheduler.swift */; };\n\t\t3A21650F09CBE1831FBE721DD709DAB4 /* Do.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02B440482343D21BF37C8EEBFF1C5CCF /* Do.swift */; };\n\t\t3AC1693675796B9D7A50E41973010880 /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 229477D6AD01652D44329EF047E9F813 /* SerialDisposable.swift */; };\n\t\t3C40BCD846AADDBCCBB01616FB445AF1 /* Range.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C6DD2ADF4B543286BD0A7B6A9F276E5 /* Range.swift */; };\n\t\t415025D71F8F696591F7D53870F6EA94 /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = F872F299C26B9DCE1C0D4D7D53400F82 /* Debug.swift */; };\n\t\t448F492936311DE3E05537E381C61FF5 /* Bag+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EAFB5D698BAF410EA0A50B3EF3C00CC /* Bag+Rx.swift */; };\n\t\t45C2D1AD3375062D1CE4B7F8E560B3B3 /* AnonymousDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 486A3949E5E08734E696D1E9BA4D6533 /* AnonymousDisposable.swift */; };\n\t\t45D20960EB2637EC1FAC564070CF336F /* RetryWhen.swift in Sources */ = {isa = PBXBuildFile; fileRef = C54D2831DC496D0DA0DF322013C23A87 /* RetryWhen.swift */; };\n\t\t469D12FDE268569443CB5C411BFACA82 /* Infallible+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0994B7709A3D2EEA03A0D4DCDF6BB178 /* Infallible+Create.swift */; };\n\t\t46A5053A29A4FD58926A1BEDA0B8D3AD /* ShareReplayScope.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8461B706FB1B7DD05B108CEB6B1C02A /* ShareReplayScope.swift */; };\n\t\t4B8EB70E5745054F72981BA725C9F2AC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D365A1DD95A5D4823B5A11942ACFAF93 /* Foundation.framework */; };\n\t\t4BD9E57C387FADC64861F6BBB3A30F1F /* StartWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76FA635A597441CAA0DCEAA7A4FF9E78 /* StartWith.swift */; };\n\t\t5027A571126888B21246D3A9BBC28088 /* AddRef.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CB980246A808326790D6B75E838566B /* AddRef.swift */; };\n\t\t50A31073B25050C013DC785725DF0772 /* DefaultIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B30AC573953B7338EECF8DCF8AB35A2 /* DefaultIfEmpty.swift */; };\n\t\t51A88D948B5804E44439099BCAE259E5 /* Infallible+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE326FD053D97022078A0670611B80DE /* Infallible+Zip+arity.swift */; };\n\t\t52B63651434DA55AB2230B1D19C35427 /* Infallible+CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63821FDC18A5EE8FA3F8530585352985 /* Infallible+CombineLatest+arity.swift */; };\n\t\t536F4E505B9012C4AD4B28CD521C3864 /* ObservableConvertibleType+Infallible.swift in Sources */ = {isa = PBXBuildFile; fileRef = C30ABEF30D25A49558F4DB7F874E44E0 /* ObservableConvertibleType+Infallible.swift */; };\n\t\t5397DF98116AD476F64F1CE3C876543D /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7343FC62CEC5B0AA43516C7345D526E /* Window.swift */; };\n\t\t541014136DA36A7064B5360801EA4830 /* Zip.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3E935098718BDD834F8201C12FFE005 /* Zip.swift */; };\n\t\t55DB941880A7888D0D85A123A4ACEB36 /* SingleAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A6ABCE4C597827931B7D5EAE8C18320 /* SingleAsync.swift */; };\n\t\t59B3716B7858D01EED5D5AD6D8C2C066 /* SkipWhile.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3B5E1F7A06DBAB7D7F26E00F2B7EA4E /* SkipWhile.swift */; };\n\t\t5AECCC2F26C5416A07BA815AE796078A /* AsyncLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1A4713FCDEB763267971007195C371B /* AsyncLock.swift */; };\n\t\t5BEAC40580BF7DEEB6A307F347CB95EE /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48D36D1199BBD2CA605448FB2CDB1BF /* Queue.swift */; };\n\t\t5E1C27FBB6B685645BB7BE28EDC5C89B /* CombineLatest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 289E83EA0EF1D3AAA93257440FDC5918 /* CombineLatest.swift */; };\n\t\t5EF265759C85C51B8228988F276513EB /* Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE5A84CE200A385437C8F8D151C0869 /* Timeout.swift */; };\n\t\t60B5316B54B52B0C5F3613EEFFF8CFDC /* ToArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D00A92C852F00C01C83EEEEF8C50BB /* ToArray.swift */; };\n\t\t6141DA2718EFD0566161F137E9E383AB /* Skip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89FA2EB233EED406AE4DAC40D842114F /* Skip.swift */; };\n\t\t62073F8A252E95BB2BF39B613D8727D9 /* SynchronizedOnType.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFA533C6532962A65D4EB6FC48797D33 /* SynchronizedOnType.swift */; };\n\t\t64F6E1A1680D3E60922BD0F28EA478B5 /* Completable+AndThen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A85B3577056C6247942FEFE551B7AFE0 /* Completable+AndThen.swift */; };\n\t\t65094386D22629854948EC52D69789E0 /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D95852033081D88BF6D8548B3FCEFD /* InfiniteSequence.swift */; };\n\t\t66ADE60CF8751D8E4C023DBC99EE9539 /* BooleanDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCD786DFFF81BAED3FAB67FAC0504FE /* BooleanDisposable.swift */; };\n\t\t67A1EEDA861B8EE685AC8A4716DDB452 /* Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BB733E7338CFB2FF7F160BD58B2E80 /* Create.swift */; };\n\t\t67E17084FFCDAF493D1164AB257CDE0B /* SubscriptionDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EF78473CE368CE85C5F646CB7DE6565 /* SubscriptionDisposable.swift */; };\n\t\t67F5F394813F91FE77E158D18E174707 /* Infallible+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB2D836C515793F4DF34F0028F9B506 /* Infallible+Concurrency.swift */; };\n\t\t6B0C96BADD521DA546149F78B96301B3 /* ElementAt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF6669B25190FDAEDE27BAB84F55204 /* ElementAt.swift */; };\n\t\t6B1229194BEDA23C822398BD4894DF4A /* RecursiveScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB9A08FF569331BEA3DC8F74A0E9C754 /* RecursiveScheduler.swift */; };\n\t\t6CD422724978EA2A3C4320E5EF5FC2E3 /* AsMaybe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78929D3F60697CBF87C2D138E1DCD30C /* AsMaybe.swift */; };\n\t\t70C9D371469D596BC953B4775DA0925D /* Observable+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19D7AFDA7F12C74BF1051E4316D60C0E /* Observable+Concurrency.swift */; };\n\t\t75DCEFDC44FACFDE3AA8A5C9333A3122 /* Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D366BF46DE5636FCECC33A91A2A62D08 /* Rx.swift */; };\n\t\t76DE94A585B1FAD043685BACEF6C5B70 /* ObservableType+PrimitiveSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50B05E705380F7B6A47CD4F8B6C1302 /* ObservableType+PrimitiveSequence.swift */; };\n\t\t7957708121EE01B84D95175C76B1DECC /* Debounce.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76417CACF79AB959453A0A9D6D1FC459 /* Debounce.swift */; };\n\t\t799903397E2ADC779776577BAB2CCE20 /* Using.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC1F3BDEB131637148CBB1AFD176B938 /* Using.swift */; };\n\t\t7A2178301E7CAE10BDE76EB50C481068 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E1AE3E6B3C655AEF201B640CC018F1D /* Event.swift */; };\n\t\t7BB669D177397F639915B4B9EC29EF6E /* HistoricalScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E42BC9B120A4EFF29D6369B47328835 /* HistoricalScheduler.swift */; };\n\t\t7ED6D7D2EF6FFF55046F3D3A35A082AC /* RxMutableBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FB395F92D0689BBE319FFE3E9629ED5 /* RxMutableBox.swift */; };\n\t\t7F3FBC4CAA887D60DFC3E5725D3E70E0 /* ObserveOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE4C8593EA93085AF9AE51CEAEFB0AC3 /* ObserveOn.swift */; };\n\t\t81BC76F158C24FE975CA9C57A024BE5D /* BinaryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E1CBC038EBBBCDA696050F62A3500E /* BinaryDisposable.swift */; };\n\t\t81D14FDCA28068E8E7F7919DF4866E2C /* Dematerialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B0D799C89CEB12E9038918280E14F94 /* Dematerialize.swift */; };\n\t\t820771AF442ACFBC89BFA23346ABA056 /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30563DE842A43C8F36704363A9C5BC22 /* Filter.swift */; };\n\t\t8396D11A46E2C9449825E617208A9CD2 /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10C46EBA1C55327F7B70CF025751F66D /* Disposables.swift */; };\n\t\t84476532DE609DE15038E4538645C8F5 /* SkipUntil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 384D5ABEA71279A62953241037D3ABF0 /* SkipUntil.swift */; };\n\t\t84C8AEF2EC6CFB6147E366D70F7FF055 /* DistinctUntilChanged.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F37EAD9D1D8D2FB6651810261BBBF46 /* DistinctUntilChanged.swift */; };\n\t\t87F7A1DF6358F7A3F6024225026D493A /* ConnectableObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90A09DE1839B191384477C3495315882 /* ConnectableObservableType.swift */; };\n\t\t8BFB53AA748AE30A083FB96E793D2E85 /* SerialDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28CC188C8790DB27A36C7943F08FD432 /* SerialDispatchQueueScheduler.swift */; };\n\t\t8C9A6D3350BB4DEDBF1C73C8DAAABC17 /* Throttle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB4E63626CE473865637963F1BA7000 /* Throttle.swift */; };\n\t\t8D87A2CF4393AC8B6FD3B12FCA8C7108 /* DisposeBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA8BC887C818360D90DFDFB75095B0C7 /* DisposeBase.swift */; };\n\t\t8E08F133D1792872AE8797D5E92B5CDD /* ScheduledItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F6A116490C11501E17DB95E4A9E2A02 /* ScheduledItemType.swift */; };\n\t\t8E0D6833AB6B04C9823521524074A316 /* Decode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1456FCCC70030329F194FE0D9BB74275 /* Decode.swift */; };\n\t\t900275BCED06EFF4B59B56F53ABC1DB0 /* VirtualTimeScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10264DE3A51C28861AE7E76F4C0F8825 /* VirtualTimeScheduler.swift */; };\n\t\t9153528E5CD81C87F10AE7DE4DF2E4A1 /* MainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B609E93A251E9C1DC3DDE256E69C6CA2 /* MainScheduler.swift */; };\n\t\t91F8A384FBCA808F732B5492FFAADD0D /* Maybe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B8A9D6B7C373B2F6EFB49C728F0AB33 /* Maybe.swift */; };\n\t\t925E00395EC25F1BAD1D2CA638908117 /* PrimitiveSequence+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC220404BDE4C21BDCE9F00438F89216 /* PrimitiveSequence+Concurrency.swift */; };\n\t\t937F15611DD0F2F7DD52ABAD74583C9C /* InvocableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C557EC0E4DE1B7D7656EB9CC85EB109 /* InvocableType.swift */; };\n\t\t93FC3FD271ECD4F94AE7079FA47CFE92 /* ScheduledDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935AEC9EAAFC5F89A715886E8200C785 /* ScheduledDisposable.swift */; };\n\t\t9408E539F7FF487D204244E858755755 /* GroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FDBA54D6DC5C795FD0AACA858F8AF22 /* GroupBy.swift */; };\n\t\t94932D29D8AFB03647F2B5969B0F9E59 /* Infallible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70C215BF3F741BE86732441F66140470 /* Infallible.swift */; };\n\t\t975320587AD0BC3BEBBED2F89A9ED43C /* OperationQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = A45A19B3FF575E57FEF0AC9E0CCF14A2 /* OperationQueueScheduler.swift */; };\n\t\t97BED227454518035D174C46B75B20A8 /* SubjectType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F46E75CCEFCF37AB05C164B05BBEAC7 /* SubjectType.swift */; };\n\t\t988332AC111773C9DAE72F5532688C71 /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DE6AA2E9BDBE033389EA2341B63CCBA /* PriorityQueue.swift */; };\n\t\t9D07D8DFF423E2D5B7B8B54CEB6B23E1 /* Never.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB19619F106F74D36A9A575A06E9559 /* Never.swift */; };\n\t\t9EF6FE74DFDFAD56CFB58E4FA0BCBFAE /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63623E296F40A0ADDBB93D580432DF4F /* Observable.swift */; };\n\t\tA156F96148D6730DB5E18AFB5AABD1D3 /* LockOwnerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C741C40114FD844B87E98FFAAB4DF12 /* LockOwnerType.swift */; };\n\t\tA39CF7AD7932E728672DAD83FD1FFF0C /* SingleAssignmentDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AD7FBF3620F8B64384DA0E29F5C131B /* SingleAssignmentDisposable.swift */; };\n\t\tA5FBA19DB6F4252091D2AE50A6E6EDA6 /* CompactMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE3E84471580B9539CC6C25DC9BEC6E5 /* CompactMap.swift */; };\n\t\tAA1E499298EB99A9E83B5BB5AEAF9D4D /* WithUnretained.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B012AC1BB4775A5EC28815355D01128 /* WithUnretained.swift */; };\n\t\tAC5239702B8B8991821E6D016C27F6F6 /* ReplaySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A49902E7EDED8592D89E33FB1F3C11D /* ReplaySubject.swift */; };\n\t\tAC6EBFB0801D2D0A402320600E88C82A /* AsyncSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4500334758AB217E0951A61CA486EC38 /* AsyncSubject.swift */; };\n\t\tAE308FD1E8051074B8AC1A7FB4577779 /* PrimitiveSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = E72A5F9AE3FC4D77EA5F51203A98DDB5 /* PrimitiveSequence.swift */; };\n\t\tAE4C4557C6151BC62B0FC434197BE3AC /* SchedulerServices+Emulation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E7DDFF07CB880A6682C00E2573BF379 /* SchedulerServices+Emulation.swift */; };\n\t\tAED89C7C5187F3FE2D802CD4A6E6A7F3 /* VirtualTimeConverterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C4CA00462D7AF81CB97DA4E9C6BD8A3 /* VirtualTimeConverterType.swift */; };\n\t\tAF68E7A15855704C483EA72F5FD2F9C7 /* NopDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC5CA0201B6F1A81ADB4DE346D38D4AC /* NopDisposable.swift */; };\n\t\tAFE1191A28173AD8B8355540D3E06A27 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB5968D6712C2A09EDBA89E0EAD3046E /* Platform.Darwin.swift */; };\n\t\tB017D75CAA35E7973007168F2DF75F69 /* Date+Dispatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A793525E12EB6DAA26709D2260A7A3C /* Date+Dispatch.swift */; };\n\t\tB2E510EBD0DC38E527BB6F451D4C32D6 /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDBBFBF18E86573854D8F3DCA852ACF5 /* Lock.swift */; };\n\t\tB3480460A8A601C8810B2B97AEAE3F11 /* ObserverType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9903F12ED76D5045A9F9D51249079B93 /* ObserverType.swift */; };\n\t\tB36798B964B97D74FC4C479654437A92 /* ObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0131D8D39CD77068996672E9A2A39EE4 /* ObservableType.swift */; };\n\t\tB510729BC4EAB870ED9BA0A7D44B7737 /* Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64016060B7F3CF26A314585CB45DFD0 /* Empty.swift */; };\n\t\tB510E55930409C014F603356972FCA84 /* ObservableConvertibleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BB436B3B9955CDC6401E136D8CB2763 /* ObservableConvertibleType.swift */; };\n\t\tB53EC57DD80044C67442489520C2180D /* Infallible+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FEBB96E2CF8614D7D9B4C723E13CD05 /* Infallible+Operators.swift */; };\n\t\tB9E0BE9FEFDF1C9C945C2E7E213907E3 /* ScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D66784A474DE7B1E6A5296032A3893A /* ScheduledItem.swift */; };\n\t\tB9F2AA513E8DC1D7F377CB0CA7B47388 /* Merge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 763C684698BA7C5BBC8B47F218E8EFD6 /* Merge.swift */; };\n\t\tBA4472ADA09BB0860AC15673B7137BAD /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5508FEBB68AFBA86B56F2FB6D923AAD /* Bag.swift */; };\n\t\tBDD82F141523A61F84A1EFD74C939EB7 /* BehaviorSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA98C39FD2DAABD4E9E9408796FC330C /* BehaviorSubject.swift */; };\n\t\tBE7B63B2F1A00752E2DDC907AEFD3240 /* CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0442E9C018C015E04C9C424540F5EBAB /* CombineLatest+arity.swift */; };\n\t\tBF4734ED5E2ABC3DCD480E2F4D8FD4E5 /* AsSingle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FAA6E81418A06864679C19EAF4370F2 /* AsSingle.swift */; };\n\t\tBF9FF582D51611FD892015715A941792 /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = F29D165FE2D9D0FA423825E28EED78DC /* Just.swift */; };\n\t\tBFADA58A29E04E7387E33812485B9894 /* SwitchIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = A21EAF8B1A7F384F4E11BAA4DB008ECA /* SwitchIfEmpty.swift */; };\n\t\tC1D5BCA3245B73B12CC2D81173CAFC86 /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD2B47FDA715687640B9ECBFDCEF8AF1 /* Sequence.swift */; };\n\t\tC2DE106305B678098B12E1B4F524B1B9 /* CombineLatest+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3238D99823CD90C93C812BC61B705AB /* CombineLatest+Collection.swift */; };\n\t\tC3CF934571EBC1F4A1F230C51ED60362 /* Materialize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 723C108E364FBC7FBC3526D2FF87A27E /* Materialize.swift */; };\n\t\tC486486178E80C12082CD098F2959562 /* ImmediateSchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37CA418CBF61F9BC663BEFFBD81E8A07 /* ImmediateSchedulerType.swift */; };\n\t\tC5C965551370FE017808404569CCC6BB /* Concat.swift in Sources */ = {isa = PBXBuildFile; fileRef = B259B9D711B96FAB66C29852E18ACA3F /* Concat.swift */; };\n\t\tC740C17E9786006DC36F024F2741771A /* Cancelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC4610D9851965958AF3BD31288C01E9 /* Cancelable.swift */; };\n\t\tC8C0BA0EAF50527DE29D96B6C53F69CC /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2E3F31DB6FDAC479625DE71067CE80C /* Error.swift */; };\n\t\tC8FA119765E5B27CF99FFD064E83F909 /* Binder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3673ADB1882C401E1A07DDDD494CB9BE /* Binder.swift */; };\n\t\tC939C9727B36ED6634ECB4361BE64F07 /* SwiftSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0F65EA7DF88BDE15ABC0967887C53DF /* SwiftSupport.swift */; };\n\t\tCB81472D138D73C90152A60CE295600B /* Disposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184AEEED7AE00B4E4FE847822881BB1A /* Disposable.swift */; };\n\t\tCBF74F411902824C989B2494B4FBFD40 /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCDC03877BD00C73C7908752994E6F18 /* TakeLast.swift */; };\n\t\tCCB1A55F885E49BADB0341769388E43A /* Amb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5796FBE0AF322957E2C4F17C32FDAA4A /* Amb.swift */; };\n\t\tCD907B5FE3F67566AA5E609DF0EE1A6C /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A38493B711788616ED6E680BC6B1E50 /* RecursiveLock.swift */; };\n\t\tCDE4E4599C60D1F00FB43023CD61C0B6 /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = A052D6BDAC8D3E52AB4F4FC0FDC5BD65 /* Map.swift */; };\n\t\tCFC59149E38952B717A689DABF1A7422 /* PrimitiveSequence+Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33C7A21E2CE1A670DBF7FE885C7DC0E7 /* PrimitiveSequence+Zip+arity.swift */; };\n\t\tD1BEFAA88B88C29030DCBF13A61D86D5 /* GroupedObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C9014E9D1DF19439018473233F3A03 /* GroupedObservable.swift */; };\n\t\tD26206E9EA32A7DC7FCC1AE1A3CBA61E /* Repeat.swift in Sources */ = {isa = PBXBuildFile; fileRef = F80352909FF165909045551B75275367 /* Repeat.swift */; };\n\t\tD50A8346720A78114AC67DECF0C5F16E /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 076F2093B603862FA92224275FA1B86E /* DisposeBag.swift */; };\n\t\tD7612CEE486A1B90B0A70E972BAA24A5 /* DelaySubscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49A88C70FDB5B3BFCB0EC68B74D76D37 /* DelaySubscription.swift */; };\n\t\tDAB9AF4FE685E504702AB4DA78CD4EB4 /* RxSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 46418EF1BD5865016420FAE80A7EBA90 /* RxSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE1823243B6AB3F3F3C39F3D55F22182B /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 435B6A26FFB2766C96A5D40F4B3EAD2E /* DispatchQueueConfiguration.swift */; };\n\t\tE71C5979D34AC68A188101B4E315906D /* TakeWithPredicate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0E97BC9561C166ACDD7B6732E0091DB /* TakeWithPredicate.swift */; };\n\t\tE747D9D51AE0F66270E93AFA34C66274 /* AnonymousObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE5689EE3E89EC97731F55A43105ED09 /* AnonymousObserver.swift */; };\n\t\tED4F788415A99C5350BF05E875049A41 /* ConcurrentDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82D2CA41877583FC602BD7D2C76B9B20 /* ConcurrentDispatchQueueScheduler.swift */; };\n\t\tEE7505CDFB3417FB3FB38FEA95ABEB60 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 409C55819165E1F55424D58510B84576 /* Errors.swift */; };\n\t\tEEC4BE88E000DCBB469C2A2FAFB7472A /* Deferred.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC5179F6A06333977D207144FD896941 /* Deferred.swift */; };\n\t\tEF2A24C562ADAF78C5D6EA620C21FB3F /* Sink.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0C4628EA034B666426FBED85AA8F9C6 /* Sink.swift */; };\n\t\tF2B153540623767DC1CC7489C338138C /* Generate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A340ED862113C7DCC0FE8BE9EA23CB6D /* Generate.swift */; };\n\t\tF32AB57E03DFB7BDE8DB7E442ED2BAA4 /* Delay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 688C976825E0C9DD937BEA6725C049BF /* Delay.swift */; };\n\t\tF395B57C3CA4C80DBF0C4C39BF863946 /* Reduce.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A2949C5A39FFE4EA9DA18E153D3509 /* Reduce.swift */; };\n\t\tF61FCD6DFF585DBA36CC3EB99C1C093E /* SynchronizedDisposeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D63F6D2E909148D9017ACBCAD047E51 /* SynchronizedDisposeType.swift */; };\n\t\tF7811F911DB7435B3AB7A38B98F5B324 /* Enumerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35122489B642F49DFE6C52D9E4E09C0E /* Enumerated.swift */; };\n\t\tF9D536CC462C5ECF9983397BE5D2C5D7 /* RxSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 52E78429366A52FE378E9CE4EE9F363C /* RxSwift-dummy.m */; };\n\t\tFD2EC1FB9138B8F851CBF129B4279BCC /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3050B92FA8AA655635DE610F012E69D /* DispatchQueue+Extensions.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t0131D8D39CD77068996672E9A2A39EE4 /* ObservableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObservableType.swift; path = RxSwift/ObservableType.swift; sourceTree = \"<group>\"; };\n\t\t02B440482343D21BF37C8EEBFF1C5CCF /* Do.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Do.swift; path = RxSwift/Observables/Do.swift; sourceTree = \"<group>\"; };\n\t\t0442E9C018C015E04C9C424540F5EBAB /* CombineLatest+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"CombineLatest+arity.swift\"; path = \"RxSwift/Observables/CombineLatest+arity.swift\"; sourceTree = \"<group>\"; };\n\t\t076F2093B603862FA92224275FA1B86E /* DisposeBag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DisposeBag.swift; path = RxSwift/Disposables/DisposeBag.swift; sourceTree = \"<group>\"; };\n\t\t07B901C7C7FE3E251B080B57F2186907 /* AnyObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyObserver.swift; path = RxSwift/AnyObserver.swift; sourceTree = \"<group>\"; };\n\t\t0994B7709A3D2EEA03A0D4DCDF6BB178 /* Infallible+Create.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Infallible+Create.swift\"; path = \"RxSwift/Traits/Infallible/Infallible+Create.swift\"; sourceTree = \"<group>\"; };\n\t\t0A6ABCE4C597827931B7D5EAE8C18320 /* SingleAsync.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SingleAsync.swift; path = RxSwift/Observables/SingleAsync.swift; sourceTree = \"<group>\"; };\n\t\t0B8A9D6B7C373B2F6EFB49C728F0AB33 /* Maybe.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Maybe.swift; path = RxSwift/Traits/PrimitiveSequence/Maybe.swift; sourceTree = \"<group>\"; };\n\t\t0BB436B3B9955CDC6401E136D8CB2763 /* ObservableConvertibleType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObservableConvertibleType.swift; path = RxSwift/ObservableConvertibleType.swift; sourceTree = \"<group>\"; };\n\t\t0E1AE3E6B3C655AEF201B640CC018F1D /* Event.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Event.swift; path = RxSwift/Event.swift; sourceTree = \"<group>\"; };\n\t\t0EF6669B25190FDAEDE27BAB84F55204 /* ElementAt.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ElementAt.swift; path = RxSwift/Observables/ElementAt.swift; sourceTree = \"<group>\"; };\n\t\t0F37EAD9D1D8D2FB6651810261BBBF46 /* DistinctUntilChanged.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DistinctUntilChanged.swift; path = RxSwift/Observables/DistinctUntilChanged.swift; sourceTree = \"<group>\"; };\n\t\t10264DE3A51C28861AE7E76F4C0F8825 /* VirtualTimeScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VirtualTimeScheduler.swift; path = RxSwift/Schedulers/VirtualTimeScheduler.swift; sourceTree = \"<group>\"; };\n\t\t10C46EBA1C55327F7B70CF025751F66D /* Disposables.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Disposables.swift; path = RxSwift/Disposables/Disposables.swift; sourceTree = \"<group>\"; };\n\t\t1456FCCC70030329F194FE0D9BB74275 /* Decode.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Decode.swift; path = RxSwift/Observables/Decode.swift; sourceTree = \"<group>\"; };\n\t\t14A6DEDFBF8EA2AFBD4724D73EBB2F54 /* First.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = First.swift; path = RxSwift/Observables/First.swift; sourceTree = \"<group>\"; };\n\t\t17E1CBC038EBBBCDA696050F62A3500E /* BinaryDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryDisposable.swift; path = RxSwift/Disposables/BinaryDisposable.swift; sourceTree = \"<group>\"; };\n\t\t184AEEED7AE00B4E4FE847822881BB1A /* Disposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Disposable.swift; path = RxSwift/Disposable.swift; sourceTree = \"<group>\"; };\n\t\t19D7AFDA7F12C74BF1051E4316D60C0E /* Observable+Concurrency.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Observable+Concurrency.swift\"; path = \"RxSwift/Observable+Concurrency.swift\"; sourceTree = \"<group>\"; };\n\t\t1EB98FFD5D7C9C835CE062EE655DF4FF /* SynchronizedUnsubscribeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedUnsubscribeType.swift; path = RxSwift/Concurrency/SynchronizedUnsubscribeType.swift; sourceTree = \"<group>\"; };\n\t\t1F2B494CA299B8E5BDF7CF902C097F9E /* Scan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Scan.swift; path = RxSwift/Observables/Scan.swift; sourceTree = \"<group>\"; };\n\t\t1FEBB96E2CF8614D7D9B4C723E13CD05 /* Infallible+Operators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Infallible+Operators.swift\"; path = \"RxSwift/Traits/Infallible/Infallible+Operators.swift\"; sourceTree = \"<group>\"; };\n\t\t229477D6AD01652D44329EF047E9F813 /* SerialDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SerialDisposable.swift; path = RxSwift/Disposables/SerialDisposable.swift; sourceTree = \"<group>\"; };\n\t\t289E83EA0EF1D3AAA93257440FDC5918 /* CombineLatest.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombineLatest.swift; path = RxSwift/Observables/CombineLatest.swift; sourceTree = \"<group>\"; };\n\t\t28C911648408A33BE68A8A86F500E252 /* Optional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Optional.swift; path = RxSwift/Observables/Optional.swift; sourceTree = \"<group>\"; };\n\t\t28CC188C8790DB27A36C7943F08FD432 /* SerialDispatchQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SerialDispatchQueueScheduler.swift; path = RxSwift/Schedulers/SerialDispatchQueueScheduler.swift; sourceTree = \"<group>\"; };\n\t\t2C4CA00462D7AF81CB97DA4E9C6BD8A3 /* VirtualTimeConverterType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VirtualTimeConverterType.swift; path = RxSwift/Schedulers/VirtualTimeConverterType.swift; sourceTree = \"<group>\"; };\n\t\t2E52DF9943C3CF80D78E2C8A12114B1D /* CompositeDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CompositeDisposable.swift; path = RxSwift/Disposables/CompositeDisposable.swift; sourceTree = \"<group>\"; };\n\t\t30563DE842A43C8F36704363A9C5BC22 /* Filter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = RxSwift/Observables/Filter.swift; sourceTree = \"<group>\"; };\n\t\t33C7A21E2CE1A670DBF7FE885C7DC0E7 /* PrimitiveSequence+Zip+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"PrimitiveSequence+Zip+arity.swift\"; path = \"RxSwift/Traits/PrimitiveSequence/PrimitiveSequence+Zip+arity.swift\"; sourceTree = \"<group>\"; };\n\t\t35122489B642F49DFE6C52D9E4E09C0E /* Enumerated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Enumerated.swift; path = RxSwift/Observables/Enumerated.swift; sourceTree = \"<group>\"; };\n\t\t3673ADB1882C401E1A07DDDD494CB9BE /* Binder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Binder.swift; path = RxSwift/Binder.swift; sourceTree = \"<group>\"; };\n\t\t372CA74FD5FB927C23DFD0B1B89F9627 /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = \"<group>\"; };\n\t\t37CA418CBF61F9BC663BEFFBD81E8A07 /* ImmediateSchedulerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImmediateSchedulerType.swift; path = RxSwift/ImmediateSchedulerType.swift; sourceTree = \"<group>\"; };\n\t\t384D5ABEA71279A62953241037D3ABF0 /* SkipUntil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SkipUntil.swift; path = RxSwift/Observables/SkipUntil.swift; sourceTree = \"<group>\"; };\n\t\t3A793525E12EB6DAA26709D2260A7A3C /* Date+Dispatch.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Date+Dispatch.swift\"; path = \"RxSwift/Date+Dispatch.swift\"; sourceTree = \"<group>\"; };\n\t\t3B012AC1BB4775A5EC28815355D01128 /* WithUnretained.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = WithUnretained.swift; path = RxSwift/Observables/WithUnretained.swift; sourceTree = \"<group>\"; };\n\t\t3D63F6D2E909148D9017ACBCAD047E51 /* SynchronizedDisposeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedDisposeType.swift; path = RxSwift/Concurrency/SynchronizedDisposeType.swift; sourceTree = \"<group>\"; };\n\t\t3D66784A474DE7B1E6A5296032A3893A /* ScheduledItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledItem.swift; path = RxSwift/Schedulers/Internal/ScheduledItem.swift; sourceTree = \"<group>\"; };\n\t\t3E42BC9B120A4EFF29D6369B47328835 /* HistoricalScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HistoricalScheduler.swift; path = RxSwift/Schedulers/HistoricalScheduler.swift; sourceTree = \"<group>\"; };\n\t\t3E7DDFF07CB880A6682C00E2573BF379 /* SchedulerServices+Emulation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"SchedulerServices+Emulation.swift\"; path = \"RxSwift/Schedulers/SchedulerServices+Emulation.swift\"; sourceTree = \"<group>\"; };\n\t\t409C55819165E1F55424D58510B84576 /* Errors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = RxSwift/Errors.swift; sourceTree = \"<group>\"; };\n\t\t435B6A26FFB2766C96A5D40F4B3EAD2E /* DispatchQueueConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DispatchQueueConfiguration.swift; path = RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift; sourceTree = \"<group>\"; };\n\t\t4500334758AB217E0951A61CA486EC38 /* AsyncSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncSubject.swift; path = RxSwift/Subjects/AsyncSubject.swift; sourceTree = \"<group>\"; };\n\t\t457B0DB19F96A3FE26CD903EBE32B403 /* Zip+Collection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Zip+Collection.swift\"; path = \"RxSwift/Observables/Zip+Collection.swift\"; sourceTree = \"<group>\"; };\n\t\t46418EF1BD5865016420FAE80A7EBA90 /* RxSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxSwift-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t486A3949E5E08734E696D1E9BA4D6533 /* AnonymousDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousDisposable.swift; path = RxSwift/Disposables/AnonymousDisposable.swift; sourceTree = \"<group>\"; };\n\t\t49A88C70FDB5B3BFCB0EC68B74D76D37 /* DelaySubscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelaySubscription.swift; path = RxSwift/Observables/DelaySubscription.swift; sourceTree = \"<group>\"; };\n\t\t4AD7FBF3620F8B64384DA0E29F5C131B /* SingleAssignmentDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SingleAssignmentDisposable.swift; path = RxSwift/Disposables/SingleAssignmentDisposable.swift; sourceTree = \"<group>\"; };\n\t\t4BB2D836C515793F4DF34F0028F9B506 /* Infallible+Concurrency.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Infallible+Concurrency.swift\"; path = \"RxSwift/Traits/Infallible/Infallible+Concurrency.swift\"; sourceTree = \"<group>\"; };\n\t\t4C557EC0E4DE1B7D7656EB9CC85EB109 /* InvocableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InvocableType.swift; path = RxSwift/Schedulers/Internal/InvocableType.swift; sourceTree = \"<group>\"; };\n\t\t4DB4E63626CE473865637963F1BA7000 /* Throttle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Throttle.swift; path = RxSwift/Observables/Throttle.swift; sourceTree = \"<group>\"; };\n\t\t4EB19619F106F74D36A9A575A06E9559 /* Never.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Never.swift; path = RxSwift/Observables/Never.swift; sourceTree = \"<group>\"; };\n\t\t4FAA6E81418A06864679C19EAF4370F2 /* AsSingle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsSingle.swift; path = RxSwift/Observables/AsSingle.swift; sourceTree = \"<group>\"; };\n\t\t52E78429366A52FE378E9CE4EE9F363C /* RxSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"RxSwift-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t55C0718AB8BFF75B7A4153E4BEA44C36 /* TailRecursiveSink.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TailRecursiveSink.swift; path = RxSwift/Observers/TailRecursiveSink.swift; sourceTree = \"<group>\"; };\n\t\t5796FBE0AF322957E2C4F17C32FDAA4A /* Amb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Amb.swift; path = RxSwift/Observables/Amb.swift; sourceTree = \"<group>\"; };\n\t\t5A65C9BEDF5D76BA130F41A6E0619B82 /* Buffer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Buffer.swift; path = RxSwift/Observables/Buffer.swift; sourceTree = \"<group>\"; };\n\t\t5B30AC573953B7338EECF8DCF8AB35A2 /* DefaultIfEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DefaultIfEmpty.swift; path = RxSwift/Observables/DefaultIfEmpty.swift; sourceTree = \"<group>\"; };\n\t\t5EB6589FC70E0734382829B9830E301D /* RxSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"RxSwift-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t63623E296F40A0ADDBB93D580432DF4F /* Observable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Observable.swift; path = RxSwift/Observable.swift; sourceTree = \"<group>\"; };\n\t\t63821FDC18A5EE8FA3F8530585352985 /* Infallible+CombineLatest+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Infallible+CombineLatest+arity.swift\"; path = \"RxSwift/Traits/Infallible/Infallible+CombineLatest+arity.swift\"; sourceTree = \"<group>\"; };\n\t\t6624BA1515ABF8CBB8CBD382A5BE4B8D /* ObservableType+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ObservableType+Extensions.swift\"; path = \"RxSwift/ObservableType+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t688C976825E0C9DD937BEA6725C049BF /* Delay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Delay.swift; path = RxSwift/Observables/Delay.swift; sourceTree = \"<group>\"; };\n\t\t6DE6AA2E9BDBE033389EA2341B63CCBA /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = \"<group>\"; };\n\t\t6EAFB5D698BAF410EA0A50B3EF3C00CC /* Bag+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Bag+Rx.swift\"; path = \"RxSwift/Extensions/Bag+Rx.swift\"; sourceTree = \"<group>\"; };\n\t\t6F8CCF0158ADFB1892D235AF948937B2 /* Catch.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Catch.swift; path = RxSwift/Observables/Catch.swift; sourceTree = \"<group>\"; };\n\t\t6FC57D0F69947131B322E3F163DB445B /* WithLatestFrom.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = WithLatestFrom.swift; path = RxSwift/Observables/WithLatestFrom.swift; sourceTree = \"<group>\"; };\n\t\t70C215BF3F741BE86732441F66140470 /* Infallible.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Infallible.swift; path = RxSwift/Traits/Infallible/Infallible.swift; sourceTree = \"<group>\"; };\n\t\t723C108E364FBC7FBC3526D2FF87A27E /* Materialize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Materialize.swift; path = RxSwift/Observables/Materialize.swift; sourceTree = \"<group>\"; };\n\t\t72EAB741B4B06EC3D025B47CD68FB644 /* SubscribeOn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubscribeOn.swift; path = RxSwift/Observables/SubscribeOn.swift; sourceTree = \"<group>\"; };\n\t\t763C684698BA7C5BBC8B47F218E8EFD6 /* Merge.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Merge.swift; path = RxSwift/Observables/Merge.swift; sourceTree = \"<group>\"; };\n\t\t76417CACF79AB959453A0A9D6D1FC459 /* Debounce.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debounce.swift; path = RxSwift/Observables/Debounce.swift; sourceTree = \"<group>\"; };\n\t\t76FA635A597441CAA0DCEAA7A4FF9E78 /* StartWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StartWith.swift; path = RxSwift/Observables/StartWith.swift; sourceTree = \"<group>\"; };\n\t\t78929D3F60697CBF87C2D138E1DCD30C /* AsMaybe.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsMaybe.swift; path = RxSwift/Observables/AsMaybe.swift; sourceTree = \"<group>\"; };\n\t\t7B0D799C89CEB12E9038918280E14F94 /* Dematerialize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Dematerialize.swift; path = RxSwift/Observables/Dematerialize.swift; sourceTree = \"<group>\"; };\n\t\t7B7B1820AAEFCC1DF667934F8D5878C8 /* ConcurrentMainScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConcurrentMainScheduler.swift; path = RxSwift/Schedulers/ConcurrentMainScheduler.swift; sourceTree = \"<group>\"; };\n\t\t7C741C40114FD844B87E98FFAAB4DF12 /* LockOwnerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LockOwnerType.swift; path = RxSwift/Concurrency/LockOwnerType.swift; sourceTree = \"<group>\"; };\n\t\t7CB980246A808326790D6B75E838566B /* AddRef.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AddRef.swift; path = RxSwift/Observables/AddRef.swift; sourceTree = \"<group>\"; };\n\t\t7D6C8DA37ACBFE46CF8E3B98E83E670C /* Switch.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Switch.swift; path = RxSwift/Observables/Switch.swift; sourceTree = \"<group>\"; };\n\t\t7E3331A80D8160095B9EDEFC659E7754 /* Sample.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sample.swift; path = RxSwift/Observables/Sample.swift; sourceTree = \"<group>\"; };\n\t\t7F6A116490C11501E17DB95E4A9E2A02 /* ScheduledItemType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledItemType.swift; path = RxSwift/Schedulers/Internal/ScheduledItemType.swift; sourceTree = \"<group>\"; };\n\t\t828FC8A5C5DFA8382BDB5EC7088E1A79 /* Multicast.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Multicast.swift; path = RxSwift/Observables/Multicast.swift; sourceTree = \"<group>\"; };\n\t\t82D2CA41877583FC602BD7D2C76B9B20 /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConcurrentDispatchQueueScheduler.swift; path = RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift; sourceTree = \"<group>\"; };\n\t\t85D3377D4F6DE195E50C7981252107B0 /* RefCountDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RefCountDisposable.swift; path = RxSwift/Disposables/RefCountDisposable.swift; sourceTree = \"<group>\"; };\n\t\t86A3B69C60B1415D7EFACB4AC87FC192 /* InvocableScheduledItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InvocableScheduledItem.swift; path = RxSwift/Schedulers/Internal/InvocableScheduledItem.swift; sourceTree = \"<group>\"; };\n\t\t89FA2EB233EED406AE4DAC40D842114F /* Skip.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Skip.swift; path = RxSwift/Observables/Skip.swift; sourceTree = \"<group>\"; };\n\t\t8A38493B711788616ED6E680BC6B1E50 /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = \"<group>\"; };\n\t\t8A49902E7EDED8592D89E33FB1F3C11D /* ReplaySubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReplaySubject.swift; path = RxSwift/Subjects/ReplaySubject.swift; sourceTree = \"<group>\"; };\n\t\t8DE4C0E7DB0FAED8D254CFA338432B04 /* RxSwift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxSwift; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t8EF78473CE368CE85C5F646CB7DE6565 /* SubscriptionDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubscriptionDisposable.swift; path = RxSwift/Disposables/SubscriptionDisposable.swift; sourceTree = \"<group>\"; };\n\t\t8FDBA54D6DC5C795FD0AACA858F8AF22 /* GroupBy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GroupBy.swift; path = RxSwift/Observables/GroupBy.swift; sourceTree = \"<group>\"; };\n\t\t90A09DE1839B191384477C3495315882 /* ConnectableObservableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConnectableObservableType.swift; path = RxSwift/ConnectableObservableType.swift; sourceTree = \"<group>\"; };\n\t\t913D1D51B63C727D0A5FB1BD77C85F67 /* Single.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Single.swift; path = RxSwift/Traits/PrimitiveSequence/Single.swift; sourceTree = \"<group>\"; };\n\t\t9222A770791B2EBB102465A7E7EB00AA /* AtomicInt.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AtomicInt.swift; path = Platform/AtomicInt.swift; sourceTree = \"<group>\"; };\n\t\t926380597C801B4D05BD2B6EB67076F2 /* Producer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Producer.swift; path = RxSwift/Observables/Producer.swift; sourceTree = \"<group>\"; };\n\t\t935AEC9EAAFC5F89A715886E8200C785 /* ScheduledDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledDisposable.swift; path = RxSwift/Disposables/ScheduledDisposable.swift; sourceTree = \"<group>\"; };\n\t\t9903F12ED76D5045A9F9D51249079B93 /* ObserverType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserverType.swift; path = RxSwift/ObserverType.swift; sourceTree = \"<group>\"; };\n\t\t9AE5A84CE200A385437C8F8D151C0869 /* Timeout.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timeout.swift; path = RxSwift/Observables/Timeout.swift; sourceTree = \"<group>\"; };\n\t\t9C6DD2ADF4B543286BD0A7B6A9F276E5 /* Range.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Range.swift; path = RxSwift/Observables/Range.swift; sourceTree = \"<group>\"; };\n\t\t9F46E75CCEFCF37AB05C164B05BBEAC7 /* SubjectType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubjectType.swift; path = RxSwift/Subjects/SubjectType.swift; sourceTree = \"<group>\"; };\n\t\t9FB395F92D0689BBE319FFE3E9629ED5 /* RxMutableBox.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxMutableBox.swift; path = RxSwift/RxMutableBox.swift; sourceTree = \"<group>\"; };\n\t\tA052D6BDAC8D3E52AB4F4FC0FDC5BD65 /* Map.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Map.swift; path = RxSwift/Observables/Map.swift; sourceTree = \"<group>\"; };\n\t\tA0E97BC9561C166ACDD7B6732E0091DB /* TakeWithPredicate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeWithPredicate.swift; path = RxSwift/Observables/TakeWithPredicate.swift; sourceTree = \"<group>\"; };\n\t\tA21EAF8B1A7F384F4E11BAA4DB008ECA /* SwitchIfEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwitchIfEmpty.swift; path = RxSwift/Observables/SwitchIfEmpty.swift; sourceTree = \"<group>\"; };\n\t\tA3050B92FA8AA655635DE610F012E69D /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DispatchQueue+Extensions.swift\"; path = \"Platform/DispatchQueue+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\tA3238D99823CD90C93C812BC61B705AB /* CombineLatest+Collection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"CombineLatest+Collection.swift\"; path = \"RxSwift/Observables/CombineLatest+Collection.swift\"; sourceTree = \"<group>\"; };\n\t\tA340ED862113C7DCC0FE8BE9EA23CB6D /* Generate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Generate.swift; path = RxSwift/Observables/Generate.swift; sourceTree = \"<group>\"; };\n\t\tA3BB733E7338CFB2FF7F160BD58B2E80 /* Create.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Create.swift; path = RxSwift/Observables/Create.swift; sourceTree = \"<group>\"; };\n\t\tA3E935098718BDD834F8201C12FFE005 /* Zip.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Zip.swift; path = RxSwift/Observables/Zip.swift; sourceTree = \"<group>\"; };\n\t\tA45A19B3FF575E57FEF0AC9E0CCF14A2 /* OperationQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = OperationQueueScheduler.swift; path = RxSwift/Schedulers/OperationQueueScheduler.swift; sourceTree = \"<group>\"; };\n\t\tA50B05E705380F7B6A47CD4F8B6C1302 /* ObservableType+PrimitiveSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ObservableType+PrimitiveSequence.swift\"; path = \"RxSwift/Traits/PrimitiveSequence/ObservableType+PrimitiveSequence.swift\"; sourceTree = \"<group>\"; };\n\t\tA5F7EF697C4A6F030C2755C0A53E5C9B /* ObserverBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserverBase.swift; path = RxSwift/Observers/ObserverBase.swift; sourceTree = \"<group>\"; };\n\t\tA85B3577056C6247942FEFE551B7AFE0 /* Completable+AndThen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Completable+AndThen.swift\"; path = \"RxSwift/Traits/PrimitiveSequence/Completable+AndThen.swift\"; sourceTree = \"<group>\"; };\n\t\tA9C9014E9D1DF19439018473233F3A03 /* GroupedObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GroupedObservable.swift; path = RxSwift/GroupedObservable.swift; sourceTree = \"<group>\"; };\n\t\tAA98C39FD2DAABD4E9E9408796FC330C /* BehaviorSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BehaviorSubject.swift; path = RxSwift/Subjects/BehaviorSubject.swift; sourceTree = \"<group>\"; };\n\t\tAC1F3BDEB131637148CBB1AFD176B938 /* Using.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Using.swift; path = RxSwift/Observables/Using.swift; sourceTree = \"<group>\"; };\n\t\tADCD786DFFF81BAED3FAB67FAC0504FE /* BooleanDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BooleanDisposable.swift; path = RxSwift/Disposables/BooleanDisposable.swift; sourceTree = \"<group>\"; };\n\t\tB0F65EA7DF88BDE15ABC0967887C53DF /* SwiftSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftSupport.swift; path = RxSwift/SwiftSupport/SwiftSupport.swift; sourceTree = \"<group>\"; };\n\t\tB10649B78769CE3E3898649BFB67576F /* RxSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = RxSwift.modulemap; sourceTree = \"<group>\"; };\n\t\tB259B9D711B96FAB66C29852E18ACA3F /* Concat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Concat.swift; path = RxSwift/Observables/Concat.swift; sourceTree = \"<group>\"; };\n\t\tB2E3F31DB6FDAC479625DE71067CE80C /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = RxSwift/Observables/Error.swift; sourceTree = \"<group>\"; };\n\t\tB3B5E1F7A06DBAB7D7F26E00F2B7EA4E /* SkipWhile.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SkipWhile.swift; path = RxSwift/Observables/SkipWhile.swift; sourceTree = \"<group>\"; };\n\t\tB609E93A251E9C1DC3DDE256E69C6CA2 /* MainScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MainScheduler.swift; path = RxSwift/Schedulers/MainScheduler.swift; sourceTree = \"<group>\"; };\n\t\tB64016060B7F3CF26A314585CB45DFD0 /* Empty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Empty.swift; path = RxSwift/Observables/Empty.swift; sourceTree = \"<group>\"; };\n\t\tBC5CA0201B6F1A81ADB4DE346D38D4AC /* NopDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NopDisposable.swift; path = RxSwift/Disposables/NopDisposable.swift; sourceTree = \"<group>\"; };\n\t\tBE4C8593EA93085AF9AE51CEAEFB0AC3 /* ObserveOn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserveOn.swift; path = RxSwift/Observables/ObserveOn.swift; sourceTree = \"<group>\"; };\n\t\tBE5689EE3E89EC97731F55A43105ED09 /* AnonymousObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousObserver.swift; path = RxSwift/Observers/AnonymousObserver.swift; sourceTree = \"<group>\"; };\n\t\tC1A4713FCDEB763267971007195C371B /* AsyncLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncLock.swift; path = RxSwift/Concurrency/AsyncLock.swift; sourceTree = \"<group>\"; };\n\t\tC1BCB3E7FD05766A7A410C999DDA2CC4 /* HistoricalSchedulerTimeConverter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HistoricalSchedulerTimeConverter.swift; path = RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift; sourceTree = \"<group>\"; };\n\t\tC30ABEF30D25A49558F4DB7F874E44E0 /* ObservableConvertibleType+Infallible.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ObservableConvertibleType+Infallible.swift\"; path = \"RxSwift/Traits/Infallible/ObservableConvertibleType+Infallible.swift\"; sourceTree = \"<group>\"; };\n\t\tC3625F658518958669E9F349CAC10EA8 /* RxSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxSwift.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tC3A2949C5A39FFE4EA9DA18E153D3509 /* Reduce.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Reduce.swift; path = RxSwift/Observables/Reduce.swift; sourceTree = \"<group>\"; };\n\t\tC54D2831DC496D0DA0DF322013C23A87 /* RetryWhen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RetryWhen.swift; path = RxSwift/Observables/RetryWhen.swift; sourceTree = \"<group>\"; };\n\t\tC9358CE4DA5674AC8E0C904B7DD9BACA /* Take.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Take.swift; path = RxSwift/Observables/Take.swift; sourceTree = \"<group>\"; };\n\t\tCC5179F6A06333977D207144FD896941 /* Deferred.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Deferred.swift; path = RxSwift/Observables/Deferred.swift; sourceTree = \"<group>\"; };\n\t\tCD2B47FDA715687640B9ECBFDCEF8AF1 /* Sequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sequence.swift; path = RxSwift/Observables/Sequence.swift; sourceTree = \"<group>\"; };\n\t\tCFA533C6532962A65D4EB6FC48797D33 /* SynchronizedOnType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedOnType.swift; path = RxSwift/Concurrency/SynchronizedOnType.swift; sourceTree = \"<group>\"; };\n\t\tD365A1DD95A5D4823B5A11942ACFAF93 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tD366BF46DE5636FCECC33A91A2A62D08 /* Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Rx.swift; path = RxSwift/Rx.swift; sourceTree = \"<group>\"; };\n\t\tD5508FEBB68AFBA86B56F2FB6D923AAD /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = \"<group>\"; };\n\t\tD7343FC62CEC5B0AA43516C7345D526E /* Window.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Window.swift; path = RxSwift/Observables/Window.swift; sourceTree = \"<group>\"; };\n\t\tD954021B3B4AB7F638939EA5D5745604 /* RxSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxSwift-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tDB5968D6712C2A09EDBA89E0EAD3046E /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = \"<group>\"; };\n\t\tDCDC03877BD00C73C7908752994E6F18 /* TakeLast.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeLast.swift; path = RxSwift/Observables/TakeLast.swift; sourceTree = \"<group>\"; };\n\t\tDF014BB7B837F2A81B6F32487F5FB98D /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CurrentThreadScheduler.swift; path = RxSwift/Schedulers/CurrentThreadScheduler.swift; sourceTree = \"<group>\"; };\n\t\tE095558419F15445B00EDE173B85AE0F /* Zip+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Zip+arity.swift\"; path = \"RxSwift/Observables/Zip+arity.swift\"; sourceTree = \"<group>\"; };\n\t\tE0C4628EA034B666426FBED85AA8F9C6 /* Sink.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sink.swift; path = RxSwift/Observables/Sink.swift; sourceTree = \"<group>\"; };\n\t\tE4A0868043C5BC77A2DC222B14ACE05F /* PublishSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PublishSubject.swift; path = RxSwift/Subjects/PublishSubject.swift; sourceTree = \"<group>\"; };\n\t\tE4D95852033081D88BF6D8548B3FCEFD /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = \"<group>\"; };\n\t\tE65257A733C08F50E16495A11737ADE2 /* Reactive.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Reactive.swift; path = RxSwift/Reactive.swift; sourceTree = \"<group>\"; };\n\t\tE72A5F9AE3FC4D77EA5F51203A98DDB5 /* PrimitiveSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PrimitiveSequence.swift; path = RxSwift/Traits/PrimitiveSequence/PrimitiveSequence.swift; sourceTree = \"<group>\"; };\n\t\tE8461B706FB1B7DD05B108CEB6B1C02A /* ShareReplayScope.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ShareReplayScope.swift; path = RxSwift/Observables/ShareReplayScope.swift; sourceTree = \"<group>\"; };\n\t\tEA8BC887C818360D90DFDFB75095B0C7 /* DisposeBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DisposeBase.swift; path = RxSwift/Disposables/DisposeBase.swift; sourceTree = \"<group>\"; };\n\t\tEC4610D9851965958AF3BD31288C01E9 /* Cancelable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Cancelable.swift; path = RxSwift/Cancelable.swift; sourceTree = \"<group>\"; };\n\t\tEDBBFBF18E86573854D8F3DCA852ACF5 /* Lock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Lock.swift; path = RxSwift/Concurrency/Lock.swift; sourceTree = \"<group>\"; };\n\t\tEE3E84471580B9539CC6C25DC9BEC6E5 /* CompactMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CompactMap.swift; path = RxSwift/Observables/CompactMap.swift; sourceTree = \"<group>\"; };\n\t\tEFF22A7CD6079BD75E789D4223133C06 /* RxSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxSwift.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tF29D165FE2D9D0FA423825E28EED78DC /* Just.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Just.swift; path = RxSwift/Observables/Just.swift; sourceTree = \"<group>\"; };\n\t\tF48D36D1199BBD2CA605448FB2CDB1BF /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = \"<group>\"; };\n\t\tF4D00A92C852F00C01C83EEEEF8C50BB /* ToArray.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ToArray.swift; path = RxSwift/Observables/ToArray.swift; sourceTree = \"<group>\"; };\n\t\tF5958FB9316312650DBBF3B8684DE5FC /* Timer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timer.swift; path = RxSwift/Observables/Timer.swift; sourceTree = \"<group>\"; };\n\t\tF80352909FF165909045551B75275367 /* Repeat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Repeat.swift; path = RxSwift/Observables/Repeat.swift; sourceTree = \"<group>\"; };\n\t\tF872F299C26B9DCE1C0D4D7D53400F82 /* Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debug.swift; path = RxSwift/Observables/Debug.swift; sourceTree = \"<group>\"; };\n\t\tF8FA35ED041E0D556064480FF0E51D65 /* Completable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Completable.swift; path = RxSwift/Traits/PrimitiveSequence/Completable.swift; sourceTree = \"<group>\"; };\n\t\tFB9A08FF569331BEA3DC8F74A0E9C754 /* RecursiveScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveScheduler.swift; path = RxSwift/Schedulers/RecursiveScheduler.swift; sourceTree = \"<group>\"; };\n\t\tFC220404BDE4C21BDCE9F00438F89216 /* PrimitiveSequence+Concurrency.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"PrimitiveSequence+Concurrency.swift\"; path = \"RxSwift/Traits/PrimitiveSequence/PrimitiveSequence+Concurrency.swift\"; sourceTree = \"<group>\"; };\n\t\tFE326FD053D97022078A0670611B80DE /* Infallible+Zip+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Infallible+Zip+arity.swift\"; path = \"RxSwift/Traits/Infallible/Infallible+Zip+arity.swift\"; sourceTree = \"<group>\"; };\n\t\tFF02F4A025996FB90BDE36031387D29C /* SchedulerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SchedulerType.swift; path = RxSwift/SchedulerType.swift; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tBF3C5523A9E8BA6BCF33523133BA3EDE /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4B8EB70E5745054F72981BA725C9F2AC /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t342831380A0844956C64A25BEEC04C48 /* RxSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7CB980246A808326790D6B75E838566B /* AddRef.swift */,\n\t\t\t\t5796FBE0AF322957E2C4F17C32FDAA4A /* Amb.swift */,\n\t\t\t\t486A3949E5E08734E696D1E9BA4D6533 /* AnonymousDisposable.swift */,\n\t\t\t\tBE5689EE3E89EC97731F55A43105ED09 /* AnonymousObserver.swift */,\n\t\t\t\t07B901C7C7FE3E251B080B57F2186907 /* AnyObserver.swift */,\n\t\t\t\t78929D3F60697CBF87C2D138E1DCD30C /* AsMaybe.swift */,\n\t\t\t\t4FAA6E81418A06864679C19EAF4370F2 /* AsSingle.swift */,\n\t\t\t\tC1A4713FCDEB763267971007195C371B /* AsyncLock.swift */,\n\t\t\t\t4500334758AB217E0951A61CA486EC38 /* AsyncSubject.swift */,\n\t\t\t\t9222A770791B2EBB102465A7E7EB00AA /* AtomicInt.swift */,\n\t\t\t\tD5508FEBB68AFBA86B56F2FB6D923AAD /* Bag.swift */,\n\t\t\t\t6EAFB5D698BAF410EA0A50B3EF3C00CC /* Bag+Rx.swift */,\n\t\t\t\tAA98C39FD2DAABD4E9E9408796FC330C /* BehaviorSubject.swift */,\n\t\t\t\t17E1CBC038EBBBCDA696050F62A3500E /* BinaryDisposable.swift */,\n\t\t\t\t3673ADB1882C401E1A07DDDD494CB9BE /* Binder.swift */,\n\t\t\t\tADCD786DFFF81BAED3FAB67FAC0504FE /* BooleanDisposable.swift */,\n\t\t\t\t5A65C9BEDF5D76BA130F41A6E0619B82 /* Buffer.swift */,\n\t\t\t\tEC4610D9851965958AF3BD31288C01E9 /* Cancelable.swift */,\n\t\t\t\t6F8CCF0158ADFB1892D235AF948937B2 /* Catch.swift */,\n\t\t\t\t289E83EA0EF1D3AAA93257440FDC5918 /* CombineLatest.swift */,\n\t\t\t\t0442E9C018C015E04C9C424540F5EBAB /* CombineLatest+arity.swift */,\n\t\t\t\tA3238D99823CD90C93C812BC61B705AB /* CombineLatest+Collection.swift */,\n\t\t\t\tEE3E84471580B9539CC6C25DC9BEC6E5 /* CompactMap.swift */,\n\t\t\t\tF8FA35ED041E0D556064480FF0E51D65 /* Completable.swift */,\n\t\t\t\tA85B3577056C6247942FEFE551B7AFE0 /* Completable+AndThen.swift */,\n\t\t\t\t2E52DF9943C3CF80D78E2C8A12114B1D /* CompositeDisposable.swift */,\n\t\t\t\tB259B9D711B96FAB66C29852E18ACA3F /* Concat.swift */,\n\t\t\t\t82D2CA41877583FC602BD7D2C76B9B20 /* ConcurrentDispatchQueueScheduler.swift */,\n\t\t\t\t7B7B1820AAEFCC1DF667934F8D5878C8 /* ConcurrentMainScheduler.swift */,\n\t\t\t\t90A09DE1839B191384477C3495315882 /* ConnectableObservableType.swift */,\n\t\t\t\tA3BB733E7338CFB2FF7F160BD58B2E80 /* Create.swift */,\n\t\t\t\tDF014BB7B837F2A81B6F32487F5FB98D /* CurrentThreadScheduler.swift */,\n\t\t\t\t3A793525E12EB6DAA26709D2260A7A3C /* Date+Dispatch.swift */,\n\t\t\t\t76417CACF79AB959453A0A9D6D1FC459 /* Debounce.swift */,\n\t\t\t\tF872F299C26B9DCE1C0D4D7D53400F82 /* Debug.swift */,\n\t\t\t\t1456FCCC70030329F194FE0D9BB74275 /* Decode.swift */,\n\t\t\t\t5B30AC573953B7338EECF8DCF8AB35A2 /* DefaultIfEmpty.swift */,\n\t\t\t\tCC5179F6A06333977D207144FD896941 /* Deferred.swift */,\n\t\t\t\t688C976825E0C9DD937BEA6725C049BF /* Delay.swift */,\n\t\t\t\t49A88C70FDB5B3BFCB0EC68B74D76D37 /* DelaySubscription.swift */,\n\t\t\t\t7B0D799C89CEB12E9038918280E14F94 /* Dematerialize.swift */,\n\t\t\t\tA3050B92FA8AA655635DE610F012E69D /* DispatchQueue+Extensions.swift */,\n\t\t\t\t435B6A26FFB2766C96A5D40F4B3EAD2E /* DispatchQueueConfiguration.swift */,\n\t\t\t\t184AEEED7AE00B4E4FE847822881BB1A /* Disposable.swift */,\n\t\t\t\t10C46EBA1C55327F7B70CF025751F66D /* Disposables.swift */,\n\t\t\t\t076F2093B603862FA92224275FA1B86E /* DisposeBag.swift */,\n\t\t\t\tEA8BC887C818360D90DFDFB75095B0C7 /* DisposeBase.swift */,\n\t\t\t\t0F37EAD9D1D8D2FB6651810261BBBF46 /* DistinctUntilChanged.swift */,\n\t\t\t\t02B440482343D21BF37C8EEBFF1C5CCF /* Do.swift */,\n\t\t\t\t0EF6669B25190FDAEDE27BAB84F55204 /* ElementAt.swift */,\n\t\t\t\tB64016060B7F3CF26A314585CB45DFD0 /* Empty.swift */,\n\t\t\t\t35122489B642F49DFE6C52D9E4E09C0E /* Enumerated.swift */,\n\t\t\t\tB2E3F31DB6FDAC479625DE71067CE80C /* Error.swift */,\n\t\t\t\t409C55819165E1F55424D58510B84576 /* Errors.swift */,\n\t\t\t\t0E1AE3E6B3C655AEF201B640CC018F1D /* Event.swift */,\n\t\t\t\t30563DE842A43C8F36704363A9C5BC22 /* Filter.swift */,\n\t\t\t\t14A6DEDFBF8EA2AFBD4724D73EBB2F54 /* First.swift */,\n\t\t\t\tA340ED862113C7DCC0FE8BE9EA23CB6D /* Generate.swift */,\n\t\t\t\t8FDBA54D6DC5C795FD0AACA858F8AF22 /* GroupBy.swift */,\n\t\t\t\tA9C9014E9D1DF19439018473233F3A03 /* GroupedObservable.swift */,\n\t\t\t\t3E42BC9B120A4EFF29D6369B47328835 /* HistoricalScheduler.swift */,\n\t\t\t\tC1BCB3E7FD05766A7A410C999DDA2CC4 /* HistoricalSchedulerTimeConverter.swift */,\n\t\t\t\t37CA418CBF61F9BC663BEFFBD81E8A07 /* ImmediateSchedulerType.swift */,\n\t\t\t\t70C215BF3F741BE86732441F66140470 /* Infallible.swift */,\n\t\t\t\t63821FDC18A5EE8FA3F8530585352985 /* Infallible+CombineLatest+arity.swift */,\n\t\t\t\t4BB2D836C515793F4DF34F0028F9B506 /* Infallible+Concurrency.swift */,\n\t\t\t\t0994B7709A3D2EEA03A0D4DCDF6BB178 /* Infallible+Create.swift */,\n\t\t\t\t1FEBB96E2CF8614D7D9B4C723E13CD05 /* Infallible+Operators.swift */,\n\t\t\t\tFE326FD053D97022078A0670611B80DE /* Infallible+Zip+arity.swift */,\n\t\t\t\tE4D95852033081D88BF6D8548B3FCEFD /* InfiniteSequence.swift */,\n\t\t\t\t86A3B69C60B1415D7EFACB4AC87FC192 /* InvocableScheduledItem.swift */,\n\t\t\t\t4C557EC0E4DE1B7D7656EB9CC85EB109 /* InvocableType.swift */,\n\t\t\t\tF29D165FE2D9D0FA423825E28EED78DC /* Just.swift */,\n\t\t\t\tEDBBFBF18E86573854D8F3DCA852ACF5 /* Lock.swift */,\n\t\t\t\t7C741C40114FD844B87E98FFAAB4DF12 /* LockOwnerType.swift */,\n\t\t\t\tB609E93A251E9C1DC3DDE256E69C6CA2 /* MainScheduler.swift */,\n\t\t\t\tA052D6BDAC8D3E52AB4F4FC0FDC5BD65 /* Map.swift */,\n\t\t\t\t723C108E364FBC7FBC3526D2FF87A27E /* Materialize.swift */,\n\t\t\t\t0B8A9D6B7C373B2F6EFB49C728F0AB33 /* Maybe.swift */,\n\t\t\t\t763C684698BA7C5BBC8B47F218E8EFD6 /* Merge.swift */,\n\t\t\t\t828FC8A5C5DFA8382BDB5EC7088E1A79 /* Multicast.swift */,\n\t\t\t\t4EB19619F106F74D36A9A575A06E9559 /* Never.swift */,\n\t\t\t\tBC5CA0201B6F1A81ADB4DE346D38D4AC /* NopDisposable.swift */,\n\t\t\t\t63623E296F40A0ADDBB93D580432DF4F /* Observable.swift */,\n\t\t\t\t19D7AFDA7F12C74BF1051E4316D60C0E /* Observable+Concurrency.swift */,\n\t\t\t\t0BB436B3B9955CDC6401E136D8CB2763 /* ObservableConvertibleType.swift */,\n\t\t\t\tC30ABEF30D25A49558F4DB7F874E44E0 /* ObservableConvertibleType+Infallible.swift */,\n\t\t\t\t0131D8D39CD77068996672E9A2A39EE4 /* ObservableType.swift */,\n\t\t\t\t6624BA1515ABF8CBB8CBD382A5BE4B8D /* ObservableType+Extensions.swift */,\n\t\t\t\tA50B05E705380F7B6A47CD4F8B6C1302 /* ObservableType+PrimitiveSequence.swift */,\n\t\t\t\tBE4C8593EA93085AF9AE51CEAEFB0AC3 /* ObserveOn.swift */,\n\t\t\t\tA5F7EF697C4A6F030C2755C0A53E5C9B /* ObserverBase.swift */,\n\t\t\t\t9903F12ED76D5045A9F9D51249079B93 /* ObserverType.swift */,\n\t\t\t\tA45A19B3FF575E57FEF0AC9E0CCF14A2 /* OperationQueueScheduler.swift */,\n\t\t\t\t28C911648408A33BE68A8A86F500E252 /* Optional.swift */,\n\t\t\t\tDB5968D6712C2A09EDBA89E0EAD3046E /* Platform.Darwin.swift */,\n\t\t\t\t372CA74FD5FB927C23DFD0B1B89F9627 /* Platform.Linux.swift */,\n\t\t\t\tE72A5F9AE3FC4D77EA5F51203A98DDB5 /* PrimitiveSequence.swift */,\n\t\t\t\tFC220404BDE4C21BDCE9F00438F89216 /* PrimitiveSequence+Concurrency.swift */,\n\t\t\t\t33C7A21E2CE1A670DBF7FE885C7DC0E7 /* PrimitiveSequence+Zip+arity.swift */,\n\t\t\t\t6DE6AA2E9BDBE033389EA2341B63CCBA /* PriorityQueue.swift */,\n\t\t\t\t926380597C801B4D05BD2B6EB67076F2 /* Producer.swift */,\n\t\t\t\tE4A0868043C5BC77A2DC222B14ACE05F /* PublishSubject.swift */,\n\t\t\t\tF48D36D1199BBD2CA605448FB2CDB1BF /* Queue.swift */,\n\t\t\t\t9C6DD2ADF4B543286BD0A7B6A9F276E5 /* Range.swift */,\n\t\t\t\tE65257A733C08F50E16495A11737ADE2 /* Reactive.swift */,\n\t\t\t\t8A38493B711788616ED6E680BC6B1E50 /* RecursiveLock.swift */,\n\t\t\t\tFB9A08FF569331BEA3DC8F74A0E9C754 /* RecursiveScheduler.swift */,\n\t\t\t\tC3A2949C5A39FFE4EA9DA18E153D3509 /* Reduce.swift */,\n\t\t\t\t85D3377D4F6DE195E50C7981252107B0 /* RefCountDisposable.swift */,\n\t\t\t\tF80352909FF165909045551B75275367 /* Repeat.swift */,\n\t\t\t\t8A49902E7EDED8592D89E33FB1F3C11D /* ReplaySubject.swift */,\n\t\t\t\tC54D2831DC496D0DA0DF322013C23A87 /* RetryWhen.swift */,\n\t\t\t\tD366BF46DE5636FCECC33A91A2A62D08 /* Rx.swift */,\n\t\t\t\t9FB395F92D0689BBE319FFE3E9629ED5 /* RxMutableBox.swift */,\n\t\t\t\t7E3331A80D8160095B9EDEFC659E7754 /* Sample.swift */,\n\t\t\t\t1F2B494CA299B8E5BDF7CF902C097F9E /* Scan.swift */,\n\t\t\t\t935AEC9EAAFC5F89A715886E8200C785 /* ScheduledDisposable.swift */,\n\t\t\t\t3D66784A474DE7B1E6A5296032A3893A /* ScheduledItem.swift */,\n\t\t\t\t7F6A116490C11501E17DB95E4A9E2A02 /* ScheduledItemType.swift */,\n\t\t\t\t3E7DDFF07CB880A6682C00E2573BF379 /* SchedulerServices+Emulation.swift */,\n\t\t\t\tFF02F4A025996FB90BDE36031387D29C /* SchedulerType.swift */,\n\t\t\t\tCD2B47FDA715687640B9ECBFDCEF8AF1 /* Sequence.swift */,\n\t\t\t\t28CC188C8790DB27A36C7943F08FD432 /* SerialDispatchQueueScheduler.swift */,\n\t\t\t\t229477D6AD01652D44329EF047E9F813 /* SerialDisposable.swift */,\n\t\t\t\tE8461B706FB1B7DD05B108CEB6B1C02A /* ShareReplayScope.swift */,\n\t\t\t\t913D1D51B63C727D0A5FB1BD77C85F67 /* Single.swift */,\n\t\t\t\t4AD7FBF3620F8B64384DA0E29F5C131B /* SingleAssignmentDisposable.swift */,\n\t\t\t\t0A6ABCE4C597827931B7D5EAE8C18320 /* SingleAsync.swift */,\n\t\t\t\tE0C4628EA034B666426FBED85AA8F9C6 /* Sink.swift */,\n\t\t\t\t89FA2EB233EED406AE4DAC40D842114F /* Skip.swift */,\n\t\t\t\t384D5ABEA71279A62953241037D3ABF0 /* SkipUntil.swift */,\n\t\t\t\tB3B5E1F7A06DBAB7D7F26E00F2B7EA4E /* SkipWhile.swift */,\n\t\t\t\t76FA635A597441CAA0DCEAA7A4FF9E78 /* StartWith.swift */,\n\t\t\t\t9F46E75CCEFCF37AB05C164B05BBEAC7 /* SubjectType.swift */,\n\t\t\t\t72EAB741B4B06EC3D025B47CD68FB644 /* SubscribeOn.swift */,\n\t\t\t\t8EF78473CE368CE85C5F646CB7DE6565 /* SubscriptionDisposable.swift */,\n\t\t\t\tB0F65EA7DF88BDE15ABC0967887C53DF /* SwiftSupport.swift */,\n\t\t\t\t7D6C8DA37ACBFE46CF8E3B98E83E670C /* Switch.swift */,\n\t\t\t\tA21EAF8B1A7F384F4E11BAA4DB008ECA /* SwitchIfEmpty.swift */,\n\t\t\t\t3D63F6D2E909148D9017ACBCAD047E51 /* SynchronizedDisposeType.swift */,\n\t\t\t\tCFA533C6532962A65D4EB6FC48797D33 /* SynchronizedOnType.swift */,\n\t\t\t\t1EB98FFD5D7C9C835CE062EE655DF4FF /* SynchronizedUnsubscribeType.swift */,\n\t\t\t\t55C0718AB8BFF75B7A4153E4BEA44C36 /* TailRecursiveSink.swift */,\n\t\t\t\tC9358CE4DA5674AC8E0C904B7DD9BACA /* Take.swift */,\n\t\t\t\tDCDC03877BD00C73C7908752994E6F18 /* TakeLast.swift */,\n\t\t\t\tA0E97BC9561C166ACDD7B6732E0091DB /* TakeWithPredicate.swift */,\n\t\t\t\t4DB4E63626CE473865637963F1BA7000 /* Throttle.swift */,\n\t\t\t\t9AE5A84CE200A385437C8F8D151C0869 /* Timeout.swift */,\n\t\t\t\tF5958FB9316312650DBBF3B8684DE5FC /* Timer.swift */,\n\t\t\t\tF4D00A92C852F00C01C83EEEEF8C50BB /* ToArray.swift */,\n\t\t\t\tAC1F3BDEB131637148CBB1AFD176B938 /* Using.swift */,\n\t\t\t\t2C4CA00462D7AF81CB97DA4E9C6BD8A3 /* VirtualTimeConverterType.swift */,\n\t\t\t\t10264DE3A51C28861AE7E76F4C0F8825 /* VirtualTimeScheduler.swift */,\n\t\t\t\tD7343FC62CEC5B0AA43516C7345D526E /* Window.swift */,\n\t\t\t\t6FC57D0F69947131B322E3F163DB445B /* WithLatestFrom.swift */,\n\t\t\t\t3B012AC1BB4775A5EC28815355D01128 /* WithUnretained.swift */,\n\t\t\t\tA3E935098718BDD834F8201C12FFE005 /* Zip.swift */,\n\t\t\t\tE095558419F15445B00EDE173B85AE0F /* Zip+arity.swift */,\n\t\t\t\t457B0DB19F96A3FE26CD903EBE32B403 /* Zip+Collection.swift */,\n\t\t\t\tCC399392D456A39B57A7A1E861042E9C /* Support Files */,\n\t\t\t);\n\t\t\tname = RxSwift;\n\t\t\tpath = RxSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t51CC71E921BB4F2C5767FA11A2BE055C /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t62B8649FFBA69E32A34E3DE1B0F1D971 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t62B8649FFBA69E32A34E3DE1B0F1D971 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD365A1DD95A5D4823B5A11942ACFAF93 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t745A6302F28ADA2439F621EA0F234737 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t51CC71E921BB4F2C5767FA11A2BE055C /* Frameworks */,\n\t\t\t\t7D478511B58C7E356D43E9EAF33068A2 /* Products */,\n\t\t\t\t342831380A0844956C64A25BEEC04C48 /* RxSwift */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7D478511B58C7E356D43E9EAF33068A2 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8DE4C0E7DB0FAED8D254CFA338432B04 /* RxSwift */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tCC399392D456A39B57A7A1E861042E9C /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB10649B78769CE3E3898649BFB67576F /* RxSwift.modulemap */,\n\t\t\t\t52E78429366A52FE378E9CE4EE9F363C /* RxSwift-dummy.m */,\n\t\t\t\t5EB6589FC70E0734382829B9830E301D /* RxSwift-Info.plist */,\n\t\t\t\tD954021B3B4AB7F638939EA5D5745604 /* RxSwift-prefix.pch */,\n\t\t\t\t46418EF1BD5865016420FAE80A7EBA90 /* RxSwift-umbrella.h */,\n\t\t\t\tEFF22A7CD6079BD75E789D4223133C06 /* RxSwift.debug.xcconfig */,\n\t\t\t\tC3625F658518958669E9F349CAC10EA8 /* RxSwift.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/RxSwift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t4F8325AE4A106912E653F85483DD0B74 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDAB9AF4FE685E504702AB4DA78CD4EB4 /* RxSwift-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tF0179EE061353B7A322F596E97844774 /* RxSwift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = B4E2D1F61E23FB52423FB9C5874178C4 /* Build configuration list for PBXNativeTarget \"RxSwift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t4F8325AE4A106912E653F85483DD0B74 /* Headers */,\n\t\t\t\t16D5F9C045F96CB6BC86D0EA3447DC5D /* Sources */,\n\t\t\t\tBF3C5523A9E8BA6BCF33523133BA3EDE /* Frameworks */,\n\t\t\t\t74BE248FAE4904D5A2514946C6F87407 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = RxSwift;\n\t\t\tproductName = RxSwift;\n\t\t\tproductReference = 8DE4C0E7DB0FAED8D254CFA338432B04 /* RxSwift */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tAA0626FC25346966A35C7A0A125D383A /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = C554F1D8FD3E7C1C62ABFC6216CE8FB5 /* Build configuration list for PBXProject \"RxSwift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 745A6302F28ADA2439F621EA0F234737;\n\t\t\tproductRefGroup = 7D478511B58C7E356D43E9EAF33068A2 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tF0179EE061353B7A322F596E97844774 /* RxSwift */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t74BE248FAE4904D5A2514946C6F87407 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t16D5F9C045F96CB6BC86D0EA3447DC5D /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t5027A571126888B21246D3A9BBC28088 /* AddRef.swift in Sources */,\n\t\t\t\tCCB1A55F885E49BADB0341769388E43A /* Amb.swift in Sources */,\n\t\t\t\t45C2D1AD3375062D1CE4B7F8E560B3B3 /* AnonymousDisposable.swift in Sources */,\n\t\t\t\tE747D9D51AE0F66270E93AFA34C66274 /* AnonymousObserver.swift in Sources */,\n\t\t\t\t3296D977065426CC53BE9CEAF947D9A5 /* AnyObserver.swift in Sources */,\n\t\t\t\t6CD422724978EA2A3C4320E5EF5FC2E3 /* AsMaybe.swift in Sources */,\n\t\t\t\tBF4734ED5E2ABC3DCD480E2F4D8FD4E5 /* AsSingle.swift in Sources */,\n\t\t\t\t5AECCC2F26C5416A07BA815AE796078A /* AsyncLock.swift in Sources */,\n\t\t\t\tAC6EBFB0801D2D0A402320600E88C82A /* AsyncSubject.swift in Sources */,\n\t\t\t\t086C1BBC078D07B513726C29DDBE89F9 /* AtomicInt.swift in Sources */,\n\t\t\t\tBA4472ADA09BB0860AC15673B7137BAD /* Bag.swift in Sources */,\n\t\t\t\t448F492936311DE3E05537E381C61FF5 /* Bag+Rx.swift in Sources */,\n\t\t\t\tBDD82F141523A61F84A1EFD74C939EB7 /* BehaviorSubject.swift in Sources */,\n\t\t\t\t81BC76F158C24FE975CA9C57A024BE5D /* BinaryDisposable.swift in Sources */,\n\t\t\t\tC8FA119765E5B27CF99FFD064E83F909 /* Binder.swift in Sources */,\n\t\t\t\t66ADE60CF8751D8E4C023DBC99EE9539 /* BooleanDisposable.swift in Sources */,\n\t\t\t\t2D77F6B3727F5ADDE2C04D7981DFCF75 /* Buffer.swift in Sources */,\n\t\t\t\tC740C17E9786006DC36F024F2741771A /* Cancelable.swift in Sources */,\n\t\t\t\t06F6E04B59CEC84DF49096AFAD86C6BD /* Catch.swift in Sources */,\n\t\t\t\t5E1C27FBB6B685645BB7BE28EDC5C89B /* CombineLatest.swift in Sources */,\n\t\t\t\tBE7B63B2F1A00752E2DDC907AEFD3240 /* CombineLatest+arity.swift in Sources */,\n\t\t\t\tC2DE106305B678098B12E1B4F524B1B9 /* CombineLatest+Collection.swift in Sources */,\n\t\t\t\tA5FBA19DB6F4252091D2AE50A6E6EDA6 /* CompactMap.swift in Sources */,\n\t\t\t\t019899346ED81F4573AB0A3CB9164641 /* Completable.swift in Sources */,\n\t\t\t\t64F6E1A1680D3E60922BD0F28EA478B5 /* Completable+AndThen.swift in Sources */,\n\t\t\t\t1C84AE9CF71E774F7374B3F9344E7CE2 /* CompositeDisposable.swift in Sources */,\n\t\t\t\tC5C965551370FE017808404569CCC6BB /* Concat.swift in Sources */,\n\t\t\t\tED4F788415A99C5350BF05E875049A41 /* ConcurrentDispatchQueueScheduler.swift in Sources */,\n\t\t\t\t38C65444BAB2232F172CBBC24525C35C /* ConcurrentMainScheduler.swift in Sources */,\n\t\t\t\t87F7A1DF6358F7A3F6024225026D493A /* ConnectableObservableType.swift in Sources */,\n\t\t\t\t67A1EEDA861B8EE685AC8A4716DDB452 /* Create.swift in Sources */,\n\t\t\t\t226F2EADEC4AF7F6B2FE8EF31D5CC02B /* CurrentThreadScheduler.swift in Sources */,\n\t\t\t\tB017D75CAA35E7973007168F2DF75F69 /* Date+Dispatch.swift in Sources */,\n\t\t\t\t7957708121EE01B84D95175C76B1DECC /* Debounce.swift in Sources */,\n\t\t\t\t415025D71F8F696591F7D53870F6EA94 /* Debug.swift in Sources */,\n\t\t\t\t8E0D6833AB6B04C9823521524074A316 /* Decode.swift in Sources */,\n\t\t\t\t50A31073B25050C013DC785725DF0772 /* DefaultIfEmpty.swift in Sources */,\n\t\t\t\tEEC4BE88E000DCBB469C2A2FAFB7472A /* Deferred.swift in Sources */,\n\t\t\t\tF32AB57E03DFB7BDE8DB7E442ED2BAA4 /* Delay.swift in Sources */,\n\t\t\t\tD7612CEE486A1B90B0A70E972BAA24A5 /* DelaySubscription.swift in Sources */,\n\t\t\t\t81D14FDCA28068E8E7F7919DF4866E2C /* Dematerialize.swift in Sources */,\n\t\t\t\tFD2EC1FB9138B8F851CBF129B4279BCC /* DispatchQueue+Extensions.swift in Sources */,\n\t\t\t\tE1823243B6AB3F3F3C39F3D55F22182B /* DispatchQueueConfiguration.swift in Sources */,\n\t\t\t\tCB81472D138D73C90152A60CE295600B /* Disposable.swift in Sources */,\n\t\t\t\t8396D11A46E2C9449825E617208A9CD2 /* Disposables.swift in Sources */,\n\t\t\t\tD50A8346720A78114AC67DECF0C5F16E /* DisposeBag.swift in Sources */,\n\t\t\t\t8D87A2CF4393AC8B6FD3B12FCA8C7108 /* DisposeBase.swift in Sources */,\n\t\t\t\t84C8AEF2EC6CFB6147E366D70F7FF055 /* DistinctUntilChanged.swift in Sources */,\n\t\t\t\t3A21650F09CBE1831FBE721DD709DAB4 /* Do.swift in Sources */,\n\t\t\t\t6B0C96BADD521DA546149F78B96301B3 /* ElementAt.swift in Sources */,\n\t\t\t\tB510729BC4EAB870ED9BA0A7D44B7737 /* Empty.swift in Sources */,\n\t\t\t\tF7811F911DB7435B3AB7A38B98F5B324 /* Enumerated.swift in Sources */,\n\t\t\t\tC8C0BA0EAF50527DE29D96B6C53F69CC /* Error.swift in Sources */,\n\t\t\t\tEE7505CDFB3417FB3FB38FEA95ABEB60 /* Errors.swift in Sources */,\n\t\t\t\t7A2178301E7CAE10BDE76EB50C481068 /* Event.swift in Sources */,\n\t\t\t\t820771AF442ACFBC89BFA23346ABA056 /* Filter.swift in Sources */,\n\t\t\t\t22E660E81CD084696CECA5522D13727B /* First.swift in Sources */,\n\t\t\t\tF2B153540623767DC1CC7489C338138C /* Generate.swift in Sources */,\n\t\t\t\t9408E539F7FF487D204244E858755755 /* GroupBy.swift in Sources */,\n\t\t\t\tD1BEFAA88B88C29030DCBF13A61D86D5 /* GroupedObservable.swift in Sources */,\n\t\t\t\t7BB669D177397F639915B4B9EC29EF6E /* HistoricalScheduler.swift in Sources */,\n\t\t\t\t26309E380687E17AC365A969B0D40273 /* HistoricalSchedulerTimeConverter.swift in Sources */,\n\t\t\t\tC486486178E80C12082CD098F2959562 /* ImmediateSchedulerType.swift in Sources */,\n\t\t\t\t94932D29D8AFB03647F2B5969B0F9E59 /* Infallible.swift in Sources */,\n\t\t\t\t52B63651434DA55AB2230B1D19C35427 /* Infallible+CombineLatest+arity.swift in Sources */,\n\t\t\t\t67F5F394813F91FE77E158D18E174707 /* Infallible+Concurrency.swift in Sources */,\n\t\t\t\t469D12FDE268569443CB5C411BFACA82 /* Infallible+Create.swift in Sources */,\n\t\t\t\tB53EC57DD80044C67442489520C2180D /* Infallible+Operators.swift in Sources */,\n\t\t\t\t51A88D948B5804E44439099BCAE259E5 /* Infallible+Zip+arity.swift in Sources */,\n\t\t\t\t65094386D22629854948EC52D69789E0 /* InfiniteSequence.swift in Sources */,\n\t\t\t\t12CF9C56FDFA0DBA916C91E7DE791632 /* InvocableScheduledItem.swift in Sources */,\n\t\t\t\t937F15611DD0F2F7DD52ABAD74583C9C /* InvocableType.swift in Sources */,\n\t\t\t\tBF9FF582D51611FD892015715A941792 /* Just.swift in Sources */,\n\t\t\t\tB2E510EBD0DC38E527BB6F451D4C32D6 /* Lock.swift in Sources */,\n\t\t\t\tA156F96148D6730DB5E18AFB5AABD1D3 /* LockOwnerType.swift in Sources */,\n\t\t\t\t9153528E5CD81C87F10AE7DE4DF2E4A1 /* MainScheduler.swift in Sources */,\n\t\t\t\tCDE4E4599C60D1F00FB43023CD61C0B6 /* Map.swift in Sources */,\n\t\t\t\tC3CF934571EBC1F4A1F230C51ED60362 /* Materialize.swift in Sources */,\n\t\t\t\t91F8A384FBCA808F732B5492FFAADD0D /* Maybe.swift in Sources */,\n\t\t\t\tB9F2AA513E8DC1D7F377CB0CA7B47388 /* Merge.swift in Sources */,\n\t\t\t\t0A5318AC866A98385F0B8A7C0C94708F /* Multicast.swift in Sources */,\n\t\t\t\t9D07D8DFF423E2D5B7B8B54CEB6B23E1 /* Never.swift in Sources */,\n\t\t\t\tAF68E7A15855704C483EA72F5FD2F9C7 /* NopDisposable.swift in Sources */,\n\t\t\t\t9EF6FE74DFDFAD56CFB58E4FA0BCBFAE /* Observable.swift in Sources */,\n\t\t\t\t70C9D371469D596BC953B4775DA0925D /* Observable+Concurrency.swift in Sources */,\n\t\t\t\tB510E55930409C014F603356972FCA84 /* ObservableConvertibleType.swift in Sources */,\n\t\t\t\t536F4E505B9012C4AD4B28CD521C3864 /* ObservableConvertibleType+Infallible.swift in Sources */,\n\t\t\t\tB36798B964B97D74FC4C479654437A92 /* ObservableType.swift in Sources */,\n\t\t\t\t0D4FF0B01DDB04ACD457A6152F318AF6 /* ObservableType+Extensions.swift in Sources */,\n\t\t\t\t76DE94A585B1FAD043685BACEF6C5B70 /* ObservableType+PrimitiveSequence.swift in Sources */,\n\t\t\t\t7F3FBC4CAA887D60DFC3E5725D3E70E0 /* ObserveOn.swift in Sources */,\n\t\t\t\t15E713F4897AA101FA1E6570FD594701 /* ObserverBase.swift in Sources */,\n\t\t\t\tB3480460A8A601C8810B2B97AEAE3F11 /* ObserverType.swift in Sources */,\n\t\t\t\t975320587AD0BC3BEBBED2F89A9ED43C /* OperationQueueScheduler.swift in Sources */,\n\t\t\t\t36C8E03F40EBD1C1880DDAB95AE8988C /* Optional.swift in Sources */,\n\t\t\t\tAFE1191A28173AD8B8355540D3E06A27 /* Platform.Darwin.swift in Sources */,\n\t\t\t\t11DF514DCC5B5D1E9D743195039D3C5D /* Platform.Linux.swift in Sources */,\n\t\t\t\tAE308FD1E8051074B8AC1A7FB4577779 /* PrimitiveSequence.swift in Sources */,\n\t\t\t\t925E00395EC25F1BAD1D2CA638908117 /* PrimitiveSequence+Concurrency.swift in Sources */,\n\t\t\t\tCFC59149E38952B717A689DABF1A7422 /* PrimitiveSequence+Zip+arity.swift in Sources */,\n\t\t\t\t988332AC111773C9DAE72F5532688C71 /* PriorityQueue.swift in Sources */,\n\t\t\t\t35DC586B423CD703AA701A9649FF0633 /* Producer.swift in Sources */,\n\t\t\t\t08F9C51060FD0A28DA37E280FC64CE4F /* PublishSubject.swift in Sources */,\n\t\t\t\t5BEAC40580BF7DEEB6A307F347CB95EE /* Queue.swift in Sources */,\n\t\t\t\t3C40BCD846AADDBCCBB01616FB445AF1 /* Range.swift in Sources */,\n\t\t\t\t2E01EA4D665B4681E6635D79C8582ECF /* Reactive.swift in Sources */,\n\t\t\t\tCD907B5FE3F67566AA5E609DF0EE1A6C /* RecursiveLock.swift in Sources */,\n\t\t\t\t6B1229194BEDA23C822398BD4894DF4A /* RecursiveScheduler.swift in Sources */,\n\t\t\t\tF395B57C3CA4C80DBF0C4C39BF863946 /* Reduce.swift in Sources */,\n\t\t\t\t0F1EEEA275F08A0D52A234619B8BE11D /* RefCountDisposable.swift in Sources */,\n\t\t\t\tD26206E9EA32A7DC7FCC1AE1A3CBA61E /* Repeat.swift in Sources */,\n\t\t\t\tAC5239702B8B8991821E6D016C27F6F6 /* ReplaySubject.swift in Sources */,\n\t\t\t\t45D20960EB2637EC1FAC564070CF336F /* RetryWhen.swift in Sources */,\n\t\t\t\t75DCEFDC44FACFDE3AA8A5C9333A3122 /* Rx.swift in Sources */,\n\t\t\t\t7ED6D7D2EF6FFF55046F3D3A35A082AC /* RxMutableBox.swift in Sources */,\n\t\t\t\tF9D536CC462C5ECF9983397BE5D2C5D7 /* RxSwift-dummy.m in Sources */,\n\t\t\t\t35BC9E8D1C55A8E930A903F826C4A1C2 /* Sample.swift in Sources */,\n\t\t\t\t24C24E8FA042FB69CB26B0DAC7FB5AC4 /* Scan.swift in Sources */,\n\t\t\t\t93FC3FD271ECD4F94AE7079FA47CFE92 /* ScheduledDisposable.swift in Sources */,\n\t\t\t\tB9E0BE9FEFDF1C9C945C2E7E213907E3 /* ScheduledItem.swift in Sources */,\n\t\t\t\t8E08F133D1792872AE8797D5E92B5CDD /* ScheduledItemType.swift in Sources */,\n\t\t\t\tAE4C4557C6151BC62B0FC434197BE3AC /* SchedulerServices+Emulation.swift in Sources */,\n\t\t\t\t31B23D9E34F65F2463991217F0485921 /* SchedulerType.swift in Sources */,\n\t\t\t\tC1D5BCA3245B73B12CC2D81173CAFC86 /* Sequence.swift in Sources */,\n\t\t\t\t8BFB53AA748AE30A083FB96E793D2E85 /* SerialDispatchQueueScheduler.swift in Sources */,\n\t\t\t\t3AC1693675796B9D7A50E41973010880 /* SerialDisposable.swift in Sources */,\n\t\t\t\t46A5053A29A4FD58926A1BEDA0B8D3AD /* ShareReplayScope.swift in Sources */,\n\t\t\t\t01D23591462DC8DCA05ED97B49994B1B /* Single.swift in Sources */,\n\t\t\t\tA39CF7AD7932E728672DAD83FD1FFF0C /* SingleAssignmentDisposable.swift in Sources */,\n\t\t\t\t55DB941880A7888D0D85A123A4ACEB36 /* SingleAsync.swift in Sources */,\n\t\t\t\tEF2A24C562ADAF78C5D6EA620C21FB3F /* Sink.swift in Sources */,\n\t\t\t\t6141DA2718EFD0566161F137E9E383AB /* Skip.swift in Sources */,\n\t\t\t\t84476532DE609DE15038E4538645C8F5 /* SkipUntil.swift in Sources */,\n\t\t\t\t59B3716B7858D01EED5D5AD6D8C2C066 /* SkipWhile.swift in Sources */,\n\t\t\t\t4BD9E57C387FADC64861F6BBB3A30F1F /* StartWith.swift in Sources */,\n\t\t\t\t97BED227454518035D174C46B75B20A8 /* SubjectType.swift in Sources */,\n\t\t\t\t134077B0292900713522F8CB9A61E18F /* SubscribeOn.swift in Sources */,\n\t\t\t\t67E17084FFCDAF493D1164AB257CDE0B /* SubscriptionDisposable.swift in Sources */,\n\t\t\t\tC939C9727B36ED6634ECB4361BE64F07 /* SwiftSupport.swift in Sources */,\n\t\t\t\t35B80F5760F79B7C4D9E593278D9BD1B /* Switch.swift in Sources */,\n\t\t\t\tBFADA58A29E04E7387E33812485B9894 /* SwitchIfEmpty.swift in Sources */,\n\t\t\t\tF61FCD6DFF585DBA36CC3EB99C1C093E /* SynchronizedDisposeType.swift in Sources */,\n\t\t\t\t62073F8A252E95BB2BF39B613D8727D9 /* SynchronizedOnType.swift in Sources */,\n\t\t\t\t339EA339C67B8CB4875EB0892A941443 /* SynchronizedUnsubscribeType.swift in Sources */,\n\t\t\t\t1A8A1A8CA78D0CBE9F8FFDE4A8C9C6DB /* TailRecursiveSink.swift in Sources */,\n\t\t\t\t298E4BD1F88890FB0308EFC735894E65 /* Take.swift in Sources */,\n\t\t\t\tCBF74F411902824C989B2494B4FBFD40 /* TakeLast.swift in Sources */,\n\t\t\t\tE71C5979D34AC68A188101B4E315906D /* TakeWithPredicate.swift in Sources */,\n\t\t\t\t8C9A6D3350BB4DEDBF1C73C8DAAABC17 /* Throttle.swift in Sources */,\n\t\t\t\t5EF265759C85C51B8228988F276513EB /* Timeout.swift in Sources */,\n\t\t\t\t2CADB9CEDFCBFB51298A0F180F528943 /* Timer.swift in Sources */,\n\t\t\t\t60B5316B54B52B0C5F3613EEFFF8CFDC /* ToArray.swift in Sources */,\n\t\t\t\t799903397E2ADC779776577BAB2CCE20 /* Using.swift in Sources */,\n\t\t\t\tAED89C7C5187F3FE2D802CD4A6E6A7F3 /* VirtualTimeConverterType.swift in Sources */,\n\t\t\t\t900275BCED06EFF4B59B56F53ABC1DB0 /* VirtualTimeScheduler.swift in Sources */,\n\t\t\t\t5397DF98116AD476F64F1CE3C876543D /* Window.swift in Sources */,\n\t\t\t\t1B6D0B5C8D50557BA362EADF160B031A /* WithLatestFrom.swift in Sources */,\n\t\t\t\tAA1E499298EB99A9E83B5BB5AEAF9D4D /* WithUnretained.swift in Sources */,\n\t\t\t\t541014136DA36A7064B5360801EA4830 /* Zip.swift in Sources */,\n\t\t\t\t1452D00AF7A9643A2EEFBFA29FA4E749 /* Zip+arity.swift in Sources */,\n\t\t\t\t11C8A9F94E68A9809D20916C96CCDDF6 /* Zip+Collection.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t122884F2A07507375A4984A074322B8F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t16180B8274624CE7954B2E15118CA681 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = EFF22A7CD6079BD75E789D4223133C06 /* RxSwift.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxSwift/RxSwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxSwift/RxSwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxSwift/RxSwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxSwift;\n\t\t\t\tPRODUCT_NAME = RxSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tA4C218879A82FB981A79ABE23E095C84 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = C3625F658518958669E9F349CAC10EA8 /* RxSwift.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxSwift/RxSwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxSwift/RxSwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxSwift/RxSwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxSwift;\n\t\t\t\tPRODUCT_NAME = RxSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tFEC189919E84797158D614E18CC9A96C /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tB4E2D1F61E23FB52423FB9C5874178C4 /* Build configuration list for PBXNativeTarget \"RxSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t16180B8274624CE7954B2E15118CA681 /* Debug */,\n\t\t\t\tA4C218879A82FB981A79ABE23E095C84 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tC554F1D8FD3E7C1C62ABFC6216CE8FB5 /* Build configuration list for PBXProject \"RxSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tFEC189919E84797158D614E18CC9A96C /* Debug */,\n\t\t\t\t122884F2A07507375A4984A074322B8F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = AA0626FC25346966A35C7A0A125D383A /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/LICENSE",
    "content": "Copyright (c) 2018 RxSwiftCommunity\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/README.md",
    "content": "# RxTheme\n\n[![Build Status](https://travis-ci.org/RxSwiftCommunity/RxTheme.svg?branch=master)](https://travis-ci.org/RxSwiftCommunity/RxTheme)\n[![Version](https://img.shields.io/cocoapods/v/RxTheme.svg?style=flat)](http://cocoapods.org/pods/RxTheme)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/RxTheme.svg?style=flat)](http://cocoapods.org/pods/RxTheme)\n[![Platform](https://img.shields.io/cocoapods/p/RxTheme.svg?style=flat)](http://cocoapods.org/pods/RxTheme)\n\n## Manual\n\n### Define theme service\n\n```swift\nimport RxTheme\n\nprotocol Theme {\n    var backgroundColor: UIColor { get }\n    var textColor: UIColor { get }\n}\n\nstruct LightTheme: Theme {\n    let backgroundColor = .white\n    let textColor = .black\n}\n\nstruct DarkTheme: Theme {\n    let backgroundColor = .black\n    let textColor = .white\n}\n\nenum ThemeType: ThemeProvider {\n    case light, dark\n    var associatedObject: Theme {\n        switch self {\n        case .light:\n            return LightTheme()\n        case .dark:\n            return DarkTheme()\n        }\n    }\n}\n\nlet themeService = ThemeType.service(initial: .light)\n```\n\n### Apply theme to UI\n\n```swift\n\n// Bind stream to a single attribute\n// RxTheme would automatically manage the lifecycle of the binded stream\nview.theme.backgroundColor = themeService.attribute { $0.backgroundColor }\n```\n\n### Switch themes\n\n```swift\nthemeService.switch(.dark)\n// When this is triggered by some signal, you can use:\nsomeSignal.bind(to: themeService.switcher)\n```\n\n### Other APIs\n\n```swift\n// Current theme type\nthemeService.type\n// Theme type stream\nthemeService.typeStream\n```\n\n## Examples\n\nYou can run the example project, clone the repo, run `pod install` from the Example directory first, and open up the workspace file.\n\n## Installation\n\n### SPM\n\n1. File > Swift Packages > Add Package Dependency\n2. Add https://github.com/RxSwiftCommunity/RxTheme\n\n### Cocoapods\n\n```ruby\npod 'RxTheme', '~> 5.0'\n```\n\n### Carthage\n\n```\ngithub \"RxSwiftCommunity/RxTheme\" ~> 5.0.0\n```\n\n## Author\n\nduan, wddwyss@gmail.com\n\n## License\n\nRxTheme is available under the MIT license. See the LICENSE file for more info.\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/CALayer+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS) || os(macOS)\n\n\nimport QuartzCore\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: CALayer {\n\n    /// (set only) bind a stream to backgroundColor\n    var backgroundColor: ThemeAttribute<CGColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.backgroundColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.backgroundColor)\n            hold(disposable, for: \"backgroundColor\")\n        }\n    }\n\n    /// (set only) bind a stream to borderWidth\n    var borderWidth: ThemeAttribute<CGFloat> {\n        get { fatalError(\"set only\") }\n        set {\n            base.borderWidth = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.borderWidth)\n            hold(disposable, for: \"borderWidth\")\n        }\n    }\n\n    /// (set only) bind a stream to borderColor\n    var borderColor: ThemeAttribute<CGColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.borderColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.borderColor)\n            hold(disposable, for: \"borderColor\")\n        }\n    }\n\n    /// (set only) bind a stream to shadowColor\n    var shadowColor: ThemeAttribute<CGColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.shadowColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.shadowColor)\n            hold(disposable, for: \"shadowColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/CAShapeLayer+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS) || os(macOS)\n\n\nimport QuartzCore\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: CAShapeLayer {\n\n    /// (set only) bind a stream to strokeColor\n    var strokeColor: ThemeAttribute<CGColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.strokeColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.strokeColor)\n            hold(disposable, for: \"strokeColor\")\n        }\n    }\n\n    /// (set only) bind a stream to fillColor\n    var fillColor: ThemeAttribute<CGColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.fillColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.fillColor)\n            hold(disposable, for: \"fillColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UIActivityIndicatorView+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UIActivityIndicatorView {\n\n    /// (set only) bind a stream to style\n    var style: ThemeAttribute<UIActivityIndicatorView.Style> {\n        get { fatalError(\"set only\") }\n        set {\n            base.style = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.style)\n            hold(disposable, for: \"style\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UIBarButtonItem+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UIBarButtonItem {\n\n    /// (set only) bind a stream to tintColor\n    var tintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.tintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.tintColor)\n            hold(disposable, for: \"tintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UIButton+Theme.swift",
    "content": "//\n//  UIButton+Theme.swift\n//  Pods\n//\n//  Created by duan on 2019/01/23.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\nextension Reactive where Base: UIButton {\n\n    /// Bindable sink for `titleColor` property\n    func titleColor(for state: UIControl.State) -> Binder<UIColor?> {\n        return Binder(self.base) { view, attr in\n            view.setTitleColor(attr, for: state)\n        }\n    }\n\n}\n\npublic extension ThemeProxy where Base: UIButton {\n\n    func titleColor(from newValue: ThemeAttribute<UIColor?>, for state: UIControl.State) {\n        base.setTitleColor(newValue.value, for: state)\n        let disposable = newValue.stream\n            .take(until: base.rx.deallocating)\n            .observe(on: MainScheduler.instance)\n            .bind(to: base.rx.titleColor(for: state))\n        hold(disposable, for: \"titleColor.forState.\\(state.rawValue)\")\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UILabel+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UILabel {\n\n    /// (set only) bind a stream to font\n    var font: ThemeAttribute<UIFont> {\n        get { fatalError(\"set only\") }\n        set {\n            base.font = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.font)\n            hold(disposable, for: \"font\")\n        }\n    }\n\n    /// (set only) bind a stream to textColor\n    var textColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.textColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.textColor)\n            hold(disposable, for: \"textColor\")\n        }\n    }\n\n    /// (set only) bind a stream to highlightedTextColor\n    var highlightedTextColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.highlightedTextColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.highlightedTextColor)\n            hold(disposable, for: \"highlightedTextColor\")\n        }\n    }\n\n    /// (set only) bind a stream to shadowColor\n    var shadowColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.shadowColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.shadowColor)\n            hold(disposable, for: \"shadowColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UINavigationBar+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UINavigationBar {\n\n    /// (set only) bind a stream to barStyle\n    var barStyle: ThemeAttribute<UIBarStyle> {\n        get { fatalError(\"set only\") }\n        set {\n            base.barStyle = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barStyle)\n            hold(disposable, for: \"barStyle\")\n        }\n    }\n\n    /// (set only) bind a stream to barTintColor\n    var barTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            if let value = newValue.value {\n                base.barTintColor = value\n            }\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barTintColor)\n            hold(disposable, for: \"barTintColor\")\n        }\n    }\n\n    /// (set only) bind a stream to titleTextAttributes\n    var titleTextAttributes: ThemeAttribute<[NSAttributedString.Key: Any]?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.titleTextAttributes = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.titleTextAttributes)\n            hold(disposable, for: \"titleTextAttributes\")\n        }\n    }\n\n    /// (set only) bind a stream to largeTitleTextAttributes\n    @available(iOS 11.0, *)\n    var largeTitleTextAttributes: ThemeAttribute<[NSAttributedString.Key: Any]?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.largeTitleTextAttributes = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.largeTitleTextAttributes)\n            hold(disposable, for: \"largeTitleTextAttributes\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UIPageControl+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UIPageControl {\n\n    /// (set only) bind a stream to pageIndicatorTintColor\n    var pageIndicatorTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.pageIndicatorTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.pageIndicatorTintColor)\n            hold(disposable, for: \"pageIndicatorTintColor\")\n        }\n    }\n\n    /// (set only) bind a stream to currentPageIndicatorTintColor\n    var currentPageIndicatorTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.currentPageIndicatorTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.currentPageIndicatorTintColor)\n            hold(disposable, for: \"currentPageIndicatorTintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UIProgressView+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UIProgressView {\n\n    /// (set only) bind a stream to progressTintColor\n    var progressTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.progressTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.progressTintColor)\n            hold(disposable, for: \"progressTintColor\")\n        }\n    }\n\n    /// (set only) bind a stream to trackTintColor\n    var trackTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.trackTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.trackTintColor)\n            hold(disposable, for: \"trackTintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UISearchBar+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UISearchBar {\n\n    /// (set only) bind a stream to barStyle\n    var barStyle: ThemeAttribute<UIBarStyle> {\n        get { fatalError(\"set only\") }\n        set {\n            base.barStyle = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barStyle)\n            hold(disposable, for: \"barStyle\")\n        }\n    }\n\n    /// (set only) bind a stream to barTintColor\n    var barTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.barTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barTintColor)\n            hold(disposable, for: \"barTintColor\")\n        }\n    }\n\n    /// (set only) bind a stream to keyboardAppearance\n    var keyboardAppearance: ThemeAttribute<UIKeyboardAppearance> {\n        get { fatalError(\"set only\") }\n        set {\n            base.keyboardAppearance = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.keyboardAppearance)\n            hold(disposable, for: \"keyboardAppearance\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UISegmentedControl+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UISegmentedControl {\n\n    /// (set only) bind a stream to style\n    @available(iOS 13, tvOS 13, *)\n    var selectedSegmentTintColor: ThemeAttribute<UIColor> {\n        get { fatalError(\"set only\") }\n        set {\n            base.selectedSegmentTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.selectedSegmentTintColor)\n            hold(disposable, for: \"selectedSegmentTintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UISlider+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UISlider {\n\n    /// (set only) bind a stream to thumbTintColor\n    var thumbTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.thumbTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.thumbTintColor)\n            hold(disposable, for: \"thumbTintColor\")\n        }\n    }\n\n    /// (set only) bind a stream to minimumTrackTintColor\n    var minimumTrackTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.minimumTrackTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.minimumTrackTintColor)\n            hold(disposable, for: \"minimumTrackTintColor\")\n        }\n    }\n\n    /// (set only) bind a stream to maximumTrackTintColor\n    var maximumTrackTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.maximumTrackTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.maximumTrackTintColor)\n            hold(disposable, for: \"maximumTrackTintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UISwitch+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UISwitch {\n\n    /// (set only) bind a stream to onTintColor\n    var onTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.onTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.onTintColor)\n            hold(disposable, for: \"onTintColor\")\n        }\n    }\n\n    /// (set only) bind a stream to thumbTintColor\n    var thumbTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.thumbTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.thumbTintColor)\n            hold(disposable, for: \"thumbTintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UITAbleViewCell+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UITableViewCell {\n\n    /// (set only) bind a stream to selectionStyle\n    var selectionStyle: ThemeAttribute<UITableViewCell.SelectionStyle> {\n        get { fatalError(\"set only\") }\n        set {\n            base.selectionStyle = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.selectionStyle)\n            hold(disposable, for: \"selectionStyle\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UITabBar+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UITabBar {\n\n    /// (set only) bind a stream to barStyle\n    var barStyle: ThemeAttribute<UIBarStyle> {\n        get { fatalError(\"set only\") }\n        set {\n            base.barStyle = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barStyle)\n            hold(disposable, for: \"barStyle\")\n        }\n    }\n\n    /// (set only) bind a stream to barTintColor\n    var barTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.barTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barTintColor)\n            hold(disposable, for: \"barTintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UITableView+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UITableView {\n\n    /// (set only) bind a stream to separatorColor\n    var separatorColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.separatorColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.separatorColor)\n            hold(disposable, for: \"separatorColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UITextField+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UITextField {\n\n    /// (set only) bind a stream to font\n    var font: ThemeAttribute<UIFont?> {\n        get { fatalError(\"set only\") }\n        set {\n            if let value = newValue.value {\n                base.font = value\n            }\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.font)\n            hold(disposable, for: \"font\")\n        }\n    }\n\n    /// (set only) bind a stream to textColor\n    var textColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            if let value = newValue.value {\n                base.textColor = value\n            }\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.textColor)\n            hold(disposable, for: \"textColor\")\n        }\n    }\n\n    /// (set only) bind a stream to keyboardAppearance\n    var keyboardAppearance: ThemeAttribute<UIKeyboardAppearance> {\n        get { fatalError(\"set only\") }\n        set {\n            base.keyboardAppearance = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.keyboardAppearance)\n            hold(disposable, for: \"keyboardAppearance\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UITextView+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UITextView {\n\n    /// (set only) bind a stream to font\n    var font: ThemeAttribute<UIFont?> {\n        get { fatalError(\"set only\") }\n        set {\n            if let value = newValue.value {\n                base.font = value\n            }\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.font)\n            hold(disposable, for: \"font\")\n        }\n    }\n\n    /// (set only) bind a stream to textColor\n    var textColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            if let value = newValue.value {\n                base.textColor = value\n            }\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.textColor)\n            hold(disposable, for: \"textColor\")\n        }\n    }\n\n    /// (set only) bind a stream to keyboardAppearance\n    var keyboardAppearance: ThemeAttribute<UIKeyboardAppearance> {\n        get { fatalError(\"set only\") }\n        set {\n            base.keyboardAppearance = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.keyboardAppearance)\n            hold(disposable, for: \"keyboardAppearance\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UIToolbar+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UIToolbar {\n\n    /// (set only) bind a stream to barStyle\n    var barStyle: ThemeAttribute<UIBarStyle> {\n        get { fatalError(\"set only\") }\n        set {\n            base.barStyle = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barStyle)\n            hold(disposable, for: \"barStyle\")\n        }\n    }\n\n    /// (set only) bind a stream to barTintColor\n    var barTintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.barTintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.barTintColor)\n            hold(disposable, for: \"barTintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/Extensions/UIView+Theme.swift",
    "content": "//\n//  Created by duan on 2018/3/7.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\n\nimport UIKit\nimport RxSwift\nimport RxCocoa\n\n\npublic extension ThemeProxy where Base: UIView {\n\n    /// (set only) bind a stream to backgroundColor\n    var backgroundColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.backgroundColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.backgroundColor)\n            hold(disposable, for: \"backgroundColor\")\n        }\n    }\n\n    /// (set only) bind a stream to tintColor\n    var tintColor: ThemeAttribute<UIColor?> {\n        get { fatalError(\"set only\") }\n        set {\n            base.tintColor = newValue.value\n            let disposable = newValue.stream\n                .take(until: base.rx.deallocating)\n                .observe(on: MainScheduler.instance)\n                .bind(to: base.rx.tintColor)\n            hold(disposable, for: \"tintColor\")\n        }\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/ThemeAttribute.swift",
    "content": "//\n//  ThemeAttribute.swift\n//  Pods\n//\n//  Created by mk on 2021/4/23.\n//\n\nimport Foundation\nimport RxSwift\n\npublic struct ThemeAttribute<T> {\n    public var value: T\n    public var stream: Observable<T>\n}\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/ThemeProvider.swift",
    "content": "//\n//  ThemeProvider.swift\n//\n//  Created by duan on 2019/01/22.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\nimport Foundation\n\n\n// TODO: better implementation when Swift releases more generic Enum\npublic protocol ThemeProvider: Hashable {\n    associatedtype T\n    var associatedObject: T { get }\n}\n\npublic extension ThemeProvider {\n    /// Generate Theme service\n    static func service(initial: Self) -> ThemeService<Self> {\n        return ThemeService(initial: initial)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/ThemeProxy.swift",
    "content": "//\n//  ThemeProxy.swift\n//\n//  Created by duan on 2019/01/22.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\nimport Foundation\nimport ObjectiveC\nimport RxSwift\n\n\npublic protocol ThemeCompatible {\n    associatedtype CompatibleType\n    var theme: ThemeProxy<CompatibleType> { get }\n}\n\nextension ThemeCompatible {\n    public var theme: ThemeProxy<Self> { return ThemeProxy(self) }\n}\n\nextension NSObject: ThemeCompatible {}\n\nprivate var ThemeProxyDisposablesHandle: UInt8 = 0\n\npublic class ThemeProxy<Base> {\n    /// Base object to extend.\n    public let base: Base\n\n    /// Creates extensions with base object.\n    ///\n    /// - parameter base: Base object.\n    public init(_ base: Base) {\n        self.base = base\n    }\n\n    /// Hold disposable for key, override if already exist\n    public func hold(_ disposable: Disposable, for key: String) {\n        let rv = disposables\n        if let prev = rv[key] as? Disposable {\n            prev.dispose()\n        }\n        rv[key] = disposable\n        disposables = rv\n    }\n\n    private var disposables: NSMutableDictionary {\n        get {\n            let val = objc_getAssociatedObject(\n                base,\n                &ThemeProxyDisposablesHandle\n            ) as? NSMutableDictionary\n            return val ?? [:]\n        }\n        set {\n            objc_setAssociatedObject(\n                base, &ThemeProxyDisposablesHandle,\n                newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC\n            )\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/RxTheme/Sources/ThemeService.swift",
    "content": "//\n//  ThemeService.swift\n//\n//  Created by duan on 2019/01/22.\n//  2018 Copyright (c) RxSwiftCommunity. All rights reserved.\n//\n\nimport Foundation\nimport RxSwift\nimport RxCocoa\n\n\npublic class ThemeService<Provider: ThemeProvider>: NSObject {\n    init(initial: Provider) {\n        self.relay = BehaviorRelay<Provider>(value: initial)\n    }\n\n    private let relay: BehaviorRelay<Provider>\n    private var cache = [Provider: Provider.T]()\n    private func getAssociatedObject(_ key: Provider) -> Provider.T {\n        if let cached = cache[key] { return cached }\n        let object = key.associatedObject\n        cache[key] = object\n        return object\n    }\n\n    /// Current theme type\n    public var type: Provider { return self.relay.value }\n\n    /// Theme type stream\n    public var typeStream: Observable<Provider> {\n        return relay.asObservable()\n    }\n\n    /// Current theme attributes\n    public func attribute<U>(_ mapper: @escaping ((Provider.T) -> U)) -> ThemeAttribute<U> {\n        return ThemeAttribute(\n            value: mapper(self.getAssociatedObject(self.type)),\n            stream: relay.map { [unowned self] in self.getAssociatedObject($0) }.map(mapper)\n        )\n    }\n\n    /// Update theme type\n    public func `switch`(_ theme: Provider) {\n        self.relay.accept(theme)\n    }\n\n    /// Bindable sink for theme switch\n    public var switcher: Binder<Provider> {\n        return Binder(self) { obj, attr in\n            obj.switch(attr)\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "JetChat/Pods/RxTheme.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t00B84B318B557C6FBEEBF93CCD3FFAC2 /* UITabBar+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8498CC0610306A664CF6E29F899E6A7 /* UITabBar+Theme.swift */; };\n\t\t08A96A7F15147B644D310FB5F53CB2AF /* UIPageControl+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEAAC55E3F5C56C23E3A4DC734E4D833 /* UIPageControl+Theme.swift */; };\n\t\t217B3A81C9FF516123ECDC81D0D1931C /* UITAbleViewCell+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB86599CCFD30B09FB5F0E0386520F6 /* UITAbleViewCell+Theme.swift */; };\n\t\t2CB28D014C90911F998DD0F7032C4612 /* UIButton+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A59FB7A48F8265B6F48E398E1949CDF /* UIButton+Theme.swift */; };\n\t\t2F262E8B22AC4941DBB619D72C5D17D2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CFB604C62428DD1BD44F8E8B1C49A20 /* Foundation.framework */; };\n\t\t2F5CCB13CF68E8B2DFE046325DD72844 /* UILabel+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = D54BDFBBFA99CDB9DA3D4CA9CAB4E932 /* UILabel+Theme.swift */; };\n\t\t371658CC3D0B27EECF6C41A49C9A0356 /* ThemeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DFB68C57A1F09FE0F012E0649841259 /* ThemeService.swift */; };\n\t\t4C5253F41E2F04A743BAFC584A120F79 /* UISlider+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C80F87DBB44255AD7E8044E7628138 /* UISlider+Theme.swift */; };\n\t\t53DB00A4BF49DDAB413CF803A1C22CC5 /* UIActivityIndicatorView+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A49B18663AD3A09556FA2A514DE56FD /* UIActivityIndicatorView+Theme.swift */; };\n\t\t544838644EDACB9C3AC73180143830F8 /* ThemeAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD9A67CD92DA395C33A66ED044C8CE31 /* ThemeAttribute.swift */; };\n\t\t5CCDEF7998E2E9A56DA13DD4C35B507E /* UISearchBar+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC5B6A3665B70A7A16B624E3DAF8BDAC /* UISearchBar+Theme.swift */; };\n\t\t6856517DC92C0326AE7FD1AF3530C384 /* UINavigationBar+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4240B289FB2E1875EA651526EFAE854 /* UINavigationBar+Theme.swift */; };\n\t\t68F2BC365AD82A3F647310D4DC2945AC /* UIView+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9131ADA29D82ECB74C8B1F0F369E680E /* UIView+Theme.swift */; };\n\t\t7294B17266217C97F2434CAC471542B7 /* UIBarButtonItem+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 281229955878CC6E9FFAABD8040AAC73 /* UIBarButtonItem+Theme.swift */; };\n\t\t769E6A700479C79226AAE7ED7F9960F7 /* RxTheme-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C03B870E83DC105A3516F950D5CDD684 /* RxTheme-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t872AB6046CDF2C85A7CE788BAEA3855B /* CALayer+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88FCC7C49D3DC396D948C7CA2243BB6C /* CALayer+Theme.swift */; };\n\t\t888EFEC02EC754211EDB9BED24F06F87 /* UIToolbar+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86F59B970B56DAD6B62AAA3B69BB842C /* UIToolbar+Theme.swift */; };\n\t\t8BA4FA5476F4FA6AC728C302F0C9DF08 /* UITextField+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BD129E00B4180D4BF3AF9DE6D815364 /* UITextField+Theme.swift */; };\n\t\t8F9DB0DFCC179F81F6A45F89B900FB06 /* UITextView+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A211A5E00C31BCECC30A84C61406313 /* UITextView+Theme.swift */; };\n\t\tA4617FA3355A95E0AE7846101D1E4211 /* UISegmentedControl+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF9FE339E1607184E0AA50BACCD53219 /* UISegmentedControl+Theme.swift */; };\n\t\tB46AE523F0439679A39E280E807D5F04 /* UISwitch+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDE997806C86D5AB33DD0A8B19ADCDAC /* UISwitch+Theme.swift */; };\n\t\tBA8F061E5255A2279A5A7FAEA81FCCC4 /* UIProgressView+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA7E984EFB59FEB771934DCD59A67C0 /* UIProgressView+Theme.swift */; };\n\t\tC13A0798B2906D41DFAA7F9414A84C90 /* CAShapeLayer+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E3C1A8030662798A88BFC076DB1F6CB /* CAShapeLayer+Theme.swift */; };\n\t\tC45A8867D2D90C6713F2B386E572B153 /* RxTheme-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = AB43521140EF0FD565BE8D5FA58DEF82 /* RxTheme-dummy.m */; };\n\t\tDBF4E1954FCE7F40BCC5670680DB9256 /* ThemeProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53204E56A6E77185E1AE712C9D9E53D4 /* ThemeProvider.swift */; };\n\t\tE88F3F12A7A8F6986B64E89C592D8750 /* ThemeProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D856F0F5BF817B964DF8BC27BC796B3 /* ThemeProxy.swift */; };\n\t\tF19ACA69AC33C3AC40E991B319C94110 /* UITableView+Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = B17718BEA95AA0B2AD2AAD2EF0DE5798 /* UITableView+Theme.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t84F1C2E63D63DE25AC1D535F20EB2CC9 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 88BF26F3D3FEEFD3CC0043324EDDE9F7 /* RxSwift.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = F0179EE061353B7A322F596E97844774;\n\t\t\tremoteInfo = RxSwift;\n\t\t};\n\t\t8F755E43B587B5DDF678B5C8EC1FBA26 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 726EF7675FACE7ADB88CC6ADB7F2D253 /* RxCocoa.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = BC5183FBB16A06C1D86620B00CFE6269;\n\t\t\tremoteInfo = RxCocoa;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t0EA7E984EFB59FEB771934DCD59A67C0 /* UIProgressView+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIProgressView+Theme.swift\"; path = \"Sources/Extensions/UIProgressView+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t1E3C1A8030662798A88BFC076DB1F6CB /* CAShapeLayer+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"CAShapeLayer+Theme.swift\"; path = \"Sources/Extensions/CAShapeLayer+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t281229955878CC6E9FFAABD8040AAC73 /* UIBarButtonItem+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIBarButtonItem+Theme.swift\"; path = \"Sources/Extensions/UIBarButtonItem+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t2CFB604C62428DD1BD44F8E8B1C49A20 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t3DFB68C57A1F09FE0F012E0649841259 /* ThemeService.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThemeService.swift; path = Sources/ThemeService.swift; sourceTree = \"<group>\"; };\n\t\t462680FD13598CC1D5228119E707954B /* RxTheme.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxTheme.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t4D856F0F5BF817B964DF8BC27BC796B3 /* ThemeProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThemeProxy.swift; path = Sources/ThemeProxy.swift; sourceTree = \"<group>\"; };\n\t\t53204E56A6E77185E1AE712C9D9E53D4 /* ThemeProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThemeProvider.swift; path = Sources/ThemeProvider.swift; sourceTree = \"<group>\"; };\n\t\t5A211A5E00C31BCECC30A84C61406313 /* UITextView+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITextView+Theme.swift\"; path = \"Sources/Extensions/UITextView+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t5E559FEB032D5416FEE1577B066ECE72 /* RxTheme */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxTheme; path = RxTheme.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t6A49B18663AD3A09556FA2A514DE56FD /* UIActivityIndicatorView+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIActivityIndicatorView+Theme.swift\"; path = \"Sources/Extensions/UIActivityIndicatorView+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t726EF7675FACE7ADB88CC6ADB7F2D253 /* RxCocoa */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxCocoa; path = RxCocoa.xcodeproj; sourceTree = \"<group>\"; };\n\t\t785775A614F58B074D4AF455BB8382F2 /* RxTheme-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxTheme-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t7BB86599CCFD30B09FB5F0E0386520F6 /* UITAbleViewCell+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITAbleViewCell+Theme.swift\"; path = \"Sources/Extensions/UITAbleViewCell+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t84C80F87DBB44255AD7E8044E7628138 /* UISlider+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISlider+Theme.swift\"; path = \"Sources/Extensions/UISlider+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t86F59B970B56DAD6B62AAA3B69BB842C /* UIToolbar+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIToolbar+Theme.swift\"; path = \"Sources/Extensions/UIToolbar+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t88BF26F3D3FEEFD3CC0043324EDDE9F7 /* RxSwift */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = RxSwift; path = RxSwift.xcodeproj; sourceTree = \"<group>\"; };\n\t\t88FCC7C49D3DC396D948C7CA2243BB6C /* CALayer+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"CALayer+Theme.swift\"; path = \"Sources/Extensions/CALayer+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t8A59FB7A48F8265B6F48E398E1949CDF /* UIButton+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIButton+Theme.swift\"; path = \"Sources/Extensions/UIButton+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t8BD129E00B4180D4BF3AF9DE6D815364 /* UITextField+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITextField+Theme.swift\"; path = \"Sources/Extensions/UITextField+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\t9131ADA29D82ECB74C8B1F0F369E680E /* UIView+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIView+Theme.swift\"; path = \"Sources/Extensions/UIView+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tA8498CC0610306A664CF6E29F899E6A7 /* UITabBar+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITabBar+Theme.swift\"; path = \"Sources/Extensions/UITabBar+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tAB43521140EF0FD565BE8D5FA58DEF82 /* RxTheme-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"RxTheme-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tAC5B6A3665B70A7A16B624E3DAF8BDAC /* UISearchBar+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISearchBar+Theme.swift\"; path = \"Sources/Extensions/UISearchBar+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tAF918B3A1D0CAF364DD367AE08C53C65 /* RxTheme.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = RxTheme.modulemap; sourceTree = \"<group>\"; };\n\t\tB17718BEA95AA0B2AD2AAD2EF0DE5798 /* UITableView+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UITableView+Theme.swift\"; path = \"Sources/Extensions/UITableView+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tB4240B289FB2E1875EA651526EFAE854 /* UINavigationBar+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UINavigationBar+Theme.swift\"; path = \"Sources/Extensions/UINavigationBar+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tC03B870E83DC105A3516F950D5CDD684 /* RxTheme-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"RxTheme-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tCD9A67CD92DA395C33A66ED044C8CE31 /* ThemeAttribute.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThemeAttribute.swift; path = Sources/ThemeAttribute.swift; sourceTree = \"<group>\"; };\n\t\tD54BDFBBFA99CDB9DA3D4CA9CAB4E932 /* UILabel+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UILabel+Theme.swift\"; path = \"Sources/Extensions/UILabel+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tDD3DA3914C320EEF3A39BC9487419C4B /* RxTheme.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxTheme.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tDDE997806C86D5AB33DD0A8B19ADCDAC /* UISwitch+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISwitch+Theme.swift\"; path = \"Sources/Extensions/UISwitch+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tEDBBE5F25AECCDA3AC27ECABFC7ECAF6 /* RxTheme-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"RxTheme-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tEEAAC55E3F5C56C23E3A4DC734E4D833 /* UIPageControl+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UIPageControl+Theme.swift\"; path = \"Sources/Extensions/UIPageControl+Theme.swift\"; sourceTree = \"<group>\"; };\n\t\tEF9FE339E1607184E0AA50BACCD53219 /* UISegmentedControl+Theme.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UISegmentedControl+Theme.swift\"; path = \"Sources/Extensions/UISegmentedControl+Theme.swift\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t81E19BB9B96949EACFBCCFF452CE525F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t2F262E8B22AC4941DBB619D72C5D17D2 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2A5F9C658E049C7B2CC4A4B18DA945BE /* RxTheme */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t88FCC7C49D3DC396D948C7CA2243BB6C /* CALayer+Theme.swift */,\n\t\t\t\t1E3C1A8030662798A88BFC076DB1F6CB /* CAShapeLayer+Theme.swift */,\n\t\t\t\tCD9A67CD92DA395C33A66ED044C8CE31 /* ThemeAttribute.swift */,\n\t\t\t\t53204E56A6E77185E1AE712C9D9E53D4 /* ThemeProvider.swift */,\n\t\t\t\t4D856F0F5BF817B964DF8BC27BC796B3 /* ThemeProxy.swift */,\n\t\t\t\t3DFB68C57A1F09FE0F012E0649841259 /* ThemeService.swift */,\n\t\t\t\t6A49B18663AD3A09556FA2A514DE56FD /* UIActivityIndicatorView+Theme.swift */,\n\t\t\t\t281229955878CC6E9FFAABD8040AAC73 /* UIBarButtonItem+Theme.swift */,\n\t\t\t\t8A59FB7A48F8265B6F48E398E1949CDF /* UIButton+Theme.swift */,\n\t\t\t\tD54BDFBBFA99CDB9DA3D4CA9CAB4E932 /* UILabel+Theme.swift */,\n\t\t\t\tB4240B289FB2E1875EA651526EFAE854 /* UINavigationBar+Theme.swift */,\n\t\t\t\tEEAAC55E3F5C56C23E3A4DC734E4D833 /* UIPageControl+Theme.swift */,\n\t\t\t\t0EA7E984EFB59FEB771934DCD59A67C0 /* UIProgressView+Theme.swift */,\n\t\t\t\tAC5B6A3665B70A7A16B624E3DAF8BDAC /* UISearchBar+Theme.swift */,\n\t\t\t\tEF9FE339E1607184E0AA50BACCD53219 /* UISegmentedControl+Theme.swift */,\n\t\t\t\t84C80F87DBB44255AD7E8044E7628138 /* UISlider+Theme.swift */,\n\t\t\t\tDDE997806C86D5AB33DD0A8B19ADCDAC /* UISwitch+Theme.swift */,\n\t\t\t\tA8498CC0610306A664CF6E29F899E6A7 /* UITabBar+Theme.swift */,\n\t\t\t\tB17718BEA95AA0B2AD2AAD2EF0DE5798 /* UITableView+Theme.swift */,\n\t\t\t\t7BB86599CCFD30B09FB5F0E0386520F6 /* UITAbleViewCell+Theme.swift */,\n\t\t\t\t8BD129E00B4180D4BF3AF9DE6D815364 /* UITextField+Theme.swift */,\n\t\t\t\t5A211A5E00C31BCECC30A84C61406313 /* UITextView+Theme.swift */,\n\t\t\t\t86F59B970B56DAD6B62AAA3B69BB842C /* UIToolbar+Theme.swift */,\n\t\t\t\t9131ADA29D82ECB74C8B1F0F369E680E /* UIView+Theme.swift */,\n\t\t\t\tE2E87F271DB01AD7EF878BD37A2F55CE /* Support Files */,\n\t\t\t);\n\t\t\tname = RxTheme;\n\t\t\tpath = RxTheme;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7033A78EF492E311BA8544293528331E /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5E559FEB032D5416FEE1577B066ECE72 /* RxTheme */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t88AEEA9F2A9070333BD7F023B3FD62A8 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2CFB604C62428DD1BD44F8E8B1C49A20 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t99ABCF3FF11004064B395683E5D1AF41 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t88AEEA9F2A9070333BD7F023B3FD62A8 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA28C4BD307997C9615286455C8A85CA5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDB8A8CB5D1CC8FF157A165B425071707 /* Dependencies */,\n\t\t\t\t99ABCF3FF11004064B395683E5D1AF41 /* Frameworks */,\n\t\t\t\t7033A78EF492E311BA8544293528331E /* Products */,\n\t\t\t\t2A5F9C658E049C7B2CC4A4B18DA945BE /* RxTheme */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDB8A8CB5D1CC8FF157A165B425071707 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t726EF7675FACE7ADB88CC6ADB7F2D253 /* RxCocoa */,\n\t\t\t\t88BF26F3D3FEEFD3CC0043324EDDE9F7 /* RxSwift */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE2E87F271DB01AD7EF878BD37A2F55CE /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tAF918B3A1D0CAF364DD367AE08C53C65 /* RxTheme.modulemap */,\n\t\t\t\tAB43521140EF0FD565BE8D5FA58DEF82 /* RxTheme-dummy.m */,\n\t\t\t\tEDBBE5F25AECCDA3AC27ECABFC7ECAF6 /* RxTheme-Info.plist */,\n\t\t\t\t785775A614F58B074D4AF455BB8382F2 /* RxTheme-prefix.pch */,\n\t\t\t\tC03B870E83DC105A3516F950D5CDD684 /* RxTheme-umbrella.h */,\n\t\t\t\t462680FD13598CC1D5228119E707954B /* RxTheme.debug.xcconfig */,\n\t\t\t\tDD3DA3914C320EEF3A39BC9487419C4B /* RxTheme.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/RxTheme\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tD7E2CF69CECFF1544F1A93463C0BBC1F /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t769E6A700479C79226AAE7ED7F9960F7 /* RxTheme-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t642CE8A56D477528D9E8BCDD0A6FEBB8 /* RxTheme */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = EAF08A90A54CFEA6AE3672BF4E2B39BB /* Build configuration list for PBXNativeTarget \"RxTheme\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tD7E2CF69CECFF1544F1A93463C0BBC1F /* Headers */,\n\t\t\t\t66E5990EA34E609A3B19506FC6811C28 /* Sources */,\n\t\t\t\t81E19BB9B96949EACFBCCFF452CE525F /* Frameworks */,\n\t\t\t\t0D7BFBA19E9DEDE3F2DA12FA7754B9BD /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tCA4DC747C9E5CB7918553DCB8E1B72C1 /* PBXTargetDependency */,\n\t\t\t\t867EFB1DA3E9F7155A73DDA7B4D5630D /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = RxTheme;\n\t\t\tproductName = RxTheme;\n\t\t\tproductReference = 5E559FEB032D5416FEE1577B066ECE72 /* RxTheme */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t0CC1EDB73ECD05CC39ACDDE89EE78FF5 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 7927FE4B2BEC21F1A143A6F3AD8B5A11 /* Build configuration list for PBXProject \"RxTheme\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = A28C4BD307997C9615286455C8A85CA5;\n\t\t\tproductRefGroup = 7033A78EF492E311BA8544293528331E /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 88BF26F3D3FEEFD3CC0043324EDDE9F7 /* RxSwift */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 726EF7675FACE7ADB88CC6ADB7F2D253 /* RxCocoa */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t642CE8A56D477528D9E8BCDD0A6FEBB8 /* RxTheme */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t0D7BFBA19E9DEDE3F2DA12FA7754B9BD /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t66E5990EA34E609A3B19506FC6811C28 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t872AB6046CDF2C85A7CE788BAEA3855B /* CALayer+Theme.swift in Sources */,\n\t\t\t\tC13A0798B2906D41DFAA7F9414A84C90 /* CAShapeLayer+Theme.swift in Sources */,\n\t\t\t\tC45A8867D2D90C6713F2B386E572B153 /* RxTheme-dummy.m in Sources */,\n\t\t\t\t544838644EDACB9C3AC73180143830F8 /* ThemeAttribute.swift in Sources */,\n\t\t\t\tDBF4E1954FCE7F40BCC5670680DB9256 /* ThemeProvider.swift in Sources */,\n\t\t\t\tE88F3F12A7A8F6986B64E89C592D8750 /* ThemeProxy.swift in Sources */,\n\t\t\t\t371658CC3D0B27EECF6C41A49C9A0356 /* ThemeService.swift in Sources */,\n\t\t\t\t53DB00A4BF49DDAB413CF803A1C22CC5 /* UIActivityIndicatorView+Theme.swift in Sources */,\n\t\t\t\t7294B17266217C97F2434CAC471542B7 /* UIBarButtonItem+Theme.swift in Sources */,\n\t\t\t\t2CB28D014C90911F998DD0F7032C4612 /* UIButton+Theme.swift in Sources */,\n\t\t\t\t2F5CCB13CF68E8B2DFE046325DD72844 /* UILabel+Theme.swift in Sources */,\n\t\t\t\t6856517DC92C0326AE7FD1AF3530C384 /* UINavigationBar+Theme.swift in Sources */,\n\t\t\t\t08A96A7F15147B644D310FB5F53CB2AF /* UIPageControl+Theme.swift in Sources */,\n\t\t\t\tBA8F061E5255A2279A5A7FAEA81FCCC4 /* UIProgressView+Theme.swift in Sources */,\n\t\t\t\t5CCDEF7998E2E9A56DA13DD4C35B507E /* UISearchBar+Theme.swift in Sources */,\n\t\t\t\tA4617FA3355A95E0AE7846101D1E4211 /* UISegmentedControl+Theme.swift in Sources */,\n\t\t\t\t4C5253F41E2F04A743BAFC584A120F79 /* UISlider+Theme.swift in Sources */,\n\t\t\t\tB46AE523F0439679A39E280E807D5F04 /* UISwitch+Theme.swift in Sources */,\n\t\t\t\t00B84B318B557C6FBEEBF93CCD3FFAC2 /* UITabBar+Theme.swift in Sources */,\n\t\t\t\tF19ACA69AC33C3AC40E991B319C94110 /* UITableView+Theme.swift in Sources */,\n\t\t\t\t217B3A81C9FF516123ECDC81D0D1931C /* UITAbleViewCell+Theme.swift in Sources */,\n\t\t\t\t8BA4FA5476F4FA6AC728C302F0C9DF08 /* UITextField+Theme.swift in Sources */,\n\t\t\t\t8F9DB0DFCC179F81F6A45F89B900FB06 /* UITextView+Theme.swift in Sources */,\n\t\t\t\t888EFEC02EC754211EDB9BED24F06F87 /* UIToolbar+Theme.swift in Sources */,\n\t\t\t\t68F2BC365AD82A3F647310D4DC2945AC /* UIView+Theme.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t867EFB1DA3E9F7155A73DDA7B4D5630D /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxSwift;\n\t\t\ttargetProxy = 84F1C2E63D63DE25AC1D535F20EB2CC9 /* PBXContainerItemProxy */;\n\t\t};\n\t\tCA4DC747C9E5CB7918553DCB8E1B72C1 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = RxCocoa;\n\t\t\ttargetProxy = 8F755E43B587B5DDF678B5C8EC1FBA26 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2154572BF5149D71D8055999DA472720 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = DD3DA3914C320EEF3A39BC9487419C4B /* RxTheme.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxTheme/RxTheme-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxTheme/RxTheme-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxTheme/RxTheme.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxTheme;\n\t\t\t\tPRODUCT_NAME = RxTheme;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t9DEF81265B981A6BA1A1C0FC80EE8EAF /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tCD9A16A606B1EAF6D7791279DBEA0C0B /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 462680FD13598CC1D5228119E707954B /* RxTheme.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/RxTheme/RxTheme-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/RxTheme/RxTheme-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/RxTheme/RxTheme.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = RxTheme;\n\t\t\t\tPRODUCT_NAME = RxTheme;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDEDF5F48B0C7899FF02E08BE1B80CF9E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t7927FE4B2BEC21F1A143A6F3AD8B5A11 /* Build configuration list for PBXProject \"RxTheme\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tDEDF5F48B0C7899FF02E08BE1B80CF9E /* Debug */,\n\t\t\t\t9DEF81265B981A6BA1A1C0FC80EE8EAF /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tEAF08A90A54CFEA6AE3672BF4E2B39BB /* Build configuration list for PBXNativeTarget \"RxTheme\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tCD9A16A606B1EAF6D7791279DBEA0C0B /* Debug */,\n\t\t\t\t2154572BF5149D71D8055999DA472720 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 0CC1EDB73ECD05CC39ACDDE89EE78FF5 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/LICENSE",
    "content": "Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com\n \nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is furnished\nto do so, subject to the following conditions:\n \nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/README.md",
    "content": "<p align=\"center\" >\n  <img src=\"https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/SDWebImage_logo.png\" title=\"SDWebImage logo\" float=left>\n</p>\n\n\n[![Build Status](http://img.shields.io/travis/SDWebImage/SDWebImage/master.svg?style=flat)](https://travis-ci.org/SDWebImage/SDWebImage)\n[![Pod Version](http://img.shields.io/cocoapods/v/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/)\n[![Pod Platform](http://img.shields.io/cocoapods/p/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/)\n[![Pod License](http://img.shields.io/cocoapods/l/SDWebImage.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg)](https://github.com/SDWebImage/SDWebImage)\n[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/)\n[![Mac Catalyst compatible](https://img.shields.io/badge/Catalyst-compatible-brightgreen.svg)](https://developer.apple.com/documentation/xcode/creating_a_mac_version_of_your_ipad_app/)\n[![codecov](https://codecov.io/gh/SDWebImage/SDWebImage/branch/master/graph/badge.svg)](https://codecov.io/gh/SDWebImage/SDWebImage)\n\nThis library provides an async image downloader with cache support. For convenience, we added categories for UI elements like `UIImageView`, `UIButton`, `MKAnnotationView`.\n\n## Features\n\n- [x] Categories for `UIImageView`, `UIButton`, `MKAnnotationView` adding web image and cache management\n- [x] An asynchronous image downloader\n- [x] An asynchronous memory + disk image caching with automatic cache expiration handling\n- [x] A background image decompression to avoid frame rate drop\n- [x] [Progressive image loading](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#progressive-animation) (including animated image, like GIF showing in Web browser)\n- [x] [Thumbnail image decoding](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#thumbnail-decoding-550) to save CPU && Memory for large images\n- [x] [Extendable image coder](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-coder-420) to support massive image format, like WebP\n- [x] [Full-stack solution for animated images](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) which keep a balance between CPU && Memory\n- [x] [Customizable and composable transformations](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#transformer-50) can be applied to the images right after download\n- [x] [Customizable and multiple caches system](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-cache-50)\n- [x] [Customizable and multiple loaders system](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-loader-50) to expand the capabilities, like [Photos Library](https://github.com/SDWebImage/SDWebImagePhotosPlugin)\n- [x] [Image loading indicators](https://github.com/SDWebImage/SDWebImage/wiki/How-to-use#use-view-indicator-50)\n- [x] [Image loading transition animation](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#image-transition-430)\n- [x] A guarantee that the same URL won't be downloaded several times\n- [x] A guarantee that bogus URLs won't be retried again and again\n- [x] A guarantee that main thread will never be blocked\n- [x] Modern Objective-C and better Swift support \n- [x] Performances!\n\n## Supported Image Formats\n\n- Image formats supported by Apple system (JPEG, PNG, TIFF, BMP, ...), including [GIF](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#gif-coder)/[APNG](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#apng-coder) animated image\n- HEIC format from iOS 11/macOS 10.13, including animated HEIC from iOS 13/macOS 10.15 via [SDWebImageHEICCoder](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#heic-coder). For lower firmware, use coder plugin [SDWebImageHEIFCoder](https://github.com/SDWebImage/SDWebImageHEIFCoder)\n- WebP format from iOS 14/macOS 11.0 via [SDWebImageAWebPCoder](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#awebp-coder). For lower firmware, use coder plugin [SDWebImageWebPCoder](https://github.com/SDWebImage/SDWebImageWebPCoder)\n- Support extendable coder plugins for new image formats like BPG, AVIF. And vector format like PDF, SVG. See all the list in [Image coder plugin List](https://github.com/SDWebImage/SDWebImage/wiki/Coder-Plugin-List)\n\n## Additional modules and Ecosystem\n\nIn order to keep SDWebImage focused and limited to the core features, but also allow extensibility and custom behaviors, during the 5.0 refactoring we focused on modularizing the library.\nAs such, we have moved/built new modules to [SDWebImage org](https://github.com/SDWebImage).\n\n#### SwiftUI\n[SwiftUI](https://developer.apple.com/xcode/swiftui/) is an innovative UI framework written in Swift to build user interfaces across all Apple platforms.\n\nWe support SwiftUI by building a brand new framework called [SDWebImageSwiftUI](https://github.com/SDWebImage/SDWebImageSwiftUI), which is built on top of SDWebImage core functions (caching, loading and animation).\n\nThe new framework introduce two View structs `WebImage` and `AnimatedImage` for SwiftUI world, `ImageIndicator` modifier for any View, `ImageManager` observable object for data source. Supports iOS 13+/macOS 10.15+/tvOS 13+/watchOS 6+ and Swift 5.1. Have a nice try and provide feedback!\n\n#### Coders for additional image formats\n- [SDWebImageWebPCoder](https://github.com/SDWebImage/SDWebImageWebPCoder) - coder for WebP format. iOS 8+/macOS 10.10+. Based on [libwebp](https://chromium.googlesource.com/webm/libwebp)\n- [SDWebImageHEIFCoder](https://github.com/SDWebImage/SDWebImageHEIFCoder) - coder for HEIF format, iOS 8+/macOS 10.10+ support. Based on [libheif](https://github.com/strukturag/libheif)\n- [SDWebImageBPGCoder](https://github.com/SDWebImage/SDWebImageBPGCoder) - coder for BPG format. Based on [libbpg](https://github.com/mirrorer/libbpg)\n- [SDWebImageFLIFCoder](https://github.com/SDWebImage/SDWebImageFLIFCoder) - coder for FLIF format. Based on [libflif](https://github.com/FLIF-hub/FLIF)\n- [SDWebImageAVIFCoder](https://github.com/SDWebImage/SDWebImageAVIFCoder) - coder for AVIF (AV1-based) format. Based on [libavif](https://github.com/AOMediaCodec/libavif)\n- [SDWebImagePDFCoder](https://github.com/SDWebImage/SDWebImagePDFCoder) - coder for PDF vector format. Using built-in frameworks\n- [SDWebImageSVGCoder](https://github.com/SDWebImage/SDWebImageSVGCoder) - coder for SVG vector format. Using built-in frameworks\n- [SDWebImageLottieCoder](https://github.com/SDWebImage/SDWebImageLottieCoder) - coder for Lottie animation format. Based on [rlottie](https://github.com/Samsung/rlottie)\n- and more from community!\n\n#### Custom Caches\n- [SDWebImageYYPlugin](https://github.com/SDWebImage/SDWebImageYYPlugin) - plugin to support caching images with [YYCache](https://github.com/ibireme/YYCache)\n- [SDWebImagePINPlugin](https://github.com/SDWebImage/SDWebImagePINPlugin) - plugin to support caching images with [PINCache](https://github.com/pinterest/PINCache)\n\n#### Custom Loaders\n- [SDWebImagePhotosPlugin](https://github.com/SDWebImage/SDWebImagePhotosPlugin) - plugin to support loading images from Photos (using `Photos.framework`) \n- [SDWebImageLinkPlugin](https://github.com/SDWebImage/SDWebImageLinkPlugin) - plugin to support loading images from rich link url, as well as `LPLinkView` (using `LinkPresentation.framework`) \n\n#### Integration with 3rd party libraries\n- [SDWebImageLottiePlugin](https://github.com/SDWebImage/SDWebImageLottiePlugin) - plugin to support [Lottie-iOS](https://github.com/airbnb/lottie-ios), vector animation rending with remote JSON files\n- [SDWebImageSVGKitPlugin](https://github.com/SDWebImage/SDWebImageSVGKitPlugin) - plugin to support [SVGKit](https://github.com/SVGKit/SVGKit), SVG rendering using Core Animation, iOS 8+/macOS 10.10+ support\n- [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin) - plugin to support [FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) as the engine for animated GIFs\n- [SDWebImageYYPlugin](https://github.com/SDWebImage/SDWebImageYYPlugin) - plugin to integrate [YYImage](https://github.com/ibireme/YYImage) & [YYCache](https://github.com/ibireme/YYCache) for image rendering & caching\n\n#### Community driven popular libraries\n- [FirebaseUI](https://github.com/firebase/FirebaseUI-iOS) - Firebase Storage binding for query images, based on SDWebImage loader system\n- [react-native-fast-image](https://github.com/DylanVann/react-native-fast-image) - React Native fast image component, based on SDWebImage Animated Image solution\n- [flutter_image_compress](https://github.com/OpenFlutter/flutter_image_compress) - Flutter compresses image plugin, based on SDWebImage WebP coder plugin\n\n#### Make our lives easier\n- [libwebp-Xcode](https://github.com/SDWebImage/libwebp-Xcode) - A wrapper for [libwebp](https://chromium.googlesource.com/webm/libwebp) + an Xcode project.\n- [libheif-Xcode](https://github.com/SDWebImage/libheif-Xcode) - A wrapper for [libheif](https://github.com/strukturag/libheif) + an Xcode project.\n- [libavif-Xcode](https://github.com/SDWebImage/libavif-Xcode) - A wrapper for [libavif](https://github.com/AOMediaCodec/libavif) + an Xcode project.\n- and more third-party C/C++ image codec libraries with CocoaPods/Carthage/SwiftPM support.\n\nYou can use those directly, or create similar components of your own, by using the customizable architecture of SDWebImage.\n\n## Requirements\n\n- iOS 9.0 or later\n- tvOS 9.0 or later\n- watchOS 2.0 or later\n- macOS 10.11 or later (10.15 for Catalyst)\n- Xcode 11.0 or later\n\n#### Backwards compatibility\n\n- For iOS 8, macOS 10.10 or Xcode < 11, use [any 5.x version up to 5.9.5](https://github.com/SDWebImage/SDWebImage/releases/tag/5.9.5)\n- For iOS 7, macOS 10.9 or Xcode < 8, use [any 4.x version up to 4.4.6](https://github.com/SDWebImage/SDWebImage/releases/tag/4.4.6)\n- For macOS 10.8, use [any 4.x version up to 4.3.0](https://github.com/SDWebImage/SDWebImage/releases/tag/4.3.0)\n- For iOS 5 and 6, use [any 3.x version up to 3.7.6](https://github.com/SDWebImage/SDWebImage/releases/tag/3.7.6)\n- For iOS < 5.0, please use the last [2.0 version](https://github.com/SDWebImage/SDWebImage/tree/2.0-compat).\n\n## Getting Started\n\n- Read this Readme doc\n- Read the [How to use section](https://github.com/SDWebImage/SDWebImage#how-to-use)\n- Read the [Latest Documentation](https://sdwebimage.github.io/) and [CocoaDocs for old version](http://cocoadocs.org/docsets/SDWebImage/)\n- Try the example by downloading the project from Github or even easier using CocoaPods try `pod try SDWebImage`\n- Read the [Installation Guide](https://github.com/SDWebImage/SDWebImage/wiki/Installation-Guide)\n- Read the [SDWebImage 5.0 Migration Guide](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/SDWebImage-5.0-Migration-guide.md) to get an idea of the changes from 4.x to 5.x\n- Read the [SDWebImage 4.0 Migration Guide](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/SDWebImage-4.0-Migration-guide.md) to get an idea of the changes from 3.x to 4.x\n- Read the [Common Problems](https://github.com/SDWebImage/SDWebImage/wiki/Common-Problems) to find the solution for common problems \n- Go to the [Wiki Page](https://github.com/SDWebImage/SDWebImage/wiki) for more information such as [Advanced Usage](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage)\n\n## Who Uses It\n- Find out [who uses SDWebImage](https://github.com/SDWebImage/SDWebImage/wiki/Who-Uses-SDWebImage) and add your app to the list.\n\n## Communication\n\n- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/sdwebimage). (Tag 'sdwebimage')\n- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/sdwebimage).\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **need IRC channel**, use [Gitter](https://gitter.im/SDWebImage/community).\n\n## Contribution\n\n- If you **want to contribute**, read the [Contributing Guide](https://github.com/SDWebImage/SDWebImage/blob/master/.github/CONTRIBUTING.md)\n- For **development contribution guide**, read the [How-To-Contribute](https://github.com/SDWebImage/SDWebImage/wiki/How-to-Contribute)\n- For **understanding code architecture**, read the [Code Architecture Analysis](https://github.com/SDWebImage/SDWebImage/wiki/5.6-Code-Architecture-Analysis)\n\n## How To Use\n\n* Objective-C\n\n```objective-c\n#import <SDWebImage/SDWebImage.h>\n...\n[imageView sd_setImageWithURL:[NSURL URLWithString:@\"http://www.domain.com/path/to/image.jpg\"]\n             placeholderImage:[UIImage imageNamed:@\"placeholder.png\"]];\n```\n\n* Swift\n\n```swift\nimport SDWebImage\n\nimageView.sd_setImage(with: URL(string: \"http://www.domain.com/path/to/image.jpg\"), placeholderImage: UIImage(named: \"placeholder.png\"))\n```\n\n- For details about how to use the library and clear examples, see [The detailed How to use](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/HowToUse.md)\n\n## Animated Images (GIF) support\n\nIn 5.0, we introduced a brand new mechanism for supporting animated images. This includes animated image loading, rendering, decoding, and also supports customizations (for advanced users).\n\nThis animated image solution is available for `iOS`/`tvOS`/`macOS`. The `SDAnimatedImage` is subclass of `UIImage/NSImage`, and `SDAnimatedImageView` is subclass of `UIImageView/NSImageView`, to make them compatible with the common frameworks APIs.\n\nThe `SDAnimatedImageView` supports the familiar image loading category methods, works like drop-in replacement for `UIImageView/NSImageView`.\n\nDon't have `UIView` (like `WatchKit` or `CALayer`)? you can still use `SDAnimatedPlayer` the player engine for advanced playback and rendering.\n\nSee [Animated Image](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) for more detailed information.\n\n* Objective-C\n\n```objective-c\nSDAnimatedImageView *imageView = [SDAnimatedImageView new];\nSDAnimatedImage *animatedImage = [SDAnimatedImage imageNamed:@\"image.gif\"];\nimageView.image = animatedImage;\n```\n\n* Swift\n\n```swift\nlet imageView = SDAnimatedImageView()\nlet animatedImage = SDAnimatedImage(named: \"image.gif\")\nimageView.image = animatedImage\n```\n\n#### FLAnimatedImage integration has its own dedicated repo\nIn order to clean up things and make our core project do less things, we decided that the `FLAnimatedImage` integration does not belong here. From 5.0, this will still be available, but under a dedicated repo [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin).\n\n## Installation\n\nThere are four ways to use SDWebImage in your project:\n- using CocoaPods\n- using Carthage\n- using Swift Package Manager\n- manual install (build frameworks or embed Xcode Project)\n\n### Installation with CocoaPods\n\n[CocoaPods](http://cocoapods.org/) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the [Get Started](http://cocoapods.org/#get_started) section for more details.\n\n#### Podfile\n```\nplatform :ios, '8.0'\npod 'SDWebImage', '~> 5.0'\n```\n\n##### Swift and static framework\n\nSwift project previously had to use `use_frameworks!` to make all Pods into dynamic framework to let CocoaPods work.\n\nHowever, starting with `CocoaPods 1.5.0+` (with `Xcode 9+`), which supports to build both Objective-C && Swift code into static framework. You can use modular headers to use SDWebImage as static framework, without the need of `use_frameworks!`:\n\n```\nplatform :ios, '8.0'\n# Uncomment the next line when you want all Pods as static framework\n# use_modular_headers!\npod 'SDWebImage', :modular_headers => true\n```\n\nSee more on [CocoaPods 1.5.0 — Swift Static Libraries](http://blog.cocoapods.org/CocoaPods-1.5.0/)\n\nIf not, you still need to add `use_frameworks!` to use SDWebImage as dynamic framework:\n\n```\nplatform :ios, '8.0'\nuse_frameworks!\npod 'SDWebImage'\n```\n\n#### Subspecs\n\nThere are 2 subspecs available now: `Core` and `MapKit` (this means you can install only some of the SDWebImage modules. By default, you get just `Core`, so if you need `MapKit`, you need to specify it). \n\nPodfile example:\n\n```\npod 'SDWebImage/MapKit'\n```\n\n### Installation with Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.\n\nTo install with carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage)\n\nCarthage users can point to this repository and use whichever generated framework they'd like: SDWebImage, SDWebImageMapKit or both.\n\nMake the following entry in your Cartfile: `github \"SDWebImage/SDWebImage\"`\nThen run `carthage update`\nIf this is your first time using Carthage in the project, you'll need to go through some additional steps as explained [over at Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application).\n\n> NOTE: At this time, Carthage does not provide a way to build only specific repository subcomponents (or equivalent of CocoaPods's subspecs). All components and their dependencies will be built with the above command. However, you don't need to copy frameworks you aren't using into your project. For instance, if you aren't using `SDWebImageMapKit`, feel free to delete that framework from the Carthage Build directory after `carthage update` completes.\n\n### Installation with Swift Package Manager (Xcode 11+)\n\n[Swift Package Manager](https://swift.org/package-manager/) (SwiftPM) is a tool for managing the distribution of Swift code as well as C-family dependency. From Xcode 11, SwiftPM got natively integrated with Xcode.\n\nSDWebImage support SwiftPM from version 5.1.0. To use SwiftPM, you should use Xcode 11 to open your project. Click `File` -> `Swift Packages` -> `Add Package Dependency`, enter [SDWebImage repo's URL](https://github.com/SDWebImage/SDWebImage.git). Or you can login Xcode with your GitHub account and just type `SDWebImage` to search.\n\nAfter select the package, you can choose the dependency type (tagged version, branch or commit). Then Xcode will setup all the stuff for you.\n\nIf you're a framework author and use SDWebImage as a dependency, update your `Package.swift` file:\n\n```swift\nlet package = Package(\n    // 5.1.0 ..< 6.0.0\n    dependencies: [\n        .package(url: \"https://github.com/SDWebImage/SDWebImage.git\", from: \"5.1.0\")\n    ],\n    // ...\n)\n```\n\n### Manual Installation Guide\n\nSee more on [Manual install Guide](https://github.com/SDWebImage/SDWebImage/wiki/Installation-Guide#manual-installation-guide)\n\n### Import headers in your source files\n\nIn the source files where you need to use the library, import the umbrella header file:\n\n```objective-c\n#import <SDWebImage/SDWebImage.h>\n```\n\nIt's also recommend to use the module import syntax, available for CocoaPods(enable `modular_headers`)/Carthage/SwiftPM.\n\n```objecitivec\n@import SDWebImage;\n```\n\n### Build Project\n\nAt this point your workspace should build without error. If you are having problem, post to the Issue and the\ncommunity can help you solve it.\n\n## Data Collection Practices\nAs required by the [App privacy details on the App Store](https://developer.apple.com/app-store/app-privacy-details/), here's SDWebImage's list of [Data Collection Practices](https://sdwebimage.github.io/DataCollection/index.html).\n\n## Author\n- [Olivier Poitrey](https://github.com/rs)\n\n## Collaborators\n- [Konstantinos K.](https://github.com/mythodeia)\n- [Bogdan Poplauschi](https://github.com/bpoplauschi)\n- [Chester Liu](https://github.com/skyline75489)\n- [DreamPiggy](https://github.com/dreampiggy)\n- [Wu Zhong](https://github.com/zhongwuzw)\n\n## Credits\n\nThank you to all the people who have already contributed to SDWebImage.\n\n[![Contributors](https://opencollective.com/SDWebImage/contributors.svg?width=890)](https://github.com/SDWebImage/SDWebImage/graphs/contributors)\n\n## Licenses\n\nAll source code is licensed under the [MIT License](https://github.com/SDWebImage/SDWebImage/blob/master/LICENSE).\n\n## Architecture\n\nTo learn about SDWebImage's architecture design for contribution, read [The Core of SDWebImage v5.6 Architecture](https://github.com/SDWebImage/SDWebImage/wiki/5.6-Code-Architecture-Analysis). Thanks @looseyi for the post and translation.\n\n#### High Level Diagram\n<p align=\"center\" >\n    <img src=\"https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageHighLevelDiagram.jpeg\" title=\"SDWebImage high level diagram\">\n</p>\n\n#### Overall Class Diagram\n<p align=\"center\" >\n    <img src=\"https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageClassDiagram.png\" title=\"SDWebImage overall class diagram\">\n</p>\n\n#### Top Level API Diagram\n<p align=\"center\" >\n    <img src=\"https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageTopLevelClassDiagram.png\" title=\"SDWebImage top level API diagram\">\n</p>\n\n#### Main Sequence Diagram\n<p align=\"center\" >\n    <img src=\"https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageSequenceDiagram.png\" title=\"SDWebImage sequence diagram\">\n</p>\n\n#### More detailed diagrams\n- [Manager API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageManagerClassDiagram.png)\n- [Coders API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageCodersClassDiagram.png)\n- [Loader API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageLoaderClassDiagram.png)\n- [Cache API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageCacheClassDiagram.png)\n\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_MAC\n\n#import \"SDWebImageManager.h\"\n\n/**\n * Integrates SDWebImage async downloading and caching of remote images with NSButton.\n */\n@interface NSButton (WebCache)\n\n#pragma mark - Image\n\n/**\n * Get the current image URL.\n */\n@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentImageURL;\n\n/**\n * Set the button `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url The url for the image.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url` and a placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @see sd_setImageWithURL:placeholderImage:options:\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context;\n\n/**\n * Set the button `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `image` with an `url`, placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                 completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n#pragma mark - Alternate Image\n\n/**\n * Get the current alternateImage URL.\n */\n@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentAlternateImageURL;\n\n/**\n * Set the button `alternateImage` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url The url for the alternateImage.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `alternateImage` with an `url` and a placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the alternateImage.\n * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.\n * @see sd_setAlternateImageWithURL:placeholderImage:options:\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `alternateImage` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the alternateImage.\n * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.\n * @param options     The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder\n                            options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `alternateImage` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the alternateImage.\n * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes.\n * @param options     The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder\n                            options:(SDWebImageOptions)options\n                            context:(nullable SDWebImageContext *)context;\n\n/**\n * Set the button `alternateImage` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the alternateImage.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the alternateImage parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the alternateImage was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original alternateImage url.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                          completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `alternateImage` with an `url`, placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the alternateImage.\n * @param placeholder    The alternateImage to be set initially, until the alternateImage request finishes.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the alternateImage parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the alternateImage was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original alternateImage url.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder\n                          completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `alternateImage` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the alternateImage.\n * @param placeholder    The alternateImage to be set initially, until the alternateImage request finishes.\n * @param options        The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the alternateImage parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the alternateImage was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original alternateImage url.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder\n                            options:(SDWebImageOptions)options\n                          completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `alternateImage` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the alternateImage.\n * @param placeholder    The alternateImage to be set initially, until the alternateImage request finishes.\n * @param options        The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.\n * @param progressBlock  A block called while alternateImage is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the alternateImage parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the alternateImage was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original alternateImage url.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder\n                            options:(SDWebImageOptions)options\n                           progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                          completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `alternateImage` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the alternateImage.\n * @param placeholder    The alternateImage to be set initially, until the alternateImage request finishes.\n * @param options        The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values.\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while alternateImage is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the alternateImage parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the alternateImage was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original alternateImage url.\n */\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder\n                            options:(SDWebImageOptions)options\n                            context:(nullable SDWebImageContext *)context\n                           progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                          completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n#pragma mark - Cancel\n\n/**\n * Cancel the current image download\n */\n- (void)sd_cancelCurrentImageLoad;\n\n/**\n * Cancel the current alternateImage download\n */\n- (void)sd_cancelCurrentAlternateImageLoad;\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"NSButton+WebCache.h\"\n\n#if SD_MAC\n\n#import \"objc/runtime.h\"\n#import \"UIView+WebCacheOperation.h\"\n#import \"UIView+WebCache.h\"\n#import \"SDInternalMacros.h\"\n\nstatic NSString * const SDAlternateImageOperationKey = @\"NSButtonAlternateImageOperation\";\n\n@implementation NSButton (WebCache)\n\n#pragma mark - Image\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url {\n    [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock {\n    self.sd_currentImageURL = url;\n    [self sd_internalSetImageWithURL:url\n                    placeholderImage:placeholder\n                             options:options\n                             context:context\n                       setImageBlock:nil\n                            progress:progressBlock\n                           completed:^(NSImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                               if (completedBlock) {\n                                   completedBlock(image, error, cacheType, imageURL);\n                               }\n                           }];\n}\n\n#pragma mark - Alternate Image\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url {\n    [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder {\n    [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options {\n    [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {\n    [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url\n                   placeholderImage:(nullable UIImage *)placeholder\n                            options:(SDWebImageOptions)options\n                            context:(nullable SDWebImageContext *)context\n                           progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                          completed:(nullable SDExternalCompletionBlock)completedBlock {\n    self.sd_currentAlternateImageURL = url;\n    \n    SDWebImageMutableContext *mutableContext;\n    if (context) {\n        mutableContext = [context mutableCopy];\n    } else {\n        mutableContext = [NSMutableDictionary dictionary];\n    }\n    mutableContext[SDWebImageContextSetImageOperationKey] = SDAlternateImageOperationKey;\n    @weakify(self);\n    [self sd_internalSetImageWithURL:url\n                    placeholderImage:placeholder\n                             options:options\n                             context:mutableContext\n                       setImageBlock:^(NSImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {\n                           @strongify(self);\n                           self.alternateImage = image;\n                       }\n                            progress:progressBlock\n                           completed:^(NSImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                               if (completedBlock) {\n                                   completedBlock(image, error, cacheType, imageURL);\n                               }\n                           }];\n}\n\n#pragma mark - Cancel\n\n- (void)sd_cancelCurrentImageLoad {\n    [self sd_cancelImageLoadOperationWithKey:NSStringFromClass([self class])];\n}\n\n- (void)sd_cancelCurrentAlternateImageLoad {\n    [self sd_cancelImageLoadOperationWithKey:SDAlternateImageOperationKey];\n}\n\n#pragma mar - Private\n\n- (NSURL *)sd_currentImageURL {\n    return objc_getAssociatedObject(self, @selector(sd_currentImageURL));\n}\n\n- (void)setSd_currentImageURL:(NSURL *)sd_currentImageURL {\n    objc_setAssociatedObject(self, @selector(sd_currentImageURL), sd_currentImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (NSURL *)sd_currentAlternateImageURL {\n    return objc_getAssociatedObject(self, @selector(sd_currentAlternateImageURL));\n}\n\n- (void)setSd_currentAlternateImageURL:(NSURL *)sd_currentAlternateImageURL {\n    objc_setAssociatedObject(self, @selector(sd_currentAlternateImageURL), sd_currentAlternateImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Fabrice Aneche\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/**\n You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value.\n For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information.\n */\ntypedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM;\nstatic const SDImageFormat SDImageFormatUndefined = -1;\nstatic const SDImageFormat SDImageFormatJPEG      = 0;\nstatic const SDImageFormat SDImageFormatPNG       = 1;\nstatic const SDImageFormat SDImageFormatGIF       = 2;\nstatic const SDImageFormat SDImageFormatTIFF      = 3;\nstatic const SDImageFormat SDImageFormatWebP      = 4;\nstatic const SDImageFormat SDImageFormatHEIC      = 5;\nstatic const SDImageFormat SDImageFormatHEIF      = 6;\nstatic const SDImageFormat SDImageFormatPDF       = 7;\nstatic const SDImageFormat SDImageFormatSVG       = 8;\n\n/**\n NSData category about the image content type and UTI.\n */\n@interface NSData (ImageContentType)\n\n/**\n *  Return image format\n *\n *  @param data the input image data\n *\n *  @return the image format as `SDImageFormat` (enum)\n */\n+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data;\n\n/**\n *  Convert SDImageFormat to UTType\n *\n *  @param format Format as SDImageFormat\n *  @return The UTType as CFStringRef\n *  @note For unknown format, `kSDUTTypeImage` abstract type will return\n */\n+ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(sd_UTType(from:));\n\n/**\n *  Convert UTType to SDImageFormat\n *\n *  @param uttype The UTType as CFStringRef\n *  @return The Format as SDImageFormat\n *  @note For unknown type, `SDImageFormatUndefined` will return\n */\n+ (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Fabrice Aneche\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"NSData+ImageContentType.h\"\n#if SD_MAC\n#import <CoreServices/CoreServices.h>\n#else\n#import <MobileCoreServices/MobileCoreServices.h>\n#endif\n#import \"SDImageIOAnimatedCoderInternal.h\"\n\n#define kSVGTagEnd @\"</svg>\"\n\n@implementation NSData (ImageContentType)\n\n+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data {\n    if (!data) {\n        return SDImageFormatUndefined;\n    }\n    \n    // File signatures table: http://www.garykessler.net/library/file_sigs.html\n    uint8_t c;\n    [data getBytes:&c length:1];\n    switch (c) {\n        case 0xFF:\n            return SDImageFormatJPEG;\n        case 0x89:\n            return SDImageFormatPNG;\n        case 0x47:\n            return SDImageFormatGIF;\n        case 0x49:\n        case 0x4D:\n            return SDImageFormatTIFF;\n        case 0x52: {\n            if (data.length >= 12) {\n                //RIFF....WEBP\n                NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding];\n                if ([testString hasPrefix:@\"RIFF\"] && [testString hasSuffix:@\"WEBP\"]) {\n                    return SDImageFormatWebP;\n                }\n            }\n            break;\n        }\n        case 0x00: {\n            if (data.length >= 12) {\n                //....ftypheic ....ftypheix ....ftyphevc ....ftyphevx\n                NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(4, 8)] encoding:NSASCIIStringEncoding];\n                if ([testString isEqualToString:@\"ftypheic\"]\n                    || [testString isEqualToString:@\"ftypheix\"]\n                    || [testString isEqualToString:@\"ftyphevc\"]\n                    || [testString isEqualToString:@\"ftyphevx\"]) {\n                    return SDImageFormatHEIC;\n                }\n                //....ftypmif1 ....ftypmsf1\n                if ([testString isEqualToString:@\"ftypmif1\"] || [testString isEqualToString:@\"ftypmsf1\"]) {\n                    return SDImageFormatHEIF;\n                }\n            }\n            break;\n        }\n        case 0x25: {\n            if (data.length >= 4) {\n                //%PDF\n                NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(1, 3)] encoding:NSASCIIStringEncoding];\n                if ([testString isEqualToString:@\"PDF\"]) {\n                    return SDImageFormatPDF;\n                }\n            }\n        }\n        case 0x3C: {\n            // Check end with SVG tag\n            if ([data rangeOfData:[kSVGTagEnd dataUsingEncoding:NSUTF8StringEncoding] options:NSDataSearchBackwards range: NSMakeRange(data.length - MIN(100, data.length), MIN(100, data.length))].location != NSNotFound) {\n                return SDImageFormatSVG;\n            }\n        }\n    }\n    return SDImageFormatUndefined;\n}\n\n+ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format {\n    CFStringRef UTType;\n    switch (format) {\n        case SDImageFormatJPEG:\n            UTType = kSDUTTypeJPEG;\n            break;\n        case SDImageFormatPNG:\n            UTType = kSDUTTypePNG;\n            break;\n        case SDImageFormatGIF:\n            UTType = kSDUTTypeGIF;\n            break;\n        case SDImageFormatTIFF:\n            UTType = kSDUTTypeTIFF;\n            break;\n        case SDImageFormatWebP:\n            UTType = kSDUTTypeWebP;\n            break;\n        case SDImageFormatHEIC:\n            UTType = kSDUTTypeHEIC;\n            break;\n        case SDImageFormatHEIF:\n            UTType = kSDUTTypeHEIF;\n            break;\n        case SDImageFormatPDF:\n            UTType = kSDUTTypePDF;\n            break;\n        case SDImageFormatSVG:\n            UTType = kSDUTTypeSVG;\n            break;\n        default:\n            // default is kUTTypeImage abstract type\n            UTType = kSDUTTypeImage;\n            break;\n    }\n    return UTType;\n}\n\n+ (SDImageFormat)sd_imageFormatFromUTType:(CFStringRef)uttype {\n    if (!uttype) {\n        return SDImageFormatUndefined;\n    }\n    SDImageFormat imageFormat;\n    if (CFStringCompare(uttype, kSDUTTypeJPEG, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatJPEG;\n    } else if (CFStringCompare(uttype, kSDUTTypePNG, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatPNG;\n    } else if (CFStringCompare(uttype, kSDUTTypeGIF, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatGIF;\n    } else if (CFStringCompare(uttype, kSDUTTypeTIFF, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatTIFF;\n    } else if (CFStringCompare(uttype, kSDUTTypeWebP, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatWebP;\n    } else if (CFStringCompare(uttype, kSDUTTypeHEIC, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatHEIC;\n    } else if (CFStringCompare(uttype, kSDUTTypeHEIF, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatHEIF;\n    } else if (CFStringCompare(uttype, kSDUTTypePDF, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatPDF;\n    } else if (CFStringCompare(uttype, kSDUTTypeSVG, 0) == kCFCompareEqualTo) {\n        imageFormat = SDImageFormatSVG;\n    } else {\n        imageFormat = SDImageFormatUndefined;\n    }\n    return imageFormat;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_MAC\n\n/**\n This category is provided to easily write cross-platform(AppKit/UIKit) code. For common usage, see `UIImage+Metadata.h`.\n */\n@interface NSImage (Compatibility)\n\n/**\nThe underlying Core Graphics image object. This will actually use `CGImageForProposedRect` with the image size.\n */\n@property (nonatomic, readonly, nullable) CGImageRef CGImage;\n/**\n The underlying Core Image data. This will actually use `bestRepresentationForRect` with the image size to find the `NSCIImageRep`.\n */\n@property (nonatomic, readonly, nullable) CIImage *CIImage;\n/**\n The scale factor of the image. This wil actually use `bestRepresentationForRect` with image size and pixel size to calculate the scale factor. If failed, use the default value 1.0. Should be greater than or equal to 1.0.\n */\n@property (nonatomic, readonly) CGFloat scale;\n\n// These are convenience methods to make AppKit's `NSImage` match UIKit's `UIImage` behavior. The scale factor should be greater than or equal to 1.0.\n\n/**\n Returns an image object with the scale factor and orientation. The representation is created from the Core Graphics image object.\n @note The difference between this and `initWithCGImage:size` is that `initWithCGImage:size` will actually create a `NSCGImageSnapshotRep` representation and always use `backingScaleFactor` as scale factor. So we should avoid it and use `NSBitmapImageRep` with `initWithCGImage:` instead.\n @note The difference between this and UIKit's `UIImage` equivalent method is the way to process orientation. If the provided image orientation is not equal to Up orientation, this method will firstly rotate the CGImage to the correct orientation to work compatible with `NSImageView`. However, UIKit will not actually rotate CGImage and just store it as `imageOrientation` property.\n\n @param cgImage A Core Graphics image object\n @param scale The image scale factor\n @param orientation The orientation of the image data\n @return The image object\n */\n- (nonnull instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation;\n\n/**\n Initializes and returns an image object with the specified Core Image object. The representation is `NSCIImageRep`.\n \n @param ciImage A Core Image image object\n @param scale The image scale factor\n @param orientation The orientation of the image data\n @return The image object\n */\n- (nonnull instancetype)initWithCIImage:(nonnull CIImage *)ciImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation;\n\n/**\n Returns an image object with the scale factor. The representation is created from the image data.\n @note The difference between these this and `initWithData:` is that `initWithData:` will always use `backingScaleFactor` as scale factor.\n\n @param data The image data\n @param scale The image scale factor\n @return The image object\n */\n- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale;\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"NSImage+Compatibility.h\"\n\n#if SD_MAC\n\n#import \"SDImageCoderHelper.h\"\n\n@implementation NSImage (Compatibility)\n\n- (nullable CGImageRef)CGImage {\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:nil hints:nil];\n    return cgImage;\n}\n\n- (nullable CIImage *)CIImage {\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];\n    if (![imageRep isKindOfClass:NSCIImageRep.class]) {\n        return nil;\n    }\n    return ((NSCIImageRep *)imageRep).CIImage;\n}\n\n- (CGFloat)scale {\n    CGFloat scale = 1;\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];\n    CGFloat width = imageRep.size.width;\n    CGFloat height = imageRep.size.height;\n    CGFloat pixelWidth = (CGFloat)imageRep.pixelsWide;\n    CGFloat pixelHeight = (CGFloat)imageRep.pixelsHigh;\n    if (width > 0 && height > 0) {\n        CGFloat widthScale = pixelWidth / width;\n        CGFloat heightScale = pixelHeight / height;\n        if (widthScale == heightScale && widthScale >= 1) {\n            // Protect because there may be `NSImageRepMatchesDevice` (0)\n            scale = widthScale;\n        }\n    }\n    \n    return scale;\n}\n\n- (instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation {\n    NSBitmapImageRep *imageRep;\n    if (orientation != kCGImagePropertyOrientationUp) {\n        // AppKit design is different from UIKit. Where CGImage based image rep does not respect to any orientation. Only data based image rep which contains the EXIF metadata can automatically detect orientation.\n        // This should be nonnull, until the memory is exhausted cause `CGBitmapContextCreate` failed.\n        CGImageRef rotatedCGImage = [SDImageCoderHelper CGImageCreateDecoded:cgImage orientation:orientation];\n        imageRep = [[NSBitmapImageRep alloc] initWithCGImage:rotatedCGImage];\n        CGImageRelease(rotatedCGImage);\n    } else {\n        imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];\n    }\n    if (scale < 1) {\n        scale = 1;\n    }\n    CGFloat pixelWidth = imageRep.pixelsWide;\n    CGFloat pixelHeight = imageRep.pixelsHigh;\n    NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale);\n    self = [self initWithSize:size];\n    if (self) {\n        imageRep.size = size;\n        [self addRepresentation:imageRep];\n    }\n    return self;\n}\n\n- (instancetype)initWithCIImage:(nonnull CIImage *)ciImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation {\n    NSCIImageRep *imageRep;\n    if (orientation != kCGImagePropertyOrientationUp) {\n        CIImage *rotatedCIImage = [ciImage imageByApplyingOrientation:orientation];\n        imageRep = [[NSCIImageRep alloc] initWithCIImage:rotatedCIImage];\n    } else {\n        imageRep = [[NSCIImageRep alloc] initWithCIImage:ciImage];\n    }\n    if (scale < 1) {\n        scale = 1;\n    }\n    CGFloat pixelWidth = imageRep.pixelsWide;\n    CGFloat pixelHeight = imageRep.pixelsHigh;\n    NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale);\n    self = [self initWithSize:size];\n    if (self) {\n        imageRep.size = size;\n        [self addRepresentation:imageRep];\n    }\n    return self;\n}\n\n- (instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale {\n    NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithData:data];\n    if (!imageRep) {\n        return nil;\n    }\n    if (scale < 1) {\n        scale = 1;\n    }\n    CGFloat pixelWidth = imageRep.pixelsWide;\n    CGFloat pixelHeight = imageRep.pixelsHigh;\n    NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale);\n    self = [self initWithSize:size];\n    if (self) {\n        imageRep.size = size;\n        [self addRepresentation:imageRep];\n    }\n    return self;\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"SDImageCoder.h\"\n\n\n/**\n This is the protocol for SDAnimatedImage class only but not for SDAnimatedImageCoder. If you want to provide a custom animated image class with full advanced function, you can conform to this instead of the base protocol.\n */\n@protocol SDAnimatedImage <SDAnimatedImageProvider>\n\n@required\n/**\n Initializes and returns the image object with the specified data, scale factor and possible animation decoding options.\n @note We use this to create animated image instance for normal animation decoding.\n \n @param data The data object containing the image data.\n @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property.\n @param options A dictionary containing any animation decoding options.\n @return An initialized object\n */\n- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale options:(nullable SDImageCoderOptions *)options;\n\n/**\n Initializes the image with an animated coder. You can use the coder to decode the image frame later.\n @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding.\n \n @param animatedCoder An animated coder which conform `SDAnimatedImageCoder` protocol\n @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property.\n @return An initialized object\n */\n- (nullable instancetype)initWithAnimatedCoder:(nonnull id<SDAnimatedImageCoder>)animatedCoder scale:(CGFloat)scale;\n\n@optional\n// These methods are used for optional advanced feature, like image frame preloading.\n/**\n Pre-load all animated image frame into memory. Then later frame image request can directly return the frame for index without decoding.\n This method may be called on background thread.\n \n @note If one image instance is shared by lots of imageViews, the CPU performance for large animated image will drop down because the request frame index will be random (not in order) and the decoder should take extra effort to keep it re-entrant. You can use this to reduce CPU usage if need. Attention this will consume more memory usage.\n */\n- (void)preloadAllFrames;\n\n/**\n Unload all animated image frame from memory if are already pre-loaded. Then later frame image request need decoding. You can use this to free up the memory usage if need.\n */\n- (void)unloadAllFrames;\n\n/**\n Returns a Boolean value indicating whether all animated image frames are already pre-loaded into memory.\n */\n@property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded;\n\n/**\n Return the animated image coder if the image is created with `initWithAnimatedCoder:scale:` method.\n @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding.\n */\n@property (nonatomic, strong, readonly, nullable) id<SDAnimatedImageCoder> animatedCoder;\n\n@end\n\n/**\n The image class which supports animating on `SDAnimatedImageView`. You can also use it on normal UIImageView/NSImageView.\n */\n@interface SDAnimatedImage : UIImage <SDAnimatedImage>\n\n// This class override these methods from UIImage(NSImage), and it supports NSSecureCoding.\n// You should use these methods to create a new animated image. Use other methods just call super instead.\n// Pay attention, when the animated image frame count <= 1, all the `SDAnimatedImageProvider` protocol methods will return nil or 0 value, you'd better check the frame count before usage and keep fallback.\n+ (nullable instancetype)imageNamed:(nonnull NSString *)name; // Cache in memory, no Asset Catalog support\n#if __has_include(<UIKit/UITraitCollection.h>)\n+ (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection; // Cache in memory, no Asset Catalog support\n#else\n+ (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle; // Cache in memory, no Asset Catalog support\n#endif\n+ (nullable instancetype)imageWithContentsOfFile:(nonnull NSString *)path;\n+ (nullable instancetype)imageWithData:(nonnull NSData *)data;\n+ (nullable instancetype)imageWithData:(nonnull NSData *)data scale:(CGFloat)scale;\n- (nullable instancetype)initWithContentsOfFile:(nonnull NSString *)path;\n- (nullable instancetype)initWithData:(nonnull NSData *)data;\n- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale;\n\n/**\n Current animated image format.\n */\n@property (nonatomic, assign, readonly) SDImageFormat animatedImageFormat;\n\n/**\n Current animated image data, you can use this to grab the compressed format data and create another animated image instance.\n If this image instance is an animated image created by using animated image coder (which means using the API listed above or using `initWithAnimatedCoder:scale:`), this property is non-nil.\n */\n@property (nonatomic, copy, readonly, nullable) NSData *animatedImageData;\n\n/**\n The scale factor of the image.\n \n @note For UIKit, this just call super instead.\n @note For AppKit, `NSImage` can contains multiple image representations with different scales. However, this class does not do that from the design. We process the scale like UIKit. This will actually be calculated from image size and pixel size.\n */\n@property (nonatomic, readonly) CGFloat scale;\n\n// By default, animated image frames are returned by decoding just in time without keeping into memory. But you can choose to preload them into memory as well, See the description in `SDAnimatedImage` protocol.\n// After preloaded, there is no huge difference on performance between this and UIImage's `animatedImageWithImages:duration:`. But UIImage's animation have some issues such like blanking and pausing during segue when using in `UIImageView`. It's recommend to use only if need.\n- (void)preloadAllFrames;\n- (void)unloadAllFrames;\n@property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDAnimatedImage.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDImageCoder.h\"\n#import \"SDImageCodersManager.h\"\n#import \"SDImageFrame.h\"\n#import \"UIImage+MemoryCacheCost.h\"\n#import \"UIImage+Metadata.h\"\n#import \"UIImage+MultiFormat.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"SDImageAssetManager.h\"\n#import \"objc/runtime.h\"\n\nstatic CGFloat SDImageScaleFromPath(NSString *string) {\n    if (string.length == 0 || [string hasSuffix:@\"/\"]) return 1;\n    NSString *name = string.stringByDeletingPathExtension;\n    __block CGFloat scale = 1;\n    \n    NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:@\"@[0-9]+\\\\.?[0-9]*x$\" options:NSRegularExpressionAnchorsMatchLines error:nil];\n    [pattern enumerateMatchesInString:name options:kNilOptions range:NSMakeRange(0, name.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue;\n    }];\n    \n    return scale;\n}\n\n@interface SDAnimatedImage ()\n\n@property (nonatomic, strong) id<SDAnimatedImageCoder> animatedCoder;\n@property (nonatomic, assign, readwrite) SDImageFormat animatedImageFormat;\n@property (atomic, copy) NSArray<SDImageFrame *> *loadedAnimatedImageFrames; // Mark as atomic to keep thread-safe\n@property (nonatomic, assign, getter=isAllFramesLoaded) BOOL allFramesLoaded;\n\n@end\n\n@implementation SDAnimatedImage\n@dynamic scale; // call super\n\n#pragma mark - UIImage override method\n+ (instancetype)imageNamed:(NSString *)name {\n#if __has_include(<UIKit/UITraitCollection.h>)\n    return [self imageNamed:name inBundle:nil compatibleWithTraitCollection:nil];\n#else\n    return [self imageNamed:name inBundle:nil];\n#endif\n}\n\n#if __has_include(<UIKit/UITraitCollection.h>)\n+ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle compatibleWithTraitCollection:(UITraitCollection *)traitCollection {\n    if (!traitCollection) {\n        traitCollection = UIScreen.mainScreen.traitCollection;\n    }\n    CGFloat scale = traitCollection.displayScale;\n    return [self imageNamed:name inBundle:bundle scale:scale];\n}\n#else\n+ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle {\n    return [self imageNamed:name inBundle:bundle scale:0];\n}\n#endif\n\n// 0 scale means automatically check\n+ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle scale:(CGFloat)scale {\n    if (!name) {\n        return nil;\n    }\n    if (!bundle) {\n        bundle = [NSBundle mainBundle];\n    }\n    SDImageAssetManager *assetManager = [SDImageAssetManager sharedAssetManager];\n    SDAnimatedImage *image = (SDAnimatedImage *)[assetManager imageForName:name];\n    if ([image isKindOfClass:[SDAnimatedImage class]]) {\n        return image;\n    }\n    NSString *path = [assetManager getPathForName:name bundle:bundle preferredScale:&scale];\n    if (!path) {\n        return image;\n    }\n    NSData *data = [NSData dataWithContentsOfFile:path];\n    if (!data) {\n        return image;\n    }\n    image = [[self alloc] initWithData:data scale:scale];\n    if (image) {\n        [assetManager storeImage:image forName:name];\n    }\n    \n    return image;\n}\n\n+ (instancetype)imageWithContentsOfFile:(NSString *)path {\n    return [[self alloc] initWithContentsOfFile:path];\n}\n\n+ (instancetype)imageWithData:(NSData *)data {\n    return [[self alloc] initWithData:data];\n}\n\n+ (instancetype)imageWithData:(NSData *)data scale:(CGFloat)scale {\n    return [[self alloc] initWithData:data scale:scale];\n}\n\n- (instancetype)initWithContentsOfFile:(NSString *)path {\n    NSData *data = [NSData dataWithContentsOfFile:path];\n    return [self initWithData:data scale:SDImageScaleFromPath(path)];\n}\n\n- (instancetype)initWithData:(NSData *)data {\n    return [self initWithData:data scale:1];\n}\n\n- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale {\n    return [self initWithData:data scale:scale options:nil];\n}\n\n- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale options:(SDImageCoderOptions *)options {\n    if (!data || data.length == 0) {\n        return nil;\n    }\n    data = [data copy]; // avoid mutable data\n    id<SDAnimatedImageCoder> animatedCoder = nil;\n    for (id<SDImageCoder>coder in [SDImageCodersManager sharedManager].coders.reverseObjectEnumerator) {\n        if ([coder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) {\n            if ([coder canDecodeFromData:data]) {\n                if (!options) {\n                    options = @{SDImageCoderDecodeScaleFactor : @(scale)};\n                }\n                animatedCoder = [[[coder class] alloc] initWithAnimatedImageData:data options:options];\n                break;\n            }\n        }\n    }\n    if (!animatedCoder) {\n        return nil;\n    }\n    return [self initWithAnimatedCoder:animatedCoder scale:scale];\n}\n\n- (instancetype)initWithAnimatedCoder:(id<SDAnimatedImageCoder>)animatedCoder scale:(CGFloat)scale {\n    if (!animatedCoder) {\n        return nil;\n    }\n    UIImage *image = [animatedCoder animatedImageFrameAtIndex:0];\n    if (!image) {\n        return nil;\n    }\n#if SD_MAC\n    self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:kCGImagePropertyOrientationUp];\n#else\n    self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:image.imageOrientation];\n#endif\n    if (self) {\n        // Only keep the animated coder if frame count > 1, save RAM usage for non-animated image format (APNG/WebP)\n        if (animatedCoder.animatedImageFrameCount > 1) {\n            _animatedCoder = animatedCoder;\n        }\n        NSData *data = [animatedCoder animatedImageData];\n        SDImageFormat format = [NSData sd_imageFormatForImageData:data];\n        _animatedImageFormat = format;\n    }\n    return self;\n}\n\n#pragma mark - Preload\n- (void)preloadAllFrames {\n    if (!_animatedCoder) {\n        return;\n    }\n    if (!self.isAllFramesLoaded) {\n        NSMutableArray<SDImageFrame *> *frames = [NSMutableArray arrayWithCapacity:self.animatedImageFrameCount];\n        for (size_t i = 0; i < self.animatedImageFrameCount; i++) {\n            UIImage *image = [self animatedImageFrameAtIndex:i];\n            NSTimeInterval duration = [self animatedImageDurationAtIndex:i];\n            SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; // through the image should be nonnull, used as nullable for `animatedImageFrameAtIndex:`\n            [frames addObject:frame];\n        }\n        self.loadedAnimatedImageFrames = frames;\n        self.allFramesLoaded = YES;\n    }\n}\n\n- (void)unloadAllFrames {\n    if (!_animatedCoder) {\n        return;\n    }\n    if (self.isAllFramesLoaded) {\n        self.loadedAnimatedImageFrames = nil;\n        self.allFramesLoaded = NO;\n    }\n}\n\n#pragma mark - NSSecureCoding\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    self = [super initWithCoder:aDecoder];\n    if (self) {\n        _animatedImageFormat = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(animatedImageFormat))];\n        NSData *animatedImageData = [aDecoder decodeObjectOfClass:[NSData class] forKey:NSStringFromSelector(@selector(animatedImageData))];\n        if (!animatedImageData) {\n            return self;\n        }\n        CGFloat scale = self.scale;\n        id<SDAnimatedImageCoder> animatedCoder = nil;\n        for (id<SDImageCoder>coder in [SDImageCodersManager sharedManager].coders.reverseObjectEnumerator) {\n            if ([coder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) {\n                if ([coder canDecodeFromData:animatedImageData]) {\n                    animatedCoder = [[[coder class] alloc] initWithAnimatedImageData:animatedImageData options:@{SDImageCoderDecodeScaleFactor : @(scale)}];\n                    break;\n                }\n            }\n        }\n        if (!animatedCoder) {\n            return self;\n        }\n        if (animatedCoder.animatedImageFrameCount > 1) {\n            _animatedCoder = animatedCoder;\n        }\n    }\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [super encodeWithCoder:aCoder];\n    [aCoder encodeInteger:self.animatedImageFormat forKey:NSStringFromSelector(@selector(animatedImageFormat))];\n    NSData *animatedImageData = self.animatedImageData;\n    if (animatedImageData) {\n        [aCoder encodeObject:animatedImageData forKey:NSStringFromSelector(@selector(animatedImageData))];\n    }\n}\n\n+ (BOOL)supportsSecureCoding {\n    return YES;\n}\n\n#pragma mark - SDAnimatedImageProvider\n\n- (NSData *)animatedImageData {\n    return [self.animatedCoder animatedImageData];\n}\n\n- (NSUInteger)animatedImageLoopCount {\n    return [self.animatedCoder animatedImageLoopCount];\n}\n\n- (NSUInteger)animatedImageFrameCount {\n    return [self.animatedCoder animatedImageFrameCount];\n}\n\n- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {\n    if (index >= self.animatedImageFrameCount) {\n        return nil;\n    }\n    if (self.isAllFramesLoaded) {\n        SDImageFrame *frame = [self.loadedAnimatedImageFrames objectAtIndex:index];\n        return frame.image;\n    }\n    return [self.animatedCoder animatedImageFrameAtIndex:index];\n}\n\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index {\n    if (index >= self.animatedImageFrameCount) {\n        return 0;\n    }\n    if (self.isAllFramesLoaded) {\n        SDImageFrame *frame = [self.loadedAnimatedImageFrames objectAtIndex:index];\n        return frame.duration;\n    }\n    return [self.animatedCoder animatedImageDurationAtIndex:index];\n}\n\n@end\n\n@implementation SDAnimatedImage (MemoryCacheCost)\n\n- (NSUInteger)sd_memoryCost {\n    NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost));\n    if (value != nil) {\n        return value.unsignedIntegerValue;\n    }\n    \n    CGImageRef imageRef = self.CGImage;\n    if (!imageRef) {\n        return 0;\n    }\n    NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef);\n    NSUInteger frameCount = 1;\n    if (self.isAllFramesLoaded) {\n        frameCount = self.animatedImageFrameCount;\n    }\n    frameCount = frameCount > 0 ? frameCount : 1;\n    NSUInteger cost = bytesPerFrame * frameCount;\n    return cost;\n}\n\n@end\n\n@implementation SDAnimatedImage (Metadata)\n\n- (BOOL)sd_isAnimated {\n    return YES;\n}\n\n- (NSUInteger)sd_imageLoopCount {\n    return self.animatedImageLoopCount;\n}\n\n- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {\n    return;\n}\n\n- (NSUInteger)sd_imageFrameCount {\n    return self.animatedImageFrameCount;\n}\n\n- (SDImageFormat)sd_imageFormat {\n    return self.animatedImageFormat;\n}\n\n- (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat {\n    return;\n}\n\n- (BOOL)sd_isVector {\n    return NO;\n}\n\n@end\n\n@implementation SDAnimatedImage (MultiFormat)\n\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data {\n    return [self sd_imageWithData:data scale:1];\n}\n\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale {\n    return [self sd_imageWithData:data scale:scale firstFrameOnly:NO];\n}\n\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly {\n    if (!data) {\n        return nil;\n    }\n    return [[self alloc] initWithData:data scale:scale options:@{SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)}];\n}\n\n- (nullable NSData *)sd_imageData {\n    NSData *imageData = self.animatedImageData;\n    if (imageData) {\n        return imageData;\n    } else {\n        return [self sd_imageDataAsFormat:self.animatedImageFormat];\n    }\n}\n\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat {\n    return [self sd_imageDataAsFormat:imageFormat compressionQuality:1];\n}\n\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality {\n    return [self sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO];\n}\n\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly {\n    if (firstFrameOnly) {\n        // First frame, use super implementation\n        return [super sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly];\n    }\n    NSUInteger frameCount = self.animatedImageFrameCount;\n    if (frameCount <= 1) {\n        // Static image, use super implementation\n        return [super sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly];\n    }\n    // Keep animated image encoding, loop each frame.\n    NSMutableArray<SDImageFrame *> *frames = [NSMutableArray arrayWithCapacity:frameCount];\n    for (size_t i = 0; i < frameCount; i++) {\n        UIImage *image = [self animatedImageFrameAtIndex:i];\n        NSTimeInterval duration = [self animatedImageDurationAtIndex:i];\n        SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration];\n        [frames addObject:frame];\n    }\n    UIImage *animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames];\n    NSData *imageData = [animatedImage sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly];\n    return imageData;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n#import \"SDImageCoder.h\"\n\ntypedef NS_ENUM(NSUInteger, SDAnimatedImagePlaybackMode) {\n    /**\n     * From first to last frame and stop or next loop.\n     */\n    SDAnimatedImagePlaybackModeNormal = 0,\n    /**\n     * From last frame to first frame and stop or next loop.\n     */\n    SDAnimatedImagePlaybackModeReverse,\n    /**\n     * From first frame to last frame and reverse again, like reciprocating.\n     */\n    SDAnimatedImagePlaybackModeBounce,\n    /**\n     * From last frame to first frame and reverse again, like reversed reciprocating.\n     */\n    SDAnimatedImagePlaybackModeReversedBounce,\n};\n\n/// A player to control the playback of animated image, which can be used to drive Animated ImageView or any rendering usage, like CALayer/WatchKit/SwiftUI rendering.\n@interface SDAnimatedImagePlayer : NSObject\n\n/// Current playing frame image. This value is KVO Compliance.\n@property (nonatomic, readonly, nullable) UIImage *currentFrame;\n\n/// Current frame index, zero based. This value is KVO Compliance.\n@property (nonatomic, readonly) NSUInteger currentFrameIndex;\n\n/// Current loop count since its latest animating. This value is KVO Compliance.\n@property (nonatomic, readonly) NSUInteger currentLoopCount;\n\n/// Total frame count for animated image rendering. Defaults is animated image's frame count.\n/// @note For progressive animation, you can update this value when your provider receive more frames.\n@property (nonatomic, assign) NSUInteger totalFrameCount;\n\n/// Total loop count for animated image rendering. Default is animated image's loop count.\n@property (nonatomic, assign) NSUInteger totalLoopCount;\n\n/// The animation playback rate. Default is 1.0\n/// `1.0` means the normal speed.\n/// `0.0` means stopping the animation.\n/// `0.0-1.0` means the slow speed.\n/// `> 1.0` means the fast speed.\n/// `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future)\n@property (nonatomic, assign) double playbackRate;\n\n/// Asynchronous setup animation playback mode. Default mode is SDAnimatedImagePlaybackModeNormal.\n@property (nonatomic, assign) SDAnimatedImagePlaybackMode playbackMode;\n\n/// Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0.\n/// `0` means automatically adjust by calculating current memory usage.\n/// `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU)\n/// `NSUIntegerMax` means cache all the buffer. (Lowest CPU and Highest Memory)\n@property (nonatomic, assign) NSUInteger maxBufferSize;\n\n/// You can specify a runloop mode to let it rendering.\n/// Default is NSRunLoopCommonModes on multi-core device, NSDefaultRunLoopMode on single-core device\n@property (nonatomic, copy, nonnull) NSRunLoopMode runLoopMode;\n\n/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil.\n/// The provider can be any protocol implementation, like `SDAnimatedImage`, `SDImageGIFCoder`, etc.\n/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself\n/// @param provider The animated provider\n- (nullable instancetype)initWithProvider:(nonnull id<SDAnimatedImageProvider>)provider;\n\n/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil.\n/// The provider can be any protocol implementation, like `SDAnimatedImage` or `SDImageGIFCoder`, etc.\n/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself\n/// @param provider The animated provider\n+ (nullable instancetype)playerWithProvider:(nonnull id<SDAnimatedImageProvider>)provider;\n\n/// The handler block when current frame and index changed.\n@property (nonatomic, copy, nullable) void (^animationFrameHandler)(NSUInteger index, UIImage * _Nonnull frame);\n\n/// The handler block when one loop count finished.\n@property (nonatomic, copy, nullable) void (^animationLoopHandler)(NSUInteger loopCount);\n\n/// Return the status whether animation is playing.\n@property (nonatomic, readonly) BOOL isPlaying;\n\n/// Start the animation. Or resume the previously paused animation.\n- (void)startPlaying;\n\n/// Pause the animation. Keep the current frame index and loop count.\n- (void)pausePlaying;\n\n/// Stop the animation. Reset the current frame index and loop count.\n- (void)stopPlaying;\n\n/// Seek to the desired frame index and loop count.\n/// @note This can be used for advanced control like progressive loading, or skipping specify frames.\n/// @param index The frame index\n/// @param loopCount The loop count\n- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount;\n\n/// Clear the frame cache buffer. The frame cache buffer size can be controlled by `maxBufferSize`.\n/// By default, when stop or pause the animation, the frame buffer is still kept to ready for the next restart\n- (void)clearFrameBuffer;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDAnimatedImagePlayer.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDDisplayLink.h\"\n#import \"SDDeviceHelper.h\"\n#import \"SDInternalMacros.h\"\n\n@interface SDAnimatedImagePlayer () {\n    SD_LOCK_DECLARE(_lock);\n    NSRunLoopMode _runLoopMode;\n}\n\n@property (nonatomic, strong, readwrite) UIImage *currentFrame;\n@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex;\n@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount;\n@property (nonatomic, strong) id<SDAnimatedImageProvider> animatedProvider;\n@property (nonatomic, strong) NSMutableDictionary<NSNumber *, UIImage *> *frameBuffer;\n@property (nonatomic, assign) NSTimeInterval currentTime;\n@property (nonatomic, assign) BOOL bufferMiss;\n@property (nonatomic, assign) BOOL needsDisplayWhenImageBecomesAvailable;\n@property (nonatomic, assign) BOOL shouldReverse;\n@property (nonatomic, assign) NSUInteger maxBufferCount;\n@property (nonatomic, strong) NSOperationQueue *fetchQueue;\n@property (nonatomic, strong) SDDisplayLink *displayLink;\n\n@end\n\n@implementation SDAnimatedImagePlayer\n\n- (instancetype)initWithProvider:(id<SDAnimatedImageProvider>)provider {\n    self = [super init];\n    if (self) {\n        NSUInteger animatedImageFrameCount = provider.animatedImageFrameCount;\n        // Check the frame count\n        if (animatedImageFrameCount <= 1) {\n            return nil;\n        }\n        self.totalFrameCount = animatedImageFrameCount;\n        // Get the current frame and loop count.\n        self.totalLoopCount = provider.animatedImageLoopCount;\n        self.animatedProvider = provider;\n        self.playbackRate = 1.0;\n        SD_LOCK_INIT(_lock);\n#if SD_UIKIT\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n    }\n    return self;\n}\n\n+ (instancetype)playerWithProvider:(id<SDAnimatedImageProvider>)provider {\n    SDAnimatedImagePlayer *player = [[SDAnimatedImagePlayer alloc] initWithProvider:provider];\n    return player;\n}\n\n#pragma mark - Life Cycle\n\n- (void)dealloc {\n#if SD_UIKIT\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n}\n\n- (void)didReceiveMemoryWarning:(NSNotification *)notification {\n    [_fetchQueue cancelAllOperations];\n    [_fetchQueue addOperationWithBlock:^{\n        NSNumber *currentFrameIndex = @(self.currentFrameIndex);\n        SD_LOCK(self->_lock);\n        NSArray *keys = self.frameBuffer.allKeys;\n        // only keep the next frame for later rendering\n        for (NSNumber * key in keys) {\n            if (![key isEqualToNumber:currentFrameIndex]) {\n                [self.frameBuffer removeObjectForKey:key];\n            }\n        }\n        SD_UNLOCK(self->_lock);\n    }];\n}\n\n#pragma mark - Private\n- (NSOperationQueue *)fetchQueue {\n    if (!_fetchQueue) {\n        _fetchQueue = [[NSOperationQueue alloc] init];\n        _fetchQueue.maxConcurrentOperationCount = 1;\n    }\n    return _fetchQueue;\n}\n\n- (NSMutableDictionary<NSNumber *,UIImage *> *)frameBuffer {\n    if (!_frameBuffer) {\n        _frameBuffer = [NSMutableDictionary dictionary];\n    }\n    return _frameBuffer;\n}\n\n- (SDDisplayLink *)displayLink {\n    if (!_displayLink) {\n        _displayLink = [SDDisplayLink displayLinkWithTarget:self selector:@selector(displayDidRefresh:)];\n        [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.runLoopMode];\n        [_displayLink stop];\n    }\n    return _displayLink;\n}\n\n- (void)setRunLoopMode:(NSRunLoopMode)runLoopMode {\n    if ([_runLoopMode isEqual:runLoopMode]) {\n        return;\n    }\n    if (_displayLink) {\n        if (_runLoopMode) {\n            [_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_runLoopMode];\n        }\n        if (runLoopMode.length > 0) {\n            [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode];\n        }\n    }\n    _runLoopMode = [runLoopMode copy];\n}\n\n- (NSRunLoopMode)runLoopMode {\n    if (!_runLoopMode) {\n        _runLoopMode = [[self class] defaultRunLoopMode];\n    }\n    return _runLoopMode;\n}\n\n#pragma mark - State Control\n\n- (void)setupCurrentFrame {\n    if (self.currentFrameIndex != 0) {\n        return;\n    }\n    if (self.playbackMode == SDAnimatedImagePlaybackModeReverse ||\n               self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) {\n        self.currentFrameIndex = self.totalFrameCount - 1;\n    }\n    \n    if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) {\n        UIImage *image = (UIImage *)self.animatedProvider;\n        // Use the poster image if available\n        #if SD_MAC\n        UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];\n        #else\n        UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];\n        #endif\n        if (posterFrame) {\n            self.currentFrame = posterFrame;\n            SD_LOCK(self->_lock);\n            self.frameBuffer[@(self.currentFrameIndex)] = self.currentFrame;\n            SD_UNLOCK(self->_lock);\n            [self handleFrameChange];\n        }\n    }\n    \n}\n\n- (void)resetCurrentFrameStatus {\n    // These should not trigger KVO, user don't need to receive an `index == 0, image == nil` callback.\n    _currentFrame = nil;\n    _currentFrameIndex = 0;\n    _currentLoopCount = 0;\n    _currentTime = 0;\n    _bufferMiss = NO;\n    _needsDisplayWhenImageBecomesAvailable = NO;\n}\n\n- (void)clearFrameBuffer {\n    SD_LOCK(_lock);\n    [_frameBuffer removeAllObjects];\n    SD_UNLOCK(_lock);\n}\n\n#pragma mark - Animation Control\n- (void)startPlaying {\n    [self.displayLink start];\n    // Setup frame\n    [self setupCurrentFrame];\n    // Calculate max buffer size\n    [self calculateMaxBufferCount];\n}\n\n- (void)stopPlaying {\n    [_fetchQueue cancelAllOperations];\n    // Using `_displayLink` here because when UIImageView dealloc, it may trigger `[self stopAnimating]`, we already release the display link in SDAnimatedImageView's dealloc method.\n    [_displayLink stop];\n    // We need to reset the frame status, but not trigger any handle. This can ensure next time's playing status correct.\n    [self resetCurrentFrameStatus];\n}\n\n- (void)pausePlaying {\n    [_fetchQueue cancelAllOperations];\n    [_displayLink stop];\n}\n\n- (BOOL)isPlaying {\n    return _displayLink.isRunning;\n}\n\n- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount {\n    if (index >= self.totalFrameCount) {\n        return;\n    }\n    self.currentFrameIndex = index;\n    self.currentLoopCount = loopCount;\n    self.currentFrame = [self.animatedProvider animatedImageFrameAtIndex:index];\n    [self handleFrameChange];\n}\n\n#pragma mark - Core Render\n- (void)displayDidRefresh:(SDDisplayLink *)displayLink {\n    // If for some reason a wild call makes it through when we shouldn't be animating, bail.\n    // Early return!\n    if (!self.isPlaying) {\n        return;\n    }\n    \n    NSUInteger totalFrameCount = self.totalFrameCount;\n    if (totalFrameCount <= 1) {\n        // Total frame count less than 1, wrong configuration and stop animating\n        [self stopPlaying];\n        return;\n    }\n    \n    NSTimeInterval playbackRate = self.playbackRate;\n    if (playbackRate <= 0) {\n        // Does not support <= 0 play rate\n        [self stopPlaying];\n        return;\n    }\n    \n    // Calculate refresh duration\n    NSTimeInterval duration = self.displayLink.duration;\n    \n    NSUInteger currentFrameIndex = self.currentFrameIndex;\n    NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount;\n    \n    if (self.playbackMode == SDAnimatedImagePlaybackModeReverse) {\n        nextFrameIndex = currentFrameIndex == 0 ? (totalFrameCount - 1) : (currentFrameIndex - 1) % totalFrameCount;\n        \n    } else if (self.playbackMode == SDAnimatedImagePlaybackModeBounce ||\n               self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) {\n        if (currentFrameIndex == 0) {\n            self.shouldReverse = false;\n        } else if (currentFrameIndex == totalFrameCount - 1) {\n            self.shouldReverse = true;\n        }\n        nextFrameIndex = self.shouldReverse ? (currentFrameIndex - 1) : (currentFrameIndex + 1);\n        nextFrameIndex %= totalFrameCount;\n    }\n    \n    \n    // Check if we need to display new frame firstly\n    BOOL bufferFull = NO;\n    if (self.needsDisplayWhenImageBecomesAvailable) {\n        UIImage *currentFrame;\n        SD_LOCK(_lock);\n        currentFrame = self.frameBuffer[@(currentFrameIndex)];\n        SD_UNLOCK(_lock);\n        \n        // Update the current frame\n        if (currentFrame) {\n            SD_LOCK(_lock);\n            // Remove the frame buffer if need\n            if (self.frameBuffer.count > self.maxBufferCount) {\n                self.frameBuffer[@(currentFrameIndex)] = nil;\n            }\n            // Check whether we can stop fetch\n            if (self.frameBuffer.count == totalFrameCount) {\n                bufferFull = YES;\n            }\n            SD_UNLOCK(_lock);\n            \n            // Update the current frame immediately\n            self.currentFrame = currentFrame;\n            [self handleFrameChange];\n            \n            self.bufferMiss = NO;\n            self.needsDisplayWhenImageBecomesAvailable = NO;\n        }\n        else {\n            self.bufferMiss = YES;\n        }\n    }\n    \n    // Check if we have the frame buffer\n    if (!self.bufferMiss) {\n        // Then check if timestamp is reached\n        self.currentTime += duration;\n        NSTimeInterval currentDuration = [self.animatedProvider animatedImageDurationAtIndex:currentFrameIndex];\n        currentDuration = currentDuration / playbackRate;\n        if (self.currentTime < currentDuration) {\n            // Current frame timestamp not reached, return\n            return;\n        }\n        \n        // Otherwise, we should be ready to display next frame\n        self.needsDisplayWhenImageBecomesAvailable = YES;\n        self.currentFrameIndex = nextFrameIndex;\n        self.currentTime -= currentDuration;\n        NSTimeInterval nextDuration = [self.animatedProvider animatedImageDurationAtIndex:nextFrameIndex];\n        nextDuration = nextDuration / playbackRate;\n        if (self.currentTime > nextDuration) {\n            // Do not skip frame\n            self.currentTime = nextDuration;\n        }\n        \n        // Update the loop count when last frame rendered\n        if (nextFrameIndex == 0) {\n            // Update the loop count\n            self.currentLoopCount++;\n            [self handleLoopChange];\n            \n            // if reached the max loop count, stop animating, 0 means loop indefinitely\n            NSUInteger maxLoopCount = self.totalLoopCount;\n            if (maxLoopCount != 0 && (self.currentLoopCount >= maxLoopCount)) {\n                [self stopPlaying];\n                return;\n            }\n        }\n    }\n    \n    // Since we support handler, check animating state again\n    if (!self.isPlaying) {\n        return;\n    }\n    \n    // Check if we should prefetch next frame or current frame\n    // When buffer miss, means the decode speed is slower than render speed, we fetch current miss frame\n    // Or, most cases, the decode speed is faster than render speed, we fetch next frame\n    NSUInteger fetchFrameIndex = self.bufferMiss? currentFrameIndex : nextFrameIndex;\n    UIImage *fetchFrame;\n    SD_LOCK(_lock);\n    fetchFrame = self.bufferMiss? nil : self.frameBuffer[@(nextFrameIndex)];\n    SD_UNLOCK(_lock);\n    \n    if (!fetchFrame && !bufferFull && self.fetchQueue.operationCount == 0) {\n        // Prefetch next frame in background queue\n        id<SDAnimatedImageProvider> animatedProvider = self.animatedProvider;\n        @weakify(self);\n        NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{\n            @strongify(self);\n            if (!self) {\n                return;\n            }\n            UIImage *frame = [animatedProvider animatedImageFrameAtIndex:fetchFrameIndex];\n\n            BOOL isAnimating = self.displayLink.isRunning;\n            if (isAnimating) {\n                SD_LOCK(self->_lock);\n                self.frameBuffer[@(fetchFrameIndex)] = frame;\n                SD_UNLOCK(self->_lock);\n            }\n        }];\n        [self.fetchQueue addOperation:operation];\n    }\n}\n\n- (void)handleFrameChange {\n    if (self.animationFrameHandler) {\n        self.animationFrameHandler(self.currentFrameIndex, self.currentFrame);\n    }\n}\n\n- (void)handleLoopChange {\n    if (self.animationLoopHandler) {\n        self.animationLoopHandler(self.currentLoopCount);\n    }\n}\n\n#pragma mark - Util\n- (void)calculateMaxBufferCount {\n    NSUInteger bytes = CGImageGetBytesPerRow(self.currentFrame.CGImage) * CGImageGetHeight(self.currentFrame.CGImage);\n    if (bytes == 0) bytes = 1024;\n    \n    NSUInteger max = 0;\n    if (self.maxBufferSize > 0) {\n        max = self.maxBufferSize;\n    } else {\n        // Calculate based on current memory, these factors are by experience\n        NSUInteger total = [SDDeviceHelper totalMemory];\n        NSUInteger free = [SDDeviceHelper freeMemory];\n        max = MIN(total * 0.2, free * 0.6);\n    }\n    \n    NSUInteger maxBufferCount = (double)max / (double)bytes;\n    if (!maxBufferCount) {\n        // At least 1 frame\n        maxBufferCount = 1;\n    }\n    \n    self.maxBufferCount = maxBufferCount;\n}\n\n+ (NSString *)defaultRunLoopMode {\n    // Key off `activeProcessorCount` (as opposed to `processorCount`) since the system could shut down cores in certain situations.\n    return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_MAC\n\n/**\n A subclass of `NSBitmapImageRep` to fix that GIF duration issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`.\n This also fix the GIF loop count issue, which will use the Netscape standard (See http://www6.uniovi.es/gifanim/gifabout.htm)  to only place once when the `kCGImagePropertyGIFLoopCount` is nil. This is what modern browser's behavior.\n Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image.\n This also support APNG format using `SDImageAPNGCoder`. Which provide full alpha-channel support and the correct duration match the `kCGImagePropertyAPNGUnclampedDelayTime`.\n */\n@interface SDAnimatedImageRep : NSBitmapImageRep\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDAnimatedImageRep.h\"\n\n#if SD_MAC\n\n#import \"SDImageIOAnimatedCoderInternal.h\"\n#import \"SDImageGIFCoder.h\"\n#import \"SDImageAPNGCoder.h\"\n#import \"SDImageHEICCoder.h\"\n#import \"SDImageAWebPCoder.h\"\n\n@implementation SDAnimatedImageRep {\n    CGImageSourceRef _imageSource;\n}\n\n- (void)dealloc {\n    if (_imageSource) {\n        CFRelease(_imageSource);\n        _imageSource = NULL;\n    }\n}\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n  SDAnimatedImageRep *imageRep = [super copyWithZone:zone];\n  CFRetain(imageRep->_imageSource);\n  return imageRep;\n}\n\n// `NSBitmapImageRep`'s `imageRepWithData:` is not designed initializer\n+ (instancetype)imageRepWithData:(NSData *)data {\n    SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data];\n    return imageRep;\n}\n\n// We should override init method for `NSBitmapImageRep` to do initialize about animated image format\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunguarded-availability\"\n- (instancetype)initWithData:(NSData *)data {\n    self = [super initWithData:data];\n    if (self) {\n        CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef) data, NULL);\n        if (!imageSource) {\n            return self;\n        }\n        _imageSource = imageSource;\n        NSUInteger frameCount = CGImageSourceGetCount(imageSource);\n        if (frameCount <= 1) {\n            return self;\n        }\n        CFStringRef type = CGImageSourceGetType(imageSource);\n        if (!type) {\n            return self;\n        }\n        if (CFStringCompare(type, kSDUTTypeGIF, 0) == kCFCompareEqualTo) {\n            // GIF\n            // Fix the `NSBitmapImageRep` GIF loop count calculation issue\n            // Which will use 0 when there are no loop count information metadata in GIF data\n            NSUInteger loopCount = [SDImageGIFCoder imageLoopCountWithSource:imageSource];\n            [self setProperty:NSImageLoopCount withValue:@(loopCount)];\n        } else if (CFStringCompare(type, kSDUTTypePNG, 0) == kCFCompareEqualTo) {\n            // APNG\n            // Do initialize about frame count, current frame/duration and loop count\n            [self setProperty:NSImageFrameCount withValue:@(frameCount)];\n            [self setProperty:NSImageCurrentFrame withValue:@(0)];\n            NSUInteger loopCount = [SDImageAPNGCoder imageLoopCountWithSource:imageSource];\n            [self setProperty:NSImageLoopCount withValue:@(loopCount)];\n        } else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) {\n            // HEIC\n            // Do initialize about frame count, current frame/duration and loop count\n            [self setProperty:NSImageFrameCount withValue:@(frameCount)];\n            [self setProperty:NSImageCurrentFrame withValue:@(0)];\n            NSUInteger loopCount = [SDImageHEICCoder imageLoopCountWithSource:imageSource];\n            [self setProperty:NSImageLoopCount withValue:@(loopCount)];\n        } else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) {\n            // WebP\n            // Do initialize about frame count, current frame/duration and loop count\n            [self setProperty:NSImageFrameCount withValue:@(frameCount)];\n            [self setProperty:NSImageCurrentFrame withValue:@(0)];\n            NSUInteger loopCount = [SDImageAWebPCoder imageLoopCountWithSource:imageSource];\n            [self setProperty:NSImageLoopCount withValue:@(loopCount)];\n        }\n    }\n    return self;\n}\n\n// `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need.\n- (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value {\n    [super setProperty:property withValue:value];\n    if ([property isEqualToString:NSImageCurrentFrame]) {\n        // Access the image source\n        CGImageSourceRef imageSource = _imageSource;\n        if (!imageSource) {\n            return;\n        }\n        // Check format type\n        CFStringRef type = CGImageSourceGetType(imageSource);\n        if (!type) {\n            return;\n        }\n        NSUInteger index = [value unsignedIntegerValue];\n        NSTimeInterval frameDuration = 0;\n        if (CFStringCompare(type, kSDUTTypeGIF, 0) == kCFCompareEqualTo) {\n            // GIF\n            frameDuration = [SDImageGIFCoder frameDurationAtIndex:index source:imageSource];\n        } else if (CFStringCompare(type, kSDUTTypePNG, 0) == kCFCompareEqualTo) {\n            // APNG\n            frameDuration = [SDImageAPNGCoder frameDurationAtIndex:index source:imageSource];\n        } else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) {\n            // HEIC\n            frameDuration = [SDImageHEICCoder frameDurationAtIndex:index source:imageSource];\n        } else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) {\n            // WebP\n            frameDuration = [SDImageAWebPCoder frameDurationAtIndex:index source:imageSource];\n        }\n        if (!frameDuration) {\n            return;\n        }\n        // Reset super frame duration with the actual frame duration\n        [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)];\n    }\n}\n#pragma clang diagnostic pop\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDAnimatedImageView.h\"\n\n#if SD_UIKIT || SD_MAC\n\n#import \"SDWebImageManager.h\"\n\n/**\n Integrates SDWebImage async downloading and caching of remote images with SDAnimatedImageView.\n */\n@interface SDAnimatedImageView (WebCache)\n\n/**\n * Set the imageView `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url The url for the image.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url` and a placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @see sd_setImageWithURL:placeholderImage:options:\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context;\n\n/**\n * Set the imageView `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `image` with an `url`, placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                 completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `image` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDAnimatedImageView+WebCache.h\"\n\n#if SD_UIKIT || SD_MAC\n\n#import \"UIView+WebCache.h\"\n#import \"SDAnimatedImage.h\"\n\n@implementation SDAnimatedImageView (WebCache)\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url {\n    [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock {\n    Class animatedImageClass = [SDAnimatedImage class];\n    SDWebImageMutableContext *mutableContext;\n    if (context) {\n        mutableContext = [context mutableCopy];\n    } else {\n        mutableContext = [NSMutableDictionary dictionary];\n    }\n    mutableContext[SDWebImageContextAnimatedImageClass] = animatedImageClass;\n    [self sd_internalSetImageWithURL:url\n                    placeholderImage:placeholder\n                             options:options\n                             context:mutableContext\n                       setImageBlock:nil\n                            progress:progressBlock\n                           completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                               if (completedBlock) {\n                                   completedBlock(image, error, cacheType, imageURL);\n                               }\n                           }];\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_UIKIT || SD_MAC\n\n#import \"SDAnimatedImage.h\"\n#import \"SDAnimatedImagePlayer.h\"\n\n/**\n A drop-in replacement for UIImageView/NSImageView, you can use this for animated image rendering.\n Call `setImage:` with `UIImage(NSImage)` which conforms to `SDAnimatedImage` protocol will start animated image rendering. Call with normal UIImage(NSImage) will back to normal UIImageView(NSImageView) rendering\n For UIKit: use `-startAnimating`, `-stopAnimating` to control animating. `isAnimating` to check animation state.\n For AppKit: use `-setAnimates:` to control animating, `animates` to check animation state. This view is layer-backed.\n */\n@interface SDAnimatedImageView : UIImageView\n/**\n The internal animation player.\n This property is only used for advanced usage, like inspecting/debugging animation status, control progressive loading, complicated animation frame index control, etc.\n @warning Pay attention if you directly update the player's property like `totalFrameCount`, `totalLoopCount`, the same property on `SDAnimatedImageView` may not get synced.\n */\n@property (nonatomic, strong, readonly, nullable) SDAnimatedImagePlayer *player;\n\n/**\n Current display frame image. This value is KVO Compliance.\n */\n@property (nonatomic, strong, readonly, nullable) UIImage *currentFrame;\n/**\n Current frame index, zero based. This value is KVO Compliance.\n */\n@property (nonatomic, assign, readonly) NSUInteger currentFrameIndex;\n/**\n Current loop count since its latest animating. This value is KVO Compliance.\n */\n@property (nonatomic, assign, readonly) NSUInteger currentLoopCount;\n/**\n YES to choose `animationRepeatCount` property for animation loop count. No to use animated image's `animatedImageLoopCount` instead.\n Default is NO.\n */\n@property (nonatomic, assign) BOOL shouldCustomLoopCount;\n/**\n Total loop count for animated image rendering. Default is animated image's loop count.\n If you need to set custom loop count, set `shouldCustomLoopCount` to YES and change this value.\n This class override UIImageView's `animationRepeatCount` property on iOS, use this property as well.\n */\n@property (nonatomic, assign) NSInteger animationRepeatCount;\n/**\n The animation playback rate. Default is 1.0.\n `1.0` means the normal speed.\n `0.0` means stopping the animation.\n `0.0-1.0` means the slow speed.\n `> 1.0` means the fast speed.\n `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future)\n */\n@property (nonatomic, assign) double playbackRate;\n\n/// Asynchronous setup animation playback mode. Default mode is SDAnimatedImagePlaybackModeNormal.\n@property (nonatomic, assign) SDAnimatedImagePlaybackMode playbackMode;\n\n/**\n Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0.\n `0` means automatically adjust by calculating current memory usage.\n `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU)\n `NSUIntegerMax` means cache all the buffer. (Lowest CPU and Highest Memory)\n */\n@property (nonatomic, assign) NSUInteger maxBufferSize;\n/**\n Whehter or not to enable incremental image load for animated image. This is for the animated image which `sd_isIncremental` is YES (See `UIImage+Metadata.h`). If enable, animated image rendering will stop at the last frame available currently, and continue when another `setImage:` trigger, where the new animated image's `animatedImageData` should be updated from the previous one. If the `sd_isIncremental` is NO. The incremental image load stop.\n @note If you are confused about this description, open Chrome browser to view some large GIF images with low network speed to see the animation behavior.\n @note The best practice to use incremental load is using `initWithAnimatedCoder:scale:` in `SDAnimatedImage` with animated coder which conform to `SDProgressiveImageCoder` as well. Then call incremental update and incremental decode method to produce the image.\n Default is YES. Set to NO to only render the static poster for incremental animated image.\n */\n@property (nonatomic, assign) BOOL shouldIncrementalLoad;\n\n/**\n Whether or not to clear the frame buffer cache when animation stopped. See `maxBufferSize`\n This is useful when you want to limit the memory usage during frequently visibility changes (such as image view inside a list view, then push and pop)\n Default is NO.\n */\n@property (nonatomic, assign) BOOL clearBufferWhenStopped;\n\n/**\n Whether or not to reset the current frame index when animation stopped.\n For some of use case, you may want to reset the frame index to 0 when stop, but some other want to keep the current frame index.\n Default is NO.\n */\n@property (nonatomic, assign) BOOL resetFrameIndexWhenStopped;\n\n/**\n If the image which conforms to `SDAnimatedImage` protocol has more than one frame, set this value to `YES` will automatically\n play/stop the animation when the view become visible/invisible.\n Default is YES.\n */\n@property (nonatomic, assign) BOOL autoPlayAnimatedImage;\n\n/**\n You can specify a runloop mode to let it rendering.\n Default is NSRunLoopCommonModes on multi-core device, NSDefaultRunLoopMode on single-core device\n @note This is useful for some cases, for example, always specify NSDefaultRunLoopMode, if you want to pause the animation when user scroll (for Mac user, drag the mouse or touchpad)\n */\n@property (nonatomic, copy, nonnull) NSRunLoopMode runLoopMode;\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDAnimatedImageView.h\"\n\n#if SD_UIKIT || SD_MAC\n\n#import \"UIImage+Metadata.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDInternalMacros.h\"\n#import \"objc/runtime.h\"\n\n@interface UIImageView () <CALayerDelegate>\n@end\n\n@interface SDAnimatedImageView () {\n    BOOL _initFinished; // Extra flag to mark the `commonInit` is called\n    NSRunLoopMode _runLoopMode;\n    NSUInteger _maxBufferSize;\n    double _playbackRate;\n    SDAnimatedImagePlaybackMode _playbackMode;\n}\n\n@property (nonatomic, strong, readwrite) SDAnimatedImagePlayer *player;\n@property (nonatomic, strong, readwrite) UIImage *currentFrame;\n@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex;\n@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount;\n@property (nonatomic, assign) BOOL shouldAnimate;\n@property (nonatomic, assign) BOOL isProgressive;\n@property (nonatomic) CALayer *imageViewLayer; // The actual rendering layer.\n\n@end\n\n@implementation SDAnimatedImageView\n#if SD_UIKIT\n@dynamic animationRepeatCount; // we re-use this property from `UIImageView` super class on iOS.\n#endif\n\n#pragma mark - Initializers\n\n#if SD_MAC\n+ (instancetype)imageViewWithImage:(NSImage *)image\n{\n    NSRect frame = NSMakeRect(0, 0, image.size.width, image.size.height);\n    SDAnimatedImageView *imageView = [[SDAnimatedImageView alloc] initWithFrame:frame];\n    [imageView setImage:image];\n    return imageView;\n}\n#else\n// -initWithImage: isn't documented as a designated initializer of UIImageView, but it actually seems to be.\n// Using -initWithImage: doesn't call any of the other designated initializers.\n- (instancetype)initWithImage:(UIImage *)image\n{\n    self = [super initWithImage:image];\n    if (self) {\n        [self commonInit];\n    }\n    return self;\n}\n\n// -initWithImage:highlightedImage: also isn't documented as a designated initializer of UIImageView, but it doesn't call any other designated initializers.\n- (instancetype)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage\n{\n    self = [super initWithImage:image highlightedImage:highlightedImage];\n    if (self) {\n        [self commonInit];\n    }\n    return self;\n}\n#endif\n\n- (instancetype)initWithFrame:(CGRect)frame\n{\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self commonInit];\n    }\n    return self;\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder\n{\n    self = [super initWithCoder:aDecoder];\n    if (self) {\n        [self commonInit];\n    }\n    return self;\n}\n\n- (void)commonInit\n{\n    // Pay attention that UIKit's `initWithImage:` will trigger a `setImage:` during initialization before this `commonInit`.\n    // So the properties which rely on this order, should using lazy-evaluation or do extra check in `setImage:`.\n    self.autoPlayAnimatedImage = YES;\n    self.shouldCustomLoopCount = NO;\n    self.shouldIncrementalLoad = YES;\n    self.playbackRate = 1.0;\n#if SD_MAC\n    self.wantsLayer = YES;\n#endif\n    // Mark commonInit finished\n    _initFinished = YES;\n}\n\n#pragma mark - Accessors\n#pragma mark Public\n\n- (void)setImage:(UIImage *)image\n{\n    if (self.image == image) {\n        return;\n    }\n    \n    // Check Progressive rendering\n    [self updateIsProgressiveWithImage:image];\n    \n    if (!self.isProgressive) {\n        // Stop animating\n        self.player = nil;\n        self.currentFrame = nil;\n        self.currentFrameIndex = 0;\n        self.currentLoopCount = 0;\n    }\n    \n    // We need call super method to keep function. This will impliedly call `setNeedsDisplay`. But we have no way to avoid this when using animated image. So we call `setNeedsDisplay` again at the end.\n    super.image = image;\n    if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) {\n        if (!self.player) {\n            id<SDAnimatedImageProvider> provider;\n            // Check progressive loading\n            if (self.isProgressive) {\n                provider = [self progressiveAnimatedCoderForImage:image];\n            } else {\n                provider = (id<SDAnimatedImage>)image;\n            }\n            // Create animated player\n            self.player = [SDAnimatedImagePlayer playerWithProvider:provider];\n        } else {\n            // Update Frame Count\n            self.player.totalFrameCount = [(id<SDAnimatedImage>)image animatedImageFrameCount];\n        }\n        \n        if (!self.player) {\n            // animated player nil means the image format is not supported, or frame count <= 1\n            return;\n        }\n        \n        // Custom Loop Count\n        if (self.shouldCustomLoopCount) {\n            self.player.totalLoopCount = self.animationRepeatCount;\n        }\n        \n        // RunLoop Mode\n        self.player.runLoopMode = self.runLoopMode;\n        \n        // Max Buffer Size\n        self.player.maxBufferSize = self.maxBufferSize;\n        \n        // Play Rate\n        self.player.playbackRate = self.playbackRate;\n        \n        // Play Mode\n        self.player.playbackMode = self.playbackMode;\n\n        // Setup handler\n        @weakify(self);\n        self.player.animationFrameHandler = ^(NSUInteger index, UIImage * frame) {\n            @strongify(self);\n            self.currentFrameIndex = index;\n            self.currentFrame = frame;\n            [self.imageViewLayer setNeedsDisplay];\n        };\n        self.player.animationLoopHandler = ^(NSUInteger loopCount) {\n            @strongify(self);\n            // Progressive image reach the current last frame index. Keep the state and pause animating. Wait for later restart\n            if (self.isProgressive) {\n                NSUInteger lastFrameIndex = self.player.totalFrameCount - 1;\n                [self.player seekToFrameAtIndex:lastFrameIndex loopCount:0];\n                [self.player pausePlaying];\n            } else {\n                self.currentLoopCount = loopCount;\n            }\n        };\n        \n        // Ensure disabled highlighting; it's not supported (see `-setHighlighted:`).\n        super.highlighted = NO;\n        \n        [self stopAnimating];\n        [self checkPlay];\n\n        [self.imageViewLayer setNeedsDisplay];\n    }\n}\n\n#pragma mark - Configuration\n\n- (void)setRunLoopMode:(NSRunLoopMode)runLoopMode\n{\n    _runLoopMode = [runLoopMode copy];\n    self.player.runLoopMode = runLoopMode;\n}\n\n- (NSRunLoopMode)runLoopMode\n{\n    if (!_runLoopMode) {\n        _runLoopMode = [[self class] defaultRunLoopMode];\n    }\n    return _runLoopMode;\n}\n\n+ (NSString *)defaultRunLoopMode {\n    // Key off `activeProcessorCount` (as opposed to `processorCount`) since the system could shut down cores in certain situations.\n    return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode;\n}\n\n- (void)setMaxBufferSize:(NSUInteger)maxBufferSize\n{\n    _maxBufferSize = maxBufferSize;\n    self.player.maxBufferSize = maxBufferSize;\n}\n\n- (NSUInteger)maxBufferSize {\n    return _maxBufferSize; // Defaults to 0\n}\n\n- (void)setPlaybackRate:(double)playbackRate\n{\n    _playbackRate = playbackRate;\n    self.player.playbackRate = playbackRate;\n}\n\n- (double)playbackRate\n{\n    if (!_initFinished) {\n        return 1.0; // Defaults to 1.0\n    }\n    return _playbackRate;\n}\n\n- (void)setPlaybackMode:(SDAnimatedImagePlaybackMode)playbackMode {\n    _playbackMode = playbackMode;\n    self.player.playbackMode = playbackMode;\n}\n\n- (SDAnimatedImagePlaybackMode)playbackMode {\n    if (!_initFinished) {\n        return SDAnimatedImagePlaybackModeNormal; // Default mode is normal\n    }\n    return _playbackMode;\n}\n\n\n- (BOOL)shouldIncrementalLoad\n{\n    if (!_initFinished) {\n        return YES; // Defaults to YES\n    }\n    return _initFinished;\n}\n\n#pragma mark - UIView Method Overrides\n#pragma mark Observing View-Related Changes\n\n#if SD_MAC\n- (void)viewDidMoveToSuperview\n#else\n- (void)didMoveToSuperview\n#endif\n{\n#if SD_MAC\n    [super viewDidMoveToSuperview];\n#else\n    [super didMoveToSuperview];\n#endif\n    \n    [self checkPlay];\n}\n\n#if SD_MAC\n- (void)viewDidMoveToWindow\n#else\n- (void)didMoveToWindow\n#endif\n{\n#if SD_MAC\n    [super viewDidMoveToWindow];\n#else\n    [super didMoveToWindow];\n#endif\n    \n    [self checkPlay];\n}\n\n#if SD_MAC\n- (void)setAlphaValue:(CGFloat)alphaValue\n#else\n- (void)setAlpha:(CGFloat)alpha\n#endif\n{\n#if SD_MAC\n    [super setAlphaValue:alphaValue];\n#else\n    [super setAlpha:alpha];\n#endif\n    \n    [self checkPlay];\n}\n\n- (void)setHidden:(BOOL)hidden\n{\n    [super setHidden:hidden];\n    \n    [self checkPlay];\n}\n\n#pragma mark - UIImageView Method Overrides\n#pragma mark Image Data\n\n- (void)setAnimationRepeatCount:(NSInteger)animationRepeatCount\n{\n#if SD_UIKIT\n    [super setAnimationRepeatCount:animationRepeatCount];\n#else\n    _animationRepeatCount = animationRepeatCount;\n#endif\n    \n    if (self.shouldCustomLoopCount) {\n        self.player.totalLoopCount = animationRepeatCount;\n    }\n}\n\n- (void)startAnimating\n{\n    if (self.player) {\n        [self updateShouldAnimate];\n        if (self.shouldAnimate) {\n            [self.player startPlaying];\n        }\n    } else {\n#if SD_UIKIT\n        [super startAnimating];\n#else\n        [super setAnimates:YES];\n#endif\n    }\n}\n\n- (void)stopAnimating\n{\n    if (self.player) {\n        if (self.resetFrameIndexWhenStopped) {\n            [self.player stopPlaying];\n        } else {\n            [self.player pausePlaying];\n        }\n        if (self.clearBufferWhenStopped) {\n            [self.player clearFrameBuffer];\n        }\n    } else {\n#if SD_UIKIT\n        [super stopAnimating];\n#else\n        [super setAnimates:NO];\n#endif\n    }\n}\n\n#if SD_UIKIT\n- (BOOL)isAnimating\n{\n    if (self.player) {\n        return self.player.isPlaying;\n    } else {\n        return [super isAnimating];\n    }\n}\n#endif\n\n#if SD_MAC\n- (BOOL)animates\n{\n    if (self.player) {\n        return self.player.isPlaying;\n    } else {\n        return [super animates];\n    }\n}\n\n- (void)setAnimates:(BOOL)animates\n{\n    if (animates) {\n        [self startAnimating];\n    } else {\n        [self stopAnimating];\n    }\n}\n#endif\n\n#pragma mark Highlighted Image Unsupport\n\n- (void)setHighlighted:(BOOL)highlighted\n{\n    // Highlighted image is unsupported for animated images, but implementing it breaks the image view when embedded in a UICollectionViewCell.\n    if (!self.player) {\n        [super setHighlighted:highlighted];\n    }\n}\n\n\n#pragma mark - Private Methods\n#pragma mark Animation\n\n/// Check if it should be played\n- (void)checkPlay\n{\n    // Only handle for SDAnimatedImage, leave UIAnimatedImage or animationImages for super implementation control\n    if (self.player && self.autoPlayAnimatedImage) {\n        [self updateShouldAnimate];\n        if (self.shouldAnimate) {\n            [self startAnimating];\n        } else {\n            [self stopAnimating];\n        }\n    }\n}\n\n// Don't repeatedly check our window & superview in `-displayDidRefresh:` for performance reasons.\n// Just update our cached value whenever the animated image or visibility (window, superview, hidden, alpha) is changed.\n- (void)updateShouldAnimate\n{\n#if SD_MAC\n    BOOL isVisible = self.window && self.superview && ![self isHidden] && self.alphaValue > 0.0;\n#else\n    BOOL isVisible = self.window && self.superview && ![self isHidden] && self.alpha > 0.0;\n#endif\n    self.shouldAnimate = self.player && isVisible;\n}\n\n// Update progressive status only after `setImage:` call.\n- (void)updateIsProgressiveWithImage:(UIImage *)image\n{\n    self.isProgressive = NO;\n    if (!self.shouldIncrementalLoad) {\n        // Early return\n        return;\n    }\n    // We must use `image.class conformsToProtocol:` instead of `image conformsToProtocol:` here\n    // Because UIKit on macOS, using internal hard-coded override method, which returns NO\n    id<SDAnimatedImageCoder> currentAnimatedCoder = [self progressiveAnimatedCoderForImage:image];\n    if (currentAnimatedCoder) {\n        UIImage *previousImage = self.image;\n        if (!previousImage) {\n            // If current animated coder supports progressive, and no previous image to check, start progressive loading\n            self.isProgressive = YES;\n        } else {\n            id<SDAnimatedImageCoder> previousAnimatedCoder = [self progressiveAnimatedCoderForImage:previousImage];\n            if (previousAnimatedCoder == currentAnimatedCoder) {\n                // If current animated coder is the same as previous, start progressive loading\n                self.isProgressive = YES;\n            }\n        }\n    }\n}\n\n// Check if image can represent a `Progressive Animated Image` during loading\n- (id<SDAnimatedImageCoder, SDProgressiveImageCoder>)progressiveAnimatedCoderForImage:(UIImage *)image\n{\n    if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)] && image.sd_isIncremental && [image respondsToSelector:@selector(animatedCoder)]) {\n        id<SDAnimatedImageCoder> animatedCoder = [(id<SDAnimatedImage>)image animatedCoder];\n        if ([animatedCoder conformsToProtocol:@protocol(SDProgressiveImageCoder)]) {\n            return (id<SDAnimatedImageCoder, SDProgressiveImageCoder>)animatedCoder;\n        }\n    }\n    return nil;\n}\n\n\n#pragma mark Providing the Layer's Content\n#pragma mark - CALayerDelegate\n\n- (void)displayLayer:(CALayer *)layer\n{\n    UIImage *currentFrame = self.currentFrame;\n    if (currentFrame) {\n        layer.contentsScale = currentFrame.scale;\n        layer.contents = (__bridge id)currentFrame.CGImage;\n    } else {\n        // If we have no animation frames, call super implementation. iOS 14+ UIImageView use this delegate method for rendering.\n        if ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) {\n            [super displayLayer:layer];\n        }\n    }\n}\n\n#if SD_MAC\n// NSImageView use a subview. We need this subview's layer for actual rendering.\n// Why using this design may because of properties like `imageAlignment` and `imageScaling`, which it's not available for UIImageView.contentMode (it's impossible to align left and keep aspect ratio at the same time)\n- (NSView *)imageView {\n    NSImageView *imageView = objc_getAssociatedObject(self, SD_SEL_SPI(imageView));\n    if (!imageView) {\n        // macOS 10.14\n        imageView = objc_getAssociatedObject(self, SD_SEL_SPI(imageSubview));\n    }\n    return imageView;\n}\n\n// on macOS, it's the imageView subview's layer (we use layer-hosting view to let CALayerDelegate works)\n- (CALayer *)imageViewLayer {\n    NSView *imageView = self.imageView;\n    if (!imageView) {\n        return nil;\n    }\n    if (!_imageViewLayer) {\n        _imageViewLayer = [CALayer new];\n        _imageViewLayer.delegate = self;\n        imageView.layer = _imageViewLayer;\n        imageView.wantsLayer = YES;\n    }\n    return _imageViewLayer;\n}\n#else\n// on iOS, it's the imageView itself's layer\n- (CALayer *)imageViewLayer {\n    return self.layer;\n}\n\n#endif\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n@class SDImageCacheConfig;\n/**\n A protocol to allow custom disk cache used in SDImageCache.\n */\n@protocol SDDiskCache <NSObject>\n\n// All of these method are called from the same global queue to avoid blocking on main queue and thread-safe problem. But it's also recommend to ensure thread-safe yourself using lock or other ways.\n@required\n/**\n Create a new disk cache based on the specified path. You can check `maxDiskSize` and `maxDiskAge` used for disk cache.\n \n @param cachePath Full path of a directory in which the cache will write data.\n Once initialized you should not read and write to this directory.\n @param config The cache config to be used to create the cache.\n \n @return A new cache object, or nil if an error occurs.\n */\n- (nullable instancetype)initWithCachePath:(nonnull NSString *)cachePath config:(nonnull SDImageCacheConfig *)config;\n\n/**\n Returns a boolean value that indicates whether a given key is in cache.\n This method may blocks the calling thread until file read finished.\n \n @param key A string identifying the data. If nil, just return NO.\n @return Whether the key is in cache.\n */\n- (BOOL)containsDataForKey:(nonnull NSString *)key;\n\n/**\n Returns the data associated with a given key.\n This method may blocks the calling thread until file read finished.\n \n @param key A string identifying the data. If nil, just return nil.\n @return The value associated with key, or nil if no value is associated with key.\n */\n- (nullable NSData *)dataForKey:(nonnull NSString *)key;\n\n/**\n Sets the value of the specified key in the cache.\n This method may blocks the calling thread until file write finished.\n \n @param data The data to be stored in the cache.\n @param key    The key with which to associate the value. If nil, this method has no effect.\n */\n- (void)setData:(nullable NSData *)data forKey:(nonnull NSString *)key;\n\n/**\n Returns the extended data associated with a given key.\n This method may blocks the calling thread until file read finished.\n \n @param key A string identifying the data. If nil, just return nil.\n @return The value associated with key, or nil if no value is associated with key.\n */\n- (nullable NSData *)extendedDataForKey:(nonnull NSString *)key;\n\n/**\n Set extended data with a given key.\n \n @discussion You can set any extended data to exist cache key. Without override the exist disk file data.\n on UNIX, the common way for this is to use the Extended file attributes (xattr)\n \n @param extendedData The extended data (pass nil to remove).\n @param key The key with which to associate the value. If nil, this method has no effect.\n*/\n- (void)setExtendedData:(nullable NSData *)extendedData forKey:(nonnull NSString *)key;\n\n/**\n Removes the value of the specified key in the cache.\n This method may blocks the calling thread until file delete finished.\n \n @param key The key identifying the value to be removed. If nil, this method has no effect.\n */\n- (void)removeDataForKey:(nonnull NSString *)key;\n\n/**\n Empties the cache.\n This method may blocks the calling thread until file delete finished.\n */\n- (void)removeAllData;\n\n/**\n Removes the expired data from the cache. You can choose the data to remove base on `ageLimit`, `countLimit` and `sizeLimit` options.\n */\n- (void)removeExpiredData;\n\n/**\n The cache path for key\n\n @param key A string identifying the value\n @return The cache path for key. Or nil if the key can not associate to a path\n */\n- (nullable NSString *)cachePathForKey:(nonnull NSString *)key;\n\n/**\n Returns the number of data in this cache.\n This method may blocks the calling thread until file read finished.\n \n @return The total data count.\n */\n- (NSUInteger)totalCount;\n\n/**\n Returns the total size (in bytes) of data in this cache.\n This method may blocks the calling thread until file read finished.\n \n @return The total data size in bytes.\n */\n- (NSUInteger)totalSize;\n\n@end\n\n/**\n The built-in disk cache.\n */\n@interface SDDiskCache : NSObject <SDDiskCache>\n/**\n Cache Config object - storing all kind of settings.\n */\n@property (nonatomic, strong, readonly, nonnull) SDImageCacheConfig *config;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n\n/**\n Move the cache directory from old location to new location, the old location will be removed after finish.\n If the old location does not exist, does nothing.\n If the new location does not exist, only do a movement of directory.\n If the new location does exist, will move and merge the files from old location.\n If the new location does exist, but is not a directory, will remove it and do a movement of directory.\n\n @param srcPath old location of cache directory\n @param dstPath new location of cache directory\n */\n- (void)moveCacheDirectoryFromPath:(nonnull NSString *)srcPath toPath:(nonnull NSString *)dstPath;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDDiskCache.h\"\n#import \"SDImageCacheConfig.h\"\n#import \"SDFileAttributeHelper.h\"\n#import <CommonCrypto/CommonDigest.h>\n\nstatic NSString * const SDDiskCacheExtendedAttributeName = @\"com.hackemist.SDDiskCache\";\n\n@interface SDDiskCache ()\n\n@property (nonatomic, copy) NSString *diskCachePath;\n@property (nonatomic, strong, nonnull) NSFileManager *fileManager;\n\n@end\n\n@implementation SDDiskCache\n\n- (instancetype)init {\n    NSAssert(NO, @\"Use `initWithCachePath:` with the disk cache path\");\n    return nil;\n}\n\n#pragma mark - SDcachePathForKeyDiskCache Protocol\n- (instancetype)initWithCachePath:(NSString *)cachePath config:(nonnull SDImageCacheConfig *)config {\n    if (self = [super init]) {\n        _diskCachePath = cachePath;\n        _config = config;\n        [self commonInit];\n    }\n    return self;\n}\n\n- (void)commonInit {\n    if (self.config.fileManager) {\n        self.fileManager = self.config.fileManager;\n    } else {\n        self.fileManager = [NSFileManager new];\n    }\n}\n\n- (BOOL)containsDataForKey:(NSString *)key {\n    NSParameterAssert(key);\n    NSString *filePath = [self cachePathForKey:key];\n    BOOL exists = [self.fileManager fileExistsAtPath:filePath];\n    \n    // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name\n    // checking the key with and without the extension\n    if (!exists) {\n        exists = [self.fileManager fileExistsAtPath:filePath.stringByDeletingPathExtension];\n    }\n    \n    return exists;\n}\n\n- (NSData *)dataForKey:(NSString *)key {\n    NSParameterAssert(key);\n    NSString *filePath = [self cachePathForKey:key];\n    NSData *data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil];\n    if (data) {\n        return data;\n    }\n    \n    // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name\n    // checking the key with and without the extension\n    data = [NSData dataWithContentsOfFile:filePath.stringByDeletingPathExtension options:self.config.diskCacheReadingOptions error:nil];\n    if (data) {\n        return data;\n    }\n    \n    return nil;\n}\n\n- (void)setData:(NSData *)data forKey:(NSString *)key {\n    NSParameterAssert(data);\n    NSParameterAssert(key);\n    if (![self.fileManager fileExistsAtPath:self.diskCachePath]) {\n        [self.fileManager createDirectoryAtPath:self.diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL];\n    }\n    \n    // get cache Path for image key\n    NSString *cachePathForKey = [self cachePathForKey:key];\n    // transform to NSURL\n    NSURL *fileURL = [NSURL fileURLWithPath:cachePathForKey];\n    \n    [data writeToURL:fileURL options:self.config.diskCacheWritingOptions error:nil];\n    \n    // disable iCloud backup\n    if (self.config.shouldDisableiCloud) {\n        // ignore iCloud backup resource value error\n        [fileURL setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil];\n    }\n}\n\n- (NSData *)extendedDataForKey:(NSString *)key {\n    NSParameterAssert(key);\n    \n    // get cache Path for image key\n    NSString *cachePathForKey = [self cachePathForKey:key];\n    \n    NSData *extendedData = [SDFileAttributeHelper extendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil];\n    \n    return extendedData;\n}\n\n- (void)setExtendedData:(NSData *)extendedData forKey:(NSString *)key {\n    NSParameterAssert(key);\n    // get cache Path for image key\n    NSString *cachePathForKey = [self cachePathForKey:key];\n    \n    if (!extendedData) {\n        // Remove\n        [SDFileAttributeHelper removeExtendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil];\n    } else {\n        // Override\n        [SDFileAttributeHelper setExtendedAttribute:SDDiskCacheExtendedAttributeName value:extendedData atPath:cachePathForKey traverseLink:NO overwrite:YES error:nil];\n    }\n}\n\n- (void)removeDataForKey:(NSString *)key {\n    NSParameterAssert(key);\n    NSString *filePath = [self cachePathForKey:key];\n    [self.fileManager removeItemAtPath:filePath error:nil];\n}\n\n- (void)removeAllData {\n    [self.fileManager removeItemAtPath:self.diskCachePath error:nil];\n    [self.fileManager createDirectoryAtPath:self.diskCachePath\n            withIntermediateDirectories:YES\n                             attributes:nil\n                                  error:NULL];\n}\n\n- (void)removeExpiredData {\n    NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES];\n    \n    // Compute content date key to be used for tests\n    NSURLResourceKey cacheContentDateKey = NSURLContentModificationDateKey;\n    switch (self.config.diskCacheExpireType) {\n        case SDImageCacheConfigExpireTypeAccessDate:\n            cacheContentDateKey = NSURLContentAccessDateKey;\n            break;\n        case SDImageCacheConfigExpireTypeModificationDate:\n            cacheContentDateKey = NSURLContentModificationDateKey;\n            break;\n        case SDImageCacheConfigExpireTypeCreationDate:\n            cacheContentDateKey = NSURLCreationDateKey;\n            break;\n        case SDImageCacheConfigExpireTypeChangeDate:\n            cacheContentDateKey = NSURLAttributeModificationDateKey;\n            break;\n        default:\n            break;\n    }\n    \n    NSArray<NSString *> *resourceKeys = @[NSURLIsDirectoryKey, cacheContentDateKey, NSURLTotalFileAllocatedSizeKey];\n    \n    // This enumerator prefetches useful properties for our cache files.\n    NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtURL:diskCacheURL\n                                               includingPropertiesForKeys:resourceKeys\n                                                                  options:NSDirectoryEnumerationSkipsHiddenFiles\n                                                             errorHandler:NULL];\n    \n    NSDate *expirationDate = (self.config.maxDiskAge < 0) ? nil: [NSDate dateWithTimeIntervalSinceNow:-self.config.maxDiskAge];\n    NSMutableDictionary<NSURL *, NSDictionary<NSString *, id> *> *cacheFiles = [NSMutableDictionary dictionary];\n    NSUInteger currentCacheSize = 0;\n    \n    // Enumerate all of the files in the cache directory.  This loop has two purposes:\n    //\n    //  1. Removing files that are older than the expiration date.\n    //  2. Storing file attributes for the size-based cleanup pass.\n    NSMutableArray<NSURL *> *urlsToDelete = [[NSMutableArray alloc] init];\n    for (NSURL *fileURL in fileEnumerator) {\n        NSError *error;\n        NSDictionary<NSString *, id> *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:&error];\n        \n        // Skip directories and errors.\n        if (error || !resourceValues || [resourceValues[NSURLIsDirectoryKey] boolValue]) {\n            continue;\n        }\n        \n        // Remove files that are older than the expiration date;\n        NSDate *modifiedDate = resourceValues[cacheContentDateKey];\n        if (expirationDate && [[modifiedDate laterDate:expirationDate] isEqualToDate:expirationDate]) {\n            [urlsToDelete addObject:fileURL];\n            continue;\n        }\n        \n        // Store a reference to this file and account for its total size.\n        NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];\n        currentCacheSize += totalAllocatedSize.unsignedIntegerValue;\n        cacheFiles[fileURL] = resourceValues;\n    }\n    \n    for (NSURL *fileURL in urlsToDelete) {\n        [self.fileManager removeItemAtURL:fileURL error:nil];\n    }\n    \n    // If our remaining disk cache exceeds a configured maximum size, perform a second\n    // size-based cleanup pass.  We delete the oldest files first.\n    NSUInteger maxDiskSize = self.config.maxDiskSize;\n    if (maxDiskSize > 0 && currentCacheSize > maxDiskSize) {\n        // Target half of our maximum cache size for this cleanup pass.\n        const NSUInteger desiredCacheSize = maxDiskSize / 2;\n        \n        // Sort the remaining cache files by their last modification time or last access time (oldest first).\n        NSArray<NSURL *> *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent\n                                                                 usingComparator:^NSComparisonResult(id obj1, id obj2) {\n                                                                     return [obj1[cacheContentDateKey] compare:obj2[cacheContentDateKey]];\n                                                                 }];\n        \n        // Delete files until we fall below our desired cache size.\n        for (NSURL *fileURL in sortedFiles) {\n            if ([self.fileManager removeItemAtURL:fileURL error:nil]) {\n                NSDictionary<NSString *, id> *resourceValues = cacheFiles[fileURL];\n                NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];\n                currentCacheSize -= totalAllocatedSize.unsignedIntegerValue;\n                \n                if (currentCacheSize < desiredCacheSize) {\n                    break;\n                }\n            }\n        }\n    }\n}\n\n- (nullable NSString *)cachePathForKey:(NSString *)key {\n    NSParameterAssert(key);\n    return [self cachePathForKey:key inPath:self.diskCachePath];\n}\n\n- (NSUInteger)totalSize {\n    NSUInteger size = 0;\n    NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath];\n    for (NSString *fileName in fileEnumerator) {\n        NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName];\n        NSDictionary<NSString *, id> *attrs = [self.fileManager attributesOfItemAtPath:filePath error:nil];\n        size += [attrs fileSize];\n    }\n    return size;\n}\n\n- (NSUInteger)totalCount {\n    NSUInteger count = 0;\n    NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath];\n    count = fileEnumerator.allObjects.count;\n    return count;\n}\n\n#pragma mark - Cache paths\n\n- (nullable NSString *)cachePathForKey:(nullable NSString *)key inPath:(nonnull NSString *)path {\n    NSString *filename = SDDiskCacheFileNameForKey(key);\n    return [path stringByAppendingPathComponent:filename];\n}\n\n- (void)moveCacheDirectoryFromPath:(nonnull NSString *)srcPath toPath:(nonnull NSString *)dstPath {\n    NSParameterAssert(srcPath);\n    NSParameterAssert(dstPath);\n    // Check if old path is equal to new path\n    if ([srcPath isEqualToString:dstPath]) {\n        return;\n    }\n    BOOL isDirectory;\n    // Check if old path is directory\n    if (![self.fileManager fileExistsAtPath:srcPath isDirectory:&isDirectory] || !isDirectory) {\n        return;\n    }\n    // Check if new path is directory\n    if (![self.fileManager fileExistsAtPath:dstPath isDirectory:&isDirectory] || !isDirectory) {\n        if (!isDirectory) {\n            // New path is not directory, remove file\n            [self.fileManager removeItemAtPath:dstPath error:nil];\n        }\n        NSString *dstParentPath = [dstPath stringByDeletingLastPathComponent];\n        // Creates any non-existent parent directories as part of creating the directory in path\n        if (![self.fileManager fileExistsAtPath:dstParentPath]) {\n            [self.fileManager createDirectoryAtPath:dstParentPath withIntermediateDirectories:YES attributes:nil error:NULL];\n        }\n        // New directory does not exist, rename directory\n        [self.fileManager moveItemAtPath:srcPath toPath:dstPath error:nil];\n    } else {\n        // New directory exist, merge the files\n        NSDirectoryEnumerator *dirEnumerator = [self.fileManager enumeratorAtPath:srcPath];\n        NSString *file;\n        while ((file = [dirEnumerator nextObject])) {\n            [self.fileManager moveItemAtPath:[srcPath stringByAppendingPathComponent:file] toPath:[dstPath stringByAppendingPathComponent:file] error:nil];\n        }\n        // Remove the old path\n        [self.fileManager removeItemAtPath:srcPath error:nil];\n    }\n}\n\n#pragma mark - Hash\n\n#define SD_MAX_FILE_EXTENSION_LENGTH (NAME_MAX - CC_MD5_DIGEST_LENGTH * 2 - 1)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\nstatic inline NSString * _Nonnull SDDiskCacheFileNameForKey(NSString * _Nullable key) {\n    const char *str = key.UTF8String;\n    if (str == NULL) {\n        str = \"\";\n    }\n    unsigned char r[CC_MD5_DIGEST_LENGTH];\n    CC_MD5(str, (CC_LONG)strlen(str), r);\n    NSURL *keyURL = [NSURL URLWithString:key];\n    NSString *ext = keyURL ? keyURL.pathExtension : key.pathExtension;\n    // File system has file name length limit, we need to check if ext is too long, we don't add it to the filename\n    if (ext.length > SD_MAX_FILE_EXTENSION_LENGTH) {\n        ext = nil;\n    }\n    NSString *filename = [NSString stringWithFormat:@\"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%@\",\n                          r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10],\n                          r[11], r[12], r[13], r[14], r[15], ext.length == 0 ? @\"\" : [NSString stringWithFormat:@\".%@\", ext]];\n    return filename;\n}\n#pragma clang diagnostic pop\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDWebImageCompat.h\"\n\n/**\n These following class are provided to use `UIGraphicsImageRenderer` with polyfill, which allows write cross-platform(AppKit/UIKit) code and avoid runtime version check.\n Compared to `UIGraphicsBeginImageContext`, `UIGraphicsImageRenderer` use dynamic bitmap from your draw code to generate CGContext, not always use ARGB8888, which is more performant on RAM usage.\n Which means, if you draw CGImage/CIImage which contains grayscale only, the underlaying bitmap context use grayscale, it's managed by system and not a fixed type. (actually, the `kCGContextTypeAutomatic`)\n For usage, See more in Apple's documentation: https://developer.apple.com/documentation/uikit/uigraphicsimagerenderer\n For UIKit on iOS/tvOS 10+, these method just use the same `UIGraphicsImageRenderer` API.\n For others (macOS/watchOS or iOS/tvOS 10-), these method use the `SDImageGraphics.h` to implements the same behavior (but without dynamic bitmap support)\n*/\n\ntypedef void (^SDGraphicsImageDrawingActions)(CGContextRef _Nonnull context);\ntypedef NS_ENUM(NSInteger, SDGraphicsImageRendererFormatRange) {\n    SDGraphicsImageRendererFormatRangeUnspecified = -1,\n    SDGraphicsImageRendererFormatRangeAutomatic = 0,\n    SDGraphicsImageRendererFormatRangeExtended,\n    SDGraphicsImageRendererFormatRangeStandard\n};\n\n/// A set of drawing attributes that represent the configuration of an image renderer context.\n@interface SDGraphicsImageRendererFormat : NSObject\n\n/// The display scale of the image renderer context.\n/// The default value is equal to the scale of the main screen.\n@property (nonatomic) CGFloat scale;\n\n/// A Boolean value indicating whether the underlying Core Graphics context has an alpha channel.\n/// The default value is NO.\n@property (nonatomic) BOOL opaque;\n\n/// Specifying whether the bitmap context should use extended color.\n/// For iOS 12+, the value is from system `preferredRange` property\n/// For iOS 10-11, the value is from system `prefersExtendedRange` property\n/// For iOS 9-, the value is `.standard`\n@property (nonatomic) SDGraphicsImageRendererFormatRange preferredRange;\n\n/// Init the default format. See each properties's default value.\n- (nonnull instancetype)init;\n\n/// Returns a new format best suited for the main screen’s current configuration.\n+ (nonnull instancetype)preferredFormat;\n\n@end\n\n/// A graphics renderer for creating Core Graphics-backed images.\n@interface SDGraphicsImageRenderer : NSObject\n\n/// Creates an image renderer for drawing images of a given size.\n/// @param size The size of images output from the renderer, specified in points.\n/// @return An initialized image renderer.\n- (nonnull instancetype)initWithSize:(CGSize)size;\n\n/// Creates a new image renderer with a given size and format.\n/// @param size The size of images output from the renderer, specified in points.\n/// @param format A SDGraphicsImageRendererFormat object that encapsulates the format used to create the renderer context.\n/// @return An initialized image renderer.\n- (nonnull instancetype)initWithSize:(CGSize)size format:(nonnull SDGraphicsImageRendererFormat *)format;\n\n/// Creates an image by following a set of drawing instructions.\n/// @param actions A SDGraphicsImageDrawingActions block that, when invoked by the renderer, executes a set of drawing instructions to create the output image.\n/// @note You should not retain or use the context outside the block, it's non-escaping.\n/// @return A UIImage object created by the supplied drawing actions.\n- (nonnull UIImage *)imageWithActions:(nonnull NS_NOESCAPE SDGraphicsImageDrawingActions)actions;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDGraphicsImageRenderer.h\"\n#import \"SDImageGraphics.h\"\n\n@interface SDGraphicsImageRendererFormat ()\n#if SD_UIKIT\n@property (nonatomic, strong) UIGraphicsImageRendererFormat *uiformat API_AVAILABLE(ios(10.0), tvos(10.0));\n#endif\n@end\n\n@implementation SDGraphicsImageRendererFormat\n@synthesize scale = _scale;\n@synthesize opaque = _opaque;\n@synthesize preferredRange = _preferredRange;\n\n#pragma mark - Property\n- (CGFloat)scale {\n#if SD_UIKIT\n    if (@available(iOS 10.0, tvOS 10.10, *)) {\n        return self.uiformat.scale;\n    } else {\n        return _scale;\n    }\n#else\n    return _scale;\n#endif\n}\n\n- (void)setScale:(CGFloat)scale {\n#if SD_UIKIT\n    if (@available(iOS 10.0, tvOS 10.10, *)) {\n        self.uiformat.scale = scale;\n    } else {\n        _scale = scale;\n    }\n#else\n    _scale = scale;\n#endif\n}\n\n- (BOOL)opaque {\n#if SD_UIKIT\n    if (@available(iOS 10.0, tvOS 10.10, *)) {\n        return self.uiformat.opaque;\n    } else {\n        return _opaque;\n    }\n#else\n    return _opaque;\n#endif\n}\n\n- (void)setOpaque:(BOOL)opaque {\n#if SD_UIKIT\n    if (@available(iOS 10.0, tvOS 10.10, *)) {\n        self.uiformat.opaque = opaque;\n    } else {\n        _opaque = opaque;\n    }\n#else\n    _opaque = opaque;\n#endif\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n- (SDGraphicsImageRendererFormatRange)preferredRange {\n#if SD_UIKIT\n    if (@available(iOS 10.0, tvOS 10.10, *)) {\n        if (@available(iOS 12.0, tvOS 12.0, *)) {\n            return (SDGraphicsImageRendererFormatRange)self.uiformat.preferredRange;\n        } else {\n            BOOL prefersExtendedRange = self.uiformat.prefersExtendedRange;\n            if (prefersExtendedRange) {\n                return SDGraphicsImageRendererFormatRangeExtended;\n            } else {\n                return SDGraphicsImageRendererFormatRangeStandard;\n            }\n        }\n    } else {\n        return _preferredRange;\n    }\n#else\n    return _preferredRange;\n#endif\n}\n\n- (void)setPreferredRange:(SDGraphicsImageRendererFormatRange)preferredRange {\n#if SD_UIKIT\n    if (@available(iOS 10.0, tvOS 10.10, *)) {\n        if (@available(iOS 12.0, tvOS 12.0, *)) {\n            self.uiformat.preferredRange = (UIGraphicsImageRendererFormatRange)preferredRange;\n        } else {\n            switch (preferredRange) {\n                case SDGraphicsImageRendererFormatRangeExtended:\n                    self.uiformat.prefersExtendedRange = YES;\n                    break;\n                case SDGraphicsImageRendererFormatRangeStandard:\n                    self.uiformat.prefersExtendedRange = NO;\n                default:\n                    // Automatic means default\n                    break;\n            }\n        }\n    } else {\n        _preferredRange = preferredRange;\n    }\n#else\n    _preferredRange = preferredRange;\n#endif\n}\n#pragma clang diagnostic pop\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n#if SD_UIKIT\n        if (@available(iOS 10.0, tvOS 10.10, *)) {\n            UIGraphicsImageRendererFormat *uiformat = [[UIGraphicsImageRendererFormat alloc] init];\n            self.uiformat = uiformat;\n        } else {\n#endif\n#if SD_WATCH\n            CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale;\n#elif SD_UIKIT\n            CGFloat screenScale = [UIScreen mainScreen].scale;\n#elif SD_MAC\n            CGFloat screenScale = [NSScreen mainScreen].backingScaleFactor;\n#endif\n            self.scale = screenScale;\n            self.opaque = NO;\n            self.preferredRange = SDGraphicsImageRendererFormatRangeStandard;\n#if SD_UIKIT\n        }\n#endif\n    }\n    return self;\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunguarded-availability\"\n- (instancetype)initForMainScreen {\n    self = [super init];\n    if (self) {\n#if SD_UIKIT\n        if (@available(iOS 10.0, tvOS 10.0, *)) {\n            UIGraphicsImageRendererFormat *uiformat;\n            // iOS 11.0.0 GM does have `preferredFormat`, but iOS 11 betas did not (argh!)\n            if ([UIGraphicsImageRenderer respondsToSelector:@selector(preferredFormat)]) {\n                uiformat = [UIGraphicsImageRendererFormat preferredFormat];\n            } else {\n                uiformat = [UIGraphicsImageRendererFormat defaultFormat];\n            }\n            self.uiformat = uiformat;\n        } else {\n#endif\n#if SD_WATCH\n            CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale;\n#elif SD_UIKIT\n            CGFloat screenScale = [UIScreen mainScreen].scale;\n#elif SD_MAC\n            CGFloat screenScale = [NSScreen mainScreen].backingScaleFactor;\n#endif\n            self.scale = screenScale;\n            self.opaque = NO;\n            self.preferredRange = SDGraphicsImageRendererFormatRangeStandard;\n#if SD_UIKIT\n        }\n#endif\n    }\n    return self;\n}\n#pragma clang diagnostic pop\n\n+ (instancetype)preferredFormat {\n    SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] initForMainScreen];\n    return format;\n}\n\n@end\n\n@interface SDGraphicsImageRenderer ()\n@property (nonatomic, assign) CGSize size;\n@property (nonatomic, strong) SDGraphicsImageRendererFormat *format;\n#if SD_UIKIT\n@property (nonatomic, strong) UIGraphicsImageRenderer *uirenderer API_AVAILABLE(ios(10.0), tvos(10.0));\n#endif\n@end\n\n@implementation SDGraphicsImageRenderer\n\n- (instancetype)initWithSize:(CGSize)size {\n    return [self initWithSize:size format:SDGraphicsImageRendererFormat.preferredFormat];\n}\n\n- (instancetype)initWithSize:(CGSize)size format:(SDGraphicsImageRendererFormat *)format {\n    NSParameterAssert(format);\n    self = [super init];\n    if (self) {\n        self.size = size;\n        self.format = format;\n#if SD_UIKIT\n        if (@available(iOS 10.0, tvOS 10.0, *)) {\n            UIGraphicsImageRendererFormat *uiformat = format.uiformat;\n            self.uirenderer = [[UIGraphicsImageRenderer alloc] initWithSize:size format:uiformat];\n        }\n#endif\n    }\n    return self;\n}\n\n- (UIImage *)imageWithActions:(NS_NOESCAPE SDGraphicsImageDrawingActions)actions {\n    NSParameterAssert(actions);\n#if SD_UIKIT\n    if (@available(iOS 10.0, tvOS 10.0, *)) {\n        UIGraphicsImageDrawingActions uiactions = ^(UIGraphicsImageRendererContext *rendererContext) {\n            if (actions) {\n                actions(rendererContext.CGContext);\n            }\n        };\n        return [self.uirenderer imageWithActions:uiactions];\n    } else {\n#endif\n        SDGraphicsBeginImageContextWithOptions(self.size, self.format.opaque, self.format.scale);\n        CGContextRef context = SDGraphicsGetCurrentContext();\n        if (actions) {\n            actions(context);\n        }\n        UIImage *image = SDGraphicsGetImageFromCurrentImageContext();\n        SDGraphicsEndImageContext();\n        return image;\n#if SD_UIKIT\n    }\n#endif\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDImageIOAnimatedCoder.h\"\n\n/**\n Built in coder using ImageIO that supports APNG encoding/decoding\n */\n@interface SDImageAPNGCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>\n\n@property (nonatomic, class, readonly, nonnull) SDImageAPNGCoder *sharedCoder;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageAPNGCoder.h\"\n#import \"SDImageIOAnimatedCoderInternal.h\"\n#if SD_MAC\n#import <CoreServices/CoreServices.h>\n#else\n#import <MobileCoreServices/MobileCoreServices.h>\n#endif\n\n@implementation SDImageAPNGCoder\n\n+ (instancetype)sharedCoder {\n    static SDImageAPNGCoder *coder;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        coder = [[SDImageAPNGCoder alloc] init];\n    });\n    return coder;\n}\n\n#pragma mark - Subclass Override\n\n+ (SDImageFormat)imageFormat {\n    return SDImageFormatPNG;\n}\n\n+ (NSString *)imageUTType {\n    return (__bridge NSString *)kSDUTTypePNG;\n}\n\n+ (NSString *)dictionaryProperty {\n    return (__bridge NSString *)kCGImagePropertyPNGDictionary;\n}\n\n+ (NSString *)unclampedDelayTimeProperty {\n    return (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime;\n}\n\n+ (NSString *)delayTimeProperty {\n    return (__bridge NSString *)kCGImagePropertyAPNGDelayTime;\n}\n\n+ (NSString *)loopCountProperty {\n    return (__bridge NSString *)kCGImagePropertyAPNGLoopCount;\n}\n\n+ (NSUInteger)defaultLoopCount {\n    return 0;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDImageIOAnimatedCoder.h\"\n\n/**\n This coder is used for Google WebP and Animated WebP(AWebP) image format.\n Image/IO provide the WebP decoding support in iOS 14/macOS 11/tvOS 14/watchOS 7+.\n @note Currently Image/IO seems does not supports WebP encoding, if you need WebP encoding, use the custom codec below.\n @note If you need to support lower firmware version for WebP, you can have a try at https://github.com/SDWebImage/SDWebImageWebPCoder\n */\nAPI_AVAILABLE(ios(14.0), tvos(14.0), macos(11.0), watchos(7.0))\n@interface SDImageAWebPCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>\n\n@property (nonatomic, class, readonly, nonnull) SDImageAWebPCoder *sharedCoder;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDImageAWebPCoder.h\"\n#import \"SDImageIOAnimatedCoderInternal.h\"\n\n// These constants are available from iOS 14+ and Xcode 12. This raw value is used for toolchain and firmware compatibility\nstatic NSString * kSDCGImagePropertyWebPDictionary = @\"{WebP}\";\nstatic NSString * kSDCGImagePropertyWebPLoopCount = @\"LoopCount\";\nstatic NSString * kSDCGImagePropertyWebPDelayTime = @\"DelayTime\";\nstatic NSString * kSDCGImagePropertyWebPUnclampedDelayTime = @\"UnclampedDelayTime\";\n\n@implementation SDImageAWebPCoder\n\n+ (void)initialize {\n#if __IPHONE_14_0 || __TVOS_14_0 || __MAC_11_0 || __WATCHOS_7_0\n    // Xcode 12\n    if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) {\n        // Use SDK instead of raw value\n        kSDCGImagePropertyWebPDictionary = (__bridge NSString *)kCGImagePropertyWebPDictionary;\n        kSDCGImagePropertyWebPLoopCount = (__bridge NSString *)kCGImagePropertyWebPLoopCount;\n        kSDCGImagePropertyWebPDelayTime = (__bridge NSString *)kCGImagePropertyWebPDelayTime;\n        kSDCGImagePropertyWebPUnclampedDelayTime = (__bridge NSString *)kCGImagePropertyWebPUnclampedDelayTime;\n    }\n#endif\n}\n\n+ (instancetype)sharedCoder {\n    static SDImageAWebPCoder *coder;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        coder = [[SDImageAWebPCoder alloc] init];\n    });\n    return coder;\n}\n\n#pragma mark - SDImageCoder\n\n- (BOOL)canDecodeFromData:(nullable NSData *)data {\n    switch ([NSData sd_imageFormatForImageData:data]) {\n        case SDImageFormatWebP:\n            // Check WebP decoding compatibility\n            return [self.class canDecodeFromFormat:SDImageFormatWebP];\n        default:\n            return NO;\n    }\n}\n\n- (BOOL)canIncrementalDecodeFromData:(NSData *)data {\n    return [self canDecodeFromData:data];\n}\n\n- (BOOL)canEncodeToFormat:(SDImageFormat)format {\n    switch (format) {\n        case SDImageFormatWebP:\n            // Check WebP encoding compatibility\n            return [self.class canEncodeToFormat:SDImageFormatWebP];\n        default:\n            return NO;\n    }\n}\n\n#pragma mark - Subclass Override\n\n+ (SDImageFormat)imageFormat {\n    return SDImageFormatWebP;\n}\n\n+ (NSString *)imageUTType {\n    return (__bridge NSString *)kSDUTTypeWebP;\n}\n\n+ (NSString *)dictionaryProperty {\n    return kSDCGImagePropertyWebPDictionary;\n}\n\n+ (NSString *)unclampedDelayTimeProperty {\n    return kSDCGImagePropertyWebPUnclampedDelayTime;\n}\n\n+ (NSString *)delayTimeProperty {\n    return kSDCGImagePropertyWebPDelayTime;\n}\n\n+ (NSString *)loopCountProperty {\n    return kSDCGImagePropertyWebPLoopCount;\n}\n\n+ (NSUInteger)defaultLoopCount {\n    return 0;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageDefine.h\"\n#import \"SDImageCacheConfig.h\"\n#import \"SDImageCacheDefine.h\"\n#import \"SDMemoryCache.h\"\n#import \"SDDiskCache.h\"\n\n/// Image Cache Options\ntypedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) {\n    /**\n     * By default, we do not query image data when the image is already cached in memory. This mask can force to query image data at the same time. However, this query is asynchronously unless you specify `SDImageCacheQueryMemoryDataSync`\n     */\n    SDImageCacheQueryMemoryData = 1 << 0,\n    /**\n     * By default, when you only specify `SDImageCacheQueryMemoryData`, we query the memory image data asynchronously. Combined this mask as well to query the memory image data synchronously.\n     */\n    SDImageCacheQueryMemoryDataSync = 1 << 1,\n    /**\n     * By default, when the memory cache miss, we query the disk cache asynchronously. This mask can force to query disk cache (when memory cache miss) synchronously.\n     @note These 3 query options can be combined together. For the full list about these masks combination, see wiki page.\n     */\n    SDImageCacheQueryDiskDataSync = 1 << 2,\n    /**\n     * By default, images are decoded respecting their original size. On iOS, this flag will scale down the\n     * images to a size compatible with the constrained memory of devices.\n     */\n    SDImageCacheScaleDownLargeImages = 1 << 3,\n    /**\n     * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation.\n     * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image.\n     */\n    SDImageCacheAvoidDecodeImage = 1 << 4,\n    /**\n     * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.\n     */\n    SDImageCacheDecodeFirstFrameOnly = 1 << 5,\n    /**\n     * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from disk cache\n     */\n    SDImageCachePreloadAllFrames = 1 << 6,\n    /**\n     * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution.\n     * Using this option, can ensure we always produce image with your provided class. If failed, an error with code `SDWebImageErrorBadImageData` will be used.\n     * Note this options is not compatible with `SDImageCacheDecodeFirstFrameOnly`, which always produce a UIImage/NSImage.\n     */\n    SDImageCacheMatchAnimatedImageClass = 1 << 7,\n};\n\n/**\n * SDImageCache maintains a memory cache and a disk cache. Disk cache write operations are performed\n * asynchronous so it doesn’t add unnecessary latency to the UI.\n */\n@interface SDImageCache : NSObject\n\n#pragma mark - Properties\n\n/**\n *  Cache Config object - storing all kind of settings.\n *  The property is copy so change of current config will not accidentally affect other cache's config.\n */\n@property (nonatomic, copy, nonnull, readonly) SDImageCacheConfig *config;\n\n/**\n * The memory cache implementation object used for current image cache.\n * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method.\n * @note To customize this class, check `SDImageCacheConfig.memoryCacheClass` property.\n */\n@property (nonatomic, strong, readonly, nonnull) id<SDMemoryCache> memoryCache;\n\n/**\n * The disk cache implementation object used for current image cache.\n * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method.\n * @note To customize this class, check `SDImageCacheConfig.diskCacheClass` property.\n * @warning When calling method about read/write in disk cache, be sure to either make your disk cache implementation IO-safe or using the same access queue to avoid issues.\n */\n@property (nonatomic, strong, readonly, nonnull) id<SDDiskCache> diskCache;\n\n/**\n *  The disk cache's root path\n */\n@property (nonatomic, copy, nonnull, readonly) NSString *diskCachePath;\n\n/**\n *  The additional disk cache path to check if the query from disk cache not exist;\n *  The `key` param is the image cache key. The returned file path will be used to load the disk cache. If return nil, ignore it.\n *  Useful if you want to bundle pre-loaded images with your app\n */\n@property (nonatomic, copy, nullable) SDImageCacheAdditionalCachePathBlock additionalCachePathBlock;\n\n#pragma mark - Singleton and initialization\n\n/**\n * Returns global shared cache instance\n */\n@property (nonatomic, class, readonly, nonnull) SDImageCache *sharedImageCache;\n\n/**\n * Control the default disk cache directory. This will effect all the SDImageCache instance created after modification, even for shared image cache.\n * This can be used to share the same disk cache with the App and App Extension (Today/Notification Widget) using `- [NSFileManager.containerURLForSecurityApplicationGroupIdentifier:]`.\n * @note If you pass nil, the value will be reset to `~/Library/Caches/com.hackemist.SDImageCache`.\n * @note We still preserve the `namespace` arg, which means, if you change this property into `/path/to/use`,  the `SDImageCache.sharedImageCache.diskCachePath` should be `/path/to/use/default` because shared image cache use `default` as namespace.\n * Defaults to nil.\n */\n@property (nonatomic, class, readwrite, null_resettable) NSString *defaultDiskCacheDirectory;\n\n/**\n * Init a new cache store with a specific namespace\n * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/)\n *\n * @param ns The namespace to use for this cache store\n */\n- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns;\n\n/**\n * Init a new cache store with a specific namespace and directory.\n * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/)\n *\n * @param ns        The namespace to use for this cache store\n * @param directory Directory to cache disk images in\n */\n- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns\n                       diskCacheDirectory:(nullable NSString *)directory;\n\n/**\n * Init a new cache store with a specific namespace, directory and config.\n * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/)\n *\n * @param ns          The namespace to use for this cache store\n * @param directory   Directory to cache disk images in\n * @param config      The cache config to be used to create the cache. You can provide custom memory cache or disk cache class in the cache config\n */\n- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns\n                       diskCacheDirectory:(nullable NSString *)directory\n                                   config:(nullable SDImageCacheConfig *)config NS_DESIGNATED_INITIALIZER;\n\n#pragma mark - Cache paths\n\n/**\n Get the cache path for a certain key\n \n @param key The unique image cache key\n @return The cache path. You can check `lastPathComponent` to grab the file name.\n */\n- (nullable NSString *)cachePathForKey:(nullable NSString *)key;\n\n#pragma mark - Store Ops\n\n/**\n * Asynchronously store an image into memory and disk cache at the given key.\n *\n * @param image           The image to store\n * @param key             The unique image cache key, usually it's image absolute URL\n * @param completionBlock A block executed after the operation is finished\n */\n- (void)storeImage:(nullable UIImage *)image\n            forKey:(nullable NSString *)key\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock;\n\n/**\n * Asynchronously store an image into memory and disk cache at the given key.\n *\n * @param image           The image to store\n * @param key             The unique image cache key, usually it's image absolute URL\n * @param toDisk          Store the image to disk cache if YES. If NO, the completion block is called synchronously\n * @param completionBlock A block executed after the operation is finished\n * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG.\n */\n- (void)storeImage:(nullable UIImage *)image\n            forKey:(nullable NSString *)key\n            toDisk:(BOOL)toDisk\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock;\n\n/**\n * Asynchronously store an image into memory and disk cache at the given key.\n *\n * @param image           The image to store\n * @param imageData       The image data as returned by the server, this representation will be used for disk storage\n *                        instead of converting the given image object into a storable/compressed image format in order\n *                        to save quality and CPU\n * @param key             The unique image cache key, usually it's image absolute URL\n * @param toDisk          Store the image to disk cache if YES. If NO, the completion block is called synchronously\n * @param completionBlock A block executed after the operation is finished\n * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG.\n */\n- (void)storeImage:(nullable UIImage *)image\n         imageData:(nullable NSData *)imageData\n            forKey:(nullable NSString *)key\n            toDisk:(BOOL)toDisk\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock;\n\n/**\n * Synchronously store image into memory cache at the given key.\n *\n * @param image  The image to store\n * @param key    The unique image cache key, usually it's image absolute URL\n */\n- (void)storeImageToMemory:(nullable UIImage*)image\n                    forKey:(nullable NSString *)key;\n\n/**\n * Synchronously store image data into disk cache at the given key.\n *\n * @param imageData  The image data to store\n * @param key        The unique image cache key, usually it's image absolute URL\n */\n- (void)storeImageDataToDisk:(nullable NSData *)imageData\n                      forKey:(nullable NSString *)key;\n\n\n#pragma mark - Contains and Check Ops\n\n/**\n *  Asynchronously check if image exists in disk cache already (does not load the image)\n *\n *  @param key             the key describing the url\n *  @param completionBlock the block to be executed when the check is done.\n *  @note the completion block will be always executed on the main queue\n */\n- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDImageCacheCheckCompletionBlock)completionBlock;\n\n/**\n *  Synchronously check if image data exists in disk cache already (does not load the image)\n *\n *  @param key             the key describing the url\n */\n- (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key;\n\n#pragma mark - Query and Retrieve Ops\n\n/**\n * Synchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded.\n *\n *  @param key The unique key used to store the wanted image\n *  @return The image data for the given key, or nil if not found.\n */\n- (nullable NSData *)diskImageDataForKey:(nullable NSString *)key;\n\n/**\n * Asynchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded.\n *\n *  @param key The unique key used to store the wanted image\n *  @param completionBlock the block to be executed when the query is done.\n *  @note the completion block will be always executed on the main queue\n */\n- (void)diskImageDataQueryForKey:(nullable NSString *)key completion:(nullable SDImageCacheQueryDataCompletionBlock)completionBlock;\n\n/**\n * Asynchronously queries the cache with operation and call the completion when done.\n *\n * @param key       The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.\n * @param doneBlock The completion block. Will not get called if the operation is cancelled\n *\n * @return a NSOperation instance containing the cache op\n */\n- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;\n\n/**\n * Asynchronously queries the cache with operation and call the completion when done.\n *\n * @param key       The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.\n * @param options   A mask to specify options to use for this cache query\n * @param doneBlock The completion block. Will not get called if the operation is cancelled\n *\n * @return a NSOperation instance containing the cache op\n */\n- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;\n\n/**\n * Asynchronously queries the cache with operation and call the completion when done.\n *\n * @param key       The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.\n * @param options   A mask to specify options to use for this cache query\n * @param context   A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param doneBlock The completion block. Will not get called if the operation is cancelled\n *\n * @return a NSOperation instance containing the cache op\n */\n- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;\n\n/**\n * Asynchronously queries the cache with operation and call the completion when done.\n *\n * @param key       The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`.\n * @param options   A mask to specify options to use for this cache query\n * @param context   A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param queryCacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately.\n * @param doneBlock The completion block. Will not get called if the operation is cancelled\n *\n * @return a NSOperation instance containing the cache op\n */\n- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock;\n\n/**\n * Synchronously query the memory cache.\n *\n * @param key The unique key used to store the image\n * @return The image for the given key, or nil if not found.\n */\n- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key;\n\n/**\n * Synchronously query the disk cache.\n *\n * @param key The unique key used to store the image\n * @return The image for the given key, or nil if not found.\n */\n- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key;\n\n/**\n * Synchronously query the disk cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc)\n *\n * @param key The unique key used to store the image\n * @param options   A mask to specify options to use for this cache query\n * @param context   A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @return The image for the given key, or nil if not found.\n */\n- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context;\n\n/**\n * Synchronously query the cache (memory and or disk) after checking the memory cache.\n *\n * @param key The unique key used to store the image\n * @return The image for the given key, or nil if not found.\n */\n- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key;\n\n/**\n * Synchronously query the cache (memory and or disk) after checking the memory cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc)\n *\n * @param key The unique key used to store the image\n * @param options   A mask to specify options to use for this cache query\n * @param context   A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @return The image for the given key, or nil if not found.\n */\n- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context;\n\n#pragma mark - Remove Ops\n\n/**\n * Asynchronously remove the image from memory and disk cache\n *\n * @param key             The unique image cache key\n * @param completion      A block that should be executed after the image has been removed (optional)\n */\n- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion;\n\n/**\n * Asynchronously remove the image from memory and optionally disk cache\n *\n * @param key             The unique image cache key\n * @param fromDisk        Also remove cache entry from disk if YES. If NO, the completion block is called synchronously\n * @param completion      A block that should be executed after the image has been removed (optional)\n */\n- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion;\n\n/**\n Synchronously remove the image from memory cache.\n \n @param key The unique image cache key\n */\n- (void)removeImageFromMemoryForKey:(nullable NSString *)key;\n\n/**\n Synchronously remove the image from disk cache.\n \n @param key The unique image cache key\n */\n- (void)removeImageFromDiskForKey:(nullable NSString *)key;\n\n#pragma mark - Cache clean Ops\n\n/**\n * Synchronously Clear all memory cached images\n */\n- (void)clearMemory;\n\n/**\n * Asynchronously clear all disk cached images. Non-blocking method - returns immediately.\n * @param completion    A block that should be executed after cache expiration completes (optional)\n */\n- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion;\n\n/**\n * Asynchronously remove all expired cached image from disk. Non-blocking method - returns immediately.\n * @param completionBlock A block that should be executed after cache expiration completes (optional)\n */\n- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock;\n\n#pragma mark - Cache Info\n\n/**\n * Get the total bytes size of images in the disk cache\n */\n- (NSUInteger)totalDiskSize;\n\n/**\n * Get the number of images in the disk cache\n */\n- (NSUInteger)totalDiskCount;\n\n/**\n * Asynchronously calculate the disk cache's size.\n */\n- (void)calculateSizeWithCompletionBlock:(nullable SDImageCacheCalculateSizeBlock)completionBlock;\n\n@end\n\n/**\n * SDImageCache is the built-in image cache implementation for web image manager. It adopts `SDImageCache` protocol to provide the function for web image manager to use for image loading process.\n */\n@interface SDImageCache (SDImageCache) <SDImageCache>\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCache.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDImageCodersManager.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"SDAnimatedImage.h\"\n#import \"UIImage+MemoryCacheCost.h\"\n#import \"UIImage+Metadata.h\"\n#import \"UIImage+ExtendedCacheData.h\"\n\nstatic NSString * _defaultDiskCacheDirectory;\n\n@interface SDImageCache ()\n\n#pragma mark - Properties\n@property (nonatomic, strong, readwrite, nonnull) id<SDMemoryCache> memoryCache;\n@property (nonatomic, strong, readwrite, nonnull) id<SDDiskCache> diskCache;\n@property (nonatomic, copy, readwrite, nonnull) SDImageCacheConfig *config;\n@property (nonatomic, copy, readwrite, nonnull) NSString *diskCachePath;\n@property (nonatomic, strong, nullable) dispatch_queue_t ioQueue;\n\n@end\n\n\n@implementation SDImageCache\n\n#pragma mark - Singleton, init, dealloc\n\n+ (nonnull instancetype)sharedImageCache {\n    static dispatch_once_t once;\n    static id instance;\n    dispatch_once(&once, ^{\n        instance = [self new];\n    });\n    return instance;\n}\n\n+ (NSString *)defaultDiskCacheDirectory {\n    if (!_defaultDiskCacheDirectory) {\n        _defaultDiskCacheDirectory = [[self userCacheDirectory] stringByAppendingPathComponent:@\"com.hackemist.SDImageCache\"];\n    }\n    return _defaultDiskCacheDirectory;\n}\n\n+ (void)setDefaultDiskCacheDirectory:(NSString *)defaultDiskCacheDirectory {\n    _defaultDiskCacheDirectory = [defaultDiskCacheDirectory copy];\n}\n\n- (instancetype)init {\n    return [self initWithNamespace:@\"default\"];\n}\n\n- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns {\n    return [self initWithNamespace:ns diskCacheDirectory:nil];\n}\n\n- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns\n                       diskCacheDirectory:(nullable NSString *)directory {\n    return [self initWithNamespace:ns diskCacheDirectory:directory config:SDImageCacheConfig.defaultCacheConfig];\n}\n\n- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns\n                       diskCacheDirectory:(nullable NSString *)directory\n                                   config:(nullable SDImageCacheConfig *)config {\n    if ((self = [super init])) {\n        NSAssert(ns, @\"Cache namespace should not be nil\");\n        \n        // Create IO serial queue\n        _ioQueue = dispatch_queue_create(\"com.hackemist.SDImageCache\", DISPATCH_QUEUE_SERIAL);\n        \n        if (!config) {\n            config = SDImageCacheConfig.defaultCacheConfig;\n        }\n        _config = [config copy];\n        \n        // Init the memory cache\n        NSAssert([config.memoryCacheClass conformsToProtocol:@protocol(SDMemoryCache)], @\"Custom memory cache class must conform to `SDMemoryCache` protocol\");\n        _memoryCache = [[config.memoryCacheClass alloc] initWithConfig:_config];\n        \n        // Init the disk cache\n        if (!directory) {\n            // Use default disk cache directory\n            directory = [self.class defaultDiskCacheDirectory];\n        }\n        _diskCachePath = [directory stringByAppendingPathComponent:ns];\n        \n        NSAssert([config.diskCacheClass conformsToProtocol:@protocol(SDDiskCache)], @\"Custom disk cache class must conform to `SDDiskCache` protocol\");\n        _diskCache = [[config.diskCacheClass alloc] initWithCachePath:_diskCachePath config:_config];\n        \n        // Check and migrate disk cache directory if need\n        [self migrateDiskCacheDirectory];\n\n#if SD_UIKIT\n        // Subscribe to app events\n        [[NSNotificationCenter defaultCenter] addObserver:self\n                                                 selector:@selector(applicationWillTerminate:)\n                                                     name:UIApplicationWillTerminateNotification\n                                                   object:nil];\n\n        [[NSNotificationCenter defaultCenter] addObserver:self\n                                                 selector:@selector(applicationDidEnterBackground:)\n                                                     name:UIApplicationDidEnterBackgroundNotification\n                                                   object:nil];\n#endif\n#if SD_MAC\n        [[NSNotificationCenter defaultCenter] addObserver:self\n                                                 selector:@selector(applicationWillTerminate:)\n                                                     name:NSApplicationWillTerminateNotification\n                                                   object:nil];\n#endif\n    }\n\n    return self;\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n#pragma mark - Cache paths\n\n- (nullable NSString *)cachePathForKey:(nullable NSString *)key {\n    if (!key) {\n        return nil;\n    }\n    return [self.diskCache cachePathForKey:key];\n}\n\n+ (nullable NSString *)userCacheDirectory {\n    NSArray<NSString *> *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);\n    return paths.firstObject;\n}\n\n- (void)migrateDiskCacheDirectory {\n    if ([self.diskCache isKindOfClass:[SDDiskCache class]]) {\n        static dispatch_once_t onceToken;\n        dispatch_once(&onceToken, ^{\n            // ~/Library/Caches/com.hackemist.SDImageCache/default/\n            NSString *newDefaultPath = [[[self.class userCacheDirectory] stringByAppendingPathComponent:@\"com.hackemist.SDImageCache\"] stringByAppendingPathComponent:@\"default\"];\n            // ~/Library/Caches/default/com.hackemist.SDWebImageCache.default/\n            NSString *oldDefaultPath = [[[self.class userCacheDirectory] stringByAppendingPathComponent:@\"default\"] stringByAppendingPathComponent:@\"com.hackemist.SDWebImageCache.default\"];\n            dispatch_async(self.ioQueue, ^{\n                [((SDDiskCache *)self.diskCache) moveCacheDirectoryFromPath:oldDefaultPath toPath:newDefaultPath];\n            });\n        });\n    }\n}\n\n#pragma mark - Store Ops\n\n- (void)storeImage:(nullable UIImage *)image\n            forKey:(nullable NSString *)key\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock {\n    [self storeImage:image imageData:nil forKey:key toDisk:YES completion:completionBlock];\n}\n\n- (void)storeImage:(nullable UIImage *)image\n            forKey:(nullable NSString *)key\n            toDisk:(BOOL)toDisk\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock {\n    [self storeImage:image imageData:nil forKey:key toDisk:toDisk completion:completionBlock];\n}\n\n- (void)storeImage:(nullable UIImage *)image\n         imageData:(nullable NSData *)imageData\n            forKey:(nullable NSString *)key\n            toDisk:(BOOL)toDisk\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock {\n    return [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:toDisk completion:completionBlock];\n}\n\n- (void)storeImage:(nullable UIImage *)image\n         imageData:(nullable NSData *)imageData\n            forKey:(nullable NSString *)key\n          toMemory:(BOOL)toMemory\n            toDisk:(BOOL)toDisk\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock {\n    if (!image || !key) {\n        if (completionBlock) {\n            completionBlock();\n        }\n        return;\n    }\n    // if memory cache is enabled\n    if (toMemory && self.config.shouldCacheImagesInMemory) {\n        NSUInteger cost = image.sd_memoryCost;\n        [self.memoryCache setObject:image forKey:key cost:cost];\n    }\n    \n    if (!toDisk) {\n        if (completionBlock) {\n            completionBlock();\n        }\n        return;\n    }\n    dispatch_async(self.ioQueue, ^{\n        @autoreleasepool {\n            NSData *data = imageData;\n            if (!data && [image conformsToProtocol:@protocol(SDAnimatedImage)]) {\n                // If image is custom animated image class, prefer its original animated data\n                data = [((id<SDAnimatedImage>)image) animatedImageData];\n            }\n            if (!data && image) {\n                // Check image's associated image format, may return .undefined\n                SDImageFormat format = image.sd_imageFormat;\n                if (format == SDImageFormatUndefined) {\n                    // If image is animated, use GIF (APNG may be better, but has bugs before macOS 10.14)\n                    if (image.sd_isAnimated) {\n                        format = SDImageFormatGIF;\n                    } else {\n                        // If we do not have any data to detect image format, check whether it contains alpha channel to use PNG or JPEG format\n                        format = [SDImageCoderHelper CGImageContainsAlpha:image.CGImage] ? SDImageFormatPNG : SDImageFormatJPEG;\n                    }\n                }\n                data = [[SDImageCodersManager sharedManager] encodedDataWithImage:image format:format options:nil];\n            }\n            [self _storeImageDataToDisk:data forKey:key];\n            [self _archivedDataWithImage:image forKey:key];\n        }\n        \n        if (completionBlock) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                completionBlock();\n            });\n        }\n    });\n}\n\n- (void)_archivedDataWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return;\n    }\n    // Check extended data\n    id extendedObject = image.sd_extendedObject;\n    if (![extendedObject conformsToProtocol:@protocol(NSCoding)]) {\n        return;\n    }\n    NSData *extendedData;\n    if (@available(iOS 11, tvOS 11, macOS 10.13, watchOS 4, *)) {\n        NSError *error;\n        extendedData = [NSKeyedArchiver archivedDataWithRootObject:extendedObject requiringSecureCoding:NO error:&error];\n        if (error) {\n            NSLog(@\"NSKeyedArchiver archive failed with error: %@\", error);\n        }\n    } else {\n        @try {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n            extendedData = [NSKeyedArchiver archivedDataWithRootObject:extendedObject];\n#pragma clang diagnostic pop\n        } @catch (NSException *exception) {\n            NSLog(@\"NSKeyedArchiver archive failed with exception: %@\", exception);\n        }\n    }\n    if (extendedData) {\n        [self.diskCache setExtendedData:extendedData forKey:key];\n    }\n}\n\n- (void)storeImageToMemory:(UIImage *)image forKey:(NSString *)key {\n    if (!image || !key) {\n        return;\n    }\n    NSUInteger cost = image.sd_memoryCost;\n    [self.memoryCache setObject:image forKey:key cost:cost];\n}\n\n- (void)storeImageDataToDisk:(nullable NSData *)imageData\n                      forKey:(nullable NSString *)key {\n    if (!imageData || !key) {\n        return;\n    }\n    \n    dispatch_sync(self.ioQueue, ^{\n        [self _storeImageDataToDisk:imageData forKey:key];\n    });\n}\n\n// Make sure to call from io queue by caller\n- (void)_storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key {\n    if (!imageData || !key) {\n        return;\n    }\n    \n    [self.diskCache setData:imageData forKey:key];\n}\n\n#pragma mark - Query and Retrieve Ops\n\n- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDImageCacheCheckCompletionBlock)completionBlock {\n    dispatch_async(self.ioQueue, ^{\n        BOOL exists = [self _diskImageDataExistsWithKey:key];\n        if (completionBlock) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                completionBlock(exists);\n            });\n        }\n    });\n}\n\n- (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key {\n    if (!key) {\n        return NO;\n    }\n    \n    __block BOOL exists = NO;\n    dispatch_sync(self.ioQueue, ^{\n        exists = [self _diskImageDataExistsWithKey:key];\n    });\n    \n    return exists;\n}\n\n// Make sure to call from io queue by caller\n- (BOOL)_diskImageDataExistsWithKey:(nullable NSString *)key {\n    if (!key) {\n        return NO;\n    }\n    \n    return [self.diskCache containsDataForKey:key];\n}\n\n- (void)diskImageDataQueryForKey:(NSString *)key completion:(SDImageCacheQueryDataCompletionBlock)completionBlock {\n    dispatch_async(self.ioQueue, ^{\n        NSData *imageData = [self diskImageDataBySearchingAllPathsForKey:key];\n        if (completionBlock) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                completionBlock(imageData);\n            });\n        }\n    });\n}\n\n- (nullable NSData *)diskImageDataForKey:(nullable NSString *)key {\n    if (!key) {\n        return nil;\n    }\n    __block NSData *imageData = nil;\n    dispatch_sync(self.ioQueue, ^{\n        imageData = [self diskImageDataBySearchingAllPathsForKey:key];\n    });\n    \n    return imageData;\n}\n\n- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key {\n    return [self.memoryCache objectForKey:key];\n}\n\n- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key {\n    return [self imageFromDiskCacheForKey:key options:0 context:nil];\n}\n\n- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context {\n    NSData *data = [self diskImageDataForKey:key];\n    UIImage *diskImage = [self diskImageForKey:key data:data options:options context:context];\n    \n    BOOL shouldCacheToMomery = YES;\n    if (context[SDWebImageContextStoreCacheType]) {\n        SDImageCacheType cacheType = [context[SDWebImageContextStoreCacheType] integerValue];\n        shouldCacheToMomery = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory);\n    }\n    if (diskImage && self.config.shouldCacheImagesInMemory && shouldCacheToMomery) {\n        NSUInteger cost = diskImage.sd_memoryCost;\n        [self.memoryCache setObject:diskImage forKey:key cost:cost];\n    }\n\n    return diskImage;\n}\n\n- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key {\n    return [self imageFromCacheForKey:key options:0 context:nil];\n}\n\n- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context {\n    // First check the in-memory cache...\n    UIImage *image = [self imageFromMemoryCacheForKey:key];\n    if (image) {\n        if (options & SDImageCacheDecodeFirstFrameOnly) {\n            // Ensure static image\n            Class animatedImageClass = image.class;\n            if (image.sd_isAnimated || ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)])) {\n#if SD_MAC\n                image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];\n#else\n                image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];\n#endif\n            }\n        } else if (options & SDImageCacheMatchAnimatedImageClass) {\n            // Check image class matching\n            Class animatedImageClass = image.class;\n            Class desiredImageClass = context[SDWebImageContextAnimatedImageClass];\n            if (desiredImageClass && ![animatedImageClass isSubclassOfClass:desiredImageClass]) {\n                image = nil;\n            }\n        }\n    }\n    \n    // Since we don't need to query imageData, return image if exist\n    if (image) {\n        return image;\n    }\n    \n    // Second check the disk cache...\n    image = [self imageFromDiskCacheForKey:key options:options context:context];\n    return image;\n}\n\n- (nullable NSData *)diskImageDataBySearchingAllPathsForKey:(nullable NSString *)key {\n    if (!key) {\n        return nil;\n    }\n    \n    NSData *data = [self.diskCache dataForKey:key];\n    if (data) {\n        return data;\n    }\n    \n    // Addtional cache path for custom pre-load cache\n    if (self.additionalCachePathBlock) {\n        NSString *filePath = self.additionalCachePathBlock(key);\n        if (filePath) {\n            data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil];\n        }\n    }\n\n    return data;\n}\n\n- (nullable UIImage *)diskImageForKey:(nullable NSString *)key {\n    NSData *data = [self diskImageDataForKey:key];\n    return [self diskImageForKey:key data:data];\n}\n\n- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data {\n    return [self diskImageForKey:key data:data options:0 context:nil];\n}\n\n- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data options:(SDImageCacheOptions)options context:(SDWebImageContext *)context {\n    if (!data) {\n        return nil;\n    }\n    UIImage *image = SDImageCacheDecodeImageData(data, key, [[self class] imageOptionsFromCacheOptions:options], context);\n    [self _unarchiveObjectWithImage:image forKey:key];\n    return image;\n}\n\n- (void)_unarchiveObjectWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return;\n    }\n    // Check extended data\n    NSData *extendedData = [self.diskCache extendedDataForKey:key];\n    if (!extendedData) {\n        return;\n    }\n    id extendedObject;\n    if (@available(iOS 11, tvOS 11, macOS 10.13, watchOS 4, *)) {\n        NSError *error;\n        NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:extendedData error:&error];\n        unarchiver.requiresSecureCoding = NO;\n        extendedObject = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];\n        if (error) {\n            NSLog(@\"NSKeyedUnarchiver unarchive failed with error: %@\", error);\n        }\n    } else {\n        @try {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n            extendedObject = [NSKeyedUnarchiver unarchiveObjectWithData:extendedData];\n#pragma clang diagnostic pop\n        } @catch (NSException *exception) {\n            NSLog(@\"NSKeyedUnarchiver unarchive failed with exception: %@\", exception);\n        }\n    }\n    image.sd_extendedObject = extendedObject;\n}\n\n- (nullable NSOperation *)queryCacheOperationForKey:(NSString *)key done:(SDImageCacheQueryCompletionBlock)doneBlock {\n    return [self queryCacheOperationForKey:key options:0 done:doneBlock];\n}\n\n- (nullable NSOperation *)queryCacheOperationForKey:(NSString *)key options:(SDImageCacheOptions)options done:(SDImageCacheQueryCompletionBlock)doneBlock {\n    return [self queryCacheOperationForKey:key options:options context:nil done:doneBlock];\n}\n\n- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock {\n    return [self queryCacheOperationForKey:key options:options context:context cacheType:SDImageCacheTypeAll done:doneBlock];\n}\n\n- (nullable NSOperation *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock {\n    if (!key) {\n        if (doneBlock) {\n            doneBlock(nil, nil, SDImageCacheTypeNone);\n        }\n        return nil;\n    }\n    // Invalid cache type\n    if (queryCacheType == SDImageCacheTypeNone) {\n        if (doneBlock) {\n            doneBlock(nil, nil, SDImageCacheTypeNone);\n        }\n        return nil;\n    }\n    \n    // First check the in-memory cache...\n    UIImage *image;\n    if (queryCacheType != SDImageCacheTypeDisk) {\n        image = [self imageFromMemoryCacheForKey:key];\n    }\n    \n    if (image) {\n        if (options & SDImageCacheDecodeFirstFrameOnly) {\n            // Ensure static image\n            Class animatedImageClass = image.class;\n            if (image.sd_isAnimated || ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)])) {\n#if SD_MAC\n                image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];\n#else\n                image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];\n#endif\n            }\n        } else if (options & SDImageCacheMatchAnimatedImageClass) {\n            // Check image class matching\n            Class animatedImageClass = image.class;\n            Class desiredImageClass = context[SDWebImageContextAnimatedImageClass];\n            if (desiredImageClass && ![animatedImageClass isSubclassOfClass:desiredImageClass]) {\n                image = nil;\n            }\n        }\n    }\n\n    BOOL shouldQueryMemoryOnly = (queryCacheType == SDImageCacheTypeMemory) || (image && !(options & SDImageCacheQueryMemoryData));\n    if (shouldQueryMemoryOnly) {\n        if (doneBlock) {\n            doneBlock(image, nil, SDImageCacheTypeMemory);\n        }\n        return nil;\n    }\n    \n    // Second check the disk cache...\n    NSOperation *operation = [NSOperation new];\n    // Check whether we need to synchronously query disk\n    // 1. in-memory cache hit & memoryDataSync\n    // 2. in-memory cache miss & diskDataSync\n    BOOL shouldQueryDiskSync = ((image && options & SDImageCacheQueryMemoryDataSync) ||\n                                (!image && options & SDImageCacheQueryDiskDataSync));\n    NSData* (^queryDiskDataBlock)(void) = ^NSData* {\n        if (operation.isCancelled) {\n            return nil;\n        }\n        \n        return [self diskImageDataBySearchingAllPathsForKey:key];\n    };\n    \n    UIImage* (^queryDiskImageBlock)(NSData*) = ^UIImage*(NSData* diskData) {\n        if (operation.isCancelled) {\n            return nil;\n        }\n        \n        UIImage *diskImage;\n        if (image) {\n            // the image is from in-memory cache, but need image data\n            diskImage = image;\n        } else if (diskData) {\n            BOOL shouldCacheToMomery = YES;\n            if (context[SDWebImageContextStoreCacheType]) {\n                SDImageCacheType cacheType = [context[SDWebImageContextStoreCacheType] integerValue];\n                shouldCacheToMomery = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory);\n            }\n            // decode image data only if in-memory cache missed\n            diskImage = [self diskImageForKey:key data:diskData options:options context:context];\n            if (shouldCacheToMomery && diskImage && self.config.shouldCacheImagesInMemory) {\n                NSUInteger cost = diskImage.sd_memoryCost;\n                [self.memoryCache setObject:diskImage forKey:key cost:cost];\n            }\n        }\n        return diskImage;\n    };\n    \n    // Query in ioQueue to keep IO-safe\n    if (shouldQueryDiskSync) {\n        __block NSData* diskData;\n        __block UIImage* diskImage;\n        dispatch_sync(self.ioQueue, ^{\n            diskData = queryDiskDataBlock();\n            diskImage = queryDiskImageBlock(diskData);\n        });\n        if (doneBlock) {\n            doneBlock(diskImage, diskData, SDImageCacheTypeDisk);\n        }\n    } else {\n        dispatch_async(self.ioQueue, ^{\n            NSData* diskData = queryDiskDataBlock();\n            UIImage* diskImage = queryDiskImageBlock(diskData);\n            if (doneBlock) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    doneBlock(diskImage, diskData, SDImageCacheTypeDisk);\n                });\n            }\n        });\n    }\n    \n    return operation;\n}\n\n#pragma mark - Remove Ops\n\n- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion {\n    [self removeImageForKey:key fromDisk:YES withCompletion:completion];\n}\n\n- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion {\n    [self removeImageForKey:key fromMemory:YES fromDisk:fromDisk withCompletion:completion];\n}\n\n- (void)removeImageForKey:(nullable NSString *)key fromMemory:(BOOL)fromMemory fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion {\n    if (key == nil) {\n        return;\n    }\n\n    if (fromMemory && self.config.shouldCacheImagesInMemory) {\n        [self.memoryCache removeObjectForKey:key];\n    }\n\n    if (fromDisk) {\n        dispatch_async(self.ioQueue, ^{\n            [self.diskCache removeDataForKey:key];\n            \n            if (completion) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    completion();\n                });\n            }\n        });\n    } else if (completion) {\n        completion();\n    }\n}\n\n- (void)removeImageFromMemoryForKey:(NSString *)key {\n    if (!key) {\n        return;\n    }\n    \n    [self.memoryCache removeObjectForKey:key];\n}\n\n- (void)removeImageFromDiskForKey:(NSString *)key {\n    if (!key) {\n        return;\n    }\n    dispatch_sync(self.ioQueue, ^{\n        [self _removeImageFromDiskForKey:key];\n    });\n}\n\n// Make sure to call from io queue by caller\n- (void)_removeImageFromDiskForKey:(NSString *)key {\n    if (!key) {\n        return;\n    }\n    \n    [self.diskCache removeDataForKey:key];\n}\n\n#pragma mark - Cache clean Ops\n\n- (void)clearMemory {\n    [self.memoryCache removeAllObjects];\n}\n\n- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion {\n    dispatch_async(self.ioQueue, ^{\n        [self.diskCache removeAllData];\n        if (completion) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                completion();\n            });\n        }\n    });\n}\n\n- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock {\n    dispatch_async(self.ioQueue, ^{\n        [self.diskCache removeExpiredData];\n        if (completionBlock) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                completionBlock();\n            });\n        }\n    });\n}\n\n#pragma mark - UIApplicationWillTerminateNotification\n\n#if SD_UIKIT || SD_MAC\n- (void)applicationWillTerminate:(NSNotification *)notification {\n    // On iOS/macOS, the async opeartion to remove exipred data will be terminated quickly\n    // Try using the sync operation to ensure we reomve the exipred data\n    if (!self.config.shouldRemoveExpiredDataWhenTerminate) {\n        return;\n    }\n    dispatch_sync(self.ioQueue, ^{\n        [self.diskCache removeExpiredData];\n    });\n}\n#endif\n\n#pragma mark - UIApplicationDidEnterBackgroundNotification\n\n#if SD_UIKIT\n- (void)applicationDidEnterBackground:(NSNotification *)notification {\n    if (!self.config.shouldRemoveExpiredDataWhenEnterBackground) {\n        return;\n    }\n    Class UIApplicationClass = NSClassFromString(@\"UIApplication\");\n    if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) {\n        return;\n    }\n    UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)];\n    __block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{\n        // Clean up any unfinished task business by marking where you\n        // stopped or ending the task outright.\n        [application endBackgroundTask:bgTask];\n        bgTask = UIBackgroundTaskInvalid;\n    }];\n\n    // Start the long-running task and return immediately.\n    [self deleteOldFilesWithCompletionBlock:^{\n        [application endBackgroundTask:bgTask];\n        bgTask = UIBackgroundTaskInvalid;\n    }];\n}\n#endif\n\n#pragma mark - Cache Info\n\n- (NSUInteger)totalDiskSize {\n    __block NSUInteger size = 0;\n    dispatch_sync(self.ioQueue, ^{\n        size = [self.diskCache totalSize];\n    });\n    return size;\n}\n\n- (NSUInteger)totalDiskCount {\n    __block NSUInteger count = 0;\n    dispatch_sync(self.ioQueue, ^{\n        count = [self.diskCache totalCount];\n    });\n    return count;\n}\n\n- (void)calculateSizeWithCompletionBlock:(nullable SDImageCacheCalculateSizeBlock)completionBlock {\n    dispatch_async(self.ioQueue, ^{\n        NSUInteger fileCount = [self.diskCache totalCount];\n        NSUInteger totalSize = [self.diskCache totalSize];\n        if (completionBlock) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                completionBlock(fileCount, totalSize);\n            });\n        }\n    });\n}\n\n#pragma mark - Helper\n+ (SDWebImageOptions)imageOptionsFromCacheOptions:(SDImageCacheOptions)cacheOptions {\n    SDWebImageOptions options = 0;\n    if (cacheOptions & SDImageCacheScaleDownLargeImages) options |= SDWebImageScaleDownLargeImages;\n    if (cacheOptions & SDImageCacheDecodeFirstFrameOnly) options |= SDWebImageDecodeFirstFrameOnly;\n    if (cacheOptions & SDImageCachePreloadAllFrames) options |= SDWebImagePreloadAllFrames;\n    if (cacheOptions & SDImageCacheAvoidDecodeImage) options |= SDWebImageAvoidDecodeImage;\n    if (cacheOptions & SDImageCacheMatchAnimatedImageClass) options |= SDWebImageMatchAnimatedImageClass;\n    \n    return options;\n}\n\n@end\n\n@implementation SDImageCache (SDImageCache)\n\n#pragma mark - SDImageCache\n\n- (id<SDWebImageOperation>)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock {\n    return [self queryImageForKey:key options:options context:context cacheType:SDImageCacheTypeAll completion:completionBlock];\n}\n\n- (id<SDWebImageOperation>)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)cacheType completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock {\n    SDImageCacheOptions cacheOptions = 0;\n    if (options & SDWebImageQueryMemoryData) cacheOptions |= SDImageCacheQueryMemoryData;\n    if (options & SDWebImageQueryMemoryDataSync) cacheOptions |= SDImageCacheQueryMemoryDataSync;\n    if (options & SDWebImageQueryDiskDataSync) cacheOptions |= SDImageCacheQueryDiskDataSync;\n    if (options & SDWebImageScaleDownLargeImages) cacheOptions |= SDImageCacheScaleDownLargeImages;\n    if (options & SDWebImageAvoidDecodeImage) cacheOptions |= SDImageCacheAvoidDecodeImage;\n    if (options & SDWebImageDecodeFirstFrameOnly) cacheOptions |= SDImageCacheDecodeFirstFrameOnly;\n    if (options & SDWebImagePreloadAllFrames) cacheOptions |= SDImageCachePreloadAllFrames;\n    if (options & SDWebImageMatchAnimatedImageClass) cacheOptions |= SDImageCacheMatchAnimatedImageClass;\n    \n    return [self queryCacheOperationForKey:key options:cacheOptions context:context cacheType:cacheType done:completionBlock];\n}\n\n- (void)storeImage:(UIImage *)image imageData:(NSData *)imageData forKey:(nullable NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDWebImageNoParamsBlock)completionBlock {\n    switch (cacheType) {\n        case SDImageCacheTypeNone: {\n            [self storeImage:image imageData:imageData forKey:key toMemory:NO toDisk:NO completion:completionBlock];\n        }\n            break;\n        case SDImageCacheTypeMemory: {\n            [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:NO completion:completionBlock];\n        }\n            break;\n        case SDImageCacheTypeDisk: {\n            [self storeImage:image imageData:imageData forKey:key toMemory:NO toDisk:YES completion:completionBlock];\n        }\n            break;\n        case SDImageCacheTypeAll: {\n            [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:YES completion:completionBlock];\n        }\n            break;\n        default: {\n            if (completionBlock) {\n                completionBlock();\n            }\n        }\n            break;\n    }\n}\n\n- (void)removeImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDWebImageNoParamsBlock)completionBlock {\n    switch (cacheType) {\n        case SDImageCacheTypeNone: {\n            [self removeImageForKey:key fromMemory:NO fromDisk:NO withCompletion:completionBlock];\n        }\n            break;\n        case SDImageCacheTypeMemory: {\n            [self removeImageForKey:key fromMemory:YES fromDisk:NO withCompletion:completionBlock];\n        }\n            break;\n        case SDImageCacheTypeDisk: {\n            [self removeImageForKey:key fromMemory:NO fromDisk:YES withCompletion:completionBlock];\n        }\n            break;\n        case SDImageCacheTypeAll: {\n            [self removeImageForKey:key fromMemory:YES fromDisk:YES withCompletion:completionBlock];\n        }\n            break;\n        default: {\n            if (completionBlock) {\n                completionBlock();\n            }\n        }\n            break;\n    }\n}\n\n- (void)containsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDImageCacheContainsCompletionBlock)completionBlock {\n    switch (cacheType) {\n        case SDImageCacheTypeNone: {\n            if (completionBlock) {\n                completionBlock(SDImageCacheTypeNone);\n            }\n        }\n            break;\n        case SDImageCacheTypeMemory: {\n            BOOL isInMemoryCache = ([self imageFromMemoryCacheForKey:key] != nil);\n            if (completionBlock) {\n                completionBlock(isInMemoryCache ? SDImageCacheTypeMemory : SDImageCacheTypeNone);\n            }\n        }\n            break;\n        case SDImageCacheTypeDisk: {\n            [self diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) {\n                if (completionBlock) {\n                    completionBlock(isInDiskCache ? SDImageCacheTypeDisk : SDImageCacheTypeNone);\n                }\n            }];\n        }\n            break;\n        case SDImageCacheTypeAll: {\n            BOOL isInMemoryCache = ([self imageFromMemoryCacheForKey:key] != nil);\n            if (isInMemoryCache) {\n                if (completionBlock) {\n                    completionBlock(SDImageCacheTypeMemory);\n                }\n                return;\n            }\n            [self diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) {\n                if (completionBlock) {\n                    completionBlock(isInDiskCache ? SDImageCacheTypeDisk : SDImageCacheTypeNone);\n                }\n            }];\n        }\n            break;\n        default:\n            if (completionBlock) {\n                completionBlock(SDImageCacheTypeNone);\n            }\n            break;\n    }\n}\n\n- (void)clearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock {\n    switch (cacheType) {\n        case SDImageCacheTypeNone: {\n            if (completionBlock) {\n                completionBlock();\n            }\n        }\n            break;\n        case SDImageCacheTypeMemory: {\n            [self clearMemory];\n            if (completionBlock) {\n                completionBlock();\n            }\n        }\n            break;\n        case SDImageCacheTypeDisk: {\n            [self clearDiskOnCompletion:completionBlock];\n        }\n            break;\n        case SDImageCacheTypeAll: {\n            [self clearMemory];\n            [self clearDiskOnCompletion:completionBlock];\n        }\n            break;\n        default: {\n            if (completionBlock) {\n                completionBlock();\n            }\n        }\n            break;\n    }\n}\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/// Image Cache Expire Type\ntypedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) {\n    /**\n     * When the image cache is accessed it will update this value\n     */\n    SDImageCacheConfigExpireTypeAccessDate,\n    /**\n     * When the image cache is created or modified it will update this value (Default)\n     */\n    SDImageCacheConfigExpireTypeModificationDate,\n    /**\n     * When the image cache is created it will update this value\n     */\n    SDImageCacheConfigExpireTypeCreationDate,\n    /**\n     * When the image cache is created, modified, renamed, file attribute updated (like permission, xattr)  it will update this value\n     */\n    SDImageCacheConfigExpireTypeChangeDate,\n};\n\n/**\n The class contains all the config for image cache\n @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well.\n */\n@interface SDImageCacheConfig : NSObject <NSCopying>\n\n/**\n Gets the default cache config used for shared instance or initialization when it does not provide any cache config. Such as `SDImageCache.sharedImageCache`.\n @note You can modify the property on default cache config, which can be used for later created cache instance. The already created cache instance does not get affected.\n */\n@property (nonatomic, class, readonly, nonnull) SDImageCacheConfig *defaultCacheConfig;\n\n/**\n * Whether or not to disable iCloud backup\n * Defaults to YES.\n */\n@property (assign, nonatomic) BOOL shouldDisableiCloud;\n\n/**\n * Whether or not to use memory cache\n * @note When the memory cache is disabled, the weak memory cache will also be disabled.\n * Defaults to YES.\n */\n@property (assign, nonatomic) BOOL shouldCacheImagesInMemory;\n\n/*\n * The option to control weak memory cache for images. When enable, `SDImageCache`'s memory cache will use a weak maptable to store the image at the same time when it stored to memory, and get removed at the same time.\n * However when memory warning is triggered, since the weak maptable does not hold a strong reference to image instance, even when the memory cache itself is purged, some images which are held strongly by UIImageViews or other live instances can be recovered again, to avoid later re-query from disk cache or network. This may be helpful for the case, for example, when app enter background and memory is purged, cause cell flashing after re-enter foreground.\n * When enabling this option, we will sync back the image from weak maptable to strong cache during next time top level `sd_setImage` function call.\n * Defaults to NO (YES before 5.12.0 version). You can change this option dynamically.\n */\n@property (assign, nonatomic) BOOL shouldUseWeakMemoryCache;\n\n/**\n * Whether or not to remove the expired disk data when application entering the background. (Not works for macOS)\n * Defaults to YES.\n */\n@property (assign, nonatomic) BOOL shouldRemoveExpiredDataWhenEnterBackground;\n\n/**\n * Whether or not to remove the expired disk data when application been terminated. This operation is processed in sync to ensure clean up.\n * Defaults to YES.\n */\n@property (assign, nonatomic) BOOL shouldRemoveExpiredDataWhenTerminate;\n\n/**\n * The reading options while reading cache from disk.\n * Defaults to 0. You can set this to `NSDataReadingMappedIfSafe` to improve performance.\n */\n@property (assign, nonatomic) NSDataReadingOptions diskCacheReadingOptions;\n\n/**\n * The writing options while writing cache to disk.\n * Defaults to `NSDataWritingAtomic`. You can set this to `NSDataWritingWithoutOverwriting` to prevent overwriting an existing file.\n */\n@property (assign, nonatomic) NSDataWritingOptions diskCacheWritingOptions;\n\n/**\n * The maximum length of time to keep an image in the disk cache, in seconds.\n * Setting this to a negative value means no expiring.\n * Setting this to zero means that all cached files would be removed when do expiration check.\n * Defaults to 1 week.\n */\n@property (assign, nonatomic) NSTimeInterval maxDiskAge;\n\n/**\n * The maximum size of the disk cache, in bytes.\n * Defaults to 0. Which means there is no cache size limit.\n */\n@property (assign, nonatomic) NSUInteger maxDiskSize;\n\n/**\n * The maximum \"total cost\" of the in-memory image cache. The cost function is the bytes size held in memory.\n * @note The memory cost is bytes size in memory, but not simple pixels count. For common ARGB8888 image, one pixel is 4 bytes (32 bits).\n * Defaults to 0. Which means there is no memory cost limit.\n */\n@property (assign, nonatomic) NSUInteger maxMemoryCost;\n\n/**\n * The maximum number of objects in-memory image cache should hold.\n * Defaults to 0. Which means there is no memory count limit.\n */\n@property (assign, nonatomic) NSUInteger maxMemoryCount;\n\n/*\n * The attribute which the clear cache will be checked against when clearing the disk cache\n * Default is Modified Date\n */\n@property (assign, nonatomic) SDImageCacheConfigExpireType diskCacheExpireType;\n\n/**\n * The custom file manager for disk cache. Pass nil to let disk cache choose the proper file manager.\n * Defaults to nil.\n * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect.\n * @note Since `NSFileManager` does not support `NSCopying`. We just pass this by reference during copying. So it's not recommend to set this value on `defaultCacheConfig`.\n */\n@property (strong, nonatomic, nullable) NSFileManager *fileManager;\n\n/**\n * The custom memory cache class. Provided class instance must conform to `SDMemoryCache` protocol to allow usage.\n * Defaults to built-in `SDMemoryCache` class.\n * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect.\n */\n@property (assign, nonatomic, nonnull) Class memoryCacheClass;\n\n/**\n * The custom disk cache class. Provided class instance must conform to `SDDiskCache` protocol to allow usage.\n * Defaults to built-in `SDDiskCache` class.\n * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect.\n */\n@property (assign ,nonatomic, nonnull) Class diskCacheClass;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCacheConfig.h\"\n#import \"SDMemoryCache.h\"\n#import \"SDDiskCache.h\"\n\nstatic SDImageCacheConfig *_defaultCacheConfig;\nstatic const NSInteger kDefaultCacheMaxDiskAge = 60 * 60 * 24 * 7; // 1 week\n\n@implementation SDImageCacheConfig\n\n+ (SDImageCacheConfig *)defaultCacheConfig {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        _defaultCacheConfig = [SDImageCacheConfig new];\n    });\n    return _defaultCacheConfig;\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        _shouldDisableiCloud = YES;\n        _shouldCacheImagesInMemory = YES;\n        _shouldUseWeakMemoryCache = NO;\n        _shouldRemoveExpiredDataWhenEnterBackground = YES;\n        _shouldRemoveExpiredDataWhenTerminate = YES;\n        _diskCacheReadingOptions = 0;\n        _diskCacheWritingOptions = NSDataWritingAtomic;\n        _maxDiskAge = kDefaultCacheMaxDiskAge;\n        _maxDiskSize = 0;\n        _diskCacheExpireType = SDImageCacheConfigExpireTypeModificationDate;\n        _memoryCacheClass = [SDMemoryCache class];\n        _diskCacheClass = [SDDiskCache class];\n    }\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    SDImageCacheConfig *config = [[[self class] allocWithZone:zone] init];\n    config.shouldDisableiCloud = self.shouldDisableiCloud;\n    config.shouldCacheImagesInMemory = self.shouldCacheImagesInMemory;\n    config.shouldUseWeakMemoryCache = self.shouldUseWeakMemoryCache;\n    config.shouldRemoveExpiredDataWhenEnterBackground = self.shouldRemoveExpiredDataWhenEnterBackground;\n    config.shouldRemoveExpiredDataWhenTerminate = self.shouldRemoveExpiredDataWhenTerminate;\n    config.diskCacheReadingOptions = self.diskCacheReadingOptions;\n    config.diskCacheWritingOptions = self.diskCacheWritingOptions;\n    config.maxDiskAge = self.maxDiskAge;\n    config.maxDiskSize = self.maxDiskSize;\n    config.maxMemoryCost = self.maxMemoryCost;\n    config.maxMemoryCount = self.maxMemoryCount;\n    config.diskCacheExpireType = self.diskCacheExpireType;\n    config.fileManager = self.fileManager; // NSFileManager does not conform to NSCopying, just pass the reference\n    config.memoryCacheClass = self.memoryCacheClass;\n    config.diskCacheClass = self.diskCacheClass;\n    \n    return config;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageOperation.h\"\n#import \"SDWebImageDefine.h\"\n\n/// Image Cache Type\ntypedef NS_ENUM(NSInteger, SDImageCacheType) {\n    /**\n     * For query and contains op in response, means the image isn't available in the image cache\n     * For op in request, this type is not available and take no effect.\n     */\n    SDImageCacheTypeNone,\n    /**\n     * For query and contains op in response, means the image was obtained from the disk cache.\n     * For op in request, means process only disk cache.\n     */\n    SDImageCacheTypeDisk,\n    /**\n     * For query and contains op in response, means the image was obtained from the memory cache.\n     * For op in request, means process only memory cache.\n     */\n    SDImageCacheTypeMemory,\n    /**\n     * For query and contains op in response, this type is not available and take no effect.\n     * For op in request, means process both memory cache and disk cache.\n     */\n    SDImageCacheTypeAll\n};\n\ntypedef void(^SDImageCacheCheckCompletionBlock)(BOOL isInCache);\ntypedef void(^SDImageCacheQueryDataCompletionBlock)(NSData * _Nullable data);\ntypedef void(^SDImageCacheCalculateSizeBlock)(NSUInteger fileCount, NSUInteger totalSize);\ntypedef NSString * _Nullable (^SDImageCacheAdditionalCachePathBlock)(NSString * _Nonnull key);\ntypedef void(^SDImageCacheQueryCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType);\ntypedef void(^SDImageCacheContainsCompletionBlock)(SDImageCacheType containsCacheType);\n\n/**\n This is the built-in decoding process for image query from cache.\n @note If you want to implement your custom loader with `queryImageForKey:options:context:completion:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image.\n \n @param imageData The image data from the cache. Should not be nil\n @param cacheKey The image cache key from the input. Should not be nil\n @param options The options arg from the input\n @param context The context arg from the input\n @return The decoded image for current image data query from cache\n */\nFOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSString * _Nonnull cacheKey, SDWebImageOptions options, SDWebImageContext * _Nullable context);\n\n/**\n This is the image cache protocol to provide custom image cache for `SDWebImageManager`.\n Though the best practice to custom image cache, is to write your own class which conform `SDMemoryCache` or `SDDiskCache` protocol for `SDImageCache` class (See more on `SDImageCacheConfig.memoryCacheClass & SDImageCacheConfig.diskCacheClass`).\n However, if your own cache implementation contains more advanced feature beyond `SDImageCache` itself, you can consider to provide this instead. For example, you can even use a cache manager like `SDImageCachesManager` to register multiple caches.\n */\n@protocol SDImageCache <NSObject>\n\n@required\n/**\n Query the cached image from image cache for given key. The operation can be used to cancel the query.\n If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`)\n\n @param key The image cache key\n @param options A mask to specify options to use for this query\n @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n @param completionBlock The completion block. Will not get called if the operation is cancelled\n @return The operation for this query\n */\n- (nullable id<SDWebImageOperation>)queryImageForKey:(nullable NSString *)key\n                                             options:(SDWebImageOptions)options\n                                             context:(nullable SDWebImageContext *)context\n                                          completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock;\n\n/**\n Query the cached image from image cache for given key. The operation can be used to cancel the query.\n If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`)\n\n @param key The image cache key\n @param options A mask to specify options to use for this query\n @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n @param cacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately.\n @param completionBlock The completion block. Will not get called if the operation is cancelled\n @return The operation for this query\n */\n- (nullable id<SDWebImageOperation>)queryImageForKey:(nullable NSString *)key\n                                             options:(SDWebImageOptions)options\n                                             context:(nullable SDWebImageContext *)context\n                                           cacheType:(SDImageCacheType)cacheType\n                                          completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock;\n\n/**\n Store the image into image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously.\n\n @param image The image to store\n @param imageData The image data to be used for disk storage\n @param key The image cache key\n @param cacheType The image store op cache type\n @param completionBlock A block executed after the operation is finished\n */\n- (void)storeImage:(nullable UIImage *)image\n         imageData:(nullable NSData *)imageData\n            forKey:(nullable NSString *)key\n         cacheType:(SDImageCacheType)cacheType\n        completion:(nullable SDWebImageNoParamsBlock)completionBlock;\n\n/**\n Remove the image from image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously.\n\n @param key The image cache key\n @param cacheType The image remove op cache type\n @param completionBlock A block executed after the operation is finished\n */\n- (void)removeImageForKey:(nullable NSString *)key\n                cacheType:(SDImageCacheType)cacheType\n               completion:(nullable SDWebImageNoParamsBlock)completionBlock;\n\n/**\n Check if image cache contains the image for the given key (does not load the image). If image is cached in memory, completion is called synchronously, else asynchronously.\n\n @param key The image cache key\n @param cacheType The image contains op cache type\n @param completionBlock A block executed after the operation is finished.\n */\n- (void)containsImageForKey:(nullable NSString *)key\n                  cacheType:(SDImageCacheType)cacheType\n                 completion:(nullable SDImageCacheContainsCompletionBlock)completionBlock;\n\n/**\n Clear all the cached images for image cache. If cache type is memory only, completion is called synchronously, else asynchronously.\n\n @param cacheType The image clear op cache type\n @param completionBlock A block executed after the operation is finished\n */\n- (void)clearWithCacheType:(SDImageCacheType)cacheType\n                completion:(nullable SDWebImageNoParamsBlock)completionBlock;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCacheDefine.h\"\n#import \"SDImageCodersManager.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"SDAnimatedImage.h\"\n#import \"UIImage+Metadata.h\"\n#import \"SDInternalMacros.h\"\n\nUIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSString * _Nonnull cacheKey, SDWebImageOptions options, SDWebImageContext * _Nullable context) {\n    UIImage *image;\n    BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly);\n    NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor];\n    CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);\n    NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];\n    NSValue *thumbnailSizeValue;\n    BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);\n    if (shouldScaleDown) {\n        CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;\n        CGFloat dimension = ceil(sqrt(thumbnailPixels));\n        thumbnailSizeValue = @(CGSizeMake(dimension, dimension));\n    }\n    if (context[SDWebImageContextImageThumbnailPixelSize]) {\n        thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];\n    }\n    \n    SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2];\n    mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame);\n    mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale);\n    mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue;\n    mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue;\n    mutableCoderOptions[SDImageCoderWebImageContext] = context;\n    SDImageCoderOptions *coderOptions = [mutableCoderOptions copy];\n    \n    // Grab the image coder\n    id<SDImageCoder> imageCoder;\n    if ([context[SDWebImageContextImageCoder] conformsToProtocol:@protocol(SDImageCoder)]) {\n        imageCoder = context[SDWebImageContextImageCoder];\n    } else {\n        imageCoder = [SDImageCodersManager sharedManager];\n    }\n    \n    if (!decodeFirstFrame) {\n        Class animatedImageClass = context[SDWebImageContextAnimatedImageClass];\n        // check whether we should use `SDAnimatedImage`\n        if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)]) {\n            image = [[animatedImageClass alloc] initWithData:imageData scale:scale options:coderOptions];\n            if (image) {\n                // Preload frames if supported\n                if (options & SDWebImagePreloadAllFrames && [image respondsToSelector:@selector(preloadAllFrames)]) {\n                    [((id<SDAnimatedImage>)image) preloadAllFrames];\n                }\n            } else {\n                // Check image class matching\n                if (options & SDWebImageMatchAnimatedImageClass) {\n                    return nil;\n                }\n            }\n        }\n    }\n    if (!image) {\n        image = [imageCoder decodedImageWithData:imageData options:coderOptions];\n    }\n    if (image) {\n        BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage);\n        if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) {\n            // `SDAnimatedImage` do not decode\n            shouldDecode = NO;\n        } else if (image.sd_isAnimated) {\n            // animated image do not decode\n            shouldDecode = NO;\n        }\n        if (shouldDecode) {\n            image = [SDImageCoderHelper decodedImageWithImage:image];\n        }\n    }\n    \n    return image;\n}\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDImageCacheDefine.h\"\n\n/// Policy for cache operation\ntypedef NS_ENUM(NSUInteger, SDImageCachesManagerOperationPolicy) {\n    SDImageCachesManagerOperationPolicySerial, // process all caches serially (from the highest priority to the lowest priority cache by order)\n    SDImageCachesManagerOperationPolicyConcurrent, // process all caches concurrently\n    SDImageCachesManagerOperationPolicyHighestOnly, // process the highest priority cache only\n    SDImageCachesManagerOperationPolicyLowestOnly // process the lowest priority cache only\n};\n\n/**\n A caches manager to manage multiple caches.\n */\n@interface SDImageCachesManager : NSObject <SDImageCache>\n\n/**\n Returns the global shared caches manager instance. By default we will set [`SDImageCache.sharedImageCache`] into the caches array.\n */\n@property (nonatomic, class, readonly, nonnull) SDImageCachesManager *sharedManager;\n\n// These are op policy for cache manager.\n\n/**\n Operation policy for query op.\n Defaults to `Serial`, means query all caches serially (one completion called then next begin) until one cache query success (`image` != nil).\n */\n@property (nonatomic, assign) SDImageCachesManagerOperationPolicy queryOperationPolicy;\n\n/**\n Operation policy for store op.\n Defaults to `HighestOnly`, means store to the highest priority cache only.\n */\n@property (nonatomic, assign) SDImageCachesManagerOperationPolicy storeOperationPolicy;\n\n/**\n Operation policy for remove op.\n Defaults to `Concurrent`, means remove all caches concurrently.\n */\n@property (nonatomic, assign) SDImageCachesManagerOperationPolicy removeOperationPolicy;\n\n/**\n Operation policy for contains op.\n Defaults to `Serial`, means check all caches serially (one completion called then next begin) until one cache check success (`containsCacheType` != None).\n */\n@property (nonatomic, assign) SDImageCachesManagerOperationPolicy containsOperationPolicy;\n\n/**\n Operation policy for clear op.\n Defaults to `Concurrent`, means clear all caches concurrently.\n */\n@property (nonatomic, assign) SDImageCachesManagerOperationPolicy clearOperationPolicy;\n\n/**\n All caches in caches manager. The caches array is a priority queue, which means the later added cache will have the highest priority\n */\n@property (nonatomic, copy, nullable) NSArray<id<SDImageCache>> *caches;\n\n/**\n Add a new cache to the end of caches array. Which has the highest priority.\n \n @param cache cache\n */\n- (void)addCache:(nonnull id<SDImageCache>)cache;\n\n/**\n Remove a cache in the caches array.\n \n @param cache cache\n */\n- (void)removeCache:(nonnull id<SDImageCache>)cache;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCachesManager.h\"\n#import \"SDImageCachesManagerOperation.h\"\n#import \"SDImageCache.h\"\n#import \"SDInternalMacros.h\"\n\n@interface SDImageCachesManager ()\n\n@property (nonatomic, strong, nonnull) NSMutableArray<id<SDImageCache>> *imageCaches;\n\n@end\n\n@implementation SDImageCachesManager {\n    SD_LOCK_DECLARE(_cachesLock);\n}\n\n+ (SDImageCachesManager *)sharedManager {\n    static dispatch_once_t onceToken;\n    static SDImageCachesManager *manager;\n    dispatch_once(&onceToken, ^{\n        manager = [[SDImageCachesManager alloc] init];\n    });\n    return manager;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        self.queryOperationPolicy = SDImageCachesManagerOperationPolicySerial;\n        self.storeOperationPolicy = SDImageCachesManagerOperationPolicyHighestOnly;\n        self.removeOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent;\n        self.containsOperationPolicy = SDImageCachesManagerOperationPolicySerial;\n        self.clearOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent;\n        // initialize with default image caches\n        _imageCaches = [NSMutableArray arrayWithObject:[SDImageCache sharedImageCache]];\n        SD_LOCK_INIT(_cachesLock);\n    }\n    return self;\n}\n\n- (NSArray<id<SDImageCache>> *)caches {\n    SD_LOCK(_cachesLock);\n    NSArray<id<SDImageCache>> *caches = [_imageCaches copy];\n    SD_UNLOCK(_cachesLock);\n    return caches;\n}\n\n- (void)setCaches:(NSArray<id<SDImageCache>> *)caches {\n    SD_LOCK(_cachesLock);\n    [_imageCaches removeAllObjects];\n    if (caches.count) {\n        [_imageCaches addObjectsFromArray:caches];\n    }\n    SD_UNLOCK(_cachesLock);\n}\n\n#pragma mark - Cache IO operations\n\n- (void)addCache:(id<SDImageCache>)cache {\n    if (![cache conformsToProtocol:@protocol(SDImageCache)]) {\n        return;\n    }\n    SD_LOCK(_cachesLock);\n    [_imageCaches addObject:cache];\n    SD_UNLOCK(_cachesLock);\n}\n\n- (void)removeCache:(id<SDImageCache>)cache {\n    if (![cache conformsToProtocol:@protocol(SDImageCache)]) {\n        return;\n    }\n    SD_LOCK(_cachesLock);\n    [_imageCaches removeObject:cache];\n    SD_UNLOCK(_cachesLock);\n}\n\n#pragma mark - SDImageCache\n\n- (id<SDWebImageOperation>)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context completion:(SDImageCacheQueryCompletionBlock)completionBlock {\n    return [self queryImageForKey:key options:options context:context cacheType:SDImageCacheTypeAll completion:completionBlock];\n}\n\n- (id<SDWebImageOperation>)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock {\n    if (!key) {\n        return nil;\n    }\n    NSArray<id<SDImageCache>> *caches = self.caches;\n    NSUInteger count = caches.count;\n    if (count == 0) {\n        return nil;\n    } else if (count == 1) {\n        return [caches.firstObject queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock];\n    }\n    switch (self.queryOperationPolicy) {\n        case SDImageCachesManagerOperationPolicyHighestOnly: {\n            id<SDImageCache> cache = caches.lastObject;\n            return [cache queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyLowestOnly: {\n            id<SDImageCache> cache = caches.firstObject;\n            return [cache queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyConcurrent: {\n            SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new];\n            [operation beginWithTotalCount:caches.count];\n            [self concurrentQueryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation];\n            return operation;\n        }\n            break;\n        case SDImageCachesManagerOperationPolicySerial: {\n            SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new];\n            [operation beginWithTotalCount:caches.count];\n            [self serialQueryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation];\n            return operation;\n        }\n            break;\n        default:\n            return nil;\n            break;\n    }\n}\n\n- (void)storeImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock {\n    if (!key) {\n        return;\n    }\n    NSArray<id<SDImageCache>> *caches = self.caches;\n    NSUInteger count = caches.count;\n    if (count == 0) {\n        return;\n    } else if (count == 1) {\n        [caches.firstObject storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock];\n        return;\n    }\n    switch (self.storeOperationPolicy) {\n        case SDImageCachesManagerOperationPolicyHighestOnly: {\n            id<SDImageCache> cache = caches.lastObject;\n            [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyLowestOnly: {\n            id<SDImageCache> cache = caches.firstObject;\n            [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyConcurrent: {\n            SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new];\n            [operation beginWithTotalCount:caches.count];\n            [self concurrentStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicySerial: {\n            [self serialStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator];\n        }\n            break;\n        default:\n            break;\n    }\n}\n\n- (void)removeImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock {\n    if (!key) {\n        return;\n    }\n    NSArray<id<SDImageCache>> *caches = self.caches;\n    NSUInteger count = caches.count;\n    if (count == 0) {\n        return;\n    } else if (count == 1) {\n        [caches.firstObject removeImageForKey:key cacheType:cacheType completion:completionBlock];\n        return;\n    }\n    switch (self.removeOperationPolicy) {\n        case SDImageCachesManagerOperationPolicyHighestOnly: {\n            id<SDImageCache> cache = caches.lastObject;\n            [cache removeImageForKey:key cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyLowestOnly: {\n            id<SDImageCache> cache = caches.firstObject;\n            [cache removeImageForKey:key cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyConcurrent: {\n            SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new];\n            [operation beginWithTotalCount:caches.count];\n            [self concurrentRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicySerial: {\n            [self serialRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator];\n        }\n            break;\n        default:\n            break;\n    }\n}\n\n- (void)containsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock {\n    if (!key) {\n        return;\n    }\n    NSArray<id<SDImageCache>> *caches = self.caches;\n    NSUInteger count = caches.count;\n    if (count == 0) {\n        return;\n    } else if (count == 1) {\n        [caches.firstObject containsImageForKey:key cacheType:cacheType completion:completionBlock];\n        return;\n    }\n    switch (self.clearOperationPolicy) {\n        case SDImageCachesManagerOperationPolicyHighestOnly: {\n            id<SDImageCache> cache = caches.lastObject;\n            [cache containsImageForKey:key cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyLowestOnly: {\n            id<SDImageCache> cache = caches.firstObject;\n            [cache containsImageForKey:key cacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyConcurrent: {\n            SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new];\n            [operation beginWithTotalCount:caches.count];\n            [self concurrentContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicySerial: {\n            SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new];\n            [operation beginWithTotalCount:caches.count];\n            [self serialContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation];\n        }\n            break;\n        default:\n            break;\n    }\n}\n\n- (void)clearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock {\n    NSArray<id<SDImageCache>> *caches = self.caches;\n    NSUInteger count = caches.count;\n    if (count == 0) {\n        return;\n    } else if (count == 1) {\n        [caches.firstObject clearWithCacheType:cacheType completion:completionBlock];\n        return;\n    }\n    switch (self.clearOperationPolicy) {\n        case SDImageCachesManagerOperationPolicyHighestOnly: {\n            id<SDImageCache> cache = caches.lastObject;\n            [cache clearWithCacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyLowestOnly: {\n            id<SDImageCache> cache = caches.firstObject;\n            [cache clearWithCacheType:cacheType completion:completionBlock];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicyConcurrent: {\n            SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new];\n            [operation beginWithTotalCount:caches.count];\n            [self concurrentClearWithCacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation];\n        }\n            break;\n        case SDImageCachesManagerOperationPolicySerial: {\n            [self serialClearWithCacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator];\n        }\n            break;\n        default:\n            break;\n    }\n}\n\n#pragma mark - Concurrent Operation\n\n- (void)concurrentQueryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator operation:(SDImageCachesManagerOperation *)operation {\n    NSParameterAssert(enumerator);\n    NSParameterAssert(operation);\n    for (id<SDImageCache> cache in enumerator) {\n        [cache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) {\n            if (operation.isCancelled) {\n                // Cancelled\n                return;\n            }\n            if (operation.isFinished) {\n                // Finished\n                return;\n            }\n            [operation completeOne];\n            if (image) {\n                // Success\n                [operation done];\n                if (completionBlock) {\n                    completionBlock(image, data, cacheType);\n                }\n                return;\n            }\n            if (operation.pendingCount == 0) {\n                // Complete\n                [operation done];\n                if (completionBlock) {\n                    completionBlock(nil, nil, SDImageCacheTypeNone);\n                }\n            }\n        }];\n    }\n}\n\n- (void)concurrentStoreImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator operation:(SDImageCachesManagerOperation *)operation {\n    NSParameterAssert(enumerator);\n    NSParameterAssert(operation);\n    for (id<SDImageCache> cache in enumerator) {\n        [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:^{\n            if (operation.isCancelled) {\n                // Cancelled\n                return;\n            }\n            if (operation.isFinished) {\n                // Finished\n                return;\n            }\n            [operation completeOne];\n            if (operation.pendingCount == 0) {\n                // Complete\n                [operation done];\n                if (completionBlock) {\n                    completionBlock();\n                }\n            }\n        }];\n    }\n}\n\n- (void)concurrentRemoveImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator operation:(SDImageCachesManagerOperation *)operation {\n    NSParameterAssert(enumerator);\n    NSParameterAssert(operation);\n    for (id<SDImageCache> cache in enumerator) {\n        [cache removeImageForKey:key cacheType:cacheType completion:^{\n            if (operation.isCancelled) {\n                // Cancelled\n                return;\n            }\n            if (operation.isFinished) {\n                // Finished\n                return;\n            }\n            [operation completeOne];\n            if (operation.pendingCount == 0) {\n                // Complete\n                [operation done];\n                if (completionBlock) {\n                    completionBlock();\n                }\n            }\n        }];\n    }\n}\n\n- (void)concurrentContainsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator operation:(SDImageCachesManagerOperation *)operation {\n    NSParameterAssert(enumerator);\n    NSParameterAssert(operation);\n    for (id<SDImageCache> cache in enumerator) {\n        [cache containsImageForKey:key cacheType:cacheType completion:^(SDImageCacheType containsCacheType) {\n            if (operation.isCancelled) {\n                // Cancelled\n                return;\n            }\n            if (operation.isFinished) {\n                // Finished\n                return;\n            }\n            [operation completeOne];\n            if (containsCacheType != SDImageCacheTypeNone) {\n                // Success\n                [operation done];\n                if (completionBlock) {\n                    completionBlock(containsCacheType);\n                }\n                return;\n            }\n            if (operation.pendingCount == 0) {\n                // Complete\n                [operation done];\n                if (completionBlock) {\n                    completionBlock(SDImageCacheTypeNone);\n                }\n            }\n        }];\n    }\n}\n\n- (void)concurrentClearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator operation:(SDImageCachesManagerOperation *)operation {\n    NSParameterAssert(enumerator);\n    NSParameterAssert(operation);\n    for (id<SDImageCache> cache in enumerator) {\n        [cache clearWithCacheType:cacheType completion:^{\n            if (operation.isCancelled) {\n                // Cancelled\n                return;\n            }\n            if (operation.isFinished) {\n                // Finished\n                return;\n            }\n            [operation completeOne];\n            if (operation.pendingCount == 0) {\n                // Complete\n                [operation done];\n                if (completionBlock) {\n                    completionBlock();\n                }\n            }\n        }];\n    }\n}\n\n#pragma mark - Serial Operation\n\n- (void)serialQueryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator operation:(SDImageCachesManagerOperation *)operation {\n    NSParameterAssert(enumerator);\n    NSParameterAssert(operation);\n    id<SDImageCache> cache = enumerator.nextObject;\n    if (!cache) {\n        // Complete\n        [operation done];\n        if (completionBlock) {\n            completionBlock(nil, nil, SDImageCacheTypeNone);\n        }\n        return;\n    }\n    @weakify(self);\n    [cache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) {\n        @strongify(self);\n        if (operation.isCancelled) {\n            // Cancelled\n            return;\n        }\n        if (operation.isFinished) {\n            // Finished\n            return;\n        }\n        [operation completeOne];\n        if (image) {\n            // Success\n            [operation done];\n            if (completionBlock) {\n                completionBlock(image, data, cacheType);\n            }\n            return;\n        }\n        // Next\n        [self serialQueryImageForKey:key options:options context:context cacheType:queryCacheType completion:completionBlock enumerator:enumerator operation:operation];\n    }];\n}\n\n- (void)serialStoreImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator {\n    NSParameterAssert(enumerator);\n    id<SDImageCache> cache = enumerator.nextObject;\n    if (!cache) {\n        // Complete\n        if (completionBlock) {\n            completionBlock();\n        }\n        return;\n    }\n    @weakify(self);\n    [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:^{\n        @strongify(self);\n        // Next\n        [self serialStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator];\n    }];\n}\n\n- (void)serialRemoveImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator {\n    NSParameterAssert(enumerator);\n    id<SDImageCache> cache = enumerator.nextObject;\n    if (!cache) {\n        // Complete\n        if (completionBlock) {\n            completionBlock();\n        }\n        return;\n    }\n    @weakify(self);\n    [cache removeImageForKey:key cacheType:cacheType completion:^{\n        @strongify(self);\n        // Next\n        [self serialRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator];\n    }];\n}\n\n- (void)serialContainsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator operation:(SDImageCachesManagerOperation *)operation {\n    NSParameterAssert(enumerator);\n    NSParameterAssert(operation);\n    id<SDImageCache> cache = enumerator.nextObject;\n    if (!cache) {\n        // Complete\n        [operation done];\n        if (completionBlock) {\n            completionBlock(SDImageCacheTypeNone);\n        }\n        return;\n    }\n    @weakify(self);\n    [cache containsImageForKey:key cacheType:cacheType completion:^(SDImageCacheType containsCacheType) {\n        @strongify(self);\n        if (operation.isCancelled) {\n            // Cancelled\n            return;\n        }\n        if (operation.isFinished) {\n            // Finished\n            return;\n        }\n        [operation completeOne];\n        if (containsCacheType != SDImageCacheTypeNone) {\n            // Success\n            [operation done];\n            if (completionBlock) {\n                completionBlock(containsCacheType);\n            }\n            return;\n        }\n        // Next\n        [self serialContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator operation:operation];\n    }];\n}\n\n- (void)serialClearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator<id<SDImageCache>> *)enumerator {\n    NSParameterAssert(enumerator);\n    id<SDImageCache> cache = enumerator.nextObject;\n    if (!cache) {\n        // Complete\n        if (completionBlock) {\n            completionBlock();\n        }\n        return;\n    }\n    @weakify(self);\n    [cache clearWithCacheType:cacheType completion:^{\n        @strongify(self);\n        // Next\n        [self serialClearWithCacheType:cacheType completion:completionBlock enumerator:enumerator];\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n#import \"NSData+ImageContentType.h\"\n\ntypedef NSString * SDImageCoderOption NS_STRING_ENUM;\ntypedef NSDictionary<SDImageCoderOption, id> SDImageCoderOptions;\ntypedef NSMutableDictionary<SDImageCoderOption, id> SDImageCoderMutableOptions;\n\n#pragma mark - Coder Options\n// These options are for image decoding\n/**\n A Boolean value indicating whether to decode the first frame only for animated image during decoding. (NSNumber). If not provide, decode animated image if need.\n @note works for `SDImageCoder`.\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeFirstFrameOnly;\n\n/**\n A CGFloat value which is greater than or equal to 1.0. This value specify the image scale factor for decoding. If not provide, use 1.0. (NSNumber)\n @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`.\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeScaleFactor;\n\n/**\n A Boolean value indicating whether to keep the original aspect ratio when generating thumbnail images (or bitmap images from vector format).\n Defaults to YES.\n @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`.\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodePreserveAspectRatio;\n\n/**\n A CGSize value indicating whether or not to generate the thumbnail images (or bitmap images from vector format). When this value is provided, the decoder will generate a thumbnail image which pixel size is smaller than or equal to (depends the `.preserveAspectRatio`) the value size.\n Defaults to CGSizeZero, which means no thumbnail generation at all.\n @note Supports for animated image as well.\n @note When you pass `.preserveAspectRatio == NO`, the thumbnail image is stretched to match each dimension. When `.preserveAspectRatio == YES`, the thumbnail image's width is limited to pixel size's width, the thumbnail image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both.\n @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`.\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeThumbnailPixelSize;\n\n\n// These options are for image encoding\n/**\n A Boolean value indicating whether to encode the first frame only for animated image during encoding. (NSNumber). If not provide, encode animated image if need.\n @note works for `SDImageCoder`.\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeFirstFrameOnly;\n/**\n A double value between 0.0-1.0 indicating the encode compression quality to produce the image data. 1.0 resulting in no compression and 0.0 resulting in the maximum compression possible. If not provide, use 1.0. (NSNumber)\n @note works for `SDImageCoder`\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeCompressionQuality;\n\n/**\n A UIColor(NSColor) value to used for non-alpha image encoding when the input image has alpha channel, the background color will be used to compose the alpha one. If not provide, use white color.\n @note works for `SDImageCoder`\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeBackgroundColor;\n\n/**\n A CGSize value indicating the max image resolution in pixels during encoding. For vector image, this also effect the output vector data information about width and height. The encoder will not generate the encoded image larger than this limit. Note it always use the aspect ratio of input image..\n Defaults to CGSizeZero, which means no max size limit at all.\n @note Supports for animated image as well.\n @note The output image's width is limited to pixel size's width, the output image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both.\n @note works for `SDImageCoder`\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxPixelSize;\n\n/**\n A NSUInteger value specify the max output data bytes size after encoding. Some lossy format like JPEG/HEIF supports the hint for codec to automatically reduce the quality and match the file size you want. Note this option will override the `SDImageCoderEncodeCompressionQuality`, because now the quality is decided by the encoder. (NSNumber)\n @note This is a hint, no guarantee for output size because of compression algorithm limit. And this options does not works for vector images.\n @note works for `SDImageCoder`\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxFileSize;\n\n/**\n A Boolean value indicating the encoding format should contains a thumbnail image into the output data. Only some of image format (like JPEG/HEIF/AVIF) support this behavior. The embed thumbnail will be used during next time thumbnail decoding (provided `.thumbnailPixelSize`), which is faster than full image thumbnail decoding. (NSNumber)\n Defaults to NO, which does not embed any thumbnail.\n @note The thumbnail image's pixel size is not defined, the encoder can choose the proper pixel size which is suitable for encoding quality.\n @note works for `SDImageCoder`\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeEmbedThumbnail;\n\n/**\n A SDWebImageContext object which hold the original context options from top-level API. (SDWebImageContext)\n This option is ignored for all built-in coders and take no effect.\n But this may be useful for some custom coders, because some business logic may dependent on things other than image or image data information only.\n See `SDWebImageContext` for more detailed information.\n */\nFOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderWebImageContext API_DEPRECATED(\"The coder component will be seperated from Core subspec in the future. Update your code to not rely on this context option.\", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));\n\n#pragma mark - Coder\n/**\n This is the image coder protocol to provide custom image decoding/encoding.\n These methods are all required to implement.\n @note Pay attention that these methods are not called from main queue.\n */\n@protocol SDImageCoder <NSObject>\n\n@required\n#pragma mark - Decoding\n/**\n Returns YES if this coder can decode some data. Otherwise, the data should be passed to another coder.\n \n @param data The image data so we can look at it\n @return YES if this coder can decode the data, NO otherwise\n */\n- (BOOL)canDecodeFromData:(nullable NSData *)data;\n\n/**\n Decode the image data to image.\n @note This protocol may supports decode animated image frames. You can use `+[SDImageCoderHelper animatedImageWithFrames:]` to produce an animated image with frames.\n\n @param data The image data to be decoded\n @param options A dictionary containing any decoding options. Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for image. Pass @{SDImageCoderDecodeFirstFrameOnly: @(YES)} to decode the first frame only.\n @return The decoded image from data\n */\n- (nullable UIImage *)decodedImageWithData:(nullable NSData *)data\n                                   options:(nullable SDImageCoderOptions *)options;\n\n#pragma mark - Encoding\n\n/**\n Returns YES if this coder can encode some image. Otherwise, it should be passed to another coder.\n For custom coder which introduce new image format, you'd better define a new `SDImageFormat` using like this. If you're creating public coder plugin for new image format, also update `https://github.com/rs/SDWebImage/wiki/Coder-Plugin-List` to avoid same value been defined twice.\n * @code\n static const SDImageFormat SDImageFormatHEIF = 10;\n * @endcode\n \n @param format The image format\n @return YES if this coder can encode the image, NO otherwise\n */\n- (BOOL)canEncodeToFormat:(SDImageFormat)format NS_SWIFT_NAME(canEncode(to:));\n\n/**\n Encode the image to image data.\n @note This protocol may supports encode animated image frames. You can use `+[SDImageCoderHelper framesFromAnimatedImage:]` to assemble an animated image with frames.\n\n @param image The image to be encoded\n @param format The image format to encode, you should note `SDImageFormatUndefined` format is also  possible\n @param options A dictionary containing any encoding options. Pass @{SDImageCoderEncodeCompressionQuality: @(1)} to specify compression quality.\n @return The encoded image data\n */\n- (nullable NSData *)encodedDataWithImage:(nullable UIImage *)image\n                                   format:(SDImageFormat)format\n                                  options:(nullable SDImageCoderOptions *)options;\n\n@end\n\n#pragma mark - Progressive Coder\n/**\n This is the image coder protocol to provide custom progressive image decoding.\n These methods are all required to implement.\n @note Pay attention that these methods are not called from main queue.\n */\n@protocol SDProgressiveImageCoder <SDImageCoder>\n\n@required\n/**\n Returns YES if this coder can incremental decode some data. Otherwise, it should be passed to another coder.\n \n @param data The image data so we can look at it\n @return YES if this coder can decode the data, NO otherwise\n */\n- (BOOL)canIncrementalDecodeFromData:(nullable NSData *)data;\n\n/**\n Because incremental decoding need to keep the decoded context, we will alloc a new instance with the same class for each download operation to avoid conflicts\n This init method should not return nil\n\n @param options A dictionary containing any progressive decoding options (instance-level). Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for progressive animated image (each frames should use the same scale).\n @return A new instance to do incremental decoding for the specify image format\n */\n- (nonnull instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options;\n\n/**\n Update the incremental decoding when new image data available\n\n @param data The image data has been downloaded so far\n @param finished Whether the download has finished\n */\n- (void)updateIncrementalData:(nullable NSData *)data finished:(BOOL)finished;\n\n/**\n Incremental decode the current image data to image.\n @note Due to the performance issue for progressive decoding and the integration for image view. This method may only return the first frame image even if the image data is animated image. If you want progressive animated image decoding, conform to `SDAnimatedImageCoder` protocol as well and use `animatedImageFrameAtIndex:` instead.\n\n @param options A dictionary containing any progressive decoding options. Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for progressive image\n @return The decoded image from current data\n */\n- (nullable UIImage *)incrementalDecodedImageWithOptions:(nullable SDImageCoderOptions *)options;\n\n@end\n\n#pragma mark - Animated Image Provider\n/**\n This is the animated image protocol to provide the basic function for animated image rendering. It's adopted by `SDAnimatedImage` and `SDAnimatedImageCoder`\n */\n@protocol SDAnimatedImageProvider <NSObject>\n\n@required\n/**\n The original animated image data for current image. If current image is not an animated format, return nil.\n We may use this method to grab back the original image data if need, such as NSCoding or compare.\n \n @return The animated image data\n */\n@property (nonatomic, copy, readonly, nullable) NSData *animatedImageData;\n\n/**\n Total animated frame count.\n If the frame count is less than 1, then the methods below will be ignored.\n \n @return Total animated frame count.\n */\n@property (nonatomic, assign, readonly) NSUInteger animatedImageFrameCount;\n/**\n Animation loop count, 0 means infinite looping.\n \n @return Animation loop count\n */\n@property (nonatomic, assign, readonly) NSUInteger animatedImageLoopCount;\n/**\n Returns the frame image from a specified index.\n @note The index maybe randomly if one image was set to different imageViews, keep it re-entrant. (It's not recommend to store the images into array because it's memory consuming)\n \n @param index Frame index (zero based).\n @return Frame's image\n */\n- (nullable UIImage *)animatedImageFrameAtIndex:(NSUInteger)index;\n/**\n Returns the frames's duration from a specified index.\n @note The index maybe randomly if one image was set to different imageViews, keep it re-entrant. (It's recommend to store the durations into array because it's not memory-consuming)\n \n @param index Frame index (zero based).\n @return Frame's duration\n */\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index;\n\n@end\n\n#pragma mark - Animated Coder\n/**\n This is the animated image coder protocol for custom animated image class like  `SDAnimatedImage`. Through it inherit from `SDImageCoder`. We currentlly only use the method `canDecodeFromData:` to detect the proper coder for specify animated image format.\n */\n@protocol SDAnimatedImageCoder <SDImageCoder, SDAnimatedImageProvider>\n\n@required\n/**\n Because animated image coder should keep the original data, we will alloc a new instance with the same class for the specify animated image data\n The init method should return nil if it can't decode the specify animated image data to produce any frame.\n After the instance created, we may call methods in `SDAnimatedImageProvider` to produce animated image frame.\n\n @param data The animated image data to be decode\n @param options A dictionary containing any animated decoding options (instance-level). Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for animated image (each frames should use the same scale).\n @return A new instance to do animated decoding for specify image data\n */\n- (nullable instancetype)initWithAnimatedImageData:(nullable NSData *)data options:(nullable SDImageCoderOptions *)options;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCoder.h\"\n\nSDImageCoderOption const SDImageCoderDecodeFirstFrameOnly = @\"decodeFirstFrameOnly\";\nSDImageCoderOption const SDImageCoderDecodeScaleFactor = @\"decodeScaleFactor\";\nSDImageCoderOption const SDImageCoderDecodePreserveAspectRatio = @\"decodePreserveAspectRatio\";\nSDImageCoderOption const SDImageCoderDecodeThumbnailPixelSize = @\"decodeThumbnailPixelSize\";\n\nSDImageCoderOption const SDImageCoderEncodeFirstFrameOnly = @\"encodeFirstFrameOnly\";\nSDImageCoderOption const SDImageCoderEncodeCompressionQuality = @\"encodeCompressionQuality\";\nSDImageCoderOption const SDImageCoderEncodeBackgroundColor = @\"encodeBackgroundColor\";\nSDImageCoderOption const SDImageCoderEncodeMaxPixelSize = @\"encodeMaxPixelSize\";\nSDImageCoderOption const SDImageCoderEncodeMaxFileSize = @\"encodeMaxFileSize\";\nSDImageCoderOption const SDImageCoderEncodeEmbedThumbnail = @\"encodeEmbedThumbnail\";\n\nSDImageCoderOption const SDImageCoderWebImageContext = @\"webImageContext\";\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <ImageIO/ImageIO.h>\n#import \"SDWebImageCompat.h\"\n#import \"SDImageFrame.h\"\n\n/**\n Provide some common helper methods for building the image decoder/encoder.\n */\n@interface SDImageCoderHelper : NSObject\n\n/**\n Return an animated image with frames array.\n For UIKit, this will apply the patch and then create animated UIImage. The patch is because that `+[UIImage animatedImageWithImages:duration:]` just use the average of duration for each image. So it will not work if different frame has different duration. Therefore we repeat the specify frame for specify times to let it work.\n For AppKit, NSImage does not support animates other than GIF. This will try to encode the frames to GIF format and then create an animated NSImage for rendering. Attention the animated image may loss some detail if the input frames contain full alpha channel because GIF only supports 1 bit alpha channel. (For 1 pixel, either transparent or not)\n\n @param frames The frames array. If no frames or frames is empty, return nil\n @return A animated image for rendering on UIImageView(UIKit) or NSImageView(AppKit)\n */\n+ (UIImage * _Nullable)animatedImageWithFrames:(NSArray<SDImageFrame *> * _Nullable)frames;\n\n/**\n Return frames array from an animated image.\n For UIKit, this will unapply the patch for the description above and then create frames array. This will also work for normal animated UIImage.\n For AppKit, NSImage does not support animates other than GIF. This will try to decode the GIF imageRep and then create frames array.\n\n @param animatedImage A animated image. If it's not animated, return nil\n @return The frames array\n */\n+ (NSArray<SDImageFrame *> * _Nullable)framesFromAnimatedImage:(UIImage * _Nullable)animatedImage NS_SWIFT_NAME(frames(from:));\n\n/**\n Return the shared device-dependent RGB color space. This follows The Get Rule.\n On iOS, it's created with deviceRGB (if available, use sRGB).\n On macOS, it's from the screen colorspace (if failed, use deviceRGB)\n Because it's shared, you should not retain or release this object.\n \n @return The device-dependent RGB color space\n */\n+ (CGColorSpaceRef _Nonnull)colorSpaceGetDeviceRGB CF_RETURNS_NOT_RETAINED;\n\n/**\n Check whether CGImage contains alpha channel.\n \n @param cgImage The CGImage\n @return Return YES if CGImage contains alpha channel, otherwise return NO\n */\n+ (BOOL)CGImageContainsAlpha:(_Nonnull CGImageRef)cgImage;\n\n/**\n Create a decoded CGImage by the provided CGImage. This follows The Create Rule and you are response to call release after usage.\n It will detect whether image contains alpha channel, then create a new bitmap context with the same size of image, and draw it. This can ensure that the image do not need extra decoding after been set to the imageView.\n @note This actually call `CGImageCreateDecoded:orientation:` with the Up orientation.\n\n @param cgImage The CGImage\n @return A new created decoded image\n */\n+ (CGImageRef _Nullable)CGImageCreateDecoded:(_Nonnull CGImageRef)cgImage CF_RETURNS_RETAINED;\n\n/**\n Create a decoded CGImage by the provided CGImage and orientation. This follows The Create Rule and you are response to call release after usage.\n It will detect whether image contains alpha channel, then create a new bitmap context with the same size of image, and draw it. This can ensure that the image do not need extra decoding after been set to the imageView.\n \n @param cgImage The CGImage\n @param orientation The EXIF image orientation.\n @return A new created decoded image\n */\n+ (CGImageRef _Nullable)CGImageCreateDecoded:(_Nonnull CGImageRef)cgImage orientation:(CGImagePropertyOrientation)orientation CF_RETURNS_RETAINED;\n\n/**\n Create a scaled CGImage by the provided CGImage and size. This follows The Create Rule and you are response to call release after usage.\n It will detect whether the image size matching the scale size, if not, stretch the image to the target size.\n \n @param cgImage The CGImage\n @param size The scale size in pixel.\n @return A new created scaled image\n */\n+ (CGImageRef _Nullable)CGImageCreateScaled:(_Nonnull CGImageRef)cgImage size:(CGSize)size CF_RETURNS_RETAINED;\n\n/**\n Return the decoded image by the provided image. This one unlike `CGImageCreateDecoded:`, will not decode the image which contains alpha channel or animated image\n @param image The image to be decoded\n @return The decoded image\n */\n+ (UIImage * _Nullable)decodedImageWithImage:(UIImage * _Nullable)image;\n\n/**\n Return the decoded and probably scaled down image by the provided image. If the image pixels bytes size large than the limit bytes, will try to scale down. Or just works as `decodedImageWithImage:`, never scale up.\n @warning You should not pass too small bytes, the suggestion value should be larger than 1MB. Even we use Tile Decoding to avoid OOM, however, small bytes will consume much more CPU time because we need to iterate more times to draw each tile.\n\n @param image The image to be decoded and scaled down\n @param bytes The limit bytes size. Provide 0 to use the build-in limit.\n @return The decoded and probably scaled down image\n */\n+ (UIImage * _Nullable)decodedAndScaledDownImageWithImage:(UIImage * _Nullable)image limitBytes:(NSUInteger)bytes;\n\n/**\n Control the default limit bytes to scale down largest images.\n This value must be larger than 4 Bytes (at least 1x1 pixel). Defaults to 60MB on iOS/tvOS, 90MB on macOS, 30MB on watchOS.\n */\n@property (class, readwrite) NSUInteger defaultScaleDownLimitBytes;\n\n#if SD_UIKIT || SD_WATCH\n/**\n Convert an EXIF image orientation to an iOS one.\n\n @param exifOrientation EXIF orientation\n @return iOS orientation\n */\n+ (UIImageOrientation)imageOrientationFromEXIFOrientation:(CGImagePropertyOrientation)exifOrientation NS_SWIFT_NAME(imageOrientation(from:));\n\n/**\n Convert an iOS orientation to an EXIF image orientation.\n\n @param imageOrientation iOS orientation\n @return EXIF orientation\n */\n+ (CGImagePropertyOrientation)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation;\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCoderHelper.h\"\n#import \"SDImageFrame.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"NSData+ImageContentType.h\"\n#import \"SDAnimatedImageRep.h\"\n#import \"UIImage+ForceDecode.h\"\n#import \"SDAssociatedObject.h\"\n#import \"UIImage+Metadata.h\"\n#import \"SDInternalMacros.h\"\n#import \"SDGraphicsImageRenderer.h\"\n#import <Accelerate/Accelerate.h>\n\nstatic inline size_t SDByteAlign(size_t size, size_t alignment) {\n    return ((size + (alignment - 1)) / alignment) * alignment;\n}\n\nstatic const size_t kBytesPerPixel = 4;\nstatic const size_t kBitsPerComponent = 8;\n\nstatic const CGFloat kBytesPerMB = 1024.0f * 1024.0f;\n/*\n * Defines the maximum size in MB of the decoded image when the flag `SDWebImageScaleDownLargeImages` is set\n * Suggested value for iPad1 and iPhone 3GS: 60.\n * Suggested value for iPad2 and iPhone 4: 120.\n * Suggested value for iPhone 3G and iPod 2 and earlier devices: 30.\n */\n#if SD_MAC\nstatic CGFloat kDestImageLimitBytes = 90.f * kBytesPerMB;\n#elif SD_UIKIT\nstatic CGFloat kDestImageLimitBytes = 60.f * kBytesPerMB;\n#elif SD_WATCH\nstatic CGFloat kDestImageLimitBytes = 30.f * kBytesPerMB;\n#endif\n\nstatic const CGFloat kDestSeemOverlap = 2.0f;   // the numbers of pixels to overlap the seems where tiles meet.\n\n@implementation SDImageCoderHelper\n\n+ (UIImage *)animatedImageWithFrames:(NSArray<SDImageFrame *> *)frames {\n    NSUInteger frameCount = frames.count;\n    if (frameCount == 0) {\n        return nil;\n    }\n    \n    UIImage *animatedImage;\n    \n#if SD_UIKIT || SD_WATCH\n    NSUInteger durations[frameCount];\n    for (size_t i = 0; i < frameCount; i++) {\n        durations[i] = frames[i].duration * 1000;\n    }\n    NSUInteger const gcd = gcdArray(frameCount, durations);\n    __block NSTimeInterval totalDuration = 0;\n    NSMutableArray<UIImage *> *animatedImages = [NSMutableArray arrayWithCapacity:frameCount];\n    [frames enumerateObjectsUsingBlock:^(SDImageFrame * _Nonnull frame, NSUInteger idx, BOOL * _Nonnull stop) {\n        UIImage *image = frame.image;\n        NSUInteger duration = frame.duration * 1000;\n        totalDuration += frame.duration;\n        NSUInteger repeatCount;\n        if (gcd) {\n            repeatCount = duration / gcd;\n        } else {\n            repeatCount = 1;\n        }\n        for (size_t i = 0; i < repeatCount; ++i) {\n            [animatedImages addObject:image];\n        }\n    }];\n    \n    animatedImage = [UIImage animatedImageWithImages:animatedImages duration:totalDuration];\n    \n#else\n    \n    NSMutableData *imageData = [NSMutableData data];\n    CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatGIF];\n    // Create an image destination. GIF does not support EXIF image orientation\n    CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frameCount, NULL);\n    if (!imageDestination) {\n        // Handle failure.\n        return nil;\n    }\n    \n    for (size_t i = 0; i < frameCount; i++) {\n        @autoreleasepool {\n            SDImageFrame *frame = frames[i];\n            NSTimeInterval frameDuration = frame.duration;\n            CGImageRef frameImageRef = frame.image.CGImage;\n            NSDictionary *frameProperties = @{(__bridge NSString *)kCGImagePropertyGIFDictionary : @{(__bridge NSString *)kCGImagePropertyGIFDelayTime : @(frameDuration)}};\n            CGImageDestinationAddImage(imageDestination, frameImageRef, (__bridge CFDictionaryRef)frameProperties);\n        }\n    }\n    // Finalize the destination.\n    if (CGImageDestinationFinalize(imageDestination) == NO) {\n        // Handle failure.\n        CFRelease(imageDestination);\n        return nil;\n    }\n    CFRelease(imageDestination);\n    CGFloat scale = MAX(frames.firstObject.image.scale, 1);\n    \n    SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:imageData];\n    NSSize size = NSMakeSize(imageRep.pixelsWide / scale, imageRep.pixelsHigh / scale);\n    imageRep.size = size;\n    animatedImage = [[NSImage alloc] initWithSize:size];\n    [animatedImage addRepresentation:imageRep];\n#endif\n    \n    return animatedImage;\n}\n\n+ (NSArray<SDImageFrame *> *)framesFromAnimatedImage:(UIImage *)animatedImage {\n    if (!animatedImage) {\n        return nil;\n    }\n    \n    NSMutableArray<SDImageFrame *> *frames = [NSMutableArray array];\n    NSUInteger frameCount = 0;\n    \n#if SD_UIKIT || SD_WATCH\n    NSArray<UIImage *> *animatedImages = animatedImage.images;\n    frameCount = animatedImages.count;\n    if (frameCount == 0) {\n        return nil;\n    }\n    \n    NSTimeInterval avgDuration = animatedImage.duration / frameCount;\n    if (avgDuration == 0) {\n        avgDuration = 0.1; // if it's a animated image but no duration, set it to default 100ms (this do not have that 10ms limit like GIF or WebP to allow custom coder provide the limit)\n    }\n    \n    __block NSUInteger repeatCount = 1;\n    __block UIImage *previousImage = animatedImages.firstObject;\n    [animatedImages enumerateObjectsUsingBlock:^(UIImage * _Nonnull image, NSUInteger idx, BOOL * _Nonnull stop) {\n        // ignore first\n        if (idx == 0) {\n            return;\n        }\n        if ([image isEqual:previousImage]) {\n            repeatCount++;\n        } else {\n            SDImageFrame *frame = [SDImageFrame frameWithImage:previousImage duration:avgDuration * repeatCount];\n            [frames addObject:frame];\n            repeatCount = 1;\n        }\n        previousImage = image;\n    }];\n    // last one\n    SDImageFrame *frame = [SDImageFrame frameWithImage:previousImage duration:avgDuration * repeatCount];\n    [frames addObject:frame];\n    \n#else\n    \n    NSRect imageRect = NSMakeRect(0, 0, animatedImage.size.width, animatedImage.size.height);\n    NSImageRep *imageRep = [animatedImage bestRepresentationForRect:imageRect context:nil hints:nil];\n    NSBitmapImageRep *bitmapImageRep;\n    if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) {\n        bitmapImageRep = (NSBitmapImageRep *)imageRep;\n    }\n    if (!bitmapImageRep) {\n        return nil;\n    }\n    frameCount = [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];\n    if (frameCount == 0) {\n        return nil;\n    }\n    CGFloat scale = animatedImage.scale;\n    \n    for (size_t i = 0; i < frameCount; i++) {\n        @autoreleasepool {\n            // NSBitmapImageRep need to manually change frame. \"Good taste\" API\n            [bitmapImageRep setProperty:NSImageCurrentFrame withValue:@(i)];\n            NSTimeInterval frameDuration = [[bitmapImageRep valueForProperty:NSImageCurrentFrameDuration] doubleValue];\n            NSImage *frameImage = [[NSImage alloc] initWithCGImage:bitmapImageRep.CGImage scale:scale orientation:kCGImagePropertyOrientationUp];\n            SDImageFrame *frame = [SDImageFrame frameWithImage:frameImage duration:frameDuration];\n            [frames addObject:frame];\n        }\n    }\n#endif\n    \n    return frames;\n}\n\n+ (CGColorSpaceRef)colorSpaceGetDeviceRGB {\n    static CGColorSpaceRef colorSpace;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);\n    });\n    return colorSpace;\n}\n\n+ (BOOL)CGImageContainsAlpha:(CGImageRef)cgImage {\n    if (!cgImage) {\n        return NO;\n    }\n    CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(cgImage);\n    BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone ||\n                      alphaInfo == kCGImageAlphaNoneSkipFirst ||\n                      alphaInfo == kCGImageAlphaNoneSkipLast);\n    return hasAlpha;\n}\n\n+ (CGImageRef)CGImageCreateDecoded:(CGImageRef)cgImage {\n    return [self CGImageCreateDecoded:cgImage orientation:kCGImagePropertyOrientationUp];\n}\n\n+ (CGImageRef)CGImageCreateDecoded:(CGImageRef)cgImage orientation:(CGImagePropertyOrientation)orientation {\n    if (!cgImage) {\n        return NULL;\n    }\n    size_t width = CGImageGetWidth(cgImage);\n    size_t height = CGImageGetHeight(cgImage);\n    if (width == 0 || height == 0) return NULL;\n    size_t newWidth;\n    size_t newHeight;\n    switch (orientation) {\n        case kCGImagePropertyOrientationLeft:\n        case kCGImagePropertyOrientationLeftMirrored:\n        case kCGImagePropertyOrientationRight:\n        case kCGImagePropertyOrientationRightMirrored: {\n            // These orientation should swap width & height\n            newWidth = height;\n            newHeight = width;\n        }\n            break;\n        default: {\n            newWidth = width;\n            newHeight = height;\n        }\n            break;\n    }\n    \n    BOOL hasAlpha = [self CGImageContainsAlpha:cgImage];\n    // kCGImageAlphaNone is not supported in CGBitmapContextCreate.\n    // Check #3330 for more detail about why this bitmap is choosen.\n    CGBitmapInfo bitmapInfo;\n    if (hasAlpha) {\n        // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489\n        // BGRA8888\n        bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;\n    } else {\n        // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017\n        // RGB888\n        bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast;\n    }\n    CGContextRef context = CGBitmapContextCreate(NULL, newWidth, newHeight, 8, 0, [self colorSpaceGetDeviceRGB], bitmapInfo);\n    if (!context) {\n        return NULL;\n    }\n    \n    // Apply transform\n    CGAffineTransform transform = SDCGContextTransformFromOrientation(orientation, CGSizeMake(newWidth, newHeight));\n    CGContextConcatCTM(context, transform);\n    CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage); // The rect is bounding box of CGImage, don't swap width & height\n    CGImageRef newImageRef = CGBitmapContextCreateImage(context);\n    CGContextRelease(context);\n    \n    return newImageRef;\n}\n\n+ (CGImageRef)CGImageCreateScaled:(CGImageRef)cgImage size:(CGSize)size {\n    if (!cgImage) {\n        return NULL;\n    }\n    size_t width = CGImageGetWidth(cgImage);\n    size_t height = CGImageGetHeight(cgImage);\n    if (width == size.width && height == size.height) {\n        CGImageRetain(cgImage);\n        return cgImage;\n    }\n    \n    __block vImage_Buffer input_buffer = {}, output_buffer = {};\n    @onExit {\n        if (input_buffer.data) free(input_buffer.data);\n        if (output_buffer.data) free(output_buffer.data);\n    };\n    BOOL hasAlpha = [self CGImageContainsAlpha:cgImage];\n    // kCGImageAlphaNone is not supported in CGBitmapContextCreate.\n    // Check #3330 for more detail about why this bitmap is choosen.\n    CGBitmapInfo bitmapInfo;\n    if (hasAlpha) {\n        // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489\n        // BGRA8888\n        bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;\n    } else {\n        // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017\n        // RGB888\n        bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast;\n    }\n    vImage_CGImageFormat format = (vImage_CGImageFormat) {\n        .bitsPerComponent = 8,\n        .bitsPerPixel = 32,\n        .colorSpace = NULL,\n        .bitmapInfo = bitmapInfo,\n        .version = 0,\n        .decode = NULL,\n        .renderingIntent = CGImageGetRenderingIntent(cgImage)\n    };\n    \n    vImage_Error a_ret = vImageBuffer_InitWithCGImage(&input_buffer, &format, NULL, cgImage, kvImageNoFlags);\n    if (a_ret != kvImageNoError) return NULL;\n    output_buffer.width = MAX(size.width, 0);\n    output_buffer.height = MAX(size.height, 0);\n    output_buffer.rowBytes = SDByteAlign(output_buffer.width * 4, 64);\n    output_buffer.data = malloc(output_buffer.rowBytes * output_buffer.height);\n    if (!output_buffer.data) return NULL;\n    \n    vImage_Error ret = vImageScale_ARGB8888(&input_buffer, &output_buffer, NULL, kvImageHighQualityResampling);\n    if (ret != kvImageNoError) return NULL;\n    \n    CGImageRef outputImage = vImageCreateCGImageFromBuffer(&output_buffer, &format, NULL, NULL, kvImageNoFlags, &ret);\n    if (ret != kvImageNoError) {\n        CGImageRelease(outputImage);\n        return NULL;\n    }\n    \n    return outputImage;\n}\n\n+ (UIImage *)decodedImageWithImage:(UIImage *)image {\n    if (![self shouldDecodeImage:image]) {\n        return image;\n    }\n    \n    CGImageRef imageRef = image.CGImage;\n    if (!imageRef) {\n        return image;\n    }\n    BOOL hasAlpha = [self CGImageContainsAlpha:imageRef];\n    // Prefer to use new Image Renderer to re-draw image, instead of low-level CGBitmapContext and CGContextDrawImage\n    // This can keep both OS compatible and don't fight with Apple's performance optimization\n    SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init];\n    format.opaque = !hasAlpha;\n    format.scale = image.scale;\n    CGSize imageSize = image.size;\n    SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:imageSize format:format];\n    UIImage *decodedImage = [renderer imageWithActions:^(CGContextRef  _Nonnull context) {\n            [image drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)];\n    }];\n    SDImageCopyAssociatedObject(image, decodedImage);\n    decodedImage.sd_isDecoded = YES;\n    return decodedImage;\n}\n\n+ (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image limitBytes:(NSUInteger)bytes {\n    if (![self shouldDecodeImage:image]) {\n        return image;\n    }\n    \n    if (![self shouldScaleDownImage:image limitBytes:bytes]) {\n        return [self decodedImageWithImage:image];\n    }\n    \n    CGFloat destTotalPixels;\n    CGFloat tileTotalPixels;\n    if (bytes == 0) {\n        bytes = kDestImageLimitBytes;\n    }\n    destTotalPixels = bytes / kBytesPerPixel;\n    tileTotalPixels = destTotalPixels / 3;\n    CGContextRef destContext = NULL;\n    \n    // autorelease the bitmap context and all vars to help system to free memory when there are memory warning.\n    // on iOS7, do not forget to call [[SDImageCache sharedImageCache] clearMemory];\n    @autoreleasepool {\n        CGImageRef sourceImageRef = image.CGImage;\n        \n        CGSize sourceResolution = CGSizeZero;\n        sourceResolution.width = CGImageGetWidth(sourceImageRef);\n        sourceResolution.height = CGImageGetHeight(sourceImageRef);\n        CGFloat sourceTotalPixels = sourceResolution.width * sourceResolution.height;\n        // Determine the scale ratio to apply to the input image\n        // that results in an output image of the defined size.\n        // see kDestImageSizeMB, and how it relates to destTotalPixels.\n        CGFloat imageScale = sqrt(destTotalPixels / sourceTotalPixels);\n        CGSize destResolution = CGSizeZero;\n        destResolution.width = MAX(1, (int)(sourceResolution.width * imageScale));\n        destResolution.height = MAX(1, (int)(sourceResolution.height * imageScale));\n        \n        // device color space\n        CGColorSpaceRef colorspaceRef = [self colorSpaceGetDeviceRGB];\n        BOOL hasAlpha = [self CGImageContainsAlpha:sourceImageRef];\n        \n        // kCGImageAlphaNone is not supported in CGBitmapContextCreate.\n        // Check #3330 for more detail about why this bitmap is choosen.\n        CGBitmapInfo bitmapInfo;\n        if (hasAlpha) {\n            // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489\n            // BGRA8888\n            bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;\n        } else {\n            // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017\n            // RGB888\n            bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast;\n        }\n        destContext = CGBitmapContextCreate(NULL,\n                                            destResolution.width,\n                                            destResolution.height,\n                                            kBitsPerComponent,\n                                            0,\n                                            colorspaceRef,\n                                            bitmapInfo);\n        \n        if (destContext == NULL) {\n            return image;\n        }\n        CGContextSetInterpolationQuality(destContext, kCGInterpolationHigh);\n        \n        // Now define the size of the rectangle to be used for the\n        // incremental bits from the input image to the output image.\n        // we use a source tile width equal to the width of the source\n        // image due to the way that iOS retrieves image data from disk.\n        // iOS must decode an image from disk in full width 'bands', even\n        // if current graphics context is clipped to a subrect within that\n        // band. Therefore we fully utilize all of the pixel data that results\n        // from a decoding operation by anchoring our tile size to the full\n        // width of the input image.\n        CGRect sourceTile = CGRectZero;\n        sourceTile.size.width = sourceResolution.width;\n        // The source tile height is dynamic. Since we specified the size\n        // of the source tile in MB, see how many rows of pixels high it\n        // can be given the input image width.\n        sourceTile.size.height = MAX(1, (int)(tileTotalPixels / sourceTile.size.width));\n        sourceTile.origin.x = 0.0f;\n        // The output tile is the same proportions as the input tile, but\n        // scaled to image scale.\n        CGRect destTile;\n        destTile.size.width = destResolution.width;\n        destTile.size.height = sourceTile.size.height * imageScale;\n        destTile.origin.x = 0.0f;\n        // The source seem overlap is proportionate to the destination seem overlap.\n        // this is the amount of pixels to overlap each tile as we assemble the output image.\n        float sourceSeemOverlap = (int)((kDestSeemOverlap/destResolution.height)*sourceResolution.height);\n        CGImageRef sourceTileImageRef;\n        // calculate the number of read/write operations required to assemble the\n        // output image.\n        int iterations = (int)( sourceResolution.height / sourceTile.size.height );\n        // If tile height doesn't divide the image height evenly, add another iteration\n        // to account for the remaining pixels.\n        int remainder = (int)sourceResolution.height % (int)sourceTile.size.height;\n        if(remainder) {\n            iterations++;\n        }\n        // Add seem overlaps to the tiles, but save the original tile height for y coordinate calculations.\n        float sourceTileHeightMinusOverlap = sourceTile.size.height;\n        sourceTile.size.height += sourceSeemOverlap;\n        destTile.size.height += kDestSeemOverlap;\n        for( int y = 0; y < iterations; ++y ) {\n            @autoreleasepool {\n                sourceTile.origin.y = y * sourceTileHeightMinusOverlap + sourceSeemOverlap;\n                destTile.origin.y = destResolution.height - (( y + 1 ) * sourceTileHeightMinusOverlap * imageScale + kDestSeemOverlap);\n                sourceTileImageRef = CGImageCreateWithImageInRect( sourceImageRef, sourceTile );\n                if( y == iterations - 1 && remainder ) {\n                    float dify = destTile.size.height;\n                    destTile.size.height = CGImageGetHeight( sourceTileImageRef ) * imageScale;\n                    dify -= destTile.size.height;\n                    destTile.origin.y = MIN(0, destTile.origin.y + dify);\n                }\n                CGContextDrawImage( destContext, destTile, sourceTileImageRef );\n                CGImageRelease( sourceTileImageRef );\n            }\n        }\n        \n        CGImageRef destImageRef = CGBitmapContextCreateImage(destContext);\n        CGContextRelease(destContext);\n        if (destImageRef == NULL) {\n            return image;\n        }\n#if SD_MAC\n        UIImage *destImage = [[UIImage alloc] initWithCGImage:destImageRef scale:image.scale orientation:kCGImagePropertyOrientationUp];\n#else\n        UIImage *destImage = [[UIImage alloc] initWithCGImage:destImageRef scale:image.scale orientation:image.imageOrientation];\n#endif\n        CGImageRelease(destImageRef);\n        if (destImage == nil) {\n            return image;\n        }\n        SDImageCopyAssociatedObject(image, destImage);\n        destImage.sd_isDecoded = YES;\n        return destImage;\n    }\n}\n\n+ (NSUInteger)defaultScaleDownLimitBytes {\n    return kDestImageLimitBytes;\n}\n\n+ (void)setDefaultScaleDownLimitBytes:(NSUInteger)defaultScaleDownLimitBytes {\n    if (defaultScaleDownLimitBytes < kBytesPerPixel) {\n        return;\n    }\n    kDestImageLimitBytes = defaultScaleDownLimitBytes;\n}\n\n#if SD_UIKIT || SD_WATCH\n// Convert an EXIF image orientation to an iOS one.\n+ (UIImageOrientation)imageOrientationFromEXIFOrientation:(CGImagePropertyOrientation)exifOrientation {\n    UIImageOrientation imageOrientation = UIImageOrientationUp;\n    switch (exifOrientation) {\n        case kCGImagePropertyOrientationUp:\n            imageOrientation = UIImageOrientationUp;\n            break;\n        case kCGImagePropertyOrientationDown:\n            imageOrientation = UIImageOrientationDown;\n            break;\n        case kCGImagePropertyOrientationLeft:\n            imageOrientation = UIImageOrientationLeft;\n            break;\n        case kCGImagePropertyOrientationRight:\n            imageOrientation = UIImageOrientationRight;\n            break;\n        case kCGImagePropertyOrientationUpMirrored:\n            imageOrientation = UIImageOrientationUpMirrored;\n            break;\n        case kCGImagePropertyOrientationDownMirrored:\n            imageOrientation = UIImageOrientationDownMirrored;\n            break;\n        case kCGImagePropertyOrientationLeftMirrored:\n            imageOrientation = UIImageOrientationLeftMirrored;\n            break;\n        case kCGImagePropertyOrientationRightMirrored:\n            imageOrientation = UIImageOrientationRightMirrored;\n            break;\n        default:\n            break;\n    }\n    return imageOrientation;\n}\n\n// Convert an iOS orientation to an EXIF image orientation.\n+ (CGImagePropertyOrientation)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation {\n    CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp;\n    switch (imageOrientation) {\n        case UIImageOrientationUp:\n            exifOrientation = kCGImagePropertyOrientationUp;\n            break;\n        case UIImageOrientationDown:\n            exifOrientation = kCGImagePropertyOrientationDown;\n            break;\n        case UIImageOrientationLeft:\n            exifOrientation = kCGImagePropertyOrientationLeft;\n            break;\n        case UIImageOrientationRight:\n            exifOrientation = kCGImagePropertyOrientationRight;\n            break;\n        case UIImageOrientationUpMirrored:\n            exifOrientation = kCGImagePropertyOrientationUpMirrored;\n            break;\n        case UIImageOrientationDownMirrored:\n            exifOrientation = kCGImagePropertyOrientationDownMirrored;\n            break;\n        case UIImageOrientationLeftMirrored:\n            exifOrientation = kCGImagePropertyOrientationLeftMirrored;\n            break;\n        case UIImageOrientationRightMirrored:\n            exifOrientation = kCGImagePropertyOrientationRightMirrored;\n            break;\n        default:\n            break;\n    }\n    return exifOrientation;\n}\n#endif\n\n#pragma mark - Helper Function\n+ (BOOL)shouldDecodeImage:(nullable UIImage *)image {\n    // Prevent \"CGBitmapContextCreateImage: invalid context 0x0\" error\n    if (image == nil) {\n        return NO;\n    }\n    // Avoid extra decode\n    if (image.sd_isDecoded) {\n        return NO;\n    }\n    // do not decode animated images\n    if (image.sd_isAnimated) {\n        return NO;\n    }\n    // do not decode vector images\n    if (image.sd_isVector) {\n        return NO;\n    }\n    \n    return YES;\n}\n\n+ (BOOL)shouldScaleDownImage:(nonnull UIImage *)image limitBytes:(NSUInteger)bytes {\n    BOOL shouldScaleDown = YES;\n    \n    CGImageRef sourceImageRef = image.CGImage;\n    CGSize sourceResolution = CGSizeZero;\n    sourceResolution.width = CGImageGetWidth(sourceImageRef);\n    sourceResolution.height = CGImageGetHeight(sourceImageRef);\n    float sourceTotalPixels = sourceResolution.width * sourceResolution.height;\n    if (sourceTotalPixels <= 0) {\n        return NO;\n    }\n    CGFloat destTotalPixels;\n    if (bytes == 0) {\n        bytes = [self defaultScaleDownLimitBytes];\n    }\n    bytes = MAX(bytes, kBytesPerPixel);\n    destTotalPixels = bytes / kBytesPerPixel;\n    float imageScale = destTotalPixels / sourceTotalPixels;\n    if (imageScale < 1) {\n        shouldScaleDown = YES;\n    } else {\n        shouldScaleDown = NO;\n    }\n    \n    return shouldScaleDown;\n}\n\nstatic inline CGAffineTransform SDCGContextTransformFromOrientation(CGImagePropertyOrientation orientation, CGSize size) {\n    // Inspiration from @libfeihu\n    // We need to calculate the proper transformation to make the image upright.\n    // We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored.\n    CGAffineTransform transform = CGAffineTransformIdentity;\n    \n    switch (orientation) {\n        case kCGImagePropertyOrientationDown:\n        case kCGImagePropertyOrientationDownMirrored:\n            transform = CGAffineTransformTranslate(transform, size.width, size.height);\n            transform = CGAffineTransformRotate(transform, M_PI);\n            break;\n            \n        case kCGImagePropertyOrientationLeft:\n        case kCGImagePropertyOrientationLeftMirrored:\n            transform = CGAffineTransformTranslate(transform, size.width, 0);\n            transform = CGAffineTransformRotate(transform, M_PI_2);\n            break;\n            \n        case kCGImagePropertyOrientationRight:\n        case kCGImagePropertyOrientationRightMirrored:\n            transform = CGAffineTransformTranslate(transform, 0, size.height);\n            transform = CGAffineTransformRotate(transform, -M_PI_2);\n            break;\n        case kCGImagePropertyOrientationUp:\n        case kCGImagePropertyOrientationUpMirrored:\n            break;\n    }\n    \n    switch (orientation) {\n        case kCGImagePropertyOrientationUpMirrored:\n        case kCGImagePropertyOrientationDownMirrored:\n            transform = CGAffineTransformTranslate(transform, size.width, 0);\n            transform = CGAffineTransformScale(transform, -1, 1);\n            break;\n            \n        case kCGImagePropertyOrientationLeftMirrored:\n        case kCGImagePropertyOrientationRightMirrored:\n            transform = CGAffineTransformTranslate(transform, size.height, 0);\n            transform = CGAffineTransformScale(transform, -1, 1);\n            break;\n        case kCGImagePropertyOrientationUp:\n        case kCGImagePropertyOrientationDown:\n        case kCGImagePropertyOrientationLeft:\n        case kCGImagePropertyOrientationRight:\n            break;\n    }\n    \n    return transform;\n}\n\n#if SD_UIKIT || SD_WATCH\nstatic NSUInteger gcd(NSUInteger a, NSUInteger b) {\n    NSUInteger c;\n    while (a != 0) {\n        c = a;\n        a = b % a;\n        b = c;\n    }\n    return b;\n}\n\nstatic NSUInteger gcdArray(size_t const count, NSUInteger const * const values) {\n    if (count == 0) {\n        return 0;\n    }\n    NSUInteger result = values[0];\n    for (size_t i = 1; i < count; ++i) {\n        result = gcd(values[i], result);\n    }\n    return result;\n}\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDImageCoder.h\"\n\n/**\n Global object holding the array of coders, so that we avoid passing them from object to object.\n Uses a priority queue behind scenes, which means the latest added coders have the highest priority.\n This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data.\n That way, users can add their custom coders while preserving our existing prebuilt ones\n \n Note: the `coders` getter will return the coders in their reversed order\n Example:\n - by default we internally set coders = `IOCoder`, `GIFCoder`, `APNGCoder`\n - calling `coders` will return `@[IOCoder, GIFCoder, APNGCoder]`\n - call `[addCoder:[MyCrazyCoder new]]`\n - calling `coders` now returns `@[IOCoder, GIFCoder, APNGCoder, MyCrazyCoder]`\n \n Coders\n ------\n A coder must conform to the `SDImageCoder` protocol or even to `SDProgressiveImageCoder` if it supports progressive decoding\n Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat`\n Those methods are called on each coder in the array (using the priority order) until one of them returns YES.\n That means that coder can decode that data / encode to that format\n */\n@interface SDImageCodersManager : NSObject <SDImageCoder>\n\n/**\n Returns the global shared coders manager instance.\n */\n@property (nonatomic, class, readonly, nonnull) SDImageCodersManager *sharedManager;\n\n/**\n All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority\n */\n@property (nonatomic, copy, nullable) NSArray<id<SDImageCoder>> *coders;\n\n/**\n Add a new coder to the end of coders array. Which has the highest priority.\n\n @param coder coder\n */\n- (void)addCoder:(nonnull id<SDImageCoder>)coder;\n\n/**\n Remove a coder in the coders array.\n\n @param coder coder\n */\n- (void)removeCoder:(nonnull id<SDImageCoder>)coder;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCodersManager.h\"\n#import \"SDImageIOCoder.h\"\n#import \"SDImageGIFCoder.h\"\n#import \"SDImageAPNGCoder.h\"\n#import \"SDImageHEICCoder.h\"\n#import \"SDInternalMacros.h\"\n\n@interface SDImageCodersManager ()\n\n@property (nonatomic, strong, nonnull) NSMutableArray<id<SDImageCoder>> *imageCoders;\n\n@end\n\n@implementation SDImageCodersManager {\n    SD_LOCK_DECLARE(_codersLock);\n}\n\n+ (nonnull instancetype)sharedManager {\n    static dispatch_once_t once;\n    static id instance;\n    dispatch_once(&once, ^{\n        instance = [self new];\n    });\n    return instance;\n}\n\n- (instancetype)init {\n    if (self = [super init]) {\n        // initialize with default coders\n        _imageCoders = [NSMutableArray arrayWithArray:@[[SDImageIOCoder sharedCoder], [SDImageGIFCoder sharedCoder], [SDImageAPNGCoder sharedCoder]]];\n        SD_LOCK_INIT(_codersLock);\n    }\n    return self;\n}\n\n- (NSArray<id<SDImageCoder>> *)coders {\n    SD_LOCK(_codersLock);\n    NSArray<id<SDImageCoder>> *coders = [_imageCoders copy];\n    SD_UNLOCK(_codersLock);\n    return coders;\n}\n\n- (void)setCoders:(NSArray<id<SDImageCoder>> *)coders {\n    SD_LOCK(_codersLock);\n    [_imageCoders removeAllObjects];\n    if (coders.count) {\n        [_imageCoders addObjectsFromArray:coders];\n    }\n    SD_UNLOCK(_codersLock);\n}\n\n#pragma mark - Coder IO operations\n\n- (void)addCoder:(nonnull id<SDImageCoder>)coder {\n    if (![coder conformsToProtocol:@protocol(SDImageCoder)]) {\n        return;\n    }\n    SD_LOCK(_codersLock);\n    [_imageCoders addObject:coder];\n    SD_UNLOCK(_codersLock);\n}\n\n- (void)removeCoder:(nonnull id<SDImageCoder>)coder {\n    if (![coder conformsToProtocol:@protocol(SDImageCoder)]) {\n        return;\n    }\n    SD_LOCK(_codersLock);\n    [_imageCoders removeObject:coder];\n    SD_UNLOCK(_codersLock);\n}\n\n#pragma mark - SDImageCoder\n- (BOOL)canDecodeFromData:(NSData *)data {\n    NSArray<id<SDImageCoder>> *coders = self.coders;\n    for (id<SDImageCoder> coder in coders.reverseObjectEnumerator) {\n        if ([coder canDecodeFromData:data]) {\n            return YES;\n        }\n    }\n    return NO;\n}\n\n- (BOOL)canEncodeToFormat:(SDImageFormat)format {\n    NSArray<id<SDImageCoder>> *coders = self.coders;\n    for (id<SDImageCoder> coder in coders.reverseObjectEnumerator) {\n        if ([coder canEncodeToFormat:format]) {\n            return YES;\n        }\n    }\n    return NO;\n}\n\n- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options {\n    if (!data) {\n        return nil;\n    }\n    UIImage *image;\n    NSArray<id<SDImageCoder>> *coders = self.coders;\n    for (id<SDImageCoder> coder in coders.reverseObjectEnumerator) {\n        if ([coder canDecodeFromData:data]) {\n            image = [coder decodedImageWithData:data options:options];\n            break;\n        }\n    }\n    \n    return image;\n}\n\n- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options {\n    if (!image) {\n        return nil;\n    }\n    NSArray<id<SDImageCoder>> *coders = self.coders;\n    for (id<SDImageCoder> coder in coders.reverseObjectEnumerator) {\n        if ([coder canEncodeToFormat:format]) {\n            return [coder encodedDataWithImage:image format:format options:options];\n        }\n    }\n    return nil;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/**\n This class is used for creating animated images via `animatedImageWithFrames` in `SDImageCoderHelper`.\n @note If you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+Metadata.h`.\n */\n@interface SDImageFrame : NSObject\n\n/**\n The image of current frame. You should not set an animated image.\n */\n@property (nonatomic, strong, readonly, nonnull) UIImage *image;\n/**\n The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero.\n */\n@property (nonatomic, readonly, assign) NSTimeInterval duration;\n\n/**\n Create a frame instance with specify image and duration\n\n @param image current frame's image\n @param duration current frame's duration\n @return frame instance\n */\n+ (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageFrame.h\"\n\n@interface SDImageFrame ()\n\n@property (nonatomic, strong, readwrite, nonnull) UIImage *image;\n@property (nonatomic, readwrite, assign) NSTimeInterval duration;\n\n@end\n\n@implementation SDImageFrame\n\n+ (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration {\n    SDImageFrame *frame = [[SDImageFrame alloc] init];\n    frame.image = image;\n    frame.duration = duration;\n    \n    return frame;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDImageIOAnimatedCoder.h\"\n\n/**\n Built in coder using ImageIO that supports animated GIF encoding/decoding\n @note `SDImageIOCoder` supports GIF but only as static (will use the 1st frame).\n @note Use `SDImageGIFCoder` for fully animated GIFs. For `UIImageView`, it will produce animated `UIImage`(`NSImage` on macOS) for rendering. For `SDAnimatedImageView`, it will use `SDAnimatedImage` for rendering.\n @note The recommended approach for animated GIFs is using `SDAnimatedImage` with `SDAnimatedImageView`. It's more performant than `UIImageView` for GIF displaying(especially on memory usage)\n */\n@interface SDImageGIFCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>\n\n@property (nonatomic, class, readonly, nonnull) SDImageGIFCoder *sharedCoder;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageGIFCoder.h\"\n#import \"SDImageIOAnimatedCoderInternal.h\"\n#if SD_MAC\n#import <CoreServices/CoreServices.h>\n#else\n#import <MobileCoreServices/MobileCoreServices.h>\n#endif\n\n@implementation SDImageGIFCoder\n\n+ (instancetype)sharedCoder {\n    static SDImageGIFCoder *coder;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        coder = [[SDImageGIFCoder alloc] init];\n    });\n    return coder;\n}\n\n#pragma mark - Subclass Override\n\n+ (SDImageFormat)imageFormat {\n    return SDImageFormatGIF;\n}\n\n+ (NSString *)imageUTType {\n    return (__bridge NSString *)kSDUTTypeGIF;\n}\n\n+ (NSString *)dictionaryProperty {\n    return (__bridge NSString *)kCGImagePropertyGIFDictionary;\n}\n\n+ (NSString *)unclampedDelayTimeProperty {\n    return (__bridge NSString *)kCGImagePropertyGIFUnclampedDelayTime;\n}\n\n+ (NSString *)delayTimeProperty {\n    return (__bridge NSString *)kCGImagePropertyGIFDelayTime;\n}\n\n+ (NSString *)loopCountProperty {\n    return (__bridge NSString *)kCGImagePropertyGIFLoopCount;\n}\n\n+ (NSUInteger)defaultLoopCount {\n    return 1;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import <CoreGraphics/CoreGraphics.h>\n\n/**\n These following graphics context method are provided to easily write cross-platform(AppKit/UIKit) code.\n For UIKit, these methods just call the same method in `UIGraphics.h`. See the documentation for usage.\n For AppKit, these methods use `NSGraphicsContext` to create image context and match the behavior like UIKit.\n @note If you don't care bitmap format (ARGB8888) and just draw image, use `SDGraphicsImageRenderer` instead. It's more performant on RAM usage.`\n */\n\n/// Returns the current graphics context.\nFOUNDATION_EXPORT CGContextRef __nullable SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED;\n/// Creates a bitmap-based graphics context and makes it the current context.\nFOUNDATION_EXPORT void SDGraphicsBeginImageContext(CGSize size);\n/// Creates a bitmap-based graphics context with the specified options.\nFOUNDATION_EXPORT void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale);\n/// Removes the current bitmap-based graphics context from the top of the stack.\nFOUNDATION_EXPORT void SDGraphicsEndImageContext(void);\n/// Returns an image based on the contents of the current bitmap-based graphics context.\nFOUNDATION_EXPORT UIImage * __nullable SDGraphicsGetImageFromCurrentImageContext(void);\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageGraphics.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"objc/runtime.h\"\n\n#if SD_MAC\nstatic void *kNSGraphicsContextScaleFactorKey;\n\nstatic CGContextRef SDCGContextCreateBitmapContext(CGSize size, BOOL opaque, CGFloat scale) {\n    if (scale == 0) {\n        // Match `UIGraphicsBeginImageContextWithOptions`, reset to the scale factor of the device’s main screen if scale is 0.\n        scale = [NSScreen mainScreen].backingScaleFactor;\n    }\n    size_t width = ceil(size.width * scale);\n    size_t height = ceil(size.height * scale);\n    if (width < 1 || height < 1) return NULL;\n    \n    CGColorSpaceRef space = [SDImageCoderHelper colorSpaceGetDeviceRGB];\n    // kCGImageAlphaNone is not supported in CGBitmapContextCreate.\n    // Check #3330 for more detail about why this bitmap is choosen.\n    CGBitmapInfo bitmapInfo;\n    if (!opaque) {\n        // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489\n        // BGRA8888\n        bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst;\n    } else {\n        // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017\n        // RGB888\n        bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast;\n    }\n    CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, space, bitmapInfo);\n    if (!context) {\n        return NULL;\n    }\n    CGContextScaleCTM(context, scale, scale);\n    \n    return context;\n}\n#endif\n\nCGContextRef SDGraphicsGetCurrentContext(void) {\n#if SD_UIKIT || SD_WATCH\n    return UIGraphicsGetCurrentContext();\n#else\n    return NSGraphicsContext.currentContext.CGContext;\n#endif\n}\n\nvoid SDGraphicsBeginImageContext(CGSize size) {\n#if SD_UIKIT || SD_WATCH\n    UIGraphicsBeginImageContext(size);\n#else\n    SDGraphicsBeginImageContextWithOptions(size, NO, 1.0);\n#endif\n}\n\nvoid SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) {\n#if SD_UIKIT || SD_WATCH\n    UIGraphicsBeginImageContextWithOptions(size, opaque, scale);\n#else\n    CGContextRef context = SDCGContextCreateBitmapContext(size, opaque, scale);\n    if (!context) {\n        return;\n    }\n    NSGraphicsContext *graphicsContext = [NSGraphicsContext graphicsContextWithCGContext:context flipped:NO];\n    objc_setAssociatedObject(graphicsContext, &kNSGraphicsContextScaleFactorKey, @(scale), OBJC_ASSOCIATION_RETAIN);\n    CGContextRelease(context);\n    [NSGraphicsContext saveGraphicsState];\n    NSGraphicsContext.currentContext = graphicsContext;\n#endif\n}\n\nvoid SDGraphicsEndImageContext(void) {\n#if SD_UIKIT || SD_WATCH\n    UIGraphicsEndImageContext();\n#else\n    [NSGraphicsContext restoreGraphicsState];\n#endif\n}\n\nUIImage * SDGraphicsGetImageFromCurrentImageContext(void) {\n#if SD_UIKIT || SD_WATCH\n    return UIGraphicsGetImageFromCurrentImageContext();\n#else\n    NSGraphicsContext *context = NSGraphicsContext.currentContext;\n    CGContextRef contextRef = context.CGContext;\n    if (!contextRef) {\n        return nil;\n    }\n    CGImageRef imageRef = CGBitmapContextCreateImage(contextRef);\n    if (!imageRef) {\n        return nil;\n    }\n    CGFloat scale = 0;\n    NSNumber *scaleFactor = objc_getAssociatedObject(context, &kNSGraphicsContextScaleFactorKey);\n    if ([scaleFactor isKindOfClass:[NSNumber class]]) {\n        scale = scaleFactor.doubleValue;\n    }\n    if (!scale) {\n        // reset to the scale factor of the device’s main screen if scale is 0.\n        scale = [NSScreen mainScreen].backingScaleFactor;\n    }\n    NSImage *image = [[NSImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp];\n    CGImageRelease(imageRef);\n    return image;\n#endif\n}\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import \"SDImageIOAnimatedCoder.h\"\n\n/**\n This coder is used for HEIC (HEIF with HEVC container codec) image format.\n Image/IO provide the static HEIC (.heic) support in iOS 11/macOS 10.13/tvOS 11/watchOS 4+.\n Image/IO provide the animated HEIC (.heics) support in iOS 13/macOS 10.15/tvOS 13/watchOS 6+.\n See https://nokiatech.github.io/heif/technical.html for the standard.\n @note This coder is not in the default coder list for now, since HEIC animated image is really rare, and Apple's implementation still contains performance issues. You can enable if you need this.\n @note If you need to support lower firmware version for HEIF, you can have a try at https://github.com/SDWebImage/SDWebImageHEIFCoder\n */\nAPI_AVAILABLE(ios(13.0), tvos(13.0), macos(10.15), watchos(6.0))\n@interface SDImageHEICCoder : SDImageIOAnimatedCoder <SDProgressiveImageCoder, SDAnimatedImageCoder>\n\n@property (nonatomic, class, readonly, nonnull) SDImageHEICCoder *sharedCoder;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDImageHEICCoder.h\"\n#import \"SDImageIOAnimatedCoderInternal.h\"\n\n// These constants are available from iOS 13+ and Xcode 11. This raw value is used for toolchain and firmware compatibility\nstatic NSString * kSDCGImagePropertyHEICSDictionary = @\"{HEICS}\";\nstatic NSString * kSDCGImagePropertyHEICSLoopCount = @\"LoopCount\";\nstatic NSString * kSDCGImagePropertyHEICSDelayTime = @\"DelayTime\";\nstatic NSString * kSDCGImagePropertyHEICSUnclampedDelayTime = @\"UnclampedDelayTime\";\n\n@implementation SDImageHEICCoder\n\n+ (void)initialize {\n    if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) {\n        // Use SDK instead of raw value\n        kSDCGImagePropertyHEICSDictionary = (__bridge NSString *)kCGImagePropertyHEICSDictionary;\n        kSDCGImagePropertyHEICSLoopCount = (__bridge NSString *)kCGImagePropertyHEICSLoopCount;\n        kSDCGImagePropertyHEICSDelayTime = (__bridge NSString *)kCGImagePropertyHEICSDelayTime;\n        kSDCGImagePropertyHEICSUnclampedDelayTime = (__bridge NSString *)kCGImagePropertyHEICSUnclampedDelayTime;\n    }\n}\n\n+ (instancetype)sharedCoder {\n    static SDImageHEICCoder *coder;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        coder = [[SDImageHEICCoder alloc] init];\n    });\n    return coder;\n}\n\n#pragma mark - SDImageCoder\n\n- (BOOL)canDecodeFromData:(nullable NSData *)data {\n    switch ([NSData sd_imageFormatForImageData:data]) {\n        case SDImageFormatHEIC:\n            // Check HEIC decoding compatibility\n            return [self.class canDecodeFromFormat:SDImageFormatHEIC];\n        case SDImageFormatHEIF:\n            // Check HEIF decoding compatibility\n            return [self.class canDecodeFromFormat:SDImageFormatHEIF];\n        default:\n            return NO;\n    }\n}\n\n- (BOOL)canIncrementalDecodeFromData:(NSData *)data {\n    return [self canDecodeFromData:data];\n}\n\n- (BOOL)canEncodeToFormat:(SDImageFormat)format {\n    switch (format) {\n        case SDImageFormatHEIC:\n            // Check HEIC encoding compatibility\n            return [self.class canEncodeToFormat:SDImageFormatHEIC];\n        case SDImageFormatHEIF:\n            // Check HEIF encoding compatibility\n            return [self.class canEncodeToFormat:SDImageFormatHEIF];\n        default:\n            return NO;\n    }\n}\n\n#pragma mark - Subclass Override\n\n+ (SDImageFormat)imageFormat {\n    return SDImageFormatHEIC;\n}\n\n+ (NSString *)imageUTType {\n    return (__bridge NSString *)kSDUTTypeHEIC;\n}\n\n+ (NSString *)dictionaryProperty {\n    return kSDCGImagePropertyHEICSDictionary;\n}\n\n+ (NSString *)unclampedDelayTimeProperty {\n    return kSDCGImagePropertyHEICSUnclampedDelayTime;\n}\n\n+ (NSString *)delayTimeProperty {\n    return kSDCGImagePropertyHEICSDelayTime;\n}\n\n+ (NSString *)loopCountProperty {\n    return kSDCGImagePropertyHEICSLoopCount;\n}\n\n+ (NSUInteger)defaultLoopCount {\n    return 0;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import <ImageIO/ImageIO.h>\n#import \"SDImageCoder.h\"\n\n/**\n This is the abstract class for all animated coder, which use the Image/IO API. You can not use this directly as real coders. A exception will be raised if you use this class.\n All of the properties need the subclass to implement and works as expected.\n For Image/IO, See Apple's documentation: https://developer.apple.com/documentation/imageio\n */\n@interface SDImageIOAnimatedCoder : NSObject <SDProgressiveImageCoder, SDAnimatedImageCoder>\n\n#pragma mark - Subclass Override\n/**\n The supported animated image format. Such as `SDImageFormatGIF`.\n @note Subclass override.\n */\n@property (class, readonly) SDImageFormat imageFormat;\n/**\n The supported image format UTI Type. Such as `kSDUTTypeGIF`.\n This can be used for cases when we can not detect `SDImageFormat. Such as progressive decoding's hint format `kCGImageSourceTypeIdentifierHint`.\n @note Subclass override.\n */\n@property (class, readonly, nonnull) NSString *imageUTType;\n/**\n The image container property key used in Image/IO API. Such as `kCGImagePropertyGIFDictionary`.\n @note Subclass override.\n */\n@property (class, readonly, nonnull) NSString *dictionaryProperty;\n/**\n The image unclamped delay time property key used in Image/IO  API. Such as `kCGImagePropertyGIFUnclampedDelayTime`\n @note Subclass override.\n */\n@property (class, readonly, nonnull) NSString *unclampedDelayTimeProperty;\n/**\n The image delay time property key used in Image/IO API. Such as `kCGImagePropertyGIFDelayTime`.\n @note Subclass override.\n */\n@property (class, readonly, nonnull) NSString *delayTimeProperty;\n/**\n The image loop count property key used in Image/IO API. Such as `kCGImagePropertyGIFLoopCount`.\n @note Subclass override.\n */\n@property (class, readonly, nonnull) NSString *loopCountProperty;\n/**\n The default loop count when there are no any loop count information inside image container metadata.\n For example, for GIF format, the standard use 1 (play once). For APNG format, the standard use 0 (infinity loop).\n @note Subclass override.\n */\n@property (class, readonly) NSUInteger defaultLoopCount;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDImageIOAnimatedCoder.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"UIImage+Metadata.h\"\n#import \"NSData+ImageContentType.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"SDAnimatedImageRep.h\"\n#import \"UIImage+ForceDecode.h\"\n\n// Specify DPI for vector format in CGImageSource, like PDF\nstatic NSString * kSDCGImageSourceRasterizationDPI = @\"kCGImageSourceRasterizationDPI\";\n// Specify File Size for lossy format encoding, like JPEG\nstatic NSString * kSDCGImageDestinationRequestedFileSize = @\"kCGImageDestinationRequestedFileSize\";\n\n@interface SDImageIOCoderFrame : NSObject\n\n@property (nonatomic, assign) NSUInteger index; // Frame index (zero based)\n@property (nonatomic, assign) NSTimeInterval duration; // Frame duration in seconds\n\n@end\n\n@implementation SDImageIOCoderFrame\n@end\n\n@implementation SDImageIOAnimatedCoder {\n    size_t _width, _height;\n    CGImageSourceRef _imageSource;\n    NSData *_imageData;\n    CGFloat _scale;\n    NSUInteger _loopCount;\n    NSUInteger _frameCount;\n    NSArray<SDImageIOCoderFrame *> *_frames;\n    BOOL _finished;\n    BOOL _preserveAspectRatio;\n    CGSize _thumbnailSize;\n}\n\n- (void)dealloc\n{\n    if (_imageSource) {\n        CFRelease(_imageSource);\n        _imageSource = NULL;\n    }\n#if SD_UIKIT\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n}\n\n- (void)didReceiveMemoryWarning:(NSNotification *)notification\n{\n    if (_imageSource) {\n        for (size_t i = 0; i < _frameCount; i++) {\n            CGImageSourceRemoveCacheAtIndex(_imageSource, i);\n        }\n    }\n}\n\n#pragma mark - Subclass Override\n\n+ (SDImageFormat)imageFormat {\n    @throw [NSException exceptionWithName:NSInternalInconsistencyException\n                                   reason:[NSString stringWithFormat:@\"For `SDImageIOAnimatedCoder` subclass, you must override %@ method\", NSStringFromSelector(_cmd)]\n                                 userInfo:nil];\n}\n\n+ (NSString *)imageUTType {\n    @throw [NSException exceptionWithName:NSInternalInconsistencyException\n                                   reason:[NSString stringWithFormat:@\"For `SDImageIOAnimatedCoder` subclass, you must override %@ method\", NSStringFromSelector(_cmd)]\n                                 userInfo:nil];\n}\n\n+ (NSString *)dictionaryProperty {\n    @throw [NSException exceptionWithName:NSInternalInconsistencyException\n                                   reason:[NSString stringWithFormat:@\"For `SDImageIOAnimatedCoder` subclass, you must override %@ method\", NSStringFromSelector(_cmd)]\n                                 userInfo:nil];\n}\n\n+ (NSString *)unclampedDelayTimeProperty {\n    @throw [NSException exceptionWithName:NSInternalInconsistencyException\n                                   reason:[NSString stringWithFormat:@\"For `SDImageIOAnimatedCoder` subclass, you must override %@ method\", NSStringFromSelector(_cmd)]\n                                 userInfo:nil];\n}\n\n+ (NSString *)delayTimeProperty {\n    @throw [NSException exceptionWithName:NSInternalInconsistencyException\n                                   reason:[NSString stringWithFormat:@\"For `SDImageIOAnimatedCoder` subclass, you must override %@ method\", NSStringFromSelector(_cmd)]\n                                 userInfo:nil];\n}\n\n+ (NSString *)loopCountProperty {\n    @throw [NSException exceptionWithName:NSInternalInconsistencyException\n                                   reason:[NSString stringWithFormat:@\"For `SDImageIOAnimatedCoder` subclass, you must override %@ method\", NSStringFromSelector(_cmd)]\n                                 userInfo:nil];\n}\n\n+ (NSUInteger)defaultLoopCount {\n    @throw [NSException exceptionWithName:NSInternalInconsistencyException\n                                   reason:[NSString stringWithFormat:@\"For `SDImageIOAnimatedCoder` subclass, you must override %@ method\", NSStringFromSelector(_cmd)]\n                                 userInfo:nil];\n}\n\n#pragma mark - Utils\n\n+ (BOOL)canDecodeFromFormat:(SDImageFormat)format {\n    static dispatch_once_t onceToken;\n    static NSSet *imageUTTypeSet;\n    dispatch_once(&onceToken, ^{\n        NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageSourceCopyTypeIdentifiers();\n        imageUTTypeSet = [NSSet setWithArray:imageUTTypes];\n    });\n    CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format];\n    if ([imageUTTypeSet containsObject:(__bridge NSString *)(imageUTType)]) {\n        // Can decode from target format\n        return YES;\n    }\n    return NO;\n}\n\n+ (BOOL)canEncodeToFormat:(SDImageFormat)format {\n    static dispatch_once_t onceToken;\n    static NSSet *imageUTTypeSet;\n    dispatch_once(&onceToken, ^{\n        NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageDestinationCopyTypeIdentifiers();\n        imageUTTypeSet = [NSSet setWithArray:imageUTTypes];\n    });\n    CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format];\n    if ([imageUTTypeSet containsObject:(__bridge NSString *)(imageUTType)]) {\n        // Can encode to target format\n        return YES;\n    }\n    return NO;\n}\n\n+ (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source {\n    NSUInteger loopCount = self.defaultLoopCount;\n    NSDictionary *imageProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(source, NULL);\n    NSDictionary *containerProperties = imageProperties[self.dictionaryProperty];\n    if (containerProperties) {\n        NSNumber *containerLoopCount = containerProperties[self.loopCountProperty];\n        if (containerLoopCount != nil) {\n            loopCount = containerLoopCount.unsignedIntegerValue;\n        }\n    }\n    return loopCount;\n}\n\n+ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source {\n    NSDictionary *options = @{\n        (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES),\n        (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage\n    };\n    NSTimeInterval frameDuration = 0.1;\n    CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options);\n    if (!cfFrameProperties) {\n        return frameDuration;\n    }\n    NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties;\n    NSDictionary *containerProperties = frameProperties[self.dictionaryProperty];\n    \n    NSNumber *delayTimeUnclampedProp = containerProperties[self.unclampedDelayTimeProperty];\n    if (delayTimeUnclampedProp != nil) {\n        frameDuration = [delayTimeUnclampedProp doubleValue];\n    } else {\n        NSNumber *delayTimeProp = containerProperties[self.delayTimeProperty];\n        if (delayTimeProp != nil) {\n            frameDuration = [delayTimeProp doubleValue];\n        }\n    }\n    \n    // Many annoying ads specify a 0 duration to make an image flash as quickly as possible.\n    // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify\n    // a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082>\n    // for more information.\n    \n    if (frameDuration < 0.011) {\n        frameDuration = 0.1;\n    }\n    \n    CFRelease(cfFrameProperties);\n    return frameDuration;\n}\n\n+ (UIImage *)createFrameAtIndex:(NSUInteger)index source:(CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize options:(NSDictionary *)options {\n    // Some options need to pass to `CGImageSourceCopyPropertiesAtIndex` before `CGImageSourceCreateImageAtIndex`, or ImageIO will ignore them because they parse once :)\n    // Parse the image properties\n    NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options);\n    CGFloat pixelWidth = [properties[(__bridge NSString *)kCGImagePropertyPixelWidth] doubleValue];\n    CGFloat pixelHeight = [properties[(__bridge NSString *)kCGImagePropertyPixelHeight] doubleValue];\n    CGImagePropertyOrientation exifOrientation = (CGImagePropertyOrientation)[properties[(__bridge NSString *)kCGImagePropertyOrientation] unsignedIntegerValue];\n    if (!exifOrientation) {\n        exifOrientation = kCGImagePropertyOrientationUp;\n    }\n    \n    CFStringRef uttype = CGImageSourceGetType(source);\n    // Check vector format\n    BOOL isVector = NO;\n    if ([NSData sd_imageFormatFromUTType:uttype] == SDImageFormatPDF) {\n        isVector = YES;\n    }\n\n    NSMutableDictionary *decodingOptions;\n    if (options) {\n        decodingOptions = [NSMutableDictionary dictionaryWithDictionary:options];\n    } else {\n        decodingOptions = [NSMutableDictionary dictionary];\n    }\n    CGImageRef imageRef;\n    BOOL createFullImage = thumbnailSize.width == 0 || thumbnailSize.height == 0 || pixelWidth == 0 || pixelHeight == 0 || (pixelWidth <= thumbnailSize.width && pixelHeight <= thumbnailSize.height);\n    if (createFullImage) {\n        if (isVector) {\n            if (thumbnailSize.width == 0 || thumbnailSize.height == 0) {\n                // Provide the default pixel count for vector images, simply just use the screen size\n#if SD_WATCH\n                thumbnailSize = WKInterfaceDevice.currentDevice.screenBounds.size;\n#elif SD_UIKIT\n                thumbnailSize = UIScreen.mainScreen.bounds.size;\n#elif SD_MAC\n                thumbnailSize = NSScreen.mainScreen.frame.size;\n#endif\n            }\n            CGFloat maxPixelSize = MAX(thumbnailSize.width, thumbnailSize.height);\n            NSUInteger DPIPerPixel = 2;\n            NSUInteger rasterizationDPI = maxPixelSize * DPIPerPixel;\n            decodingOptions[kSDCGImageSourceRasterizationDPI] = @(rasterizationDPI);\n        }\n        imageRef = CGImageSourceCreateImageAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]);\n    } else {\n        decodingOptions[(__bridge NSString *)kCGImageSourceCreateThumbnailWithTransform] = @(preserveAspectRatio);\n        CGFloat maxPixelSize;\n        if (preserveAspectRatio) {\n            CGFloat pixelRatio = pixelWidth / pixelHeight;\n            CGFloat thumbnailRatio = thumbnailSize.width / thumbnailSize.height;\n            if (pixelRatio > thumbnailRatio) {\n                maxPixelSize = thumbnailSize.width;\n            } else {\n                maxPixelSize = thumbnailSize.height;\n            }\n        } else {\n            maxPixelSize = MAX(thumbnailSize.width, thumbnailSize.height);\n        }\n        decodingOptions[(__bridge NSString *)kCGImageSourceThumbnailMaxPixelSize] = @(maxPixelSize);\n        decodingOptions[(__bridge NSString *)kCGImageSourceCreateThumbnailFromImageAlways] = @(YES);\n        imageRef = CGImageSourceCreateThumbnailAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]);\n    }\n    if (!imageRef) {\n        return nil;\n    }\n    // Thumbnail image post-process\n    if (!createFullImage) {\n        if (preserveAspectRatio) {\n            // kCGImageSourceCreateThumbnailWithTransform will apply EXIF transform as well, we should not apply twice\n            exifOrientation = kCGImagePropertyOrientationUp;\n        } else {\n            // `CGImageSourceCreateThumbnailAtIndex` take only pixel dimension, if not `preserveAspectRatio`, we should manual scale to the target size\n            CGImageRef scaledImageRef = [SDImageCoderHelper CGImageCreateScaled:imageRef size:thumbnailSize];\n            CGImageRelease(imageRef);\n            imageRef = scaledImageRef;\n        }\n    }\n    \n#if SD_UIKIT || SD_WATCH\n    UIImageOrientation imageOrientation = [SDImageCoderHelper imageOrientationFromEXIFOrientation:exifOrientation];\n    UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:imageOrientation];\n#else\n    UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:exifOrientation];\n#endif\n    CGImageRelease(imageRef);\n    return image;\n}\n\n#pragma mark - Decode\n- (BOOL)canDecodeFromData:(nullable NSData *)data {\n    return ([NSData sd_imageFormatForImageData:data] == self.class.imageFormat);\n}\n\n- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options {\n    if (!data) {\n        return nil;\n    }\n    CGFloat scale = 1;\n    NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor];\n    if (scaleFactor != nil) {\n        scale = MAX([scaleFactor doubleValue], 1);\n    }\n    \n    CGSize thumbnailSize = CGSizeZero;\n    NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];\n    if (thumbnailSizeValue != nil) {\n#if SD_MAC\n        thumbnailSize = thumbnailSizeValue.sizeValue;\n#else\n        thumbnailSize = thumbnailSizeValue.CGSizeValue;\n#endif\n    }\n    \n    BOOL preserveAspectRatio = YES;\n    NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio];\n    if (preserveAspectRatioValue != nil) {\n        preserveAspectRatio = preserveAspectRatioValue.boolValue;\n    }\n    \n#if SD_MAC\n    // If don't use thumbnail, prefers the built-in generation of frames (GIF/APNG)\n    // Which decode frames in time and reduce memory usage\n    if (thumbnailSize.width == 0 || thumbnailSize.height == 0) {\n        SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data];\n        NSSize size = NSMakeSize(imageRep.pixelsWide / scale, imageRep.pixelsHigh / scale);\n        imageRep.size = size;\n        NSImage *animatedImage = [[NSImage alloc] initWithSize:size];\n        [animatedImage addRepresentation:imageRep];\n        return animatedImage;\n    }\n#endif\n    \n    CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);\n    if (!source) {\n        return nil;\n    }\n    size_t count = CGImageSourceGetCount(source);\n    UIImage *animatedImage;\n    \n    BOOL decodeFirstFrame = [options[SDImageCoderDecodeFirstFrameOnly] boolValue];\n    if (decodeFirstFrame || count <= 1) {\n        animatedImage = [self.class createFrameAtIndex:0 source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil];\n    } else {\n        NSMutableArray<SDImageFrame *> *frames = [NSMutableArray array];\n        \n        for (size_t i = 0; i < count; i++) {\n            UIImage *image = [self.class createFrameAtIndex:i source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil];\n            if (!image) {\n                continue;\n            }\n            \n            NSTimeInterval duration = [self.class frameDurationAtIndex:i source:source];\n            \n            SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration];\n            [frames addObject:frame];\n        }\n        \n        NSUInteger loopCount = [self.class imageLoopCountWithSource:source];\n        \n        animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames];\n        animatedImage.sd_imageLoopCount = loopCount;\n    }\n    animatedImage.sd_imageFormat = self.class.imageFormat;\n    CFRelease(source);\n    \n    return animatedImage;\n}\n\n#pragma mark - Progressive Decode\n\n- (BOOL)canIncrementalDecodeFromData:(NSData *)data {\n    return ([NSData sd_imageFormatForImageData:data] == self.class.imageFormat);\n}\n\n- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options {\n    self = [super init];\n    if (self) {\n        NSString *imageUTType = self.class.imageUTType;\n        _imageSource = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint : imageUTType});\n        CGFloat scale = 1;\n        NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor];\n        if (scaleFactor != nil) {\n            scale = MAX([scaleFactor doubleValue], 1);\n        }\n        _scale = scale;\n        CGSize thumbnailSize = CGSizeZero;\n        NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];\n        if (thumbnailSizeValue != nil) {\n    #if SD_MAC\n            thumbnailSize = thumbnailSizeValue.sizeValue;\n    #else\n            thumbnailSize = thumbnailSizeValue.CGSizeValue;\n    #endif\n        }\n        _thumbnailSize = thumbnailSize;\n        BOOL preserveAspectRatio = YES;\n        NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio];\n        if (preserveAspectRatioValue != nil) {\n            preserveAspectRatio = preserveAspectRatioValue.boolValue;\n        }\n        _preserveAspectRatio = preserveAspectRatio;\n#if SD_UIKIT\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n    }\n    return self;\n}\n\n- (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished {\n    if (_finished) {\n        return;\n    }\n    _imageData = data;\n    _finished = finished;\n    \n    // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/\n    // Thanks to the author @Nyx0uf\n    \n    // Update the data source, we must pass ALL the data, not just the new bytes\n    CGImageSourceUpdateData(_imageSource, (__bridge CFDataRef)data, finished);\n    \n    if (_width + _height == 0) {\n        NSDictionary *options = @{\n            (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES),\n            (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage\n        };\n        CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, (__bridge CFDictionaryRef)options);\n        if (properties) {\n            CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight);\n            if (val) CFNumberGetValue(val, kCFNumberLongType, &_height);\n            val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth);\n            if (val) CFNumberGetValue(val, kCFNumberLongType, &_width);\n            CFRelease(properties);\n        }\n    }\n    \n    // For animated image progressive decoding because the frame count and duration may be changed.\n    [self scanAndCheckFramesValidWithImageSource:_imageSource];\n}\n\n- (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options {\n    UIImage *image;\n    \n    if (_width + _height > 0) {\n        // Create the image\n        CGFloat scale = _scale;\n        NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor];\n        if (scaleFactor != nil) {\n            scale = MAX([scaleFactor doubleValue], 1);\n        }\n        image = [self.class createFrameAtIndex:0 source:_imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil];\n        if (image) {\n            image.sd_imageFormat = self.class.imageFormat;\n        }\n    }\n    \n    return image;\n}\n\n#pragma mark - Encode\n- (BOOL)canEncodeToFormat:(SDImageFormat)format {\n    return (format == self.class.imageFormat);\n}\n\n- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options {\n    if (!image) {\n        return nil;\n    }\n    CGImageRef imageRef = image.CGImage;\n    if (!imageRef) {\n        // Earily return, supports CGImage only\n        return nil;\n    }\n    \n    if (format != self.class.imageFormat) {\n        return nil;\n    }\n    \n    NSMutableData *imageData = [NSMutableData data];\n    CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format];\n    NSArray<SDImageFrame *> *frames = [SDImageCoderHelper framesFromAnimatedImage:image];\n    \n    // Create an image destination. Animated Image does not support EXIF image orientation TODO\n    // The `CGImageDestinationCreateWithData` will log a warning when count is 0, use 1 instead.\n    CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count ?: 1, NULL);\n    if (!imageDestination) {\n        // Handle failure.\n        return nil;\n    }\n    NSMutableDictionary *properties = [NSMutableDictionary dictionary];\n    // Encoding Options\n    double compressionQuality = 1;\n    if (options[SDImageCoderEncodeCompressionQuality]) {\n        compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];\n    }\n    properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality);\n    CGColorRef backgroundColor = [options[SDImageCoderEncodeBackgroundColor] CGColor];\n    if (backgroundColor) {\n        properties[(__bridge NSString *)kCGImageDestinationBackgroundColor] = (__bridge id)(backgroundColor);\n    }\n    CGSize maxPixelSize = CGSizeZero;\n    NSValue *maxPixelSizeValue = options[SDImageCoderEncodeMaxPixelSize];\n    if (maxPixelSizeValue != nil) {\n#if SD_MAC\n        maxPixelSize = maxPixelSizeValue.sizeValue;\n#else\n        maxPixelSize = maxPixelSizeValue.CGSizeValue;\n#endif\n    }\n    CGFloat pixelWidth = (CGFloat)CGImageGetWidth(imageRef);\n    CGFloat pixelHeight = (CGFloat)CGImageGetHeight(imageRef);\n    CGFloat finalPixelSize = 0;\n    if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > maxPixelSize.width && pixelHeight > maxPixelSize.height) {\n        CGFloat pixelRatio = pixelWidth / pixelHeight;\n        CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height;\n        if (pixelRatio > maxPixelSizeRatio) {\n            finalPixelSize = maxPixelSize.width;\n        } else {\n            finalPixelSize = maxPixelSize.height;\n        }\n        properties[(__bridge NSString *)kCGImageDestinationImageMaxPixelSize] = @(finalPixelSize);\n    }\n    NSUInteger maxFileSize = [options[SDImageCoderEncodeMaxFileSize] unsignedIntegerValue];\n    if (maxFileSize > 0) {\n        properties[kSDCGImageDestinationRequestedFileSize] = @(maxFileSize);\n        // Remove the quality if we have file size limit\n        properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = nil;\n    }\n    BOOL embedThumbnail = NO;\n    if (options[SDImageCoderEncodeEmbedThumbnail]) {\n        embedThumbnail = [options[SDImageCoderEncodeEmbedThumbnail] boolValue];\n    }\n    properties[(__bridge NSString *)kCGImageDestinationEmbedThumbnail] = @(embedThumbnail);\n    \n    BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];\n    if (encodeFirstFrame || frames.count == 0) {\n        // for static single images\n        CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties);\n    } else {\n        // for animated images\n        NSUInteger loopCount = image.sd_imageLoopCount;\n        NSDictionary *containerProperties = @{\n            self.class.dictionaryProperty: @{self.class.loopCountProperty : @(loopCount)}\n        };\n        // container level properties (applies for `CGImageDestinationSetProperties`, not individual frames)\n        CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)containerProperties);\n        \n        for (size_t i = 0; i < frames.count; i++) {\n            SDImageFrame *frame = frames[i];\n            NSTimeInterval frameDuration = frame.duration;\n            CGImageRef frameImageRef = frame.image.CGImage;\n            properties[self.class.dictionaryProperty] = @{self.class.delayTimeProperty : @(frameDuration)};\n            CGImageDestinationAddImage(imageDestination, frameImageRef, (__bridge CFDictionaryRef)properties);\n        }\n    }\n    // Finalize the destination.\n    if (CGImageDestinationFinalize(imageDestination) == NO) {\n        // Handle failure.\n        imageData = nil;\n    }\n    \n    CFRelease(imageDestination);\n    \n    return [imageData copy];\n}\n\n#pragma mark - SDAnimatedImageCoder\n- (nullable instancetype)initWithAnimatedImageData:(nullable NSData *)data options:(nullable SDImageCoderOptions *)options {\n    if (!data) {\n        return nil;\n    }\n    self = [super init];\n    if (self) {\n        CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);\n        if (!imageSource) {\n            return nil;\n        }\n        BOOL framesValid = [self scanAndCheckFramesValidWithImageSource:imageSource];\n        if (!framesValid) {\n            CFRelease(imageSource);\n            return nil;\n        }\n        CGFloat scale = 1;\n        NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor];\n        if (scaleFactor != nil) {\n            scale = MAX([scaleFactor doubleValue], 1);\n        }\n        _scale = scale;\n        CGSize thumbnailSize = CGSizeZero;\n        NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];\n        if (thumbnailSizeValue != nil) {\n    #if SD_MAC\n            thumbnailSize = thumbnailSizeValue.sizeValue;\n    #else\n            thumbnailSize = thumbnailSizeValue.CGSizeValue;\n    #endif\n        }\n        _thumbnailSize = thumbnailSize;\n        BOOL preserveAspectRatio = YES;\n        NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio];\n        if (preserveAspectRatioValue != nil) {\n            preserveAspectRatio = preserveAspectRatioValue.boolValue;\n        }\n        _preserveAspectRatio = preserveAspectRatio;\n        _imageSource = imageSource;\n        _imageData = data;\n#if SD_UIKIT\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n    }\n    return self;\n}\n\n- (BOOL)scanAndCheckFramesValidWithImageSource:(CGImageSourceRef)imageSource {\n    if (!imageSource) {\n        return NO;\n    }\n    NSUInteger frameCount = CGImageSourceGetCount(imageSource);\n    NSUInteger loopCount = [self.class imageLoopCountWithSource:imageSource];\n    NSMutableArray<SDImageIOCoderFrame *> *frames = [NSMutableArray array];\n    \n    for (size_t i = 0; i < frameCount; i++) {\n        SDImageIOCoderFrame *frame = [[SDImageIOCoderFrame alloc] init];\n        frame.index = i;\n        frame.duration = [self.class frameDurationAtIndex:i source:imageSource];\n        [frames addObject:frame];\n    }\n    \n    _frameCount = frameCount;\n    _loopCount = loopCount;\n    _frames = [frames copy];\n    \n    return YES;\n}\n\n- (NSData *)animatedImageData {\n    return _imageData;\n}\n\n- (NSUInteger)animatedImageLoopCount {\n    return _loopCount;\n}\n\n- (NSUInteger)animatedImageFrameCount {\n    return _frameCount;\n}\n\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index {\n    if (index >= _frameCount) {\n        return 0;\n    }\n    return _frames[index].duration;\n}\n\n- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {\n    if (index >= _frameCount) {\n        return nil;\n    }\n    // Animated Image should not use the CGContext solution to force decode. Prefers to use Image/IO built in method, which is safer and memory friendly, see https://github.com/SDWebImage/SDWebImage/issues/2961\n    NSDictionary *options = @{\n        (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES),\n        (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage\n    };\n    UIImage *image = [self.class createFrameAtIndex:index source:_imageSource scale:_scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:options];\n    if (!image) {\n        return nil;\n    }\n    image.sd_imageFormat = self.class.imageFormat;\n    image.sd_isDecoded = YES;\n    return image;\n}\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDImageCoder.h\"\n\n/**\n Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding.\n \n GIF\n Also supports static GIF (meaning will only handle the 1st frame).\n For a full GIF support, we recommend `SDAnimatedImageView` to keep both CPU and memory balanced.\n \n HEIC\n This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf\n Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13)\n Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU))\n Encode(Software): macOS 10.13\n Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU))\n */\n@interface SDImageIOCoder : NSObject <SDProgressiveImageCoder>\n\n@property (nonatomic, class, readonly, nonnull) SDImageIOCoder *sharedCoder;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageIOCoder.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"NSImage+Compatibility.h\"\n#import <ImageIO/ImageIO.h>\n#import \"UIImage+Metadata.h\"\n#import \"SDImageIOAnimatedCoderInternal.h\"\n\n// Specify File Size for lossy format encoding, like JPEG\nstatic NSString * kSDCGImageDestinationRequestedFileSize = @\"kCGImageDestinationRequestedFileSize\";\n\n@implementation SDImageIOCoder {\n    size_t _width, _height;\n    CGImagePropertyOrientation _orientation;\n    CGImageSourceRef _imageSource;\n    CGFloat _scale;\n    BOOL _finished;\n    BOOL _preserveAspectRatio;\n    CGSize _thumbnailSize;\n}\n\n- (void)dealloc {\n    if (_imageSource) {\n        CFRelease(_imageSource);\n        _imageSource = NULL;\n    }\n#if SD_UIKIT\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n}\n\n- (void)didReceiveMemoryWarning:(NSNotification *)notification\n{\n    if (_imageSource) {\n        CGImageSourceRemoveCacheAtIndex(_imageSource, 0);\n    }\n}\n\n+ (instancetype)sharedCoder {\n    static SDImageIOCoder *coder;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        coder = [[SDImageIOCoder alloc] init];\n    });\n    return coder;\n}\n\n#pragma mark - Decode\n- (BOOL)canDecodeFromData:(nullable NSData *)data {\n    return YES;\n}\n\n- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options {\n    if (!data) {\n        return nil;\n    }\n    CGFloat scale = 1;\n    NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor];\n    if (scaleFactor != nil) {\n        scale = MAX([scaleFactor doubleValue], 1) ;\n    }\n    \n    CGSize thumbnailSize = CGSizeZero;\n    NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];\n    if (thumbnailSizeValue != nil) {\n#if SD_MAC\n        thumbnailSize = thumbnailSizeValue.sizeValue;\n#else\n        thumbnailSize = thumbnailSizeValue.CGSizeValue;\n#endif\n    }\n    \n    BOOL preserveAspectRatio = YES;\n    NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio];\n    if (preserveAspectRatioValue != nil) {\n        preserveAspectRatio = preserveAspectRatioValue.boolValue;\n    }\n    \n    CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);\n    if (!source) {\n        return nil;\n    }\n    \n    UIImage *image = [SDImageIOAnimatedCoder createFrameAtIndex:0 source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil];\n    CFRelease(source);\n    if (!image) {\n        return nil;\n    }\n    \n    image.sd_imageFormat = [NSData sd_imageFormatForImageData:data];\n    return image;\n}\n\n#pragma mark - Progressive Decode\n\n- (BOOL)canIncrementalDecodeFromData:(NSData *)data {\n    return [self canDecodeFromData:data];\n}\n\n- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options {\n    self = [super init];\n    if (self) {\n        _imageSource = CGImageSourceCreateIncremental(NULL);\n        CGFloat scale = 1;\n        NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor];\n        if (scaleFactor != nil) {\n            scale = MAX([scaleFactor doubleValue], 1);\n        }\n        _scale = scale;\n        CGSize thumbnailSize = CGSizeZero;\n        NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize];\n        if (thumbnailSizeValue != nil) {\n    #if SD_MAC\n            thumbnailSize = thumbnailSizeValue.sizeValue;\n    #else\n            thumbnailSize = thumbnailSizeValue.CGSizeValue;\n    #endif\n        }\n        _thumbnailSize = thumbnailSize;\n        BOOL preserveAspectRatio = YES;\n        NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio];\n        if (preserveAspectRatioValue != nil) {\n            preserveAspectRatio = preserveAspectRatioValue.boolValue;\n        }\n        _preserveAspectRatio = preserveAspectRatio;\n#if SD_UIKIT\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n    }\n    return self;\n}\n\n- (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished {\n    if (_finished) {\n        return;\n    }\n    _finished = finished;\n    \n    // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/\n    // Thanks to the author @Nyx0uf\n    \n    // Update the data source, we must pass ALL the data, not just the new bytes\n    CGImageSourceUpdateData(_imageSource, (__bridge CFDataRef)data, finished);\n    \n    if (_width + _height == 0) {\n        CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, NULL);\n        if (properties) {\n            NSInteger orientationValue = 1;\n            CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight);\n            if (val) CFNumberGetValue(val, kCFNumberLongType, &_height);\n            val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth);\n            if (val) CFNumberGetValue(val, kCFNumberLongType, &_width);\n            val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation);\n            if (val) CFNumberGetValue(val, kCFNumberNSIntegerType, &orientationValue);\n            CFRelease(properties);\n            \n            // When we draw to Core Graphics, we lose orientation information,\n            // which means the image below born of initWithCGIImage will be\n            // oriented incorrectly sometimes. (Unlike the image born of initWithData\n            // in didCompleteWithError.) So save it here and pass it on later.\n            _orientation = (CGImagePropertyOrientation)orientationValue;\n        }\n    }\n}\n\n- (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options {\n    UIImage *image;\n    \n    if (_width + _height > 0) {\n        // Create the image\n        CGFloat scale = _scale;\n        NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor];\n        if (scaleFactor != nil) {\n            scale = MAX([scaleFactor doubleValue], 1);\n        }\n        image = [SDImageIOAnimatedCoder createFrameAtIndex:0 source:_imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil];\n        if (image) {\n            CFStringRef uttype = CGImageSourceGetType(_imageSource);\n            image.sd_imageFormat = [NSData sd_imageFormatFromUTType:uttype];\n        }\n    }\n    \n    return image;\n}\n\n#pragma mark - Encode\n- (BOOL)canEncodeToFormat:(SDImageFormat)format {\n    return YES;\n}\n\n- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options {\n    if (!image) {\n        return nil;\n    }\n    CGImageRef imageRef = image.CGImage;\n    if (!imageRef) {\n        // Earily return, supports CGImage only\n        return nil;\n    }\n    \n    if (format == SDImageFormatUndefined) {\n        BOOL hasAlpha = [SDImageCoderHelper CGImageContainsAlpha:imageRef];\n        if (hasAlpha) {\n            format = SDImageFormatPNG;\n        } else {\n            format = SDImageFormatJPEG;\n        }\n    }\n    \n    NSMutableData *imageData = [NSMutableData data];\n    CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format];\n    \n    // Create an image destination.\n    CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL);\n    if (!imageDestination) {\n        // Handle failure.\n        return nil;\n    }\n    \n    NSMutableDictionary *properties = [NSMutableDictionary dictionary];\n#if SD_UIKIT || SD_WATCH\n    CGImagePropertyOrientation exifOrientation = [SDImageCoderHelper exifOrientationFromImageOrientation:image.imageOrientation];\n#else\n    CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp;\n#endif\n    properties[(__bridge NSString *)kCGImagePropertyOrientation] = @(exifOrientation);\n    // Encoding Options\n    double compressionQuality = 1;\n    if (options[SDImageCoderEncodeCompressionQuality]) {\n        compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];\n    }\n    properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality);\n    CGColorRef backgroundColor = [options[SDImageCoderEncodeBackgroundColor] CGColor];\n    if (backgroundColor) {\n        properties[(__bridge NSString *)kCGImageDestinationBackgroundColor] = (__bridge id)(backgroundColor);\n    }\n    CGSize maxPixelSize = CGSizeZero;\n    NSValue *maxPixelSizeValue = options[SDImageCoderEncodeMaxPixelSize];\n    if (maxPixelSizeValue != nil) {\n#if SD_MAC\n        maxPixelSize = maxPixelSizeValue.sizeValue;\n#else\n        maxPixelSize = maxPixelSizeValue.CGSizeValue;\n#endif\n    }\n    CGFloat pixelWidth = (CGFloat)CGImageGetWidth(imageRef);\n    CGFloat pixelHeight = (CGFloat)CGImageGetHeight(imageRef);\n    if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > maxPixelSize.width && pixelHeight > maxPixelSize.height) {\n        CGFloat pixelRatio = pixelWidth / pixelHeight;\n        CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height;\n        CGFloat finalPixelSize;\n        if (pixelRatio > maxPixelSizeRatio) {\n            finalPixelSize = maxPixelSize.width;\n        } else {\n            finalPixelSize = maxPixelSize.height;\n        }\n        properties[(__bridge NSString *)kCGImageDestinationImageMaxPixelSize] = @(finalPixelSize);\n    }\n    NSUInteger maxFileSize = [options[SDImageCoderEncodeMaxFileSize] unsignedIntegerValue];\n    if (maxFileSize > 0) {\n        properties[kSDCGImageDestinationRequestedFileSize] = @(maxFileSize);\n        // Remove the quality if we have file size limit\n        properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = nil;\n    }\n    BOOL embedThumbnail = NO;\n    if (options[SDImageCoderEncodeEmbedThumbnail]) {\n        embedThumbnail = [options[SDImageCoderEncodeEmbedThumbnail] boolValue];\n    }\n    properties[(__bridge NSString *)kCGImageDestinationEmbedThumbnail] = @(embedThumbnail);\n    \n    // Add your image to the destination.\n    CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties);\n    \n    // Finalize the destination.\n    if (CGImageDestinationFinalize(imageDestination) == NO) {\n        // Handle failure.\n        imageData = nil;\n    }\n    \n    CFRelease(imageDestination);\n    \n    return [imageData copy];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageDefine.h\"\n#import \"SDWebImageOperation.h\"\n#import \"SDImageCoder.h\"\n\ntypedef void(^SDImageLoaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL);\ntypedef void(^SDImageLoaderCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished);\n\n#pragma mark - Context Options\n\n/**\n A `UIImage` instance from `SDWebImageManager` when you specify `SDWebImageRefreshCached` and image cache hit.\n This can be a hint for image loader to load the image from network and refresh the image from remote location if needed. If the image from remote location does not change, you should call the completion with `SDWebImageErrorCacheNotModified` error. (UIImage)\n @note If you don't implement `SDWebImageRefreshCached` support, you do not need to care about this context option.\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextLoaderCachedImage;\n\n#pragma mark - Helper method\n\n/**\n This is the built-in decoding process for image download from network or local file.\n @note If you want to implement your custom loader with `requestImageWithURL:options:context:progress:completed:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image.\n\n @param imageData The image data from the network. Should not be nil\n @param imageURL The image URL from the input. Should not be nil\n @param options The options arg from the input\n @param context The context arg from the input\n @return The decoded image for current image data load from the network\n */\nFOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, SDWebImageOptions options, SDWebImageContext * _Nullable context);\n\n/**\n This is the built-in decoding process for image progressive download from network. It's used when `SDWebImageProgressiveLoad` option is set. (It's not required when your loader does not support progressive image loading)\n @note If you want to implement your custom loader with `requestImageWithURL:options:context:progress:completed:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image.\n\n @param imageData The image data from the network so far. Should not be nil\n @param imageURL The image URL from the input. Should not be nil\n @param finished Pass NO to specify the download process has not finished. Pass YES when all image data has finished.\n @param operation The loader operation associated with current progressive download. Why to provide this is because progressive decoding need to store the partial decoded context for each operation to avoid conflict. You should provide the operation from `loadImageWithURL:` method return value.\n @param options The options arg from the input\n @param context The context arg from the input\n @return The decoded progressive image for current image data load from the network\n */\nFOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, BOOL finished,  id<SDWebImageOperation> _Nonnull operation, SDWebImageOptions options, SDWebImageContext * _Nullable context);\n\n/**\n This function get the progressive decoder for current loading operation. If no progressive decoding is happended or decoder is not able to construct, return nil.\n @return The progressive decoder associated with the loading operation.\n */\nFOUNDATION_EXPORT id<SDProgressiveImageCoder> _Nullable SDImageLoaderGetProgressiveCoder(id<SDWebImageOperation> _Nonnull operation);\n\n/**\n This function set the progressive decoder for current loading operation. If no progressive decoding is happended, pass nil.\n @param operation The loading operation to associate the progerssive decoder.\n */\nFOUNDATION_EXPORT void SDImageLoaderSetProgressiveCoder(id<SDWebImageOperation> _Nonnull operation, id<SDProgressiveImageCoder> _Nullable progressiveCoder);\n\n#pragma mark - SDImageLoader\n\n/**\n This is the protocol to specify custom image load process. You can create your own class to conform this protocol and use as a image loader to load image from network or any available remote resources defined by yourself.\n If you want to implement custom loader for image download from network or local file, you just need to concentrate on image data download only. After the download finish, call `SDImageLoaderDecodeImageData` or `SDImageLoaderDecodeProgressiveImageData` to use the built-in decoding process and produce image (Remember to call in the global queue). And finally callback the completion block.\n If you directly get the image instance using some third-party SDKs, such as image directly from Photos framework. You can process the image data and image instance by yourself without that built-in decoding process. And finally callback the completion block.\n @note It's your responsibility to load the image in the desired global queue(to avoid block main queue). We do not dispatch these method call in a global queue but just from the call queue (For `SDWebImageManager`, it typically call from the main queue).\n*/\n@protocol SDImageLoader <NSObject>\n\n@required\n/**\n Whether current image loader supports to load the provide image URL.\n This will be checked every time a new image request come for loader. If this return NO, we will mark this image load as failed. If return YES, we will start to call `requestImageWithURL:options:context:progress:completed:`.\n\n @param url The image URL to be loaded.\n @return YES to continue download, NO to stop download.\n */\n- (BOOL)canRequestImageForURL:(nullable NSURL *)url API_DEPRECATED(\"Use canRequestImageForURL:options:context: instead\", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));\n\n@optional\n/**\n Whether current image loader supports to load the provide image URL, with associated options and context.\n This will be checked every time a new image request come for loader. If this return NO, we will mark this image load as failed. If return YES, we will start to call `requestImageWithURL:options:context:progress:completed:`.\n\n @param url The image URL to be loaded.\n @param options A mask to specify options to use for this request\n @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n @return YES to continue download, NO to stop download.\n */\n- (BOOL)canRequestImageForURL:(nullable NSURL *)url\n                      options:(SDWebImageOptions)options\n                      context:(nullable SDWebImageContext *)context;\n\n@required\n/**\n Load the image and image data with the given URL and return the image data. You're responsible for producing the image instance.\n\n @param url The URL represent the image. Note this may not be a HTTP URL\n @param options A mask to specify options to use for this request\n @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n @param progressBlock A block called while image is downloading\n *                    @note the progress block is executed on a background queue\n @param completedBlock A block called when operation has been completed.\n @return An operation which allow the user to cancel the current request.\n */\n- (nullable id<SDWebImageOperation>)requestImageWithURL:(nullable NSURL *)url\n                                                options:(SDWebImageOptions)options\n                                                context:(nullable SDWebImageContext *)context\n                                               progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                                              completed:(nullable SDImageLoaderCompletedBlock)completedBlock;\n\n\n/**\n Whether the error from image loader should be marked indeed un-recoverable or not.\n If this return YES, failed URL which does not using `SDWebImageRetryFailed` will be blocked into black list. Else not.\n\n @param url The URL represent the image. Note this may not be a HTTP URL\n @param error The URL's loading error, from previous `requestImageWithURL:options:context:progress:completed:` completedBlock's error.\n @return Whether to block this url or not. Return YES to mark this URL as failed.\n */\n- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url\n                              error:(nonnull NSError *)error API_DEPRECATED(\"Use shouldBlockFailedURLWithURL:error:options:context: instead\", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));\n\n@optional\n/**\n Whether the error from image loader should be marked indeed un-recoverable or not, with associated options and context.\n If this return YES, failed URL which does not using `SDWebImageRetryFailed` will be blocked into black list. Else not.\n\n @param url The URL represent the image. Note this may not be a HTTP URL\n @param error The URL's loading error, from previous `requestImageWithURL:options:context:progress:completed:` completedBlock's error.\n @param options A mask to specify options to use for this request\n @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n @return Whether to block this url or not. Return YES to mark this URL as failed.\n */\n- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url\n                              error:(nonnull NSError *)error\n                            options:(SDWebImageOptions)options\n                            context:(nullable SDWebImageContext *)context;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageLoader.h\"\n#import \"SDWebImageCacheKeyFilter.h\"\n#import \"SDImageCodersManager.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"SDAnimatedImage.h\"\n#import \"UIImage+Metadata.h\"\n#import \"SDInternalMacros.h\"\n#import \"objc/runtime.h\"\n\nSDWebImageContextOption const SDWebImageContextLoaderCachedImage = @\"loaderCachedImage\";\n\nstatic void * SDImageLoaderProgressiveCoderKey = &SDImageLoaderProgressiveCoderKey;\n\nid<SDProgressiveImageCoder> SDImageLoaderGetProgressiveCoder(id<SDWebImageOperation> operation) {\n    NSCParameterAssert(operation);\n    return objc_getAssociatedObject(operation, SDImageLoaderProgressiveCoderKey);\n}\n\nvoid SDImageLoaderSetProgressiveCoder(id<SDWebImageOperation> operation, id<SDProgressiveImageCoder> progressiveCoder) {\n    NSCParameterAssert(operation);\n    objc_setAssociatedObject(operation, SDImageLoaderProgressiveCoderKey, progressiveCoder, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\nUIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, SDWebImageOptions options, SDWebImageContext * _Nullable context) {\n    NSCParameterAssert(imageData);\n    NSCParameterAssert(imageURL);\n    \n    UIImage *image;\n    id<SDWebImageCacheKeyFilter> cacheKeyFilter = context[SDWebImageContextCacheKeyFilter];\n    NSString *cacheKey;\n    if (cacheKeyFilter) {\n        cacheKey = [cacheKeyFilter cacheKeyForURL:imageURL];\n    } else {\n        cacheKey = imageURL.absoluteString;\n    }\n    BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly);\n    NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor];\n    CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);\n    NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];\n    NSValue *thumbnailSizeValue;\n    BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);\n    if (shouldScaleDown) {\n        CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;\n        CGFloat dimension = ceil(sqrt(thumbnailPixels));\n        thumbnailSizeValue = @(CGSizeMake(dimension, dimension));\n    }\n    if (context[SDWebImageContextImageThumbnailPixelSize]) {\n        thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];\n    }\n    \n    SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2];\n    mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame);\n    mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale);\n    mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue;\n    mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue;\n    mutableCoderOptions[SDImageCoderWebImageContext] = context;\n    SDImageCoderOptions *coderOptions = [mutableCoderOptions copy];\n    \n    // Grab the image coder\n    id<SDImageCoder> imageCoder;\n    if ([context[SDWebImageContextImageCoder] conformsToProtocol:@protocol(SDImageCoder)]) {\n        imageCoder = context[SDWebImageContextImageCoder];\n    } else {\n        imageCoder = [SDImageCodersManager sharedManager];\n    }\n    \n    if (!decodeFirstFrame) {\n        // check whether we should use `SDAnimatedImage`\n        Class animatedImageClass = context[SDWebImageContextAnimatedImageClass];\n        if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)]) {\n            image = [[animatedImageClass alloc] initWithData:imageData scale:scale options:coderOptions];\n            if (image) {\n                // Preload frames if supported\n                if (options & SDWebImagePreloadAllFrames && [image respondsToSelector:@selector(preloadAllFrames)]) {\n                    [((id<SDAnimatedImage>)image) preloadAllFrames];\n                }\n            } else {\n                // Check image class matching\n                if (options & SDWebImageMatchAnimatedImageClass) {\n                    return nil;\n                }\n            }\n        }\n    }\n    if (!image) {\n        image = [imageCoder decodedImageWithData:imageData options:coderOptions];\n    }\n    if (image) {\n        BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage);\n        if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) {\n            // `SDAnimatedImage` do not decode\n            shouldDecode = NO;\n        } else if (image.sd_isAnimated) {\n            // animated image do not decode\n            shouldDecode = NO;\n        }\n        \n        if (shouldDecode) {\n            image = [SDImageCoderHelper decodedImageWithImage:image];\n        }\n    }\n    \n    return image;\n}\n\nUIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, BOOL finished,  id<SDWebImageOperation> _Nonnull operation, SDWebImageOptions options, SDWebImageContext * _Nullable context) {\n    NSCParameterAssert(imageData);\n    NSCParameterAssert(imageURL);\n    NSCParameterAssert(operation);\n    \n    UIImage *image;\n    id<SDWebImageCacheKeyFilter> cacheKeyFilter = context[SDWebImageContextCacheKeyFilter];\n    NSString *cacheKey;\n    if (cacheKeyFilter) {\n        cacheKey = [cacheKeyFilter cacheKeyForURL:imageURL];\n    } else {\n        cacheKey = imageURL.absoluteString;\n    }\n    BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly);\n    NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor];\n    CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);\n    NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];\n    NSValue *thumbnailSizeValue;\n    BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);\n    if (shouldScaleDown) {\n        CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;\n        CGFloat dimension = ceil(sqrt(thumbnailPixels));\n        thumbnailSizeValue = @(CGSizeMake(dimension, dimension));\n    }\n    if (context[SDWebImageContextImageThumbnailPixelSize]) {\n        thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];\n    }\n    \n    SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2];\n    mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame);\n    mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale);\n    mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue;\n    mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue;\n    mutableCoderOptions[SDImageCoderWebImageContext] = context;\n    SDImageCoderOptions *coderOptions = [mutableCoderOptions copy];\n    \n    // Grab the progressive image coder\n    id<SDProgressiveImageCoder> progressiveCoder = SDImageLoaderGetProgressiveCoder(operation);\n    if (!progressiveCoder) {\n        id<SDProgressiveImageCoder> imageCoder = context[SDWebImageContextImageCoder];\n        // Check the progressive coder if provided\n        if ([imageCoder conformsToProtocol:@protocol(SDProgressiveImageCoder)]) {\n            progressiveCoder = [[[imageCoder class] alloc] initIncrementalWithOptions:coderOptions];\n        } else {\n            // We need to create a new instance for progressive decoding to avoid conflicts\n            for (id<SDImageCoder> coder in [SDImageCodersManager sharedManager].coders.reverseObjectEnumerator) {\n                if ([coder conformsToProtocol:@protocol(SDProgressiveImageCoder)] &&\n                    [((id<SDProgressiveImageCoder>)coder) canIncrementalDecodeFromData:imageData]) {\n                    progressiveCoder = [[[coder class] alloc] initIncrementalWithOptions:coderOptions];\n                    break;\n                }\n            }\n        }\n        SDImageLoaderSetProgressiveCoder(operation, progressiveCoder);\n    }\n    // If we can't find any progressive coder, disable progressive download\n    if (!progressiveCoder) {\n        return nil;\n    }\n    \n    [progressiveCoder updateIncrementalData:imageData finished:finished];\n    if (!decodeFirstFrame) {\n        // check whether we should use `SDAnimatedImage`\n        Class animatedImageClass = context[SDWebImageContextAnimatedImageClass];\n        if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)] && [progressiveCoder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) {\n            image = [[animatedImageClass alloc] initWithAnimatedCoder:(id<SDAnimatedImageCoder>)progressiveCoder scale:scale];\n            if (image) {\n                // Progressive decoding does not preload frames\n            } else {\n                // Check image class matching\n                if (options & SDWebImageMatchAnimatedImageClass) {\n                    return nil;\n                }\n            }\n        }\n    }\n    if (!image) {\n        image = [progressiveCoder incrementalDecodedImageWithOptions:coderOptions];\n    }\n    if (image) {\n        BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage);\n        if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) {\n            // `SDAnimatedImage` do not decode\n            shouldDecode = NO;\n        } else if (image.sd_isAnimated) {\n            // animated image do not decode\n            shouldDecode = NO;\n        }\n        if (shouldDecode) {\n            image = [SDImageCoderHelper decodedImageWithImage:image];\n        }\n        // mark the image as progressive (completed one are not mark as progressive)\n        image.sd_isIncremental = !finished;\n    }\n    \n    return image;\n}\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageLoader.h\"\n\n/**\n A loaders manager to manage multiple loaders\n */\n@interface SDImageLoadersManager : NSObject <SDImageLoader>\n\n/**\n Returns the global shared loaders manager instance. By default we will set [`SDWebImageDownloader.sharedDownloader`] into the loaders array.\n */\n@property (nonatomic, class, readonly, nonnull) SDImageLoadersManager *sharedManager;\n\n/**\n All image loaders in manager. The loaders array is a priority queue, which means the later added loader will have the highest priority\n */\n@property (nonatomic, copy, nullable) NSArray<id<SDImageLoader>>* loaders;\n\n/**\n Add a new image loader to the end of loaders array. Which has the highest priority.\n \n @param loader loader\n */\n- (void)addLoader:(nonnull id<SDImageLoader>)loader;\n\n/**\n Remove an image loader in the loaders array.\n \n @param loader loader\n */\n- (void)removeLoader:(nonnull id<SDImageLoader>)loader;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageLoadersManager.h\"\n#import \"SDWebImageDownloader.h\"\n#import \"SDInternalMacros.h\"\n\n@interface SDImageLoadersManager ()\n\n@property (nonatomic, strong, nonnull) NSMutableArray<id<SDImageLoader>> *imageLoaders;\n\n@end\n\n@implementation SDImageLoadersManager {\n    SD_LOCK_DECLARE(_loadersLock);\n}\n\n+ (SDImageLoadersManager *)sharedManager {\n    static dispatch_once_t onceToken;\n    static SDImageLoadersManager *manager;\n    dispatch_once(&onceToken, ^{\n        manager = [[SDImageLoadersManager alloc] init];\n    });\n    return manager;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        // initialize with default image loaders\n        _imageLoaders = [NSMutableArray arrayWithObject:[SDWebImageDownloader sharedDownloader]];\n        SD_LOCK_INIT(_loadersLock);\n    }\n    return self;\n}\n\n- (NSArray<id<SDImageLoader>> *)loaders {\n    SD_LOCK(_loadersLock);\n    NSArray<id<SDImageLoader>>* loaders = [_imageLoaders copy];\n    SD_UNLOCK(_loadersLock);\n    return loaders;\n}\n\n- (void)setLoaders:(NSArray<id<SDImageLoader>> *)loaders {\n    SD_LOCK(_loadersLock);\n    [_imageLoaders removeAllObjects];\n    if (loaders.count) {\n        [_imageLoaders addObjectsFromArray:loaders];\n    }\n    SD_UNLOCK(_loadersLock);\n}\n\n#pragma mark - Loader Property\n\n- (void)addLoader:(id<SDImageLoader>)loader {\n    if (![loader conformsToProtocol:@protocol(SDImageLoader)]) {\n        return;\n    }\n    SD_LOCK(_loadersLock);\n    [_imageLoaders addObject:loader];\n    SD_UNLOCK(_loadersLock);\n}\n\n- (void)removeLoader:(id<SDImageLoader>)loader {\n    if (![loader conformsToProtocol:@protocol(SDImageLoader)]) {\n        return;\n    }\n    SD_LOCK(_loadersLock);\n    [_imageLoaders removeObject:loader];\n    SD_UNLOCK(_loadersLock);\n}\n\n#pragma mark - SDImageLoader\n\n- (BOOL)canRequestImageForURL:(nullable NSURL *)url {\n    return [self canRequestImageForURL:url options:0 context:nil];\n}\n\n- (BOOL)canRequestImageForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context {\n    NSArray<id<SDImageLoader>> *loaders = self.loaders;\n    for (id<SDImageLoader> loader in loaders.reverseObjectEnumerator) {\n        if ([loader respondsToSelector:@selector(canRequestImageForURL:options:context:)]) {\n            if ([loader canRequestImageForURL:url options:options context:context]) {\n                return YES;\n            }\n        } else {\n            if ([loader canRequestImageForURL:url]) {\n                return YES;\n            }\n        }\n    }\n    return NO;\n}\n\n- (id<SDWebImageOperation>)requestImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock {\n    if (!url) {\n        return nil;\n    }\n    NSArray<id<SDImageLoader>> *loaders = self.loaders;\n    for (id<SDImageLoader> loader in loaders.reverseObjectEnumerator) {\n        if ([loader canRequestImageForURL:url]) {\n            return [loader requestImageWithURL:url options:options context:context progress:progressBlock completed:completedBlock];\n        }\n    }\n    return nil;\n}\n\n- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error {\n    NSArray<id<SDImageLoader>> *loaders = self.loaders;\n    for (id<SDImageLoader> loader in loaders.reverseObjectEnumerator) {\n        if ([loader canRequestImageForURL:url]) {\n            return [loader shouldBlockFailedURLWithURL:url error:error];\n        }\n    }\n    return NO;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"UIImage+Transform.h\"\n\n/**\n Return the transformed cache key which applied with specify transformerKey.\n\n @param key The original cache key\n @param transformerKey The transformer key from the transformer\n @return The transformed cache key\n */\nFOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey);\n\n/**\n Return the thumbnailed cache key which applied with specify thumbnailSize and preserveAspectRatio control.\n @param key The original cache key\n @param thumbnailPixelSize The thumbnail pixel size\n @param preserveAspectRatio The preserve aspect ratio option\n @return The thumbnailed cache key\n @note If you have both transformer and thumbnail applied for image, call `SDThumbnailedKeyForKey` firstly and then with `SDTransformedKeyForKey`.`\n */\nFOUNDATION_EXPORT NSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullable key, CGSize thumbnailPixelSize, BOOL preserveAspectRatio);\n\n/**\n A transformer protocol to transform the image load from cache or from download.\n You can provide transformer to cache and manager (Through the `transformer` property or context option `SDWebImageContextImageTransformer`).\n \n @note The transform process is called from a global queue in order to not to block the main queue.\n */\n@protocol SDImageTransformer <NSObject>\n\n@required\n/**\n For each transformer, it must contains its cache key to used to store the image cache or query from the cache. This key will be appened after the original cache key generated by URL or from user.\n\n @return The cache key to appended after the original cache key. Should not be nil.\n */\n@property (nonatomic, copy, readonly, nonnull) NSString *transformerKey;\n\n/**\n Transform the image to another image.\n\n @param image The image to be transformed\n @param key The cache key associated to the image. This arg is a hint for image source, not always useful and should be nullable. In the future we will remove this arg.\n @return The transformed image, or nil if transform failed\n */\n- (nullable UIImage *)transformedImageWithImage:(nonnull UIImage *)image forKey:(nonnull NSString *)key API_DEPRECATED(\"The key arg will be removed in the future. Update your code and don't rely on that.\", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));\n\n@end\n\n#pragma mark - Pipeline\n\n/**\n Pipeline transformer. Which you can bind multiple transformers together to let the image to be transformed one by one in order and generate the final image.\n @note Because transformers are lightweight, if you want to append or arrange transformers, create another pipeline transformer instead. This class is considered as immutable.\n */\n@interface SDImagePipelineTransformer : NSObject <SDImageTransformer>\n\n/**\n All transformers in pipeline\n */\n@property (nonatomic, copy, readonly, nonnull) NSArray<id<SDImageTransformer>> *transformers;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithTransformers:(nonnull NSArray<id<SDImageTransformer>> *)transformers;\n\n@end\n\n// There are some built-in transformers based on the `UIImage+Transformer` category to provide the common image geometry, image blending and image effect process. Those transform are useful for static image only but you can create your own to support animated image as well.\n// Because transformers are lightweight, these class are considered as immutable.\n#pragma mark - Image Geometry\n\n/**\n Image round corner transformer\n */\n@interface SDImageRoundCornerTransformer: NSObject <SDImageTransformer>\n\n/**\n The radius of each corner oval. Values larger than half the\n rectangle's width or height are clamped appropriately to\n half the width or height.\n */\n@property (nonatomic, assign, readonly) CGFloat cornerRadius;\n\n/**\n A bitmask value that identifies the corners that you want\n rounded. You can use this parameter to round only a subset\n of the corners of the rectangle.\n */\n@property (nonatomic, assign, readonly) SDRectCorner corners;\n\n/**\n The inset border line width. Values larger than half the rectangle's\n width or height are clamped appropriately to half the width\n or height.\n */\n@property (nonatomic, assign, readonly) CGFloat borderWidth;\n\n/**\n The border stroke color. nil means clear color.\n */\n@property (nonatomic, strong, readonly, nullable) UIColor *borderColor;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(nullable UIColor *)borderColor;\n\n@end\n\n/**\n Image resizing transformer\n */\n@interface SDImageResizingTransformer : NSObject <SDImageTransformer>\n\n/**\n The new size to be resized, values should be positive.\n */\n@property (nonatomic, assign, readonly) CGSize size;\n\n/**\n The scale mode for image content.\n */\n@property (nonatomic, assign, readonly) SDImageScaleMode scaleMode;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode;\n\n@end\n\n/**\n Image cropping transformer\n */\n@interface SDImageCroppingTransformer : NSObject <SDImageTransformer>\n\n/**\n Image's inner rect.\n */\n@property (nonatomic, assign, readonly) CGRect rect;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithRect:(CGRect)rect;\n\n@end\n\n/**\n Image flipping transformer\n */\n@interface SDImageFlippingTransformer : NSObject <SDImageTransformer>\n\n/**\n YES to flip the image horizontally. ⇋\n */\n@property (nonatomic, assign, readonly) BOOL horizontal;\n\n/**\n YES to flip the image vertically. ⥯\n */\n@property (nonatomic, assign, readonly) BOOL vertical;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical;\n\n@end\n\n/**\n Image rotation transformer\n */\n@interface SDImageRotationTransformer : NSObject <SDImageTransformer>\n\n/**\n Rotated radians in counterclockwise.⟲\n */\n@property (nonatomic, assign, readonly) CGFloat angle;\n\n/**\n YES: new image's size is extend to fit all content.\n NO: image's size will not change, content may be clipped.\n */\n@property (nonatomic, assign, readonly) BOOL fitSize;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize;\n\n@end\n\n#pragma mark - Image Blending\n\n/**\n Image tint color transformer\n */\n@interface SDImageTintTransformer : NSObject <SDImageTransformer>\n\n/**\n The tint color.\n */\n@property (nonatomic, strong, readonly, nonnull) UIColor *tintColor;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithColor:(nonnull UIColor *)tintColor;\n\n@end\n\n#pragma mark - Image Effect\n\n/**\n Image blur effect transformer\n */\n@interface SDImageBlurTransformer : NSObject <SDImageTransformer>\n\n/**\n The radius of the blur in points, 0 means no blur effect.\n */\n@property (nonatomic, assign, readonly) CGFloat blurRadius;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithRadius:(CGFloat)blurRadius;\n\n@end\n\n#if SD_UIKIT || SD_MAC\n/**\n Core Image filter transformer\n */\n@interface SDImageFilterTransformer: NSObject <SDImageTransformer>\n\n/**\n The CIFilter to be applied to the image.\n */\n@property (nonatomic, strong, readonly, nonnull) CIFilter *filter;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)transformerWithFilter:(nonnull CIFilter *)filter;\n\n@end\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageTransformer.h\"\n#import \"UIColor+SDHexString.h\"\n#if SD_UIKIT || SD_MAC\n#import <CoreImage/CoreImage.h>\n#endif\n\n// Separator for different transformerKey, for example, `image.png` |> flip(YES,NO) |> rotate(pi/4,YES) => 'image-SDImageFlippingTransformer(1,0)-SDImageRotationTransformer(0.78539816339,1).png'\nstatic NSString * const SDImageTransformerKeySeparator = @\"-\";\n\nNSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey) {\n    if (!key || !transformerKey) {\n        return nil;\n    }\n    // Find the file extension\n    NSURL *keyURL = [NSURL URLWithString:key];\n    NSString *ext = keyURL ? keyURL.pathExtension : key.pathExtension;\n    if (ext.length > 0) {\n        // For non-file URL\n        if (keyURL && !keyURL.isFileURL) {\n            // keep anything except path (like URL query)\n            NSURLComponents *component = [NSURLComponents componentsWithURL:keyURL resolvingAgainstBaseURL:NO];\n            component.path = [[[component.path.stringByDeletingPathExtension stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey] stringByAppendingPathExtension:ext];\n            return component.URL.absoluteString;\n        } else {\n            // file URL\n            return [[[key.stringByDeletingPathExtension stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey] stringByAppendingPathExtension:ext];\n        }\n    } else {\n        return [[key stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey];\n    }\n}\n\nNSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullable key, CGSize thumbnailPixelSize, BOOL preserveAspectRatio) {\n    NSString *thumbnailKey = [NSString stringWithFormat:@\"Thumbnail({%f,%f},%d)\", thumbnailPixelSize.width, thumbnailPixelSize.height, preserveAspectRatio];\n    return SDTransformedKeyForKey(key, thumbnailKey);\n}\n\n@interface SDImagePipelineTransformer ()\n\n@property (nonatomic, copy, readwrite, nonnull) NSArray<id<SDImageTransformer>> *transformers;\n@property (nonatomic, copy, readwrite) NSString *transformerKey;\n\n@end\n\n@implementation SDImagePipelineTransformer\n\n+ (instancetype)transformerWithTransformers:(NSArray<id<SDImageTransformer>> *)transformers {\n    SDImagePipelineTransformer *transformer = [SDImagePipelineTransformer new];\n    transformer.transformers = transformers;\n    transformer.transformerKey = [[self class] cacheKeyForTransformers:transformers];\n    \n    return transformer;\n}\n\n+ (NSString *)cacheKeyForTransformers:(NSArray<id<SDImageTransformer>> *)transformers {\n    if (transformers.count == 0) {\n        return @\"\";\n    }\n    NSMutableArray<NSString *> *cacheKeys = [NSMutableArray arrayWithCapacity:transformers.count];\n    [transformers enumerateObjectsUsingBlock:^(id<SDImageTransformer>  _Nonnull transformer, NSUInteger idx, BOOL * _Nonnull stop) {\n        NSString *cacheKey = transformer.transformerKey;\n        [cacheKeys addObject:cacheKey];\n    }];\n    \n    return [cacheKeys componentsJoinedByString:SDImageTransformerKeySeparator];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    UIImage *transformedImage = image;\n    for (id<SDImageTransformer> transformer in self.transformers) {\n        transformedImage = [transformer transformedImageWithImage:transformedImage forKey:key];\n    }\n    return transformedImage;\n}\n\n@end\n\n@interface SDImageRoundCornerTransformer ()\n\n@property (nonatomic, assign) CGFloat cornerRadius;\n@property (nonatomic, assign) SDRectCorner corners;\n@property (nonatomic, assign) CGFloat borderWidth;\n@property (nonatomic, strong, nullable) UIColor *borderColor;\n\n@end\n\n@implementation SDImageRoundCornerTransformer\n\n+ (instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor {\n    SDImageRoundCornerTransformer *transformer = [SDImageRoundCornerTransformer new];\n    transformer.cornerRadius = cornerRadius;\n    transformer.corners = corners;\n    transformer.borderWidth = borderWidth;\n    transformer.borderColor = borderColor;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    return [NSString stringWithFormat:@\"SDImageRoundCornerTransformer(%f,%lu,%f,%@)\", self.cornerRadius, (unsigned long)self.corners, self.borderWidth, self.borderColor.sd_hexString];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_roundedCornerImageWithRadius:self.cornerRadius corners:self.corners borderWidth:self.borderWidth borderColor:self.borderColor];\n}\n\n@end\n\n@interface SDImageResizingTransformer ()\n\n@property (nonatomic, assign) CGSize size;\n@property (nonatomic, assign) SDImageScaleMode scaleMode;\n\n@end\n\n@implementation SDImageResizingTransformer\n\n+ (instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode {\n    SDImageResizingTransformer *transformer = [SDImageResizingTransformer new];\n    transformer.size = size;\n    transformer.scaleMode = scaleMode;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    CGSize size = self.size;\n    return [NSString stringWithFormat:@\"SDImageResizingTransformer({%f,%f},%lu)\", size.width, size.height, (unsigned long)self.scaleMode];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_resizedImageWithSize:self.size scaleMode:self.scaleMode];\n}\n\n@end\n\n@interface SDImageCroppingTransformer ()\n\n@property (nonatomic, assign) CGRect rect;\n\n@end\n\n@implementation SDImageCroppingTransformer\n\n+ (instancetype)transformerWithRect:(CGRect)rect {\n    SDImageCroppingTransformer *transformer = [SDImageCroppingTransformer new];\n    transformer.rect = rect;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    CGRect rect = self.rect;\n    return [NSString stringWithFormat:@\"SDImageCroppingTransformer({%f,%f,%f,%f})\", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_croppedImageWithRect:self.rect];\n}\n\n@end\n\n@interface SDImageFlippingTransformer ()\n\n@property (nonatomic, assign) BOOL horizontal;\n@property (nonatomic, assign) BOOL vertical;\n\n@end\n\n@implementation SDImageFlippingTransformer\n\n+ (instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical {\n    SDImageFlippingTransformer *transformer = [SDImageFlippingTransformer new];\n    transformer.horizontal = horizontal;\n    transformer.vertical = vertical;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    return [NSString stringWithFormat:@\"SDImageFlippingTransformer(%d,%d)\", self.horizontal, self.vertical];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_flippedImageWithHorizontal:self.horizontal vertical:self.vertical];\n}\n\n@end\n\n@interface SDImageRotationTransformer ()\n\n@property (nonatomic, assign) CGFloat angle;\n@property (nonatomic, assign) BOOL fitSize;\n\n@end\n\n@implementation SDImageRotationTransformer\n\n+ (instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize {\n    SDImageRotationTransformer *transformer = [SDImageRotationTransformer new];\n    transformer.angle = angle;\n    transformer.fitSize = fitSize;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    return [NSString stringWithFormat:@\"SDImageRotationTransformer(%f,%d)\", self.angle, self.fitSize];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_rotatedImageWithAngle:self.angle fitSize:self.fitSize];\n}\n\n@end\n\n#pragma mark - Image Blending\n\n@interface SDImageTintTransformer ()\n\n@property (nonatomic, strong, nonnull) UIColor *tintColor;\n\n@end\n\n@implementation SDImageTintTransformer\n\n+ (instancetype)transformerWithColor:(UIColor *)tintColor {\n    SDImageTintTransformer *transformer = [SDImageTintTransformer new];\n    transformer.tintColor = tintColor;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    return [NSString stringWithFormat:@\"SDImageTintTransformer(%@)\", self.tintColor.sd_hexString];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_tintedImageWithColor:self.tintColor];\n}\n\n@end\n\n#pragma mark - Image Effect\n\n@interface SDImageBlurTransformer ()\n\n@property (nonatomic, assign) CGFloat blurRadius;\n\n@end\n\n@implementation SDImageBlurTransformer\n\n+ (instancetype)transformerWithRadius:(CGFloat)blurRadius {\n    SDImageBlurTransformer *transformer = [SDImageBlurTransformer new];\n    transformer.blurRadius = blurRadius;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    return [NSString stringWithFormat:@\"SDImageBlurTransformer(%f)\", self.blurRadius];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_blurredImageWithRadius:self.blurRadius];\n}\n\n@end\n\n#if SD_UIKIT || SD_MAC\n@interface SDImageFilterTransformer ()\n\n@property (nonatomic, strong, nonnull) CIFilter *filter;\n\n@end\n\n@implementation SDImageFilterTransformer\n\n+ (instancetype)transformerWithFilter:(CIFilter *)filter {\n    SDImageFilterTransformer *transformer = [SDImageFilterTransformer new];\n    transformer.filter = filter;\n    \n    return transformer;\n}\n\n- (NSString *)transformerKey {\n    return [NSString stringWithFormat:@\"SDImageFilterTransformer(%@)\", self.filter.name];\n}\n\n- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {\n    if (!image) {\n        return nil;\n    }\n    return [image sd_filteredImageWithFilter:self.filter];\n}\n\n@end\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n@class SDImageCacheConfig;\n/**\n A protocol to allow custom memory cache used in SDImageCache.\n */\n@protocol SDMemoryCache <NSObject>\n\n@required\n\n/**\n Create a new memory cache instance with the specify cache config. You can check `maxMemoryCost` and `maxMemoryCount` used for memory cache.\n\n @param config The cache config to be used to create the cache.\n @return The new memory cache instance.\n */\n- (nonnull instancetype)initWithConfig:(nonnull SDImageCacheConfig *)config;\n\n/**\n Returns the value associated with a given key.\n\n @param key An object identifying the value. If nil, just return nil.\n @return The value associated with key, or nil if no value is associated with key.\n */\n- (nullable id)objectForKey:(nonnull id)key;\n\n/**\n Sets the value of the specified key in the cache (0 cost).\n\n @param object The object to be stored in the cache. If nil, it calls `removeObjectForKey:`.\n @param key    The key with which to associate the value. If nil, this method has no effect.\n @discussion Unlike an NSMutableDictionary object, a cache does not copy the key\n objects that are put into it.\n */\n- (void)setObject:(nullable id)object forKey:(nonnull id)key;\n\n/**\n Sets the value of the specified key in the cache, and associates the key-value\n pair with the specified cost.\n\n @param object The object to store in the cache. If nil, it calls `removeObjectForKey`.\n @param key    The key with which to associate the value. If nil, this method has no effect.\n @param cost   The cost with which to associate the key-value pair.\n @discussion Unlike an NSMutableDictionary object, a cache does not copy the key\n objects that are put into it.\n */\n- (void)setObject:(nullable id)object forKey:(nonnull id)key cost:(NSUInteger)cost;\n\n/**\n Removes the value of the specified key in the cache.\n\n @param key The key identifying the value to be removed. If nil, this method has no effect.\n */\n- (void)removeObjectForKey:(nonnull id)key;\n\n/**\n Empties the cache immediately.\n */\n- (void)removeAllObjects;\n\n@end\n\n/**\n A memory cache which auto purge the cache on memory warning and support weak cache.\n */\n@interface SDMemoryCache <KeyType, ObjectType> : NSCache <KeyType, ObjectType> <SDMemoryCache>\n\n@property (nonatomic, strong, nonnull, readonly) SDImageCacheConfig *config;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDMemoryCache.h\"\n#import \"SDImageCacheConfig.h\"\n#import \"UIImage+MemoryCacheCost.h\"\n#import \"SDInternalMacros.h\"\n\nstatic void * SDMemoryCacheContext = &SDMemoryCacheContext;\n\n@interface SDMemoryCache <KeyType, ObjectType> () {\n#if SD_UIKIT\n    SD_LOCK_DECLARE(_weakCacheLock); // a lock to keep the access to `weakCache` thread-safe\n#endif\n}\n\n@property (nonatomic, strong, nullable) SDImageCacheConfig *config;\n#if SD_UIKIT\n@property (nonatomic, strong, nonnull) NSMapTable<KeyType, ObjectType> *weakCache; // strong-weak cache\n#endif\n@end\n\n@implementation SDMemoryCache\n\n- (void)dealloc {\n    [_config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCost)) context:SDMemoryCacheContext];\n    [_config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCount)) context:SDMemoryCacheContext];\n#if SD_UIKIT\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n    self.delegate = nil;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _config = [[SDImageCacheConfig alloc] init];\n        [self commonInit];\n    }\n    return self;\n}\n\n- (instancetype)initWithConfig:(SDImageCacheConfig *)config {\n    self = [super init];\n    if (self) {\n        _config = config;\n        [self commonInit];\n    }\n    return self;\n}\n\n- (void)commonInit {\n    SDImageCacheConfig *config = self.config;\n    self.totalCostLimit = config.maxMemoryCost;\n    self.countLimit = config.maxMemoryCount;\n\n    [config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCost)) options:0 context:SDMemoryCacheContext];\n    [config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCount)) options:0 context:SDMemoryCacheContext];\n\n#if SD_UIKIT\n    self.weakCache = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0];\n    SD_LOCK_INIT(_weakCacheLock);\n\n    [[NSNotificationCenter defaultCenter] addObserver:self\n                                             selector:@selector(didReceiveMemoryWarning:)\n                                                 name:UIApplicationDidReceiveMemoryWarningNotification\n                                               object:nil];\n#endif\n}\n\n// Current this seems no use on macOS (macOS use virtual memory and do not clear cache when memory warning). So we only override on iOS/tvOS platform.\n#if SD_UIKIT\n- (void)didReceiveMemoryWarning:(NSNotification *)notification {\n    // Only remove cache, but keep weak cache\n    [super removeAllObjects];\n}\n\n// `setObject:forKey:` just call this with 0 cost. Override this is enough\n- (void)setObject:(id)obj forKey:(id)key cost:(NSUInteger)g {\n    [super setObject:obj forKey:key cost:g];\n    if (!self.config.shouldUseWeakMemoryCache) {\n        return;\n    }\n    if (key && obj) {\n        // Store weak cache\n        SD_LOCK(_weakCacheLock);\n        [self.weakCache setObject:obj forKey:key];\n        SD_UNLOCK(_weakCacheLock);\n    }\n}\n\n- (id)objectForKey:(id)key {\n    id obj = [super objectForKey:key];\n    if (!self.config.shouldUseWeakMemoryCache) {\n        return obj;\n    }\n    if (key && !obj) {\n        // Check weak cache\n        SD_LOCK(_weakCacheLock);\n        obj = [self.weakCache objectForKey:key];\n        SD_UNLOCK(_weakCacheLock);\n        if (obj) {\n            // Sync cache\n            NSUInteger cost = 0;\n            if ([obj isKindOfClass:[UIImage class]]) {\n                cost = [(UIImage *)obj sd_memoryCost];\n            }\n            [super setObject:obj forKey:key cost:cost];\n        }\n    }\n    return obj;\n}\n\n- (void)removeObjectForKey:(id)key {\n    [super removeObjectForKey:key];\n    if (!self.config.shouldUseWeakMemoryCache) {\n        return;\n    }\n    if (key) {\n        // Remove weak cache\n        SD_LOCK(_weakCacheLock);\n        [self.weakCache removeObjectForKey:key];\n        SD_UNLOCK(_weakCacheLock);\n    }\n}\n\n- (void)removeAllObjects {\n    [super removeAllObjects];\n    if (!self.config.shouldUseWeakMemoryCache) {\n        return;\n    }\n    // Manually remove should also remove weak cache\n    SD_LOCK(_weakCacheLock);\n    [self.weakCache removeAllObjects];\n    SD_UNLOCK(_weakCacheLock);\n}\n#endif\n\n#pragma mark - KVO\n\n- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {\n    if (context == SDMemoryCacheContext) {\n        if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxMemoryCost))]) {\n            self.totalCostLimit = self.config.maxMemoryCost;\n        } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxMemoryCount))]) {\n            self.countLimit = self.config.maxMemoryCount;\n        }\n    } else {\n        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\ntypedef NSString * _Nullable(^SDWebImageCacheKeyFilterBlock)(NSURL * _Nonnull url);\n\n/**\n This is the protocol for cache key filter.\n We can use a block to specify the cache key filter. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.\n */\n@protocol SDWebImageCacheKeyFilter <NSObject>\n\n- (nullable NSString *)cacheKeyForURL:(nonnull NSURL *)url;\n\n@end\n\n/**\n A cache key filter class with block.\n */\n@interface SDWebImageCacheKeyFilter : NSObject <SDWebImageCacheKeyFilter>\n\n- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block;\n+ (nonnull instancetype)cacheKeyFilterWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCacheKeyFilter.h\"\n\n@interface SDWebImageCacheKeyFilter ()\n\n@property (nonatomic, copy, nonnull) SDWebImageCacheKeyFilterBlock block;\n\n@end\n\n@implementation SDWebImageCacheKeyFilter\n\n- (instancetype)initWithBlock:(SDWebImageCacheKeyFilterBlock)block {\n    self = [super init];\n    if (self) {\n        self.block = block;\n    }\n    return self;\n}\n\n+ (instancetype)cacheKeyFilterWithBlock:(SDWebImageCacheKeyFilterBlock)block {\n    SDWebImageCacheKeyFilter *cacheKeyFilter = [[SDWebImageCacheKeyFilter alloc] initWithBlock:block];\n    return cacheKeyFilter;\n}\n\n- (NSString *)cacheKeyForURL:(NSURL *)url {\n    if (!self.block) {\n        return nil;\n    }\n    return self.block(url);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\ntypedef NSData * _Nullable(^SDWebImageCacheSerializerBlock)(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL);\n\n/**\n This is the protocol for cache serializer.\n We can use a block to specify the cache serializer. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.\n */\n@protocol SDWebImageCacheSerializer <NSObject>\n\n/// Provide the image data associated to the image and store to disk cache\n/// @param image The loaded image\n/// @param data The original loaded image data\n/// @param imageURL The image URL\n- (nullable NSData *)cacheDataWithImage:(nonnull UIImage *)image originalData:(nullable NSData *)data imageURL:(nullable NSURL *)imageURL;\n\n@end\n\n/**\n A cache serializer class with block.\n */\n@interface SDWebImageCacheSerializer : NSObject <SDWebImageCacheSerializer>\n\n- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheSerializerBlock)block;\n+ (nonnull instancetype)cacheSerializerWithBlock:(nonnull SDWebImageCacheSerializerBlock)block;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCacheSerializer.h\"\n\n@interface SDWebImageCacheSerializer ()\n\n@property (nonatomic, copy, nonnull) SDWebImageCacheSerializerBlock block;\n\n@end\n\n@implementation SDWebImageCacheSerializer\n\n- (instancetype)initWithBlock:(SDWebImageCacheSerializerBlock)block {\n    self = [super init];\n    if (self) {\n        self.block = block;\n    }\n    return self;\n}\n\n+ (instancetype)cacheSerializerWithBlock:(SDWebImageCacheSerializerBlock)block {\n    SDWebImageCacheSerializer *cacheSerializer = [[SDWebImageCacheSerializer alloc] initWithBlock:block];\n    return cacheSerializer;\n}\n\n- (NSData *)cacheDataWithImage:(UIImage *)image originalData:(NSData *)data imageURL:(nullable NSURL *)imageURL {\n    if (!self.block) {\n        return nil;\n    }\n    return self.block(image, data, imageURL);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Jamie Pinkham\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <TargetConditionals.h>\n\n#ifdef __OBJC_GC__\n    #error SDWebImage does not support Objective-C Garbage Collection\n#endif\n\n// Seems like TARGET_OS_MAC is always defined (on all platforms).\n// To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8\n#if TARGET_OS_OSX\n    #define SD_MAC 1\n#else\n    #define SD_MAC 0\n#endif\n\n// iOS and tvOS are very similar, UIKit exists on both platforms\n// Note: watchOS also has UIKit, but it's very limited\n#if TARGET_OS_IOS || TARGET_OS_TV\n    #define SD_UIKIT 1\n#else\n    #define SD_UIKIT 0\n#endif\n\n#if TARGET_OS_IOS\n    #define SD_IOS 1\n#else\n    #define SD_IOS 0\n#endif\n\n#if TARGET_OS_TV\n    #define SD_TV 1\n#else\n    #define SD_TV 0\n#endif\n\n#if TARGET_OS_WATCH\n    #define SD_WATCH 1\n#else\n    #define SD_WATCH 0\n#endif\n\n\n#if SD_MAC\n    #import <AppKit/AppKit.h>\n    #ifndef UIImage\n        #define UIImage NSImage\n    #endif\n    #ifndef UIImageView\n        #define UIImageView NSImageView\n    #endif\n    #ifndef UIView\n        #define UIView NSView\n    #endif\n    #ifndef UIColor\n        #define UIColor NSColor\n    #endif\n#else\n    #if SD_UIKIT\n        #import <UIKit/UIKit.h>\n    #endif\n    #if SD_WATCH\n        #import <WatchKit/WatchKit.h>\n        #ifndef UIView\n            #define UIView WKInterfaceObject\n        #endif\n        #ifndef UIImageView\n            #define UIImageView WKInterfaceImage\n        #endif\n    #endif\n#endif\n\n#ifndef NS_ENUM\n#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type\n#endif\n\n#ifndef NS_OPTIONS\n#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type\n#endif\n\n#ifndef dispatch_main_async_safe\n#define dispatch_main_async_safe(block)\\\n    if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\\\n        block();\\\n    } else {\\\n        dispatch_async(dispatch_get_main_queue(), block);\\\n    }\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if !__has_feature(objc_arc)\n    #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag\n#endif\n\n#if !OS_OBJECT_USE_OBJC\n    #error SDWebImage need ARC for dispatch object\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\ntypedef void(^SDWebImageNoParamsBlock)(void);\ntypedef NSString * SDWebImageContextOption NS_EXTENSIBLE_STRING_ENUM;\ntypedef NSDictionary<SDWebImageContextOption, id> SDWebImageContext;\ntypedef NSMutableDictionary<SDWebImageContextOption, id> SDWebImageMutableContext;\n\n#pragma mark - Image scale\n\n/**\n Return the image scale factor for the specify key, supports file name and url key.\n This is the built-in way to check the scale factor when we have no context about it. Because scale factor is not stored in image data (It's typically from filename).\n However, you can also provide custom scale factor as well, see `SDWebImageContextImageScaleFactor`.\n\n @param key The image cache key\n @return The scale factor for image\n */\nFOUNDATION_EXPORT CGFloat SDImageScaleFactorForKey(NSString * _Nullable key);\n\n/**\n Scale the image with the scale factor for the specify key. If no need to scale, return the original image.\n This works for `UIImage`(UIKit) or `NSImage`(AppKit). And this function also preserve the associated value in `UIImage+Metadata.h`.\n @note This is actually a convenience function, which firstly call `SDImageScaleFactorForKey` and then call `SDScaledImageForScaleFactor`, kept for backward compatibility.\n\n @param key The image cache key\n @param image The image\n @return The scaled image\n */\nFOUNDATION_EXPORT UIImage * _Nullable SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image);\n\n/**\n Scale the image with the scale factor. If no need to scale, return the original image.\n This works for `UIImage`(UIKit) or `NSImage`(AppKit). And this function also preserve the associated value in `UIImage+Metadata.h`.\n \n @param scale The image scale factor\n @param image The image\n @return The scaled image\n */\nFOUNDATION_EXPORT UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage * _Nullable image);\n\n#pragma mark - WebCache Options\n\n/// WebCache options\ntypedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {\n    /**\n     * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying.\n     * This flag disable this blacklisting.\n     */\n    SDWebImageRetryFailed = 1 << 0,\n    \n    /**\n     * By default, image downloads are started during UI interactions, this flags disable this feature,\n     * leading to delayed download on UIScrollView deceleration for instance.\n     */\n    SDWebImageLowPriority = 1 << 1,\n    \n    /**\n     * This flag enables progressive download, the image is displayed progressively during download as a browser would do.\n     * By default, the image is only displayed once completely downloaded.\n     */\n    SDWebImageProgressiveLoad = 1 << 2,\n    \n    /**\n     * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed.\n     * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation.\n     * This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics.\n     * If a cached image is refreshed, the completion block is called once with the cached image and again with the final image.\n     *\n     * Use this flag only if you can't make your URLs static with embedded cache busting parameter.\n     */\n    SDWebImageRefreshCached = 1 << 3,\n    \n    /**\n     * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for\n     * extra time in background to let the request finish. If the background task expires the operation will be cancelled.\n     */\n    SDWebImageContinueInBackground = 1 << 4,\n    \n    /**\n     * Handles cookies stored in NSHTTPCookieStore by setting\n     * NSMutableURLRequest.HTTPShouldHandleCookies = YES;\n     */\n    SDWebImageHandleCookies = 1 << 5,\n    \n    /**\n     * Enable to allow untrusted SSL certificates.\n     * Useful for testing purposes. Use with caution in production.\n     */\n    SDWebImageAllowInvalidSSLCertificates = 1 << 6,\n    \n    /**\n     * By default, images are loaded in the order in which they were queued. This flag moves them to\n     * the front of the queue.\n     */\n    SDWebImageHighPriority = 1 << 7,\n    \n    /**\n     * By default, placeholder images are loaded while the image is loading. This flag will delay the loading\n     * of the placeholder image until after the image has finished loading.\n     */\n    SDWebImageDelayPlaceholder = 1 << 8,\n    \n    /**\n     * We usually don't apply transform on animated images as most transformers could not manage animated images.\n     * Use this flag to transform them anyway.\n     */\n    SDWebImageTransformAnimatedImage = 1 << 9,\n    \n    /**\n     * By default, image is added to the imageView after download. But in some cases, we want to\n     * have the hand before setting the image (apply a filter or add it with cross-fade animation for instance)\n     * Use this flag if you want to manually set the image in the completion when success\n     */\n    SDWebImageAvoidAutoSetImage = 1 << 10,\n    \n    /**\n     * By default, images are decoded respecting their original size.\n     * This flag will scale down the images to a size compatible with the constrained memory of devices.\n     * To control the limit memory bytes, check `SDImageCoderHelper.defaultScaleDownLimitBytes` (Defaults to 60MB on iOS)\n     * This will actually translate to use context option `.imageThumbnailPixelSize` from v5.5.0 (Defaults to (3966, 3966) on iOS). Previously does not.\n     * This flags effect the progressive and animated images as well from v5.5.0. Previously does not.\n     * @note If you need detail controls, it's better to use context option `imageThumbnailPixelSize` and `imagePreserveAspectRatio` instead.\n     */\n    SDWebImageScaleDownLargeImages = 1 << 11,\n    \n    /**\n     * By default, we do not query image data when the image is already cached in memory. This mask can force to query image data at the same time. However, this query is asynchronously unless you specify `SDWebImageQueryMemoryDataSync`\n     */\n    SDWebImageQueryMemoryData = 1 << 12,\n    \n    /**\n     * By default, when you only specify `SDWebImageQueryMemoryData`, we query the memory image data asynchronously. Combined this mask as well to query the memory image data synchronously.\n     * @note Query data synchronously is not recommend, unless you want to ensure the image is loaded in the same runloop to avoid flashing during cell reusing.\n     */\n    SDWebImageQueryMemoryDataSync = 1 << 13,\n    \n    /**\n     * By default, when the memory cache miss, we query the disk cache asynchronously. This mask can force to query disk cache (when memory cache miss) synchronously.\n     * @note These 3 query options can be combined together. For the full list about these masks combination, see wiki page.\n     * @note Query data synchronously is not recommend, unless you want to ensure the image is loaded in the same runloop to avoid flashing during cell reusing.\n     */\n    SDWebImageQueryDiskDataSync = 1 << 14,\n    \n    /**\n     * By default, when the cache missed, the image is load from the loader. This flag can prevent this to load from cache only.\n     */\n    SDWebImageFromCacheOnly = 1 << 15,\n    \n    /**\n     * By default, we query the cache before the image is load from the loader. This flag can prevent this to load from loader only.\n     */\n    SDWebImageFromLoaderOnly = 1 << 16,\n    \n    /**\n     * By default, when you use `SDWebImageTransition` to do some view transition after the image load finished, this transition is only applied for image when the callback from manager is asynchronous (from network, or disk cache query)\n     * This mask can force to apply view transition for any cases, like memory cache query, or sync disk cache query.\n     */\n    SDWebImageForceTransition = 1 << 17,\n    \n    /**\n     * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation.\n     * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image.\n     */\n    SDWebImageAvoidDecodeImage = 1 << 18,\n    \n    /**\n     * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.\n     */\n    SDWebImageDecodeFirstFrameOnly = 1 << 19,\n    \n    /**\n     * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. However, you can specify to preload all frames into memory to reduce CPU usage when the animated image is shared by lots of imageViews.\n     * This will actually trigger `preloadAllAnimatedImageFrames` in the background queue(Disk Cache & Download only).\n     */\n    SDWebImagePreloadAllFrames = 1 << 20,\n    \n    /**\n     * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available to produce one exactlly matching your custom class as a fallback solution.\n     * Using this option, can ensure we always callback image with your provided class. If failed to produce one, a error with code `SDWebImageErrorBadImageData` will been used.\n     * Note this options is not compatible with `SDWebImageDecodeFirstFrameOnly`, which always produce a UIImage/NSImage.\n     */\n    SDWebImageMatchAnimatedImageClass = 1 << 21,\n    \n    /**\n     * By default, when we load the image from network, the image will be written to the cache (memory and disk, controlled by your `storeCacheType` context option)\n     * This maybe an asynchronously operation and the final `SDInternalCompletionBlock` callback does not guarantee the disk cache written is finished and may cause logic error. (For example, you modify the disk data just in completion block, however, the disk cache is not ready)\n     * If you need to process with the disk cache in the completion block, you should use this option to ensure the disk cache already been written when callback.\n     * Note if you use this when using the custom cache serializer, or using the transformer, we will also wait until the output image data written is finished.\n     */\n    SDWebImageWaitStoreCache = 1 << 22,\n    \n    /**\n     * We usually don't apply transform on vector images, because vector images supports dynamically changing to any size, rasterize to a fixed size will loss details. To modify vector images, you can process the vector data at runtime (such as modifying PDF tag / SVG element).\n     * Use this flag to transform them anyway.\n     */\n    SDWebImageTransformVectorImage = 1 << 23\n};\n\n\n#pragma mark - Context Options\n\n/**\n A String to be used as the operation key for view category to store the image load operation. This is used for view instance which supports different image loading process. If nil, will use the class name as operation key. (NSString *)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextSetImageOperationKey;\n\n/**\n A SDWebImageManager instance to control the image download and cache process using in UIImageView+WebCache category and likes. If not provided, use the shared manager (SDWebImageManager *)\n @deprecated Deprecated in the future. This context options can be replaced by other context option control like `.imageCache`, `.imageLoader`, `.imageTransformer` (See below), which already matches all the properties in SDWebImageManager.\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomManager API_DEPRECATED(\"Use individual context option like .imageCache, .imageLoader and .imageTransformer instead\", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED));\n\n/**\n A id<SDImageCache> instance which conforms to `SDImageCache` protocol. It's used to override the image manager's cache during the image loading pipeline.\n In other word, if you just want to specify a custom cache during image loading, you don't need to re-create a dummy SDWebImageManager instance with the cache. If not provided, use the image manager's cache (id<SDImageCache>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageCache;\n\n/**\n A id<SDImageLoader> instance which conforms to `SDImageLoader` protocol. It's used to override the image manager's loader during the image loading pipeline.\n In other word, if you just want to specify a custom loader during image loading, you don't need to re-create a dummy SDWebImageManager instance with the loader. If not provided, use the image manager's cache (id<SDImageLoader>)\n*/\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageLoader;\n\n/**\n A id<SDImageCoder> instance which conforms to `SDImageCoder` protocol. It's used to override the default image coder for image decoding(including progressive) and encoding during the image loading process.\n If you use this context option, we will not always use `SDImageCodersManager.shared` to loop through all registered coders and find the suitable one. Instead, we will arbitrarily use the exact provided coder without extra checking (We may not call `canDecodeFromData:`).\n @note This is only useful for cases which you can ensure the loading url matches your coder, or you find it's too hard to write a common coder which can used for generic usage. This will bind the loading url with the coder logic, which is not always a good design, but possible. (id<SDImageCache>)\n*/\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageCoder;\n\n/**\n A id<SDImageTransformer> instance which conforms `SDImageTransformer` protocol. It's used for image transform after the image load finished and store the transformed image to cache. If you provide one, it will ignore the `transformer` in manager and use provided one instead. If you pass NSNull, the transformer feature will be disabled. (id<SDImageTransformer>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageTransformer;\n\n/**\n A CGFloat raw value which specify the image scale factor. The number should be greater than or equal to 1.0. If not provide or the number is invalid, we will use the cache key to specify the scale factor. (NSNumber)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageScaleFactor;\n\n/**\n A Boolean value indicating whether to keep the original aspect ratio when generating thumbnail images (or bitmap images from vector format).\n Defaults to YES. (NSNumber)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImagePreserveAspectRatio;\n\n/**\n A CGSize raw value indicating whether or not to generate the thumbnail images (or bitmap images from vector format). When this value is provided, the decoder will generate a thumbnail image which pixel size is smaller than or equal to (depends the `.imagePreserveAspectRatio`) the value size.\n @note When you pass `.preserveAspectRatio == NO`, the thumbnail image is stretched to match each dimension. When `.preserveAspectRatio == YES`, the thumbnail image's width is limited to pixel size's width, the thumbnail image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both.\n Defaults to CGSizeZero, which means no thumbnail generation at all. (NSValue)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageThumbnailPixelSize;\n\n/**\n A SDImageCacheType raw value which specify the source of cache to query. Specify `SDImageCacheTypeDisk` to query from disk cache only; `SDImageCacheTypeMemory` to query from memory only. And `SDImageCacheTypeAll` to query from both memory cache and disk cache. Specify `SDImageCacheTypeNone` is invalid and totally ignore the cache query.\n If not provide or the value is invalid, we will use `SDImageCacheTypeAll`. (NSNumber)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextQueryCacheType;\n\n/**\n A SDImageCacheType raw value which specify the store cache type when the image has just been downloaded and will be stored to the cache. Specify `SDImageCacheTypeNone` to disable cache storage; `SDImageCacheTypeDisk` to store in disk cache only; `SDImageCacheTypeMemory` to store in memory only. And `SDImageCacheTypeAll` to store in both memory cache and disk cache.\n If you use image transformer feature, this actually apply for the transformed image, but not the original image itself. Use `SDWebImageContextOriginalStoreCacheType` if you want to control the original image's store cache type at the same time.\n If not provide or the value is invalid, we will use `SDImageCacheTypeAll`. (NSNumber)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextStoreCacheType;\n\n/**\n The same behavior like `SDWebImageContextQueryCacheType`, but control the query cache type for the original image when you use image transformer feature. This allows the detail control of cache query for these two images. For example, if you want to query the transformed image from both memory/disk cache, query the original image from disk cache only, use `[.queryCacheType : .all, .originalQueryCacheType : .disk]`\n If not provide or the value is invalid, we will use `SDImageCacheTypeDisk`, which query the original full image data from disk cache after transformed image cache miss. This is suitable for most common cases to avoid re-downloading the full data for different transform variants. (NSNumber)\n @note Which means, if you set this value to not be `.none`, we will query the original image from cache, then do transform with transformer, instead of actual downloading, which can save bandwidth usage.\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalQueryCacheType;\n\n/**\n The same behavior like `SDWebImageContextStoreCacheType`, but control the store cache type for the original image when you use image transformer feature. This allows the detail control of cache storage for these two images. For example, if you want to store the transformed image into both memory/disk cache, store the original image into disk cache only, use `[.storeCacheType : .all, .originalStoreCacheType : .disk]`\n If not provide or the value is invalid, we will use `SDImageCacheTypeDisk`, which store the original full image data into disk cache after storing the transformed image. This is suitable for most common cases to avoid re-downloading the full data for different transform variants. (NSNumber)\n @note This only store the original image, if you want to use the original image without downloading in next query, specify `SDWebImageContextOriginalQueryCacheType` as well.\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalStoreCacheType;\n\n/**\n A id<SDImageCache> instance which conforms to `SDImageCache` protocol. It's used to control the cache for original image when using the transformer. If you provide one, the original image (full size image) will query and write from that cache instance instead, the transformed image will query and write from the default `SDWebImageContextImageCache` instead. (id<SDImageCache>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalImageCache;\n\n/**\n A Class object which the instance is a `UIImage/NSImage` subclass and adopt `SDAnimatedImage` protocol. We will call `initWithData:scale:options:` to create the instance (or `initWithAnimatedCoder:scale:` when using progressive download) . If the instance create failed, fallback to normal `UIImage/NSImage`.\n This can be used to improve animated images rendering performance (especially memory usage on big animated images) with `SDAnimatedImageView` (Class).\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextAnimatedImageClass;\n\n/**\n A id<SDWebImageDownloaderRequestModifier> instance to modify the image download request. It's used for downloader to modify the original request from URL and options. If you provide one, it will ignore the `requestModifier` in downloader and use provided one instead. (id<SDWebImageDownloaderRequestModifier>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadRequestModifier;\n\n/**\n A id<SDWebImageDownloaderResponseModifier> instance to modify the image download response. It's used for downloader to modify the original response from URL and options.  If you provide one, it will ignore the `responseModifier` in downloader and use provided one instead. (id<SDWebImageDownloaderResponseModifier>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadResponseModifier;\n\n/**\n A id<SDWebImageContextDownloadDecryptor> instance to decrypt the image download data. This can be used for image data decryption, such as Base64 encoded image. If you provide one, it will ignore the `decryptor` in downloader and use provided one instead. (id<SDWebImageContextDownloadDecryptor>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadDecryptor;\n\n/**\n A id<SDWebImageCacheKeyFilter> instance to convert an URL into a cache key. It's used when manager need cache key to use image cache. If you provide one, it will ignore the `cacheKeyFilter` in manager and use provided one instead. (id<SDWebImageCacheKeyFilter>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCacheKeyFilter;\n\n/**\n A id<SDWebImageCacheSerializer> instance to convert the decoded image, the source downloaded data, to the actual data. It's used for manager to store image to the disk cache. If you provide one, it will ignore the `cacheSerializer` in manager and use provided one instead. (id<SDWebImageCacheSerializer>)\n */\nFOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCacheSerializer;\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageDefine.h\"\n#import \"UIImage+Metadata.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDAssociatedObject.h\"\n\n#pragma mark - Image scale\n\nstatic inline NSArray<NSNumber *> * _Nonnull SDImageScaleFactors() {\n    return @[@2, @3];\n}\n\ninline CGFloat SDImageScaleFactorForKey(NSString * _Nullable key) {\n    CGFloat scale = 1;\n    if (!key) {\n        return scale;\n    }\n    // Check if target OS support scale\n#if SD_WATCH\n    if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)])\n#elif SD_UIKIT\n    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])\n#elif SD_MAC\n    if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])\n#endif\n    {\n        // a@2x.png -> 8\n        if (key.length >= 8) {\n            // Fast check\n            BOOL isURL = [key hasPrefix:@\"http://\"] || [key hasPrefix:@\"https://\"];\n            for (NSNumber *scaleFactor in SDImageScaleFactors()) {\n                // @2x. for file name and normal url\n                NSString *fileScale = [NSString stringWithFormat:@\"@%@x.\", scaleFactor];\n                if ([key containsString:fileScale]) {\n                    scale = scaleFactor.doubleValue;\n                    return scale;\n                }\n                if (isURL) {\n                    // %402x. for url encode\n                    NSString *urlScale = [NSString stringWithFormat:@\"%%40%@x.\", scaleFactor];\n                    if ([key containsString:urlScale]) {\n                        scale = scaleFactor.doubleValue;\n                        return scale;\n                    }\n                }\n            }\n        }\n    }\n    return scale;\n}\n\ninline UIImage * _Nullable SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) {\n    if (!image) {\n        return nil;\n    }\n    CGFloat scale = SDImageScaleFactorForKey(key);\n    return SDScaledImageForScaleFactor(scale, image);\n}\n\ninline UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage * _Nullable image) {\n    if (!image) {\n        return nil;\n    }\n    if (scale <= 1) {\n        return image;\n    }\n    if (scale == image.scale) {\n        return image;\n    }\n    UIImage *scaledImage;\n    if (image.sd_isAnimated) {\n        UIImage *animatedImage;\n#if SD_UIKIT || SD_WATCH\n        // `UIAnimatedImage` images share the same size and scale.\n        NSMutableArray<UIImage *> *scaledImages = [NSMutableArray array];\n        \n        for (UIImage *tempImage in image.images) {\n            UIImage *tempScaledImage = [[UIImage alloc] initWithCGImage:tempImage.CGImage scale:scale orientation:tempImage.imageOrientation];\n            [scaledImages addObject:tempScaledImage];\n        }\n        \n        animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration];\n        animatedImage.sd_imageLoopCount = image.sd_imageLoopCount;\n#else\n        // Animated GIF for `NSImage` need to grab `NSBitmapImageRep`;\n        NSRect imageRect = NSMakeRect(0, 0, image.size.width, image.size.height);\n        NSImageRep *imageRep = [image bestRepresentationForRect:imageRect context:nil hints:nil];\n        NSBitmapImageRep *bitmapImageRep;\n        if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) {\n            bitmapImageRep = (NSBitmapImageRep *)imageRep;\n        }\n        if (bitmapImageRep) {\n            NSSize size = NSMakeSize(image.size.width / scale, image.size.height / scale);\n            animatedImage = [[NSImage alloc] initWithSize:size];\n            bitmapImageRep.size = size;\n            [animatedImage addRepresentation:bitmapImageRep];\n        }\n#endif\n        scaledImage = animatedImage;\n    } else {\n#if SD_UIKIT || SD_WATCH\n        scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation];\n#else\n        scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:kCGImagePropertyOrientationUp];\n#endif\n    }\n    SDImageCopyAssociatedObject(image, scaledImage);\n    \n    return scaledImage;\n}\n\n#pragma mark - Context option\n\nSDWebImageContextOption const SDWebImageContextSetImageOperationKey = @\"setImageOperationKey\";\nSDWebImageContextOption const SDWebImageContextCustomManager = @\"customManager\";\nSDWebImageContextOption const SDWebImageContextImageCache = @\"imageCache\";\nSDWebImageContextOption const SDWebImageContextImageLoader = @\"imageLoader\";\nSDWebImageContextOption const SDWebImageContextImageCoder = @\"imageCoder\";\nSDWebImageContextOption const SDWebImageContextImageTransformer = @\"imageTransformer\";\nSDWebImageContextOption const SDWebImageContextImageScaleFactor = @\"imageScaleFactor\";\nSDWebImageContextOption const SDWebImageContextImagePreserveAspectRatio = @\"imagePreserveAspectRatio\";\nSDWebImageContextOption const SDWebImageContextImageThumbnailPixelSize = @\"imageThumbnailPixelSize\";\nSDWebImageContextOption const SDWebImageContextQueryCacheType = @\"queryCacheType\";\nSDWebImageContextOption const SDWebImageContextStoreCacheType = @\"storeCacheType\";\nSDWebImageContextOption const SDWebImageContextOriginalQueryCacheType = @\"originalQueryCacheType\";\nSDWebImageContextOption const SDWebImageContextOriginalStoreCacheType = @\"originalStoreCacheType\";\nSDWebImageContextOption const SDWebImageContextOriginalImageCache = @\"originalImageCache\";\nSDWebImageContextOption const SDWebImageContextAnimatedImageClass = @\"animatedImageClass\";\nSDWebImageContextOption const SDWebImageContextDownloadRequestModifier = @\"downloadRequestModifier\";\nSDWebImageContextOption const SDWebImageContextDownloadResponseModifier = @\"downloadResponseModifier\";\nSDWebImageContextOption const SDWebImageContextDownloadDecryptor = @\"downloadDecryptor\";\nSDWebImageContextOption const SDWebImageContextCacheKeyFilter = @\"cacheKeyFilter\";\nSDWebImageContextOption const SDWebImageContextCacheSerializer = @\"cacheSerializer\";\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageDefine.h\"\n#import \"SDWebImageOperation.h\"\n#import \"SDWebImageDownloaderConfig.h\"\n#import \"SDWebImageDownloaderRequestModifier.h\"\n#import \"SDWebImageDownloaderResponseModifier.h\"\n#import \"SDWebImageDownloaderDecryptor.h\"\n#import \"SDImageLoader.h\"\n\n/// Downloader options\ntypedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {\n    /**\n     * Put the download in the low queue priority and task priority.\n     */\n    SDWebImageDownloaderLowPriority = 1 << 0,\n    \n    /**\n     * This flag enables progressive download, the image is displayed progressively during download as a browser would do.\n     */\n    SDWebImageDownloaderProgressiveLoad = 1 << 1,\n\n    /**\n     * By default, request prevent the use of NSURLCache. With this flag, NSURLCache\n     * is used with default policies.\n     */\n    SDWebImageDownloaderUseNSURLCache = 1 << 2,\n\n    /**\n     * Call completion block with nil image/imageData if the image was read from NSURLCache\n     * And the error code is `SDWebImageErrorCacheNotModified`\n     * This flag should be combined with `SDWebImageDownloaderUseNSURLCache`.\n     */\n    SDWebImageDownloaderIgnoreCachedResponse = 1 << 3,\n    \n    /**\n     * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for\n     * extra time in background to let the request finish. If the background task expires the operation will be cancelled.\n     */\n    SDWebImageDownloaderContinueInBackground = 1 << 4,\n\n    /**\n     * Handles cookies stored in NSHTTPCookieStore by setting \n     * NSMutableURLRequest.HTTPShouldHandleCookies = YES;\n     */\n    SDWebImageDownloaderHandleCookies = 1 << 5,\n\n    /**\n     * Enable to allow untrusted SSL certificates.\n     * Useful for testing purposes. Use with caution in production.\n     */\n    SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6,\n\n    /**\n     * Put the download in the high queue priority and task priority.\n     */\n    SDWebImageDownloaderHighPriority = 1 << 7,\n    \n    /**\n     * By default, images are decoded respecting their original size. On iOS, this flag will scale down the\n     * images to a size compatible with the constrained memory of devices.\n     * This flag take no effect if `SDWebImageDownloaderAvoidDecodeImage` is set. And it will be ignored if `SDWebImageDownloaderProgressiveLoad` is set.\n     */\n    SDWebImageDownloaderScaleDownLargeImages = 1 << 8,\n    \n    /**\n     * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation.\n     * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image.\n     */\n    SDWebImageDownloaderAvoidDecodeImage = 1 << 9,\n    \n    /**\n     * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.\n     */\n    SDWebImageDownloaderDecodeFirstFrameOnly = 1 << 10,\n    \n    /**\n     * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from network\n     */\n    SDWebImageDownloaderPreloadAllFrames = 1 << 11,\n    \n    /**\n     * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution.\n     * Using this option, can ensure we always produce image with your provided class. If failed, a error with code `SDWebImageErrorBadImageData` will been used.\n     * Note this options is not compatible with `SDWebImageDownloaderDecodeFirstFrameOnly`, which always produce a UIImage/NSImage.\n     */\n    SDWebImageDownloaderMatchAnimatedImageClass = 1 << 12,\n};\n\nFOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStartNotification;\nFOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadReceiveResponseNotification;\nFOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStopNotification;\nFOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadFinishNotification;\n\ntypedef SDImageLoaderProgressBlock SDWebImageDownloaderProgressBlock;\ntypedef SDImageLoaderCompletedBlock SDWebImageDownloaderCompletedBlock;\n\n/**\n *  A token associated with each download. Can be used to cancel a download\n */\n@interface SDWebImageDownloadToken : NSObject <SDWebImageOperation>\n\n/**\n Cancel the current download.\n */\n- (void)cancel;\n\n/**\n The download's URL.\n */\n@property (nonatomic, strong, nullable, readonly) NSURL *url;\n\n/**\n The download's request.\n */\n@property (nonatomic, strong, nullable, readonly) NSURLRequest *request;\n\n/**\n The download's response.\n */\n@property (nonatomic, strong, nullable, readonly) NSURLResponse *response;\n\n/**\n The download's metrics. This will be nil if download operation does not support metrics.\n */\n@property (nonatomic, strong, nullable, readonly) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));\n\n@end\n\n\n/**\n * Asynchronous downloader dedicated and optimized for image loading.\n */\n@interface SDWebImageDownloader : NSObject\n\n/**\n * Downloader Config object - storing all kind of settings.\n * Most config properties support dynamic changes during download, except something like `sessionConfiguration`, see `SDWebImageDownloaderConfig` for more detail.\n */\n@property (nonatomic, copy, readonly, nonnull) SDWebImageDownloaderConfig *config;\n\n/**\n * Set the request modifier to modify the original download request before image load.\n * This request modifier method will be called for each downloading image request. Return the original request means no modification. Return nil will cancel the download request.\n * Defaults to nil, means does not modify the original download request.\n * @note If you want to modify single request, consider using `SDWebImageContextDownloadRequestModifier` context option.\n */\n@property (nonatomic, strong, nullable) id<SDWebImageDownloaderRequestModifier> requestModifier;\n\n/**\n * Set the response modifier to modify the original download response during image load.\n * This response modifier method will be called for each downloading image response. Return the original response means no modification. Return nil will mark current download as cancelled.\n * Defaults to nil, means does not modify the original download response.\n * @note If you want to modify single response, consider using `SDWebImageContextDownloadResponseModifier` context option.\n */\n@property (nonatomic, strong, nullable) id<SDWebImageDownloaderResponseModifier> responseModifier;\n\n/**\n * Set the decryptor to decrypt the original download data before image decoding. This can be used for encrypted image data, like Base64.\n * This decryptor method will be called for each downloading image data. Return the original data means no modification. Return nil will mark this download failed.\n * Defaults to nil, means does not modify the original download data.\n * @note When using decryptor, progressive decoding will be disabled, to avoid data corrupt issue.\n * @note If you want to decrypt single download data, consider using `SDWebImageContextDownloadDecryptor` context option.\n */\n@property (nonatomic, strong, nullable) id<SDWebImageDownloaderDecryptor> decryptor;\n\n/**\n * The configuration in use by the internal NSURLSession. If you want to provide a custom sessionConfiguration, use `SDWebImageDownloaderConfig.sessionConfiguration` and create a new downloader instance.\n @note This is immutable according to NSURLSession's documentation. Mutating this object directly has no effect.\n */\n@property (nonatomic, readonly, nonnull) NSURLSessionConfiguration *sessionConfiguration;\n\n/**\n * Gets/Sets the download queue suspension state.\n */\n@property (nonatomic, assign, getter=isSuspended) BOOL suspended;\n\n/**\n * Shows the current amount of downloads that still need to be downloaded\n */\n@property (nonatomic, assign, readonly) NSUInteger currentDownloadCount;\n\n/**\n *  Returns the global shared downloader instance. Which use the `SDWebImageDownloaderConfig.defaultDownloaderConfig` config.\n */\n@property (nonatomic, class, readonly, nonnull) SDWebImageDownloader *sharedDownloader;\n\n/**\n Creates an instance of a downloader with specified downloader config.\n You can specify session configuration, timeout or operation class through downloader config.\n\n @param config The downloader config. If you specify nil, the `defaultDownloaderConfig` will be used.\n @return new instance of downloader class\n */\n- (nonnull instancetype)initWithConfig:(nullable SDWebImageDownloaderConfig *)config NS_DESIGNATED_INITIALIZER;\n\n/**\n * Set a value for a HTTP header to be appended to each download HTTP request.\n *\n * @param value The value for the header field. Use `nil` value to remove the header field.\n * @param field The name of the header field to set.\n */\n- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field;\n\n/**\n * Returns the value of the specified HTTP header field.\n *\n * @return The value associated with the header field field, or `nil` if there is no corresponding header field.\n */\n- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field;\n\n/**\n * Creates a SDWebImageDownloader async downloader instance with a given URL\n *\n * The delegate will be informed when the image is finish downloaded or an error has happen.\n *\n * @see SDWebImageDownloaderDelegate\n *\n * @param url            The URL to the image to download\n * @param completedBlock A block called once the download is completed.\n *                       If the download succeeded, the image parameter is set, in case of error,\n *                       error parameter is set with the error. The last parameter is always YES\n *                       if SDWebImageDownloaderProgressiveDownload isn't use. With the\n *                       SDWebImageDownloaderProgressiveDownload option, this block is called\n *                       repeatedly with the partial image object and the finished argument set to NO\n *                       before to be called a last time with the full image and finished argument\n *                       set to YES. In case of error, the finished argument is always YES.\n *\n * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation\n */\n- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url\n                                                 completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;\n\n/**\n * Creates a SDWebImageDownloader async downloader instance with a given URL\n *\n * The delegate will be informed when the image is finish downloaded or an error has happen.\n *\n * @see SDWebImageDownloaderDelegate\n *\n * @param url            The URL to the image to download\n * @param options        The options to be used for this download\n * @param progressBlock  A block called repeatedly while the image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called once the download is completed.\n *                       If the download succeeded, the image parameter is set, in case of error,\n *                       error parameter is set with the error. The last parameter is always YES\n *                       if SDWebImageDownloaderProgressiveLoad isn't use. With the\n *                       SDWebImageDownloaderProgressiveLoad option, this block is called\n *                       repeatedly with the partial image object and the finished argument set to NO\n *                       before to be called a last time with the full image and finished argument\n *                       set to YES. In case of error, the finished argument is always YES.\n *\n * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation\n */\n- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url\n                                                   options:(SDWebImageDownloaderOptions)options\n                                                  progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock\n                                                 completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;\n\n/**\n * Creates a SDWebImageDownloader async downloader instance with a given URL\n *\n * The delegate will be informed when the image is finish downloaded or an error has happen.\n *\n * @see SDWebImageDownloaderDelegate\n *\n * @param url            The URL to the image to download\n * @param options        The options to be used for this download\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called repeatedly while the image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called once the download is completed.\n *\n * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation\n */\n- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url\n                                                   options:(SDWebImageDownloaderOptions)options\n                                                   context:(nullable SDWebImageContext *)context\n                                                  progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock\n                                                 completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;\n\n/**\n * Cancels all download operations in the queue\n */\n- (void)cancelAllDownloads;\n\n/**\n * Invalidates the managed session, optionally canceling pending operations.\n * @note If you use custom downloader instead of the shared downloader, you need call this method when you do not use it to avoid memory leak\n * @param cancelPendingOperations Whether or not to cancel pending operations.\n * @note Calling this method on the shared downloader has no effect.\n */\n- (void)invalidateSessionAndCancel:(BOOL)cancelPendingOperations;\n\n@end\n\n\n/**\n SDWebImageDownloader is the built-in image loader conform to `SDImageLoader`. Which provide the HTTP/HTTPS/FTP download, or local file URL using NSURLSession.\n However, this downloader class itself also support customization for advanced users. You can specify `operationClass` in download config to custom download operation, See `SDWebImageDownloaderOperation`.\n If you want to provide some image loader which beyond network or local file, consider to create your own custom class conform to `SDImageLoader`.\n */\n@interface SDWebImageDownloader (SDImageLoader) <SDImageLoader>\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageDownloader.h\"\n#import \"SDWebImageDownloaderConfig.h\"\n#import \"SDWebImageDownloaderOperation.h\"\n#import \"SDWebImageError.h\"\n#import \"SDInternalMacros.h\"\n\nNSNotificationName const SDWebImageDownloadStartNotification = @\"SDWebImageDownloadStartNotification\";\nNSNotificationName const SDWebImageDownloadReceiveResponseNotification = @\"SDWebImageDownloadReceiveResponseNotification\";\nNSNotificationName const SDWebImageDownloadStopNotification = @\"SDWebImageDownloadStopNotification\";\nNSNotificationName const SDWebImageDownloadFinishNotification = @\"SDWebImageDownloadFinishNotification\";\n\nstatic void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext;\n\n@interface SDWebImageDownloadToken ()\n\n@property (nonatomic, strong, nullable, readwrite) NSURL *url;\n@property (nonatomic, strong, nullable, readwrite) NSURLRequest *request;\n@property (nonatomic, strong, nullable, readwrite) NSURLResponse *response;\n@property (nonatomic, strong, nullable, readwrite) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));\n@property (nonatomic, weak, nullable, readwrite) id downloadOperationCancelToken;\n@property (nonatomic, weak, nullable) NSOperation<SDWebImageDownloaderOperation> *downloadOperation;\n@property (nonatomic, assign, getter=isCancelled) BOOL cancelled;\n\n- (nonnull instancetype)init NS_UNAVAILABLE;\n+ (nonnull instancetype)new  NS_UNAVAILABLE;\n- (nonnull instancetype)initWithDownloadOperation:(nullable NSOperation<SDWebImageDownloaderOperation> *)downloadOperation;\n\n@end\n\n@interface SDWebImageDownloader () <NSURLSessionTaskDelegate, NSURLSessionDataDelegate>\n\n@property (strong, nonatomic, nonnull) NSOperationQueue *downloadQueue;\n@property (strong, nonatomic, nonnull) NSMutableDictionary<NSURL *, NSOperation<SDWebImageDownloaderOperation> *> *URLOperations;\n@property (strong, nonatomic, nullable) NSMutableDictionary<NSString *, NSString *> *HTTPHeaders;\n\n// The session in which data tasks will run\n@property (strong, nonatomic) NSURLSession *session;\n\n@end\n\n@implementation SDWebImageDownloader {\n    SD_LOCK_DECLARE(_HTTPHeadersLock); // A lock to keep the access to `HTTPHeaders` thread-safe\n    SD_LOCK_DECLARE(_operationsLock); // A lock to keep the access to `URLOperations` thread-safe\n}\n\n+ (void)initialize {\n    // Bind SDNetworkActivityIndicator if available (download it here: http://github.com/rs/SDNetworkActivityIndicator )\n    // To use it, just add #import \"SDNetworkActivityIndicator.h\" in addition to the SDWebImage import\n    if (NSClassFromString(@\"SDNetworkActivityIndicator\")) {\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Warc-performSelector-leaks\"\n        id activityIndicator = [NSClassFromString(@\"SDNetworkActivityIndicator\") performSelector:NSSelectorFromString(@\"sharedActivityIndicator\")];\n#pragma clang diagnostic pop\n\n        // Remove observer in case it was previously added.\n        [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStartNotification object:nil];\n        [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStopNotification object:nil];\n\n        [[NSNotificationCenter defaultCenter] addObserver:activityIndicator\n                                                 selector:NSSelectorFromString(@\"startActivity\")\n                                                     name:SDWebImageDownloadStartNotification object:nil];\n        [[NSNotificationCenter defaultCenter] addObserver:activityIndicator\n                                                 selector:NSSelectorFromString(@\"stopActivity\")\n                                                     name:SDWebImageDownloadStopNotification object:nil];\n    }\n}\n\n+ (nonnull instancetype)sharedDownloader {\n    static dispatch_once_t once;\n    static id instance;\n    dispatch_once(&once, ^{\n        instance = [self new];\n    });\n    return instance;\n}\n\n- (nonnull instancetype)init {\n    return [self initWithConfig:SDWebImageDownloaderConfig.defaultDownloaderConfig];\n}\n\n- (instancetype)initWithConfig:(SDWebImageDownloaderConfig *)config {\n    self = [super init];\n    if (self) {\n        if (!config) {\n            config = SDWebImageDownloaderConfig.defaultDownloaderConfig;\n        }\n        _config = [config copy];\n        [_config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxConcurrentDownloads)) options:0 context:SDWebImageDownloaderContext];\n        _downloadQueue = [NSOperationQueue new];\n        _downloadQueue.maxConcurrentOperationCount = _config.maxConcurrentDownloads;\n        _downloadQueue.name = @\"com.hackemist.SDWebImageDownloader\";\n        _URLOperations = [NSMutableDictionary new];\n        NSMutableDictionary<NSString *, NSString *> *headerDictionary = [NSMutableDictionary dictionary];\n        NSString *userAgent = nil;\n#if SD_UIKIT\n        // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43\n        userAgent = [NSString stringWithFormat:@\"%@/%@ (%@; iOS %@; Scale/%0.2f)\", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@\"CFBundleShortVersionString\"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]];\n#elif SD_WATCH\n        // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43\n        userAgent = [NSString stringWithFormat:@\"%@/%@ (%@; watchOS %@; Scale/%0.2f)\", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@\"CFBundleShortVersionString\"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]];\n#elif SD_MAC\n        userAgent = [NSString stringWithFormat:@\"%@/%@ (Mac OS X %@)\", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@\"CFBundleShortVersionString\"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]];\n#endif\n        if (userAgent) {\n            if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) {\n                NSMutableString *mutableUserAgent = [userAgent mutableCopy];\n                if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@\"Any-Latin; Latin-ASCII; [:^ASCII:] Remove\", false)) {\n                    userAgent = mutableUserAgent;\n                }\n            }\n            headerDictionary[@\"User-Agent\"] = userAgent;\n        }\n        headerDictionary[@\"Accept\"] = @\"image/*,*/*;q=0.8\";\n        _HTTPHeaders = headerDictionary;\n        SD_LOCK_INIT(_HTTPHeadersLock);\n        SD_LOCK_INIT(_operationsLock);\n        NSURLSessionConfiguration *sessionConfiguration = _config.sessionConfiguration;\n        if (!sessionConfiguration) {\n            sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration];\n        }\n        /**\n         *  Create the session for this task\n         *  We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate\n         *  method calls and completion handler calls.\n         */\n        _session = [NSURLSession sessionWithConfiguration:sessionConfiguration\n                                                 delegate:self\n                                            delegateQueue:nil];\n    }\n    return self;\n}\n\n- (void)dealloc {\n    [self.downloadQueue cancelAllOperations];\n    [self.config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxConcurrentDownloads)) context:SDWebImageDownloaderContext];\n    \n    // Invalide the URLSession after all operations been cancelled\n    [self.session invalidateAndCancel];\n    self.session = nil;\n}\n\n- (void)invalidateSessionAndCancel:(BOOL)cancelPendingOperations {\n    if (self == [SDWebImageDownloader sharedDownloader]) {\n        return;\n    }\n    if (cancelPendingOperations) {\n        [self.session invalidateAndCancel];\n    } else {\n        [self.session finishTasksAndInvalidate];\n    }\n}\n\n- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field {\n    if (!field) {\n        return;\n    }\n    SD_LOCK(_HTTPHeadersLock);\n    [self.HTTPHeaders setValue:value forKey:field];\n    SD_UNLOCK(_HTTPHeadersLock);\n}\n\n- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field {\n    if (!field) {\n        return nil;\n    }\n    SD_LOCK(_HTTPHeadersLock);\n    NSString *value = [self.HTTPHeaders objectForKey:field];\n    SD_UNLOCK(_HTTPHeadersLock);\n    return value;\n}\n\n- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(NSURL *)url\n                                                 completed:(SDWebImageDownloaderCompletedBlock)completedBlock {\n    return [self downloadImageWithURL:url options:0 progress:nil completed:completedBlock];\n}\n\n- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(NSURL *)url\n                                                   options:(SDWebImageDownloaderOptions)options\n                                                  progress:(SDWebImageDownloaderProgressBlock)progressBlock\n                                                 completed:(SDWebImageDownloaderCompletedBlock)completedBlock {\n    return [self downloadImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url\n                                                   options:(SDWebImageDownloaderOptions)options\n                                                   context:(nullable SDWebImageContext *)context\n                                                  progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock\n                                                 completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock {\n    // The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data.\n    if (url == nil) {\n        if (completedBlock) {\n            NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey : @\"Image url is nil\"}];\n            completedBlock(nil, nil, error, YES);\n        }\n        return nil;\n    }\n    \n    SD_LOCK(_operationsLock);\n    id downloadOperationCancelToken;\n    NSOperation<SDWebImageDownloaderOperation> *operation = [self.URLOperations objectForKey:url];\n    // There is a case that the operation may be marked as finished or cancelled, but not been removed from `self.URLOperations`.\n    if (!operation || operation.isFinished || operation.isCancelled) {\n        operation = [self createDownloaderOperationWithUrl:url options:options context:context];\n        if (!operation) {\n            SD_UNLOCK(_operationsLock);\n            if (completedBlock) {\n                NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @\"Downloader operation is nil\"}];\n                completedBlock(nil, nil, error, YES);\n            }\n            return nil;\n        }\n        @weakify(self);\n        operation.completionBlock = ^{\n            @strongify(self);\n            if (!self) {\n                return;\n            }\n            SD_LOCK(self->_operationsLock);\n            [self.URLOperations removeObjectForKey:url];\n            SD_UNLOCK(self->_operationsLock);\n        };\n        self.URLOperations[url] = operation;\n        // Add the handlers before submitting to operation queue, avoid the race condition that operation finished before setting handlers.\n        downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock];\n        // Add operation to operation queue only after all configuration done according to Apple's doc.\n        // `addOperation:` does not synchronously execute the `operation.completionBlock` so this will not cause deadlock.\n        [self.downloadQueue addOperation:operation];\n    } else {\n        // When we reuse the download operation to attach more callbacks, there may be thread safe issue because the getter of callbacks may in another queue (decoding queue or delegate queue)\n        // So we lock the operation here, and in `SDWebImageDownloaderOperation`, we use `@synchonzied (self)`, to ensure the thread safe between these two classes.\n        @synchronized (operation) {\n            downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock];\n        }\n        if (!operation.isExecuting) {\n            if (options & SDWebImageDownloaderHighPriority) {\n                operation.queuePriority = NSOperationQueuePriorityHigh;\n            } else if (options & SDWebImageDownloaderLowPriority) {\n                operation.queuePriority = NSOperationQueuePriorityLow;\n            } else {\n                operation.queuePriority = NSOperationQueuePriorityNormal;\n            }\n        }\n    }\n    SD_UNLOCK(_operationsLock);\n    \n    SDWebImageDownloadToken *token = [[SDWebImageDownloadToken alloc] initWithDownloadOperation:operation];\n    token.url = url;\n    token.request = operation.request;\n    token.downloadOperationCancelToken = downloadOperationCancelToken;\n    \n    return token;\n}\n\n- (nullable NSOperation<SDWebImageDownloaderOperation> *)createDownloaderOperationWithUrl:(nonnull NSURL *)url\n                                                                                  options:(SDWebImageDownloaderOptions)options\n                                                                                  context:(nullable SDWebImageContext *)context {\n    NSTimeInterval timeoutInterval = self.config.downloadTimeout;\n    if (timeoutInterval == 0.0) {\n        timeoutInterval = 15.0;\n    }\n    \n    // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise\n    NSURLRequestCachePolicy cachePolicy = options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData;\n    NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:cachePolicy timeoutInterval:timeoutInterval];\n    mutableRequest.HTTPShouldHandleCookies = SD_OPTIONS_CONTAINS(options, SDWebImageDownloaderHandleCookies);\n    mutableRequest.HTTPShouldUsePipelining = YES;\n    SD_LOCK(_HTTPHeadersLock);\n    mutableRequest.allHTTPHeaderFields = self.HTTPHeaders;\n    SD_UNLOCK(_HTTPHeadersLock);\n    \n    // Context Option\n    SDWebImageMutableContext *mutableContext;\n    if (context) {\n        mutableContext = [context mutableCopy];\n    } else {\n        mutableContext = [NSMutableDictionary dictionary];\n    }\n    \n    // Request Modifier\n    id<SDWebImageDownloaderRequestModifier> requestModifier;\n    if ([context valueForKey:SDWebImageContextDownloadRequestModifier]) {\n        requestModifier = [context valueForKey:SDWebImageContextDownloadRequestModifier];\n    } else {\n        requestModifier = self.requestModifier;\n    }\n    \n    NSURLRequest *request;\n    if (requestModifier) {\n        NSURLRequest *modifiedRequest = [requestModifier modifiedRequestWithRequest:[mutableRequest copy]];\n        // If modified request is nil, early return\n        if (!modifiedRequest) {\n            return nil;\n        } else {\n            request = [modifiedRequest copy];\n        }\n    } else {\n        request = [mutableRequest copy];\n    }\n    // Response Modifier\n    id<SDWebImageDownloaderResponseModifier> responseModifier;\n    if ([context valueForKey:SDWebImageContextDownloadResponseModifier]) {\n        responseModifier = [context valueForKey:SDWebImageContextDownloadResponseModifier];\n    } else {\n        responseModifier = self.responseModifier;\n    }\n    if (responseModifier) {\n        mutableContext[SDWebImageContextDownloadResponseModifier] = responseModifier;\n    }\n    // Decryptor\n    id<SDWebImageDownloaderDecryptor> decryptor;\n    if ([context valueForKey:SDWebImageContextDownloadDecryptor]) {\n        decryptor = [context valueForKey:SDWebImageContextDownloadDecryptor];\n    } else {\n        decryptor = self.decryptor;\n    }\n    if (decryptor) {\n        mutableContext[SDWebImageContextDownloadDecryptor] = decryptor;\n    }\n    \n    context = [mutableContext copy];\n    \n    // Operation Class\n    Class operationClass = self.config.operationClass;\n    if (operationClass && [operationClass isSubclassOfClass:[NSOperation class]] && [operationClass conformsToProtocol:@protocol(SDWebImageDownloaderOperation)]) {\n        // Custom operation class\n    } else {\n        operationClass = [SDWebImageDownloaderOperation class];\n    }\n    NSOperation<SDWebImageDownloaderOperation> *operation = [[operationClass alloc] initWithRequest:request inSession:self.session options:options context:context];\n    \n    if ([operation respondsToSelector:@selector(setCredential:)]) {\n        if (self.config.urlCredential) {\n            operation.credential = self.config.urlCredential;\n        } else if (self.config.username && self.config.password) {\n            operation.credential = [NSURLCredential credentialWithUser:self.config.username password:self.config.password persistence:NSURLCredentialPersistenceForSession];\n        }\n    }\n        \n    if ([operation respondsToSelector:@selector(setMinimumProgressInterval:)]) {\n        operation.minimumProgressInterval = MIN(MAX(self.config.minimumProgressInterval, 0), 1);\n    }\n    \n    if ([operation respondsToSelector:@selector(setAcceptableStatusCodes:)]) {\n        operation.acceptableStatusCodes = self.config.acceptableStatusCodes;\n    }\n    \n    if ([operation respondsToSelector:@selector(setAcceptableContentTypes:)]) {\n        operation.acceptableContentTypes = self.config.acceptableContentTypes;\n    }\n    \n    if (options & SDWebImageDownloaderHighPriority) {\n        operation.queuePriority = NSOperationQueuePriorityHigh;\n    } else if (options & SDWebImageDownloaderLowPriority) {\n        operation.queuePriority = NSOperationQueuePriorityLow;\n    }\n    \n    if (self.config.executionOrder == SDWebImageDownloaderLIFOExecutionOrder) {\n        // Emulate LIFO execution order by systematically, each previous adding operation can dependency the new operation\n        // This can gurantee the new operation to be execulated firstly, even if when some operations finished, meanwhile you appending new operations\n        // Just make last added operation dependents new operation can not solve this problem. See test case #test15DownloaderLIFOExecutionOrder\n        for (NSOperation *pendingOperation in self.downloadQueue.operations) {\n            [pendingOperation addDependency:operation];\n        }\n    }\n    \n    return operation;\n}\n\n- (void)cancelAllDownloads {\n    [self.downloadQueue cancelAllOperations];\n}\n\n#pragma mark - Properties\n\n- (BOOL)isSuspended {\n    return self.downloadQueue.isSuspended;\n}\n\n- (void)setSuspended:(BOOL)suspended {\n    self.downloadQueue.suspended = suspended;\n}\n\n- (NSUInteger)currentDownloadCount {\n    return self.downloadQueue.operationCount;\n}\n\n- (NSURLSessionConfiguration *)sessionConfiguration {\n    return self.session.configuration;\n}\n\n#pragma mark - KVO\n\n- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {\n    if (context == SDWebImageDownloaderContext) {\n        if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxConcurrentDownloads))]) {\n            self.downloadQueue.maxConcurrentOperationCount = self.config.maxConcurrentDownloads;\n        }\n    } else {\n        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];\n    }\n}\n\n#pragma mark Helper methods\n\n- (NSOperation<SDWebImageDownloaderOperation> *)operationWithTask:(NSURLSessionTask *)task {\n    NSOperation<SDWebImageDownloaderOperation> *returnOperation = nil;\n    for (NSOperation<SDWebImageDownloaderOperation> *operation in self.downloadQueue.operations) {\n        if ([operation respondsToSelector:@selector(dataTask)]) {\n            // So we lock the operation here, and in `SDWebImageDownloaderOperation`, we use `@synchonzied (self)`, to ensure the thread safe between these two classes.\n            NSURLSessionTask *operationTask;\n            @synchronized (operation) {\n                operationTask = operation.dataTask;\n            }\n            if (operationTask.taskIdentifier == task.taskIdentifier) {\n                returnOperation = operation;\n                break;\n            }\n        }\n    }\n    return returnOperation;\n}\n\n#pragma mark NSURLSessionDataDelegate\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\ndidReceiveResponse:(NSURLResponse *)response\n completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {\n\n    // Identify the operation that runs this task and pass it the delegate method\n    NSOperation<SDWebImageDownloaderOperation> *dataOperation = [self operationWithTask:dataTask];\n    if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:didReceiveResponse:completionHandler:)]) {\n        [dataOperation URLSession:session dataTask:dataTask didReceiveResponse:response completionHandler:completionHandler];\n    } else {\n        if (completionHandler) {\n            completionHandler(NSURLSessionResponseAllow);\n        }\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {\n\n    // Identify the operation that runs this task and pass it the delegate method\n    NSOperation<SDWebImageDownloaderOperation> *dataOperation = [self operationWithTask:dataTask];\n    if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:didReceiveData:)]) {\n        [dataOperation URLSession:session dataTask:dataTask didReceiveData:data];\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\n willCacheResponse:(NSCachedURLResponse *)proposedResponse\n completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler {\n\n    // Identify the operation that runs this task and pass it the delegate method\n    NSOperation<SDWebImageDownloaderOperation> *dataOperation = [self operationWithTask:dataTask];\n    if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:willCacheResponse:completionHandler:)]) {\n        [dataOperation URLSession:session dataTask:dataTask willCacheResponse:proposedResponse completionHandler:completionHandler];\n    } else {\n        if (completionHandler) {\n            completionHandler(proposedResponse);\n        }\n    }\n}\n\n#pragma mark NSURLSessionTaskDelegate\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {\n    \n    // Identify the operation that runs this task and pass it the delegate method\n    NSOperation<SDWebImageDownloaderOperation> *dataOperation = [self operationWithTask:task];\n    if ([dataOperation respondsToSelector:@selector(URLSession:task:didCompleteWithError:)]) {\n        [dataOperation URLSession:session task:task didCompleteWithError:error];\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler {\n    \n    // Identify the operation that runs this task and pass it the delegate method\n    NSOperation<SDWebImageDownloaderOperation> *dataOperation = [self operationWithTask:task];\n    if ([dataOperation respondsToSelector:@selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)]) {\n        [dataOperation URLSession:session task:task willPerformHTTPRedirection:response newRequest:request completionHandler:completionHandler];\n    } else {\n        if (completionHandler) {\n            completionHandler(request);\n        }\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {\n\n    // Identify the operation that runs this task and pass it the delegate method\n    NSOperation<SDWebImageDownloaderOperation> *dataOperation = [self operationWithTask:task];\n    if ([dataOperation respondsToSelector:@selector(URLSession:task:didReceiveChallenge:completionHandler:)]) {\n        [dataOperation URLSession:session task:task didReceiveChallenge:challenge completionHandler:completionHandler];\n    } else {\n        if (completionHandler) {\n            completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);\n        }\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) {\n    \n    // Identify the operation that runs this task and pass it the delegate method\n    NSOperation<SDWebImageDownloaderOperation> *dataOperation = [self operationWithTask:task];\n    if ([dataOperation respondsToSelector:@selector(URLSession:task:didFinishCollectingMetrics:)]) {\n        [dataOperation URLSession:session task:task didFinishCollectingMetrics:metrics];\n    }\n}\n\n@end\n\n@implementation SDWebImageDownloadToken\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadReceiveResponseNotification object:nil];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadStopNotification object:nil];\n}\n\n- (instancetype)initWithDownloadOperation:(NSOperation<SDWebImageDownloaderOperation> *)downloadOperation {\n    self = [super init];\n    if (self) {\n        _downloadOperation = downloadOperation;\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidReceiveResponse:) name:SDWebImageDownloadReceiveResponseNotification object:downloadOperation];\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidStop:) name:SDWebImageDownloadStopNotification object:downloadOperation];\n    }\n    return self;\n}\n\n- (void)downloadDidReceiveResponse:(NSNotification *)notification {\n    NSOperation<SDWebImageDownloaderOperation> *downloadOperation = notification.object;\n    if (downloadOperation && downloadOperation == self.downloadOperation) {\n        self.response = downloadOperation.response;\n    }\n}\n\n- (void)downloadDidStop:(NSNotification *)notification {\n    NSOperation<SDWebImageDownloaderOperation> *downloadOperation = notification.object;\n    if (downloadOperation && downloadOperation == self.downloadOperation) {\n        if ([downloadOperation respondsToSelector:@selector(metrics)]) {\n            if (@available(iOS 10.0, tvOS 10.0, macOS 10.12, watchOS 3.0, *)) {\n                self.metrics = downloadOperation.metrics;\n            }\n        }\n    }\n}\n\n- (void)cancel {\n    @synchronized (self) {\n        if (self.isCancelled) {\n            return;\n        }\n        self.cancelled = YES;\n        [self.downloadOperation cancel:self.downloadOperationCancelToken];\n        self.downloadOperationCancelToken = nil;\n    }\n}\n\n@end\n\n@implementation SDWebImageDownloader (SDImageLoader)\n\n- (BOOL)canRequestImageForURL:(NSURL *)url {\n    return [self canRequestImageForURL:url options:0 context:nil];\n}\n\n- (BOOL)canRequestImageForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context {\n    if (!url) {\n        return NO;\n    }\n    // Always pass YES to let URLSession or custom download operation to determine\n    return YES;\n}\n\n- (id<SDWebImageOperation>)requestImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock {\n    UIImage *cachedImage = context[SDWebImageContextLoaderCachedImage];\n    \n    SDWebImageDownloaderOptions downloaderOptions = 0;\n    if (options & SDWebImageLowPriority) downloaderOptions |= SDWebImageDownloaderLowPriority;\n    if (options & SDWebImageProgressiveLoad) downloaderOptions |= SDWebImageDownloaderProgressiveLoad;\n    if (options & SDWebImageRefreshCached) downloaderOptions |= SDWebImageDownloaderUseNSURLCache;\n    if (options & SDWebImageContinueInBackground) downloaderOptions |= SDWebImageDownloaderContinueInBackground;\n    if (options & SDWebImageHandleCookies) downloaderOptions |= SDWebImageDownloaderHandleCookies;\n    if (options & SDWebImageAllowInvalidSSLCertificates) downloaderOptions |= SDWebImageDownloaderAllowInvalidSSLCertificates;\n    if (options & SDWebImageHighPriority) downloaderOptions |= SDWebImageDownloaderHighPriority;\n    if (options & SDWebImageScaleDownLargeImages) downloaderOptions |= SDWebImageDownloaderScaleDownLargeImages;\n    if (options & SDWebImageAvoidDecodeImage) downloaderOptions |= SDWebImageDownloaderAvoidDecodeImage;\n    if (options & SDWebImageDecodeFirstFrameOnly) downloaderOptions |= SDWebImageDownloaderDecodeFirstFrameOnly;\n    if (options & SDWebImagePreloadAllFrames) downloaderOptions |= SDWebImageDownloaderPreloadAllFrames;\n    if (options & SDWebImageMatchAnimatedImageClass) downloaderOptions |= SDWebImageDownloaderMatchAnimatedImageClass;\n    \n    if (cachedImage && options & SDWebImageRefreshCached) {\n        // force progressive off if image already cached but forced refreshing\n        downloaderOptions &= ~SDWebImageDownloaderProgressiveLoad;\n        // ignore image read from NSURLCache if image if cached but force refreshing\n        downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse;\n    }\n    \n    return [self downloadImageWithURL:url options:downloaderOptions context:context progress:progressBlock completed:completedBlock];\n}\n\n- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error {\n    return [self shouldBlockFailedURLWithURL:url error:error options:0 context:nil];\n}\n\n- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error options:(SDWebImageOptions)options context:(SDWebImageContext *)context {\n    BOOL shouldBlockFailedURL;\n    // Filter the error domain and check error codes\n    if ([error.domain isEqualToString:SDWebImageErrorDomain]) {\n        shouldBlockFailedURL = (   error.code == SDWebImageErrorInvalidURL\n                                || error.code == SDWebImageErrorBadImageData);\n    } else if ([error.domain isEqualToString:NSURLErrorDomain]) {\n        shouldBlockFailedURL = (   error.code != NSURLErrorNotConnectedToInternet\n                                && error.code != NSURLErrorCancelled\n                                && error.code != NSURLErrorTimedOut\n                                && error.code != NSURLErrorInternationalRoamingOff\n                                && error.code != NSURLErrorDataNotAllowed\n                                && error.code != NSURLErrorCannotFindHost\n                                && error.code != NSURLErrorCannotConnectToHost\n                                && error.code != NSURLErrorNetworkConnectionLost);\n    } else {\n        shouldBlockFailedURL = NO;\n    }\n    return shouldBlockFailedURL;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/// Operation execution order\ntypedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {\n    /**\n     * Default value. All download operations will execute in queue style (first-in-first-out).\n     */\n    SDWebImageDownloaderFIFOExecutionOrder,\n    \n    /**\n     * All download operations will execute in stack style (last-in-first-out).\n     */\n    SDWebImageDownloaderLIFOExecutionOrder\n};\n\n/**\n The class contains all the config for image downloader\n @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well.\n */\n@interface SDWebImageDownloaderConfig : NSObject <NSCopying>\n\n/**\n Gets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`.\n @note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected.\n */\n@property (nonatomic, class, readonly, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig;\n\n/**\n * The maximum number of concurrent downloads.\n * Defaults to 6.\n */\n@property (nonatomic, assign) NSInteger maxConcurrentDownloads;\n\n/**\n * The timeout value (in seconds) for each download operation.\n * Defaults to 15.0.\n */\n@property (nonatomic, assign) NSTimeInterval downloadTimeout;\n\n/**\n * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected.\n * The value should be 0.0-1.0.\n * @note If you're using progressive decoding feature, this will also effect the image refresh rate.\n * @note This value may enhance the performance if you don't want progress callback too frequently.\n * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately.\n */\n@property (nonatomic, assign) double minimumProgressInterval;\n\n/**\n * The custom session configuration in use by NSURLSession. If you don't provide one, we will use `defaultSessionConfiguration` instead.\n * Defatuls to nil.\n * @note This property does not support dynamic changes, means it's immutable after the downloader instance initialized.\n */\n@property (nonatomic, strong, nullable) NSURLSessionConfiguration *sessionConfiguration;\n\n/**\n * Gets/Sets a subclass of `SDWebImageDownloaderOperation` as the default\n * `NSOperation` to be used each time SDWebImage constructs a request\n * operation to download an image.\n * Defaults to nil.\n * @note Passing `NSOperation<SDWebImageDownloaderOperation>` to set as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`.\n */\n@property (nonatomic, assign, nullable) Class operationClass;\n\n/**\n * Changes download operations execution order.\n * Defaults to `SDWebImageDownloaderFIFOExecutionOrder`.\n */\n@property (nonatomic, assign) SDWebImageDownloaderExecutionOrder executionOrder;\n\n/**\n * Set the default URL credential to be set for request operations.\n * Defaults to nil.\n */\n@property (nonatomic, copy, nullable) NSURLCredential *urlCredential;\n\n/**\n * Set username using for HTTP Basic authentication.\n * Defaults to nil.\n */\n@property (nonatomic, copy, nullable) NSString *username;\n\n/**\n * Set password using for HTTP Basic authentication.\n * Defaults to nil.\n */\n@property (nonatomic, copy, nullable) NSString *password;\n\n/**\n * Set the acceptable HTTP Response status code. The status code which beyond the range will mark the download operation failed.\n * For example, if we config [200, 400) but server response is 503, the download will fail with error code `SDWebImageErrorInvalidDownloadStatusCode`.\n * Defaults to [200,400). Nil means no validation at all.\n */\n@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes;\n\n/**\n * Set the acceptable HTTP Response content type. The content type beyond the set will mark the download operation failed.\n * For example, if we config [\"image/png\"] but server response is \"application/json\", the download will fail with error code `SDWebImageErrorInvalidDownloadContentType`.\n * Normally you don't need this for image format detection because we use image's data file signature magic bytes: https://en.wikipedia.org/wiki/List_of_file_signatures\n * Defaults to nil. Nil means no validation at all.\n */\n@property (nonatomic, copy, nullable) NSSet<NSString *> *acceptableContentTypes;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageDownloaderConfig.h\"\n\nstatic SDWebImageDownloaderConfig * _defaultDownloaderConfig;\n\n@implementation SDWebImageDownloaderConfig\n\n+ (SDWebImageDownloaderConfig *)defaultDownloaderConfig {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        _defaultDownloaderConfig = [SDWebImageDownloaderConfig new];\n    });\n    return _defaultDownloaderConfig;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _maxConcurrentDownloads = 6;\n        _downloadTimeout = 15.0;\n        _executionOrder = SDWebImageDownloaderFIFOExecutionOrder;\n        _acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)];\n    }\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    SDWebImageDownloaderConfig *config = [[[self class] allocWithZone:zone] init];\n    config.maxConcurrentDownloads = self.maxConcurrentDownloads;\n    config.downloadTimeout = self.downloadTimeout;\n    config.minimumProgressInterval = self.minimumProgressInterval;\n    config.sessionConfiguration = [self.sessionConfiguration copyWithZone:zone];\n    config.operationClass = self.operationClass;\n    config.executionOrder = self.executionOrder;\n    config.urlCredential = self.urlCredential;\n    config.username = self.username;\n    config.password = self.password;\n    config.acceptableStatusCodes = self.acceptableStatusCodes;\n    config.acceptableContentTypes = self.acceptableContentTypes;\n    \n    return config;\n}\n\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\ntypedef NSData * _Nullable (^SDWebImageDownloaderDecryptorBlock)(NSData * _Nonnull data, NSURLResponse * _Nullable response);\n\n/**\nThis is the protocol for downloader decryptor. Which decrypt the original encrypted data before decoding. Note progressive decoding is not compatible for decryptor.\nWe can use a block to specify the downloader decryptor. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.\n*/\n@protocol SDWebImageDownloaderDecryptor <NSObject>\n\n/// Decrypt the original download data and return a new data. You can use this to decrypt the data using your preferred algorithm.\n/// @param data The original download data\n/// @param response The URL response for data. If you modify the original URL response via response modifier, the modified version will be here. This arg is nullable.\n/// @note If nil is returned, the image download will be marked as failed with error `SDWebImageErrorBadImageData`\n- (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response;\n\n@end\n\n/**\nA downloader response modifier class with block.\n*/\n@interface SDWebImageDownloaderDecryptor : NSObject <SDWebImageDownloaderDecryptor>\n\n/// Create the data decryptor with block\n/// @param block A block to control decrypt logic\n- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block;\n\n/// Create the data decryptor with block\n/// @param block A block to control decrypt logic\n+ (nonnull instancetype)decryptorWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block;\n\n@end\n\n/// Convenience way to create decryptor for common data encryption.\n@interface SDWebImageDownloaderDecryptor (Conveniences)\n\n/// Base64 Encoded image data decryptor\n@property (class, readonly, nonnull) SDWebImageDownloaderDecryptor *base64Decryptor;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDWebImageDownloaderDecryptor.h\"\n\n@interface SDWebImageDownloaderDecryptor ()\n\n@property (nonatomic, copy, nonnull) SDWebImageDownloaderDecryptorBlock block;\n\n@end\n\n@implementation SDWebImageDownloaderDecryptor\n\n- (instancetype)initWithBlock:(SDWebImageDownloaderDecryptorBlock)block {\n    self = [super init];\n    if (self) {\n        self.block = block;\n    }\n    return self;\n}\n\n+ (instancetype)decryptorWithBlock:(SDWebImageDownloaderDecryptorBlock)block {\n    SDWebImageDownloaderDecryptor *decryptor = [[SDWebImageDownloaderDecryptor alloc] initWithBlock:block];\n    return decryptor;\n}\n\n- (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response {\n    if (!self.block) {\n        return nil;\n    }\n    return self.block(data, response);\n}\n\n@end\n\n@implementation SDWebImageDownloaderDecryptor (Conveniences)\n\n+ (SDWebImageDownloaderDecryptor *)base64Decryptor {\n    static SDWebImageDownloaderDecryptor *decryptor;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        decryptor = [SDWebImageDownloaderDecryptor decryptorWithBlock:^NSData * _Nullable(NSData * _Nonnull data, NSURLResponse * _Nullable response) {\n            NSData *modifiedData = [[NSData alloc] initWithBase64EncodedData:data options:NSDataBase64DecodingIgnoreUnknownCharacters];\n            return modifiedData;\n        }];\n    });\n    return decryptor;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageDownloader.h\"\n#import \"SDWebImageOperation.h\"\n\n/**\n Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol\n For the description about these methods, see `SDWebImageDownloaderOperation`\n @note If your custom operation class does not use `NSURLSession` at all, do not implement the optional methods and session delegate methods.\n */\n@protocol SDWebImageDownloaderOperation <NSURLSessionTaskDelegate, NSURLSessionDataDelegate>\n@required\n- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request\n                              inSession:(nullable NSURLSession *)session\n                                options:(SDWebImageDownloaderOptions)options;\n\n- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request\n                              inSession:(nullable NSURLSession *)session\n                                options:(SDWebImageDownloaderOptions)options\n                                context:(nullable SDWebImageContext *)context;\n\n- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock\n                            completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;\n\n- (BOOL)cancel:(nullable id)token;\n\n@property (strong, nonatomic, readonly, nullable) NSURLRequest *request;\n@property (strong, nonatomic, readonly, nullable) NSURLResponse *response;\n\n@optional\n@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask;\n@property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));\n\n// These operation-level config was inherited from downloader. See `SDWebImageDownloaderConfig` for documentation.\n@property (strong, nonatomic, nullable) NSURLCredential *credential;\n@property (assign, nonatomic) double minimumProgressInterval;\n@property (copy, nonatomic, nullable) NSIndexSet *acceptableStatusCodes;\n@property (copy, nonatomic, nullable) NSSet<NSString *> *acceptableContentTypes;\n\n@end\n\n\n/**\n The download operation class for SDWebImageDownloader.\n */\n@interface SDWebImageDownloaderOperation : NSOperation <SDWebImageDownloaderOperation>\n\n/**\n * The request used by the operation's task.\n */\n@property (strong, nonatomic, readonly, nullable) NSURLRequest *request;\n\n/**\n * The response returned by the operation's task.\n */\n@property (strong, nonatomic, readonly, nullable) NSURLResponse *response;\n\n/**\n * The operation's task\n */\n@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask;\n\n/**\n * The collected metrics from `-URLSession:task:didFinishCollectingMetrics:`.\n * This can be used to collect the network metrics like download duration, DNS lookup duration, SSL handshake duration, etc. See Apple's documentation: https://developer.apple.com/documentation/foundation/urlsessiontaskmetrics\n */\n@property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));\n\n/**\n * The credential used for authentication challenges in `-URLSession:task:didReceiveChallenge:completionHandler:`.\n *\n * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present.\n */\n@property (strong, nonatomic, nullable) NSURLCredential *credential;\n\n/**\n * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected.\n * The value should be 0.0-1.0.\n * @note If you're using progressive decoding feature, this will also effect the image refresh rate.\n * @note This value may enhance the performance if you don't want progress callback too frequently.\n * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately.\n */\n@property (assign, nonatomic) double minimumProgressInterval;\n\n/**\n * Set the acceptable HTTP Response status code. The status code which beyond the range will mark the download operation failed.\n * For example, if we config [200, 400) but server response is 503, the download will fail with error code `SDWebImageErrorInvalidDownloadStatusCode`.\n * Defaults to [200,400). Nil means no validation at all.\n */\n@property (copy, nonatomic, nullable) NSIndexSet *acceptableStatusCodes;\n\n/**\n * Set the acceptable HTTP Response content type. The content type beyond the set will mark the download operation failed.\n * For example, if we config [\"image/png\"] but server response is \"application/json\", the download will fail with error code `SDWebImageErrorInvalidDownloadContentType`.\n * Normally you don't need this for image format detection because we use image's data file signature magic bytes: https://en.wikipedia.org/wiki/List_of_file_signatures\n * Defaults to nil. Nil means no validation at all.\n */\n@property (copy, nonatomic, nullable) NSSet<NSString *> *acceptableContentTypes;\n\n/**\n * The options for the receiver.\n */\n@property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options;\n\n/**\n * The context for the receiver.\n */\n@property (copy, nonatomic, readonly, nullable) SDWebImageContext *context;\n\n/**\n *  Initializes a `SDWebImageDownloaderOperation` object\n *\n *  @see SDWebImageDownloaderOperation\n *\n *  @param request        the URL request\n *  @param session        the URL session in which this operation will run\n *  @param options        downloader options\n *\n *  @return the initialized instance\n */\n- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request\n                              inSession:(nullable NSURLSession *)session\n                                options:(SDWebImageDownloaderOptions)options;\n\n/**\n *  Initializes a `SDWebImageDownloaderOperation` object\n *\n *  @see SDWebImageDownloaderOperation\n *\n *  @param request        the URL request\n *  @param session        the URL session in which this operation will run\n *  @param options        downloader options\n *  @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n *\n *  @return the initialized instance\n */\n- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request\n                              inSession:(nullable NSURLSession *)session\n                                options:(SDWebImageDownloaderOptions)options\n                                context:(nullable SDWebImageContext *)context NS_DESIGNATED_INITIALIZER;\n\n/**\n *  Adds handlers for progress and completion. Returns a token that can be passed to -cancel: to cancel this set of\n *  callbacks.\n *\n *  @param progressBlock  the block executed when a new chunk of data arrives.\n *                        @note the progress block is executed on a background queue\n *  @param completedBlock the block executed when the download is done.\n *                        @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue\n *\n *  @return the token to use to cancel this set of handlers\n */\n- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock\n                            completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;\n\n/**\n *  Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled.\n *\n *  @param token the token representing a set of callbacks to cancel\n *\n *  @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise.\n */\n- (BOOL)cancel:(nullable id)token;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageDownloaderOperation.h\"\n#import \"SDWebImageError.h\"\n#import \"SDInternalMacros.h\"\n#import \"SDWebImageDownloaderResponseModifier.h\"\n#import \"SDWebImageDownloaderDecryptor.h\"\n\nstatic NSString *const kProgressCallbackKey = @\"progress\";\nstatic NSString *const kCompletedCallbackKey = @\"completed\";\n\ntypedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;\n\n@interface SDWebImageDownloaderOperation ()\n\n@property (strong, nonatomic, nonnull) NSMutableArray<SDCallbacksDictionary *> *callbackBlocks;\n\n@property (assign, nonatomic, readwrite) SDWebImageDownloaderOptions options;\n@property (copy, nonatomic, readwrite, nullable) SDWebImageContext *context;\n\n@property (assign, nonatomic, getter = isExecuting) BOOL executing;\n@property (assign, nonatomic, getter = isFinished) BOOL finished;\n@property (strong, nonatomic, nullable) NSMutableData *imageData;\n@property (copy, nonatomic, nullable) NSData *cachedData; // for `SDWebImageDownloaderIgnoreCachedResponse`\n@property (assign, nonatomic) NSUInteger expectedSize; // may be 0\n@property (assign, nonatomic) NSUInteger receivedSize;\n@property (strong, nonatomic, nullable, readwrite) NSURLResponse *response;\n@property (strong, nonatomic, nullable) NSError *responseError;\n@property (assign, nonatomic) double previousProgress; // previous progress percent\n\n@property (strong, nonatomic, nullable) id<SDWebImageDownloaderResponseModifier> responseModifier; // modify original URLResponse\n@property (strong, nonatomic, nullable) id<SDWebImageDownloaderDecryptor> decryptor; // decrypt image data\n\n// This is weak because it is injected by whoever manages this session. If this gets nil-ed out, we won't be able to run\n// the task associated with this operation\n@property (weak, nonatomic, nullable) NSURLSession *unownedSession;\n// This is set if we're using not using an injected NSURLSession. We're responsible of invalidating this one\n@property (strong, nonatomic, nullable) NSURLSession *ownedSession;\n\n@property (strong, nonatomic, readwrite, nullable) NSURLSessionTask *dataTask;\n\n@property (strong, nonatomic, readwrite, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0));\n\n@property (strong, nonatomic, nonnull) NSOperationQueue *coderQueue; // the serial operation queue to do image decoding\n#if SD_UIKIT\n@property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundTaskId;\n#endif\n\n@end\n\n@implementation SDWebImageDownloaderOperation\n\n@synthesize executing = _executing;\n@synthesize finished = _finished;\n\n- (nonnull instancetype)init {\n    return [self initWithRequest:nil inSession:nil options:0];\n}\n\n- (instancetype)initWithRequest:(NSURLRequest *)request inSession:(NSURLSession *)session options:(SDWebImageDownloaderOptions)options {\n    return [self initWithRequest:request inSession:session options:options context:nil];\n}\n\n- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request\n                              inSession:(nullable NSURLSession *)session\n                                options:(SDWebImageDownloaderOptions)options\n                                context:(nullable SDWebImageContext *)context {\n    if ((self = [super init])) {\n        _request = [request copy];\n        _options = options;\n        _context = [context copy];\n        _callbackBlocks = [NSMutableArray new];\n        _responseModifier = context[SDWebImageContextDownloadResponseModifier];\n        _decryptor = context[SDWebImageContextDownloadDecryptor];\n        _executing = NO;\n        _finished = NO;\n        _expectedSize = 0;\n        _unownedSession = session;\n        _coderQueue = [NSOperationQueue new];\n        _coderQueue.maxConcurrentOperationCount = 1;\n#if SD_UIKIT\n        _backgroundTaskId = UIBackgroundTaskInvalid;\n#endif\n    }\n    return self;\n}\n\n- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock\n                            completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock {\n    SDCallbacksDictionary *callbacks = [NSMutableDictionary new];\n    if (progressBlock) callbacks[kProgressCallbackKey] = [progressBlock copy];\n    if (completedBlock) callbacks[kCompletedCallbackKey] = [completedBlock copy];\n    @synchronized (self) {\n        [self.callbackBlocks addObject:callbacks];\n    }\n    return callbacks;\n}\n\n- (nullable NSArray<id> *)callbacksForKey:(NSString *)key {\n    NSMutableArray<id> *callbacks;\n    @synchronized (self) {\n        callbacks = [[self.callbackBlocks valueForKey:key] mutableCopy];\n    }\n    // We need to remove [NSNull null] because there might not always be a progress block for each callback\n    [callbacks removeObjectIdenticalTo:[NSNull null]];\n    return [callbacks copy]; // strip mutability here\n}\n\n- (BOOL)cancel:(nullable id)token {\n    if (!token) return NO;\n    \n    BOOL shouldCancel = NO;\n    @synchronized (self) {\n        NSMutableArray *tempCallbackBlocks = [self.callbackBlocks mutableCopy];\n        [tempCallbackBlocks removeObjectIdenticalTo:token];\n        if (tempCallbackBlocks.count == 0) {\n            shouldCancel = YES;\n        }\n    }\n    if (shouldCancel) {\n        // Cancel operation running and callback last token's completion block\n        [self cancel];\n    } else {\n        // Only callback this token's completion block\n        @synchronized (self) {\n            [self.callbackBlocks removeObjectIdenticalTo:token];\n        }\n        SDWebImageDownloaderCompletedBlock completedBlock = [token valueForKey:kCompletedCallbackKey];\n        dispatch_main_async_safe(^{\n            if (completedBlock) {\n                completedBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @\"Operation cancelled by user during sending the request\"}], YES);\n            }\n        });\n    }\n    return shouldCancel;\n}\n\n- (void)start {\n    @synchronized (self) {\n        if (self.isCancelled) {\n            if (!self.isFinished) self.finished = YES;\n            // Operation cancelled by user before sending the request\n            [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @\"Operation cancelled by user before sending the request\"}]];\n            [self reset];\n            return;\n        }\n\n#if SD_UIKIT\n        Class UIApplicationClass = NSClassFromString(@\"UIApplication\");\n        BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)];\n        if (hasApplication && [self shouldContinueWhenAppEntersBackground]) {\n            __weak typeof(self) wself = self;\n            UIApplication * app = [UIApplicationClass performSelector:@selector(sharedApplication)];\n            self.backgroundTaskId = [app beginBackgroundTaskWithExpirationHandler:^{\n                [wself cancel];\n            }];\n        }\n#endif\n        NSURLSession *session = self.unownedSession;\n        if (!session) {\n            NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];\n            sessionConfig.timeoutIntervalForRequest = 15;\n            \n            /**\n             *  Create the session for this task\n             *  We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate\n             *  method calls and completion handler calls.\n             */\n            session = [NSURLSession sessionWithConfiguration:sessionConfig\n                                                    delegate:self\n                                               delegateQueue:nil];\n            self.ownedSession = session;\n        }\n        \n        if (self.options & SDWebImageDownloaderIgnoreCachedResponse) {\n            // Grab the cached data for later check\n            NSURLCache *URLCache = session.configuration.URLCache;\n            if (!URLCache) {\n                URLCache = [NSURLCache sharedURLCache];\n            }\n            NSCachedURLResponse *cachedResponse;\n            // NSURLCache's `cachedResponseForRequest:` is not thread-safe, see https://developer.apple.com/documentation/foundation/nsurlcache#2317483\n            @synchronized (URLCache) {\n                cachedResponse = [URLCache cachedResponseForRequest:self.request];\n            }\n            if (cachedResponse) {\n                self.cachedData = cachedResponse.data;\n                self.response = cachedResponse.response;\n            }\n        }\n        \n        if (!session.delegate) {\n            // Session been invalid and has no delegate at all\n            [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @\"Session delegate is nil and invalid\"}]];\n            [self reset];\n            return;\n        }\n        \n        self.dataTask = [session dataTaskWithRequest:self.request];\n        self.executing = YES;\n    }\n\n    if (self.dataTask) {\n        if (self.options & SDWebImageDownloaderHighPriority) {\n            self.dataTask.priority = NSURLSessionTaskPriorityHigh;\n            self.coderQueue.qualityOfService = NSQualityOfServiceUserInteractive;\n        } else if (self.options & SDWebImageDownloaderLowPriority) {\n            self.dataTask.priority = NSURLSessionTaskPriorityLow;\n            self.coderQueue.qualityOfService = NSQualityOfServiceBackground;\n        } else {\n            self.dataTask.priority = NSURLSessionTaskPriorityDefault;\n            self.coderQueue.qualityOfService = NSQualityOfServiceDefault;\n        }\n        [self.dataTask resume];\n        for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {\n            progressBlock(0, NSURLResponseUnknownLength, self.request.URL);\n        }\n        __block typeof(self) strongSelf = self;\n        dispatch_async(dispatch_get_main_queue(), ^{\n            [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:strongSelf];\n        });\n    } else {\n        if (!self.isFinished) self.finished = YES;\n        [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @\"Task can't be initialized\"}]];\n        [self reset];\n    }\n}\n\n- (void)cancel {\n    @synchronized (self) {\n        [self cancelInternal];\n    }\n}\n\n- (void)cancelInternal {\n    if (self.isFinished) return;\n    [super cancel];\n    \n    __block typeof(self) strongSelf = self;\n    dispatch_async(dispatch_get_main_queue(), ^{\n        [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf];\n    });\n\n    if (self.dataTask) {\n        // Cancel the URLSession, `URLSession:task:didCompleteWithError:` delegate callback will be ignored\n        [self.dataTask cancel];\n        self.dataTask = nil;\n    }\n    \n    // NSOperation disallow setFinished=YES **before** operation's start method been called\n    // We check for the initialized status, which is isExecuting == NO && isFinished = NO\n    // Ony update for non-intialized status, which is !(isExecuting == NO && isFinished = NO), or if (self.isExecuting || self.isFinished) {...}\n    if (self.isExecuting || self.isFinished) {\n        if (self.isExecuting) self.executing = NO;\n        if (!self.isFinished) self.finished = YES;\n    }\n    \n    // Operation cancelled by user during sending the request\n    [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @\"Operation cancelled by user during sending the request\"}]];\n\n    [self reset];\n}\n\n- (void)done {\n    self.finished = YES;\n    self.executing = NO;\n    [self reset];\n}\n\n- (void)reset {\n    @synchronized (self) {\n        [self.callbackBlocks removeAllObjects];\n        self.dataTask = nil;\n        \n        if (self.ownedSession) {\n            [self.ownedSession invalidateAndCancel];\n            self.ownedSession = nil;\n        }\n        \n#if SD_UIKIT\n        if (self.backgroundTaskId != UIBackgroundTaskInvalid) {\n            // If backgroundTaskId != UIBackgroundTaskInvalid, sharedApplication is always exist\n            UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)];\n            [app endBackgroundTask:self.backgroundTaskId];\n            self.backgroundTaskId = UIBackgroundTaskInvalid;\n        }\n#endif\n    }\n}\n\n- (void)setFinished:(BOOL)finished {\n    [self willChangeValueForKey:@\"isFinished\"];\n    _finished = finished;\n    [self didChangeValueForKey:@\"isFinished\"];\n}\n\n- (void)setExecuting:(BOOL)executing {\n    [self willChangeValueForKey:@\"isExecuting\"];\n    _executing = executing;\n    [self didChangeValueForKey:@\"isExecuting\"];\n}\n\n- (BOOL)isConcurrent {\n    return YES;\n}\n\n#pragma mark NSURLSessionDataDelegate\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\ndidReceiveResponse:(NSURLResponse *)response\n completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {\n    NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow;\n    \n    // Check response modifier, if return nil, will marked as cancelled.\n    BOOL valid = YES;\n    if (self.responseModifier && response) {\n        response = [self.responseModifier modifiedResponseWithResponse:response];\n        if (!response) {\n            valid = NO;\n            self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain\n                                                     code:SDWebImageErrorInvalidDownloadResponse\n                                                 userInfo:@{NSLocalizedDescriptionKey : @\"Download marked as failed because response is nil\"}];\n        }\n    }\n    \n    NSInteger expected = (NSInteger)response.expectedContentLength;\n    expected = expected > 0 ? expected : 0;\n    self.expectedSize = expected;\n    self.response = response;\n    \n    // Check status code valid (defaults [200,400))\n    NSInteger statusCode = [response isKindOfClass:NSHTTPURLResponse.class] ? ((NSHTTPURLResponse *)response).statusCode : 0;\n    BOOL statusCodeValid = YES;\n    if (valid && statusCode > 0 && self.acceptableStatusCodes) {\n        statusCodeValid = [self.acceptableStatusCodes containsIndex:statusCode];\n    }\n    if (!statusCodeValid) {\n        valid = NO;\n        self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain\n                                                 code:SDWebImageErrorInvalidDownloadStatusCode\n                                             userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@\"Download marked as failed because of invalid response status code %ld\", (long)statusCode],\n                                                        SDWebImageErrorDownloadStatusCodeKey : @(statusCode),\n                                                        SDWebImageErrorDownloadResponseKey : response}];\n    }\n    // Check content type valid (defaults nil)\n    NSString *contentType = [response isKindOfClass:NSHTTPURLResponse.class] ? ((NSHTTPURLResponse *)response).MIMEType : nil;\n    BOOL contentTypeValid = YES;\n    if (valid && contentType.length > 0 && self.acceptableContentTypes) {\n        contentTypeValid = [self.acceptableContentTypes containsObject:contentType];\n    }\n    if (!contentTypeValid) {\n        valid = NO;\n        self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain\n                                                 code:SDWebImageErrorInvalidDownloadContentType\n                                             userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@\"Download marked as failed because of invalid response content type %@\", contentType],\n                                                        SDWebImageErrorDownloadContentTypeKey : contentType,\n                                                        SDWebImageErrorDownloadResponseKey : response}];\n    }\n    //'304 Not Modified' is an exceptional one\n    //URLSession current behavior will return 200 status code when the server respond 304 and URLCache hit. But this is not a standard behavior and we just add a check\n    if (valid && statusCode == 304 && !self.cachedData) {\n        valid = NO;\n        self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain\n                                                 code:SDWebImageErrorCacheNotModified\n                                             userInfo:@{NSLocalizedDescriptionKey: @\"Download response status code is 304 not modified and ignored\",\n                                                        SDWebImageErrorDownloadResponseKey : response}];\n    }\n    \n    if (valid) {\n        for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {\n            progressBlock(0, expected, self.request.URL);\n        }\n    } else {\n        // Status code invalid and marked as cancelled. Do not call `[self.dataTask cancel]` which may mass up URLSession life cycle\n        disposition = NSURLSessionResponseCancel;\n    }\n    __block typeof(self) strongSelf = self;\n    dispatch_async(dispatch_get_main_queue(), ^{\n        [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadReceiveResponseNotification object:strongSelf];\n    });\n    \n    if (completionHandler) {\n        completionHandler(disposition);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {\n    if (!self.imageData) {\n        self.imageData = [[NSMutableData alloc] initWithCapacity:self.expectedSize];\n    }\n    [self.imageData appendData:data];\n    \n    self.receivedSize = self.imageData.length;\n    if (self.expectedSize == 0) {\n        // Unknown expectedSize, immediately call progressBlock and return\n        for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {\n            progressBlock(self.receivedSize, self.expectedSize, self.request.URL);\n        }\n        return;\n    }\n    \n    // Get the finish status\n    BOOL finished = (self.receivedSize >= self.expectedSize);\n    // Get the current progress\n    double currentProgress = (double)self.receivedSize / (double)self.expectedSize;\n    double previousProgress = self.previousProgress;\n    double progressInterval = currentProgress - previousProgress;\n    // Check if we need callback progress\n    if (!finished && (progressInterval < self.minimumProgressInterval)) {\n        return;\n    }\n    self.previousProgress = currentProgress;\n    \n    // Using data decryptor will disable the progressive decoding, since there are no support for progressive decrypt\n    BOOL supportProgressive = (self.options & SDWebImageDownloaderProgressiveLoad) && !self.decryptor;\n    // Progressive decoding Only decode partial image, full image in `URLSession:task:didCompleteWithError:`\n    if (supportProgressive && !finished) {\n        // Get the image data\n        NSData *imageData = self.imageData;\n        \n        // keep maximum one progressive decode process during download\n        if (self.coderQueue.operationCount == 0) {\n            // NSOperation have autoreleasepool, don't need to create extra one\n            @weakify(self);\n            [self.coderQueue addOperationWithBlock:^{\n                @strongify(self);\n                if (!self) {\n                    return;\n                }\n                UIImage *image = SDImageLoaderDecodeProgressiveImageData(imageData, self.request.URL, NO, self, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context);\n                if (image) {\n                    // We do not keep the progressive decoding image even when `finished`=YES. Because they are for view rendering but not take full function from downloader options. And some coders implementation may not keep consistent between progressive decoding and normal decoding.\n                    \n                    [self callCompletionBlocksWithImage:image imageData:nil error:nil finished:NO];\n                }\n            }];\n        }\n    }\n    \n    for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {\n        progressBlock(self.receivedSize, self.expectedSize, self.request.URL);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session\n          dataTask:(NSURLSessionDataTask *)dataTask\n willCacheResponse:(NSCachedURLResponse *)proposedResponse\n completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler {\n    \n    NSCachedURLResponse *cachedResponse = proposedResponse;\n\n    if (!(self.options & SDWebImageDownloaderUseNSURLCache)) {\n        // Prevents caching of responses\n        cachedResponse = nil;\n    }\n    if (completionHandler) {\n        completionHandler(cachedResponse);\n    }\n}\n\n#pragma mark NSURLSessionTaskDelegate\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {\n    // If we already cancel the operation or anything mark the operation finished, don't callback twice\n    if (self.isFinished) return;\n    \n    @synchronized(self) {\n        self.dataTask = nil;\n        __block typeof(self) strongSelf = self;\n        dispatch_async(dispatch_get_main_queue(), ^{\n            [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf];\n            if (!error) {\n                [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadFinishNotification object:strongSelf];\n            }\n        });\n    }\n    \n    // make sure to call `[self done]` to mark operation as finished\n    if (error) {\n        // custom error instead of URLSession error\n        if (self.responseError) {\n            error = self.responseError;\n        }\n        [self callCompletionBlocksWithError:error];\n        [self done];\n    } else {\n        if ([self callbacksForKey:kCompletedCallbackKey].count > 0) {\n            NSData *imageData = self.imageData;\n            self.imageData = nil;\n            // data decryptor\n            if (imageData && self.decryptor) {\n                imageData = [self.decryptor decryptedDataWithData:imageData response:self.response];\n            }\n            if (imageData) {\n                /**  if you specified to only use cached data via `SDWebImageDownloaderIgnoreCachedResponse`,\n                 *  then we should check if the cached data is equal to image data\n                 */\n                if (self.options & SDWebImageDownloaderIgnoreCachedResponse && [self.cachedData isEqualToData:imageData]) {\n                    self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain\n                                                             code:SDWebImageErrorCacheNotModified\n                                                         userInfo:@{NSLocalizedDescriptionKey : @\"Downloaded image is not modified and ignored\",\n                                                                    SDWebImageErrorDownloadResponseKey : self.response}];\n                    // call completion block with not modified error\n                    [self callCompletionBlocksWithError:self.responseError];\n                    [self done];\n                } else {\n                    // decode the image in coder queue, cancel all previous decoding process\n                    [self.coderQueue cancelAllOperations];\n                    @weakify(self);\n                    [self.coderQueue addOperationWithBlock:^{\n                        @strongify(self);\n                        if (!self) {\n                            return;\n                        }\n                        // check if we already use progressive decoding, use that to produce faster decoding\n                        id<SDProgressiveImageCoder> progressiveCoder = SDImageLoaderGetProgressiveCoder(self);\n                        UIImage *image;\n                        if (progressiveCoder) {\n                            image = SDImageLoaderDecodeProgressiveImageData(imageData, self.request.URL, YES, self, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context);\n                        } else {\n                            image = SDImageLoaderDecodeImageData(imageData, self.request.URL, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context);\n                        }\n                        CGSize imageSize = image.size;\n                        if (imageSize.width == 0 || imageSize.height == 0) {\n                            NSString *description = image == nil ? @\"Downloaded image decode failed\" : @\"Downloaded image has 0 pixels\";\n                            [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : description}]];\n                        } else {\n                            [self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES];\n                        }\n                        [self done];\n                    }];\n                }\n            } else {\n                [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : @\"Image data is nil\"}]];\n                [self done];\n            }\n        } else {\n            [self done];\n        }\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {\n    \n    NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n    __block NSURLCredential *credential = nil;\n    \n    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {\n        if (!(self.options & SDWebImageDownloaderAllowInvalidSSLCertificates)) {\n            disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n        } else {\n            credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];\n            disposition = NSURLSessionAuthChallengeUseCredential;\n        }\n    } else {\n        if (challenge.previousFailureCount == 0) {\n            if (self.credential) {\n                credential = self.credential;\n                disposition = NSURLSessionAuthChallengeUseCredential;\n            } else {\n                // Web Server like Nginx can set `ssl_verify_client` to optional but not always on\n                // We'd better use default handling here\n                disposition = NSURLSessionAuthChallengePerformDefaultHandling;\n            }\n        } else {\n            disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge;\n        }\n    }\n    \n    if (completionHandler) {\n        completionHandler(disposition, credential);\n    }\n}\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) {\n    self.metrics = metrics;\n}\n\n#pragma mark Helper methods\n+ (SDWebImageOptions)imageOptionsFromDownloaderOptions:(SDWebImageDownloaderOptions)downloadOptions {\n    SDWebImageOptions options = 0;\n    if (downloadOptions & SDWebImageDownloaderScaleDownLargeImages) options |= SDWebImageScaleDownLargeImages;\n    if (downloadOptions & SDWebImageDownloaderDecodeFirstFrameOnly) options |= SDWebImageDecodeFirstFrameOnly;\n    if (downloadOptions & SDWebImageDownloaderPreloadAllFrames) options |= SDWebImagePreloadAllFrames;\n    if (downloadOptions & SDWebImageDownloaderAvoidDecodeImage) options |= SDWebImageAvoidDecodeImage;\n    if (downloadOptions & SDWebImageDownloaderMatchAnimatedImageClass) options |= SDWebImageMatchAnimatedImageClass;\n    \n    return options;\n}\n\n- (BOOL)shouldContinueWhenAppEntersBackground {\n    return SD_OPTIONS_CONTAINS(self.options, SDWebImageDownloaderContinueInBackground);\n}\n\n- (void)callCompletionBlocksWithError:(nullable NSError *)error {\n    [self callCompletionBlocksWithImage:nil imageData:nil error:error finished:YES];\n}\n\n- (void)callCompletionBlocksWithImage:(nullable UIImage *)image\n                            imageData:(nullable NSData *)imageData\n                                error:(nullable NSError *)error\n                             finished:(BOOL)finished {\n    NSArray<id> *completionBlocks = [self callbacksForKey:kCompletedCallbackKey];\n    dispatch_main_async_safe(^{\n        for (SDWebImageDownloaderCompletedBlock completedBlock in completionBlocks) {\n            completedBlock(image, imageData, error, finished);\n        }\n    });\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\ntypedef NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSURLRequest * _Nonnull request);\n\n/**\n This is the protocol for downloader request modifier.\n We can use a block to specify the downloader request modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.\n */\n@protocol SDWebImageDownloaderRequestModifier <NSObject>\n\n/// Modify the original URL request and return a new one instead. You can modify the HTTP header, cachePolicy, etc for this URL.\n/// @param request The original URL request for image loading\n/// @note If return nil, the URL request will be cancelled.\n- (nullable NSURLRequest *)modifiedRequestWithRequest:(nonnull NSURLRequest *)request;\n\n@end\n\n/**\n A downloader request modifier class with block.\n */\n@interface SDWebImageDownloaderRequestModifier : NSObject <SDWebImageDownloaderRequestModifier>\n\n/// Create the request modifier with block\n/// @param block A block to control modifier logic\n- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block;\n\n/// Create the request modifier with block\n/// @param block A block to control modifier logic\n+ (nonnull instancetype)requestModifierWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block;\n\n@end\n\n/**\nA convenient request modifier to provide the HTTP request including HTTP Method, Headers and Body.\n*/\n@interface SDWebImageDownloaderRequestModifier (Conveniences)\n\n/// Create the request modifier with HTTP Method.\n/// @param method HTTP Method, nil means to GET.\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithMethod:(nullable NSString *)method;\n\n/// Create the request modifier with HTTP Headers.\n/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request.\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithHeaders:(nullable NSDictionary<NSString *, NSString *> *)headers;\n\n/// Create the request modifier with HTTP Body.\n/// @param body HTTP Body.\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithBody:(nullable NSData *)body;\n\n/// Create the request modifier with HTTP Method, Headers and Body.\n/// @param method HTTP Method, nil means to GET.\n/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request.\n/// @param body HTTP Body.\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithMethod:(nullable NSString *)method headers:(nullable NSDictionary<NSString *, NSString *> *)headers body:(nullable NSData *)body;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageDownloaderRequestModifier.h\"\n\n@interface SDWebImageDownloaderRequestModifier ()\n\n@property (nonatomic, copy, nonnull) SDWebImageDownloaderRequestModifierBlock block;\n\n@end\n\n@implementation SDWebImageDownloaderRequestModifier\n\n- (instancetype)initWithBlock:(SDWebImageDownloaderRequestModifierBlock)block {\n    self = [super init];\n    if (self) {\n        self.block = block;\n    }\n    return self;\n}\n\n+ (instancetype)requestModifierWithBlock:(SDWebImageDownloaderRequestModifierBlock)block {\n    SDWebImageDownloaderRequestModifier *requestModifier = [[SDWebImageDownloaderRequestModifier alloc] initWithBlock:block];\n    return requestModifier;\n}\n\n- (NSURLRequest *)modifiedRequestWithRequest:(NSURLRequest *)request {\n    if (!self.block) {\n        return nil;\n    }\n    return self.block(request);\n}\n\n@end\n\n@implementation SDWebImageDownloaderRequestModifier (Conveniences)\n\n- (instancetype)initWithMethod:(NSString *)method {\n    return [self initWithMethod:method headers:nil body:nil];\n}\n\n- (instancetype)initWithHeaders:(NSDictionary<NSString *,NSString *> *)headers {\n    return [self initWithMethod:nil headers:headers body:nil];\n}\n\n- (instancetype)initWithBody:(NSData *)body {\n    return [self initWithMethod:nil headers:nil body:body];\n}\n\n- (instancetype)initWithMethod:(NSString *)method headers:(NSDictionary<NSString *,NSString *> *)headers body:(NSData *)body {\n    method = method ? [method copy] : @\"GET\";\n    headers = [headers copy];\n    body = [body copy];\n    return [self initWithBlock:^NSURLRequest * _Nullable(NSURLRequest * _Nonnull request) {\n        NSMutableURLRequest *mutableRequest = [request mutableCopy];\n        mutableRequest.HTTPMethod = method;\n        mutableRequest.HTTPBody = body;\n        for (NSString *header in headers) {\n            NSString *value = headers[header];\n            [mutableRequest setValue:value forHTTPHeaderField:header];\n        }\n        return [mutableRequest copy];\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\ntypedef NSURLResponse * _Nullable (^SDWebImageDownloaderResponseModifierBlock)(NSURLResponse * _Nonnull response);\n\n/**\n This is the protocol for downloader response modifier.\n We can use a block to specify the downloader response modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.\n */\n@protocol SDWebImageDownloaderResponseModifier <NSObject>\n\n/// Modify the original URL response and return a new response. You can use this to check MIME-Type, mock server response, etc.\n/// @param response The original URL response, note for HTTP request it's actually a `NSHTTPURLResponse` instance\n/// @note If nil is returned, the image download will marked as cancelled with error `SDWebImageErrorInvalidDownloadResponse`\n- (nullable NSURLResponse *)modifiedResponseWithResponse:(nonnull NSURLResponse *)response;\n\n@end\n\n/**\n A downloader response modifier class with block.\n */\n@interface SDWebImageDownloaderResponseModifier : NSObject <SDWebImageDownloaderResponseModifier>\n\n/// Create the response modifier with block\n/// @param block A block to control modifier logic\n- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block;\n\n/// Create the response modifier with block\n/// @param block A block to control modifier logic\n+ (nonnull instancetype)responseModifierWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block;\n\n@end\n\n/**\nA convenient response modifier to provide the HTTP response including HTTP Status Code, Version and Headers.\n*/\n@interface SDWebImageDownloaderResponseModifier (Conveniences)\n\n/// Create the response modifier with HTTP Status code.\n/// @param statusCode HTTP Status Code.\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode;\n\n/// Create the response modifier with HTTP Version. Status code defaults to 200.\n/// @param version HTTP Version, nil means \"HTTP/1.1\".\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithVersion:(nullable NSString *)version;\n\n/// Create the response modifier with HTTP Headers. Status code defaults to 200.\n/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response.\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithHeaders:(nullable NSDictionary<NSString *, NSString *> *)headers;\n\n/// Create the response modifier with HTTP Status Code, Version and Headers.\n/// @param statusCode HTTP Status Code.\n/// @param version HTTP Version, nil means \"HTTP/1.1\".\n/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response.\n/// @note This is for convenience, if you need code to control the logic, use block API instead.\n- (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode version:(nullable NSString *)version headers:(nullable NSDictionary<NSString *, NSString *> *)headers;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n\n#import \"SDWebImageDownloaderResponseModifier.h\"\n\n@interface SDWebImageDownloaderResponseModifier ()\n\n@property (nonatomic, copy, nonnull) SDWebImageDownloaderResponseModifierBlock block;\n\n@end\n\n@implementation SDWebImageDownloaderResponseModifier\n\n- (instancetype)initWithBlock:(SDWebImageDownloaderResponseModifierBlock)block {\n    self = [super init];\n    if (self) {\n        self.block = block;\n    }\n    return self;\n}\n\n+ (instancetype)responseModifierWithBlock:(SDWebImageDownloaderResponseModifierBlock)block {\n    SDWebImageDownloaderResponseModifier *responseModifier = [[SDWebImageDownloaderResponseModifier alloc] initWithBlock:block];\n    return responseModifier;\n}\n\n- (nullable NSURLResponse *)modifiedResponseWithResponse:(nonnull NSURLResponse *)response {\n    if (!self.block) {\n        return nil;\n    }\n    return self.block(response);\n}\n\n@end\n\n@implementation SDWebImageDownloaderResponseModifier (Conveniences)\n\n- (instancetype)initWithStatusCode:(NSInteger)statusCode {\n    return [self initWithStatusCode:statusCode version:nil headers:nil];\n}\n\n- (instancetype)initWithVersion:(NSString *)version {\n    return [self initWithStatusCode:200 version:version headers:nil];\n}\n\n- (instancetype)initWithHeaders:(NSDictionary<NSString *,NSString *> *)headers {\n    return [self initWithStatusCode:200 version:nil headers:headers];\n}\n\n- (instancetype)initWithStatusCode:(NSInteger)statusCode version:(NSString *)version headers:(NSDictionary<NSString *,NSString *> *)headers {\n    version = version ? [version copy] : @\"HTTP/1.1\";\n    headers = [headers copy];\n    return [self initWithBlock:^NSURLResponse * _Nullable(NSURLResponse * _Nonnull response) {\n        if (![response isKindOfClass:NSHTTPURLResponse.class]) {\n            return response;\n        }\n        NSMutableDictionary *mutableHeaders = [((NSHTTPURLResponse *)response).allHeaderFields mutableCopy];\n        for (NSString *header in headers) {\n            NSString *value = headers[header];\n            mutableHeaders[header] = value;\n        }\n        NSHTTPURLResponse *httpResponse = [[NSHTTPURLResponse alloc] initWithURL:response.URL statusCode:statusCode HTTPVersion:version headerFields:[mutableHeaders copy]];\n        return httpResponse;\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Jamie Pinkham\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\nFOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain;\n\n/// The response instance for invalid download response (NSURLResponse *)\nFOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadResponseKey;\n/// The HTTP status code for invalid download response (NSNumber *)\nFOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey;\n/// The HTTP MIME content type for invalid download response (NSString *)\nFOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadContentTypeKey;\n\n/// SDWebImage error domain and codes\ntypedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) {\n    SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL\n    SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty\n    SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached`\n    SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this\n    SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized\n    SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey`\n    SDWebImageErrorCancelled = 2002, // The image loading operation is cancelled before finished, during either async disk cache query, or waiting before actual network request. For actual network request error, check `NSURLErrorDomain` error domain and code.\n    SDWebImageErrorInvalidDownloadResponse = 2003, // When using response modifier, the modified download response is nil and marked as failed.\n    SDWebImageErrorInvalidDownloadContentType = 2004, // The image download response a invalid content type. You can check the MIME content type in error's userInfo under `SDWebImageErrorDownloadContentTypeKey`\n};\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Jamie Pinkham\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageError.h\"\n\nNSErrorDomain const _Nonnull SDWebImageErrorDomain = @\"SDWebImageErrorDomain\";\n\nNSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadResponseKey = @\"SDWebImageErrorDownloadResponseKey\";\nNSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey = @\"SDWebImageErrorDownloadStatusCodeKey\";\nNSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadContentTypeKey = @\"SDWebImageErrorDownloadContentTypeKey\";\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_UIKIT || SD_MAC\n\n/**\n A protocol to custom the indicator during the image loading.\n All of these methods are called from main queue.\n */\n@protocol SDWebImageIndicator <NSObject>\n\n@required\n/**\n The view associate to the indicator.\n\n @return The indicator view\n */\n@property (nonatomic, strong, readonly, nonnull) UIView *indicatorView;\n\n/**\n Start the animating for indicator.\n */\n- (void)startAnimatingIndicator;\n\n/**\n Stop the animating for indicator.\n */\n- (void)stopAnimatingIndicator;\n\n@optional\n/**\n Update the loading progress (0-1.0) for indicator. Optional\n \n @param progress The progress, value between 0 and 1.0\n */\n- (void)updateIndicatorProgress:(double)progress;\n\n@end\n\n#pragma mark - Activity Indicator\n\n/**\n Activity indicator class.\n for UIKit(macOS), it use a `UIActivityIndicatorView`.\n for AppKit(macOS), it use a `NSProgressIndicator` with the spinning style.\n */\n@interface SDWebImageActivityIndicator : NSObject <SDWebImageIndicator>\n\n#if SD_UIKIT\n@property (nonatomic, strong, readonly, nonnull) UIActivityIndicatorView *indicatorView;\n#else\n@property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView;\n#endif\n\n@end\n\n/**\n Convenience way to use activity indicator.\n */\n@interface SDWebImageActivityIndicator (Conveniences)\n\n/// These indicator use the fixed color without dark mode support\n/// gray-style activity indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayIndicator;\n/// large gray-style activity indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayLargeIndicator;\n/// white-style activity indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteIndicator;\n/// large white-style activity indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteLargeIndicator;\n/// These indicator use the system style, supports dark mode if available (iOS 13+/macOS 10.14+)\n/// large activity indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *largeIndicator;\n/// medium activity indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *mediumIndicator;\n\n@end\n\n#pragma mark - Progress Indicator\n\n/**\n Progress indicator class.\n for UIKit(macOS), it use a `UIProgressView`.\n for AppKit(macOS), it use a `NSProgressIndicator` with the bar style.\n */\n@interface SDWebImageProgressIndicator : NSObject <SDWebImageIndicator>\n\n#if SD_UIKIT\n@property (nonatomic, strong, readonly, nonnull) UIProgressView *indicatorView;\n#else\n@property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView;\n#endif\n\n@end\n\n/**\n Convenience way to create progress indicator. Remember to specify the indicator width or use layout constraint if need.\n */\n@interface SDWebImageProgressIndicator (Conveniences)\n\n/// default-style progress indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *defaultIndicator;\n/// bar-style progress indicator\n@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *barIndicator API_UNAVAILABLE(macos, tvos);\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageIndicator.h\"\n\n#if SD_UIKIT || SD_MAC\n\n#if SD_MAC\n#import <QuartzCore/QuartzCore.h>\n#endif\n\n#pragma mark - Activity Indicator\n\n@interface SDWebImageActivityIndicator ()\n\n#if SD_UIKIT\n@property (nonatomic, strong, readwrite, nonnull) UIActivityIndicatorView *indicatorView;\n#else\n@property (nonatomic, strong, readwrite, nonnull) NSProgressIndicator *indicatorView;\n#endif\n\n@end\n\n@implementation SDWebImageActivityIndicator\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        [self commonInit];\n    }\n    return self;\n}\n\n#if SD_UIKIT\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n- (void)commonInit {\n    self.indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];\n    self.indicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;\n}\n#pragma clang diagnostic pop\n#endif\n\n#if SD_MAC\n- (void)commonInit {\n    self.indicatorView = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect];\n    self.indicatorView.style = NSProgressIndicatorStyleSpinning;\n    self.indicatorView.controlSize = NSControlSizeSmall;\n    [self.indicatorView sizeToFit];\n    self.indicatorView.autoresizingMask = NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin;\n}\n#endif\n\n- (void)startAnimatingIndicator {\n#if SD_UIKIT\n    [self.indicatorView startAnimating];\n#else\n    [self.indicatorView startAnimation:nil];\n#endif\n    self.indicatorView.hidden = NO;\n}\n\n- (void)stopAnimatingIndicator {\n#if SD_UIKIT\n    [self.indicatorView stopAnimating];\n#else\n    [self.indicatorView stopAnimation:nil];\n#endif\n    self.indicatorView.hidden = YES;\n}\n\n@end\n\n@implementation SDWebImageActivityIndicator (Conveniences)\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n+ (SDWebImageActivityIndicator *)grayIndicator {\n    SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new];\n#if SD_UIKIT\n#if SD_IOS\n    indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;\n#else\n    indicator.indicatorView.color = [UIColor colorWithWhite:0 alpha:0.45]; // Color from `UIActivityIndicatorViewStyleGray`\n#endif\n#else\n    indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support\n#endif\n    return indicator;\n}\n\n+ (SDWebImageActivityIndicator *)grayLargeIndicator {\n    SDWebImageActivityIndicator *indicator = SDWebImageActivityIndicator.grayIndicator;\n#if SD_UIKIT\n    UIColor *grayColor = indicator.indicatorView.color;\n    indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;\n    indicator.indicatorView.color = grayColor;\n#else\n    indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support\n    indicator.indicatorView.controlSize = NSControlSizeRegular;\n#endif\n    [indicator.indicatorView sizeToFit];\n    return indicator;\n}\n\n+ (SDWebImageActivityIndicator *)whiteIndicator {\n    SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new];\n#if SD_UIKIT\n    indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;\n#else\n    indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support\n    CIFilter *lighten = [CIFilter filterWithName:@\"CIColorControls\"];\n    [lighten setDefaults];\n    [lighten setValue:@(1) forKey:kCIInputBrightnessKey];\n    indicator.indicatorView.contentFilters = @[lighten];\n#endif\n    return indicator;\n}\n\n+ (SDWebImageActivityIndicator *)whiteLargeIndicator {\n    SDWebImageActivityIndicator *indicator = SDWebImageActivityIndicator.whiteIndicator;\n#if SD_UIKIT\n    indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;\n#else\n    indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support\n    indicator.indicatorView.controlSize = NSControlSizeRegular;\n    [indicator.indicatorView sizeToFit];\n#endif\n    return indicator;\n}\n\n+ (SDWebImageActivityIndicator *)largeIndicator {\n    SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new];\n#if SD_UIKIT\n    if (@available(iOS 13.0, tvOS 13.0, *)) {\n        indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleLarge;\n    } else {\n        indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;\n    }\n#else\n    indicator.indicatorView.controlSize = NSControlSizeRegular;\n    [indicator.indicatorView sizeToFit];\n#endif\n    return indicator;\n}\n\n+ (SDWebImageActivityIndicator *)mediumIndicator {\n    SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new];\n#if SD_UIKIT\n    if (@available(iOS 13.0, tvOS 13.0, *)) {\n        indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleMedium;\n    } else {\n        indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;\n    }\n#else\n    indicator.indicatorView.controlSize = NSControlSizeSmall;\n    [indicator.indicatorView sizeToFit];\n#endif\n    return indicator;\n}\n#pragma clang diagnostic pop\n\n@end\n\n#pragma mark - Progress Indicator\n\n@interface SDWebImageProgressIndicator ()\n\n#if SD_UIKIT\n@property (nonatomic, strong, readwrite, nonnull) UIProgressView *indicatorView;\n#else\n@property (nonatomic, strong, readwrite, nonnull) NSProgressIndicator *indicatorView;\n#endif\n\n@end\n\n@implementation SDWebImageProgressIndicator\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        [self commonInit];\n    }\n    return self;\n}\n\n#if SD_UIKIT\n- (void)commonInit {\n    self.indicatorView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];\n    self.indicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;\n}\n#endif\n\n#if SD_MAC\n- (void)commonInit {\n    self.indicatorView = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 160, 0)]; // Width from `UIProgressView` default width\n    self.indicatorView.style = NSProgressIndicatorStyleBar;\n    self.indicatorView.controlSize = NSControlSizeSmall;\n    [self.indicatorView sizeToFit];\n    self.indicatorView.autoresizingMask = NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin;\n}\n#endif\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunguarded-availability\"\n- (void)startAnimatingIndicator {\n    self.indicatorView.hidden = NO;\n#if SD_UIKIT\n    if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) {\n        // Ignore NSProgress\n    } else {\n        self.indicatorView.progress = 0;\n    }\n#else\n    self.indicatorView.indeterminate = YES;\n    self.indicatorView.doubleValue = 0;\n    [self.indicatorView startAnimation:nil];\n#endif\n}\n\n- (void)stopAnimatingIndicator {\n    self.indicatorView.hidden = YES;\n#if SD_UIKIT\n    if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) {\n        // Ignore NSProgress\n    } else {\n        self.indicatorView.progress = 1;\n    }\n#else\n    self.indicatorView.indeterminate = NO;\n    self.indicatorView.doubleValue = 100;\n    [self.indicatorView stopAnimation:nil];\n#endif\n}\n\n- (void)updateIndicatorProgress:(double)progress {\n#if SD_UIKIT\n    if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) {\n        // Ignore NSProgress\n    } else {\n        [self.indicatorView setProgress:progress animated:YES];\n    }\n#else\n    self.indicatorView.indeterminate = progress > 0 ? NO : YES;\n    self.indicatorView.doubleValue = progress * 100;\n#endif\n}\n#pragma clang diagnostic pop\n\n@end\n\n@implementation SDWebImageProgressIndicator (Conveniences)\n\n+ (SDWebImageProgressIndicator *)defaultIndicator {\n    SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new];\n    return indicator;\n}\n\n#if SD_IOS\n+ (SDWebImageProgressIndicator *)barIndicator {\n    SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new];\n    indicator.indicatorView.progressViewStyle = UIProgressViewStyleBar;\n    return indicator;\n}\n#endif\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageOperation.h\"\n#import \"SDImageCacheDefine.h\"\n#import \"SDImageLoader.h\"\n#import \"SDImageTransformer.h\"\n#import \"SDWebImageCacheKeyFilter.h\"\n#import \"SDWebImageCacheSerializer.h\"\n#import \"SDWebImageOptionsProcessor.h\"\n\ntypedef void(^SDExternalCompletionBlock)(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL);\n\ntypedef void(^SDInternalCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL);\n\n/**\n A combined operation representing the cache and loader operation. You can use it to cancel the load process.\n */\n@interface SDWebImageCombinedOperation : NSObject <SDWebImageOperation>\n\n/**\n Cancel the current operation, including cache and loader process\n */\n- (void)cancel;\n\n/**\n The cache operation from the image cache query\n */\n@property (strong, nonatomic, nullable, readonly) id<SDWebImageOperation> cacheOperation;\n\n/**\n The loader operation from the image loader (such as download operation)\n */\n@property (strong, nonatomic, nullable, readonly) id<SDWebImageOperation> loaderOperation;\n\n@end\n\n\n@class SDWebImageManager;\n\n/**\n The manager delegate protocol.\n */\n@protocol SDWebImageManagerDelegate <NSObject>\n\n@optional\n\n/**\n * Controls which image should be downloaded when the image is not found in the cache.\n *\n * @param imageManager The current `SDWebImageManager`\n * @param imageURL     The url of the image to be downloaded\n *\n * @return Return NO to prevent the downloading of the image on cache misses. If not implemented, YES is implied.\n */\n- (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldDownloadImageForURL:(nonnull NSURL *)imageURL;\n\n/**\n * Controls the complicated logic to mark as failed URLs when download error occur.\n * If the delegate implement this method, we will not use the built-in way to mark URL as failed based on error code;\n @param imageManager The current `SDWebImageManager`\n @param imageURL The url of the image\n @param error The download error for the url\n @return Whether to block this url or not. Return YES to mark this URL as failed.\n */\n- (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldBlockFailedURL:(nonnull NSURL *)imageURL withError:(nonnull NSError *)error;\n\n@end\n\n/**\n * The SDWebImageManager is the class behind the UIImageView+WebCache category and likes.\n * It ties the asynchronous downloader (SDWebImageDownloader) with the image cache store (SDImageCache).\n * You can use this class directly to benefit from web image downloading with caching in another context than\n * a UIView.\n *\n * Here is a simple example of how to use SDWebImageManager:\n *\n * @code\n\nSDWebImageManager *manager = [SDWebImageManager sharedManager];\n[manager loadImageWithURL:imageURL\n                  options:0\n                 progress:nil\n                completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {\n                    if (image) {\n                        // do something with image\n                    }\n                }];\n\n * @endcode\n */\n@interface SDWebImageManager : NSObject\n\n/**\n * The delegate for manager. Defaults to nil.\n */\n@property (weak, nonatomic, nullable) id <SDWebImageManagerDelegate> delegate;\n\n/**\n * The image cache used by manager to query image cache.\n */\n@property (strong, nonatomic, readonly, nonnull) id<SDImageCache> imageCache;\n\n/**\n * The image loader used by manager to load image.\n */\n@property (strong, nonatomic, readonly, nonnull) id<SDImageLoader> imageLoader;\n\n/**\n The image transformer for manager. It's used for image transform after the image load finished and store the transformed image to cache, see `SDImageTransformer`.\n Defaults to nil, which means no transform is applied.\n @note This will affect all the load requests for this manager if you provide. However, you can pass `SDWebImageContextImageTransformer` in context arg to explicitly use that transformer instead.\n */\n@property (strong, nonatomic, nullable) id<SDImageTransformer> transformer;\n\n/**\n * The cache filter is used to convert an URL into a cache key each time SDWebImageManager need cache key to use image cache.\n *\n * The following example sets a filter in the application delegate that will remove any query-string from the\n * URL before to use it as a cache key:\n *\n * @code\n SDWebImageManager.sharedManager.cacheKeyFilter =[SDWebImageCacheKeyFilter cacheKeyFilterWithBlock:^NSString * _Nullable(NSURL * _Nonnull url) {\n    url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];\n    return [url absoluteString];\n }];\n * @endcode\n */\n@property (nonatomic, strong, nullable) id<SDWebImageCacheKeyFilter> cacheKeyFilter;\n\n/**\n * The cache serializer is used to convert the decoded image, the source downloaded data, to the actual data used for storing to the disk cache. If you return nil, means to generate the data from the image instance, see `SDImageCache`.\n * For example, if you are using WebP images and facing the slow decoding time issue when later retrieving from disk cache again. You can try to encode the decoded image to JPEG/PNG format to disk cache instead of source downloaded data.\n * @note The `image` arg is nonnull, but when you also provide an image transformer and the image is transformed, the `data` arg may be nil, take attention to this case.\n * @note This method is called from a global queue in order to not to block the main thread.\n * @code\n SDWebImageManager.sharedManager.cacheSerializer = [SDWebImageCacheSerializer cacheSerializerWithBlock:^NSData * _Nullable(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL) {\n    SDImageFormat format = [NSData sd_imageFormatForImageData:data];\n    switch (format) {\n        case SDImageFormatWebP:\n            return image.images ? data : nil;\n        default:\n            return data;\n    }\n}];\n * @endcode\n * The default value is nil. Means we just store the source downloaded data to disk cache.\n */\n@property (nonatomic, strong, nullable) id<SDWebImageCacheSerializer> cacheSerializer;\n\n/**\n The options processor is used, to have a global control for all the image request options and context option for current manager.\n @note If you use `transformer`, `cacheKeyFilter` or `cacheSerializer` property of manager, the input context option already apply those properties before passed. This options processor is a better replacement for those property in common usage.\n For example, you can control the global options, based on the URL or original context option like the below code.\n \n @code\n SDWebImageManager.sharedManager.optionsProcessor = [SDWebImageOptionsProcessor optionsProcessorWithBlock:^SDWebImageOptionsResult * _Nullable(NSURL * _Nullable url, SDWebImageOptions options, SDWebImageContext * _Nullable context) {\n     // Only do animation on `SDAnimatedImageView`\n     if (!context[SDWebImageContextAnimatedImageClass]) {\n        options |= SDWebImageDecodeFirstFrameOnly;\n     }\n     // Do not force decode for png url\n     if ([url.lastPathComponent isEqualToString:@\"png\"]) {\n        options |= SDWebImageAvoidDecodeImage;\n     }\n     // Always use screen scale factor\n     SDWebImageMutableContext *mutableContext = [NSDictionary dictionaryWithDictionary:context];\n     mutableContext[SDWebImageContextImageScaleFactor] = @(UIScreen.mainScreen.scale);\n     context = [mutableContext copy];\n \n     return [[SDWebImageOptionsResult alloc] initWithOptions:options context:context];\n }];\n @endcode\n */\n@property (nonatomic, strong, nullable) id<SDWebImageOptionsProcessor> optionsProcessor;\n\n/**\n * Check one or more operations running\n */\n@property (nonatomic, assign, readonly, getter=isRunning) BOOL running;\n\n/**\n The default image cache when the manager which is created with no arguments. Such as shared manager or init.\n Defaults to nil. Means using `SDImageCache.sharedImageCache`\n */\n@property (nonatomic, class, nullable) id<SDImageCache> defaultImageCache;\n\n/**\n The default image loader for manager which is created with no arguments. Such as shared manager or init.\n Defaults to nil. Means using `SDWebImageDownloader.sharedDownloader`\n */\n@property (nonatomic, class, nullable) id<SDImageLoader> defaultImageLoader;\n\n/**\n * Returns global shared manager instance.\n */\n@property (nonatomic, class, readonly, nonnull) SDWebImageManager *sharedManager;\n\n/**\n * Allows to specify instance of cache and image loader used with image manager.\n * @return new instance of `SDWebImageManager` with specified cache and loader.\n */\n- (nonnull instancetype)initWithCache:(nonnull id<SDImageCache>)cache loader:(nonnull id<SDImageLoader>)loader NS_DESIGNATED_INITIALIZER;\n\n/**\n * Downloads the image at the given URL if not present in cache or return the cached version otherwise.\n *\n * @param url            The URL to the image\n * @param options        A mask to specify options to use for this request\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed.\n *\n *   This parameter is required.\n * \n *   This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter.\n *   In case of error the image parameter is nil and the third parameter may contain an NSError.\n *\n *   The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache\n *   or from the memory cache or from the network.\n *\n *   The fifth parameter is set to NO when the SDWebImageProgressiveLoad option is used and the image is\n *   downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the\n *   block is called a last time with the full image and the last parameter set to YES.\n *\n *   The last parameter is the original image URL\n *\n * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process.\n */\n- (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url\n                                                   options:(SDWebImageOptions)options\n                                                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                                                 completed:(nonnull SDInternalCompletionBlock)completedBlock;\n\n/**\n * Downloads the image at the given URL if not present in cache or return the cached version otherwise.\n *\n * @param url            The URL to the image\n * @param options        A mask to specify options to use for this request\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed.\n *\n * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process.\n */\n- (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url\n                                                   options:(SDWebImageOptions)options\n                                                   context:(nullable SDWebImageContext *)context\n                                                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                                                 completed:(nonnull SDInternalCompletionBlock)completedBlock;\n\n/**\n * Cancel all current operations\n */\n- (void)cancelAll;\n\n/**\n * Remove the specify URL from failed black list.\n * @param url The failed URL.\n */\n- (void)removeFailedURL:(nonnull NSURL *)url;\n\n/**\n * Remove all the URL from failed black list.\n */\n- (void)removeAllFailedURLs;\n\n/**\n * Return the cache key for a given URL, does not considerate transformer or thumbnail.\n * @note This method does not have context option, only use the url and manager level cacheKeyFilter to generate the cache key.\n */\n- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url;\n\n/**\n * Return the cache key for a given URL and context option.\n * @note The context option like `.thumbnailPixelSize` and `.imageTransformer` will effect the generated cache key, using this if you have those context associated.\n*/\n- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageManager.h\"\n#import \"SDImageCache.h\"\n#import \"SDWebImageDownloader.h\"\n#import \"UIImage+Metadata.h\"\n#import \"SDAssociatedObject.h\"\n#import \"SDWebImageError.h\"\n#import \"SDInternalMacros.h\"\n\nstatic id<SDImageCache> _defaultImageCache;\nstatic id<SDImageLoader> _defaultImageLoader;\n\n@interface SDWebImageCombinedOperation ()\n\n@property (assign, nonatomic, getter = isCancelled) BOOL cancelled;\n@property (strong, nonatomic, readwrite, nullable) id<SDWebImageOperation> loaderOperation;\n@property (strong, nonatomic, readwrite, nullable) id<SDWebImageOperation> cacheOperation;\n@property (weak, nonatomic, nullable) SDWebImageManager *manager;\n\n@end\n\n@interface SDWebImageManager () {\n    SD_LOCK_DECLARE(_failedURLsLock); // a lock to keep the access to `failedURLs` thread-safe\n    SD_LOCK_DECLARE(_runningOperationsLock); // a lock to keep the access to `runningOperations` thread-safe\n}\n\n@property (strong, nonatomic, readwrite, nonnull) SDImageCache *imageCache;\n@property (strong, nonatomic, readwrite, nonnull) id<SDImageLoader> imageLoader;\n@property (strong, nonatomic, nonnull) NSMutableSet<NSURL *> *failedURLs;\n@property (strong, nonatomic, nonnull) NSMutableSet<SDWebImageCombinedOperation *> *runningOperations;\n\n@end\n\n@implementation SDWebImageManager\n\n+ (id<SDImageCache>)defaultImageCache {\n    return _defaultImageCache;\n}\n\n+ (void)setDefaultImageCache:(id<SDImageCache>)defaultImageCache {\n    if (defaultImageCache && ![defaultImageCache conformsToProtocol:@protocol(SDImageCache)]) {\n        return;\n    }\n    _defaultImageCache = defaultImageCache;\n}\n\n+ (id<SDImageLoader>)defaultImageLoader {\n    return _defaultImageLoader;\n}\n\n+ (void)setDefaultImageLoader:(id<SDImageLoader>)defaultImageLoader {\n    if (defaultImageLoader && ![defaultImageLoader conformsToProtocol:@protocol(SDImageLoader)]) {\n        return;\n    }\n    _defaultImageLoader = defaultImageLoader;\n}\n\n+ (nonnull instancetype)sharedManager {\n    static dispatch_once_t once;\n    static id instance;\n    dispatch_once(&once, ^{\n        instance = [self new];\n    });\n    return instance;\n}\n\n- (nonnull instancetype)init {\n    id<SDImageCache> cache = [[self class] defaultImageCache];\n    if (!cache) {\n        cache = [SDImageCache sharedImageCache];\n    }\n    id<SDImageLoader> loader = [[self class] defaultImageLoader];\n    if (!loader) {\n        loader = [SDWebImageDownloader sharedDownloader];\n    }\n    return [self initWithCache:cache loader:loader];\n}\n\n- (nonnull instancetype)initWithCache:(nonnull id<SDImageCache>)cache loader:(nonnull id<SDImageLoader>)loader {\n    if ((self = [super init])) {\n        _imageCache = cache;\n        _imageLoader = loader;\n        _failedURLs = [NSMutableSet new];\n        SD_LOCK_INIT(_failedURLsLock);\n        _runningOperations = [NSMutableSet new];\n        SD_LOCK_INIT(_runningOperationsLock);\n    }\n    return self;\n}\n\n- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url {\n    if (!url) {\n        return @\"\";\n    }\n    \n    NSString *key;\n    // Cache Key Filter\n    id<SDWebImageCacheKeyFilter> cacheKeyFilter = self.cacheKeyFilter;\n    if (cacheKeyFilter) {\n        key = [cacheKeyFilter cacheKeyForURL:url];\n    } else {\n        key = url.absoluteString;\n    }\n    \n    return key;\n}\n\n- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context {\n    if (!url) {\n        return @\"\";\n    }\n    \n    NSString *key;\n    // Cache Key Filter\n    id<SDWebImageCacheKeyFilter> cacheKeyFilter = self.cacheKeyFilter;\n    if (context[SDWebImageContextCacheKeyFilter]) {\n        cacheKeyFilter = context[SDWebImageContextCacheKeyFilter];\n    }\n    if (cacheKeyFilter) {\n        key = [cacheKeyFilter cacheKeyForURL:url];\n    } else {\n        key = url.absoluteString;\n    }\n    \n    // Thumbnail Key Appending\n    NSValue *thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];\n    if (thumbnailSizeValue != nil) {\n        CGSize thumbnailSize = CGSizeZero;\n#if SD_MAC\n        thumbnailSize = thumbnailSizeValue.sizeValue;\n#else\n        thumbnailSize = thumbnailSizeValue.CGSizeValue;\n#endif\n        BOOL preserveAspectRatio = YES;\n        NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];\n        if (preserveAspectRatioValue != nil) {\n            preserveAspectRatio = preserveAspectRatioValue.boolValue;\n        }\n        key = SDThumbnailedKeyForKey(key, thumbnailSize, preserveAspectRatio);\n    }\n    \n    // Transformer Key Appending\n    id<SDImageTransformer> transformer = self.transformer;\n    if (context[SDWebImageContextImageTransformer]) {\n        transformer = context[SDWebImageContextImageTransformer];\n        if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) {\n            transformer = nil;\n        }\n    }\n    if (transformer) {\n        key = SDTransformedKeyForKey(key, transformer.transformerKey);\n    }\n    \n    return key;\n}\n\n- (SDWebImageCombinedOperation *)loadImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDInternalCompletionBlock)completedBlock {\n    return [self loadImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url\n                                          options:(SDWebImageOptions)options\n                                          context:(nullable SDWebImageContext *)context\n                                         progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                                        completed:(nonnull SDInternalCompletionBlock)completedBlock {\n    // Invoking this method without a completedBlock is pointless\n    NSAssert(completedBlock != nil, @\"If you mean to prefetch the image, use -[SDWebImagePrefetcher prefetchURLs] instead\");\n\n    // Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, Xcode won't\n    // throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString.\n    if ([url isKindOfClass:NSString.class]) {\n        url = [NSURL URLWithString:(NSString *)url];\n    }\n\n    // Prevents app crashing on argument type error like sending NSNull instead of NSURL\n    if (![url isKindOfClass:NSURL.class]) {\n        url = nil;\n    }\n\n    SDWebImageCombinedOperation *operation = [SDWebImageCombinedOperation new];\n    operation.manager = self;\n\n    BOOL isFailedUrl = NO;\n    if (url) {\n        SD_LOCK(_failedURLsLock);\n        isFailedUrl = [self.failedURLs containsObject:url];\n        SD_UNLOCK(_failedURLsLock);\n    }\n\n    if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) {\n        NSString *description = isFailedUrl ? @\"Image url is blacklisted\" : @\"Image url is nil\";\n        NSInteger code = isFailedUrl ? SDWebImageErrorBlackListed : SDWebImageErrorInvalidURL;\n        [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : description}] url:url];\n        return operation;\n    }\n\n    SD_LOCK(_runningOperationsLock);\n    [self.runningOperations addObject:operation];\n    SD_UNLOCK(_runningOperationsLock);\n    \n    // Preprocess the options and context arg to decide the final the result for manager\n    SDWebImageOptionsResult *result = [self processedResultForURL:url options:options context:context];\n    \n    // Start the entry to load image from cache\n    [self callCacheProcessForOperation:operation url:url options:result.options context:result.context progress:progressBlock completed:completedBlock];\n\n    return operation;\n}\n\n- (void)cancelAll {\n    SD_LOCK(_runningOperationsLock);\n    NSSet<SDWebImageCombinedOperation *> *copiedOperations = [self.runningOperations copy];\n    SD_UNLOCK(_runningOperationsLock);\n    [copiedOperations makeObjectsPerformSelector:@selector(cancel)]; // This will call `safelyRemoveOperationFromRunning:` and remove from the array\n}\n\n- (BOOL)isRunning {\n    BOOL isRunning = NO;\n    SD_LOCK(_runningOperationsLock);\n    isRunning = (self.runningOperations.count > 0);\n    SD_UNLOCK(_runningOperationsLock);\n    return isRunning;\n}\n\n- (void)removeFailedURL:(NSURL *)url {\n    if (!url) {\n        return;\n    }\n    SD_LOCK(_failedURLsLock);\n    [self.failedURLs removeObject:url];\n    SD_UNLOCK(_failedURLsLock);\n}\n\n- (void)removeAllFailedURLs {\n    SD_LOCK(_failedURLsLock);\n    [self.failedURLs removeAllObjects];\n    SD_UNLOCK(_failedURLsLock);\n}\n\n#pragma mark - Private\n\n// Query normal cache process\n- (void)callCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation\n                                 url:(nonnull NSURL *)url\n                             options:(SDWebImageOptions)options\n                             context:(nullable SDWebImageContext *)context\n                            progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                           completed:(nullable SDInternalCompletionBlock)completedBlock {\n    // Grab the image cache to use\n    id<SDImageCache> imageCache;\n    if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) {\n        imageCache = context[SDWebImageContextImageCache];\n    } else {\n        imageCache = self.imageCache;\n    }\n    // Get the query cache type\n    SDImageCacheType queryCacheType = SDImageCacheTypeAll;\n    if (context[SDWebImageContextQueryCacheType]) {\n        queryCacheType = [context[SDWebImageContextQueryCacheType] integerValue];\n    }\n    \n    // Check whether we should query cache\n    BOOL shouldQueryCache = !SD_OPTIONS_CONTAINS(options, SDWebImageFromLoaderOnly);\n    if (shouldQueryCache) {\n        NSString *key = [self cacheKeyForURL:url context:context];\n        @weakify(operation);\n        operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) {\n            @strongify(operation);\n            if (!operation || operation.isCancelled) {\n                // Image combined operation cancelled by user\n                [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @\"Operation cancelled by user during querying the cache\"}] url:url];\n                [self safelyRemoveOperationFromRunning:operation];\n                return;\n            } else if (context[SDWebImageContextImageTransformer] && !cachedImage) {\n                // Have a chance to query original cache instead of downloading\n                [self callOriginalCacheProcessForOperation:operation url:url options:options context:context progress:progressBlock completed:completedBlock];\n                return;\n            }\n            \n            // Continue download process\n            [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:cachedImage cachedData:cachedData cacheType:cacheType progress:progressBlock completed:completedBlock];\n        }];\n    } else {\n        // Continue download process\n        [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock];\n    }\n}\n\n// Query original cache process\n- (void)callOriginalCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation\n                                         url:(nonnull NSURL *)url\n                                     options:(SDWebImageOptions)options\n                                     context:(nullable SDWebImageContext *)context\n                                    progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                                   completed:(nullable SDInternalCompletionBlock)completedBlock {\n    // Grab the image cache to use, choose standalone original cache firstly\n    id<SDImageCache> imageCache;\n    if ([context[SDWebImageContextOriginalImageCache] conformsToProtocol:@protocol(SDImageCache)]) {\n        imageCache = context[SDWebImageContextOriginalImageCache];\n    } else {\n        // if no standalone cache available, use default cache\n        if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) {\n            imageCache = context[SDWebImageContextImageCache];\n        } else {\n            imageCache = self.imageCache;\n        }\n    }\n    // Get the original query cache type\n    SDImageCacheType originalQueryCacheType = SDImageCacheTypeDisk;\n    if (context[SDWebImageContextOriginalQueryCacheType]) {\n        originalQueryCacheType = [context[SDWebImageContextOriginalQueryCacheType] integerValue];\n    }\n    \n    // Check whether we should query original cache\n    BOOL shouldQueryOriginalCache = (originalQueryCacheType != SDImageCacheTypeNone);\n    if (shouldQueryOriginalCache) {\n        // Disable transformer for original cache key generation\n        SDWebImageMutableContext *tempContext = [context mutableCopy];\n        tempContext[SDWebImageContextImageTransformer] = [NSNull null];\n        NSString *key = [self cacheKeyForURL:url context:tempContext];\n        @weakify(operation);\n        operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:originalQueryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) {\n            @strongify(operation);\n            if (!operation || operation.isCancelled) {\n                // Image combined operation cancelled by user\n                [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @\"Operation cancelled by user during querying the cache\"}] url:url];\n                [self safelyRemoveOperationFromRunning:operation];\n                return;\n            } else if (context[SDWebImageContextImageTransformer] && !cachedImage) {\n                // Original image cache miss. Continue download process\n                [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:originalQueryCacheType progress:progressBlock completed:completedBlock];\n                return;\n            }\n                        \n            // Use the store cache process instead of downloading, and ignore .refreshCached option for now\n            [self callStoreCacheProcessForOperation:operation url:url options:options context:context downloadedImage:cachedImage downloadedData:cachedData finished:YES progress:progressBlock completed:completedBlock];\n            \n            [self safelyRemoveOperationFromRunning:operation];\n        }];\n    } else {\n        // Continue download process\n        [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:originalQueryCacheType progress:progressBlock completed:completedBlock];\n    }\n}\n\n// Download process\n- (void)callDownloadProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation\n                                    url:(nonnull NSURL *)url\n                                options:(SDWebImageOptions)options\n                                context:(SDWebImageContext *)context\n                            cachedImage:(nullable UIImage *)cachedImage\n                             cachedData:(nullable NSData *)cachedData\n                              cacheType:(SDImageCacheType)cacheType\n                               progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                              completed:(nullable SDInternalCompletionBlock)completedBlock {\n    // Grab the image loader to use\n    id<SDImageLoader> imageLoader;\n    if ([context[SDWebImageContextImageLoader] conformsToProtocol:@protocol(SDImageLoader)]) {\n        imageLoader = context[SDWebImageContextImageLoader];\n    } else {\n        imageLoader = self.imageLoader;\n    }\n    \n    // Check whether we should download image from network\n    BOOL shouldDownload = !SD_OPTIONS_CONTAINS(options, SDWebImageFromCacheOnly);\n    shouldDownload &= (!cachedImage || options & SDWebImageRefreshCached);\n    shouldDownload &= (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url]);\n    if ([imageLoader respondsToSelector:@selector(canRequestImageForURL:options:context:)]) {\n        shouldDownload &= [imageLoader canRequestImageForURL:url options:options context:context];\n    } else {\n        shouldDownload &= [imageLoader canRequestImageForURL:url];\n    }\n    if (shouldDownload) {\n        if (cachedImage && options & SDWebImageRefreshCached) {\n            // If image was found in the cache but SDWebImageRefreshCached is provided, notify about the cached image\n            // AND try to re-download it in order to let a chance to NSURLCache to refresh it from server.\n            [self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url];\n            // Pass the cached image to the image loader. The image loader should check whether the remote image is equal to the cached image.\n            SDWebImageMutableContext *mutableContext;\n            if (context) {\n                mutableContext = [context mutableCopy];\n            } else {\n                mutableContext = [NSMutableDictionary dictionary];\n            }\n            mutableContext[SDWebImageContextLoaderCachedImage] = cachedImage;\n            context = [mutableContext copy];\n        }\n        \n        @weakify(operation);\n        operation.loaderOperation = [imageLoader requestImageWithURL:url options:options context:context progress:progressBlock completed:^(UIImage *downloadedImage, NSData *downloadedData, NSError *error, BOOL finished) {\n            @strongify(operation);\n            if (!operation || operation.isCancelled) {\n                // Image combined operation cancelled by user\n                [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @\"Operation cancelled by user during sending the request\"}] url:url];\n            } else if (cachedImage && options & SDWebImageRefreshCached && [error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCacheNotModified) {\n                // Image refresh hit the NSURLCache cache, do not call the completion block\n            } else if ([error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCancelled) {\n                // Download operation cancelled by user before sending the request, don't block failed URL\n                [self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url];\n            } else if (error) {\n                [self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url];\n                BOOL shouldBlockFailedURL = [self shouldBlockFailedURLWithURL:url error:error options:options context:context];\n                \n                if (shouldBlockFailedURL) {\n                    SD_LOCK(self->_failedURLsLock);\n                    [self.failedURLs addObject:url];\n                    SD_UNLOCK(self->_failedURLsLock);\n                }\n            } else {\n                if ((options & SDWebImageRetryFailed)) {\n                    SD_LOCK(self->_failedURLsLock);\n                    [self.failedURLs removeObject:url];\n                    SD_UNLOCK(self->_failedURLsLock);\n                }\n                // Continue store cache process\n                [self callStoreCacheProcessForOperation:operation url:url options:options context:context downloadedImage:downloadedImage downloadedData:downloadedData finished:finished progress:progressBlock completed:completedBlock];\n            }\n            \n            if (finished) {\n                [self safelyRemoveOperationFromRunning:operation];\n            }\n        }];\n    } else if (cachedImage) {\n        [self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url];\n        [self safelyRemoveOperationFromRunning:operation];\n    } else {\n        // Image not in cache and download disallowed by delegate\n        [self callCompletionBlockForOperation:operation completion:completedBlock image:nil data:nil error:nil cacheType:SDImageCacheTypeNone finished:YES url:url];\n        [self safelyRemoveOperationFromRunning:operation];\n    }\n}\n\n// Store cache process\n- (void)callStoreCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation\n                                      url:(nonnull NSURL *)url\n                                  options:(SDWebImageOptions)options\n                                  context:(SDWebImageContext *)context\n                          downloadedImage:(nullable UIImage *)downloadedImage\n                           downloadedData:(nullable NSData *)downloadedData\n                                 finished:(BOOL)finished\n                                 progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                                completed:(nullable SDInternalCompletionBlock)completedBlock {\n    // Grab the image cache to use, choose standalone original cache firstly\n    id<SDImageCache> imageCache;\n    if ([context[SDWebImageContextOriginalImageCache] conformsToProtocol:@protocol(SDImageCache)]) {\n        imageCache = context[SDWebImageContextOriginalImageCache];\n    } else {\n        // if no standalone cache available, use default cache\n        if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) {\n            imageCache = context[SDWebImageContextImageCache];\n        } else {\n            imageCache = self.imageCache;\n        }\n    }\n    // the target image store cache type\n    SDImageCacheType storeCacheType = SDImageCacheTypeAll;\n    if (context[SDWebImageContextStoreCacheType]) {\n        storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue];\n    }\n    // the original store image cache type\n    SDImageCacheType originalStoreCacheType = SDImageCacheTypeDisk;\n    if (context[SDWebImageContextOriginalStoreCacheType]) {\n        originalStoreCacheType = [context[SDWebImageContextOriginalStoreCacheType] integerValue];\n    }\n    // Disable transformer for original cache key generation\n    SDWebImageMutableContext *tempContext = [context mutableCopy];\n    tempContext[SDWebImageContextImageTransformer] = [NSNull null];\n    NSString *key = [self cacheKeyForURL:url context:tempContext];\n    id<SDImageTransformer> transformer = context[SDWebImageContextImageTransformer];\n    if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) {\n        transformer = nil;\n    }\n    id<SDWebImageCacheSerializer> cacheSerializer = context[SDWebImageContextCacheSerializer];\n    \n    BOOL shouldTransformImage = downloadedImage && transformer;\n    shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage));\n    shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isVector || (options & SDWebImageTransformVectorImage));\n    BOOL shouldCacheOriginal = downloadedImage && finished;\n    \n    // if available, store original image to cache\n    if (shouldCacheOriginal) {\n        // normally use the store cache type, but if target image is transformed, use original store cache type instead\n        SDImageCacheType targetStoreCacheType = shouldTransformImage ? originalStoreCacheType : storeCacheType;\n        if (cacheSerializer && (targetStoreCacheType == SDImageCacheTypeDisk || targetStoreCacheType == SDImageCacheTypeAll)) {\n            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{\n                @autoreleasepool {\n                    NSData *cacheData = [cacheSerializer cacheDataWithImage:downloadedImage originalData:downloadedData imageURL:url];\n                    [self storeImage:downloadedImage imageData:cacheData forKey:key imageCache:imageCache cacheType:targetStoreCacheType options:options context:context completion:^{\n                        // Continue transform process\n                        [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData finished:finished progress:progressBlock completed:completedBlock];\n                    }];\n                }\n            });\n        } else {\n            [self storeImage:downloadedImage imageData:downloadedData forKey:key imageCache:imageCache cacheType:targetStoreCacheType options:options context:context completion:^{\n                // Continue transform process\n                [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData finished:finished progress:progressBlock completed:completedBlock];\n            }];\n        }\n    } else {\n        // Continue transform process\n        [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData finished:finished progress:progressBlock completed:completedBlock];\n    }\n}\n\n// Transform process\n- (void)callTransformProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation\n                                     url:(nonnull NSURL *)url\n                                 options:(SDWebImageOptions)options\n                                 context:(SDWebImageContext *)context\n                           originalImage:(nullable UIImage *)originalImage\n                            originalData:(nullable NSData *)originalData\n                                finished:(BOOL)finished\n                                progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                               completed:(nullable SDInternalCompletionBlock)completedBlock {\n    // Grab the image cache to use\n    id<SDImageCache> imageCache;\n    if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) {\n        imageCache = context[SDWebImageContextImageCache];\n    } else {\n        imageCache = self.imageCache;\n    }\n    // the target image store cache type\n    SDImageCacheType storeCacheType = SDImageCacheTypeAll;\n    if (context[SDWebImageContextStoreCacheType]) {\n        storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue];\n    }\n    // transformed cache key\n    NSString *key = [self cacheKeyForURL:url context:context];\n    id<SDImageTransformer> transformer = context[SDWebImageContextImageTransformer];\n    if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) {\n        transformer = nil;\n    }\n    id<SDWebImageCacheSerializer> cacheSerializer = context[SDWebImageContextCacheSerializer];\n    \n    BOOL shouldTransformImage = originalImage && transformer;\n    shouldTransformImage = shouldTransformImage && (!originalImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage));\n    shouldTransformImage = shouldTransformImage && (!originalImage.sd_isVector || (options & SDWebImageTransformVectorImage));\n    // if available, store transformed image to cache\n    if (shouldTransformImage) {\n        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{\n            @autoreleasepool {\n                UIImage *transformedImage = [transformer transformedImageWithImage:originalImage forKey:key];\n                if (transformedImage && finished) {\n                    BOOL imageWasTransformed = ![transformedImage isEqual:originalImage];\n                    NSData *cacheData;\n                    // pass nil if the image was transformed, so we can recalculate the data from the image\n                    if (cacheSerializer && (storeCacheType == SDImageCacheTypeDisk || storeCacheType == SDImageCacheTypeAll)) {\n                        cacheData = [cacheSerializer cacheDataWithImage:transformedImage originalData:(imageWasTransformed ? nil : originalData) imageURL:url];\n                    } else {\n                        cacheData = (imageWasTransformed ? nil : originalData);\n                    }\n                    [self storeImage:transformedImage imageData:cacheData forKey:key imageCache:imageCache cacheType:storeCacheType options:options context:context completion:^{\n                        [self callCompletionBlockForOperation:operation completion:completedBlock image:transformedImage data:originalData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url];\n                    }];\n                } else {\n                    [self callCompletionBlockForOperation:operation completion:completedBlock image:transformedImage data:originalData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url];\n                }\n            }\n        });\n    } else {\n        [self callCompletionBlockForOperation:operation completion:completedBlock image:originalImage data:originalData error:nil cacheType:SDImageCacheTypeNone finished:finished url:url];\n    }\n}\n\n#pragma mark - Helper\n\n- (void)safelyRemoveOperationFromRunning:(nullable SDWebImageCombinedOperation*)operation {\n    if (!operation) {\n        return;\n    }\n    SD_LOCK(_runningOperationsLock);\n    [self.runningOperations removeObject:operation];\n    SD_UNLOCK(_runningOperationsLock);\n}\n\n- (void)storeImage:(nullable UIImage *)image\n         imageData:(nullable NSData *)data\n            forKey:(nullable NSString *)key\n        imageCache:(nonnull id<SDImageCache>)imageCache\n         cacheType:(SDImageCacheType)cacheType\n           options:(SDWebImageOptions)options\n           context:(nullable SDWebImageContext *)context\n        completion:(nullable SDWebImageNoParamsBlock)completion {\n    BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache);\n    // Check whether we should wait the store cache finished. If not, callback immediately\n    [imageCache storeImage:image imageData:data forKey:key cacheType:cacheType completion:^{\n        if (waitStoreCache) {\n            if (completion) {\n                completion();\n            }\n        }\n    }];\n    if (!waitStoreCache) {\n        if (completion) {\n            completion();\n        }\n    }\n}\n\n- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation\n                             completion:(nullable SDInternalCompletionBlock)completionBlock\n                                  error:(nullable NSError *)error\n                                    url:(nullable NSURL *)url {\n    [self callCompletionBlockForOperation:operation completion:completionBlock image:nil data:nil error:error cacheType:SDImageCacheTypeNone finished:YES url:url];\n}\n\n- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation\n                             completion:(nullable SDInternalCompletionBlock)completionBlock\n                                  image:(nullable UIImage *)image\n                                   data:(nullable NSData *)data\n                                  error:(nullable NSError *)error\n                              cacheType:(SDImageCacheType)cacheType\n                               finished:(BOOL)finished\n                                    url:(nullable NSURL *)url {\n    dispatch_main_async_safe(^{\n        if (completionBlock) {\n            completionBlock(image, data, error, cacheType, finished, url);\n        }\n    });\n}\n\n- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url\n                              error:(nonnull NSError *)error\n                            options:(SDWebImageOptions)options\n                            context:(nullable SDWebImageContext *)context {\n    id<SDImageLoader> imageLoader;\n    if ([context[SDWebImageContextImageLoader] conformsToProtocol:@protocol(SDImageLoader)]) {\n        imageLoader = context[SDWebImageContextImageLoader];\n    } else {\n        imageLoader = self.imageLoader;\n    }\n    // Check whether we should block failed url\n    BOOL shouldBlockFailedURL;\n    if ([self.delegate respondsToSelector:@selector(imageManager:shouldBlockFailedURL:withError:)]) {\n        shouldBlockFailedURL = [self.delegate imageManager:self shouldBlockFailedURL:url withError:error];\n    } else {\n        if ([imageLoader respondsToSelector:@selector(shouldBlockFailedURLWithURL:error:options:context:)]) {\n            shouldBlockFailedURL = [imageLoader shouldBlockFailedURLWithURL:url error:error options:options context:context];\n        } else {\n            shouldBlockFailedURL = [imageLoader shouldBlockFailedURLWithURL:url error:error];\n        }\n    }\n    \n    return shouldBlockFailedURL;\n}\n\n- (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context {\n    SDWebImageOptionsResult *result;\n    SDWebImageMutableContext *mutableContext = [SDWebImageMutableContext dictionary];\n    \n    // Image Transformer from manager\n    if (!context[SDWebImageContextImageTransformer]) {\n        id<SDImageTransformer> transformer = self.transformer;\n        [mutableContext setValue:transformer forKey:SDWebImageContextImageTransformer];\n    }\n    // Cache key filter from manager\n    if (!context[SDWebImageContextCacheKeyFilter]) {\n        id<SDWebImageCacheKeyFilter> cacheKeyFilter = self.cacheKeyFilter;\n        [mutableContext setValue:cacheKeyFilter forKey:SDWebImageContextCacheKeyFilter];\n    }\n    // Cache serializer from manager\n    if (!context[SDWebImageContextCacheSerializer]) {\n        id<SDWebImageCacheSerializer> cacheSerializer = self.cacheSerializer;\n        [mutableContext setValue:cacheSerializer forKey:SDWebImageContextCacheSerializer];\n    }\n    \n    if (mutableContext.count > 0) {\n        if (context) {\n            [mutableContext addEntriesFromDictionary:context];\n        }\n        context = [mutableContext copy];\n    }\n    \n    // Apply options processor\n    if (self.optionsProcessor) {\n        result = [self.optionsProcessor processedResultForURL:url options:options context:context];\n    }\n    if (!result) {\n        // Use default options result\n        result = [[SDWebImageOptionsResult alloc] initWithOptions:options context:context];\n    }\n    \n    return result;\n}\n\n@end\n\n\n@implementation SDWebImageCombinedOperation\n\n- (void)cancel {\n    @synchronized(self) {\n        if (self.isCancelled) {\n            return;\n        }\n        self.cancelled = YES;\n        if (self.cacheOperation) {\n            [self.cacheOperation cancel];\n            self.cacheOperation = nil;\n        }\n        if (self.loaderOperation) {\n            [self.loaderOperation cancel];\n            self.loaderOperation = nil;\n        }\n        [self.manager safelyRemoveOperationFromRunning:self];\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n\n/// A protocol represents cancelable operation.\n@protocol SDWebImageOperation <NSObject>\n\n- (void)cancel;\n\n@end\n\n/// NSOperation conform to `SDWebImageOperation`.\n@interface NSOperation (SDWebImageOperation) <SDWebImageOperation>\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageOperation.h\"\n\n/// NSOperation conform to `SDWebImageOperation`.\n@implementation NSOperation (SDWebImageOperation)\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageDefine.h\"\n\n@class SDWebImageOptionsResult;\n\ntypedef SDWebImageOptionsResult * _Nullable(^SDWebImageOptionsProcessorBlock)(NSURL * _Nullable url, SDWebImageOptions options, SDWebImageContext * _Nullable context);\n\n/**\n The options result contains both options and context.\n */\n@interface SDWebImageOptionsResult : NSObject\n\n/**\n WebCache options.\n */\n@property (nonatomic, assign, readonly) SDWebImageOptions options;\n\n/**\n Context options.\n */\n@property (nonatomic, copy, readonly, nullable) SDWebImageContext *context;\n\n/**\n Create a new options result.\n\n @param options options\n @param context context\n @return The options result contains both options and context.\n */\n- (nonnull instancetype)initWithOptions:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context;\n\n@end\n\n/**\n This is the protocol for options processor.\n Options processor can be used, to control the final result for individual image request's `SDWebImageOptions` and `SDWebImageContext`\n Implements the protocol to have a global control for each indivadual image request's option.\n */\n@protocol SDWebImageOptionsProcessor <NSObject>\n\n/**\n Return the processed options result for specify image URL, with its options and context\n\n @param url The URL to the image\n @param options A mask to specify options to use for this request\n @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n @return The processed result, contains both options and context\n */\n- (nullable SDWebImageOptionsResult *)processedResultForURL:(nullable NSURL *)url\n                                                    options:(SDWebImageOptions)options\n                                                    context:(nullable SDWebImageContext *)context;\n\n@end\n\n/**\n A options processor class with block.\n */\n@interface SDWebImageOptionsProcessor : NSObject<SDWebImageOptionsProcessor>\n\n- (nonnull instancetype)initWithBlock:(nonnull SDWebImageOptionsProcessorBlock)block;\n+ (nonnull instancetype)optionsProcessorWithBlock:(nonnull SDWebImageOptionsProcessorBlock)block;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageOptionsProcessor.h\"\n\n@interface SDWebImageOptionsResult ()\n\n@property (nonatomic, assign) SDWebImageOptions options;\n@property (nonatomic, copy, nullable) SDWebImageContext *context;\n\n@end\n\n@implementation SDWebImageOptionsResult\n\n- (instancetype)initWithOptions:(SDWebImageOptions)options context:(SDWebImageContext *)context {\n    self = [super init];\n    if (self) {\n        self.options = options;\n        self.context = context;\n    }\n    return self;\n}\n\n@end\n\n@interface SDWebImageOptionsProcessor ()\n\n@property (nonatomic, copy, nonnull) SDWebImageOptionsProcessorBlock block;\n\n@end\n\n@implementation SDWebImageOptionsProcessor\n\n- (instancetype)initWithBlock:(SDWebImageOptionsProcessorBlock)block {\n    self = [super init];\n    if (self) {\n        self.block = block;\n    }\n    return self;\n}\n\n+ (instancetype)optionsProcessorWithBlock:(SDWebImageOptionsProcessorBlock)block {\n    SDWebImageOptionsProcessor *optionsProcessor = [[SDWebImageOptionsProcessor alloc] initWithBlock:block];\n    return optionsProcessor;\n}\n\n- (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context {\n    if (!self.block) {\n        return nil;\n    }\n    return self.block(url, options, context);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageManager.h\"\n\n@class SDWebImagePrefetcher;\n\n/**\n A token represents a list of URLs, can be used to cancel the download.\n */\n@interface SDWebImagePrefetchToken : NSObject <SDWebImageOperation>\n\n/**\n * Cancel the current prefetching.\n */\n- (void)cancel;\n\n/**\n list of URLs of current prefetching.\n */\n@property (nonatomic, copy, readonly, nullable) NSArray<NSURL *> *urls;\n\n@end\n\n/**\n The prefetcher delegate protocol\n */\n@protocol SDWebImagePrefetcherDelegate <NSObject>\n\n@optional\n\n/**\n * Called when an image was prefetched. Which means it's called when one URL from any of prefetching finished.\n *\n * @param imagePrefetcher The current image prefetcher\n * @param imageURL        The image url that was prefetched\n * @param finishedCount   The total number of images that were prefetched (successful or not)\n * @param totalCount      The total number of images that were to be prefetched\n */\n- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount;\n\n/**\n * Called when all images are prefetched. Which means it's called when all URLs from all of prefetching finished.\n * @param imagePrefetcher The current image prefetcher\n * @param totalCount      The total number of images that were prefetched (whether successful or not)\n * @param skippedCount    The total number of images that were skipped\n */\n- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount;\n\n@end\n\ntypedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls);\ntypedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls);\n\n/**\n * Prefetch some URLs in the cache for future use. Images are downloaded in low priority.\n */\n@interface SDWebImagePrefetcher : NSObject\n\n/**\n * The web image manager used by prefetcher to prefetch images.\n * @note You can specify a standalone manager and downloader with custom configuration suitable for image prefetching. Such as `currentDownloadCount` or `downloadTimeout`.\n */\n@property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager;\n\n/**\n * Maximum number of URLs to prefetch at the same time. Defaults to 3.\n */\n@property (nonatomic, assign) NSUInteger maxConcurrentPrefetchCount;\n\n/**\n * The options for prefetcher. Defaults to SDWebImageLowPriority.\n */\n@property (nonatomic, assign) SDWebImageOptions options;\n\n/**\n * The context for prefetcher. Defaults to nil.\n */\n@property (nonatomic, copy, nullable) SDWebImageContext *context;\n\n/**\n * Queue options for prefetcher when call the progressBlock, completionBlock and delegate methods. Defaults to Main Queue.\n * @note The call is asynchronously to avoid blocking target queue.\n * @note The delegate queue should be set before any prefetching start and may not be changed during prefetching to avoid thread-safe problem.\n */\n@property (strong, nonatomic, nonnull) dispatch_queue_t delegateQueue;\n\n/**\n * The delegate for the prefetcher. Defaults to nil.\n */\n@property (weak, nonatomic, nullable) id <SDWebImagePrefetcherDelegate> delegate;\n\n/**\n * Returns the global shared image prefetcher instance. It use a standalone manager which is different from shared manager.\n */\n@property (nonatomic, class, readonly, nonnull) SDWebImagePrefetcher *sharedImagePrefetcher;\n\n/**\n * Allows you to instantiate a prefetcher with any arbitrary image manager.\n */\n- (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER;\n\n/**\n * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property.\n * Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls.\n * Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch.\n *\n * @param urls list of URLs to prefetch\n * @return the token to cancel the current prefetching.\n */\n- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray<NSURL *> *)urls;\n\n/**\n * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property.\n * Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls.\n * Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch.\n *\n * @param urls            list of URLs to prefetch\n * @param progressBlock   block to be called when progress updates; \n *                        first parameter is the number of completed (successful or not) requests, \n *                        second parameter is the total number of images originally requested to be prefetched\n * @param completionBlock block to be called when the current prefetching is completed\n *                        first param is the number of completed (successful or not) requests,\n *                        second parameter is the number of skipped requests\n * @return the token to cancel the current prefetching.\n */\n- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray<NSURL *> *)urls\n                                          progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock\n                                         completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock;\n\n/**\n * Remove and cancel all the prefeching for the prefetcher.\n */\n- (void)cancelPrefetching;\n\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImagePrefetcher.h\"\n#import \"SDAsyncBlockOperation.h\"\n#import \"SDInternalMacros.h\"\n#import <stdatomic.h>\n\n@interface SDWebImagePrefetchToken () {\n    @public\n    // Though current implementation, `SDWebImageManager` completion block is always on main queue. But however, there is no guarantee in docs. And we may introduce config to specify custom queue in the future.\n    // These value are just used as incrementing counter, keep thread-safe using memory_order_relaxed for performance.\n    atomic_ulong _skippedCount;\n    atomic_ulong _finishedCount;\n    atomic_flag  _isAllFinished;\n    \n    unsigned long _totalCount;\n    \n    // Used to ensure NSPointerArray thread safe\n    SD_LOCK_DECLARE(_prefetchOperationsLock);\n    SD_LOCK_DECLARE(_loadOperationsLock);\n}\n\n@property (nonatomic, copy, readwrite) NSArray<NSURL *> *urls;\n@property (nonatomic, strong) NSPointerArray *loadOperations;\n@property (nonatomic, strong) NSPointerArray *prefetchOperations;\n@property (nonatomic, weak) SDWebImagePrefetcher *prefetcher;\n@property (nonatomic, copy, nullable) SDWebImagePrefetcherCompletionBlock completionBlock;\n@property (nonatomic, copy, nullable) SDWebImagePrefetcherProgressBlock progressBlock;\n\n@end\n\n@interface SDWebImagePrefetcher ()\n\n@property (strong, nonatomic, nonnull) SDWebImageManager *manager;\n@property (strong, atomic, nonnull) NSMutableSet<SDWebImagePrefetchToken *> *runningTokens;\n@property (strong, nonatomic, nonnull) NSOperationQueue *prefetchQueue;\n\n@end\n\n@implementation SDWebImagePrefetcher\n\n+ (nonnull instancetype)sharedImagePrefetcher {\n    static dispatch_once_t once;\n    static id instance;\n    dispatch_once(&once, ^{\n        instance = [self new];\n    });\n    return instance;\n}\n\n- (nonnull instancetype)init {\n    return [self initWithImageManager:[SDWebImageManager new]];\n}\n\n- (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager {\n    if ((self = [super init])) {\n        _manager = manager;\n        _runningTokens = [NSMutableSet set];\n        _options = SDWebImageLowPriority;\n        _delegateQueue = dispatch_get_main_queue();\n        _prefetchQueue = [NSOperationQueue new];\n        self.maxConcurrentPrefetchCount = 3;\n    }\n    return self;\n}\n\n- (void)setMaxConcurrentPrefetchCount:(NSUInteger)maxConcurrentPrefetchCount {\n    self.prefetchQueue.maxConcurrentOperationCount = maxConcurrentPrefetchCount;\n}\n\n- (NSUInteger)maxConcurrentPrefetchCount {\n    return self.prefetchQueue.maxConcurrentOperationCount;\n}\n\n#pragma mark - Prefetch\n- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray<NSURL *> *)urls {\n    return [self prefetchURLs:urls progress:nil completed:nil];\n}\n\n- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray<NSURL *> *)urls\n                                          progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock\n                                         completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock {\n    if (!urls || urls.count == 0) {\n        if (completionBlock) {\n            completionBlock(0, 0);\n        }\n        return nil;\n    }\n    SDWebImagePrefetchToken *token = [SDWebImagePrefetchToken new];\n    token.prefetcher = self;\n    token.urls = urls;\n    token->_skippedCount = 0;\n    token->_finishedCount = 0;\n    token->_totalCount = token.urls.count;\n    atomic_flag_clear(&(token->_isAllFinished));\n    token.loadOperations = [NSPointerArray weakObjectsPointerArray];\n    token.prefetchOperations = [NSPointerArray weakObjectsPointerArray];\n    token.progressBlock = progressBlock;\n    token.completionBlock = completionBlock;\n    [self addRunningToken:token];\n    [self startPrefetchWithToken:token];\n    \n    return token;\n}\n\n- (void)startPrefetchWithToken:(SDWebImagePrefetchToken * _Nonnull)token {\n    for (NSURL *url in token.urls) {\n        @autoreleasepool {\n            @weakify(self);\n            SDAsyncBlockOperation *prefetchOperation = [SDAsyncBlockOperation blockOperationWithBlock:^(SDAsyncBlockOperation * _Nonnull asyncOperation) {\n                @strongify(self);\n                if (!self || asyncOperation.isCancelled) {\n                    return;\n                }\n                id<SDWebImageOperation> operation = [self.manager loadImageWithURL:url options:self.options context:self.context progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                    @strongify(self);\n                    if (!self) {\n                        return;\n                    }\n                    if (!finished) {\n                        return;\n                    }\n                    atomic_fetch_add_explicit(&(token->_finishedCount), 1, memory_order_relaxed);\n                    if (error) {\n                        // Add last failed\n                        atomic_fetch_add_explicit(&(token->_skippedCount), 1, memory_order_relaxed);\n                    }\n                    \n                    // Current operation finished\n                    [self callProgressBlockForToken:token imageURL:imageURL];\n                    \n                    if (atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed) == token->_totalCount) {\n                        // All finished\n                        if (!atomic_flag_test_and_set_explicit(&(token->_isAllFinished), memory_order_relaxed)) {\n                            [self callCompletionBlockForToken:token];\n                            [self removeRunningToken:token];\n                        }\n                    }\n                    [asyncOperation complete];\n                }];\n                NSAssert(operation != nil, @\"Operation should not be nil, [SDWebImageManager loadImageWithURL:options:context:progress:completed:] break prefetch logic\");\n                SD_LOCK(token->_loadOperationsLock);\n                [token.loadOperations addPointer:(__bridge void *)operation];\n                SD_UNLOCK(token->_loadOperationsLock);\n            }];\n            SD_LOCK(token->_prefetchOperationsLock);\n            [token.prefetchOperations addPointer:(__bridge void *)prefetchOperation];\n            SD_UNLOCK(token->_prefetchOperationsLock);\n            [self.prefetchQueue addOperation:prefetchOperation];\n        }\n    }\n}\n\n#pragma mark - Cancel\n- (void)cancelPrefetching {\n    @synchronized(self.runningTokens) {\n        NSSet<SDWebImagePrefetchToken *> *copiedTokens = [self.runningTokens copy];\n        [copiedTokens makeObjectsPerformSelector:@selector(cancel)];\n        [self.runningTokens removeAllObjects];\n    }\n}\n\n- (void)callProgressBlockForToken:(SDWebImagePrefetchToken *)token imageURL:(NSURL *)url {\n    if (!token) {\n        return;\n    }\n    BOOL shouldCallDelegate = [self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)];\n    NSUInteger tokenFinishedCount = [self tokenFinishedCount];\n    NSUInteger tokenTotalCount = [self tokenTotalCount];\n    NSUInteger finishedCount = atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed);\n    NSUInteger totalCount = token->_totalCount;\n    dispatch_async(self.delegateQueue, ^{\n        if (shouldCallDelegate) {\n            [self.delegate imagePrefetcher:self didPrefetchURL:url finishedCount:tokenFinishedCount totalCount:tokenTotalCount];\n        }\n        if (token.progressBlock) {\n            token.progressBlock(finishedCount, totalCount);\n        }\n    });\n}\n\n- (void)callCompletionBlockForToken:(SDWebImagePrefetchToken *)token {\n    if (!token) {\n        return;\n    }\n    BOOL shoulCallDelegate = [self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)] && ([self countOfRunningTokens] == 1); // last one\n    NSUInteger tokenTotalCount = [self tokenTotalCount];\n    NSUInteger tokenSkippedCount = [self tokenSkippedCount];\n    NSUInteger finishedCount = atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed);\n    NSUInteger skippedCount = atomic_load_explicit(&(token->_skippedCount), memory_order_relaxed);\n    dispatch_async(self.delegateQueue, ^{\n        if (shoulCallDelegate) {\n            [self.delegate imagePrefetcher:self didFinishWithTotalCount:tokenTotalCount skippedCount:tokenSkippedCount];\n        }\n        if (token.completionBlock) {\n            token.completionBlock(finishedCount, skippedCount);\n        }\n    });\n}\n\n#pragma mark - Helper\n- (NSUInteger)tokenTotalCount {\n    NSUInteger tokenTotalCount = 0;\n    @synchronized (self.runningTokens) {\n        for (SDWebImagePrefetchToken *token in self.runningTokens) {\n            tokenTotalCount += token->_totalCount;\n        }\n    }\n    return tokenTotalCount;\n}\n\n- (NSUInteger)tokenSkippedCount {\n    NSUInteger tokenSkippedCount = 0;\n    @synchronized (self.runningTokens) {\n        for (SDWebImagePrefetchToken *token in self.runningTokens) {\n            tokenSkippedCount += atomic_load_explicit(&(token->_skippedCount), memory_order_relaxed);\n        }\n    }\n    return tokenSkippedCount;\n}\n\n- (NSUInteger)tokenFinishedCount {\n    NSUInteger tokenFinishedCount = 0;\n    @synchronized (self.runningTokens) {\n        for (SDWebImagePrefetchToken *token in self.runningTokens) {\n            tokenFinishedCount += atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed);\n        }\n    }\n    return tokenFinishedCount;\n}\n\n- (void)addRunningToken:(SDWebImagePrefetchToken *)token {\n    if (!token) {\n        return;\n    }\n    @synchronized (self.runningTokens) {\n        [self.runningTokens addObject:token];\n    }\n}\n\n- (void)removeRunningToken:(SDWebImagePrefetchToken *)token {\n    if (!token) {\n        return;\n    }\n    @synchronized (self.runningTokens) {\n        [self.runningTokens removeObject:token];\n    }\n}\n\n- (NSUInteger)countOfRunningTokens {\n    NSUInteger count = 0;\n    @synchronized (self.runningTokens) {\n        count = self.runningTokens.count;\n    }\n    return count;\n}\n\n@end\n\n@implementation SDWebImagePrefetchToken\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        SD_LOCK_INIT(_prefetchOperationsLock);\n        SD_LOCK_INIT(_loadOperationsLock);\n    }\n    return self;\n}\n\n- (void)cancel {\n    SD_LOCK(_prefetchOperationsLock);\n    [self.prefetchOperations compact];\n    for (id operation in self.prefetchOperations) {\n        id<SDWebImageOperation> strongOperation = operation;\n        if (strongOperation) {\n            [strongOperation cancel];\n        }\n    }\n    self.prefetchOperations.count = 0;\n    SD_UNLOCK(_prefetchOperationsLock);\n    \n    SD_LOCK(_loadOperationsLock);\n    [self.loadOperations compact];\n    for (id operation in self.loadOperations) {\n        id<SDWebImageOperation> strongOperation = operation;\n        if (strongOperation) {\n            [strongOperation cancel];\n        }\n    }\n    self.loadOperations.count = 0;\n    SD_UNLOCK(_loadOperationsLock);\n    \n    self.completionBlock = nil;\n    self.progressBlock = nil;\n    [self.prefetcher removeRunningToken:self];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_UIKIT || SD_MAC\n#import \"SDImageCache.h\"\n\n#if SD_UIKIT\ntypedef UIViewAnimationOptions SDWebImageAnimationOptions;\n#else\ntypedef NS_OPTIONS(NSUInteger, SDWebImageAnimationOptions) {\n    SDWebImageAnimationOptionAllowsImplicitAnimation   = 1 << 0, // specify `allowsImplicitAnimation` for the `NSAnimationContext`\n    \n    SDWebImageAnimationOptionCurveEaseInOut            = 0 << 16, // default\n    SDWebImageAnimationOptionCurveEaseIn               = 1 << 16,\n    SDWebImageAnimationOptionCurveEaseOut              = 2 << 16,\n    SDWebImageAnimationOptionCurveLinear               = 3 << 16,\n    \n    SDWebImageAnimationOptionTransitionNone            = 0 << 20, // default\n    SDWebImageAnimationOptionTransitionFlipFromLeft    = 1 << 20,\n    SDWebImageAnimationOptionTransitionFlipFromRight   = 2 << 20,\n    SDWebImageAnimationOptionTransitionCurlUp          = 3 << 20,\n    SDWebImageAnimationOptionTransitionCurlDown        = 4 << 20,\n    SDWebImageAnimationOptionTransitionCrossDissolve   = 5 << 20,\n    SDWebImageAnimationOptionTransitionFlipFromTop     = 6 << 20,\n    SDWebImageAnimationOptionTransitionFlipFromBottom  = 7 << 20,\n};\n#endif\n\ntypedef void (^SDWebImageTransitionPreparesBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL);\ntypedef void (^SDWebImageTransitionAnimationsBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image);\ntypedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished);\n\n/**\n This class is used to provide a transition animation after the view category load image finished. Use this on `sd_imageTransition` in UIView+WebCache.h\n for UIKit(iOS & tvOS), we use `+[UIView transitionWithView:duration:options:animations:completion]` for transition animation.\n for AppKit(macOS), we use `+[NSAnimationContext runAnimationGroup:completionHandler:]` for transition animation. You can call `+[NSAnimationContext currentContext]` to grab the context during animations block.\n @note These transition are provided for basic usage. If you need complicated animation, consider to directly use Core Animation or use `SDWebImageAvoidAutoSetImage` and implement your own after image load finished.\n */\n@interface SDWebImageTransition : NSObject\n\n/**\n By default, we set the image to the view at the beginning of the animations. You can disable this and provide custom set image process\n */\n@property (nonatomic, assign) BOOL avoidAutoSetImage;\n/**\n The duration of the transition animation, measured in seconds. Defaults to 0.5.\n */\n@property (nonatomic, assign) NSTimeInterval duration;\n/**\n The timing function used for all animations within this transition animation (macOS).\n */\n@property (nonatomic, strong, nullable) CAMediaTimingFunction *timingFunction API_UNAVAILABLE(ios, tvos, watchos) API_DEPRECATED(\"Use SDWebImageAnimationOptions instead, or grab NSAnimationContext.currentContext and modify the timingFunction\", macos(10.10, 10.10));\n/**\n A mask of options indicating how you want to perform the animations.\n */\n@property (nonatomic, assign) SDWebImageAnimationOptions animationOptions;\n/**\n A block object to be executed before the animation sequence starts.\n */\n@property (nonatomic, copy, nullable) SDWebImageTransitionPreparesBlock prepares;\n/**\n A block object that contains the changes you want to make to the specified view.\n */\n@property (nonatomic, copy, nullable) SDWebImageTransitionAnimationsBlock animations;\n/**\n A block object to be executed when the animation sequence ends.\n */\n@property (nonatomic, copy, nullable) SDWebImageTransitionCompletionBlock completion;\n\n@end\n\n/**\n Convenience way to create transition. Remember to specify the duration if needed.\n for UIKit, these transition just use the correspond `animationOptions`. By default we enable `UIViewAnimationOptionAllowUserInteraction` to allow user interaction during transition.\n for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it.\n */\n@interface SDWebImageTransition (Conveniences)\n\n/// Fade-in transition.\n@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *fadeTransition;\n/// Flip from left transition.\n@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromLeftTransition;\n/// Flip from right transition.\n@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromRightTransition;\n/// Flip from top transition.\n@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromTopTransition;\n/// Flip from bottom transition.\n@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromBottomTransition;\n/// Curl up transition.\n@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlUpTransition;\n/// Curl down transition.\n@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlDownTransition;\n\n/// Fade-in transition with duration.\n/// @param duration transition duration, use ease-in-out\n+ (nonnull instancetype)fadeTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(fade(duration:));\n\n/// Flip from left  transition with duration.\n/// @param duration transition duration, use ease-in-out\n+ (nonnull instancetype)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromLeft(duration:));\n\n/// Flip from right transition with duration.\n/// @param duration transition duration, use ease-in-out\n+ (nonnull instancetype)flipFromRightTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromRight(duration:));\n\n/// Flip from top transition with duration.\n/// @param duration transition duration, use ease-in-out\n+ (nonnull instancetype)flipFromTopTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromTop(duration:));\n\n/// Flip from bottom transition with duration.\n/// @param duration transition duration, use ease-in-out\n+ (nonnull instancetype)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromBottom(duration:));\n\n///  Curl up transition with duration.\n/// @param duration transition duration, use ease-in-out\n+ (nonnull instancetype)curlUpTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlUp(duration:));\n\n/// Curl down transition with duration.\n/// @param duration transition duration, use ease-in-out\n+ (nonnull instancetype)curlDownTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlDown(duration:));\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageTransition.h\"\n\n#if SD_UIKIT || SD_MAC\n\n#if SD_MAC\n#import \"SDWebImageTransitionInternal.h\"\n#import \"SDInternalMacros.h\"\n\nCAMediaTimingFunction * SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options) {\n    if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveLinear, options)) {\n        return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];\n    } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseIn, options)) {\n        return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];\n    } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseOut, options)) {\n        return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];\n    } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseInOut, options)) {\n        return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];\n    } else {\n        return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];\n    }\n}\n\nCATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options) {\n    if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCrossDissolve)) {\n        CATransition *trans = [CATransition animation];\n        trans.type = kCATransitionFade;\n        return trans;\n    } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromLeft)) {\n        CATransition *trans = [CATransition animation];\n        trans.type = kCATransitionPush;\n        trans.subtype = kCATransitionFromLeft;\n        return trans;\n    } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromRight)) {\n        CATransition *trans = [CATransition animation];\n        trans.type = kCATransitionPush;\n        trans.subtype = kCATransitionFromRight;\n        return trans;\n    } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromTop)) {\n        CATransition *trans = [CATransition animation];\n        trans.type = kCATransitionPush;\n        trans.subtype = kCATransitionFromTop;\n        return trans;\n    } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromBottom)) {\n        CATransition *trans = [CATransition animation];\n        trans.type = kCATransitionPush;\n        trans.subtype = kCATransitionFromBottom;\n        return trans;\n    } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCurlUp)) {\n        CATransition *trans = [CATransition animation];\n        trans.type = kCATransitionReveal;\n        trans.subtype = kCATransitionFromTop;\n        return trans;\n    } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCurlDown)) {\n        CATransition *trans = [CATransition animation];\n        trans.type = kCATransitionReveal;\n        trans.subtype = kCATransitionFromBottom;\n        return trans;\n    } else {\n        return nil;\n    }\n}\n#endif\n\n@implementation SDWebImageTransition\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        self.duration = 0.5;\n    }\n    return self;\n}\n\n@end\n\n@implementation SDWebImageTransition (Conveniences)\n\n+ (SDWebImageTransition *)fadeTransition {\n    return [self fadeTransitionWithDuration:0.5];\n}\n\n+ (SDWebImageTransition *)fadeTransitionWithDuration:(NSTimeInterval)duration {\n    SDWebImageTransition *transition = [SDWebImageTransition new];\n    transition.duration = duration;\n#if SD_UIKIT\n    transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction;\n#else\n    transition.animationOptions = SDWebImageAnimationOptionTransitionCrossDissolve;\n#endif\n    return transition;\n}\n\n+ (SDWebImageTransition *)flipFromLeftTransition {\n    return [self flipFromLeftTransitionWithDuration:0.5];\n}\n\n+ (SDWebImageTransition *)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration {\n    SDWebImageTransition *transition = [SDWebImageTransition new];\n    transition.duration = duration;\n#if SD_UIKIT\n    transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowUserInteraction;\n#else\n    transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromLeft;\n#endif\n    return transition;\n}\n\n+ (SDWebImageTransition *)flipFromRightTransition {\n    return [self flipFromRightTransitionWithDuration:0.5];\n}\n\n+ (SDWebImageTransition *)flipFromRightTransitionWithDuration:(NSTimeInterval)duration {\n    SDWebImageTransition *transition = [SDWebImageTransition new];\n    transition.duration = duration;\n#if SD_UIKIT\n    transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionAllowUserInteraction;\n#else\n    transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromRight;\n#endif\n    return transition;\n}\n\n+ (SDWebImageTransition *)flipFromTopTransition {\n    return [self flipFromTopTransitionWithDuration:0.5];\n}\n\n+ (SDWebImageTransition *)flipFromTopTransitionWithDuration:(NSTimeInterval)duration {\n    SDWebImageTransition *transition = [SDWebImageTransition new];\n    transition.duration = duration;\n#if SD_UIKIT\n    transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionAllowUserInteraction;\n#else\n    transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromTop;\n#endif\n    return transition;\n}\n\n+ (SDWebImageTransition *)flipFromBottomTransition {\n    return [self flipFromBottomTransitionWithDuration:0.5];\n}\n\n+ (SDWebImageTransition *)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration {\n    SDWebImageTransition *transition = [SDWebImageTransition new];\n    transition.duration = duration;\n#if SD_UIKIT\n    transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom | UIViewAnimationOptionAllowUserInteraction;\n#else\n    transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromBottom;\n#endif\n    return transition;\n}\n\n+ (SDWebImageTransition *)curlUpTransition {\n    return [self curlUpTransitionWithDuration:0.5];\n}\n\n+ (SDWebImageTransition *)curlUpTransitionWithDuration:(NSTimeInterval)duration {\n    SDWebImageTransition *transition = [SDWebImageTransition new];\n    transition.duration = duration;\n#if SD_UIKIT\n    transition.animationOptions = UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionAllowUserInteraction;\n#else\n    transition.animationOptions = SDWebImageAnimationOptionTransitionCurlUp;\n#endif\n    return transition;\n}\n\n+ (SDWebImageTransition *)curlDownTransition {\n    return [self curlDownTransitionWithDuration:0.5];\n}\n\n+ (SDWebImageTransition *)curlDownTransitionWithDuration:(NSTimeInterval)duration {\n    SDWebImageTransition *transition = [SDWebImageTransition new];\n    transition.duration = duration;\n#if SD_UIKIT\n    transition.animationOptions = UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionAllowUserInteraction;\n#else\n    transition.animationOptions = SDWebImageAnimationOptionTransitionCurlDown;\n#endif\n    transition.duration = duration;\n    return transition;\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_UIKIT\n\n#import \"SDWebImageManager.h\"\n\n/**\n * Integrates SDWebImage async downloading and caching of remote images with UIButton.\n */\n@interface UIButton (WebCache)\n\n#pragma mark - Image\n\n/**\n * Get the current image URL.\n */\n@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentImageURL;\n\n/**\n * Get the image URL for a control state.\n * \n * @param state Which state you want to know the URL for. The values are described in UIControlState.\n */\n- (nullable NSURL *)sd_imageURLForState:(UIControlState)state;\n\n/**\n * Set the button `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url   The url for the image.\n * @param state The state that uses the specified title. The values are described in UIControlState.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url` and a placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param state       The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @see sd_setImageWithURL:placeholderImage:options:\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param state       The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param state       The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context;\n\n/**\n * Set the button `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param state          The state that uses the specified title. The values are described in UIControlState.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `image` with an `url`, placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param state          The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder\n                 completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param state          The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param state          The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `image` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param state          The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n#pragma mark - Background Image\n\n/**\n * Get the current background image URL.\n */\n@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentBackgroundImageURL;\n\n/**\n * Get the background image URL for a control state.\n * \n * @param state Which state you want to know the URL for. The values are described in UIControlState.\n */\n- (nullable NSURL *)sd_backgroundImageURLForState:(UIControlState)state;\n\n/**\n * Set the button `backgroundImage` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url   The url for the image.\n * @param state The state that uses the specified title. The values are described in UIControlState.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `backgroundImage` with an `url` and a placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param state       The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @see sd_setImageWithURL:placeholderImage:options:\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `backgroundImage` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param state       The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder\n                             options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `backgroundImage` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param state       The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder\n                             options:(SDWebImageOptions)options\n                             context:(nullable SDWebImageContext *)context;\n\n/**\n * Set the button `backgroundImage` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param state          The state that uses the specified title. The values are described in UIControlState.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                           completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `backgroundImage` with an `url`, placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param state          The state that uses the specified title. The values are described in UIControlState.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder\n                           completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the button `backgroundImage` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder\n                             options:(SDWebImageOptions)options\n                           completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `backgroundImage` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder\n                             options:(SDWebImageOptions)options\n                            progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                           completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the button `backgroundImage` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder\n                             options:(SDWebImageOptions)options\n                             context:(nullable SDWebImageContext *)context\n                            progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                           completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n#pragma mark - Cancel\n\n/**\n * Cancel the current image download\n */\n- (void)sd_cancelImageLoadForState:(UIControlState)state;\n\n/**\n * Cancel the current backgroundImage download\n */\n- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state;\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIButton+WebCache.h\"\n\n#if SD_UIKIT\n\n#import \"objc/runtime.h\"\n#import \"UIView+WebCacheOperation.h\"\n#import \"UIView+WebCache.h\"\n#import \"SDInternalMacros.h\"\n\nstatic char imageURLStorageKey;\n\ntypedef NSMutableDictionary<NSString *, NSURL *> SDStateImageURLDictionary;\n\nstatic inline NSString * imageURLKeyForState(UIControlState state) {\n    return [NSString stringWithFormat:@\"image_%lu\", (unsigned long)state];\n}\n\nstatic inline NSString * backgroundImageURLKeyForState(UIControlState state) {\n    return [NSString stringWithFormat:@\"backgroundImage_%lu\", (unsigned long)state];\n}\n\nstatic inline NSString * imageOperationKeyForState(UIControlState state) {\n    return [NSString stringWithFormat:@\"UIButtonImageOperation%lu\", (unsigned long)state];\n}\n\nstatic inline NSString * backgroundImageOperationKeyForState(UIControlState state) {\n    return [NSString stringWithFormat:@\"UIButtonBackgroundImageOperation%lu\", (unsigned long)state];\n}\n\n@implementation UIButton (WebCache)\n\n#pragma mark - Image\n\n- (nullable NSURL *)sd_currentImageURL {\n    NSURL *url = self.sd_imageURLStorage[imageURLKeyForState(self.state)];\n\n    if (!url) {\n        url = self.sd_imageURLStorage[imageURLKeyForState(UIControlStateNormal)];\n    }\n\n    return url;\n}\n\n- (nullable NSURL *)sd_imageURLForState:(UIControlState)state {\n    return self.sd_imageURLStorage[imageURLKeyForState(state)];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state {\n    [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder {\n    [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options {\n    [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {\n    [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options context:context progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                  forState:(UIControlState)state\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock {\n    if (!url) {\n        [self.sd_imageURLStorage removeObjectForKey:imageURLKeyForState(state)];\n    } else {\n        self.sd_imageURLStorage[imageURLKeyForState(state)] = url;\n    }\n    \n    SDWebImageMutableContext *mutableContext;\n    if (context) {\n        mutableContext = [context mutableCopy];\n    } else {\n        mutableContext = [NSMutableDictionary dictionary];\n    }\n    mutableContext[SDWebImageContextSetImageOperationKey] = imageOperationKeyForState(state);\n    @weakify(self);\n    [self sd_internalSetImageWithURL:url\n                    placeholderImage:placeholder\n                             options:options\n                             context:mutableContext\n                       setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {\n                           @strongify(self);\n                           [self setImage:image forState:state];\n                       }\n                            progress:progressBlock\n                           completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                               if (completedBlock) {\n                                   completedBlock(image, error, cacheType, imageURL);\n                               }\n                           }];\n}\n\n#pragma mark - Background Image\n\n- (nullable NSURL *)sd_currentBackgroundImageURL {\n    NSURL *url = self.sd_imageURLStorage[backgroundImageURLKeyForState(self.state)];\n    \n    if (!url) {\n        url = self.sd_imageURLStorage[backgroundImageURLKeyForState(UIControlStateNormal)];\n    }\n    \n    return url;\n}\n\n- (nullable NSURL *)sd_backgroundImageURLForState:(UIControlState)state {\n    return self.sd_imageURLStorage[backgroundImageURLKeyForState(state)];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:nil];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options context:context progress:nil completed:nil];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:completedBlock];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url\n                            forState:(UIControlState)state\n                    placeholderImage:(nullable UIImage *)placeholder\n                             options:(SDWebImageOptions)options\n                             context:(nullable SDWebImageContext *)context\n                            progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                           completed:(nullable SDExternalCompletionBlock)completedBlock {\n    if (!url) {\n        [self.sd_imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)];\n    } else {\n        self.sd_imageURLStorage[backgroundImageURLKeyForState(state)] = url;\n    }\n    \n    SDWebImageMutableContext *mutableContext;\n    if (context) {\n        mutableContext = [context mutableCopy];\n    } else {\n        mutableContext = [NSMutableDictionary dictionary];\n    }\n    mutableContext[SDWebImageContextSetImageOperationKey] = backgroundImageOperationKeyForState(state);\n    @weakify(self);\n    [self sd_internalSetImageWithURL:url\n                    placeholderImage:placeholder\n                             options:options\n                             context:mutableContext\n                       setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {\n                           @strongify(self);\n                           [self setBackgroundImage:image forState:state];\n                       }\n                            progress:progressBlock\n                           completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                               if (completedBlock) {\n                                   completedBlock(image, error, cacheType, imageURL);\n                               }\n                           }];\n}\n\n#pragma mark - Cancel\n\n- (void)sd_cancelImageLoadForState:(UIControlState)state {\n    [self sd_cancelImageLoadOperationWithKey:imageOperationKeyForState(state)];\n}\n\n- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state {\n    [self sd_cancelImageLoadOperationWithKey:backgroundImageOperationKeyForState(state)];\n}\n\n#pragma mark - Private\n\n- (SDStateImageURLDictionary *)sd_imageURLStorage {\n    SDStateImageURLDictionary *storage = objc_getAssociatedObject(self, &imageURLStorageKey);\n    if (!storage) {\n        storage = [NSMutableDictionary dictionary];\n        objc_setAssociatedObject(self, &imageURLStorageKey, storage, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n\n    return storage;\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n* (c) Fabrice Aneche\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n@interface UIImage (ExtendedCacheData)\n\n/**\n Read and Write the extended object and bind it to the image. Which can hold some extra metadata like Image's scale factor, URL rich link, date, etc.\n The extended object should conforms to NSCoding, which we use `NSKeyedArchiver` and `NSKeyedUnarchiver` to archive it to data, and write to disk cache.\n @note The disk cache preserve both of the data and extended data with the same cache key. For manual query, use the `SDDiskCache` protocol method `extendedDataForKey:` instead.\n @note You can specify arbitrary object conforms to NSCoding (NSObject protocol here is used to support object using `NS_ROOT_CLASS`, which is not NSObject subclass). If you load image from disk cache, you should check the extended object class to avoid corrupted data.\n @warning This object don't need to implements NSSecureCoding (but it's recommended),  because we allows arbitrary class.\n */\n@property (nonatomic, strong, nullable) id<NSObject, NSCoding> sd_extendedObject;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n* (c) Fabrice Aneche\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"UIImage+ExtendedCacheData.h\"\n#import <objc/runtime.h>\n\n@implementation UIImage (ExtendedCacheData)\n\n- (id<NSObject, NSCoding>)sd_extendedObject {\n    return objc_getAssociatedObject(self, @selector(sd_extendedObject));\n}\n\n- (void)setSd_extendedObject:(id<NSObject, NSCoding>)sd_extendedObject {\n    objc_setAssociatedObject(self, @selector(sd_extendedObject), sd_extendedObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n/**\n UIImage category about force decode feature (avoid Image/IO's lazy decoding during rendering behavior).\n */\n@interface UIImage (ForceDecode)\n\n/**\n A bool value indicating whether the image has already been decoded. This can help to avoid extra force decode.\n */\n@property (nonatomic, assign) BOOL sd_isDecoded;\n\n/**\n Decode the provided image. This is useful if you want to force decode the image before rendering to improve performance.\n\n @param image The image to be decoded\n @return The decoded image\n */\n+ (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image;\n\n/**\n Decode and scale down the provided image\n\n @param image The image to be decoded\n @return The decoded and scaled down image\n */\n+ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image;\n\n/**\n Decode and scale down the provided image with limit bytes\n \n @param image The image to be decoded\n @param bytes The limit bytes size. Provide 0 to use the build-in limit.\n @return The decoded and scaled down image\n */\n+ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImage+ForceDecode.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"objc/runtime.h\"\n\n@implementation UIImage (ForceDecode)\n\n- (BOOL)sd_isDecoded {\n    NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isDecoded));\n    return value.boolValue;\n}\n\n- (void)setSd_isDecoded:(BOOL)sd_isDecoded {\n    objc_setAssociatedObject(self, @selector(sd_isDecoded), @(sd_isDecoded), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n+ (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image {\n    if (!image) {\n        return nil;\n    }\n    return [SDImageCoderHelper decodedImageWithImage:image];\n}\n\n+ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image {\n    return [self sd_decodedAndScaledDownImageWithImage:image limitBytes:0];\n}\n\n+ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes {\n    if (!image) {\n        return nil;\n    }\n    return [SDImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:bytes];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Laurin Brandner\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n/**\n This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directly use `SDImageCoder`.\n */\n@interface UIImage (GIF)\n\n/**\n Creates an animated UIImage from an NSData.\n This will create animated image if the data is Animated GIF. And will create a static image is the data is Static GIF.\n\n @param data The GIF data\n @return The created image\n */\n+ (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Laurin Brandner\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImage+GIF.h\"\n#import \"SDImageGIFCoder.h\"\n\n@implementation UIImage (GIF)\n\n+ (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data {\n    if (!data) {\n        return nil;\n    }\n    return [[SDImageGIFCoder sharedCoder] decodedImageWithData:data options:0];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n/**\n UIImage category for memory cache cost.\n */\n@interface UIImage (MemoryCacheCost)\n\n/**\n The memory cache cost for specify image used by image cache. The cost function is the bytes size held in memory.\n If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost.\n \n For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Return full frame bytes size when `image.images` is not nil for animated image.\n For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory.\n @note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods.\n @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total bytes.\n */\n@property (assign, nonatomic) NSUInteger sd_memoryCost;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImage+MemoryCacheCost.h\"\n#import \"objc/runtime.h\"\n#import \"NSImage+Compatibility.h\"\n\nFOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) {\n    CGImageRef imageRef = image.CGImage;\n    if (!imageRef) {\n        return 0;\n    }\n    NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef);\n    NSUInteger frameCount;\n#if SD_MAC\n    frameCount = 1;\n#elif SD_UIKIT || SD_WATCH\n    // Filter the same frame in `_UIAnimatedImage`.\n    frameCount = image.images.count > 1 ? [NSSet setWithArray:image.images].count : 1;\n#endif\n    NSUInteger cost = bytesPerFrame * frameCount;\n    return cost;\n}\n\n@implementation UIImage (MemoryCacheCost)\n\n- (NSUInteger)sd_memoryCost {\n    NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost));\n    NSUInteger memoryCost;\n    if (value != nil) {\n        memoryCost = [value unsignedIntegerValue];\n    } else {\n        memoryCost = SDMemoryCacheCostForImage(self);\n    }\n    return memoryCost;\n}\n\n- (void)setSd_memoryCost:(NSUInteger)sd_memoryCost {\n    objc_setAssociatedObject(self, @selector(sd_memoryCost), @(sd_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"NSData+ImageContentType.h\"\n\n/**\n UIImage category for image metadata, including animation, loop count, format, incremental, etc.\n */\n@interface UIImage (Metadata)\n\n/**\n * UIKit:\n * For static image format, this value is always 0.\n * For animated image format, 0 means infinite looping.\n * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.\n * AppKit:\n * NSImage currently only support animated via `NSBitmapImageRep`(GIF) or `SDAnimatedImageRep`(APNG/GIF/WebP) unlike UIImage.\n * The getter of this property will get the loop count from animated imageRep\n * The setter of this property will set the loop count from animated imageRep\n */\n@property (nonatomic, assign) NSUInteger sd_imageLoopCount;\n\n/**\n * UIKit:\n * Returns the `images`'s count by unapply the patch for the different frame durations. Which matches the real visible frame count when displaying on UIImageView.\n * See more in `SDImageCoderHelper.animatedImageWithFrames`.\n * Returns 1 for static image.\n * AppKit:\n * Returns the underlaying `NSBitmapImageRep` or `SDAnimatedImageRep` frame count.\n * Returns 1 for static image.\n */\n@property (nonatomic, assign, readonly) NSUInteger sd_imageFrameCount;\n\n/**\n * UIKit:\n * Check the `images` array property.\n * AppKit:\n * NSImage currently only support animated via GIF imageRep unlike UIImage. It will check the imageRep's frame count.\n */\n@property (nonatomic, assign, readonly) BOOL sd_isAnimated;\n\n/**\n * UIKit:\n * Check the `isSymbolImage` property. Also check the system PDF(iOS 11+) && SVG(iOS 13+) support.\n * AppKit:\n * NSImage supports PDF && SVG && EPS imageRep, check the imageRep class.\n */\n@property (nonatomic, assign, readonly) BOOL sd_isVector;\n\n/**\n * The image format represent the original compressed image data format.\n * If you don't manually specify a format, this information is retrieve from CGImage using `CGImageGetUTType`, which may return nil for non-CG based image. At this time it will return `SDImageFormatUndefined` as default value.\n * @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.\n */\n@property (nonatomic, assign) SDImageFormat sd_imageFormat;\n\n/**\n A bool value indicating whether the image is during incremental decoding and may not contains full pixels.\n */\n@property (nonatomic, assign) BOOL sd_isIncremental;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImage+Metadata.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDInternalMacros.h\"\n#import \"objc/runtime.h\"\n\n@implementation UIImage (Metadata)\n\n#if SD_UIKIT || SD_WATCH\n\n- (NSUInteger)sd_imageLoopCount {\n    NSUInteger imageLoopCount = 0;\n    NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount));\n    if ([value isKindOfClass:[NSNumber class]]) {\n        imageLoopCount = value.unsignedIntegerValue;\n    }\n    return imageLoopCount;\n}\n\n- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {\n    NSNumber *value = @(sd_imageLoopCount);\n    objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (NSUInteger)sd_imageFrameCount {\n    NSArray<UIImage *> *animatedImages = self.images;\n    if (!animatedImages || animatedImages.count <= 1) {\n        return 1;\n    }\n    NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageFrameCount));\n    if ([value isKindOfClass:[NSNumber class]]) {\n        return [value unsignedIntegerValue];\n    }\n    __block NSUInteger frameCount = 1;\n    __block UIImage *previousImage = animatedImages.firstObject;\n    [animatedImages enumerateObjectsUsingBlock:^(UIImage * _Nonnull image, NSUInteger idx, BOOL * _Nonnull stop) {\n        // ignore first\n        if (idx == 0) {\n            return;\n        }\n        if (![image isEqual:previousImage]) {\n            frameCount++;\n        }\n        previousImage = image;\n    }];\n    objc_setAssociatedObject(self, @selector(sd_imageFrameCount), @(frameCount), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    \n    return frameCount;\n}\n\n- (BOOL)sd_isAnimated {\n    return (self.images != nil);\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Warc-performSelector-leaks\"\n- (BOOL)sd_isVector {\n    if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) {\n        // Xcode 11 supports symbol image, keep Xcode 10 compatible currently\n        SEL SymbolSelector = NSSelectorFromString(@\"isSymbolImage\");\n        if ([self respondsToSelector:SymbolSelector] && [self performSelector:SymbolSelector]) {\n            return YES;\n        }\n        // SVG\n        SEL SVGSelector = SD_SEL_SPI(CGSVGDocument);\n        if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector]) {\n            return YES;\n        }\n    }\n    if (@available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {\n        // PDF\n        SEL PDFSelector = SD_SEL_SPI(CGPDFPage);\n        if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector]) {\n            return YES;\n        }\n    }\n    return NO;\n}\n#pragma clang diagnostic pop\n\n#else\n\n- (NSUInteger)sd_imageLoopCount {\n    NSUInteger imageLoopCount = 0;\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];\n    NSBitmapImageRep *bitmapImageRep;\n    if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) {\n        bitmapImageRep = (NSBitmapImageRep *)imageRep;\n    }\n    if (bitmapImageRep) {\n        imageLoopCount = [[bitmapImageRep valueForProperty:NSImageLoopCount] unsignedIntegerValue];\n    }\n    return imageLoopCount;\n}\n\n- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];\n    NSBitmapImageRep *bitmapImageRep;\n    if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) {\n        bitmapImageRep = (NSBitmapImageRep *)imageRep;\n    }\n    if (bitmapImageRep) {\n        [bitmapImageRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)];\n    }\n}\n\n- (NSUInteger)sd_imageFrameCount {\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];\n    NSBitmapImageRep *bitmapImageRep;\n    if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) {\n        bitmapImageRep = (NSBitmapImageRep *)imageRep;\n    }\n    if (bitmapImageRep) {\n        return [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];\n    }\n    return 1;\n}\n\n- (BOOL)sd_isAnimated {\n    BOOL isAnimated = NO;\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];\n    NSBitmapImageRep *bitmapImageRep;\n    if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) {\n        bitmapImageRep = (NSBitmapImageRep *)imageRep;\n    }\n    if (bitmapImageRep) {\n        NSUInteger frameCount = [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];\n        isAnimated = frameCount > 1 ? YES : NO;\n    }\n    return isAnimated;\n}\n\n- (BOOL)sd_isVector {\n    NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height);\n    NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil];\n    if ([imageRep isKindOfClass:[NSPDFImageRep class]]) {\n        return YES;\n    }\n    if ([imageRep isKindOfClass:[NSEPSImageRep class]]) {\n        return YES;\n    }\n    if ([NSStringFromClass(imageRep.class) hasSuffix:@\"NSSVGImageRep\"]) {\n        return YES;\n    }\n    return NO;\n}\n\n#endif\n\n- (SDImageFormat)sd_imageFormat {\n    SDImageFormat imageFormat = SDImageFormatUndefined;\n    NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageFormat));\n    if ([value isKindOfClass:[NSNumber class]]) {\n        imageFormat = value.integerValue;\n        return imageFormat;\n    }\n    // Check CGImage's UTType, may return nil for non-Image/IO based image\n    if (@available(iOS 9.0, tvOS 9.0, macOS 10.11, watchOS 2.0, *)) {\n        CFStringRef uttype = CGImageGetUTType(self.CGImage);\n        imageFormat = [NSData sd_imageFormatFromUTType:uttype];\n    }\n    return imageFormat;\n}\n\n- (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat {\n    objc_setAssociatedObject(self, @selector(sd_imageFormat), @(sd_imageFormat), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (void)setSd_isIncremental:(BOOL)sd_isIncremental {\n    objc_setAssociatedObject(self, @selector(sd_isIncremental), @(sd_isIncremental), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (BOOL)sd_isIncremental {\n    NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isIncremental));\n    return value.boolValue;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"NSData+ImageContentType.h\"\n\n/**\n UIImage category for convenient image format decoding/encoding.\n */\n@interface UIImage (MultiFormat)\n#pragma mark - Decode\n/**\n Create and decode a image with the specify image data\n\n @param data The image data\n @return The created image\n */\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data;\n\n/**\n Create and decode a image with the specify image data and scale\n \n @param data The image data\n @param scale The image scale factor. Should be greater than or equal to 1.0.\n @return The created image\n */\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale;\n\n/**\n Create and decode a image with the specify image data and scale, allow specify animate/static control\n \n @param data The image data\n @param scale The image scale factor. Should be greater than or equal to 1.0.\n @param firstFrameOnly Even if the image data is animated image format, decode the first frame only as static image.\n @return The created image\n */\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly;\n\n#pragma mark - Encode\n/**\n Encode the current image to the data, the image format is unspecified\n\n @note If the receiver is `SDAnimatedImage`, this will return the animated image data if available. No more extra encoding process.\n @return The encoded data. If can't encode, return nil\n */\n- (nullable NSData *)sd_imageData;\n\n/**\n Encode the current image to data with the specify image format\n\n @param imageFormat The specify image format\n @return The encoded data. If can't encode, return nil\n */\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat NS_SWIFT_NAME(sd_imageData(as:));\n\n/**\n Encode the current image to data with the specify image format and compression quality\n\n @param imageFormat The specify image format\n @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality.\n @return The encoded data. If can't encode, return nil\n */\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality NS_SWIFT_NAME(sd_imageData(as:compressionQuality:));\n\n/**\n Encode the current image to data with the specify image format and compression quality, allow specify animate/static control\n \n @param imageFormat The specify image format\n @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality.\n @param firstFrameOnly Even if the image is animated image, encode the first frame only as static image.\n @return The encoded data. If can't encode, return nil\n */\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly NS_SWIFT_NAME(sd_imageData(as:compressionQuality:firstFrameOnly:));\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImage+MultiFormat.h\"\n#import \"SDImageCodersManager.h\"\n\n@implementation UIImage (MultiFormat)\n\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data {\n    return [self sd_imageWithData:data scale:1];\n}\n\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale {\n    return [self sd_imageWithData:data scale:scale firstFrameOnly:NO];\n}\n\n+ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly {\n    if (!data) {\n        return nil;\n    }\n    SDImageCoderOptions *options = @{SDImageCoderDecodeScaleFactor : @(MAX(scale, 1)), SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)};\n    return [[SDImageCodersManager sharedManager] decodedImageWithData:data options:options];\n}\n\n- (nullable NSData *)sd_imageData {\n    return [self sd_imageDataAsFormat:SDImageFormatUndefined];\n}\n\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat {\n    return [self sd_imageDataAsFormat:imageFormat compressionQuality:1];\n}\n\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality {\n    return [self sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO];\n}\n\n- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly {\n    SDImageCoderOptions *options = @{SDImageCoderEncodeCompressionQuality : @(compressionQuality), SDImageCoderEncodeFirstFrameOnly : @(firstFrameOnly)};\n    return [[SDImageCodersManager sharedManager] encodedDataWithImage:self format:imageFormat options:options];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\ntypedef NS_ENUM(NSUInteger, SDImageScaleMode) {\n    SDImageScaleModeFill = 0,\n    SDImageScaleModeAspectFit = 1,\n    SDImageScaleModeAspectFill = 2\n};\n\n#if SD_UIKIT || SD_WATCH\ntypedef UIRectCorner SDRectCorner;\n#else\ntypedef NS_OPTIONS(NSUInteger, SDRectCorner) {\n    SDRectCornerTopLeft     = 1 << 0,\n    SDRectCornerTopRight    = 1 << 1,\n    SDRectCornerBottomLeft  = 1 << 2,\n    SDRectCornerBottomRight = 1 << 3,\n    SDRectCornerAllCorners  = ~0UL\n};\n#endif\n\n/**\n Provide some common method for `UIImage`.\n Image process is based on Core Graphics and vImage.\n */\n@interface UIImage (Transform)\n\n#pragma mark - Image Geometry\n\n/**\n Returns a new image which is resized from this image.\n You can specify a larger or smaller size than the image size. The image content will be changed with the scale mode.\n \n @param size        The new size to be resized, values should be positive.\n @param scaleMode   The scale mode for image content.\n @return The new image with the given size.\n */\n- (nullable UIImage *)sd_resizedImageWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode;\n\n/**\n Returns a new image which is cropped from this image.\n \n @param rect     Image's inner rect.\n @return         The new image with the cropping rect.\n */\n- (nullable UIImage *)sd_croppedImageWithRect:(CGRect)rect;\n\n/**\n Rounds a new image with a given corner radius and corners.\n \n @param cornerRadius The radius of each corner oval. Values larger than half the\n rectangle's width or height are clamped appropriately to\n half the width or height.\n @param corners      A bitmask value that identifies the corners that you want\n rounded. You can use this parameter to round only a subset\n of the corners of the rectangle.\n @param borderWidth  The inset border line width. Values larger than half the rectangle's\n width or height are clamped appropriately to half the width\n or height.\n @param borderColor  The border stroke color. nil means clear color.\n @return The new image with the round corner.\n */\n- (nullable UIImage *)sd_roundedCornerImageWithRadius:(CGFloat)cornerRadius\n                                              corners:(SDRectCorner)corners\n                                          borderWidth:(CGFloat)borderWidth\n                                          borderColor:(nullable UIColor *)borderColor;\n\n/**\n Returns a new rotated image (relative to the center).\n \n @param angle     Rotated radians in counterclockwise.⟲\n @param fitSize   YES: new image's size is extend to fit all content.\n                  NO: image's size will not change, content may be clipped.\n @return The new image with the rotation.\n */\n- (nullable UIImage *)sd_rotatedImageWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize;\n\n/**\n Returns a new horizontally(vertically) flipped image.\n \n @param horizontal YES to flip the image horizontally. ⇋\n @param vertical YES to flip the image vertically. ⥯\n @return The new image with the flipping.\n */\n- (nullable UIImage *)sd_flippedImageWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical;\n\n#pragma mark - Image Blending\n\n/**\n Return a tinted image with the given color. This actually use alpha blending of current image and the tint color.\n \n @param tintColor  The tint color.\n @return The new image with the tint color.\n */\n- (nullable UIImage *)sd_tintedImageWithColor:(nonnull UIColor *)tintColor;\n\n/**\n Return the pixel color at specify position. The point is from the top-left to the bottom-right and 0-based. The returned the color is always be RGBA format. The image must be CG-based.\n @note The point's x/y should not be smaller than 0, or greater than or equal to width/height.\n @note The overhead of object creation means this method is best suited for infrequent color sampling. For heavy image processing, grab the raw bitmap data and process yourself.\n\n @param point The position of pixel\n @return The color for specify pixel, or nil if any error occur\n */\n- (nullable UIColor *)sd_colorAtPoint:(CGPoint)point;\n\n/**\n Return the pixel color array with specify rectangle. The rect is from the top-left to the bottom-right and 0-based. The returned the color is always be RGBA format. The image must be CG-based.\n @note The rect's width/height should not be smaller than or equal to 0. The minX/minY should not be smaller than 0. The maxX/maxY should not be greater than width/height. Attention this limit is different from `sd_colorAtPoint:` (point: (0, 0) like rect: (0, 0, 1, 1))\n @note The overhead of object creation means this method is best suited for infrequent color sampling. For heavy image processing, grab the raw bitmap data and process yourself.\n\n @param rect The rectangle of pixels\n @return The color array for specify pixels, or nil if any error occur\n */\n- (nullable NSArray<UIColor *> *)sd_colorsWithRect:(CGRect)rect;\n\n#pragma mark - Image Effect\n\n/**\n Return a new image applied a blur effect.\n \n @param blurRadius     The radius of the blur in points, 0 means no blur effect.\n \n @return               The new image with blur effect, or nil if an error occurs (e.g. no enough memory).\n */\n- (nullable UIImage *)sd_blurredImageWithRadius:(CGFloat)blurRadius;\n\n#if SD_UIKIT || SD_MAC\n/**\n Return a new image applied a CIFilter.\n\n @param filter The CIFilter to be applied to the image.\n @return The new image with the CIFilter, or nil if an error occurs (e.g. no\n enough memory).\n */\n- (nullable UIImage *)sd_filteredImageWithFilter:(nonnull CIFilter *)filter;\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImage+Transform.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDImageGraphics.h\"\n#import \"SDGraphicsImageRenderer.h\"\n#import \"NSBezierPath+SDRoundedCorners.h\"\n#import <Accelerate/Accelerate.h>\n#if SD_UIKIT || SD_MAC\n#import <CoreImage/CoreImage.h>\n#endif\n\nstatic inline CGRect SDCGRectFitWithScaleMode(CGRect rect, CGSize size, SDImageScaleMode scaleMode) {\n    rect = CGRectStandardize(rect);\n    size.width = size.width < 0 ? -size.width : size.width;\n    size.height = size.height < 0 ? -size.height : size.height;\n    CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));\n    switch (scaleMode) {\n        case SDImageScaleModeAspectFit:\n        case SDImageScaleModeAspectFill: {\n            if (rect.size.width < 0.01 || rect.size.height < 0.01 ||\n                size.width < 0.01 || size.height < 0.01) {\n                rect.origin = center;\n                rect.size = CGSizeZero;\n            } else {\n                CGFloat scale;\n                if (scaleMode == SDImageScaleModeAspectFit) {\n                    if (size.width / size.height < rect.size.width / rect.size.height) {\n                        scale = rect.size.height / size.height;\n                    } else {\n                        scale = rect.size.width / size.width;\n                    }\n                } else {\n                    if (size.width / size.height < rect.size.width / rect.size.height) {\n                        scale = rect.size.width / size.width;\n                    } else {\n                        scale = rect.size.height / size.height;\n                    }\n                }\n                size.width *= scale;\n                size.height *= scale;\n                rect.size = size;\n                rect.origin = CGPointMake(center.x - size.width * 0.5, center.y - size.height * 0.5);\n            }\n        } break;\n        case SDImageScaleModeFill:\n        default: {\n            rect = rect;\n        }\n    }\n    return rect;\n}\n\nstatic inline UIColor * SDGetColorFromPixel(Pixel_8888 pixel, CGBitmapInfo bitmapInfo) {\n    // Get alpha info, byteOrder info\n    CGImageAlphaInfo alphaInfo = bitmapInfo & kCGBitmapAlphaInfoMask;\n    CGBitmapInfo byteOrderInfo = bitmapInfo & kCGBitmapByteOrderMask;\n    CGFloat r = 0, g = 0, b = 0, a = 1;\n    \n    BOOL byteOrderNormal = NO;\n    switch (byteOrderInfo) {\n        case kCGBitmapByteOrderDefault: {\n            byteOrderNormal = YES;\n        } break;\n        case kCGBitmapByteOrder32Little: {\n        } break;\n        case kCGBitmapByteOrder32Big: {\n            byteOrderNormal = YES;\n        } break;\n        default: break;\n    }\n    switch (alphaInfo) {\n        case kCGImageAlphaPremultipliedFirst:\n        case kCGImageAlphaFirst: {\n            if (byteOrderNormal) {\n                // ARGB8888\n                a = pixel[0] / 255.0;\n                r = pixel[1] / 255.0;\n                g = pixel[2] / 255.0;\n                b = pixel[3] / 255.0;\n            } else {\n                // BGRA8888\n                b = pixel[0] / 255.0;\n                g = pixel[1] / 255.0;\n                r = pixel[2] / 255.0;\n                a = pixel[3] / 255.0;\n            }\n        }\n            break;\n        case kCGImageAlphaPremultipliedLast:\n        case kCGImageAlphaLast: {\n            if (byteOrderNormal) {\n                // RGBA8888\n                r = pixel[0] / 255.0;\n                g = pixel[1] / 255.0;\n                b = pixel[2] / 255.0;\n                a = pixel[3] / 255.0;\n            } else {\n                // ABGR8888\n                a = pixel[0] / 255.0;\n                b = pixel[1] / 255.0;\n                g = pixel[2] / 255.0;\n                r = pixel[3] / 255.0;\n            }\n        }\n            break;\n        case kCGImageAlphaNone: {\n            if (byteOrderNormal) {\n                // RGB\n                r = pixel[0] / 255.0;\n                g = pixel[1] / 255.0;\n                b = pixel[2] / 255.0;\n            } else {\n                // BGR\n                b = pixel[0] / 255.0;\n                g = pixel[1] / 255.0;\n                r = pixel[2] / 255.0;\n            }\n        }\n            break;\n        case kCGImageAlphaNoneSkipLast: {\n            if (byteOrderNormal) {\n                // RGBX\n                r = pixel[0] / 255.0;\n                g = pixel[1] / 255.0;\n                b = pixel[2] / 255.0;\n            } else {\n                // XBGR\n                b = pixel[1] / 255.0;\n                g = pixel[2] / 255.0;\n                r = pixel[3] / 255.0;\n            }\n        }\n            break;\n        case kCGImageAlphaNoneSkipFirst: {\n            if (byteOrderNormal) {\n                // XRGB\n                r = pixel[1] / 255.0;\n                g = pixel[2] / 255.0;\n                b = pixel[3] / 255.0;\n            } else {\n                // BGRX\n                b = pixel[0] / 255.0;\n                g = pixel[1] / 255.0;\n                r = pixel[2] / 255.0;\n            }\n        }\n            break;\n        case kCGImageAlphaOnly: {\n            // A\n            a = pixel[0] / 255.0;\n        }\n            break;\n        default:\n            break;\n    }\n    \n    return [UIColor colorWithRed:r green:g blue:b alpha:a];\n}\n\n#if SD_UIKIT || SD_MAC\n// Create-Rule, caller should call CGImageRelease\nstatic inline CGImageRef _Nullable SDCreateCGImageFromCIImage(CIImage * _Nonnull ciImage) {\n    CGImageRef imageRef = NULL;\n    if (@available(iOS 10, macOS 10.12, tvOS 10, *)) {\n        imageRef = ciImage.CGImage;\n    }\n    if (!imageRef) {\n        CIContext *context = [CIContext context];\n        imageRef = [context createCGImage:ciImage fromRect:ciImage.extent];\n    } else {\n        CGImageRetain(imageRef);\n    }\n    return imageRef;\n}\n#endif\n\n@implementation UIImage (Transform)\n\n- (void)sd_drawInRect:(CGRect)rect context:(CGContextRef)context scaleMode:(SDImageScaleMode)scaleMode clipsToBounds:(BOOL)clips {\n    CGRect drawRect = SDCGRectFitWithScaleMode(rect, self.size, scaleMode);\n    if (drawRect.size.width == 0 || drawRect.size.height == 0) return;\n    if (clips) {\n        if (context) {\n            CGContextSaveGState(context);\n            CGContextAddRect(context, rect);\n            CGContextClip(context);\n            [self drawInRect:drawRect];\n            CGContextRestoreGState(context);\n        }\n    } else {\n        [self drawInRect:drawRect];\n    }\n}\n\n- (nullable UIImage *)sd_resizedImageWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode {\n    if (size.width <= 0 || size.height <= 0) return nil;\n    SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init];\n    format.scale = self.scale;\n    SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format];\n    UIImage *image = [renderer imageWithActions:^(CGContextRef  _Nonnull context) {\n        [self sd_drawInRect:CGRectMake(0, 0, size.width, size.height) context:context scaleMode:scaleMode clipsToBounds:NO];\n    }];\n    return image;\n}\n\n- (nullable UIImage *)sd_croppedImageWithRect:(CGRect)rect {\n    rect.origin.x *= self.scale;\n    rect.origin.y *= self.scale;\n    rect.size.width *= self.scale;\n    rect.size.height *= self.scale;\n    if (rect.size.width <= 0 || rect.size.height <= 0) return nil;\n    \n#if SD_UIKIT || SD_MAC\n    // CIImage shortcut\n    if (self.CIImage) {\n        CGRect croppingRect = CGRectMake(rect.origin.x, self.size.height - CGRectGetMaxY(rect), rect.size.width, rect.size.height);\n        CIImage *ciImage = [self.CIImage imageByCroppingToRect:croppingRect];\n#if SD_UIKIT\n        UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation];\n#else\n        UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n        return image;\n    }\n#endif\n    \n    CGImageRef imageRef = self.CGImage;\n    if (!imageRef) {\n        return nil;\n    }\n    \n    CGImageRef croppedImageRef = CGImageCreateWithImageInRect(imageRef, rect);\n    if (!croppedImageRef) {\n        return nil;\n    }\n#if SD_UIKIT || SD_WATCH\n    UIImage *image = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:self.imageOrientation];\n#else\n    UIImage *image = [[UIImage alloc] initWithCGImage:croppedImageRef scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n    CGImageRelease(croppedImageRef);\n    return image;\n}\n\n- (nullable UIImage *)sd_roundedCornerImageWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(nullable UIColor *)borderColor {\n    SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init];\n    format.scale = self.scale;\n    SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:self.size format:format];\n    UIImage *image = [renderer imageWithActions:^(CGContextRef  _Nonnull context) {\n        CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height);\n        \n        CGFloat minSize = MIN(self.size.width, self.size.height);\n        if (borderWidth < minSize / 2) {\n#if SD_UIKIT || SD_WATCH\n            UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];\n#else\n            NSBezierPath *path = [NSBezierPath sd_bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadius:cornerRadius];\n#endif\n            [path closePath];\n            \n            CGContextSaveGState(context);\n            [path addClip];\n            [self drawInRect:rect];\n            CGContextRestoreGState(context);\n        }\n        \n        if (borderColor && borderWidth < minSize / 2 && borderWidth > 0) {\n            CGFloat strokeInset = (floor(borderWidth * self.scale) + 0.5) / self.scale;\n            CGRect strokeRect = CGRectInset(rect, strokeInset, strokeInset);\n            CGFloat strokeRadius = cornerRadius > self.scale / 2 ? cornerRadius - self.scale / 2 : 0;\n#if SD_UIKIT || SD_WATCH\n            UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:strokeRect byRoundingCorners:corners cornerRadii:CGSizeMake(strokeRadius, strokeRadius)];\n#else\n            NSBezierPath *path = [NSBezierPath sd_bezierPathWithRoundedRect:strokeRect byRoundingCorners:corners cornerRadius:strokeRadius];\n#endif\n            [path closePath];\n            \n            path.lineWidth = borderWidth;\n            [borderColor setStroke];\n            [path stroke];\n        }\n    }];\n    return image;\n}\n\n- (nullable UIImage *)sd_rotatedImageWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize {\n    size_t width = self.size.width;\n    size_t height = self.size.height;\n    CGRect newRect = CGRectApplyAffineTransform(CGRectMake(0, 0, width, height),\n                                                fitSize ? CGAffineTransformMakeRotation(angle) : CGAffineTransformIdentity);\n\n#if SD_UIKIT || SD_MAC\n    // CIImage shortcut\n    if (self.CIImage) {\n        CIImage *ciImage = self.CIImage;\n        if (fitSize) {\n            CGAffineTransform transform = CGAffineTransformMakeRotation(angle);\n            ciImage = [ciImage imageByApplyingTransform:transform];\n        } else {\n            CIFilter *filter = [CIFilter filterWithName:@\"CIStraightenFilter\"];\n            [filter setValue:ciImage forKey:kCIInputImageKey];\n            [filter setValue:@(angle) forKey:kCIInputAngleKey];\n            ciImage = filter.outputImage;\n        }\n#if SD_UIKIT || SD_WATCH\n        UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation];\n#else\n        UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n        return image;\n    }\n#endif\n    \n    SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init];\n    format.scale = self.scale;\n    SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:newRect.size format:format];\n    UIImage *image = [renderer imageWithActions:^(CGContextRef  _Nonnull context) {\n        CGContextSetShouldAntialias(context, true);\n        CGContextSetAllowsAntialiasing(context, true);\n        CGContextSetInterpolationQuality(context, kCGInterpolationHigh);\n        CGContextTranslateCTM(context, +(newRect.size.width * 0.5), +(newRect.size.height * 0.5));\n#if SD_UIKIT || SD_WATCH\n        // Use UIKit coordinate system counterclockwise (⟲)\n        CGContextRotateCTM(context, -angle);\n#else\n        CGContextRotateCTM(context, angle);\n#endif\n        \n        [self drawInRect:CGRectMake(-(width * 0.5), -(height * 0.5), width, height)];\n    }];\n    return image;\n}\n\n- (nullable UIImage *)sd_flippedImageWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical {\n    size_t width = self.size.width;\n    size_t height = self.size.height;\n\n#if SD_UIKIT || SD_MAC\n    // CIImage shortcut\n    if (self.CIImage) {\n        CGAffineTransform transform = CGAffineTransformIdentity;\n        // Use UIKit coordinate system\n        if (horizontal) {\n            CGAffineTransform flipHorizontal = CGAffineTransformMake(-1, 0, 0, 1, width, 0);\n            transform = CGAffineTransformConcat(transform, flipHorizontal);\n        }\n        if (vertical) {\n            CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, height);\n            transform = CGAffineTransformConcat(transform, flipVertical);\n        }\n        CIImage *ciImage = [self.CIImage imageByApplyingTransform:transform];\n#if SD_UIKIT\n        UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation];\n#else\n        UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n        return image;\n    }\n#endif\n    \n    SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init];\n    format.scale = self.scale;\n    SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:self.size format:format];\n    UIImage *image = [renderer imageWithActions:^(CGContextRef  _Nonnull context) {\n        // Use UIKit coordinate system\n        if (horizontal) {\n            CGAffineTransform flipHorizontal = CGAffineTransformMake(-1, 0, 0, 1, width, 0);\n            CGContextConcatCTM(context, flipHorizontal);\n        }\n        if (vertical) {\n            CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, height);\n            CGContextConcatCTM(context, flipVertical);\n        }\n        [self drawInRect:CGRectMake(0, 0, width, height)];\n    }];\n    return image;\n}\n\n#pragma mark - Image Blending\n\n- (nullable UIImage *)sd_tintedImageWithColor:(nonnull UIColor *)tintColor {\n    BOOL hasTint = CGColorGetAlpha(tintColor.CGColor) > __FLT_EPSILON__;\n    if (!hasTint) {\n        return self;\n    }\n    \n#if SD_UIKIT || SD_MAC\n    // CIImage shortcut\n    if (self.CIImage) {\n        CIImage *ciImage = self.CIImage;\n        CIImage *colorImage = [CIImage imageWithColor:[[CIColor alloc] initWithColor:tintColor]];\n        colorImage = [colorImage imageByCroppingToRect:ciImage.extent];\n        CIFilter *filter = [CIFilter filterWithName:@\"CISourceAtopCompositing\"];\n        [filter setValue:colorImage forKey:kCIInputImageKey];\n        [filter setValue:ciImage forKey:kCIInputBackgroundImageKey];\n        ciImage = filter.outputImage;\n#if SD_UIKIT\n        UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation];\n#else\n        UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n        return image;\n    }\n#endif\n    \n    CGSize size = self.size;\n    CGRect rect = { CGPointZero, size };\n    CGFloat scale = self.scale;\n    \n    // blend mode, see https://en.wikipedia.org/wiki/Alpha_compositing\n    CGBlendMode blendMode = kCGBlendModeSourceAtop;\n    \n    SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init];\n    format.scale = scale;\n    SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format];\n    UIImage *image = [renderer imageWithActions:^(CGContextRef  _Nonnull context) {\n        [self drawInRect:rect];\n        CGContextSetBlendMode(context, blendMode);\n        CGContextSetFillColorWithColor(context, tintColor.CGColor);\n        CGContextFillRect(context, rect);\n    }];\n    return image;\n}\n\n- (nullable UIColor *)sd_colorAtPoint:(CGPoint)point {\n    CGImageRef imageRef = NULL;\n    // CIImage compatible\n#if SD_UIKIT || SD_MAC\n    if (self.CIImage) {\n        imageRef = SDCreateCGImageFromCIImage(self.CIImage);\n    }\n#endif\n    if (!imageRef) {\n        imageRef = self.CGImage;\n        CGImageRetain(imageRef);\n    }\n    if (!imageRef) {\n        return nil;\n    }\n    \n    // Check point\n    CGFloat width = CGImageGetWidth(imageRef);\n    CGFloat height = CGImageGetHeight(imageRef);\n    if (point.x < 0 || point.y < 0 || point.x >= width || point.y >= height) {\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    \n    // Get pixels\n    CGDataProviderRef provider = CGImageGetDataProvider(imageRef);\n    if (!provider) {\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    CFDataRef data = CGDataProviderCopyData(provider);\n    if (!data) {\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    \n    // Get pixel at point\n    size_t bytesPerRow = CGImageGetBytesPerRow(imageRef);\n    size_t components = CGImageGetBitsPerPixel(imageRef) / CGImageGetBitsPerComponent(imageRef);\n    CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);\n    \n    CFRange range = CFRangeMake(bytesPerRow * point.y + components * point.x, 4);\n    if (CFDataGetLength(data) < range.location + range.length) {\n        CFRelease(data);\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    Pixel_8888 pixel = {0};\n    CFDataGetBytes(data, range, pixel);\n    CFRelease(data);\n    CGImageRelease(imageRef);\n    // Convert to color\n    return SDGetColorFromPixel(pixel, bitmapInfo);\n}\n\n- (nullable NSArray<UIColor *> *)sd_colorsWithRect:(CGRect)rect {\n    CGImageRef imageRef = NULL;\n    // CIImage compatible\n#if SD_UIKIT || SD_MAC\n    if (self.CIImage) {\n        imageRef = SDCreateCGImageFromCIImage(self.CIImage);\n    }\n#endif\n    if (!imageRef) {\n        imageRef = self.CGImage;\n        CGImageRetain(imageRef);\n    }\n    if (!imageRef) {\n        return nil;\n    }\n    \n    // Check rect\n    CGFloat width = CGImageGetWidth(imageRef);\n    CGFloat height = CGImageGetHeight(imageRef);\n    if (CGRectGetWidth(rect) <= 0 || CGRectGetHeight(rect) <= 0 || CGRectGetMinX(rect) < 0 || CGRectGetMinY(rect) < 0 || CGRectGetMaxX(rect) > width || CGRectGetMaxY(rect) > height) {\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    \n    // Get pixels\n    CGDataProviderRef provider = CGImageGetDataProvider(imageRef);\n    if (!provider) {\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    CFDataRef data = CGDataProviderCopyData(provider);\n    if (!data) {\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    \n    // Get pixels with rect\n    size_t bytesPerRow = CGImageGetBytesPerRow(imageRef);\n    size_t components = CGImageGetBitsPerPixel(imageRef) / CGImageGetBitsPerComponent(imageRef);\n    \n    size_t start = bytesPerRow * CGRectGetMinY(rect) + components * CGRectGetMinX(rect);\n    size_t end = bytesPerRow * (CGRectGetMaxY(rect) - 1) + components * CGRectGetMaxX(rect);\n    if (CFDataGetLength(data) < (CFIndex)end) {\n        CFRelease(data);\n        CGImageRelease(imageRef);\n        return nil;\n    }\n    \n    const UInt8 *pixels = CFDataGetBytePtr(data);\n    size_t row = CGRectGetMinY(rect);\n    size_t col = CGRectGetMaxX(rect);\n    \n    // Convert to color\n    CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);\n    NSMutableArray<UIColor *> *colors = [NSMutableArray arrayWithCapacity:CGRectGetWidth(rect) * CGRectGetHeight(rect)];\n    for (size_t index = start; index < end; index += 4) {\n        if (index >= row * bytesPerRow + col * components) {\n            // Index beyond the end of current row, go next row\n            row++;\n            index = row * bytesPerRow + CGRectGetMinX(rect) * components;\n            index -= 4;\n            continue;\n        }\n        Pixel_8888 pixel = {pixels[index], pixels[index+1], pixels[index+2], pixels[index+3]};\n        UIColor *color = SDGetColorFromPixel(pixel, bitmapInfo);\n        [colors addObject:color];\n    }\n    CFRelease(data);\n    CGImageRelease(imageRef);\n    \n    return [colors copy];\n}\n\n#pragma mark - Image Effect\n\n// We use vImage to do box convolve for performance and support for watchOS. However, you can just use `CIFilter.CIGaussianBlur`. For other blur effect, use any filter in `CICategoryBlur`\n- (nullable UIImage *)sd_blurredImageWithRadius:(CGFloat)blurRadius {\n    if (self.size.width < 1 || self.size.height < 1) {\n        return nil;\n    }\n    BOOL hasBlur = blurRadius > __FLT_EPSILON__;\n    if (!hasBlur) {\n        return self;\n    }\n    \n    CGFloat scale = self.scale;\n    CGFloat inputRadius = blurRadius * scale;\n#if SD_UIKIT || SD_MAC\n    if (self.CIImage) {\n        CIFilter *filter = [CIFilter filterWithName:@\"CIGaussianBlur\"];\n        [filter setValue:self.CIImage forKey:kCIInputImageKey];\n        [filter setValue:@(inputRadius) forKey:kCIInputRadiusKey];\n        CIImage *ciImage = filter.outputImage;\n        ciImage = [ciImage imageByCroppingToRect:CGRectMake(0, 0, self.size.width, self.size.height)];\n#if SD_UIKIT\n        UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation];\n#else\n        UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n        return image;\n    }\n#endif\n    \n    CGImageRef imageRef = self.CGImage;\n    \n    //convert to BGRA if it isn't\n    if (CGImageGetBitsPerPixel(imageRef) != 32 ||\n        CGImageGetBitsPerComponent(imageRef) != 8 ||\n        !((CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask))) {\n        SDGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);\n        [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)];\n        imageRef = SDGraphicsGetImageFromCurrentImageContext().CGImage;\n        SDGraphicsEndImageContext();\n    }\n    \n    vImage_Buffer effect = {}, scratch = {};\n    vImage_Buffer *input = NULL, *output = NULL;\n    \n    vImage_CGImageFormat format = {\n        .bitsPerComponent = 8,\n        .bitsPerPixel = 32,\n        .colorSpace = NULL,\n        .bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, //requests a BGRA buffer.\n        .version = 0,\n        .decode = NULL,\n        .renderingIntent = CGImageGetRenderingIntent(imageRef)\n    };\n    \n    vImage_Error err;\n    err = vImageBuffer_InitWithCGImage(&effect, &format, NULL, imageRef, kvImageNoFlags);\n    if (err != kvImageNoError) {\n        NSLog(@\"UIImage+Transform error: vImageBuffer_InitWithCGImage returned error code %zi for inputImage: %@\", err, self);\n        return nil;\n    }\n    err = vImageBuffer_Init(&scratch, effect.height, effect.width, format.bitsPerPixel, kvImageNoFlags);\n    if (err != kvImageNoError) {\n        NSLog(@\"UIImage+Transform error: vImageBuffer_Init returned error code %zi for inputImage: %@\", err, self);\n        return nil;\n    }\n    \n    input = &effect;\n    output = &scratch;\n    \n    if (hasBlur) {\n        // A description of how to compute the box kernel width from the Gaussian\n        // radius (aka standard deviation) appears in the SVG spec:\n        // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement\n        //\n        // For larger values of 's' (s >= 2.0), an approximation can be used: Three\n        // successive box-blurs build a piece-wise quadratic convolution kernel, which\n        // approximates the Gaussian kernel to within roughly 3%.\n        //\n        // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5)\n        //\n        // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel.\n        //\n        if (inputRadius - 2.0 < __FLT_EPSILON__) inputRadius = 2.0;\n        uint32_t radius = floor(inputRadius * 3.0 * sqrt(2 * M_PI) / 4 + 0.5);\n        radius |= 1; // force radius to be odd so that the three box-blur methodology works.\n        int iterations;\n        if (blurRadius * scale < 0.5) iterations = 1;\n        else if (blurRadius * scale < 1.5) iterations = 2;\n        else iterations = 3;\n        NSInteger tempSize = vImageBoxConvolve_ARGB8888(input, output, NULL, 0, 0, radius, radius, NULL, kvImageGetTempBufferSize | kvImageEdgeExtend);\n        void *temp = malloc(tempSize);\n        for (int i = 0; i < iterations; i++) {\n            vImageBoxConvolve_ARGB8888(input, output, temp, 0, 0, radius, radius, NULL, kvImageEdgeExtend);\n            vImage_Buffer *tmp = input;\n            input = output;\n            output = tmp;\n        }\n        free(temp);\n    }\n    \n    CGImageRef effectCGImage = NULL;\n    effectCGImage = vImageCreateCGImageFromBuffer(input, &format, NULL, NULL, kvImageNoAllocate, NULL);\n    if (effectCGImage == NULL) {\n        effectCGImage = vImageCreateCGImageFromBuffer(input, &format, NULL, NULL, kvImageNoFlags, NULL);\n        free(input->data);\n    }\n    free(output->data);\n#if SD_UIKIT || SD_WATCH\n    UIImage *outputImage = [UIImage imageWithCGImage:effectCGImage scale:self.scale orientation:self.imageOrientation];\n#else\n    UIImage *outputImage = [[UIImage alloc] initWithCGImage:effectCGImage scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n    CGImageRelease(effectCGImage);\n    \n    return outputImage;\n}\n\n#if SD_UIKIT || SD_MAC\n- (nullable UIImage *)sd_filteredImageWithFilter:(nonnull CIFilter *)filter {\n    CIImage *inputImage;\n    if (self.CIImage) {\n        inputImage = self.CIImage;\n    } else {\n        CGImageRef imageRef = self.CGImage;\n        if (!imageRef) {\n            return nil;\n        }\n        inputImage = [CIImage imageWithCGImage:imageRef];\n    }\n    if (!inputImage) return nil;\n    \n    CIContext *context = [CIContext context];\n    [filter setValue:inputImage forKey:kCIInputImageKey];\n    CIImage *outputImage = filter.outputImage;\n    if (!outputImage) return nil;\n    \n    CGImageRef imageRef = [context createCGImage:outputImage fromRect:outputImage.extent];\n    if (!imageRef) return nil;\n    \n#if SD_UIKIT\n    UIImage *image = [UIImage imageWithCGImage:imageRef scale:self.scale orientation:self.imageOrientation];\n#else\n    UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:self.scale orientation:kCGImagePropertyOrientationUp];\n#endif\n    CGImageRelease(imageRef);\n    \n    return image;\n}\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_UIKIT\n\n#import \"SDWebImageManager.h\"\n\n/**\n * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state.\n */\n@interface UIImageView (HighlightedWebCache)\n\n/**\n * Set the imageView `highlightedImage` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url The url for the image.\n */\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `highlightedImage` with an `url` and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url     The url for the image.\n * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n */\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url\n                              options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `highlightedImage` with an `url`, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url     The url for the image.\n * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n */\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url\n                              options:(SDWebImageOptions)options\n                              context:(nullable SDWebImageContext *)context;\n\n/**\n * Set the imageView `highlightedImage` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url\n                            completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `highlightedImage` with an `url` and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url\n                              options:(SDWebImageOptions)options\n                            completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `highlightedImage` with an `url` and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url\n                              options:(SDWebImageOptions)options\n                             progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                            completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `highlightedImage` with an `url`, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url\n                              options:(SDWebImageOptions)options\n                              context:(nullable SDWebImageContext *)context\n                             progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                            completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImageView+HighlightedWebCache.h\"\n\n#if SD_UIKIT\n\n#import \"UIView+WebCacheOperation.h\"\n#import \"UIView+WebCache.h\"\n#import \"SDInternalMacros.h\"\n\nstatic NSString * const SDHighlightedImageOperationKey = @\"UIImageViewImageOperationHighlighted\";\n\n@implementation UIImageView (HighlightedWebCache)\n\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url {\n    [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options {\n    [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil];\n}\n\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {\n    [self sd_setHighlightedImageWithURL:url options:options context:context progress:nil completed:nil];\n}\n\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock];\n}\n\n- (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setHighlightedImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url\n                              options:(SDWebImageOptions)options\n                              context:(nullable SDWebImageContext *)context\n                             progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                            completed:(nullable SDExternalCompletionBlock)completedBlock {\n    @weakify(self);\n    SDWebImageMutableContext *mutableContext;\n    if (context) {\n        mutableContext = [context mutableCopy];\n    } else {\n        mutableContext = [NSMutableDictionary dictionary];\n    }\n    mutableContext[SDWebImageContextSetImageOperationKey] = SDHighlightedImageOperationKey;\n    [self sd_internalSetImageWithURL:url\n                    placeholderImage:nil\n                             options:options\n                             context:mutableContext\n                       setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {\n                           @strongify(self);\n                           self.highlightedImage = image;\n                       }\n                            progress:progressBlock\n                           completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                               if (completedBlock) {\n                                   completedBlock(image, error, cacheType, imageURL);\n                               }\n                           }];\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageManager.h\"\n\n/**\n * Usage with a UITableViewCell sub-class:\n *\n * @code\n\n#import <SDWebImage/UIImageView+WebCache.h>\n\n...\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n    static NSString *MyIdentifier = @\"MyIdentifier\";\n \n    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];\n \n    if (cell == nil) {\n        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];\n    }\n \n    // Here we use the provided sd_setImageWithURL:placeholderImage: method to load the web image\n    // Ensure you use a placeholder image otherwise cells will be initialized with no image\n    [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@\"http://example.com/image.jpg\"]\n                      placeholderImage:[UIImage imageNamed:@\"placeholder\"]];\n \n    cell.textLabel.text = @\"My Text\";\n    return cell;\n}\n\n * @endcode\n */\n\n/**\n * Integrates SDWebImage async downloading and caching of remote images with UIImageView.\n */\n@interface UIImageView (WebCache)\n\n/**\n * Set the imageView `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url The url for the image.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url` and a placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @see sd_setImageWithURL:placeholderImage:options:\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url         The url for the image.\n * @param placeholder The image to be set initially, until the image request finishes.\n * @param options     The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context     A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context;\n\n/**\n * Set the imageView `image` with an `url`.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `image` with an `url`, placeholder.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                 completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;\n\n/**\n * Set the imageView `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `image` with an `url`, placeholder and custom options.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n/**\n * Set the imageView `image` with an `url`, placeholder, custom options and context.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed. This block has no return value\n *                       and takes the requested UIImage as first parameter. In case of error the image parameter\n *                       is nil and the second parameter may contain an NSError. The third parameter is a Boolean\n *                       indicating if the image was retrieved from the local cache or from the network.\n *                       The fourth parameter is the original image url.\n */\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIImageView+WebCache.h\"\n#import \"objc/runtime.h\"\n#import \"UIView+WebCacheOperation.h\"\n#import \"UIView+WebCache.h\"\n\n@implementation UIImageView (WebCache)\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url {\n    [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock];\n}\n\n- (void)sd_setImageWithURL:(nullable NSURL *)url\n          placeholderImage:(nullable UIImage *)placeholder\n                   options:(SDWebImageOptions)options\n                   context:(nullable SDWebImageContext *)context\n                  progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                 completed:(nullable SDExternalCompletionBlock)completedBlock {\n    [self sd_internalSetImageWithURL:url\n                    placeholderImage:placeholder\n                             options:options\n                             context:context\n                       setImageBlock:nil\n                            progress:progressBlock\n                           completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {\n                               if (completedBlock) {\n                                   completedBlock(image, error, cacheType, imageURL);\n                               }\n                           }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageDefine.h\"\n#import \"SDWebImageManager.h\"\n#import \"SDWebImageTransition.h\"\n#import \"SDWebImageIndicator.h\"\n\n/**\n The value specify that the image progress unit count cannot be determined because the progressBlock is not been called.\n */\nFOUNDATION_EXPORT const int64_t SDWebImageProgressUnitCountUnknown; /* 1LL */\n\ntypedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL);\n\n/**\n Integrates SDWebImage async downloading and caching of remote images with UIView subclass.\n */\n@interface UIView (WebCache)\n\n/**\n * Get the current image URL.\n *\n * @note Note that because of the limitations of categories this property can get out of sync if you use setImage: directly.\n */\n@property (nonatomic, strong, readonly, nullable) NSURL *sd_imageURL;\n\n/**\n * Get the current image operation key. Operation key is used to identify the different queries for one view instance (like UIButton).\n * See more about this in `SDWebImageContextSetImageOperationKey`.\n * If you cancel current image load, the key will be set to nil.\n * @note You can use method `UIView+WebCacheOperation` to investigate different queries' operation.\n */\n@property (nonatomic, strong, readonly, nullable) NSString *sd_latestOperationKey;\n\n/**\n * The current image loading progress associated to the view. The unit count is the received size and excepted size of download.\n * The `totalUnitCount` and `completedUnitCount` will be reset to 0 after a new image loading start (change from current queue). And they will be set to `SDWebImageProgressUnitCountUnknown` if the progressBlock not been called but the image loading success to mark the progress finished (change from main queue).\n * @note You can use Key-Value Observing on the progress, but you should take care that the change to progress is from a background queue during download(the same as progressBlock). If you want to using KVO and update the UI, make sure to dispatch on the main queue. And it's recommend to use some KVO libs like KVOController because it's more safe and easy to use.\n * @note The getter will create a progress instance if the value is nil. But by default, we don't create one. If you need to use Key-Value Observing, you must trigger the getter or set a custom progress instance before the loading start. The default value is nil.\n * @note Note that because of the limitations of categories this property can get out of sync if you update the progress directly.\n */\n@property (nonatomic, strong, null_resettable) NSProgress *sd_imageProgress;\n\n/**\n * Set the imageView `image` with an `url` and optionally a placeholder image.\n *\n * The download is asynchronous and cached.\n *\n * @param url            The url for the image.\n * @param placeholder    The image to be set initially, until the image request finishes.\n * @param options        The options to use when downloading the image. @see SDWebImageOptions for the possible values.\n * @param context        A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold.\n * @param setImageBlock  Block used for custom set image code. If not provide, use the built-in set image code (supports `UIImageView/NSImageView` and `UIButton/NSButton` currently)\n * @param progressBlock  A block called while image is downloading\n *                       @note the progress block is executed on a background queue\n * @param completedBlock A block called when operation has been completed.\n *   This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter.\n *   In case of error the image parameter is nil and the third parameter may contain an NSError.\n *\n *   The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache\n *   or from the memory cache or from the network.\n *\n *   The fifth parameter normally is always YES. However, if you provide SDWebImageAvoidAutoSetImage with SDWebImageProgressiveLoad options to enable progressive downloading and set the image yourself. This block is thus called repeatedly with a partial image. When image is fully downloaded, the\n *   block is called a last time with the full image and the last parameter set to YES.\n *\n *   The last parameter is the original image URL\n */\n- (void)sd_internalSetImageWithURL:(nullable NSURL *)url\n                  placeholderImage:(nullable UIImage *)placeholder\n                           options:(SDWebImageOptions)options\n                           context:(nullable SDWebImageContext *)context\n                     setImageBlock:(nullable SDSetImageBlock)setImageBlock\n                          progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                         completed:(nullable SDInternalCompletionBlock)completedBlock;\n\n/**\n * Cancel the current image load\n */\n- (void)sd_cancelCurrentImageLoad;\n\n#if SD_UIKIT || SD_MAC\n\n#pragma mark - Image Transition\n\n/**\n The image transition when image load finished. See `SDWebImageTransition`.\n If you specify nil, do not do transition. Defaults to nil.\n */\n@property (nonatomic, strong, nullable) SDWebImageTransition *sd_imageTransition;\n\n#pragma mark - Image Indicator\n\n/**\n The image indicator during the image loading. If you do not need indicator, specify nil. Defaults to nil\n The setter will remove the old indicator view and add new indicator view to current view's subview.\n @note Because this is UI related, you should access only from the main queue.\n */\n@property (nonatomic, strong, nullable) id<SDWebImageIndicator> sd_imageIndicator;\n\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIView+WebCache.h\"\n#import \"objc/runtime.h\"\n#import \"UIView+WebCacheOperation.h\"\n#import \"SDWebImageError.h\"\n#import \"SDInternalMacros.h\"\n#import \"SDWebImageTransitionInternal.h\"\n#import \"SDImageCache.h\"\n\nconst int64_t SDWebImageProgressUnitCountUnknown = 1LL;\n\n@implementation UIView (WebCache)\n\n- (nullable NSURL *)sd_imageURL {\n    return objc_getAssociatedObject(self, @selector(sd_imageURL));\n}\n\n- (void)setSd_imageURL:(NSURL * _Nullable)sd_imageURL {\n    objc_setAssociatedObject(self, @selector(sd_imageURL), sd_imageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (nullable NSString *)sd_latestOperationKey {\n    return objc_getAssociatedObject(self, @selector(sd_latestOperationKey));\n}\n\n- (void)setSd_latestOperationKey:(NSString * _Nullable)sd_latestOperationKey {\n    objc_setAssociatedObject(self, @selector(sd_latestOperationKey), sd_latestOperationKey, OBJC_ASSOCIATION_COPY_NONATOMIC);\n}\n\n- (NSProgress *)sd_imageProgress {\n    NSProgress *progress = objc_getAssociatedObject(self, @selector(sd_imageProgress));\n    if (!progress) {\n        progress = [[NSProgress alloc] initWithParent:nil userInfo:nil];\n        self.sd_imageProgress = progress;\n    }\n    return progress;\n}\n\n- (void)setSd_imageProgress:(NSProgress *)sd_imageProgress {\n    objc_setAssociatedObject(self, @selector(sd_imageProgress), sd_imageProgress, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (void)sd_internalSetImageWithURL:(nullable NSURL *)url\n                  placeholderImage:(nullable UIImage *)placeholder\n                           options:(SDWebImageOptions)options\n                           context:(nullable SDWebImageContext *)context\n                     setImageBlock:(nullable SDSetImageBlock)setImageBlock\n                          progress:(nullable SDImageLoaderProgressBlock)progressBlock\n                         completed:(nullable SDInternalCompletionBlock)completedBlock {\n    if (context) {\n        // copy to avoid mutable object\n        context = [context copy];\n    } else {\n        context = [NSDictionary dictionary];\n    }\n    NSString *validOperationKey = context[SDWebImageContextSetImageOperationKey];\n    if (!validOperationKey) {\n        // pass through the operation key to downstream, which can used for tracing operation or image view class\n        validOperationKey = NSStringFromClass([self class]);\n        SDWebImageMutableContext *mutableContext = [context mutableCopy];\n        mutableContext[SDWebImageContextSetImageOperationKey] = validOperationKey;\n        context = [mutableContext copy];\n    }\n    self.sd_latestOperationKey = validOperationKey;\n    [self sd_cancelImageLoadOperationWithKey:validOperationKey];\n    self.sd_imageURL = url;\n    \n    SDWebImageManager *manager = context[SDWebImageContextCustomManager];\n    if (!manager) {\n        manager = [SDWebImageManager sharedManager];\n    } else {\n        // remove this manager to avoid retain cycle (manger -> loader -> operation -> context -> manager)\n        SDWebImageMutableContext *mutableContext = [context mutableCopy];\n        mutableContext[SDWebImageContextCustomManager] = nil;\n        context = [mutableContext copy];\n    }\n    \n    BOOL shouldUseWeakCache = NO;\n    if ([manager.imageCache isKindOfClass:SDImageCache.class]) {\n        shouldUseWeakCache = ((SDImageCache *)manager.imageCache).config.shouldUseWeakMemoryCache;\n    }\n    if (!(options & SDWebImageDelayPlaceholder)) {\n        if (shouldUseWeakCache) {\n            NSString *key = [manager cacheKeyForURL:url context:context];\n            // call memory cache to trigger weak cache sync logic, ignore the return value and go on normal query\n            // this unfortunately will cause twice memory cache query, but it's fast enough\n            // in the future the weak cache feature may be re-design or removed\n            [((SDImageCache *)manager.imageCache) imageFromMemoryCacheForKey:key];\n        }\n        dispatch_main_async_safe(^{\n            [self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:SDImageCacheTypeNone imageURL:url];\n        });\n    }\n    \n    if (url) {\n        // reset the progress\n        NSProgress *imageProgress = objc_getAssociatedObject(self, @selector(sd_imageProgress));\n        if (imageProgress) {\n            imageProgress.totalUnitCount = 0;\n            imageProgress.completedUnitCount = 0;\n        }\n        \n#if SD_UIKIT || SD_MAC\n        // check and start image indicator\n        [self sd_startImageIndicator];\n        id<SDWebImageIndicator> imageIndicator = self.sd_imageIndicator;\n#endif\n        \n        SDImageLoaderProgressBlock combinedProgressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {\n            if (imageProgress) {\n                imageProgress.totalUnitCount = expectedSize;\n                imageProgress.completedUnitCount = receivedSize;\n            }\n#if SD_UIKIT || SD_MAC\n            if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) {\n                double progress = 0;\n                if (expectedSize != 0) {\n                    progress = (double)receivedSize / expectedSize;\n                }\n                progress = MAX(MIN(progress, 1), 0); // 0.0 - 1.0\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    [imageIndicator updateIndicatorProgress:progress];\n                });\n            }\n#endif\n            if (progressBlock) {\n                progressBlock(receivedSize, expectedSize, targetURL);\n            }\n        };\n        @weakify(self);\n        id <SDWebImageOperation> operation = [manager loadImageWithURL:url options:options context:context progress:combinedProgressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {\n            @strongify(self);\n            if (!self) { return; }\n            // if the progress not been updated, mark it to complete state\n            if (imageProgress && finished && !error && imageProgress.totalUnitCount == 0 && imageProgress.completedUnitCount == 0) {\n                imageProgress.totalUnitCount = SDWebImageProgressUnitCountUnknown;\n                imageProgress.completedUnitCount = SDWebImageProgressUnitCountUnknown;\n            }\n            \n#if SD_UIKIT || SD_MAC\n            // check and stop image indicator\n            if (finished) {\n                [self sd_stopImageIndicator];\n            }\n#endif\n            \n            BOOL shouldCallCompletedBlock = finished || (options & SDWebImageAvoidAutoSetImage);\n            BOOL shouldNotSetImage = ((image && (options & SDWebImageAvoidAutoSetImage)) ||\n                                      (!image && !(options & SDWebImageDelayPlaceholder)));\n            SDWebImageNoParamsBlock callCompletedBlockClosure = ^{\n                if (!self) { return; }\n                if (!shouldNotSetImage) {\n                    [self sd_setNeedsLayout];\n                }\n                if (completedBlock && shouldCallCompletedBlock) {\n                    completedBlock(image, data, error, cacheType, finished, url);\n                }\n            };\n            \n            // case 1a: we got an image, but the SDWebImageAvoidAutoSetImage flag is set\n            // OR\n            // case 1b: we got no image and the SDWebImageDelayPlaceholder is not set\n            if (shouldNotSetImage) {\n                dispatch_main_async_safe(callCompletedBlockClosure);\n                return;\n            }\n            \n            UIImage *targetImage = nil;\n            NSData *targetData = nil;\n            if (image) {\n                // case 2a: we got an image and the SDWebImageAvoidAutoSetImage is not set\n                targetImage = image;\n                targetData = data;\n            } else if (options & SDWebImageDelayPlaceholder) {\n                // case 2b: we got no image and the SDWebImageDelayPlaceholder flag is set\n                targetImage = placeholder;\n                targetData = nil;\n            }\n            \n#if SD_UIKIT || SD_MAC\n            // check whether we should use the image transition\n            SDWebImageTransition *transition = nil;\n            BOOL shouldUseTransition = NO;\n            if (options & SDWebImageForceTransition) {\n                // Always\n                shouldUseTransition = YES;\n            } else if (cacheType == SDImageCacheTypeNone) {\n                // From network\n                shouldUseTransition = YES;\n            } else {\n                // From disk (and, user don't use sync query)\n                if (cacheType == SDImageCacheTypeMemory) {\n                    shouldUseTransition = NO;\n                } else if (cacheType == SDImageCacheTypeDisk) {\n                    if (options & SDWebImageQueryMemoryDataSync || options & SDWebImageQueryDiskDataSync) {\n                        shouldUseTransition = NO;\n                    } else {\n                        shouldUseTransition = YES;\n                    }\n                } else {\n                    // Not valid cache type, fallback\n                    shouldUseTransition = NO;\n                }\n            }\n            if (finished && shouldUseTransition) {\n                transition = self.sd_imageTransition;\n            }\n#endif\n            dispatch_main_async_safe(^{\n#if SD_UIKIT || SD_MAC\n                [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:transition cacheType:cacheType imageURL:imageURL];\n#else\n                [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:cacheType imageURL:imageURL];\n#endif\n                callCompletedBlockClosure();\n            });\n        }];\n        [self sd_setImageLoadOperation:operation forKey:validOperationKey];\n    } else {\n#if SD_UIKIT || SD_MAC\n        [self sd_stopImageIndicator];\n#endif\n        dispatch_main_async_safe(^{\n            if (completedBlock) {\n                NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey : @\"Image url is nil\"}];\n                completedBlock(nil, nil, error, SDImageCacheTypeNone, YES, url);\n            }\n        });\n    }\n}\n\n- (void)sd_cancelCurrentImageLoad {\n    [self sd_cancelImageLoadOperationWithKey:self.sd_latestOperationKey];\n    self.sd_latestOperationKey = nil;\n}\n\n- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL {\n#if SD_UIKIT || SD_MAC\n    [self sd_setImage:image imageData:imageData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:nil cacheType:cacheType imageURL:imageURL];\n#else\n    // watchOS does not support view transition. Simplify the logic\n    if (setImageBlock) {\n        setImageBlock(image, imageData, cacheType, imageURL);\n    } else if ([self isKindOfClass:[UIImageView class]]) {\n        UIImageView *imageView = (UIImageView *)self;\n        [imageView setImage:image];\n    }\n#endif\n}\n\n#if SD_UIKIT || SD_MAC\n- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock transition:(SDWebImageTransition *)transition cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL {\n    UIView *view = self;\n    SDSetImageBlock finalSetImageBlock;\n    if (setImageBlock) {\n        finalSetImageBlock = setImageBlock;\n    } else if ([view isKindOfClass:[UIImageView class]]) {\n        UIImageView *imageView = (UIImageView *)view;\n        finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) {\n            imageView.image = setImage;\n        };\n    }\n#if SD_UIKIT\n    else if ([view isKindOfClass:[UIButton class]]) {\n        UIButton *button = (UIButton *)view;\n        finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) {\n            [button setImage:setImage forState:UIControlStateNormal];\n        };\n    }\n#endif\n#if SD_MAC\n    else if ([view isKindOfClass:[NSButton class]]) {\n        NSButton *button = (NSButton *)view;\n        finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) {\n            button.image = setImage;\n        };\n    }\n#endif\n    \n    if (transition) {\n        NSString *originalOperationKey = view.sd_latestOperationKey;\n\n#if SD_UIKIT\n        [UIView transitionWithView:view duration:0 options:0 animations:^{\n            if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) {\n                return;\n            }\n            // 0 duration to let UIKit render placeholder and prepares block\n            if (transition.prepares) {\n                transition.prepares(view, image, imageData, cacheType, imageURL);\n            }\n        } completion:^(BOOL tempFinished) {\n            [UIView transitionWithView:view duration:transition.duration options:transition.animationOptions animations:^{\n                if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) {\n                    return;\n                }\n                if (finalSetImageBlock && !transition.avoidAutoSetImage) {\n                    finalSetImageBlock(image, imageData, cacheType, imageURL);\n                }\n                if (transition.animations) {\n                    transition.animations(view, image);\n                }\n            } completion:^(BOOL finished) {\n                if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) {\n                    return;\n                }\n                if (transition.completion) {\n                    transition.completion(finished);\n                }\n            }];\n        }];\n#elif SD_MAC\n        [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull prepareContext) {\n            if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) {\n                return;\n            }\n            // 0 duration to let AppKit render placeholder and prepares block\n            prepareContext.duration = 0;\n            if (transition.prepares) {\n                transition.prepares(view, image, imageData, cacheType, imageURL);\n            }\n        } completionHandler:^{\n            [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) {\n                if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) {\n                    return;\n                }\n                context.duration = transition.duration;\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n                CAMediaTimingFunction *timingFunction = transition.timingFunction;\n#pragma clang diagnostic pop\n                if (!timingFunction) {\n                    timingFunction = SDTimingFunctionFromAnimationOptions(transition.animationOptions);\n                }\n                context.timingFunction = timingFunction;\n                context.allowsImplicitAnimation = SD_OPTIONS_CONTAINS(transition.animationOptions, SDWebImageAnimationOptionAllowsImplicitAnimation);\n                if (finalSetImageBlock && !transition.avoidAutoSetImage) {\n                    finalSetImageBlock(image, imageData, cacheType, imageURL);\n                }\n                CATransition *trans = SDTransitionFromAnimationOptions(transition.animationOptions);\n                if (trans) {\n                    [view.layer addAnimation:trans forKey:kCATransition];\n                }\n                if (transition.animations) {\n                    transition.animations(view, image);\n                }\n            } completionHandler:^{\n                if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) {\n                    return;\n                }\n                if (transition.completion) {\n                    transition.completion(YES);\n                }\n            }];\n        }];\n#endif\n    } else {\n        if (finalSetImageBlock) {\n            finalSetImageBlock(image, imageData, cacheType, imageURL);\n        }\n    }\n}\n#endif\n\n- (void)sd_setNeedsLayout {\n#if SD_UIKIT\n    [self setNeedsLayout];\n#elif SD_MAC\n    [self setNeedsLayout:YES];\n#elif SD_WATCH\n    // Do nothing because WatchKit automatically layout the view after property change\n#endif\n}\n\n#if SD_UIKIT || SD_MAC\n\n#pragma mark - Image Transition\n- (SDWebImageTransition *)sd_imageTransition {\n    return objc_getAssociatedObject(self, @selector(sd_imageTransition));\n}\n\n- (void)setSd_imageTransition:(SDWebImageTransition *)sd_imageTransition {\n    objc_setAssociatedObject(self, @selector(sd_imageTransition), sd_imageTransition, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n#pragma mark - Indicator\n- (id<SDWebImageIndicator>)sd_imageIndicator {\n    return objc_getAssociatedObject(self, @selector(sd_imageIndicator));\n}\n\n- (void)setSd_imageIndicator:(id<SDWebImageIndicator>)sd_imageIndicator {\n    // Remove the old indicator view\n    id<SDWebImageIndicator> previousIndicator = self.sd_imageIndicator;\n    [previousIndicator.indicatorView removeFromSuperview];\n    \n    objc_setAssociatedObject(self, @selector(sd_imageIndicator), sd_imageIndicator, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    \n    // Add the new indicator view\n    UIView *view = sd_imageIndicator.indicatorView;\n    if (CGRectEqualToRect(view.frame, CGRectZero)) {\n        view.frame = self.bounds;\n    }\n    // Center the indicator view\n#if SD_MAC\n    [view setFrameOrigin:CGPointMake(round((NSWidth(self.bounds) - NSWidth(view.frame)) / 2), round((NSHeight(self.bounds) - NSHeight(view.frame)) / 2))];\n#else\n    view.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));\n#endif\n    view.hidden = NO;\n    [self addSubview:view];\n}\n\n- (void)sd_startImageIndicator {\n    id<SDWebImageIndicator> imageIndicator = self.sd_imageIndicator;\n    if (!imageIndicator) {\n        return;\n    }\n    dispatch_main_async_safe(^{\n        [imageIndicator startAnimatingIndicator];\n    });\n}\n\n- (void)sd_stopImageIndicator {\n    id<SDWebImageIndicator> imageIndicator = self.sd_imageIndicator;\n    if (!imageIndicator) {\n        return;\n    }\n    dispatch_main_async_safe(^{\n        [imageIndicator stopAnimatingIndicator];\n    });\n}\n\n#endif\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageOperation.h\"\n\n/**\n These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external.\n All the stored operations are weak, so it will be dealloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them.\n */\n@interface UIView (WebCacheOperation)\n\n/**\n *  Get the image load operation for key\n *\n *  @param key key for identifying the operations\n *  @return the image load operation\n */\n- (nullable id<SDWebImageOperation>)sd_imageLoadOperationForKey:(nullable NSString *)key;\n\n/**\n *  Set the image load operation (storage in a UIView based weak map table)\n *\n *  @param operation the operation\n *  @param key       key for storing the operation\n */\n- (void)sd_setImageLoadOperation:(nullable id<SDWebImageOperation>)operation forKey:(nullable NSString *)key;\n\n/**\n *  Cancel all operations for the current UIView and key\n *\n *  @param key key for identifying the operations\n */\n- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key;\n\n/**\n *  Just remove the operations corresponding to the current UIView and key without cancelling them\n *\n *  @param key key for identifying the operations\n */\n- (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIView+WebCacheOperation.h\"\n#import \"objc/runtime.h\"\n\nstatic char loadOperationKey;\n\n// key is strong, value is weak because operation instance is retained by SDWebImageManager's runningOperations property\n// we should use lock to keep thread-safe because these method may not be accessed from main queue\ntypedef NSMapTable<NSString *, id<SDWebImageOperation>> SDOperationsDictionary;\n\n@implementation UIView (WebCacheOperation)\n\n- (SDOperationsDictionary *)sd_operationDictionary {\n    @synchronized(self) {\n        SDOperationsDictionary *operations = objc_getAssociatedObject(self, &loadOperationKey);\n        if (operations) {\n            return operations;\n        }\n        operations = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0];\n        objc_setAssociatedObject(self, &loadOperationKey, operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n        return operations;\n    }\n}\n\n- (nullable id<SDWebImageOperation>)sd_imageLoadOperationForKey:(nullable NSString *)key  {\n    id<SDWebImageOperation> operation;\n    if (key) {\n        SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];\n        @synchronized (self) {\n            operation = [operationDictionary objectForKey:key];\n        }\n    }\n    return operation;\n}\n\n- (void)sd_setImageLoadOperation:(nullable id<SDWebImageOperation>)operation forKey:(nullable NSString *)key {\n    if (key) {\n        [self sd_cancelImageLoadOperationWithKey:key];\n        if (operation) {\n            SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];\n            @synchronized (self) {\n                [operationDictionary setObject:operation forKey:key];\n            }\n        }\n    }\n}\n\n- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key {\n    if (key) {\n        // Cancel in progress downloader from queue\n        SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];\n        id<SDWebImageOperation> operation;\n        \n        @synchronized (self) {\n            operation = [operationDictionary objectForKey:key];\n        }\n        if (operation) {\n            if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) {\n                [operation cancel];\n            }\n            @synchronized (self) {\n                [operationDictionary removeObjectForKey:key];\n            }\n        }\n    }\n}\n\n- (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key {\n    if (key) {\n        SDOperationsDictionary *operationDictionary = [self sd_operationDictionary];\n        @synchronized (self) {\n            [operationDictionary removeObjectForKey:key];\n        }\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_MAC\n\n#import \"UIImage+Transform.h\"\n\n@interface NSBezierPath (SDRoundedCorners)\n\n/**\n Convenience way to create a bezier path with the specify rounding corners on macOS. Same as the one on `UIBezierPath`.\n */\n+ (nonnull instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius;\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"NSBezierPath+SDRoundedCorners.h\"\n\n#if SD_MAC\n\n@implementation NSBezierPath (SDRoundedCorners)\n\n+ (instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius {\n    NSBezierPath *path = [NSBezierPath bezierPath];\n    \n    CGFloat maxCorner = MIN(NSWidth(rect), NSHeight(rect)) / 2;\n    \n    CGFloat topLeftRadius = MIN(maxCorner, (corners & SDRectCornerTopLeft) ? cornerRadius : 0);\n    CGFloat topRightRadius = MIN(maxCorner, (corners & SDRectCornerTopRight) ? cornerRadius : 0);\n    CGFloat bottomLeftRadius = MIN(maxCorner, (corners & SDRectCornerBottomLeft) ? cornerRadius : 0);\n    CGFloat bottomRightRadius = MIN(maxCorner, (corners & SDRectCornerBottomRight) ? cornerRadius : 0);\n    \n    NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect));\n    NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect));\n    NSPoint bottomLeft = NSMakePoint(NSMinX(rect), NSMinY(rect));\n    NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect));\n    \n    [path moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))];\n    [path appendBezierPathWithArcFromPoint:topLeft toPoint:bottomLeft radius:topLeftRadius];\n    [path appendBezierPathWithArcFromPoint:bottomLeft toPoint:bottomRight radius:bottomLeftRadius];\n    [path appendBezierPathWithArcFromPoint:bottomRight toPoint:topRight radius:bottomRightRadius];\n    [path appendBezierPathWithArcFromPoint:topRight toPoint:topLeft radius:topRightRadius];\n    [path closePath];\n    \n    return path;\n}\n\n@end\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDWebImageCompat.h\"\n\n/// Copy the associated object from source image to target image. The associated object including all the category read/write properties.\n/// @param source source\n/// @param target target\nFOUNDATION_EXPORT void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target);\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDAssociatedObject.h\"\n#import \"UIImage+Metadata.h\"\n#import \"UIImage+ExtendedCacheData.h\"\n#import \"UIImage+MemoryCacheCost.h\"\n#import \"UIImage+ForceDecode.h\"\n\nvoid SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target) {\n    if (!source || !target) {\n        return;\n    }\n    // Image Metadata\n    target.sd_isIncremental = source.sd_isIncremental;\n    target.sd_imageLoopCount = source.sd_imageLoopCount;\n    target.sd_imageFormat = source.sd_imageFormat;\n    // Force Decode\n    target.sd_isDecoded = source.sd_isDecoded;\n    // Extended Cache Data\n    target.sd_extendedObject = source.sd_extendedObject;\n}\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n@class SDAsyncBlockOperation;\ntypedef void (^SDAsyncBlock)(SDAsyncBlockOperation * __nonnull asyncOperation);\n\n/// A async block operation, success after you call `completer` (not like `NSBlockOperation` which is for sync block, success on return)\n@interface SDAsyncBlockOperation : NSOperation\n\n- (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block;\n+ (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block;\n- (void)complete;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDAsyncBlockOperation.h\"\n\n@interface SDAsyncBlockOperation ()\n\n@property (assign, nonatomic, getter = isExecuting) BOOL executing;\n@property (assign, nonatomic, getter = isFinished) BOOL finished;\n@property (nonatomic, copy, nonnull) SDAsyncBlock executionBlock;\n\n@end\n\n@implementation SDAsyncBlockOperation\n\n@synthesize executing = _executing;\n@synthesize finished = _finished;\n\n- (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block {\n    self = [super init];\n    if (self) {\n        self.executionBlock = block;\n    }\n    return self;\n}\n\n+ (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block {\n    SDAsyncBlockOperation *operation = [[SDAsyncBlockOperation alloc] initWithBlock:block];\n    return operation;\n}\n\n- (void)start {\n    @synchronized (self) {\n        if (self.isCancelled) {\n            self.finished = YES;\n            return;\n        }\n        \n        self.finished = NO;\n        self.executing = YES;\n        \n        if (self.executionBlock) {\n            self.executionBlock(self);\n        } else {\n            self.executing = NO;\n            self.finished = YES;\n        }\n    }\n}\n\n- (void)cancel {\n    @synchronized (self) {\n        [super cancel];\n        if (self.isExecuting) {\n            self.executing = NO;\n            self.finished = YES;\n        }\n    }\n}\n\n \n- (void)complete {\n    @synchronized (self) {\n        if (self.isExecuting) {\n            self.finished = YES;\n            self.executing = NO;\n        }\n    }\n }\n\n- (void)setFinished:(BOOL)finished {\n    [self willChangeValueForKey:@\"isFinished\"];\n    _finished = finished;\n    [self didChangeValueForKey:@\"isFinished\"];\n}\n\n- (void)setExecuting:(BOOL)executing {\n    [self willChangeValueForKey:@\"isExecuting\"];\n    _executing = executing;\n    [self didChangeValueForKey:@\"isExecuting\"];\n}\n\n- (BOOL)isConcurrent {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/// Device information helper methods\n@interface SDDeviceHelper : NSObject\n\n+ (NSUInteger)totalMemory;\n+ (NSUInteger)freeMemory;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDDeviceHelper.h\"\n#import <mach/mach.h>\n\n@implementation SDDeviceHelper\n\n+ (NSUInteger)totalMemory {\n    return (NSUInteger)[[NSProcessInfo processInfo] physicalMemory];\n}\n\n+ (NSUInteger)freeMemory {\n    mach_port_t host_port = mach_host_self();\n    mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);\n    vm_size_t page_size;\n    vm_statistics_data_t vm_stat;\n    kern_return_t kern;\n    \n    kern = host_page_size(host_port, &page_size);\n    if (kern != KERN_SUCCESS) return 0;\n    kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size);\n    if (kern != KERN_SUCCESS) return 0;\n    return vm_stat.free_count * page_size;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/// Cross-platform display link wrapper. Do not retain the target\n/// Use `CADisplayLink` on iOS/tvOS, `CVDisplayLink` on macOS, `NSTimer` on watchOS\n@interface SDDisplayLink : NSObject\n\n@property (readonly, nonatomic, weak, nullable) id target;\n@property (readonly, nonatomic, assign, nonnull) SEL selector;\n@property (readonly, nonatomic) CFTimeInterval duration;\n@property (readonly, nonatomic) BOOL isRunning;\n\n+ (nonnull instancetype)displayLinkWithTarget:(nonnull id)target selector:(nonnull SEL)sel;\n\n- (void)addToRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode;\n- (void)removeFromRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode;\n\n- (void)start;\n- (void)stop;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDDisplayLink.h\"\n#import \"SDWeakProxy.h\"\n#if SD_MAC\n#import <CoreVideo/CoreVideo.h>\n#elif SD_IOS || SD_TV\n#import <QuartzCore/QuartzCore.h>\n#endif\n\n#if SD_MAC\nstatic CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext);\n#endif\n\n#define kSDDisplayLinkInterval 1.0 / 60\n\n@interface SDDisplayLink ()\n\n#if SD_MAC\n@property (nonatomic, assign) CVDisplayLinkRef displayLink;\n@property (nonatomic, assign) CVTimeStamp outputTime;\n@property (nonatomic, copy) NSRunLoopMode runloopMode;\n#elif SD_IOS || SD_TV\n@property (nonatomic, strong) CADisplayLink *displayLink;\n#else\n@property (nonatomic, strong) NSTimer *displayLink;\n@property (nonatomic, strong) NSRunLoop *runloop;\n@property (nonatomic, copy) NSRunLoopMode runloopMode;\n@property (nonatomic, assign) NSTimeInterval currentFireDate;\n#endif\n\n@end\n\n@implementation SDDisplayLink\n\n- (void)dealloc {\n#if SD_MAC\n    if (_displayLink) {\n        CVDisplayLinkRelease(_displayLink);\n        _displayLink = NULL;\n    }\n#elif SD_IOS || SD_TV\n    [_displayLink invalidate];\n    _displayLink = nil;\n#else\n    [_displayLink invalidate];\n    _displayLink = nil;\n#endif\n}\n\n- (instancetype)initWithTarget:(id)target selector:(SEL)sel {\n    self = [super init];\n    if (self) {\n        _target = target;\n        _selector = sel;\n#if SD_MAC\n        CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);\n        CVDisplayLinkSetOutputCallback(_displayLink, DisplayLinkCallback, (__bridge void *)self);\n#elif SD_IOS || SD_TV\n        SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self];\n        _displayLink = [CADisplayLink displayLinkWithTarget:weakProxy selector:@selector(displayLinkDidRefresh:)];\n#else\n        SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self];\n        _displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES];\n#endif\n    }\n    return self;\n}\n\n+ (instancetype)displayLinkWithTarget:(id)target selector:(SEL)sel {\n    SDDisplayLink *displayLink = [[SDDisplayLink alloc] initWithTarget:target selector:sel];\n    return displayLink;\n}\n\n- (CFTimeInterval)duration {\n#if SD_MAC\n    CVTimeStamp outputTime = self.outputTime;\n    NSTimeInterval duration = 0;\n    double periodPerSecond = (double)outputTime.videoTimeScale * outputTime.rateScalar;\n    if (periodPerSecond > 0) {\n        duration = (double)outputTime.videoRefreshPeriod / periodPerSecond;\n    }\n#elif SD_IOS || SD_TV\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n    NSTimeInterval duration = 0;\n    if (@available(iOS 10.0, tvOS 10.0, *)) {\n        duration = self.displayLink.targetTimestamp - CACurrentMediaTime();\n    } else {\n        duration = self.displayLink.duration * self.displayLink.frameInterval;\n    }\n#pragma clang diagnostic pop\n#else\n    NSTimeInterval duration = 0;\n    if (self.displayLink.isValid && self.currentFireDate != 0) {\n        NSTimeInterval nextFireDate = CFRunLoopTimerGetNextFireDate((__bridge CFRunLoopTimerRef)self.displayLink);\n        duration = nextFireDate - self.currentFireDate;\n    }\n#endif\n    if (duration <= 0) {\n        duration = kSDDisplayLinkInterval;\n    }\n    return duration;\n}\n\n- (BOOL)isRunning {\n#if SD_MAC\n    return CVDisplayLinkIsRunning(self.displayLink);\n#elif SD_IOS || SD_TV\n    return !self.displayLink.isPaused;\n#else\n    return self.displayLink.isValid;\n#endif\n}\n\n- (void)addToRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode {\n    if  (!runloop || !mode) {\n        return;\n    }\n#if SD_MAC\n    self.runloopMode = mode;\n#elif SD_IOS || SD_TV\n    [self.displayLink addToRunLoop:runloop forMode:mode];\n#else\n    self.runloop = runloop;\n    self.runloopMode = mode;\n    CFRunLoopMode cfMode;\n    if ([mode isEqualToString:NSDefaultRunLoopMode]) {\n        cfMode = kCFRunLoopDefaultMode;\n    } else if ([mode isEqualToString:NSRunLoopCommonModes]) {\n        cfMode = kCFRunLoopCommonModes;\n    } else {\n        cfMode = (__bridge CFStringRef)mode;\n    }\n    CFRunLoopAddTimer(runloop.getCFRunLoop, (__bridge CFRunLoopTimerRef)self.displayLink, cfMode);\n#endif\n}\n\n- (void)removeFromRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode {\n    if  (!runloop || !mode) {\n        return;\n    }\n#if SD_MAC\n    self.runloopMode = nil;\n#elif SD_IOS || SD_TV\n    [self.displayLink removeFromRunLoop:runloop forMode:mode];\n#else\n    self.runloop = nil;\n    self.runloopMode = nil;\n    CFRunLoopMode cfMode;\n    if ([mode isEqualToString:NSDefaultRunLoopMode]) {\n        cfMode = kCFRunLoopDefaultMode;\n    } else if ([mode isEqualToString:NSRunLoopCommonModes]) {\n        cfMode = kCFRunLoopCommonModes;\n    } else {\n        cfMode = (__bridge CFStringRef)mode;\n    }\n    CFRunLoopRemoveTimer(runloop.getCFRunLoop, (__bridge CFRunLoopTimerRef)self.displayLink, cfMode);\n#endif\n}\n\n- (void)start {\n#if SD_MAC\n    CVDisplayLinkStart(self.displayLink);\n#elif SD_IOS || SD_TV\n    self.displayLink.paused = NO;\n#else\n    if (self.displayLink.isValid) {\n        [self.displayLink fire];\n    } else {\n        SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self];\n        self.displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES];\n        [self addToRunLoop:self.runloop forMode:self.runloopMode];\n    }\n#endif\n}\n\n- (void)stop {\n#if SD_MAC\n    CVDisplayLinkStop(self.displayLink);\n#elif SD_IOS || SD_TV\n    self.displayLink.paused = YES;\n#else\n    [self.displayLink invalidate];\n#endif\n}\n\n- (void)displayLinkDidRefresh:(id)displayLink {\n#if SD_MAC\n    // CVDisplayLink does not use runloop, but we can provide similar behavior for modes\n    // May use `default` runloop to avoid extra callback when in `eventTracking` (mouse drag, scroll) or `modalPanel` (modal panel)\n    NSString *runloopMode = self.runloopMode;\n    if (![runloopMode isEqualToString:NSRunLoopCommonModes] && ![runloopMode isEqualToString:NSRunLoop.mainRunLoop.currentMode]) {\n        return;\n    }\n#endif\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Warc-performSelector-leaks\"\n    [_target performSelector:_selector withObject:self];\n#pragma clang diagnostic pop\n#if SD_WATCH\n    self.currentFireDate = CFRunLoopTimerGetNextFireDate((__bridge CFRunLoopTimerRef)self.displayLink);\n#endif\n}\n\n@end\n\n#if SD_MAC\nstatic CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext) {\n    // CVDisplayLink callback is not on main queue\n    SDDisplayLink *object = (__bridge SDDisplayLink *)displayLinkContext;\n    if (inOutputTime) {\n        object.outputTime = *inOutputTime;\n    }\n    __weak SDDisplayLink *weakObject = object;\n    dispatch_async(dispatch_get_main_queue(), ^{\n        [weakObject displayLinkDidRefresh:(__bridge id)(displayLink)];\n    });\n    return kCVReturnSuccess;\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h",
    "content": "//\n//  This file is from https://gist.github.com/zydeco/6292773\n//\n//  Created by Jesús A. Álvarez on 2008-12-17.\n//  Copyright 2008-2009 namedfork.net. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\n/// File Extended Attribute (xattr) helper methods\n@interface SDFileAttributeHelper : NSObject\n\n+ (nullable NSArray<NSString *> *)extendedAttributeNamesAtPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;\n+ (BOOL)hasExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;\n+ (nullable NSData *)extendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;\n+ (BOOL)setExtendedAttribute:(nonnull NSString *)name value:(nonnull NSData *)value atPath:(nonnull NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError * _Nullable * _Nullable)err;\n+ (BOOL)removeExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m",
    "content": "//\n//  This file is from https://gist.github.com/zydeco/6292773\n//\n//  Created by Jesús A. Álvarez on 2008-12-17.\n//  Copyright 2008-2009 namedfork.net. All rights reserved.\n//\n\n#import \"SDFileAttributeHelper.h\"\n#import <sys/xattr.h>\n\n@implementation SDFileAttributeHelper\n\n+ (NSArray*)extendedAttributeNamesAtPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err {\n    int flags = follow? 0 : XATTR_NOFOLLOW;\n    \n    // get size of name list\n    ssize_t nameBuffLen = listxattr([path fileSystemRepresentation], NULL, 0, flags);\n    if (nameBuffLen == -1) {\n        if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:\n                         @{\n                             @\"error\": [NSString stringWithUTF8String:strerror(errno)],\n                             @\"function\": @\"listxattr\",\n                             @\":path\": path,\n                             @\":traverseLink\": @(follow)\n                         }\n                         ];\n        return nil;\n    } else if (nameBuffLen == 0) return @[];\n    \n    // get name list\n    NSMutableData *nameBuff = [NSMutableData dataWithLength:nameBuffLen];\n    listxattr([path fileSystemRepresentation], [nameBuff mutableBytes], nameBuffLen, flags);\n    \n    // convert to array\n    NSMutableArray * names = [NSMutableArray arrayWithCapacity:5];\n    char *nextName, *endOfNames = [nameBuff mutableBytes] + nameBuffLen;\n    for(nextName = [nameBuff mutableBytes]; nextName < endOfNames; nextName += 1+strlen(nextName))\n        [names addObject:[NSString stringWithUTF8String:nextName]];\n    return names.copy;\n}\n\n+ (BOOL)hasExtendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err {\n    int flags = follow? 0 : XATTR_NOFOLLOW;\n    \n    // get size of name list\n    ssize_t nameBuffLen = listxattr([path fileSystemRepresentation], NULL, 0, flags);\n    if (nameBuffLen == -1) {\n        if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:\n                         @{\n                             @\"error\": [NSString stringWithUTF8String:strerror(errno)],\n                             @\"function\": @\"listxattr\",\n                             @\":path\": path,\n                             @\":traverseLink\": @(follow)\n                         }\n                         ];\n        return NO;\n    } else if (nameBuffLen == 0) return NO;\n    \n    // get name list\n    NSMutableData *nameBuff = [NSMutableData dataWithLength:nameBuffLen];\n    listxattr([path fileSystemRepresentation], [nameBuff mutableBytes], nameBuffLen, flags);\n    \n    // find our name\n    char *nextName, *endOfNames = [nameBuff mutableBytes] + nameBuffLen;\n    for(nextName = [nameBuff mutableBytes]; nextName < endOfNames; nextName += 1+strlen(nextName))\n        if (strcmp(nextName, [name UTF8String]) == 0) return YES;\n    return NO;\n}\n\n+ (NSData *)extendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err {\n    int flags = follow? 0 : XATTR_NOFOLLOW;\n    // get length\n    ssize_t attrLen = getxattr([path fileSystemRepresentation], [name UTF8String], NULL, 0, 0, flags);\n    if (attrLen == -1) {\n        if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:\n                         @{\n                             @\"error\": [NSString stringWithUTF8String:strerror(errno)],\n                             @\"function\": @\"getxattr\",\n                             @\":name\": name,\n                             @\":path\": path,\n                             @\":traverseLink\": @(follow)\n                         }\n                         ];\n        return nil;\n    }\n    \n    // get attribute data\n    NSMutableData *attrData = [NSMutableData dataWithLength:attrLen];\n    getxattr([path fileSystemRepresentation], [name UTF8String], [attrData mutableBytes], attrLen, 0, flags);\n    return attrData;\n}\n\n+ (BOOL)setExtendedAttribute:(NSString *)name value:(NSData *)value atPath:(NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError **)err {\n    int flags = (follow? 0 : XATTR_NOFOLLOW) | (overwrite? 0 : XATTR_CREATE);\n    if (0 == setxattr([path fileSystemRepresentation], [name UTF8String], [value bytes], [value length], 0, flags)) return YES;\n    // error\n    if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:\n                     @{\n                         @\"error\": [NSString stringWithUTF8String:strerror(errno)],\n                         @\"function\": @\"setxattr\",\n                         @\":name\": name,\n                         @\":value.length\": @(value.length),\n                         @\":path\": path,\n                         @\":traverseLink\": @(follow),\n                         @\":overwrite\": @(overwrite)\n                     }\n                     ];\n    return NO;\n}\n\n+ (BOOL)removeExtendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err {\n    int flags = (follow? 0 : XATTR_NOFOLLOW);\n    if (0 == removexattr([path fileSystemRepresentation], [name UTF8String], flags)) return YES;\n    // error\n    if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:\n                     @{\n                         @\"error\": [NSString stringWithUTF8String:strerror(errno)],\n                         @\"function\": @\"removexattr\",\n                         @\":name\": name,\n                         @\":path\": path,\n                         @\":traverseLink\": @(follow)\n                     }\n                     ];\n    return NO;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/// A Image-Asset manager to work like UIKit/AppKit's image cache behavior\n/// Apple parse the Asset Catalog compiled file(`Assets.car`) by CoreUI.framework, however it's a private framework and there are no other ways to directly get the data. So we just process the normal bundle files :)\n@interface SDImageAssetManager : NSObject\n\n@property (nonatomic, strong, nonnull) NSMapTable<NSString *, UIImage *> *imageTable;\n\n+ (nonnull instancetype)sharedAssetManager;\n- (nullable NSString *)getPathForName:(nonnull NSString *)name bundle:(nonnull NSBundle *)bundle preferredScale:(nonnull CGFloat *)scale;\n- (nullable UIImage *)imageForName:(nonnull NSString *)name;\n- (void)storeImage:(nonnull UIImage *)image forName:(nonnull NSString *)name;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageAssetManager.h\"\n#import \"SDInternalMacros.h\"\n\nstatic NSArray *SDBundlePreferredScales() {\n    static NSArray *scales;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n#if SD_WATCH\n        CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale;\n#elif SD_UIKIT\n        CGFloat screenScale = [UIScreen mainScreen].scale;\n#elif SD_MAC\n        CGFloat screenScale = [NSScreen mainScreen].backingScaleFactor;\n#endif\n        if (screenScale <= 1) {\n            scales = @[@1,@2,@3];\n        } else if (screenScale <= 2) {\n            scales = @[@2,@3,@1];\n        } else {\n            scales = @[@3,@2,@1];\n        }\n    });\n    return scales;\n}\n\n@implementation SDImageAssetManager {\n    SD_LOCK_DECLARE(_lock);\n}\n\n+ (instancetype)sharedAssetManager {\n    static dispatch_once_t onceToken;\n    static SDImageAssetManager *assetManager;\n    dispatch_once(&onceToken, ^{\n        assetManager = [[SDImageAssetManager alloc] init];\n    });\n    return assetManager;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        NSPointerFunctionsOptions valueOptions;\n#if SD_MAC\n        // Apple says that NSImage use a weak reference to value\n        valueOptions = NSPointerFunctionsWeakMemory;\n#else\n        // Apple says that UIImage use a strong reference to value\n        valueOptions = NSPointerFunctionsStrongMemory;\n#endif\n        _imageTable = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsCopyIn valueOptions:valueOptions];\n        SD_LOCK_INIT(_lock);\n#if SD_UIKIT\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n    }\n    return self;\n}\n\n- (void)dealloc {\n#if SD_UIKIT\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n#endif\n}\n\n- (void)didReceiveMemoryWarning:(NSNotification *)notification {\n    SD_LOCK(_lock);\n    [self.imageTable removeAllObjects];\n    SD_UNLOCK(_lock);\n}\n\n- (NSString *)getPathForName:(NSString *)name bundle:(NSBundle *)bundle preferredScale:(CGFloat *)scale {\n    NSParameterAssert(name);\n    NSParameterAssert(bundle);\n    NSString *path;\n    if (name.length == 0) {\n        return path;\n    }\n    if ([name hasSuffix:@\"/\"]) {\n        return path;\n    }\n    NSString *extension = name.pathExtension;\n    if (extension.length == 0) {\n        // If no extension, follow Apple's doc, check PNG format\n        extension = @\"png\";\n    }\n    name = [name stringByDeletingPathExtension];\n    \n    CGFloat providedScale = *scale;\n    NSArray *scales = SDBundlePreferredScales();\n    \n    // Check if file name contains scale\n    for (size_t i = 0; i < scales.count; i++) {\n        NSNumber *scaleValue = scales[i];\n        if ([name hasSuffix:[NSString stringWithFormat:@\"@%@x\", scaleValue]]) {\n            path = [bundle pathForResource:name ofType:extension];\n            if (path) {\n                *scale = scaleValue.doubleValue; // override\n                return path;\n            }\n        }\n    }\n    \n    // Search with provided scale first\n    if (providedScale != 0) {\n        NSString *scaledName = [name stringByAppendingFormat:@\"@%@x\", @(providedScale)];\n        path = [bundle pathForResource:scaledName ofType:extension];\n        if (path) {\n            return path;\n        }\n    }\n    \n    // Search with preferred scale\n    for (size_t i = 0; i < scales.count; i++) {\n        NSNumber *scaleValue = scales[i];\n        if (scaleValue.doubleValue == providedScale) {\n            // Ignore provided scale\n            continue;\n        }\n        NSString *scaledName = [name stringByAppendingFormat:@\"@%@x\", scaleValue];\n        path = [bundle pathForResource:scaledName ofType:extension];\n        if (path) {\n            *scale = scaleValue.doubleValue; // override\n            return path;\n        }\n    }\n    \n    // Search without scale\n    path = [bundle pathForResource:name ofType:extension];\n    \n    return path;\n}\n\n- (UIImage *)imageForName:(NSString *)name {\n    NSParameterAssert(name);\n    UIImage *image;\n    SD_LOCK(_lock);\n    image = [self.imageTable objectForKey:name];\n    SD_UNLOCK(_lock);\n    return image;\n}\n\n- (void)storeImage:(UIImage *)image forName:(NSString *)name {\n    NSParameterAssert(image);\n    NSParameterAssert(name);\n    SD_LOCK(_lock);\n    [self.imageTable setObject:image forKey:name];\n    SD_UNLOCK(_lock);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/// This is used for operation management, but not for operation queue execute\n@interface SDImageCachesManagerOperation : NSOperation\n\n@property (nonatomic, assign, readonly) NSUInteger pendingCount;\n\n- (void)beginWithTotalCount:(NSUInteger)totalCount;\n- (void)completeOne;\n- (void)done;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDImageCachesManagerOperation.h\"\n#import \"SDInternalMacros.h\"\n\n@implementation SDImageCachesManagerOperation {\n    SD_LOCK_DECLARE(_pendingCountLock);\n}\n\n@synthesize executing = _executing;\n@synthesize finished = _finished;\n@synthesize cancelled = _cancelled;\n@synthesize pendingCount = _pendingCount;\n\n- (instancetype)init {\n    if (self = [super init]) {\n        SD_LOCK_INIT(_pendingCountLock);\n        _pendingCount = 0;\n    }\n    return self;\n}\n\n- (void)beginWithTotalCount:(NSUInteger)totalCount {\n    self.executing = YES;\n    self.finished = NO;\n    _pendingCount = totalCount;\n}\n\n- (NSUInteger)pendingCount {\n    SD_LOCK(_pendingCountLock);\n    NSUInteger pendingCount = _pendingCount;\n    SD_UNLOCK(_pendingCountLock);\n    return pendingCount;\n}\n\n- (void)completeOne {\n    SD_LOCK(_pendingCountLock);\n    _pendingCount = _pendingCount > 0 ? _pendingCount - 1 : 0;\n    SD_UNLOCK(_pendingCountLock);\n}\n\n- (void)cancel {\n    self.cancelled = YES;\n    [self reset];\n}\n\n- (void)done {\n    self.finished = YES;\n    self.executing = NO;\n    [self reset];\n}\n\n- (void)reset {\n    SD_LOCK(_pendingCountLock);\n    _pendingCount = 0;\n    SD_UNLOCK(_pendingCountLock);\n}\n\n- (void)setFinished:(BOOL)finished {\n    [self willChangeValueForKey:@\"isFinished\"];\n    _finished = finished;\n    [self didChangeValueForKey:@\"isFinished\"];\n}\n\n- (void)setExecuting:(BOOL)executing {\n    [self willChangeValueForKey:@\"isExecuting\"];\n    _executing = executing;\n    [self didChangeValueForKey:@\"isExecuting\"];\n}\n\n- (void)setCancelled:(BOOL)cancelled {\n    [self willChangeValueForKey:@\"isCancelled\"];\n    _cancelled = cancelled;\n    [self didChangeValueForKey:@\"isCancelled\"];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import <Foundation/Foundation.h>\n#import \"SDImageIOAnimatedCoder.h\"\n\n// AVFileTypeHEIC/AVFileTypeHEIF is defined in AVFoundation via iOS 11, we use this without import AVFoundation\n#define kSDUTTypeHEIC  ((__bridge CFStringRef)@\"public.heic\")\n#define kSDUTTypeHEIF  ((__bridge CFStringRef)@\"public.heif\")\n// HEIC Sequence (Animated Image)\n#define kSDUTTypeHEICS ((__bridge CFStringRef)@\"public.heics\")\n// kSDUTTypeWebP seems not defined in public UTI framework, Apple use the hardcode string, we define them :)\n#define kSDUTTypeWebP  ((__bridge CFStringRef)@\"org.webmproject.webp\")\n\n#define kSDUTTypeImage ((__bridge CFStringRef)@\"public.image\")\n#define kSDUTTypeJPEG  ((__bridge CFStringRef)@\"public.jpeg\")\n#define kSDUTTypePNG   ((__bridge CFStringRef)@\"public.png\")\n#define kSDUTTypeTIFF  ((__bridge CFStringRef)@\"public.tiff\")\n#define kSDUTTypeSVG   ((__bridge CFStringRef)@\"public.svg-image\")\n#define kSDUTTypeGIF   ((__bridge CFStringRef)@\"com.compuserve.gif\")\n#define kSDUTTypePDF   ((__bridge CFStringRef)@\"com.adobe.pdf\")\n\n@interface SDImageIOAnimatedCoder ()\n\n+ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source;\n+ (NSUInteger)imageLoopCountWithSource:(nonnull CGImageSourceRef)source;\n+ (nullable UIImage *)createFrameAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize options:(nullable NSDictionary *)options;\n+ (BOOL)canEncodeToFormat:(SDImageFormat)format;\n+ (BOOL)canDecodeFromFormat:(SDImageFormat)format;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import <os/lock.h>\n#import <libkern/OSAtomic.h>\n#import \"SDmetamacros.h\"\n\n#define SD_USE_OS_UNFAIR_LOCK TARGET_OS_MACCATALYST ||\\\n    (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0) ||\\\n    (__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12) ||\\\n    (__TV_OS_VERSION_MIN_REQUIRED >= __TVOS_10_0) ||\\\n    (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0)\n\n#ifndef SD_LOCK_DECLARE\n#if SD_USE_OS_UNFAIR_LOCK\n#define SD_LOCK_DECLARE(lock) os_unfair_lock lock\n#else\n#define SD_LOCK_DECLARE(lock) os_unfair_lock lock API_AVAILABLE(ios(10.0), tvos(10), watchos(3), macos(10.12)); \\\nOSSpinLock lock##_deprecated;\n#endif\n#endif\n\n#ifndef SD_LOCK_DECLARE_STATIC\n#if SD_USE_OS_UNFAIR_LOCK\n#define SD_LOCK_DECLARE_STATIC(lock) static os_unfair_lock lock\n#else\n#define SD_LOCK_DECLARE_STATIC(lock) static os_unfair_lock lock API_AVAILABLE(ios(10.0), tvos(10), watchos(3), macos(10.12)); \\\nstatic OSSpinLock lock##_deprecated;\n#endif\n#endif\n\n#ifndef SD_LOCK_INIT\n#if SD_USE_OS_UNFAIR_LOCK\n#define SD_LOCK_INIT(lock) lock = OS_UNFAIR_LOCK_INIT\n#else\n#define SD_LOCK_INIT(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) lock = OS_UNFAIR_LOCK_INIT; \\\nelse lock##_deprecated = OS_SPINLOCK_INIT;\n#endif\n#endif\n\n#ifndef SD_LOCK\n#if SD_USE_OS_UNFAIR_LOCK\n#define SD_LOCK(lock) os_unfair_lock_lock(&lock)\n#else\n#define SD_LOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_lock(&lock); \\\nelse OSSpinLockLock(&lock##_deprecated);\n#endif\n#endif\n\n#ifndef SD_UNLOCK\n#if SD_USE_OS_UNFAIR_LOCK\n#define SD_UNLOCK(lock) os_unfair_lock_unlock(&lock)\n#else\n#define SD_UNLOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_unlock(&lock); \\\nelse OSSpinLockUnlock(&lock##_deprecated);\n#endif\n#endif\n\n#ifndef SD_OPTIONS_CONTAINS\n#define SD_OPTIONS_CONTAINS(options, value) (((options) & (value)) == (value))\n#endif\n\n#ifndef SD_CSTRING\n#define SD_CSTRING(str) #str\n#endif\n\n#ifndef SD_NSSTRING\n#define SD_NSSTRING(str) @(SD_CSTRING(str))\n#endif\n\n#ifndef SD_SEL_SPI\n#define SD_SEL_SPI(name) NSSelectorFromString([NSString stringWithFormat:@\"_%@\", SD_NSSTRING(name)])\n#endif\n\n#ifndef weakify\n#define weakify(...) \\\nsd_keywordify \\\nmetamacro_foreach_cxt(sd_weakify_,, __weak, __VA_ARGS__)\n#endif\n\n#ifndef strongify\n#define strongify(...) \\\nsd_keywordify \\\n_Pragma(\"clang diagnostic push\") \\\n_Pragma(\"clang diagnostic ignored \\\"-Wshadow\\\"\") \\\nmetamacro_foreach(sd_strongify_,, __VA_ARGS__) \\\n_Pragma(\"clang diagnostic pop\")\n#endif\n\n#define sd_weakify_(INDEX, CONTEXT, VAR) \\\nCONTEXT __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR);\n\n#define sd_strongify_(INDEX, VAR) \\\n__strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_);\n\n#if DEBUG\n#define sd_keywordify autoreleasepool {}\n#else\n#define sd_keywordify try {} @catch (...) {}\n#endif\n\n#ifndef onExit\n#define onExit \\\nsd_keywordify \\\n__strong sd_cleanupBlock_t metamacro_concat(sd_exitBlock_, __LINE__) __attribute__((cleanup(sd_executeCleanupBlock), unused)) = ^\n#endif\n\ntypedef void (^sd_cleanupBlock_t)(void);\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\n    void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block);\n#if defined(__cplusplus)\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDInternalMacros.h\"\n\nvoid sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block) {\n    (*block)();\n}\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <Foundation/Foundation.h>\n#import \"SDWebImageCompat.h\"\n\n/// A weak proxy which forward all the message to the target\n@interface SDWeakProxy : NSProxy\n\n@property (nonatomic, weak, readonly, nullable) id target;\n\n- (nonnull instancetype)initWithTarget:(nonnull id)target;\n+ (nonnull instancetype)proxyWithTarget:(nonnull id)target;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWeakProxy.h\"\n\n@implementation SDWeakProxy\n\n- (instancetype)initWithTarget:(id)target {\n    _target = target;\n    return self;\n}\n\n+ (instancetype)proxyWithTarget:(id)target {\n    return [[SDWeakProxy alloc] initWithTarget:target];\n}\n\n- (id)forwardingTargetForSelector:(SEL)selector {\n    return _target;\n}\n\n- (void)forwardInvocation:(NSInvocation *)invocation {\n    void *null = NULL;\n    [invocation setReturnValue:&null];\n}\n\n- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {\n    return [NSObject instanceMethodSignatureForSelector:@selector(init)];\n}\n\n- (BOOL)respondsToSelector:(SEL)aSelector {\n    return [_target respondsToSelector:aSelector];\n}\n\n- (BOOL)isEqual:(id)object {\n    return [_target isEqual:object];\n}\n\n- (NSUInteger)hash {\n    return [_target hash];\n}\n\n- (Class)superclass {\n    return [_target superclass];\n}\n\n- (Class)class {\n    return [_target class];\n}\n\n- (BOOL)isKindOfClass:(Class)aClass {\n    return [_target isKindOfClass:aClass];\n}\n\n- (BOOL)isMemberOfClass:(Class)aClass {\n    return [_target isMemberOfClass:aClass];\n}\n\n- (BOOL)conformsToProtocol:(Protocol *)aProtocol {\n    return [_target conformsToProtocol:aProtocol];\n}\n\n- (BOOL)isProxy {\n    return YES;\n}\n\n- (NSString *)description {\n    return [_target description];\n}\n\n- (NSString *)debugDescription {\n    return [_target debugDescription];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h",
    "content": "/*\n* This file is part of the SDWebImage package.\n* (c) Olivier Poitrey <rs@dailymotion.com>\n*\n* For the full copyright and license information, please view the LICENSE\n* file that was distributed with this source code.\n*/\n\n#import \"SDWebImageCompat.h\"\n\n#if SD_MAC\n\n#import <QuartzCore/QuartzCore.h>\n\n/// Helper method for Core Animation transition\nFOUNDATION_EXPORT CAMediaTimingFunction * _Nullable SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options);\nFOUNDATION_EXPORT CATransition * _Nullable SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options);\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h",
    "content": "/**\n * Macros for metaprogramming\n * ExtendedC\n *\n * Copyright (C) 2012 Justin Spahr-Summers\n * Released under the MIT license\n */\n\n#ifndef EXTC_METAMACROS_H\n#define EXTC_METAMACROS_H\n\n\n/**\n * Executes one or more expressions (which may have a void type, such as a call\n * to a function that returns no value) and always returns true.\n */\n#define metamacro_exprify(...) \\\n    ((__VA_ARGS__), true)\n\n/**\n * Returns a string representation of VALUE after full macro expansion.\n */\n#define metamacro_stringify(VALUE) \\\n        metamacro_stringify_(VALUE)\n\n/**\n * Returns A and B concatenated after full macro expansion.\n */\n#define metamacro_concat(A, B) \\\n        metamacro_concat_(A, B)\n\n/**\n * Returns the Nth variadic argument (starting from zero). At least\n * N + 1 variadic arguments must be given. N must be between zero and twenty,\n * inclusive.\n */\n#define metamacro_at(N, ...) \\\n        metamacro_concat(metamacro_at, N)(__VA_ARGS__)\n\n/**\n * Returns the number of arguments (up to twenty) provided to the macro. At\n * least one argument must be provided.\n *\n * Inspired by P99: http://p99.gforge.inria.fr\n */\n#define metamacro_argcount(...) \\\n        metamacro_at(20, __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)\n\n/**\n * Identical to #metamacro_foreach_cxt, except that no CONTEXT argument is\n * given. Only the index and current argument will thus be passed to MACRO.\n */\n#define metamacro_foreach(MACRO, SEP, ...) \\\n        metamacro_foreach_cxt(metamacro_foreach_iter, SEP, MACRO, __VA_ARGS__)\n\n/**\n * For each consecutive variadic argument (up to twenty), MACRO is passed the\n * zero-based index of the current argument, CONTEXT, and then the argument\n * itself. The results of adjoining invocations of MACRO are then separated by\n * SEP.\n *\n * Inspired by P99: http://p99.gforge.inria.fr\n */\n#define metamacro_foreach_cxt(MACRO, SEP, CONTEXT, ...) \\\n        metamacro_concat(metamacro_foreach_cxt, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__)\n\n/**\n * Identical to #metamacro_foreach_cxt. This can be used when the former would\n * fail due to recursive macro expansion.\n */\n#define metamacro_foreach_cxt_recursive(MACRO, SEP, CONTEXT, ...) \\\n        metamacro_concat(metamacro_foreach_cxt_recursive, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__)\n\n/**\n * In consecutive order, appends each variadic argument (up to twenty) onto\n * BASE. The resulting concatenations are then separated by SEP.\n *\n * This is primarily useful to manipulate a list of macro invocations into instead\n * invoking a different, possibly related macro.\n */\n#define metamacro_foreach_concat(BASE, SEP, ...) \\\n        metamacro_foreach_cxt(metamacro_foreach_concat_iter, SEP, BASE, __VA_ARGS__)\n\n/**\n * Iterates COUNT times, each time invoking MACRO with the current index\n * (starting at zero) and CONTEXT. The results of adjoining invocations of MACRO\n * are then separated by SEP.\n *\n * COUNT must be an integer between zero and twenty, inclusive.\n */\n#define metamacro_for_cxt(COUNT, MACRO, SEP, CONTEXT) \\\n        metamacro_concat(metamacro_for_cxt, COUNT)(MACRO, SEP, CONTEXT)\n\n/**\n * Returns the first argument given. At least one argument must be provided.\n *\n * This is useful when implementing a variadic macro, where you may have only\n * one variadic argument, but no way to retrieve it (for example, because \\c ...\n * always needs to match at least one argument).\n *\n * @code\n\n#define varmacro(...) \\\n    metamacro_head(__VA_ARGS__)\n\n * @endcode\n */\n#define metamacro_head(...) \\\n        metamacro_head_(__VA_ARGS__, 0)\n\n/**\n * Returns every argument except the first. At least two arguments must be\n * provided.\n */\n#define metamacro_tail(...) \\\n        metamacro_tail_(__VA_ARGS__)\n\n/**\n * Returns the first N (up to twenty) variadic arguments as a new argument list.\n * At least N variadic arguments must be provided.\n */\n#define metamacro_take(N, ...) \\\n        metamacro_concat(metamacro_take, N)(__VA_ARGS__)\n\n/**\n * Removes the first N (up to twenty) variadic arguments from the given argument\n * list. At least N variadic arguments must be provided.\n */\n#define metamacro_drop(N, ...) \\\n        metamacro_concat(metamacro_drop, N)(__VA_ARGS__)\n\n/**\n * Decrements VAL, which must be a number between zero and twenty, inclusive.\n *\n * This is primarily useful when dealing with indexes and counts in\n * metaprogramming.\n */\n#define metamacro_dec(VAL) \\\n        metamacro_at(VAL, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)\n\n/**\n * Increments VAL, which must be a number between zero and twenty, inclusive.\n *\n * This is primarily useful when dealing with indexes and counts in\n * metaprogramming.\n */\n#define metamacro_inc(VAL) \\\n        metamacro_at(VAL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)\n\n/**\n * If A is equal to B, the next argument list is expanded; otherwise, the\n * argument list after that is expanded. A and B must be numbers between zero\n * and twenty, inclusive. Additionally, B must be greater than or equal to A.\n *\n * @code\n\n// expands to true\nmetamacro_if_eq(0, 0)(true)(false)\n\n// expands to false\nmetamacro_if_eq(0, 1)(true)(false)\n\n * @endcode\n *\n * This is primarily useful when dealing with indexes and counts in\n * metaprogramming.\n */\n#define metamacro_if_eq(A, B) \\\n        metamacro_concat(metamacro_if_eq, A)(B)\n\n/**\n * Identical to #metamacro_if_eq. This can be used when the former would fail\n * due to recursive macro expansion.\n */\n#define metamacro_if_eq_recursive(A, B) \\\n        metamacro_concat(metamacro_if_eq_recursive, A)(B)\n\n/**\n * Returns 1 if N is an even number, or 0 otherwise. N must be between zero and\n * twenty, inclusive.\n *\n * For the purposes of this test, zero is considered even.\n */\n#define metamacro_is_even(N) \\\n        metamacro_at(N, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)\n\n/**\n * Returns the logical NOT of B, which must be the number zero or one.\n */\n#define metamacro_not(B) \\\n        metamacro_at(B, 1, 0)\n\n// IMPLEMENTATION DETAILS FOLLOW!\n// Do not write code that depends on anything below this line.\n#define metamacro_stringify_(VALUE) # VALUE\n#define metamacro_concat_(A, B) A ## B\n#define metamacro_foreach_iter(INDEX, MACRO, ARG) MACRO(INDEX, ARG)\n#define metamacro_head_(FIRST, ...) FIRST\n#define metamacro_tail_(FIRST, ...) __VA_ARGS__\n#define metamacro_consume_(...)\n#define metamacro_expand_(...) __VA_ARGS__\n\n// implemented from scratch so that metamacro_concat() doesn't end up nesting\n#define metamacro_foreach_concat_iter(INDEX, BASE, ARG) metamacro_foreach_concat_iter_(BASE, ARG)\n#define metamacro_foreach_concat_iter_(BASE, ARG) BASE ## ARG\n\n// metamacro_at expansions\n#define metamacro_at0(...) metamacro_head(__VA_ARGS__)\n#define metamacro_at1(_0, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at2(_0, _1, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at3(_0, _1, _2, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at4(_0, _1, _2, _3, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at5(_0, _1, _2, _3, _4, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at6(_0, _1, _2, _3, _4, _5, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at7(_0, _1, _2, _3, _4, _5, _6, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at8(_0, _1, _2, _3, _4, _5, _6, _7, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) metamacro_head(__VA_ARGS__)\n#define metamacro_at20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) metamacro_head(__VA_ARGS__)\n\n// metamacro_foreach_cxt expansions\n#define metamacro_foreach_cxt0(MACRO, SEP, CONTEXT)\n#define metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0)\n\n#define metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \\\n    metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) \\\n    SEP \\\n    MACRO(1, CONTEXT, _1)\n\n#define metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \\\n    metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \\\n    SEP \\\n    MACRO(2, CONTEXT, _2)\n\n#define metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \\\n    metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \\\n    SEP \\\n    MACRO(3, CONTEXT, _3)\n\n#define metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \\\n    metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \\\n    SEP \\\n    MACRO(4, CONTEXT, _4)\n\n#define metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \\\n    metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \\\n    SEP \\\n    MACRO(5, CONTEXT, _5)\n\n#define metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \\\n    metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \\\n    SEP \\\n    MACRO(6, CONTEXT, _6)\n\n#define metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \\\n    metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \\\n    SEP \\\n    MACRO(7, CONTEXT, _7)\n\n#define metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \\\n    metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \\\n    SEP \\\n    MACRO(8, CONTEXT, _8)\n\n#define metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \\\n    metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \\\n    SEP \\\n    MACRO(9, CONTEXT, _9)\n\n#define metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \\\n    metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \\\n    SEP \\\n    MACRO(10, CONTEXT, _10)\n\n#define metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \\\n    metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \\\n    SEP \\\n    MACRO(11, CONTEXT, _11)\n\n#define metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \\\n    metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \\\n    SEP \\\n    MACRO(12, CONTEXT, _12)\n\n#define metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \\\n    metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \\\n    SEP \\\n    MACRO(13, CONTEXT, _13)\n\n#define metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \\\n    metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \\\n    SEP \\\n    MACRO(14, CONTEXT, _14)\n\n#define metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \\\n    metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \\\n    SEP \\\n    MACRO(15, CONTEXT, _15)\n\n#define metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \\\n    metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \\\n    SEP \\\n    MACRO(16, CONTEXT, _16)\n\n#define metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \\\n    metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \\\n    SEP \\\n    MACRO(17, CONTEXT, _17)\n\n#define metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \\\n    metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \\\n    SEP \\\n    MACRO(18, CONTEXT, _18)\n\n#define metamacro_foreach_cxt20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \\\n    metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \\\n    SEP \\\n    MACRO(19, CONTEXT, _19)\n\n// metamacro_foreach_cxt_recursive expansions\n#define metamacro_foreach_cxt_recursive0(MACRO, SEP, CONTEXT)\n#define metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0)\n\n#define metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \\\n    metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) \\\n    SEP \\\n    MACRO(1, CONTEXT, _1)\n\n#define metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \\\n    metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \\\n    SEP \\\n    MACRO(2, CONTEXT, _2)\n\n#define metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \\\n    metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \\\n    SEP \\\n    MACRO(3, CONTEXT, _3)\n\n#define metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \\\n    metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \\\n    SEP \\\n    MACRO(4, CONTEXT, _4)\n\n#define metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \\\n    metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \\\n    SEP \\\n    MACRO(5, CONTEXT, _5)\n\n#define metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \\\n    metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \\\n    SEP \\\n    MACRO(6, CONTEXT, _6)\n\n#define metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \\\n    metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \\\n    SEP \\\n    MACRO(7, CONTEXT, _7)\n\n#define metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \\\n    metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \\\n    SEP \\\n    MACRO(8, CONTEXT, _8)\n\n#define metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \\\n    metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \\\n    SEP \\\n    MACRO(9, CONTEXT, _9)\n\n#define metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \\\n    metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \\\n    SEP \\\n    MACRO(10, CONTEXT, _10)\n\n#define metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \\\n    metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \\\n    SEP \\\n    MACRO(11, CONTEXT, _11)\n\n#define metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \\\n    metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \\\n    SEP \\\n    MACRO(12, CONTEXT, _12)\n\n#define metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \\\n    metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \\\n    SEP \\\n    MACRO(13, CONTEXT, _13)\n\n#define metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \\\n    metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \\\n    SEP \\\n    MACRO(14, CONTEXT, _14)\n\n#define metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \\\n    metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \\\n    SEP \\\n    MACRO(15, CONTEXT, _15)\n\n#define metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \\\n    metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \\\n    SEP \\\n    MACRO(16, CONTEXT, _16)\n\n#define metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \\\n    metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \\\n    SEP \\\n    MACRO(17, CONTEXT, _17)\n\n#define metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \\\n    metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \\\n    SEP \\\n    MACRO(18, CONTEXT, _18)\n\n#define metamacro_foreach_cxt_recursive20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \\\n    metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \\\n    SEP \\\n    MACRO(19, CONTEXT, _19)\n\n// metamacro_for_cxt expansions\n#define metamacro_for_cxt0(MACRO, SEP, CONTEXT)\n#define metamacro_for_cxt1(MACRO, SEP, CONTEXT) MACRO(0, CONTEXT)\n\n#define metamacro_for_cxt2(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt1(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(1, CONTEXT)\n\n#define metamacro_for_cxt3(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt2(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(2, CONTEXT)\n\n#define metamacro_for_cxt4(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt3(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(3, CONTEXT)\n\n#define metamacro_for_cxt5(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt4(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(4, CONTEXT)\n\n#define metamacro_for_cxt6(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt5(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(5, CONTEXT)\n\n#define metamacro_for_cxt7(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt6(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(6, CONTEXT)\n\n#define metamacro_for_cxt8(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt7(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(7, CONTEXT)\n\n#define metamacro_for_cxt9(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt8(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(8, CONTEXT)\n\n#define metamacro_for_cxt10(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt9(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(9, CONTEXT)\n\n#define metamacro_for_cxt11(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt10(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(10, CONTEXT)\n\n#define metamacro_for_cxt12(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt11(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(11, CONTEXT)\n\n#define metamacro_for_cxt13(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt12(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(12, CONTEXT)\n\n#define metamacro_for_cxt14(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt13(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(13, CONTEXT)\n\n#define metamacro_for_cxt15(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt14(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(14, CONTEXT)\n\n#define metamacro_for_cxt16(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt15(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(15, CONTEXT)\n\n#define metamacro_for_cxt17(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt16(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(16, CONTEXT)\n\n#define metamacro_for_cxt18(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt17(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(17, CONTEXT)\n\n#define metamacro_for_cxt19(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt18(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(18, CONTEXT)\n\n#define metamacro_for_cxt20(MACRO, SEP, CONTEXT) \\\n    metamacro_for_cxt19(MACRO, SEP, CONTEXT) \\\n    SEP \\\n    MACRO(19, CONTEXT)\n\n// metamacro_if_eq expansions\n#define metamacro_if_eq0(VALUE) \\\n    metamacro_concat(metamacro_if_eq0_, VALUE)\n\n#define metamacro_if_eq0_0(...) __VA_ARGS__ metamacro_consume_\n#define metamacro_if_eq0_1(...) metamacro_expand_\n#define metamacro_if_eq0_2(...) metamacro_expand_\n#define metamacro_if_eq0_3(...) metamacro_expand_\n#define metamacro_if_eq0_4(...) metamacro_expand_\n#define metamacro_if_eq0_5(...) metamacro_expand_\n#define metamacro_if_eq0_6(...) metamacro_expand_\n#define metamacro_if_eq0_7(...) metamacro_expand_\n#define metamacro_if_eq0_8(...) metamacro_expand_\n#define metamacro_if_eq0_9(...) metamacro_expand_\n#define metamacro_if_eq0_10(...) metamacro_expand_\n#define metamacro_if_eq0_11(...) metamacro_expand_\n#define metamacro_if_eq0_12(...) metamacro_expand_\n#define metamacro_if_eq0_13(...) metamacro_expand_\n#define metamacro_if_eq0_14(...) metamacro_expand_\n#define metamacro_if_eq0_15(...) metamacro_expand_\n#define metamacro_if_eq0_16(...) metamacro_expand_\n#define metamacro_if_eq0_17(...) metamacro_expand_\n#define metamacro_if_eq0_18(...) metamacro_expand_\n#define metamacro_if_eq0_19(...) metamacro_expand_\n#define metamacro_if_eq0_20(...) metamacro_expand_\n\n#define metamacro_if_eq1(VALUE) metamacro_if_eq0(metamacro_dec(VALUE))\n#define metamacro_if_eq2(VALUE) metamacro_if_eq1(metamacro_dec(VALUE))\n#define metamacro_if_eq3(VALUE) metamacro_if_eq2(metamacro_dec(VALUE))\n#define metamacro_if_eq4(VALUE) metamacro_if_eq3(metamacro_dec(VALUE))\n#define metamacro_if_eq5(VALUE) metamacro_if_eq4(metamacro_dec(VALUE))\n#define metamacro_if_eq6(VALUE) metamacro_if_eq5(metamacro_dec(VALUE))\n#define metamacro_if_eq7(VALUE) metamacro_if_eq6(metamacro_dec(VALUE))\n#define metamacro_if_eq8(VALUE) metamacro_if_eq7(metamacro_dec(VALUE))\n#define metamacro_if_eq9(VALUE) metamacro_if_eq8(metamacro_dec(VALUE))\n#define metamacro_if_eq10(VALUE) metamacro_if_eq9(metamacro_dec(VALUE))\n#define metamacro_if_eq11(VALUE) metamacro_if_eq10(metamacro_dec(VALUE))\n#define metamacro_if_eq12(VALUE) metamacro_if_eq11(metamacro_dec(VALUE))\n#define metamacro_if_eq13(VALUE) metamacro_if_eq12(metamacro_dec(VALUE))\n#define metamacro_if_eq14(VALUE) metamacro_if_eq13(metamacro_dec(VALUE))\n#define metamacro_if_eq15(VALUE) metamacro_if_eq14(metamacro_dec(VALUE))\n#define metamacro_if_eq16(VALUE) metamacro_if_eq15(metamacro_dec(VALUE))\n#define metamacro_if_eq17(VALUE) metamacro_if_eq16(metamacro_dec(VALUE))\n#define metamacro_if_eq18(VALUE) metamacro_if_eq17(metamacro_dec(VALUE))\n#define metamacro_if_eq19(VALUE) metamacro_if_eq18(metamacro_dec(VALUE))\n#define metamacro_if_eq20(VALUE) metamacro_if_eq19(metamacro_dec(VALUE))\n\n// metamacro_if_eq_recursive expansions\n#define metamacro_if_eq_recursive0(VALUE) \\\n    metamacro_concat(metamacro_if_eq_recursive0_, VALUE)\n\n#define metamacro_if_eq_recursive0_0(...) __VA_ARGS__ metamacro_consume_\n#define metamacro_if_eq_recursive0_1(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_2(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_3(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_4(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_5(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_6(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_7(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_8(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_9(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_10(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_11(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_12(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_13(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_14(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_15(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_16(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_17(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_18(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_19(...) metamacro_expand_\n#define metamacro_if_eq_recursive0_20(...) metamacro_expand_\n\n#define metamacro_if_eq_recursive1(VALUE) metamacro_if_eq_recursive0(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive2(VALUE) metamacro_if_eq_recursive1(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive3(VALUE) metamacro_if_eq_recursive2(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive4(VALUE) metamacro_if_eq_recursive3(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive5(VALUE) metamacro_if_eq_recursive4(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive6(VALUE) metamacro_if_eq_recursive5(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive7(VALUE) metamacro_if_eq_recursive6(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive8(VALUE) metamacro_if_eq_recursive7(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive9(VALUE) metamacro_if_eq_recursive8(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive10(VALUE) metamacro_if_eq_recursive9(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive11(VALUE) metamacro_if_eq_recursive10(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive12(VALUE) metamacro_if_eq_recursive11(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive13(VALUE) metamacro_if_eq_recursive12(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive14(VALUE) metamacro_if_eq_recursive13(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive15(VALUE) metamacro_if_eq_recursive14(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive16(VALUE) metamacro_if_eq_recursive15(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive17(VALUE) metamacro_if_eq_recursive16(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive18(VALUE) metamacro_if_eq_recursive17(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive19(VALUE) metamacro_if_eq_recursive18(metamacro_dec(VALUE))\n#define metamacro_if_eq_recursive20(VALUE) metamacro_if_eq_recursive19(metamacro_dec(VALUE))\n\n// metamacro_take expansions\n#define metamacro_take0(...)\n#define metamacro_take1(...) metamacro_head(__VA_ARGS__)\n#define metamacro_take2(...) metamacro_head(__VA_ARGS__), metamacro_take1(metamacro_tail(__VA_ARGS__))\n#define metamacro_take3(...) metamacro_head(__VA_ARGS__), metamacro_take2(metamacro_tail(__VA_ARGS__))\n#define metamacro_take4(...) metamacro_head(__VA_ARGS__), metamacro_take3(metamacro_tail(__VA_ARGS__))\n#define metamacro_take5(...) metamacro_head(__VA_ARGS__), metamacro_take4(metamacro_tail(__VA_ARGS__))\n#define metamacro_take6(...) metamacro_head(__VA_ARGS__), metamacro_take5(metamacro_tail(__VA_ARGS__))\n#define metamacro_take7(...) metamacro_head(__VA_ARGS__), metamacro_take6(metamacro_tail(__VA_ARGS__))\n#define metamacro_take8(...) metamacro_head(__VA_ARGS__), metamacro_take7(metamacro_tail(__VA_ARGS__))\n#define metamacro_take9(...) metamacro_head(__VA_ARGS__), metamacro_take8(metamacro_tail(__VA_ARGS__))\n#define metamacro_take10(...) metamacro_head(__VA_ARGS__), metamacro_take9(metamacro_tail(__VA_ARGS__))\n#define metamacro_take11(...) metamacro_head(__VA_ARGS__), metamacro_take10(metamacro_tail(__VA_ARGS__))\n#define metamacro_take12(...) metamacro_head(__VA_ARGS__), metamacro_take11(metamacro_tail(__VA_ARGS__))\n#define metamacro_take13(...) metamacro_head(__VA_ARGS__), metamacro_take12(metamacro_tail(__VA_ARGS__))\n#define metamacro_take14(...) metamacro_head(__VA_ARGS__), metamacro_take13(metamacro_tail(__VA_ARGS__))\n#define metamacro_take15(...) metamacro_head(__VA_ARGS__), metamacro_take14(metamacro_tail(__VA_ARGS__))\n#define metamacro_take16(...) metamacro_head(__VA_ARGS__), metamacro_take15(metamacro_tail(__VA_ARGS__))\n#define metamacro_take17(...) metamacro_head(__VA_ARGS__), metamacro_take16(metamacro_tail(__VA_ARGS__))\n#define metamacro_take18(...) metamacro_head(__VA_ARGS__), metamacro_take17(metamacro_tail(__VA_ARGS__))\n#define metamacro_take19(...) metamacro_head(__VA_ARGS__), metamacro_take18(metamacro_tail(__VA_ARGS__))\n#define metamacro_take20(...) metamacro_head(__VA_ARGS__), metamacro_take19(metamacro_tail(__VA_ARGS__))\n\n// metamacro_drop expansions\n#define metamacro_drop0(...) __VA_ARGS__\n#define metamacro_drop1(...) metamacro_tail(__VA_ARGS__)\n#define metamacro_drop2(...) metamacro_drop1(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop3(...) metamacro_drop2(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop4(...) metamacro_drop3(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop5(...) metamacro_drop4(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop6(...) metamacro_drop5(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop7(...) metamacro_drop6(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop8(...) metamacro_drop7(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop9(...) metamacro_drop8(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop10(...) metamacro_drop9(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop11(...) metamacro_drop10(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop12(...) metamacro_drop11(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop13(...) metamacro_drop12(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop14(...) metamacro_drop13(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop15(...) metamacro_drop14(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop16(...) metamacro_drop15(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop17(...) metamacro_drop16(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop18(...) metamacro_drop17(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop19(...) metamacro_drop18(metamacro_tail(__VA_ARGS__))\n#define metamacro_drop20(...) metamacro_drop19(metamacro_tail(__VA_ARGS__))\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"SDWebImageCompat.h\"\n\n@interface UIColor (SDHexString)\n\n/**\n Convenience way to get hex string from color. The output should always be 32-bit RGBA hex string like `#00000000`.\n */\n@property (nonatomic, copy, readonly, nonnull) NSString *sd_hexString;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import \"UIColor+SDHexString.h\"\n\n@implementation UIColor (SDHexString)\n\n- (NSString *)sd_hexString {\n    CGFloat red, green, blue, alpha;\n#if SD_UIKIT\n    if (![self getRed:&red green:&green blue:&blue alpha:&alpha]) {\n        [self getWhite:&red alpha:&alpha];\n        green = red;\n        blue = red;\n    }\n#else\n    @try {\n        [self getRed:&red green:&green blue:&blue alpha:&alpha];\n    }\n    @catch (NSException *exception) {\n        [self getWhite:&red alpha:&alpha];\n        green = red;\n        blue = red;\n    }\n#endif\n    \n    red = roundf(red * 255.f);\n    green = roundf(green * 255.f);\n    blue = roundf(blue * 255.f);\n    alpha = roundf(alpha * 255.f);\n    \n    uint hex = ((uint)alpha << 24) | ((uint)red << 16) | ((uint)green << 8) | ((uint)blue);\n    \n    return [NSString stringWithFormat:@\"#%08x\", hex];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage/WebImage/SDWebImage.h",
    "content": "/*\n * This file is part of the SDWebImage package.\n * (c) Olivier Poitrey <rs@dailymotion.com>\n * (c) Florent Vilmart\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\n#import <SDWebImage/SDWebImageCompat.h>\n\n//! Project version number for SDWebImage.\nFOUNDATION_EXPORT double SDWebImageVersionNumber;\n\n//! Project version string for SDWebImage.\nFOUNDATION_EXPORT const unsigned char SDWebImageVersionString[];\n\n// In this header, you should import all the public headers of your framework using statements like #import <SDWebImage/PublicHeader.h>\n\n#import <SDWebImage/SDWebImageManager.h>\n#import <SDWebImage/SDWebImageCacheKeyFilter.h>\n#import <SDWebImage/SDWebImageCacheSerializer.h>\n#import <SDWebImage/SDImageCacheConfig.h>\n#import <SDWebImage/SDImageCache.h>\n#import <SDWebImage/SDMemoryCache.h>\n#import <SDWebImage/SDDiskCache.h>\n#import <SDWebImage/SDImageCacheDefine.h>\n#import <SDWebImage/SDImageCachesManager.h>\n#import <SDWebImage/UIView+WebCache.h>\n#import <SDWebImage/UIImageView+WebCache.h>\n#import <SDWebImage/UIImageView+HighlightedWebCache.h>\n#import <SDWebImage/SDWebImageDownloaderConfig.h>\n#import <SDWebImage/SDWebImageDownloaderOperation.h>\n#import <SDWebImage/SDWebImageDownloaderRequestModifier.h>\n#import <SDWebImage/SDWebImageDownloaderResponseModifier.h>\n#import <SDWebImage/SDWebImageDownloaderDecryptor.h>\n#import <SDWebImage/SDImageLoader.h>\n#import <SDWebImage/SDImageLoadersManager.h>\n#import <SDWebImage/UIButton+WebCache.h>\n#import <SDWebImage/SDWebImagePrefetcher.h>\n#import <SDWebImage/UIView+WebCacheOperation.h>\n#import <SDWebImage/UIImage+Metadata.h>\n#import <SDWebImage/UIImage+MultiFormat.h>\n#import <SDWebImage/UIImage+MemoryCacheCost.h>\n#import <SDWebImage/UIImage+ExtendedCacheData.h>\n#import <SDWebImage/SDWebImageOperation.h>\n#import <SDWebImage/SDWebImageDownloader.h>\n#import <SDWebImage/SDWebImageTransition.h>\n#import <SDWebImage/SDWebImageIndicator.h>\n#import <SDWebImage/SDImageTransformer.h>\n#import <SDWebImage/UIImage+Transform.h>\n#import <SDWebImage/SDAnimatedImage.h>\n#import <SDWebImage/SDAnimatedImageView.h>\n#import <SDWebImage/SDAnimatedImageView+WebCache.h>\n#import <SDWebImage/SDAnimatedImagePlayer.h>\n#import <SDWebImage/SDImageCodersManager.h>\n#import <SDWebImage/SDImageCoder.h>\n#import <SDWebImage/SDImageAPNGCoder.h>\n#import <SDWebImage/SDImageGIFCoder.h>\n#import <SDWebImage/SDImageIOCoder.h>\n#import <SDWebImage/SDImageFrame.h>\n#import <SDWebImage/SDImageCoderHelper.h>\n#import <SDWebImage/SDImageGraphics.h>\n#import <SDWebImage/SDGraphicsImageRenderer.h>\n#import <SDWebImage/UIImage+GIF.h>\n#import <SDWebImage/UIImage+ForceDecode.h>\n#import <SDWebImage/NSData+ImageContentType.h>\n#import <SDWebImage/SDWebImageDefine.h>\n#import <SDWebImage/SDWebImageError.h>\n#import <SDWebImage/SDWebImageOptionsProcessor.h>\n#import <SDWebImage/SDImageIOAnimatedCoder.h>\n#import <SDWebImage/SDImageHEICCoder.h>\n#import <SDWebImage/SDImageAWebPCoder.h>\n\n// Mac\n#if __has_include(<SDWebImage/NSImage+Compatibility.h>)\n#import <SDWebImage/NSImage+Compatibility.h>\n#endif\n#if __has_include(<SDWebImage/NSButton+WebCache.h>)\n#import <SDWebImage/NSButton+WebCache.h>\n#endif\n#if __has_include(<SDWebImage/SDAnimatedImageRep.h>)\n#import <SDWebImage/SDAnimatedImageRep.h>\n#endif\n\n// MapKit\n#if __has_include(<SDWebImage/MKAnnotationView+WebCache.h>)\n#import <SDWebImage/MKAnnotationView+WebCache.h>\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SDWebImage.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t017A8EBFE8DC8B43131132D6A0A93961 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDD5F2F1F02C18A79E07B60F9DDE73A2 /* Foundation.framework */; };\n\t\t033D30A41D5007C165F92FB7F2B51EF2 /* SDImageGraphics.h in Headers */ = {isa = PBXBuildFile; fileRef = F094CEF5CF97BA34E3714DF99D8151AB /* SDImageGraphics.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t0360D8687AF2A9902EC3FA1DE24CC9B0 /* SDDeviceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DF84F793E1AF1DA5BDCCA3E391A97C1 /* SDDeviceHelper.m */; };\n\t\t04716505942C09FC7B01A96897DCEE3B /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB2D198AF0A355584536E3500DBE2E8 /* SDImageCache.m */; };\n\t\t04CCA3F309A39B753C0D9DD8AF01F8B6 /* SDImageGIFCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 03E0B5592E46D728E442B1648CD10BBD /* SDImageGIFCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t0D169DE8A8C0292DFA5B21B63D14125F /* SDWebImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 5623ACD13AF15910148FA4B12ED2C98A /* SDWebImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t0F8416B37566296722AAE59C27E9ACDE /* SDWebImageError.h in Headers */ = {isa = PBXBuildFile; fileRef = FCA015513B1EFEF20937CACE347F6CE6 /* SDWebImageError.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t107453FE42293C03B140B6F2DCB57417 /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 56D53C9457F64C3D085B9F55A26FA635 /* UIImage+ForceDecode.m */; };\n\t\t1083CE42F0BC3374608F13F226507156 /* SDWebImageDownloaderOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = A3AC3A636C5E135A2F260C047EB6AC90 /* SDWebImageDownloaderOperation.m */; };\n\t\t161A606566EEFDCAFABFD105D6F0833E /* SDWebImageCacheSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = D3017ECF9CD6A407A4358B37D26CC738 /* SDWebImageCacheSerializer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t18AB7AC6286B9603EB8A486FA2F260FC /* SDAnimatedImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B012A3986BA9AADB23FB78286FBF3ED9 /* SDAnimatedImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1985DAD90DBAB8F7A3C747F79B4952E8 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A96AE32E620549D5A0F47A7B4885813 /* SDImageTransformer.m */; };\n\t\t1A53DB9033809C32E23357EC16F81509 /* SDWebImageDefine.m in Sources */ = {isa = PBXBuildFile; fileRef = F8773626C1285B6750D540C1860D2226 /* SDWebImageDefine.m */; };\n\t\t1DDC2B93D326EA190AB99120112417A9 /* SDImageIOAnimatedCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 478C50E03A97779A7D1BD2E13AC6048E /* SDImageIOAnimatedCoder.m */; };\n\t\t1ECDF269AC653EBC32B2C0EFE9C44BF3 /* SDAssociatedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8AD4E99FB699379E84F784ED775B5604 /* SDAssociatedObject.m */; };\n\t\t22366C8CFD2EBAF435360AFC0E2F830F /* SDImageCachesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = D6C7CC06E5D4A392C8CDC4D3B26B0B03 /* SDImageCachesManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t227FE7B6D8D0D4D9B97DE8230807A73E /* SDWebImageDownloaderConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = D4F0A71FFABB934597FCEDBC21C58341 /* SDWebImageDownloaderConfig.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t266D8680A81C44835113A74F79FE28C1 /* SDAnimatedImagePlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 65FC11D60A8718174AA3116D4F92F9CF /* SDAnimatedImagePlayer.m */; };\n\t\t29E765BDA8027E02BA9BCD1BC1EF0669 /* NSImage+Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BC4D26F309274A59DC3CB0C0DFF0ED /* NSImage+Compatibility.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2C9AB902492820A5DDDF22FA66C1E86A /* SDImageIOAnimatedCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DBC938B81E08C836316BE1FB6AC8C79 /* SDImageIOAnimatedCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2DF8A19E25CE6D074228AE98586DF589 /* SDImageCachesManagerOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = DCFF0092B5A552196540BA81BFABBF9C /* SDImageCachesManagerOperation.m */; };\n\t\t2E85A167C1E64E12F3D6FF4E821722C1 /* SDImageAPNGCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 088D90830AEAF64BB9F032BA6996AC61 /* SDImageAPNGCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3127EEB15C5E5AECDA626B96D8451F5F /* SDImageCacheConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = E4FCC67F7077610770FC9342826E310D /* SDImageCacheConfig.m */; };\n\t\t322216A2ED2A78C679DB91289A08FAB9 /* SDAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 186DCBFC7A864E0A97EA1131A39D3050 /* SDAnimatedImage.m */; };\n\t\t34C6A846A0214494AFF37247458235A3 /* SDWebImageCacheKeyFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7504BE4E214D7FD85A97A5E7B1F5DD40 /* SDWebImageCacheKeyFilter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t36025E58F1341DF34C307D71F6E4F898 /* UIImage+Transform.h in Headers */ = {isa = PBXBuildFile; fileRef = B53F68262A835F384D7E560771C842DC /* UIImage+Transform.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t39463C913813D0838138400D2A7A399C /* SDWebImageCacheKeyFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AFA39BFD716DC6794C5D14A4E8838DD /* SDWebImageCacheKeyFilter.m */; };\n\t\t399929CBDE1E678356C187DE1F1A25C1 /* NSBezierPath+SDRoundedCorners.h in Headers */ = {isa = PBXBuildFile; fileRef = F1952E4C3AFDF1C5B171B1F760CD806F /* NSBezierPath+SDRoundedCorners.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t3D20CD7FEA131319092D4E7384DD474D /* SDGraphicsImageRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 63EB762F1ED6232B5B74FAB52AF483D1 /* SDGraphicsImageRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3E55223993C1778DD7AFFBBBA7A8B29E /* UIImage+Metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 70DD600EFC0B867BC223AAD8B6C1775F /* UIImage+Metadata.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3FC55A4808DD574FFE9FD5781E86FE0F /* SDWebImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 906131E3EB08469F8D0851D96E91072B /* SDWebImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4152B47B123636224DFCDD0627EBD4F5 /* SDWebImageTransitionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 22B3BCF7948FC9A3812EDA631AFFDEE0 /* SDWebImageTransitionInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t41559433269385202C704240F989DB22 /* SDWebImagePrefetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = C521A50437968929A6749809B534A109 /* SDWebImagePrefetcher.m */; };\n\t\t41B7CB0EABC8E13E8A63C4AF10481720 /* SDWebImageDownloaderRequestModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = C017B0B19177543DB8069448EAC1D7C9 /* SDWebImageDownloaderRequestModifier.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t439E54F89461873CD83B591B95D8C646 /* SDDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = DB787B9542CEC06523FE90AF3380FFF8 /* SDDisplayLink.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t43F7B8B8379EAE6D455C503364006E57 /* UIImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 340097FB09DD2EBA3B82E27EBC56E3A6 /* UIImageView+WebCache.m */; };\n\t\t46CA92B6752FEA4B2B1299E5FF73D813 /* UIImageView+HighlightedWebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 863940ED467FB4DC3A096D94AB1C672F /* UIImageView+HighlightedWebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4B1A8DCEB73F8D33FB4BC40383F153EF /* SDMemoryCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A06F4C3C7D1BBDF407D59737EBF3FA /* SDMemoryCache.m */; };\n\t\t4F5EEAD98875B84E0E3D046BB9291020 /* SDAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A256FF15DE4363D8EDC52F8716A4C33 /* SDAnimatedImage.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5073144967ED8F8F22823D7ED8EA988B /* UIImage+MemoryCacheCost.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0C86BBFDAEF13596976471E39DD7B7 /* UIImage+MemoryCacheCost.m */; };\n\t\t53881FE5ABC1A5E4ED04173787A66203 /* SDWebImageCacheSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = F43BCE19447EA654C32C635CA7A94155 /* SDWebImageCacheSerializer.m */; };\n\t\t564AFEE21E0B12FAAFF2489B6D508812 /* UIImage+ExtendedCacheData.h in Headers */ = {isa = PBXBuildFile; fileRef = 002E0B6B353CA73DD209125453960B56 /* UIImage+ExtendedCacheData.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t567B42476A7F95BDE8EB38AADC1D994D /* SDWebImageError.m in Sources */ = {isa = PBXBuildFile; fileRef = B3694C2700CC3B5D4E5473D7FBB8FE15 /* SDWebImageError.m */; };\n\t\t5857D3DD95E3A3A09DD988E94CB57419 /* SDWebImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BA1F2E86B8788BAA1474D127BA40C1D /* SDWebImageDownloader.m */; };\n\t\t5B7D375E4753197DFC77C945BB12710E /* SDImageLoadersManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5688F187D3DF0255F3B8F4FC9485E8B6 /* SDImageLoadersManager.m */; };\n\t\t5FA26E57153263D3F543E9363BF7F123 /* UIView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = BF21560DAE601971301E213EB3D2D13C /* UIView+WebCache.m */; };\n\t\t614D41C9FDA2A5CC0B72360EDBE82E5C /* SDWebImageOptionsProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1892C19FA39805AA7847E7711D841DF8 /* SDWebImageOptionsProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t619AA6344E251075187177818FDFE6CB /* SDWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E24C5242FFE86B1409FD4E2E2E39BD8 /* SDWebImageManager.m */; };\n\t\t63023D51B95E93519D4D2CD2876A94AA /* SDImageCachesManagerOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C98B62126F100BA9382A352F84D624 /* SDImageCachesManagerOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t654D810C86F399CC3BE4AD523E52B475 /* SDWebImageDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 6553CB2ADD0863E60E271E296B0A349E /* SDWebImageDefine.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t65CB2508292593B49F2C8197B79F2CCC /* NSButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 9222A0B3B5CF0B054FFEFFDA775D4634 /* NSButton+WebCache.m */; };\n\t\t67295DC01E742ADD1864A84D7DDD920E /* SDWebImagePrefetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 7FBEB84E83B4BE4C17FF1C56D54A02F5 /* SDWebImagePrefetcher.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t674901E853B1C1E4DA0B425EDA3FE13D /* SDImageIOCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 92B28EBF253AFB404B73F8C695056EDE /* SDImageIOCoder.m */; };\n\t\t675E47286C3885D9713B8653A48A4224 /* SDAnimatedImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F95D40EE640603175684908465FD45 /* SDAnimatedImageView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t67EA93F2DD3B21202D00E11C783A2730 /* SDImageAssetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E62E18A1D077533562607EC86BC75663 /* SDImageAssetManager.m */; };\n\t\t6C95697F54C61988AC0C445AA6443BF8 /* SDImageCacheConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E0E4BA095CC3E6AF196B0150F569805 /* SDImageCacheConfig.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6D85CB8F85268AF029DC8287850B5C2E /* UIView+WebCacheOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 6648EBFBE19B796663C6F11FE06C9502 /* UIView+WebCacheOperation.m */; };\n\t\t6E5594A345C9D79BDA93BAF06E66C439 /* SDInternalMacros.m in Sources */ = {isa = PBXBuildFile; fileRef = 86F0E333B8DD31BE7D320DE1EB3C4639 /* SDInternalMacros.m */; };\n\t\t7670D5362F015B792496C1C73003C6F7 /* UIImage+ExtendedCacheData.m in Sources */ = {isa = PBXBuildFile; fileRef = C3E5910181DAB70A6B0268D6E6BB9263 /* UIImage+ExtendedCacheData.m */; };\n\t\t76DF42CE93B4B9032B2B82A2A066DC4C /* SDWebImageTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = 15A15B85F3512810879E6D1184F238CF /* SDWebImageTransition.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t76FB751A5E82E727F1E910D1A7829827 /* SDImageLoadersManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 45D693CA18736936505C117F99694A9F /* SDImageLoadersManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t775CDFE8A5E02DB66F140E63FEDC99EE /* SDImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2EC9AD884F61CB5ED647022DCBCD07 /* SDImageLoader.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7978C141F49F1680892F4451972F721A /* SDImageAPNGCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 74C0C238C15B488574FB7409985F20B0 /* SDImageAPNGCoder.m */; };\n\t\t7CAD02304CE20F19562B3372B30CF504 /* SDWebImageOptionsProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8586CE89060C6D21B67942F9355E10 /* SDWebImageOptionsProcessor.m */; };\n\t\t7D49538ED6F49D720F147CF8E45F31E2 /* SDImageCodersManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 138539D89325F3072735D344A616BF6A /* SDImageCodersManager.m */; };\n\t\t8364BB3E107BBAAE9BA3DCBD07E61D00 /* UIImage+ForceDecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 48977471C1E799BF8813169AD23485A1 /* UIImage+ForceDecode.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t891D38E58F12D16BF5DBD265FC97C31F /* UIImage+MultiFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = B251B5416236640DE6AD04888F92D7CB /* UIImage+MultiFormat.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8B6F63CE501F3004E4ECE579F169D38F /* UIImage+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 55CE3C7639AA4B15E74900252E9DBEE9 /* UIImage+Transform.m */; };\n\t\t8EAE6C3C8FF324DA7093912DAC1D69B9 /* SDImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B7794D882366791D4C4601F548C6E9 /* SDImageFrame.m */; };\n\t\t8FBAD13862B002ED185A5A244F0596E2 /* SDDiskCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B0F139D91592217DD6C7182F1375644 /* SDDiskCache.m */; };\n\t\t974B083B5040A03A06C8F7B80574348D /* SDImageCodersManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A95B7F0033244260EFB3F2A6E3C298FD /* SDImageCodersManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t97596D2FC3943FF736C2C45EE903D252 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = E91C86EF152EF66986159AA7F19D4559 /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t9AC9DFD2CD734BBD9473C457A090981F /* SDImageHEICCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = DFC7AAFE5196B0EBE871A80B9A222204 /* SDImageHEICCoder.m */; };\n\t\t9CA8D145CB9D09A96409BC46818DB25A /* SDImageAssetManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A5E6F6BD74A92F697F6F1B9045011DF /* SDImageAssetManager.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\t9ECC0BCAE96ECF00CBFE8D00B9C25E9C /* SDWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A9EA599CDD13794505A4917340F3EB /* SDWeakProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tA0CD0ACA2EA68C8641CD30F4E0CE49A7 /* SDMemoryCache.h in Headers */ = {isa = PBXBuildFile; fileRef = EE14002DB253AFFCB3C0CA2B28418331 /* SDMemoryCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA1B689B19929AE185B6A71A68D1DCB9E /* SDImageIOCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 22569A558AE5320ACE616ECC8D35F920 /* SDImageIOCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA2143819203DFCF08B0D00995A0477A9 /* SDWebImageOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F938B502BCF0CAB6D857CEBFC38B39F6 /* SDWebImageOperation.m */; };\n\t\tA3BA3A24DD90B22F1B1247C21B2209CE /* UIView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CBBEE85A98909844140F5961B44A0F0 /* UIView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA4518D36B35CA4E69901285CD7808474 /* SDWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A79BAE814858BFA847FAA3689F60A78 /* SDWeakProxy.m */; };\n\t\tA4DA595C4A44FC9270FEDE186169F7EC /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 32B522BB370BBC4BF03A129F2F5EBF16 /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA8034D4C2B3407D5548D650CF881D6B9 /* SDWebImageDownloaderResponseModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 931638DEF7C4D552D6D22FC5D1951DD8 /* SDWebImageDownloaderResponseModifier.m */; };\n\t\tAB709AD9C1C3A21CB3F579672FB9D3F8 /* SDAnimatedImageRep.h in Headers */ = {isa = PBXBuildFile; fileRef = F30220C27718B323D096D784D9B74C51 /* SDAnimatedImageRep.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB082AD25250A28B1BED67D261315A801 /* SDImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = EA72E509C2EFAB04ACDADD9BAA8B0398 /* SDImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB0EBB9195608E36200197ABAF1B6EB54 /* SDAnimatedImagePlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = BBC9B778212094A9FCE49CDA59854D4C /* SDAnimatedImagePlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB1520092AB7F08C4FEFFD651696774F6 /* UIColor+SDHexString.m in Sources */ = {isa = PBXBuildFile; fileRef = 65C3820371F2F971D5C059C093F4261F /* UIColor+SDHexString.m */; };\n\t\tB16F0B99A78AE36B96472E42F643CE9D /* SDWebImageDownloaderRequestModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = BFD3345A0DAC74FDC59C15BEE92EC036 /* SDWebImageDownloaderRequestModifier.m */; };\n\t\tB26182BC860A4871D7DA1ADDE04AD1E3 /* SDWebImageTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 659846DEEF56C680890CCCA8183DD120 /* SDWebImageTransition.m */; };\n\t\tB492E94E6F63136E40CB823B22B745B3 /* SDImageIOAnimatedCoderInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = DAFF228F7784695DCFF3B7F7CA0A5485 /* SDImageIOAnimatedCoderInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tB55FD8B4B65D57360489C29531E8A6C5 /* SDAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = CD02CEC383DF2A724660F6E8127589B7 /* SDAnimatedImageView.m */; };\n\t\tB5C4B013FC5A9DDBC5CF99CA6F916C98 /* SDDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = BE067052A3157658302BE7D499303DDC /* SDDisplayLink.m */; };\n\t\tB63C7E3CA2C16F9C2F63A8F301630FF7 /* SDWebImageIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 205F117ECC37533DE41A3A956ACB9442 /* SDWebImageIndicator.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB7B85D9D072D7B8BEAD876EC4AB0A9B7 /* SDAsyncBlockOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = CE2ED1E1A2F9AC9564433AE5A256C47E /* SDAsyncBlockOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tBAECDB60B89EBEE259A045C27A43C69E /* SDImageHEICCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = F7BE21F5E980C5A11EDCCE279247791C /* SDImageHEICCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tBCC39063F53149224CBA05B646747C8A /* UIColor+SDHexString.h in Headers */ = {isa = PBXBuildFile; fileRef = A4FDC8040E44E00CDF85104535826F48 /* UIColor+SDHexString.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tBF79AC5C68631B99C8805C2D30EDEDDF /* UIImage+GIF.m in Sources */ = {isa = PBXBuildFile; fileRef = 355FA21948400FDC019D81668A95E8A5 /* UIImage+GIF.m */; };\n\t\tC08C35AA98A208273D1C8758C856B188 /* SDWebImage-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CC529B43FCA8E710D06E15F46CF147A /* SDWebImage-dummy.m */; };\n\t\tC20BFEB4E9B8C78E1CB67E6D0902A7CB /* SDImageGIFCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AEA6F52B71942B7569AE9C83412B83E /* SDImageGIFCoder.m */; };\n\t\tC385E318F0D1A034654F3D2EE7B798C1 /* SDImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D36DF07AD9F3F284D9D7DE55205CD90 /* SDImageFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tC54EB3DAAE5EE08E6456CBE9D8033BF8 /* SDAnimatedImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 657A35F31ABE2B828E01E4DBCFE954DB /* SDAnimatedImageView+WebCache.m */; };\n\t\tC58A6FAB4E78D26754D4458A052F16E1 /* SDmetamacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 6CAEE904B9A1ED59FAA31047208EF648 /* SDmetamacros.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tC5B51C8260F99B2D9663B3BB88A3C025 /* SDImageGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = 0DC000B5A48EC78804289BD58D747B8C /* SDImageGraphics.m */; };\n\t\tC75C57ABEC833416CDEBDA658757CD58 /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = EF8FDB67DAEC88FCA34FEDAB9B6F65D6 /* UIButton+WebCache.m */; };\n\t\tC7C2A3554D6B038D6E33110C0BABF880 /* SDGraphicsImageRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8786AB014BA729FBEEA8EAD097191C25 /* SDGraphicsImageRenderer.m */; };\n\t\tC80F08539C52F178C8F18929C5F7478D /* SDImageCacheDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 72798E370062BD82EE9A6534993F474C /* SDImageCacheDefine.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tC82CB7BE8B7EB4A6C5E81591EB38295E /* SDAnimatedImageRep.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AD537958997302A699662C09B967BF8 /* SDAnimatedImageRep.m */; };\n\t\tC90EF93938354BC7C6B470EEEBB09F6C /* SDWebImageDownloaderConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = C6CF3FC59D27CC65D07AAF6DCAF22A66 /* SDWebImageDownloaderConfig.m */; };\n\t\tC9E491C8F020975770ED0CA03547A2F2 /* UIImage+MultiFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A86FB0DB1E697C25977B4351E24E38A /* UIImage+MultiFormat.m */; };\n\t\tCB6E32653B477366FD590E81ED7771F4 /* SDImageCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E0A9E3A6F267717B6F013C4294DC6DD /* SDImageCoder.m */; };\n\t\tCB81850E9B5DD147779CA34D2A263DF0 /* SDImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 465664694A16243EA6C438CF81921BA4 /* SDImageLoader.m */; };\n\t\tCD25CAE2C1FF19A7E39A9F30B6254BC4 /* UIImage+MemoryCacheCost.h in Headers */ = {isa = PBXBuildFile; fileRef = F7B25DFC8584AEFF845F39C2CBF465A7 /* UIImage+MemoryCacheCost.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCEE8EB1129EF624312C7816BF8509249 /* SDWebImageDownloaderDecryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD7BC606D038BB720FE23C80EE81E9B /* SDWebImageDownloaderDecryptor.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCF569C8CB0FA4C4A1038E61EB4CC3A0B /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 143CE21F06F3E6112918CEF3519E3258 /* NSData+ImageContentType.m */; };\n\t\tD1756BB30222DD207BB611131CE73BD9 /* SDWebImageCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = 6359017BC145888E74A06BE6C25A5D25 /* SDWebImageCompat.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD4D5B65E8449915EB362D33BCF40955C /* SDDeviceHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = CFDD846243FD1BEB047CC064BF578B4F /* SDDeviceHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tD67FB1DB3FA168870272155052DC4CFB /* NSImage+Compatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F5B0898E2D9DBB65D9A8A81507A4D4 /* NSImage+Compatibility.m */; };\n\t\tD6953911E08553D47B3745C427D110AC /* SDInternalMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 66DAF0772983299FF38E06C67E480CF9 /* SDInternalMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tD775E1442E9831F664F0BE4656F288B8 /* UIView+WebCacheOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = F0EDF9B91CC054AEA1A2B87D4F3827D3 /* UIView+WebCacheOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD837A487651833EB5454D9FA494B631E /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 72A5C3AF1EA7C49A47BADF10AD15866E /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD90255ACEE3E72F4FEC1547D4C301DCC /* SDImageCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = FDDB5BCF1297B9AC25A1D9636664A4C4 /* SDImageCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDA0D1AA32063C2A6803A81B88D52697C /* SDFileAttributeHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E8E5427C822D43DF55E1DBBF30359F3 /* SDFileAttributeHelper.h */; settings = {ATTRIBUTES = (Private, ); }; };\n\t\tDD5134AB9EAB2562A2D69D0637A5124D /* SDWebImageDownloaderDecryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 88928DC1414EAC8401B8942448675958 /* SDWebImageDownloaderDecryptor.m */; };\n\t\tDF7B7568EB0B8AEE00801C5848867121 /* SDWebImageDownloaderResponseModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D0D7FA7ACB9425BF6C822CB62DECEF0 /* SDWebImageDownloaderResponseModifier.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE20F562CDEC2C1A84404D7C6B1C940E6 /* SDWebImageIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = B88DCD17BF46DCBFE9DDB31297E0D257 /* SDWebImageIndicator.m */; };\n\t\tE41924C55EF72B58917C6CFF047270DA /* SDWebImageCompat.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C0ABDFB9CD68A1CFFBF76BA3E25E962 /* SDWebImageCompat.m */; };\n\t\tE49AC5D7F000086FC652F3D5CEDC14B7 /* SDImageCoderHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF159FF7D405B5B212B595FF9DBC66D /* SDImageCoderHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE513A58F19CC8A2C671251B5113AF573 /* SDWebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 15E85D7724602ED101C3A99B30C84906 /* SDWebImage.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE5A7524C1AA3E7521AFBE4D958258988 /* NSButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 303D2F96E93D7DCBFB91DDFAC45CC4EE /* NSButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE5ACEE960263DE8ED444E4B86B4E661E /* SDImageAWebPCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 69670628F16BFDD291C2F4E111A3F3C3 /* SDImageAWebPCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE687F48BFD1054FC2C82FDDBD7B52130 /* SDImageCoderHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 08C1576224B15D2E3DFBB5E9D1A543E6 /* SDImageCoderHelper.m */; };\n\t\tE7A356A0E27354788F7A41C62155BC93 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DF5EC205DDF2654E46C2EB3E1EC29E3 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE9BC3110F50B5FF6991DA03DC3DA2B80 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = F6A0E32FD30540933C13DDAF5B0BD12F /* UIImageView+HighlightedWebCache.m */; };\n\t\tEA27DA0EDC4ABFEC35FA02755F0B2E5E /* SDImageAWebPCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 01E8CD3C7BF130FAC031BC44839EB42D /* SDImageAWebPCoder.m */; };\n\t\tEBF97DCA99ADE80DF5B13501BC98499A /* SDImageCachesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5954F8311AA585C2FDA0087D3DBF86E5 /* SDImageCachesManager.m */; };\n\t\tEC06A5EC82EBF035A936D5958CA2BABB /* SDFileAttributeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 81B03EFCF7C72F5FE776BFE91BF2393D /* SDFileAttributeHelper.m */; };\n\t\tED13F3EBBF3D361441301E898EFFCB86 /* UIImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 8126BEAD2A5E788F0860C22A6491592F /* UIImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEDC509F2FF438627A00F3B0F2F50AA5A /* UIImage+Metadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB84D814D54FA245AA7627A50880C53 /* UIImage+Metadata.m */; };\n\t\tEEA5193830FCE87BB8C77FCBC5129EEE /* SDWebImage-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 5888775B964E7CDF250D2C5C66476B4C /* SDWebImage-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF3E28C010CD36A1721E44D026C3429C0 /* NSBezierPath+SDRoundedCorners.m in Sources */ = {isa = PBXBuildFile; fileRef = ACD77ADCC05DADAD533CAB83CC41178C /* NSBezierPath+SDRoundedCorners.m */; };\n\t\tF44E0AC4AF71DA17509B00E977A18B32 /* SDImageCacheDefine.m in Sources */ = {isa = PBXBuildFile; fileRef = CE3CDE2FF25A5133150A0C32FE1E6B55 /* SDImageCacheDefine.m */; };\n\t\tF6A8B6C518D3AF1FA554E0758AFF2107 /* SDAsyncBlockOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F411D9FDA3BA2827CE3E1496A15B01E /* SDAsyncBlockOperation.m */; };\n\t\tF90FC90360BBE4552B57DDB1BDD66319 /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = E2886D63B50384D8512CCC724A9F32E2 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFAC7EFB0C0C7C7E68A61DA87A1C9EF3E /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C67098B292C77323CDCB7C0F2C04F218 /* ImageIO.framework */; };\n\t\tFCB798313C3BD61EBAFF3847C9182608 /* UIButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3448A8591CCD4B4446305E140AB91718 /* UIButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFD41BA476E30BB35C864BBF9E6815549 /* SDDiskCache.h in Headers */ = {isa = PBXBuildFile; fileRef = C9DC96800E84EC5C9936AD7DBFC9D76D /* SDDiskCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFFD1E46E05CDFB892F4AD7065E6C60E6 /* SDAssociatedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BB9905B43EAEF8DA35CBFDC451FEFF3 /* SDAssociatedObject.h */; settings = {ATTRIBUTES = (Private, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t002E0B6B353CA73DD209125453960B56 /* UIImage+ExtendedCacheData.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+ExtendedCacheData.h\"; path = \"SDWebImage/Core/UIImage+ExtendedCacheData.h\"; sourceTree = \"<group>\"; };\n\t\t01E8CD3C7BF130FAC031BC44839EB42D /* SDImageAWebPCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAWebPCoder.m; path = SDWebImage/Core/SDImageAWebPCoder.m; sourceTree = \"<group>\"; };\n\t\t03E0B5592E46D728E442B1648CD10BBD /* SDImageGIFCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageGIFCoder.h; path = SDWebImage/Core/SDImageGIFCoder.h; sourceTree = \"<group>\"; };\n\t\t04BC4D26F309274A59DC3CB0C0DFF0ED /* NSImage+Compatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSImage+Compatibility.h\"; path = \"SDWebImage/Core/NSImage+Compatibility.h\"; sourceTree = \"<group>\"; };\n\t\t088D90830AEAF64BB9F032BA6996AC61 /* SDImageAPNGCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAPNGCoder.h; path = SDWebImage/Core/SDImageAPNGCoder.h; sourceTree = \"<group>\"; };\n\t\t08C1576224B15D2E3DFBB5E9D1A543E6 /* SDImageCoderHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCoderHelper.m; path = SDWebImage/Core/SDImageCoderHelper.m; sourceTree = \"<group>\"; };\n\t\t0C0ABDFB9CD68A1CFFBF76BA3E25E962 /* SDWebImageCompat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCompat.m; path = SDWebImage/Core/SDWebImageCompat.m; sourceTree = \"<group>\"; };\n\t\t0CB813A55C780940F659BAB6BECDD436 /* SDWebImage.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SDWebImage.modulemap; sourceTree = \"<group>\"; };\n\t\t0DC000B5A48EC78804289BD58D747B8C /* SDImageGraphics.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageGraphics.m; path = SDWebImage/Core/SDImageGraphics.m; sourceTree = \"<group>\"; };\n\t\t0E24C5242FFE86B1409FD4E2E2E39BD8 /* SDWebImageManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageManager.m; path = SDWebImage/Core/SDWebImageManager.m; sourceTree = \"<group>\"; };\n\t\t0E8E5427C822D43DF55E1DBBF30359F3 /* SDFileAttributeHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDFileAttributeHelper.h; path = SDWebImage/Private/SDFileAttributeHelper.h; sourceTree = \"<group>\"; };\n\t\t0F411D9FDA3BA2827CE3E1496A15B01E /* SDAsyncBlockOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAsyncBlockOperation.m; path = SDWebImage/Private/SDAsyncBlockOperation.m; sourceTree = \"<group>\"; };\n\t\t138539D89325F3072735D344A616BF6A /* SDImageCodersManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCodersManager.m; path = SDWebImage/Core/SDImageCodersManager.m; sourceTree = \"<group>\"; };\n\t\t143CE21F06F3E6112918CEF3519E3258 /* NSData+ImageContentType.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSData+ImageContentType.m\"; path = \"SDWebImage/Core/NSData+ImageContentType.m\"; sourceTree = \"<group>\"; };\n\t\t15A15B85F3512810879E6D1184F238CF /* SDWebImageTransition.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageTransition.h; path = SDWebImage/Core/SDWebImageTransition.h; sourceTree = \"<group>\"; };\n\t\t15E85D7724602ED101C3A99B30C84906 /* SDWebImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImage.h; path = WebImage/SDWebImage.h; sourceTree = \"<group>\"; };\n\t\t186DCBFC7A864E0A97EA1131A39D3050 /* SDAnimatedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImage.m; path = SDWebImage/Core/SDAnimatedImage.m; sourceTree = \"<group>\"; };\n\t\t1892C19FA39805AA7847E7711D841DF8 /* SDWebImageOptionsProcessor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageOptionsProcessor.h; path = SDWebImage/Core/SDWebImageOptionsProcessor.h; sourceTree = \"<group>\"; };\n\t\t1BA1F2E86B8788BAA1474D127BA40C1D /* SDWebImageDownloader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloader.m; path = SDWebImage/Core/SDWebImageDownloader.m; sourceTree = \"<group>\"; };\n\t\t1D844570BD8AC62B01899FB06E34E08F /* SDWebImage-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"SDWebImage-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t1E0A9E3A6F267717B6F013C4294DC6DD /* SDImageCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCoder.m; path = SDWebImage/Core/SDImageCoder.m; sourceTree = \"<group>\"; };\n\t\t1FB84D814D54FA245AA7627A50880C53 /* UIImage+Metadata.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+Metadata.m\"; path = \"SDWebImage/Core/UIImage+Metadata.m\"; sourceTree = \"<group>\"; };\n\t\t205F117ECC37533DE41A3A956ACB9442 /* SDWebImageIndicator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageIndicator.h; path = SDWebImage/Core/SDWebImageIndicator.h; sourceTree = \"<group>\"; };\n\t\t22569A558AE5320ACE616ECC8D35F920 /* SDImageIOCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOCoder.h; path = SDWebImage/Core/SDImageIOCoder.h; sourceTree = \"<group>\"; };\n\t\t22B3BCF7948FC9A3812EDA631AFFDEE0 /* SDWebImageTransitionInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageTransitionInternal.h; path = SDWebImage/Private/SDWebImageTransitionInternal.h; sourceTree = \"<group>\"; };\n\t\t2A86FB0DB1E697C25977B4351E24E38A /* UIImage+MultiFormat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+MultiFormat.m\"; path = \"SDWebImage/Core/UIImage+MultiFormat.m\"; sourceTree = \"<group>\"; };\n\t\t2CBBEE85A98909844140F5961B44A0F0 /* UIView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIView+WebCache.h\"; path = \"SDWebImage/Core/UIView+WebCache.h\"; sourceTree = \"<group>\"; };\n\t\t303D2F96E93D7DCBFB91DDFAC45CC4EE /* NSButton+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSButton+WebCache.h\"; path = \"SDWebImage/Core/NSButton+WebCache.h\"; sourceTree = \"<group>\"; };\n\t\t32B522BB370BBC4BF03A129F2F5EBF16 /* NSData+ImageContentType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSData+ImageContentType.h\"; path = \"SDWebImage/Core/NSData+ImageContentType.h\"; sourceTree = \"<group>\"; };\n\t\t340097FB09DD2EBA3B82E27EBC56E3A6 /* UIImageView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImageView+WebCache.m\"; path = \"SDWebImage/Core/UIImageView+WebCache.m\"; sourceTree = \"<group>\"; };\n\t\t3448A8591CCD4B4446305E140AB91718 /* UIButton+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIButton+WebCache.h\"; path = \"SDWebImage/Core/UIButton+WebCache.h\"; sourceTree = \"<group>\"; };\n\t\t355FA21948400FDC019D81668A95E8A5 /* UIImage+GIF.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+GIF.m\"; path = \"SDWebImage/Core/UIImage+GIF.m\"; sourceTree = \"<group>\"; };\n\t\t3AD537958997302A699662C09B967BF8 /* SDAnimatedImageRep.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImageRep.m; path = SDWebImage/Core/SDAnimatedImageRep.m; sourceTree = \"<group>\"; };\n\t\t45D693CA18736936505C117F99694A9F /* SDImageLoadersManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageLoadersManager.h; path = SDWebImage/Core/SDImageLoadersManager.h; sourceTree = \"<group>\"; };\n\t\t465664694A16243EA6C438CF81921BA4 /* SDImageLoader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageLoader.m; path = SDWebImage/Core/SDImageLoader.m; sourceTree = \"<group>\"; };\n\t\t478C50E03A97779A7D1BD2E13AC6048E /* SDImageIOAnimatedCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageIOAnimatedCoder.m; path = SDWebImage/Core/SDImageIOAnimatedCoder.m; sourceTree = \"<group>\"; };\n\t\t48977471C1E799BF8813169AD23485A1 /* UIImage+ForceDecode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+ForceDecode.h\"; path = \"SDWebImage/Core/UIImage+ForceDecode.h\"; sourceTree = \"<group>\"; };\n\t\t4AEA6F52B71942B7569AE9C83412B83E /* SDImageGIFCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageGIFCoder.m; path = SDWebImage/Core/SDImageGIFCoder.m; sourceTree = \"<group>\"; };\n\t\t4DF84F793E1AF1DA5BDCCA3E391A97C1 /* SDDeviceHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDeviceHelper.m; path = SDWebImage/Private/SDDeviceHelper.m; sourceTree = \"<group>\"; };\n\t\t4E0E4BA095CC3E6AF196B0150F569805 /* SDImageCacheConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCacheConfig.h; path = SDWebImage/Core/SDImageCacheConfig.h; sourceTree = \"<group>\"; };\n\t\t55CE3C7639AA4B15E74900252E9DBEE9 /* UIImage+Transform.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+Transform.m\"; path = \"SDWebImage/Core/UIImage+Transform.m\"; sourceTree = \"<group>\"; };\n\t\t5623ACD13AF15910148FA4B12ED2C98A /* SDWebImageDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloader.h; path = SDWebImage/Core/SDWebImageDownloader.h; sourceTree = \"<group>\"; };\n\t\t5688F187D3DF0255F3B8F4FC9485E8B6 /* SDImageLoadersManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageLoadersManager.m; path = SDWebImage/Core/SDImageLoadersManager.m; sourceTree = \"<group>\"; };\n\t\t56D53C9457F64C3D085B9F55A26FA635 /* UIImage+ForceDecode.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+ForceDecode.m\"; path = \"SDWebImage/Core/UIImage+ForceDecode.m\"; sourceTree = \"<group>\"; };\n\t\t5888775B964E7CDF250D2C5C66476B4C /* SDWebImage-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SDWebImage-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t5954F8311AA585C2FDA0087D3DBF86E5 /* SDImageCachesManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCachesManager.m; path = SDWebImage/Core/SDImageCachesManager.m; sourceTree = \"<group>\"; };\n\t\t5A256FF15DE4363D8EDC52F8716A4C33 /* SDAnimatedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImage.h; path = SDWebImage/Core/SDAnimatedImage.h; sourceTree = \"<group>\"; };\n\t\t5A79BAE814858BFA847FAA3689F60A78 /* SDWeakProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWeakProxy.m; path = SDWebImage/Private/SDWeakProxy.m; sourceTree = \"<group>\"; };\n\t\t5A96AE32E620549D5A0F47A7B4885813 /* SDImageTransformer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageTransformer.m; path = SDWebImage/Core/SDImageTransformer.m; sourceTree = \"<group>\"; };\n\t\t5B0F139D91592217DD6C7182F1375644 /* SDDiskCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDiskCache.m; path = SDWebImage/Core/SDDiskCache.m; sourceTree = \"<group>\"; };\n\t\t5D36DF07AD9F3F284D9D7DE55205CD90 /* SDImageFrame.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageFrame.h; path = SDWebImage/Core/SDImageFrame.h; sourceTree = \"<group>\"; };\n\t\t6359017BC145888E74A06BE6C25A5D25 /* SDWebImageCompat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCompat.h; path = SDWebImage/Core/SDWebImageCompat.h; sourceTree = \"<group>\"; };\n\t\t63EB762F1ED6232B5B74FAB52AF483D1 /* SDGraphicsImageRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDGraphicsImageRenderer.h; path = SDWebImage/Core/SDGraphicsImageRenderer.h; sourceTree = \"<group>\"; };\n\t\t6553CB2ADD0863E60E271E296B0A349E /* SDWebImageDefine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDefine.h; path = SDWebImage/Core/SDWebImageDefine.h; sourceTree = \"<group>\"; };\n\t\t657A35F31ABE2B828E01E4DBCFE954DB /* SDAnimatedImageView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"SDAnimatedImageView+WebCache.m\"; path = \"SDWebImage/Core/SDAnimatedImageView+WebCache.m\"; sourceTree = \"<group>\"; };\n\t\t659846DEEF56C680890CCCA8183DD120 /* SDWebImageTransition.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageTransition.m; path = SDWebImage/Core/SDWebImageTransition.m; sourceTree = \"<group>\"; };\n\t\t65C3820371F2F971D5C059C093F4261F /* UIColor+SDHexString.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIColor+SDHexString.m\"; path = \"SDWebImage/Private/UIColor+SDHexString.m\"; sourceTree = \"<group>\"; };\n\t\t65FC11D60A8718174AA3116D4F92F9CF /* SDAnimatedImagePlayer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImagePlayer.m; path = SDWebImage/Core/SDAnimatedImagePlayer.m; sourceTree = \"<group>\"; };\n\t\t6648EBFBE19B796663C6F11FE06C9502 /* UIView+WebCacheOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIView+WebCacheOperation.m\"; path = \"SDWebImage/Core/UIView+WebCacheOperation.m\"; sourceTree = \"<group>\"; };\n\t\t66DAF0772983299FF38E06C67E480CF9 /* SDInternalMacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDInternalMacros.h; path = SDWebImage/Private/SDInternalMacros.h; sourceTree = \"<group>\"; };\n\t\t69670628F16BFDD291C2F4E111A3F3C3 /* SDImageAWebPCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAWebPCoder.h; path = SDWebImage/Core/SDImageAWebPCoder.h; sourceTree = \"<group>\"; };\n\t\t6A5E6F6BD74A92F697F6F1B9045011DF /* SDImageAssetManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAssetManager.h; path = SDWebImage/Private/SDImageAssetManager.h; sourceTree = \"<group>\"; };\n\t\t6AFA39BFD716DC6794C5D14A4E8838DD /* SDWebImageCacheKeyFilter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCacheKeyFilter.m; path = SDWebImage/Core/SDWebImageCacheKeyFilter.m; sourceTree = \"<group>\"; };\n\t\t6CAEE904B9A1ED59FAA31047208EF648 /* SDmetamacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDmetamacros.h; path = SDWebImage/Private/SDmetamacros.h; sourceTree = \"<group>\"; };\n\t\t70DD600EFC0B867BC223AAD8B6C1775F /* UIImage+Metadata.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+Metadata.h\"; path = \"SDWebImage/Core/UIImage+Metadata.h\"; sourceTree = \"<group>\"; };\n\t\t72798E370062BD82EE9A6534993F474C /* SDImageCacheDefine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCacheDefine.h; path = SDWebImage/Core/SDImageCacheDefine.h; sourceTree = \"<group>\"; };\n\t\t72A5C3AF1EA7C49A47BADF10AD15866E /* SDWebImageDownloaderOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderOperation.h; path = SDWebImage/Core/SDWebImageDownloaderOperation.h; sourceTree = \"<group>\"; };\n\t\t72F95D40EE640603175684908465FD45 /* SDAnimatedImageView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImageView.h; path = SDWebImage/Core/SDAnimatedImageView.h; sourceTree = \"<group>\"; };\n\t\t74C0C238C15B488574FB7409985F20B0 /* SDImageAPNGCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAPNGCoder.m; path = SDWebImage/Core/SDImageAPNGCoder.m; sourceTree = \"<group>\"; };\n\t\t7504BE4E214D7FD85A97A5E7B1F5DD40 /* SDWebImageCacheKeyFilter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCacheKeyFilter.h; path = SDWebImage/Core/SDWebImageCacheKeyFilter.h; sourceTree = \"<group>\"; };\n\t\t7DBC938B81E08C836316BE1FB6AC8C79 /* SDImageIOAnimatedCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOAnimatedCoder.h; path = SDWebImage/Core/SDImageIOAnimatedCoder.h; sourceTree = \"<group>\"; };\n\t\t7FBEB84E83B4BE4C17FF1C56D54A02F5 /* SDWebImagePrefetcher.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImagePrefetcher.h; path = SDWebImage/Core/SDWebImagePrefetcher.h; sourceTree = \"<group>\"; };\n\t\t8126BEAD2A5E788F0860C22A6491592F /* UIImageView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImageView+WebCache.h\"; path = \"SDWebImage/Core/UIImageView+WebCache.h\"; sourceTree = \"<group>\"; };\n\t\t81B03EFCF7C72F5FE776BFE91BF2393D /* SDFileAttributeHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDFileAttributeHelper.m; path = SDWebImage/Private/SDFileAttributeHelper.m; sourceTree = \"<group>\"; };\n\t\t863940ED467FB4DC3A096D94AB1C672F /* UIImageView+HighlightedWebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImageView+HighlightedWebCache.h\"; path = \"SDWebImage/Core/UIImageView+HighlightedWebCache.h\"; sourceTree = \"<group>\"; };\n\t\t86F0E333B8DD31BE7D320DE1EB3C4639 /* SDInternalMacros.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDInternalMacros.m; path = SDWebImage/Private/SDInternalMacros.m; sourceTree = \"<group>\"; };\n\t\t8786AB014BA729FBEEA8EAD097191C25 /* SDGraphicsImageRenderer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDGraphicsImageRenderer.m; path = SDWebImage/Core/SDGraphicsImageRenderer.m; sourceTree = \"<group>\"; };\n\t\t88928DC1414EAC8401B8942448675958 /* SDWebImageDownloaderDecryptor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderDecryptor.m; path = SDWebImage/Core/SDWebImageDownloaderDecryptor.m; sourceTree = \"<group>\"; };\n\t\t8AD4E99FB699379E84F784ED775B5604 /* SDAssociatedObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAssociatedObject.m; path = SDWebImage/Private/SDAssociatedObject.m; sourceTree = \"<group>\"; };\n\t\t8CC529B43FCA8E710D06E15F46CF147A /* SDWebImage-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"SDWebImage-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t906131E3EB08469F8D0851D96E91072B /* SDWebImageManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageManager.h; path = SDWebImage/Core/SDWebImageManager.h; sourceTree = \"<group>\"; };\n\t\t9222A0B3B5CF0B054FFEFFDA775D4634 /* NSButton+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSButton+WebCache.m\"; path = \"SDWebImage/Core/NSButton+WebCache.m\"; sourceTree = \"<group>\"; };\n\t\t92B28EBF253AFB404B73F8C695056EDE /* SDImageIOCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageIOCoder.m; path = SDWebImage/Core/SDImageIOCoder.m; sourceTree = \"<group>\"; };\n\t\t931638DEF7C4D552D6D22FC5D1951DD8 /* SDWebImageDownloaderResponseModifier.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderResponseModifier.m; path = SDWebImage/Core/SDWebImageDownloaderResponseModifier.m; sourceTree = \"<group>\"; };\n\t\t98A373AB42BB83999C42F0562B3EFA47 /* SDWebImage */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SDWebImage; path = SDWebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t9B8586CE89060C6D21B67942F9355E10 /* SDWebImageOptionsProcessor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageOptionsProcessor.m; path = SDWebImage/Core/SDWebImageOptionsProcessor.m; sourceTree = \"<group>\"; };\n\t\t9BB9905B43EAEF8DA35CBFDC451FEFF3 /* SDAssociatedObject.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAssociatedObject.h; path = SDWebImage/Private/SDAssociatedObject.h; sourceTree = \"<group>\"; };\n\t\t9D0D7FA7ACB9425BF6C822CB62DECEF0 /* SDWebImageDownloaderResponseModifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderResponseModifier.h; path = SDWebImage/Core/SDWebImageDownloaderResponseModifier.h; sourceTree = \"<group>\"; };\n\t\t9DF5EC205DDF2654E46C2EB3E1EC29E3 /* SDWebImageOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageOperation.h; path = SDWebImage/Core/SDWebImageOperation.h; sourceTree = \"<group>\"; };\n\t\tA3AC3A636C5E135A2F260C047EB6AC90 /* SDWebImageDownloaderOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderOperation.m; path = SDWebImage/Core/SDWebImageDownloaderOperation.m; sourceTree = \"<group>\"; };\n\t\tA4FDC8040E44E00CDF85104535826F48 /* UIColor+SDHexString.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIColor+SDHexString.h\"; path = \"SDWebImage/Private/UIColor+SDHexString.h\"; sourceTree = \"<group>\"; };\n\t\tA95B7F0033244260EFB3F2A6E3C298FD /* SDImageCodersManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCodersManager.h; path = SDWebImage/Core/SDImageCodersManager.h; sourceTree = \"<group>\"; };\n\t\tACD77ADCC05DADAD533CAB83CC41178C /* NSBezierPath+SDRoundedCorners.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSBezierPath+SDRoundedCorners.m\"; path = \"SDWebImage/Private/NSBezierPath+SDRoundedCorners.m\"; sourceTree = \"<group>\"; };\n\t\tAEB9D28C04C9DE2878406904E8AF611D /* SDWebImage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImage.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tB012A3986BA9AADB23FB78286FBF3ED9 /* SDAnimatedImageView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"SDAnimatedImageView+WebCache.h\"; path = \"SDWebImage/Core/SDAnimatedImageView+WebCache.h\"; sourceTree = \"<group>\"; };\n\t\tB251B5416236640DE6AD04888F92D7CB /* UIImage+MultiFormat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+MultiFormat.h\"; path = \"SDWebImage/Core/UIImage+MultiFormat.h\"; sourceTree = \"<group>\"; };\n\t\tB3694C2700CC3B5D4E5473D7FBB8FE15 /* SDWebImageError.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageError.m; path = SDWebImage/Core/SDWebImageError.m; sourceTree = \"<group>\"; };\n\t\tB53F68262A835F384D7E560771C842DC /* UIImage+Transform.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+Transform.h\"; path = \"SDWebImage/Core/UIImage+Transform.h\"; sourceTree = \"<group>\"; };\n\t\tB88DCD17BF46DCBFE9DDB31297E0D257 /* SDWebImageIndicator.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageIndicator.m; path = SDWebImage/Core/SDWebImageIndicator.m; sourceTree = \"<group>\"; };\n\t\tB9A06F4C3C7D1BBDF407D59737EBF3FA /* SDMemoryCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDMemoryCache.m; path = SDWebImage/Core/SDMemoryCache.m; sourceTree = \"<group>\"; };\n\t\tBBC9B778212094A9FCE49CDA59854D4C /* SDAnimatedImagePlayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImagePlayer.h; path = SDWebImage/Core/SDAnimatedImagePlayer.h; sourceTree = \"<group>\"; };\n\t\tBE067052A3157658302BE7D499303DDC /* SDDisplayLink.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDisplayLink.m; path = SDWebImage/Private/SDDisplayLink.m; sourceTree = \"<group>\"; };\n\t\tBF21560DAE601971301E213EB3D2D13C /* UIView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIView+WebCache.m\"; path = \"SDWebImage/Core/UIView+WebCache.m\"; sourceTree = \"<group>\"; };\n\t\tBFD3345A0DAC74FDC59C15BEE92EC036 /* SDWebImageDownloaderRequestModifier.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderRequestModifier.m; path = SDWebImage/Core/SDWebImageDownloaderRequestModifier.m; sourceTree = \"<group>\"; };\n\t\tC017B0B19177543DB8069448EAC1D7C9 /* SDWebImageDownloaderRequestModifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderRequestModifier.h; path = SDWebImage/Core/SDWebImageDownloaderRequestModifier.h; sourceTree = \"<group>\"; };\n\t\tC3E5910181DAB70A6B0268D6E6BB9263 /* UIImage+ExtendedCacheData.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+ExtendedCacheData.m\"; path = \"SDWebImage/Core/UIImage+ExtendedCacheData.m\"; sourceTree = \"<group>\"; };\n\t\tC3F5B0898E2D9DBB65D9A8A81507A4D4 /* NSImage+Compatibility.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSImage+Compatibility.m\"; path = \"SDWebImage/Core/NSImage+Compatibility.m\"; sourceTree = \"<group>\"; };\n\t\tC521A50437968929A6749809B534A109 /* SDWebImagePrefetcher.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImagePrefetcher.m; path = SDWebImage/Core/SDWebImagePrefetcher.m; sourceTree = \"<group>\"; };\n\t\tC67098B292C77323CDCB7C0F2C04F218 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; };\n\t\tC6CF3FC59D27CC65D07AAF6DCAF22A66 /* SDWebImageDownloaderConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderConfig.m; path = SDWebImage/Core/SDWebImageDownloaderConfig.m; sourceTree = \"<group>\"; };\n\t\tC9DC96800E84EC5C9936AD7DBFC9D76D /* SDDiskCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDiskCache.h; path = SDWebImage/Core/SDDiskCache.h; sourceTree = \"<group>\"; };\n\t\tCCD7BC606D038BB720FE23C80EE81E9B /* SDWebImageDownloaderDecryptor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderDecryptor.h; path = SDWebImage/Core/SDWebImageDownloaderDecryptor.h; sourceTree = \"<group>\"; };\n\t\tCD02CEC383DF2A724660F6E8127589B7 /* SDAnimatedImageView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImageView.m; path = SDWebImage/Core/SDAnimatedImageView.m; sourceTree = \"<group>\"; };\n\t\tCE0C86BBFDAEF13596976471E39DD7B7 /* UIImage+MemoryCacheCost.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImage+MemoryCacheCost.m\"; path = \"SDWebImage/Core/UIImage+MemoryCacheCost.m\"; sourceTree = \"<group>\"; };\n\t\tCE2ED1E1A2F9AC9564433AE5A256C47E /* SDAsyncBlockOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAsyncBlockOperation.h; path = SDWebImage/Private/SDAsyncBlockOperation.h; sourceTree = \"<group>\"; };\n\t\tCE3CDE2FF25A5133150A0C32FE1E6B55 /* SDImageCacheDefine.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCacheDefine.m; path = SDWebImage/Core/SDImageCacheDefine.m; sourceTree = \"<group>\"; };\n\t\tCFDD846243FD1BEB047CC064BF578B4F /* SDDeviceHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDeviceHelper.h; path = SDWebImage/Private/SDDeviceHelper.h; sourceTree = \"<group>\"; };\n\t\tD3017ECF9CD6A407A4358B37D26CC738 /* SDWebImageCacheSerializer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCacheSerializer.h; path = SDWebImage/Core/SDWebImageCacheSerializer.h; sourceTree = \"<group>\"; };\n\t\tD4F0A71FFABB934597FCEDBC21C58341 /* SDWebImageDownloaderConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderConfig.h; path = SDWebImage/Core/SDWebImageDownloaderConfig.h; sourceTree = \"<group>\"; };\n\t\tD6C7CC06E5D4A392C8CDC4D3B26B0B03 /* SDImageCachesManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCachesManager.h; path = SDWebImage/Core/SDImageCachesManager.h; sourceTree = \"<group>\"; };\n\t\tDAFF228F7784695DCFF3B7F7CA0A5485 /* SDImageIOAnimatedCoderInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOAnimatedCoderInternal.h; path = SDWebImage/Private/SDImageIOAnimatedCoderInternal.h; sourceTree = \"<group>\"; };\n\t\tDB787B9542CEC06523FE90AF3380FFF8 /* SDDisplayLink.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDisplayLink.h; path = SDWebImage/Private/SDDisplayLink.h; sourceTree = \"<group>\"; };\n\t\tDCFF0092B5A552196540BA81BFABBF9C /* SDImageCachesManagerOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCachesManagerOperation.m; path = SDWebImage/Private/SDImageCachesManagerOperation.m; sourceTree = \"<group>\"; };\n\t\tDDD5F2F1F02C18A79E07B60F9DDE73A2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tDF2EC9AD884F61CB5ED647022DCBCD07 /* SDImageLoader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageLoader.h; path = SDWebImage/Core/SDImageLoader.h; sourceTree = \"<group>\"; };\n\t\tDFC7AAFE5196B0EBE871A80B9A222204 /* SDImageHEICCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageHEICCoder.m; path = SDWebImage/Core/SDImageHEICCoder.m; sourceTree = \"<group>\"; };\n\t\tE2886D63B50384D8512CCC724A9F32E2 /* SDImageTransformer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageTransformer.h; path = SDWebImage/Core/SDImageTransformer.h; sourceTree = \"<group>\"; };\n\t\tE2A0B7D6A1A50EE9135CCF5029CBAA68 /* SDWebImage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImage.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tE4C98B62126F100BA9382A352F84D624 /* SDImageCachesManagerOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCachesManagerOperation.h; path = SDWebImage/Private/SDImageCachesManagerOperation.h; sourceTree = \"<group>\"; };\n\t\tE4FCC67F7077610770FC9342826E310D /* SDImageCacheConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCacheConfig.m; path = SDWebImage/Core/SDImageCacheConfig.m; sourceTree = \"<group>\"; };\n\t\tE62E18A1D077533562607EC86BC75663 /* SDImageAssetManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAssetManager.m; path = SDWebImage/Private/SDImageAssetManager.m; sourceTree = \"<group>\"; };\n\t\tE91C86EF152EF66986159AA7F19D4559 /* UIImage+GIF.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+GIF.h\"; path = \"SDWebImage/Core/UIImage+GIF.h\"; sourceTree = \"<group>\"; };\n\t\tE9A9EA599CDD13794505A4917340F3EB /* SDWeakProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWeakProxy.h; path = SDWebImage/Private/SDWeakProxy.h; sourceTree = \"<group>\"; };\n\t\tEA72E509C2EFAB04ACDADD9BAA8B0398 /* SDImageCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCache.h; path = SDWebImage/Core/SDImageCache.h; sourceTree = \"<group>\"; };\n\t\tEBF159FF7D405B5B212B595FF9DBC66D /* SDImageCoderHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCoderHelper.h; path = SDWebImage/Core/SDImageCoderHelper.h; sourceTree = \"<group>\"; };\n\t\tECF19150A18A469AE8425679913F3B58 /* SDWebImage-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SDWebImage-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tEE14002DB253AFFCB3C0CA2B28418331 /* SDMemoryCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDMemoryCache.h; path = SDWebImage/Core/SDMemoryCache.h; sourceTree = \"<group>\"; };\n\t\tEF8FDB67DAEC88FCA34FEDAB9B6F65D6 /* UIButton+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIButton+WebCache.m\"; path = \"SDWebImage/Core/UIButton+WebCache.m\"; sourceTree = \"<group>\"; };\n\t\tF094CEF5CF97BA34E3714DF99D8151AB /* SDImageGraphics.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageGraphics.h; path = SDWebImage/Core/SDImageGraphics.h; sourceTree = \"<group>\"; };\n\t\tF0EDF9B91CC054AEA1A2B87D4F3827D3 /* UIView+WebCacheOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIView+WebCacheOperation.h\"; path = \"SDWebImage/Core/UIView+WebCacheOperation.h\"; sourceTree = \"<group>\"; };\n\t\tF1952E4C3AFDF1C5B171B1F760CD806F /* NSBezierPath+SDRoundedCorners.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSBezierPath+SDRoundedCorners.h\"; path = \"SDWebImage/Private/NSBezierPath+SDRoundedCorners.h\"; sourceTree = \"<group>\"; };\n\t\tF30220C27718B323D096D784D9B74C51 /* SDAnimatedImageRep.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImageRep.h; path = SDWebImage/Core/SDAnimatedImageRep.h; sourceTree = \"<group>\"; };\n\t\tF43BCE19447EA654C32C635CA7A94155 /* SDWebImageCacheSerializer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCacheSerializer.m; path = SDWebImage/Core/SDWebImageCacheSerializer.m; sourceTree = \"<group>\"; };\n\t\tF6A0E32FD30540933C13DDAF5B0BD12F /* UIImageView+HighlightedWebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIImageView+HighlightedWebCache.m\"; path = \"SDWebImage/Core/UIImageView+HighlightedWebCache.m\"; sourceTree = \"<group>\"; };\n\t\tF7B25DFC8584AEFF845F39C2CBF465A7 /* UIImage+MemoryCacheCost.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIImage+MemoryCacheCost.h\"; path = \"SDWebImage/Core/UIImage+MemoryCacheCost.h\"; sourceTree = \"<group>\"; };\n\t\tF7B7794D882366791D4C4601F548C6E9 /* SDImageFrame.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageFrame.m; path = SDWebImage/Core/SDImageFrame.m; sourceTree = \"<group>\"; };\n\t\tF7BE21F5E980C5A11EDCCE279247791C /* SDImageHEICCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageHEICCoder.h; path = SDWebImage/Core/SDImageHEICCoder.h; sourceTree = \"<group>\"; };\n\t\tF8773626C1285B6750D540C1860D2226 /* SDWebImageDefine.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDefine.m; path = SDWebImage/Core/SDWebImageDefine.m; sourceTree = \"<group>\"; };\n\t\tF938B502BCF0CAB6D857CEBFC38B39F6 /* SDWebImageOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageOperation.m; path = SDWebImage/Core/SDWebImageOperation.m; sourceTree = \"<group>\"; };\n\t\tFCA015513B1EFEF20937CACE347F6CE6 /* SDWebImageError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageError.h; path = SDWebImage/Core/SDWebImageError.h; sourceTree = \"<group>\"; };\n\t\tFDDB5BCF1297B9AC25A1D9636664A4C4 /* SDImageCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCoder.h; path = SDWebImage/Core/SDImageCoder.h; sourceTree = \"<group>\"; };\n\t\tFEB2D198AF0A355584536E3500DBE2E8 /* SDImageCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCache.m; path = SDWebImage/Core/SDImageCache.m; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t23CFCBF60EE04EE9E36508CCE2559AA1 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t017A8EBFE8DC8B43131132D6A0A93961 /* Foundation.framework in Frameworks */,\n\t\t\t\tFAC7EFB0C0C7C7E68A61DA87A1C9EF3E /* ImageIO.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2B2A4042532E797CFB2772F1BE96F7FB /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDDD5F2F1F02C18A79E07B60F9DDE73A2 /* Foundation.framework */,\n\t\t\t\tC67098B292C77323CDCB7C0F2C04F218 /* ImageIO.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t3C6C639094BF66D38DFF32B1CAB81D6E /* Core */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF1952E4C3AFDF1C5B171B1F760CD806F /* NSBezierPath+SDRoundedCorners.h */,\n\t\t\t\tACD77ADCC05DADAD533CAB83CC41178C /* NSBezierPath+SDRoundedCorners.m */,\n\t\t\t\t303D2F96E93D7DCBFB91DDFAC45CC4EE /* NSButton+WebCache.h */,\n\t\t\t\t9222A0B3B5CF0B054FFEFFDA775D4634 /* NSButton+WebCache.m */,\n\t\t\t\t32B522BB370BBC4BF03A129F2F5EBF16 /* NSData+ImageContentType.h */,\n\t\t\t\t143CE21F06F3E6112918CEF3519E3258 /* NSData+ImageContentType.m */,\n\t\t\t\t04BC4D26F309274A59DC3CB0C0DFF0ED /* NSImage+Compatibility.h */,\n\t\t\t\tC3F5B0898E2D9DBB65D9A8A81507A4D4 /* NSImage+Compatibility.m */,\n\t\t\t\t5A256FF15DE4363D8EDC52F8716A4C33 /* SDAnimatedImage.h */,\n\t\t\t\t186DCBFC7A864E0A97EA1131A39D3050 /* SDAnimatedImage.m */,\n\t\t\t\tBBC9B778212094A9FCE49CDA59854D4C /* SDAnimatedImagePlayer.h */,\n\t\t\t\t65FC11D60A8718174AA3116D4F92F9CF /* SDAnimatedImagePlayer.m */,\n\t\t\t\tF30220C27718B323D096D784D9B74C51 /* SDAnimatedImageRep.h */,\n\t\t\t\t3AD537958997302A699662C09B967BF8 /* SDAnimatedImageRep.m */,\n\t\t\t\t72F95D40EE640603175684908465FD45 /* SDAnimatedImageView.h */,\n\t\t\t\tCD02CEC383DF2A724660F6E8127589B7 /* SDAnimatedImageView.m */,\n\t\t\t\tB012A3986BA9AADB23FB78286FBF3ED9 /* SDAnimatedImageView+WebCache.h */,\n\t\t\t\t657A35F31ABE2B828E01E4DBCFE954DB /* SDAnimatedImageView+WebCache.m */,\n\t\t\t\t9BB9905B43EAEF8DA35CBFDC451FEFF3 /* SDAssociatedObject.h */,\n\t\t\t\t8AD4E99FB699379E84F784ED775B5604 /* SDAssociatedObject.m */,\n\t\t\t\tCE2ED1E1A2F9AC9564433AE5A256C47E /* SDAsyncBlockOperation.h */,\n\t\t\t\t0F411D9FDA3BA2827CE3E1496A15B01E /* SDAsyncBlockOperation.m */,\n\t\t\t\tCFDD846243FD1BEB047CC064BF578B4F /* SDDeviceHelper.h */,\n\t\t\t\t4DF84F793E1AF1DA5BDCCA3E391A97C1 /* SDDeviceHelper.m */,\n\t\t\t\tC9DC96800E84EC5C9936AD7DBFC9D76D /* SDDiskCache.h */,\n\t\t\t\t5B0F139D91592217DD6C7182F1375644 /* SDDiskCache.m */,\n\t\t\t\tDB787B9542CEC06523FE90AF3380FFF8 /* SDDisplayLink.h */,\n\t\t\t\tBE067052A3157658302BE7D499303DDC /* SDDisplayLink.m */,\n\t\t\t\t0E8E5427C822D43DF55E1DBBF30359F3 /* SDFileAttributeHelper.h */,\n\t\t\t\t81B03EFCF7C72F5FE776BFE91BF2393D /* SDFileAttributeHelper.m */,\n\t\t\t\t63EB762F1ED6232B5B74FAB52AF483D1 /* SDGraphicsImageRenderer.h */,\n\t\t\t\t8786AB014BA729FBEEA8EAD097191C25 /* SDGraphicsImageRenderer.m */,\n\t\t\t\t088D90830AEAF64BB9F032BA6996AC61 /* SDImageAPNGCoder.h */,\n\t\t\t\t74C0C238C15B488574FB7409985F20B0 /* SDImageAPNGCoder.m */,\n\t\t\t\t6A5E6F6BD74A92F697F6F1B9045011DF /* SDImageAssetManager.h */,\n\t\t\t\tE62E18A1D077533562607EC86BC75663 /* SDImageAssetManager.m */,\n\t\t\t\t69670628F16BFDD291C2F4E111A3F3C3 /* SDImageAWebPCoder.h */,\n\t\t\t\t01E8CD3C7BF130FAC031BC44839EB42D /* SDImageAWebPCoder.m */,\n\t\t\t\tEA72E509C2EFAB04ACDADD9BAA8B0398 /* SDImageCache.h */,\n\t\t\t\tFEB2D198AF0A355584536E3500DBE2E8 /* SDImageCache.m */,\n\t\t\t\t4E0E4BA095CC3E6AF196B0150F569805 /* SDImageCacheConfig.h */,\n\t\t\t\tE4FCC67F7077610770FC9342826E310D /* SDImageCacheConfig.m */,\n\t\t\t\t72798E370062BD82EE9A6534993F474C /* SDImageCacheDefine.h */,\n\t\t\t\tCE3CDE2FF25A5133150A0C32FE1E6B55 /* SDImageCacheDefine.m */,\n\t\t\t\tD6C7CC06E5D4A392C8CDC4D3B26B0B03 /* SDImageCachesManager.h */,\n\t\t\t\t5954F8311AA585C2FDA0087D3DBF86E5 /* SDImageCachesManager.m */,\n\t\t\t\tE4C98B62126F100BA9382A352F84D624 /* SDImageCachesManagerOperation.h */,\n\t\t\t\tDCFF0092B5A552196540BA81BFABBF9C /* SDImageCachesManagerOperation.m */,\n\t\t\t\tFDDB5BCF1297B9AC25A1D9636664A4C4 /* SDImageCoder.h */,\n\t\t\t\t1E0A9E3A6F267717B6F013C4294DC6DD /* SDImageCoder.m */,\n\t\t\t\tEBF159FF7D405B5B212B595FF9DBC66D /* SDImageCoderHelper.h */,\n\t\t\t\t08C1576224B15D2E3DFBB5E9D1A543E6 /* SDImageCoderHelper.m */,\n\t\t\t\tA95B7F0033244260EFB3F2A6E3C298FD /* SDImageCodersManager.h */,\n\t\t\t\t138539D89325F3072735D344A616BF6A /* SDImageCodersManager.m */,\n\t\t\t\t5D36DF07AD9F3F284D9D7DE55205CD90 /* SDImageFrame.h */,\n\t\t\t\tF7B7794D882366791D4C4601F548C6E9 /* SDImageFrame.m */,\n\t\t\t\t03E0B5592E46D728E442B1648CD10BBD /* SDImageGIFCoder.h */,\n\t\t\t\t4AEA6F52B71942B7569AE9C83412B83E /* SDImageGIFCoder.m */,\n\t\t\t\tF094CEF5CF97BA34E3714DF99D8151AB /* SDImageGraphics.h */,\n\t\t\t\t0DC000B5A48EC78804289BD58D747B8C /* SDImageGraphics.m */,\n\t\t\t\tF7BE21F5E980C5A11EDCCE279247791C /* SDImageHEICCoder.h */,\n\t\t\t\tDFC7AAFE5196B0EBE871A80B9A222204 /* SDImageHEICCoder.m */,\n\t\t\t\t7DBC938B81E08C836316BE1FB6AC8C79 /* SDImageIOAnimatedCoder.h */,\n\t\t\t\t478C50E03A97779A7D1BD2E13AC6048E /* SDImageIOAnimatedCoder.m */,\n\t\t\t\tDAFF228F7784695DCFF3B7F7CA0A5485 /* SDImageIOAnimatedCoderInternal.h */,\n\t\t\t\t22569A558AE5320ACE616ECC8D35F920 /* SDImageIOCoder.h */,\n\t\t\t\t92B28EBF253AFB404B73F8C695056EDE /* SDImageIOCoder.m */,\n\t\t\t\tDF2EC9AD884F61CB5ED647022DCBCD07 /* SDImageLoader.h */,\n\t\t\t\t465664694A16243EA6C438CF81921BA4 /* SDImageLoader.m */,\n\t\t\t\t45D693CA18736936505C117F99694A9F /* SDImageLoadersManager.h */,\n\t\t\t\t5688F187D3DF0255F3B8F4FC9485E8B6 /* SDImageLoadersManager.m */,\n\t\t\t\tE2886D63B50384D8512CCC724A9F32E2 /* SDImageTransformer.h */,\n\t\t\t\t5A96AE32E620549D5A0F47A7B4885813 /* SDImageTransformer.m */,\n\t\t\t\t66DAF0772983299FF38E06C67E480CF9 /* SDInternalMacros.h */,\n\t\t\t\t86F0E333B8DD31BE7D320DE1EB3C4639 /* SDInternalMacros.m */,\n\t\t\t\tEE14002DB253AFFCB3C0CA2B28418331 /* SDMemoryCache.h */,\n\t\t\t\tB9A06F4C3C7D1BBDF407D59737EBF3FA /* SDMemoryCache.m */,\n\t\t\t\t6CAEE904B9A1ED59FAA31047208EF648 /* SDmetamacros.h */,\n\t\t\t\tE9A9EA599CDD13794505A4917340F3EB /* SDWeakProxy.h */,\n\t\t\t\t5A79BAE814858BFA847FAA3689F60A78 /* SDWeakProxy.m */,\n\t\t\t\t15E85D7724602ED101C3A99B30C84906 /* SDWebImage.h */,\n\t\t\t\t7504BE4E214D7FD85A97A5E7B1F5DD40 /* SDWebImageCacheKeyFilter.h */,\n\t\t\t\t6AFA39BFD716DC6794C5D14A4E8838DD /* SDWebImageCacheKeyFilter.m */,\n\t\t\t\tD3017ECF9CD6A407A4358B37D26CC738 /* SDWebImageCacheSerializer.h */,\n\t\t\t\tF43BCE19447EA654C32C635CA7A94155 /* SDWebImageCacheSerializer.m */,\n\t\t\t\t6359017BC145888E74A06BE6C25A5D25 /* SDWebImageCompat.h */,\n\t\t\t\t0C0ABDFB9CD68A1CFFBF76BA3E25E962 /* SDWebImageCompat.m */,\n\t\t\t\t6553CB2ADD0863E60E271E296B0A349E /* SDWebImageDefine.h */,\n\t\t\t\tF8773626C1285B6750D540C1860D2226 /* SDWebImageDefine.m */,\n\t\t\t\t5623ACD13AF15910148FA4B12ED2C98A /* SDWebImageDownloader.h */,\n\t\t\t\t1BA1F2E86B8788BAA1474D127BA40C1D /* SDWebImageDownloader.m */,\n\t\t\t\tD4F0A71FFABB934597FCEDBC21C58341 /* SDWebImageDownloaderConfig.h */,\n\t\t\t\tC6CF3FC59D27CC65D07AAF6DCAF22A66 /* SDWebImageDownloaderConfig.m */,\n\t\t\t\tCCD7BC606D038BB720FE23C80EE81E9B /* SDWebImageDownloaderDecryptor.h */,\n\t\t\t\t88928DC1414EAC8401B8942448675958 /* SDWebImageDownloaderDecryptor.m */,\n\t\t\t\t72A5C3AF1EA7C49A47BADF10AD15866E /* SDWebImageDownloaderOperation.h */,\n\t\t\t\tA3AC3A636C5E135A2F260C047EB6AC90 /* SDWebImageDownloaderOperation.m */,\n\t\t\t\tC017B0B19177543DB8069448EAC1D7C9 /* SDWebImageDownloaderRequestModifier.h */,\n\t\t\t\tBFD3345A0DAC74FDC59C15BEE92EC036 /* SDWebImageDownloaderRequestModifier.m */,\n\t\t\t\t9D0D7FA7ACB9425BF6C822CB62DECEF0 /* SDWebImageDownloaderResponseModifier.h */,\n\t\t\t\t931638DEF7C4D552D6D22FC5D1951DD8 /* SDWebImageDownloaderResponseModifier.m */,\n\t\t\t\tFCA015513B1EFEF20937CACE347F6CE6 /* SDWebImageError.h */,\n\t\t\t\tB3694C2700CC3B5D4E5473D7FBB8FE15 /* SDWebImageError.m */,\n\t\t\t\t205F117ECC37533DE41A3A956ACB9442 /* SDWebImageIndicator.h */,\n\t\t\t\tB88DCD17BF46DCBFE9DDB31297E0D257 /* SDWebImageIndicator.m */,\n\t\t\t\t906131E3EB08469F8D0851D96E91072B /* SDWebImageManager.h */,\n\t\t\t\t0E24C5242FFE86B1409FD4E2E2E39BD8 /* SDWebImageManager.m */,\n\t\t\t\t9DF5EC205DDF2654E46C2EB3E1EC29E3 /* SDWebImageOperation.h */,\n\t\t\t\tF938B502BCF0CAB6D857CEBFC38B39F6 /* SDWebImageOperation.m */,\n\t\t\t\t1892C19FA39805AA7847E7711D841DF8 /* SDWebImageOptionsProcessor.h */,\n\t\t\t\t9B8586CE89060C6D21B67942F9355E10 /* SDWebImageOptionsProcessor.m */,\n\t\t\t\t7FBEB84E83B4BE4C17FF1C56D54A02F5 /* SDWebImagePrefetcher.h */,\n\t\t\t\tC521A50437968929A6749809B534A109 /* SDWebImagePrefetcher.m */,\n\t\t\t\t15A15B85F3512810879E6D1184F238CF /* SDWebImageTransition.h */,\n\t\t\t\t659846DEEF56C680890CCCA8183DD120 /* SDWebImageTransition.m */,\n\t\t\t\t22B3BCF7948FC9A3812EDA631AFFDEE0 /* SDWebImageTransitionInternal.h */,\n\t\t\t\t3448A8591CCD4B4446305E140AB91718 /* UIButton+WebCache.h */,\n\t\t\t\tEF8FDB67DAEC88FCA34FEDAB9B6F65D6 /* UIButton+WebCache.m */,\n\t\t\t\tA4FDC8040E44E00CDF85104535826F48 /* UIColor+SDHexString.h */,\n\t\t\t\t65C3820371F2F971D5C059C093F4261F /* UIColor+SDHexString.m */,\n\t\t\t\t002E0B6B353CA73DD209125453960B56 /* UIImage+ExtendedCacheData.h */,\n\t\t\t\tC3E5910181DAB70A6B0268D6E6BB9263 /* UIImage+ExtendedCacheData.m */,\n\t\t\t\t48977471C1E799BF8813169AD23485A1 /* UIImage+ForceDecode.h */,\n\t\t\t\t56D53C9457F64C3D085B9F55A26FA635 /* UIImage+ForceDecode.m */,\n\t\t\t\tE91C86EF152EF66986159AA7F19D4559 /* UIImage+GIF.h */,\n\t\t\t\t355FA21948400FDC019D81668A95E8A5 /* UIImage+GIF.m */,\n\t\t\t\tF7B25DFC8584AEFF845F39C2CBF465A7 /* UIImage+MemoryCacheCost.h */,\n\t\t\t\tCE0C86BBFDAEF13596976471E39DD7B7 /* UIImage+MemoryCacheCost.m */,\n\t\t\t\t70DD600EFC0B867BC223AAD8B6C1775F /* UIImage+Metadata.h */,\n\t\t\t\t1FB84D814D54FA245AA7627A50880C53 /* UIImage+Metadata.m */,\n\t\t\t\tB251B5416236640DE6AD04888F92D7CB /* UIImage+MultiFormat.h */,\n\t\t\t\t2A86FB0DB1E697C25977B4351E24E38A /* UIImage+MultiFormat.m */,\n\t\t\t\tB53F68262A835F384D7E560771C842DC /* UIImage+Transform.h */,\n\t\t\t\t55CE3C7639AA4B15E74900252E9DBEE9 /* UIImage+Transform.m */,\n\t\t\t\t863940ED467FB4DC3A096D94AB1C672F /* UIImageView+HighlightedWebCache.h */,\n\t\t\t\tF6A0E32FD30540933C13DDAF5B0BD12F /* UIImageView+HighlightedWebCache.m */,\n\t\t\t\t8126BEAD2A5E788F0860C22A6491592F /* UIImageView+WebCache.h */,\n\t\t\t\t340097FB09DD2EBA3B82E27EBC56E3A6 /* UIImageView+WebCache.m */,\n\t\t\t\t2CBBEE85A98909844140F5961B44A0F0 /* UIView+WebCache.h */,\n\t\t\t\tBF21560DAE601971301E213EB3D2D13C /* UIView+WebCache.m */,\n\t\t\t\tF0EDF9B91CC054AEA1A2B87D4F3827D3 /* UIView+WebCacheOperation.h */,\n\t\t\t\t6648EBFBE19B796663C6F11FE06C9502 /* UIView+WebCacheOperation.m */,\n\t\t\t);\n\t\t\tname = Core;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t745539EC90BA4D04EE8421CF47DD4081 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2B2A4042532E797CFB2772F1BE96F7FB /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7B6482294C7101930067A6BE20A44AD5 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t98A373AB42BB83999C42F0562B3EFA47 /* SDWebImage */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t9D413D1DC3EA90E2919C46FB3FE8FC27 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0CB813A55C780940F659BAB6BECDD436 /* SDWebImage.modulemap */,\n\t\t\t\t8CC529B43FCA8E710D06E15F46CF147A /* SDWebImage-dummy.m */,\n\t\t\t\t1D844570BD8AC62B01899FB06E34E08F /* SDWebImage-Info.plist */,\n\t\t\t\tECF19150A18A469AE8425679913F3B58 /* SDWebImage-prefix.pch */,\n\t\t\t\t5888775B964E7CDF250D2C5C66476B4C /* SDWebImage-umbrella.h */,\n\t\t\t\tE2A0B7D6A1A50EE9135CCF5029CBAA68 /* SDWebImage.debug.xcconfig */,\n\t\t\t\tAEB9D28C04C9DE2878406904E8AF611D /* SDWebImage.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/SDWebImage\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB7055D1F01EF05254BDE8AB494F1F8FA = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t745539EC90BA4D04EE8421CF47DD4081 /* Frameworks */,\n\t\t\t\t7B6482294C7101930067A6BE20A44AD5 /* Products */,\n\t\t\t\tC7DB46F1CB7BC843D7DFA90277D488A8 /* SDWebImage */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tC7DB46F1CB7BC843D7DFA90277D488A8 /* SDWebImage */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t3C6C639094BF66D38DFF32B1CAB81D6E /* Core */,\n\t\t\t\t9D413D1DC3EA90E2919C46FB3FE8FC27 /* Support Files */,\n\t\t\t);\n\t\t\tname = SDWebImage;\n\t\t\tpath = SDWebImage;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t0262B7A63C6842855C97BE5154A5E945 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t399929CBDE1E678356C187DE1F1A25C1 /* NSBezierPath+SDRoundedCorners.h in Headers */,\n\t\t\t\tE5A7524C1AA3E7521AFBE4D958258988 /* NSButton+WebCache.h in Headers */,\n\t\t\t\tA4DA595C4A44FC9270FEDE186169F7EC /* NSData+ImageContentType.h in Headers */,\n\t\t\t\t29E765BDA8027E02BA9BCD1BC1EF0669 /* NSImage+Compatibility.h in Headers */,\n\t\t\t\t4F5EEAD98875B84E0E3D046BB9291020 /* SDAnimatedImage.h in Headers */,\n\t\t\t\tB0EBB9195608E36200197ABAF1B6EB54 /* SDAnimatedImagePlayer.h in Headers */,\n\t\t\t\tAB709AD9C1C3A21CB3F579672FB9D3F8 /* SDAnimatedImageRep.h in Headers */,\n\t\t\t\t675E47286C3885D9713B8653A48A4224 /* SDAnimatedImageView.h in Headers */,\n\t\t\t\t18AB7AC6286B9603EB8A486FA2F260FC /* SDAnimatedImageView+WebCache.h in Headers */,\n\t\t\t\tFFD1E46E05CDFB892F4AD7065E6C60E6 /* SDAssociatedObject.h in Headers */,\n\t\t\t\tB7B85D9D072D7B8BEAD876EC4AB0A9B7 /* SDAsyncBlockOperation.h in Headers */,\n\t\t\t\tD4D5B65E8449915EB362D33BCF40955C /* SDDeviceHelper.h in Headers */,\n\t\t\t\tFD41BA476E30BB35C864BBF9E6815549 /* SDDiskCache.h in Headers */,\n\t\t\t\t439E54F89461873CD83B591B95D8C646 /* SDDisplayLink.h in Headers */,\n\t\t\t\tDA0D1AA32063C2A6803A81B88D52697C /* SDFileAttributeHelper.h in Headers */,\n\t\t\t\t3D20CD7FEA131319092D4E7384DD474D /* SDGraphicsImageRenderer.h in Headers */,\n\t\t\t\t2E85A167C1E64E12F3D6FF4E821722C1 /* SDImageAPNGCoder.h in Headers */,\n\t\t\t\t9CA8D145CB9D09A96409BC46818DB25A /* SDImageAssetManager.h in Headers */,\n\t\t\t\tE5ACEE960263DE8ED444E4B86B4E661E /* SDImageAWebPCoder.h in Headers */,\n\t\t\t\tB082AD25250A28B1BED67D261315A801 /* SDImageCache.h in Headers */,\n\t\t\t\t6C95697F54C61988AC0C445AA6443BF8 /* SDImageCacheConfig.h in Headers */,\n\t\t\t\tC80F08539C52F178C8F18929C5F7478D /* SDImageCacheDefine.h in Headers */,\n\t\t\t\t22366C8CFD2EBAF435360AFC0E2F830F /* SDImageCachesManager.h in Headers */,\n\t\t\t\t63023D51B95E93519D4D2CD2876A94AA /* SDImageCachesManagerOperation.h in Headers */,\n\t\t\t\tD90255ACEE3E72F4FEC1547D4C301DCC /* SDImageCoder.h in Headers */,\n\t\t\t\tE49AC5D7F000086FC652F3D5CEDC14B7 /* SDImageCoderHelper.h in Headers */,\n\t\t\t\t974B083B5040A03A06C8F7B80574348D /* SDImageCodersManager.h in Headers */,\n\t\t\t\tC385E318F0D1A034654F3D2EE7B798C1 /* SDImageFrame.h in Headers */,\n\t\t\t\t04CCA3F309A39B753C0D9DD8AF01F8B6 /* SDImageGIFCoder.h in Headers */,\n\t\t\t\t033D30A41D5007C165F92FB7F2B51EF2 /* SDImageGraphics.h in Headers */,\n\t\t\t\tBAECDB60B89EBEE259A045C27A43C69E /* SDImageHEICCoder.h in Headers */,\n\t\t\t\t2C9AB902492820A5DDDF22FA66C1E86A /* SDImageIOAnimatedCoder.h in Headers */,\n\t\t\t\tB492E94E6F63136E40CB823B22B745B3 /* SDImageIOAnimatedCoderInternal.h in Headers */,\n\t\t\t\tA1B689B19929AE185B6A71A68D1DCB9E /* SDImageIOCoder.h in Headers */,\n\t\t\t\t775CDFE8A5E02DB66F140E63FEDC99EE /* SDImageLoader.h in Headers */,\n\t\t\t\t76FB751A5E82E727F1E910D1A7829827 /* SDImageLoadersManager.h in Headers */,\n\t\t\t\tF90FC90360BBE4552B57DDB1BDD66319 /* SDImageTransformer.h in Headers */,\n\t\t\t\tD6953911E08553D47B3745C427D110AC /* SDInternalMacros.h in Headers */,\n\t\t\t\tA0CD0ACA2EA68C8641CD30F4E0CE49A7 /* SDMemoryCache.h in Headers */,\n\t\t\t\tC58A6FAB4E78D26754D4458A052F16E1 /* SDmetamacros.h in Headers */,\n\t\t\t\t9ECC0BCAE96ECF00CBFE8D00B9C25E9C /* SDWeakProxy.h in Headers */,\n\t\t\t\tE513A58F19CC8A2C671251B5113AF573 /* SDWebImage.h in Headers */,\n\t\t\t\tEEA5193830FCE87BB8C77FCBC5129EEE /* SDWebImage-umbrella.h in Headers */,\n\t\t\t\t34C6A846A0214494AFF37247458235A3 /* SDWebImageCacheKeyFilter.h in Headers */,\n\t\t\t\t161A606566EEFDCAFABFD105D6F0833E /* SDWebImageCacheSerializer.h in Headers */,\n\t\t\t\tD1756BB30222DD207BB611131CE73BD9 /* SDWebImageCompat.h in Headers */,\n\t\t\t\t654D810C86F399CC3BE4AD523E52B475 /* SDWebImageDefine.h in Headers */,\n\t\t\t\t0D169DE8A8C0292DFA5B21B63D14125F /* SDWebImageDownloader.h in Headers */,\n\t\t\t\t227FE7B6D8D0D4D9B97DE8230807A73E /* SDWebImageDownloaderConfig.h in Headers */,\n\t\t\t\tCEE8EB1129EF624312C7816BF8509249 /* SDWebImageDownloaderDecryptor.h in Headers */,\n\t\t\t\tD837A487651833EB5454D9FA494B631E /* SDWebImageDownloaderOperation.h in Headers */,\n\t\t\t\t41B7CB0EABC8E13E8A63C4AF10481720 /* SDWebImageDownloaderRequestModifier.h in Headers */,\n\t\t\t\tDF7B7568EB0B8AEE00801C5848867121 /* SDWebImageDownloaderResponseModifier.h in Headers */,\n\t\t\t\t0F8416B37566296722AAE59C27E9ACDE /* SDWebImageError.h in Headers */,\n\t\t\t\tB63C7E3CA2C16F9C2F63A8F301630FF7 /* SDWebImageIndicator.h in Headers */,\n\t\t\t\t3FC55A4808DD574FFE9FD5781E86FE0F /* SDWebImageManager.h in Headers */,\n\t\t\t\tE7A356A0E27354788F7A41C62155BC93 /* SDWebImageOperation.h in Headers */,\n\t\t\t\t614D41C9FDA2A5CC0B72360EDBE82E5C /* SDWebImageOptionsProcessor.h in Headers */,\n\t\t\t\t67295DC01E742ADD1864A84D7DDD920E /* SDWebImagePrefetcher.h in Headers */,\n\t\t\t\t76DF42CE93B4B9032B2B82A2A066DC4C /* SDWebImageTransition.h in Headers */,\n\t\t\t\t4152B47B123636224DFCDD0627EBD4F5 /* SDWebImageTransitionInternal.h in Headers */,\n\t\t\t\tFCB798313C3BD61EBAFF3847C9182608 /* UIButton+WebCache.h in Headers */,\n\t\t\t\tBCC39063F53149224CBA05B646747C8A /* UIColor+SDHexString.h in Headers */,\n\t\t\t\t564AFEE21E0B12FAAFF2489B6D508812 /* UIImage+ExtendedCacheData.h in Headers */,\n\t\t\t\t8364BB3E107BBAAE9BA3DCBD07E61D00 /* UIImage+ForceDecode.h in Headers */,\n\t\t\t\t97596D2FC3943FF736C2C45EE903D252 /* UIImage+GIF.h in Headers */,\n\t\t\t\tCD25CAE2C1FF19A7E39A9F30B6254BC4 /* UIImage+MemoryCacheCost.h in Headers */,\n\t\t\t\t3E55223993C1778DD7AFFBBBA7A8B29E /* UIImage+Metadata.h in Headers */,\n\t\t\t\t891D38E58F12D16BF5DBD265FC97C31F /* UIImage+MultiFormat.h in Headers */,\n\t\t\t\t36025E58F1341DF34C307D71F6E4F898 /* UIImage+Transform.h in Headers */,\n\t\t\t\t46CA92B6752FEA4B2B1299E5FF73D813 /* UIImageView+HighlightedWebCache.h in Headers */,\n\t\t\t\tED13F3EBBF3D361441301E898EFFCB86 /* UIImageView+WebCache.h in Headers */,\n\t\t\t\tA3BA3A24DD90B22F1B1247C21B2209CE /* UIView+WebCache.h in Headers */,\n\t\t\t\tD775E1442E9831F664F0BE4656F288B8 /* UIView+WebCacheOperation.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t4ECF4E662EEBE4FA58102FF984D920CC /* SDWebImage */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = B0596298A997619B278D07CF1AB7E1A2 /* Build configuration list for PBXNativeTarget \"SDWebImage\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t0262B7A63C6842855C97BE5154A5E945 /* Headers */,\n\t\t\t\t56CA95378F844C101F90D4A9A30B5439 /* Sources */,\n\t\t\t\t23CFCBF60EE04EE9E36508CCE2559AA1 /* Frameworks */,\n\t\t\t\tB288FF45966A52D33C9F5566790356BC /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = SDWebImage;\n\t\t\tproductName = SDWebImage;\n\t\t\tproductReference = 98A373AB42BB83999C42F0562B3EFA47 /* SDWebImage */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t8654C589048010934C79D870E55A473A /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3358AAB3E9A96AF9A87B5B31701E372F /* Build configuration list for PBXProject \"SDWebImage\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = B7055D1F01EF05254BDE8AB494F1F8FA;\n\t\t\tproductRefGroup = 7B6482294C7101930067A6BE20A44AD5 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t4ECF4E662EEBE4FA58102FF984D920CC /* SDWebImage */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tB288FF45966A52D33C9F5566790356BC /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t56CA95378F844C101F90D4A9A30B5439 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tF3E28C010CD36A1721E44D026C3429C0 /* NSBezierPath+SDRoundedCorners.m in Sources */,\n\t\t\t\t65CB2508292593B49F2C8197B79F2CCC /* NSButton+WebCache.m in Sources */,\n\t\t\t\tCF569C8CB0FA4C4A1038E61EB4CC3A0B /* NSData+ImageContentType.m in Sources */,\n\t\t\t\tD67FB1DB3FA168870272155052DC4CFB /* NSImage+Compatibility.m in Sources */,\n\t\t\t\t322216A2ED2A78C679DB91289A08FAB9 /* SDAnimatedImage.m in Sources */,\n\t\t\t\t266D8680A81C44835113A74F79FE28C1 /* SDAnimatedImagePlayer.m in Sources */,\n\t\t\t\tC82CB7BE8B7EB4A6C5E81591EB38295E /* SDAnimatedImageRep.m in Sources */,\n\t\t\t\tB55FD8B4B65D57360489C29531E8A6C5 /* SDAnimatedImageView.m in Sources */,\n\t\t\t\tC54EB3DAAE5EE08E6456CBE9D8033BF8 /* SDAnimatedImageView+WebCache.m in Sources */,\n\t\t\t\t1ECDF269AC653EBC32B2C0EFE9C44BF3 /* SDAssociatedObject.m in Sources */,\n\t\t\t\tF6A8B6C518D3AF1FA554E0758AFF2107 /* SDAsyncBlockOperation.m in Sources */,\n\t\t\t\t0360D8687AF2A9902EC3FA1DE24CC9B0 /* SDDeviceHelper.m in Sources */,\n\t\t\t\t8FBAD13862B002ED185A5A244F0596E2 /* SDDiskCache.m in Sources */,\n\t\t\t\tB5C4B013FC5A9DDBC5CF99CA6F916C98 /* SDDisplayLink.m in Sources */,\n\t\t\t\tEC06A5EC82EBF035A936D5958CA2BABB /* SDFileAttributeHelper.m in Sources */,\n\t\t\t\tC7C2A3554D6B038D6E33110C0BABF880 /* SDGraphicsImageRenderer.m in Sources */,\n\t\t\t\t7978C141F49F1680892F4451972F721A /* SDImageAPNGCoder.m in Sources */,\n\t\t\t\t67EA93F2DD3B21202D00E11C783A2730 /* SDImageAssetManager.m in Sources */,\n\t\t\t\tEA27DA0EDC4ABFEC35FA02755F0B2E5E /* SDImageAWebPCoder.m in Sources */,\n\t\t\t\t04716505942C09FC7B01A96897DCEE3B /* SDImageCache.m in Sources */,\n\t\t\t\t3127EEB15C5E5AECDA626B96D8451F5F /* SDImageCacheConfig.m in Sources */,\n\t\t\t\tF44E0AC4AF71DA17509B00E977A18B32 /* SDImageCacheDefine.m in Sources */,\n\t\t\t\tEBF97DCA99ADE80DF5B13501BC98499A /* SDImageCachesManager.m in Sources */,\n\t\t\t\t2DF8A19E25CE6D074228AE98586DF589 /* SDImageCachesManagerOperation.m in Sources */,\n\t\t\t\tCB6E32653B477366FD590E81ED7771F4 /* SDImageCoder.m in Sources */,\n\t\t\t\tE687F48BFD1054FC2C82FDDBD7B52130 /* SDImageCoderHelper.m in Sources */,\n\t\t\t\t7D49538ED6F49D720F147CF8E45F31E2 /* SDImageCodersManager.m in Sources */,\n\t\t\t\t8EAE6C3C8FF324DA7093912DAC1D69B9 /* SDImageFrame.m in Sources */,\n\t\t\t\tC20BFEB4E9B8C78E1CB67E6D0902A7CB /* SDImageGIFCoder.m in Sources */,\n\t\t\t\tC5B51C8260F99B2D9663B3BB88A3C025 /* SDImageGraphics.m in Sources */,\n\t\t\t\t9AC9DFD2CD734BBD9473C457A090981F /* SDImageHEICCoder.m in Sources */,\n\t\t\t\t1DDC2B93D326EA190AB99120112417A9 /* SDImageIOAnimatedCoder.m in Sources */,\n\t\t\t\t674901E853B1C1E4DA0B425EDA3FE13D /* SDImageIOCoder.m in Sources */,\n\t\t\t\tCB81850E9B5DD147779CA34D2A263DF0 /* SDImageLoader.m in Sources */,\n\t\t\t\t5B7D375E4753197DFC77C945BB12710E /* SDImageLoadersManager.m in Sources */,\n\t\t\t\t1985DAD90DBAB8F7A3C747F79B4952E8 /* SDImageTransformer.m in Sources */,\n\t\t\t\t6E5594A345C9D79BDA93BAF06E66C439 /* SDInternalMacros.m in Sources */,\n\t\t\t\t4B1A8DCEB73F8D33FB4BC40383F153EF /* SDMemoryCache.m in Sources */,\n\t\t\t\tA4518D36B35CA4E69901285CD7808474 /* SDWeakProxy.m in Sources */,\n\t\t\t\tC08C35AA98A208273D1C8758C856B188 /* SDWebImage-dummy.m in Sources */,\n\t\t\t\t39463C913813D0838138400D2A7A399C /* SDWebImageCacheKeyFilter.m in Sources */,\n\t\t\t\t53881FE5ABC1A5E4ED04173787A66203 /* SDWebImageCacheSerializer.m in Sources */,\n\t\t\t\tE41924C55EF72B58917C6CFF047270DA /* SDWebImageCompat.m in Sources */,\n\t\t\t\t1A53DB9033809C32E23357EC16F81509 /* SDWebImageDefine.m in Sources */,\n\t\t\t\t5857D3DD95E3A3A09DD988E94CB57419 /* SDWebImageDownloader.m in Sources */,\n\t\t\t\tC90EF93938354BC7C6B470EEEBB09F6C /* SDWebImageDownloaderConfig.m in Sources */,\n\t\t\t\tDD5134AB9EAB2562A2D69D0637A5124D /* SDWebImageDownloaderDecryptor.m in Sources */,\n\t\t\t\t1083CE42F0BC3374608F13F226507156 /* SDWebImageDownloaderOperation.m in Sources */,\n\t\t\t\tB16F0B99A78AE36B96472E42F643CE9D /* SDWebImageDownloaderRequestModifier.m in Sources */,\n\t\t\t\tA8034D4C2B3407D5548D650CF881D6B9 /* SDWebImageDownloaderResponseModifier.m in Sources */,\n\t\t\t\t567B42476A7F95BDE8EB38AADC1D994D /* SDWebImageError.m in Sources */,\n\t\t\t\tE20F562CDEC2C1A84404D7C6B1C940E6 /* SDWebImageIndicator.m in Sources */,\n\t\t\t\t619AA6344E251075187177818FDFE6CB /* SDWebImageManager.m in Sources */,\n\t\t\t\tA2143819203DFCF08B0D00995A0477A9 /* SDWebImageOperation.m in Sources */,\n\t\t\t\t7CAD02304CE20F19562B3372B30CF504 /* SDWebImageOptionsProcessor.m in Sources */,\n\t\t\t\t41559433269385202C704240F989DB22 /* SDWebImagePrefetcher.m in Sources */,\n\t\t\t\tB26182BC860A4871D7DA1ADDE04AD1E3 /* SDWebImageTransition.m in Sources */,\n\t\t\t\tC75C57ABEC833416CDEBDA658757CD58 /* UIButton+WebCache.m in Sources */,\n\t\t\t\tB1520092AB7F08C4FEFFD651696774F6 /* UIColor+SDHexString.m in Sources */,\n\t\t\t\t7670D5362F015B792496C1C73003C6F7 /* UIImage+ExtendedCacheData.m in Sources */,\n\t\t\t\t107453FE42293C03B140B6F2DCB57417 /* UIImage+ForceDecode.m in Sources */,\n\t\t\t\tBF79AC5C68631B99C8805C2D30EDEDDF /* UIImage+GIF.m in Sources */,\n\t\t\t\t5073144967ED8F8F22823D7ED8EA988B /* UIImage+MemoryCacheCost.m in Sources */,\n\t\t\t\tEDC509F2FF438627A00F3B0F2F50AA5A /* UIImage+Metadata.m in Sources */,\n\t\t\t\tC9E491C8F020975770ED0CA03547A2F2 /* UIImage+MultiFormat.m in Sources */,\n\t\t\t\t8B6F63CE501F3004E4ECE579F169D38F /* UIImage+Transform.m in Sources */,\n\t\t\t\tE9BC3110F50B5FF6991DA03DC3DA2B80 /* UIImageView+HighlightedWebCache.m in Sources */,\n\t\t\t\t43F7B8B8379EAE6D455C503364006E57 /* UIImageView+WebCache.m in Sources */,\n\t\t\t\t5FA26E57153263D3F543E9363BF7F123 /* UIView+WebCache.m in Sources */,\n\t\t\t\t6D85CB8F85268AF029DC8287850B5C2E /* UIView+WebCacheOperation.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t09B2FB7926129797F3DFF9ABE82F6477 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t1114965B3DA7481F5BDF4C49F06E6213 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t7086DA866B355EC786FE92144773E207 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = E2A0B7D6A1A50EE9135CCF5029CBAA68 /* SDWebImage.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SDWebImage/SDWebImage-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SDWebImage/SDWebImage-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SDWebImage/SDWebImage.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SDWebImage;\n\t\t\t\tPRODUCT_NAME = SDWebImage;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tD464BA8F1C318AC75B6C79D21B0014E8 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = AEB9D28C04C9DE2878406904E8AF611D /* SDWebImage.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SDWebImage/SDWebImage-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SDWebImage/SDWebImage-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SDWebImage/SDWebImage.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SDWebImage;\n\t\t\t\tPRODUCT_NAME = SDWebImage;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3358AAB3E9A96AF9A87B5B31701E372F /* Build configuration list for PBXProject \"SDWebImage\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t09B2FB7926129797F3DFF9ABE82F6477 /* Debug */,\n\t\t\t\t1114965B3DA7481F5BDF4C49F06E6213 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tB0596298A997619B278D07CF1AB7E1A2 /* Build configuration list for PBXNativeTarget \"SDWebImage\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7086DA866B355EC786FE92144773E207 /* Debug */,\n\t\t\t\tD464BA8F1C318AC75B6C79D21B0014E8 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 8654C589048010934C79D870E55A473A /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/LICENSE",
    "content": "Tencent is pleased to support the open source community by making WCDB available.  \n\nCopyright (C) 2017 THL A29 Limited, a Tencent company.  All rights reserved.\nIf you have downloaded a copy of the WCDB binary from Tencent, please note that \nthe WCDB binary is licensed under the BSD 3-Clause License.\n\nIf you have downloaded a copy of the WCDB source code from Tencent, please note \nthat WCDB source code is licensed under the BSD 3-Clause License, except for \nthe third-party components listed below which are subject to different license \nterms.  Your integration of WCDB into your own projects may require compliance \nwith the BSD 3-Clause License, as well as the other licenses applicable to the \nthird-party components included within WCDB.\n\nA copy of the BSD 3-Clause License is included in this file.\nOther dependencies and licenses:\n \nOpen Source Software Licensed Under the Apache License, Version 2.0: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n\n----------------------------------------------------------------------------------------\n1. Android Source Code  4.3\nCopyright (C) 2006-2011 The Android Open Source Project \n \n \nTerms of the Apache License, Version 2.0:\n---------------------------------------------------\nApache License\n\nVersion 2.0, January 2004\n\nhttp://www.apache.org/licenses/\n \nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n \n1. Definitions.\n \n“License” shall mean the terms and conditions for use, reproduction, and distribution\nas defined by Sections 1 through 9 of this document.\n \n“Licensor” shall mean the copyright owner or entity authorized by the copyright owner\nthat is granting the License.\n \n“Legal Entity” shall mean the union of the acting entity and all other entities that \ncontrol, are controlled by, or are under common control with that entity. For the \npurposes of this definition, “control” means (i) the power, direct or indirect, to \ncause the direction or management of such entity, whether by contract or otherwise, \nor (ii) ownership of fifty percent (50%) or more of the outstanding shares, or \n(iii) beneficial ownership of such entity.\n \n“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions \ngranted by this License.\n \n“Source” form shall mean the preferred form for making modifications, including but \nnot limited to software source code, documentation source, and configuration files.\n \n“Object” form shall mean any form resulting from mechanical transformation or \ntranslation of a Source form, including but not limited to compiled object code, \ngenerated documentation, and conversions to other media types.\n \n“Work” shall mean the work of authorship, whether in Source or Object form, made \navailable under the License, as indicated by a copyright notice that is included \nin or attached to the work (an example is provided in the Appendix below).\n \n“Derivative Works” shall mean any work, whether in Source or Object form, that is \nbased on (or derived from) the Work and for which the editorial revisions, \nannotations, elaborations, or other modifications represent, as a whole, an \noriginal work of authorship. For the purposes of this License, Derivative Works \nshall not include works that remain separable from, or merely link (or bind by \nname) to the interfaces of, the Work and Derivative Works thereof.\n \n“Contribution” shall mean any work of authorship, including the original version \nof the Work and any modifications or additions to that Work or Derivative Works \nthereof, that is intentionally submitted to Licensor for inclusion in the Work \nby the copyright owner or by an individual or Legal Entity authorized to submit \non behalf of the copyright owner. For the purposes of this definition, “submitted” \nmeans any form of electronic, verbal, or written communication sent to the \nLicensor or its representatives, including but not limited to communication on \nelectronic mailing lists, source code control systems, and issue tracking systems \nthat are managed by, or on behalf of, the Licensor for the purpose of discussing \nand improving the Work, but excluding communication that is conspicuously marked \nor otherwise designated in writing by the copyright owner as “Not a Contribution.”\n \n“Contributor” shall mean Licensor and any individual or Legal Entity on behalf \nof whom a Contribution has been received by Licensor and subsequently \nincorporated within the Work.\n \n2. Grant of Copyright License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable copyright license to reproduce, prepare \nDerivative Works of, publicly display, publicly perform, sublicense, and distribute \nthe Work and such Derivative Works in Source or Object form.\n \n3. Grant of Patent License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable (except as stated in this section) patent \nlicense to make, have made, use, offer to sell, sell, import, and otherwise transfer \nthe Work, where such license applies only to those patent claims licensable by such \nContributor that are necessarily infringed by their Contribution(s) alone or by \ncombination of their Contribution(s) with the Work to which such Contribution(s) was \nsubmitted. If You institute patent litigation against any entity (including a \ncross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution \nincorporated within the Work constitutes direct or contributory patent infringement, \nthen any patent licenses granted to You under this License for that Work shall \nterminate as of the date such litigation is filed.\n \n4. Redistribution. You may reproduce and distribute copies of the Work or Derivative \nWorks thereof in any medium, with or without modifications, and in Source or Object \nform, provided that You meet the following conditions:\n \na) You must give any other recipients of the Work or Derivative Works a copy of this \nLicense; and\n \nb) You must cause any modified files to carry prominent notices stating that You \nchanged the files; and\n \nc) You must retain, in the Source form of any Derivative Works that You distribute, \nall copyright, patent, trademark, and attribution notices from the Source form of \nthe Work, excluding those notices that do not pertain to any part of the Derivative \nWorks; and\n \nd) If the Work includes a “NOTICE” text file as part of its distribution, then any \nDerivative Works that You distribute must include a readable copy of the attribution \nnotices contained within such NOTICE file, excluding those notices that do not pertain \nto any part of the Derivative Works, in at least one of the following places: within \na NOTICE text file distributed as part of the Derivative Works; within the Source \nform or documentation, if provided along with the Derivative Works; or, within a \ndisplay generated by the Derivative Works, if and wherever such third-party notices \nnormally appear. The contents of the NOTICE file are for informational purposes only \nand do not modify the License. You may add Your own attribution notices within \nDerivative Works that You distribute, alongside or as an addendum to the NOTICE text \nfrom the Work, provided that such additional attribution notices cannot be construed \nas modifying the License. \n \nYou may add Your own copyright statement to Your modifications and may provide \nadditional or different license terms and conditions for use, reproduction, or \ndistribution of Your modifications, or for any such Derivative Works as a whole, \nprovided Your use, reproduction, and distribution of the Work otherwise complies with \nthe conditions stated in this License. \n \n5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution \nintentionally submitted for inclusion in the Work by You to the Licensor shall be under \nthe terms and conditions of this License, without any additional terms or conditions. \nNotwithstanding the above, nothing herein shall supersede or modify the terms of any \nseparate license agreement you may have executed with Licensor regarding such \nContributions.\n \n6. Trademarks. This License does not grant permission to use the trade names, trademarks, \nservice marks, or product names of the Licensor, except as required for reasonable and \ncustomary use in describing the origin of the Work and reproducing the content of the \nNOTICE file.\n \n7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, \nLicensor provides the Work (and each Contributor provides its Contributions) on an \n“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, \nincluding, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, \nMERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for \ndetermining the appropriateness of using or redistributing the Work and assume any risks \nassociated with Your exercise of permissions under this License.\n \n8. Limitation of Liability. In no event and under no legal theory, whether in tort \n(including negligence), contract, or otherwise, unless required by applicable law (such \nas deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor \nbe liable to You for damages, including any direct, indirect, special, incidental, or \nconsequential damages of any character arising as a result of this License or out of the \nuse or inability to use the Work (including but not limited to damages for loss of \ngoodwill, work stoppage, computer failure or malfunction, or any and all other commercial \ndamages or losses), even if such Contributor has been advised of the possibility of such \ndamages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative \nWorks thereof, You may choose to offer, and charge a fee for, acceptance of support, \nwarranty, indemnity, or other liability obligations and/or rights consistent with this \nLicense. However, in accepting such obligations, You may act only on Your own behalf and \non Your sole responsibility, not on behalf of any other Contributor, and only if You agree \nto indemnify, defend, and hold each Contributor harmless for any liability incurred by, or \nclaims asserted against, such Contributor by reason of your accepting any such warranty or \nadditional liability.\n \nEND OF TERMS AND CONDITIONS\n \nAPPENDIX: How to apply the Apache License to your work\nTo apply the Apache License to your work, attach the following boilerplate notice, with the \nfields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't \ninclude the brackets!) The text should be enclosed in the appropriate comment syntax for \nthe file format. We also recommend that a file or class name and description of purpose be \nincluded on the same \"printed page\" as the copyright notice for easier identification within \nthird-party archives.\n \nCopyright [yyyy] [name of copyright owner]\n \nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n \n \n \nOpen Source Software Licensed Under Public Domain: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLite  3.11.0\n \n \n \nOpen Source Software Licensed Under the OpenSSL License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. OpenSSL  1.0.2j\nCopyright (c) 1998-2016 The OpenSSL Project.\nAll rights reserved.\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \n \n \nTerms of the OpenSSL License:\n---------------------------------------------------\nLICENSE ISSUES:\n--------------------------------------------------------------------\n \nThe OpenSSL toolkit stays under a dual license, i.e. both the conditions of the \nOpenSSL License and the original SSLeay license apply to the toolkit.\nSee below for the actual license texts.\n \nOpenSSL License:\n--------------------------------------------------------------------\nCopyright (c) 1998-2016 The OpenSSL Project.  All rights reserved.\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n \n1. Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n \n2. Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n \n3. All advertising materials mentioning features or use of this software must \ndisplay the following acknowledgment:\n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit. (http://www.openssl.org/)\"\n \n4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to endorse or \npromote products derived from this software without prior written permission. For \nwritten permission, please contact openssl-core@openssl.org.\n \n5. Products derived from this software may not be called \"OpenSSL\" nor may \"OpenSSL\" \nappear in their names without prior written permission of the OpenSSL Project.\n \n6. Redistributions of any form whatsoever must retain the following acknowledgment: \n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/)\"\n \nTHIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR \nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \nSHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE. \n====================================================================\n* This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).  \nThis product includes software written by Tim Hudson (tjh@cryptsoft.com).\n \n \nOriginal SSLeay License:\n--------------------------------------------------------------------\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \nThis package is an SSL implementation written by Eric Young (eay@cryptsoft.com).\nThe implementation was written so as to conform with Netscapes SSL.\n \nThis library is free for commercial and non-commercial use as long as the following \nconditions are aheared to. The following conditions apply to all code found in this \ndistribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. \nThe SSL documentation included with this distribution is covered by the same copyright \nterms except that the holder is Tim Hudson (tjh@cryptsoft.com). \n \nCopyright remains Eric Young's, and as such any Copyright notices in the code are not \nto be removed.  If this package is used in a product, Eric Young should be given \nattribution as the author of the parts of the library used. This can be in the form \nof a textual message at program startup or in documentation (online or textual) \nprovided with the package. \n  \nRedistribution and use in source and binary forms, with or without modification, are \npermitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the copyright notice, this list of \nconditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list \nof conditions and the following disclaimer in the documentation and/or other materials \nprovided with the distribution.\n\n3. All advertising materials mentioning features or use of this software must display \nthe following acknowledgement:\" This product includes cryptographic software written \nby Eric Young (eay@cryptsoft.com)\" The word 'cryptographic' can be left out if the \nrouines from the library being used are not cryptographic related :-).\n\n4. If you include any Windows specific code (or a derivative thereof) from the apps \ndirectory (application code) you must include an acknowledgement: \"This product includes \nsoftware written by Tim Hudson (tjh@cryptsoft.com)\"\n \nTHIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, \nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR \nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE \nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH \nDAMAGE. \n  \nThe licence and distribution terms for any publically available version or derivative of \nthis code cannot be changed.  i.e. this code cannot simply be copied and put under another \ndistribution licence [including the GNU Public Licence.]\n \n \n \nOpen Source Software Licensed Under the ICU License: \n----------------------------------------------------------------------------------------\n1. ICU4C  50.1\nCopyright (c) 1995-2012 International Business Machines Corporation and others\nAll rights reserved.\n \n \nTerms of the ICU License:\n--------------------------------------------------------------------\nICU License - ICU 1.8.1 and later\n \nCOPYRIGHT AND PERMISSION NOTICE\n \nCopyright (c) 1995-2012 International Business Machines Corporation and others\n \nAll rights reserved.\n \nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in the \nSoftware without restriction, including without limitation the rights to use, copy, \nmodify, merge, publish, distribute, and/or sell copies of the Software, and to permit \npersons to whom the Software is furnished to do so, provided that the above copyright \nnotice(s) and this permission notice appear in all copies of the Software and that both \nthe above copyright notice(s) and this permission notice appear in supporting \ndocumentation.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, \nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \nPURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER \nOR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR \nCONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR \nPROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING \nOUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \nExcept as contained in this notice, the name of a copyright holder shall not be used in \nadvertising or otherwise to promote the sale, use or other dealings in this Software \nwithout prior written authorization of the copyright holder.\n \nAll trademarks and registered trademarks mentioned herein are the property of their \nrespective owners.\n \n \nOpen Source Software Licensed Under the BSD 3-Clause License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLCipher  3.4.0\nCopyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n \n \n \nTerms of the BSD 3-Clause License:\n--------------------------------------------------------------------\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n\nl  Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n\nl  Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n\nl  Neither the name of [copyright holder] nor the names of its contributors may be \nused to endorse or promote products derived from this software without specific \nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/README.md",
    "content": "# WCDB\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/wcdb/pulls)\n[![Release Version](https://img.shields.io/badge/release-1.0.5-brightgreen.svg)](https://github.com/Tencent/wcdb/releases)\n[![WeChat Approved iOS](https://img.shields.io/badge/Wechat_Approved_iOS-1.0.5-brightgreen.svg)](https://github.com/Tencent/wcdb/blob/master/README.md#wcdb-for-iosmacos)\n[![WeChat Approved Android](https://img.shields.io/badge/Wechat_Approved_Android-1.0.5-brightgreen.svg)](https://github.com/Tencent/wcdb/blob/master/README.md#wcdb-for-android)\n[![Platform](https://img.shields.io/badge/Platform-%20iOS%20%7C%20macOS%20%7C%20Android-brightgreen.svg)](https://github.com/Tencent/wcdb/wiki)\n\n中文版本请参看[这里][wcdb-wiki]\n\nWCDB is an **efficient**, **complete**, **easy-to-use** mobile database framework used in the WeChat application. It's currently available on iOS, macOS and Android.\n\n# WCDB for iOS/macOS\n\n## Features\n\n* **Easy-to-use**. Through WCDB, you can get objects from database in one line code. \n\n  * **WINQ** (WCDB language integrated query): WINQ is a native data querying capability which frees developers from writing glue code to concatenate SQL query strings.\n\n  * **ORM** (Object Relational Mapping): WCDB provides a flexible, easy-to-use ORM for creating tables, indices and constraints, as well as CRUD through ObjC objects.\n\n    ```objective-c\n    [database getObjectsOfClass:WCTSampleConvenient.class\n                      fromTable:tableName\n                          where:WCTSampleConvenient.intValue>=10\n                          limit:20];\n    ```\n\n* **Efficient**. Through the framework layer and sqlcipher source optimization, WCDB have more efficient performance.\n\n  * **Multi-threaded concurrency**: WCDB supports concurrent read-read and read-write access via connection pooling.\n  * **Batch Write Performance Test**.\n    ![](https://raw.githubusercontent.com/wiki/Tencent/wcdb/assets/benchmark/baseline_batch_write.png)\n    For more benchmark data, please refer to [our benchmark][Benchmark-iOS].\n\n* **Complete**.\n\n  * **Encryption Support**: WCDB supports database encryption via [SQLCipher][sqlcipher].\n  * **Corruption recovery**: WCDB provides a built-in repair kit for database corruption recovery.\n  * **Anti-injection**: WCDB provides a built-in protection from SQL injection.\n\n## Getting Started\n\n### Prerequisites\n\n* Apps using WCDB can target: iOS 7 or later, macOS 10.9 or later.\n* Xcode 8.0 or later required.\n* Objective-C++ required.\n\n### Installation\n\n* **Via Cocoapods:**\n  1. Install [CocoaPods.](https://guides.cocoapods.org/using/getting-started.html)\n  2. Run `pod repo update` to make CocoaPods aware of the latest available WCDB versions.\n  3. In your Podfile, add `pod 'WCDB'` to your app target.\n  4. From the command line, run `pod install`.\n  5. Use the `.xcworkspace` file generated by CocoaPods to work on your project.\n  6. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  7. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n* **Via Carthage:** \n  1. Install [Carthage][install-carthage].\n  2. Add `github \"Tencent/WCDB\"` to your Cartfile.\n  3. Run `carthage update`.\n  4. Drag `WCDB.framework` from the appropriate platform directory in `Carthage/Build/` to the `Linked Binary and Libraries` section of your Xcode project’s `Build Phases` settings.\n  5. On your application targets' `Build Phases` settings tab, click the \"+\" icon and choose `New Run Script Phase`. Create a Run Script with  `carthage copy-frameworks` and add the paths to the frameworks under `Input Files`: `$(SRCROOT)/Carthage/Build/iOS/WCDB.framework` or `$(SRCROOT)/Carthage/Build/Mac/WCDB.framework`.\n  6. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  7. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n* **Via Dynamic Framework**: \n  **Note that Dynamic frameworks are not compatible with iOS 7. See “Static Framework” for iOS 7 support.**\n  1. Getting source code from git repository and update the submodule of sqlcipher.\n     - `git clone https://github.com/Tencent/wcdb.git`\n     - `cd wcdb`\n     - `git submodule update --init sqlcipher ` \n  2. Drag `WCDB.xcodeproj` in `wcdb/apple/` into your project.\n  3. Add `WCDB.framework` to the `Enbedded Binaries` section of your Xcode project's `General settings`. **Note that there are two frameworks here and the dynamic one should be chosen. You can check it at `Build Phases`->`Target Dependencies`. The right one is `WCDB` while `WCDB iOS Static is used for static lib.**\n  4. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  5. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n* **Via Static Framework:**\n  1. Getting source code from git repository and update the submodule of sqlcipher.\n     - `git clone https://github.com/Tencent/wcdb.git`\n     - `cd wcdb`\n     - `git submodule update --init sqlcipher ` \n  2. Drag `WCDB.xcodeproj` in `wcdb/apple/` into your project.\n  3. Add `WCDB iOS Static` to the `Target Dependencies` section of your Xcode project's `Build Phases` settings.\n  4. Add `WCDB.framework`， `libz.tbd` to the `Linked Binary and Libraries` section of your Xcode project's `Build Phases` settings. Note that there are two `WCDB.framework`, you should choose the one from `WCDB iOS Static` target.\n  5. Add `-all_load` and `-ObjC` to the `Other Linker Flags` section of your Xcode project's `Build Settings`.\n  6. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  7. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n\n## Tutorials\n\nTutorials can be found [here][iOS-tutorial].\n\n## Documentations\n\n* Documentations can be found on [our Wiki][wcdb-wiki].\n* API references for iOS/macOS can be found [here][wcdb-docs-ios].\n* Performance data can be found on [our benchmark][Benchmark-iOS].\n\n# WCDB for Android\n\n## Features\n\n* Database encryption via [SQLCipher][sqlcipher].\n* ORM/persistence solution via [Room][room] from Android Architecture Components.\n* Concurrent access via connection pooling from modern Android framework.\n* Repair toolkit for database corruption recovery.\n* Database backup and recovery utility optimized for small backup size.\n* Log redirection and various tracing facilities.\n* API 14 (Android 4.0) and above are supported.\n\n## Getting Started\n\nTo include WCDB to your project, choose either way: import via Maven or via AAR package. \n\n### Import via Maven\n\nTo import WCDB via Maven repositories, add the following lines to `build.gradle` on your\napp module: \n\n```gradle\ndependencies {\n    compile 'com.tencent.wcdb:wcdb-android:1.0.8'\n    // Replace \"1.0.8\" to any available version.\n}\n```\n\nThis will cause Gradle to download AAR package from JCenter while building your application.\n\nIf you want to use Room persistence library, you need to add the Google Maven repository to\n`build.gradle` to your **root project**.\n\n```gradle\nallprojects {\n    repositories {\n        jcenter()\n        google()    // Add this line\n    }\n}\n```\n\nAlso add dependencies to module `build.gradle`.\n\n```gradle\ndependencies {\n    compile 'com.tencent.wcdb:room:1.0.8'\n    // Replace \"1.0.8\" to any available version.\n\n    annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'\n    // Don't forget to include Room annotation compiler from Google.\n}\n```\n\n### Import Prebuilt AAR Package\n\n    1. **Download AAR package from release page.**\n    2. **Import the AAR as new module.** In Android Studio, select `File -> New -> New Module...` menu and choose `\"Import JAR/AAR Package\"`.\n    3. **Add a dependency on the new module.** This can be done using `File -> Project Structure...` in Android Studio, or by adding following code to application's `build.gradle`:\n```gradle\ndependencies {\n    // Change \"wcdb\" to the actual module name specified in step 2.\n    compile project(':wcdb')\n}\n```\n\n### Migrate from Plain-text SQLite Databases\n\nWCDB has interfaces very similar to Android SQLite Database APIs. To migrate you application from\nAOSP API, change import path from `android.database.*` to `com.tencent.wcdb.*`, and \n`android.database.sqlite.*` to `com.tencent.wcdb.database.*`. After import path update, \nyour application links to WCDB instead of AOSP API.\n\nTo open or create an encrypted database, use with-password versions of \n`SQLiteDatabase.openOrCreateDatabase()`, `SQLiteOpenHelper.getWritableDatabase()`, \nor `Context.openOrCreateDatabase()`.\n\n*Note: WCDB uses `byte[]` for password instead of `String` in SQLCipher Android Binding.*\n\n```java\nString password = \"MyPassword\";\nSQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(\"/path/to/database\", password.getBytes(), \n        null, null);\n```\n\nSee `sample-encryptdb` for sample for transferring data between plain-text and encrypted\ndatabases.\n\n### Use WCDB with Room\n\nTo use WCDB with Room library, follow the [Room instructions][room]. The only code to change\nis specifying `WCDBOpenHelperFactory` when getting instance of the database.\n\n```java\nSQLiteCipherSpec cipherSpec = new SQLiteCipherSpec()\n        .setPageSize(4096)\n        .setKDFIteration(64000);\n\nWCDBOpenHelperFactory factory = new WCDBOpenHelperFactory()\n        .passphrase(\"passphrase\".getBytes())  // passphrase to the database, remove this line for plain-text\n        .cipherSpec(cipherSpec)               // cipher to use, remove for default settings\n        .writeAheadLoggingEnabled(true)       // enable WAL mode, remove if not needed\n        .asyncCheckpointEnabled(true);        // enable asynchronous checkpoint, remove if not needed\n\nAppDatabase db = Room.databaseBuilder(this, AppDatabase.class, \"app-db\")\n                .allowMainThreadQueries()\n                .openHelperFactory(factory)   // specify WCDBOpenHelperFactory when opening database\n                .build();\n```\n\nSee `sample-persistence` for samples using Room library with WCDB.\nSee `sample-room-with-a-view` for samples using Room library with WCDB and other architecture components from Google.\n\n> `sample-room-with-a-view` comes from Google's CodeLabs with modification of just a few rows. Search for *\\[WCDB\\]* keyword for the modification.\n>\n> See [here][room-codelabs] for the original tutorial.\n\n### Corruption Recovery\n\nSee `sample-repairdb` for instructions how to recover corrupted databases using `RepairKit`.\n\n### Redirect Log Output\n\nBy default, WCDB prints its log message to system logcat. You may want to change this\nbehavior in order to, for example, save logs for troubleshooting. WCDB can redirect\nall of its log outputs to user-defined routine using `Log.setLogger(LogCallback)`\nmethod.\n\n## Build from Sources\n\n### Build WCDB Android with Prebuilt Dependencies\n\nWCDB itself can be built apart from its dependencies using Gradle or Android Studio. \nTo build WCDB Android library, run Gradle on `android` directory:\n\n```bash\n$ cd android\n$ ./gradlew build\n```\n\nBuilding WCDB requires Android NDK installed. If Gradle failed to find your SDK and/or \nNDK, you may need to create a file named `local.properties` on the `android` directory \nwith content:\n\n```\nsdk.dir=path/to/sdk\nndk.dir=path/to/ndk\n```\n\nAndroid Studio will do this for you when the project is imported.\n\n### Build Dependencies from Sources\n\nWCDB depends on OpenSSL crypto library and SQLCipher. You can rebuild all dependencies\nif you wish. In this case, a working C compiler on the host system, Perl 5, Tcl and a \nbash environment is needed to be installed on your system.\n\nTo build dependencies, checkout all submodules, set `ANDROID_NDK_ROOT` environment \nvariable to your NDK path, then run `build-depends-android.sh`:\n\n```bash\n$ export ANDROID_NDK_ROOT=/path/to/ndk\n$ ./build-depends-android.sh\n```\n\nThis will build OpenSSL crypto library and generate SQLCipher amalgamation sources\nand place them to proper locations suitable for WCDB library building.\n\n## Documentations\n\n* Documentations can be found on [our Wiki][wcdb-wiki].\n* API references for Android can be found [here][wcdb-docs-android].\n\n## Contributing\n\nIf you are interested in contributing, check out the [CONTRIBUTING.md], also join our [Tencent OpenSource Plan](https://opensource.tencent.com/contribution).\n\n[install-carthage]: https://github.com/Carthage/Carthage#installing-carthage\n[wcdb-wiki]: https://github.com/Tencent/wcdb/wiki\n[wcdb-docs-ios]: https://tencent.github.io/wcdb/references/ios/index.html\n[wcdb-docs-android]: https://tencent.github.io/wcdb/references/android/index.html\n[sqlcipher]: https://github.com/sqlcipher/sqlcipher\n[room]: https://developer.android.com/topic/libraries/architecture/room\n[room-codelabs]: https://codelabs.developers.google.com/codelabs/android-room-with-a-view\n[iOS-tutorial]: https://github.com/Tencent/wcdb/wiki/iOS-macOS-Tutorial\n[Benchmark-iOS]: https://github.com/Tencent/wcdb/wiki/WCDB-iOS-benchmark\n\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/SQLiteRepairKit.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef SQLiteRepairKit_h\n#define SQLiteRepairKit_h\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <stdlib.h>\n\ntypedef struct sqliterk sqliterk;\ntypedef struct sqliterk_table sqliterk_table;\ntypedef struct sqliterk_column sqliterk_column;\n\ntypedef struct sqliterk_notify sqliterk_notify;\nstruct sqliterk_notify {\n    void (*onBeginParseTable)(sqliterk *rk, sqliterk_table *table);\n    // Only a column that make sense will trigger this callback,\n    // which is the column in a non-system table or the \"sqlite_master\"\n    // return SQLITERK_OK to tell sqliterk that you already know that\n    // meaning of this column\n    int (*onParseColumn)(sqliterk *rk,\n                         sqliterk_table *table,\n                         sqliterk_column *column);\n    void (*onEndParseTable)(sqliterk *rk, sqliterk_table *table);\n    void (*didParsePage)(sqliterk *rk, int pageno);\n};\nint sqliterk_register_notify(sqliterk *rk, sqliterk_notify notify);\n\ntypedef struct sqliterk_cipher_conf {\n    const void *key;\n    int key_len;\n    const char *cipher_name;\n    int page_size;\n    int kdf_iter;\n    int use_hmac;\n    const unsigned char *kdf_salt;\n} sqliterk_cipher_conf;\n    \nvoid sqliterk_cipher_conf_set_key(sqliterk_cipher_conf *conf, const void* key, int key_len);\n\ntypedef struct sqlite3 sqlite3;\ntypedef struct sqliterk_master_info sqliterk_master_info;\n\n#define SQLITERK_OUTPUT_NO_CREATE_TABLES 0x0001\n#define SQLITERK_OUTPUT_ALL_TABLES 0x0002\n\nint sqliterk_open(const char *path,\n                  const sqliterk_cipher_conf *cipher,\n                  sqliterk **rk);\nint sqliterk_parse(sqliterk *rk);\nint sqliterk_parse_page(sqliterk *rk, int pageno);\nint sqliterk_parse_master(sqliterk *rk);\nint sqliterk_close(sqliterk *rk);\nvoid *sqliterk_get_user_info(sqliterk *rk);\nvoid sqliterk_set_user_info(sqliterk *rk, void *userInfo);\nvoid sqliterk_set_recursive(sqliterk *rk, int recursive);\n\nint sqliterk_output(sqliterk *rk,\n                    sqlite3 *db,\n                    sqliterk_master_info *master,\n                    unsigned int flags);\nint sqliterk_output_cb(sqliterk *rk,\n                       sqlite3 *db,\n                       sqliterk_master_info *master,\n                       unsigned int flags,\n                       int (*callback)(void *user,\n                                       sqliterk *rk,\n                                       sqliterk_table *table,\n                                       sqliterk_column *column),\n                       void *user);\nvoid sqliterk_cancel(sqliterk *rk);\nint sqliterk_make_master(const char **tables,\n                         int num_tables,\n                         sqliterk_master_info **out_master);\nint sqliterk_save_master(sqlite3 *db,\n                         const char *path,\n                         const void *key,\n                         int key_len);\nint sqliterk_load_master(const char *path,\n                         const void *key,\n                         int key_len,\n                         const char **tables,\n                         int num_tables,\n                         sqliterk_master_info **out_master,\n                         unsigned char *out_kdf_salt);\nvoid sqliterk_free_master(sqliterk_master_info *master);\n\n// A database may have many kind of tables or indexes, such as a customized\n// index or a system-level table and so on. But you should be only concern\n// about the listed types below.\n// Since the system-level tables or indexes is generated. And you do know\n// the index of a certain table (you make this table).\ntypedef enum {\n    sqliterk_type_index = -2,\n    sqliterk_type_table = -1,\n    sqliterk_type_unknown = 0,\n    sqliterk_type_sequence = 1,\n    sqliterk_type_autoindex = 2,\n    sqliterk_type_stat = 3,\n    sqliterk_type_master = 4,\n} sqliterk_type;\n\n// This method may return NULL since SQLiteRepairKir may not understand\n// a corrupted b-tree.\nconst char *sqliterk_table_name(sqliterk_table *table);\nsqliterk_type sqliterk_table_type(sqliterk_table *table);\nint sqliterk_table_root(sqliterk_table *table);\nvoid sqliterk_table_set_user_info(sqliterk_table *table, void *userInfo);\nvoid *sqliterk_table_get_user_info(sqliterk_table *table);\n\ntypedef enum {\n    sqliterk_value_type_null,\n    sqliterk_value_type_integer,\n    sqliterk_value_type_number,\n    sqliterk_value_type_text,\n    sqliterk_value_type_binary,\n} sqliterk_value_type;\n\nint sqliterk_column_count(sqliterk_column *column);\nsqliterk_value_type sqliterk_column_type(sqliterk_column *column, int index);\nint sqliterk_column_integer(sqliterk_column *column, int index);\nint64_t sqliterk_column_integer64(sqliterk_column *column, int index);\ndouble sqliterk_column_number(sqliterk_column *column, int index);\nconst char *sqliterk_column_text(sqliterk_column *column, int index);\nconst void *sqliterk_column_binary(sqliterk_column *column, int index);\nint sqliterk_column_bytes(sqliterk_column *column, int index);\nint64_t sqliterk_column_rowid(sqliterk_column *column);\n\n#define SQLITERK_INTEGRITY_HEADER 0x0001\n#define SQLITERK_INTEGRITY_DATA 0x0002\n#define SQLITERK_INTEGRITY_KDF_SALT 0x0004\n\nint sqliterk_parsed_page_count(sqliterk *rk);\nint sqliterk_valid_page_count(sqliterk *rk);\nint sqliterk_page_count(sqliterk *rk);\nunsigned int sqliterk_integrity(sqliterk *rk);\n\ntypedef enum {\n    sqliterk_loglevel_debug,\n    sqliterk_loglevel_warning,\n    sqliterk_loglevel_error,\n    sqliterk_loglevel_info,\n} sqliterk_loglevel;\n\ntypedef struct sqliterk_os sqliterk_os;\nstruct sqliterk_os {\n    void (*xLog)(sqliterk_loglevel level, int result, const char *msg);\n    //TODO\n};\nint sqliterk_register(sqliterk_os os);\n\n#define SQLITERK_OK 0\n#define SQLITERK_CANTOPEN 1\n#define SQLITERK_MISUSE 2\n#define SQLITERK_IOERR 3\n#define SQLITERK_NOMEM 4\n#define SQLITERK_SHORT_READ 5\n#define SQLITERK_DAMAGED 6\n#define SQLITERK_DISCARD 7\n#define SQLITERK_CANCELLED 8\n#define SQLITERK_IGNORE 100\nconst char *sqliterk_description(int result);\n\n#ifndef SQLITRK_CONFIG_DEFAULT_PAGESIZE\n#define SQLITRK_CONFIG_DEFAULT_PAGESIZE 4096\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* SQLiteRepairKit_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk.h\"\n#include \"SQLiteRepairKit.h\"\n#include \"sqliterk_btree.h\"\n#include \"sqliterk_column.h\"\n#include \"sqliterk_os.h\"\n#include \"sqliterk_pager.h\"\n#include \"sqliterk_util.h\"\n#include \"sqliterk_values.h\"\n#include <string.h>\n\nstruct sqliterk {\n    sqliterk_pager *pager;\n    sqliterk_btree_notify listen;\n    sqliterk_notify notify;\n    void *userInfo;\n    char recursive;\n};\n\n//declaration\nstatic void sqliterkNotify_onBeginParseBtree(sqliterk *rk,\n                                             sqliterk_btree *btree);\nstatic void\nsqliterkNotify_onEndParseBtree(sqliterk *rk, sqliterk_btree *btree, int result);\nstatic int sqliterkNotify_onParseColumn(sqliterk *rk,\n                                        sqliterk_btree *btree,\n                                        sqliterk_page *page,\n                                        sqliterk_column *column);\nstatic int sqliterkNotify_onBeginParsePage(sqliterk *rk,\n                                           sqliterk_btree *btree,\n                                           int pageno);\nstatic void sqliterkNotify_onEndParsePage(sqliterk *rk,\n                                          sqliterk_btree *btree,\n                                          int pageno,\n                                          int result);\nstatic int sqliterkParseBtree(sqliterk *rk, sqliterk_btree *btree);\n\nint sqliterkOpen(const char *path,\n                 const sqliterk_cipher_conf *cipher,\n                 sqliterk **rk)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk *therk = sqliterkOSMalloc(sizeof(sqliterk));\n    if (!therk) {\n        rc = SQLITERK_NOMEM;\n        sqliterkOSError(rc, \"Not enough memory, required: %zu bytes\",\n                        sizeof(sqliterk));\n        goto sqliterkOpen_Failed;\n    }\n\n    rc = sqliterkPagerOpen(path, cipher, &therk->pager);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkOpen_Failed;\n    }\n\n    therk->listen.onBeginParsePage = sqliterkNotify_onBeginParsePage;\n    therk->listen.onEndParsePage = sqliterkNotify_onEndParsePage;\n    therk->listen.onBeginParseBtree = sqliterkNotify_onBeginParseBtree;\n    therk->listen.onEndParseBtree = sqliterkNotify_onEndParseBtree;\n    therk->listen.onParseColumn = sqliterkNotify_onParseColumn;\n    therk->recursive = 1;\n\n    *rk = therk;\n    sqliterkOSInfo(SQLITERK_OK, \"RepairKit on '%s' opened, %s.\", path,\n                   cipher ? \"encrypted\" : \"plain-text\");\n    return SQLITERK_OK;\n\nsqliterkOpen_Failed:\n    if (therk) {\n        sqliterkClose(therk);\n    }\n    *rk = NULL;\n    return rc;\n}\n\nvoid sqliterk_set_recursive(sqliterk *rk, int recursive)\n{\n    rk->recursive = (char) recursive;\n}\n\nint sqliterkParse(sqliterk *rk)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n\n    int i;\n    for (i = 0; i < sqliterkPagerGetPageCount(rk->pager); i++) {\n        int pageno = i + 1;\n        sqliterkParsePage(rk, pageno);\n    }\n    return SQLITERK_OK;\n}\n\nint sqliterkParsePage(sqliterk *rk, int pageno)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n    if (sqliterkPagerGetStatus(rk->pager, pageno) !=\n        sqliterk_status_unchecked) {\n        return SQLITERK_OK;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk_btree *btree = NULL;\n    rc = sqliterkBtreeOpen(rk, rk->pager, pageno, &btree);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkParsePage_End;\n    }\n    rc = sqliterkParseBtree(rk, btree);\nsqliterkParsePage_End:\n    if (btree) {\n        sqliterkBtreeClose(btree);\n    }\n    return rc;\n}\n\nstatic int sqliterkParseBtree(sqliterk *rk, sqliterk_btree *btree)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n    sqliterk_page *page = sqliterkBtreeGetRootPage(btree);\n    int pageno = sqliterkPageGetPageno(page);\n    if (!page || sqliterkPagerIsPagenoValid(rk->pager, pageno) != SQLITERK_OK) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterkBtreeSetNotify(btree, &rk->listen);\n    rc = sqliterkBtreeParse(btree);\n    return rc;\n}\n\nint sqliterkParseMaster(sqliterk *rk)\n{\n    // The page 1 is always sqlite_master. See [B-tree Pages] at\n    // https://www.sqlite.org/fileformat2.html\n    return sqliterkParsePage(rk, 1);\n}\n\nint sqliterkClose(sqliterk *rk)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n    if (rk->pager) {\n        sqliterkPagerClose(rk->pager);\n        rk->pager = NULL;\n    }\n    sqliterkOSFree(rk);\n    return SQLITERK_OK;\n}\n\nstatic void sqliterkNotify_onBeginParseBtree(sqliterk *rk,\n                                             sqliterk_btree *btree)\n{\n    if (rk->notify.onBeginParseTable) {\n        rk->notify.onBeginParseTable(rk, (sqliterk_table *) btree);\n    }\n    sqliterk_page *rootpage = sqliterkBtreeGetRootPage(btree);\n    sqliterkOSDebug(\n        SQLITERK_OK, \"Parsing B-tree -> [root: %d, name: %s, type: %s]\",\n        sqliterkPageGetPageno(rootpage), sqliterkBtreeGetName(btree),\n        sqliterkBtreeGetTypeName(sqliterkBtreeGetType(btree)));\n}\n\nstatic void\nsqliterkNotify_onEndParseBtree(sqliterk *rk, sqliterk_btree *btree, int result)\n{\n    if (rk->notify.onEndParseTable) {\n        rk->notify.onEndParseTable(rk, (sqliterk_table *) btree);\n    }\n}\n\nstatic int sqliterkNotify_onParseColumn(sqliterk *rk,\n                                        sqliterk_btree *btree,\n                                        sqliterk_page *page,\n                                        sqliterk_column *column)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n\n    int result;\n    if (rk->notify.onParseColumn) {\n        result = rk->notify.onParseColumn(rk, (sqliterk_table *) btree, column);\n        if (result == SQLITERK_CANCELLED) {\n            return result;\n        } else if (result != SQLITERK_OK) {\n            int pageno = sqliterkPageGetPageno(page);\n            sqliterkPagerSetStatus(rk->pager, pageno,\n                                   sqliterk_status_discarded);\n            sqliterk_values *overflowPages =\n                sqliterkColumnGetOverflowPages(column);\n\n            int i;\n            for (i = 0; i < sqliterkValuesGetCount(overflowPages); i++) {\n                sqliterkPagerSetStatus(\n                    rk->pager, sqliterkValuesGetInteger(overflowPages, i),\n                    sqliterk_status_discarded);\n            }\n        }\n    } else {\n        result = SQLITERK_OK;\n    }\n\n    if (sqliterkBtreeGetType(btree) == sqliterk_btree_type_master &&\n        rk->recursive) {\n        // Recursively decode the page since the mapping of [table]->[rootPageno] is known\n        sqliterk_values *values = sqliterkColumnGetValues(column);\n        const char *type = sqliterkValuesGetText(values, 0);\n        const char *name = sqliterkValuesGetText(values, 1);\n        int rootPageno = sqliterkValuesGetInteger(values, 3);\n        int rc = SQLITERK_OK;\n        if (type && name) {\n            sqliterk_btree *subbtree;\n            rc = sqliterkBtreeOpen(rk, rk->pager, rootPageno, &subbtree);\n            if (rc == SQLITERK_OK) {\n                if (memcmp(\"table\", type, 5) == 0) {\n                    sqliterkBtreeSetMeta(subbtree, name,\n                                         sqliterk_btree_type_table);\n                } else if (memcmp(\"index\", type, 5) == 0) {\n                    sqliterkBtreeSetMeta(subbtree, name,\n                                         sqliterk_btree_type_index);\n                } else {\n                    sqliterkBtreeSetMeta(subbtree, name,\n                                         sqliterk_btree_type_unknown);\n                }\n                rc = sqliterkParseBtree(rk, subbtree);\n            }\n            if (rc != SQLITERK_OK) {\n                sqliterk_page *rootpage = sqliterkBtreeGetRootPage(subbtree);\n                sqliterkOSError(\n                    rc,\n                    \"sqliterkNotify_onParseColumn: failed to parse known \"\n                    \"table with root page no. %d, name %s, type %s\",\n                    sqliterkPageGetPageno(rootpage),\n                    sqliterkBtreeGetName(subbtree),\n                    sqliterkBtreeGetTypeName(sqliterkBtreeGetType(subbtree)));\n            }\n            if (subbtree) {\n                sqliterkBtreeClose(subbtree);\n            }\n        }\n    }\n\n    return result;\n}\n\nstatic int\nsqliterkNotify_onBeginParsePage(sqliterk *rk, sqliterk_btree *btree, int pageno)\n{\n    //sqliterkOSDebug(SQLITERK_OK, \"sqliterkNotify_onBeginParsePage: %d\", pageno);\n    if (sqliterkPagerGetStatus(rk->pager, pageno) == sqliterk_status_checking) {\n        return SQLITERK_MISUSE;\n    }\n    sqliterkPagerSetStatus(rk->pager, pageno, sqliterk_status_checking);\n    return SQLITERK_OK;\n}\n\nstatic void sqliterkNotify_onEndParsePage(sqliterk *rk,\n                                          sqliterk_btree *btree,\n                                          int pageno,\n                                          int result)\n{\n    if (!rk) {\n        return;\n    }\n    switch (result) {\n        case SQLITERK_OK:\n            sqliterkPagerSetStatus(rk->pager, pageno, sqliterk_status_checked);\n            break;\n        case SQLITERK_DAMAGED:\n            sqliterkPagerSetStatus(rk->pager, pageno, sqliterk_status_damaged);\n            break;\n        case SQLITERK_CANCELLED:\n            sqliterkOSDebug(SQLITERK_CANCELLED, \"Cancelled parsing page %d.\",\n                            pageno);\n            break;\n        default:\n            sqliterkOSWarning(SQLITERK_MISUSE,\n                              \"Cannot parse page %d. Invalid type.\", pageno);\n            sqliterkPagerSetStatus(rk->pager, pageno, sqliterk_status_invalid);\n            break;\n    }\n    //sqliterkOSDebug(result, \"sqliterkNotify_onEndParsePage: %d\", pageno);\n    if (rk->notify.didParsePage) {\n        rk->notify.didParsePage(rk, pageno);\n    }\n}\n\nint sqliterkSetNotify(sqliterk *rk, sqliterk_notify notify)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n    rk->notify = notify;\n    return SQLITERK_OK;\n}\n\nint sqliterkSetUserInfo(sqliterk *rk, void *userInfo)\n{\n    if (!rk) {\n        return SQLITERK_MISUSE;\n    }\n    rk->userInfo = userInfo;\n    return SQLITERK_OK;\n}\n\nvoid *sqliterkGetUserInfo(sqliterk *rk)\n{\n    if (!rk) {\n        return NULL;\n    }\n    return rk->userInfo;\n}\n\nint sqliterkGetParsedPageCount(sqliterk *rk)\n{\n    if (!rk) {\n        return 0;\n    }\n    return sqliterkPagerGetParsedPageCount(rk->pager);\n}\n\nint sqliterkGetValidPageCount(sqliterk *rk)\n{\n    if (!rk) {\n        return 0;\n    }\n    return sqliterkPagerGetValidPageCount(rk->pager);\n}\n\nint sqliterkGetPageCount(sqliterk *rk)\n{\n    if (!rk) {\n        return 0;\n    }\n    return sqliterkPagerGetPageCount(rk->pager);\n}\n\nunsigned int sqliterkGetIntegrity(sqliterk *rk)\n{\n    if (!rk) {\n        return 0;\n    }\n    return sqliterkPagerGetIntegrity(rk->pager);\n}\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_h\n#define sqliterk_h\n\ntypedef struct sqliterk sqliterk;\ntypedef struct sqliterk_cipher_conf sqliterk_cipher_conf;\ntypedef struct sqliterk_notify sqliterk_notify;\n\nint sqliterkOpen(const char *path,\n                 const sqliterk_cipher_conf *cipher,\n                 sqliterk **rk);\nint sqliterkParse(sqliterk *rk);\nint sqliterkParsePage(sqliterk *rk, int pageno);\nint sqliterkParseMaster(sqliterk *rk);\nint sqliterkClose(sqliterk *rk);\nint sqliterkSetNotify(sqliterk *rk, sqliterk_notify notify);\nint sqliterkSetUserInfo(sqliterk *rk, void *userInfo);\nvoid *sqliterkGetUserInfo(sqliterk *rk);\n\nint sqliterkGetParsedPageCount(sqliterk *rk);\nint sqliterkGetValidPageCount(sqliterk *rk);\nint sqliterkGetPageCount(sqliterk *rk);\nunsigned int sqliterkGetIntegrity(sqliterk *rk);\n\n#endif /* sqliterk_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_api.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"SQLiteRepairKit.h\"\n#include \"sqliterk.h\"\n#include \"sqliterk_btree.h\"\n#include \"sqliterk_column.h\"\n#include \"sqliterk_os.h\"\n#include \"sqliterk_pager.h\"\n#include \"sqliterk_util.h\"\n#include \"sqliterk_values.h\"\n\nint sqliterk_register_notify(sqliterk *rk, sqliterk_notify notify)\n{\n    return sqliterkSetNotify(rk, notify);\n}\n\nint sqliterk_open(const char *path,\n                  const sqliterk_cipher_conf *cipher,\n                  sqliterk **rk)\n{\n    return sqliterkOpen(path, cipher, rk);\n}\n\nvoid *sqliterk_user_info(sqliterk *rk)\n{\n    return sqliterkGetUserInfo(rk);\n}\n\nint sqliterk_parse(sqliterk *rk)\n{\n    return sqliterkParse(rk);\n}\n\nint sqliterk_parse_page(sqliterk *rk, int pageno)\n{\n    return sqliterkParsePage(rk, pageno);\n}\n\nint sqliterk_parse_master(sqliterk *rk)\n{\n    return sqliterkParseMaster(rk);\n}\n\nint sqliterk_close(sqliterk *rk)\n{\n    return sqliterkClose(rk);\n}\n\nvoid *sqliterk_get_user_info(sqliterk *rk)\n{\n    return sqliterkGetUserInfo(rk);\n}\n\nvoid sqliterk_set_user_info(sqliterk *rk, void *userInfo)\n{\n    sqliterkSetUserInfo(rk, userInfo);\n}\n\nint sqliterk_column_count(sqliterk_column *column)\n{\n    return sqliterkValuesGetCount(sqliterkColumnGetValues(column));\n}\n\nsqliterk_value_type sqliterk_column_type(sqliterk_column *column, int index)\n{\n    return sqliterkValuesGetType(sqliterkColumnGetValues(column), index);\n}\n\nint sqliterk_column_integer(sqliterk_column *column, int index)\n{\n    return sqliterkValuesGetInteger(sqliterkColumnGetValues(column), index);\n}\n\nint64_t sqliterk_column_integer64(sqliterk_column *column, int index)\n{\n    return sqliterkValuesGetInteger64(sqliterkColumnGetValues(column), index);\n}\n\ndouble sqliterk_column_number(sqliterk_column *column, int index)\n{\n    return sqliterkValuesGetNumber(sqliterkColumnGetValues(column), index);\n}\n\nconst char *sqliterk_column_text(sqliterk_column *column, int index)\n{\n    return sqliterkValuesGetText(sqliterkColumnGetValues(column), index);\n}\n\nconst void *sqliterk_column_binary(sqliterk_column *column, int index)\n{\n    return sqliterkValuesGetBinary(sqliterkColumnGetValues(column), index);\n}\n\nint sqliterk_column_bytes(sqliterk_column *column, int index)\n{\n    return sqliterkValuesGetBytes(sqliterkColumnGetValues(column), index);\n}\n\nint64_t sqliterk_column_rowid(sqliterk_column *column)\n{\n    return sqliterkColumnGetRowId(column);\n}\n\nconst char *sqliterk_table_name(sqliterk_table *table)\n{\n    return sqliterkBtreeGetName((sqliterk_btree *) table);\n}\n\nvoid sqliterk_table_set_user_info(sqliterk_table *table, void *userInfo)\n{\n    sqliterkBtreeSetUserInfo((sqliterk_btree *) table, userInfo);\n}\n\nvoid *sqliterk_table_get_user_info(sqliterk_table *table)\n{\n    return sqliterkBtreeGetUserInfo((sqliterk_btree *) table);\n}\n\nsqliterk_type sqliterk_table_type(sqliterk_table *table)\n{\n    return (sqliterk_type) sqliterkBtreeGetType((sqliterk_btree *) table);\n}\n\nint sqliterk_register(sqliterk_os os)\n{\n    return sqliterkOSRegister(os);\n}\n\nint sqliterk_table_root(sqliterk_table *table)\n{\n    sqliterk_page *page = sqliterkBtreeGetRootPage((sqliterk_btree *) table);\n    return sqliterkPageGetPageno(page);\n}\n\nconst char *sqliterk_description(int result)\n{\n    return sqliterkGetResultCodeDescription(result);\n}\n\nint sqliterk_parsed_page_count(sqliterk *rk)\n{\n    return sqliterkGetParsedPageCount(rk);\n}\n\nint sqliterk_valid_page_count(sqliterk *rk)\n{\n    return sqliterkGetValidPageCount(rk);\n}\n\nint sqliterk_page_count(sqliterk *rk)\n{\n    return sqliterkGetPageCount(rk);\n}\n\nunsigned int sqliterk_integrity(sqliterk *rk)\n{\n    return sqliterkGetIntegrity(rk);\n}\n\nvoid sqliterk_cipher_conf_set_key(sqliterk_cipher_conf *conf, const void* key, int key_len)\n{\n    if (conf != NULL) {\n        conf->key = key;\n        conf->key_len = key_len;\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_btree.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk_btree.h\"\n#include \"SQLiteRepairKit.h\"\n#include \"sqliterk_column.h\"\n#include \"sqliterk_os.h\"\n#include \"sqliterk_pager.h\"\n#include \"sqliterk_util.h\"\n#include \"sqliterk_values.h\"\n#include <string.h>\n\n// Declarations\nstatic int sqliterkBtreeParsePage(sqliterk_btree *btree, int pageno);\nstatic int sqliterkBtreeParseCell(sqliterk_btree *btree,\n                                  sqliterk_page *page,\n                                  const int *cellPointerArray,\n                                  const int cellsCount);\nstatic int sqliterkBtreeParsePayload(sqliterk_btree *btree,\n                                     sqliterk_page *page,\n                                     int offset,\n                                     int payloadSize,\n                                     sqliterk_column *column);\nstatic int sqliterkBtreeGetLengthForSerialType(int serialType);\n\nstruct sqliterk_btree {\n    sqliterk *rk;\n    char *name;\n    sqliterk_btree_type type;\n    sqliterk_pager *pager;\n    sqliterk_page *rootpage;\n    // For leaf-table. See https://www.sqlite.org/fileformat2.html#btree\n    int maxLocal;\n    int minLocal;\n    int maxLeaf;\n    int minLeaf;\n\n    sqliterk_btree_notify notify;\n    void *userInfo;\n};\n\nint sqliterkBtreeOpen(sqliterk *rk,\n                      sqliterk_pager *pager,\n                      int rootPageno,\n                      sqliterk_btree **btree)\n{\n    if (!pager || !btree) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk_btree *theBtree = sqliterkOSMalloc(sizeof(sqliterk_btree));\n    if (!theBtree) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkBtreeOpen_Failed;\n    }\n    theBtree->pager = pager;\n\n    rc = sqliterkPageAcquire(theBtree->pager, rootPageno, &theBtree->rootpage);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkBtreeOpen_Failed;\n    }\n    if (rootPageno == 1) {\n        rc = sqliterkBtreeSetMeta(theBtree, \"sqlite_master\",\n                                  sqliterk_btree_type_master);\n        if (rc != SQLITERK_OK) {\n            goto sqliterkBtreeOpen_Failed;\n        }\n    } else {\n        switch (sqliterkPageGetType(theBtree->rootpage)) {\n            case sqliterk_page_type_interior_index:\n            case sqliterk_page_type_leaf_index:\n                theBtree->type = sqliterk_btree_type_index;\n                break;\n            case sqliterk_page_type_interior_table:\n            case sqliterk_page_type_leaf_table:\n                theBtree->type = sqliterk_btree_type_table;\n                break;\n            default:\n                rc = SQLITERK_DAMAGED;\n                goto sqliterkBtreeOpen_Failed;\n        }\n    }\n    // Save memory\n    sqliterkPageClearData(theBtree->rootpage);\n\n    theBtree->maxLocal =\n        (sqliterkPagerGetUsableSize(theBtree->pager) - 12) * 64 / 255 - 23;\n    theBtree->minLocal =\n        (sqliterkPagerGetUsableSize(theBtree->pager) - 12) * 32 / 255 - 23;\n    theBtree->maxLeaf = sqliterkPagerGetUsableSize(theBtree->pager) - 35;\n    theBtree->minLeaf =\n        (sqliterkPagerGetUsableSize(theBtree->pager) - 12) * 32 / 255 - 23;\n\n    theBtree->rk = rk;\n\n    *btree = theBtree;\n    return SQLITERK_OK;\n\nsqliterkBtreeOpen_Failed:\n    if (theBtree) {\n        sqliterkBtreeClose(theBtree);\n    }\n    *btree = NULL;\n    return rc;\n}\n\nint sqliterkBtreeParse(sqliterk_btree *btree)\n{\n    if (!btree) {\n        return SQLITERK_MISUSE;\n    }\n    if (btree->notify.onBeginParseBtree) {\n        btree->notify.onBeginParseBtree(btree->rk, btree);\n    }\n    int rc =\n        sqliterkBtreeParsePage(btree, sqliterkPageGetPageno(btree->rootpage));\n    if (btree->notify.onEndParseBtree) {\n        btree->notify.onEndParseBtree(btree->rk, btree, rc);\n    }\n    return rc;\n}\n\n// If the page is an interior-btree, no matter is an interior-table btree\n// or an interior-index btree, this function will recursively parse the page\n// until it find the leaf page or any error occur.\n// A leaf-index btree will only be found but not parse, since its data make\n// no sense.\nstatic int sqliterkBtreeParsePage(sqliterk_btree *btree, int pageno)\n{\n    int i;\n\n    if (!btree || pageno > sqliterkPagerGetPageCount(btree->pager)) {\n        return SQLITERK_MISUSE;\n    }\n\n    int rc;\n\n    if (btree->notify.onBeginParsePage) {\n        rc = btree->notify.onBeginParsePage(btree->rk, btree, pageno);\n        if (rc != SQLITERK_OK) {\n            return rc;\n        }\n    }\n\n    int *cellPointerArray = NULL;\n    sqliterk_page *page = NULL;\n\n    // ahead checking type to fast up parsing\n    rc = sqliterkPageAcquire(btree->pager, pageno, &page);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkBtreeParsePage_End;\n    }\n    sqliterk_page_type type = sqliterkPageGetType(page);\n    if (type != sqliterk_page_type_interior_index &&\n        type != sqliterk_page_type_interior_table &&\n        type != sqliterk_page_type_leaf_index &&\n        type != sqliterk_page_type_leaf_table) {\n        rc = sqliterkOSWarning(SQLITERK_DAMAGED, \"Page %d has invalid type\",\n                               pageno);\n        goto sqliterkBtreeParsePage_End;\n    }\n\n    //sqliterkOSDebug(SQLITERK_OK, \"Page %d is %s\", pageno, sqliterkPageGetTypeName(type));\n\n    // Parse cell pointer array. For further information, see [cell pointer]\n    // at https://www.sqlite.org/fileformat2.html#btree\n    const unsigned char *pagedata = sqliterkPageGetData(page);\n    int offsetCellPointerArray =\n        (type == sqliterk_page_type_interior_table) ? 12 : 8;\n    int cellsCount;\n    sqliterkParseInt(pagedata, 3 + sqliterkPageHeaderOffset(page), 2,\n                     &cellsCount);\n    if (cellsCount <= 0 || cellsCount * 2 + offsetCellPointerArray >\n                               sqliterkPagerGetSize(btree->pager)) {\n        rc = SQLITERK_DAMAGED;\n        goto sqliterkBtreeParsePage_End;\n    }\n    cellPointerArray = sqliterkOSMalloc(sizeof(int) * (cellsCount + 1));\n    if (!cellPointerArray) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkBtreeParsePage_End;\n    }\n\n    for (i = 0; i < cellsCount; i++) {\n        int cellPointer;\n        sqliterkParseInt(pagedata,\n                         sqliterkPageHeaderOffset(page) +\n                             offsetCellPointerArray + i * 2,\n                         2, &cellPointer);\n        cellPointerArray[i] = cellPointer;\n    }\n\n    switch (type) {\n        case sqliterk_page_type_interior_table:\n        case sqliterk_page_type_interior_index: {\n            int hasRightMostPageno =\n                (type == sqliterk_page_type_interior_table);\n            int pagenosCount = cellsCount + hasRightMostPageno;\n            int *pagenos = sqliterkOSMalloc(sizeof(int) * (pagenosCount + 1));\n            if (!pagenos) {\n                rc = SQLITERK_NOMEM;\n                goto sqliterkBtreeParsePage_End;\n            }\n            for (i = 0; i < cellsCount; i++) {\n                sqliterkParseInt(pagedata, cellPointerArray[i], 4, pagenos + i);\n            }\n            if (hasRightMostPageno) {\n                sqliterkParseInt(pagedata, 8, 4, pagenos + cellsCount);\n            }\n            // All done for page data. Ahead release the page data to avoid memory overflow\n            sqliterkOSFree(cellPointerArray);\n            cellPointerArray = NULL;\n            sqliterkPageClearData(page);\n            // Recursively decode the page\n            for (i = 0; i < pagenosCount; i++) {\n                if (sqliterkBtreeParsePage(btree, pagenos[i]) ==\n                    SQLITERK_CANCELLED)\n                    break;\n            }\n            sqliterkOSFree(pagenos);\n            break;\n        }\n        case sqliterk_page_type_leaf_table:\n            if (sqliterkBtreeIsSystemType(sqliterkBtreeGetType(btree)) &&\n                btree->type != sqliterk_btree_type_master) {\n                //skip a non-master system table, since its column is generated.\n                goto sqliterkBtreeParsePage_End;\n            }\n            rc = sqliterkBtreeParseCell(btree, page, cellPointerArray,\n                                        cellsCount);\n            break;\n        case sqliterk_page_type_leaf_index:\n            // Just skip it since the column in leaf index make no sense.\n            break;\n        default:\n            break;\n    }\n\nsqliterkBtreeParsePage_End:\n    if (cellPointerArray) {\n        sqliterkOSFree(cellPointerArray);\n    }\n    if (btree->notify.onEndParsePage) {\n        btree->notify.onEndParsePage(btree->rk, btree, pageno, rc);\n    }\n    if (page) {\n        sqliterkPageRelease(page);\n    }\n    if (rc != SQLITERK_OK && rc != SQLITERK_CANCELLED) {\n        sqliterkOSDebug(rc, \"Failed to parse page %d.\", pageno);\n    }\n    return rc;\n}\n\n// Parse the payload data. see [B-tree Cell Format]\n// at https://www.sqlite.org/fileformat2.html#btree\nstatic int sqliterkBtreeParseCell(sqliterk_btree *btree,\n                                  sqliterk_page *page,\n                                  const int *cellPointerArray,\n                                  const int cellsCount)\n{\n    if (!btree || !page || !cellPointerArray || cellsCount < 0) {\n        return SQLITERK_MISUSE;\n    }\n    const unsigned char *pagedata = sqliterkPageGetData(page);\n    int rc = SQLITERK_OK;\n    sqliterk_column *column;\n    rc = sqliterkColumnAlloc(&column);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkBtreeParsePayload_End;\n    }\n\n    int i;\n    for (i = 0; i < cellsCount; i++) {\n        sqliterkColumnClear(column);\n        int offset = cellPointerArray[i];\n        // Find payload\n        int payloadSizeLength;\n        int payloadSize;\n        rc = sqliterkParseVarint(pagedata, offset, &payloadSizeLength,\n                                 &payloadSize);\n        if (rc != SQLITERK_OK) {\n            goto sqliterkBtreeParsePayload_End;\n        }\n        offset += payloadSizeLength;\n\n        int rowidLength;\n        int64_t rowid;\n        rc = sqliterkParseVarint64(pagedata, offset, &rowidLength, &rowid);\n        if (rc != SQLITERK_OK) {\n            goto sqliterkBtreeParsePayload_End;\n        }\n        offset += rowidLength;\n        sqliterkColumnSetRowId(column, rowid);\n\n        rc =\n            sqliterkBtreeParsePayload(btree, page, offset, payloadSize, column);\n        if (rc != SQLITERK_OK) {\n            goto sqliterkBtreeParsePayload_End;\n        }\n    }\nsqliterkBtreeParsePayload_End:\n    if (column) {\n        sqliterkColumnFree(column);\n    }\n    if (rc != SQLITERK_OK && rc != SQLITERK_CANCELLED) {\n        sqliterkOSDebug(rc, \"Failed to parse payload.\");\n    }\n    return rc;\n}\n\n// Parse the payload for leaf-table page only. We don't implement the parse\n// method for index page, since we are not concerned about the data in an\n// index page. See [Record Format] at https://www.sqlite.org/fileformat2.html\nstatic int sqliterkBtreeParsePayload(sqliterk_btree *btree,\n                                     sqliterk_page *page,\n                                     int offset,\n                                     int payloadSize,\n                                     sqliterk_column *column)\n{\n    if (!btree || payloadSize <= 0 || !column) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    unsigned char *payloadData = sqliterkOSMalloc(payloadSize);\n    if (!payloadData) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkBtreeParseColumn_End;\n    }\n\n    // Check overflow\n    int local = 0;\n    if (payloadSize <= btree->maxLeaf) {\n        local = payloadSize;\n    } else {\n        // Since it is a leaf-table page, the max local should be equal to max leaf\n        int maxPageLocal = btree->maxLeaf;\n        int minPageLocal = btree->minLocal;\n        int surplus =\n            minPageLocal + (payloadSize - minPageLocal) %\n                               (sqliterkPagerGetUsableSize(btree->pager) - 4);\n        if (surplus <= maxPageLocal) {\n            local = surplus;\n        } else {\n            local = minPageLocal;\n        }\n    }\n\n    // Read data\n    int payloadPointer = 0;\n    const unsigned char *pagedata = sqliterkPageGetData(page);\n    if (offset + local > sqliterkPagerGetSize(btree->pager)) {\n        rc = SQLITERK_DAMAGED;\n        goto sqliterkBtreeParseColumn_End;\n    }\n    memcpy(payloadData, pagedata + offset, local);\n    payloadPointer += local;\n\n    if (payloadPointer < payloadSize) {\n        sqliterk_values *overflowPages = sqliterkColumnGetOverflowPages(column);\n        int overflowPageno;\n        const unsigned char *pagedata = sqliterkPageGetData(page);\n        sqliterkParseInt(pagedata, offset + local, 4, &overflowPageno);\n        while (sqliterkPagerIsPagenoValid(btree->pager, overflowPageno) ==\n               SQLITERK_OK) {\n            sqliterkValuesAddInteger(overflowPages, overflowPageno);\n            if (btree->notify.onBeginParsePage) {\n                btree->notify.onBeginParsePage(btree->rk, btree,\n                                               overflowPageno);\n            }\n            sqliterk_page *page;\n            rc = sqliterkPageAcquireOverflow(btree->pager, overflowPageno,\n                                             &page);\n            if (btree->notify.onEndParsePage) {\n                btree->notify.onEndParsePage(btree->rk, btree, overflowPageno,\n                                             rc);\n            }\n            if (rc != SQLITERK_OK) {\n                break;\n            }\n            // Read data\n            int overflowSize = payloadSize - payloadPointer;\n            int maxSize = sqliterkPagerGetUsableSize(btree->pager) - 4;\n            if (overflowSize > maxSize) {\n                overflowSize = maxSize;\n            }\n\n            const unsigned char *pageData = sqliterkPageGetData(page);\n            memcpy(payloadData + payloadPointer, pageData + 4, overflowSize);\n            payloadPointer += overflowSize;\n            // Iterate\n            sqliterkParseInt(pageData, 0, 4, &overflowPageno);\n            // Clear\n            sqliterkPageRelease(page);\n        }\n    }\n\n    int columnOffsetValue = 0;\n    int columnOffsetValueLength = 0;\n    rc = sqliterkParseVarint(payloadData, 0, &columnOffsetValueLength,\n                             &columnOffsetValue);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkBtreeParseColumn_End;\n    }\n\n    int offsetSerialType = columnOffsetValueLength;\n    int offsetValue = columnOffsetValue;\n    const int endSerialType = offsetValue;\n    const int endValue = payloadSize;\n\n    int serialTypeLength = 0;\n    int serialType = 0;\n    int valueLength = 0;\n\n    sqliterk_values *values = sqliterkColumnGetValues(column);\n    while (offsetValue < endValue || offsetSerialType < endSerialType) {\n        rc = sqliterkParseVarint(payloadData, offsetSerialType,\n                                 &serialTypeLength, &serialType);\n        if (rc != SQLITERK_OK) {\n            goto sqliterkBtreeParseColumn_End;\n        }\n        valueLength = sqliterkBtreeGetLengthForSerialType(serialType);\n        if (serialType == 0) {\n            rc = sqliterkValuesAddNull(values);\n        } else if (serialType < 7) {\n            int64_t value;\n            sqliterkParseInt64(payloadData, offsetValue, valueLength, &value);\n            rc = sqliterkValuesAddInteger64(values, value);\n        } else if (serialType == 7) {\n            double value;\n            sqliterkParseNumber(payloadData, offsetValue, &value);\n            rc = sqliterkValuesAddNumber(values, value);\n        } else if (serialType == 8) {\n            rc = sqliterkValuesAddInteger(values, 0);\n        } else if (serialType == 9) {\n            rc = sqliterkValuesAddInteger(values, 1);\n        } else if (serialType >= 12) {\n            if (serialType % 2 == 0) {\n                rc = sqliterkValuesAddBinary(values, payloadData + offsetValue,\n                                             valueLength);\n            } else {\n                rc = sqliterkValuesAddNoTerminatorText(\n                    values, (const char *) payloadData + offsetValue,\n                    valueLength);\n            }\n        } else {\n            rc = SQLITERK_DAMAGED;\n        }\n        if (rc != SQLITERK_OK) {\n            goto sqliterkBtreeParseColumn_End;\n        }\n        offsetValue += valueLength;\n        offsetSerialType += serialTypeLength;\n    }\n    if (offsetSerialType != endSerialType || offsetValue != endValue) {\n        rc = SQLITERK_DAMAGED;\n        goto sqliterkBtreeParseColumn_End;\n    }\n\nsqliterkBtreeParseColumn_End:\n    if (rc == SQLITERK_OK && btree->notify.onParseColumn) {\n        rc = btree->notify.onParseColumn(btree->rk, btree, page, column);\n    }\n    if (payloadData) {\n        sqliterkOSFree(payloadData);\n    }\n    return rc;\n}\n\nint sqliterkBtreeClose(sqliterk_btree *btree)\n{\n    if (!btree) {\n        return SQLITERK_MISUSE;\n    }\n    if (btree->name) {\n        sqliterkOSFree(btree->name);\n        btree->name = NULL;\n    }\n    if (btree->rootpage) {\n        sqliterkPageRelease(btree->rootpage);\n        btree->rootpage = NULL;\n    }\n    btree->pager = NULL;\n    btree->userInfo = NULL;\n    btree->rk = NULL;\n    btree->type = 0;\n    sqliterkOSFree(btree);\n    return SQLITERK_OK;\n}\n\nint sqliterkBtreeSetMeta(sqliterk_btree *btree,\n                         const char *name,\n                         sqliterk_btree_type type)\n{\n    if (!btree) {\n        return SQLITERK_MISUSE;\n    }\n    if (btree->name) {\n        sqliterkOSFree(btree->name);\n        btree->name = NULL;\n    }\n    if (name) {\n        size_t length = strlen(name);\n        btree->name = sqliterkOSMalloc(sizeof(char) * (length + 1));\n        if (!btree->name) {\n            return SQLITERK_NOMEM;\n        }\n        strncpy(btree->name, name, length);\n        // If it's a system btree name, then setup its b-tree type.\n        sqliterk_btree_type i;\n        for (i = sqliterk_btree_type_system_begin;\n             i < sqliterk_btree_type_system_end; i++) {\n            const char *typename = sqliterkBtreeGetTypeName(i);\n            if (strncmp(btree->name, typename, strlen(typename)) == 0) {\n                btree->type = i;\n                break;\n            }\n        }\n    } else {\n        btree->name = NULL;\n    }\n    if (!sqliterkBtreeIsSystemType(btree->type) &&\n        type != sqliterk_btree_type_unknown) {\n        btree->type = type;\n    }\n    return SQLITERK_OK;\n}\n\nconst char *sqliterkBtreeGetName(sqliterk_btree *btree)\n{\n    if (!btree) {\n        return NULL;\n    }\n    return btree->name;\n}\n\nsqliterk_btree_type sqliterkBtreeGetType(sqliterk_btree *btree)\n{\n    if (!btree) {\n        return sqliterk_btree_type_unknown;\n    }\n    return btree->type;\n}\n\nint sqliterkBtreeSetType(sqliterk_btree *btree, sqliterk_btree_type type)\n{\n    if (!btree) {\n        return SQLITERK_MISUSE;\n    }\n    if (sqliterkBtreeIsSystemType(btree->type)) {\n        // You can only set the type manually when the type is not a system type\n        return SQLITERK_MISUSE;\n    }\n    btree->type = type;\n    return SQLITERK_OK;\n}\n\nint sqliterkBtreeIsSystemType(sqliterk_btree_type type)\n{\n    if (type >= sqliterk_btree_type_system_begin &&\n        type < sqliterk_btree_type_system_end) {\n        return 1;\n    }\n    return 0;\n}\n\nvoid sqliterkBtreeSetNotify(sqliterk_btree *btree,\n                            sqliterk_btree_notify *notify)\n{\n    if (!btree || !notify) {\n        return;\n    }\n    btree->notify = *notify;\n}\n\nvoid sqliterkBtreeSetUserInfo(sqliterk_btree *btree, void *userInfo)\n{\n    if (!btree) {\n        return;\n    }\n    btree->userInfo = userInfo;\n}\n\nvoid *sqliterkBtreeGetUserInfo(sqliterk_btree *btree)\n{\n    if (!btree) {\n        return NULL;\n    }\n    return btree->userInfo;\n}\n\nsqliterk_page *sqliterkBtreeGetRootPage(sqliterk_btree *btree)\n{\n    if (!btree) {\n        return NULL;\n    }\n    return btree->rootpage;\n}\n\nconst char *sqliterkBtreeGetTypeName(sqliterk_btree_type type)\n{\n    char *name;\n    switch (type) {\n        case sqliterk_btree_type_autoindex:\n            name = \"sqlite_autoindex\";\n            break;\n        case sqliterk_btree_type_sequence:\n            name = \"sqlite_sequence\";\n            break;\n        case sqliterk_btree_type_stat:\n            name = \"sqlite_stat\";\n            break;\n        case sqliterk_btree_type_master:\n            name = \"sqlite_master\";\n            break;\n        case sqliterk_btree_type_table:\n            name = \"table\";\n            break;\n        case sqliterk_btree_type_index:\n            name = \"index\";\n            break;\n        default:\n            name = \"unknown\";\n            break;\n    }\n    return name;\n}\n\n// See [Serial Type Codes Of The Record Format]\n// at https://www.sqlite.org/fileformat2.html\nstatic int sqliterkBtreeGetLengthForSerialType(int serialType)\n{\n    if (serialType < 0) {\n        return 0;\n    }\n    static int sqliterk_btree_serialtype_fixlengths[12] = {0, 1, 2, 3, 4, 6,\n                                                           8, 8, 0, 0, 0, 0};\n    if (serialType < 12) {\n        return sqliterk_btree_serialtype_fixlengths[serialType];\n    }\n    return (serialType - 12 - serialType % 2) / 2;\n}"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_btree.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_btree_h\n#define sqliterk_btree_h\n\n// About sqliterk_btree, see https://www.sqlite.org/fileformat2.html#btree\ntypedef struct sqliterk_btree sqliterk_btree;\ntypedef struct sqliterk_pager sqliterk_pager;\ntypedef struct sqliterk_values sqliterk_values;\ntypedef struct sqliterk_column sqliterk_column;\ntypedef struct sqliterk_page sqliterk_page;\ntypedef struct sqliterk sqliterk;\ntypedef struct sqliterk_btree_notify sqliterk_btree_notify;\n\ntypedef enum {\n    sqliterk_btree_type_index = -2,\n    sqliterk_btree_type_table = -1,\n    sqliterk_btree_type_unknown = 0,\n    // About SQLite reserved btree, see [Storage Of The SQL Database Schema]\n    // chapter at https://www.sqlite.org/fileformat2.html#Schema\n    sqliterk_btree_type_system_begin = 1,\n    sqliterk_btree_type_sequence = 1,\n    sqliterk_btree_type_autoindex = 2,\n    sqliterk_btree_type_stat = 3,\n    sqliterk_btree_type_master = 4,\n    sqliterk_btree_type_system_end = 5,\n} sqliterk_btree_type;\n\nstruct sqliterk_btree_notify {\n    void (*onBeginParseBtree)(sqliterk *rk, sqliterk_btree *btree);\n    void (*onEndParseBtree)(sqliterk *rk, sqliterk_btree *btree, int result);\n    int (*onParseColumn)(sqliterk *rk,\n                         sqliterk_btree *btree,\n                         sqliterk_page *page,\n                         sqliterk_column *column);\n\n    // return SQLITE_OK to continue parsing the page. All other return\n    // value will skip the parsing phase of this page.\n    int (*onBeginParsePage)(sqliterk *rk, sqliterk_btree *btree, int pageno);\n\n    void (*onEndParsePage)(sqliterk *rk,\n                           sqliterk_btree *btree,\n                           int pageno,\n                           int result);\n};\n\nint sqliterkBtreeOpen(sqliterk *rk,\n                      sqliterk_pager *pager,\n                      int rootPageno,\n                      sqliterk_btree **btree);\nint sqliterkBtreeParse(sqliterk_btree *btree);\nint sqliterkBtreeClose(sqliterk_btree *btree);\n\nint sqliterkBtreeSetMeta(sqliterk_btree *btree,\n                         const char *name,\n                         sqliterk_btree_type type);\nconst char *sqliterkBtreeGetName(sqliterk_btree *btree);\nsqliterk_btree_type sqliterkBtreeGetType(sqliterk_btree *btree);\nint sqliterkBtreeIsSystemType(sqliterk_btree_type type);\nsqliterk_page *sqliterkBtreeGetRootPage(sqliterk_btree *btree);\n\nvoid sqliterkBtreeSetNotify(sqliterk_btree *btree,\n                            sqliterk_btree_notify *notify);\nvoid sqliterkBtreeSetUserInfo(sqliterk_btree *btree, void *userInfo);\nvoid *sqliterkBtreeGetUserInfo(sqliterk_btree *btree);\nconst char *sqliterkBtreeGetTypeName(sqliterk_btree_type type);\n\n#endif /* sqliterk_btree_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_column.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk_column.h\"\n#include \"sqliterk_os.h\"\n\nstruct sqliterk_column {\n    int64_t rowid;\n    sqliterk_values *values;\n    sqliterk_values *overflowPages;\n};\n\nint sqliterkColumnAlloc(sqliterk_column **column)\n{\n    if (!column) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk_column *theColumn = sqliterkOSMalloc(sizeof(sqliterk_column));\n    if (!theColumn) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkColumnAlloc_Failed;\n    }\n    rc = sqliterkValuesAlloc(&theColumn->values);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkColumnAlloc_Failed;\n    }\n    rc = sqliterkValuesAlloc(&theColumn->overflowPages);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkColumnAlloc_Failed;\n    }\n    *column = theColumn;\n    return SQLITERK_OK;\n\nsqliterkColumnAlloc_Failed:\n    if (theColumn) {\n        sqliterkColumnFree(theColumn);\n    }\n    *column = NULL;\n    return rc;\n}\n\nint sqliterkColumnFree(sqliterk_column *column)\n{\n    if (!column) {\n        return SQLITERK_MISUSE;\n    }\n    if (column->overflowPages) {\n        sqliterkValuesFree(column->overflowPages);\n    }\n    if (column->values) {\n        sqliterkValuesFree(column->values);\n    }\n    sqliterkOSFree(column);\n    return SQLITERK_OK;\n}\n\nsqliterk_values *sqliterkColumnGetValues(sqliterk_column *column)\n{\n    if (!column) {\n        return NULL;\n    }\n    return column->values;\n}\n\nvoid sqliterkColumnSetRowId(sqliterk_column *column, int64_t rowid)\n{\n    if (column) {\n        column->rowid = rowid;\n    }\n}\n\nint64_t sqliterkColumnGetRowId(sqliterk_column *column)\n{\n    if (!column) {\n        return 0;\n    }\n    return column->rowid;\n}\n\nsqliterk_values *sqliterkColumnGetOverflowPages(sqliterk_column *column)\n{\n    if (!column) {\n        return NULL;\n    }\n    return column->overflowPages;\n}\n\nint sqliterkColumnClear(sqliterk_column *column)\n{\n    if (!column) {\n        return SQLITERK_MISUSE;\n    }\n    column->rowid = 0;\n    sqliterkValuesClear(column->overflowPages);\n    sqliterkValuesClear(column->values);\n    return SQLITERK_OK;\n}"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_column.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_column_h\n#define sqliterk_column_h\n\n#include \"sqliterk_values.h\"\n\ntypedef struct sqliterk_column sqliterk_column;\n\nint sqliterkColumnAlloc(sqliterk_column **column);\nint sqliterkColumnFree(sqliterk_column *column);\n\nsqliterk_values *sqliterkColumnGetValues(sqliterk_column *column);\nvoid sqliterkColumnSetRowId(sqliterk_column *column, int64_t rowid);\nint64_t sqliterkColumnGetRowId(sqliterk_column *column);\nsqliterk_values *sqliterkColumnGetOverflowPages(sqliterk_column *column);\nint sqliterkColumnClear(sqliterk_column *column);\n\n#endif /* sqliterk_column_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_crypto.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk_crypto.h\"\n#include \"SQLiteRepairKit.h\"\n#include \"sqliterk_os.h\"\n#include \"sqliterk_pager.h\"\n#ifdef WCDB_BUILTIN_SQLCIPHER\n#include <sqlcipher/sqlite3.h>\n#else  //WCDB_BUILTIN_SQLCIPHER\n#include <sqlite3.h>\n#endif //WCDB_BUILTIN_SQLCIPHER\n#include <string.h>\n\n// Declarations by SQLCipher.\n#define CIPHER_DECRYPT 0\n#define CIPHER_ENCRYPT 1\n\n#define CIPHER_READ_CTX 0\n#define CIPHER_WRITE_CTX 1\n#define CIPHER_READWRITE_CTX 2\n\n/* Extensions defined in crypto_impl.c */\ntypedef struct codec_ctx codec_ctx;\n\n/* Activation and initialization */\nvoid sqlcipher_activate(void);\nvoid sqlcipher_deactivate(void);\nint sqlcipher_codec_ctx_init(\n    codec_ctx **, void *, void *, void *, const void *, int);\nvoid sqlcipher_codec_ctx_free(codec_ctx **);\nint sqlcipher_codec_key_derive(codec_ctx *);\nint sqlcipher_codec_key_copy(codec_ctx *, int);\n\n/* Page cipher implementation */\nint sqlcipher_page_cipher(\n    codec_ctx *, int, int, int, int, unsigned char *, unsigned char *);\n\n/* Context setters & getters */\n//void sqlcipher_codec_ctx_set_error(codec_ctx *, int);\n\nint sqlcipher_codec_ctx_set_pass(codec_ctx *, const void *, int, int);\nvoid sqlcipher_codec_get_keyspec(codec_ctx *, void **zKey, int *nKey);\n\nint sqlcipher_codec_ctx_set_pagesize(codec_ctx *, int);\nint sqlcipher_codec_ctx_get_pagesize(codec_ctx *);\nint sqlcipher_codec_ctx_get_reservesize(codec_ctx *);\n\nvoid sqlcipher_set_default_pagesize(int page_size);\nint sqlcipher_get_default_pagesize(void);\n\nvoid sqlcipher_set_default_kdf_iter(int iter);\nint sqlcipher_get_default_kdf_iter(void);\n\nint sqlcipher_codec_ctx_set_kdf_iter(codec_ctx *, int, int);\nint sqlcipher_codec_ctx_get_kdf_iter(codec_ctx *ctx, int);\n\nvoid *sqlcipher_codec_ctx_get_kdf_salt(codec_ctx *ctx);\n\nint sqlcipher_codec_ctx_set_fast_kdf_iter(codec_ctx *, int, int);\nint sqlcipher_codec_ctx_get_fast_kdf_iter(codec_ctx *, int);\n\nint sqlcipher_codec_ctx_set_cipher(codec_ctx *, const char *, int);\nconst char *sqlcipher_codec_ctx_get_cipher(codec_ctx *ctx, int for_ctx);\n\nvoid *sqlcipher_codec_ctx_get_data(codec_ctx *);\n\n//void sqlcipher_exportFunc(sqlite3_context *, int, sqlite3_value **);\n\nvoid sqlcipher_set_default_use_hmac(int use);\nint sqlcipher_get_default_use_hmac(void);\n\nvoid sqlcipher_set_hmac_salt_mask(unsigned char mask);\nunsigned char sqlcipher_get_hmac_salt_mask(void);\n\nint sqlcipher_codec_ctx_set_use_hmac(codec_ctx *ctx, int use);\nint sqlcipher_codec_ctx_get_use_hmac(codec_ctx *ctx, int for_ctx);\n\nint sqlcipher_codec_ctx_set_flag(codec_ctx *ctx, unsigned int flag);\nint sqlcipher_codec_ctx_unset_flag(codec_ctx *ctx, unsigned int flag);\nint sqlcipher_codec_ctx_get_flag(codec_ctx *ctx,\n                                 unsigned int flag,\n                                 int for_ctx);\n\nconst char *sqlcipher_codec_get_cipher_provider(codec_ctx *ctx);\n//int sqlcipher_codec_ctx_migrate(codec_ctx *ctx);\nint sqlcipher_codec_add_random(codec_ctx *ctx, const char *data, int random_sz);\nint sqlcipher_cipher_profile(sqlite3 *db, const char *destination);\n//static void sqlcipher_profile_callback(void *file, const char *sql, sqlite3_uint64 run_time);\n//static int sqlcipher_codec_get_store_pass(codec_ctx *ctx);\n//static void sqlcipher_codec_get_pass(codec_ctx *ctx, void **zKey, int *nKey);\n//static void sqlcipher_codec_set_store_pass(codec_ctx *ctx, int value);\nint sqlcipher_codec_fips_status(codec_ctx *ctx);\nconst char *sqlcipher_codec_get_provider_version(codec_ctx *ctx);\n\n// sqlite3_file redirector\ntypedef struct {\n    const struct sqlite3_io_methods *pMethods;\n    sqliterk_file *fd;\n    const unsigned char *kdf_salt;\n} sqlite3_file_rkredir;\n\nint sqliterkRead(sqlite3_file *fd, void *data, int iAmt, sqlite3_int64 iOfst)\n{\n    sqlite3_file_rkredir *rkos = (sqlite3_file_rkredir *) fd;\n    if (rkos->kdf_salt) {\n        memcpy(data, rkos->kdf_salt, (iAmt > 16) ? 16 : iAmt);\n        return SQLITE_OK;\n    } else {\n        sqliterk_file *f = rkos->fd;\n        size_t size = iAmt;\n        return sqliterkOSRead(f, (off_t) iOfst, data, &size);\n    }\n}\n\nint sqliterkCryptoSetCipher(sqliterk_pager *pager,\n                            sqliterk_file *fd,\n                            const sqliterk_cipher_conf *conf)\n{\n    codec_ctx *codec = NULL;\n    int rc;\n\n    if (conf) {\n        // Check arguments.\n        if (!conf->key || conf->key_len <= 0)\n            return SQLITERK_MISUSE;\n\n        // SQLite library must be initialized before calling sqlcipher_activate(),\n        // or it will cause a deadlock.\n        sqlite3_initialize();\n        sqlcipher_activate();\n\n        // XXX: fake BTree structure passed to sqlcipher_codec_ctx_init.\n        // Member of such structure is assigned but never used by repair kit.\n        int fake_db[8];\n\n        sqlite3_file_rkredir file;\n        struct sqlite3_io_methods methods = {0};\n        methods.xRead = sqliterkRead;\n        file.pMethods = &methods;\n        file.fd = fd;\n        file.kdf_salt = conf->kdf_salt;\n\n        // Initialize codec context.\n        rc = sqlcipher_codec_ctx_init(&codec, fake_db, NULL, &file, conf->key,\n                                      conf->key_len);\n        if (rc != SQLITE_OK)\n            goto bail_sqlite_errstr;\n\n        // Set cipher.\n        if (conf->cipher_name) {\n            rc = sqlcipher_codec_ctx_set_cipher(codec, conf->cipher_name,\n                                                CIPHER_READWRITE_CTX);\n            if (rc != SQLITE_OK)\n                goto bail_sqlite_errstr;\n        }\n\n        // Set page size.\n        if (conf->page_size > 0) {\n            rc = sqlcipher_codec_ctx_set_pagesize(codec, conf->page_size);\n            if (rc != SQLITE_OK)\n                goto bail_sqlite_errstr;\n        }\n\n        // Set HMAC usage.\n        if (conf->use_hmac >= 0) {\n            rc = sqlcipher_codec_ctx_set_use_hmac(codec, conf->use_hmac);\n            if (rc != SQLITE_OK)\n                goto bail_sqlite_errstr;\n        }\n\n        // Set KDF Iteration.\n        if (conf->kdf_iter > 0) {\n            rc = sqlcipher_codec_ctx_set_kdf_iter(codec, conf->kdf_iter,\n                                                  CIPHER_READWRITE_CTX);\n            if (rc != SQLITE_OK)\n                goto bail;\n        }\n\n        // Update pager page size.\n        int page_sz = sqlcipher_codec_ctx_get_pagesize(codec);\n        int reserve_sz = sqlcipher_codec_ctx_get_reservesize(codec);\n\n        pager->pagesize = page_sz;\n        pager->reservedBytes = reserve_sz;\n    }\n\n    if (pager->codec) {\n        sqlcipher_codec_ctx_free(&pager->codec);\n        sqlcipher_deactivate();\n    }\n\n    pager->codec = codec;\n    return SQLITERK_OK;\n\nbail_sqlite_errstr:\n    sqliterkOSError(SQLITERK_CANTOPEN,\n                    \"Failed to initialize cipher context: %s\",\n                    sqlite3_errstr(rc));\n    rc = SQLITERK_CANTOPEN;\nbail:\n    if (codec)\n        sqlcipher_codec_ctx_free(&codec);\n    sqlcipher_deactivate();\n    return rc;\n}\n\nvoid sqliterkCryptoFreeCodec(sqliterk_pager *pager)\n{\n    if (!pager->codec)\n        return;\n    sqlcipher_codec_ctx_free(&pager->codec);\n    sqlcipher_deactivate();\n}\n\nint sqliterkCryptoDecode(sqliterk_codec *codec, int pgno, void *data)\n{\n    int rc;\n    int offset = 0;\n    unsigned char *pdata = (unsigned char *) data;\n\n    int page_sz = sqlcipher_codec_ctx_get_pagesize(codec);\n    unsigned char *buffer =\n        (unsigned char *) sqlcipher_codec_ctx_get_data(codec);\n\n    rc = sqlcipher_codec_key_derive(codec);\n    if (rc != SQLITE_OK)\n        return rc;\n\n    if (pgno == 1) {\n        offset = 16; // FILE_HEADER_SZ\n        memcpy(buffer, \"SQLite format 3\", 16);\n    }\n    rc = sqlcipher_page_cipher(codec, CIPHER_READ_CTX, pgno, CIPHER_DECRYPT,\n                               page_sz - offset, pdata + offset,\n                               buffer + offset);\n    if (rc != SQLITE_OK)\n        goto bail;\n    memcpy(pdata, buffer, page_sz);\n\n    return SQLITERK_OK;\n\nbail:\n    sqliterkOSError(SQLITERK_DAMAGED, \"Failed to decode page %d: %s\", pgno,\n                    sqlite3_errstr(rc));\n    return rc;\n}\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_crypto.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_crypto_h\n#define sqliterk_crypto_h\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct sqliterk_file sqliterk_file;\ntypedef struct sqliterk_pager sqliterk_pager;\ntypedef struct codec_ctx sqliterk_codec;\ntypedef struct sqliterk_cipher_conf sqliterk_cipher_conf;\n\nint sqliterkCryptoSetCipher(sqliterk_pager *pager,\n                            sqliterk_file *fd,\n                            const sqliterk_cipher_conf *conf);\nvoid sqliterkCryptoFreeCodec(sqliterk_pager *pager);\nint sqliterkCryptoDecode(sqliterk_codec *codec, int pgno, void *data);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_os.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk_os.h\"\n#include \"sqliterk_util.h\"\n#include <errno.h>\n#include <fcntl.h>\n#include <stdarg.h>\n#include <string.h>\n#include <sys/stat.h>\n#include <unistd.h>\n\nstruct sqliterk_file {\n    char *path;\n    int fd;\n    int error; // errno will be set when system error occur\n};\n\nint sqliterkOSReadOnlyOpen(const char *path, sqliterk_file **file)\n{\n    if (!path || !path[0] || !file) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk_file *theFile = sqliterkOSMalloc(sizeof(sqliterk_file));\n    if (!theFile) {\n        rc = SQLITERK_NOMEM;\n        sqliterkOSError(rc, \"Not enough memory, required %zu bytes.\",\n                        sizeof(sqliterk_file));\n        goto sqliterkOSReadOnlyOpen_Failed;\n    }\n\n    size_t len = sizeof(char) * (strlen(path) + 1);\n    theFile->path = sqliterkOSMalloc(len);\n    if (!theFile->path) {\n        rc = SQLITERK_NOMEM;\n        sqliterkOSError(rc, \"Not enough memory, required %zu bytes.\", len);\n        goto sqliterkOSReadOnlyOpen_Failed;\n    }\n    strncpy(theFile->path, path, len);\n\n    // Open the file in read-only mode, since we do not intend to modify it\n    theFile->fd = open(theFile->path, O_RDONLY);\n    if (theFile->fd < 0) {\n        rc = SQLITERK_CANTOPEN;\n        sqliterkOSError(rc, \"Cannot open '%s' for reading: %s\", theFile->path,\n                        strerror(errno));\n        goto sqliterkOSReadOnlyOpen_Failed;\n    }\n    *file = theFile;\n    return SQLITERK_OK;\n\nsqliterkOSReadOnlyOpen_Failed:\n    if (theFile) {\n        sqliterkOSClose(theFile);\n    }\n    *file = NULL;\n    return rc;\n}\n\nint sqliterkOSClose(sqliterk_file *file)\n{\n    if (!file) {\n        return SQLITERK_MISUSE;\n    }\n    if (file->path) {\n        sqliterkOSFree((char *) file->path);\n        file->path = NULL;\n    }\n    if (file->fd >= 0) {\n        close(file->fd);\n        file->fd = -1;\n    }\n    file->error = 0;\n    sqliterkOSFree(file);\n    return SQLITERK_OK;\n}\n\nint sqliterkOSRead(sqliterk_file *file,\n                   off_t offset,\n                   unsigned char *data,\n                   size_t *size)\n{\n    if (!file || file->fd < 0) {\n        return SQLITERK_MISUSE;\n    }\n    off_t newOffset = lseek(file->fd, offset, SEEK_SET);\n    if (newOffset == -1) {\n        file->error = errno;\n        return SQLITERK_IOERR;\n    }\n    size_t left = *size;\n    size_t cnt = 0;\n    ssize_t got = 0;\n    do {\n        got = read(file->fd, data, left);\n        if (got < 0) {\n            if (errno == EINTR) {\n                got = 1;\n                continue;\n            }\n            file->error = errno;\n            return SQLITERK_IOERR;\n        } else if (got > 0) {\n            left -= got;\n            cnt += got;\n            data = data + got;\n        }\n    } while (got > 0 && left > 0);\n    *size = cnt;\n    if (left > 0) {\n        return SQLITERK_SHORT_READ;\n    }\n    return SQLITERK_OK;\n}\n\nint sqliterkOSFileSize(sqliterk_file *file, size_t *filesize)\n{\n    if (!file || file->fd < 0) {\n        return SQLITERK_MISUSE;\n    }\n    struct stat statbuf;\n    if (fstat(file->fd, &statbuf) != 0) {\n        file->error = errno;\n        return SQLITERK_IOERR;\n    }\n    *filesize = (size_t) statbuf.st_size;\n    return SQLITERK_OK;\n}\n\nconst char *sqliterkOSGetFilePath(sqliterk_file *file)\n{\n    return file->path;\n}\n\nvoid *sqliterkOSMalloc(size_t size)\n{\n    return calloc(size, sizeof(char));\n}\n\nvoid sqliterkOSFree(void *p)\n{\n    free(p);\n}\n\nstatic void\nsqliterkDefaultLog(sqliterk_loglevel level, int result, const char *msg)\n{\n    fprintf(stderr, \"[%s] %s\\n\", sqliterkGetResultCodeDescription(result), msg);\n}\n\n#define SQLITERK_CONFIG_MAXLOG 4096\nstatic sqliterk_os s_os = {sqliterkDefaultLog};\n\nint sqliterkOSLog(sqliterk_loglevel loglevel,\n                  int result,\n                  const char *format,\n                  ...)\n{\n    char buf[SQLITERK_CONFIG_MAXLOG];\n\n    va_list ap;\n    va_start(ap, format);\n    vsnprintf(buf, sizeof(buf), format, ap);\n    va_end(ap);\n    if (s_os.xLog) {\n        s_os.xLog(loglevel, result, buf);\n    }\n    return result;\n}\n\nint sqliterkOSRegister(sqliterk_os os)\n{\n    s_os = os;\n    return SQLITERK_OK;\n}\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_os.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_os_h\n#define sqliterk_os_h\n\n#include \"SQLiteRepairKit.h\"\n#include <stdio.h>\n#include <stdlib.h>\n\ntypedef struct sqliterk_file sqliterk_file;\n// sqliterk_os is the virtual layer to fit different os or platform.\n// TODO\ntypedef struct sqliterk_os sqliterk_os;\n\n// memory allocation and set the allocated memory to zero-values\nvoid *sqliterkOSMalloc(size_t size);\nvoid sqliterkOSFree(void *p);\n\nint sqliterkOSLog(sqliterk_loglevel loglevel,\n                  int result,\n                  const char *format,\n                  ...)\n#ifdef __GNUC__\n    __attribute__((format(printf, 3, 4)))\n#endif\n    ;\nint sqliterkOSRegister(sqliterk_os os);\n\n#define sqliterkOSDebug(result, ...)                                           \\\n    sqliterkOSLog(sqliterk_loglevel_debug, result, ##__VA_ARGS__)\n#define sqliterkOSWarning(result, ...)                                         \\\n    sqliterkOSLog(sqliterk_loglevel_warning, result, ##__VA_ARGS__)\n#define sqliterkOSError(result, ...)                                           \\\n    sqliterkOSLog(sqliterk_loglevel_error, result, ##__VA_ARGS__)\n#define sqliterkOSInfo(result, ...)                                            \\\n    sqliterkOSLog(sqliterk_loglevel_info, result, ##__VA_ARGS__)\n\nint sqliterkOSReadOnlyOpen(const char *path, sqliterk_file **file);\nint sqliterkOSClose(sqliterk_file *file);\nint sqliterkOSRead(sqliterk_file *file,\n                   off_t offset,\n                   unsigned char *data,\n                   size_t *size);\nint sqliterkOSFileSize(sqliterk_file *file, size_t *filesize);\nconst char *sqliterkOSGetFilePath(sqliterk_file *file);\n\n#endif /* sqliterk_os_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_output.cpp",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"SQLiteRepairKit.h\"\n#include <assert.h>\n#include <errno.h>\n#include <map>\n#ifdef WCDB_BUILTIN_SQLCIPHER\n#include <sqlcipher/sqlite3.h>\n#else  //WCDB_BUILTIN_SQLCIPHER\n#include <sqlite3.h>\n#endif //WCDB_BUILTIN_SQLCIPHER\n#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <string>\n#include <strings.h>\n#include <vector>\n#include <zlib.h>\n#if defined(__APPLE__)\n#include <CommonCrypto/CommonCrypto.h>\n#include <Security/Security.h>\n#else\n#include <openssl/rc4.h>\n#endif\n\nextern \"C\" {\n#include \"sqliterk_btree.h\"\n#include \"sqliterk_os.h\"\n}\n\nclass CipherContext {\npublic:\n    enum Op {\n        Encrypt,\n        Decrypt,\n    };\n    CipherContext(Op op)\n#if defined(__APPLE__)\n        : m_op(op), m_key(nullptr), m_keyLength(0), m_cryptor(nullptr)\n#endif\n    {\n    }\n\n    void setKey(const void *key, unsigned int keyLength)\n    {\n#if defined(__APPLE__)\n        m_keyLength = keyLength;\n        m_key = (unsigned char *) realloc(m_key, m_keyLength);\n        memcpy(m_key, key, m_keyLength);\n#else\n        RC4_set_key(&m_rc4Key, keyLength, (const unsigned char *) key);\n#endif\n    }\n\n    void cipher(unsigned char *data, unsigned int length)\n    {\n#if defined(__APPLE__)\n        if (!m_cryptor) {\n            CCCryptorCreate(kCCEncrypt, kCCAlgorithmRC4, 0, m_key, m_keyLength,\n                            nullptr, &m_cryptor);\n        }\n\n        size_t cryptBytes = 0;\n        CCCryptorUpdate(m_cryptor, data, length, data, length, &cryptBytes);\n        CCCryptorFinal(m_cryptor, data, length, &cryptBytes);\n#else\n        RC4(&m_rc4Key, length, data, data);\n#endif\n    }\n\n    ~CipherContext()\n    {\n#if defined(__APPLE__)\n        if (m_cryptor) {\n            CCCryptorRelease(m_cryptor);\n        }\n        if (m_key) {\n            free(m_key);\n        }\n#endif\n    }\n\nprotected:\n#if defined(__APPLE__)\n    unsigned char *m_key;\n    unsigned int m_keyLength;\n    Op m_op;\n    CCCryptorRef m_cryptor;\n#else\n    RC4_KEY m_rc4Key;\n#endif\n};\n\nstruct sqliterk_master_entity {\n    sqliterk_type type;\n    std::string sql;\n    int root_page;\n\n    sqliterk_master_entity() {}\n\n    sqliterk_master_entity(sqliterk_type type_,\n                           const char *sql_,\n                           int root_page_)\n        : type(type_), sql(sql_), root_page(root_page_)\n    {\n    }\n};\ntypedef std::map<std::string, sqliterk_master_entity> sqliterk_master_map;\nstruct sqliterk_master_info : public sqliterk_master_map {\n};\n\nstruct sqliterk_output_ctx {\n    sqlite3 *db;\n    sqlite3_stmt *stmt;\n    int real_columns;\n    std::vector<sqlite3_value *> dflt_values;\n    int ipk_column;\n\n    sqliterk_master_map tables;\n    sqliterk_master_map::const_iterator table_cursor;\n    unsigned int flags;\n\n    unsigned int success_count;\n    unsigned int fail_count;\n    volatile unsigned cancelled;\n\n    int (*callback)(void *user,\n                    sqliterk *rk,\n                    sqliterk_table *table,\n                    sqliterk_column *column);\n    void *user;\n};\n\nstatic void dummyParseTableCallback(sqliterk *rk, sqliterk_table *table)\n{\n}\n\nstatic int master_onParseColumn(sqliterk *rk,\n                                sqliterk_table *table,\n                                sqliterk_column *column)\n{\n    sqliterk_output_ctx *ctx =\n        (sqliterk_output_ctx *) sqliterk_get_user_info(rk);\n\n    if (ctx->cancelled)\n        return SQLITERK_CANCELLED;\n\n    // For master table, check whether we should ignore, or create table\n    // and prepare for insertion.\n    if (sqliterk_table_type(table) != sqliterk_type_master)\n        return SQLITERK_MISUSE;\n\n    const char *typestr = sqliterk_column_text(column, 0);\n    const char *name = sqliterk_column_text(column, 1);\n    const char *tbl_name = sqliterk_column_text(column, 2);\n    int root_page = sqliterk_column_integer(column, 3);\n    const char *sql = sqliterk_column_text(column, 4);\n    sqliterk_type type;\n\n    if (strcmp(typestr, \"table\") == 0)\n        type = sqliterk_type_table;\n    else if (strcmp(typestr, \"index\") == 0)\n        type = sqliterk_type_index;\n    else\n        return SQLITERK_OK;\n\n    // TODO: deal with system tables.\n    if (strncmp(name, \"sqlite_\", 7) == 0)\n        return SQLITERK_OK;\n\n    if (ctx->flags & SQLITERK_OUTPUT_ALL_TABLES) {\n        // Recover ALL: add table to the list.\n        ctx->tables[name] = sqliterk_master_entity(type, sql, root_page);\n    } else {\n        // PARTIAL Recover: check whether we are interested, update info.\n        sqliterk_master_map::iterator it = ctx->tables.find(tbl_name);\n        if (it != ctx->tables.end())\n            ctx->tables[name] = sqliterk_master_entity(type, sql, root_page);\n    }\n\n    return SQLITERK_OK;\n}\n\nstatic void fini_insert(sqliterk_output_ctx *ctx)\n{\n    if (ctx->stmt) {\n        sqlite3_finalize(ctx->stmt);\n        ctx->stmt = NULL;\n    }\n\n    int n = (int) ctx->dflt_values.size();\n    for (int i = 0; i < n; i++)\n        sqlite3_value_free(ctx->dflt_values[i]);\n    ctx->dflt_values.clear();\n    ctx->real_columns = 0;\n    ctx->ipk_column = 0;\n}\n\nstatic int init_insert(sqliterk_output_ctx *ctx, const std::string &table)\n{\n    std::string sql;\n    sqlite3_stmt *table_info_stmt;\n\n    assert(ctx->stmt == NULL && ctx->dflt_values.empty());\n\n    sql.reserve(512);\n    sql = \"PRAGMA table_info(\";\n    sql += table;\n    sql += \");\";\n    int rc =\n        sqlite3_prepare_v2(ctx->db, sql.c_str(), -1, &table_info_stmt, NULL);\n    if (rc != SQLITE_OK) {\n        sqliterkOSWarning(rc, \"Failed to prepare SQL: %s [SQL: %s]\",\n                          sqlite3_errmsg(ctx->db), sql.c_str());\n        fini_insert(ctx);\n        return -1;\n    }\n\n    sql = \"REPLACE INTO \";\n    sql += table;\n    sql += \" VALUES(\";\n    ctx->real_columns = 0;\n    int ipk_column = 0;\n    while (sqlite3_step(table_info_stmt) == SQLITE_ROW) {\n        ctx->real_columns++;\n\n        sqlite3_value *value = sqlite3_column_value(table_info_stmt, 4);\n        ctx->dflt_values.push_back(sqlite3_value_dup(value));\n\n        // determine INTEGER PRIMARY KEY\n        if (ipk_column >= 0) {\n            int pk_idx = sqlite3_column_int(table_info_stmt, 5);\n            if (pk_idx == 1) {\n                const char *column_type =\n                    (const char *) sqlite3_column_text(table_info_stmt, 2);\n                if (strcasecmp(column_type, \"INTEGER\") == 0)\n                    ipk_column = ctx->real_columns;\n            } else if (pk_idx != 0) {\n                ipk_column = -1;\n            }\n        }\n\n        sql += \"?,\";\n    }\n    rc = sqlite3_finalize(table_info_stmt);\n    if (rc != SQLITE_OK || ctx->real_columns == 0) {\n        sqliterkOSWarning(\n            rc, \"Failed to execute SQL: %s [SQL: PRAGMA table_info(%s);]\",\n            sqlite3_errmsg(ctx->db), table.c_str());\n        fini_insert(ctx);\n        return -1;\n    }\n\n    sql[sql.length() - 1] = ')';\n    sql += ';';\n\n    sqlite3_stmt *stmt;\n    rc = sqlite3_prepare_v2(ctx->db, sql.c_str(), -1, &stmt, NULL);\n    if (rc != SQLITE_OK) {\n        sqliterkOSWarning(rc, \"Failed to prepare SQL: %s [SQL: %s]\",\n                          sqlite3_errmsg(ctx->db), sql.c_str());\n        fini_insert(ctx);\n        return -1;\n    }\n    ctx->stmt = stmt;\n    ctx->ipk_column = (ipk_column > 0) ? ipk_column : 0;\n\n    return ctx->real_columns;\n}\n\nstatic void table_onBeginParseTable(sqliterk *rk, sqliterk_table *table)\n{\n    sqliterk_output_ctx *ctx =\n        (sqliterk_output_ctx *) sqliterk_get_user_info(rk);\n\n    sqliterkBtreeSetMeta((sqliterk_btree *) table,\n                         ctx->table_cursor->first.c_str(),\n                         sqliterk_btree_type_table);\n}\n\nstatic int table_onParseColumn(sqliterk *rk,\n                               sqliterk_table *table,\n                               sqliterk_column *column)\n{\n    sqliterk_output_ctx *ctx =\n        (sqliterk_output_ctx *) sqliterk_get_user_info(rk);\n\n    if (ctx->cancelled)\n        return SQLITERK_CANCELLED;\n\n    int rc;\n    if (ctx->callback) {\n        rc = ctx->callback(ctx->user, rk, table, column);\n        if (rc != SQLITERK_OK) {\n            if (rc == SQLITERK_IGNORE)\n                rc = SQLITERK_OK;\n            return rc;\n        }\n    }\n\n    int columns = sqliterk_column_count(column);\n    sqlite3_stmt *stmt = ctx->stmt;\n\n    if (!stmt) {\n        // Invalid table_cursor means failed statement compilation.\n        if (ctx->table_cursor == ctx->tables.end()) {\n            ctx->fail_count++;\n            return SQLITERK_OK;\n        }\n\n        rc = init_insert(ctx, ctx->table_cursor->first);\n        if (rc <= 0) {\n            ctx->table_cursor = ctx->tables.end();\n            ctx->fail_count++;\n            return SQLITERK_OK;\n        }\n\n        // Begin transaction.\n        char *errmsg;\n        rc = sqlite3_exec(ctx->db, \"BEGIN;\", NULL, NULL, &errmsg);\n        if (errmsg) {\n            sqliterkOSWarning(rc, \"Failed to begin transaction: %s\", errmsg);\n            sqlite3_free(errmsg);\n        }\n\n        stmt = ctx->stmt;\n    }\n\n    int i;\n\n    // Bind values provided by the repair kit.\n    for (i = 0; i < columns; i++) {\n        sqliterk_value_type type = sqliterk_column_type(column, i);\n        switch (type) {\n            case sqliterk_value_type_binary:\n                sqlite3_bind_blob(stmt, i + 1,\n                                  sqliterk_column_binary(column, i),\n                                  sqliterk_column_bytes(column, i), NULL);\n                break;\n            case sqliterk_value_type_integer:\n                sqlite3_bind_int64(stmt, i + 1,\n                                   sqliterk_column_integer64(column, i));\n                break;\n            case sqliterk_value_type_null:\n                // If it's INTEGER PRIMARY KEY column, bind rowid instead.\n                if (ctx->ipk_column == i + 1)\n                    sqlite3_bind_int64(stmt, i + 1,\n                                       sqliterk_column_rowid(column));\n                else\n                    sqlite3_bind_null(stmt, i + 1);\n                break;\n            case sqliterk_value_type_number:\n                sqlite3_bind_double(stmt, i + 1,\n                                    sqliterk_column_number(column, i));\n                break;\n            case sqliterk_value_type_text:\n                sqlite3_bind_text(stmt, i + 1, sqliterk_column_text(column, i),\n                                  sqliterk_column_bytes(column, i), NULL);\n                break;\n        }\n    }\n\n    // Use defaults for remaining values.\n    for (; i < ctx->real_columns; i++) {\n        sqlite3_bind_value(stmt, i, ctx->dflt_values[i]);\n    }\n\n    while (sqlite3_step(stmt) == SQLITE_ROW) {\n    }\n    rc = sqlite3_reset(stmt);\n    if (rc != SQLITE_OK) {\n        sqliterkOSWarning(rc, \"Failed to execute SQL: %s [SQL: %s]\",\n                          sqlite3_errmsg(ctx->db), sqlite3_sql(stmt));\n        ctx->fail_count++;\n        return SQLITERK_OK;\n    }\n\n    ctx->success_count++;\n    if (ctx->success_count % 256 == 0) {\n        char *errmsg;\n        rc = sqlite3_exec(ctx->db, \"COMMIT; BEGIN;\", NULL, NULL, &errmsg);\n        if (errmsg) {\n            sqliterkOSWarning(rc, \"Failed to commit transaction: %s\", errmsg);\n            sqlite3_free(errmsg);\n        }\n    }\n\n    return SQLITERK_OK;\n}\n\nint sqliterk_output(sqliterk *rk,\n                    sqlite3 *db,\n                    sqliterk_master_info *master_,\n                    unsigned int flags)\n{\n    return sqliterk_output_cb(rk, db, master_, flags, NULL, NULL);\n}\n\nint sqliterk_output_cb(sqliterk *rk,\n                       sqlite3 *db,\n                       sqliterk_master_info *master_,\n                       unsigned int flags,\n                       int (*callback)(void *user,\n                                       sqliterk *rk,\n                                       sqliterk_table *table,\n                                       sqliterk_column *column),\n                       void *user)\n{\n    if (!rk || !db)\n        return SQLITERK_MISUSE;\n\n    sqliterk_master_map *master = static_cast<sqliterk_master_map *>(master_);\n    sqliterk_output_ctx ctx;\n    ctx.db = db;\n    ctx.stmt = NULL;\n    ctx.flags = flags;\n    ctx.success_count = 0;\n    ctx.fail_count = 0;\n    ctx.ipk_column = 0;\n    ctx.callback = callback;\n    ctx.user = user;\n    ctx.cancelled = 0;\n\n    if (!master)\n        ctx.flags |= SQLITERK_OUTPUT_ALL_TABLES;\n    else\n        ctx.tables = *master;\n\n    sqliterk_set_user_info(rk, &ctx);\n    sqliterk_notify notify;\n    notify.onBeginParseTable = dummyParseTableCallback;\n    notify.onEndParseTable = dummyParseTableCallback;\n    notify.onParseColumn = master_onParseColumn;\n    notify.didParsePage = NULL;\n    sqliterk_register_notify(rk, notify);\n    sqliterk_set_recursive(rk, 0);\n\n    const char *db_file = sqlite3_db_filename(db, \"main\");\n    sqliterkOSInfo(SQLITERK_OK, \"Output recovered data to '%s', flags 0x%04x\",\n                   db_file ? db_file : \"unknown\", flags);\n\n    // Parse sqlite_master for table info.\n    sqliterkOSDebug(SQLITERK_OK, \"Begin parsing sqlite_master...\");\n    int rc = sqliterk_parse_page(rk, 1);\n    if (rc == SQLITERK_CANCELLED) {\n        goto cancelled;\n    } else if (rc != SQLITERK_OK)\n        sqliterkOSWarning(rc, \"Failed to parse sqlite_master.\");\n    else\n        sqliterkOSInfo(rc, \"Parsed sqlite_master. [table/index: %zu]\",\n                       ctx.tables.size());\n\n    // Parse all tables.\n    notify.onBeginParseTable = table_onBeginParseTable;\n    notify.onParseColumn = table_onParseColumn;\n    sqliterk_register_notify(rk, notify);\n\n    for (sqliterk_master_map::iterator it = ctx.tables.begin();\n         it != ctx.tables.end(); ++it) {\n        if (ctx.cancelled)\n            goto cancelled;\n\n        if (it->second.type != sqliterk_type_table)\n            continue;\n\n        // Run CREATE TABLE statements if necessary.\n        if (!(ctx.flags & SQLITERK_OUTPUT_NO_CREATE_TABLES) &&\n            !it->second.sql.empty()) {\n            sqliterkOSDebug(SQLITERK_OK, \">>> %s\", it->second.sql.c_str());\n            char *errmsg = NULL;\n            const char *sql = it->second.sql.c_str();\n            rc = sqlite3_exec(ctx.db, sql, NULL, NULL, &errmsg);\n            if (errmsg) {\n                sqliterkOSWarning(rc, \"EXEC FAILED: %s [SQL: %s]\", errmsg, sql);\n                ctx.fail_count++;\n                sqlite3_free(errmsg);\n            } else\n                ctx.success_count++;\n        }\n\n        if (it->second.root_page != 0) {\n            const char *name = it->first.c_str();\n            int root_page = it->second.root_page;\n            sqliterkOSInfo(SQLITERK_OK, \"[%s] -> pgno: %d\", name, root_page);\n            ctx.table_cursor = it;\n            rc = sqliterk_parse_page(rk, root_page);\n            if (ctx.stmt) {\n                const char *sql =\n                    (rc == SQLITERK_CANCELLED) ? \"ROLLBACK;\" : \"COMMIT;\";\n\n                // Commit transaction and free statement.\n                char *errmsg;\n                int rc2 = sqlite3_exec(ctx.db, sql, NULL, NULL, &errmsg);\n                if (errmsg) {\n                    sqliterkOSWarning(rc2, \"Failed to commit transaction: %s\",\n                                      errmsg);\n                    sqlite3_free(errmsg);\n                }\n\n                fini_insert(&ctx);\n            }\n            if (rc == SQLITERK_CANCELLED) {\n                goto cancelled;\n            } else if (rc != SQLITERK_OK) {\n                sqliterkOSWarning(rc,\n                                  \"Failed to parse B-tree with root page %d.\",\n                                  it->second.root_page);\n            }\n        }\n    }\n\n    // Iterate through indices, create them if necessary.\n    if (!(ctx.flags & SQLITERK_OUTPUT_NO_CREATE_TABLES)) {\n        for (sqliterk_master_map::iterator it = ctx.tables.begin();\n             it != ctx.tables.end(); ++it) {\n            if (ctx.cancelled)\n                goto cancelled;\n\n            if (it->second.type != sqliterk_type_index)\n                continue;\n\n            const char *sql = it->second.sql.c_str();\n            sqliterkOSDebug(SQLITERK_OK, \">>> %s\", sql);\n            char *errmsg = NULL;\n            rc = sqlite3_exec(ctx.db, sql, NULL, NULL, &errmsg);\n            if (errmsg) {\n                sqliterkOSWarning(rc, \"EXEC FAILED: %s [SQL: %s]\", errmsg, sql);\n                ctx.fail_count++;\n                sqlite3_free(errmsg);\n            } else\n                ctx.success_count++;\n        }\n    }\n\n    // Return OK only if we had successfully output at least one row.\n    if (ctx.success_count == 0) {\n        if (ctx.tables.empty())\n            sqliterkOSError(SQLITERK_DAMAGED,\n                            \"No valid sqlite_master info available, \"\n                            \"sqlite_master is corrupted.\");\n        else\n            sqliterkOSError(SQLITERK_DAMAGED,\n                            \"No rows can be successfully output. [failed: %u]\",\n                            ctx.fail_count);\n        return SQLITERK_DAMAGED;\n    } else {\n        sqliterkOSInfo(SQLITERK_OK,\n                       \"Recovery output finished. [succeeded: %u, failed: %u]\",\n                       ctx.success_count, ctx.fail_count);\n        return SQLITERK_OK;\n    }\n\ncancelled:\n    sqliterkOSInfo(SQLITERK_CANCELLED,\n                   \"Recovery cancelled. [succeeded: %u, failed: %u]\",\n                   ctx.success_count, ctx.fail_count);\n    return SQLITERK_CANCELLED;\n}\n\nvoid sqliterk_cancel(sqliterk *rk)\n{\n    sqliterk_output_ctx *ctx =\n        (sqliterk_output_ctx *) sqliterk_get_user_info(rk);\n    if (ctx) {\n        ctx->cancelled = 1;\n    }\n}\n\nint sqliterk_make_master(const char **tables,\n                         int num_tables,\n                         sqliterk_master_info **out_master)\n{\n    if (!tables || !num_tables) {\n        *out_master = NULL;\n        return SQLITERK_OK;\n    }\n\n    sqliterk_master_map *master = new sqliterk_master_map();\n    for (int i = 0; i < num_tables; i++)\n        (*master)[tables[i]] =\n            sqliterk_master_entity(sqliterk_type_unknown, \"\", 0);\n\n    *out_master = static_cast<sqliterk_master_info *>(master);\n    return SQLITERK_OK;\n}\n\n#define SQLITERK_SM_TYPE_TABLE 0x01\n#define SQLITERK_SM_TYPE_INDEX 0x02\n\n#define SQLITERK_SM_MAGIC \"\\0dBmSt\"\n#define SQLITERK_SM_VERSION 1\n\n#pragma pack(push, 1)\nstruct master_file_header {\n    char magic[6];\n    uint16_t version;\n    uint32_t entities;\n    unsigned char kdf_salt[16];\n};\n\nstruct master_file_entity {\n    uint32_t root_page;\n    uint8_t type;\n    uint8_t name_len;\n    uint8_t tbl_name_len;\n    uint8_t reserved;\n    uint16_t sql_len;\n\n    unsigned char data[0];\n};\n#pragma pack(pop)\n\nint sqliterk_save_master(sqlite3 *db,\n                         const char *path,\n                         const void *key,\n                         int key_len)\n{\n    FILE *fp = NULL;\n    int rc = SQLITERK_OK;\n    sqlite3_stmt *stmt = NULL;\n    z_stream zstrm = {0};\n    CipherContext cipherContext(CipherContext::Encrypt);\n    unsigned char in_buf[512 + 8];\n    unsigned char out_buf[2048];\n    uint32_t entities = 0;\n    master_file_header header;\n\n    // Prepare deflate stream.\n    rc = deflateInit(&zstrm, Z_DEFAULT_COMPRESSION);\n    if (rc != Z_OK)\n        goto bail_zlib;\n    zstrm.data_type = Z_TEXT;\n\n    // Open output file.\n    fp = fopen(path, \"wb\");\n    if (!fp)\n        goto bail_errno;\n\n    // Prepare cipher key.\n    if (key && key_len) {\n        cipherContext.setKey(key, key_len);\n    } else {\n        key = NULL;\n    }\n\n    // Prepare SQL statement.\n    rc =\n        sqlite3_prepare_v2(db, \"SELECT * FROM sqlite_master;\", -1, &stmt, NULL);\n    if (rc != SQLITE_OK)\n        goto bail_sqlite;\n\n    // Write dummy header.\n    memset(&header, 0, sizeof(header));\n    if (fwrite(&header, sizeof(header), 1, fp) != 1)\n        goto bail_errno;\n\n    // Read all rows.\n    while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {\n        const char *typestr = (const char *) sqlite3_column_text(stmt, 0);\n        int name_len = sqlite3_column_bytes(stmt, 1);\n        const char *name = (const char *) sqlite3_column_text(stmt, 1);\n        int tbl_name_len = sqlite3_column_bytes(stmt, 2);\n        const char *tbl_name = (const char *) sqlite3_column_text(stmt, 2);\n        int root_page = sqlite3_column_int(stmt, 3);\n        int sql_len = sqlite3_column_bytes(stmt, 4);\n        const char *sql = (const char *) sqlite3_column_text(stmt, 4);\n\n        // Skip system tables and indices.\n        if (strncmp(name, \"sqlite_\", 7) == 0)\n            continue;\n\n        unsigned char type;\n        if (strcmp(typestr, \"table\") == 0)\n            type = SQLITERK_SM_TYPE_TABLE;\n        else if (strcmp(typestr, \"index\") == 0)\n            type = SQLITERK_SM_TYPE_INDEX;\n        else\n            continue;\n\n        if (name_len > 255 || tbl_name_len > 255 || sql_len > 65535) {\n            sqliterkOSError(SQLITERK_IOERR,\n                            \"Table/index has name longer than 255: %s, %s\",\n                            name, tbl_name);\n            goto bail;\n        }\n\n        // Write to zip-stream buffer.\n        master_file_entity *entity = (master_file_entity *) in_buf;\n        entity->root_page = root_page;\n        entity->type = type;\n        entity->name_len = (unsigned char) name_len;\n        entity->tbl_name_len = (unsigned char) tbl_name_len;\n        entity->reserved = 0;\n        entity->sql_len = (unsigned short) sql_len;\n        unsigned char *p_data = entity->data;\n        memcpy(p_data, name, name_len + 1);\n        p_data += name_len + 1;\n        memcpy(p_data, tbl_name, tbl_name_len + 1);\n        p_data += tbl_name_len + 1;\n\n        zstrm.next_in = in_buf;\n        zstrm.avail_in = (uInt)(p_data - in_buf);\n\n        do {\n            zstrm.next_out = out_buf;\n            zstrm.avail_out = sizeof(out_buf);\n            rc = deflate(&zstrm, Z_NO_FLUSH);\n            if (rc == Z_STREAM_ERROR)\n                goto bail_zlib;\n\n            unsigned have = sizeof(out_buf) - zstrm.avail_out;\n            if (key) {\n                cipherContext.cipher(out_buf, have);\n            }\n            if (fwrite(out_buf, 1, have, fp) != have) {\n                sqliterkOSError(SQLITERK_IOERR,\n                                \"Cannot write to backup file: %s\",\n                                strerror(errno));\n                goto bail;\n            }\n        } while (zstrm.avail_out == 0);\n\n        zstrm.next_in = (unsigned char *) sql;\n        zstrm.avail_in = sql_len + 1;\n\n        do {\n            zstrm.next_out = out_buf;\n            zstrm.avail_out = sizeof(out_buf);\n            rc = deflate(&zstrm, Z_NO_FLUSH);\n            if (rc == Z_STREAM_ERROR)\n                goto bail_zlib;\n\n            unsigned have = sizeof(out_buf) - zstrm.avail_out;\n            if (key) {\n                cipherContext.cipher(out_buf, have);\n            }\n            if (fwrite(out_buf, 1, have, fp) != have) {\n                sqliterkOSError(SQLITERK_IOERR,\n                                \"Cannot write to backup file: %s\",\n                                strerror(errno));\n                goto bail;\n            }\n        } while (zstrm.avail_out == 0);\n\n        entities++;\n    } // sqlite3_step\n    rc = sqlite3_finalize(stmt);\n    stmt = NULL;\n    if (rc != SQLITE_OK)\n        goto bail_sqlite;\n\n    // Flush Z-stream.\n    zstrm.avail_in = 0;\n    do {\n        zstrm.next_out = out_buf;\n        zstrm.avail_out = sizeof(out_buf);\n        rc = deflate(&zstrm, Z_FINISH);\n        if (rc == Z_STREAM_ERROR)\n            goto bail_zlib;\n\n        unsigned have = sizeof(out_buf) - zstrm.avail_out;\n        if (key) {\n            cipherContext.cipher(out_buf, have);\n        }\n        if (fwrite(out_buf, 1, have, fp) != have) {\n            sqliterkOSError(SQLITERK_IOERR, \"Cannot write to backup file: %s\",\n                            strerror(errno));\n            goto bail;\n        }\n    } while (zstrm.avail_out == 0);\n    deflateEnd(&zstrm);\n\n    // Read KDF salt from file header.\n    sqlite3_file *db_file;\n    rc = sqlite3_file_control(db, \"main\", SQLITE_FCNTL_FILE_POINTER, &db_file);\n    if (rc != SQLITE_OK)\n        goto bail_sqlite;\n\n    rc = db_file->pMethods->xRead(db_file, header.kdf_salt,\n                                  sizeof(header.kdf_salt), 0);\n    if (rc != SQLITE_OK)\n        goto bail_sqlite;\n\n    // Write real header.\n    memcpy(header.magic, SQLITERK_SM_MAGIC, sizeof(header.magic));\n    header.version = SQLITERK_SM_VERSION;\n    header.entities = entities;\n    fseek(fp, 0, SEEK_SET);\n    fwrite(&header, sizeof(header), 1, fp);\n    fclose(fp);\n\n    sqliterkOSInfo(SQLITERK_OK, \"Saved master info with %u entries.\", entities);\n    return SQLITERK_OK;\n\nbail_zlib:\n    sqliterkOSError(SQLITERK_CANTOPEN, \"Failed to backup master table: %s\",\n                    zstrm.msg);\n    goto bail;\nbail_errno:\n    sqliterkOSError(rc, \"Failed to backup master table: %s\", strerror(errno));\n    goto bail;\nbail_sqlite:\n    sqliterkOSError(rc, \"Failed to backup master table: %s\",\n                    sqlite3_errmsg(db));\n\nbail:\n    if (fp)\n        fclose(fp);\n    if (stmt)\n        sqlite3_finalize(stmt);\n    deflateEnd(&zstrm);\n    return rc;\n}\n\nstatic const size_t IN_BUF_SIZE = 4096;\nstatic int inflate_read(FILE *fp,\n                        z_streamp strm,\n                        void *buf,\n                        unsigned size,\n                        CipherContext *cipherContext)\n{\n    int ret;\n    if (size == 0)\n        return SQLITERK_OK;\n\n    strm->next_out = (unsigned char *) buf;\n    strm->avail_out = size;\n\n    do {\n        if (strm->avail_in == 0 && !feof(fp)) {\n            unsigned char *in_buf = strm->next_in - strm->total_in;\n            strm->total_in = 0;\n\n            ret = (int) fread(in_buf, 1, IN_BUF_SIZE, fp);\n            if (ret == 0 && ferror(fp))\n                return SQLITERK_IOERR;\n            if (ret > 0) {\n                if (cipherContext) {\n                    cipherContext->cipher(in_buf, ret);\n                }\n                strm->next_in = in_buf;\n                strm->avail_in = ret;\n            }\n        }\n\n        ret = inflate(strm, Z_NO_FLUSH);\n        if (ret != Z_OK && ret != Z_STREAM_END)\n            return SQLITERK_DAMAGED;\n\n    } while (strm->avail_out > 0 && ret != Z_STREAM_END);\n\n    return strm->avail_out ? SQLITERK_DAMAGED : SQLITERK_OK;\n}\n\nstatic int pstrcmp(const void *p1, const void *p2)\n{\n    return strcmp(*(char *const *) p1, *(char *const *) p2);\n}\n\nint sqliterk_load_master(const char *path,\n                         const void *key,\n                         int key_len,\n                         const char **tables,\n                         int num_tables,\n                         sqliterk_master_info **out_master,\n                         unsigned char *out_kdf_salt)\n{\n    FILE *fp = NULL;\n    z_stream zstrm = {0};\n    CipherContext cipherContext(CipherContext::Decrypt);\n    int rc;\n    unsigned char in_buf[IN_BUF_SIZE];\n    const char **filter = NULL;\n    sqliterk_master_map *master = NULL;\n    uint32_t entities;\n\n    // Allocate output buffer.\n    char *str_buf = (char *) malloc(65536 + 512);\n    if (!str_buf)\n        goto bail_errno;\n\n    // Sort table filter for later binary searching.\n    if (tables && num_tables) {\n        sqliterk_make_master(tables, num_tables,\n                             (sqliterk_master_info **) &master);\n\n        size_t filter_size = num_tables * sizeof(const char *);\n        filter = (const char **) malloc(filter_size);\n        if (!filter)\n            goto bail_errno;\n\n        memcpy(filter, tables, filter_size);\n        qsort(filter, num_tables, sizeof(const char *), pstrcmp);\n    }\n    if (!master)\n        master = new sqliterk_master_map();\n\n    fp = fopen(path, \"rb\");\n    if (!fp)\n        goto bail_errno;\n\n    // Read header.\n    master_file_header header;\n    if (fread(&header, sizeof(header), 1, fp) != 1)\n        goto bail_errno;\n    if (memcmp(header.magic, SQLITERK_SM_MAGIC, sizeof(header.magic)) != 0 ||\n        header.version != SQLITERK_SM_VERSION) {\n        sqliterkOSError(SQLITERK_DAMAGED, \"Invalid format: %s\", path);\n        goto bail;\n    }\n\n    // Initialize zlib and RC4.\n    rc = inflateInit(&zstrm);\n    if (rc != Z_OK)\n        goto bail_zlib;\n\n    if (key && key_len) {\n        cipherContext.setKey(key, key_len);\n    } else {\n        key = NULL;\n    }\n\n    // Read all entities.\n    entities = header.entities;\n    zstrm.next_in = in_buf;\n    zstrm.avail_in = 0;\n    while (entities--) {\n        // Read entity header.\n        master_file_entity entity;\n        rc = inflate_read(fp, &zstrm, &entity, sizeof(entity),\n                          key ? &cipherContext : NULL);\n        if (rc == SQLITERK_IOERR)\n            goto bail_errno;\n        else if (rc == SQLITERK_DAMAGED)\n            goto bail_zlib;\n\n        // Read names and SQL.\n        rc = inflate_read(fp, &zstrm, str_buf,\n                          entity.name_len + entity.tbl_name_len +\n                              entity.sql_len + 3,\n                          key ? &cipherContext : NULL);\n        if (rc == SQLITERK_IOERR)\n            goto bail_errno;\n        else if (rc == SQLITERK_DAMAGED)\n            goto bail_zlib;\n\n        const char *name = str_buf;\n        const char *tbl_name = name + entity.name_len + 1;\n        const char *sql = tbl_name + entity.tbl_name_len + 1;\n        if (name[entity.name_len] != '\\0' ||\n            tbl_name[entity.tbl_name_len] != '\\0' ||\n            sql[entity.sql_len] != '\\0') {\n            sqliterkOSError(SQLITERK_DAMAGED,\n                            \"Invalid string. File corrupted.\");\n            goto bail;\n        }\n\n        // Filter tables.\n        if (!filter || bsearch(&tbl_name, filter, num_tables,\n                               sizeof(const char *), pstrcmp)) {\n            sqliterk_master_entity e(sqliterk_type_unknown, sql,\n                                     entity.root_page);\n            if (entity.type == SQLITERK_SM_TYPE_TABLE)\n                e.type = sqliterk_type_table;\n            else if (entity.type == SQLITERK_SM_TYPE_INDEX)\n                e.type = sqliterk_type_index;\n\n            (*master)[name] = e;\n        }\n    }\n\n    inflateEnd(&zstrm);\n    free(str_buf);\n    free(filter);\n    fclose(fp);\n\n    if (out_kdf_salt)\n        memcpy(out_kdf_salt, header.kdf_salt, sizeof(header.kdf_salt));\n    *out_master = static_cast<sqliterk_master_info *>(master);\n    sqliterkOSInfo(SQLITERK_OK, \"Loaded master info with %zu valid entries.\",\n                   master->size());\n    return SQLITERK_OK;\n\nbail_errno:\n    sqliterkOSError(SQLITERK_IOERR, \"Cannot load master table: %s\",\n                    strerror(errno));\n    goto bail;\nbail_zlib:\n    sqliterkOSError(SQLITERK_DAMAGED, \"Cannot load master table: %s\",\n                    zstrm.msg);\nbail:\n    if (master)\n        delete master;\n    free(str_buf);\n    free(filter);\n    inflateEnd(&zstrm);\n    if (fp)\n        fclose(fp);\n    return SQLITERK_DAMAGED;\n}\n\nvoid sqliterk_free_master(sqliterk_master_info *master)\n{\n    if (master)\n        delete static_cast<sqliterk_master_map *>(master);\n}\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_pager.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk_pager.h\"\n#include \"SQLiteRepairKit.h\"\n#include \"sqliterk_crypto.h\"\n#include \"sqliterk_os.h\"\n#include \"sqliterk_util.h\"\n#include <errno.h>\n#include <string.h>\n\nstatic int sqliterkPagerParseHeader(sqliterk_pager *pager, int forcePageSize);\nstatic int sqliterkPageAcquireOne(sqliterk_pager *pager,\n                                  int pageno,\n                                  sqliterk_page **page,\n                                  sqliterk_page_type type);\n\nstruct sqliterk_page {\n    int pageno;\n    unsigned char *data; // page data\n    sqliterk_page_type type;\n};\n\nint sqliterkPagerOpen(const char *path,\n                      const sqliterk_cipher_conf *cipher,\n                      sqliterk_pager **pager)\n{\n    // Workaround page size cannot be specified for plain-text\n    // databases. For that case, pass non-null cipher_conf with\n    // null key and non-zero page size.\n    int forcePageSize = 0;\n    if (cipher && !cipher->key) {\n        forcePageSize = cipher->page_size;\n        cipher = NULL;\n    }\n\n    if (!pager) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk_pager *thePager = sqliterkOSMalloc(sizeof(sqliterk_pager));\n    if (!thePager) {\n        rc = SQLITERK_NOMEM;\n        sqliterkOSError(rc, \"Not enough memory, required %zu bytes.\",\n                        sizeof(sqliterk_pager));\n        goto sqliterkPagerOpen_Failed;\n    }\n\n    rc = sqliterkOSReadOnlyOpen(path, &thePager->file);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkPagerOpen_Failed;\n    }\n\n    if (cipher) {\n        // Try KDF salt in SQLite file first.\n        sqliterk_cipher_conf c;\n        memcpy(&c, cipher, sizeof(c));\n        c.kdf_salt = NULL;\n\n        rc = sqliterkCryptoSetCipher(thePager, thePager->file, &c);\n        if (rc != SQLITERK_OK)\n            goto sqliterkPagerOpen_Failed;\n\n        // Try parsing header.\n        sqliterkPagerParseHeader(thePager, 0);\n\n        if (thePager->integrity & SQLITERK_INTEGRITY_HEADER) {\n            // If header is parsed successfully, original KDF salt is also correct.\n            thePager->integrity |= SQLITERK_INTEGRITY_KDF_SALT;\n        } else if (cipher->kdf_salt) {\n            // If anything goes wrong, use KDF salt specified in cipher config.\n            sqliterkOSWarning(SQLITERK_DAMAGED, \"Header cannot be decoded \"\n                                                \"correctly. Trying to apply \"\n                                                \"recovery data.\");\n            rc = sqliterkCryptoSetCipher(thePager, thePager->file, cipher);\n            if (rc != SQLITERK_OK)\n                goto sqliterkPagerOpen_Failed;\n\n            rc = sqliterkPagerParseHeader(thePager, 0);\n            if (rc != SQLITERK_OK)\n                goto sqliterkPagerOpen_Failed;\n        }\n    } else {\n        rc = sqliterkPagerParseHeader(thePager, forcePageSize);\n        if (rc != SQLITERK_OK)\n            goto sqliterkPagerOpen_Failed;\n\n        // For plain-text databases, just mark KDF salt correct.\n        if (thePager->integrity & SQLITERK_INTEGRITY_HEADER)\n            thePager->integrity |= SQLITERK_INTEGRITY_KDF_SALT;\n    }\n    if (!(thePager->integrity & SQLITERK_INTEGRITY_HEADER))\n        sqliterkOSWarning(SQLITERK_DAMAGED, \"Header corrupted.\");\n    else\n        sqliterkOSInfo(SQLITERK_OK, \"Header checksum OK.\");\n\n    int pageCount = thePager->pagecount;\n    size_t len = sizeof(sqliterk_status) * (pageCount + 1);\n    thePager->pagesStatus = sqliterkOSMalloc(len);\n    if (!thePager->pagesStatus) {\n        rc = SQLITERK_NOMEM;\n        sqliterkOSError(rc, \"Not enough memory, required %zu bytes.\", len);\n        goto sqliterkPagerOpen_Failed;\n    }\n\n    *pager = thePager;\n\n    return SQLITERK_OK;\n\nsqliterkPagerOpen_Failed:\n    if (thePager) {\n        sqliterkPagerClose(thePager);\n    }\n    *pager = NULL;\n    return rc;\n}\n\n// Get the meta from header and set it into pager.\n// For further information, see https://www.sqlite.org/fileformat2.html\nstatic int sqliterkPagerParseHeader(sqliterk_pager *pager, int forcePageSize)\n{\n    // For encrypted databases, assume default page size, decode the first\n    // page, and we have the plain-text header.\n\n    if (!pager) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n\n    // Overwrite pager page size if forcePageSize is specified.\n    if (forcePageSize) {\n        pager->pagesize = forcePageSize;\n    }\n\n    size_t size = pager->codec ? pager->pagesize : 100;\n\n    // Read data\n    unsigned char *buffer = sqliterkOSMalloc(size);\n    if (!buffer) {\n        rc = SQLITERK_NOMEM;\n        sqliterkOSError(rc, \"Not enough memory, required %zu bytes.\", size);\n        goto sqliterkPagerParseHeader_End;\n    }\n\n    rc = sqliterkOSRead(pager->file, 0, buffer, &size);\n    if (rc != SQLITERK_OK) {\n        if (rc == SQLITERK_SHORT_READ)\n            sqliterkOSError(rc, \"File truncated.\");\n        else\n            sqliterkOSError(rc, \"Cannot read file '%s': %s\",\n                            sqliterkOSGetFilePath(pager->file),\n                            strerror(errno));\n        pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n        goto sqliterkPagerParseHeader_End;\n    }\n\n    pager->integrity |= SQLITERK_INTEGRITY_HEADER;\n\n    if (pager->codec) {\n        rc = sqliterkCryptoDecode(pager->codec, 1, buffer);\n        if (rc != SQLITERK_OK) {\n            sqliterkOSWarning(SQLITERK_DAMAGED,\n                              \"Failed to decode page 1, header corrupted.\");\n            pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n        }\n    }\n\n    if (pager->integrity & SQLITERK_INTEGRITY_HEADER) {\n        if (memcmp(buffer, \"SQLite format 3\\000\", 16) == 0) {\n            //parse pagesize\n            int pagesize;\n            sqliterkParseInt(buffer, 16, 2, &pagesize);\n            if (pager->codec || forcePageSize) {\n                // Page size is predefined, check whether it matches the header.\n                if (pagesize != pager->pagesize) {\n                    sqliterkOSWarning(\n                        SQLITERK_DAMAGED,\n                        \"Invalid page size: %d expected, %d returned.\",\n                        pager->pagesize, pagesize);\n                    pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n                }\n            } else if (((pagesize - 1) & pagesize) != 0 || pagesize < 512) {\n                // Page size is not predefined and value in the header is invalid,\n                // use the default page size.\n                sqliterkOSWarning(SQLITERK_DAMAGED,\n                                  \"Page size field is corrupted. Default page \"\n                                  \"size %d is used\",\n                                  SQLITRK_CONFIG_DEFAULT_PAGESIZE);\n                pager->pagesize = SQLITRK_CONFIG_DEFAULT_PAGESIZE;\n                pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n            } else {\n                // Page size is not predefined and value in the header is valid,\n                // use the value in header.\n                pager->pagesize = pagesize;\n            }\n\n            // parse free page count\n            sqliterkParseInt(buffer, 36, 4, &pager->freepagecount);\n\n            // parse reserved bytes\n            int reservedBytes;\n            sqliterkParseInt(buffer, 20, 1, &reservedBytes);\n            if (pager->codec) {\n                if (reservedBytes != pager->reservedBytes) {\n                    sqliterkOSWarning(SQLITERK_DAMAGED,\n                                      \"Reserved bytes field doesn't match. %d \"\n                                      \"expected, %d returned.\",\n                                      pager->reservedBytes, reservedBytes);\n                    pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n                }\n            } else if (reservedBytes < 0 || reservedBytes > 255) {\n                sqliterkOSWarning(\n                    SQLITERK_DAMAGED,\n                    \"The [reserved bytes] field is corrupted. 0 is used\");\n                pager->reservedBytes = 0;\n                pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n            } else\n                pager->reservedBytes = reservedBytes;\n        } else {\n            // Header is corrupted. Defaults the config\n            sqliterkOSWarning(SQLITERK_DAMAGED,\n                              \"SQLite format magic corrupted.\");\n            if (!pager->codec) {\n                pager->pagesize = SQLITRK_CONFIG_DEFAULT_PAGESIZE;\n                pager->reservedBytes = 0;\n            }\n            pager->freepagecount = 0;\n            pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n        }\n    }\n\n    // Assign page count\n    size_t filesize;\n    rc = sqliterkOSFileSize(pager->file, &filesize);\n    if (rc != SQLITERK_OK) {\n        sqliterkOSError(rc, \"Failed to get size of file '%s': %s\",\n                        sqliterkOSGetFilePath(pager->file), strerror(errno));\n        goto sqliterkPagerParseHeader_End;\n    }\n\n    pager->pagecount =\n        (int) ((filesize + pager->pagesize - 1) / pager->pagesize);\n    if (pager->pagecount < 1) {\n        rc = SQLITERK_DAMAGED;\n        sqliterkOSError(rc, \"File truncated.\");\n        goto sqliterkPagerParseHeader_End;\n    }\n\n    // Check free page\n    if (pager->freepagecount < 0 || pager->freepagecount > pager->pagecount) {\n        sqliterkOSWarning(\n            SQLITERK_DAMAGED,\n            \"The [free page count] field is corrupted. 0 is used\");\n        pager->freepagecount = 0;\n        pager->integrity &= ~SQLITERK_INTEGRITY_HEADER;\n    }\n\n    // Assign usableSize\n    pager->usableSize = pager->pagesize - pager->reservedBytes;\n\nsqliterkPagerParseHeader_End:\n    if (buffer) {\n        sqliterkOSFree(buffer);\n    }\n    return rc;\n}\n\nint sqliterkPagerClose(sqliterk_pager *pager)\n{\n    if (!pager) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    if (pager->file) {\n        rc = sqliterkOSClose(pager->file);\n        pager->file = NULL;\n    }\n    if (pager->pagesStatus) {\n        sqliterkOSFree(pager->pagesStatus);\n        pager->pagesStatus = NULL;\n    }\n    pager->pagesize = 0;\n    pager->pagecount = 0;\n\n    sqliterkCryptoFreeCodec(pager);\n\n    sqliterkOSFree(pager);\n    return rc;\n}\n\nint sqliterkPagerGetPageCount(sqliterk_pager *pager)\n{\n    if (!pager) {\n        return 0;\n    }\n    return pager->pagecount;\n}\n\nint sqliterkPagerIsPagenoValid(sqliterk_pager *pager, int pageno)\n{\n    if (!pager || pageno < 1 || pageno > pager->pagecount) {\n        return SQLITERK_MISUSE;\n    }\n    return SQLITERK_OK;\n}\n\n// Get the page type from file at page [pageno]\nint sqliterkPageAcquireType(sqliterk_pager *pager,\n                            int pageno,\n                            sqliterk_page_type *type)\n{\n    // TODO: for encrypted databases, decode the whole page.\n    // Use sqliterkPageAcquire instead.\n\n    if (!pager || sqliterkPagerIsPagenoValid(pager, pageno) != SQLITERK_OK ||\n        !type) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    unsigned char typedata;\n    size_t typesize = 1;\n    rc = sqliterkOSRead(pager->file,\n                        sqliterkPagenoHeaderOffset(pageno) +\n                            (pageno - 1) * pager->pagesize,\n                        &typedata, &typesize);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkPageAcquireType_Failed;\n    }\n\n    int theType;\n    sqliterkParseInt(&typedata, 0, 1, &theType);\n    switch (theType) {\n        case sqliterk_page_type_interior_index:\n        case sqliterk_page_type_interior_table:\n        case sqliterk_page_type_leaf_index:\n        case sqliterk_page_type_leaf_table:\n            *type = theType;\n            break;\n        default:\n            *type = sqliterk_page_type_unknown;\n            break;\n    }\n    return SQLITERK_OK;\n\nsqliterkPageAcquireType_Failed:\n    *type = sqliterk_page_type_unknown;\n    return rc;\n}\n\n// Get whole page data from file at page [pageno] and setup the [page].\nint sqliterkPageAcquire(sqliterk_pager *pager, int pageno, sqliterk_page **page)\n{\n    return sqliterkPageAcquireOne(pager, pageno, page,\n                                  sqliterk_page_type_unknown);\n}\n\nint sqliterkPageAcquireOverflow(sqliterk_pager *pager,\n                                int pageno,\n                                sqliterk_page **page)\n{\n    return sqliterkPageAcquireOne(pager, pageno, page,\n                                  sqliterk_page_type_overflow);\n}\n\nstatic int sqliterkPageAcquireOne(sqliterk_pager *pager,\n                                  int pageno,\n                                  sqliterk_page **page,\n                                  sqliterk_page_type type)\n{\n    if (!pager || !page ||\n        sqliterkPagerIsPagenoValid(pager, pageno) != SQLITERK_OK) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk_page *thePage = sqliterkOSMalloc(sizeof(sqliterk_page));\n    if (!thePage) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkPageAcquire_Failed;\n    }\n\n    thePage->pageno = pageno;\n\n    thePage->data = sqliterkOSMalloc(pager->pagesize);\n    if (!thePage->data) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkPageAcquire_Failed;\n    }\n\n    size_t size = pager->pagesize;\n    rc = sqliterkOSRead(pager->file, (pageno - 1) * pager->pagesize,\n                        thePage->data, &size);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkPageAcquire_Failed;\n    }\n\n    // For encrypted databases, decode page.\n    if (pager->codec) {\n        rc = sqliterkCryptoDecode(pager->codec, pageno, thePage->data);\n        if (rc != SQLITERK_OK)\n            goto sqliterkPageAcquire_Failed;\n    }\n\n    // Check type\n    if (type == sqliterk_page_type_unknown) {\n        sqliterkParseInt(thePage->data, sqliterkPageHeaderOffset(thePage), 1,\n                         &type);\n        switch (type) {\n            case sqliterk_page_type_interior_index:\n            case sqliterk_page_type_interior_table:\n            case sqliterk_page_type_leaf_index:\n            case sqliterk_page_type_leaf_table:\n                thePage->type = type;\n                break;\n            default:\n                thePage->type = sqliterk_page_type_unknown;\n                break;\n        }\n    } else {\n        thePage->type = type;\n    }\n\n    *page = thePage;\n    return SQLITERK_OK;\n\nsqliterkPageAcquire_Failed:\n    if (thePage) {\n        sqliterkPageRelease(thePage);\n    }\n    *page = NULL;\n    return rc;\n}\n\nint sqliterkPageRelease(sqliterk_page *page)\n{\n    if (!page) {\n        return SQLITERK_MISUSE;\n    }\n    if (page->data) {\n        sqliterkOSFree(page->data);\n        page->data = NULL;\n    }\n    sqliterkOSFree(page);\n    return SQLITERK_OK;\n}\n\n// Ahead release the page data to save memory\nint sqliterkPageClearData(sqliterk_page *page)\n{\n    if (!page) {\n        return SQLITERK_MISUSE;\n    }\n    if (page->data) {\n        sqliterkOSFree(page->data);\n        page->data = NULL;\n    }\n    return SQLITERK_OK;\n}\n\nconst unsigned char *sqliterkPageGetData(sqliterk_page *page)\n{\n    if (!page) {\n        return NULL;\n    }\n    return page->data;\n}\n\nint sqliterkPagerGetSize(sqliterk_pager *pager)\n{\n    if (!pager) {\n        return 0;\n    }\n    return pager->pagesize;\n}\n\nint sqliterkPagerGetUsableSize(sqliterk_pager *pager)\n{\n    if (!pager) {\n        return 0;\n    }\n    return pager->usableSize;\n}\n\nint sqliterkPageGetPageno(sqliterk_page *page)\n{\n    if (!page) {\n        return 0;\n    }\n    return page->pageno;\n}\nsqliterk_page_type sqliterkPageGetType(sqliterk_page *page)\n{\n    if (!page) {\n        return sqliterk_page_type_unknown;\n    }\n    return page->type;\n}\n\nint sqliterkPagenoHeaderOffset(int pageno)\n{\n    if (pageno == 1) {\n        return 100;\n    }\n    return 0;\n}\n\nint sqliterkPageHeaderOffset(sqliterk_page *page)\n{\n    if (!page) {\n        return 0;\n    }\n    return sqliterkPagenoHeaderOffset(page->pageno);\n}\n\nconst char *sqliterkPageGetTypeName(sqliterk_page_type type)\n{\n    char *name;\n    switch (type) {\n        case sqliterk_page_type_interior_index:\n            name = \"interior-index btree\";\n            break;\n        case sqliterk_page_type_interior_table:\n            name = \"interior-table btree\";\n            break;\n        case sqliterk_page_type_leaf_index:\n            name = \"leaf-index btree\";\n            break;\n        case sqliterk_page_type_leaf_table:\n            name = \"leaf-table btree\";\n            break;\n        default:\n            name = \"unknown page\";\n            break;\n    }\n    return name;\n}\n\nvoid sqliterkPagerSetStatus(sqliterk_pager *pager,\n                            int pageno,\n                            sqliterk_status status)\n{\n    if (!pager || !pager->pagesStatus ||\n        sqliterkPagerIsPagenoValid(pager, pageno) != SQLITERK_OK) {\n        return;\n    }\n\n    pager->pagesStatus[pageno - 1] = status;\n    if (status == sqliterk_status_checked)\n        pager->integrity |= SQLITERK_INTEGRITY_DATA;\n}\n\nsqliterk_status sqliterkPagerGetStatus(sqliterk_pager *pager, int pageno)\n{\n    if (!pager || !pager->pagesStatus ||\n        sqliterkPagerIsPagenoValid(pager, pageno) != SQLITERK_OK) {\n        return sqliterk_status_invalid;\n    }\n    return pager->pagesStatus[pageno - 1];\n}\n\nint sqliterkPagerGetParsedPageCount(sqliterk_pager *pager)\n{\n    if (!pager || !pager->pagesStatus) {\n        return 0;\n    }\n\n    int i, count = 0;\n    for (i = 0; i < pager->pagecount; i++) {\n        if (pager->pagesStatus[i] == sqliterk_status_checked) {\n            count++;\n        }\n    }\n    return count;\n}\n\nint sqliterkPagerGetValidPageCount(sqliterk_pager *pager)\n{\n    if (!pager) {\n        return 0;\n    }\n    return pager->pagecount - pager->freepagecount;\n}\n\nunsigned int sqliterkPagerGetIntegrity(sqliterk_pager *pager)\n{\n    if (!pager) {\n        return 0;\n    }\n    return pager->integrity;\n}\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_pager.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_pager_h\n#define sqliterk_pager_h\n\n#include \"sqliterk_crypto.h\"\n#include <stdio.h>\n\n// A legal state transfer is:\n// unchecked --> checking\n// checking --> invalid\n// checking --> damaged\n// checking --> checked\n// checking --> discarded\n// default status is unchecked\ntypedef enum {\n    sqliterk_status_invalid = -1,\n    sqliterk_status_unchecked = 0,\n    sqliterk_status_checking = 1,\n    sqliterk_status_damaged = 2,\n    sqliterk_status_discarded = 3,\n    sqliterk_status_checked = 4,\n} sqliterk_status;\n\n// We are only concerned about the listed types. See https://www.sqlite.org/fileformat2.html#btree\ntypedef enum {\n    sqliterk_page_type_interior_index = 2,\n    sqliterk_page_type_interior_table = 5,\n    sqliterk_page_type_leaf_index = 10,\n    sqliterk_page_type_leaf_table = 13,\n    sqliterk_page_type_overflow = 1,\n    sqliterk_page_type_unknown = -1,\n} sqliterk_page_type;\n\n// sqliterk_pager is the management class for all page in single db file\ntypedef struct sqliterk_pager sqliterk_pager;\n// sqliterk_page is single page in db file, including its page data. But sometime, page data will be ahead release to save memory.\ntypedef struct sqliterk_page sqliterk_page;\n\ntypedef struct sqliterk_file sqliterk_file;\ntypedef struct sqliterk_cipher_conf sqliterk_cipher_conf;\nstruct sqliterk_pager {\n    sqliterk_file *file;\n    sqliterk_status *pagesStatus;\n    int pagesize;\n    int freepagecount;\n    int reservedBytes;\n    int pagecount;\n    int usableSize;         // pagesize-reservedBytes\n    unsigned int integrity; // integrity flags.\n\n    sqliterk_codec *codec; // Codec context, implemented in SQLCipher library.\n};\n\nint sqliterkPagerOpen(const char *path,\n                      const sqliterk_cipher_conf *cipher,\n                      sqliterk_pager **pager);\nint sqliterkPagerClose(sqliterk_pager *pager);\nint sqliterkPagerGetPageCount(sqliterk_pager *pager);\nint sqliterkPagerIsPagenoValid(sqliterk_pager *pager, int pageno);\nint sqliterkPagerGetSize(sqliterk_pager *pager);\nint sqliterkPagerGetUsableSize(sqliterk_pager *pager);\n\nvoid sqliterkPagerSetStatus(sqliterk_pager *pager,\n                            int pageno,\n                            sqliterk_status status);\nsqliterk_status sqliterkPagerGetStatus(sqliterk_pager *pager, int pageno);\nint sqliterkPagerGetParsedPageCount(sqliterk_pager *pager);\nint sqliterkPagerGetValidPageCount(sqliterk_pager *pager);\nunsigned int sqliterkPagerGetIntegrity(sqliterk_pager *pager);\n\nint sqliterkPageAcquire(sqliterk_pager *pager,\n                        int pageno,\n                        sqliterk_page **page);\nint sqliterkPageAcquireOverflow(sqliterk_pager *pager,\n                                int pageno,\n                                sqliterk_page **page);\nint sqliterkPageAcquireType(sqliterk_pager *pager,\n                            int pageno,\n                            sqliterk_page_type *type);\nint sqliterkPageClearData(sqliterk_page *page);\nint sqliterkPageRelease(sqliterk_page *page);\n\nint sqliterkPagenoHeaderOffset(int pageno);\nint sqliterkPageHeaderOffset(sqliterk_page *page);\n\nconst unsigned char *sqliterkPageGetData(sqliterk_page *page);\n\nint sqliterkPageGetPageno(sqliterk_page *page);\nsqliterk_page_type sqliterkPageGetType(sqliterk_page *page);\n\nconst char *sqliterkPageGetTypeName(sqliterk_page_type type);\n\n#endif /* sqliterk_pager_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_util.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk_util.h\"\n#include \"SQLiteRepairKit.h\"\n#include <stdarg.h>\n#include <stdlib.h>\n#include <string.h>\n\nint sqliterkParseInt(const unsigned char *data,\n                     int offset,\n                     int length,\n                     int *value)\n{\n    if (!value || length > sizeof(int)) {\n        return SQLITERK_MISUSE;\n    }\n    int64_t out;\n    int rc = sqliterkParseInt64(data, offset, length, &out);\n    if (rc != SQLITERK_OK) {\n        return rc;\n    }\n    *value = (int) out;\n    return SQLITERK_OK;\n}\n\nint sqliterkParseInt64(const unsigned char *data,\n                       int offset,\n                       int length,\n                       int64_t *value)\n{\n    if (!data || !value)\n        return SQLITERK_MISUSE;\n\n    const unsigned char *p = data + offset;\n    int64_t out;\n\n    switch (length) {\n        case 1:\n            out = (int8_t) p[0];\n            break;\n        case 2:\n            out = (((int8_t) p[0]) * 256) | p[1];\n            break;\n        case 3:\n            out = (((int8_t) p[0]) * 65536) | (p[1] << 8) | p[2];\n            break;\n        case 4:\n            out = (((int8_t) p[0]) * 16777216) | (p[1] << 16) | (p[2] << 8) |\n                  p[3];\n            break;\n        case 6:\n            out = (((int8_t) p[0]) * 256) | p[1];\n            out *= ((int64_t) 1) << 32;\n            out +=\n                (((uint32_t) p[2]) << 24) | (p[3] << 16) | (p[4] << 8) | p[5];\n            break;\n        case 8:\n            out = (((int8_t) p[0]) * 16777216) | (p[1] << 16) | (p[2] << 8) |\n                  p[3];\n            out *= ((int64_t) 1) << 32;\n            out +=\n                (((uint32_t) p[4]) << 24) | (p[5] << 16) | (p[6] << 8) | p[7];\n            break;\n        default:\n            return SQLITERK_MISUSE;\n    }\n\n    *value = out;\n    return SQLITERK_OK;\n}\n\n// Varint is a kind of huffman encoding value. For further informantion,\n// see https://www.sqlite.org/fileformat2.html#varint\nint sqliterkParseVarint(const unsigned char *data,\n                        int offset,\n                        int *length,\n                        int *value)\n{\n    if (!value) {\n        return SQLITERK_MISUSE;\n    }\n    int64_t out;\n    int rc = sqliterkParseVarint64(data, offset, length, &out);\n    if (rc != SQLITERK_OK) {\n        return rc;\n    }\n    *value = (int) out;\n    return SQLITERK_OK;\n}\n\nint sqliterkParseVarint64(const unsigned char *data,\n                          int offset,\n                          int *length,\n                          int64_t *value)\n{\n    if (!data || !length || !value) {\n        return SQLITERK_MISUSE;\n    }\n    int64_t out = 0;\n    const unsigned char *begin = data + offset;\n    int i = 0;\n    while ((begin[i] & 0x80) && i < sqliterkGetMaxVarintLength()) {\n        out |= (begin[i] & 0x7f);\n        out = (out << 7);\n        i++;\n        if (i >= sqliterkGetMaxVarintLength()) {\n            return SQLITERK_DAMAGED;\n        }\n    }\n    out |= begin[i];\n    *length = i + 1;\n    *value = out;\n    return SQLITERK_OK;\n}\n\nint sqliterkGetMaxVarintLength()\n{\n    return 9;\n}\n\nint sqliterkParseNumber(const unsigned char *data, int offset, double *value)\n{\n    if (!data || !value) {\n        return SQLITERK_MISUSE;\n    }\n    unsigned char out[8];\n    const unsigned char *begin = data + offset;\n    int i;\n    for (i = 0; i < 8; i++) {\n        // All float values in SQLite is big-endian with 8 lengths.\n        // For further informantion, see [Record Format] chapter at\n        // https://www.sqlite.org/fileformat2.html\n        out[i] = begin[8 - 1 - i];\n    }\n    memcpy(value, out, 8);\n    return SQLITERK_OK;\n}\n\nconst char *sqliterkGetResultCodeDescription(int result)\n{\n    switch (result) {\n        case SQLITERK_OK:\n            return \"SQLITERK_OK\";\n        case SQLITERK_CANTOPEN:\n            return \"SQLITERK_CANTOPEN\";\n        case SQLITERK_MISUSE:\n            return \"SQLITERK_MISUSE\";\n        case SQLITERK_IOERR:\n            return \"SQLITERK_IOERR\";\n        case SQLITERK_NOMEM:\n            return \"SQLITERK_NOMEM\";\n        case SQLITERK_SHORT_READ:\n            return \"SQLITERK_SHORT_READ\";\n        case SQLITERK_DAMAGED:\n            return \"SQLITERK_DAMAGED\";\n        case SQLITERK_DISCARD:\n            return \"SQLITERK_DISCARD\";\n        default:\n            break;\n    }\n    return \"SQLITERK_UNKNOWN\";\n}"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_util.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_util_h\n#define sqliterk_util_h\n\n#include <stdio.h>\n\nint sqliterkParseInt(const unsigned char *data,\n                     int offset,\n                     int length,\n                     int *value);\nint sqliterkParseInt64(const unsigned char *data,\n                       int offset,\n                       int length,\n                       int64_t *value);\nint sqliterkParseVarint(const unsigned char *data,\n                        int offset,\n                        int *length,\n                        int *value);\nint sqliterkParseVarint64(const unsigned char *data,\n                          int offset,\n                          int *length,\n                          int64_t *value);\nint sqliterkParseNumber(const unsigned char *data, int offset, double *value);\nint sqliterkGetMaxVarintLength(void);\nconst char *sqliterkGetResultCodeDescription(int result);\n\n#endif /* sqliterk_util_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_values.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"sqliterk_values.h\"\n#include \"SQLiteRepairKit.h\"\n#include \"sqliterk_os.h\"\n#include \"sqliterk_util.h\"\n#include <stdlib.h>\n#include <string.h>\n\n//declaration\nstatic int sqliterkValuesAutoGrow(sqliterk_values *values);\n\ntypedef int64_t sqliterk_integer;\ntypedef double sqliterk_number;\ntypedef struct sqliterk_text sqliterk_text;\nstruct sqliterk_text {\n    char *t;\n    int s;\n};\ntypedef struct sqliterk_binary sqliterk_binary;\nstruct sqliterk_binary {\n    void *b;\n    int s;\n};\ntypedef union sqliterk_any sqliterk_any;\nunion sqliterk_any {\n    sqliterk_integer *integer;\n    sqliterk_number *number;\n    sqliterk_text *text;\n    sqliterk_binary *binary;\n    void *memory;\n};\n\nstruct sqliterk_value {\n    sqliterk_value_type type;\n    sqliterk_any any;\n};\n\nstruct sqliterk_values {\n    int count;\n    int capacity;\n    sqliterk_value *values;\n};\n\nint sqliterkValuesAlloc(sqliterk_values **values)\n{\n    if (!values) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = SQLITERK_OK;\n    sqliterk_values *theValues = sqliterkOSMalloc(sizeof(sqliterk_values));\n    if (!theValues) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkValuesAlloc_Failed;\n    }\n    rc = sqliterkValuesAutoGrow(theValues);\n    if (rc != SQLITERK_OK) {\n        goto sqliterkValuesAlloc_Failed;\n    }\n    *values = theValues;\n    return SQLITERK_OK;\nsqliterkValuesAlloc_Failed:\n    if (theValues) {\n        sqliterkValuesFree(theValues);\n    }\n    return rc;\n}\n\nint sqliterkValuesFree(sqliterk_values *values)\n{\n    if (!values) {\n        return SQLITERK_MISUSE;\n    }\n\n    int i;\n    for (i = 0; i < values->count; i++) {\n        sqliterk_value *value = &values->values[i];\n        sqliterkValueClear(value);\n    }\n    values->count = 0;\n    if (values->values) {\n        sqliterkOSFree(values->values);\n        values->values = NULL;\n    }\n    values->capacity = 0;\n    sqliterkOSFree(values);\n    return SQLITERK_OK;\n}\n\nint sqliterkValuesClear(sqliterk_values *values)\n{\n    if (!values) {\n        return SQLITERK_MISUSE;\n    }\n\n    int i;\n    for (i = 0; i < values->count; i++) {\n        sqliterk_value *value = &values->values[i];\n        sqliterkValueClear(value);\n    }\n    values->count = 0;\n    return SQLITERK_OK;\n}\n\nstatic int sqliterkValuesAutoGrow(sqliterk_values *values)\n{\n    if (!values) {\n        return SQLITERK_MISUSE;\n    }\n    if (values->count >= values->capacity) {\n        int oldCapacity = values->capacity;\n        if (oldCapacity <= 0) {\n            //init for 4\n            values->capacity = 4;\n        } else {\n            values->capacity = oldCapacity * 2;\n        }\n        sqliterk_value *newValues =\n            sqliterkOSMalloc(sizeof(sqliterk_value) * (values->capacity + 1));\n        if (!newValues) {\n            return SQLITERK_NOMEM;\n        }\n        if (values->values) {\n            memcpy(newValues, values->values,\n                   sizeof(sqliterk_value) * oldCapacity);\n            sqliterkOSFree(values->values);\n        }\n        values->values = newValues;\n    }\n    return SQLITERK_OK;\n}\n\nint sqliterkValuesGetCount(sqliterk_values *values)\n{\n    if (!values) {\n        return 0;\n    }\n    return values->count;\n}\n\nsqliterk_value_type sqliterkValuesGetType(sqliterk_values *values, int index)\n{\n    if (values && index < sqliterkValuesGetCount(values)) {\n        return values->values[index].type;\n    }\n    return sqliterk_value_type_null;\n}\n\nint64_t sqliterkValuesGetInteger64(sqliterk_values *values, int index)\n{\n    int64_t out = 0;\n    if (values && index < sqliterkValuesGetCount(values)) {\n        sqliterk_value *value = &values->values[index];\n        switch (sqliterkValuesGetType(values, index)) {\n            case sqliterk_value_type_integer:\n                out = (int64_t)(*value->any.integer);\n                break;\n            case sqliterk_value_type_number:\n                out = (int64_t)(*value->any.number);\n                break;\n            case sqliterk_value_type_text:\n                out = atol(value->any.text->t);\n                break;\n            default:\n                break;\n        }\n    }\n    return out;\n}\n\nint sqliterkValuesGetInteger(sqliterk_values *values, int index)\n{\n    return (int) sqliterkValuesGetInteger64(values, index);\n}\n\ndouble sqliterkValuesGetNumber(sqliterk_values *values, int index)\n{\n    double out = 0;\n    if (values && index < sqliterkValuesGetCount(values)) {\n        sqliterk_value *value = &values->values[index];\n        switch (sqliterkValuesGetType(values, index)) {\n            case sqliterk_value_type_integer:\n                out = (double) (*value->any.integer);\n                break;\n            case sqliterk_value_type_number:\n                out = (double) (*value->any.number);\n                break;\n            case sqliterk_value_type_text:\n                out = atof(value->any.text->t);\n                break;\n            default:\n                break;\n        }\n    }\n    return out;\n}\n\nconst char *sqliterkValuesGetText(sqliterk_values *values, int index)\n{\n    char *out = NULL;\n    if (values && index < sqliterkValuesGetCount(values)) {\n        sqliterk_value *value = &values->values[index];\n        switch (value->type) {\n            case sqliterk_value_type_text:\n                out = value->any.text->t;\n                break;\n            default:\n                break;\n        }\n    }\n    return out;\n}\n\nconst void *sqliterkValuesGetBinary(sqliterk_values *values, int index)\n{\n    void *out = NULL;\n    if (values && index < sqliterkValuesGetCount(values)) {\n        sqliterk_value *value = &values->values[index];\n        switch (value->type) {\n            case sqliterk_value_type_binary:\n                out = value->any.binary->b;\n                break;\n            default:\n                break;\n        }\n    }\n    return out;\n}\n\nint sqliterkValuesGetBytes(sqliterk_values *values, int index)\n{\n    int out = 0;\n    if (values && index < sqliterkValuesGetCount(values)) {\n        sqliterk_value *value = &values->values[index];\n        switch (value->type) {\n            case sqliterk_value_type_binary:\n                out = value->any.binary->s;\n                break;\n            case sqliterk_value_type_text:\n                out = value->any.text->s;\n                break;\n            default:\n                break;\n        }\n    }\n    return out;\n}\n\nint sqliterkValuesAddInteger64(sqliterk_values *values, int64_t i)\n{\n    if (!values) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = sqliterkValuesAutoGrow(values);\n    if (rc != SQLITERK_OK) {\n        return rc;\n    }\n    sqliterk_value *value = &values->values[values->count];\n    value->type = sqliterk_value_type_integer;\n    value->any.integer = sqliterkOSMalloc(sizeof(sqliterk_integer));\n    if (!value->any.integer) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkValuesAddInteger64_Failed;\n    }\n    *value->any.integer = i;\n    values->count++;\n    return SQLITERK_OK;\n\nsqliterkValuesAddInteger64_Failed:\n    sqliterkValueClear(value);\n    return rc;\n}\n\nint sqliterkValuesAddInteger(sqliterk_values *values, int i)\n{\n    return sqliterkValuesAddInteger64(values, i);\n}\n\nint sqliterkValuesAddNumber(sqliterk_values *values, double d)\n{\n    if (!values) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = sqliterkValuesAutoGrow(values);\n    if (rc != SQLITERK_OK) {\n        return rc;\n    }\n    sqliterk_value *value = &values->values[values->count];\n    value->type = sqliterk_value_type_number;\n    value->any.number = sqliterkOSMalloc(sizeof(sqliterk_number));\n    if (!value->any.number) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkValuesAddNumber_Failed;\n    }\n    *value->any.number = d;\n    values->count++;\n    return SQLITERK_OK;\n\nsqliterkValuesAddNumber_Failed:\n    sqliterkValueClear(value);\n    return rc;\n}\n\nint sqliterkValuesAddText(sqliterk_values *values, const char *t)\n{\n    return sqliterkValuesAddNoTerminatorText(values, t, (int) strlen(t));\n}\n\nint sqliterkValuesAddNoTerminatorText(sqliterk_values *values,\n                                      const char *t,\n                                      const int s)\n{\n    if (!values || !t) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = sqliterkValuesAutoGrow(values);\n    if (rc != SQLITERK_OK) {\n        return rc;\n    }\n    sqliterk_value *value = &values->values[values->count];\n    value->type = sqliterk_value_type_text;\n    value->any.text = sqliterkOSMalloc(sizeof(sqliterk_text));\n    if (!value->any.text) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkValuesAddNoTerminatorText_Failed;\n    }\n    value->any.text->s = s;\n    value->any.text->t = sqliterkOSMalloc(sizeof(char) * (s + 1));\n    if (!value->any.text->t) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkValuesAddNoTerminatorText_Failed;\n    }\n    memcpy(value->any.text->t, t, s);\n    value->any.text->t[s] = '\\0';\n    values->count++;\n    return SQLITERK_OK;\n\nsqliterkValuesAddNoTerminatorText_Failed:\n    sqliterkValueClear(value);\n    return rc;\n}\n\nint sqliterkValuesAddBinary(sqliterk_values *values, const void *b, const int s)\n{\n    if (!values || !b) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = sqliterkValuesAutoGrow(values);\n    if (rc != SQLITERK_OK) {\n        return rc;\n    }\n    sqliterk_value *value = &values->values[values->count];\n    value->type = sqliterk_value_type_binary;\n    value->any.binary = sqliterkOSMalloc(sizeof(sqliterk_binary));\n    if (!value->any.binary) {\n        rc = SQLITERK_NOMEM;\n        goto sqliterkValuesAddBinary_Failed;\n    }\n    value->any.binary->s = s;\n    value->any.binary->b = sqliterkOSMalloc(sizeof(void *) * s);\n    if (!value->any.binary->b) {\n        return SQLITERK_NOMEM;\n    }\n    memcpy(value->any.binary->b, b, s);\n    values->count++;\n    return SQLITERK_OK;\n\nsqliterkValuesAddBinary_Failed:\n    sqliterkValueClear(value);\n    return rc;\n}\n\nint sqliterkValuesAddNull(sqliterk_values *values)\n{\n    if (!values) {\n        return SQLITERK_MISUSE;\n    }\n    int rc = sqliterkValuesAutoGrow(values);\n    if (rc != SQLITERK_OK) {\n        return rc;\n    }\n    sqliterk_value *value = &values->values[values->count];\n    value->type = sqliterk_value_type_null;\n    value->any.memory = NULL;\n    values->count++;\n    return SQLITERK_OK;\n}\n\nint sqliterkValueClear(sqliterk_value *value)\n{\n    if (!value) {\n        return SQLITERK_MISUSE;\n    }\n    if (value->any.memory) {\n        switch (value->type) {\n            case sqliterk_value_type_text:\n                if (value->any.text->t) {\n                    sqliterkOSFree(value->any.text->t);\n                    value->any.text->t = NULL;\n                }\n                break;\n            case sqliterk_value_type_binary:\n                if (value->any.binary->b) {\n                    sqliterkOSFree(value->any.binary->b);\n                    value->any.binary->b = NULL;\n                }\n                break;\n            default:\n                break;\n        }\n        sqliterkOSFree(value->any.memory);\n        value->any.memory = NULL;\n    }\n    value->type = sqliterk_value_type_null;\n    return SQLITERK_OK;\n}"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit/repair/sqliterk_values.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef sqliterk_values_h\n#define sqliterk_values_h\n\n#include \"SQLiteRepairKit.h\"\n#include <stdint.h>\n\n// sqliterk_values is a kind of [Any] array.\ntypedef struct sqliterk_values sqliterk_values;\ntypedef struct sqliterk_value sqliterk_value;\n\nint sqliterkValuesAlloc(sqliterk_values **values);\nint sqliterkValuesFree(sqliterk_values *values);\nint sqliterkValuesClear(sqliterk_values *values);\n\nint sqliterkValuesAddInteger(sqliterk_values *values, int i);\nint sqliterkValuesAddInteger64(sqliterk_values *values, int64_t i);\nint sqliterkValuesAddNumber(sqliterk_values *values, double d);\nint sqliterkValuesAddText(sqliterk_values *values, const char *t);\nint sqliterkValuesAddNoTerminatorText(sqliterk_values *values,\n                                      const char *t,\n                                      const int s);\nint sqliterkValuesAddBinary(sqliterk_values *values,\n                            const void *b,\n                            const int s);\nint sqliterkValuesAddNull(sqliterk_values *values);\n\nint sqliterkValuesGetCount(sqliterk_values *values);\nsqliterk_value_type sqliterkValuesGetType(sqliterk_values *values, int index);\nint sqliterkValuesGetInteger(sqliterk_values *values, int index);\nint64_t sqliterkValuesGetInteger64(sqliterk_values *values, int index);\ndouble sqliterkValuesGetNumber(sqliterk_values *values, int index);\nconst char *sqliterkValuesGetText(sqliterk_values *values, int index);\nconst void *sqliterkValuesGetBinary(sqliterk_values *values, int index);\nint sqliterkValuesGetBytes(sqliterk_values *values, int index);\n\nint sqliterkValueClear(sqliterk_value *value);\n\n#endif /* sqliterk_values_h */\n"
  },
  {
    "path": "JetChat/Pods/SQLiteRepairKit.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t09C37B9EAF0A91E411C230B530488EAE /* SQLiteRepairKit.h in Headers */ = {isa = PBXBuildFile; fileRef = C2699A3528C0A5F1C622F13A15E2A375 /* SQLiteRepairKit.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t176DC82D0402AE4B5AC755F05471EB4E /* sqliterk_values.h in Headers */ = {isa = PBXBuildFile; fileRef = FD6EAD9E1BDBBF2ABF9F1008A472FFD7 /* sqliterk_values.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t2E063DC26FF43A99829A164F65C503CA /* sqliterk_column.h in Headers */ = {isa = PBXBuildFile; fileRef = 955A57868B67557DDA37F17786196FA0 /* sqliterk_column.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t3AE41D38FE17ADC2D9B82EE6D53C138C /* sqliterk_pager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E36F7FAB20BFB989A01CAEA09E628CE /* sqliterk_pager.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t3B14642612ADE63649CA2150DD608AD4 /* sqliterk_os.c in Sources */ = {isa = PBXBuildFile; fileRef = EAD4B18B1E93B235C4D738B459FA1CDD /* sqliterk_os.c */; };\n\t\t3FAE6428E5AD397A309BBDBE9FBEB664 /* SQLiteRepairKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 18DDC7D060C37F424AE03ABBCAB1AFF8 /* SQLiteRepairKit-dummy.m */; };\n\t\t51DAF1127E2CC4FC72DACF04FF8B22FF /* sqliterk_btree.c in Sources */ = {isa = PBXBuildFile; fileRef = BCEA6CE602E2F502368CA2417738B8DE /* sqliterk_btree.c */; };\n\t\t6A24C502C67FC17714170E7B8A5B2C48 /* sqliterk_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DAEBB28F84965AB1215E135043131E9E /* sqliterk_util.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t6AD7B2216EE7A30A77F1B485075017FE /* sqliterk_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 129D3A9547906F386E5C16CA6EDBB2A7 /* sqliterk_api.c */; };\n\t\t77C9F72CE4237B5E7FFD8EF5B3641CD6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0FF3BDAC58FC44C0FEDA8DEC904475C /* Foundation.framework */; };\n\t\t982DD5BE7A5817EE91C12D28E82B3565 /* sqliterk.c in Sources */ = {isa = PBXBuildFile; fileRef = DAA588B9A6F2F787BECF17873788FD3D /* sqliterk.c */; };\n\t\tA4888EA3ACE61B853899E132CC4AFFEC /* sqliterk_crypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0EB536CB64C4231BB3EED54A6DF965 /* sqliterk_crypto.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tA7D26571F28ED9D7D19D506E3FE1D3C2 /* sqliterk_btree.h in Headers */ = {isa = PBXBuildFile; fileRef = DE95136C07A4101A95638B74DC6D4F4B /* sqliterk_btree.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tB62E847194B9F855730F51B3CD54D690 /* sqliterk_values.c in Sources */ = {isa = PBXBuildFile; fileRef = EDC48A0E1EBD1BC54BF0AF0ADB94CF11 /* sqliterk_values.c */; };\n\t\tC380943B0B1EBE7265610E9F3A40B191 /* sqliterk_output.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8789C56A5DA28E8FD5B47DDB5189E397 /* sqliterk_output.cpp */; };\n\t\tCC9800871CCA79D8F8F04ED28FF7845D /* sqliterk_column.c in Sources */ = {isa = PBXBuildFile; fileRef = C5CCDC1C04633F075711D56F0335AC72 /* sqliterk_column.c */; };\n\t\tCD2B12BFB91B60F93531A9029067C6AE /* sqliterk.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2D47D65C355C91E0D42CE76F05303C /* sqliterk.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tD1219D3AB8D680934CFF59C0AEB44915 /* sqliterk_crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 307E8F67E6612D8B908CC3880030FE64 /* sqliterk_crypto.c */; };\n\t\tE37840C5DEE5C6AAD91389A592F69D3A /* sqliterk_os.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C1399DFA6407B62D13CD4E8CDBAE768 /* sqliterk_os.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tE7971C7E04CC805CD38952E0C54E0849 /* sqliterk_util.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D5A26DE8C568A86EF101A1E4F55A827 /* sqliterk_util.c */; };\n\t\tF0F657424AAED2C7ACC44180FAC9BC7F /* SQLiteRepairKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D7D3EC24EE7EB10134A24B66B60916A4 /* SQLiteRepairKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF4D72EDA1624CEC1FFF510F11963EA3B /* sqliterk_pager.c in Sources */ = {isa = PBXBuildFile; fileRef = 886920879C7D3440E2A7B65FA56BD461 /* sqliterk_pager.c */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t32BDD7A42787EA02C49DC988584A5383 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = F55D62FF7768EAD866747BAE6F45723B /* WCDBOptimizedSQLCipher.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8820E4661B26990965C45655F51ED18B;\n\t\t\tremoteInfo = WCDBOptimizedSQLCipher;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t0D5A26DE8C568A86EF101A1E4F55A827 /* sqliterk_util.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_util.c; path = repair/sqliterk_util.c; sourceTree = \"<group>\"; };\n\t\t129D3A9547906F386E5C16CA6EDBB2A7 /* sqliterk_api.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_api.c; path = repair/sqliterk_api.c; sourceTree = \"<group>\"; };\n\t\t129D8474E215FB1DD1DFB27779DD40C1 /* SQLiteRepairKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SQLiteRepairKit-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t18DDC7D060C37F424AE03ABBCAB1AFF8 /* SQLiteRepairKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"SQLiteRepairKit-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t1E36F7FAB20BFB989A01CAEA09E628CE /* sqliterk_pager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk_pager.h; path = repair/sqliterk_pager.h; sourceTree = \"<group>\"; };\n\t\t2E0EB536CB64C4231BB3EED54A6DF965 /* sqliterk_crypto.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk_crypto.h; path = repair/sqliterk_crypto.h; sourceTree = \"<group>\"; };\n\t\t307E8F67E6612D8B908CC3880030FE64 /* sqliterk_crypto.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_crypto.c; path = repair/sqliterk_crypto.c; sourceTree = \"<group>\"; };\n\t\t3355DE648E59F8937FBD7465726C2233 /* SQLiteRepairKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SQLiteRepairKit.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t5D7D68B91D104D80B14A6BDB3166D161 /* SQLiteRepairKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SQLiteRepairKit.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t8789C56A5DA28E8FD5B47DDB5189E397 /* sqliterk_output.cpp */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.cpp.cpp; name = sqliterk_output.cpp; path = repair/sqliterk_output.cpp; sourceTree = \"<group>\"; };\n\t\t886920879C7D3440E2A7B65FA56BD461 /* sqliterk_pager.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_pager.c; path = repair/sqliterk_pager.c; sourceTree = \"<group>\"; };\n\t\t955A57868B67557DDA37F17786196FA0 /* sqliterk_column.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk_column.h; path = repair/sqliterk_column.h; sourceTree = \"<group>\"; };\n\t\t9C1399DFA6407B62D13CD4E8CDBAE768 /* sqliterk_os.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk_os.h; path = repair/sqliterk_os.h; sourceTree = \"<group>\"; };\n\t\tA3B4CB408E8C91C7EE382DBE663BE9ED /* SQLiteRepairKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"SQLiteRepairKit-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tBC230609C0C5DD8FF50C972A5AE2D025 /* SQLiteRepairKit */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SQLiteRepairKit; path = sqliterk.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tBCEA6CE602E2F502368CA2417738B8DE /* sqliterk_btree.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_btree.c; path = repair/sqliterk_btree.c; sourceTree = \"<group>\"; };\n\t\tC0FF3BDAC58FC44C0FEDA8DEC904475C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tC2699A3528C0A5F1C622F13A15E2A375 /* SQLiteRepairKit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SQLiteRepairKit.h; path = repair/SQLiteRepairKit.h; sourceTree = \"<group>\"; };\n\t\tC5CCDC1C04633F075711D56F0335AC72 /* sqliterk_column.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_column.c; path = repair/sqliterk_column.c; sourceTree = \"<group>\"; };\n\t\tD7D3EC24EE7EB10134A24B66B60916A4 /* SQLiteRepairKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SQLiteRepairKit-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tD8303B3BBF74C66525B890E7566D8CAB /* SQLiteRepairKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SQLiteRepairKit.modulemap; sourceTree = \"<group>\"; };\n\t\tDAA588B9A6F2F787BECF17873788FD3D /* sqliterk.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk.c; path = repair/sqliterk.c; sourceTree = \"<group>\"; };\n\t\tDAEBB28F84965AB1215E135043131E9E /* sqliterk_util.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk_util.h; path = repair/sqliterk_util.h; sourceTree = \"<group>\"; };\n\t\tDE95136C07A4101A95638B74DC6D4F4B /* sqliterk_btree.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk_btree.h; path = repair/sqliterk_btree.h; sourceTree = \"<group>\"; };\n\t\tDF2D47D65C355C91E0D42CE76F05303C /* sqliterk.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk.h; path = repair/sqliterk.h; sourceTree = \"<group>\"; };\n\t\tEAD4B18B1E93B235C4D738B459FA1CDD /* sqliterk_os.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_os.c; path = repair/sqliterk_os.c; sourceTree = \"<group>\"; };\n\t\tEDC48A0E1EBD1BC54BF0AF0ADB94CF11 /* sqliterk_values.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqliterk_values.c; path = repair/sqliterk_values.c; sourceTree = \"<group>\"; };\n\t\tF55D62FF7768EAD866747BAE6F45723B /* WCDBOptimizedSQLCipher */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = WCDBOptimizedSQLCipher; path = WCDBOptimizedSQLCipher.xcodeproj; sourceTree = \"<group>\"; };\n\t\tFD6EAD9E1BDBBF2ABF9F1008A472FFD7 /* sqliterk_values.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliterk_values.h; path = repair/sqliterk_values.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t892BD0FF95EF13778214FCDF5E1246EB /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t77C9F72CE4237B5E7FFD8EF5B3641CD6 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t4A5FE6155219ED574862F845CC14A711 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tAF77247E881523682DBD750C838776C6 /* Dependencies */,\n\t\t\t\tA1D6920BF042772F3B8018B4CFDB1F3D /* Frameworks */,\n\t\t\t\tEA2389905A2F1932F044AF1D3D71ADB7 /* Products */,\n\t\t\t\tBA91BBF7EFB30626C14BBC2FA7A648E1 /* SQLiteRepairKit */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CF9D40A2D9C668B4BE55F335DF02A5F /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD8303B3BBF74C66525B890E7566D8CAB /* SQLiteRepairKit.modulemap */,\n\t\t\t\t18DDC7D060C37F424AE03ABBCAB1AFF8 /* SQLiteRepairKit-dummy.m */,\n\t\t\t\tA3B4CB408E8C91C7EE382DBE663BE9ED /* SQLiteRepairKit-Info.plist */,\n\t\t\t\t129D8474E215FB1DD1DFB27779DD40C1 /* SQLiteRepairKit-prefix.pch */,\n\t\t\t\tD7D3EC24EE7EB10134A24B66B60916A4 /* SQLiteRepairKit-umbrella.h */,\n\t\t\t\t5D7D68B91D104D80B14A6BDB3166D161 /* SQLiteRepairKit.debug.xcconfig */,\n\t\t\t\t3355DE648E59F8937FBD7465726C2233 /* SQLiteRepairKit.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/SQLiteRepairKit\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA1D6920BF042772F3B8018B4CFDB1F3D /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB8BB131934AB5A96CD6AE20C3D965604 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tAF77247E881523682DBD750C838776C6 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF55D62FF7768EAD866747BAE6F45723B /* WCDBOptimizedSQLCipher */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB8BB131934AB5A96CD6AE20C3D965604 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC0FF3BDAC58FC44C0FEDA8DEC904475C /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tBA91BBF7EFB30626C14BBC2FA7A648E1 /* SQLiteRepairKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC2699A3528C0A5F1C622F13A15E2A375 /* SQLiteRepairKit.h */,\n\t\t\t\tDAA588B9A6F2F787BECF17873788FD3D /* sqliterk.c */,\n\t\t\t\tDF2D47D65C355C91E0D42CE76F05303C /* sqliterk.h */,\n\t\t\t\t129D3A9547906F386E5C16CA6EDBB2A7 /* sqliterk_api.c */,\n\t\t\t\tBCEA6CE602E2F502368CA2417738B8DE /* sqliterk_btree.c */,\n\t\t\t\tDE95136C07A4101A95638B74DC6D4F4B /* sqliterk_btree.h */,\n\t\t\t\tC5CCDC1C04633F075711D56F0335AC72 /* sqliterk_column.c */,\n\t\t\t\t955A57868B67557DDA37F17786196FA0 /* sqliterk_column.h */,\n\t\t\t\t307E8F67E6612D8B908CC3880030FE64 /* sqliterk_crypto.c */,\n\t\t\t\t2E0EB536CB64C4231BB3EED54A6DF965 /* sqliterk_crypto.h */,\n\t\t\t\tEAD4B18B1E93B235C4D738B459FA1CDD /* sqliterk_os.c */,\n\t\t\t\t9C1399DFA6407B62D13CD4E8CDBAE768 /* sqliterk_os.h */,\n\t\t\t\t8789C56A5DA28E8FD5B47DDB5189E397 /* sqliterk_output.cpp */,\n\t\t\t\t886920879C7D3440E2A7B65FA56BD461 /* sqliterk_pager.c */,\n\t\t\t\t1E36F7FAB20BFB989A01CAEA09E628CE /* sqliterk_pager.h */,\n\t\t\t\t0D5A26DE8C568A86EF101A1E4F55A827 /* sqliterk_util.c */,\n\t\t\t\tDAEBB28F84965AB1215E135043131E9E /* sqliterk_util.h */,\n\t\t\t\tEDC48A0E1EBD1BC54BF0AF0ADB94CF11 /* sqliterk_values.c */,\n\t\t\t\tFD6EAD9E1BDBBF2ABF9F1008A472FFD7 /* sqliterk_values.h */,\n\t\t\t\t4CF9D40A2D9C668B4BE55F335DF02A5F /* Support Files */,\n\t\t\t);\n\t\t\tname = SQLiteRepairKit;\n\t\t\tpath = SQLiteRepairKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEA2389905A2F1932F044AF1D3D71ADB7 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBC230609C0C5DD8FF50C972A5AE2D025 /* SQLiteRepairKit */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t420417AA00806D444BA006B9BE6A8685 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t09C37B9EAF0A91E411C230B530488EAE /* SQLiteRepairKit.h in Headers */,\n\t\t\t\tF0F657424AAED2C7ACC44180FAC9BC7F /* SQLiteRepairKit-umbrella.h in Headers */,\n\t\t\t\tCD2B12BFB91B60F93531A9029067C6AE /* sqliterk.h in Headers */,\n\t\t\t\tA7D26571F28ED9D7D19D506E3FE1D3C2 /* sqliterk_btree.h in Headers */,\n\t\t\t\t2E063DC26FF43A99829A164F65C503CA /* sqliterk_column.h in Headers */,\n\t\t\t\tA4888EA3ACE61B853899E132CC4AFFEC /* sqliterk_crypto.h in Headers */,\n\t\t\t\tE37840C5DEE5C6AAD91389A592F69D3A /* sqliterk_os.h in Headers */,\n\t\t\t\t3AE41D38FE17ADC2D9B82EE6D53C138C /* sqliterk_pager.h in Headers */,\n\t\t\t\t6A24C502C67FC17714170E7B8A5B2C48 /* sqliterk_util.h in Headers */,\n\t\t\t\t176DC82D0402AE4B5AC755F05471EB4E /* sqliterk_values.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t1A6A317D19224BA6C654767A5DA5460D /* SQLiteRepairKit */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 9B324AB545B06D15EB773A28F7C93A6E /* Build configuration list for PBXNativeTarget \"SQLiteRepairKit\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t420417AA00806D444BA006B9BE6A8685 /* Headers */,\n\t\t\t\t8411E89AB3A877BBA853A460153DFC08 /* Sources */,\n\t\t\t\t892BD0FF95EF13778214FCDF5E1246EB /* Frameworks */,\n\t\t\t\tCFFDFB89F7F9FDE6B25FB66EBF2ED0EE /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t46CC0431C051FBA5DC86558C3659D5CF /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = SQLiteRepairKit;\n\t\t\tproductName = sqliterk;\n\t\t\tproductReference = BC230609C0C5DD8FF50C972A5AE2D025 /* SQLiteRepairKit */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t52B6080A2307243691D77756F64C3E23 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 546BA24C7E985C6A75116ACE8B73B720 /* Build configuration list for PBXProject \"SQLiteRepairKit\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 4A5FE6155219ED574862F845CC14A711;\n\t\t\tproductRefGroup = EA2389905A2F1932F044AF1D3D71ADB7 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = F55D62FF7768EAD866747BAE6F45723B /* WCDBOptimizedSQLCipher */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t1A6A317D19224BA6C654767A5DA5460D /* SQLiteRepairKit */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tCFFDFB89F7F9FDE6B25FB66EBF2ED0EE /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t8411E89AB3A877BBA853A460153DFC08 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3FAE6428E5AD397A309BBDBE9FBEB664 /* SQLiteRepairKit-dummy.m in Sources */,\n\t\t\t\t982DD5BE7A5817EE91C12D28E82B3565 /* sqliterk.c in Sources */,\n\t\t\t\t6AD7B2216EE7A30A77F1B485075017FE /* sqliterk_api.c in Sources */,\n\t\t\t\t51DAF1127E2CC4FC72DACF04FF8B22FF /* sqliterk_btree.c in Sources */,\n\t\t\t\tCC9800871CCA79D8F8F04ED28FF7845D /* sqliterk_column.c in Sources */,\n\t\t\t\tD1219D3AB8D680934CFF59C0AEB44915 /* sqliterk_crypto.c in Sources */,\n\t\t\t\t3B14642612ADE63649CA2150DD608AD4 /* sqliterk_os.c in Sources */,\n\t\t\t\tC380943B0B1EBE7265610E9F3A40B191 /* sqliterk_output.cpp in Sources */,\n\t\t\t\tF4D72EDA1624CEC1FFF510F11963EA3B /* sqliterk_pager.c in Sources */,\n\t\t\t\tE7971C7E04CC805CD38952E0C54E0849 /* sqliterk_util.c in Sources */,\n\t\t\t\tB62E847194B9F855730F51B3CD54D690 /* sqliterk_values.c in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t46CC0431C051FBA5DC86558C3659D5CF /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = WCDBOptimizedSQLCipher;\n\t\t\ttargetProxy = 32BDD7A42787EA02C49DC988584A5383 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2726B1ECE656CBDCE2B4AC1C925BFA3C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 3355DE648E59F8937FBD7465726C2233 /* SQLiteRepairKit.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SQLiteRepairKit/SQLiteRepairKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SQLiteRepairKit/SQLiteRepairKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SQLiteRepairKit/SQLiteRepairKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = sqliterk;\n\t\t\t\tPRODUCT_NAME = sqliterk;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t2E4B7820D6ADE8EF7B8B3C4FC90211A5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tA47917006794CA734542383A80C0D8E7 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tD4A0EB13B602A5080437A21446F472BA /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 5D7D68B91D104D80B14A6BDB3166D161 /* SQLiteRepairKit.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SQLiteRepairKit/SQLiteRepairKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SQLiteRepairKit/SQLiteRepairKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SQLiteRepairKit/SQLiteRepairKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = sqliterk;\n\t\t\t\tPRODUCT_NAME = sqliterk;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t546BA24C7E985C6A75116ACE8B73B720 /* Build configuration list for PBXProject \"SQLiteRepairKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA47917006794CA734542383A80C0D8E7 /* Debug */,\n\t\t\t\t2E4B7820D6ADE8EF7B8B3C4FC90211A5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t9B324AB545B06D15EB773A28F7C93A6E /* Build configuration list for PBXNativeTarget \"SQLiteRepairKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD4A0EB13B602A5080437A21446F472BA /* Debug */,\n\t\t\t\t2726B1ECE656CBDCE2B4AC1C925BFA3C /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 52B6080A2307243691D77756F64C3E23 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/LICENSE",
    "content": "Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/README.md",
    "content": "<img src=\"https://snapkit.github.io/SnapKit/images/banner.jpg\" alt=\"\" />\n\nSnapKit is a DSL to make Auto Layout easy on both iOS and OS X.\n\n[![Build Status](https://travis-ci.org/SnapKit/SnapKit.svg)](https://travis-ci.org/SnapKit/SnapKit)\n[![Platform](https://img.shields.io/cocoapods/p/SnapKit.svg?style=flat)](https://github.com/SnapKit/SnapKit)\n[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/SnapKit.svg)](https://cocoapods.org/pods/SnapKit)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n#### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️\n#### ⚠️ **To use with Swift 5.x please ensure you are using >= 5.0.0** ⚠️\n\n## Contents\n\n- [Requirements](#requirements)\n- [Migration Guides](#migration-guides)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Credits](#credits)\n- [License](#license)\n\n## Requirements\n\n- iOS 10.0+ / Mac OS X 10.12+ / tvOS 10.0+\n- Xcode 10.0+\n- Swift 4.0+\n\n## Migration Guides\n\n- [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md)\n\n## Communication\n\n- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit')\n- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit).\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n> CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.\n\nTo integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget '<Your Target Name>' do\n    pod 'SnapKit', '~> 5.6.0'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"SnapKit/SnapKit\" ~> 5.0.0\n```\n\nRun `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.\n\n### Swift Package Manager\n\n[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\n> Xcode 11+ is required to build SnapKit using Swift Package Manager.\n\nTo integrate SnapKit into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/SnapKit/SnapKit.git\", .upToNextMajor(from: \"5.0.1\"))\n]\n```\n\n### Manually\n\nIf you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.\n\n---\n\n## Usage\n\n### Quick Start\n\n```swift\nimport SnapKit\n\nclass MyViewController: UIViewController {\n\n    lazy var box = UIView()\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\n        self.view.addSubview(box)\n        box.backgroundColor = .green\n        box.snp.makeConstraints { (make) -> Void in\n           make.width.height.equalTo(50)\n           make.center.equalTo(self.view)\n        }\n    }\n\n}\n```\n\n### Playground\nYou can try SnapKit in Playground.\n\n**Note:**\n\n> To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.\n\n### Resources\n\n- [Documentation](https://snapkit.github.io/SnapKit/docs/)\n- [F.A.Q.](https://snapkit.github.io/SnapKit/faq/)\n\n## Credits\n\n- Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))\n- Many other contributors\n\n## License\n\nSnapKit is released under the MIT license. See LICENSE for details.\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/Constraint.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\npublic final class Constraint {\n\n    internal let sourceLocation: (String, UInt)\n    internal let label: String?\n\n    private let from: ConstraintItem\n    private let to: ConstraintItem\n    private let relation: ConstraintRelation\n    private let multiplier: ConstraintMultiplierTarget\n    private var constant: ConstraintConstantTarget {\n        didSet {\n            self.updateConstantAndPriorityIfNeeded()\n        }\n    }\n    private var priority: ConstraintPriorityTarget {\n        didSet {\n          self.updateConstantAndPriorityIfNeeded()\n        }\n    }\n    public var layoutConstraints: [LayoutConstraint]\n    \n    public var isActive: Bool {\n        set {\n            if newValue {\n                activate()\n            }\n            else {\n                deactivate()\n            }\n        }\n        \n        get {\n            for layoutConstraint in self.layoutConstraints {\n                if layoutConstraint.isActive {\n                    return true\n                }\n            }\n            return false\n        }\n    }\n    \n    // MARK: Initialization\n\n    internal init(from: ConstraintItem,\n                  to: ConstraintItem,\n                  relation: ConstraintRelation,\n                  sourceLocation: (String, UInt),\n                  label: String?,\n                  multiplier: ConstraintMultiplierTarget,\n                  constant: ConstraintConstantTarget,\n                  priority: ConstraintPriorityTarget) {\n        self.from = from\n        self.to = to\n        self.relation = relation\n        self.sourceLocation = sourceLocation\n        self.label = label\n        self.multiplier = multiplier\n        self.constant = constant\n        self.priority = priority\n        self.layoutConstraints = []\n\n        // get attributes\n        let layoutFromAttributes = self.from.attributes.layoutAttributes\n        let layoutToAttributes = self.to.attributes.layoutAttributes\n\n        // get layout from\n        let layoutFrom = self.from.layoutConstraintItem!\n\n        // get relation\n        let layoutRelation = self.relation.layoutRelation\n\n        for layoutFromAttribute in layoutFromAttributes {\n            // get layout to attribute\n            let layoutToAttribute: LayoutAttribute\n            #if os(iOS) || os(tvOS)\n                if layoutToAttributes.count > 0 {\n                    if self.from.attributes == .edges && self.to.attributes == .margins {\n                        switch layoutFromAttribute {\n                        case .left:\n                            layoutToAttribute = .leftMargin\n                        case .right:\n                            layoutToAttribute = .rightMargin\n                        case .top:\n                            layoutToAttribute = .topMargin\n                        case .bottom:\n                            layoutToAttribute = .bottomMargin\n                        default:\n                            fatalError()\n                        }\n                    } else if self.from.attributes == .margins && self.to.attributes == .edges {\n                        switch layoutFromAttribute {\n                        case .leftMargin:\n                            layoutToAttribute = .left\n                        case .rightMargin:\n                            layoutToAttribute = .right\n                        case .topMargin:\n                            layoutToAttribute = .top\n                        case .bottomMargin:\n                            layoutToAttribute = .bottom\n                        default:\n                            fatalError()\n                        }\n                    } else if self.from.attributes == .directionalEdges && self.to.attributes == .directionalMargins {\n                      switch layoutFromAttribute {\n                      case .leading:\n                        layoutToAttribute = .leadingMargin\n                      case .trailing:\n                        layoutToAttribute = .trailingMargin\n                      case .top:\n                        layoutToAttribute = .topMargin\n                      case .bottom:\n                        layoutToAttribute = .bottomMargin\n                      default:\n                        fatalError()\n                      }\n                    } else if self.from.attributes == .directionalMargins && self.to.attributes == .directionalEdges {\n                      switch layoutFromAttribute {\n                      case .leadingMargin:\n                        layoutToAttribute = .leading\n                      case .trailingMargin:\n                        layoutToAttribute = .trailing\n                      case .topMargin:\n                        layoutToAttribute = .top\n                      case .bottomMargin:\n                        layoutToAttribute = .bottom\n                      default:\n                        fatalError()\n                      }\n                    } else if self.from.attributes == self.to.attributes {\n                        layoutToAttribute = layoutFromAttribute\n                    } else {\n                        layoutToAttribute = layoutToAttributes[0]\n                    }\n                } else {\n                    if self.to.target == nil && (layoutFromAttribute == .centerX || layoutFromAttribute == .centerY) {\n                        layoutToAttribute = layoutFromAttribute == .centerX ? .left : .top\n                    } else {\n                        layoutToAttribute = layoutFromAttribute\n                    }\n                }\n            #else\n                if self.from.attributes == self.to.attributes {\n                    layoutToAttribute = layoutFromAttribute\n                } else if layoutToAttributes.count > 0 {\n                    layoutToAttribute = layoutToAttributes[0]\n                } else {\n                    layoutToAttribute = layoutFromAttribute\n                }\n            #endif\n\n            // get layout constant\n            let layoutConstant: CGFloat = self.constant.constraintConstantTargetValueFor(layoutAttribute: layoutToAttribute)\n\n            // get layout to\n            var layoutTo: AnyObject? = self.to.target\n\n            // use superview if possible\n            if layoutTo == nil && layoutToAttribute != .width && layoutToAttribute != .height {\n                layoutTo = layoutFrom.superview\n            }\n\n            // create layout constraint\n            let layoutConstraint = LayoutConstraint(\n                item: layoutFrom,\n                attribute: layoutFromAttribute,\n                relatedBy: layoutRelation,\n                toItem: layoutTo,\n                attribute: layoutToAttribute,\n                multiplier: self.multiplier.constraintMultiplierTargetValue,\n                constant: layoutConstant\n            )\n\n            // set label\n            layoutConstraint.label = self.label\n\n            // set priority\n            layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)\n\n            // set constraint\n            layoutConstraint.constraint = self\n\n            // append\n            self.layoutConstraints.append(layoutConstraint)\n        }\n    }\n\n    // MARK: Public\n\n    @available(*, deprecated, renamed:\"activate()\")\n    public func install() {\n        self.activate()\n    }\n\n    @available(*, deprecated, renamed:\"deactivate()\")\n    public func uninstall() {\n        self.deactivate()\n    }\n\n    public func activate() {\n        self.activateIfNeeded()\n    }\n\n    public func deactivate() {\n        self.deactivateIfNeeded()\n    }\n\n    @discardableResult\n    public func update(offset: ConstraintOffsetTarget) -> Constraint {\n        self.constant = offset.constraintOffsetTargetValue\n        return self\n    }\n\n    @discardableResult\n    public func update(inset: ConstraintInsetTarget) -> Constraint {\n        self.constant = inset.constraintInsetTargetValue\n        return self\n    }\n\n    #if os(iOS) || os(tvOS)\n    @discardableResult\n    @available(iOS 11.0, tvOS 11.0, *)\n    public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint {\n      self.constant = inset.constraintDirectionalInsetTargetValue\n      return self\n    }\n    #endif\n\n    @discardableResult\n    public func update(priority: ConstraintPriorityTarget) -> Constraint {\n        self.priority = priority.constraintPriorityTargetValue\n        return self\n    }\n\n    @discardableResult\n    public func update(priority: ConstraintPriority) -> Constraint {\n        self.priority = priority.value\n        return self\n    }\n\n    @available(*, deprecated, renamed:\"update(offset:)\")\n    public func updateOffset(amount: ConstraintOffsetTarget) -> Void { self.update(offset: amount) }\n\n    @available(*, deprecated, renamed:\"update(inset:)\")\n    public func updateInsets(amount: ConstraintInsetTarget) -> Void { self.update(inset: amount) }\n\n    @available(*, deprecated, renamed:\"update(priority:)\")\n    public func updatePriority(amount: ConstraintPriorityTarget) -> Void { self.update(priority: amount) }\n\n    @available(*, deprecated, message:\"Use update(priority: ConstraintPriorityTarget) instead.\")\n    public func updatePriorityRequired() -> Void {}\n\n    @available(*, deprecated, message:\"Use update(priority: ConstraintPriorityTarget) instead.\")\n    public func updatePriorityHigh() -> Void { fatalError(\"Must be implemented by Concrete subclass.\") }\n\n    @available(*, deprecated, message:\"Use update(priority: ConstraintPriorityTarget) instead.\")\n    public func updatePriorityMedium() -> Void { fatalError(\"Must be implemented by Concrete subclass.\") }\n\n    @available(*, deprecated, message:\"Use update(priority: ConstraintPriorityTarget) instead.\")\n    public func updatePriorityLow() -> Void { fatalError(\"Must be implemented by Concrete subclass.\") }\n\n    // MARK: Internal\n\n    internal func updateConstantAndPriorityIfNeeded() {\n        for layoutConstraint in self.layoutConstraints {\n            let attribute = (layoutConstraint.secondAttribute == .notAnAttribute) ? layoutConstraint.firstAttribute : layoutConstraint.secondAttribute\n            layoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: attribute)\n\n            let requiredPriority = ConstraintPriority.required.value\n            if (layoutConstraint.priority.rawValue < requiredPriority), (self.priority.constraintPriorityTargetValue != requiredPriority) {\n                layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)\n            }\n        }\n    }\n\n    internal func activateIfNeeded(updatingExisting: Bool = false) {\n        guard let item = self.from.layoutConstraintItem else {\n            print(\"WARNING: SnapKit failed to get from item from constraint. Activate will be a no-op.\")\n            return\n        }\n        let layoutConstraints = self.layoutConstraints\n\n        if updatingExisting {\n            var existingLayoutConstraints: [LayoutConstraint] = []\n            for constraint in item.constraints {\n                existingLayoutConstraints += constraint.layoutConstraints\n            }\n\n            for layoutConstraint in layoutConstraints {\n                let existingLayoutConstraint = existingLayoutConstraints.first { $0 == layoutConstraint }\n                guard let updateLayoutConstraint = existingLayoutConstraint else {\n                    fatalError(\"Updated constraint could not find existing matching constraint to update: \\(layoutConstraint)\")\n                }\n\n                let updateLayoutAttribute = (updateLayoutConstraint.secondAttribute == .notAnAttribute) ? updateLayoutConstraint.firstAttribute : updateLayoutConstraint.secondAttribute\n                updateLayoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: updateLayoutAttribute)\n            }\n        } else {\n            NSLayoutConstraint.activate(layoutConstraints)\n            item.add(constraints: [self])\n        }\n    }\n\n    internal func deactivateIfNeeded() {\n        guard let item = self.from.layoutConstraintItem else {\n            print(\"WARNING: SnapKit failed to get from item from constraint. Deactivate will be a no-op.\")\n            return\n        }\n        let layoutConstraints = self.layoutConstraints\n        NSLayoutConstraint.deactivate(layoutConstraints)\n        item.remove(constraints: [self])\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintAttributes.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\ninternal struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral {\n    \n    typealias IntegerLiteralType = UInt\n    \n    internal init(rawValue: UInt) {\n        self.rawValue = rawValue\n    }\n    internal init(_ rawValue: UInt) {\n        self.init(rawValue: rawValue)\n    }\n    internal init(nilLiteral: ()) {\n        self.rawValue = 0\n    }\n    internal init(integerLiteral rawValue: IntegerLiteralType) {\n        self.init(rawValue: rawValue)\n    }\n    \n    internal private(set) var rawValue: UInt\n    internal static var allZeros: ConstraintAttributes { return 0 }\n    internal static func convertFromNilLiteral() -> ConstraintAttributes { return 0 }\n    internal var boolValue: Bool { return self.rawValue != 0 }\n    \n    internal func toRaw() -> UInt { return self.rawValue }\n    internal static func fromRaw(_ raw: UInt) -> ConstraintAttributes? { return self.init(raw) }\n    internal static func fromMask(_ raw: UInt) -> ConstraintAttributes { return self.init(raw) }\n    \n    // normal\n    \n    internal static let none: ConstraintAttributes = 0\n    internal static let left: ConstraintAttributes = ConstraintAttributes(UInt(1) << 0)\n    internal static let top: ConstraintAttributes = ConstraintAttributes(UInt(1) << 1)\n    internal static let right: ConstraintAttributes = ConstraintAttributes(UInt(1) << 2)\n    internal static let bottom: ConstraintAttributes = ConstraintAttributes(UInt(1) << 3)\n    internal static let leading: ConstraintAttributes = ConstraintAttributes(UInt(1) << 4)\n    internal static let trailing: ConstraintAttributes = ConstraintAttributes(UInt(1) << 5)\n    internal static let width: ConstraintAttributes = ConstraintAttributes(UInt(1) << 6)\n    internal static let height: ConstraintAttributes = ConstraintAttributes(UInt(1) << 7)\n    internal static let centerX: ConstraintAttributes = ConstraintAttributes(UInt(1) << 8)\n    internal static let centerY: ConstraintAttributes = ConstraintAttributes(UInt(1) << 9)\n    internal static let lastBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 10)\n    \n    @available(iOS 8.0, OSX 10.11, *)\n    internal static let firstBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 11)\n\n    @available(iOS 8.0, *)\n    internal static let leftMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 12)\n\n    @available(iOS 8.0, *)\n    internal static let rightMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 13)\n\n    @available(iOS 8.0, *)\n    internal static let topMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 14)\n\n    @available(iOS 8.0, *)\n    internal static let bottomMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 15)\n\n    @available(iOS 8.0, *)\n    internal static let leadingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 16)\n\n    @available(iOS 8.0, *)\n    internal static let trailingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 17)\n\n    @available(iOS 8.0, *)\n    internal static let centerXWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 18)\n\n    @available(iOS 8.0, *)\n    internal static let centerYWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 19)\n    \n    // aggregates\n    \n    internal static let edges: ConstraintAttributes = [.horizontalEdges, .verticalEdges]\n    internal static let horizontalEdges: ConstraintAttributes = [.left, .right]\n    internal static let verticalEdges: ConstraintAttributes = [.top, .bottom]\n    internal static let directionalEdges: ConstraintAttributes = [.directionalHorizontalEdges, .directionalVerticalEdges]\n    internal static let directionalHorizontalEdges: ConstraintAttributes = [.leading, .trailing]\n    internal static let directionalVerticalEdges: ConstraintAttributes = [.top, .bottom]\n    internal static let size: ConstraintAttributes = [.width, .height]\n    internal static let center: ConstraintAttributes = [.centerX, .centerY]\n\n    @available(iOS 8.0, *)\n    internal static let margins: ConstraintAttributes = [.leftMargin, .topMargin, .rightMargin, .bottomMargin]\n\n    @available(iOS 8.0, *)\n    internal static let directionalMargins: ConstraintAttributes = [.leadingMargin, .topMargin, .trailingMargin, .bottomMargin]\n\n    @available(iOS 8.0, *)\n    internal static let centerWithinMargins: ConstraintAttributes = [.centerXWithinMargins, .centerYWithinMargins]\n    \n    internal var layoutAttributes:[LayoutAttribute] {\n        var attrs = [LayoutAttribute]()\n        if (self.contains(ConstraintAttributes.left)) {\n            attrs.append(.left)\n        }\n        if (self.contains(ConstraintAttributes.top)) {\n            attrs.append(.top)\n        }\n        if (self.contains(ConstraintAttributes.right)) {\n            attrs.append(.right)\n        }\n        if (self.contains(ConstraintAttributes.bottom)) {\n            attrs.append(.bottom)\n        }\n        if (self.contains(ConstraintAttributes.leading)) {\n            attrs.append(.leading)\n        }\n        if (self.contains(ConstraintAttributes.trailing)) {\n            attrs.append(.trailing)\n        }\n        if (self.contains(ConstraintAttributes.width)) {\n            attrs.append(.width)\n        }\n        if (self.contains(ConstraintAttributes.height)) {\n            attrs.append(.height)\n        }\n        if (self.contains(ConstraintAttributes.centerX)) {\n            attrs.append(.centerX)\n        }\n        if (self.contains(ConstraintAttributes.centerY)) {\n            attrs.append(.centerY)\n        }\n        if (self.contains(ConstraintAttributes.lastBaseline)) {\n            attrs.append(.lastBaseline)\n        }\n        \n        #if os(iOS) || os(tvOS)\n            if (self.contains(ConstraintAttributes.firstBaseline)) {\n                attrs.append(.firstBaseline)\n            }\n            if (self.contains(ConstraintAttributes.leftMargin)) {\n                attrs.append(.leftMargin)\n            }\n            if (self.contains(ConstraintAttributes.rightMargin)) {\n                attrs.append(.rightMargin)\n            }\n            if (self.contains(ConstraintAttributes.topMargin)) {\n                attrs.append(.topMargin)\n            }\n            if (self.contains(ConstraintAttributes.bottomMargin)) {\n                attrs.append(.bottomMargin)\n            }\n            if (self.contains(ConstraintAttributes.leadingMargin)) {\n                attrs.append(.leadingMargin)\n            }\n            if (self.contains(ConstraintAttributes.trailingMargin)) {\n                attrs.append(.trailingMargin)\n            }\n            if (self.contains(ConstraintAttributes.centerXWithinMargins)) {\n                attrs.append(.centerXWithinMargins)\n            }\n            if (self.contains(ConstraintAttributes.centerYWithinMargins)) {\n                attrs.append(.centerYWithinMargins)\n            }\n        #endif\n        \n        return attrs\n    }\n}\n\ninternal func + (left: ConstraintAttributes, right: ConstraintAttributes) -> ConstraintAttributes {\n    return left.union(right)\n}\n\ninternal func +=(left: inout ConstraintAttributes, right: ConstraintAttributes) {\n    left.formUnion(right)\n}\n\ninternal func -=(left: inout ConstraintAttributes, right: ConstraintAttributes) {\n    left.subtract(right)\n}\n\ninternal func ==(left: ConstraintAttributes, right: ConstraintAttributes) -> Bool {\n    return left.rawValue == right.rawValue\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintConfig.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n    public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection\n#else\n    import AppKit\n    public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection\n#endif\n\n\npublic struct ConstraintConfig {\n    \n    public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintConstantTarget.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol ConstraintConstantTarget {\n}\n\nextension CGPoint: ConstraintConstantTarget {\n}\n\nextension CGSize: ConstraintConstantTarget {    \n}\n\nextension ConstraintInsets: ConstraintConstantTarget {\n}\n\n#if os(iOS) || os(tvOS)\n@available(iOS 11.0, tvOS 11.0, *)\nextension ConstraintDirectionalInsets: ConstraintConstantTarget {\n}\n#endif\n\nextension ConstraintConstantTarget {\n    \n    internal func constraintConstantTargetValueFor(layoutAttribute: LayoutAttribute) -> CGFloat {\n        if let value = self as? CGFloat {\n            return value\n        }\n        \n        if let value = self as? Float {\n            return CGFloat(value)\n        }\n        \n        if let value = self as? Double {\n            return CGFloat(value)\n        }\n        \n        if let value = self as? Int {\n            return CGFloat(value)\n        }\n        \n        if let value = self as? UInt {\n            return CGFloat(value)\n        }\n        \n        if let value = self as? CGSize {\n            if layoutAttribute == .width {\n                return value.width\n            } else if layoutAttribute == .height {\n                return value.height\n            } else {\n                return 0.0\n            }\n        }\n        \n        if let value = self as? CGPoint {\n            #if os(iOS) || os(tvOS)\n                switch layoutAttribute {\n                case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins:\n                    return value.x\n                case .top, .bottom, .centerY, .topMargin, .bottomMargin, .centerYWithinMargins, .lastBaseline, .firstBaseline:\n                    return value.y\n                case .width, .height, .notAnAttribute:\n                    return 0.0\n                #if swift(>=5.0)\n                @unknown default:\n                    return 0.0\n                #endif\n            }\n            #else\n                switch layoutAttribute {\n                case .left, .right, .leading, .trailing, .centerX:\n                    return value.x\n                case .top, .bottom, .centerY, .lastBaseline, .firstBaseline:\n                    return value.y\n                case .width, .height, .notAnAttribute:\n                    return 0.0\n                #if swift(>=5.0)\n                @unknown default:\n                    return 0.0\n                #endif\n            }\n            #endif\n        }\n        \n        if let value = self as? ConstraintInsets {\n            #if os(iOS) || os(tvOS)\n                switch layoutAttribute {\n                case .left, .leftMargin:\n                    return value.left\n                case .top, .topMargin, .firstBaseline:\n                    return value.top\n                case .right, .rightMargin:\n                    return -value.right\n                case .bottom, .bottomMargin, .lastBaseline:\n                    return -value.bottom\n                case .leading, .leadingMargin:\n                    return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right\n                case .trailing, .trailingMargin:\n                    return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left\n                case .centerX, .centerXWithinMargins:\n                    return (value.left - value.right) / 2\n                case .centerY, .centerYWithinMargins:\n                    return (value.top - value.bottom) / 2\n                case .width:\n                    return -(value.left + value.right)\n                case .height:\n                    return -(value.top + value.bottom)\n                case .notAnAttribute:\n                    return 0.0\n                #if swift(>=5.0)\n                @unknown default:\n                    return 0.0\n                #endif\n            }\n            #else\n                switch layoutAttribute {\n                case .left:\n                    return value.left\n                case .top, .firstBaseline:\n                    return value.top\n                case .right:\n                    return -value.right\n                case .bottom, .lastBaseline:\n                    return -value.bottom\n                case .leading:\n                    return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right\n                case .trailing:\n                    return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left\n                case .centerX:\n                    return (value.left - value.right) / 2\n                case .centerY:\n                    return (value.top - value.bottom) / 2\n                case .width:\n                    return -(value.left + value.right)\n                case .height:\n                    return -(value.top + value.bottom)\n                case .notAnAttribute:\n                    return 0.0\n                #if swift(>=5.0)\n                @unknown default:\n                    return 0.0\n                #endif\n            }\n            #endif\n        }\n        \n        #if os(iOS) || os(tvOS)\n            if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets {\n                switch layoutAttribute {\n                case .left, .leftMargin:\n                  return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.leading : value.trailing\n                case .top, .topMargin, .firstBaseline:\n                    return value.top\n                case .right, .rightMargin:\n                  return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.trailing : -value.leading\n                case .bottom, .bottomMargin, .lastBaseline:\n                    return -value.bottom\n                case .leading, .leadingMargin:\n                    return value.leading\n                case .trailing, .trailingMargin:\n                    return -value.trailing\n                case .centerX, .centerXWithinMargins:\n                    return (value.leading - value.trailing) / 2\n                case .centerY, .centerYWithinMargins:\n                    return (value.top - value.bottom) / 2\n                case .width:\n                    return -(value.leading + value.trailing)\n                case .height:\n                    return -(value.top + value.bottom)\n                case .notAnAttribute:\n                    return 0.0\n                #if swift(>=5.0)\n                @unknown default:\n                    return 0.0\n                #else\n                default:\n                    return 0.0\n                #endif\n                }\n            }\n        #endif\n\n        return 0.0\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintDSL.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol ConstraintDSL {\n    \n    var target: AnyObject? { get }\n    \n    func setLabel(_ value: String?)\n    func label() -> String?\n    \n}\nextension ConstraintDSL {\n    \n    public func setLabel(_ value: String?) {\n        objc_setAssociatedObject(self.target as Any, &labelKey, value, .OBJC_ASSOCIATION_COPY_NONATOMIC)\n    }\n    public func label() -> String? {\n        return objc_getAssociatedObject(self.target as Any, &labelKey) as? String\n    }\n    \n}\nprivate var labelKey: UInt8 = 0\n\n\npublic protocol ConstraintBasicAttributesDSL : ConstraintDSL {\n}\nextension ConstraintBasicAttributesDSL {\n    \n    // MARK: Basics\n    \n    public var left: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.left)\n    }\n    \n    public var top: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)\n    }\n    \n    public var right: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.right)\n    }\n    \n    public var bottom: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)\n    }\n    \n    public var leading: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leading)\n    }\n    \n    public var trailing: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailing)\n    }\n    \n    public var width: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.width)\n    }\n    \n    public var height: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)\n    }\n    \n    public var centerX: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerX)\n    }\n    \n    public var centerY: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerY)\n    }\n    \n    public var edges: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.edges)\n    }\n    \n    public var directionalEdges: ConstraintItem {\n      return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalEdges)\n    }\n\n    public var horizontalEdges: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.horizontalEdges)\n    }\n\n    public var verticalEdges: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.verticalEdges)\n    }\n\n    public var directionalHorizontalEdges: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalHorizontalEdges)\n    }\n\n    public var directionalVerticalEdges: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalVerticalEdges)\n    }\n\n    public var size: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.size)\n    }\n    \n    public var center: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.center)\n    }\n    \n}\n\npublic protocol ConstraintAttributesDSL : ConstraintBasicAttributesDSL {\n}\nextension ConstraintAttributesDSL {\n    \n    // MARK: Baselines\n    @available(*, deprecated, renamed:\"lastBaseline\")\n    public var baseline: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)\n    }\n    \n    @available(iOS 8.0, OSX 10.11, *)\n    public var lastBaseline: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)\n    }\n    \n    @available(iOS 8.0, OSX 10.11, *)\n    public var firstBaseline: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.firstBaseline)\n    }\n    \n    // MARK: Margins\n    \n    @available(iOS 8.0, *)\n    public var leftMargin: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leftMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var topMargin: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.topMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var rightMargin: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.rightMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var bottomMargin: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottomMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var leadingMargin: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leadingMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var trailingMargin: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailingMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var centerXWithinMargins: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerXWithinMargins)\n    }\n    \n    @available(iOS 8.0, *)\n    public var centerYWithinMargins: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerYWithinMargins)\n    }\n    \n    @available(iOS 8.0, *)\n    public var margins: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.margins)\n    }\n    \n    @available(iOS 8.0, *)\n    public var directionalMargins: ConstraintItem {\n      return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalMargins)\n    }\n\n    @available(iOS 8.0, *)\n    public var centerWithinMargins: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerWithinMargins)\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintDescription.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic class ConstraintDescription {\n    \n    internal let item: LayoutConstraintItem\n    internal var attributes: ConstraintAttributes\n    internal var relation: ConstraintRelation? = nil\n    internal var sourceLocation: (String, UInt)? = nil\n    internal var label: String? = nil\n    internal var related: ConstraintItem? = nil\n    internal var multiplier: ConstraintMultiplierTarget = 1.0\n    internal var constant: ConstraintConstantTarget = 0.0\n    internal var priority: ConstraintPriorityTarget = 1000.0\n    internal lazy var constraint: Constraint? = {\n        guard let relation = self.relation,\n              let related = self.related,\n              let sourceLocation = self.sourceLocation else {\n            return nil\n        }\n        let from = ConstraintItem(target: self.item, attributes: self.attributes)\n        \n        return Constraint(\n            from: from,\n            to: related,\n            relation: relation,\n            sourceLocation: sourceLocation,\n            label: self.label,\n            multiplier: self.multiplier,\n            constant: self.constant,\n            priority: self.priority\n        )\n    }()\n    \n    // MARK: Initialization\n    \n    internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) {\n        self.item = item\n        self.attributes = attributes\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintDirectionalInsetTarget.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\nimport UIKit\n#else\nimport AppKit\n#endif\n\n#if os(iOS) || os(tvOS)\npublic protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget {\n}\n\n@available(iOS 11.0, tvOS 11.0, *)\nextension ConstraintDirectionalInsets: ConstraintDirectionalInsetTarget {\n}\n\nextension ConstraintDirectionalInsetTarget {\n\n  @available(iOS 11.0, tvOS 11.0, *)\n  internal var constraintDirectionalInsetTargetValue: ConstraintDirectionalInsets {\n    if let amount = self as? ConstraintDirectionalInsets {\n      return amount\n    } else {\n      return ConstraintDirectionalInsets(top: 0, leading: 0, bottom: 0, trailing: 0)\n    }\n  }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintDirectionalInsets.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\n#if os(iOS) || os(tvOS)\n    @available(iOS 11.0, tvOS 11.0, *)\n    public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintInsetTarget.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol ConstraintInsetTarget: ConstraintConstantTarget {\n}\n\nextension Int: ConstraintInsetTarget {\n}\n\nextension UInt: ConstraintInsetTarget {\n}\n\nextension Float: ConstraintInsetTarget {\n}\n\nextension Double: ConstraintInsetTarget {\n}\n\nextension CGFloat: ConstraintInsetTarget {\n}\n\nextension ConstraintInsets: ConstraintInsetTarget {\n}\n\nextension ConstraintInsetTarget {\n\n    internal var constraintInsetTargetValue: ConstraintInsets {\n        if let amount = self as? ConstraintInsets {\n            return amount\n        } else if let amount = self as? Float {\n            return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))\n        } else if let amount = self as? Double {\n            return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))\n        } else if let amount = self as? CGFloat {\n            return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount)\n        } else if let amount = self as? Int {\n            return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))\n        } else if let amount = self as? UInt {\n            return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))\n        } else {\n            return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0)\n        }\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintInsets.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\n#if os(iOS) || os(tvOS)\n    public typealias ConstraintInsets = UIEdgeInsets\n#else\n    public typealias ConstraintInsets = NSEdgeInsets\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintItem.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic final class ConstraintItem {\n    \n    internal weak var target: AnyObject?\n    internal let attributes: ConstraintAttributes\n    \n    internal init(target: AnyObject?, attributes: ConstraintAttributes) {\n        self.target = target\n        self.attributes = attributes\n    }\n    \n    internal var layoutConstraintItem: LayoutConstraintItem? {\n        return self.target as? LayoutConstraintItem\n    }\n    \n}\n\npublic func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool {\n    // pointer equality\n    guard lhs !== rhs else {\n        return true\n    }\n    \n    // must both have valid targets and identical attributes\n    guard let target1 = lhs.target,\n          let target2 = rhs.target,\n          target1 === target2 && lhs.attributes == rhs.attributes else {\n            return false\n    }\n    \n    return true\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintLayoutGuide+Extensions.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#endif\n    \n    \n@available(iOS 9.0, OSX 10.11, *)\npublic extension ConstraintLayoutGuide {\n    \n    var snp: ConstraintLayoutGuideDSL {\n        return ConstraintLayoutGuideDSL(guide: self)\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintLayoutGuide.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\n#if os(iOS) || os(tvOS)\n    @available(iOS 9.0, *)\n    public typealias ConstraintLayoutGuide = UILayoutGuide\n#else\n    @available(OSX 10.11, *)\n    public typealias ConstraintLayoutGuide = NSLayoutGuide\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintLayoutGuideDSL.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\n@available(iOS 9.0, OSX 10.11, *)\npublic struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL {\n    \n    @discardableResult\n    public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {\n        return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure)\n    }\n    \n    public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        ConstraintMaker.makeConstraints(item: self.guide, closure: closure)\n    }\n    \n    public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        ConstraintMaker.remakeConstraints(item: self.guide, closure: closure)\n    }\n    \n    public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        ConstraintMaker.updateConstraints(item: self.guide, closure: closure)\n    }\n    \n    public func removeConstraints() {\n        ConstraintMaker.removeConstraints(item: self.guide)\n    }\n    \n    public var target: AnyObject? {\n        return self.guide\n    }\n    \n    internal let guide: ConstraintLayoutGuide\n    \n    internal init(guide: ConstraintLayoutGuide) {\n        self.guide = guide\n        \n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintLayoutSupport.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\n#if os(iOS) || os(tvOS)\n    @available(iOS 8.0, *)\n    public typealias ConstraintLayoutSupport = UILayoutSupport\n#else\n    public class ConstraintLayoutSupport {}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintLayoutSupportDSL.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\n@available(iOS 8.0, *)\npublic struct ConstraintLayoutSupportDSL: ConstraintDSL {\n    \n    public var target: AnyObject? {\n        return self.support\n    }\n    \n    internal let support: ConstraintLayoutSupport\n    \n    internal init(support: ConstraintLayoutSupport) {\n        self.support = support\n        \n    }\n    \n    public var top: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)\n    }\n    \n    public var bottom: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)\n    }\n    \n    public var height: ConstraintItem {\n        return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMaker.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\npublic class ConstraintMaker {\n    \n    public var left: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.left)\n    }\n    \n    public var top: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.top)\n    }\n    \n    public var bottom: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.bottom)\n    }\n    \n    public var right: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.right)\n    }\n    \n    public var leading: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.leading)\n    }\n    \n    public var trailing: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.trailing)\n    }\n    \n    public var width: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.width)\n    }\n    \n    public var height: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.height)\n    }\n    \n    public var centerX: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.centerX)\n    }\n    \n    public var centerY: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.centerY)\n    }\n    \n    @available(*, deprecated, renamed:\"lastBaseline\")\n    public var baseline: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.lastBaseline)\n    }\n    \n    public var lastBaseline: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.lastBaseline)\n    }\n    \n    @available(iOS 8.0, OSX 10.11, *)\n    public var firstBaseline: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.firstBaseline)\n    }\n    \n    @available(iOS 8.0, *)\n    public var leftMargin: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.leftMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var rightMargin: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.rightMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var topMargin: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.topMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var bottomMargin: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.bottomMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var leadingMargin: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.leadingMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var trailingMargin: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.trailingMargin)\n    }\n    \n    @available(iOS 8.0, *)\n    public var centerXWithinMargins: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.centerXWithinMargins)\n    }\n    \n    @available(iOS 8.0, *)\n    public var centerYWithinMargins: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.centerYWithinMargins)\n    }\n    \n    public var edges: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.edges)\n    }\n    public var horizontalEdges: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.horizontalEdges)\n    }\n    public var verticalEdges: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.verticalEdges)\n    }\n    public var directionalEdges: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.directionalEdges)\n    }\n    public var directionalHorizontalEdges: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.directionalHorizontalEdges)\n    }\n    public var directionalVerticalEdges: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.directionalVerticalEdges)\n    }\n    public var size: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.size)\n    }\n    public var center: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.center)\n    }\n    \n    @available(iOS 8.0, *)\n    public var margins: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.margins)\n    }\n    \n    @available(iOS 8.0, *)\n    public var directionalMargins: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.directionalMargins)\n    }\n\n    @available(iOS 8.0, *)\n    public var centerWithinMargins: ConstraintMakerExtendable {\n        return self.makeExtendableWithAttributes(.centerWithinMargins)\n    }\n    \n    public let item: LayoutConstraintItem\n    private var descriptions = [ConstraintDescription]()\n    \n    internal init(item: LayoutConstraintItem) {\n        self.item = item\n        self.item.prepare()\n    }\n    \n    internal func makeExtendableWithAttributes(_ attributes: ConstraintAttributes) -> ConstraintMakerExtendable {\n        let description = ConstraintDescription(item: self.item, attributes: attributes)\n        self.descriptions.append(description)\n        return ConstraintMakerExtendable(description)\n    }\n    \n    internal static func prepareConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {\n        let maker = ConstraintMaker(item: item)\n        closure(maker)\n        var constraints: [Constraint] = []\n        for description in maker.descriptions {\n            guard let constraint = description.constraint else {\n                continue\n            }\n            constraints.append(constraint)\n        }\n        return constraints\n    }\n    \n    internal static func makeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {\n        let constraints = prepareConstraints(item: item, closure: closure)\n        for constraint in constraints {\n            constraint.activateIfNeeded(updatingExisting: false)\n        }\n    }\n    \n    internal static func remakeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {\n        self.removeConstraints(item: item)\n        self.makeConstraints(item: item, closure: closure)\n    }\n    \n    internal static func updateConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {\n        guard item.constraints.count > 0 else {\n            self.makeConstraints(item: item, closure: closure)\n            return\n        }\n        \n        let constraints = prepareConstraints(item: item, closure: closure)\n        for constraint in constraints {\n            constraint.activateIfNeeded(updatingExisting: true)\n        }\n    }\n    \n    internal static func removeConstraints(item: LayoutConstraintItem) {\n        let constraints = item.constraints\n        for constraint in constraints {\n            constraint.deactivateIfNeeded()\n        }\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMakerEditable.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic class ConstraintMakerEditable: ConstraintMakerPrioritizable {\n\n    @discardableResult\n    public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {\n        self.description.multiplier = amount\n        return self\n    }\n    \n    @discardableResult\n    public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {\n        return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue)\n    }\n    \n    @discardableResult\n    public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable {\n        self.description.constant = amount.constraintOffsetTargetValue\n        return self\n    }\n    \n    @discardableResult\n    public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable {\n        self.description.constant = amount.constraintInsetTargetValue\n        return self\n    }\n    \n    #if os(iOS) || os(tvOS)\n    @discardableResult\n    @available(iOS 11.0, tvOS 11.0, *)\n    public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable {\n        self.description.constant = amount.constraintDirectionalInsetTargetValue\n        return self\n    }\n    #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMakerExtendable.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic class ConstraintMakerExtendable: ConstraintMakerRelatable {\n    \n    public var left: ConstraintMakerExtendable {\n        self.description.attributes += .left\n        return self\n    }\n    \n    public var top: ConstraintMakerExtendable {\n        self.description.attributes += .top\n        return self\n    }\n    \n    public var bottom: ConstraintMakerExtendable {\n        self.description.attributes += .bottom\n        return self\n    }\n    \n    public var right: ConstraintMakerExtendable {\n        self.description.attributes += .right\n        return self\n    }\n    \n    public var leading: ConstraintMakerExtendable {\n        self.description.attributes += .leading\n        return self\n    }\n    \n    public var trailing: ConstraintMakerExtendable {\n        self.description.attributes += .trailing\n        return self\n    }\n    \n    public var width: ConstraintMakerExtendable {\n        self.description.attributes += .width\n        return self\n    }\n    \n    public var height: ConstraintMakerExtendable {\n        self.description.attributes += .height\n        return self\n    }\n    \n    public var centerX: ConstraintMakerExtendable {\n        self.description.attributes += .centerX\n        return self\n    }\n    \n    public var centerY: ConstraintMakerExtendable {\n        self.description.attributes += .centerY\n        return self\n    }\n    \n    @available(*, deprecated, renamed:\"lastBaseline\")\n    public var baseline: ConstraintMakerExtendable {\n        self.description.attributes += .lastBaseline\n        return self\n    }\n    \n    public var lastBaseline: ConstraintMakerExtendable {\n        self.description.attributes += .lastBaseline\n        return self\n    }\n    \n    @available(iOS 8.0, OSX 10.11, *)\n    public var firstBaseline: ConstraintMakerExtendable {\n        self.description.attributes += .firstBaseline\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var leftMargin: ConstraintMakerExtendable {\n        self.description.attributes += .leftMargin\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var rightMargin: ConstraintMakerExtendable {\n        self.description.attributes += .rightMargin\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var topMargin: ConstraintMakerExtendable {\n        self.description.attributes += .topMargin\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var bottomMargin: ConstraintMakerExtendable {\n        self.description.attributes += .bottomMargin\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var leadingMargin: ConstraintMakerExtendable {\n        self.description.attributes += .leadingMargin\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var trailingMargin: ConstraintMakerExtendable {\n        self.description.attributes += .trailingMargin\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var centerXWithinMargins: ConstraintMakerExtendable {\n        self.description.attributes += .centerXWithinMargins\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var centerYWithinMargins: ConstraintMakerExtendable {\n        self.description.attributes += .centerYWithinMargins\n        return self\n    }\n    \n    public var edges: ConstraintMakerExtendable {\n        self.description.attributes += .edges\n        return self\n    }\n    public var horizontalEdges: ConstraintMakerExtendable {\n        self.description.attributes += .horizontalEdges\n        return self\n    }\n    public var verticalEdges: ConstraintMakerExtendable {\n        self.description.attributes += .verticalEdges\n        return self\n    }\n    public var directionalEdges: ConstraintMakerExtendable {\n        self.description.attributes += .directionalEdges\n        return self\n    }\n    public var directionalHorizontalEdges: ConstraintMakerExtendable {\n        self.description.attributes += .directionalHorizontalEdges\n        return self\n    }\n    public var directionalVerticalEdges: ConstraintMakerExtendable {\n        self.description.attributes += .directionalVerticalEdges\n        return self\n    }\n    public var size: ConstraintMakerExtendable {\n        self.description.attributes += .size\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var margins: ConstraintMakerExtendable {\n        self.description.attributes += .margins\n        return self\n    }\n    \n    @available(iOS 8.0, *)\n    public var directionalMargins: ConstraintMakerExtendable {\n      self.description.attributes += .directionalMargins\n      return self\n    }\n\n    @available(iOS 8.0, *)\n    public var centerWithinMargins: ConstraintMakerExtendable {\n        self.description.attributes += .centerWithinMargins\n        return self\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMakerFinalizable.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic class ConstraintMakerFinalizable {\n    \n    internal let description: ConstraintDescription\n    \n    internal init(_ description: ConstraintDescription) {\n        self.description = description\n    }\n    \n    @discardableResult\n    public func labeled(_ label: String) -> ConstraintMakerFinalizable {\n        self.description.label = label\n        return self\n    }\n    \n    public var constraint: Constraint {\n        return self.description.constraint!\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMakerPrioritizable.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n@available(*, deprecated, message:\"Use ConstraintMakerPrioritizable instead.\")\npublic typealias ConstraintMakerPriortizable = ConstraintMakerPrioritizable\n\npublic class ConstraintMakerPrioritizable: ConstraintMakerFinalizable {\n    \n    @discardableResult\n    public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable {\n        self.description.priority = amount.value\n        return self\n    }\n    \n    @discardableResult\n    public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {\n        self.description.priority = amount\n        return self\n    }\n    \n    @available(*, deprecated, message:\"Use priority(.required) instead.\")\n    @discardableResult\n    public func priorityRequired() -> ConstraintMakerFinalizable {\n        return self.priority(.required)\n    }\n    \n    @available(*, deprecated, message:\"Use priority(.high) instead.\")\n    @discardableResult\n    public func priorityHigh() -> ConstraintMakerFinalizable {\n        return self.priority(.high)\n    }\n    \n    @available(*, deprecated, message:\"Use priority(.medium) instead.\")\n    @discardableResult\n    public func priorityMedium() -> ConstraintMakerFinalizable {\n        return self.priority(.medium)\n    }\n    \n    @available(*, deprecated, message:\"Use priority(.low) instead.\")\n    @discardableResult\n    public func priorityLow() -> ConstraintMakerFinalizable {\n        return self.priority(.low)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMakerRelatable+Extensions.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\nextension ConstraintMakerRelatable {\n  \n    @discardableResult\n    public func equalToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {\n        guard let other = self.description.item.superview else {\n            fatalError(\"Expected superview but found nil when attempting make constraint `equalToSuperview`.\")\n        }\n        return self.relatedTo(closure(other), relation: .equal, file: file, line: line)\n    }\n  \n    @discardableResult\n    public func lessThanOrEqualToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {\n        guard let other = self.description.item.superview else {\n            fatalError(\"Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.\")\n        }\n        return self.relatedTo(closure(other), relation: .lessThanOrEqual, file: file, line: line)\n    }\n  \n    @discardableResult\n    public func greaterThanOrEqualTo<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {\n        guard let other = self.description.item.superview else {\n            fatalError(\"Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.\")\n        }\n        return self.relatedTo(closure(other), relation: .greaterThanOrEqual, file: file, line: line)\n    }\n  \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMakerRelatable.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic class ConstraintMakerRelatable {\n    \n    internal let description: ConstraintDescription\n    \n    internal init(_ description: ConstraintDescription) {\n        self.description = description\n    }\n    \n    internal func relatedTo(_ other: ConstraintRelatableTarget, relation: ConstraintRelation, file: String, line: UInt) -> ConstraintMakerEditable {\n        let related: ConstraintItem\n        let constant: ConstraintConstantTarget\n        \n        if let other = other as? ConstraintItem {\n            guard other.attributes == ConstraintAttributes.none ||\n                  other.attributes.layoutAttributes.count <= 1 ||\n                  other.attributes.layoutAttributes == self.description.attributes.layoutAttributes ||\n                  other.attributes == .edges && self.description.attributes == .margins ||\n                  other.attributes == .margins && self.description.attributes == .edges ||\n                  other.attributes == .directionalEdges && self.description.attributes == .directionalMargins ||\n                  other.attributes == .directionalMargins && self.description.attributes == .directionalEdges else {\n                fatalError(\"Cannot constraint to multiple non identical attributes. (\\(file), \\(line))\");\n            }\n            \n            related = other\n            constant = 0.0\n        } else if let other = other as? ConstraintView {\n            related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)\n            constant = 0.0\n        } else if let other = other as? ConstraintConstantTarget {\n            related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none)\n            constant = other\n        } else if #available(iOS 9.0, OSX 10.11, *), let other = other as? ConstraintLayoutGuide {\n            related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)\n            constant = 0.0\n        } else {\n            fatalError(\"Invalid constraint. (\\(file), \\(line))\")\n        }\n        \n        let editable = ConstraintMakerEditable(self.description)\n        editable.description.sourceLocation = (file, line)\n        editable.description.relation = relation\n        editable.description.related = related\n        editable.description.constant = constant\n        return editable\n    }\n    \n    @discardableResult\n    public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {\n        return self.relatedTo(other, relation: .equal, file: file, line: line)\n    }\n    \n    @discardableResult\n    public func equalToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {\n        guard let other = self.description.item.superview else {\n            fatalError(\"Expected superview but found nil when attempting make constraint `equalToSuperview`.\")\n        }\n        return self.relatedTo(other, relation: .equal, file: file, line: line)\n    }\n    \n    @discardableResult\n    public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {\n        return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)\n    }\n    \n    @discardableResult\n    public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {\n        guard let other = self.description.item.superview else {\n            fatalError(\"Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.\")\n        }\n        return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)\n    }\n    \n    @discardableResult\n    public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {\n        return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)\n    }\n    \n    @discardableResult\n    public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {\n        guard let other = self.description.item.superview else {\n            fatalError(\"Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.\")\n        }\n        return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintMultiplierTarget.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol ConstraintMultiplierTarget {\n    \n    var constraintMultiplierTargetValue: CGFloat { get }\n    \n}\n\nextension Int: ConstraintMultiplierTarget {\n    \n    public var constraintMultiplierTargetValue: CGFloat {\n        return CGFloat(self)\n    }\n    \n}\n\nextension UInt: ConstraintMultiplierTarget {\n    \n    public var constraintMultiplierTargetValue: CGFloat {\n        return CGFloat(self)\n    }\n    \n}\n\nextension Float: ConstraintMultiplierTarget {\n    \n    public var constraintMultiplierTargetValue: CGFloat {\n        return CGFloat(self)\n    }\n    \n}\n\nextension Double: ConstraintMultiplierTarget {\n    \n    public var constraintMultiplierTargetValue: CGFloat {\n        return CGFloat(self)\n    }\n    \n}\n\nextension CGFloat: ConstraintMultiplierTarget {\n    \n    public var constraintMultiplierTargetValue: CGFloat {\n        return self\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintOffsetTarget.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol ConstraintOffsetTarget: ConstraintConstantTarget {\n}\n\nextension Int: ConstraintOffsetTarget {\n}\n\nextension UInt: ConstraintOffsetTarget {\n}\n\nextension Float: ConstraintOffsetTarget {\n}\n\nextension Double: ConstraintOffsetTarget {\n}\n\nextension CGFloat: ConstraintOffsetTarget {\n}\n\nextension ConstraintOffsetTarget {\n    \n    internal var constraintOffsetTargetValue: CGFloat {\n        let offset: CGFloat\n        if let amount = self as? Float {\n            offset = CGFloat(amount)\n        } else if let amount = self as? Double {\n            offset = CGFloat(amount)\n        } else if let amount = self as? CGFloat {\n            offset = CGFloat(amount)\n        } else if let amount = self as? Int {\n            offset = CGFloat(amount)\n        } else if let amount = self as? UInt {\n            offset = CGFloat(amount)\n        } else {\n            offset = 0.0\n        }\n        return offset\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintPriority.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\npublic struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable {\n    public typealias FloatLiteralType = Float\n    \n    public let value: Float\n    \n    public init(floatLiteral value: Float) {\n        self.value = value\n    }\n    \n    public init(_ value: Float) {\n        self.value = value\n    }\n    \n    public static var required: ConstraintPriority {\n        return 1000.0\n    }\n    \n    public static var high: ConstraintPriority {\n        return 750.0\n    }\n    \n    public static var medium: ConstraintPriority {\n        #if os(OSX)\n            return 501.0\n        #else\n            return 500.0\n        #endif\n        \n    }\n    \n    public static var low: ConstraintPriority {\n        return 250.0\n    }\n    \n    public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool {\n        return lhs.value == rhs.value\n    }\n\n    // MARK: Strideable\n\n    public func advanced(by n: FloatLiteralType) -> ConstraintPriority {\n        return ConstraintPriority(floatLiteral: value + n)\n    }\n\n    public func distance(to other: ConstraintPriority) -> FloatLiteralType {\n        return other.value - value\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintPriorityTarget.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol ConstraintPriorityTarget {\n    \n    var constraintPriorityTargetValue: Float { get }\n    \n}\n\nextension Int: ConstraintPriorityTarget {\n    \n    public var constraintPriorityTargetValue: Float {\n        return Float(self)\n    }\n    \n}\n\nextension UInt: ConstraintPriorityTarget {\n    \n    public var constraintPriorityTargetValue: Float {\n        return Float(self)\n    }\n    \n}\n\nextension Float: ConstraintPriorityTarget {\n    \n    public var constraintPriorityTargetValue: Float {\n        return self\n    }\n    \n}\n\nextension Double: ConstraintPriorityTarget {\n    \n    public var constraintPriorityTargetValue: Float {\n        return Float(self)\n    }\n    \n}\n\nextension CGFloat: ConstraintPriorityTarget {\n    \n    public var constraintPriorityTargetValue: Float {\n        return Float(self)\n    }\n    \n}\n\n#if os(iOS) || os(tvOS)\nextension UILayoutPriority: ConstraintPriorityTarget {\n\n    public var constraintPriorityTargetValue: Float {\n        return self.rawValue\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintRelatableTarget.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol ConstraintRelatableTarget {\n}\n\nextension Int: ConstraintRelatableTarget {\n}\n\nextension UInt: ConstraintRelatableTarget {\n}\n\nextension Float: ConstraintRelatableTarget {\n}\n\nextension Double: ConstraintRelatableTarget {\n}\n\nextension CGFloat: ConstraintRelatableTarget {\n}\n\nextension CGSize: ConstraintRelatableTarget {\n}\n\nextension CGPoint: ConstraintRelatableTarget {\n}\n\nextension ConstraintInsets: ConstraintRelatableTarget {\n}\n\n#if os(iOS) || os(tvOS)\n@available(iOS 11.0, tvOS 11.0, *)\nextension ConstraintDirectionalInsets: ConstraintRelatableTarget {\n}\n#endif\n\nextension ConstraintItem: ConstraintRelatableTarget {\n}\n\nextension ConstraintView: ConstraintRelatableTarget {\n}\n\n@available(iOS 9.0, OSX 10.11, *)\nextension ConstraintLayoutGuide: ConstraintRelatableTarget {\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintRelation.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\ninternal enum ConstraintRelation : Int {\n    case equal = 1\n    case lessThanOrEqual\n    case greaterThanOrEqual\n    \n    internal var layoutRelation: LayoutRelation {\n        get {\n            switch(self) {\n            case .equal:\n                return .equal\n            case .lessThanOrEqual:\n                return .lessThanOrEqual\n            case .greaterThanOrEqual:\n                return .greaterThanOrEqual\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintView+Extensions.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic extension ConstraintView {\n    \n    @available(*, deprecated, renamed:\"snp.left\")\n    var snp_left: ConstraintItem { return self.snp.left }\n    \n    @available(*, deprecated, renamed:\"snp.top\")\n    var snp_top: ConstraintItem { return self.snp.top }\n    \n    @available(*, deprecated, renamed:\"snp.right\")\n    var snp_right: ConstraintItem { return self.snp.right }\n    \n    @available(*, deprecated, renamed:\"snp.bottom\")\n    var snp_bottom: ConstraintItem { return self.snp.bottom }\n    \n    @available(*, deprecated, renamed:\"snp.leading\")\n    var snp_leading: ConstraintItem { return self.snp.leading }\n    \n    @available(*, deprecated, renamed:\"snp.trailing\")\n    var snp_trailing: ConstraintItem { return self.snp.trailing }\n    \n    @available(*, deprecated, renamed:\"snp.width\")\n    var snp_width: ConstraintItem { return self.snp.width }\n    \n    @available(*, deprecated, renamed:\"snp.height\")\n    var snp_height: ConstraintItem { return self.snp.height }\n    \n    @available(*, deprecated, renamed:\"snp.centerX\")\n    var snp_centerX: ConstraintItem { return self.snp.centerX }\n    \n    @available(*, deprecated, renamed:\"snp.centerY\")\n    var snp_centerY: ConstraintItem { return self.snp.centerY }\n    \n    @available(*, deprecated, renamed:\"snp.baseline\")\n    var snp_baseline: ConstraintItem { return self.snp.baseline }\n    \n    @available(*, deprecated, renamed:\"snp.lastBaseline\")\n    @available(iOS 8.0, OSX 10.11, *)\n    var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }\n    \n    @available(iOS, deprecated, renamed:\"snp.firstBaseline\")\n    @available(iOS 8.0, OSX 10.11, *)\n    var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }\n    \n    @available(iOS, deprecated, renamed:\"snp.leftMargin\")\n    @available(iOS 8.0, *)\n    var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }\n    \n    @available(iOS, deprecated, renamed:\"snp.topMargin\")\n    @available(iOS 8.0, *)\n    var snp_topMargin: ConstraintItem { return self.snp.topMargin }\n    \n    @available(iOS, deprecated, renamed:\"snp.rightMargin\")\n    @available(iOS 8.0, *)\n    var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }\n    \n    @available(iOS, deprecated, renamed:\"snp.bottomMargin\")\n    @available(iOS 8.0, *)\n    var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }\n    \n    @available(iOS, deprecated, renamed:\"snp.leadingMargin\")\n    @available(iOS 8.0, *)\n    var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }\n    \n    @available(iOS, deprecated, renamed:\"snp.trailingMargin\")\n    @available(iOS 8.0, *)\n    var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }\n    \n    @available(iOS, deprecated, renamed:\"snp.centerXWithinMargins\")\n    @available(iOS 8.0, *)\n    var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }\n    \n    @available(iOS, deprecated, renamed:\"snp.centerYWithinMargins\")\n    @available(iOS 8.0, *)\n    var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }\n    \n    @available(*, deprecated, renamed:\"snp.edges\")\n    var snp_edges: ConstraintItem { return self.snp.edges }\n    \n    @available(*, deprecated, renamed:\"snp.size\")\n    var snp_size: ConstraintItem { return self.snp.size }\n    \n    @available(*, deprecated, renamed:\"snp.center\")\n    var snp_center: ConstraintItem { return self.snp.center }\n    \n    @available(iOS, deprecated, renamed:\"snp.margins\")\n    @available(iOS 8.0, *)\n    var snp_margins: ConstraintItem { return self.snp.margins }\n    \n    @available(iOS, deprecated, renamed:\"snp.centerWithinMargins\")\n    @available(iOS 8.0, *)\n    var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }\n    \n    @available(*, deprecated, renamed:\"snp.prepareConstraints(_:)\")\n    func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {\n        return self.snp.prepareConstraints(closure)\n    }\n    \n    @available(*, deprecated, renamed:\"snp.makeConstraints(_:)\")\n    func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        self.snp.makeConstraints(closure)\n    }\n    \n    @available(*, deprecated, renamed:\"snp.remakeConstraints(_:)\")\n    func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        self.snp.remakeConstraints(closure)\n    }\n    \n    @available(*, deprecated, renamed:\"snp.updateConstraints(_:)\")\n    func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        self.snp.updateConstraints(closure)\n    }\n    \n    @available(*, deprecated, renamed:\"snp.removeConstraints()\")\n    func snp_removeConstraints() {\n        self.snp.removeConstraints()\n    }\n    \n    var snp: ConstraintViewDSL {\n        return ConstraintViewDSL(view: self)\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintView.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\n#if os(iOS) || os(tvOS)\n    public typealias ConstraintView = UIView\n#else\n    public typealias ConstraintView = NSView\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/ConstraintViewDSL.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic struct ConstraintViewDSL: ConstraintAttributesDSL {\n    \n    @discardableResult\n    public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {\n        return ConstraintMaker.prepareConstraints(item: self.view, closure: closure)\n    }\n    \n    public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        ConstraintMaker.makeConstraints(item: self.view, closure: closure)\n    }\n    \n    public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        ConstraintMaker.remakeConstraints(item: self.view, closure: closure)\n    }\n    \n    public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {\n        ConstraintMaker.updateConstraints(item: self.view, closure: closure)\n    }\n    \n    public func removeConstraints() {\n        ConstraintMaker.removeConstraints(item: self.view)\n    }\n    \n    public var contentHuggingHorizontalPriority: Float {\n        get {\n            return self.view.contentHuggingPriority(for: .horizontal).rawValue\n        }\n        nonmutating set {\n            self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal)\n        }\n    }\n    \n    public var contentHuggingVerticalPriority: Float {\n        get {\n            return self.view.contentHuggingPriority(for: .vertical).rawValue\n        }\n        nonmutating set {\n            self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical)\n        }\n    }\n    \n    public var contentCompressionResistanceHorizontalPriority: Float {\n        get {\n            return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue\n        }\n        nonmutating set {\n            self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal)\n        }\n    }\n    \n    public var contentCompressionResistanceVerticalPriority: Float {\n        get {\n            return self.view.contentCompressionResistancePriority(for: .vertical).rawValue\n        }\n        nonmutating set {\n            self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .vertical)\n        }\n    }\n    \n    public var target: AnyObject? {\n        return self.view\n    }\n    \n    internal let view: ConstraintView\n    \n    internal init(view: ConstraintView) {\n        self.view = view\n        \n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/Debugging.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\npublic extension LayoutConstraint {\n    \n    override var description: String {\n        var description = \"<\"\n        \n        description += descriptionForObject(self)\n        \n        if let firstItem = conditionalOptional(from: self.firstItem) {\n            description += \" \\(descriptionForObject(firstItem))\"\n        }\n        \n        if self.firstAttribute != .notAnAttribute {\n            description += \".\\(descriptionForAttribute(self.firstAttribute))\"\n        }\n        \n        description += \" \\(descriptionForRelation(self.relation))\"\n        \n        if let secondItem = self.secondItem {\n            description += \" \\(descriptionForObject(secondItem))\"\n        }\n        \n        if self.secondAttribute != .notAnAttribute {\n            description += \".\\(descriptionForAttribute(self.secondAttribute))\"\n        }\n        \n        if self.multiplier != 1.0 {\n            description += \" * \\(self.multiplier)\"\n        }\n        \n        if self.secondAttribute == .notAnAttribute {\n            description += \" \\(self.constant)\"\n        } else {\n            if self.constant > 0.0 {\n                description += \" + \\(self.constant)\"\n            } else if self.constant < 0.0 {\n                description += \" - \\(abs(self.constant))\"\n            }\n        }\n        \n        if self.priority.rawValue != 1000.0 {\n            description += \" ^\\(self.priority)\"\n        }\n        \n        description += \">\"\n        \n        return description\n    }\n    \n}\n\nprivate func descriptionForRelation(_ relation: LayoutRelation) -> String {\n    switch relation {\n    case .equal:                return \"==\"\n    case .greaterThanOrEqual:   return \">=\"\n    case .lessThanOrEqual:      return \"<=\"\n    #if swift(>=5.0)\n    @unknown default:           return \"unknown\"\n    #endif\n    }\n}\n\nprivate func descriptionForAttribute(_ attribute: LayoutAttribute) -> String {\n    #if os(iOS) || os(tvOS)\n        switch attribute {\n        case .notAnAttribute:       return \"notAnAttribute\"\n        case .top:                  return \"top\"\n        case .left:                 return \"left\"\n        case .bottom:               return \"bottom\"\n        case .right:                return \"right\"\n        case .leading:              return \"leading\"\n        case .trailing:             return \"trailing\"\n        case .width:                return \"width\"\n        case .height:               return \"height\"\n        case .centerX:              return \"centerX\"\n        case .centerY:              return \"centerY\"\n        case .lastBaseline:         return \"lastBaseline\"\n        case .firstBaseline:        return \"firstBaseline\"\n        case .topMargin:            return \"topMargin\"\n        case .leftMargin:           return \"leftMargin\"\n        case .bottomMargin:         return \"bottomMargin\"\n        case .rightMargin:          return \"rightMargin\"\n        case .leadingMargin:        return \"leadingMargin\"\n        case .trailingMargin:       return \"trailingMargin\"\n        case .centerXWithinMargins: return \"centerXWithinMargins\"\n        case .centerYWithinMargins: return \"centerYWithinMargins\"\n        #if swift(>=5.0)\n        @unknown default:           return \"unknown\"\n        #endif\n    }\n    #else\n        switch attribute {\n        case .notAnAttribute:       return \"notAnAttribute\"\n        case .top:                  return \"top\"\n        case .left:                 return \"left\"\n        case .bottom:               return \"bottom\"\n        case .right:                return \"right\"\n        case .leading:              return \"leading\"\n        case .trailing:             return \"trailing\"\n        case .width:                return \"width\"\n        case .height:               return \"height\"\n        case .centerX:              return \"centerX\"\n        case .centerY:              return \"centerY\"\n        case .lastBaseline:         return \"lastBaseline\"\n        case .firstBaseline:        return \"firstBaseline\"\n        #if swift(>=5.0)\n        @unknown default:           return \"unknown\"\n        #endif\n    }\n    #endif\n}\n\nprivate func conditionalOptional<T>(from object: Optional<T>) -> Optional<T> {\n    return object\n}\n\nprivate func conditionalOptional<T>(from object: T) -> Optional<T> {\n    return Optional.some(object)\n}\n\nprivate func descriptionForObject(_ object: AnyObject) -> String {\n    let pointerDescription = String(format: \"%p\", UInt(bitPattern: ObjectIdentifier(object)))\n    var desc = \"\"\n    \n    desc += type(of: object).description()\n    \n    if let object = object as? ConstraintView {\n        desc += \":\\(object.snp.label() ?? pointerDescription)\"\n    } else if let object = object as? LayoutConstraint {\n        desc += \":\\(object.label ?? pointerDescription)\"\n    } else {\n        desc += \":\\(pointerDescription)\"\n    }\n    \n    if let object = object as? LayoutConstraint, let file = object.constraint?.sourceLocation.0, let line = object.constraint?.sourceLocation.1 {\n        desc += \"@\\((file as NSString).lastPathComponent)#\\(line)\"\n    }\n    \n    desc += \"\"\n    return desc\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/LayoutConstraint.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic class LayoutConstraint : NSLayoutConstraint {\n    \n    public var label: String? {\n        get {\n            return self.identifier\n        }\n        set {\n            self.identifier = newValue\n        }\n    }\n    \n    internal weak var constraint: Constraint? = nil\n    \n}\n\ninternal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {\n    // If firstItem or secondItem on either constraint has a dangling pointer\n    // this comparison can cause a crash. The solution for this is to ensure\n    // your layout code hold strong references to things like Views, LayoutGuides\n    // and LayoutAnchors as SnapKit will not keep strong references to any of these.\n    guard lhs.firstAttribute == rhs.firstAttribute &&\n          lhs.secondAttribute == rhs.secondAttribute &&\n          lhs.relation == rhs.relation &&\n          lhs.priority == rhs.priority &&\n          lhs.multiplier == rhs.multiplier &&\n          lhs.secondItem === rhs.secondItem &&\n          lhs.firstItem === rhs.firstItem else {\n        return false\n    }\n    return true\n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/LayoutConstraintItem.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#else\n    import AppKit\n#endif\n\n\npublic protocol LayoutConstraintItem: AnyObject {\n}\n\n@available(iOS 9.0, OSX 10.11, *)\nextension ConstraintLayoutGuide : LayoutConstraintItem {\n}\n\nextension ConstraintView : LayoutConstraintItem {\n}\n\n\nextension LayoutConstraintItem {\n    \n    internal func prepare() {\n        if let view = self as? ConstraintView {\n            view.translatesAutoresizingMaskIntoConstraints = false\n        }\n    }\n    \n    internal var superview: ConstraintView? {\n        if let view = self as? ConstraintView {\n            return view.superview\n        }\n        \n        if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide {\n            return guide.owningView\n        }\n        \n        return nil\n    }\n    internal var constraints: [Constraint] {\n        return self.constraintsSet.allObjects as! [Constraint]\n    }\n    \n    internal func add(constraints: [Constraint]) {\n        let constraintsSet = self.constraintsSet\n        for constraint in constraints {\n            constraintsSet.add(constraint)\n        }\n    }\n    \n    internal func remove(constraints: [Constraint]) {\n        let constraintsSet = self.constraintsSet\n        for constraint in constraints {\n            constraintsSet.remove(constraint)\n        }\n    }\n    \n    private var constraintsSet: NSMutableSet {\n        let constraintsSet: NSMutableSet\n        \n        if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSMutableSet {\n            constraintsSet = existing\n        } else {\n            constraintsSet = NSMutableSet()\n            objc_setAssociatedObject(self, &constraintsKey, constraintsSet, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n        }\n        return constraintsSet\n        \n    }\n    \n}\nprivate var constraintsKey: UInt8 = 0\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/Typealiases.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#if swift(>=4.2)\n    typealias LayoutRelation = NSLayoutConstraint.Relation\n    typealias LayoutAttribute = NSLayoutConstraint.Attribute\n#else\n    typealias LayoutRelation = NSLayoutRelation\n    typealias LayoutAttribute = NSLayoutAttribute\n#endif\n    typealias LayoutPriority = UILayoutPriority\n#else\n    import AppKit\n    typealias LayoutRelation = NSLayoutConstraint.Relation\n    typealias LayoutAttribute = NSLayoutConstraint.Attribute\n    typealias LayoutPriority = NSLayoutConstraint.Priority\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/SnapKit/Sources/UILayoutSupport+Extensions.swift",
    "content": "//\n//  SnapKit\n//\n//  Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\n#if os(iOS) || os(tvOS)\n    import UIKit\n#endif\n\n    \n@available(iOS 8.0, *)\npublic extension ConstraintLayoutSupport {\n    \n    var snp: ConstraintLayoutSupportDSL {\n        return ConstraintLayoutSupportDSL(support: self)\n    }\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SnapKit.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t00D8165E61DB4A46219E0A7AA4E897D3 /* ConstraintOffsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7051EB5426FDDF63868DF29E69EB3CD /* ConstraintOffsetTarget.swift */; };\n\t\t134E45BD332C3FBE340D3F8A743C2C62 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A8BD630E1A960525797DF39130524D /* ConstraintItem.swift */; };\n\t\t13B6328C65209EE99F6B30C148219837 /* ConstraintRelatableTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5610388E3D529371A6C917E42F3EB5CC /* ConstraintRelatableTarget.swift */; };\n\t\t1B073A36B22381A8F1C5047BAC9BCEBB /* ConstraintDirectionalInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69BAB2F27B28482F20AD06232DF6015B /* ConstraintDirectionalInsetTarget.swift */; };\n\t\t1FCC9EDD920B5DF59C009EAADD557B5F /* ConstraintLayoutGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48175EC2D31B5D089D65544ED0BC0822 /* ConstraintLayoutGuide.swift */; };\n\t\t203F3D007FE05737B1443E529F7EBDB4 /* ConstraintDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 486EC08B7F63F885E5EE3A8592B7EC15 /* ConstraintDSL.swift */; };\n\t\t2587754241286CC412B6C3D35E0D32DD /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D345EC9BCC4434DF84D8D508D4E3A6 /* ConstraintMaker.swift */; };\n\t\t2DB970F9C1CD90274C26B78FEFEF31D4 /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6772C4FB1C4E0B6B66F9DD0776F37959 /* ConstraintLayoutSupport.swift */; };\n\t\t2F0D83CC89E36D018DDA4A3FFAB09446 /* ConstraintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27DDCC39DD617132EF55C79FACF6A10E /* ConstraintView.swift */; };\n\t\t37D528EEB24CCBCF6FEEF8F84366E34F /* ConstraintPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BB34963D19DCC3FE8347C0D7F5686F6 /* ConstraintPriority.swift */; };\n\t\t3888F5F2682FB9ED5F2F046F1D377760 /* ConstraintDirectionalInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC557799B101B70A84B6AF1C8D6B509 /* ConstraintDirectionalInsets.swift */; };\n\t\t3A02CC761720C6E53AB5B10EB4C27A78 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1DB0A79D4FEEC4AF630152AD47ADB1B /* ConstraintMakerFinalizable.swift */; };\n\t\t53F0ECCD18C451B3A3696BE25F6E78FC /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70418BDEDCCD804DCCD24D0DC01C9C4F /* ConstraintMakerEditable.swift */; };\n\t\t54AFA946423220BFB2D445D435AE16F3 /* ConstraintMultiplierTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 438A382C159813E58ADAD5FAE7D86553 /* ConstraintMultiplierTarget.swift */; };\n\t\t54F10F0C6DDDE989487061BD362AD5C7 /* ConstraintConstantTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DCE48CD9BB1FB84120680AFA0092EFF /* ConstraintConstantTarget.swift */; };\n\t\t57F8F7823EBF10BA6185079AA060608A /* ConstraintLayoutGuideDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A91A33DAE0C179014DBA9211C19443 /* ConstraintLayoutGuideDSL.swift */; };\n\t\t6D821220F430989D4CAFCE4249EA5681 /* ConstraintMakerPrioritizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3121215DF7F5ED870283752272877B4E /* ConstraintMakerPrioritizable.swift */; };\n\t\t6F23B9F634ADACEDC4167A0F3407174D /* ConstraintView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 342A5659D0F9676ED83490F2F2CF02F9 /* ConstraintView+Extensions.swift */; };\n\t\t84F900D3917751204C659D19EC958D64 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1766ABD604AFF4F995D4730C3BEE0976 /* ConstraintAttributes.swift */; };\n\t\t8C404A0D3EEB73DC4F92B8D81D1C77A3 /* ConstraintPriorityTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F265F154F742EB270CC6D643141B12DF /* ConstraintPriorityTarget.swift */; };\n\t\t91F1F7F0D55210C7DF1A66796AF4E18D /* ConstraintViewDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 155B485CF3B3CDB31EA290996E4C9AFF /* ConstraintViewDSL.swift */; };\n\t\tA5A4EC13D6E7FB4C68EC0DFB07E37C50 /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = B65F2DAC78967E95602FA238AC393A8B /* ConstraintInsetTarget.swift */; };\n\t\tAD42B167AAEFE26344D892B04F710F4A /* SnapKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B98AD9017D9A1736A52ECCB545D43F2 /* SnapKit-dummy.m */; };\n\t\tAFB886639E639A552B3C92E17CD61AC9 /* ConstraintConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0139A550E7E07ABF33D0B7F029331133 /* ConstraintConfig.swift */; };\n\t\tB083D496EEED9CD03270CC557241E2BE /* ConstraintInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BB005AA56A197AA3A91561AF7176D72 /* ConstraintInsets.swift */; };\n\t\tB1B6604176F0BAF48DAF23A97AF2D6D7 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAC0B50D6FFD28BAD1F89764815C89B0 /* Constraint.swift */; };\n\t\tB5F2D32342C124CE746995F1921A120A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C25529A935388F0C0DE3726CF56C4D4F /* Foundation.framework */; };\n\t\tB9892E645CC5A615904522010FDAFD87 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A4A74241EC911565C978A8C999C0E51 /* ConstraintRelation.swift */; };\n\t\tBCB9828D4BBB422F8356311F619C7AD5 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC966C2302559724506CCBAD8C78840 /* ConstraintDescription.swift */; };\n\t\tC14434764ADAFA146DE9009D20E142CD /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB3AC2ED38FCA9EAE6AF429C1EB003F7 /* LayoutConstraint.swift */; };\n\t\tCAA0B027A0E5EA9424455C6243A309A8 /* ConstraintMakerRelatable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B969C2E9B9483500CD88151895AFC54 /* ConstraintMakerRelatable+Extensions.swift */; };\n\t\tD4A3EF11A987B26DA6E40E255F6FF610 /* ConstraintLayoutGuide+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37997643847B48CCD57B1043D71CDAAB /* ConstraintLayoutGuide+Extensions.swift */; };\n\t\tDAE060F175BFE553FCD5187C2E13E8EA /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3E0C9F2FA17BA3702593546A603F1CF /* ConstraintMakerRelatable.swift */; };\n\t\tE6D05259ACA480628EE6CE17479EF732 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D1DE0C295CD49C7FC308223C2C0E545 /* Debugging.swift */; };\n\t\tEE49BBC61D5B1933001F25471E28CAE1 /* SnapKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EFB68D70C62B358418ADB6728ECADBE /* SnapKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF25CB4207D9F603460C4AF11410DCBA0 /* ConstraintLayoutSupportDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB1F453F859480792C168120A3F6721 /* ConstraintLayoutSupportDSL.swift */; };\n\t\tF3405E1983CEFFD5A2873CA30E48D7CF /* UILayoutSupport+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64CFF86D085117D9E70D89F3EEFFF325 /* UILayoutSupport+Extensions.swift */; };\n\t\tF76E21B754D1C14A83513D5AC9D38338 /* LayoutConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 338D992AF42AA7914001481844E7DF00 /* LayoutConstraintItem.swift */; };\n\t\tF7AF92DB4A0D789412A6E8C3C1FD5919 /* Typealiases.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D129707FDA1E365E98D3D45B39BAF89 /* Typealiases.swift */; };\n\t\tFAD6B59B97A1ABEE33545C79C8E42B55 /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BDEE4903FBE9F76E71F0AF9010F5E48 /* ConstraintMakerExtendable.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t0139A550E7E07ABF33D0B7F029331133 /* ConstraintConfig.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConfig.swift; path = Sources/ConstraintConfig.swift; sourceTree = \"<group>\"; };\n\t\t0BC557799B101B70A84B6AF1C8D6B509 /* ConstraintDirectionalInsets.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDirectionalInsets.swift; path = Sources/ConstraintDirectionalInsets.swift; sourceTree = \"<group>\"; };\n\t\t0BC966C2302559724506CCBAD8C78840 /* ConstraintDescription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDescription.swift; path = Sources/ConstraintDescription.swift; sourceTree = \"<group>\"; };\n\t\t138F7F24A0F293AE20EADBC06E9711A7 /* SnapKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t155B485CF3B3CDB31EA290996E4C9AFF /* ConstraintViewDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintViewDSL.swift; path = Sources/ConstraintViewDSL.swift; sourceTree = \"<group>\"; };\n\t\t1766ABD604AFF4F995D4730C3BEE0976 /* ConstraintAttributes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintAttributes.swift; path = Sources/ConstraintAttributes.swift; sourceTree = \"<group>\"; };\n\t\t1BDEE4903FBE9F76E71F0AF9010F5E48 /* ConstraintMakerExtendable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerExtendable.swift; path = Sources/ConstraintMakerExtendable.swift; sourceTree = \"<group>\"; };\n\t\t27DDCC39DD617132EF55C79FACF6A10E /* ConstraintView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintView.swift; path = Sources/ConstraintView.swift; sourceTree = \"<group>\"; };\n\t\t2D129707FDA1E365E98D3D45B39BAF89 /* Typealiases.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Typealiases.swift; path = Sources/Typealiases.swift; sourceTree = \"<group>\"; };\n\t\t3121215DF7F5ED870283752272877B4E /* ConstraintMakerPrioritizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerPrioritizable.swift; path = Sources/ConstraintMakerPrioritizable.swift; sourceTree = \"<group>\"; };\n\t\t31A8BD630E1A960525797DF39130524D /* ConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintItem.swift; path = Sources/ConstraintItem.swift; sourceTree = \"<group>\"; };\n\t\t338D992AF42AA7914001481844E7DF00 /* LayoutConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraintItem.swift; path = Sources/LayoutConstraintItem.swift; sourceTree = \"<group>\"; };\n\t\t342A5659D0F9676ED83490F2F2CF02F9 /* ConstraintView+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ConstraintView+Extensions.swift\"; path = \"Sources/ConstraintView+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t37997643847B48CCD57B1043D71CDAAB /* ConstraintLayoutGuide+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ConstraintLayoutGuide+Extensions.swift\"; path = \"Sources/ConstraintLayoutGuide+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t3A4A74241EC911565C978A8C999C0E51 /* ConstraintRelation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelation.swift; path = Sources/ConstraintRelation.swift; sourceTree = \"<group>\"; };\n\t\t438A382C159813E58ADAD5FAE7D86553 /* ConstraintMultiplierTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMultiplierTarget.swift; path = Sources/ConstraintMultiplierTarget.swift; sourceTree = \"<group>\"; };\n\t\t48175EC2D31B5D089D65544ED0BC0822 /* ConstraintLayoutGuide.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuide.swift; path = Sources/ConstraintLayoutGuide.swift; sourceTree = \"<group>\"; };\n\t\t486EC08B7F63F885E5EE3A8592B7EC15 /* ConstraintDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDSL.swift; path = Sources/ConstraintDSL.swift; sourceTree = \"<group>\"; };\n\t\t4C869FDCB01928EA1213A88708602ED9 /* SnapKit */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SnapKit; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t53D345EC9BCC4434DF84D8D508D4E3A6 /* ConstraintMaker.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMaker.swift; path = Sources/ConstraintMaker.swift; sourceTree = \"<group>\"; };\n\t\t5610388E3D529371A6C917E42F3EB5CC /* ConstraintRelatableTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelatableTarget.swift; path = Sources/ConstraintRelatableTarget.swift; sourceTree = \"<group>\"; };\n\t\t5BB005AA56A197AA3A91561AF7176D72 /* ConstraintInsets.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsets.swift; path = Sources/ConstraintInsets.swift; sourceTree = \"<group>\"; };\n\t\t5BB34963D19DCC3FE8347C0D7F5686F6 /* ConstraintPriority.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriority.swift; path = Sources/ConstraintPriority.swift; sourceTree = \"<group>\"; };\n\t\t5F4A671B79612079B9DABE9D5BAC41C9 /* SnapKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"SnapKit-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t64CFF86D085117D9E70D89F3EEFFF325 /* UILayoutSupport+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"UILayoutSupport+Extensions.swift\"; path = \"Sources/UILayoutSupport+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t6772C4FB1C4E0B6B66F9DD0776F37959 /* ConstraintLayoutSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupport.swift; path = Sources/ConstraintLayoutSupport.swift; sourceTree = \"<group>\"; };\n\t\t68ABF38B17CD746D3B0103D03BEB701C /* SnapKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SnapKit-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t69BAB2F27B28482F20AD06232DF6015B /* ConstraintDirectionalInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDirectionalInsetTarget.swift; path = Sources/ConstraintDirectionalInsetTarget.swift; sourceTree = \"<group>\"; };\n\t\t70418BDEDCCD804DCCD24D0DC01C9C4F /* ConstraintMakerEditable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerEditable.swift; path = Sources/ConstraintMakerEditable.swift; sourceTree = \"<group>\"; };\n\t\t78E0EB4272144354821B72C70D2E52A5 /* SnapKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SnapKit.modulemap; sourceTree = \"<group>\"; };\n\t\t7D1DE0C295CD49C7FC308223C2C0E545 /* Debugging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debugging.swift; path = Sources/Debugging.swift; sourceTree = \"<group>\"; };\n\t\t7EFB68D70C62B358418ADB6728ECADBE /* SnapKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SnapKit-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t861DBB48F3D16DB488A17FD4DA7CD618 /* SnapKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t8B969C2E9B9483500CD88151895AFC54 /* ConstraintMakerRelatable+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"ConstraintMakerRelatable+Extensions.swift\"; path = \"Sources/ConstraintMakerRelatable+Extensions.swift\"; sourceTree = \"<group>\"; };\n\t\t8B98AD9017D9A1736A52ECCB545D43F2 /* SnapKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"SnapKit-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t9DCE48CD9BB1FB84120680AFA0092EFF /* ConstraintConstantTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConstantTarget.swift; path = Sources/ConstraintConstantTarget.swift; sourceTree = \"<group>\"; };\n\t\tA7A91A33DAE0C179014DBA9211C19443 /* ConstraintLayoutGuideDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuideDSL.swift; path = Sources/ConstraintLayoutGuideDSL.swift; sourceTree = \"<group>\"; };\n\t\tB65F2DAC78967E95602FA238AC393A8B /* ConstraintInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsetTarget.swift; path = Sources/ConstraintInsetTarget.swift; sourceTree = \"<group>\"; };\n\t\tBAC0B50D6FFD28BAD1F89764815C89B0 /* Constraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Constraint.swift; path = Sources/Constraint.swift; sourceTree = \"<group>\"; };\n\t\tBEB1F453F859480792C168120A3F6721 /* ConstraintLayoutSupportDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupportDSL.swift; path = Sources/ConstraintLayoutSupportDSL.swift; sourceTree = \"<group>\"; };\n\t\tC25529A935388F0C0DE3726CF56C4D4F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tD1DB0A79D4FEEC4AF630152AD47ADB1B /* ConstraintMakerFinalizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerFinalizable.swift; path = Sources/ConstraintMakerFinalizable.swift; sourceTree = \"<group>\"; };\n\t\tD3E0C9F2FA17BA3702593546A603F1CF /* ConstraintMakerRelatable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerRelatable.swift; path = Sources/ConstraintMakerRelatable.swift; sourceTree = \"<group>\"; };\n\t\tDB3AC2ED38FCA9EAE6AF429C1EB003F7 /* LayoutConstraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraint.swift; path = Sources/LayoutConstraint.swift; sourceTree = \"<group>\"; };\n\t\tE7051EB5426FDDF63868DF29E69EB3CD /* ConstraintOffsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintOffsetTarget.swift; path = Sources/ConstraintOffsetTarget.swift; sourceTree = \"<group>\"; };\n\t\tF265F154F742EB270CC6D643141B12DF /* ConstraintPriorityTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriorityTarget.swift; path = Sources/ConstraintPriorityTarget.swift; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t624267A0C747D85D2F9EF19AA40E8CB1 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB5F2D32342C124CE746995F1921A120A /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2AFCE41BBA2D17CE026693F1310DC51A /* SnapKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBAC0B50D6FFD28BAD1F89764815C89B0 /* Constraint.swift */,\n\t\t\t\t1766ABD604AFF4F995D4730C3BEE0976 /* ConstraintAttributes.swift */,\n\t\t\t\t0139A550E7E07ABF33D0B7F029331133 /* ConstraintConfig.swift */,\n\t\t\t\t9DCE48CD9BB1FB84120680AFA0092EFF /* ConstraintConstantTarget.swift */,\n\t\t\t\t0BC966C2302559724506CCBAD8C78840 /* ConstraintDescription.swift */,\n\t\t\t\t0BC557799B101B70A84B6AF1C8D6B509 /* ConstraintDirectionalInsets.swift */,\n\t\t\t\t69BAB2F27B28482F20AD06232DF6015B /* ConstraintDirectionalInsetTarget.swift */,\n\t\t\t\t486EC08B7F63F885E5EE3A8592B7EC15 /* ConstraintDSL.swift */,\n\t\t\t\t5BB005AA56A197AA3A91561AF7176D72 /* ConstraintInsets.swift */,\n\t\t\t\tB65F2DAC78967E95602FA238AC393A8B /* ConstraintInsetTarget.swift */,\n\t\t\t\t31A8BD630E1A960525797DF39130524D /* ConstraintItem.swift */,\n\t\t\t\t48175EC2D31B5D089D65544ED0BC0822 /* ConstraintLayoutGuide.swift */,\n\t\t\t\t37997643847B48CCD57B1043D71CDAAB /* ConstraintLayoutGuide+Extensions.swift */,\n\t\t\t\tA7A91A33DAE0C179014DBA9211C19443 /* ConstraintLayoutGuideDSL.swift */,\n\t\t\t\t6772C4FB1C4E0B6B66F9DD0776F37959 /* ConstraintLayoutSupport.swift */,\n\t\t\t\tBEB1F453F859480792C168120A3F6721 /* ConstraintLayoutSupportDSL.swift */,\n\t\t\t\t53D345EC9BCC4434DF84D8D508D4E3A6 /* ConstraintMaker.swift */,\n\t\t\t\t70418BDEDCCD804DCCD24D0DC01C9C4F /* ConstraintMakerEditable.swift */,\n\t\t\t\t1BDEE4903FBE9F76E71F0AF9010F5E48 /* ConstraintMakerExtendable.swift */,\n\t\t\t\tD1DB0A79D4FEEC4AF630152AD47ADB1B /* ConstraintMakerFinalizable.swift */,\n\t\t\t\t3121215DF7F5ED870283752272877B4E /* ConstraintMakerPrioritizable.swift */,\n\t\t\t\tD3E0C9F2FA17BA3702593546A603F1CF /* ConstraintMakerRelatable.swift */,\n\t\t\t\t8B969C2E9B9483500CD88151895AFC54 /* ConstraintMakerRelatable+Extensions.swift */,\n\t\t\t\t438A382C159813E58ADAD5FAE7D86553 /* ConstraintMultiplierTarget.swift */,\n\t\t\t\tE7051EB5426FDDF63868DF29E69EB3CD /* ConstraintOffsetTarget.swift */,\n\t\t\t\t5BB34963D19DCC3FE8347C0D7F5686F6 /* ConstraintPriority.swift */,\n\t\t\t\tF265F154F742EB270CC6D643141B12DF /* ConstraintPriorityTarget.swift */,\n\t\t\t\t5610388E3D529371A6C917E42F3EB5CC /* ConstraintRelatableTarget.swift */,\n\t\t\t\t3A4A74241EC911565C978A8C999C0E51 /* ConstraintRelation.swift */,\n\t\t\t\t27DDCC39DD617132EF55C79FACF6A10E /* ConstraintView.swift */,\n\t\t\t\t342A5659D0F9676ED83490F2F2CF02F9 /* ConstraintView+Extensions.swift */,\n\t\t\t\t155B485CF3B3CDB31EA290996E4C9AFF /* ConstraintViewDSL.swift */,\n\t\t\t\t7D1DE0C295CD49C7FC308223C2C0E545 /* Debugging.swift */,\n\t\t\t\tDB3AC2ED38FCA9EAE6AF429C1EB003F7 /* LayoutConstraint.swift */,\n\t\t\t\t338D992AF42AA7914001481844E7DF00 /* LayoutConstraintItem.swift */,\n\t\t\t\t2D129707FDA1E365E98D3D45B39BAF89 /* Typealiases.swift */,\n\t\t\t\t64CFF86D085117D9E70D89F3EEFFF325 /* UILayoutSupport+Extensions.swift */,\n\t\t\t\t2B61DA66BA1D5F29A3A8898175A29E47 /* Support Files */,\n\t\t\t);\n\t\t\tname = SnapKit;\n\t\t\tpath = SnapKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2B61DA66BA1D5F29A3A8898175A29E47 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t78E0EB4272144354821B72C70D2E52A5 /* SnapKit.modulemap */,\n\t\t\t\t8B98AD9017D9A1736A52ECCB545D43F2 /* SnapKit-dummy.m */,\n\t\t\t\t5F4A671B79612079B9DABE9D5BAC41C9 /* SnapKit-Info.plist */,\n\t\t\t\t68ABF38B17CD746D3B0103D03BEB701C /* SnapKit-prefix.pch */,\n\t\t\t\t7EFB68D70C62B358418ADB6728ECADBE /* SnapKit-umbrella.h */,\n\t\t\t\t138F7F24A0F293AE20EADBC06E9711A7 /* SnapKit.debug.xcconfig */,\n\t\t\t\t861DBB48F3D16DB488A17FD4DA7CD618 /* SnapKit.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/SnapKit\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t50098AA6AE9F902486430BC762678712 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t839FC10F5C9F8BF429627A0DAC8730C6 /* Frameworks */,\n\t\t\t\t660AC0C02A2556ECBC6FF8B2052354FD /* Products */,\n\t\t\t\t2AFCE41BBA2D17CE026693F1310DC51A /* SnapKit */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t660AC0C02A2556ECBC6FF8B2052354FD /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C869FDCB01928EA1213A88708602ED9 /* SnapKit */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t839FC10F5C9F8BF429627A0DAC8730C6 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB36F9FD2FBE151EFBF63242183F9E3F9 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB36F9FD2FBE151EFBF63242183F9E3F9 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC25529A935388F0C0DE3726CF56C4D4F /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tE9236FFD681A56F2EA737EF39B722E23 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tEE49BBC61D5B1933001F25471E28CAE1 /* SnapKit-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t6913FCF4B90C224E55FE5C821AFB90D2 /* SnapKit */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = A583C7D8F729661B3B5ED3574138F8D4 /* Build configuration list for PBXNativeTarget \"SnapKit\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE9236FFD681A56F2EA737EF39B722E23 /* Headers */,\n\t\t\t\t061603471E032B634D5CE92E2049D203 /* Sources */,\n\t\t\t\t624267A0C747D85D2F9EF19AA40E8CB1 /* Frameworks */,\n\t\t\t\t87118D3820809B509FB99AD7C8098AC9 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = SnapKit;\n\t\t\tproductName = SnapKit;\n\t\t\tproductReference = 4C869FDCB01928EA1213A88708602ED9 /* SnapKit */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t4E07CAC47E0963A0A66108E62D78D5D3 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3F69B37F5DCCE980243AC77F1144EFDE /* Build configuration list for PBXProject \"SnapKit\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 50098AA6AE9F902486430BC762678712;\n\t\t\tproductRefGroup = 660AC0C02A2556ECBC6FF8B2052354FD /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t6913FCF4B90C224E55FE5C821AFB90D2 /* SnapKit */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t87118D3820809B509FB99AD7C8098AC9 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t061603471E032B634D5CE92E2049D203 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB1B6604176F0BAF48DAF23A97AF2D6D7 /* Constraint.swift in Sources */,\n\t\t\t\t84F900D3917751204C659D19EC958D64 /* ConstraintAttributes.swift in Sources */,\n\t\t\t\tAFB886639E639A552B3C92E17CD61AC9 /* ConstraintConfig.swift in Sources */,\n\t\t\t\t54F10F0C6DDDE989487061BD362AD5C7 /* ConstraintConstantTarget.swift in Sources */,\n\t\t\t\tBCB9828D4BBB422F8356311F619C7AD5 /* ConstraintDescription.swift in Sources */,\n\t\t\t\t3888F5F2682FB9ED5F2F046F1D377760 /* ConstraintDirectionalInsets.swift in Sources */,\n\t\t\t\t1B073A36B22381A8F1C5047BAC9BCEBB /* ConstraintDirectionalInsetTarget.swift in Sources */,\n\t\t\t\t203F3D007FE05737B1443E529F7EBDB4 /* ConstraintDSL.swift in Sources */,\n\t\t\t\tB083D496EEED9CD03270CC557241E2BE /* ConstraintInsets.swift in Sources */,\n\t\t\t\tA5A4EC13D6E7FB4C68EC0DFB07E37C50 /* ConstraintInsetTarget.swift in Sources */,\n\t\t\t\t134E45BD332C3FBE340D3F8A743C2C62 /* ConstraintItem.swift in Sources */,\n\t\t\t\t1FCC9EDD920B5DF59C009EAADD557B5F /* ConstraintLayoutGuide.swift in Sources */,\n\t\t\t\tD4A3EF11A987B26DA6E40E255F6FF610 /* ConstraintLayoutGuide+Extensions.swift in Sources */,\n\t\t\t\t57F8F7823EBF10BA6185079AA060608A /* ConstraintLayoutGuideDSL.swift in Sources */,\n\t\t\t\t2DB970F9C1CD90274C26B78FEFEF31D4 /* ConstraintLayoutSupport.swift in Sources */,\n\t\t\t\tF25CB4207D9F603460C4AF11410DCBA0 /* ConstraintLayoutSupportDSL.swift in Sources */,\n\t\t\t\t2587754241286CC412B6C3D35E0D32DD /* ConstraintMaker.swift in Sources */,\n\t\t\t\t53F0ECCD18C451B3A3696BE25F6E78FC /* ConstraintMakerEditable.swift in Sources */,\n\t\t\t\tFAD6B59B97A1ABEE33545C79C8E42B55 /* ConstraintMakerExtendable.swift in Sources */,\n\t\t\t\t3A02CC761720C6E53AB5B10EB4C27A78 /* ConstraintMakerFinalizable.swift in Sources */,\n\t\t\t\t6D821220F430989D4CAFCE4249EA5681 /* ConstraintMakerPrioritizable.swift in Sources */,\n\t\t\t\tDAE060F175BFE553FCD5187C2E13E8EA /* ConstraintMakerRelatable.swift in Sources */,\n\t\t\t\tCAA0B027A0E5EA9424455C6243A309A8 /* ConstraintMakerRelatable+Extensions.swift in Sources */,\n\t\t\t\t54AFA946423220BFB2D445D435AE16F3 /* ConstraintMultiplierTarget.swift in Sources */,\n\t\t\t\t00D8165E61DB4A46219E0A7AA4E897D3 /* ConstraintOffsetTarget.swift in Sources */,\n\t\t\t\t37D528EEB24CCBCF6FEEF8F84366E34F /* ConstraintPriority.swift in Sources */,\n\t\t\t\t8C404A0D3EEB73DC4F92B8D81D1C77A3 /* ConstraintPriorityTarget.swift in Sources */,\n\t\t\t\t13B6328C65209EE99F6B30C148219837 /* ConstraintRelatableTarget.swift in Sources */,\n\t\t\t\tB9892E645CC5A615904522010FDAFD87 /* ConstraintRelation.swift in Sources */,\n\t\t\t\t2F0D83CC89E36D018DDA4A3FFAB09446 /* ConstraintView.swift in Sources */,\n\t\t\t\t6F23B9F634ADACEDC4167A0F3407174D /* ConstraintView+Extensions.swift in Sources */,\n\t\t\t\t91F1F7F0D55210C7DF1A66796AF4E18D /* ConstraintViewDSL.swift in Sources */,\n\t\t\t\tE6D05259ACA480628EE6CE17479EF732 /* Debugging.swift in Sources */,\n\t\t\t\tC14434764ADAFA146DE9009D20E142CD /* LayoutConstraint.swift in Sources */,\n\t\t\t\tF76E21B754D1C14A83513D5AC9D38338 /* LayoutConstraintItem.swift in Sources */,\n\t\t\t\tAD42B167AAEFE26344D892B04F710F4A /* SnapKit-dummy.m in Sources */,\n\t\t\t\tF7AF92DB4A0D789412A6E8C3C1FD5919 /* Typealiases.swift in Sources */,\n\t\t\t\tF3405E1983CEFFD5A2873CA30E48D7CF /* UILayoutSupport+Extensions.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2DD42BF64D8550A6C04B88E080753821 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tE2CB174044F50F005064E202DEC98DE0 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 138F7F24A0F293AE20EADBC06E9711A7 /* SnapKit.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SnapKit/SnapKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SnapKit/SnapKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SnapKit/SnapKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SnapKit;\n\t\t\t\tPRODUCT_NAME = SnapKit;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tF3B92DE508CA822C88FBED1C3B4CE950 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tF76C2D78EDC30FB8970207228C4FCA8F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 861DBB48F3D16DB488A17FD4DA7CD618 /* SnapKit.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SnapKit/SnapKit-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SnapKit/SnapKit-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SnapKit/SnapKit.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SnapKit;\n\t\t\t\tPRODUCT_NAME = SnapKit;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t3F69B37F5DCCE980243AC77F1144EFDE /* Build configuration list for PBXProject \"SnapKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2DD42BF64D8550A6C04B88E080753821 /* Debug */,\n\t\t\t\tF3B92DE508CA822C88FBED1C3B4CE950 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tA583C7D8F729661B3B5ED3574138F8D4 /* Build configuration list for PBXNativeTarget \"SnapKit\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE2CB174044F50F005064E202DEC98DE0 /* Debug */,\n\t\t\t\tF76C2D78EDC30FB8970207228C4FCA8F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 4E07CAC47E0963A0A66108E62D78D5D3 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2018 Daniele Margutti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/README.md",
    "content": "<p align=\"center\" >\n  <img src=\"banner.png\" width=300px alt=\"SwiftDate\" title=\"SwiftDate\">\n</p>\n\n<p align=\"center\"><strong>Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.</strong></p>\n\n## What's This?\n\nSwiftDate is the **definitive toolchain to manipulate and display dates and time zones** on all Apple platform and even on Linux and Swift Server Side frameworks like Vapor or Kitura.  \n**Over 3 million of downloads on [CocoaPods](https://cocoapods.org/pods/SwiftDate).**\n\nFrom simple date manipulation to complex business logic SwiftDate maybe the right choice for your next project.\n\n- [x] **Easy Date Parsing** (custom formats, iso8601, rss & many more)\n- [x] **Easy Date Formatting** even with colloquial formatter and 140+ supported languages\n- [x] **Easy math operations with time units** (`2.hours + 5.minutes`...)\n- [x] **Intuitive components extraction** (`day, hour, nearestHour, weekdayNameShort` etc.)\n- [x] **Derivated dates generation** (`nextWeek, nextMonth, nextWeekday, tomorrow`...)\n- [x] Over **20+ fine grained date comparison** functions (`isToday, isTomorrow, isSameWeek, isNextYear`...)\n- [x] Swift 4's **Codable Support**\n- [x] **Random dates** generation\n- [x] **Fine grained date enumeration** functions\n- [x] **Time period** support\n- [x] **Convert TimeIntervals** to other units (`2.hours.toUnits(.minutes)`)\n\nand of course...\n\n- **IT'S TESTED!**. As 5.x the project has 90% of code coverage (want help us? write some unit tests and make a PR)\n- **IT'S FULLY DOCUMENTED!**, [both with a complete guide](/Documentation/Index.md) and with Jazzy!\n- **WE LOVE PLAYGROUND!** [Check out](/Playgrounds/SwiftDate.playground) our interactive playground!\n\n\n## Start with SwiftDate\n\nThe entire library is fully documented both via XCode method inspector and a complete markdown documentation you can found below.\n\n- → **[Full Documentation](/Documentation/Index.md)**\n- → **[Requirements, Install, License & More](/Documentation/0.Informations.md)**\n- → **[Upgrading from SwiftDate 4](/Documentation/10.Upgrading_SwiftDate4.md)**\n\n### Explore SwiftDate\n\nFrom simple date manipulation to complex business logic SwiftDate maybe the right choice for your next project.\n\nLet me show to you the main features of the library:\n\n- [Date Parsing](#1)\n- [Date Manipulation](#2)\n- [Date Comparsion](#3)\n- [Date Creation with Region (Timezone, Calendar & Locale)](#4)\n- [Derivated Dates](#5)\n- [Components Extraction](#6)\n- [Switch between timezones/locale and calendars](#7)\n- [Date Formatting](#8)\n- [Relative Date Formatting (fully customizable!)](#9)\n- [Codable Support](#10)\n- [Time Periods](#11)\n\n<a name=\"1\"/>\n\n### 1. Date Parsing\nSwiftDate can recognize all the major datetime formats  automatically (ISO8601, RSS, Alt RSS, .NET, SQL, HTTP...) and you can also provide your own formats.\nCreating a new date has never been so easy!\n\n```swift\n// All default datetime formats (15+) are recognized automatically\nlet _ = \"2010-05-20 15:30:00\".toDate()\n// You can also provide your own format!\nlet _ = \"2010-05-20 15:30\".toDate(\"yyyy-MM-dd HH:mm\")\n// All ISO8601 variants are supported too with timezone parsing!\nlet _ = \"2017-09-17T11:59:29+02:00\".toISODate()\n// RSS, Extended, HTTP, SQL, .NET and all the major variants are supported!\nlet _ = \"19 Nov 2015 22:20:40 +0100\".toRSS(alt: true)\n\n```\n\n<a name=\"2\"/>\n\n### 2. Date Manipulation\nDate can be manipulated by adding or removing time components using a natural language; time unit extraction is also easy and includes the support for timezone, calendar and locales!\n\nManipulation can be done with standard math operators and between dates, time intervals, date components and relevant time units!\n\n```swift\n// Math operations support time units\nlet _ = (\"2010-05-20 15:30:00\".toDate() + 3.months - 2.days)\nlet _ = Date() + 3.hours\nlet _ = date1 + [.year:1, .month:2, .hour:5]\nlet _ = date1 + date2\n// extract single time unit components from date manipulation\nlet over1Year = (date3 - date2).year > 1\n```\n<a name=\"3\"/>\n\n### 3. Date Comparison\nSwiftDate include an extensive set of comparison functions; you can compare two dates by granularity, check if a date is an particular day, range and practically any other comparison you ever need.\n\nComparison is also available via standard math operators like (`>, >=, <, <=`).\n\n```swift\n// Standard math comparison is allowed\nlet _ = dateA >= dateB || dateC < dateB\n\n// Complex comparisons includes granularity support\nlet _ = dateA.compare(toDate: dateB, granularity: .hour) == .orderedSame\nlet _ = dateA.isAfterDate(dateB, orEqual: true, granularity: .month) // > until month granularity\nlet _ = dateC.isInRange(date: dateA, and: dateB, orEqual: true, granularity: .day) // > until day granularity\nlet _ = dateA.earlierDate(dateB) // earlier date\nlet _ = dateA.laterDate(dateB) // later date\n\n// Check if date is close to another with a given precision\nlet _ = dateA.compareCloseTo(dateB, precision: 1.hours.timeInterval\n\n// Compare for relevant events:\n// .isToday, .isYesterday, .isTomorrow, .isWeekend, isNextWeek\n// .isSameDay, .isMorning, .isWeekday ...\nlet _ = date.compare(.isToday)\nlet _ = date.compare(.isNight)\nlet _ = date.compare(.isNextWeek)\nlet _ = date.compare(.isThisMonth)\nlet _ = date.compare(.startOfWeek)\nlet _ = date.compare(.isNextYear)\n// ...and MORE THAN 30 OTHER COMPARISONS BUILT IN\n\n// Operation in arrays (oldestIn, newestIn, sortedByNewest, sortedByOldest...)\nlet _ = DateInRegion.oldestIn(list: datesArray)\nlet _ = DateInRegion.sortedByNewest(list: datesArray)\n```\n\n<a name=\"4\"/>\n\n### 4. Date Creation with Region (Timezone, Calendar & Locale)\nYou can create new dates from a string, time intervals or using date components. SwiftDate offers a wide set of functions to create and derivate your dates even with random generation!\n\n```swift\n// All dates includes timezone, calendar and locales!\n// Create from string\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet date1 = DateInRegion(\"2010-01-01 00:00:00\", region: rome)!\n\n// Create date from intervals\nlet _ = DateInRegion(seconds: 39940, region: rome)\nlet _ = DateInRegion(milliseconds: 5000, region: rome)\n\n// Date from components\nlet _ = DateInRegion(components: {\n\t$0.year = 2001\n\t$0.month = 9\n\t$0.day = 11\n\t$0.hour = 12\n\t$0.minute = 0\n}, region: rome)\nlet _ = DateInRegion(year: 2001, month: 1, day: 5, hour: 23, minute: 30, second: 0, region: rome)\n\n// Random date generation with/without bounds\nlet _ = DateInRegion.randomDate(region: rome)\nlet _ = DateInRegion.randomDate(withinDaysBeforeToday: 5)\nlet _ = DateInRegion.randomDates(count: 50, between: lowerLimitDate, and: upperLimitDate, region: rome)\n```\n<a name=\"5\"/>\n\n### 5. Derivated Dates\nDate can be also generated starting from other dates; SwiftDate includes an extensive set of functions to generate.\nOver 20 different derivated dates can be created easily using `dateAt()` function.\n\n```swift\nlet _ = DateInRegion().dateAt(.endOfDay) // today at the end of the day\n// Over 20 different relevant dates including .startOfDay,\n// .endOfDay, .startOfWeek, .tomorrow, .nextWeekday, .nextMonth, .prevYear, .nearestMinute and many others!\nlet _ = dateA.nextWeekday(.friday) // the next friday after dateA\nlet _ = (date.dateAt(.startOfMonth) - 3.days)\nlet _ = dateA.compare(.endOfWeek)\n\n// Enumerate dates in range by providing your own custom\n// increment expressed in date components\nlet from = DateInRegion(\"2015-01-01 10:00:00\", region: rome)!\nlet to = DateInRegion(\"2015-01-02 03:00:00\", region: rome)!\nlet increment2 = DateComponents.create {\n\t$0.hour = 1\n\t$0.minute = 30\n\t$0.second = 10\n}\n// generate dates in range by incrementing +1h,30m,10s each new date\nlet dates = DateInRegion.enumerateDates(from: fromDate2, to: toDate2, increment: increment2)\n\n// Get all mondays in Jan 2019\nlet mondaysInJan2019 = Date.datesForWeekday(.monday, inMonth: 1, ofYear: 2019)\n\n// Altering time components\nlet _ = dateA.dateBySet(hour: 10, min: 0, secs: 0)\n\n// Truncating a date\nlet _ = dateA.dateTruncated(at: [.year,.month,.day]) // reset all time components keeping only date\n\n// Rounding a date\nlet _ = dateA.dateRoundedAt(.toMins(10))\nlet _ = dateA.dateRoundedAt(.toFloor30Mins)\n\n// Adding components\nlet _ = dateA.dateByAdding(5,.year)\n\n// Date at the start/end of any time component\nlet _ = dateA.dateAtEndOf(.year) // 31 of Dec at 23:59:59\nlet _ = dateA.dateAtStartOf(.day) // at 00:00:00 of the same day\nlet _ = dateA.dateAtStartOf(.month) // at 00:00:00 of the first day of the month\n```\n\n<a name=\"6\"/>\n\n### 6. Components Extraction\nYou can extract components directly from dates and it includes the right value expressed in date's region (the right timezone and set locale!).\n\n```swift\n// Create a date in a region, London but with the lcoale set to IT\nlet london = Region(calendar: .gregorian, zone: .europeLondon, locale: .italian)\nlet date = DateInRegion(\"2018-02-05 23:14:45\", format: dateFormat, region: london)!\n\n// You can extract any of the all available time units.\n// VALUES ARE EXPRESSED IN THE REGION OF THE DATE (THE RIGHT TIMEZONE).\n// (you can still get the UTC/absolute value by getting the inner's absoluteDate).\n\nlet _ = date.year // 2018\nlet _ = date.month // 2\nlet _ = date.monthNameDefault // 'Febbraio' as the locale is the to IT!\nlet _ = date.firstDayOfWeek // 5\nlet _ = date.weekdayNameShort // 'Lun' as locale is the to IT\n// ... all components are supported: .year, .month, .day, .hour, .minute, .second,\n// .monthName, .weekday, .nearestHour, .firstDayOfWeek. .quarter and so on...\n```\n\n<a name=\"7\"/>\n\n### 7. Switch between timezones/locale and calendars\nYou can easily convert any date to another region (aka another calendar, locale or timezone) easily!\nNew date contains all values expressed into the destination reason\n\n```swift\n// Conversion between timezones is easy using convertTo(region:) function\nlet rNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.english)\nlet rRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet dateInNY = \"2017-01-01 00:00:00\".toDate(region: rNY)\nlet dateInRome = dateInNY?.convertTo(region: rRome)!\nprint(dateInRome.toString()) // \"dom gen 01 06:00:00 +0100 2017\\n\"\n\n// You can also convert single region's attributes\nlet dateInIndia = dateInNY?.convertTo(timezone: Zones.indianChristmas, locale: Locales.nepaliIndia)\nprint(\"\\(dateInIndia!.toString())\") // \"आइत जनवरी ०१ १२:००:०० +0700 २०१७\\n\"\n```\n\n<a name=\"8\"/>\n\n### 8. Date Formatting\nDate formatting is easy, you can specify your own format, locale or use any of the provided ones.\n\n```swift\n// Date Formatting\nlet london = Region(calendar: .gregorian, zone: .europeLondon, locale: .english)\nlet date = ... // 2017-07-22T18:27:02+02:00 in london region\nlet _ = date.toDotNET() // /Date(1500740822000+0200)/\nlet _ = date.toISODate() // 2017-07-22T18:27:02+02:00\nlet _ = date.toFormat(\"dd MMM yyyy 'at' HH:mm\") // \"22 July 2017 at 18:27\"\n\n// You can also easily change locale when formatting a region\nlet _ = date.toFormat(\"dd MMM\", locale: .italian) // \"22 Luglio\"\n\n// Time Interval Formatting as Countdown\nlet interval: TimeInterval = (2.hours.timeInterval) + (34.minutes.timeInterval) + (5.seconds.timeInterval)\nlet _ = interval.toClock() // \"2:34:05\"\n\n// Time Interval Formatting by Components\nlet _ = interval.toString {\n\t$0.maximumUnitCount = 4\n\t$0.allowedUnits = [.day, .hour, .minute]\n\t$0.collapsesLargestUnit = true\n\t$0.unitsStyle = .abbreviated\n} // \"2h 34m\"\n```\n\n<a name=\"9\"/>\n\n### 9. Relative Date Formatting (fully customizable!)\nRelative formatting is all new in SwiftDate; it supports 120+ languages with two different styles (`.default, .twitter`), 9 flavours (`.long, .longTime, .longConvenient, .short, .shortTime, .shortConvenient, .narrow, .tiny, .quantify`) and all of them are customizable as you need.\nThe extensible format allows you to provide your own translations and rules to override the default behaviour.\n\n```swift\n// Twitter Style\nlet _ = (Date() - 3.minutes).toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.english) // \"3m\"\nlet _ = (Date() - 6.minutes).toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian) // \"6 min fa\"\n\n// Default Style\nlet _ = (now2 - 5.hours).toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.english) // \"5 hours ago\"\nlet y = (now2 - 40.minutes).toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.italian) // \"45 minuti fa\"\n```\n<a name=\"10\"/>\n\n### 10. Codable Support\nBoth `DateInRegion` and `Region` fully support the new Swift's `Codable` protocol. This mean you can safely encode/decode them:\n\n```swift\n// Encoding/Decoding a Region\nlet region = Region(calendar: Calendars.gregorian, zone: Zones.europeOslo, locale: Locales.english)\nlet encodedJSON = try JSONEncoder().encode(region)\nlet decodedRegion = try JSONDecoder().decode(Region.self, from: encodedJSON)\n\n// Encoding/Decoding a DateInRegion\nlet date = DateInRegion(\"2015-09-24T13:20:55\", region: region)\nlet encodedDate = try JSONEncoder().encode(date)\nlet decodedDate = try JSONDecoder().decode(DateInRegion.self, from: encodedDate)\n```\n\n<a name=\"11\"/>\n\n### 11. Time Periods\nSwiftDate integrates the great Matthew York's [DateTools](https://github.com/MatthewYork/DateTools) module in order to support Time Periods.\n\nSee [Time Periods](/Documentation/12.Timer_Periods.md) section of the documentation.\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Date/Date+Compare.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension Date {\n\n\t// MARK: - Comparing Close\n\n\t/// Decides whether a Date is \"close by\" another one passed in parameter,\n\t/// where \"Being close\" is measured using a precision argument\n\t/// which is initialized a 300 seconds, or 5 minutes.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date compare against to.\n\t///   - precision: The precision of the comparison (default is 5 minutes, or 300 seconds).\n\t/// - Returns: A boolean; true if close by, false otherwise.\n\tfunc compareCloseTo(_ refDate: Date, precision: TimeInterval = 300) -> Bool {\n\t\treturn (abs(timeIntervalSince(refDate)) < precision)\n\t}\n\n\t// MARK: - Extendend Compare\n\n\t/// Compare the date with the rule specified in the `compareType` parameter.\n\t///\n\t/// - Parameter compareType: comparison type.\n\t/// - Returns: `true` if comparison succeded, `false` otherwise\n\tfunc compare(_ compareType: DateComparisonType) -> Bool {\n\t\treturn inDefaultRegion().compare(compareType)\n\t}\n\n\t/// Returns a ComparisonResult value that indicates the ordering of two given dates based on\n\t/// their components down to a given unit granularity.\n\t///\n\t/// - parameter date:        date to compare.\n\t/// - parameter granularity: The smallest unit that must, along with all larger units be less for the given dates\n\t/// - returns: `ComparisonResult`\n\tfunc compare(toDate refDate: Date, granularity: Calendar.Component) -> ComparisonResult {\n\t\treturn inDefaultRegion().compare(toDate: refDate.inDefaultRegion(), granularity: granularity)\n\t}\n\n\t/// Compares whether the receiver is before/before equal `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: smallest unit that must, along with all larger units, be less for the given dates\n\t/// - Returns: Boolean\n\tfunc isBeforeDate(_ refDate: Date, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n\t\treturn inDefaultRegion().isBeforeDate(refDate.inDefaultRegion(), orEqual: orEqual, granularity: granularity)\n\t}\n\n\t/// Compares whether the receiver is after `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: Smallest unit that must, along with all larger units, be greater for the given dates.\n\t/// - Returns: Boolean\n\tfunc isAfterDate(_ refDate: Date, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n\t\treturn inDefaultRegion().isAfterDate(refDate.inDefaultRegion(), orEqual: orEqual, granularity: granularity)\n\t}\n\n\t/// Returns a value between 0.0 and 1.0 or nil, that is the position of current date between 2 other dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t/// - Returns: `nil` if current date is not between `startDate` and `endDate`. Otherwise returns position between `startDate` and `endDate`.\n\tfunc positionInRange(date startDate: Date, and endDate: Date) -> Double? {\n\t\treturn inDefaultRegion().positionInRange(date: startDate.inDefaultRegion(), and: endDate.inDefaultRegion())\n\t}\n\n\t/// Return true if receiver date is contained in the range specified by two dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t///   - orEqual: `true` to also check for equality on date and date2\n\t///   - granularity: smallest unit that must, along with all larger units, be greater for the given dates.\n\t/// - Returns: Boolean\n\tfunc isInRange(date startDate: Date, and endDate: Date, orEqual: Bool = false, granularity: Calendar.Component = .nanosecond) -> Bool {\n        return inDefaultRegion().isInRange(date: startDate.inDefaultRegion(), and: endDate.inDefaultRegion(), orEqual: orEqual, granularity: granularity)\n\t}\n\n\t/// Compares equality of two given dates based on their components down to a given unit\n\t/// granularity.\n\t///\n\t/// - parameter date:        date to compare\n\t/// - parameter granularity: The smallest unit that must, along with all larger units, be equal for the given\n\t///         dates to be considered the same.\n\t///\n\t/// - returns: `true` if the dates are the same down to the given granularity, otherwise `false`\n\tfunc isInside(date: Date, granularity: Calendar.Component) -> Bool {\n\t\treturn (compare(toDate: date, granularity: granularity) == .orderedSame)\n\t}\n\n\t// MARK: - Date Earlier/Later\n\n\t/// Return the earlier of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is earlier\n\tfunc earlierDate(_ date: Date) -> Date {\n\t\treturn timeIntervalSince(date) <= 0 ? self : date\n\t}\n\n\t/// Return the later of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is later\n\tfunc laterDate(_ date: Date) -> Date {\n\t\treturn timeIntervalSince(date) >= 0 ? self : date\n\t}\n\n}\n\nextension Date {\n\n    /// Returns the difference in the calendar component given (like day, month or year)\n    /// with respect to the other date as a positive integer\n    public func difference(in component: Calendar.Component, from other: Date) -> Int? {\n        let (max, min) = orderDate(with: other)\n        let result = calendar.dateComponents([component], from: min, to: max)\n        return getValue(of: component, from: result)\n    }\n\n    /// Returns the differences in the calendar components given (like day, month and year)\n    /// with respect to the other date as dictionary with the calendar component as the key\n    /// and the diffrence as a positive integer as the value\n    public func differences(in components: Set<Calendar.Component>, from other: Date) -> [Calendar.Component: Int] {\n        let (max, min) = orderDate(with: other)\n        let differenceInDates = calendar.dateComponents(components, from: min, to: max)\n        var result = [Calendar.Component: Int]()\n        for component in components {\n            if let value = getValue(of: component, from: differenceInDates) {\n                result[component] = value\n            }\n        }\n        return result\n    }\n\n    private func getValue(of component: Calendar.Component, from dateComponents: DateComponents) -> Int? {\n        switch component {\n        case .era:\n            return dateComponents.era\n        case .year:\n            return dateComponents.year\n        case .month:\n            return dateComponents.month\n        case .day:\n            return dateComponents.day\n        case .hour:\n            return dateComponents.hour\n        case .minute:\n            return dateComponents.minute\n        case .second:\n            return dateComponents.second\n        case .weekday:\n            return dateComponents.weekday\n        case .weekdayOrdinal:\n            return dateComponents.weekdayOrdinal\n        case .quarter:\n            return dateComponents.quarter\n        case .weekOfMonth:\n            return dateComponents.weekOfMonth\n        case .weekOfYear:\n            return dateComponents.weekOfYear\n        case .yearForWeekOfYear:\n            return dateComponents.yearForWeekOfYear\n        case .nanosecond:\n            return dateComponents.nanosecond\n        case .calendar, .timeZone:\n            return nil\n        @unknown default:\n            assert(false, \"unknown date component\")\n        }\n        return nil\n    }\n\n    private func orderDate(with other: Date) -> (Date, Date) {\n        let first = self.timeIntervalSince1970\n        let second = other.timeIntervalSince1970\n\n        if first >= second {\n            return (self, other)\n        }\n\n        return (other, self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Date/Date+Components.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension Date {\n\n\t/// Indicates whether the month is a leap month.\n\tvar isLeapMonth: Bool {\n\t\treturn inDefaultRegion().isLeapMonth\n\t}\n\n\t/// Indicates whether the year is a leap year.\n\tvar isLeapYear: Bool {\n\t\treturn inDefaultRegion().isLeapYear\n\t}\n\n\t/// Julian day is the continuous count of days since the beginning of\n\t/// the Julian Period used primarily by astronomers.\n\tvar julianDay: Double {\n\t\treturn inDefaultRegion().julianDay\n\t}\n\n\t/// The Modified Julian Date (MJD) was introduced by the Smithsonian Astrophysical Observatory\n\t/// in 1957 to record the orbit of Sputnik via an IBM 704 (36-bit machine)\n\t/// and using only 18 bits until August 7, 2576.\n\tvar modifiedJulianDay: Double {\n\t\treturn inDefaultRegion().modifiedJulianDay\n\t}\n\n\t/// Return elapsed time expressed in given components since the current receiver and a reference date.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date (`nil` to use current date in the same region of the receiver)\n\t///   - component: time unit to extract.\n\t/// - Returns: value\n\tfunc getInterval(toDate: Date?, component: Calendar.Component) -> Int64 {\n\t\treturn inDefaultRegion().getInterval(toDate: toDate?.inDefaultRegion(), component: component)\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Date/Date+Create.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension Date {\n\n\t/// Return the oldest date in given list.\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the oldest date and its instance.\n\tstatic func oldestIn(list: [Date]) -> Date? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.min(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Return the newest date in given list.\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the oldest date and its instance.\n\tstatic func newestIn(list: [Date]) -> Date? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.max(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components defined by a function and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: increment function. It get the last generated date and require a valida `DateComponents` instance which define the increment\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: Date, to endDate: Date, increment: ((Date) -> (DateComponents))) -> [Date] {\n\t\tvar dates: [Date] = []\n\t\tvar currentDate = startDate\n\n\t\twhile currentDate <= endDate {\n\t\t\tdates.append(currentDate)\n\t\t\tcurrentDate = (currentDate + increment(currentDate))\n\t\t}\n\t\treturn dates\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: components to add\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: Date, to endDate: Date, increment: DateComponents) -> [Date] {\n\t\treturn Date.enumerateDates(from: startDate, to: endDate, increment: { _ in\n\t\t\treturn increment\n\t\t})\n\t}\n\n\t/// Round a given date time to the passed style (off|up|down).\n\t///\n\t/// - Parameter style: rounding mode.\n\t/// - Returns: rounded date\n\tfunc dateRoundedAt(at style: RoundDateMode) -> Date {\n\t\treturn inDefaultRegion().dateRoundedAt(style).date\n\t}\n\n\t/// Returns a new DateInRegion that is initialized at the start of a specified unit of time.\n\t///\n\t/// - Parameter unit: time unit value.\n\t/// - Returns: instance at the beginning of the time unit; `self` if fails.\n\tfunc dateAtStartOf(_ unit: Calendar.Component) -> Date {\n\t\treturn inDefaultRegion().dateAtStartOf(unit).date\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the start of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the beginning of the passed components, intermediate results if fails.\n\tfunc dateAtStartOf(_ units: [Calendar.Component]) -> Date {\n\t\treturn units.reduce(self) { (currentDate, currentUnit) -> Date in\n\t\t\treturn currentDate.dateAtStartOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Returns a new Moment that is initialized at the end of a specified unit of time.\n\t///\n\t/// - parameter unit: A TimeUnit value.\n\t///\n\t/// - returns: A new Moment instance.\n\tfunc dateAtEndOf(_ unit: Calendar.Component) -> Date {\n\t\treturn inDefaultRegion().dateAtEndOf(unit).date\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the end of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the end of the passed components, intermediate results if fails.\n\tfunc dateAtEndOf(_ units: [Calendar.Component]) -> Date {\n\t\treturn units.reduce(self) { (currentDate, currentUnit) -> Date in\n\t\t\treturn currentDate.dateAtEndOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Create a new date by altering specified components of the receiver.\n\t///\n\t/// - Parameter components: components to alter with their new values.\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(_ components: [Calendar.Component: Int]) -> Date? {\n\t\treturn DateInRegion(self, region: SwiftDate.defaultRegion).dateBySet(components)?.date\n\t}\n\n\t/// Create a new date by altering specified time components.\n\t///\n\t/// - Parameters:\n\t///   - hour: hour to set (`nil` to leave it unaltered)\n\t///   - min: min to set (`nil` to leave it unaltered)\n\t///   - secs: sec to set (`nil` to leave it unaltered)\n\t///   - ms: milliseconds to set (`nil` to leave it unaltered)\n\t///   - options: options for calculation\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(hour: Int?, min: Int?, secs: Int?, ms: Int? = nil, options: TimeCalculationOptions = TimeCalculationOptions()) -> Date? {\n\t\tlet srcDate = DateInRegion(self, region: SwiftDate.defaultRegion)\n\t\treturn srcDate.dateBySet(hour: hour, min: min, secs: secs, ms: ms, options: options)?.date\n\t}\n\n\t/// Creates a new instance by truncating the components\n\t///\n\t/// - Parameter components: components to truncate.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(_ components: [Calendar.Component]) -> Date? {\n\t\treturn DateInRegion(self, region: SwiftDate.defaultRegion).dateTruncated(at: components)?.date\n\t}\n\n\t/// Creates a new instance by truncating the components starting from given components down the granurality.\n\t///\n\t/// - Parameter component: The component to be truncated from.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(from component: Calendar.Component) -> Date? {\n\t\treturn DateInRegion(self, region: SwiftDate.defaultRegion).dateTruncated(from: component)?.date\n\t}\n\n\t/// Offset a date by n calendar components.\n\t/// Note: This operation can be functionally chained.\n\t///\n\t/// - Parameters:\n\t///   - count: value of the offset.\n\t///   - component: component to offset.\n\t/// - Returns: new altered date.\n\tfunc dateByAdding(_ count: Int, _ component: Calendar.Component) -> DateInRegion {\n\t\treturn DateInRegion(self, region: SwiftDate.defaultRegion).dateByAdding(count, component)\n\t}\n\n\t/// Return related date starting from the receiver attributes.\n\t///\n\t/// - Parameter type: related date to obtain.\n\t/// - Returns: instance of the related date.\n\tfunc dateAt(_ type: DateRelatedType) -> Date {\n\t\treturn inDefaultRegion().dateAt(type).date\n\t}\n\n\t/// Create a new date at now and extract the related date using passed rule type.\n\t///\n\t/// - Parameter type: related date to obtain.\n\t/// - Returns: instance of the related date.\n\tstatic func nowAt(_ type: DateRelatedType) -> Date {\n\t\treturn Date().dateAt(type)\n\t}\n\n\t/// Return the dates for a specific weekday inside given month of specified year.\n\t/// Ie. get me all the saturdays of Feb 2018.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - month: month target.\n\t///   - year: year target.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday into given month.\n\tstatic func datesForWeekday(_ weekday: WeekDay, inMonth month: Int, ofYear year: Int,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [Date] {\n\t\tlet fromDate = DateInRegion(Date(year: year, month: month, day: 1, hour: 0, minute: 0), region: region)\n\t\tlet toDate = fromDate.dateAt(.endOfMonth)\n\t\treturn DateInRegion.datesForWeekday(weekday, from: fromDate, to: toDate, region: region).map { $0.date }\n\t}\n\n\t/// Return the dates for a specific weekday inside a specified date range.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - startDate: from date of the range.\n\t///   - endDate: to date of the range.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday in passed range.\n\tstatic func datesForWeekday(_ weekday: WeekDay, from startDate: Date, to endDate: Date,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [Date] {\n\t\tlet fromDate = DateInRegion(startDate, region: region)\n\t\tlet toDate = DateInRegion(endDate, region: region)\n\t\treturn DateInRegion.datesForWeekday(weekday, from: fromDate, to: toDate, region: region).map { $0.date }\n\t}\n\n    /// Returns the date at the given week number and week day preserving smaller components (hour, minute, seconds)\n    ///\n    /// For example: to get the third friday of next month\n    ///         let today = DateInRegion()\n    ///         let result = today.dateAt(weekdayOrdinal: 3, weekday: .friday, monthNumber: today.month + 1)\n    ///\n    /// - Parameters:\n    ///     - weekdayOrdinal: the week number (by set position in a recurrence rule)\n    ///     - weekday: WeekDay\n    ///     - monthNumber: a number from 1 to 12 representing the month, optional parameter\n    ///     - yearNumber: a number representing the year, optional parameter\n    /// - Returns: new date created with the given parameters\n    func dateAt(weekdayOrdinal: Int, weekday: WeekDay, monthNumber: Int? = nil,\n                yearNumber: Int? = nil) -> Date {\n        let date = DateInRegion(self, region: region)\n        return date.dateAt(weekdayOrdinal: weekdayOrdinal, weekday: weekday, monthNumber: monthNumber, yearNumber: yearNumber).date\n    }\n\n    /// Returns the next weekday preserving smaller components (hour, minute, seconds)\n    ///\n    /// - Parameters:\n    ///   - weekday: weekday to get.\n    ///   - region: region target, omit to use `SwiftDate.defaultRegion`\n    /// - Returns: `Date`\n    func nextWeekday(_ weekday: WeekDay, region: Region = SwiftDate.defaultRegion) -> Date {\n        let date = DateInRegion(self, region: region)\n        return date.nextWeekday(weekday).date\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Date/Date+Math.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Subtracts two dates and returns the relative components from `lhs` to `rhs`.\n/// Follows this mathematical pattern:\n///     let difference = lhs - rhs\n///     rhs + difference = lhs\npublic func - (lhs: Date, rhs: Date) -> DateComponents {\n\treturn SwiftDate.defaultRegion.calendar.dateComponents(DateComponents.allComponentsSet, from: rhs, to: lhs)\n}\n\n/// Adds date components to a date and returns a new date.\npublic func + (lhs: Date, rhs: DateComponents) -> Date {\n\treturn rhs.from(lhs)!\n}\n\n/// Adds date components to a date and returns a new date.\npublic func + (lhs: DateComponents, rhs: Date) -> Date {\n\treturn (rhs + lhs)\n}\n\n/// Subtracts date components from a date and returns a new date.\npublic func - (lhs: Date, rhs: DateComponents) -> Date {\n\treturn (lhs + (-rhs))\n}\n\npublic func + (lhs: Date, rhs: TimeInterval) -> Date {\n\treturn lhs.addingTimeInterval(rhs)\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Date/Date.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n#if os(Linux)\n\n#else\ninternal enum AssociatedKeys: String {\n\tcase customDateFormatter = \"SwiftDate.CustomDateFormatter\"\n}\n#endif\n\nextension Date: DateRepresentable {\n\n\t/// Just return itself to be compliant with `DateRepresentable` protocol.\n\tpublic var date: Date { return self }\n\n\t/// For absolute Date object the default region is obtained from the global `defaultRegion` variable.\n\tpublic var region: Region {\n\t\treturn SwiftDate.defaultRegion\n\t}\n\n\t#if os(Linux)\n\tpublic var customFormatter: DateFormatter? {\n\t\tget {\n\t\t\tdebugPrint(\"Not supported on Linux\")\n\t\t\treturn nil\n\t\t}\n\t\tset { debugPrint(\"Not supported on Linux\") }\n\t}\n\t#else\n\t/// Assign a custom formatter if you need a special behaviour during formatting of the object.\n\t/// Usually you will not need to do it, SwiftDate uses the local thread date formatter in order to\n\t/// optimize the formatting process. By default is `nil`.\n\tpublic var customFormatter: DateFormatter? {\n\t\tget {\n\t\t\tlet formatter: DateFormatter? = getAssociatedValue(key: AssociatedKeys.customDateFormatter.rawValue, object: self as AnyObject)\n\t\t\treturn formatter\n\t\t}\n\t\tset {\n\t\t\tset(associatedValue: newValue, key: AssociatedKeys.customDateFormatter.rawValue, object: self as AnyObject)\n\t\t}\n\t}\n\t#endif\n\n\t/// Extract the date components.\n\tpublic var dateComponents: DateComponents {\n\t\treturn region.calendar.dateComponents(DateComponents.allComponentsSet, from: self)\n\t}\n\n\t/// Initialize a new date object from string expressed in given region.\n\t///\n\t/// - Parameters:\n\t///   - string: date expressed as string.\n\t///   - format: format of the date (`nil` uses provided list of auto formats patterns.\n\t///\t\t\t\tPass it if you can in order to optimize the parse task).\n\t///   - region: region in which the date is expressed. `nil` uses the `SwiftDate.defaultRegion`.\n\tpublic init?(_ string: String, format: String? = nil, region: Region = SwiftDate.defaultRegion) {\n\t\tguard let dateInRegion = DateInRegion(string, format: format, region: region) else { return nil }\n\t\tself = dateInRegion.date\n\t}\n\n\t/// Initialize a new date from the number of seconds passed since Unix Epoch.\n\t///\n\t/// - Parameter interval: seconds\n\n\t/// Initialize a new date from the number of seconds passed since Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds from Unix epoch time.\n\t///   - region: region in which the date, `nil` uses the default region at UTC timezone\n\tpublic init(seconds interval: TimeInterval, region: Region = Region.UTC) {\n\t\tself = DateInRegion(seconds: interval, region: region).date\n\t}\n\n\t/// Initialize a new date corresponding to the number of milliseconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed, `nil` uses the default region at UTC timezone\n\tpublic init(milliseconds interval: Int, region: Region = Region.UTC) {\n\t\tself = DateInRegion(milliseconds: interval, region: region).date\n\t}\n\n\t/// Initialize a new date with the opportunity to configure single date components via builder pattern.\n\t/// Date is therfore expressed in passed region (`DateComponents`'s `timezone`,`calendar` and `locale` are ignored\n\t/// and overwritten by the region if not `nil`).\n\t///\n\t/// - Parameters:\n\t///   - configuration: configuration callback\n\t///   - region: region in which the date is expressed. Ignore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components configuration: ((inout DateComponents) -> Void), region: Region? = SwiftDate.defaultRegion) {\n\t\tguard let date = DateInRegion(components: configuration, region: region)?.date else { return nil }\n\t\tself = date\n\t}\n\n\t/// Initialize a new date with given components.\n\t///\n\t/// - Parameters:\n\t///   - components: components of the date.\n\t///   - region: region in which the date is expressed.\n\t///\t\t\t\tIgnore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components: DateComponents, region: Region?) {\n\t\tguard let date = DateInRegion(components: components, region: region)?.date else { return nil }\n\t\tself = date\n\t}\n\n\t/// Initialize a new date with given components.\n\tpublic init(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0, region: Region = SwiftDate.defaultRegion) {\n\t\tvar components = DateComponents()\n\t\tcomponents.year = year\n\t\tcomponents.month = month\n\t\tcomponents.day = day\n\t\tcomponents.hour = hour\n\t\tcomponents.minute = minute\n\t\tcomponents.second = second\n\t\tcomponents.nanosecond = nanosecond\n\t\tcomponents.timeZone = region.timeZone\n\t\tcomponents.calendar = region.calendar\n\t\tself = region.calendar.date(from: components)!\n\t}\n\n\t/// Express given absolute date in the context of the default region.\n\t///\n\t/// - Returns: `DateInRegion`\n\tpublic func inDefaultRegion() -> DateInRegion {\n\t\treturn DateInRegion(self, region: SwiftDate.defaultRegion)\n\t}\n\n\t/// Express given absolute date in the context of passed region.\n\t///\n\t/// - Parameter region: destination region.\n\t/// - Returns: `DateInRegion`\n\tpublic func `in`(region: Region) -> DateInRegion {\n\t\treturn DateInRegion(self, region: region)\n\t}\n\n\t/// Return a date in the distant past.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func past() -> Date {\n\t\treturn Date.distantPast\n\t}\n\n\t/// Return a date in the distant future.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func future() -> Date {\n\t\treturn Date.distantFuture\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Compare.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Comparing DateInRegion\n\npublic func == (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n\treturn (lhs.date.timeIntervalSince1970 == rhs.date.timeIntervalSince1970)\n}\n\npublic func <= (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n\tlet result = lhs.date.compare(rhs.date)\n\treturn (result == .orderedAscending || result == .orderedSame)\n}\n\npublic func >= (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n\tlet result = lhs.date.compare(rhs.date)\n\treturn (result == .orderedDescending || result == .orderedSame)\n}\n\npublic func < (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n\treturn lhs.date.compare(rhs.date) == .orderedAscending\n}\n\npublic func > (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n\treturn lhs.date.compare(rhs.date) == .orderedDescending\n}\n\n// The type of comparison to do against today's date or with the suplied date.\n///\n/// - isToday: hecks if date today.\n/// - isTomorrow: Checks if date is tomorrow.\n/// - isYesterday: Checks if date is yesterday.\n/// - isSameDay: Compares date days\n/// - isThisWeek: Checks if date is in this week.\n/// - isNextWeek: Checks if date is in next week.\n/// - isLastWeek: Checks if date is in last week.\n/// - isSameWeek: Compares date weeks\n/// - isThisMonth: Checks if date is in this month.\n/// - isNextMonth: Checks if date is in next month.\n/// - isLastMonth: Checks if date is in last month.\n/// - isSameMonth: Compares date months\n/// - isThisYear: Checks if date is in this year.\n/// - isNextYear: Checks if date is in next year.\n/// - isLastYear: Checks if date is in last year.\n/// - isSameYear: Compare date years\n/// - isInTheFuture: Checks if it's a future date\n/// - isInThePast: Checks if the date has passed\n/// - isEarlier: Checks if earlier than date\n/// - isLater: Checks if later than date\n/// - isWeekday: Checks if it's a weekday\n/// - isWeekend: Checks if it's a weekend\n/// - isInDST: Indicates whether the represented date uses daylight saving time.\n/// - isMorning: Return true if date is in the morning (>=5 - <12)\n/// - isAfternoon: Return true if date is in the afternoon (>=12 - <17)\n/// - isEvening: Return true if date is in the morning (>=17 - <21)\n/// - isNight: Return true if date is in the morning (>=21 - <5)\npublic enum DateComparisonType {\n\n\t// Days\n\tcase isToday\n\tcase isTomorrow\n\tcase isYesterday\n\tcase isSameDay(_ : DateRepresentable)\n\n\t// Weeks\n\tcase isThisWeek\n\tcase isNextWeek\n\tcase isLastWeek\n\tcase isSameWeek(_: DateRepresentable)\n\n\t// Months\n\tcase isThisMonth\n\tcase isNextMonth\n\tcase isLastMonth\n\tcase isSameMonth(_: DateRepresentable)\n\n\t// Years\n\tcase isThisYear\n\tcase isNextYear\n\tcase isLastYear\n\tcase isSameYear(_: DateRepresentable)\n\n\t// Relative Time\n\tcase isInTheFuture\n\tcase isInThePast\n\tcase isEarlier(than: DateRepresentable)\n\tcase isLater(than: DateRepresentable)\n\tcase isWeekday\n\tcase isWeekend\n\n\t// Day time\n\tcase isMorning\n\tcase isAfternoon\n\tcase isEvening\n\tcase isNight\n\n\t// TZ\n\tcase isInDST\n}\n\npublic extension DateInRegion {\n\n\t/// Decides whether a DATE is \"close by\" another one passed in parameter,\n\t/// where \"Being close\" is measured using a precision argument\n\t/// which is initialized a 300 seconds, or 5 minutes.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date compare against to.\n\t///   - precision: The precision of the comparison (default is 5 minutes, or 300 seconds).\n\t/// - Returns: A boolean; true if close by, false otherwise.\n\tfunc compareCloseTo(_ refDate: DateInRegion, precision: TimeInterval = 300) -> Bool {\n\t\treturn (abs(date.timeIntervalSince(refDate.date)) <= precision)\n\t}\n\n\t/// Compare the date with the rule specified in the `compareType` parameter.\n\t///\n\t/// - Parameter compareType: comparison type.\n\t/// - Returns: `true` if comparison succeded, `false` otherwise\n\tfunc compare(_ compareType: DateComparisonType) -> Bool {\n\t\tswitch compareType {\n\t\tcase .isToday:\n\t\t\treturn compare(.isSameDay(region.nowInThisRegion()))\n\n\t\tcase .isTomorrow:\n\t\t\tlet tomorrow = DateInRegion(region: region).dateByAdding(1, .day)\n\t\t\treturn compare(.isSameDay(tomorrow))\n\n\t\tcase .isYesterday:\n\t\t\tlet yesterday = DateInRegion(region: region).dateByAdding(-1, .day)\n\t\t\treturn compare(.isSameDay(yesterday))\n\n\t\tcase .isSameDay(let refDate):\n\t\t\treturn calendar.isDate(date, inSameDayAs: refDate.date)\n\n\t\tcase .isThisWeek:\n\t\t\treturn compare(.isSameWeek(region.nowInThisRegion()))\n\n\t\tcase .isNextWeek:\n\t\t\tlet nextWeek = region.nowInThisRegion().dateByAdding(1, .weekOfYear)\n\t\t\treturn compare(.isSameWeek(nextWeek))\n\n\t\tcase .isLastWeek:\n\t\t\tlet lastWeek = region.nowInThisRegion().dateByAdding(-1, .weekOfYear)\n\t\t\treturn compare(.isSameWeek(lastWeek))\n\n\t\tcase .isSameWeek(let refDate):\n\t\t\tguard weekOfYear == refDate.weekOfYear else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t// Ensure time interval is under 1 week\n\t\t\treturn (abs(date.timeIntervalSince(refDate.date)) < 1.weeks.timeInterval)\n\n\t\tcase .isThisMonth:\n\t\t\treturn compare(.isSameMonth(region.nowInThisRegion()))\n\n\t\tcase .isNextMonth:\n\t\t\tlet nextMonth = region.nowInThisRegion().dateByAdding(1, .month)\n\t\t\treturn compare(.isSameMonth(nextMonth))\n\n\t\tcase .isLastMonth:\n\t\t\tlet lastMonth = region.nowInThisRegion().dateByAdding(-1, .month)\n\t\t\treturn compare(.isSameMonth(lastMonth))\n\n\t\tcase .isSameMonth(let refDate):\n\t\t\treturn (year == refDate.year) && (month == refDate.month)\n\n\t\tcase .isThisYear:\n\t\t\treturn compare(.isSameYear(region.nowInThisRegion()))\n\n\t\tcase .isNextYear:\n\t\t\tlet nextYear = region.nowInThisRegion().dateByAdding(1, .year)\n\t\t\treturn compare(.isSameYear(nextYear))\n\n\t\tcase .isLastYear:\n\t\t\tlet lastYear = region.nowInThisRegion().dateByAdding(-1, .year)\n\t\t\treturn compare(.isSameYear(lastYear))\n\n\t\tcase .isSameYear(let refDate):\n\t\t\treturn (year == refDate.year)\n\n\t\tcase .isInTheFuture:\n\t\t\treturn compare(.isLater(than: region.nowInThisRegion()))\n\n\t\tcase .isInThePast:\n\t\t\treturn compare(.isEarlier(than: region.nowInThisRegion()))\n\n\t\tcase .isEarlier(let refDate):\n\t\t\treturn ((date as NSDate).earlierDate(refDate.date) == date)\n\n\t\tcase .isLater(let refDate):\n\t\t\treturn ((date as NSDate).laterDate(refDate.date) == date)\n\n\t\tcase .isWeekday:\n\t\t\treturn !compare(.isWeekend)\n\n\t\tcase .isWeekend:\n\t\t\tlet range = calendar.maximumRange(of: Calendar.Component.weekday)!\n\t\t\treturn (weekday == range.lowerBound || weekday == range.upperBound - range.lowerBound)\n\n\t\tcase .isInDST:\n\t\t\treturn region.timeZone.isDaylightSavingTime(for: date)\n\n\t\tcase .isMorning:\n\t\t\treturn (hour >= 5 && hour < 12)\n\n\t\tcase .isAfternoon:\n\t\t\treturn (hour >= 12 && hour < 17)\n\n\t\tcase .isEvening:\n\t\t\treturn (hour >= 17 && hour < 21)\n\n\t\tcase .isNight:\n\t\t\treturn (hour >= 21 || hour < 5)\n\n\t\t}\n\t}\n\n\t/// Returns a ComparisonResult value that indicates the ordering of two given dates based on\n\t/// their components down to a given unit granularity.\n\t///\n\t/// - parameter date:        date to compare.\n\t/// - parameter granularity: The smallest unit that must, along with all larger units\n\t/// - returns: `ComparisonResult`\n\tfunc compare(toDate refDate: DateInRegion, granularity: Calendar.Component) -> ComparisonResult {\n\t\tswitch granularity {\n\t\tcase .nanosecond:\n\t\t\t// There is a possible rounding error using Calendar to compare two dates below the minute granularity\n\t\t\t// So we've added this trick and use standard Date compare which return correct results in this case\n\t\t\t// https://github.com/malcommac/SwiftDate/issues/346\n\t\t\treturn date.compare(refDate.date)\n\t\tdefault:\n\t\t\treturn region.calendar.compare(date, to: refDate.date, toGranularity: granularity)\n\t\t}\n\t}\n\n\t/// Compares whether the receiver is before/before equal `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: smallest unit that must, along with all larger units, be less for the given dates\n\t/// - Returns: Boolean\n\tfunc isBeforeDate(_ date: DateInRegion, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n\t\tlet result = compare(toDate: date, granularity: granularity)\n\t\treturn (orEqual ? (result == .orderedSame || result == .orderedAscending) : result == .orderedAscending)\n\t}\n\n\t/// Compares whether the receiver is after `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: Smallest unit that must, along with all larger units, be greater for the given dates.\n\t/// - Returns: Boolean\n\tfunc isAfterDate(_ refDate: DateInRegion, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n\t\tlet result = compare(toDate: refDate, granularity: granularity)\n\t\treturn (orEqual ? (result == .orderedSame || result == .orderedDescending) : result == .orderedDescending)\n\t}\n\n\t/// Compares equality of two given dates based on their components down to a given unit\n\t/// granularity.\n\t///\n\t/// - parameter date:        date to compare\n\t/// - parameter granularity: The smallest unit that must, along with all larger units, be equal for the given\n\t///         dates to be considered the same.\n\t///\n\t/// - returns: `true` if the dates are the same down to the given granularity, otherwise `false`\n\tfunc isInside(date: DateInRegion, granularity: Calendar.Component) -> Bool {\n\t\treturn (compare(toDate: date, granularity: granularity) == .orderedSame)\n\t}\n\n\t/// Returns a value between 0.0 and 1.0 or nil, that is the position of current date between 2 other dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t/// - Returns: `nil` if current date is not between `startDate` and `endDate`. Otherwise returns position between `startDate` and `endDate`.\n\tfunc positionInRange(date startDate: DateInRegion, and endDate: DateInRegion) -> Double? {\n\t\tlet diffCurrentDateAndStartDate = self - startDate\n\t\tguard diffCurrentDateAndStartDate >= 0 else {\n\t\t\treturn nil\n\t\t}\n\t\tlet diffEndDateAndStartDate = endDate - startDate\n\t\tguard diffEndDateAndStartDate > 0, diffCurrentDateAndStartDate <= diffEndDateAndStartDate else {\n\t\t\treturn nil\n\t\t}\n\t\treturn diffCurrentDateAndStartDate / diffEndDateAndStartDate\n\t}\n\n\t/// Return `true` if receiver data is contained in the range specified by two dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t///   - orEqual: `true` to also check for equality on date and date2, default is `true`\n\t///   - granularity: smallest unit that must, along with all larger units, be greater\n\t/// - Returns: Boolean\n\tfunc isInRange(date startDate: DateInRegion, and endDate: DateInRegion, orEqual: Bool = true, granularity: Calendar.Component = .nanosecond) -> Bool {\n\t\treturn isAfterDate(startDate, orEqual: orEqual, granularity: granularity) && isBeforeDate(endDate, orEqual: orEqual, granularity: granularity)\n\t}\n\n\t// MARK: - Date Earlier/Later\n\n\t/// Return the earlier of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is earlier\n\tfunc earlierDate(_ date: DateInRegion) -> DateInRegion {\n\t\treturn self.date.timeIntervalSince(date.date) <= 0 ? self : date\n\t}\n\n\t/// Return the later of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is later\n\tfunc laterDate(_ date: DateInRegion) -> DateInRegion {\n\t\treturn self.date.timeIntervalSince(date.date) >= 0 ? self : date\n\t}\n\n    /// Returns the difference in the calendar component given (like day, month or year)\n    /// with respect to the other date as a positive integer\n    func difference(in component: Calendar.Component, from other: DateInRegion) -> Int? {\n        return self.date.difference(in: component, from: other.date)\n    }\n\n    /// Returns the differences in the calendar components given (like day, month and year)\n    /// with respect to the other date as dictionary with the calendar component as the key\n    /// and the diffrence as a positive integer as the value\n    func differences(in components: Set<Calendar.Component>, from other: DateInRegion) -> [Calendar.Component: Int] {\n        return self.date.differences(in: components, from: other.date)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Components.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension DateInRegion {\n\n\t/// Indicates whether the month is a leap month.\n\tvar isLeapMonth: Bool {\n\t\tlet calendar = region.calendar\n\t\t// Library function for leap contains a bug for Gregorian calendars, implemented workaround\n\t\tif calendar.identifier == Calendar.Identifier.gregorian && year > 1582 {\n\t\t\tguard let range: Range<Int> = calendar.range(of: .day, in: .month, for: date) else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn ((range.upperBound - range.lowerBound) == 29)\n\t\t}\n\t\t// For other calendars:\n\t\treturn calendar.dateComponents([.day, .month, .year], from: date).isLeapMonth!\n\t}\n\n\t/// Indicates whether the year is a leap year.\n\tvar isLeapYear: Bool {\n\t\tlet calendar = region.calendar\n\t\t// Library function for leap contains a bug for Gregorian calendars, implemented workaround\n\t\tif calendar.identifier == Calendar.Identifier.gregorian {\n\t\t\tvar newComponents = dateComponents\n\t\t\tnewComponents.month = 2\n\t\t\tnewComponents.day = 10\n\t\t\tlet testDate = DateInRegion(components: newComponents, region: region)\n\t\t\treturn testDate!.isLeapMonth\n\t\t} else if calendar.identifier == Calendar.Identifier.chinese {\n\t\t\t/// There are 12 or 13 months in each year and 29 or 30 days in each month.\n\t\t\t/// A 13-month year is a leap year, which meaning more than 376 days is a leap year.\n\t\t\treturn ( dateAtStartOf(.year).toUnit(.day, to: dateAtEndOf(.year)) > 375 )\n\t\t}\n\t\t// For other calendars:\n\t\treturn calendar.dateComponents([.day, .month, .year], from: date).isLeapMonth!\n\t}\n\n\t/// Julian day is the continuous count of days since the beginning of\n\t/// the Julian Period used primarily by astronomers.\n\tvar julianDay: Double {\n\t\tlet destRegion = Region(calendar: Calendars.gregorian, zone: Zones.gmt, locale: Locales.english)\n\t\tlet utc = convertTo(region: destRegion)\n\n\t\tlet year = Double(utc.year)\n\t\tlet month = Double(utc.month)\n\t\tlet day = Double(utc.day)\n\t\tlet hour = Double(utc.hour) + Double(utc.minute) / 60.0 + (Double(utc.second) + Double(utc.nanosecond) / 1e9) / 3600.0\n\n\t\tvar jd = 367.0 * year - floor( 7.0 * ( year + floor((month + 9.0) / 12.0)) / 4.0 )\n\t\tjd -= floor( 3.0 * (floor( (year + (month - 9.0) / 7.0) / 100.0 ) + 1.0) / 4.0 )\n\t\tjd += floor(275.0 * month / 9.0) + day + 1_721_028.5 + hour / 24.0\n\n\t\treturn jd\n\t}\n\n\t/// The Modified Julian Date (MJD) was introduced by the Smithsonian Astrophysical Observatory\n\t/// in 1957 to record the orbit of Sputnik via an IBM 704 (36-bit machine)\n\t/// and using only 18 bits until August 7, 2576.\n\tvar modifiedJulianDay: Double {\n\t\treturn julianDay - 2_400_000.5\n\t}\n\n\t/// Return elapsed time expressed in given components since the current receiver and a reference date.\n\t/// Time is evaluated with the fixed measumerent of each unity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date (`nil` to use current date in the same region of the receiver)\n\t///   - component: time unit to extract.\n\t/// - Returns: value\n\tfunc getInterval(toDate: DateInRegion?, component: Calendar.Component) -> Int64 {\n\t\tlet refDate = (toDate ?? region.nowInThisRegion())\n\t\tswitch component {\n\t\tcase .year:\n\t\t\tlet end = calendar.ordinality(of: .year, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .year, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .month:\n\t\t\tlet end = calendar.ordinality(of: .month, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .month, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .day:\n\t\t\tlet end = calendar.ordinality(of: .day, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .day, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .hour:\n\t\t\tlet interval = refDate.date.timeIntervalSince(date)\n\t\t\treturn Int64(interval / 1.hours.timeInterval)\n\n\t\tcase .minute:\n\t\t\tlet interval = refDate.date.timeIntervalSince(date)\n\t\t\treturn Int64(interval / 1.minutes.timeInterval)\n\n\t\tcase .second:\n\t\t\treturn Int64(refDate.date.timeIntervalSince(date))\n\n\t\tcase .weekday:\n\t\t\tlet end = calendar.ordinality(of: .weekday, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .weekday, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .weekdayOrdinal:\n\t\t\tlet end = calendar.ordinality(of: .weekdayOrdinal, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .weekdayOrdinal, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .weekOfYear:\n\t\t\tlet end = calendar.ordinality(of: .weekOfYear, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .weekOfYear, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tdefault:\n\t\t\tdebugPrint(\"Passed component cannot be used to extract values using interval() function between two dates. Returning 0.\")\n\t\t\treturn 0\n\t\t}\n\t}\n\n\t/// The interval between the receiver and the another parameter.\n\t/// If the receiver is earlier than anotherDate, the return value is negative.\n\t/// If anotherDate is nil, the results are undefined.\n\t///\n\t/// - Parameter date: The date with which to compare the receiver.\n\t/// - Returns: time interval between two dates\n\tfunc timeIntervalSince(_ date: DateInRegion) -> TimeInterval {\n\t\treturn self.date.timeIntervalSince(date.date)\n\t}\n\n\t/// Extract DateComponents from the difference between two dates.\n\t///\n\t/// - Parameter rhs: date to compare\n\t/// - Returns: components\n\tfunc componentsTo(_ rhs: DateInRegion) -> DateComponents {\n\t\treturn calendar.dateComponents(DateComponents.allComponentsSet, from: rhs.date, to: date)\n\t}\n\n\t/// Returns the difference between two dates (`date - self`) expressed as date components.\n\t///\n\t/// - Parameters:\n\t///   - date: reference date as initial date (left operand)\n\t///   - components: components to extract, `nil` to use default `DateComponents.allComponentsSet`\n\t/// - Returns: extracted date components\n\tfunc componentsSince(_ date: DateInRegion, components: [Calendar.Component]? = nil) -> DateComponents {\n\t\tif date.calendar != calendar {\n\t\t\tdebugPrint(\"Date has different calendar, results maybe wrong\")\n\t\t}\n\t\tlet cmps = (components != nil ? Calendar.Component.toSet(components!) : DateComponents.allComponentsSet)\n\t\treturn date.calendar.dateComponents(cmps, from: date.date, to: self.date)\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Create.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension DateInRegion {\n\n\t// MARK: - Random Date Generator\n\n\t/// Generate a sequence of dates between a range.\n\t///\n\t/// - Parameters:\n\t///   - count: number of dates to generate.\n\t///   - initial: lower date bound.\n\t///   - final: upper date bound.\n\t///   - region: region of the dates.\n\t/// - Returns: array of dates\n\tstatic func randomDates(count: Int, between initial: DateInRegion, and final: DateInRegion,\n\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [DateInRegion] {\n\t\tvar list: [DateInRegion] = []\n\t\tfor _ in 0..<count {\n\t\t\tlist.append(DateInRegion.randomDate(between: initial, and: final, region: region))\n\t\t}\n\t\treturn list\n\t}\n\n\t/// Return a date between now and a specified amount days ealier.\n\t///\n\t/// - Parameters:\n\t///   - days: days range\n\t///   - region: destination region, `nil` to use the default region\n\t/// - Returns: random date\n\tstatic func randomDate(withinDaysBeforeToday days: Int,\n\t\t\t\t\t\t\t\t  region: Region = SwiftDate.defaultRegion) -> DateInRegion {\n\t\tlet today = DateInRegion(region: region)\n\t\tlet earliest = DateInRegion(today.date.addingTimeInterval(TimeInterval(-days * 24 * 60 * 60)), region: region)\n\t\treturn DateInRegion.randomDate(between: earliest, and: today)\n\t}\n\n\t/// Generate a random date in given region.\n\t///\n\t/// - Parameter region: destination region, `nil` to use the default region\n\t/// - Returns: random date\n\tstatic func randomDate(region: Region = SwiftDate.defaultRegion) -> DateInRegion {\n\t\tlet randomTime = TimeInterval(UInt32.random(in: UInt32.min..<UInt32.max))\n\t\tlet absoluteDate = Date(timeIntervalSince1970: randomTime)\n\t\treturn DateInRegion(absoluteDate, region: region)\n\t}\n\n\t/// Generate a random date between two intervals.\n\t///\n\t/// - Parameters:\n\t///   - initial: lower bound date\n\t///   - final: upper bound date\n\t///   - region: destination region, `nil` to use the default region\n\t/// - Returns: random Date\n\tstatic func randomDate(between initial: DateInRegion, and final: DateInRegion,\n\t\t\t\t\t\t\t\t  region: Region = SwiftDate.defaultRegion) -> DateInRegion {\n\t\tlet interval = final.timeIntervalSince(initial)\n\t\tlet randomInterval = TimeInterval(UInt32.random(in: UInt32.min..<UInt32(interval)))\n\t\treturn initial.addingTimeInterval(randomInterval)\n\t}\n\n\t/// Return the oldest date in given list (timezone is ignored, comparison uses absolute date).\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the oldest date and its instance.\n\tstatic func oldestIn(list: [DateInRegion]) -> DateInRegion? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.min(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Sort date by oldest, with the oldest date on top.\n\t///\n\t/// - Parameter list: list to sort\n\t/// - Returns: sorted array\n\tstatic func sortedByOldest(list: [DateInRegion]) -> [DateInRegion] {\n\t\treturn list.sorted(by: { $0.date.compare($1.date) == .orderedAscending })\n\t}\n\n\t/// Sort date by newest, with the newest date on top.\n\t///\n\t/// - Parameter list: list to sort\n\t/// - Returns: sorted array\n\tstatic func sortedByNewest(list: [DateInRegion]) -> [DateInRegion] {\n\t\treturn list.sorted(by: { $0.date.compare($1.date) == .orderedDescending })\n\t}\n\n\t/// Return the newest date in given list (timezone is ignored, comparison uses absolute date).\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the newest date and its instance.\n\tstatic func newestIn(list: [DateInRegion]) -> DateInRegion? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.max(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: components to add\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: DateComponents) -> [DateInRegion] {\n\t\treturn DateInRegion.enumerateDates(from: startDate, to: endDate, increment: { _ in\n\t\t\treturn increment\n\t\t})\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components defined in a closure and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: increment function. It get the last generated date and require a valida `DateComponents` instance which define the increment\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: ((DateInRegion) -> (DateComponents))) -> [DateInRegion] {\n\t\tguard startDate.calendar == endDate.calendar else {\n\t\t\tdebugPrint(\"Cannot enumerate dates between two different region's calendars. Return empty array.\")\n\t\t\treturn []\n\t\t}\n\n\t\tvar dates: [DateInRegion] = []\n\t\tvar currentDate = startDate\n\t\twhile currentDate <= endDate {\n\t\t\tdates.append(currentDate)\n\t\t\tcurrentDate = (currentDate + increment(currentDate))\n\t\t}\n\t\treturn dates\n\t}\n\n\t/// Returns a new DateInRegion that is initialized at the start of a specified unit of time.\n\t///\n\t/// - Parameter unit: time unit value.\n\t/// - Returns: instance at the beginning of the time unit; `self` if fails.\n\tfunc dateAtStartOf(_ unit: Calendar.Component) -> DateInRegion {\n\t\t#if os(Linux)\n\t\tguard let result = (region.calendar as NSCalendar).range(of: unit.nsCalendarUnit, for: date) else {\n\t\t\treturn self\n\t\t}\n\t\treturn DateInRegion(result.start, region: region)\n\t\t#else\n\t\tvar start: NSDate?\n\t\tvar interval: TimeInterval = 0\n\t\tguard (region.calendar as NSCalendar).range(of: unit.nsCalendarUnit, start: &start, interval: &interval, for: date),\n\t\t\tlet startDate = start else {\n\t\t\t\treturn self\n\t\t}\n\t\treturn DateInRegion(startDate as Date, region: region)\n\t\t#endif\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the start of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the beginning of the passed components, intermediate results if fails.\n\tfunc dateAtStartOf(_ units: [Calendar.Component]) -> DateInRegion {\n\t\treturn units.reduce(self) { (currentDate, currentUnit) -> DateInRegion in\n\t\t\treturn currentDate.dateAtStartOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Returns a new Moment that is initialized at the end of a specified unit of time.\n\t///\n\t/// - parameter unit: time unit value.\n\t///\n\t/// - returns: A new Moment instance.\n\tfunc dateAtEndOf(_ unit: Calendar.Component) -> DateInRegion {\n\t\t// RangeOfUnit returns the start of the next unit; we will subtract one thousandth of a second\n\t\t#if os(Linux)\n\t\tguard let result = (region.calendar as NSCalendar).range(of: unit.nsCalendarUnit, for: date) else {\n\t\t\treturn self\n\t\t}\n\t\tlet startOfNextUnit = result.start.addingTimeInterval(result.duration)\n\t\tlet endOfThisUnit = Date(timeInterval: -0.001, since: startOfNextUnit)\n\t\treturn DateInRegion(endOfThisUnit, region: region)\n\t\t#else\n\t\tvar start: NSDate?\n\t\tvar interval: TimeInterval = 0\n\t\tguard (self.region.calendar as NSCalendar).range(of: unit.nsCalendarUnit, start: &start, interval: &interval, for: date),\n\t\tlet startDate = start else {\n\t\t\treturn self\n\t\t}\n\t\tlet startOfNextUnit = startDate.addingTimeInterval(interval)\n\t\tlet endOfThisUnit = Date(timeInterval: -0.001, since: startOfNextUnit as Date)\n\t\treturn DateInRegion(endOfThisUnit, region: region)\n\t\t#endif\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the end of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the end of the passed components, intermediate results if fails.\n\tfunc dateAtEndOf(_ units: [Calendar.Component]) -> DateInRegion {\n\t\treturn units.reduce(self) { (currentDate, currentUnit) -> DateInRegion in\n\t\t\treturn currentDate.dateAtEndOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Create a new date by altering specified components of the receiver.\n\t/// Note: `calendar` and `timezone` are ignored.\n\t/// Note: some components may alter the date cyclically (like setting both `.year` and `.yearForWeekOfYear`) and\n\t/// may results in a wrong evaluated date.\n\t///\n\t/// - Parameter components: components to alter with their new values.\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(_ components: [Calendar.Component: Int?]) -> DateInRegion? {\n\t\tvar dateComponents = DateComponents()\n\t\tdateComponents.year = (components[.year] ?? year)\n\t\tdateComponents.month = (components[.month] ?? month)\n\t\tdateComponents.day = (components[.day] ?? day)\n\t\tdateComponents.hour = (components[.hour] ?? hour)\n\t\tdateComponents.minute = (components[.minute] ?? minute)\n\t\tdateComponents.second = (components[.second] ?? second)\n\t\tdateComponents.nanosecond = (components[.nanosecond] ?? nanosecond)\n\n\t\t// Some components may interfer with others, so we'll set it them only if explicitly set.\n\t\tif let weekday = components[.weekday] {\n\t\t\tdateComponents.weekday = weekday\n\t\t}\n\t\tif let weekOfYear = components[.weekOfYear] {\n\t\t\tdateComponents.weekOfYear = weekOfYear\n\t\t}\n\t\tif let weekdayOrdinal = components[.weekdayOrdinal] {\n\t\t\tdateComponents.weekdayOrdinal = weekdayOrdinal\n\t\t}\n\t\tif let yearForWeekOfYear = components[.yearForWeekOfYear] {\n\t\t\tdateComponents.yearForWeekOfYear = yearForWeekOfYear\n\t\t}\n\n\t\tguard let newDate = calendar.date(from: dateComponents) else { return nil }\n\t\treturn DateInRegion(newDate, region: region)\n\t}\n\n\t/// Create a new date by altering specified time components.\n\t///\n\t/// - Parameters:\n\t///   - hour: hour to set (`nil` to leave it unaltered)\n\t///   - min: min to set (`nil` to leave it unaltered)\n\t///   - secs: sec to set (`nil` to leave it unaltered)\n\t///   - ms: milliseconds to set (`nil` to leave it unaltered)\n\t///   - options: options for calculation\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(hour: Int?, min: Int?, secs: Int?, ms: Int? = nil, options: TimeCalculationOptions = TimeCalculationOptions()) -> DateInRegion? {\n\t\tguard let date = calendar.date(bySettingHour: (hour ?? self.hour),\n\t\t\t\t\t\t\t\t\t\t\tminute: (min ?? self.minute),\n\t\t\t\t\t\t\t\t\t\t\tsecond: (secs ?? self.second),\n\t\t\t\t\t\t\t\t\t\t\tof: self.date,\n\t\t\t\t\t\t\t\t\t\t\tmatchingPolicy: options.matchingPolicy,\n\t\t\t\t\t\t\t\t\t\t\trepeatedTimePolicy: options.repeatedTimePolicy,\n\t\t\t\t\t\t\t\t\t\t\tdirection: options.direction) else { return nil }\n\t\tguard let ms = ms else {\n\t\t\treturn DateInRegion(date, region: region)\n\t\t}\n\t\tvar timestamp = date.timeIntervalSince1970.rounded(.down)\n\t\ttimestamp += Double(ms) / 1000.0\n\t\treturn DateInRegion(Date(timeIntervalSince1970: timestamp), region: region)\n\t}\n\n\t/// Creates a new instance by truncating the components\n\t///\n\t/// - Parameter components: components to truncate.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(at components: [Calendar.Component]) -> DateInRegion? {\n\t\tvar dateComponents = self.dateComponents\n\n\t\tfor component in components {\n\t\t\tswitch component {\n\t\t\tcase .month:\t\tdateComponents.month = 1\n\t\t\tcase .day:\t\t\tdateComponents.day = 1\n\t\t\tcase .hour:\t\t\tdateComponents.hour = 0\n\t\t\tcase .minute:\t\tdateComponents.minute = 0\n\t\t\tcase .second:\t\tdateComponents.second = 0\n\t\t\tcase .nanosecond:\tdateComponents.nanosecond = 0\n\t\t\tdefault:\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tguard let newDate = calendar.date(from: dateComponents) else { return nil }\n\t\treturn DateInRegion(newDate, region: region)\n\t}\n\n\t/// Creates a new instance by truncating the components starting from given components down the granurality.\n\t///\n\t/// - Parameter component: The component to be truncated from.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(from component: Calendar.Component) -> DateInRegion? {\n\t\tswitch component {\n\t\tcase .month:\t\treturn dateTruncated(at: [.month, .day, .hour, .minute, .second, .nanosecond])\n\t\tcase .day:\t\t\treturn dateTruncated(at: [.day, .hour, .minute, .second, .nanosecond])\n\t\tcase .hour:\t\t\treturn dateTruncated(at: [.hour, .minute, .second, .nanosecond])\n\t\tcase .minute:\t\treturn dateTruncated(at: [.minute, .second, .nanosecond])\n\t\tcase .second:\t\treturn dateTruncated(at: [.second, .nanosecond])\n\t\tcase .nanosecond:\treturn dateTruncated(at: [.nanosecond])\n\t\tdefault:\t\t\treturn self\n\t\t}\n\t}\n\n\t/// Round a given date time to the passed style (off|up|down).\n\t///\n\t/// - Parameter style: rounding mode.\n\t/// - Returns: rounded date\n\tfunc dateRoundedAt(_ style: RoundDateMode) -> DateInRegion {\n\t\tswitch style {\n\t\tcase .to5Mins:\t\t\treturn dateRoundedAt(.toMins(5))\n\t\tcase .to10Mins:\t\t\treturn dateRoundedAt(.toMins(10))\n\t\tcase .to30Mins:\t\t\treturn dateRoundedAt(.toMins(30))\n\t\tcase .toCeil5Mins:\t\treturn dateRoundedAt(.toCeilMins(5))\n\t\tcase .toCeil10Mins:\t\treturn dateRoundedAt(.toCeilMins(10))\n\t\tcase .toCeil30Mins:\t\treturn dateRoundedAt(.toCeilMins(30))\n\t\tcase .toFloor5Mins:\t\treturn dateRoundedAt(.toFloorMins(5))\n\t\tcase .toFloor10Mins:\treturn dateRoundedAt(.toFloorMins(10))\n\t\tcase .toFloor30Mins:\treturn dateRoundedAt(.toFloorMins(30))\n\n\t\tcase .toMins(let minuteInterval):\n\t\t\tlet onesDigit: Int = (minute % 10)\n\t\t\tif onesDigit < 5 {\n\t\t\t\treturn dateRoundedAt(.toFloorMins(minuteInterval))\n\t\t\t} else {\n\t\t\t\treturn dateRoundedAt(.toCeilMins(minuteInterval))\n\t\t\t}\n\n\t\tcase .toCeilMins(let minuteInterval):\n\t\t\tlet remain: Int = (minute % minuteInterval)\n\t\t\tlet value = (( Int(1.minutes.timeInterval) * (minuteInterval - remain)) - second)\n\t\t\treturn dateByAdding(value, .second)\n\n\t\tcase .toFloorMins(let minuteInterval):\n\t\t\tlet remain: Int = (minute % minuteInterval)\n\t\t\tlet value = -((Int(1.minutes.timeInterval) * remain) + second)\n\t\t\treturn dateByAdding(value, .second)\n\n\t\t}\n\t}\n\n\t/// Offset a date by n calendar components.\n\t/// Note: This operation can be functionally chained.\n\t///\n\t/// - Parameters:\n\t///   - count: value of the offset (maybe negative).\n\t///   - component: component to offset.\n\t/// - Returns: new altered date.\n\tfunc dateByAdding(_ count: Int, _ component: Calendar.Component) -> DateInRegion {\n\t\tvar newComponent = DateComponents(second: 0)\n\t\tswitch component {\n\t\tcase .era: \t\t\t\t\tnewComponent = DateComponents(era: count)\n\t\tcase .year: \t\t\t\tnewComponent = DateComponents(year: count)\n\t\tcase .month: \t\t\t\tnewComponent = DateComponents(month: count)\n\t\tcase .day: \t\t\t\t\tnewComponent = DateComponents(day: count)\n\t\tcase .hour: \t\t\t\tnewComponent = DateComponents(hour: count)\n\t\tcase .minute: \t\t\t\tnewComponent = DateComponents(minute: count)\n\t\tcase .second:\t\t\t\tnewComponent = DateComponents(second: count)\n\t\tcase .weekday:\t\t\t\tnewComponent = DateComponents(weekday: count)\n\t\tcase .weekdayOrdinal: \t\tnewComponent = DateComponents(weekdayOrdinal: count)\n\t\tcase .quarter: \t\t\t\tnewComponent = DateComponents(quarter: count)\n\t\tcase .weekOfMonth: \t\t\tnewComponent = DateComponents(weekOfMonth: count)\n\t\tcase .weekOfYear: \t\t\tnewComponent = DateComponents(weekOfYear: count)\n\t\tcase .yearForWeekOfYear: \tnewComponent = DateComponents(yearForWeekOfYear: count)\n\t\tcase .nanosecond: \t\t\tnewComponent = DateComponents(nanosecond: count)\n\t\tdefault: break // .calendar and .timezone does nothing in this context\n\t\t}\n\n\t\tguard let newDate = region.calendar.date(byAdding: newComponent, to: date) else {\n\t\t\treturn self // failed to add component, return unmodified date\n\t\t}\n\t\treturn DateInRegion(newDate, region: region)\n\t}\n\n\t/// Return related date starting from the receiver attributes.\n\t///\n\t/// - Parameter type: related date to obtain.\n\t/// - Returns: instance of the related date; if fails the same unmodified date is returned\n\tfunc dateAt(_ type: DateRelatedType) -> DateInRegion {\n\t\tswitch type {\n\t\tcase .startOfDay:\n\t\t\treturn calendar.startOfDay(for: date).in(region: region)\n\t\tcase .endOfDay:\n\t\t\treturn dateByAdding(1, .day).dateAt(.startOfDay).dateByAdding(-1, .second)\n\t\tcase .startOfWeek:\n\t\t\tlet components = calendar.dateComponents([.yearForWeekOfYear, .weekOfYear], from: date)\n\t\t\treturn calendar.date(from: components)!.in(region: region)\n\t\tcase .endOfWeek:\n\t\t\treturn dateAt(.startOfWeek).dateByAdding(7, .day).dateByAdding(-1, .second)\n\t\tcase .startOfMonth:\n\t\t\treturn dateBySet([.day: 1, .hour: 0, .minute: 0, .second: 0, .nanosecond: 0])!\n\t\tcase .endOfMonth:\n\t\t\treturn dateByAdding((monthDays - day), .day).dateAtEndOf(.day)\n\t\tcase .tomorrow:\n\t\t\treturn dateByAdding(1, .day)\n\t\tcase .tomorrowAtStart:\n\t\t\treturn dateByAdding(1, .day).dateAtStartOf(.day)\n\t\tcase .yesterday:\n\t\t\treturn dateByAdding(-1, .day)\n\t\tcase .yesterdayAtStart:\n\t\t\treturn dateByAdding(-1, .day).dateAtStartOf(.day)\n\t\tcase .nearestMinute(let nearest):\n\t\t\tlet minutes = (minute + nearest / 2) / nearest * nearest\n\t\t\treturn dateBySet([.minute: minutes])!\n\t\tcase .nearestHour(let nearest):\n\t\t\tlet hours = (hour + nearest / 2) / nearest * nearest\n\t\t\treturn dateBySet([.hour: hours, .minute: 0])!\n\t\tcase .nextWeekday(let weekday):\n\t\t\tvar cal = Calendar(identifier: calendar.identifier)\n\t\t\tcal.firstWeekday = 2 // Sunday = 1, Saturday = 7\n\t\t\tvar components = DateComponents()\n\t\t\tcomponents.weekday = weekday.rawValue\n\t\t\tguard let next = cal.nextDate(after: date, matching: components, matchingPolicy: .nextTimePreservingSmallerComponents) else {\n\t\t\t\treturn self\n\t\t\t}\n\t\t\treturn DateInRegion(next, region: region)\n\t\tcase .nextDSTDate:\n\t\t\tguard let nextDate = region.timeZone.nextDaylightSavingTimeTransition(after: date) else {\n\t\t\t\treturn self\n\t\t\t}\n\t\t\treturn DateInRegion(nextDate, region: region)\n\t\tcase .prevMonth:\n\t\t\treturn dateByAdding(-1, .month).dateAtStartOf(.month).dateAtStartOf(.day)\n\t\tcase .nextMonth:\n\t\t\treturn dateByAdding(1, .month).dateAtStartOf(.month).dateAtStartOf(.day)\n\t\tcase .prevWeek:\n\t\t\treturn dateByAdding(-1, .weekOfYear).dateAtStartOf(.weekOfYear).dateAtStartOf(.day)\n\t\tcase .nextWeek:\n\t\t\treturn dateByAdding(1, .weekOfYear).dateAtStartOf(.weekOfYear).dateAtStartOf(.day)\n\t\tcase .nextYear:\n\t\t\treturn dateByAdding(1, .year).dateAtStartOf(.year)\n\t\tcase .prevYear:\n\t\t\treturn dateByAdding(-1, .year).dateAtStartOf(.year)\n\t\tcase .nextDSTTransition:\n\t\t\tguard let transitionDate = region.timeZone.nextDaylightSavingTimeTransition(after: date) else {\n\t\t\t\treturn self\n\t\t\t}\n\t\t\treturn DateInRegion(transitionDate, region: region)\n\t\t}\n\t}\n\n\t/// Create a new instance of the date in the same region with time shifted by given time interval.\n\t///\n\t/// - Parameter interval: time interval to shift; maybe negative.\n\t/// - Returns: new instance of the `DateInRegion`\n\tfunc addingTimeInterval(_ interval: TimeInterval) -> DateInRegion {\n\t\treturn DateInRegion(date.addingTimeInterval(interval), region: region)\n\t}\n\n\t// MARK: - Conversion\n\n\t/// Convert a date to a new calendar/timezone/locale.\n\t/// Only non `nil` values are used, other values are inherithed by the receiver's region.\n\t///\n\t/// - Parameters:\n\t///   - calendar: non `nil` value to change the calendar\n\t///   - timezone: non `nil` value to change the timezone\n\t///   - locale: non `nil` value to change the locale\n\t/// - Returns: converted date\n\tfunc convertTo(calendar: CalendarConvertible? = nil, timezone: ZoneConvertible? = nil, locale: LocaleConvertible? = nil) -> DateInRegion {\n\t\tlet newRegion = Region(calendar: (calendar ?? region.calendar),\n\t\t\t\t\t\t\t   zone: (timezone ?? region.timeZone),\n\t\t\t\t\t\t\t   locale: (locale ?? region.locale))\n\t\treturn convertTo(region: newRegion)\n\t}\n\n\t/// Return the dates for a specific weekday inside given month of specified year.\n\t/// Ie. get me all the saturdays of Feb 2018.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - month: month target.\n\t///   - year: year target.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday into given month.\n\tstatic func datesForWeekday(_ weekday: WeekDay, inMonth month: Int, ofYear year: Int,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [DateInRegion] {\n\t\tlet fromDate = DateInRegion(year: year, month: month, day: 1, hour: 0, minute: 0, second: 0, nanosecond: 0, region: region)\n\t\tlet toDate = fromDate.dateAt(.endOfMonth)\n\t\treturn DateInRegion.datesForWeekday(weekday, from: fromDate, to: toDate, region: region)\n\t}\n\n\t/// Return the dates for a specific weekday inside a specified date range.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - startDate: from date of the range.\n\t///   - endDate: to date of the range.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday in passed range.\n\tstatic func datesForWeekday(_ weekday: WeekDay, from startDate: DateInRegion, to endDate: DateInRegion,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [DateInRegion] {\n\n\t\tlet calendarObj = region.calendar\n\t\tlet startDateWeekDay = Int(calendarObj.component(.weekday, from: startDate.date))\n\t\tlet desiredDay = weekday.rawValue\n\n\t\tlet offset = (desiredDay - startDateWeekDay + 7) % 7\n\t\tlet firstOccurrence = calendarObj.startOfDay(for: calendarObj.date(byAdding: DateComponents(day: offset), to: startDate.date)!)\n\t\tguard firstOccurrence.timeIntervalSince1970 < endDate.timeIntervalSince1970 else {\n\t\t\treturn []\n\t\t}\n\t\tvar dateOccurrences = [DateInRegion(firstOccurrence, region: region)]\n\t\twhile true {\n\t\t\tlet nextDate = DateInRegion(calendarObj.date(byAdding: DateComponents(day: 7), to: dateOccurrences.last!.date)!,\n\t\t\t\t\t\t\t\t\t\tregion: region)\n\t\t\tguard nextDate < endDate else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdateOccurrences.append(nextDate)\n\t\t}\n\t\treturn dateOccurrences\n\t}\n\n}\n\npublic extension DateInRegion {\n\n    /// Returns the date at the given week number and week day preserving smaller components (hour, minute, seconds)\n    ///\n    /// For example: to get the third friday of next month\n    ///         let today = DateInRegion()\n    ///         let result = today.dateAt(weekdayOrdinal: 3, weekday: .friday, monthNumber: today.month + 1)\n    ///\n    /// - Parameters:\n    ///     - weekdayOrdinal: the week number (by set position in a recurrence rule)\n    ///     - weekday: WeekDay\n    ///     - monthNumber: a number from 1 to 12 representing the month, optional parameter\n    ///     - yearNumber: a number representing the year, optional parameter\n    /// - Returns: new date created with the given parameters\n    func dateAt(weekdayOrdinal: Int, weekday: WeekDay, monthNumber: Int? = nil,\n                yearNumber: Int? = nil) -> DateInRegion {\n        let monthNum = monthNumber ?? month\n        let yearNum = yearNumber ?? year\n\n        var requiredWeekNum = weekdayOrdinal\n        var result = DateInRegion(year: yearNum, month: monthNum, day: 1, hour: hour,\n                                  minute: minute, second: second, nanosecond: nanosecond, region: region)\n\n        if result.weekday == weekday.rawValue {\n            requiredWeekNum -= 1\n        }\n\n        while requiredWeekNum > 0 {\n            result = result.nextWeekday(weekday)\n            requiredWeekNum -= 1\n        }\n\n        return result\n    }\n\n    /// Returns the date on the given day of month preserving smaller components\n    func dateAt(dayOfMonth: Int, monthNumber: Int? = nil,\n                yearNumber: Int? = nil) -> DateInRegion {\n        let monthNum = monthNumber ?? month\n        let yearNum = yearNumber ?? year\n\n        let result = DateInRegion(year: yearNum, month: monthNum, day: dayOfMonth,\n                                  hour: hour, minute: minute, second: second,\n                                  nanosecond: nanosecond, region: region)\n\n        return result\n    }\n\n    /// Returns the date after given number of weeks on the given day of week\n    func dateAfter(weeks count: Int, on weekday: WeekDay) -> DateInRegion {\n        var result = self.dateByAdding(count, .weekOfMonth)\n        if result.weekday == weekday.rawValue {\n            return result\n        } else if result.weekday > weekday.rawValue {\n            result = result.dateByAdding(-1, .weekOfMonth)\n        }\n        return result.nextWeekday(weekday)\n    }\n\n    /// Returns the next weekday preserving smaller components\n    ///\n    /// - Parameters:\n    ///   - weekday: weekday to get.\n    ///   - region: region target, omit to use `SwiftDate.defaultRegion`\n    /// - Returns: `DateInRegion`\n    func nextWeekday(_ weekday: WeekDay) -> DateInRegion {\n        var components = DateComponents()\n        components.weekday = weekday.rawValue\n        components.hour = hour\n        components.second = second\n        components.minute = minute\n\n        guard let next = region.calendar.nextDate(after: date, matching: components,\n                                                  matchingPolicy: .nextTimePreservingSmallerComponents) else {\n                                                    return self\n        }\n\n        return DateInRegion(next, region: region)\n    }\n\n    /// Returns next date with the given weekday and the given week number\n    func next(_ weekday: WeekDay, withWeekOfMonth weekNumber: Int,\n              andMonthNumber monthNumber: Int? = nil) -> DateInRegion {\n        var result = self.dateAt(weekdayOrdinal: weekNumber, weekday: weekday, monthNumber: monthNumber)\n\n        if result <= self {\n\n            if let monthNum = monthNumber {\n                result = self.dateAt(weekdayOrdinal: weekNumber, weekday: weekday,\n                                     monthNumber: monthNum, yearNumber: self.year + 1)\n            } else {\n                result = self.dateAt(weekdayOrdinal: weekNumber, weekday: weekday, monthNumber: self.month + 1)\n            }\n\n        }\n\n        return result\n    }\n\n    /// Returns the next day of month preserving smaller components (hour, minute, seconds)\n    func next(dayOfMonth: Int, monthOfYear: Int? = nil) -> DateInRegion {\n        var components = DateComponents()\n        components.day = dayOfMonth\n        components.month = monthOfYear\n        components.hour = hour\n        components.second = second\n        components.minute = minute\n\n        guard let next = region.calendar.nextDate(after: date, matching: components,\n                                                  matchingPolicy: .nextTimePreservingSmallerComponents) else {\n                                                    return self\n        }\n\n        return DateInRegion(next, region: region)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion+Math.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Math Operation DateInRegion - DateInRegion\n\npublic func - (lhs: DateInRegion, rhs: DateInRegion) -> TimeInterval {\n\treturn lhs.timeIntervalSince(rhs)\n}\n\n// MARK: - Math Operation DateInRegion - Date Components\n\npublic func + (lhs: DateInRegion, rhs: DateComponents) -> DateInRegion {\n\tlet nextDate = lhs.calendar.date(byAdding: rhs, to: lhs.date)\n\treturn DateInRegion(nextDate!, region: lhs.region)\n}\n\npublic func - (lhs: DateInRegion, rhs: DateComponents) -> DateInRegion {\n\treturn lhs + (-rhs)\n}\n\n// MARK: - Math Operation DateInRegion - Calendar.Component\n\npublic func + (lhs: DateInRegion, rhs: [Calendar.Component: Int]) -> DateInRegion {\n\tlet cmps = DateInRegion.componentsFrom(values: rhs)\n\treturn lhs + cmps\n}\n\npublic func - (lhs: DateInRegion, rhs: [Calendar.Component: Int]) -> DateInRegion {\n\tvar invertedCmps: [Calendar.Component: Int] = [:]\n\trhs.forEach { invertedCmps[$0.key] = -$0.value }\n\treturn lhs + invertedCmps\n}\n\n// MARK: - Internal DateInRegion Extension\n\nextension DateInRegion {\n\n\t/// Return a `DateComponent` object from a given set of `Calendar.Component` object with associated values and a specific region\n\t///\n\t/// - parameter values:    calendar components to set (with their values)\n\t/// - parameter multipler: optional multipler (by default is nil; to make an inverse component value it should be multipled by -1)\n\t/// - parameter region:    optional region to set\n\t///\n\t/// - returns: a `DateComponents` object\n\tinternal static func componentsFrom(values: [Calendar.Component: Int], multipler: Int? = nil, setRegion region: Region? = nil) -> DateComponents {\n\t\tvar cmps = DateComponents()\n\t\tif region != nil {\n\t\t\tcmps.calendar = region!.calendar\n\t\t\tcmps.calendar!.locale = region!.locale\n\t\t\tcmps.timeZone = region!.timeZone\n\t\t}\n\t\tvalues.forEach { pair in\n\t\t\tif pair.key != .timeZone && pair.key != .calendar {\n\t\t\t\tcmps.setValue( (multipler == nil ? pair.value : pair.value * multipler!), for: pair.key)\n\t\t\t}\n\t\t}\n\t\treturn cmps\n\t}\n\n\t/// Adds a time interval to this date.\n\t/// WARNING:\n\t/// This only adjusts an absolute value. If you wish to add calendrical concepts like hours,\n\t/// days, months then you must use a Calendar.\n\t/// That will take into account complexities like daylight saving time,\n\t/// months with different numbers of days, and more.\n\t///\n\t/// - Parameter timeInterval: The value to add, in seconds.\n\tpublic mutating func addTimeInterval(_ timeInterval: TimeInterval) {\n\t\tdate.addTimeInterval(timeInterval)\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/DateInRegion.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic struct DateInRegion: DateRepresentable, Decodable, Encodable, CustomStringConvertible, Comparable, Hashable {\n\n\t/// Absolute date represented. This date is not associated with any timezone or calendar\n\t/// but represent the absolute number of seconds since Jan 1, 2001 at 00:00:00 UTC.\n\tpublic internal(set) var date: Date\n\n\t/// Associated region which define where the date is represented into the world.\n\tpublic let region: Region\n\n\t/// Formatter used to transform this object in a string. By default is `nil` because SwiftDate\n\t/// uses the thread shared formatter in order to avoid expensive init of the `DateFormatter` object.\n\t/// However, if you need of a custom behaviour you can set a valid value.\n\tpublic var customFormatter: DateFormatter?\n\n\t/// Extract date components by taking care of the region in which the date is expressed.\n\tpublic var dateComponents: DateComponents {\n\t\treturn region.calendar.dateComponents(DateComponents.allComponentsSet, from: date)\n\t}\n\n\t/// Description of the date\n\tpublic var description: String {\n\t\tlet absISODate = DateFormatter.sharedFormatter(forRegion: Region.UTC).string(from: date)\n\t\tlet representedDate = formatter(format: DateFormats.iso8601).string(from: date)\n\t\treturn \"{abs_date='\\(absISODate)', rep_date='\\(representedDate)', region=\\(region.description)\"\n\t}\n\n\t/// The interval between the date value and 00:00:00 UTC on 1 January 1970.\n\tpublic var timeIntervalSince1970: TimeInterval {\n\t\treturn date.timeIntervalSince1970\n\t}\n\n\t/// Initialize with an absolute date and represent it into given geographic region.\n\t///\n\t/// - Parameters:\n\t///   - date: absolute date to represent.\n\t///   - region: region in which the date is represented. If ignored `defaultRegion` is used instead.\n\tpublic init(_ date: Date = Date(), region: Region = SwiftDate.defaultRegion) {\n\t\tself.date = date\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new `DateInRegion` by parsing given string.\n\t/// If you know the format of the string you should pass it in order to speed up the parsing process.\n\t/// If you don't know the format leave it `nil` and parse is done between all formats in `DateFormats.builtInAutoFormats`\n\t/// and the ordered list you can provide in `SwiftDate.autoParseFormats` (with attempt priority set on your list).\n\t///\n\t/// - Parameters:\n\t///   - string: string with the date.\n\t///   - format: format of the date.\n\t///   - region: region in which the date is expressed.\n\tpublic init?(_ string: String, format: String? = nil, region: Region = SwiftDate.defaultRegion) {\n\t\tguard let date = DateFormats.parse(string: string,\n\t\t\t\t\t\t\t\t\t\t   format: format,\n\t\t\t\t\t\t\t\t\t\t   region: region) else {\n\t\t\treturn nil // failed to parse date\n\t\t}\n\t\tself.date = date\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new `DateInRegion` by parsing given string with the ordered list of passed formats.\n\t/// If you know the format of the string you should pass it in order to speed up the parsing process.\n\t/// If you don't know the format leave it `nil` and parse is done between all formats in `DateFormats.builtInAutoFormats`\n\t/// and the ordered list you can provide in `SwiftDate.autoParseFormats` (with attempt priority set on your list).\n\t///\n\t/// - Parameters:\n\t///   - string: string with the date.\n\t///   - formats: ordered list of formats to use.\n\t///   - region: region in which the date is expressed.\n\tpublic init?(_ string: String, formats: [String]?, region: Region = SwiftDate.defaultRegion) {\n\t\tguard let date = DateFormats.parse(string: string,\n\t\t\t\t\t\t\t\t\t\t   formats: (formats ?? SwiftDate.autoFormats),\n\t\t\t\t\t\t\t\t\t\t   region: region) else {\n\t\t\treturn nil // failed to parse date\n\t\t}\n\t\tself.date = date\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new date from the number of seconds passed since Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since Unix Epoch.\n\t///   - region: the region in which the date must be expressed, `nil` uses the default region at UTC timezone\n\tpublic init(seconds interval: TimeInterval, region: Region = Region.UTC) {\n\t\tself.date = Date(timeIntervalSince1970: interval)\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new date corresponding to the number of milliseconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed, `nil` uses the default region at UTC timezone\n\tpublic init(milliseconds interval: Int, region: Region = Region.UTC) {\n\t\tself.date = Date(timeIntervalSince1970: TimeInterval(interval) / 1000)\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new date with the opportunity to configure single date components via builder pattern.\n\t/// Date is therfore expressed in passed region (`DateComponents`'s `timezone`,`calendar` and `locale` are ignored\n\t/// and overwritten by the region if not `nil`).\n\t///\n\t/// - Parameters:\n\t///   - configuration: configuration callback\n\t///   - region: region in which the date is expressed.\n\t///\t\t\t\tIgnore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components configuration: ((inout DateComponents) -> Void), region: Region? = SwiftDate.defaultRegion) {\n\t\tvar components = DateComponents()\n\t\tconfiguration(&components)\n\t\tlet r = (region ?? Region(fromDateComponents: components))\n\t\tguard let date = r.calendar.date(from: components) else {\n\t\t\treturn nil\n\t\t}\n\t\tself.date = date\n\t\tself.region = r\n\t}\n\n\t/// Initialize a new date with given components.\n\t///\n\t/// - Parameters:\n\t///   - components: components of the date.\n\t///   - region: region in which the date is expressed.\n\t///\t\t\t\tIgnore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components: DateComponents, region: Region?) {\n\t\tlet r = (region ?? Region(fromDateComponents: components))\n\t\tguard let date = r.calendar.date(from: components) else {\n\t\t\treturn nil\n\t\t}\n\t\tself.date = date\n\t\tself.region = r\n\t}\n\n\t/// Initialize a new date with given components.\n\tpublic init(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, nanosecond: Int = 0, region: Region = SwiftDate.defaultRegion) {\n\t\tvar components = DateComponents()\n\t\tcomponents.year = year\n\t\tcomponents.month = month\n\t\tcomponents.day = day\n\t\tcomponents.hour = hour\n\t\tcomponents.minute = minute\n\t\tcomponents.second = second\n\t\tcomponents.nanosecond = nanosecond\n\t\tcomponents.timeZone = region.timeZone\n\t\tcomponents.calendar = region.calendar\n\t\tself.date = region.calendar.date(from: components)!\n\t\tself.region = region\n\t}\n\n\t/// Return a date in the distant past.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func past() -> DateInRegion {\n\t\treturn DateInRegion(Date.distantPast, region: SwiftDate.defaultRegion)\n\t}\n\n\t/// Return a date in the distant future.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func future() -> DateInRegion {\n\t\treturn DateInRegion(Date.distantFuture, region: SwiftDate.defaultRegion)\n\t}\n\n\t// MARK: - Codable Support\n\n\tenum CodingKeys: String, CodingKey {\n\t\tcase date\n\t\tcase region\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/DateInRegion/Region.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Region define a context both for `Date` and `DateInRegion`.\n/// Each `Date` is assigned to the currently set `SwiftDate.default\npublic struct Region: Decodable, Encodable, Equatable, Hashable, CustomStringConvertible {\n\n\t// MARK: - Properties\n\n\t/// Calendar associated with region\n\tpublic let calendar: Calendar\n\n\t/// Locale associated with region\n\tpublic var locale: Locale { return calendar.locale! }\n\n\t/// Timezone associated with region\n\tpublic var timeZone: TimeZone { return calendar.timeZone }\n\n\t/// Description of the object\n\tpublic var description: String {\n\t\treturn \"{calendar='\\(calendar.identifier)', timezone='\\(timeZone.identifier)', locale='\\(locale.identifier)'}\"\n\t}\n\n\tpublic func hash(into hasher: inout Hasher) {\n\t\thasher.combine(calendar)\n\t}\n\n\t// MARK: Initialization\n\n\t/// Initialize a new region with given parameters.\n\t///\n\t/// - Parameters:\n\t///   - calendar: calendar for region, if not specified `defaultRegions`'s calendar is used instead.\n\t///   - timezone: timezone for region, if not specified `defaultRegions`'s timezone is used instead.\n\t///   - locale: locale for region, if not specified `defaultRegions`'s locale is used instead.\n\tpublic init(calendar: CalendarConvertible = SwiftDate.defaultRegion.calendar,\n\t\t\t\tzone: ZoneConvertible = SwiftDate.defaultRegion.timeZone,\n\t\t\t\tlocale: LocaleConvertible = SwiftDate.defaultRegion.locale) {\n\t\tself.calendar = Calendar.newCalendar(calendar, configure: {\n\t\t\t$0.timeZone = zone.toTimezone()\n\t\t\t$0.locale = locale.toLocale()\n\t\t})\n\t}\n\n\t/// Initialize a new Region by reading the `timeZone`,`calendar` and `locale`\n\t/// parameters from the passed `DateComponents` instance.\n\t/// For any `nil` parameter the correspondent `SwiftDate.defaultRegion` is used instead.\n\t///\n\t/// - Parameter fromDateComponents: date components\n\tpublic init(fromDateComponents components: DateComponents) {\n\t\tlet tz = (components.timeZone ?? Zones.current.toTimezone())\n\t\tlet cal = (components.calendar ?? Calendars.gregorian.toCalendar())\n\t\tlet loc = (cal.locale ?? Locales.current.toLocale())\n        self.init(calendar: cal, zone: tz, locale: loc)\n\t}\n\n\tpublic static var UTC: Region {\n\t\treturn Region(calendar: Calendar.autoupdatingCurrent,\n\t\t\t\t\t  zone: Zones.gmt.toTimezone(),\n\t\t\t\t\t  locale: Locale.autoupdatingCurrent)\n\t}\n\n\t/// Return the current local device's region where all attributes are set to the device's values.\n\t///\n\t/// - Returns: Region\n\tpublic static var local: Region {\n\t\treturn Region(calendar: Calendar.autoupdatingCurrent,\n\t\t\t\t\t  zone: TimeZone.autoupdatingCurrent,\n\t\t\t\t\t  locale: Locale.autoupdatingCurrent)\n\t}\n\n\t/// ISO Region is defined by the gregorian calendar, gmt timezone and english posix locale\n\tpublic static var ISO: Region {\n\t\treturn Region(calendar: Calendars.gregorian.toCalendar(),\n\t\t\t\t\t  zone: Zones.gmt.toTimezone(),\n\t\t\t\t\t  locale: Locales.englishUnitedStatesComputer)\n\t}\n\n\t/// Return an auto updating region where all settings are obtained from the current's device settings.\n\t///\n\t/// - Returns: Region\n\tpublic static var current: Region {\n\t\treturn Region(calendar: Calendar.autoupdatingCurrent,\n\t\t\t\t\t  zone: TimeZone.autoupdatingCurrent,\n\t\t\t\t\t  locale: Locale.autoupdatingCurrent)\n\t}\n\n\t/// Return a new region in current's device timezone with optional adjust of the calendar and locale.\n\t///\n\t/// - Parameters:\n\t///   - locale: locale to set\n\t///   - calendar: calendar to set\n\t/// - Returns: region\n\tpublic static func currentIn(locale: LocaleConvertible? = nil, calendar: CalendarConvertible? = nil) -> Region {\n\t\treturn Region(calendar: (calendar ?? SwiftDate.defaultRegion.calendar),\n\t\t\t\t\t  zone: SwiftDate.defaultRegion.timeZone,\n\t\t\t\t\t  locale: (locale ?? SwiftDate.defaultRegion.locale))\n\t}\n\n\t/// Return the current date expressed into the receiver region.\n\t///\n\t/// - Returns: `DateInRegion` instance\n\tpublic func nowInThisRegion() -> DateInRegion {\n\t\treturn DateInRegion(Date(), region: self)\n\t}\n\n\t// MARK: - Codable Support\n\n\tenum CodingKeys: String, CodingKey {\n\t\tcase calendar\n\t\tcase locale\n\t\tcase timezone\n\t}\n\n\tpublic func encode(to encoder: Encoder) throws {\n\t\tvar container = encoder.container(keyedBy: CodingKeys.self)\n\t\ttry container.encode(calendar.timeZone.identifier, forKey: .timezone)\n\t\ttry container.encode(calendar.locale!.identifier, forKey: .locale)\n\t\ttry container.encode(calendar.identifier.description, forKey: .calendar)\n\t}\n\n\tpublic init(from decoder: Decoder) throws {\n\t\tlet values = try decoder.container(keyedBy: CodingKeys.self)\n\t\tlet calId = Calendar.Identifier( try values.decode(String.self, forKey: .calendar))\n\t\tlet tz = (TimeZone(identifier: try values.decode(String.self, forKey: .timezone)) ?? SwiftDate.defaultRegion.timeZone)\n\t\tlet lc = Locale(identifier: try values.decode(String.self, forKey: .locale))\n\t\tcalendar = Calendar.newCalendar(calId, configure: {\n\t\t\t$0.timeZone = tz\n\t\t\t$0.locale = lc\n\t\t})\n\t}\n\n\t// MARK: - Comparable\n\n\tpublic static func == (lhs: Region, rhs: Region) -> Bool {\n\t\t// Note: equality does not consider other parameters than the identifier of the major\n\t\t// attributes (calendar, timezone and locale). Deeper comparisor must be made directly\n\t\t// between Calendar (it may fail when you encode/decode autoUpdating calendars).\n\t\treturn\n\t\t\t(lhs.calendar.identifier == rhs.calendar.identifier) &&\n\t\t\t(lhs.timeZone.identifier == rhs.timeZone.identifier) &&\n\t\t\t(lhs.locale.identifier == rhs.locale.identifier)\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/DateRepresentable.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol DateRepresentable {\n\n\t// MARK: - Date Components\n\tvar year: Int { get }\n\n\t/// Represented month\n\tvar month: Int { get }\n\n\t/// Represented month name with given style.\n\t///\n\t/// - Parameter style: style in which the name must be formatted.\n\t/// - Returns: name of the month\n\tfunc monthName(_ style: SymbolFormatStyle) -> String\n\n\t/// Number of the days in the receiver.\n\tvar monthDays: Int { get }\n\n\t/// Day unit of the receiver.\n\tvar day: Int { get }\n\n\t/// Day of year unit of the receiver\n\tvar dayOfYear: Int { get }\n\n\t/// The number of day in ordinal style format for the receiver in current locale.\n\t/// For example, in the en_US locale, the number 3 is represented as 3rd;\n\t/// in the fr_FR locale, the number 3 is represented as 3e.\n\t@available(iOS 9.0, macOS 10.11, *)\n\tvar ordinalDay: String { get }\n\n\t/// Hour unit of the receiver.\n\tvar hour: Int { get }\n\n\t/// Nearest rounded hour from the date\n\tvar nearestHour: Int { get }\n\n\t/// Minute unit of the receiver.\n\tvar minute: Int { get }\n\n\t/// Second unit of the receiver.\n\tvar second: Int { get }\n\n\t/// Nanosecond unit of the receiver.\n\tvar nanosecond: Int { get }\n\n\t/// Milliseconds in day of the receiver\n\t/// This field behaves exactly like a composite of all time-related fields, not including the zone fields.\n\t/// As such, it also reflects discontinuities of those fields on DST transition days.\n\t/// On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward.\n\t/// This reflects the fact that is must be combined with the offset field to obtain a unique local time value.\n\tvar msInDay: Int { get }\n\n\t/// Weekday unit of the receiver.\n\t/// The weekday units are the numbers 1-N (where for the Gregorian calendar N=7 and 1 is Sunday).\n\tvar weekday: Int { get }\n\n\t/// Name of the weekday expressed in given format style.\n\t///\n\t/// - Parameter style: style to express the value.\n\t/// - Parameter locale: locale to use; ignore it to use default's region locale.\n\t/// - Returns: weekday name\n\tfunc weekdayName(_ style: SymbolFormatStyle, locale: LocaleConvertible?) -> String\n\n\t/// Week of a year of the receiver.\n\tvar weekOfYear: Int { get }\n\n\t/// Week of a month of the receiver.\n\tvar weekOfMonth: Int { get }\n\n\t/// Ordinal position within the month unit of the corresponding weekday unit.\n\t/// For example, in the Gregorian calendar a weekday ordinal unit of 2 for a\n\t/// weekday unit 3 indicates \"the second Tuesday in the month\".\n\tvar weekdayOrdinal: Int { get }\n\n\t/// Return the first day number of the week where the receiver date is located.\n\tvar firstDayOfWeek: Int { get }\n\n\t/// Return the last day number of the week where the receiver date is located.\n\tvar lastDayOfWeek: Int { get }\n\n\t/// Relative year for a week within a year calendar unit.\n\tvar yearForWeekOfYear: Int { get }\n\n\t/// Quarter value of the receiver.\n\tvar quarter: Int { get }\n\n\t/// Quarter name expressed in given format style.\n\t///\n\t/// - Parameter style: style to express the value.\n\t/// - Parameter locale: locale to use; ignore it to use default's region locale.\n\t/// - Returns: quarter name\n\tfunc quarterName(_ style: SymbolFormatStyle, locale: LocaleConvertible?) -> String\n\n\t/// Era value of the receiver.\n\tvar era: Int { get }\n\n\t/// Name of the era expressed in given format style.\n\t///\n\t/// - Parameter style: style to express the value.\n\t/// - Parameter locale: locale to use; ignore it to use default's region locale.\n\t/// - Returns: era\n\tfunc eraName(_ style: SymbolFormatStyle, locale: LocaleConvertible?) -> String\n\n\t/// The current daylight saving time offset of the represented date.\n\tvar DSTOffset: TimeInterval { get }\n\n\t// MARK: - Common Properties\n\n\t/// Absolute representation of the date\n\tvar date: Date { get }\n\n\t/// Associated region\n\tvar region: Region { get }\n\n\t/// Associated calendar\n\tvar calendar: Calendar { get }\n\n\t/// Extract the date components from the date\n\tvar dateComponents: DateComponents { get }\n\n\t/// Returns whether the given date is in today as boolean.\n\tvar isToday: Bool { get }\n\n\t/// Returns whether the given date is in yesterday.\n\tvar isYesterday: Bool { get }\n\n\t/// Returns whether the given date is in tomorrow.\n\tvar isTomorrow: Bool { get }\n\n\t/// Returns whether the given date is in the weekend.\n\tvar isInWeekend: Bool { get }\n\n\t/// Return true if given date represent a passed date\n\tvar isInPast: Bool { get }\n\n\t/// Return true if given date represent a future date\n\tvar isInFuture: Bool { get }\n\n\t/// Use this object to format the date object.\n\t/// By default this object return the `customFormatter` instance (if set) or the\n\t/// local thread shared formatter (via `sharedFormatter()` func; this is the most typical scenario).\n\t///\n\t/// - Parameters:\n\t///   - format: format string to set.\n\t///   - configuration: optional callback used to configure the object inline.\n\t/// - Returns: formatter instance\n\tfunc formatter(format: String?, configuration: ((DateFormatter) -> Void)?) -> DateFormatter\n\n\t/// User this object to get an DateFormatter already configured to format the data object with the associated region.\n\t/// By default this object return the `customFormatter` instance (if set) configured for region or the\n\t/// local thread shared formatter even configured for region (via `sharedFormatter()` func; this is the most typical scenario).\n\t///\n\t///   - format: format string to set.\n\t///   - configuration: optional callback used to configure the object inline.\n\t/// - Returns: formatter instance\n\tfunc formatterForRegion(format: String?, configuration: ((inout DateFormatter) -> Void)?) -> DateFormatter\n\n\t/// Set a custom formatter for this object.\n\t/// Typically you should not need to set a value for this property.\n\t/// With a `nil` value SwiftDate will uses the threa shared formatter returned by `sharedFormatter()` function.\n\t/// In case you need to a custom formatter instance you can override the default behaviour by setting a value here.\n\tvar customFormatter: DateFormatter? { get set }\n\n\t/// Return a formatter instance created as singleton into the current caller's thread.\n\t/// This object is used for formatting when no `dateFormatter` is set for the object\n\t/// (this is the common scenario where you want to avoid multiple formatter instances to\n\t/// parse dates; instances of DateFormatter are very expensive to create and you should\n\t/// use a single instance in each thread to perform this kind of tasks).\n\t///\n\t/// - Returns: formatter instance\n\tvar sharedFormatter: DateFormatter { get }\n\n\t// MARK: - Init\n\n\t/// Initialize a new date by parsing a string.\n\t///\n\t/// - Parameters:\n\t///   - string: string with the date.\n\t///   - format: format used to parse date. Pass `nil` to use built-in formats\n\t///\t\t\t\t(if you know you should pass it to optimize the parsing process)\n\t///   - region: region in which the date in `string` is expressed.\n\tinit?(_ string: String, format: String?, region: Region)\n\n\t/// Initialize a new date from a number of seconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed.\n\tinit(seconds interval: TimeInterval, region: Region)\n\n\t/// Initialize a new date corresponding to the number of milliseconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed.\n\tinit(milliseconds interval: Int, region: Region)\n\n\t/// Initialize a new date with the opportunity to configure single date components via builder pattern.\n\t/// Date is therfore expressed in passed region (`DateComponents`'s `timezone`,`calendar` and `locale` are ignored\n\t/// and overwritten by the region if not `nil`).\n\t///\n\t/// - Parameters:\n\t///   - configuration: configuration callback\n\t///   - region: region in which the date is expressed. Ignore to use `SwiftDate.defaultRegion`,\n\t///\t\t\t\t`nil` to use `DateComponents` data.\n\tinit?(components configuration: ((inout DateComponents) -> Void), region: Region?)\n\n\t/// Initialize a new date with time components passed.\n\t///\n\t/// - Parameters:\n\t///   - components: date components\n\t///   - region: region in which the date is expressed. Ignore to use `SwiftDate.defaultRegion`,\n\t///\t\t\t\t`nil` to use `DateComponents` data.\n\tinit?(components: DateComponents, region: Region?)\n\n\t/// Initialize a new date with given components.\n\tinit(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int, nanosecond: Int, region: Region)\n\n\t// MARK: - Conversion\n\n\t/// Convert a date to another region.\n\t///\n\t/// - Parameter region: destination region in which the date must be represented.\n\t/// - Returns: converted date\n\tfunc convertTo(region: Region) -> DateInRegion\n\n\t// MARK: - To String Formatting\n\n\t/// Convert date to a string using passed pre-defined style.\n\t///\n\t/// - Parameter style: formatter style, `nil` to use `standard` style\n\t/// - Returns: string representation of the date\n\tfunc toString(_ style: DateToStringStyles?) -> String\n\n\t/// Convert date to a string using custom date format.\n\t///\n\t/// - Parameters:\n\t/// \t- format: format of the string representation\n\t///\t\t- locale: locale to fix a custom locale, `nil` to use associated region's locale\n\t/// - Returns: string representation of the date\n\tfunc toFormat(_ format: String, locale: LocaleConvertible?) -> String\n\n\t/// Convert a date to a string representation relative to another reference date (or current\n\t/// if not passed).\n\t///\n\t/// - Parameters:\n\t///   - since: reference date, if `nil` current is used.\n\t///   - style: style to use to format relative date.\n\t///\t  - locale: force locale print, `nil` to use the date own region's locale\n\t/// - Returns: string representation of the date.\n\tfunc toRelative(since: DateInRegion?, style: RelativeFormatter.Style?, locale: LocaleConvertible?) -> String\n\n\t/// Return ISO8601 representation of the date\n\t///\n\t/// - Parameter options: optional options, if nil extended iso format is used\n\tfunc toISO(_ options: ISOFormatter.Options?) -> String\n\n\t/// Return DOTNET compatible representation of the date.\n\t///\n\t/// - Returns: string representation of the date\n\tfunc toDotNET() -> String\n\n\t/// Return SQL compatible representation of the date.\n\t///\n\t/// - Returns: string represenation of the date\n\tfunc toSQL() -> String\n\n\t/// Return RSS compatible representation of the date\n\t///\n\t/// - Parameter alt: `true` to return altRSS version, `false` to return the standard RSS representation\n\t/// - Returns: string representation of the date\n\tfunc toRSS(alt: Bool) -> String\n\n\t// MARK: - Extract Components\n\n\t/// Extract time components for elapsed interval between the receiver date\n\t/// and a reference date.\n\t///\n\t/// - Parameters:\n\t///   - units: units to extract.\n\t///   - refDate: reference date\n\t/// - Returns: extracted time units\n\tfunc toUnits(_ units: Set<Calendar.Component>, to refDate: DateRepresentable) -> [Calendar.Component: Int]\n\n\t/// Extract time unit component from given date.\n\t///\n\t/// - Parameters:\n\t///   - unit: time component to extract\n\t///   - refDate: reference date\n\t/// - Returns: extracted time unit value\n\tfunc toUnit(_ unit: Calendar.Component, to refDate: DateRepresentable) -> Int\n\n}\n\npublic extension DateRepresentable {\n\n\t// MARK: - Common Properties\n\n\tvar calendar: Calendar {\n\t\treturn region.calendar\n\t}\n\n\t// MARK: - Date Components Properties\n\n\tvar year: Int {\n\t\treturn dateComponents.year!\n\t}\n\n\tvar month: Int {\n\t\treturn dateComponents.month!\n\t}\n\n\tvar monthDays: Int {\n\t\treturn calendar.range(of: .day, in: .month, for: date)!.count\n\t}\n\n\tfunc monthName(_ style: SymbolFormatStyle) -> String {\n\t\tlet formatter = self.formatter(format: nil)\n\t\tlet idx = (month - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.monthSymbols[idx]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneMonthSymbols[idx]\n\t\tcase .short:\t\t\t\treturn formatter.shortMonthSymbols[idx]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneMonthSymbols[idx]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortMonthSymbols[idx]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneMonthSymbols[idx]\n\t\t}\n\t}\n\n\tvar day: Int {\n\t\treturn dateComponents.day!\n\t}\n\n\tvar dayOfYear: Int {\n\t\treturn calendar.ordinality(of: .day, in: .year, for: date)!\n\t}\n\n\t@available(iOS 9.0, macOS 10.11, *)\n\tvar ordinalDay: String {\n\t\tlet day = self.day\n\t\treturn DateFormatter.sharedOrdinalNumberFormatter(locale: region.locale).string(from: day as NSNumber) ?? \"\\(day)\"\n\t}\n\n\tvar hour: Int {\n\t\treturn dateComponents.hour!\n\t}\n\n\tvar nearestHour: Int {\n\t\tlet newDate = (date + (date.minute >= 30 ? 60 - date.minute : -date.minute).minutes)\n\t\treturn newDate.in(region: region).hour\n\t}\n\n\tvar minute: Int {\n\t\treturn dateComponents.minute!\n\t}\n\n\tvar second: Int {\n\t\treturn dateComponents.second!\n\t}\n\n\tvar nanosecond: Int {\n\t\treturn dateComponents.nanosecond!\n\t}\n\n\tvar msInDay: Int {\n\t\treturn (calendar.ordinality(of: .second, in: .day, for: date)! * 1000)\n\t}\n\n\tvar weekday: Int {\n\t\treturn dateComponents.weekday!\n\t}\n\n\tfunc weekdayName(_ style: SymbolFormatStyle, locale: LocaleConvertible? = nil) -> String {\n\t\tlet formatter = self.formatter(format: nil) {\n\t\t\t$0.locale = (locale ?? self.region.locale).toLocale()\n\t\t}\n\t\tlet idx = (weekday - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.weekdaySymbols[idx]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneWeekdaySymbols[idx]\n\t\tcase .short:\t\t\t\treturn formatter.shortWeekdaySymbols[idx]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneWeekdaySymbols[idx]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortWeekdaySymbols[idx]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneWeekdaySymbols[idx]\n\t\t}\n\t}\n\n\tvar weekOfYear: Int {\n\t\treturn dateComponents.weekOfYear!\n\t}\n\n\tvar weekOfMonth: Int {\n\t\treturn dateComponents.weekOfMonth!\n\t}\n\n\tvar weekdayOrdinal: Int {\n\t\treturn dateComponents.weekdayOrdinal!\n\t}\n\n\tvar yearForWeekOfYear: Int {\n\t\treturn dateComponents.yearForWeekOfYear!\n\t}\n\n\tvar firstDayOfWeek: Int {\n\t\treturn date.dateAt(.startOfWeek).day\n\t}\n\n\tvar lastDayOfWeek: Int {\n\t\treturn date.dateAt(.endOfWeek).day\n\t}\n\n\tvar quarter: Int {\n\t\tlet monthsInQuarter = Double(Calendar.current.monthSymbols.count) / 4.0\n\t\treturn Int(ceil( Double(month) / monthsInQuarter))\n\t}\n\n\tvar isToday: Bool {\n\t\treturn calendar.isDateInToday(date)\n\t}\n\n\tvar isYesterday: Bool {\n\t\treturn calendar.isDateInYesterday(date)\n\t}\n\n\tvar isTomorrow: Bool {\n\t\treturn calendar.isDateInTomorrow(date)\n\t}\n\n\tvar isInWeekend: Bool {\n\t\treturn calendar.isDateInWeekend(date)\n\t}\n\n\tvar isInPast: Bool {\n\t\treturn date < Date()\n\t}\n\n\tvar isInFuture: Bool {\n\t\treturn date > Date()\n\t}\n\n\tfunc quarterName(_ style: SymbolFormatStyle, locale: LocaleConvertible? = nil) -> String {\n\t\tlet formatter = self.formatter(format: nil) {\n\t\t\t$0.locale = (locale ?? self.region.locale).toLocale()\n\t\t}\n\t\tlet idx = (quarter - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\t\t\t\t\t\treturn formatter.quarterSymbols[idx]\n\t\tcase .defaultStandalone:\t\t\t\t\t\treturn formatter.standaloneQuarterSymbols[idx]\n\t\tcase .short, .veryShort:\t\t\t\t\t\treturn formatter.shortQuarterSymbols[idx]\n\t\tcase .standaloneShort, .standaloneVeryShort:\treturn formatter.shortStandaloneQuarterSymbols[idx]\n\t\t}\n\t}\n\n\tvar era: Int {\n\t\treturn dateComponents.era!\n\t}\n\n\tfunc eraName(_ style: SymbolFormatStyle, locale: LocaleConvertible? = nil) -> String {\n\t\tlet formatter = self.formatter(format: nil) {\n\t\t\t$0.locale = (locale ?? self.region.locale).toLocale()\n\t\t}\n\t\tlet idx = (era - 1)\n\t\tswitch style {\n\t\tcase .default, .defaultStandalone:\t\t\t\t\t\t\t\treturn formatter.longEraSymbols[idx]\n\t\tcase .short, .standaloneShort, .veryShort, .standaloneVeryShort:\treturn formatter.eraSymbols[idx]\n\t\t}\n\t}\n\n\tvar DSTOffset: TimeInterval {\n\t\treturn region.timeZone.daylightSavingTimeOffset(for: date)\n\t}\n\n\t// MARK: - Date Formatters\n\n\tfunc formatter(format: String? = nil, configuration: ((DateFormatter) -> Void)? = nil) -> DateFormatter {\n\t\tlet formatter = (customFormatter ?? sharedFormatter)\n\t\tif let dFormat = format {\n\t\t\tformatter.dateFormat = dFormat\n\t\t}\n\t\tconfiguration?(formatter)\n\t\treturn formatter\n\t}\n\n\tfunc formatterForRegion(format: String? = nil, configuration: ((inout DateFormatter) -> Void)? = nil) -> DateFormatter {\n\t\tvar formatter = self.formatter(format: format, configuration: {\n            $0.timeZone = self.region.timeZone\n\t\t\t$0.calendar = self.calendar\n\t\t\t$0.locale = self.region.locale\n\t\t})\n\t\tconfiguration?(&formatter)\n\t\treturn formatter\n\t}\n\n\tvar sharedFormatter: DateFormatter {\n\t\treturn DateFormatter.sharedFormatter(forRegion: region)\n\t}\n\n\tfunc toString(_ style: DateToStringStyles? = nil) -> String {\n\t\tguard let style = style else {\n\t\t\treturn DateToStringStyles.standard.toString(self)\n\t\t}\n\t\treturn style.toString(self)\n\t}\n\n\tfunc toFormat(_ format: String, locale: LocaleConvertible? = nil) -> String {\n\t\tguard let fixedLocale = locale else {\n\t\t\treturn DateToStringStyles.custom(format).toString(self)\n\t\t}\n\t\tlet fixedRegion = Region(calendar: region.calendar, zone: region.timeZone, locale: fixedLocale)\n\t\tlet fixedDate = DateInRegion(date.date, region: fixedRegion)\n\t\treturn DateToStringStyles.custom(format).toString(fixedDate)\n\t}\n\n\tfunc toRelative(since: DateInRegion? = nil, style: RelativeFormatter.Style? = nil, locale: LocaleConvertible? = nil) -> String {\n\t\treturn RelativeFormatter.format(date: self, to: since, style: style, locale: locale?.toLocale())\n\t}\n\n\tfunc toISO(_ options: ISOFormatter.Options? = nil) -> String {\n\t\treturn DateToStringStyles.iso( (options ?? ISOFormatter.Options([.withInternetDateTime])) ).toString(self)\n\t}\n\n\tfunc toDotNET() -> String {\n\t\treturn DOTNETFormatter.format(self, options: nil)\n\t}\n\n\tfunc toRSS(alt: Bool) -> String {\n\t\tswitch alt {\n\t\tcase true: \t\treturn DateToStringStyles.altRSS.toString(self)\n\t\tcase false: \treturn DateToStringStyles.rss.toString(self)\n\t\t}\n\t}\n\n\tfunc toSQL() -> String {\n\t\treturn DateToStringStyles.sql.toString(self)\n\t}\n\n\t// MARK: - Conversion\n\n\tfunc convertTo(region: Region) -> DateInRegion {\n\t\treturn DateInRegion(date, region: region)\n\t}\n\n\t// MARK: - Extract Time Components\n\n\tfunc toUnits(_ units: Set<Calendar.Component>, to refDate: DateRepresentable) -> [Calendar.Component: Int] {\n\t\tlet cal = region.calendar\n\t\tlet components = cal.dateComponents(units, from: date, to: refDate.date)\n\t\treturn components.toDict()\n\t}\n\n\tfunc toUnit(_ unit: Calendar.Component, to refDate: DateRepresentable) -> Int {\n\t\tlet cal = region.calendar\n\t\tlet components = cal.dateComponents([unit], from: date, to: refDate.date)\n\t\treturn components.value(for: unit)!\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/DotNetParserFormatter.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic class DOTNETParser: StringToDateTransformable {\n\n\tinternal static let pattern = \"\\\\/Date\\\\((-?\\\\d+)((?:[\\\\+\\\\-]\\\\d+)?)\\\\)\\\\/\"\n\n\tpublic static func parse(_ string: String) -> (seconds: TimeInterval, tz: TimeZone)? {\n\t\tdo {\n\t\t\tlet parser = try NSRegularExpression(pattern: DOTNETParser.pattern, options: .caseInsensitive)\n\t\t\tguard let match = parser.firstMatch(in: string, options: .reportCompletion, range: NSRange(location: 0, length: string.count)) else {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tguard let milliseconds = TimeInterval((string as NSString).substring(with: match.range(at: 1))) else { return nil }\n\n\t\t\t// Parse timezone\n\t\t\tlet raw_tz = ((string as NSString).substring(with: match.range(at: 2)) as NSString)\n\t\t\tguard raw_tz.length > 1 else {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tlet tz_sign: String = raw_tz.substring(to: 1)\n\t\t\tif tz_sign != \"+\" && tz_sign != \"-\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tlet tz_hours: String = raw_tz.substring(with: NSRange(location: 1, length: 2))\n\t\t\tlet tz_minutes: String = raw_tz.substring(with: NSRange(location: 3, length: 2))\n\n\t\t\tlet tz_offset = (Int(tz_hours)! * 60 * 60) + ( Int(tz_minutes)! * 60 )\n\t\t\tguard let tz_obj = TimeZone(secondsFromGMT: tz_offset) else {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn ( (milliseconds / 1000), tz_obj )\n\t\t} catch {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tpublic static func parse(_ string: String, region: Region?, options: Any?) -> DateInRegion? {\n\t\tguard let result = DOTNETParser.parse(string) else { return nil }\n        let regionSet = region ?? Region.ISO\n\t\tlet adaptedRegion = Region(calendar: regionSet.calendar, zone: regionSet.timeZone, locale: regionSet.locale)\n\t\treturn DateInRegion(seconds: result.seconds, region: adaptedRegion)\n\t}\n\n}\n\npublic class DOTNETFormatter: DateToStringTrasformable {\n\n\tpublic static func format(_ date: DateRepresentable, options: Any?) -> String {\n\t\tlet milliseconds = (date.date.timeIntervalSince1970 * 1000.0)\n\t\tlet tzOffsets = (date.region.timeZone.secondsFromGMT(for: date.date) / 3600)\n\t\tlet formattedStr = String(format: \"/Date(%.0f%+03d00)/\", milliseconds, tzOffsets)\n\t\treturn formattedStr\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/Formatter+Protocols.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol DateToStringTrasformable {\n\tstatic func format(_ date: DateRepresentable, options: Any?) -> String\n}\n\npublic protocol StringToDateTransformable {\n\tstatic func parse(_ string: String, region: Region?, options: Any?) -> DateInRegion?\n}\n\n// MARK: - Formatters\n\n/// Format to represent a date to string\n///\n/// - iso: standard iso format. The ISO8601 formatted date, time and millisec \"yyyy-MM-dd'T'HH:mm:ssZZZZZ\"\n/// - extended: Extended format. \"eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz\"\n/// - rss: The RSS formatted date \"EEE, d MMM yyyy HH:mm:ss ZZZ\" i.e. \"Fri, 09 Sep 2011 15:26:08 +0200\"\n/// - altRSS: The Alternative RSS formatted date \"d MMM yyyy HH:mm:ss ZZZ\" i.e. \"09 Sep 2011 15:26:08 +0200\"\n/// - dotNet: The dotNet formatted date \"/Date(%d%d)/\" i.e. \"/Date(1268123281843)/\"\n/// - httpHeader: The http header formatted date \"EEE, dd MMM yyyy HH:mm:ss zzz\" i.e. \"Tue, 15 Nov 1994 12:45:26 GMT\"\n/// - custom: custom string format\n/// - standard: A generic standard format date i.e. \"EEE MMM dd HH:mm:ss Z yyyy\"\n/// - date: Date only format (short = \"2/27/17\", medium = \"Feb 27, 2017\", long = \"February 27, 2017\", full = \"Monday, February 27, 2017\"\n/// - time: Time only format (short = \"2:22 PM\", medium = \"2:22:06 PM\", long = \"2:22:06 PM EST\", full = \"2:22:06 PM Eastern Standard Time\"\n/// - dateTime: Date/Time format (short = \"2/27/17, 2:22 PM\", medium = \"Feb 27, 2017, 2:22:06 PM\", long = \"February 27, 2017 at 2:22:06 PM EST\", full = \"Monday, February 27, 2017 at 2:22:06 PM Eastern Standard Time\"\npublic enum DateToStringStyles {\n\tcase iso(_: ISOFormatter.Options)\n\tcase extended\n\tcase rss\n\tcase altRSS\n\tcase dotNet\n\tcase httpHeader\n\tcase sql\n\tcase date(_: DateFormatter.Style)\n\tcase time(_: DateFormatter.Style)\n\tcase dateTime(_: DateFormatter.Style)\n    case dateTimeMixed(dateStyle: DateFormatter.Style, timeStyle: DateFormatter.Style)\n\tcase custom(_: String)\n\tcase standard\n\tcase relative(style: RelativeFormatter.Style?)\n\n\tpublic func toString(_ date: DateRepresentable) -> String {\n\t\tswitch self {\n\t\tcase .iso(let opts):\t\t\treturn ISOFormatter.format(date, options: opts)\n\t\tcase .extended:\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.extended).string(from: date.date)\n\t\tcase .rss:\t\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.rss).string(from: date.date)\n\t\tcase .altRSS:\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.altRSS).string(from: date.date)\n\t\tcase .sql:\t\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.sql).string(from: date.date)\n\t\tcase .dotNet:\t\t\t\t\treturn DOTNETFormatter.format(date, options: nil)\n\t\tcase .httpHeader:\t\t\t\treturn date.formatterForRegion(format: DateFormats.httpHeader).string(from: date.date)\n\t\tcase .custom(let format):\t\treturn date.formatterForRegion(format: format).string(from: date.date)\n\t\tcase .standard:\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.standard).string(from: date.date)\n\t\tcase .date(let style):\n\t\t\treturn date.formatterForRegion(format: nil, configuration: {\n\t\t\t\t$0.dateStyle = style\n\t\t\t\t$0.timeStyle = .none\n\t\t\t}).string(from: date.date)\n\t\tcase .time(let style):\n\t\t\treturn date.formatterForRegion(format: nil, configuration: {\n\t\t\t\t$0.dateStyle = .none\n\t\t\t\t$0.timeStyle = style\n\t\t\t}).string(from: date.date)\n\t\tcase .dateTime(let style):\n\t\t\treturn date.formatterForRegion(format: nil, configuration: {\n\t\t\t\t$0.dateStyle = style\n\t\t\t\t$0.timeStyle = style\n\t\t\t}).string(from: date.date)\n        case .dateTimeMixed(let dateStyle, let timeStyle):\n            return date.formatterForRegion(format: nil, configuration: {\n                $0.dateStyle = dateStyle\n                $0.timeStyle = timeStyle\n            }).string(from: date.date)\n\t\tcase .relative(let style):\n\t\t\treturn RelativeFormatter.format(date, options: style)\n\t\t}\n\t}\n\n}\n\n// MARK: - Parsers\n\n/// String to date transform\n///\n/// - iso: standard automatic iso parser (evaluate the date components automatically)\n/// - extended: Extended format. \"eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz\"\n/// - rss: The RSS formatted date \"EEE, d MMM yyyy HH:mm:ss ZZZ\" i.e. \"Fri, 09 Sep 2011 15:26:08 +0200\"\n/// - altRSS: The Alternative RSS formatted date \"d MMM yyyy HH:mm:ss ZZZ\" i.e. \"09 Sep 2011 15:26:08 +0200\"\n/// - dotNet: The dotNet formatted date \"/Date(%d%d)/\" i.e. \"/Date(1268123281843)/\"\n/// - httpHeader: The http header formatted date \"EEE, dd MMM yyyy HH:mm:ss zzz\" i.e. \"Tue, 15 Nov 1994 12:45:26 GMT\"\n/// - strict: custom string format with lenient options active\n/// - custom: custom string format\n/// - standard: A generic standard format date i.e. \"EEE MMM dd HH:mm:ss Z yyyy\"\npublic enum StringToDateStyles {\n\tcase iso(_: ISOParser.Options)\n\tcase extended\n\tcase rss\n\tcase altRSS\n\tcase dotNet\n\tcase sql\n\tcase httpHeader\n\tcase strict(_: String)\n\tcase custom(_: String)\n\tcase standard\n\n\tpublic func toDate(_ string: String, region: Region) -> DateInRegion? {\n\t\tswitch self {\n\t\tcase .iso(let options):\t\t\t\treturn ISOParser.parse(string, region: region, options: options)\n\t\tcase .custom(let format):\t\t\treturn DateInRegion(string, format: format, region: region)\n\t\tcase .extended:\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.extended, region: region)\n\t\tcase .sql:\t\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.sql, region: region)\n\t\tcase .rss:\t\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.rss, region: Region.ISO)?.convertTo(locale: region.locale)\n\t\tcase .altRSS:\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.altRSS, region: Region.ISO)?.convertTo(locale: region.locale)\n\t\tcase .dotNet:\t\t\t\t\t\treturn DOTNETParser.parse(string, region: region, options: nil)\n\t\tcase .httpHeader:\t\t\t\t\treturn DateInRegion(string, format: DateFormats.httpHeader, region: region)\n\t\tcase .standard:\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.standard, region: region)\n\t\tcase .strict(let format):\n\t\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region, format: format)\n\t\t\tformatter.isLenient = false\n\t\t\tguard let absDate = formatter.date(from: string) else { return nil }\n\t\t\treturn DateInRegion(absDate, region: region)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/ISOFormatter.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic class ISOFormatter: DateToStringTrasformable {\n\n\tpublic struct Options: OptionSet {\n\t\tpublic let rawValue: Int\n\n\t\tpublic init(rawValue: Int) {\n\t\t\tself.rawValue = rawValue\n\t\t}\n\n\t\t/// The date representation includes the year. The format for year is inferred based on the other specified options.\n\t\t/// - If withWeekOfYear is specified, YYYY is used.\n\t\t/// - Otherwise, yyyy is used.\n\t\tpublic static let withYear = ISOFormatter.Options(rawValue: 1 << 0)\n\n\t\t/// The date representation includes the month. The format for month is MM.\n\t\tpublic static let withMonth = ISOFormatter.Options(rawValue: 1 << 1)\n\n\t\t/// The date representation includes the week of the year.\n\t\t/// The format for week of year is ww, including the W prefix.\n\t\tpublic static let withWeekOfYear = ISOFormatter.Options(rawValue: 1 << 2)\n\n\t\t/// The date representation includes the day. The format for day is inferred based on provided options:\n\t\t/// - If withMonth is specified, dd is used.\n\t\t/// - If withWeekOfYear is specified, ee is used.\n\t\t/// - Otherwise, DDD is used.\n\t\tpublic static let withDay = ISOFormatter.Options(rawValue: 1 << 3)\n\n\t\t/// The date representation includes the time. The format for time is HH:mm:ss.\n\t\tpublic static let withTime = ISOFormatter.Options(rawValue: 1 << 4)\n\n\t\t/// The date representation includes the timezone. The format for timezone is ZZZZZ.\n\t\tpublic static let withTimeZone = ISOFormatter.Options(rawValue: 1 << 5)\n\n\t\t/// The date representation uses a space ( ) instead of T between the date and time.\n\t\tpublic static let withSpaceBetweenDateAndTime = ISOFormatter.Options(rawValue: 1 << 6)\n\n\t\t/// The date representation uses the dash separator (-) in the date.\n\t\tpublic static let withDashSeparatorInDate = ISOFormatter.Options(rawValue: 1 << 7)\n\n\t\t/// The date representation uses the colon separator (:) in the time.\n\t\tpublic static let withFullDate = ISOFormatter.Options(rawValue: 1 << 8)\n\n\t\t/// The date representation includes the hour, minute, and second.\n\t\tpublic static let withFullTime = ISOFormatter.Options(rawValue: 1 << 9)\n\n\t\t/// The format used for internet date times, according to the RFC 3339 standard.\n\t\t/// Equivalent to specifying withFullDate, withFullTime, withDashSeparatorInDate,\n\t\t/// withColonSeparatorInTime, and withColonSeparatorInTimeZone.\n\t\tpublic static let withInternetDateTime = ISOFormatter.Options(rawValue: 1 << 10)\n\n\t\t// The format used for internet date times; it's similar to .withInternetDateTime\n\t\t// but include milliseconds ('yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ').\n\t\tpublic static let withInternetDateTimeExtended = ISOFormatter.Options(rawValue: 1 << 11)\n\n\t\t/// Print the timezone in format `ZZZ` instead of `ZZZZZ`\n\t\t/// An example outout maybe be `+0200` instead of `+02:00`.\n\t\tpublic static let withoutTZSeparators = ISOFormatter.Options(rawValue: 1 << 12)\n\n\t\t/// Evaluate formatting string\n\t\tpublic var dateFormat: String {\n\t\t\tif contains(.withInternetDateTimeExtended) || contains(.withoutTZSeparators) {\n\t\t\t\tif contains(.withoutTZSeparators) {\n\t\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ\"\n\t\t\t\t}\n\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\"\n\t\t\t}\n\n\t\t\tif contains(.withInternetDateTime) {\n\t\t\t\tif contains(.withoutTZSeparators) {\n\t\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ\"\n\t\t\t\t}\n\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ssZZZZZ\"\n\t\t\t}\n\n\t\t\tvar format: String = \"\"\n\t\t\tif contains(.withFullDate) {\n\t\t\t\tformat += \"yyyy-MM-dd\"\n\t\t\t} else {\n\t\t\t\tif contains(.withYear) {\n\t\t\t\t\tif contains(.withWeekOfYear) {\n\t\t\t\t\t\tformat += \"YYYY\"\n\t\t\t\t\t} else if contains(.withMonth) || contains(.withDay) {\n\t\t\t\t\t\tformat += \"yyyy\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// not valid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif contains(.withMonth) {\n\t\t\t\t\tif contains(.withYear) || contains(.withDay) || contains(.withWeekOfYear) {\n\t\t\t\t\t\tformat += \"MM\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// not valid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif contains(.withWeekOfYear) {\n\t\t\t\t\tif contains(.withDay) {\n\t\t\t\t\t\tformat += \"'W'ww\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif contains(.withYear) || contains(.withMonth) {\n\t\t\t\t\t\t\tif contains(.withDashSeparatorInDate) {\n\t\t\t\t\t\t\t\tformat += \"-'W'ww\"\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tformat += \"'W'ww\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// not valid\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif contains(.withDay) {\n\t\t\t\t\tif contains(.withWeekOfYear) {\n\t\t\t\t\t\tformat += \"FF\"\n\t\t\t\t\t} else if contains(.withMonth) {\n\t\t\t\t\t\tformat += \"dd\"\n\t\t\t\t\t} else if contains(.withYear) {\n\t\t\t\t\t\tif contains(.withDashSeparatorInDate) {\n\t\t\t\t\t\t\tformat += \"-DDD\"\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tformat += \"DDD\"\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// not valid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet hasDate = (contains(.withFullDate) || contains(.withMonth) || contains(.withDay) || contains(.withWeekOfYear) || contains(.withYear))\n\t\t\tif hasDate && (contains(.withFullTime) || contains(.withTimeZone) || contains(.withTime)) {\n\t\t\t\tif contains(.withSpaceBetweenDateAndTime) {\n\t\t\t\t\tformat += \" \"\n\t\t\t\t} else {\n\t\t\t\t\tformat += \"'T'\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif contains(.withFullTime) {\n\t\t\t\tformat += \"HH:mm:ssZZZZZ\"\n\t\t\t} else {\n\t\t\t\tif contains(.withTime) {\n\t\t\t\t\tformat += \"HH:mm:ss\"\n\t\t\t\t}\n\t\t\t\tif contains(.withTimeZone) {\n\t\t\t\t\tif contains(.withoutTZSeparators) {\n\t\t\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ\"\n\t\t\t\t\t}\n\t\t\t\t\tformat += \"ZZZZZ\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn format\n\t\t}\n\t}\n\n\tpublic static func format(_ date: DateRepresentable, options: Any?) -> String {\n\t\tlet formatOptions = ((options as? ISOFormatter.Options) ?? ISOFormatter.Options([.withInternetDateTime]))\n\t\tlet formatter = date.formatter(format: formatOptions.dateFormat) {\n\t\t\t$0.locale = Locales.englishUnitedStatesComputer.toLocale() // fix for 12/24h\n\t\t\t$0.timeZone = date.region.timeZone\n\t\t\t$0.calendar = Calendars.gregorian.toCalendar()\n\t\t}\n\t\treturn formatter.string(from: date.date)\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/ISOParser.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\n// swiftlint:disable file_length\n\nimport Foundation\n\n/// This defines all possible errors you can encounter parsing ISO8601 string\n///\n/// - eof: end of file\n/// - notDigit: expected digit, value cannot be parsed as int\n/// - notDouble: expected double digit, value cannot be parsed as double\n/// - invalid: invalid state reached. Something in the format is not correct\npublic enum ISO8601ParserError: Error {\n\tcase eof\n\tcase notDigit\n\tcase notDouble\n\tcase invalid\n}\n\nfileprivate extension Int {\n\n\t/// Return `true` if current year is a leap year, `false` otherwise\n\tvar isLeapYear: Bool {\n\t\treturn ((self % 4) == 0) && (((self % 100) != 0) || ((self % 400) == 0))\n\t}\n\n}\n\n// MARK: - Internal Extension for UnicodeScalar type\n\ninternal extension UnicodeScalar {\n\n\t/// return `true` if current character is a digit (arabic), `false` otherwise\n\tvar isDigit: Bool {\n\t\treturn \"0\"...\"9\" ~= self\n\t}\n\n\t/// return `true` if current character is a space\n\tvar isSpace: Bool {\n\t\treturn CharacterSet.whitespaces.contains(self)\n\t}\n\n}\n\n/// This is the ISO8601 Parser class: it evaluates automatically the format of the ISO8601 date\n/// and attempt to parse it in a valid `Date` object.\n/// Resulting date also includes Time Zone settings and a property which allows you to inspect\n/// single date components.\n///\n/// This work is inspired to the original ISO8601DateFormatter class written in ObjC by\n/// Peter Hosey (available here https://bitbucket.org/boredzo/iso-8601-parser-unparser).\n/// I've made a Swift porting and fixed some issues when parsing several ISO8601 date variants.\n\n// swiftlint:disable type_body_length\npublic class ISOParser: StringToDateTransformable {\n\n\t/// Internal structure\n\tinternal enum Weekday: Int {\n\t\tcase monday = 0\n\t\tcase tuesday = 1\n\t\tcase wednesday = 2\n\t\tcase thursday = 3\n\t}\n\n\tpublic struct Options {\n\n\t\t/// Time separator character. By default is `:`.\n\t\tvar time_separator: ISOParser.ISOChar = \":\"\n\n\t\t/// Strict parsing. By default is `false`.\n\t\tvar strict: Bool = false\n\n\t\tpublic init(strict: Bool = false) {\n\t\t\tself.strict = strict\n\t\t}\n\t}\n\n\t/// Some typealias to make the code cleaner\n\tpublic typealias ISOString = String.UnicodeScalarView\n\tpublic typealias ISOIndex = String.UnicodeScalarView.Index\n\tpublic typealias ISOChar = UnicodeScalar\n\tpublic typealias ISOParsedDate\t= (date: Date?, timezone: TimeZone?)\n\n\t/// This represent the internal parser status representation\n\tpublic struct ParsedDate {\n\n\t\t/// Type of date parsed\n\t\t///\n\t\t/// - monthAndDate: month and date style\n\t\t/// - week: date with week number\n\t\t/// - dateOnly: date only\n\t\t// swiftlint:disable nesting\n\t\tpublic enum DateStyle {\n\t\t\tcase monthAndDate\n\t\t\tcase week\n\t\t\tcase dateOnly\n\t\t}\n\n\t\t/// Parsed year value\n\t\tvar year: Int = 0\n\n\t\t/// Parsed month or week number\n\t\tvar month_or_week:\tInt = 0\n\n\t\t/// Parsed day value\n\t\tvar day: Int = 0\n\n\t\t/// Parsed hour value\n\t\tvar hour: Int = 0\n\n\t\t/// Parsed minutes value\n\t\tvar minute: TimeInterval = 0.0\n\n\t\t/// Parsed seconds value\n\t\tvar seconds: TimeInterval = 0.0\n\n\t\t/// Parsed nanoseconds value\n\t\tvar nanoseconds:\tTimeInterval = 0.0\n\n\t\t/// Parsed weekday number (1=monday, 7=sunday)\n\t\t/// If `nil` source string has not specs about weekday.\n\t\tvar weekday: Int?\n\n\t\t/// Timezone parsed hour value\n\t\tvar tz_hour: Int = 0\n\n\t\t/// Timezone parsed minute value\n\t\tvar tz_minute: Int = 0\n\n\t\t/// Type of parsed date\n\t\tvar type: DateStyle = .monthAndDate\n\n\t\t/// Parsed timezone object\n\t\tvar timezone: TimeZone?\n\t}\n\n\t/// Source generation calendar.\n\tprivate var srcCalendar = Calendars.gregorian.toCalendar()\n\n\t/// Source raw parsed values\n\tprivate var date = ParsedDate()\n\n\t/// Source string represented as unicode scalars\n\tprivate var string: ISOString\n\n\t/// Current position of the parser in source string.\n\t/// Initially is equal to `string.startIndex`\n\tprivate var cIdx: ISOIndex\n\n\t/// Just a shortcut to the last index in source string\n\tprivate var eIdx: ISOIndex\n\n\t/// Lenght of the string\n\tprivate var length: Int\n\n\t/// Number of hyphens characters found before any value\n\t/// Consequential \"-\" are used to define implicit values in dates.\n\tprivate var hyphens:\tInt = 0\n\n\t/// Private date components used for default values\n\tprivate var now_cmps:\tDateComponents\n\n\t/// Configuration used for parser\n\tprivate var options: ISOParser.Options\n\n\t/// Date components parsed\n\tprivate(set) var date_components: DateComponents?\n\n\t/// Parsed date\n\tprivate(set) var parsedDate: Date?\n\n\t/// Parsed timezone\n\tprivate(set) var parsedTimeZone: TimeZone?\n\n\t/// Date adjusted at parsed timezone\n\tprivate var dateInTimezone: Date? {\n\t\tget {\n\t\t\tsrcCalendar.timeZone = date.timezone ?? TimeZone(identifier: \"UTC\")!\n\t\t\treturn srcCalendar.date(from: date_components!)\n\t\t}\n\t}\n\n\t/// Initialize a new parser with a source ISO8601 string to parse\n\t/// Parsing is done during initialization; any exception is reported\n\t/// before allocating.\n\t///\n\t/// - Parameters:\n\t///   - src: source ISO8601 string\n\t///   - config: configuration used for parsing\n\t/// - Throws: throw an `ISO8601Error` if parsing operation fails\n\n\tpublic init?(_ src: String, options: ISOParser.Options? = nil) {\n\t\tlet src_trimmed = src.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)\n\t\tguard src_trimmed.count > 0 else {\n\t\t\treturn nil\n\t\t}\n\t\tstring = src_trimmed.unicodeScalars\n\t\tlength = src_trimmed.count\n\t\tcIdx = string.startIndex\n\t\teIdx = string.endIndex\n\t\tself.options = (options ?? ISOParser.Options())\n\t\tself.now_cmps = srcCalendar.dateComponents([.year, .month, .day], from: Date())\n\n\t\tvar idx = cIdx\n\t\twhile idx < eIdx {\n\t\t\tif string[idx] == \"-\" { hyphens += 1 } else { break }\n\t\t\tidx = string.index(after: idx)\n\t\t}\n\n\t\tdo {\n\t\t\ttry parse()\n\t\t} catch {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// MARK: - Internal Parser\n\n\t/// Private parsing function\n\t///\n\t/// - Throws: throw an `ISO8601Error` if parsing operation fails\n\t@discardableResult\n\tprivate func parse() throws -> ISOParsedDate {\n\n\t\t// PARSE DATE\n\n\t\tif current() == \"T\" {\n\t\t\t// There is no date here, only a time.\n\t\t\t// Set the date to now; then we'll parse the time.\n\t\t\tnext()\n\t\t\tguard current()?.isDigit ?? false else {\n\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t}\n\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = now_cmps.month!\n\t\t\tdate.day = now_cmps.day!\n\t\t} else {\n\t\t\tmoveUntil(is: \"-\")\n\t\t\tlet is_time_only = (string.contains(\"T\") == false && string.contains(\":\") && !string.contains(\"-\"))\n\n\t\t\tif is_time_only == false {\n\t\t\t\tvar (num_digits, segment) = try read_int()\n\t\t\t\tswitch num_digits {\n\t\t\t\tcase 0:\t\ttry parse_digits_0(num_digits, &segment)\n\t\t\t\tcase 8:\t\ttry parse_digits_8(num_digits, &segment)\n\t\t\t\tcase 6:\t\ttry parse_digits_6(num_digits, &segment)\n\t\t\t\tcase 4:\t\ttry parse_digits_4(num_digits, &segment)\n\t\t\t\tcase 5:\t\ttry parse_digits_5(num_digits, &segment)\n\t\t\t\tcase 1:\t\ttry parse_digits_1(num_digits, &segment)\n\t\t\t\tcase 2:\t\ttry parse_digits_2(num_digits, &segment)\n\t\t\t\tcase 7:\t\ttry parse_digits_7(num_digits, &segment) //YYYY DDD (ordinal date)\n\t\t\t\tcase 3:\t\ttry parse_digits_3(num_digits, &segment) //--DDD (ordinal date, implicit year)\n\t\t\t\tdefault:\tthrow ISO8601ParserError.invalid\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdate.year = now_cmps.year!\n\t\t\t\tdate.month_or_week = now_cmps.month!\n\t\t\t\tdate.day = now_cmps.day!\n\t\t\t}\n\t\t}\n\n\t\tvar hasTime = false\n\t\tif current()?.isSpace ?? false || current() == \"T\" {\n\t\t\thasTime = true\n\t\t\tnext()\n\t\t}\n\n\t\t// PARSE TIME\n\n\t\tif current()?.isDigit ?? false == true {\n\t\t\tlet time_sep = options.time_separator\n\t\t\tlet hasTimeSeparator = string.contains(time_sep)\n\n\t\t\tdate.hour = try read_int(2).value\n\n\t\t\tif hasTimeSeparator == false && hasTime {\n\t\t\t\tdate.minute = TimeInterval(try read_int(2).value)\n\t\t\t} else if current() == time_sep {\n\t\t\t\tnext()\n\n\t\t\t\tif time_sep == \",\" || time_sep == \".\" {\n\t\t\t\t\t//We can't do fractional minutes when '.' is the segment separator.\n\t\t\t\t\t//Only allow whole minutes and whole seconds.\n\t\t\t\t\tdate.minute = TimeInterval(try read_int(2).value)\n\t\t\t\t\tif current() == time_sep {\n\t\t\t\t\t\tnext()\n\t\t\t\t\t\tdate.seconds = TimeInterval(try read_int(2).value)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//Allow a fractional minute.\n\t\t\t\t\t//If we don't get a fraction, look for a seconds segment.\n\t\t\t\t\t//Otherwise, the fraction of a minute is the seconds.\n\t\t\t\t\tdate.minute = try read_double().value\n\n\t\t\t\t\tif current() != \":\" {\n\t\t\t\t\t\tvar int_part: Double = 0.0\n\t\t\t\t\t\tvar frac_part: Double = 0.0\n\t\t\t\t\t\tfrac_part = modf(date.minute, &int_part)\n\t\t\t\t\t\tdate.minute = int_part\n\t\t\t\t\t\tdate.seconds = frac_part\n\t\t\t\t\t\tif date.seconds > Double.ulpOfOne {\n\t\t\t\t\t\t\t// Convert fraction (e.g. .5) into seconds (e.g. 30).\n\t\t\t\t\t\t\tdate.seconds *= 60\n\t\t\t\t\t\t} else if current() == time_sep {\n\t\t\t\t\t\t\tnext()\n\t\t\t\t\t\t\t//\tdate.seconds = try read_double().value\n\t\t\t\t\t\t\tlet value = try modf(read_double().value)\n\t\t\t\t\t\t\tdate.nanoseconds = TimeInterval(round(value.1 * 1000) * 1_000_000)\n\t\t\t\t\t\t\tdate.seconds = TimeInterval(value.0)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// fractional minutes\n\t\t\t\t\t\tnext()\n\t\t\t\t\t\tlet value = try modf(read_double().value)\n\t\t\t\t\t\tdate.nanoseconds = TimeInterval(round(value.1 * 1000) * 1_000_000)\n\t\t\t\t\t\tdate.seconds = TimeInterval(value.0)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif options.strict == false {\n\t\t\t\tif cIdx != eIdx && current()?.isSpace ?? false == true {\n\t\t\t\t\tnext()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif cIdx != eIdx {\n\t\t\t\tswitch current() {\n\t\t\t\tcase \"Z\":\n\t\t\t\t\tdate.timezone = TimeZone(abbreviation: \"UTC\")\n\n\t\t\t\tcase \"+\", \"-\":\n\t\t\t\t\tlet is_negative = current() == \"-\"\n\t\t\t\t\tnext()\n\t\t\t\t\tif current()?.isDigit ?? false == true {\n\t\t\t\t\t\t//Read hour offset.\n\t\t\t\t\t\tdate.tz_hour = try read_int(2).value\n\t\t\t\t\t\tif is_negative == true { date.tz_hour = -date.tz_hour }\n\n\t\t\t\t\t\t// Optional separator\n\t\t\t\t\t\tif current() == time_sep {\n\t\t\t\t\t\t\tnext()\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif current()?.isDigit ?? false {\n\t\t\t\t\t\t\t// Read minute offset\n\t\t\t\t\t\t\tdate.tz_minute = try read_int(2).value\n\t\t\t\t\t\t\tif is_negative == true { date.tz_minute = -date.tz_minute }\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet timezone_offset = (date.tz_hour * 3600) + (date.tz_minute * 60)\n\t\t\t\t\t\tdate.timezone = TimeZone(secondsFromGMT: timezone_offset)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdate_components = DateComponents()\n\t\tdate_components!.year = date.year\n\t\tdate_components!.day = date.day\n\t\tdate_components!.hour = date.hour\n\t\tdate_components!.minute = Int(date.minute)\n\t\tdate_components!.second = Int(date.seconds)\n\t\tdate_components!.nanosecond = Int(date.nanoseconds)\n\n\t\tswitch date.type {\n\t\tcase .monthAndDate:\n\t\t\tdate_components!.month = date.month_or_week\n\t\tcase .week:\n\t\t\t//Adapted from <http://personal.ecu.edu/mccartyr/ISOwdALG.txt>.\n\t\t\t//This works by converting the week date into an ordinal date, then letting the next case handle it.\n\t\t\tlet prevYear = date.year - 1\n\t\t\tlet YY = prevYear % 100\n\t\t\tlet prevC = prevYear - YY\n\t\t\tlet prevG = YY + YY / 4\n\t\t\tlet isLeapYear = (((prevC / 100) % 4) * 5)\n\t\t\tlet jan1Weekday = ((isLeapYear + prevG) % 7)\n\n\t\t\tvar day = ((8 - jan1Weekday) + (7 * (jan1Weekday > Weekday.thursday.rawValue ? 1 : 0)))\n\t\t\tday += (date.day - 1) + (7 * (date.month_or_week - 2))\n\n\t\t\tif let weekday = date.weekday {\n\t\t\t\t//date_components!.weekday = weekday\n\t\t\t\tdate_components!.day = day + weekday\n\t\t\t} else {\n\t\t\t\tdate_components!.day = day\n\t\t\t}\n\t\tcase .dateOnly: //An \"ordinal date\".\n\t\t\tbreak\n\n\t\t}\n\n\t\t//cfg.calendar.timeZone = date.timezone ?? TimeZone(identifier: \"UTC\")!\n\t\t//parsedDate = cfg.calendar.date(from: date_components!)\n\n\t\tlet tz = date.timezone ?? TimeZone(identifier: \"UTC\")!\n\t\tparsedTimeZone = tz\n\t\tsrcCalendar.timeZone = tz\n\t\tparsedDate = srcCalendar.date(from: date_components!)\n\n\t\treturn (parsedDate, parsedTimeZone)\n\t}\n\n\tprivate func parse_digits_3(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t//Technically, the standard only allows one hyphen. But it says that two hyphens is the logical implementation, and one was dropped for brevity. So I have chosen to allow the missing hyphen.\n\t\tif hyphens < 1 || (hyphens > 2 && options.strict == false) {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tdate.day = segment\n\t\tdate.year = now_cmps.year!\n\t\tdate.type = .dateOnly\n\t\tif options.strict == true && (date.day > (365 + (date.year.isLeapYear ? 1 : 0))) {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parse_digits_7(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tguard hyphens == 0 else { throw ISO8601ParserError.invalid }\n\n\t\tdate.day = segment % 1000\n\t\tdate.year = segment / 1000\n\t\tdate.type = .dateOnly\n\t\tif options.strict == true && (date.day > (365 + (date.year.isLeapYear ? 1 : 0))) {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parse_digits_2(_ num_digits: Int, _ segment: inout Int) throws {\n\n\t\tfunc parse_hyphens_3(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = now_cmps.month!\n\t\t\tdate.day = segment\n\t\t}\n\n\t\tfunc parse_hyphens_2(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = segment\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t\tdate.day = try read_int(2).value\n\t\t\t} else {\n\t\t\t\tdate.day = 1\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_1(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tlet current_year = now_cmps.year!\n\t\t\tlet current_century = (current_year % 100)\n\t\t\tdate.year = segment + (current_year - current_century)\n\t\t\tif num_digits == 1 { // implied decade\n\t\t\t\tdate.year += current_century - (current_year % 10)\n\t\t\t}\n\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t\tif current() == \"W\" {\n\t\t\t\t\tnext()\n\t\t\t\t\tdate.type = .week\n\t\t\t\t}\n\t\t\t\tdate.month_or_week = try read_int(2).value\n\n\t\t\t\tif current() == \"-\" {\n\t\t\t\t\tnext()\n\t\t\t\t\tif date.type == .week {\n\t\t\t\t\t\t// weekday number\n\t\t\t\t\t\tlet weekday = try read_int().value\n\t\t\t\t\t\tif weekday > 7 {\n\t\t\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdate.weekday = weekday\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdate.day = try read_int().value\n\t\t\t\t\t\tif date.day == 0 {\n\t\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif date.month_or_week == 0 {\n\t\t\t\t\t\t\tdate.month_or_week = 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tdate.day = 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdate.month_or_week = 1\n\t\t\t\tdate.day = 1\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_0(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tif current() == \"-\" {\n\t\t\t\t// Implicit century\n\t\t\t\tdate.year = now_cmps.year!\n\t\t\t\tdate.year -= (date.year % 100)\n\t\t\t\tdate.year += segment\n\n\t\t\t\tnext()\n\t\t\t\tif current() == \"W\" {\n\t\t\t\t\ttry parseWeekAndDay()\n\t\t\t\t} else if current()?.isDigit ?? false == false {\n\t\t\t\t\ttry centuryOnly(&segment)\n\t\t\t\t} else {\n\t\t\t\t\t// Get month and/or date.\n\t\t\t\t\tlet (v_count, v_seg) = try read_int()\n\t\t\t\t\tswitch v_count {\n\t\t\t\t\tcase 4: // YY-MMDD\n\t\t\t\t\t\tdate.day = v_seg % 100\n\t\t\t\t\t\tdate.month_or_week = v_seg / 100\n\t\t\t\t\tcase 1: // YY-M; YY-M-DD (extension)\n\t\t\t\t\t\tif options.strict == true {\n\t\t\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 2: // YY-MM; YY-MM-DD\n\t\t\t\t\t\tdate.month_or_week = v_seg\n\t\t\t\t\t\tif current() == \"-\" {\n\t\t\t\t\t\t\tnext()\n\t\t\t\t\t\t\tif current()?.isDigit ?? false == true {\n\t\t\t\t\t\t\t\tdate.day = try read_int(2).value\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 3: // Ordinal date\n\t\t\t\t\t\tdate.day = v_seg\n\t\t\t\t\t\tdate.type = .dateOnly\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if current() == \"W\" {\n\t\t\t\tdate.year = now_cmps.year!\n\t\t\t\tdate.year -= (date.year % 100)\n\t\t\t\tdate.year += segment\n\n\t\t\t\ttry parseWeekAndDay()\n\t\t\t} else {\n\t\t\t\ttry centuryOnly(&segment)\n\t\t\t}\n\t\t}\n\n\t\tswitch hyphens {\n\t\tcase 0:\t\ttry parse_hyphens_0(num_digits, &segment)\n\t\tcase 1:\t\ttry parse_hyphens_1(num_digits, &segment) //-YY; -YY-MM (implicit century)\n\t\tcase 2:\t\ttry parse_hyphens_2(num_digits, &segment) //--MM; --MM-DD\n\t\tcase 3:\t\ttry parse_hyphens_3(num_digits, &segment) //---DD\n\t\tdefault:\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parse_digits_1(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tif options.strict == true {\n\t\t\t// Two digits only - never just one.\n\t\t\tguard hyphens == 1 else { throw ISO8601ParserError.invalid }\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t}\n\t\t\tnext()\n\t\t\tguard current() == \"W\" else { throw ISO8601ParserError.invalid }\n\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.year -= (date.year % 10)\n\t\t\tdate.year += segment\n\t\t} else {\n\t\t\ttry parse_digits_2(num_digits, &segment)\n\t\t}\n\t}\n\n\tprivate func parse_digits_5(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tguard hyphens == 0 else { throw ISO8601ParserError.invalid }\n\t\t// YYDDD\n\t\tdate.year = now_cmps.year!\n\t\tdate.year -= (date.year % 100)\n\t\tdate.year += segment / 1000\n\n\t\tdate.day = segment % 1000\n\t\tdate.type = .dateOnly\n\t}\n\n\tprivate func parse_digits_4(_ num_digits: Int, _ segment: inout Int) throws {\n\n\t\tfunc parse_hyphens_0(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.year = segment\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t}\n\n\t\t\tif current()?.isDigit ?? false == false {\n\t\t\t\tif current() == \"W\" {\n\t\t\t\t\ttry parseWeekAndDay()\n\t\t\t\t} else {\n\t\t\t\t\tdate.month_or_week = 1\n\t\t\t\t\tdate.day = 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlet (v_num, v_seg) = try read_int()\n\t\t\t\tswitch v_num {\n\t\t\t\tcase 4: // MMDD\n\t\t\t\t\tdate.day = v_seg % 100\n\t\t\t\t\tdate.month_or_week = v_seg / 100\n\t\t\t\tcase 2: // MM\n\t\t\t\t\tdate.month_or_week = v_seg\n\n\t\t\t\t\tif current() == \"-\" {\n\t\t\t\t\t\tnext()\n\t\t\t\t\t}\n\t\t\t\t\tif current()?.isDigit ?? false == false {\n\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdate.day = try read_int().value\n\t\t\t\t\t}\n\t\t\t\tcase 3: // DDD\n\t\t\t\t\tdate.day = v_seg % 1000\n\t\t\t\t\tdate.type = .dateOnly\n\t\t\t\t\tif options.strict == true && (date.day > 365 + (date.year.isLeapYear ? 1 : 0)) {\n\t\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_1(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.month_or_week = segment % 100\n\t\t\tdate.year = segment / 100\n\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t}\n\t\t\tif current()?.isDigit ?? false == false {\n\t\t\t\tdate.day = 1\n\t\t\t} else {\n\t\t\t\tdate.day = try read_int().value\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_2(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.day = segment % 100\n\t\t\tdate.month_or_week = segment / 100\n\t\t\tdate.year = now_cmps.year!\n\t\t}\n\n\t\tswitch hyphens {\n\t\tcase 0:\t\ttry parse_hyphens_0(num_digits, &segment) // YYYY\n\t\tcase 1:\t\ttry parse_hyphens_1(num_digits, &segment) // YYMM\n\t\tcase 2:\t\ttry parse_hyphens_2(num_digits, &segment) // MMDD\n\t\tdefault:\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t}\n\n\tprivate func parse_digits_6(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t// YYMMDD (implicit century)\n\t\tguard hyphens == 0 else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tdate.day = segment % 100\n\t\tsegment /= 100\n\t\tdate.month_or_week = segment % 100\n\t\tdate.year = now_cmps.year!\n\t\tdate.year -= (date.year % 100)\n\t\tdate.year += (segment / 100)\n\t}\n\n\tprivate func parse_digits_8(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t// YYYY MM DD\n\t\tguard hyphens == 0 else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tdate.day = segment % 100\n\t\tsegment /= 100\n\t\tdate.month_or_week = segment % 100\n\t\tdate.year = segment / 100\n\t}\n\n\tprivate func parse_digits_0(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tguard current() == \"W\" else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tif seek(1) == \"-\" && isDigit(seek(2)) &&\n\t\t\t((hyphens == 1 || hyphens == 2) && options.strict == false) {\n\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = 1\n\t\t\tnext(2)\n\t\t\ttry parseDayAfterWeek()\n\t\t} else if hyphens == 1 {\n\t\t\tdate.year = now_cmps.year!\n\t\t\tif current() == \"W\" {\n\t\t\t\tnext()\n\t\t\t\tdate.month_or_week = try read_int(2).value\n\t\t\t\tdate.type = .week\n\t\t\t\ttry parseWeekday()\n\t\t\t} else {\n\t\t\t\ttry parseDayAfterWeek()\n\t\t\t}\n\t\t} else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parseWeekday() throws {\n\t\tif current() == \"-\" {\n\t\t\tnext()\n\t\t}\n\t\tlet weekday = try read_int().value\n\t\tif weekday > 7 {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t\tdate.type = .week\n\t\tdate.weekday = weekday\n\t}\n\n\tprivate func parseWeekAndDay() throws {\n\t\tnext()\n\t\tif current()?.isDigit ?? false == false {\n\t\t\t//Not really a week-based date; just a year followed by '-W'.\n\t\t\tguard options.strict == false else {\n\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t}\n\t\t\tdate.month_or_week = 1\n\t\t\tdate.day = 1\n\t\t} else {\n\t\t\tdate.month_or_week = try read_int(2).value\n\t\t\ttry parseWeekday()\n\t\t}\n\t}\n\n\tprivate func parseDayAfterWeek() throws {\n\t\tdate.day = current()?.isDigit ?? false == true ? try read_int(2).value : 1\n\t\tdate.type = .week\n\t}\n\n\tprivate func centuryOnly(_ segment: inout Int) throws {\n\t\tdate.year = segment * 100 + now_cmps.year! % 100\n\t\tdate.month_or_week = 1\n\t\tdate.day = 1\n\t}\n\n\t/// Return `true` if given character is a char\n\t///\n\t/// - Parameter char: char to evaluate\n\t/// - Returns: `true` if char is a digit, `false` otherwise\n\tprivate func isDigit(_ char: UnicodeScalar?) -> Bool {\n\t\tguard let char = char else { return false }\n\t\treturn char.isDigit\n\t}\n\n\t// MARK: - Scanner internal functions\n\n\t/// Get the value at specified offset from current scanner position without\n\t/// moving the current scanner's index.\n\t///\n\t/// - Parameter offset: offset to move\n\t/// - Returns: char at given position, `nil` if not found\n\t@discardableResult\n\tpublic func seek(_ offset: Int = 1) -> ISOChar? {\n\t\tlet move_idx = string.index(cIdx, offsetBy: offset)\n\t\tguard move_idx < eIdx else {\n\t\t\treturn nil\n\t\t}\n\t\treturn string[move_idx]\n\t}\n\n\t/// Return the char at the current position of the scanner\n\t///\n\t/// - Parameter next: if `true` return the current char and move to the next position\n\t/// - Returns: the char sat the current position of the scanner\n\t@discardableResult\n\tpublic func current(_ next: Bool = false) -> ISOChar? {\n\t\tguard cIdx != eIdx else { return nil }\n\t\tlet current = string[cIdx]\n\t\tif next == true { cIdx = string.index(after: cIdx) }\n\t\treturn current\n\t}\n\n\t/// Move by `offset` characters the index of the scanner and return the char at the current\n\t/// position. If EOF is reached `nil` is returned.\n\t///\n\t/// - Parameter offset: offset value (use negative number to move backwards)\n\t/// - Returns: character at the current position.\n\t@discardableResult\n\tprivate func next(_ offset: Int = 1) -> ISOChar? {\n\t\tlet next = string.index(cIdx, offsetBy: offset)\n\t\tguard next < eIdx else {\n\t\t\treturn nil\n\t\t}\n\t\tcIdx = next\n\t\treturn string[cIdx]\n\t}\n\n\t/// Read from the current scanner index and parse the value as Int.\n\t///\n\t/// - Parameter max_count: number of characters to move. If nil scanners continues until a non\n\t///   digit value is encountered.\n\t/// - Returns: parsed value\n\t/// - Throws: throw an exception if parser fails\n\t@discardableResult\n\tprivate func read_int(_ max_count: Int? = nil) throws -> (count: Int, value: Int) {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\twhile move_idx < eIdx {\n\t\t\tif let max = max_count, count >= max { break }\n\t\t\tif string[move_idx].isDigit == false { break }\n\t\t\tcount += 1\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t}\n\n\t\tlet raw_value = String(string[cIdx..<move_idx])\n\t\tif raw_value == \"\" {\n\t\t\treturn (count, 0)\n\t\t}\n\t\tguard let value = Int(raw_value) else {\n\t\t\tthrow ISO8601ParserError.notDigit\n\t\t}\n\n\t\tcIdx = move_idx\n\t\treturn (count, value)\n\t}\n\n\t/// Read from the current scanner index and parse the value as Double.\n\t/// If parser fails an exception is throw.\n\t/// Unit separator can be `-` or `,`.\n\t///\n\t/// - Returns: double value\n\t/// - Throws: throw an exception if parser fails\n\t@discardableResult\n\tprivate func read_double() throws -> (count: Int, value: Double) {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\tvar fractional_start = false\n\t\twhile move_idx < eIdx {\n\t\t\tlet char = string[move_idx]\n\t\t\tif char == \".\" || char == \",\" {\n\t\t\t\tif fractional_start == true { throw ISO8601ParserError.notDouble } else { fractional_start = true }\n\t\t\t} else {\n\t\t\t\tif char.isDigit == false { break }\n\t\t\t}\n\t\t\tcount += 1\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t}\n\n\t\tlet raw_value = String(string[cIdx..<move_idx]).replacingOccurrences(of: \",\", with: \".\")\n\t\tif raw_value == \"\" {\n\t\t\treturn (count, 0.0)\n\t\t}\n\t\tguard let value = Double(raw_value) else {\n\t\t\tthrow ISO8601ParserError.notDouble\n\t\t}\n\t\tcIdx = move_idx\n\t\treturn (count, value)\n\t}\n\n\t/// Move the current scanner index to the next position until the current char of the scanner\n\t/// is the given `char` value.\n\t///\n\t/// - Parameter char: char\n\t/// - Returns: the number of characters passed\n\t@discardableResult\n\tprivate func moveUntil(is char: UnicodeScalar) -> Int {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\twhile move_idx < eIdx {\n\t\t\tguard string[move_idx] == char else { break }\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t\tcount += 1\n\t\t}\n\t\tcIdx = move_idx\n\t\treturn count\n\t}\n\n\t/// Move the current scanner index to the next position until passed `char` value is\n\t/// encountered or `eof` is reached.\n\t///\n\t/// - Parameter char: char\n\t/// - Returns: the number of characters passed\n\t@discardableResult\n\tprivate func moveUntil(isNot char: UnicodeScalar) -> Int {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\twhile move_idx < eIdx {\n\t\t\tguard string[move_idx] != char else { break }\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t\tcount += 1\n\t\t}\n\t\tcIdx = move_idx\n\t\treturn count\n\t}\n\n\t/// Return a date parsed from a valid ISO8601 string\n\t///\n\t/// - Parameter string: source string\n\t/// - Returns: a valid `Date` object or `nil` if date cannot be parsed\n\tpublic static func date(from string: String) -> ISOParsedDate? {\n\t\tguard let parser = ISOParser(string) else {\n\t\t\treturn nil\n\t\t}\n\t\treturn (parser.parsedDate, parser.parsedTimeZone)\n\t}\n\n\tpublic static func parse(_ string: String, region: Region?, options: Any?) -> DateInRegion? {\n\t\tlet formatOptions = options as? ISOParser.Options\n\t\tguard let parser = ISOParser(string, options: formatOptions),\n\t\t\tlet date = parser.parsedDate else {\n\t\t\treturn nil\n\t\t}\n\t\tlet parsedRegion = Region(calendar: region?.calendar ?? Region.ISO.calendar,\n\t\t\t\t\t\t\t\t  zone: (region?.timeZone ?? parser.parsedTimeZone ?? Region.ISO.timeZone),\n\t\t\t\t\t\t\t\t  locale: region?.locale ?? Region.ISO.locale)\n\t\treturn DateInRegion(date, region: parsedRegion)\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/RelativeFormatter+Style.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n#if os(Linux)\nimport Glibc\n#else\nimport Darwin\n#endif\n\n// MARK: - Style\n\npublic extension RelativeFormatter {\n\n\tenum PluralForm: String {\n\t\tcase zero, one, two, few, many, other\n\t}\n\n\t/// Style for formatter\n\tstruct Style {\n\n\t\t/// Flavours supported by the style, specified in order.\n\t\t/// The first available flavour for specified locale is used.\n\t\t/// If no flavour is available `.long` is used instead (this flavour\n\t\t/// MUST be part of every lang structure).\n\t\tpublic var flavours: [Flavour]\n\n\t\t/// Gradation specify how the unit are evaluated in order to get the\n\t\t/// best one to represent a given amount of time interval.\n\t\t/// By default `convenient()` is used.\n\t\tpublic var gradation: Gradation = .convenient()\n\n\t\t/// Allowed time units the style can use. Some styles may not include\n\t\t/// some time units (ie. `.quarter`) because they are not useful for\n\t\t/// a given representation.\n\t\t/// If not specified all the following units are set:\n\t\t/// `.now, .minute, .hour, .day, .week, .month, .year`\n\t\tpublic var allowedUnits: [Unit]?\n\n\t\t/// Create a new style.\n\t\t///\n\t\t/// - Parameters:\n\t\t///   - flavours: flavours of the style.\n\t\t///   - gradation: gradation rules.\n\t\t///   - units: allowed units.\n\t\tpublic init(flavours: [Flavour], gradation: Gradation, allowedUnits units: [Unit]? = nil) {\n            self.flavours = flavours\n\t\t\tself.gradation = gradation\n\t\t\tallowedUnits = (units ?? [.now, .minute, .hour, .day, .week, .month, .year])\n\t\t}\n\t}\n\n\t/// Return the default style for relative formatter.\n\t///\n\t/// - Returns: style instance.\n\tstatic func defaultStyle() -> Style {\n\t\treturn Style(flavours: [.longConvenient, .long], gradation: .convenient())\n\t}\n\n\t/// Return the time-only style for relative formatter.\n\t///\n\t/// - Returns: style instance.\n\tstatic func timeStyle() -> Style {\n\t\treturn Style(flavours: [.longTime], gradation: .convenient())\n\t}\n\t/// Return the twitter style for relative formatter.\n\t///\n\t/// - Returns: style instance.\n\tstatic func twitterStyle() -> Style {\n\t\treturn Style(flavours: [.tiny, .shortTime, .narrow, .shortTime], gradation: .twitter())\n\t}\n\n}\n\n// MARK: - Flavour\n\npublic extension RelativeFormatter {\n\n\t/// Supported flavours\n\tenum Flavour: String {\n\t\tcase long \t\t\t\t= \"long\"\n\t\tcase longTime \t\t\t= \"long_time\"\n\t\tcase longConvenient\t \t= \"long_convenient\"\n\t\tcase short \t\t\t\t= \"short\"\n\t\tcase shortTime \t\t\t= \"short_time\"\n\t\tcase shortConvenient \t= \"short_convenient\"\n\t\tcase narrow \t\t\t= \"narrow\"\n\t\tcase tiny \t\t\t\t= \"tiny\"\n\t\tcase quantify \t\t\t= \"quantify\"\n\t}\n\n}\n\n// MARK: - Gradation\n\npublic extension RelativeFormatter {\n\n\t/// Gradation is used to define a set of rules used to get the best\n\t/// representation of a given elapsed time interval (ie. the best\n\t/// representation for 300 seconds is in minutes, 5 minutes specifically).\n\t/// Rules are executed in order by the parser and the best one (< elapsed interval)\n\t/// is returned to be used by the formatter.\n\tstruct Gradation {\n\n\t\t/// A single Gradation rule specification\n\t\t// swiftlint:disable nesting\n\t\tpublic struct Rule {\n\n\t\t\tpublic enum ThresholdType {\n\t\t\t\tcase value(_: Double?)\n\t\t\t\tcase function(_: ((TimeInterval) -> (Double?)))\n\n\t\t\t\tfunc evaluateForTimeInterval(_ elapsed: TimeInterval) -> Double? {\n\t\t\t\t\tswitch self {\n\t\t\t\t\tcase .value(let value): \t\treturn value\n\t\t\t\t\tcase .function(let function): \treturn function(elapsed)\n\t\t\t\t\t}\n\t\t\t\t}\n\n            }\n\n            public enum RoundingStrategy {\n\n                case regularRound\n                case ceiling\n                case flooring\n                case custom((Double) -> Double)\n\n                func roundValue(_ value: Double) -> Double {\n\n                    switch self {\n                    case .regularRound:                 return round(value)\n                    case .ceiling:                      return ceil(value)\n                    case .flooring:                     return floor(value)\n                    case .custom(let roundingFunction): return roundingFunction(value)\n                    }\n                }\n            }\n\n\t\t\t/// The time unit to which the rule refers.\n\t\t\t/// It's used to evaluate the factor.\n\t\t\tpublic var unit: Unit\n\n\t\t\t/// Threhsold value of the unit. When a difference between two dates\n\t\t\t/// is less than the threshold the unit before this is the best\n\t\t\t/// candidate to represent the time interval.\n\t\t\tpublic var threshold: ThresholdType?\n\n\t\t\t/// Granuality threshold of the unit\n\t\t\tpublic var granularity: Double?\n\n            /// The rounding strategy that should be used prior to generating the relative time\n            public var roundingStrategy: RoundingStrategy\n\n\t\t\t/// Relation with a previous threshold\n\t\t\tpublic var thresholdPrevious: [Unit: Double]?\n\n\t\t\t/// You can specify a custom formatter for a rule which return the\n\t\t\t/// string representation of a data with your own pattern.\n\t\t\t// swiftlint:disable nesting\n\t\t\tpublic typealias CustomFormatter = ((DateRepresentable) -> (String))\n\t\t\tpublic var customFormatter: CustomFormatter?\n\n\t\t\t/// Create a new rule.\n\t\t\t///\n\t\t\t/// - Parameters:\n\t\t\t///   - unit: target time unit.\n\t\t\t///   - threshold: threshold value.\n\t\t\t///   - granularity: granularity value.\n\t\t\t///   - prev: relation with a previous rule in gradation lsit.\n\t\t\t///   - formatter: custom formatter.\n\t\t\tpublic init(_ unit: Unit,\n                        threshold: ThresholdType?,\n\t\t\t\t\t\tgranularity: Double? = nil,\n                        roundingStrategy: RoundingStrategy = .regularRound,\n                        prev: [Unit: Double]? = nil,\n                        formatter: CustomFormatter? = nil ) {\n\t\t\t\tself.unit = unit\n\t\t\t\tself.threshold = threshold\n\t\t\t\tself.granularity = granularity\n                self.roundingStrategy = roundingStrategy\n\t\t\t\tself.thresholdPrevious = prev\n\t\t\t\tself.customFormatter = formatter\n\t\t\t}\n\n\t\t}\n\n\t\t/// Gradation rules\n\t\tvar rules: [Rule]\n\n\t\t/// Number of gradation rules\n\t\tvar count: Int { return rules.count }\n\n\t\t/// Subscript by unit.\n\t\t/// Return the first rule for given unit.\n\t\t///\n\t\t/// - Parameter unit: unit to get.\n\t\tpublic subscript(_ unit: Unit) -> Rule? {\n\t\t\treturn rules.first(where: { $0.unit == unit })\n\t\t}\n\n\t\t/// Subscript by index.\n\t\t/// Return the rule at given index, `nil` if index is invalid.\n\t\t///\n\t\t/// - Parameter index: index\n\t\tpublic subscript(_ index: Int) -> Rule? {\n\t\t\tguard index < rules.count, index >= 0 else { return nil }\n\t\t\treturn rules[index]\n\t\t}\n\n\t\t/// Create a new gradition with a given set of ordered rules.\n\t\t///\n\t\t/// - Parameter rules: ordered rules.\n\t\tpublic init(_ rules: [Rule]) {\n\t\t\tself.rules = rules\n\t\t}\n\n\t\t/// Create a new gradation by removing the units from receiver which are not part of the given array.\n\t\t///\n\t\t/// - Parameter units: units to keep.\n\t\t/// - Returns: a new filtered `Gradation` instance.\n\t\tpublic func filtered(byUnits units: [Unit]) -> Gradation {\n\t\t\treturn Gradation(rules.filter { units.contains($0.unit) })\n\t\t}\n\n\t\t/// Canonical gradation rules\n\t\tpublic static func canonical() -> Gradation {\n\t\t\treturn Gradation([\n\t\t\t\tRule(.now, threshold: .value(0)),\n\t\t\t\tRule(.second, threshold: .value(0.5)),\n\t\t\t\tRule(.minute, threshold: .value(59.5)),\n\t\t\t\tRule(.hour, threshold: .value(59.5 * 60.0)),\n\t\t\t\tRule(.day, threshold: .value(23.5 * 60 * 60)),\n\t\t\t\tRule(.week, threshold: .value(6.5 * Unit.day.factor)),\n\t\t\t\tRule(.month, threshold: .value(3.5 * 7 * Unit.day.factor)),\n\t\t\t\tRule(.year, threshold: .value(1.5 * Unit.month.factor))\n\t\t\t\t])\n\t\t}\n\n\t\t/// Convenient gradation rules\n\t\tpublic static func convenient() -> Gradation {\n\t\t\tlet list = Gradation([\n\t\t\t\tRule(.now, threshold: .value(0)),\n\t\t\t\tRule(.second, threshold: .value(1), prev: [.now: 1]),\n\t\t\t\tRule(.minute, threshold: .value(45)),\n\t\t\t\tRule(.minute, threshold: .value(2.5 * 60), granularity: 5),\n\t\t\t\tRule(.halfHour, threshold: .value(22.5 * 60), granularity: 5),\n\t\t\t\tRule(.hour, threshold: .value(42.5 * 60), prev: [.minute: 52.5 * 60]),\n\t\t\t\tRule(.day, threshold: .value((20.5 / 24) * Unit.day.factor)),\n\t\t\t\tRule(.week, threshold: .value(5.5 * Unit.day.factor)),\n\t\t\t\tRule(.month, threshold: .value(3.5 * 7 * Unit.day.factor)),\n\t\t\t\tRule(.year, threshold: .value(10.5 * Unit.month.factor))\n\t\t\t\t])\n\t\t\treturn list\n\t\t}\n\n\t\t/// Twitter gradation rules\n\t\tpublic static func twitter() -> Gradation {\n\t\t\treturn Gradation([\n\t\t\t\tRule(.now, threshold: .value(0)),\n\t\t\t\tRule(.second, threshold: .value(1), prev: [.now: 1]),\n\t\t\t\tRule(.minute, threshold: .value(45)),\n\t\t\t\tRule(.hour, threshold: .value(59.5 * 60.0)),\n\t\t\t\tRule(.hour, threshold: .value((1.days.timeInterval - 0.5 * 1.hours.timeInterval))),\n\t\t\t\tRule(.day, threshold: .value((20.5 / 24) * Unit.day.factor)),\n\t\t\t\tRule(.other, threshold: .function({ now in\n\t\t\t\t\t// Jan 1st of the next year.\n\t\t\t\t\tlet nextYear = (Date(timeIntervalSince1970: now) + 1.years).dateAtStartOf(.year)\n\t\t\t\t\treturn (nextYear.timeIntervalSince1970 - now)\n\t\t\t\t}), formatter: { date in // \"Apr 11, 2017\"\n\t\t\t\t\treturn date.toFormat(\"MMM dd, yyyy\")\n\t\t\t\t})\n\t\t\t])\n\t\t}\n\n\t}\n\n}\n\n// MARK: - Unit\n\npublic extension RelativeFormatter {\n\n\t/// Units for relative formatter\n\tenum Unit: String {\n\t\tcase now \t\t= \"now\"\n\t\tcase second \t= \"second\"\n\t\tcase minute \t= \"minute\"\n\t\tcase hour \t\t= \"hour\"\n\t\tcase halfHour \t= \"half_hour\"\n\t\tcase day \t\t= \"day\"\n\t\tcase week \t\t= \"week\"\n\t\tcase month \t\t= \"month\"\n\t\tcase year \t\t= \"year\"\n\t\tcase quarter \t= \"quarter\"\n\t\tcase other \t\t= \"\"\n\n\t\t/// Factor of conversion of the unit to seconds\n\t\tpublic var factor: Double {\n\t\t\tswitch self {\n\t\t\tcase .now, .second: return 1\n\t\t\tcase .minute: \t\treturn 1.minutes.timeInterval\n\t\t\tcase .hour: \t\treturn 1.hours.timeInterval\n\t\t\tcase .halfHour: \treturn (1.hours.timeInterval * 0.5)\n\t\t\tcase .day: \t\t\treturn 1.days.timeInterval\n\t\t\tcase .week: \t\treturn 1.weeks.timeInterval\n\t\t\tcase .month: \t\treturn 1.months.timeInterval\n\t\t\tcase .year: \t\treturn 1.years.timeInterval\n\t\t\tcase .quarter: \t\treturn (91.days.timeInterval + 6.hours.timeInterval)\n\t\t\tcase .other:\t\treturn 0\n\t\t\t}\n\t\t}\n\n\t}\n\n}\n\ninternal extension Double {\n\n\t/// Return -1 if number is negative, 1 if positive\n\tvar sign: Int {\n\t\treturn (self < 0 ? -1 : 1)\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/RelativeFormatter.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic class RelativeFormatter: DateToStringTrasformable {\n\n\t/// Private singleton for relative formatter\n\tprivate static let shared = RelativeFormatter()\n\n\t/// Return all languages supported by the library for relative date formatting\n\tpublic static var allLanguages: [RelativeFormatterLanguage] {\n        return RelativeFormatterLanguage.allCases\n\t}\n\n\tprivate init() {}\n\n\t/// Return the language table for a specified locale.\n\t/// If not loaded yet a new instance of the table is loaded and cached.\n\t///\n\t/// - Parameter locale: locale to load\n\t/// - Returns: language table\n    private func tableForLocale(_ locale: Locale) -> RelativeFormatterLanguage {\n        let localeId = (locale.collatorIdentifier ?? Locales.english.toLocale().collatorIdentifier!)\n\n        if let lang = RelativeFormatterLanguage(rawValue: localeId) {\n            return lang\n        }\n\n        guard let fallbackFlavours = RelativeFormatterLanguage(rawValue: localeId.components(separatedBy: \"_\").first!) ??\n            RelativeFormatterLanguage(rawValue: localeId.components(separatedBy: \"-\").first!) else {\n                return tableForLocale(Locales.english.toLocale()) // fallback not found, return english\n        }\n        return fallbackFlavours // return fallback\n    }\n\n\t/// Implementation of the protocol for DateToStringTransformable.\n\tpublic static func format(_ date: DateRepresentable, options: Any?) -> String {\n\t\tlet dateToFormat = (date as? DateInRegion ?? DateInRegion(date.date, region: SwiftDate.defaultRegion))\n\t\treturn RelativeFormatter.format(date: dateToFormat, style: (options as? Style), locale: date.region.locale)\n\t}\n\n\t/// Return relative formatted string result of comparison of two passed dates.\n\t///\n\t/// - Parameters:\n\t///   - date: date to compare\n\t///   - toDate: date to compare against for (if `nil` current date in the same region of `date` is used)\n\t///   - style: style of the relative formatter.\n\t///   - locale: locale to use; if not passed the `date`'s region locale is used.\n\t/// - Returns: formatted string, empty string if formatting fails\n\tpublic static func format(date: DateRepresentable, to toDate: DateRepresentable? = nil,\n\t\t\t\t\t\t\t  style: Style?, locale fixedLocale: Locale? = nil) -> String {\n\n\t\tlet refDate = (toDate ?? date.region.nowInThisRegion()) // a now() date is created if no reference is passed\n\t\tlet options = (style ?? RelativeFormatter.defaultStyle()) // default style if not used\n\t\tlet locale = (fixedLocale ?? date.region.locale) // date's locale is used if no value is forced\n\n\t\t// how much time elapsed (in seconds)\n\t\tlet elapsed = (refDate.date.timeIntervalSince1970 - date.date.timeIntervalSince1970)\n\n\t\t// get first suitable flavour for a given locale\n\t\tlet (flavour, localeData) = suitableFlavour(inList: options.flavours, forLocale: locale)\n\t\t// get all units which can be represented by the locale data for required style\n\t\tlet allUnits = suitableUnits(inLocaleData: localeData, requiredUnits: options.allowedUnits)\n\t\tguard allUnits.count > 0 else {\n\t\t\tdebugPrint(\"Required units in style were not found in locale spec. Returning empty string\")\n\t\t\treturn \"\"\n\t\t}\n\n\t\tguard let suitableRule = ruleToRepresent(timeInterval: abs(elapsed),\n\t\t\t\t\t\t\t\t\t\t\t   referenceInterval: refDate.date.timeIntervalSince1970,\n\t\t\t\t\t\t\t\t\t\t\t   units: allUnits,\n\t\t\t\t\t\t\t\t\t\t\t   gradation: options.gradation) else {\n\t\t\t// If no time unit is suitable, just output an empty string.\n\t\t\t// E.g. when \"now\" unit is not available\n\t\t\t// and \"second\" has a threshold of `0.5`\n\t\t\t// (e.g. the \"canonical\" grading scale).\n\t\t\treturn \"\"\n\t\t}\n\n\t\tif let customFormat = suitableRule.customFormatter {\n\t\t\treturn customFormat(date)\n\t\t}\n\n\t\tvar amount = (abs(elapsed) / suitableRule.unit.factor)\n\n\t\t// Apply granularity to the time amount\n\t\t// (and fallback to the previous step\n\t\t//  if the first level of granularity\n\t\t//  isn't met by this amount)\n\t\tif let granularity = suitableRule.granularity {\n\t\t\t// Recalculate the elapsed time amount based on granularity\n\t\t\tamount = round(amount / granularity) * granularity\n\t\t}\n\n\t\tlet value: Double = -1.0 * Double(elapsed.sign) * suitableRule.roundingStrategy.roundValue(amount)\n\t\tlet formatString = relativeFormat(locale: locale, flavour: flavour, value: value, unit: suitableRule.unit)\n\t\treturn formatString.replacingOccurrences(of: \"{0}\", with: String(Int(abs(value))))\n\t}\n\n\tprivate static func relativeFormat(locale: Locale, flavour: Flavour, value: Double, unit: Unit) -> String {\n        let table = RelativeFormatter.shared.tableForLocale(locale)\n\t\tguard let styleTable = table.flavours[flavour.rawValue] as? [String: Any] else {\n\t\t\treturn \"\"\n\t\t}\n\n\t\tif let fixedValue = styleTable[unit.rawValue] as? String {\n\t\t\treturn fixedValue\n\t\t}\n\n\t\tguard let unitRules = styleTable[unit.rawValue] as? [String: Any] else {\n\t\t\treturn \"\"\n\t\t}\n\n    // Choose either \"previous\", \"past\", \"current\", \"next\" or \"future\" based on time `value` sign.\n    // If \"next\" is not present, we fallback on \"future\"\n    // If \"previous\" is not present, we fallback on \"past\"\n    // If \"current\" is not present, we fallback on \"past\"\n    // If \"past\" is same as \"future\" then they're stored as \"other\".\n    // If there's only \"other\" then it's being collapsed.\n    let quantifierKey: String\n\n    switch value {\n    case -1 where unitRules[\"previous\"] != nil: // If it is previous value -1, and previous unitRule exist\n      quantifierKey = \"previous\"\n    case 0 where unitRules[\"current\"] != nil: // If it is current value 0, and current unitRule exist\n      quantifierKey = \"current\"\n    case ...0: // If value is up to 0 included, also fallback when current or previous isn't found\n      quantifierKey = \"past\"\n    case 1 where unitRules[\"next\"] != nil: // If it is next value 1, and next unitRule exist\n      quantifierKey = \"next\"\n    case 1...: // If it is future value >0, and fallback if next isn't found\n      quantifierKey = \"future\"\n    default: // Should never happen\n      fatalError()\n    }\n\n\t\tif let fixedValue = unitRules[quantifierKey] as? String {\n\t\t\treturn fixedValue\n\t\t} else if let quantifierRules = unitRules[quantifierKey] as? [String: Any] {\n\t\t\t// plurar/translations forms\n\t\t\t// \"other\" rule is supposed to always be present.\n\t\t\t// If only \"other\" rule is present then \"rules\" is not an object and is a string.\n\t\t\tlet quantifier = (table.quantifyKey(forValue: abs(value)) ?? .other).rawValue\n\t\t\tif let relativeFormat = quantifierRules[quantifier] as? String {\n\t\t\t\treturn relativeFormat\n\t\t\t} else {\n\t\t\t\treturn quantifierRules[RelativeFormatter.PluralForm.other.rawValue] as? String ?? \"\"\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\t/// Return the first suitable flavour into the list which is available for a given locale.\n\t///\n\t/// - Parameters:\n\t///   - flavours: ordered flavours.\n\t///   - locale: locale to use.\n\t/// - Returns: a pair of found flavor and locale table\n\tprivate static func suitableFlavour(inList flavours: [Flavour], forLocale locale: Locale) -> (flavour: Flavour, locale: [String: Any]) {\n        let localeData = RelativeFormatter.shared.tableForLocale(locale) // get the locale table\n\t\tfor flavour in flavours {\n\t\t\tif let flavourData = localeData.flavours[flavour.rawValue] as? [String: Any] {\n\t\t\t\treturn (flavour, flavourData) // found our required flavor in passed locale\n\t\t\t}\n\t\t}\n\t\t// long must be always present\n\t\t// swiftlint:disable force_cast\n\t\treturn (.long, localeData.flavours[Flavour.long.rawValue] as! [String: Any])\n\t}\n\n\t/// Return a list of available time units in locale filtered by required units of style.\n\t/// If resulting array if empty there is not any time unit which can be rapresented with given locale\n\t/// so formatting fails.\n\t///\n\t/// - Parameters:\n\t///   - localeData: local table.\n\t///   - styleUnits: required time units.\n\t/// - Returns: available units.\n\tprivate static func suitableUnits(inLocaleData localeData: [String: Any], requiredUnits styleUnits: [Unit]?) -> [Unit] {\n\t\tlet localeUnits: [Unit] = localeData.keys.compactMap { Unit(rawValue: $0) }\n\t\tguard let restrictedStyleUnits = styleUnits else { return localeUnits } // no restrictions\n\t\treturn localeUnits.filter({ restrictedStyleUnits.contains($0) })\n\t}\n\n\t/// Return the best rule in gradation to represent given time interval.\n\t///\n\t/// - Parameters:\n\t///   - elapsed: elapsed interval to represent\n\t///   - referenceInterval: reference interval\n\t///   - units: units\n\t///   - gradation: gradation\n\t/// - Returns: best rule to represent\n\tprivate static func ruleToRepresent(timeInterval elapsed: TimeInterval, referenceInterval: TimeInterval, units: [Unit], gradation: Gradation) -> Gradation.Rule? {\n\t\t// Leave only allowed time measurement units.\n\t\t// E.g. omit \"quarter\" unit.\n\t\tlet filteredGradation = gradation.filtered(byUnits: units)\n\t\t// If no steps of gradation fit the conditions\n\t\t// then return nothing.\n\t\tguard gradation.count > 0 else {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Find the most appropriate gradation step\n\t\tlet i = findGradationStep(elapsed: elapsed, now: referenceInterval, gradation: filteredGradation)\n\t\tguard i >= 0 else {\n\t\t\treturn nil\n\t\t}\n\t\tlet step = filteredGradation[i]!\n\n\t\t// Apply granularity to the time amount\n\t\t// (and fall back to the previous step\n\t\t//  if the first level of granularity\n\t\t//  isn't met by this amount)\n\t\tif let granurality = step.granularity {\n\t\t\t// Recalculate the elapsed time amount based on granularity\n\t\t\tlet amount = round( (elapsed / step.unit.factor) / granurality) * granurality\n\n\t\t\t// If the granularity for this step\n\t\t\t// is too high, then fallback\n\t\t\t// to the previous step of gradation.\n\t\t\t// (if there is any previous step of gradation)\n\t\t\tif amount == 0 && i > 0 {\n\t\t\t\treturn filteredGradation[i - 1]\n\t\t\t}\n\t\t}\n\t\treturn step\n\t}\n\n\tprivate static func findGradationStep(elapsed: TimeInterval, now: TimeInterval, gradation: Gradation, step: Int = 0) -> Int {\n\t\t// If the threshold for moving from previous step\n\t\t// to this step is too high then return the previous step.\n\t\tlet fromGradation = gradation[step - 1]\n\t\tlet currentGradation = gradation[step]!\n\t\tlet thresholdValue = threshold(from: fromGradation, to: currentGradation, now: now)\n\n\t\tif let t = thresholdValue, elapsed < t {\n\t\t\treturn step - 1\n\t\t}\n\n\t\t// If it's the last step of gradation then return it.\n\t\tif step == (gradation.count - 1) {\n\t\t\treturn step\n\t\t}\n\t\t// Move to the next step.\n\t\treturn findGradationStep(elapsed: elapsed, now: now, gradation: gradation, step: step + 1)\n\t}\n\n\t/// Evaluate threshold.\n\tprivate static func threshold(from fromRule: Gradation.Rule?, to toRule: Gradation.Rule, now: TimeInterval) -> Double? {\n\t\tvar threshold: Double?\n\n\t\t// Allows custom thresholds when moving\n\t\t// from a specific step to a specific step.\n\t\tif let fromStepUnit = fromRule?.unit {\n\t\t\tthreshold = toRule.thresholdPrevious?[fromStepUnit]\n\t\t}\n\n\t\t// If no custom threshold is set for this transition\n\t\t// then use the usual threshold for the next step.\n\t\tif threshold == nil {\n\t\t\tthreshold = toRule.threshold?.evaluateForTimeInterval(now)\n\t\t}\n\n\t\treturn threshold\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/RelativeFormatterLanguage.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\ninternal class RelativeFormatterLanguagesCache {\n\n    static let shared = RelativeFormatterLanguagesCache()\n\n    @Atomic\n    private(set) var cachedValues = [String: [String: Any]]()\n    \n    func flavoursForLocaleID(_ langID: String) -> [String: Any]? {\n        do {\n            \n            guard let cachedValue = cachedValues[langID] else {\n                var fileURL = Bundle.appModule?.url(forResource: langID, withExtension: \"json\", subdirectory: \"langs\")\n                if fileURL == nil {\n                    fileURL = Bundle(for: RelativeFormatter.self).resourceURL?.appendingPathComponent(\"langs/\\(langID).json\")\n                }\n                \n                guard let fullURL = fileURL else {\n                    return nil\n                }\n                let data = try Data(contentsOf: fullURL)\n                let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments)\n\n                if let value = json as? [String: Any] {\n                    cachedValues[langID] = value\n                    return value\n                }\n                return nil\n            }\n            \n            return cachedValue\n\n        } catch {\n            debugPrint(\"Failed to read data for language id: \\(langID)\")\n            return nil\n        }\n    }\n}\n\npublic enum RelativeFormatterLanguage: String, CaseIterable {\n    case af = \"af\" // Locales.afrikaans\n    case am = \"am\" // Locales.amharic\n    case ar_AE = \"ar_AE\" // Locales.arabicUnitedArabEmirates\n    case ar = \"ar\" // Locales.arabic\n    case `as` = \"as\" // Locales.assamese\n    case az = \"az\" // Locales.assamese\n    case be = \"be\" // Locales.belarusian\n    case bg = \"bg\" // Locales.bulgarian\n    case bn = \"bn\" // Locales.bengali\n    case br = \"br\" // Locales.breton\n    case bs = \"bs\" // Locales.bosnian\n    case bs_Cyrl = \"bs-Cyrl\" // Locales.belarusian\n    case ca = \"ca\" // Locales.catalan\n    case cz = \"cz\" // Locales.czech\n    case cy = \"cy\" // Locales.welsh\n    case cs = \"cs\" // Locales.czech\n    case da = \"da\" // Locales.danish\n    case de = \"de\" // Locales.dutch\n    case dsb = \"dsb\" // Locales.lowerSorbian\n    case dz = \"dz\" // Locales.dzongkha\n    case ee = \"ee\" // Locales.ewe\n    case el = \"el\" // Locales.greek\n    case en = \"en\" // Locales.english\n    case es_AR = \"es_AR\" // Locales.spanishArgentina\n    case es_PY = \"es_PY\" // Locales.spanishParaguay\n    case es_MX = \"es_MX\" // Locales.spanishMexico\n    case es_US = \"es_US\" // Locales.spanishUnitedStates\n    case es = \"es\" // Locales.spanish\n    case et = \"et\" // Locales.estonian\n    case eu = \"eu\" // Locales.basque\n    case fa = \"fa\" // Locales.persian\n    case fi = \"fi\" // Locales.finnish\n    case fil = \"fil\" // Locales.filipino\n    case fo = \"fo\" // Locales.faroese\n    case fr_CA = \"fr_CA\" // French (Canada)\n    case fr = \"fr\" // French\n    case fur = \"fur\" // Friulian\n    case fy = \"fy\" // Western Frisian\n    case ga = \"ga\" // Irish\n    case gd = \"gd\" // Scottish Gaelic\n    case gl = \"gl\" // Galician\n    case gu = \"gu\" // Gujarati\n    case he = \"he\" // Hebrew\n    case hi = \"hi\" // Hindi\n    case hr = \"hr\" // Croatian\n    case hsb = \"hsb\" // Upper Sorbian\n    case hu = \"hu\" // Hungarian\n    case hy = \"hy\" // Armenian\n    case id = \"id\" // Indonesian\n    case `is` = \"is\" // Icelandic\n    case it = \"it\" // Locales.italian\n    case ja = \"ja\" // Japanese\n    case jgo = \"jgo\" // Ngomba\n    case ka = \"ka\" // Georgian\n    case kea = \"kea\" // Kabuverdianu\n    case kk = \"kk\" // Kazakh\n    case kl = \"kl\" // Kalaallisut\n    case km = \"km\" // Khmer\n    case kn = \"kn\" // Kannada\n    case ko = \"ko\" // Korean\n    case kok = \"kok\" // Konkani\n    case ksh = \"ksh\" // Colognian\n    case ky = \"ky\" // Kyrgyz\n    case lb = \"lb\" // Luxembourgish\n    case lkt = \"lkt\" // Lakota\n    case lo = \"lo\" // Lao\n    case lt = \"lt\" // Lithuanian\n    case lv = \"lv\" // Latvian\n    case mk = \"mk\" // Macedonian\n    case ml = \"ml\" // Malayalam\n    case mn = \"mn\" // Mongolian\n    case mr = \"mr\" // Marathi\n    case ms = \"ms\" // Malay\n    case mt = \"mt\" // Maltese\n    case my = \"my\" // Burmese\n    case mzn = \"mzn\" // Mazanderani\n    case nb = \"nb\" // Norwegian Bokmål\n    case ne = \"ne\" // Nepali\n    case nl = \"nl\" // Netherland\n    case nn = \"nn\" // Norwegian Nynorsk\n    case or = \"or\" // Odia\n    case pa = \"pa\" // Punjabi\n    case pl = \"pl\" // Polish\n    case ps = \"ps\" // Pashto\n    case pt = \"pt\" // Portuguese\n    case ro = \"ro\" // Romanian\n    case ru = \"ru\" // Russian\n    case sah = \"sah\" // Sakha\n    case sd = \"sd\" // Sindhi\n    case se_FI = \"se_FI\" // Northern Sami (Finland)\n    case se = \"se\" // Northern Sami\n    case si = \"si\" // Sinhala\n    case sk = \"sk\" // Slovak\n    case sl = \"sl\" // Slovenian\n    case sq = \"sq\" // Albanian\n    case sr_Latn = \"sr_Latn\" // Serbian (Latin)\n    case sr = \"sr\" // Serbian\n    case sv = \"sv\" // Swedish\n    case sw = \"sw\" // Swedish\n    case ta = \"ta\" // Tamil\n    case te = \"te\" // Telugu\n    case th = \"th\" // Thai\n    case ti = \"ti\" // Tigrinya\n    case tk = \"tk\" // Turkmen\n    case to = \"to\" // Tongan\n    case tr = \"tr\" // Turkish\n    case ug = \"ug\" // Uyghur\n    case uk = \"uk\" // Ukrainian\n    case ur_IN = \"ur_IN\" // Urdu (India)\n    case ur = \"ur\" // Urdu\n    case uz_Cyrl = \"uz_Cyrl\" // Uzbek (Cyrillic)\n    case uz = \"uz\" // Uzbek (Cyrillic)\n    case vi = \"vi\" // Vietnamese\n    case wae = \"wae\" // Walser\n    case yue_Hans = \"yue_Hans\" // Cantonese (Simplified)\n    case yue_Hant = \"yue_Hant\" // Cantonese (Traditional)\n    case zh_Hans_HK = \"zh_Hans_HK\" // Chinese (Simplified, Hong Kong [China])\n    case zh_Hans_MO = \"zh_Hans_MO\" // Chinese (Simplified, Macau [China])\n    case zh_Hans_SG = \"zh_Hans_SG\" // Chinese (Simplified, Singapore)\n    case zh_Hant_HK = \"zh_Hant_HK\" // Chinese (Traditional, Hong Kong [China])\n    case zh_Hant_MO = \"zh_Hant_MO\" // Chinese (Traditional, Macau [China])\n    case zh_Hans = \"zh_Hans\" // Chinese (Simplified)\n    case zh_Hant = \"zh_Hant\" // Chinese (Traditional)\n    case zh = \"zh\" // Chinese\n    case zu = \"zu\" // Zulu\n\n    /// Table with the data of the language.\n    /// Data is structured in:\n    /// { flavour: { unit : { data } } }\n    public var flavours: [String: Any] {\n        return RelativeFormatterLanguagesCache.shared.flavoursForLocaleID(self.rawValue) ?? [:]\n    }\n\n    public var identifier: String {\n        return self.rawValue\n    }\n\n    public func quantifyKey(forValue value: Double) -> RelativeFormatter.PluralForm? {\n        switch self {\n\n        case .sr_Latn, .sr, .uk:\n            let mod10 = Int(value) % 10\n            let mod100 = Int(value) % 100\n\n            switch mod10 {\n            case 1:\n                switch mod100 {\n                case 11:\n                    break\n                default:\n                    return .one\n                }\n            case 2, 3, 4:\n                switch mod100 {\n                case 12, 13, 14:\n                    break\n                default:\n                    return .few\n                }\n            default:\n                break\n            }\n\n            return .many\n\n        case .ru, .sk, .sl:\n            let mod10 = Int(value) % 10\n            let mod100 = Int(value) % 100\n\n            switch mod100 {\n            case 11...14:\n                break\n\n            default:\n                switch mod10 {\n                case 1:\n                    return .one\n                case 2...4:\n                    return .few\n                default:\n                    break\n                }\n\n            }\n            return .many\n\n        case .ro:\n            let mod100 = Int(value) % 100\n\n            switch value {\n            case 0:\n                return .few\n            case 1:\n                return .one\n            default:\n                if mod100 > 1 && mod100 <= 19 {\n                    return .few\n                }\n            }\n\n            return .other\n\n        case .pa:\n            switch value {\n            case 0, 1:\n                return .one\n            default:\n                return .other\n            }\n\n        case .mt:\n            switch value {\n            case 1: return .one\n            case 0: return .few\n            case 2...10: return .few\n            case 11...19: return .many\n            default: return .other\n            }\n\n        case .lt, .lv:\n            let mod10 = Int(value) % 10\n            let mod100 = Int(value) % 100\n\n            if value == 0 {\n                return .zero\n            }\n\n            if value == 1 {\n                return .one\n            }\n\n            switch mod10 {\n            case 1:\n                if mod100 != 11 {\n                    return .one\n                }\n                return .many\n            default:\n                return .many\n            }\n\n        case .ksh, .se:\n            switch value {\n            case 0: return .zero\n            case 1: return .one\n            default: return .other\n            }\n\n        case .`is`:\n            let mod10 = Int(value) % 10\n            let mod100 = Int(value) % 100\n\n            if value == 0 {\n                return .zero\n            }\n\n            if value == 1 {\n                return .one\n            }\n\n            switch mod10 {\n            case 1:\n                if mod100 != 11 {\n                    return .one\n                }\n            default:\n                break\n            }\n\n            return .many\n\n        case .id, .ja, .ms, .my, .mzn, .sah, .se_FI, .si, .th, .yue_Hans, .yue_Hant,\n             .zh_Hans_HK, .zh_Hans_MO, .zh_Hans_SG, .zh_Hant_HK, .zh_Hant_MO, .zh:\n\n            return .other\n\n        case .hy:\n            return (value >= 0 && value < 2 ? .one : .other)\n\n        case .ga, .gd:\n            switch Int(value) {\n            case 1: return .one\n            case 2: return .two\n            case 3...6: return .few\n            case 7...10: return .many\n            default: return .other\n            }\n\n        case .fr_CA, .fr:\n            return (value >= 0 && value < 2 ? .one : .other)\n\n        case .dz, .kea, .ko, .kok, .lkt, .lo:\n            return nil\n\n        case .cs: // Locales.czech\n            switch value {\n            case 1:\n                return .one\n            case 2, 3, 4:\n                return .few\n            default:\n                return .other\n            }\n\n        case .cy:\n            switch value {\n            case 0:    return .zero\n            case 1: return .one\n            case 2: return .two\n            case 3: return .few\n            case 6: return .many\n            default: return .other\n            }\n\n        case .cz, .dsb:\n            switch value {\n            case 1:\n                return .one\n            case 2, 3, 4:\n                return .few\n            default:\n                return .other\n            }\n\n        case .br:\n            let n = Int(value)\n            return n % 10 == 1 && n % 100 != 11 && n % 100 != 71 && n % 100 != 91 ? .zero : n % 10 == 2 && n % 100 != 12 && n % 100 != 72 && n % 100 != 92 ? .one : (n % 10 == 3 || n % 10 == 4 || n % 10 == 9) && n % 100 != 13 && n % 100 != 14 && n % 100 != 19 && n % 100 != 73 && n % 100 != 74 && n % 100 != 79 && n % 100 != 93 && n % 100 != 94 && n % 100 != 99 ? .two : n % 1_000_000 == 0 && n != 0 ? .many : .other\n\n        case .be, .bs, .bs_Cyrl, .hr, .hsb, .pl:\n            let mod10 = Int(value) % 10\n            let mod100 = Int(value) % 100\n\n            switch mod10 {\n            case 1:\n                switch mod100 {\n                case 11:\n                    break\n                default:\n                    return .one\n                }\n            case 2, 3, 4:\n                switch mod100 {\n                case 12, 13, 14:\n                    break\n                default:\n                    return .few\n                }\n            default:\n                break\n            }\n            return .many\n\n        case .ar, .ar_AE, .he:\n            switch value {\n            case 0: return .zero\n            case 1: return .one\n            case 2: return .two\n            default:\n                let mod100 = Int(value) % 100\n                if mod100 >= 3 && mod100 <= 10 {\n                    return .few\n                } else if mod100 >= 11 {\n                    return .many\n                } else {\n                    return .other\n                }\n            }\n\n        case .am, .bn, .fa, .gu, .kn, .mr, .zu:\n            return (value >= 0 && value <= 1 ? .one : .other)\n\n        default:\n            return (value == 1 ? .one : .other)\n\n        }\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/af.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"previous\" : \"vorige kwartaal\",\n      \"current\" : \"hierdie kwartaal\",\n      \"next\" : \"volgende kwartaal\",\n      \"past\" : \"{0} kwartale gelede\",\n      \"future\" : \"oor {0} kwartale\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} md. gelede\",\n      \"next\" : \"volgende maand\",\n      \"future\" : \"oor {0} md.\",\n      \"previous\" : \"verlede maand\",\n      \"current\" : \"vandeesmaand\"\n    },\n    \"now\" : \"nou\",\n    \"hour\" : {\n      \"future\" : \"oor {0} uur\",\n      \"past\" : \"{0} uur gelede\",\n      \"current\" : \"hierdie uur\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} min. gelede\",\n      \"current\" : \"hierdie minuut\",\n      \"future\" : \"oor {0} min.\"\n    },\n    \"day\" : {\n      \"previous\" : \"gister\",\n      \"future\" : {\n        \"one\" : \"oor {0} dag\",\n        \"other\" : \"oor {0} dae\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} dag gelede\",\n        \"other\" : \"{0} dae gelede\"\n      },\n      \"current\" : \"vandag\",\n      \"next\" : \"môre\"\n    },\n    \"year\" : {\n      \"next\" : \"volgende jaar\",\n      \"past\" : \"{0} jaar gelede\",\n      \"future\" : \"oor {0} jaar\",\n      \"previous\" : \"verlede jaar\",\n      \"current\" : \"hierdie jaar\"\n    },\n    \"week\" : {\n      \"next\" : \"volgende week\",\n      \"previous\" : \"verlede week\",\n      \"past\" : \"{0} w. gelede\",\n      \"future\" : \"oor {0} w.\",\n      \"current\" : \"vandeesweek\"\n    },\n    \"second\" : {\n      \"future\" : \"oor {0} sek.\",\n      \"current\" : \"nou\",\n      \"past\" : \"{0} sek. gelede\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"oor {0} min.\",\n      \"current\" : \"hierdie minuut\",\n      \"past\" : \"{0} min. gelede\"\n    },\n    \"month\" : {\n      \"current\" : \"vandeesmaand\",\n      \"past\" : \"{0} md. gelede\",\n      \"future\" : \"oor {0} md.\",\n      \"next\" : \"volgende maand\",\n      \"previous\" : \"verlede maand\"\n    },\n    \"week\" : {\n      \"current\" : \"vandeesweek\",\n      \"past\" : \"{0} w. gelede\",\n      \"future\" : \"oor {0} w.\",\n      \"next\" : \"volgende week\",\n      \"previous\" : \"verlede week\"\n    },\n    \"hour\" : {\n      \"future\" : \"oor {0} uur\",\n      \"current\" : \"hierdie uur\",\n      \"past\" : \"{0} uur gelede\"\n    },\n    \"day\" : {\n      \"next\" : \"môre\",\n      \"current\" : \"vandag\",\n      \"previous\" : \"gister\",\n      \"past\" : {\n        \"one\" : \"{0} dag gelede\",\n        \"other\" : \"{0} dae gelede\"\n      },\n      \"future\" : {\n        \"one\" : \"oor {0} dag\",\n        \"other\" : \"oor {0} dae\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"oor {0} sek.\",\n      \"current\" : \"nou\",\n      \"past\" : \"{0} sek. gelede\"\n    },\n    \"now\" : \"nou\",\n    \"year\" : {\n      \"current\" : \"hierdie jaar\",\n      \"future\" : \"oor {0} jaar\",\n      \"past\" : \"{0} jaar gelede\",\n      \"next\" : \"volgende jaar\",\n      \"previous\" : \"verlede jaar\"\n    },\n    \"quarter\" : {\n      \"current\" : \"hierdie kwartaal\",\n      \"future\" : {\n        \"one\" : \"oor {0} kwartaal\",\n        \"other\" : \"oor {0} kwartale\"\n      },\n      \"previous\" : \"vorige kwartaal\",\n      \"next\" : \"volgende kwartaal\",\n      \"past\" : {\n        \"other\" : \"{0} kwartale gelede\",\n        \"one\" : \"{0} kwartaal gelede\"\n      }\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"gister\",\n      \"past\" : {\n        \"one\" : \"{0} dag gelede\",\n        \"other\" : \"{0} dae gelede\"\n      },\n      \"future\" : {\n        \"other\" : \"oor {0} dae\",\n        \"one\" : \"oor {0} dag\"\n      },\n      \"next\" : \"môre\",\n      \"current\" : \"vandag\"\n    },\n    \"hour\" : {\n      \"current\" : \"hierdie uur\",\n      \"future\" : \"oor {0} uur\",\n      \"past\" : \"{0} uur gelede\"\n    },\n    \"month\" : {\n      \"next\" : \"volgende maand\",\n      \"current\" : \"vandeesmaand\",\n      \"past\" : {\n        \"one\" : \"{0} maand gelede\",\n        \"other\" : \"{0} maande gelede\"\n      },\n      \"previous\" : \"verlede maand\",\n      \"future\" : \"oor {0} minuut\"\n    },\n    \"quarter\" : {\n      \"next\" : \"volgende kwartaal\",\n      \"past\" : {\n        \"one\" : \"{0} kwartaal gelede\",\n        \"other\" : \"{0} kwartale gelede\"\n      },\n      \"previous\" : \"vorige kwartaal\",\n      \"current\" : \"hierdie kwartaal\",\n      \"future\" : {\n        \"one\" : \"oor {0} kwartaal\",\n        \"other\" : \"oor {0} kwartale\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"verlede jaar\",\n      \"current\" : \"hierdie jaar\",\n      \"next\" : \"volgende jaar\",\n      \"past\" : \"{0} jaar gelede\",\n      \"future\" : \"oor {0} jaar\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"{0} minute gelede\",\n        \"one\" : \"{0} minuut gelede\"\n      },\n      \"future\" : \"oor {0} minuut\",\n      \"current\" : \"hierdie minuut\"\n    },\n    \"second\" : {\n      \"current\" : \"nou\",\n      \"future\" : {\n        \"one\" : \"oor {0} sekonde\",\n        \"other\" : \"oor {0} sekondes\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} sekondes gelede\",\n        \"one\" : \"{0} sekonde gelede\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"oor {0} weke\",\n        \"one\" : \"oor {0} week\"\n      },\n      \"previous\" : \"verlede week\",\n      \"current\" : \"vandeesweek\",\n      \"next\" : \"volgende week\",\n      \"past\" : {\n        \"one\" : \"{0} week gelede\",\n        \"other\" : \"{0} weke gelede\"\n      }\n    },\n    \"now\" : \"nou\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/am.json",
    "content": "{\n  \"short\" : {\n    \"month\" : {\n      \"previous\" : \"ያለፈው ወር\",\n      \"current\" : \"በዚህ ወር\",\n      \"next\" : \"የሚቀጥለው ወር\",\n      \"past\" : \"ከ{0} ወራት በፊት\",\n      \"future\" : \"በ{0} ወራት ውስጥ\"\n    },\n    \"now\" : \"አሁን\",\n    \"day\" : {\n      \"next\" : \"ነገ\",\n      \"current\" : \"ዛሬ\",\n      \"previous\" : \"ትላንትና\",\n      \"past\" : {\n        \"other\" : \"ከ{0} ቀኖች በፊት\",\n        \"one\" : \"ከ {0} ቀን በፊት\"\n      },\n      \"future\" : {\n        \"other\" : \"በ{0} ቀኖች ውስጥ\",\n        \"one\" : \"በ{0} ቀን ውስጥ\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"በዚህ ዓመት\",\n      \"future\" : \"በ{0} ዓመታት ውስጥ\",\n      \"previous\" : \"ያለፈው ዓመት\",\n      \"next\" : \"የሚቀጥለው ዓመት\",\n      \"past\" : \"ከ{0} ዓመታት በፊት\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"ከ{0} ሰዓት በፊት\",\n        \"other\" : \"ከ{0} ሰዓቶች በፊት\"\n      },\n      \"future\" : {\n        \"one\" : \"በ{0} ሰዓት ውስጥ\",\n        \"other\" : \"በ{0} ሰዓቶች ውስጥ\"\n      },\n      \"current\" : \"ይህ ሰዓት\"\n    },\n    \"minute\" : {\n      \"current\" : \"ይህ ደቂቃ\",\n      \"future\" : {\n        \"other\" : \"በ{0} ደቂቃዎች ውስጥ\",\n        \"one\" : \"በ{0} ደቂቃ ውስጥ\"\n      },\n      \"past\" : {\n        \"other\" : \"ከ{0} ደቂቃዎች በፊት\",\n        \"one\" : \"ከ{0} ደቂቃ በፊት\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"አሁን\",\n      \"future\" : {\n        \"other\" : \"በ{0} ሰከንዶች ውስጥ\",\n        \"one\" : \"በ{0} ሰከንድ ውስጥ\"\n      },\n      \"past\" : {\n        \"one\" : \"ከ{0} ሰከንድ በፊት\",\n        \"other\" : \"ከ{0} ሰከንዶች በፊት\"\n      }\n    },\n    \"quarter\" : {\n      \"future\" : \"+{0} ሩብ\",\n      \"previous\" : \"የመጨረሻው ሩብ\",\n      \"next\" : \"የሚቀጥለው ሩብ\",\n      \"past\" : \"{0} ሩብ በፊት\",\n      \"current\" : \"ይህ ሩብ\"\n    },\n    \"week\" : {\n      \"next\" : \"የሚቀጥለው ሳምንት\",\n      \"past\" : \"ከ{0} ሳምንታት በፊት\",\n      \"current\" : \"በዚህ ሣምንት\",\n      \"previous\" : \"ባለፈው ሳምንት\",\n      \"future\" : \"በ{0} ሳምንታት ውስጥ\"\n    }\n  },\n  \"narrow\" : {\n    \"now\" : \"አሁን\",\n    \"year\" : {\n      \"current\" : \"በዚህ ዓመት\",\n      \"next\" : \"የሚቀጥለው ዓመት\",\n      \"past\" : \"ከ{0} ዓመታት በፊት\",\n      \"future\" : \"በ{0} ዓመታት ውስጥ\",\n      \"previous\" : \"ያለፈው ዓመት\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"other\" : \"ከ{0} ቀኖች በፊት\",\n        \"one\" : \"ከ {0} ቀን በፊት\"\n      },\n      \"future\" : {\n        \"one\" : \"በ{0} ቀን ውስጥ\",\n        \"other\" : \"በ{0} ቀኖች ውስጥ\"\n      },\n      \"next\" : \"ነገ\",\n      \"current\" : \"ዛሬ\",\n      \"previous\" : \"ትላንትና\"\n    },\n    \"month\" : {\n      \"current\" : \"በዚህ ወር\",\n      \"future\" : \"በ{0} ወራት ውስጥ\",\n      \"next\" : \"የሚቀጥለው ወር\",\n      \"past\" : \"ከ{0} ወራት በፊት\",\n      \"previous\" : \"ያለፈው ወር\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"በ{0} ሰከንድ ውስጥ\",\n        \"other\" : \"በ{0} ሰከንዶች ውስጥ\"\n      },\n      \"current\" : \"አሁን\",\n      \"past\" : {\n        \"one\" : \"ከ{0} ሰከንድ በፊት\",\n        \"other\" : \"ከ{0} ሰከንዶች በፊት\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"በ{0} ደቂቃ ውስጥ\",\n        \"other\" : \"በ{0} ደቂቃዎች ውስጥ\"\n      },\n      \"current\" : \"ይህ ደቂቃ\",\n      \"past\" : {\n        \"one\" : \"ከ{0} ደቂቃ በፊት\",\n        \"other\" : \"ከ{0} ደቂቃዎች በፊት\"\n      }\n    },\n    \"week\" : {\n      \"future\" : \"በ{0} ሳምንታት ውስጥ\",\n      \"next\" : \"የሚቀጥለው ሳምንት\",\n      \"previous\" : \"ባለፈው ሳምንት\",\n      \"past\" : \"ከ{0} ሳምንታት በፊት\",\n      \"current\" : \"በዚህ ሣምንት\"\n    },\n    \"quarter\" : {\n      \"future\" : \"+{0} ሩብ\",\n      \"current\" : \"ይህ ሩብ\",\n      \"past\" : \"{0} ሩብ በፊት\",\n      \"previous\" : \"የመጨረሻው ሩብ\",\n      \"next\" : \"የሚቀጥለው ሩብ\"\n    },\n    \"hour\" : {\n      \"current\" : \"ይህ ሰዓት\",\n      \"past\" : {\n        \"one\" : \"ከ{0} ሰዓት በፊት\",\n        \"other\" : \"ከ{0} ሰዓቶች በፊት\"\n      },\n      \"future\" : {\n        \"other\" : \"በ{0} ሰዓቶች ውስጥ\",\n        \"one\" : \"በ{0} ሰዓት ውስጥ\"\n      }\n    }\n  },\n  \"long\" : {\n    \"now\" : \"አሁን\",\n    \"minute\" : {\n      \"current\" : \"ይህ ደቂቃ\",\n      \"future\" : {\n        \"one\" : \"በ{0} ደቂቃ ውስጥ\",\n        \"other\" : \"በ{0} ደቂቃዎች ውስጥ\"\n      },\n      \"past\" : {\n        \"one\" : \"ከ{0} ደቂቃ በፊት\",\n        \"other\" : \"ከ{0} ደቂቃዎች በፊት\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"ከ{0} ዓመታት በፊት\",\n        \"one\" : \"ከ{0} ዓመት በፊት\"\n      },\n      \"previous\" : \"ያለፈው ዓመት\",\n      \"current\" : \"በዚህ ዓመት\",\n      \"next\" : \"የሚቀጥለው ዓመት\",\n      \"future\" : \"በ{0} ዓመታት ውስጥ\"\n    },\n    \"hour\" : {\n      \"current\" : \"ይህ ሰዓት\",\n      \"future\" : {\n        \"one\" : \"በ{0} ሰዓት ውስጥ\",\n        \"other\" : \"በ{0} ሰዓቶች ውስጥ\"\n      },\n      \"past\" : {\n        \"one\" : \"ከ{0} ሰዓት በፊት\",\n        \"other\" : \"ከ{0} ሰዓቶች በፊት\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"አሁን\",\n      \"past\" : {\n        \"one\" : \"ከ{0} ሰከንድ በፊት\",\n        \"other\" : \"ከ{0} ሰከንዶች በፊት\"\n      },\n      \"future\" : {\n        \"other\" : \"በ{0} ሰከንዶች ውስጥ\",\n        \"one\" : \"በ{0} ሰከንድ ውስጥ\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"ትናንት\",\n      \"current\" : \"ዛሬ\",\n      \"future\" : {\n        \"other\" : \"በ{0} ቀናት ውስጥ\",\n        \"one\" : \"በ{0} ቀን ውስጥ\"\n      },\n      \"past\" : {\n        \"one\" : \"ከ{0} ቀን በፊት\",\n        \"other\" : \"ከ{0} ቀናት በፊት\"\n      },\n      \"next\" : \"ነገ\"\n    },\n    \"month\" : {\n      \"previous\" : \"ያለፈው ወር\",\n      \"current\" : \"በዚህ ወር\",\n      \"next\" : \"የሚቀጥለው ወር\",\n      \"future\" : {\n        \"one\" : \"በ{0} ወር ውስጥ\",\n        \"other\" : \"በ{0} ወራት ውስጥ\"\n      },\n      \"past\" : {\n        \"other\" : \"ከ{0} ወራት በፊት\",\n        \"one\" : \"ከ{0} ወር በፊት\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"የሚቀጥለው ሩብ\",\n      \"current\" : \"ይህ ሩብ\",\n      \"past\" : \"{0} ሩብ በፊት\",\n      \"future\" : \"+{0} ሩብ\",\n      \"previous\" : \"የመጨረሻው ሩብ\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"በ{0} ሳምንት ውስጥ\",\n        \"other\" : \"በ{0} ሳምንታት ውስጥ\"\n      },\n      \"current\" : \"በዚህ ሳምንት\",\n      \"next\" : \"የሚቀጥለው ሳምንት\",\n      \"previous\" : \"ያለፈው ሳምንት\",\n      \"past\" : {\n        \"other\" : \"ከ{0} ሳምንታት በፊት\",\n        \"one\" : \"ከ{0} ሳምንት በፊት\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ar.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"قبل {0} ثانية\",\n        \"one\" : \"قبل ثانية واحدة\",\n        \"two\" : \"قبل ثانيتين\",\n        \"few\" : \"قبل {0} ثوانٍ\"\n      },\n      \"current\" : \"الآن\",\n      \"future\" : {\n        \"two\" : \"خلال ثانيتين\",\n        \"one\" : \"خلال ثانية واحدة\",\n        \"other\" : \"خلال {0} ثانية\",\n        \"few\" : \"خلال {0} ثوانٍ\"\n      }\n    },\n    \"week\" : {\n      \"past\" : {\n        \"one\" : \"قبل أسبوع واحد\",\n        \"few\" : \"قبل {0} أسابيع\",\n        \"two\" : \"قبل أسبوعين\",\n        \"many\" : \"قبل {0} أسبوعًا\",\n        \"other\" : \"قبل {0} أسبوع\"\n      },\n      \"previous\" : \"الأسبوع الماضي\",\n      \"future\" : {\n        \"one\" : \"خلال أسبوع واحد\",\n        \"many\" : \"خلال {0} أسبوعًا\",\n        \"other\" : \"خلال {0} أسبوع\",\n        \"two\" : \"خلال أسبوعين\",\n        \"few\" : \"خلال {0} أسابيع\"\n      },\n      \"current\" : \"هذا الأسبوع\",\n      \"next\" : \"الأسبوع القادم\"\n    },\n    \"day\" : {\n      \"current\" : \"اليوم\",\n      \"next\" : \"غدًا\",\n      \"past\" : {\n        \"one\" : \"قبل يوم واحد\",\n        \"many\" : \"قبل {0} يومًا\",\n        \"other\" : \"قبل {0} يوم\",\n        \"few\" : \"قبل {0} أيام\",\n        \"two\" : \"قبل يومين\"\n      },\n      \"previous\" : \"أمس\",\n      \"future\" : {\n        \"two\" : \"خلال يومين\",\n        \"few\" : \"خلال {0} أيام\",\n        \"other\" : \"خلال {0} يوم\",\n        \"one\" : \"خلال يوم واحد\",\n        \"many\" : \"خلال {0} يومًا\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"two\" : \"قبل ساعتين\",\n        \"other\" : \"قبل {0} ساعة\",\n        \"few\" : \"قبل {0} ساعات\",\n        \"one\" : \"قبل ساعة واحدة\"\n      },\n      \"current\" : \"الساعة الحالية\",\n      \"future\" : {\n        \"few\" : \"خلال {0} ساعات\",\n        \"other\" : \"خلال {0} ساعة\",\n        \"one\" : \"خلال ساعة واحدة\",\n        \"two\" : \"خلال ساعتين\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"two\" : \"قبل سنتين\",\n        \"other\" : \"قبل {0} سنة\",\n        \"few\" : \"قبل {0} سنوات\",\n        \"one\" : \"قبل سنة واحدة\"\n      },\n      \"previous\" : \"السنة الماضية\",\n      \"next\" : \"السنة القادمة\",\n      \"future\" : {\n        \"one\" : \"خلال سنة واحدة\",\n        \"two\" : \"خلال سنتين\",\n        \"other\" : \"خلال {0} سنة\",\n        \"few\" : \"خلال {0} سنوات\"\n      },\n      \"current\" : \"السنة الحالية\"\n    },\n    \"quarter\" : {\n      \"next\" : \"الربع القادم\",\n      \"future\" : {\n        \"other\" : \"خلال {0} ربع سنة\",\n        \"one\" : \"خلال ربع سنة واحد\",\n        \"few\" : \"خلال {0} أرباع سنة\",\n        \"two\" : \"خلال ربعي سنة\"\n      },\n      \"previous\" : \"الربع الأخير\",\n      \"current\" : \"هذا الربع\",\n      \"past\" : {\n        \"one\" : \"قبل ربع سنة واحد\",\n        \"other\" : \"قبل {0} ربع سنة\",\n        \"two\" : \"قبل ربعي سنة\",\n        \"few\" : \"قبل {0} أرباع سنة\"\n      }\n    },\n    \"month\" : {\n      \"past\" : {\n        \"few\" : \"قبل {0} أشهر\",\n        \"many\" : \"قبل {0} شهرًا\",\n        \"other\" : \"قبل {0} شهر\",\n        \"one\" : \"قبل شهر واحد\",\n        \"two\" : \"قبل شهرين\"\n      },\n      \"next\" : \"الشهر القادم\",\n      \"current\" : \"هذا الشهر\",\n      \"previous\" : \"الشهر الماضي\",\n      \"future\" : {\n        \"many\" : \"خلال {0} شهرًا\",\n        \"two\" : \"خلال شهرين\",\n        \"other\" : \"خلال {0} شهر\",\n        \"one\" : \"خلال شهر واحد\",\n        \"few\" : \"خلال {0} أشهر\"\n      }\n    },\n    \"now\" : \"الآن\",\n    \"minute\" : {\n      \"future\" : {\n        \"two\" : \"خلال دقيقتين\",\n        \"few\" : \"خلال {0} دقائق\",\n        \"other\" : \"خلال {0} دقيقة\",\n        \"one\" : \"خلال دقيقة واحدة\"\n      },\n      \"past\" : {\n        \"one\" : \"قبل دقيقة واحدة\",\n        \"few\" : \"قبل {0} دقائق\",\n        \"other\" : \"قبل {0} دقيقة\",\n        \"two\" : \"قبل دقيقتين\"\n      },\n      \"current\" : \"هذه الدقيقة\"\n    }\n  },\n  \"long\" : {\n    \"now\" : \"الآن\",\n    \"day\" : {\n      \"current\" : \"اليوم\",\n      \"previous\" : \"أمس\",\n      \"next\" : \"غدًا\",\n      \"past\" : {\n        \"one\" : \"قبل يوم واحد\",\n        \"two\" : \"قبل يومين\",\n        \"many\" : \"قبل {0} يومًا\",\n        \"few\" : \"قبل {0} أيام\",\n        \"other\" : \"قبل {0} يوم\"\n      },\n      \"future\" : {\n        \"two\" : \"خلال يومين\",\n        \"many\" : \"خلال {0} يومًا\",\n        \"few\" : \"خلال {0} أيام\",\n        \"one\" : \"خلال يوم واحد\",\n        \"other\" : \"خلال {0} يوم\"\n      }\n    },\n    \"month\" : {\n      \"future\" : {\n        \"few\" : \"خلال {0} أشهر\",\n        \"many\" : \"خلال {0} شهرًا\",\n        \"other\" : \"خلال {0} شهر\",\n        \"one\" : \"خلال شهر واحد\",\n        \"two\" : \"خلال شهرين\"\n      },\n      \"past\" : {\n        \"two\" : \"قبل شهرين\",\n        \"few\" : \"قبل {0} أشهر\",\n        \"one\" : \"قبل شهر واحد\",\n        \"many\" : \"قبل {0} شهرًا\",\n        \"other\" : \"قبل {0} شهر\"\n      },\n      \"current\" : \"هذا الشهر\",\n      \"previous\" : \"الشهر الماضي\",\n      \"next\" : \"الشهر القادم\"\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"two\" : \"خلال دقيقتين\",\n        \"few\" : \"خلال {0} دقائق\",\n        \"other\" : \"خلال {0} دقيقة\",\n        \"one\" : \"خلال دقيقة واحدة\"\n      },\n      \"past\" : {\n        \"two\" : \"قبل دقيقتين\",\n        \"other\" : \"قبل {0} دقيقة\",\n        \"few\" : \"قبل {0} دقائق\",\n        \"one\" : \"قبل دقيقة واحدة\"\n      },\n      \"current\" : \"هذه الدقيقة\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"two\" : \"خلال ثانيتين\",\n        \"other\" : \"خلال {0} ثانية\",\n        \"one\" : \"خلال ثانية واحدة\",\n        \"few\" : \"خلال {0} ثوانٍ\"\n      },\n      \"current\" : \"الآن\",\n      \"past\" : {\n        \"two\" : \"قبل ثانيتين\",\n        \"one\" : \"قبل ثانية واحدة\",\n        \"other\" : \"قبل {0} ثانية\",\n        \"few\" : \"قبل {0} ثوانِ\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"الساعة الحالية\",\n      \"past\" : {\n        \"few\" : \"قبل {0} ساعات\",\n        \"other\" : \"قبل {0} ساعة\",\n        \"one\" : \"قبل ساعة واحدة\",\n        \"two\" : \"قبل ساعتين\"\n      },\n      \"future\" : {\n        \"other\" : \"خلال {0} ساعة\",\n        \"one\" : \"خلال ساعة واحدة\",\n        \"two\" : \"خلال ساعتين\",\n        \"few\" : \"خلال {0} ساعات\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"السنة الماضية\",\n      \"future\" : {\n        \"one\" : \"خلال سنة واحدة\",\n        \"two\" : \"خلال سنتين\",\n        \"few\" : \"خلال {0} سنوات\",\n        \"other\" : \"خلال {0} سنة\"\n      },\n      \"current\" : \"السنة الحالية\",\n      \"next\" : \"السنة القادمة\",\n      \"past\" : {\n        \"one\" : \"قبل سنة واحدة\",\n        \"other\" : \"قبل {0} سنة\",\n        \"two\" : \"قبل سنتين\",\n        \"few\" : \"قبل {0} سنوات\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"هذا الربع\",\n      \"past\" : {\n        \"other\" : \"قبل {0} ربع سنة\",\n        \"two\" : \"قبل ربعي سنة\",\n        \"few\" : \"قبل {0} أرباع سنة\",\n        \"one\" : \"قبل ربع سنة واحد\"\n      },\n      \"future\" : {\n        \"two\" : \"خلال ربعي سنة\",\n        \"few\" : \"خلال {0} أرباع سنة\",\n        \"other\" : \"خلال {0} ربع سنة\",\n        \"one\" : \"خلال ربع سنة واحد\"\n      },\n      \"next\" : \"الربع القادم\",\n      \"previous\" : \"الربع الأخير\"\n    },\n    \"week\" : {\n      \"next\" : \"الأسبوع القادم\",\n      \"current\" : \"هذا الأسبوع\",\n      \"past\" : {\n        \"one\" : \"قبل أسبوع واحد\",\n        \"many\" : \"قبل {0} أسبوعًا\",\n        \"two\" : \"قبل أسبوعين\",\n        \"other\" : \"قبل {0} أسبوع\",\n        \"few\" : \"قبل {0} أسابيع\"\n      },\n      \"future\" : {\n        \"other\" : \"خلال {0} أسبوع\",\n        \"two\" : \"خلال أسبوعين\",\n        \"few\" : \"خلال {0} أسابيع\",\n        \"one\" : \"خلال أسبوع واحد\",\n        \"many\" : \"خلال {0} أسبوعًا\"\n      },\n      \"previous\" : \"الأسبوع الماضي\"\n    }\n  },\n  \"short\" : {\n    \"now\" : \"الآن\",\n    \"year\" : {\n      \"current\" : \"السنة الحالية\",\n      \"past\" : {\n        \"few\" : \"قبل {0} سنوات\",\n        \"two\" : \"قبل سنتين\",\n        \"other\" : \"قبل {0} سنة\",\n        \"one\" : \"قبل سنة واحدة\"\n      },\n      \"previous\" : \"السنة الماضية\",\n      \"next\" : \"السنة القادمة\",\n      \"future\" : {\n        \"few\" : \"خلال {0} سنوات\",\n        \"one\" : \"خلال سنة واحدة\",\n        \"two\" : \"خلال سنتين\",\n        \"other\" : \"خلال {0} سنة\"\n      }\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"two\" : \"قبل ربعي سنة\",\n        \"few\" : \"قبل {0} أرباع سنة\",\n        \"other\" : \"قبل {0} ربع سنة\",\n        \"one\" : \"قبل ربع سنة واحد\"\n      },\n      \"next\" : \"الربع القادم\",\n      \"previous\" : \"الربع الأخير\",\n      \"current\" : \"هذا الربع\",\n      \"future\" : {\n        \"few\" : \"خلال {0} أرباع سنة\",\n        \"one\" : \"خلال ربع سنة واحد\",\n        \"other\" : \"خلال {0} ربع سنة\",\n        \"two\" : \"خلال ربعي سنة\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"few\" : \"قبل {0} ثوانٍ\",\n        \"other\" : \"قبل {0} ثانية\",\n        \"one\" : \"قبل ثانية واحدة\",\n        \"two\" : \"قبل ثانيتين\"\n      },\n      \"future\" : {\n        \"one\" : \"خلال ثانية واحدة\",\n        \"two\" : \"خلال ثانيتين\",\n        \"few\" : \"خلال {0} ثوانٍ\",\n        \"other\" : \"خلال {0} ثانية\"\n      },\n      \"current\" : \"الآن\"\n    },\n    \"hour\" : {\n      \"current\" : \"الساعة الحالية\",\n      \"past\" : {\n        \"other\" : \"قبل {0} ساعة\",\n        \"two\" : \"قبل ساعتين\",\n        \"one\" : \"قبل ساعة واحدة\",\n        \"few\" : \"قبل {0} ساعات\"\n      },\n      \"future\" : {\n        \"two\" : \"خلال ساعتين\",\n        \"one\" : \"خلال ساعة واحدة\",\n        \"other\" : \"خلال {0} ساعة\",\n        \"few\" : \"خلال {0} ساعات\"\n      }\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"خلال {0} يوم\",\n        \"one\" : \"خلال يوم واحد\",\n        \"few\" : \"خلال {0} أيام\",\n        \"two\" : \"خلال يومين\",\n        \"many\" : \"خلال {0} يومًا\"\n      },\n      \"previous\" : \"أمس\",\n      \"current\" : \"اليوم\",\n      \"past\" : {\n        \"many\" : \"قبل {0} يومًا\",\n        \"other\" : \"قبل {0} يوم\",\n        \"two\" : \"قبل يومين\",\n        \"few\" : \"قبل {0} أيام\",\n        \"one\" : \"قبل يوم واحد\"\n      },\n      \"next\" : \"غدًا\"\n    },\n    \"month\" : {\n      \"next\" : \"الشهر القادم\",\n      \"past\" : {\n        \"two\" : \"قبل شهرين\",\n        \"other\" : \"قبل {0} شهر\",\n        \"few\" : \"خلال {0} أشهر\",\n        \"many\" : \"قبل {0} شهرًا\",\n        \"one\" : \"قبل شهر واحد\"\n      },\n      \"future\" : {\n        \"one\" : \"خلال شهر واحد\",\n        \"two\" : \"خلال شهرين\",\n        \"other\" : \"خلال {0} شهر\",\n        \"many\" : \"خلال {0} شهرًا\",\n        \"few\" : \"خلال {0} أشهر\"\n      },\n      \"previous\" : \"الشهر الماضي\",\n      \"current\" : \"هذا الشهر\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"خلال أسبوع واحد\",\n        \"two\" : \"خلال {0} أسبوعين\",\n        \"few\" : \"خلال {0} أسابيع\",\n        \"many\" : \"خلال {0} أسبوعًا\",\n        \"other\" : \"خلال {0} أسبوع\"\n      },\n      \"next\" : \"الأسبوع القادم\",\n      \"previous\" : \"الأسبوع الماضي\",\n      \"past\" : {\n        \"many\" : \"قبل {0} أسبوعًا\",\n        \"other\" : \"قبل {0} أسبوع\",\n        \"two\" : \"قبل أسبوعين\",\n        \"one\" : \"قبل أسبوع واحد\",\n        \"few\" : \"قبل {0} أسابيع\"\n      },\n      \"current\" : \"هذا الأسبوع\"\n    },\n    \"minute\" : {\n      \"current\" : \"هذه الدقيقة\",\n      \"past\" : {\n        \"few\" : \"قبل {0} دقائق\",\n        \"two\" : \"قبل دقيقتين\",\n        \"one\" : \"قبل دقيقة واحدة\",\n        \"other\" : \"قبل {0} دقيقة\"\n      },\n      \"future\" : {\n        \"few\" : \"خلال {0} دقائق\",\n        \"other\" : \"خلال {0} دقيقة\",\n        \"one\" : \"خلال دقيقة واحدة\",\n        \"two\" : \"خلال دقيقتين\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ar_AE.json",
    "content": "{\n  \"short\" : {\n    \"month\" : {\n      \"future\" : {\n        \"other\" : \"خلال {0} شهر\",\n        \"one\" : \"خلال شهر واحد\",\n        \"two\" : \"خلال شهرين\",\n        \"few\" : \"خلال {0} أشهر\",\n        \"many\" : \"خلال {0} شهرًا\"\n      },\n      \"previous\" : \"الشهر الماضي\",\n      \"next\" : \"الشهر القادم\",\n      \"past\" : {\n        \"one\" : \"قبل شهر واحد\",\n        \"two\" : \"قبل شهرين\",\n        \"few\" : \"خلال {0} أشهر\",\n        \"other\" : \"قبل {0} شهر\",\n        \"many\" : \"قبل {0} شهرًا\"\n      },\n      \"current\" : \"هذا الشهر\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"two\" : \"خلال يومين\",\n        \"one\" : \"خلال يوم واحد\",\n        \"few\" : \"خلال {0} أيام\",\n        \"other\" : \"خلال {0} يوم\",\n        \"many\" : \"خلال {0} يومًا\"\n      },\n      \"previous\" : \"أمس\",\n      \"next\" : \"غدًا\",\n      \"past\" : {\n        \"two\" : \"قبل يومين\",\n        \"many\" : \"قبل {0} يومًا\",\n        \"other\" : \"قبل {0} يوم\",\n        \"one\" : \"قبل يوم واحد\",\n        \"few\" : \"قبل {0} أيام\"\n      },\n      \"current\" : \"اليوم\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"خلال ثانية واحدة\",\n        \"few\" : \"خلال {0} ثوانٍ\",\n        \"two\" : \"خلال ثانيتين\",\n        \"other\" : \"خلال {0} ثانية\"\n      },\n      \"current\" : \"الآن\",\n      \"past\" : {\n        \"two\" : \"قبل ثانيتين\",\n        \"other\" : \"قبل {0} ثانية\",\n        \"few\" : \"قبل {0} ثوانٍ\",\n        \"one\" : \"قبل ثانية واحدة\"\n      }\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"other\" : \"قبل {0} ربع سنة\",\n        \"two\" : \"قبل ربعي سنة\",\n        \"one\" : \"قبل ربع سنة واحد\",\n        \"few\" : \"قبل {0} أرباع سنة\"\n      },\n      \"next\" : \"الربع القادم\",\n      \"future\" : {\n        \"other\" : \"خلال {0} ربع سنة\",\n        \"few\" : \"خلال {0} أرباع سنة\",\n        \"two\" : \"خلال ربعي سنة\",\n        \"one\" : \"خلال ربع سنة واحد\"\n      },\n      \"previous\" : \"الربع الأخير\",\n      \"current\" : \"هذا الربع\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"few\" : \"خلال {0} سنوات\",\n        \"other\" : \"خلال {0} سنة\",\n        \"one\" : \"خلال سنة واحدة\",\n        \"two\" : \"خلال سنتين\"\n      },\n      \"current\" : \"هذه السنة\",\n      \"previous\" : \"السنة الماضية\",\n      \"past\" : {\n        \"few\" : \"قبل {0} سنوات\",\n        \"other\" : \"قبل {0} سنة\",\n        \"two\" : \"قبل سنتين\",\n        \"one\" : \"قبل سنة واحدة\"\n      },\n      \"next\" : \"السنة التالية\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"few\" : \"قبل {0} ساعات\",\n        \"other\" : \"قبل {0} ساعة\",\n        \"two\" : \"قبل ساعتين\",\n        \"one\" : \"قبل ساعة واحدة\"\n      },\n      \"future\" : {\n        \"two\" : \"خلال ساعتين\",\n        \"one\" : \"خلال ساعة واحدة\",\n        \"other\" : \"خلال {0} ساعة\",\n        \"few\" : \"خلال {0} ساعات\"\n      },\n      \"current\" : \"الساعة الحالية\"\n    },\n    \"week\" : {\n      \"current\" : \"هذا الأسبوع\",\n      \"previous\" : \"الأسبوع الماضي\",\n      \"past\" : {\n        \"two\" : \"قبل أسبوعين\",\n        \"other\" : \"قبل {0} أسبوع\",\n        \"few\" : \"قبل {0} أسابيع\",\n        \"one\" : \"قبل أسبوع واحد\",\n        \"many\" : \"قبل {0} أسبوعًا\"\n      },\n      \"next\" : \"الأسبوع القادم\",\n      \"future\" : {\n        \"two\" : \"خلال {0} أسبوعين\",\n        \"few\" : \"خلال {0} أسابيع\",\n        \"other\" : \"خلال {0} أسبوع\",\n        \"one\" : \"خلال أسبوع واحد\",\n        \"many\" : \"خلال {0} أسبوعًا\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"other\" : \"خلال {0} دقيقة\",\n        \"one\" : \"خلال دقيقة واحدة\",\n        \"few\" : \"خلال {0} دقائق\",\n        \"two\" : \"خلال دقيقتين\"\n      },\n      \"past\" : {\n        \"other\" : \"قبل {0} دقيقة\",\n        \"two\" : \"قبل دقيقتين\",\n        \"one\" : \"قبل دقيقة واحدة\",\n        \"few\" : \"قبل {0} دقائق\"\n      },\n      \"current\" : \"هذه الدقيقة\"\n    },\n    \"now\" : \"الآن\"\n  },\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : {\n        \"few\" : \"خلال {0} ثوانٍ\",\n        \"two\" : \"خلال ثانيتين\",\n        \"other\" : \"خلال {0} ثانية\",\n        \"one\" : \"خلال ثانية واحدة\"\n      },\n      \"current\" : \"الآن\",\n      \"past\" : {\n        \"one\" : \"قبل ثانية واحدة\",\n        \"few\" : \"قبل {0} ثوانٍ\",\n        \"two\" : \"قبل ثانيتين\",\n        \"other\" : \"قبل {0} ثانية\"\n      }\n    },\n    \"now\" : \"الآن\",\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"خلال {0} يوم\",\n        \"one\" : \"خلال يوم واحد\",\n        \"two\" : \"خلال يومين\",\n        \"few\" : \"خلال {0} أيام\",\n        \"many\" : \"خلال {0} يومًا\"\n      },\n      \"current\" : \"اليوم\",\n      \"past\" : {\n        \"one\" : \"قبل يوم واحد\",\n        \"many\" : \"قبل {0} يومًا\",\n        \"two\" : \"قبل يومين\",\n        \"other\" : \"قبل {0} يوم\",\n        \"few\" : \"قبل {0} أيام\"\n      },\n      \"next\" : \"غدًا\",\n      \"previous\" : \"أمس\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"few\" : \"قبل {0} ساعات\",\n        \"two\" : \"قبل ساعتين\",\n        \"other\" : \"قبل {0} ساعة\",\n        \"one\" : \"قبل ساعة واحدة\"\n      },\n      \"future\" : {\n        \"two\" : \"خلال ساعتين\",\n        \"one\" : \"خلال ساعة واحدة\",\n        \"few\" : \"خلال {0} ساعات\",\n        \"other\" : \"خلال {0} ساعة\"\n      },\n      \"current\" : \"الساعة الحالية\"\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"قبل ربع سنة واحد\",\n        \"few\" : \"قبل {0} أرباع سنة\",\n        \"other\" : \"قبل {0} ربع سنة\",\n        \"two\" : \"قبل ربعي سنة\"\n      },\n      \"current\" : \"هذا الربع\",\n      \"future\" : {\n        \"one\" : \"خلال ربع سنة واحد\",\n        \"two\" : \"خلال ربعي سنة\",\n        \"few\" : \"خلال {0} أرباع سنة\",\n        \"other\" : \"خلال {0} ربع سنة\"\n      },\n      \"next\" : \"الربع القادم\",\n      \"previous\" : \"الربع الأخير\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"other\" : \"خلال {0} سنة\",\n        \"one\" : \"خلال سنة واحدة\",\n        \"few\" : \"خلال {0} سنوات\",\n        \"two\" : \"خلال سنتين\"\n      },\n      \"next\" : \"السنة التالية\",\n      \"previous\" : \"السنة الماضية\",\n      \"current\" : \"هذه السنة\",\n      \"past\" : {\n        \"two\" : \"قبل سنتين\",\n        \"few\" : \"قبل {0} سنوات\",\n        \"other\" : \"قبل {0} سنة\",\n        \"one\" : \"قبل سنة واحدة\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"الشهر القادم\",\n      \"previous\" : \"الشهر الماضي\",\n      \"future\" : {\n        \"other\" : \"خلال {0} شهر\",\n        \"few\" : \"خلال {0} أشهر\",\n        \"one\" : \"خلال شهر واحد\",\n        \"many\" : \"خلال {0} شهرًا\",\n        \"two\" : \"خلال شهرين\"\n      },\n      \"current\" : \"هذا الشهر\",\n      \"past\" : {\n        \"many\" : \"قبل {0} شهرًا\",\n        \"other\" : \"قبل {0} شهر\",\n        \"one\" : \"قبل شهر واحد\",\n        \"two\" : \"قبل شهرين\",\n        \"few\" : \"قبل {0} أشهر\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"الأسبوع الماضي\",\n      \"next\" : \"الأسبوع القادم\",\n      \"past\" : {\n        \"many\" : \"قبل {0} أسبوعًا\",\n        \"few\" : \"قبل {0} أسابيع\",\n        \"other\" : \"قبل {0} أسبوع\",\n        \"two\" : \"قبل أسبوعين\",\n        \"one\" : \"قبل أسبوع واحد\"\n      },\n      \"future\" : {\n        \"one\" : \"خلال أسبوع واحد\",\n        \"many\" : \"خلال {0} أسبوعًا\",\n        \"few\" : \"خلال {0} أسابيع\",\n        \"two\" : \"خلال أسبوعين\",\n        \"other\" : \"خلال {0} أسبوع\"\n      },\n      \"current\" : \"هذا الأسبوع\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"two\" : \"قبل دقيقتين\",\n        \"other\" : \"قبل {0} دقيقة\",\n        \"one\" : \"قبل دقيقة واحدة\",\n        \"few\" : \"قبل {0} دقائق\"\n      },\n      \"future\" : {\n        \"other\" : \"خلال {0} دقيقة\",\n        \"few\" : \"خلال {0} دقائق\",\n        \"two\" : \"خلال دقيقتين\",\n        \"one\" : \"خلال دقيقة واحدة\"\n      },\n      \"current\" : \"هذه الدقيقة\"\n    }\n  },\n  \"long\" : {\n    \"now\" : \"الآن\",\n    \"second\" : {\n      \"past\" : {\n        \"two\" : \"قبل ثانيتين\",\n        \"one\" : \"قبل ثانية واحدة\",\n        \"other\" : \"قبل {0} ثانية\",\n        \"few\" : \"قبل {0} ثوانِ\"\n      },\n      \"future\" : {\n        \"one\" : \"خلال ثانية واحدة\",\n        \"two\" : \"خلال ثانيتين\",\n        \"few\" : \"خلال {0} ثوانٍ\",\n        \"other\" : \"خلال {0} ثانية\"\n      },\n      \"current\" : \"الآن\"\n    },\n    \"minute\" : {\n      \"current\" : \"هذه الدقيقة\",\n      \"past\" : {\n        \"one\" : \"قبل دقيقة واحدة\",\n        \"few\" : \"قبل {0} دقائق\",\n        \"two\" : \"قبل دقيقتين\",\n        \"other\" : \"قبل {0} دقيقة\"\n      },\n      \"future\" : {\n        \"one\" : \"خلال دقيقة واحدة\",\n        \"few\" : \"خلال {0} دقائق\",\n        \"two\" : \"خلال دقيقتين\",\n        \"other\" : \"خلال {0} دقيقة\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"الأسبوع الماضي\",\n      \"current\" : \"هذا الأسبوع\",\n      \"past\" : {\n        \"one\" : \"قبل أسبوع واحد\",\n        \"two\" : \"قبل أسبوعين\",\n        \"few\" : \"قبل {0} أسابيع\",\n        \"other\" : \"قبل {0} أسبوع\",\n        \"many\" : \"قبل {0} أسبوعًا\"\n      },\n      \"next\" : \"الأسبوع القادم\",\n      \"future\" : {\n        \"one\" : \"خلال أسبوع واحد\",\n        \"many\" : \"خلال {0} أسبوعًا\",\n        \"other\" : \"خلال {0} أسبوع\",\n        \"two\" : \"خلال أسبوعين\",\n        \"few\" : \"خلال {0} أسابيع\"\n      }\n    },\n    \"day\" : {\n      \"future\" : {\n        \"one\" : \"خلال يوم واحد\",\n        \"few\" : \"خلال {0} أيام\",\n        \"two\" : \"خلال يومين\",\n        \"many\" : \"خلال {0} يومًا\",\n        \"other\" : \"خلال {0} يوم\"\n      },\n      \"next\" : \"غدًا\",\n      \"previous\" : \"أمس\",\n      \"current\" : \"اليوم\",\n      \"past\" : {\n        \"many\" : \"قبل {0} يومًا\",\n        \"two\" : \"قبل يومين\",\n        \"one\" : \"قبل يوم واحد\",\n        \"few\" : \"قبل {0} أيام\",\n        \"other\" : \"قبل {0} يوم\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"هذا الشهر\",\n      \"next\" : \"الشهر القادم\",\n      \"future\" : {\n        \"many\" : \"خلال {0} شهرًا\",\n        \"few\" : \"خلال {0} أشهر\",\n        \"other\" : \"خلال {0} شهر\",\n        \"one\" : \"خلال شهر واحد\",\n        \"two\" : \"خلال شهرين\"\n      },\n      \"previous\" : \"الشهر الماضي\",\n      \"past\" : {\n        \"other\" : \"قبل {0} شهر\",\n        \"two\" : \"قبل شهرين\",\n        \"many\" : \"قبل {0} شهرًا\",\n        \"one\" : \"قبل شهر واحد\",\n        \"few\" : \"قبل {0} أشهر\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"خلال سنة واحدة\",\n        \"few\" : \"خلال {0} سنوات\",\n        \"two\" : \"خلال سنتين\",\n        \"other\" : \"خلال {0} سنة\"\n      },\n      \"previous\" : \"السنة الماضية\",\n      \"next\" : \"السنة التالية\",\n      \"current\" : \"هذه السنة\",\n      \"past\" : {\n        \"two\" : \"قبل سنتين\",\n        \"other\" : \"قبل {0} سنة\",\n        \"one\" : \"قبل سنة واحدة\",\n        \"few\" : \"قبل {0} سنوات\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"خلال {0} ساعة\",\n        \"one\" : \"خلال ساعة واحدة\",\n        \"two\" : \"خلال ساعتين\",\n        \"few\" : \"خلال {0} ساعات\"\n      },\n      \"past\" : {\n        \"two\" : \"قبل ساعتين\",\n        \"few\" : \"قبل {0} ساعات\",\n        \"one\" : \"قبل ساعة واحدة\",\n        \"other\" : \"قبل {0} ساعة\"\n      },\n      \"current\" : \"الساعة الحالية\"\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"قبل ربع سنة واحد\",\n        \"two\" : \"قبل ربعي سنة\",\n        \"other\" : \"قبل {0} ربع سنة\",\n        \"few\" : \"قبل {0} أرباع سنة\"\n      },\n      \"future\" : {\n        \"few\" : \"خلال {0} أرباع سنة\",\n        \"one\" : \"خلال ربع سنة واحد\",\n        \"other\" : \"خلال {0} ربع سنة\",\n        \"two\" : \"خلال ربعي سنة\"\n      },\n      \"previous\" : \"الربع الأخير\",\n      \"current\" : \"هذا الربع\",\n      \"next\" : \"الربع القادم\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/as.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"{0} তিনি মাহ পূৰ্বে\",\n      \"future\" : \"{0} তিনি মাহত\",\n      \"current\" : \"এই তিনি মাহ\",\n      \"previous\" : \"যোৱা তিনি মাহ\",\n      \"next\" : \"অহা তিনি মাহ\"\n    },\n    \"year\" : {\n      \"previous\" : \"যোৱা বছৰ\",\n      \"next\" : \"অহা বছৰ\",\n      \"future\" : \"{0} বছৰত\",\n      \"current\" : \"এই বছৰ\",\n      \"past\" : \"{0} বছৰৰ পূৰ্বে\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} সপ্তাহত\",\n      \"previous\" : \"যোৱা সপ্তাহ\",\n      \"next\" : \"অহা সপ্তাহ\",\n      \"past\" : \"{0} সপ্তাহ পূৰ্বে\",\n      \"current\" : \"এই সপ্তাহ\"\n    },\n    \"day\" : {\n      \"current\" : \"আজি\",\n      \"past\" : \"{0} দিন পূৰ্বে\",\n      \"next\" : \"কাইলৈ\",\n      \"future\" : \"{0} দিনত\",\n      \"previous\" : \"কালি\"\n    },\n    \"hour\" : {\n      \"current\" : \"এইটো ঘণ্টাত\",\n      \"past\" : \"{0} ঘণ্টা পূৰ্বে\",\n      \"future\" : \"{0} ঘণ্টাত\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} মিনিটত\",\n      \"current\" : \"এইটো মিনিটত\",\n      \"past\" : \"{0} মিনিট পূৰ্বে\"\n    },\n    \"month\" : {\n      \"next\" : \"অহা মাহ\",\n      \"current\" : \"এই মাহ\",\n      \"past\" : \"{0} মাহ পূৰ্বে\",\n      \"future\" : \"{0} মাহত\",\n      \"previous\" : \"যোৱা মাহ\"\n    },\n    \"now\" : \"এতিয়া\",\n    \"second\" : {\n      \"future\" : \"{0} ছেকেণ্ডত\",\n      \"current\" : \"এতিয়া\",\n      \"past\" : \"{0} ছেকেণ্ড পূৰ্বে\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} মিনিট পূৰ্বে\",\n      \"future\" : \"{0} মিনিটত\",\n      \"current\" : \"এইটো মিনিটত\"\n    },\n    \"week\" : {\n      \"current\" : \"এই সপ্তাহ\",\n      \"past\" : \"{0} সপ্তাহ পূৰ্বে\",\n      \"future\" : \"{0} সপ্তাহত\",\n      \"next\" : \"অহা সপ্তাহ\",\n      \"previous\" : \"যোৱা সপ্তাহ\"\n    },\n    \"year\" : {\n      \"future\" : \"{0} বছৰত\",\n      \"previous\" : \"যোৱা বছৰ\",\n      \"next\" : \"অহা বছৰ\",\n      \"current\" : \"এই বছৰ\",\n      \"past\" : \"{0} বছৰৰ পূৰ্বে\"\n    },\n    \"day\" : {\n      \"next\" : \"কাইলৈ\",\n      \"current\" : \"আজি\",\n      \"previous\" : \"কালি\",\n      \"past\" : \"{0} দিন পূৰ্বে\",\n      \"future\" : \"{0} দিনত\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} ঘণ্টাত\",\n      \"current\" : \"এইটো ঘণ্টাত\",\n      \"past\" : \"{0} ঘণ্টা পূৰ্বে\"\n    },\n    \"quarter\" : {\n      \"current\" : \"এই তিনি মাহ\",\n      \"future\" : \"{0} তিনি মাহত\",\n      \"previous\" : \"যোৱা তিনি মাহ\",\n      \"next\" : \"অহা তিনি মাহ\",\n      \"past\" : \"{0} তিনি মাহ পূৰ্বে\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} ছেকেণ্ড পূৰ্বে\",\n      \"current\" : \"এতিয়া\",\n      \"future\" : \"{0} ছেকেণ্ডত\"\n    },\n    \"month\" : {\n      \"current\" : \"এই মাহ\",\n      \"past\" : \"{0} মাহ পূৰ্বে\",\n      \"future\" : \"{0} মাহত\",\n      \"next\" : \"অহা মাহ\",\n      \"previous\" : \"যোৱা মাহ\"\n    },\n    \"now\" : \"এতিয়া\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} ঘণ্টাত\",\n      \"current\" : \"এইটো ঘণ্টাত\",\n      \"past\" : \"{0} ঘণ্টা পূৰ্বে\"\n    },\n    \"day\" : {\n      \"next\" : \"কাইলৈ\",\n      \"past\" : \"{0} দিন পূৰ্বে\",\n      \"previous\" : \"কালি\",\n      \"future\" : \"{0} দিনত\",\n      \"current\" : \"আজি\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} ছেকেণ্ড পূৰ্বে\",\n      \"current\" : \"এতিয়া\",\n      \"future\" : \"{0} ছেকেণ্ডত\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} সপ্তাহত\",\n      \"past\" : \"{0} সপ্তাহ পূৰ্বে\",\n      \"current\" : \"এই সপ্তাহ\",\n      \"next\" : \"অহা সপ্তাহ\",\n      \"previous\" : \"যোৱা সপ্তাহ\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} মিনিটত\",\n      \"past\" : \"{0} মিনিট পূৰ্বে\",\n      \"current\" : \"এইটো মিনিটত\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} মাহত\",\n      \"past\" : \"{0} মাহ পূৰ্বে\",\n      \"current\" : \"এই মাহ\",\n      \"previous\" : \"যোৱা মাহ\",\n      \"next\" : \"অহা মাহ\"\n    },\n    \"now\" : \"এতিয়া\",\n    \"year\" : {\n      \"current\" : \"এই বছৰ\",\n      \"next\" : \"অহা বছৰ\",\n      \"previous\" : \"যোৱা বছৰ\",\n      \"future\" : \"{0} বছৰত\",\n      \"past\" : \"{0} বছৰৰ পূৰ্বে\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} তিনি মাহত\",\n      \"previous\" : \"যোৱা তিনি মাহ\",\n      \"past\" : \"{0} তিনি মাহ পূৰ্বে\",\n      \"next\" : \"অহা তিনি মাহ\",\n      \"current\" : \"এই তিনি মাহ\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/be.json",
    "content": "{\n  \"long\" : {\n    \"quarter\" : {\n      \"previous\" : \"у мінулым квартале\",\n      \"next\" : \"у наступным квартале\",\n      \"past\" : {\n        \"one\" : \"{0} квартал таму\",\n        \"few\" : \"{0} кварталы таму\",\n        \"many\" : \"{0} кварталаў таму\",\n        \"other\" : \"{0} квартала таму\"\n      },\n      \"future\" : {\n        \"many\" : \"праз {0} кварталаў\",\n        \"one\" : \"праз {0} квартал\",\n        \"other\" : \"праз {0} квартала\",\n        \"few\" : \"праз {0} кварталы\"\n      },\n      \"current\" : \"у гэтым квартале\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"праз {0} год\",\n        \"many\" : \"праз {0} гадоў\",\n        \"few\" : \"праз {0} гады\",\n        \"other\" : \"праз {0} года\"\n      },\n      \"current\" : \"у гэтым годзе\",\n      \"next\" : \"у наступным годзе\",\n      \"past\" : {\n        \"one\" : \"{0} год таму\",\n        \"other\" : \"{0} года таму\",\n        \"many\" : \"{0} гадоў таму\",\n        \"few\" : \"{0} гады таму\"\n      },\n      \"previous\" : \"у мінулым годзе\"\n    },\n    \"month\" : {\n      \"current\" : \"у гэтым месяцы\",\n      \"past\" : {\n        \"one\" : \"{0} месяц таму\",\n        \"few\" : \"{0} месяцы таму\",\n        \"many\" : \"{0} месяцаў таму\",\n        \"other\" : \"{0} месяца таму\"\n      },\n      \"previous\" : \"у мінулым месяцы\",\n      \"next\" : \"у наступным месяцы\",\n      \"future\" : {\n        \"many\" : \"праз {0} месяцаў\",\n        \"other\" : \"праз {0} месяца\",\n        \"few\" : \"праз {0} месяцы\",\n        \"one\" : \"праз {0} месяц\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"у гэту гадзіну\",\n      \"future\" : {\n        \"one\" : \"праз {0} гадзіну\",\n        \"other\" : \"праз {0} гадзіны\",\n        \"many\" : \"праз {0} гадзін\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} гадзіну таму\",\n        \"other\" : \"{0} гадзіны таму\",\n        \"many\" : \"{0} гадзін таму\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"праз {0} тыдня\",\n        \"few\" : \"праз {0} тыдні\",\n        \"one\" : \"праз {0} тыдзень\",\n        \"many\" : \"праз {0} тыдняў\"\n      },\n      \"next\" : \"на наступным тыдні\",\n      \"previous\" : \"на мінулым тыдні\",\n      \"past\" : {\n        \"many\" : \"{0} тыдняў таму\",\n        \"one\" : \"{0} тыдзень таму\",\n        \"few\" : \"{0} тыдні таму\",\n        \"other\" : \"{0} тыдня таму\"\n      },\n      \"current\" : \"на гэтым тыдні\"\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"праз {0} хвіліну\",\n        \"other\" : \"праз {0} хвіліны\",\n        \"many\" : \"праз {0} хвілін\"\n      },\n      \"current\" : \"у гэту хвіліну\",\n      \"past\" : {\n        \"one\" : \"{0} хвіліну таму\",\n        \"many\" : \"{0} хвілін таму\",\n        \"other\" : \"{0} хвіліны таму\"\n      }\n    },\n    \"now\" : \"цяпер\",\n    \"second\" : {\n      \"past\" : {\n        \"many\" : \"{0} секунд таму\",\n        \"other\" : \"{0} секунды таму\",\n        \"one\" : \"{0} секунду таму\"\n      },\n      \"future\" : {\n        \"many\" : \"праз {0} секунд\",\n        \"one\" : \"праз {0} секунду\",\n        \"other\" : \"праз {0} секунды\"\n      },\n      \"current\" : \"цяпер\"\n    },\n    \"day\" : {\n      \"current\" : \"сёння\",\n      \"next\" : \"заўтра\",\n      \"past\" : {\n        \"one\" : \"{0} дзень таму\",\n        \"many\" : \"{0} дзён таму\",\n        \"few\" : \"{0} дні таму\",\n        \"other\" : \"{0} дня таму\"\n      },\n      \"future\" : {\n        \"other\" : \"праз {0} дня\",\n        \"one\" : \"праз {0} дзень\",\n        \"many\" : \"праз {0} дзён\",\n        \"few\" : \"праз {0} дні\"\n      },\n      \"previous\" : \"учора\"\n    }\n  },\n  \"narrow\" : {\n    \"now\" : \"цяпер\",\n    \"quarter\" : {\n      \"current\" : \"у гэтым квартале\",\n      \"next\" : \"у наступным квартале\",\n      \"past\" : \"{0} кв. таму\",\n      \"previous\" : \"у мінулым квартале\",\n      \"future\" : \"праз {0} кв.\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"{0} дзень таму\",\n        \"few\" : \"{0} дні таму\",\n        \"many\" : \"{0} дзён таму\",\n        \"other\" : \"{0} дня таму\"\n      },\n      \"previous\" : \"учора\",\n      \"current\" : \"сёння\",\n      \"next\" : \"заўтра\",\n      \"future\" : {\n        \"few\" : \"праз {0} дні\",\n        \"many\" : \"праз {0} дзён\",\n        \"other\" : \"праз {0} дня\",\n        \"one\" : \"праз {0} дзень\"\n      }\n    },\n    \"week\" : {\n      \"current\" : \"на гэтым тыдні\",\n      \"next\" : \"на наступным тыдні\",\n      \"future\" : \"праз {0} тыд\",\n      \"previous\" : \"на мінулым тыдні\",\n      \"past\" : \"{0} тыд таму\"\n    },\n    \"year\" : {\n      \"current\" : \"у гэтым годзе\",\n      \"previous\" : \"у мінулым годзе\",\n      \"past\" : \"{0} г. таму\",\n      \"next\" : \"у наступным годзе\",\n      \"future\" : \"праз {0} г.\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} мес. таму\",\n      \"current\" : \"у гэтым месяцы\",\n      \"future\" : \"праз {0} мес.\",\n      \"previous\" : \"у мінулым месяцы\",\n      \"next\" : \"у наступным месяцы\"\n    },\n    \"second\" : {\n      \"current\" : \"цяпер\",\n      \"past\" : \"{0} с таму\",\n      \"future\" : \"праз {0} с\"\n    },\n    \"minute\" : {\n      \"current\" : \"у гэту хвіліну\",\n      \"future\" : \"праз {0} хв\",\n      \"past\" : \"{0} хв таму\"\n    },\n    \"hour\" : {\n      \"future\" : \"праз {0} гадз\",\n      \"past\" : \"{0} гадз таму\",\n      \"current\" : \"у гэту гадзіну\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"current\" : \"у гэтым месяцы\",\n      \"next\" : \"у наступным месяцы\",\n      \"past\" : \"{0} мес. таму\",\n      \"future\" : \"праз {0} мес.\",\n      \"previous\" : \"у мінулым месяцы\"\n    },\n    \"now\" : \"цяпер\",\n    \"week\" : {\n      \"next\" : \"на наступным тыдні\",\n      \"past\" : \"{0} тыд таму\",\n      \"current\" : \"на гэтым тыдні\",\n      \"previous\" : \"на мінулым тыдні\",\n      \"future\" : \"праз {0} тыд\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"праз {0} дня\",\n        \"few\" : \"праз {0} дні\",\n        \"one\" : \"праз {0} дзень\",\n        \"many\" : \"праз {0} дзён\"\n      },\n      \"previous\" : \"учора\",\n      \"current\" : \"сёння\",\n      \"next\" : \"заўтра\",\n      \"past\" : {\n        \"one\" : \"{0} дзень таму\",\n        \"few\" : \"{0} дні таму\",\n        \"other\" : \"{0} дня таму\",\n        \"many\" : \"{0} дзён таму\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"у гэтым годзе\",\n      \"future\" : \"праз {0} г.\",\n      \"previous\" : \"у мінулым годзе\",\n      \"next\" : \"у наступным годзе\",\n      \"past\" : \"{0} г. таму\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} гадз таму\",\n      \"current\" : \"у гэту гадзіну\",\n      \"future\" : \"праз {0} гадз\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} хв таму\",\n      \"future\" : \"праз {0} хв\",\n      \"current\" : \"у гэту хвіліну\"\n    },\n    \"second\" : {\n      \"future\" : \"праз {0} с\",\n      \"current\" : \"цяпер\",\n      \"past\" : \"{0} с таму\"\n    },\n    \"quarter\" : {\n      \"future\" : \"праз {0} кв.\",\n      \"previous\" : \"у мінулым квартале\",\n      \"next\" : \"у наступным квартале\",\n      \"past\" : \"{0} кв. таму\",\n      \"current\" : \"у гэтым квартале\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/bg.json",
    "content": "{\n  \"narrow\" : {\n    \"week\" : {\n      \"next\" : \"сл. седм.\",\n      \"past\" : \"пр. {0} седм.\",\n      \"future\" : \"сл. {0} седм.\",\n      \"previous\" : \"мин. седм.\",\n      \"current\" : \"тази седм.\"\n    },\n    \"quarter\" : {\n      \"next\" : \"следв. трим.\",\n      \"past\" : \"пр. {0} трим.\",\n      \"previous\" : \"мин. трим.\",\n      \"current\" : \"това трим.\",\n      \"future\" : \"сл. {0} трим.\"\n    },\n    \"minute\" : {\n      \"current\" : \"в тази минута\",\n      \"past\" : \"пр. {0} мин\",\n      \"future\" : \"сл. {0} мин\"\n    },\n    \"day\" : {\n      \"previous\" : \"вчера\",\n      \"next\" : \"утре\",\n      \"current\" : \"днес\",\n      \"future\" : \"сл. {0} д\",\n      \"past\" : \"пр. {0} д\"\n    },\n    \"year\" : {\n      \"current\" : \"т. г.\",\n      \"previous\" : \"мин. г.\",\n      \"next\" : \"сл. г.\",\n      \"past\" : \"пр. {0} г.\",\n      \"future\" : \"сл. {0} г.\"\n    },\n    \"second\" : {\n      \"past\" : \"пр. {0} сек\",\n      \"future\" : \"сл. {0} сек\",\n      \"current\" : \"сега\"\n    },\n    \"month\" : {\n      \"past\" : \"пр. {0} м.\",\n      \"future\" : \"сл. {0} м.\",\n      \"next\" : \"сл. м.\",\n      \"current\" : \"т. м.\",\n      \"previous\" : \"мин. м.\"\n    },\n    \"now\" : \"сега\",\n    \"hour\" : {\n      \"past\" : \"пр. {0} ч\",\n      \"current\" : \"в този час\",\n      \"future\" : \"сл. {0} ч\"\n    }\n  },\n  \"short\" : {\n    \"year\" : {\n      \"next\" : \"следв. г.\",\n      \"future\" : \"след {0} г.\",\n      \"current\" : \"т. г.\",\n      \"past\" : \"преди {0} г.\",\n      \"previous\" : \"мин. г.\"\n    },\n    \"quarter\" : {\n      \"future\" : \"след {0} трим.\",\n      \"next\" : \"следв. трим.\",\n      \"previous\" : \"мин. трим.\",\n      \"current\" : \"това трим.\",\n      \"past\" : \"преди {0} трим.\"\n    },\n    \"second\" : {\n      \"future\" : \"след {0} сек\",\n      \"current\" : \"сега\",\n      \"past\" : \"преди {0} сек\"\n    },\n    \"minute\" : {\n      \"current\" : \"в тази минута\",\n      \"past\" : \"преди {0} мин\",\n      \"future\" : \"след {0} мин\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"преди {0} ден\",\n        \"other\" : \"преди {0} дни\"\n      },\n      \"next\" : \"утре\",\n      \"future\" : {\n        \"one\" : \"след {0} ден\",\n        \"other\" : \"след {0} дни\"\n      },\n      \"previous\" : \"вчера\",\n      \"current\" : \"днес\"\n    },\n    \"month\" : {\n      \"previous\" : \"мин. мес.\",\n      \"next\" : \"следв. мес.\",\n      \"past\" : \"преди {0} м.\",\n      \"current\" : \"този мес.\",\n      \"future\" : \"след {0} м.\"\n    },\n    \"hour\" : {\n      \"current\" : \"в този час\",\n      \"past\" : \"преди {0} ч\",\n      \"future\" : \"след {0} ч\"\n    },\n    \"now\" : \"сега\",\n    \"week\" : {\n      \"previous\" : \"миналата седмица\",\n      \"current\" : \"тази седм.\",\n      \"next\" : \"следв. седм.\",\n      \"past\" : \"преди {0} седм.\",\n      \"future\" : \"след {0} седм.\"\n    }\n  },\n  \"long\" : {\n    \"month\" : {\n      \"previous\" : \"предходен месец\",\n      \"past\" : {\n        \"one\" : \"преди {0} месец\",\n        \"other\" : \"преди {0} месеца\"\n      },\n      \"current\" : \"този месец\",\n      \"future\" : {\n        \"one\" : \"след {0} месец\",\n        \"other\" : \"след {0} месеца\"\n      },\n      \"next\" : \"следващ месец\"\n    },\n    \"week\" : {\n      \"previous\" : \"предходната седмица\",\n      \"current\" : \"тази седмица\",\n      \"next\" : \"следващата седмица\",\n      \"past\" : {\n        \"other\" : \"преди {0} седмици\",\n        \"one\" : \"преди {0} седмица\"\n      },\n      \"future\" : {\n        \"one\" : \"след {0} седмица\",\n        \"other\" : \"след {0} седмици\"\n      }\n    },\n    \"quarter\" : {\n      \"future\" : {\n        \"one\" : \"след {0} тримесечие\",\n        \"other\" : \"след {0} тримесечия\"\n      },\n      \"next\" : \"следващо тримесечие\",\n      \"previous\" : \"предходно тримесечие\",\n      \"current\" : \"това тримесечие\",\n      \"past\" : {\n        \"other\" : \"преди {0} тримесечия\",\n        \"one\" : \"преди {0} тримесечие\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"след {0} час\",\n        \"other\" : \"след {0} часа\"\n      },\n      \"current\" : \"в този час\",\n      \"past\" : {\n        \"one\" : \"преди {0} час\",\n        \"other\" : \"преди {0} часа\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"след {0} секунда\",\n        \"other\" : \"след {0} секунди\"\n      },\n      \"current\" : \"сега\",\n      \"past\" : {\n        \"one\" : \"преди {0} секунда\",\n        \"other\" : \"преди {0} секунди\"\n      }\n    },\n    \"now\" : \"сега\",\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"след {0} минута\",\n        \"other\" : \"след {0} минути\"\n      },\n      \"past\" : {\n        \"one\" : \"преди {0} минута\",\n        \"other\" : \"преди {0} минути\"\n      },\n      \"current\" : \"в тази минута\"\n    },\n    \"year\" : {\n      \"current\" : \"тази година\",\n      \"next\" : \"следващата година\",\n      \"future\" : {\n        \"other\" : \"след {0} години\",\n        \"one\" : \"след {0} година\"\n      },\n      \"past\" : {\n        \"one\" : \"преди {0} година\",\n        \"other\" : \"преди {0} години\"\n      },\n      \"previous\" : \"миналата година\"\n    },\n    \"day\" : {\n      \"current\" : \"днес\",\n      \"previous\" : \"вчера\",\n      \"future\" : {\n        \"other\" : \"след {0} дни\",\n        \"one\" : \"след {0} ден\"\n      },\n      \"past\" : {\n        \"one\" : \"преди {0} ден\",\n        \"other\" : \"преди {0} дни\"\n      },\n      \"next\" : \"утре\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/bn.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"[0] ত্রৈমাসিক আগে\",\n      \"future\" : \"[0] ত্রৈমাসিকে\",\n      \"current\" : \"এই ত্রৈমাসিক\",\n      \"previous\" : \"গত ত্রৈমাসিক\",\n      \"next\" : \"পরের ত্রৈমাসিক\"\n    },\n    \"year\" : {\n      \"previous\" : \"গত বছর\",\n      \"next\" : \"পরের বছর\",\n      \"future\" : \"[0] বছরে\",\n      \"current\" : \"এই বছর\",\n      \"past\" : \"[0] বছর পূর্বে\"\n    },\n    \"week\" : {\n      \"future\" : \"[0] সপ্তাহে\",\n      \"previous\" : \"গত সপ্তাহ\",\n      \"next\" : \"পরের সপ্তাহ\",\n      \"past\" : \"[0] সপ্তাহ আগে\",\n      \"current\" : \"এই সপ্তাহ\"\n    },\n    \"day\" : {\n      \"current\" : \"আজ\",\n      \"past\" : \"[0] দিন আগে\",\n      \"next\" : \"আগামীকাল\",\n      \"future\" : \"[0] দিনের মধ্যে\",\n      \"previous\" : \"গতকাল\"\n    },\n    \"hour\" : {\n      \"current\" : \"এই ঘণ্টায়\",\n      \"past\" : \"[0] ঘন্টা আগে\",\n      \"future\" : \"[0] ঘন্টায়\"\n    },\n    \"minute\" : {\n      \"future\" : \"[0] মিনিটে\",\n      \"current\" : \"এই মিনিট\",\n      \"past\" : \"[0] মিনিট আগে\"\n    },\n    \"month\" : {\n      \"next\" : \"পরের মাস\",\n      \"current\" : \"এই মাস\",\n      \"past\" : \"[0] মাস আগে\",\n      \"future\" : \"[0] মাসে\",\n      \"previous\" : \"গত মাস\"\n    },\n    \"now\" : \"এখন\",\n    \"second\" : {\n      \"future\" : \"[0] সেকেন্ডে\",\n      \"current\" : \"এখন\",\n      \"past\" : \"[0] সেকেন্ড আগে\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"[0] মিনিট আগে\",\n      \"future\" : \"[0] মিনিটে\",\n      \"current\" : \"এই মিনিট\"\n    },\n    \"week\" : {\n      \"current\" : \"এই সপ্তাহ\",\n      \"past\" : \"[0] সপ্তাহ আগে\",\n      \"future\" : \"[0] সপ্তাহে\",\n      \"next\" : \"পরের সপ্তাহ\",\n      \"previous\" : \"গত সপ্তাহ\"\n    },\n    \"year\" : {\n      \"current\" : \"এই বছর\",\n      \"future\" : \"[0] বছরে\",\n      \"past\" : \"[0] বছর পূর্বে\",\n      \"next\" : \"পরের বছর\",\n      \"previous\" : \"গত বছর\"\n    },\n    \"day\" : {\n      \"next\" : \"আগামীকাল\",\n      \"current\" : \"আজ\",\n      \"previous\" : \"গতকাল\",\n      \"past\" : \"[0] দিন আগে\",\n      \"future\" : \"[0] দিনের মধ্যে\"\n    },\n    \"hour\" : {\n      \"future\" : \"[0] ঘন্টায়\",\n      \"current\" : \"এই ঘণ্টায়\",\n      \"past\" : \"[0] ঘন্টা আগে\"\n    },\n    \"quarter\" : {\n      \"current\" : \"এই ত্রৈমাসিক\",\n      \"future\" : \"[0] ত্রৈমাসিকে\",\n      \"previous\" : \"গত ত্রৈমাসিক\",\n      \"next\" : \"পরের ত্রৈমাসিক\",\n      \"past\" : \"[0] ত্রৈমাসিক আগে\"\n    },\n    \"second\" : {\n      \"past\" : \"[0] সেকেন্ড পূর্বে\",\n      \"current\" : \"এখন\",\n      \"future\" : \"[0] সেকেন্ডে\"\n    },\n    \"month\" : {\n      \"current\" : \"এই মাস\",\n      \"past\" : \"[0] মাস আগে\",\n      \"future\" : \"[0] মাসে\",\n      \"next\" : \"পরের মাস\",\n      \"previous\" : \"গত মাস\"\n    },\n    \"now\" : \"এখন\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"[0] ঘন্টায়\",\n      \"current\" : \"এই ঘণ্টায়\",\n      \"past\" : \"[0] ঘন্টা আগে\"\n    },\n    \"day\" : {\n      \"next\" : \"আগামীকাল\",\n      \"past\" : \"[0] দিন আগে\",\n      \"previous\" : \"গতকাল\",\n      \"future\" : \"[0] দিনের মধ্যে\",\n      \"current\" : \"আজ\"\n    },\n    \"second\" : {\n      \"past\" : \"[0] সেকেন্ড পূর্বে\",\n      \"current\" : \"এখন\",\n      \"future\" : \"[0] সেকেন্ডে\"\n    },\n    \"week\" : {\n      \"future\" : \"[0] সপ্তাহে\",\n      \"past\" : \"[0] সপ্তাহ আগে\",\n      \"current\" : \"এই সপ্তাহ\",\n      \"next\" : \"পরের সপ্তাহ\",\n      \"previous\" : \"গত সপ্তাহ\"\n    },\n    \"minute\" : {\n      \"future\" : \"[0] মিনিটে\",\n      \"past\" : \"[0] মিনিট আগে\",\n      \"current\" : \"এই মিনিট\"\n    },\n    \"month\" : {\n      \"future\" : \"[0] মাসে\",\n      \"past\" : \"[0] মাস আগে\",\n      \"current\" : \"এই মাস\",\n      \"previous\" : \"গত মাস\",\n      \"next\" : \"পরের মাস\"\n    },\n    \"now\" : \"এখন\",\n    \"year\" : {\n      \"current\" : \"এই বছর\",\n      \"next\" : \"পরের বছর\",\n      \"previous\" : \"গত বছর\",\n      \"future\" : \"[0] বছরে\",\n      \"past\" : \"[0] বছর পূর্বে\"\n    },\n    \"quarter\" : {\n      \"future\" : \"[0] ত্রৈমাসিকে\",\n      \"previous\" : \"গত ত্রৈমাসিক\",\n      \"past\" : \"[0] ত্রৈমাসিক আগে\",\n      \"next\" : \"পরের ত্রৈমাসিক\",\n      \"current\" : \"এই ত্রৈমাসিক\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/br.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} trim.\",\n      \"future\" : \"+{0} trim.\"\n    },\n    \"month\" : {\n      \"past\" : \"-{0} miz\",\n      \"next\" : \"ar miz a zeu\",\n      \"future\" : \"+{0} miz\",\n      \"previous\" : \"ar miz diaraok\",\n      \"current\" : \"ar miz-mañ\"\n    },\n    \"now\" : \"brem.\",\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"past\" : \"-{0} h\",\n      \"current\" : \"this hour\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"current\" : \"this minute\",\n      \"future\" : \"+{0} min\"\n    },\n    \"day\" : {\n      \"current\" : \"hiziv\",\n      \"future\" : \"+{0} d\",\n      \"next\" : \"warcʼhoazh\",\n      \"previous\" : \"decʼh\",\n      \"past\" : \"-{0} d\"\n    },\n    \"year\" : {\n      \"next\" : \"ar bl. a zeu\",\n      \"past\" : \"-{0} bl.\",\n      \"future\" : \"+{0} bl.\",\n      \"previous\" : \"warlene\",\n      \"current\" : \"hevlene\"\n    },\n    \"week\" : {\n      \"next\" : \"ar sizhun a zeu\",\n      \"previous\" : \"ar sizhun diaraok\",\n      \"past\" : {\n        \"many\" : \"{0} a sizhunioù zo\",\n        \"other\" : \"{0} sizhun zo\"\n      },\n      \"future\" : {\n        \"many\" : \"a-benn {0} a sizhunioù\",\n        \"other\" : \"a-benn {0} sizhun\"\n      },\n      \"current\" : \"ar sizhun-mañ\"\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"brem.\",\n      \"past\" : \"-{0} s\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"a-benn {0} min\",\n      \"current\" : \"this minute\",\n      \"past\" : \"{0} min zo\"\n    },\n    \"month\" : {\n      \"current\" : \"ar miz-mañ\",\n      \"past\" : {\n        \"two\" : \"{0} viz zo\",\n        \"many\" : \"{0} a vizioù zo\",\n        \"other\" : \"{0} miz zo\"\n      },\n      \"future\" : {\n        \"two\" : \"a-benn {0} viz\",\n        \"many\" : \"a-benn {0} a vizioù\",\n        \"other\" : \"a-benn {0} miz\"\n      },\n      \"next\" : \"ar miz a zeu\",\n      \"previous\" : \"ar miz diaraok\"\n    },\n    \"week\" : {\n      \"next\" : \"ar sizhun a zeu\",\n      \"current\" : \"ar sizhun-mañ\",\n      \"previous\" : \"ar sizhun diaraok\",\n      \"past\" : {\n        \"many\" : \"{0} a sizhunioù zo\",\n        \"other\" : \"{0} sizhun zo\"\n      },\n      \"future\" : {\n        \"other\" : \"a-benn {0} sizhun\",\n        \"many\" : \"a-benn {0} a sizhunioù\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : \"a-benn {0} e\",\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} e zo\"\n    },\n    \"day\" : {\n      \"future\" : \"a-benn {0} d\",\n      \"previous\" : \"decʼh\",\n      \"current\" : \"hiziv\",\n      \"next\" : \"warcʼhoazh\",\n      \"past\" : \"{0} d zo\"\n    },\n    \"second\" : {\n      \"future\" : \"a-benn {0} s\",\n      \"current\" : \"brem.\",\n      \"past\" : \"{0} s zo\"\n    },\n    \"now\" : \"brem.\",\n    \"year\" : {\n      \"current\" : \"hevlene\",\n      \"future\" : \"a-benn {0} bl.\",\n      \"past\" : \"{0} bl. zo\",\n      \"next\" : \"ar bl. a zeu\",\n      \"previous\" : \"warlene\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"a-benn {0} trim.\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"{0} trim. zo\"\n    }\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"{0} munut zo\",\n        \"two\" : \"{0} vunut zo\",\n        \"many\" : \"{0} a vunutoù zo\"\n      },\n      \"future\" : {\n        \"two\" : \"a-benn {0} vunut\",\n        \"many\" : \"a-benn {0} a vunutoù\",\n        \"other\" : \"a-benn {0} munut\"\n      },\n      \"current\" : \"this minute\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"many\" : \"{0} a sizhunioù zo\",\n        \"other\" : \"{0} sizhun zo\"\n      },\n      \"future\" : {\n        \"many\" : \"a-benn {0} a sizhunioù\",\n        \"other\" : \"a-benn {0} sizhun\"\n      },\n      \"next\" : \"ar sizhun a zeu\",\n      \"previous\" : \"ar sizhun diaraok\",\n      \"current\" : \"ar sizhun-mañ\"\n    },\n    \"now\" : \"bremañ\",\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"future\" : {\n        \"other\" : \"a-benn {0} eur\",\n        \"many\" : \"a-benn {0} a eurioù\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} eur zo\",\n        \"many\" : \"{0} a eurioù zo\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"other\" : \"a-benn {0} eilenn\",\n        \"many\" : \"a-benn {0} a eilennoù\"\n      },\n      \"current\" : \"bremañ\",\n      \"past\" : \"{0} eilenn zo\"\n    },\n    \"day\" : {\n      \"next\" : \"warcʼhoazh\",\n      \"previous\" : \"decʼh\",\n      \"future\" : {\n        \"many\" : \"a-benn {0} a zeizioù\",\n        \"two\" : \"a-benn {0} zeiz\",\n        \"other\" : \"a-benn {0} deiz\"\n      },\n      \"current\" : \"hiziv\",\n      \"past\" : {\n        \"other\" : \"{0} deiz zo\",\n        \"many\" : \"{0} a zeizioù zo\",\n        \"two\" : \"{0} zeiz zo\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"ar bloaz a zeu\",\n      \"past\" : {\n        \"many\" : \"{0} a vloazioù zo\",\n        \"other\" : \"{0} vloaz zo\",\n        \"one\" : \"{0} bloaz zo\",\n        \"few\" : \"{0} bloaz zo\"\n      },\n      \"future\" : {\n        \"other\" : \"a-benn {0} vloaz\",\n        \"one\" : \"a-benn {0} bloaz\",\n        \"many\" : \"a-benn {0} a vloazioù\",\n        \"few\" : \"a-benn {0} bloaz\"\n      },\n      \"previous\" : \"warlene\",\n      \"current\" : \"hevlene\"\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"few\" : \"{0} zrimiziad zo\",\n        \"other\" : \"{0} trimiziad zo\",\n        \"many\" : \"{0} a zrimiziadoù zo\",\n        \"two\" : \"{0} drimiziad zo\"\n      },\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"future\" : {\n        \"many\" : \"a-benn {0} a drimiziadoù\",\n        \"few\" : \"a-benn {0} zrimiziad\",\n        \"two\" : \"a-benn {0} drimiziad\",\n        \"other\" : \"a-benn {0} trimiziad\"\n      },\n      \"previous\" : \"last quarter\"\n    },\n    \"month\" : {\n      \"previous\" : \"ar miz diaraok\",\n      \"next\" : \"ar miz a zeu\",\n      \"future\" : {\n        \"two\" : \"a-benn {0} viz\",\n        \"many\" : \"a-benn {0} a vizioù\",\n        \"other\" : \"a-benn {0} miz\"\n      },\n      \"current\" : \"ar miz-mañ\",\n      \"past\" : {\n        \"two\" : \"{0} viz zo\",\n        \"other\" : \"{0} miz zo\",\n        \"many\" : \"{0} a vizioù zo\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/bs-Cyrl.json",
    "content": "{\n  \"narrow\" : {\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"за {0} сати\",\n        \"few\" : \"за {0} сата\",\n        \"one\" : \"за {0} сат\"\n      },\n      \"past\" : {\n        \"few\" : \"пре {0} сата\",\n        \"other\" : \"пре {0} сати\",\n        \"one\" : \"пре {0} сат\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\"\n    },\n    \"week\" : {\n      \"previous\" : \"Прошле недеље\",\n      \"current\" : \"Ове недеље\",\n      \"future\" : {\n        \"other\" : \"за {0} недеља\",\n        \"few\" : \"за {0} недеље\",\n        \"one\" : \"за {0} недељу\"\n      },\n      \"past\" : {\n        \"one\" : \"пре {0} недељу\",\n        \"other\" : \"пре {0} недеља\",\n        \"few\" : \"пре {0} недеље\"\n      },\n      \"next\" : \"Следеће недеље\"\n    },\n    \"day\" : {\n      \"next\" : \"сутра\",\n      \"past\" : {\n        \"one\" : \"пре {0} дан\",\n        \"other\" : \"пре {0} дана\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} дан\",\n        \"other\" : \"за {0} дана\"\n      },\n      \"current\" : \"данас\",\n      \"previous\" : \"јуче\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"few\" : \"пре {0} секунде\",\n        \"other\" : \"пре {0} секунди\",\n        \"one\" : \"пре {0} секунд\"\n      },\n      \"current\" : \"now\",\n      \"future\" : {\n        \"one\" : \"за {0} секунд\",\n        \"few\" : \"за {0} секунде\",\n        \"other\" : \"за {0} секунди\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"пре {0} годину\",\n        \"few\" : \"пре {0} године\",\n        \"other\" : \"пре {0} година\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} годину\",\n        \"few\" : \"за {0} године\",\n        \"other\" : \"за {0} година\"\n      },\n      \"previous\" : \"Прошле године\",\n      \"current\" : \"Ове године\",\n      \"next\" : \"Следеће године\"\n    },\n    \"month\" : {\n      \"previous\" : \"Прошлог месеца\",\n      \"current\" : \"Овог месеца\",\n      \"past\" : {\n        \"other\" : \"пре {0} месеци\",\n        \"one\" : \"пре {0} месец\",\n        \"few\" : \"пре {0} месеца\"\n      },\n      \"next\" : \"Следећег месеца\",\n      \"future\" : {\n        \"one\" : \"за {0} месец\",\n        \"few\" : \"за {0} месеца\",\n        \"other\" : \"за {0} месеци\"\n      }\n    },\n    \"now\" : \"now\",\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"пре {0} минута\",\n        \"one\" : \"пре {0} минут\"\n      },\n      \"future\" : {\n        \"other\" : \"за {0} минута\",\n        \"one\" : \"за {0} минут\"\n      },\n      \"current\" : \"this minute\"\n    }\n  },\n  \"long\" : {\n    \"month\" : {\n      \"next\" : \"Следећег месеца\",\n      \"future\" : {\n        \"one\" : \"за {0} месец\",\n        \"other\" : \"за {0} месеци\",\n        \"few\" : \"за {0} месеца\"\n      },\n      \"previous\" : \"Прошлог месеца\",\n      \"current\" : \"Овог месеца\",\n      \"past\" : {\n        \"few\" : \"пре {0} месеца\",\n        \"one\" : \"пре {0} месец\",\n        \"other\" : \"пре {0} месеци\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : {\n        \"one\" : \"пре {0} минут\",\n        \"other\" : \"пре {0} минута\"\n      },\n      \"future\" : {\n        \"other\" : \"за {0} минута\",\n        \"one\" : \"за {0} минут\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"Следеће недеље\",\n      \"future\" : {\n        \"few\" : \"за {0} недеље\",\n        \"other\" : \"за {0} недеља\",\n        \"one\" : \"за {0} недељу\"\n      },\n      \"previous\" : \"Прошле недеље\",\n      \"past\" : {\n        \"few\" : \"пре {0} недеље\",\n        \"other\" : \"пре {0} недеља\",\n        \"one\" : \"пре {0} недељу\"\n      },\n      \"current\" : \"Ове недеље\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"пре {0} секунди\",\n        \"one\" : \"пре {0} секунд\",\n        \"few\" : \"пре {0} секунде\"\n      },\n      \"future\" : {\n        \"other\" : \"за {0} секунди\",\n        \"few\" : \"за {0} секунде\",\n        \"one\" : \"за {0} секунд\"\n      },\n      \"current\" : \"now\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"за {0} сати\",\n        \"few\" : \"за {0} сата\",\n        \"one\" : \"за {0} сат\"\n      },\n      \"past\" : {\n        \"one\" : \"пре {0} сат\",\n        \"other\" : \"пре {0} сати\",\n        \"few\" : \"пре {0} сата\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"this quarter\"\n    },\n    \"year\" : {\n      \"next\" : \"Следеће године\",\n      \"past\" : {\n        \"one\" : \"пре {0} годину\",\n        \"few\" : \"пре {0} године\",\n        \"other\" : \"пре {0} година\"\n      },\n      \"current\" : \"Ове године\",\n      \"future\" : {\n        \"few\" : \"за {0} године\",\n        \"other\" : \"за {0} година\",\n        \"one\" : \"за {0} годину\"\n      },\n      \"previous\" : \"Прошле године\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"пре {0} дан\",\n        \"other\" : \"пре {0} дана\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} дан\",\n        \"other\" : \"за {0} дана\"\n      },\n      \"current\" : \"данас\",\n      \"previous\" : \"јуче\",\n      \"next\" : \"сутра\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"other\" : \"за {0} месеци\",\n        \"few\" : \"за {0} месеца\",\n        \"one\" : \"за {0} месец\"\n      },\n      \"previous\" : \"Прошлог месеца\",\n      \"current\" : \"Овог месеца\",\n      \"next\" : \"Следећег месеца\",\n      \"past\" : {\n        \"other\" : \"пре {0} месеци\",\n        \"one\" : \"пре {0} месец\",\n        \"few\" : \"пре {0} месеца\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"Прошле године\",\n      \"next\" : \"Следеће године\",\n      \"current\" : \"Ове године\",\n      \"future\" : {\n        \"few\" : \"за {0} године\",\n        \"other\" : \"за {0} година\",\n        \"one\" : \"за {0} годину\"\n      },\n      \"past\" : {\n        \"one\" : \"пре {0} годину\",\n        \"few\" : \"пре {0} године\",\n        \"other\" : \"пре {0} година\"\n      }\n    },\n    \"week\" : {\n      \"past\" : {\n        \"other\" : \"пре {0} недеља\",\n        \"one\" : \"пре {0} недељу\",\n        \"few\" : \"пре {0} недеље\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} недељу\",\n        \"other\" : \"за {0} недеља\",\n        \"few\" : \"за {0} недеље\"\n      },\n      \"next\" : \"Следеће недеље\",\n      \"current\" : \"Ове недеље\",\n      \"previous\" : \"Прошле недеље\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"other\" : \"пре {0} дана\",\n        \"one\" : \"пре {0} дан\"\n      },\n      \"next\" : \"сутра\",\n      \"previous\" : \"јуче\",\n      \"current\" : \"данас\",\n      \"future\" : {\n        \"one\" : \"за {0} дан\",\n        \"other\" : \"за {0} дана\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"one\" : \"пре {0} сат\",\n        \"few\" : \"пре {0} сата\",\n        \"other\" : \"пре {0} сати\"\n      },\n      \"future\" : {\n        \"few\" : \"за {0} сата\",\n        \"other\" : \"за {0} сати\",\n        \"one\" : \"за {0} сат\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"пре {0} минут\",\n        \"other\" : \"пре {0} минута\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} минут\",\n        \"other\" : \"за {0} минута\"\n      },\n      \"current\" : \"this minute\"\n    },\n    \"now\" : \"now\",\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : {\n        \"one\" : \"пре {0} секунд\",\n        \"few\" : \"пре {0} секунде\",\n        \"other\" : \"пре {0} секунди\"\n      },\n      \"future\" : {\n        \"other\" : \"за {0} секунди\",\n        \"few\" : \"за {0} секунде\",\n        \"one\" : \"за {0} секунд\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/bs.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"past\" : \"prije {0} sek.\",\n      \"future\" : \"za {0} sek.\",\n      \"current\" : \"sada\"\n    },\n    \"week\" : {\n      \"current\" : \"ove sedmice\",\n      \"next\" : \"sljedeće sedmice\",\n      \"past\" : \"prije {0} sed.\",\n      \"previous\" : \"prošle sedmice\",\n      \"future\" : \"za {0} sed.\"\n    },\n    \"year\" : {\n      \"next\" : \"sljedeće godine\",\n      \"previous\" : \"prošle godine\",\n      \"current\" : \"ove godine\",\n      \"past\" : \"prije {0} g.\",\n      \"future\" : \"za {0} g.\"\n    },\n    \"minute\" : {\n      \"current\" : \"ova minuta\",\n      \"past\" : \"prije {0} min.\",\n      \"future\" : \"za {0} min.\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"posljednji kvartal\",\n      \"future\" : \"za {0} kv.\",\n      \"next\" : \"sljedeći kvartal\",\n      \"current\" : \"ovaj kvartal\",\n      \"past\" : \"prije {0} kv.\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"za {0} sati\",\n        \"one\" : \"za {0} sat\",\n        \"few\" : \"za {0} sata\"\n      },\n      \"past\" : {\n        \"other\" : \"prije {0} sati\",\n        \"one\" : \"prije {0} sat\",\n        \"few\" : \"prije {0} sata\"\n      },\n      \"current\" : \"ovaj sat\"\n    },\n    \"day\" : {\n      \"previous\" : \"jučer\",\n      \"current\" : \"danas\",\n      \"next\" : \"sutra\",\n      \"past\" : \"prije {0} d.\",\n      \"future\" : \"za {0} d.\"\n    },\n    \"now\" : \"sada\",\n    \"month\" : {\n      \"future\" : \"za {0} mj.\",\n      \"previous\" : \"prošli mjesec\",\n      \"next\" : \"sljedeći mjesec\",\n      \"current\" : \"ovaj mjesec\",\n      \"past\" : \"prije {0} mj.\"\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"previous\" : \"prošle sedmice\",\n      \"future\" : {\n        \"other\" : \"za {0} sedmica\",\n        \"one\" : \"za {0} sedmicu\",\n        \"few\" : \"za {0} sedmice\"\n      },\n      \"past\" : {\n        \"few\" : \"prije {0} sedmice\",\n        \"one\" : \"prije {0} sedmicu\",\n        \"other\" : \"prije {0} sedmica\"\n      },\n      \"current\" : \"ove sedmice\",\n      \"next\" : \"sljedeće sedmice\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"few\" : \"za {0} sekunde\",\n        \"one\" : \"za {0} sekundu\",\n        \"other\" : \"za {0} sekundi\"\n      },\n      \"current\" : \"sada\",\n      \"past\" : {\n        \"one\" : \"prije {0} sekundu\",\n        \"other\" : \"prije {0} sekundi\",\n        \"few\" : \"prije {0} sekunde\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"za {0} minutu\",\n        \"few\" : \"za {0} minute\",\n        \"other\" : \"za {0} minuta\"\n      },\n      \"current\" : \"ova minuta\",\n      \"past\" : {\n        \"one\" : \"prije {0} minutu\",\n        \"other\" : \"prije {0} minuta\",\n        \"few\" : \"prije {0} minute\"\n      }\n    },\n    \"quarter\" : {\n      \"future\" : {\n        \"one\" : \"za {0} kvartal\",\n        \"other\" : \"za {0} kvartala\"\n      },\n      \"current\" : \"ovaj kvartal\",\n      \"next\" : \"sljedeći kvartal\",\n      \"past\" : {\n        \"other\" : \"prije {0} kvartala\",\n        \"one\" : \"prije {0} kvartal\"\n      },\n      \"previous\" : \"posljednji kvartal\"\n    },\n    \"day\" : {\n      \"previous\" : \"jučer\",\n      \"current\" : \"danas\",\n      \"next\" : \"sutra\",\n      \"past\" : {\n        \"one\" : \"prije {0} dan\",\n        \"other\" : \"prije {0} dana\"\n      },\n      \"future\" : {\n        \"other\" : \"za {0} dana\",\n        \"one\" : \"za {0} dan\"\n      }\n    },\n    \"now\" : \"sada\",\n    \"month\" : {\n      \"next\" : \"sljedeći mjesec\",\n      \"current\" : \"ovaj mjesec\",\n      \"future\" : {\n        \"one\" : \"za {0} mjesec\",\n        \"other\" : \"za {0} mjeseci\",\n        \"few\" : \"za {0} mjeseca\"\n      },\n      \"previous\" : \"prošli mjesec\",\n      \"past\" : {\n        \"few\" : \"prije {0} mjeseca\",\n        \"one\" : \"prije {0} mjesec\",\n        \"other\" : \"prije {0} mjeseci\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"few\" : \"prije {0} sata\",\n        \"other\" : \"prije {0} sati\",\n        \"one\" : \"prije {0} sat\"\n      },\n      \"current\" : \"ovaj sat\",\n      \"future\" : {\n        \"few\" : \"za {0} sata\",\n        \"other\" : \"za {0} sati\",\n        \"one\" : \"za {0} sat\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"ove godine\",\n      \"past\" : {\n        \"one\" : \"prije {0} godinu\",\n        \"few\" : \"prije {0} godine\",\n        \"other\" : \"prije {0} godina\"\n      },\n      \"previous\" : \"prošle godine\",\n      \"future\" : {\n        \"one\" : \"za {0} godinu\",\n        \"other\" : \"za {0} godina\",\n        \"few\" : \"za {0} godine\"\n      },\n      \"next\" : \"sljedeće godine\"\n    }\n  },\n  \"short\" : {\n    \"week\" : {\n      \"previous\" : \"prošle sedmice\",\n      \"current\" : \"ove sedmice\",\n      \"next\" : \"sljedeće sedmice\",\n      \"past\" : \"prije {0} sed.\",\n      \"future\" : \"za {0} sed.\"\n    },\n    \"day\" : {\n      \"next\" : \"sutra\",\n      \"past\" : \"prije {0} d.\",\n      \"future\" : \"za {0} d.\",\n      \"previous\" : \"jučer\",\n      \"current\" : \"danas\"\n    },\n    \"second\" : {\n      \"future\" : \"za {0} sek.\",\n      \"current\" : \"sada\",\n      \"past\" : \"prije {0} sek.\"\n    },\n    \"month\" : {\n      \"previous\" : \"prošli mjesec\",\n      \"next\" : \"sljedeći mjesec\",\n      \"past\" : \"prije {0} mj.\",\n      \"current\" : \"ovaj mjesec\",\n      \"future\" : \"za {0} mj.\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"few\" : \"za {0} sata\",\n        \"other\" : \"za {0} sati\",\n        \"one\" : \"za {0} sat\"\n      },\n      \"current\" : \"ovaj sat\",\n      \"past\" : {\n        \"other\" : \"prije {0} sati\",\n        \"one\" : \"prije {0} sat\",\n        \"few\" : \"prije {0} sata\"\n      }\n    },\n    \"now\" : \"sada\",\n    \"quarter\" : {\n      \"future\" : \"za {0} kv.\",\n      \"next\" : \"sljedeći kvartal\",\n      \"previous\" : \"posljednji kvartal\",\n      \"current\" : \"ovaj kvartal\",\n      \"past\" : \"prije {0} kv.\"\n    },\n    \"minute\" : {\n      \"current\" : \"ova minuta\",\n      \"past\" : \"prije {0} min.\",\n      \"future\" : \"za {0} min.\"\n    },\n    \"year\" : {\n      \"next\" : \"sljedeće godine\",\n      \"future\" : \"za {0} god.\",\n      \"current\" : \"ove godine\",\n      \"past\" : \"prije {0} god.\",\n      \"previous\" : \"prošle godine\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ca.json",
    "content": "{\n  \"long\" : {\n    \"minute\" : {\n      \"current\" : \"aquest minut\",\n      \"past\" : {\n        \"one\" : \"fa {0} minut\",\n        \"other\" : \"fa {0} minuts\"\n      },\n      \"future\" : {\n        \"other\" : \"d’aquí a {0} minuts\",\n        \"one\" : \"d’aquí a {0} minut\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"fa {0} hores\",\n        \"one\" : \"fa {0} hora\"\n      },\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} hora\",\n        \"other\" : \"d’aquí a {0} hores\"\n      },\n      \"current\" : \"aquesta hora\"\n    },\n    \"quarter\" : {\n      \"current\" : \"aquest trimestre\",\n      \"next\" : \"el trimestre que ve\",\n      \"previous\" : \"el trimestre passat\",\n      \"past\" : {\n        \"other\" : \"fa {0} trimestres\",\n        \"one\" : \"fa {0} trimestre\"\n      },\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} trimestre\",\n        \"other\" : \"d’aquí a {0} trimestres\"\n      }\n    },\n    \"now\" : \"ara\",\n    \"year\" : {\n      \"next\" : \"l’any que ve\",\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} any\",\n        \"other\" : \"d’aquí a {0} anys\"\n      },\n      \"past\" : {\n        \"one\" : \"fa {0} any\",\n        \"other\" : \"fa {0} anys\"\n      },\n      \"current\" : \"enguany\",\n      \"previous\" : \"l’any passat\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"other\" : \"d’aquí a {0} mesos\",\n        \"one\" : \"d’aquí a {0} mes\"\n      },\n      \"previous\" : \"el mes passat\",\n      \"next\" : \"el mes que ve\",\n      \"past\" : {\n        \"other\" : \"fa {0} mesos\",\n        \"one\" : \"fa {0} mes\"\n      },\n      \"current\" : \"aquest mes\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} segon\",\n        \"other\" : \"d’aquí a {0} segons\"\n      },\n      \"current\" : \"ara\",\n      \"past\" : {\n        \"other\" : \"fa {0} segons\",\n        \"one\" : \"fa {0} segon\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"ahir\",\n      \"current\" : \"avui\",\n      \"next\" : \"demà\",\n      \"future\" : {\n        \"other\" : \"d’aquí a {0} dies\",\n        \"one\" : \"d’aquí a {0} dia\"\n      },\n      \"past\" : {\n        \"one\" : \"fa {0} dia\",\n        \"other\" : \"fa {0} dies\"\n      }\n    },\n    \"week\" : {\n      \"current\" : \"aquesta setmana\",\n      \"previous\" : \"la setmana passada\",\n      \"past\" : {\n        \"other\" : \"fa {0} setmanes\",\n        \"one\" : \"fa {0} setmana\"\n      },\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} setmana\",\n        \"other\" : \"d’aquí a {0} setmanes\"\n      },\n      \"next\" : \"la setmana que ve\"\n    }\n  },\n  \"narrow\" : {\n    \"year\" : {\n      \"previous\" : \"l’any passat\",\n      \"current\" : \"enguany\",\n      \"next\" : \"l’any que ve\",\n      \"past\" : {\n        \"one\" : \"fa {0} any\",\n        \"other\" : \"fa {0} anys\"\n      },\n      \"future\" : {\n        \"other\" : \"d’aquí a {0} anys\",\n        \"one\" : \"d’aquí a {0} any\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"ara\",\n      \"future\" : \"d’aquí a {0} s\",\n      \"past\" : \"fa {0} s\"\n    },\n    \"hour\" : {\n      \"past\" : \"fa {0} h\",\n      \"current\" : \"aquesta hora\",\n      \"future\" : \"d‘aquí a {0} h\"\n    },\n    \"week\" : {\n      \"current\" : \"aquesta setm.\",\n      \"previous\" : \"setm. passada\",\n      \"past\" : \"fa {0} setm.\",\n      \"next\" : \"setm. vinent\",\n      \"future\" : \"d’aquí a {0} setm.\"\n    },\n    \"day\" : {\n      \"current\" : \"avui\",\n      \"next\" : \"demà\",\n      \"past\" : {\n        \"other\" : \"fa {0} dies\",\n        \"one\" : \"fa {0} dia\"\n      },\n      \"previous\" : \"ahir\",\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} dia\",\n        \"other\" : \"d’aquí a {0} dies\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"aquest mes\",\n      \"next\" : \"mes vinent\",\n      \"past\" : {\n        \"one\" : \"fa {0} mes\",\n        \"other\" : \"fa {0} mesos\"\n      },\n      \"previous\" : \"mes passat\",\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} mes\",\n        \"other\" : \"d’aquí a {0} mesos\"\n      }\n    },\n    \"now\" : \"ara\",\n    \"minute\" : {\n      \"current\" : \"aquest minut\",\n      \"past\" : \"fa {0} min\",\n      \"future\" : \"d’aquí a {0} min\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"trim. passat\",\n      \"current\" : \"aquest trim.\",\n      \"past\" : \"fa {0} trim.\",\n      \"future\" : \"d’aquí a {0} trim.\",\n      \"next\" : \"trim. vinent\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"next\" : \"el mes que ve\",\n      \"past\" : {\n        \"other\" : \"fa {0} mesos\",\n        \"one\" : \"fa {0} mes\"\n      },\n      \"current\" : \"aquest mes\",\n      \"previous\" : \"el mes passat\",\n      \"future\" : {\n        \"other\" : \"d’aquí a {0} mesos\",\n        \"one\" : \"d’aquí a {0} mes\"\n      }\n    },\n    \"now\" : \"ara\",\n    \"day\" : {\n      \"next\" : \"demà\",\n      \"current\" : \"avui\",\n      \"previous\" : \"ahir\",\n      \"past\" : {\n        \"one\" : \"fa {0} dia\",\n        \"other\" : \"fa {0} dies\"\n      },\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} dia\",\n        \"other\" : \"d’aquí a {0} dies\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"enguany\",\n      \"next\" : \"l’any que ve\",\n      \"past\" : {\n        \"other\" : \"fa {0} anys\",\n        \"one\" : \"fa {0} any\"\n      },\n      \"future\" : {\n        \"one\" : \"d’aquí a {0} any\",\n        \"other\" : \"d’aquí a {0} anys\"\n      },\n      \"previous\" : \"l’any passat\"\n    },\n    \"hour\" : {\n      \"current\" : \"aquesta hora\",\n      \"past\" : \"fa {0} h\",\n      \"future\" : \"d’aquí a {0} h\"\n    },\n    \"minute\" : {\n      \"past\" : \"fa {0} min\",\n      \"future\" : \"d’aquí a {0} min\",\n      \"current\" : \"aquest minut\"\n    },\n    \"second\" : {\n      \"future\" : \"d’aquí a {0} s\",\n      \"past\" : \"fa {0} s\",\n      \"current\" : \"ara\"\n    },\n    \"quarter\" : {\n      \"current\" : \"aquest trim.\",\n      \"future\" : \"d’aquí a {0} trim.\",\n      \"previous\" : \"el trim. passat\",\n      \"next\" : \"el trim. que ve\",\n      \"past\" : \"fa {0} trim.\"\n    },\n    \"week\" : {\n      \"future\" : \"d’aquí a {0} setm.\",\n      \"previous\" : \"la setm. passada\",\n      \"next\" : \"la setm. que ve\",\n      \"past\" : \"fa {0} setm.\",\n      \"current\" : \"aquesta setm.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/cs.json",
    "content": "{\n  \"long\" : {\n    \"month\" : {\n      \"past\" : {\n        \"many\" : \"před {0} měsíce\",\n        \"other\" : \"před {0} měsíci\",\n        \"one\" : \"před {0} měsícem\"\n      },\n      \"previous\" : \"minulý měsíc\",\n      \"current\" : \"tento měsíc\",\n      \"future\" : {\n        \"one\" : \"za {0} měsíc\",\n        \"many\" : \"za {0} měsíce\",\n        \"few\" : \"za {0} měsíce\",\n        \"other\" : \"za {0} měsíců\"\n      },\n      \"next\" : \"příští měsíc\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"other\" : \"za {0} let\",\n        \"many\" : \"za {0} roku\",\n        \"one\" : \"za {0} rok\",\n        \"few\" : \"za {0} roky\"\n      },\n      \"past\" : {\n        \"one\" : \"před {0} rokem\",\n        \"many\" : \"před {0} roku\",\n        \"other\" : \"před {0} lety\"\n      },\n      \"current\" : \"tento rok\",\n      \"next\" : \"příští rok\",\n      \"previous\" : \"minulý rok\"\n    },\n    \"second\" : {\n      \"current\" : \"nyní\",\n      \"past\" : {\n        \"one\" : \"před {0} sekundou\",\n        \"other\" : \"před {0} sekundami\",\n        \"many\" : \"před {0} sekundy\"\n      },\n      \"future\" : {\n        \"many\" : \"za {0} sekundy\",\n        \"other\" : \"za {0} sekund\",\n        \"one\" : \"za {0} sekundu\",\n        \"few\" : \"za {0} sekundy\"\n      }\n    },\n    \"quarter\" : {\n      \"future\" : \"za {0} čtvrtletí\",\n      \"previous\" : \"minulé čtvrtletí\",\n      \"current\" : \"toto čtvrtletí\",\n      \"past\" : {\n        \"one\" : \"před {0} čtvrtletím\",\n        \"many\" : \"před {0} čtvrtletí\",\n        \"other\" : \"před {0} čtvrtletími\"\n      },\n      \"next\" : \"příští čtvrtletí\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"many\" : \"před {0} týdne\",\n        \"one\" : \"před {0} týdnem\",\n        \"other\" : \"před {0} týdny\"\n      },\n      \"current\" : \"tento týden\",\n      \"future\" : {\n        \"other\" : \"za {0} týdnů\",\n        \"one\" : \"za {0} týden\",\n        \"few\" : \"za {0} týdny\",\n        \"many\" : \"za {0} týdne\"\n      },\n      \"previous\" : \"minulý týden\",\n      \"next\" : \"příští týden\"\n    },\n    \"minute\" : {\n      \"current\" : \"tuto minutu\",\n      \"past\" : {\n        \"one\" : \"před {0} minutou\",\n        \"other\" : \"před {0} minutami\",\n        \"many\" : \"před {0} minuty\"\n      },\n      \"future\" : {\n        \"few\" : \"za {0} minuty\",\n        \"one\" : \"za {0} minutu\",\n        \"many\" : \"za {0} minuty\",\n        \"other\" : \"za {0} minut\"\n      }\n    },\n    \"day\" : {\n      \"past\" : {\n        \"other\" : \"před {0} dny\",\n        \"one\" : \"před {0} dnem\",\n        \"many\" : \"před {0} dne\"\n      },\n      \"previous\" : \"včera\",\n      \"current\" : \"dnes\",\n      \"next\" : \"zítra\",\n      \"future\" : {\n        \"few\" : \"za {0} dny\",\n        \"many\" : \"za {0} dne\",\n        \"other\" : \"za {0} dní\",\n        \"one\" : \"za {0} den\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"many\" : \"za {0} hodiny\",\n        \"other\" : \"za {0} hodin\",\n        \"one\" : \"za {0} hodinu\",\n        \"few\" : \"za {0} hodiny\"\n      },\n      \"current\" : \"tuto hodinu\",\n      \"past\" : {\n        \"many\" : \"před {0} hodiny\",\n        \"one\" : \"před {0} hodinou\",\n        \"other\" : \"před {0} hodinami\"\n      }\n    },\n    \"now\" : \"nyní\"\n  },\n  \"narrow\" : {\n    \"hour\" : {\n      \"future\" : \"za {0} h\",\n      \"current\" : \"tuto hodinu\",\n      \"past\" : \"před {0} h\"\n    },\n    \"minute\" : {\n      \"past\" : \"před {0} min\",\n      \"future\" : \"za {0} min\",\n      \"current\" : \"tuto minutu\"\n    },\n    \"second\" : {\n      \"past\" : \"před {0} s\",\n      \"current\" : \"nyní\",\n      \"future\" : \"za {0} s\"\n    },\n    \"now\" : \"nyní\",\n    \"quarter\" : {\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"minulé čtvrtletí\",\n      \"next\" : \"příští čtvrtletí\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"toto čtvrtletí\"\n    },\n    \"week\" : {\n      \"previous\" : \"minulý týd.\",\n      \"past\" : \"před {0} týd.\",\n      \"next\" : \"příští týd.\",\n      \"current\" : \"tento týd.\",\n      \"future\" : \"za {0} týd.\"\n    },\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"před {0} l.\",\n        \"many\" : \"před {0} r.\",\n        \"one\" : \"před {0} r.\",\n        \"few\" : \"před {0} r.\"\n      },\n      \"previous\" : \"minulý rok\",\n      \"current\" : \"tento rok\",\n      \"next\" : \"příští rok\",\n      \"future\" : {\n        \"few\" : \"za {0} r.\",\n        \"many\" : \"za {0} r.\",\n        \"one\" : \"za {0} r.\",\n        \"other\" : \"za {0} l.\"\n      }\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"před {0} dnem\",\n        \"other\" : \"před {0} dny\",\n        \"many\" : \"před {0} dne\"\n      },\n      \"previous\" : \"včera\",\n      \"future\" : {\n        \"one\" : \"za {0} den\",\n        \"few\" : \"za {0} dny\",\n        \"many\" : \"za {0} dne\",\n        \"other\" : \"za {0} dní\"\n      },\n      \"next\" : \"zítra\",\n      \"current\" : \"dnes\"\n    },\n    \"month\" : {\n      \"current\" : \"tento měs.\",\n      \"next\" : \"příští měs.\",\n      \"future\" : \"za {0} měs.\",\n      \"past\" : \"před {0} měs.\",\n      \"previous\" : \"minuý měs.\"\n    }\n  },\n  \"short\" : {\n    \"year\" : {\n      \"current\" : \"tento rok\",\n      \"previous\" : \"minulý rok\",\n      \"next\" : \"příští rok\",\n      \"past\" : {\n        \"few\" : \"před {0} r.\",\n        \"one\" : \"před {0} r.\",\n        \"many\" : \"před {0} r.\",\n        \"other\" : \"před {0} l.\"\n      },\n      \"future\" : {\n        \"few\" : \"za {0} r.\",\n        \"many\" : \"za {0} r.\",\n        \"other\" : \"za {0} l.\",\n        \"one\" : \"za {0} r.\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"příští čtvrtletí\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"toto čtvrtletí\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"minulé čtvrtletí\"\n    },\n    \"second\" : {\n      \"past\" : \"před {0} s\",\n      \"future\" : \"za {0} s\",\n      \"current\" : \"nyní\"\n    },\n    \"minute\" : {\n      \"future\" : \"za {0} min\",\n      \"current\" : \"tuto minutu\",\n      \"past\" : \"před {0} min\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"many\" : \"před {0} dne\",\n        \"other\" : \"před {0} dny\",\n        \"one\" : \"před {0} dnem\"\n      },\n      \"next\" : \"zítra\",\n      \"future\" : {\n        \"one\" : \"za {0} den\",\n        \"many\" : \"za {0} dne\",\n        \"other\" : \"za {0} dní\",\n        \"few\" : \"za {0} dny\"\n      },\n      \"previous\" : \"včera\",\n      \"current\" : \"dnes\"\n    },\n    \"month\" : {\n      \"future\" : \"za {0} měs.\",\n      \"next\" : \"příští měs.\",\n      \"previous\" : \"minulý měs.\",\n      \"current\" : \"tento měs.\",\n      \"past\" : \"před {0} měs.\"\n    },\n    \"hour\" : {\n      \"future\" : \"za {0} h\",\n      \"current\" : \"tuto hodinu\",\n      \"past\" : \"před {0} h\"\n    },\n    \"now\" : \"nyní\",\n    \"week\" : {\n      \"previous\" : \"minulý týd.\",\n      \"next\" : \"příští týd.\",\n      \"past\" : \"před {0} týd.\",\n      \"current\" : \"tento týd.\",\n      \"future\" : \"za {0} týd.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/cy.json",
    "content": "{\n  \"narrow\" : {\n    \"now\" : \"nawr\",\n    \"minute\" : {\n      \"past\" : \"{0} mun. yn ôl\",\n      \"current\" : \"y funud hon\",\n      \"future\" : \"ymhen {0} mun.\"\n    },\n    \"day\" : {\n      \"current\" : \"heddiw\",\n      \"future\" : \"ymhen {0} diwrnod\",\n      \"next\" : \"yfory\",\n      \"past\" : {\n        \"two\" : \"{0} ddiwrnod yn ôl\",\n        \"other\" : \"{0} diwrnod yn ôl\"\n      },\n      \"previous\" : \"ddoe\"\n    },\n    \"month\" : {\n      \"next\" : \"mis nesaf\",\n      \"past\" : {\n        \"two\" : \"{0} fis yn ôl\",\n        \"other\" : \"{0} mis yn ôl\"\n      },\n      \"future\" : {\n        \"one\" : \"ymhen mis\",\n        \"two\" : \"ymhen deufis\",\n        \"other\" : \"ymhen {0} mis\"\n      },\n      \"previous\" : \"mis diwethaf\",\n      \"current\" : \"y mis hwn\"\n    },\n    \"week\" : {\n      \"future\" : \"ymhen {0} wythnos\",\n      \"previous\" : \"wythnos ddiwethaf\",\n      \"current\" : \"yr wythnos hon\",\n      \"next\" : \"wythnos nesaf\",\n      \"past\" : {\n        \"two\" : \"pythefnos yn ôl\",\n        \"other\" : \"{0} wythnos yn ôl\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"chwarter olaf\",\n      \"future\" : \"ymhen {0} chwarter\",\n      \"next\" : \"chwarter nesaf\",\n      \"current\" : \"chwarter hwn\",\n      \"past\" : {\n        \"one\" : \"{0} chwarter yn ôl\",\n        \"few\" : \"{0} chwarter yn ôl\",\n        \"many\" : \"{0} chwarter yn ôl\",\n        \"other\" : \"{0} o chwarteri yn ôl\",\n        \"two\" : \"{0} chwarter yn ôl\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"few\" : \"ymhen {0} blynedd\",\n        \"one\" : \"ymhen blwyddyn\",\n        \"many\" : \"ymhen {0} blynedd\",\n        \"other\" : \"ymhen {0} mlynedd\",\n        \"two\" : \"ymhen {0} flynedd\"\n      },\n      \"next\" : \"blwyddyn nesaf\",\n      \"past\" : {\n        \"other\" : \"{0} o flynyddoedd yn ôl\",\n        \"two\" : \"{0} flynedd yn ôl\",\n        \"few\" : \"{0} blynedd yn ôl\",\n        \"many\" : \"{0} blynedd yn ôl\",\n        \"one\" : \"blwyddyn yn ôl\"\n      },\n      \"previous\" : \"llynedd\",\n      \"current\" : \"eleni\"\n    },\n    \"hour\" : {\n      \"current\" : \"yr awr hon\",\n      \"past\" : \"{0} awr yn ôl\",\n      \"future\" : \"ymhen {0} awr\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} eiliad yn ôl\",\n      \"current\" : \"nawr\",\n      \"future\" : \"ymhen {0} eiliad\"\n    }\n  },\n  \"long\" : {\n    \"now\" : \"nawr\",\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"blwyddyn yn ôl\",\n        \"two\" : \"{0} flynedd yn ôl\",\n        \"few\" : \"{0} blynedd yn ôl\",\n        \"many\" : \"{0} blynedd yn ôl\",\n        \"other\" : \"{0} o flynyddoedd yn ôl\"\n      },\n      \"previous\" : \"llynedd\",\n      \"current\" : \"eleni\",\n      \"next\" : \"blwyddyn nesaf\",\n      \"future\" : {\n        \"many\" : \"ymhen {0} blynedd\",\n        \"few\" : \"ymhen {0} blynedd\",\n        \"one\" : \"ymhen blwyddyn\",\n        \"other\" : \"ymhen {0} mlynedd\",\n        \"two\" : \"ymhen {0} flynedd\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"mis nesaf\",\n      \"current\" : \"y mis hwn\",\n      \"past\" : {\n        \"two\" : \"{0} fis yn ôl\",\n        \"other\" : \"{0} mis yn ôl\"\n      },\n      \"previous\" : \"mis diwethaf\",\n      \"future\" : {\n        \"two\" : \"ymhen deufis\",\n        \"other\" : \"ymhen {0} mis\",\n        \"one\" : \"ymhen mis\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"wythnos nesaf\",\n      \"future\" : {\n        \"other\" : \"ymhen {0} wythnos\",\n        \"one\" : \"ymhen wythnos\",\n        \"two\" : \"ymhen pythefnos\"\n      },\n      \"current\" : \"yr wythnos hon\",\n      \"past\" : \"{0} wythnos yn ôl\",\n      \"previous\" : \"wythnos ddiwethaf\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"ymhen awr\",\n        \"other\" : \"ymhen {0} awr\"\n      },\n      \"current\" : \"yr awr hon\",\n      \"past\" : \"{0} awr yn ôl\"\n    },\n    \"minute\" : {\n      \"current\" : \"y funud hon\",\n      \"past\" : \"{0} munud yn ôl\",\n      \"future\" : \"ymhen {0} munud\"\n    },\n    \"second\" : {\n      \"future\" : \"ymhen {0} eiliad\",\n      \"past\" : \"{0} eiliad yn ôl\",\n      \"current\" : \"nawr\"\n    },\n    \"quarter\" : {\n      \"future\" : \"ymhen {0} chwarter\",\n      \"current\" : \"chwarter hwn\",\n      \"previous\" : \"chwarter olaf\",\n      \"next\" : \"chwarter nesaf\",\n      \"past\" : {\n        \"many\" : \"{0} chwarter yn ôl\",\n        \"other\" : \"{0} o chwarteri yn ôl\",\n        \"one\" : \"{0} chwarter yn ôl\",\n        \"few\" : \"{0} chwarter yn ôl\",\n        \"two\" : \"{0} chwarter yn ôl\"\n      }\n    },\n    \"day\" : {\n      \"future\" : {\n        \"one\" : \"ymhen diwrnod\",\n        \"two\" : \"ymhen deuddydd\",\n        \"other\" : \"ymhen {0} diwrnod\"\n      },\n      \"previous\" : \"ddoe\",\n      \"current\" : \"heddiw\",\n      \"next\" : \"yfory\",\n      \"past\" : {\n        \"two\" : \"{0} ddiwrnod yn ôl\",\n        \"other\" : \"{0} diwrnod yn ôl\"\n      }\n    }\n  },\n  \"short\" : {\n    \"year\" : {\n      \"current\" : \"eleni\",\n      \"past\" : {\n        \"other\" : \"{0} o flynyddoedd yn ôl\",\n        \"many\" : \"{0} blynedd yn ôl\",\n        \"one\" : \"blwyddyn yn ôl\",\n        \"two\" : \"{0} flynedd yn ôl\",\n        \"few\" : \"{0} blynedd yn ôl\"\n      },\n      \"future\" : {\n        \"few\" : \"ymhen {0} blynedd\",\n        \"one\" : \"ymhen blwyddyn\",\n        \"two\" : \"ymhen {0} flynedd\",\n        \"many\" : \"ymhen {0} blynedd\",\n        \"other\" : \"ymhen {0} mlynedd\"\n      },\n      \"next\" : \"blwyddyn nesaf\",\n      \"previous\" : \"llynedd\"\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"ymhen {0} mun.\",\n        \"other\" : \"ymhen {0} munud\",\n        \"two\" : \"ymhen {0} fun.\"\n      },\n      \"past\" : {\n        \"two\" : \"{0} fun. yn ôl\",\n        \"other\" : \"{0} munud yn ôl\"\n      },\n      \"current\" : \"y funud hon\"\n    },\n    \"day\" : {\n      \"previous\" : \"ddoe\",\n      \"current\" : \"heddiw\",\n      \"next\" : \"yfory\",\n      \"past\" : {\n        \"two\" : \"{0} ddiwrnod yn ôl\",\n        \"other\" : \"{0} diwrnod yn ôl\"\n      },\n      \"future\" : {\n        \"two\" : \"ymhen deuddydd\",\n        \"one\" : \"ymhen diwrnod\",\n        \"other\" : \"ymhen {0} diwrnod\"\n      }\n    },\n    \"second\" : {\n      \"past\" : \"{0} eiliad yn ôl\",\n      \"current\" : \"nawr\",\n      \"future\" : \"ymhen {0} eiliad\"\n    },\n    \"now\" : \"nawr\",\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"ymhen mis\",\n        \"two\" : \"ymhen deufis\",\n        \"other\" : \"ymhen {0} mis\"\n      },\n      \"current\" : \"y mis hwn\",\n      \"next\" : \"mis nesaf\",\n      \"previous\" : \"mis diwethaf\",\n      \"past\" : {\n        \"two\" : \"deufis yn ôl\",\n        \"other\" : \"{0} mis yn ôl\"\n      }\n    },\n    \"week\" : {\n      \"past\" : {\n        \"two\" : \"pythefnos yn ôl\",\n        \"other\" : \"{0} wythnos yn ôl\"\n      },\n      \"previous\" : \"wythnos ddiwethaf\",\n      \"future\" : {\n        \"one\" : \"ymhen wythnos\",\n        \"other\" : \"ymhen {0} wythnos\",\n        \"two\" : \"ymhen pythefnos\"\n      },\n      \"next\" : \"wythnos nesaf\",\n      \"current\" : \"yr wythnos hon\"\n    },\n    \"quarter\" : {\n      \"next\" : \"chwarter nesaf\",\n      \"current\" : \"chwarter hwn\",\n      \"previous\" : \"chwarter olaf\",\n      \"past\" : {\n        \"many\" : \"{0} chwarter yn ôl\",\n        \"one\" : \"{0} chwarter yn ôl\",\n        \"few\" : \"{0} chwarter yn ôl\",\n        \"other\" : \"{0} o chwarteri yn ôl\",\n        \"two\" : \"{0} chwarter yn ôl\"\n      },\n      \"future\" : \"ymhen {0} chwarter\"\n    },\n    \"hour\" : {\n      \"current\" : \"yr awr hon\",\n      \"future\" : {\n        \"one\" : \"ymhen awr\",\n        \"other\" : \"ymhen {0} awr\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} awr yn ôl\",\n        \"one\" : \"awr yn ôl\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/da.json",
    "content": "{\n  \"narrow\" : {\n    \"hour\" : {\n      \"current\" : \"i den kommende time\",\n      \"future\" : {\n        \"one\" : \"om {0} time\",\n        \"other\" : \"om {0} timer\"\n      },\n      \"past\" : {\n        \"other\" : \"for {0} timer siden\",\n        \"one\" : \"for {0} time siden\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"sidste uge\",\n      \"current\" : \"denne uge\",\n      \"next\" : \"næste uge\",\n      \"past\" : {\n        \"one\" : \"for {0} uge siden\",\n        \"other\" : \"for {0} uger siden\"\n      },\n      \"future\" : {\n        \"one\" : \"om {0} uge\",\n        \"other\" : \"om {0} uger\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"nu\",\n      \"future\" : \"om {0} sek.\",\n      \"past\" : \"for {0} sek. siden\"\n    },\n    \"month\" : {\n      \"previous\" : \"sidste md.\",\n      \"next\" : \"næste md.\",\n      \"future\" : {\n        \"other\" : \"om {0} mdr.\",\n        \"one\" : \"om {0} md.\"\n      },\n      \"current\" : \"denne md.\",\n      \"past\" : {\n        \"other\" : \"for {0} mdr. siden\",\n        \"one\" : \"for {0} md. siden\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : \"for {0} min. siden\",\n      \"future\" : \"om {0} min.\",\n      \"current\" : \"i det kommende minut\"\n    },\n    \"now\" : \"nu\",\n    \"year\" : {\n      \"future\" : \"om {0} år\",\n      \"previous\" : \"sidste år\",\n      \"current\" : \"i år\",\n      \"next\" : \"næste år\",\n      \"past\" : \"for {0} år siden\"\n    },\n    \"quarter\" : {\n      \"next\" : \"næste kvt.\",\n      \"future\" : \"om {0} kvt.\",\n      \"previous\" : \"sidste kvt.\",\n      \"current\" : \"dette kvt.\",\n      \"past\" : \"for {0} kvt. siden\"\n    },\n    \"day\" : {\n      \"previous\" : \"i går\",\n      \"current\" : \"i dag\",\n      \"next\" : \"i morgen\",\n      \"past\" : {\n        \"one\" : \"for {0} dag siden\",\n        \"other\" : \"for {0} dage siden\"\n      },\n      \"future\" : {\n        \"one\" : \"om {0} dag\",\n        \"other\" : \"om {0} dage\"\n      }\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"i går\",\n      \"next\" : \"i morgen\",\n      \"future\" : {\n        \"other\" : \"om {0} dage\",\n        \"one\" : \"om {0} dag\"\n      },\n      \"current\" : \"i dag\",\n      \"past\" : {\n        \"one\" : \"for {0} dag siden\",\n        \"other\" : \"for {0} dage siden\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"for {0} sekunder siden\",\n        \"one\" : \"for {0} sekund siden\"\n      },\n      \"current\" : \"nu\",\n      \"future\" : {\n        \"one\" : \"om {0} sekund\",\n        \"other\" : \"om {0} sekunder\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"for {0} minut siden\",\n        \"other\" : \"for {0} minutter siden\"\n      },\n      \"current\" : \"i det kommende minut\",\n      \"future\" : {\n        \"one\" : \"om {0} minut\",\n        \"other\" : \"om {0} minutter\"\n      }\n    },\n    \"week\" : {\n      \"current\" : \"denne uge\",\n      \"past\" : {\n        \"one\" : \"for {0} uge siden\",\n        \"other\" : \"for {0} uger siden\"\n      },\n      \"future\" : {\n        \"other\" : \"om {0} uger\",\n        \"one\" : \"om {0} uge\"\n      },\n      \"previous\" : \"sidste uge\",\n      \"next\" : \"næste uge\"\n    },\n    \"now\" : \"nu\",\n    \"year\" : {\n      \"current\" : \"i år\",\n      \"next\" : \"næste år\",\n      \"past\" : \"for {0} år siden\",\n      \"previous\" : \"sidste år\",\n      \"future\" : \"om {0} år\"\n    },\n    \"month\" : {\n      \"previous\" : \"sidste måned\",\n      \"past\" : {\n        \"one\" : \"for {0} måned siden\",\n        \"other\" : \"for {0} måneder siden\"\n      },\n      \"future\" : {\n        \"one\" : \"om {0} måned\",\n        \"other\" : \"om {0} måneder\"\n      },\n      \"current\" : \"denne måned\",\n      \"next\" : \"næste måned\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"om {0} time\",\n        \"other\" : \"om {0} timer\"\n      },\n      \"past\" : {\n        \"other\" : \"for {0} timer siden\",\n        \"one\" : \"for {0} time siden\"\n      },\n      \"current\" : \"i den kommende time\"\n    },\n    \"quarter\" : {\n      \"current\" : \"dette kvartal\",\n      \"future\" : {\n        \"other\" : \"om {0} kvartaler\",\n        \"one\" : \"om {0} kvartal\"\n      },\n      \"next\" : \"næste kvartal\",\n      \"previous\" : \"sidste kvartal\",\n      \"past\" : {\n        \"other\" : \"for {0} kvartaler siden\",\n        \"one\" : \"for {0} kvartal siden\"\n      }\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"om {0} time\",\n        \"other\" : \"om {0} timer\"\n      },\n      \"past\" : {\n        \"other\" : \"for {0} timer siden\",\n        \"one\" : \"for {0} time siden\"\n      },\n      \"current\" : \"i den kommende time\"\n    },\n    \"now\" : \"nu\",\n    \"quarter\" : {\n      \"current\" : \"dette kvt.\",\n      \"future\" : \"om {0} kvt.\",\n      \"past\" : \"for {0} kvt. siden\",\n      \"next\" : \"næste kvt.\",\n      \"previous\" : \"sidste kvt.\"\n    },\n    \"day\" : {\n      \"current\" : \"i dag\",\n      \"past\" : {\n        \"one\" : \"for {0} dag siden\",\n        \"other\" : \"for {0} dage siden\"\n      },\n      \"future\" : {\n        \"one\" : \"om {0} dag\",\n        \"other\" : \"om {0} dage\"\n      },\n      \"next\" : \"i morgen\",\n      \"previous\" : \"i går\"\n    },\n    \"week\" : {\n      \"current\" : \"denne uge\",\n      \"future\" : {\n        \"one\" : \"om {0} uge\",\n        \"other\" : \"om {0} uger\"\n      },\n      \"previous\" : \"sidste uge\",\n      \"next\" : \"næste uge\",\n      \"past\" : {\n        \"one\" : \"for {0} uge siden\",\n        \"other\" : \"for {0} uger siden\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : \"for {0} min. siden\",\n      \"current\" : \"i det kommende minut\",\n      \"future\" : \"om {0} min.\"\n    },\n    \"second\" : {\n      \"future\" : \"om {0} sek.\",\n      \"past\" : \"for {0} sek. siden\",\n      \"current\" : \"nu\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"om {0} md.\",\n        \"other\" : \"om {0} mdr.\"\n      },\n      \"previous\" : \"sidste md.\",\n      \"next\" : \"næste md.\",\n      \"current\" : \"denne md.\",\n      \"past\" : {\n        \"other\" : \"for {0} mdr. siden\",\n        \"one\" : \"for {0} md. siden\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"næste år\",\n      \"previous\" : \"sidste år\",\n      \"current\" : \"i år\",\n      \"future\" : \"om {0} år\",\n      \"past\" : \"for {0} år siden\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/de.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"vor {0} Jahren\",\n        \"one\" : \"vor {0} Jahr\"\n      },\n      \"current\" : \"dieses Jahr\",\n      \"future\" : {\n        \"one\" : \"in {0} Jahr\",\n        \"other\" : \"in {0} Jahren\"\n      },\n      \"previous\" : \"letztes Jahr\",\n      \"next\" : \"nächstes Jahr\"\n    },\n    \"minute\" : {\n      \"future\" : \"in {0} m\",\n      \"current\" : \"in dieser Minute\",\n      \"past\" : \"vor {0} m\"\n    },\n    \"day\" : {\n      \"current\" : \"heute\",\n      \"past\" : {\n        \"one\" : \"vor {0} Tag\",\n        \"other\" : \"vor {0} Tagen\"\n      },\n      \"previous\" : \"gestern\",\n      \"next\" : \"morgen\",\n      \"future\" : {\n        \"one\" : \"in {0} Tag\",\n        \"other\" : \"in {0} Tagen\"\n      }\n    },\n    \"now\" : \"jetzt\",\n    \"week\" : {\n      \"current\" : \"diese Woche\",\n      \"future\" : \"in {0} Wo.\",\n      \"next\" : \"nächste Woche\",\n      \"past\" : \"vor {0} Wo.\",\n      \"previous\" : \"letzte Woche\"\n    },\n    \"second\" : {\n      \"current\" : \"jetzt\",\n      \"past\" : \"vor {0} s\",\n      \"future\" : \"in {0} s\"\n    },\n    \"hour\" : {\n      \"current\" : \"in dieser Stunde\",\n      \"future\" : \"in {0} Std.\",\n      \"past\" : \"vor {0} Std.\"\n    },\n    \"quarter\" : {\n      \"current\" : \"dieses Quartal\",\n      \"previous\" : \"letztes Quartal\",\n      \"next\" : \"nächstes Quartal\",\n      \"future\" : \"in {0} Q\",\n      \"past\" : \"vor {0} Q\"\n    },\n    \"month\" : {\n      \"current\" : \"diesen Monat\",\n      \"future\" : {\n        \"one\" : \"in {0} Monat\",\n        \"other\" : \"in {0} Monaten\"\n      },\n      \"previous\" : \"letzten Monat\",\n      \"past\" : {\n        \"other\" : \"vor {0} Monaten\",\n        \"one\" : \"vor {0} Monat\"\n      },\n      \"next\" : \"nächsten Monat\"\n    }\n  },\n  \"long\" : {\n    \"month\" : {\n      \"previous\" : \"letzten Monat\",\n      \"next\" : \"nächsten Monat\",\n      \"past\" : {\n        \"other\" : \"vor {0} Monaten\",\n        \"one\" : \"vor {0} Monat\"\n      },\n      \"current\" : \"diesen Monat\",\n      \"future\" : {\n        \"one\" : \"in {0} Monat\",\n        \"other\" : \"in {0} Monaten\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"vor {0} Sekunde\",\n        \"other\" : \"vor {0} Sekunden\"\n      },\n      \"future\" : {\n        \"other\" : \"in {0} Sekunden\",\n        \"one\" : \"in {0} Sekunde\"\n      },\n      \"current\" : \"jetzt\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"vor {0} Stunden\",\n        \"one\" : \"vor {0} Stunde\"\n      },\n      \"current\" : \"in dieser Stunde\",\n      \"future\" : {\n        \"one\" : \"in {0} Stunde\",\n        \"other\" : \"in {0} Stunden\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"letztes Quartal\",\n      \"future\" : {\n        \"one\" : \"in {0} Quartal\",\n        \"other\" : \"in {0} Quartalen\"\n      },\n      \"next\" : \"nächstes Quartal\",\n      \"current\" : \"dieses Quartal\",\n      \"past\" : {\n        \"one\" : \"vor {0} Quartal\",\n        \"other\" : \"vor {0} Quartalen\"\n      }\n    },\n    \"now\" : \"jetzt\",\n    \"minute\" : {\n      \"current\" : \"in dieser Minute\",\n      \"future\" : {\n        \"other\" : \"in {0} Minuten\",\n        \"one\" : \"in {0} Minute\"\n      },\n      \"past\" : {\n        \"other\" : \"vor {0} Minuten\",\n        \"one\" : \"vor {0} Minute\"\n      }\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"vor {0} Tag\",\n        \"other\" : \"vor {0} Tagen\"\n      },\n      \"previous\" : \"gestern\",\n      \"current\" : \"heute\",\n      \"future\" : {\n        \"one\" : \"in {0} Tag\",\n        \"other\" : \"in {0} Tagen\"\n      },\n      \"next\" : \"morgen\"\n    },\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"vor {0} Jahren\",\n        \"one\" : \"vor {0} Jahr\"\n      },\n      \"next\" : \"nächstes Jahr\",\n      \"current\" : \"dieses Jahr\",\n      \"previous\" : \"letztes Jahr\",\n      \"future\" : {\n        \"one\" : \"in {0} Jahr\",\n        \"other\" : \"in {0} Jahren\"\n      }\n    },\n    \"week\" : {\n      \"current\" : \"diese Woche\",\n      \"past\" : {\n        \"other\" : \"vor {0} Wochen\",\n        \"one\" : \"vor {0} Woche\"\n      },\n      \"previous\" : \"letzte Woche\",\n      \"future\" : {\n        \"one\" : \"in {0} Woche\",\n        \"other\" : \"in {0} Wochen\"\n      },\n      \"next\" : \"nächste Woche\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"vor {0} Min.\",\n      \"future\" : \"in {0} Min.\",\n      \"current\" : \"in dieser Minute\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"one\" : \"vor {0} Woche\",\n        \"other\" : \"vor {0} Wochen\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} Woche\",\n        \"other\" : \"in {0} Wochen\"\n      },\n      \"next\" : \"nächste Woche\",\n      \"current\" : \"diese Woche\",\n      \"previous\" : \"letzte Woche\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"one\" : \"in {0} Tag\",\n        \"other\" : \"in {0} Tagen\"\n      },\n      \"current\" : \"heute\",\n      \"previous\" : \"gestern\",\n      \"next\" : \"morgen\",\n      \"past\" : {\n        \"one\" : \"vor {0} Tag\",\n        \"other\" : \"vor {0} Tagen\"\n      }\n    },\n    \"second\" : {\n      \"past\" : \"vor {0} Sek.\",\n      \"future\" : \"in {0} Sek.\",\n      \"current\" : \"jetzt\"\n    },\n    \"now\" : \"jetzt\",\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"vor {0} Jahren\",\n        \"one\" : \"vor {0} Jahr\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} Jahr\",\n        \"other\" : \"in {0} Jahren\"\n      },\n      \"previous\" : \"letztes Jahr\",\n      \"current\" : \"dieses Jahr\",\n      \"next\" : \"nächstes Jahr\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"vor {0} Monaten\",\n        \"one\" : \"vor {0} Monat\"\n      },\n      \"future\" : {\n        \"other\" : \"in {0} Monaten\",\n        \"one\" : \"in {0} Monat\"\n      },\n      \"next\" : \"nächsten Monat\",\n      \"previous\" : \"letzten Monat\",\n      \"current\" : \"diesen Monat\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"letztes Quartal\",\n      \"future\" : \"in {0} Quart.\",\n      \"next\" : \"nächstes Quartal\",\n      \"past\" : \"vor {0} Quart.\",\n      \"current\" : \"dieses Quartal\"\n    },\n    \"hour\" : {\n      \"current\" : \"in dieser Stunde\",\n      \"past\" : \"vor {0} Std.\",\n      \"future\" : \"in {0} Std.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/dsb.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : \"za {0} s\",\n      \"current\" : \"now\",\n      \"past\" : \"pśed {0} s\"\n    },\n    \"year\" : {\n      \"next\" : \"znowa\",\n      \"past\" : \"pśed {0} l.\",\n      \"future\" : \"za {0} l.\",\n      \"previous\" : \"łoni\",\n      \"current\" : \"lětosa\"\n    },\n    \"month\" : {\n      \"past\" : \"pśed {0} mjas.\",\n      \"next\" : \"pśiducy mjasec\",\n      \"future\" : \"za {0} mjas.\",\n      \"previous\" : \"slědny mjasec\",\n      \"current\" : \"ten mjasec\"\n    },\n    \"minute\" : {\n      \"future\" : \"za {0} m\",\n      \"current\" : \"this minute\",\n      \"past\" : \"pśed {0} m\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"pśed {0} kw.\",\n      \"future\" : \"za {0} kw.\"\n    },\n    \"hour\" : {\n      \"future\" : \"za {0} g\",\n      \"current\" : \"this hour\",\n      \"past\" : \"pśed {0} g\"\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"next\" : \"pśiducy tyźeń\",\n      \"previous\" : \"slědny tyźeń\",\n      \"past\" : \"pśed {0} tyź.\",\n      \"future\" : \"za {0} tyź.\",\n      \"current\" : \"ten tyźeń\"\n    },\n    \"day\" : {\n      \"previous\" : \"cora\",\n      \"future\" : \"za {0} ź\",\n      \"past\" : \"pśed {0} d\",\n      \"current\" : \"źinsa\",\n      \"next\" : \"witśe\"\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"past\" : {\n        \"two\" : \"pśed {0} tyźenjoma\",\n        \"other\" : \"pśed {0} tyźenjami\",\n        \"one\" : \"pśed {0} tyźenjom\"\n      },\n      \"future\" : {\n        \"other\" : \"za {0} tyźenjow\",\n        \"two\" : \"za {0} tyźenja\",\n        \"few\" : \"za {0} tyźenje\",\n        \"one\" : \"za {0} tyźeń\"\n      },\n      \"previous\" : \"slědny tyźeń\",\n      \"current\" : \"ten tyźeń\",\n      \"next\" : \"pśiducy tyźeń\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"past\" : {\n        \"one\" : \"pśed {0} kwartalom\",\n        \"two\" : \"pśed {0} kwartaloma\",\n        \"other\" : \"pśed {0} kwartalami\"\n      },\n      \"future\" : {\n        \"one\" : \"za {0} kwartal\",\n        \"two\" : \"za {0} kwartala\",\n        \"few\" : \"za {0} kwartale\",\n        \"other\" : \"za {0} kwartalow\"\n      },\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"one\" : \"pśed {0} mjasecom\",\n        \"other\" : \"pśed {0} mjasecami\",\n        \"two\" : \"pśed {0} mjasecoma\"\n      },\n      \"current\" : \"ten mjasec\",\n      \"next\" : \"pśiducy mjasec\",\n      \"future\" : {\n        \"one\" : \"za {0} mjasec\",\n        \"few\" : \"za {0} mjasecy\",\n        \"two\" : \"za {0} mjaseca\",\n        \"other\" : \"za {0} mjasecow\"\n      },\n      \"previous\" : \"slědny mjasec\"\n    },\n    \"year\" : {\n      \"previous\" : \"łoni\",\n      \"future\" : {\n        \"one\" : \"za {0} lěto\",\n        \"few\" : \"za {0} lěta\",\n        \"other\" : \"za {0} lět\",\n        \"two\" : \"za {0} lěśe\"\n      },\n      \"next\" : \"znowa\",\n      \"current\" : \"lětosa\",\n      \"past\" : {\n        \"two\" : \"pśed {0} lětoma\",\n        \"one\" : \"pśed {0} lětom\",\n        \"other\" : \"pśed {0} lětami\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"za {0} minutu\",\n        \"few\" : \"za {0} minuty\",\n        \"two\" : \"za {0} minuśe\",\n        \"other\" : \"za {0} minutow\"\n      },\n      \"past\" : {\n        \"two\" : \"pśed {0} minutoma\",\n        \"one\" : \"pśed {0} minutu\",\n        \"other\" : \"pśed {0} minutami\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"two\" : \"za {0} góźinje\",\n        \"few\" : \"za {0} góźiny\",\n        \"one\" : \"za {0} góźinu\",\n        \"other\" : \"za {0} góźin\"\n      },\n      \"past\" : {\n        \"one\" : \"pśed {0} góźinu\",\n        \"two\" : \"pśed {0} góźinoma\",\n        \"other\" : \"pśed {0} góźinami\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"day\" : {\n      \"previous\" : \"cora\",\n      \"current\" : \"źinsa\",\n      \"next\" : \"witśe\",\n      \"future\" : {\n        \"two\" : \"za {0} dnja\",\n        \"few\" : \"za {0} dny\",\n        \"one\" : \"za {0} źeń\",\n        \"other\" : \"za {0} dnjow\"\n      },\n      \"past\" : {\n        \"other\" : \"pśed {0} dnjami\",\n        \"two\" : \"pśed {0} dnjoma\",\n        \"one\" : \"pśed {0} dnjom\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"two\" : \"za {0} sekunźe\",\n        \"other\" : \"za {0} sekundow\",\n        \"few\" : \"za {0} sekundy\",\n        \"one\" : \"za {0} sekundu\"\n      },\n      \"current\" : \"now\",\n      \"past\" : {\n        \"one\" : \"pśed {0} sekundu\",\n        \"two\" : \"pśed {0} sekundoma\",\n        \"other\" : \"pśed {0} sekundami\"\n      }\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"pśed {0} min.\",\n      \"current\" : \"this minute\",\n      \"future\" : \"za {0} min.\"\n    },\n    \"month\" : {\n      \"current\" : \"ten mjasec\",\n      \"past\" : \"pśed {0} mjas.\",\n      \"future\" : \"za {0} mjas.\",\n      \"next\" : \"pśiducy mjasec\",\n      \"previous\" : \"slědny mjasec\"\n    },\n    \"week\" : {\n      \"current\" : \"ten tyźeń\",\n      \"past\" : \"pśed {0} tyź.\",\n      \"future\" : \"za {0} tyź.\",\n      \"next\" : \"pśiducy tyźeń\",\n      \"previous\" : \"slědny tyźeń\"\n    },\n    \"hour\" : {\n      \"past\" : \"pśed {0} góź.\",\n      \"future\" : \"za {0} góź.\",\n      \"current\" : \"this hour\"\n    },\n    \"day\" : {\n      \"next\" : \"witśe\",\n      \"current\" : \"źinsa\",\n      \"previous\" : \"cora\",\n      \"past\" : \"pśed {0} dnj.\",\n      \"future\" : {\n        \"few\" : \"za {0} dny\",\n        \"other\" : \"za {0} dnj.\",\n        \"one\" : \"za {0} źeń\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"pśed {0} sek.\",\n      \"future\" : \"za {0} sek.\"\n    },\n    \"now\" : \"now\",\n    \"year\" : {\n      \"future\" : \"za {0} l.\",\n      \"previous\" : \"łoni\",\n      \"next\" : \"znowa\",\n      \"current\" : \"lětosa\",\n      \"past\" : \"pśed {0} l.\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"za {0} kwart.\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"pśed {0} kwart.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/dz.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\"\n    },\n    \"day\" : {\n      \"next\" : \"ནངས་པ་\",\n      \"previous\" : \"ཁ་ཙ་\",\n      \"future\" : \"ཉིནམ་ {0} ནང་\",\n      \"past\" : \"ཉིནམ་ {0} ཧེ་མ་\",\n      \"current\" : \"ད་རིས་\"\n    },\n    \"year\" : {\n      \"past\" : \"ལོ་འཁོར་ {0} ཧེ་མ་\",\n      \"previous\" : \"last year\",\n      \"future\" : \"ལོ་འཁོར་ {0} ནང་\",\n      \"next\" : \"next year\",\n      \"current\" : \"this year\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : \"སྐར་མ་ {0} ཧེ་མ་\",\n      \"future\" : \"སྐར་མ་ {0} ནང་\"\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"current\" : \"this week\",\n      \"previous\" : \"last week\",\n      \"past\" : \"བངུན་ཕྲག་ {0} ཧེ་མ་\",\n      \"next\" : \"next week\",\n      \"future\" : \"བངུན་ཕྲག་ {0} ནང་\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : \"སྐར་ཆ་ {0} ནང་\",\n      \"past\" : \"སྐར་ཆ་ {0} ཧེ་མ་\"\n    },\n    \"month\" : {\n      \"future\" : \"ཟླཝ་ {0} ནང་\",\n      \"current\" : \"this month\",\n      \"past\" : \"ཟླཝ་ {0} ཧེ་མ་\",\n      \"previous\" : \"last month\",\n      \"next\" : \"next month\"\n    },\n    \"hour\" : {\n      \"past\" : \"ཆུ་ཚོད་ {0} ཧེ་མ་\",\n      \"future\" : \"ཆུ་ཚོད་ {0} ནང་\",\n      \"current\" : \"this hour\"\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"next\" : \"next year\",\n      \"previous\" : \"last year\",\n      \"past\" : \"ལོ་འཁོར་ {0} ཧེ་མ་\",\n      \"future\" : \"ལོ་འཁོར་ {0} ནང་\",\n      \"current\" : \"this year\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\"\n    },\n    \"month\" : {\n      \"past\" : \"ཟླཝ་ {0} ཧེ་མ་\",\n      \"next\" : \"next month\",\n      \"previous\" : \"last month\",\n      \"future\" : \"ཟླཝ་ {0} ནང་\",\n      \"current\" : \"this month\"\n    },\n    \"second\" : {\n      \"past\" : \"སྐར་ཆ་ {0} ཧེ་མ་\",\n      \"future\" : \"སྐར་ཆ་ {0} ནང་\",\n      \"current\" : \"now\"\n    },\n    \"week\" : {\n      \"past\" : \"བངུན་ཕྲག་ {0} ཧེ་མ་\",\n      \"previous\" : \"last week\",\n      \"future\" : \"བངུན་ཕྲག་ {0} ནང་\",\n      \"next\" : \"next week\",\n      \"current\" : \"this week\"\n    },\n    \"day\" : {\n      \"next\" : \"ནངས་པ་\",\n      \"future\" : \"ཉིནམ་ {0} ནང་\",\n      \"previous\" : \"ཁ་ཙ་\",\n      \"current\" : \"ད་རིས་\",\n      \"past\" : \"ཉིནམ་ {0} ཧེ་མ་\"\n    },\n    \"minute\" : {\n      \"past\" : \"སྐར་མ་ {0} ཧེ་མ་\",\n      \"future\" : \"སྐར་མ་ {0} ནང་\",\n      \"current\" : \"this minute\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"ཆུ་ཚོད་ {0} ཧེ་མ་\",\n      \"future\" : \"ཆུ་ཚོད་ {0} ནང་\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : \"སྐར་མ་ {0} ཧེ་མ་\",\n      \"future\" : \"སྐར་མ་ {0} ནང་\"\n    },\n    \"week\" : {\n      \"future\" : \"བངུན་ཕྲག་ {0} ནང་\",\n      \"previous\" : \"last week\",\n      \"next\" : \"next week\",\n      \"current\" : \"this week\",\n      \"past\" : \"བངུན་ཕྲག་ {0} ཧེ་མ་\"\n    },\n    \"year\" : {\n      \"current\" : \"this year\",\n      \"previous\" : \"last year\",\n      \"future\" : \"ལོ་འཁོར་ {0} ནང་\",\n      \"past\" : \"ལོ་འཁོར་ {0} ཧེ་མ་\",\n      \"next\" : \"next year\"\n    },\n    \"month\" : {\n      \"next\" : \"next month\",\n      \"past\" : \"ཟླཝ་ {0} ཧེ་མ་\",\n      \"future\" : \"ཟླཝ་ {0} ནང་\",\n      \"previous\" : \"last month\",\n      \"current\" : \"this month\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"day\" : {\n      \"current\" : \"ད་རིས་\",\n      \"previous\" : \"ཁ་ཙ་\",\n      \"past\" : \"ཉིནམ་ {0} ཧེ་མ་\",\n      \"next\" : \"ནངས་པ་\",\n      \"future\" : \"ཉིནམ་ {0} ནང་\"\n    },\n    \"hour\" : {\n      \"future\" : \"ཆུ་ཚོད་ {0} ནང་\",\n      \"current\" : \"this hour\",\n      \"past\" : \"ཆུ་ཚོད་ {0} ཧེ་མ་\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"སྐར་ཆ་ {0} ཧེ་མ་\",\n      \"future\" : \"སྐར་ཆ་ {0} ནང་\"\n    },\n    \"now\" : \"now\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ee.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"current\" : \"egbe\",\n      \"next\" : \"etsɔ si gbɔna\",\n      \"future\" : {\n        \"one\" : \"le ŋkeke {0} me\",\n        \"other\" : \"le ŋkeke {0} wo me\"\n      },\n      \"past\" : {\n        \"one\" : \"ŋkeke {0} si va yi\",\n        \"other\" : \"ŋkeke {0} si wo va yi\"\n      },\n      \"previous\" : \"etsɔ si va yi\"\n    },\n    \"week\" : {\n      \"next\" : \"kɔsiɖa si gbɔ na\",\n      \"previous\" : \"kɔsiɖa si va yi\",\n      \"future\" : {\n        \"other\" : \"le kɔsiɖa {0} wo me\",\n        \"one\" : \"le kɔsiɖa {0} me\"\n      },\n      \"current\" : \"kɔsiɖa sia\",\n      \"past\" : {\n        \"one\" : \"kɔsiɖa {0} si va yi\",\n        \"other\" : \"kɔsiɖa {0} si wo va yi\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"ƒe sia\",\n      \"past\" : \"ƒe {0} si va yi me\",\n      \"next\" : \"ƒe si gbɔ na\",\n      \"previous\" : \"ƒe si va yi\",\n      \"future\" : \"le ƒe {0} si gbɔna me\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"gaƒoƒo {0} si wo va yi\",\n        \"one\" : \"gaƒoƒo {0} si va yi\"\n      },\n      \"future\" : {\n        \"other\" : \"le gaƒoƒo {0} wo me\",\n        \"one\" : \"le gaƒoƒo {0} me\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"now\" : \"fifi\",\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"sekend {0} si va yi\",\n        \"other\" : \"sekend {0} si wo va yi\"\n      },\n      \"current\" : \"fifi\",\n      \"future\" : {\n        \"other\" : \"le sekend {0} wo me\",\n        \"one\" : \"le sekend {0} me\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"other\" : \"le aɖabaƒoƒo {0} wo me\",\n        \"one\" : \"le aɖabaƒoƒo {0} me\"\n      },\n      \"current\" : \"this minute\",\n      \"past\" : {\n        \"one\" : \"aɖabaƒoƒo {0} si va yi\",\n        \"other\" : \"aɖabaƒoƒo {0} si wo va yi\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : {\n        \"one\" : \"le kɔta {0} si gbɔna me\",\n        \"other\" : \"le kɔta {0} si gbɔ na me\"\n      },\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"past\" : \"kɔta {0} si va yi me\"\n    },\n    \"month\" : {\n      \"next\" : \"ɣleti si gbɔ na\",\n      \"past\" : {\n        \"other\" : \"ɣleti {0} si wo va yi\",\n        \"one\" : \"ɣleti {0} si va yi\"\n      },\n      \"future\" : {\n        \"one\" : \"le ɣleti {0} me\",\n        \"other\" : \"le ɣleti {0} wo me\"\n      },\n      \"previous\" : \"ɣleti si va yi\",\n      \"current\" : \"ɣleti sia\"\n    }\n  },\n  \"long\" : {\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"sekend {0} si wo va yi\",\n        \"one\" : \"sekend {0} si va yi\"\n      },\n      \"future\" : {\n        \"one\" : \"le sekend {0} me\",\n        \"other\" : \"le sekend {0} wo me\"\n      },\n      \"current\" : \"fifi\"\n    },\n    \"week\" : {\n      \"current\" : \"kɔsiɖa sia\",\n      \"next\" : \"kɔsiɖa si gbɔ na\",\n      \"previous\" : \"kɔsiɖa si va yi\",\n      \"past\" : {\n        \"one\" : \"kɔsiɖa {0} si va yi\",\n        \"other\" : \"kɔsiɖa {0} si wo va yi\"\n      },\n      \"future\" : {\n        \"one\" : \"le kɔsiɖa {0} me\",\n        \"other\" : \"le kɔsiɖa {0} wo me\"\n      }\n    },\n    \"day\" : {\n      \"past\" : {\n        \"other\" : \"ŋkeke {0} si wo va yi\",\n        \"one\" : \"ŋkeke {0} si va yi\"\n      },\n      \"previous\" : \"etsɔ si va yi\",\n      \"next\" : \"etsɔ si gbɔna\",\n      \"future\" : {\n        \"one\" : \"le ŋkeke {0} me\",\n        \"other\" : \"le ŋkeke {0} wo me\"\n      },\n      \"current\" : \"egbe\"\n    },\n    \"now\" : \"fifi\",\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"le gaƒoƒo {0} wo me\",\n        \"one\" : \"le gaƒoƒo {0} me\"\n      },\n      \"past\" : {\n        \"one\" : \"gaƒoƒo {0} si va yi\",\n        \"other\" : \"gaƒoƒo {0} si wo va yi\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"le ɣleti {0} me\",\n        \"other\" : \"le ɣleti {0} wo me\"\n      },\n      \"past\" : {\n        \"other\" : \"ɣleti {0} si wo va yi\",\n        \"one\" : \"ɣleti {0} si va yi\"\n      },\n      \"current\" : \"ɣleti sia\",\n      \"next\" : \"ɣleti si gbɔ na\",\n      \"previous\" : \"ɣleti si va yi\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"aɖabaƒoƒo {0} si wo va yi\",\n        \"one\" : \"aɖabaƒoƒo {0} si va yi\"\n      },\n      \"future\" : {\n        \"other\" : \"le aɖabaƒoƒo {0} wo me\",\n        \"one\" : \"le aɖabaƒoƒo {0} me\"\n      },\n      \"current\" : \"this minute\"\n    },\n    \"year\" : {\n      \"next\" : \"ƒe si gbɔ na\",\n      \"previous\" : \"ƒe si va yi\",\n      \"past\" : {\n        \"one\" : \"ƒe {0} si va yi\",\n        \"other\" : \"ƒe {0} si wo va yi\"\n      },\n      \"future\" : \"le ƒe {0} me\",\n      \"current\" : \"ƒe sia\"\n    },\n    \"quarter\" : {\n      \"future\" : \"le kɔta {0} si gbɔ na me\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"kɔta {0} si va yi me\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\"\n    }\n  },\n  \"short\" : {\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"le kɔsiɖa {0} me\",\n        \"other\" : \"le kɔsiɖa {0} wo me\"\n      },\n      \"next\" : \"kɔsiɖa si gbɔ na\",\n      \"current\" : \"kɔsiɖa sia\",\n      \"past\" : {\n        \"one\" : \"kɔsiɖa {0} si va yi\",\n        \"other\" : \"kɔsiɖa {0} si wo va yi\"\n      },\n      \"previous\" : \"kɔsiɖa si va yi\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"le aɖabaƒoƒo {0} me\",\n        \"other\" : \"le aɖabaƒoƒo {0} wo me\"\n      },\n      \"past\" : {\n        \"one\" : \"aɖabaƒoƒo {0} si va yi\",\n        \"other\" : \"aɖabaƒoƒo {0} si wo va yi\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"etsɔ si gbɔna\",\n      \"current\" : \"egbe\",\n      \"previous\" : \"etsɔ si va yi\",\n      \"future\" : {\n        \"one\" : \"le ŋkeke {0} me\",\n        \"other\" : \"le ŋkeke {0} wo me\"\n      },\n      \"past\" : {\n        \"other\" : \"ŋkeke {0} si wo va yi\",\n        \"one\" : \"ŋkeke {0} si va yi\"\n      }\n    },\n    \"now\" : \"fifi\",\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"sekend {0} si va yi\",\n        \"other\" : \"sekend {0} si wo va yi\"\n      },\n      \"future\" : {\n        \"other\" : \"le sekend {0} wo me\",\n        \"one\" : \"le sekend {0} me\"\n      },\n      \"current\" : \"fifi\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"one\" : \"gaƒoƒo {0} si va yi\",\n        \"other\" : \"gaƒoƒo {0} si wo va yi\"\n      },\n      \"future\" : {\n        \"one\" : \"le gaƒoƒo {0} me\",\n        \"other\" : \"le gaƒoƒo {0} wo me\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"ɣleti sia\",\n      \"past\" : {\n        \"one\" : \"ɣleti {0} si va yi\",\n        \"other\" : \"ɣleti {0} si wo va yi\"\n      },\n      \"previous\" : \"ɣleti si va yi\",\n      \"next\" : \"ɣleti si gbɔ na\",\n      \"future\" : {\n        \"other\" : \"le ɣleti {0} wo me\",\n        \"one\" : \"le ɣleti {0} me\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"ƒe si gbɔ na\",\n      \"future\" : \"le ƒe {0} me\",\n      \"current\" : \"ƒe sia\",\n      \"past\" : \"le ƒe {0} si va yi me\",\n      \"previous\" : \"ƒe si va yi\"\n    },\n    \"quarter\" : {\n      \"future\" : \"le kɔta {0} si gbɔ na me\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"kɔta {0} si va yi me\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/el.json",
    "content": "{\n  \"narrow\" : {\n    \"now\" : \"τώρα\",\n    \"hour\" : {\n      \"future\" : \"σε {0} ώ.\",\n      \"past\" : \"{0} ώ. πριν\",\n      \"current\" : \"τρέχουσα ώρα\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} λ. πριν\",\n      \"current\" : \"τρέχον λεπτό\",\n      \"future\" : \"σε {0} λ.\"\n    },\n    \"second\" : {\n      \"future\" : \"σε {0} δ.\",\n      \"current\" : \"τώρα\",\n      \"past\" : \"{0} δ. πριν\"\n    },\n    \"year\" : {\n      \"next\" : \"επόμενο έτος\",\n      \"future\" : {\n        \"one\" : \"σε {0} έτος\",\n        \"other\" : \"σε {0} έτη\"\n      },\n      \"previous\" : \"πέρσι\",\n      \"current\" : \"φέτος\",\n      \"past\" : {\n        \"one\" : \"{0} έτος πριν\",\n        \"other\" : \"{0} έτη πριν\"\n      }\n    },\n    \"week\" : {\n      \"past\" : \"{0} εβδ. πριν\",\n      \"next\" : \"επόμενη εβδομάδα\",\n      \"future\" : \"σε {0} εβδ.\",\n      \"previous\" : \"προηγούμενη εβδομάδα\",\n      \"current\" : \"τρέχουσα εβδομάδα\"\n    },\n    \"month\" : {\n      \"previous\" : \"προηγούμενος μήνας\",\n      \"current\" : \"τρέχων μήνας\",\n      \"next\" : \"επόμενος μήνας\",\n      \"past\" : \"{0} μ. πριν\",\n      \"future\" : \"σε {0} μ.\"\n    },\n    \"quarter\" : {\n      \"next\" : \"επόμ. τρίμ.\",\n      \"past\" : \"{0} τρίμ. πριν\",\n      \"future\" : \"σε {0} τρίμ.\",\n      \"previous\" : \"προηγ. τρίμ.\",\n      \"current\" : \"τρέχον τρίμ.\"\n    },\n    \"day\" : {\n      \"next\" : \"αύριο\",\n      \"previous\" : \"χθες\",\n      \"past\" : \"{0} ημ. πριν\",\n      \"future\" : \"σε {0} ημ.\",\n      \"current\" : \"σήμερα\"\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"σε {0} εβδομάδες\",\n        \"one\" : \"σε {0} εβδομάδα\"\n      },\n      \"past\" : {\n        \"other\" : \"πριν από {0} εβδομάδες\",\n        \"one\" : \"πριν από {0} εβδομάδα\"\n      },\n      \"next\" : \"επόμενη εβδομάδα\",\n      \"current\" : \"τρέχουσα εβδομάδα\",\n      \"previous\" : \"προηγούμενη εβδομάδα\"\n    },\n    \"minute\" : {\n      \"current\" : \"τρέχον λεπτό\",\n      \"future\" : {\n        \"other\" : \"σε {0} λεπτά\",\n        \"one\" : \"σε {0} λεπτό\"\n      },\n      \"past\" : {\n        \"one\" : \"πριν από {0} λεπτό\",\n        \"other\" : \"πριν από {0} λεπτά\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"τρέχων μήνας\",\n      \"past\" : {\n        \"other\" : \"πριν από {0} μήνες\",\n        \"one\" : \"πριν από {0} μήνα\"\n      },\n      \"previous\" : \"προηγούμενος μήνας\",\n      \"future\" : {\n        \"one\" : \"σε {0} μήνα\",\n        \"other\" : \"σε {0} μήνες\"\n      },\n      \"next\" : \"επόμενος μήνας\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"σε {0} ώρα\",\n        \"other\" : \"σε {0} ώρες\"\n      },\n      \"past\" : {\n        \"one\" : \"πριν από {0} ώρα\",\n        \"other\" : \"πριν από {0} ώρες\"\n      },\n      \"current\" : \"τρέχουσα ώρα\"\n    },\n    \"year\" : {\n      \"previous\" : \"πέρσι\",\n      \"past\" : {\n        \"one\" : \"πριν από {0} έτος\",\n        \"other\" : \"πριν από {0} έτη\"\n      },\n      \"next\" : \"επόμενο έτος\",\n      \"future\" : {\n        \"one\" : \"σε {0} έτος\",\n        \"other\" : \"σε {0} έτη\"\n      },\n      \"current\" : \"φέτος\"\n    },\n    \"day\" : {\n      \"current\" : \"σήμερα\",\n      \"previous\" : \"χθες\",\n      \"next\" : \"αύριο\",\n      \"future\" : {\n        \"other\" : \"σε {0} ημέρες\",\n        \"one\" : \"σε {0} ημέρα\"\n      },\n      \"past\" : {\n        \"other\" : \"πριν από {0} ημέρες\",\n        \"one\" : \"πριν από {0} ημέρα\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"τώρα\",\n      \"future\" : {\n        \"other\" : \"σε {0} δευτερόλεπτα\",\n        \"one\" : \"σε {0} δευτερόλεπτο\"\n      },\n      \"past\" : {\n        \"one\" : \"πριν από {0} δευτερόλεπτο\",\n        \"other\" : \"πριν από {0} δευτερόλεπτα\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"προηγούμενο τρίμηνο\",\n      \"current\" : \"τρέχον τρίμηνο\",\n      \"next\" : \"επόμενο τρίμηνο\",\n      \"past\" : {\n        \"one\" : \"πριν από {0} τρίμηνο\",\n        \"other\" : \"πριν από {0} τρίμηνα\"\n      },\n      \"future\" : {\n        \"one\" : \"σε {0} τρίμηνο\",\n        \"other\" : \"σε {0} τρίμηνα\"\n      }\n    },\n    \"now\" : \"τώρα\"\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : \"σε {0} ώ.\",\n      \"current\" : \"τρέχουσα ώρα\",\n      \"past\" : \"πριν από {0} ώ.\"\n    },\n    \"now\" : \"τώρα\",\n    \"quarter\" : {\n      \"current\" : \"τρέχον τρίμ.\",\n      \"future\" : \"σε {0} τρίμ.\",\n      \"past\" : \"πριν από {0} τρίμ.\",\n      \"next\" : \"επόμ. τρίμ.\",\n      \"previous\" : \"προηγ. τρίμ.\"\n    },\n    \"day\" : {\n      \"current\" : \"σήμερα\",\n      \"past\" : \"πριν από {0} ημ.\",\n      \"future\" : \"σε {0} ημ.\",\n      \"next\" : \"αύριο\",\n      \"previous\" : \"χθες\"\n    },\n    \"week\" : {\n      \"current\" : \"τρέχουσα εβδομάδα\",\n      \"past\" : \"πριν από {0} εβδ.\",\n      \"future\" : \"σε {0} εβδ.\",\n      \"next\" : \"επόμενη εβδομάδα\",\n      \"previous\" : \"προηγούμενη εβδομάδα\"\n    },\n    \"minute\" : {\n      \"future\" : \"σε {0} λεπ.\",\n      \"current\" : \"τρέχον λεπτό\",\n      \"past\" : \"πριν από {0} λεπ.\"\n    },\n    \"second\" : {\n      \"future\" : \"σε {0} δευτ.\",\n      \"current\" : \"τώρα\",\n      \"past\" : \"πριν από {0} δευτ.\"\n    },\n    \"month\" : {\n      \"current\" : \"τρέχων μήνας\",\n      \"future\" : {\n        \"one\" : \"σε {0} μήνα\",\n        \"other\" : \"σε {0} μήνες\"\n      },\n      \"previous\" : \"προηγούμενος μήνας\",\n      \"next\" : \"επόμενος μήνας\",\n      \"past\" : {\n        \"one\" : \"πριν από {0} μήνα\",\n        \"other\" : \"πριν από {0} μήνες\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"σε {0} έτος\",\n        \"other\" : \"σε {0} έτη\"\n      },\n      \"previous\" : \"πέρσι\",\n      \"next\" : \"επόμενο έτος\",\n      \"current\" : \"φέτος\",\n      \"past\" : {\n        \"other\" : \"πριν από {0} έτη\",\n        \"one\" : \"πριν από {0} έτος\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/en.json",
    "content": "{\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : {\n        \"one\" : \"in {0} quarter\",\n        \"other\" : \"in {0} quarters\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} quarter ago\",\n        \"other\" : \"{0} quarters ago\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"next month\",\n      \"past\" : {\n        \"one\" : \"{0} month ago\",\n        \"other\" : \"{0} months ago\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} month\",\n        \"other\" : \"in {0} months\"\n      },\n      \"previous\" : \"last month\",\n      \"current\" : \"this month\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} hours ago\",\n        \"one\" : \"{0} hour ago\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} hour\",\n        \"other\" : \"in {0} hours\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"week\" : {\n      \"previous\" : \"last week\",\n      \"current\" : \"this week\",\n      \"future\" : {\n        \"one\" : \"in {0} week\",\n        \"other\" : \"in {0} weeks\"\n      },\n      \"next\" : \"next week\",\n      \"past\" : {\n        \"one\" : \"{0} week ago\",\n        \"other\" : \"{0} weeks ago\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : {\n        \"one\" : \"{0} minute ago\",\n        \"other\" : \"{0} minutes ago\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} minute\",\n        \"other\" : \"in {0} minutes\"\n      }\n    },\n    \"now\" : \"now\",\n    \"year\" : {\n      \"next\" : \"next year\",\n      \"future\" : {\n        \"one\" : \"in {0} year\",\n        \"other\" : \"in {0} years\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} years ago\",\n        \"one\" : \"{0} year ago\"\n      },\n      \"current\" : \"this year\",\n      \"previous\" : \"last year\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : {\n        \"other\" : \"{0} seconds ago\",\n        \"one\" : \"{0} second ago\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} second\",\n        \"other\" : \"in {0} seconds\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"tomorrow\",\n      \"past\" : {\n        \"other\" : \"{0} days ago\",\n        \"one\" : \"{0} day ago\"\n      },\n      \"future\" : {\n        \"other\" : \"in {0} days\",\n        \"one\" : \"in {0} day\"\n      },\n      \"previous\" : \"yesterday\",\n      \"current\" : \"today\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"future\" : \"in {0} mo.\",\n      \"previous\" : \"last mo.\",\n      \"current\" : \"this mo.\",\n      \"next\" : \"next mo.\",\n      \"past\" : \"{0} mo. ago\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"{0} day ago\",\n        \"other\" : \"{0} days ago\"\n      },\n      \"previous\" : \"yesterday\",\n      \"current\" : \"today\",\n      \"next\" : \"tomorrow\",\n      \"future\" : {\n        \"other\" : \"in {0} days\",\n        \"one\" : \"in {0} day\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"future\" : \"in {0} hr.\",\n      \"past\" : \"{0} hr. ago\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} sec. ago\",\n      \"future\" : \"in {0} sec.\",\n      \"current\" : \"now\"\n    },\n    \"year\" : {\n      \"current\" : \"this yr.\",\n      \"previous\" : \"last yr.\",\n      \"future\" : \"in {0} yr.\",\n      \"past\" : \"{0} yr. ago\",\n      \"next\" : \"next yr.\"\n    },\n    \"week\" : {\n      \"previous\" : \"last wk.\",\n      \"current\" : \"this wk.\",\n      \"future\" : \"in {0} wk.\",\n      \"past\" : \"{0} wk. ago\",\n      \"next\" : \"next wk.\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : \"in {0} min.\",\n      \"past\" : \"{0} min. ago\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"next\" : \"next qtr.\",\n      \"previous\" : \"last qtr.\",\n      \"current\" : \"this qtr.\",\n      \"past\" : {\n        \"other\" : \"{0} qtrs. ago\",\n        \"one\" : \"{0} qtr. ago\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} qtr.\",\n        \"other\" : \"in {0} qtrs.\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"hour\" : {\n      \"future\" : \"in {0} hr.\",\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} hr. ago\"\n    },\n    \"week\" : {\n      \"next\" : \"next wk.\",\n      \"previous\" : \"last wk.\",\n      \"past\" : \"{0} wk. ago\",\n      \"current\" : \"this wk.\",\n      \"future\" : \"in {0} wk.\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : \"{0} min. ago\",\n      \"future\" : \"in {0} min.\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"{0} sec. ago\",\n      \"future\" : \"in {0} sec.\"\n    },\n    \"now\" : \"now\",\n    \"month\" : {\n      \"past\" : \"{0} mo. ago\",\n      \"current\" : \"this mo.\",\n      \"next\" : \"next mo.\",\n      \"previous\" : \"last mo.\",\n      \"future\" : \"in {0} mo.\"\n    },\n    \"day\" : {\n      \"current\" : \"today\",\n      \"future\" : {\n        \"one\" : \"in {0} day\",\n        \"other\" : \"in {0} days\"\n      },\n      \"previous\" : \"yesterday\",\n      \"next\" : \"tomorrow\",\n      \"past\" : {\n        \"one\" : \"{0} day ago\",\n        \"other\" : \"{0} days ago\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"last yr.\",\n      \"current\" : \"this yr.\",\n      \"past\" : \"{0} yr. ago\",\n      \"next\" : \"next yr.\",\n      \"future\" : \"in {0} yr.\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last qtr.\",\n      \"next\" : \"next qtr.\",\n      \"past\" : {\n        \"one\" : \"{0} qtr. ago\",\n        \"other\" : \"{0} qtrs. ago\"\n      },\n      \"future\" : {\n        \"one\" : \"in {0} qtr.\",\n        \"other\" : \"in {0} qtrs.\"\n      },\n      \"current\" : \"this qtr.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/es.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"previous\" : \"el trimestre pasado\",\n      \"current\" : \"este trimestre\",\n      \"next\" : \"el próximo trimestre\",\n      \"past\" : \"hace {0} trim.\",\n      \"future\" : \"dentro de {0} trim.\"\n    },\n    \"month\" : {\n      \"past\" : \"hace {0} m\",\n      \"next\" : \"el próximo mes\",\n      \"future\" : \"dentro de {0} m\",\n      \"previous\" : \"el mes pasado\",\n      \"current\" : \"este mes\"\n    },\n    \"now\" : \"ahora\",\n    \"hour\" : {\n      \"future\" : \"dentro de {0} h\",\n      \"past\" : \"hace {0} h\",\n      \"current\" : \"esta hora\"\n    },\n    \"minute\" : {\n      \"past\" : \"hace {0} min\",\n      \"current\" : \"este minuto\",\n      \"future\" : \"dentro de {0} min\"\n    },\n    \"day\" : {\n      \"previous\" : \"ayer\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"past\" : {\n        \"one\" : \"hace {0} día\",\n        \"other\" : \"hace {0} días\"\n      },\n      \"current\" : \"hoy\",\n      \"next\" : \"mañana\"\n    },\n    \"year\" : {\n      \"next\" : \"el próximo año\",\n      \"past\" : \"hace {0} a\",\n      \"future\" : \"dentro de {0} a\",\n      \"previous\" : \"el año pasado\",\n      \"current\" : \"este año\"\n    },\n    \"week\" : {\n      \"next\" : \"la próxima semana\",\n      \"previous\" : \"la semana pasada\",\n      \"past\" : \"hace {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\",\n      \"current\" : \"esta semana\"\n    },\n    \"second\" : {\n      \"future\" : \"dentro de {0} s\",\n      \"past\" : \"hace {0} s\",\n      \"current\" : \"ahora\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"este minuto\",\n      \"past\" : \"hace {0} min\",\n      \"future\" : \"dentro de {0} min\"\n    },\n    \"month\" : {\n      \"current\" : \"este mes\",\n      \"past\" : \"hace {0} m\",\n      \"future\" : \"dentro de {0} m\",\n      \"next\" : \"el próximo mes\",\n      \"previous\" : \"el mes pasado\"\n    },\n    \"week\" : {\n      \"current\" : \"esta semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\",\n      \"next\" : \"la próxima semana\",\n      \"previous\" : \"la semana pasada\"\n    },\n    \"hour\" : {\n      \"past\" : \"hace {0} h\",\n      \"current\" : \"esta hora\",\n      \"future\" : \"dentro de {0} h\"\n    },\n    \"day\" : {\n      \"next\" : \"mañana\",\n      \"current\" : \"hoy\",\n      \"previous\" : \"ayer\",\n      \"past\" : {\n        \"other\" : \"hace {0} días\",\n        \"one\" : \"hace {0} día\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} día\",\n        \"other\" : \"dentro de {0} días\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"dentro de {0} s\",\n      \"current\" : \"ahora\",\n      \"past\" : \"hace {0} s\"\n    },\n    \"now\" : \"ahora\",\n    \"year\" : {\n      \"future\" : \"dentro de {0} a\",\n      \"previous\" : \"el año pasado\",\n      \"next\" : \"el próximo año\",\n      \"current\" : \"este año\",\n      \"past\" : \"hace {0} a\"\n    },\n    \"quarter\" : {\n      \"current\" : \"este trimestre\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"previous\" : \"el trimestre pasado\",\n      \"next\" : \"el próximo trimestre\",\n      \"past\" : \"hace {0} trim.\"\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"current\" : \"esta semana\",\n      \"previous\" : \"la semana pasada\",\n      \"next\" : \"la próxima semana\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} semana\",\n        \"other\" : \"dentro de {0} semanas\"\n      },\n      \"past\" : {\n        \"other\" : \"hace {0} semanas\",\n        \"one\" : \"hace {0} semana\"\n      }\n    },\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"dentro de {0} mes\",\n        \"other\" : \"dentro de {0} meses\"\n      },\n      \"past\" : {\n        \"one\" : \"hace {0} mes\",\n        \"other\" : \"hace {0} meses\"\n      },\n      \"next\" : \"el próximo mes\",\n      \"current\" : \"este mes\",\n      \"previous\" : \"el mes pasado\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"hace {0} minuto\",\n        \"other\" : \"hace {0} minutos\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} minuto\",\n        \"other\" : \"dentro de {0} minutos\"\n      },\n      \"current\" : \"este minuto\"\n    },\n    \"now\" : \"ahora\",\n    \"year\" : {\n      \"previous\" : \"el año pasado\",\n      \"current\" : \"este año\",\n      \"next\" : \"el próximo año\",\n      \"past\" : {\n        \"other\" : \"hace {0} años\",\n        \"one\" : \"hace {0} año\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} años\",\n        \"one\" : \"dentro de {0} año\"\n      }\n    },\n    \"day\" : {\n      \"current\" : \"hoy\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"past\" : {\n        \"other\" : \"hace {0} días\",\n        \"one\" : \"hace {0} día\"\n      },\n      \"next\" : \"mañana\",\n      \"previous\" : \"ayer\"\n    },\n    \"quarter\" : {\n      \"current\" : \"este trimestre\",\n      \"past\" : {\n        \"one\" : \"hace {0} trimestre\",\n        \"other\" : \"hace {0} trimestres\"\n      },\n      \"previous\" : \"el trimestre pasado\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} trimestre\",\n        \"other\" : \"dentro de {0} trimestres\"\n      },\n      \"next\" : \"el próximo trimestre\"\n    },\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} horas\",\n        \"one\" : \"dentro de {0} hora\"\n      },\n      \"past\" : {\n        \"other\" : \"hace {0} horas\",\n        \"one\" : \"hace {0} hora\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} segundos\",\n        \"one\" : \"dentro de {0} segundo\"\n      },\n      \"current\" : \"ahora\",\n      \"past\" : {\n        \"one\" : \"hace {0} segundo\",\n        \"other\" : \"hace {0} segundos\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/es_AR.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"mañana\",\n      \"future\" : \"dentro de {0} días\",\n      \"previous\" : \"ayer\",\n      \"current\" : \"hoy\",\n      \"past\" : \"hace {0} días\"\n    },\n    \"quarter\" : {\n      \"next\" : \"el próximo trimestre\",\n      \"past\" : \"hace {0} trim.\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"previous\" : \"el trimestre pasado\",\n      \"current\" : \"este trimestre\"\n    },\n    \"hour\" : {\n      \"future\" : \"dentro de {0} h\",\n      \"current\" : \"esta hora\",\n      \"past\" : \"hace {0} h\"\n    },\n    \"year\" : {\n      \"next\" : \"el próximo año\",\n      \"past\" : \"hace {0} a\",\n      \"current\" : \"este año\",\n      \"previous\" : \"el año pasado\",\n      \"future\" : \"dentro de {0} a\"\n    },\n    \"now\" : \"ahora\",\n    \"month\" : {\n      \"current\" : \"este mes\",\n      \"future\" : \"dentro de {0} m\",\n      \"past\" : \"hace {0} m\",\n      \"next\" : \"el próximo mes\",\n      \"previous\" : \"el mes pasado\"\n    },\n    \"week\" : {\n      \"previous\" : \"la semana pasada\",\n      \"current\" : \"esta semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\",\n      \"next\" : \"la próxima semana\"\n    },\n    \"minute\" : {\n      \"past\" : \"hace {0} min\",\n      \"current\" : \"este minuto\",\n      \"future\" : \"dentro de {0} min\"\n    },\n    \"second\" : {\n      \"current\" : \"ahora\",\n      \"past\" : \"hace {0} seg.\",\n      \"future\" : \"dentro de {0} seg.\"\n    }\n  },\n  \"long\" : {\n    \"month\" : {\n      \"next\" : \"el próximo mes\",\n      \"previous\" : \"el mes pasado\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} mes\",\n        \"other\" : \"dentro de {0} meses\"\n      },\n      \"current\" : \"este mes\",\n      \"past\" : {\n        \"other\" : \"hace {0} meses\",\n        \"one\" : \"hace {0} mes\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"dentro de {0} semana\",\n        \"other\" : \"dentro de {0} semanas\"\n      },\n      \"previous\" : \"la semana pasada\",\n      \"next\" : \"la próxima semana\",\n      \"current\" : \"esta semana\",\n      \"past\" : {\n        \"one\" : \"hace {0} semana\",\n        \"other\" : \"hace {0} semanas\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"ahora\",\n      \"past\" : {\n        \"other\" : \"hace {0} segundos\",\n        \"one\" : \"hace {0} segundo\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} segundo\",\n        \"other\" : \"dentro de {0} segundos\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"dentro de {0} año\",\n        \"other\" : \"dentro de {0} años\"\n      },\n      \"previous\" : \"el año pasado\",\n      \"next\" : \"el próximo año\",\n      \"current\" : \"este año\",\n      \"past\" : {\n        \"one\" : \"hace {0} año\",\n        \"other\" : \"hace {0} años\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"mañana\",\n      \"current\" : \"hoy\",\n      \"previous\" : \"ayer\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"past\" : {\n        \"other\" : \"hace {0} días\",\n        \"one\" : \"hace {0} día\"\n      }\n    },\n    \"now\" : \"ahora\",\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"dentro de {0} minuto\",\n        \"other\" : \"dentro de {0} minutos\"\n      },\n      \"past\" : {\n        \"other\" : \"hace {0} minutos\",\n        \"one\" : \"hace {0} minuto\"\n      },\n      \"current\" : \"este minuto\"\n    },\n    \"quarter\" : {\n      \"next\" : \"el próximo trimestre\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} trimestre\",\n        \"other\" : \"dentro de {0} trimestres\"\n      },\n      \"previous\" : \"el trimestre pasado\",\n      \"current\" : \"este trimestre\",\n      \"past\" : {\n        \"one\" : \"hace {0} trimestre\",\n        \"other\" : \"hace {0} trimestres\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} horas\",\n        \"one\" : \"dentro de {0} hora\"\n      },\n      \"past\" : {\n        \"other\" : \"hace {0} horas\",\n        \"one\" : \"hace {0} hora\"\n      },\n      \"current\" : \"esta hora\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"dentro de {0} trim.\",\n      \"next\" : \"el próximo trimestre\",\n      \"previous\" : \"el trimestre pasado\",\n      \"current\" : \"este trimestre\",\n      \"past\" : \"hace {0} trim.\"\n    },\n    \"minute\" : {\n      \"current\" : \"este minuto\",\n      \"past\" : \"hace {0} min\",\n      \"future\" : \"dentro de {0} min\"\n    },\n    \"year\" : {\n      \"next\" : \"el próximo año\",\n      \"future\" : \"dentro de {0} a\",\n      \"current\" : \"este año\",\n      \"past\" : \"hace {0} a\",\n      \"previous\" : \"el año pasado\"\n    },\n    \"second\" : {\n      \"past\" : \"hace {0} seg.\",\n      \"current\" : \"ahora\",\n      \"future\" : \"dentro de {0} seg.\"\n    },\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"past\" : \"hace {0} h\",\n      \"future\" : \"dentro de {0} h\"\n    },\n    \"now\" : \"ahora\",\n    \"month\" : {\n      \"previous\" : \"el mes pasado\",\n      \"next\" : \"el próximo mes\",\n      \"past\" : \"hace {0} m\",\n      \"current\" : \"este mes\",\n      \"future\" : \"dentro de {0} m\"\n    },\n    \"week\" : {\n      \"previous\" : \"la semana pasada\",\n      \"current\" : \"esta semana\",\n      \"next\" : \"la próxima semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\"\n    },\n    \"day\" : {\n      \"next\" : \"mañana\",\n      \"past\" : \"hace {0} días\",\n      \"future\" : \"dentro de {0} días\",\n      \"previous\" : \"ayer\",\n      \"current\" : \"hoy\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/es_MX.json",
    "content": "{\n  \"narrow\" : {\n    \"minute\" : {\n      \"future\" : \"dentro de {0} min\",\n      \"past\" : \"hace {0} min\",\n      \"current\" : \"este minuto\"\n    },\n    \"year\" : {\n      \"past\" : \"hace {0} a\",\n      \"current\" : \"este año\",\n      \"next\" : \"el próximo año\",\n      \"previous\" : \"el año pasado\",\n      \"future\" : \"dentro de {0} a\"\n    },\n    \"now\" : \"ahora\",\n    \"second\" : {\n      \"past\" : \"hace {0} seg.\",\n      \"future\" : \"dentro de {0} seg.\",\n      \"current\" : \"ahora\"\n    },\n    \"day\" : {\n      \"previous\" : \"ayer\",\n      \"current\" : \"hoy\",\n      \"next\" : \"mañana\",\n      \"past\" : {\n        \"one\" : \"hace {0} día\",\n        \"other\" : \"hace {0} días\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"hace {0} m\",\n      \"current\" : \"este mes\",\n      \"next\" : \"el próximo mes\",\n      \"future\" : \"dentro de {0} m\",\n      \"previous\" : \"el mes pasado\"\n    },\n    \"week\" : {\n      \"next\" : \"la próxima semana\",\n      \"current\" : \"esta semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\",\n      \"previous\" : \"la semana pasada\"\n    },\n    \"quarter\" : {\n      \"current\" : \"este trimestre\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"next\" : \"el próximo trimestre\",\n      \"past\" : \"hace {0} trim.\",\n      \"previous\" : \"el trimestre pasado\"\n    },\n    \"hour\" : {\n      \"future\" : \"dentro de {0} h\",\n      \"current\" : \"esta hora\",\n      \"past\" : \"hace {0} h\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"past\" : \"hace {0} seg.\",\n      \"future\" : \"dentro de {0} seg.\",\n      \"current\" : \"ahora\"\n    },\n    \"now\" : \"ahora\",\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"past\" : \"hace {0} h\",\n      \"future\" : \"dentro de {0} h\"\n    },\n    \"month\" : {\n      \"past\" : \"hace {0} m\",\n      \"current\" : \"este mes\",\n      \"next\" : \"el próximo mes\",\n      \"future\" : \"dentro de {0} m\",\n      \"previous\" : \"el mes pasado\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"current\" : \"hoy\",\n      \"previous\" : \"ayer\",\n      \"next\" : \"mañana\",\n      \"past\" : {\n        \"one\" : \"hace {0} día\",\n        \"other\" : \"hace {0} días\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : \"dentro de {0} min\",\n      \"current\" : \"este minuto\",\n      \"past\" : \"hace {0} min\"\n    },\n    \"week\" : {\n      \"next\" : \"la próxima semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"previous\" : \"la semana pasada\",\n      \"current\" : \"esta semana\",\n      \"future\" : \"dentro de {0} sem.\"\n    },\n    \"quarter\" : {\n      \"current\" : \"este trimestre\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"next\" : \"el próximo trimestre\",\n      \"previous\" : \"el trimestre pasado\",\n      \"past\" : \"hace {0} trim.\"\n    },\n    \"year\" : {\n      \"next\" : \"el próximo año\",\n      \"current\" : \"este año\",\n      \"future\" : \"dentro de {0} a\",\n      \"past\" : \"hace {0} a\",\n      \"previous\" : \"el año pasado\"\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"current\" : \"esta semana\",\n      \"previous\" : \"la semana pasada\",\n      \"next\" : \"la próxima semana\",\n      \"past\" : {\n        \"one\" : \"hace {0} semana\",\n        \"other\" : \"hace {0} semanas\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} semana\",\n        \"other\" : \"dentro de {0} semanas\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} horas\",\n        \"one\" : \"dentro de {0} hora\"\n      },\n      \"past\" : {\n        \"other\" : \"hace {0} horas\",\n        \"one\" : \"hace {0} hora\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"dentro de {0} minuto\",\n        \"other\" : \"dentro de {0} minutos\"\n      },\n      \"current\" : \"este minuto\",\n      \"past\" : {\n        \"one\" : \"hace {0} minuto\",\n        \"other\" : \"hace {0} minutos\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"ayer\",\n      \"current\" : \"hoy\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"next\" : \"mañana\",\n      \"past\" : {\n        \"other\" : \"hace {0} días\",\n        \"one\" : \"hace {0} día\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"ahora\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} segundos\",\n        \"one\" : \"dentro de {0} segundo\"\n      },\n      \"past\" : {\n        \"one\" : \"hace {0} segundo\",\n        \"other\" : \"hace {0} segundos\"\n      }\n    },\n    \"now\" : \"ahora\",\n    \"month\" : {\n      \"next\" : \"el próximo mes\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} meses\",\n        \"one\" : \"dentro de {0} mes\"\n      },\n      \"previous\" : \"el mes pasado\",\n      \"current\" : \"este mes\",\n      \"past\" : {\n        \"other\" : \"hace {0} meses\",\n        \"one\" : \"hace {0} mes\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"el trimestre pasado\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} trimestre\",\n        \"other\" : \"dentro de {0} trimestres\"\n      },\n      \"current\" : \"este trimestre\",\n      \"past\" : {\n        \"one\" : \"hace {0} trimestre\",\n        \"other\" : \"hace {0} trimestres\"\n      },\n      \"next\" : \"el próximo trimestre\"\n    },\n    \"year\" : {\n      \"next\" : \"el próximo año\",\n      \"past\" : {\n        \"one\" : \"hace {0} año\",\n        \"other\" : \"hace {0} años\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} años\",\n        \"one\" : \"dentro de {0} año\"\n      },\n      \"current\" : \"este año\",\n      \"previous\" : \"el año pasado\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/es_PY.json",
    "content": "{\n  \"narrow\" : {\n    \"minute\" : {\n      \"current\" : \"este minuto\",\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\"\n    },\n    \"year\" : {\n      \"previous\" : \"el año pasado\",\n      \"past\" : \"-{0} a\",\n      \"future\" : \"en {0} a\",\n      \"next\" : \"el próximo año\",\n      \"current\" : \"este año\"\n    },\n    \"day\" : {\n      \"next\" : \"mañana\",\n      \"previous\" : \"ayer\",\n      \"past\" : {\n        \"one\" : \"hace {0} día\",\n        \"other\" : \"hace {0} días\"\n      },\n      \"future\" : {\n        \"other\" : \"+{0} días\",\n        \"one\" : \"+{0} día\"\n      },\n      \"current\" : \"hoy\"\n    },\n    \"month\" : {\n      \"current\" : \"este mes\",\n      \"past\" : \"-{0} m\",\n      \"next\" : \"el próximo mes\",\n      \"previous\" : \"el mes pasado\",\n      \"future\" : \"+{0} m\"\n    },\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"past\" : \"hace {0} h\",\n      \"future\" : \"dentro de {0} h\"\n    },\n    \"now\" : \"ahora\",\n    \"quarter\" : {\n      \"past\" : \"-{0} T\",\n      \"current\" : \"este trimestre\",\n      \"future\" : \"+{0} T\",\n      \"previous\" : \"el trimestre pasado\",\n      \"next\" : \"el próximo trimestre\"\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"ahora\",\n      \"past\" : \"hace {0} s\"\n    },\n    \"week\" : {\n      \"past\" : \"hace {0} sem.\",\n      \"previous\" : \"la semana pasada\",\n      \"current\" : \"esta semana\",\n      \"next\" : \"la semana próxima\",\n      \"future\" : \"dentro de {0} sem.\"\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"next\" : \"el año próximo\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} año\",\n        \"other\" : \"dentro de {0} años\"\n      },\n      \"previous\" : \"el año pasado\",\n      \"current\" : \"este año\",\n      \"past\" : {\n        \"one\" : \"hace {0} año\",\n        \"other\" : \"hace {0} años\"\n      }\n    },\n    \"now\" : \"ahora\",\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"en {0} mes\",\n        \"other\" : \"en {0} meses\"\n      },\n      \"previous\" : \"el mes pasado\",\n      \"next\" : \"el mes próximo\",\n      \"current\" : \"este mes\",\n      \"past\" : {\n        \"other\" : \"hace {0} meses\",\n        \"one\" : \"hace {0} mes\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"el próximo trimestre\",\n      \"previous\" : \"el trimestre pasado\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} trimetres\",\n        \"one\" : \"dentro de {0} trimetre\"\n      },\n      \"current\" : \"este trimestre\",\n      \"past\" : {\n        \"other\" : \"hace {0} trimestres\",\n        \"one\" : \"hace {0} trimestre\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"ayer\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"current\" : \"hoy\",\n      \"next\" : \"mañana\",\n      \"past\" : {\n        \"one\" : \"hace {0} día\",\n        \"other\" : \"hace {0} días\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"la semana próxima\",\n      \"current\" : \"esta semana\",\n      \"previous\" : \"la semana pasada\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} semanas\",\n        \"one\" : \"dentro de {0} semana\"\n      },\n      \"past\" : {\n        \"one\" : \"hace {0} semana\",\n        \"other\" : \"hace {0} semanas\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"past\" : {\n        \"one\" : \"hace {0} hora\",\n        \"other\" : \"hace {0} horas\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} hora\",\n        \"other\" : \"dentro de {0} horas\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} minutos\",\n        \"one\" : \"dentro de {0} minuto\"\n      },\n      \"current\" : \"este minuto\",\n      \"past\" : {\n        \"one\" : \"hace {0} minuto\",\n        \"other\" : \"hace {0} minutos\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"ahora\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} segundos\",\n        \"one\" : \"dentro de {0} segundo\"\n      },\n      \"past\" : {\n        \"one\" : \"hace {0} segundo\",\n        \"other\" : \"hace {0} segundos\"\n      }\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"este minuto\",\n      \"past\" : \"hace {0} min\",\n      \"future\" : \"en {0} min\"\n    },\n    \"second\" : {\n      \"current\" : \"ahora\",\n      \"past\" : \"hace {0} s\",\n      \"future\" : \"en {0} s\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"en {0} h\",\n        \"other\" : \"en {0} n\"\n      },\n      \"current\" : \"esta hora\",\n      \"past\" : \"hace {0} h\"\n    },\n    \"year\" : {\n      \"next\" : \"el próximo año\",\n      \"future\" : \"en {0} a\",\n      \"current\" : \"este año\",\n      \"past\" : \"hace {0} a\",\n      \"previous\" : \"el año pasado\"\n    },\n    \"now\" : \"ahora\",\n    \"quarter\" : {\n      \"previous\" : \"el trimestre pasado\",\n      \"current\" : \"este trimestre\",\n      \"past\" : \"hace {0} trim.\",\n      \"next\" : \"el próximo trimestre\",\n      \"future\" : {\n        \"other\" : \"en {0} trim\",\n        \"one\" : \"en {0} trim.\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"hace {0} m\",\n      \"future\" : \"en {0} m\",\n      \"next\" : \"el próximo mes\",\n      \"previous\" : \"el mes pasado\",\n      \"current\" : \"este mes\"\n    },\n    \"week\" : {\n      \"future\" : \"en {0} sem.\",\n      \"next\" : \"la semana próxima\",\n      \"current\" : \"esta semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"previous\" : \"la semana pasada\"\n    },\n    \"day\" : {\n      \"previous\" : \"ayer\",\n      \"current\" : \"hoy\",\n      \"next\" : \"mañana\",\n      \"past\" : {\n        \"one\" : \"hace {0} día\",\n        \"other\" : \"hace {0} días\"\n      },\n      \"future\" : {\n        \"one\" : \"en {0} día\",\n        \"other\" : \"en {0} días\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/es_US.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : \"dentro de {0} s\",\n      \"past\" : \"hace {0} s\",\n      \"current\" : \"ahora\"\n    },\n    \"month\" : {\n      \"past\" : \"hace {0} m\",\n      \"future\" : \"dentro de {0} m\",\n      \"current\" : \"este mes\",\n      \"previous\" : \"el mes pasado\",\n      \"next\" : \"el próximo mes\"\n    },\n    \"hour\" : {\n      \"future\" : \"dentro de {0} h\",\n      \"past\" : \"hace {0} h\",\n      \"current\" : \"esta hora\"\n    },\n    \"week\" : {\n      \"next\" : \"la semana próxima\",\n      \"current\" : \"esta semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\",\n      \"previous\" : \"la semana pasada\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"previous\" : \"ayer\",\n      \"next\" : \"mañana\",\n      \"past\" : {\n        \"one\" : \"hace {0} día\",\n        \"other\" : \"hace {0} días\"\n      },\n      \"current\" : \"hoy\"\n    },\n    \"minute\" : {\n      \"past\" : \"hace {0} min\",\n      \"current\" : \"este minuto\",\n      \"future\" : \"dentro de {0} min\"\n    },\n    \"year\" : {\n      \"next\" : \"el próximo año\",\n      \"future\" : \"dentro de {0} a\",\n      \"previous\" : \"el año pasado\",\n      \"current\" : \"este año\",\n      \"past\" : \"hace {0} a\"\n    },\n    \"now\" : \"ahora\",\n    \"quarter\" : {\n      \"previous\" : \"el trimestre pasado\",\n      \"next\" : \"el próximo trimestre\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"current\" : \"este trimestre\",\n      \"past\" : \"hace {0} trim.\"\n    }\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"hace {0} minuto\",\n        \"other\" : \"hace {0} minutos\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} minuto\",\n        \"other\" : \"dentro de {0} minutos\"\n      },\n      \"current\" : \"este minuto\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"hace {0} meses\",\n        \"one\" : \"hace {0} mes\"\n      },\n      \"next\" : \"el mes próximo\",\n      \"previous\" : \"el mes pasado\",\n      \"current\" : \"este mes\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} mes\",\n        \"other\" : \"dentro de {0} meses\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} horas\",\n        \"one\" : \"dentro de {0} hora\"\n      },\n      \"current\" : \"esta hora\",\n      \"past\" : {\n        \"one\" : \"hace {0} hora\",\n        \"other\" : \"hace {0} horas\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"hace {0} segundos\",\n        \"one\" : \"hace {0} segundo\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} segundo\",\n        \"other\" : \"dentro de {0} segundos\"\n      },\n      \"current\" : \"ahora\"\n    },\n    \"now\" : \"ahora\",\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"dentro de {0} año\",\n        \"other\" : \"dentro de {0} años\"\n      },\n      \"previous\" : \"el año pasado\",\n      \"current\" : \"este año\",\n      \"next\" : \"el año próximo\",\n      \"past\" : {\n        \"one\" : \"hace {0} año\",\n        \"other\" : \"hace {0} años\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} semanas\",\n        \"one\" : \"dentro de {0} semana\"\n      },\n      \"current\" : \"esta semana\",\n      \"previous\" : \"la semana pasada\",\n      \"next\" : \"la semana próxima\",\n      \"past\" : {\n        \"one\" : \"hace {0} semana\",\n        \"other\" : \"hace {0} semanas\"\n      }\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"hace {0} trimestre\",\n        \"other\" : \"hace {0} trimestres\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} trimestres\",\n        \"one\" : \"dentro de {0} trimestre\"\n      },\n      \"next\" : \"el próximo trimestre\",\n      \"current\" : \"este trimestre\",\n      \"previous\" : \"el trimestre pasado\"\n    },\n    \"day\" : {\n      \"current\" : \"hoy\",\n      \"past\" : {\n        \"other\" : \"hace {0} días\",\n        \"one\" : \"hace {0} día\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} día\",\n        \"other\" : \"dentro de {0} días\"\n      },\n      \"next\" : \"mañana\",\n      \"previous\" : \"ayer\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"past\" : \"hace {0} h\",\n      \"current\" : \"esta hora\",\n      \"future\" : \"dentro de {0} h\"\n    },\n    \"now\" : \"ahora\",\n    \"quarter\" : {\n      \"current\" : \"este trimestre\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"past\" : \"hace {0} trim.\",\n      \"next\" : \"el próximo trimestre\",\n      \"previous\" : \"el trimestre pasado\"\n    },\n    \"day\" : {\n      \"current\" : \"hoy\",\n      \"past\" : {\n        \"other\" : \"hace {0} días\",\n        \"one\" : \"hace {0} día\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} día\",\n        \"other\" : \"dentro de {0} días\"\n      },\n      \"next\" : \"mañana\",\n      \"previous\" : \"ayer\"\n    },\n    \"week\" : {\n      \"current\" : \"esta semana\",\n      \"past\" : \"hace {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\",\n      \"next\" : \"la semana próxima\",\n      \"previous\" : \"la semana pasada\"\n    },\n    \"minute\" : {\n      \"current\" : \"este minuto\",\n      \"past\" : \"hace {0} min\",\n      \"future\" : \"dentro de {0} min\"\n    },\n    \"second\" : {\n      \"future\" : \"dentro de {0} s\",\n      \"current\" : \"ahora\",\n      \"past\" : \"hace {0} s\"\n    },\n    \"month\" : {\n      \"current\" : \"este mes\",\n      \"future\" : \"dentro de {0} m\",\n      \"previous\" : \"el mes pasado\",\n      \"next\" : \"el próximo mes\",\n      \"past\" : \"hace {0} m\"\n    },\n    \"year\" : {\n      \"future\" : \"dentro de {0} a\",\n      \"previous\" : \"el año pasado\",\n      \"next\" : \"el próximo año\",\n      \"current\" : \"este año\",\n      \"past\" : \"hace {0} a\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/et.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"{0} a pärast\",\n      \"previous\" : \"eelmine aasta\",\n      \"next\" : \"järgmine aasta\",\n      \"current\" : \"käesolev aasta\",\n      \"past\" : \"{0} a eest\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} näd eest\",\n      \"previous\" : \"eelmine nädal\",\n      \"future\" : \"{0} näd pärast\",\n      \"current\" : \"käesolev nädal\",\n      \"next\" : \"järgmine nädal\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} t eest\",\n      \"future\" : \"{0} t pärast\",\n      \"current\" : \"praegusel tunnil\"\n    },\n    \"quarter\" : {\n      \"current\" : \"käesolev kv\",\n      \"previous\" : \"eelmine kv\",\n      \"future\" : \"{0} kv pärast\",\n      \"past\" : \"{0} kv eest\",\n      \"next\" : \"järgmine kv\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} s pärast\",\n      \"current\" : \"nüüd\",\n      \"past\" : \"{0} s eest\"\n    },\n    \"month\" : {\n      \"current\" : \"käesolev kuu\",\n      \"future\" : \"{0} k pärast\",\n      \"past\" : \"{0} k eest\",\n      \"next\" : \"järgmine kuu\",\n      \"previous\" : \"eelmine kuu\"\n    },\n    \"day\" : {\n      \"previous\" : \"eile\",\n      \"future\" : \"{0} p pärast\",\n      \"next\" : \"homme\",\n      \"current\" : \"täna\",\n      \"past\" : \"{0} p eest\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} min pärast\",\n      \"current\" : \"praegusel minutil\",\n      \"past\" : \"{0} min eest\"\n    },\n    \"now\" : \"nüüd\"\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"järgmine kvartal\",\n      \"current\" : \"käesolev kvartal\",\n      \"previous\" : \"eelmine kvartal\",\n      \"past\" : \"{0} kvartali eest\",\n      \"future\" : \"{0} kvartali pärast\"\n    },\n    \"now\" : \"nüüd\",\n    \"year\" : {\n      \"previous\" : \"eelmine aasta\",\n      \"past\" : \"{0} aasta eest\",\n      \"future\" : \"{0} aasta pärast\",\n      \"next\" : \"järgmine aasta\",\n      \"current\" : \"käesolev aasta\"\n    },\n    \"month\" : {\n      \"previous\" : \"eelmine kuu\",\n      \"current\" : \"käesolev kuu\",\n      \"future\" : \"{0} kuu pärast\",\n      \"past\" : \"{0} kuu eest\",\n      \"next\" : \"järgmine kuu\"\n    },\n    \"day\" : {\n      \"previous\" : \"eile\",\n      \"future\" : \"{0} päeva pärast\",\n      \"next\" : \"homme\",\n      \"past\" : \"{0} päeva eest\",\n      \"current\" : \"täna\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} sekundi eest\",\n      \"future\" : \"{0} sekundi pärast\",\n      \"current\" : \"nüüd\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} nädala eest\",\n      \"current\" : \"käesolev nädal\",\n      \"next\" : \"järgmine nädal\",\n      \"previous\" : \"eelmine nädal\",\n      \"future\" : \"{0} nädala pärast\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} tunni pärast\",\n      \"current\" : \"praegusel tunnil\",\n      \"past\" : \"{0} tunni eest\"\n    },\n    \"minute\" : {\n      \"current\" : \"praegusel minutil\",\n      \"past\" : \"{0} minuti eest\",\n      \"future\" : \"{0} minuti pärast\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"nüüd\",\n      \"past\" : \"{0} sek eest\",\n      \"future\" : \"{0} sek pärast\"\n    },\n    \"now\" : \"nüüd\",\n    \"month\" : {\n      \"future\" : \"{0} kuu pärast\",\n      \"current\" : \"käesolev kuu\",\n      \"past\" : \"{0} kuu eest\",\n      \"previous\" : \"eelmine kuu\",\n      \"next\" : \"järgmine kuu\"\n    },\n    \"day\" : {\n      \"previous\" : \"eile\",\n      \"current\" : \"täna\",\n      \"next\" : \"homme\",\n      \"future\" : \"{0} p pärast\",\n      \"past\" : \"{0} p eest\"\n    },\n    \"minute\" : {\n      \"current\" : \"praegusel minutil\",\n      \"future\" : \"{0} min pärast\",\n      \"past\" : \"{0} min eest\"\n    },\n    \"quarter\" : {\n      \"past\" : \"{0} kv eest\",\n      \"previous\" : \"eelmine kv\",\n      \"current\" : \"käesolev kv\",\n      \"future\" : \"{0} kv pärast\",\n      \"next\" : \"järgmine kv\"\n    },\n    \"hour\" : {\n      \"current\" : \"praegusel tunnil\",\n      \"future\" : \"{0} t pärast\",\n      \"past\" : \"{0} t eest\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} näd pärast\",\n      \"previous\" : \"eelmine nädal\",\n      \"next\" : \"järgmine nädal\",\n      \"past\" : \"{0} näd eest\",\n      \"current\" : \"käesolev nädal\"\n    },\n    \"year\" : {\n      \"next\" : \"järgmine aasta\",\n      \"current\" : \"käesolev aasta\",\n      \"past\" : \"{0} a eest\",\n      \"future\" : \"{0} a pärast\",\n      \"previous\" : \"eelmine aasta\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/eu.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"current\" : \"aurten\",\n      \"past\" : \"Duela {0} urte\",\n      \"future\" : \"{0} urte barru\",\n      \"next\" : \"hurrengo urtea\",\n      \"previous\" : \"aurreko urtea\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} minutu barru\",\n      \"current\" : \"minutu honetan\",\n      \"past\" : \"Duela {0} minutu\"\n    },\n    \"day\" : {\n      \"past\" : \"Duela {0} egun\",\n      \"future\" : \"{0} egun barru\",\n      \"current\" : \"gaur\",\n      \"previous\" : \"atzo\",\n      \"next\" : \"bihar\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} segundo barru\",\n      \"current\" : \"orain\",\n      \"past\" : \"Duela {0} segundo\"\n    },\n    \"now\" : \"orain\",\n    \"month\" : {\n      \"next\" : \"hurrengo hilabetean\",\n      \"future\" : \"{0} hilabete barru\",\n      \"previous\" : \"aurreko hilabetean\",\n      \"current\" : \"hilabete honetan\",\n      \"past\" : \"Duela {0} hilabete\"\n    },\n    \"week\" : {\n      \"previous\" : \"aurreko astean\",\n      \"next\" : \"hurrengo astean\",\n      \"future\" : \"{0} aste barru\",\n      \"current\" : \"aste honetan\",\n      \"past\" : \"Duela {0} aste\"\n    },\n    \"quarter\" : {\n      \"current\" : \"hiruhileko hau\",\n      \"past\" : \"Duela {0} hiruhileko\",\n      \"future\" : \"{0} hiruhileko barru\",\n      \"next\" : \"hurrengo hiruhilekoa\",\n      \"previous\" : \"aurreko hiruhilekoa\"\n    },\n    \"hour\" : {\n      \"current\" : \"ordu honetan\",\n      \"past\" : \"Duela {0} ordu\",\n      \"future\" : \"{0} ordu barru\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : \"{0} ordu barru\",\n      \"current\" : \"ordu honetan\",\n      \"past\" : \"Duela {0} ordu\"\n    },\n    \"now\" : \"orain\",\n    \"quarter\" : {\n      \"future\" : \"{0} hiruhileko barru\",\n      \"previous\" : \"aurreko hiruhilekoa\",\n      \"next\" : \"hurrengo hiruhilekoa\",\n      \"past\" : \"Duela {0} hiruhileko\",\n      \"current\" : \"hiruhileko hau\"\n    },\n    \"day\" : {\n      \"current\" : \"gaur\",\n      \"future\" : \"{0} egun barru\",\n      \"past\" : \"Duela {0} egun\",\n      \"next\" : \"bihar\",\n      \"previous\" : \"atzo\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} aste barru\",\n      \"previous\" : \"aurreko astean\",\n      \"next\" : \"hurrengo astean\",\n      \"current\" : \"aste honetan\",\n      \"past\" : \"Duela {0} aste\"\n    },\n    \"minute\" : {\n      \"past\" : \"Duela {0} minutu\",\n      \"future\" : \"{0} minutu barru\",\n      \"current\" : \"minutu honetan\"\n    },\n    \"second\" : {\n      \"past\" : \"Duela {0} segundo\",\n      \"current\" : \"orain\",\n      \"future\" : \"{0} segundo barru\"\n    },\n    \"month\" : {\n      \"current\" : \"hilabete honetan\",\n      \"previous\" : \"aurreko hilabetean\",\n      \"next\" : \"hurrengo hilabetean\",\n      \"past\" : \"Duela {0} hilabete\",\n      \"future\" : \"{0} hilabete barru\"\n    },\n    \"year\" : {\n      \"current\" : \"aurten\",\n      \"future\" : \"{0} urte barru\",\n      \"previous\" : \"aurreko urtea\",\n      \"next\" : \"hurrengo urtea\",\n      \"past\" : \"Duela {0} urte\"\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"previous\" : \"aurreko hiruhilekoa\",\n      \"current\" : \"hiruhileko hau\",\n      \"future\" : \"{0} hiruhileko barru\",\n      \"next\" : \"hurrengo hiruhilekoa\",\n      \"past\" : \"Duela {0} hiruhileko\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} ordu barru\",\n      \"current\" : \"ordu honetan\",\n      \"past\" : \"Duela {0} ordu\"\n    },\n    \"now\" : \"orain\",\n    \"week\" : {\n      \"current\" : \"aste honetan\",\n      \"next\" : \"hurrengo astean\",\n      \"previous\" : \"aurreko astean\",\n      \"future\" : \"{0} aste barru\",\n      \"past\" : \"Duela {0} aste\"\n    },\n    \"second\" : {\n      \"past\" : \"Duela {0} segundo\",\n      \"current\" : \"orain\",\n      \"future\" : \"{0} segundo barru\"\n    },\n    \"year\" : {\n      \"current\" : \"aurten\",\n      \"previous\" : \"iaz\",\n      \"past\" : \"Duela {0} urte\",\n      \"future\" : \"{0} urte barru\",\n      \"next\" : \"hurrengo urtean\"\n    },\n    \"day\" : {\n      \"future\" : \"{0} egun barru\",\n      \"previous\" : \"atzo\",\n      \"past\" : \"Duela {0} egun\",\n      \"next\" : \"bihar\",\n      \"current\" : \"gaur\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} minutu barru\",\n      \"past\" : \"Duela {0} minutu\",\n      \"current\" : \"minutu honetan\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} hilabete barru\",\n      \"next\" : \"hurrengo hilabetean\",\n      \"past\" : \"Duela {0} hilabete\",\n      \"previous\" : \"aurreko hilabetean\",\n      \"current\" : \"hilabete honetan\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fa.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"فردا\",\n      \"future\" : \"{0} روز بعد\",\n      \"previous\" : \"دیروز\",\n      \"current\" : \"امروز\",\n      \"past\" : \"{0} روز پیش\"\n    },\n    \"quarter\" : {\n      \"next\" : \"سه‌ماههٔ آینده\",\n      \"past\" : \"{0} سه‌ماههٔ پیش\",\n      \"future\" : \"{0} سه‌ماههٔ بعد\",\n      \"previous\" : \"سه‌ماههٔ گذشته\",\n      \"current\" : \"سه‌ماههٔ کنونی\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} ساعت بعد\",\n      \"current\" : \"همین ساعت\",\n      \"past\" : \"{0} ساعت پیش\"\n    },\n    \"year\" : {\n      \"next\" : \"سال آینده\",\n      \"past\" : \"{0} سال پیش\",\n      \"current\" : \"امسال\",\n      \"previous\" : \"سال گذشته\",\n      \"future\" : \"{0} سال بعد\"\n    },\n    \"now\" : \"اکنون\",\n    \"month\" : {\n      \"current\" : \"این ماه\",\n      \"future\" : \"{0} ماه بعد\",\n      \"past\" : \"{0} ماه پیش\",\n      \"next\" : \"ماه آینده\",\n      \"previous\" : \"ماه پیش\"\n    },\n    \"week\" : {\n      \"previous\" : \"هفتهٔ گذشته\",\n      \"current\" : \"این هفته\",\n      \"past\" : \"{0} هفته پیش\",\n      \"future\" : \"{0} هفته بعد\",\n      \"next\" : \"هفتهٔ آینده\"\n    },\n    \"minute\" : {\n      \"current\" : \"همین دقیقه\",\n      \"future\" : \"{0} دقیقه بعد\",\n      \"past\" : \"{0} دقیقه پیش\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} ثانیه پیش\",\n      \"current\" : \"اکنون\",\n      \"future\" : \"{0} ثانیه بعد\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"دیروز\",\n      \"current\" : \"امروز\",\n      \"next\" : \"فردا\",\n      \"past\" : \"{0} روز پیش\",\n      \"future\" : \"{0} روز بعد\"\n    },\n    \"week\" : {\n      \"current\" : \"این هفته\",\n      \"future\" : \"{0} هفته بعد\",\n      \"past\" : \"{0} هفته پیش\",\n      \"previous\" : \"هفتهٔ گذشته\",\n      \"next\" : \"هفتهٔ آینده\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} دقیقه پیش\",\n      \"current\" : \"همین دقیقه\",\n      \"future\" : \"{0} دقیقه بعد\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ماه بعد\",\n      \"next\" : \"ماه آینده\",\n      \"previous\" : \"ماه گذشته\",\n      \"current\" : \"این ماه\",\n      \"past\" : \"{0} ماه پیش\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ساعت پیش\",\n      \"current\" : \"همین ساعت\",\n      \"future\" : \"{0} ساعت بعد\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} سال پیش\",\n      \"future\" : \"{0} سال بعد\",\n      \"previous\" : \"سال گذشته\",\n      \"next\" : \"سال آینده\",\n      \"current\" : \"امسال\"\n    },\n    \"second\" : {\n      \"current\" : \"اکنون\",\n      \"past\" : \"{0} ثانیه پیش\",\n      \"future\" : \"{0} ثانیه بعد\"\n    },\n    \"now\" : \"اکنون\",\n    \"quarter\" : {\n      \"past\" : \"{0} سه‌ماههٔ پیش\",\n      \"current\" : \"سه‌ماههٔ کنونی\",\n      \"previous\" : \"سه‌ماههٔ گذشته\",\n      \"future\" : \"{0} سه‌ماههٔ بعد\",\n      \"next\" : \"سه‌ماههٔ آینده\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} سه‌ماههٔ بعد\",\n      \"next\" : \"سه‌ماههٔ آینده\",\n      \"previous\" : \"سه‌ماههٔ گذشته\",\n      \"current\" : \"سه‌ماههٔ کنونی\",\n      \"past\" : \"{0} سه‌ماههٔ پیش\"\n    },\n    \"minute\" : {\n      \"current\" : \"همین دقیقه\",\n      \"past\" : \"{0} دقیقه پیش\",\n      \"future\" : \"{0} دقیقه بعد\"\n    },\n    \"year\" : {\n      \"next\" : \"سال آینده\",\n      \"future\" : \"{0} سال بعد\",\n      \"current\" : \"امسال\",\n      \"past\" : \"{0} سال پیش\",\n      \"previous\" : \"سال گذشته\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} ثانیه بعد\",\n      \"current\" : \"اکنون\",\n      \"past\" : \"{0} ثانیه پیش\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ساعت پیش\",\n      \"future\" : \"{0} ساعت بعد\",\n      \"current\" : \"همین ساعت\"\n    },\n    \"now\" : \"اکنون\",\n    \"month\" : {\n      \"previous\" : \"ماه پیش\",\n      \"next\" : \"ماه آینده\",\n      \"past\" : \"{0} ماه پیش\",\n      \"current\" : \"این ماه\",\n      \"future\" : \"{0} ماه بعد\"\n    },\n    \"week\" : {\n      \"previous\" : \"هفتهٔ گذشته\",\n      \"current\" : \"این هفته\",\n      \"next\" : \"هفتهٔ آینده\",\n      \"past\" : \"{0} هفته پیش\",\n      \"future\" : \"{0} هفته بعد\"\n    },\n    \"day\" : {\n      \"next\" : \"فردا\",\n      \"past\" : \"{0} روز پیش\",\n      \"future\" : \"{0} روز بعد\",\n      \"previous\" : \"دیروز\",\n      \"current\" : \"امروز\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fi.json",
    "content": "{\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"{0} minuuttia sitten\",\n        \"one\" : \"{0} minuutti sitten\"\n      },\n      \"future\" : \"{0} minuutin päästä\",\n      \"current\" : \"tämän minuutin aikana\"\n    },\n    \"year\" : {\n      \"future\" : \"{0} vuoden päästä\",\n      \"current\" : \"tänä vuonna\",\n      \"previous\" : \"viime vuonna\",\n      \"next\" : \"ensi vuonna\",\n      \"past\" : {\n        \"one\" : \"{0} vuosi sitten\",\n        \"other\" : \"{0} vuotta sitten\"\n      }\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"{0} neljännesvuosi sitten\",\n        \"other\" : \"{0} neljännesvuotta sitten\"\n      },\n      \"next\" : \"ensi neljännesvuonna\",\n      \"previous\" : \"viime neljännesvuonna\",\n      \"future\" : \"{0} neljännesvuoden päästä\",\n      \"current\" : \"tänä neljännesvuonna\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} viikon päästä\",\n      \"past\" : {\n        \"other\" : \"{0} viikkoa sitten\",\n        \"one\" : \"{0} viikko sitten\"\n      },\n      \"previous\" : \"viime viikolla\",\n      \"current\" : \"tällä viikolla\",\n      \"next\" : \"ensi viikolla\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} tuntia sitten\",\n        \"one\" : \"{0} tunti sitten\"\n      },\n      \"future\" : \"{0} tunnin päästä\",\n      \"current\" : \"tämän tunnin aikana\"\n    },\n    \"month\" : {\n      \"previous\" : \"viime kuussa\",\n      \"next\" : \"ensi kuussa\",\n      \"future\" : \"{0} kuukauden päästä\",\n      \"past\" : {\n        \"one\" : \"{0} kuukausi sitten\",\n        \"other\" : \"{0} kuukautta sitten\"\n      },\n      \"current\" : \"tässä kuussa\"\n    },\n    \"second\" : {\n      \"current\" : \"nyt\",\n      \"past\" : {\n        \"one\" : \"{0} sekunti sitten\",\n        \"other\" : \"{0} sekuntia sitten\"\n      },\n      \"future\" : \"{0} sekunnin päästä\"\n    },\n    \"now\" : \"nyt\",\n    \"day\" : {\n      \"next\" : \"huomenna\",\n      \"future\" : \"{0} päivän päästä\",\n      \"previous\" : \"eilen\",\n      \"current\" : \"tänään\",\n      \"past\" : {\n        \"other\" : \"{0} päivää sitten\",\n        \"one\" : \"{0} päivä sitten\"\n      }\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"future\" : \"{0} kk päästä\",\n      \"previous\" : \"viime kk\",\n      \"current\" : \"tässä kk\",\n      \"next\" : \"ensi kk\",\n      \"past\" : \"{0} kk sitten\"\n    },\n    \"week\" : {\n      \"previous\" : \"viime vk\",\n      \"current\" : \"tällä vk\",\n      \"future\" : \"{0} vk päästä\",\n      \"past\" : \"{0} vk sitten\",\n      \"next\" : \"ensi vk\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} t päästä\",\n      \"current\" : \"tunnin sisällä\",\n      \"past\" : \"{0} t sitten\"\n    },\n    \"quarter\" : {\n      \"next\" : \"ensi neljänneksenä\",\n      \"previous\" : \"viime neljänneksenä\",\n      \"current\" : \"tänä neljänneksenä\",\n      \"past\" : {\n        \"other\" : \"{0} neljännestä sitten\",\n        \"one\" : \"{0} neljännes sitten\"\n      },\n      \"future\" : \"{0} neljänneksen päästä\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} min sitten\",\n      \"future\" : \"{0} min päästä\",\n      \"current\" : \"minuutin sisällä\"\n    },\n    \"now\" : \"nyt\",\n    \"day\" : {\n      \"past\" : \"{0} pv sitten\",\n      \"previous\" : \"eilen\",\n      \"current\" : \"tänään\",\n      \"next\" : \"huom.\",\n      \"future\" : \"{0} pv päästä\"\n    },\n    \"year\" : {\n      \"current\" : \"tänä v\",\n      \"previous\" : \"viime v\",\n      \"future\" : \"{0} v päästä\",\n      \"past\" : \"{0} v sitten\",\n      \"next\" : \"ensi v\"\n    },\n    \"second\" : {\n      \"current\" : \"nyt\",\n      \"past\" : \"{0} s sitten\",\n      \"future\" : \"{0} s päästä\"\n    }\n  },\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"huom.\",\n      \"current\" : \"tänään\",\n      \"future\" : \"{0} pv päästä\",\n      \"past\" : \"{0} pv sitten\",\n      \"previous\" : \"eilen\"\n    },\n    \"week\" : {\n      \"current\" : \"tällä vk\",\n      \"next\" : \"ensi vk\",\n      \"previous\" : \"viime vk\",\n      \"past\" : \"{0} vk sitten\",\n      \"future\" : \"{0} vk päästä\"\n    },\n    \"quarter\" : {\n      \"past\" : \"{0} nelj. sitten\",\n      \"future\" : \"{0} nelj. päästä\",\n      \"previous\" : \"viime nelj.\",\n      \"current\" : \"tänä nelj.\",\n      \"next\" : \"ensi nelj.\"\n    },\n    \"month\" : {\n      \"previous\" : \"viime kk\",\n      \"current\" : \"tässä kk\",\n      \"next\" : \"ensi kk\",\n      \"past\" : \"{0} kk sitten\",\n      \"future\" : \"{0} kk päästä\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} t päästä\",\n      \"past\" : \"{0} t sitten\",\n      \"current\" : \"tunnin sisällä\"\n    },\n    \"year\" : {\n      \"current\" : \"tänä v\",\n      \"past\" : \"{0} v sitten\",\n      \"future\" : \"{0} v päästä\",\n      \"next\" : \"ensi v\",\n      \"previous\" : \"viime v\"\n    },\n    \"now\" : \"nyt\",\n    \"minute\" : {\n      \"past\" : \"{0} min sitten\",\n      \"current\" : \"minuutin sisällä\",\n      \"future\" : \"{0} min päästä\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} s sitten\",\n      \"future\" : \"{0} s päästä\",\n      \"current\" : \"nyt\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fil.json",
    "content": "{\n  \"narrow\" : {\n    \"hour\" : {\n      \"current\" : \"ngayong oras\",\n      \"past\" : {\n        \"one\" : \"{0} oras nakalipas\",\n        \"other\" : \"{0} (na) oras nakalipas\"\n      },\n      \"future\" : {\n        \"other\" : \"sa {0} (na) oras\",\n        \"one\" : \"sa {0} oras\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"nakaraang linggo\",\n      \"past\" : {\n        \"one\" : \"{0} linggo ang nakalipas\",\n        \"other\" : \"{0} (na) linggo ang nakalipas\"\n      },\n      \"future\" : {\n        \"other\" : \"sa {0} (na) linggo\",\n        \"one\" : \"sa {0} linggo\"\n      },\n      \"next\" : \"susunod na linggo\",\n      \"current\" : \"ngayong linggo\"\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"sa {0} min.\",\n        \"other\" : \"sa {0} (na) min.\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} min. ang nakalipas\",\n        \"other\" : \"{0} (na) min. ang nakalipas\"\n      },\n      \"current\" : \"sa minutong ito\"\n    },\n    \"quarter\" : {\n      \"future\" : {\n        \"other\" : \"sa {0} (na) quarter\",\n        \"one\" : \"sa {0} quarter\"\n      },\n      \"next\" : \"susunod na quarter\",\n      \"current\" : \"ngayong quarter\",\n      \"previous\" : \"nakaraang quarter\",\n      \"past\" : {\n        \"other\" : \"{0} (na) quarter ang nakalipas\",\n        \"one\" : \"{0} quarter ang nakalipas\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"ngayong taon\",\n      \"past\" : {\n        \"one\" : \"{0} taon ang nakalipas\",\n        \"other\" : \"{0} (na) taon ang nakalipas\"\n      },\n      \"future\" : {\n        \"one\" : \"sa {0} taon\",\n        \"other\" : \"sa {0} (na) taon\"\n      },\n      \"next\" : \"susunod na taon\",\n      \"previous\" : \"nakaraang taon\"\n    },\n    \"month\" : {\n      \"previous\" : \"nakaraang buwan\",\n      \"current\" : \"ngayong buwan\",\n      \"next\" : \"susunod na buwan\",\n      \"past\" : {\n        \"one\" : \"{0} buwan ang nakalipas\",\n        \"other\" : \"{0} (na) buwan ang nakalipas\"\n      },\n      \"future\" : {\n        \"other\" : \"sa {0} (na) buwan\",\n        \"one\" : \"sa {0} buwan\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"bukas\",\n      \"previous\" : \"kahapon\",\n      \"past\" : {\n        \"other\" : \"{0} (na) araw ang nakalipas\",\n        \"one\" : \"{0} araw ang nakalipas\"\n      },\n      \"current\" : \"ngayong araw\",\n      \"future\" : {\n        \"one\" : \"sa {0} araw\",\n        \"other\" : \"sa {0} (na) araw\"\n      }\n    },\n    \"now\" : \"ngayon\",\n    \"second\" : {\n      \"current\" : \"ngayon\",\n      \"past\" : {\n        \"one\" : \"{0} seg. nakalipas\",\n        \"other\" : \"{0} (na) seg. nakalipas\"\n      },\n      \"future\" : {\n        \"one\" : \"sa {0} seg.\",\n        \"other\" : \"sa {0} (na) seg.\"\n      }\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"current\" : \"sa linggong ito\",\n      \"next\" : \"susunod na linggo\",\n      \"past\" : {\n        \"one\" : \"{0} linggo ang nakalipas\",\n        \"other\" : \"{0} (na) linggo ang nakalipas\"\n      },\n      \"previous\" : \"nakalipas na linggo\",\n      \"future\" : {\n        \"one\" : \"sa {0} linggo\",\n        \"other\" : \"sa {0} (na) linggo\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"ngayong quarter\",\n      \"past\" : {\n        \"one\" : \"{0} quarter ang nakalipas\",\n        \"other\" : \"{0} (na) quarter ang nakalipas\"\n      },\n      \"previous\" : \"nakaraang quarter\",\n      \"future\" : {\n        \"one\" : \"sa {0} quarter\",\n        \"other\" : \"sa {0} (na) quarter\"\n      },\n      \"next\" : \"susunod na quarter\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"sa {0} segundo\",\n        \"other\" : \"sa {0} (na) segundo\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} (na) segundo ang nakalipas\",\n        \"one\" : \"{0} segundo ang nakalipas\"\n      },\n      \"current\" : \"ngayon\"\n    },\n    \"day\" : {\n      \"current\" : \"ngayong araw\",\n      \"future\" : {\n        \"one\" : \"sa {0} araw\",\n        \"other\" : \"sa {0} (na) araw\"\n      },\n      \"previous\" : \"kahapon\",\n      \"past\" : {\n        \"one\" : \"{0} araw ang nakalipas\",\n        \"other\" : \"{0} (na) araw ang nakalipas\"\n      },\n      \"next\" : \"bukas\"\n    },\n    \"minute\" : {\n      \"current\" : \"sa minutong ito\",\n      \"past\" : {\n        \"other\" : \"{0} (na) minuto ang nakalipas\",\n        \"one\" : \"{0} minuto ang nakalipas\"\n      },\n      \"future\" : {\n        \"other\" : \"sa {0} (na) minuto\",\n        \"one\" : \"sa {0} minuto\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"susunod na buwan\",\n      \"previous\" : \"nakaraang buwan\",\n      \"past\" : {\n        \"one\" : \"{0} buwan ang nakalipas\",\n        \"other\" : \"{0} (na) buwan ang nakalipas\"\n      },\n      \"future\" : {\n        \"other\" : \"sa {0} (na) buwan\",\n        \"one\" : \"sa {0} buwan\"\n      },\n      \"current\" : \"ngayong buwan\"\n    },\n    \"now\" : \"ngayon\",\n    \"year\" : {\n      \"previous\" : \"nakaraang taon\",\n      \"past\" : {\n        \"one\" : \"{0} taon ang nakalipas\",\n        \"other\" : \"{0} (na) taon ang nakalipas\"\n      },\n      \"current\" : \"ngayong taon\",\n      \"next\" : \"susunod na taon\",\n      \"future\" : {\n        \"one\" : \"sa {0} taon\",\n        \"other\" : \"sa {0} (na) taon\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} (na) oras ang nakalipas\",\n        \"one\" : \"{0} oras ang nakalipas\"\n      },\n      \"current\" : \"ngayong oras\",\n      \"future\" : {\n        \"other\" : \"sa {0} (na) oras\",\n        \"one\" : \"sa {0} oras\"\n      }\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"sa minutong ito\",\n      \"future\" : {\n        \"other\" : \"sa {0} (na) min.\",\n        \"one\" : \"sa {0} min.\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} (na) min. ang nakalipas\",\n        \"one\" : \"{0} min. ang nakalipas\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"{0} (na) seg. nakalipas\",\n        \"one\" : \"{0} seg. ang nakalipas\"\n      },\n      \"current\" : \"ngayon\",\n      \"future\" : {\n        \"one\" : \"sa {0} seg.\",\n        \"other\" : \"sa {0} (na) seg.\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"susunod na taon\",\n      \"current\" : \"ngayong taon\",\n      \"past\" : {\n        \"one\" : \"{0} taon ang nakalipas\",\n        \"other\" : \"{0} (na) taon ang nakalipas\"\n      },\n      \"previous\" : \"nakaraang taon\",\n      \"future\" : {\n        \"one\" : \"sa {0} taon\",\n        \"other\" : \"sa {0} (na) taon\"\n      }\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"{0} (na) buwan ang nakalipas\",\n        \"one\" : \"{0} buwan ang nakalipas\"\n      },\n      \"next\" : \"susunod na buwan\",\n      \"future\" : {\n        \"one\" : \"sa {0} buwan\",\n        \"other\" : \"sa {0} (na) buwan\"\n      },\n      \"previous\" : \"nakaraang buwan\",\n      \"current\" : \"ngayong buwan\"\n    },\n    \"day\" : {\n      \"previous\" : \"kahapon\",\n      \"past\" : \"{0} (na) araw ang nakalipas\",\n      \"current\" : \"ngayong araw\",\n      \"next\" : \"bukas\",\n      \"future\" : \"sa {0} (na) araw\"\n    },\n    \"now\" : \"ngayon\",\n    \"hour\" : {\n      \"current\" : \"ngayong oras\",\n      \"future\" : {\n        \"one\" : \"sa {0} oras\",\n        \"other\" : \"sa {0} (na) oras\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} (na) oras ang nakalipas\",\n        \"one\" : \"{0} oras ang nakalipas\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"susunod na quarter\",\n      \"previous\" : \"nakaraang quarter\",\n      \"past\" : {\n        \"one\" : \"{0} quarter ang nakalipas\",\n        \"other\" : \"{0} (na) quarter ang nakalipas\"\n      },\n      \"future\" : \"sa {0} (na) quarter\",\n      \"current\" : \"ngayong quarter\"\n    },\n    \"week\" : {\n      \"next\" : \"susunod na linggo\",\n      \"previous\" : \"nakaraang linggo\",\n      \"past\" : {\n        \"one\" : \"{0} linggo ang nakalipas\",\n        \"other\" : \"{0} (na) linggo ang nakalipas\"\n      },\n      \"current\" : \"ngayong linggo\",\n      \"future\" : {\n        \"one\" : \"sa {0} linggo\",\n        \"other\" : \"sa {0} (na) linggo\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fo.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"um {0} ár\",\n      \"previous\" : \"í fjør\",\n      \"next\" : \"næsta ár\",\n      \"current\" : \"í ár\",\n      \"past\" : \"{0} ár síðan\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} v. síðan\",\n      \"previous\" : \"seinastu viku\",\n      \"future\" : \"um {0} v.\",\n      \"current\" : \"hesu viku\",\n      \"next\" : \"næstu viku\"\n    },\n    \"hour\" : {\n      \"current\" : \"hendan tíman\",\n      \"future\" : \"um {0} t.\",\n      \"past\" : \"{0} t. síðan\"\n    },\n    \"quarter\" : {\n      \"current\" : \"hendan ársfjórðingin\",\n      \"previous\" : \"seinasta ársfjórðing\",\n      \"future\" : \"um {0} ársfj.\",\n      \"past\" : \"{0} ársfj. síðan\",\n      \"next\" : \"næsta ársfjórðing\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} s. síðan\",\n      \"future\" : \"um {0} s.\",\n      \"current\" : \"nú\"\n    },\n    \"month\" : {\n      \"current\" : \"henda mánaðin\",\n      \"future\" : \"um {0} mnð.\",\n      \"past\" : \"{0} mnð. síðan\",\n      \"next\" : \"næsta mánað\",\n      \"previous\" : \"seinasta mánað\"\n    },\n    \"day\" : {\n      \"previous\" : \"í gjár\",\n      \"future\" : \"um {0} d.\",\n      \"next\" : \"í morgin\",\n      \"current\" : \"í dag\",\n      \"past\" : \"{0} d. síðan\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} m. síðan\",\n      \"future\" : \"um {0} m.\",\n      \"current\" : \"hendan minuttin\"\n    },\n    \"now\" : \"nú\"\n  },\n  \"long\" : {\n    \"month\" : {\n      \"previous\" : \"seinasta mánað\",\n      \"past\" : {\n        \"one\" : \"{0} mánað síðan\",\n        \"other\" : \"{0} mánaðir síðan\"\n      },\n      \"next\" : \"næsta mánað\",\n      \"current\" : \"henda mánaðin\",\n      \"future\" : {\n        \"other\" : \"um {0} mánaðir\",\n        \"one\" : \"um {0} mánað\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"hendan minuttin\",\n      \"future\" : {\n        \"one\" : \"um {0} minutt\",\n        \"other\" : \"um {0} minuttir\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} minutt síðan\",\n        \"other\" : \"{0} minuttir síðan\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"næsta ársfjórðing\",\n      \"past\" : {\n        \"one\" : \"{0} ársfjórðing síðan\",\n        \"other\" : \"{0} ársfjórðingar síðan\"\n      },\n      \"future\" : {\n        \"one\" : \"um {0} ársfjórðing\",\n        \"other\" : \"um {0} ársfjórðingar\"\n      },\n      \"current\" : \"hendan ársfjórðingin\",\n      \"previous\" : \"seinasta ársfjórðing\"\n    },\n    \"week\" : {\n      \"next\" : \"næstu viku\",\n      \"previous\" : \"seinastu viku\",\n      \"future\" : {\n        \"other\" : \"um {0} vikur\",\n        \"one\" : \"um {0} viku\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} vika síðan\",\n        \"other\" : \"{0} vikur síðan\"\n      },\n      \"current\" : \"hesu viku\"\n    },\n    \"day\" : {\n      \"previous\" : \"í gjár\",\n      \"past\" : {\n        \"one\" : \"{0} dagur síðan\",\n        \"other\" : \"{0} dagar síðan\"\n      },\n      \"future\" : {\n        \"other\" : \"um {0} dagar\",\n        \"one\" : \"um {0} dag\"\n      },\n      \"current\" : \"í dag\",\n      \"next\" : \"í morgin\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"um {0} tíma\",\n        \"other\" : \"um {0} tímar\"\n      },\n      \"current\" : \"hendan tíman\",\n      \"past\" : {\n        \"one\" : \"{0} tími síðan\",\n        \"other\" : \"{0} tímar síðan\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"í ár\",\n      \"future\" : \"um {0} ár\",\n      \"next\" : \"næsta ár\",\n      \"past\" : \"{0} ár síðan\",\n      \"previous\" : \"í fjør\"\n    },\n    \"second\" : {\n      \"future\" : \"um {0} sekund\",\n      \"current\" : \"nú\",\n      \"past\" : \"{0} sekund síðan\"\n    },\n    \"now\" : \"nú\"\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"nú\",\n      \"past\" : \"{0} sek. síðan\",\n      \"future\" : \"um {0} sek.\"\n    },\n    \"now\" : \"nú\",\n    \"month\" : {\n      \"future\" : \"um {0} mnð.\",\n      \"current\" : \"henda mánaðin\",\n      \"past\" : \"{0} mnð. síðan\",\n      \"previous\" : \"seinasta mánað\",\n      \"next\" : \"næsta mánað\"\n    },\n    \"day\" : {\n      \"previous\" : \"í gjár\",\n      \"current\" : \"í dag\",\n      \"next\" : \"í morgin\",\n      \"future\" : \"um {0} da.\",\n      \"past\" : \"{0} da. síðan\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} min. síðan\",\n      \"future\" : \"um {0} min.\",\n      \"current\" : \"hendan minuttin\"\n    },\n    \"quarter\" : {\n      \"past\" : \"{0} ársfj. síðan\",\n      \"previous\" : \"seinasta ársfjórðing\",\n      \"current\" : \"hendan ársfjórðingin\",\n      \"future\" : \"um {0} ársfj.\",\n      \"next\" : \"næsta ársfjórðing\"\n    },\n    \"hour\" : {\n      \"future\" : \"um {0} t.\",\n      \"current\" : \"hendan tíman\",\n      \"past\" : \"{0} t. síðan\"\n    },\n    \"week\" : {\n      \"future\" : \"um {0} vi.\",\n      \"previous\" : \"seinastu viku\",\n      \"next\" : \"næstu viku\",\n      \"past\" : \"{0} vi. síðan\",\n      \"current\" : \"hesu viku\"\n    },\n    \"year\" : {\n      \"next\" : \"næsta ár\",\n      \"current\" : \"í ár\",\n      \"past\" : \"{0} ár síðan\",\n      \"future\" : \"um {0} ár\",\n      \"previous\" : \"í fjør\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fr.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"demain\",\n      \"future\" : \"+{0} j\",\n      \"previous\" : \"hier\",\n      \"current\" : \"aujourd’hui\",\n      \"past\" : \"-{0} j\"\n    },\n    \"quarter\" : {\n      \"next\" : \"le trimestre prochain\",\n      \"past\" : \"-{0} trim.\",\n      \"future\" : \"+{0} trim.\",\n      \"previous\" : \"le trimestre dernier\",\n      \"current\" : \"ce trimestre\"\n    },\n    \"hour\" : {\n      \"past\" : \"-{0} h\",\n      \"future\" : \"+{0} h\",\n      \"current\" : \"cette heure-ci\"\n    },\n    \"year\" : {\n      \"next\" : \"l’année prochaine\",\n      \"past\" : \"-{0} a\",\n      \"current\" : \"cette année\",\n      \"previous\" : \"l’année dernière\",\n      \"future\" : \"+{0} a\"\n    },\n    \"now\" : \"maintenant\",\n    \"month\" : {\n      \"current\" : \"ce mois-ci\",\n      \"future\" : \"+{0} m.\",\n      \"past\" : \"-{0} m.\",\n      \"next\" : \"le mois prochain\",\n      \"previous\" : \"le mois dernier\"\n    },\n    \"week\" : {\n      \"previous\" : \"la semaine dernière\",\n      \"current\" : \"cette semaine\",\n      \"past\" : \"-{0} sem.\",\n      \"future\" : \"+{0} sem.\",\n      \"next\" : \"la semaine prochaine\"\n    },\n    \"minute\" : {\n      \"current\" : \"cette minute-ci\",\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\"\n    },\n    \"second\" : {\n      \"current\" : \"maintenant\",\n      \"past\" : \"-{0} s\",\n      \"future\" : \"+{0} s\"\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"le trimestre prochain\",\n      \"future\" : {\n        \"other\" : \"dans {0} trimestres\",\n        \"one\" : \"dans {0} trimestre\"\n      },\n      \"previous\" : \"le trimestre dernier\",\n      \"current\" : \"ce trimestre\",\n      \"past\" : {\n        \"other\" : \"il y a {0} trimestres\",\n        \"one\" : \"il y a {0} trimestre\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"dans {0} heures\",\n        \"one\" : \"dans {0} heure\"\n      },\n      \"past\" : {\n        \"one\" : \"il y a {0} heure\",\n        \"other\" : \"il y a {0} heures\"\n      },\n      \"current\" : \"cette heure-ci\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"il y a {0} minute\",\n        \"other\" : \"il y a {0} minutes\"\n      },\n      \"future\" : {\n        \"one\" : \"dans {0} minute\",\n        \"other\" : \"dans {0} minutes\"\n      },\n      \"current\" : \"cette minute-ci\"\n    },\n    \"now\" : \"maintenant\",\n    \"month\" : {\n      \"next\" : \"le mois prochain\",\n      \"previous\" : \"le mois dernier\",\n      \"future\" : \"dans {0} mois\",\n      \"current\" : \"ce mois-ci\",\n      \"past\" : \"il y a {0} mois\"\n    },\n    \"day\" : {\n      \"next\" : \"demain\",\n      \"future\" : {\n        \"one\" : \"dans {0} jour\",\n        \"other\" : \"dans {0} jours\"\n      },\n      \"past\" : {\n        \"one\" : \"il y a {0} jour\",\n        \"other\" : \"il y a {0} jours\"\n      },\n      \"current\" : \"aujourd’hui\",\n      \"previous\" : \"hier\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"dans {0} an\",\n        \"other\" : \"dans {0} ans\"\n      },\n      \"previous\" : \"l’année dernière\",\n      \"next\" : \"l’année prochaine\",\n      \"current\" : \"cette année\",\n      \"past\" : {\n        \"other\" : \"il y a {0} ans\",\n        \"one\" : \"il y a {0} an\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"la semaine prochaine\",\n      \"past\" : {\n        \"one\" : \"il y a {0} semaine\",\n        \"other\" : \"il y a {0} semaines\"\n      },\n      \"previous\" : \"la semaine dernière\",\n      \"current\" : \"cette semaine\",\n      \"future\" : {\n        \"one\" : \"dans {0} semaine\",\n        \"other\" : \"dans {0} semaines\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"dans {0} seconde\",\n        \"other\" : \"dans {0} secondes\"\n      },\n      \"current\" : \"maintenant\",\n      \"past\" : {\n        \"other\" : \"il y a {0} secondes\",\n        \"one\" : \"il y a {0} seconde\"\n      }\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"dans {0} trim.\",\n      \"next\" : \"le trimestre prochain\",\n      \"previous\" : \"le trimestre dernier\",\n      \"current\" : \"ce trimestre\",\n      \"past\" : \"il y a {0} trim.\"\n    },\n    \"minute\" : {\n      \"future\" : \"dans {0} min\",\n      \"current\" : \"cette minute-ci\",\n      \"past\" : \"il y a {0} min\"\n    },\n    \"year\" : {\n      \"next\" : \"l’année prochaine\",\n      \"future\" : \"dans {0} a\",\n      \"current\" : \"cette année\",\n      \"past\" : \"il y a {0} a\",\n      \"previous\" : \"l’année dernière\"\n    },\n    \"second\" : {\n      \"current\" : \"maintenant\",\n      \"past\" : \"il y a {0} s\",\n      \"future\" : \"dans {0} s\"\n    },\n    \"hour\" : {\n      \"current\" : \"cette heure-ci\",\n      \"past\" : \"il y a {0} h\",\n      \"future\" : \"dans {0} h\"\n    },\n    \"now\" : \"maintenant\",\n    \"month\" : {\n      \"previous\" : \"le mois dernier\",\n      \"next\" : \"le mois prochain\",\n      \"past\" : \"il y a {0} m.\",\n      \"current\" : \"ce mois-ci\",\n      \"future\" : \"dans {0} m.\"\n    },\n    \"week\" : {\n      \"previous\" : \"la semaine dernière\",\n      \"current\" : \"cette semaine\",\n      \"next\" : \"la semaine prochaine\",\n      \"past\" : \"il y a {0} sem.\",\n      \"future\" : \"dans {0} sem.\"\n    },\n    \"day\" : {\n      \"next\" : \"demain\",\n      \"past\" : \"il y a {0} j\",\n      \"future\" : \"dans {0} j\",\n      \"previous\" : \"hier\",\n      \"current\" : \"aujourd’hui\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fr_CA.json",
    "content": "{\n  \"long\" : {\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"il y a {0} trimestre\",\n        \"other\" : \"il y a {0} trimestres\"\n      },\n      \"next\" : \"le trimestre prochain\",\n      \"previous\" : \"le trimestre dernier\",\n      \"current\" : \"ce trimestre-ci\",\n      \"future\" : {\n        \"one\" : \"dans {0} trimestre\",\n        \"other\" : \"dans {0} trimestres\"\n      }\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"dans {0} jours\",\n        \"one\" : \"dans {0} jour\"\n      },\n      \"previous\" : \"hier\",\n      \"past\" : {\n        \"other\" : \"il y a {0} jours\",\n        \"one\" : \"il y a {0} jour\"\n      },\n      \"next\" : \"demain\",\n      \"current\" : \"aujourd’hui\"\n    },\n    \"year\" : {\n      \"previous\" : \"l’année dernière\",\n      \"current\" : \"cette année\",\n      \"future\" : {\n        \"one\" : \"Dans {0} an\",\n        \"other\" : \"Dans {0} ans\"\n      },\n      \"next\" : \"l’année prochaine\",\n      \"past\" : {\n        \"other\" : \"Il y a {0} ans\",\n        \"one\" : \"Il y a {0} an\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"dans {0} heure\",\n        \"other\" : \"dans {0} heures\"\n      },\n      \"current\" : \"cette heure-ci\",\n      \"past\" : {\n        \"other\" : \"il y a {0} heures\",\n        \"one\" : \"il y a {0} heure\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"il y a {0} seconde\",\n        \"other\" : \"il y a {0} secondes\"\n      },\n      \"current\" : \"maintenant\",\n      \"future\" : {\n        \"other\" : \"dans {0} secondes\",\n        \"one\" : \"dans {0} seconde\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"il y a {0} minute\",\n        \"other\" : \"il y a {0} minutes\"\n      },\n      \"current\" : \"cette minute-ci\",\n      \"future\" : {\n        \"one\" : \"dans {0} minute\",\n        \"other\" : \"dans {0} minutes\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"ce mois-ci\",\n      \"next\" : \"le mois prochain\",\n      \"previous\" : \"le mois dernier\",\n      \"past\" : \"il y a {0} mois\",\n      \"future\" : \"dans {0} mois\"\n    },\n    \"now\" : \"maintenant\",\n    \"week\" : {\n      \"past\" : {\n        \"one\" : \"il y a {0} semaine\",\n        \"other\" : \"il y a {0} semaines\"\n      },\n      \"current\" : \"cette semaine\",\n      \"next\" : \"la semaine prochaine\",\n      \"previous\" : \"la semaine dernière\",\n      \"future\" : {\n        \"one\" : \"dans {0} semaine\",\n        \"other\" : \"dans {0} semaines\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"current\" : \"cette semaine\",\n      \"next\" : \"la semaine prochaine\",\n      \"past\" : \"-{0} sem.\",\n      \"previous\" : \"la semaine dernière\",\n      \"future\" : \"+{0} sem.\"\n    },\n    \"minute\" : {\n      \"current\" : \"cette minute-ci\",\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\"\n    },\n    \"month\" : {\n      \"current\" : \"ce mois-ci\",\n      \"previous\" : \"le mois dernier\",\n      \"past\" : \"-{0} m.\",\n      \"next\" : \"le mois prochain\",\n      \"future\" : \"+{0} m.\"\n    },\n    \"now\" : \"maintenant\",\n    \"year\" : {\n      \"current\" : \"cette année\",\n      \"next\" : \"l’année prochaine\",\n      \"past\" : \"-{0} a\",\n      \"future\" : \"+{0} a\",\n      \"previous\" : \"l’année dernière\"\n    },\n    \"hour\" : {\n      \"current\" : \"cette heure-ci\",\n      \"future\" : \"+{0} h\",\n      \"past\" : \"-{0} h\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"le trimestre dernier\",\n      \"current\" : \"ce trimestre-ci\",\n      \"past\" : \"-{0} trim.\",\n      \"future\" : \"+{0} trim.\",\n      \"next\" : \"le trimestre prochain\"\n    },\n    \"second\" : {\n      \"past\" : \"-{0} s\",\n      \"future\" : {\n        \"one\" : \"+ {0} s\",\n        \"other\" : \"+{0} s\"\n      },\n      \"current\" : \"maintenant\"\n    },\n    \"day\" : {\n      \"past\" : \"-{0} j\",\n      \"current\" : \"aujourd’hui\",\n      \"future\" : \"+{0} j\",\n      \"previous\" : \"hier\",\n      \"next\" : \"demain\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"previous\" : \"le mois dernier\",\n      \"current\" : \"ce mois-ci\",\n      \"next\" : \"le mois prochain\",\n      \"past\" : \"il y a {0} m.\",\n      \"future\" : \"dans {0} m.\"\n    },\n    \"now\" : \"maintenant\",\n    \"day\" : {\n      \"next\" : \"demain\",\n      \"current\" : \"aujourd’hui\",\n      \"previous\" : \"hier\",\n      \"past\" : \"il y a {0} j\",\n      \"future\" : \"dans {0} j\"\n    },\n    \"year\" : {\n      \"current\" : \"cette année\",\n      \"future\" : \"dans {0} a\",\n      \"previous\" : \"l’année dernière\",\n      \"next\" : \"l’année prochaine\",\n      \"past\" : \"il y a {0} a\"\n    },\n    \"hour\" : {\n      \"future\" : \"dans {0} h\",\n      \"current\" : \"cette heure-ci\",\n      \"past\" : \"il y a {0} h\"\n    },\n    \"minute\" : {\n      \"past\" : \"il y a {0} min\",\n      \"future\" : \"dans {0} min\",\n      \"current\" : \"cette minute-ci\"\n    },\n    \"second\" : {\n      \"past\" : \"il y a {0} s\",\n      \"current\" : \"maintenant\",\n      \"future\" : \"dans {0} s\"\n    },\n    \"quarter\" : {\n      \"future\" : \"dans {0} trim.\",\n      \"previous\" : \"le trimestre dernier\",\n      \"next\" : \"le trimestre prochain\",\n      \"past\" : \"il y a {0} trim.\",\n      \"current\" : \"ce trimestre-ci\"\n    },\n    \"week\" : {\n      \"next\" : \"la semaine prochaine\",\n      \"past\" : \"il y a {0} sem.\",\n      \"current\" : \"cette semaine\",\n      \"previous\" : \"la semaine dernière\",\n      \"future\" : \"dans {0} sem.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fur.json",
    "content": "{\n  \"short\" : {\n    \"day\" : {\n      \"next\" : \"doman\",\n      \"past\" : {\n        \"one\" : \"{0} zornade indaûr\",\n        \"other\" : \"{0} zornadis indaûr\"\n      },\n      \"current\" : \"vuê\",\n      \"previous\" : \"îr\",\n      \"future\" : {\n        \"one\" : \"ca di {0} zornade\",\n        \"other\" : \"ca di {0} zornadis\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"{0} mês indaûr\",\n      \"future\" : \"ca di {0} mês\",\n      \"next\" : \"next month\",\n      \"current\" : \"this month\",\n      \"previous\" : \"last month\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"future\" : {\n        \"one\" : \"ca di {0} ore\",\n        \"other\" : \"ca di {0} oris\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} oris indaûr\",\n        \"one\" : \"{0} ore indaûr\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"next year\",\n      \"previous\" : \"last year\",\n      \"past\" : {\n        \"other\" : \"{0} agns indaûr\",\n        \"one\" : \"{0} an indaûr\"\n      },\n      \"current\" : \"this year\",\n      \"future\" : {\n        \"one\" : \"ca di {0} an\",\n        \"other\" : \"ca di {0} agns\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"ca di {0} minût\",\n        \"other\" : \"ca di {0} minûts\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} minûts indaûr\",\n        \"one\" : \"{0} minût indaûr\"\n      }\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"next\" : \"next week\",\n      \"previous\" : \"last week\",\n      \"current\" : \"this week\",\n      \"past\" : {\n        \"one\" : \"{0} setemane indaûr\",\n        \"other\" : \"{0} setemanis indaûr\"\n      },\n      \"future\" : {\n        \"other\" : \"ca di {0} setemanis\",\n        \"one\" : \"ca di {0} setemane\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : {\n        \"one\" : \"ca di {0} secont\",\n        \"other\" : \"ca di {0} seconts\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} secont indaûr\",\n        \"other\" : \"{0} seconts indaûr\"\n      }\n    }\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"{0} ore indaûr\",\n        \"other\" : \"{0} oris indaûr\"\n      },\n      \"future\" : {\n        \"one\" : \"ca di {0} ore\",\n        \"other\" : \"ca di {0} oris\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"day\" : {\n      \"current\" : \"vuê\",\n      \"past\" : {\n        \"one\" : \"{0} zornade indaûr\",\n        \"other\" : \"{0} zornadis indaûr\"\n      },\n      \"future\" : {\n        \"one\" : \"ca di {0} zornade\",\n        \"other\" : \"ca di {0} zornadis\"\n      },\n      \"next\" : \"doman\",\n      \"previous\" : \"îr\"\n    },\n    \"week\" : {\n      \"current\" : \"this week\",\n      \"future\" : {\n        \"one\" : \"ca di {0} setemane\",\n        \"other\" : \"ca di {0} setemanis\"\n      },\n      \"previous\" : \"last week\",\n      \"next\" : \"next week\",\n      \"past\" : {\n        \"other\" : \"{0} setemanis indaûr\",\n        \"one\" : \"{0} setemane indaûr\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"ca di {0} minût\",\n        \"other\" : \"ca di {0} minûts\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} minûts indaûr\",\n        \"one\" : \"{0} minût indaûr\"\n      },\n      \"current\" : \"this minute\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : {\n        \"one\" : \"ca di {0} secont\",\n        \"other\" : \"ca di {0} seconts\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} secont indaûr\",\n        \"other\" : \"{0} seconts indaûr\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"this month\",\n      \"future\" : \"ca di {0} mês\",\n      \"past\" : \"{0} mês indaûr\",\n      \"next\" : \"next month\",\n      \"previous\" : \"last month\"\n    },\n    \"year\" : {\n      \"current\" : \"this year\",\n      \"past\" : {\n        \"one\" : \"{0} an indaûr\",\n        \"other\" : \"{0} agns indaûr\"\n      },\n      \"next\" : \"next year\",\n      \"previous\" : \"last year\",\n      \"future\" : {\n        \"one\" : \"ca di {0} an\",\n        \"other\" : \"ca di {0} agns\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"previous\" : \"last week\",\n      \"past\" : {\n        \"other\" : \"{0} setemanis indaûr\",\n        \"one\" : \"{0} setemane indaûr\"\n      },\n      \"current\" : \"this week\",\n      \"future\" : {\n        \"other\" : \"ca di {0} setemanis\",\n        \"one\" : \"ca di {0} setemane\"\n      },\n      \"next\" : \"next week\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"ca di {0} oris\",\n        \"one\" : \"ca di {0} ore\"\n      },\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"one\" : \"{0} ore indaûr\",\n        \"other\" : \"{0} oris indaûr\"\n      }\n    },\n    \"now\" : \"now\",\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"{0} seconts indaûr\",\n        \"one\" : \"{0} secont indaûr\"\n      },\n      \"future\" : {\n        \"other\" : \"ca di {0} seconts\",\n        \"one\" : \"ca di {0} secont\"\n      },\n      \"current\" : \"now\"\n    },\n    \"month\" : {\n      \"previous\" : \"last month\",\n      \"next\" : \"next month\",\n      \"current\" : \"this month\",\n      \"past\" : \"{0} mês indaûr\",\n      \"future\" : \"ca di {0} mês\"\n    },\n    \"day\" : {\n      \"previous\" : \"îr\",\n      \"current\" : \"vuê\",\n      \"next\" : \"doman\",\n      \"past\" : {\n        \"other\" : \"{0} zornadis indaûr\",\n        \"one\" : \"{0} zornade indaûr\"\n      },\n      \"future\" : {\n        \"other\" : \"ca di {0} zornadis\",\n        \"one\" : \"ca di {0} zornade\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"ca di {0} an\",\n        \"other\" : \"ca di {0} agns\"\n      },\n      \"current\" : \"this year\",\n      \"past\" : {\n        \"other\" : \"{0} agns indaûr\",\n        \"one\" : \"{0} an indaûr\"\n      },\n      \"previous\" : \"last year\",\n      \"next\" : \"next year\"\n    },\n    \"quarter\" : {\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : {\n        \"other\" : \"{0} minûts indaûr\",\n        \"one\" : \"{0} minût indaûr\"\n      },\n      \"future\" : {\n        \"other\" : \"ca di {0} minûts\",\n        \"one\" : \"ca di {0} minût\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/fy.json",
    "content": "{\n  \"narrow\" : {\n    \"week\" : {\n      \"current\" : \"dizze wike\",\n      \"next\" : \"folgjende wike\",\n      \"future\" : {\n        \"other\" : \"Oer {0} wiken\",\n        \"one\" : \"Oer {0} wike\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} wike lyn\",\n        \"other\" : \"{0} wiken lyn\"\n      },\n      \"previous\" : \"foarige wike\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"one\" : \"{0} moanne lyn\",\n        \"other\" : \"{0} moannen lyn\"\n      },\n      \"current\" : \"dizze moanne\",\n      \"future\" : {\n        \"one\" : \"Oer {0} moanne\",\n        \"other\" : \"Oer {0} moannen\"\n      },\n      \"next\" : \"folgjende moanne\",\n      \"previous\" : \"foarige moanne\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"year\" : {\n      \"current\" : \"dit jier\",\n      \"next\" : \"folgjend jier\",\n      \"previous\" : \"foarich jier\",\n      \"past\" : \"{0} jier lyn\",\n      \"future\" : \"Oer {0} jier\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} oere lyn\",\n      \"future\" : \"Oer {0} oere\",\n      \"current\" : \"this hour\"\n    },\n    \"now\" : \"nu\",\n    \"day\" : {\n      \"current\" : \"vandaag\",\n      \"past\" : {\n        \"other\" : \"{0} deien lyn\",\n        \"one\" : \"{0} dei lyn\"\n      },\n      \"previous\" : \"gisteren\",\n      \"next\" : \"morgen\",\n      \"future\" : {\n        \"one\" : \"Oer {0} dei\",\n        \"other\" : \"Oer {0} deien\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : {\n        \"other\" : \"{0} minuten lyn\",\n        \"one\" : \"{0} minút lyn\"\n      },\n      \"future\" : {\n        \"other\" : \"Oer {0} minuten\",\n        \"one\" : \"Oer {0} minút\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"Oer {0} sekonde\",\n        \"other\" : \"Oer {0} sekonden\"\n      },\n      \"current\" : \"nu\",\n      \"past\" : {\n        \"one\" : \"{0} sekonde lyn\",\n        \"other\" : \"{0} sekonden lyn\"\n      }\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"now\" : \"nu\",\n    \"day\" : {\n      \"previous\" : \"gisteren\",\n      \"past\" : {\n        \"one\" : \"{0} dei lyn\",\n        \"other\" : \"{0} deien lyn\"\n      },\n      \"current\" : \"vandaag\",\n      \"next\" : \"morgen\",\n      \"future\" : {\n        \"one\" : \"Oer {0} dei\",\n        \"other\" : \"Oer {0} deien\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"folgjende moanne\",\n      \"previous\" : \"foarige moanne\",\n      \"past\" : {\n        \"other\" : \"{0} moannen lyn\",\n        \"one\" : \"{0} moanne lyn\"\n      },\n      \"future\" : {\n        \"other\" : \"Oer {0} moannen\",\n        \"one\" : \"Oer {0} moanne\"\n      },\n      \"current\" : \"dizze moanne\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"{0} sekonde lyn\",\n        \"other\" : \"{0} sekonden lyn\"\n      },\n      \"future\" : {\n        \"one\" : \"Oer {0} sekonde\",\n        \"other\" : \"Oer {0} sekonden\"\n      },\n      \"current\" : \"nu\"\n    },\n    \"year\" : {\n      \"previous\" : \"foarich jier\",\n      \"next\" : \"folgjend jier\",\n      \"future\" : \"Oer {0} jier\",\n      \"past\" : \"{0} jier lyn\",\n      \"current\" : \"dit jier\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"Oer {0} wike\",\n        \"other\" : \"Oer {0} wiken\"\n      },\n      \"current\" : \"dizze wike\",\n      \"past\" : {\n        \"other\" : \"{0} wiken lyn\",\n        \"one\" : \"{0} wike lyn\"\n      },\n      \"next\" : \"folgjende wike\",\n      \"previous\" : \"foarige wike\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} oere lyn\",\n      \"future\" : \"Oer {0} oere\",\n      \"current\" : \"this hour\"\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"Oer {0} minút\",\n        \"other\" : \"Oer {0} minuten\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} minút lyn\",\n        \"other\" : \"{0} minuten lyn\"\n      },\n      \"current\" : \"this minute\"\n    }\n  },\n  \"short\" : {\n    \"year\" : {\n      \"next\" : \"folgjend jier\",\n      \"future\" : \"Oer {0} jier\",\n      \"current\" : \"dit jier\",\n      \"past\" : \"{0} jier lyn\",\n      \"previous\" : \"foarich jier\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : {\n        \"one\" : \"{0} minút lyn\",\n        \"other\" : \"{0} minuten lyn\"\n      },\n      \"future\" : {\n        \"one\" : \"Oer {0} minút\",\n        \"other\" : \"Oer {0} minuten\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"Oer {0} wiken\",\n        \"one\" : \"Oer {0} wike\"\n      },\n      \"next\" : \"folgjende wike\",\n      \"current\" : \"dizze wike\",\n      \"past\" : {\n        \"one\" : \"{0} wike lyn\",\n        \"other\" : \"{0} wiken lyn\"\n      },\n      \"previous\" : \"foarige wike\"\n    },\n    \"day\" : {\n      \"next\" : \"morgen\",\n      \"current\" : \"vandaag\",\n      \"previous\" : \"gisteren\",\n      \"future\" : {\n        \"one\" : \"Oer {0} dei\",\n        \"other\" : \"Oer {0} deien\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} dei lyn\",\n        \"other\" : \"{0} deien lyn\"\n      }\n    },\n    \"quarter\" : {\n      \"future\" : \"+{0} Q\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"month\" : {\n      \"current\" : \"dizze moanne\",\n      \"past\" : {\n        \"other\" : \"{0} moannen lyn\",\n        \"one\" : \"{0} moanne lyn\"\n      },\n      \"previous\" : \"foarige moanne\",\n      \"next\" : \"folgjende moanne\",\n      \"future\" : {\n        \"other\" : \"Oer {0} moannen\",\n        \"one\" : \"Oer {0} moanne\"\n      }\n    },\n    \"now\" : \"nu\",\n    \"second\" : {\n      \"current\" : \"nu\",\n      \"future\" : {\n        \"other\" : \"Oer {0} sekonden\",\n        \"one\" : \"Oer {0} sekonde\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} sekonde lyn\",\n        \"other\" : \"{0} sekonden lyn\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : \"{0} oere lyn\",\n      \"current\" : \"this hour\",\n      \"future\" : \"Oer {0} oere\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ga.json",
    "content": "{\n  \"long\" : {\n    \"month\" : {\n      \"next\" : \"an mhí seo chugainn\",\n      \"current\" : \"an mhí seo\",\n      \"future\" : {\n        \"one\" : \"i gceann {0} mhí\",\n        \"two\" : \"i gceann {0} mhí\",\n        \"other\" : \"i gceann {0} mí\",\n        \"few\" : \"i gceann {0} mhí\"\n      },\n      \"previous\" : \"an mhí seo caite\",\n      \"past\" : {\n        \"one\" : \"{0} mhí ó shin\",\n        \"other\" : \"{0} mí ó shin\",\n        \"two\" : \"{0} mhí ó shin\",\n        \"few\" : \"{0} mhí ó shin\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"anois\",\n      \"past\" : {\n        \"few\" : \"{0} shoicind ó shin\",\n        \"other\" : \"{0} soicind ó shin\",\n        \"two\" : \"{0} shoicind ó shin\"\n      },\n      \"future\" : {\n        \"other\" : \"i gceann {0} soicind\",\n        \"two\" : \"i gceann {0} shoicind\",\n        \"few\" : \"i gceann {0} shoicind\"\n      }\n    },\n    \"day\" : {\n      \"past\" : \"{0} lá ó shin\",\n      \"future\" : \"i gceann {0} lá\",\n      \"next\" : \"amárach\",\n      \"previous\" : \"inné\",\n      \"current\" : \"inniu\"\n    },\n    \"minute\" : {\n      \"future\" : \"i gceann {0} nóiméad\",\n      \"current\" : \"an nóiméad seo\",\n      \"past\" : \"{0} nóiméad ó shin\"\n    },\n    \"hour\" : {\n      \"current\" : \"an uair seo\",\n      \"past\" : {\n        \"many\" : \"{0} n-uaire an chloig ó shin\",\n        \"few\" : \"{0} huaire an chloig ó shin\",\n        \"other\" : \"{0} uair an chloig ó shin\"\n      },\n      \"future\" : {\n        \"few\" : \"i gceann {0} huaire an chloig\",\n        \"many\" : \"i gceann {0} n-uaire an chloig\",\n        \"other\" : \"i gceann {0} uair an chloig\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"an ráithe seo chugainn\",\n      \"current\" : \"an ráithe seo\",\n      \"future\" : \"i gceann {0} ráithe\",\n      \"past\" : \"{0} ráithe ó shin\",\n      \"previous\" : \"an ráithe seo caite\"\n    },\n    \"now\" : \"anois\",\n    \"year\" : {\n      \"next\" : \"an bhliain seo chugainn\",\n      \"past\" : {\n        \"two\" : \"{0} bhliain ó shin\",\n        \"many\" : \"{0} mbliana ó shin\",\n        \"other\" : \"{0} bliain ó shin\",\n        \"one\" : \"{0} bhliain ó shin\",\n        \"few\" : \"{0} bliana ó shin\"\n      },\n      \"future\" : {\n        \"one\" : \"i gceann {0} bhliain\",\n        \"two\" : \"i gceann {0} bhliain\",\n        \"few\" : \"i gceann {0} bliana\",\n        \"many\" : \"i gceann {0} mbliana\",\n        \"other\" : \"i gceann {0} bliain\"\n      },\n      \"previous\" : \"anuraidh\",\n      \"current\" : \"an bhliain seo\"\n    },\n    \"week\" : {\n      \"previous\" : \"an tseachtain seo caite\",\n      \"next\" : \"an tseachtain seo chugainn\",\n      \"past\" : {\n        \"other\" : \"{0} seachtain ó shin\",\n        \"many\" : \"{0} seachtaine ó shin\",\n        \"few\" : \"{0} seachtaine ó shin\",\n        \"two\" : \"{0} sheachtain ó shin\"\n      },\n      \"current\" : \"an tseachtain seo\",\n      \"future\" : {\n        \"other\" : \"i gceann {0} seachtain\",\n        \"many\" : \"i gceann {0} seachtaine\",\n        \"few\" : \"i gceann {0} seachtaine\",\n        \"two\" : \"i gceann {0} sheachtain\"\n      }\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} nóim. ó shin\",\n      \"future\" : \"i gceann {0} nóim.\",\n      \"current\" : \"an nóiméad seo\"\n    },\n    \"hour\" : {\n      \"current\" : \"an uair seo\",\n      \"future\" : {\n        \"few\" : \"i gceann {0} huaire\",\n        \"many\" : \"i gceann {0} n-uaire\",\n        \"other\" : \"i gceann {0} uair\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} uair ó shin\",\n        \"few\" : \"{0} huaire ó shin\",\n        \"many\" : \"{0} n-uaire ó shin\"\n      }\n    },\n    \"day\" : {\n      \"past\" : \"{0} lá ó shin\",\n      \"previous\" : \"inné\",\n      \"current\" : \"inniu\",\n      \"future\" : \"i gceann {0} lá\",\n      \"next\" : \"amárach\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"few\" : \"i gceann {0} shoic.\",\n        \"two\" : \"i gceann {0} shoic.\",\n        \"other\" : \"i gceann {0} soic.\"\n      },\n      \"past\" : {\n        \"few\" : \"{0} shoic. ó shin\",\n        \"two\" : \"{0} shoic. ó shin\",\n        \"other\" : \"{0} soic. ó shin\"\n      },\n      \"current\" : \"anois\"\n    },\n    \"quarter\" : {\n      \"future\" : \"i gceann {0} ráithe\",\n      \"next\" : \"an ráithe seo chugainn\",\n      \"current\" : \"an ráithe seo\",\n      \"past\" : \"{0} ráithe ó shin\",\n      \"previous\" : \"an ráithe seo caite\"\n    },\n    \"year\" : {\n      \"current\" : \"an bhl. seo\",\n      \"past\" : {\n        \"other\" : \"{0} bl. ó shin\",\n        \"two\" : \"{0} bhl. ó shin\",\n        \"many\" : \"{0} mbl. ó shin\",\n        \"one\" : \"{0} bhl. ó shin\"\n      },\n      \"previous\" : \"anuraidh\",\n      \"next\" : \"an bhl. seo chugainn\",\n      \"future\" : {\n        \"two\" : \"i gceann {0} bhl.\",\n        \"many\" : \"i gceann {0} mbl.\",\n        \"other\" : \"i gceann {0} bl.\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"two\" : \"i gceann {0} shcht.\",\n        \"other\" : \"i gceann {0} scht.\"\n      },\n      \"past\" : \"{0} scht. ó shin\",\n      \"next\" : \"an tscht. seo chugainn\",\n      \"current\" : \"an tscht. seo\",\n      \"previous\" : \"an tscht. seo caite\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"few\" : \"i gceann {0} mhí\",\n        \"other\" : \"i gceann {0} mí\",\n        \"one\" : \"i gceann {0} mhí\",\n        \"two\" : \"i gceann {0} mhí\"\n      },\n      \"past\" : {\n        \"two\" : \"{0} mhí ó shin\",\n        \"one\" : \"{0} mhí ó shin\",\n        \"other\" : \"{0} mí ó shin\",\n        \"few\" : \"{0} mhí ó shin\"\n      },\n      \"current\" : \"an mhí seo\",\n      \"previous\" : \"an mhí seo caite\",\n      \"next\" : \"an mhí seo chugainn\"\n    },\n    \"now\" : \"anois\"\n  },\n  \"narrow\" : {\n    \"now\" : \"anois\",\n    \"day\" : {\n      \"future\" : \"+{0} lá\",\n      \"current\" : \"inniu\",\n      \"next\" : \"amárach\",\n      \"previous\" : \"inné\",\n      \"past\" : \"-{0} lá\"\n    },\n    \"year\" : {\n      \"next\" : \"an bhl. seo chugainn\",\n      \"future\" : {\n        \"two\" : \"+{0} bhl.\",\n        \"many\" : \"+{0} mbl.\",\n        \"one\" : \"+{0} bhl.\",\n        \"other\" : \"+{0} bl.\"\n      },\n      \"past\" : {\n        \"other\" : \"-{0} bl.\",\n        \"two\" : \"-{0} bhl.\",\n        \"one\" : \"-{0} bhl.\",\n        \"many\" : \"-{0} mbl.\"\n      },\n      \"current\" : \"an bhl. seo\",\n      \"previous\" : \"anuraidh\"\n    },\n    \"minute\" : {\n      \"current\" : \"an nóiméad seo\",\n      \"past\" : \"-{0} n\",\n      \"future\" : \"+{0} n\"\n    },\n    \"week\" : {\n      \"previous\" : \"an tscht. seo caite\",\n      \"current\" : \"an tscht. seo\",\n      \"past\" : \"-{0} scht.\",\n      \"future\" : \"+{0} scht.\",\n      \"next\" : \"an tscht. seo chugainn\"\n    },\n    \"hour\" : {\n      \"current\" : \"an uair seo\",\n      \"future\" : \"+{0} u\",\n      \"past\" : \"-{0} u\"\n    },\n    \"second\" : {\n      \"current\" : \"anois\",\n      \"future\" : \"+{0} s\",\n      \"past\" : \"-{0} s\"\n    },\n    \"month\" : {\n      \"next\" : \"an mhí seo chugainn\",\n      \"past\" : {\n        \"one\" : \"-{0} mhí\",\n        \"other\" : \"-{0} mí\",\n        \"few\" : \"-{0} mhí\",\n        \"two\" : \"-{0} mhí\"\n      },\n      \"previous\" : \"an mhí seo caite\",\n      \"future\" : {\n        \"two\" : \"+{0} mhí\",\n        \"one\" : \"+{0} mhí\",\n        \"few\" : \"+{0} mhí\",\n        \"other\" : \"+{0} mí\"\n      },\n      \"current\" : \"an mhí seo\"\n    },\n    \"quarter\" : {\n      \"next\" : \"an ráithe seo chugainn\",\n      \"future\" : \"+{0} R\",\n      \"past\" : \"-{0} R\",\n      \"previous\" : \"an ráithe seo caite\",\n      \"current\" : \"an ráithe seo\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/gd.json",
    "content": "{\n  \"narrow\" : {\n    \"week\" : {\n      \"next\" : \"ath-shn.\",\n      \"previous\" : \"sn. ch.\",\n      \"current\" : \"an t-sn. seo\",\n      \"future\" : \"+{0} sn.\",\n      \"past\" : \"-{0} sn.\"\n    },\n    \"quarter\" : {\n      \"future\" : \"+{0} c.\",\n      \"previous\" : \"c. ch.\",\n      \"current\" : \"an c. seo\",\n      \"next\" : \"ath-ch.\",\n      \"past\" : \"-{0} c.\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} m\",\n      \"current\" : \"sa mhion.\",\n      \"future\" : \"+{0} m\"\n    },\n    \"year\" : {\n      \"previous\" : \"an-uir.\",\n      \"current\" : \"am bl.\",\n      \"past\" : {\n        \"two\" : \"-{0} bhl.\",\n        \"other\" : \"-{0} bl.\",\n        \"one\" : \"-{0} bhl.\"\n      },\n      \"next\" : \"an ath-bhl.\",\n      \"future\" : {\n        \"two\" : \"+{0} bhl.\",\n        \"one\" : \"+{0} bhl.\",\n        \"other\" : \"+{0} bl.\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"+{0} d\",\n      \"past\" : \"-{0} d\",\n      \"current\" : \"an-dràsta\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"two\" : \"+{0} mhì.\",\n        \"other\" : \"+{0} mì.\",\n        \"one\" : \"+{0} mhì.\"\n      },\n      \"current\" : \"am mì. seo\",\n      \"past\" : {\n        \"two\" : \"-{0} mhì.\",\n        \"one\" : \"-{0} mhì.\",\n        \"other\" : \"-{0} mì.\"\n      },\n      \"previous\" : \"mì. ch.\",\n      \"next\" : \"ath-mhì.\"\n    },\n    \"now\" : \"an-dràsta\",\n    \"hour\" : {\n      \"future\" : \"+{0} u.\",\n      \"current\" : \"san uair\",\n      \"past\" : \"-{0} u.\"\n    },\n    \"day\" : {\n      \"current\" : \"an-diugh\",\n      \"previous\" : \"an-dè\",\n      \"next\" : \"a-màireach\",\n      \"past\" : \"-{0} là\",\n      \"future\" : \"+{0} là\"\n    }\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : {\n        \"few\" : \"an ceann {0} uairean a thìde\",\n        \"other\" : \"an ceann {0} uair a thìde\"\n      },\n      \"current\" : \"am broinn uair a thìde\",\n      \"past\" : {\n        \"other\" : \"{0} uair a thìde air ais\",\n        \"few\" : \"{0} uairean a thìde air ais\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"an-uiridh\",\n      \"current\" : \"am bliadhna\",\n      \"next\" : \"an ath-bhliadhna\",\n      \"past\" : {\n        \"few\" : \"{0} bhliadhnaichean air ais\",\n        \"two\" : \"{0} bhliadhna air ais\",\n        \"other\" : \"{0} bliadhna air ais\",\n        \"one\" : \"{0} bhliadhna air ais\"\n      },\n      \"future\" : {\n        \"one\" : \"an ceann {0} bhliadhna\",\n        \"few\" : \"an ceann {0} bliadhnaichean\",\n        \"other\" : \"an ceann {0} bliadhna\",\n        \"two\" : \"an ceann {0} bhliadhna\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"an-dè\",\n      \"current\" : \"an-diugh\",\n      \"next\" : \"a-màireach\",\n      \"future\" : {\n        \"other\" : \"an ceann {0} latha\",\n        \"few\" : \"an ceann {0} làithean\"\n      },\n      \"past\" : {\n        \"few\" : \"{0} làithean air ais\",\n        \"other\" : \"{0} latha air ais\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"an ceann {0} mhionaid\",\n        \"two\" : \"an ceann {0} mhionaid\",\n        \"other\" : \"an ceann {0} mionaid\",\n        \"few\" : \"an ceann {0} mionaidean\"\n      },\n      \"current\" : \"am broinn mionaid\",\n      \"past\" : {\n        \"two\" : \"{0} mhionaid air ais\",\n        \"one\" : \"{0} mhionaid air ais\",\n        \"few\" : \"{0} mionaidean air ais\",\n        \"other\" : \"{0} mionaid air ais\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"few\" : \"an ceann {0} diogan\",\n        \"other\" : \"an ceann {0} diog\",\n        \"two\" : \"an ceann {0} dhiog\"\n      },\n      \"current\" : \"an-dràsta\",\n      \"past\" : {\n        \"two\" : \"{0} dhiog air ais\",\n        \"few\" : \"{0} diogan air ais\",\n        \"other\" : \"{0} diog air ais\"\n      }\n    },\n    \"now\" : \"an-dràsta\",\n    \"week\" : {\n      \"previous\" : \"an t-seachdain seo chaidh\",\n      \"next\" : \"an ath-sheachdain\",\n      \"future\" : {\n        \"two\" : \"an ceann {0} sheachdain\",\n        \"few\" : \"an ceann {0} seachdainean\",\n        \"other\" : \"an ceann {0} seachdain\"\n      },\n      \"current\" : \"an t-seachdain seo\",\n      \"past\" : {\n        \"few\" : \"{0} seachdainean air ais\",\n        \"two\" : \"{0} sheachdain air ais\",\n        \"other\" : \"{0} seachdain air ais\"\n      }\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"two\" : \"o chionn {0} chairteil\",\n        \"few\" : \"o chionn {0} cairtealan\",\n        \"other\" : \"o chionn {0} cairteil\",\n        \"one\" : \"o chionn {0} chairteil\"\n      },\n      \"future\" : {\n        \"other\" : \"an ceann {0} cairteil\",\n        \"two\" : \"an ceann {0} chairteil\",\n        \"few\" : \"an ceann {0} cairtealan\",\n        \"one\" : \"an ceann {0} chairteil\"\n      },\n      \"previous\" : \"an cairteal seo chaidh\",\n      \"current\" : \"an cairteal seo\",\n      \"next\" : \"an ath-chairteal\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"two\" : \"{0} mhìos air ais\",\n        \"few\" : \"{0} mìosan air ais\",\n        \"one\" : \"{0} mhìos air ais\",\n        \"other\" : \"{0} mìos air ais\"\n      },\n      \"previous\" : \"am mìos seo chaidh\",\n      \"future\" : {\n        \"one\" : \"an ceann {0} mhìosa\",\n        \"other\" : \"an ceann {0} mìosa\",\n        \"two\" : \"an ceann {0} mhìosa\",\n        \"few\" : \"an ceann {0} mìosan\"\n      },\n      \"current\" : \"am mìos seo\",\n      \"next\" : \"an ath-mhìos\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : {\n        \"few\" : \"an {0} uair.\",\n        \"other\" : \"an {0} uair\"\n      },\n      \"past\" : {\n        \"other\" : \"o {0} uair\",\n        \"few\" : \"o {0} uair.\"\n      },\n      \"current\" : \"am broinn uair\"\n    },\n    \"quarter\" : {\n      \"current\" : \"an cairt. seo\",\n      \"future\" : {\n        \"one\" : \"an {0} chairt.\",\n        \"other\" : \"an {0} cairt.\",\n        \"two\" : \"an {0} chairt.\"\n      },\n      \"previous\" : \"an cairt. sa chaidh\",\n      \"next\" : \"an ath-chairt.\",\n      \"past\" : {\n        \"other\" : \"o {0} cairt.\",\n        \"one\" : \"o {0} chairt.\",\n        \"two\" : \"o {0} chairt.\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"an ath-sheachd.\",\n      \"current\" : \"an t-seachd. seo\",\n      \"previous\" : \"seachd. sa chaidh\",\n      \"past\" : {\n        \"two\" : \"o {0} sheachd.\",\n        \"other\" : \"o {0} seachd.\",\n        \"one\" : \"o {0} sheachd.\"\n      },\n      \"future\" : {\n        \"two\" : \"an {0} sheachd.\",\n        \"one\" : \"an {0} sheachd.\",\n        \"other\" : \"an {0} seachd.\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"am bliadhna\",\n      \"future\" : {\n        \"one\" : \"an {0} bhlia.\",\n        \"two\" : \"an {0} bhlia.\",\n        \"other\" : \"an {0} blia.\"\n      },\n      \"past\" : {\n        \"two\" : \"o {0} bhlia.\",\n        \"other\" : \"o {0} blia.\",\n        \"one\" : \"o {0} bhlia.\"\n      },\n      \"next\" : \"an ath-bhliadhna\",\n      \"previous\" : \"an-uiridh\"\n    },\n    \"minute\" : {\n      \"current\" : \"am broinn mion.\",\n      \"future\" : {\n        \"two\" : \"an {0} mhion.\",\n        \"one\" : \"an {0} mhion.\",\n        \"other\" : \"an {0} mion.\"\n      },\n      \"past\" : {\n        \"one\" : \"o {0} mhion.\",\n        \"two\" : \"o {0} mhion.\",\n        \"other\" : \"o {0} mion.\"\n      }\n    },\n    \"now\" : \"an-dràsta\",\n    \"month\" : {\n      \"current\" : \"am mìos seo\",\n      \"past\" : {\n        \"two\" : \"o {0} mhìos.\",\n        \"one\" : \"o {0} mhìos.\",\n        \"other\" : \"o {0} mìos.\"\n      },\n      \"future\" : {\n        \"two\" : \"an {0} mhìos.\",\n        \"one\" : \"an {0} mhìos.\",\n        \"other\" : \"an {0} mìos.\"\n      },\n      \"next\" : \"an ath-mhìos\",\n      \"previous\" : \"am mìos sa chaidh\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"an {0} là\",\n        \"few\" : \"an {0} là.\"\n      },\n      \"current\" : \"an-diugh\",\n      \"next\" : \"a-màireach\",\n      \"previous\" : \"an-dè\",\n      \"past\" : {\n        \"few\" : \"o {0} là.\",\n        \"other\" : \"o {0} là\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"o {0} diog\",\n        \"two\" : \"o {0} dhiog\",\n        \"few\" : \"o {0} diog.\"\n      },\n      \"future\" : {\n        \"few\" : \"an {0} diog.\",\n        \"two\" : \"an {0} dhiog\",\n        \"other\" : \"an {0} diog\"\n      },\n      \"current\" : \"an-dràsta\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/gl.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : \"en {0} s\",\n      \"current\" : \"agora\",\n      \"past\" : \"hai {0} s\"\n    },\n    \"year\" : {\n      \"next\" : \"seguinte ano\",\n      \"past\" : \"hai {0} a.\",\n      \"future\" : \"en {0} a.\",\n      \"previous\" : \"ano pasado\",\n      \"current\" : \"este ano\"\n    },\n    \"month\" : {\n      \"past\" : \"hai {0} m.\",\n      \"next\" : \"m. seguinte\",\n      \"future\" : \"en {0} m.\",\n      \"previous\" : \"m. pasado\",\n      \"current\" : \"este m.\"\n    },\n    \"minute\" : {\n      \"past\" : \"hai {0} min\",\n      \"current\" : \"este minuto\",\n      \"future\" : \"en {0} min\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"trim. pasado\",\n      \"current\" : \"este trim.\",\n      \"next\" : \"trim. seguinte\",\n      \"past\" : \"hai {0} trim.\",\n      \"future\" : \"en {0} trim.\"\n    },\n    \"hour\" : {\n      \"future\" : \"en {0} h\",\n      \"past\" : \"hai {0} h\",\n      \"current\" : \"esta hora\"\n    },\n    \"now\" : \"agora\",\n    \"week\" : {\n      \"next\" : \"sem. seguinte\",\n      \"previous\" : \"sem. pasada\",\n      \"past\" : \"hai {0} sem.\",\n      \"future\" : \"en {0} sem.\",\n      \"current\" : \"esta sem.\"\n    },\n    \"day\" : {\n      \"previous\" : \"onte\",\n      \"future\" : \"en {0} d.\",\n      \"past\" : \"hai {0} d.\",\n      \"current\" : \"hoxe\",\n      \"next\" : \"mañá\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"dentro de {0} min\",\n      \"past\" : \"hai {0} min\",\n      \"current\" : \"este minuto\"\n    },\n    \"month\" : {\n      \"current\" : \"este m.\",\n      \"past\" : {\n        \"one\" : \"hai {0} mes\",\n        \"other\" : \"hai {0} mes.\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} mes\",\n        \"other\" : \"dentro de {0} mes.\"\n      },\n      \"next\" : \"m. seguinte\",\n      \"previous\" : \"m. pasado\"\n    },\n    \"week\" : {\n      \"future\" : \"dentro de {0} sem.\",\n      \"previous\" : \"sem. pasada\",\n      \"current\" : \"esta sem.\",\n      \"next\" : \"sem. seguinte\",\n      \"past\" : \"hai {0} sem.\"\n    },\n    \"hour\" : {\n      \"future\" : \"dentro de {0} h\",\n      \"current\" : \"esta hora\",\n      \"past\" : \"hai {0} h\"\n    },\n    \"day\" : {\n      \"next\" : \"mañá\",\n      \"current\" : \"hoxe\",\n      \"previous\" : \"onte\",\n      \"past\" : {\n        \"one\" : \"hai {0} día\",\n        \"other\" : \"hai {0} días\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} día\",\n        \"other\" : \"dentro de {0} días\"\n      }\n    },\n    \"second\" : {\n      \"past\" : \"hai {0} s\",\n      \"current\" : \"agora\",\n      \"future\" : \"dentro de {0} s\"\n    },\n    \"now\" : \"agora\",\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"dentro de {0} ano\",\n        \"other\" : \"dentro de {0} anos\"\n      },\n      \"previous\" : \"ano pasado\",\n      \"next\" : \"seguinte ano\",\n      \"current\" : \"este ano\",\n      \"past\" : {\n        \"other\" : \"hai {0} anos\",\n        \"one\" : \"hai {0} ano\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"este trim.\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"previous\" : \"trim. pasado\",\n      \"next\" : \"trim. seguinte\",\n      \"past\" : \"hai {0} trim.\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"onte\",\n      \"past\" : {\n        \"other\" : \"hai {0} días\",\n        \"one\" : \"hai {0} día\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} días\",\n        \"one\" : \"dentro de {0} día\"\n      },\n      \"next\" : \"mañá\",\n      \"current\" : \"hoxe\"\n    },\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} hora\",\n        \"other\" : \"dentro de {0} horas\"\n      },\n      \"past\" : {\n        \"one\" : \"hai {0} hora\",\n        \"other\" : \"hai {0} horas\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"o próximo mes\",\n      \"current\" : \"este mes\",\n      \"past\" : {\n        \"other\" : \"hai {0} meses\",\n        \"one\" : \"hai {0} mes\"\n      },\n      \"previous\" : \"o mes pasado\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} mes\",\n        \"other\" : \"dentro de {0} meses\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"o próximo trimestre\",\n      \"past\" : {\n        \"one\" : \"hai {0} trimestre\",\n        \"other\" : \"hai {0} trimestres\"\n      },\n      \"previous\" : \"o trimestre pasado\",\n      \"current\" : \"este trimestre\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} trimestre\",\n        \"other\" : \"dentro de {0} trimestres\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"o próximo ano\",\n      \"current\" : \"este ano\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} ano\",\n        \"other\" : \"dentro de {0} anos\"\n      },\n      \"previous\" : \"o ano pasado\",\n      \"past\" : {\n        \"one\" : \"hai {0} ano\",\n        \"other\" : \"hai {0} anos\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"hai {0} minuto\",\n        \"other\" : \"hai {0} minutos\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} minutos\",\n        \"one\" : \"dentro de {0} minuto\"\n      },\n      \"current\" : \"este minuto\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} segundos\",\n        \"one\" : \"dentro de {0} segundo\"\n      },\n      \"current\" : \"agora\",\n      \"past\" : {\n        \"one\" : \"hai {0} segundo\",\n        \"other\" : \"hai {0} segundos\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"dentro de {0} semanas\",\n        \"one\" : \"dentro de {0} semana\"\n      },\n      \"previous\" : \"a semana pasada\",\n      \"current\" : \"esta semana\",\n      \"next\" : \"a próxima semana\",\n      \"past\" : {\n        \"other\" : \"hai {0} semanas\",\n        \"one\" : \"hai {0} semana\"\n      }\n    },\n    \"now\" : \"agora\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/gu.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"આવતીકાલે\",\n      \"future\" : \"{0} દિવસમાં\",\n      \"previous\" : \"ગઈકાલે\",\n      \"current\" : \"આજે\",\n      \"past\" : \"{0} દિવસ પહેલાં\"\n    },\n    \"quarter\" : {\n      \"next\" : \"પછીનું ત્રિમાસિક\",\n      \"past\" : \"{0} ત્રિમાસિક પહેલાં\",\n      \"future\" : \"{0} ત્રિમાસિકમાં\",\n      \"previous\" : \"છેલ્લું ત્રિમાસિક\",\n      \"current\" : \"આ ત્રિમાસિક\"\n    },\n    \"hour\" : {\n      \"current\" : \"આ કલાક\",\n      \"past\" : \"{0} કલાક પહેલાં\",\n      \"future\" : \"{0} કલાકમાં\"\n    },\n    \"year\" : {\n      \"next\" : \"આવતા વર્ષે\",\n      \"past\" : \"{0} વર્ષ પહેલાં\",\n      \"current\" : \"આ વર્ષે\",\n      \"previous\" : \"ગયા વર્ષે\",\n      \"future\" : \"{0} વર્ષમાં\"\n    },\n    \"now\" : \"હમણાં\",\n    \"month\" : {\n      \"current\" : \"આ મહિને\",\n      \"future\" : \"{0} મહિનામાં\",\n      \"past\" : \"{0} મહિના પહેલાં\",\n      \"next\" : \"આવતા મહિને\",\n      \"previous\" : \"ગયા મહિને\"\n    },\n    \"week\" : {\n      \"previous\" : \"ગયા અઠવાડિયે\",\n      \"current\" : \"આ અઠવાડિયે\",\n      \"past\" : \"{0} અઠ. પહેલાં\",\n      \"future\" : \"{0} અઠ. માં\",\n      \"next\" : \"આવતા અઠવાડિયે\"\n    },\n    \"minute\" : {\n      \"current\" : \"આ મિનિટ\",\n      \"past\" : \"{0} મિનિટ પહેલાં\",\n      \"future\" : \"{0} મિનિટમાં\"\n    },\n    \"second\" : {\n      \"current\" : \"હમણાં\",\n      \"past\" : \"{0} સેકંડ પહેલાં\",\n      \"future\" : \"{0} સેકંડમાં\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"ગઈકાલે\",\n      \"current\" : \"આજે\",\n      \"next\" : \"આવતીકાલે\",\n      \"past\" : \"{0} દિવસ પહેલાં\",\n      \"future\" : \"{0} દિવસમાં\"\n    },\n    \"week\" : {\n      \"current\" : \"આ અઠવાડિયે\",\n      \"future\" : \"{0} અઠવાડિયામાં\",\n      \"past\" : \"{0} અઠવાડિયા પહેલાં\",\n      \"previous\" : \"ગયા અઠવાડિયે\",\n      \"next\" : \"આવતા અઠવાડિયે\"\n    },\n    \"minute\" : {\n      \"current\" : \"આ મિનિટ\",\n      \"past\" : \"{0} મિનિટ પહેલાં\",\n      \"future\" : \"{0} મિનિટમાં\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} મહિનામાં\",\n      \"next\" : \"આવતા મહિને\",\n      \"previous\" : \"ગયા મહિને\",\n      \"current\" : \"આ મહિને\",\n      \"past\" : \"{0} મહિના પહેલાં\"\n    },\n    \"hour\" : {\n      \"current\" : \"આ કલાક\",\n      \"past\" : \"{0} કલાક પહેલાં\",\n      \"future\" : \"{0} કલાકમાં\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} વર્ષ પહેલાં\",\n      \"future\" : \"{0} વર્ષમાં\",\n      \"previous\" : \"ગયા વર્ષે\",\n      \"next\" : \"આવતા વર્ષે\",\n      \"current\" : \"આ વર્ષે\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} સેકંડ પહેલાં\",\n      \"future\" : \"{0} સેકંડમાં\",\n      \"current\" : \"હમણાં\"\n    },\n    \"now\" : \"હમણાં\",\n    \"quarter\" : {\n      \"past\" : \"{0} ત્રિમાસિક પહેલાં\",\n      \"current\" : \"આ ત્રિમાસિક\",\n      \"previous\" : \"છેલ્લું ત્રિમાસિક\",\n      \"future\" : \"{0} ત્રિમાસિકમાં\",\n      \"next\" : \"પછીનું ત્રિમાસિક\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} ત્રિમાસિકમાં\",\n      \"next\" : \"પછીનું ત્રિમાસિક\",\n      \"previous\" : \"છેલ્લું ત્રિમાસિક\",\n      \"current\" : \"આ ત્રિમાસિક\",\n      \"past\" : \"{0} ત્રિમાસિક પહેલાં\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} મિનિટ પહેલાં\",\n      \"future\" : \"{0} મિનિટમાં\",\n      \"current\" : \"આ મિનિટ\"\n    },\n    \"year\" : {\n      \"next\" : \"આવતા વર્ષે\",\n      \"future\" : \"{0} વર્ષમાં\",\n      \"current\" : \"આ વર્ષે\",\n      \"past\" : \"{0} વર્ષ પહેલાં\",\n      \"previous\" : \"ગયા વર્ષે\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} સેકંડ પહેલાં\",\n      \"current\" : \"હમણાં\",\n      \"future\" : \"{0} સેકંડમાં\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} કલાક પહેલાં\",\n      \"current\" : \"આ કલાક\",\n      \"future\" : \"{0} કલાકમાં\"\n    },\n    \"now\" : \"હમણાં\",\n    \"month\" : {\n      \"previous\" : \"ગયા મહિને\",\n      \"next\" : \"આવતા મહિને\",\n      \"past\" : \"{0} મહિના પહેલાં\",\n      \"current\" : \"આ મહિને\",\n      \"future\" : \"{0} મહિનામાં\"\n    },\n    \"week\" : {\n      \"previous\" : \"ગયા અઠવાડિયે\",\n      \"current\" : \"આ અઠવાડિયે\",\n      \"next\" : \"આવતા અઠવાડિયે\",\n      \"past\" : \"{0} અઠ. પહેલાં\",\n      \"future\" : \"{0} અઠ. માં\"\n    },\n    \"day\" : {\n      \"next\" : \"આવતીકાલે\",\n      \"past\" : \"{0} દિવસ પહેલાં\",\n      \"future\" : \"{0} દિવસમાં\",\n      \"previous\" : \"ગઈકાલે\",\n      \"current\" : \"આજે\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/he.json",
    "content": "{\n  \"long\" : {\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"לפני שנייה\",\n        \"two\" : \"לפני שתי שניות\",\n        \"other\" : \"לפני {0} שניות\"\n      },\n      \"current\" : \"עכשיו\",\n      \"future\" : {\n        \"two\" : \"בעוד שתי שניות\",\n        \"other\" : \"בעוד {0} שניות\",\n        \"one\" : \"בעוד שנייה\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"בשעה זו\",\n      \"past\" : {\n        \"one\" : \"לפני שעה\",\n        \"two\" : \"לפני שעתיים\",\n        \"other\" : \"לפני {0} שעות\"\n      },\n      \"future\" : {\n        \"one\" : \"בעוד שעה\",\n        \"two\" : \"בעוד שעתיים\",\n        \"other\" : \"בעוד {0} שעות\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"הרבעון הבא\",\n      \"current\" : \"רבעון זה\",\n      \"future\" : {\n        \"one\" : \"ברבעון הבא\",\n        \"two\" : \"בעוד שני רבעונים\",\n        \"other\" : \"בעוד {0} רבעונים\"\n      },\n      \"previous\" : \"הרבעון הקודם\",\n      \"past\" : {\n        \"one\" : \"ברבעון הקודם\",\n        \"two\" : \"לפני שני רבעונים\",\n        \"other\" : \"לפני {0} רבעונים\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"בעוד שנה\",\n        \"many\" : \"בעוד {0} שנה\",\n        \"other\" : \"בעוד {0} שנים\",\n        \"two\" : \"בעוד שנתיים\"\n      },\n      \"next\" : \"השנה הבאה\",\n      \"past\" : {\n        \"other\" : \"לפני {0} שנים\",\n        \"two\" : \"לפני שנתיים\",\n        \"many\" : \"לפני {0} שנה\",\n        \"one\" : \"לפני שנה\"\n      },\n      \"previous\" : \"השנה שעברה\",\n      \"current\" : \"השנה\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"בעוד {0} ימים\",\n        \"two\" : \"בעוד יומיים\",\n        \"one\" : \"בעוד יום {0}\"\n      },\n      \"previous\" : \"אתמול\",\n      \"current\" : \"היום\",\n      \"next\" : \"מחר\",\n      \"past\" : {\n        \"other\" : \"לפני {0} ימים\",\n        \"one\" : \"לפני יום {0}\",\n        \"two\" : \"לפני יומיים\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"other\" : \"בעוד {0} דקות\",\n        \"two\" : \"בעוד שתי דקות\",\n        \"one\" : \"בעוד דקה\"\n      },\n      \"past\" : {\n        \"two\" : \"לפני שתי דקות\",\n        \"one\" : \"לפני דקה\",\n        \"other\" : \"לפני {0} דקות\"\n      },\n      \"current\" : \"בדקה זו\"\n    },\n    \"month\" : {\n      \"next\" : \"החודש הבא\",\n      \"past\" : {\n        \"two\" : \"לפני חודשיים\",\n        \"other\" : \"לפני {0} חודשים\",\n        \"one\" : \"לפני חודש\"\n      },\n      \"previous\" : \"החודש שעבר\",\n      \"current\" : \"החודש\",\n      \"future\" : {\n        \"two\" : \"בעוד חודשיים\",\n        \"one\" : \"בעוד חודש\",\n        \"other\" : \"בעוד {0} חודשים\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"השבוע הבא\",\n      \"current\" : \"השבוע\",\n      \"past\" : {\n        \"two\" : \"לפני שבועיים\",\n        \"one\" : \"לפני שבוע\",\n        \"other\" : \"לפני {0} שבועות\"\n      },\n      \"previous\" : \"השבוע שעבר\",\n      \"future\" : {\n        \"two\" : \"בעוד שבועיים\",\n        \"other\" : \"בעוד {0} שבועות\",\n        \"one\" : \"בעוד שבוע\"\n      }\n    },\n    \"now\" : \"עכשיו\"\n  },\n  \"short\" : {\n    \"week\" : {\n      \"previous\" : \"השבוע שעבר\",\n      \"next\" : \"השבוע הבא\",\n      \"current\" : \"השבוע\",\n      \"past\" : {\n        \"other\" : \"לפני {0} שב׳\",\n        \"two\" : \"לפני שבועיים\",\n        \"one\" : \"לפני שב׳\"\n      },\n      \"future\" : {\n        \"other\" : \"בעוד {0} שב׳\",\n        \"one\" : \"בעוד שב׳\",\n        \"two\" : \"בעוד שבועיים\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"החודש הבא\",\n      \"current\" : \"החודש\",\n      \"previous\" : \"החודש שעבר\",\n      \"future\" : {\n        \"two\" : \"בעוד חודשיים\",\n        \"one\" : \"בעוד חודש\",\n        \"other\" : \"בעוד {0} חודשים\"\n      },\n      \"past\" : {\n        \"two\" : \"לפני חודשיים\",\n        \"one\" : \"לפני חודש\",\n        \"other\" : \"לפני {0} חודשים\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"בדקה זו\",\n      \"past\" : {\n        \"other\" : \"לפני {0} דק׳\",\n        \"one\" : \"לפני דקה\"\n      },\n      \"future\" : {\n        \"two\" : \"בעוד שתי דק׳\",\n        \"other\" : \"בעוד {0} דק׳\",\n        \"one\" : \"בעוד דקה\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"two\" : \"לפני שתי שנ׳\",\n        \"one\" : \"לפני שנ׳\",\n        \"other\" : \"לפני {0} שנ׳\"\n      },\n      \"future\" : {\n        \"one\" : \"בעוד שנ׳\",\n        \"two\" : \"בעוד שתי שנ׳\",\n        \"other\" : \"בעוד {0} שנ׳\"\n      },\n      \"current\" : \"עכשיו\"\n    },\n    \"now\" : \"עכשיו\",\n    \"day\" : {\n      \"next\" : \"מחר\",\n      \"previous\" : \"אתמול\",\n      \"current\" : \"היום\",\n      \"past\" : {\n        \"other\" : \"לפני {0} ימים\",\n        \"one\" : \"אתמול\",\n        \"two\" : \"לפני יומיים\"\n      },\n      \"future\" : {\n        \"one\" : \"מחר\",\n        \"two\" : \"בעוד יומיים\",\n        \"other\" : \"בעוד {0} ימים\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"השנה\",\n      \"past\" : {\n        \"two\" : \"לפני שנתיים\",\n        \"other\" : \"לפני {0} שנים\",\n        \"one\" : \"לפני שנה\",\n        \"many\" : \"לפני {0} שנה\"\n      },\n      \"previous\" : \"השנה שעברה\",\n      \"next\" : \"השנה הבאה\",\n      \"future\" : {\n        \"many\" : \"בעוד {0} שנה\",\n        \"one\" : \"בעוד שנה\",\n        \"two\" : \"בעוד שנתיים\",\n        \"other\" : \"בעוד {0} שנים\"\n      }\n    },\n    \"quarter\" : {\n      \"future\" : {\n        \"one\" : \"ברבע׳ הבא\",\n        \"two\" : \"בעוד שני רבע׳\",\n        \"other\" : \"בעוד {0} רבע׳\"\n      },\n      \"next\" : \"הרבעון הבא\",\n      \"current\" : \"רבעון זה\",\n      \"past\" : {\n        \"one\" : \"ברבע׳ הקודם\",\n        \"two\" : \"לפני שני רבע׳\",\n        \"other\" : \"לפני {0} רבע׳\"\n      },\n      \"previous\" : \"הרבעון הקודם\"\n    },\n    \"hour\" : {\n      \"current\" : \"בשעה זו\",\n      \"past\" : {\n        \"other\" : \"לפני {0} שע׳\",\n        \"two\" : \"לפני שעתיים\",\n        \"one\" : \"לפני שעה\"\n      },\n      \"future\" : {\n        \"other\" : \"בעוד {0} שע׳\",\n        \"one\" : \"בעוד שעה\",\n        \"two\" : \"בעוד שעתיים\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"year\" : {\n      \"current\" : \"השנה\",\n      \"past\" : {\n        \"one\" : \"לפני שנה\",\n        \"two\" : \"לפני שנתיים\",\n        \"other\" : \"לפני {0} שנים\",\n        \"many\" : \"לפני {0} שנה\"\n      },\n      \"future\" : {\n        \"one\" : \"בעוד שנה\",\n        \"two\" : \"בעוד שנתיים\",\n        \"many\" : \"בעוד {0} שנה\",\n        \"other\" : \"בעוד {0} שנים\"\n      },\n      \"next\" : \"השנה הבאה\",\n      \"previous\" : \"השנה שעברה\"\n    },\n    \"minute\" : {\n      \"current\" : \"בדקה זו\",\n      \"future\" : {\n        \"other\" : \"בעוד {0} דק׳\",\n        \"two\" : \"בעוד שתי דק׳\",\n        \"one\" : \"בעוד דקה\"\n      },\n      \"past\" : {\n        \"two\" : \"לפני שתי דק׳\",\n        \"other\" : \"לפני {0} דק׳\",\n        \"one\" : \"לפני דקה\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"אתמול\",\n      \"current\" : \"היום\",\n      \"next\" : \"מחר\",\n      \"past\" : {\n        \"two\" : \"לפני יומיים\",\n        \"other\" : \"לפני {0} ימים\",\n        \"one\" : \"אתמול\"\n      },\n      \"future\" : {\n        \"two\" : \"בעוד יומיים\",\n        \"one\" : \"מחר\",\n        \"other\" : \"בעוד {0} ימים\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"two\" : \"בעוד שתי שנ׳\",\n        \"one\" : \"בעוד שנ׳\",\n        \"other\" : \"בעוד {0} שנ׳\"\n      },\n      \"past\" : {\n        \"one\" : \"לפני שנ׳\",\n        \"two\" : \"לפני שתי שנ׳\",\n        \"other\" : \"לפני {0} שנ׳\"\n      },\n      \"current\" : \"עכשיו\"\n    },\n    \"now\" : \"עכשיו\",\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"בעוד חו׳\",\n        \"other\" : \"בעוד {0} חו׳\",\n        \"two\" : \"בעוד חודשיים\"\n      },\n      \"current\" : \"החודש\",\n      \"next\" : \"החודש הבא\",\n      \"previous\" : \"החודש שעבר\",\n      \"past\" : {\n        \"other\" : \"לפני {0} חו׳\",\n        \"one\" : \"לפני חו׳\",\n        \"two\" : \"לפני חודשיים\"\n      }\n    },\n    \"week\" : {\n      \"past\" : {\n        \"two\" : \"לפני שבועיים\",\n        \"one\" : \"לפני שבוע\",\n        \"other\" : \"לפני {0} שב׳\"\n      },\n      \"previous\" : \"השבוע שעבר\",\n      \"future\" : {\n        \"two\" : \"בעוד שבועיים\",\n        \"one\" : \"בעוד שב׳\",\n        \"other\" : \"בעוד {0} שב׳\"\n      },\n      \"next\" : \"השבוע הבא\",\n      \"current\" : \"השבוע\"\n    },\n    \"quarter\" : {\n      \"next\" : \"הרבעון הבא\",\n      \"current\" : \"רבעון זה\",\n      \"previous\" : \"הרבעון הקודם\",\n      \"past\" : {\n        \"two\" : \"לפני שני רבע׳\",\n        \"other\" : \"לפני {0} רבע׳\",\n        \"one\" : \"ברבע׳ הקודם\"\n      },\n      \"future\" : {\n        \"one\" : \"ברבע׳ הבא\",\n        \"two\" : \"בעוד שני רבע׳\",\n        \"other\" : \"בעוד {0} רבע׳\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"לפני שעה\",\n        \"two\" : \"לפני שעתיים\",\n        \"other\" : \"לפני {0} שע׳\"\n      },\n      \"future\" : {\n        \"one\" : \"בעוד שעה\",\n        \"other\" : \"בעוד {0} שע׳\",\n        \"two\" : \"בעוד שעתיים\"\n      },\n      \"current\" : \"בשעה זו\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/hi.json",
    "content": "{\n  \"long\" : {\n    \"year\" : {\n      \"future\" : \"{0} वर्ष में\",\n      \"past\" : \"{0} वर्ष पहले\",\n      \"next\" : \"अगला वर्ष\",\n      \"previous\" : \"पिछला वर्ष\",\n      \"current\" : \"इस वर्ष\"\n    },\n    \"week\" : {\n      \"current\" : \"इस सप्ताह\",\n      \"next\" : \"अगला सप्ताह\",\n      \"future\" : \"{0} सप्ताह में\",\n      \"previous\" : \"पिछला सप्ताह\",\n      \"past\" : \"{0} सप्ताह पहले\"\n    },\n    \"quarter\" : {\n      \"next\" : \"अगली तिमाही\",\n      \"past\" : \"{0} तिमाही पहले\",\n      \"current\" : \"इस तिमाही\",\n      \"future\" : {\n        \"other\" : \"{0} तिमाहियों में\",\n        \"one\" : \"{0} तिमाही में\"\n      },\n      \"previous\" : \"अंतिम तिमाही\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} मिनट में\",\n      \"past\" : \"{0} मिनट पहले\",\n      \"current\" : \"यह मिनट\"\n    },\n    \"month\" : {\n      \"current\" : \"इस माह\",\n      \"next\" : \"अगला माह\",\n      \"previous\" : \"पिछला माह\",\n      \"future\" : \"{0} माह में\",\n      \"past\" : \"{0} माह पहले\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} सेकंड में\",\n      \"current\" : \"अब\",\n      \"past\" : \"{0} सेकंड पहले\"\n    },\n    \"day\" : {\n      \"next\" : \"कल\",\n      \"past\" : \"{0} दिन पहले\",\n      \"previous\" : \"कल\",\n      \"current\" : \"आज\",\n      \"future\" : \"{0} दिन में\"\n    },\n    \"now\" : \"अब\",\n    \"hour\" : {\n      \"future\" : \"{0} घंटे में\",\n      \"current\" : \"यह घंटा\",\n      \"past\" : \"{0} घंटे पहले\"\n    }\n  },\n  \"narrow\" : {\n    \"now\" : \"अब\",\n    \"minute\" : {\n      \"future\" : \"{0} मि॰ में\",\n      \"current\" : \"यह मिनट\",\n      \"past\" : \"{0} मि॰ पहले\"\n    },\n    \"year\" : {\n      \"previous\" : \"पिछला वर्ष\",\n      \"current\" : \"इस वर्ष\",\n      \"next\" : \"अगला वर्ष\",\n      \"past\" : \"{0} वर्ष पहले\",\n      \"future\" : \"{0} वर्ष में\"\n    },\n    \"second\" : {\n      \"current\" : \"अब\",\n      \"future\" : \"{0} से॰ में\",\n      \"past\" : \"{0} से॰ पहले\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} घं॰ पहले\",\n      \"future\" : \"{0} घं॰ में\",\n      \"current\" : \"यह घंटा\"\n    },\n    \"month\" : {\n      \"current\" : \"इस माह\",\n      \"previous\" : \"पिछला माह\",\n      \"past\" : \"{0} माह पहले\",\n      \"next\" : \"अगला माह\",\n      \"future\" : \"{0} माह में\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"अंतिम तिमाही\",\n      \"current\" : \"इस तिमाही\",\n      \"past\" : \"{0} ति॰ पहले\",\n      \"future\" : \"{0} ति॰ में\",\n      \"next\" : \"अगली तिमाही\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} सप्ताह में\",\n      \"current\" : \"इस सप्ताह\",\n      \"past\" : \"{0} सप्ताह पहले\",\n      \"previous\" : \"पिछला सप्ताह\",\n      \"next\" : \"अगला सप्ताह\"\n    },\n    \"day\" : {\n      \"current\" : \"आज\",\n      \"future\" : \"{0} दिन में\",\n      \"next\" : \"कल\",\n      \"past\" : \"{0} दिन पहले\",\n      \"previous\" : \"कल\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"future\" : \"{0} माह में\",\n      \"previous\" : \"पिछला माह\",\n      \"next\" : \"अगला माह\",\n      \"past\" : \"{0} माह पहले\",\n      \"current\" : \"इस माह\"\n    },\n    \"now\" : \"अब\",\n    \"day\" : {\n      \"next\" : \"कल\",\n      \"current\" : \"आज\",\n      \"previous\" : \"कल\",\n      \"past\" : \"{0} दिन पहले\",\n      \"future\" : \"{0} दिन में\"\n    },\n    \"year\" : {\n      \"current\" : \"इस वर्ष\",\n      \"future\" : \"{0} वर्ष में\",\n      \"previous\" : \"पिछला वर्ष\",\n      \"next\" : \"अगला वर्ष\",\n      \"past\" : \"{0} वर्ष पहले\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} घं॰ में\",\n      \"past\" : \"{0} घं॰ पहले\",\n      \"current\" : \"यह घंटा\"\n    },\n    \"minute\" : {\n      \"current\" : \"यह मिनट\",\n      \"past\" : \"{0} मि॰ पहले\",\n      \"future\" : \"{0} मि॰ में\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} से॰ पहले\",\n      \"future\" : \"{0} से॰ में\",\n      \"current\" : \"अब\"\n    },\n    \"quarter\" : {\n      \"current\" : \"इस तिमाही\",\n      \"next\" : \"अगली तिमाही\",\n      \"past\" : {\n        \"other\" : \"{0} तिमाहियों पहले\",\n        \"one\" : \"{0} तिमाही पहले\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} तिमाहियों में\",\n        \"one\" : \"{0} तिमाही में\"\n      },\n      \"previous\" : \"अंतिम तिमाही\"\n    },\n    \"week\" : {\n      \"next\" : \"अगला सप्ताह\",\n      \"past\" : \"{0} सप्ताह पहले\",\n      \"current\" : \"इस सप्ताह\",\n      \"previous\" : \"पिछला सप्ताह\",\n      \"future\" : \"{0} सप्ताह में\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/hr.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"za {0} g.\",\n      \"previous\" : \"prošle g.\",\n      \"current\" : \"ove g.\",\n      \"next\" : \"sljedeće g.\",\n      \"past\" : \"prije {0} g.\"\n    },\n    \"day\" : {\n      \"current\" : \"danas\",\n      \"past\" : \"prije {0} d\",\n      \"next\" : \"sutra\",\n      \"previous\" : \"jučer\",\n      \"future\" : \"za {0} d\"\n    },\n    \"quarter\" : {\n      \"future\" : \"za {0} kv.\",\n      \"previous\" : \"prošli kv.\",\n      \"current\" : \"ovaj kv.\",\n      \"next\" : \"sljedeći kv.\",\n      \"past\" : \"prije {0} kv.\"\n    },\n    \"week\" : {\n      \"next\" : \"sljedeći tj.\",\n      \"past\" : \"prije {0} tj.\",\n      \"current\" : \"ovaj tj.\",\n      \"future\" : \"za {0} tj.\",\n      \"previous\" : \"prošli tj.\"\n    },\n    \"hour\" : {\n      \"current\" : \"ovaj sat\",\n      \"past\" : \"prije {0} h\",\n      \"future\" : \"za {0} h\"\n    },\n    \"month\" : {\n      \"past\" : \"prije {0} mj.\",\n      \"previous\" : \"prošli mj.\",\n      \"current\" : \"ovaj mj.\",\n      \"future\" : \"za {0} mj.\",\n      \"next\" : \"sljedeći mj.\"\n    },\n    \"minute\" : {\n      \"current\" : \"ova minuta\",\n      \"past\" : \"prije {0} min\",\n      \"future\" : \"za {0} min\"\n    },\n    \"second\" : {\n      \"past\" : \"prije {0} s\",\n      \"future\" : \"za {0} s\",\n      \"current\" : \"sad\"\n    },\n    \"now\" : \"sad\"\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"current\" : \"ovaj sat\",\n      \"past\" : \"prije {0} h\",\n      \"future\" : \"za {0} h\"\n    },\n    \"now\" : \"sad\",\n    \"quarter\" : {\n      \"current\" : \"ovaj kv.\",\n      \"future\" : \"za {0} kv.\",\n      \"past\" : \"prije {0} kv.\",\n      \"next\" : \"sljedeći kv.\",\n      \"previous\" : \"prošli kv.\"\n    },\n    \"day\" : {\n      \"current\" : \"danas\",\n      \"past\" : {\n        \"other\" : \"prije {0} dana\",\n        \"one\" : \"prije {0} dan\"\n      },\n      \"future\" : {\n        \"other\" : \"za {0} dana\",\n        \"one\" : \"za {0} dan\"\n      },\n      \"next\" : \"sutra\",\n      \"previous\" : \"jučer\"\n    },\n    \"week\" : {\n      \"current\" : \"ovaj tj.\",\n      \"future\" : \"za {0} tj.\",\n      \"previous\" : \"prošli tj.\",\n      \"next\" : \"sljedeći tj.\",\n      \"past\" : \"prije {0} tj.\"\n    },\n    \"minute\" : {\n      \"future\" : \"za {0} min\",\n      \"past\" : \"prije {0} min\",\n      \"current\" : \"ova minuta\"\n    },\n    \"second\" : {\n      \"future\" : \"za {0} s\",\n      \"current\" : \"sad\",\n      \"past\" : \"prije {0} s\"\n    },\n    \"month\" : {\n      \"future\" : \"za {0} mj.\",\n      \"previous\" : \"prošli mj.\",\n      \"next\" : \"sljedeći mj.\",\n      \"current\" : \"ovaj mj.\",\n      \"past\" : \"prije {0} mj.\"\n    },\n    \"year\" : {\n      \"next\" : \"sljedeće god.\",\n      \"previous\" : \"prošle god.\",\n      \"current\" : \"ove god.\",\n      \"future\" : \"za {0} g.\",\n      \"past\" : \"prije {0} g.\"\n    }\n  },\n  \"long\" : {\n    \"second\" : {\n      \"future\" : {\n        \"few\" : \"za {0} sekunde\",\n        \"one\" : \"za {0} sekundu\",\n        \"other\" : \"za {0} sekundi\"\n      },\n      \"current\" : \"sad\",\n      \"past\" : {\n        \"one\" : \"prije {0} sekundu\",\n        \"other\" : \"prije {0} sekundi\",\n        \"few\" : \"prije {0} sekunde\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"prošle godine\",\n      \"next\" : \"sljedeće godine\",\n      \"past\" : {\n        \"few\" : \"prije {0} godine\",\n        \"one\" : \"prije {0} godinu\",\n        \"other\" : \"prije {0} godina\"\n      },\n      \"current\" : \"ove godine\",\n      \"future\" : {\n        \"other\" : \"za {0} godina\",\n        \"few\" : \"za {0} godine\",\n        \"one\" : \"za {0} godinu\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"jučer\",\n      \"future\" : {\n        \"one\" : \"za {0} dan\",\n        \"other\" : \"za {0} dana\"\n      },\n      \"past\" : {\n        \"other\" : \"prije {0} dana\",\n        \"one\" : \"prije {0} dan\"\n      },\n      \"current\" : \"danas\",\n      \"next\" : \"sutra\"\n    },\n    \"now\" : \"sad\",\n    \"month\" : {\n      \"past\" : {\n        \"few\" : \"prije {0} mjeseca\",\n        \"one\" : \"prije {0} mjesec\",\n        \"other\" : \"prije {0} mjeseci\"\n      },\n      \"next\" : \"sljedeći mjesec\",\n      \"previous\" : \"prošli mjesec\",\n      \"future\" : {\n        \"other\" : \"za {0} mjeseci\",\n        \"one\" : \"za {0} mjesec\",\n        \"few\" : \"za {0} mjeseca\"\n      },\n      \"current\" : \"ovaj mjesec\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"one\" : \"prije {0} tjedan\",\n        \"few\" : \"prije {0} tjedna\",\n        \"other\" : \"prije {0} tjedana\"\n      },\n      \"future\" : {\n        \"one\" : \"za {0} tjedan\",\n        \"few\" : \"za {0} tjedna\",\n        \"other\" : \"za {0} tjedana\"\n      },\n      \"current\" : \"ovaj tjedan\",\n      \"previous\" : \"prošli tjedan\",\n      \"next\" : \"sljedeći tjedan\"\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"prije {0} kvartal\",\n        \"other\" : \"prije {0} kvartala\"\n      },\n      \"current\" : \"ovaj kvartal\",\n      \"future\" : {\n        \"one\" : \"za {0} kvartal\",\n        \"other\" : \"za {0} kvartala\"\n      },\n      \"previous\" : \"prošli kvartal\",\n      \"next\" : \"sljedeći kvartal\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"prije {0} sat\",\n        \"few\" : \"prije {0} sata\",\n        \"other\" : \"prije {0} sati\"\n      },\n      \"future\" : {\n        \"other\" : \"za {0} sati\",\n        \"few\" : \"za {0} sata\",\n        \"one\" : \"za {0} sat\"\n      },\n      \"current\" : \"ovaj sat\"\n    },\n    \"minute\" : {\n      \"current\" : \"ova minuta\",\n      \"future\" : {\n        \"few\" : \"za {0} minute\",\n        \"other\" : \"za {0} minuta\",\n        \"one\" : \"za {0} minutu\"\n      },\n      \"past\" : {\n        \"few\" : \"prije {0} minute\",\n        \"other\" : \"prije {0} minuta\",\n        \"one\" : \"prije {0} minutu\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/hsb.json",
    "content": "{\n  \"narrow\" : {\n    \"week\" : {\n      \"next\" : \"přichodny tydźeń\",\n      \"past\" : \"před {0} tydź.\",\n      \"future\" : \"za {0} tydź.\",\n      \"previous\" : \"zašły tydźeń\",\n      \"current\" : \"tutón tydźeń\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"před {0} kw.\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"za {0} kw.\"\n    },\n    \"minute\" : {\n      \"past\" : \"před {0} m\",\n      \"future\" : \"za {0} m\",\n      \"current\" : \"this minute\"\n    },\n    \"day\" : {\n      \"previous\" : \"wčera\",\n      \"next\" : \"jutře\",\n      \"current\" : \"dźensa\",\n      \"future\" : \"za {0} d\",\n      \"past\" : \"před {0} d\"\n    },\n    \"year\" : {\n      \"current\" : \"lětsa\",\n      \"previous\" : \"loni\",\n      \"next\" : \"klětu\",\n      \"past\" : \"před {0} l.\",\n      \"future\" : \"za {0} l.\"\n    },\n    \"second\" : {\n      \"future\" : \"za {0} s\",\n      \"current\" : \"now\",\n      \"past\" : \"před {0} s\"\n    },\n    \"month\" : {\n      \"past\" : \"před {0} měs.\",\n      \"future\" : \"za {0} měs.\",\n      \"next\" : \"přichodny měsac\",\n      \"current\" : \"tutón měsac\",\n      \"previous\" : \"zašły měsac\"\n    },\n    \"now\" : \"now\",\n    \"hour\" : {\n      \"future\" : \"za {0} h\",\n      \"current\" : \"this hour\",\n      \"past\" : \"před {0} h\"\n    }\n  },\n  \"short\" : {\n    \"year\" : {\n      \"next\" : \"klětu\",\n      \"future\" : \"za {0} l.\",\n      \"current\" : \"lětsa\",\n      \"past\" : \"před {0} l.\",\n      \"previous\" : \"loni\"\n    },\n    \"quarter\" : {\n      \"future\" : \"za {0} kwart.\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"před {0} kwart.\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"před {0} sek.\",\n      \"future\" : \"za {0} sek.\"\n    },\n    \"minute\" : {\n      \"past\" : \"před {0} min.\",\n      \"future\" : \"za {0} min.\",\n      \"current\" : \"this minute\"\n    },\n    \"day\" : {\n      \"past\" : \"před {0} dnj.\",\n      \"next\" : \"jutře\",\n      \"future\" : {\n        \"one\" : \"za {0} dźeń\",\n        \"few\" : \"za {0} dny\",\n        \"other\" : \"za {0} dnj.\"\n      },\n      \"previous\" : \"wčera\",\n      \"current\" : \"dźensa\"\n    },\n    \"month\" : {\n      \"previous\" : \"zašły měsac\",\n      \"next\" : \"přichodny měsac\",\n      \"past\" : \"před {0} měs.\",\n      \"current\" : \"tutón měsac\",\n      \"future\" : \"za {0} měs.\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"před {0} hodź.\",\n      \"future\" : \"za {0} hodź.\"\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"previous\" : \"zašły tydźeń\",\n      \"current\" : \"tutón tydźeń\",\n      \"next\" : \"přichodny tydźeń\",\n      \"past\" : \"před {0} tydź.\",\n      \"future\" : \"za {0} tydź.\"\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : {\n        \"two\" : \"před {0} kwartalomaj\",\n        \"one\" : \"před {0} kwartalom\",\n        \"other\" : \"před {0} kwartalemi\"\n      },\n      \"future\" : {\n        \"one\" : \"za {0} kwartal\",\n        \"few\" : \"za {0} kwartale\",\n        \"other\" : \"za {0} kwartalow\",\n        \"two\" : \"za {0} kwartalej\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"two\" : \"za {0} hodźinje\",\n        \"few\" : \"za {0} hodźiny\",\n        \"one\" : \"za {0} hodźinu\",\n        \"other\" : \"za {0} hodźin\"\n      },\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"two\" : \"před {0} hodźinomaj\",\n        \"other\" : \"před {0} hodźinami\",\n        \"one\" : \"před {0} hodźinu\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"wčera\",\n      \"current\" : \"dźensa\",\n      \"next\" : \"jutře\",\n      \"past\" : {\n        \"one\" : \"před {0} dnjom\",\n        \"two\" : \"před {0} dnjomaj\",\n        \"other\" : \"před {0} dnjemi\"\n      },\n      \"future\" : {\n        \"one\" : \"za {0} dźeń\",\n        \"two\" : \"za {0} dnjej\",\n        \"other\" : \"za {0} dnjow\",\n        \"few\" : \"za {0} dny\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"přichodny měsac\",\n      \"previous\" : \"zašły měsac\",\n      \"current\" : \"tutón měsac\",\n      \"future\" : {\n        \"one\" : \"za {0} měsac\",\n        \"other\" : \"za {0} měsacow\",\n        \"two\" : \"za {0} měsacaj\",\n        \"few\" : \"za {0} měsacy\"\n      },\n      \"past\" : {\n        \"one\" : \"před {0} měsacom\",\n        \"two\" : \"před {0} měsacomaj\",\n        \"other\" : \"před {0} měsacami\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"other\" : \"za {0} sekundow\",\n        \"two\" : \"za {0} sekundźe\",\n        \"one\" : \"za {0} sekundu\",\n        \"few\" : \"za {0} sekundy\"\n      },\n      \"current\" : \"now\",\n      \"past\" : {\n        \"other\" : \"před {0} sekundami\",\n        \"one\" : \"před {0} sekundu\",\n        \"two\" : \"před {0} sekundomaj\"\n      }\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"current\" : \"tutón tydźeń\",\n      \"previous\" : \"zašły tydźeń\",\n      \"next\" : \"přichodny tydźeń\",\n      \"past\" : {\n        \"two\" : \"před {0} tydźenjomaj\",\n        \"one\" : \"před {0} tydźenjom\",\n        \"other\" : \"před {0} tydźenjemi\"\n      },\n      \"future\" : {\n        \"two\" : \"za {0} tydźenjej\",\n        \"one\" : \"za {0} tydźeń\",\n        \"few\" : \"za {0} tydźenje\",\n        \"other\" : \"za {0} tydźenjow\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"před {0} minutami\",\n        \"one\" : \"před {0} minutu\",\n        \"two\" : \"před {0} minutomaj\"\n      },\n      \"future\" : {\n        \"one\" : \"za {0} minutu\",\n        \"few\" : \"za {0} minuty\",\n        \"two\" : \"za {0} minuće\",\n        \"other\" : \"za {0} minutow\"\n      },\n      \"current\" : \"this minute\"\n    },\n    \"year\" : {\n      \"next\" : \"klětu\",\n      \"previous\" : \"loni\",\n      \"past\" : {\n        \"one\" : \"před {0} lětom\",\n        \"two\" : \"před {0} lětomaj\",\n        \"other\" : \"před {0} lětami\"\n      },\n      \"current\" : \"lětsa\",\n      \"future\" : {\n        \"other\" : \"za {0} lět\",\n        \"two\" : \"za {0} lěće\",\n        \"few\" : \"za {0} lěta\",\n        \"one\" : \"za {0} lěto\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/hu.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"holnap\",\n      \"future\" : \"{0} nap múlva\",\n      \"previous\" : \"tegnap\",\n      \"current\" : \"ma\",\n      \"past\" : \"{0} napja\"\n    },\n    \"quarter\" : {\n      \"next\" : \"következő negyedév\",\n      \"past\" : \"{0} negyedévvel ezelőtt\",\n      \"future\" : \"{0} n.év múlva\",\n      \"previous\" : \"előző negyedév\",\n      \"current\" : \"ez a negyedév\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} óra múlva\",\n      \"current\" : \"ebben az órában\",\n      \"past\" : \"{0} órával ezelőtt\"\n    },\n    \"year\" : {\n      \"next\" : \"következő év\",\n      \"past\" : \"{0} évvel ezelőtt\",\n      \"current\" : \"ez az év\",\n      \"previous\" : \"előző év\",\n      \"future\" : \"{0} év múlva\"\n    },\n    \"now\" : \"most\",\n    \"month\" : {\n      \"current\" : \"ez a hónap\",\n      \"future\" : \"{0} hónap múlva\",\n      \"past\" : \"{0} hónappal ezelőtt\",\n      \"next\" : \"következő hónap\",\n      \"previous\" : \"előző hónap\"\n    },\n    \"week\" : {\n      \"previous\" : \"előző hét\",\n      \"current\" : \"ez a hét\",\n      \"past\" : \"{0} héttel ezelőtt\",\n      \"future\" : \"{0} hét múlva\",\n      \"next\" : \"következő hét\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} perc múlva\",\n      \"current\" : \"ebben a percben\",\n      \"past\" : \"{0} perccel ezelőtt\"\n    },\n    \"second\" : {\n      \"current\" : \"most\",\n      \"past\" : \"{0} másodperccel ezelőtt\",\n      \"future\" : \"{0} másodperc múlva\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"tegnap\",\n      \"current\" : \"ma\",\n      \"next\" : \"holnap\",\n      \"past\" : \"{0} nappal ezelőtt\",\n      \"future\" : \"{0} nap múlva\"\n    },\n    \"week\" : {\n      \"current\" : \"ez a hét\",\n      \"future\" : \"{0} hét múlva\",\n      \"past\" : \"{0} héttel ezelőtt\",\n      \"previous\" : \"előző hét\",\n      \"next\" : \"következő hét\"\n    },\n    \"minute\" : {\n      \"current\" : \"ebben a percben\",\n      \"past\" : \"{0} perccel ezelőtt\",\n      \"future\" : \"{0} perc múlva\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} hónap múlva\",\n      \"next\" : \"következő hónap\",\n      \"previous\" : \"előző hónap\",\n      \"current\" : \"ez a hónap\",\n      \"past\" : \"{0} hónappal ezelőtt\"\n    },\n    \"hour\" : {\n      \"current\" : \"ebben az órában\",\n      \"past\" : \"{0} órával ezelőtt\",\n      \"future\" : \"{0} óra múlva\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} évvel ezelőtt\",\n      \"future\" : \"{0} év múlva\",\n      \"previous\" : \"előző év\",\n      \"next\" : \"következő év\",\n      \"current\" : \"ez az év\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} másodperccel ezelőtt\",\n      \"future\" : \"{0} másodperc múlva\",\n      \"current\" : \"most\"\n    },\n    \"now\" : \"most\",\n    \"quarter\" : {\n      \"past\" : \"{0} negyedévvel ezelőtt\",\n      \"current\" : \"ez a negyedév\",\n      \"previous\" : \"előző negyedév\",\n      \"future\" : \"{0} negyedév múlva\",\n      \"next\" : \"következő negyedév\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} negyedév múlva\",\n      \"next\" : \"következő negyedév\",\n      \"previous\" : \"előző negyedév\",\n      \"current\" : \"ez a negyedév\",\n      \"past\" : \"{0} negyedévvel ezelőtt\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} perc múlva\",\n      \"current\" : \"ebben a percben\",\n      \"past\" : \"{0} perccel ezelőtt\"\n    },\n    \"year\" : {\n      \"next\" : \"következő év\",\n      \"future\" : \"{0} év múlva\",\n      \"current\" : \"ez az év\",\n      \"past\" : \"{0} évvel ezelőtt\",\n      \"previous\" : \"előző év\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} másodperc múlva\",\n      \"current\" : \"most\",\n      \"past\" : \"{0} másodperccel ezelőtt\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} órával ezelőtt\",\n      \"current\" : \"ebben az órában\",\n      \"future\" : \"{0} óra múlva\"\n    },\n    \"now\" : \"most\",\n    \"month\" : {\n      \"previous\" : \"előző hónap\",\n      \"next\" : \"következő hónap\",\n      \"past\" : \"{0} hónappal ezelőtt\",\n      \"current\" : \"ez a hónap\",\n      \"future\" : \"{0} hónap múlva\"\n    },\n    \"week\" : {\n      \"previous\" : \"előző hét\",\n      \"current\" : \"ez a hét\",\n      \"next\" : \"következő hét\",\n      \"past\" : \"{0} héttel ezelőtt\",\n      \"future\" : \"{0} hét múlva\"\n    },\n    \"day\" : {\n      \"next\" : \"holnap\",\n      \"past\" : \"{0} napja\",\n      \"future\" : \"{0} nap múlva\",\n      \"previous\" : \"tegnap\",\n      \"current\" : \"ma\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/hy.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"վաղը\",\n      \"future\" : \"{0} օրից\",\n      \"previous\" : \"երեկ\",\n      \"current\" : \"այսօր\",\n      \"past\" : \"{0} օր առաջ\"\n    },\n    \"quarter\" : {\n      \"next\" : \"հաջորդ եռամսյակ\",\n      \"past\" : \"{0} եռմս առաջ\",\n      \"future\" : \"{0} եռմս-ից\",\n      \"previous\" : \"նախորդ եռամսյակ\",\n      \"current\" : \"այս եռամսյակ\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ժ առաջ\",\n      \"current\" : \"այս ժամին\",\n      \"future\" : \"{0} ժ-ից\"\n    },\n    \"year\" : {\n      \"next\" : \"հաջորդ տարի\",\n      \"past\" : \"{0} տ առաջ\",\n      \"current\" : \"այս տարի\",\n      \"previous\" : \"նախորդ տարի\",\n      \"future\" : \"{0} տարուց\"\n    },\n    \"now\" : \"հիմա\",\n    \"month\" : {\n      \"current\" : \"այս ամիս\",\n      \"future\" : \"{0} ամսից\",\n      \"past\" : \"{0} ամիս առաջ\",\n      \"next\" : \"հաջորդ ամիս\",\n      \"previous\" : \"անցյալ ամիս\"\n    },\n    \"week\" : {\n      \"previous\" : \"նախորդ շաբաթ\",\n      \"current\" : \"այս շաբաթ\",\n      \"past\" : \"{0} շաբ առաջ\",\n      \"future\" : \"{0} շաբ անց\",\n      \"next\" : \"հաջորդ շաբաթ\"\n    },\n    \"minute\" : {\n      \"current\" : \"այս րոպեին\",\n      \"future\" : \"{0} ր-ից\",\n      \"past\" : \"{0} ր առաջ\"\n    },\n    \"second\" : {\n      \"current\" : \"հիմա\",\n      \"past\" : \"{0} վ առաջ\",\n      \"future\" : \"{0} վ-ից\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"երեկ\",\n      \"current\" : \"այսօր\",\n      \"next\" : \"վաղը\",\n      \"past\" : \"{0} օր առաջ\",\n      \"future\" : \"{0} օրից\"\n    },\n    \"week\" : {\n      \"current\" : \"այս շաբաթ\",\n      \"future\" : \"{0} շաբաթից\",\n      \"past\" : \"{0} շաբաթ առաջ\",\n      \"previous\" : \"նախորդ շաբաթ\",\n      \"next\" : \"հաջորդ շաբաթ\"\n    },\n    \"minute\" : {\n      \"current\" : \"այս րոպեին\",\n      \"past\" : \"{0} րոպե առաջ\",\n      \"future\" : \"{0} րոպեից\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ամսից\",\n      \"next\" : \"հաջորդ ամիս\",\n      \"previous\" : \"նախորդ ամիս\",\n      \"current\" : \"այս ամիս\",\n      \"past\" : \"{0} ամիս առաջ\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ժամ առաջ\",\n      \"current\" : \"այս ժամին\",\n      \"future\" : \"{0} ժամից\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} տարի առաջ\",\n      \"future\" : \"{0} տարուց\",\n      \"previous\" : \"նախորդ տարի\",\n      \"next\" : \"հաջորդ տարի\",\n      \"current\" : \"այս տարի\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} վայրկյանից\",\n      \"current\" : \"հիմա\",\n      \"past\" : \"{0} վայրկյան առաջ\"\n    },\n    \"now\" : \"հիմա\",\n    \"quarter\" : {\n      \"past\" : \"{0} եռամսյակ առաջ\",\n      \"current\" : \"այս եռամսյակ\",\n      \"previous\" : \"նախորդ եռամսյակ\",\n      \"future\" : \"{0} եռամսյակից\",\n      \"next\" : \"հաջորդ եռամսյակ\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} եռմս-ից\",\n      \"next\" : \"հաջորդ եռամսյակ\",\n      \"previous\" : \"նախորդ եռամսյակ\",\n      \"current\" : \"այս եռամսյակ\",\n      \"past\" : \"{0} եռմս առաջ\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} ր առաջ\",\n      \"current\" : \"այս րոպեին\",\n      \"future\" : \"{0} ր-ից\"\n    },\n    \"year\" : {\n      \"next\" : \"հաջորդ տարի\",\n      \"future\" : \"{0} տարուց\",\n      \"current\" : \"այս տարի\",\n      \"past\" : \"{0} տ առաջ\",\n      \"previous\" : \"նախորդ տարի\"\n    },\n    \"second\" : {\n      \"current\" : \"հիմա\",\n      \"past\" : \"{0} վրկ առաջ\",\n      \"future\" : \"{0} վրկ-ից\"\n    },\n    \"hour\" : {\n      \"current\" : \"այս ժամին\",\n      \"past\" : \"{0} ժ առաջ\",\n      \"future\" : \"{0} ժ-ից\"\n    },\n    \"now\" : \"հիմա\",\n    \"month\" : {\n      \"previous\" : \"անցյալ ամիս\",\n      \"next\" : \"հաջորդ ամիս\",\n      \"past\" : \"{0} ամիս առաջ\",\n      \"current\" : \"այս ամիս\",\n      \"future\" : \"{0} ամսից\"\n    },\n    \"week\" : {\n      \"previous\" : \"նախորդ շաբաթ\",\n      \"current\" : \"այս շաբաթ\",\n      \"next\" : \"հաջորդ շաբաթ\",\n      \"past\" : \"{0} շաբ առաջ\",\n      \"future\" : \"{0} շաբ-ից\"\n    },\n    \"day\" : {\n      \"next\" : \"վաղը\",\n      \"past\" : \"{0} օր առաջ\",\n      \"future\" : \"{0} օրից\",\n      \"previous\" : \"երեկ\",\n      \"current\" : \"այսօր\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/id.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"besok\",\n      \"future\" : \"dalam {0} h\",\n      \"previous\" : \"kemarin\",\n      \"current\" : \"hari ini\",\n      \"past\" : \"{0} h lalu\"\n    },\n    \"quarter\" : {\n      \"next\" : \"kuartal berikutnya\",\n      \"past\" : \"{0} krtl. lalu\",\n      \"future\" : \"dlm {0} krtl.\",\n      \"previous\" : \"Kuartal lalu\",\n      \"current\" : \"kuartal ini\"\n    },\n    \"hour\" : {\n      \"future\" : \"dalam {0} jam\",\n      \"current\" : \"jam ini\",\n      \"past\" : \"{0} jam lalu\"\n    },\n    \"year\" : {\n      \"next\" : \"tahun depan\",\n      \"past\" : \"{0} thn lalu\",\n      \"current\" : \"tahun ini\",\n      \"previous\" : \"tahun lalu\",\n      \"future\" : \"dlm {0} thn\"\n    },\n    \"now\" : \"sekarang\",\n    \"month\" : {\n      \"current\" : \"bulan ini\",\n      \"future\" : \"dlm {0} bln\",\n      \"past\" : \"{0} bln lalu\",\n      \"next\" : \"bulan berikutnya\",\n      \"previous\" : \"bulan lalu\"\n    },\n    \"week\" : {\n      \"previous\" : \"minggu lalu\",\n      \"current\" : \"minggu ini\",\n      \"past\" : \"{0} mgg lalu\",\n      \"future\" : \"dlm {0} mgg\",\n      \"next\" : \"minggu depan\"\n    },\n    \"minute\" : {\n      \"future\" : \"dlm {0} mnt\",\n      \"current\" : \"menit ini\",\n      \"past\" : \"{0} mnt lalu\"\n    },\n    \"second\" : {\n      \"current\" : \"sekarang\",\n      \"future\" : \"dlm {0} dtk\",\n      \"past\" : \"{0} dtk lalu\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"kemarin\",\n      \"current\" : \"hari ini\",\n      \"next\" : \"besok\",\n      \"past\" : \"{0} hari yang lalu\",\n      \"future\" : \"dalam {0} hari\"\n    },\n    \"week\" : {\n      \"current\" : \"minggu ini\",\n      \"future\" : \"dalam {0} minggu\",\n      \"past\" : \"{0} minggu yang lalu\",\n      \"previous\" : \"minggu lalu\",\n      \"next\" : \"minggu depan\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} menit yang lalu\",\n      \"current\" : \"menit ini\",\n      \"future\" : \"dalam {0} menit\"\n    },\n    \"month\" : {\n      \"future\" : \"dalam {0} bulan\",\n      \"next\" : \"bulan berikutnya\",\n      \"previous\" : \"bulan lalu\",\n      \"current\" : \"bulan ini\",\n      \"past\" : \"{0} bulan yang lalu\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} jam yang lalu\",\n      \"future\" : \"dalam {0} jam\",\n      \"current\" : \"jam ini\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} tahun yang lalu\",\n      \"future\" : \"dalam {0} tahun\",\n      \"previous\" : \"tahun lalu\",\n      \"next\" : \"tahun depan\",\n      \"current\" : \"tahun ini\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} detik yang lalu\",\n      \"current\" : \"sekarang\",\n      \"future\" : \"dalam {0} detik\"\n    },\n    \"now\" : \"sekarang\",\n    \"quarter\" : {\n      \"past\" : \"{0} kuartal yang lalu\",\n      \"current\" : \"kuartal ini\",\n      \"previous\" : \"Kuartal lalu\",\n      \"future\" : \"dalam {0} kuartal\",\n      \"next\" : \"kuartal berikutnya\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"dlm {0} krtl.\",\n      \"next\" : \"kuartal berikutnya\",\n      \"previous\" : \"Kuartal lalu\",\n      \"current\" : \"kuartal ini\",\n      \"past\" : \"{0} krtl. lalu\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} mnt lalu\",\n      \"current\" : \"menit ini\",\n      \"future\" : \"dlm {0} mnt\"\n    },\n    \"year\" : {\n      \"next\" : \"tahun depan\",\n      \"future\" : \"dlm {0} thn\",\n      \"current\" : \"tahun ini\",\n      \"past\" : \"{0} thn lalu\",\n      \"previous\" : \"tahun lalu\"\n    },\n    \"second\" : {\n      \"current\" : \"sekarang\",\n      \"past\" : \"{0} dtk lalu\",\n      \"future\" : \"dlm {0} dtk\"\n    },\n    \"hour\" : {\n      \"current\" : \"jam ini\",\n      \"past\" : \"{0} jam lalu\",\n      \"future\" : \"dalam {0} jam\"\n    },\n    \"now\" : \"sekarang\",\n    \"month\" : {\n      \"previous\" : \"bulan lalu\",\n      \"next\" : \"bulan berikutnya\",\n      \"past\" : \"{0} bln lalu\",\n      \"current\" : \"bulan ini\",\n      \"future\" : \"dlm {0} bln\"\n    },\n    \"week\" : {\n      \"previous\" : \"minggu lalu\",\n      \"current\" : \"minggu ini\",\n      \"next\" : \"minggu depan\",\n      \"past\" : \"{0} mgg lalu\",\n      \"future\" : \"dlm {0} mgg\"\n    },\n    \"day\" : {\n      \"next\" : \"besok\",\n      \"past\" : \"{0} h lalu\",\n      \"future\" : \"dalam {0} h\",\n      \"previous\" : \"kemarin\",\n      \"current\" : \"hari ini\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/is.json",
    "content": "{\n  \"short\" : {\n    \"now\" : \"núna\",\n    \"month\" : {\n      \"future\" : \"eftir {0} mán.\",\n      \"next\" : \"í næsta mán.\",\n      \"current\" : \"í þessum mán.\",\n      \"past\" : \"fyrir {0} mán.\",\n      \"previous\" : \"í síðasta mán.\"\n    },\n    \"second\" : {\n      \"past\" : \"fyrir {0} sek.\",\n      \"future\" : \"eftir {0} sek.\",\n      \"current\" : \"núna\"\n    },\n    \"year\" : {\n      \"next\" : \"á næsta ári\",\n      \"current\" : \"á þessu ári\",\n      \"past\" : {\n        \"other\" : \"fyrir {0} árum\",\n        \"one\" : \"fyrir {0} ári\"\n      },\n      \"previous\" : \"á síðasta ári\",\n      \"future\" : \"eftir {0} ár\"\n    },\n    \"week\" : {\n      \"previous\" : \"í síðustu viku\",\n      \"current\" : \"í þessari viku\",\n      \"past\" : {\n        \"other\" : \"fyrir {0} vikum\",\n        \"one\" : \"fyrir {0} viku\"\n      },\n      \"future\" : \"eftir {0} vikur\",\n      \"next\" : \"í næstu viku\"\n    },\n    \"day\" : {\n      \"previous\" : \"í gær\",\n      \"current\" : \"í dag\",\n      \"past\" : {\n        \"one\" : \"fyrir {0} degi\",\n        \"other\" : \"fyrir {0} dögum\"\n      },\n      \"next\" : \"á morgun\",\n      \"future\" : {\n        \"one\" : \"eftir {0} dag\",\n        \"other\" : \"eftir {0} daga\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : \"fyrir {0} klst.\",\n      \"future\" : \"eftir {0} klst.\",\n      \"current\" : \"þessa stundina\"\n    },\n    \"quarter\" : {\n      \"next\" : \"næsti ársfj.\",\n      \"previous\" : \"síðasti ársfj.\",\n      \"past\" : \"fyrir {0} ársfj.\",\n      \"future\" : \"eftir {0} ársfj.\",\n      \"current\" : \"þessi ársfj.\"\n    },\n    \"minute\" : {\n      \"future\" : \"eftir {0} mín.\",\n      \"current\" : \"á þessari mínútu\",\n      \"past\" : \"fyrir {0} mín.\"\n    }\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"fyrir {0} mínútu\",\n        \"other\" : \"fyrir {0} mínútum\"\n      },\n      \"future\" : {\n        \"one\" : \"eftir {0} mínútu\",\n        \"other\" : \"eftir {0} mínútur\"\n      },\n      \"current\" : \"á þessari mínútu\"\n    },\n    \"year\" : {\n      \"future\" : \"eftir {0} ár\",\n      \"current\" : \"á þessu ári\",\n      \"previous\" : \"á síðasta ári\",\n      \"next\" : \"á næsta ári\",\n      \"past\" : {\n        \"one\" : \"fyrir {0} ári\",\n        \"other\" : \"fyrir {0} árum\"\n      }\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"fyrir {0} ársfjórðungi\",\n        \"other\" : \"fyrir {0} ársfjórðungum\"\n      },\n      \"next\" : \"næsti ársfjórðungur\",\n      \"previous\" : \"síðasti ársfjórðungur\",\n      \"future\" : {\n        \"one\" : \"eftir {0} ársfjórðung\",\n        \"other\" : \"eftir {0} ársfjórðunga\"\n      },\n      \"current\" : \"þessi ársfjórðungur\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"eftir {0} viku\",\n        \"other\" : \"eftir {0} vikur\"\n      },\n      \"past\" : {\n        \"other\" : \"fyrir {0} vikum\",\n        \"one\" : \"fyrir {0} viku\"\n      },\n      \"previous\" : \"í síðustu viku\",\n      \"current\" : \"í þessari viku\",\n      \"next\" : \"í næstu viku\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"fyrir {0} klukkustund\",\n        \"other\" : \"fyrir {0} klukkustundum\"\n      },\n      \"future\" : {\n        \"other\" : \"eftir {0} klukkustundir\",\n        \"one\" : \"eftir {0} klukkustund\"\n      },\n      \"current\" : \"þessa stundina\"\n    },\n    \"month\" : {\n      \"previous\" : \"í síðasta mánuði\",\n      \"next\" : \"í næsta mánuði\",\n      \"future\" : {\n        \"one\" : \"eftir {0} mánuð\",\n        \"other\" : \"eftir {0} mánuði\"\n      },\n      \"past\" : {\n        \"one\" : \"fyrir {0} mánuði\",\n        \"other\" : \"fyrir {0} mánuðum\"\n      },\n      \"current\" : \"í þessum mánuði\"\n    },\n    \"second\" : {\n      \"current\" : \"núna\",\n      \"past\" : {\n        \"one\" : \"fyrir {0} sekúndu\",\n        \"other\" : \"fyrir {0} sekúndum\"\n      },\n      \"future\" : {\n        \"other\" : \"eftir {0} sekúndur\",\n        \"one\" : \"eftir {0} sekúndu\"\n      }\n    },\n    \"now\" : \"núna\",\n    \"day\" : {\n      \"next\" : \"á morgun\",\n      \"future\" : {\n        \"other\" : \"eftir {0} daga\",\n        \"one\" : \"eftir {0} dag\"\n      },\n      \"previous\" : \"í gær\",\n      \"current\" : \"í dag\",\n      \"past\" : {\n        \"one\" : \"fyrir {0} degi\",\n        \"other\" : \"fyrir {0} dögum\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"day\" : {\n      \"previous\" : \"í gær\",\n      \"future\" : {\n        \"other\" : \"+{0} daga\",\n        \"one\" : \"+{0} dag\"\n      },\n      \"past\" : {\n        \"one\" : \"-{0} degi\",\n        \"other\" : \"-{0} dögum\"\n      },\n      \"current\" : \"í dag\",\n      \"next\" : \"á morgun\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"other\" : \"-{0} vikur\",\n        \"one\" : \"-{0} viku\"\n      },\n      \"future\" : {\n        \"one\" : \"+{0} viku\",\n        \"other\" : \"+{0} vikur\"\n      },\n      \"current\" : \"í þessari viku\",\n      \"previous\" : \"í síðustu viku\",\n      \"next\" : \"í næstu viku\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"síðasti ársfj.\",\n      \"future\" : \"eftir {0} ársfj.\",\n      \"next\" : \"næsti ársfj.\",\n      \"past\" : \"fyrir {0} ársfj.\",\n      \"current\" : \"þessi ársfj.\"\n    },\n    \"month\" : {\n      \"future\" : \"eftir {0} mán.\",\n      \"current\" : \"í þessum mán.\",\n      \"previous\" : \"í síðasta mán.\",\n      \"past\" : \"fyrir {0} mán.\",\n      \"next\" : \"í næsta mán.\"\n    },\n    \"hour\" : {\n      \"past\" : \"-{0} klst.\",\n      \"future\" : \"+{0} klst.\",\n      \"current\" : \"þessa stundina\"\n    },\n    \"year\" : {\n      \"past\" : \"fyrir {0} árum\",\n      \"previous\" : \"á síðasta ári\",\n      \"next\" : \"á næsta ári\",\n      \"future\" : \"eftir {0} ár\",\n      \"current\" : \"á þessu ári\"\n    },\n    \"now\" : \"núna\",\n    \"minute\" : {\n      \"past\" : \"-{0} mín.\",\n      \"future\" : \"+{0} mín.\",\n      \"current\" : \"á þessari mínútu\"\n    },\n    \"second\" : {\n      \"current\" : \"núna\",\n      \"past\" : \"-{0} sek.\",\n      \"future\" : \"+{0} sek.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/it.json",
    "content": "{\n  \"long\" : {\n    \"day\" : {\n      \"current\" : \"oggi\",\n      \"next\" : \"domani\",\n      \"past\" : {\n        \"one\" : \"{0} giorno fa\",\n        \"other\" : \"{0} giorni fa\"\n      },\n      \"future\" : {\n        \"one\" : \"tra {0} giorno\",\n        \"other\" : \"tra {0} giorni\"\n      },\n      \"previous\" : \"ieri\"\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"tra {0} minuto\",\n        \"other\" : \"tra {0} minuti\"\n      },\n      \"current\" : \"questo minuto\",\n      \"past\" : {\n        \"other\" : \"{0} minuti fa\",\n        \"one\" : \"{0} minuto fa\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"tra {0} secondo\",\n        \"other\" : \"tra {0} secondi\"\n      },\n      \"current\" : \"ora\",\n      \"past\" : {\n        \"one\" : \"{0} secondo fa\",\n        \"other\" : \"{0} secondi fa\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"tra {0} settimane\",\n        \"one\" : \"tra {0} settimana\"\n      },\n      \"previous\" : \"settimana scorsa\",\n      \"current\" : \"questa settimana\",\n      \"next\" : \"settimana prossima\",\n      \"past\" : {\n        \"one\" : \"{0} settimana fa\",\n        \"other\" : \"{0} settimane fa\"\n      }\n    },\n    \"now\" : \"ora\",\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"{0} mesi fa\",\n        \"one\" : \"{0} mese fa\"\n      },\n      \"current\" : \"questo mese\",\n      \"future\" : {\n        \"other\" : \"tra {0} mesi\",\n        \"one\" : \"tra {0} mese\"\n      },\n      \"previous\" : \"mese scorso\",\n      \"next\" : \"mese prossimo\"\n    },\n    \"quarter\" : {\n      \"future\" : {\n        \"other\" : \"tra {0} trimestri\",\n        \"one\" : \"tra {0} trimestre\"\n      },\n      \"previous\" : \"trimestre scorso\",\n      \"next\" : \"trimestre prossimo\",\n      \"current\" : \"questo trimestre\",\n      \"past\" : {\n        \"other\" : \"{0} trimestri fa\",\n        \"one\" : \"{0} trimestre fa\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} ore fa\",\n        \"one\" : \"{0} ora fa\"\n      },\n      \"current\" : \"quest’ora\",\n      \"future\" : {\n        \"one\" : \"tra {0} ora\",\n        \"other\" : \"tra {0} ore\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"quest’anno\",\n      \"next\" : \"anno prossimo\",\n      \"previous\" : \"anno scorso\",\n      \"future\" : {\n        \"one\" : \"tra {0} anno\",\n        \"other\" : \"tra {0} anni\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} anno fa\",\n        \"other\" : \"{0} anni fa\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : \"tra {0} s\",\n      \"current\" : \"ora\",\n      \"past\" : \"{0}s fa\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"{0} mesi fa\",\n        \"one\" : \"{0} mese fa\"\n      },\n      \"future\" : {\n        \"one\" : \"tra {0} mese\",\n        \"other\" : \"tra {0} mesi\"\n      },\n      \"next\" : \"mese prossimo\",\n      \"current\" : \"questo mese\",\n      \"previous\" : \"mese scorso\"\n    },\n    \"quarter\" : {\n      \"current\" : \"questo trimestre\",\n      \"next\" : \"trimestre prossimo\",\n      \"past\" : \"{0} trim. fa\",\n      \"future\" : \"tra {0} trim.\",\n      \"previous\" : \"trimestre scorso\"\n    },\n    \"now\" : \"ora\",\n    \"week\" : {\n      \"past\" : \"{0} sett. fa\",\n      \"current\" : \"questa settimana\",\n      \"next\" : \"settimana prossima\",\n      \"future\" : \"tra {0} sett.\",\n      \"previous\" : \"settimana scorsa\"\n    },\n    \"year\" : {\n      \"previous\" : \"anno scorso\",\n      \"current\" : \"quest’anno\",\n      \"past\" : {\n        \"one\" : \"{0} anno fa\",\n        \"other\" : \"{0} anni fa\"\n      },\n      \"future\" : {\n        \"one\" : \"tra {0} anno\",\n        \"other\" : \"tra {0} anni\"\n      },\n      \"next\" : \"anno prossimo\"\n    },\n    \"day\" : {\n      \"current\" : \"oggi\",\n      \"future\" : {\n        \"one\" : \"tra {0}g\",\n        \"other\" : \"tra {0} gg\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} gg fa\",\n        \"one\" : \"{0}g fa\"\n      },\n      \"next\" : \"domani\",\n      \"previous\" : \"ieri\"\n    },\n    \"hour\" : {\n      \"future\" : \"tra {0} h\",\n      \"current\" : \"quest’ora\",\n      \"past\" : \"{0}h fa\"\n    },\n    \"minute\" : {\n      \"future\" : \"tra {0} min\",\n      \"current\" : \"questo minuto\",\n      \"past\" : \"{0} min fa\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"next\" : \"mese prossimo\",\n      \"past\" : {\n        \"one\" : \"{0} mese fa\",\n        \"other\" : \"{0} mesi fa\"\n      },\n      \"current\" : \"questo mese\",\n      \"previous\" : \"mese scorso\",\n      \"future\" : {\n        \"one\" : \"tra {0} mese\",\n        \"other\" : \"tra {0} mesi\"\n      }\n    },\n    \"now\" : \"ora\",\n    \"day\" : {\n      \"next\" : \"domani\",\n      \"current\" : \"oggi\",\n      \"previous\" : \"ieri\",\n      \"past\" : {\n        \"other\" : \"{0}gg fa\",\n        \"one\" : \"{0}g fa\"\n      },\n      \"future\" : {\n        \"one\" : \"tra {0} g\",\n        \"other\" : \"tra {0} gg\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"anno scorso\",\n      \"current\" : \"quest’anno\",\n      \"next\" : \"anno prossimo\",\n      \"past\" : {\n        \"other\" : \"{0} anni fa\",\n        \"one\" : \"{0} anno fa\"\n      },\n      \"future\" : {\n        \"one\" : \"tra {0} anno\",\n        \"other\" : \"tra {0} anni\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : \"{0}h fa\",\n      \"future\" : \"tra {0}h\",\n      \"current\" : \"quest’ora\"\n    },\n    \"minute\" : {\n      \"future\" : \"tra {0} min\",\n      \"current\" : \"questo minuto\",\n      \"past\" : \"{0} min fa\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"{0}s fa\",\n        \"other\" : \"{0} sec. fa\"\n      },\n      \"future\" : {\n        \"one\" : \"tra {0}s\",\n        \"other\" : \"tra {0} sec.\"\n      },\n      \"current\" : \"ora\"\n    },\n    \"quarter\" : {\n      \"current\" : \"questo trimestre\",\n      \"future\" : \"tra {0} trim.\",\n      \"previous\" : \"trimestre scorso\",\n      \"next\" : \"trimestre prossimo\",\n      \"past\" : \"{0} trim. fa\"\n    },\n    \"week\" : {\n      \"future\" : \"tra {0} sett.\",\n      \"previous\" : \"settimana scorsa\",\n      \"next\" : \"settimana prossima\",\n      \"past\" : \"{0} sett. fa\",\n      \"current\" : \"questa settimana\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ja.json",
    "content": "{\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} 時間後\",\n      \"past\" : \"{0} 時間前\",\n      \"current\" : \"1 時間以内\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} 秒後\",\n      \"past\" : \"{0} 秒前\",\n      \"current\" : \"今\"\n    },\n    \"week\" : {\n      \"next\" : \"翌週\",\n      \"current\" : \"今週\",\n      \"previous\" : \"先週\",\n      \"future\" : \"{0} 週間後\",\n      \"past\" : \"{0} 週間前\"\n    },\n    \"minute\" : {\n      \"current\" : \"1 分以内\",\n      \"past\" : \"{0} 分前\",\n      \"future\" : \"{0} 分後\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"past\" : \"{0} 年前\",\n      \"future\" : \"{0} 年後\",\n      \"previous\" : \"昨年\",\n      \"next\" : \"翌年\"\n    },\n    \"quarter\" : {\n      \"next\" : \"翌四半期\",\n      \"current\" : \"今四半期\",\n      \"future\" : \"{0} 四半期後\",\n      \"previous\" : \"前四半期\",\n      \"past\" : \"{0} 四半期前\"\n    },\n    \"month\" : {\n      \"previous\" : \"先月\",\n      \"future\" : \"{0} か月後\",\n      \"current\" : \"今月\",\n      \"next\" : \"翌月\",\n      \"past\" : \"{0} か月前\"\n    },\n    \"day\" : {\n      \"next\" : \"明日\",\n      \"past\" : \"{0} 日前\",\n      \"current\" : \"今日\",\n      \"future\" : \"{0} 日後\",\n      \"previous\" : \"昨日\"\n    },\n    \"now\" : \"今\"\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"current\" : \"今週\",\n      \"next\" : \"翌週\",\n      \"past\" : \"{0}週間前\",\n      \"previous\" : \"先週\",\n      \"future\" : \"{0}週間後\"\n    },\n    \"minute\" : {\n      \"current\" : \"1 分以内\",\n      \"past\" : \"{0}分前\",\n      \"future\" : \"{0}分後\"\n    },\n    \"month\" : {\n      \"current\" : \"今月\",\n      \"previous\" : \"先月\",\n      \"past\" : \"{0}か月前\",\n      \"next\" : \"翌月\",\n      \"future\" : \"{0}か月後\"\n    },\n    \"now\" : \"今\",\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"next\" : \"翌年\",\n      \"past\" : \"{0}年前\",\n      \"future\" : \"{0}年後\",\n      \"previous\" : \"昨年\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0}時間後\",\n      \"current\" : \"1 時間以内\",\n      \"past\" : \"{0}時間前\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"前四半期\",\n      \"current\" : \"今四半期\",\n      \"past\" : \"{0}四半期前\",\n      \"future\" : \"{0}四半期後\",\n      \"next\" : \"翌四半期\"\n    },\n    \"second\" : {\n      \"past\" : \"{0}秒前\",\n      \"current\" : \"今\",\n      \"future\" : \"{0}秒後\"\n    },\n    \"day\" : {\n      \"past\" : \"{0}日前\",\n      \"current\" : \"今日\",\n      \"future\" : \"{0}日後\",\n      \"previous\" : \"昨日\",\n      \"next\" : \"明日\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"previous\" : \"先月\",\n      \"current\" : \"今月\",\n      \"next\" : \"翌月\",\n      \"past\" : \"{0} か月前\",\n      \"future\" : \"{0} か月後\"\n    },\n    \"now\" : \"今\",\n    \"day\" : {\n      \"next\" : \"明日\",\n      \"current\" : \"今日\",\n      \"previous\" : \"昨日\",\n      \"past\" : \"{0} 日前\",\n      \"future\" : \"{0} 日後\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"future\" : \"{0} 年後\",\n      \"previous\" : \"昨年\",\n      \"next\" : \"翌年\",\n      \"past\" : \"{0} 年前\"\n    },\n    \"hour\" : {\n      \"current\" : \"1 時間以内\",\n      \"past\" : \"{0} 時間前\",\n      \"future\" : \"{0} 時間後\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} 分前\",\n      \"future\" : \"{0} 分後\",\n      \"current\" : \"1 分以内\"\n    },\n    \"second\" : {\n      \"current\" : \"今\",\n      \"past\" : \"{0} 秒前\",\n      \"future\" : \"{0} 秒後\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} 四半期後\",\n      \"previous\" : \"前四半期\",\n      \"next\" : \"翌四半期\",\n      \"past\" : \"{0} 四半期前\",\n      \"current\" : \"今四半期\"\n    },\n    \"week\" : {\n      \"next\" : \"翌週\",\n      \"past\" : \"{0} 週間前\",\n      \"current\" : \"今週\",\n      \"previous\" : \"先週\",\n      \"future\" : \"{0} 週間後\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/jgo.json",
    "content": "{\n  \"narrow\" : {\n    \"now\" : \"now\",\n    \"week\" : {\n      \"next\" : \"next week\",\n      \"current\" : \"this week\",\n      \"past\" : \"Ɛ́ gɛ́ mɔ {0} ŋgap-mbi\",\n      \"future\" : \"Nǔu ŋgap-mbi {0}\",\n      \"previous\" : \"last week\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"day\" : {\n      \"future\" : \"Nǔu lɛ́Ꞌ {0}\",\n      \"previous\" : \"yesterday\",\n      \"next\" : \"tomorrow\",\n      \"past\" : \"Ɛ́ gɛ́ mɔ́ lɛ́Ꞌ {0}\",\n      \"current\" : \"lɔꞋɔ\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"ɛ́ gɛ mɔ́ {0} háwa\",\n      \"future\" : \"nǔu háwa {0}\"\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"now\",\n      \"past\" : \"-{0} s\"\n    },\n    \"month\" : {\n      \"past\" : \"ɛ́ gɛ́ mɔ́ pɛsaŋ {0}\",\n      \"future\" : \"Nǔu {0} saŋ\",\n      \"current\" : \"this month\",\n      \"previous\" : \"last month\",\n      \"next\" : \"next month\"\n    },\n    \"minute\" : {\n      \"future\" : \"nǔu {0} minút\",\n      \"current\" : \"this minute\",\n      \"past\" : \"ɛ́ gɛ́ mɔ́ minút {0}\"\n    },\n    \"year\" : {\n      \"next\" : \"next year\",\n      \"future\" : \"Nǔu ŋguꞋ {0}\",\n      \"previous\" : \"last year\",\n      \"current\" : \"this year\",\n      \"past\" : \"Ɛ́gɛ́ mɔ́ ŋguꞋ {0}\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"future\" : \"Nǔu lɛ́Ꞌ {0}\",\n      \"past\" : \"Ɛ́ gɛ́ mɔ́ lɛ́Ꞌ {0}\",\n      \"current\" : \"lɔꞋɔ\",\n      \"next\" : \"tomorrow\",\n      \"previous\" : \"yesterday\"\n    },\n    \"second\" : {\n      \"past\" : \"-{0} s\",\n      \"current\" : \"now\",\n      \"future\" : \"+{0} s\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"future\" : \"+{0} Q\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"month\" : {\n      \"future\" : \"Nǔu {0} saŋ\",\n      \"previous\" : \"last month\",\n      \"past\" : \"ɛ́ gɛ́ mɔ́ pɛsaŋ {0}\",\n      \"next\" : \"next month\",\n      \"current\" : \"this month\"\n    },\n    \"week\" : {\n      \"future\" : \"Nǔu ŋgap-mbi {0}\",\n      \"past\" : \"Ɛ́ gɛ́ mɔ {0} ŋgap-mbi\",\n      \"current\" : \"this week\",\n      \"previous\" : \"last week\",\n      \"next\" : \"next week\"\n    },\n    \"hour\" : {\n      \"future\" : \"nǔu háwa {0}\",\n      \"current\" : \"this hour\",\n      \"past\" : \"ɛ́ gɛ mɔ́ {0} háwa\"\n    },\n    \"minute\" : {\n      \"future\" : \"nǔu {0} minút\",\n      \"past\" : \"ɛ́ gɛ́ mɔ́ minút {0}\",\n      \"current\" : \"this minute\"\n    },\n    \"now\" : \"now\",\n    \"year\" : {\n      \"future\" : \"Nǔu ŋguꞋ {0}\",\n      \"next\" : \"next year\",\n      \"past\" : \"Ɛ́gɛ́ mɔ́ ŋguꞋ {0}\",\n      \"previous\" : \"last year\",\n      \"current\" : \"this year\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : \"nǔu háwa {0}\",\n      \"current\" : \"this hour\",\n      \"past\" : \"ɛ́ gɛ mɔ́ {0} háwa\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\"\n    },\n    \"day\" : {\n      \"current\" : \"lɔꞋɔ\",\n      \"past\" : \"Ɛ́ gɛ́ mɔ́ lɛ́Ꞌ {0}\",\n      \"future\" : \"Nǔu lɛ́Ꞌ {0}\",\n      \"next\" : \"tomorrow\",\n      \"previous\" : \"yesterday\"\n    },\n    \"week\" : {\n      \"current\" : \"this week\",\n      \"past\" : \"Ɛ́ gɛ́ mɔ {0} ŋgap-mbi\",\n      \"future\" : \"Nǔu ŋgap-mbi {0}\",\n      \"next\" : \"next week\",\n      \"previous\" : \"last week\"\n    },\n    \"minute\" : {\n      \"past\" : \"ɛ́ gɛ́ mɔ́ minút {0}\",\n      \"future\" : \"nǔu {0} minút\",\n      \"current\" : \"this minute\"\n    },\n    \"second\" : {\n      \"past\" : \"-{0} s\",\n      \"current\" : \"now\",\n      \"future\" : \"+{0} s\"\n    },\n    \"month\" : {\n      \"current\" : \"this month\",\n      \"future\" : \"Nǔu {0} saŋ\",\n      \"previous\" : \"last month\",\n      \"next\" : \"next month\",\n      \"past\" : \"ɛ́ gɛ́ mɔ́ pɛsaŋ {0}\"\n    },\n    \"year\" : {\n      \"future\" : \"Nǔu ŋguꞋ {0}\",\n      \"previous\" : \"last year\",\n      \"next\" : \"next year\",\n      \"current\" : \"this year\",\n      \"past\" : \"Ɛ́gɛ́ mɔ́ ŋguꞋ {0}\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ka.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"current\" : \"ამ კვარტალში\",\n      \"past\" : \"{0} კვარტ. წინ\",\n      \"next\" : \"შემდეგ კვარტალში\",\n      \"future\" : \"{0} კვარტალში\",\n      \"previous\" : \"გასულ კვარტალში\"\n    },\n    \"day\" : {\n      \"next\" : \"ხვალ\",\n      \"previous\" : \"გუშინ\",\n      \"future\" : \"{0} დღეში\",\n      \"past\" : \"{0} დღის წინ\",\n      \"current\" : \"დღეს\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} წლის წინ\",\n      \"previous\" : \"გასულ წელს\",\n      \"future\" : \"{0} წელში\",\n      \"next\" : \"მომავალ წელს\",\n      \"current\" : \"ამ წელს\"\n    },\n    \"minute\" : {\n      \"current\" : \"ამ წუთში\",\n      \"past\" : \"{0} წთ წინ\",\n      \"future\" : \"{0} წუთში\"\n    },\n    \"now\" : \"ახლა\",\n    \"week\" : {\n      \"current\" : \"ამ კვირაში\",\n      \"previous\" : \"გასულ კვირაში\",\n      \"past\" : \"{0} კვირის წინ\",\n      \"next\" : \"მომავალ კვირაში\",\n      \"future\" : \"{0} კვირაში\"\n    },\n    \"second\" : {\n      \"current\" : \"ახლა\",\n      \"future\" : \"{0} წამში\",\n      \"past\" : \"{0} წმ წინ\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} თვეში\",\n      \"current\" : \"ამ თვეში\",\n      \"past\" : \"{0} თვის წინ\",\n      \"previous\" : \"გასულ თვეს\",\n      \"next\" : \"მომავალ თვეს\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} სთ წინ\",\n      \"future\" : \"{0} საათში\",\n      \"current\" : \"ამ საათში\"\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"next\" : \"მომავალ წელს\",\n      \"previous\" : \"გასულ წელს\",\n      \"past\" : \"{0} წლის წინ\",\n      \"future\" : \"{0} წელიწადში\",\n      \"current\" : \"ამ წელს\"\n    },\n    \"now\" : \"ახლა\",\n    \"quarter\" : {\n      \"next\" : \"შემდეგ კვარტალში\",\n      \"past\" : \"{0} კვარტალის წინ\",\n      \"future\" : \"{0} კვარტალში\",\n      \"current\" : \"ამ კვარტალში\",\n      \"previous\" : \"გასულ კვარტალში\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} თვის წინ\",\n      \"next\" : \"მომავალ თვეს\",\n      \"previous\" : \"გასულ თვეს\",\n      \"future\" : \"{0} თვეში\",\n      \"current\" : \"ამ თვეში\"\n    },\n    \"second\" : {\n      \"current\" : \"ახლა\",\n      \"future\" : \"{0} წამში\",\n      \"past\" : \"{0} წამის წინ\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} კვირის წინ\",\n      \"previous\" : \"გასულ კვირაში\",\n      \"future\" : \"{0} კვირაში\",\n      \"next\" : \"მომავალ კვირაში\",\n      \"current\" : \"ამ კვირაში\"\n    },\n    \"day\" : {\n      \"next\" : \"ხვალ\",\n      \"future\" : \"{0} დღეში\",\n      \"previous\" : \"გუშინ\",\n      \"current\" : \"დღეს\",\n      \"past\" : \"{0} დღის წინ\"\n    },\n    \"minute\" : {\n      \"current\" : \"ამ წუთში\",\n      \"future\" : \"{0} წუთში\",\n      \"past\" : \"{0} წუთის წინ\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} საათის წინ\",\n      \"future\" : \"{0} საათში\",\n      \"current\" : \"ამ საათში\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} წთ წინ\",\n      \"future\" : \"{0} წუთში\",\n      \"current\" : \"ამ წუთში\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} კვირაში\",\n      \"previous\" : \"გასულ კვირაში\",\n      \"next\" : \"მომავალ კვირაში\",\n      \"current\" : \"ამ კვირაში\",\n      \"past\" : \"{0} კვ. წინ\"\n    },\n    \"year\" : {\n      \"current\" : \"ამ წელს\",\n      \"previous\" : \"გასულ წელს\",\n      \"future\" : \"{0} წელში\",\n      \"past\" : \"{0} წლის წინ\",\n      \"next\" : \"მომავალ წელს\"\n    },\n    \"month\" : {\n      \"next\" : \"მომავალ თვეს\",\n      \"past\" : \"{0} თვის წინ\",\n      \"future\" : \"{0} თვეში\",\n      \"previous\" : \"გასულ თვეს\",\n      \"current\" : \"ამ თვეში\"\n    },\n    \"quarter\" : {\n      \"next\" : \"შემდეგ კვარტალში\",\n      \"past\" : \"{0} კვარტ. წინ\",\n      \"previous\" : \"გასულ კვარტალში\",\n      \"current\" : \"ამ კვარტალში\",\n      \"future\" : \"{0} კვარტალში\"\n    },\n    \"day\" : {\n      \"current\" : \"დღეს\",\n      \"previous\" : \"გუშინ\",\n      \"past\" : \"{0} დღის წინ\",\n      \"next\" : \"ხვალ\",\n      \"future\" : \"{0} დღეში\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} სთ წინ\",\n      \"future\" : \"{0} საათში\",\n      \"current\" : \"ამ საათში\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} წმ წინ\",\n      \"future\" : \"{0} წამში\",\n      \"current\" : \"ახლა\"\n    },\n    \"now\" : \"ახლა\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/kea.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"manha\",\n      \"future\" : \"di li {0} dia\",\n      \"previous\" : \"onti\",\n      \"current\" : \"oji\",\n      \"past\" : \"a ten {0} dia\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"a ten {0} trim.\",\n      \"future\" : \"di li {0} trim.\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"a ten {0} ora\",\n      \"future\" : \"di li {0} ora\"\n    },\n    \"year\" : {\n      \"next\" : \"prósimu anu\",\n      \"past\" : \"a ten {0} anu\",\n      \"current\" : \"es anu li\",\n      \"previous\" : \"anu pasadu\",\n      \"future\" : \"di li {0} anu\"\n    },\n    \"now\" : \"now\",\n    \"month\" : {\n      \"current\" : \"es mes li\",\n      \"future\" : \"di li {0} mes\",\n      \"past\" : \"a ten {0} mes\",\n      \"next\" : \"prósimu mes\",\n      \"previous\" : \"mes pasadu\"\n    },\n    \"week\" : {\n      \"previous\" : \"simana pasadu\",\n      \"current\" : \"es simana li\",\n      \"past\" : \"a ten {0} sim.\",\n      \"future\" : \"di li {0} sim.\",\n      \"next\" : \"prósimu simana\"\n    },\n    \"minute\" : {\n      \"past\" : \"a ten {0} m\",\n      \"future\" : \"di li {0} m\",\n      \"current\" : \"this minute\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"a ten {0} s\",\n      \"future\" : \"di li {0} s\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"onti\",\n      \"current\" : \"oji\",\n      \"next\" : \"manha\",\n      \"past\" : \"a ten {0} dia\",\n      \"future\" : \"di li {0} dia\"\n    },\n    \"week\" : {\n      \"current\" : \"es simana li\",\n      \"future\" : \"di li {0} simana\",\n      \"past\" : \"a ten {0} simana\",\n      \"previous\" : \"simana pasadu\",\n      \"next\" : \"prósimu simana\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : \"a ten {0} minutu\",\n      \"future\" : \"di li {0} minutu\"\n    },\n    \"month\" : {\n      \"future\" : \"di li {0} mes\",\n      \"next\" : \"prósimu mes\",\n      \"previous\" : \"mes pasadu\",\n      \"current\" : \"es mes li\",\n      \"past\" : \"a ten {0} mes\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"a ten {0} ora\",\n      \"future\" : \"di li {0} ora\"\n    },\n    \"year\" : {\n      \"past\" : \"a ten {0} anu\",\n      \"future\" : \"di li {0} anu\",\n      \"previous\" : \"anu pasadu\",\n      \"next\" : \"prósimu anu\",\n      \"current\" : \"es anu li\"\n    },\n    \"second\" : {\n      \"future\" : \"di li {0} sigundu\",\n      \"current\" : \"now\",\n      \"past\" : \"a ten {0} sigundu\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"past\" : \"a ten {0} trimestri\",\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\",\n      \"future\" : \"di li {0} trimestri\",\n      \"next\" : \"next quarter\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"di li {0} trim.\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"a ten {0} trim.\"\n    },\n    \"minute\" : {\n      \"past\" : \"a ten {0} min\",\n      \"current\" : \"this minute\",\n      \"future\" : \"di li {0} min\"\n    },\n    \"year\" : {\n      \"next\" : \"prósimu anu\",\n      \"future\" : \"di li {0} anu\",\n      \"current\" : \"es anu li\",\n      \"past\" : \"a ten {0} anu\",\n      \"previous\" : \"anu pasadu\"\n    },\n    \"second\" : {\n      \"future\" : \"di li {0} sig\",\n      \"current\" : \"now\",\n      \"past\" : \"a ten {0} sig\"\n    },\n    \"hour\" : {\n      \"future\" : \"di li {0} ora\",\n      \"current\" : \"this hour\",\n      \"past\" : \"a ten {0} ora\"\n    },\n    \"now\" : \"now\",\n    \"month\" : {\n      \"previous\" : \"mes pasadu\",\n      \"next\" : \"prósimu mes\",\n      \"past\" : \"a ten {0} mes\",\n      \"current\" : \"es mes li\",\n      \"future\" : \"di li {0} mes\"\n    },\n    \"week\" : {\n      \"previous\" : \"simana pasadu\",\n      \"current\" : \"es simana li\",\n      \"next\" : \"prósimu simana\",\n      \"past\" : \"a ten {0} sim.\",\n      \"future\" : \"di li {0} sim.\"\n    },\n    \"day\" : {\n      \"next\" : \"manha\",\n      \"past\" : \"a ten {0} dia\",\n      \"future\" : \"di li {0} dia\",\n      \"previous\" : \"onti\",\n      \"current\" : \"oji\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/kk.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"ертең\",\n      \"future\" : \"{0} күннен кейін\",\n      \"previous\" : \"кеше\",\n      \"current\" : \"бүгін\",\n      \"past\" : \"{0} күн бұрын\"\n    },\n    \"quarter\" : {\n      \"next\" : \"келесі тоқсан\",\n      \"past\" : \"{0} тқс. бұрын\",\n      \"future\" : \"{0} тқс. кейін\",\n      \"previous\" : \"өткен тоқсан\",\n      \"current\" : \"осы тоқсан\"\n    },\n    \"hour\" : {\n      \"current\" : \"осы сағат\",\n      \"past\" : \"{0} сағ. бұрын\",\n      \"future\" : \"{0} сағ. кейін\"\n    },\n    \"year\" : {\n      \"next\" : \"келесі жыл\",\n      \"past\" : \"{0} ж. бұрын\",\n      \"current\" : \"биылғы жыл\",\n      \"previous\" : \"былтырғы жыл\",\n      \"future\" : \"{0} ж. кейін\"\n    },\n    \"now\" : \"қазір\",\n    \"month\" : {\n      \"current\" : \"осы ай\",\n      \"future\" : \"{0} айдан кейін\",\n      \"past\" : \"{0} ай бұрын\",\n      \"next\" : \"келесі ай\",\n      \"previous\" : \"өткен ай\"\n    },\n    \"week\" : {\n      \"previous\" : \"өткен апта\",\n      \"current\" : \"осы апта\",\n      \"past\" : \"{0} ап. бұрын\",\n      \"future\" : \"{0} ап. кейін\",\n      \"next\" : \"келесі апта\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} мин. бұрын\",\n      \"current\" : \"осы минут\",\n      \"future\" : \"{0} мин. кейін\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} сек. кейін\",\n      \"current\" : \"қазір\",\n      \"past\" : \"{0} сек. бұрын\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"кеше\",\n      \"current\" : \"бүгін\",\n      \"next\" : \"ертең\",\n      \"past\" : \"{0} күн бұрын\",\n      \"future\" : \"{0} күннен кейін\"\n    },\n    \"week\" : {\n      \"current\" : \"осы апта\",\n      \"future\" : \"{0} аптадан кейін\",\n      \"past\" : \"{0} апта бұрын\",\n      \"previous\" : \"өткен апта\",\n      \"next\" : \"келесі апта\"\n    },\n    \"minute\" : {\n      \"current\" : \"осы минут\",\n      \"past\" : \"{0} минут бұрын\",\n      \"future\" : \"{0} минуттан кейін\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} айдан кейін\",\n      \"next\" : \"келесі ай\",\n      \"previous\" : \"өткен ай\",\n      \"current\" : \"осы ай\",\n      \"past\" : \"{0} ай бұрын\"\n    },\n    \"hour\" : {\n      \"current\" : \"осы сағат\",\n      \"past\" : \"{0} сағат бұрын\",\n      \"future\" : \"{0} сағаттан кейін\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} жыл бұрын\",\n      \"future\" : \"{0} жылдан кейін\",\n      \"previous\" : \"былтырғы жыл\",\n      \"next\" : \"келесі жыл\",\n      \"current\" : \"биылғы жыл\"\n    },\n    \"second\" : {\n      \"current\" : \"қазір\",\n      \"past\" : \"{0} секунд бұрын\",\n      \"future\" : \"{0} секундтан кейін\"\n    },\n    \"now\" : \"қазір\",\n    \"quarter\" : {\n      \"past\" : \"{0} тоқсан бұрын\",\n      \"current\" : \"осы тоқсан\",\n      \"previous\" : \"өткен тоқсан\",\n      \"future\" : \"{0} тоқсаннан кейін\",\n      \"next\" : \"келесі тоқсан\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} тқс. кейін\",\n      \"next\" : \"келесі тоқсан\",\n      \"previous\" : \"өткен тоқсан\",\n      \"current\" : \"осы тоқсан\",\n      \"past\" : \"{0} тқс. бұрын\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} мин. бұрын\",\n      \"future\" : \"{0} мин. кейін\",\n      \"current\" : \"осы минут\"\n    },\n    \"year\" : {\n      \"next\" : \"келесі жыл\",\n      \"future\" : \"{0} ж. кейін\",\n      \"current\" : \"биылғы жыл\",\n      \"past\" : \"{0} ж. бұрын\",\n      \"previous\" : \"былтырғы жыл\"\n    },\n    \"second\" : {\n      \"current\" : \"қазір\",\n      \"past\" : \"{0} сек. бұрын\",\n      \"future\" : \"{0} сек. кейін\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} сағ. кейін\",\n      \"current\" : \"осы сағат\",\n      \"past\" : \"{0} сағ. бұрын\"\n    },\n    \"now\" : \"қазір\",\n    \"month\" : {\n      \"previous\" : \"өткен ай\",\n      \"next\" : \"келесі ай\",\n      \"past\" : \"{0} ай бұрын\",\n      \"current\" : \"осы ай\",\n      \"future\" : \"{0} айдан кейін\"\n    },\n    \"week\" : {\n      \"previous\" : \"өткен апта\",\n      \"current\" : \"осы апта\",\n      \"next\" : \"келесі апта\",\n      \"past\" : \"{0} ап. бұрын\",\n      \"future\" : \"{0} ап. кейін\"\n    },\n    \"day\" : {\n      \"next\" : \"ертең\",\n      \"past\" : \"{0} күн бұрын\",\n      \"future\" : \"{0} күннен кейін\",\n      \"previous\" : \"кеше\",\n      \"current\" : \"бүгін\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/kl.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\"\n    },\n    \"year\" : {\n      \"previous\" : \"last year\",\n      \"next\" : \"next year\",\n      \"future\" : \"om {0} ukioq\",\n      \"current\" : \"this year\",\n      \"past\" : \"for {0} ukioq siden\"\n    },\n    \"week\" : {\n      \"future\" : \"om {0} sapaatip-akunnera\",\n      \"previous\" : \"last week\",\n      \"next\" : \"next week\",\n      \"past\" : \"for {0} sapaatip-akunnera siden\",\n      \"current\" : \"this week\"\n    },\n    \"day\" : {\n      \"current\" : \"today\",\n      \"past\" : \"for {0} ulloq unnuarlu siden\",\n      \"next\" : \"tomorrow\",\n      \"future\" : \"om {0} ulloq unnuarlu\",\n      \"previous\" : \"yesterday\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"for {0} nalunaaquttap-akunnera siden\",\n      \"future\" : \"om {0} nalunaaquttap-akunnera\"\n    },\n    \"minute\" : {\n      \"future\" : \"om {0} minutsi\",\n      \"current\" : \"this minute\",\n      \"past\" : \"for {0} minutsi siden\"\n    },\n    \"month\" : {\n      \"next\" : \"next month\",\n      \"current\" : \"this month\",\n      \"past\" : \"for {0} qaammat siden\",\n      \"future\" : \"om {0} qaammat\",\n      \"previous\" : \"last month\"\n    },\n    \"now\" : \"now\",\n    \"second\" : {\n      \"future\" : \"om {0} sekundi\",\n      \"current\" : \"now\",\n      \"past\" : \"for {0} sekundi siden\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"for {0} minutsi siden\",\n      \"future\" : \"om {0} minutsi\",\n      \"current\" : \"this minute\"\n    },\n    \"week\" : {\n      \"current\" : \"this week\",\n      \"past\" : \"for {0} sapaatip-akunnera siden\",\n      \"future\" : \"om {0} sapaatip-akunnera\",\n      \"next\" : \"next week\",\n      \"previous\" : \"last week\"\n    },\n    \"year\" : {\n      \"current\" : \"this year\",\n      \"future\" : \"om {0} ukioq\",\n      \"past\" : \"for {0} ukioq siden\",\n      \"next\" : \"next year\",\n      \"previous\" : \"last year\"\n    },\n    \"day\" : {\n      \"next\" : \"tomorrow\",\n      \"current\" : \"today\",\n      \"previous\" : \"yesterday\",\n      \"past\" : \"for {0} ulloq unnuarlu siden\",\n      \"future\" : \"om {0} ulloq unnuarlu\"\n    },\n    \"hour\" : {\n      \"future\" : \"om {0} nalunaaquttap-akunnera\",\n      \"current\" : \"this hour\",\n      \"past\" : \"for {0} nalunaaquttap-akunnera siden\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"second\" : {\n      \"past\" : \"for {0} sekundi siden\",\n      \"current\" : \"now\",\n      \"future\" : \"om {0} sekundi\"\n    },\n    \"month\" : {\n      \"current\" : \"this month\",\n      \"past\" : \"for {0} qaammat siden\",\n      \"future\" : \"om {0} qaammat\",\n      \"next\" : \"next month\",\n      \"previous\" : \"last month\"\n    },\n    \"now\" : \"now\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"om {0} nalunaaquttap-akunnera\",\n      \"current\" : \"this hour\",\n      \"past\" : \"for {0} nalunaaquttap-akunnera siden\"\n    },\n    \"day\" : {\n      \"next\" : \"tomorrow\",\n      \"past\" : \"for {0} ulloq unnuarlu siden\",\n      \"previous\" : \"yesterday\",\n      \"future\" : \"om {0} ulloq unnuarlu\",\n      \"current\" : \"today\"\n    },\n    \"second\" : {\n      \"past\" : \"for {0} sekundi siden\",\n      \"current\" : \"now\",\n      \"future\" : \"om {0} sekundi\"\n    },\n    \"week\" : {\n      \"future\" : \"om {0} sapaatip-akunnera\",\n      \"past\" : \"for {0} sapaatip-akunnera siden\",\n      \"current\" : \"this week\",\n      \"next\" : \"next week\",\n      \"previous\" : \"last week\"\n    },\n    \"minute\" : {\n      \"future\" : \"om {0} minutsi\",\n      \"past\" : \"for {0} minutsi siden\",\n      \"current\" : \"this minute\"\n    },\n    \"month\" : {\n      \"future\" : \"om {0} qaammat\",\n      \"past\" : \"for {0} qaammat siden\",\n      \"current\" : \"this month\",\n      \"previous\" : \"last month\",\n      \"next\" : \"next month\"\n    },\n    \"now\" : \"now\",\n    \"year\" : {\n      \"current\" : \"this year\",\n      \"next\" : \"next year\",\n      \"previous\" : \"last year\",\n      \"future\" : \"om {0} ukioq\",\n      \"past\" : \"for {0} ukioq siden\"\n    },\n    \"quarter\" : {\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/km.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"ថ្ងៃស្អែក\",\n      \"future\" : \"{0} ថ្ងៃទៀត\",\n      \"previous\" : \"ម្សិលមិញ\",\n      \"current\" : \"ថ្ងៃ​នេះ\",\n      \"past\" : \"{0} ថ្ងៃ​​មុន\"\n    },\n    \"quarter\" : {\n      \"next\" : \"ត្រីមាស​ក្រោយ\",\n      \"past\" : \"{0} ត្រីមាស​មុន\",\n      \"future\" : \"{0} ត្រីមាសទៀត\",\n      \"previous\" : \"ត្រីមាស​មុន\",\n      \"current\" : \"ត្រីមាស​នេះ\"\n    },\n    \"hour\" : {\n      \"current\" : \"ម៉ោងនេះ\",\n      \"future\" : \"{0} ម៉ោងទៀត\",\n      \"past\" : \"{0} ម៉ោង​មុន\"\n    },\n    \"year\" : {\n      \"next\" : \"ឆ្នាំ​ក្រោយ\",\n      \"past\" : \"{0} ឆ្នាំ​មុន\",\n      \"current\" : \"ឆ្នាំ​នេះ\",\n      \"previous\" : \"ឆ្នាំ​មុន\",\n      \"future\" : \"{0} ឆ្នាំទៀត\"\n    },\n    \"now\" : \"ឥឡូវ\",\n    \"month\" : {\n      \"current\" : \"ខែ​នេះ\",\n      \"future\" : \"{0} ខែទៀត\",\n      \"past\" : \"{0} ខែមុន\",\n      \"next\" : \"ខែ​ក្រោយ\",\n      \"previous\" : \"ខែ​មុន\"\n    },\n    \"week\" : {\n      \"previous\" : \"សប្ដាហ៍​មុន\",\n      \"current\" : \"សប្ដាហ៍​នេះ\",\n      \"past\" : \"{0} សប្ដាហ៍​មុន\",\n      \"future\" : \"{0} សប្ដាហ៍ទៀត\",\n      \"next\" : \"សប្ដាហ៍​ក្រោយ\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} នាទី​​មុន\",\n      \"future\" : \"{0} នាទីទៀត\",\n      \"current\" : \"នាទីនេះ\"\n    },\n    \"second\" : {\n      \"current\" : \"ឥឡូវ\",\n      \"past\" : \"{0} វិនាទី​មុន\",\n      \"future\" : \"{0} វិនាទីទៀត\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"ម្សិលមិញ\",\n      \"current\" : \"ថ្ងៃ​នេះ\",\n      \"next\" : \"ថ្ងៃ​ស្អែក\",\n      \"past\" : \"{0} ថ្ងៃ​មុន\",\n      \"future\" : \"{0} ថ្ងៃទៀត\"\n    },\n    \"week\" : {\n      \"current\" : \"សប្ដាហ៍​នេះ\",\n      \"future\" : \"{0} សប្ដាហ៍ទៀត\",\n      \"past\" : \"{0} សប្ដាហ៍​មុន\",\n      \"previous\" : \"សប្ដាហ៍​មុន\",\n      \"next\" : \"សប្ដាហ៍​ក្រោយ\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} នាទី​មុន\",\n      \"future\" : \"{0} នាទីទៀត\",\n      \"current\" : \"នាទីនេះ\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ខែទៀត\",\n      \"next\" : \"ខែ​ក្រោយ\",\n      \"previous\" : \"ខែ​មុន\",\n      \"current\" : \"ខែ​នេះ\",\n      \"past\" : \"{0} ខែមុន\"\n    },\n    \"hour\" : {\n      \"future\" : \"ក្នុង​រយៈ​ពេល {0} ម៉ោង\",\n      \"current\" : \"ម៉ោងនេះ\",\n      \"past\" : \"{0} ម៉ោង​មុន\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} ឆ្នាំ​មុន\",\n      \"future\" : \"{0} ឆ្នាំទៀត\",\n      \"previous\" : \"ឆ្នាំ​មុន\",\n      \"next\" : \"ឆ្នាំ​ក្រោយ\",\n      \"current\" : \"ឆ្នាំ​នេះ\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} វិនាទីទៀត\",\n      \"current\" : \"ឥឡូវ\",\n      \"past\" : \"{0} វិនាទី​មុន\"\n    },\n    \"now\" : \"ឥឡូវ\",\n    \"quarter\" : {\n      \"past\" : \"{0} ត្រីមាស​មុន\",\n      \"current\" : \"ត្រីមាស​នេះ\",\n      \"previous\" : \"ត្រីមាស​មុន\",\n      \"future\" : \"{0} ត្រីមាសទៀត\",\n      \"next\" : \"ត្រីមាស​ក្រោយ\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} ត្រីមាសទៀត\",\n      \"next\" : \"ត្រីមាស​ក្រោយ\",\n      \"previous\" : \"ត្រីមាស​មុន\",\n      \"current\" : \"ត្រីមាស​នេះ\",\n      \"past\" : \"{0} ត្រីមាស​មុន\"\n    },\n    \"minute\" : {\n      \"current\" : \"នាទីនេះ\",\n      \"past\" : \"{0} នាទី​​មុន\",\n      \"future\" : \"{0} នាទីទៀត\"\n    },\n    \"year\" : {\n      \"next\" : \"ឆ្នាំ​ក្រោយ\",\n      \"future\" : \"{0} ឆ្នាំទៀត\",\n      \"current\" : \"ឆ្នាំ​នេះ\",\n      \"past\" : \"{0} ឆ្នាំ​មុន\",\n      \"previous\" : \"ឆ្នាំ​មុន\"\n    },\n    \"second\" : {\n      \"current\" : \"ឥឡូវ\",\n      \"past\" : \"{0} វិនាទី​មុន\",\n      \"future\" : \"{0} វិនាទីទៀត\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ម៉ោង​មុន\",\n      \"current\" : \"ម៉ោងនេះ\",\n      \"future\" : \"{0} ម៉ោងទៀត\"\n    },\n    \"now\" : \"ឥឡូវ\",\n    \"month\" : {\n      \"previous\" : \"ខែ​មុន\",\n      \"next\" : \"ខែ​ក្រោយ\",\n      \"past\" : \"{0} ខែមុន\",\n      \"current\" : \"ខែ​នេះ\",\n      \"future\" : \"{0} ខែទៀត\"\n    },\n    \"week\" : {\n      \"previous\" : \"សប្ដាហ៍​មុន\",\n      \"current\" : \"សប្ដាហ៍​នេះ\",\n      \"next\" : \"សប្ដាហ៍​ក្រោយ\",\n      \"past\" : \"{0} សប្ដាហ៍​មុន\",\n      \"future\" : \"{0} សប្ដាហ៍ទៀត\"\n    },\n    \"day\" : {\n      \"next\" : \"ថ្ងៃស្អែក\",\n      \"past\" : \"{0} ថ្ងៃ​​មុន\",\n      \"future\" : \"{0} ថ្ងៃទៀត\",\n      \"previous\" : \"ម្សិលមិញ\",\n      \"current\" : \"ថ្ងៃ​នេះ\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/kn.json",
    "content": "{\n  \"narrow\" : {\n    \"now\" : \"ಈಗ\",\n    \"minute\" : {\n      \"current\" : \"ಈ ನಿಮಿಷ\",\n      \"future\" : {\n        \"one\" : \"{0} ನಿಮಿಷದಲ್ಲಿ\",\n        \"other\" : \"{0} ನಿಮಿಷಗಳಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} ನಿಮಿಷಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ನಿಮಿಷದ ಹಿಂದೆ\"\n      }\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"{0} ವಾರದಲ್ಲಿ\",\n        \"other\" : \"{0} ವಾರಗಳಲ್ಲಿ\"\n      },\n      \"current\" : \"ಈ ವಾರ\",\n      \"previous\" : \"ಕಳೆದ ವಾರ\",\n      \"next\" : \"ಮುಂದಿನ ವಾರ\",\n      \"past\" : {\n        \"one\" : \"{0} ವಾರದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ವಾರಗಳ ಹಿಂದೆ\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"ಈ ಗಂಟೆ\",\n      \"future\" : {\n        \"one\" : \"{0} ಗಂಟೆಯಲ್ಲಿ\",\n        \"other\" : \"{0} ಗಂಟೆಗಳಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} ಗಂಟೆಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ಗಂಟೆ ಹಿಂದೆ\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"ಈ ತಿಂಗಳು\",\n      \"future\" : {\n        \"other\" : \"{0} ತಿಂಗಳುಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ತಿಂಗಳಲ್ಲಿ\"\n      },\n      \"previous\" : \"ಕಳೆದ ತಿಂಗಳು\",\n      \"next\" : \"ಮುಂದಿನ ತಿಂಗಳು\",\n      \"past\" : {\n        \"one\" : \"{0} ತಿಂಗಳ ಹಿಂದೆ\",\n        \"other\" : \"{0} ತಿಂಗಳುಗಳ ಹಿಂದೆ\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"{0} ಸೆಕೆಂಡ್‌ನಲ್ಲಿ\",\n        \"other\" : \"{0} ಸೆಕೆಂಡ್‌ಗಳಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} ಸೆಕೆಂಡುಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ಸೆಕೆಂಡ್ ಹಿಂದೆ\"\n      },\n      \"current\" : \"ಈಗ\"\n    },\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"{0} ವರ್ಷದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ವರ್ಷಗಳ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ವರ್ಷಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ವರ್ಷದಲ್ಲಿ\"\n      },\n      \"current\" : \"ಈ ವರ್ಷ\",\n      \"next\" : \"ಮುಂದಿನ ವರ್ಷ\",\n      \"previous\" : \"ಕಳೆದ ವರ್ಷ\"\n    },\n    \"day\" : {\n      \"next\" : \"ನಾಳೆ\",\n      \"future\" : {\n        \"one\" : \"{0} ದಿನದಲ್ಲಿ\",\n        \"other\" : \"{0} ದಿನಗಳಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} ದಿನದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ದಿನಗಳ ಹಿಂದೆ\"\n      },\n      \"current\" : \"ಇಂದು\",\n      \"previous\" : \"ನಿನ್ನೆ\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} ತ್ರೈಮಾಸಿಕಗಳಲ್ಲಿ\",\n      \"current\" : \"ಈ ತ್ರೈಮಾಸಿಕ\",\n      \"next\" : \"ಮುಂದಿನ ತ್ರೈಮಾಸಿಕ\",\n      \"past\" : {\n        \"one\" : \"{0} ತ್ರೈ.ಮಾ. ಹಿಂದೆ\",\n        \"other\" : \"{0} ತ್ರೈಮಾಸಿಕಗಳ ಹಿಂದೆ\"\n      },\n      \"previous\" : \"ಕಳೆದ ತ್ರೈಮಾಸಿಕ\"\n    }\n  },\n  \"long\" : {\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"{0} ಸೆಕೆಂಡ್ ಹಿಂದೆ\",\n        \"other\" : \"{0} ಸೆಕೆಂಡುಗಳ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ಸೆಕೆಂಡ್‌ನಲ್ಲಿ\",\n        \"other\" : \"{0} ಸೆಕೆಂಡ್‌ಗಳಲ್ಲಿ\"\n      },\n      \"current\" : \"ಈಗ\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"other\" : \"{0} ವರ್ಷಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ವರ್ಷದಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} ವರ್ಷದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ವರ್ಷಗಳ ಹಿಂದೆ\"\n      },\n      \"next\" : \"ಮುಂದಿನ ವರ್ಷ\",\n      \"current\" : \"ಈ ವರ್ಷ\",\n      \"previous\" : \"ಹಿಂದಿನ ವರ್ಷ\"\n    },\n    \"day\" : {\n      \"current\" : \"ಇಂದು\",\n      \"next\" : \"ನಾಳೆ\",\n      \"previous\" : \"ನಿನ್ನೆ\",\n      \"past\" : {\n        \"one\" : \"{0} ದಿನದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ದಿನಗಳ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ದಿನದಲ್ಲಿ\",\n        \"other\" : \"{0} ದಿನಗಳಲ್ಲಿ\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"{0} ನಿಮಿಷದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ನಿಮಿಷಗಳ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ನಿಮಿಷದಲ್ಲಿ\",\n        \"other\" : \"{0} ನಿಮಿಷಗಳಲ್ಲಿ\"\n      },\n      \"current\" : \"ಈ ನಿಮಿಷ\"\n    },\n    \"quarter\" : {\n      \"next\" : \"ಮುಂದಿನ ತ್ರೈಮಾಸಿಕ\",\n      \"previous\" : \"ಹಿಂದಿನ ತ್ರೈಮಾಸಿಕ\",\n      \"future\" : {\n        \"one\" : \"{0} ತ್ರೈಮಾಸಿಕದಲ್ಲಿ\",\n        \"other\" : \"{0} ತ್ರೈಮಾಸಿಕಗಳಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} ತ್ರೈಮಾಸಿಕಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ತ್ರೈಮಾಸಿಕದ ಹಿಂದೆ\"\n      },\n      \"current\" : \"ಈ ತ್ರೈಮಾಸಿಕ\"\n    },\n    \"month\" : {\n      \"current\" : \"ಈ ತಿಂಗಳು\",\n      \"next\" : \"ಮುಂದಿನ ತಿಂಗಳು\",\n      \"previous\" : \"ಕಳೆದ ತಿಂಗಳು\",\n      \"past\" : {\n        \"other\" : \"{0} ತಿಂಗಳುಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ತಿಂಗಳ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ತಿಂಗಳುಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ತಿಂಗಳಲ್ಲಿ\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"ಈ ಗಂಟೆ\",\n      \"past\" : {\n        \"other\" : \"{0} ಗಂಟೆಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ಗಂಟೆ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ಗಂಟೆಯಲ್ಲಿ\",\n        \"other\" : \"{0} ಗಂಟೆಗಳಲ್ಲಿ\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"ಮುಂದಿನ ವಾರ\",\n      \"future\" : {\n        \"one\" : \"{0} ವಾರದಲ್ಲಿ\",\n        \"other\" : \"{0} ವಾರಗಳಲ್ಲಿ\"\n      },\n      \"current\" : \"ಈ ವಾರ\",\n      \"previous\" : \"ಕಳೆದ ವಾರ\",\n      \"past\" : {\n        \"other\" : \"{0} ವಾರಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ವಾರದ ಹಿಂದೆ\"\n      }\n    },\n    \"now\" : \"ಈಗ\"\n  },\n  \"short\" : {\n    \"month\" : {\n      \"previous\" : \"ಕಳೆದ ತಿಂಗಳು\",\n      \"current\" : \"ಈ ತಿಂಗಳು\",\n      \"next\" : \"ಮುಂದಿನ ತಿಂಗಳು\",\n      \"past\" : {\n        \"one\" : \"{0} ತಿಂಗಳು ಹಿಂದೆ\",\n        \"other\" : \"{0} ತಿಂಗಳುಗಳ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ತಿಂಗಳುಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ತಿಂಗಳಲ್ಲಿ\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"ಈ ಗಂಟೆ\",\n      \"past\" : {\n        \"other\" : \"{0} ಗಂಟೆಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ಗಂಟೆ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ಗಂಟೆಯಲ್ಲಿ\",\n        \"other\" : \"{0} ಗಂಟೆಗಳಲ್ಲಿ\"\n      }\n    },\n    \"now\" : \"ಈಗ\",\n    \"quarter\" : {\n      \"future\" : {\n        \"one\" : \"{0} ತ್ರೈ.ಮಾ.ದಲ್ಲಿ\",\n        \"other\" : \"{0} ತ್ರೈಮಾಸಿಕಗಳಲ್ಲಿ\"\n      },\n      \"previous\" : \"ಕಳೆದ ತ್ರೈಮಾಸಿಕ\",\n      \"current\" : \"ಈ ತ್ರೈಮಾಸಿಕ\",\n      \"next\" : \"ಮುಂದಿನ ತ್ರೈಮಾಸಿಕ\",\n      \"past\" : {\n        \"one\" : \"{0} ತ್ರೈ.ಮಾ. ಹಿಂದೆ\",\n        \"other\" : \"{0} ತ್ರೈಮಾಸಿಕಗಳ ಹಿಂದೆ\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"ಕಳೆದ ವಾರ\",\n      \"next\" : \"ಮುಂದಿನ ವಾರ\",\n      \"future\" : {\n        \"one\" : \"{0} ವಾರದಲ್ಲಿ\",\n        \"other\" : \"{0} ವಾರಗಳಲ್ಲಿ\"\n      },\n      \"current\" : \"ಈ ವಾರ\",\n      \"past\" : {\n        \"one\" : \"{0} ವಾರದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ವಾರಗಳ ಹಿಂದೆ\"\n      }\n    },\n    \"day\" : {\n      \"current\" : \"ಇಂದು\",\n      \"previous\" : \"ನಿನ್ನೆ\",\n      \"next\" : \"ನಾಳೆ\",\n      \"past\" : {\n        \"other\" : \"{0} ದಿನಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ದಿನದ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ದಿನಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ದಿನದಲ್ಲಿ\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"other\" : \"{0} ನಿಮಿಷಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ನಿಮಿಷದಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} ನಿಮಿಷಗಳ ಹಿಂದೆ\",\n        \"one\" : \"{0} ನಿಮಿಷದ ಹಿಂದೆ\"\n      },\n      \"current\" : \"ಈ ನಿಮಿಷ\"\n    },\n    \"second\" : {\n      \"current\" : \"ಈಗ\",\n      \"past\" : {\n        \"one\" : \"{0} ಸೆಕೆಂಡ್ ಹಿಂದೆ\",\n        \"other\" : \"{0} ಸೆಕೆಂಡುಗಳ ಹಿಂದೆ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ಸೆಕೆಂಡ್‌ನಲ್ಲಿ\",\n        \"other\" : \"{0} ಸೆಕೆಂಡ್‌ಗಳಲ್ಲಿ\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"ಕಳೆದ ವರ್ಷ\",\n      \"next\" : \"ಮುಂದಿನ ವರ್ಷ\",\n      \"current\" : \"ಈ ವರ್ಷ\",\n      \"future\" : {\n        \"other\" : \"{0} ವರ್ಷಗಳಲ್ಲಿ\",\n        \"one\" : \"{0} ವರ್ಷದಲ್ಲಿ\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} ವರ್ಷದ ಹಿಂದೆ\",\n        \"other\" : \"{0} ವರ್ಷಗಳ ಹಿಂದೆ\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ko.json",
    "content": "{\n  \"narrow\" : {\n    \"now\" : \"지금\",\n    \"week\" : {\n      \"next\" : \"다음 주\",\n      \"current\" : \"이번 주\",\n      \"past\" : \"{0}주 전\",\n      \"future\" : \"{0}주 후\",\n      \"previous\" : \"지난주\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"지난 분기\",\n      \"next\" : \"다음 분기\",\n      \"future\" : \"{0}분기 후\",\n      \"current\" : \"이번 분기\",\n      \"past\" : \"{0}분기 전\"\n    },\n    \"day\" : {\n      \"future\" : \"{0}일 후\",\n      \"previous\" : \"어제\",\n      \"next\" : \"내일\",\n      \"past\" : \"{0}일 전\",\n      \"current\" : \"오늘\"\n    },\n    \"hour\" : {\n      \"current\" : \"현재 시간\",\n      \"past\" : \"{0}시간 전\",\n      \"future\" : \"{0}시간 후\"\n    },\n    \"second\" : {\n      \"future\" : \"{0}초 후\",\n      \"current\" : \"지금\",\n      \"past\" : \"{0}초 전\"\n    },\n    \"month\" : {\n      \"past\" : \"{0}개월 전\",\n      \"future\" : \"{0}개월 후\",\n      \"current\" : \"이번 달\",\n      \"previous\" : \"지난달\",\n      \"next\" : \"다음 달\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0}분 후\",\n      \"current\" : \"현재 분\",\n      \"past\" : \"{0}분 전\"\n    },\n    \"year\" : {\n      \"next\" : \"내년\",\n      \"future\" : \"{0}년 후\",\n      \"previous\" : \"작년\",\n      \"current\" : \"올해\",\n      \"past\" : \"{0}년 전\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"future\" : \"{0}일 후\",\n      \"past\" : \"{0}일 전\",\n      \"current\" : \"오늘\",\n      \"next\" : \"내일\",\n      \"previous\" : \"어제\"\n    },\n    \"second\" : {\n      \"past\" : \"{0}초 전\",\n      \"current\" : \"지금\",\n      \"future\" : \"{0}초 후\"\n    },\n    \"quarter\" : {\n      \"current\" : \"이번 분기\",\n      \"next\" : \"다음 분기\",\n      \"previous\" : \"지난 분기\",\n      \"future\" : \"{0}분기 후\",\n      \"past\" : \"{0}분기 전\"\n    },\n    \"month\" : {\n      \"future\" : \"{0}개월 후\",\n      \"previous\" : \"지난달\",\n      \"past\" : \"{0}개월 전\",\n      \"next\" : \"다음 달\",\n      \"current\" : \"이번 달\"\n    },\n    \"week\" : {\n      \"future\" : \"{0}주 후\",\n      \"past\" : \"{0}주 전\",\n      \"current\" : \"이번 주\",\n      \"previous\" : \"지난주\",\n      \"next\" : \"다음 주\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0}시간 후\",\n      \"current\" : \"현재 시간\",\n      \"past\" : \"{0}시간 전\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0}분 후\",\n      \"past\" : \"{0}분 전\",\n      \"current\" : \"현재 분\"\n    },\n    \"now\" : \"지금\",\n    \"year\" : {\n      \"future\" : \"{0}년 후\",\n      \"next\" : \"내년\",\n      \"past\" : \"{0}년 전\",\n      \"previous\" : \"작년\",\n      \"current\" : \"올해\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : \"{0}시간 후\",\n      \"current\" : \"현재 시간\",\n      \"past\" : \"{0}시간 전\"\n    },\n    \"now\" : \"지금\",\n    \"quarter\" : {\n      \"current\" : \"이번 분기\",\n      \"future\" : \"{0}분기 후\",\n      \"past\" : \"{0}분기 전\",\n      \"next\" : \"다음 분기\",\n      \"previous\" : \"지난 분기\"\n    },\n    \"day\" : {\n      \"current\" : \"오늘\",\n      \"past\" : \"{0}일 전\",\n      \"future\" : \"{0}일 후\",\n      \"next\" : \"내일\",\n      \"previous\" : \"어제\"\n    },\n    \"week\" : {\n      \"current\" : \"이번 주\",\n      \"past\" : \"{0}주 전\",\n      \"future\" : \"{0}주 후\",\n      \"next\" : \"다음 주\",\n      \"previous\" : \"지난주\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0}분 전\",\n      \"future\" : \"{0}분 후\",\n      \"current\" : \"현재 분\"\n    },\n    \"second\" : {\n      \"past\" : \"{0}초 전\",\n      \"current\" : \"지금\",\n      \"future\" : \"{0}초 후\"\n    },\n    \"month\" : {\n      \"current\" : \"이번 달\",\n      \"future\" : \"{0}개월 후\",\n      \"previous\" : \"지난달\",\n      \"next\" : \"다음 달\",\n      \"past\" : \"{0}개월 전\"\n    },\n    \"year\" : {\n      \"future\" : \"{0}년 후\",\n      \"previous\" : \"작년\",\n      \"next\" : \"내년\",\n      \"current\" : \"올해\",\n      \"past\" : \"{0}년 전\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/kok.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"{0} त्रैमासीकां आदीं\",\n      \"future\" : \"{0} त्रैमासीकांत\",\n      \"current\" : \"हो त्रैमासीक\",\n      \"previous\" : \"फाटलो त्रैमासीक\",\n      \"next\" : \"फुडलो त्रैमासीक\"\n    },\n    \"year\" : {\n      \"previous\" : \"फाटलें वर्स\",\n      \"next\" : \"फुडलें वर्स\",\n      \"future\" : \"{0} वर्सांनीं\",\n      \"current\" : \"हें वर्स\",\n      \"past\" : \"{0} वर्स आदीं\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} सप्तकांनीं\",\n      \"previous\" : \"निमाणो सप्तक\",\n      \"next\" : \"फुडलो सप्तक\",\n      \"past\" : \"{0} सप्त. आदीं\",\n      \"current\" : \"हो सप्तक\"\n    },\n    \"day\" : {\n      \"current\" : \"आयज\",\n      \"past\" : \"{0} दीस आदीं\",\n      \"next\" : \"फाल्यां\",\n      \"future\" : \"{0} दिसानीं\",\n      \"previous\" : \"काल\"\n    },\n    \"hour\" : {\n      \"current\" : \"हें वर\",\n      \"past\" : \"{0} वरा आदीं\",\n      \"future\" : \"{0} वरांनीं\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} मिन्टां\",\n      \"current\" : \"हें मिनीट\",\n      \"past\" : \"{0} मिन्टां आदीं\"\n    },\n    \"month\" : {\n      \"next\" : \"फुडलो म्हयनो\",\n      \"current\" : \"हो म्हयनो\",\n      \"past\" : \"{0} म्हयन्यां आदीं\",\n      \"future\" : \"{0} म्हयन्यानीं\",\n      \"previous\" : \"फाटलो म्हयनो\"\n    },\n    \"now\" : \"आतां\",\n    \"second\" : {\n      \"future\" : \"{0} सेकंदानीं\",\n      \"current\" : \"आतां\",\n      \"past\" : \"{0} से. आदीं\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} मिन्टां आदीं\",\n      \"future\" : \"{0} मिन्टां\",\n      \"current\" : \"हें मिनीट\"\n    },\n    \"week\" : {\n      \"current\" : \"हो सप्तक\",\n      \"past\" : \"{0} सप्तकां आदीं\",\n      \"future\" : \"{0} सप्त.\",\n      \"next\" : \"फुडलो सप्तक\",\n      \"previous\" : \"निमाणो सप्तक\"\n    },\n    \"year\" : {\n      \"future\" : \"{0} वर्सांनीं\",\n      \"previous\" : \"फाटलें वर्स\",\n      \"next\" : \"फुडलें वर्स\",\n      \"current\" : \"हें वर्स\",\n      \"past\" : \"{0} वर्स आदीं\"\n    },\n    \"day\" : {\n      \"next\" : \"फाल्यां\",\n      \"current\" : \"आयज\",\n      \"previous\" : \"काल\",\n      \"past\" : \"{0} दीस आदीं\",\n      \"future\" : \"{0} दिसानीं\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} वरांनीं\",\n      \"current\" : \"हें वर\",\n      \"past\" : \"{0} वरा आदीं\"\n    },\n    \"quarter\" : {\n      \"current\" : \"हो त्रैमासीक\",\n      \"future\" : \"{0} त्रैमासीकांत\",\n      \"previous\" : \"फाटलो त्रैमासीक\",\n      \"next\" : \"फुडलो त्रैमासीक\",\n      \"past\" : \"{0} त्रैमासीकां आदीं\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} से. आदीं\",\n      \"current\" : \"आतां\",\n      \"future\" : \"{0} सेकंदानीं\"\n    },\n    \"month\" : {\n      \"current\" : \"हो म्हयनो\",\n      \"past\" : \"{0} म्हयन्यां आदीं\",\n      \"future\" : \"{0} म्हयन्यानीं\",\n      \"next\" : \"फुडलो म्हयनो\",\n      \"previous\" : \"फाटलो म्हयनो\"\n    },\n    \"now\" : \"आतां\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} वरांनीं\",\n      \"current\" : \"हें वर\",\n      \"past\" : \"{0} वरा आदीं\"\n    },\n    \"day\" : {\n      \"next\" : \"फाल्यां\",\n      \"past\" : \"{0} दीस आदीं\",\n      \"previous\" : \"काल\",\n      \"future\" : \"{0} दिसानीं\",\n      \"current\" : \"आयज\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} सेकंद आदीं\",\n      \"current\" : \"आतां\",\n      \"future\" : \"{0} सेकंदानीं\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} सप्तकांनीं\",\n      \"past\" : \"{0} सप्तकां आदीं\",\n      \"current\" : \"हो सप्तक\",\n      \"next\" : \"फुडलो सप्तक\",\n      \"previous\" : \"निमाणो सप्तक\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} मिन्टां\",\n      \"past\" : \"{0} मिन्टां आदीं\",\n      \"current\" : \"हें मिनीट\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} म्हयन्यानीं\",\n      \"past\" : \"{0} म्हयन्यां आदीं\",\n      \"current\" : \"हो म्हयनो\",\n      \"previous\" : \"फाटलो म्हयनो\",\n      \"next\" : \"फुडलो म्हयनो\"\n    },\n    \"now\" : \"आतां\",\n    \"year\" : {\n      \"current\" : \"हें वर्स\",\n      \"next\" : \"फुडलें वर्स\",\n      \"previous\" : \"फाटलें वर्स\",\n      \"future\" : \"{0} वर्सांनीं\",\n      \"past\" : \"{0} वर्सां आदीं\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} त्रैमासीकांत\",\n      \"previous\" : \"फाटलो त्रैमासीक\",\n      \"past\" : \"{0} त्रैमासीकां आदीं\",\n      \"next\" : \"फुडलो त्रैमासीक\",\n      \"current\" : \"हो त्रैमासीक\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ksh.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"past\" : \"-{0} s\",\n      \"current\" : \"now\"\n    },\n    \"year\" : {\n      \"previous\" : \"läz Johr\",\n      \"next\" : \"näx Johr\",\n      \"future\" : {\n        \"zero\" : \"en keinem Johr\",\n        \"other\" : \"en {0} Johre\",\n        \"one\" : \"en {0} Johr\"\n      },\n      \"current\" : \"diß Johr\",\n      \"past\" : {\n        \"other\" : \"vör {0} Johre\",\n        \"zero\" : \"vör keijnem Johr\",\n        \"one\" : \"vör {0} Johr\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"-{0} m\",\n      \"next\" : \"nächste Mohnd\",\n      \"future\" : \"+{0} m\",\n      \"previous\" : \"lätzde Mohnd\",\n      \"current\" : \"diese Mohnd\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"current\" : \"this minute\",\n      \"future\" : \"+{0} min\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"past\" : \"-{0} h\",\n      \"current\" : \"this hour\"\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"next\" : \"nächste Woche\",\n      \"previous\" : \"läz Woch\",\n      \"past\" : \"-{0} w\",\n      \"future\" : \"+{0} w\",\n      \"current\" : \"di Woch\"\n    },\n    \"day\" : {\n      \"previous\" : \"jestere\",\n      \"future\" : \"+{0} d\",\n      \"past\" : \"-{0} d\",\n      \"current\" : \"hück\",\n      \"next\" : \"morje\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\"\n    },\n    \"week\" : {\n      \"current\" : \"di Woch\",\n      \"past\" : \"-{0} w\",\n      \"future\" : \"+{0} w\",\n      \"next\" : \"nächste Woche\",\n      \"previous\" : \"läz Woch\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"en {0} Johr\",\n        \"zero\" : \"en keinem Johr\",\n        \"other\" : \"en {0} Johre\"\n      },\n      \"previous\" : \"läz Johr\",\n      \"next\" : \"näx Johr\",\n      \"current\" : \"diß Johr\",\n      \"past\" : {\n        \"zero\" : \"vör keijnem Johr\",\n        \"other\" : \"vör {0} Johre\",\n        \"one\" : \"vör {0} Johr\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"morje\",\n      \"current\" : \"hück\",\n      \"previous\" : \"jestere\",\n      \"past\" : \"-{0} d\",\n      \"future\" : \"+{0} d\"\n    },\n    \"hour\" : {\n      \"past\" : \"-{0} h\",\n      \"current\" : \"this hour\",\n      \"future\" : \"+{0} h\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"now\",\n      \"past\" : \"-{0} s\"\n    },\n    \"month\" : {\n      \"current\" : \"diese Mohnd\",\n      \"past\" : \"-{0} m\",\n      \"future\" : \"+{0} m\",\n      \"next\" : \"nächste Mohnd\",\n      \"previous\" : \"lätzde Mohnd\"\n    },\n    \"now\" : \"now\"\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\"\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"previous\" : \"läz Woch\",\n      \"past\" : \"-{0} w\",\n      \"future\" : \"+{0} w\",\n      \"current\" : \"di Woch\",\n      \"next\" : \"nächste Woche\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"current\" : \"this hour\",\n      \"past\" : \"-{0} h\"\n    },\n    \"day\" : {\n      \"current\" : \"hück\",\n      \"future\" : \"+{0} d\",\n      \"next\" : \"morje\",\n      \"previous\" : \"jestere\",\n      \"past\" : \"-{0} d\"\n    },\n    \"month\" : {\n      \"next\" : \"nächste Mohnd\",\n      \"past\" : \"-{0} m\",\n      \"future\" : \"+{0} m\",\n      \"previous\" : \"lätzde Mohnd\",\n      \"current\" : \"diese Mohnd\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : \"+{0} s\",\n      \"past\" : \"-{0} s\"\n    },\n    \"year\" : {\n      \"next\" : \"näx Johr\",\n      \"current\" : \"diß Johr\",\n      \"future\" : {\n        \"other\" : \"en {0} Johre\",\n        \"zero\" : \"en keinem Johr\",\n        \"one\" : \"en {0} Johr\"\n      },\n      \"previous\" : \"läz Johr\",\n      \"past\" : {\n        \"zero\" : \"vör keijnem Johr\",\n        \"other\" : \"vör {0} Johre\",\n        \"one\" : \"vör {0} Johr\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ky.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"next\" : \"кийинки чейр.\",\n      \"past\" : \"{0} чейр. мурун\",\n      \"future\" : \"{0} чейр. кийин\",\n      \"previous\" : \"акыркы чейр.\",\n      \"current\" : \"бул чейр.\"\n    },\n    \"day\" : {\n      \"next\" : \"эртеӊ\",\n      \"future\" : \"{0} күн. кийин\",\n      \"previous\" : \"кечээ\",\n      \"current\" : \"бүгүн\",\n      \"past\" : \"{0} күн мурун\"\n    },\n    \"year\" : {\n      \"next\" : \"эмдиги жылы\",\n      \"past\" : \"{0} жыл мурун\",\n      \"current\" : \"быйыл\",\n      \"previous\" : \"былтыр\",\n      \"future\" : \"{0} жыл. кийин\"\n    },\n    \"week\" : {\n      \"previous\" : \"өткөн апт.\",\n      \"current\" : \"ушул апт.\",\n      \"past\" : \"{0} апт. мурун\",\n      \"future\" : \"{0} апт. кийин\",\n      \"next\" : \"келерки апт.\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} сек. кийн\",\n      \"current\" : \"азыр\",\n      \"past\" : \"{0} сек. мурн\"\n    },\n    \"minute\" : {\n      \"current\" : \"ушул мүнөттө\",\n      \"past\" : \"{0} мүн. мурн\",\n      \"future\" : \"{0} мүн. кийн\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} с. мурн\",\n      \"future\" : \"{0} с. кийн\",\n      \"current\" : \"ушул саатта\"\n    },\n    \"now\" : \"азыр\",\n    \"month\" : {\n      \"current\" : \"бул айда\",\n      \"future\" : \"{0} айд. кийн\",\n      \"past\" : \"{0} ай мурн\",\n      \"next\" : \"эмдиги айда\",\n      \"previous\" : \"өткөн айда\"\n    }\n  },\n  \"long\" : {\n    \"now\" : \"азыр\",\n    \"minute\" : {\n      \"current\" : \"ушул мүнөттө\",\n      \"past\" : \"{0} мүнөт мурун\",\n      \"future\" : \"{0} мүнөттөн кийин\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} чейректен кийин\",\n      \"current\" : \"бул чейрек\",\n      \"next\" : \"кийинки чейрек\",\n      \"past\" : \"{0} чейрек мурун\",\n      \"previous\" : \"акыркы чейрек\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} апта мурун\",\n      \"future\" : \"{0} аптадан кийин\",\n      \"previous\" : \"өткөн аптада\",\n      \"next\" : \"келерки аптада\",\n      \"current\" : \"ушул аптада\"\n    },\n    \"day\" : {\n      \"next\" : \"эртеӊ\",\n      \"previous\" : \"кечээ\",\n      \"future\" : \"{0} күндөн кийин\",\n      \"current\" : \"бүгүн\",\n      \"past\" : \"{0} күн мурун\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} сааттан кийин\",\n      \"current\" : \"ушул саатта\",\n      \"past\" : \"{0} саат мурун\"\n    },\n    \"month\" : {\n      \"current\" : \"бул айда\",\n      \"past\" : \"{0} ай мурун\",\n      \"previous\" : \"өткөн айда\",\n      \"future\" : \"{0} айдан кийин\",\n      \"next\" : \"эмдиги айда\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} секунддан кийин\",\n      \"current\" : \"азыр\",\n      \"past\" : \"{0} секунд мурун\"\n    },\n    \"year\" : {\n      \"previous\" : \"былтыр\",\n      \"next\" : \"эмдиги жылы\",\n      \"past\" : \"{0} жыл мурун\",\n      \"current\" : \"быйыл\",\n      \"future\" : \"{0} жылдан кийин\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} чейректен кийин\",\n      \"next\" : \"кийинки чейр.\",\n      \"previous\" : \"акыркы чейр.\",\n      \"current\" : \"бул чейр.\",\n      \"past\" : \"{0} чейр. мурун\"\n    },\n    \"minute\" : {\n      \"current\" : \"ушул мүнөттө\",\n      \"past\" : \"{0} мүн. мурун\",\n      \"future\" : \"{0} мүн. кийин\"\n    },\n    \"year\" : {\n      \"next\" : \"эмдиги жылы\",\n      \"future\" : \"{0} жыл. кийин\",\n      \"current\" : \"быйыл\",\n      \"past\" : \"{0} жыл мурун\",\n      \"previous\" : \"былтыр\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} сек. кийин\",\n      \"current\" : \"азыр\",\n      \"past\" : \"{0} сек. мурун\"\n    },\n    \"hour\" : {\n      \"current\" : \"ушул саатта\",\n      \"past\" : \"{0} саат. мурун\",\n      \"future\" : \"{0} саат. кийин\"\n    },\n    \"now\" : \"азыр\",\n    \"month\" : {\n      \"previous\" : \"өткөн айда\",\n      \"next\" : \"эмдиги айда\",\n      \"past\" : \"{0} ай мурун\",\n      \"current\" : \"бул айда\",\n      \"future\" : \"{0} айд. кийин\"\n    },\n    \"week\" : {\n      \"previous\" : \"өткөн апт.\",\n      \"current\" : \"ушул апт.\",\n      \"next\" : \"келерки апт.\",\n      \"past\" : \"{0} апт. мурун\",\n      \"future\" : \"{0} апт. кийин\"\n    },\n    \"day\" : {\n      \"next\" : \"эртеӊ\",\n      \"past\" : \"{0} күн мурун\",\n      \"future\" : \"{0} күн. кийин\",\n      \"previous\" : \"кечээ\",\n      \"current\" : \"бүгүн\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/lb.json",
    "content": "{\n  \"narrow\" : {\n    \"month\" : {\n      \"past\" : \"-{0} M.\",\n      \"next\" : \"nächste Mount\",\n      \"previous\" : \"leschte Mount\",\n      \"current\" : \"dëse Mount\",\n      \"future\" : \"+{0} M.\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"-{0} Sek.\",\n      \"future\" : \"+{0} Sek.\"\n    },\n    \"day\" : {\n      \"current\" : \"haut\",\n      \"past\" : \"-{0} D.\",\n      \"previous\" : \"gëschter\",\n      \"next\" : \"muer\",\n      \"future\" : \"+{0} D.\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q.\",\n      \"past\" : \"-{0} Q.\"\n    },\n    \"week\" : {\n      \"current\" : \"dës Woch\",\n      \"future\" : \"+{0} W.\",\n      \"next\" : \"nächst Woch\",\n      \"past\" : \"-{0} W.\",\n      \"previous\" : \"lescht Woch\"\n    },\n    \"minute\" : {\n      \"future\" : \"+{0} Min.\",\n      \"past\" : \"-{0} Min.\",\n      \"current\" : \"this minute\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"-{0} St.\",\n      \"future\" : \"+{0} St.\"\n    },\n    \"year\" : {\n      \"previous\" : \"lescht Joer\",\n      \"next\" : \"nächst Joer\",\n      \"current\" : \"dëst Joer\",\n      \"future\" : \"+{0} J.\",\n      \"past\" : \"-{0} J.\"\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : {\n        \"one\" : \"virun {0} Quartal\",\n        \"other\" : \"viru(n) {0} Quartaler\"\n      },\n      \"previous\" : \"last quarter\",\n      \"future\" : {\n        \"other\" : \"a(n) {0} Quartaler\",\n        \"one\" : \"an {0} Quartal\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"an {0} Stonn\",\n        \"other\" : \"a(n) {0} Stonnen\"\n      },\n      \"past\" : {\n        \"one\" : \"virun {0} Stonn\",\n        \"other\" : \"viru(n) {0} Stonnen\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"month\" : {\n      \"next\" : \"nächste Mount\",\n      \"previous\" : \"leschte Mount\",\n      \"current\" : \"dëse Mount\",\n      \"future\" : {\n        \"one\" : \"an {0} Mount\",\n        \"other\" : \"a(n) {0} Méint\"\n      },\n      \"past\" : {\n        \"other\" : \"viru(n) {0} Méint\",\n        \"one\" : \"virun {0} Mount\"\n      }\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"current\" : \"dës Woch\",\n      \"next\" : \"nächst Woch\",\n      \"past\" : {\n        \"one\" : \"virun {0} Woch\",\n        \"other\" : \"viru(n) {0} Wochen\"\n      },\n      \"previous\" : \"lescht Woch\",\n      \"future\" : {\n        \"other\" : \"a(n) {0} Wochen\",\n        \"one\" : \"an {0} Woch\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"an {0} Minutt\",\n        \"other\" : \"a(n) {0} Minutten\"\n      },\n      \"past\" : {\n        \"one\" : \"virun {0} Minutt\",\n        \"other\" : \"viru(n) {0} Minutten\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"an {0} Sekonn\",\n        \"other\" : \"a(n) {0} Sekonnen\"\n      },\n      \"current\" : \"now\",\n      \"past\" : {\n        \"other\" : \"viru(n) {0} Sekonnen\",\n        \"one\" : \"virun {0} Sekonn\"\n      }\n    },\n    \"day\" : {\n      \"current\" : \"haut\",\n      \"future\" : {\n        \"one\" : \"an {0} Dag\",\n        \"other\" : \"a(n) {0} Deeg\"\n      },\n      \"previous\" : \"gëschter\",\n      \"next\" : \"muer\",\n      \"past\" : {\n        \"other\" : \"viru(n) {0} Deeg\",\n        \"one\" : \"virun {0} Dag\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"virun {0} Joer\",\n        \"other\" : \"viru(n) {0} Joer\"\n      },\n      \"next\" : \"nächst Joer\",\n      \"previous\" : \"lescht Joer\",\n      \"current\" : \"dëst Joer\",\n      \"future\" : {\n        \"one\" : \"an {0} Joer\",\n        \"other\" : \"a(n) {0} Joer\"\n      }\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"other\" : \"viru(n) {0} St.\",\n        \"one\" : \"virun {0} St.\"\n      },\n      \"future\" : {\n        \"one\" : \"an {0} St.\",\n        \"other\" : \"a(n) {0} St.\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"an {0} Sek.\",\n        \"other\" : \"a(n) {0} Sek.\"\n      },\n      \"past\" : {\n        \"one\" : \"virun {0} Sek.\",\n        \"other\" : \"viru(n) {0} Sek.\"\n      },\n      \"current\" : \"now\"\n    },\n    \"now\" : \"now\",\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"virun {0} J.\",\n        \"other\" : \"viru(n) {0} J.\"\n      },\n      \"future\" : {\n        \"one\" : \"an {0} J.\",\n        \"other\" : \"a(n) {0} J.\"\n      },\n      \"previous\" : \"lescht Joer\",\n      \"current\" : \"dëst Joer\",\n      \"next\" : \"nächst Joer\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"future\" : {\n        \"other\" : \"a(n) {0} Q.\",\n        \"one\" : \"an {0} Q.\"\n      },\n      \"next\" : \"next quarter\",\n      \"past\" : {\n        \"other\" : \"viru(n) {0} Q.\",\n        \"one\" : \"virun {0} Q.\"\n      },\n      \"current\" : \"this quarter\"\n    },\n    \"week\" : {\n      \"previous\" : \"lescht Woch\",\n      \"current\" : \"dës Woch\",\n      \"next\" : \"nächst Woch\",\n      \"past\" : {\n        \"one\" : \"virun {0} W.\",\n        \"other\" : \"viru(n) {0} W.\"\n      },\n      \"future\" : {\n        \"other\" : \"a(n) {0} W.\",\n        \"one\" : \"an {0} W.\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"muer\",\n      \"past\" : {\n        \"other\" : \"viru(n) {0} D.\",\n        \"one\" : \"virun {0} D.\"\n      },\n      \"previous\" : \"gëschter\",\n      \"future\" : {\n        \"one\" : \"an {0} D.\",\n        \"other\" : \"a(n) {0} D.\"\n      },\n      \"current\" : \"haut\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"viru(n) {0} Min.\",\n        \"one\" : \"virun {0} Min.\"\n      },\n      \"future\" : {\n        \"one\" : \"an {0} Min.\",\n        \"other\" : \"a(n) {0} Min.\"\n      },\n      \"current\" : \"this minute\"\n    },\n    \"month\" : {\n      \"next\" : \"nächste Mount\",\n      \"past\" : {\n        \"one\" : \"virun {0} M.\",\n        \"other\" : \"viru(n) {0} M.\"\n      },\n      \"future\" : {\n        \"one\" : \"an {0} M.\",\n        \"other\" : \"a(n) {0} M.\"\n      },\n      \"previous\" : \"leschte Mount\",\n      \"current\" : \"dëse Mount\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/lkt.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"Letáŋhaŋ ómakȟa {0} kiŋháŋ\",\n      \"previous\" : \"Ómakȟa kʼuŋ héhaŋ\",\n      \"next\" : \"Tȟokáta ómakȟa kiŋháŋ\",\n      \"current\" : \"Lé ómakȟa kiŋ\",\n      \"past\" : \"Hékta ómakȟa {0} kʼuŋ héhaŋ\"\n    },\n    \"week\" : {\n      \"past\" : \"Hékta okó {0} kʼuŋ héhaŋ\",\n      \"previous\" : \"Okó kʼuŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ okó {0} kiŋháŋ\",\n      \"current\" : \"Lé okó kiŋ\",\n      \"next\" : \"Tȟokáta okó kiŋháŋ\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"Hékta owápȟe {0} kʼuŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ owápȟe {0} kiŋháŋ\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\",\n      \"future\" : \"+{0} Q\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\"\n    },\n    \"second\" : {\n      \"past\" : \"Hékta okpí {0} k’uŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ okpí {0} kiŋháŋ\",\n      \"current\" : \"now\"\n    },\n    \"month\" : {\n      \"current\" : \"Lé wí kiŋ\",\n      \"future\" : \"Letáŋhaŋ wíyawapi {0} kiŋháŋ\",\n      \"past\" : \"Hékta wíyawapi {0} kʼuŋ héhaŋ\",\n      \"next\" : \"Tȟokáta wí kiŋháŋ\",\n      \"previous\" : \"Wí kʼuŋ héhaŋ\"\n    },\n    \"day\" : {\n      \"previous\" : \"Ȟtálehaŋ\",\n      \"future\" : \"Letáŋhaŋ {0}-čháŋ kiŋháŋ\",\n      \"next\" : \"Híŋhaŋni kiŋháŋ\",\n      \"current\" : \"Lé aŋpétu kiŋ\",\n      \"past\" : \"Hékta {0}-čháŋ k’uŋ héhaŋ\"\n    },\n    \"minute\" : {\n      \"future\" : \"Letáŋhaŋ oȟ’áŋkȟo {0} kiŋháŋ\",\n      \"current\" : \"this minute\",\n      \"past\" : \"Hékta oȟ’áŋkȟo {0} k’uŋ héhaŋ\"\n    },\n    \"now\" : \"now\"\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"now\" : \"now\",\n    \"year\" : {\n      \"previous\" : \"Ómakȟa kʼuŋ héhaŋ\",\n      \"past\" : \"Hékta ómakȟa {0} kʼuŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ ómakȟa {0} kiŋháŋ\",\n      \"next\" : \"Tȟokáta ómakȟa kiŋháŋ\",\n      \"current\" : \"Lé ómakȟa kiŋ\"\n    },\n    \"month\" : {\n      \"previous\" : \"Wí kʼuŋ héhaŋ\",\n      \"current\" : \"Lé wí kiŋ\",\n      \"future\" : \"Letáŋhaŋ wíyawapi {0} kiŋháŋ\",\n      \"past\" : \"Hékta wíyawapi {0} kʼuŋ héhaŋ\",\n      \"next\" : \"Tȟokáta wí kiŋháŋ\"\n    },\n    \"day\" : {\n      \"previous\" : \"Ȟtálehaŋ\",\n      \"future\" : \"Letáŋhaŋ {0}-čháŋ kiŋháŋ\",\n      \"next\" : \"Híŋhaŋni kiŋháŋ\",\n      \"past\" : \"Hékta {0}-čháŋ k’uŋ héhaŋ\",\n      \"current\" : \"Lé aŋpétu kiŋ\"\n    },\n    \"second\" : {\n      \"past\" : \"Hékta okpí {0} k’uŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ okpí {0} kiŋháŋ\",\n      \"current\" : \"now\"\n    },\n    \"week\" : {\n      \"past\" : \"Hékta okó {0} kʼuŋ héhaŋ\",\n      \"current\" : \"Lé okó kiŋ\",\n      \"next\" : \"Tȟokáta okó kiŋháŋ\",\n      \"previous\" : \"Okó kʼuŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ okó {0} kiŋháŋ\"\n    },\n    \"hour\" : {\n      \"future\" : \"Letáŋhaŋ owápȟe {0} kiŋháŋ\",\n      \"current\" : \"this hour\",\n      \"past\" : \"Hékta owápȟe {0} kʼuŋ héhaŋ\"\n    },\n    \"minute\" : {\n      \"future\" : \"Letáŋhaŋ oȟ’áŋkȟo {0} kiŋháŋ\",\n      \"current\" : \"this minute\",\n      \"past\" : \"Hékta oȟ’áŋkȟo {0} k’uŋ héhaŋ\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"Hékta okpí {0} k’uŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ okpí {0} kiŋháŋ\"\n    },\n    \"now\" : \"now\",\n    \"month\" : {\n      \"future\" : \"Letáŋhaŋ wíyawapi {0} kiŋháŋ\",\n      \"current\" : \"Lé wí kiŋ\",\n      \"past\" : \"Hékta wíyawapi {0} kʼuŋ héhaŋ\",\n      \"previous\" : \"Wí kʼuŋ héhaŋ\",\n      \"next\" : \"Tȟokáta wí kiŋháŋ\"\n    },\n    \"day\" : {\n      \"previous\" : \"Ȟtálehaŋ\",\n      \"current\" : \"Lé aŋpétu kiŋ\",\n      \"next\" : \"Híŋhaŋni kiŋháŋ\",\n      \"future\" : \"Letáŋhaŋ {0}-čháŋ kiŋháŋ\",\n      \"past\" : \"Hékta {0}-čháŋ k’uŋ héhaŋ\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : \"Letáŋhaŋ oȟ’áŋkȟo {0} kiŋháŋ\",\n      \"past\" : \"Hékta oȟ’áŋkȟo {0} k’uŋ héhaŋ\"\n    },\n    \"quarter\" : {\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"next\" : \"next quarter\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"future\" : \"Letáŋhaŋ owápȟe {0} kiŋháŋ\",\n      \"past\" : \"Hékta owápȟe {0} kʼuŋ héhaŋ\"\n    },\n    \"week\" : {\n      \"future\" : \"Letáŋhaŋ okó {0} kiŋháŋ\",\n      \"previous\" : \"Okó kʼuŋ héhaŋ\",\n      \"next\" : \"Tȟokáta okó kiŋháŋ\",\n      \"past\" : \"Hékta okó {0} kʼuŋ héhaŋ\",\n      \"current\" : \"Lé okó kiŋ\"\n    },\n    \"year\" : {\n      \"next\" : \"Tȟokáta ómakȟa kiŋháŋ\",\n      \"current\" : \"Lé ómakȟa kiŋ\",\n      \"past\" : \"Hékta ómakȟa {0} kʼuŋ héhaŋ\",\n      \"future\" : \"Letáŋhaŋ ómakȟa {0} kiŋháŋ\",\n      \"previous\" : \"Ómakȟa kʼuŋ héhaŋ\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/lo.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"{0} ຕມ. ກ່ອນ\",\n      \"future\" : \"ໃນ {0} ຕມ.\",\n      \"current\" : \"ໄຕຣມາດນີ້\",\n      \"previous\" : \"ໄຕຣມາດກ່ອນໜ້າ\",\n      \"next\" : \"ໄຕຣມາດໜ້າ\"\n    },\n    \"year\" : {\n      \"previous\" : \"ປີກາຍ\",\n      \"next\" : \"ປີໜ້າ\",\n      \"future\" : \"ໃນອີກ {0} ປີ\",\n      \"current\" : \"ປີນີ້\",\n      \"past\" : \"{0} ປີກ່ອນ\"\n    },\n    \"week\" : {\n      \"future\" : \"ໃນອີກ {0} ອທ.\",\n      \"previous\" : \"ອາທິດແລ້ວ\",\n      \"next\" : \"ອາທິດໜ້າ\",\n      \"past\" : \"{0} ອທ. ກ່ອນ\",\n      \"current\" : \"ອາທິດນີ້\"\n    },\n    \"day\" : {\n      \"current\" : \"ມື້ນີ້\",\n      \"past\" : \"{0} ມື້ກ່ອນ\",\n      \"next\" : \"ມື້ອື່ນ\",\n      \"future\" : \"ໃນອີກ {0} ມື້\",\n      \"previous\" : \"ມື້ວານ\"\n    },\n    \"hour\" : {\n      \"current\" : \"ຊົ່ວໂມງນີ້\",\n      \"past\" : \"{0} ຊມ. ກ່ອນ\",\n      \"future\" : \"ໃນອີກ {0} ຊມ.\"\n    },\n    \"minute\" : {\n      \"future\" : \"ໃນ {0} ນທ.\",\n      \"current\" : \"ນາທີນີ້\",\n      \"past\" : \"{0} ນທ. ກ່ອນ\"\n    },\n    \"month\" : {\n      \"next\" : \"ເດືອນໜ້າ\",\n      \"current\" : \"ເດືອນນີ້\",\n      \"past\" : \"{0} ດ. ກ່ອນ\",\n      \"future\" : \"ໃນອີກ {0} ດ.\",\n      \"previous\" : \"ເດືອນແລ້ວ\"\n    },\n    \"now\" : \"ຕອນນີ້\",\n    \"second\" : {\n      \"future\" : \"ໃນ {0} ວິ.\",\n      \"current\" : \"ຕອນນີ້\",\n      \"past\" : \"{0} ວິ. ກ່ອນ\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} ນທ. ກ່ອນ\",\n      \"future\" : \"ໃນ {0} ນທ.\",\n      \"current\" : \"ນາທີນີ້\"\n    },\n    \"week\" : {\n      \"current\" : \"ອາທິດນີ້\",\n      \"past\" : \"{0} ອທ. ກ່ອນ\",\n      \"future\" : \"ໃນອີກ {0} ອທ.\",\n      \"next\" : \"ອາທິດໜ້າ\",\n      \"previous\" : \"ອາທິດແລ້ວ\"\n    },\n    \"year\" : {\n      \"future\" : \"ໃນອີກ {0} ປີ\",\n      \"previous\" : \"ປີກາຍ\",\n      \"next\" : \"ປີໜ້າ\",\n      \"current\" : \"ປີນີ້\",\n      \"past\" : \"{0} ປີກ່ອນ\"\n    },\n    \"day\" : {\n      \"next\" : \"ມື້ອື່ນ\",\n      \"current\" : \"ມື້ນີ້\",\n      \"previous\" : \"ມື້ວານ\",\n      \"past\" : \"{0} ມື້ກ່ອນ\",\n      \"future\" : \"ໃນອີກ {0} ມື້\"\n    },\n    \"hour\" : {\n      \"future\" : \"ໃນອີກ {0} ຊມ.\",\n      \"current\" : \"ຊົ່ວໂມງນີ້\",\n      \"past\" : \"{0} ຊມ. ກ່ອນ\"\n    },\n    \"quarter\" : {\n      \"current\" : \"ໄຕຣມາດນີ້\",\n      \"future\" : \"ໃນ {0} ຕມ.\",\n      \"previous\" : \"ໄຕຣມາດກ່ອນໜ້າ\",\n      \"next\" : \"ໄຕຣມາດໜ້າ\",\n      \"past\" : \"{0} ຕມ. ກ່ອນ\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} ວິ. ກ່ອນ\",\n      \"current\" : \"ຕອນນີ້\",\n      \"future\" : \"ໃນ {0} ວິ.\"\n    },\n    \"month\" : {\n      \"current\" : \"ເດືອນນີ້\",\n      \"past\" : \"{0} ດ. ກ່ອນ\",\n      \"future\" : \"ໃນອີກ {0} ດ.\",\n      \"next\" : \"ເດືອນໜ້າ\",\n      \"previous\" : \"ເດືອນແລ້ວ\"\n    },\n    \"now\" : \"ຕອນນີ້\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"ໃນອີກ {0} ຊົ່ວໂມງ\",\n      \"current\" : \"ຊົ່ວໂມງນີ້\",\n      \"past\" : \"{0} ຊົ່ວໂມງກ່ອນ\"\n    },\n    \"day\" : {\n      \"next\" : \"ມື້ອື່ນ\",\n      \"past\" : \"{0} ມື້ກ່ອນ\",\n      \"previous\" : \"ມື້ວານ\",\n      \"future\" : \"ໃນອີກ {0} ມື້\",\n      \"current\" : \"ມື້ນີ້\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} ວິນາທີກ່ອນ\",\n      \"current\" : \"ຕອນນີ້\",\n      \"future\" : \"ໃນອີກ {0} ວິນາທີ\"\n    },\n    \"week\" : {\n      \"future\" : \"ໃນອີກ {0} ອາທິດ\",\n      \"past\" : \"{0} ອາທິດກ່ອນ\",\n      \"current\" : \"ອາທິດນີ້\",\n      \"next\" : \"ອາທິດໜ້າ\",\n      \"previous\" : \"ອາທິດແລ້ວ\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} ໃນອີກ 0 ນາທີ\",\n      \"past\" : \"{0} ນາທີກ່ອນ\",\n      \"current\" : \"ນາທີນີ້\"\n    },\n    \"month\" : {\n      \"future\" : \"ໃນອີກ {0} ເດືອນ\",\n      \"past\" : \"{0} ເດືອນກ່ອນ\",\n      \"current\" : \"ເດືອນນີ້\",\n      \"previous\" : \"ເດືອນແລ້ວ\",\n      \"next\" : \"ເດືອນໜ້າ\"\n    },\n    \"now\" : \"ຕອນນີ້\",\n    \"year\" : {\n      \"current\" : \"ປີນີ້\",\n      \"next\" : \"ປີໜ້າ\",\n      \"previous\" : \"ປີກາຍ\",\n      \"future\" : \"ໃນອີກ {0} ປີ\",\n      \"past\" : \"{0} ປີກ່ອນ\"\n    },\n    \"quarter\" : {\n      \"future\" : \"ໃນອີກ {0} ໄຕຣມາດ\",\n      \"previous\" : \"ໄຕຣມາດກ່ອນໜ້າ\",\n      \"past\" : \"{0} ໄຕຣມາດກ່ອນ\",\n      \"next\" : \"ໄຕຣມາດໜ້າ\",\n      \"current\" : \"ໄຕຣມາດນີ້\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/lt.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"prieš {0} ketv.\",\n      \"future\" : \"po {0} ketv.\",\n      \"current\" : \"šis ketvirtis\",\n      \"previous\" : \"praėjęs ketvirtis\",\n      \"next\" : \"kitas ketvirtis\"\n    },\n    \"year\" : {\n      \"previous\" : \"praėjusiais metais\",\n      \"next\" : \"kitais metais\",\n      \"future\" : \"po {0} m.\",\n      \"current\" : \"šiais metais\",\n      \"past\" : \"prieš {0} m.\"\n    },\n    \"week\" : {\n      \"future\" : \"po {0} sav.\",\n      \"previous\" : \"praėjusią savaitę\",\n      \"next\" : \"kitą savaitę\",\n      \"past\" : \"prieš {0} sav.\",\n      \"current\" : \"šią savaitę\"\n    },\n    \"day\" : {\n      \"current\" : \"šiandien\",\n      \"past\" : \"prieš {0} d.\",\n      \"next\" : \"rytoj\",\n      \"future\" : \"po {0} d.\",\n      \"previous\" : \"vakar\"\n    },\n    \"hour\" : {\n      \"current\" : \"šią valandą\",\n      \"past\" : \"prieš {0} val.\",\n      \"future\" : \"po {0} val.\"\n    },\n    \"minute\" : {\n      \"future\" : \"po {0} min.\",\n      \"current\" : \"šią minutę\",\n      \"past\" : \"prieš {0} min.\"\n    },\n    \"month\" : {\n      \"next\" : \"kitą mėnesį\",\n      \"current\" : \"šį mėnesį\",\n      \"past\" : \"prieš {0} mėn.\",\n      \"future\" : \"po {0} mėn.\",\n      \"previous\" : \"praėjusį mėnesį\"\n    },\n    \"now\" : \"dabar\",\n    \"second\" : {\n      \"future\" : \"po {0} s\",\n      \"current\" : \"dabar\",\n      \"past\" : \"prieš {0} s\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"prieš {0} min.\",\n      \"future\" : \"po {0} min.\",\n      \"current\" : \"šią minutę\"\n    },\n    \"week\" : {\n      \"current\" : \"šią savaitę\",\n      \"past\" : \"prieš {0} sav.\",\n      \"future\" : \"po {0} sav.\",\n      \"next\" : \"kitą savaitę\",\n      \"previous\" : \"praėjusią savaitę\"\n    },\n    \"year\" : {\n      \"future\" : \"po {0} m.\",\n      \"previous\" : \"praėjusiais metais\",\n      \"next\" : \"kitais metais\",\n      \"current\" : \"šiais metais\",\n      \"past\" : \"prieš {0} m.\"\n    },\n    \"day\" : {\n      \"next\" : \"rytoj\",\n      \"current\" : \"šiandien\",\n      \"previous\" : \"vakar\",\n      \"past\" : \"prieš {0} d.\",\n      \"future\" : \"po {0} d.\"\n    },\n    \"hour\" : {\n      \"future\" : \"po {0} val.\",\n      \"current\" : \"šią valandą\",\n      \"past\" : \"prieš {0} val.\"\n    },\n    \"quarter\" : {\n      \"current\" : \"šis ketvirtis\",\n      \"future\" : \"po {0} ketv.\",\n      \"previous\" : \"praėjęs ketvirtis\",\n      \"next\" : \"kitas ketvirtis\",\n      \"past\" : \"prieš {0} ketv.\"\n    },\n    \"second\" : {\n      \"past\" : \"prieš {0} sek.\",\n      \"current\" : \"dabar\",\n      \"future\" : \"po {0} sek.\"\n    },\n    \"month\" : {\n      \"current\" : \"šį mėnesį\",\n      \"past\" : \"prieš {0} mėn.\",\n      \"future\" : \"po {0} mėn.\",\n      \"next\" : \"kitą mėnesį\",\n      \"previous\" : \"praėjusį mėnesį\"\n    },\n    \"now\" : \"dabar\"\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"kitas ketvirtis\",\n      \"current\" : \"šis ketvirtis\",\n      \"future\" : {\n        \"many\" : \"po {0} ketvirčio\",\n        \"one\" : \"po {0} ketvirčio\",\n        \"other\" : \"po {0} ketvirčių\"\n      },\n      \"previous\" : \"praėjęs ketvirtis\",\n      \"past\" : {\n        \"few\" : \"prieš {0} ketvirčius\",\n        \"one\" : \"prieš {0} ketvirtį\",\n        \"many\" : \"prieš {0} ketvirčio\",\n        \"other\" : \"prieš {0} ketvirčių\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"rytoj\",\n      \"past\" : {\n        \"few\" : \"prieš {0} dienas\",\n        \"one\" : \"prieš {0} dieną\",\n        \"many\" : \"prieš {0} dienos\",\n        \"other\" : \"prieš {0} dienų\"\n      },\n      \"previous\" : \"vakar\",\n      \"current\" : \"šiandien\",\n      \"future\" : {\n        \"other\" : \"po {0} dienų\",\n        \"many\" : \"po {0} dienos\",\n        \"one\" : \"po {0} dienos\"\n      }\n    },\n    \"week\" : {\n      \"current\" : \"šią savaitę\",\n      \"next\" : \"kitą savaitę\",\n      \"past\" : {\n        \"one\" : \"prieš {0} savaitę\",\n        \"few\" : \"prieš {0} savaites\",\n        \"other\" : \"prieš {0} savaičių\",\n        \"many\" : \"prieš {0} savaitės\"\n      },\n      \"future\" : {\n        \"one\" : \"po {0} savaitės\",\n        \"other\" : \"po {0} savaičių\",\n        \"many\" : \"po {0} savaitės\"\n      },\n      \"previous\" : \"praėjusią savaitę\"\n    },\n    \"month\" : {\n      \"current\" : \"šį mėnesį\",\n      \"future\" : {\n        \"one\" : \"po {0} mėnesio\",\n        \"many\" : \"po {0} mėnesio\",\n        \"other\" : \"po {0} mėnesių\"\n      },\n      \"next\" : \"kitą mėnesį\",\n      \"previous\" : \"praėjusį mėnesį\",\n      \"past\" : {\n        \"one\" : \"prieš {0} mėnesį\",\n        \"many\" : \"prieš {0} mėnesio\",\n        \"other\" : \"prieš {0} mėnesių\",\n        \"few\" : \"prieš {0} mėnesius\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"po {0} sekundės\",\n        \"many\" : \"po {0} sekundės\",\n        \"other\" : \"po {0} sekundžių\"\n      },\n      \"current\" : \"dabar\",\n      \"past\" : {\n        \"many\" : \"prieš {0} sekundės\",\n        \"one\" : \"prieš {0} sekundę\",\n        \"few\" : \"prieš {0} sekundes\",\n        \"other\" : \"prieš {0} sekundžių\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"šiais metais\",\n      \"next\" : \"kitais metais\",\n      \"previous\" : \"praėjusiais metais\",\n      \"future\" : \"po {0} metų\",\n      \"past\" : {\n        \"other\" : \"prieš {0} metų\",\n        \"one\" : \"prieš {0} metus\",\n        \"few\" : \"prieš {0} metus\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"prieš {0} valandą\",\n        \"other\" : \"prieš {0} valandų\",\n        \"few\" : \"prieš {0} valandas\",\n        \"many\" : \"prieš {0} valandos\"\n      },\n      \"future\" : {\n        \"many\" : \"po {0} valandos\",\n        \"other\" : \"po {0} valandų\",\n        \"one\" : \"po {0} valandos\"\n      },\n      \"current\" : \"šią valandą\"\n    },\n    \"now\" : \"dabar\",\n    \"minute\" : {\n      \"current\" : \"šią minutę\",\n      \"future\" : {\n        \"one\" : \"po {0} minutės\",\n        \"other\" : \"po {0} minučių\",\n        \"many\" : \"po {0} minutės\"\n      },\n      \"past\" : {\n        \"other\" : \"prieš {0} minučių\",\n        \"many\" : \"prieš {0} minutės\",\n        \"one\" : \"prieš {0} minutę\",\n        \"few\" : \"prieš {0} minutes\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/lv.json",
    "content": "{\n  \"short\" : {\n    \"now\" : \"tagad\",\n    \"minute\" : {\n      \"past\" : \"pirms {0} min.\",\n      \"future\" : \"pēc {0} min.\",\n      \"current\" : \"šajā minūtē\"\n    },\n    \"year\" : {\n      \"current\" : \"šajā gadā\",\n      \"future\" : \"pēc {0} g.\",\n      \"previous\" : \"pagājušajā gadā\",\n      \"next\" : \"nākamajā gadā\",\n      \"past\" : \"pirms {0} g.\"\n    },\n    \"second\" : {\n      \"current\" : \"tagad\",\n      \"future\" : \"pēc {0} sek.\",\n      \"past\" : \"pirms {0} sek.\"\n    },\n    \"hour\" : {\n      \"future\" : \"pēc {0} st.\",\n      \"past\" : \"pirms {0} st.\",\n      \"current\" : \"šajā stundā\"\n    },\n    \"month\" : {\n      \"current\" : \"šajā mēnesī\",\n      \"next\" : \"nākamajā mēnesī\",\n      \"past\" : \"pirms {0} mēn.\",\n      \"future\" : \"pēc {0} mēn.\",\n      \"previous\" : \"pagājušajā mēnesī\"\n    },\n    \"quarter\" : {\n      \"future\" : \"pēc {0} cet.\",\n      \"previous\" : \"pēdējais ceturksnis\",\n      \"next\" : \"nākamais ceturksnis\",\n      \"past\" : \"pirms {0} cet.\",\n      \"current\" : \"šis ceturksnis\"\n    },\n    \"week\" : {\n      \"next\" : \"nākamajā nedēļā\",\n      \"past\" : \"pirms {0} ned.\",\n      \"current\" : \"šajā nedēļā\",\n      \"previous\" : \"pagājušajā nedēļā\",\n      \"future\" : \"pēc {0} ned.\"\n    },\n    \"day\" : {\n      \"next\" : \"rīt\",\n      \"current\" : \"šodien\",\n      \"previous\" : \"vakar\",\n      \"past\" : {\n        \"one\" : \"pirms {0} d.\",\n        \"other\" : \"pirms {0} d.\"\n      },\n      \"future\" : {\n        \"one\" : \"pēc {0} d.\",\n        \"other\" : \"pēc {0} d.\"\n      }\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"current\" : \"šis ceturksnis\",\n      \"previous\" : \"pēdējais ceturksnis\",\n      \"next\" : \"nākamais ceturksnis\",\n      \"past\" : {\n        \"one\" : \"pirms {0} ceturkšņa\",\n        \"other\" : \"pirms {0} ceturkšņiem\"\n      },\n      \"future\" : {\n        \"one\" : \"pēc {0} ceturkšņa\",\n        \"other\" : \"pēc {0} ceturkšņiem\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"šajā minūtē\",\n      \"past\" : {\n        \"one\" : \"pirms {0} minūtes\",\n        \"other\" : \"pirms {0} minūtēm\"\n      },\n      \"future\" : {\n        \"one\" : \"pēc {0} minūtes\",\n        \"other\" : \"pēc {0} minūtēm\"\n      }\n    },\n    \"now\" : \"tagad\",\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"pirms {0} sekundēm\",\n        \"one\" : \"pirms {0} sekundes\"\n      },\n      \"future\" : {\n        \"one\" : \"pēc {0} sekundes\",\n        \"other\" : \"pēc {0} sekundēm\"\n      },\n      \"current\" : \"tagad\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"pēc {0} stundām\",\n        \"one\" : \"pēc {0} stundas\"\n      },\n      \"current\" : \"šajā stundā\",\n      \"past\" : {\n        \"other\" : \"pirms {0} stundām\",\n        \"one\" : \"pirms {0} stundas\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"nākamajā nedēļā\",\n      \"past\" : {\n        \"other\" : \"pirms {0} nedēļām\",\n        \"one\" : \"pirms {0} nedēļas\"\n      },\n      \"current\" : \"šajā nedēļā\",\n      \"previous\" : \"pagājušajā nedēļā\",\n      \"future\" : {\n        \"other\" : \"pēc {0} nedēļām\",\n        \"one\" : \"pēc {0} nedēļas\"\n      }\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"pēc {0} dienām\",\n        \"one\" : \"pēc {0} dienas\"\n      },\n      \"past\" : {\n        \"one\" : \"pirms {0} dienas\",\n        \"other\" : \"pirms {0} dienām\"\n      },\n      \"previous\" : \"vakar\",\n      \"current\" : \"šodien\",\n      \"next\" : \"rīt\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"pirms {0} mēnešiem\",\n        \"one\" : \"pirms {0} mēneša\"\n      },\n      \"previous\" : \"pagājušajā mēnesī\",\n      \"next\" : \"nākamajā mēnesī\",\n      \"future\" : {\n        \"other\" : \"pēc {0} mēnešiem\",\n        \"one\" : \"pēc {0} mēneša\"\n      },\n      \"current\" : \"šajā mēnesī\"\n    },\n    \"year\" : {\n      \"current\" : \"šajā gadā\",\n      \"previous\" : \"pagājušajā gadā\",\n      \"future\" : {\n        \"one\" : \"pēc {0} gada\",\n        \"other\" : \"pēc {0} gadiem\"\n      },\n      \"next\" : \"nākamajā gadā\",\n      \"past\" : {\n        \"other\" : \"pirms {0} gadiem\",\n        \"one\" : \"pirms {0} gada\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"past\" : \"pirms {0} ned.\",\n      \"future\" : \"pēc {0} ned.\",\n      \"next\" : \"nākamajā nedēļā\",\n      \"current\" : \"šajā nedēļā\",\n      \"previous\" : \"pagājušajā nedēļā\"\n    },\n    \"minute\" : {\n      \"past\" : \"pirms {0} min\",\n      \"future\" : {\n        \"other\" : \"pēc {0} min\",\n        \"one\" : \"pēc {0} min\"\n      },\n      \"current\" : \"šajā minūtē\"\n    },\n    \"month\" : {\n      \"next\" : \"nākamajā mēnesī\",\n      \"past\" : \"pirms {0} mēn.\",\n      \"current\" : \"šajā mēnesī\",\n      \"future\" : \"pēc {0} mēn.\",\n      \"previous\" : \"pagājušajā mēnesī\"\n    },\n    \"now\" : \"tagad\",\n    \"year\" : {\n      \"previous\" : \"pagājušajā gadā\",\n      \"current\" : \"šajā gadā\",\n      \"past\" : \"pirms {0} g.\",\n      \"future\" : \"pēc {0} g.\",\n      \"next\" : \"nākamajā gadā\"\n    },\n    \"day\" : {\n      \"current\" : \"šodien\",\n      \"past\" : {\n        \"one\" : \"pirms {0} d.\",\n        \"other\" : \"pirms {0} d.\"\n      },\n      \"future\" : {\n        \"one\" : \"pēc {0} d.\",\n        \"other\" : \"pēc {0} d.\"\n      },\n      \"previous\" : \"vakar\",\n      \"next\" : \"rīt\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"pirms {0} s\",\n        \"one\" : \"pirms {0} s\"\n      },\n      \"current\" : \"tagad\",\n      \"future\" : \"pēc {0} s\"\n    },\n    \"quarter\" : {\n      \"current\" : \"šis ceturksnis\",\n      \"previous\" : \"pēdējais ceturksnis\",\n      \"past\" : \"pirms {0} cet.\",\n      \"next\" : \"nākamais ceturksnis\",\n      \"future\" : \"pēc {0} cet.\"\n    },\n    \"hour\" : {\n      \"current\" : \"šajā stundā\",\n      \"past\" : \"pirms {0} h\",\n      \"future\" : \"pēc {0} h\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/mk.json",
    "content": "{\n  \"short\" : {\n    \"month\" : {\n      \"current\" : \"овој месец\",\n      \"next\" : \"следниот месец\",\n      \"past\" : {\n        \"one\" : \"пред {0} месец\",\n        \"other\" : \"пред {0} месеци\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} месец\",\n        \"other\" : \"за {0} месеци\"\n      },\n      \"previous\" : \"минатиот месец\"\n    },\n    \"now\" : \"сега\",\n    \"day\" : {\n      \"next\" : \"утре\",\n      \"current\" : \"денес\",\n      \"previous\" : \"вчера\",\n      \"past\" : {\n        \"one\" : \"пред {0} ден\",\n        \"other\" : \"пред {0} дена\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} ден\",\n        \"other\" : \"за {0} дена\"\n      }\n    },\n    \"year\" : {\n      \"current\" : \"оваа година\",\n      \"future\" : \"за {0} год.\",\n      \"previous\" : \"минатата година\",\n      \"next\" : \"следната година\",\n      \"past\" : \"пред {0} год.\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"пред {0} часа\",\n        \"one\" : \"пред {0} час\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} час\",\n        \"other\" : \"за {0} часа\"\n      },\n      \"current\" : \"часов\"\n    },\n    \"minute\" : {\n      \"future\" : \"за {0} мин.\",\n      \"past\" : \"пред {0} мин.\",\n      \"current\" : \"оваа минута\"\n    },\n    \"second\" : {\n      \"current\" : \"сега\",\n      \"future\" : \"за {0} сек.\",\n      \"past\" : \"пред {0} сек.\"\n    },\n    \"quarter\" : {\n      \"future\" : \"за {0} тромес.\",\n      \"previous\" : \"последното тромесечје\",\n      \"next\" : \"следното тромесечје\",\n      \"past\" : \"пред {0} тромес.\",\n      \"current\" : \"ова тромесечје\"\n    },\n    \"week\" : {\n      \"next\" : \"следната седмица\",\n      \"past\" : {\n        \"one\" : \"пред {0} седмица\",\n        \"other\" : \"пред {0} седмици\"\n      },\n      \"current\" : \"оваа седмица\",\n      \"previous\" : \"минатата седмица\",\n      \"future\" : {\n        \"other\" : \"за {0} седмици\",\n        \"one\" : \"за {0} седмица\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"second\" : {\n      \"current\" : \"сега\",\n      \"past\" : \"пред {0} сек.\",\n      \"future\" : \"за {0} сек.\"\n    },\n    \"now\" : \"сега\",\n    \"quarter\" : {\n      \"previous\" : \"последното тромесечје\",\n      \"current\" : \"ова тромесечје\",\n      \"past\" : \"пред {0} тромес.\",\n      \"future\" : \"за {0} тромес.\",\n      \"next\" : \"следното тромесечје\"\n    },\n    \"minute\" : {\n      \"future\" : \"за {0} мин.\",\n      \"current\" : \"оваа минута\",\n      \"past\" : \"пред {0} мин.\"\n    },\n    \"day\" : {\n      \"next\" : \"утре\",\n      \"current\" : \"денес\",\n      \"past\" : {\n        \"other\" : \"пред {0} дена\",\n        \"one\" : \"пред {0} ден\"\n      },\n      \"future\" : {\n        \"other\" : \"за {0} дена\",\n        \"one\" : \"за {0} ден\"\n      },\n      \"previous\" : \"вчера\"\n    },\n    \"week\" : {\n      \"current\" : \"оваа седмица\",\n      \"next\" : \"следната седмица\",\n      \"past\" : {\n        \"other\" : \"пред {0} седмици\",\n        \"one\" : \"пред {0} седмица\"\n      },\n      \"previous\" : \"минатата седмица\",\n      \"future\" : {\n        \"one\" : \"за {0} седмица\",\n        \"other\" : \"за {0} седмици\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"овој месец\",\n      \"next\" : \"следниот месец\",\n      \"past\" : {\n        \"other\" : \"пред {0} месеци\",\n        \"one\" : \"пред {0} месец\"\n      },\n      \"previous\" : \"минатиот месец\",\n      \"future\" : {\n        \"one\" : \"за {0} месец\",\n        \"other\" : \"за {0} месеци\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"минатата година\",\n      \"current\" : \"оваа година\",\n      \"next\" : \"следната година\",\n      \"past\" : \"пред {0} год.\",\n      \"future\" : \"за {0} год.\"\n    },\n    \"hour\" : {\n      \"current\" : \"часов\",\n      \"past\" : {\n        \"one\" : \"пред {0} час\",\n        \"other\" : \"пред {0} часа\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} час\",\n        \"other\" : \"за {0} часа\"\n      }\n    }\n  },\n  \"long\" : {\n    \"now\" : \"сега\",\n    \"minute\" : {\n      \"current\" : \"оваа минута\",\n      \"future\" : {\n        \"one\" : \"за {0} минута\",\n        \"other\" : \"за {0} минути\"\n      },\n      \"past\" : {\n        \"other\" : \"пред {0} минути\",\n        \"one\" : \"пред {0} минута\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"other\" : \"за {0} години\",\n        \"one\" : \"за {0} година\"\n      },\n      \"previous\" : \"минатата година\",\n      \"next\" : \"следната година\",\n      \"past\" : {\n        \"other\" : \"пред {0} години\",\n        \"one\" : \"пред {0} година\"\n      },\n      \"current\" : \"оваа година\"\n    },\n    \"hour\" : {\n      \"current\" : \"часов\",\n      \"past\" : {\n        \"one\" : \"пред {0} час\",\n        \"other\" : \"пред {0} часа\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} час\",\n        \"other\" : \"за {0} часа\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"сега\",\n      \"past\" : {\n        \"one\" : \"пред {0} секунда\",\n        \"other\" : \"пред {0} секунди\"\n      },\n      \"future\" : {\n        \"one\" : \"за {0} секунда\",\n        \"other\" : \"за {0} секунди\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"вчера\",\n      \"current\" : \"денес\",\n      \"future\" : {\n        \"other\" : \"за {0} дена\",\n        \"one\" : \"за {0} ден\"\n      },\n      \"past\" : {\n        \"one\" : \"пред {0} ден\",\n        \"other\" : \"пред {0} дена\"\n      },\n      \"next\" : \"утре\"\n    },\n    \"month\" : {\n      \"previous\" : \"минатиот месец\",\n      \"current\" : \"овој месец\",\n      \"next\" : \"следниот месец\",\n      \"future\" : {\n        \"other\" : \"за {0} месеци\",\n        \"one\" : \"за {0} месец\"\n      },\n      \"past\" : {\n        \"one\" : \"пред {0} месец\",\n        \"other\" : \"пред {0} месеци\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"ова тромесечје\",\n      \"previous\" : \"последното тромесечје\",\n      \"past\" : {\n        \"one\" : \"пред {0} тромесечје\",\n        \"other\" : \"пред {0} тромесечја\"\n      },\n      \"future\" : {\n        \"other\" : \"за {0} тромесечја\",\n        \"one\" : \"за {0} тромесечје\"\n      },\n      \"next\" : \"следното тромесечје\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"за {0} седмица\",\n        \"other\" : \"за {0} седмици\"\n      },\n      \"current\" : \"оваа седмица\",\n      \"next\" : \"следната седмица\",\n      \"previous\" : \"минатата седмица\",\n      \"past\" : {\n        \"one\" : \"пред {0} седмица\",\n        \"other\" : \"пред {0} седмици\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ml.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"നാളെ\",\n      \"future\" : \"{0} ദിവസത്തിൽ\",\n      \"previous\" : \"ഇന്നലെ\",\n      \"current\" : \"ഇന്ന്\",\n      \"past\" : \"{0} ദിവസം മുമ്പ്\"\n    },\n    \"quarter\" : {\n      \"next\" : \"അടുത്ത പാദം\",\n      \"past\" : \"{0} പാദം മുമ്പ്\",\n      \"future\" : \"{0} പാദത്തിൽ\",\n      \"previous\" : \"കഴിഞ്ഞ പാദം\",\n      \"current\" : \"ഈ പാദം\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} മണിക്കൂറിൽ\",\n      \"current\" : \"ഈ മണിക്കൂറിൽ\",\n      \"past\" : \"{0} മണിക്കൂർ മുമ്പ്\"\n    },\n    \"year\" : {\n      \"next\" : \"അടുത്തവർഷം\",\n      \"past\" : \"{0} വർഷം മുമ്പ്\",\n      \"current\" : \"ഈ വർ‌ഷം\",\n      \"previous\" : \"കഴിഞ്ഞ വർഷം\",\n      \"future\" : \"{0} വർഷത്തിൽ\"\n    },\n    \"now\" : \"ഇപ്പോൾ\",\n    \"month\" : {\n      \"current\" : \"ഈ മാസം\",\n      \"future\" : \"{0} മാസത്തിൽ\",\n      \"past\" : \"{0} മാസം മുമ്പ്\",\n      \"next\" : \"അടുത്ത മാസം\",\n      \"previous\" : \"കഴിഞ്ഞ മാസം\"\n    },\n    \"week\" : {\n      \"previous\" : \"കഴിഞ്ഞ ആഴ്‌ച\",\n      \"current\" : \"ഈ ആഴ്ച\",\n      \"past\" : \"{0} ആഴ്ച മുമ്പ്\",\n      \"future\" : \"{0} ആഴ്ചയിൽ\",\n      \"next\" : \"അടുത്ത ആഴ്ച\"\n    },\n    \"minute\" : {\n      \"current\" : \"ഈ മിനിറ്റിൽ\",\n      \"past\" : \"{0} മിനിറ്റ് മുമ്പ്\",\n      \"future\" : \"{0} മിനിറ്റിൽ\"\n    },\n    \"second\" : {\n      \"current\" : \"ഇപ്പോൾ\",\n      \"past\" : \"{0} സെക്കൻഡ് മുമ്പ്\",\n      \"future\" : \"{0} സെക്കൻഡിൽ\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"ഇന്നലെ\",\n      \"current\" : \"ഇന്ന്\",\n      \"next\" : \"നാളെ\",\n      \"past\" : \"{0} ദിവസം മുമ്പ്\",\n      \"future\" : \"{0} ദിവസത്തിൽ\"\n    },\n    \"week\" : {\n      \"current\" : \"ഈ ആഴ്ച\",\n      \"future\" : \"{0} ആഴ്ചയിൽ\",\n      \"past\" : \"{0} ആഴ്ച മുമ്പ്\",\n      \"previous\" : \"കഴിഞ്ഞ ആഴ്‌ച\",\n      \"next\" : \"അടുത്ത ആഴ്ച\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} മിനിറ്റ് മുമ്പ്\",\n      \"future\" : \"{0} മിനിറ്റിൽ\",\n      \"current\" : \"ഈ മിനിറ്റിൽ\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} മാസത്തിൽ\",\n      \"next\" : \"അടുത്ത മാസം\",\n      \"previous\" : \"കഴിഞ്ഞ മാസം\",\n      \"current\" : \"ഈ മാസം\",\n      \"past\" : \"{0} മാസം മുമ്പ്\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} മണിക്കൂറിൽ\",\n      \"current\" : \"ഈ മണിക്കൂറിൽ\",\n      \"past\" : \"{0} മണിക്കൂർ മുമ്പ്\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} വർഷം മുമ്പ്\",\n      \"future\" : \"{0} വർഷത്തിൽ\",\n      \"previous\" : \"കഴിഞ്ഞ വർഷം\",\n      \"next\" : \"അടുത്തവർഷം\",\n      \"current\" : \"ഈ വർ‌ഷം\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} സെക്കൻഡ് മുമ്പ്\",\n      \"future\" : \"{0} സെക്കൻഡിൽ\",\n      \"current\" : \"ഇപ്പോൾ\"\n    },\n    \"now\" : \"ഇപ്പോൾ\",\n    \"quarter\" : {\n      \"past\" : \"{0} പാദം മുമ്പ്\",\n      \"current\" : \"ഈ പാദം\",\n      \"previous\" : \"കഴിഞ്ഞ പാദം\",\n      \"future\" : \"{0} പാദത്തിൽ\",\n      \"next\" : \"അടുത്ത പാദം\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} പാദത്തിൽ\",\n      \"next\" : \"അടുത്ത പാദം\",\n      \"previous\" : \"കഴിഞ്ഞ പാദം\",\n      \"current\" : \"ഈ പാദം\",\n      \"past\" : \"{0} പാദം മുമ്പ്\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} മിനിറ്റിൽ\",\n      \"current\" : \"ഈ മിനിറ്റിൽ\",\n      \"past\" : \"{0} മിനിറ്റ് മുമ്പ്\"\n    },\n    \"year\" : {\n      \"next\" : \"അടുത്തവർഷം\",\n      \"future\" : \"{0} വർഷത്തിൽ\",\n      \"current\" : \"ഈ വർ‌ഷം\",\n      \"past\" : \"{0} വർഷം മുമ്പ്\",\n      \"previous\" : \"കഴിഞ്ഞ വർഷം\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} സെക്കൻഡിൽ\",\n      \"current\" : \"ഇപ്പോൾ\",\n      \"past\" : \"{0} സെക്കൻഡ് മുമ്പ്\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} മണിക്കൂർ മുമ്പ്\",\n      \"current\" : \"ഈ മണിക്കൂറിൽ\",\n      \"future\" : \"{0} മണിക്കൂറിൽ\"\n    },\n    \"now\" : \"ഇപ്പോൾ\",\n    \"month\" : {\n      \"previous\" : \"കഴിഞ്ഞ മാസം\",\n      \"next\" : \"അടുത്ത മാസം\",\n      \"past\" : \"{0} മാസം മുമ്പ്\",\n      \"current\" : \"ഈ മാസം\",\n      \"future\" : \"{0} മാസത്തിൽ\"\n    },\n    \"week\" : {\n      \"previous\" : \"കഴിഞ്ഞ ആഴ്‌ച\",\n      \"current\" : \"ഈ ആഴ്ച\",\n      \"next\" : \"അടുത്ത ആഴ്ച\",\n      \"past\" : \"{0} ആഴ്ച മുമ്പ്\",\n      \"future\" : \"{0} ആഴ്ചയിൽ\"\n    },\n    \"day\" : {\n      \"next\" : \"നാളെ\",\n      \"past\" : \"{0} ദിവസം മുമ്പ്\",\n      \"future\" : \"{0} ദിവസത്തിൽ\",\n      \"previous\" : \"ഇന്നലെ\",\n      \"current\" : \"ഇന്ന്\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/mn.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"маргааш\",\n      \"future\" : \"{0} өдөрт\",\n      \"previous\" : \"өчигдөр\",\n      \"current\" : \"өнөөдөр\",\n      \"past\" : \"{0} өдрийн өмнө\"\n    },\n    \"quarter\" : {\n      \"next\" : \"дараагийн улирал\",\n      \"past\" : \"{0} улирлын өмнө\",\n      \"future\" : \"{0} улиралд\",\n      \"previous\" : \"өнгөрсөн улирал\",\n      \"current\" : \"энэ улирал\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} цагт\",\n      \"current\" : \"энэ цаг\",\n      \"past\" : \"{0} ц. өмнө\"\n    },\n    \"year\" : {\n      \"next\" : \"ирэх жил\",\n      \"past\" : \"-{0} жил.н өмнө\",\n      \"current\" : \"энэ жил\",\n      \"previous\" : \"өнгөрсөн жил\",\n      \"future\" : \"+{0} жилд\"\n    },\n    \"now\" : \"одоо\",\n    \"month\" : {\n      \"current\" : \"энэ сар\",\n      \"future\" : \"+{0} сард\",\n      \"past\" : \"{0} сарын өмнө\",\n      \"next\" : \"ирэх сар\",\n      \"previous\" : \"өнгөрсөн сар\"\n    },\n    \"week\" : {\n      \"previous\" : \"өнгөрсөн долоо хоног\",\n      \"current\" : \"энэ долоо хоног\",\n      \"past\" : \"{0} 7 хоногийн өмнө\",\n      \"future\" : \"{0} 7 хоногт\",\n      \"next\" : \"ирэх долоо хоног\"\n    },\n    \"minute\" : {\n      \"current\" : \"энэ минут\",\n      \"past\" : \"{0} мин. өмнө\",\n      \"future\" : \"{0} мин. дотор\"\n    },\n    \"second\" : {\n      \"current\" : \"одоо\",\n      \"past\" : \"{0} сек. өмнө\",\n      \"future\" : \"{0} сек. дотор\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"өчигдөр\",\n      \"current\" : \"өнөөдөр\",\n      \"next\" : \"маргааш\",\n      \"past\" : \"{0} өдрийн өмнө\",\n      \"future\" : \"{0} өдөрт\"\n    },\n    \"week\" : {\n      \"current\" : \"энэ долоо хоног\",\n      \"future\" : \"{0} 7 хоногт\",\n      \"past\" : \"{0} 7 хоногийн өмнө\",\n      \"previous\" : \"өнгөрсөн долоо хоног\",\n      \"next\" : \"ирэх долоо хоног\"\n    },\n    \"minute\" : {\n      \"current\" : \"энэ минут\",\n      \"past\" : \"{0} минутын өмнө\",\n      \"future\" : \"{0} минутын дотор\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} сард\",\n      \"next\" : \"ирэх сар\",\n      \"previous\" : \"өнгөрсөн сар\",\n      \"current\" : \"энэ сар\",\n      \"past\" : \"{0} сарын өмнө\"\n    },\n    \"hour\" : {\n      \"current\" : \"энэ цаг\",\n      \"past\" : \"{0} цагийн өмнө\",\n      \"future\" : \"{0} цагт\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} жилийн өмнө\",\n      \"future\" : \"{0} жилийн дотор\",\n      \"previous\" : \"өнгөрсөн жил\",\n      \"next\" : \"ирэх жил\",\n      \"current\" : \"энэ жил\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} секундын өмнө\",\n      \"future\" : \"{0} секундын дотор\",\n      \"current\" : \"одоо\"\n    },\n    \"now\" : \"одоо\",\n    \"quarter\" : {\n      \"past\" : \"{0} улирлын өмнө\",\n      \"current\" : \"энэ улирал\",\n      \"previous\" : \"өнгөрсөн улирал\",\n      \"future\" : \"{0} улиралд\",\n      \"next\" : \"дараагийн улирал\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} улиралд\",\n      \"next\" : \"дараагийн улирал\",\n      \"previous\" : \"өнгөрсөн улирал\",\n      \"current\" : \"энэ улирал\",\n      \"past\" : \"{0} улирлын өмнө\"\n    },\n    \"minute\" : {\n      \"current\" : \"энэ минут\",\n      \"past\" : \"{0} мин. өмнө\",\n      \"future\" : \"{0} мин. дотор\"\n    },\n    \"year\" : {\n      \"next\" : \"ирэх жил\",\n      \"future\" : \"{0} жилийн дотор\",\n      \"current\" : \"энэ жил\",\n      \"past\" : \"{0} жилийн өмнө\",\n      \"previous\" : \"өнгөрсөн жил\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} сек. дотор\",\n      \"current\" : \"одоо\",\n      \"past\" : \"{0} сек. өмнө\"\n    },\n    \"hour\" : {\n      \"current\" : \"энэ цаг\",\n      \"past\" : \"{0} ц. өмнө\",\n      \"future\" : \"{0} цагт\"\n    },\n    \"now\" : \"одоо\",\n    \"month\" : {\n      \"previous\" : \"өнгөрсөн сар\",\n      \"next\" : \"ирэх сар\",\n      \"past\" : \"{0} сарын өмнө\",\n      \"current\" : \"энэ сар\",\n      \"future\" : \"{0} сард\"\n    },\n    \"week\" : {\n      \"previous\" : \"өнгөрсөн долоо хоног\",\n      \"current\" : \"энэ долоо хоног\",\n      \"next\" : \"ирэх долоо хоног\",\n      \"past\" : \"{0} 7 хоногийн өмнө\",\n      \"future\" : \"{0} 7 хоногт\"\n    },\n    \"day\" : {\n      \"next\" : \"маргааш\",\n      \"past\" : \"{0} өдрийн өмнө\",\n      \"future\" : \"{0} өдөрт\",\n      \"previous\" : \"өчигдөр\",\n      \"current\" : \"өнөөдөр\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/mr.json",
    "content": "{\n  \"narrow\" : {\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"येत्या {0} तासांमध्ये\",\n        \"one\" : \"येत्या {0} तासामध्ये\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} तासापूर्वी\",\n        \"other\" : \"{0} तासांपूर्वी\"\n      },\n      \"current\" : \"तासात\"\n    },\n    \"now\" : \"आत्ता\",\n    \"quarter\" : {\n      \"current\" : \"ही तिमाही\",\n      \"next\" : \"पुढील तिमाही\",\n      \"previous\" : \"मागील तिमाही\",\n      \"past\" : {\n        \"one\" : \"{0} तिमाहीपूर्वी\",\n        \"other\" : \"{0} तिमाहींपूर्वी\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} तिमाहीमध्ये\",\n        \"other\" : \"{0} तिमाहींमध्ये\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"पुढील वर्ष\",\n      \"previous\" : \"मागील वर्ष\",\n      \"past\" : {\n        \"one\" : \"{0} वर्षापूर्वी\",\n        \"other\" : \"{0} वर्षांपूर्वी\"\n      },\n      \"current\" : \"हे वर्ष\",\n      \"future\" : {\n        \"one\" : \"येत्या {0} वर्षामध्ये\",\n        \"other\" : \"येत्या {0} वर्षांमध्ये\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"पुढील आठवडा\",\n      \"previous\" : \"मागील आठवडा\",\n      \"future\" : {\n        \"other\" : \"येत्या {0} आठवड्यांमध्ये\",\n        \"one\" : \"येत्या {0} आठवड्यामध्ये\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} आठवड्यांपूर्वी\",\n        \"one\" : \"{0} आठवड्यापूर्वी\"\n      },\n      \"current\" : \"हा आठवडा\"\n    },\n    \"month\" : {\n      \"previous\" : \"मागील महिना\",\n      \"next\" : \"पुढील महिना\",\n      \"future\" : {\n        \"one\" : \"{0} महिन्यामध्ये\",\n        \"other\" : \"{0} महिन्यांमध्ये\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} महिन्यांपूर्वी\",\n        \"one\" : \"{0} महिन्यापूर्वी\"\n      },\n      \"current\" : \"हा महिना\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"one\" : \"{0} दिवसामध्ये\",\n        \"other\" : \"{0} दिवसांमध्ये\"\n      },\n      \"previous\" : \"काल\",\n      \"current\" : \"आज\",\n      \"next\" : \"उद्या\",\n      \"past\" : {\n        \"one\" : \"{0} दिवसापूर्वी\",\n        \"other\" : \"{0} दिवसांपूर्वी\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : \"{0} मिनि. मध्ये\",\n      \"current\" : \"या मिनिटात\",\n      \"past\" : \"{0} मिनि. पूर्वी\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} से. पूर्वी\",\n      \"current\" : \"आत्ता\",\n      \"future\" : {\n        \"one\" : \"{0} से. मध्ये\",\n        \"other\" : \"येत्या {0} से. मध्ये\"\n      }\n    }\n  },\n  \"long\" : {\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"{0} सेकंदांपूर्वी\",\n        \"one\" : \"{0} सेकंदापूर्वी\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} सेकंदांमध्ये\",\n        \"one\" : \"{0} सेकंदामध्ये\"\n      },\n      \"current\" : \"आत्ता\"\n    },\n    \"year\" : {\n      \"previous\" : \"मागील वर्ष\",\n      \"current\" : \"हे वर्ष\",\n      \"next\" : \"पुढील वर्ष\",\n      \"past\" : {\n        \"one\" : \"{0} वर्षापूर्वी\",\n        \"other\" : \"{0} वर्षांपूर्वी\"\n      },\n      \"future\" : {\n        \"one\" : \"येत्या {0} वर्षामध्ये\",\n        \"other\" : \"येत्या {0} वर्षांमध्ये\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"ही तिमाही\",\n      \"future\" : {\n        \"one\" : \"{0} तिमाहीमध्ये\",\n        \"other\" : \"{0} तिमाहींमध्ये\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} तिमाहींपूर्वी\",\n        \"one\" : \"{0} तिमाहीपूर्वी\"\n      },\n      \"previous\" : \"मागील तिमाही\",\n      \"next\" : \"पुढील तिमाही\"\n    },\n    \"minute\" : {\n      \"current\" : \"या मिनिटात\",\n      \"past\" : {\n        \"other\" : \"{0} मिनिटांपूर्वी\",\n        \"one\" : \"{0} मिनिटापूर्वी\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} मिनिटांमध्ये\",\n        \"one\" : \"{0} मिनिटामध्ये\"\n      }\n    },\n    \"now\" : \"आत्ता\",\n    \"month\" : {\n      \"future\" : {\n        \"other\" : \"येत्या {0} महिन्यांमध्ये\",\n        \"one\" : \"येत्या {0} महिन्यामध्ये\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} महिन्यापूर्वी\",\n        \"other\" : \"{0} महिन्यांपूर्वी\"\n      },\n      \"current\" : \"हा महिना\",\n      \"next\" : \"पुढील महिना\",\n      \"previous\" : \"मागील महिना\"\n    },\n    \"week\" : {\n      \"current\" : \"हा आठवडा\",\n      \"next\" : \"पुढील आठवडा\",\n      \"previous\" : \"मागील आठवडा\",\n      \"past\" : {\n        \"one\" : \"{0} आठवड्यापूर्वी\",\n        \"other\" : \"{0} आठवड्यांपूर्वी\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} आठवड्यामध्ये\",\n        \"other\" : \"{0} आठवड्यांमध्ये\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"तासात\",\n      \"past\" : {\n        \"one\" : \"{0} तासापूर्वी\",\n        \"other\" : \"{0} तासांपूर्वी\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} तासांमध्ये\",\n        \"one\" : \"{0} तासामध्ये\"\n      }\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"{0} दिवसापूर्वी\",\n        \"other\" : \"{0} दिवसांपूर्वी\"\n      },\n      \"previous\" : \"काल\",\n      \"next\" : \"उद्या\",\n      \"future\" : {\n        \"other\" : \"येत्या {0} दिवसांमध्ये\",\n        \"one\" : \"येत्या {0} दिवसामध्ये\"\n      },\n      \"current\" : \"आज\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"past\" : \"{0} से. पूर्वी\",\n      \"current\" : \"आत्ता\",\n      \"future\" : \"{0} से. मध्ये\"\n    },\n    \"day\" : {\n      \"next\" : \"उद्या\",\n      \"past\" : {\n        \"one\" : \"{0} दिवसापूर्वी\",\n        \"other\" : \"{0} दिवसांपूर्वी\"\n      },\n      \"previous\" : \"काल\",\n      \"future\" : {\n        \"other\" : \"येत्या {0} दिवसांमध्ये\",\n        \"one\" : \"{0} दिवसामध्ये\"\n      },\n      \"current\" : \"आज\"\n    },\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"{0} वर्षापूर्वी\",\n        \"other\" : \"{0} वर्षांपूर्वी\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} वर्षामध्ये\",\n        \"other\" : \"{0} वर्षांमध्ये\"\n      },\n      \"previous\" : \"मागील वर्ष\",\n      \"current\" : \"हे वर्ष\",\n      \"next\" : \"पुढील वर्ष\"\n    },\n    \"week\" : {\n      \"previous\" : \"मागील आठवडा\",\n      \"current\" : \"हा आठवडा\",\n      \"next\" : \"पुढील आठवडा\",\n      \"past\" : {\n        \"one\" : \"{0} आठवड्यापूर्वी\",\n        \"other\" : \"{0} आठवड्यांपूर्वी\"\n      },\n      \"future\" : {\n        \"one\" : \"येत्या {0} आठवड्यामध्ये\",\n        \"other\" : \"येत्या {0} आठवड्यांमध्ये\"\n      }\n    },\n    \"now\" : \"आत्ता\",\n    \"minute\" : {\n      \"past\" : \"{0} मिनि. पूर्वी\",\n      \"future\" : \"{0} मिनि. मध्ये\",\n      \"current\" : \"या मिनिटात\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"मागील तिमाही\",\n      \"future\" : {\n        \"other\" : \"येत्या {0} तिमाहींमध्ये\",\n        \"one\" : \"येत्या {0} तिमाहीमध्ये\"\n      },\n      \"next\" : \"पुढील तिमाही\",\n      \"past\" : {\n        \"other\" : \"{0} तिमाहींपूर्वी\",\n        \"one\" : \"{0} तिमाहीपूर्वी\"\n      },\n      \"current\" : \"ही तिमाही\"\n    },\n    \"month\" : {\n      \"next\" : \"पुढील महिना\",\n      \"past\" : {\n        \"one\" : \"{0} महिन्यापूर्वी\",\n        \"other\" : \"{0} महिन्यांपूर्वी\"\n      },\n      \"future\" : \"{0} महिन्यामध्ये\",\n      \"previous\" : \"मागील महिना\",\n      \"current\" : \"हा महिना\"\n    },\n    \"hour\" : {\n      \"current\" : \"तासात\",\n      \"past\" : {\n        \"one\" : \"{0} तासापूर्वी\",\n        \"other\" : \"{0} तासांपूर्वी\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} तासामध्ये\",\n        \"other\" : \"{0} तासांमध्ये\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ms.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"esok\",\n      \"future\" : \"dlm {0} hari\",\n      \"previous\" : \"semlm\",\n      \"current\" : \"hari ini\",\n      \"past\" : \"{0} hari lalu\"\n    },\n    \"quarter\" : {\n      \"next\" : \"suku seterusnya\",\n      \"past\" : \"{0} suku thn lalu\",\n      \"future\" : \"dlm {0} suku thn\",\n      \"previous\" : \"suku lepas\",\n      \"current\" : \"suku ini\"\n    },\n    \"hour\" : {\n      \"future\" : \"dlm {0} jam\",\n      \"current\" : \"jam ini\",\n      \"past\" : \"{0} jam lalu\"\n    },\n    \"year\" : {\n      \"next\" : \"thn depan\",\n      \"past\" : \"{0} thn lalu\",\n      \"current\" : \"thn ini\",\n      \"previous\" : \"thn lepas\",\n      \"future\" : \"dalam {0} thn\"\n    },\n    \"now\" : \"sekarang\",\n    \"month\" : {\n      \"current\" : \"bln ini\",\n      \"future\" : \"dlm {0} bln\",\n      \"past\" : \"{0} bulan lalu\",\n      \"next\" : \"bln depan\",\n      \"previous\" : \"bln lalu\"\n    },\n    \"week\" : {\n      \"previous\" : \"mng lepas\",\n      \"current\" : \"mng ini\",\n      \"past\" : \"{0} mgu lalu\",\n      \"future\" : \"dlm {0} mgu\",\n      \"next\" : \"mng depan\"\n    },\n    \"minute\" : {\n      \"current\" : \"pada minit ini\",\n      \"past\" : \"{0} min lalu\",\n      \"future\" : \"dlm {0} min\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} saat lalu\",\n      \"current\" : \"sekarang\",\n      \"future\" : \"dlm {0} saat\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"semalam\",\n      \"current\" : \"hari ini\",\n      \"next\" : \"esok\",\n      \"past\" : \"{0} hari lalu\",\n      \"future\" : \"dalam {0} hari\"\n    },\n    \"week\" : {\n      \"current\" : \"minggu ini\",\n      \"future\" : \"dalam {0} minggu\",\n      \"past\" : \"{0} minggu lalu\",\n      \"previous\" : \"minggu lalu\",\n      \"next\" : \"minggu depan\"\n    },\n    \"minute\" : {\n      \"current\" : \"pada minit ini\",\n      \"past\" : \"{0} minit lalu\",\n      \"future\" : \"dalam {0} minit\"\n    },\n    \"month\" : {\n      \"future\" : \"dalam {0} bulan\",\n      \"next\" : \"bulan depan\",\n      \"previous\" : \"bulan lalu\",\n      \"current\" : \"bulan ini\",\n      \"past\" : \"{0} bulan lalu\"\n    },\n    \"hour\" : {\n      \"current\" : \"jam ini\",\n      \"future\" : \"dalam {0} jam\",\n      \"past\" : \"{0} jam lalu\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} tahun lalu\",\n      \"future\" : \"dalam {0} tahun\",\n      \"previous\" : \"tahun lalu\",\n      \"next\" : \"tahun depan\",\n      \"current\" : \"tahun ini\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} saat lalu\",\n      \"current\" : \"sekarang\",\n      \"future\" : \"dalam {0} saat\"\n    },\n    \"now\" : \"sekarang\",\n    \"quarter\" : {\n      \"past\" : \"{0} suku tahun lalu\",\n      \"current\" : \"suku tahun ini\",\n      \"previous\" : \"suku tahun lalu\",\n      \"future\" : \"dalam {0} suku tahun\",\n      \"next\" : \"suku tahun seterusnya\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"dlm {0} suku thn\",\n      \"next\" : \"suku seterusnya\",\n      \"previous\" : \"suku lepas\",\n      \"current\" : \"suku ini\",\n      \"past\" : \"{0} suku thn lalu\"\n    },\n    \"minute\" : {\n      \"current\" : \"pada minit ini\",\n      \"past\" : \"{0} min lalu\",\n      \"future\" : \"dlm {0} min\"\n    },\n    \"year\" : {\n      \"next\" : \"thn depan\",\n      \"future\" : \"dalam {0} thn\",\n      \"current\" : \"thn ini\",\n      \"past\" : \"{0} thn lalu\",\n      \"previous\" : \"thn lepas\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} saat lalu\",\n      \"current\" : \"sekarang\",\n      \"future\" : \"dlm {0} saat\"\n    },\n    \"hour\" : {\n      \"current\" : \"jam ini\",\n      \"past\" : \"{0} jam lalu\",\n      \"future\" : \"dlm {0} jam\"\n    },\n    \"now\" : \"sekarang\",\n    \"month\" : {\n      \"previous\" : \"bln lalu\",\n      \"next\" : \"bln depan\",\n      \"past\" : \"{0} bln lalu\",\n      \"current\" : \"bln ini\",\n      \"future\" : \"dlm {0} bln\"\n    },\n    \"week\" : {\n      \"previous\" : \"mng lepas\",\n      \"current\" : \"mng ini\",\n      \"next\" : \"mng depan\",\n      \"past\" : \"{0} mgu lalu\",\n      \"future\" : \"dlm {0} mgu\"\n    },\n    \"day\" : {\n      \"next\" : \"esok\",\n      \"past\" : \"{0} hari lalu\",\n      \"future\" : \"dlm {0} hari\",\n      \"previous\" : \"semlm\",\n      \"current\" : \"hari ini\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/mt.json",
    "content": "{\n  \"narrow\" : {\n    \"now\" : \"now\",\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"current\" : \"this hour\",\n      \"past\" : \"-{0} h\"\n    },\n    \"minute\" : {\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\",\n      \"past\" : \"-{0} min\"\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"past\" : \"-{0} s\",\n      \"current\" : \"now\"\n    },\n    \"year\" : {\n      \"next\" : \"Is-sena d-dieħla\",\n      \"future\" : \"+{0} y\",\n      \"previous\" : \"Is-sena li għaddiet\",\n      \"current\" : \"din is-sena\",\n      \"past\" : {\n        \"one\" : \"{0} sena ilu\",\n        \"other\" : \"{0} snin ilu\"\n      }\n    },\n    \"week\" : {\n      \"past\" : \"-{0} w\",\n      \"next\" : \"Il-ġimgħa d-dieħla\",\n      \"future\" : \"+{0} w\",\n      \"previous\" : \"Il-ġimgħa li għaddiet\",\n      \"current\" : \"Din il-ġimgħa\"\n    },\n    \"month\" : {\n      \"previous\" : \"Ix-xahar li għadda\",\n      \"current\" : \"Dan ix-xahar\",\n      \"next\" : \"Ix-xahar id-dieħel\",\n      \"past\" : \"-{0} m\",\n      \"future\" : \"+{0} m\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\"\n    },\n    \"day\" : {\n      \"next\" : \"Għada\",\n      \"previous\" : \"Ilbieraħ\",\n      \"past\" : \"-{0} d\",\n      \"future\" : \"+{0} d\",\n      \"current\" : \"Illum\"\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"day\" : {\n      \"previous\" : \"Ilbieraħ\",\n      \"past\" : \"-{0} d\",\n      \"future\" : \"+{0} d\",\n      \"current\" : \"Illum\",\n      \"next\" : \"Għada\"\n    },\n    \"week\" : {\n      \"next\" : \"Il-ġimgħa d-dieħla\",\n      \"past\" : \"-{0} w\",\n      \"future\" : \"+{0} w\",\n      \"previous\" : \"Il-ġimgħa li għaddiet\",\n      \"current\" : \"Din il-ġimgħa\"\n    },\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"past\" : \"-{0} h\",\n      \"current\" : \"this hour\"\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"now\",\n      \"past\" : \"-{0} s\"\n    },\n    \"year\" : {\n      \"previous\" : \"Is-sena li għaddiet\",\n      \"past\" : {\n        \"one\" : \"{0} sena ilu\",\n        \"other\" : \"{0} snin ilu\"\n      },\n      \"next\" : \"Is-sena d-dieħla\",\n      \"future\" : \"+{0} y\",\n      \"current\" : \"din is-sena\"\n    },\n    \"month\" : {\n      \"next\" : \"Ix-xahar id-dieħel\",\n      \"past\" : \"-{0} m\",\n      \"previous\" : \"Ix-xahar li għadda\",\n      \"current\" : \"Dan ix-xahar\",\n      \"future\" : \"+{0} m\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"current\" : \"this minute\",\n      \"future\" : \"+{0} min\"\n    },\n    \"now\" : \"now\"\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"past\" : \"-{0} h\",\n      \"future\" : \"+{0} h\",\n      \"current\" : \"this hour\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"previous\" : \"last quarter\"\n    },\n    \"day\" : {\n      \"current\" : \"Illum\",\n      \"past\" : \"-{0} d\",\n      \"future\" : \"+{0} d\",\n      \"next\" : \"Għada\",\n      \"previous\" : \"Ilbieraħ\"\n    },\n    \"week\" : {\n      \"current\" : \"Din il-ġimgħa\",\n      \"past\" : \"-{0} w\",\n      \"future\" : \"+{0} w\",\n      \"next\" : \"Il-ġimgħa d-dieħla\",\n      \"previous\" : \"Il-ġimgħa li għaddiet\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"current\" : \"this minute\",\n      \"future\" : \"+{0} min\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"-{0} s\",\n      \"future\" : \"+{0} s\"\n    },\n    \"month\" : {\n      \"current\" : \"Dan ix-xahar\",\n      \"future\" : \"+{0} m\",\n      \"previous\" : \"Ix-xahar li għadda\",\n      \"next\" : \"Ix-xahar id-dieħel\",\n      \"past\" : \"-{0} m\"\n    },\n    \"year\" : {\n      \"future\" : \"+{0} y\",\n      \"previous\" : \"Is-sena li għaddiet\",\n      \"next\" : \"Is-sena d-dieħla\",\n      \"current\" : \"din is-sena\",\n      \"past\" : {\n        \"other\" : \"{0} snin ilu\",\n        \"one\" : \"{0} sena ilu\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/my.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"ပြီးခဲ့သည့် သုံးလပတ်ကာလ {0} ခုအတွင်း\",\n      \"future\" : \"သုံးလပတ်ကာလ {0} ခုအတွင်း\",\n      \"current\" : \"ယခုသုံးလပတ်\",\n      \"previous\" : \"ပြီးခဲ့သောသုံးလပတ်\",\n      \"next\" : \"နောက်လာမည့်သုံးလပတ်\"\n    },\n    \"year\" : {\n      \"previous\" : \"ယမန်နှစ်\",\n      \"next\" : \"လာမည့်နှစ်\",\n      \"future\" : \"{0} နှစ်အတွင်း\",\n      \"current\" : \"ယခုနှစ်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} နှစ်\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} ပတ်အတွင်း\",\n      \"previous\" : \"ပြီးခဲ့သည့် သီတင်းပတ်\",\n      \"next\" : \"လာမည့် သီတင်းပတ်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} ပတ်\",\n      \"current\" : \"ယခု သီတင်းပတ်\"\n    },\n    \"day\" : {\n      \"current\" : \"ယနေ့\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} ရက်\",\n      \"next\" : \"မနက်ဖြန်\",\n      \"future\" : \"{0} ရက်အတွင်း\",\n      \"previous\" : \"မနေ့က\"\n    },\n    \"hour\" : {\n      \"current\" : \"ဤအချိန်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} နာရီ\",\n      \"future\" : \"{0} နာရီအတွင်း\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} မိနစ်အတွင်း\",\n      \"current\" : \"ဤမိနစ်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} မိနစ်\"\n    },\n    \"month\" : {\n      \"next\" : \"လာမည့်လ\",\n      \"current\" : \"ယခုလ\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} လ\",\n      \"future\" : \"{0} လအတွင်း\",\n      \"previous\" : \"ပြီးခဲ့သည့်လ\"\n    },\n    \"now\" : \"ယခု\",\n    \"second\" : {\n      \"future\" : \"{0} စက္ကန့်အတွင်း\",\n      \"current\" : \"ယခု\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} စက္ကန့်\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"ပြီးခဲ့သည့် {0} မိနစ်\",\n      \"future\" : \"{0} မိနစ်အတွင်း\",\n      \"current\" : \"ဤမိနစ်\"\n    },\n    \"week\" : {\n      \"current\" : \"ယခု သီတင်းပတ်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} ပတ်\",\n      \"future\" : \"{0} ပတ်အတွင်း\",\n      \"next\" : \"လာမည့် သီတင်းပတ်\",\n      \"previous\" : \"ပြီးခဲ့သည့် သီတင်းပတ်\"\n    },\n    \"year\" : {\n      \"current\" : \"ယခုနှစ်\",\n      \"future\" : \"{0} နှစ်အတွင်း\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} နှစ်\",\n      \"next\" : \"လာမည့်နှစ်\",\n      \"previous\" : \"ယမန်နှစ်\"\n    },\n    \"day\" : {\n      \"next\" : \"မနက်ဖြန်\",\n      \"current\" : \"ယနေ့\",\n      \"previous\" : \"မနေ့က\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} ရက်\",\n      \"future\" : \"{0} ရက်အတွင်း\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} နာရီအတွင်း\",\n      \"current\" : \"ဤအချိန်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} နာရီ\"\n    },\n    \"quarter\" : {\n      \"current\" : \"ယခုသုံးလပတ်\",\n      \"future\" : \"သုံးလပတ်ကာလ {0} ခုအတွင်း\",\n      \"previous\" : \"ပြီးခဲ့သောသုံးလပတ်\",\n      \"next\" : \"နောက်လာမည့်သုံးလပတ်\",\n      \"past\" : \"ပြီးခဲ့သည့် သုံးလပတ်ကာလ {0} ခုအတွင်း\"\n    },\n    \"second\" : {\n      \"past\" : \"ပြီးခဲ့သည့် {0} စက္ကန့်\",\n      \"current\" : \"ယခု\",\n      \"future\" : \"{0} စက္ကန့်အတွင်း\"\n    },\n    \"month\" : {\n      \"current\" : \"ယခုလ\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} လ\",\n      \"future\" : \"{0} လအတွင်း\",\n      \"next\" : \"လာမည့်လ\",\n      \"previous\" : \"ပြီးခဲ့သည့်လ\"\n    },\n    \"now\" : \"ယခု\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} နာရီအတွင်း\",\n      \"current\" : \"ဤအချိန်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} နာရီ\"\n    },\n    \"day\" : {\n      \"next\" : \"မနက်ဖြန်\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} ရက်\",\n      \"previous\" : \"မနေ့က\",\n      \"future\" : \"{0} ရက်အတွင်း\",\n      \"current\" : \"ယနေ့\"\n    },\n    \"second\" : {\n      \"past\" : \"ပြီးခဲ့သည့် {0} စက္ကန့်\",\n      \"current\" : \"ယခု\",\n      \"future\" : \"{0} စက္ကန့်အတွင်း\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} ပတ်အတွင်း\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} ပတ်\",\n      \"current\" : \"ယခု သီတင်းပတ်\",\n      \"next\" : \"လာမည့် သီတင်းပတ်\",\n      \"previous\" : \"ပြီးခဲ့သည့် သီတင်းပတ်\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} မိနစ်အတွင်း\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} မိနစ်\",\n      \"current\" : \"ဤမိနစ်\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} လအတွင်း\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} လ\",\n      \"current\" : \"ယခုလ\",\n      \"previous\" : \"ပြီးခဲ့သည့်လ\",\n      \"next\" : \"လာမည့်လ\"\n    },\n    \"now\" : \"ယခု\",\n    \"year\" : {\n      \"current\" : \"ယခုနှစ်\",\n      \"next\" : \"လာမည့်နှစ်\",\n      \"previous\" : \"ယမန်နှစ်\",\n      \"future\" : \"{0} နှစ်အတွင်း\",\n      \"past\" : \"ပြီးခဲ့သည့် {0} နှစ်\"\n    },\n    \"quarter\" : {\n      \"future\" : \"သုံးလပတ်ကာလ {0} အတွင်း\",\n      \"previous\" : \"ပြီးခဲ့သည့် သုံးလပတ်\",\n      \"past\" : \"ပြီးခဲ့သည့် သုံးလပတ်ကာလ {0} ခုအတွင်း\",\n      \"next\" : \"လာမည့် သုံးလပတ်\",\n      \"current\" : \"ယခု သုံးလပတ်\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/mzn.json",
    "content": "{\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} ساعِت دله\",\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} ساعِت پیش\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} ثانیه دله\",\n      \"past\" : \"{0} ثانیه پیش\",\n      \"current\" : \"now\"\n    },\n    \"week\" : {\n      \"next\" : \"بعدی هفته\",\n      \"current\" : \"این هفته\",\n      \"previous\" : \"قبلی هفته\",\n      \"future\" : \"{0} هفته دله\",\n      \"past\" : \"{0} هفته پیش\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} دَقه پیش\",\n      \"future\" : \"{0} دقیقه دله\",\n      \"current\" : \"this minute\"\n    },\n    \"year\" : {\n      \"current\" : \"امسال\",\n      \"past\" : \"{0} سال پیش\",\n      \"future\" : \"{0} سال دله\",\n      \"previous\" : \"پارسال\",\n      \"next\" : \"سال دیگه\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"{0} ربع دله\",\n      \"previous\" : \"last quarter\",\n      \"past\" : \"{0} ربع پیش\"\n    },\n    \"month\" : {\n      \"previous\" : \"ماه قبل\",\n      \"future\" : \"{0} ماه دله\",\n      \"current\" : \"این ماه\",\n      \"next\" : \"ماه ِبعد\",\n      \"past\" : \"{0} ماه پیش\"\n    },\n    \"day\" : {\n      \"next\" : \"فِردا\",\n      \"past\" : \"{0} روز پیش\",\n      \"current\" : \"اَمروز\",\n      \"future\" : \"{0} روز دله\",\n      \"previous\" : \"دیروز\"\n    },\n    \"now\" : \"now\"\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"current\" : \"این هفته\",\n      \"next\" : \"بعدی هفته\",\n      \"past\" : \"{0} هفته پیش\",\n      \"previous\" : \"قبلی هفته\",\n      \"future\" : \"{0} هفته دله\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} دَقه دله\",\n      \"past\" : \"{0} دَقه پیش\",\n      \"current\" : \"this minute\"\n    },\n    \"month\" : {\n      \"current\" : \"این ماه\",\n      \"previous\" : \"ماه قبل\",\n      \"past\" : \"{0} ماه پیش\",\n      \"next\" : \"ماه ِبعد\",\n      \"future\" : \"{0} ماه دله\"\n    },\n    \"now\" : \"now\",\n    \"year\" : {\n      \"previous\" : \"پارسال\",\n      \"current\" : \"امسال\",\n      \"next\" : \"سال دیگه\",\n      \"past\" : \"{0} سال پیش\",\n      \"future\" : \"{0} سال دله\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} ساعت پیش\",\n      \"future\" : \"{0} ساعت دله\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"{0} ربع پیش\",\n      \"future\" : \"{0} ربع دله\",\n      \"next\" : \"next quarter\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : \"{0} ثانیه دله\",\n      \"past\" : \"{0} ثانیه پیش\"\n    },\n    \"day\" : {\n      \"past\" : \"{0} روز پیش\",\n      \"current\" : \"اَمروز\",\n      \"future\" : \"{0} روز دله\",\n      \"previous\" : \"دیروز\",\n      \"next\" : \"فِردا\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"current\" : \"این ماه\",\n      \"next\" : \"ماه ِبعد\",\n      \"past\" : \"{0} ماه پیش\",\n      \"future\" : \"{0} ماه دله\",\n      \"previous\" : \"ماه قبل\"\n    },\n    \"now\" : \"now\",\n    \"day\" : {\n      \"next\" : \"فِردا\",\n      \"current\" : \"اَمروز\",\n      \"previous\" : \"دیروز\",\n      \"past\" : \"{0} روز پیش\",\n      \"future\" : \"{0} روز دله\"\n    },\n    \"year\" : {\n      \"current\" : \"امسال\",\n      \"future\" : \"{0} سال دله\",\n      \"previous\" : \"پارسال\",\n      \"next\" : \"سال دیگه\",\n      \"past\" : \"{0} سال پیش\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ساعت پیش\",\n      \"current\" : \"this hour\",\n      \"future\" : \"{0} ساعت دله\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} دَقه پیش\",\n      \"future\" : \"{0} دَقه دله\",\n      \"current\" : \"this minute\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} ثانیه دله\",\n      \"current\" : \"now\",\n      \"past\" : \"{0} ثانیه پیش\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} ربع دله\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"{0} ربع پیش\",\n      \"current\" : \"this quarter\"\n    },\n    \"week\" : {\n      \"next\" : \"بعدی هفته\",\n      \"past\" : \"{0} هفته پیش\",\n      \"current\" : \"این هفته\",\n      \"previous\" : \"قبلی هفته\",\n      \"future\" : \"{0} هفته دله\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/nb.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"–{0} kv.\",\n      \"future\" : \"+{0} kv.\",\n      \"current\" : \"dette kv.\",\n      \"previous\" : \"forrige kv.\",\n      \"next\" : \"neste kv.\"\n    },\n    \"year\" : {\n      \"previous\" : \"i fjor\",\n      \"next\" : \"neste år\",\n      \"future\" : \"+{0} år\",\n      \"current\" : \"i år\",\n      \"past\" : \"–{0} år\"\n    },\n    \"week\" : {\n      \"future\" : \"+{0} u.\",\n      \"previous\" : \"forrige uke\",\n      \"next\" : \"neste uke\",\n      \"past\" : \"-{0} u.\",\n      \"current\" : \"denne uken\"\n    },\n    \"day\" : {\n      \"current\" : \"i dag\",\n      \"past\" : \"-{0} d.\",\n      \"next\" : \"i morgen\",\n      \"future\" : \"+{0} d.\",\n      \"previous\" : \"i går\"\n    },\n    \"hour\" : {\n      \"current\" : \"denne timen\",\n      \"past\" : \"-{0} t\",\n      \"future\" : \"+{0} t\"\n    },\n    \"minute\" : {\n      \"future\" : \"+{0} min\",\n      \"current\" : \"dette minuttet\",\n      \"past\" : \"-{0} min\"\n    },\n    \"month\" : {\n      \"next\" : \"neste md.\",\n      \"current\" : \"denne md.\",\n      \"past\" : \"-{0} md.\",\n      \"future\" : \"+{0} md.\",\n      \"previous\" : \"forrige md.\"\n    },\n    \"now\" : \"nå\",\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"nå\",\n      \"past\" : \"-{0} s\"\n    }\n  },\n  \"long\" : {\n    \"month\" : {\n      \"next\" : \"neste måned\",\n      \"current\" : \"denne måneden\",\n      \"future\" : {\n        \"one\" : \"om {0} måned\",\n        \"other\" : \"om {0} måneder\"\n      },\n      \"previous\" : \"forrige måned\",\n      \"past\" : {\n        \"one\" : \"for {0} måned siden\",\n        \"other\" : \"for {0} måneder siden\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"denne timen\",\n      \"future\" : {\n        \"one\" : \"om {0} time\",\n        \"other\" : \"om {0} timer\"\n      },\n      \"past\" : {\n        \"one\" : \"for {0} time siden\",\n        \"other\" : \"for {0} timer siden\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"om {0} sekund\",\n        \"other\" : \"om {0} sekunder\"\n      },\n      \"current\" : \"nå\",\n      \"past\" : {\n        \"other\" : \"for {0} sekunder siden\",\n        \"one\" : \"for {0} sekund siden\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"forrige uke\",\n      \"past\" : {\n        \"other\" : \"for {0} uker siden\",\n        \"one\" : \"for {0} uke siden\"\n      },\n      \"future\" : {\n        \"other\" : \"om {0} uker\",\n        \"one\" : \"om {0} uke\"\n      },\n      \"current\" : \"denne uken\",\n      \"next\" : \"neste uke\"\n    },\n    \"year\" : {\n      \"current\" : \"i år\",\n      \"next\" : \"neste år\",\n      \"previous\" : \"i fjor\",\n      \"future\" : \"om {0} år\",\n      \"past\" : \"for {0} år siden\"\n    },\n    \"now\" : \"nå\",\n    \"quarter\" : {\n      \"future\" : {\n        \"one\" : \"om {0} kvartal\",\n        \"other\" : \"om {0} kvartaler\"\n      },\n      \"previous\" : \"forrige kvartal\",\n      \"past\" : {\n        \"other\" : \"for {0} kvartaler siden\",\n        \"one\" : \"for {0} kvartal siden\"\n      },\n      \"next\" : \"neste kvartal\",\n      \"current\" : \"dette kvartalet\"\n    },\n    \"day\" : {\n      \"previous\" : \"i går\",\n      \"current\" : \"i dag\",\n      \"next\" : \"i morgen\",\n      \"past\" : \"for {0} døgn siden\",\n      \"future\" : \"om {0} døgn\"\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"om {0} minutt\",\n        \"other\" : \"om {0} minutter\"\n      },\n      \"past\" : {\n        \"one\" : \"for {0} minutt siden\",\n        \"other\" : \"for {0} minutter siden\"\n      },\n      \"current\" : \"dette minuttet\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"for {0} min siden\",\n      \"future\" : \"om {0} min\",\n      \"current\" : \"dette minuttet\"\n    },\n    \"week\" : {\n      \"current\" : \"denne uken\",\n      \"past\" : \"for {0} u. siden\",\n      \"future\" : \"om {0} u.\",\n      \"next\" : \"neste uke\",\n      \"previous\" : \"forrige uke\"\n    },\n    \"year\" : {\n      \"current\" : \"i år\",\n      \"future\" : \"om {0} år\",\n      \"past\" : \"for {0} år siden\",\n      \"next\" : \"neste år\",\n      \"previous\" : \"i fjor\"\n    },\n    \"day\" : {\n      \"next\" : \"i morgen\",\n      \"current\" : \"i dag\",\n      \"previous\" : \"i går\",\n      \"past\" : \"for {0} d. siden\",\n      \"future\" : \"om {0} d.\"\n    },\n    \"hour\" : {\n      \"future\" : \"om {0} t\",\n      \"current\" : \"denne timen\",\n      \"past\" : \"for {0} t siden\"\n    },\n    \"quarter\" : {\n      \"current\" : \"dette kv.\",\n      \"future\" : \"om {0} kv.\",\n      \"previous\" : \"forrige kv.\",\n      \"next\" : \"neste kv.\",\n      \"past\" : \"for {0} kv. siden\"\n    },\n    \"second\" : {\n      \"past\" : \"for {0} sek siden\",\n      \"current\" : \"nå\",\n      \"future\" : \"om {0} sek\"\n    },\n    \"month\" : {\n      \"current\" : \"denne md.\",\n      \"past\" : \"for {0} md. siden\",\n      \"future\" : \"om {0} md.\",\n      \"next\" : \"neste md.\",\n      \"previous\" : \"forrige md.\"\n    },\n    \"now\" : \"nå\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ne.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"{0}सत्र अघि\",\n      \"future\" : \"{0}सत्रमा\",\n      \"current\" : \"यो सत्र\",\n      \"previous\" : \"अघिल्लो सत्र\",\n      \"next\" : \"अर्को सत्र\"\n    },\n    \"year\" : {\n      \"previous\" : \"गत वर्ष\",\n      \"next\" : \"आगामी वर्ष\",\n      \"future\" : \"{0} वर्षमा\",\n      \"current\" : \"यो वर्ष\",\n      \"past\" : \"{0} वर्ष अघि\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} हप्तामा\",\n      \"previous\" : \"गत हप्ता\",\n      \"next\" : \"आउने हप्ता\",\n      \"past\" : \"{0} हप्ता पहिले\",\n      \"current\" : \"यो हप्ता\"\n    },\n    \"day\" : {\n      \"current\" : \"आज\",\n      \"past\" : \"{0} दिन पहिले\",\n      \"next\" : \"भोलि\",\n      \"future\" : \"{0} दिनमा\",\n      \"previous\" : \"हिजो\"\n    },\n    \"hour\" : {\n      \"current\" : \"यस घडीमा\",\n      \"past\" : \"{0} घण्टा पहिले\",\n      \"future\" : \"{0} घण्टामा\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} मिनेटमा\",\n      \"current\" : \"यही मिनेटमा\",\n      \"past\" : \"{0} मिनेट पहिले\"\n    },\n    \"month\" : {\n      \"next\" : \"अर्को महिना\",\n      \"current\" : \"यो महिना\",\n      \"past\" : \"{0} महिना पहिले\",\n      \"future\" : \"{0} महिनामा\",\n      \"previous\" : \"गत महिना\"\n    },\n    \"now\" : \"अहिले\",\n    \"second\" : {\n      \"future\" : \"{0} सेकेन्डमा\",\n      \"current\" : \"अहिले\",\n      \"past\" : \"{0} सेकेन्ड पहिले\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} मिनेट पहिले\",\n      \"future\" : \"{0} मिनेटमा\",\n      \"current\" : \"यही मिनेटमा\"\n    },\n    \"week\" : {\n      \"current\" : \"यो हप्ता\",\n      \"past\" : \"{0} हप्ता पहिले\",\n      \"future\" : \"{0} हप्तामा\",\n      \"next\" : \"आउने हप्ता\",\n      \"previous\" : \"गत हप्ता\"\n    },\n    \"year\" : {\n      \"current\" : \"यो वर्ष\",\n      \"future\" : \"{0} वर्षमा\",\n      \"past\" : \"{0} वर्ष अघि\",\n      \"next\" : \"आगामी वर्ष\",\n      \"previous\" : \"गत वर्ष\"\n    },\n    \"day\" : {\n      \"next\" : \"भोलि\",\n      \"current\" : \"आज\",\n      \"previous\" : \"हिजो\",\n      \"past\" : \"{0} दिन पहिले\",\n      \"future\" : \"{0} दिनमा\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} घण्टामा\",\n      \"current\" : \"यस घडीमा\",\n      \"past\" : \"{0} घण्टा पहिले\"\n    },\n    \"quarter\" : {\n      \"current\" : \"यो सत्र\",\n      \"future\" : \"{0}सत्रमा\",\n      \"previous\" : \"अघिल्लो सत्र\",\n      \"next\" : \"अर्को सत्र\",\n      \"past\" : \"{0}सत्र अघि\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} सेकेन्ड पहिले\",\n      \"current\" : \"अहिले\",\n      \"future\" : \"{0} सेकेन्डमा\"\n    },\n    \"month\" : {\n      \"current\" : \"यो महिना\",\n      \"past\" : \"{0} महिना पहिले\",\n      \"future\" : \"{0} महिनामा\",\n      \"next\" : \"अर्को महिना\",\n      \"previous\" : \"गत महिना\"\n    },\n    \"now\" : \"अहिले\"\n  },\n  \"long\" : {\n    \"week\" : {\n      \"current\" : \"यो हप्ता\",\n      \"past\" : \"{0} हप्ता पहिले\",\n      \"next\" : \"आउने हप्ता\",\n      \"previous\" : \"गत हप्ता\",\n      \"future\" : \"{0} हप्तामा\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} सेकेन्डमा\",\n      \"past\" : \"{0} सेकेन्ड पहिले\",\n      \"current\" : \"अहिले\"\n    },\n    \"quarter\" : {\n      \"future\" : {\n        \"other\" : \"{0}सत्रमा\",\n        \"one\" : \"+{0} सत्रमा\"\n      },\n      \"previous\" : \"अघिल्लो सत्र\",\n      \"past\" : \"{0}सत्र अघि\",\n      \"next\" : \"अर्को सत्र\",\n      \"current\" : \"यो सत्र\"\n    },\n    \"now\" : \"अहिले\",\n    \"day\" : {\n      \"future\" : \"{0} दिनमा\",\n      \"previous\" : \"हिजो\",\n      \"past\" : \"{0} दिन पहिले\",\n      \"next\" : \"भोलि\",\n      \"current\" : \"आज\"\n    },\n    \"year\" : {\n      \"current\" : \"यो वर्ष\",\n      \"next\" : \"आगामी वर्ष\",\n      \"previous\" : \"गत वर्ष\",\n      \"future\" : \"{0} वर्षमा\",\n      \"past\" : \"{0} वर्ष अघि\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} घण्टामा\",\n      \"past\" : \"{0} घण्टा पहिले\",\n      \"current\" : \"यस घडीमा\"\n    },\n    \"month\" : {\n      \"next\" : \"अर्को महिना\",\n      \"current\" : \"यो महिना\",\n      \"future\" : \"{0} महिनामा\",\n      \"previous\" : \"गत महिना\",\n      \"past\" : \"{0} महिना पहिले\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} मिनेट पहिले\",\n      \"current\" : \"यही मिनेटमा\",\n      \"future\" : \"{0} मिनेटमा\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/nl.json",
    "content": "{\n  \"narrow\" : {\n    \"minute\" : {\n      \"future\" : \"over {0} min.\",\n      \"current\" : \"binnen een minuut\",\n      \"past\" : \"{0} min. geleden\"\n    },\n    \"week\" : {\n      \"current\" : \"deze week\",\n      \"previous\" : \"vorige week\",\n      \"past\" : {\n        \"one\" : \"{0} week geleden\",\n        \"other\" : \"{0} weken geleden\"\n      },\n      \"future\" : {\n        \"other\" : \"over {0} weken\",\n        \"one\" : \"over {0} week\"\n      },\n      \"next\" : \"volgende week\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"vorig kwartaal\",\n      \"current\" : \"dit kwartaal\",\n      \"past\" : {\n        \"other\" : \"{0} kwartalen geleden\",\n        \"one\" : \"{0} kwartaal geleden\"\n      },\n      \"next\" : \"volgend kwartaal\",\n      \"future\" : {\n        \"one\" : \"over {0} kw.\",\n        \"other\" : \"over {0} kwartalen\"\n      }\n    },\n    \"year\" : {\n      \"future\" : \"over {0} jaar\",\n      \"previous\" : \"vorig jaar\",\n      \"current\" : \"dit jaar\",\n      \"next\" : \"volgend jaar\",\n      \"past\" : \"{0} jaar geleden\"\n    },\n    \"hour\" : {\n      \"current\" : \"binnen een uur\",\n      \"future\" : \"over {0} uur\",\n      \"past\" : \"{0} uur geleden\"\n    },\n    \"day\" : {\n      \"previous\" : \"gisteren\",\n      \"current\" : \"vandaag\",\n      \"past\" : {\n        \"one\" : \"{0} dag geleden\",\n        \"other\" : \"{0} dgn geleden\"\n      },\n      \"future\" : {\n        \"other\" : \"over {0} dgn\",\n        \"one\" : \"over {0} dag\"\n      },\n      \"next\" : \"morgen\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} sec. geleden\",\n      \"current\" : \"nu\",\n      \"future\" : \"over {0} sec.\"\n    },\n    \"now\" : \"nu\",\n    \"month\" : {\n      \"previous\" : \"vorige maand\",\n      \"current\" : \"deze maand\",\n      \"past\" : {\n        \"one\" : \"{0} maand geleden\",\n        \"other\" : \"{0} maanden geleden\"\n      },\n      \"future\" : {\n        \"one\" : \"over {0} maand\",\n        \"other\" : \"over {0} maanden\"\n      },\n      \"next\" : \"volgende maand\"\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"past\" : \"{0} jaar geleden\",\n      \"future\" : \"over {0} jaar\",\n      \"previous\" : \"vorig jaar\",\n      \"next\" : \"volgend jaar\",\n      \"current\" : \"dit jaar\"\n    },\n    \"quarter\" : {\n      \"future\" : {\n        \"one\" : \"over {0} kwartaal\",\n        \"other\" : \"over {0} kwartalen\"\n      },\n      \"current\" : \"dit kwartaal\",\n      \"next\" : \"volgend kwartaal\",\n      \"past\" : {\n        \"one\" : \"{0} kwartaal geleden\",\n        \"other\" : \"{0} kwartalen geleden\"\n      },\n      \"previous\" : \"vorig kwartaal\"\n    },\n    \"hour\" : {\n      \"future\" : \"over {0} uur\",\n      \"current\" : \"binnen een uur\",\n      \"past\" : \"{0} uur geleden\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"one\" : \"{0} maand geleden\",\n        \"other\" : \"{0} maanden geleden\"\n      },\n      \"previous\" : \"vorige maand\",\n      \"current\" : \"deze maand\",\n      \"future\" : {\n        \"other\" : \"over {0} maanden\",\n        \"one\" : \"over {0} maand\"\n      },\n      \"next\" : \"volgende maand\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"one\" : \"{0} week geleden\",\n        \"other\" : \"{0} weken geleden\"\n      },\n      \"previous\" : \"vorige week\",\n      \"next\" : \"volgende week\",\n      \"current\" : \"deze week\",\n      \"future\" : {\n        \"other\" : \"over {0} weken\",\n        \"one\" : \"over {0} week\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"gisteren\",\n      \"current\" : \"vandaag\",\n      \"future\" : {\n        \"one\" : \"over {0} dag\",\n        \"other\" : \"over {0} dagen\"\n      },\n      \"next\" : \"morgen\",\n      \"past\" : {\n        \"other\" : \"{0} dagen geleden\",\n        \"one\" : \"{0} dag geleden\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"other\" : \"over {0} minuten\",\n        \"one\" : \"over {0} minuut\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} minuut geleden\",\n        \"other\" : \"{0} minuten geleden\"\n      },\n      \"current\" : \"binnen een minuut\"\n    },\n    \"now\" : \"nu\",\n    \"second\" : {\n      \"current\" : \"nu\",\n      \"future\" : {\n        \"other\" : \"over {0} seconden\",\n        \"one\" : \"over {0} seconde\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} seconde geleden\",\n        \"other\" : \"{0} seconden geleden\"\n      }\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"past\" : \"{0} uur geleden\",\n      \"current\" : \"binnen een uur\",\n      \"future\" : \"over {0} uur\"\n    },\n    \"quarter\" : {\n      \"current\" : \"dit kwartaal\",\n      \"future\" : {\n        \"one\" : \"over {0} kwartaal\",\n        \"other\" : \"over {0} kwartalen\"\n      },\n      \"previous\" : \"vorig kwartaal\",\n      \"next\" : \"volgend kwartaal\",\n      \"past\" : {\n        \"other\" : \"{0} kwartalen geleden\",\n        \"one\" : \"{0} kwartaal geleden\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"volgende week\",\n      \"current\" : \"deze week\",\n      \"previous\" : \"vorige week\",\n      \"past\" : {\n        \"one\" : \"{0} week geleden\",\n        \"other\" : \"{0} weken geleden\"\n      },\n      \"future\" : {\n        \"one\" : \"over {0} week\",\n        \"other\" : \"over {0} weken\"\n      }\n    },\n    \"year\" : {\n      \"future\" : \"over {0} jaar\",\n      \"previous\" : \"vorig jaar\",\n      \"next\" : \"volgend jaar\",\n      \"current\" : \"dit jaar\",\n      \"past\" : \"{0} jaar geleden\"\n    },\n    \"minute\" : {\n      \"future\" : \"over {0} min.\",\n      \"past\" : \"{0} min. geleden\",\n      \"current\" : \"binnen een minuut\"\n    },\n    \"now\" : \"nu\",\n    \"month\" : {\n      \"current\" : \"deze maand\",\n      \"past\" : {\n        \"one\" : \"{0} maand geleden\",\n        \"other\" : \"{0} maanden geleden\"\n      },\n      \"future\" : {\n        \"one\" : \"over {0} maand\",\n        \"other\" : \"over {0} maanden\"\n      },\n      \"next\" : \"volgende maand\",\n      \"previous\" : \"vorige maand\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"one\" : \"over {0} dag\",\n        \"other\" : \"over {0} dgn\"\n      },\n      \"current\" : \"vandaag\",\n      \"next\" : \"morgen\",\n      \"previous\" : \"gisteren\",\n      \"past\" : {\n        \"other\" : \"{0} dgn geleden\",\n        \"one\" : \"{0} dag geleden\"\n      }\n    },\n    \"second\" : {\n      \"past\" : \"{0} sec. geleden\",\n      \"current\" : \"nu\",\n      \"future\" : \"over {0} sec.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/nn.json",
    "content": "{\n  \"narrow\" : {\n    \"hour\" : {\n      \"future\" : \"+{0} t\",\n      \"current\" : \"denne timen\",\n      \"past\" : \"–{0} t\"\n    },\n    \"quarter\" : {\n      \"current\" : \"dette kvartalet\",\n      \"previous\" : \"førre kvartal\",\n      \"future\" : \"+{0} kv.\",\n      \"past\" : \"–{0} kv.\",\n      \"next\" : \"neste kvartal\"\n    },\n    \"year\" : {\n      \"future\" : \"om {0} år\",\n      \"previous\" : \"i fjor\",\n      \"next\" : \"neste år\",\n      \"current\" : \"i år\",\n      \"past\" : \"for {0} år sidan\"\n    },\n    \"day\" : {\n      \"previous\" : \"i går\",\n      \"future\" : \"+{0} d.\",\n      \"next\" : \"i morgon\",\n      \"current\" : \"i dag\",\n      \"past\" : \"–{0} d.\"\n    },\n    \"month\" : {\n      \"current\" : \"denne månaden\",\n      \"future\" : \"+{0} md.\",\n      \"past\" : \"–{0} md.\",\n      \"next\" : \"neste månad\",\n      \"previous\" : \"førre månad\"\n    },\n    \"now\" : \"no\",\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"–{0} s\",\n        \"other\" : \"–{0} s\"\n      },\n      \"future\" : \"+{0} s\",\n      \"current\" : \"no\"\n    },\n    \"minute\" : {\n      \"current\" : \"dette minuttet\",\n      \"past\" : \"–{0} min\",\n      \"future\" : \"+{0} min\"\n    },\n    \"week\" : {\n      \"past\" : \"–{0} v.\",\n      \"previous\" : \"førre veke\",\n      \"future\" : \"+{0} v.\",\n      \"current\" : \"denne veka\",\n      \"next\" : \"neste veke\"\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"om {0} veker\",\n        \"one\" : \"om {0} veke\"\n      },\n      \"past\" : {\n        \"one\" : \"for {0} veke sidan\",\n        \"other\" : \"for {0} veker sidan\"\n      },\n      \"next\" : \"neste veke\",\n      \"previous\" : \"førre veke\",\n      \"current\" : \"denne veka\"\n    },\n    \"day\" : {\n      \"future\" : \"om {0} døgn\",\n      \"previous\" : \"i går\",\n      \"current\" : \"i dag\",\n      \"next\" : \"i morgon\",\n      \"past\" : \"for {0} døgn sidan\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"for {0} time sidan\",\n        \"other\" : \"for {0} timar sidan\"\n      },\n      \"current\" : \"denne timen\",\n      \"future\" : {\n        \"one\" : \"om {0} time\",\n        \"other\" : \"om {0} timar\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : \"om {0} minutt\",\n      \"current\" : \"dette minuttet\",\n      \"past\" : \"for {0} minutt sidan\"\n    },\n    \"now\" : \"no\",\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"for {0} månadar sidan\",\n        \"one\" : \"for {0} månad sidan\"\n      },\n      \"current\" : \"denne månaden\",\n      \"next\" : \"neste månad\",\n      \"previous\" : \"førre månad\",\n      \"future\" : {\n        \"one\" : \"om {0} månad\",\n        \"other\" : \"om {0} månadar\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"neste kvartal\",\n      \"past\" : \"for {0} kvartal sidan\",\n      \"future\" : \"om {0} kvartal\",\n      \"previous\" : \"førre kvartal\",\n      \"current\" : \"dette kvartalet\"\n    },\n    \"second\" : {\n      \"current\" : \"no\",\n      \"past\" : \"for {0} sekund sidan\",\n      \"future\" : {\n        \"one\" : \"om {0} sekund\",\n        \"other\" : \"om {0} sekund\"\n      }\n    },\n    \"year\" : {\n      \"future\" : \"om {0} år\",\n      \"previous\" : \"i fjor\",\n      \"next\" : \"neste år\",\n      \"past\" : \"for {0} år sidan\",\n      \"current\" : \"i år\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"no\",\n      \"past\" : \"for {0} sek sidan\",\n      \"future\" : \"om {0} sek\"\n    },\n    \"now\" : \"no\",\n    \"month\" : {\n      \"future\" : \"om {0} md.\",\n      \"current\" : \"denne månaden\",\n      \"past\" : \"for {0} md. sidan\",\n      \"previous\" : \"førre månad\",\n      \"next\" : \"neste månad\"\n    },\n    \"day\" : {\n      \"previous\" : \"i går\",\n      \"current\" : \"i dag\",\n      \"next\" : \"i morgon\",\n      \"future\" : \"om {0} d.\",\n      \"past\" : \"for {0} d. sidan\"\n    },\n    \"minute\" : {\n      \"past\" : \"for {0} min sidan\",\n      \"future\" : \"om {0} min\",\n      \"current\" : \"dette minuttet\"\n    },\n    \"quarter\" : {\n      \"past\" : \"for {0} kv. sidan\",\n      \"previous\" : \"førre kvartal\",\n      \"current\" : \"dette kvartalet\",\n      \"future\" : \"om {0} kv.\",\n      \"next\" : \"neste kvartal\"\n    },\n    \"hour\" : {\n      \"future\" : \"om {0} t\",\n      \"current\" : \"denne timen\",\n      \"past\" : \"for {0} t sidan\"\n    },\n    \"week\" : {\n      \"future\" : \"om {0} v.\",\n      \"previous\" : \"førre veke\",\n      \"next\" : \"neste veke\",\n      \"past\" : \"for {0} v. sidan\",\n      \"current\" : \"denne veka\"\n    },\n    \"year\" : {\n      \"next\" : \"neste år\",\n      \"current\" : \"i år\",\n      \"past\" : \"for {0} år sidan\",\n      \"future\" : \"om {0} år\",\n      \"previous\" : \"i fjor\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/or.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"ଆସନ୍ତାକାଲି\",\n      \"future\" : \"{0} ଦିନରେ\",\n      \"previous\" : \"ଗତକାଲି\",\n      \"current\" : \"ଆଜି\",\n      \"past\" : \"{0} ଦିନ ପୂର୍ବେ\"\n    },\n    \"quarter\" : {\n      \"next\" : \"ଆଗାମୀ ତ୍ରୟମାସ\",\n      \"past\" : \"{0} ତ୍ରୟ. ପୂର୍ବେ\",\n      \"future\" : \"{0} ତ୍ରୟ. ରେ\",\n      \"previous\" : \"ଗତ ତ୍ରୟମାସ\",\n      \"current\" : \"ଗତ ତ୍ରୟମାସ\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ଘ. ପୂର୍ବେ\",\n      \"future\" : \"{0} ଘ. ରେ\",\n      \"current\" : \"ଏହି ଘଣ୍ଟା\"\n    },\n    \"year\" : {\n      \"next\" : \"ଆଗାମୀ ବର୍ଷ\",\n      \"past\" : \"{0} ବ. ପୂର୍ବେ\",\n      \"current\" : \"ଏହି ବର୍ଷ\",\n      \"previous\" : \"ଗତ ବର୍ଷ\",\n      \"future\" : \"{0} ବ. ରେ\"\n    },\n    \"now\" : \"ବର୍ତ୍ତମାନ\",\n    \"month\" : {\n      \"current\" : \"ଏହି ମାସ\",\n      \"future\" : \"{0} ମା. ରେ\",\n      \"past\" : \"{0} ମା. ପୂର୍ବେ\",\n      \"next\" : \"ଆଗାମୀ ମାସ\",\n      \"previous\" : \"ଗତ ମାସ\"\n    },\n    \"week\" : {\n      \"previous\" : \"ଗତ ସପ୍ତାହ\",\n      \"current\" : \"ଏହି ସପ୍ତାହ\",\n      \"past\" : \"{0} ସପ୍ତା. ପୂର୍ବେ\",\n      \"future\" : \"{0} ସପ୍ତା. ରେ\",\n      \"next\" : \"ଆଗାମୀ ସପ୍ତାହ\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} ମି. ରେ\",\n      \"current\" : \"ଏହି ମିନିଟ୍\",\n      \"past\" : \"{0} ମି. ପୂର୍ବେ\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} ସେ. ପୂର୍ବେ\",\n      \"future\" : \"{0} ସେ. ରେ\",\n      \"current\" : \"ବର୍ତ୍ତମାନ\"\n    }\n  },\n  \"long\" : {\n    \"now\" : \"ବର୍ତ୍ତମାନ\",\n    \"hour\" : {\n      \"current\" : \"ଏହି ଘଣ୍ଟା\",\n      \"past\" : \"{0} ଘଣ୍ଟା ପୂର୍ବେ\",\n      \"future\" : \"{0} ଘଣ୍ଟାରେ\"\n    },\n    \"quarter\" : {\n      \"past\" : \"{0} ତ୍ରୟମାସ ପୂର୍ବେ\",\n      \"current\" : \"ଗତ ତ୍ରୟମାସ\",\n      \"previous\" : \"ଗତ ତ୍ରୟମାସ\",\n      \"future\" : \"{0} ତ୍ରୟମାସରେ\",\n      \"next\" : \"ଆଗାମୀ ତ୍ରୟମାସ\"\n    },\n    \"second\" : {\n      \"current\" : \"ବର୍ତ୍ତମାନ\",\n      \"past\" : \"{0} ସେକେଣ୍ଡ ପୂର୍ବେ\",\n      \"future\" : \"{0} ସେକେଣ୍ଡରେ\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ମାସରେ\",\n      \"next\" : \"ଆଗାମୀ ମାସ\",\n      \"previous\" : \"ଗତ ମାସ\",\n      \"current\" : \"ଏହି ମାସ\",\n      \"past\" : \"{0} ମାସ ପୂର୍ବେ\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} ମିନିଟ୍‌‌ରେ\",\n      \"current\" : \"ଏହି ମିନିଟ୍\",\n      \"past\" : \"{0} ମିନିଟ୍ ପୂର୍ବେ\"\n    },\n    \"day\" : {\n      \"next\" : \"ଆସନ୍ତାକାଲି\",\n      \"current\" : \"ଆଜି\",\n      \"future\" : \"{0} ଦିନରେ\",\n      \"previous\" : \"ଗତକାଲି\",\n      \"past\" : \"{0} ଦିନ ପୂର୍ବେ\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} ସପ୍ତାହରେ\",\n      \"current\" : \"ଏହି ସପ୍ତାହ\",\n      \"next\" : \"ଆଗାମୀ ସପ୍ତାହ\",\n      \"past\" : {\n        \"other\" : \"{0} ସପ୍ତାହ ପୂର୍ବେ\",\n        \"one\" : \"{0} ସପ୍ତାହରେ\"\n      },\n      \"previous\" : \"ଗତ ସପ୍ତାହ\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} ବର୍ଷ ପୂର୍ବେ\",\n      \"future\" : \"{0} ବର୍ଷରେ\",\n      \"previous\" : \"ଗତ ବର୍ଷ\",\n      \"next\" : \"ଆଗାମୀ ବର୍ଷ\",\n      \"current\" : \"ଏହି ବର୍ଷ\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} ତ୍ରୟ. ରେ\",\n      \"next\" : \"ଆଗାମୀ ତ୍ରୟମାସ\",\n      \"previous\" : \"ଗତ ତ୍ରୟମାସ\",\n      \"current\" : \"ଗତ ତ୍ରୟମାସ\",\n      \"past\" : \"{0} ତ୍ରୟ. ପୂର୍ବେ\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} ମି. ରେ\",\n      \"current\" : \"ଏହି ମିନିଟ୍\",\n      \"past\" : \"{0} ମି. ପୂର୍ବେ\"\n    },\n    \"year\" : {\n      \"next\" : \"ଆଗାମୀ ବର୍ଷ\",\n      \"future\" : \"{0} ବ. ରେ\",\n      \"current\" : \"ଏହି ବର୍ଷ\",\n      \"past\" : \"{0} ବ. ପୂର୍ବେ\",\n      \"previous\" : \"ଗତ ବର୍ଷ\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} ସେ. ରେ\",\n      \"current\" : \"ବର୍ତ୍ତମାନ\",\n      \"past\" : \"{0} ସେ. ପୂର୍ବେ\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ଘ. ପୂର୍ବେ\",\n      \"current\" : \"ଏହି ଘଣ୍ଟା\",\n      \"future\" : \"{0} ଘ. ରେ\"\n    },\n    \"now\" : \"ବର୍ତ୍ତମାନ\",\n    \"month\" : {\n      \"previous\" : \"ଗତ ମାସ\",\n      \"next\" : \"ଆଗାମୀ ମାସ\",\n      \"past\" : \"{0} ମା. ପୂର୍ବେ\",\n      \"current\" : \"ଏହି ମାସ\",\n      \"future\" : \"{0} ମା. ରେ\"\n    },\n    \"week\" : {\n      \"previous\" : \"ଗତ ସପ୍ତାହ\",\n      \"current\" : \"ଏହି ସପ୍ତାହ\",\n      \"next\" : \"ଆଗାମୀ ସପ୍ତାହ\",\n      \"past\" : \"{0} ସପ୍ତା. ପୂର୍ବେ\",\n      \"future\" : \"{0} ସପ୍ତା. ରେ\"\n    },\n    \"day\" : {\n      \"next\" : \"ଆସନ୍ତାକାଲି\",\n      \"past\" : \"{0} ଦିନ ପୂର୍ବେ\",\n      \"future\" : \"{0} ଦିନରେ\",\n      \"previous\" : \"ଗତକାଲି\",\n      \"current\" : \"ଆଜି\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/pa.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"{0} ਤਿਮਾਹੀਆਂ ਪਹਿਲਾਂ\",\n      \"current\" : \"ਇਹ ਤਿਮਾਹੀ\",\n      \"next\" : \"ਅਗਲੀ ਤਿਮਾਹੀ\",\n      \"future\" : \"{0} ਤਿਮਾਹੀਆਂ ਵਿੱਚ\",\n      \"previous\" : \"ਪਿਛਲੀ ਤਿਮਾਹੀ\"\n    },\n    \"week\" : {\n      \"next\" : \"ਅਗਲਾ ਹਫ਼ਤਾ\",\n      \"future\" : {\n        \"other\" : \"{0} ਹਫ਼ਤਿਆਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਹਫ਼ਤੇ ਵਿੱਚ\"\n      },\n      \"previous\" : \"ਪਿਛਲਾ ਹਫ਼ਤਾ\",\n      \"current\" : \"ਇਹ ਹਫ਼ਤਾ\",\n      \"past\" : {\n        \"one\" : \"{0} ਹਫ਼ਤਾ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਹਫ਼ਤੇ ਪਹਿਲਾਂ\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"ਇਸ ਘੰਟੇ\",\n      \"past\" : {\n        \"one\" : \"{0} ਘੰਟਾ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਘੰਟੇ ਪਹਿਲਾਂ\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ਘੰਟਿਆਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਘੰਟੇ ਵਿੱਚ\"\n      }\n    },\n    \"now\" : \"ਹੁਣ\",\n    \"day\" : {\n      \"past\" : \"{0} ਦਿਨ ਪਹਿਲਾਂ\",\n      \"future\" : {\n        \"one\" : \"{0} ਦਿਨ ਵਿੱਚ\",\n        \"other\" : \"{0} ਦਿਨਾਂ ਵਿੱਚ\"\n      },\n      \"previous\" : \"ਬੀਤਿਆ ਕੱਲ੍ਹ\",\n      \"current\" : \"ਅੱਜ\",\n      \"next\" : \"ਭਲਕੇ\"\n    },\n    \"minute\" : {\n      \"current\" : \"ਇਸ ਮਿੰਟ\",\n      \"past\" : \"{0} ਮਿੰਟ ਪਹਿਲਾਂ\",\n      \"future\" : {\n        \"one\" : \"{0} ਮਿੰਟ ਵਿੱਚ\",\n        \"other\" : \"{0} ਮਿੰਟਾਂ ਵਿੱਚ\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"ਇਹ ਮਹੀਨਾ\",\n      \"future\" : {\n        \"one\" : \"{0} ਮਹੀਨੇ ਵਿੱਚ\",\n        \"other\" : \"{0} ਮਹੀਨਿਆਂ ਵਿੱਚ\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} ਮਹੀਨੇ ਪਹਿਲਾਂ\",\n        \"one\" : \"{0} ਮਹੀਨਾ ਪਹਿਲਾਂ\"\n      },\n      \"next\" : \"ਅਗਲਾ ਮਹੀਨਾ\",\n      \"previous\" : \"ਪਿਛਲਾ ਮਹੀਨਾ\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} ਸਾਲ ਪਹਿਲਾਂ\",\n      \"future\" : {\n        \"one\" : \"{0} ਸਾਲ ਵਿੱਚ\",\n        \"other\" : \"{0} ਸਾਲਾਂ ਵਿੱਚ\"\n      },\n      \"next\" : \"ਅਗਲਾ ਸਾਲ\",\n      \"current\" : \"ਇਹ ਸਾਲ\",\n      \"previous\" : \"ਪਿਛਲਾ ਸਾਲ\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"other\" : \"{0} ਸਕਿੰਟਾਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਸਕਿੰਟ ਵਿੱਚ\"\n      },\n      \"current\" : \"ਹੁਣ\",\n      \"past\" : \"{0} ਸਕਿੰਟ ਪਹਿਲਾਂ\"\n    }\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"current\" : \"ਇਸ ਘੰਟੇ\",\n      \"past\" : {\n        \"one\" : \"{0} ਘੰਟਾ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਘੰਟੇ ਪਹਿਲਾਂ\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ਘੰਟਿਆਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਘੰਟੇ ਵਿੱਚ\"\n      }\n    },\n    \"now\" : \"ਹੁਣ\",\n    \"quarter\" : {\n      \"previous\" : \"ਪਿਛਲੀ ਤਿਮਾਹੀ\",\n      \"future\" : {\n        \"other\" : \"{0} ਤਿਮਾਹੀਆਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਤਿਮਾਹੀ ਵਿੱਚ\"\n      },\n      \"next\" : \"ਅਗਲੀ ਤਿਮਾਹੀ\",\n      \"past\" : {\n        \"one\" : \"{0} ਤਿਮਾਹੀ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਤਿਮਾਹੀਆਂ ਪਹਿਲਾਂ\"\n      },\n      \"current\" : \"ਇਸ ਤਿਮਾਹੀ\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"{0} ਦਿਨਾਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਦਿਨ ਵਿੱਚ\"\n      },\n      \"current\" : \"ਅੱਜ\",\n      \"past\" : \"{0} ਦਿਨ ਪਹਿਲਾਂ\",\n      \"previous\" : \"ਬੀਤਿਆ ਕੱਲ੍ਹ\",\n      \"next\" : \"ਭਲਕੇ\"\n    },\n    \"week\" : {\n      \"previous\" : \"ਪਿਛਲਾ ਹਫ਼ਤਾ\",\n      \"past\" : {\n        \"one\" : \"{0} ਹਫ਼ਤਾ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਹਫ਼ਤੇ ਪਹਿਲਾਂ\"\n      },\n      \"current\" : \"ਇਹ ਹਫ਼ਤਾ\",\n      \"next\" : \"ਅਗਲਾ ਹਫ਼ਤਾ\",\n      \"future\" : {\n        \"one\" : \"{0} ਹਫ਼ਤੇ ਵਿੱਚ\",\n        \"other\" : \"{0} ਹਫ਼ਤਿਆਂ ਵਿੱਚ\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : \"{0} ਮਿੰਟ ਪਹਿਲਾਂ\",\n      \"current\" : \"ਇਸ ਮਿੰਟ\",\n      \"future\" : {\n        \"other\" : \"{0} ਮਿੰਟਾਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਮਿੰਟ ਵਿੱਚ\"\n      }\n    },\n    \"second\" : {\n      \"past\" : \"{0} ਸਕਿੰਟ ਪਹਿਲਾਂ\",\n      \"future\" : {\n        \"other\" : \"{0} ਸਕਿੰਟਾਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਸਕਿੰਟ ਵਿੱਚ\"\n      },\n      \"current\" : \"ਹੁਣ\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"{0} ਮਹੀਨੇ ਪਹਿਲਾਂ\",\n        \"one\" : \"{0} ਮਹੀਨਾ ਪਹਿਲਾਂ\"\n      },\n      \"next\" : \"ਅਗਲਾ ਮਹੀਨਾ\",\n      \"future\" : {\n        \"one\" : \"{0} ਮਹੀਨੇ ਵਿੱਚ\",\n        \"other\" : \"{0} ਮਹੀਨਿਆਂ ਵਿੱਚ\"\n      },\n      \"previous\" : \"ਪਿਛਲਾ ਮਹੀਨਾ\",\n      \"current\" : \"ਇਹ ਮਹੀਨਾ\"\n    },\n    \"year\" : {\n      \"current\" : \"ਇਹ ਸਾਲ\",\n      \"future\" : {\n        \"other\" : \"{0} ਸਾਲਾਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਸਾਲ ਵਿੱਚ\"\n      },\n      \"previous\" : \"ਪਿਛਲਾ ਸਾਲ\",\n      \"next\" : \"ਅਗਲਾ ਸਾਲ\",\n      \"past\" : \"{0} ਸਾਲ ਪਹਿਲਾਂ\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"next\" : \"ਅਗਲਾ ਮਹੀਨਾ\",\n      \"current\" : \"ਇਹ ਮਹੀਨਾ\",\n      \"previous\" : \"ਪਿਛਲਾ ਮਹੀਨਾ\",\n      \"past\" : {\n        \"one\" : \"{0} ਮਹੀਨਾ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਮਹੀਨੇ ਪਹਿਲਾਂ\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ਮਹੀਨਿਆਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਮਹੀਨੇ ਵਿੱਚ\"\n      }\n    },\n    \"now\" : \"ਹੁਣ\",\n    \"week\" : {\n      \"previous\" : \"ਪਿਛਲਾ ਹਫ਼ਤਾ\",\n      \"current\" : \"ਇਹ ਹਫ਼ਤਾ\",\n      \"past\" : {\n        \"one\" : \"{0} ਹਫ਼ਤਾ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਹਫ਼ਤੇ ਪਹਿਲਾਂ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ਹਫ਼ਤੇ ਵਿੱਚ\",\n        \"other\" : \"{0} ਹਫ਼ਤਿਆਂ ਵਿੱਚ\"\n      },\n      \"next\" : \"ਅਗਲਾ ਹਫ਼ਤਾ\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"{0} ਦਿਨਾਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਦਿਨ ਵਿੱਚ\"\n      },\n      \"previous\" : \"ਬੀਤਿਆ ਕੱਲ੍ਹ\",\n      \"current\" : \"ਅੱਜ\",\n      \"next\" : \"ਭਲਕੇ\",\n      \"past\" : \"{0} ਦਿਨ ਪਹਿਲਾਂ\"\n    },\n    \"year\" : {\n      \"previous\" : \"ਪਿਛਲਾ ਸਾਲ\",\n      \"current\" : \"ਇਹ ਸਾਲ\",\n      \"next\" : \"ਅਗਲਾ ਸਾਲ\",\n      \"past\" : \"{0} ਸਾਲ ਪਹਿਲਾਂ\",\n      \"future\" : {\n        \"other\" : \"{0} ਸਾਲਾਂ ਵਿੱਚ\",\n        \"one\" : \"{0} ਸਾਲ ਵਿੱਚ\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} ਘੰਟੇ ਪਹਿਲਾਂ\",\n        \"one\" : \"{0} ਘੰਟਾ ਪਹਿਲਾਂ\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ਘੰਟੇ ਵਿੱਚ\",\n        \"other\" : \"{0} ਘੰਟਿਆਂ ਵਿੱਚ\"\n      },\n      \"current\" : \"ਇਸ ਘੰਟੇ\"\n    },\n    \"minute\" : {\n      \"current\" : \"ਇਸ ਮਿੰਟ\",\n      \"past\" : \"{0} ਮਿੰਟ ਪਹਿਲਾਂ\",\n      \"future\" : {\n        \"one\" : \"{0} ਮਿੰਟ ਵਿੱਚ\",\n        \"other\" : \"{0} ਮਿੰਟਾਂ ਵਿੱਚ\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"{0} ਸਕਿੰਟ ਵਿੱਚ\",\n        \"other\" : \"{0} ਸਕਿੰਟਾਂ ਵਿੱਚ\"\n      },\n      \"past\" : \"{0} ਸਕਿੰਟ ਪਹਿਲਾਂ\",\n      \"current\" : \"ਹੁਣ\"\n    },\n    \"quarter\" : {\n      \"next\" : \"ਅਗਲੀ ਤਿਮਾਹੀ\",\n      \"past\" : {\n        \"one\" : \"{0} ਤਿਮਾਹੀ ਪਹਿਲਾਂ\",\n        \"other\" : \"{0} ਤਿਮਾਹੀਆਂ ਪਹਿਲਾਂ\"\n      },\n      \"current\" : \"ਇਹ ਤਿਮਾਹੀ\",\n      \"previous\" : \"ਪਿਛਲੀ ਤਿਮਾਹੀ\",\n      \"future\" : {\n        \"one\" : \"{0} ਤਿਮਾਹੀ ਵਿੱਚ\",\n        \"other\" : \"{0} ਤਿਮਾਹੀਆਂ ਵਿੱਚ\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/pl.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"previous\" : \"wczoraj\",\n      \"current\" : \"dzisiaj\",\n      \"next\" : \"jutro\",\n      \"past\" : {\n        \"many\" : \"{0} dni temu\",\n        \"few\" : \"{0} dni temu\",\n        \"one\" : \"{0} dzień temu\",\n        \"other\" : \"{0} dnia temu\"\n      },\n      \"future\" : {\n        \"few\" : \"za {0} dni\",\n        \"many\" : \"za {0} dni\",\n        \"other\" : \"za {0} dnia\",\n        \"one\" : \"za {0} dzień\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : \"za {0} g.\",\n      \"past\" : \"{0} g. temu\",\n      \"current\" : \"ta godzina\"\n    },\n    \"now\" : \"teraz\",\n    \"week\" : {\n      \"current\" : \"w tym tygodniu\",\n      \"previous\" : \"w zeszłym tygodniu\",\n      \"past\" : {\n        \"one\" : \"{0} tydz. temu\",\n        \"other\" : \"{0} tyg. temu\"\n      },\n      \"future\" : {\n        \"other\" : \"za {0} tyg.\",\n        \"one\" : \"za {0} tydz.\"\n      },\n      \"next\" : \"w przyszłym tygodniu\"\n    },\n    \"month\" : {\n      \"next\" : \"w przyszłym miesiącu\",\n      \"previous\" : \"w zeszłym miesiącu\",\n      \"current\" : \"w tym miesiącu\",\n      \"future\" : \"za {0} mies.\",\n      \"past\" : \"{0} mies. temu\"\n    },\n    \"year\" : {\n      \"previous\" : \"w zeszłym roku\",\n      \"future\" : {\n        \"few\" : \"za {0} lata\",\n        \"one\" : \"za {0} rok\",\n        \"many\" : \"za {0} lat\",\n        \"other\" : \"za {0} roku\"\n      },\n      \"next\" : \"w przyszłym roku\",\n      \"current\" : \"w tym roku\",\n      \"past\" : {\n        \"one\" : \"{0} rok temu\",\n        \"other\" : \"{0} roku temu\",\n        \"few\" : \"{0} lata temu\",\n        \"many\" : \"{0} lat temu\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"w tym kwartale\",\n      \"future\" : \"za {0} kw.\",\n      \"previous\" : \"w zeszłym kwartale\",\n      \"next\" : \"w przyszłym kwartale\",\n      \"past\" : \"{0} kw. temu\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} min temu\",\n      \"current\" : \"ta minuta\",\n      \"future\" : \"za {0} min\"\n    },\n    \"second\" : {\n      \"future\" : \"za {0} s\",\n      \"past\" : \"{0} s temu\",\n      \"current\" : \"teraz\"\n    }\n  },\n  \"long\" : {\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"za {0} tygodnia\",\n        \"one\" : \"za {0} tydzień\",\n        \"few\" : \"za {0} tygodnie\",\n        \"many\" : \"za {0} tygodni\"\n      },\n      \"current\" : \"w tym tygodniu\",\n      \"past\" : {\n        \"few\" : \"{0} tygodnie temu\",\n        \"one\" : \"{0} tydzień temu\",\n        \"other\" : \"{0} tygodnia temu\",\n        \"many\" : \"{0} tygodni temu\"\n      },\n      \"previous\" : \"w zeszłym tygodniu\",\n      \"next\" : \"w przyszłym tygodniu\"\n    },\n    \"quarter\" : {\n      \"current\" : \"w tym kwartale\",\n      \"next\" : \"w przyszłym kwartale\",\n      \"future\" : {\n        \"other\" : \"za {0} kwartału\",\n        \"many\" : \"za {0} kwartałów\",\n        \"few\" : \"za {0} kwartały\",\n        \"one\" : \"za {0} kwartał\"\n      },\n      \"previous\" : \"w zeszłym kwartale\",\n      \"past\" : {\n        \"one\" : \"{0} kwartał temu\",\n        \"many\" : \"{0} kwartałów temu\",\n        \"few\" : \"{0} kwartały temu\",\n        \"other\" : \"{0} kwartału temu\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"za {0} sekundę\",\n        \"many\" : \"za {0} sekund\",\n        \"other\" : \"za {0} sekundy\"\n      },\n      \"current\" : \"teraz\",\n      \"past\" : {\n        \"one\" : \"{0} sekundę temu\",\n        \"many\" : \"{0} sekund temu\",\n        \"other\" : \"{0} sekundy temu\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"many\" : \"{0} lat temu\",\n        \"few\" : \"{0} lata temu\",\n        \"one\" : \"{0} rok temu\",\n        \"other\" : \"{0} roku temu\"\n      },\n      \"previous\" : \"w zeszłym roku\",\n      \"future\" : {\n        \"one\" : \"za {0} rok\",\n        \"other\" : \"za {0} roku\",\n        \"few\" : \"za {0} lata\",\n        \"many\" : \"za {0} lat\"\n      },\n      \"current\" : \"w tym roku\",\n      \"next\" : \"w przyszłym roku\"\n    },\n    \"now\" : \"teraz\",\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} godziny temu\",\n        \"many\" : \"{0} godzin temu\",\n        \"one\" : \"{0} godzinę temu\"\n      },\n      \"future\" : {\n        \"many\" : \"za {0} godzin\",\n        \"other\" : \"za {0} godziny\",\n        \"one\" : \"za {0} godzinę\"\n      },\n      \"current\" : \"ta godzina\"\n    },\n    \"day\" : {\n      \"previous\" : \"wczoraj\",\n      \"next\" : \"jutro\",\n      \"past\" : {\n        \"one\" : \"{0} dzień temu\",\n        \"many\" : \"{0} dni temu\",\n        \"other\" : \"{0} dnia temu\",\n        \"few\" : \"{0} dni temu\"\n      },\n      \"current\" : \"dzisiaj\",\n      \"future\" : {\n        \"many\" : \"za {0} dni\",\n        \"one\" : \"za {0} dzień\",\n        \"few\" : \"za {0} dni\",\n        \"other\" : \"za {0} dnia\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"za {0} minutę\",\n        \"many\" : \"za {0} minut\",\n        \"other\" : \"za {0} minuty\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} minutę temu\",\n        \"other\" : \"{0} minuty temu\",\n        \"many\" : \"{0} minut temu\"\n      },\n      \"current\" : \"ta minuta\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"few\" : \"{0} miesiące temu\",\n        \"one\" : \"{0} miesiąc temu\",\n        \"many\" : \"{0} miesięcy temu\",\n        \"other\" : \"{0} miesiąca temu\"\n      },\n      \"previous\" : \"w zeszłym miesiącu\",\n      \"next\" : \"w przyszłym miesiącu\",\n      \"future\" : {\n        \"few\" : \"za {0} miesiące\",\n        \"many\" : \"za {0} miesięcy\",\n        \"other\" : \"za {0} miesiąca\",\n        \"one\" : \"za {0} miesiąc\"\n      },\n      \"current\" : \"w tym miesiącu\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"ta minuta\",\n      \"past\" : \"{0} min temu\",\n      \"future\" : \"za {0} min\"\n    },\n    \"year\" : {\n      \"current\" : \"w tym roku\",\n      \"past\" : {\n        \"one\" : \"{0} rok temu\",\n        \"other\" : \"{0} roku temu\",\n        \"many\" : \"{0} lat temu\",\n        \"few\" : \"{0} lata temu\"\n      },\n      \"future\" : {\n        \"few\" : \"za {0} lata\",\n        \"one\" : \"za {0} rok\",\n        \"many\" : \"za {0} lat\",\n        \"other\" : \"za {0} roku\"\n      },\n      \"next\" : \"w przyszłym roku\",\n      \"previous\" : \"w zeszłym roku\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"other\" : \"{0} dnia temu\",\n        \"one\" : \"{0} dzień temu\",\n        \"many\" : \"{0} dni temu\",\n        \"few\" : \"{0} dni temu\"\n      },\n      \"current\" : \"dzisiaj\",\n      \"future\" : {\n        \"few\" : \"za {0} dni\",\n        \"other\" : \"za {0} dnia\",\n        \"one\" : \"za {0} dzień\",\n        \"many\" : \"za {0} dni\"\n      },\n      \"next\" : \"jutro\",\n      \"previous\" : \"wczoraj\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} godz. temu\",\n      \"current\" : \"ta godzina\",\n      \"future\" : \"za {0} godz.\"\n    },\n    \"quarter\" : {\n      \"future\" : \"za {0} kw.\",\n      \"previous\" : \"w zeszłym kwartale\",\n      \"current\" : \"w tym kwartale\",\n      \"next\" : \"w przyszłym kwartale\",\n      \"past\" : \"{0} kw. temu\"\n    },\n    \"second\" : {\n      \"future\" : \"za {0} sek.\",\n      \"current\" : \"teraz\",\n      \"past\" : \"{0} sek. temu\"\n    },\n    \"now\" : \"teraz\",\n    \"month\" : {\n      \"next\" : \"w przyszłym miesiącu\",\n      \"current\" : \"w tym miesiącu\",\n      \"previous\" : \"w zeszłym miesiącu\",\n      \"past\" : \"{0} mies. temu\",\n      \"future\" : \"za {0} mies.\"\n    },\n    \"week\" : {\n      \"next\" : \"w przyszłym tygodniu\",\n      \"past\" : {\n        \"other\" : \"{0} tyg. temu\",\n        \"one\" : \"{0} tydz. temu\"\n      },\n      \"previous\" : \"w zeszłym tygodniu\",\n      \"current\" : \"w tym tygodniu\",\n      \"future\" : {\n        \"one\" : \"za {0} tydz.\",\n        \"other\" : \"za {0} tyg.\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ps.json",
    "content": "{\n  \"short\" : {\n    \"month\" : {\n      \"future\" : \"+{0} m\",\n      \"previous\" : \"last month\",\n      \"current\" : \"this month\",\n      \"next\" : \"next month\",\n      \"past\" : \"-{0} m\"\n    },\n    \"week\" : {\n      \"previous\" : \"last week\",\n      \"current\" : \"this week\",\n      \"future\" : \"+{0} w\",\n      \"past\" : \"-{0} w\",\n      \"next\" : \"next week\"\n    },\n    \"hour\" : {\n      \"past\" : \"-{0} h\",\n      \"current\" : \"this hour\",\n      \"future\" : \"+{0} h\"\n    },\n    \"quarter\" : {\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"minute\" : {\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\",\n      \"past\" : \"-{0} min\"\n    },\n    \"now\" : \"now\",\n    \"day\" : {\n      \"past\" : \"-{0} d\",\n      \"previous\" : \"yesterday\",\n      \"current\" : \"today\",\n      \"next\" : \"tomorrow\",\n      \"future\" : \"+{0} d\"\n    },\n    \"year\" : {\n      \"previous\" : \"پروسږکال\",\n      \"next\" : \"بل کال\",\n      \"current\" : \"سږکال\",\n      \"future\" : {\n        \"other\" : \"په {0} کالونو کې\",\n        \"one\" : \"په {0} کال کې\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} کال مخکې\",\n        \"other\" : \"{0} کاله مخکې\"\n      }\n    },\n    \"second\" : {\n      \"past\" : \"-{0} s\",\n      \"future\" : \"+{0} s\",\n      \"current\" : \"now\"\n    }\n  },\n  \"narrow\" : {\n    \"day\" : {\n      \"future\" : \"+{0} d\",\n      \"previous\" : \"yesterday\",\n      \"current\" : \"today\",\n      \"next\" : \"tomorrow\",\n      \"past\" : \"-{0} d\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"-{0} s\",\n      \"future\" : \"+{0} s\"\n    },\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"current\" : \"this hour\",\n      \"past\" : \"-{0} h\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"this quarter\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\"\n    },\n    \"year\" : {\n      \"current\" : \"سږکال\",\n      \"past\" : {\n        \"one\" : \"{0} کال مخکې\",\n        \"other\" : \"{0} کاله مخکې\"\n      },\n      \"future\" : {\n        \"one\" : \"په {0} کال کې\",\n        \"other\" : \"په {0} کالونو کې\"\n      },\n      \"next\" : \"بل کال\",\n      \"previous\" : \"پروسږکال\"\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"current\" : \"this week\",\n      \"past\" : \"-{0} w\",\n      \"future\" : \"+{0} w\",\n      \"next\" : \"next week\",\n      \"previous\" : \"last week\"\n    },\n    \"month\" : {\n      \"previous\" : \"last month\",\n      \"current\" : \"this month\",\n      \"next\" : \"next month\",\n      \"future\" : \"+{0} m\",\n      \"past\" : \"-{0} m\"\n    }\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\"\n    },\n    \"week\" : {\n      \"next\" : \"next week\",\n      \"current\" : \"this week\",\n      \"past\" : \"-{0} w\",\n      \"previous\" : \"last week\",\n      \"future\" : \"+{0} w\"\n    },\n    \"year\" : {\n      \"next\" : \"بل کال\",\n      \"past\" : {\n        \"other\" : \"{0} کاله مخکې\",\n        \"one\" : \"{0} کال مخکې\"\n      },\n      \"future\" : {\n        \"other\" : \"په {0} کالونو کې\",\n        \"one\" : \"په {0} کال کې\"\n      },\n      \"current\" : \"سږکال\",\n      \"previous\" : \"پروسږکال\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"future\" : \"+{0} h\",\n      \"past\" : \"-{0} h\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : \"-{0} s\",\n      \"future\" : \"+{0} s\"\n    },\n    \"day\" : {\n      \"previous\" : \"yesterday\",\n      \"current\" : \"today\",\n      \"next\" : \"tomorrow\",\n      \"past\" : \"-{0} d\",\n      \"future\" : \"+{0} d\"\n    },\n    \"now\" : \"now\",\n    \"month\" : {\n      \"current\" : \"this month\",\n      \"future\" : \"+{0} m\",\n      \"next\" : \"next month\",\n      \"previous\" : \"last month\",\n      \"past\" : \"-{0} m\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/pt.json",
    "content": "{\n  \"narrow\" : {\n    \"minute\" : {\n      \"future\" : \"+{0} min\",\n      \"past\" : \"-{0} min\",\n      \"current\" : \"este minuto\"\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"agora\",\n      \"past\" : \"-{0} s\"\n    },\n    \"now\" : \"agora\",\n    \"day\" : {\n      \"next\" : \"amanhã\",\n      \"previous\" : \"ontem\",\n      \"past\" : \"há {0} dias\",\n      \"current\" : \"hoje\",\n      \"future\" : {\n        \"other\" : \"+{0} dias\",\n        \"one\" : \"+{0} dia\"\n      }\n    },\n    \"month\" : {\n      \"previous\" : \"mês passado\",\n      \"next\" : \"próximo mês\",\n      \"current\" : \"este mês\",\n      \"future\" : {\n        \"one\" : \"+{0} mês\",\n        \"other\" : \"+{0} meses\"\n      },\n      \"past\" : {\n        \"one\" : \"-{0} mês\",\n        \"other\" : \"-{0} meses\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"próximo trim.\",\n      \"past\" : \"-{0} trim.\",\n      \"future\" : \"+{0} trim.\",\n      \"previous\" : \"trim. passado\",\n      \"current\" : \"este trim.\"\n    },\n    \"week\" : {\n      \"previous\" : \"semana passada\",\n      \"next\" : \"próxima semana\",\n      \"future\" : \"+{0} sem.\",\n      \"current\" : \"esta semana\",\n      \"past\" : \"-{0} sem.\"\n    },\n    \"hour\" : {\n      \"current\" : \"esta hora\",\n      \"past\" : \"-{0} h\",\n      \"future\" : \"+{0} h\"\n    },\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"-{0} ano\",\n        \"other\" : \"-{0} anos\"\n      },\n      \"next\" : \"próximo ano\",\n      \"previous\" : \"ano passado\",\n      \"current\" : \"este ano\",\n      \"future\" : {\n        \"other\" : \"+{0} anos\",\n        \"one\" : \"+{0} ano\"\n      }\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"previous\" : \"ano passado\",\n      \"current\" : \"este ano\",\n      \"next\" : \"próximo ano\",\n      \"past\" : {\n        \"one\" : \"há {0} ano\",\n        \"other\" : \"há {0} anos\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} ano\",\n        \"other\" : \"dentro de {0} anos\"\n      }\n    },\n    \"month\" : {\n      \"previous\" : \"mês passado\",\n      \"current\" : \"este mês\",\n      \"next\" : \"próximo mês\",\n      \"past\" : {\n        \"other\" : \"há {0} meses\",\n        \"one\" : \"há {0} mês\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} meses\",\n        \"one\" : \"dentro de {0} mês\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"ontem\",\n      \"current\" : \"hoje\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} dia\",\n        \"other\" : \"dentro de {0} dias\"\n      },\n      \"next\" : \"amanhã\",\n      \"past\" : {\n        \"one\" : \"há {0} dia\",\n        \"other\" : \"há {0} dias\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"há {0} horas\",\n        \"one\" : \"há {0} hora\"\n      },\n      \"current\" : \"esta hora\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} horas\",\n        \"one\" : \"dentro de {0} hora\"\n      }\n    },\n    \"now\" : \"agora\",\n    \"minute\" : {\n      \"current\" : \"este minuto\",\n      \"past\" : {\n        \"one\" : \"há {0} minuto\",\n        \"other\" : \"há {0} minutos\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} minuto\",\n        \"other\" : \"dentro de {0} minutos\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"há {0} segundo\",\n        \"other\" : \"há {0} segundos\"\n      },\n      \"current\" : \"agora\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} segundo\",\n        \"other\" : \"dentro de {0} segundos\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"próximo trimestre\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} trimestres\",\n        \"one\" : \"dentro de {0} trimestre\"\n      },\n      \"past\" : {\n        \"one\" : \"há {0} trimestre\",\n        \"other\" : \"há {0} trimestres\"\n      },\n      \"current\" : \"este trimestre\",\n      \"previous\" : \"trimestre passado\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"other\" : \"há {0} semanas\",\n        \"one\" : \"há {0} semana\"\n      },\n      \"current\" : \"esta semana\",\n      \"previous\" : \"semana passada\",\n      \"next\" : \"próxima semana\",\n      \"future\" : {\n        \"one\" : \"dentro de {0} semana\",\n        \"other\" : \"dentro de {0} semanas\"\n      }\n    }\n  },\n  \"short\" : {\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"há {0} ano\",\n        \"other\" : \"há {0} anos\"\n      },\n      \"future\" : {\n        \"one\" : \"dentro de {0} ano\",\n        \"other\" : \"dentro de {0} anos\"\n      },\n      \"previous\" : \"ano passado\",\n      \"current\" : \"este ano\",\n      \"next\" : \"próximo ano\"\n    },\n    \"day\" : {\n      \"next\" : \"amanhã\",\n      \"current\" : \"hoje\",\n      \"previous\" : \"ontem\",\n      \"future\" : {\n        \"other\" : \"dentro de {0} dias\",\n        \"one\" : \"dentro de {0} dia\"\n      },\n      \"past\" : {\n        \"other\" : \"há {0} dias\",\n        \"one\" : \"há {0} dia\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"este minuto\",\n      \"past\" : \"há {0} min\",\n      \"future\" : \"dentro de {0} min\"\n    },\n    \"hour\" : {\n      \"past\" : \"há {0} h\",\n      \"future\" : \"dentro de {0} h\",\n      \"current\" : \"esta hora\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"trim. passado\",\n      \"future\" : \"dentro de {0} trim.\",\n      \"next\" : \"próximo trim.\",\n      \"past\" : \"há {0} trim.\",\n      \"current\" : \"este trim.\"\n    },\n    \"second\" : {\n      \"future\" : \"dentro de {0} s\",\n      \"current\" : \"agora\",\n      \"past\" : \"há {0} s\"\n    },\n    \"now\" : \"agora\",\n    \"week\" : {\n      \"past\" : \"há {0} sem.\",\n      \"future\" : \"dentro de {0} sem.\",\n      \"next\" : \"próxima semana\",\n      \"current\" : \"esta semana\",\n      \"previous\" : \"semana passada\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"one\" : \"há {0} mês\",\n        \"other\" : \"há {0} meses\"\n      },\n      \"future\" : {\n        \"other\" : \"dentro de {0} meses\",\n        \"one\" : \"dentro de {0} mês\"\n      },\n      \"next\" : \"próximo mês\",\n      \"previous\" : \"mês passado\",\n      \"current\" : \"este mês\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ro.json",
    "content": "{\n  \"short\" : {\n    \"year\" : {\n      \"previous\" : \"anul trecut\",\n      \"next\" : \"anul viitor\",\n      \"current\" : \"anul acesta\",\n      \"future\" : {\n        \"other\" : \"peste {0} de ani\",\n        \"one\" : \"peste {0} an\",\n        \"few\" : \"peste {0} ani\"\n      },\n      \"past\" : {\n        \"few\" : \"acum {0} ani\",\n        \"one\" : \"acum {0} an\",\n        \"other\" : \"acum {0} de ani\"\n      }\n    },\n    \"quarter\" : {\n      \"future\" : \"peste {0} trim.\",\n      \"previous\" : \"trim. trecut\",\n      \"current\" : \"trim. acesta\",\n      \"next\" : \"trim. viitor\",\n      \"past\" : \"acum {0} trim.\"\n    },\n    \"hour\" : {\n      \"past\" : \"acum {0} h\",\n      \"future\" : \"peste {0} h\",\n      \"current\" : \"ora aceasta\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"acum {0} zi\",\n        \"few\" : \"acum {0} zile\",\n        \"other\" : \"acum {0} de zile\"\n      },\n      \"future\" : {\n        \"other\" : \"peste {0} de zile\",\n        \"few\" : \"peste {0} zile\",\n        \"one\" : \"peste {0} zi\"\n      },\n      \"previous\" : \"ieri\",\n      \"next\" : \"mâine\",\n      \"current\" : \"azi\"\n    },\n    \"minute\" : {\n      \"current\" : \"minutul acesta\",\n      \"past\" : \"acum {0} min.\",\n      \"future\" : \"peste {0} min.\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"other\" : \"peste {0} luni\",\n        \"one\" : \"peste {0} lună\"\n      },\n      \"previous\" : \"luna trecută\",\n      \"current\" : \"luna aceasta\",\n      \"next\" : \"luna viitoare\",\n      \"past\" : {\n        \"one\" : \"acum {0} lună\",\n        \"other\" : \"acum {0} luni\"\n      }\n    },\n    \"week\" : {\n      \"past\" : \"acum {0} săpt.\",\n      \"future\" : \"peste {0} săpt.\",\n      \"next\" : \"săptămâna viitoare\",\n      \"current\" : \"săptămâna aceasta\",\n      \"previous\" : \"săptămâna trecută\"\n    },\n    \"second\" : {\n      \"future\" : \"peste {0} sec.\",\n      \"current\" : \"acum\",\n      \"past\" : \"acum {0} sec.\"\n    },\n    \"now\" : \"acum\"\n  },\n  \"narrow\" : {\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"+{0} lună\",\n        \"other\" : \"+{0} luni\"\n      },\n      \"next\" : \"luna viitoare\",\n      \"current\" : \"luna aceasta\",\n      \"previous\" : \"luna trecută\",\n      \"past\" : {\n        \"one\" : \"-{0} lună\",\n        \"other\" : \"-{0} luni\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : \"+{0} m\",\n      \"current\" : \"minutul acesta\",\n      \"past\" : \"-{0} m\"\n    },\n    \"second\" : {\n      \"current\" : \"acum\",\n      \"future\" : \"+{0} s\",\n      \"past\" : \"-{0} s\"\n    },\n    \"now\" : \"acum\",\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"+{0} zile\",\n        \"one\" : \"+{0} zi\"\n      },\n      \"previous\" : \"ieri\",\n      \"current\" : \"azi\",\n      \"next\" : \"mâine\",\n      \"past\" : {\n        \"one\" : \"-{0} zi\",\n        \"other\" : \"-{0} zile\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"anul trecut\",\n      \"past\" : {\n        \"one\" : \"-{0} an\",\n        \"other\" : \"-{0} ani\"\n      },\n      \"future\" : {\n        \"other\" : \"+{0} ani\",\n        \"one\" : \"+{0} an\"\n      },\n      \"current\" : \"anul acesta\",\n      \"next\" : \"anul viitor\"\n    },\n    \"quarter\" : {\n      \"past\" : \"-{0} trim.\",\n      \"previous\" : \"trim. trecut\",\n      \"current\" : \"trim. acesta\",\n      \"next\" : \"trim. viitor\",\n      \"future\" : \"+{0} trim.\"\n    },\n    \"week\" : {\n      \"previous\" : \"săptămâna trecută\",\n      \"past\" : \"-{0} săpt.\",\n      \"future\" : \"+{0} săpt.\",\n      \"current\" : \"săptămâna aceasta\",\n      \"next\" : \"săptămâna viitoare\"\n    },\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"past\" : \"-{0} h\",\n      \"current\" : \"ora aceasta\"\n    }\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"acum {0} minut\",\n        \"few\" : \"acum {0} minute\",\n        \"other\" : \"acum {0} de minute\"\n      },\n      \"current\" : \"minutul acesta\",\n      \"future\" : {\n        \"one\" : \"peste {0} minut\",\n        \"other\" : \"peste {0} de minute\",\n        \"few\" : \"peste {0} minute\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"acum\",\n      \"future\" : {\n        \"few\" : \"peste {0} secunde\",\n        \"one\" : \"peste {0} secundă\",\n        \"other\" : \"peste {0} de secunde\"\n      },\n      \"past\" : {\n        \"few\" : \"acum {0} secunde\",\n        \"other\" : \"acum {0} de secunde\",\n        \"one\" : \"acum {0} secundă\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"luna viitoare\",\n      \"current\" : \"luna aceasta\",\n      \"previous\" : \"luna trecută\",\n      \"past\" : {\n        \"other\" : \"acum {0} de luni\",\n        \"one\" : \"acum {0} lună\",\n        \"few\" : \"acum {0} luni\"\n      },\n      \"future\" : {\n        \"one\" : \"peste {0} lună\",\n        \"other\" : \"peste {0} de luni\",\n        \"few\" : \"peste {0} luni\"\n      }\n    },\n    \"day\" : {\n      \"current\" : \"azi\",\n      \"future\" : {\n        \"other\" : \"peste {0} de zile\",\n        \"few\" : \"peste {0} zile\",\n        \"one\" : \"peste {0} zi\"\n      },\n      \"next\" : \"mâine\",\n      \"previous\" : \"ieri\",\n      \"past\" : {\n        \"one\" : \"acum {0} zi\",\n        \"few\" : \"acum {0} zile\",\n        \"other\" : \"acum {0} de zile\"\n      }\n    },\n    \"now\" : \"acum\",\n    \"hour\" : {\n      \"current\" : \"ora aceasta\",\n      \"past\" : {\n        \"few\" : \"acum {0} ore\",\n        \"one\" : \"acum {0} oră\",\n        \"other\" : \"acum {0} de ore\"\n      },\n      \"future\" : {\n        \"few\" : \"peste {0} ore\",\n        \"other\" : \"peste {0} de ore\",\n        \"one\" : \"peste {0} oră\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"trimestrul trecut\",\n      \"current\" : \"trimestrul acesta\",\n      \"past\" : {\n        \"one\" : \"acum {0} trimestru\",\n        \"few\" : \"acum {0} trimestre\",\n        \"other\" : \"acum {0} de trimestre\"\n      },\n      \"future\" : {\n        \"other\" : \"peste {0} de trimestre\",\n        \"one\" : \"peste {0} trimestru\",\n        \"few\" : \"peste {0} trimestre\"\n      },\n      \"next\" : \"trimestrul viitor\"\n    },\n    \"year\" : {\n      \"next\" : \"anul viitor\",\n      \"past\" : {\n        \"few\" : \"acum {0} ani\",\n        \"other\" : \"acum {0} de ani\",\n        \"one\" : \"acum {0} an\"\n      },\n      \"previous\" : \"anul trecut\",\n      \"future\" : {\n        \"few\" : \"peste {0} ani\",\n        \"other\" : \"peste {0} de ani\",\n        \"one\" : \"peste {0} an\"\n      },\n      \"current\" : \"anul acesta\"\n    },\n    \"week\" : {\n      \"next\" : \"săptămâna viitoare\",\n      \"future\" : {\n        \"few\" : \"peste {0} săptămâni\",\n        \"other\" : \"peste {0} de săptămâni\",\n        \"one\" : \"peste {0} săptămână\"\n      },\n      \"previous\" : \"săptămâna trecută\",\n      \"current\" : \"săptămâna aceasta\",\n      \"past\" : {\n        \"one\" : \"acum {0} săptămână\",\n        \"few\" : \"acum {0} săptămâni\",\n        \"other\" : \"acum {0} de săptămâni\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ru.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"past\" : \"-{0} с\",\n      \"current\" : \"сейчас\",\n      \"future\" : \"+{0} с\"\n    },\n    \"year\" : {\n      \"previous\" : \"в пр. г.\",\n      \"next\" : \"в сл. г.\",\n      \"future\" : {\n        \"many\" : \"+{0} л.\",\n        \"other\" : \"+{0} г.\"\n      },\n      \"current\" : \"в эт. г.\",\n      \"past\" : {\n        \"other\" : \"-{0} г.\",\n        \"many\" : \"-{0} л.\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"-{0} мес.\",\n      \"next\" : \"в след. мес.\",\n      \"future\" : \"+{0} мес.\",\n      \"previous\" : \"в пр. мес.\",\n      \"current\" : \"в эт. мес.\"\n    },\n    \"minute\" : {\n      \"future\" : \"+{0} мин.\",\n      \"past\" : \"-{0} мин.\",\n      \"current\" : \"в эту минуту\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"посл. кв.\",\n      \"current\" : \"тек. кв.\",\n      \"next\" : \"след. кв.\",\n      \"past\" : \"-{0} кв.\",\n      \"future\" : \"+{0} кв.\"\n    },\n    \"hour\" : {\n      \"past\" : \"-{0} ч.\",\n      \"current\" : \"в этот час\",\n      \"future\" : \"+{0} ч.\"\n    },\n    \"now\" : \"сейчас\",\n    \"week\" : {\n      \"next\" : \"на след. неделе\",\n      \"previous\" : \"на пр. нед.\",\n      \"past\" : \"-{0} нед.\",\n      \"future\" : \"+{0} нед.\",\n      \"current\" : \"на эт. нед.\"\n    },\n    \"day\" : {\n      \"previous\" : \"вчера\",\n      \"future\" : \"+{0} дн.\",\n      \"past\" : \"-{0} дн.\",\n      \"current\" : \"сегодня\",\n      \"next\" : \"завтра\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"через {0} мин.\",\n      \"current\" : \"в эту минуту\",\n      \"past\" : \"{0} мин. назад\"\n    },\n    \"week\" : {\n      \"current\" : \"на этой нед.\",\n      \"past\" : \"{0} нед. назад\",\n      \"future\" : \"через {0} нед.\",\n      \"next\" : \"на следующей нед.\",\n      \"previous\" : \"на прошлой нед.\"\n    },\n    \"year\" : {\n      \"current\" : \"в этом г.\",\n      \"future\" : {\n        \"many\" : \"через {0} л.\",\n        \"other\" : \"через {0} г.\"\n      },\n      \"past\" : {\n        \"many\" : \"{0} л. назад\",\n        \"other\" : \"{0} г. назад\"\n      },\n      \"next\" : \"в след. г.\",\n      \"previous\" : \"в прошлом г.\"\n    },\n    \"day\" : {\n      \"next\" : \"завтра\",\n      \"current\" : \"сегодня\",\n      \"previous\" : \"вчера\",\n      \"past\" : \"{0} дн. назад\",\n      \"future\" : \"через {0} дн.\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"{0} ч. назад\",\n        \"other\" : \"{0} ч. назад\"\n      },\n      \"future\" : {\n        \"one\" : \"через {0} ч.\",\n        \"other\" : \"через {0} ч.\"\n      },\n      \"current\" : \"в этот час\"\n    },\n    \"quarter\" : {\n      \"current\" : \"текущий кв.\",\n      \"future\" : \"через {0} кв.\",\n      \"previous\" : \"последний кв.\",\n      \"next\" : \"следующий кв.\",\n      \"past\" : \"{0} кв. назад\"\n    },\n    \"second\" : {\n      \"future\" : \"через {0} сек.\",\n      \"current\" : \"сейчас\",\n      \"past\" : \"{0} сек. назад\"\n    },\n    \"month\" : {\n      \"current\" : \"в этом мес.\",\n      \"past\" : \"{0} мес. назад\",\n      \"future\" : \"через {0} мес.\",\n      \"next\" : \"в следующем мес.\",\n      \"previous\" : \"в прошлом мес.\"\n    },\n    \"now\" : \"сейчас\"\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"в следующем квартале\",\n      \"past\" : {\n        \"one\" : \"{0} квартал назад\",\n        \"many\" : \"{0} кварталов назад\",\n        \"other\" : \"{0} квартала назад\"\n      },\n      \"previous\" : \"в прошлом квартале\",\n      \"current\" : \"в текущем квартале\",\n      \"future\" : {\n        \"one\" : \"через {0} квартал\",\n        \"many\" : \"через {0} кварталов\",\n        \"other\" : \"через {0} квартала\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"в следующем месяце\",\n      \"current\" : \"в этом месяце\",\n      \"past\" : {\n        \"one\" : \"{0} месяц назад\",\n        \"many\" : \"{0} месяцев назад\",\n        \"other\" : \"{0} месяца назад\"\n      },\n      \"previous\" : \"в прошлом месяце\",\n      \"future\" : {\n        \"other\" : \"через {0} месяца\",\n        \"many\" : \"через {0} месяцев\",\n        \"one\" : \"через {0} месяц\"\n      }\n    },\n    \"now\" : \"сейчас\",\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"через {0} недели\",\n        \"one\" : \"через {0} неделю\",\n        \"many\" : \"через {0} недель\"\n      },\n      \"previous\" : \"на прошлой неделе\",\n      \"current\" : \"на этой неделе\",\n      \"next\" : \"на следующей неделе\",\n      \"past\" : {\n        \"many\" : \"{0} недель назад\",\n        \"one\" : \"{0} неделю назад\",\n        \"other\" : \"{0} недели назад\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"в этот час\",\n      \"future\" : {\n        \"one\" : \"через {0} час\",\n        \"many\" : \"через {0} часов\",\n        \"other\" : \"через {0} часа\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} часа назад\",\n        \"many\" : \"{0} часов назад\",\n        \"one\" : \"{0} час назад\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"many\" : \"через {0} минут\",\n        \"one\" : \"через {0} минуту\",\n        \"other\" : \"через {0} минуты\"\n      },\n      \"current\" : \"в эту минуту\",\n      \"past\" : {\n        \"one\" : \"{0} минуту назад\",\n        \"many\" : \"{0} минут назад\",\n        \"other\" : \"{0} минуты назад\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"other\" : \"{0} секунды назад\",\n        \"many\" : \"{0} секунд назад\",\n        \"one\" : \"{0} секунду назад\"\n      },\n      \"current\" : \"сейчас\",\n      \"future\" : {\n        \"other\" : \"через {0} секунды\",\n        \"one\" : \"через {0} секунду\",\n        \"many\" : \"через {0} секунд\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"вчера\",\n      \"past\" : {\n        \"many\" : \"{0} дней назад\",\n        \"other\" : \"{0} дня назад\",\n        \"one\" : \"{0} день назад\"\n      },\n      \"future\" : {\n        \"other\" : \"через {0} дня\",\n        \"one\" : \"через {0} день\",\n        \"many\" : \"через {0} дней\"\n      },\n      \"next\" : \"завтра\",\n      \"current\" : \"сегодня\"\n    },\n    \"year\" : {\n      \"next\" : \"в следующем году\",\n      \"current\" : \"в этом году\",\n      \"future\" : {\n        \"one\" : \"через {0} год\",\n        \"other\" : \"через {0} года\",\n        \"many\" : \"через {0} лет\"\n      },\n      \"previous\" : \"в прошлом году\",\n      \"past\" : {\n        \"many\" : \"{0} лет назад\",\n        \"other\" : \"{0} года назад\",\n        \"one\" : \"{0} год назад\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sah.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"Сарсын\",\n      \"future\" : \"{0} күнүнэн\",\n      \"previous\" : \"Бэҕэһээ\",\n      \"current\" : \"Бүгүн\",\n      \"past\" : \"{0} күн ынараа өттүгэр\"\n    },\n    \"quarter\" : {\n      \"next\" : \"кэлэр кыбаартал\",\n      \"past\" : \"{0} кыб. анараа өттүгэр\",\n      \"future\" : \"{0} кыбаарталынан\",\n      \"previous\" : \"ааспыт кыбаартал\",\n      \"current\" : \"бу кыбаартал\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} чаас ынараа өттүгэр\",\n      \"future\" : \"{0} чааһынан\",\n      \"current\" : \"this hour\"\n    },\n    \"year\" : {\n      \"next\" : \"эһиил\",\n      \"past\" : \"{0} сыл ынараа өттүгэр\",\n      \"current\" : \"быйыл\",\n      \"previous\" : \"Былырыын\",\n      \"future\" : \"{0} сылынан\"\n    },\n    \"now\" : \"билигин\",\n    \"month\" : {\n      \"current\" : \"бу ый\",\n      \"future\" : \"{0} ыйынан\",\n      \"past\" : \"{0} ый ынараа өттүгэр\",\n      \"next\" : \"аныгыскы ый\",\n      \"previous\" : \"ааспыт ый\"\n    },\n    \"week\" : {\n      \"previous\" : \"ааспыт нэдиэлэ\",\n      \"current\" : \"бу нэдиэлэ\",\n      \"past\" : \"{0} нэдиэлэ анараа өттүгэр\",\n      \"future\" : \"{0} нэдиэлэннэн\",\n      \"next\" : \"кэлэр нэдиэлэ\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} мүнүүтэ ынараа өттүгэр\",\n      \"current\" : \"this minute\",\n      \"future\" : \"{0} мүнүүтэннэн\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} сөкүүндэннэн\",\n      \"current\" : \"билигин\",\n      \"past\" : \"{0} сөк. анараа өттүгэр\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"Бэҕэһээ\",\n      \"current\" : \"Бүгүн\",\n      \"next\" : \"Сарсын\",\n      \"past\" : \"{0} күн ынараа өттүгэр\",\n      \"future\" : \"{0} күнүнэн\"\n    },\n    \"week\" : {\n      \"current\" : \"бу нэдиэлэ\",\n      \"future\" : \"{0} нэдиэлэннэн\",\n      \"past\" : \"{0} нэдиэлэ анараа өттүгэр\",\n      \"previous\" : \"ааспыт нэдиэлэ\",\n      \"next\" : \"кэлэр нэдиэлэ\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} мүнүүтэннэн\",\n      \"current\" : \"this minute\",\n      \"past\" : \"{0} мүнүүтэ ынараа өттүгэр\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ыйынан\",\n      \"next\" : \"аныгыскы ый\",\n      \"previous\" : \"ааспыт ый\",\n      \"current\" : \"бу ый\",\n      \"past\" : \"{0} ый ынараа өттүгэр\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} чаас ынараа өттүгэр\",\n      \"future\" : \"{0} чааһынан\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} сыл ынараа өттүгэр\",\n      \"future\" : \"{0} сылынан\",\n      \"previous\" : \"Былырыын\",\n      \"next\" : \"эһиил\",\n      \"current\" : \"быйыл\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} сөкүүндэ ынараа өттүгэр\",\n      \"current\" : \"билигин\",\n      \"future\" : \"{0} сөкүүндэннэн\"\n    },\n    \"now\" : \"билигин\",\n    \"quarter\" : {\n      \"past\" : \"{0} кыбаартал анараа өттүгэр\",\n      \"current\" : \"бу кыбаартал\",\n      \"previous\" : \"ааспыт кыбаартал\",\n      \"future\" : \"{0} кыбаарталынан\",\n      \"next\" : \"кэлэр кыбаартал\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} кыбаарталынан\",\n      \"next\" : \"кэлэр кыбаартал\",\n      \"previous\" : \"ааспыт кыбаартал\",\n      \"current\" : \"бу кыбаартал\",\n      \"past\" : \"{0} кыб. анараа өттүгэр\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} мүнүүтэ ынараа өттүгэр\",\n      \"future\" : \"{0} мүнүүтэннэн\",\n      \"current\" : \"this minute\"\n    },\n    \"year\" : {\n      \"next\" : \"эһиил\",\n      \"future\" : \"{0} сылынан\",\n      \"current\" : \"быйыл\",\n      \"past\" : \"{0} сыл ынараа өттүгэр\",\n      \"previous\" : \"Былырыын\"\n    },\n    \"second\" : {\n      \"current\" : \"билигин\",\n      \"past\" : \"{0} сөк. анараа өттүгэр\",\n      \"future\" : \"{0} сөкүүндэннэн\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} чаас ынараа өттүгэр\",\n      \"future\" : \"{0} чааһынан\"\n    },\n    \"now\" : \"билигин\",\n    \"month\" : {\n      \"previous\" : \"ааспыт ый\",\n      \"next\" : \"аныгыскы ый\",\n      \"past\" : \"{0} ый ынараа өттүгэр\",\n      \"current\" : \"бу ый\",\n      \"future\" : \"{0} ыйынан\"\n    },\n    \"week\" : {\n      \"previous\" : \"ааспыт нэдиэлэ\",\n      \"current\" : \"бу нэдиэлэ\",\n      \"next\" : \"кэлэр нэдиэлэ\",\n      \"past\" : \"{0} нэдиэлэ анараа өттүгэр\",\n      \"future\" : \"{0} нэдиэлэннэн\"\n    },\n    \"day\" : {\n      \"next\" : \"Сарсын\",\n      \"past\" : \"{0} күн ынараа өттүгэр\",\n      \"future\" : \"{0} күнүнэн\",\n      \"previous\" : \"Бэҕэһээ\",\n      \"current\" : \"Бүгүн\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sd.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"{0} سالن ۾\",\n      \"previous\" : \"پويون سال\",\n      \"next\" : \"پويون سال\",\n      \"current\" : \"پويون سال\",\n      \"past\" : \"{0} سال پهرين\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} هفتا پهرين\",\n      \"previous\" : \"پوئين هفتي\",\n      \"future\" : \"{0} هفتن ۾\",\n      \"current\" : \"هن هفتي\",\n      \"next\" : \"اڳين هفتي\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} ڪلاڪ ۾\",\n      \"current\" : \"هن ڪلڪ\",\n      \"past\" : \"{0} ڪلاڪ پهرين\"\n    },\n    \"quarter\" : {\n      \"current\" : \"هن ٽي ماهي\",\n      \"previous\" : \"پوئين ٽي ماهي\",\n      \"future\" : \"{0} ٽي ماهي ۾\",\n      \"past\" : \"{0} ٽي ماهي پهرين\",\n      \"next\" : \"اڳين ٽي ماهي\"\n    },\n    \"second\" : {\n      \"current\" : \"هاڻي\",\n      \"future\" : \"{0} سيڪنڊن ۾\",\n      \"past\" : \"{0} سيڪنڊ پهرين\"\n    },\n    \"month\" : {\n      \"current\" : \"هن مهيني\",\n      \"future\" : \"{0} مهينن ۾\",\n      \"past\" : \"{0} مهينا پهرين\",\n      \"next\" : \"اڳين مهيني\",\n      \"previous\" : \"پوئين مهيني\"\n    },\n    \"day\" : {\n      \"previous\" : \"ڪل\",\n      \"future\" : \"{0} ڏينهن ۾\",\n      \"next\" : \"سڀاڻي\",\n      \"current\" : \"اڄ\",\n      \"past\" : \"{0} ڏينهن پهرين\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} منٽ پهرين\",\n      \"future\" : \"{0} منٽن ۾\",\n      \"current\" : \"هن منٽ\"\n    },\n    \"now\" : \"هاڻي\"\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"اڳين ٽي ماهي\",\n      \"current\" : \"هن ٽي ماهي\",\n      \"previous\" : \"پوئين ٽي ماهي\",\n      \"past\" : \"{0} ٽي ماهي پهرين\",\n      \"future\" : \"{0} ٽي ماهي ۾\"\n    },\n    \"year\" : {\n      \"previous\" : \"پويون سال\",\n      \"past\" : \"{0} سال پهرين\",\n      \"future\" : \"{0} سالن ۾\",\n      \"next\" : \"پويون سال\",\n      \"current\" : \"پويون سال\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} منٽ پهرين\",\n      \"future\" : {\n        \"one\" : \"{0} منٽن ۾\",\n        \"other\" : \"+{0} min\"\n      },\n      \"current\" : \"هن منٽ\"\n    },\n    \"month\" : {\n      \"previous\" : \"پوئين مهيني\",\n      \"current\" : \"هن مهيني\",\n      \"future\" : \"{0} مهينن ۾\",\n      \"past\" : \"{0} مهينا پهرين\",\n      \"next\" : \"اڳين مهيني\"\n    },\n    \"now\" : \"هاڻي\",\n    \"hour\" : {\n      \"past\" : \"{0} ڪلاڪ پهرين\",\n      \"future\" : \"{0} ڪلاڪ ۾\",\n      \"current\" : \"هن ڪلڪ\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} سيڪنڊن ۾\",\n      \"current\" : \"هاڻي\",\n      \"past\" : \"{0} سيڪنڊ پهرين\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} هفتا پهرين\",\n      \"current\" : \"هن هفتي\",\n      \"next\" : \"اڳين هفتي\",\n      \"previous\" : \"پوئين هفتي\",\n      \"future\" : \"{0} هفتن ۾\"\n    },\n    \"day\" : {\n      \"previous\" : \"ڪل\",\n      \"future\" : \"{0} ڏينهن ۾\",\n      \"next\" : \"سڀاڻي\",\n      \"past\" : \"{0} ڏينهن پهرين\",\n      \"current\" : \"اڄ\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"هاڻي\",\n      \"past\" : \"{0} سيڪنڊ پهرين\",\n      \"future\" : \"{0} سيڪنڊن ۾\"\n    },\n    \"now\" : \"هاڻي\",\n    \"month\" : {\n      \"future\" : \"{0} مهينن ۾\",\n      \"current\" : \"هن مهيني\",\n      \"past\" : \"{0} مهينا پهرين\",\n      \"previous\" : \"پوئين مهيني\",\n      \"next\" : \"اڳين مهيني\"\n    },\n    \"day\" : {\n      \"previous\" : \"ڪل\",\n      \"current\" : \"اڄ\",\n      \"next\" : \"سڀاڻي\",\n      \"future\" : \"{0} ڏينهن ۾\",\n      \"past\" : \"{0} ڏينهن پهرين\"\n    },\n    \"minute\" : {\n      \"current\" : \"هن منٽ\",\n      \"future\" : \"{0} منٽن ۾\",\n      \"past\" : \"{0} منٽ پهرين\"\n    },\n    \"quarter\" : {\n      \"past\" : \"{0} ٽي ماهي پهرين\",\n      \"previous\" : \"پوئين ٽي ماهي\",\n      \"current\" : \"هن ٽي ماهي\",\n      \"future\" : \"{0} ٽي ماهي ۾\",\n      \"next\" : \"اڳين ٽي ماهي\"\n    },\n    \"hour\" : {\n      \"current\" : \"هن ڪلڪ\",\n      \"future\" : \"{0} ڪلاڪ ۾\",\n      \"past\" : \"{0} ڪلاڪ پهرين\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} هفتن ۾\",\n      \"previous\" : \"پوئين هفتي\",\n      \"next\" : \"اڳين هفتي\",\n      \"past\" : \"{0} هفتا پهرين\",\n      \"current\" : \"هن هفتي\"\n    },\n    \"year\" : {\n      \"next\" : \"پويون سال\",\n      \"current\" : \"پويون سال\",\n      \"past\" : \"{0} سال پهرين\",\n      \"future\" : \"{0} سالن ۾\",\n      \"previous\" : \"پويون سال\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/se.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"{0} sekunda maŋŋilit\",\n        \"other\" : \"{0} sekundda maŋŋilit\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} sekunda árat\",\n        \"other\" : \"{0} sekundda árat\"\n      },\n      \"current\" : \"now\"\n    },\n    \"week\" : {\n      \"past\" : {\n        \"one\" : \"{0} vahku árat\",\n        \"other\" : \"{0} vahkku árat\"\n      },\n      \"next\" : \"next week\",\n      \"previous\" : \"last week\",\n      \"current\" : \"this week\",\n      \"future\" : {\n        \"one\" : \"{0} vahku maŋŋilit\",\n        \"other\" : \"{0} vahkku maŋŋilit\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"this month\",\n      \"next\" : \"next month\",\n      \"future\" : \"{0} mánotbadji maŋŋilit\",\n      \"previous\" : \"last month\",\n      \"past\" : \"{0} mánotbadji árat\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"next\" : \"next quarter\"\n    },\n    \"year\" : {\n      \"current\" : \"this year\",\n      \"previous\" : \"last year\",\n      \"future\" : {\n        \"other\" : \"{0} jahkki maŋŋilit\",\n        \"one\" : \"{0} jahki maŋŋilit\"\n      },\n      \"next\" : \"next year\",\n      \"past\" : {\n        \"other\" : \"{0} jahkki árat\",\n        \"one\" : \"{0} jahki árat\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"one\" : \"{0} diibmu árat\",\n        \"other\" : \"{0} diibmur árat\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} diibmu maŋŋilit\",\n        \"other\" : \"{0} diibmur maŋŋilit\"\n      }\n    },\n    \"day\" : {\n      \"current\" : \"odne\",\n      \"next\" : \"ihttin\",\n      \"previous\" : \"ikte\",\n      \"past\" : {\n        \"other\" : \"{0} jándora árat\",\n        \"one\" : \"{0} jándor árat\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} jándora maŋŋilit\",\n        \"one\" : \"{0} jándor maŋŋilit\",\n        \"two\" : \"{0} jándor amaŋŋilit\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"{0} minuhta árat\",\n        \"other\" : \"{0} minuhtta árat\"\n      },\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"{0} minuhta maŋŋilit\",\n        \"other\" : \"{0} minuhtta maŋŋilit\"\n      }\n    },\n    \"now\" : \"now\"\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"{0} minuhta árat\",\n        \"other\" : \"{0} minuhtta árat\"\n      },\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"{0} minuhta maŋŋilit\",\n        \"other\" : \"{0} minuhtta maŋŋilit\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"other\" : \"{0} diibmur árat\",\n        \"one\" : \"{0} diibmu árat\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} diibmu maŋŋilit\",\n        \"other\" : \"{0} diibmur maŋŋilit\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"next\" : \"next quarter\",\n      \"future\" : \"+{0} Q\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"year\" : {\n      \"previous\" : \"last year\",\n      \"next\" : \"next year\",\n      \"past\" : {\n        \"one\" : \"{0} jahki árat\",\n        \"other\" : \"{0} jahkki árat\"\n      },\n      \"current\" : \"this year\",\n      \"future\" : {\n        \"one\" : \"{0} jahki maŋŋilit\",\n        \"other\" : \"{0} jahkki maŋŋilit\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"next week\",\n      \"previous\" : \"last week\",\n      \"current\" : \"this week\",\n      \"past\" : {\n        \"one\" : \"{0} vahku árat\",\n        \"other\" : \"{0} vahkku árat\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} vahkku maŋŋilit\",\n        \"one\" : \"{0} vahku maŋŋilit\"\n      }\n    },\n    \"day\" : {\n      \"current\" : \"odne\",\n      \"future\" : {\n        \"one\" : \"{0} jándor maŋŋilit\",\n        \"other\" : \"{0} jándora maŋŋilit\",\n        \"two\" : \"{0} jándor amaŋŋilit\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} jándora árat\",\n        \"one\" : \"{0} jándor árat\"\n      },\n      \"next\" : \"ihttin\",\n      \"previous\" : \"ikte\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : {\n        \"one\" : \"{0} sekunda árat\",\n        \"other\" : \"{0} sekundda árat\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} sekundda maŋŋilit\",\n        \"one\" : \"{0} sekunda maŋŋilit\"\n      }\n    },\n    \"now\" : \"now\",\n    \"month\" : {\n      \"previous\" : \"last month\",\n      \"future\" : \"{0} mánotbadji maŋŋilit\",\n      \"past\" : \"{0} mánotbadji árat\",\n      \"current\" : \"this month\",\n      \"next\" : \"next month\"\n    }\n  },\n  \"short\" : {\n    \"now\" : \"now\",\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"{0} minuhta maŋŋilit\",\n        \"other\" : \"{0} minuhtta maŋŋilit\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} minuhtta árat\",\n        \"one\" : \"{0} minuhta árat\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"last year\",\n      \"current\" : \"this year\",\n      \"next\" : \"next year\",\n      \"past\" : {\n        \"other\" : \"{0} jahkki árat\",\n        \"one\" : \"{0} jahki árat\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} jahki maŋŋilit\",\n        \"other\" : \"{0} jahkki maŋŋilit\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : {\n        \"one\" : \"{0} sekunda maŋŋilit\",\n        \"other\" : \"{0} sekundda maŋŋilit\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} sekunda árat\",\n        \"other\" : \"{0} sekundda árat\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} diibmur árat\",\n        \"one\" : \"{0} diibmu árat\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} diibmur maŋŋilit\",\n        \"one\" : \"{0} diibmu maŋŋilit\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} mánotbadji maŋŋilit\",\n      \"previous\" : \"last month\",\n      \"next\" : \"next month\",\n      \"past\" : \"{0} mánotbadji árat\",\n      \"current\" : \"this month\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"week\" : {\n      \"next\" : \"next week\",\n      \"past\" : {\n        \"other\" : \"{0} vahkku árat\",\n        \"one\" : \"{0} vahku árat\"\n      },\n      \"current\" : \"this week\",\n      \"previous\" : \"last week\",\n      \"future\" : {\n        \"other\" : \"{0} vahkku maŋŋilit\",\n        \"one\" : \"{0} vahku maŋŋilit\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"ihttin\",\n      \"current\" : \"odne\",\n      \"previous\" : \"ikte\",\n      \"past\" : {\n        \"other\" : \"{0} jándora árat\",\n        \"one\" : \"{0} jándor árat\"\n      },\n      \"future\" : {\n        \"two\" : \"{0} jándor amaŋŋilit\",\n        \"other\" : \"{0} jándora maŋŋilit\",\n        \"one\" : \"{0} jándor maŋŋilit\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/se_FI.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"next\" : \"boahtte jagi\",\n      \"past\" : {\n        \"other\" : \"{0} j. dás ovdal\",\n        \"two\" : \"{0} jagi dás ovdal\"\n      },\n      \"future\" : \"{0} jagi siste\",\n      \"previous\" : \"diibmá\",\n      \"current\" : \"dán jagi\"\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"two\" : \"-{0} njealjádasjagi dás ovdal\",\n        \"other\" : \"{0} njealj.j. dás ovdal\"\n      },\n      \"previous\" : \"mannan njealjádasjagi\",\n      \"current\" : \"dán njealjádasjagi\",\n      \"next\" : \"boahtte njealjádasjagi\",\n      \"future\" : {\n        \"other\" : \"boahtte {0} njealj.j.\",\n        \"two\" : \"boahtte {0} njealjádasjagi\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"two\" : \"{0} diimmu áigi\",\n        \"other\" : \"{0} dmu áigi\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} dmu siste\",\n        \"two\" : \"{0} diimmu siste\"\n      },\n      \"current\" : \"dán diimmu\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"two\" : \"{0} sekundda áigi\",\n        \"other\" : \"{0} sek. áigi\"\n      },\n      \"current\" : \"dál\",\n      \"future\" : {\n        \"two\" : \"{0} sekundda siste\",\n        \"other\" : \"{0} sek. siste\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"mannan vahku\",\n      \"past\" : {\n        \"two\" : \"{0} vahku dás ovdal\",\n        \"one\" : \"{0} vahkku dás ovdal\",\n        \"other\" : \"{0} v(k) dás ovdal\"\n      },\n      \"next\" : \"boahtte vahku\",\n      \"future\" : \"{0} v(k) geahčen\",\n      \"current\" : \"dán vahku\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"{0} mánu dás ovdal\",\n        \"one\" : \"{0} mánnu dás ovdal\"\n      },\n      \"current\" : \"dán mánu\",\n      \"future\" : \"{0} mánu geahčen\",\n      \"next\" : \"boahtte mánu\",\n      \"previous\" : \"mannan mánu\"\n    },\n    \"day\" : {\n      \"future\" : \"{0} beaivve siste\",\n      \"current\" : \"odne\",\n      \"past\" : {\n        \"two\" : \"ovddet beaivve\",\n        \"one\" : \"ikte\",\n        \"other\" : \"{0} beaivve dás ovdal\"\n      },\n      \"previous\" : \"ikte\",\n      \"next\" : \"ihttin\"\n    },\n    \"minute\" : {\n      \"current\" : \"dán minuhta\",\n      \"past\" : {\n        \"other\" : \"{0} min. áigi\",\n        \"two\" : \"{0} minuhta áigi\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} min. siste\",\n        \"two\" : \"{0} minuhta siste\"\n      }\n    },\n    \"now\" : \"dál\"\n  },\n  \"long\" : {\n    \"month\" : {\n      \"past\" : {\n        \"one\" : \"{0} mánnu dás ovdal\",\n        \"other\" : \"{0} mánu dás ovdal\"\n      },\n      \"previous\" : \"mannan mánu\",\n      \"future\" : \"{0} mánu siste\",\n      \"next\" : \"boahtte mánu\",\n      \"current\" : \"dán mánu\"\n    },\n    \"now\" : \"dál\",\n    \"year\" : {\n      \"current\" : \"dán jagi\",\n      \"past\" : {\n        \"other\" : \"{0} jagi dás ovdal\",\n        \"one\" : \"diibmá\",\n        \"two\" : \"ovddet jagi\"\n      },\n      \"future\" : \"{0} jagi siste\",\n      \"next\" : \"boahtte jagi\",\n      \"previous\" : \"diibmá\"\n    },\n    \"quarter\" : {\n      \"past\" : \"-{0} njealjádasjagi dás ovdal\",\n      \"future\" : \"čuovvovaš {0} njealjádasjagi\",\n      \"current\" : \"dán njealjádasjagi\",\n      \"next\" : \"boahtte njealjádasjagi\",\n      \"previous\" : \"mannan njealjádasjagi\"\n    },\n    \"minute\" : {\n      \"current\" : \"dán minuhta\",\n      \"past\" : {\n        \"other\" : \"{0} minuhta áigi\",\n        \"one\" : \"{0} minuhtta áigi\"\n      },\n      \"future\" : \"{0} minuhta siste\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} vahku geahčen\",\n      \"previous\" : \"mannan vahku\",\n      \"current\" : \"dán vahku\",\n      \"next\" : \"boahtte vahku\",\n      \"past\" : {\n        \"one\" : \"{0} vahkku dás ovdal\",\n        \"other\" : \"{0} vahku dás ovdal\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"{0} sekundda siste\",\n      \"current\" : \"dál\",\n      \"past\" : {\n        \"one\" : \"{0} sekunda áigi\",\n        \"other\" : \"{0} sekundda áigi\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : \"{0} diimmu siste\",\n      \"current\" : \"dán diimmu\",\n      \"past\" : {\n        \"other\" : \"{0} diimmu áigi\",\n        \"one\" : \"{0} diibmu áigi\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"ihttin\",\n      \"past\" : {\n        \"other\" : \"{0} beaivve dás ovdal\",\n        \"two\" : \"ovddet beaivve\",\n        \"one\" : \"ikte\"\n      },\n      \"future\" : \"{0} beaivve siste\",\n      \"previous\" : \"ikte\",\n      \"current\" : \"odne\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"current\" : \"dán diimmu\",\n      \"past\" : {\n        \"other\" : \"{0} dmu áigi\",\n        \"two\" : \"{0} diimmu áigi\"\n      },\n      \"future\" : {\n        \"two\" : \"{0} diimmu siste\",\n        \"other\" : \"{0} dmu siste\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"two\" : \"{0} sekundda siste\",\n        \"other\" : \"{0} sek. siste\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} sek. áigi\",\n        \"two\" : \"{0} sekundda áigi\"\n      },\n      \"current\" : \"dál\"\n    },\n    \"now\" : \"dál\",\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"diibmá\",\n        \"two\" : \"ovddet jagi\",\n        \"other\" : \"{0} j. dás ovdal\"\n      },\n      \"future\" : {\n        \"two\" : \"{0} jagi siste\",\n        \"other\" : \"{0} j. siste\"\n      },\n      \"previous\" : \"diibmá\",\n      \"current\" : \"dán jagi\",\n      \"next\" : \"boahtte jagi\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"mannan njealjádasjagi\",\n      \"future\" : {\n        \"other\" : \"boahtte {0} njealj.j.\",\n        \"two\" : \"boahtte {0} njealjádasjagi\"\n      },\n      \"next\" : \"boahtte njealjádasjagi\",\n      \"past\" : {\n        \"two\" : \"{0} njealjádasjagi dás ovdal\",\n        \"other\" : \"{0} njealj.j. dás ovdal\"\n      },\n      \"current\" : \"dán njealjádasjagi\"\n    },\n    \"week\" : {\n      \"previous\" : \"mannan vahku\",\n      \"current\" : \"dán vahku\",\n      \"next\" : \"boahtte vahku\",\n      \"past\" : {\n        \"two\" : \"{0} vahku dás ovdal\",\n        \"other\" : \"{0} v(k) dás ovdal\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} v(k) siste\",\n        \"two\" : \"{0} vahku siste\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"ihttin\",\n      \"past\" : {\n        \"one\" : \"ikte\",\n        \"other\" : \"{0} beaivve dás ovdal\",\n        \"two\" : \"ovddet beaivve\"\n      },\n      \"previous\" : \"ikte\",\n      \"future\" : \"{0} beaivve siste\",\n      \"current\" : \"odne\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"two\" : \"{0} minuhta áigi\",\n        \"other\" : \"{0} min. áigi\"\n      },\n      \"future\" : {\n        \"two\" : \"{0} minuhta siste\",\n        \"other\" : \"{0} min. siste\"\n      },\n      \"current\" : \"dán minuhta\"\n    },\n    \"month\" : {\n      \"next\" : \"boahtte mánu\",\n      \"past\" : {\n        \"other\" : \"{0} mánu dás ovdal\",\n        \"one\" : \"{0} mánnu dás ovdal\"\n      },\n      \"future\" : \"{0} mánu siste\",\n      \"previous\" : \"mannan mánu\",\n      \"current\" : \"dán mánu\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/si.json",
    "content": "{\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"පැය {0}කින්\",\n      \"past\" : \"පැය {0}කට පෙර\",\n      \"current\" : \"මෙම පැය\"\n    },\n    \"second\" : {\n      \"past\" : \"තත්පර {0}කට පෙර\",\n      \"future\" : \"තත්පර {0}කින්\",\n      \"current\" : \"දැන්\"\n    },\n    \"week\" : {\n      \"next\" : \"ඊළඟ සතිය\",\n      \"current\" : \"මෙම සතිය\",\n      \"previous\" : \"පසුගිය සතිය\",\n      \"future\" : \"සති {0}කින්\",\n      \"past\" : \"සති {0}කට පෙර\"\n    },\n    \"minute\" : {\n      \"current\" : \"මෙම මිනිත්තුව\",\n      \"past\" : \"මිනිත්තු {0}කට පෙර\",\n      \"future\" : \"මිනිත්තු {0}කින්\"\n    },\n    \"year\" : {\n      \"current\" : \"මෙම වසර\",\n      \"past\" : \"වසර {0}කට පෙර\",\n      \"future\" : \"වසර {0}කින්\",\n      \"previous\" : \"පසුගිය වසර\",\n      \"next\" : \"ඊළඟ වසර\"\n    },\n    \"quarter\" : {\n      \"next\" : \"ඊළඟ කාර්තුව\",\n      \"current\" : \"මෙම කාර්තුව\",\n      \"future\" : \"කාර්තු {0}කින්\",\n      \"previous\" : \"පසුගිය කාර්තුව\",\n      \"past\" : \"කාර්තු {0}කට පෙර\"\n    },\n    \"month\" : {\n      \"previous\" : \"පසුගිය මාසය\",\n      \"future\" : \"මාස {0}කින්\",\n      \"current\" : \"මෙම මාසය\",\n      \"next\" : \"ඊළඟ මාසය\",\n      \"past\" : \"මාස {0}කට පෙර\"\n    },\n    \"day\" : {\n      \"next\" : \"හෙට\",\n      \"past\" : \"දින {0}කට පෙර\",\n      \"current\" : \"අද\",\n      \"future\" : \"දින {0}න්\",\n      \"previous\" : \"ඊයේ\"\n    },\n    \"now\" : \"දැන්\"\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"current\" : \"මෙම සති.\",\n      \"next\" : \"ඊළඟ සති.\",\n      \"past\" : \"සති {0}කට පෙර\",\n      \"previous\" : \"පසුගිය සති.\",\n      \"future\" : \"සති {0}කින්\"\n    },\n    \"minute\" : {\n      \"current\" : \"මෙම මිනිත්තුව\",\n      \"future\" : \"මිනිත්තු {0}කින්\",\n      \"past\" : \"මිනිත්තු {0}කට පෙර\"\n    },\n    \"month\" : {\n      \"current\" : \"මෙම මාස.\",\n      \"previous\" : \"පසුගිය මාස.\",\n      \"past\" : \"මාස {0}කට පෙර\",\n      \"next\" : \"ඊළඟ මාස.\",\n      \"future\" : \"මාස {0}කින්\"\n    },\n    \"now\" : \"දැන්\",\n    \"year\" : {\n      \"current\" : \"මෙම වසර\",\n      \"next\" : \"ඊළඟ වසර\",\n      \"past\" : \"වසර {0}කට පෙර\",\n      \"future\" : \"වසර {0}කින්\",\n      \"previous\" : \"පසුගිය වසර\"\n    },\n    \"hour\" : {\n      \"future\" : \"පැය {0}කින්\",\n      \"past\" : \"පැය {0}කට පෙර\",\n      \"current\" : \"මෙම පැය\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"පසුගිය කාර්.\",\n      \"current\" : \"මෙම කාර්.\",\n      \"past\" : \"කාර්. {0}කට පෙර\",\n      \"future\" : \"කාර්. {0}කින්\",\n      \"next\" : \"ඊළඟ කාර්.\"\n    },\n    \"second\" : {\n      \"current\" : \"දැන්\",\n      \"past\" : \"තත්පර {0}කට පෙර\",\n      \"future\" : \"තත්පර {0}කින්\"\n    },\n    \"day\" : {\n      \"past\" : \"දින {0}කට පෙර\",\n      \"current\" : \"අද\",\n      \"future\" : \"දින {0}න්\",\n      \"previous\" : \"ඊයේ\",\n      \"next\" : \"හෙට\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"previous\" : \"පසුගිය මාස.\",\n      \"current\" : \"මෙම මාස.\",\n      \"next\" : \"ඊළඟ මාස.\",\n      \"past\" : \"මාස {0}කට පෙර\",\n      \"future\" : \"මාස {0}කින්\"\n    },\n    \"now\" : \"දැන්\",\n    \"day\" : {\n      \"next\" : \"හෙට\",\n      \"current\" : \"අද\",\n      \"previous\" : \"ඊයේ\",\n      \"past\" : \"දින {0}කට පෙර\",\n      \"future\" : \"දින {0}න්\"\n    },\n    \"year\" : {\n      \"current\" : \"මෙම වසර\",\n      \"future\" : \"වසර {0}කින්\",\n      \"previous\" : \"පසුගිය වසර\",\n      \"next\" : \"ඊළඟ වසර\",\n      \"past\" : \"වසර {0}කට පෙර\"\n    },\n    \"hour\" : {\n      \"past\" : \"පැය {0}කට පෙර\",\n      \"current\" : \"මෙම පැය\",\n      \"future\" : \"පැය {0}කින්\"\n    },\n    \"minute\" : {\n      \"past\" : \"මිනිත්තු {0}කට පෙර\",\n      \"future\" : \"මිනිත්තු {0}කින්\",\n      \"current\" : \"මෙම මිනිත්තුව\"\n    },\n    \"second\" : {\n      \"future\" : \"තත්පර {0}කින්\",\n      \"current\" : \"දැන්\",\n      \"past\" : \"තත්පර {0}කට පෙර\"\n    },\n    \"quarter\" : {\n      \"future\" : \"කාර්. {0}කින්\",\n      \"previous\" : \"පසුගිය කාර්.\",\n      \"next\" : \"ඊළඟ කාර්.\",\n      \"past\" : \"කාර්. {0}කට පෙර\",\n      \"current\" : \"මෙම කාර්.\"\n    },\n    \"week\" : {\n      \"next\" : \"ඊළඟ සති.\",\n      \"past\" : \"සති {0}කට පෙර\",\n      \"current\" : \"මෙම සති.\",\n      \"previous\" : \"පසුගිය සති.\",\n      \"future\" : \"සති {0}කින්\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sk.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"current\" : \"tento štvrťr.\",\n      \"past\" : \"pred {0} štvrťr.\",\n      \"next\" : \"budúci štvrťr.\",\n      \"future\" : \"o {0} štvrťr.\",\n      \"previous\" : \"minulý štvrťr.\"\n    },\n    \"day\" : {\n      \"next\" : \"zajtra\",\n      \"previous\" : \"včera\",\n      \"future\" : \"o {0} d.\",\n      \"past\" : \"pred {0} d.\",\n      \"current\" : \"dnes\"\n    },\n    \"year\" : {\n      \"past\" : \"pred {0} r.\",\n      \"previous\" : \"minulý rok\",\n      \"future\" : \"o {0} r.\",\n      \"next\" : \"budúci rok\",\n      \"current\" : \"tento rok\"\n    },\n    \"minute\" : {\n      \"past\" : \"pred {0} min\",\n      \"current\" : \"v tejto minúte\",\n      \"future\" : \"o {0} min\"\n    },\n    \"now\" : \"teraz\",\n    \"week\" : {\n      \"current\" : \"tento týž.\",\n      \"previous\" : \"minulý týž.\",\n      \"past\" : \"pred {0} týž.\",\n      \"next\" : \"budúci týž.\",\n      \"future\" : \"o {0} týž.\"\n    },\n    \"second\" : {\n      \"future\" : \"o {0} s\",\n      \"current\" : \"teraz\",\n      \"past\" : \"pred {0} s\"\n    },\n    \"month\" : {\n      \"future\" : \"o {0} mes.\",\n      \"current\" : \"tento mes.\",\n      \"past\" : \"pred {0} mes.\",\n      \"previous\" : \"minulý mes.\",\n      \"next\" : \"budúci mes.\"\n    },\n    \"hour\" : {\n      \"future\" : \"o {0} h\",\n      \"past\" : \"pred {0} h\",\n      \"current\" : \"v tejto hodine\"\n    }\n  },\n  \"long\" : {\n    \"now\" : \"teraz\",\n    \"week\" : {\n      \"current\" : \"tento týždeň\",\n      \"past\" : {\n        \"other\" : \"pred {0} týždňami\",\n        \"one\" : \"pred {0} týždňom\"\n      },\n      \"previous\" : \"minulý týždeň\",\n      \"future\" : {\n        \"one\" : \"o {0} týždeň\",\n        \"few\" : \"o {0} týždne\",\n        \"other\" : \"o {0} týždňov\"\n      },\n      \"next\" : \"budúci týždeň\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"pred {0} hodinou\",\n        \"other\" : \"pred {0} hodinami\"\n      },\n      \"future\" : {\n        \"one\" : \"o {0} hodinu\",\n        \"few\" : \"o {0} hodiny\",\n        \"other\" : \"o {0} hodín\"\n      },\n      \"current\" : \"v tejto hodine\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"minulý štvrťrok\",\n      \"future\" : {\n        \"other\" : \"o {0} štvrťrokov\",\n        \"few\" : \"o {0} štvrťroky\",\n        \"one\" : \"o {0} štvrťrok\"\n      },\n      \"past\" : {\n        \"one\" : \"pred {0} štvrťrokom\",\n        \"other\" : \"pred {0} štvrťrokmi\"\n      },\n      \"current\" : \"tento štvrťrok\",\n      \"next\" : \"budúci štvrťrok\"\n    },\n    \"minute\" : {\n      \"current\" : \"v tejto minúte\",\n      \"future\" : {\n        \"one\" : \"o {0} minútu\",\n        \"other\" : \"o {0} minút\",\n        \"few\" : \"o {0} minúty\"\n      },\n      \"past\" : {\n        \"other\" : \"pred {0} minútami\",\n        \"one\" : \"pred {0} minútou\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"pred {0} rokmi\",\n        \"one\" : \"pred {0} rokom\"\n      },\n      \"future\" : {\n        \"few\" : \"o {0} roky\",\n        \"one\" : \"o {0} rok\",\n        \"other\" : \"o {0} rokov\"\n      },\n      \"current\" : \"tento rok\",\n      \"next\" : \"budúci rok\",\n      \"previous\" : \"minulý rok\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"many\" : \"o {0} mesiacov\",\n        \"one\" : \"o {0} mesiac\",\n        \"few\" : \"o {0} mesiace\",\n        \"other\" : \"o {0} mesiacov\"\n      },\n      \"current\" : \"tento mesiac\",\n      \"previous\" : \"minulý mesiac\",\n      \"next\" : \"budúci mesiac\",\n      \"past\" : {\n        \"many\" : \"pred {0} mesiacmi\",\n        \"other\" : \"pred {0} mesiacmi\",\n        \"one\" : \"pred {0} mesiacom\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"teraz\",\n      \"past\" : {\n        \"one\" : \"pred {0} sekundou\",\n        \"other\" : \"pred {0} sekundami\"\n      },\n      \"future\" : {\n        \"few\" : \"o {0} sekundy\",\n        \"one\" : \"o {0} sekundu\",\n        \"other\" : \"o {0} sekúnd\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"včera\",\n      \"next\" : \"zajtra\",\n      \"past\" : {\n        \"one\" : \"pred {0} dňom\",\n        \"other\" : \"pred {0} dňami\"\n      },\n      \"current\" : \"dnes\",\n      \"future\" : {\n        \"one\" : \"o {0} deň\",\n        \"few\" : \"o {0} dni\",\n        \"other\" : \"o {0} dní\"\n      }\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"o {0} min\",\n      \"current\" : \"v tejto minúte\",\n      \"past\" : \"pred {0} min\"\n    },\n    \"week\" : {\n      \"future\" : \"o {0} týž.\",\n      \"previous\" : \"minulý týž.\",\n      \"next\" : \"budúci týž.\",\n      \"current\" : \"tento týž.\",\n      \"past\" : \"pred {0} týž.\"\n    },\n    \"year\" : {\n      \"current\" : \"tento rok\",\n      \"previous\" : \"minulý rok\",\n      \"future\" : \"o {0} r.\",\n      \"past\" : \"pred {0} r.\",\n      \"next\" : \"budúci rok\"\n    },\n    \"month\" : {\n      \"next\" : \"budúci mes.\",\n      \"past\" : \"pred {0} mes.\",\n      \"future\" : \"o {0} mes.\",\n      \"previous\" : \"minulý mes.\",\n      \"current\" : \"tento mes.\"\n    },\n    \"quarter\" : {\n      \"next\" : \"budúci štvrťr.\",\n      \"past\" : \"pred {0} štvrťr.\",\n      \"previous\" : \"minulý štvrťr.\",\n      \"current\" : \"tento štvrťr.\",\n      \"future\" : \"o {0} štvrťr.\"\n    },\n    \"day\" : {\n      \"current\" : \"dnes\",\n      \"previous\" : \"včera\",\n      \"past\" : \"pred {0} d.\",\n      \"next\" : \"zajtra\",\n      \"future\" : \"o {0} d.\"\n    },\n    \"hour\" : {\n      \"past\" : \"pred {0} h\",\n      \"current\" : \"v tejto hodine\",\n      \"future\" : \"o {0} h\"\n    },\n    \"second\" : {\n      \"past\" : \"pred {0} s\",\n      \"current\" : \"teraz\",\n      \"future\" : \"o {0} s\"\n    },\n    \"now\" : \"teraz\"\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sl.json",
    "content": "{\n  \"long\" : {\n    \"day\" : {\n      \"next\" : \"jutri\",\n      \"past\" : {\n        \"other\" : \"pred {0} dnevi\",\n        \"one\" : \"pred {0} dnevom\",\n        \"two\" : \"pred {0} dnevoma\"\n      },\n      \"future\" : {\n        \"two\" : \"čez {0} dneva\",\n        \"one\" : \"čez {0} dan\",\n        \"other\" : \"čez {0} dni\"\n      },\n      \"previous\" : \"včeraj\",\n      \"current\" : \"danes\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"few\" : \"čez {0} mesece\",\n        \"other\" : \"čez {0} mesecev\",\n        \"two\" : \"čez {0} meseca\",\n        \"one\" : \"čez {0} mesec\"\n      },\n      \"next\" : \"naslednji mesec\",\n      \"current\" : \"ta mesec\",\n      \"past\" : {\n        \"other\" : \"pred {0} meseci\",\n        \"two\" : \"pred {0} mesecema\",\n        \"one\" : \"pred {0} mesecem\"\n      },\n      \"previous\" : \"prejšnji mesec\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"two\" : \"pred {0} sekundama\",\n        \"other\" : \"pred {0} sekundami\",\n        \"one\" : \"pred {0} sekundo\"\n      },\n      \"current\" : \"zdaj\",\n      \"future\" : {\n        \"other\" : \"čez {0} sekund\",\n        \"one\" : \"čez {0} sekundo\",\n        \"few\" : \"čez {0} sekunde\",\n        \"two\" : \"čez {0} sekundi\"\n      }\n    },\n    \"now\" : \"zdaj\",\n    \"hour\" : {\n      \"past\" : {\n        \"two\" : \"pred {0} urama\",\n        \"other\" : \"pred {0} urami\",\n        \"one\" : \"pred {0} uro\"\n      },\n      \"current\" : \"v tej uri\",\n      \"future\" : {\n        \"few\" : \"čez {0} ure\",\n        \"one\" : \"čez {0} uro\",\n        \"other\" : \"čez {0} ur\",\n        \"two\" : \"čez {0} uri\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"two\" : \"pred {0} minutama\",\n        \"one\" : \"pred {0} minuto\",\n        \"other\" : \"pred {0} minutami\"\n      },\n      \"current\" : \"to minuto\",\n      \"future\" : {\n        \"two\" : \"čez {0} minuti\",\n        \"one\" : \"čez {0} minuto\",\n        \"few\" : \"čez {0} minute\",\n        \"other\" : \"čez {0} minut\"\n      }\n    },\n    \"week\" : {\n      \"past\" : {\n        \"other\" : \"pred {0} tedni\",\n        \"one\" : \"pred {0} tednom\",\n        \"two\" : \"pred {0} tednoma\"\n      },\n      \"next\" : \"naslednji teden\",\n      \"previous\" : \"prejšnji teden\",\n      \"current\" : \"ta teden\",\n      \"future\" : {\n        \"one\" : \"čez {0} teden\",\n        \"two\" : \"čez {0} tedna\",\n        \"few\" : \"čez {0} tedne\",\n        \"other\" : \"čez {0} tednov\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"lani\",\n      \"future\" : {\n        \"two\" : \"čez {0} leti\",\n        \"other\" : \"čez {0} let\",\n        \"one\" : \"čez {0} leto\",\n        \"few\" : \"čez {0} leta\"\n      },\n      \"past\" : {\n        \"one\" : \"pred {0} letom\",\n        \"other\" : \"pred {0} leti\",\n        \"two\" : \"pred {0} letoma\"\n      },\n      \"current\" : \"letos\",\n      \"next\" : \"naslednje leto\"\n    },\n    \"quarter\" : {\n      \"current\" : \"to četrtletje\",\n      \"previous\" : \"zadnje četrtletje\",\n      \"future\" : {\n        \"few\" : \"čez {0} četrtletja\",\n        \"one\" : \"čez {0} četrtletje\",\n        \"other\" : \"čez {0} četrtletij\",\n        \"two\" : \"čez {0} četrtletji\"\n      },\n      \"next\" : \"naslednje četrtletje\",\n      \"past\" : {\n        \"one\" : \"pred {0} četrtletjem\",\n        \"two\" : \"pred {0} četrtletjema\",\n        \"other\" : \"pred {0} četrtletji\"\n      }\n    }\n  },\n  \"narrow\" : {\n    \"quarter\" : {\n      \"next\" : \"naslednje četrtletje\",\n      \"past\" : \"pred {0} četr.\",\n      \"future\" : \"čez {0} četr.\",\n      \"previous\" : \"zadnje četrtletje\",\n      \"current\" : \"to četrtletje\"\n    },\n    \"hour\" : {\n      \"past\" : \"pred {0} h\",\n      \"future\" : \"čez {0} h\",\n      \"current\" : \"v tej uri\"\n    },\n    \"day\" : {\n      \"previous\" : \"včeraj\",\n      \"past\" : {\n        \"two\" : \"pred {0} dnevoma\",\n        \"other\" : \"pred {0} dnevi\",\n        \"one\" : \"pred {0} dnevom\"\n      },\n      \"future\" : {\n        \"one\" : \"čez {0} dan\",\n        \"two\" : \"čez {0} dneva\",\n        \"other\" : \"čez {0} dni\"\n      },\n      \"next\" : \"jutri\",\n      \"current\" : \"danes\"\n    },\n    \"year\" : {\n      \"current\" : \"letos\",\n      \"future\" : {\n        \"few\" : \"čez {0} leta\",\n        \"one\" : \"čez {0} leto\",\n        \"two\" : \"čez {0} leti\",\n        \"other\" : \"čez {0} let\"\n      },\n      \"next\" : \"naslednje leto\",\n      \"previous\" : \"lani\",\n      \"past\" : {\n        \"other\" : \"pred {0} leti\",\n        \"one\" : \"pred {0} letom\",\n        \"two\" : \"pred {0} letoma\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"naslednji teden\",\n      \"future\" : \"čez {0} ted.\",\n      \"past\" : \"pred {0} ted.\",\n      \"previous\" : \"prejšnji teden\",\n      \"current\" : \"ta teden\"\n    },\n    \"minute\" : {\n      \"current\" : \"to minuto\",\n      \"past\" : \"pred {0} min\",\n      \"future\" : \"čez {0} min\"\n    },\n    \"month\" : {\n      \"next\" : \"naslednji mesec\",\n      \"current\" : \"ta mesec\",\n      \"previous\" : \"prejšnji mesec\",\n      \"past\" : \"pred {0} mes.\",\n      \"future\" : \"čez {0} mes.\"\n    },\n    \"second\" : {\n      \"current\" : \"zdaj\",\n      \"future\" : \"čez {0} s\",\n      \"past\" : \"pred {0} s\"\n    },\n    \"now\" : \"zdaj\"\n  },\n  \"short\" : {\n    \"week\" : {\n      \"previous\" : \"prejšnji teden\",\n      \"current\" : \"ta teden\",\n      \"next\" : \"naslednji teden\",\n      \"past\" : \"pred {0} ted.\",\n      \"future\" : \"čez {0} ted.\"\n    },\n    \"minute\" : {\n      \"past\" : \"pred {0} min.\",\n      \"current\" : \"to minuto\",\n      \"future\" : \"čez {0} min.\"\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"pred {0} dnevom\",\n        \"two\" : \"pred {0} dnevoma\",\n        \"other\" : \"pred {0} dnevi\"\n      },\n      \"next\" : \"jutri\",\n      \"previous\" : \"včeraj\",\n      \"current\" : \"danes\",\n      \"future\" : {\n        \"other\" : \"čez {0} dni\",\n        \"one\" : \"čez {0} dan\",\n        \"two\" : \"čez {0} dneva\"\n      }\n    },\n    \"now\" : \"zdaj\",\n    \"second\" : {\n      \"past\" : \"pred {0} s\",\n      \"current\" : \"zdaj\",\n      \"future\" : \"čez {0} s\"\n    },\n    \"hour\" : {\n      \"current\" : \"v tej uri\",\n      \"past\" : {\n        \"other\" : \"pred {0} urami\",\n        \"two\" : \"pred {0} urama\",\n        \"one\" : \"pred {0} uro\"\n      },\n      \"future\" : {\n        \"two\" : \"čez {0} uri\",\n        \"other\" : \"čez {0} ur\",\n        \"few\" : \"čez {0} ure\",\n        \"one\" : \"čez {0} uro\"\n      }\n    },\n    \"month\" : {\n      \"future\" : \"čez {0} mes.\",\n      \"next\" : \"naslednji mesec\",\n      \"current\" : \"ta mesec\",\n      \"past\" : \"pred {0} mes.\",\n      \"previous\" : \"prejšnji mesec\"\n    },\n    \"year\" : {\n      \"previous\" : \"lani\",\n      \"current\" : \"letos\",\n      \"past\" : {\n        \"one\" : \"pred {0} letom\",\n        \"two\" : \"pred {0} letoma\",\n        \"other\" : \"pred {0} leti\"\n      },\n      \"next\" : \"naslednje leto\",\n      \"future\" : {\n        \"few\" : \"čez {0} leta\",\n        \"two\" : \"čez {0} leti\",\n        \"other\" : \"čez {0} let\",\n        \"one\" : \"čez {0} leto\"\n      }\n    },\n    \"quarter\" : {\n      \"past\" : \"pred {0} četrtl.\",\n      \"future\" : \"čez {0} četrtl.\",\n      \"next\" : \"naslednje četrtletje\",\n      \"previous\" : \"zadnje četrtletje\",\n      \"current\" : \"to četrtletje\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sq.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"current\" : \"këtë tremujor\",\n      \"previous\" : \"tremujorin e kaluar\",\n      \"past\" : {\n        \"other\" : \"{0} tremujorë më parë\",\n        \"one\" : \"{0} tremujor më parë\"\n      },\n      \"future\" : {\n        \"one\" : \"pas {0} tremujori\",\n        \"other\" : \"pas {0} tremujorësh\"\n      },\n      \"next\" : \"tremujorin e ardhshëm\"\n    },\n    \"now\" : \"tani\",\n    \"minute\" : {\n      \"past\" : \"{0} min. më parë\",\n      \"future\" : \"pas {0} min.\",\n      \"current\" : \"këtë minutë\"\n    },\n    \"month\" : {\n      \"future\" : {\n        \"other\" : \"pas {0} muajsh\",\n        \"one\" : \"pas {0} muaji\"\n      },\n      \"previous\" : \"muajin e kaluar\",\n      \"next\" : \"muajin e ardhshëm\",\n      \"current\" : \"këtë muaj\",\n      \"past\" : \"{0} muaj më parë\"\n    },\n    \"second\" : {\n      \"future\" : \"pas {0} sek.\",\n      \"current\" : \"tani\",\n      \"past\" : \"{0} sek. më parë\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} javë më parë\",\n      \"future\" : {\n        \"one\" : \"pas {0} jave\",\n        \"other\" : \"pas {0} javësh\"\n      },\n      \"previous\" : \"javën e kaluar\",\n      \"current\" : \"këtë javë\",\n      \"next\" : \"javën e ardhshme\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} orë më parë\",\n      \"future\" : {\n        \"one\" : \"pas {0} ore\",\n        \"other\" : \"pas {0} orësh\"\n      },\n      \"current\" : \"këtë orë\"\n    },\n    \"day\" : {\n      \"previous\" : \"dje\",\n      \"past\" : \"{0} ditë më parë\",\n      \"current\" : \"sot\",\n      \"future\" : {\n        \"other\" : \"pas {0} ditësh\",\n        \"one\" : \"pas {0} dite\"\n      },\n      \"next\" : \"nesër\"\n    },\n    \"year\" : {\n      \"next\" : \"vitin e ardhshëm\",\n      \"past\" : {\n        \"other\" : \"{0} vjet më parë\",\n        \"one\" : \"{0} vit më parë\"\n      },\n      \"previous\" : \"vitin e kaluar\",\n      \"current\" : \"këtë vit\",\n      \"future\" : {\n        \"one\" : \"pas {0} viti\",\n        \"other\" : \"pas {0} vjetësh\"\n      }\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"current\" : \"sot\",\n      \"past\" : \"{0} ditë më parë\",\n      \"previous\" : \"dje\",\n      \"next\" : \"nesër\",\n      \"future\" : {\n        \"one\" : \"pas {0} dite\",\n        \"other\" : \"pas {0} ditësh\"\n      }\n    },\n    \"now\" : \"tani\",\n    \"quarter\" : {\n      \"current\" : \"këtë tremujor\",\n      \"past\" : {\n        \"one\" : \"{0} tremujor më parë\",\n        \"other\" : \"{0} tremujorë më parë\"\n      },\n      \"future\" : {\n        \"one\" : \"pas {0} tremujori\",\n        \"other\" : \"pas {0} tremujorësh\"\n      },\n      \"next\" : \"tremujorin e ardhshëm\",\n      \"previous\" : \"tremujorin e kaluar\"\n    },\n    \"year\" : {\n      \"current\" : \"këtë vit\",\n      \"past\" : {\n        \"other\" : \"{0} vjet më parë\",\n        \"one\" : \"{0} vit më parë\"\n      },\n      \"previous\" : \"vitin e kaluar\",\n      \"future\" : {\n        \"other\" : \"pas {0} vjetësh\",\n        \"one\" : \"pas {0} viti\"\n      },\n      \"next\" : \"vitin e ardhshëm\"\n    },\n    \"week\" : {\n      \"current\" : \"këtë javë\",\n      \"next\" : \"javën e ardhshme\",\n      \"past\" : \"{0} javë më parë\",\n      \"future\" : {\n        \"other\" : \"pas {0} javësh\",\n        \"one\" : \"pas {0} jave\"\n      },\n      \"previous\" : \"javën e kaluar\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} orë më parë\",\n      \"future\" : {\n        \"one\" : \"pas {0} ore\",\n        \"other\" : \"pas {0} orësh\"\n      },\n      \"current\" : \"këtë orë\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"pas {0} sekonde\",\n        \"other\" : \"pas {0} sekondash\"\n      },\n      \"current\" : \"tani\",\n      \"past\" : {\n        \"one\" : \"{0} sekondë më parë\",\n        \"other\" : \"{0} sekonda më parë\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"{0} minuta më parë\",\n        \"one\" : \"{0} minutë më parë\"\n      },\n      \"current\" : \"këtë minutë\",\n      \"future\" : {\n        \"one\" : \"pas {0} minute\",\n        \"other\" : \"pas {0} minutash\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"{0} muaj më parë\",\n      \"next\" : \"muajin e ardhshëm\",\n      \"future\" : {\n        \"one\" : \"pas {0} muaji\",\n        \"other\" : \"pas {0} muajsh\"\n      },\n      \"current\" : \"këtë muaj\",\n      \"previous\" : \"muajin e kaluar\"\n    }\n  },\n  \"short\" : {\n    \"week\" : {\n      \"previous\" : \"javën e kaluar\",\n      \"next\" : \"javën e ardhshme\",\n      \"future\" : {\n        \"other\" : \"pas {0} javësh\",\n        \"one\" : \"pas {0} jave\"\n      },\n      \"current\" : \"këtë javë\",\n      \"past\" : \"{0} javë më parë\"\n    },\n    \"day\" : {\n      \"current\" : \"sot\",\n      \"previous\" : \"dje\",\n      \"next\" : \"nesër\",\n      \"past\" : \"{0} ditë më parë\",\n      \"future\" : {\n        \"other\" : \"pas {0} ditësh\",\n        \"one\" : \"pas {0} dite\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"pas {0} sek.\",\n      \"past\" : \"{0} sek. më parë\",\n      \"current\" : \"tani\"\n    },\n    \"year\" : {\n      \"previous\" : \"vitin e kaluar\",\n      \"next\" : \"vitin e ardhshëm\",\n      \"current\" : \"këtë vit\",\n      \"future\" : {\n        \"one\" : \"pas {0} viti\",\n        \"other\" : \"pas {0} vjetësh\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} vjet më parë\",\n        \"one\" : \"{0} vit më parë\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"këtë orë\",\n      \"past\" : \"{0} orë më parë\",\n      \"future\" : {\n        \"one\" : \"pas {0} ore\",\n        \"other\" : \"pas {0} orësh\"\n      }\n    },\n    \"now\" : \"tani\",\n    \"quarter\" : {\n      \"future\" : {\n        \"other\" : \"pas {0} tremujorësh\",\n        \"one\" : \"pas {0} tremujori\"\n      },\n      \"previous\" : \"tremujorin e kaluar\",\n      \"current\" : \"këtë tremujor\",\n      \"next\" : \"tremujorin e ardhshëm\",\n      \"past\" : {\n        \"one\" : \"{0} tremujor më parë\",\n        \"other\" : \"{0} tremujorë më parë\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"këtë minutë\",\n      \"past\" : \"{0} min. më parë\",\n      \"future\" : \"pas {0} min.\"\n    },\n    \"month\" : {\n      \"previous\" : \"muajin e kaluar\",\n      \"current\" : \"këtë muaj\",\n      \"next\" : \"muajin e ardhshëm\",\n      \"past\" : \"{0} muaj më parë\",\n      \"future\" : {\n        \"one\" : \"pas {0} muaji\",\n        \"other\" : \"pas {0} muajsh\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sr.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"za {0} g.\",\n      \"previous\" : \"prošle g.\",\n      \"next\" : \"sledeće g.\",\n      \"current\" : \"ove g.\",\n      \"past\" : \"pre {0} g.\"\n    },\n    \"week\" : {\n      \"past\" : \"pre {0} n.\",\n      \"previous\" : \"prošle n.\",\n      \"future\" : \"za {0} n.\",\n      \"current\" : \"ove n.\",\n      \"next\" : \"sledeće n.\"\n    },\n    \"hour\" : {\n      \"future\" : \"za {0} č.\",\n      \"current\" : \"ovog sata\",\n      \"past\" : \"pre {0} č.\"\n    },\n    \"quarter\" : {\n      \"current\" : \"ovog kvartala\",\n      \"previous\" : \"prošlog kvartala\",\n      \"future\" : \"za {0} kv.\",\n      \"past\" : \"pre {0} kv.\",\n      \"next\" : \"sledećeg kvartala\"\n    },\n    \"second\" : {\n      \"past\" : \"pre {0} s.\",\n      \"future\" : \"za {0} s.\",\n      \"current\" : \"sada\"\n    },\n    \"month\" : {\n      \"current\" : \"ovog m.\",\n      \"future\" : \"za {0} m.\",\n      \"past\" : \"pre {0} m.\",\n      \"next\" : \"sledećeg m.\",\n      \"previous\" : \"prošlog m.\"\n    },\n    \"day\" : {\n      \"previous\" : \"juče\",\n      \"future\" : \"za {0} d.\",\n      \"next\" : \"sutra\",\n      \"current\" : \"danas\",\n      \"past\" : \"pre {0} d.\"\n    },\n    \"minute\" : {\n      \"future\" : \"za {0} min.\",\n      \"current\" : \"ovog minuta\",\n      \"past\" : \"pre {0} min.\"\n    },\n    \"now\" : \"sada\"\n  },\n  \"long\" : {\n    \"now\" : \"sada\",\n    \"week\" : {\n      \"previous\" : \"prošle nedelje\",\n      \"current\" : \"ove nedelje\",\n      \"future\" : {\n        \"one\" : \"za {0} nedelju\",\n        \"few\" : \"za {0} nedelje\",\n        \"other\" : \"za {0} nedelja\"\n      },\n      \"next\" : \"sledeće nedelje\",\n      \"past\" : {\n        \"other\" : \"pre {0} nedelja\",\n        \"few\" : \"pre {0} nedelje\",\n        \"one\" : \"pre {0} nedelje\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"ovog kvartala\",\n      \"previous\" : \"prošlog kvartala\",\n      \"past\" : \"pre {0} kvartala\",\n      \"next\" : \"sledećeg kvartala\",\n      \"future\" : {\n        \"other\" : \"za {0} kvartala\",\n        \"one\" : \"za {0} kvartal\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"ovog meseca\",\n      \"future\" : {\n        \"one\" : \"za {0} mesec\",\n        \"few\" : \"za {0} meseca\",\n        \"other\" : \"za {0} meseci\"\n      },\n      \"past\" : {\n        \"one\" : \"pre {0} meseca\",\n        \"other\" : \"pre {0} meseci\",\n        \"few\" : \"pre {0} meseca\"\n      },\n      \"previous\" : \"prošlog meseca\",\n      \"next\" : \"sledećeg meseca\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"za {0} dana\",\n        \"one\" : \"za {0} dan\"\n      },\n      \"previous\" : \"juče\",\n      \"current\" : \"danas\",\n      \"next\" : \"sutra\",\n      \"past\" : \"pre {0} dana\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"za {0} sat\",\n        \"few\" : \"za {0} sata\",\n        \"other\" : \"za {0} sati\"\n      },\n      \"current\" : \"ovog sata\",\n      \"past\" : {\n        \"one\" : \"pre {0} sata\",\n        \"few\" : \"pre {0} sata\",\n        \"other\" : \"pre {0} sati\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : \"pre {0} minuta\",\n      \"current\" : \"ovog minuta\",\n      \"future\" : {\n        \"one\" : \"za {0} minut\",\n        \"other\" : \"za {0} minuta\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"sada\",\n      \"past\" : {\n        \"few\" : \"pre {0} sekunde\",\n        \"other\" : \"pre {0} sekundi\",\n        \"one\" : \"pre {0} sekunde\"\n      },\n      \"future\" : {\n        \"other\" : \"za {0} sekundi\",\n        \"one\" : \"za {0} sekundu\",\n        \"few\" : \"za {0} sekunde\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"few\" : \"za {0} godine\",\n        \"one\" : \"za {0} godinu\",\n        \"other\" : \"za {0} godina\"\n      },\n      \"previous\" : \"prošle godine\",\n      \"next\" : \"sledeće godine\",\n      \"past\" : {\n        \"one\" : \"pre {0} godine\",\n        \"few\" : \"pre {0} godine\",\n        \"other\" : \"pre {0} godina\"\n      },\n      \"current\" : \"ove godine\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"sada\",\n      \"past\" : \"pre {0} sek.\",\n      \"future\" : \"za {0} sek.\"\n    },\n    \"now\" : \"sada\",\n    \"month\" : {\n      \"future\" : \"za {0} mes.\",\n      \"current\" : \"ovog mes.\",\n      \"past\" : \"pre {0} mes.\",\n      \"previous\" : \"prošlog mes.\",\n      \"next\" : \"sledećeg mes.\"\n    },\n    \"day\" : {\n      \"previous\" : \"juče\",\n      \"current\" : \"danas\",\n      \"next\" : \"sutra\",\n      \"future\" : \"za {0} d.\",\n      \"past\" : \"pre {0} d.\"\n    },\n    \"minute\" : {\n      \"current\" : \"ovog minuta\",\n      \"future\" : \"za {0} min.\",\n      \"past\" : \"pre {0} min.\"\n    },\n    \"quarter\" : {\n      \"past\" : \"pre {0} kv.\",\n      \"previous\" : \"prošlog kvartala\",\n      \"current\" : \"ovog kvartala\",\n      \"future\" : \"za {0} kv.\",\n      \"next\" : \"sledećeg kvartala\"\n    },\n    \"hour\" : {\n      \"current\" : \"ovog sata\",\n      \"future\" : \"za {0} č.\",\n      \"past\" : \"pre {0} č.\"\n    },\n    \"week\" : {\n      \"future\" : \"za {0} ned.\",\n      \"previous\" : \"prošle ned.\",\n      \"next\" : \"sledeće ned.\",\n      \"past\" : \"pre {0} ned.\",\n      \"current\" : \"ove ned.\"\n    },\n    \"year\" : {\n      \"next\" : \"sledeće god.\",\n      \"current\" : \"ove god.\",\n      \"past\" : \"pre {0} god.\",\n      \"future\" : \"za {0} god.\",\n      \"previous\" : \"prošle god.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sr_Latn.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"za {0} g.\",\n      \"previous\" : \"prošle g.\",\n      \"next\" : \"sledeće g.\",\n      \"current\" : \"ove g.\",\n      \"past\" : \"pre {0} g.\"\n    },\n    \"week\" : {\n      \"past\" : \"pre {0} n.\",\n      \"previous\" : \"prošle n.\",\n      \"future\" : \"za {0} n.\",\n      \"current\" : \"ove n.\",\n      \"next\" : \"sledeće n.\"\n    },\n    \"hour\" : {\n      \"future\" : \"za {0} č.\",\n      \"current\" : \"ovog sata\",\n      \"past\" : \"pre {0} č.\"\n    },\n    \"quarter\" : {\n      \"current\" : \"ovog kvartala\",\n      \"previous\" : \"prošlog kvartala\",\n      \"future\" : \"za {0} kv.\",\n      \"past\" : \"pre {0} kv.\",\n      \"next\" : \"sledećeg kvartala\"\n    },\n    \"second\" : {\n      \"past\" : \"pre {0} s.\",\n      \"future\" : \"za {0} s.\",\n      \"current\" : \"sada\"\n    },\n    \"month\" : {\n      \"current\" : \"ovog m.\",\n      \"future\" : \"za {0} m.\",\n      \"past\" : \"pre {0} m.\",\n      \"next\" : \"sledećeg m.\",\n      \"previous\" : \"prošlog m.\"\n    },\n    \"day\" : {\n      \"previous\" : \"juče\",\n      \"future\" : \"za {0} d.\",\n      \"next\" : \"sutra\",\n      \"current\" : \"danas\",\n      \"past\" : \"pre {0} d.\"\n    },\n    \"minute\" : {\n      \"future\" : \"za {0} min.\",\n      \"current\" : \"ovog minuta\",\n      \"past\" : \"pre {0} min.\"\n    },\n    \"now\" : \"sada\"\n  },\n  \"long\" : {\n    \"now\" : \"sada\",\n    \"week\" : {\n      \"previous\" : \"prošle nedelje\",\n      \"current\" : \"ove nedelje\",\n      \"future\" : {\n        \"one\" : \"za {0} nedelju\",\n        \"few\" : \"za {0} nedelje\",\n        \"other\" : \"za {0} nedelja\"\n      },\n      \"next\" : \"sledeće nedelje\",\n      \"past\" : {\n        \"other\" : \"pre {0} nedelja\",\n        \"few\" : \"pre {0} nedelje\",\n        \"one\" : \"pre {0} nedelje\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"ovog kvartala\",\n      \"previous\" : \"prošlog kvartala\",\n      \"past\" : \"pre {0} kvartala\",\n      \"next\" : \"sledećeg kvartala\",\n      \"future\" : {\n        \"other\" : \"za {0} kvartala\",\n        \"one\" : \"za {0} kvartal\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"ovog meseca\",\n      \"future\" : {\n        \"one\" : \"za {0} mesec\",\n        \"few\" : \"za {0} meseca\",\n        \"other\" : \"za {0} meseci\"\n      },\n      \"past\" : {\n        \"one\" : \"pre {0} meseca\",\n        \"other\" : \"pre {0} meseci\",\n        \"few\" : \"pre {0} meseca\"\n      },\n      \"previous\" : \"prošlog meseca\",\n      \"next\" : \"sledećeg meseca\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"za {0} dana\",\n        \"one\" : \"za {0} dan\"\n      },\n      \"previous\" : \"juče\",\n      \"current\" : \"danas\",\n      \"next\" : \"sutra\",\n      \"past\" : \"pre {0} dana\"\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"one\" : \"za {0} sat\",\n        \"few\" : \"za {0} sata\",\n        \"other\" : \"za {0} sati\"\n      },\n      \"current\" : \"ovog sata\",\n      \"past\" : {\n        \"one\" : \"pre {0} sata\",\n        \"few\" : \"pre {0} sata\",\n        \"other\" : \"pre {0} sati\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : \"pre {0} minuta\",\n      \"current\" : \"ovog minuta\",\n      \"future\" : {\n        \"one\" : \"za {0} minut\",\n        \"other\" : \"za {0} minuta\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"sada\",\n      \"past\" : {\n        \"few\" : \"pre {0} sekunde\",\n        \"other\" : \"pre {0} sekundi\",\n        \"one\" : \"pre {0} sekunde\"\n      },\n      \"future\" : {\n        \"other\" : \"za {0} sekundi\",\n        \"one\" : \"za {0} sekundu\",\n        \"few\" : \"za {0} sekunde\"\n      }\n    },\n    \"year\" : {\n      \"future\" : {\n        \"few\" : \"za {0} godine\",\n        \"one\" : \"za {0} godinu\",\n        \"other\" : \"za {0} godina\"\n      },\n      \"previous\" : \"prošle godine\",\n      \"next\" : \"sledeće godine\",\n      \"past\" : {\n        \"one\" : \"pre {0} godine\",\n        \"few\" : \"pre {0} godine\",\n        \"other\" : \"pre {0} godina\"\n      },\n      \"current\" : \"ove godine\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"sada\",\n      \"past\" : \"pre {0} sek.\",\n      \"future\" : \"za {0} sek.\"\n    },\n    \"now\" : \"sada\",\n    \"month\" : {\n      \"future\" : \"za {0} mes.\",\n      \"current\" : \"ovog mes.\",\n      \"past\" : \"pre {0} mes.\",\n      \"previous\" : \"prošlog mes.\",\n      \"next\" : \"sledećeg mes.\"\n    },\n    \"day\" : {\n      \"previous\" : \"juče\",\n      \"current\" : \"danas\",\n      \"next\" : \"sutra\",\n      \"future\" : \"za {0} d.\",\n      \"past\" : \"pre {0} d.\"\n    },\n    \"minute\" : {\n      \"current\" : \"ovog minuta\",\n      \"future\" : \"za {0} min.\",\n      \"past\" : \"pre {0} min.\"\n    },\n    \"quarter\" : {\n      \"past\" : \"pre {0} kv.\",\n      \"previous\" : \"prošlog kvartala\",\n      \"current\" : \"ovog kvartala\",\n      \"future\" : \"za {0} kv.\",\n      \"next\" : \"sledećeg kvartala\"\n    },\n    \"hour\" : {\n      \"current\" : \"ovog sata\",\n      \"future\" : \"za {0} č.\",\n      \"past\" : \"pre {0} č.\"\n    },\n    \"week\" : {\n      \"future\" : \"za {0} ned.\",\n      \"previous\" : \"prošle ned.\",\n      \"next\" : \"sledeće ned.\",\n      \"past\" : \"pre {0} ned.\",\n      \"current\" : \"ove ned.\"\n    },\n    \"year\" : {\n      \"next\" : \"sledeće god.\",\n      \"current\" : \"ove god.\",\n      \"past\" : \"pre {0} god.\",\n      \"future\" : \"za {0} god.\",\n      \"previous\" : \"prošle god.\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sv.json",
    "content": "{\n  \"short\" : {\n    \"now\" : \"nu\",\n    \"minute\" : {\n      \"past\" : \"för {0} min sen\",\n      \"current\" : \"denna minut\",\n      \"future\" : \"om {0} min\"\n    },\n    \"year\" : {\n      \"current\" : \"i år\",\n      \"future\" : \"om {0} år\",\n      \"previous\" : \"i fjol\",\n      \"next\" : \"nästa år\",\n      \"past\" : \"för {0} år sen\"\n    },\n    \"second\" : {\n      \"past\" : \"för {0} s sen\",\n      \"future\" : {\n        \"one\" : \"om {0} sek\",\n        \"other\" : \"om {0} sek\"\n      },\n      \"current\" : \"nu\"\n    },\n    \"hour\" : {\n      \"past\" : \"för {0} tim sedan\",\n      \"future\" : \"om {0} tim\",\n      \"current\" : \"denna timme\"\n    },\n    \"month\" : {\n      \"current\" : \"denna mån.\",\n      \"next\" : \"nästa mån.\",\n      \"past\" : \"för {0} mån. sen\",\n      \"future\" : \"om {0} mån.\",\n      \"previous\" : \"förra mån.\"\n    },\n    \"quarter\" : {\n      \"future\" : \"om {0} kv.\",\n      \"previous\" : \"förra kv.\",\n      \"next\" : \"nästa kv.\",\n      \"past\" : \"för {0} kv. sen\",\n      \"current\" : \"detta kv.\"\n    },\n    \"week\" : {\n      \"next\" : \"nästa v.\",\n      \"past\" : \"för {0} v. sedan\",\n      \"current\" : \"denna v.\",\n      \"previous\" : \"förra v.\",\n      \"future\" : \"om {0} v.\"\n    },\n    \"day\" : {\n      \"next\" : \"i morgon\",\n      \"current\" : \"i dag\",\n      \"previous\" : \"i går\",\n      \"past\" : {\n        \"one\" : \"för {0} d sedan\",\n        \"other\" : \"för {0} d sedan\"\n      },\n      \"future\" : \"om {0} d\"\n    }\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"current\" : \"denna minut\",\n      \"past\" : {\n        \"one\" : \"för {0} minut sedan\",\n        \"other\" : \"för {0} minuter sedan\"\n      },\n      \"future\" : {\n        \"other\" : \"om {0} minuter\",\n        \"one\" : \"om {0} minut\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"detta kvartal\",\n      \"past\" : \"för {0} kvartal sedan\",\n      \"next\" : \"nästa kvartal\",\n      \"future\" : \"om {0} kvartal\",\n      \"previous\" : \"förra kvartalet\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"om {0} veckor\",\n        \"one\" : \"om {0} vecka\"\n      },\n      \"previous\" : \"förra veckan\",\n      \"current\" : \"denna vecka\",\n      \"next\" : \"nästa vecka\",\n      \"past\" : {\n        \"one\" : \"för {0} vecka sedan\",\n        \"other\" : \"för {0} veckor sedan\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"nu\",\n      \"future\" : {\n        \"one\" : \"om {0} sekund\",\n        \"other\" : \"om {0} sekunder\"\n      },\n      \"past\" : {\n        \"one\" : \"för {0} sekund sedan\",\n        \"other\" : \"för {0} sekunder sedan\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"denna timme\",\n      \"past\" : {\n        \"other\" : \"för {0} timmar sedan\",\n        \"one\" : \"för {0} timme sedan\"\n      },\n      \"future\" : {\n        \"other\" : \"om {0} timmar\",\n        \"one\" : \"om {0} timme\"\n      }\n    },\n    \"now\" : \"nu\",\n    \"year\" : {\n      \"past\" : \"för {0} år sedan\",\n      \"previous\" : \"i fjol\",\n      \"current\" : \"i år\",\n      \"next\" : \"nästa år\",\n      \"future\" : \"om {0} år\"\n    },\n    \"day\" : {\n      \"current\" : \"i dag\",\n      \"previous\" : \"i går\",\n      \"next\" : \"i morgon\",\n      \"past\" : {\n        \"other\" : \"för {0} dagar sedan\",\n        \"one\" : \"för {0} dag sedan\"\n      },\n      \"future\" : {\n        \"other\" : \"om {0} dagar\",\n        \"one\" : \"om {0} dag\"\n      }\n    },\n    \"month\" : {\n      \"next\" : \"nästa månad\",\n      \"past\" : {\n        \"other\" : \"för {0} månader sedan\",\n        \"one\" : \"för {0} månad sedan\"\n      },\n      \"future\" : {\n        \"other\" : \"om {0} månader\",\n        \"one\" : \"om {0} månad\"\n      },\n      \"current\" : \"denna månad\",\n      \"previous\" : \"förra månaden\"\n    }\n  },\n  \"narrow\" : {\n    \"month\" : {\n      \"next\" : \"nästa mån.\",\n      \"past\" : \"−{0} mån\",\n      \"current\" : \"denna mån.\",\n      \"future\" : \"+{0} mån.\",\n      \"previous\" : \"förra mån.\"\n    },\n    \"day\" : {\n      \"current\" : \"idag\",\n      \"past\" : \"−{0} d\",\n      \"future\" : \"+{0} d\",\n      \"previous\" : \"igår\",\n      \"next\" : \"imorgon\"\n    },\n    \"second\" : {\n      \"past\" : \"−{0} s\",\n      \"future\" : \"+{0} s\",\n      \"current\" : \"nu\"\n    },\n    \"quarter\" : {\n      \"current\" : \"detta kv.\",\n      \"previous\" : \"förra kv.\",\n      \"past\" : \"−{0} kv\",\n      \"next\" : \"nästa kv.\",\n      \"future\" : \"+{0} kv.\"\n    },\n    \"year\" : {\n      \"previous\" : \"i fjol\",\n      \"current\" : \"i år\",\n      \"past\" : \"−{0} år\",\n      \"future\" : \"+{0} år\",\n      \"next\" : \"nästa år\"\n    },\n    \"now\" : \"nu\",\n    \"minute\" : {\n      \"current\" : \"denna minut\",\n      \"past\" : \"−{0} min\",\n      \"future\" : \"+{0} min\"\n    },\n    \"week\" : {\n      \"past\" : \"−{0} v\",\n      \"future\" : \"+{0} v.\",\n      \"next\" : \"nästa v.\",\n      \"current\" : \"denna v.\",\n      \"previous\" : \"förra v.\"\n    },\n    \"hour\" : {\n      \"past\" : \"−{0} h\",\n      \"future\" : \"+{0} h\",\n      \"current\" : \"denna timme\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/sw.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"next\" : \"mwaka ujao\",\n      \"past\" : {\n        \"one\" : \"mwaka {0} uliopita\",\n        \"other\" : \"miaka {0} iliyopita\"\n      },\n      \"future\" : {\n        \"one\" : \"baada ya mwaka {0}\",\n        \"other\" : \"baada ya miaka {0}\"\n      },\n      \"previous\" : \"mwaka uliopita\",\n      \"current\" : \"mwaka huu\"\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"one\" : \"robo {0} iliyopita\",\n        \"other\" : \"robo {0} zilizopita\"\n      },\n      \"previous\" : \"robo ya mwaka iliyopita\",\n      \"current\" : \"robo hii ya mwaka\",\n      \"next\" : \"robo ya mwaka inayofuata\",\n      \"future\" : \"baada ya robo {0}\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"Saa {0} zilizopita\",\n        \"one\" : \"Saa {0} iliyopita\"\n      },\n      \"future\" : \"baada ya saa {0}\",\n      \"current\" : \"saa hii\"\n    },\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"sekunde {0} iliyopita\",\n        \"other\" : \"sekunde {0} zilizopita\"\n      },\n      \"current\" : \"sasa hivi\",\n      \"future\" : \"baada ya sekunde {0}\"\n    },\n    \"week\" : {\n      \"previous\" : \"wiki iliyopita\",\n      \"past\" : {\n        \"other\" : \"wiki {0} zilizopita\",\n        \"one\" : \"wiki {0} iliyopita\"\n      },\n      \"next\" : \"wiki ijayo\",\n      \"future\" : \"baada ya wiki {0}\",\n      \"current\" : \"wiki hii\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"one\" : \"mwezi {0} uliopita\",\n        \"other\" : \"miezi {0} iliyopita\"\n      },\n      \"current\" : \"mwezi huu\",\n      \"future\" : {\n        \"one\" : \"baada ya mwezi {0}\",\n        \"other\" : \"baada ya miezi {0}\"\n      },\n      \"next\" : \"mwezi ujao\",\n      \"previous\" : \"mwezi uliopita\"\n    },\n    \"day\" : {\n      \"future\" : \"baada ya siku {0}\",\n      \"current\" : \"leo\",\n      \"past\" : {\n        \"one\" : \"siku {0} iliyopita\",\n        \"other\" : \"siku {0} zilizopita\"\n      },\n      \"previous\" : \"jana\",\n      \"next\" : \"kesho\"\n    },\n    \"minute\" : {\n      \"current\" : \"dakika hii\",\n      \"past\" : {\n        \"other\" : \"dakika {0} zilizopita\",\n        \"one\" : \"dakika {0} iliyopita\"\n      },\n      \"future\" : \"baada ya dakika {0}\"\n    },\n    \"now\" : \"sasa hivi\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"baada ya saa {0}\",\n      \"current\" : \"saa hii\",\n      \"past\" : {\n        \"one\" : \"saa {0} iliyopita\",\n        \"other\" : \"saa {0} zilizopita\"\n      }\n    },\n    \"week\" : {\n      \"previous\" : \"wiki iliyopita\",\n      \"past\" : {\n        \"other\" : \"wiki {0} zilizopita\",\n        \"one\" : \"wiki {0} iliyopita\"\n      },\n      \"current\" : \"wiki hii\",\n      \"next\" : \"wiki ijayo\",\n      \"future\" : \"baada ya wiki {0}\"\n    },\n    \"month\" : {\n      \"previous\" : \"mwezi uliopita\",\n      \"future\" : {\n        \"one\" : \"baada ya mwezi {0}\",\n        \"other\" : \"baada ya miezi {0}\"\n      },\n      \"next\" : \"mwezi ujao\",\n      \"current\" : \"mwezi huu\",\n      \"past\" : {\n        \"one\" : \"mwezi {0} uliopita\",\n        \"other\" : \"miezi {0} iliyopita\"\n      }\n    },\n    \"day\" : {\n      \"previous\" : \"jana\",\n      \"current\" : \"leo\",\n      \"next\" : \"kesho\",\n      \"past\" : {\n        \"one\" : \"siku {0} iliyopita\",\n        \"other\" : \"siku {0} zilizopita\"\n      },\n      \"future\" : \"baada ya siku {0}\"\n    },\n    \"second\" : {\n      \"future\" : \"baada ya sekunde {0}\",\n      \"current\" : \"sasa hivi\",\n      \"past\" : {\n        \"one\" : \"Sekunde {0} iliyopita\",\n        \"other\" : \"Sekunde {0} zilizopita\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"dakika {0} iliyopita\",\n        \"other\" : \"dakika {0} zilizopita\"\n      },\n      \"future\" : \"baada ya dakika {0}\",\n      \"current\" : \"dakika hii\"\n    },\n    \"year\" : {\n      \"current\" : \"mwaka huu\",\n      \"past\" : {\n        \"one\" : \"mwaka {0} uliopita\",\n        \"other\" : \"miaka {0} iliyopita\"\n      },\n      \"future\" : {\n        \"other\" : \"baada ya miaka {0}\",\n        \"one\" : \"baada ya mwaka {0}\"\n      },\n      \"next\" : \"mwaka ujao\",\n      \"previous\" : \"mwaka uliopita\"\n    },\n    \"now\" : \"sasa hivi\",\n    \"quarter\" : {\n      \"past\" : {\n        \"other\" : \"robo {0} zilizopita\",\n        \"one\" : \"robo {0} iliyopita\"\n      },\n      \"future\" : \"baada ya robo {0}\",\n      \"current\" : \"robo hii ya mwaka\",\n      \"next\" : \"robo ya mwaka inayofuata\",\n      \"previous\" : \"robo ya mwaka iliyopita\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"current\" : \"saa hii\",\n      \"past\" : {\n        \"other\" : \"saa {0} zilizopita\",\n        \"one\" : \"saa {0} iliyopita\"\n      },\n      \"future\" : \"baada ya saa {0}\"\n    },\n    \"second\" : {\n      \"future\" : \"baada ya sekunde {0}\",\n      \"past\" : {\n        \"other\" : \"sekunde {0} zilizopita\",\n        \"one\" : \"sekunde {0} iliyopita\"\n      },\n      \"current\" : \"sasa hivi\"\n    },\n    \"now\" : \"sasa hivi\",\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"mwaka {0} uliopita\",\n        \"other\" : \"miaka {0} iliyopita\"\n      },\n      \"future\" : {\n        \"other\" : \"baada ya miaka {0}\",\n        \"one\" : \"baada ya mwaka {0}\"\n      },\n      \"previous\" : \"mwaka uliopita\",\n      \"current\" : \"mwaka huu\",\n      \"next\" : \"mwaka ujao\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"robo ya mwaka iliyopita\",\n      \"future\" : \"baada ya robo {0}\",\n      \"next\" : \"robo ya mwaka inayofuata\",\n      \"past\" : {\n        \"one\" : \"robo {0} iliyopita\",\n        \"other\" : \"robo {0} zilizopita\"\n      },\n      \"current\" : \"robo hii ya mwaka\"\n    },\n    \"week\" : {\n      \"previous\" : \"wiki iliyopita\",\n      \"current\" : \"wiki hii\",\n      \"next\" : \"wiki ijayo\",\n      \"past\" : {\n        \"one\" : \"wiki {0} iliyopita\",\n        \"other\" : \"wiki {0} zilizopita\"\n      },\n      \"future\" : \"baada ya wiki {0}\"\n    },\n    \"day\" : {\n      \"next\" : \"kesho\",\n      \"past\" : {\n        \"other\" : \"siku {0} zilizopita\",\n        \"one\" : \"siku {0} iliyopita\"\n      },\n      \"previous\" : \"jana\",\n      \"future\" : \"baada ya siku {0}\",\n      \"current\" : \"leo\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"dakika {0} iliyopita\",\n        \"other\" : \"dakika {0} zilizopita\"\n      },\n      \"future\" : \"baada ya dakika {0}\",\n      \"current\" : \"dakika hii\"\n    },\n    \"month\" : {\n      \"next\" : \"mwezi ujao\",\n      \"past\" : {\n        \"one\" : \"mwezi {0} uliopita\",\n        \"other\" : \"miezi {0} iliyopita\"\n      },\n      \"future\" : {\n        \"one\" : \"baada ya mwezi {0}\",\n        \"other\" : \"baada ya miezi {0}\"\n      },\n      \"previous\" : \"mwezi uliopita\",\n      \"current\" : \"mwezi huu\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ta.json",
    "content": "{\n  \"narrow\" : {\n    \"second\" : {\n      \"future\" : \"{0} வி.\",\n      \"past\" : \"{0} வி. முன்\",\n      \"current\" : \"இப்போது\"\n    },\n    \"year\" : {\n      \"next\" : \"அடுத்த ஆண்டு\",\n      \"past\" : \"{0} ஆ. முன்\",\n      \"future\" : \"{0} ஆ.\",\n      \"previous\" : \"கடந்த ஆண்டு\",\n      \"current\" : \"இந்த ஆண்டு\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} மா. முன்\",\n      \"next\" : \"அடுத்த மாதம்\",\n      \"future\" : \"{0} மா.\",\n      \"previous\" : \"கடந்த மாதம்\",\n      \"current\" : \"இந்த மாதம்\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} நி. முன்\",\n      \"current\" : \"இந்த ஒரு நிமிடத்தில்\",\n      \"future\" : \"{0} நி.\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"இறுதி காலாண்டு\",\n      \"current\" : \"இந்த காலாண்டு\",\n      \"next\" : \"அடுத்த காலாண்டு\",\n      \"past\" : \"{0} கா. முன்\",\n      \"future\" : \"{0} கா.\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} ம.\",\n      \"past\" : \"{0} ம. முன்\",\n      \"current\" : \"இந்த ஒரு மணிநேரத்தில்\"\n    },\n    \"now\" : \"இப்போது\",\n    \"week\" : {\n      \"next\" : \"அடுத்த வாரம்\",\n      \"previous\" : \"கடந்த வாரம்\",\n      \"past\" : \"{0} வா. முன்\",\n      \"future\" : \"{0} வா.\",\n      \"current\" : \"இந்த வாரம்\"\n    },\n    \"day\" : {\n      \"previous\" : \"நேற்று\",\n      \"future\" : \"{0} நா.\",\n      \"past\" : \"{0} நா. முன்\",\n      \"current\" : \"இன்று\",\n      \"next\" : \"நாளை\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"நேற்று\",\n      \"past\" : {\n        \"other\" : \"{0} நாட்களுக்கு முன்\",\n        \"one\" : \"{0} நாளுக்கு முன்\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} நாட்களில்\",\n        \"one\" : \"{0} நாளில்\"\n      },\n      \"next\" : \"நாளை\",\n      \"current\" : \"இன்று\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} மணிநேரத்தில்\",\n      \"current\" : \"இந்த ஒரு மணிநேரத்தில்\",\n      \"past\" : \"{0} மணிநேரம் முன்\"\n    },\n    \"month\" : {\n      \"next\" : \"அடுத்த மாதம்\",\n      \"current\" : \"இந்த மாதம்\",\n      \"past\" : {\n        \"one\" : \"{0} மாதத்துக்கு முன்\",\n        \"other\" : \"{0} மாதங்களுக்கு முன்\"\n      },\n      \"previous\" : \"கடந்த மாதம்\",\n      \"future\" : {\n        \"one\" : \"{0} மாதத்தில்\",\n        \"other\" : \"{0} மாதங்களில்\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"அடுத்த காலாண்டு\",\n      \"past\" : {\n        \"one\" : \"{0} காலாண்டுக்கு முன்\",\n        \"other\" : \"{0} காலாண்டுகளுக்கு முன்\"\n      },\n      \"previous\" : \"கடந்த காலாண்டு\",\n      \"current\" : \"இந்த காலாண்டு\",\n      \"future\" : {\n        \"one\" : \"+{0} காலாண்டில்\",\n        \"other\" : \"{0} காலாண்டுகளில்\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"அடுத்த ஆண்டு\",\n      \"current\" : \"இந்த ஆண்டு\",\n      \"future\" : {\n        \"other\" : \"{0} ஆண்டுகளில்\",\n        \"one\" : \"{0} ஆண்டில்\"\n      },\n      \"previous\" : \"கடந்த ஆண்டு\",\n      \"past\" : {\n        \"other\" : \"{0} ஆண்டுகளுக்கு முன்\",\n        \"one\" : \"{0} ஆண்டிற்கு முன்\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"இந்த ஒரு நிமிடத்தில்\",\n      \"future\" : {\n        \"one\" : \"{0} நிமிடத்தில்\",\n        \"other\" : \"{0} நிமிடங்களில்\"\n      },\n      \"past\" : {\n        \"other\" : \"{0} நிமிடங்களுக்கு முன்\",\n        \"one\" : \"{0} நிமிடத்திற்கு முன்\"\n      }\n    },\n    \"second\" : {\n      \"future\" : {\n        \"one\" : \"{0} விநாடியில்\",\n        \"other\" : \"{0} விநாடிகளில்\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} விநாடிக்கு முன்\",\n        \"other\" : \"{0} விநாடிகளுக்கு முன்\"\n      },\n      \"current\" : \"இப்போது\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"{0} வாரத்தில்\",\n        \"other\" : \"{0} வாரங்களில்\"\n      },\n      \"previous\" : \"கடந்த வாரம்\",\n      \"current\" : \"இந்த வாரம்\",\n      \"next\" : \"அடுத்த வாரம்\",\n      \"past\" : {\n        \"other\" : \"{0} வாரங்களுக்கு முன்\",\n        \"one\" : \"{0} வாரத்திற்கு முன்\"\n      }\n    },\n    \"now\" : \"இப்போது\"\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"{0} நிமி.\",\n      \"current\" : \"இந்த ஒரு நிமிடத்தில்\",\n      \"past\" : \"{0} நிமி. முன்\"\n    },\n    \"month\" : {\n      \"current\" : \"இந்த மாதம்\",\n      \"past\" : \"{0} மாத. முன்\",\n      \"future\" : \"{0} மாத.\",\n      \"next\" : \"அடுத்த மாதம்\",\n      \"previous\" : \"கடந்த மாதம்\"\n    },\n    \"week\" : {\n      \"current\" : \"இந்த வாரம்\",\n      \"past\" : \"{0} வார. முன்\",\n      \"future\" : \"{0} வார.\",\n      \"next\" : \"அடுத்த வாரம்\",\n      \"previous\" : \"கடந்த வாரம்\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} மணி.\",\n      \"current\" : \"இந்த ஒரு மணிநேரத்தில்\",\n      \"past\" : \"{0} மணி. முன்\"\n    },\n    \"day\" : {\n      \"next\" : \"நாளை\",\n      \"current\" : \"இன்று\",\n      \"previous\" : \"நேற்று\",\n      \"past\" : {\n        \"one\" : \"{0} நாளுக்கு முன்\",\n        \"other\" : \"{0} நாட்களுக்கு முன்\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} நாளில்\",\n        \"other\" : \"{0} நாட்களில்\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"{0} விநா.\",\n      \"current\" : \"இப்போது\",\n      \"past\" : \"{0} விநா. முன்\"\n    },\n    \"now\" : \"இப்போது\",\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"{0} ஆண்டில்\",\n        \"other\" : \"{0} ஆண்டுகளில்\"\n      },\n      \"previous\" : \"கடந்த ஆண்டு\",\n      \"next\" : \"அடுத்த ஆண்டு\",\n      \"current\" : \"இந்த ஆண்டு\",\n      \"past\" : {\n        \"other\" : \"{0} ஆண்டுகளுக்கு முன்\",\n        \"one\" : \"{0} ஆண்டிற்கு முன்\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"இந்த காலாண்டு\",\n      \"future\" : \"{0} காலா.\",\n      \"previous\" : \"இறுதி காலாண்டு\",\n      \"next\" : \"அடுத்த காலாண்டு\",\n      \"past\" : \"{0} காலா. முன்\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/te.json",
    "content": "{\n  \"narrow\" : {\n    \"now\" : \"ప్రస్తుతం\",\n    \"hour\" : {\n      \"past\" : \"{0} గం. క్రితం\",\n      \"future\" : \"{0} గం.లో\",\n      \"current\" : \"ఈ గంట\"\n    },\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"{0} సం.లో\",\n        \"other\" : \"{0} సం.ల్లో\"\n      },\n      \"current\" : \"ఈ సంవత్సరం\",\n      \"past\" : \"{0} సం. క్రితం\",\n      \"previous\" : \"గత సంవత్సరం\",\n      \"next\" : \"తదుపరి సంవత్సరం\"\n    },\n    \"month\" : {\n      \"past\" : {\n        \"other\" : \"{0} నెలల క్రితం\",\n        \"one\" : \"{0} నెల క్రితం\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} నెలల్లో\",\n        \"one\" : \"{0} నెలలో\"\n      },\n      \"previous\" : \"గత నెల\",\n      \"current\" : \"ఈ నెల\",\n      \"next\" : \"తదుపరి నెల\"\n    },\n    \"day\" : {\n      \"current\" : \"ఈ రోజు\",\n      \"future\" : {\n        \"other\" : \"{0} రోజుల్లో\",\n        \"one\" : \"{0} రోజులో\"\n      },\n      \"previous\" : \"నిన్న\",\n      \"next\" : \"రేపు\",\n      \"past\" : {\n        \"other\" : \"{0} రోజుల క్రితం\",\n        \"one\" : \"{0} రోజు క్రితం\"\n      }\n    },\n    \"second\" : {\n      \"past\" : \"{0} సెక. క్రితం\",\n      \"future\" : {\n        \"other\" : \"{0} సెక. లో\",\n        \"one\" : \"{0} సెక.లో\"\n      },\n      \"current\" : \"ప్రస్తుతం\"\n    },\n    \"minute\" : {\n      \"current\" : \"ఈ నిమిషం\",\n      \"past\" : \"{0} నిమి. క్రితం\",\n      \"future\" : \"{0} నిమి.లో\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"గత త్రైమాసికం\",\n      \"past\" : \"{0} త్రైమా. క్రితం\",\n      \"current\" : \"ఈ త్రైమాసికం\",\n      \"next\" : \"తదుపరి త్రైమాసికం\",\n      \"future\" : {\n        \"one\" : \"{0} త్రైమాసికంలో\",\n        \"other\" : \"{0} త్రైమాసికాల్లో\"\n      }\n    },\n    \"week\" : {\n      \"next\" : \"తదుపరి వారం\",\n      \"current\" : \"ఈ వారం\",\n      \"past\" : {\n        \"one\" : \"{0} వారం క్రితం\",\n        \"other\" : \"{0} వారాల క్రితం\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} వారంలో\",\n        \"other\" : \"{0} వారాల్లో\"\n      },\n      \"previous\" : \"గత వారం\"\n    }\n  },\n  \"long\" : {\n    \"month\" : {\n      \"future\" : {\n        \"one\" : \"{0} నెలలో\",\n        \"other\" : \"{0} నెలల్లో\"\n      },\n      \"previous\" : \"గత నెల\",\n      \"current\" : \"ఈ నెల\",\n      \"next\" : \"తదుపరి నెల\",\n      \"past\" : {\n        \"other\" : \"{0} నెలల క్రితం\",\n        \"one\" : \"{0} నెల క్రితం\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"గత త్రైమాసికం\",\n      \"next\" : \"తదుపరి త్రైమాసికం\",\n      \"current\" : \"ఈ త్రైమాసికం\",\n      \"past\" : {\n        \"other\" : \"{0} త్రైమాసికాల క్రితం\",\n        \"one\" : \"{0} త్రైమాసికం క్రితం\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} త్రైమాసికాల్లో\",\n        \"one\" : \"{0} త్రైమాసికంలో\"\n      }\n    },\n    \"hour\" : {\n      \"current\" : \"ఈ గంట\",\n      \"past\" : {\n        \"other\" : \"{0} గంటల క్రితం\",\n        \"one\" : \"{0} గంట క్రితం\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} గంటలో\",\n        \"other\" : \"{0} గంటల్లో\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"ప్రస్తుతం\",\n      \"past\" : {\n        \"other\" : \"{0} సెకన్ల క్రితం\",\n        \"one\" : \"{0} సెకను క్రితం\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} సెకనులో\",\n        \"other\" : \"{0} సెకన్లలో\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"{0} సంవత్సరం క్రితం\",\n        \"other\" : \"{0} సంవత్సరాల క్రితం\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} సంవత్సరంలో\",\n        \"other\" : \"{0} సంవత్సరాల్లో\"\n      },\n      \"previous\" : \"గత సంవత్సరం\",\n      \"current\" : \"ఈ సంవత్సరం\",\n      \"next\" : \"తదుపరి సంవత్సరం\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"one\" : \"{0} రోజులో\",\n        \"other\" : \"{0} రోజుల్లో\"\n      },\n      \"current\" : \"ఈ రోజు\",\n      \"previous\" : \"నిన్న\",\n      \"next\" : \"రేపు\",\n      \"past\" : {\n        \"one\" : \"{0} రోజు క్రితం\",\n        \"other\" : \"{0} రోజుల క్రితం\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"ఈ నిమిషం\",\n      \"past\" : {\n        \"other\" : \"{0} నిమిషాల క్రితం\",\n        \"one\" : \"{0} నిమిషం క్రితం\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} నిమిషంలో\",\n        \"other\" : \"{0} నిమిషాల్లో\"\n      }\n    },\n    \"week\" : {\n      \"past\" : {\n        \"one\" : \"{0} వారం క్రితం\",\n        \"other\" : \"{0} వారాల క్రితం\"\n      },\n      \"next\" : \"తదుపరి వారం\",\n      \"current\" : \"ఈ వారం\",\n      \"future\" : {\n        \"one\" : \"{0} వారంలో\",\n        \"other\" : \"{0} వారాల్లో\"\n      },\n      \"previous\" : \"గత వారం\"\n    },\n    \"now\" : \"ప్రస్తుతం\"\n  },\n  \"short\" : {\n    \"month\" : {\n      \"past\" : {\n        \"one\" : \"{0} నెల క్రితం\",\n        \"other\" : \"{0} నెలల క్రితం\"\n      },\n      \"next\" : \"తదుపరి నెల\",\n      \"future\" : {\n        \"one\" : \"{0} నెలలో\",\n        \"other\" : \"{0} నెలల్లో\"\n      },\n      \"previous\" : \"గత నెల\",\n      \"current\" : \"ఈ నెల\"\n    },\n    \"week\" : {\n      \"next\" : \"తదుపరి వారం\",\n      \"previous\" : \"గత వారం\",\n      \"past\" : {\n        \"one\" : \"{0} వారం క్రితం\",\n        \"other\" : \"{0} వారాల క్రితం\"\n      },\n      \"current\" : \"ఈ వారం\",\n      \"future\" : {\n        \"one\" : \"{0} వారంలో\",\n        \"other\" : \"{0} వారాల్లో\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : \"{0} గం.లో\",\n      \"current\" : \"ఈ గంట\",\n      \"past\" : \"{0} గం. క్రితం\"\n    },\n    \"quarter\" : {\n      \"next\" : \"తదుపరి త్రైమాసికం\",\n      \"previous\" : \"గత త్రైమాసికం\",\n      \"past\" : \"{0} త్రైమా. క్రితం\",\n      \"future\" : {\n        \"one\" : \"{0} త్రైమా.లో\",\n        \"other\" : \"{0} త్రైమా.ల్లో\"\n      },\n      \"current\" : \"ఈ త్రైమాసికం\"\n    },\n    \"minute\" : {\n      \"current\" : \"ఈ నిమిషం\",\n      \"past\" : \"{0} నిమి. క్రితం\",\n      \"future\" : \"{0} నిమి.లో\"\n    },\n    \"now\" : \"ప్రస్తుతం\",\n    \"day\" : {\n      \"previous\" : \"నిన్న\",\n      \"past\" : {\n        \"other\" : \"{0} రోజుల క్రితం\",\n        \"one\" : \"{0} రోజు క్రితం\"\n      },\n      \"current\" : \"ఈ రోజు\",\n      \"next\" : \"రేపు\",\n      \"future\" : {\n        \"one\" : \"{0} రోజులో\",\n        \"other\" : \"{0} రోజుల్లో\"\n      }\n    },\n    \"year\" : {\n      \"next\" : \"తదుపరి సంవత్సరం\",\n      \"current\" : \"ఈ సంవత్సరం\",\n      \"past\" : \"{0} సం. క్రితం\",\n      \"previous\" : \"గత సంవత్సరం\",\n      \"future\" : {\n        \"one\" : \"{0} సం.లో\",\n        \"other\" : \"{0} సం.ల్లో\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"ప్రస్తుతం\",\n      \"future\" : {\n        \"other\" : \"{0} సెకన్లలో\",\n        \"one\" : \"{0} సెకనులో\"\n      },\n      \"past\" : \"{0} సెక. క్రితం\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/th.json",
    "content": "{\n  \"long\" : {\n    \"week\" : {\n      \"past\" : \"{0} สัปดาห์ที่ผ่านมา\",\n      \"next\" : \"สัปดาห์หน้า\",\n      \"current\" : \"สัปดาห์นี้\",\n      \"future\" : \"ในอีก {0} สัปดาห์\",\n      \"previous\" : \"สัปดาห์ที่แล้ว\"\n    },\n    \"hour\" : {\n      \"future\" : \"ในอีก {0} ชั่วโมง\",\n      \"past\" : \"{0} ชั่วโมงที่ผ่านมา\",\n      \"current\" : \"ชั่วโมงนี้\"\n    },\n    \"second\" : {\n      \"future\" : \"ในอีก {0} วินาที\",\n      \"current\" : \"ขณะนี้\",\n      \"past\" : \"{0} วินาทีที่ผ่านมา\"\n    },\n    \"day\" : {\n      \"future\" : \"ในอีก {0} วัน\",\n      \"previous\" : \"เมื่อวาน\",\n      \"current\" : \"วันนี้\",\n      \"next\" : \"พรุ่งนี้\",\n      \"past\" : \"{0} วันที่ผ่านมา\"\n    },\n    \"month\" : {\n      \"previous\" : \"เดือนที่แล้ว\",\n      \"current\" : \"เดือนนี้\",\n      \"future\" : \"ในอีก {0} เดือน\",\n      \"past\" : \"{0} เดือนที่ผ่านมา\",\n      \"next\" : \"เดือนหน้า\"\n    },\n    \"year\" : {\n      \"current\" : \"ปีนี้\",\n      \"next\" : \"ปีหน้า\",\n      \"previous\" : \"ปีที่แล้ว\",\n      \"past\" : \"{0} ปีที่แล้ว\",\n      \"future\" : \"ในอีก {0} ปี\"\n    },\n    \"now\" : \"ขณะนี้\",\n    \"minute\" : {\n      \"past\" : \"{0} นาทีที่ผ่านมา\",\n      \"future\" : \"ในอีก {0} นาที\",\n      \"current\" : \"นาทีนี้\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"ไตรมาสที่แล้ว\",\n      \"future\" : \"ในอีก {0} ไตรมาส\",\n      \"next\" : \"ไตรมาสหน้า\",\n      \"past\" : \"{0} ไตรมาสที่แล้ว\",\n      \"current\" : \"ไตรมาสนี้\"\n    }\n  },\n  \"narrow\" : {\n    \"month\" : {\n      \"next\" : \"เดือนหน้า\",\n      \"past\" : \"{0} เดือนที่แล้ว\",\n      \"current\" : \"เดือนนี้\",\n      \"future\" : \"ใน {0} เดือน\",\n      \"previous\" : \"เดือนที่แล้ว\"\n    },\n    \"day\" : {\n      \"current\" : \"วันนี้\",\n      \"past\" : \"{0} วันที่แล้ว\",\n      \"future\" : \"ใน {0} วัน\",\n      \"previous\" : \"เมื่อวาน\",\n      \"next\" : \"พรุ่งนี้\"\n    },\n    \"second\" : {\n      \"future\" : \"ใน {0} วินาที\",\n      \"past\" : \"{0} วินาทีที่แล้ว\",\n      \"current\" : \"ขณะนี้\"\n    },\n    \"quarter\" : {\n      \"current\" : \"ไตรมาสนี้\",\n      \"previous\" : \"ไตรมาสที่แล้ว\",\n      \"past\" : \"{0} ไตรมาสที่แล้ว\",\n      \"next\" : \"ไตรมาสหน้า\",\n      \"future\" : \"ใน {0} ไตรมาส\"\n    },\n    \"year\" : {\n      \"previous\" : \"ปีที่แล้ว\",\n      \"current\" : \"ปีนี้\",\n      \"past\" : \"{0} ปีที่แล้ว\",\n      \"future\" : \"ใน {0} ปี\",\n      \"next\" : \"ปีหน้า\"\n    },\n    \"now\" : \"ขณะนี้\",\n    \"minute\" : {\n      \"future\" : \"ใน {0} นาที\",\n      \"past\" : \"{0} นาทีที่แล้ว\",\n      \"current\" : \"นาทีนี้\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} สัปดาห์ที่แล้ว\",\n      \"future\" : \"ใน {0} สัปดาห์\",\n      \"next\" : \"สัปดาห์หน้า\",\n      \"current\" : \"สัปดาห์นี้\",\n      \"previous\" : \"สัปดาห์ที่แล้ว\"\n    },\n    \"hour\" : {\n      \"current\" : \"ชั่วโมงนี้\",\n      \"future\" : \"ใน {0} ชม.\",\n      \"past\" : \"{0} ชม. ที่แล้ว\"\n    }\n  },\n  \"short\" : {\n    \"now\" : \"ขณะนี้\",\n    \"minute\" : {\n      \"current\" : \"นาทีนี้\",\n      \"past\" : \"{0} นาทีที่แล้ว\",\n      \"future\" : \"ใน {0} นาที\"\n    },\n    \"year\" : {\n      \"current\" : \"ปีนี้\",\n      \"future\" : \"ใน {0} ปี\",\n      \"previous\" : \"ปีที่แล้ว\",\n      \"next\" : \"ปีหน้า\",\n      \"past\" : \"{0} ปีที่แล้ว\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} วินาทีที่แล้ว\",\n      \"future\" : \"ใน {0} วินาที\",\n      \"current\" : \"ขณะนี้\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} ชม. ที่แล้ว\",\n      \"future\" : \"ใน {0} ชม.\",\n      \"current\" : \"ชั่วโมงนี้\"\n    },\n    \"month\" : {\n      \"current\" : \"เดือนนี้\",\n      \"next\" : \"เดือนหน้า\",\n      \"past\" : \"{0} เดือนที่แล้ว\",\n      \"future\" : \"ใน {0} เดือน\",\n      \"previous\" : \"เดือนที่แล้ว\"\n    },\n    \"quarter\" : {\n      \"future\" : \"ใน {0} ไตรมาส\",\n      \"previous\" : \"ไตรมาสที่แล้ว\",\n      \"next\" : \"ไตรมาสหน้า\",\n      \"past\" : \"{0} ไตรมาสที่แล้ว\",\n      \"current\" : \"ไตรมาสนี้\"\n    },\n    \"week\" : {\n      \"next\" : \"สัปดาห์หน้า\",\n      \"past\" : \"{0} สัปดาห์ที่แล้ว\",\n      \"current\" : \"สัปดาห์นี้\",\n      \"previous\" : \"สัปดาห์ที่แล้ว\",\n      \"future\" : \"ใน {0} สัปดาห์\"\n    },\n    \"day\" : {\n      \"next\" : \"พรุ่งนี้\",\n      \"current\" : \"วันนี้\",\n      \"previous\" : \"เมื่อวาน\",\n      \"past\" : \"{0} วันที่แล้ว\",\n      \"future\" : \"ใน {0} วัน\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ti.json",
    "content": "{\n  \"short\" : {\n    \"month\" : {\n      \"future\" : \"ኣብ {0} ወርሒ\",\n      \"previous\" : \"last month\",\n      \"current\" : \"ህሉው ወርሒ\",\n      \"next\" : \"ዝመጽእ ወርሒ\",\n      \"past\" : \"ቅድሚ {0} ወርሒ\"\n    },\n    \"week\" : {\n      \"previous\" : \"ዝሓለፈ ሰሙን\",\n      \"current\" : \"ህሉው ሰሙን\",\n      \"future\" : \"ኣብ {0} ሰሙን\",\n      \"past\" : \"ቅድሚ {0} ሰሙን\",\n      \"next\" : \"ዝመጽእ ሰሙን\"\n    },\n    \"hour\" : {\n      \"past\" : \"ቅድሚ {0} ሰዓት\",\n      \"current\" : \"ኣብዚ ሰዓት\",\n      \"future\" : \"ኣብ {0} ሰዓት\"\n    },\n    \"quarter\" : {\n      \"future\" : \"ኣብ {0} ርብዒ\",\n      \"previous\" : \"ዝሓለፈ ርብዒ\",\n      \"current\" : \"ህሉው ርብዒ\",\n      \"next\" : \"ዝመጽእ ርብዒ\",\n      \"past\" : \"ቅድሚ {0} ርብዒ\"\n    },\n    \"minute\" : {\n      \"current\" : \"ኣብዚ ደቒቕ\",\n      \"past\" : \"ቅድሚ {0} ደቒቕ\",\n      \"future\" : \"ኣብ {0} ደቒቕ\"\n    },\n    \"now\" : \"ሕጂ\",\n    \"day\" : {\n      \"past\" : \"ቅድሚ {0} መዓልቲ\",\n      \"previous\" : \"ትማሊ\",\n      \"current\" : \"ሎሚ\",\n      \"next\" : \"ጽባሕ\",\n      \"future\" : \"ኣብ {0} መዓልቲ\"\n    },\n    \"year\" : {\n      \"previous\" : \"ዓሚ\",\n      \"next\" : \"ንዓመታ\",\n      \"current\" : \"ሎሚ ዓመት\",\n      \"future\" : \"ኣብ {0} ዓ\",\n      \"past\" : {\n        \"other\" : \"ቅድሚ {0} ዓ\",\n        \"one\" : \"ቅድሚ -{0} ዓ\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"ሕጂ\",\n      \"past\" : \"ቅድሚ {0} ካልኢት\",\n      \"future\" : \"ኣብ {0} ካልኢት\"\n    }\n  },\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"ጽባሕ\",\n      \"current\" : \"ሎሚ\",\n      \"future\" : \"ኣብ {0} መዓልቲ\",\n      \"past\" : \"ቅድሚ {0} መዓልቲ\",\n      \"previous\" : \"ትማሊ\"\n    },\n    \"week\" : {\n      \"current\" : \"ህሉው ሰሙን\",\n      \"next\" : \"ዝመጽእ ሰሙን\",\n      \"previous\" : \"ዝሓለፈ ሰሙን\",\n      \"past\" : \"ቅድሚ {0} ሰሙን\",\n      \"future\" : \"ኣብ {0} ሰሙን\"\n    },\n    \"quarter\" : {\n      \"past\" : \"ቅድሚ {0} ርብዒ\",\n      \"future\" : \"ኣብ {0} ርብዒ\",\n      \"previous\" : \"ዝሓለፈ ርብዒ\",\n      \"current\" : \"ህሉው ርብዒ\",\n      \"next\" : \"ዝመጽእ ርብዒ\"\n    },\n    \"month\" : {\n      \"previous\" : \"last month\",\n      \"current\" : \"ህሉው ወርሒ\",\n      \"next\" : \"ዝመጽእ ወርሒ\",\n      \"past\" : \"ቅድሚ {0} ወርሒ\",\n      \"future\" : \"ኣብ {0} ወርሒ\"\n    },\n    \"hour\" : {\n      \"past\" : \"ቅድሚ {0} ሰዓት\",\n      \"future\" : \"ኣብ {0} ሰዓት\",\n      \"current\" : \"ኣብዚ ሰዓት\"\n    },\n    \"year\" : {\n      \"current\" : \"ሎሚ ዓመት\",\n      \"past\" : \"ቅድሚ {0} ዓ\",\n      \"future\" : \"ኣብ {0} ዓ\",\n      \"next\" : \"ንዓመታ\",\n      \"previous\" : \"ዓሚ\"\n    },\n    \"now\" : \"ሕጂ\",\n    \"minute\" : {\n      \"future\" : \"ኣብ {0} ደቒቕ\",\n      \"current\" : \"ኣብዚ ደቒቕ\",\n      \"past\" : \"ቅድሚ {0} ደቒቕ\"\n    },\n    \"second\" : {\n      \"current\" : \"ሕጂ\",\n      \"past\" : \"ቅድሚ {0} ካልኢት\",\n      \"future\" : \"ኣብ {0} ካልኢት\"\n    }\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : \"ቅድሚ {0} ደቒቕ\",\n      \"future\" : \"ኣብ {0} ደቒቕ\",\n      \"current\" : \"ኣብዚ ደቒቕ\"\n    },\n    \"quarter\" : {\n      \"next\" : \"ዝመጽእ ርብዒ\",\n      \"past\" : \"ቅድሚ {0} ርብዒ\",\n      \"future\" : \"ኣብ {0} ርብዒ\",\n      \"previous\" : \"ዝሓለፈ ርብዒ\",\n      \"current\" : \"ህሉው ርብዒ\"\n    },\n    \"year\" : {\n      \"past\" : \"ቅድሚ {0} ዓ\",\n      \"current\" : \"ሎሚ ዓመት\",\n      \"previous\" : \"ዓሚ\",\n      \"next\" : \"ንዓመታ\",\n      \"future\" : \"ኣብ {0} ዓ\"\n    },\n    \"month\" : {\n      \"past\" : \"ቅድሚ {0} ወርሒ\",\n      \"future\" : \"ኣብ {0} ወርሒ\",\n      \"current\" : \"ህሉው ወርሒ\",\n      \"next\" : \"ዝመጽእ ወርሒ\",\n      \"previous\" : \"last month\"\n    },\n    \"hour\" : {\n      \"future\" : \"ኣብ {0} ሰዓት\",\n      \"past\" : \"ቅድሚ {0} ሰዓት\",\n      \"current\" : \"ኣብዚ ሰዓት\"\n    },\n    \"now\" : \"ሕጂ\",\n    \"week\" : {\n      \"future\" : \"ኣብ {0} ሰሙን\",\n      \"past\" : \"ቅድሚ {0} ሰሙን\",\n      \"previous\" : \"ዝሓለፈ ሰሙን\",\n      \"current\" : \"ህሉው ሰሙን\",\n      \"next\" : \"ዝመጽእ ሰሙን\"\n    },\n    \"day\" : {\n      \"current\" : \"ሎሚ\",\n      \"previous\" : \"ትማሊ\",\n      \"next\" : \"ጽባሕ\",\n      \"past\" : {\n        \"other\" : \"ኣብ {0} መዓልቲ\",\n        \"one\" : \"ቅድሚ {0} መዓልቲ\"\n      },\n      \"future\" : \"ኣብ {0} መዓልቲ\"\n    },\n    \"second\" : {\n      \"future\" : \"ኣብ {0} ካልኢት\",\n      \"current\" : \"ሕጂ\",\n      \"past\" : \"ቅድሚ {0} ካልኢት\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/tk.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"{0} ç. öň\",\n      \"future\" : \"{0} ç.-den\",\n      \"current\" : \"şu çärýek\",\n      \"previous\" : \"geçen çärýek\",\n      \"next\" : \"indiki çärýek\"\n    },\n    \"year\" : {\n      \"previous\" : \"geçen ýyl\",\n      \"next\" : \"indiki ýyl\",\n      \"future\" : \"{0}ý.-dan\",\n      \"current\" : \"şu ýyl\",\n      \"past\" : \"{0}ý. öň\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} h-den\",\n      \"previous\" : \"geçen hepde\",\n      \"next\" : \"indiki hepde\",\n      \"past\" : \"{0} h. öň\",\n      \"current\" : \"şu hepde\"\n    },\n    \"day\" : {\n      \"current\" : \"şu gün\",\n      \"past\" : \"{0} g. öň\",\n      \"next\" : \"ertir\",\n      \"future\" : \"{0} g-den\",\n      \"previous\" : \"düýn\"\n    },\n    \"hour\" : {\n      \"current\" : \"şu sagat\",\n      \"past\" : \"{0} sag. öň\",\n      \"future\" : \"{0} sag-dan\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} min-dan\",\n      \"current\" : \"şu minut\",\n      \"past\" : \"{0} min. öň\"\n    },\n    \"month\" : {\n      \"next\" : \"indiki aý\",\n      \"current\" : \"şu aý\",\n      \"past\" : \"{0} aý öň\",\n      \"future\" : \"{0} aýdan\",\n      \"previous\" : \"geçen aý\"\n    },\n    \"now\" : \"häzir\",\n    \"second\" : {\n      \"future\" : \"{0} sek-dan\",\n      \"current\" : \"häzir\",\n      \"past\" : \"{0} sek. öň\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} min. öň\",\n      \"future\" : \"{0} min-dan\",\n      \"current\" : \"şu minut\"\n    },\n    \"week\" : {\n      \"current\" : \"şu hepde\",\n      \"past\" : \"{0} hep. öň\",\n      \"future\" : \"{0} hep-den\",\n      \"next\" : \"indiki hepde\",\n      \"previous\" : \"geçen hepde\"\n    },\n    \"year\" : {\n      \"future\" : \"{0}ý.-dan\",\n      \"previous\" : \"geçen ýyl\",\n      \"next\" : \"indiki ýyl\",\n      \"current\" : \"şu ýyl\",\n      \"past\" : \"{0}ý. öň\"\n    },\n    \"day\" : {\n      \"next\" : \"ertir\",\n      \"current\" : \"şu gün\",\n      \"previous\" : \"düýn\",\n      \"past\" : \"{0} g. öň\",\n      \"future\" : \"{0} g-den\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} sag-dan\",\n      \"current\" : \"şu sagat\",\n      \"past\" : \"{0} sag. öň\"\n    },\n    \"quarter\" : {\n      \"current\" : \"şu çärýek\",\n      \"future\" : \"{0} çär.-den\",\n      \"previous\" : \"geçen çärýek\",\n      \"next\" : \"indiki çärýek\",\n      \"past\" : \"{0} çär. öň\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} sek. öň\",\n      \"current\" : \"häzir\",\n      \"future\" : \"{0} sek-dan\"\n    },\n    \"month\" : {\n      \"current\" : \"şu aý\",\n      \"past\" : \"{0} aý öň\",\n      \"future\" : \"{0} aýdan\",\n      \"next\" : \"indiki aý\",\n      \"previous\" : \"geçen aý\"\n    },\n    \"now\" : \"häzir\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} sagatdan\",\n      \"current\" : \"şu sagat\",\n      \"past\" : \"{0} sagat öň\"\n    },\n    \"day\" : {\n      \"next\" : \"ertir\",\n      \"past\" : \"{0} gün öň\",\n      \"previous\" : \"düýn\",\n      \"future\" : \"{0} günden\",\n      \"current\" : \"şu gün\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} sekunt öň\",\n      \"current\" : \"häzir\",\n      \"future\" : \"{0} sekuntdan\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} hepdeden\",\n      \"past\" : \"{0} hepde öň\",\n      \"current\" : \"şu hepde\",\n      \"next\" : \"indiki hepde\",\n      \"previous\" : \"geçen hepde\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} minutdan\",\n      \"past\" : \"{0} minut öň\",\n      \"current\" : \"şu minut\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} aýdan\",\n      \"past\" : \"{0} aý öň\",\n      \"current\" : \"şu aý\",\n      \"previous\" : \"geçen aý\",\n      \"next\" : \"indiki aý\"\n    },\n    \"now\" : \"häzir\",\n    \"year\" : {\n      \"current\" : \"şu ýyl\",\n      \"next\" : \"indiki ýyl\",\n      \"previous\" : \"geçen ýyl\",\n      \"future\" : \"{0} ýyldan\",\n      \"past\" : \"{0} ýyl öň\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} çärýekden\",\n      \"previous\" : \"geçen çärýek\",\n      \"past\" : \"{0} çärýek öň\",\n      \"next\" : \"indiki çärýek\",\n      \"current\" : \"şu çärýek\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/to.json",
    "content": "{\n  \"narrow\" : {\n    \"year\" : {\n      \"future\" : \"ʻi he taʻu ʻe {0}\",\n      \"previous\" : \"taʻu kuoʻosi\",\n      \"next\" : \"taʻu kahaʻu\",\n      \"current\" : \"taʻú ni\",\n      \"past\" : \"taʻu ʻe {0} kuoʻosi\"\n    },\n    \"week\" : {\n      \"past\" : \"uike ʻe {0} kuoʻosi\",\n      \"previous\" : \"uike kuoʻosi\",\n      \"future\" : \"ʻi he uike ʻe {0}\",\n      \"current\" : \"uiké ni\",\n      \"next\" : \"uike kahaʻu\"\n    },\n    \"hour\" : {\n      \"future\" : \"ʻi he houa ʻe {0}\",\n      \"current\" : \"this hour\",\n      \"past\" : \"houa ʻe {0} kuoʻosi\"\n    },\n    \"quarter\" : {\n      \"current\" : \"kuata koʻeni\",\n      \"previous\" : \"kuata kuoʻosi\",\n      \"future\" : \"ʻi he kuata ʻe {0}\",\n      \"past\" : \"kuata ʻe {0} kuoʻosi\",\n      \"next\" : \"kuata hoko\"\n    },\n    \"second\" : {\n      \"past\" : \"sekoni ʻe {0} kuoʻosi\",\n      \"future\" : \"ʻi he sekoni ʻe {0}\",\n      \"current\" : \"taimí ni\"\n    },\n    \"month\" : {\n      \"current\" : \"māhiná ni\",\n      \"future\" : \"ʻi he māhina ʻe {0}\",\n      \"past\" : \"māhina ʻe {0} kuoʻosi\",\n      \"next\" : \"māhina kahaʻu\",\n      \"previous\" : \"māhina kuoʻosi\"\n    },\n    \"day\" : {\n      \"previous\" : \"ʻaneafi\",\n      \"future\" : \"ʻi he ʻaho ʻe {0}\",\n      \"next\" : \"ʻapongipongi\",\n      \"current\" : \"ʻahó ni\",\n      \"past\" : \"ʻaho ʻe {0} kuoʻosi\"\n    },\n    \"minute\" : {\n      \"past\" : \"miniti ʻe {0} kuoʻosi\",\n      \"future\" : \"ʻi he miniti ʻe {0}\",\n      \"current\" : \"this minute\"\n    },\n    \"now\" : \"taimí ni\"\n  },\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"kuata hoko\",\n      \"current\" : \"kuata koʻeni\",\n      \"previous\" : \"kuata kuoʻosi\",\n      \"past\" : \"kuata ʻe {0} kuoʻosi\",\n      \"future\" : \"ʻi he kuata ʻe {0}\"\n    },\n    \"now\" : \"taimí ni\",\n    \"year\" : {\n      \"previous\" : \"taʻu kuoʻosi\",\n      \"past\" : \"taʻu ʻe {0} kuoʻosi\",\n      \"future\" : \"ʻi he taʻu ʻe {0}\",\n      \"next\" : \"taʻu kahaʻu\",\n      \"current\" : \"taʻú ni\"\n    },\n    \"month\" : {\n      \"previous\" : \"māhina kuoʻosi\",\n      \"current\" : \"māhiná ni\",\n      \"future\" : \"ʻi he māhina ʻe {0}\",\n      \"past\" : \"māhina ʻe {0} kuoʻosi\",\n      \"next\" : \"māhina kahaʻu\"\n    },\n    \"day\" : {\n      \"previous\" : \"ʻaneafi\",\n      \"future\" : \"ʻi he ʻaho ʻe {0}\",\n      \"next\" : \"ʻapongipongi\",\n      \"past\" : \"ʻaho ʻe {0} kuoʻosi\",\n      \"current\" : \"ʻahó ni\"\n    },\n    \"second\" : {\n      \"future\" : \"ʻi he sekoni ʻe {0}\",\n      \"current\" : \"taimí ni\",\n      \"past\" : \"sekoni ʻe {0} kuoʻosi\"\n    },\n    \"week\" : {\n      \"past\" : \"uike ʻe {0} kuoʻosi\",\n      \"current\" : \"uiké ni\",\n      \"next\" : \"uike kahaʻu\",\n      \"previous\" : \"uike kuoʻosi\",\n      \"future\" : \"ʻi he uike ʻe {0}\"\n    },\n    \"hour\" : {\n      \"past\" : \"houa ʻe {0} kuoʻosi\",\n      \"future\" : \"ʻi he houa ʻe {0}\",\n      \"current\" : \"this hour\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : \"ʻi he miniti ʻe {0}\",\n      \"past\" : \"miniti ʻe {0} kuoʻosi\"\n    }\n  },\n  \"short\" : {\n    \"second\" : {\n      \"current\" : \"taimí ni\",\n      \"past\" : \"sekoni ʻe {0} kuoʻosi\",\n      \"future\" : \"ʻi he sekoni ʻe {0}\"\n    },\n    \"now\" : \"taimí ni\",\n    \"month\" : {\n      \"future\" : \"ʻi he māhina ʻe {0}\",\n      \"current\" : \"māhiná ni\",\n      \"past\" : \"māhina ʻe {0} kuoʻosi\",\n      \"previous\" : \"māhina kuoʻosi\",\n      \"next\" : \"māhina kahaʻu\"\n    },\n    \"day\" : {\n      \"previous\" : \"ʻaneafi\",\n      \"current\" : \"ʻahó ni\",\n      \"next\" : \"ʻapongipongi\",\n      \"future\" : \"ʻi he ʻaho ʻe {0}\",\n      \"past\" : \"ʻaho ʻe {0} kuoʻosi\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : \"ʻi he miniti ʻe {0}\",\n      \"past\" : \"miniti ʻe {0} kuoʻosi\"\n    },\n    \"quarter\" : {\n      \"past\" : \"kuata ʻe {0} kuoʻosi\",\n      \"previous\" : \"kuata kuoʻosi\",\n      \"current\" : \"kuata koʻeni\",\n      \"future\" : \"ʻi he kuata ʻe {0}\",\n      \"next\" : \"kuata hoko\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"future\" : \"ʻi he houa ʻe {0}\",\n      \"past\" : \"houa ʻe {0} kuoʻosi\"\n    },\n    \"week\" : {\n      \"future\" : \"ʻi he uike ʻe {0}\",\n      \"previous\" : \"uike kuoʻosi\",\n      \"next\" : \"uike kahaʻu\",\n      \"past\" : \"uike ʻe {0} kuoʻosi\",\n      \"current\" : \"uiké ni\"\n    },\n    \"year\" : {\n      \"next\" : \"taʻu kahaʻu\",\n      \"current\" : \"taʻú ni\",\n      \"past\" : \"taʻu ʻe {0} kuoʻosi\",\n      \"future\" : \"ʻi he taʻu ʻe {0}\",\n      \"previous\" : \"taʻu kuoʻosi\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/tr.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"yarın\",\n      \"future\" : \"{0} gün sonra\",\n      \"previous\" : \"dün\",\n      \"current\" : \"bugün\",\n      \"past\" : \"{0} gün önce\"\n    },\n    \"quarter\" : {\n      \"next\" : \"gelecek çeyrek\",\n      \"past\" : \"{0} çyr. önce\",\n      \"future\" : \"{0} çyr. sonra\",\n      \"previous\" : \"geçen çeyrek\",\n      \"current\" : \"bu çeyrek\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} sa. önce\",\n      \"future\" : \"{0} sa. sonra\",\n      \"current\" : \"bu saat\"\n    },\n    \"year\" : {\n      \"next\" : \"gelecek yıl\",\n      \"past\" : \"{0} yıl önce\",\n      \"current\" : \"bu yıl\",\n      \"previous\" : \"geçen yıl\",\n      \"future\" : \"{0} yıl sonra\"\n    },\n    \"now\" : \"şimdi\",\n    \"month\" : {\n      \"current\" : \"bu ay\",\n      \"future\" : \"{0} ay sonra\",\n      \"past\" : \"{0} ay önce\",\n      \"next\" : \"gelecek ay\",\n      \"previous\" : \"geçen ay\"\n    },\n    \"week\" : {\n      \"previous\" : \"geçen hafta\",\n      \"current\" : \"bu hafta\",\n      \"past\" : \"{0} hf. önce\",\n      \"future\" : \"{0} hf. sonra\",\n      \"next\" : \"gelecek hafta\"\n    },\n    \"minute\" : {\n      \"current\" : \"bu dakika\",\n      \"past\" : \"{0} dk. önce\",\n      \"future\" : \"{0} dk. sonra\"\n    },\n    \"second\" : {\n      \"current\" : \"şimdi\",\n      \"past\" : \"{0} sn. önce\",\n      \"future\" : \"{0} sn. sonra\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"dün\",\n      \"current\" : \"bugün\",\n      \"next\" : \"yarın\",\n      \"past\" : \"{0} gün önce\",\n      \"future\" : \"{0} gün sonra\"\n    },\n    \"week\" : {\n      \"current\" : \"bu hafta\",\n      \"future\" : \"{0} hafta sonra\",\n      \"past\" : \"{0} hafta önce\",\n      \"previous\" : \"geçen hafta\",\n      \"next\" : \"gelecek hafta\"\n    },\n    \"minute\" : {\n      \"current\" : \"bu dakika\",\n      \"past\" : \"{0} dakika önce\",\n      \"future\" : \"{0} dakika sonra\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ay sonra\",\n      \"next\" : \"gelecek ay\",\n      \"previous\" : \"geçen ay\",\n      \"current\" : \"bu ay\",\n      \"past\" : \"{0} ay önce\"\n    },\n    \"hour\" : {\n      \"current\" : \"bu saat\",\n      \"past\" : \"{0} saat önce\",\n      \"future\" : \"{0} saat sonra\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} yıl önce\",\n      \"future\" : \"{0} yıl sonra\",\n      \"previous\" : \"geçen yıl\",\n      \"next\" : \"gelecek yıl\",\n      \"current\" : \"bu yıl\"\n    },\n    \"second\" : {\n      \"current\" : \"şimdi\",\n      \"past\" : \"{0} saniye önce\",\n      \"future\" : \"{0} saniye sonra\"\n    },\n    \"now\" : \"şimdi\",\n    \"quarter\" : {\n      \"past\" : \"{0} çeyrek önce\",\n      \"current\" : \"bu çeyrek\",\n      \"previous\" : \"geçen çeyrek\",\n      \"future\" : \"{0} çeyrek sonra\",\n      \"next\" : \"gelecek çeyrek\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} çyr. sonra\",\n      \"next\" : \"gelecek çeyrek\",\n      \"previous\" : \"geçen çeyrek\",\n      \"current\" : \"bu çeyrek\",\n      \"past\" : \"{0} çyr. önce\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} dk. önce\",\n      \"current\" : \"bu dakika\",\n      \"future\" : \"{0} dk. sonra\"\n    },\n    \"year\" : {\n      \"next\" : \"gelecek yıl\",\n      \"future\" : \"{0} yıl sonra\",\n      \"current\" : \"bu yıl\",\n      \"past\" : \"{0} yıl önce\",\n      \"previous\" : \"geçen yıl\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} sn. önce\",\n      \"future\" : \"{0} sn. sonra\",\n      \"current\" : \"şimdi\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} sa. önce\",\n      \"current\" : \"bu saat\",\n      \"future\" : \"{0} sa. sonra\"\n    },\n    \"now\" : \"şimdi\",\n    \"month\" : {\n      \"previous\" : \"geçen ay\",\n      \"next\" : \"gelecek ay\",\n      \"past\" : \"{0} ay önce\",\n      \"current\" : \"bu ay\",\n      \"future\" : \"{0} ay sonra\"\n    },\n    \"week\" : {\n      \"previous\" : \"geçen hafta\",\n      \"current\" : \"bu hafta\",\n      \"next\" : \"gelecek hafta\",\n      \"past\" : \"{0} hf. önce\",\n      \"future\" : \"{0} hf. sonra\"\n    },\n    \"day\" : {\n      \"next\" : \"yarın\",\n      \"past\" : \"{0} gün önce\",\n      \"future\" : \"{0} gün sonra\",\n      \"previous\" : \"dün\",\n      \"current\" : \"bugün\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ug.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\"\n    },\n    \"day\" : {\n      \"next\" : \"ئەتە\",\n      \"previous\" : \"تۈنۈگۈن\",\n      \"future\" : \"{0} كۈندىن كېيىن\",\n      \"past\" : \"{0} كۈن ئىلگىرى\",\n      \"current\" : \"بۈگۈن\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} يىل ئىلگىرى\",\n      \"previous\" : \"ئۆتكەن يىل\",\n      \"future\" : \"{0} يىلدىن كېيىن\",\n      \"next\" : \"كېلەر يىل\",\n      \"current\" : \"بۇ يىل\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} مىنۇت ئىلگىرى\",\n      \"future\" : \"{0} مىنۇتتىن كېيىن\",\n      \"current\" : \"this minute\"\n    },\n    \"now\" : \"now\",\n    \"week\" : {\n      \"current\" : \"بۇ ھەپتە\",\n      \"previous\" : \"ئۆتكەن ھەپتە\",\n      \"past\" : \"{0} ھەپتە ئىلگىرى\",\n      \"next\" : \"كېلەر ھەپتە\",\n      \"future\" : \"{0} ھەپتىدىن كېيىن\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} سېكۇنت ئىلگىرى\",\n      \"future\" : \"{0} سېكۇنتتىن كېيىن\",\n      \"current\" : \"now\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ئايدىن كېيىن\",\n      \"current\" : \"بۇ ئاي\",\n      \"past\" : \"{0} ئاي ئىلگىرى\",\n      \"previous\" : \"ئۆتكەن ئاي\",\n      \"next\" : \"كېلەر ئاي\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} سائەت ئىلگىرى\",\n      \"future\" : \"{0} سائەتتىن كېيىن\"\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"next\" : \"كېلەر يىل\",\n      \"previous\" : \"ئۆتكەن يىل\",\n      \"past\" : \"{0} يىل ئىلگىرى\",\n      \"future\" : \"{0} يىلدىن كېيىن\",\n      \"current\" : \"بۇ يىل\"\n    },\n    \"now\" : \"now\",\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} ئاي ئىلگىرى\",\n      \"next\" : \"كېلەر ئاي\",\n      \"previous\" : \"ئۆتكەن ئاي\",\n      \"future\" : \"{0} ئايدىن كېيىن\",\n      \"current\" : \"بۇ ئاي\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : \"{0} سېكۇنتتىن كېيىن\",\n      \"past\" : \"{0} سېكۇنت ئىلگىرى\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} ھەپتە ئىلگىرى\",\n      \"previous\" : \"ئۆتكەن ھەپتە\",\n      \"future\" : \"{0} ھەپتىدىن كېيىن\",\n      \"next\" : \"كېلەر ھەپتە\",\n      \"current\" : \"بۇ ھەپتە\"\n    },\n    \"day\" : {\n      \"next\" : \"ئەتە\",\n      \"future\" : \"{0} كۈندىن كېيىن\",\n      \"previous\" : \"تۈنۈگۈن\",\n      \"current\" : \"بۈگۈن\",\n      \"past\" : \"{0} كۈن ئىلگىرى\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : \"{0} مىنۇت ئىلگىرى\",\n      \"future\" : \"{0} مىنۇتتىن كېيىن\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} سائەت ئىلگىرى\",\n      \"future\" : \"{0} سائەتتىن كېيىن\",\n      \"current\" : \"this hour\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : \"{0} مىنۇت ئىلگىرى\",\n      \"future\" : \"{0} مىنۇتتىن كېيىن\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} ھەپتىدىن كېيىن\",\n      \"previous\" : \"ئۆتكەن ھەپتە\",\n      \"next\" : \"كېلەر ھەپتە\",\n      \"current\" : \"بۇ ھەپتە\",\n      \"past\" : \"{0} ھەپتە ئىلگىرى\"\n    },\n    \"year\" : {\n      \"current\" : \"بۇ يىل\",\n      \"previous\" : \"ئۆتكەن يىل\",\n      \"future\" : \"{0} يىلدىن كېيىن\",\n      \"past\" : \"{0} يىل ئىلگىرى\",\n      \"next\" : \"كېلەر يىل\"\n    },\n    \"month\" : {\n      \"next\" : \"كېلەر ئاي\",\n      \"past\" : \"{0} ئاي ئىلگىرى\",\n      \"future\" : \"{0} ئايدىن كېيىن\",\n      \"previous\" : \"ئۆتكەن ئاي\",\n      \"current\" : \"بۇ ئاي\"\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"day\" : {\n      \"current\" : \"بۈگۈن\",\n      \"previous\" : \"تۈنۈگۈن\",\n      \"past\" : \"{0} كۈن ئىلگىرى\",\n      \"next\" : \"ئەتە\",\n      \"future\" : \"{0} كۈندىن كېيىن\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} سائەت ئىلگىرى\",\n      \"future\" : \"{0} سائەتتىن كېيىن\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} سېكۇنتتىن كېيىن\",\n      \"current\" : \"now\",\n      \"past\" : \"{0} سېكۇنت ئىلگىرى\"\n    },\n    \"now\" : \"now\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/uk.json",
    "content": "{\n  \"long\" : {\n    \"day\" : {\n      \"future\" : {\n        \"many\" : \"через {0} днів\",\n        \"one\" : \"через {0} день\",\n        \"few\" : \"через {0} дні\",\n        \"other\" : \"через {0} дня\"\n      },\n      \"previous\" : \"учора\",\n      \"current\" : \"сьогодні\",\n      \"past\" : {\n        \"many\" : \"{0} днів тому\",\n        \"other\" : \"{0} дня тому\",\n        \"few\" : \"{0} дні тому\",\n        \"one\" : \"{0} день тому\"\n      },\n      \"next\" : \"завтра\"\n    },\n    \"minute\" : {\n      \"current\" : \"цієї хвилини\",\n      \"past\" : {\n        \"one\" : \"{0} хвилину тому\",\n        \"many\" : \"{0} хвилин тому\",\n        \"other\" : \"{0} хвилини тому\"\n      },\n      \"future\" : {\n        \"many\" : \"через {0} хвилин\",\n        \"one\" : \"через {0} хвилину\",\n        \"other\" : \"через {0} хвилини\"\n      }\n    },\n    \"now\" : \"зараз\",\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"{0} секунду тому\",\n        \"other\" : \"{0} секунди тому\",\n        \"many\" : \"{0} секунд тому\"\n      },\n      \"future\" : {\n        \"one\" : \"через {0} секунду\",\n        \"other\" : \"через {0} секунди\",\n        \"many\" : \"через {0} секунд\"\n      },\n      \"current\" : \"зараз\"\n    },\n    \"week\" : {\n      \"current\" : \"цього тижня\",\n      \"next\" : \"наступного тижня\",\n      \"previous\" : \"минулого тижня\",\n      \"future\" : {\n        \"many\" : \"через {0} тижнів\",\n        \"few\" : \"через {0} тижні\",\n        \"other\" : \"через {0} тижня\",\n        \"one\" : \"через {0} тиждень\"\n      },\n      \"past\" : {\n        \"many\" : \"{0} тижнів тому\",\n        \"other\" : \"{0} тижня тому\",\n        \"few\" : \"{0} тижні тому\",\n        \"one\" : \"{0} тиждень тому\"\n      }\n    },\n    \"quarter\" : {\n      \"previous\" : \"минулого кварталу\",\n      \"past\" : {\n        \"few\" : \"{0} квартали тому\",\n        \"one\" : \"{0} квартал тому\",\n        \"other\" : \"{0} кварталу тому\",\n        \"many\" : \"{0} кварталів тому\"\n      },\n      \"future\" : {\n        \"one\" : \"через {0} квартал\",\n        \"many\" : \"через {0} кварталів\",\n        \"other\" : \"через {0} кварталу\",\n        \"few\" : \"через {0} квартали\"\n      },\n      \"current\" : \"цього кварталу\",\n      \"next\" : \"наступного кварталу\"\n    },\n    \"month\" : {\n      \"current\" : \"цього місяця\",\n      \"next\" : \"наступного місяця\",\n      \"previous\" : \"минулого місяця\",\n      \"past\" : {\n        \"many\" : \"{0} місяців тому\",\n        \"one\" : \"{0} місяць тому\",\n        \"few\" : \"{0} місяці тому\",\n        \"other\" : \"{0} місяця тому\"\n      },\n      \"future\" : {\n        \"many\" : \"через {0} місяців\",\n        \"one\" : \"через {0} місяць\",\n        \"few\" : \"через {0} місяці\",\n        \"other\" : \"через {0} місяця\"\n      }\n    },\n    \"hour\" : {\n      \"future\" : {\n        \"many\" : \"через {0} годин\",\n        \"one\" : \"через {0} годину\",\n        \"other\" : \"через {0} години\"\n      },\n      \"current\" : \"цієї години\",\n      \"past\" : {\n        \"one\" : \"{0} годину тому\",\n        \"many\" : \"{0} годин тому\",\n        \"other\" : \"{0} години тому\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"{0} року тому\",\n        \"many\" : \"{0} років тому\",\n        \"few\" : \"{0} роки тому\",\n        \"one\" : \"{0} рік тому\"\n      },\n      \"future\" : {\n        \"one\" : \"через {0} рік\",\n        \"other\" : \"через {0} року\",\n        \"many\" : \"через {0} років\",\n        \"few\" : \"через {0} роки\"\n      },\n      \"previous\" : \"торік\",\n      \"current\" : \"цього року\",\n      \"next\" : \"наступного року\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"через {0} кв.\",\n      \"next\" : \"наступного кв.\",\n      \"previous\" : \"минулого кв.\",\n      \"current\" : \"цього кв.\",\n      \"past\" : \"{0} кв. тому\"\n    },\n    \"minute\" : {\n      \"current\" : \"цієї хвилини\",\n      \"past\" : \"{0} хв тому\",\n      \"future\" : \"через {0} хв\"\n    },\n    \"year\" : {\n      \"next\" : \"наступного року\",\n      \"future\" : \"через {0} р.\",\n      \"current\" : \"цього року\",\n      \"past\" : \"{0} р. тому\",\n      \"previous\" : \"торік\"\n    },\n    \"second\" : {\n      \"current\" : \"зараз\",\n      \"past\" : \"{0} с тому\",\n      \"future\" : \"через {0} с\"\n    },\n    \"hour\" : {\n      \"future\" : \"через {0} год\",\n      \"current\" : \"цієї години\",\n      \"past\" : \"{0} год тому\"\n    },\n    \"now\" : \"зараз\",\n    \"month\" : {\n      \"previous\" : \"минулого місяця\",\n      \"next\" : \"наступного місяця\",\n      \"past\" : \"{0} міс. тому\",\n      \"current\" : \"цього місяця\",\n      \"future\" : \"через {0} міс.\"\n    },\n    \"week\" : {\n      \"previous\" : \"минулого тижня\",\n      \"current\" : \"цього тижня\",\n      \"next\" : \"наступного тижня\",\n      \"past\" : \"{0} тиж. тому\",\n      \"future\" : \"через {0} тиж.\"\n    },\n    \"day\" : {\n      \"next\" : \"завтра\",\n      \"past\" : \"{0} дн. тому\",\n      \"future\" : \"через {0} дн.\",\n      \"previous\" : \"учора\",\n      \"current\" : \"сьогодні\"\n    }\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"previous\" : \"минулого тижня\",\n      \"current\" : \"цього тижня\",\n      \"past\" : \"{0} тиж. тому\",\n      \"future\" : \"за {0} тиж.\",\n      \"next\" : \"наступного тижня\"\n    },\n    \"quarter\" : {\n      \"next\" : \"наступного кв.\",\n      \"past\" : \"{0} кв. тому\",\n      \"future\" : \"за {0} кв.\",\n      \"previous\" : \"минулого кв.\",\n      \"current\" : \"цього кв.\"\n    },\n    \"minute\" : {\n      \"future\" : \"за {0} хв\",\n      \"current\" : \"цієї хвилини\",\n      \"past\" : \"{0} хв тому\"\n    },\n    \"day\" : {\n      \"previous\" : \"учора\",\n      \"current\" : \"сьогодні\",\n      \"next\" : \"завтра\",\n      \"past\" : {\n        \"other\" : \"-{0} дн.\",\n        \"one\" : \"{0} д. тому\"\n      },\n      \"future\" : \"за {0} д.\"\n    },\n    \"year\" : {\n      \"next\" : \"наступного року\",\n      \"past\" : \"{0} р. тому\",\n      \"current\" : \"цього року\",\n      \"previous\" : \"торік\",\n      \"future\" : \"за {0} р.\"\n    },\n    \"second\" : {\n      \"future\" : \"за {0} с\",\n      \"current\" : \"зараз\",\n      \"past\" : \"{0} с тому\"\n    },\n    \"month\" : {\n      \"current\" : \"цього місяця\",\n      \"future\" : \"за {0} міс.\",\n      \"past\" : \"{0} міс. тому\",\n      \"next\" : \"наступного місяця\",\n      \"previous\" : \"минулого місяця\"\n    },\n    \"now\" : \"зараз\",\n    \"hour\" : {\n      \"past\" : \"{0} год тому\",\n      \"current\" : \"цієї години\",\n      \"future\" : \"за {0} год\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ur.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"previous\" : \"گزشتہ سہ ماہی\",\n      \"current\" : \"اس سہ ماہی\",\n      \"next\" : \"اگلے سہ ماہی\",\n      \"past\" : \"{0} سہ ماہی پہلے\",\n      \"future\" : \"{0} سہ ماہی میں\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} ماہ پہلے\",\n      \"next\" : \"اگلے مہینہ\",\n      \"future\" : \"{0} ماہ میں\",\n      \"previous\" : \"پچھلے مہینہ\",\n      \"current\" : \"اس مہینہ\"\n    },\n    \"week\" : {\n      \"next\" : \"اگلے ہفتہ\",\n      \"previous\" : \"پچھلے ہفتہ\",\n      \"past\" : {\n        \"one\" : \"{0} ہفتہ پہلے\",\n        \"other\" : \"{0} ہفتے پہلے\"\n      },\n      \"future\" : {\n        \"other\" : \"{0} ہفتے میں\",\n        \"one\" : \"{0} ہفتہ میں\"\n      },\n      \"current\" : \"اس ہفتہ\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} سیکنڈ میں\",\n      \"current\" : \"اب\",\n      \"past\" : \"{0} سیکنڈ پہلے\"\n    },\n    \"day\" : {\n      \"current\" : \"آج\",\n      \"future\" : {\n        \"one\" : \"{0} دن میں\",\n        \"other\" : \"{0} دنوں میں\"\n      },\n      \"next\" : \"آئندہ کل\",\n      \"previous\" : \"گزشتہ کل\",\n      \"past\" : \"{0} دن پہلے\"\n    },\n    \"now\" : \"اب\",\n    \"hour\" : {\n      \"current\" : \"اس گھنٹے\",\n      \"future\" : {\n        \"one\" : \"{0} گھنٹہ میں\",\n        \"other\" : \"{0} گھنٹوں میں\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} گھنٹہ پہلے\",\n        \"other\" : \"{0} گھنٹے پہلے\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : \"{0} منٹ پہلے\",\n      \"current\" : \"اس منٹ\",\n      \"future\" : \"{0} منٹ میں\"\n    },\n    \"year\" : {\n      \"next\" : \"اگلے سال\",\n      \"past\" : \"{0} سال پہلے\",\n      \"future\" : \"{0} سال میں\",\n      \"previous\" : \"گزشتہ سال\",\n      \"current\" : \"اس سال\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"current\" : \"اس منٹ\",\n      \"past\" : \"{0} منٹ پہلے\",\n      \"future\" : \"{0} منٹ میں\"\n    },\n    \"month\" : {\n      \"current\" : \"اس مہینہ\",\n      \"past\" : \"{0} ماہ قبل\",\n      \"future\" : \"{0} ماہ میں\",\n      \"next\" : \"اگلے مہینہ\",\n      \"previous\" : \"پچھلے مہینہ\"\n    },\n    \"week\" : {\n      \"current\" : \"اس ہفتہ\",\n      \"past\" : \"{0} ہفتے پہلے\",\n      \"future\" : \"{0} ہفتے میں\",\n      \"next\" : \"اگلے ہفتہ\",\n      \"previous\" : \"پچھلے ہفتہ\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} گھنٹے پہلے\",\n      \"current\" : \"اس گھنٹے\",\n      \"future\" : \"{0} گھنٹے میں\"\n    },\n    \"day\" : {\n      \"next\" : \"آئندہ کل\",\n      \"current\" : \"آج\",\n      \"previous\" : \"گزشتہ کل\",\n      \"past\" : {\n        \"other\" : \"{0} دنوں پہلے\",\n        \"one\" : \"{0} دن پہلے\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} دن میں\",\n        \"other\" : \"{0} دنوں میں\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"{0} سیکنڈ میں\",\n      \"current\" : \"اب\",\n      \"past\" : \"{0} سیکنڈ پہلے\"\n    },\n    \"now\" : \"اب\",\n    \"year\" : {\n      \"current\" : \"اس سال\",\n      \"future\" : \"{0} سال میں\",\n      \"past\" : \"{0} سال پہلے\",\n      \"next\" : \"اگلے سال\",\n      \"previous\" : \"گزشتہ سال\"\n    },\n    \"quarter\" : {\n      \"current\" : \"اس سہ ماہی\",\n      \"future\" : \"{0} سہ ماہی میں\",\n      \"previous\" : \"گزشتہ سہ ماہی\",\n      \"next\" : \"اگلے سہ ماہی\",\n      \"past\" : \"{0} سہ ماہی قبل\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"گزشتہ کل\",\n      \"past\" : {\n        \"other\" : \"{0} دنوں پہلے\",\n        \"one\" : \"{0} دن پہلے\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} دن میں\",\n        \"other\" : \"{0} دنوں میں\"\n      },\n      \"next\" : \"آئندہ کل\",\n      \"current\" : \"آج\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} گھنٹے پہلے\",\n        \"one\" : \"{0} گھنٹہ پہلے\"\n      },\n      \"future\" : \"{0} گھنٹے میں\",\n      \"current\" : \"اس گھنٹے\"\n    },\n    \"month\" : {\n      \"next\" : \"اگلا مہینہ\",\n      \"current\" : \"اس مہینہ\",\n      \"past\" : {\n        \"one\" : \"{0} مہینہ پہلے\",\n        \"other\" : \"{0} مہینے پہلے\"\n      },\n      \"previous\" : \"پچھلا مہینہ\",\n      \"future\" : {\n        \"one\" : \"{0} مہینہ میں\",\n        \"other\" : \"{0} مہینے میں\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"اس سہ ماہی\",\n      \"past\" : \"{0} سہ ماہی پہلے\",\n      \"previous\" : \"گزشتہ سہ ماہی\",\n      \"future\" : \"{0} سہ ماہی میں\",\n      \"next\" : \"اگلے سہ ماہی\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} سال پہلے\",\n      \"previous\" : \"گزشتہ سال\",\n      \"next\" : \"اگلے سال\",\n      \"future\" : \"{0} سال میں\",\n      \"current\" : \"اس سال\"\n    },\n    \"minute\" : {\n      \"current\" : \"اس منٹ\",\n      \"future\" : \"{0} منٹ میں\",\n      \"past\" : \"{0} منٹ پہلے\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} سیکنڈ میں\",\n      \"current\" : \"اب\",\n      \"past\" : \"{0} سیکنڈ پہلے\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"{0} ہفتہ میں\",\n        \"other\" : \"{0} ہفتے میں\"\n      },\n      \"previous\" : \"پچھلے ہفتہ\",\n      \"current\" : \"اس ہفتہ\",\n      \"next\" : \"اگلے ہفتہ\",\n      \"past\" : {\n        \"one\" : \"{0} ہفتہ پہلے\",\n        \"other\" : \"{0} ہفتے پہلے\"\n      }\n    },\n    \"now\" : \"اب\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/ur_IN.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"previous\" : \"گزشتہ سہ ماہی\",\n      \"current\" : \"اس سہ ماہی\",\n      \"next\" : \"اگلے سہ ماہی\",\n      \"past\" : \"{0} سہ ماہی پہلے\",\n      \"future\" : \"{0} سہ ماہی میں\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} ماہ قبل\",\n      \"next\" : \"اگلے مہینہ\",\n      \"future\" : \"{0} ماہ میں\",\n      \"previous\" : \"پچھلے مہینہ\",\n      \"current\" : \"اس مہینہ\"\n    },\n    \"week\" : {\n      \"next\" : \"اگلے ہفتہ\",\n      \"previous\" : \"پچھلے ہفتہ\",\n      \"past\" : {\n        \"other\" : \"{0} ہفتے قبل\",\n        \"one\" : \"{0} ہفتہ قبل\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} ہفتہ میں\",\n        \"other\" : \"{0} ہفتے میں\"\n      },\n      \"current\" : \"اس ہفتہ\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} سیکنڈ میں\",\n      \"current\" : \"اب\",\n      \"past\" : \"{0} سیکنڈ قبل\"\n    },\n    \"day\" : {\n      \"current\" : \"آج\",\n      \"future\" : {\n        \"one\" : \"{0} دن میں\",\n        \"other\" : \"{0} دنوں میں\"\n      },\n      \"next\" : \"آئندہ کل\",\n      \"previous\" : \"گزشتہ کل\",\n      \"past\" : \"{0} دن قبل\"\n    },\n    \"now\" : \"اب\",\n    \"hour\" : {\n      \"future\" : {\n        \"other\" : \"{0} گھنٹوں میں\",\n        \"one\" : \"{0} گھنٹہ میں\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} گھنٹہ قبل\",\n        \"other\" : \"{0} گھنٹے قبل\"\n      },\n      \"current\" : \"اس گھنٹے\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} منٹ میں\",\n      \"current\" : \"اس منٹ\",\n      \"past\" : \"{0} منٹ قبل\"\n    },\n    \"year\" : {\n      \"next\" : \"اگلے سال\",\n      \"past\" : \"{0} سال پہلے\",\n      \"future\" : \"{0} سال میں\",\n      \"previous\" : \"گزشتہ سال\",\n      \"current\" : \"اس سال\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"گزشتہ کل\",\n      \"past\" : {\n        \"other\" : \"{0} دنوں پہلے\",\n        \"one\" : \"{0} دن پہلے\"\n      },\n      \"future\" : {\n        \"one\" : \"{0} دن میں\",\n        \"other\" : \"{0} دنوں میں\"\n      },\n      \"next\" : \"آئندہ کل\",\n      \"current\" : \"آج\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"{0} گھنٹے پہلے\",\n        \"one\" : \"{0} گھنٹہ پہلے\"\n      },\n      \"future\" : \"{0} گھنٹے میں\",\n      \"current\" : \"اس گھنٹے\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ماہ میں\",\n      \"past\" : \"{0} ماہ قبل\",\n      \"next\" : \"اگلے ماہ\",\n      \"current\" : \"اس ماہ\",\n      \"previous\" : \"گزشتہ ماہ\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"گزشتہ سہ ماہی\",\n      \"next\" : \"اگلے سہ ماہی\",\n      \"past\" : \"{0} سہ ماہی پہلے\",\n      \"future\" : \"{0} سہ ماہی میں\",\n      \"current\" : \"اس سہ ماہی\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} سال پہلے\",\n      \"previous\" : \"گزشتہ سال\",\n      \"next\" : \"اگلے سال\",\n      \"future\" : {\n        \"one\" : \"{0} سال میں\",\n        \"other\" : \"{0} سالوں میں\"\n      },\n      \"current\" : \"اس سال\"\n    },\n    \"minute\" : {\n      \"current\" : \"اس منٹ\",\n      \"future\" : \"{0} منٹ میں\",\n      \"past\" : \"{0} منٹ قبل\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} سیکنڈ میں\",\n      \"current\" : \"اب\",\n      \"past\" : \"{0} سیکنڈ قبل\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"one\" : \"{0} ہفتہ میں\",\n        \"other\" : \"{0} ہفتوں میں\"\n      },\n      \"previous\" : \"گزشتہ ہفتہ\",\n      \"current\" : \"اس ہفتہ\",\n      \"next\" : \"اگلے ہفتہ\",\n      \"past\" : {\n        \"one\" : \"{0} ہفتہ قبل\",\n        \"other\" : \"{0} ہفتے قبل\"\n      }\n    },\n    \"now\" : \"اب\"\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"{0} منٹ میں\",\n      \"current\" : \"اس منٹ\",\n      \"past\" : \"{0} منٹ قبل\"\n    },\n    \"month\" : {\n      \"current\" : \"اس مہینہ\",\n      \"past\" : \"{0} ماہ قبل\",\n      \"future\" : \"{0} ماہ میں\",\n      \"next\" : \"اگلے مہینہ\",\n      \"previous\" : \"پچھلے مہینہ\"\n    },\n    \"week\" : {\n      \"current\" : \"اس ہفتہ\",\n      \"past\" : \"{0} ہفتے قبل\",\n      \"future\" : \"{0} ہفتے میں\",\n      \"next\" : \"اگلے ہفتہ\",\n      \"previous\" : \"پچھلے ہفتہ\"\n    },\n    \"hour\" : {\n      \"current\" : \"اس گھنٹے\",\n      \"past\" : \"{0} گھنٹے قبل\",\n      \"future\" : \"{0} گھنٹے میں\"\n    },\n    \"day\" : {\n      \"next\" : \"آئندہ کل\",\n      \"current\" : \"آج\",\n      \"previous\" : \"گزشتہ کل\",\n      \"past\" : {\n        \"one\" : \"{0} دن پہلے\",\n        \"other\" : \"{0} دنوں پہلے\"\n      },\n      \"future\" : \"{0} دنوں میں\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} سیکنڈ میں\",\n      \"current\" : \"اب\",\n      \"past\" : \"{0} سیکنڈ قبل\"\n    },\n    \"now\" : \"اب\",\n    \"year\" : {\n      \"future\" : {\n        \"one\" : \"{0} سال میں\",\n        \"other\" : \"{0} سالوں میں\"\n      },\n      \"previous\" : \"گزشتہ سال\",\n      \"next\" : \"اگلے سال\",\n      \"current\" : \"اس سال\",\n      \"past\" : {\n        \"other\" : \"{0} سالوں پہلے\",\n        \"one\" : \"{0} سال پہلے\"\n      }\n    },\n    \"quarter\" : {\n      \"current\" : \"اس سہ ماہی\",\n      \"future\" : \"{0} سہ ماہی میں\",\n      \"previous\" : \"گزشتہ سہ ماہی\",\n      \"next\" : \"اگلے سہ ماہی\",\n      \"past\" : \"{0} سہ ماہی قبل\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/uz.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"{0} chorak oldin\",\n      \"future\" : \"{0} chorakdan keyin\",\n      \"current\" : \"shu chorak\",\n      \"previous\" : \"o‘tgan chorak\",\n      \"next\" : \"keyingi chorak\"\n    },\n    \"year\" : {\n      \"previous\" : \"oʻtgan yil\",\n      \"next\" : \"keyingi yil\",\n      \"future\" : \"{0} yildan keyin\",\n      \"current\" : \"bu yil\",\n      \"past\" : \"{0} yil oldin\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} haftadan keyin\",\n      \"previous\" : \"o‘tgan hafta\",\n      \"next\" : \"keyingi hafta\",\n      \"past\" : \"{0} hafta oldin\",\n      \"current\" : \"shu hafta\"\n    },\n    \"day\" : {\n      \"current\" : \"bugun\",\n      \"past\" : \"{0} kun oldin\",\n      \"next\" : \"ertaga\",\n      \"future\" : \"{0} kundan keyin\",\n      \"previous\" : \"kecha\"\n    },\n    \"hour\" : {\n      \"current\" : \"shu soatda\",\n      \"past\" : \"{0} soat oldin\",\n      \"future\" : \"{0} soatdan keyin\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} daqiqadan keyin\",\n      \"current\" : \"shu daqiqada\",\n      \"past\" : \"{0} daqiqa oldin\"\n    },\n    \"month\" : {\n      \"next\" : \"keyingi oy\",\n      \"current\" : \"shu oy\",\n      \"past\" : \"{0} oy oldin\",\n      \"future\" : \"{0} oydan keyin\",\n      \"previous\" : \"o‘tgan oy\"\n    },\n    \"now\" : \"hozir\",\n    \"second\" : {\n      \"future\" : \"{0} soniyadan keyin\",\n      \"current\" : \"hozir\",\n      \"past\" : \"{0} soniya oldin\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} daqiqa oldin\",\n      \"future\" : \"{0} daqiqadan keyin\",\n      \"current\" : \"shu daqiqada\"\n    },\n    \"week\" : {\n      \"current\" : \"shu hafta\",\n      \"past\" : \"{0} hafta oldin\",\n      \"future\" : \"{0} haftadan keyin\",\n      \"next\" : \"keyingi hafta\",\n      \"previous\" : \"o‘tgan hafta\"\n    },\n    \"year\" : {\n      \"future\" : \"{0} yildan keyin\",\n      \"previous\" : \"oʻtgan yil\",\n      \"next\" : \"keyingi yil\",\n      \"current\" : \"bu yil\",\n      \"past\" : \"{0} yil oldin\"\n    },\n    \"day\" : {\n      \"next\" : \"ertaga\",\n      \"current\" : \"bugun\",\n      \"previous\" : \"kecha\",\n      \"past\" : \"{0} kun oldin\",\n      \"future\" : \"{0} kundan keyin\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} soatdan keyin\",\n      \"current\" : \"shu soatda\",\n      \"past\" : \"{0} soat oldin\"\n    },\n    \"quarter\" : {\n      \"current\" : \"shu chorak\",\n      \"future\" : \"{0} chorakdan keyin\",\n      \"previous\" : \"o‘tgan chorak\",\n      \"next\" : \"keyingi chorak\",\n      \"past\" : \"{0} chorak oldin\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} soniya oldin\",\n      \"current\" : \"hozir\",\n      \"future\" : \"{0} soniyadan keyin\"\n    },\n    \"month\" : {\n      \"current\" : \"shu oy\",\n      \"past\" : \"{0} oy oldin\",\n      \"future\" : \"{0} oydan keyin\",\n      \"next\" : \"keyingi oy\",\n      \"previous\" : \"o‘tgan oy\"\n    },\n    \"now\" : \"hozir\"\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} soatdan keyin\",\n      \"current\" : \"shu soatda\",\n      \"past\" : \"{0} soat oldin\"\n    },\n    \"day\" : {\n      \"next\" : \"ertaga\",\n      \"past\" : \"{0} kun oldin\",\n      \"previous\" : \"kecha\",\n      \"future\" : \"{0} kundan keyin\",\n      \"current\" : \"bugun\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} soniya oldin\",\n      \"current\" : \"hozir\",\n      \"future\" : \"{0} soniyadan keyin\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} haftadan keyin\",\n      \"past\" : \"{0} hafta oldin\",\n      \"current\" : \"shu hafta\",\n      \"next\" : \"keyingi hafta\",\n      \"previous\" : \"o‘tgan hafta\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} daqiqadan keyin\",\n      \"past\" : \"{0} daqiqa oldin\",\n      \"current\" : \"shu daqiqada\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} oydan keyin\",\n      \"past\" : \"{0} oy oldin\",\n      \"current\" : \"shu oy\",\n      \"previous\" : \"o‘tgan oy\",\n      \"next\" : \"keyingi oy\"\n    },\n    \"now\" : \"hozir\",\n    \"year\" : {\n      \"current\" : \"shu yil\",\n      \"next\" : \"keyingi yil\",\n      \"previous\" : \"o‘tgan yil\",\n      \"future\" : \"{0} yildan keyin\",\n      \"past\" : \"{0} yil oldin\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} chorakdan keyin\",\n      \"previous\" : \"o‘tgan chorak\",\n      \"past\" : \"{0} chorak oldin\",\n      \"next\" : \"keyingi chorak\",\n      \"current\" : \"shu chorak\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/uz_Cyrl.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\"\n    },\n    \"year\" : {\n      \"previous\" : \"ўтган йил\",\n      \"next\" : \"кейинги йил\",\n      \"future\" : \"{0} йилдан сўнг\",\n      \"current\" : \"бу йил\",\n      \"past\" : \"{0} йил аввал\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} ҳафтадан сўнг\",\n      \"previous\" : \"ўтган ҳафта\",\n      \"next\" : \"кейинги ҳафта\",\n      \"past\" : \"{0} ҳафта олдин\",\n      \"current\" : \"бу ҳафта\"\n    },\n    \"day\" : {\n      \"current\" : \"бугун\",\n      \"past\" : \"{0} кун олдин\",\n      \"next\" : \"эртага\",\n      \"future\" : \"{0} кундан сўнг\",\n      \"previous\" : \"кеча\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} соат олдин\",\n      \"future\" : \"{0} соатдан сўнг\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} дақиқадан сўнг\",\n      \"current\" : \"this minute\",\n      \"past\" : \"{0} дақиқа олдин\"\n    },\n    \"month\" : {\n      \"next\" : \"кейинги ой\",\n      \"current\" : \"бу ой\",\n      \"past\" : \"{0} ой аввал\",\n      \"future\" : \"{0} ойдан сўнг\",\n      \"previous\" : \"ўтган ой\"\n    },\n    \"now\" : \"ҳозир\",\n    \"second\" : {\n      \"future\" : \"{0} сониядан сўнг\",\n      \"current\" : \"ҳозир\",\n      \"past\" : \"{0} сония олдин\"\n    }\n  },\n  \"long\" : {\n    \"hour\" : {\n      \"future\" : \"{0} соатдан сўнг\",\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} соат олдин\"\n    },\n    \"day\" : {\n      \"next\" : \"эртага\",\n      \"past\" : \"{0} кун олдин\",\n      \"previous\" : \"кеча\",\n      \"future\" : \"{0} кундан сўнг\",\n      \"current\" : \"бугун\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} сония олдин\",\n      \"current\" : \"ҳозир\",\n      \"future\" : \"{0} сониядан сўнг\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} ҳафтадан сўнг\",\n      \"past\" : \"{0} ҳафта олдин\",\n      \"current\" : \"бу ҳафта\",\n      \"next\" : \"кейинги ҳафта\",\n      \"previous\" : \"ўтган ҳафта\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} дақиқадан сўнг\",\n      \"past\" : \"{0} дақиқа олдин\",\n      \"current\" : \"this minute\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} ойдан сўнг\",\n      \"past\" : \"{0} ой аввал\",\n      \"current\" : \"бу ой\",\n      \"previous\" : \"ўтган ой\",\n      \"next\" : \"кейинги ой\"\n    },\n    \"now\" : \"ҳозир\",\n    \"year\" : {\n      \"current\" : \"бу йил\",\n      \"next\" : \"кейинги йил\",\n      \"previous\" : \"ўтган йил\",\n      \"future\" : \"{0} йилдан сўнг\",\n      \"past\" : \"{0} йил аввал\"\n    },\n    \"quarter\" : {\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"past\" : \"-{0} Q\",\n      \"next\" : \"next quarter\",\n      \"current\" : \"this quarter\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0} дақиқа олдин\",\n      \"future\" : \"{0} дақиқадан сўнг\",\n      \"current\" : \"this minute\"\n    },\n    \"week\" : {\n      \"current\" : \"бу ҳафта\",\n      \"past\" : \"{0} ҳафта олдин\",\n      \"future\" : \"{0} ҳафтадан сўнг\",\n      \"next\" : \"кейинги ҳафта\",\n      \"previous\" : \"ўтган ҳафта\"\n    },\n    \"year\" : {\n      \"future\" : \"{0} йилдан сўнг\",\n      \"previous\" : \"ўтган йил\",\n      \"next\" : \"кейинги йил\",\n      \"current\" : \"бу йил\",\n      \"past\" : \"{0} йил аввал\"\n    },\n    \"day\" : {\n      \"next\" : \"эртага\",\n      \"current\" : \"бугун\",\n      \"previous\" : \"кеча\",\n      \"past\" : \"{0} кун олдин\",\n      \"future\" : \"{0} кундан сўнг\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} соатдан сўнг\",\n      \"current\" : \"this hour\",\n      \"past\" : \"{0} соат олдин\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} сония олдин\",\n      \"current\" : \"ҳозир\",\n      \"future\" : \"{0} сониядан сўнг\"\n    },\n    \"month\" : {\n      \"current\" : \"бу ой\",\n      \"past\" : \"{0} ой аввал\",\n      \"future\" : \"{0} ойдан сўнг\",\n      \"next\" : \"кейинги ой\",\n      \"previous\" : \"ўтган ой\"\n    },\n    \"now\" : \"ҳозир\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/vi.json",
    "content": "{\n  \"narrow\" : {\n    \"week\" : {\n      \"past\" : \"{0} tuần trước\",\n      \"future\" : \"sau {0} tuần nữa\",\n      \"current\" : \"tuần này\",\n      \"previous\" : \"tuần trước\",\n      \"next\" : \"tuần sau\"\n    },\n    \"hour\" : {\n      \"current\" : \"giờ này\",\n      \"past\" : \"{0} giờ trước\",\n      \"future\" : \"sau {0} giờ nữa\"\n    },\n    \"now\" : \"bây giờ\",\n    \"day\" : {\n      \"next\" : \"Ngày mai\",\n      \"current\" : \"Hôm nay\",\n      \"past\" : \"{0} ngày trước\",\n      \"future\" : \"sau {0} ngày nữa\",\n      \"previous\" : \"Hôm qua\"\n    },\n    \"minute\" : {\n      \"future\" : \"sau {0} phút nữa\",\n      \"current\" : \"phút này\",\n      \"past\" : \"{0} phút trước\"\n    },\n    \"quarter\" : {\n      \"next\" : \"quý sau\",\n      \"future\" : \"sau {0} quý nữa\",\n      \"previous\" : \"quý trước\",\n      \"current\" : \"quý này\",\n      \"past\" : \"{0} quý trước\"\n    },\n    \"second\" : {\n      \"future\" : \"sau {0} giây nữa\",\n      \"current\" : \"bây giờ\",\n      \"past\" : \"{0} giây trước\"\n    },\n    \"year\" : {\n      \"next\" : \"năm sau\",\n      \"previous\" : \"năm ngoái\",\n      \"current\" : \"năm nay\",\n      \"future\" : \"sau {0} năm nữa\",\n      \"past\" : \"{0} năm trước\"\n    },\n    \"month\" : {\n      \"previous\" : \"tháng trước\",\n      \"next\" : \"tháng sau\",\n      \"future\" : \"sau {0} tháng nữa\",\n      \"current\" : \"tháng này\",\n      \"past\" : \"{0} tháng trước\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : \"sau {0} giờ nữa\",\n      \"current\" : \"giờ này\",\n      \"past\" : \"{0} giờ trước\"\n    },\n    \"now\" : \"bây giờ\",\n    \"quarter\" : {\n      \"future\" : \"sau {0} quý nữa\",\n      \"previous\" : \"quý trước\",\n      \"next\" : \"quý sau\",\n      \"current\" : \"quý này\",\n      \"past\" : \"{0} quý trước\"\n    },\n    \"day\" : {\n      \"current\" : \"Hôm nay\",\n      \"past\" : \"{0} ngày trước\",\n      \"future\" : \"sau {0} ngày nữa\",\n      \"next\" : \"Ngày mai\",\n      \"previous\" : \"Hôm qua\"\n    },\n    \"week\" : {\n      \"current\" : \"tuần này\",\n      \"future\" : \"sau {0} tuần nữa\",\n      \"previous\" : \"tuần trước\",\n      \"next\" : \"tuần sau\",\n      \"past\" : \"{0} tuần trước\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} phút trước\",\n      \"future\" : \"sau {0} phút nữa\",\n      \"current\" : \"phút này\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} giây trước\",\n      \"current\" : \"bây giờ\",\n      \"future\" : \"sau {0} giây nữa\"\n    },\n    \"month\" : {\n      \"current\" : \"tháng này\",\n      \"future\" : \"sau {0} tháng nữa\",\n      \"past\" : \"{0} tháng trước\",\n      \"next\" : \"tháng sau\",\n      \"previous\" : \"tháng trước\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} năm trước\",\n      \"future\" : \"sau {0} năm nữa\",\n      \"previous\" : \"năm ngoái\",\n      \"current\" : \"năm nay\",\n      \"next\" : \"năm sau\"\n    }\n  },\n  \"long\" : {\n    \"month\" : {\n      \"current\" : \"tháng này\",\n      \"next\" : \"tháng sau\",\n      \"previous\" : \"tháng trước\",\n      \"future\" : \"sau {0} tháng nữa\",\n      \"past\" : \"{0} tháng trước\"\n    },\n    \"quarter\" : {\n      \"future\" : \"sau {0} quý nữa\",\n      \"next\" : \"quý sau\",\n      \"past\" : \"{0} quý trước\",\n      \"previous\" : \"quý trước\",\n      \"current\" : \"quý này\"\n    },\n    \"minute\" : {\n      \"future\" : \"sau {0} phút nữa\",\n      \"past\" : \"{0} phút trước\",\n      \"current\" : \"phút này\"\n    },\n    \"day\" : {\n      \"future\" : \"sau {0} ngày nữa\",\n      \"past\" : \"{0} ngày trước\",\n      \"current\" : \"Hôm nay\",\n      \"previous\" : \"Hôm qua\",\n      \"next\" : \"Ngày mai\"\n    },\n    \"year\" : {\n      \"previous\" : \"năm ngoái\",\n      \"current\" : \"năm nay\",\n      \"future\" : \"sau {0} năm nữa\",\n      \"next\" : \"năm sau\",\n      \"past\" : \"{0} năm trước\"\n    },\n    \"week\" : {\n      \"future\" : \"sau {0} tuần nữa\",\n      \"previous\" : \"tuần trước\",\n      \"past\" : \"{0} tuần trước\",\n      \"next\" : \"tuần sau\",\n      \"current\" : \"tuần này\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} giây trước\",\n      \"current\" : \"bây giờ\",\n      \"future\" : \"sau {0} giây nữa\"\n    },\n    \"hour\" : {\n      \"future\" : \"sau {0} giờ nữa\",\n      \"current\" : \"giờ này\",\n      \"past\" : \"{0} giờ trước\"\n    },\n    \"now\" : \"bây giờ\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/wae.json",
    "content": "{\n  \"narrow\" : {\n    \"week\" : {\n      \"next\" : \"next week\",\n      \"current\" : \"this week\",\n      \"previous\" : \"last week\",\n      \"past\" : {\n        \"one\" : \"vor {0} wuča\",\n        \"other\" : \"cor {0} wučä\"\n      },\n      \"future\" : {\n        \"other\" : \"i {0} wučä\",\n        \"one\" : \"i {0} wuča\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"other\" : \"vor {0} stunde\",\n        \"one\" : \"vor {0} stund\"\n      },\n      \"future\" : {\n        \"other\" : \"i {0} stunde\",\n        \"one\" : \"i {0} stund\"\n      },\n      \"current\" : \"this hour\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"past\" : {\n        \"one\" : \"vor {0} sekund\",\n        \"other\" : \"vor {0} sekunde\"\n      },\n      \"future\" : {\n        \"one\" : \"i {0} sekund\",\n        \"other\" : \"i {0} sekunde\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"current\" : \"this quarter\",\n      \"previous\" : \"last quarter\",\n      \"future\" : \"+{0} Q\"\n    },\n    \"now\" : \"now\",\n    \"day\" : {\n      \"future\" : {\n        \"other\" : \"i {0} täg\",\n        \"one\" : \"i {0} tag\"\n      },\n      \"current\" : \"Hitte\",\n      \"next\" : \"Móre\",\n      \"past\" : {\n        \"one\" : \"vor {0} tag\",\n        \"other\" : \"vor {0} täg\"\n      },\n      \"previous\" : \"Gešter\"\n    },\n    \"month\" : {\n      \"next\" : \"next month\",\n      \"past\" : \"vor {0} mánet\",\n      \"future\" : \"I {0} mánet\",\n      \"previous\" : \"last month\",\n      \"current\" : \"this month\"\n    },\n    \"year\" : {\n      \"previous\" : \"last year\",\n      \"past\" : {\n        \"one\" : \"vor {0} jár\",\n        \"other\" : \"cor {0} jár\"\n      },\n      \"current\" : \"this year\",\n      \"next\" : \"next year\",\n      \"future\" : \"I {0} jár\"\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"other\" : \"vor {0} minüte\",\n        \"one\" : \"vor {0} minüta\"\n      },\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"i {0} minüta\",\n        \"other\" : \"i {0} minüte\"\n      }\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"next\" : \"Móre\",\n      \"future\" : {\n        \"one\" : \"i {0} tag\",\n        \"other\" : \"i {0} täg\"\n      },\n      \"current\" : \"Hitte\",\n      \"previous\" : \"Gešter\",\n      \"past\" : {\n        \"one\" : \"vor {0} tag\",\n        \"other\" : \"vor {0} täg\"\n      }\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"past\" : {\n        \"other\" : \"vor {0} minüte\",\n        \"one\" : \"vor {0} minüta\"\n      },\n      \"future\" : {\n        \"other\" : \"i {0} minüte\",\n        \"one\" : \"i {0} minüta\"\n      }\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : {\n        \"other\" : \"i {0} sekunde\",\n        \"one\" : \"i {0} sekund\"\n      },\n      \"past\" : {\n        \"one\" : \"vor {0} sekund\",\n        \"other\" : \"vor {0} sekunde\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"vor {0} mánet\",\n      \"previous\" : \"last month\",\n      \"current\" : \"this month\",\n      \"next\" : \"next month\",\n      \"future\" : \"I {0} mánet\"\n    },\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"i {0} wučä\",\n        \"one\" : \"i {0} wuča\"\n      },\n      \"next\" : \"next week\",\n      \"current\" : \"this week\",\n      \"past\" : {\n        \"one\" : \"vor {0} wuča\",\n        \"other\" : \"cor {0} wučä\"\n      },\n      \"previous\" : \"last week\"\n    },\n    \"now\" : \"now\",\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"vor {0} stund\",\n        \"other\" : \"vor {0} stunde\"\n      },\n      \"current\" : \"this hour\",\n      \"future\" : {\n        \"one\" : \"i {0} stund\",\n        \"other\" : \"i {0} stunde\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"last year\",\n      \"current\" : \"this year\",\n      \"next\" : \"next year\",\n      \"past\" : {\n        \"one\" : \"vor {0} jár\",\n        \"other\" : \"cor {0} jár\"\n      },\n      \"future\" : \"I {0} jár\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"past\" : \"-{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\"\n    }\n  },\n  \"short\" : {\n    \"week\" : {\n      \"future\" : {\n        \"other\" : \"i {0} wučä\",\n        \"one\" : \"i {0} wuča\"\n      },\n      \"next\" : \"next week\",\n      \"current\" : \"this week\",\n      \"past\" : {\n        \"one\" : \"vor {0} wuča\",\n        \"other\" : \"cor {0} wučä\"\n      },\n      \"previous\" : \"last week\"\n    },\n    \"minute\" : {\n      \"current\" : \"this minute\",\n      \"future\" : {\n        \"one\" : \"i {0} minüta\",\n        \"other\" : \"i {0} minüte\"\n      },\n      \"past\" : {\n        \"other\" : \"vor {0} minüte\",\n        \"one\" : \"vor {0} minüta\"\n      }\n    },\n    \"day\" : {\n      \"next\" : \"Móre\",\n      \"current\" : \"Hitte\",\n      \"previous\" : \"Gešter\",\n      \"future\" : {\n        \"one\" : \"i {0} tag\",\n        \"other\" : \"i {0} täg\"\n      },\n      \"past\" : {\n        \"other\" : \"vor {0} täg\",\n        \"one\" : \"vor {0} tag\"\n      }\n    },\n    \"now\" : \"now\",\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"vor {0} sekund\",\n        \"other\" : \"vor {0} sekunde\"\n      },\n      \"future\" : {\n        \"one\" : \"i {0} sekund\",\n        \"other\" : \"i {0} sekunde\"\n      },\n      \"current\" : \"now\"\n    },\n    \"hour\" : {\n      \"current\" : \"this hour\",\n      \"past\" : {\n        \"other\" : \"vor {0} stunde\",\n        \"one\" : \"vor {0} stund\"\n      },\n      \"future\" : {\n        \"one\" : \"i {0} stund\",\n        \"other\" : \"i {0} stunde\"\n      }\n    },\n    \"month\" : {\n      \"past\" : \"vor {0} mánet\",\n      \"future\" : \"I {0} mánet\",\n      \"next\" : \"next month\",\n      \"previous\" : \"last month\",\n      \"current\" : \"this month\"\n    },\n    \"year\" : {\n      \"past\" : {\n        \"one\" : \"vor {0} jár\",\n        \"other\" : \"cor {0} jár\"\n      },\n      \"future\" : \"I {0} jár\",\n      \"previous\" : \"last year\",\n      \"current\" : \"this year\",\n      \"next\" : \"next year\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"future\" : \"+{0} Q\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\",\n      \"current\" : \"this quarter\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/yi.json",
    "content": "{\n  \"long\" : {\n    \"quarter\" : {\n      \"next\" : \"next quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"past\" : \"-{0} Q\",\n      \"current\" : \"this quarter\"\n    },\n    \"month\" : {\n      \"current\" : \"דעם חודש\",\n      \"next\" : \"קומענדיקן חודש\",\n      \"previous\" : \"פֿאַרגאנגענעם חודש\",\n      \"past\" : {\n        \"one\" : \"פֿאַר {0} חודש\",\n        \"other\" : \"פֿאַר {0} חדשים\"\n      },\n      \"future\" : {\n        \"one\" : \"איבער {0} חודש\",\n        \"other\" : \"איבער {0} חדשים\"\n      }\n    },\n    \"second\" : {\n      \"future\" : \"+{0} s\",\n      \"current\" : \"now\",\n      \"past\" : \"-{0} s\"\n    },\n    \"hour\" : {\n      \"past\" : \"-{0} h\",\n      \"current\" : \"this hour\",\n      \"future\" : \"+{0} h\"\n    },\n    \"day\" : {\n      \"future\" : {\n        \"one\" : \"אין {0} טאָג אַרום\",\n        \"other\" : \"אין {0} טעג אַרום\"\n      },\n      \"previous\" : \"נעכטן\",\n      \"past\" : \"-{0} d\",\n      \"next\" : \"מארגן\",\n      \"current\" : \"היינט\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\"\n    },\n    \"week\" : {\n      \"past\" : \"-{0} w\",\n      \"previous\" : \"last week\",\n      \"future\" : \"+{0} w\",\n      \"current\" : \"this week\",\n      \"next\" : \"איבער אַכט טאָג\"\n    },\n    \"year\" : {\n      \"next\" : \"איבער א יאָר\",\n      \"current\" : \"הײַ יאָר\",\n      \"previous\" : \"פֿאַראַיאָר\",\n      \"future\" : \"איבער {0} יאָר\",\n      \"past\" : \"פֿאַר {0} יאָר\"\n    },\n    \"now\" : \"now\"\n  },\n  \"narrow\" : {\n    \"year\" : {\n      \"current\" : \"הײַ יאָר\",\n      \"next\" : \"איבער א יאָר\",\n      \"past\" : \"פֿאַר {0} יאָר\",\n      \"future\" : \"איבער {0} יאָר\",\n      \"previous\" : \"פֿאַראַיאָר\"\n    },\n    \"second\" : {\n      \"past\" : \"-{0} s\",\n      \"future\" : \"+{0} s\",\n      \"current\" : \"now\"\n    },\n    \"hour\" : {\n      \"future\" : \"+{0} h\",\n      \"current\" : \"this hour\",\n      \"past\" : \"-{0} h\"\n    },\n    \"week\" : {\n      \"current\" : \"this week\",\n      \"previous\" : \"last week\",\n      \"past\" : \"-{0} w\",\n      \"next\" : \"איבער אַכט טאָג\",\n      \"future\" : \"+{0} w\"\n    },\n    \"day\" : {\n      \"current\" : \"היינט\",\n      \"next\" : \"מארגן\",\n      \"past\" : \"-{0} d\",\n      \"previous\" : \"נעכטן\",\n      \"future\" : {\n        \"one\" : \"אין {0} טאָג אַרום\",\n        \"other\" : \"אין {0} טעג אַרום\"\n      }\n    },\n    \"month\" : {\n      \"current\" : \"דעם חודש\",\n      \"next\" : \"קומענדיקן חודש\",\n      \"past\" : {\n        \"one\" : \"פֿאַר {0} חודש\",\n        \"other\" : \"פֿאַר {0} חדשים\"\n      },\n      \"previous\" : \"פֿאַרגאנגענעם חודש\",\n      \"future\" : {\n        \"one\" : \"איבער {0} חודש\",\n        \"other\" : \"איבער {0} חדשים\"\n      }\n    },\n    \"now\" : \"now\",\n    \"minute\" : {\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\",\n      \"past\" : \"-{0} min\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"last quarter\",\n      \"current\" : \"this quarter\",\n      \"past\" : \"-{0} Q\",\n      \"future\" : \"+{0} Q\",\n      \"next\" : \"next quarter\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"next\" : \"קומענדיקן חודש\",\n      \"past\" : {\n        \"one\" : \"פֿאַר {0} חודש\",\n        \"other\" : \"פֿאַר {0} חדשים\"\n      },\n      \"current\" : \"דעם חודש\",\n      \"previous\" : \"פֿאַרגאנגענעם חודש\",\n      \"future\" : {\n        \"one\" : \"איבער {0} חודש\",\n        \"other\" : \"איבער {0} חדשים\"\n      }\n    },\n    \"now\" : \"now\",\n    \"day\" : {\n      \"next\" : \"מארגן\",\n      \"current\" : \"היינט\",\n      \"previous\" : \"נעכטן\",\n      \"past\" : \"-{0} d\",\n      \"future\" : {\n        \"other\" : \"אין {0} טעג אַרום\",\n        \"one\" : \"אין {0} טאָג אַרום\"\n      }\n    },\n    \"year\" : {\n      \"previous\" : \"פֿאַראַיאָר\",\n      \"current\" : \"הײַ יאָר\",\n      \"next\" : \"איבער א יאָר\",\n      \"past\" : \"פֿאַר {0} יאָר\",\n      \"future\" : {\n        \"other\" : \"איבער {0} יאָר\",\n        \"one\" : \"איבער א יאָר\"\n      }\n    },\n    \"hour\" : {\n      \"past\" : \"-{0} h\",\n      \"future\" : \"+{0} h\",\n      \"current\" : \"this hour\"\n    },\n    \"minute\" : {\n      \"past\" : \"-{0} min\",\n      \"future\" : \"+{0} min\",\n      \"current\" : \"this minute\"\n    },\n    \"second\" : {\n      \"current\" : \"now\",\n      \"future\" : \"+{0} s\",\n      \"past\" : \"-{0} s\"\n    },\n    \"quarter\" : {\n      \"current\" : \"this quarter\",\n      \"future\" : \"+{0} Q\",\n      \"previous\" : \"last quarter\",\n      \"next\" : \"next quarter\",\n      \"past\" : \"-{0} Q\"\n    },\n    \"week\" : {\n      \"future\" : \"+{0} w\",\n      \"previous\" : \"last week\",\n      \"next\" : \"איבער אַכט טאָג\",\n      \"past\" : \"-{0} w\",\n      \"current\" : \"this week\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/yue_Hans.json",
    "content": "{\n  \"narrow\" : {\n    \"day\" : {\n      \"next\" : \"听日\",\n      \"future\" : \"{0} 日后\",\n      \"previous\" : \"寻日\",\n      \"current\" : \"今日\",\n      \"past\" : \"{0} 日前\"\n    },\n    \"quarter\" : {\n      \"next\" : \"下季\",\n      \"past\" : \"{0} 季前\",\n      \"future\" : \"{0} 季后\",\n      \"previous\" : \"上季\",\n      \"current\" : \"今季\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} 小时后\",\n      \"current\" : \"呢个小时\",\n      \"past\" : \"{0} 小时前\"\n    },\n    \"year\" : {\n      \"next\" : \"下年\",\n      \"past\" : \"{0} 年前\",\n      \"current\" : \"今年\",\n      \"previous\" : \"旧年\",\n      \"future\" : \"{0} 年后\"\n    },\n    \"now\" : \"宜家\",\n    \"month\" : {\n      \"current\" : \"今个月\",\n      \"future\" : \"{0} 个月后\",\n      \"past\" : \"{0} 个月前\",\n      \"next\" : \"下个月\",\n      \"previous\" : \"上个月\"\n    },\n    \"week\" : {\n      \"previous\" : \"上星期\",\n      \"current\" : \"今个星期\",\n      \"past\" : \"{0} 个星期前\",\n      \"future\" : \"{0} 个星期后\",\n      \"next\" : \"下星期\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} 分钟前\",\n      \"future\" : \"{0} 分钟后\",\n      \"current\" : \"呢分钟\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} 秒前\",\n      \"current\" : \"宜家\",\n      \"future\" : \"{0} 秒后\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"previous\" : \"寻日\",\n      \"current\" : \"今日\",\n      \"next\" : \"听日\",\n      \"past\" : \"{0} 日前\",\n      \"future\" : \"{0} 日后\"\n    },\n    \"week\" : {\n      \"current\" : \"今个星期\",\n      \"future\" : \"{0} 个星期后\",\n      \"past\" : \"{0} 个星期前\",\n      \"previous\" : \"上星期\",\n      \"next\" : \"下星期\"\n    },\n    \"minute\" : {\n      \"current\" : \"呢分钟\",\n      \"past\" : \"{0} 分钟前\",\n      \"future\" : \"{0} 分钟后\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} 个月后\",\n      \"next\" : \"下个月\",\n      \"previous\" : \"上个月\",\n      \"current\" : \"今个月\",\n      \"past\" : \"{0} 个月前\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} 小时前\",\n      \"current\" : \"呢个小时\",\n      \"future\" : \"{0} 小时后\"\n    },\n    \"year\" : {\n      \"past\" : \"{0} 年前\",\n      \"future\" : \"{0} 年后\",\n      \"previous\" : \"旧年\",\n      \"next\" : \"下年\",\n      \"current\" : \"今年\"\n    },\n    \"second\" : {\n      \"current\" : \"宜家\",\n      \"past\" : \"{0} 秒前\",\n      \"future\" : \"{0} 秒后\"\n    },\n    \"now\" : \"宜家\",\n    \"quarter\" : {\n      \"past\" : \"{0} 季前\",\n      \"current\" : \"今季\",\n      \"previous\" : \"上一季\",\n      \"future\" : \"{0} 季后\",\n      \"next\" : \"下一季\"\n    }\n  },\n  \"short\" : {\n    \"quarter\" : {\n      \"future\" : \"{0} 季后\",\n      \"next\" : \"下季\",\n      \"previous\" : \"上季\",\n      \"current\" : \"今季\",\n      \"past\" : \"{0} 季前\"\n    },\n    \"minute\" : {\n      \"current\" : \"呢分钟\",\n      \"past\" : \"{0} 分钟前\",\n      \"future\" : \"{0} 分钟后\"\n    },\n    \"year\" : {\n      \"next\" : \"下年\",\n      \"future\" : \"{0} 年后\",\n      \"current\" : \"今年\",\n      \"past\" : \"{0} 年前\",\n      \"previous\" : \"旧年\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} 秒后\",\n      \"current\" : \"宜家\",\n      \"past\" : \"{0} 秒前\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} 小时前\",\n      \"current\" : \"呢个小时\",\n      \"future\" : \"{0} 小时后\"\n    },\n    \"now\" : \"宜家\",\n    \"month\" : {\n      \"previous\" : \"上个月\",\n      \"next\" : \"下个月\",\n      \"past\" : \"{0} 个月前\",\n      \"current\" : \"今个月\",\n      \"future\" : \"{0} 个月后\"\n    },\n    \"week\" : {\n      \"previous\" : \"上星期\",\n      \"current\" : \"今个星期\",\n      \"next\" : \"下星期\",\n      \"past\" : \"{0} 个星期前\",\n      \"future\" : \"{0} 个星期后\"\n    },\n    \"day\" : {\n      \"next\" : \"听日\",\n      \"past\" : \"{0} 日前\",\n      \"future\" : \"{0} 日后\",\n      \"previous\" : \"寻日\",\n      \"current\" : \"今日\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/yue_Hant.json",
    "content": "{\n  \"long\" : {\n    \"hour\" : {\n      \"current\" : \"呢個小時\",\n      \"past\" : \"{0} 小時前\",\n      \"future\" : \"{0} 小時後\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} 秒後\",\n      \"past\" : \"{0} 秒前\",\n      \"current\" : \"宜家\"\n    },\n    \"week\" : {\n      \"next\" : \"下星期\",\n      \"current\" : \"今個星期\",\n      \"previous\" : \"上星期\",\n      \"future\" : \"{0} 個星期後\",\n      \"past\" : \"{0} 個星期前\"\n    },\n    \"minute\" : {\n      \"current\" : \"呢分鐘\",\n      \"future\" : \"{0} 分鐘後\",\n      \"past\" : \"{0} 分鐘前\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"past\" : \"{0} 年前\",\n      \"future\" : \"{0} 年後\",\n      \"previous\" : \"舊年\",\n      \"next\" : \"下年\"\n    },\n    \"quarter\" : {\n      \"next\" : \"下一季\",\n      \"current\" : \"今季\",\n      \"future\" : \"{0} 季後\",\n      \"previous\" : \"上一季\",\n      \"past\" : \"{0} 季前\"\n    },\n    \"month\" : {\n      \"previous\" : \"上個月\",\n      \"future\" : \"{0} 個月後\",\n      \"current\" : \"今個月\",\n      \"next\" : \"下個月\",\n      \"past\" : \"{0} 個月前\"\n    },\n    \"day\" : {\n      \"next\" : \"聽日\",\n      \"past\" : \"{0} 日前\",\n      \"current\" : \"今日\",\n      \"future\" : \"{0} 日後\",\n      \"previous\" : \"尋日\"\n    },\n    \"now\" : \"宜家\"\n  },\n  \"narrow\" : {\n    \"week\" : {\n      \"current\" : \"今個星期\",\n      \"next\" : \"下星期\",\n      \"past\" : \"{0} 個星期前\",\n      \"previous\" : \"上星期\",\n      \"future\" : \"{0} 個星期後\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} 分鐘前\",\n      \"future\" : \"{0} 分鐘後\",\n      \"current\" : \"呢分鐘\"\n    },\n    \"month\" : {\n      \"current\" : \"今個月\",\n      \"previous\" : \"上個月\",\n      \"past\" : \"{0} 個月前\",\n      \"next\" : \"下個月\",\n      \"future\" : \"{0} 個月後\"\n    },\n    \"now\" : \"宜家\",\n    \"year\" : {\n      \"previous\" : \"舊年\",\n      \"current\" : \"今年\",\n      \"next\" : \"下年\",\n      \"past\" : \"{0} 年前\",\n      \"future\" : \"{0} 年後\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0} 小時前\",\n      \"future\" : \"{0} 小時後\",\n      \"current\" : \"呢個小時\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"上季\",\n      \"current\" : \"今季\",\n      \"past\" : \"{0} 季前\",\n      \"future\" : \"{0} 季後\",\n      \"next\" : \"下季\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} 秒後\",\n      \"current\" : \"宜家\",\n      \"past\" : \"{0} 秒前\"\n    },\n    \"day\" : {\n      \"past\" : \"{0} 日前\",\n      \"current\" : \"今日\",\n      \"future\" : \"{0} 日後\",\n      \"previous\" : \"尋日\",\n      \"next\" : \"聽日\"\n    }\n  },\n  \"short\" : {\n    \"month\" : {\n      \"current\" : \"今個月\",\n      \"next\" : \"下個月\",\n      \"past\" : \"{0} 個月前\",\n      \"future\" : \"{0} 個月後\",\n      \"previous\" : \"上個月\"\n    },\n    \"now\" : \"宜家\",\n    \"day\" : {\n      \"next\" : \"聽日\",\n      \"current\" : \"今日\",\n      \"previous\" : \"尋日\",\n      \"past\" : \"{0} 日前\",\n      \"future\" : \"{0} 日後\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"future\" : \"{0} 年後\",\n      \"previous\" : \"舊年\",\n      \"next\" : \"下年\",\n      \"past\" : \"{0} 年前\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} 小時後\",\n      \"current\" : \"呢個小時\",\n      \"past\" : \"{0} 小時前\"\n    },\n    \"minute\" : {\n      \"current\" : \"呢分鐘\",\n      \"future\" : \"{0} 分鐘後\",\n      \"past\" : \"{0} 分鐘前\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} 秒後\",\n      \"current\" : \"宜家\",\n      \"past\" : \"{0} 秒前\"\n    },\n    \"quarter\" : {\n      \"future\" : \"{0} 季後\",\n      \"previous\" : \"上季\",\n      \"next\" : \"下季\",\n      \"past\" : \"{0} 季前\",\n      \"current\" : \"今季\"\n    },\n    \"week\" : {\n      \"next\" : \"下星期\",\n      \"past\" : \"{0} 個星期前\",\n      \"current\" : \"今個星期\",\n      \"previous\" : \"上星期\",\n      \"future\" : \"{0} 個星期後\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zh.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"current\" : \"本季度\",\n      \"past\" : \"{0}个季度前\",\n      \"next\" : \"下季度\",\n      \"future\" : \"{0}个季度后\",\n      \"previous\" : \"上季度\"\n    },\n    \"day\" : {\n      \"next\" : \"明天\",\n      \"previous\" : \"昨天\",\n      \"future\" : \"{0}天后\",\n      \"past\" : \"{0}天前\",\n      \"current\" : \"今天\"\n    },\n    \"year\" : {\n      \"past\" : \"{0}年前\",\n      \"previous\" : \"去年\",\n      \"future\" : \"{0}年后\",\n      \"next\" : \"明年\",\n      \"current\" : \"今年\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0}分钟前\",\n      \"future\" : \"{0}分钟后\",\n      \"current\" : \"此刻\"\n    },\n    \"now\" : \"现在\",\n    \"week\" : {\n      \"current\" : \"本周\",\n      \"previous\" : \"上周\",\n      \"past\" : \"{0}周前\",\n      \"next\" : \"下周\",\n      \"future\" : \"{0}周后\"\n    },\n    \"second\" : {\n      \"future\" : \"{0}秒后\",\n      \"current\" : \"现在\",\n      \"past\" : \"{0}秒前\"\n    },\n    \"month\" : {\n      \"future\" : \"{0}个月后\",\n      \"current\" : \"本月\",\n      \"past\" : \"{0}个月前\",\n      \"previous\" : \"上个月\",\n      \"next\" : \"下个月\"\n    },\n    \"hour\" : {\n      \"current\" : \"这一时间 \\/ 此时\",\n      \"past\" : \"{0}小时前\",\n      \"future\" : \"{0}小时后\"\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"next\" : \"明年\",\n      \"previous\" : \"去年\",\n      \"past\" : \"{0}年前\",\n      \"future\" : \"{0}年后\",\n      \"current\" : \"今年\"\n    },\n    \"now\" : \"现在\",\n    \"quarter\" : {\n      \"next\" : \"下季度\",\n      \"past\" : \"{0}个季度前\",\n      \"future\" : \"{0}个季度后\",\n      \"current\" : \"本季度\",\n      \"previous\" : \"上季度\"\n    },\n    \"month\" : {\n      \"past\" : \"{0}个月前\",\n      \"next\" : \"下个月\",\n      \"previous\" : \"上个月\",\n      \"future\" : \"{0}个月后\",\n      \"current\" : \"本月\"\n    },\n    \"second\" : {\n      \"current\" : \"现在\",\n      \"past\" : \"{0}秒钟前\",\n      \"future\" : \"{0}秒钟后\"\n    },\n    \"week\" : {\n      \"past\" : \"{0}周前\",\n      \"previous\" : \"上周\",\n      \"future\" : \"{0}周后\",\n      \"next\" : \"下周\",\n      \"current\" : \"本周\"\n    },\n    \"day\" : {\n      \"next\" : \"明天\",\n      \"future\" : \"{0}天后\",\n      \"previous\" : \"昨天\",\n      \"current\" : \"今天\",\n      \"past\" : \"{0}天前\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0}分钟前\",\n      \"future\" : \"{0}分钟后\",\n      \"current\" : \"此刻\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0}小时后\",\n      \"current\" : \"这一时间 \\/ 此时\",\n      \"past\" : \"{0}小时前\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"past\" : \"{0}分钟前\",\n      \"current\" : \"此刻\",\n      \"future\" : \"{0}分钟后\"\n    },\n    \"week\" : {\n      \"future\" : \"{0}周后\",\n      \"previous\" : \"上周\",\n      \"next\" : \"下周\",\n      \"current\" : \"本周\",\n      \"past\" : \"{0}周前\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"previous\" : \"去年\",\n      \"future\" : \"{0}年后\",\n      \"past\" : \"{0}年前\",\n      \"next\" : \"明年\"\n    },\n    \"month\" : {\n      \"next\" : \"下个月\",\n      \"past\" : \"{0}个月前\",\n      \"future\" : \"{0}个月后\",\n      \"previous\" : \"上个月\",\n      \"current\" : \"本月\"\n    },\n    \"quarter\" : {\n      \"next\" : \"下季度\",\n      \"past\" : \"{0}个季度前\",\n      \"previous\" : \"上季度\",\n      \"current\" : \"本季度\",\n      \"future\" : \"{0}个季度后\"\n    },\n    \"day\" : {\n      \"current\" : \"今天\",\n      \"previous\" : \"昨天\",\n      \"past\" : \"{0}天前\",\n      \"next\" : \"明天\",\n      \"future\" : \"{0}天后\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0}小时前\",\n      \"future\" : \"{0}小时后\",\n      \"current\" : \"这一时间 \\/ 此时\"\n    },\n    \"second\" : {\n      \"future\" : \"{0}秒后\",\n      \"past\" : \"{0}秒前\",\n      \"current\" : \"现在\"\n    },\n    \"now\" : \"现在\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zh_Hans.json",
    "content": "{\n    \"narrow\" : {\n        \"quarter\" : {\n            \"current\" : \"本季度\",\n            \"past\" : \"{0}个季度前\",\n            \"next\" : \"下季度\",\n            \"future\" : \"{0}个季度后\",\n            \"previous\" : \"上季度\"\n        },\n        \"day\" : {\n            \"next\" : \"明天\",\n            \"previous\" : \"昨天\",\n            \"future\" : \"{0}天后\",\n            \"past\" : \"{0}天前\",\n            \"current\" : \"今天\"\n        },\n        \"year\" : {\n            \"past\" : \"{0}年前\",\n            \"previous\" : \"去年\",\n            \"future\" : \"{0}年后\",\n            \"next\" : \"明年\",\n            \"current\" : \"今年\"\n        },\n        \"minute\" : {\n            \"past\" : \"{0}分钟前\",\n            \"future\" : \"{0}分钟后\",\n            \"current\" : \"此刻\"\n        },\n        \"now\" : \"现在\",\n        \"week\" : {\n            \"current\" : \"本周\",\n            \"previous\" : \"上周\",\n            \"past\" : \"{0}周前\",\n            \"next\" : \"下周\",\n            \"future\" : \"{0}周后\"\n        },\n        \"second\" : {\n            \"future\" : \"{0}秒后\",\n            \"current\" : \"现在\",\n            \"past\" : \"{0}秒前\"\n        },\n        \"month\" : {\n            \"future\" : \"{0}个月后\",\n            \"current\" : \"本月\",\n            \"past\" : \"{0}个月前\",\n            \"previous\" : \"上个月\",\n            \"next\" : \"下个月\"\n        },\n        \"hour\" : {\n            \"current\" : \"这一时间 \\/ 此时\",\n            \"past\" : \"{0}小时前\",\n            \"future\" : \"{0}小时后\"\n        }\n    },\n    \"long\" : {\n        \"year\" : {\n            \"next\" : \"明年\",\n            \"previous\" : \"去年\",\n            \"past\" : \"{0}年前\",\n            \"future\" : \"{0}年后\",\n            \"current\" : \"今年\"\n        },\n        \"now\" : \"现在\",\n        \"quarter\" : {\n            \"next\" : \"下季度\",\n            \"past\" : \"{0}个季度前\",\n            \"future\" : \"{0}个季度后\",\n            \"current\" : \"本季度\",\n            \"previous\" : \"上季度\"\n        },\n        \"month\" : {\n            \"past\" : \"{0}个月前\",\n            \"next\" : \"下个月\",\n            \"previous\" : \"上个月\",\n            \"future\" : \"{0}个月后\",\n            \"current\" : \"本月\"\n        },\n        \"second\" : {\n            \"current\" : \"现在\",\n            \"past\" : \"{0}秒钟前\",\n            \"future\" : \"{0}秒钟后\"\n        },\n        \"week\" : {\n            \"past\" : \"{0}周前\",\n            \"previous\" : \"上周\",\n            \"future\" : \"{0}周后\",\n            \"next\" : \"下周\",\n            \"current\" : \"本周\"\n        },\n        \"day\" : {\n            \"next\" : \"明天\",\n            \"future\" : \"{0}天后\",\n            \"previous\" : \"昨天\",\n            \"current\" : \"今天\",\n            \"past\" : \"{0}天前\"\n        },\n        \"minute\" : {\n            \"past\" : \"{0}分钟前\",\n            \"future\" : \"{0}分钟后\",\n            \"current\" : \"此刻\"\n        },\n        \"hour\" : {\n            \"future\" : \"{0}小时后\",\n            \"current\" : \"这一时间 \\/ 此时\",\n            \"past\" : \"{0}小时前\"\n        }\n    },\n    \"short\" : {\n        \"minute\" : {\n            \"past\" : \"{0}分钟前\",\n            \"current\" : \"此刻\",\n            \"future\" : \"{0}分钟后\"\n        },\n        \"week\" : {\n            \"future\" : \"{0}周后\",\n            \"previous\" : \"上周\",\n            \"next\" : \"下周\",\n            \"current\" : \"本周\",\n            \"past\" : \"{0}周前\"\n        },\n        \"year\" : {\n            \"current\" : \"今年\",\n            \"previous\" : \"去年\",\n            \"future\" : \"{0}年后\",\n            \"past\" : \"{0}年前\",\n            \"next\" : \"明年\"\n        },\n        \"month\" : {\n            \"next\" : \"下个月\",\n            \"past\" : \"{0}个月前\",\n            \"future\" : \"{0}个月后\",\n            \"previous\" : \"上个月\",\n            \"current\" : \"本月\"\n        },\n        \"quarter\" : {\n            \"next\" : \"下季度\",\n            \"past\" : \"{0}个季度前\",\n            \"previous\" : \"上季度\",\n            \"current\" : \"本季度\",\n            \"future\" : \"{0}个季度后\"\n        },\n        \"day\" : {\n            \"current\" : \"今天\",\n            \"previous\" : \"昨天\",\n            \"past\" : \"{0}天前\",\n            \"next\" : \"明天\",\n            \"future\" : \"{0}天后\"\n        },\n        \"hour\" : {\n            \"past\" : \"{0}小时前\",\n            \"future\" : \"{0}小时后\",\n            \"current\" : \"这一时间 \\/ 此时\"\n        },\n        \"second\" : {\n            \"future\" : \"{0}秒后\",\n            \"past\" : \"{0}秒前\",\n            \"current\" : \"现在\"\n        },\n        \"now\" : \"现在\"\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zh_Hans_HK.json",
    "content": "{\n  \"narrow\" : {\n\n  },\n  \"short\" : {\n\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : \"{0}分钟前\",\n      \"future\" : \"{0}分钟后\",\n      \"current\" : \"此刻\"\n    },\n    \"week\" : {\n      \"current\" : \"本周\",\n      \"past\" : \"{0}周前\",\n      \"future\" : \"{0}周后\",\n      \"next\" : \"下周\",\n      \"previous\" : \"上周\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"future\" : \"{0}年后\",\n      \"past\" : \"{0}年前\",\n      \"next\" : \"明年\",\n      \"previous\" : \"去年\"\n    },\n    \"day\" : {\n      \"next\" : \"明天\",\n      \"current\" : \"今天\",\n      \"previous\" : \"昨天\",\n      \"past\" : \"{0}天前\",\n      \"future\" : \"{0}天后\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0}小时后\",\n      \"current\" : \"这一时间 \\/ 此时\",\n      \"past\" : \"{0}小时前\"\n    },\n    \"quarter\" : {\n      \"current\" : \"本季度\",\n      \"future\" : \"{0}个季度后\",\n      \"previous\" : \"上季度\",\n      \"next\" : \"下季度\",\n      \"past\" : \"{0}个季度前\"\n    },\n    \"second\" : {\n      \"past\" : \"{0}秒前\",\n      \"current\" : \"现在\",\n      \"future\" : \"{0}秒后\"\n    },\n    \"month\" : {\n      \"current\" : \"本月\",\n      \"past\" : \"{0}个月前\",\n      \"future\" : \"{0}个月后\",\n      \"next\" : \"下个月\",\n      \"previous\" : \"上个月\"\n    },\n    \"now\" : \"现在\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zh_Hans_MO.json",
    "content": "{\n  \"narrow\" : {\n\n  },\n  \"long\" : {\n    \"second\" : {\n      \"future\" : \"{0}秒后\",\n      \"current\" : \"现在\",\n      \"past\" : \"{0}秒前\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0}小时后\",\n      \"past\" : \"{0}小时前\",\n      \"current\" : \"这一时间 \\/ 此时\"\n    },\n    \"day\" : {\n      \"previous\" : \"昨天\",\n      \"past\" : \"{0}天前\",\n      \"future\" : \"{0}天后\",\n      \"current\" : \"今天\",\n      \"next\" : \"明天\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0}分钟前\",\n      \"current\" : \"此刻\",\n      \"future\" : \"{0}分钟后\"\n    },\n    \"now\" : \"现在\",\n    \"year\" : {\n      \"future\" : \"{0}年后\",\n      \"past\" : \"{0}年前\",\n      \"previous\" : \"去年\",\n      \"next\" : \"明年\",\n      \"current\" : \"今年\"\n    },\n    \"quarter\" : {\n      \"current\" : \"本季度\",\n      \"next\" : \"下季度\",\n      \"previous\" : \"上季度\",\n      \"future\" : \"{0}个季度后\",\n      \"past\" : \"{0}个季度前\"\n    },\n    \"week\" : {\n      \"past\" : \"{0}周前\",\n      \"next\" : \"下周\",\n      \"future\" : \"{0}周后\",\n      \"current\" : \"本周\",\n      \"previous\" : \"上周\"\n    },\n    \"month\" : {\n      \"next\" : \"下个月\",\n      \"future\" : \"{0}个月后\",\n      \"previous\" : \"上个月\",\n      \"past\" : \"{0}个月前\",\n      \"current\" : \"本月\"\n    }\n  },\n  \"short\" : {\n\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zh_Hans_SG.json",
    "content": "{\n  \"narrow\" : {\n\n  },\n  \"short\" : {\n\n  },\n  \"long\" : {\n    \"minute\" : {\n      \"past\" : \"{0}分钟前\",\n      \"future\" : \"{0}分钟后\",\n      \"current\" : \"此刻\"\n    },\n    \"week\" : {\n      \"current\" : \"本周\",\n      \"past\" : \"{0}周前\",\n      \"future\" : \"{0}周后\",\n      \"next\" : \"下周\",\n      \"previous\" : \"上周\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"future\" : \"{0}年后\",\n      \"past\" : \"{0}年前\",\n      \"next\" : \"明年\",\n      \"previous\" : \"去年\"\n    },\n    \"day\" : {\n      \"next\" : \"明天\",\n      \"current\" : \"今天\",\n      \"previous\" : \"昨天\",\n      \"past\" : \"{0}天前\",\n      \"future\" : \"{0}天后\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0}小时后\",\n      \"current\" : \"这一时间 \\/ 此时\",\n      \"past\" : \"{0}小时前\"\n    },\n    \"quarter\" : {\n      \"current\" : \"本季度\",\n      \"future\" : \"{0}个季度后\",\n      \"previous\" : \"上季度\",\n      \"next\" : \"下季度\",\n      \"past\" : \"{0}个季度前\"\n    },\n    \"second\" : {\n      \"past\" : \"{0}秒前\",\n      \"current\" : \"现在\",\n      \"future\" : \"{0}秒后\"\n    },\n    \"month\" : {\n      \"current\" : \"本月\",\n      \"past\" : \"{0}个月前\",\n      \"future\" : \"{0}个月后\",\n      \"next\" : \"下个月\",\n      \"previous\" : \"上个月\"\n    },\n    \"now\" : \"现在\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zh_Hant.json",
    "content": "﻿{\n  \"narrow\" : {\n    \"now\" : \"現在\",\n    \"week\" : {\n      \"next\" : \"下週\",\n      \"current\" : \"本週\",\n      \"past\" : \"{0} 週前\",\n      \"future\" : \"{0} 週後\",\n      \"previous\" : \"上週\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"上一季\",\n      \"next\" : \"下一季\",\n      \"future\" : \"{0} 季後\",\n      \"current\" : \"本季\",\n      \"past\" : \"{0} 季前\"\n    },\n    \"day\" : {\n      \"future\" : \"{0} 天後\",\n      \"previous\" : \"昨天\",\n      \"next\" : \"明天\",\n      \"past\" : \"{0} 天前\",\n      \"current\" : \"今天\"\n    },\n    \"hour\" : {\n      \"current\" : \"這個小時\",\n      \"past\" : \"{0} 小時前\",\n      \"future\" : \"{0} 小時後\"\n    },\n    \"second\" : {\n      \"future\" : \"{0} 秒後\",\n      \"current\" : \"現在\",\n      \"past\" : \"{0} 秒前\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} 個月前\",\n      \"future\" : \"{0} 個月後\",\n      \"current\" : \"本月\",\n      \"previous\" : \"上個月\",\n      \"next\" : \"下個月\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} 分鐘後\",\n      \"current\" : \"現在\",\n      \"past\" : \"{0} 分鐘前\"\n    },\n    \"year\" : {\n      \"next\" : \"明年\",\n      \"future\" : \"{0} 年後\",\n      \"previous\" : \"去年\",\n      \"current\" : \"今年\",\n      \"past\" : \"{0} 年前\"\n    }\n  },\n  \"long\" : {\n    \"day\" : {\n      \"future\" : \"{0} 天後\",\n      \"past\" : \"{0} 天前\",\n      \"current\" : \"今天\",\n      \"next\" : \"明天\",\n      \"previous\" : \"昨天\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} 秒前\",\n      \"current\" : \"現在\",\n      \"future\" : \"{0} 秒後\"\n    },\n    \"quarter\" : {\n      \"current\" : \"本季\",\n      \"next\" : \"下一季\",\n      \"previous\" : \"上一季\",\n      \"future\" : \"{0} 季後\",\n      \"past\" : \"{0} 季前\"\n    },\n    \"month\" : {\n      \"future\" : \"{0} 個月後\",\n      \"previous\" : \"上個月\",\n      \"past\" : \"{0} 個月前\",\n      \"next\" : \"下個月\",\n      \"current\" : \"本月\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} 週後\",\n      \"past\" : \"{0} 週前\",\n      \"current\" : \"本週\",\n      \"previous\" : \"上週\",\n      \"next\" : \"下週\"\n    },\n    \"hour\" : {\n      \"future\" : \"{0} 小時後\",\n      \"current\" : \"這個小時\",\n      \"past\" : \"{0} 小時前\"\n    },\n    \"minute\" : {\n      \"future\" : \"{0} 分鐘後\",\n      \"past\" : \"{0} 分鐘前\",\n      \"current\" : \"現在\"\n    },\n    \"now\" : \"現在\",\n    \"year\" : {\n      \"future\" : \"{0} 年後\",\n      \"next\" : \"明年\",\n      \"past\" : \"{0} 年前\",\n      \"previous\" : \"去年\",\n      \"current\" : \"今年\"\n    }\n  },\n  \"short\" : {\n    \"hour\" : {\n      \"future\" : \"{0} 小時後\",\n      \"current\" : \"這個小時\",\n      \"past\" : \"{0} 小時前\"\n    },\n    \"now\" : \"現在\",\n    \"quarter\" : {\n      \"current\" : \"本季\",\n      \"future\" : \"{0} 季後\",\n      \"past\" : \"{0} 季前\",\n      \"next\" : \"下一季\",\n      \"previous\" : \"上一季\"\n    },\n    \"day\" : {\n      \"current\" : \"今天\",\n      \"past\" : \"{0} 天前\",\n      \"future\" : \"{0} 天後\",\n      \"next\" : \"明天\",\n      \"previous\" : \"昨天\"\n    },\n    \"week\" : {\n      \"current\" : \"本週\",\n      \"past\" : \"{0} 週前\",\n      \"future\" : \"{0} 週後\",\n      \"next\" : \"下週\",\n      \"previous\" : \"上週\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} 分鐘前\",\n      \"future\" : \"{0} 分鐘後\",\n      \"current\" : \"現在\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} 秒前\",\n      \"current\" : \"現在\",\n      \"future\" : \"{0} 秒後\"\n    },\n    \"month\" : {\n      \"current\" : \"本月\",\n      \"future\" : \"{0} 個月後\",\n      \"previous\" : \"上個月\",\n      \"next\" : \"下個月\",\n      \"past\" : \"{0} 個月前\"\n    },\n    \"year\" : {\n      \"future\" : \"{0} 年後\",\n      \"previous\" : \"去年\",\n      \"next\" : \"明年\",\n      \"current\" : \"今年\",\n      \"past\" : \"{0} 年前\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zh_Hant_HK.json",
    "content": "{\n  \"narrow\" : {\n    \"quarter\" : {\n      \"current\" : \"今季\",\n      \"past\" : \"-{0}Q\",\n      \"next\" : \"下季\",\n      \"future\" : \"+{0}Q\",\n      \"previous\" : \"上季\"\n    },\n    \"day\" : {\n      \"next\" : \"明日\",\n      \"previous\" : \"昨日\",\n      \"future\" : \"{0}日後\",\n      \"past\" : \"{0}日前\",\n      \"current\" : \"今日\"\n    },\n    \"year\" : {\n      \"past\" : \"{0}年前\",\n      \"previous\" : \"上年\",\n      \"future\" : \"{0}年後\",\n      \"next\" : \"下年\",\n      \"current\" : \"今年\"\n    },\n    \"minute\" : {\n      \"current\" : \"這分鐘\",\n      \"future\" : \"{0}分後\",\n      \"past\" : \"{0}分前\"\n    },\n    \"now\" : \"現在\",\n    \"week\" : {\n      \"current\" : \"本星期\",\n      \"previous\" : \"上星期\",\n      \"past\" : \"{0}星期前\",\n      \"next\" : \"下星期\",\n      \"future\" : \"{0}星期後\"\n    },\n    \"second\" : {\n      \"current\" : \"現在\",\n      \"past\" : \"{0}秒前\",\n      \"future\" : \"{0}秒後\"\n    },\n    \"month\" : {\n      \"future\" : \"{0}個月後\",\n      \"current\" : \"本月\",\n      \"past\" : \"{0}個月前\",\n      \"previous\" : \"上個月\",\n      \"next\" : \"下個月\"\n    },\n    \"hour\" : {\n      \"past\" : \"{0}小時前\",\n      \"future\" : \"{0}小時後\",\n      \"current\" : \"這個小時\"\n    }\n  },\n  \"long\" : {\n    \"year\" : {\n      \"next\" : \"下年\",\n      \"previous\" : \"上年\",\n      \"past\" : \"{0} 年前\",\n      \"future\" : \"{0} 年後\",\n      \"current\" : \"今年\"\n    },\n    \"now\" : \"現在\",\n    \"quarter\" : {\n      \"next\" : \"下一季\",\n      \"past\" : \"{0} 季前\",\n      \"future\" : \"{0} 季後\",\n      \"current\" : \"今季\",\n      \"previous\" : \"上一季\"\n    },\n    \"month\" : {\n      \"past\" : \"{0} 個月前\",\n      \"next\" : \"下個月\",\n      \"previous\" : \"上個月\",\n      \"future\" : \"{0} 個月後\",\n      \"current\" : \"本月\"\n    },\n    \"second\" : {\n      \"past\" : \"{0} 秒前\",\n      \"future\" : \"{0} 秒後\",\n      \"current\" : \"現在\"\n    },\n    \"week\" : {\n      \"past\" : \"{0} 星期前\",\n      \"previous\" : \"上星期\",\n      \"future\" : \"{0} 星期後\",\n      \"next\" : \"下星期\",\n      \"current\" : \"本星期\"\n    },\n    \"day\" : {\n      \"next\" : \"明日\",\n      \"future\" : \"{0} 日後\",\n      \"previous\" : \"昨日\",\n      \"current\" : \"今日\",\n      \"past\" : \"{0} 日前\"\n    },\n    \"minute\" : {\n      \"past\" : \"{0} 分鐘前\",\n      \"future\" : \"{0} 分鐘後\",\n      \"current\" : \"這分鐘\"\n    },\n    \"hour\" : {\n      \"current\" : \"這個小時\",\n      \"past\" : \"{0} 小時前\",\n      \"future\" : \"{0} 小時後\"\n    }\n  },\n  \"short\" : {\n    \"minute\" : {\n      \"future\" : \"{0} 分鐘後\",\n      \"current\" : \"這分鐘\",\n      \"past\" : \"{0} 分鐘前\"\n    },\n    \"week\" : {\n      \"future\" : \"{0} 星期後\",\n      \"previous\" : \"上星期\",\n      \"next\" : \"下星期\",\n      \"current\" : \"本星期\",\n      \"past\" : \"{0} 星期前\"\n    },\n    \"year\" : {\n      \"current\" : \"今年\",\n      \"previous\" : \"上年\",\n      \"future\" : \"{0} 年後\",\n      \"past\" : \"{0} 年前\",\n      \"next\" : \"下年\"\n    },\n    \"month\" : {\n      \"next\" : \"下個月\",\n      \"past\" : \"{0} 個月前\",\n      \"future\" : \"{0} 個月後\",\n      \"previous\" : \"上個月\",\n      \"current\" : \"本月\"\n    },\n    \"quarter\" : {\n      \"next\" : \"下季\",\n      \"past\" : \"{0} 季前\",\n      \"previous\" : \"上季\",\n      \"current\" : \"今季\",\n      \"future\" : \"{0} 季後\"\n    },\n    \"day\" : {\n      \"current\" : \"今日\",\n      \"previous\" : \"昨日\",\n      \"past\" : \"{0} 日前\",\n      \"next\" : \"明日\",\n      \"future\" : \"{0} 日後\"\n    },\n    \"hour\" : {\n      \"current\" : \"這個小時\",\n      \"past\" : \"{0} 小時前\",\n      \"future\" : \"{0} 小時後\"\n    },\n    \"second\" : {\n      \"current\" : \"現在\",\n      \"past\" : \"{0} 秒前\",\n      \"future\" : \"{0} 秒後\"\n    },\n    \"now\" : \"現在\"\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Formatters/RelativeFormatter/langs/zu.json",
    "content": "{\n  \"short\" : {\n    \"day\" : {\n      \"previous\" : \"izolo\",\n      \"current\" : \"namhlanje\",\n      \"past\" : {\n        \"other\" : \"{0} izinsuku ezedlule\",\n        \"one\" : \"{0} usuku olwedlule\"\n      },\n      \"future\" : {\n        \"one\" : \"osukwini olungu-{0} oluzayo\",\n        \"other\" : \"ezinsukwini ezingu-{0} ezizayo\"\n      },\n      \"next\" : \"kusasa\"\n    },\n    \"week\" : {\n      \"next\" : \"iviki elizayo\",\n      \"current\" : \"leli viki\",\n      \"previous\" : \"iviki eledlule\",\n      \"past\" : \"amaviki angu-{0} edlule\",\n      \"future\" : {\n        \"other\" : \"emavikini angu-{0} ezayo\",\n        \"one\" : \"evikini elingu-{0} elizayo\"\n      }\n    },\n    \"quarter\" : {\n      \"next\" : \"ikota ezayo\",\n      \"past\" : {\n        \"one\" : \"{0} amakota adlule\",\n        \"other\" : \"{0} amakota edlule\"\n      },\n      \"current\" : \"le kota\",\n      \"previous\" : \"ikota edlule\",\n      \"future\" : {\n        \"one\" : \"kwikota engu-{0} ezayo\",\n        \"other\" : \"kumakota angu-{0} ezayo\"\n      }\n    },\n    \"minute\" : {\n      \"future\" : {\n        \"one\" : \"kuminithi elingu-{0} elizayo\",\n        \"other\" : \"kumaminithi angu-{0} ezayo\"\n      },\n      \"past\" : {\n        \"one\" : \"{0} iminithi eledlule\",\n        \"other\" : \"{0} amaminithi edlule\"\n      },\n      \"current\" : \"leli minithi\"\n    },\n    \"year\" : {\n      \"current\" : \"kulo nyaka\",\n      \"next\" : \"unyaka ozayo\",\n      \"past\" : \"{0} unyaka odlule\",\n      \"future\" : {\n        \"other\" : \"eminyakeni engu-{0} ezayo\",\n        \"one\" : \"onyakeni ongu-{0} ozayo\"\n      },\n      \"previous\" : \"onyakeni odlule\"\n    },\n    \"hour\" : {\n      \"past\" : {\n        \"one\" : \"{0} ihora eledlule\",\n        \"other\" : \"emahoreni angu-{0} edlule\"\n      },\n      \"future\" : {\n        \"other\" : \"emahoreni angu-{0} ezayo\",\n        \"one\" : \"ehoreni elingu-{0} elizayo\"\n      },\n      \"current\" : \"leli hora\"\n    },\n    \"month\" : {\n      \"current\" : \"le nyanga\",\n      \"future\" : \"ezinyangeni ezingu-{0} ezizayo\",\n      \"previous\" : \"inyanga edlule\",\n      \"next\" : \"inyanga ezayo\",\n      \"past\" : \"{0} izinyanga ezedlule\"\n    },\n    \"second\" : {\n      \"future\" : {\n        \"other\" : \"kumasekhondi angu-{0} ezayo\",\n        \"one\" : \"kusekhondi elingu-{0} elizayo\"\n      },\n      \"current\" : \"manje\",\n      \"past\" : {\n        \"one\" : \"{0} isekhondi eledlule\",\n        \"other\" : \"{0} amasekhondi edlule\"\n      }\n    },\n    \"now\" : \"manje\"\n  },\n  \"long\" : {\n    \"month\" : {\n      \"previous\" : \"inyanga edlule\",\n      \"next\" : \"inyanga ezayo\",\n      \"future\" : {\n        \"one\" : \"enyangeni engu-{0}\",\n        \"other\" : \"ezinyangeni ezingu-{0} ezizayo\"\n      },\n      \"current\" : \"le nyanga\",\n      \"past\" : {\n        \"other\" : \"{0} izinyanga ezedlule\",\n        \"one\" : \"{0} inyanga edlule\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"{0} iminithi eledlule\",\n        \"other\" : \"{0} amaminithi edlule\"\n      },\n      \"future\" : {\n        \"one\" : \"kuminithi elingu-{0} elizayo\",\n        \"other\" : \"kumaminithi angu-{0} ezayo\"\n      },\n      \"current\" : \"leli minithi\"\n    },\n    \"quarter\" : {\n      \"previous\" : \"ikota edlule\",\n      \"past\" : {\n        \"other\" : \"{0} amakota adlule\",\n        \"one\" : \"{0} ikota edlule\"\n      },\n      \"current\" : \"le kota\",\n      \"next\" : \"ikota ezayo\",\n      \"future\" : {\n        \"other\" : \"kumakota angu-{0} ezayo\",\n        \"one\" : \"kwikota engu-{0} ezayo\"\n      }\n    },\n    \"week\" : {\n      \"current\" : \"leli viki\",\n      \"past\" : {\n        \"other\" : \"amaviki angu-{0} edlule\",\n        \"one\" : \"evikini elingu-{0} eledlule\"\n      },\n      \"previous\" : \"iviki eledlule\",\n      \"future\" : {\n        \"one\" : \"evikini elingu-{0}\",\n        \"other\" : \"emavikini angu-{0}\"\n      },\n      \"next\" : \"iviki elizayo\"\n    },\n    \"now\" : \"manje\",\n    \"second\" : {\n      \"future\" : {\n        \"other\" : \"kumasekhondi angu-{0} ezayo\",\n        \"one\" : \"kusekhondi elingu-{0} elizayo\"\n      },\n      \"current\" : \"manje\",\n      \"past\" : {\n        \"other\" : \"{0} amasekhondi edlule\",\n        \"one\" : \"{0} isekhondi eledlule\"\n      }\n    },\n    \"year\" : {\n      \"past\" : {\n        \"other\" : \"{0} iminyaka edlule\",\n        \"one\" : \"{0} unyaka odlule\"\n      },\n      \"next\" : \"unyaka ozayo\",\n      \"current\" : \"kulo nyaka\",\n      \"future\" : {\n        \"other\" : \"eminyakeni engu-{0} ezayo\",\n        \"one\" : \"onyakeni ongu-{0} ozayo\"\n      },\n      \"previous\" : \"onyakeni odlule\"\n    },\n    \"hour\" : {\n      \"current\" : \"leli hora\",\n      \"past\" : {\n        \"one\" : \"{0} ihora eledlule\",\n        \"other\" : \"emahoreni angu-{0} edlule\"\n      },\n      \"future\" : {\n        \"one\" : \"ehoreni elingu-{0} elizayo\",\n        \"other\" : \"emahoreni angu-{0} ezayo\"\n      }\n    },\n    \"day\" : {\n      \"past\" : {\n        \"one\" : \"osukwini olungu-{0} olwedlule\",\n        \"other\" : \"ezinsukwini ezingu-{0} ezedlule.\"\n      },\n      \"future\" : {\n        \"other\" : \"ezinsukwini ezingu-{0} ezizayo\",\n        \"one\" : \"osukwini olungu-{0} oluzayo\"\n      },\n      \"current\" : \"namhlanje\",\n      \"previous\" : \"izolo\",\n      \"next\" : \"kusasa\"\n    }\n  },\n  \"narrow\" : {\n    \"year\" : {\n      \"past\" : \"{0} unyaka odlule\",\n      \"future\" : {\n        \"other\" : \"eminyakeni engu-{0} ezayo\",\n        \"one\" : \"onyakeni ongu-{0} ozayo\"\n      },\n      \"next\" : \"unyaka ozayo\",\n      \"current\" : \"kulo nyaka\",\n      \"previous\" : \"onyakeni odlule\"\n    },\n    \"quarter\" : {\n      \"past\" : {\n        \"other\" : \"{0} amakota edlule\",\n        \"one\" : \"{0} amakota adlule\"\n      },\n      \"current\" : \"le kota\",\n      \"next\" : \"ikota ezayo\",\n      \"future\" : \"kumakota angu-{0}\",\n      \"previous\" : \"ikota edlule\"\n    },\n    \"day\" : {\n      \"current\" : \"namhlanje\",\n      \"next\" : \"kusasa\",\n      \"past\" : {\n        \"one\" : \"{0} usuku olwedlule\",\n        \"other\" : \"{0} izinsuku ezedlule\"\n      },\n      \"future\" : {\n        \"one\" : \"osukwini olungu-{0} oluzayo\",\n        \"other\" : \"ezinsukwini ezingu-{0} ezizayo\"\n      },\n      \"previous\" : \"izolo\"\n    },\n    \"month\" : {\n      \"previous\" : \"inyanga edlule\",\n      \"next\" : \"inyanga ezayo\",\n      \"future\" : \"enyangeni engu-{0} ezayo\",\n      \"current\" : \"le nyanga\",\n      \"past\" : \"{0} izinyanga ezedlule\"\n    },\n    \"hour\" : {\n      \"current\" : \"leli hora\",\n      \"past\" : {\n        \"one\" : \"{0} ihora eledlule\",\n        \"other\" : \"{0} amahora edlule\"\n      },\n      \"future\" : {\n        \"one\" : \"ehoreni elingu-{0} elizayo\",\n        \"other\" : \"emahoreni angu-{0} ezayo\"\n      }\n    },\n    \"second\" : {\n      \"past\" : {\n        \"one\" : \"{0} isekhondi eledlule\",\n        \"other\" : \"{0} amasekhondi edlule\"\n      },\n      \"current\" : \"manje\",\n      \"future\" : {\n        \"one\" : \"kusekhondi elingu-{0} elizayo\",\n        \"other\" : \"kumasekhondi angu-{0} ezayo\"\n      }\n    },\n    \"minute\" : {\n      \"past\" : {\n        \"one\" : \"{0} iminithi eledlule\",\n        \"other\" : \"{0} amaminithi edlule\"\n      },\n      \"future\" : {\n        \"one\" : \"kuminithi elingu-{0} elizayo\",\n        \"other\" : \"kumaminithi angu-{0} ezayo\"\n      },\n      \"current\" : \"leli minithi\"\n    },\n    \"now\" : \"manje\",\n    \"week\" : {\n      \"next\" : \"iviki elizayo\",\n      \"future\" : \"emavikini angu-{0} ezayo\",\n      \"previous\" : \"iviki eledlule\",\n      \"current\" : \"leli viki\",\n      \"past\" : \"amaviki angu-{0} edlule\"\n    }\n  }\n}"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Foundation+Extras/DateComponents+Extras.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Date Components Extensions\n\npublic extension Calendar.Component {\n\n\t/// Return a description of the calendar component in seconds.\n\t/// Note: \tValues for `era`,`weekday`,`weekdayOrdinal`, `yearForWeekOfYear`, `calendar`, `timezone` are `nil`.\n\t/// \t\tFor `weekOfYear` it return the same value of `weekOfMonth`.\n\tvar timeInterval: Double? {\n\t\tswitch self {\n\t\tcase .era: \t\t\t\t\t\treturn nil\n\t\tcase .year: \t\t\t\t\treturn (Calendar.Component.day.timeInterval! * 365.0)\n\t\tcase .month: \t\t\t\t\treturn (Calendar.Component.minute.timeInterval! * 43800)\n\t\tcase .day: \t\t\t\t\t\treturn 86400\n\t\tcase .hour: \t\t\t\t\treturn 3600\n\t\tcase .minute: \t\t\t\t\treturn 60\n\t\tcase .second: \t\t\t\t\treturn 1\n\t\tcase .quarter: \t\t\t\t\treturn (Calendar.Component.day.timeInterval! * 91.25)\n\t\tcase .weekOfMonth, .weekOfYear: return (Calendar.Component.day.timeInterval! * 7)\n\t\tcase .nanosecond: \t\t\t\treturn 1e-9\n\t\tdefault: \t\t\t\t\t\treturn nil\n\t\t}\n\t}\n\n\t/// Return the localized identifier of a calendar component\n\t///\n\t/// - parameter unit:  unit\n\t/// - parameter value: value\n\t///\n\t/// - returns: return the plural or singular form of the time unit used to compose a valid identifier for search a localized\n\t///   string in resource bundle\n\tinternal func localizedKey(forValue value: Int) -> String {\n\t\tlet locKey = localizedKey\n\t\tlet absValue = abs(value)\n\t\tswitch absValue {\n\t\tcase 0: // zero difference for this unit\n\t\t\treturn \"0\\(locKey)\"\n\t\tcase 1: // one unit of difference\n\t\t\treturn locKey\n\t\tdefault: // more than 1 unit of difference\n\t\t\treturn \"\\(locKey)\\(locKey)\"\n\t\t}\n\t}\n\n\tinternal var localizedKey: String {\n\t\tswitch self {\n\t\tcase .year:\t\t\treturn \"y\"\n\t\tcase .month:\t\treturn \"m\"\n\t\tcase .weekOfYear:\treturn \"w\"\n\t\tcase .day:\t\t\treturn \"d\"\n\t\tcase .hour:\t\t\treturn \"h\"\n\t\tcase .minute:\t\treturn \"M\"\n\t\tcase .second:\t\treturn \"s\"\n\t\tdefault:\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n}\n\npublic extension DateComponents {\n\n\t/// Shortcut for 'all calendar components'.\n\tstatic var allComponentsSet: Set<Calendar.Component> {\n\t\treturn [.era, .year, .month, .day, .hour, .minute,\n\t\t\t\t.second, .weekday, .weekdayOrdinal, .quarter,\n\t\t\t\t.weekOfMonth, .weekOfYear, .yearForWeekOfYear,\n\t\t\t\t.nanosecond, .calendar, .timeZone]\n\t}\n\n\tinternal static let allComponents: [Calendar.Component] =  [.nanosecond, .second, .minute, .hour,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.day, .month, .year, .yearForWeekOfYear,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.weekOfYear, .weekday, .quarter, .weekdayOrdinal,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.weekOfMonth]\n\n\t/// This function return the absolute amount of seconds described by the components of the receiver.\n\t/// Note: \tevaluated value maybe not strictly exact because it ignore the context (calendar/date) of\n\t/// \t\tthe date components. In details:\n\t/// \t\t- The following keys are ignored: `era`,`weekday`,`weekdayOrdinal`,\n\t///\t\t\t\t`weekOfYear`, `yearForWeekOfYear`, `calendar`, `timezone\n\t///\n\t/// Some other values dependant from dates are fixed. This is a complete table:\n\t///\t\t\t- `year` is 365.0 `days`\n\t///\t\t\t- `month` is 30.4167 `days` (or 43800 minutes)\n\t///\t\t\t- `quarter` is 91.25 `days`\n\t///\t\t\t- `weekOfMonth` is 7 `days`\n\t///\t\t\t- `day` is 86400 `seconds`\n\t///\t\t\t- `hour` is 3600 `seconds`\n\t///\t\t\t- `minute` is 60 `seconds`\n\t///\t\t\t- `nanosecond` is 1e-9 `seconds`\n\tvar timeInterval: TimeInterval {\n\t\tvar totalAmount: TimeInterval = 0\n\t\tDateComponents.allComponents.forEach {\n\t\t\tif let multipler = $0.timeInterval, let value = value(for: $0), value != Int(NSDateComponentUndefined) {\n\t\t\t\ttotalAmount += (TimeInterval(value) * multipler)\n\t\t\t}\n\t\t}\n\t\treturn totalAmount\n\t}\n\n\t/// Create a new `DateComponents` instance with builder pattern.\n\t///\n\t/// - Parameter builder: callback for builder\n\t/// - Returns: new instance\n\tstatic func create(_ builder: ((inout DateComponents) -> Void)) -> DateComponents {\n\t\tvar components = DateComponents()\n\t\tbuilder(&components)\n\t\treturn components\n\t}\n\n\t/// Return the current date plus the receive's interval\n\t/// The default calendar used is the `SwiftDate.defaultRegion`'s calendar.\n\tvar fromNow: Date {\n\t\treturn SwiftDate.defaultRegion.calendar.date(byAdding: (self as DateComponents) as DateComponents, to: Date() as Date)!\n\t}\n\n\t/// Returns the current date minus the receiver's interval\n\t/// The default calendar used is the `SwiftDate.defaultRegion`'s calendar.\n\tvar ago: Date {\n\t\treturn SwiftDate.defaultRegion.calendar.date(byAdding: -self as DateComponents, to: Date())!\n\t}\n\n\t/// - returns: the date that will occur once the receiver's components pass after the provide date.\n\tfunc from(_ date: DateRepresentable) -> Date? {\n\t\treturn date.calendar.date(byAdding: self, to: date.date)\n\t}\n\n\t/// Return `true` if all interval components are zeroes\n\tvar isZero: Bool {\n\t\tfor component in DateComponents.allComponents {\n\t\t\tif let value = value(for: component), value != 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\t/// Transform a `DateComponents` instance to a dictionary where key is the `Calendar.Component` and value is the\n\t/// value associated.\n\t///\n\t/// - returns: a new `[Calendar.Component : Int]` dict representing source `DateComponents` instance\n\tinternal func toDict() -> [Calendar.Component: Int] {\n\t\tvar list: [Calendar.Component: Int] = [:]\n\t\tDateComponents.allComponents.forEach { component in\n\t\t\tlet value = self.value(for: component)\n\t\t\tif value != nil && value != Int(NSDateComponentUndefined) {\n\t\t\t\tlist[component] = value!\n\t\t\t}\n\t\t}\n\t\treturn list\n\t}\n\n\t/// Alter date components specified into passed dictionary.\n\t///\n\t/// - Parameter components: components dictionary with their values.\n\tinternal mutating func alterComponents(_ components: [Calendar.Component: Int?]) {\n\t\tcomponents.forEach {\n\t\t\tif let v = $0.value {\n\t\t\t\tsetValue(v, for: $0.key)\n\t\t\t}\n\t\t}\n\t}\n\n\t/// Adds two NSDateComponents and returns their combined individual components.\n\tstatic func + (lhs: DateComponents, rhs: DateComponents) -> DateComponents {\n\t\treturn combine(lhs, rhs: rhs, transform: +)\n\t}\n\n\t/// Subtracts two NSDateComponents and returns the relative difference between them.\n\tstatic func - (lhs: DateComponents, rhs: DateComponents) -> DateComponents {\n\t\treturn lhs + (-rhs)\n\t}\n\n\t/// Applies the `transform` to the two `T` provided, defaulting either of them if it's\n\t/// `nil`\n\tinternal static func bimap<T>(_ a: T?, _ b: T?, default: T, _ transform: (T, T) -> T) -> T? {\n\t\tif a == nil && b == nil { return nil }\n\t\treturn transform(a ?? `default`, b ?? `default`)\n\t}\n\n\t/// - returns: a new `NSDateComponents` that represents the negative of all values within the\n\t/// components that are not `NSDateComponentUndefined`.\n\tstatic prefix func - (rhs: DateComponents) -> DateComponents {\n\t\tvar components = DateComponents()\n\t\tcomponents.era = rhs.era.map(-)\n\t\tcomponents.year = rhs.year.map(-)\n\t\tcomponents.month = rhs.month.map(-)\n\t\tcomponents.day = rhs.day.map(-)\n\t\tcomponents.hour = rhs.hour.map(-)\n\t\tcomponents.minute = rhs.minute.map(-)\n\t\tcomponents.second = rhs.second.map(-)\n\t\tcomponents.nanosecond = rhs.nanosecond.map(-)\n\t\tcomponents.weekday = rhs.weekday.map(-)\n\t\tcomponents.weekdayOrdinal = rhs.weekdayOrdinal.map(-)\n\t\tcomponents.quarter = rhs.quarter.map(-)\n\t\tcomponents.weekOfMonth = rhs.weekOfMonth.map(-)\n\t\tcomponents.weekOfYear = rhs.weekOfYear.map(-)\n\t\tcomponents.yearForWeekOfYear = rhs.yearForWeekOfYear.map(-)\n\t\treturn components\n\t}\n\n\t/// Combines two date components using the provided `transform` on all\n\t/// values within the components that are not `NSDateComponentUndefined`.\n\tprivate static func combine(_ lhs: DateComponents, rhs: DateComponents, transform: (Int, Int) -> Int) -> DateComponents {\n\t\tvar components = DateComponents()\n\t\tcomponents.era = bimap(lhs.era, rhs.era, default: 0, transform)\n\t\tcomponents.year = bimap(lhs.year, rhs.year, default: 0, transform)\n\t\tcomponents.month = bimap(lhs.month, rhs.month, default: 0, transform)\n\t\tcomponents.day = bimap(lhs.day, rhs.day, default: 0, transform)\n\t\tcomponents.hour = bimap(lhs.hour, rhs.hour, default: 0, transform)\n\t\tcomponents.minute = bimap(lhs.minute, rhs.minute, default: 0, transform)\n\t\tcomponents.second = bimap(lhs.second, rhs.second, default: 0, transform)\n\t\tcomponents.nanosecond = bimap(lhs.nanosecond, rhs.nanosecond, default: 0, transform)\n\t\tcomponents.weekday = bimap(lhs.weekday, rhs.weekday, default: 0, transform)\n\t\tcomponents.weekdayOrdinal = bimap(lhs.weekdayOrdinal, rhs.weekdayOrdinal, default: 0, transform)\n\t\tcomponents.quarter = bimap(lhs.quarter, rhs.quarter, default: 0, transform)\n\t\tcomponents.weekOfMonth = bimap(lhs.weekOfMonth, rhs.weekOfMonth, default: 0, transform)\n\t\tcomponents.weekOfYear = bimap(lhs.weekOfYear, rhs.weekOfYear, default: 0, transform)\n\t\tcomponents.yearForWeekOfYear = bimap(lhs.yearForWeekOfYear, rhs.yearForWeekOfYear, default: 0, transform)\n\t\treturn components\n\t}\n\n\t/// Subscription support for `DateComponents` instances.\n\t/// ie. `cmps[.day] = 5`\n\t///\n\t/// Note: This does not take into account any built-in errors, `Int.max` returned instead of `nil`.\n\t///\n\t/// - Parameter component: component to get\n\tsubscript(component: Calendar.Component) -> Int? {\n\t\tswitch component {\n\t\tcase .era: \t\t\t\t\treturn era\n\t\tcase .year: \t\t\t\treturn year\n\t\tcase .month: \t\t\t\treturn month\n\t\tcase .day: \t\t\t\t\treturn day\n\t\tcase .hour: \t\t\t\treturn hour\n\t\tcase .minute: \t\t\t\treturn minute\n\t\tcase .second: \t\t\t\treturn second\n\t\tcase .weekday: \t\t\t\treturn weekday\n\t\tcase .weekdayOrdinal: \t\treturn weekdayOrdinal\n\t\tcase .quarter: \t\t\t\treturn quarter\n\t\tcase .weekOfMonth: \t\t\treturn weekOfMonth\n\t\tcase .weekOfYear:\t \t\treturn weekOfYear\n\t\tcase .yearForWeekOfYear: \treturn yearForWeekOfYear\n\t\tcase .nanosecond: \t\t\treturn nanosecond\n\t\tdefault: \t\t\t\t\treturn nil // `calendar` and `timezone` are ignored in this context\n\t\t}\n\t}\n\n\t/// Express a `DateComponents` instance in another time unit you choose.\n\t///\n\t/// - parameter component: time component\n\t/// - parameter calendar:  context calendar to use\n\t///\n\t/// - returns: the value of interval expressed in selected `Calendar.Component`\n\tfunc `in`(_ component: Calendar.Component, of calendar: CalendarConvertible? = nil) -> Int? {\n\t\tlet cal = (calendar?.toCalendar() ?? SwiftDate.defaultRegion.calendar)\n\t\tlet dateFrom = Date()\n\t\tlet dateTo = (dateFrom + self)\n\t\tlet components: Set<Calendar.Component> = [component]\n\t\tlet value = cal.dateComponents(components, from: dateFrom, to: dateTo).value(for: component)\n\t\treturn value\n\t}\n\n\t/// Express a `DateComponents` instance in a set of time units you choose.\n\t///\n\t/// - Parameters:\n\t///   - component: time component\n\t///   - calendar: context calendar to use\n\t/// - Returns: a dictionary of extract values.\n\tfunc `in`(_ components: Set<Calendar.Component>, of calendar: CalendarConvertible? = nil) -> [Calendar.Component: Int] {\n\t\tlet cal = (calendar?.toCalendar() ?? SwiftDate.defaultRegion.calendar)\n\t\tlet dateFrom = Date()\n\t\tlet dateTo = (dateFrom + self)\n\t\tlet extractedCmps = cal.dateComponents(components, from: dateFrom, to: dateTo)\n\t\treturn extractedCmps.toDict()\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Foundation+Extras/Int+DateComponents.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: Int Extension\n\n/// This allows us to transform a literal number in a `DateComponents` and use it in math operations\n/// For example `5.days` will create a new `DateComponents` where `.day = 5`.\n\npublic extension Int {\n\n\t/// Internal transformation function\n\t///\n\t/// - parameter type: component to use\n\t///\n\t/// - returns: return self value in form of `DateComponents` where given `Calendar.Component` has `self` as value\n\tinternal func toDateComponents(type: Calendar.Component) -> DateComponents {\n\t\tvar dateComponents = DateComponents()\n        DateComponents.allComponents.forEach( { dateComponents.setValue(0, for: $0 )})\n        dateComponents.setValue(self, for: type)\n        dateComponents.setValue(0, for: .era)\n\t\treturn dateComponents\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as nanoseconds\n\tvar nanoseconds: DateComponents {\n\t\treturn toDateComponents(type: .nanosecond)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as seconds\n\tvar seconds: DateComponents {\n\t\treturn toDateComponents(type: .second)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as minutes\n\tvar minutes: DateComponents {\n\t\treturn toDateComponents(type: .minute)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as hours\n\tvar hours: DateComponents {\n\t\treturn toDateComponents(type: .hour)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as days\n\tvar days: DateComponents {\n\t\treturn toDateComponents(type: .day)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as weeks\n\tvar weeks: DateComponents {\n\t\treturn toDateComponents(type: .weekOfYear)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as months\n\tvar months: DateComponents {\n\t\treturn toDateComponents(type: .month)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as years\n\tvar years: DateComponents {\n\t\treturn toDateComponents(type: .year)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as quarters\n\tvar quarters: DateComponents {\n\t\treturn toDateComponents(type: .quarter)\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Foundation+Extras/String+Parser.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - DataParsable Protocol\n\npublic protocol DateParsable {\n\n\t/// Convert a string to a `DateInRegion` instance by parsing it with given parser\n\t/// or using one of the built-in parser (if you know the format of the date you\n\t/// should consider explicitly pass it to avoid unecessary computations).\n\t///\n\t/// - Parameters:\n\t///   - format: format of the date, `nil` to leave the library to found the best\n\t///\t\t\t\tone via `SwiftDate.autoFormats`\n\t///   - region: region in which the date should be expressed in.\n\t///\t\t\t\tRegion's locale is used to format the date when using long readable unit names (like MMM\n\t///\t\t\t\tfor month).\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDate(_ format: String?, region: Region) -> DateInRegion?\n\n\t/// Convert a string to a `DateInRegion` instance by parsing it with the ordered\n\t/// list of provided formats.\n\t/// If `formats` array is not provided it uses the `SwiftDate.autoFormats` array instead.\n\t/// Note: if you knwo the format of the date you should consider explicitly pass it to avoid\n\t///       unecessary computations.\n\t///\n\t/// - Parameters:\n\t///   - format: ordered formats to parse date (if you don't have a list of formats you can pass `SwiftDate.autoFormats`)\n\t///   - region: region in which the date should be expressed in.\n\t///\t\t\t\tRegion's locale is used to format the date when using long readable unit names (like MMM\n\t///\t\t\t\tfor month).\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDate(_ formats: [String], region: Region) -> DateInRegion?\n\n\t/// Convert a string to a valid `DateInRegion` using passed style.\n\t///\n\t/// - Parameters:\n\t///   - style: parsing style.\n\t///   - region: region in which the date should be expressed in\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDate(style: StringToDateStyles, region: Region) -> DateInRegion?\n\n\t/// Convert to date from a valid ISO8601 string\n\t///\n\t/// - Parameters:\n\t///   - options: options of the parser\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toISODate(_ options: ISOParser.Options?, region: Region?) -> DateInRegion?\n\n\t/// Convert to date from a valid DOTNET string\n\t///\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDotNETDate(region: Region) -> DateInRegion?\n\n\t/// Convert to a date from a valid RSS/ALT RSS string\n\t///\n\t/// - Parameters:\n\t///   - alt: `true` if string represent an ALT RSS formatted date, `false` if a standard RSS formatted date.\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toRSSDate(alt: Bool, region: Region) -> DateInRegion?\n\n\t/// Convert to a date from a valid SQL format string.\n\t///\n\t/// - Parameters:\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toSQLDate(region: Region) -> DateInRegion?\n\n}\n\n// MARK: - DataParsable Implementation for Strings\n\nextension String: DateParsable {\n\n\tpublic func toDate(_ format: String? = nil, region: Region = SwiftDate.defaultRegion) -> DateInRegion? {\n\t\treturn DateInRegion(self, format: format, region: region)\n\t}\n\n\tpublic func toDate(_ formats: [String], region: Region) -> DateInRegion? {\n\t\treturn DateInRegion(self, formats: formats, region: region)\n\t}\n\n\tpublic func toDate(style: StringToDateStyles, region: Region = SwiftDate.defaultRegion) -> DateInRegion? {\n\t\treturn style.toDate(self, region: region)\n\t}\n\n\tpublic func toISODate(_ options: ISOParser.Options? = nil, region: Region? = nil) -> DateInRegion? {\n\t\treturn ISOParser.parse(self, region: region, options: options)\n\t}\n\n\tpublic func toDotNETDate(region: Region = Region.ISO) -> DateInRegion? {\n\t\treturn DOTNETParser.parse(self, region: region, options: nil)\n\t}\n\n\tpublic func toRSSDate(alt: Bool, region: Region = Region.ISO) -> DateInRegion? {\n\t\tswitch alt {\n\t\tcase true: \treturn StringToDateStyles.altRSS.toDate(self, region: region)\n\t\tcase false: return StringToDateStyles.rss.toDate(self, region: region)\n\t\t}\n\t}\n\n\tpublic func toSQLDate(region: Region = Region.ISO) -> DateInRegion? {\n\t\treturn StringToDateStyles.sql.toDate(self, region: region)\n\t}\n\t\n\tpublic func asLocale() -> Locale {\n               Locale(identifier: self)\n        }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Foundation+Extras/TimeInterval+Formatter.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension TimeInterval {\n\n\tstruct ComponentsFormatterOptions {\n\n\t\t/// Fractional units may be used when a value cannot be exactly represented using the available units.\n\t\t/// For example, if minutes are not allowed, the value “1h 30m” could be formatted as “1.5h”.\n\t\tpublic var allowsFractionalUnits: Bool?\n\n\t\t/// Specify the units that can be used in the output.\n\t\tpublic var allowedUnits: NSCalendar.Unit?\n\n\t\t/// A Boolean value indicating whether to collapse the largest unit into smaller units when a certain threshold is met.\n\t\tpublic var collapsesLargestUnit: Bool?\n\n\t\t/// The maximum number of time units to include in the output string.\n\t\t/// If 0 does not cause the elimination of any units.\n\t\tpublic var maximumUnitCount: Int?\n\n\t\t/// The formatting style for units whose value is 0.\n\t\tpublic var zeroFormattingBehavior: DateComponentsFormatter.ZeroFormattingBehavior?\n\n\t\t/// The preferred style for units.\n\t\tpublic var unitsStyle: DateComponentsFormatter.UnitsStyle?\n\n\t\t/// Locale of the formatter\n\t\tpublic var locale: LocaleConvertible? {\n\t\t\tset { calendar.locale = newValue?.toLocale() }\n\t\t\tget { return calendar.locale }\n\t\t}\n\n\t\t/// Calendar\n        public var calendar = Calendar.autoupdatingCurrent\n\n\t\tpublic func apply(toFormatter formatter: DateComponentsFormatter) {\n            formatter.calendar = calendar\n\n            if let allowsFractionalUnits = self.allowsFractionalUnits {\n                formatter.allowsFractionalUnits = allowsFractionalUnits\n            }\n            if let allowedUnits = self.allowedUnits {\n                formatter.allowedUnits = allowedUnits\n            }\n            if let collapsesLargestUnit = self.collapsesLargestUnit {\n                formatter.collapsesLargestUnit = collapsesLargestUnit\n            }\n            if let maximumUnitCount = self.maximumUnitCount {\n                formatter.maximumUnitCount = maximumUnitCount\n            }\n            if let zeroFormattingBehavior = self.zeroFormattingBehavior {\n                formatter.zeroFormattingBehavior = zeroFormattingBehavior\n            }\n            if let unitsStyle = self.unitsStyle {\n                formatter.unitsStyle = unitsStyle\n            }\n\t\t}\n\n\t\tpublic init() {}\n\t}\n\n\t/// Return the local thread shared formatter for date components\n\tprivate static func sharedFormatter() -> DateComponentsFormatter {\n\t\tlet name = \"SwiftDate_\\(NSStringFromClass(DateComponentsFormatter.self))\"\n\t\treturn threadSharedObject(key: name, create: {\n\t\t\tlet formatter = DateComponentsFormatter()\n\t\t\tformatter.includesApproximationPhrase = false\n\t\t\tformatter.includesTimeRemainingPhrase = false\n\t\t\treturn formatter\n\t\t})\n\t}\n\n\t//@available(*, deprecated: 5.0.13, obsoleted: 5.1, message: \"Use toIntervalString function instead\")\n\tfunc toString(options callback: ((inout ComponentsFormatterOptions) -> Void)? = nil) -> String {\n\t\treturn self.toIntervalString(options: callback)\n\t}\n\n\t/// Format a time interval in a string with desidered components with passed style.\n\t///\n\t/// - Parameters:\n\t///   - units: units to include in string.\n\t///   - style: style of the units, by default is `.abbreviated`\n\t/// - Returns: string representation\n\tfunc toIntervalString(options callback: ((inout ComponentsFormatterOptions) -> Void)? = nil) -> String {\n\t\tlet formatter = DateComponentsFormatter()\n\t\tvar options = ComponentsFormatterOptions()\n\t\tcallback?(&options)\n\t\toptions.apply(toFormatter: formatter)\n\n        let formattedValue = (formatter.string(from: self) ?? \"\")\n        if options.zeroFormattingBehavior?.contains(.pad) ?? false {\n            // for some strange reason padding is not added at the very beginning positional item.\n            // we'll add it manually if necessaru\n            if let index = formattedValue.firstIndex(of: \":\"), index.utf16Offset(in: formattedValue) < 2 {\n                return \"0\\(formattedValue)\"\n            }\n        }\n        return formattedValue\n\t}\n\n\t/// Format a time interval in a string with desidered components with passed style.\n\t///\n\t/// - Parameter options: options for formatting.\n\t/// - Returns: string representation\n\tfunc toString(options: ComponentsFormatterOptions) -> String {\n\t\tlet formatter = TimeInterval.sharedFormatter()\n\t\toptions.apply(toFormatter: formatter)\n\t\treturn (formatter.string(from: self) ?? \"\")\n\t}\n\n\t/// Return a string representation of the time interval in form of clock countdown (ie. 57:00:00)\n\t///\n\t/// - Parameter zero: behaviour with zero.\n\t/// - Returns: string representation\n\tfunc toClock(zero: DateComponentsFormatter.ZeroFormattingBehavior =  [.pad, .dropLeading]) -> String {\n\t\treturn toIntervalString(options: {\n            $0.collapsesLargestUnit = true\n            $0.maximumUnitCount = 0\n\t\t\t$0.unitsStyle = .positional\n            $0.locale = Locales.englishUnitedStatesComputer\n\t\t\t$0.zeroFormattingBehavior = zero\n\t\t})\n\t}\n\n\t/// Extract requeste time units components from given interval.\n\t/// Reference date's calendar is used to make the extraction.\n\t///\n\t/// NOTE:\n\t///\t\tExtraction is calendar/date based; if you specify a `refDate` calculation is made\n\t/// \tbetween the `refDate` and `refDate + interval`.\n\t/// \tIf `refDate` is `nil` evaluation is made from `now()` and `now() + interval` in the context\n\t/// \tof the `SwiftDate.defaultRegion` set.\n\t///\n\t/// - Parameters:\n\t///   - units: units to extract\n\t///   - from: starting reference date, `nil` means `now()` in the context of the default region set.\n\t/// - Returns: dictionary with extracted components\n\tfunc toUnits(_ units: Set<Calendar.Component>, to refDate: DateInRegion? = nil) -> [Calendar.Component: Int] {\n\t\tlet dateTo = (refDate ?? DateInRegion())\n\t\tlet dateFrom = dateTo.addingTimeInterval(-self)\n\t\tlet components = dateFrom.calendar.dateComponents(units, from: dateFrom.date, to: dateTo.date)\n\t\treturn components.toDict()\n\t}\n\n\t/// Express a time interval (expressed in seconds) in another time unit you choose.\n\t/// Reference date's calendar is used to make the extraction.\n\t///\n\t/// - parameter component: time unit in which you want to express the calendar component\n\t/// - parameter from: starting reference date, `nil` means `now()` in the context of the default region set.\n\t///\n\t/// - returns: the value of interval expressed in selected `Calendar.Component`\n\tfunc toUnit(_ component: Calendar.Component, to refDate: DateInRegion? = nil) -> Int? {\n\t\treturn toUnits([component], to: refDate)[component]\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Supports/AssociatedValues.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\n#if os(Linux)\n\n#else\nimport Foundation\nimport ObjectiveC.runtime\n\ninternal func getAssociatedValue<T>(key: String, object: AnyObject) -> T? {\n\treturn (objc_getAssociatedObject(object, key.address) as? AssociatedValue)?.value as? T\n}\n\ninternal func getAssociatedValue<T>(key: String, object: AnyObject, initialValue: @autoclosure () -> T) -> T {\n\treturn getAssociatedValue(key: key, object: object) ?? setAndReturn(initialValue: initialValue(), key: key, object: object)\n}\n\ninternal func getAssociatedValue<T>(key: String, object: AnyObject, initialValue: () -> T) -> T {\n\treturn getAssociatedValue(key: key, object: object) ?? setAndReturn(initialValue: initialValue(), key: key, object: object)\n}\n\nprivate func setAndReturn<T>(initialValue: T, key: String, object: AnyObject) -> T {\n\tset(associatedValue: initialValue, key: key, object: object)\n\treturn initialValue\n}\n\ninternal func set<T>(associatedValue: T?, key: String, object: AnyObject) {\n\tset(associatedValue: AssociatedValue(associatedValue), key: key, object: object)\n}\n\ninternal func set<T: AnyObject>(weakAssociatedValue: T?, key: String, object: AnyObject) {\n\tset(associatedValue: AssociatedValue(weak: weakAssociatedValue), key: key, object: object)\n}\n\nextension String {\n\n\tfileprivate var address: UnsafeRawPointer {\n\t\treturn UnsafeRawPointer(bitPattern: abs(hashValue))!\n\t}\n\n}\n\nprivate func set(associatedValue: AssociatedValue, key: String, object: AnyObject) {\n\tobjc_setAssociatedObject(object, key.address, associatedValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n}\n\nprivate class AssociatedValue {\n\n\tweak var _weakValue: AnyObject?\n\tvar _value: Any?\n\n\tvar value: Any? {\n\t\treturn _weakValue ?? _value\n\t}\n\n\tinit(_ value: Any?) {\n\t\t_value = value\n\t}\n\n\tinit(weak: AnyObject?) {\n\t\t_weakValue = weak\n\t}\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Supports/Calendars.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic typealias Calendars = Calendar.Identifier\n\npublic protocol CalendarConvertible {\n\tfunc toCalendar() -> Calendar\n}\n\nextension Calendar: CalendarConvertible {\n\n\tpublic func toCalendar() -> Calendar {\n\t\treturn self\n\t}\n\n\tinternal static func newCalendar(_ calendar: CalendarConvertible, configure: ((inout Calendar) -> Void)? = nil) -> Calendar {\n\t\tvar cal = calendar.toCalendar()\n\t\tconfigure?(&cal)\n\t\treturn cal\n\t}\n\n}\n\nextension Calendar.Identifier: CalendarConvertible {\n\n\tpublic func toCalendar() -> Calendar {\n\t\treturn Calendar(identifier: self)\n\t}\n\n}\n\n// MARK: - Support for Calendar.Identifier encoding with Codable\n\nextension Calendar.Identifier: CustomStringConvertible {\n\n\tpublic var description: String {\n\t\tswitch self {\n\t\tcase .gregorian:\t\t\treturn \"gregorian\"\n\t\tcase .buddhist:\t\t\t\treturn \"buddhist\"\n\t\tcase .chinese:\t\t\t\treturn \"chinese\"\n\t\tcase .coptic:\t\t\t\treturn \"coptic\"\n\t\tcase .ethiopicAmeteMihret:\treturn \"ethiopicAmeteMihret\"\n\t\tcase .ethiopicAmeteAlem:\treturn \"ethiopicAmeteAlem\"\n\t\tcase .hebrew:\t\t\t\treturn \"hebrew\"\n\t\tcase .iso8601:\t\t\t\treturn \"iso8601\"\n\t\tcase .indian:\t\t\t\treturn \"indian\"\n\t\tcase .islamic:\t\t\t\treturn \"islamic\"\n\t\tcase .islamicCivil:\t\t\treturn \"islamicCivil\"\n\t\tcase .japanese:\t\t\t\treturn \"japanese\"\n\t\tcase .persian:\t\t\t\treturn \"persian\"\n\t\tcase .republicOfChina:\t\treturn \"republicOfChina\"\n\t\tcase .islamicTabular:\t\treturn \"islamicTabular\"\n\t\tcase .islamicUmmAlQura:\t\treturn \"islamicUmmAlQura\"\n\t\t@unknown default:\n\t\t\tfatalError(\"Unsupported calendar \\(self)\")\n\t\t}\n\t}\n\n\tpublic init(_ rawValue: String) {\n\t\tswitch rawValue {\n\t\tcase Calendar.Identifier.gregorian.description:\t\t\t\tself = .gregorian\n\t\tcase Calendar.Identifier.buddhist.description:\t\t\t\tself = .buddhist\n\t\tcase Calendar.Identifier.chinese.description:\t\t\t\tself = .chinese\n\t\tcase Calendar.Identifier.coptic.description:\t\t\t\tself = .coptic\n\t\tcase Calendar.Identifier.ethiopicAmeteMihret.description:\tself = .ethiopicAmeteMihret\n\t\tcase Calendar.Identifier.ethiopicAmeteAlem.description:\t\tself = .ethiopicAmeteAlem\n\t\tcase Calendar.Identifier.hebrew.description:\t\t\t\tself = .hebrew\n\t\tcase Calendar.Identifier.iso8601.description:\t\t\t\tself = .iso8601\n\t\tcase Calendar.Identifier.indian.description:\t\t\t\tself = .indian\n\t\tcase Calendar.Identifier.islamic.description:\t\t\t\tself = .islamic\n\t\tcase Calendar.Identifier.islamicCivil.description:\t\t\tself = .islamicCivil\n\t\tcase Calendar.Identifier.japanese.description:\t\t\t\tself = .japanese\n\t\tcase Calendar.Identifier.persian.description:\t\t\t\tself = .persian\n\t\tcase Calendar.Identifier.republicOfChina.description:\t\tself = .republicOfChina\n\t\tcase Calendar.Identifier.islamicTabular.description:\t\tself = .islamicTabular\n\t\tcase Calendar.Identifier.islamicTabular.description:\t\tself = .islamicTabular\n\t\tcase Calendar.Identifier.islamicUmmAlQura.description:\t\tself = .islamicUmmAlQura\n\t\tdefault:\n\t\t\tlet defaultCalendar = SwiftDate.defaultRegion.calendar.identifier\n\t\t\tdebugPrint(\"Calendar Identifier '\\(rawValue)' not recognized. Using default (\\(defaultCalendar))\")\n\t\t\tself = defaultCalendar\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Supports/Commons.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Atomic Variable Support\n\n@propertyWrapper\ninternal struct Atomic<Value> {\n    private let queue = DispatchQueue(label: \"com.vadimbulavin.atomic\")\n    private var value: Value\n\n    init(wrappedValue: Value) {\n        self.value = wrappedValue\n    }\n    \n    var wrappedValue: Value {\n        get {\n            return queue.sync { value }\n        }\n        set {\n            queue.sync { value = newValue }\n        }\n    }\n    \n}\n\n// MARK: - DateFormatter\n\npublic extension DateFormatter {\n\n\t/// Return the local thread shared formatter initialized with the configuration of the region passed.\n\t///\n\t/// - Parameters:\n\t///   - region: region used to pre-configure the cell.\n\t///   - format: optional format used to set the `dateFormat` property.\n\t/// - Returns: date formatter instance\n\tstatic func sharedFormatter(forRegion region: Region?, format: String? = nil) -> DateFormatter {\n\t\tlet name = \"SwiftDate_\\(NSStringFromClass(DateFormatter.self))\"\n\t\tlet formatter: DateFormatter = threadSharedObject(key: name, create: { return DateFormatter() })\n\t\tif let region = region {\n\t\t\tformatter.timeZone = region.timeZone\n\t\t\tformatter.calendar = region.calendar\n\t\t\tformatter.locale = region.locale\n\t\t}\n\t\tformatter.dateFormat = (format ?? DateFormats.iso8601)\n\t\treturn formatter\n\t}\n\n\t/// Returned number formatter instance shared along calling thread to format ordinal numbers.\n\t///\n\t/// - Parameter locale: locale to set\n\t/// - Returns: number formatter instance\n\t@available(iOS 9.0, macOS 10.11, *)\n\tstatic func sharedOrdinalNumberFormatter(locale: LocaleConvertible) -> NumberFormatter {\n\t\tlet name = \"SwiftDate_\\(NSStringFromClass(NumberFormatter.self))\"\n\t\tlet formatter = threadSharedObject(key: name, create: { return NumberFormatter() })\n\t\tformatter.numberStyle = .ordinal\n\t\tformatter.locale = locale.toLocale()\n\t\treturn formatter\n\t}\n\n}\n\n/// This function create (if necessary) and return a thread singleton instance of the\n/// object you want.\n///\n/// - Parameters:\n///   - key: identifier of the object.\n///   - create: create routine used the first time you are about to create the object in thread.\n/// - Returns: instance of the object for caller's thread.\ninternal func threadSharedObject<T: AnyObject>(key: String, create: () -> T) -> T {\n\tif let cachedObj = Thread.current.threadDictionary[key] as? T {\n\t\treturn cachedObj\n\t} else {\n\t\tlet newObject = create()\n\t\tThread.current.threadDictionary[key] = newObject\n\t\treturn newObject\n\t}\n}\n\n/// Style used to format month, weekday, quarter symbols.\n/// Stand-alone properties are for use in places like calendar headers.\n/// Non-stand-alone properties are for use in context (for example, “Saturday, November 12th”).\n///\n/// - `default`: Default formatter (ie. `4th quarter` for quarter, `April` for months and `Wednesday` for weekdays)\n/// - defaultStandalone:  See `default`; See `short`; stand-alone properties are for use in places like calendar headers.\n/// - short: Short symbols (ie. `Jun` for months, `Fri` for weekdays, `Q1` for quarters).\n/// - veryShort: Very short symbols (ie. `J` for months, `F` for weekdays, for quarter it just return `short` variant).\n/// - standaloneShort: See `short`; stand-alone properties are for use in places like calendar headers.\n/// - standaloneVeryShort: See `veryShort`; stand-alone properties are for use in places like calendar headers.\npublic enum SymbolFormatStyle {\n\tcase `default`\n\tcase defaultStandalone\n\tcase short\n\tcase veryShort\n\tcase standaloneShort\n\tcase standaloneVeryShort\n}\n\n/// Encapsulate the logic to use date format strings\npublic struct DateFormats {\n\n\t/// This is the built-in list of all supported formats for auto-parsing of a string to a date.\n\tinternal static let builtInAutoFormat: [String] =  [\n\t\tDateFormats.iso8601,\n\t\t\"yyyy'-'MM'-'dd'T'HH':'mm':'ssZ\",\n\t\t\"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSSZ\",\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\",\n\t\t\"yyyy-MM-dd HH:mm:ss\",\n\t\t\"yyyy-MM-dd HH:mm\",\n\t\t\"yyyy-MM-dd\",\n\t\t\"h:mm:ss A\",\n\t\t\"h:mm A\",\n\t\t\"MM/dd/yyyy\",\n\t\t\"MMMM d, yyyy\",\n\t\t\"MMMM d, yyyy LT\",\n\t\t\"dddd, MMMM D, yyyy LT\",\n\t\t\"yyyyyy-MM-dd\",\n\t\t\"yyyy-MM-dd\",\n\t\t\"yyyy-'W'ww-E\",\n\t\t\"GGGG-'['W']'ww-E\",\n\t\t\"yyyy-'W'ww\",\n\t\t\"GGGG-'['W']'ww\",\n\t\t\"yyyy'W'ww\",\n\t\t\"yyyy-ddd\",\n\t\t\"HH:mm:ss.SSSS\",\n\t\t\"HH:mm:ss\",\n\t\t\"HH:mm\",\n\t\t\"HH\"\n\t]\n\n\t/// This is the ordered list of all formats SwiftDate can use in order to attempt parsing a passaed\n\t/// date expressed as string. Evaluation is made in order; you can add or remove new formats as you wish.\n\t/// In order to reset the list call `resetAutoFormats()` function.\n\tpublic static var autoFormats: [String] = DateFormats.builtInAutoFormat\n\n\t/// Default ISO8601 format string\n\tpublic static let iso8601: String = \"yyyy-MM-dd'T'HH:mm:ssZZZZZ\"\n\n\t/// Extended format\n\tpublic static let extended: String = \"eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz\"\n\n\t/// The Alternative RSS formatted date \"d MMM yyyy HH:mm:ss ZZZ\" i.e. \"09 Sep 2011 15:26:08 +0200\"\n\tpublic static let altRSS: String = \"d MMM yyyy HH:mm:ss ZZZ\"\n\n\t/// The RSS formatted date \"EEE, d MMM yyyy HH:mm:ss ZZZ\" i.e. \"Fri, 09 Sep 2011 15:26:08 +0200\"\n\tpublic static let rss: String = \"EEE, d MMM yyyy HH:mm:ss ZZZ\"\n\n\t/// The http header formatted date \"EEE, dd MMM yyyy HH:mm:ss zzz\" i.e. \"Tue, 15 Nov 1994 12:45:26 GMT\"\n\tpublic static let httpHeader: String = \"EEE, dd MMM yyyy HH:mm:ss zzz\"\n\n\t/// A generic standard format date i.e. \"EEE MMM dd HH:mm:ss Z yyyy\"\n\tpublic static let standard: String = \"EEE MMM dd HH:mm:ss Z yyyy\"\n\n\t/// SQL date format\n\tpublic static let sql: String = \"yyyy-MM-dd'T'HH:mm:ss.SSSX\"\n\n\t/// Reset the list of auto formats to the initial settings.\n\tpublic static func resetAutoFormats() {\n\t\tautoFormats = DateFormats.builtInAutoFormat\n\t}\n\n\t/// Parse a new string optionally passing the format in which is encoded. If no format is passed\n\t/// an attempt is made by cycling all the formats set in `autoFormats` property.\n\t///\n\t/// - Parameters:\n\t///   - string: date expressed as string.\n\t///   - suggestedFormat: optional format of the date expressed by the string (set it if you can in order to optimize the parse task).\n\t///   - region: region in which the date is expressed.\n\t/// - Returns: parsed absolute `Date`, `nil` if parse fails.\n\tpublic static func parse(string: String, format: String?, region: Region) -> Date? {\n\t\tlet formats = (format != nil ? [format!] : DateFormats.autoFormats)\n\t\treturn DateFormats.parse(string: string, formats: formats, region: region)\n\t}\n\n\tpublic static func parse(string: String, formats: [String], region: Region) -> Date? {\n\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region)\n\n\t\tvar parsedDate: Date?\n\t\tfor format in formats {\n\t\t\tformatter.dateFormat = format\n\t\t\tformatter.locale = region.locale\n\t\t\tif let date = formatter.date(from: string) {\n\t\t\t\tparsedDate = date\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn parsedDate\n\t}\n}\n\n// MARK: - Calendar Extension\n\npublic extension Calendar.Component {\n\n\tinternal static func toSet(_ src: [Calendar.Component]) -> Set<Calendar.Component> {\n\t\tvar l: Set<Calendar.Component> = []\n\t\tsrc.forEach { l.insert($0) }\n\t\treturn l\n\t}\n\n\tinternal var nsCalendarUnit: NSCalendar.Unit {\n\t\tswitch self {\n\t\tcase .era: return NSCalendar.Unit.era\n\t\tcase .year: return NSCalendar.Unit.year\n\t\tcase .month: return NSCalendar.Unit.month\n\t\tcase .day: return NSCalendar.Unit.day\n\t\tcase .hour: return NSCalendar.Unit.hour\n\t\tcase .minute: return NSCalendar.Unit.minute\n\t\tcase .second: return NSCalendar.Unit.second\n\t\tcase .weekday: return NSCalendar.Unit.weekday\n\t\tcase .weekdayOrdinal: return NSCalendar.Unit.weekdayOrdinal\n\t\tcase .quarter: return NSCalendar.Unit.quarter\n\t\tcase .weekOfMonth: return NSCalendar.Unit.weekOfMonth\n\t\tcase .weekOfYear: return NSCalendar.Unit.weekOfYear\n\t\tcase .yearForWeekOfYear: return NSCalendar.Unit.yearForWeekOfYear\n\t\tcase .nanosecond: return NSCalendar.Unit.nanosecond\n\t\tcase .calendar: return NSCalendar.Unit.calendar\n\t\tcase .timeZone: return NSCalendar.Unit.timeZone\n\t\t@unknown default:\n\t\t\tfatalError(\"Unsupported type \\(self)\")\n\t\t}\n\t}\n}\n\n/// Rounding mode for dates.\n/// Round off/up (ceil) or down (floor) target date.\npublic enum RoundDateMode {\n\tcase to5Mins\n\tcase to10Mins\n\tcase to30Mins\n\tcase toMins(_: Int)\n\tcase toCeil5Mins\n\tcase toCeil10Mins\n\tcase toCeil30Mins\n\tcase toCeilMins(_: Int)\n\tcase toFloor5Mins\n\tcase toFloor10Mins\n\tcase toFloor30Mins\n\tcase toFloorMins(_: Int)\n}\n\n/// Related type enum to get derivated date from a receiver date.\npublic enum DateRelatedType {\n\tcase startOfDay\n\tcase endOfDay\n\tcase startOfWeek\n\tcase endOfWeek\n\tcase startOfMonth\n\tcase endOfMonth\n\tcase tomorrow\n\tcase tomorrowAtStart\n\tcase yesterday\n\tcase yesterdayAtStart\n\tcase nearestMinute(minute: Int)\n\tcase nearestHour(hour :Int)\n\tcase nextWeekday(_: WeekDay)\n\tcase nextDSTDate\n\tcase prevMonth\n\tcase nextMonth\n\tcase prevWeek\n\tcase nextWeek\n\tcase nextYear\n\tcase prevYear\n\tcase nextDSTTransition\n}\n\npublic struct TimeCalculationOptions {\n\n\t/// Specifies the technique the search algorithm uses to find result\n\tpublic var matchingPolicy: Calendar.MatchingPolicy\n\n\t/// Specifies the behavior when multiple matches are found\n\tpublic var repeatedTimePolicy: Calendar.RepeatedTimePolicy\n\n\t/// Specifies the direction in time to search\n\tpublic var direction: Calendar.SearchDirection\n\n\tpublic init(matching: Calendar.MatchingPolicy = .nextTime,\n\t\t\t\ttimePolicy: Calendar.RepeatedTimePolicy = .first,\n\t\t\t\tdirection: Calendar.SearchDirection = .forward) {\n\t\tself.matchingPolicy = matching\n\t\tself.repeatedTimePolicy = timePolicy\n\t\tself.direction = direction\n\t}\n}\n\n// MARK: - compactMap for Swift 4.0 (not necessary > 4.0)\n\n#if swift(>=4.1)\n#else\n\textension Collection {\n\t\tfunc compactMap<ElementOfResult>(\n\t\t\t_ transform: (Element) throws -> ElementOfResult?\n\t\t\t) rethrows -> [ElementOfResult] {\n\t\t\treturn try flatMap(transform)\n\t\t}\n\t}\n#endif\n\n// MARK: - Foundation Bundle\n\nprivate class BundleFinder {}\n\nextension Foundation.Bundle {\n    \n    /// Returns the resource bundle associated with the current Swift module.\n    /// This is used instead of `module` to allows compatibility outside the SwiftPM environment (ie. CocoaPods).\n    static var appModule: Bundle? = {\n        let bundleName = \"SwiftDate_SwiftDate\"\n\n        let candidates = [\n            // Bundle should be present here when the package is linked into an App.\n            Bundle.main.resourceURL,\n\n            // Bundle should be present here when the package is linked into a framework.\n            Bundle(for: BundleFinder.self).resourceURL,\n\n            // For command-line tools.\n            Bundle.main.bundleURL,\n        ]\n\n        for candidate in candidates {\n            let bundlePath = candidate?.appendingPathComponent(bundleName + \".bundle\")\n            if let bundle = bundlePath.flatMap(Bundle.init(url:)) {\n                return bundle\n            }\n        }\n        \n        return nil\n    }()\n    \n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Supports/Locales.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\n// swiftlint:disable file_length\n\nimport Foundation\n\npublic protocol LocaleConvertible {\n\tfunc toLocale() -> Locale\n}\n\nextension Locale: LocaleConvertible {\n\tpublic func toLocale() -> Locale {\n\t\treturn self\n\t}\n}\n\n// swiftlint:disable type_body_length\npublic enum Locales: String, LocaleConvertible {\n\n\tcase current = \"current\"\n\tcase autoUpdating = \"currentAutoUpdating\"\n\n\tcase afrikaans = \"af\"\n\tcase afrikaansNamibia = \"af_NA\"\n\tcase afrikaansSouthAfrica = \"af_ZA\"\n\tcase aghem = \"agq\"\n\tcase aghemCameroon = \"agq_CM\"\n\tcase akan = \"ak\"\n\tcase akanGhana = \"ak_GH\"\n\tcase albanian = \"sq\"\n\tcase albanianAlbania = \"sq_AL\"\n\tcase albanianKosovo = \"sq_XK\"\n\tcase albanianMacedonia = \"sq_MK\"\n\tcase amharic = \"am\"\n\tcase amharicEthiopia = \"am_ET\"\n\tcase arabic = \"ar\"\n\tcase arabicAlgeria = \"ar_DZ\"\n\tcase arabicBahrain = \"ar_BH\"\n\tcase arabicChad = \"ar_TD\"\n\tcase arabicComoros = \"ar_KM\"\n\tcase arabicDjibouti = \"ar_DJ\"\n\tcase arabicEgypt = \"ar_EG\"\n\tcase arabicEritrea = \"ar_ER\"\n\tcase arabicIraq = \"ar_IQ\"\n\tcase arabicIsrael = \"ar_IL\"\n\tcase arabicJordan = \"ar_JO\"\n\tcase arabicKuwait = \"ar_KW\"\n\tcase arabicLebanon = \"ar_LB\"\n\tcase arabicLibya = \"ar_LY\"\n\tcase arabicMauritania = \"ar_MR\"\n\tcase arabicMorocco = \"ar_MA\"\n\tcase arabicOman = \"ar_OM\"\n\tcase arabicPalestinianTerritories = \"ar_PS\"\n\tcase arabicQatar = \"ar_QA\"\n\tcase arabicSaudiArabia = \"ar_SA\"\n\tcase arabicSomalia = \"ar_SO\"\n\tcase arabicSouthSudan = \"ar_SS\"\n\tcase arabicSudan = \"ar_SD\"\n\tcase arabicSyria = \"ar_SY\"\n\tcase arabicTunisia = \"ar_TN\"\n\tcase arabicUnitedArabEmirates = \"ar_AE\"\n\tcase arabicWesternSahara = \"ar_EH\"\n\tcase arabicWorld = \"ar_001\"\n\tcase arabicYemen = \"ar_YE\"\n\tcase armenian = \"hy\"\n\tcase armenianArmenia = \"hy_AM\"\n\tcase assamese = \"as\"\n\tcase assameseIndia = \"as_IN\"\n\tcase asu = \"asa\"\n\tcase asuTanzania = \"asa_TZ\"\n\tcase azerbaijani = \"az_Latn\"\n\tcase azerbaijaniAzerbaijan = \"az_Latn_AZ\"\n\tcase azerbaijaniCyrillic = \"az_Cyrl\"\n\tcase azerbaijaniCyrillicAzerbaijan = \"az_Cyrl_AZ\"\n\tcase bafia = \"ksf\"\n\tcase bafiaCameroon = \"ksf_CM\"\n\tcase bambara = \"bm_Latn\"\n\tcase bambaraMali = \"bm_Latn_ML\"\n\tcase basaa = \"bas\"\n\tcase basaaCameroon = \"bas_CM\"\n\tcase basque = \"eu\"\n\tcase basqueSpain = \"eu_ES\"\n\tcase belarusian = \"be\"\n\tcase belarusianBelarus = \"be_BY\"\n\tcase bemba = \"bem\"\n\tcase bembaZambia = \"bem_ZM\"\n\tcase bena = \"bez\"\n\tcase benaTanzania = \"bez_TZ\"\n\tcase bengali = \"bn\"\n\tcase bengaliBangladesh = \"bn_BD\"\n\tcase engaliIndia = \"bn_IN\"\n\tcase bodo = \"brx\"\n\tcase bodoIndia = \"brx_IN\"\n\tcase bosnian = \"bs_Latn\"\n\tcase bosnianBosniaHerzegovina = \"bs_Latn_BA\"\n\tcase bosnianCyrillic = \"bs_Cyrl\"\n\tcase bosnianCyrillicBosniaHerzegovina = \"bs_Cyrl_BA\"\n\tcase breton = \"br\"\n\tcase bretonFrance = \"br_FR\"\n\tcase bulgarian = \"bg\"\n\tcase bulgarianBulgaria = \"bg_BG\"\n\tcase burmese = \"my\"\n\tcase burmeseMyanmarBurma = \"my_MM\"\n\tcase catalan = \"ca\"\n\tcase catalanAndorra = \"ca_AD\"\n\tcase catalanFrance = \"ca_FR\"\n\tcase catalanItaly = \"ca_IT\"\n\tcase catalanSpain = \"ca_ES\"\n\tcase centralAtlasTamazight = \"tzm_Latn\"\n\tcase centralAtlasTamazightMorocco = \"tzm_Latn_MA\"\n\tcase centralKurdish = \"ckb\"\n\tcase centralKurdishIran = \"ckb_IR\"\n\tcase centralKurdishIraq = \"ckb_IQ\"\n\tcase cherokee = \"chr\"\n\tcase cherokeeUnitedStates = \"chr_US\"\n\tcase chiga = \"cgg\"\n\tcase chigaUganda = \"cgg_UG\"\n\tcase chinese = \"zh\"\n\tcase chineseChina = \"zh_Hans_CN\"\n\tcase chineseHongKongSarChina = \"zh_Hant_HK\"\n\tcase chineseMacauSarChina = \"zh_Hant_MO\"\n\tcase chineseSimplified = \"zh_Hans\"\n\tcase chineseSimplifiedHongKongSarChina = \"zh_Hans_HK\"\n\tcase chineseSimplifiedMacauSarChina = \"zh_Hans_MO\"\n\tcase chineseSingapore = \"zh_Hans_SG\"\n\tcase chineseTaiwan = \"zh_Hant_TW\"\n\tcase chineseTraditional = \"zh_Hant\"\n\tcase colognian = \"ksh\"\n\tcase colognianGermany = \"ksh_DE\"\n\tcase cornish = \"kw\"\n\tcase cornishUnitedKingdom = \"kw_GB\"\n\tcase croatian = \"hr\"\n\tcase croatianBosniaHerzegovina = \"hr_BA\"\n\tcase croatianCroatia = \"hr_HR\"\n\tcase czech = \"cs\"\n\tcase czechCzechRepublic = \"cs_CZ\"\n\tcase danish = \"da\"\n\tcase danishDenmark = \"da_DK\"\n\tcase danishGreenland = \"da_GL\"\n\tcase duala = \"dua\"\n\tcase dualaCameroon = \"dua_CM\"\n\tcase dutch = \"nl\"\n\tcase dutchAruba = \"nl_AW\"\n\tcase dutchBelgium = \"nl_BE\"\n\tcase dutchCaribbeanNetherlands = \"nl_BQ\"\n\tcase dutchCuraao = \"nl_CW\"\n\tcase dutchNetherlands = \"nl_NL\"\n\tcase dutchSintMaarten = \"nl_SX\"\n\tcase dutchSuriname = \"nl_SR\"\n\tcase dzongkha = \"dz\"\n\tcase dzongkhaBhutan = \"dz_BT\"\n\tcase embu = \"ebu\"\n\tcase embuKenya = \"ebu_KE\"\n\tcase english = \"en\"\n\tcase englishAlbania = \"en_AL\"\n\tcase englishAmericanSamoa = \"en_AS\"\n\tcase englishAndorra = \"en_AD\"\n\tcase englishAnguilla = \"en_AI\"\n\tcase englishAntiguaBarbuda = \"en_AG\"\n\tcase englishAustralia = \"en_AU\"\n\tcase englishAustria = \"en_AT\"\n\tcase englishBahamas = \"en_BS\"\n\tcase englishBarbados = \"en_BB\"\n\tcase englishBelgium = \"en_BE\"\n\tcase englishBelize = \"en_BZ\"\n\tcase englishBermuda = \"en_BM\"\n\tcase englishBosniaHerzegovina = \"en_BA\"\n\tcase englishBotswana = \"en_BW\"\n\tcase englishBritishIndianOceanTerritory = \"en_IO\"\n\tcase englishBritishVirginIslands = \"en_VG\"\n\tcase englishCameroon = \"en_CM\"\n\tcase englishCanada = \"en_CA\"\n\tcase englishCaymanIslands = \"en_KY\"\n\tcase englishChristmasIsland = \"en_CX\"\n\tcase englishCocosKeelingIslands = \"en_CC\"\n\tcase englishCookIslands = \"en_CK\"\n\tcase englishCroatia = \"en_HR\"\n\tcase englishCyprus = \"en_CY\"\n\tcase englishCzechRepublic = \"en_CZ\"\n\tcase englishDenmark = \"en_DK\"\n\tcase englishDiegoGarcia = \"en_DG\"\n\tcase englishDominica = \"en_DM\"\n\tcase englishEritrea = \"en_ER\"\n\tcase englishEstonia = \"en_EE\"\n\tcase englishEurope = \"en_150\"\n\tcase englishFalklandIslands = \"en_FK\"\n\tcase englishFiji = \"en_FJ\"\n\tcase englishFinland = \"en_FI\"\n\tcase englishFrance = \"en_FR\"\n\tcase englishGambia = \"en_GM\"\n\tcase englishGermany = \"en_DE\"\n\tcase englishGhana = \"en_GH\"\n\tcase englishGibraltar = \"en_GI\"\n\tcase englishGreece = \"en_GR\"\n\tcase englishGrenada = \"en_GD\"\n\tcase englishGuam = \"en_GU\"\n\tcase englishGuernsey = \"en_GG\"\n\tcase englishGuyana = \"en_GY\"\n\tcase englishHongKongSarChina = \"en_HK\"\n\tcase englishHungary = \"en_HU\"\n\tcase englishIceland = \"en_IS\"\n\tcase englishIndia = \"en_IN\"\n\tcase englishIreland = \"en_IE\"\n\tcase englishIsleOfMan = \"en_IM\"\n\tcase englishIsrael = \"en_IL\"\n\tcase englishItaly = \"en_IT\"\n\tcase englishJamaica = \"en_JM\"\n\tcase englishJersey = \"en_JE\"\n\tcase englishKenya = \"en_KE\"\n\tcase englishKiribati = \"en_KI\"\n\tcase englishLatvia = \"en_LV\"\n\tcase englishLesotho = \"en_LS\"\n\tcase englishLiberia = \"en_LR\"\n\tcase englishLithuania = \"en_LT\"\n\tcase englishLuxembourg = \"en_LU\"\n\tcase englishMacauSarChina = \"en_MO\"\n\tcase englishMadagascar = \"en_MG\"\n\tcase englishMalawi = \"en_MW\"\n\tcase englishMalaysia = \"en_MY\"\n\tcase englishMalta = \"en_MT\"\n\tcase englishMarshallIslands = \"en_MH\"\n\tcase englishMauritius = \"en_MU\"\n\tcase englishMicronesia = \"en_FM\"\n\tcase englishMontenegro = \"en_ME\"\n\tcase englishMontserrat = \"en_MS\"\n\tcase englishNamibia = \"en_NA\"\n\tcase englishNauru = \"en_NR\"\n\tcase englishNetherlands = \"en_NL\"\n\tcase englishNewZealand = \"en_NZ\"\n\tcase englishNigeria = \"en_NG\"\n\tcase englishNiue = \"en_NU\"\n\tcase englishNorfolkIsland = \"en_NF\"\n\tcase englishNorthernMarianaIslands = \"en_MP\"\n\tcase englishNorway = \"en_NO\"\n\tcase englishPakistan = \"en_PK\"\n\tcase englishPalau = \"en_PW\"\n\tcase englishPapuaNewGuinea = \"en_PG\"\n\tcase englishPhilippines = \"en_PH\"\n\tcase englishPitcairnIslands = \"en_PN\"\n\tcase englishPoland = \"en_PL\"\n\tcase englishPortugal = \"en_PT\"\n\tcase englishPuertoRico = \"en_PR\"\n\tcase englishRomania = \"en_RO\"\n\tcase englishRussia = \"en_RU\"\n\tcase englishRwanda = \"en_RW\"\n\tcase englishSamoa = \"en_WS\"\n\tcase englishSeychelles = \"en_SC\"\n\tcase englishSierraLeone = \"en_SL\"\n\tcase englishSingapore = \"en_SG\"\n\tcase englishSintMaarten = \"en_SX\"\n\tcase englishSlovakia = \"en_SK\"\n\tcase englishSlovenia = \"en_SI\"\n\tcase englishSolomonIslands = \"en_SB\"\n\tcase englishSouthAfrica = \"en_ZA\"\n\tcase englishSouthSudan = \"en_SS\"\n\tcase englishSpain = \"en_ES\"\n\tcase englishStHelena = \"en_SH\"\n\tcase englishStKittsNevis = \"en_KN\"\n\tcase englishStLucia = \"en_LC\"\n\tcase englishStVincentGrenadines = \"en_VC\"\n\tcase englishSudan = \"en_SD\"\n\tcase englishSwaziland = \"en_SZ\"\n\tcase englishSweden = \"en_SE\"\n\tcase englishSwitzerland = \"en_CH\"\n\tcase englishTanzania = \"en_TZ\"\n\tcase englishTokelau = \"en_TK\"\n\tcase englishTonga = \"en_TO\"\n\tcase englishTrinidadTobago = \"en_TT\"\n\tcase englishTurkey = \"en_TR\"\n\tcase englishTurksCaicosIslands = \"en_TC\"\n\tcase englishTuvalu = \"en_TV\"\n\tcase englishUSOutlyingIslands = \"en_UM\"\n\tcase englishUSVirginIslands = \"en_VI\"\n\tcase englishUganda = \"en_UG\"\n\tcase englishUnitedKingdom = \"en_GB\"\n\tcase englishUnitedStates = \"en_US\"\n\tcase englishUnitedStatesComputer = \"en_US_POSIX\"\n\tcase englishVanuatu = \"en_VU\"\n\tcase englishWorld = \"en_001\"\n\tcase englishZambia = \"en_ZM\"\n\tcase englishZimbabwe = \"en_ZW\"\n\tcase esperanto = \"eo\"\n\tcase estonian = \"et\"\n\tcase estonianEstonia = \"et_EE\"\n\tcase ewe = \"ee\"\n\tcase eweGhana = \"ee_GH\"\n\tcase eweTogo = \"ee_TG\"\n\tcase ewondo = \"ewo\"\n\tcase ewondoCameroon = \"ewo_CM\"\n\tcase faroese = \"fo\"\n\tcase faroeseFaroeIslands = \"fo_FO\"\n\tcase filipino = \"fil\"\n\tcase filipinoPhilippines = \"fil_PH\"\n\tcase finnish = \"fi\"\n\tcase finnishFinland = \"fi_FI\"\n\tcase french = \"fr\"\n\tcase frenchAlgeria = \"fr_DZ\"\n\tcase frenchBelgium = \"fr_BE\"\n\tcase frenchBenin = \"fr_BJ\"\n\tcase frenchBurkinaFaso = \"fr_BF\"\n\tcase frenchBurundi = \"fr_BI\"\n\tcase frenchCameroon = \"fr_CM\"\n\tcase frenchCanada = \"fr_CA\"\n\tcase frenchCentralAfricanRepublic = \"fr_CF\"\n\tcase frenchChad = \"fr_TD\"\n\tcase frenchComoros = \"fr_KM\"\n\tcase frenchCongoBrazzaville = \"fr_CG\"\n\tcase frenchCongoKinshasa = \"fr_CD\"\n\tcase frenchCteDivoire = \"fr_CI\"\n\tcase frenchDjibouti = \"fr_DJ\"\n\tcase frenchEquatorialGuinea = \"fr_GQ\"\n\tcase frenchFrance = \"fr_FR\"\n\tcase frenchFrenchGuiana = \"fr_GF\"\n\tcase frenchFrenchPolynesia = \"fr_PF\"\n\tcase frenchGabon = \"fr_GA\"\n\tcase frenchGuadeloupe = \"fr_GP\"\n\tcase frenchGuinea = \"fr_GN\"\n\tcase frenchHaiti = \"fr_HT\"\n\tcase frenchLuxembourg = \"fr_LU\"\n\tcase frenchMadagascar = \"fr_MG\"\n\tcase frenchMali = \"fr_ML\"\n\tcase frenchMartinique = \"fr_MQ\"\n\tcase frenchMauritania = \"fr_MR\"\n\tcase frenchMauritius = \"fr_MU\"\n\tcase frenchMayotte = \"fr_YT\"\n\tcase frenchMonaco = \"fr_MC\"\n\tcase frenchMorocco = \"fr_MA\"\n\tcase frenchNewCaledonia = \"fr_NC\"\n\tcase frenchNiger = \"fr_NE\"\n\tcase frenchRunion = \"fr_RE\"\n\tcase frenchRwanda = \"fr_RW\"\n\tcase frenchSenegal = \"fr_SN\"\n\tcase frenchSeychelles = \"fr_SC\"\n\tcase frenchStBarthlemy = \"fr_BL\"\n\tcase frenchStMartin = \"fr_MF\"\n\tcase frenchStPierreMiquelon = \"fr_PM\"\n\tcase frenchSwitzerland = \"fr_CH\"\n\tcase frenchSyria = \"fr_SY\"\n\tcase frenchTogo = \"fr_TG\"\n\tcase frenchTunisia = \"fr_TN\"\n\tcase frenchVanuatu = \"fr_VU\"\n\tcase frenchWallisFutuna = \"fr_WF\"\n\tcase friulian = \"fur\"\n\tcase friulianItaly = \"fur_IT\"\n\tcase fulah = \"ff\"\n\tcase fulahCameroon = \"ff_CM\"\n\tcase fulahGuinea = \"ff_GN\"\n\tcase fulahMauritania = \"ff_MR\"\n\tcase fulahSenegal = \"ff_SN\"\n\tcase galician = \"gl\"\n\tcase galicianSpain = \"gl_ES\"\n\tcase ganda = \"lg\"\n\tcase gandaUganda = \"lg_UG\"\n\tcase georgian = \"ka\"\n\tcase georgianGeorgia = \"ka_GE\"\n\tcase german = \"de\"\n\tcase germanAustria = \"de_AT\"\n\tcase germanBelgium = \"de_BE\"\n\tcase germanGermany = \"de_DE\"\n\tcase germanLiechtenstein = \"de_LI\"\n\tcase germanLuxembourg = \"de_LU\"\n\tcase germanSwitzerland = \"de_CH\"\n\tcase greek = \"el\"\n\tcase greekCyprus = \"el_CY\"\n\tcase greekGreece = \"el_GR\"\n\tcase gujarati = \"gu\"\n\tcase gujaratiIndia = \"gu_IN\"\n\tcase gusii = \"guz\"\n\tcase gusiiKenya = \"guz_KE\"\n\tcase hausa = \"ha_Latn\"\n\tcase hausaGhana = \"ha_Latn_GH\"\n\tcase hausaNiger = \"ha_Latn_NE\"\n\tcase hausaNigeria = \"ha_Latn_NG\"\n\tcase hawaiian = \"haw\"\n\tcase hawaiianUnitedStates = \"haw_US\"\n\tcase hebrew = \"he\"\n\tcase hebrewIsrael = \"he_IL\"\n\tcase hindi = \"hi\"\n\tcase hindiIndia = \"hi_IN\"\n\tcase hungarian = \"hu\"\n\tcase hungarianHungary = \"hu_HU\"\n\tcase icelandic = \"is\"\n\tcase icelandicIceland = \"is_IS\"\n\tcase igbo = \"ig\"\n\tcase igboNigeria = \"ig_NG\"\n\tcase inariSami = \"smn\"\n\tcase inariSamiFinland = \"smn_FI\"\n\tcase indonesian = \"id\"\n\tcase indonesianIndonesia = \"id_ID\"\n\tcase inuktitut = \"iu\"\n\tcase inuktitutUnifiedCanadianAboriginalSyllabics = \"iu_Cans\"\n\tcase inuktitutUnifiedCanadianAboriginalSyllabicsCanada = \"iu_Cans_CA\"\n\tcase irish = \"ga\"\n\tcase irishIreland = \"ga_IE\"\n\tcase italian = \"it\"\n\tcase italianItaly = \"it_IT\"\n\tcase italianSanMarino = \"it_SM\"\n\tcase italianSwitzerland = \"it_CH\"\n\tcase japanese = \"ja\"\n\tcase japaneseJapan = \"ja_JP\"\n\tcase jolaFonyi = \"dyo\"\n\tcase jolaFonyiSenegal = \"dyo_SN\"\n\tcase kabuverdianu = \"kea\"\n\tcase kabuverdianuCapeVerde = \"kea_CV\"\n\tcase kabyle = \"kab\"\n\tcase kabyleAlgeria = \"kab_DZ\"\n\tcase kako = \"kkj\"\n\tcase kakoCameroon = \"kkj_CM\"\n\tcase kalaallisut = \"kl\"\n\tcase kalaallisutGreenland = \"kl_GL\"\n\tcase kalenjin = \"kln\"\n\tcase kalenjinKenya = \"kln_KE\"\n\tcase kamba = \"kam\"\n\tcase kambaKenya = \"kam_KE\"\n\tcase kannada = \"kn\"\n\tcase kannadaIndia = \"kn_IN\"\n\tcase kashmiri = \"ks\"\n\tcase kashmiriArabic = \"ks_Arab\"\n\tcase kashmiriArabicIndia = \"ks_Arab_IN\"\n\tcase kazakh = \"kk_Cyrl\"\n\tcase kazakhKazakhstan = \"kk_Cyrl_KZ\"\n\tcase khmer = \"km\"\n\tcase khmerCambodia = \"km_KH\"\n\tcase kikuyu = \"ki\"\n\tcase kikuyuKenya = \"ki_KE\"\n\tcase kinyarwanda = \"rw\"\n\tcase kinyarwandaRwanda = \"rw_RW\"\n\tcase konkani = \"kok\"\n\tcase konkaniIndia = \"kok_IN\"\n\tcase korean = \"ko\"\n\tcase koreanNorthKorea = \"ko_KP\"\n\tcase koreanSouthKorea = \"ko_KR\"\n\tcase koyraChiini = \"khq\"\n\tcase koyraChiiniMali = \"khq_ML\"\n\tcase koyraboroSenni = \"ses\"\n\tcase koyraboroSenniMali = \"ses_ML\"\n\tcase kwasio = \"nmg\"\n\tcase kwasioCameroon = \"nmg_CM\"\n\tcase kyrgyz = \"ky_Cyrl\"\n\tcase kyrgyzKyrgyzstan = \"ky_Cyrl_KG\"\n\tcase lakota = \"lkt\"\n\tcase lakotaUnitedStates = \"lkt_US\"\n\tcase langi = \"lag\"\n\tcase langiTanzania = \"lag_TZ\"\n\tcase lao = \"lo\"\n\tcase laoLaos = \"lo_LA\"\n\tcase latvian = \"lv\"\n\tcase latvianLatvia = \"lv_LV\"\n\tcase lingala = \"ln\"\n\tcase lingalaAngola = \"ln_AO\"\n\tcase lingalaCentralAfricanRepublic = \"ln_CF\"\n\tcase lingalaCongoBrazzaville = \"ln_CG\"\n\tcase lingalaCongoKinshasa = \"ln_CD\"\n\tcase lithuanian = \"lt\"\n\tcase lithuanianLithuania = \"lt_LT\"\n\tcase lowerSorbian = \"dsb\"\n\tcase lowerSorbianGermany = \"dsb_DE\"\n\tcase lubaKatanga = \"lu\"\n\tcase lubaKatangaCongoKinshasa = \"lu_CD\"\n\tcase luo = \"luo\"\n\tcase luoKenya = \"luo_KE\"\n\tcase luxembourgish = \"lb\"\n\tcase luxembourgishLuxembourg = \"lb_LU\"\n\tcase luyia = \"luy\"\n\tcase luyiaKenya = \"luy_KE\"\n\tcase macedonian = \"mk\"\n\tcase macedonianMacedonia = \"mk_MK\"\n\tcase machame = \"jmc\"\n\tcase machameTanzania = \"jmc_TZ\"\n\tcase makhuwaMeetto = \"mgh\"\n\tcase makhuwaMeettoMozambique = \"mgh_MZ\"\n\tcase makonde = \"kde\"\n\tcase makondeTanzania = \"kde_TZ\"\n\tcase malagasy = \"mg\"\n\tcase malagasyMadagascar = \"mg_MG\"\n\tcase malay = \"ms_Latn\"\n\tcase malayArabic = \"ms_Arab\"\n\tcase malayArabicBrunei = \"ms_Arab_BN\"\n\tcase malayArabicMalaysia = \"ms_Arab_MY\"\n\tcase malayBrunei = \"ms_Latn_BN\"\n\tcase malayMalaysia = \"ms_Latn_MY\"\n\tcase malaySingapore = \"ms_Latn_SG\"\n\tcase malayalam = \"ml\"\n\tcase malayalamIndia = \"ml_IN\"\n\tcase maltese = \"mt\"\n\tcase malteseMalta = \"mt_MT\"\n\tcase manx = \"gv\"\n\tcase manxIsleOfMan = \"gv_IM\"\n\tcase marathi = \"mr\"\n\tcase marathiIndia = \"mr_IN\"\n\tcase masai = \"mas\"\n\tcase masaiKenya = \"mas_KE\"\n\tcase masaiTanzania = \"mas_TZ\"\n\tcase meru = \"mer\"\n\tcase meruKenya = \"mer_KE\"\n\tcase meta = \"mgo\"\n\tcase metaCameroon = \"mgo_CM\"\n\tcase mongolian = \"mn_Cyrl\"\n\tcase mongolianMongolia = \"mn_Cyrl_MN\"\n\tcase morisyen = \"mfe\"\n\tcase morisyenMauritius = \"mfe_MU\"\n\tcase mundang = \"mua\"\n\tcase mundangCameroon = \"mua_CM\"\n\tcase nama = \"naq\"\n\tcase namaNamibia = \"naq_NA\"\n\tcase nepali = \"ne\"\n\tcase nepaliIndia = \"ne_IN\"\n\tcase nepaliNepal = \"ne_NP\"\n\tcase ngiemboon = \"nnh\"\n\tcase ngiemboonCameroon = \"nnh_CM\"\n\tcase ngomba = \"jgo\"\n\tcase ngombaCameroon = \"jgo_CM\"\n\tcase northNdebele = \"nd\"\n\tcase northNdebeleZimbabwe = \"nd_ZW\"\n\tcase northernSami = \"se\"\n\tcase northernSamiFinland = \"se_FI\"\n\tcase northernSamiNorway = \"se_NO\"\n\tcase northernSamiSweden = \"se_SE\"\n\tcase norwegianBokml = \"nb\"\n\tcase norwegianBokmlNorway = \"nb_NO\"\n\tcase norwegianBokmlSvalbardJanMayen = \"nb_SJ\"\n\tcase norwegianNynorsk = \"nn\"\n\tcase norwegianNynorskNorway = \"nn_NO\"\n\tcase nuer = \"nus\"\n\tcase nuerSudan = \"nus_SD\"\n\tcase nyankole = \"nyn\"\n\tcase nyankoleUganda = \"nyn_UG\"\n\tcase oriya = \"or\"\n\tcase oriyaIndia = \"or_IN\"\n\tcase oromo = \"om\"\n\tcase oromoEthiopia = \"om_ET\"\n\tcase oromoKenya = \"om_KE\"\n\tcase ossetic = \"os\"\n\tcase osseticGeorgia = \"os_GE\"\n\tcase osseticRussia = \"os_RU\"\n\tcase pashto = \"ps\"\n\tcase pashtoAfghanistan = \"ps_AF\"\n\tcase persian = \"fa\"\n\tcase persianAfghanistan = \"fa_AF\"\n\tcase persianIran = \"fa_IR\"\n\tcase polish = \"pl\"\n\tcase polishPoland = \"pl_PL\"\n\tcase portuguese = \"pt\"\n\tcase portugueseAngola = \"pt_AO\"\n\tcase portugueseBrazil = \"pt_BR\"\n\tcase portugueseCapeVerde = \"pt_CV\"\n\tcase portugueseGuineaBissau = \"pt_GW\"\n\tcase portugueseMacauSarChina = \"pt_MO\"\n\tcase portugueseMozambique = \"pt_MZ\"\n\tcase portuguesePortugal = \"pt_PT\"\n\tcase portugueseSoTomPrncipe = \"pt_ST\"\n\tcase portugueseTimorLeste = \"pt_TL\"\n\tcase punjabi = \"pa_Guru\"\n\tcase punjabiArabic = \"pa_Arab\"\n\tcase punjabiArabicPakistan = \"pa_Arab_PK\"\n\tcase punjabiIndia = \"pa_Guru_IN\"\n\tcase quechua = \"qu\"\n\tcase quechuaBolivia = \"qu_BO\"\n\tcase quechuaEcuador = \"qu_EC\"\n\tcase quechuaPeru = \"qu_PE\"\n\tcase romanian = \"ro\"\n\tcase romanianMoldova = \"ro_MD\"\n\tcase romanianRomania = \"ro_RO\"\n\tcase romansh = \"rm\"\n\tcase romanshSwitzerland = \"rm_CH\"\n\tcase rombo = \"rof\"\n\tcase romboTanzania = \"rof_TZ\"\n\tcase rundi = \"rn\"\n\tcase rundiBurundi = \"rn_BI\"\n\tcase russian = \"ru\"\n\tcase russianBelarus = \"ru_BY\"\n\tcase russianKazakhstan = \"ru_KZ\"\n\tcase russianKyrgyzstan = \"ru_KG\"\n\tcase russianMoldova = \"ru_MD\"\n\tcase russianRussia = \"ru_RU\"\n\tcase russianUkraine = \"ru_UA\"\n\tcase rwa = \"rwk\"\n\tcase rwaTanzania = \"rwk_TZ\"\n\tcase sakha = \"sah\"\n\tcase sakhaRussia = \"sah_RU\"\n\tcase samburu = \"saq\"\n\tcase samburuKenya = \"saq_KE\"\n\tcase sango = \"sg\"\n\tcase sangoCentralAfricanRepublic = \"sg_CF\"\n\tcase sangu = \"sbp\"\n\tcase sanguTanzania = \"sbp_TZ\"\n\tcase scottishGaelic = \"gd\"\n\tcase scottishGaelicUnitedKingdom = \"gd_GB\"\n\tcase sena = \"seh\"\n\tcase senaMozambique = \"seh_MZ\"\n\tcase serbian = \"sr_Cyrl\"\n\tcase serbianBosniaHerzegovina = \"sr_Cyrl_BA\"\n\tcase serbianKosovo = \"sr_Cyrl_XK\"\n\tcase serbianLatin = \"sr_Latn\"\n\tcase serbianLatinBosniaHerzegovina = \"sr_Latn_BA\"\n\tcase serbianLatinKosovo = \"sr_Latn_XK\"\n\tcase serbianLatinMontenegro = \"sr_Latn_ME\"\n\tcase serbianLatinSerbia = \"sr_Latn_RS\"\n\tcase serbianMontenegro = \"sr_Cyrl_ME\"\n\tcase serbianSerbia = \"sr_Cyrl_RS\"\n\tcase shambala = \"ksb\"\n\tcase shambalaTanzania = \"ksb_TZ\"\n\tcase shona = \"sn\"\n\tcase shonaZimbabwe = \"sn_ZW\"\n\tcase sichuanYi = \"ii\"\n\tcase sichuanYiChina = \"ii_CN\"\n\tcase sinhala = \"si\"\n\tcase sinhalaSriLanka = \"si_LK\"\n\tcase slovak = \"sk\"\n\tcase slovakSlovakia = \"sk_SK\"\n\tcase slovenian = \"sl\"\n\tcase slovenianSlovenia = \"sl_SI\"\n\tcase soga = \"xog\"\n\tcase sogaUganda = \"xog_UG\"\n\tcase somali = \"so\"\n\tcase somaliDjibouti = \"so_DJ\"\n\tcase somaliEthiopia = \"so_ET\"\n\tcase somaliKenya = \"so_KE\"\n\tcase somaliSomalia = \"so_SO\"\n\tcase spanish = \"es\"\n\tcase spanishArgentina = \"es_AR\"\n\tcase spanishBolivia = \"es_BO\"\n\tcase spanishCanaryIslands = \"es_IC\"\n\tcase spanishCeutaMelilla = \"es_EA\"\n\tcase spanishChile = \"es_CL\"\n\tcase spanishColombia = \"es_CO\"\n\tcase spanishCostaRica = \"es_CR\"\n\tcase spanishCuba = \"es_CU\"\n\tcase spanishDominicanRepublic = \"es_DO\"\n\tcase spanishEcuador = \"es_EC\"\n\tcase spanishElSalvador = \"es_SV\"\n\tcase spanishEquatorialGuinea = \"es_GQ\"\n\tcase spanishGuatemala = \"es_GT\"\n\tcase spanishHonduras = \"es_HN\"\n\tcase spanishLatinAmerica = \"es_419\"\n\tcase spanishMexico = \"es_MX\"\n\tcase spanishNicaragua = \"es_NI\"\n\tcase spanishPanama = \"es_PA\"\n\tcase spanishParaguay = \"es_PY\"\n\tcase spanishPeru = \"es_PE\"\n\tcase spanishPhilippines = \"es_PH\"\n\tcase spanishPuertoRico = \"es_PR\"\n\tcase spanishSpain = \"es_ES\"\n\tcase spanishUnitedStates = \"es_US\"\n\tcase spanishUruguay = \"es_UY\"\n\tcase spanishVenezuela = \"es_VE\"\n\tcase standardMoroccanTamazight = \"zgh\"\n\tcase standardMoroccanTamazightMorocco = \"zgh_MA\"\n\tcase swahili = \"sw\"\n\tcase swahiliCongoKinshasa = \"sw_CD\"\n\tcase swahiliKenya = \"sw_KE\"\n\tcase swahiliTanzania = \"sw_TZ\"\n\tcase swahiliUganda = \"sw_UG\"\n\tcase swedish = \"sv\"\n\tcase swedishlandIslands = \"sv_AX\"\n\tcase swedishFinland = \"sv_FI\"\n\tcase swedishSweden = \"sv_SE\"\n\tcase swissGerman = \"gsw\"\n\tcase swissGermanFrance = \"gsw_FR\"\n\tcase swissGermanLiechtenstein = \"gsw_LI\"\n\tcase swissGermanSwitzerland = \"gsw_CH\"\n\tcase tachelhit = \"shi_Latn\"\n\tcase tachelhitMorocco = \"shi_Latn_MA\"\n\tcase tachelhitTifinagh = \"shi_Tfng\"\n\tcase tachelhitTifinaghMorocco = \"shi_Tfng_MA\"\n\tcase taita = \"dav\"\n\tcase taitaKenya = \"dav_KE\"\n\tcase tajik = \"tg_Cyrl\"\n\tcase tajikTajikistan = \"tg_Cyrl_TJ\"\n\tcase tamil = \"ta\"\n\tcase tamilIndia = \"ta_IN\"\n\tcase tamilMalaysia = \"ta_MY\"\n\tcase tamilSingapore = \"ta_SG\"\n\tcase tamilSriLanka = \"ta_LK\"\n\tcase tasawaq = \"twq\"\n\tcase tasawaqNiger = \"twq_NE\"\n\tcase telugu = \"te\"\n\tcase teluguIndia = \"te_IN\"\n\tcase teso = \"teo\"\n\tcase tesoKenya = \"teo_KE\"\n\tcase tesoUganda = \"teo_UG\"\n\tcase thai = \"th\"\n\tcase thaiThailand = \"th_TH\"\n\tcase tibetan = \"bo\"\n\tcase tibetanChina = \"bo_CN\"\n\tcase tibetanIndia = \"bo_IN\"\n\tcase tigrinya = \"ti\"\n\tcase tigrinyaEritrea = \"ti_ER\"\n\tcase tigrinyaEthiopia = \"ti_ET\"\n\tcase tongan = \"to\"\n\tcase tonganTonga = \"to_TO\"\n\tcase turkish = \"tr\"\n\tcase turkishCyprus = \"tr_CY\"\n\tcase turkishTurkey = \"tr_TR\"\n\tcase turkmen = \"tk_Latn\"\n\tcase turkmenTurkmenistan = \"tk_Latn_TM\"\n\tcase ukrainian = \"uk\"\n\tcase ukrainianUkraine = \"uk_UA\"\n\tcase upperSorbian = \"hsb\"\n\tcase upperSorbianGermany = \"hsb_DE\"\n\tcase urdu = \"ur\"\n\tcase urduIndia = \"ur_IN\"\n\tcase urduPakistan = \"ur_PK\"\n\tcase uyghur = \"ug\"\n\tcase uyghurArabic = \"ug_Arab\"\n\tcase uyghurArabicChina = \"ug_Arab_CN\"\n\tcase uzbek = \"uz_Cyrl\"\n\tcase uzbekArabic = \"uz_Arab\"\n\tcase uzbekArabicAfghanistan = \"uz_Arab_AF\"\n\tcase uzbekLatin = \"uz_Latn\"\n\tcase uzbekLatinUzbekistan = \"uz_Latn_UZ\"\n\tcase uzbekUzbekistan = \"uz_Cyrl_UZ\"\n\tcase vai = \"vai_Vaii\"\n\tcase vaiLatin = \"vai_Latn\"\n\tcase vaiLatinLiberia = \"vai_Latn_LR\"\n\tcase vaiLiberia = \"vai_Vaii_LR\"\n\tcase vietnamese = \"vi\"\n\tcase vietnameseVietnam = \"vi_VN\"\n\tcase vunjo = \"vun\"\n\tcase vunjoTanzania = \"vun_TZ\"\n\tcase walser = \"wae\"\n\tcase walserSwitzerland = \"wae_CH\"\n\tcase welsh = \"cy\"\n\tcase welshUnitedKingdom = \"cy_GB\"\n\tcase westernFrisian = \"fy\"\n\tcase westernFrisianNetherlands = \"fy_NL\"\n\tcase yangben = \"yav\"\n\tcase yangbenCameroon = \"yav_CM\"\n\tcase yiddish = \"yi\"\n\tcase yiddishWorld = \"yi_001\"\n\tcase yoruba = \"yo\"\n\tcase yorubaBenin = \"yo_BJ\"\n\tcase yorubaNigeria = \"yo_NG\"\n\tcase zarma = \"dje\"\n\tcase zarmaNiger = \"dje_NE\"\n\tcase zulu = \"zu\"\n\tcase zuluSouthAfrica = \"zu_ZA\"\n\n\t/// Return a valid `Locale` instance from current selected locale enum\n\tpublic func toLocale() -> Locale {\n\t\tswitch self {\n\t\tcase .current:\t\t\treturn Locale.current\n\t\tcase .autoUpdating:\t\treturn Locale.autoupdatingCurrent\n\t\tdefault:\t\t\t\treturn Locale(identifier: rawValue)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Supports/TimeStructures.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Weekday\n\n/// This define the weekdays for some functions.\npublic enum WeekDay: Int {\n\tcase sunday = 1, monday, tuesday, wednesday, thursday, friday, saturday\n\n\t/// Returns the name of the day given a specific locale.\n\t/// For example, for the `Friday` enum value, the en_AU locale would return \"Friday\" and fr_FR would return \"samedi\"\n\t///\n\t/// - Parameter locale: locale of the output, omit to use the `defaultRegion`'s locale.\n\t/// - Returns: display name\n\tpublic func name(style: SymbolFormatStyle = .`default`, locale: LocaleConvertible = SwiftDate.defaultRegion.locale) -> String {\n\t\tlet region = Region(calendar: SwiftDate.defaultRegion.calendar, zone: SwiftDate.defaultRegion.timeZone, locale: locale)\n\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region, format: nil)\n\n\t\tlet idx = (self.rawValue - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.weekdaySymbols[idx]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneWeekdaySymbols[idx]\n\t\tcase .short:\t\t\t\treturn formatter.shortWeekdaySymbols[idx]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneWeekdaySymbols[idx]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortWeekdaySymbols[idx]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneWeekdaySymbols[idx]\n\t\t}\n\t}\n\n\t/// Adds a number of days to the current weekday and returns the new weekday.\n\t///\n\t/// - Parameter months: number of months to add\n\t/// - Returns: new month.\n\tpublic func add(days: Int) -> WeekDay {\n\t\tlet normalized = days % 7\n\t\treturn WeekDay(rawValue: ((self.rawValue + normalized + 7 - 1) % 7) + 1)!\n\t}\n\n\t/// Subtracts a number of days from the current weekday and returns the new weekday.\n\t///\n\t/// - Parameter months: number of days to subtract. May be negative, in which case it will be added\n\t/// - Returns: new weekday.\n\tpublic func subtract(days: Int) -> WeekDay {\n\t\treturn add(days: -(days % 7))\n\t}\n\n}\n\n// MARK: - Year\n\npublic struct Year: CustomStringConvertible, Equatable {\n\tlet year: Int\n\n\tpublic var description: String {\n\t\treturn \"\\(self.year)\"\n\t}\n\n\t/// Constructs a `Year` from the passed value.\n\t///\n\t/// - Parameter year: year value. Can be negative.\n\tpublic init(_ year: Int) {\n\t\tself.year = year\n\t}\n\n\t/// Returns whether this year is a leap year\n\t///\n\t/// - Returns: A boolean indicating whether this year is a leap year\n\tpublic func isLeap() -> Bool {\n\t\treturn ((year & 3) == 0) && ((year % 100) != 0 || (year % 400) == 0)\n\t}\n\n\t/// Returns the number of days in this year\n\t///\n\t/// - Returns: The number of days in this year\n\tpublic func numberOfDays() -> Int {\n\t\treturn self.isLeap() ? 366 : 365\n\t}\n\n}\n\n// MARK: - Month\n\n/// Defines months in a year\npublic enum Month: Int, CustomStringConvertible, Equatable {\n\tcase january = 0, february, march, april, may, june, july, august, september, october, november, december\n\n\tpublic var description: String {\n\t\treturn self.name()\n\t}\n\n\t/// Returns the name of the month given a specific locale.\n\t/// For example, for the `January` enum value, the en_AU locale would return \"January\" and fr_FR would return \"janvier\"\n\t///\n\t/// - Parameter locale: locale of the output, omit to use the `defaultRegion`'s locale.\n\t/// - Returns: display name\n\tpublic func name(style: SymbolFormatStyle = .`default`, locale: LocaleConvertible = SwiftDate.defaultRegion.locale) -> String {\n\t\tlet region = Region(calendar: SwiftDate.defaultRegion.calendar, zone: SwiftDate.defaultRegion.timeZone, locale: locale)\n\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region, format: nil)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.monthSymbols[self.rawValue]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneMonthSymbols[self.rawValue]\n\t\tcase .short:\t\t\t\treturn formatter.shortMonthSymbols[self.rawValue]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneMonthSymbols[self.rawValue]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortMonthSymbols[self.rawValue]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneMonthSymbols[self.rawValue]\n\t\t}\n\t}\n\n\t/// Adds a number of months to the current month and returns the new month.\n\t///\n\t/// - Parameter months: number of months to add\n\t/// - Returns: new month.\n\tpublic func add(months: Int) -> Month {\n\t\tlet normalized = months % 12\n\t\treturn Month(rawValue: (self.rawValue + normalized + 12) % 12)!\n\t}\n\n\t/// Subtracts a number of months from the current month and returns the new month.\n\t///\n\t/// - Parameter months: number of months to subtract. May be negative, in which case it will be added\n\t/// - Returns: new month.\n\tpublic func subtract(months: Int) -> Month {\n\t\treturn add(months: -(months % 12))\n\t}\n\n\t/// Returns the number of days in a this month for a given year\n\t///\n\t/// - Parameter year: reference year.\n\t/// - Returns: The number of days in this month.\n\tpublic func numberOfDays(year: Int) -> Int {\n\t\tswitch self {\n\t\tcase .february:\n\t\t\treturn Year(year).isLeap() ? 29 : 28\n\t\tcase .april, .june, .september, .november:\n\t\t\treturn 30\n\t\tdefault:\n\t\t\treturn 31\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/Supports/Zones.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol ZoneConvertible {\n\tfunc toTimezone() -> TimeZone\n}\n\nextension TimeZone: ZoneConvertible {\n\tpublic func toTimezone() -> TimeZone {\n\t\treturn self\n\t}\n}\n\n// swiftlint:disable type_body_length\npublic enum Zones: String, ZoneConvertible {\n\tcase current = \"Current\"\n\tcase autoUpdating = \"CurrentAutoUpdating\"\n\tcase africaAbidjan = \"Africa/Abidjan\"\n\tcase africaAccra = \"Africa/Accra\"\n\tcase africaAddisAbaba = \"Africa/Addis_Ababa\"\n\tcase africaAlgiers = \"Africa/Algiers\"\n\tcase africaAsmara = \"Africa/Asmara\"\n\tcase africaBamako = \"Africa/Bamako\"\n\tcase africaBangui = \"Africa/Bangui\"\n\tcase africaBanjul = \"Africa/Banjul\"\n\tcase africaBissau = \"Africa/Bissau\"\n\tcase africaBlantyre = \"Africa/Blantyre\"\n\tcase africaBrazzaville = \"Africa/Brazzaville\"\n\tcase africaBujumbura = \"Africa/Bujumbura\"\n\tcase africaCairo = \"Africa/Cairo\"\n\tcase africaCasablanca = \"Africa/Casablanca\"\n\tcase africaCeuta = \"Africa/Ceuta\"\n\tcase africaConakry = \"Africa/Conakry\"\n\tcase africaDakar = \"Africa/Dakar\"\n\tcase africaDarEsSalaam = \"Africa/Dar_es_Salaam\"\n\tcase africaDjibouti = \"Africa/Djibouti\"\n\tcase africaDouala = \"Africa/Douala\"\n\tcase africaElAaiun = \"Africa/El_Aaiun\"\n\tcase africaFreetown = \"Africa/Freetown\"\n\tcase africaGaborone = \"Africa/Gaborone\"\n\tcase africaHarare = \"Africa/Harare\"\n\tcase africaJohannesburg = \"Africa/Johannesburg\"\n\tcase africaJuba = \"Africa/Juba\"\n\tcase africaKampala = \"Africa/Kampala\"\n\tcase africaKhartoum = \"Africa/Khartoum\"\n\tcase fricaKigali = \"Africa/Kigali\"\n\tcase africaKinshasa = \"Africa/Kinshasa\"\n\tcase africaLagos = \"Africa/Lagos\"\n\tcase africaLibreville = \"Africa/Libreville\"\n\tcase africaLome = \"Africa/Lome\"\n\tcase africaLuanda = \"Africa/Luanda\"\n\tcase africaLubumbashi = \"Africa/Lubumbashi\"\n\tcase africaLusaka = \"Africa/Lusaka\"\n\tcase africaMalabo = \"Africa/Malabo\"\n\tcase africaMaputo = \"Africa/Maputo\"\n\tcase africaMaseru = \"Africa/Maseru\"\n\tcase africaMbabane = \"Africa/Mbabane\"\n\tcase africaMogadishu = \"Africa/Mogadishu\"\n\tcase africaMonrovia = \"Africa/Monrovia\"\n\tcase africaNairobi = \"Africa/Nairobi\"\n\tcase africaNdjamena = \"Africa/Ndjamena\"\n\tcase africaNiamey = \"Africa/Niamey\"\n\tcase africaNouakchott = \"Africa/Nouakchott\"\n\tcase africaOuagadougou = \"Africa/Ouagadougou\"\n\tcase africaPortoNovo = \"Africa/Porto-Novo\"\n\tcase africaSaoTome = \"Africa/Sao_Tome\"\n\tcase africaTripoli = \"Africa/Tripoli\"\n\tcase africaTunis = \"Africa/Tunis\"\n\tcase africaWindhoek = \"Africa/Windhoek\"\n\tcase americaAdak = \"America/Adak\"\n\tcase americaAnchorage = \"America/Anchorage\"\n\tcase americaAnguilla = \"America/Anguilla\"\n\tcase americaAntigua = \"America/Antigua\"\n\tcase americaAraguaina = \"America/Araguaina\"\n\tcase americaArgentinaBuenosAires = \"America/Argentina/Buenos_Aires\"\n\tcase americaArgentinaCatamarca = \"America/Argentina/Catamarca\"\n\tcase americaArgentinaCordoba = \"America/Argentina/Cordoba\"\n\tcase americaArgentinaJujuy = \"America/Argentina/Jujuy\"\n\tcase americaArgentinaLaRioja = \"America/Argentina/La_Rioja\"\n\tcase americaArgentinaMendoza = \"America/Argentina/Mendoza\"\n\tcase americaArgentinaRioGallegos = \"America/Argentina/Rio_Gallegos\"\n\tcase americaArgentinaSalta = \"America/Argentina/Salta\"\n\tcase americaArgentinaSanJuan = \"America/Argentina/San_Juan\"\n\tcase americaArgentinaSanLuis = \"America/Argentina/San_Luis\"\n\tcase americaArgentinaTucuman = \"America/Argentina/Tucuman\"\n\tcase americaArgentinaUshuaia = \"America/Argentina/Ushuaia\"\n\tcase americaAruba = \"America/Aruba\"\n\tcase americaAsuncion = \"America/Asuncion\"\n\tcase americaAtikokan = \"America/Atikokan\"\n\tcase americaBahia = \"America/Bahia\"\n\tcase americaBahiaBanderas = \"America/Bahia_Banderas\"\n\tcase americaBarbados = \"America/Barbados\"\n\tcase americaBelem = \"America/Belem\"\n\tcase americaBelize = \"America/Belize\"\n\tcase americaBlancSablon = \"America/Blanc-Sablon\"\n\tcase americaBoaVista = \"America/Boa_Vista\"\n\tcase americaBogota = \"America/Bogota\"\n\tcase americaBoise = \"America/Boise\"\n\tcase americaCambridgeBay = \"America/Cambridge_Bay\"\n\tcase americaCampoGrande = \"America/Campo_Grande\"\n\tcase americaCancun = \"America/Cancun\"\n\tcase americaCaracas = \"America/Caracas\"\n\tcase americaCayenne = \"America/Cayenne\"\n\tcase americaCayman = \"America/Cayman\"\n\tcase americaChicago = \"America/Chicago\"\n\tcase americaChihuahua = \"America/Chihuahua\"\n\tcase americaCostaRica = \"America/Costa_Rica\"\n\tcase americaCreston = \"America/Creston\"\n\tcase americaCuiaba = \"America/Cuiaba\"\n\tcase americaCuracao = \"America/Curacao\"\n\tcase americaDanmarkshavn = \"America/Danmarkshavn\"\n\tcase americaDawson = \"America/Dawson\"\n\tcase americaDawsonCreek = \"America/Dawson_Creek\"\n\tcase americaDenver = \"America/Denver\"\n\tcase americaDetroit = \"America/Detroit\"\n\tcase americaDominica = \"America/Dominica\"\n\tcase americaEdmonton = \"America/Edmonton\"\n\tcase americaEirunepe = \"America/Eirunepe\"\n\tcase americaElSalvador = \"America/El_Salvador\"\n\tcase americaFortNelson = \"America/Fort_Nelson\"\n\tcase americaFortaleza = \"America/Fortaleza\"\n\tcase americaGlaceBay = \"America/Glace_Bay\"\n\tcase americaGodthab = \"America/Godthab\"\n\tcase americaGooseBay = \"America/Goose_Bay\"\n\tcase americaGrandTurk = \"America/Grand_Turk\"\n\tcase americaGrenada = \"America/Grenada\"\n\tcase americaGuadeloupe = \"America/Guadeloupe\"\n\tcase americaGuatemala = \"America/Guatemala\"\n\tcase americaGuayaquil = \"America/Guayaquil\"\n\tcase americaGuyana = \"America/Guyana\"\n\tcase americaHalifax = \"America/Halifax\"\n\tcase americaHavana = \"America/Havana\"\n\tcase americaHermosillo = \"America/Hermosillo\"\n\tcase americaIndianaIndianapolis = \"America/Indiana/Indianapolis\"\n\tcase americaIndianaKnox = \"America/Indiana/Knox\"\n\tcase americaIndianaMarengo = \"America/Indiana/Marengo\"\n\tcase americaIndianaPetersburg = \"America/Indiana/Petersburg\"\n\tcase americaIndianaTellCity = \"America/Indiana/Tell_City\"\n\tcase americaIndianaVevay = \"America/Indiana/Vevay\"\n\tcase americaIndianaVincennes = \"America/Indiana/Vincennes\"\n\tcase americaIndianaWinamac = \"America/Indiana/Winamac\"\n\tcase americaInuvik = \"America/Inuvik\"\n\tcase americaIqaluit = \"America/Iqaluit\"\n\tcase americaJamaica = \"America/Jamaica\"\n\tcase americaJuneau = \"America/Juneau\"\n\tcase americaKentuckyLouisville = \"America/Kentucky/Louisville\"\n\tcase americaKentuckyMonticello = \"America/Kentucky/Monticello\"\n\tcase americaKralendijk = \"America/Kralendijk\"\n\tcase americaLaPaz = \"America/La_Paz\"\n\tcase americaLima = \"America/Lima\"\n\tcase americaLosAngeles = \"America/Los_Angeles\"\n\tcase americaLowerPrinces = \"America/Lower_Princes\"\n\tcase americaMaceio = \"America/Maceio\"\n\tcase americaManagua = \"America/Managua\"\n\tcase americaManaus = \"America/Manaus\"\n\tcase americaMarigot = \"America/Marigot\"\n\tcase americaMartinique = \"America/Martinique\"\n\tcase americaMatamoros = \"America/Matamoros\"\n\tcase americaMazatlan = \"America/Mazatlan\"\n\tcase americaMenominee = \"America/Menominee\"\n\tcase americaMerida = \"America/Merida\"\n\tcase americaMetlakatla = \"America/Metlakatla\"\n\tcase americaMexicoCity = \"America/Mexico_City\"\n\tcase americaMiquelon = \"America/Miquelon\"\n\tcase americaMoncton = \"America/Moncton\"\n\tcase americaMonterrey = \"America/Monterrey\"\n\tcase americaMontevideo = \"America/Montevideo\"\n\tcase americaMontreal = \"America/Montreal\"\n\tcase americaMontserrat = \"America/Montserrat\"\n\tcase americaNassau = \"America/Nassau\"\n\tcase americaNewYork = \"America/New_York\"\n\tcase americaNipigon = \"America/Nipigon\"\n\tcase americaNome = \"America/Nome\"\n\tcase americaNoronha = \"America/Noronha\"\n\tcase americaNorthDakotaBeulah = \"America/North_Dakota/Beulah\"\n\tcase americaNorthDakotaCenter = \"America/North_Dakota/Center\"\n\tcase americaNorthDakotaNewSalem = \"America/North_Dakota/New_Salem\"\n\tcase americaOjinaga = \"America/Ojinaga\"\n\tcase americaPanama = \"America/Panama\"\n\tcase americaPangnirtung = \"America/Pangnirtung\"\n\tcase americaParamaribo = \"America/Paramaribo\"\n\tcase americaPhoenix = \"America/Phoenix\"\n\tcase americaPortAuPrince = \"America/Port-au-Prince\"\n\tcase americaPortOfSpain = \"America/Port_of_Spain\"\n\tcase americaPortoVelho = \"America/Porto_Velho\"\n\tcase americaPuertoRico = \"America/Puerto_Rico\"\n\tcase americaRainyRiver = \"America/Rainy_River\"\n\tcase americaRankinInlet = \"America/Rankin_Inlet\"\n\tcase americaRecife = \"America/Recife\"\n\tcase americaRegina = \"America/Regina\"\n\tcase americaResolute = \"America/Resolute\"\n\tcase americaRioBranco = \"America/Rio_Branco\"\n\tcase americaSantaIsabel = \"America/Santa_Isabel\"\n\tcase americaSantarem = \"America/Santarem\"\n\tcase americaSantiago = \"America/Santiago\"\n\tcase americaSantoDomingo = \"America/Santo_Domingo\"\n\tcase americaSaoPaulo = \"America/Sao_Paulo\"\n\tcase americaScoresbysund = \"America/Scoresbysund\"\n\tcase americaShiprock = \"America/Shiprock\"\n\tcase americaSitka = \"America/Sitka\"\n\tcase americaStBarthelemy = \"America/St_Barthelemy\"\n\tcase americaStJohns = \"America/St_Johns\"\n\tcase americaStKitts = \"America/St_Kitts\"\n\tcase americaStLucia = \"America/St_Lucia\"\n\tcase americaStThomas = \"America/St_Thomas\"\n\tcase americaStVincent = \"America/St_Vincent\"\n\tcase americaSwiftCurrent = \"America/Swift_Current\"\n\tcase americaTegucigalpa = \"America/Tegucigalpa\"\n\tcase americaThule = \"America/Thule\"\n\tcase americaThunderBay = \"America/Thunder_Bay\"\n\tcase americaTijuana = \"America/Tijuana\"\n\tcase americaToronto = \"America/Toronto\"\n\tcase americaTortola = \"America/Tortola\"\n\tcase americaVancouver = \"America/Vancouver\"\n\tcase americaWhitehorse = \"America/Whitehorse\"\n\tcase americaWinnipeg = \"America/Winnipeg\"\n\tcase americaYakutat = \"America/Yakutat\"\n\tcase americaYellowknife = \"America/Yellowknife\"\n\tcase antarcticaCasey = \"Antarctica/Casey\"\n\tcase antarcticaDavis = \"Antarctica/Davis\"\n\tcase antarcticaDumontdurville = \"Antarctica/DumontDUrville\"\n\tcase antarcticaMacquarie = \"Antarctica/Macquarie\"\n\tcase antarcticaMawson = \"Antarctica/Mawson\"\n\tcase antarcticaMcmurdo = \"Antarctica/McMurdo\"\n\tcase antarcticaPalmer = \"Antarctica/Palmer\"\n\tcase antarcticaRothera = \"Antarctica/Rothera\"\n\tcase antarcticaSouthPole = \"Antarctica/South_Pole\"\n\tcase antarcticaSyowa = \"Antarctica/Syowa\"\n\tcase antarcticaTroll = \"Antarctica/Troll\"\n\tcase antarcticaVostok = \"Antarctica/Vostok\"\n\tcase arcticLongyearbyen = \"Arctic/Longyearbyen\"\n\tcase asiaAden = \"Asia/Aden\"\n\tcase asiaAlmaty = \"Asia/Almaty\"\n\tcase asiaAmman = \"Asia/Amman\"\n\tcase asiaAnadyr = \"Asia/Anadyr\"\n\tcase asiaAqtau = \"Asia/Aqtau\"\n\tcase asiaAqtobe = \"Asia/Aqtobe\"\n\tcase asiaAshgabat = \"Asia/Ashgabat\"\n\tcase asiaBaghdad = \"Asia/Baghdad\"\n\tcase asiaBahrain = \"Asia/Bahrain\"\n\tcase asiaBaku = \"Asia/Baku\"\n\tcase asiaBangkok = \"Asia/Bangkok\"\n\tcase asiaBeirut = \"Asia/Beirut\"\n\tcase asiaBishkek = \"Asia/Bishkek\"\n\tcase asiaBrunei = \"Asia/Brunei\"\n\tcase asiaChita = \"Asia/Chita\"\n\tcase asiaChoibalsan = \"Asia/Choibalsan\"\n\tcase asiaChongqing = \"Asia/Chongqing\"\n\tcase asiaColombo = \"Asia/Colombo\"\n\tcase asiaDamascus = \"Asia/Damascus\"\n\tcase asiaDhaka = \"Asia/Dhaka\"\n\tcase asiaDili = \"Asia/Dili\"\n\tcase asiaDubai = \"Asia/Dubai\"\n\tcase asiaDushanbe = \"Asia/Dushanbe\"\n\tcase asiaGaza = \"Asia/Gaza\"\n\tcase asiaHarbin = \"Asia/Harbin\"\n\tcase asiaHebron = \"Asia/Hebron\"\n\tcase asiaHoChiMinh = \"Asia/Ho_Chi_Minh\"\n\tcase asiaSaigon = \"Asia/Saigon\"\n\tcase asiaHongKong = \"Asia/Hong_Kong\"\n\tcase asiaHovd = \"Asia/Hovd\"\n\tcase asiaIrkutsk = \"Asia/Irkutsk\"\n\tcase asiaJakarta = \"Asia/Jakarta\"\n\tcase asiaJayapura = \"Asia/Jayapura\"\n\tcase asiaJerusalem = \"Asia/Jerusalem\"\n\tcase asiaKabul = \"Asia/Kabul\"\n\tcase asiaKamchatka = \"Asia/Kamchatka\"\n\tcase asiaKarachi = \"Asia/Karachi\"\n\tcase asiaKashgar = \"Asia/Kashgar\"\n\tcase asiaKathmandu = \"Asia/Kathmandu\"\n\tcase asiaKatmandu = \"Asia/Katmandu\"\n\tcase asiaKhandyga = \"Asia/Khandyga\"\n\tcase asiaKolkata = \"Asia/Kolkata\"\n\tcase asiaKrasnoyarsk = \"Asia/Krasnoyarsk\"\n\tcase asiaKualaLumpur = \"Asia/Kuala_Lumpur\"\n\tcase asiaKuching = \"Asia/Kuching\"\n\tcase asiaKuwait = \"Asia/Kuwait\"\n\tcase asiaMacau = \"Asia/Macau\"\n\tcase asiaMagadan = \"Asia/Magadan\"\n\tcase asiaMakassar = \"Asia/Makassar\"\n\tcase asiaManila = \"Asia/Manila\"\n\tcase asiaMuscat = \"Asia/Muscat\"\n\tcase asiaNicosia = \"Asia/Nicosia\"\n\tcase asiaNovokuznetsk = \"Asia/Novokuznetsk\"\n\tcase asiaNovosibirsk = \"Asia/Novosibirsk\"\n\tcase asiaOmsk = \"Asia/Omsk\"\n\tcase asiaOral = \"Asia/Oral\"\n\tcase asiaPhnomPenh = \"Asia/Phnom_Penh\"\n\tcase asiaPontianak = \"Asia/Pontianak\"\n\tcase asiaPyongyang = \"Asia/Pyongyang\"\n\tcase asiaQatar = \"Asia/Qatar\"\n\tcase asiaQyzylorda = \"Asia/Qyzylorda\"\n\tcase asiaRangoon = \"Asia/Rangoon\"\n\tcase asiaRiyadh = \"Asia/Riyadh\"\n\tcase asiaSakhalin = \"Asia/Sakhalin\"\n\tcase asiaSamarkand = \"Asia/Samarkand\"\n\tcase asiaSeoul = \"Asia/Seoul\"\n\tcase asiaShanghai = \"Asia/Shanghai\"\n\tcase asiaSingapore = \"Asia/Singapore\"\n\tcase asiaSrednekolymsk = \"Asia/Srednekolymsk\"\n\tcase asiaTaipei = \"Asia/Taipei\"\n\tcase asiaTashkent = \"Asia/Tashkent\"\n\tcase asiaTbilisi = \"Asia/Tbilisi\"\n\tcase asiaTehran = \"Asia/Tehran\"\n\tcase asiaThimphu = \"Asia/Thimphu\"\n\tcase asiaTokyo = \"Asia/Tokyo\"\n\tcase asiaUlaanbaatar = \"Asia/Ulaanbaatar\"\n\tcase asiaUrumqi = \"Asia/Urumqi\"\n\tcase asiaUstNera = \"Asia/Ust-Nera\"\n\tcase asiaVientiane = \"Asia/Vientiane\"\n\tcase asiaVladivostok = \"Asia/Vladivostok\"\n\tcase asiaYakutsk = \"Asia/Yakutsk\"\n\tcase asiaYekaterinburg = \"Asia/Yekaterinburg\"\n\tcase asiaYerevan = \"Asia/Yerevan\"\n\tcase atlanticAzores = \"Atlantic/Azores\"\n\tcase atlanticBermuda = \"Atlantic/Bermuda\"\n\tcase atlanticCanary = \"Atlantic/Canary\"\n\tcase atlanticCapeVerde = \"Atlantic/Cape_Verde\"\n\tcase atlanticFaroe = \"Atlantic/Faroe\"\n\tcase atlanticMadeira = \"Atlantic/Madeira\"\n\tcase atlanticReykjavik = \"Atlantic/Reykjavik\"\n\tcase atlanticSouthGeorgia = \"Atlantic/South_Georgia\"\n\tcase atlanticStHelena = \"Atlantic/St_Helena\"\n\tcase atlanticStanley = \"Atlantic/Stanley\"\n\tcase australiaAdelaide = \"Australia/Adelaide\"\n\tcase australiaBrisbane = \"Australia/Brisbane\"\n\tcase australiaBrokenHill = \"Australia/Broken_Hill\"\n\tcase australiaCurrie = \"Australia/Currie\"\n\tcase australiaDarwin = \"Australia/Darwin\"\n\tcase australiaEucla = \"Australia/Eucla\"\n\tcase australiaHobart = \"Australia/Hobart\"\n\tcase australiaLindeman = \"Australia/Lindeman\"\n\tcase australiaLordHowe = \"Australia/Lord_Howe\"\n\tcase australiaMelbourne = \"Australia/Melbourne\"\n\tcase australiaPerth = \"Australia/Perth\"\n\tcase australiaSydney = \"Australia/Sydney\"\n\tcase europeAmsterdam = \"Europe/Amsterdam\"\n\tcase europeAndorra = \"Europe/Andorra\"\n\tcase europeAthens = \"Europe/Athens\"\n\tcase europeBelgrade = \"Europe/Belgrade\"\n\tcase europeBerlin = \"Europe/Berlin\"\n\tcase europeBratislava = \"Europe/Bratislava\"\n\tcase europeBrussels = \"Europe/Brussels\"\n\tcase europeBucharest = \"Europe/Bucharest\"\n\tcase europeBudapest = \"Europe/Budapest\"\n\tcase europeBusingen = \"Europe/Busingen\"\n\tcase europeChisinau = \"Europe/Chisinau\"\n\tcase europeCopenhagen = \"Europe/Copenhagen\"\n\tcase europeDublin = \"Europe/Dublin\"\n\tcase europeGibraltar = \"Europe/Gibraltar\"\n\tcase europeGuernsey = \"Europe/Guernsey\"\n\tcase europeHelsinki = \"Europe/Helsinki\"\n\tcase europeIsleOfMan = \"Europe/Isle_of_Man\"\n\tcase europeIstanbul = \"Europe/Istanbul\"\n\tcase europeJersey = \"Europe/Jersey\"\n\tcase europeKaliningrad = \"Europe/Kaliningrad\"\n\tcase europeKiev = \"Europe/Kiev\"\n\tcase europeLisbon = \"Europe/Lisbon\"\n\tcase europeLjubljana = \"Europe/Ljubljana\"\n\tcase europeLondon = \"Europe/London\"\n\tcase europeLuxembourg = \"Europe/Luxembourg\"\n\tcase europeMadrid = \"Europe/Madrid\"\n\tcase europeMalta = \"Europe/Malta\"\n\tcase europeMariehamn = \"Europe/Mariehamn\"\n\tcase europeMinsk = \"Europe/Minsk\"\n\tcase europeMonaco = \"Europe/Monaco\"\n\tcase europeMoscow = \"Europe/Moscow\"\n\tcase europeOslo = \"Europe/Oslo\"\n\tcase europeParis = \"Europe/Paris\"\n\tcase europePodgorica = \"Europe/Podgorica\"\n\tcase europePrague = \"Europe/Prague\"\n\tcase europeRiga = \"Europe/Riga\"\n\tcase europeRome = \"Europe/Rome\"\n\tcase europeSamara = \"Europe/Samara\"\n\tcase europeSanMarino = \"Europe/San_Marino\"\n\tcase europeSarajevo = \"Europe/Sarajevo\"\n\tcase europeSimferopol = \"Europe/Simferopol\"\n\tcase europeSkopje = \"Europe/Skopje\"\n\tcase europeSofia = \"Europe/Sofia\"\n\tcase europeStockholm = \"Europe/Stockholm\"\n\tcase europeTallinn = \"Europe/Tallinn\"\n\tcase europeTirane = \"Europe/Tirane\"\n\tcase europeUzhgorod = \"Europe/Uzhgorod\"\n\tcase europeVaduz = \"Europe/Vaduz\"\n\tcase europeVatican = \"Europe/Vatican\"\n\tcase europeVienna = \"Europe/Vienna\"\n\tcase europeVilnius = \"Europe/Vilnius\"\n\tcase europeVolgograd = \"Europe/Volgograd\"\n\tcase europeWarsaw = \"Europe/Warsaw\"\n\tcase europeZagreb = \"Europe/Zagreb\"\n\tcase europeZaporozhye = \"Europe/Zaporozhye\"\n\tcase europeZurich = \"Europe/Zurich\"\n\tcase gmt = \"GMT\"\n\tcase indianAntananarivo = \"Indian/Antananarivo\"\n\tcase indianChagos = \"Indian/Chagos\"\n\tcase indianChristmas = \"Indian/Christmas\"\n\tcase indianCocos = \"Indian/Cocos\"\n\tcase indianComoro = \"Indian/Comoro\"\n\tcase indianKerguelen = \"Indian/Kerguelen\"\n\tcase indianMahe = \"Indian/Mahe\"\n\tcase indianMaldives = \"Indian/Maldives\"\n\tcase indianMauritius = \"Indian/Mauritius\"\n\tcase indianMayotte = \"Indian/Mayotte\"\n\tcase indianReunion = \"Indian/Reunion\"\n\tcase pacificApia = \"Pacific/Apia\"\n\tcase pacificAuckland = \"Pacific/Auckland\"\n\tcase pacificBougainville = \"Pacific/Bougainville\"\n\tcase pacificChatham = \"Pacific/Chatham\"\n\tcase pacificChuuk = \"Pacific/Chuuk\"\n\tcase pacificEaster = \"Pacific/Easter\"\n\tcase pacificEfate = \"Pacific/Efate\"\n\tcase pacificEnderbury = \"Pacific/Enderbury\"\n\tcase pacificFakaofo = \"Pacific/Fakaofo\"\n\tcase pacificFiji = \"Pacific/Fiji\"\n\tcase pacificFunafuti = \"Pacific/Funafuti\"\n\tcase pacificGalapagos = \"Pacific/Galapagos\"\n\tcase pacificGambier = \"Pacific/Gambier\"\n\tcase pacificGuadalcanal = \"Pacific/Guadalcanal\"\n\tcase pacificGuam = \"Pacific/Guam\"\n\tcase pacificHonolulu = \"Pacific/Honolulu\"\n\tcase pacificJohnston = \"Pacific/Johnston\"\n\tcase pacificKiritimati = \"Pacific/Kiritimati\"\n\tcase pacificKosrae = \"Pacific/Kosrae\"\n\tcase pacificKwajalein = \"Pacific/Kwajalein\"\n\tcase pacificMajuro = \"Pacific/Majuro\"\n\tcase pacificMarquesas = \"Pacific/Marquesas\"\n\tcase pacificMidway = \"Pacific/Midway\"\n\tcase pacificNauru = \"Pacific/Nauru\"\n\tcase pacificNiue = \"Pacific/Niue\"\n\tcase pacificNorfolk = \"Pacific/Norfolk\"\n\tcase pacificNoumea = \"Pacific/Noumea\"\n\tcase pacificPagoPago = \"Pacific/Pago_Pago\"\n\tcase pacificPalau = \"Pacific/Palau\"\n\tcase pacificPitcairn = \"Pacific/Pitcairn\"\n\tcase pacificPohnpei = \"Pacific/Pohnpei\"\n\tcase pacificPonape = \"Pacific/Ponape\"\n\tcase pacificPortMoresby = \"Pacific/Port_Moresby\"\n\tcase pacificRarotonga = \"Pacific/Rarotonga\"\n\tcase pacificSaipan = \"Pacific/Saipan\"\n\tcase pacificTahiti = \"Pacific/Tahiti\"\n\tcase pacificTarawa = \"Pacific/Tarawa\"\n\tcase pacificTongatapu = \"Pacific/Tongatapu\"\n\tcase pacificTruk = \"Pacific/Truk\"\n\tcase pacificWake = \"Pacific/Wake\"\n\tcase pacificWallis = \"Pacific/Wallis\"\n\n\tpublic func toTimezone() -> TimeZone {\n\t\tswitch self {\n\t\tcase .current:\t\t\treturn TimeZone.current\n\t\tcase .autoUpdating:\t\treturn TimeZone.autoupdatingCurrent\n\t\tdefault:\t\t\t\treturn TimeZone(identifier: rawValue)!\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/SwiftDate.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic struct SwiftDate {\n\n\tprivate init() { }\n\n\t/// The default region is used to manipulate and work with plain `Date` object and\n\t/// wherever a region parameter is optional. By default region is the to GMT timezone\n\t/// along with the default device's locale and calendar (both autoupdating).\n\tpublic static var defaultRegion = Region.UTC\n\n\t/// This is the ordered list of all formats SwiftDate can use in order to attempt parsing a passaed\n\t/// date expressed as string. Evaluation is made in order; you can add or remove new formats as you wish.\n\t/// In order to reset the list call `resetAutoFormats()` function.\n\tpublic static var autoFormats: [String] {\n\t\tset { DateFormats.autoFormats = newValue }\n\t\tget { return DateFormats.autoFormats }\n\t}\n\n\t/// Reset the list of all built-in auto formats patterns.\n\tpublic static func resetAutoFormats() {\n\t\tDateFormats.resetAutoFormats()\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/TimePeriod/Groups/TimePeriodChain.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Time period chains serve as a tightly coupled set of time periods.\n/// They are always organized by start and end date, and have their own characteristics like\n/// a StartDate and EndDate that are extrapolated from the time periods within.\n/// Time period chains do not allow overlaps within their set of time periods.\n/// This type of group is ideal for modeling schedules like sequential meetings or appointments.\nopen class TimePeriodChain: TimePeriodGroup {\n\n\t// MARK: - Chain Existence Manipulation\n\n\t/**\n\t*  Append a TimePeriodProtocol to the periods array and update the Chain's\n\t*  beginning and end.\n\t*\n\t* - parameter period: TimePeriodProtocol to add to the collection\n\t*/\n\tpublic func append(_ period: TimePeriodProtocol) {\n\t\tlet beginning = (periods.count > 0) ? periods.last!.end! : period.start\n\n\t\tlet newPeriod = TimePeriod(start: beginning!, duration: period.duration)\n\t\tperiods.append(newPeriod)\n\n\t\t//Update updateExtremes\n\t\tif periods.count == 1 {\n\t\t\tstart = period.start\n\t\t\tend = period.end\n\t\t} else {\n\t\t\tend = end?.addingTimeInterval(period.duration)\n\t\t}\n\t}\n\n\t/**\n\t*  Append a TimePeriodProtocol array to the periods array and update the Chain's\n\t*  beginning and end.\n\t*\n\t* - parameter periodArray: TimePeriodProtocol list to add to the collection\n\t*/\n\tpublic func append<G: TimePeriodGroup>(contentsOf group: G) {\n\t\tfor period in group.periods {\n\t\t\tlet beginning = (periods.count > 0) ? periods.last!.end! : period.start\n\n\t\t\tlet newPeriod = TimePeriod(start: beginning!, duration: period.duration)\n\t\t\tperiods.append(newPeriod)\n\n\t\t\t//Update updateExtremes\n\t\t\tif periods.count == 1 {\n\t\t\t\tstart = period.start\n\t\t\t\tend = period.end\n\t\t\t} else {\n\t\t\t\tend = end?.addingTimeInterval(period.duration)\n\t\t\t}\n\t\t}\n\t}\n\n\t/// Insert period into periods array at given index.\n\t///\n\t/// - Parameters:\n\t///   - period: The period to insert\n\t///   - index: Index to insert period at\n\tpublic func insert(_ period: TimePeriodProtocol, at index: Int) {\n\t\t//Check for special zero case which takes the beginning date\n\t\tif index == 0 && period.start != nil && period.end != nil {\n\t\t\t//Insert new period\n\t\t\tperiods.insert(period, at: index)\n\t\t} else if period.start != nil && period.end != nil {\n\t\t\t//Insert new period\n\t\t\tperiods.insert(period, at: index)\n\t\t} else {\n\t\t\tprint(\"All TimePeriods in a TimePeriodChain must contain a defined start and end date\")\n\t\t\treturn\n\t\t}\n\n\t\t//Shift all periods after inserted period\n\t\tfor i in 0..<periods.count {\n\t\t\tif i > index && i > 0 {\n\t\t\t\tlet currentPeriod = TimePeriod(start: period.start, end: period.end)\n\t\t\t\tperiods[i].start = periods[i - 1].end\n\t\t\t\tperiods[i].end = periods[i].start!.addingTimeInterval(currentPeriod.duration)\n\t\t\t}\n\t\t}\n\n\t\tupdateExtremes()\n\t}\n\n\t/// Remove from period array at the given index.\n\t///\n\t/// - Parameter index: The index in the collection to remove\n\tpublic func remove(at index: Int) {\n\t\t//Retrieve duration of period to be removed\n\t\tlet duration = periods[index].duration\n\n\t\t//Remove period\n\t\tperiods.remove(at: index)\n\n\t\t//Shift all periods after inserted period\n\t\tfor i in index..<periods.count {\n\t\t\tperiods[i].shift(by: -duration)\n\t\t}\n\t\tupdateExtremes()\n\t}\n\n\t/// Remove all periods from period array.\n\tpublic func removeAll() {\n\t\tperiods.removeAll()\n\t\tupdateExtremes()\n\t}\n\n\t// MARK: - Chain Content Manipulation\n\n\t/// In place, shifts all chain time periods by a given time interval\n\t///\n\t/// - Parameter duration: The time interval to shift the period by\n\tpublic func shift(by duration: TimeInterval) {\n\t\tfor var period in periods {\n\t\t\tperiod.shift(by: duration)\n\t\t}\n\t\tstart = start?.addingTimeInterval(duration)\n\t\tend = end?.addingTimeInterval(duration)\n\t}\n\n\tpublic override func map<T>(_ transform: (TimePeriodProtocol) throws -> T) rethrows -> [T] {\n\t\treturn try periods.map(transform)\n\t}\n\n\tpublic override func filter(_ isIncluded: (TimePeriodProtocol) throws -> Bool) rethrows -> [TimePeriodProtocol] {\n\t\treturn try periods.filter(isIncluded)\n\t}\n\n\tinternal override func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, TimePeriodProtocol) throws -> Result) rethrows -> Result {\n\t\treturn try periods.reduce(initialResult, nextPartialResult)\n\t}\n\n\t/// Removes the last object from the `TimePeriodChain` and returns it\n\tpublic func pop() -> TimePeriodProtocol? {\n\t\tlet period = periods.popLast()\n\t\tupdateExtremes()\n\n\t\treturn period\n\t}\n\n\tinternal func updateExtremes() {\n\t\tstart = periods.first?.start\n\t\tend = periods.last?.end\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/TimePeriod/Groups/TimePeriodCollection.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Sort type\n///\n/// - ascending: sort in ascending order\n/// - descending: sort in descending order\npublic enum SortMode {\n\tcase ascending\n\tcase descending\n}\n\n/// Sorting type\n///\n/// - start: sort by start date\n/// - end: sort by end date\n/// - duration: sort by duration\n/// - custom: sort using custom function\npublic enum SortType {\n\tcase start(_: SortMode)\n\tcase end(_: SortMode)\n\tcase duration(_: SortMode)\n\tcase custom(_: ((TimePeriodProtocol, TimePeriodProtocol) -> Bool))\n}\n\n/// Time period collections serve as loose sets of time periods.\n/// They are unorganized unless you decide to sort them, and have their own characteristics\n/// like a `start` and `end` that are extrapolated from the time periods within.\n/// Time period collections allow overlaps within their set of time periods.\nopen class TimePeriodCollection: TimePeriodGroup {\n\n\t// MARK: - Collection Manipulation\n\n\t/// Append a TimePeriodProtocol to the periods array and check if the Collection's start and end should change.\n\t///\n\t/// - Parameter period: TimePeriodProtocol to add to the collection\n\tpublic func append(_ period: TimePeriodProtocol) {\n\t\tperiods.append(period)\n\t\tupdateExtremes(period: period)\n\t}\n\n\t/// Append a TimePeriodProtocol array to the periods array and check if the Collection's\n\t/// start and end should change.\n\t///\n\t/// - Parameter periodArray: TimePeriodProtocol list to add to the collection\n\tpublic func append(_ periodArray: [TimePeriodProtocol]) {\n\t\tfor period in periodArray {\n\t\t\tperiods.append(period)\n\t\t\tupdateExtremes(period: period)\n\t\t}\n\t}\n\n\t/// Append a TimePeriodGroup's periods array to the periods array of self and check if the Collection's\n\t/// start and end should change.\n\t///\n\t/// - Parameter newPeriods: TimePeriodGroup to merge periods arrays with\n\tpublic func append<C: TimePeriodGroup>(contentsOf newPeriods: C) {\n\t\tfor period in newPeriods as TimePeriodGroup {\n\t\t\tperiods.append(period)\n\t\t\tupdateExtremes(period: period)\n\t\t}\n\t}\n\n\t/// Insert period into periods array at given index.\n\t///\n\t/// - Parameters:\n\t///   - newElement: The period to insert\n\t///   - index: Index to insert period at\n\tpublic func insert(_ newElement: TimePeriodProtocol, at index: Int) {\n\t\tperiods.insert(newElement, at: index)\n\t\tupdateExtremes(period: newElement)\n\t}\n\n\t/// Remove from period array at the given index.\n\t///\n\t/// - Parameter at: The index in the collection to remove\n\tpublic func remove(at: Int) {\n\t\tperiods.remove(at: at)\n\t\tupdateExtremes()\n\t}\n\n\t/// Remove all periods from period array.\n\tpublic func removeAll() {\n\t\tperiods.removeAll()\n\t\tupdateExtremes()\n\t}\n\n\t// MARK: - Sorting\n\n\t/// Sort elements in place using given method.\n\t///\n\t/// - Parameter type: sorting method\n\tpublic func sort(by type: SortType) {\n\t\tswitch type {\n\t\tcase .duration(let mode):\tperiods.sort(by: sortFuncDuration(mode))\n\t\tcase .start(let mode):\t\tperiods.sort(by: sortFunc(byStart: true, type: mode))\n\t\tcase .end(let mode):\t\tperiods.sort(by: sortFunc(byStart: false, type: mode))\n\t\tcase .custom(let f):\t\tperiods.sort(by: f)\n\t\t}\n\t}\n\n\t/// Generate a new `TimePeriodCollection` where items are sorted with specified method.\n\t///\n\t/// - Parameters:\n\t///   - type: sorting method\n\t/// - Returns: collection ordered by given function\n\tpublic func sorted(by type: SortType) -> TimePeriodCollection {\n\t\tvar sortedList: [TimePeriodProtocol]!\n\t\tswitch type {\n\t\tcase .duration(let mode):\tsortedList = periods.sorted(by: sortFuncDuration(mode))\n\t\tcase .start(let mode):\t\tsortedList = periods.sorted(by: sortFunc(byStart: true, type: mode))\n\t\tcase .end(let mode):\t\tsortedList = periods.sorted(by: sortFunc(byStart: false, type: mode))\n\t\tcase .custom(let f):\t\tsortedList = periods.sorted(by: f)\n\t\t}\n\t\treturn TimePeriodCollection(sortedList)\n\t}\n\n\t// MARK: - Collection Relationship\n\n\t/// Returns from the `TimePeriodCollection` a sub-collection of `TimePeriod`s\n\t/// whose start and end dates fall completely inside the interval of the given `TimePeriod`.\n\t///\n\t/// - Parameter period: The period to compare each other period against\n\t/// - Returns: Collection of periods inside the given period\n\tpublic func periodsInside(period: TimePeriodProtocol) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.isInside(period) }))\n\t}\n\n\t//  Returns from the `TimePeriodCollection` a sub-collection of `TimePeriod`s containing the given date.\n\t///\n\t/// - Parameter date: The date to compare each period to\n\t/// - Returns: Collection of periods intersected by the given date\n\tpublic func periodsIntersected(by date: DateInRegion) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.contains(date: date, interval: .closed) }))\n\t}\n\n\t/// Returns from the `TimePeriodCollection` a sub-collection of `TimePeriod`s\n\t/// containing either the start date or the end date--or both--of the given `TimePeriod`.\n\t///\n\t/// - Parameter period: The period to compare each other period to\n\t/// - Returns: Collection of periods intersected by the given period\n\tpublic func periodsIntersected(by period: TimePeriodProtocol) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.intersects(with: period) }))\n\t}\n\n\t/// Returns an instance of DTTimePeriodCollection with all the time periods in the receiver that overlap a given time period.\n\t/// Overlap with the given time period does NOT include other time periods that simply touch it.\n\t/// (i.e. one's start date is equal to another's end date)\n\t///\n\t/// - Parameter period: The time period to check against the receiver's time periods.\n\t/// - Returns: Collection of periods overlapped by the given period\n\tpublic func periodsOverlappedBy(_ period: TimePeriodProtocol) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.overlaps(with: period) }))\n\t}\n\n\t// MARK: - Map\n\n\tpublic func map(_ transform: (TimePeriodProtocol) throws -> TimePeriodProtocol) rethrows -> TimePeriodCollection {\n\t\tvar mappedArray = [TimePeriodProtocol]()\n\t\tmappedArray = try periods.map(transform)\n\t\tlet mappedCollection = TimePeriodCollection()\n\t\tfor period in mappedArray {\n\t\t\tmappedCollection.periods.append(period)\n\t\t\tmappedCollection.updateExtremes(period: period)\n\t\t}\n\t\treturn mappedCollection\n\t}\n\n\t// MARK: - Helpers\n\n\tprivate func sortFuncDuration(_ type: SortMode) -> ((TimePeriodProtocol, TimePeriodProtocol) -> Bool) {\n\t\tswitch type {\n\t\tcase .ascending: \treturn { $0.duration < $1.duration }\n\t\tcase .descending: \treturn { $0.duration > $1.duration }\n\t\t}\n\t}\n\n\tprivate func sortFunc(byStart start: Bool = true, type: SortMode) -> ((TimePeriodProtocol, TimePeriodProtocol) -> Bool) {\n\t\treturn {\n\t\t\tlet date0 = (start ? $0.start : $0.end)\n\t\t\tlet date1 = (start ? $1.start : $1.end)\n\t\t\tif date0 == nil && date1 == nil {\n\t\t\t\treturn false\n\t\t\t} else if date0 == nil {\n\t\t\t\treturn true\n\t\t\t} else if date1 == nil {\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\treturn (type == .ascending ? date1! > date0! : date0! > date1!)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate func updateExtremes(period: TimePeriodProtocol) {\n\t\t//Check incoming period against previous start and end date\n\t\tguard count != 1 else {\n\t\t\tstart = period.start\n\t\t\tend = period.end\n\t\t\treturn\n\t\t}\n\t\tstart = nilOrEarlier(date1: start, date2: period.start)\n\t\tend = nilOrLater(date1: end, date2: period.end)\n\t}\n\n\tprivate func updateExtremes() {\n\t\tguard periods.count > 0 else {\n\t\t\tstart = nil\n\t\t\tend = nil\n\t\t\treturn\n\t\t}\n\n\t\tstart = periods.first!.start\n\t\tend = periods.first!.end\n\t\tfor i in 1..<periods.count {\n\t\t\tstart = nilOrEarlier(date1: start, date2: periods[i].start)\n\t\t\tend = nilOrEarlier(date1: end, date2: periods[i].end)\n\t\t}\n\t}\n\n\tprivate func nilOrEarlier(date1: DateInRegion?, date2: DateInRegion?) -> DateInRegion? {\n\t\tguard date1 != nil && date2 != nil else { return nil }\n\t\treturn date1!.earlierDate(date2!)\n\t}\n\n\tprivate func nilOrLater(date1: DateInRegion?, date2: DateInRegion?) -> DateInRegion? {\n\t\tguard date1 != nil && date2 != nil else { return nil }\n\t\treturn date1!.laterDate(date2!)\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/TimePeriod/Groups/TimePeriodGroup.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Time period groups are the final abstraction of date and time in DateTools.\n/// Here, time periods are gathered and organized into something useful.\n/// There are two main types of time period groups, `TimePeriodCollection` and `TimePeriodChain`.\nopen class TimePeriodGroup: Sequence, Equatable {\n\n\t/// Array of periods that define the group.\n\tinternal var periods: [TimePeriodProtocol] = []\n\n\t/// The earliest beginning date of a `TimePeriod` in the group.\n\t/// `nil` if any `TimePeriod` in group has a nil beginning date (indefinite).\n\tpublic internal(set) var start: DateInRegion?\n\n\t/// The latest end date of a `TimePeriod` in the group.\n\t/// `nil` if any `TimePeriod` in group has a nil end date (indefinite).\n\tpublic internal(set) var end: DateInRegion?\n\n\t/// The total amount of time between the earliest and latest dates stored in the periods array.\n\t/// `nil` if any beginning or end date in any contained period is `nil`.\n\tpublic var duration: TimeInterval? {\n\t\tguard let start = start, let end = end else { return nil }\n\t\treturn end.timeIntervalSince(start)\n\t}\n\n\t/// The number of periods in the periods array.\n\tpublic var count: Int {\n\t\treturn periods.count\n\t}\n\n\t// MARK: - Equatable\n\n\tpublic static func == (lhs: TimePeriodGroup, rhs: TimePeriodGroup) -> Bool {\n\t\treturn TimePeriodGroup.hasSameElements(array1: lhs.periods, rhs.periods)\n\t}\n\n\t// MARK: - Initializers\n\n\tpublic init(_ periods: [TimePeriodProtocol]? = nil) {\n\t\tself.periods = (periods ?? [])\n\t}\n\n\t// MARK: - Sequence Protocol\n\n\tpublic func makeIterator() -> IndexingIterator<[TimePeriodProtocol]> {\n\t\treturn periods.makeIterator()\n\t}\n\n\tpublic func map<T>(_ transform: (TimePeriodProtocol) throws -> T) rethrows -> [T] {\n\t\treturn try periods.map(transform)\n\t}\n\n\tpublic func filter(_ isIncluded: (TimePeriodProtocol) throws -> Bool) rethrows -> [TimePeriodProtocol] {\n\t\treturn try periods.filter(isIncluded)\n\t}\n\n\tpublic func forEach(_ body: (TimePeriodProtocol) throws -> Void) rethrows {\n\t\treturn try periods.forEach(body)\n\t}\n\n\tpublic func split(maxSplits: Int, omittingEmptySubsequences: Bool, whereSeparator isSeparator: (TimePeriodProtocol) throws -> Bool) rethrows -> [AnySequence<TimePeriodProtocol>] {\n\t\treturn try periods.split(maxSplits: maxSplits, omittingEmptySubsequences: omittingEmptySubsequences, whereSeparator: isSeparator).map(AnySequence.init)\n\t}\n\n\tpublic subscript(index: Int) -> TimePeriodProtocol {\n\t\tget {\n\t\t\treturn periods[index]\n\t\t}\n\t}\n\n\tinternal func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, TimePeriodProtocol) throws -> Result) rethrows -> Result {\n\t\treturn try periods.reduce(initialResult, nextPartialResult)\n\t}\n\n\t// MARK: - Internal Helper Functions\n\n\tinternal static func hasSameElements(array1: [TimePeriodProtocol], _ array2: [TimePeriodProtocol]) -> Bool {\n\t\tguard array1.count == array2.count else {\n\t\t\treturn false // No need to sorting if they already have different counts\n\t\t}\n\n\t\tlet compArray1: [TimePeriodProtocol] = array1.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in\n\t\t\tif period1.start == nil && period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else if period1.start == nil {\n\t\t\t\treturn true\n\t\t\t} else if period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\treturn period2.start! < period1.start!\n\t\t\t}\n\t\t}\n\t\tlet compArray2: [TimePeriodProtocol] = array2.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in\n\t\t\tif period1.start == nil && period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else if period1.start == nil {\n\t\t\t\treturn true\n\t\t\t} else if period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\treturn period2.start! < period1.start!\n\t\t\t}\n\t\t}\n\t\tfor x in 0..<compArray1.count {\n\t\t\tif !compArray1[x].equals(compArray2[x]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/TimePeriod/TimePeriod+Support.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// There may come a need, say when you are making a scheduling app, when\n/// it might be good to know how two time periods relate to one another\n/// Are they the same? Is one inside of another?\n/// All these questions may be asked using the relationship method of TimePeriod.\npublic enum TimePeriodRelation {\n\tcase after\n\tcase startTouching\n\tcase startInside\n\tcase insideStartTouching\n\tcase enclosingStartTouching\n\tcase enclosing\n\tcase enclosingEndTouching\n\tcase exactMatch\n\tcase inside\n\tcase insideEndTouching\n\tcase endInside\n\tcase endTouching\n\tcase before\n\tcase none\n}\n\n/// Whether the time period is Open or Closed\n///\n/// - open: The boundary moment of time is included in calculations.\n/// - closed: The boundary moment of time represents a boundary value which is excluded in regard to calculations.\npublic enum IntervalType {\n\tcase open\n\tcase closed\n}\n\n/// When a time periods is lengthened or shortened, it does so anchoring one date\n/// of the time period and then changing the other one. There is also an option to\n/// anchor the centerpoint of the time period, changing both the start and end dates.\npublic enum TimePeriodAnchor {\n\tcase beginning\n\tcase center\n\tcase end\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/TimePeriod/TimePeriod.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Time periods are represented by the TimePeriodProtocol protocol.\n/// Required variables and method impleementations are bound below.\n/// An inheritable implementation of the TimePeriodProtocol is available through the TimePeriod class.\nopen class TimePeriod: TimePeriodProtocol {\n\n\t/// The start date for a TimePeriod representing the starting boundary of the time period\n\tpublic var start: DateInRegion?\n\n\t/// The end date for a TimePeriod representing the ending boundary of the time period\n\tpublic var end: DateInRegion?\n\n\t// MARK: - Initializers\n\n\tpublic init() { }\n\n\t/// Create a new time period with given date range.\n\t///\n\t/// - Parameters:\n\t///   - start: start date\n\t///   - end: end date\n\tpublic init(start: DateInRegion?, end: DateInRegion?) {\n\t\tself.start = start\n\t\tself.end = end\n\t}\n\n\t/// Create a new time period with given start and a length specified in number of seconds.\n\t///\n\t/// - Parameters:\n\t///   - start: start of the period\n\t///   - duration: duration of the period expressed in seconds\n\tpublic init(start: DateInRegion, duration: TimeInterval) {\n\t\tself.start = start\n\t\tself.end = DateInRegion(start.date.addingTimeInterval(duration), region: start.region)\n\t}\n\n\t/// Create a new time period which ends at given date and start date is back on time by given interval.\n\t///\n\t/// - Parameters:\n\t///   - end: end date\n\t///   - duration: duration expressed in seconds (it will be subtracted from start date)\n\tpublic init(end: DateInRegion, duration: TimeInterval) {\n\t\tself.end = end\n\t\tself.start = end.addingTimeInterval(-duration)\n\t}\n\n\t/// Return a new instance of the TimePeriod that starts on the provided start date and is of the\n\t/// size provided.\n\t///\n\t/// - Parameters:\n\t///   - start: start of the period\n\t///   - duration: length of the period (ie. `2.days` or `14.hours`...)\n\tpublic init(start: DateInRegion, duration: DateComponents) {\n\t\tself.start = start\n\t\tself.end = (start + duration)\n\t}\n\n\t/// Return a new instance of the TimePeriod that starts at end time minus given duration.\n\t///\n\t/// - Parameters:\n\t///   - end: end date\n\t///   - duration: duration (it will be subtracted from end date in order to provide the start date)\n\tpublic init(end: DateInRegion, duration: DateComponents) {\n\t\tself.start = (end - duration)\n\t\tself.end = end\n\t}\n\n\t/// Returns a new instance of DTTimePeriod that represents the largest time period available.\n\t/// The start date is in the distant past and the end date is in the distant future.\n\t///\n\t/// - Returns: a new time period\n\tpublic static func infinity() -> TimePeriod {\n\t\treturn TimePeriod(start: DateInRegion.past(), end: DateInRegion.future())\n\t}\n\n\t// MARK: - Shifted\n\n\t/// Shift the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameter timeInterval: The time interval to shift the period by\n\t/// - Returns: The new, shifted `TimePeriod`\n\tpublic func shifted(by timeInterval: TimeInterval) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\ttimePeriod.start = start?.addingTimeInterval(timeInterval)\n\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval)\n\t\treturn timePeriod\n\t}\n\n\t/// Shift the `TimePeriod` by the specified components value.\n\t/// ie. `let shifted = period.shifted(by: 3.days)`\n\t///\n\t/// - Parameter components: components to shift\n\t/// - Returns: new period\n\tpublic func shifted(by components: DateComponents) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\ttimePeriod.start = (hasStart ? (start! + components) : nil)\n\t\ttimePeriod.end = (hasEnd ? (end! + components) : nil)\n\t\treturn timePeriod\n\t}\n\n\t// MARK: - Lengthen / Shorten\n\n\t/// Lengthen the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameters:\n\t///   - timeInterval: The time interval to lengthen the period by\n\t///   - anchor: The anchor point from which to make the change\n\t/// - Returns: The new, lengthened `TimePeriod`\n\tpublic func lengthened(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\ttimePeriod.start = start\n\t\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval)\n\t\tcase .center:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(-timeInterval)\n\t\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval)\n\t\tcase .end:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(-timeInterval)\n\t\t\ttimePeriod.end = end\n\t\t}\n\t\treturn timePeriod\n\t}\n\n\t/// Shorten the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameters:\n\t///   - timeInterval:  The time interval to shorten the period by\n\t///   - anchor: The anchor point from which to make the change\n\t/// - Returns: The new, shortened `TimePeriod`\n\tpublic func shortened(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\ttimePeriod.start = start\n\t\t\ttimePeriod.end = end?.addingTimeInterval(-timeInterval)\n\t\tcase .center:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(-timeInterval / 2)\n\t\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval / 2)\n\t\tcase .end:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(timeInterval)\n\t\t\ttimePeriod.end = end\n\t\t}\n\t\treturn timePeriod\n\t}\n\n\t// MARK: - Operator Overloads\n\n\t/// Default anchor = beginning\n\t/// Operator overload for lengthening a `TimePeriod` by a `TimeInterval`\n\tpublic static func + (leftAddend: TimePeriod, rightAddend: TimeInterval) -> TimePeriod {\n\t\treturn leftAddend.lengthened(by: rightAddend, at: .beginning)\n\t}\n\n\t/// Default anchor = beginning\n\t/// Operator overload for shortening a `TimePeriod` by a `TimeInterval`\n\tpublic static func - (minuend: TimePeriod, subtrahend: TimeInterval) -> TimePeriod {\n\t\treturn minuend.shortened(by: subtrahend, at: .beginning)\n\t}\n\n\t/// Operator overload for checking if a `TimePeriod` is equal to a `TimePeriodProtocol`\n\tpublic static func == (left: TimePeriod, right: TimePeriodProtocol) -> Bool {\n\t\treturn left.equals(right)\n\t}\n\n}\n\npublic extension TimePeriod {\n\n    /// The start date of the time period\n    var startDate: Date? {\n        return start?.date\n    }\n\n    /// The end date of the time period\n    var endDate: Date? {\n        return end?.date\n    }\n\n    /// Create a new time period with the given start date, end date and region (default is UTC)\n    convenience init(startDate: Date, endDate: Date, region: Region = Region.UTC) {\n        let start = DateInRegion(startDate, region: region)\n        let end = DateInRegion(endDate, region: region)\n        self.init(start: start, end: end)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate/Sources/SwiftDate/TimePeriod/TimePeriodProtocol.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol TimePeriodProtocol {\n\n\t/// The start date for a TimePeriod representing the starting boundary of the time period\n\tvar start: DateInRegion? { get set }\n\n\t/// The end date for a TimePeriod representing the ending boundary of the time period\n\tvar end: DateInRegion? { get set }\n\n}\n\npublic extension TimePeriodProtocol {\n\n\t/// Return `true` if time period has both start and end dates\n\tvar hasFiniteRange: Bool {\n\t\tguard start != nil && end != nil else { return false }\n\t\treturn true\n\t}\n\n\t/// Return `true` if period has a start date\n\tvar hasStart: Bool {\n\t\treturn (start != nil)\n\t}\n\n\t/// Return `true` if period has a end date\n\tvar hasEnd: Bool {\n\t\treturn (end != nil)\n\t}\n\n\t/// Check if receiver is equal to given period (both start/end groups are equals)\n\t///\n\t/// - Parameter period: period to compare against to.\n\t/// - Returns: true if are equals\n\tfunc equals(_ period: TimePeriodProtocol) -> Bool {\n\t\treturn (start == period.start && end == period.end)\n\t}\n\n\t/// If the given `TimePeriod`'s beginning is before `beginning` and\n\t/// if the given 'TimePeriod`'s end is after `end`.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if self is inside of the given `TimePeriod`\n\tfunc isInside(_ period: TimePeriodProtocol) -> Bool {\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return false }\n\t\treturn (period.start! <= start! && period.end! >= end!)\n\t}\n\n\t/// If the given Date is after `beginning` and before `end`.\n\t///\n\t/// - Parameters:\n\t///   - date: The time period to compare to self\n\t///   - interval: Whether the edge of the date is included in the calculation\n\t/// - Returns: True if the given `TimePeriod` is inside of self\n\tfunc contains(date: DateInRegion, interval: IntervalType = .closed) -> Bool {\n\t\tguard hasFiniteRange else { return false }\n\t\tswitch interval {\n\t\tcase .closed:\treturn (start! <= date && end! >= date)\n\t\tcase .open:\t\treturn (start! < date && end! > date)\n\t\t}\n\t}\n\n\t/// If the given `TimePeriod`'s beginning is after `beginning` and\n\t/// if the given 'TimePeriod`'s after is after `end`.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if the given `TimePeriod` is inside of self\n\tfunc contains(_ period: TimePeriodProtocol) -> Bool {\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return false }\n\t\tif period.start! < start! && period.end! > start! {\n\t\t\treturn true // Outside -> Inside\n\t\t} else if period.start! >= start! && period.end! <= end! {\n\t\t\treturn true // Enclosing\n\t\t} else if period.start! < end! && period.end! > end! {\n\t\t\treturn true // Inside -> Out\n\t\t}\n\t\treturn false\n\t}\n\n\t/// If self and the given `TimePeriod` share any sub-`TimePeriod`.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if there is a period of time that is shared by both `TimePeriod`s\n\tfunc overlaps(with period: TimePeriodProtocol) -> Bool {\n\t\tif period.start! < start! && period.end! > start! {\n\t\t\treturn true // Outside -> Inside\n\t\t} else if period.start! >= start! && period.end! <= end! {\n\t\t\treturn true // Enclosing\n\t\t} else if period.start! < end! && period.end! > end! {\n\t\t\treturn true // Inside -> Out\n\t\t}\n\t\treturn false\n\t}\n\n\t/// If self and the given `TimePeriod` overlap or the period's edges touch.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if there is a period of time or moment that is shared by both `TimePeriod`s\n\tfunc intersects(with period: TimePeriodProtocol) -> Bool {\n\t\tlet relation = self.relation(to: period)\n\t\treturn (relation != .after && relation != .before)\n\t}\n\n\t/// If self is before the given `TimePeriod` chronologically. (A gap must exist between the two).\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if self is after the given `TimePeriod`\n\tfunc isBefore(_ period: TimePeriodProtocol) -> Bool {\n\t\treturn (relation(to: period) == .before)\n\t}\n\n\t/// If self is after the given `TimePeriod` chronologically. (A gap must exist between the two).\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if self is after the given `TimePeriod`\n\tfunc isAfter(_ period: TimePeriodProtocol) -> Bool {\n\t\treturn (relation(to: period) == .after)\n\t}\n\n\t/// The period of time between self and the given `TimePeriod` not contained by either.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: The gap between the periods. Zero if there is no gap.\n\tfunc hasGap(between period: TimePeriodProtocol) -> Bool {\n\t\treturn (isBefore(period) || isAfter(period))\n\t}\n\n\t/// The period of time between self and the given `TimePeriod` not contained by either.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: The gap between the periods. Zero if there is no gap.\n\tfunc gap(between period: TimePeriodProtocol) -> TimeInterval {\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return TimeInterval.greatestFiniteMagnitude }\n\t\tif end! < period.start! {\n\t\t\treturn abs(end!.timeIntervalSince(period.start!))\n\t\t} else if period.end! < start! {\n\t\t\treturn abs(end!.timeIntervalSince(start!))\n\t\t}\n\t\treturn 0\n\t}\n\n\t/// In place, shift the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameter timeInterval: The time interval to shift the period by\n\tmutating func shift(by timeInterval: TimeInterval) {\n\t\tstart?.addTimeInterval(timeInterval)\n\t\tend?.addTimeInterval(timeInterval)\n\t}\n\n\t/// In place, lengthen the `TimePeriod`, anchored at the beginning, end or center\n\t///\n\t/// - Parameters:\n\t///   - timeInterval: The time interval to lengthen the period by\n\t///   - anchor: The anchor point from which to make the change\n\tmutating func lengthen(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) {\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\tend?.addTimeInterval(timeInterval)\n\t\tcase .end:\n\t\t\tstart?.addTimeInterval(timeInterval)\n\t\tcase .center:\n\t\t\tstart = start?.addingTimeInterval(-timeInterval / 2.0)\n\t\t\tend = end?.addingTimeInterval(timeInterval / 2.0)\n\t\t}\n\t}\n\n\t/// In place, shorten the `TimePeriod`, anchored at the beginning, end or center\n\t///\n\t/// - Parameters:\n\t///   - timeInterval: The time interval to shorten the period by\n\t///   - anchor: The anchor point from which to make the change\n\tmutating func shorten(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) {\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\tend?.addTimeInterval(-timeInterval)\n\t\tcase .end:\n\t\t\tstart?.addTimeInterval(timeInterval)\n\t\tcase .center:\n\t\t\tstart?.addTimeInterval(timeInterval / 2.0)\n\t\t\tend?.addTimeInterval(-timeInterval / 2.0)\n\t\t}\n\t}\n\n\t/// The relationship of the self `TimePeriod` to the given `TimePeriod`.\n\t/// Relations are stored in Enums.swift. Formal defnitions available in the provided\n\t/// links:\n\t/// [GitHub](https://github.com/MatthewYork/DateTools#relationships),\n\t/// [CodeProject](http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET)\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: The relationship between self and the given time period\n\tfunc relation(to period: TimePeriodProtocol) -> TimePeriodRelation {\n\t\t//Make sure that all start and end points exist for comparison\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return .none }\n\t\t//Make sure time periods are of positive durations\n\t\tguard start! < end! && period.start! < period.end! else { return .none }\n\t\t//Make comparisons\n\t\tif period.start! < start! {\n\t\t\treturn .after\n\t\t} else if period.end! == start! {\n\t\t\treturn .startTouching\n\t\t} else if period.start! < start! && period.end! < end! {\n\t\t\treturn .startInside\n\t\t} else if period.start! == start! && period.end! > end! {\n\t\t\treturn .insideStartTouching\n\t\t} else if period.start! == start! && period.end! < end! {\n\t\t\treturn .enclosingStartTouching\n\t\t} else if period.start! > start! && period.end! < end! {\n\t\t\treturn .enclosing\n\t\t} else if period.start! > start! && period.end! == end! {\n\t\t\treturn .enclosingEndTouching\n\t\t} else if period.start == start! && period.end! == end! {\n\t\t\treturn .exactMatch\n\t\t} else if period.start! < start! && period.end! > end! {\n\t\t\treturn .inside\n\t\t} else if period.start! < start! && period.end! == end! {\n\t\t\treturn .insideEndTouching\n\t\t} else if period.start! < end! && period.end! > end! {\n\t\t\treturn .endInside\n\t\t} else if period.start! == end! && period.end! > end! {\n\t\t\treturn .endTouching\n\t\t} else if period.start! > end! {\n\t\t\treturn .before\n\t\t}\n\t\treturn .none\n\t}\n\n\t/// Return `true` if period is zero-seconds long or less than specified precision.\n\t///\n\t/// - Parameter precision: precision in seconds; by default is 0.\n\t/// - Returns: true if start/end has the same value or less than specified precision\n\tfunc isMoment(precision: TimeInterval = 0) -> Bool {\n\t\tguard hasFiniteRange else { return false }\n\t\treturn (abs(start!.date.timeIntervalSince1970 - end!.date.timeIntervalSince1970) <= precision)\n\t}\n\n\t/// Returns the duration of the receiver expressed with given time unit.\n\t/// If time period has not a finite range it returns `nil`.\n\t///\n\t/// - Parameter unit: unit of the duration\n\t/// - Returns: duration, `nil` if period has not a finite range\n\tfunc durationIn(_ units: Set<Calendar.Component>) -> DateComponents? {\n\t\tguard hasFiniteRange else { return nil }\n\t\treturn start!.calendar.dateComponents(units, from: start!.date, to: end!.date)\n\t}\n\n\t/// Returns the duration of the receiver expressed with given time unit.\n\t/// If time period has not a finite range it returns `nil`.\n\t///\n\t/// - Parameter unit: unit of the duration\n\t/// - Returns: duration, `nil` if period has not a finite range\n\tfunc durationIn(_ unit: Calendar.Component) -> Int? {\n\t\tguard hasFiniteRange else { return nil }\n\t\treturn start!.calendar.dateComponents([unit], from: start!.date, to: end!.date).value(for: unit)\n\t}\n\n\t/// The duration of the `TimePeriod` in years.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar years: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.year, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in months.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar months: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.month, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in weeks.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar weeks: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.weekOfMonth, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in days.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar days: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.day, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in hours.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar hours: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.hour, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in years.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar minutes: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.minute, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in seconds.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar seconds: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.second, to: e)\n\t}\n\n\t/// The length of time between the beginning and end dates of the\n\t/// `TimePeriod` as a `TimeInterval`.\n\t/// If intervals are not nil returns `Double.greatestFiniteMagnitude`\n\tvar duration: TimeInterval {\n\t\tguard let b = start, let e = end else {\n\t\t\treturn TimeInterval(Double.greatestFiniteMagnitude)\n\t\t}\n\t\treturn abs(b.date.timeIntervalSince(e.date))\n\t}\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftDate.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t04552A46A2EAF300E1558D2EC781BD5B /* Date+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F738171711D7EAF45933D58EFA7602E /* Date+Create.swift */; };\n\t\t05BA96FFDB05D91220B538227903B9A3 /* DateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0776E215812B5AB4EF314CEF6412D6C /* DateInRegion+Components.swift */; };\n\t\t0ECA88B7835E763945CE5023DE69C279 /* Commons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 389412B33EEC0DACE7C19FC2F5C82E7A /* Commons.swift */; };\n\t\t12220D1956CA542F89B10C2443E9F39D /* RelativeFormatterLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 933C513E0079ECB7F1814342C225D414 /* RelativeFormatterLanguage.swift */; };\n\t\t15F90B229B1E027627CB909E53B65B73 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067B6B38C481B84878ED1F4B55622A97 /* Date.swift */; };\n\t\t168504799F4BCD8370737D181DAF8032 /* ISOParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC96EA10AC3AF0D429824295F66D63C9 /* ISOParser.swift */; };\n\t\t1A45DEA218A73D86E8F9CA569FE40EB8 /* TimePeriodGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 490F9B3F226903EB3A4F544A7F81D542 /* TimePeriodGroup.swift */; };\n\t\t3F8BF48F896133C02C333773628EACE9 /* Formatter+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = D89E210A45A8198C3306020C4638ED32 /* Formatter+Protocols.swift */; };\n\t\t4972927CC66129318F18E08F8325D116 /* Calendars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 459978B46F06AF08EC1DAFB56AFF33B0 /* Calendars.swift */; };\n\t\t5289DB57E05BCB7B77D80ABEC73698A6 /* String+Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33E13985D1554E001E4AAFF2F2B1CBB6 /* String+Parser.swift */; };\n\t\t56A26D70821D5CF4B4438FF5278D4B2D /* TimeStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13713A4B408A1B272DABD217B4089190 /* TimeStructures.swift */; };\n\t\t58007C320B03FCEEB38136CC7568E0B0 /* TimePeriodCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5702AF7511B996F2558CDF416E1C83DF /* TimePeriodCollection.swift */; };\n\t\t5B6935326CF472D5B927E2B0C1E971E4 /* Int+DateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A6C5169843FAF6766C8DA20368007D5 /* Int+DateComponents.swift */; };\n\t\t5D8FC7D4AB0CCAAD3FCC913ED8404050 /* Locales.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8E2DFBDE9B5B725361F6DDC5A0215E9 /* Locales.swift */; };\n\t\t5D90902DB184D55790ADBA1C5A7021EC /* SwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 839ACD973C6D2ED0D3E11CDB004855FB /* SwiftDate.swift */; };\n\t\t6B0433A7C5E01E7C13ABD93162673104 /* Zones.swift in Sources */ = {isa = PBXBuildFile; fileRef = E663B964AE1572B99CD544809502F015 /* Zones.swift */; };\n\t\t71036D3BF6777369448489D82EF199EC /* DateRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 318606DD0ADB11BEF455A663278B7CA6 /* DateRepresentable.swift */; };\n\t\t753209268C1F812663C41FD4CBFB79F1 /* TimeInterval+Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69483CFAA4FEBE1B0B0C2E137BE0FBF0 /* TimeInterval+Formatter.swift */; };\n\t\t7EBA76AF7E6B978D7EA43CA567AF1868 /* AssociatedValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCFE8AA0417C90F4387F08906675C26F /* AssociatedValues.swift */; };\n\t\t86E262757817B74C4C251E33846C7CFE /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7CA1C0EAB90E4B0546CD79258DEFFB5 /* TimePeriod.swift */; };\n\t\t8D354F09B131C8C3C8B776330DE2CB19 /* TimePeriod+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02FCDC30E9CCE3E0AC943C8F2F17322F /* TimePeriod+Support.swift */; };\n\t\t8F9154B18951A7AFA87DBEDD4E624922 /* RelativeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E39D3C4C5AF2F511D054C64B3B7020 /* RelativeFormatter.swift */; };\n\t\t931121076824D49A5D2B409962CD44BE /* DateComponents+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E61FBCFF2761B35BF2CBD3E95BCFEC0 /* DateComponents+Extras.swift */; };\n\t\t939A97DE9222EE9523C90047A0BE2F25 /* DateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF51A90634CF2808B3C8C003B26CF7EC /* DateInRegion.swift */; };\n\t\t93F5F672D257BDE00AAD29E63945540B /* SwiftDate-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = FD4D37E580C7423C7FD961F092E80A97 /* SwiftDate-dummy.m */; };\n\t\tB1371B879AF9ECA4058D3F63E0FB39AC /* SwiftDate-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A7000BDFFB98B1843DDF8178B0C46F0 /* SwiftDate-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB18C0607F5CF235C03C289EDBFC43C5C /* DateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AB30ADF5006FE0403DF11074D7F9BE2 /* DateInRegion+Math.swift */; };\n\t\tB87AABDFBF96ED433C51598106016B90 /* RelativeFormatter+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEFC0714D030ECA21A1D179A7FD57380 /* RelativeFormatter+Style.swift */; };\n\t\tB8F48E769FA72A0E51FD17597298A66F /* Region.swift in Sources */ = {isa = PBXBuildFile; fileRef = 510A0B712B4890CE97B741E1626EBAD2 /* Region.swift */; };\n\t\tB974C58A2ED8BA1703228DE4148B723A /* DateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2149B74912D9CB72A5B019C195F9DE07 /* DateInRegion+Compare.swift */; };\n\t\tBBE1D8F08CDC3977B1E4CDA1EA9A045C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F3F6D99819CC9B998199F7FF5DA3622 /* Foundation.framework */; };\n\t\tBC0181DA80F82B7ADC9D16BE1969E492 /* ISOFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FE9E2209E8BB7BEA9DAC079969A6F8 /* ISOFormatter.swift */; };\n\t\tBF5312B8372DF3DE5DACD24C3460AE38 /* TimePeriodProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A47470B7A82F13EB0AD4CB1B88920032 /* TimePeriodProtocol.swift */; };\n\t\tCA1DA6DB443E04EA5E1DD432379EDDC7 /* Date+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0072C05B0F9CFE5718ACB921F69B19E /* Date+Components.swift */; };\n\t\tCB6BAC34B10ADC7AD30F7E84AB9D2BA4 /* TimePeriodChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E22A87CA84A38BEF8BEE8DBF62D707 /* TimePeriodChain.swift */; };\n\t\tE09103B837EA3F56F961FC8DB8EA17B4 /* Date+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E196D552C0917E27D5ACBB15CE08748 /* Date+Compare.swift */; };\n\t\tF2A624D0506CD7DFB44835D9632659B3 /* DateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 737F67BE147AEA41FFDC41DCEB97A6AE /* DateInRegion+Create.swift */; };\n\t\tF4A81244ABA5CD808403878984AE0532 /* DotNetParserFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F064054D3B568D74820327A37B559AE5 /* DotNetParserFormatter.swift */; };\n\t\tF4DC15248ECB8E6D8C4674537F908C5A /* Date+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A8FBEBF84FB6046308071909D982CF6 /* Date+Math.swift */; };\n\t\tF55BAC777A58A22DE49A7E35C98E4671 /* langs in Resources */ = {isa = PBXBuildFile; fileRef = 05458FAA8CE784D25494CA640FD046A7 /* langs */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t01E22A87CA84A38BEF8BEE8DBF62D707 /* TimePeriodChain.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimePeriodChain.swift; path = Sources/SwiftDate/TimePeriod/Groups/TimePeriodChain.swift; sourceTree = \"<group>\"; };\n\t\t02FCDC30E9CCE3E0AC943C8F2F17322F /* TimePeriod+Support.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"TimePeriod+Support.swift\"; path = \"Sources/SwiftDate/TimePeriod/TimePeriod+Support.swift\"; sourceTree = \"<group>\"; };\n\t\t05458FAA8CE784D25494CA640FD046A7 /* langs */ = {isa = PBXFileReference; includeInIndex = 1; name = langs; path = Sources/SwiftDate/Formatters/RelativeFormatter/langs; sourceTree = \"<group>\"; };\n\t\t067B6B38C481B84878ED1F4B55622A97 /* Date.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Date.swift; path = Sources/SwiftDate/Date/Date.swift; sourceTree = \"<group>\"; };\n\t\t0A8FBEBF84FB6046308071909D982CF6 /* Date+Math.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Date+Math.swift\"; path = \"Sources/SwiftDate/Date/Date+Math.swift\"; sourceTree = \"<group>\"; };\n\t\t13713A4B408A1B272DABD217B4089190 /* TimeStructures.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimeStructures.swift; path = Sources/SwiftDate/Supports/TimeStructures.swift; sourceTree = \"<group>\"; };\n\t\t1A6C5169843FAF6766C8DA20368007D5 /* Int+DateComponents.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Int+DateComponents.swift\"; path = \"Sources/SwiftDate/Foundation+Extras/Int+DateComponents.swift\"; sourceTree = \"<group>\"; };\n\t\t2149B74912D9CB72A5B019C195F9DE07 /* DateInRegion+Compare.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DateInRegion+Compare.swift\"; path = \"Sources/SwiftDate/DateInRegion/DateInRegion+Compare.swift\"; sourceTree = \"<group>\"; };\n\t\t2E196D552C0917E27D5ACBB15CE08748 /* Date+Compare.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Date+Compare.swift\"; path = \"Sources/SwiftDate/Date/Date+Compare.swift\"; sourceTree = \"<group>\"; };\n\t\t318606DD0ADB11BEF455A663278B7CA6 /* DateRepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DateRepresentable.swift; path = Sources/SwiftDate/DateRepresentable.swift; sourceTree = \"<group>\"; };\n\t\t33E13985D1554E001E4AAFF2F2B1CBB6 /* String+Parser.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"String+Parser.swift\"; path = \"Sources/SwiftDate/Foundation+Extras/String+Parser.swift\"; sourceTree = \"<group>\"; };\n\t\t34E39D3C4C5AF2F511D054C64B3B7020 /* RelativeFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RelativeFormatter.swift; path = Sources/SwiftDate/Formatters/RelativeFormatter/RelativeFormatter.swift; sourceTree = \"<group>\"; };\n\t\t37FE9E2209E8BB7BEA9DAC079969A6F8 /* ISOFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ISOFormatter.swift; path = Sources/SwiftDate/Formatters/ISOFormatter.swift; sourceTree = \"<group>\"; };\n\t\t389412B33EEC0DACE7C19FC2F5C82E7A /* Commons.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Commons.swift; path = Sources/SwiftDate/Supports/Commons.swift; sourceTree = \"<group>\"; };\n\t\t3A7000BDFFB98B1843DDF8178B0C46F0 /* SwiftDate-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SwiftDate-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t459978B46F06AF08EC1DAFB56AFF33B0 /* Calendars.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Calendars.swift; path = Sources/SwiftDate/Supports/Calendars.swift; sourceTree = \"<group>\"; };\n\t\t490F9B3F226903EB3A4F544A7F81D542 /* TimePeriodGroup.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimePeriodGroup.swift; path = Sources/SwiftDate/TimePeriod/Groups/TimePeriodGroup.swift; sourceTree = \"<group>\"; };\n\t\t4F3F6D99819CC9B998199F7FF5DA3622 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t4F738171711D7EAF45933D58EFA7602E /* Date+Create.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Date+Create.swift\"; path = \"Sources/SwiftDate/Date/Date+Create.swift\"; sourceTree = \"<group>\"; };\n\t\t510A0B712B4890CE97B741E1626EBAD2 /* Region.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Region.swift; path = Sources/SwiftDate/DateInRegion/Region.swift; sourceTree = \"<group>\"; };\n\t\t5702AF7511B996F2558CDF416E1C83DF /* TimePeriodCollection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimePeriodCollection.swift; path = Sources/SwiftDate/TimePeriod/Groups/TimePeriodCollection.swift; sourceTree = \"<group>\"; };\n\t\t69483CFAA4FEBE1B0B0C2E137BE0FBF0 /* TimeInterval+Formatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"TimeInterval+Formatter.swift\"; path = \"Sources/SwiftDate/Foundation+Extras/TimeInterval+Formatter.swift\"; sourceTree = \"<group>\"; };\n\t\t737F67BE147AEA41FFDC41DCEB97A6AE /* DateInRegion+Create.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DateInRegion+Create.swift\"; path = \"Sources/SwiftDate/DateInRegion/DateInRegion+Create.swift\"; sourceTree = \"<group>\"; };\n\t\t839ACD973C6D2ED0D3E11CDB004855FB /* SwiftDate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftDate.swift; path = Sources/SwiftDate/SwiftDate.swift; sourceTree = \"<group>\"; };\n\t\t8AB30ADF5006FE0403DF11074D7F9BE2 /* DateInRegion+Math.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DateInRegion+Math.swift\"; path = \"Sources/SwiftDate/DateInRegion/DateInRegion+Math.swift\"; sourceTree = \"<group>\"; };\n\t\t8C78A73FBF001C1DB0597972B6AFA08A /* SwiftDate */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SwiftDate; path = SwiftDate.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t8E61FBCFF2761B35BF2CBD3E95BCFEC0 /* DateComponents+Extras.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DateComponents+Extras.swift\"; path = \"Sources/SwiftDate/Foundation+Extras/DateComponents+Extras.swift\"; sourceTree = \"<group>\"; };\n\t\t933C513E0079ECB7F1814342C225D414 /* RelativeFormatterLanguage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RelativeFormatterLanguage.swift; path = Sources/SwiftDate/Formatters/RelativeFormatter/RelativeFormatterLanguage.swift; sourceTree = \"<group>\"; };\n\t\tA0072C05B0F9CFE5718ACB921F69B19E /* Date+Components.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Date+Components.swift\"; path = \"Sources/SwiftDate/Date/Date+Components.swift\"; sourceTree = \"<group>\"; };\n\t\tA47470B7A82F13EB0AD4CB1B88920032 /* TimePeriodProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimePeriodProtocol.swift; path = Sources/SwiftDate/TimePeriod/TimePeriodProtocol.swift; sourceTree = \"<group>\"; };\n\t\tAF51A90634CF2808B3C8C003B26CF7EC /* DateInRegion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DateInRegion.swift; path = Sources/SwiftDate/DateInRegion/DateInRegion.swift; sourceTree = \"<group>\"; };\n\t\tBC612998A52258F8860AD578CB896175 /* SwiftDate.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftDate.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tBC96EA10AC3AF0D429824295F66D63C9 /* ISOParser.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ISOParser.swift; path = Sources/SwiftDate/Formatters/ISOParser.swift; sourceTree = \"<group>\"; };\n\t\tD89E210A45A8198C3306020C4638ED32 /* Formatter+Protocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"Formatter+Protocols.swift\"; path = \"Sources/SwiftDate/Formatters/Formatter+Protocols.swift\"; sourceTree = \"<group>\"; };\n\t\tE663B964AE1572B99CD544809502F015 /* Zones.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Zones.swift; path = Sources/SwiftDate/Supports/Zones.swift; sourceTree = \"<group>\"; };\n\t\tE7CA1C0EAB90E4B0546CD79258DEFFB5 /* TimePeriod.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimePeriod.swift; path = Sources/SwiftDate/TimePeriod/TimePeriod.swift; sourceTree = \"<group>\"; };\n\t\tE8E2DFBDE9B5B725361F6DDC5A0215E9 /* Locales.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Locales.swift; path = Sources/SwiftDate/Supports/Locales.swift; sourceTree = \"<group>\"; };\n\t\tEF2BE2D9A938E81666997F4EBE28ACF9 /* SwiftDate.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftDate.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tF064054D3B568D74820327A37B559AE5 /* DotNetParserFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DotNetParserFormatter.swift; path = Sources/SwiftDate/Formatters/DotNetParserFormatter.swift; sourceTree = \"<group>\"; };\n\t\tF0776E215812B5AB4EF314CEF6412D6C /* DateInRegion+Components.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"DateInRegion+Components.swift\"; path = \"Sources/SwiftDate/DateInRegion/DateInRegion+Components.swift\"; sourceTree = \"<group>\"; };\n\t\tF9DA70A200BB729ED227CDAF47503332 /* SwiftDate.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SwiftDate.modulemap; sourceTree = \"<group>\"; };\n\t\tFC0B231A234912D8FC315794C96E732E /* SwiftDate-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SwiftDate-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tFCFE8AA0417C90F4387F08906675C26F /* AssociatedValues.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssociatedValues.swift; path = Sources/SwiftDate/Supports/AssociatedValues.swift; sourceTree = \"<group>\"; };\n\t\tFD1FA3AA21A65751C1688D7365D035A7 /* SwiftDate-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"SwiftDate-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tFD4D37E580C7423C7FD961F092E80A97 /* SwiftDate-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"SwiftDate-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tFEFC0714D030ECA21A1D179A7FD57380 /* RelativeFormatter+Style.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"RelativeFormatter+Style.swift\"; path = \"Sources/SwiftDate/Formatters/RelativeFormatter/RelativeFormatter+Style.swift\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t8F23964745A52FACFA5E44BC11F2CB98 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tBBE1D8F08CDC3977B1E4CDA1EA9A045C /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t024622CA23AB169F00B75A12702AABDB /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7CD3D58F318C7A35FD9D6F89210FD33D /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t27CE58AC37A619DA0642D3DC61E9F2B8 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF9DA70A200BB729ED227CDAF47503332 /* SwiftDate.modulemap */,\n\t\t\t\tFD4D37E580C7423C7FD961F092E80A97 /* SwiftDate-dummy.m */,\n\t\t\t\tFD1FA3AA21A65751C1688D7365D035A7 /* SwiftDate-Info.plist */,\n\t\t\t\tFC0B231A234912D8FC315794C96E732E /* SwiftDate-prefix.pch */,\n\t\t\t\t3A7000BDFFB98B1843DDF8178B0C46F0 /* SwiftDate-umbrella.h */,\n\t\t\t\tEF2BE2D9A938E81666997F4EBE28ACF9 /* SwiftDate.debug.xcconfig */,\n\t\t\t\tBC612998A52258F8860AD578CB896175 /* SwiftDate.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/SwiftDate\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2D4AFD73869343784F84A95EB0A8224D /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t05458FAA8CE784D25494CA640FD046A7 /* langs */,\n\t\t\t);\n\t\t\tname = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4543671139C9E474DFF10DD697BCCB0E = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t024622CA23AB169F00B75A12702AABDB /* Frameworks */,\n\t\t\t\tD75EAE3C496CD0C2E6CC2A677B3AF3C0 /* Products */,\n\t\t\t\t6C3B725EEC4F76EFEC95FF16F3833C1B /* SwiftDate */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6C3B725EEC4F76EFEC95FF16F3833C1B /* SwiftDate */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tFCFE8AA0417C90F4387F08906675C26F /* AssociatedValues.swift */,\n\t\t\t\t459978B46F06AF08EC1DAFB56AFF33B0 /* Calendars.swift */,\n\t\t\t\t389412B33EEC0DACE7C19FC2F5C82E7A /* Commons.swift */,\n\t\t\t\t067B6B38C481B84878ED1F4B55622A97 /* Date.swift */,\n\t\t\t\t2E196D552C0917E27D5ACBB15CE08748 /* Date+Compare.swift */,\n\t\t\t\tA0072C05B0F9CFE5718ACB921F69B19E /* Date+Components.swift */,\n\t\t\t\t4F738171711D7EAF45933D58EFA7602E /* Date+Create.swift */,\n\t\t\t\t0A8FBEBF84FB6046308071909D982CF6 /* Date+Math.swift */,\n\t\t\t\t8E61FBCFF2761B35BF2CBD3E95BCFEC0 /* DateComponents+Extras.swift */,\n\t\t\t\tAF51A90634CF2808B3C8C003B26CF7EC /* DateInRegion.swift */,\n\t\t\t\t2149B74912D9CB72A5B019C195F9DE07 /* DateInRegion+Compare.swift */,\n\t\t\t\tF0776E215812B5AB4EF314CEF6412D6C /* DateInRegion+Components.swift */,\n\t\t\t\t737F67BE147AEA41FFDC41DCEB97A6AE /* DateInRegion+Create.swift */,\n\t\t\t\t8AB30ADF5006FE0403DF11074D7F9BE2 /* DateInRegion+Math.swift */,\n\t\t\t\t318606DD0ADB11BEF455A663278B7CA6 /* DateRepresentable.swift */,\n\t\t\t\tF064054D3B568D74820327A37B559AE5 /* DotNetParserFormatter.swift */,\n\t\t\t\tD89E210A45A8198C3306020C4638ED32 /* Formatter+Protocols.swift */,\n\t\t\t\t1A6C5169843FAF6766C8DA20368007D5 /* Int+DateComponents.swift */,\n\t\t\t\t37FE9E2209E8BB7BEA9DAC079969A6F8 /* ISOFormatter.swift */,\n\t\t\t\tBC96EA10AC3AF0D429824295F66D63C9 /* ISOParser.swift */,\n\t\t\t\tE8E2DFBDE9B5B725361F6DDC5A0215E9 /* Locales.swift */,\n\t\t\t\t510A0B712B4890CE97B741E1626EBAD2 /* Region.swift */,\n\t\t\t\t34E39D3C4C5AF2F511D054C64B3B7020 /* RelativeFormatter.swift */,\n\t\t\t\tFEFC0714D030ECA21A1D179A7FD57380 /* RelativeFormatter+Style.swift */,\n\t\t\t\t933C513E0079ECB7F1814342C225D414 /* RelativeFormatterLanguage.swift */,\n\t\t\t\t33E13985D1554E001E4AAFF2F2B1CBB6 /* String+Parser.swift */,\n\t\t\t\t839ACD973C6D2ED0D3E11CDB004855FB /* SwiftDate.swift */,\n\t\t\t\t69483CFAA4FEBE1B0B0C2E137BE0FBF0 /* TimeInterval+Formatter.swift */,\n\t\t\t\tE7CA1C0EAB90E4B0546CD79258DEFFB5 /* TimePeriod.swift */,\n\t\t\t\t02FCDC30E9CCE3E0AC943C8F2F17322F /* TimePeriod+Support.swift */,\n\t\t\t\t01E22A87CA84A38BEF8BEE8DBF62D707 /* TimePeriodChain.swift */,\n\t\t\t\t5702AF7511B996F2558CDF416E1C83DF /* TimePeriodCollection.swift */,\n\t\t\t\t490F9B3F226903EB3A4F544A7F81D542 /* TimePeriodGroup.swift */,\n\t\t\t\tA47470B7A82F13EB0AD4CB1B88920032 /* TimePeriodProtocol.swift */,\n\t\t\t\t13713A4B408A1B272DABD217B4089190 /* TimeStructures.swift */,\n\t\t\t\tE663B964AE1572B99CD544809502F015 /* Zones.swift */,\n\t\t\t\t2D4AFD73869343784F84A95EB0A8224D /* Resources */,\n\t\t\t\t27CE58AC37A619DA0642D3DC61E9F2B8 /* Support Files */,\n\t\t\t);\n\t\t\tname = SwiftDate;\n\t\t\tpath = SwiftDate;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7CD3D58F318C7A35FD9D6F89210FD33D /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4F3F6D99819CC9B998199F7FF5DA3622 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD75EAE3C496CD0C2E6CC2A677B3AF3C0 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8C78A73FBF001C1DB0597972B6AFA08A /* SwiftDate */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t9C0316CF843F144B00C7D92331504B6D /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB1371B879AF9ECA4058D3F63E0FB39AC /* SwiftDate-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t084C1733B4DEB4359B4EFB893E424972 /* SwiftDate */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 709D18045AD8211DFD3558F0727445CC /* Build configuration list for PBXNativeTarget \"SwiftDate\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t9C0316CF843F144B00C7D92331504B6D /* Headers */,\n\t\t\t\tC62F481C44A3D96821D331A353B337F1 /* Sources */,\n\t\t\t\t8F23964745A52FACFA5E44BC11F2CB98 /* Frameworks */,\n\t\t\t\tFA41934FCA58DEFF6700ADD2A41BDE2F /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = SwiftDate;\n\t\t\tproductName = SwiftDate;\n\t\t\tproductReference = 8C78A73FBF001C1DB0597972B6AFA08A /* SwiftDate */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tC9D01DC6E20F002C529A63228712762F /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = EA52B03FAF35CA1FAB3674849233060A /* Build configuration list for PBXProject \"SwiftDate\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 4543671139C9E474DFF10DD697BCCB0E;\n\t\t\tproductRefGroup = D75EAE3C496CD0C2E6CC2A677B3AF3C0 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t084C1733B4DEB4359B4EFB893E424972 /* SwiftDate */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tFA41934FCA58DEFF6700ADD2A41BDE2F /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tF55BAC777A58A22DE49A7E35C98E4671 /* langs in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tC62F481C44A3D96821D331A353B337F1 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t7EBA76AF7E6B978D7EA43CA567AF1868 /* AssociatedValues.swift in Sources */,\n\t\t\t\t4972927CC66129318F18E08F8325D116 /* Calendars.swift in Sources */,\n\t\t\t\t0ECA88B7835E763945CE5023DE69C279 /* Commons.swift in Sources */,\n\t\t\t\t15F90B229B1E027627CB909E53B65B73 /* Date.swift in Sources */,\n\t\t\t\tE09103B837EA3F56F961FC8DB8EA17B4 /* Date+Compare.swift in Sources */,\n\t\t\t\tCA1DA6DB443E04EA5E1DD432379EDDC7 /* Date+Components.swift in Sources */,\n\t\t\t\t04552A46A2EAF300E1558D2EC781BD5B /* Date+Create.swift in Sources */,\n\t\t\t\tF4DC15248ECB8E6D8C4674537F908C5A /* Date+Math.swift in Sources */,\n\t\t\t\t931121076824D49A5D2B409962CD44BE /* DateComponents+Extras.swift in Sources */,\n\t\t\t\t939A97DE9222EE9523C90047A0BE2F25 /* DateInRegion.swift in Sources */,\n\t\t\t\tB974C58A2ED8BA1703228DE4148B723A /* DateInRegion+Compare.swift in Sources */,\n\t\t\t\t05BA96FFDB05D91220B538227903B9A3 /* DateInRegion+Components.swift in Sources */,\n\t\t\t\tF2A624D0506CD7DFB44835D9632659B3 /* DateInRegion+Create.swift in Sources */,\n\t\t\t\tB18C0607F5CF235C03C289EDBFC43C5C /* DateInRegion+Math.swift in Sources */,\n\t\t\t\t71036D3BF6777369448489D82EF199EC /* DateRepresentable.swift in Sources */,\n\t\t\t\tF4A81244ABA5CD808403878984AE0532 /* DotNetParserFormatter.swift in Sources */,\n\t\t\t\t3F8BF48F896133C02C333773628EACE9 /* Formatter+Protocols.swift in Sources */,\n\t\t\t\t5B6935326CF472D5B927E2B0C1E971E4 /* Int+DateComponents.swift in Sources */,\n\t\t\t\tBC0181DA80F82B7ADC9D16BE1969E492 /* ISOFormatter.swift in Sources */,\n\t\t\t\t168504799F4BCD8370737D181DAF8032 /* ISOParser.swift in Sources */,\n\t\t\t\t5D8FC7D4AB0CCAAD3FCC913ED8404050 /* Locales.swift in Sources */,\n\t\t\t\tB8F48E769FA72A0E51FD17597298A66F /* Region.swift in Sources */,\n\t\t\t\t8F9154B18951A7AFA87DBEDD4E624922 /* RelativeFormatter.swift in Sources */,\n\t\t\t\tB87AABDFBF96ED433C51598106016B90 /* RelativeFormatter+Style.swift in Sources */,\n\t\t\t\t12220D1956CA542F89B10C2443E9F39D /* RelativeFormatterLanguage.swift in Sources */,\n\t\t\t\t5289DB57E05BCB7B77D80ABEC73698A6 /* String+Parser.swift in Sources */,\n\t\t\t\t5D90902DB184D55790ADBA1C5A7021EC /* SwiftDate.swift in Sources */,\n\t\t\t\t93F5F672D257BDE00AAD29E63945540B /* SwiftDate-dummy.m in Sources */,\n\t\t\t\t753209268C1F812663C41FD4CBFB79F1 /* TimeInterval+Formatter.swift in Sources */,\n\t\t\t\t86E262757817B74C4C251E33846C7CFE /* TimePeriod.swift in Sources */,\n\t\t\t\t8D354F09B131C8C3C8B776330DE2CB19 /* TimePeriod+Support.swift in Sources */,\n\t\t\t\tCB6BAC34B10ADC7AD30F7E84AB9D2BA4 /* TimePeriodChain.swift in Sources */,\n\t\t\t\t58007C320B03FCEEB38136CC7568E0B0 /* TimePeriodCollection.swift in Sources */,\n\t\t\t\t1A45DEA218A73D86E8F9CA569FE40EB8 /* TimePeriodGroup.swift in Sources */,\n\t\t\t\tBF5312B8372DF3DE5DACD24C3460AE38 /* TimePeriodProtocol.swift in Sources */,\n\t\t\t\t56A26D70821D5CF4B4438FF5278D4B2D /* TimeStructures.swift in Sources */,\n\t\t\t\t6B0433A7C5E01E7C13ABD93162673104 /* Zones.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t226A0910E52B90D7C07421F8ABCEC18C /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = BC612998A52258F8860AD578CB896175 /* SwiftDate.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SwiftDate/SwiftDate-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SwiftDate/SwiftDate-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SwiftDate/SwiftDate.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SwiftDate;\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t32AF5F0083429A8534912177AEFEE82F /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t6EC13EAB29A29FDA27EC8CCF2A59153E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = EF2BE2D9A938E81666997F4EBE28ACF9 /* SwiftDate.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SwiftDate/SwiftDate-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SwiftDate/SwiftDate-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SwiftDate/SwiftDate.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SwiftDate;\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tADB96C629DA58788B18762E78D9E96B6 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t709D18045AD8211DFD3558F0727445CC /* Build configuration list for PBXNativeTarget \"SwiftDate\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t6EC13EAB29A29FDA27EC8CCF2A59153E /* Debug */,\n\t\t\t\t226A0910E52B90D7C07421F8ABCEC18C /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tEA52B03FAF35CA1FAB3674849233060A /* Build configuration list for PBXProject \"SwiftDate\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tADB96C629DA58788B18762E78D9E96B6 /* Debug */,\n\t\t\t\t32AF5F0083429A8534912177AEFEE82F /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = C9D01DC6E20F002C529A63228712762F /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/LICENSE",
    "content": "MIT License\n\nCopyright (c) 2015-2018 SwifterSwift (https://github.com/swifterswift)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/README.md",
    "content": "<p align=\"left\">\n  <img src=\"https://cdn.rawgit.com/SwifterSwift/SwifterSwift/master/Assets/logo.svg\" title=\"swifterSwift\">\n</p>\n\n[![Build Status](https://github.com/SwifterSwift/SwifterSwift/workflows/SwifterSwift/badge.svg?branch=master)](https://github.com/SwifterSwift/SwifterSwift/actions)\n[![Platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20tvOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20Linux-lightgrey.svg)](https://github.com/SwifterSwift/swifterSwift)\n[![Cocoapods](https://img.shields.io/cocoapods/v/SwifterSwift.svg)](https://cocoapods.org/pods/SwifterSwift)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-Compatible-brightgreen.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![SPM compatible](https://img.shields.io/badge/SPM-Compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)\n[![Accio supported](https://img.shields.io/badge/Accio-supported-0A7CF5.svg?style=flat)](https://github.com/JamitLabs/Accio)\n[![codecov](https://codecov.io/gh/SwifterSwift/SwifterSwift/branch/master/graph/badge.svg)](https://codecov.io/gh/SwifterSwift/SwifterSwift)\n[![docs](http://swifterswift.com/docs/badge.svg)](http://swifterswift.com/docs)\n[![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)](https://swift.org)\n[![Xcode](https://img.shields.io/badge/Xcode-11.4-blue.svg)](https://developer.apple.com/xcode)\n[![MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)\n[![Slack Channel](https://slackin-ppvrggbpgn.now.sh/badge.svg)](https://slackin-ppvrggbpgn.now.sh/)\n\nSwifterSwift is a collection of **over 500 native Swift extensions**, with handy methods, syntactic sugar, and performance improvements for wide range of primitive data types, UIKit and Cocoa classes –over 500 in 1– for iOS, macOS, tvOS, watchOS and Linux.\n\n### [Whats New in v5.2?](https://github.com/SwifterSwift/SwifterSwift/blob/master/CHANGELOG.md#v520)\n\n## Requirements\n\n- **iOS** 10.0+ / **tvOS** 9.0+ / **watchOS** 2.0+ / **macOS** 10.10+ / **Ubuntu** 14.04+\n- Swift 5.0+\n\n## Looking to use SwifterSwift for older versions of Swift\n\nSwifterSwift is Swift v5.0+ compatible starting from v5\n\n- To use with **Swift 3 / Xcode 8.x** please ensure you are using [**`v3.1.1`**](https://github.com/SwifterSwift/SwifterSwift/releases/tag/3.1.1).\n- To use with **Swift 3.2 / Xcode 9.x** please ensure you are using [**`v3.2.0`**](https://github.com/SwifterSwift/SwifterSwift/releases/tag/3.2.0).\n\n## Installation\n\n<details>\n<summary>CocoaPods</summary>\n</br>\n<p>To integrate SwifterSwift into your Xcode project using <a href=\"http://cocoapods.org\">CocoaPods</a>, specify it in your <code>Podfile</code>:</p>\n\n<h4>- Integrate All extensions (recommended):</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift'</code></pre>\n\n<h4>- Integrate SwiftStdlib extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/SwiftStdlib'</code></pre>\n\n<h4>- Integrate Foundation extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/Foundation'</code></pre>\n\n<h4>- Integrate UIKit extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/UIKit'</code></pre>\n\n<h4>- Integrate AppKit extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/AppKit'</code></pre>\n\n<h4>- Integrate MapKit extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/MapKit'</code></pre>\n\n<h4>- Integrate CoreGraphics extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/CoreGraphics'</code></pre>\n\n<h4>- Integrate CoreLocation extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/CoreLocation'</code></pre>\n\n<h4>- Integrate SpriteKit extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/SpriteKit'</code></pre>\n\n<h4>- Integrate SceneKit extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/SceneKit'</code></pre>\n\n<h4>- Integrate StoreKit extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/StoreKit'</code></pre>\n\n<h4>- Integrate Dispatch extensions only:</h4>\n<pre><code class=\"ruby language-ruby\">pod 'SwifterSwift/Dispatch'</code></pre>\n</details>\n\n<details>\n<summary>Carthage</summary>\n</br>\n<p>To integrate SwifterSwift into your Xcode project using <a href=\"https://github.com/Carthage/Carthage\">Carthage</a>, specify it in your <code>Cartfile</code>:</p>\n\n<pre><code class=\"ogdl language-ogdl\">github \"SwifterSwift/SwifterSwift\" ~&gt; 5.2\n</code></pre>\n</details>\n\n<details>\n<summary>Swift Package Manager</summary>\n</br>\n<p>You can use <a href=\"https://swift.org/package-manager\">The Swift Package Manager</a> to install <code>SwifterSwift</code> by adding the proper description to your <code>Package.swift</code> file:</p>\n\n<pre><code class=\"swift language-swift\">import PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    targets: [],\n    dependencies: [\n        .package(url: \"https://github.com/SwifterSwift/SwifterSwift.git\", from: \"5.2.0\")\n    ]\n)\n</code></pre>\n\n<p>Next, add <code>SwifterSwift</code> to your targets dependencies like so:</p>\n<pre><code class=\"swift language-swift\">.target(\n    name: \"YOUR_TARGET_NAME\",\n    dependencies: [\n        \"SwifterSwift\",\n    ]\n),</code></pre>\n<p>Then run <code>swift package update</code>.</p>\n\n<p>Note that the <a href=\"https://swift.org/package-manager\">Swift Package Manager</a> doesn't support building for iOS/tvOS/macOS/watchOS apps – see Accio in the next section for that.\n</details>\n\n\n<details>\n<summary>Accio</summary>\n<p><a href=\"https://github.com/JamitLabs/Accio\">Accio</a> is a dependency manager based on SwiftPM which can build frameworks for iOS/macOS/tvOS/watchOS. Therefore the integration steps are exactly the same as described above. Once your <code>Package.swift</code> file is configured, you need to run <code>accio update</code> instead of <code>swift package update</code> though.</p>\n</details>\n\n\n<details>\n<summary>Manually</summary>\n</br>\n<p>Add the <a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift\">SwifterSwift</a> folder to your Xcode project to use all extensions, or a specific extension.</p>\n</details>\n\n## List of All Extensions\n\n<details>\n<summary>SwiftStdlib Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/ArrayExtensions.swift\"><code>Array extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/BidirectionalCollectionExtensions.swift\"><code>BidirectionalCollection extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/BinaryFloatingPointExtensions.swift\"><code>BinaryFloatingPoint extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/BoolExtensions.swift\"><code>Bool extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/CharacterExtensions.swift\"><code>Character extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift\"><code>Collection extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/ComparableExtensions.swift\"><code>Comparable extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/DictionaryExtensions.swift\"><code>Dictionary extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/DoubleExtensions.swift\"><code>Double extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/FloatExtensions.swift\"><code>Float extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/FloatingPointExtensions.swift\"><code>FloatingPoint extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/IntExtensions.swift\"><code>Int extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/OptionalExtensions.swift\"><code>Optional extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SwiftStdlib/RandomAccessCollectionExtensions.swift\"><code>RandomAccessCollection extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SwiftStdlib/RangeReplaceableCollectionExtensions.swift\"><code>RangeReplaceableCollection extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/SequenceExtensions.swift\"><code>Sequence extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/SignedIntegerExtensions.swift\"><code>SignedInteger extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/SignedNumericExtensions.swift\"><code>SignedNumeric extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/SwiftStdlib/StringExtensions.swift\"><code>String extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SwiftStdlib/StringProtocolExtensions.swift\"><code>StringProtocol extensions</code></a></li>\n</ul>\n</details>\n\n\n<details>\n<summary>Foundation Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/CalendarExtensions.swift\"><code>Calendar extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/DataExtensions.swift\"><code>Data extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/DateExtensions.swift\"><code>Date extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/Foundation/FileManagerExtensions.swift\"><code>FileManager extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/LocaleExtensions.swift\"><code>Locale extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/NSAttributedStringExtensions.swift\"><code>NSAttributedString extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/NSPredicateExtensions.swift\"><code>NSPredicate extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/URLExtensions.swift\"><code>URL extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/URLRequestExtensions.swift\"><code>URLRequest extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Foundation/UserDefaultsExtensions.swift\"><code>UserDefaults extensions</code></a></li>\n</ul>\n</details>\n\n\n<details>\n<summary>UIKit Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIActivityExtensions.swift\"><code>UIActivity extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIAlertControllerExtensions.swift\"><code>UIAlertController extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIApplicationExtensions.swift\"><code>UIApplication extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIBarButtonItemExtensions.swift\"><code>UIBarButtonItem extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIButtonExtensions.swift\"><code>UIButton extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UICollectionViewExtensions.swift\"><code>UICollectionView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Shared/ColorExtensions.swift\"><code>UIColor extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIDatePickerExtensions.swift\"><code>UIDatePicker extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIEdgeInsetsExtensions.swift\"><code>UIEdgeInsets extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIFontExtensions.swift\"><code>UIFont extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIGestureRecognizer.swift\"><code>UIGestureRecognizer extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIImageExtensions.swift\"><code>UIImage extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIImageViewExtensions.swift\"><code>UIImageView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UILabelExtensions.swift\"><code>UILabel extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UILayoutPriorityExtensions.swift\"><code>UILayoutPriority extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UINavigationBarExtensions.swift\"><code>UINavigationBar extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UINavigationControllerExtensions.swift\"><code>UINavigationController extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UINavigationItemExtensions.swift\"><code>UINavigationItem extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIRefreshControlExtensions.swift\"><code>UIRefreshControl extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIScrollViewExtensions.swift\"><code>UIScrollView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UISearchBarExtensions.swift\"><code>UISearchBar extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UISegmentedControlExtensions.swift\"><code>UISegmentedControl extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UISliderExtensions.swift\"><code>UISlider extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/UIKit/UIStackViewExtensions.swift\"><code>UIStackView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIStoryboardExtensions.swift\"><code>UIStoryboard extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UISwitchExtensions.swift\"><code>UISwitch extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UITabBarExtensions.swift\"><code>UITabBar extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UITableViewExtensions.swift\"><code>UITableView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UITextFieldExtensions.swift\"><code>UITextField extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UITextViewExtensions.swift\"><code>UITextView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIViewControllerExtensions.swift\"><code>UIViewController extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIViewExtensions.swift\"><code>UIView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/UIKit/UIWindowExtensions.swift\"><code>UIWindow extensions</code></a></li>\n</ul>\n</details>\n\n\n<details>\n<summary>AppKit Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/Shared/ColorExtensions.swift\"><code>NSColor extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/AppKit/NSViewExtensions.swift\"><code>NSView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/AppKit/NSImageExtensions.swift\"><code>NSImage extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>CoreGraphics Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreGraphics/CGColorExtensions.swift\"><code>CGColor extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreGraphics/CGFloatExtensions.swift\"><code>CGFloat extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreGraphics/CGPointExtensions.swift\"><code>CGPoint extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreGraphics/CGSizeExtensions.swift\"><code>CGSize extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreGraphics/CGRectExtensions.swift\"><code>CGRect extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreGraphics/CGVectorExtensions.swift\"><code>CGVector extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>CoreLocation Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreLocation/CLLocationExtensions.swift\"><code>CLLocation extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreLocation/CLVisitExtensions.swift\"><code>CLVisit extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>CoreAnimation Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/tree/master/Sources/SwifterSwift/CoreAnimation/CAGradientLayerExtensions.swift\"><code>CAGradientLayer extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>MapKit Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/MapKit/MKMapViewExtensions.swift\"><code>MKMapView extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/MapKit/MKPolylineExtensions.swift\"><code>MKPolyline extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>SpriteKit Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SpriteKit/SKNodeExtensions.swift\"><code>SKNode extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>SceneKit Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNBoxExtensions.swift\"><code>SCNBox extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNCone.swift\"><code>SCNCone extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNCapsule.swift\"><code>SCNCapsule extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNCylinderExtensions.swift\"><code>SCNCylinder extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNGeometryExtensions.swift\"><code>SCNGeometry extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNMaterialExtensions.swift\"><code>SCNMaterial extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNPlaneExtensions.swift\"><code>SCNPlane extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNShape.swift\"><code>SCNShape extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNSphereExtensions.swift\"><code>SCNSphere extensions</code></a></li>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/SceneKit/SCNVector3Extensions.swift\"><code>SCNVector3 extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>StoreKit Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/StoreKit/SKProductExtensions.swift\"><code>SKProduct extensions</code></a></li>\n</ul>\n</details>\n\n<details>\n<summary>Dispatch Extensions</summary>\n</br>\n<ul>\n<li><a href=\"https://github.com/SwifterSwift/SwifterSwift/blob/master/Sources/SwifterSwift/Dispatch/DispatchQueueExtensions.swift\"><code>DispatchQueue extensions</code></a></li>\n</ul>\n</details>\n\n## How cool is this?\n\nSwifterSwift is a library of **over 500 properties and methods**, designed to extend Swift's functionality and productivity, staying faithful to the original Swift API design guidelines.\n\nCheck Examples.playground from the project for some cool examples!\n\n## Documentation\n\nDocumentation for all extensions, with examples, is available at [swifterswift.com/docs](http://swifterswift.com/docs)\n\n## Get involved\n\nWe want your feedback.\nPlease refer to [contributing guidelines](https://github.com/SwifterSwift/SwifterSwift/tree/master/CONTRIBUTING.md) before participating.\n\n## Slack Channel: [![Slack](https://slackin-ppvrggbpgn.now.sh/badge.svg)](https://slackin-ppvrggbpgn.now.sh/)\n\nIt is always nice to talk with other people using SwifterSwift and exchange experiences, so come [join our Slack channel](https://slackin-ppvrggbpgn.now.sh/).\n\n## Thanks\n\nSpecial thanks to:\n\n- [Steven Deutsch](https://github.com/SD10), [Luciano Almeida](https://github.com/LucianoPAlmeida) and [Guy Kogus](https://github.com/guykogus) for their latest contributions to extensions, docs and tests.\n- [Paweł Urbanek](https://github.com/pawurb) for adding tvOS, watchOS, and macOS initial support and helping with extensions.\n- [Mert Akengin](https://github.com/pvtmert) and [Bashar Ghadanfar](https://www.behance.net/lionbytes) for designing [project website](http://swifterswift.com) and logo.\n- [Abdul Rahman Dabbour](https://github.com/ardabbour) for helping document the project.\n- Many thanks to all other [contributors](https://github.com/SwifterSwift/SwifterSwift/graphs/contributors) of this project.\n\n## License\n\nSwifterSwift is released under the MIT license. See [LICENSE](https://github.com/SwifterSwift/SwifterSwift/blob/master/LICENSE) for more information.\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/AppKit/NSColorExtensions.swift",
    "content": "//\n//  NSColorExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Haertwig on 10/06/19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n\npublic extension NSColor {\n\n    /// SwifterSwift: Create an NSColor with different colors for light and dark mode.\n    ///\n    /// - Parameters:\n    ///     - light: Color to use in light/unspecified mode.\n    ///     - dark: Color to use in dark mode.\n    @available(OSX 10.15, *)\n    convenience init(light: NSColor, dark: NSColor) {\n        self.init(name: nil, dynamicProvider: { $0.name == .darkAqua ? dark : light })\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/AppKit/NSImageExtensions.swift",
    "content": "//\n//  NSImageExtensions.swift\n//  SwifterSwift-macOS\n//\n//  Created by BUDDAx2 on 20.10.2017.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n\n// MARK: - Methods\npublic extension NSImage {\n\n    /// SwifterSwift: NSImage scaled to maximum size with respect to aspect ratio\n    ///\n    /// - Parameter toMaxSize: maximum size\n    /// - Returns: scaled NSImage\n    func scaled(toMaxSize: NSSize) -> NSImage {\n        var ratio: Float = 0.0\n        let imageWidth = Float(size.width)\n        let imageHeight = Float(size.height)\n        let maxWidth = Float(toMaxSize.width)\n        let maxHeight = Float(toMaxSize.height)\n\n        // Get ratio (landscape or portrait)\n        if imageWidth > imageHeight {\n            // Landscape\n            ratio = maxWidth / imageWidth\n        } else {\n            // Portrait\n            ratio = maxHeight / imageHeight\n        }\n\n        // Calculate new size based on the ratio\n        let newWidth = imageWidth * ratio\n        let newHeight = imageHeight * ratio\n\n        // Create a new NSSize object with the newly calculated size\n        let newSize = NSSize(width: Int(newWidth), height: Int(newHeight))\n\n        // Cast the NSImage to a CGImage\n        var imageRect = CGRect(x: 0, y: 0, width: size.width, height: size.height)\n        let imageRef = cgImage(forProposedRect: &imageRect, context: nil, hints: nil)\n\n        // Create NSImage from the CGImage using the new size\n        let imageWithNewSize = NSImage(cgImage: imageRef!, size: newSize)\n\n        // Return the new image\n        return imageWithNewSize\n    }\n\n    /// SwifterSwift: Write NSImage to url.\n    ///\n    /// - Parameters:\n    ///   - url: Desired file URL.\n    ///   - type: Type of image (default is .jpeg).\n    ///   - compressionFactor: used only for JPEG files. The value is a float between 0.0 and 1.0, with 1.0 resulting in no compression and 0.0 resulting in the maximum compression possible.\n    func write(to url: URL, fileType type: NSBitmapImageRep.FileType = .jpeg, compressionFactor: NSNumber = 1.0) {\n        // https://stackoverflow.com/a/45042611/3882644\n\n        guard let data = tiffRepresentation else { return }\n        guard let imageRep = NSBitmapImageRep(data: data) else { return }\n\n        guard let imageData = imageRep.representation(using: type, properties: [.compressionFactor: compressionFactor]) else { return }\n        try? imageData.write(to: url)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/AppKit/NSViewExtensions.swift",
    "content": "//\n//  NSViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 3/3/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n\n// MARK: - Properties\npublic extension NSView {\n\n    /// SwifterSwift: Border color of view; also inspectable from Storyboard.\n    @IBInspectable\n    var borderColor: NSColor? {\n        get {\n            guard let color = layer?.borderColor else { return nil }\n            return NSColor(cgColor: color)\n        }\n        set {\n            wantsLayer = true\n            layer?.borderColor = newValue?.cgColor\n        }\n    }\n\n    /// SwifterSwift: Border width of view; also inspectable from Storyboard.\n    @IBInspectable\n    var borderWidth: CGFloat {\n        get {\n            return layer?.borderWidth ?? 0\n        }\n        set {\n            wantsLayer = true\n            layer?.borderWidth = newValue\n        }\n    }\n\n    /// SwifterSwift: Corner radius of view; also inspectable from Storyboard.\n    @IBInspectable\n    var cornerRadius: CGFloat {\n        get {\n            return layer?.cornerRadius ?? 0\n        }\n        set {\n            wantsLayer = true\n            layer?.masksToBounds = true\n            layer?.cornerRadius = abs(CGFloat(Int(newValue * 100)) / 100)\n        }\n    }\n\n    // SwifterSwift: Height of view.\n    var height: CGFloat {\n        get {\n            return frame.size.height\n        }\n        set {\n            frame.size.height = newValue\n        }\n    }\n\n    /// SwifterSwift: Shadow color of view; also inspectable from Storyboard.\n    @IBInspectable\n    var shadowColor: NSColor? {\n        get {\n            guard let color = layer?.shadowColor else { return nil }\n            return NSColor(cgColor: color)\n        }\n        set {\n            wantsLayer = true\n            layer?.shadowColor = newValue?.cgColor\n        }\n    }\n\n    /// SwifterSwift: Shadow offset of view; also inspectable from Storyboard.\n    @IBInspectable\n    var shadowOffset: CGSize {\n        get {\n            return layer?.shadowOffset ?? CGSize.zero\n        }\n        set {\n            wantsLayer = true\n            layer?.shadowOffset = newValue\n        }\n    }\n\n    /// SwifterSwift: Shadow opacity of view; also inspectable from Storyboard.\n    @IBInspectable\n    var shadowOpacity: Float {\n        get {\n            return layer?.shadowOpacity ?? 0\n        }\n        set {\n            wantsLayer = true\n            layer?.shadowOpacity = newValue\n        }\n    }\n\n    /// SwifterSwift: Shadow radius of view; also inspectable from Storyboard.\n    @IBInspectable\n    var shadowRadius: CGFloat {\n        get {\n            return layer?.shadowRadius ?? 0\n        }\n        set {\n            wantsLayer = true\n            layer?.shadowRadius = newValue\n        }\n    }\n\n    /// SwifterSwift: Background color of the view; also inspectable from Storyboard.\n    @IBInspectable\n    var backgroundColor: NSColor? {\n        get {\n            if let colorRef = layer?.backgroundColor {\n                return NSColor(cgColor: colorRef)\n            } else {\n                return nil\n            }\n        }\n        set {\n            wantsLayer = true\n            layer?.backgroundColor = newValue?.cgColor\n        }\n    }\n\n    /// SwifterSwift: Size of view.\n    var size: CGSize {\n        get {\n            return frame.size\n        }\n        set {\n            width = newValue.width\n            height = newValue.height\n        }\n    }\n\n    /// SwifterSwift: Width of view.\n    var width: CGFloat {\n        get {\n            return frame.size.width\n        }\n        set {\n            frame.size.width = newValue\n        }\n    }\n\n}\n\n// MARK: - Methods\npublic extension NSView {\n\n    /// SwifterSwift: Add array of subviews to view.\n    ///\n    /// - Parameter subviews: array of subviews to add to self.\n    func addSubviews(_ subviews: [NSView]) {\n        subviews.forEach { addSubview($0) }\n    }\n\n    /// SwifterSwift: Remove all subviews in view.\n    func removeSubviews() {\n        subviews.forEach { $0.removeFromSuperview() }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreAnimation/CAGradientLayerExtensions.swift",
    "content": "//\n//  CAGradientLayerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Jay Mehta on 11/10/19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if !os(watchOS) && !os(Linux) && canImport(QuartzCore)\nimport QuartzCore\n\nextension CAGradientLayer {\n\n    /// SwifterSwift: Creates a CAGradientLayer with the specified colors, location, startPoint, endPoint, and type.\n    /// - Parameter colors: An array of colors defining the color of each gradient stop\n    /// - Parameter locations: An array of NSNumber defining the location of each\n    ///                gradient stop as a value in the range [0,1]. The values must be\n    ///                monotonically increasing. If a nil array is given, the stops are\n    ///                assumed to spread uniformly across the [0,1] range. When rendered,\n    ///                the colors are mapped to the output colorspace before being\n    ///                interpolated. (default is nil)\n    /// - Parameter startPoint: start point corresponds to the first gradient stop (I.e. [0,0] is the bottom-corner of the layer, [1,1] is the top-right corner.)\n    /// - Parameter endPoint: end point corresponds to the last gradient stop\n    /// - Parameter type: The kind of gradient that will be drawn. Currently, the only allowed values are `axial' (the default value), `radial', and `conic'.\n    convenience init(colors: [Color], locations: [CGFloat]? = nil, startPoint: CGPoint, endPoint: CGPoint, type: CAGradientLayerType = .axial) {\n        self.init()\n        self.colors =  colors.map { $0.cgColor }\n        self.locations = locations?.map { NSNumber(value: Double($0)) }\n        self.startPoint = startPoint\n        self.endPoint = endPoint\n        self.type = type\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreAnimation/CATransform3DExtensions.swift",
    "content": "//\n//  CATransform3DExtensions.swift\n//  SwifterSwift\n//\n//  Created by Guy Kogus on 19/3/20.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if canImport(QuartzCore)\n\nimport QuartzCore\n\n// MARK: - Equatable\nextension CATransform3D: Equatable {\n\n    // swiftlint:disable missing_swifterswift_prefix\n\n    /// Returns a Boolean value indicating whether two values are equal.\n    ///\n    /// Equality is the inverse of inequality. For any values `a` and `b`,\n    /// `a == b` implies that `a != b` is `false`.\n    ///\n    /// - Parameters:\n    ///   - lhs: A value to compare.\n    ///   - rhs: Another value to compare.\n    @inlinable\n    public static func == (lhs: CATransform3D, rhs: CATransform3D) -> Bool {\n        CATransform3DEqualToTransform(lhs, rhs)\n    }\n\n    // swiftlint:disable missing_swifterswift_prefix\n\n}\n\n// MARK: - Static Properties\npublic extension CATransform3D {\n\n    /// SwifterSwift: The identity transform: [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1].\n    @inlinable\n    static var identity: CATransform3D { CATransform3DIdentity }\n\n}\n\n// MARK: - Codable\nextension CATransform3D: Codable {\n\n    // swiftlint:disable missing_swifterswift_prefix\n\n    /// Creates a new instance by decoding from the given decoder.\n    ///\n    /// This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.\n    /// - Parameter decoder: The decoder to read data from.\n    @inlinable\n    public init(from decoder: Decoder) throws {\n        var container = try decoder.unkeyedContainer()\n        self.init(m11: try container.decode(CGFloat.self),\n                  m12: try container.decode(CGFloat.self),\n                  m13: try container.decode(CGFloat.self),\n                  m14: try container.decode(CGFloat.self),\n                  m21: try container.decode(CGFloat.self),\n                  m22: try container.decode(CGFloat.self),\n                  m23: try container.decode(CGFloat.self),\n                  m24: try container.decode(CGFloat.self),\n                  m31: try container.decode(CGFloat.self),\n                  m32: try container.decode(CGFloat.self),\n                  m33: try container.decode(CGFloat.self),\n                  m34: try container.decode(CGFloat.self),\n                  m41: try container.decode(CGFloat.self),\n                  m42: try container.decode(CGFloat.self),\n                  m43: try container.decode(CGFloat.self),\n                  m44: try container.decode(CGFloat.self))\n    }\n\n    /// Encodes this value into the given encoder.\n    ///\n    /// If the value fails to encode anything, encoder will encode an empty keyed container in its place.\n    ///\n    /// This function throws an error if any values are invalid for the given encoder’s format.\n    /// - Parameter encoder: The encoder to write data to.\n    @inlinable\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.unkeyedContainer()\n        try container.encode(m11)\n        try container.encode(m12)\n        try container.encode(m13)\n        try container.encode(m14)\n        try container.encode(m21)\n        try container.encode(m22)\n        try container.encode(m23)\n        try container.encode(m24)\n        try container.encode(m31)\n        try container.encode(m32)\n        try container.encode(m33)\n        try container.encode(m34)\n        try container.encode(m41)\n        try container.encode(m42)\n        try container.encode(m43)\n        try container.encode(m44)\n    }\n\n    // swiftlint:enable missing_swifterswift_prefix\n\n}\n\n// MARK: - Initializers\npublic extension CATransform3D {\n\n    /// SwifterSwift: Returns a transform that translates by `(tx, ty, tz)`.\n    /// - Parameters:\n    ///   - tx: x-axis translation\n    ///   - ty: y-axis translation\n    ///   - tz: z-axis translation\n    @inlinable\n    init(translationX tx: CGFloat, y ty: CGFloat, z tz: CGFloat) { // swiftlint:disable:this identifier_name\n        self = CATransform3DMakeTranslation(tx, ty, tz)\n    }\n\n    /// SwifterSwift: Returns a transform that scales by `(sx, sy, sz)`.\n    /// - Parameters:\n    ///   - sx: x-axis scale\n    ///   - sy: y-axis scale\n    ///   - sz: z-axis scale\n    @inlinable\n    init(scaleX sx: CGFloat, y sy: CGFloat, z sz: CGFloat) { // swiftlint:disable:this identifier_name\n        self = CATransform3DMakeScale(sx, sy, sz)\n    }\n\n    /// SwifterSwift: Returns a transform that rotates by `angle` radians about the vector `(x, y, z)`.\n    ///\n    /// If the vector has zero length the behavior is undefined.\n    /// - Parameters:\n    ///   - angle: The angle of rotation\n    ///   - x: x position of the vector\n    ///   - y: y position of the vector\n    ///   - z: z position of the vector\n    @inlinable\n    init(rotationAngle angle: CGFloat, x: CGFloat, y: CGFloat, z: CGFloat) {\n        self = CATransform3DMakeRotation(angle, x, y, z)\n    }\n\n}\n\n// MARK: - Properties\npublic extension CATransform3D {\n\n    /// SwifterSwift: Returns `true` if the receiver is the identity transform.\n    @inlinable\n    var isIdentity: Bool { CATransform3DIsIdentity(self) }\n\n}\n\n// MARK: - Methods\npublic extension CATransform3D {\n\n    /// SwifterSwift: Translate the receiver by `(tx, ty, tz)`.\n    /// - Parameters:\n    ///   - tx: x-axis translation\n    ///   - ty: y-axis translation\n    ///   - tz: z-axis translation\n    /// - Returns: The translated matrix.\n    @inlinable\n    func translatedBy(x tx: CGFloat, y ty: CGFloat, z tz: CGFloat) -> CATransform3D { // swiftlint:disable:this identifier_name\n        CATransform3DTranslate(self, tx, ty, tz)\n    }\n\n    /// SwifterSwift: Scale the receiver by `(sx, sy, sz)`.\n    /// - Parameters:\n    ///   - sx: x-axis scale\n    ///   - sy: y-axis scale\n    ///   - sz: z-axis scale\n    /// - Returns: The scaled matrix.\n    @inlinable\n    func scaledBy(x sx: CGFloat, y sy: CGFloat, z sz: CGFloat) -> CATransform3D { // swiftlint:disable:this identifier_name\n        CATransform3DScale(self, sx, sy, sz)\n    }\n\n    /// SwifterSwift: Rotate the receiver by `angle` radians about the vector `(x, y, z)`.\n    ///\n    /// If the vector has zero length the behavior is undefined.\n    /// - Parameters:\n    ///   - angle: The angle of rotation\n    ///   - x: x position of the vector\n    ///   - y: y position of the vector\n    ///   - z: z position of the vector\n    /// - Returns: The rotated matrix.\n    @inlinable\n    func rotated(by angle: CGFloat, x: CGFloat, y: CGFloat, z: CGFloat) -> CATransform3D {\n        CATransform3DRotate(self, angle, x, y, z)\n    }\n\n    /// SwifterSwift: Invert the receiver.\n    ///\n    /// Returns the original matrix if the receiver has no inverse.\n    /// - Returns: The inverted matrix of the receiver.\n    @inlinable\n    func inverted() -> CATransform3D {\n        CATransform3DInvert(self)\n    }\n\n    /// SwifterSwift: Concatenate `transform` to the receiver.\n    /// - Parameter t2: The transform to concatenate on to the receiver\n    /// - Returns: The concatenated matrix.\n    @inlinable\n    func concatenating(_ t2: CATransform3D) -> CATransform3D { // swiftlint:disable:this identifier_name\n        CATransform3DConcat(self, t2)\n    }\n\n    /// SwifterSwift: Translate the receiver by `(tx, ty, tz)`.\n    /// - Parameters:\n    ///   - tx: x-axis translation\n    ///   - ty: y-axis translation\n    ///   - tz: z-axis translation\n    @inlinable\n    mutating func translateBy(x tx: CGFloat, y ty: CGFloat, z tz: CGFloat) { // swiftlint:disable:this identifier_name\n        self = CATransform3DTranslate(self, tx, ty, tz)\n    }\n\n    /// SwifterSwift: Scale the receiver by `(sx, sy, sz)`.\n    /// - Parameters:\n    ///   - sx: x-axis scale\n    ///   - sy: y-axis scale\n    ///   - sz: z-axis scale\n    @inlinable\n    mutating func scaleBy(x sx: CGFloat, y sy: CGFloat, z sz: CGFloat) { // swiftlint:disable:this identifier_name\n        self = CATransform3DScale(self, sx, sy, sz)\n    }\n\n    /// SwifterSwift: Rotate the receiver by `angle` radians about the vector `(x, y, z)`.\n    ///\n    /// If the vector has zero length the behavior is undefined.\n    /// - Parameters:\n    ///   - angle: The angle of rotation\n    ///   - x: x position of the vector\n    ///   - y: y position of the vector\n    ///   - z: z position of the vector\n    @inlinable\n    mutating func rotate(by angle: CGFloat, x: CGFloat, y: CGFloat, z: CGFloat) {\n        self = CATransform3DRotate(self, angle, x, y, z)\n    }\n\n    /// SwifterSwift: Invert the receiver.\n    ///\n    /// Returns the original matrix if the receiver has no inverse.\n    @inlinable\n    mutating func invert() {\n        self = CATransform3DInvert(self)\n    }\n\n    /// SwifterSwift: Concatenate `transform` to the receiver.\n    /// - Parameter t2: The transform to concatenate on to the receiver\n    @inlinable\n    mutating func concatenate(_ t2: CATransform3D) { // swiftlint:disable:this identifier_name\n        self = CATransform3DConcat(self, t2)\n    }\n\n}\n\n#if canImport(CoreGraphics)\n\nimport CoreGraphics\n\n// MARK: - CGAffineTransform\npublic extension CATransform3D {\n\n    /// SwifterSwift: Returns true if the receiver can be represented exactly by an affine transform.\n    @inlinable\n    var isAffine: Bool { CATransform3DIsAffine(self) }\n\n    /// SwifterSwift: Returns the affine transform represented by the receiver.\n    ///\n    /// If the receiver can not be represented exactly by an affine transform the returned value is undefined.\n    @inlinable\n    func affineTransform() -> CGAffineTransform {\n        CATransform3DGetAffineTransform(self)\n    }\n\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreGraphics/CGAffineTransformExtensions.swift",
    "content": "//\n//  CGAffineTransformExtensions.swift\n//  SwifterSwift\n//\n//  Created by Guy Kogus on 19/3/20.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n\n#if canImport(QuartzCore)\n\nimport QuartzCore\n\n// MARK: - Methods\npublic extension CGAffineTransform {\n\n    /// SwifterSwift: Returns a transform with the same effect as the receiver.\n    @inlinable\n    func transform3D() -> CATransform3D { CATransform3DMakeAffineTransform(self) }\n\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreGraphics/CGColorExtensions.swift",
    "content": "//\n//  CGColorExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 03/02/2017.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n\n#if canImport(UIKit)\nimport UIKit\n#endif\n\n#if canImport(AppKit)\nimport AppKit\n#endif\n\n// MARK: - Properties\npublic extension CGColor {\n\n    #if canImport(UIKit)\n    /// SwifterSwift: UIColor.\n    var uiColor: UIColor? {\n        return UIColor(cgColor: self)\n    }\n    #endif\n\n    #if canImport(AppKit) && !targetEnvironment(macCatalyst)\n    /// SwifterSwift: NSColor.\n    var nsColor: NSColor? {\n        return NSColor(cgColor: self)\n    }\n    #endif\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreGraphics/CGFloatExtensions.swift",
    "content": "//\n//  CGFloatExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/23/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n\n#if canImport(Foundation)\nimport Foundation\n#endif\n\n// MARK: - Properties\npublic extension CGFloat {\n\n    /// SwifterSwift: Absolute of CGFloat value.\n    var abs: CGFloat {\n        return Swift.abs(self)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Ceil of CGFloat value.\n    var ceil: CGFloat {\n        return Foundation.ceil(self)\n    }\n    #endif\n\n    /// SwifterSwift: Radian value of degree input.\n    var degreesToRadians: CGFloat {\n        return .pi * self / 180.0\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Floor of CGFloat value.\n    var floor: CGFloat {\n        return Foundation.floor(self)\n    }\n    #endif\n\n    /// SwifterSwift: Check if CGFloat is positive.\n    var isPositive: Bool {\n        return self > 0\n    }\n\n    /// SwifterSwift: Check if CGFloat is negative.\n    var isNegative: Bool {\n        return self < 0\n    }\n\n    /// SwifterSwift: Int.\n    var int: Int {\n        return Int(self)\n    }\n\n    /// SwifterSwift: Float.\n    var float: Float {\n        return Float(self)\n    }\n\n    /// SwifterSwift: Double.\n    var double: Double {\n        return Double(self)\n    }\n\n    /// SwifterSwift: Degree value of radian input.\n    var radiansToDegrees: CGFloat {\n        return self * 180 / CGFloat.pi\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreGraphics/CGPointExtensions.swift",
    "content": "//\n//  CGPointExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 07/12/2016.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n\n// MARK: - Methods\npublic extension CGPoint {\n\n    /// SwifterSwift: Distance from another CGPoint.\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let point2 = CGPoint(x: 30, y: 30)\n    ///     let distance = point1.distance(from: point2)\n    ///     // distance = 28.28\n    ///\n    /// - Parameter point: CGPoint to get distance from.\n    /// - Returns: Distance between self and given CGPoint.\n    func distance(from point: CGPoint) -> CGFloat {\n        return CGPoint.distance(from: self, to: point)\n    }\n\n    /// SwifterSwift: Distance between two CGPoints.\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let point2 = CGPoint(x: 30, y: 30)\n    ///     let distance = CGPoint.distance(from: point2, to: point1)\n    ///     // distance = 28.28\n    ///\n    /// - Parameters:\n    ///   - point1: first CGPoint.\n    ///   - point2: second CGPoint.\n    /// - Returns: distance between the two given CGPoints.\n    static func distance(from point1: CGPoint, to point2: CGPoint) -> CGFloat {\n        // http://stackoverflow.com/questions/6416101/calculate-the-distance-between-two-cgpoints\n        return sqrt(pow(point2.x - point1.x, 2) + pow(point2.y - point1.y, 2))\n    }\n\n}\n\n// MARK: - Operators\npublic extension CGPoint {\n\n    /// SwifterSwift: Add two CGPoints.\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let point2 = CGPoint(x: 30, y: 30)\n    ///     let point = point1 + point2\n    ///     // point = CGPoint(x: 40, y: 40)\n    ///\n    /// - Parameters:\n    ///   - lhs: CGPoint to add to.\n    ///   - rhs: CGPoint to add.\n    /// - Returns: result of addition of the two given CGPoints.\n    static func + (lhs: CGPoint, rhs: CGPoint) -> CGPoint {\n        return CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)\n    }\n\n    /// SwifterSwift: Add a CGPoints to self.\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let point2 = CGPoint(x: 30, y: 30)\n    ///     point1 += point2\n    ///     // point1 = CGPoint(x: 40, y: 40)\n    ///\n    /// - Parameters:\n    ///   - lhs: self\n    ///   - rhs: CGPoint to add.\n    static func += (lhs: inout CGPoint, rhs: CGPoint) {\n        // swiftlint:disable:next shorthand_operator\n        lhs = lhs + rhs\n    }\n\n    /// SwifterSwift: Subtract two CGPoints.\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let point2 = CGPoint(x: 30, y: 30)\n    ///     let point = point1 - point2\n    ///     // point = CGPoint(x: -20, y: -20)\n    ///\n    /// - Parameters:\n    ///   - lhs: CGPoint to subtract from.\n    ///   - rhs: CGPoint to subtract.\n    /// - Returns: result of subtract of the two given CGPoints.\n    static func - (lhs: CGPoint, rhs: CGPoint) -> CGPoint {\n        return CGPoint(x: lhs.x - rhs.x, y: lhs.y - rhs.y)\n    }\n\n    /// SwifterSwift: Subtract a CGPoints from self.\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let point2 = CGPoint(x: 30, y: 30)\n    ///     point1 -= point2\n    ///     // point1 = CGPoint(x: -20, y: -20)\n    ///\n    /// - Parameters:\n    ///   - lhs: self\n    ///   - rhs: CGPoint to subtract.\n    static func -= (lhs: inout CGPoint, rhs: CGPoint) {\n        // swiftlint:disable:next shorthand_operator\n        lhs = lhs - rhs\n    }\n\n    /// SwifterSwift: Multiply a CGPoint with a scalar\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let scalar = point1 * 5\n    ///     // scalar = CGPoint(x: 50, y: 50)\n    ///\n    /// - Parameters:\n    ///   - point: CGPoint to multiply.\n    ///   - scalar: scalar value.\n    /// - Returns: result of multiplication of the given CGPoint with the scalar.\n    static func * (point: CGPoint, scalar: CGFloat) -> CGPoint {\n        return CGPoint(x: point.x * scalar, y: point.y * scalar)\n    }\n\n    /// SwifterSwift: Multiply self with a scalar\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     point *= 5\n    ///     // point1 = CGPoint(x: 50, y: 50)\n    ///\n    /// - Parameters:\n    ///   - point: self.\n    ///   - scalar: scalar value.\n    /// - Returns: result of multiplication of the given CGPoint with the scalar.\n    static func *= (point: inout CGPoint, scalar: CGFloat) {\n        // swiftlint:disable:next shorthand_operator\n        point = point * scalar\n    }\n\n    /// SwifterSwift: Multiply a CGPoint with a scalar\n    ///\n    ///     let point1 = CGPoint(x: 10, y: 10)\n    ///     let scalar = 5 * point1\n    ///     // scalar = CGPoint(x: 50, y: 50)\n    ///\n    /// - Parameters:\n    ///   - scalar: scalar value.\n    ///   - point: CGPoint to multiply.\n    /// - Returns: result of multiplication of the given CGPoint with the scalar.\n    static func * (scalar: CGFloat, point: CGPoint) -> CGPoint {\n        return CGPoint(x: point.x * scalar, y: point.y * scalar)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreGraphics/CGRectExtensions.swift",
    "content": "//\n//  CGRectExtensions.swift\n//  SwifterSwift\n//\n//  Created by Chen Qizhi on 2020/03/11.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n\n// MARK: - Properties\npublic extension CGRect {\n\n    /// SwifterSwift: Return center of rect\n    var center: CGPoint { CGPoint(x: midX, y: midY) }\n\n}\n\n// MARK: - Initializers\npublic extension CGRect {\n\n    /// SwifterSwift: Create a `CGRect` instance with center and size\n    /// - Parameters:\n    ///   - center: center of the new rect\n    ///   - size: size of the new rect\n    init(center: CGPoint, size: CGSize) {\n        let origin = CGPoint(x: center.x - size.width / 2.0, y: center.y - size.height / 2.0)\n        self.init(origin: origin, size: size)\n    }\n\n}\n\n// MARK: - Methods\npublic extension CGRect {\n\n    /// SwifterSwift: Create a new `CGRect` by resizing with specified anchor\n    /// - Parameters:\n    ///   - size: new size to be applied\n    ///   - anchor: specified anchor, a point in normalized coordinates -\n    ///     '(0, 0)' is the top left corner of rect，'(1, 1)' is the bottom right corner of rect,\n    ///     defaults to '(0.5, 0.5)'. excample:\n    ///\n    ///          anchor = CGPoint(x: 0.0, y: 1.0):\n    ///\n    ///                       A2------B2\n    ///          A----B       |        |\n    ///          |    |  -->  |        |\n    ///          C----D       C-------D2\n    ///\n    func resizing(to size: CGSize, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5)) -> CGRect {\n        let sizeDelta = CGSize(width: size.width - width, height: size.height - height)\n        return CGRect(origin: CGPoint(x: minX - sizeDelta.width * anchor.x,\n                                      y: minY - sizeDelta.height * anchor.y),\n                      size: size)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreGraphics/CGSizeExtensions.swift",
    "content": "//\n//  CGSizeExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/22/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n\n// MARK: - Methods\npublic extension CGSize {\n\n    /// SwifterSwift: Returns the aspect ratio.\n    var aspectRatio: CGFloat {\n        return height == 0 ? 0 : width / height\n    }\n\n    /// SwifterSwift: Returns width or height, whichever is the bigger value.\n    var maxDimension: CGFloat {\n        return max(width, height)\n    }\n\n    /// SwifterSwift: Returns width or height, whichever is the smaller value.\n    var minDimension: CGFloat {\n        return min(width, height)\n    }\n\n}\n\n// MARK: - Methods\npublic extension CGSize {\n\n    /// SwifterSwift: Aspect fit CGSize.\n    ///\n    ///     let rect = CGSize(width: 120, height: 80)\n    ///     let parentRect  = CGSize(width: 100, height: 50)\n    ///     let newRect = rect.aspectFit(to: parentRect)\n    ///     // newRect.width = 75 , newRect = 50\n    ///\n    /// - Parameter boundingSize: bounding size to fit self to.\n    /// - Returns: self fitted into given bounding size\n    func aspectFit(to boundingSize: CGSize) -> CGSize {\n        let minRatio = min(boundingSize.width / width, boundingSize.height / height)\n        return CGSize(width: width * minRatio, height: height * minRatio)\n    }\n\n    /// SwifterSwift: Aspect fill CGSize.\n    ///\n    ///     let rect = CGSize(width: 20, height: 120)\n    ///     let parentRect  = CGSize(width: 100, height: 60)\n    ///     let newRect = rect.aspectFit(to: parentRect)\n    ///     // newRect.width = 100 , newRect = 60\n    ///\n    /// - Parameter boundingSize: bounding size to fill self to.\n    /// - Returns: self filled into given bounding size\n    func aspectFill(to boundingSize: CGSize) -> CGSize {\n        let minRatio = max(boundingSize.width / width, boundingSize.height / height)\n        let aWidth = min(width * minRatio, boundingSize.width)\n        let aHeight = min(height * minRatio, boundingSize.height)\n        return CGSize(width: aWidth, height: aHeight)\n    }\n\n}\n\n// MARK: - Operators\npublic extension CGSize {\n\n    /// SwifterSwift: Add two CGSize\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let sizeB = CGSize(width: 3, height: 4)\n    ///     let result = sizeA + sizeB\n    ///     // result = CGSize(width: 8, height: 14)\n    ///\n    /// - Parameters:\n    ///   - lhs: CGSize to add to.\n    ///   - rhs: CGSize to add.\n    /// - Returns: The result comes from the addition of the two given CGSize struct.\n    static func + (lhs: CGSize, rhs: CGSize) -> CGSize {\n        return CGSize(width: lhs.width + rhs.width, height: lhs.height + rhs.height)\n    }\n\n    /// SwifterSwift: Add a CGSize to self.\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let sizeB = CGSize(width: 3, height: 4)\n    ///     sizeA += sizeB\n    ///     // sizeA = CGPoint(width: 8, height: 14)\n    ///\n    /// - Parameters:\n    ///   - lhs: self\n    ///   - rhs: CGSize to add.\n    static func += (lhs: inout CGSize, rhs: CGSize) {\n        lhs.width += rhs.width\n        lhs.height += rhs.height\n    }\n\n    /// SwifterSwift: Subtract two CGSize\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let sizeB = CGSize(width: 3, height: 4)\n    ///     let result = sizeA - sizeB\n    ///     // result = CGSize(width: 2, height: 6)\n    ///\n    /// - Parameters:\n    ///   - lhs: CGSize to subtract from.\n    ///   - rhs: CGSize to subtract.\n    /// - Returns: The result comes from the subtract of the two given CGSize struct.\n    static func - (lhs: CGSize, rhs: CGSize) -> CGSize {\n        return CGSize(width: lhs.width - rhs.width, height: lhs.height - rhs.height)\n    }\n\n    /// SwifterSwift: Subtract a CGSize from self.\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let sizeB = CGSize(width: 3, height: 4)\n    ///     sizeA -= sizeB\n    ///     // sizeA = CGPoint(width: 2, height: 6)\n    ///\n    /// - Parameters:\n    ///   - lhs: self\n    ///   - rhs: CGSize to subtract.\n    static func -= (lhs: inout CGSize, rhs: CGSize) {\n        lhs.width -= rhs.width\n        lhs.height -= rhs.height\n    }\n\n    /// SwifterSwift: Multiply two CGSize\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let sizeB = CGSize(width: 3, height: 4)\n    ///     let result = sizeA * sizeB\n    ///     // result = CGSize(width: 15, height: 40)\n    ///\n    /// - Parameters:\n    ///   - lhs: CGSize to multiply.\n    ///   - rhs: CGSize to multiply with.\n    /// - Returns: The result comes from the multiplication of the two given CGSize structs.\n    static func * (lhs: CGSize, rhs: CGSize) -> CGSize {\n        return CGSize(width: lhs.width * rhs.width, height: lhs.height * rhs.height)\n    }\n\n    /// SwifterSwift: Multiply a CGSize with a scalar.\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let result = sizeA * 5\n    ///     // result = CGSize(width: 25, height: 50)\n    ///\n    /// - Parameters:\n    ///   - lhs: CGSize to multiply.\n    ///   - scalar: scalar value.\n    /// - Returns: The result comes from the multiplication of the given CGSize and scalar.\n    static func * (lhs: CGSize, scalar: CGFloat) -> CGSize {\n        return CGSize(width: lhs.width * scalar, height: lhs.height * scalar)\n    }\n\n    /// SwifterSwift: Multiply a CGSize with a scalar.\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let result = 5 * sizeA\n    ///     // result = CGSize(width: 25, height: 50)\n    ///\n    /// - Parameters:\n    ///   - scalar: scalar value.\n    ///   - rhs: CGSize to multiply.\n    /// - Returns: The result comes from the multiplication of the given scalar and CGSize.\n    static func * (scalar: CGFloat, rhs: CGSize) -> CGSize {\n        return CGSize(width: scalar * rhs.width, height: scalar * rhs.height)\n    }\n\n    /// SwifterSwift: Multiply self with a CGSize.\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     let sizeB = CGSize(width: 3, height: 4)\n    ///     sizeA *= sizeB\n    ///     // result = CGSize(width: 15, height: 40)\n    ///\n    /// - Parameters:\n    ///   - lhs: self.\n    ///   - rhs: CGSize to multiply.\n    static func *= (lhs: inout CGSize, rhs: CGSize) {\n        lhs.width *= rhs.width\n        lhs.height *= rhs.height\n    }\n\n    /// SwifterSwift: Multiply self with a scalar.\n    ///\n    ///     let sizeA = CGSize(width: 5, height: 10)\n    ///     sizeA *= 3\n    ///     // result = CGSize(width: 15, height: 30)\n    ///\n    /// - Parameters:\n    ///   - lhs: self.\n    ///   - scalar: scalar value.\n    static func *= (lhs: inout CGSize, scalar: CGFloat) {\n        lhs.width *= scalar\n        lhs.height *= scalar\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreGraphics/CGVectorExtensions.swift",
    "content": "//\n//  CGVectorExtensions.swift\n//  SwifterSwift\n//\n//  Created by Robbie Moyer on 7/25/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n\n// MARK: - Properties\npublic extension CGVector {\n\n    /// SwifterSwift: The angle of rotation (in radians) of the vector. The range of the angle is -π to π; an angle of 0 points to the right.\n    ///\n    /// https://en.wikipedia.org/wiki/Atan2\n    var angle: CGFloat {\n        return atan2(dy, dx)\n    }\n\n    /// SwifterSwift: The magnitude (or length) of the vector.\n    ///\n    /// https://en.wikipedia.org/wiki/Euclidean_vector#Length\n    var magnitude: CGFloat {\n        return sqrt((dx * dx) + (dy * dy))\n    }\n\n}\n\n// MARK: - Initializers\npublic extension CGVector {\n\n    /// SwifterSwift: Creates a vector with the given magnitude and angle.\n    ///\n    ///     let vector = CGVector(angle: .pi, magnitude: 1)\n    ///\n    /// - Parameters:\n    ///     - angle: The angle of rotation (in radians) counterclockwise from the positive x-axis.\n    ///     - magnitude: The lenth of the vector.\n    ///\n    init(angle: CGFloat, magnitude: CGFloat) {\n        // https://www.grc.nasa.gov/WWW/K-12/airplane/vectpart.html\n        self.init(dx: magnitude * cos(angle), dy: magnitude * sin(angle))\n    }\n\n}\n\n// MARK: - Operators\npublic extension CGVector {\n\n    /// SwifterSwift: Multiplies a scalar and a vector (commutative).\n    ///\n    ///     let vector = CGVector(dx: 1, dy: 1)\n    ///     let largerVector = vector * 2\n    ///\n    /// - Parameters:\n    ///   - vector: The vector to be multiplied\n    ///   - scalar: The scale by which the vector will be multiplied\n    /// - Returns: The vector with its magnitude scaled\n    static func * (vector: CGVector, scalar: CGFloat) -> CGVector {\n        return CGVector(dx: vector.dx * scalar, dy: vector.dy * scalar)\n    }\n\n    /// SwifterSwift: Multiplies a scalar and a vector (commutative).\n    ///\n    ///     let vector = CGVector(dx: 1, dy: 1)\n    ///     let largerVector = 2 * vector\n    ///\n    /// - Parameters:\n    ///   - scalar: The scalar by which the vector will be multiplied\n    ///   - vector: The vector to be multiplied\n    /// - Returns: The vector with its magnitude scaled\n    static func * (scalar: CGFloat, vector: CGVector) -> CGVector {\n        return CGVector(dx: scalar * vector.dx, dy: scalar * vector.dy)\n    }\n\n    /// SwifterSwift: Compound assignment operator for vector-scalr multiplication\n    ///\n    ///     var vector = CGVector(dx: 1, dy: 1)\n    ///     vector *= 2\n    ///\n    /// - Parameters:\n    ///   - vector: The vector to be multiplied\n    ///   - scalar: The scale by which the vector will be multiplied\n    static func *= (vector: inout CGVector, scalar: CGFloat) {\n        // swiftlint:disable:next shorthand_operator\n        vector = vector * scalar\n    }\n\n    /// SwifterSwift: Negates the vector. The direction is reversed, but magnitude remains the same.\n    ///\n    ///     let vector = CGVector(dx: 1, dy: 1)\n    ///     let reversedVector = -vector\n    ///\n    /// - Parameter vector: The vector to be negated\n    /// - Returns: The negated vector\n    static prefix func - (vector: CGVector) -> CGVector {\n        return CGVector(dx: -vector.dx, dy: -vector.dy)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreLocation/CLLocationArrayExtensions.swift",
    "content": "//\n//  CLLocationArrayExtensions.swift\n//  SwifterSwift\n//\n//  Created by Trevor Phillips on 09/01/20.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if canImport(CoreLocation)\nimport CoreLocation\n\n// MARK: - Methods\npublic extension Array where Element: CLLocation {\n\n    /// SwifterSwift: Calculates the sum of distances between each location in the array based on the curvature of the earth.\n    ///\n    /// - Parameter unitLength: The unit of length to return the distance in.\n    /// - Returns: The distance in the specified unit.\n    @available(tvOS 10.0, macOS 10.12, watchOS 3.0, *)\n    func distance(unitLength unit: UnitLength) -> Measurement<UnitLength> {\n        guard count > 1 else {\n          return Measurement(value: 0.0, unit: unit)\n        }\n        var distance = 0.0\n        for idx in 0..<count-1 {\n            distance += self[idx].distance(from: self[idx + 1])\n        }\n        return Measurement(value: distance, unit: UnitLength.meters).converted(to: unit)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreLocation/CLLocationExtensions.swift",
    "content": "//\n//  CLLocationExtensions.swift\n//  SwifterSwift\n//\n//  Created by Luciano Almeida on 21/04/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(CoreLocation)\nimport CoreLocation\n\n// MARK: - Methods\npublic extension CLLocation {\n\n    /// SwifterSwift: Calculate the half-way point along a great circle path between the two points.\n    ///\n    /// - Parameters:\n    ///   - start: Start location.\n    ///   - end: End location.\n    /// - Returns: Location that represents the half-way point.\n    static func midLocation(start: CLLocation, end: CLLocation) -> CLLocation {\n        let lat1 = Double.pi * start.coordinate.latitude / 180.0\n        let long1 = Double.pi * start.coordinate.longitude / 180.0\n        let lat2 = Double.pi * end.coordinate.latitude / 180.0\n        let long2 = Double.pi * end.coordinate.longitude / 180.0\n\n        // Formula\n        //    Bx = cos φ2 ⋅ cos Δλ\n        //    By = cos φ2 ⋅ sin Δλ\n        //    φm = atan2( sin φ1 + sin φ2, √(cos φ1 + Bx)² + By² )\n        //    λm = λ1 + atan2(By, cos(φ1)+Bx)\n        // Source: http://www.movable-type.co.uk/scripts/latlong.html\n\n        let bxLoc = cos(lat2) * cos(long2 - long1)\n        let byLoc = cos(lat2) * sin(long2 - long1)\n        let mlat = atan2(sin(lat1) + sin(lat2), sqrt((cos(lat1) + bxLoc) * (cos(lat1) + bxLoc) + (byLoc * byLoc)))\n        let mlong = (long1) + atan2(byLoc, cos(lat1) + bxLoc)\n\n        return CLLocation(latitude: (mlat * 180 / Double.pi), longitude: (mlong * 180 / Double.pi))\n    }\n\n    /// SwifterSwift: Calculate the half-way point along a great circle path between self and another points.\n    ///\n    /// - Parameter point: End location.\n    /// - Returns: Location that represents the half-way point.\n    func midLocation(to point: CLLocation) -> CLLocation {\n        return CLLocation.midLocation(start: self, end: point)\n    }\n\n    /// SwifterSwift: Calculates the bearing to another CLLocation.\n    ///\n    /// - Parameters:\n    ///   - destination: Location to calculate bearing.\n    /// - Returns: Calculated bearing degrees in the range 0° ... 360°\n    func bearing(to destination: CLLocation) -> Double {\n        // http://stackoverflow.com/questions/3925942/cllocation-category-for-calculating-bearing-w-haversine-function\n        let lat1 = Double.pi * coordinate.latitude / 180.0\n        let long1 = Double.pi * coordinate.longitude / 180.0\n        let lat2 = Double.pi * destination.coordinate.latitude / 180.0\n        let long2 = Double.pi * destination.coordinate.longitude / 180.0\n\n        // Formula: θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )\n        // Source: http://www.movable-type.co.uk/scripts/latlong.html\n\n        let rads = atan2(\n            sin(long2 - long1) * cos(lat2),\n            cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(long2 - long1))\n        let degrees = rads * 180 / Double.pi\n\n        return (degrees+360).truncatingRemainder(dividingBy: 360)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/CoreLocation/CLVisitExtensions.swift",
    "content": "//\n//  CLVisitExtensions.swift\n//  SwifterSwift\n//\n//  Created by Trevor Phillips on 09/01/20.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if canImport(CoreLocation) && (os(iOS) || targetEnvironment(macCatalyst))\nimport CoreLocation\n\n// MARK: - Properties\npublic extension CLVisit {\n\n    /// SwifterSwift: Retrieves a visit's location.\n    ///\n    /// - Returns: CLLocation\n    var location: CLLocation {\n        return CLLocation(latitude: self.coordinate.latitude, longitude: self.coordinate.longitude)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Dispatch/DispatchQueueExtensions.swift",
    "content": "//\n//  DispatchQueueExtensions.swift\n//  SwifterSwift\n//\n//  Created by Quentin Jin on 2018/10/13.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(Dispatch)\nimport Dispatch\n\n// MARK: - Properties\npublic extension DispatchQueue {\n\n    /// SwifterSwift: A Boolean value indicating whether the current dispatch queue is the main queue.\n    static var isMainQueue: Bool {\n        enum Static {\n            static var key: DispatchSpecificKey<Void> = {\n                let key = DispatchSpecificKey<Void>()\n                DispatchQueue.main.setSpecific(key: key, value: ())\n                return key\n            }()\n        }\n        return DispatchQueue.getSpecific(key: Static.key) != nil\n    }\n\n}\n\n// MARK: - Methods\npublic extension DispatchQueue {\n\n    /// SwifterSwift: Returns a Boolean value indicating whether the current dispatch queue is the specified queue.\n    ///\n    /// - Parameter queue: The queue to compare against.\n    /// - Returns: `true` if the current queue is the specified queue, otherwise `false`.\n    static func isCurrent(_ queue: DispatchQueue) -> Bool {\n        let key = DispatchSpecificKey<Void>()\n\n        queue.setSpecific(key: key, value: ())\n        defer { queue.setSpecific(key: key, value: nil) }\n\n        return DispatchQueue.getSpecific(key: key) != nil\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/CalendarExtensions.swift",
    "content": "//\n//  CalendarExtensions.swift\n//  SwifterSwift\n//\n//  Created by Chaithanya Prathyush on 09/11/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n// MARK: - Methods\npublic extension Calendar {\n\n    /// SwifterSwift: Return the number of days in the month for a specified 'Date'.\n    ///\n    ///\t\tlet date = Date() // \"Jan 12, 2017, 7:07 PM\"\n    ///\t\tCalendar.current.numberOfDaysInMonth(for: date) -> 31\n    ///\n    /// - Parameter date: the date form which the number of days in month is calculated.\n    /// - Returns: The number of days in the month of 'Date'.\n    func numberOfDaysInMonth(for date: Date) -> Int {\n        return range(of: .day, in: .month, for: date)!.count\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/DataExtensions.swift",
    "content": "//\n//  DataExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 07/12/2016.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n// MARK: - Properties\npublic extension Data {\n\n    /// SwifterSwift: Return data as an array of bytes.\n    var bytes: [UInt8] {\n        // http://stackoverflow.com/questions/38097710/swift-3-changes-for-getbytes-method\n        return [UInt8](self)\n    }\n\n}\n\n// MARK: - Methods\npublic extension Data {\n\n    /// SwifterSwift: String by encoding Data using the given encoding (if applicable).\n    ///\n    /// - Parameter encoding: encoding.\n    /// - Returns: String by encoding Data using the given encoding (if applicable).\n    func string(encoding: String.Encoding) -> String? {\n        return String(data: self, encoding: encoding)\n    }\n\n    /// SwifterSwift: Returns a Foundation object from given JSON data.\n    ///\n    /// - Parameter options: Options for reading the JSON data and creating the Foundation object.\n    ///\n    ///   For possible values, see `JSONSerialization.ReadingOptions`.\n    /// - Returns: A Foundation object from the JSON data in the receiver, or `nil` if an error occurs.\n    /// - Throws: An `NSError` if the receiver does not represent a valid JSON object.\n    func jsonObject(options: JSONSerialization.ReadingOptions = []) throws -> Any {\n        return try JSONSerialization.jsonObject(with: self, options: options)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/DateExtensions.swift",
    "content": "//\n//  DateExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/5/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n#if os(macOS) || os(iOS)\nimport Darwin\n#elseif os(Linux)\nimport Glibc\n#endif\n\n// MARK: - Enums\npublic extension Date {\n\n    /// SwifterSwift: Day name format.\n    ///\n    /// - threeLetters: 3 letter day abbreviation of day name.\n    /// - oneLetter: 1 letter day abbreviation of day name.\n    /// - full: Full day name.\n    enum DayNameStyle {\n\n        /// SwifterSwift: 3 letter day abbreviation of day name.\n        case threeLetters\n\n        /// SwifterSwift: 1 letter day abbreviation of day name.\n        case oneLetter\n\n        /// SwifterSwift: Full day name.\n        case full\n\n    }\n\n    /// SwifterSwift: Month name format.\n    ///\n    /// - threeLetters: 3 letter month abbreviation of month name.\n    /// - oneLetter: 1 letter month abbreviation of month name.\n    /// - full: Full month name.\n    enum MonthNameStyle {\n\n        /// SwifterSwift: 3 letter month abbreviation of month name.\n        case threeLetters\n\n        /// SwifterSwift: 1 letter month abbreviation of month name.\n        case oneLetter\n\n        /// SwifterSwift: Full month name.\n        case full\n\n    }\n\n}\n\n// MARK: - Properties\npublic extension Date {\n\n    /// SwifterSwift: User’s current calendar.\n    var calendar: Calendar {\n        return Calendar(identifier: Calendar.current.identifier) // Workaround to segfault on corelibs foundation https://bugs.swift.org/browse/SR-10147\n    }\n\n    /// SwifterSwift: Era.\n    ///\n    ///\t\tDate().era -> 1\n    ///\n    var era: Int {\n        return calendar.component(.era, from: self)\n    }\n\n    #if !os(Linux)\n    /// SwifterSwift: Quarter.\n    ///\n    ///\t\tDate().quarter -> 3 // date in third quarter of the year.\n    ///\n    var quarter: Int {\n        let month = Double(calendar.component(.month, from: self))\n        let numberOfMonths = Double(calendar.monthSymbols.count)\n        let numberOfMonthsInQuarter = numberOfMonths / 4\n        return Int(ceil(month/numberOfMonthsInQuarter))\n    }\n    #endif\n\n    /// SwifterSwift: Week of year.\n    ///\n    ///\t\tDate().weekOfYear -> 2 // second week in the year.\n    ///\n    var weekOfYear: Int {\n        return calendar.component(.weekOfYear, from: self)\n    }\n\n    /// SwifterSwift: Week of month.\n    ///\n    ///\t\tDate().weekOfMonth -> 3 // date is in third week of the month.\n    ///\n    var weekOfMonth: Int {\n        return calendar.component(.weekOfMonth, from: self)\n    }\n\n    /// SwifterSwift: Year.\n    ///\n    ///\t\tDate().year -> 2017\n    ///\n    ///\t\tvar someDate = Date()\n    ///\t\tsomeDate.year = 2000 // sets someDate's year to 2000\n    ///\n    var year: Int {\n        get {\n            return calendar.component(.year, from: self)\n        }\n        set {\n            guard newValue > 0 else { return }\n            let currentYear = calendar.component(.year, from: self)\n            let yearsToAdd = newValue - currentYear\n            if let date = calendar.date(byAdding: .year, value: yearsToAdd, to: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Month.\n    ///\n    /// \tDate().month -> 1\n    ///\n    /// \tvar someDate = Date()\n    /// \tsomeDate.month = 10 // sets someDate's month to 10.\n    ///\n    var month: Int {\n        get {\n            return calendar.component(.month, from: self)\n        }\n        set {\n            let allowedRange = calendar.range(of: .month, in: .year, for: self)!\n            guard allowedRange.contains(newValue) else { return }\n\n            let currentMonth = calendar.component(.month, from: self)\n            let monthsToAdd = newValue - currentMonth\n            if let date = calendar.date(byAdding: .month, value: monthsToAdd, to: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Day.\n    ///\n    /// \tDate().day -> 12\n    ///\n    /// \tvar someDate = Date()\n    /// \tsomeDate.day = 1 // sets someDate's day of month to 1.\n    ///\n    var day: Int {\n        get {\n            return calendar.component(.day, from: self)\n        }\n        set {\n            let allowedRange = calendar.range(of: .day, in: .month, for: self)!\n            guard allowedRange.contains(newValue) else { return }\n\n            let currentDay = calendar.component(.day, from: self)\n            let daysToAdd = newValue - currentDay\n            if let date = calendar.date(byAdding: .day, value: daysToAdd, to: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Weekday.\n    ///\n    /// \tDate().weekday -> 5 // fifth day in the current week.\n    ///\n    var weekday: Int {\n        return calendar.component(.weekday, from: self)\n    }\n\n    /// SwifterSwift: Hour.\n    ///\n    /// \tDate().hour -> 17 // 5 pm\n    ///\n    /// \tvar someDate = Date()\n    /// \tsomeDate.hour = 13 // sets someDate's hour to 1 pm.\n    ///\n    var hour: Int {\n        get {\n            return calendar.component(.hour, from: self)\n        }\n        set {\n            let allowedRange = calendar.range(of: .hour, in: .day, for: self)!\n            guard allowedRange.contains(newValue) else { return }\n\n            let currentHour = calendar.component(.hour, from: self)\n            let hoursToAdd = newValue - currentHour\n            if let date = calendar.date(byAdding: .hour, value: hoursToAdd, to: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Minutes.\n    ///\n    /// \tDate().minute -> 39\n    ///\n    /// \tvar someDate = Date()\n    /// \tsomeDate.minute = 10 // sets someDate's minutes to 10.\n    ///\n    var minute: Int {\n        get {\n            return calendar.component(.minute, from: self)\n        }\n        set {\n            let allowedRange = calendar.range(of: .minute, in: .hour, for: self)!\n            guard allowedRange.contains(newValue) else { return }\n\n            let currentMinutes = calendar.component(.minute, from: self)\n            let minutesToAdd = newValue - currentMinutes\n            if let date = calendar.date(byAdding: .minute, value: minutesToAdd, to: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Seconds.\n    ///\n    /// \tDate().second -> 55\n    ///\n    /// \tvar someDate = Date()\n    /// \tsomeDate.second = 15 // sets someDate's seconds to 15.\n    ///\n    var second: Int {\n        get {\n            return calendar.component(.second, from: self)\n        }\n        set {\n            let allowedRange = calendar.range(of: .second, in: .minute, for: self)!\n            guard allowedRange.contains(newValue) else { return }\n\n            let currentSeconds = calendar.component(.second, from: self)\n            let secondsToAdd = newValue - currentSeconds\n            if let date = calendar.date(byAdding: .second, value: secondsToAdd, to: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Nanoseconds.\n    ///\n    /// \tDate().nanosecond -> 981379985\n    ///\n    /// \tvar someDate = Date()\n    /// \tsomeDate.nanosecond = 981379985 // sets someDate's seconds to 981379985.\n    ///\n    var nanosecond: Int {\n        get {\n            return calendar.component(.nanosecond, from: self)\n        }\n        set {\n            #if targetEnvironment(macCatalyst)\n            // The `Calendar` implementation in `macCatalyst` does not know that a nanosecond is 1/1,000,000,000th of a second\n            let allowedRange = 0..<1_000_000_000\n            #else\n            let allowedRange = calendar.range(of: .nanosecond, in: .second, for: self)!\n            #endif\n            guard allowedRange.contains(newValue) else { return }\n\n            let currentNanoseconds = calendar.component(.nanosecond, from: self)\n            let nanosecondsToAdd = newValue - currentNanoseconds\n\n            if let date = calendar.date(byAdding: .nanosecond, value: nanosecondsToAdd, to: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Milliseconds.\n    ///\n    /// \tDate().millisecond -> 68\n    ///\n    /// \tvar someDate = Date()\n    /// \tsomeDate.millisecond = 68 // sets someDate's nanosecond to 68000000.\n    ///\n    var millisecond: Int {\n        get {\n            return calendar.component(.nanosecond, from: self) / 1_000_000\n        }\n        set {\n            let nanoSeconds = newValue * 1_000_000\n            #if targetEnvironment(macCatalyst)\n            // The `Calendar` implementation in `macCatalyst` does not know that a nanosecond is 1/1,000,000,000th of a second\n            let allowedRange = 0..<1_000_000_000\n            #else\n            let allowedRange = calendar.range(of: .nanosecond, in: .second, for: self)!\n            #endif\n            guard allowedRange.contains(nanoSeconds) else { return }\n\n            if let date = calendar.date(bySetting: .nanosecond, value: nanoSeconds, of: self) {\n                self = date\n            }\n        }\n    }\n\n    /// SwifterSwift: Check if date is in future.\n    ///\n    /// \tDate(timeInterval: 100, since: Date()).isInFuture -> true\n    ///\n    var isInFuture: Bool {\n        return self > Date()\n    }\n\n    /// SwifterSwift: Check if date is in past.\n    ///\n    /// \tDate(timeInterval: -100, since: Date()).isInPast -> true\n    ///\n    var isInPast: Bool {\n        return self < Date()\n    }\n\n    /// SwifterSwift: Check if date is within today.\n    ///\n    /// \tDate().isInToday -> true\n    ///\n    var isInToday: Bool {\n        return calendar.isDateInToday(self)\n    }\n\n    /// SwifterSwift: Check if date is within yesterday.\n    ///\n    /// \tDate().isInYesterday -> false\n    ///\n    var isInYesterday: Bool {\n        return calendar.isDateInYesterday(self)\n    }\n\n    /// SwifterSwift: Check if date is within tomorrow.\n    ///\n    /// \tDate().isInTomorrow -> false\n    ///\n    var isInTomorrow: Bool {\n        return calendar.isDateInTomorrow(self)\n    }\n\n    /// SwifterSwift: Check if date is within a weekend period.\n    var isInWeekend: Bool {\n        return calendar.isDateInWeekend(self)\n    }\n\n    /// SwifterSwift: Check if date is within a weekday period.\n    var isWorkday: Bool {\n        return !calendar.isDateInWeekend(self)\n    }\n\n    /// SwifterSwift: Check if date is within the current week.\n    var isInCurrentWeek: Bool {\n        return calendar.isDate(self, equalTo: Date(), toGranularity: .weekOfYear)\n    }\n\n    /// SwifterSwift: Check if date is within the current month.\n    var isInCurrentMonth: Bool {\n        return calendar.isDate(self, equalTo: Date(), toGranularity: .month)\n    }\n\n    /// SwifterSwift: Check if date is within the current year.\n    var isInCurrentYear: Bool {\n        return calendar.isDate(self, equalTo: Date(), toGranularity: .year)\n    }\n\n    /// SwifterSwift: ISO8601 string of format (yyyy-MM-dd'T'HH:mm:ss.SSS) from date.\n    ///\n    /// \tDate().iso8601String -> \"2017-01-12T14:51:29.574Z\"\n    ///\n    var iso8601String: String {\n        // https://github.com/justinmakaila/NSDate-ISO-8601/blob/master/NSDateISO8601.swift\n        let dateFormatter = DateFormatter()\n        dateFormatter.locale = Locale(identifier: \"en_US_POSIX\")\n        dateFormatter.timeZone = TimeZone(abbreviation: \"GMT\")\n        dateFormatter.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSS\"\n\n        return dateFormatter.string(from: self).appending(\"Z\")\n    }\n\n    /// SwifterSwift: Nearest five minutes to date.\n    ///\n    /// \tvar date = Date() // \"5:54 PM\"\n    /// \tdate.minute = 32 // \"5:32 PM\"\n    /// \tdate.nearestFiveMinutes // \"5:30 PM\"\n    ///\n    /// \tdate.minute = 44 // \"5:44 PM\"\n    /// \tdate.nearestFiveMinutes // \"5:45 PM\"\n    ///\n    var nearestFiveMinutes: Date {\n        var components = calendar.dateComponents([.year, .month, .day, .hour, .minute, .second, .nanosecond], from: self)\n        let min = components.minute!\n        components.minute! = min % 5 < 3 ? min - min % 5 : min + 5 - (min % 5)\n        components.second = 0\n        components.nanosecond = 0\n        return calendar.date(from: components)!\n    }\n\n    /// SwifterSwift: Nearest ten minutes to date.\n    ///\n    /// \tvar date = Date() // \"5:57 PM\"\n    /// \tdate.minute = 34 // \"5:34 PM\"\n    /// \tdate.nearestTenMinutes // \"5:30 PM\"\n    ///\n    /// \tdate.minute = 48 // \"5:48 PM\"\n    /// \tdate.nearestTenMinutes // \"5:50 PM\"\n    ///\n    var nearestTenMinutes: Date {\n        var components = calendar.dateComponents([.year, .month, .day, .hour, .minute, .second, .nanosecond], from: self)\n        let min = components.minute!\n        components.minute? = min % 10 < 6 ? min - min % 10 : min + 10 - (min % 10)\n        components.second = 0\n        components.nanosecond = 0\n        return calendar.date(from: components)!\n    }\n\n    /// SwifterSwift: Nearest quarter hour to date.\n    ///\n    /// \tvar date = Date() // \"5:57 PM\"\n    /// \tdate.minute = 34 // \"5:34 PM\"\n    /// \tdate.nearestQuarterHour // \"5:30 PM\"\n    ///\n    /// \tdate.minute = 40 // \"5:40 PM\"\n    /// \tdate.nearestQuarterHour // \"5:45 PM\"\n    ///\n    var nearestQuarterHour: Date {\n        var components = calendar.dateComponents([.year, .month, .day, .hour, .minute, .second, .nanosecond], from: self)\n        let min = components.minute!\n        components.minute! = min % 15 < 8 ? min - min % 15 : min + 15 - (min % 15)\n        components.second = 0\n        components.nanosecond = 0\n        return calendar.date(from: components)!\n    }\n\n    /// SwifterSwift: Nearest half hour to date.\n    ///\n    /// \tvar date = Date() // \"6:07 PM\"\n    /// \tdate.minute = 41 // \"6:41 PM\"\n    /// \tdate.nearestHalfHour // \"6:30 PM\"\n    ///\n    /// \tdate.minute = 51 // \"6:51 PM\"\n    /// \tdate.nearestHalfHour // \"7:00 PM\"\n    ///\n    var nearestHalfHour: Date {\n        var components = calendar.dateComponents([.year, .month, .day, .hour, .minute, .second, .nanosecond], from: self)\n        let min = components.minute!\n        components.minute! = min % 30 < 15 ? min - min % 30 : min + 30 - (min % 30)\n        components.second = 0\n        components.nanosecond = 0\n        return calendar.date(from: components)!\n    }\n\n    /// SwifterSwift: Nearest hour to date.\n    ///\n    /// \tvar date = Date() // \"6:17 PM\"\n    /// \tdate.nearestHour // \"6:00 PM\"\n    ///\n    /// \tdate.minute = 36 // \"6:36 PM\"\n    /// \tdate.nearestHour // \"7:00 PM\"\n    ///\n    var nearestHour: Date {\n        let min = calendar.component(.minute, from: self)\n        let components: Set<Calendar.Component> = [.year, .month, .day, .hour]\n        let date = calendar.date(from: calendar.dateComponents(components, from: self))!\n\n        if min < 30 {\n            return date\n        }\n        return calendar.date(byAdding: .hour, value: 1, to: date)!\n    }\n\n    /// SwifterSwift: Yesterday date.\n    ///\n    ///     let date = Date() // \"Oct 3, 2018, 10:57:11\"\n    ///     let yesterday = date.yesterday // \"Oct 2, 2018, 10:57:11\"\n    ///\n    var yesterday: Date {\n        return calendar.date(byAdding: .day, value: -1, to: self) ?? Date()\n    }\n\n    /// SwifterSwift: Tomorrow's date.\n    ///\n    ///     let date = Date() // \"Oct 3, 2018, 10:57:11\"\n    ///     let tomorrow = date.tomorrow // \"Oct 4, 2018, 10:57:11\"\n    ///\n    var tomorrow: Date {\n        return calendar.date(byAdding: .day, value: 1, to: self) ?? Date()\n    }\n\n    /// SwifterSwift: UNIX timestamp from date.\n    ///\n    ///\t\tDate().unixTimestamp -> 1484233862.826291\n    ///\n    var unixTimestamp: Double {\n        return timeIntervalSince1970\n    }\n\n}\n\n// MARK: - Methods\npublic extension Date {\n\n    /// SwifterSwift: Date by adding multiples of calendar component.\n    ///\n    /// \tlet date = Date() // \"Jan 12, 2017, 7:07 PM\"\n    /// \tlet date2 = date.adding(.minute, value: -10) // \"Jan 12, 2017, 6:57 PM\"\n    /// \tlet date3 = date.adding(.day, value: 4) // \"Jan 16, 2017, 7:07 PM\"\n    /// \tlet date4 = date.adding(.month, value: 2) // \"Mar 12, 2017, 7:07 PM\"\n    /// \tlet date5 = date.adding(.year, value: 13) // \"Jan 12, 2030, 7:07 PM\"\n    ///\n    /// - Parameters:\n    ///   - component: component type.\n    ///   - value: multiples of components to add.\n    /// - Returns: original date + multiples of component added.\n    func adding(_ component: Calendar.Component, value: Int) -> Date {\n        return calendar.date(byAdding: component, value: value, to: self)!\n    }\n\n    /// SwifterSwift: Add calendar component to date.\n    ///\n    /// \tvar date = Date() // \"Jan 12, 2017, 7:07 PM\"\n    /// \tdate.add(.minute, value: -10) // \"Jan 12, 2017, 6:57 PM\"\n    /// \tdate.add(.day, value: 4) // \"Jan 16, 2017, 7:07 PM\"\n    /// \tdate.add(.month, value: 2) // \"Mar 12, 2017, 7:07 PM\"\n    /// \tdate.add(.year, value: 13) // \"Jan 12, 2030, 7:07 PM\"\n    ///\n    /// - Parameters:\n    ///   - component: component type.\n    ///   - value: multiples of compnenet to add.\n    mutating func add(_ component: Calendar.Component, value: Int) {\n        if let date = calendar.date(byAdding: component, value: value, to: self) {\n            self = date\n        }\n    }\n\n    // swiftlint:disable cyclomatic_complexity function_body_length\n    /// SwifterSwift: Date by changing value of calendar component.\n    ///\n    ///     let date = Date() // \"Jan 12, 2017, 7:07 PM\"\n    ///     let date2 = date.changing(.minute, value: 10) // \"Jan 12, 2017, 6:10 PM\"\n    ///     let date3 = date.changing(.day, value: 4) // \"Jan 4, 2017, 7:07 PM\"\n    ///     let date4 = date.changing(.month, value: 2) // \"Feb 12, 2017, 7:07 PM\"\n    ///     let date5 = date.changing(.year, value: 2000) // \"Jan 12, 2000, 7:07 PM\"\n    ///\n    /// - Parameters:\n    ///   - component: component type.\n    ///   - value: new value of compnenet to change.\n    /// - Returns: original date after changing given component to given value.\n    func changing(_ component: Calendar.Component, value: Int) -> Date? {\n        switch component {\n        case .nanosecond:\n            #if targetEnvironment(macCatalyst)\n            // The `Calendar` implementation in `macCatalyst` does not know that a nanosecond is 1/1,000,000,000th of a second\n            let allowedRange = 0..<1_000_000_000\n            #else\n            let allowedRange = calendar.range(of: .nanosecond, in: .second, for: self)!\n            #endif\n            guard allowedRange.contains(value) else { return nil }\n            let currentNanoseconds = calendar.component(.nanosecond, from: self)\n            let nanosecondsToAdd = value - currentNanoseconds\n            return calendar.date(byAdding: .nanosecond, value: nanosecondsToAdd, to: self)\n\n        case .second:\n            let allowedRange = calendar.range(of: .second, in: .minute, for: self)!\n            guard allowedRange.contains(value) else { return nil }\n            let currentSeconds = calendar.component(.second, from: self)\n            let secondsToAdd = value - currentSeconds\n            return calendar.date(byAdding: .second, value: secondsToAdd, to: self)\n\n        case .minute:\n            let allowedRange = calendar.range(of: .minute, in: .hour, for: self)!\n            guard allowedRange.contains(value) else { return nil }\n            let currentMinutes = calendar.component(.minute, from: self)\n            let minutesToAdd = value - currentMinutes\n            return calendar.date(byAdding: .minute, value: minutesToAdd, to: self)\n\n        case .hour:\n            let allowedRange = calendar.range(of: .hour, in: .day, for: self)!\n            guard allowedRange.contains(value) else { return nil }\n            let currentHour = calendar.component(.hour, from: self)\n            let hoursToAdd = value - currentHour\n            return calendar.date(byAdding: .hour, value: hoursToAdd, to: self)\n\n        case .day:\n            let allowedRange = calendar.range(of: .day, in: .month, for: self)!\n            guard allowedRange.contains(value) else { return nil }\n            let currentDay = calendar.component(.day, from: self)\n            let daysToAdd = value - currentDay\n            return calendar.date(byAdding: .day, value: daysToAdd, to: self)\n\n        case .month:\n            let allowedRange = calendar.range(of: .month, in: .year, for: self)!\n            guard allowedRange.contains(value) else { return nil }\n            let currentMonth = calendar.component(.month, from: self)\n            let monthsToAdd = value - currentMonth\n            return calendar.date(byAdding: .month, value: monthsToAdd, to: self)\n\n        case .year:\n            guard value > 0 else { return nil }\n            let currentYear = calendar.component(.year, from: self)\n            let yearsToAdd = value - currentYear\n            return calendar.date(byAdding: .year, value: yearsToAdd, to: self)\n\n        default:\n            return calendar.date(bySetting: component, value: value, of: self)\n        }\n    }\n    #if !os(Linux)\n    // swiftlint:enable cyclomatic_complexity, function_body_length\n\n    /// SwifterSwift: Data at the beginning of calendar component.\n    ///\n    /// \tlet date = Date() // \"Jan 12, 2017, 7:14 PM\"\n    /// \tlet date2 = date.beginning(of: .hour) // \"Jan 12, 2017, 7:00 PM\"\n    /// \tlet date3 = date.beginning(of: .month) // \"Jan 1, 2017, 12:00 AM\"\n    /// \tlet date4 = date.beginning(of: .year) // \"Jan 1, 2017, 12:00 AM\"\n    ///\n    /// - Parameter component: calendar component to get date at the beginning of.\n    /// - Returns: date at the beginning of calendar component (if applicable).\n    func beginning(of component: Calendar.Component) -> Date? {\n        if component == .day {\n            return calendar.startOfDay(for: self)\n        }\n\n        var components: Set<Calendar.Component> {\n            switch component {\n            case .second:\n                return [.year, .month, .day, .hour, .minute, .second]\n\n            case .minute:\n                return [.year, .month, .day, .hour, .minute]\n\n            case .hour:\n                return [.year, .month, .day, .hour]\n\n            case .weekOfYear, .weekOfMonth:\n                return [.yearForWeekOfYear, .weekOfYear]\n\n            case .month:\n                return [.year, .month]\n\n            case .year:\n                return [.year]\n\n            default:\n                return []\n            }\n        }\n\n        guard !components.isEmpty else { return nil }\n        return calendar.date(from: calendar.dateComponents(components, from: self))\n    }\n    #endif\n\n    // swiftlint:disable function_body_length\n    /// SwifterSwift: Date at the end of calendar component.\n    ///\n    ///     let date = Date() // \"Jan 12, 2017, 7:27 PM\"\n    ///     let date2 = date.end(of: .day) // \"Jan 12, 2017, 11:59 PM\"\n    ///     let date3 = date.end(of: .month) // \"Jan 31, 2017, 11:59 PM\"\n    ///     let date4 = date.end(of: .year) // \"Dec 31, 2017, 11:59 PM\"\n    ///\n    /// - Parameter component: calendar component to get date at the end of.\n    /// - Returns: date at the end of calendar component (if applicable).\n    func end(of component: Calendar.Component) -> Date? {\n        switch component {\n        case .second:\n            var date = adding(.second, value: 1)\n            date = calendar.date(from:\n                calendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: date))!\n            date.add(.second, value: -1)\n            return date\n\n        case .minute:\n            var date = adding(.minute, value: 1)\n            let after = calendar.date(from:\n                calendar.dateComponents([.year, .month, .day, .hour, .minute], from: date))!\n            date = after.adding(.second, value: -1)\n            return date\n\n        case .hour:\n            var date = adding(.hour, value: 1)\n            let after = calendar.date(from:\n                calendar.dateComponents([.year, .month, .day, .hour], from: date))!\n            date = after.adding(.second, value: -1)\n            return date\n\n        case .day:\n            var date = adding(.day, value: 1)\n            date = calendar.startOfDay(for: date)\n            date.add(.second, value: -1)\n            return date\n\n        case .weekOfYear, .weekOfMonth:\n            var date = self\n            let beginningOfWeek = calendar.date(from:\n                calendar.dateComponents([.yearForWeekOfYear, .weekOfYear], from: date))!\n            date = beginningOfWeek.adding(.day, value: 7).adding(.second, value: -1)\n            return date\n\n        case .month:\n            var date = adding(.month, value: 1)\n            let after = calendar.date(from:\n                calendar.dateComponents([.year, .month], from: date))!\n            date = after.adding(.second, value: -1)\n            return date\n\n        case .year:\n            var date = adding(.year, value: 1)\n            let after = calendar.date(from:\n                calendar.dateComponents([.year], from: date))!\n            date = after.adding(.second, value: -1)\n            return date\n\n        default:\n            return nil\n        }\n    }\n    // swiftlint:enable function_body_length\n\n    /// SwifterSwift: Check if date is in current given calendar component.\n    ///\n    /// \tDate().isInCurrent(.day) -> true\n    /// \tDate().isInCurrent(.year) -> true\n    ///\n    /// - Parameter component: calendar component to check.\n    /// - Returns: true if date is in current given calendar component.\n    func isInCurrent(_ component: Calendar.Component) -> Bool {\n        return calendar.isDate(self, equalTo: Date(), toGranularity: component)\n    }\n\n    /// SwifterSwift: Date string from date.\n    ///\n    ///     Date().string(withFormat: \"dd/MM/yyyy\") -> \"1/12/17\"\n    ///     Date().string(withFormat: \"HH:mm\") -> \"23:50\"\n    ///     Date().string(withFormat: \"dd/MM/yyyy HH:mm\") -> \"1/12/17 23:50\"\n    ///\n    /// - Parameter format: Date format (default is \"dd/MM/yyyy\").\n    /// - Returns: date string.\n    func string(withFormat format: String = \"dd/MM/yyyy HH:mm\") -> String {\n        let dateFormatter = DateFormatter()\n        dateFormatter.dateFormat = format\n        return dateFormatter.string(from: self)\n    }\n\n    /// SwifterSwift: Date string from date.\n    ///\n    /// \tDate().dateString(ofStyle: .short) -> \"1/12/17\"\n    /// \tDate().dateString(ofStyle: .medium) -> \"Jan 12, 2017\"\n    /// \tDate().dateString(ofStyle: .long) -> \"January 12, 2017\"\n    /// \tDate().dateString(ofStyle: .full) -> \"Thursday, January 12, 2017\"\n    ///\n    /// - Parameter style: DateFormatter style (default is .medium).\n    /// - Returns: date string.\n    func dateString(ofStyle style: DateFormatter.Style = .medium) -> String {\n        let dateFormatter = DateFormatter()\n        dateFormatter.timeStyle = .none\n        dateFormatter.dateStyle = style\n        return dateFormatter.string(from: self)\n    }\n\n    /// SwifterSwift: Date and time string from date.\n    ///\n    /// \tDate().dateTimeString(ofStyle: .short) -> \"1/12/17, 7:32 PM\"\n    /// \tDate().dateTimeString(ofStyle: .medium) -> \"Jan 12, 2017, 7:32:00 PM\"\n    /// \tDate().dateTimeString(ofStyle: .long) -> \"January 12, 2017 at 7:32:00 PM GMT+3\"\n    /// \tDate().dateTimeString(ofStyle: .full) -> \"Thursday, January 12, 2017 at 7:32:00 PM GMT+03:00\"\n    ///\n    /// - Parameter style: DateFormatter style (default is .medium).\n    /// - Returns: date and time string.\n    func dateTimeString(ofStyle style: DateFormatter.Style = .medium) -> String {\n        let dateFormatter = DateFormatter()\n        dateFormatter.timeStyle = style\n        dateFormatter.dateStyle = style\n        return dateFormatter.string(from: self)\n    }\n\n    /// SwifterSwift: Time string from date\n    ///\n    /// \tDate().timeString(ofStyle: .short) -> \"7:37 PM\"\n    /// \tDate().timeString(ofStyle: .medium) -> \"7:37:02 PM\"\n    /// \tDate().timeString(ofStyle: .long) -> \"7:37:02 PM GMT+3\"\n    /// \tDate().timeString(ofStyle: .full) -> \"7:37:02 PM GMT+03:00\"\n    ///\n    /// - Parameter style: DateFormatter style (default is .medium).\n    /// - Returns: time string.\n    func timeString(ofStyle style: DateFormatter.Style = .medium) -> String {\n        let dateFormatter = DateFormatter()\n        dateFormatter.timeStyle = style\n        dateFormatter.dateStyle = .none\n        return dateFormatter.string(from: self)\n    }\n\n    /// SwifterSwift: Day name from date.\n    ///\n    /// \tDate().dayName(ofStyle: .oneLetter) -> \"T\"\n    /// \tDate().dayName(ofStyle: .threeLetters) -> \"Thu\"\n    /// \tDate().dayName(ofStyle: .full) -> \"Thursday\"\n    ///\n    /// - Parameter Style: style of day name (default is DayNameStyle.full).\n    /// - Returns: day name string (example: W, Wed, Wednesday).\n    func dayName(ofStyle style: DayNameStyle = .full) -> String {\n        // http://www.codingexplorer.com/swiftly-getting-human-readable-date-nsdateformatter/\n        let dateFormatter = DateFormatter()\n        var format: String {\n            switch style {\n            case .oneLetter:\n                return \"EEEEE\"\n            case .threeLetters:\n                return \"EEE\"\n            case .full:\n                return \"EEEE\"\n            }\n        }\n        dateFormatter.setLocalizedDateFormatFromTemplate(format)\n        return dateFormatter.string(from: self)\n    }\n\n    /// SwifterSwift: Month name from date.\n    ///\n    /// \tDate().monthName(ofStyle: .oneLetter) -> \"J\"\n    /// \tDate().monthName(ofStyle: .threeLetters) -> \"Jan\"\n    /// \tDate().monthName(ofStyle: .full) -> \"January\"\n    ///\n    /// - Parameter Style: style of month name (default is MonthNameStyle.full).\n    /// - Returns: month name string (example: D, Dec, December).\n    func monthName(ofStyle style: MonthNameStyle = .full) -> String {\n        // http://www.codingexplorer.com/swiftly-getting-human-readable-date-nsdateformatter/\n        let dateFormatter = DateFormatter()\n        var format: String {\n            switch style {\n            case .oneLetter:\n                return \"MMMMM\"\n            case .threeLetters:\n                return \"MMM\"\n            case .full:\n                return \"MMMM\"\n            }\n        }\n        dateFormatter.setLocalizedDateFormatFromTemplate(format)\n        return dateFormatter.string(from: self)\n    }\n\n    /// SwifterSwift: get number of seconds between two date\n    ///\n    /// - Parameter date: date to compate self to.\n    /// - Returns: number of seconds between self and given date.\n    func secondsSince(_ date: Date) -> Double {\n        return timeIntervalSince(date)\n    }\n\n    /// SwifterSwift: get number of minutes between two date\n    ///\n    /// - Parameter date: date to compate self to.\n    /// - Returns: number of minutes between self and given date.\n    func minutesSince(_ date: Date) -> Double {\n        return timeIntervalSince(date)/60\n    }\n\n    /// SwifterSwift: get number of hours between two date\n    ///\n    /// - Parameter date: date to compate self to.\n    /// - Returns: number of hours between self and given date.\n    func hoursSince(_ date: Date) -> Double {\n        return timeIntervalSince(date)/3600\n    }\n\n    /// SwifterSwift: get number of days between two date\n    ///\n    /// - Parameter date: date to compate self to.\n    /// - Returns: number of days between self and given date.\n    func daysSince(_ date: Date) -> Double {\n        return timeIntervalSince(date)/(3600*24)\n    }\n\n    /// SwifterSwift: check if a date is between two other dates\n    ///\n    /// - Parameters:\n    ///   - startDate: start date to compare self to.\n    ///   - endDate: endDate date to compare self to.\n    ///   - includeBounds: true if the start and end date should be included (default is false)\n    /// - Returns: true if the date is between the two given dates.\n    func isBetween(_ startDate: Date, _ endDate: Date, includeBounds: Bool = false) -> Bool {\n        if includeBounds {\n            return startDate.compare(self).rawValue * compare(endDate).rawValue >= 0\n        }\n        return startDate.compare(self).rawValue * compare(endDate).rawValue > 0\n    }\n\n    /// SwifterSwift: check if a date is a number of date components of another date\n    ///\n    /// - Parameters:\n    ///   - value: number of times component is used in creating range\n    ///   - component: Calendar.Component to use.\n    ///   - date: Date to compare self to.\n    /// - Returns: true if the date is within a number of components of another date\n    func isWithin(_ value: UInt, _ component: Calendar.Component, of date: Date) -> Bool {\n        let components = calendar.dateComponents([component], from: self, to: date)\n        let componentValue = components.value(for: component)!\n        return abs(componentValue) <= value\n    }\n\n    /// SwifterSwift: Returns a random date within the specified range.\n    ///\n    /// - Parameter range: The range in which to create a random date. `range` must not be empty.\n    /// - Returns: A random date within the bounds of `range`.\n    static func random(in range: Range<Date>) -> Date {\n        return Date(timeIntervalSinceReferenceDate:\n            TimeInterval.random(in: range.lowerBound.timeIntervalSinceReferenceDate..<range.upperBound.timeIntervalSinceReferenceDate))\n    }\n\n    /// SwifterSwift: Returns a random date within the specified range.\n    ///\n    /// - Parameter range: The range in which to create a random date.\n    /// - Returns: A random date within the bounds of `range`.\n    static func random(in range: ClosedRange<Date>) -> Date {\n        return Date(timeIntervalSinceReferenceDate:\n            TimeInterval.random(in: range.lowerBound.timeIntervalSinceReferenceDate...range.upperBound.timeIntervalSinceReferenceDate))\n    }\n\n    /// SwifterSwift: Returns a random date within the specified range, using the given generator as a source for randomness.\n    ///\n    /// - Parameters:\n    ///   - range: The range in which to create a random date. `range` must not be empty.\n    ///   - generator: The random number generator to use when creating the new random date.\n    /// - Returns: A random date within the bounds of `range`.\n    static func random<T>(in range: Range<Date>, using generator: inout T) -> Date where T: RandomNumberGenerator {\n        return Date(timeIntervalSinceReferenceDate:\n            TimeInterval.random(in: range.lowerBound.timeIntervalSinceReferenceDate..<range.upperBound.timeIntervalSinceReferenceDate,\n                                using: &generator))\n    }\n\n    /// SwifterSwift: Returns a random date within the specified range, using the given generator as a source for randomness.\n    ///\n    /// - Parameters:\n    ///   - range: The range in which to create a random date.\n    ///   - generator: The random number generator to use when creating the new random date.\n    /// - Returns: A random date within the bounds of `range`.\n    static func random<T>(in range: ClosedRange<Date>, using generator: inout T) -> Date where T: RandomNumberGenerator {\n        return Date(timeIntervalSinceReferenceDate:\n            TimeInterval.random(in: range.lowerBound.timeIntervalSinceReferenceDate...range.upperBound.timeIntervalSinceReferenceDate,\n                                using: &generator))\n    }\n\n}\n\n// MARK: - Initializers\npublic extension Date {\n\n    /// SwifterSwift: Create a new date form calendar components.\n    ///\n    /// \tlet date = Date(year: 2010, month: 1, day: 12) // \"Jan 12, 2010, 7:45 PM\"\n    ///\n    /// - Parameters:\n    ///   - calendar: Calendar (default is current).\n    ///   - timeZone: TimeZone (default is current).\n    ///   - era: Era (default is current era).\n    ///   - year: Year (default is current year).\n    ///   - month: Month (default is current month).\n    ///   - day: Day (default is today).\n    ///   - hour: Hour (default is current hour).\n    ///   - minute: Minute (default is current minute).\n    ///   - second: Second (default is current second).\n    ///   - nanosecond: Nanosecond (default is current nanosecond).\n    init?(\n        calendar: Calendar? = Calendar.current,\n        timeZone: TimeZone? = NSTimeZone.default,\n        era: Int? = Date().era,\n        year: Int? = Date().year,\n        month: Int? = Date().month,\n        day: Int? = Date().day,\n        hour: Int? = Date().hour,\n        minute: Int? = Date().minute,\n        second: Int? = Date().second,\n        nanosecond: Int? = Date().nanosecond) {\n\n        var components = DateComponents()\n        components.calendar = calendar\n        components.timeZone = timeZone\n        components.era = era\n        components.year = year\n        components.month = month\n        components.day = day\n        components.hour = hour\n        components.minute = minute\n        components.second = second\n        components.nanosecond = nanosecond\n\n        guard let date = calendar?.date(from: components) else { return nil }\n        self = date\n    }\n\n    /// SwifterSwift: Create date object from ISO8601 string.\n    ///\n    /// \tlet date = Date(iso8601String: \"2017-01-12T16:48:00.959Z\") // \"Jan 12, 2017, 7:48 PM\"\n    ///\n    /// - Parameter iso8601String: ISO8601 string of format (yyyy-MM-dd'T'HH:mm:ss.SSSZ).\n    init?(iso8601String: String) {\n        // https://github.com/justinmakaila/NSDate-ISO-8601/blob/master/NSDateISO8601.swift\n        let dateFormatter = DateFormatter()\n        dateFormatter.locale = Locale(identifier: \"en_US_POSIX\")\n        dateFormatter.timeZone = TimeZone.current\n        dateFormatter.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSSZ\"\n        guard let date = dateFormatter.date(from: iso8601String) else { return nil }\n        self = date\n    }\n\n    /// SwifterSwift: Create new date object from UNIX timestamp.\n    ///\n    /// \tlet date = Date(unixTimestamp: 1484239783.922743) // \"Jan 12, 2017, 7:49 PM\"\n    ///\n    /// - Parameter unixTimestamp: UNIX timestamp.\n    init(unixTimestamp: Double) {\n        self.init(timeIntervalSince1970: unixTimestamp)\n    }\n\n    /// SwifterSwift: Create date object from Int literal\n    ///\n    ///     let date = Date(integerLiteral: 2017_12_25) // \"2017-12-25 00:00:00 +0000\"\n    /// - Parameter value: Int value, e.g. 20171225, or 2017_12_25 etc.\n    init?(integerLiteral value: Int) {\n        let formatter = DateFormatter()\n        formatter.dateFormat = \"yyyyMMdd\"\n        guard let date = formatter.date(from: String(value)) else { return nil }\n        self = date\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/FileManagerExtensions.swift",
    "content": "//\n//  FileManagerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Jason Jon E. Carreos on 05/02/2018.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\npublic extension FileManager {\n\n    /// SwifterSwift: Read from a JSON file at a given path.\n    ///\n    /// - Parameters:\n    ///   - path: JSON file path.\n    ///   - readingOptions: JSONSerialization reading options.\n    /// - Returns: Optional dictionary.\n    /// - Throws: Throws any errors thrown by Data creation or JSON serialization.\n    func jsonFromFile(\n        atPath path: String,\n        readingOptions: JSONSerialization.ReadingOptions = .allowFragments) throws -> [String: Any]? {\n\n        let data = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe)\n        let json = try JSONSerialization.jsonObject(with: data, options: readingOptions)\n\n        return json as? [String: Any]\n    }\n\n    #if !os(Linux)\n    /// SwifterSwift: Read from a JSON file with a given filename.\n    ///\n    /// - Parameters:\n    ///   - filename: File to read.\n    ///   - bundleClass: Bundle where the file is associated.\n    ///   - readingOptions: JSONSerialization reading options.\n    /// - Returns: Optional dictionary.\n    /// - Throws: Throws any errors thrown by Data creation or JSON serialization.\n    func jsonFromFile(\n        withFilename filename: String,\n        at bundleClass: AnyClass? = nil,\n        readingOptions: JSONSerialization.ReadingOptions = .allowFragments) throws -> [String: Any]? {\n        // https://stackoverflow.com/questions/24410881/reading-in-a-json-file-using-swift\n\n        // To handle cases that provided filename has an extension\n        let name = filename.components(separatedBy: \".\")[0]\n        let bundle = bundleClass != nil ? Bundle(for: bundleClass!) : Bundle.main\n\n        if let path = bundle.path(forResource: name, ofType: \"json\") {\n            let data = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe)\n            let json = try JSONSerialization.jsonObject(with: data, options: readingOptions)\n\n            return json as? [String: Any]\n        }\n\n        return nil\n    }\n    #endif\n\n    /// SwifterSwift: Creates a unique directory for saving temporary files. The directory can be used to create multiple temporary files used for a common purpose.\n    ///\n    ///     let tempDirectory = try fileManager.createTemporaryDirectory()\n    ///     let tempFile1URL = tempDirectory.appendingPathComponent(ProcessInfo().globallyUniqueString)\n    ///     let tempFile2URL = tempDirectory.appendingPathComponent(ProcessInfo().globallyUniqueString)\n    ///\n    /// - Returns: A URL to a new directory for saving temporary files.\n    /// - Throws: An error if a temporary directory cannot be found or created.\n    func createTemporaryDirectory() throws -> URL {\n        #if !os(Linux)\n        let temporaryDirectoryURL: URL\n        if #available(OSX 10.12, tvOS 10.0, watchOS 3.0, *) {\n            temporaryDirectoryURL = temporaryDirectory\n        } else {\n            temporaryDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)\n        }\n        return try url(for: .itemReplacementDirectory,\n                       in: .userDomainMask,\n                       appropriateFor: temporaryDirectoryURL,\n                       create: true)\n        #else\n        let envs = ProcessInfo.processInfo.environment\n        let env = envs[\"TMPDIR\"] ?? envs[\"TEMP\"] ?? envs[\"TMP\"] ?? \"/tmp\"\n        let dir = \"/\\(env)/file-temp.XXXXXX\"\n        var template = [UInt8](dir.utf8).map({ Int8($0) }) + [Int8(0)]\n        guard mkdtemp(&template) != nil else { throw CocoaError.error(.featureUnsupported) }\n        return URL(fileURLWithPath: String(cString: template))\n        #endif\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/LocaleExtensions.swift",
    "content": "//\n//  LocalExtensions.swift\n//  SwifterSwift\n//\n//  Created by Basem Emara on 4/19/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n// MARK: - Properties\npublic extension Locale {\n\n    /// SwifterSwift: UNIX representation of locale usually used for normalizing.\n    static var posix: Locale {\n        return Locale(identifier: \"en_US_POSIX\")\n    }\n\n    /// SwifterSwift: Returns bool value indicating if locale has 12h format.\n    var is12HourTimeFormat: Bool {\n        let dateFormatter = DateFormatter()\n        dateFormatter.timeStyle = .short\n        dateFormatter.dateStyle = .none\n        dateFormatter.locale = self\n        let dateString = dateFormatter.string(from: Date())\n        return dateString.contains(dateFormatter.amSymbol) || dateString.contains(dateFormatter.pmSymbol)\n    }\n\n}\n\n// MARK: - Functions\npublic extension Locale {\n\n    /// SwifterSwift: Get the flag emoji for a given country region code.\n    /// - Parameter isoRegionCode: The IOS region code.\n    ///\n    /// Adapted from https://stackoverflow.com/a/30403199/1627511\n    static func flagEmoji(forRegionCode isoRegionCode: String) -> String? {\n        #if !os(Linux)\n        guard isoRegionCodes.contains(isoRegionCode) else { return nil }\n        #endif\n\n        return isoRegionCode.unicodeScalars.reduce(into: String()) {\n            guard let flagScalar = UnicodeScalar(UInt32(127397) + $1.value) else { return }\n            $0.unicodeScalars.append(flagScalar)\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/NSAttributedStringExtensions.swift",
    "content": "//\n//  NSAttributedStringExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 26/11/2016.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n#if canImport(UIKit)\nimport UIKit\n#endif\n\n#if canImport(AppKit)\nimport AppKit\n#endif\n\n// MARK: - Properties\npublic extension NSAttributedString {\n\n    #if os(iOS)\n    /// SwifterSwift: Bolded string.\n    var bolded: NSAttributedString {\n        return applying(attributes: [.font: UIFont.boldSystemFont(ofSize: UIFont.systemFontSize)])\n    }\n    #endif\n\n    #if !os(Linux)\n    /// SwifterSwift: Underlined string.\n    var underlined: NSAttributedString {\n        return applying(attributes: [.underlineStyle: NSUnderlineStyle.single.rawValue])\n    }\n    #endif\n\n    #if os(iOS)\n    /// SwifterSwift: Italicized string.\n    var italicized: NSAttributedString {\n        return applying(attributes: [.font: UIFont.italicSystemFont(ofSize: UIFont.systemFontSize)])\n    }\n    #endif\n\n    #if !os(Linux)\n    /// SwifterSwift: Struckthrough string.\n    var struckthrough: NSAttributedString {\n        return applying(attributes: [.strikethroughStyle: NSNumber(value: NSUnderlineStyle.single.rawValue as Int)])\n    }\n    #endif\n\n    #if !os(Linux)\n    /// SwifterSwift: Dictionary of the attributes applied across the whole string\n    var attributes: [NSAttributedString.Key: Any] {\n        guard self.length > 0 else { return [:] }\n        return attributes(at: 0, effectiveRange: nil)\n    }\n    #endif\n\n}\n\n// MARK: - Methods\npublic extension NSAttributedString {\n\n    #if !os(Linux)\n    /// SwifterSwift: Applies given attributes to the new instance of NSAttributedString initialized with self object\n    ///\n    /// - Parameter attributes: Dictionary of attributes\n    /// - Returns: NSAttributedString with applied attributes\n    fileprivate func applying(attributes: [NSAttributedString.Key: Any]) -> NSAttributedString {\n        let copy = NSMutableAttributedString(attributedString: self)\n        let range = (string as NSString).range(of: string)\n        copy.addAttributes(attributes, range: range)\n\n        return copy\n    }\n    #endif\n\n    #if canImport(AppKit) || canImport(UIKit)\n    /// SwifterSwift: Add color to NSAttributedString.\n    ///\n    /// - Parameter color: text color.\n    /// - Returns: a NSAttributedString colored with given color.\n    func colored(with color: Color) -> NSAttributedString {\n        return applying(attributes: [.foregroundColor: color])\n    }\n    #endif\n\n    #if !os(Linux)\n    /// SwifterSwift: Apply attributes to substrings matching a regular expression\n    ///\n    /// - Parameters:\n    ///   - attributes: Dictionary of attributes\n    ///   - pattern: a regular expression to target\n    ///   - options: The regular expression options that are applied to the expression during matching. See NSRegularExpression.Options for possible values.\n    /// - Returns: An NSAttributedString with attributes applied to substrings matching the pattern\n    func applying(attributes: [NSAttributedString.Key: Any],\n                  toRangesMatching pattern: String,\n                  options: NSRegularExpression.Options = []) -> NSAttributedString {\n        guard let pattern = try? NSRegularExpression(pattern: pattern, options: options) else { return self }\n\n        let matches = pattern.matches(in: string, options: [], range: NSRange(0..<length))\n        let result = NSMutableAttributedString(attributedString: self)\n\n        for match in matches {\n            result.addAttributes(attributes, range: match.range)\n        }\n\n        return result\n    }\n\n    /// SwifterSwift: Apply attributes to occurrences of a given string\n    ///\n    /// - Parameters:\n    ///   - attributes: Dictionary of attributes\n    ///   - target: a subsequence string for the attributes to be applied to\n    /// - Returns: An NSAttributedString with attributes applied on the target string\n    func applying<T: StringProtocol>(attributes: [NSAttributedString.Key: Any], toOccurrencesOf target: T) -> NSAttributedString {\n        let pattern = \"\\\\Q\\(target)\\\\E\"\n\n        return applying(attributes: attributes, toRangesMatching: pattern)\n    }\n    #endif\n\n}\n\n// MARK: - Operators\npublic extension NSAttributedString {\n\n    /// SwifterSwift: Add a NSAttributedString to another NSAttributedString.\n    ///\n    /// - Parameters:\n    ///   - lhs: NSAttributedString to add to.\n    ///   - rhs: NSAttributedString to add.\n    static func += (lhs: inout NSAttributedString, rhs: NSAttributedString) {\n        let string = NSMutableAttributedString(attributedString: lhs)\n        string.append(rhs)\n        lhs = string\n    }\n\n    /// SwifterSwift: Add a NSAttributedString to another NSAttributedString and return a new NSAttributedString instance.\n    ///\n    /// - Parameters:\n    ///   - lhs: NSAttributedString to add.\n    ///   - rhs: NSAttributedString to add.\n    /// - Returns: New instance with added NSAttributedString.\n    static func + (lhs: NSAttributedString, rhs: NSAttributedString) -> NSAttributedString {\n        let string = NSMutableAttributedString(attributedString: lhs)\n        string.append(rhs)\n        return NSAttributedString(attributedString: string)\n    }\n\n    /// SwifterSwift: Add a NSAttributedString to another NSAttributedString.\n    ///\n    /// - Parameters:\n    ///   - lhs: NSAttributedString to add to.\n    ///   - rhs: String to add.\n    static func += (lhs: inout NSAttributedString, rhs: String) {\n        lhs += NSAttributedString(string: rhs)\n    }\n\n    /// SwifterSwift: Add a NSAttributedString to another NSAttributedString and return a new NSAttributedString instance.\n    ///\n    /// - Parameters:\n    ///   - lhs: NSAttributedString to add.\n    ///   - rhs: String to add.\n    /// - Returns: New instance with added NSAttributedString.\n    static func + (lhs: NSAttributedString, rhs: String) -> NSAttributedString {\n        return lhs + NSAttributedString(string: rhs)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/NSPredicateExtensions.swift",
    "content": "//\n//  NSPredicateExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 04.10.17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n// MARK: - Properties\npublic extension NSPredicate {\n\n    /// SwifterSwift: Returns a new predicate formed by NOT-ing the predicate.\n    var not: NSCompoundPredicate {\n        return NSCompoundPredicate(notPredicateWithSubpredicate: self)\n    }\n\n}\n\n// MARK: - Methods\npublic extension NSPredicate {\n\n    /// SwifterSwift: Returns a new predicate formed by AND-ing the argument to the predicate.\n    ///\n    /// - Parameter predicate: NSPredicate\n    /// - Returns: NSCompoundPredicate\n    func and(_ predicate: NSPredicate) -> NSCompoundPredicate {\n        return NSCompoundPredicate(andPredicateWithSubpredicates: [self, predicate])\n    }\n\n    /// SwifterSwift: Returns a new predicate formed by OR-ing the argument to the predicate.\n    ///\n    /// - Parameter predicate: NSPredicate\n    /// - Returns: NSCompoundPredicate\n    func or(_ predicate: NSPredicate) -> NSCompoundPredicate {\n        return NSCompoundPredicate(orPredicateWithSubpredicates: [self, predicate])\n    }\n\n}\n\n// MARK: - Operators\npublic extension NSPredicate {\n\n    /// SwifterSwift: Returns a new predicate formed by NOT-ing the predicate.\n    /// - Parameters: rhs: NSPredicate to convert.\n    /// - Returns: NSCompoundPredicate\n    static prefix func ! (rhs: NSPredicate) -> NSCompoundPredicate {\n        return rhs.not\n    }\n\n    /// SwifterSwift: Returns a new predicate formed by AND-ing the argument to the predicate.\n    ///\n    /// - Parameters:\n    ///   - lhs: NSPredicate.\n    ///   - rhs: NSPredicate.\n    /// - Returns: NSCompoundPredicate\n    static func + (lhs: NSPredicate, rhs: NSPredicate) -> NSCompoundPredicate {\n        return lhs.and(rhs)\n    }\n\n    /// SwifterSwift: Returns a new predicate formed by OR-ing the argument to the predicate.\n    ///\n    /// - Parameters:\n    ///   - lhs: NSPredicate.\n    ///   - rhs: NSPredicate.\n    /// - Returns: NSCompoundPredicate\n    static func | (lhs: NSPredicate, rhs: NSPredicate) -> NSCompoundPredicate {\n        return lhs.or(rhs)\n    }\n\n    /// SwifterSwift: Returns a new predicate formed by remove the argument to the predicate.\n    ///\n    /// - Parameters:\n    ///   - lhs: NSPredicate.\n    ///   - rhs: NSPredicate.\n    /// - Returns: NSCompoundPredicate\n    static func - (lhs: NSPredicate, rhs: NSPredicate) -> NSCompoundPredicate {\n        return lhs + !rhs\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/NSRegularExpressionExtensions.swift",
    "content": "//\n//  NSRegularExpressionExtensions.swift\n//  SwifterSwift\n//\n//  Created by Guy Kogus on 09/10/2019.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\npublic extension NSRegularExpression {\n\n    /// SwifterSwift: Enumerates the string allowing the Block to handle each regular expression match.\n    ///\n    /// - Parameters:\n    ///   - string: The string.\n    ///   - options: The matching options to report. See `NSRegularExpression.MatchingOptions` for the supported values.\n    ///   - range: The range of the string to test.\n    ///   - block: The Block enumerates the matches of the regular expression in the string.\n    ///     The block takes three arguments and returns `Void`:\n    ///   - result:\n    ///     An `NSTextCheckingResult` specifying the match. This result gives the overall matched range via its `range` property, and the range of each individual capture group via its `range(at:)` method. The range {NSNotFound, 0} is returned if one of the capture groups did not participate in this particular match.\n    ///   - flags:\n    ///     The current state of the matching progress. See `NSRegularExpression.MatchingFlags` for the possible values.\n    ///   - stop:\n    ///     A reference to a Boolean value. The Block can set the value to true to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to true within the Block.\n    #if os(Linux)\n    func enumerateMatches(in string: String,\n                          options: MatchingOptions = [],\n                          range: Range<String.Index>,\n                          using block: @escaping (_ result: NSTextCheckingResult?, _ flags: MatchingFlags, _ stop: inout Bool) -> Void) {\n        enumerateMatches(in: string,\n                         options: options,\n                         range: NSRange(range, in: string)) { result, flags, stop in\n                            var shouldStop = false\n                            block(result, flags, &shouldStop)\n                            if shouldStop {\n                                stop.pointee = true\n                            }\n        }\n    }\n    #else\n    func enumerateMatches(in string: String,\n                          options: MatchingOptions = [],\n                          range: Range<String.Index>,\n                          using block: (_ result: NSTextCheckingResult?, _ flags: MatchingFlags, _ stop: inout Bool) -> Void) {\n        enumerateMatches(in: string,\n                         options: options,\n                         range: NSRange(range, in: string)) { result, flags, stop in\n                            var shouldStop = false\n                            block(result, flags, &shouldStop)\n                            if shouldStop {\n                                stop.pointee = true\n                            }\n        }\n    }\n    #endif\n\n    /// SwifterSwift: Returns an array containing all the matches of the regular expression in the string.\n    ///\n    /// - Parameters:\n    ///   - string: The string to search.\n    ///   - options: The matching options to use. See NSRegularExpression.MatchingOptions for possible values.\n    ///   - range: The range of the string to search.\n    /// - Returns: An array of `NSTextCheckingResult` objects. Each result gives the overall matched range via its `range` property, and the range of each individual capture group via its `range(at:)` method. The range {NSNotFound, 0} is returned if one of the capture groups did not participate in this particular match.\n    func matches(in string: String,\n                 options: MatchingOptions = [],\n                 range: Range<String.Index>) -> [NSTextCheckingResult] {\n        return matches(in: string,\n                       options: options,\n                       range: NSRange(range, in: string))\n    }\n\n    /// SwifterSwift: Returns the number of matches of the regular expression within the specified range of the string.\n    ///\n    /// - Parameters:\n    ///   - string: The string to search.\n    ///   - options: The matching options to use. See NSRegularExpression.MatchingOptions for possible values.\n    ///   - range: The range of the string to search.\n    /// - Returns: The number of matches of the regular expression.\n    func numberOfMatches(in string: String,\n                         options: MatchingOptions = [],\n                         range: Range<String.Index>) -> Int {\n        return numberOfMatches(in: string,\n                               options: options,\n                               range: NSRange(range, in: string))\n    }\n\n    /// SwifterSwift: Returns the first match of the regular expression within the specified range of the string.\n    ///\n    /// - Parameters:\n    ///   - string: The string to search.\n    ///   - options: The matching options to use. See `NSRegularExpression.MatchingOptions` for possible values.\n    ///   - range: The range of the string to search.\n    /// - Returns: An `NSTextCheckingResult` object. This result gives the overall matched range via its `range` property, and the range of each individual capture group via its `range(at:)` method. The range {NSNotFound, 0} is returned if one of the capture groups did not participate in this particular match.\n    func firstMatch(in string: String,\n                    options: MatchingOptions = [],\n                    range: Range<String.Index>) -> NSTextCheckingResult? {\n        return firstMatch(in: string,\n                          options: options,\n                          range: NSRange(range, in: string))\n    }\n\n    /// SwifterSwift: Returns the range of the first match of the regular expression within the specified range of the string.\n    ///\n    /// - Parameters:\n    ///   - string: The string to search.\n    ///   - options: The matching options to use. See `NSRegularExpression.MatchingOptions` for possible values.\n    ///   - range: The range of the string to search.\n    /// - Returns: The range of the first match. Returns `nil` if no match is found.\n    func rangeOfFirstMatch(in string: String,\n                           options: MatchingOptions = [],\n                           range: Range<String.Index>) -> Range<String.Index>? {\n        return Range(rangeOfFirstMatch(in: string,\n                                       options: options,\n                                       range: NSRange(range, in: string)),\n                     in: string)\n    }\n\n    /// SwifterSwift: Returns a new string containing matching regular expressions replaced with the template string.\n    ///\n    /// - Parameters:\n    ///   - string: The string to search for values within.\n    ///   - options: The matching options to use. See `NSRegularExpression.MatchingOptions` for possible values.\n    ///   - range: The range of the string to search.\n    ///   - templ: The substitution template used when replacing matching instances.\n    /// - Returns: A string with matching regular expressions replaced by the template string.\n    func stringByReplacingMatches(in string: String,\n                                  options: MatchingOptions = [],\n                                  range: Range<String.Index>,\n                                  withTemplate templ: String) -> String {\n        return stringByReplacingMatches(in: string,\n                                        options: options,\n                                        range: NSRange(range, in: string),\n                                        withTemplate: templ)\n    }\n\n    /// SwifterSwift: Replaces regular expression matches within the mutable string using the template string.\n    ///\n    /// - Parameters:\n    ///   - string: The mutable string to search and replace values within.\n    ///   - options: The matching options to use. See `NSRegularExpression.MatchingOptions` for possible values.\n    ///   - range: The range of the string to search.\n    ///   - templ: The substitution template used when replacing matching instances.\n    /// - Returns: The number of matches.\n    @discardableResult\n    func replaceMatches(in string: inout String,\n                        options: MatchingOptions = [],\n                        range: Range<String.Index>,\n                        withTemplate templ: String) -> Int {\n        let mutableString = NSMutableString(string: string)\n        let matches = replaceMatches(in: mutableString,\n                                     options: options,\n                                     range: NSRange(range, in: string),\n                                     withTemplate: templ)\n        string = mutableString.copy() as! String // swiftlint:disable:this force_cast\n        return matches\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/NotificationCenterExtensions.swift",
    "content": "//\n//  NotificationCenterExtensions.swift\n//  SwifterSwift\n//\n//  Created by Guy Kogus on 6/3/20.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\npublic extension NotificationCenter {\n\n    /// SwifterSwift: Adds a one-time entry to the notification center's dispatch table that includes a notification queue and a block to add to the queue, and an optional notification name and sender.\n    /// - Parameters:\n    ///   - name: The name of the notification for which to register the observer; that is, only notifications with this name are used to add the block to the operation queue.\n    ///\n    ///     If you pass `nil`, the notification center doesn’t use a notification’s name to decide whether to add the block to the operation queue.\n    ///   - obj: The object whose notifications the observer wants to receive; that is, only notifications sent by this sender are delivered to the observer.\n    ///\n    ///     If you pass `nil`, the notification center doesn’t use a notification’s sender to decide whether to deliver it to the observer.\n    ///   - queue: The operation queue to which block should be added.\n    ///\n    ///     If you pass `nil`, the block is run synchronously on the posting thread.\n    ///   - block: The block to be executed when the notification is received.\n    ///\n    ///     The block is copied by the notification center and (the copy) held until the observer registration is removed.\n    ///\n    ///     The block takes one argument:\n    ///   - notification: The notification.\n    func observeOnce(forName name: NSNotification.Name?,\n                     object obj: Any? = nil,\n                     queue: OperationQueue? = nil,\n                     using block: @escaping (_ notification: Notification) -> Void) {\n        var handler: NSObjectProtocol!\n        handler = addObserver(forName: name, object: obj, queue: queue) { [unowned self] in\n            self.removeObserver(handler!)\n            block($0)\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/URLExtensions.swift",
    "content": "//\n//  URLExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 03/02/2017.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n#if canImport(UIKit) && canImport(AVFoundation)\nimport UIKit\nimport AVFoundation\n#endif\n\n// MARK: - Properties\npublic extension URL {\n\n    /// SwifterSwift: Dictionary of the URL's query parameters\n    var queryParameters: [String: String]? {\n        guard let components = URLComponents(url: self, resolvingAgainstBaseURL: false), let queryItems = components.queryItems else { return nil }\n\n        var items: [String: String] = [:]\n\n        for queryItem in queryItems {\n            items[queryItem.name] = queryItem.value\n        }\n\n        return items\n    }\n\n}\n\n// MARK: - Initializers\npublic extension URL {\n\n    /// SwifterSwift: Initializes an `URL` object with a base URL and a relative string. If `string` was malformed, returns `nil`.\n    /// - Parameters:\n    ///   - string: The URL string with which to initialize the `URL` object. Must conform to RFC 2396. `string` is interpreted relative to `url`.\n    ///   - url: The base URL for the `URL` object.\n    init?(string: String?, relativeTo url: URL? = nil) {\n        guard let string = string else { return nil }\n        self.init(string: string, relativeTo: url)\n    }\n\n}\n\n// MARK: - Methods\npublic extension URL {\n\n    /// SwifterSwift: URL with appending query parameters.\n    ///\n    ///\t\tlet url = URL(string: \"https://google.com\")!\n    ///\t\tlet param = [\"q\": \"Swifter Swift\"]\n    ///\t\turl.appendingQueryParameters(params) -> \"https://google.com?q=Swifter%20Swift\"\n    ///\n    /// - Parameter parameters: parameters dictionary.\n    /// - Returns: URL with appending given query parameters.\n    func appendingQueryParameters(_ parameters: [String: String]) -> URL {\n        var urlComponents = URLComponents(url: self, resolvingAgainstBaseURL: true)!\n        var items = urlComponents.queryItems ?? []\n        items += parameters.map({ URLQueryItem(name: $0, value: $1) })\n        urlComponents.queryItems = items\n        return urlComponents.url!\n    }\n\n    /// SwifterSwift: Append query parameters to URL.\n    ///\n    ///\t\tvar url = URL(string: \"https://google.com\")!\n    ///\t\tlet param = [\"q\": \"Swifter Swift\"]\n    ///\t\turl.appendQueryParameters(params)\n    ///\t\tprint(url) // prints \"https://google.com?q=Swifter%20Swift\"\n    ///\n    /// - Parameter parameters: parameters dictionary.\n    mutating func appendQueryParameters(_ parameters: [String: String]) {\n        self = appendingQueryParameters(parameters)\n    }\n\n    /// SwifterSwift: Get value of a query key.\n    ///\n    ///    var url = URL(string: \"https://google.com?code=12345\")!\n    ///    queryValue(for: \"code\") -> \"12345\"\n    ///\n    /// - Parameter key: The key of a query value.\n    func queryValue(for key: String) -> String? {\n        return URLComponents(string: absoluteString)?\n            .queryItems?\n            .first(where: { $0.name == key })?\n            .value\n    }\n\n    /// SwifterSwift: Returns a new URL by removing all the path components.\n    ///\n    ///     let url = URL(string: \"https://domain.com/path/other\")!\n    ///     print(url.deletingAllPathComponents()) // prints \"https://domain.com/\"\n    ///\n    /// - Returns: URL with all path components removed.\n    func deletingAllPathComponents() -> URL {\n        var url: URL = self\n        for _ in 0..<pathComponents.count - 1 {\n            url.deleteLastPathComponent()\n        }\n        return url\n    }\n\n    /// SwifterSwift: Remove all the path components from the URL.\n    ///\n    ///        var url = URL(string: \"https://domain.com/path/other\")!\n    ///        url.deleteAllPathComponents()\n    ///        print(url) // prints \"https://domain.com/\"\n    mutating func deleteAllPathComponents() {\n        for _ in 0..<pathComponents.count - 1 {\n            deleteLastPathComponent()\n        }\n    }\n\n    /// SwifterSwift: Generates new URL that does not have scheme.\n    ///\n    ///        let url = URL(string: \"https://domain.com\")!\n    ///        print(url.droppedScheme()) // prints \"domain.com\"\n    func droppedScheme() -> URL? {\n        if let scheme = scheme {\n            let droppedScheme = String(absoluteString.dropFirst(scheme.count + 3))\n            return URL(string: droppedScheme)\n        }\n\n        guard host != nil else { return self }\n\n        let droppedScheme = String(absoluteString.dropFirst(2))\n        return URL(string: droppedScheme)\n    }\n\n}\n\n// MARK: - Methods\npublic extension URL {\n\n    #if os(iOS) || os(tvOS)\n    /// SwifterSwift: Generate a thumbnail image from given url. Returns nil if no thumbnail could be created. This function may take some time to complete. It's recommended to dispatch the call if the thumbnail is not generated from a local resource.\n    ///\n    ///     var url = URL(string: \"https://video.golem.de/files/1/1/20637/wrkw0718-sd.mp4\")!\n    ///     var thumbnail = url.thumbnail()\n    ///     thumbnail = url.thumbnail(fromTime: 5)\n    ///\n    ///     DisptachQueue.main.async {\n    ///         someImageView.image = url.thumbnail()\n    ///     }\n    ///\n    /// - Parameter time: Seconds into the video where the image should be generated.\n    /// - Returns: The UIImage result of the AVAssetImageGenerator\n    func thumbnail(fromTime time: Float64 = 0) -> UIImage? {\n        let imageGenerator = AVAssetImageGenerator(asset: AVAsset(url: self))\n        let time = CMTimeMakeWithSeconds(time, preferredTimescale: 1)\n        var actualTime = CMTimeMake(value: 0, timescale: 0)\n\n        guard let cgImage = try? imageGenerator.copyCGImage(at: time, actualTime: &actualTime) else {\n            return nil\n        }\n        return UIImage(cgImage: cgImage)\n    }\n    #endif\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/URLRequestExtensions.swift",
    "content": "//\n//  URLRequestExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/5/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n#if canImport(FoundationNetworking)\nimport FoundationNetworking\n#endif\n\n// MARK: - Initializers\npublic extension URLRequest {\n\n    /// SwifterSwift: Create URLRequest from URL string.\n    ///\n    /// - Parameter urlString: URL string to initialize URL request from\n    init?(urlString: String) {\n        guard let url = URL(string: urlString) else { return nil }\n        self.init(url: url)\n    }\n\n    /// SwifterSwift: cURL command representation of this URL request.\n    var curlString: String {\n\n        guard let url = url else { return \"\" }\n\n        var baseCommand = \"curl \\(url.absoluteString)\"\n        if httpMethod == \"HEAD\" {\n            baseCommand += \" --head\"\n        }\n\n        var command = [baseCommand]\n        if let method = httpMethod, method != \"GET\" && method != \"HEAD\" {\n            command.append(\"-X \\(method)\")\n        }\n\n        if let headers = allHTTPHeaderFields {\n            for (key, value) in headers where key != \"Cookie\" {\n                command.append(\"-H '\\(key): \\(value)'\")\n            }\n        }\n\n        if let data = httpBody,\n            let body = String(data: data, encoding: .utf8) {\n            command.append(\"-d '\\(body)'\")\n        }\n\n        return command.joined(separator: \" \\\\\\n\\t\")\n    }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Foundation/UserDefaultsExtensions.swift",
    "content": "//\n//  UserDefaultsExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/5/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation) && !os(Linux)\nimport Foundation\n\n// MARK: - Methods\npublic extension UserDefaults {\n\n    /// SwifterSwift: get object from UserDefaults by using subscript\n    ///\n    /// - Parameter key: key in the current user's defaults database.\n    subscript(key: String) -> Any? {\n        get {\n            return object(forKey: key)\n        }\n        set {\n            set(newValue, forKey: key)\n        }\n    }\n\n    /// SwifterSwift: Float from UserDefaults.\n    ///\n    /// - Parameter forKey: key to find float for.\n    /// - Returns: Float object for key (if exists).\n    func float(forKey key: String) -> Float? {\n        return object(forKey: key) as? Float\n    }\n\n    /// SwifterSwift: Date from UserDefaults.\n    ///\n    /// - Parameter forKey: key to find date for.\n    /// - Returns: Date object for key (if exists).\n    func date(forKey key: String) -> Date? {\n        return object(forKey: key) as? Date\n    }\n\n    /// SwifterSwift: Retrieves a Codable object from UserDefaults.\n    ///\n    /// - Parameters:\n    ///   - type: Class that conforms to the Codable protocol.\n    ///   - key: Identifier of the object.\n    ///   - decoder: Custom JSONDecoder instance. Defaults to `JSONDecoder()`.\n    /// - Returns: Codable object for key (if exists).\n    func object<T: Codable>(_ type: T.Type, with key: String, usingDecoder decoder: JSONDecoder = JSONDecoder()) -> T? {\n        guard let data = value(forKey: key) as? Data else { return nil }\n        return try? decoder.decode(type.self, from: data)\n    }\n\n    /// SwifterSwift: Allows storing of Codable objects to UserDefaults.\n    ///\n    /// - Parameters:\n    ///   - object: Codable object to store.\n    ///   - key: Identifier of the object.\n    ///   - encoder: Custom JSONEncoder instance. Defaults to `JSONEncoder()`.\n    func set<T: Codable>(object: T, forKey key: String, usingEncoder encoder: JSONEncoder = JSONEncoder()) {\n        let data = try? encoder.encode(object)\n        set(data, forKey: key)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/MapKit/MKMapViewExtensions.swift",
    "content": "//\n//  MKMapViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by Hannes Staffler on 24.01.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(MapKit)\nimport MapKit\n\n#if !os(watchOS)\n@available(tvOS 9.2, *)\npublic extension MKMapView {\n\n    /// SwifterSwift: Dequeue reusable MKAnnotationView using class type\n    ///\n    /// - Parameters:\n    ///   - name: MKAnnotationView type.\n    /// - Returns: optional MKAnnotationView object.\n    func dequeueReusableAnnotationView<T: MKAnnotationView>(withClass name: T.Type) -> T? {\n        return dequeueReusableAnnotationView(withIdentifier: String(describing: name)) as? T\n    }\n\n    /// SwifterSwift: Register MKAnnotationView using class type\n    ///\n    /// - Parameter name: MKAnnotationView type.\n    @available(iOS 11.0, tvOS 11.0, macOS 10.13, *)\n    func register<T: MKAnnotationView>(annotationViewWithClass name: T.Type) {\n        register(T.self, forAnnotationViewWithReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Dequeue reusable MKAnnotationView using class type\n    ///\n    /// - Parameters:\n    ///   - name: MKAnnotationView type.\n    ///   - annotation: annotation of the mapView.\n    /// - Returns: optional MKAnnotationView object.\n    @available(iOS 11.0, tvOS 11.0, macOS 10.13, *)\n    func dequeueReusableAnnotationView<T: MKAnnotationView>(withClass name: T.Type, for annotation: MKAnnotation) -> T? {\n        guard let annotationView = dequeueReusableAnnotationView(withIdentifier: String(describing: name), for: annotation) as? T else {\n            fatalError(\"Couldn't find MKAnnotationView for \\(String(describing: name))\")\n        }\n\n        return annotationView\n    }\n\n    /// SwifterSwift: Zooms in on multiple mapView coordinates.\n    ///\n    /// - Parameters:\n    ///   - coordinates: Gets the array of type CLLocationCoordinate2D.\n    ///   - meter: If arrays have a single item, they take the value of meters (Double). The map zooms in at the given meters.\n    ///   - edgePadding: The amount of additional space (measured in screen points) to make visible around the specified rectangle\n    ///   - animated: The animation control takes the Boolean value. Enter the true value for zooming with the animation.\n    func zoom(to coordinates: [CLLocationCoordinate2D], meter: Double, edgePadding: EdgeInsets, animated: Bool) {\n        guard !coordinates.isEmpty else { return }\n\n        if coordinates.count == 1 {\n            let coordinateRegion = MKCoordinateRegion(center: coordinates.first!, latitudinalMeters: meter, longitudinalMeters: meter)\n            setRegion(coordinateRegion, animated: true)\n        } else {\n            let mkPolygon = MKPolygon(coordinates: coordinates, count: coordinates.count)\n            setVisibleMapRect(mkPolygon.boundingMapRect, edgePadding: edgePadding, animated: animated)\n        }\n    }\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/MapKit/MKPolylineExtensions.swift",
    "content": "//\n//  MKPolylineExtensions.swift\n//  SwifterSwift\n//\n//  Created by Shai Mishali on 3/8/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(MapKit) && !os(watchOS)\nimport MapKit\n\n// MARK: - Initializers\n@available(tvOS 9.2, *)\npublic extension MKPolyline {\n\n    /// SwifterSwift: Create a new MKPolyline from a provided Array of coordinates.\n    ///\n    /// - Parameter coordinates: Array of CLLocationCoordinate2D(s).\n    convenience init(coordinates: [CLLocationCoordinate2D]) {\n        var refCoordinates = coordinates\n        self.init(coordinates: &refCoordinates, count: refCoordinates.count)\n    }\n\n}\n\n// MARK: - Properties\n@available(tvOS 9.2, *)\npublic extension MKPolyline {\n\n    /// SwifterSwift: Return an Array of coordinates representing the provided polyline.\n    var coordinates: [CLLocationCoordinate2D] {\n        var coords = [CLLocationCoordinate2D](repeating: kCLLocationCoordinate2DInvalid, count: pointCount)\n        getCoordinates(&coords, range: NSRange(location: 0, length: pointCount))\n        return coords\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNBoxExtensions.swift",
    "content": "//\n//  SCNBoxExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNBox {\n\n    /// SwifterSwift: Creates a box geometry with the specified width, height, and length.\n    ///\n    /// - Parameters:\n    ///   - width: The width of the box along the x-axis of its local coordinate space.\n    ///   - height: The height of the box along the y-axis of its local coordinate space.\n    ///   - length: The length of the box along the z-axis of its local coordinate space.\n    convenience init(width: CGFloat, height: CGFloat, length: CGFloat) {\n        self.init(width: width, height: height, length: length, chamferRadius: 0)\n    }\n\n    /// SwifterSwift: Creates a cube geometry with the specified side length, and chamfer radius.\n    ///\n    /// - Parameters:\n    ///   - sideLength: The width, height, and length of the box in its local coordinate space.\n    ///   - chamferRadius: The radius of curvature for the edges and corners of the box.\n    convenience init(sideLength: CGFloat, chamferRadius: CGFloat = 0) {\n        self.init(width: sideLength, height: sideLength, length: sideLength, chamferRadius: chamferRadius)\n    }\n\n    /// SwifterSwift: Creates a box geometry with the specified width, height, length, chamfer radius, and material.\n    ///\n    /// - Parameters:\n    ///   - width: The width of the box along the x-axis of its local coordinate space.\n    ///   - height: The height of the box along the y-axis of its local coordinate space.\n    ///   - length: The length of the box along the z-axis of its local coordinate space.\n    ///   - chamferRadius: The radius of curvature for the edges and corners of the box.\n    ///   - material: The material of the geometry.\n    convenience init(width: CGFloat, height: CGFloat, length: CGFloat, chamferRadius: CGFloat = 0, material: SCNMaterial) {\n        self.init(width: width, height: height, length: length, chamferRadius: chamferRadius)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a cube geometry with the specified side length, chamfer radius, and material.\n    ///\n    /// - Parameters:\n    ///   - sideLength: The width, height, and length of the box in its local coordinate space.\n    ///   - chamferRadius: The radius of curvature for the edges and corners of the box.\n    ///   - material: The material of the geometry.\n    convenience init(sideLength: CGFloat, chamferRadius: CGFloat = 0, material: SCNMaterial) {\n        self.init(width: sideLength, height: sideLength, length: sideLength, chamferRadius: chamferRadius)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a box geometry with the specified width, height, length, chamfer radius, and material color.\n    ///\n    /// - Parameters:\n    ///   - width: The width of the box along the x-axis of its local coordinate space.\n    ///   - height: The height of the box along the y-axis of its local coordinate space.\n    ///   - length: The length of the box along the z-axis of its local coordinate space.\n    ///   - chamferRadius: The radius of curvature for the edges and corners of the box.\n    ///   - color: The color of the geometry's material.\n    convenience init(width: CGFloat, height: CGFloat, length: CGFloat, chamferRadius: CGFloat = 0, color: Color) {\n        self.init(width: width, height: height, length: length, chamferRadius: chamferRadius)\n        materials = [SCNMaterial(color: color)]\n    }\n\n    /// SwifterSwift: Creates a cube geometry with the specified side length, chamfer radius, and material color.\n    ///\n    /// - Parameters:\n    ///   - sideLength: The width, height, and length of the box in its local coordinate space.\n    ///   - chamferRadius: The radius of curvature for the edges and corners of the box.\n    ///   - color: The color of the geometry's material.\n    convenience init(sideLength: CGFloat, chamferRadius: CGFloat = 0, color: Color) {\n        self.init(width: sideLength, height: sideLength, length: sideLength, chamferRadius: chamferRadius)\n        materials = [SCNMaterial(color: color)]\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNCapsuleExtensions.swift",
    "content": "//\n//  SCNCapsuleExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNCapsule {\n\n    /// SwifterSwift: Creates a capsule geometry with the specified diameter and height.\n    ///\n    /// - Parameters:\n    ///   - capDiameter: The diameter both of the capsule’s cylindrical body and of its hemispherical ends.\n    ///   - height: The height of the capsule along the y-axis of its local coordinate space.\n    convenience init(capDiameter: CGFloat, height: CGFloat) {\n        self.init(capRadius: capDiameter / 2, height: height)\n    }\n\n    /// SwifterSwift: Creates a capsule geometry with the specified radius and height.\n    ///\n    /// - Parameters:\n    ///   - capRadius: The radius both of the capsule’s cylindrical body and of its hemispherical ends.\n    ///   - height: The height of the capsule along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(capRadius: CGFloat, height: CGFloat, material: SCNMaterial) {\n        self.init(capRadius: capRadius, height: height)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a capsule geometry with the specified diameter and height.\n    ///\n    /// - Parameters:\n    ///   - capDiameter: The diameter both of the capsule’s cylindrical body and of its hemispherical ends.\n    ///   - height: The height of the capsule along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(capDiameter: CGFloat, height: CGFloat, material: SCNMaterial) {\n        self.init(capRadius: capDiameter / 2, height: height)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a capsule geometry with the specified radius and height.\n    ///\n    /// - Parameters:\n    ///   - capRadius: The radius both of the capsule’s cylindrical body and of its hemispherical ends.\n    ///   - height: The height of the capsule along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(capRadius: CGFloat, height: CGFloat, color: Color) {\n        self.init(capRadius: capRadius, height: height)\n        materials = [SCNMaterial(color: color)]\n    }\n\n    /// SwifterSwift: Creates a capsule geometry with the specified diameter and height.\n    ///\n    /// - Parameters:\n    ///   - capDiameter: The diameter both of the capsule’s cylindrical body and of its hemispherical ends.\n    ///   - height: The height of the capsule along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(capDiameter: CGFloat, height: CGFloat, color: Color) {\n        self.init(capRadius: capDiameter / 2, height: height)\n        materials = [SCNMaterial(color: color)]\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNConeExtensions.swift",
    "content": "//\n//  SCNConeExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNCone {\n\n    /// SwifterSwift: Creates a cone geometry with the given top diameter, bottom diameter, and height.\n    ///\n    /// - Parameters:\n    ///   - topDiameter: The diameter of the cone’s top, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - bottomDiameter: The diameter of the cone’s base, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cone along the y-axis of its local coordinate space.\n    convenience init(topDiameter: CGFloat, bottomDiameter: CGFloat, height: CGFloat) {\n        self.init(topRadius: topDiameter / 2, bottomRadius: bottomDiameter / 2, height: height)\n    }\n\n    /// SwifterSwift: Creates a cone geometry with the given top radius, bottom radius, height, and material.\n    ///\n    /// - Parameters:\n    ///   - topRadius: The radius of the cone’s top, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - bottomRadius: The radius of the cone’s base, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cone along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(topRadius: CGFloat, bottomRadius: CGFloat, height: CGFloat, material: SCNMaterial) {\n        self.init(topRadius: topRadius, bottomRadius: bottomRadius, height: height)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a cone geometry with the given top diameter, bottom diameter, height, and material.\n    ///\n    /// - Parameters:\n    ///   - topDiameter: The diameter of the cone’s top, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - bottomDiameter: The diameter of the cone’s base, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cone along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(topDiameter: CGFloat, bottomDiameter: CGFloat, height: CGFloat, material: SCNMaterial) {\n        self.init(topRadius: topDiameter / 2, bottomRadius: bottomDiameter / 2, height: height)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a cone geometry with the given top radius, bottom radius, height, and material.\n    ///\n    /// - Parameters:\n    ///   - topRadius: The radius of the cone’s top, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - bottomRadius: The radius of the cone’s base, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cone along the y-axis of its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(topRadius: CGFloat, bottomRadius: CGFloat, height: CGFloat, color: Color) {\n        self.init(topRadius: topRadius, bottomRadius: bottomRadius, height: height)\n        materials = [SCNMaterial(color: color)]\n    }\n\n    /// SwifterSwift: Creates a cone geometry with the given top diameter, bottom diameter, height, and material.\n    ///\n    /// - Parameters:\n    ///   - topDiameter: The diameter of the cone’s top, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - bottomDiameter: The diameter of the cone’s base, forming a circle in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cone along the y-axis of its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(topDiameter: CGFloat, bottomDiameter: CGFloat, height: CGFloat, color: Color) {\n        self.init(topRadius: topDiameter / 2, bottomRadius: bottomDiameter / 2, height: height)\n        materials = [SCNMaterial(color: color)]\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNCylinderExtensions.swift",
    "content": "//\n//  SCNCylinderExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNCylinder {\n\n    /// SwifterSwift: Creates a cylinder geometry with the specified diameter and height.\n    ///\n    /// - Parameters:\n    ///   - radius: The radius of the cylinder’s circular cross section in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cylinder along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(diameter: CGFloat, height: CGFloat) {\n        self.init(radius: diameter / 2, height: height)\n    }\n\n    /// SwifterSwift: Creates a cylinder geometry with the specified radius, height and material.\n    ///\n    /// - Parameters:\n    ///   - radius: The radius of the cylinder’s circular cross section in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cylinder along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(radius: CGFloat, height: CGFloat, material: SCNMaterial) {\n        self.init(radius: radius, height: height)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a cylinder geometry with the specified diameter, height and material.\n    ///\n    /// - Parameters:\n    ///   - radius: The radius of the cylinder’s circular cross section in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cylinder along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(diameter: CGFloat, height: CGFloat, material: SCNMaterial) {\n        self.init(radius: diameter / 2, height: height)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a cylinder geometry with the specified radius, height, and material color.\n    ///\n    /// - Parameters:\n    ///   - radius: The radius of the cylinder’s circular cross section in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cylinder along the y-axis of its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(radius: CGFloat, height: CGFloat, color: Color) {\n        self.init(radius: radius, height: height)\n        materials = [SCNMaterial(color: color)]\n    }\n\n    /// SwifterSwift: Creates a cylinder geometry with the specified diameter, height, and material color.\n    ///\n    /// - Parameters:\n    ///   - diameter: The diameter of the cylinder’s circular cross section in the x- and z-axis dimensions of its local coordinate space.\n    ///   - height: The height of the cylinder along the y-axis of its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(diameter: CGFloat, height: CGFloat, color: Color) {\n        self.init(radius: diameter / 2, height: height)\n        materials = [SCNMaterial(color: color)]\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNGeometryExtensions.swift",
    "content": "//\n//  SCNGeometryExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Properties\npublic extension SCNGeometry {\n\n    /// SwifterSwift: Returns the size of the geometry's bounding box.\n    var boundingSize: SCNVector3 {\n        return (boundingBox.max - boundingBox.min).absolute\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNMaterialExtensions.swift",
    "content": "//\n//  SCNMaterialExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNMaterial {\n\n    /// SwifterSwift: Initializes a SCNMaterial with a specific diffuse color\n    ///\n    /// - Parameter color: diffuse color\n    convenience init(color: Color) {\n        self.init()\n        diffuse.contents = color\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNPlaneExtensions.swift",
    "content": "//\n//  SCNPlaneExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNPlane {\n\n    /// SwifterSwift: Creates a square plane geometry with the specified width.\n    ///\n    /// - Parameter width: The width and height of the plane along the x-axis and y-axis of its local coordinate space.\n    convenience init(width: CGFloat) {\n        self.init(width: width, height: width)\n    }\n\n    /// SwifterSwift: Creates a plane geometry with the specified width, height and material.\n    ///\n    /// - Parameters:\n    ///   - width: The width of the plane along the x-axis of its local coordinate space.\n    ///   - height: The height of the plane along the y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(width: CGFloat, height: CGFloat, material: SCNMaterial) {\n        self.init(width: width, height: height)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a square plane geometry with the specified width and material.\n    ///\n    /// - Parameters:\n    ///   - width: The width and height of the plane along the x-axis and y-axis of its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(width: CGFloat, material: SCNMaterial) {\n        self.init(width: width, height: width)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a plane geometry with the specified width, height and material color.\n    ///\n    /// - Parameters:\n    ///   - width: The width of the plane along the x-axis of its local coordinate space.\n    ///   - height: The height of the plane along the y-axis of its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(width: CGFloat, height: CGFloat, color: Color) {\n        self.init(width: width, height: height)\n        materials = [SCNMaterial(color: color)]\n    }\n\n    /// SwifterSwift: Creates a square plane geometry with the specified width and material color.\n    ///\n    /// - Parameters:\n    ///   - width: The width and height of the plane along the x-axis and y-axis of its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(width: CGFloat, color: Color) {\n        self.init(width: width, height: width)\n        materials = [SCNMaterial(color: color)]\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNShapeExtensions.swift",
    "content": "//\n//  SCNShapeExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n#if canImport(UIKit)\nimport UIKit\n#endif\n\n// MARK: - Methods\npublic extension SCNShape {\n\n    #if canImport(UIKit)\n\n    /// SwifterSwift: Creates a shape geometry with the specified path, extrusion depth, and material.\n    ///\n    /// - Parameters:\n    ///   - path: The two-dimensional path forming the basis of the shape.\n    ///   - extrusionDepth: The thickness of the extruded shape along the z-axis.\n    ///   - material: The material of the geometry.\n    convenience init(path: UIBezierPath, extrusionDepth: CGFloat, material: SCNMaterial) {\n        self.init(path: path, extrusionDepth: extrusionDepth)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a shape geometry with the specified path, extrusion depth, and material.\n    ///\n    /// - Parameters:\n    ///   - path: The two-dimensional path forming the basis of the shape.\n    ///   - extrusionDepth: The thickness of the extruded shape along the z-axis.\n    ///   - color: The color of the geometry's material.\n    convenience init(path: UIBezierPath, extrusionDepth: CGFloat, color: Color) {\n        self.init(path: path, extrusionDepth: extrusionDepth)\n        materials = [SCNMaterial(color: color)]\n    }\n\n    #endif\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNSphereExtensions.swift",
    "content": "//\n//  SCNSphereExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 06.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNSphere {\n\n    /// SwifterSwift: Creates a sphere geometry with the specified diameter.\n    ///\n    /// - Parameter diameter: The diameter of the sphere in its local coordinate space.\n    convenience init(diameter: CGFloat) {\n        self.init(radius: diameter / 2)\n    }\n\n    /// SwifterSwift: Creates a sphere geometry with the specified radius and material.\n    ///\n    /// - Parameters:\n    ///   - radius: The radius of the sphere in its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(radius: CGFloat, material: SCNMaterial) {\n        self.init(radius: radius)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a sphere geometry with the specified radius and material color.\n    ///\n    /// - Parameters:\n    ///   - radius: The radius of the sphere in its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(radius: CGFloat, color: Color) {\n        self.init(radius: radius, material: SCNMaterial(color: color))\n    }\n\n    /// SwifterSwift: Creates a sphere geometry with the specified diameter and material.\n    ///\n    /// - Parameters:\n    ///   - diameter: The diameter of the sphere in its local coordinate space.\n    ///   - material: The material of the geometry.\n    convenience init(diameter: CGFloat, material: SCNMaterial) {\n        self.init(radius: diameter / 2)\n        materials = [material]\n    }\n\n    /// SwifterSwift: Creates a sphere geometry with the specified diameter and material color.\n    ///\n    /// - Parameters:\n    ///   - diameter: The diameter of the sphere in its local coordinate space.\n    ///   - color: The color of the geometry's material.\n    convenience init(diameter: CGFloat, color: Color) {\n        self.init(diameter: diameter, material: SCNMaterial(color: color))\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SceneKit/SCNVector3Extensions.swift",
    "content": "//\n//  SCNVector3Extensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 04.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if os(OSX)\n/// SwifterSwift: CGFloat.\npublic typealias SceneKitFloat = CGFloat\n#else\n/// SwifterSwift: Float.\npublic typealias SceneKitFloat = Float\n#endif\n\n#if canImport(SceneKit)\nimport SceneKit\n\n// MARK: - Methods\npublic extension SCNVector3 {\n\n    /// SwifterSwift: Returns the absolute values of the vector's components.\n    ///\n    ///         SCNVector3(2, -3, -6).abs -> SCNVector3(2, 3, 6)\n    ///\n    var absolute: SCNVector3 {\n        return SCNVector3(abs(x), abs(y), abs(z))\n    }\n\n    /// SwifterSwift: Returns the length of the vector.\n    ///\n    ///         SCNVector3(2, 3, 6).length -> 7\n    ///\n    var length: SceneKitFloat {\n        return sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2))\n    }\n\n}\n\n// MARK: - Operators\npublic extension SCNVector3 {\n\n    /// SwifterSwift: Add two SCNVector3s.\n    ///\n    ///     SCNVector3(10, 10, 10) + SCNVector3(10, 20, -30) -> SCNVector3(20, 30, -20)\n    ///\n    /// - Parameters:\n    ///   - lhs: SCNVector3 to add to.\n    ///   - rhs: SCNVector3 to add.\n    /// - Returns: result of addition of the two given SCNVector3s.\n    static func + (lhs: SCNVector3, rhs: SCNVector3) -> SCNVector3 {\n        return SCNVector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z)\n    }\n\n    /// SwifterSwift: Add a SCNVector3 to self.\n    ///\n    ///     SCNVector3(10, 10, 10) += SCNVector3(10, 20, -30) -> SCNVector3(20, 30, -20)\n    ///\n    /// - Parameters:\n    ///   - lhs: self\n    ///   - rhs: SCNVector3 to add.\n    static func += (lhs: inout SCNVector3, rhs: SCNVector3) {\n        // swiftlint:disable:next shorthand_operator\n        lhs = lhs + rhs\n    }\n\n    /// SwifterSwift: Subtract two SCNVector3s.\n    ///\n    ///     SCNVector3(10, 10, 10) - SCNVector3(10, 20, -30) -> SCNVector3(0, -10, 40)\n    ///\n    /// - Parameters:\n    ///   - lhs: SCNVector3 to subtract from.\n    ///   - rhs: SCNVector3 to subtract.\n    /// - Returns: result of subtract of the two given SCNVector3s.\n    static func - (lhs: SCNVector3, rhs: SCNVector3) -> SCNVector3 {\n        return SCNVector3(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z)\n    }\n\n    /// SwifterSwift: Subtract a SCNVector3 from self.\n    ///\n    ///     SCNVector3(10, 10, 10) -= SCNVector3(10, 20, -30) -> SCNVector3(0, -10, 40)\n    ///\n    /// - Parameters:\n    ///   - lhs: self\n    ///   - rhs: SCNVector3 to subtract.\n    static func -= (lhs: inout SCNVector3, rhs: SCNVector3) {\n        // swiftlint:disable:next shorthand_operator\n        lhs = lhs - rhs\n    }\n\n    /// SwifterSwift: Multiply a SCNVector3 with a scalar\n    ///\n    ///     SCNVector3(10, 20, -30) * 3 -> SCNVector3(30, 60, -90)\n    ///\n    /// - Parameters:\n    ///   - vector: SCNVector3 to multiply.\n    ///   - scalar: scalar value.\n    /// - Returns: result of multiplication of the given SCNVector3 with the scalar.\n    static func * (vector: SCNVector3, scalar: SceneKitFloat) -> SCNVector3 {\n        return SCNVector3(vector.x * scalar, vector.y * scalar, vector.z * scalar)\n    }\n\n    /// SwifterSwift: Multiply self with a scalar\n    ///\n    ///     SCNVector3(10, 20, -30) *= 3 -> SCNVector3(30, 60, -90)\n    ///\n    /// - Parameters:\n    ///   - vector: self.\n    ///   - scalar: scalar value.\n    /// - Returns: result of multiplication of the given CGPoint with the scalar.\n    static func *= (vector: inout SCNVector3, scalar: SceneKitFloat) {\n        // swiftlint:disable:next shorthand_operator\n        vector = vector * scalar\n    }\n\n    /// SwifterSwift: Multiply a scalar with a SCNVector3\n    ///\n    ///     3 * SCNVector3(10, 20, -30) -> SCNVector3(30, 60, -90)\n    ///\n    /// - Parameters:\n    ///   - scalar: scalar value.\n    ///   - vector: SCNVector3 to multiply.\n    /// - Returns: result of multiplication of the given CGPoint with the scalar.\n    static func * (scalar: SceneKitFloat, vector: SCNVector3) -> SCNVector3 {\n        return SCNVector3(vector.x * scalar, vector.y * scalar, vector.z * scalar)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Shared/ColorExtensions.swift",
    "content": "//\n//  ColorExtensions.swift\n//  SwifterSwift-iOS\n//\n//  Created by Omar Albeik on 9/27/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if !os(Linux)\n\n#if canImport(UIKit)\nimport UIKit\n/// SwifterSwift: Color\npublic typealias Color = UIColor\n#endif\n\n#if canImport(AppKit) && !targetEnvironment(macCatalyst)\nimport AppKit\n/// SwifterSwift: Color\npublic typealias Color = NSColor\n#endif\n\n#if !os(watchOS)\nimport CoreImage\n#endif\n\n// MARK: - Properties\npublic extension Color {\n\n    /// SwifterSwift: Random color.\n    static var random: Color {\n        let red = Int.random(in: 0...255)\n        let green = Int.random(in: 0...255)\n        let blue = Int.random(in: 0...255)\n        return Color(red: red, green: green, blue: blue)!\n    }\n\n    // swiftlint:disable large_tuple\n    /// SwifterSwift: RGB components for a Color (between 0 and 255).\n    ///\n    ///     UIColor.red.rgbComponents.red -> 255\n    ///     NSColor.green.rgbComponents.green -> 255\n    ///     UIColor.blue.rgbComponents.blue -> 255\n    ///\n    var rgbComponents: (red: Int, green: Int, blue: Int) {\n        var components: [CGFloat] {\n            let comps = cgColor.components!\n            if comps.count == 4 { return comps }\n            return [comps[0], comps[0], comps[0], comps[1]]\n        }\n        let red = components[0]\n        let green = components[1]\n        let blue = components[2]\n        return (red: Int(red * 255.0), green: Int(green * 255.0), blue: Int(blue * 255.0))\n    }\n    // swiftlint:enable large_tuple\n\n    // swiftlint:disable large_tuple\n    /// SwifterSwift: RGB components for a Color represented as CGFloat numbers (between 0 and 1)\n    ///\n    ///     UIColor.red.rgbComponents.red -> 1.0\n    ///     NSColor.green.rgbComponents.green -> 1.0\n    ///     UIColor.blue.rgbComponents.blue -> 1.0\n    ///\n    var cgFloatComponents: (red: CGFloat, green: CGFloat, blue: CGFloat) {\n        var components: [CGFloat] {\n            let comps = cgColor.components!\n            if comps.count == 4 { return comps }\n            return [comps[0], comps[0], comps[0], comps[1]]\n        }\n        let red = components[0]\n        let green = components[1]\n        let blue = components[2]\n        return (red: red, green: green, blue: blue)\n    }\n    // swiftlint:enable large_tuple\n\n    // swiftlint:disable large_tuple\n    /// SwifterSwift: Get components of hue, saturation, and brightness, and alpha (read-only).\n    var hsbaComponents: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) {\n        var hue: CGFloat = 0.0\n        var saturation: CGFloat = 0.0\n        var brightness: CGFloat = 0.0\n        var alpha: CGFloat = 0.0\n\n        getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha)\n        return (hue: hue, saturation: saturation, brightness: brightness, alpha: alpha)\n    }\n    // swiftlint:enable large_tuple\n\n    /// SwifterSwift: Hexadecimal value string (read-only).\n    var hexString: String {\n        let components: [Int] = {\n            let comps = cgColor.components!\n            let components = comps.count == 4 ? comps : [comps[0], comps[0], comps[0], comps[1]]\n            return components.map { Int($0 * 255.0) }\n        }()\n        return String(format: \"#%02X%02X%02X\", components[0], components[1], components[2])\n    }\n\n    /// SwifterSwift: Short hexadecimal value string (read-only, if applicable).\n    var shortHexString: String? {\n        let string = hexString.replacingOccurrences(of: \"#\", with: \"\")\n        let chrs = Array(string)\n        guard chrs[0] == chrs[1], chrs[2] == chrs[3], chrs[4] == chrs[5] else { return nil }\n        return \"#\\(chrs[0])\\(chrs[2])\\(chrs[4])\"\n    }\n\n    /// SwifterSwift: Short hexadecimal value string, or full hexadecimal string if not possible (read-only).\n    var shortHexOrHexString: String {\n        let components: [Int] = {\n            let comps = cgColor.components!\n            let components = comps.count == 4 ? comps : [comps[0], comps[0], comps[0], comps[1]]\n            return components.map { Int($0 * 255.0) }\n        }()\n        let hexString = String(format: \"#%02X%02X%02X\", components[0], components[1], components[2])\n        let string = hexString.replacingOccurrences(of: \"#\", with: \"\")\n        let chrs = Array(string)\n        guard chrs[0] == chrs[1], chrs[2] == chrs[3], chrs[4] == chrs[5] else { return hexString }\n        return \"#\\(chrs[0])\\(chrs[2])\\(chrs[4])\"\n    }\n\n    /// SwifterSwift: Alpha of Color (read-only).\n    var alpha: CGFloat {\n        return cgColor.alpha\n    }\n\n    #if !os(watchOS)\n    /// SwifterSwift: CoreImage.CIColor (read-only)\n    var coreImageColor: CoreImage.CIColor? {\n        return CoreImage.CIColor(color: self)\n    }\n    #endif\n\n    /// SwifterSwift: Get UInt representation of a Color (read-only).\n    var uInt: UInt {\n        let comps: [CGFloat] = {\n            let comps = cgColor.components!\n            return comps.count == 4 ? comps : [comps[0], comps[0], comps[0], comps[1]]\n        }()\n\n        var colorAsUInt32: UInt32 = 0\n        colorAsUInt32 += UInt32(comps[0] * 255.0) << 16\n        colorAsUInt32 += UInt32(comps[1] * 255.0) << 8\n        colorAsUInt32 += UInt32(comps[2] * 255.0)\n\n        return UInt(colorAsUInt32)\n    }\n\n    /// SwifterSwift: Get color complementary (read-only, if applicable).\n    var complementary: Color? {\n        let colorSpaceRGB = CGColorSpaceCreateDeviceRGB()\n        let convertColorToRGBSpace: ((_ color: Color) -> Color?) = { color -> Color? in\n            if self.cgColor.colorSpace!.model == CGColorSpaceModel.monochrome {\n                let oldComponents = self.cgColor.components\n                let components: [CGFloat] = [ oldComponents![0], oldComponents![0], oldComponents![0], oldComponents![1]]\n                let colorRef = CGColor(colorSpace: colorSpaceRGB, components: components)\n                let colorOut = Color(cgColor: colorRef!)\n                return colorOut\n            } else {\n                return self\n            }\n        }\n\n        let color = convertColorToRGBSpace(self)\n        guard let componentColors = color?.cgColor.components else { return nil }\n\n        let red: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[0]*255), 2.0))/255\n        let green: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[1]*255), 2.0))/255\n        let blue: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[2]*255), 2.0))/255\n\n        return Color(red: red, green: green, blue: blue, alpha: 1.0)\n    }\n\n}\n\n// MARK: - Methods\npublic extension Color {\n\n    /// SwifterSwift: Blend two Colors\n    ///\n    /// - Parameters:\n    ///   - color1: first color to blend\n    ///   - intensity1: intensity of first color (default is 0.5)\n    ///   - color2: second color to blend\n    ///   - intensity2: intensity of second color (default is 0.5)\n    /// - Returns: Color created by blending first and seond colors.\n    static func blend(_ color1: Color, intensity1: CGFloat = 0.5, with color2: Color, intensity2: CGFloat = 0.5) -> Color {\n        // http://stackoverflow.com/questions/27342715/blend-uicolors-in-swift\n\n        let total = intensity1 + intensity2\n        let level1 = intensity1/total\n        let level2 = intensity2/total\n\n        guard level1 > 0 else { return color2 }\n        guard level2 > 0 else { return color1 }\n\n        let components1: [CGFloat] = {\n            let comps = color1.cgColor.components!\n            return comps.count == 4 ? comps : [comps[0], comps[0], comps[0], comps[1]]\n        }()\n\n        let components2: [CGFloat] = {\n            let comps = color2.cgColor.components!\n            return comps.count == 4 ? comps : [comps[0], comps[0], comps[0], comps[1]]\n        }()\n\n        let red1 = components1[0]\n        let red2 = components2[0]\n\n        let green1 = components1[1]\n        let green2 = components2[1]\n\n        let blue1 = components1[2]\n        let blue2 = components2[2]\n\n        let alpha1 = color1.cgColor.alpha\n        let alpha2 = color2.cgColor.alpha\n\n        let red = level1*red1 + level2*red2\n        let green = level1*green1 + level2*green2\n        let blue = level1*blue1 + level2*blue2\n        let alpha = level1*alpha1 + level2*alpha2\n\n        return Color(red: red, green: green, blue: blue, alpha: alpha)\n    }\n\n    /// SwifterSwift: Lighten a color\n    ///\n    ///     let color = Color(red: r, green: g, blue: b, alpha: a)\n    ///     let lighterColor: Color = color.lighten(by: 0.2)\n    ///\n    /// - Parameter percentage: Percentage by which to lighten the color\n    /// - Returns: A lightened color\n    func lighten(by percentage: CGFloat = 0.2) -> Color {\n        // https://stackoverflow.com/questions/38435308/swift-get-lighter-and-darker-color-variations-for-a-given-uicolor\n        var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0\n        getRed(&red, green: &green, blue: &blue, alpha: &alpha)\n        return Color(red: min(red + percentage, 1.0),\n                     green: min(green + percentage, 1.0),\n                     blue: min(blue + percentage, 1.0),\n                     alpha: alpha)\n    }\n\n    /// SwifterSwift: Darken a color\n    ///\n    ///     let color = Color(red: r, green: g, blue: b, alpha: a)\n    ///     let darkerColor: Color = color.darken(by: 0.2)\n    ///\n    /// - Parameter percentage: Percentage by which to darken the color\n    /// - Returns: A darkened color\n    func darken(by percentage: CGFloat = 0.2) -> Color {\n        // https://stackoverflow.com/questions/38435308/swift-get-lighter-and-darker-color-variations-for-a-given-uicolor\n        var red: CGFloat = 0, green: CGFloat = 0, blue: CGFloat = 0, alpha: CGFloat = 0\n        getRed(&red, green: &green, blue: &blue, alpha: &alpha)\n        return Color(red: max(red - percentage, 0),\n                     green: max(green - percentage, 0),\n                     blue: max(blue - percentage, 0),\n                     alpha: alpha)\n    }\n\n}\n\n// MARK: - Initializers\npublic extension Color {\n\n    /// SwifterSwift: Create Color from RGB values with optional transparency.\n    ///\n    /// - Parameters:\n    ///   - red: red component.\n    ///   - green: green component.\n    ///   - blue: blue component.\n    ///   - transparency: optional transparency value (default is 1).\n    convenience init?(red: Int, green: Int, blue: Int, transparency: CGFloat = 1) {\n        guard red >= 0 && red <= 255 else { return nil }\n        guard green >= 0 && green <= 255 else { return nil }\n        guard blue >= 0 && blue <= 255 else { return nil }\n\n        var trans = transparency\n        if trans < 0 { trans = 0 }\n        if trans > 1 { trans = 1 }\n\n        self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: trans)\n    }\n\n    /// SwifterSwift: Create Color from hexadecimal value with optional transparency.\n    ///\n    /// - Parameters:\n    ///   - hex: hex Int (example: 0xDECEB5).\n    ///   - transparency: optional transparency value (default is 1).\n    convenience init?(hex: Int, transparency: CGFloat = 1) {\n        var trans = transparency\n        if trans < 0 { trans = 0 }\n        if trans > 1 { trans = 1 }\n\n        let red = (hex >> 16) & 0xff\n        let green = (hex >> 8) & 0xff\n        let blue = hex & 0xff\n        self.init(red: red, green: green, blue: blue, transparency: trans)\n    }\n\n    /// SwifterSwift: Create Color from hexadecimal string with optional transparency (if applicable).\n    ///\n    /// - Parameters:\n    ///   - hexString: hexadecimal string (examples: EDE7F6, 0xEDE7F6, #EDE7F6, #0ff, 0xF0F, ..).\n    ///   - transparency: optional transparency value (default is 1).\n    convenience init?(hexString: String, transparency: CGFloat = 1) {\n        var string = \"\"\n        if hexString.lowercased().hasPrefix(\"0x\") {\n            string =  hexString.replacingOccurrences(of: \"0x\", with: \"\")\n        } else if hexString.hasPrefix(\"#\") {\n            string = hexString.replacingOccurrences(of: \"#\", with: \"\")\n        } else {\n            string = hexString\n        }\n\n        if string.count == 3 { // convert hex to 6 digit format if in short format\n            var str = \"\"\n            string.forEach { str.append(String(repeating: String($0), count: 2)) }\n            string = str\n        }\n\n        guard let hexValue = Int(string, radix: 16) else { return nil }\n\n        var trans = transparency\n        if trans < 0 { trans = 0 }\n        if trans > 1 { trans = 1 }\n\n        let red = (hexValue >> 16) & 0xff\n        let green = (hexValue >> 8) & 0xff\n        let blue = hexValue & 0xff\n        self.init(red: red, green: green, blue: blue, transparency: trans)\n    }\n\n    /// SwifterSwift: Create Color from a complementary of a Color (if applicable).\n    ///\n    /// - Parameter color: color of which opposite color is desired.\n    convenience init?(complementaryFor color: Color) {\n        let colorSpaceRGB = CGColorSpaceCreateDeviceRGB()\n        let convertColorToRGBSpace: ((_ color: Color) -> Color?) = { color -> Color? in\n            if color.cgColor.colorSpace!.model == CGColorSpaceModel.monochrome {\n                let oldComponents = color.cgColor.components\n                let components: [CGFloat] = [ oldComponents![0], oldComponents![0], oldComponents![0], oldComponents![1]]\n                let colorRef = CGColor(colorSpace: colorSpaceRGB, components: components)\n                let colorOut = Color(cgColor: colorRef!)\n                return colorOut\n            } else {\n                return color\n            }\n        }\n\n        let color = convertColorToRGBSpace(color)\n        guard let componentColors = color?.cgColor.components else { return nil }\n\n        let red: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[0]*255), 2.0))/255\n        let green: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[1]*255), 2.0))/255\n        let blue: CGFloat = sqrt(pow(255.0, 2.0) - pow((componentColors[2]*255), 2.0))/255\n        self.init(red: red, green: green, blue: blue, alpha: 1.0)\n    }\n\n}\n\n// MARK: - Social\npublic extension Color {\n\n    /// SwifterSwift: Brand identity color of popular social media platform.\n    struct Social {\n        // https://www.lockedowndesign.com/social-media-colors/\n\n        private init() {}\n\n        /// SwifterSwift: red: 59, green: 89, blue: 152\n        public static let facebook = Color(red: 59, green: 89, blue: 152)!\n\n        /// SwifterSwift: red: 0, green: 182, blue: 241\n        public static let twitter = Color(red: 0, green: 182, blue: 241)!\n\n        /// SwifterSwift: red: 223, green: 74, blue: 50\n        public static let googlePlus = Color(red: 223, green: 74, blue: 50)!\n\n        /// SwifterSwift: red: 0, green: 123, blue: 182\n        public static let linkedIn = Color(red: 0, green: 123, blue: 182)!\n\n        /// SwifterSwift: red: 69, green: 187, blue: 255\n        public static let vimeo = Color(red: 69, green: 187, blue: 255)!\n\n        /// SwifterSwift: red: 179, green: 18, blue: 23\n        public static let youtube = Color(red: 179, green: 18, blue: 23)!\n\n        /// SwifterSwift: red: 195, green: 42, blue: 163\n        public static let instagram = Color(red: 195, green: 42, blue: 163)!\n\n        /// SwifterSwift: red: 203, green: 32, blue: 39\n        public static let pinterest = Color(red: 203, green: 32, blue: 39)!\n\n        /// SwifterSwift: red: 244, green: 0, blue: 131\n        public static let flickr = Color(red: 244, green: 0, blue: 131)!\n\n        /// SwifterSwift: red: 67, green: 2, blue: 151\n        public static let yahoo = Color(red: 67, green: 2, blue: 151)!\n\n        /// SwifterSwift: red: 67, green: 2, blue: 151\n        public static let soundCloud = Color(red: 67, green: 2, blue: 151)!\n\n        /// SwifterSwift: red: 44, green: 71, blue: 98\n        public static let tumblr = Color(red: 44, green: 71, blue: 98)!\n\n        /// SwifterSwift: red: 252, green: 69, blue: 117\n        public static let foursquare = Color(red: 252, green: 69, blue: 117)!\n\n        /// SwifterSwift: red: 255, green: 176, blue: 0\n        public static let swarm = Color(red: 255, green: 176, blue: 0)!\n\n        /// SwifterSwift: red: 234, green: 76, blue: 137\n        public static let dribbble = Color(red: 234, green: 76, blue: 137)!\n\n        /// SwifterSwift: red: 255, green: 87, blue: 0\n        public static let reddit = Color(red: 255, green: 87, blue: 0)!\n\n        /// SwifterSwift: red: 74, green: 93, blue: 78\n        public static let devianArt = Color(red: 74, green: 93, blue: 78)!\n\n        /// SwifterSwift: red: 238, green: 64, blue: 86\n        public static let pocket = Color(red: 238, green: 64, blue: 86)!\n\n        /// SwifterSwift: red: 170, green: 34, blue: 182\n        public static let quora = Color(red: 170, green: 34, blue: 182)!\n\n        /// SwifterSwift: red: 247, green: 146, blue: 30\n        public static let slideShare = Color(red: 247, green: 146, blue: 30)!\n\n        /// SwifterSwift: red: 0, green: 153, blue: 229\n        public static let px500 = Color(red: 0, green: 153, blue: 229)!\n\n        /// SwifterSwift: red: 223, green: 109, blue: 70\n        public static let listly = Color(red: 223, green: 109, blue: 70)!\n\n        /// SwifterSwift: red: 0, green: 180, blue: 137\n        public static let vine = Color(red: 0, green: 180, blue: 137)!\n\n        /// SwifterSwift: red: 0, green: 175, blue: 240\n        public static let skype = Color(red: 0, green: 175, blue: 240)!\n\n        /// SwifterSwift: red: 235, green: 73, blue: 36\n        public static let stumbleUpon = Color(red: 235, green: 73, blue: 36)!\n\n        /// SwifterSwift: red: 255, green: 252, blue: 0\n        public static let snapchat = Color(red: 255, green: 252, blue: 0)!\n\n        /// SwifterSwift: red: 37, green: 211, blue: 102\n        public static let whatsApp = Color(red: 37, green: 211, blue: 102)!\n    }\n\n}\n\n// MARK: - Material colors\npublic extension Color {\n\n    // swiftlint:disable type_body_length\n    /// SwifterSwift: Google Material design colors palette.\n    struct Material {\n        // https://material.google.com/style/color.html\n\n        private init() {}\n\n        /// SwifterSwift: color red500\n        public static let red\t\t\t\t\t= red500\n\n        /// SwifterSwift: hex #FFEBEE\n        public static let red50\t\t\t\t\t= Color(hex: 0xFFEBEE)!\n\n        /// SwifterSwift: hex #FFCDD2\n        public static let red100\t\t\t\t= Color(hex: 0xFFCDD2)!\n\n        /// SwifterSwift: hex #EF9A9A\n        public static let red200\t\t\t\t= Color(hex: 0xEF9A9A)!\n\n        /// SwifterSwift: hex #E57373\n        public static let red300\t\t\t\t= Color(hex: 0xE57373)!\n\n        /// SwifterSwift: hex #EF5350\n        public static let red400\t\t\t\t= Color(hex: 0xEF5350)!\n\n        /// SwifterSwift: hex #F44336\n        public static let red500\t\t\t\t= Color(hex: 0xF44336)!\n\n        /// SwifterSwift: hex #E53935\n        public static let red600\t\t\t\t= Color(hex: 0xE53935)!\n\n        /// SwifterSwift: hex #D32F2F\n        public static let red700\t\t\t\t= Color(hex: 0xD32F2F)!\n\n        /// SwifterSwift: hex #C62828\n        public static let red800\t\t\t\t= Color(hex: 0xC62828)!\n\n        /// SwifterSwift: hex #B71C1C\n        public static let red900\t\t\t\t= Color(hex: 0xB71C1C)!\n\n        /// SwifterSwift: hex #FF8A80\n        public static let redA100\t\t\t\t= Color(hex: 0xFF8A80)!\n\n        /// SwifterSwift: hex #FF5252\n        public static let redA200\t\t\t\t= Color(hex: 0xFF5252)!\n\n        /// SwifterSwift: hex #FF1744\n        public static let redA400\t\t\t\t= Color(hex: 0xFF1744)!\n\n        /// SwifterSwift: hex #D50000\n        public static let redA700\t\t\t\t= Color(hex: 0xD50000)!\n\n        /// SwifterSwift: color pink500\n        public static let pink\t\t\t\t\t= pink500\n\n        /// SwifterSwift: hex #FCE4EC\n        public static let pink50\t\t\t\t= Color(hex: 0xFCE4EC)!\n\n        /// SwifterSwift: hex #F8BBD0\n        public static let pink100\t\t\t\t= Color(hex: 0xF8BBD0)!\n\n        /// SwifterSwift: hex #F48FB1\n        public static let pink200\t\t\t\t= Color(hex: 0xF48FB1)!\n\n        /// SwifterSwift: hex #F06292\n        public static let pink300\t\t\t\t= Color(hex: 0xF06292)!\n\n        /// SwifterSwift: hex #EC407A\n        public static let pink400\t\t\t\t= Color(hex: 0xEC407A)!\n\n        /// SwifterSwift: hex #E91E63\n        public static let pink500\t\t\t\t= Color(hex: 0xE91E63)!\n\n        /// SwifterSwift: hex #D81B60\n        public static let pink600\t\t\t\t= Color(hex: 0xD81B60)!\n\n        /// SwifterSwift: hex #C2185B\n        public static let pink700\t\t\t\t= Color(hex: 0xC2185B)!\n\n        /// SwifterSwift: hex #AD1457\n        public static let pink800\t\t\t\t= Color(hex: 0xAD1457)!\n\n        /// SwifterSwift: hex #880E4F\n        public static let pink900\t\t\t\t= Color(hex: 0x880E4F)!\n\n        /// SwifterSwift: hex #FF80AB\n        public static let pinkA100\t\t\t\t= Color(hex: 0xFF80AB)!\n\n        /// SwifterSwift: hex #FF4081\n        public static let pinkA200\t\t\t\t= Color(hex: 0xFF4081)!\n\n        /// SwifterSwift: hex #F50057\n        public static let pinkA400\t\t\t\t= Color(hex: 0xF50057)!\n\n        /// SwifterSwift: hex #C51162\n        public static let pinkA700\t\t\t\t= Color(hex: 0xC51162)!\n\n        /// SwifterSwift: color purple500\n        public static let purple\t\t\t\t= purple500\n\n        /// SwifterSwift: hex #F3E5F5\n        public static let purple50\t\t\t\t= Color(hex: 0xF3E5F5)!\n\n        /// SwifterSwift: hex #E1BEE7\n        public static let purple100\t\t\t\t= Color(hex: 0xE1BEE7)!\n\n        /// SwifterSwift: hex #CE93D8\n        public static let purple200\t\t\t\t= Color(hex: 0xCE93D8)!\n\n        /// SwifterSwift: hex #BA68C8\n        public static let purple300\t\t\t\t= Color(hex: 0xBA68C8)!\n\n        /// SwifterSwift: hex #AB47BC\n        public static let purple400\t\t\t\t= Color(hex: 0xAB47BC)!\n\n        /// SwifterSwift: hex #9C27B0\n        public static let purple500\t\t\t\t= Color(hex: 0x9C27B0)!\n\n        /// SwifterSwift: hex #8E24AA\n        public static let purple600\t\t\t\t= Color(hex: 0x8E24AA)!\n\n        /// SwifterSwift: hex #7B1FA2\n        public static let purple700\t\t\t\t= Color(hex: 0x7B1FA2)!\n\n        /// SwifterSwift: hex #6A1B9A\n        public static let purple800\t\t\t\t= Color(hex: 0x6A1B9A)!\n\n        /// SwifterSwift: hex #4A148C\n        public static let purple900\t\t\t\t= Color(hex: 0x4A148C)!\n\n        /// SwifterSwift: hex #EA80FC\n        public static let purpleA100\t\t\t= Color(hex: 0xEA80FC)!\n\n        /// SwifterSwift: hex #E040FB\n        public static let purpleA200\t\t\t= Color(hex: 0xE040FB)!\n\n        /// SwifterSwift: hex #D500F9\n        public static let purpleA400\t\t\t= Color(hex: 0xD500F9)!\n\n        /// SwifterSwift: hex #AA00FF\n        public static let purpleA700\t\t\t= Color(hex: 0xAA00FF)!\n\n        /// SwifterSwift: color deepPurple500\n        public static let deepPurple\t\t\t= deepPurple500\n\n        /// SwifterSwift: hex #EDE7F6\n        public static let deepPurple50\t\t\t= Color(hex: 0xEDE7F6)!\n\n        /// SwifterSwift: hex #D1C4E9\n        public static let deepPurple100\t\t\t= Color(hex: 0xD1C4E9)!\n\n        /// SwifterSwift: hex #B39DDB\n        public static let deepPurple200\t\t\t= Color(hex: 0xB39DDB)!\n\n        /// SwifterSwift: hex #9575CD\n        public static let deepPurple300\t\t\t= Color(hex: 0x9575CD)!\n\n        /// SwifterSwift: hex #7E57C2\n        public static let deepPurple400\t\t\t= Color(hex: 0x7E57C2)!\n\n        /// SwifterSwift: hex #673AB7\n        public static let deepPurple500\t\t\t= Color(hex: 0x673AB7)!\n\n        /// SwifterSwift: hex #5E35B1\n        public static let deepPurple600\t\t\t= Color(hex: 0x5E35B1)!\n\n        /// SwifterSwift: hex #512DA8\n        public static let deepPurple700\t\t\t= Color(hex: 0x512DA8)!\n\n        /// SwifterSwift: hex #4527A0\n        public static let deepPurple800\t\t\t= Color(hex: 0x4527A0)!\n\n        /// SwifterSwift: hex #311B92\n        public static let deepPurple900\t\t\t= Color(hex: 0x311B92)!\n\n        /// SwifterSwift: hex #B388FF\n        public static let deepPurpleA100\t\t= Color(hex: 0xB388FF)!\n\n        /// SwifterSwift: hex #7C4DFF\n        public static let deepPurpleA200\t\t= Color(hex: 0x7C4DFF)!\n\n        /// SwifterSwift: hex #651FFF\n        public static let deepPurpleA400\t\t= Color(hex: 0x651FFF)!\n\n        /// SwifterSwift: hex #6200EA\n        public static let deepPurpleA700\t\t= Color(hex: 0x6200EA)!\n\n        /// SwifterSwift: color indigo500\n        public static let indigo\t\t\t\t= indigo500\n\n        /// SwifterSwift: hex #E8EAF6\n        public static let indigo50\t\t\t\t= Color(hex: 0xE8EAF6)!\n\n        /// SwifterSwift: hex #C5CAE9\n        public static let indigo100\t\t\t\t= Color(hex: 0xC5CAE9)!\n\n        /// SwifterSwift: hex #9FA8DA\n        public static let indigo200\t\t\t\t= Color(hex: 0x9FA8DA)!\n\n        /// SwifterSwift: hex #7986CB\n        public static let indigo300\t\t\t\t= Color(hex: 0x7986CB)!\n\n        /// SwifterSwift: hex #5C6BC0\n        public static let indigo400\t\t\t\t= Color(hex: 0x5C6BC0)!\n\n        /// SwifterSwift: hex #3F51B5\n        public static let indigo500\t\t\t\t= Color(hex: 0x3F51B5)!\n\n        /// SwifterSwift: hex #3949AB\n        public static let indigo600\t\t\t\t= Color(hex: 0x3949AB)!\n\n        /// SwifterSwift: hex #303F9F\n        public static let indigo700\t\t\t\t= Color(hex: 0x303F9F)!\n\n        /// SwifterSwift: hex #283593\n        public static let indigo800\t\t\t\t= Color(hex: 0x283593)!\n\n        /// SwifterSwift: hex #1A237E\n        public static let indigo900\t\t\t\t= Color(hex: 0x1A237E)!\n\n        /// SwifterSwift: hex #8C9EFF\n        public static let indigoA100\t\t\t= Color(hex: 0x8C9EFF)!\n\n        /// SwifterSwift: hex #536DFE\n        public static let indigoA200\t\t\t= Color(hex: 0x536DFE)!\n\n        /// SwifterSwift: hex #3D5AFE\n        public static let indigoA400\t\t\t= Color(hex: 0x3D5AFE)!\n\n        /// SwifterSwift: hex #304FFE\n        public static let indigoA700\t\t\t= Color(hex: 0x304FFE)!\n\n        /// SwifterSwift: color blue500\n        public static let blue\t\t\t\t\t= blue500\n\n        /// SwifterSwift: hex #E3F2FD\n        public static let blue50\t\t\t\t= Color(hex: 0xE3F2FD)!\n\n        /// SwifterSwift: hex #BBDEFB\n        public static let blue100\t\t\t\t= Color(hex: 0xBBDEFB)!\n\n        /// SwifterSwift: hex #90CAF9\n        public static let blue200\t\t\t\t= Color(hex: 0x90CAF9)!\n\n        /// SwifterSwift: hex #64B5F6\n        public static let blue300\t\t\t\t= Color(hex: 0x64B5F6)!\n\n        /// SwifterSwift: hex #42A5F5\n        public static let blue400\t\t\t\t= Color(hex: 0x42A5F5)!\n\n        /// SwifterSwift: hex #2196F3\n        public static let blue500\t\t\t\t= Color(hex: 0x2196F3)!\n\n        /// SwifterSwift: hex #1E88E5\n        public static let blue600\t\t\t\t= Color(hex: 0x1E88E5)!\n\n        /// SwifterSwift: hex #1976D2\n        public static let blue700\t\t\t\t= Color(hex: 0x1976D2)!\n\n        /// SwifterSwift: hex #1565C0\n        public static let blue800\t\t\t\t= Color(hex: 0x1565C0)!\n\n        /// SwifterSwift: hex #0D47A1\n        public static let blue900\t\t\t\t= Color(hex: 0x0D47A1)!\n\n        /// SwifterSwift: hex #82B1FF\n        public static let blueA100\t\t\t\t= Color(hex: 0x82B1FF)!\n\n        /// SwifterSwift: hex #448AFF\n        public static let blueA200\t\t\t\t= Color(hex: 0x448AFF)!\n\n        /// SwifterSwift: hex #2979FF\n        public static let blueA400\t\t\t\t= Color(hex: 0x2979FF)!\n\n        /// SwifterSwift: hex #2962FF\n        public static let blueA700\t\t\t\t= Color(hex: 0x2962FF)!\n\n        /// SwifterSwift: color lightBlue500\n        public static let lightBlue\t\t\t\t= lightBlue500\n\n        /// SwifterSwift: hex #E1F5FE\n        public static let lightBlue50\t\t\t= Color(hex: 0xE1F5FE)!\n\n        /// SwifterSwift: hex #B3E5FC\n        public static let lightBlue100\t\t\t= Color(hex: 0xB3E5FC)!\n\n        /// SwifterSwift: hex #81D4FA\n        public static let lightBlue200\t\t\t= Color(hex: 0x81D4FA)!\n\n        /// SwifterSwift: hex #4FC3F7\n        public static let lightBlue300\t\t\t= Color(hex: 0x4FC3F7)!\n\n        /// SwifterSwift: hex #29B6F6\n        public static let lightBlue400\t\t\t= Color(hex: 0x29B6F6)!\n\n        /// SwifterSwift: hex #03A9F4\n        public static let lightBlue500\t\t\t= Color(hex: 0x03A9F4)!\n\n        /// SwifterSwift: hex #039BE5\n        public static let lightBlue600\t\t\t= Color(hex: 0x039BE5)!\n\n        /// SwifterSwift: hex #0288D1\n        public static let lightBlue700\t\t\t= Color(hex: 0x0288D1)!\n\n        /// SwifterSwift: hex #0277BD\n        public static let lightBlue800\t\t\t= Color(hex: 0x0277BD)!\n\n        /// SwifterSwift: hex #01579B\n        public static let lightBlue900\t\t\t= Color(hex: 0x01579B)!\n\n        /// SwifterSwift: hex #80D8FF\n        public static let lightBlueA100\t\t\t= Color(hex: 0x80D8FF)!\n\n        /// SwifterSwift: hex #40C4FF\n        public static let lightBlueA200\t\t\t= Color(hex: 0x40C4FF)!\n\n        /// SwifterSwift: hex #00B0FF\n        public static let lightBlueA400\t\t\t= Color(hex: 0x00B0FF)!\n\n        /// SwifterSwift: hex #0091EA\n        public static let lightBlueA700\t\t\t= Color(hex: 0x0091EA)!\n\n        /// SwifterSwift: color cyan500\n        public static let cyan\t\t\t\t\t= cyan500\n\n        /// SwifterSwift: hex #E0F7FA\n        public static let cyan50\t\t\t\t= Color(hex: 0xE0F7FA)!\n\n        /// SwifterSwift: hex #B2EBF2\n        public static let cyan100\t\t\t\t= Color(hex: 0xB2EBF2)!\n\n        /// SwifterSwift: hex #80DEEA\n        public static let cyan200\t\t\t\t= Color(hex: 0x80DEEA)!\n\n        /// SwifterSwift: hex #4DD0E1\n        public static let cyan300\t\t\t\t= Color(hex: 0x4DD0E1)!\n\n        /// SwifterSwift: hex #26C6DA\n        public static let cyan400\t\t\t\t= Color(hex: 0x26C6DA)!\n\n        /// SwifterSwift: hex #00BCD4\n        public static let cyan500\t\t\t\t= Color(hex: 0x00BCD4)!\n\n        /// SwifterSwift: hex #00ACC1\n        public static let cyan600\t\t\t\t= Color(hex: 0x00ACC1)!\n\n        /// SwifterSwift: hex #0097A7\n        public static let cyan700\t\t\t\t= Color(hex: 0x0097A7)!\n\n        /// SwifterSwift: hex #00838F\n        public static let cyan800\t\t\t\t= Color(hex: 0x00838F)!\n\n        /// SwifterSwift: hex #006064\n        public static let cyan900\t\t\t\t= Color(hex: 0x006064)!\n\n        /// SwifterSwift: hex #84FFFF\n        public static let cyanA100\t\t\t\t= Color(hex: 0x84FFFF)!\n\n        /// SwifterSwift: hex #18FFFF\n        public static let cyanA200\t\t\t\t= Color(hex: 0x18FFFF)!\n\n        /// SwifterSwift: hex #00E5FF\n        public static let cyanA400\t\t\t\t= Color(hex: 0x00E5FF)!\n\n        /// SwifterSwift: hex #00B8D4\n        public static let cyanA700\t\t\t\t= Color(hex: 0x00B8D4)!\n\n        /// SwifterSwift: color teal500\n        public static let teal\t\t\t\t\t= teal500\n\n        /// SwifterSwift: hex #E0F2F1\n        public static let teal50\t\t\t\t= Color(hex: 0xE0F2F1)!\n\n        /// SwifterSwift: hex #B2DFDB\n        public static let teal100\t\t\t\t= Color(hex: 0xB2DFDB)!\n\n        /// SwifterSwift: hex #80CBC4\n        public static let teal200\t\t\t\t= Color(hex: 0x80CBC4)!\n\n        /// SwifterSwift: hex #4DB6AC\n        public static let teal300\t\t\t\t= Color(hex: 0x4DB6AC)!\n\n        /// SwifterSwift: hex #26A69A\n        public static let teal400\t\t\t\t= Color(hex: 0x26A69A)!\n\n        /// SwifterSwift: hex #009688\n        public static let teal500\t\t\t\t= Color(hex: 0x009688)!\n\n        /// SwifterSwift: hex #00897B\n        public static let teal600\t\t\t\t= Color(hex: 0x00897B)!\n\n        /// SwifterSwift: hex #00796B\n        public static let teal700\t\t\t\t= Color(hex: 0x00796B)!\n\n        /// SwifterSwift: hex #00695C\n        public static let teal800\t\t\t\t= Color(hex: 0x00695C)!\n\n        /// SwifterSwift: hex #004D40\n        public static let teal900\t\t\t\t= Color(hex: 0x004D40)!\n\n        /// SwifterSwift: hex #A7FFEB\n        public static let tealA100\t\t\t\t= Color(hex: 0xA7FFEB)!\n\n        /// SwifterSwift: hex #64FFDA\n        public static let tealA200\t\t\t\t= Color(hex: 0x64FFDA)!\n\n        /// SwifterSwift: hex #1DE9B6\n        public static let tealA400\t\t\t\t= Color(hex: 0x1DE9B6)!\n\n        /// SwifterSwift: hex #00BFA5\n        public static let tealA700\t\t\t\t= Color(hex: 0x00BFA5)!\n\n        /// SwifterSwift: color green500\n        public static let green\t\t\t\t\t= green500\n\n        /// SwifterSwift: hex #E8F5E9\n        public static let green50\t\t\t\t= Color(hex: 0xE8F5E9)!\n\n        /// SwifterSwift: hex #C8E6C9\n        public static let green100\t\t\t\t= Color(hex: 0xC8E6C9)!\n\n        /// SwifterSwift: hex #A5D6A7\n        public static let green200\t\t\t\t= Color(hex: 0xA5D6A7)!\n\n        /// SwifterSwift: hex #81C784\n        public static let green300\t\t\t\t= Color(hex: 0x81C784)!\n\n        /// SwifterSwift: hex #66BB6A\n        public static let green400\t\t\t\t= Color(hex: 0x66BB6A)!\n\n        /// SwifterSwift: hex #4CAF50\n        public static let green500\t\t\t\t= Color(hex: 0x4CAF50)!\n\n        /// SwifterSwift: hex #43A047\n        public static let green600\t\t\t\t= Color(hex: 0x43A047)!\n\n        /// SwifterSwift: hex #388E3C\n        public static let green700\t\t\t\t= Color(hex: 0x388E3C)!\n\n        /// SwifterSwift: hex #2E7D32\n        public static let green800\t\t\t\t= Color(hex: 0x2E7D32)!\n\n        /// SwifterSwift: hex #1B5E20\n        public static let green900\t\t\t\t= Color(hex: 0x1B5E20)!\n\n        /// SwifterSwift: hex #B9F6CA\n        public static let greenA100\t\t\t\t= Color(hex: 0xB9F6CA)!\n\n        /// SwifterSwift: hex #69F0AE\n        public static let greenA200\t\t\t\t= Color(hex: 0x69F0AE)!\n\n        /// SwifterSwift: hex #00E676\n        public static let greenA400\t\t\t\t= Color(hex: 0x00E676)!\n\n        /// SwifterSwift: hex #00C853\n        public static let greenA700\t\t\t\t= Color(hex: 0x00C853)!\n\n        /// SwifterSwift: color lightGreen500\n        public static let lightGreen\t\t\t= lightGreen500\n\n        /// SwifterSwift: hex #F1F8E9\n        public static let lightGreen50\t\t\t= Color(hex: 0xF1F8E9)!\n\n        /// SwifterSwift: hex #DCEDC8\n        public static let lightGreen100\t\t\t= Color(hex: 0xDCEDC8)!\n\n        /// SwifterSwift: hex #C5E1A5\n        public static let lightGreen200\t\t\t= Color(hex: 0xC5E1A5)!\n\n        /// SwifterSwift: hex #AED581\n        public static let lightGreen300\t\t\t= Color(hex: 0xAED581)!\n\n        /// SwifterSwift: hex #9CCC65\n        public static let lightGreen400\t\t\t= Color(hex: 0x9CCC65)!\n\n        /// SwifterSwift: hex #8BC34A\n        public static let lightGreen500\t\t\t= Color(hex: 0x8BC34A)!\n\n        /// SwifterSwift: hex #7CB342\n        public static let lightGreen600\t\t\t= Color(hex: 0x7CB342)!\n\n        /// SwifterSwift: hex #689F38\n        public static let lightGreen700\t\t\t= Color(hex: 0x689F38)!\n\n        /// SwifterSwift: hex #558B2F\n        public static let lightGreen800\t\t\t= Color(hex: 0x558B2F)!\n\n        /// SwifterSwift: hex #33691E\n        public static let lightGreen900\t\t\t= Color(hex: 0x33691E)!\n\n        /// SwifterSwift: hex #CCFF90\n        public static let lightGreenA100\t\t= Color(hex: 0xCCFF90)!\n\n        /// SwifterSwift: hex #B2FF59\n        public static let lightGreenA200\t\t= Color(hex: 0xB2FF59)!\n\n        /// SwifterSwift: hex #76FF03\n        public static let lightGreenA400\t\t= Color(hex: 0x76FF03)!\n\n        /// SwifterSwift: hex #64DD17\n        public static let lightGreenA700\t\t= Color(hex: 0x64DD17)!\n\n        /// SwifterSwift: color lime500\n        public static let lime\t\t\t\t\t= lime500\n\n        /// SwifterSwift: hex #F9FBE7\n        public static let lime50\t\t\t\t= Color(hex: 0xF9FBE7)!\n\n        /// SwifterSwift: hex #F0F4C3\n        public static let lime100\t\t\t\t= Color(hex: 0xF0F4C3)!\n\n        /// SwifterSwift: hex #E6EE9C\n        public static let lime200\t\t\t\t= Color(hex: 0xE6EE9C)!\n\n        /// SwifterSwift: hex #DCE775\n        public static let lime300\t\t\t\t= Color(hex: 0xDCE775)!\n\n        /// SwifterSwift: hex #D4E157\n        public static let lime400\t\t\t\t= Color(hex: 0xD4E157)!\n\n        /// SwifterSwift: hex #CDDC39\n        public static let lime500\t\t\t\t= Color(hex: 0xCDDC39)!\n\n        /// SwifterSwift: hex #C0CA33\n        public static let lime600\t\t\t\t= Color(hex: 0xC0CA33)!\n\n        /// SwifterSwift: hex #AFB42B\n        public static let lime700\t\t\t\t= Color(hex: 0xAFB42B)!\n\n        /// SwifterSwift: hex #9E9D24\n        public static let lime800\t\t\t\t= Color(hex: 0x9E9D24)!\n\n        /// SwifterSwift: hex #827717\n        public static let lime900\t\t\t\t= Color(hex: 0x827717)!\n\n        /// SwifterSwift: hex #F4FF81\n        public static let limeA100\t\t\t\t= Color(hex: 0xF4FF81)!\n\n        /// SwifterSwift: hex #EEFF41\n        public static let limeA200\t\t\t\t= Color(hex: 0xEEFF41)!\n\n        /// SwifterSwift: hex #C6FF00\n        public static let limeA400\t\t\t\t= Color(hex: 0xC6FF00)!\n\n        /// SwifterSwift: hex #AEEA00\n        public static let limeA700\t\t\t\t= Color(hex: 0xAEEA00)!\n\n        /// SwifterSwift: color yellow500\n        public static let yellow\t\t\t\t= yellow500\n\n        /// SwifterSwift: hex #FFFDE7\n        public static let yellow50\t\t\t\t= Color(hex: 0xFFFDE7)!\n\n        /// SwifterSwift: hex #FFF9C4\n        public static let yellow100\t\t\t\t= Color(hex: 0xFFF9C4)!\n\n        /// SwifterSwift: hex #FFF59D\n        public static let yellow200\t\t\t\t= Color(hex: 0xFFF59D)!\n\n        /// SwifterSwift: hex #FFF176\n        public static let yellow300\t\t\t\t= Color(hex: 0xFFF176)!\n\n        /// SwifterSwift: hex #FFEE58\n        public static let yellow400\t\t\t\t= Color(hex: 0xFFEE58)!\n\n        /// SwifterSwift: hex #FFEB3B\n        public static let yellow500\t\t\t\t= Color(hex: 0xFFEB3B)!\n\n        /// SwifterSwift: hex #FDD835\n        public static let yellow600\t\t\t\t= Color(hex: 0xFDD835)!\n\n        /// SwifterSwift: hex #FBC02D\n        public static let yellow700\t\t\t\t= Color(hex: 0xFBC02D)!\n\n        /// SwifterSwift: hex #F9A825\n        public static let yellow800\t\t\t\t= Color(hex: 0xF9A825)!\n\n        /// SwifterSwift: hex #F57F17\n        public static let yellow900\t\t\t\t= Color(hex: 0xF57F17)!\n\n        /// SwifterSwift: hex #FFFF8D\n        public static let yellowA100\t\t\t= Color(hex: 0xFFFF8D)!\n\n        /// SwifterSwift: hex #FFFF00\n        public static let yellowA200\t\t\t= Color(hex: 0xFFFF00)!\n\n        /// SwifterSwift: hex #FFEA00\n        public static let yellowA400\t\t\t= Color(hex: 0xFFEA00)!\n\n        /// SwifterSwift: hex #FFD600\n        public static let yellowA700\t\t\t= Color(hex: 0xFFD600)!\n\n        /// SwifterSwift: color amber500\n        public static let amber\t\t\t\t\t= amber500\n\n        /// SwifterSwift: hex #FFF8E1\n        public static let amber50\t\t\t\t= Color(hex: 0xFFF8E1)!\n\n        /// SwifterSwift: hex #FFECB3\n        public static let amber100\t\t\t\t= Color(hex: 0xFFECB3)!\n\n        /// SwifterSwift: hex #FFE082\n        public static let amber200\t\t\t\t= Color(hex: 0xFFE082)!\n\n        /// SwifterSwift: hex #FFD54F\n        public static let amber300\t\t\t\t= Color(hex: 0xFFD54F)!\n\n        /// SwifterSwift: hex #FFCA28\n        public static let amber400\t\t\t\t= Color(hex: 0xFFCA28)!\n\n        /// SwifterSwift: hex #FFC107\n        public static let amber500\t\t\t\t= Color(hex: 0xFFC107)!\n\n        /// SwifterSwift: hex #FFB300\n        public static let amber600\t\t\t\t= Color(hex: 0xFFB300)!\n\n        /// SwifterSwift: hex #FFA000\n        public static let amber700\t\t\t\t= Color(hex: 0xFFA000)!\n\n        /// SwifterSwift: hex #FF8F00\n        public static let amber800\t\t\t\t= Color(hex: 0xFF8F00)!\n\n        /// SwifterSwift: hex #FF6F00\n        public static let amber900\t\t\t\t= Color(hex: 0xFF6F00)!\n\n        /// SwifterSwift: hex #FFE57F\n        public static let amberA100\t\t\t\t= Color(hex: 0xFFE57F)!\n\n        /// SwifterSwift: hex #FFD740\n        public static let amberA200\t\t\t\t= Color(hex: 0xFFD740)!\n\n        /// SwifterSwift: hex #FFC400\n        public static let amberA400\t\t\t\t= Color(hex: 0xFFC400)!\n\n        /// SwifterSwift: hex #FFAB00\n        public static let amberA700\t\t\t\t= Color(hex: 0xFFAB00)!\n\n        /// SwifterSwift: color orange500\n        public static let orange\t\t\t\t= orange500\n\n        /// SwifterSwift: hex #FFF3E0\n        public static let orange50\t\t\t\t= Color(hex: 0xFFF3E0)!\n\n        /// SwifterSwift: hex #FFE0B2\n        public static let orange100\t\t\t\t= Color(hex: 0xFFE0B2)!\n\n        /// SwifterSwift: hex #FFCC80\n        public static let orange200\t\t\t\t= Color(hex: 0xFFCC80)!\n\n        /// SwifterSwift: hex #FFB74D\n        public static let orange300\t\t\t\t= Color(hex: 0xFFB74D)!\n\n        /// SwifterSwift: hex #FFA726\n        public static let orange400\t\t\t\t= Color(hex: 0xFFA726)!\n\n        /// SwifterSwift: hex #FF9800\n        public static let orange500\t\t\t\t= Color(hex: 0xFF9800)!\n\n        /// SwifterSwift: hex #FB8C00\n        public static let orange600\t\t\t\t= Color(hex: 0xFB8C00)!\n\n        /// SwifterSwift: hex #F57C00\n        public static let orange700\t\t\t\t= Color(hex: 0xF57C00)!\n\n        /// SwifterSwift: hex #EF6C00\n        public static let orange800\t\t\t\t= Color(hex: 0xEF6C00)!\n\n        /// SwifterSwift: hex #E65100\n        public static let orange900\t\t\t\t= Color(hex: 0xE65100)!\n\n        /// SwifterSwift: hex #FFD180\n        public static let orangeA100\t\t\t= Color(hex: 0xFFD180)!\n\n        /// SwifterSwift: hex #FFAB40\n        public static let orangeA200\t\t\t= Color(hex: 0xFFAB40)!\n\n        /// SwifterSwift: hex #FF9100\n        public static let orangeA400\t\t\t= Color(hex: 0xFF9100)!\n\n        /// SwifterSwift: hex #FF6D00\n        public static let orangeA700\t\t\t= Color(hex: 0xFF6D00)!\n\n        /// SwifterSwift: color deepOrange500\n        public static let deepOrange\t\t\t= deepOrange500\n\n        /// SwifterSwift: hex #FBE9E7\n        public static let deepOrange50\t\t\t= Color(hex: 0xFBE9E7)!\n\n        /// SwifterSwift: hex #FFCCBC\n        public static let deepOrange100\t\t\t= Color(hex: 0xFFCCBC)!\n\n        /// SwifterSwift: hex #FFAB91\n        public static let deepOrange200\t\t\t= Color(hex: 0xFFAB91)!\n\n        /// SwifterSwift: hex #FF8A65\n        public static let deepOrange300\t\t\t= Color(hex: 0xFF8A65)!\n\n        /// SwifterSwift: hex #FF7043\n        public static let deepOrange400\t\t\t= Color(hex: 0xFF7043)!\n\n        /// SwifterSwift: hex #FF5722\n        public static let deepOrange500\t\t\t= Color(hex: 0xFF5722)!\n\n        /// SwifterSwift: hex #F4511E\n        public static let deepOrange600\t\t\t= Color(hex: 0xF4511E)!\n\n        /// SwifterSwift: hex #E64A19\n        public static let deepOrange700\t\t\t= Color(hex: 0xE64A19)!\n\n        /// SwifterSwift: hex #D84315\n        public static let deepOrange800\t\t\t= Color(hex: 0xD84315)!\n\n        /// SwifterSwift: hex #BF360C\n        public static let deepOrange900\t\t\t= Color(hex: 0xBF360C)!\n\n        /// SwifterSwift: hex #FF9E80\n        public static let deepOrangeA100\t\t= Color(hex: 0xFF9E80)!\n\n        /// SwifterSwift: hex #FF6E40\n        public static let deepOrangeA200\t\t= Color(hex: 0xFF6E40)!\n\n        /// SwifterSwift: hex #FF3D00\n        public static let deepOrangeA400\t\t= Color(hex: 0xFF3D00)!\n\n        /// SwifterSwift: hex #DD2C00\n        public static let deepOrangeA700\t\t= Color(hex: 0xDD2C00)!\n\n        /// SwifterSwift: color brown500\n        public static let brown\t\t\t\t\t= brown500\n\n        /// SwifterSwift: hex #EFEBE9\n        public static let brown50\t\t\t\t= Color(hex: 0xEFEBE9)!\n\n        /// SwifterSwift: hex #D7CCC8\n        public static let brown100\t\t\t\t= Color(hex: 0xD7CCC8)!\n\n        /// SwifterSwift: hex #BCAAA4\n        public static let brown200\t\t\t\t= Color(hex: 0xBCAAA4)!\n\n        /// SwifterSwift: hex #A1887F\n        public static let brown300\t\t\t\t= Color(hex: 0xA1887F)!\n\n        /// SwifterSwift: hex #8D6E63\n        public static let brown400\t\t\t\t= Color(hex: 0x8D6E63)!\n\n        /// SwifterSwift: hex #795548\n        public static let brown500\t\t\t\t= Color(hex: 0x795548)!\n\n        /// SwifterSwift: hex #6D4C41\n        public static let brown600\t\t\t\t= Color(hex: 0x6D4C41)!\n\n        /// SwifterSwift: hex #5D4037\n        public static let brown700\t\t\t\t= Color(hex: 0x5D4037)!\n\n        /// SwifterSwift: hex #4E342E\n        public static let brown800\t\t\t\t= Color(hex: 0x4E342E)!\n\n        /// SwifterSwift: hex #3E2723\n        public static let brown900\t\t\t\t= Color(hex: 0x3E2723)!\n\n        /// SwifterSwift: color grey500\n        public static let grey\t\t\t\t\t= grey500\n\n        /// SwifterSwift: hex #FAFAFA\n        public static let grey50\t\t\t\t= Color(hex: 0xFAFAFA)!\n\n        /// SwifterSwift: hex #F5F5F5\n        public static let grey100\t\t\t\t= Color(hex: 0xF5F5F5)!\n\n        /// SwifterSwift: hex #EEEEEE\n        public static let grey200\t\t\t\t= Color(hex: 0xEEEEEE)!\n\n        /// SwifterSwift: hex #E0E0E0\n        public static let grey300\t\t\t\t= Color(hex: 0xE0E0E0)!\n\n        /// SwifterSwift: hex #BDBDBD\n        public static let grey400\t\t\t\t= Color(hex: 0xBDBDBD)!\n\n        /// SwifterSwift: hex #9E9E9E\n        public static let grey500\t\t\t\t= Color(hex: 0x9E9E9E)!\n\n        /// SwifterSwift: hex #757575\n        public static let grey600\t\t\t\t= Color(hex: 0x757575)!\n\n        /// SwifterSwift: hex #616161\n        public static let grey700\t\t\t\t= Color(hex: 0x616161)!\n\n        /// SwifterSwift: hex #424242\n        public static let grey800\t\t\t\t= Color(hex: 0x424242)!\n\n        /// SwifterSwift: hex #212121\n        public static let grey900\t\t\t\t= Color(hex: 0x212121)!\n\n        /// SwifterSwift: color blueGrey500\n        public static let blueGrey\t\t\t\t= blueGrey500\n\n        /// SwifterSwift: hex #ECEFF1\n        public static let blueGrey50\t\t\t= Color(hex: 0xECEFF1)!\n\n        /// SwifterSwift: hex #CFD8DC\n        public static let blueGrey100\t\t\t= Color(hex: 0xCFD8DC)!\n\n        /// SwifterSwift: hex #B0BEC5\n        public static let blueGrey200\t\t\t= Color(hex: 0xB0BEC5)!\n\n        /// SwifterSwift: hex #90A4AE\n        public static let blueGrey300\t\t\t= Color(hex: 0x90A4AE)!\n\n        /// SwifterSwift: hex #78909C\n        public static let blueGrey400\t\t\t= Color(hex: 0x78909C)!\n\n        /// SwifterSwift: hex #607D8B\n        public static let blueGrey500\t\t\t= Color(hex: 0x607D8B)!\n\n        /// SwifterSwift: hex #546E7A\n        public static let blueGrey600\t\t\t= Color(hex: 0x546E7A)!\n\n        /// SwifterSwift: hex #455A64\n        public static let blueGrey700\t\t\t= Color(hex: 0x455A64)!\n\n        /// SwifterSwift: hex #37474F\n        public static let blueGrey800\t\t\t= Color(hex: 0x37474F)!\n\n        /// SwifterSwift: hex #263238\n        public static let blueGrey900\t\t\t= Color(hex: 0x263238)!\n\n        /// SwifterSwift: hex #000000\n        public static let black\t\t\t\t\t= Color(hex: 0x000000)!\n\n        /// SwifterSwift: hex #FFFFFF\n        public static let white\t\t\t\t\t= Color(hex: 0xFFFFFF)!\n    }\n\n}\n\n// MARK: - CSS colors\npublic extension Color {\n\n    /// SwifterSwift: CSS colors.\n    struct CSS {\n        // http://www.w3schools.com/colors/colors_names.asp\n\n        private init() {}\n\n        /// SwifterSwift: hex #F0F8FF\n        public static let aliceBlue\t\t\t\t= Color(hex: 0xF0F8FF)!\n\n        /// SwifterSwift: hex #FAEBD7\n        public static let antiqueWhite\t\t\t= Color(hex: 0xFAEBD7)!\n\n        /// SwifterSwift: hex #00FFFF\n        public static let aqua\t\t\t\t\t= Color(hex: 0x00FFFF)!\n\n        /// SwifterSwift: hex #7FFFD4\n        public static let aquamarine\t\t\t= Color(hex: 0x7FFFD4)!\n\n        /// SwifterSwift: hex #F0FFFF\n        public static let azure\t\t\t\t\t= Color(hex: 0xF0FFFF)!\n\n        /// SwifterSwift: hex #F5F5DC\n        public static let beige\t\t\t\t\t= Color(hex: 0xF5F5DC)!\n\n        /// SwifterSwift: hex #FFE4C4\n        public static let bisque\t\t\t\t= Color(hex: 0xFFE4C4)!\n\n        /// SwifterSwift: hex #000000\n        public static let black\t\t\t\t\t= Color(hex: 0x000000)!\n\n        /// SwifterSwift: hex #FFEBCD\n        public static let blanchedAlmond\t\t= Color(hex: 0xFFEBCD)!\n\n        /// SwifterSwift: hex #0000FF\n        public static let blue\t\t\t\t\t= Color(hex: 0x0000FF)!\n\n        /// SwifterSwift: hex #8A2BE2\n        public static let blueViolet\t\t\t= Color(hex: 0x8A2BE2)!\n\n        /// SwifterSwift: hex #A52A2A\n        public static let brown\t\t\t\t\t= Color(hex: 0xA52A2A)!\n\n        /// SwifterSwift: hex #DEB887\n        public static let burlyWood\t\t\t\t= Color(hex: 0xDEB887)!\n\n        /// SwifterSwift: hex #5F9EA0\n        public static let cadetBlue\t\t\t\t= Color(hex: 0x5F9EA0)!\n\n        /// SwifterSwift: hex #7FFF00\n        public static let chartreuse\t\t\t= Color(hex: 0x7FFF00)!\n\n        /// SwifterSwift: hex #D2691E\n        public static let chocolate\t\t\t\t= Color(hex: 0xD2691E)!\n\n        /// SwifterSwift: hex #FF7F50\n        public static let coral\t\t\t\t\t= Color(hex: 0xFF7F50)!\n\n        /// SwifterSwift: hex #6495ED\n        public static let cornflowerBlue\t\t= Color(hex: 0x6495ED)!\n\n        /// SwifterSwift: hex #FFF8DC\n        public static let cornsilk\t\t\t\t= Color(hex: 0xFFF8DC)!\n\n        /// SwifterSwift: hex #DC143C\n        public static let crimson\t\t\t\t= Color(hex: 0xDC143C)!\n\n        /// SwifterSwift: hex #00FFFF\n        public static let cyan\t\t\t\t\t= Color(hex: 0x00FFFF)!\n\n        /// SwifterSwift: hex #00008B\n        public static let darkBlue\t\t\t\t= Color(hex: 0x00008B)!\n\n        /// SwifterSwift: hex #008B8B\n        public static let darkCyan\t\t\t\t= Color(hex: 0x008B8B)!\n\n        /// SwifterSwift: hex #B8860B\n        public static let darkGoldenRod\t\t\t= Color(hex: 0xB8860B)!\n\n        /// SwifterSwift: hex #A9A9A9\n        public static let darkGray\t\t\t\t= Color(hex: 0xA9A9A9)!\n\n        /// SwifterSwift: hex #A9A9A9\n        public static let darkGrey\t\t\t\t= Color(hex: 0xA9A9A9)!\n\n        /// SwifterSwift: hex #006400\n        public static let darkGreen\t\t\t\t= Color(hex: 0x006400)!\n\n        /// SwifterSwift: hex #BDB76B\n        public static let darkKhaki\t\t\t\t= Color(hex: 0xBDB76B)!\n\n        /// SwifterSwift: hex #8B008B\n        public static let darkMagenta\t\t\t= Color(hex: 0x8B008B)!\n\n        /// SwifterSwift: hex #556B2F\n        public static let darkOliveGreen\t\t= Color(hex: 0x556B2F)!\n\n        /// SwifterSwift: hex #FF8C00\n        public static let darkOrange\t\t\t= Color(hex: 0xFF8C00)!\n\n        /// SwifterSwift: hex #9932CC\n        public static let darkOrchid\t\t\t= Color(hex: 0x9932CC)!\n\n        /// SwifterSwift: hex #8B0000\n        public static let darkRed\t\t\t\t= Color(hex: 0x8B0000)!\n\n        /// SwifterSwift: hex #E9967A\n        public static let darkSalmon\t\t\t= Color(hex: 0xE9967A)!\n\n        /// SwifterSwift: hex #8FBC8F\n        public static let darkSeaGreen\t\t\t= Color(hex: 0x8FBC8F)!\n\n        /// SwifterSwift: hex #483D8B\n        public static let darkSlateBlue\t\t\t= Color(hex: 0x483D8B)!\n\n        /// SwifterSwift: hex #2F4F4F\n        public static let darkSlateGray\t\t\t= Color(hex: 0x2F4F4F)!\n\n        /// SwifterSwift: hex #2F4F4F\n        public static let darkSlateGrey\t\t\t= Color(hex: 0x2F4F4F)!\n\n        /// SwifterSwift: hex #00CED1\n        public static let darkTurquoise\t\t\t= Color(hex: 0x00CED1)!\n\n        /// SwifterSwift: hex #9400D3\n        public static let darkViolet\t\t\t= Color(hex: 0x9400D3)!\n\n        /// SwifterSwift: hex #FF1493\n        public static let deepPink\t\t\t\t= Color(hex: 0xFF1493)!\n\n        /// SwifterSwift: hex #00BFFF\n        public static let deepSkyBlue\t\t\t= Color(hex: 0x00BFFF)!\n\n        /// SwifterSwift: hex #696969\n        public static let dimGray\t\t\t\t= Color(hex: 0x696969)!\n\n        /// SwifterSwift: hex #696969\n        public static let dimGrey\t\t\t\t= Color(hex: 0x696969)!\n\n        /// SwifterSwift: hex #1E90FF\n        public static let dodgerBlue\t\t\t= Color(hex: 0x1E90FF)!\n\n        /// SwifterSwift: hex #B22222\n        public static let fireBrick\t\t\t\t= Color(hex: 0xB22222)!\n\n        /// SwifterSwift: hex #FFFAF0\n        public static let floralWhite\t\t\t= Color(hex: 0xFFFAF0)!\n\n        /// SwifterSwift: hex #228B22\n        public static let forestGreen\t\t\t= Color(hex: 0x228B22)!\n\n        /// SwifterSwift: hex #FF00FF\n        public static let fuchsia\t\t\t\t= Color(hex: 0xFF00FF)!\n\n        /// SwifterSwift: hex #DCDCDC\n        public static let gainsboro\t\t\t\t= Color(hex: 0xDCDCDC)!\n\n        /// SwifterSwift: hex #F8F8FF\n        public static let ghostWhite\t\t\t= Color(hex: 0xF8F8FF)!\n\n        /// SwifterSwift: hex #FFD700\n        public static let gold\t\t\t\t\t= Color(hex: 0xFFD700)!\n\n        /// SwifterSwift: hex #DAA520\n        public static let goldenRod\t\t\t\t= Color(hex: 0xDAA520)!\n\n        /// SwifterSwift: hex #808080\n        public static let gray\t\t\t\t\t= Color(hex: 0x808080)!\n\n        /// SwifterSwift: hex #808080\n        public static let grey\t\t\t\t\t= Color(hex: 0x808080)!\n\n        /// SwifterSwift: hex #008000\n        public static let green\t\t\t\t\t= Color(hex: 0x008000)!\n\n        /// SwifterSwift: hex #ADFF2F\n        public static let greenYellow\t\t\t= Color(hex: 0xADFF2F)!\n\n        /// SwifterSwift: hex #F0FFF0\n        public static let honeyDew\t\t\t\t= Color(hex: 0xF0FFF0)!\n\n        /// SwifterSwift: hex #FF69B4\n        public static let hotPink\t\t\t\t= Color(hex: 0xFF69B4)!\n\n        /// SwifterSwift: hex #CD5C5C\n        public static let indianRed\t\t\t\t= Color(hex: 0xCD5C5C)!\n\n        /// SwifterSwift: hex #4B0082\n        public static let indigo\t\t\t\t= Color(hex: 0x4B0082)!\n\n        /// SwifterSwift: hex #FFFFF0\n        public static let ivory\t\t\t\t\t= Color(hex: 0xFFFFF0)!\n\n        /// SwifterSwift: hex #F0E68C\n        public static let khaki\t\t\t\t\t= Color(hex: 0xF0E68C)!\n\n        /// SwifterSwift: hex #E6E6FA\n        public static let lavender\t\t\t\t= Color(hex: 0xE6E6FA)!\n\n        /// SwifterSwift: hex #FFF0F5\n        public static let lavenderBlush\t\t\t= Color(hex: 0xFFF0F5)!\n\n        /// SwifterSwift: hex #7CFC00\n        public static let lawnGreen\t\t\t\t= Color(hex: 0x7CFC00)!\n\n        /// SwifterSwift: hex #FFFACD\n        public static let lemonChiffon\t\t\t= Color(hex: 0xFFFACD)!\n\n        /// SwifterSwift: hex #ADD8E6\n        public static let lightBlue\t\t\t\t= Color(hex: 0xADD8E6)!\n\n        /// SwifterSwift: hex #F08080\n        public static let lightCoral\t\t\t= Color(hex: 0xF08080)!\n\n        /// SwifterSwift: hex #E0FFFF\n        public static let lightCyan\t\t\t\t= Color(hex: 0xE0FFFF)!\n\n        /// SwifterSwift: hex #FAFAD2\n        public static let lightGoldenRodYellow\t= Color(hex: 0xFAFAD2)!\n\n        /// SwifterSwift: hex #D3D3D3\n        public static let lightGray\t\t\t\t= Color(hex: 0xD3D3D3)!\n\n        /// SwifterSwift: hex #D3D3D3\n        public static let lightGrey\t\t\t\t= Color(hex: 0xD3D3D3)!\n\n        /// SwifterSwift: hex #90EE90\n        public static let lightGreen\t\t\t= Color(hex: 0x90EE90)!\n\n        /// SwifterSwift: hex #FFB6C1\n        public static let lightPink\t\t\t\t= Color(hex: 0xFFB6C1)!\n\n        /// SwifterSwift: hex #FFA07A\n        public static let lightSalmon\t\t\t= Color(hex: 0xFFA07A)!\n\n        /// SwifterSwift: hex #20B2AA\n        public static let lightSeaGreen\t\t\t= Color(hex: 0x20B2AA)!\n\n        /// SwifterSwift: hex #87CEFA\n        public static let lightSkyBlue\t\t\t= Color(hex: 0x87CEFA)!\n\n        /// SwifterSwift: hex #778899\n        public static let lightSlateGray\t\t= Color(hex: 0x778899)!\n\n        /// SwifterSwift: hex #778899\n        public static let lightSlateGrey\t\t= Color(hex: 0x778899)!\n\n        /// SwifterSwift: hex #B0C4DE\n        public static let lightSteelBlue\t\t= Color(hex: 0xB0C4DE)!\n\n        /// SwifterSwift: hex #FFFFE0\n        public static let lightYellow\t\t\t= Color(hex: 0xFFFFE0)!\n\n        /// SwifterSwift: hex #00FF00\n        public static let lime\t\t\t\t\t= Color(hex: 0x00FF00)!\n\n        /// SwifterSwift: hex #32CD32\n        public static let limeGreen\t\t\t\t= Color(hex: 0x32CD32)!\n\n        /// SwifterSwift: hex #FAF0E6\n        public static let linen\t\t\t\t\t= Color(hex: 0xFAF0E6)!\n\n        /// SwifterSwift: hex #FF00FF\n        public static let magenta\t\t\t\t= Color(hex: 0xFF00FF)!\n\n        /// SwifterSwift: hex #800000\n        public static let maroon\t\t\t\t= Color(hex: 0x800000)!\n\n        /// SwifterSwift: hex #66CDAA\n        public static let mediumAquaMarine\t\t= Color(hex: 0x66CDAA)!\n\n        /// SwifterSwift: hex #0000CD\n        public static let mediumBlue\t\t\t= Color(hex: 0x0000CD)!\n\n        /// SwifterSwift: hex #BA55D3\n        public static let mediumOrchid\t\t\t= Color(hex: 0xBA55D3)!\n\n        /// SwifterSwift: hex #9370DB\n        public static let mediumPurple\t\t\t= Color(hex: 0x9370DB)!\n\n        /// SwifterSwift: hex #3CB371\n        public static let mediumSeaGreen\t\t= Color(hex: 0x3CB371)!\n\n        /// SwifterSwift: hex #7B68EE\n        public static let mediumSlateBlue\t\t= Color(hex: 0x7B68EE)!\n\n        /// SwifterSwift: hex #00FA9A\n        public static let mediumSpringGreen\t\t= Color(hex: 0x00FA9A)!\n\n        /// SwifterSwift: hex #48D1CC\n        public static let mediumTurquoise\t\t= Color(hex: 0x48D1CC)!\n\n        /// SwifterSwift: hex #C71585\n        public static let mediumVioletRed\t\t= Color(hex: 0xC71585)!\n\n        /// SwifterSwift: hex #191970\n        public static let midnightBlue\t\t\t= Color(hex: 0x191970)!\n\n        /// SwifterSwift: hex #F5FFFA\n        public static let mintCream\t\t\t\t= Color(hex: 0xF5FFFA)!\n\n        /// SwifterSwift: hex #FFE4E1\n        public static let mistyRose\t\t\t\t= Color(hex: 0xFFE4E1)!\n\n        /// SwifterSwift: hex #FFE4B5\n        public static let moccasin\t\t\t\t= Color(hex: 0xFFE4B5)!\n\n        /// SwifterSwift: hex #FFDEAD\n        public static let navajoWhite\t\t\t= Color(hex: 0xFFDEAD)!\n\n        /// SwifterSwift: hex #000080\n        public static let navy\t\t\t\t\t= Color(hex: 0x000080)!\n\n        /// SwifterSwift: hex #FDF5E6\n        public static let oldLace\t\t\t\t= Color(hex: 0xFDF5E6)!\n\n        /// SwifterSwift: hex #808000\n        public static let olive\t\t\t\t\t= Color(hex: 0x808000)!\n\n        /// SwifterSwift: hex #6B8E23\n        public static let oliveDrab\t\t\t\t= Color(hex: 0x6B8E23)!\n\n        /// SwifterSwift: hex #FFA500\n        public static let orange\t\t\t\t= Color(hex: 0xFFA500)!\n\n        /// SwifterSwift: hex #FF4500\n        public static let orangeRed\t\t\t\t= Color(hex: 0xFF4500)!\n\n        /// SwifterSwift: hex #DA70D6\n        public static let orchid\t\t\t\t= Color(hex: 0xDA70D6)!\n\n        /// SwifterSwift: hex #EEE8AA\n        public static let paleGoldenRod\t\t\t= Color(hex: 0xEEE8AA)!\n\n        /// SwifterSwift: hex #98FB98\n        public static let paleGreen\t\t\t\t= Color(hex: 0x98FB98)!\n\n        /// SwifterSwift: hex #AFEEEE\n        public static let paleTurquoise\t\t\t= Color(hex: 0xAFEEEE)!\n\n        /// SwifterSwift: hex #DB7093\n        public static let paleVioletRed\t\t\t= Color(hex: 0xDB7093)!\n\n        /// SwifterSwift: hex #FFEFD5\n        public static let papayaWhip\t\t\t= Color(hex: 0xFFEFD5)!\n\n        /// SwifterSwift: hex #FFDAB9\n        public static let peachPuff\t\t\t\t= Color(hex: 0xFFDAB9)!\n\n        /// SwifterSwift: hex #CD853F\n        public static let peru\t\t\t\t\t= Color(hex: 0xCD853F)!\n\n        /// SwifterSwift: hex #FFC0CB\n        public static let pink\t\t\t\t\t= Color(hex: 0xFFC0CB)!\n\n        /// SwifterSwift: hex #DDA0DD\n        public static let plum\t\t\t\t\t= Color(hex: 0xDDA0DD)!\n\n        /// SwifterSwift: hex #B0E0E6\n        public static let powderBlue\t\t\t= Color(hex: 0xB0E0E6)!\n\n        /// SwifterSwift: hex #800080\n        public static let purple\t\t\t\t= Color(hex: 0x800080)!\n\n        /// SwifterSwift: hex #663399\n        public static let rebeccaPurple\t\t\t= Color(hex: 0x663399)!\n\n        /// SwifterSwift: hex #FF0000\n        public static let red\t\t\t\t\t= Color(hex: 0xFF0000)!\n\n        /// SwifterSwift: hex #BC8F8F\n        public static let rosyBrown\t\t\t\t= Color(hex: 0xBC8F8F)!\n\n        /// SwifterSwift: hex #4169E1\n        public static let royalBlue\t\t\t\t= Color(hex: 0x4169E1)!\n\n        /// SwifterSwift: hex #8B4513\n        public static let saddleBrown\t\t\t= Color(hex: 0x8B4513)!\n\n        /// SwifterSwift: hex #FA8072\n        public static let salmon\t\t\t\t= Color(hex: 0xFA8072)!\n\n        /// SwifterSwift: hex #F4A460\n        public static let sandyBrown\t\t\t= Color(hex: 0xF4A460)!\n\n        /// SwifterSwift: hex #2E8B57\n        public static let seaGreen\t\t\t\t= Color(hex: 0x2E8B57)!\n\n        /// SwifterSwift: hex #FFF5EE\n        public static let seaShell\t\t\t\t= Color(hex: 0xFFF5EE)!\n\n        /// SwifterSwift: hex #A0522D\n        public static let sienna\t\t\t\t= Color(hex: 0xA0522D)!\n\n        /// SwifterSwift: hex #C0C0C0\n        public static let silver\t\t\t\t= Color(hex: 0xC0C0C0)!\n\n        /// SwifterSwift: hex #87CEEB\n        public static let skyBlue\t\t\t\t= Color(hex: 0x87CEEB)!\n\n        /// SwifterSwift: hex #6A5ACD\n        public static let slateBlue\t\t\t\t= Color(hex: 0x6A5ACD)!\n\n        /// SwifterSwift: hex #708090\n        public static let slateGray\t\t\t\t= Color(hex: 0x708090)!\n\n        /// SwifterSwift: hex #708090\n        public static let slateGrey\t\t\t\t= Color(hex: 0x708090)!\n\n        /// SwifterSwift: hex #FFFAFA\n        public static let snow\t\t\t\t\t= Color(hex: 0xFFFAFA)!\n\n        /// SwifterSwift: hex #00FF7F\n        public static let springGreen\t\t\t= Color(hex: 0x00FF7F)!\n\n        /// SwifterSwift: hex #4682B4\n        public static let steelBlue\t\t\t\t= Color(hex: 0x4682B4)!\n\n        /// SwifterSwift: hex #D2B48C\n        public static let tan\t\t\t\t\t= Color(hex: 0xD2B48C)!\n\n        /// SwifterSwift: hex #008080\n        public static let teal\t\t\t\t\t= Color(hex: 0x008080)!\n\n        /// SwifterSwift: hex #D8BFD8\n        public static let thistle\t\t\t\t= Color(hex: 0xD8BFD8)!\n\n        /// SwifterSwift: hex #FF6347\n        public static let tomato\t\t\t\t= Color(hex: 0xFF6347)!\n\n        /// SwifterSwift: hex #40E0D0\n        public static let turquoise\t\t\t\t= Color(hex: 0x40E0D0)!\n\n        /// SwifterSwift: hex #EE82EE\n        public static let violet\t\t\t\t= Color(hex: 0xEE82EE)!\n\n        /// SwifterSwift: hex #F5DEB3\n        public static let wheat\t\t\t\t\t= Color(hex: 0xF5DEB3)!\n\n        /// SwifterSwift: hex #FFFFFF\n        public static let white\t\t\t\t\t= Color(hex: 0xFFFFFF)!\n\n        /// SwifterSwift: hex #F5F5F5\n        public static let whiteSmoke\t\t\t= Color(hex: 0xF5F5F5)!\n\n        /// SwifterSwift: hex #FFFF00\n        public static let yellow\t\t\t\t= Color(hex: 0xFFFF00)!\n\n        /// SwifterSwift: hex #9ACD32\n        public static let yellowGreen\t\t\t= Color(hex: 0x9ACD32)!\n    }\n\n}\n\n// MARK: - Flat UI colors\npublic extension Color {\n\n    /// SwifterSwift: Flat UI colors\n    struct FlatUI {\n        // http://flatuicolors.com.\n\n        /// SwifterSwift: hex #1ABC9C\n        public static let turquoise             = Color(hex: 0x1abc9c)!\n\n        /// SwifterSwift: hex #16A085\n        public static let greenSea              = Color(hex: 0x16a085)!\n\n        /// SwifterSwift: hex #2ECC71\n        public static let emerald               = Color(hex: 0x2ecc71)!\n\n        /// SwifterSwift: hex #27AE60\n        public static let nephritis             = Color(hex: 0x27ae60)!\n\n        /// SwifterSwift: hex #3498DB\n        public static let peterRiver            = Color(hex: 0x3498db)!\n\n        /// SwifterSwift: hex #2980B9\n        public static let belizeHole            = Color(hex: 0x2980b9)!\n\n        /// SwifterSwift: hex #9B59B6\n        public static let amethyst              = Color(hex: 0x9b59b6)!\n\n        /// SwifterSwift: hex #8E44AD\n        public static let wisteria              = Color(hex: 0x8e44ad)!\n\n        /// SwifterSwift: hex #34495E\n        public static let wetAsphalt            = Color(hex: 0x34495e)!\n\n        /// SwifterSwift: hex #2C3E50\n        public static let midnightBlue          = Color(hex: 0x2c3e50)!\n\n        /// SwifterSwift: hex #F1C40F\n        public static let sunFlower             = Color(hex: 0xf1c40f)!\n\n        /// SwifterSwift: hex #F39C12\n        public static let flatOrange            = Color(hex: 0xf39c12)!\n\n        /// SwifterSwift: hex #E67E22\n        public static let carrot                = Color(hex: 0xe67e22)!\n\n        /// SwifterSwift: hex #D35400\n        public static let pumkin                = Color(hex: 0xd35400)!\n\n        /// SwifterSwift: hex #E74C3C\n        public static let alizarin              = Color(hex: 0xe74c3c)!\n\n        /// SwifterSwift: hex #C0392B\n        public static let pomegranate           = Color(hex: 0xc0392b)!\n\n        /// SwifterSwift: hex #ECF0F1\n        public static let clouds                = Color(hex: 0xecf0f1)!\n\n        /// SwifterSwift: hex #BDC3C7\n        public static let silver                = Color(hex: 0xbdc3c7)!\n\n        /// SwifterSwift: hex #7F8C8D\n        public static let asbestos              = Color(hex: 0x7f8c8d)!\n\n        /// SwifterSwift: hex #95A5A6\n        public static let concerte              = Color(hex: 0x95a5a6)!\n    }\n    // swiftlint:enable type_body_length\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/Shared/EdgeInsetsExtensions.swift",
    "content": "//\n//  EdgeInsetsExtensions.swift\n//  SwifterSwift\n//\n//  Created by Guy Kogus on 03/01/2020.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if os(iOS) || os(tvOS) || os(watchOS)\nimport UIKit\n/// SwifterSwift: EdgeInsets\npublic typealias EdgeInsets = UIEdgeInsets\n#elseif os(macOS)\nimport Foundation\n/// SwifterSwift: EdgeInsets\npublic typealias EdgeInsets = NSEdgeInsets\n\npublic extension NSEdgeInsets {\n    /// SwifterSwift: An edge insets struct whose top, left, bottom, and right fields are all set to 0.\n    static let zero = NSEdgeInsets()\n}\n\n// swiftlint:disable missing_swifterswift_prefix\nextension NSEdgeInsets: Equatable {\n    /// Returns a Boolean value indicating whether two values are equal.\n    ///\n    /// Equality is the inverse of inequality. For any values `a` and `b`,\n    /// `a == b` implies that `a != b` is `false`.\n    ///\n    /// - Parameters:\n    ///   - lhs: A value to compare.\n    ///   - rhs: Another value to compare.\n    public static func == (lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool {\n        return lhs.top == rhs.top &&\n            lhs.left == rhs.left &&\n            lhs.bottom == rhs.bottom &&\n            lhs.right == rhs.right\n    }\n}\n// swiftlint:enable missing_swifterswift_prefix\n#endif\n\n#if os(iOS) || os(tvOS) || os(watchOS) || os(macOS)\n\n// MARK: - Properties\npublic extension EdgeInsets {\n    /// SwifterSwift: Return the vertical insets. The vertical insets is composed by top + bottom.\n    ///\n    var vertical: CGFloat {\n        // Source: https://github.com/MessageKit/MessageKit/blob/master/Sources/SwifterSwift/EdgeInsets%2BExtensions.swift\n        return top + bottom\n    }\n\n    /// SwifterSwift: Return the horizontal insets. The horizontal insets is composed by  left + right.\n    ///\n    var horizontal: CGFloat {\n        // Source: https://github.com/MessageKit/MessageKit/blob/master/Sources/SwifterSwift/EdgeInsets%2BExtensions.swift\n        return left + right\n    }\n\n}\n\n// MARK: - Methods\npublic extension EdgeInsets {\n    /// SwifterSwift: Creates an `EdgeInsets` with the inset value applied to all (top, bottom, right, left)\n    ///\n    /// - Parameter inset: Inset to be applied in all the edges.\n    init(inset: CGFloat) {\n        self.init(top: inset, left: inset, bottom: inset, right: inset)\n    }\n\n    /// SwifterSwift: Creates an `EdgeInsets` with the horizontal value equally divided and applied to right and left.\n    ///               And the vertical value equally divided and applied to top and bottom.\n    ///\n    ///\n    /// - Parameter horizontal: Inset to be applied to right and left.\n    /// - Parameter vertical: Inset to be applied to top and bottom.\n    init(horizontal: CGFloat, vertical: CGFloat) {\n        self.init(top: vertical / 2, left: horizontal / 2, bottom: vertical / 2, right: horizontal / 2)\n    }\n\n    /// SwifterSwift: Creates an `EdgeInsets` based on current value and top offset.\n    ///\n    /// - Parameters:\n    ///   - top: Offset to be applied in to the top edge.\n    /// - Returns: EdgeInsets offset with given offset.\n    func insetBy(top: CGFloat) -> EdgeInsets {\n        return EdgeInsets(top: self.top + top, left: left, bottom: bottom, right: right)\n    }\n\n    /// SwifterSwift: Creates an `EdgeInsets` based on current value and left offset.\n    ///\n    /// - Parameters:\n    ///   - left: Offset to be applied in to the left edge.\n    /// - Returns: EdgeInsets offset with given offset.\n    func insetBy(left: CGFloat) -> EdgeInsets {\n        return EdgeInsets(top: top, left: self.left + left, bottom: bottom, right: right)\n    }\n\n    /// SwifterSwift: Creates an `EdgeInsets` based on current value and bottom offset.\n    ///\n    /// - Parameters:\n    ///   - bottom: Offset to be applied in to the bottom edge.\n    /// - Returns: EdgeInsets offset with given offset.\n    func insetBy(bottom: CGFloat) -> EdgeInsets {\n        return EdgeInsets(top: top, left: left, bottom: self.bottom + bottom, right: right)\n    }\n\n    /// SwifterSwift: Creates an `EdgeInsets` based on current value and right offset.\n    ///\n    /// - Parameters:\n    ///   - right: Offset to be applied in to the right edge.\n    /// - Returns: EdgeInsets offset with given offset.\n    func insetBy(right: CGFloat) -> EdgeInsets {\n        return EdgeInsets(top: top, left: left, bottom: bottom, right: self.right + right)\n    }\n\n    /// SwifterSwift: Creates an `EdgeInsets` based on current value and horizontal value equally divided and applied to right offset and left offset.\n    ///\n    /// - Parameters:\n    ///   - horizontal: Offset to be applied to right and left.\n    /// - Returns: EdgeInsets offset with given offset.\n    func insetBy(horizontal: CGFloat) -> EdgeInsets {\n        return EdgeInsets(top: top, left: left + horizontal / 2, bottom: bottom, right: right + horizontal / 2)\n    }\n\n    /// SwifterSwift: Creates an `EdgeInsets` based on current value and vertical value equally divided and applied to top and bottom.\n    ///\n    /// - Parameters:\n    ///   - vertical: Offset to be applied to top and bottom.\n    /// - Returns: EdgeInsets offset with given offset.\n    func insetBy(vertical: CGFloat) -> EdgeInsets {\n        return EdgeInsets(top: top + vertical / 2, left: left, bottom: bottom + vertical / 2, right: right)\n    }\n}\n\n// MARK: - Operators\npublic extension EdgeInsets {\n\n    /// SwifterSwift: Add all the properties of two `EdgeInsets` to create their addition.\n    ///\n    /// - Parameters:\n    ///   - lhs: The left-hand expression\n    ///   - rhs: The right-hand expression\n    /// - Returns: A new `EdgeInsets` instance where the values of `lhs` and `rhs` are added together.\n    static func + (_ lhs: EdgeInsets, _ rhs: EdgeInsets) -> EdgeInsets {\n        return EdgeInsets(top: lhs.top + rhs.top,\n                            left: lhs.left + rhs.left,\n                            bottom: lhs.bottom + rhs.bottom,\n                            right: lhs.right + rhs.right)\n    }\n\n    /// SwifterSwift: Add all the properties of two `EdgeInsets` to the left-hand instance.\n    ///\n    /// - Parameters:\n    ///   - lhs: The left-hand expression to be mutated\n    ///   - rhs: The right-hand expression\n    static func += (_ lhs: inout EdgeInsets, _ rhs: EdgeInsets) {\n        lhs.top += rhs.top\n        lhs.left += rhs.left\n        lhs.bottom += rhs.bottom\n        lhs.right += rhs.right\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SpriteKit/SKNodeExtensions.swift",
    "content": "//\n//  SKNodeExtensions.swift\n//  SwifterSwift\n//\n//  Created by Olivia Brown on 5/28/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(SpriteKit)\nimport SpriteKit\n\n// MARK: - Methods\npublic extension SKNode {\n\n    /// SwifterSwift: Return an array of all SKNode descendants\n    ///\n    ///         mySKNode.descendants() -> [childNodeOne, childNodeTwo]\n    ///\n    func descendants() -> [SKNode] {\n        return children + children.reduce(into: [SKNode]()) { $0 += $1.descendants() }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/StoreKit/SKProductExtensions.swift",
    "content": "//\n//  SKProductExtensions.swift\n//  SwifterSwift\n//\n//  Created by Batuhan Saka on 26.12.2019.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(StoreKit)\nimport StoreKit\n\n@available(watchOS 6.2, *)\npublic extension SKProduct {\n\n    private static let priceFormatter: NumberFormatter = {\n        let priceFormatter = NumberFormatter()\n        priceFormatter.numberStyle = .currency\n        return priceFormatter\n    }()\n\n    /// SwifterSwift: Localized price of SKProduct\n    var localizedPrice: String? {\n        let formatter = SKProduct.priceFormatter\n        formatter.locale = priceLocale\n        return formatter.string(from: price)\n    }\n\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/ArrayExtensions.swift",
    "content": "//\n//  ArrayExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/5/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n// MARK: - Methods\npublic extension Array {\n\n    /// SwifterSwift: Insert an element at the beginning of array.\n    ///\n    ///        [2, 3, 4, 5].prepend(1) -> [1, 2, 3, 4, 5]\n    ///        [\"e\", \"l\", \"l\", \"o\"].prepend(\"h\") -> [\"h\", \"e\", \"l\", \"l\", \"o\"]\n    ///\n    /// - Parameter newElement: element to insert.\n    mutating func prepend(_ newElement: Element) {\n        insert(newElement, at: 0)\n    }\n\n    /// SwifterSwift: Safely swap values at given index positions.\n    ///\n    ///        [1, 2, 3, 4, 5].safeSwap(from: 3, to: 0) -> [4, 2, 3, 1, 5]\n    ///        [\"h\", \"e\", \"l\", \"l\", \"o\"].safeSwap(from: 1, to: 0) -> [\"e\", \"h\", \"l\", \"l\", \"o\"]\n    ///\n    /// - Parameters:\n    ///   - index: index of first element.\n    ///   - otherIndex: index of other element.\n    mutating func safeSwap(from index: Index, to otherIndex: Index) {\n        guard index != otherIndex else { return }\n        guard startIndex..<endIndex ~= index else { return }\n        guard startIndex..<endIndex ~= otherIndex else { return }\n        swapAt(index, otherIndex)\n    }\n\n    /// SwifterSwift: Sort an array like another array based on a key path. If the other array doesn't contain a certain value, it will be sorted last.\n    ///\n    ///        [MyStruct(x: 3), MyStruct(x: 1), MyStruct(x: 2)].sorted(like: [1, 2, 3], keyPath: \\.x)\n    ///            -> [MyStruct(x: 1), MyStruct(x: 2), MyStruct(x: 3)]\n    ///\n    /// - Parameters:\n    ///   - otherArray: array containing elements in the desired order.\n    ///   - keyPath: keyPath indiciating the property that the array should be sorted by\n    /// - Returns: sorted array.\n    func sorted<T: Hashable>(like otherArray: [T], keyPath: KeyPath<Element, T>) -> [Element] {\n        let dict = otherArray.enumerated().reduce(into: [:]) { $0[$1.element] = $1.offset }\n        return sorted {\n            guard let thisIndex = dict[$0[keyPath: keyPath]] else { return false }\n            guard let otherIndex = dict[$1[keyPath: keyPath]] else { return true }\n            return thisIndex < otherIndex\n        }\n    }\n}\n\n// MARK: - Methods (Equatable)\npublic extension Array where Element: Equatable {\n\n    /// SwifterSwift: Remove all instances of an item from array.\n    ///\n    ///        [1, 2, 2, 3, 4, 5].removeAll(2) -> [1, 3, 4, 5]\n    ///        [\"h\", \"e\", \"l\", \"l\", \"o\"].removeAll(\"l\") -> [\"h\", \"e\", \"o\"]\n    ///\n    /// - Parameter item: item to remove.\n    /// - Returns: self after removing all instances of item.\n    @discardableResult\n    mutating func removeAll(_ item: Element) -> [Element] {\n        removeAll(where: { $0 == item })\n        return self\n    }\n\n    /// SwifterSwift: Remove all instances contained in items parameter from array.\n    ///\n    ///        [1, 2, 2, 3, 4, 5].removeAll([2,5]) -> [1, 3, 4]\n    ///        [\"h\", \"e\", \"l\", \"l\", \"o\"].removeAll([\"l\", \"h\"]) -> [\"e\", \"o\"]\n    ///\n    /// - Parameter items: items to remove.\n    /// - Returns: self after removing all instances of all items in given array.\n    @discardableResult\n    mutating func removeAll(_ items: [Element]) -> [Element] {\n        guard !items.isEmpty else { return self }\n        removeAll(where: { items.contains($0) })\n        return self\n    }\n\n    /// SwifterSwift: Remove all duplicate elements from Array.\n    ///\n    ///        [1, 2, 2, 3, 4, 5].removeDuplicates() -> [1, 2, 3, 4, 5]\n    ///        [\"h\", \"e\", \"l\", \"l\", \"o\"]. removeDuplicates() -> [\"h\", \"e\", \"l\", \"o\"]\n    ///\n    /// - Returns: Return array with all duplicate elements removed.\n    @discardableResult\n    mutating func removeDuplicates() -> [Element] {\n        // Thanks to https://github.com/sairamkotha for improving the method\n        self = reduce(into: [Element]()) {\n            if !$0.contains($1) {\n                $0.append($1)\n            }\n        }\n        return self\n    }\n\n    /// SwifterSwift: Return array with all duplicate elements removed.\n    ///\n    ///     [1, 1, 2, 2, 3, 3, 3, 4, 5].withoutDuplicates() -> [1, 2, 3, 4, 5])\n    ///     [\"h\", \"e\", \"l\", \"l\", \"o\"].withoutDuplicates() -> [\"h\", \"e\", \"l\", \"o\"])\n    ///\n    /// - Returns: an array of unique elements.\n    ///\n    func withoutDuplicates() -> [Element] {\n        // Thanks to https://github.com/sairamkotha for improving the method\n        return reduce(into: [Element]()) {\n            if !$0.contains($1) {\n                $0.append($1)\n            }\n        }\n    }\n\n    /// SwifterSwift: Returns an array with all duplicate elements removed using KeyPath to compare.\n    ///\n    /// - Parameter path: Key path to compare, the value must be Equatable.\n    /// - Returns: an array of unique elements.\n    func withoutDuplicates<E: Equatable>(keyPath path: KeyPath<Element, E>) -> [Element] {\n        return reduce(into: [Element]()) { (result, element) in\n            if !result.contains(where: { $0[keyPath: path] == element[keyPath: path] }) {\n                result.append(element)\n            }\n        }\n    }\n\n    /// SwifterSwift: Returns an array with all duplicate elements removed using KeyPath to compare.\n    ///\n    /// - Parameter path: Key path to compare, the value must be Hashable.\n    /// - Returns: an array of unique elements.\n    func withoutDuplicates<E: Hashable>(keyPath path: KeyPath<Element, E>) -> [Element] {\n        var set = Set<E>()\n        return filter { set.insert($0[keyPath: path]).inserted }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/BidirectionalCollectionExtensions.swift",
    "content": "//\n//  BidirectionalCollectionExtensions.swift\n//  SwifterSwift\n//\n//  Created by Quentin Jin on 2018/10/13.\n//  Copyright © 2018 SwifterSwift\n//\n\n// MARK: - Methods\npublic extension BidirectionalCollection {\n\n    /// SwifterSwift: Returns the element at the specified position. If offset is negative, the `n`th element from the end will be returned where `n` is the result of `abs(distance)`.\n    ///\n    ///        let arr = [1, 2, 3, 4, 5]\n    ///        arr[offset: 1] -> 2\n    ///        arr[offset: -2] -> 4\n    ///\n    /// - Parameter distance: The distance to offset.\n    subscript(offset distance: Int) -> Element {\n        let index = distance >= 0 ? startIndex : endIndex\n        return self[indices.index(index, offsetBy: distance)]\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/BinaryFloatingPointExtensions.swift",
    "content": "//\n//  BinaryFloatingPointExtensions.swift\n//  SwifterSwift\n//\n//  Created by Quentin Jin on 2018/10/13.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n\n// MARK: - Methods\npublic extension BinaryFloatingPoint {\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Returns a rounded value with the specified number of decimal places and rounding rule. If `numberOfDecimalPlaces` is negative, `0` will be used.\n    ///\n    ///     let num = 3.1415927\n    ///     num.rounded(numberOfDecimalPlaces: 3, rule: .up) -> 3.142\n    ///     num.rounded(numberOfDecimalPlaces: 3, rule: .down) -> 3.141\n    ///     num.rounded(numberOfDecimalPlaces: 2, rule: .awayFromZero) -> 3.15\n    ///     num.rounded(numberOfDecimalPlaces: 4, rule: .towardZero) -> 3.1415\n    ///     num.rounded(numberOfDecimalPlaces: -1, rule: .toNearestOrEven) -> 3\n    ///\n    /// - Parameters:\n    ///   - numberOfDecimalPlaces: The expected number of decimal places.\n    ///   - rule: The rounding rule to use.\n    /// - Returns: The rounded value.\n    func rounded(numberOfDecimalPlaces: Int, rule: FloatingPointRoundingRule) -> Self {\n        let factor = Self(pow(10.0, Double(max(0, numberOfDecimalPlaces))))\n        return (self * factor).rounded(rule) / factor\n    }\n    #endif\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/BoolExtensions.swift",
    "content": "//\n//  BoolExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 07/12/2016.\n//  Copyright © 2016 SwifterSwift\n//\n\n// MARK: - Properties\npublic extension Bool {\n\n    /// SwifterSwift: Return 1 if true, or 0 if false.\n    ///\n    ///        false.int -> 0\n    ///        true.int -> 1\n    ///\n    var int: Int {\n        return self ? 1 : 0\n    }\n\n    /// SwifterSwift: Return \"true\" if true, or \"false\" if false.\n    ///\n    ///        false.string -> \"false\"\n    ///        true.string -> \"true\"\n    ///\n    var string: String {\n        return self ? \"true\" : \"false\"\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/CharacterExtensions.swift",
    "content": "//\n//  CharacterExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/8/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n// MARK: - Properties\npublic extension Character {\n\n    /// SwifterSwift: Check if character is emoji.\n    ///\n    ///        Character(\"😀\").isEmoji -> true\n    ///\n    var isEmoji: Bool {\n        // http://stackoverflow.com/questions/30757193/find-out-if-character-in-string-is-emoji\n        let scalarValue = String(self).unicodeScalars.first!.value\n        switch scalarValue {\n        case 0x1F600...0x1F64F, // Emoticons\n        0x1F300...0x1F5FF, // Misc Symbols and Pictographs\n        0x1F680...0x1F6FF, // Transport and Map\n        0x1F1E6...0x1F1FF, // Regional country flags\n        0x2600...0x26FF, // Misc symbols\n        0x2700...0x27BF, // Dingbats\n        0xE0020...0xE007F, // Tags\n        0xFE00...0xFE0F, // Variation Selectors\n        0x1F900...0x1F9FF, // Supplemental Symbols and Pictographs\n        127000...127600, // Various asian characters\n        65024...65039, // Variation selector\n        9100...9300, // Misc items\n        8400...8447: // Combining Diacritical Marks for Symbols\n            return true\n        default:\n            return false\n        }\n    }\n\n    /// SwifterSwift: Integer from character (if applicable).\n    ///\n    ///        Character(\"1\").int -> 1\n    ///        Character(\"A\").int -> nil\n    ///\n    var int: Int? {\n        return Int(String(self))\n    }\n\n    /// SwifterSwift: String from character.\n    ///\n    ///        Character(\"a\").string -> \"a\"\n    ///\n    var string: String {\n        return String(self)\n    }\n\n    /// SwifterSwift: Return the character lowercased.\n    ///\n    ///        Character(\"A\").lowercased -> Character(\"a\")\n    ///\n    var lowercased: Character {\n        return String(self).lowercased().first!\n    }\n\n    /// SwifterSwift: Return the character uppercased.\n    ///\n    ///        Character(\"a\").uppercased -> Character(\"A\")\n    ///\n    var uppercased: Character {\n        return String(self).uppercased().first!\n    }\n\n}\n\n// MARK: - Methods\npublic extension Character {\n\n    /// SwifterSwift: Random character.\n    ///\n    ///    Character.random() -> k\n    ///\n    /// - Returns: A random character.\n    static func randomAlphanumeric() -> Character {\n        return \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\".randomElement()!\n    }\n\n}\n\n// MARK: - Operators\npublic extension Character {\n\n    /// SwifterSwift: Repeat character multiple times.\n    ///\n    ///        Character(\"-\") * 10 -> \"----------\"\n    ///\n    /// - Parameters:\n    ///   - lhs: character to repeat.\n    ///   - rhs: number of times to repeat character.\n    /// - Returns: string with character repeated n times.\n    static func * (lhs: Character, rhs: Int) -> String {\n        guard rhs > 0 else { return \"\" }\n        return String(repeating: String(lhs), count: rhs)\n    }\n\n    /// SwifterSwift: Repeat character multiple times.\n    ///\n    ///        10 * Character(\"-\") -> \"----------\"\n    ///\n    /// - Parameters:\n    ///   - lhs: number of times to repeat character.\n    ///   - rhs: character to repeat.\n    /// - Returns: string with character repeated n times.\n    static func * (lhs: Int, rhs: Character) -> String {\n        guard lhs > 0 else { return \"\" }\n        return String(repeating: String(rhs), count: lhs)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift",
    "content": "//\n//  CollectionExtensions.swift\n//  SwifterSwift\n//\n//  Created by Sergey Fedortsov on 19.12.16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(Dispatch)\nimport Dispatch\n#endif\n\n// MARK: - Methods\npublic extension Collection {\n\n    #if canImport(Dispatch)\n    /// SwifterSwift: Performs `each` closure for each element of collection in parallel.\n    ///\n    ///        array.forEachInParallel { item in\n    ///            print(item)\n    ///        }\n    ///\n    /// - Parameter each: closure to run for each element.\n    func forEachInParallel(_ each: (Self.Element) -> Void) {\n        let indicesArray = Array(indices)\n        DispatchQueue.concurrentPerform(iterations: indicesArray.count) { (index) in\n            let elementIndex = indicesArray[index]\n            each(self[elementIndex])\n        }\n    }\n    #endif\n\n    /// SwifterSwift: Safe protects the array from out of bounds by use of optional.\n    ///\n    ///        let arr = [1, 2, 3, 4, 5]\n    ///        arr[safe: 1] -> 2\n    ///        arr[safe: 10] -> nil\n    ///\n    /// - Parameter index: index of element to access element.\n    subscript(safe index: Index) -> Element? {\n        return indices.contains(index) ? self[index] : nil\n    }\n\n    /// SwifterSwift: Returns an array of slices of length \"size\" from the array. If array can't be split evenly, the final slice will be the remaining elements.\n    ///\n    ///     [0, 2, 4, 7].group(by: 2) -> [[0, 2], [4, 7]]\n    ///     [0, 2, 4, 7, 6].group(by: 2) -> [[0, 2], [4, 7], [6]]\n    ///\n    /// - Parameter size: The size of the slices to be returned.\n    /// - Returns: grouped self.\n    func group(by size: Int) -> [[Element]]? {\n        // Inspired by: https://lodash.com/docs/4.17.4#chunk\n        guard size > 0, !isEmpty else { return nil }\n        var start = startIndex\n        var slices = [[Element]]()\n        while start != endIndex {\n            let end = index(start, offsetBy: size, limitedBy: endIndex) ?? endIndex\n            slices.append(Array(self[start..<end]))\n            start = end\n        }\n        return slices\n    }\n\n}\n\n// MARK: - Methods (Int)\npublic extension Collection where Index == Int {\n\n    /// SwifterSwift: Get all indices where condition is met.\n    ///\n    ///     [1, 7, 1, 2, 4, 1, 8].indices(where: { $0 == 1 }) -> [0, 2, 5]\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: all indices where the specified condition evaluates to true. (optional)\n    func indices(where condition: (Element) throws -> Bool) rethrows -> [Index]? {\n        var indicies: [Index] = []\n        for (index, value) in lazy.enumerated() where try condition(value) {\n            indicies.append(index)\n        }\n        return indicies.isEmpty ? nil : indicies\n    }\n\n    /// SwifterSwift: Calls the given closure with an array of size of the parameter slice.\n    ///\n    ///     [0, 2, 4, 7].forEach(slice: 2) { print($0) } -> // print: [0, 2], [4, 7]\n    ///     [0, 2, 4, 7, 6].forEach(slice: 2) { print($0) } -> // print: [0, 2], [4, 7], [6]\n    ///\n    /// - Parameters:\n    ///   - slice: size of array in each interation.\n    ///   - body: a closure that takes an array of slice size as a parameter.\n    func forEach(slice: Int, body: ([Element]) throws -> Void) rethrows {\n        guard slice > 0, !isEmpty else { return }\n\n        var value: Int = 0\n        while value < count {\n            try body(Array(self[Swift.max(value, startIndex)..<Swift.min(value + slice, endIndex)]))\n            value += slice\n        }\n    }\n\n}\n\n// MARK: - Methods (Integer)\npublic extension Collection where Element == IntegerLiteralType, Index == Int {\n\n    /// SwifterSwift: Average of all elements in array.\n    ///\n    /// - Returns: the average of the array's elements.\n    func average() -> Double {\n        // http://stackoverflow.com/questions/28288148/making-my-function-calculate-average-of-array-swift\n        return isEmpty ? 0 : Double(reduce(0, +)) / Double(count)\n    }\n\n}\n\n// MARK: - Methods (FloatingPoint)\npublic extension Collection where Element: FloatingPoint {\n\n    /// SwifterSwift: Average of all elements in array.\n    ///\n    ///        [1.2, 2.3, 4.5, 3.4, 4.5].average() = 3.18\n    ///\n    /// - Returns: average of the array's elements.\n    func average() -> Element {\n        guard !isEmpty else { return 0 }\n        return reduce(0, {$0 + $1}) / Element(count)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/ComparableExtensions.swift",
    "content": "//\n//  ComparableExtensions.swift\n//  SwifterSwift\n//\n//  Created by Shai Mishali on 5/4/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n// MARK: - Methods\npublic extension Comparable {\n\n    /// SwifterSwift: Returns true if value is in the provided range.\n    ///\n    ///    1.isBetween(5...7) // false\n    ///    7.isBetween(6...12) // true\n    ///    date.isBetween(date1...date2)\n    ///    \"c\".isBetween(a...d) // true\n    ///    0.32.isBetween(0.31...0.33) // true\n    ///\n    /// - parameter min: Minimum comparable value.\n    /// - parameter max: Maximum comparable value.\n    ///\n    /// - returns: `true` if value is between `min` and `max`, `false` otherwise.\n    func isBetween(_ range: ClosedRange<Self>) -> Bool {\n        return range ~= self\n    }\n\n    /// SwifterSwift: Returns value limited within the provided range.\n    ///\n    ///     1.clamped(to: 3...8) // 3\n    ///     4.clamped(to: 3...7) // 4\n    ///     \"c\".clamped(to: \"e\"...\"g\") // \"e\"\n    ///     0.32.clamped(to: 0.1...0.29) // 0.29\n    ///\n    /// - parameter min: Lower bound to limit the value to.\n    /// - parameter max: Upper bound to limit the value to.\n    ///\n    /// - returns: A value limited to the range between `min` and `max`.\n    func clamped(to range: ClosedRange<Self>) -> Self {\n        return max(range.lowerBound, min(self, range.upperBound))\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/DecodableExtensions.swift",
    "content": "//\n//  DecodableExtensions.swift\n//  SwifterSwift\n//\n//  Created by Mustafa GUNES on 16.01.2020.\n//  Copyright © 2020 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n#endif\n\npublic extension Decodable {\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Parsing the model in Decodable type\n    /// - Parameters:\n    ///   - data: Data.\n    ///   - decoder: JSONDecoder. Initialized by default\n    init?(from data: Data, using decoder: JSONDecoder = .init()) {\n        guard let parsed = try? decoder.decode(Self.self, from: data) else { return nil }\n        self = parsed\n    }\n    #endif\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/Deprecated/StdlibDeprecated.swift",
    "content": "//\n//  StdlibDeprecated.swift\n//  SwifterSwift\n//\n//  Created by Luciano Almeida on 21/09/19.\n//  Copyright © 2019 SwifterSwift\n//\n\nprivate func optionalCompareAscending<T: Comparable>(path1: T?, path2: T?) -> Bool {\n    guard let path1 = path1, let path2 = path2 else { return false }\n    return path1 < path2\n}\n\nprivate func optionalCompareDescending<T: Comparable>(path1: T?, path2: T?) -> Bool {\n    guard let path1 = path1, let path2 = path2 else { return false }\n    return path1 > path2\n}\n\npublic extension Array {\n\n    /// SwifterSwift: Returns a sorted array based on an optional keypath.\n    ///\n    /// - Parameter path: Key path to sort. The key path type must be Comparable.\n    /// - Parameter ascending: If order must be ascending.\n    /// - Returns: Sorted array based on keyPath.\n    @available(*, deprecated, message: \"Use sorted(by:with:) instead.\")\n    func sorted<T: Comparable>(by path: KeyPath<Element, T?>, ascending: Bool) -> [Element] {\n        if ascending {\n            return sorted(by: path, with: optionalCompareAscending)\n        }\n        return sorted(by: path, with: optionalCompareDescending)\n    }\n\n    /// SwifterSwift: Returns a sorted array based on a keypath.\n    ///\n    /// - Parameter path: Key path to sort. The key path type must be Comparable.\n    /// - Parameter ascending: If order must be ascending.\n    /// - Returns: Sorted array based on keyPath.\n    @available(*, deprecated, message: \"Use sorted(by:with:) instead.\")\n    func sorted<T: Comparable>(by path: KeyPath<Element, T>, ascending: Bool) -> [Element] {\n        if ascending {\n            return sorted(by: path, with: <)\n        }\n        return sorted(by: path, with: >)\n    }\n\n    /// SwifterSwift: Sort the array based on an optional keypath.\n    ///\n    /// - Parameters:\n    ///   - path: Key path to sort, must be Comparable.\n    ///   - ascending: whether order is ascending or not.\n    /// - Returns: self after sorting.\n    @available(*, deprecated, message: \"Use sort(by:with:) instead.\")\n    @discardableResult\n    mutating func sort<T: Comparable>(by path: KeyPath<Element, T?>, ascending: Bool) -> [Element] {\n        if ascending {\n            sort(by: path, with: optionalCompareAscending)\n        } else {\n            sort(by: path, with: optionalCompareDescending)\n        }\n        return self\n    }\n\n    /// SwifterSwift: Sort the array based on a keypath.\n    ///\n    /// - Parameters:\n    ///   - path: Key path to sort, must be Comparable.\n    ///   - ascending: whether order is ascending or not.\n    /// - Returns: self after sorting.\n    @available(*, deprecated, message: \"Use sort(by:with:) instead.\")\n    @discardableResult\n    mutating func sort<T: Comparable>(by path: KeyPath<Element, T>, ascending: Bool) -> [Element] {\n        if ascending {\n            sort(by: path, with: <)\n        } else {\n            sort(by: path, with: >)\n        }\n        return self\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/DictionaryExtensions.swift",
    "content": "//\n//  DictionaryExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/24/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n#endif\n\n// MARK: - Methods\npublic extension Dictionary {\n\n    /// SwifterSwift: Creates a Dictionary from a given sequence grouped by a given key path.\n    ///\n    /// - Parameters:\n    ///   - sequence: Sequence being grouped\n    ///   - keypath: The key path to group by.\n    init<S: Sequence>(grouping sequence: S, by keyPath: KeyPath<S.Element, Key>) where Value == [S.Element] {\n       self.init(grouping: sequence, by: { $0[keyPath: keyPath] })\n    }\n\n    /// SwifterSwift: Check if key exists in dictionary.\n    ///\n    ///        let dict: [String: Any] = [\"testKey\": \"testValue\", \"testArrayKey\": [1, 2, 3, 4, 5]]\n    ///        dict.has(key: \"testKey\") -> true\n    ///        dict.has(key: \"anotherKey\") -> false\n    ///\n    /// - Parameter key: key to search for\n    /// - Returns: true if key exists in dictionary.\n    func has(key: Key) -> Bool {\n        return index(forKey: key) != nil\n    }\n\n    /// SwifterSwift: Remove all keys contained in the keys parameter from the dictionary.\n    ///\n    ///        var dict : [String: String] = [\"key1\" : \"value1\", \"key2\" : \"value2\", \"key3\" : \"value3\"]\n    ///        dict.removeAll(keys: [\"key1\", \"key2\"])\n    ///        dict.keys.contains(\"key3\") -> true\n    ///        dict.keys.contains(\"key1\") -> false\n    ///        dict.keys.contains(\"key2\") -> false\n    ///\n    /// - Parameter keys: keys to be removed\n    mutating func removeAll<S: Sequence>(keys: S) where S.Element == Key {\n        keys.forEach { removeValue(forKey: $0) }\n    }\n\n    /// SwifterSwift: Remove a value for a random key from the dictionary.\n    @discardableResult\n    mutating func removeValueForRandomKey() -> Value? {\n        guard let randomKey = keys.randomElement() else { return nil }\n        return removeValue(forKey: randomKey)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: JSON Data from dictionary.\n    ///\n    /// - Parameter prettify: set true to prettify data (default is false).\n    /// - Returns: optional JSON Data (if applicable).\n    func jsonData(prettify: Bool = false) -> Data? {\n        guard JSONSerialization.isValidJSONObject(self) else {\n            return nil\n        }\n        let options = (prettify == true) ? JSONSerialization.WritingOptions.prettyPrinted : JSONSerialization.WritingOptions()\n        return try? JSONSerialization.data(withJSONObject: self, options: options)\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: JSON String from dictionary.\n    ///\n    ///        dict.jsonString() -> \"{\"testKey\":\"testValue\",\"testArrayKey\":[1,2,3,4,5]}\"\n    ///\n    ///        dict.jsonString(prettify: true)\n    ///        /*\n    ///        returns the following string:\n    ///\n    ///        \"{\n    ///        \"testKey\" : \"testValue\",\n    ///        \"testArrayKey\" : [\n    ///            1,\n    ///            2,\n    ///            3,\n    ///            4,\n    ///            5\n    ///        ]\n    ///        }\"\n    ///\n    ///        */\n    ///\n    /// - Parameter prettify: set true to prettify string (default is false).\n    /// - Returns: optional JSON String (if applicable).\n    func jsonString(prettify: Bool = false) -> String? {\n        guard JSONSerialization.isValidJSONObject(self) else { return nil }\n        let options = (prettify == true) ? JSONSerialization.WritingOptions.prettyPrinted : JSONSerialization.WritingOptions()\n        guard let jsonData = try? JSONSerialization.data(withJSONObject: self, options: options) else { return nil }\n        return String(data: jsonData, encoding: .utf8)\n    }\n    #endif\n\n    /// SwifterSwift: Returns a dictionary containing the results of mapping the given closure over the sequence’s elements.\n    /// - Parameter transform: A mapping closure. `transform` accepts an element of this sequence as its parameter and returns a transformed value of the same or of a different type.\n    /// - Returns: A dictionary containing the transformed elements of this sequence.\n    func mapKeysAndValues<K, V>(_ transform: ((key: Key, value: Value)) throws -> (K, V)) rethrows -> [K: V] {\n        return [K: V](uniqueKeysWithValues: try map(transform))\n    }\n\n    /// SwifterSwift: Returns a dictionary containing the non-`nil` results of calling the given transformation with each element of this sequence.\n    /// - Parameter transform: A closure that accepts an element of this sequence as its argument and returns an optional value.\n    /// - Returns: A dictionary of the non-`nil` results of calling `transform` with each element of the sequence.\n    /// - Complexity: *O(m + n)*, where _m_ is the length of this sequence and _n_ is the length of the result.\n    func compactMapKeysAndValues<K, V>(_ transform: ((key: Key, value: Value)) throws -> (K, V)?) rethrows -> [K: V] {\n        return [K: V](uniqueKeysWithValues: try compactMap(transform))\n    }\n\n}\n\n// MARK: - Methods (Value: Equatable)\npublic extension Dictionary where Value: Equatable {\n\n    /// SwifterSwift: Returns an array of all keys that have the given value in dictionary.\n    ///\n    ///        let dict = [\"key1\": \"value1\", \"key2\": \"value1\", \"key3\": \"value2\"]\n    ///        dict.keys(forValue: \"value1\") -> [\"key1\", \"key2\"]\n    ///        dict.keys(forValue: \"value2\") -> [\"key3\"]\n    ///        dict.keys(forValue: \"value3\") -> []\n    ///\n    /// - Parameter value: Value for which keys are to be fetched.\n    /// - Returns: An array containing keys that have the given value.\n    func keys(forValue value: Value) -> [Key] {\n        return keys.filter { self[$0] == value }\n    }\n\n}\n\n// MARK: - Methods (ExpressibleByStringLiteral)\npublic extension Dictionary where Key: StringProtocol {\n\n    /// SwifterSwift: Lowercase all keys in dictionary.\n    ///\n    ///        var dict = [\"tEstKeY\": \"value\"]\n    ///        dict.lowercaseAllKeys()\n    ///        print(dict) // prints \"[\"testkey\": \"value\"]\"\n    ///\n    mutating func lowercaseAllKeys() {\n        // http://stackoverflow.com/questions/33180028/extend-dictionary-where-key-is-of-type-string\n        for key in keys {\n            if let lowercaseKey = String(describing: key).lowercased() as? Key {\n                self[lowercaseKey] = removeValue(forKey: key)\n            }\n        }\n    }\n}\n\n// MARK: - Subscripts\npublic extension Dictionary {\n\n    /// SwifterSwift: Deep fetch or set a value from nested dictionaries.\n    ///\n    ///        var dict =  [\"key\": [\"key1\": [\"key2\": \"value\"]]]\n    ///        dict[path: [\"key\", \"key1\", \"key2\"]] = \"newValue\"\n    ///        dict[path: [\"key\", \"key1\", \"key2\"]] -> \"newValue\"\n    ///\n    /// - Note: Value fetching is iterative, while setting is recursive.\n    ///\n    /// - Complexity: O(N), _N_ being the length of the path passed in.\n    ///\n    /// - Parameter path: An array of keys to the desired value.\n    ///\n    /// - Returns: The value for the key-path passed in. `nil` if no value is found.\n    subscript(path path: [Key]) -> Any? {\n        get {\n            guard !path.isEmpty else { return nil }\n            var result: Any? = self\n            for key in path {\n                if let element = (result as? [Key: Any])?[key] {\n                    result = element\n                } else {\n                    return nil\n                }\n            }\n            return result\n        }\n        set {\n            if let first = path.first {\n                if path.count == 1, let new = newValue as? Value {\n                    return self[first] = new\n                }\n                if var nested = self[first] as? [Key: Any] {\n                    nested[path: Array(path.dropFirst())] = newValue\n                    return self[first] = nested as? Value\n                }\n            }\n        }\n    }\n}\n\n// MARK: - Operators\npublic extension Dictionary {\n\n    /// SwifterSwift: Merge the keys/values of two dictionaries.\n    ///\n    ///        let dict: [String: String] = [\"key1\": \"value1\"]\n    ///        let dict2: [String: String] = [\"key2\": \"value2\"]\n    ///        let result = dict + dict2\n    ///        result[\"key1\"] -> \"value1\"\n    ///        result[\"key2\"] -> \"value2\"\n    ///\n    /// - Parameters:\n    ///   - lhs: dictionary\n    ///   - rhs: dictionary\n    /// - Returns: An dictionary with keys and values from both.\n    static func + (lhs: [Key: Value], rhs: [Key: Value]) -> [Key: Value] {\n        var result = lhs\n        rhs.forEach { result[$0] = $1 }\n        return result\n    }\n\n    // MARK: - Operators\n\n    /// SwifterSwift: Append the keys and values from the second dictionary into the first one.\n    ///\n    ///        var dict: [String: String] = [\"key1\": \"value1\"]\n    ///        let dict2: [String: String] = [\"key2\": \"value2\"]\n    ///        dict += dict2\n    ///        dict[\"key1\"] -> \"value1\"\n    ///        dict[\"key2\"] -> \"value2\"\n    ///\n    /// - Parameters:\n    ///   - lhs: dictionary\n    ///   - rhs: dictionary\n    static func += (lhs: inout [Key: Value], rhs: [Key: Value]) {\n        rhs.forEach { lhs[$0] = $1}\n    }\n\n    /// SwifterSwift: Remove keys contained in the sequence from the dictionary\n    ///\n    ///        let dict: [String: String] = [\"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"value3\"]\n    ///        let result = dict-[\"key1\", \"key2\"]\n    ///        result.keys.contains(\"key3\") -> true\n    ///        result.keys.contains(\"key1\") -> false\n    ///        result.keys.contains(\"key2\") -> false\n    ///\n    /// - Parameters:\n    ///   - lhs: dictionary\n    ///   - rhs: array with the keys to be removed.\n    /// - Returns: a new dictionary with keys removed.\n    static func - <S: Sequence>(lhs: [Key: Value], keys: S) -> [Key: Value] where S.Element == Key {\n        var result = lhs\n        result.removeAll(keys: keys)\n        return result\n    }\n\n    /// SwifterSwift: Remove keys contained in the sequence from the dictionary\n    ///\n    ///        var dict: [String: String] = [\"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"value3\"]\n    ///        dict-=[\"key1\", \"key2\"]\n    ///        dict.keys.contains(\"key3\") -> true\n    ///        dict.keys.contains(\"key1\") -> false\n    ///        dict.keys.contains(\"key2\") -> false\n    ///\n    /// - Parameters:\n    ///   - lhs: dictionary\n    ///   - rhs: array with the keys to be removed.\n    static func -= <S: Sequence>(lhs: inout [Key: Value], keys: S) where S.Element == Key {\n        lhs.removeAll(keys: keys)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/DoubleExtensions.swift",
    "content": "//\n//  DoubleExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/6/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n#endif\n\n#if os(macOS) || os(iOS)\nimport Darwin\n#elseif os(Linux)\nimport Glibc\n#endif\n\n// MARK: - Properties\npublic extension Double {\n\n    /// SwifterSwift: Int.\n    var int: Int {\n        return Int(self)\n    }\n\n    /// SwifterSwift: Float.\n    var float: Float {\n        return Float(self)\n    }\n\n    #if canImport(CoreGraphics)\n    /// SwifterSwift: CGFloat.\n    var cgFloat: CGFloat {\n        return CGFloat(self)\n    }\n    #endif\n\n}\n\n// MARK: - Operators\n\nprecedencegroup PowerPrecedence { higherThan: MultiplicationPrecedence }\ninfix operator ** : PowerPrecedence\n/// SwifterSwift: Value of exponentiation.\n///\n/// - Parameters:\n///   - lhs: base double.\n///   - rhs: exponent double.\n/// - Returns: exponentiation result (example: 4.4 ** 0.5 = 2.0976176963).\nfunc ** (lhs: Double, rhs: Double) -> Double {\n    // http://nshipster.com/swift-operators/\n    return pow(lhs, rhs)\n}\n\n// swiftlint:disable identifier_name\nprefix operator √\n/// SwifterSwift: Square root of double.\n///\n/// - Parameter double: double value to find square root for.\n/// - Returns: square root of given double.\npublic prefix func √ (double: Double) -> Double {\n    // http://nshipster.com/swift-operators/\n    return sqrt(double)\n}\n// swiftlint:enable identifier_name\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/FloatExtensions.swift",
    "content": "//\n//  FloatExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/8/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n#endif\n\n#if os(macOS) || os(iOS)\nimport Darwin\n#elseif os(Linux)\nimport Glibc\n#endif\n\n// MARK: - Properties\npublic extension Float {\n\n    /// SwifterSwift: Int.\n    var int: Int {\n        return Int(self)\n    }\n\n    /// SwifterSwift: Double.\n    var double: Double {\n        return Double(self)\n    }\n\n    #if canImport(CoreGraphics)\n    /// SwifterSwift: CGFloat.\n    var cgFloat: CGFloat {\n        return CGFloat(self)\n    }\n    #endif\n\n}\n\n// MARK: - Operators\n\nprecedencegroup PowerPrecedence { higherThan: MultiplicationPrecedence }\ninfix operator ** : PowerPrecedence\n/// SwifterSwift: Value of exponentiation.\n///\n/// - Parameters:\n///   - lhs: base float.\n///   - rhs: exponent float.\n/// - Returns: exponentiation result (4.4 ** 0.5 = 2.0976176963).\nfunc ** (lhs: Float, rhs: Float) -> Float {\n    // http://nshipster.com/swift-operators/\n    return pow(lhs, rhs)\n}\n\n// swiftlint:disable identifier_name\nprefix operator √\n/// SwifterSwift: Square root of float.\n///\n/// - Parameter float: float value to find square root for\n/// - Returns: square root of given float.\npublic prefix func √ (float: Float) -> Float {\n    // http://nshipster.com/swift-operators/\n    return sqrt(float)\n}\n// swiftlint:enable identifier_name\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/FloatingPointExtensions.swift",
    "content": "//\n//  FloatingPointExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 7/23/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n#endif\n\n// MARK: - Properties\npublic extension FloatingPoint {\n\n    /// SwifterSwift: Absolute value of number.\n    var abs: Self {\n        return Swift.abs(self)\n    }\n\n    /// SwifterSwift: Check if number is positive.\n    var isPositive: Bool {\n        return self > 0\n    }\n\n    /// SwifterSwift: Check if number is negative.\n    var isNegative: Bool {\n        return self < 0\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Ceil of number.\n    var ceil: Self {\n        return Foundation.ceil(self)\n    }\n    #endif\n\n    /// SwifterSwift: Radian value of degree input.\n    var degreesToRadians: Self {\n        return Self.pi * self / Self(180)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Floor of number.\n    var floor: Self {\n        return Foundation.floor(self)\n    }\n    #endif\n\n    /// SwifterSwift: Degree value of radian input.\n    var radiansToDegrees: Self {\n        return self * Self(180) / Self.pi\n    }\n\n}\n\n// MARK: - Operators\n\n// swiftlint:disable identifier_name\ninfix operator ±\n/// SwifterSwift: Tuple of plus-minus operation.\n///\n/// - Parameters:\n///   - lhs: number\n///   - rhs: number\n/// - Returns: tuple of plus-minus operation ( 2.5 ± 1.5 -> (4, 1)).\nfunc ± <T: FloatingPoint> (lhs: T, rhs: T) -> (T, T) {\n    // http://nshipster.com/swift-operators/\n    return (lhs + rhs, lhs - rhs)\n}\n// swiftlint:enable identifier_name\n\n// swiftlint:disable identifier_name\nprefix operator ±\n/// SwifterSwift: Tuple of plus-minus operation.\n///\n/// - Parameter int: number\n/// - Returns: tuple of plus-minus operation (± 2.5 -> (2.5, -2.5)).\npublic prefix func ± <T: FloatingPoint> (number: T) -> (T, T) {\n    // http://nshipster.com/swift-operators/\n    return 0 ± number\n}\n// swiftlint:enable identifier_name\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/IntExtensions.swift",
    "content": "//\n//  IntExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/6/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n#endif\n\n#if os(macOS) || os(iOS)\nimport Darwin\n#elseif os(Linux)\nimport Glibc\n#endif\n\n// MARK: - Properties\npublic extension Int {\n\n    /// SwifterSwift: CountableRange 0..<Int.\n    var countableRange: CountableRange<Int> {\n        return 0..<self\n    }\n\n    /// SwifterSwift: Radian value of degree input.\n    var degreesToRadians: Double {\n        return Double.pi * Double(self) / 180.0\n    }\n\n    /// SwifterSwift: Degree value of radian input\n    var radiansToDegrees: Double {\n        return Double(self) * 180 / Double.pi\n    }\n\n    /// SwifterSwift: UInt.\n    var uInt: UInt {\n        return UInt(self)\n    }\n\n    /// SwifterSwift: Double.\n    var double: Double {\n        return Double(self)\n    }\n\n    /// SwifterSwift: Float.\n    var float: Float {\n        return Float(self)\n    }\n\n    #if canImport(CoreGraphics)\n    /// SwifterSwift: CGFloat.\n    var cgFloat: CGFloat {\n        return CGFloat(self)\n    }\n    #endif\n\n    /// SwifterSwift: String formatted for values over ±1000 (example: 1k, -2k, 100k, 1kk, -5kk..)\n    var kFormatted: String {\n        var sign: String {\n            return self >= 0 ? \"\" : \"-\"\n        }\n        let abs = Swift.abs(self)\n        if abs == 0 {\n            return \"0k\"\n        } else if abs >= 0 && abs < 1000 {\n            return \"0k\"\n        } else if abs >= 1000 && abs < 1000000 {\n            return String(format: \"\\(sign)%ik\", abs / 1000)\n        }\n        return String(format: \"\\(sign)%ikk\", abs / 100000)\n    }\n\n    /// SwifterSwift: Array of digits of integer value.\n    var digits: [Int] {\n        guard self != 0 else { return [0] }\n        var digits = [Int]()\n        var number = abs\n\n        while number != 0 {\n            let xNumber = number % 10\n            digits.append(xNumber)\n            number /= 10\n        }\n\n        digits.reverse()\n        return digits\n    }\n\n    /// SwifterSwift: Number of digits of integer value.\n    var digitsCount: Int {\n        guard self != 0 else { return 1 }\n        let number = Double(abs)\n        return Int(log10(number) + 1)\n    }\n\n}\n\n// MARK: - Methods\npublic extension Int {\n\n    /// SwifterSwift: check if given integer prime or not. Warning: Using big numbers can be computationally expensive!\n    /// - Returns: true or false depending on prime-ness\n    func isPrime() -> Bool {\n        // To improve speed on latter loop :)\n        if self == 2 { return true }\n\n        guard self > 1 && self % 2 != 0 else { return false }\n\n        // Explanation: It is enough to check numbers until\n        // the square root of that number. If you go up from N by one,\n        // other multiplier will go 1 down to get similar result\n        // (integer-wise operation) such way increases speed of operation\n        let base = Int(sqrt(Double(self)))\n        for int in Swift.stride(from: 3, through: base, by: 2) where self % int == 0 {\n            return false\n        }\n        return true\n    }\n\n    /// SwifterSwift: Roman numeral string from integer (if applicable).\n    ///\n    ///     10.romanNumeral() -> \"X\"\n    ///\n    /// - Returns: The roman numeral string.\n    func romanNumeral() -> String? {\n        // https://gist.github.com/kumo/a8e1cb1f4b7cff1548c7\n        guard self > 0 else { // there is no roman numeral for 0 or negative numbers\n            return nil\n        }\n        let romanValues = [\"M\", \"CM\", \"D\", \"CD\", \"C\", \"XC\", \"L\", \"XL\", \"X\", \"IX\", \"V\", \"IV\", \"I\"]\n        let arabicValues = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]\n\n        var romanValue = \"\"\n        var startingValue = self\n\n        for (index, romanChar) in romanValues.enumerated() {\n            let arabicValue = arabicValues[index]\n            let div = startingValue / arabicValue\n            if div > 0 {\n                for _ in 0..<div {\n                    romanValue += romanChar\n                }\n                startingValue -= arabicValue * div\n            }\n        }\n        return romanValue\n    }\n\n    /// SwifterSwift: Rounds to the closest multiple of n\n    func roundToNearest(_ number: Int) -> Int {\n        return number == 0 ? self : Int(round(Double(self) / Double(number))) * number\n    }\n\n}\n\n// MARK: - Operators\n\nprecedencegroup PowerPrecedence { higherThan: MultiplicationPrecedence }\ninfix operator ** : PowerPrecedence\n/// SwifterSwift: Value of exponentiation.\n///\n/// - Parameters:\n///   - lhs: base integer.\n///   - rhs: exponent integer.\n/// - Returns: exponentiation result (example: 2 ** 3 = 8).\nfunc ** (lhs: Int, rhs: Int) -> Double {\n    // http://nshipster.com/swift-operators/\n    return pow(Double(lhs), Double(rhs))\n}\n\n// swiftlint:disable identifier_name\nprefix operator √\n/// SwifterSwift: Square root of integer.\n///\n/// - Parameter int: integer value to find square root for\n/// - Returns: square root of given integer.\npublic prefix func √ (int: Int) -> Double {\n    // http://nshipster.com/swift-operators/\n    return sqrt(Double(int))\n}\n// swiftlint:enable identifier_name\n\n// swiftlint:disable identifier_name\ninfix operator ±\n/// SwifterSwift: Tuple of plus-minus operation.\n///\n/// - Parameters:\n///   - lhs: integer number.\n///   - rhs: integer number.\n/// - Returns: tuple of plus-minus operation (example: 2 ± 3 -> (5, -1)).\nfunc ± (lhs: Int, rhs: Int) -> (Int, Int) {\n    // http://nshipster.com/swift-operators/\n    return (lhs + rhs, lhs - rhs)\n}\n// swiftlint:enable identifier_name\n\n// swiftlint:disable identifier_name\nprefix operator ±\n/// SwifterSwift: Tuple of plus-minus operation.\n///\n/// - Parameter int: integer number\n/// - Returns: tuple of plus-minus operation (example: ± 2 -> (2, -2)).\npublic prefix func ± (int: Int) -> (Int, Int) {\n    // http://nshipster.com/swift-operators/\n    return 0 ± int\n}\n// swiftlint:enable identifier_name\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/KeyedDecodingContainerExtensions.swift",
    "content": "//\n//  KeyedDecodingContainer.swift\n//  SwifterSwift\n//\n//  Created by Francesco Deliro on 23/10/2019.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n#endif\n\npublic extension KeyedDecodingContainer {\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Try to decode a Bool as Int then String before decoding as Bool.\n    ///\n    /// - Parameter key: Key.\n    /// - Returns: Decoded Bool value.\n    /// - Throws: Decoding error.\n    func decodeBoolAsIntOrString(forKey key: Key) throws -> Bool {\n        if let intValue = try? decode(Int.self, forKey: key) {\n            return (intValue as NSNumber).boolValue\n        } else if let stringValue = try? decode(String.self, forKey: key) {\n            return (stringValue as NSString).boolValue\n        } else {\n            return try decode(Bool.self, forKey: key)\n        }\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Try to decode a Bool as Int then String before decoding as Bool if present.\n    ///\n    /// - Parameter key: Key.\n    /// - Returns: Decoded Bool value.\n    /// - Throws: Decoding error.\n    func decodeBoolAsIntOrStringIfPresent(forKey key: Key) throws -> Bool? {\n        if let intValue = try? decodeIfPresent(Int.self, forKey: key) {\n            return (intValue as NSNumber).boolValue\n        } else if let stringValue = try? decodeIfPresent(String.self, forKey: key) {\n            return (stringValue as NSString).boolValue\n        } else {\n            return try decodeIfPresent(Bool.self, forKey: key)\n        }\n    }\n    #endif\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/MutableCollectionExtensions.swift",
    "content": "//\n//  MutableCollectionExtensions.swift\n//  SwifterSwift\n//\n//  Created by Luciano Almeida on 21/09/19.\n//  Copyright © 2019 SwifterSwift\n//\n\npublic extension MutableCollection where Self: RandomAccessCollection {\n    /// SwifterSwift: Sort the collection based on a keypath and a compare function.\n    ///\n    /// - Parameter keyPath: Key path to sort by. The key path type must be Comparable.\n    /// - Parameter compare: Comparation function that will determine the ordering.\n    mutating func sort<T>(by keyPath: KeyPath<Element, T>, with compare: (T, T) -> Bool) {\n        sort { compare($0[keyPath: keyPath], $1[keyPath: keyPath]) }\n    }\n\n    /// SwifterSwift: Sort the collection based on a keypath.\n    ///\n    /// - Parameter keyPath: Key path to sort by. The key path type must be Comparable.\n    mutating func sort<T: Comparable>(by keyPath: KeyPath<Element, T>) {\n        sort { $0[keyPath: keyPath] < $1[keyPath: keyPath] }\n    }\n\n    /// SwifterSwift: Sort the collection based on two key paths. The second one will be used in case the values of the first one match.\n    ///\n    /// - Parameters:\n    ///     - keyPath1: Key path to sort by. Must be Comparable.\n    ///     - keyPath2: Key path to sort by in case the values of `keyPath1` match. Must be Comparable.\n    mutating func sort<T: Comparable, U: Comparable>(by keyPath1: KeyPath<Element, T>,\n                                                     and keyPath2: KeyPath<Element, U>) {\n        sort {\n            if $0[keyPath: keyPath1] != $1[keyPath: keyPath1] {\n                return $0[keyPath: keyPath1] < $1[keyPath: keyPath1]\n            }\n            return $0[keyPath: keyPath2] < $1[keyPath: keyPath2]\n        }\n    }\n\n    /// SwifterSwift: Sort the collection based on three key paths. Whenever the values of one key path match, the next one will be used.\n    ///\n    /// - Parameters:\n    ///     - keyPath1: Key path to sort by. Must be Comparable.\n    ///     - keyPath2: Key path to sort by in case the values of `keyPath1` match. Must be Comparable.\n    ///     - keyPath3: Key path to sort by in case the values of `keyPath1` and `keyPath2` match. Must be Comparable.\n    mutating func sort<T: Comparable, U: Comparable, V: Comparable>(by keyPath1: KeyPath<Element, T>,\n                                                                    and keyPath2: KeyPath<Element, U>,\n                                                                    and keyPath3: KeyPath<Element, V>) {\n        sort {\n            if $0[keyPath: keyPath1] != $1[keyPath: keyPath1] {\n                return $0[keyPath: keyPath1] < $1[keyPath: keyPath1]\n            }\n            if $0[keyPath: keyPath2] != $1[keyPath: keyPath2] {\n                return $0[keyPath: keyPath2] < $1[keyPath: keyPath2]\n            }\n            return $0[keyPath: keyPath3] < $1[keyPath: keyPath3]\n        }\n    }\n}\n\npublic extension MutableCollection {\n    /// SwifterSwift: Assign a given value to a field `keyPath` of all elements in the collection.\n    ///\n    /// - Parameter value: The new value of the field\n    /// - Parameter keyPath: The actual field of the element\n    mutating func assignToAll<Value>(value: Value, by keyPath: WritableKeyPath<Element, Value>) {\n        guard !isEmpty else { return }\n\n        var idx = startIndex\n        while idx != endIndex {\n            self[idx][keyPath: keyPath] = value\n            idx = index(after: idx)\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/OptionalExtensions.swift",
    "content": "//\n//  OptionalExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 3/3/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n// MARK: - Methods\npublic extension Optional {\n\n    /// SwifterSwift: Get self of default value (if self is nil).\n    ///\n    ///\t\tlet foo: String? = nil\n    ///\t\tprint(foo.unwrapped(or: \"bar\")) -> \"bar\"\n    ///\n    ///\t\tlet bar: String? = \"bar\"\n    ///\t\tprint(bar.unwrapped(or: \"foo\")) -> \"bar\"\n    ///\n    /// - Parameter defaultValue: default value to return if self is nil.\n    /// - Returns: self if not nil or default value if nil.\n    func unwrapped(or defaultValue: Wrapped) -> Wrapped {\n        // http://www.russbishop.net/improving-optionals\n        return self ?? defaultValue\n    }\n\n    /// SwifterSwift: Gets the wrapped value of an optional. If the optional is `nil`, throw a custom error.\n    ///\n    ///        let foo: String? = nil\n    ///        try print(foo.unwrapped(or: MyError.notFound)) -> error: MyError.notFound\n    ///\n    ///        let bar: String? = \"bar\"\n    ///        try print(bar.unwrapped(or: MyError.notFound)) -> \"bar\"\n    ///\n    /// - Parameter error: The error to throw if the optional is `nil`.\n    /// - Returns: The value wrapped by the optional.\n    /// - Throws: The error passed in.\n    func unwrapped(or error: Error) throws -> Wrapped {\n        guard let wrapped = self else { throw error }\n        return wrapped\n    }\n\n    /// SwifterSwift: Runs a block to Wrapped if not nil\n    ///\n    ///\t\tlet foo: String? = nil\n    ///\t\tfoo.run { unwrappedFoo in\n    ///\t\t\t// block will never run sice foo is nill\n    ///\t\t\tprint(unwrappedFoo)\n    ///\t\t}\n    ///\n    ///\t\tlet bar: String? = \"bar\"\n    ///\t\tbar.run { unwrappedBar in\n    ///\t\t\t// block will run sice bar is not nill\n    ///\t\t\tprint(unwrappedBar) -> \"bar\"\n    ///\t\t}\n    ///\n    /// - Parameter block: a block to run if self is not nil.\n    func run(_ block: (Wrapped) -> Void) {\n        // http://www.russbishop.net/improving-optionals\n        _ = map(block)\n    }\n\n    /// SwifterSwift: Assign an optional value to a variable only if the value is not nil.\n    ///\n    ///     let someParameter: String? = nil\n    ///     let parameters = [String: Any]() // Some parameters to be attached to a GET request\n    ///     parameters[someKey] ??= someParameter // It won't be added to the parameters dict\n    ///\n    /// - Parameters:\n    ///   - lhs: Any?\n    ///   - rhs: Any?\n    static func ??= (lhs: inout Optional, rhs: Optional) {\n        guard let rhs = rhs else { return }\n        lhs = rhs\n    }\n\n    /// SwifterSwift: Assign an optional value to a variable only if the variable is nil.\n    ///\n    ///     var someText: String? = nil\n    ///     let newText = \"Foo\"\n    ///     let defaultText = \"Bar\"\n    ///     someText ?= newText // someText is now \"Foo\" because it was nil before\n    ///     someText ?= defaultText // someText doesn't change its value because it's not nil\n    ///\n    /// - Parameters:\n    ///   - lhs: Any?\n    ///   - rhs: Any?\n    static func ?= (lhs: inout Optional, rhs: @autoclosure () -> Optional) {\n        if lhs == nil {\n            lhs = rhs()\n        }\n    }\n\n}\n\n// MARK: - Methods (Collection)\npublic extension Optional where Wrapped: Collection {\n\n    /// SwifterSwift: Check if optional is nil or empty collection.\n    var isNilOrEmpty: Bool {\n        guard let collection = self else { return true }\n        return collection.isEmpty\n    }\n\n    /// SwifterSwift: Returns the collection only if it is not nill and not empty.\n    var nonEmpty: Wrapped? {\n        guard let collection = self else { return nil }\n        guard !collection.isEmpty else { return nil }\n        return collection\n    }\n\n}\n\n// MARK: - Methods (RawRepresentable, RawValue: Equatable)\npublic extension Optional where Wrapped: RawRepresentable, Wrapped.RawValue: Equatable {\n\n    // swiftlint:disable missing_swifterswift_prefix\n\n    /// Returns a Boolean value indicating whether two values are equal.\n    ///\n    /// Equality is the inverse of inequality. For any values `a` and `b`,\n    /// `a == b` implies that `a != b` is `false`.\n    ///\n    /// - Parameters:\n    ///   - lhs: A value to compare.\n    ///   - rhs: Another value to compare.\n    @inlinable static func == (lhs: Optional, rhs: Wrapped.RawValue?) -> Bool {\n        return lhs?.rawValue == rhs\n    }\n\n    /// Returns a Boolean value indicating whether two values are equal.\n    ///\n    /// Equality is the inverse of inequality. For any values `a` and `b`,\n    /// `a == b` implies that `a != b` is `false`.\n    ///\n    /// - Parameters:\n    ///   - lhs: A value to compare.\n    ///   - rhs: Another value to compare.\n    @inlinable static func == (lhs: Wrapped.RawValue?, rhs: Optional) -> Bool {\n        return lhs == rhs?.rawValue\n    }\n\n    /// Returns a Boolean value indicating whether two values are not equal.\n    ///\n    /// Inequality is the inverse of equality. For any values `a` and `b`,\n    /// `a != b` implies that `a == b` is `false`.\n    ///\n    /// - Parameters:\n    ///   - lhs: A value to compare.\n    ///   - rhs: Another value to compare.\n    @inlinable static func != (lhs: Optional, rhs: Wrapped.RawValue?) -> Bool {\n        return lhs?.rawValue != rhs\n    }\n\n    /// Returns a Boolean value indicating whether two values are not equal.\n    ///\n    /// Inequality is the inverse of equality. For any values `a` and `b`,\n    /// `a != b` implies that `a == b` is `false`.\n    ///\n    /// - Parameters:\n    ///   - lhs: A value to compare.\n    ///   - rhs: Another value to compare.\n    @inlinable static func != (lhs: Wrapped.RawValue?, rhs: Optional) -> Bool {\n        return lhs != rhs?.rawValue\n    }\n\n    // swiftlint:enable missing_swifterswift_prefix\n\n}\n\n// MARK: - Operators\ninfix operator ??= : AssignmentPrecedence\ninfix operator ?= : AssignmentPrecedence\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/RandomAccessCollectionExtensions.swift",
    "content": "//\n//  RandomAccessCollectionExtensions.swift\n//  SwifterSwift\n//\n//  Created by Luciano Almeida on 7/13/18.\n//  Copyright © 2018 SwifterSwift\n//\n\npublic extension RandomAccessCollection where Element: Equatable {\n\n    /// SwifterSwift: All indices of specified item.\n    ///\n    ///        [1, 2, 2, 3, 4, 2, 5].indices(of 2) -> [1, 2, 5]\n    ///        [1.2, 2.3, 4.5, 3.4, 4.5].indices(of 2.3) -> [1]\n    ///        [\"h\", \"e\", \"l\", \"l\", \"o\"].indices(of \"l\") -> [2, 3]\n    ///\n    /// - Parameter item: item to check.\n    /// - Returns: an array with all indices of the given item.\n    func indices(of item: Element) -> [Index] {\n        var indices: [Index] = []\n        var idx = startIndex\n        while idx < endIndex {\n            if self[idx] == item {\n                indices.append(idx)\n            }\n            formIndex(after: &idx)\n        }\n        return indices\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/RangeReplaceableCollectionExtensions.swift",
    "content": "//\n//  RangeReplaceableCollectionExtensions.swift\n//  SwifterSwift\n//\n//  Created by Luciano Almeida on 7/2/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n// MARK: - Initializers\npublic extension RangeReplaceableCollection {\n\n    /// SwifterSwift: Creates a new collection of a given size where for each position of the collection the value will be the result of a call of the given expression.\n    ///\n    ///     let values = Array(expression: \"Value\", count: 3)\n    ///     print(values)\n    ///     // Prints \"[\"Value\", \"Value\", \"Value\"]\"\n    ///\n    /// - Parameters:\n    ///   - expression: The expression to execute for each position of the collection.\n    ///   - count: The count of the collection.\n    init(expression: @autoclosure () throws -> Element, count: Int) rethrows {\n        self.init()\n        // swiftlint:disable:next empty_count\n        if count > 0 {\n            reserveCapacity(count)\n            while self.count < count {\n                append(try expression())\n            }\n        }\n    }\n\n}\n\n// MARK: - Methods\npublic extension RangeReplaceableCollection {\n\n    /// SwifterSwift: Returns a new rotated collection by the given places.\n    ///\n    ///     [1, 2, 3, 4].rotated(by: 1) -> [4,1,2,3]\n    ///     [1, 2, 3, 4].rotated(by: 3) -> [2,3,4,1]\n    ///     [1, 2, 3, 4].rotated(by: -1) -> [2,3,4,1]\n    ///\n    /// - Parameter places: Number of places that the array be rotated. If the value is positive the end becomes the start, if it negative it's that start becom the end.\n    /// - Returns: The new rotated collection.\n    func rotated(by places: Int) -> Self {\n        // Inspired by: https://ruby-doc.org/core-2.2.0/Array.html#method-i-rotate\n        var copy = self\n        return copy.rotate(by: places)\n    }\n\n    /// SwifterSwift: Rotate the collection by the given places.\n    ///\n    ///     [1, 2, 3, 4].rotate(by: 1) -> [4,1,2,3]\n    ///     [1, 2, 3, 4].rotate(by: 3) -> [2,3,4,1]\n    ///     [1, 2, 3, 4].rotated(by: -1) -> [2,3,4,1]\n    ///\n    /// - Parameter places: The number of places that the array should be rotated. If the value is positive the end becomes the start, if it negative it's that start become the end.\n    /// - Returns: self after rotating.\n    @discardableResult\n    mutating func rotate(by places: Int) -> Self {\n        guard places != 0 else { return self }\n        let placesToMove = places%count\n        if placesToMove > 0 {\n            let range = index(endIndex, offsetBy: -placesToMove)...\n            let slice = self[range]\n            removeSubrange(range)\n            insert(contentsOf: slice, at: startIndex)\n        } else {\n            let range = startIndex..<index(startIndex, offsetBy: -placesToMove)\n            let slice = self[range]\n            removeSubrange(range)\n            append(contentsOf: slice)\n        }\n        return self\n    }\n\n    /// SwifterSwift: Removes the first element of the collection which satisfies the given predicate.\n    ///\n    ///        [1, 2, 2, 3, 4, 2, 5].removeFirst { $0 % 2 == 0 } -> [1, 2, 3, 4, 2, 5]\n    ///        [\"h\", \"e\", \"l\", \"l\", \"o\"].removeFirst { $0 == \"e\" } -> [\"h\", \"l\", \"l\", \"o\"]\n    ///\n    /// - Parameter predicate: A closure that takes an element as its argument and returns a Boolean value that indicates whether the passed element represents a match.\n    /// - Returns: The first element for which predicate returns true, after removing it. If no elements in the collection satisfy the given predicate, returns `nil`.\n    @discardableResult\n    mutating func removeFirst(where predicate: (Element) throws -> Bool) rethrows -> Element? {\n        guard let index = try firstIndex(where: predicate) else { return nil }\n        return remove(at: index)\n    }\n\n    /// SwifterSwift: Remove a random value from the collection.\n    @discardableResult\n    mutating func removeRandomElement() -> Element? {\n        guard let randomIndex = indices.randomElement() else { return nil }\n        return remove(at: randomIndex)\n    }\n\n    /// SwifterSwift: Keep elements of Array while condition is true.\n    ///\n    ///        [0, 2, 4, 7].keep(while: { $0 % 2 == 0 }) -> [0, 2, 4]\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: self after applying provided condition.\n    /// - Throws: provided condition exception.\n    @discardableResult\n    mutating func keep(while condition: (Element) throws -> Bool) rethrows -> Self {\n        if let idx = try firstIndex(where: { try !condition($0) }) {\n            removeSubrange(idx...)\n        }\n        return self\n    }\n\n    /// SwifterSwift: Take element of Array while condition is true.\n    ///\n    ///        [0, 2, 4, 7, 6, 8].take( where: {$0 % 2 == 0}) -> [0, 2, 4]\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: All elements up until condition evaluates to false.\n    func take(while condition: (Element) throws -> Bool) rethrows -> Self {\n        return Self(try prefix(while: condition))\n    }\n\n    /// SwifterSwift: Skip elements of Array while condition is true.\n    ///\n    ///        [0, 2, 4, 7, 6, 8].skip( where: {$0 % 2 == 0}) -> [6, 8]\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: All elements after the condition evaluates to false.\n    func skip(while condition: (Element) throws-> Bool) rethrows -> Self {\n        guard let idx = try firstIndex(where: { try !condition($0) }) else { return Self() }\n        return Self(self[idx...])\n    }\n\n    /// SwifterSwift: Remove all duplicate elements using KeyPath to compare.\n    ///\n    /// - Parameter path: Key path to compare, the value must be Equatable.\n    mutating func removeDuplicates<E: Equatable>(keyPath path: KeyPath<Element, E>) {\n        var items = [Element]()\n        removeAll { element -> Bool in\n            guard items.contains(where: { $0[keyPath: path] == element[keyPath: path] }) else {\n                items.append(element)\n                return false\n            }\n            return true\n        }\n    }\n\n    /// SwifterSwift: Remove all duplicate elements using KeyPath to compare.\n    ///\n    /// - Parameter path: Key path to compare, the value must be Hashable.\n    mutating func removeDuplicates<E: Hashable>(keyPath path: KeyPath<Element, E>) {\n        var set = Set<E>()\n        removeAll { !set.insert($0[keyPath: path]).inserted }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/SequenceExtensions.swift",
    "content": "//\n//  SequenceExtensions.swift\n//  SwifterSwift\n//\n//  Created by Anton Novoselov on 04/04/2018.\n//  Copyright © 2018 SwifterSwift\n//\n\npublic extension Sequence {\n\n    /// SwifterSwift: Check if all elements in collection match a conditon.\n    ///\n    ///        [2, 2, 4].all(matching: {$0 % 2 == 0}) -> true\n    ///        [1,2, 2, 4].all(matching: {$0 % 2 == 0}) -> false\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: true when all elements in the array match the specified condition.\n    func all(matching condition: (Element) throws -> Bool) rethrows -> Bool {\n        return try !contains { try !condition($0) }\n    }\n\n    /// SwifterSwift: Check if no elements in collection match a conditon.\n    ///\n    ///        [2, 2, 4].none(matching: {$0 % 2 == 0}) -> false\n    ///        [1, 3, 5, 7].none(matching: {$0 % 2 == 0}) -> true\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: true when no elements in the array match the specified condition.\n    func none(matching condition: (Element) throws -> Bool) rethrows -> Bool {\n        return try !contains { try condition($0) }\n    }\n\n    /// SwifterSwift: Check if any element in collection match a conditon.\n    ///\n    ///        [2, 2, 4].any(matching: {$0 % 2 == 0}) -> false\n    ///        [1, 3, 5, 7].any(matching: {$0 % 2 == 0}) -> true\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: true when no elements in the array match the specified condition.\n    func any(matching condition: (Element) throws -> Bool) rethrows -> Bool {\n        return try contains { try condition($0) }\n    }\n\n    /// SwifterSwift: Get last element that satisfies a conditon.\n    ///\n    ///        [2, 2, 4, 7].last(where: {$0 % 2 == 0}) -> 4\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: the last element in the array matching the specified condition. (optional)\n    func last(where condition: (Element) throws -> Bool) rethrows -> Element? {\n        for element in reversed() {\n            if try condition(element) { return element }\n        }\n        return nil\n    }\n\n    /// SwifterSwift: Filter elements based on a rejection condition.\n    ///\n    ///        [2, 2, 4, 7].reject(where: {$0 % 2 == 0}) -> [7]\n    ///\n    /// - Parameter condition: to evaluate the exclusion of an element from the array.\n    /// - Returns: the array with rejected values filtered from it.\n    func reject(where condition: (Element) throws -> Bool) rethrows -> [Element] {\n        return try filter { return try !condition($0) }\n    }\n\n    /// SwifterSwift: Get element count based on condition.\n    ///\n    ///        [2, 2, 4, 7].count(where: {$0 % 2 == 0}) -> 3\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: number of times the condition evaluated to true.\n    func count(where condition: (Element) throws -> Bool) rethrows -> Int {\n        var count = 0\n        for element in self where try condition(element) {\n            count += 1\n        }\n        return count\n    }\n\n    /// SwifterSwift: Iterate over a collection in reverse order. (right to left)\n    ///\n    ///        [0, 2, 4, 7].forEachReversed({ print($0)}) -> // Order of print: 7,4,2,0\n    ///\n    /// - Parameter body: a closure that takes an element of the array as a parameter.\n    func forEachReversed(_ body: (Element) throws -> Void) rethrows {\n        try reversed().forEach(body)\n    }\n\n    /// SwifterSwift: Calls the given closure with each element where condition is true.\n    ///\n    ///        [0, 2, 4, 7].forEach(where: {$0 % 2 == 0}, body: { print($0)}) -> // print: 0, 2, 4\n    ///\n    /// - Parameters:\n    ///   - condition: condition to evaluate each element against.\n    ///   - body: a closure that takes an element of the array as a parameter.\n    func forEach(where condition: (Element) throws -> Bool, body: (Element) throws -> Void) rethrows {\n        for element in self where try condition(element) {\n            try body(element)\n        }\n    }\n\n    /// SwifterSwift: Reduces an array while returning each interim combination.\n    ///\n    ///     [1, 2, 3].accumulate(initial: 0, next: +) -> [1, 3, 6]\n    ///\n    /// - Parameters:\n    ///   - initial: initial value.\n    ///   - next: closure that combines the accumulating value and next element of the array.\n    /// - Returns: an array of the final accumulated value and each interim combination.\n    func accumulate<U>(initial: U, next: (U, Element) throws -> U) rethrows -> [U] {\n        var runningTotal = initial\n        return try map { element in\n            runningTotal = try next(runningTotal, element)\n            return runningTotal\n        }\n    }\n\n    /// SwifterSwift: Filtered and map in a single operation.\n    ///\n    ///     [1,2,3,4,5].filtered({ $0 % 2 == 0 }, map: { $0.string }) -> [\"2\", \"4\"]\n    ///\n    /// - Parameters:\n    ///   - isIncluded: condition of inclusion to evaluate each element against.\n    ///   - transform: transform element function to evaluate every element.\n    /// - Returns: Return an filtered and mapped array.\n    func filtered<T>(_ isIncluded: (Element) throws -> Bool, map transform: (Element) throws -> T) rethrows ->  [T] {\n        return try compactMap({\n            if try isIncluded($0) {\n                return try transform($0)\n            }\n            return nil\n        })\n    }\n\n    /// SwifterSwift: Get the only element based on a condition.\n    ///\n    ///     [].single(where: {_ in true}) -> nil\n    ///     [4].single(where: {_ in true}) -> 4\n    ///     [1, 4, 7].single(where: {$0 % 2 == 0}) -> 4\n    ///     [2, 2, 4, 7].single(where: {$0 % 2 == 0}) -> nil\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: The only element in the array matching the specified condition. If there are more matching elements, nil is returned. (optional)\n    func single(where condition: ((Element) throws -> Bool)) rethrows -> Element? {\n        var singleElement: Element?\n        for element in self where try condition(element) {\n            guard singleElement == nil else {\n                singleElement = nil\n                break\n            }\n            singleElement = element\n        }\n        return singleElement\n    }\n\n    /// SwifterSwift: Remove duplicate elements based on condition.\n    ///\n    ///        [1, 2, 1, 3, 2].withoutDuplicates { $0 } -> [1, 2, 3]\n    ///        [(1, 4), (2, 2), (1, 3), (3, 2), (2, 1)].withoutDuplicates { $0.0 } -> [(1, 4), (2, 2), (3, 2)]\n    ///\n    /// - Parameter transform: A closure that should return the value to be evaluated for repeating elements.\n    /// - Returns: Sequence without repeating elements\n    /// - Complexity: O(*n*), where *n* is the length of the sequence.\n    func withoutDuplicates<T: Hashable>(transform: (Element) throws -> T) rethrows -> [Element] {\n        var set = Set<T>()\n        return try filter { set.insert(try transform($0)).inserted }\n    }\n\n    /// SwifterSwift: Separates all items into 2 lists based on a given predicate. The first list contains all items for which the specified condition evaluates to true. The second list contains those that don't.\n    ///\n    ///     let (even, odd) = [0, 1, 2, 3, 4, 5].divided { $0 % 2 == 0 }\n    ///     let (minors, adults) = people.divided { $0.age < 18 }\n    ///\n    /// - Parameter condition: condition to evaluate each element against.\n    /// - Returns: A tuple of matched and non-matched items\n    func divided(by condition: (Element) throws -> Bool) rethrows -> (matching: [Element], nonMatching: [Element]) {\n        // Inspired by: http://ruby-doc.org/core-2.5.0/Enumerable.html#method-i-partition\n        var matching = ContiguousArray<Element>()\n        var nonMatching = ContiguousArray<Element>()\n\n        var iterator = self.makeIterator()\n        while let element = iterator.next() {\n            try condition(element) ? matching.append(element) : nonMatching.append(element)\n        }\n        return (Array(matching), Array(nonMatching))\n    }\n\n    /// SwifterSwift: Return a sorted array based on a key path and a compare function.\n    ///\n    /// - Parameter keyPath: Key path to sort by.\n    /// - Parameter compare: Comparation function that will determine the ordering.\n    /// - Returns: The sorted array.\n    func sorted<T>(by keyPath: KeyPath<Element, T>, with compare: (T, T) -> Bool) -> [Element] {\n        return sorted { compare($0[keyPath: keyPath], $1[keyPath: keyPath]) }\n    }\n\n    /// SwifterSwift: Return a sorted array based on a key path.\n    ///\n    /// - Parameter keyPath: Key path to sort by. The key path type must be Comparable.\n    /// - Returns: The sorted array.\n    func sorted<T: Comparable>(by keyPath: KeyPath<Element, T>) -> [Element] {\n        return sorted { $0[keyPath: keyPath] < $1[keyPath: keyPath] }\n    }\n\n    /// SwifterSwift: Returns a sorted sequence based on two key paths. The second one will be used in case the values of the first one match.\n    ///\n    /// - Parameters:\n    ///     - keyPath1: Key path to sort by. Must be Comparable.\n    ///     - keyPath2: Key path to sort by in case the values of `keyPath1` match. Must be Comparable.\n    func sorted<T: Comparable, U: Comparable>(by keyPath1: KeyPath<Element, T>,\n                                              and keyPath2: KeyPath<Element, U>) -> [Element] {\n        return sorted {\n            if $0[keyPath: keyPath1] != $1[keyPath: keyPath1] {\n                return $0[keyPath: keyPath1] < $1[keyPath: keyPath1]\n            }\n            return $0[keyPath: keyPath2] < $1[keyPath: keyPath2]\n        }\n    }\n\n    /// SwifterSwift: Returns a sorted sequence based on three key paths. Whenever the values of one key path match, the next one will be used.\n    ///\n    /// - Parameters:\n    ///     - keyPath1: Key path to sort by. Must be Comparable.\n    ///     - keyPath2: Key path to sort by in case the values of `keyPath1` match. Must be Comparable.\n    ///     - keyPath3: Key path to sort by in case the values of `keyPath1` and `keyPath2` match. Must be Comparable.\n    func sorted<T: Comparable, U: Comparable, V: Comparable>(by keyPath1: KeyPath<Element, T>,\n                                                             and keyPath2: KeyPath<Element, U>,\n                                                             and keyPath3: KeyPath<Element, V>) -> [Element] {\n        return sorted {\n            if $0[keyPath: keyPath1] != $1[keyPath: keyPath1] {\n                return $0[keyPath: keyPath1] < $1[keyPath: keyPath1]\n            }\n            if $0[keyPath: keyPath2] != $1[keyPath: keyPath2] {\n                return $0[keyPath: keyPath2] < $1[keyPath: keyPath2]\n            }\n            return $0[keyPath: keyPath3] < $1[keyPath: keyPath3]\n        }\n    }\n\n    /// SwifterSwift: Sum of a `AdditiveArithmetic` property of each `Element` in a `Sequence`.\n    ///\n    ///     [\"James\", \"Wade\", \"Bryant\"].sum(for: \\.count) -> 15\n    ///\n    /// - Parameter keyPath: Key path of the `AdditiveArithmetic` property.\n    /// - Returns: The sum of the `AdditiveArithmetic` propertys at `keyPath`.\n    func sum<T: AdditiveArithmetic>(for keyPath: KeyPath<Element, T>) -> T {\n        // Inspired by: https://swiftbysundell.com/articles/reducers-in-swift/\n        return reduce(.zero) { $0 + $1[keyPath: keyPath] }\n    }\n\n    /// SwifterSwift: Returns an array containing the results of mapping the given key path over the sequence’s elements.\n    ///\n    /// - Parameter keyPath: Key path to map.\n    /// - Returns: An array containing the results of mapping.\n    func map<T>(by keyPath: KeyPath<Element, T>) -> [T] {\n        return map { $0[keyPath: keyPath] }\n    }\n\n    /// SwifterSwift: Returns an array containing the non-nil results of mapping the given key path over the sequence’s elements.\n    ///\n    /// - Parameter keyPath: Key path to map.\n    /// - Returns: An array containing the non-nil results of mapping.\n    func compactMap<T>(by keyPath: KeyPath<Element, T?>) -> [T] {\n        return compactMap { $0[keyPath: keyPath] }\n    }\n\n    /// SwifterSwift: Returns an array containing the results of filtering the sequence’s elements by a boolean key path.\n    ///\n    /// - Parameter keyPath: Boolean key path. If it's value is `true` the element will be added to result.\n    /// - Returns: An array containing filtered elements.\n    func filter(by keyPath: KeyPath<Element, Bool>) -> [Element] {\n        return filter { $0[keyPath: keyPath] }\n    }\n}\n\npublic extension Sequence where Element: Equatable {\n\n    /// SwifterSwift: Check if array contains an array of elements.\n    ///\n    ///        [1, 2, 3, 4, 5].contains([1, 2]) -> true\n    ///        [1.2, 2.3, 4.5, 3.4, 4.5].contains([2, 6]) -> false\n    ///        [\"h\", \"e\", \"l\", \"l\", \"o\"].contains([\"l\", \"o\"]) -> true\n    ///\n    /// - Parameter elements: array of elements to check.\n    /// - Returns: true if array contains all given items.\n    func contains(_ elements: [Element]) -> Bool {\n        guard !elements.isEmpty else { return true }\n        for element in elements {\n            if !contains(element) {\n                return false\n            }\n        }\n        return true\n    }\n\n}\n\npublic extension Sequence where Element: Hashable {\n\n    /// SwifterSwift: Check whether a sequence contains duplicates.\n    ///\n    /// - Returns: true if the receiver contains duplicates.\n    func containsDuplicates() -> Bool {\n        var set = Set<Element>()\n        for element in self {\n            if !set.insert(element).inserted {\n                return true\n            }\n        }\n        return false\n    }\n\n    /// SwifterSwift: Getting the duplicated elements in a sequence.\n    ///\n    ///     [1, 1, 2, 2, 3, 3, 3, 4, 5].duplicates().sorted() -> [1, 2, 3])\n    ///     [\"h\", \"e\", \"l\", \"l\", \"o\"].duplicates().sorted() -> [\"l\"])\n    ///\n    /// - Returns: An array of duplicated elements.\n    ///\n    func duplicates() -> [Element] {\n        var set = Set<Element>()\n        var duplicates = Set<Element>()\n        forEach {\n            if !set.insert($0).inserted {\n                duplicates.insert($0)\n            }\n        }\n        return Array(duplicates)\n    }\n}\n\n// MARK: - Methods (Numeric)\npublic extension Sequence where Element: Numeric {\n\n    /// SwifterSwift: Sum of all elements in array.\n    ///\n    ///        [1, 2, 3, 4, 5].sum() -> 15\n    ///\n    /// - Returns: sum of the array's elements.\n    func sum() -> Element {\n        return reduce(into: 0, +=)\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/SignedIntegerExtensions.swift",
    "content": "//\n//  SignedIntegerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/15/17.\n//  Copyright © 2017 SwifterSwift\n//\n#if canImport(Foundation)\nimport Foundation\n#endif\n\n// MARK: - Properties\npublic extension SignedInteger {\n\n    /// SwifterSwift: Absolute value of integer number.\n    var abs: Self {\n        return Swift.abs(self)\n    }\n\n    /// SwifterSwift: Check if integer is positive.\n    var isPositive: Bool {\n        return self > 0\n    }\n\n    /// SwifterSwift: Check if integer is negative.\n    var isNegative: Bool {\n        return self < 0\n    }\n\n    /// SwifterSwift: Check if integer is even.\n    var isEven: Bool {\n        return (self % 2) == 0\n    }\n\n    /// SwifterSwift: Check if integer is odd.\n    var isOdd: Bool {\n        return (self % 2) != 0\n    }\n\n    /// SwifterSwift: String of format (XXh XXm) from seconds Int.\n    var timeString: String {\n        guard self > 0 else {\n            return \"0 sec\"\n        }\n        if self < 60 {\n            return \"\\(self) sec\"\n        }\n        if self < 3600 {\n            return \"\\(self / 60) min\"\n        }\n        let hours = self / 3600\n        let mins = (self % 3600) / 60\n\n        if hours != 0 && mins == 0 {\n            return \"\\(hours)h\"\n        }\n        return \"\\(hours)h \\(mins)m\"\n    }\n\n}\n\n// MARK: - Methods\npublic extension SignedInteger {\n\n    /// SwifterSwift: Greatest common divisor of integer value and n.\n    ///\n    /// - Parameter number: integer value to find gcd with.\n    /// - Returns: greatest common divisor of self and n.\n    func gcd(of number: Self) -> Self {\n        return number == 0 ? self : number.gcd(of: self % number)\n    }\n\n    /// SwifterSwift: Least common multiple of integer and n.\n    ///\n    /// - Parameter number: integer value to find lcm with.\n    /// - Returns: least common multiple of self and n.\n    func lcm(of number: Self) -> Self {\n        return (self * number).abs / gcd(of: number)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Ordinal representation of an integer.\n    ///\n    ///        print((12).ordinalString()) // prints \"12th\"\n    ///\n    /// - Parameter locale: locale, default is .current.\n    /// - Returns: string ordinal representation of number in specified locale language. E.g. input 92, output in \"en\": \"92nd\".\n    @available(macOS 10.11, *)\n    func ordinalString(locale: Locale = .current) -> String? {\n        let formatter = NumberFormatter()\n        formatter.locale = locale\n        formatter.numberStyle = .ordinal\n        guard let number = self as? NSNumber else { return nil }\n        return formatter.string(from: number)\n    }\n    #endif\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/SignedNumericExtensions.swift",
    "content": "//\n//  SignedNumberExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/15/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n#endif\n\n// MARK: - Properties\npublic extension SignedNumeric {\n\n    /// SwifterSwift: String.\n    var string: String {\n        return String(describing: self)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: String with number and current locale currency.\n    var asLocaleCurrency: String? {\n        let formatter = NumberFormatter()\n        formatter.numberStyle = .currency\n        formatter.locale = Locale.current\n        // swiftlint:disable:next force_cast\n        return formatter.string(from: self as! NSNumber)\n    }\n    #endif\n\n}\n\n// MARK: - Methods\npublic extension SignedNumeric {\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Spelled out representation of a number.\n    ///\n    ///        print((12.32).spelledOutString()) // prints \"twelve point three two\"\n    ///\n    /// - Parameter locale: Locale, default is .current.\n    /// - Returns: String representation of number spelled in specified locale language. E.g. input 92, output in \"en\": \"ninety-two\"\n    func spelledOutString(locale: Locale = .current) -> String? {\n        let formatter = NumberFormatter()\n        formatter.locale = locale\n        formatter.numberStyle = .spellOut\n\n        guard let number = self as? NSNumber else { return nil }\n        return formatter.string(from: number)\n    }\n    #endif\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/StringExtensions.swift",
    "content": "//\n//  StringExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/5/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(Foundation)\nimport Foundation\n#endif\n\n#if canImport(UIKit)\nimport UIKit\n#endif\n\n#if canImport(AppKit)\nimport AppKit\n#endif\n\n#if canImport(CoreGraphics)\nimport CoreGraphics\n#endif\n\n// MARK: - Properties\npublic extension String {\n\n    #if canImport(Foundation)\n    /// SwifterSwift: String decoded from base64 (if applicable).\n    ///\n    ///\t\t\"SGVsbG8gV29ybGQh\".base64Decoded = Optional(\"Hello World!\")\n    ///\n    var base64Decoded: String? {\n        let remainder = count % 4\n\n        var padding = \"\"\n        if remainder > 0 {\n            padding = String(repeating: \"=\", count: 4 - remainder)\n        }\n\n        guard let data = Data(base64Encoded: self + padding,\n                              options: .ignoreUnknownCharacters) else { return nil }\n\n        return String(data: data, encoding: .utf8)\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: String encoded in base64 (if applicable).\n    ///\n    ///\t\t\"Hello World!\".base64Encoded -> Optional(\"SGVsbG8gV29ybGQh\")\n    ///\n    var base64Encoded: String? {\n        // https://github.com/Reza-Rg/Base64-Swift-Extension/blob/master/Base64.swift\n        let plainData = data(using: .utf8)\n        return plainData?.base64EncodedString()\n    }\n    #endif\n\n    /// SwifterSwift: Array of characters of a string.\n    var charactersArray: [Character] {\n        return Array(self)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: CamelCase of string.\n    ///\n    ///\t\t\"sOme vAriable naMe\".camelCased -> \"someVariableName\"\n    ///\n    var camelCased: String {\n        let source = lowercased()\n        let first = source[..<source.index(after: source.startIndex)]\n        if source.contains(\" \") {\n            let connected = source.capitalized.replacingOccurrences(of: \" \", with: \"\")\n            let camel = connected.replacingOccurrences(of: \"\\n\", with: \"\")\n            let rest = String(camel.dropFirst())\n            return first + rest\n        }\n        let rest = String(source.dropFirst())\n        return first + rest\n    }\n    #endif\n\n    /// SwifterSwift: Check if string contains one or more emojis.\n    ///\n    ///\t\t\"Hello 😀\".containEmoji -> true\n    ///\n    var containEmoji: Bool {\n        // http://stackoverflow.com/questions/30757193/find-out-if-character-in-string-is-emoji\n        for scalar in unicodeScalars {\n            switch scalar.value {\n            case 0x1F600...0x1F64F, // Emoticons\n            0x1F300...0x1F5FF, // Misc Symbols and Pictographs\n            0x1F680...0x1F6FF, // Transport and Map\n            0x1F1E6...0x1F1FF, // Regional country flags\n            0x2600...0x26FF, // Misc symbols\n            0x2700...0x27BF, // Dingbats\n            0xE0020...0xE007F, // Tags\n            0xFE00...0xFE0F, // Variation Selectors\n            0x1F900...0x1F9FF, // Supplemental Symbols and Pictographs\n            127000...127600, // Various asian characters\n            65024...65039, // Variation selector\n            9100...9300, // Misc items\n            8400...8447: // Combining Diacritical Marks for Symbols\n                return true\n            default:\n                continue\n            }\n        }\n        return false\n    }\n\n    /// SwifterSwift: First character of string (if applicable).\n    ///\n    ///\t\t\"Hello\".firstCharacterAsString -> Optional(\"H\")\n    ///\t\t\"\".firstCharacterAsString -> nil\n    ///\n    var firstCharacterAsString: String? {\n        guard let first = first else { return nil }\n        return String(first)\n    }\n\n    /// SwifterSwift: Check if string contains one or more letters.\n    ///\n    ///\t\t\"123abc\".hasLetters -> true\n    ///\t\t\"123\".hasLetters -> false\n    ///\n    var hasLetters: Bool {\n        return rangeOfCharacter(from: .letters, options: .numeric, range: nil) != nil\n    }\n\n    /// SwifterSwift: Check if string contains one or more numbers.\n    ///\n    ///\t\t\"abcd\".hasNumbers -> false\n    ///\t\t\"123abc\".hasNumbers -> true\n    ///\n    var hasNumbers: Bool {\n        return rangeOfCharacter(from: .decimalDigits, options: .literal, range: nil) != nil\n    }\n\n    /// SwifterSwift: Check if string contains only letters.\n    ///\n    ///\t\t\"abc\".isAlphabetic -> true\n    ///\t\t\"123abc\".isAlphabetic -> false\n    ///\n    var isAlphabetic: Bool {\n        let hasLetters = rangeOfCharacter(from: .letters, options: .numeric, range: nil) != nil\n        let hasNumbers = rangeOfCharacter(from: .decimalDigits, options: .literal, range: nil) != nil\n        return hasLetters && !hasNumbers\n    }\n\n    /// SwifterSwift: Check if string contains at least one letter and one number.\n    ///\n    ///\t\t// useful for passwords\n    ///\t\t\"123abc\".isAlphaNumeric -> true\n    ///\t\t\"abc\".isAlphaNumeric -> false\n    ///\n    var isAlphaNumeric: Bool {\n        let hasLetters = rangeOfCharacter(from: .letters, options: .numeric, range: nil) != nil\n        let hasNumbers = rangeOfCharacter(from: .decimalDigits, options: .literal, range: nil) != nil\n        let comps = components(separatedBy: .alphanumerics)\n        return comps.joined(separator: \"\").count == 0 && hasLetters && hasNumbers\n    }\n\n    /// SwifterSwift: Check if string is palindrome.\n    ///\n    ///     \"abcdcba\".isPalindrome -> true\n    ///     \"Mom\".isPalindrome -> true\n    ///     \"A man a plan a canal, Panama!\".isPalindrome -> true\n    ///     \"Mama\".isPalindrome -> false\n    ///\n    var isPalindrome: Bool {\n        let letters = filter { $0.isLetter }\n        guard !letters.isEmpty else { return false }\n        let midIndex = letters.index(letters.startIndex, offsetBy: letters.count / 2)\n        let firstHalf = letters[letters.startIndex..<midIndex]\n        let secondHalf = letters[midIndex..<letters.endIndex].reversed()\n        return !zip(firstHalf, secondHalf).contains(where: { $0.lowercased() != $1.lowercased() })\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string is valid email format.\n    ///\n    /// - Note: Note that this property does not validate the email address against an email server. It merely attempts to determine whether its format is suitable for an email address.\n    ///\n    ///\t\t\"john@doe.com\".isValidEmail -> true\n    ///\n    var isValidEmail: Bool {\n        // http://emailregex.com/\n        let regex = \"^(?:[\\\\p{L}0-9!#$%\\\\&'*+/=?\\\\^_`{|}~-]+(?:\\\\.[\\\\p{L}0-9!#$%\\\\&'*+/=?\\\\^_`{|}~-]+)*|\\\"(?:[\\\\x01-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x21\\\\x23-\\\\x5b\\\\x5d-\\\\x7f]|\\\\\\\\[\\\\x01-\\\\x09\\\\x0b\\\\x0c\\\\x0e-\\\\x7f])*\\\")@(?:(?:[\\\\p{L}0-9](?:[a-z0-9-]*[\\\\p{L}0-9])?\\\\.)+[\\\\p{L}0-9](?:[\\\\p{L}0-9-]*[\\\\p{L}0-9])?|\\\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[\\\\p{L}0-9-]*[\\\\p{L}0-9]:(?:[\\\\x01-\\\\x08\\\\x0b\\\\x0c\\\\x0e-\\\\x1f\\\\x21-\\\\x5a\\\\x53-\\\\x7f]|\\\\\\\\[\\\\x01-\\\\x09\\\\x0b\\\\x0c\\\\x0e-\\\\x7f])+)\\\\])$\"\n        return range(of: regex, options: .regularExpression, range: nil, locale: nil) != nil\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string is a valid URL.\n    ///\n    ///\t\t\"https://google.com\".isValidUrl -> true\n    ///\n    var isValidUrl: Bool {\n        return URL(string: self) != nil\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string is a valid schemed URL.\n    ///\n    ///\t\t\"https://google.com\".isValidSchemedUrl -> true\n    ///\t\t\"google.com\".isValidSchemedUrl -> false\n    ///\n    var isValidSchemedUrl: Bool {\n        guard let url = URL(string: self) else { return false }\n        return url.scheme != nil\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string is a valid https URL.\n    ///\n    ///\t\t\"https://google.com\".isValidHttpsUrl -> true\n    ///\n    var isValidHttpsUrl: Bool {\n        guard let url = URL(string: self) else { return false }\n        return url.scheme == \"https\"\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string is a valid http URL.\n    ///\n    ///\t\t\"http://google.com\".isValidHttpUrl -> true\n    ///\n    var isValidHttpUrl: Bool {\n        guard let url = URL(string: self) else { return false }\n        return url.scheme == \"http\"\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string is a valid file URL.\n    ///\n    ///\t\t\"file://Documents/file.txt\".isValidFileUrl -> true\n    ///\n    var isValidFileUrl: Bool {\n        return URL(string: self)?.isFileURL ?? false\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string is a valid Swift number. Note: In North America, \".\" is the decimal separator, while in many parts of Europe \",\" is used,\n    ///\n    ///\t\t\"123\".isNumeric -> true\n    ///     \"1.3\".isNumeric -> true (en_US)\n    ///     \"1,3\".isNumeric -> true (fr_FR)\n    ///\t\t\"abc\".isNumeric -> false\n    ///\n    var isNumeric: Bool {\n        let scanner = Scanner(string: self)\n        scanner.locale = NSLocale.current\n        #if os(Linux) || targetEnvironment(macCatalyst)\n        return scanner.scanDecimal() != nil && scanner.isAtEnd\n        #else\n        return scanner.scanDecimal(nil) && scanner.isAtEnd\n        #endif\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string only contains digits.\n    ///\n    ///     \"123\".isDigits -> true\n    ///     \"1.3\".isDigits -> false\n    ///     \"abc\".isDigits -> false\n    ///\n    var isDigits: Bool {\n        return CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: self))\n    }\n    #endif\n\n    /// SwifterSwift: Last character of string (if applicable).\n    ///\n    ///\t\t\"Hello\".lastCharacterAsString -> Optional(\"o\")\n    ///\t\t\"\".lastCharacterAsString -> nil\n    ///\n    var lastCharacterAsString: String? {\n        guard let last = last else { return nil }\n        return String(last)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Latinized string.\n    ///\n    ///\t\t\"Hèllö Wórld!\".latinized -> \"Hello World!\"\n    ///\n    var latinized: String {\n        return folding(options: .diacriticInsensitive, locale: Locale.current)\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Bool value from string (if applicable).\n    ///\n    ///\t\t\"1\".bool -> true\n    ///\t\t\"False\".bool -> false\n    ///\t\t\"Hello\".bool = nil\n    ///\n    var bool: Bool? {\n        let selfLowercased = trimmingCharacters(in: .whitespacesAndNewlines).lowercased()\n        switch selfLowercased {\n        case \"true\", \"yes\", \"1\":\n            return true\n        case \"false\", \"no\", \"0\":\n            return false\n        default:\n            return nil\n        }\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Date object from \"yyyy-MM-dd\" formatted string.\n    ///\n    ///\t\t\"2007-06-29\".date -> Optional(Date)\n    ///\n    var date: Date? {\n        let selfLowercased = trimmingCharacters(in: .whitespacesAndNewlines).lowercased()\n        let formatter = DateFormatter()\n        formatter.timeZone = TimeZone.current\n        formatter.dateFormat = \"yyyy-MM-dd\"\n        return formatter.date(from: selfLowercased)\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Date object from \"yyyy-MM-dd HH:mm:ss\" formatted string.\n    ///\n    ///\t\t\"2007-06-29 14:23:09\".dateTime -> Optional(Date)\n    ///\n    var dateTime: Date? {\n        let selfLowercased = trimmingCharacters(in: .whitespacesAndNewlines).lowercased()\n        let formatter = DateFormatter()\n        formatter.timeZone = TimeZone.current\n        formatter.dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n        return formatter.date(from: selfLowercased)\n    }\n    #endif\n\n    /// SwifterSwift: Integer value from string (if applicable).\n    ///\n    ///\t\t\"101\".int -> 101\n    ///\n    var int: Int? {\n        return Int(self)\n    }\n\n    /// SwifterSwift: Lorem ipsum string of given length.\n    ///\n    /// - Parameter length: number of characters to limit lorem ipsum to (default is 445 - full lorem ipsum).\n    /// - Returns: Lorem ipsum dolor sit amet... string.\n    static func loremIpsum(ofLength length: Int = 445) -> String {\n        guard length > 0 else { return \"\" }\n\n        // https://www.lipsum.com/\n        let loremIpsum = \"\"\"\n\t\tLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n\t\t\"\"\"\n        if loremIpsum.count > length {\n            return String(loremIpsum[loremIpsum.startIndex..<loremIpsum.index(loremIpsum.startIndex, offsetBy: length)])\n        }\n        return loremIpsum\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: URL from string (if applicable).\n    ///\n    ///\t\t\"https://google.com\".url -> URL(string: \"https://google.com\")\n    ///\t\t\"not url\".url -> nil\n    ///\n    var url: URL? {\n        return URL(string: self)\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: String with no spaces or new lines in beginning and end.\n    ///\n    ///\t\t\"   hello  \\n\".trimmed -> \"hello\"\n    ///\n    var trimmed: String {\n        return trimmingCharacters(in: .whitespacesAndNewlines)\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Readable string from a URL string.\n    ///\n    ///\t\t\"it's%20easy%20to%20decode%20strings\".urlDecoded -> \"it's easy to decode strings\"\n    ///\n    var urlDecoded: String {\n        return removingPercentEncoding ?? self\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: URL escaped string.\n    ///\n    ///\t\t\"it's easy to encode strings\".urlEncoded -> \"it's%20easy%20to%20encode%20strings\"\n    ///\n    var urlEncoded: String {\n        return addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: String without spaces and new lines.\n    ///\n    ///\t\t\"   \\n Swifter   \\n  Swift  \".withoutSpacesAndNewLines -> \"SwifterSwift\"\n    ///\n    var withoutSpacesAndNewLines: String {\n        return replacingOccurrences(of: \" \", with: \"\").replacingOccurrences(of: \"\\n\", with: \"\")\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if the given string contains only white spaces\n    var isWhitespace: Bool {\n        return trimmingCharacters(in: .whitespacesAndNewlines).isEmpty\n    }\n    #endif\n\n    #if os(iOS) || os(tvOS)\n    /// SwifterSwift: Check if the given string spelled correctly\n    var isSpelledCorrectly: Bool {\n        let checker = UITextChecker()\n        let range = NSRange(location: 0, length: utf16.count)\n\n        let misspelledRange = checker.rangeOfMisspelledWord(in: self, range: range, startingAt: 0, wrap: false, language: Locale.preferredLanguages.first ?? \"en\")\n        return misspelledRange.location == NSNotFound\n    }\n    #endif\n\n}\n\n// MARK: - Methods\npublic extension String {\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Float value from string (if applicable).\n    ///\n    /// - Parameter locale: Locale (default is Locale.current)\n    /// - Returns: Optional Float value from given string.\n    func float(locale: Locale = .current) -> Float? {\n        let formatter = NumberFormatter()\n        formatter.locale = locale\n        formatter.allowsFloats = true\n        return formatter.number(from: self)?.floatValue\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Double value from string (if applicable).\n    ///\n    /// - Parameter locale: Locale (default is Locale.current)\n    /// - Returns: Optional Double value from given string.\n    func double(locale: Locale = .current) -> Double? {\n        let formatter = NumberFormatter()\n        formatter.locale = locale\n        formatter.allowsFloats = true\n        return formatter.number(from: self)?.doubleValue\n    }\n    #endif\n\n    #if canImport(CoreGraphics) && canImport(Foundation)\n    /// SwifterSwift: CGFloat value from string (if applicable).\n    ///\n    /// - Parameter locale: Locale (default is Locale.current)\n    /// - Returns: Optional CGFloat value from given string.\n    func cgFloat(locale: Locale = .current) -> CGFloat? {\n        let formatter = NumberFormatter()\n        formatter.locale = locale\n        formatter.allowsFloats = true\n        return formatter.number(from: self) as? CGFloat\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Array of strings separated by new lines.\n    ///\n    ///\t\t\"Hello\\ntest\".lines() -> [\"Hello\", \"test\"]\n    ///\n    /// - Returns: Strings separated by new lines.\n    func lines() -> [String] {\n        var result = [String]()\n        enumerateLines { line, _ in\n            result.append(line)\n        }\n        return result\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Returns a localized string, with an optional comment for translators.\n    ///\n    ///        \"Hello world\".localized -> Hallo Welt\n    ///\n    func localized(comment: String = \"\") -> String {\n        return NSLocalizedString(self, comment: comment)\n    }\n    #endif\n\n    /// SwifterSwift: The most common character in string.\n    ///\n    ///\t\t\"This is a test, since e is appearing everywhere e should be the common character\".mostCommonCharacter() -> \"e\"\n    ///\n    /// - Returns: The most common character.\n    func mostCommonCharacter() -> Character? {\n        let mostCommon = withoutSpacesAndNewLines.reduce(into: [Character: Int]()) {\n            let count = $0[$1] ?? 0\n            $0[$1] = count + 1\n        }.max { $0.1 < $1.1 }?.key\n\n        return mostCommon\n    }\n\n    /// SwifterSwift: Array with unicodes for all characters in a string.\n    ///\n    ///\t\t\"SwifterSwift\".unicodeArray() -> [83, 119, 105, 102, 116, 101, 114, 83, 119, 105, 102, 116]\n    ///\n    /// - Returns: The unicodes for all characters in a string.\n    func unicodeArray() -> [Int] {\n        return unicodeScalars.map { Int($0.value) }\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: an array of all words in a string\n    ///\n    ///\t\t\"Swift is amazing\".words() -> [\"Swift\", \"is\", \"amazing\"]\n    ///\n    /// - Returns: The words contained in a string.\n    func words() -> [String] {\n        // https://stackoverflow.com/questions/42822838\n        let chararacterSet = CharacterSet.whitespacesAndNewlines.union(.punctuationCharacters)\n        let comps = components(separatedBy: chararacterSet)\n        return comps.filter { !$0.isEmpty }\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Count of words in a string.\n    ///\n    ///\t\t\"Swift is amazing\".wordsCount() -> 3\n    ///\n    /// - Returns: The count of words contained in a string.\n    func wordCount() -> Int {\n        // https://stackoverflow.com/questions/42822838\n        let chararacterSet = CharacterSet.whitespacesAndNewlines.union(.punctuationCharacters)\n        let comps = components(separatedBy: chararacterSet)\n        let words = comps.filter { !$0.isEmpty }\n        return words.count\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Transforms the string into a slug string.\n    ///\n    ///        \"Swift is amazing\".toSlug() -> \"swift-is-amazing\"\n    ///\n    /// - Returns: The string in slug format.\n    func toSlug() -> String {\n        let lowercased = self.lowercased()\n        let latinized = lowercased.folding(options: .diacriticInsensitive, locale: Locale.current)\n        let withDashes = latinized.replacingOccurrences(of: \" \", with: \"-\")\n\n        let alphanumerics = NSCharacterSet.alphanumerics\n        var filtered = withDashes.filter {\n            guard String($0) != \"-\" else { return true }\n            guard String($0) != \"&\" else { return true }\n            return String($0).rangeOfCharacter(from: alphanumerics) != nil\n        }\n\n        while filtered.lastCharacterAsString == \"-\" {\n            filtered = String(filtered.dropLast())\n        }\n\n        while filtered.firstCharacterAsString == \"-\" {\n            filtered = String(filtered.dropFirst())\n        }\n\n        return filtered.replacingOccurrences(of: \"--\", with: \"-\")\n    }\n    #endif\n\n    /// SwifterSwift: Safely subscript string with index.\n    ///\n    ///\t\t\"Hello World!\"[safe: 3] -> \"l\"\n    ///\t\t\"Hello World!\"[safe: 20] -> nil\n    ///\n    /// - Parameter index: index.\n    subscript(safe index: Int) -> Character? {\n        guard index >= 0 && index < count else { return nil }\n        return self[self.index(startIndex, offsetBy: index)]\n    }\n\n    /// SwifterSwift: Safely subscript string within a given range.\n    ///\n    ///        \"Hello World!\"[safe: 6..<11] -> \"World\"\n    ///        \"Hello World!\"[safe: 21..<110] -> nil\n    ///\n    ///        \"Hello World!\"[safe: 6...11] -> \"World!\"\n    ///        \"Hello World!\"[safe: 21...110] -> nil\n    ///\n    /// - Parameter range: Range expression.\n    subscript<R>(safe range: R) -> String? where R: RangeExpression, R.Bound == Int {\n        let range = range.relative(to: Int.min..<Int.max)\n        guard range.lowerBound >= 0,\n            let lowerIndex = index(startIndex, offsetBy: range.lowerBound, limitedBy: endIndex),\n            let upperIndex = index(startIndex, offsetBy: range.upperBound, limitedBy: endIndex) else {\n                return nil\n        }\n\n        return String(self[lowerIndex..<upperIndex])\n    }\n\n    #if os(iOS) || os(macOS)\n    /// SwifterSwift: Copy string to global pasteboard.\n    ///\n    ///\t\t\"SomeText\".copyToPasteboard() // copies \"SomeText\" to pasteboard\n    ///\n    func copyToPasteboard() {\n        #if os(iOS)\n        UIPasteboard.general.string = self\n        #elseif os(macOS)\n        NSPasteboard.general.clearContents()\n        NSPasteboard.general.setString(self, forType: .string)\n        #endif\n    }\n    #endif\n\n    /// SwifterSwift: Converts string format to CamelCase.\n    ///\n    ///\t\tvar str = \"sOme vaRiabLe Name\"\n    ///\t\tstr.camelize()\n    ///\t\tprint(str) // prints \"someVariableName\"\n    ///\n    @discardableResult\n    mutating func camelize() -> String {\n        let source = lowercased()\n        let first = source[..<source.index(after: source.startIndex)]\n        if source.contains(\" \") {\n            let connected = source.capitalized.replacingOccurrences(of: \" \", with: \"\")\n            let camel = connected.replacingOccurrences(of: \"\\n\", with: \"\")\n            let rest = String(camel.dropFirst())\n            self = first + rest\n            return self\n        }\n        let rest = String(source.dropFirst())\n\n        self = first + rest\n        return self\n    }\n\n    /// SwifterSwift: First character of string uppercased(if applicable) while keeping the original string.\n    ///\n    ///        \"hello world\".firstCharacterUppercased() -> \"Hello world\"\n    ///        \"\".firstCharacterUppercased() -> \"\"\n    ///\n    mutating func firstCharacterUppercased() {\n        guard let first = first else { return }\n        self = String(first).uppercased() + dropFirst()\n    }\n\n    /// SwifterSwift: Check if string contains only unique characters.\n    ///\n    func hasUniqueCharacters() -> Bool {\n        guard count > 0 else { return false }\n        var uniqueChars = Set<String>()\n        for char in self {\n            if uniqueChars.contains(String(char)) { return false }\n            uniqueChars.insert(String(char))\n        }\n        return true\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Check if string contains one or more instance of substring.\n    ///\n    ///\t\t\"Hello World!\".contain(\"O\") -> false\n    ///\t\t\"Hello World!\".contain(\"o\", caseSensitive: false) -> true\n    ///\n    /// - Parameters:\n    ///   - string: substring to search for.\n    ///   - caseSensitive: set true for case sensitive search (default is true).\n    /// - Returns: true if string contains one or more instance of substring.\n    func contains(_ string: String, caseSensitive: Bool = true) -> Bool {\n        if !caseSensitive {\n            return range(of: string, options: .caseInsensitive) != nil\n        }\n        return range(of: string) != nil\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Count of substring in string.\n    ///\n    ///\t\t\"Hello World!\".count(of: \"o\") -> 2\n    ///\t\t\"Hello World!\".count(of: \"L\", caseSensitive: false) -> 3\n    ///\n    /// - Parameters:\n    ///   - string: substring to search for.\n    ///   - caseSensitive: set true for case sensitive search (default is true).\n    /// - Returns: count of appearance of substring in string.\n    func count(of string: String, caseSensitive: Bool = true) -> Int {\n        if !caseSensitive {\n            return lowercased().components(separatedBy: string.lowercased()).count - 1\n        }\n        return components(separatedBy: string).count - 1\n    }\n    #endif\n\n    /// SwifterSwift: Check if string ends with substring.\n    ///\n    ///\t\t\"Hello World!\".ends(with: \"!\") -> true\n    ///\t\t\"Hello World!\".ends(with: \"WoRld!\", caseSensitive: false) -> true\n    ///\n    /// - Parameters:\n    ///   - suffix: substring to search if string ends with.\n    ///   - caseSensitive: set true for case sensitive search (default is true).\n    /// - Returns: true if string ends with substring.\n    func ends(with suffix: String, caseSensitive: Bool = true) -> Bool {\n        if !caseSensitive {\n            return lowercased().hasSuffix(suffix.lowercased())\n        }\n        return hasSuffix(suffix)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Latinize string.\n    ///\n    ///\t\tvar str = \"Hèllö Wórld!\"\n    ///\t\tstr.latinize()\n    ///\t\tprint(str) // prints \"Hello World!\"\n    ///\n    @discardableResult\n    mutating func latinize() -> String {\n        self = folding(options: .diacriticInsensitive, locale: Locale.current)\n        return self\n    }\n    #endif\n\n    /// SwifterSwift: Random string of given length.\n    ///\n    ///\t\tString.random(ofLength: 18) -> \"u7MMZYvGo9obcOcPj8\"\n    ///\n    /// - Parameter length: number of characters in string.\n    /// - Returns: random string of given length.\n    static func random(ofLength length: Int) -> String {\n        guard length > 0 else { return \"\" }\n        let base = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"\n        var randomString = \"\"\n        for _ in 1...length {\n            randomString.append(base.randomElement()!)\n        }\n        return randomString\n    }\n\n    /// SwifterSwift: Reverse string.\n    @discardableResult\n    mutating func reverse() -> String {\n        let chars: [Character] = reversed()\n        self = String(chars)\n        return self\n    }\n\n    /// SwifterSwift: Sliced string from a start index with length.\n    ///\n    ///        \"Hello World\".slicing(from: 6, length: 5) -> \"World\"\n    ///\n    /// - Parameters:\n    ///   - index: string index the slicing should start from.\n    ///   - length: amount of characters to be sliced after given index.\n    /// - Returns: sliced substring of length number of characters (if applicable) (example: \"Hello World\".slicing(from: 6, length: 5) -> \"World\")\n    func slicing(from index: Int, length: Int) -> String? {\n        guard length >= 0, index >= 0, index < count  else { return nil }\n        guard index.advanced(by: length) <= count else {\n            return self[safe: index..<count]\n        }\n        guard length > 0 else { return \"\" }\n        return self[safe: index..<index.advanced(by: length)]\n    }\n\n    /// SwifterSwift: Slice given string from a start index with length (if applicable).\n    ///\n    ///\t\tvar str = \"Hello World\"\n    ///\t\tstr.slice(from: 6, length: 5)\n    ///\t\tprint(str) // prints \"World\"\n    ///\n    /// - Parameters:\n    ///   - index: string index the slicing should start from.\n    ///   - length: amount of characters to be sliced after given index.\n    @discardableResult\n    mutating func slice(from index: Int, length: Int) -> String {\n        if let str = slicing(from: index, length: length) {\n            self = String(str)\n        }\n        return self\n    }\n\n    /// SwifterSwift: Slice given string from a start index to an end index (if applicable).\n    ///\n    ///\t\tvar str = \"Hello World\"\n    ///\t\tstr.slice(from: 6, to: 11)\n    ///\t\tprint(str) // prints \"World\"\n    ///\n    /// - Parameters:\n    ///   - start: string index the slicing should start from.\n    ///   - end: string index the slicing should end at.\n    @discardableResult\n    mutating func slice(from start: Int, to end: Int) -> String {\n        guard end >= start else { return self }\n        if let str = self[safe: start..<end] {\n            self = str\n        }\n        return self\n    }\n\n    /// SwifterSwift: Slice given string from a start index (if applicable).\n    ///\n    ///\t\tvar str = \"Hello World\"\n    ///\t\tstr.slice(at: 6)\n    ///\t\tprint(str) // prints \"World\"\n    ///\n    /// - Parameter index: string index the slicing should start from.\n    @discardableResult\n    mutating func slice(at index: Int) -> String {\n        guard index < count else { return self }\n        if let str = self[safe: index..<count] {\n            self = str\n        }\n        return self\n    }\n\n    /// SwifterSwift: Check if string starts with substring.\n    ///\n    ///\t\t\"hello World\".starts(with: \"h\") -> true\n    ///\t\t\"hello World\".starts(with: \"H\", caseSensitive: false) -> true\n    ///\n    /// - Parameters:\n    ///   - suffix: substring to search if string starts with.\n    ///   - caseSensitive: set true for case sensitive search (default is true).\n    /// - Returns: true if string starts with substring.\n    func starts(with prefix: String, caseSensitive: Bool = true) -> Bool {\n        if !caseSensitive {\n            return lowercased().hasPrefix(prefix.lowercased())\n        }\n        return hasPrefix(prefix)\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Date object from string of date format.\n    ///\n    ///\t\t\"2017-01-15\".date(withFormat: \"yyyy-MM-dd\") -> Date set to Jan 15, 2017\n    ///\t\t\"not date string\".date(withFormat: \"yyyy-MM-dd\") -> nil\n    ///\n    /// - Parameter format: date format.\n    /// - Returns: Date object from string (if applicable).\n    func date(withFormat format: String) -> Date? {\n        let dateFormatter = DateFormatter()\n        dateFormatter.dateFormat = format\n        return dateFormatter.date(from: self)\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Removes spaces and new lines in beginning and end of string.\n    ///\n    ///\t\tvar str = \"  \\n Hello World \\n\\n\\n\"\n    ///\t\tstr.trim()\n    ///\t\tprint(str) // prints \"Hello World\"\n    ///\n    @discardableResult\n    mutating func trim() -> String {\n        self = trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)\n        return self\n    }\n    #endif\n\n    /// SwifterSwift: Truncate string (cut it to a given number of characters).\n    ///\n    ///\t\tvar str = \"This is a very long sentence\"\n    ///\t\tstr.truncate(toLength: 14)\n    ///\t\tprint(str) // prints \"This is a very...\"\n    ///\n    /// - Parameters:\n    ///   - toLength: maximum number of characters before cutting.\n    ///   - trailing: string to add at the end of truncated string (default is \"...\").\n    @discardableResult\n    mutating func truncate(toLength length: Int, trailing: String? = \"...\") -> String {\n        guard length > 0 else { return self }\n        if count > length {\n            self = self[startIndex..<index(startIndex, offsetBy: length)] + (trailing ?? \"\")\n        }\n        return self\n    }\n\n    /// SwifterSwift: Truncated string (limited to a given number of characters).\n    ///\n    ///\t\t\"This is a very long sentence\".truncated(toLength: 14) -> \"This is a very...\"\n    ///\t\t\"Short sentence\".truncated(toLength: 14) -> \"Short sentence\"\n    ///\n    /// - Parameters:\n    ///   - toLength: maximum number of characters before cutting.\n    ///   - trailing: string to add at the end of truncated string.\n    /// - Returns: truncated string (this is an extr...).\n    func truncated(toLength length: Int, trailing: String? = \"...\") -> String {\n        guard 1..<count ~= length else { return self }\n        return self[startIndex..<index(startIndex, offsetBy: length)] + (trailing ?? \"\")\n    }\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Convert URL string to readable string.\n    ///\n    ///\t\tvar str = \"it's%20easy%20to%20decode%20strings\"\n    ///\t\tstr.urlDecode()\n    ///\t\tprint(str) // prints \"it's easy to decode strings\"\n    ///\n    @discardableResult\n    mutating func urlDecode() -> String {\n        if let decoded = removingPercentEncoding {\n            self = decoded\n        }\n        return self\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Escape string.\n    ///\n    ///\t\tvar str = \"it's easy to encode strings\"\n    ///\t\tstr.urlEncode()\n    ///\t\tprint(str) // prints \"it's%20easy%20to%20encode%20strings\"\n    ///\n    @discardableResult\n    mutating func urlEncode() -> String {\n        if let encoded = addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) {\n            self = encoded\n        }\n        return self\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Verify if string matches the regex pattern.\n    ///\n    /// - Parameter pattern: Pattern to verify.\n    /// - Returns: true if string matches the pattern.\n    func matches(pattern: String) -> Bool {\n        return range(of: pattern, options: .regularExpression, range: nil, locale: nil) != nil\n    }\n    #endif\n\n    /// SwifterSwift: Pad string to fit the length parameter size with another string in the start.\n    ///\n    ///   \"hue\".padStart(10) -> \"       hue\"\n    ///   \"hue\".padStart(10, with: \"br\") -> \"brbrbrbhue\"\n    ///\n    /// - Parameter length: The target length to pad.\n    /// - Parameter string: Pad string. Default is \" \".\n    @discardableResult\n    mutating func padStart(_ length: Int, with string: String = \" \") -> String {\n        self = paddingStart(length, with: string)\n        return self\n    }\n\n    /// SwifterSwift: Returns a string by padding to fit the length parameter size with another string in the start.\n    ///\n    ///   \"hue\".paddingStart(10) -> \"       hue\"\n    ///   \"hue\".paddingStart(10, with: \"br\") -> \"brbrbrbhue\"\n    ///\n    /// - Parameter length: The target length to pad.\n    /// - Parameter string: Pad string. Default is \" \".\n    /// - Returns: The string with the padding on the start.\n    func paddingStart(_ length: Int, with string: String = \" \") -> String {\n        guard count < length else { return self }\n\n        let padLength = length - count\n        if padLength < string.count {\n            return string[string.startIndex..<string.index(string.startIndex, offsetBy: padLength)] + self\n        } else {\n            var padding = string\n            while padding.count < padLength {\n                padding.append(string)\n            }\n            return padding[padding.startIndex..<padding.index(padding.startIndex, offsetBy: padLength)] + self\n        }\n    }\n\n    /// SwifterSwift: Pad string to fit the length parameter size with another string in the start.\n    ///\n    ///   \"hue\".padEnd(10) -> \"hue       \"\n    ///   \"hue\".padEnd(10, with: \"br\") -> \"huebrbrbrb\"\n    ///\n    /// - Parameter length: The target length to pad.\n    /// - Parameter string: Pad string. Default is \" \".\n    @discardableResult\n    mutating func padEnd(_ length: Int, with string: String = \" \") -> String {\n        self = paddingEnd(length, with: string)\n        return self\n    }\n\n    /// SwifterSwift: Returns a string by padding to fit the length parameter size with another string in the end.\n    ///\n    ///   \"hue\".paddingEnd(10) -> \"hue       \"\n    ///   \"hue\".paddingEnd(10, with: \"br\") -> \"huebrbrbrb\"\n    ///\n    /// - Parameter length: The target length to pad.\n    /// - Parameter string: Pad string. Default is \" \".\n    /// - Returns: The string with the padding on the end.\n    func paddingEnd(_ length: Int, with string: String = \" \") -> String {\n        guard count < length else { return self }\n\n        let padLength = length - count\n        if padLength < string.count {\n            return self + string[string.startIndex..<string.index(string.startIndex, offsetBy: padLength)]\n        } else {\n            var padding = string\n            while padding.count < padLength {\n                padding.append(string)\n            }\n            return self + padding[padding.startIndex..<padding.index(padding.startIndex, offsetBy: padLength)]\n        }\n    }\n\n    /// SwifterSwift: Removes given prefix from the string.\n    ///\n    ///   \"Hello, World!\".removingPrefix(\"Hello, \") -> \"World!\"\n    ///\n    /// - Parameter prefix: Prefix to remove from the string.\n    /// - Returns: The string after prefix removing.\n    func removingPrefix(_ prefix: String) -> String {\n        guard hasPrefix(prefix) else { return self }\n        return String(dropFirst(prefix.count))\n    }\n\n    /// SwifterSwift: Removes given suffix from the string.\n    ///\n    ///   \"Hello, World!\".removingSuffix(\", World!\") -> \"Hello\"\n    ///\n    /// - Parameter suffix: Suffix to remove from the string.\n    /// - Returns: The string after suffix removing.\n    func removingSuffix(_ suffix: String) -> String {\n        guard hasSuffix(suffix) else { return self }\n        return String(dropLast(suffix.count))\n    }\n\n    /// SwifterSwift: Adds prefix to the string.\n    ///\n    ///     \"www.apple.com\".withPrefix(\"https://\") -> \"https://www.apple.com\"\n    ///\n    /// - Parameter prefix: Prefix to add to the string.\n    /// - Returns: The string with the prefix prepended.\n    func withPrefix(_ prefix: String) -> String {\n        // https://www.hackingwithswift.com/articles/141/8-useful-swift-extensions\n        guard !hasPrefix(prefix) else { return self }\n        return prefix + self\n    }\n}\n\n// MARK: - Initializers\npublic extension String {\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Create a new string from a base64 string (if applicable).\n    ///\n    ///\t\tString(base64: \"SGVsbG8gV29ybGQh\") = \"Hello World!\"\n    ///\t\tString(base64: \"hello\") = nil\n    ///\n    /// - Parameter base64: base64 string.\n    init?(base64: String) {\n        guard let decodedData = Data(base64Encoded: base64) else { return nil }\n        guard let str = String(data: decodedData, encoding: .utf8) else { return nil }\n        self.init(str)\n    }\n    #endif\n\n    /// SwifterSwift: Create a new random string of given length.\n    ///\n    ///\t\tString(randomOfLength: 10) -> \"gY8r3MHvlQ\"\n    ///\n    /// - Parameter length: number of characters in string.\n    init(randomOfLength length: Int) {\n        guard length > 0 else {\n            self.init()\n            return\n        }\n\n        let base = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"\n        var randomString = \"\"\n        for _ in 1...length {\n            randomString.append(base.randomElement()!)\n        }\n        self = randomString\n    }\n\n}\n\n#if !os(Linux)\n\n// MARK: - NSAttributedString\npublic extension String {\n\n    #if canImport(UIKit)\n    private typealias Font = UIFont\n    #endif\n\n    #if canImport(AppKit) && !targetEnvironment(macCatalyst)\n    private typealias Font = NSFont\n    #endif\n\n    #if os(iOS) || os(macOS)\n    /// SwifterSwift: Bold string.\n    var bold: NSAttributedString {\n        return NSMutableAttributedString(string: self, attributes: [.font: Font.boldSystemFont(ofSize: Font.systemFontSize)])\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Underlined string\n    var underline: NSAttributedString {\n        return NSAttributedString(string: self, attributes: [.underlineStyle: NSUnderlineStyle.single.rawValue])\n    }\n    #endif\n\n    #if canImport(Foundation)\n    /// SwifterSwift: Strikethrough string.\n    var strikethrough: NSAttributedString {\n        return NSAttributedString(string: self, attributes: [.strikethroughStyle: NSNumber(value: NSUnderlineStyle.single.rawValue as Int)])\n    }\n    #endif\n\n    #if os(iOS)\n    /// SwifterSwift: Italic string.\n    var italic: NSAttributedString {\n        return NSMutableAttributedString(string: self, attributes: [.font: UIFont.italicSystemFont(ofSize: UIFont.systemFontSize)])\n    }\n    #endif\n\n    #if canImport(AppKit) || canImport(UIKit)\n    /// SwifterSwift: Add color to string.\n    ///\n    /// - Parameter color: text color.\n    /// - Returns: a NSAttributedString versions of string colored with given color.\n    func colored(with color: Color) -> NSAttributedString {\n        return NSMutableAttributedString(string: self, attributes: [.foregroundColor: color])\n    }\n    #endif\n\n}\n\n#endif\n\n// MARK: - Operators\npublic extension String {\n\n    /// SwifterSwift: Repeat string multiple times.\n    ///\n    ///        'bar' * 3 -> \"barbarbar\"\n    ///\n    /// - Parameters:\n    ///   - lhs: string to repeat.\n    ///   - rhs: number of times to repeat character.\n    /// - Returns: new string with given string repeated n times.\n    static func * (lhs: String, rhs: Int) -> String {\n        guard rhs > 0 else { return \"\" }\n        return String(repeating: lhs, count: rhs)\n    }\n\n    /// SwifterSwift: Repeat string multiple times.\n    ///\n    ///        3 * 'bar' -> \"barbarbar\"\n    ///\n    /// - Parameters:\n    ///   - lhs: number of times to repeat character.\n    ///   - rhs: string to repeat.\n    /// - Returns: new string with given string repeated n times.\n    static func * (lhs: Int, rhs: String) -> String {\n        guard lhs > 0 else { return \"\" }\n        return String(repeating: rhs, count: lhs)\n    }\n\n}\n\n#if canImport(Foundation)\n\n// MARK: - NSString extensions\npublic extension String {\n\n    /// SwifterSwift: NSString from a string.\n    var nsString: NSString {\n        return NSString(string: self)\n    }\n\n    /// SwifterSwift: NSString lastPathComponent.\n    var lastPathComponent: String {\n        return (self as NSString).lastPathComponent\n    }\n\n    /// SwifterSwift: NSString pathExtension.\n    var pathExtension: String {\n        return (self as NSString).pathExtension\n    }\n\n    /// SwifterSwift: NSString deletingLastPathComponent.\n    var deletingLastPathComponent: String {\n        return (self as NSString).deletingLastPathComponent\n    }\n\n    /// SwifterSwift: NSString deletingPathExtension.\n    var deletingPathExtension: String {\n        return (self as NSString).deletingPathExtension\n    }\n\n    /// SwifterSwift: NSString pathComponents.\n    var pathComponents: [String] {\n        return (self as NSString).pathComponents\n    }\n\n    /// SwifterSwift: NSString appendingPathComponent(str: String)\n    ///\n    /// - Note: This method only works with file paths (not, for example, string representations of URLs.\n    ///   See NSString [appendingPathComponent(_:)](https://developer.apple.com/documentation/foundation/nsstring/1417069-appendingpathcomponent)\n    /// - Parameter str: the path component to append to the receiver.\n    /// - Returns: a new string made by appending aString to the receiver, preceded if necessary by a path separator.\n    func appendingPathComponent(_ str: String) -> String {\n        return (self as NSString).appendingPathComponent(str)\n    }\n\n    /// SwifterSwift: NSString appendingPathExtension(str: String)\n    ///\n    /// - Parameter str: The extension to append to the receiver.\n    /// - Returns: a new string made by appending to the receiver an extension separator followed by ext (if applicable).\n    func appendingPathExtension(_ str: String) -> String? {\n        return (self as NSString).appendingPathExtension(str)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/StringProtocolExtensions.swift",
    "content": "//\n//  StringProtocolExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 11/26/17.\n//  Copyright © 2017 SwifterSwift\n//\n\nimport Foundation\n\npublic extension StringProtocol {\n\n    /// SwifterSwift: The longest common suffix.\n    ///\n    ///        \"Hello world!\".commonSuffix(with: \"It's cold!\") = \"ld!\"\n    ///\n    /// - Parameters:\n    ///     - Parameter aString: The string with which to compare the receiver.\n    ///     - Parameter options: Options for the comparison.\n    /// - Returns: The longest common suffix of the receiver and the given String\n    func commonSuffix<T: StringProtocol>(with aString: T, options: String.CompareOptions = []) -> String {\n        guard !isEmpty && !aString.isEmpty else { return \"\" }\n\n        var idx = endIndex\n        var strIdx = aString.endIndex\n\n        repeat {\n            formIndex(before: &idx)\n            aString.formIndex(before: &strIdx)\n\n            guard String(self[idx]).compare(String(aString[strIdx]), options: options) == .orderedSame else {\n                formIndex(after: &idx)\n                break\n            }\n\n        } while idx > startIndex && strIdx > aString.startIndex\n\n        return String(self[idx...])\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIActivityExtensions.swift",
    "content": "//\n//  UIActivityExtensions.swift\n//  SwifterSwift\n//\n//  Created by Hannes Staffler on 07.10.18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(UIKit) && os(iOS)\nimport UIKit\n\n// MARK: - ActivityType\npublic extension UIActivity.ActivityType {\n\n    /// SwifterSwift: AddToiCloudDrive\n    static let addToiCloudDrive = UIActivity.ActivityType(\"com.apple.CloudDocsUI.AddToiCloudDrive\")\n\n    /// SwifterSwift: WhatsApp share extension\n    static let postToWhatsApp = UIActivity.ActivityType(\"net.whatsapp.WhatsApp.ShareExtension\")\n\n    /// SwifterSwift: LinkedIn share extension\n    static let postToLinkedIn = UIActivity.ActivityType(\"com.linkedin.LinkedIn.ShareExtension\")\n\n    /// SwifterSwift: XING share extension\n    static let postToXing = UIActivity.ActivityType(\"com.xing.XING.Xing-Share\")\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIAlertControllerExtensions.swift",
    "content": "//\n//  UIAlertControllerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/23/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n#if canImport(AudioToolbox)\nimport AudioToolbox\n#endif\n\n// MARK: - Methods\npublic extension UIAlertController {\n\n    /// SwifterSwift: Present alert view controller in the current view controller.\n    ///\n    /// - Parameters:\n    ///   - animated: set true to animate presentation of alert controller (default is true).\n    ///   - vibrate: set true to vibrate the device while presenting the alert (default is false).\n    ///   - completion: an optional completion handler to be called after presenting alert controller (default is nil).\n    func show(animated: Bool = true, vibrate: Bool = false, completion: (() -> Void)? = nil) {\n        #if targetEnvironment(macCatalyst)\n        let window = UIApplication.shared.windows.last\n        #else\n        let window = UIApplication.shared.keyWindow\n        #endif\n        window?.rootViewController?.present(self, animated: animated, completion: completion)\n        if vibrate {\n            #if canImport(AudioToolbox)\n            AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)\n            #endif\n        }\n    }\n\n    /// SwifterSwift: Add an action to Alert\n    ///\n    /// - Parameters:\n    ///   - title: action title\n    ///   - style: action style (default is UIAlertActionStyle.default)\n    ///   - isEnabled: isEnabled status for action (default is true)\n    ///   - handler: optional action handler to be called when button is tapped (default is nil)\n    /// - Returns: action created by this method\n    @discardableResult\n    func addAction(title: String, style: UIAlertAction.Style = .default, isEnabled: Bool = true, handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {\n        let action = UIAlertAction(title: title, style: style, handler: handler)\n        action.isEnabled = isEnabled\n        addAction(action)\n        return action\n    }\n\n    /// SwifterSwift: Add a text field to Alert\n    ///\n    /// - Parameters:\n    ///   - text: text field text (default is nil)\n    ///   - placeholder: text field placeholder text (default is nil)\n    ///   - editingChangedTarget: an optional target for text field's editingChanged\n    ///   - editingChangedSelector: an optional selector for text field's editingChanged\n    func addTextField(text: String? = nil, placeholder: String? = nil, editingChangedTarget: Any?, editingChangedSelector: Selector?) {\n        addTextField { textField in\n            textField.text = text\n            textField.placeholder = placeholder\n            if let target = editingChangedTarget, let selector = editingChangedSelector {\n                textField.addTarget(target, action: selector, for: .editingChanged)\n            }\n        }\n    }\n\n}\n\n// MARK: - Initializers\npublic extension UIAlertController {\n\n    /// SwifterSwift: Create new alert view controller with default OK action.\n    ///\n    /// - Parameters:\n    ///   - title: alert controller's title.\n    ///   - message: alert controller's message (default is nil).\n    ///   - defaultActionButtonTitle: default action button title (default is \"OK\")\n    ///   - tintColor: alert controller's tint color (default is nil)\n    convenience init(title: String, message: String? = nil, defaultActionButtonTitle: String = \"OK\", tintColor: UIColor? = nil) {\n        self.init(title: title, message: message, preferredStyle: .alert)\n        let defaultAction = UIAlertAction(title: defaultActionButtonTitle, style: .default, handler: nil)\n        addAction(defaultAction)\n        if let color = tintColor {\n            view.tintColor = color\n        }\n    }\n\n    /// SwifterSwift: Create new error alert view controller from Error with default OK action.\n    ///\n    /// - Parameters:\n    ///   - title: alert controller's title (default is \"Error\").\n    ///   - error: error to set alert controller's message to it's localizedDescription.\n    ///   - defaultActionButtonTitle: default action button title (default is \"OK\")\n    ///   - tintColor: alert controller's tint color (default is nil)\n    convenience init(title: String = \"Error\", error: Error, defaultActionButtonTitle: String = \"OK\", preferredStyle: UIAlertController.Style = .alert, tintColor: UIColor? = nil) {\n        self.init(title: title, message: error.localizedDescription, preferredStyle: preferredStyle)\n        let defaultAction = UIAlertAction(title: defaultActionButtonTitle, style: .default, handler: nil)\n        addAction(defaultAction)\n        if let color = tintColor {\n            view.tintColor = color\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIApplicationExtensions.swift",
    "content": "//\n//  UIApplicationExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 3/30/19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(UIKit)\nimport UIKit\n\n#if os(iOS) || os(tvOS)\n\npublic extension UIApplication {\n\n    /// SwifterSwift: Application running environment.\n    ///\n    /// - debug: Application is running in debug mode.\n    /// - testFlight: Application is installed from Test Flight.\n    /// - appStore: Application is installed from the App Store.\n    enum Environment {\n        /// SwifterSwift: Application is running in debug mode.\n        case debug\n        /// SwifterSwift: Application is installed from Test Flight.\n        case testFlight\n        /// SwifterSwift: Application is installed from the App Store.\n        case appStore\n    }\n\n    /// SwifterSwift: Current inferred app environment.\n    var inferredEnvironment: Environment {\n        #if DEBUG\n        return .debug\n\n        #elseif targetEnvironment(simulator)\n        return .debug\n\n        #else\n        if Bundle.main.path(forResource: \"embedded\", ofType: \"mobileprovision\") != nil {\n            return .testFlight\n        }\n\n        guard let appStoreReceiptUrl = Bundle.main.appStoreReceiptURL else {\n            return .debug\n        }\n\n        if appStoreReceiptUrl.lastPathComponent.lowercased() == \"sandboxreceipt\" {\n            return .testFlight\n        }\n\n        if appStoreReceiptUrl.path.lowercased().contains(\"simulator\") {\n            return .debug\n        }\n\n        return .appStore\n        #endif\n    }\n\n    /// SwifterSwift: Application name (if applicable).\n    var displayName: String? {\n        return Bundle.main.object(forInfoDictionaryKey: \"CFBundleDisplayName\") as? String\n    }\n\n    /// SwifterSwift: App current build number (if applicable).\n    var buildNumber: String? {\n        return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String\n    }\n\n    /// SwifterSwift: App's current version number (if applicable).\n    var version: String? {\n        return Bundle.main.object(forInfoDictionaryKey: \"CFBundleShortVersionString\") as? String\n    }\n\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIBarButtonItemExtensions.swift",
    "content": "//\n//  UIBarButtonItemExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 08/12/2016.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UIBarButtonItem {\n\n    /// SwifterSwift: Creates a flexible space UIBarButtonItem\n    static var flexibleSpace: UIBarButtonItem {\n        return UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)\n    }\n\n}\n\n// MARK: - Methods\npublic extension UIBarButtonItem {\n\n    /// SwifterSwift: Add Target to UIBarButtonItem\n    ///\n    /// - Parameters:\n    ///   - target: target.\n    ///   - action: selector to run when button is tapped.\n    func addTargetForAction(_ target: AnyObject, action: Selector) {\n        self.target = target\n        self.action = action\n    }\n\n    /// SwifterSwift: Creates a fixed space UIBarButtonItem with a specific width\n    ///\n    /// - Parameter width: Width of the UIBarButtonItem\n    static func fixedSpace(width: CGFloat) -> UIBarButtonItem {\n        let barButtonItem = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)\n        barButtonItem.width = width\n        return barButtonItem\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIBezierPathExtensions.swift",
    "content": "//\n//  UIBezierPathExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Härtwig on 04.04.19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(UIKit)\nimport UIKit\n\n// MARK: - Initializers\npublic extension UIBezierPath {\n\n    /// SwifterSwift: Initializes a UIBezierPath with a line from a CGPoint to another CGPoint.\n    ///\n    /// - Parameters:\n    ///   - from: The point from which to path should start.\n    ///   - to: The point where the path should end.\n    convenience init(from: CGPoint, to otherPoint: CGPoint) {\n        self.init()\n        move(to: from)\n        addLine(to: otherPoint)\n    }\n\n    /// SwifterSwift: Initializes a UIBezierPath connecting the given CGPoints with straight lines.\n    ///\n    /// - Parameter points: The points of which the path should consist.\n    convenience init(points: [CGPoint]) {\n        self.init()\n        if !points.isEmpty {\n            move(to: points[0])\n            for point in points[1...] {\n                addLine(to: point)\n            }\n        }\n    }\n\n    /// SwifterSwift: Initializes a polygonal UIBezierPath with the given CGPoints. At least 3 points must be given.\n    ///\n    /// - Parameter points: The points of the polygon which the path should form.\n    convenience init?(polygonWithPoints points: [CGPoint]) {\n        guard points.count > 2 else {return nil}\n        self.init()\n        move(to: points[0])\n        for point in points[1...] {\n            addLine(to: point)\n        }\n        close()\n    }\n\n    /// SwifterSwift: Initializes a UIBezierPath with an oval path of given size.\n    ///\n    /// - Parameters:\n    ///   - size: The width and height of the oval.\n    ///   - centered: Whether the oval should be centered in its coordinate space.\n    convenience init(ovalOf size: CGSize, centered: Bool) {\n        let origin = centered ? CGPoint(x: -size.width / 2, y: -size.height / 2) : .zero\n        self.init(ovalIn: CGRect(origin: origin, size: size))\n    }\n\n    /// SwifterSwift: Initializes a UIBezierPath with a  rectangular path of given size.\n    ///\n    /// - Parameters:\n    ///   - size: The width and height of the rect.\n    ///   - centered: Whether the oval should be centered in its coordinate space.\n    convenience init(rectOf size: CGSize, centered: Bool) {\n        let origin = centered ? CGPoint(x: -size.width / 2, y: -size.height / 2) : .zero\n        self.init(rect: CGRect(origin: origin, size: size))\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIButtonExtensions.swift",
    "content": "//\n//  UIButtonExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/22/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UIButton {\n\n    /// SwifterSwift: Image of disabled state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var imageForDisabled: UIImage? {\n        get {\n            return image(for: .disabled)\n        }\n        set {\n            setImage(newValue, for: .disabled)\n        }\n    }\n\n    /// SwifterSwift: Image of highlighted state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var imageForHighlighted: UIImage? {\n        get {\n            return image(for: .highlighted)\n        }\n        set {\n            setImage(newValue, for: .highlighted)\n        }\n    }\n\n    /// SwifterSwift: Image of normal state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var imageForNormal: UIImage? {\n        get {\n            return image(for: .normal)\n        }\n        set {\n            setImage(newValue, for: .normal)\n        }\n    }\n\n    /// SwifterSwift: Image of selected state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var imageForSelected: UIImage? {\n        get {\n            return image(for: .selected)\n        }\n        set {\n            setImage(newValue, for: .selected)\n        }\n    }\n\n    /// SwifterSwift: Title color of disabled state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleColorForDisabled: UIColor? {\n        get {\n            return titleColor(for: .disabled)\n        }\n        set {\n            setTitleColor(newValue, for: .disabled)\n        }\n    }\n\n    /// SwifterSwift: Title color of highlighted state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleColorForHighlighted: UIColor? {\n        get {\n            return titleColor(for: .highlighted)\n        }\n        set {\n            setTitleColor(newValue, for: .highlighted)\n        }\n    }\n\n    /// SwifterSwift: Title color of normal state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleColorForNormal: UIColor? {\n        get {\n            return titleColor(for: .normal)\n        }\n        set {\n            setTitleColor(newValue, for: .normal)\n        }\n    }\n\n    /// SwifterSwift: Title color of selected state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleColorForSelected: UIColor? {\n        get {\n            return titleColor(for: .selected)\n        }\n        set {\n            setTitleColor(newValue, for: .selected)\n        }\n    }\n\n    /// SwifterSwift: Title of disabled state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleForDisabled: String? {\n        get {\n            return title(for: .disabled)\n        }\n        set {\n            setTitle(newValue, for: .disabled)\n        }\n    }\n\n    /// SwifterSwift: Title of highlighted state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleForHighlighted: String? {\n        get {\n            return title(for: .highlighted)\n        }\n        set {\n            setTitle(newValue, for: .highlighted)\n        }\n    }\n\n    /// SwifterSwift: Title of normal state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleForNormal: String? {\n        get {\n            return title(for: .normal)\n        }\n        set {\n            setTitle(newValue, for: .normal)\n        }\n    }\n\n    /// SwifterSwift: Title of selected state for button; also inspectable from Storyboard.\n    @IBInspectable\n    var titleForSelected: String? {\n        get {\n            return title(for: .selected)\n        }\n        set {\n            setTitle(newValue, for: .selected)\n        }\n    }\n\n}\n\n// MARK: - Methods\npublic extension UIButton {\n\n    private var states: [UIControl.State] {\n        return [.normal, .selected, .highlighted, .disabled]\n    }\n\n    /// SwifterSwift: Set image for all states.\n    ///\n    /// - Parameter image: UIImage.\n    func setImageForAllStates(_ image: UIImage) {\n        states.forEach { setImage(image, for: $0) }\n    }\n\n    /// SwifterSwift: Set title color for all states.\n    ///\n    /// - Parameter color: UIColor.\n    func setTitleColorForAllStates(_ color: UIColor) {\n        states.forEach { setTitleColor(color, for: $0) }\n    }\n\n    /// SwifterSwift: Set title for all states.\n    ///\n    /// - Parameter title: title string.\n    func setTitleForAllStates(_ title: String) {\n        states.forEach { setTitle(title, for: $0) }\n    }\n\n    /// SwifterSwift: Center align title text and image\n    /// - Parameters:\n    ///   - imageAboveText: set true to make image above title text, default is false, image on left of text\n    ///   - spacing: spacing between title text and image.\n    func centerTextAndImage(imageAboveText: Bool = false, spacing: CGFloat) {\n        if imageAboveText {\n            // https://stackoverflow.com/questions/2451223/#7199529\n            guard\n                let imageSize = imageView?.image?.size,\n                let text = titleLabel?.text,\n                let font = titleLabel?.font\n                else { return }\n\n            let titleSize = text.size(withAttributes: [.font: font])\n\n            let titleOffset = -(imageSize.height + spacing)\n            titleEdgeInsets = UIEdgeInsets(top: 0.0, left: -imageSize.width, bottom: titleOffset, right: 0.0)\n\n            let imageOffset = -(titleSize.height + spacing)\n            imageEdgeInsets = UIEdgeInsets(top: imageOffset, left: 0.0, bottom: 0.0, right: -titleSize.width)\n\n            let edgeOffset = abs(titleSize.height - imageSize.height) / 2.0\n            contentEdgeInsets = UIEdgeInsets(top: edgeOffset, left: 0.0, bottom: edgeOffset, right: 0.0)\n        } else {\n            let insetAmount = spacing / 2\n            imageEdgeInsets = UIEdgeInsets(top: 0, left: -insetAmount, bottom: 0, right: insetAmount)\n            titleEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: -insetAmount)\n            contentEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: insetAmount)\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UICollectionViewExtensions.swift",
    "content": "//\n//  UICollectionViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 11/12/2016.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UICollectionView {\n\n    /// SwifterSwift: Index path of last item in collectionView.\n    var indexPathForLastItem: IndexPath? {\n        return indexPathForLastItem(inSection: lastSection)\n    }\n\n    /// SwifterSwift: Index of last section in collectionView.\n    var lastSection: Int {\n        return numberOfSections > 0 ? numberOfSections - 1 : 0\n    }\n\n}\n\n// MARK: - Methods\npublic extension UICollectionView {\n\n    /// SwifterSwift: Number of all items in all sections of collectionView.\n    ///\n    /// - Returns: The count of all rows in the collectionView.\n    func numberOfItems() -> Int {\n        var section = 0\n        var itemsCount = 0\n        while section < numberOfSections {\n            itemsCount += numberOfItems(inSection: section)\n            section += 1\n        }\n        return itemsCount\n    }\n\n    /// SwifterSwift: IndexPath for last item in section.\n    ///\n    /// - Parameter section: section to get last item in.\n    /// - Returns: optional last indexPath for last item in section (if applicable).\n    func indexPathForLastItem(inSection section: Int) -> IndexPath? {\n        guard section >= 0 else {\n            return nil\n        }\n        guard section < numberOfSections else {\n            return nil\n        }\n        guard numberOfItems(inSection: section) > 0 else {\n            return IndexPath(item: 0, section: section)\n        }\n        return IndexPath(item: numberOfItems(inSection: section) - 1, section: section)\n    }\n\n    /// SwifterSwift: Reload data with a completion handler.\n    ///\n    /// - Parameter completion: completion handler to run after reloadData finishes.\n    func reloadData(_ completion: @escaping () -> Void) {\n        UIView.animate(withDuration: 0, animations: {\n            self.reloadData()\n        }, completion: { _ in\n            completion()\n        })\n    }\n\n    /// SwifterSwift: Dequeue reusable UICollectionViewCell using class name.\n    ///\n    /// - Parameters:\n    ///   - name: UICollectionViewCell type.\n    ///   - indexPath: location of cell in collectionView.\n    /// - Returns: UICollectionViewCell object with associated class name.\n    func dequeueReusableCell<T: UICollectionViewCell>(withClass name: T.Type, for indexPath: IndexPath) -> T {\n        guard let cell = dequeueReusableCell(withReuseIdentifier: String(describing: name), for: indexPath) as? T else {\n            fatalError(\"Couldn't find UICollectionViewCell for \\(String(describing: name)), make sure the cell is registered with collection view\")\n        }\n        return cell\n    }\n\n    /// SwifterSwift: Dequeue reusable UICollectionReusableView using class name.\n    ///\n    /// - Parameters:\n    ///   - kind: the kind of supplementary view to retrieve. This value is defined by the layout object.\n    ///   - name: UICollectionReusableView type.\n    ///   - indexPath: location of cell in collectionView.\n    /// - Returns: UICollectionReusableView object with associated class name.\n    func dequeueReusableSupplementaryView<T: UICollectionReusableView>(ofKind kind: String, withClass name: T.Type, for indexPath: IndexPath) -> T {\n        guard let cell = dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: String(describing: name), for: indexPath) as? T else {\n            fatalError(\"Couldn't find UICollectionReusableView for \\(String(describing: name)), make sure the view is registered with collection view\")\n        }\n        return cell\n    }\n\n    /// SwifterSwift: Register UICollectionReusableView using class name.\n    ///\n    /// - Parameters:\n    ///   - kind: the kind of supplementary view to retrieve. This value is defined by the layout object.\n    ///   - name: UICollectionReusableView type.\n    func register<T: UICollectionReusableView>(supplementaryViewOfKind kind: String, withClass name: T.Type) {\n        register(T.self, forSupplementaryViewOfKind: kind, withReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UICollectionViewCell using class name.\n    ///\n    /// - Parameters:\n    ///   - nib: Nib file used to create the collectionView cell.\n    ///   - name: UICollectionViewCell type.\n    func register<T: UICollectionViewCell>(nib: UINib?, forCellWithClass name: T.Type) {\n        register(nib, forCellWithReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UICollectionViewCell using class name.\n    ///\n    /// - Parameter name: UICollectionViewCell type.\n    func register<T: UICollectionViewCell>(cellWithClass name: T.Type) {\n        register(T.self, forCellWithReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UICollectionReusableView using class name.\n    ///\n    /// - Parameters:\n    ///   - nib: Nib file used to create the reusable view.\n    ///   - kind: the kind of supplementary view to retrieve. This value is defined by the layout object.\n    ///   - name: UICollectionReusableView type.\n    func register<T: UICollectionReusableView>(nib: UINib?, forSupplementaryViewOfKind kind: String, withClass name: T.Type) {\n        register(nib, forSupplementaryViewOfKind: kind, withReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UICollectionViewCell with .xib file using only its corresponding class.\n    ///               Assumes that the .xib filename and cell class has the same name.\n    ///\n    /// - Parameters:\n    ///   - name: UICollectionViewCell type.\n    ///   - bundleClass: Class in which the Bundle instance will be based on.\n    func register<T: UICollectionViewCell>(nibWithCellClass name: T.Type, at bundleClass: AnyClass? = nil) {\n        let identifier = String(describing: name)\n        var bundle: Bundle?\n\n        if let bundleName = bundleClass {\n            bundle = Bundle(for: bundleName)\n        }\n\n        register(UINib(nibName: identifier, bundle: bundle), forCellWithReuseIdentifier: identifier)\n    }\n\n    /// SwifterSwift: Safely scroll to possibly invalid IndexPath\n    ///\n    /// - Parameters:\n    ///   - indexPath: Target IndexPath to scroll to\n    ///   - scrollPosition: Scroll position\n    ///   - animated: Whether to animate or not\n    func safeScrollToItem(at indexPath: IndexPath, at scrollPosition: UICollectionView.ScrollPosition, animated: Bool) {\n        guard indexPath.item >= 0 &&\n            indexPath.section >= 0 &&\n            indexPath.section < numberOfSections &&\n            indexPath.item < numberOfItems(inSection: indexPath.section) else {\n                return\n        }\n        scrollToItem(at: indexPath, at: scrollPosition, animated: animated)\n    }\n\n    /// SwifterSwift: Check whether IndexPath is valid within the CollectionView\n    ///\n    /// - Parameter indexPath: An IndexPath to check\n    /// - Returns: Boolean value for valid or invalid IndexPath\n    func isValidIndexPath(_ indexPath: IndexPath) -> Bool {\n        return indexPath.section >= 0 &&\n            indexPath.item >= 0 &&\n            indexPath.section < numberOfSections &&\n            indexPath.item < numberOfItems(inSection: indexPath.section)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIColorExtensions.swift",
    "content": "//\n//  UIColorExtensions.swift\n//  SwifterSwift\n//\n//  Created by Max Haertwig on 10/06/19.\n//  Copyright © 2019 SwifterSwift\n//\n\n#if canImport(UIKit)\nimport UIKit\n\npublic extension UIColor {\n\n    #if !os(watchOS)\n    /// SwifterSwift: Create a UIColor with different colors for light and dark mode.\n    ///\n    /// - Parameters:\n    ///     - light: Color to use in light/unspecified mode.\n    ///     - dark: Color to use in dark mode.\n    @available(iOS 13.0, tvOS 13.0, *)\n    convenience init(light: UIColor, dark: UIColor) {\n        self.init(dynamicProvider: { $0.userInterfaceStyle == .dark ? dark : light })\n    }\n    #endif\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIDatePickerExtensions.swift",
    "content": "//\n//  UIDatePickerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 12/9/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(UIKit) && os(iOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UIDatePicker {\n\n    /// SwifterSwift: Text color of UIDatePicker.\n    var textColor: UIColor? {\n        set {\n            setValue(newValue, forKeyPath: \"textColor\")\n        }\n        get {\n            return value(forKeyPath: \"textColor\") as? UIColor\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIFontExtensions.swift",
    "content": "//\n//  UIFontExtensions.swift\n//  SwifterSwift\n//\n//  Created by Benjamin Meyer on 9/16/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(UIKit)\nimport UIKit\n\n// MARK: - Properties\npublic extension UIFont {\n\n    /// SwifterSwift: Font as bold font\n    var bold: UIFont {\n        return UIFont(descriptor: fontDescriptor.withSymbolicTraits(.traitBold)!, size: 0)\n    }\n\n    /// SwifterSwift: Font as italic font\n    var italic: UIFont {\n        return UIFont(descriptor: fontDescriptor.withSymbolicTraits(.traitItalic)!, size: 0)\n    }\n\n    /// SwifterSwift: Font as monospaced font\n    ///\n    ///     UIFont.preferredFont(forTextStyle: .body).monospaced\n    ///\n    var monospaced: UIFont {\n        let settings = [[UIFontDescriptor.FeatureKey.featureIdentifier: kNumberSpacingType, UIFontDescriptor.FeatureKey.typeIdentifier: kMonospacedNumbersSelector]]\n\n        let attributes = [UIFontDescriptor.AttributeName.featureSettings: settings]\n        let newDescriptor = fontDescriptor.addingAttributes(attributes)\n        return UIFont(descriptor: newDescriptor, size: 0)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIGestureRecognizerExtensions.swift",
    "content": "//\n//  UIGestureRecognizerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Morgan Dock on 4/21/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UIGestureRecognizer {\n\n    /// SwifterSwift: Remove Gesture Recognizer from its view.\n    func removeFromView() {\n        view?.removeGestureRecognizer(self)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIImageExtensions.swift",
    "content": "//\n//  UIImageExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/6/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit)\nimport UIKit\n\n// MARK: - Properties\npublic extension UIImage {\n\n    /// SwifterSwift: Size in bytes of UIImage\n    var bytesSize: Int {\n        return jpegData(compressionQuality: 1)?.count ?? 0\n    }\n\n    /// SwifterSwift: Size in kilo bytes of UIImage\n    var kilobytesSize: Int {\n        return (jpegData(compressionQuality: 1)?.count ?? 0) / 1024\n    }\n\n    /// SwifterSwift: UIImage with .alwaysOriginal rendering mode.\n    var original: UIImage {\n        return withRenderingMode(.alwaysOriginal)\n    }\n\n    /// SwifterSwift: UIImage with .alwaysTemplate rendering mode.\n    var template: UIImage {\n        return withRenderingMode(.alwaysTemplate)\n    }\n\n}\n\n// MARK: - Methods\npublic extension UIImage {\n\n    /// SwifterSwift: Compressed UIImage from original UIImage.\n    ///\n    /// - Parameter quality: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality), (default is 0.5).\n    /// - Returns: optional UIImage (if applicable).\n    func compressed(quality: CGFloat = 0.5) -> UIImage? {\n        guard let data = jpegData(compressionQuality: quality) else { return nil }\n        return UIImage(data: data)\n    }\n\n    /// SwifterSwift: Compressed UIImage data from original UIImage.\n    ///\n    /// - Parameter quality: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality), (default is 0.5).\n    /// - Returns: optional Data (if applicable).\n    func compressedData(quality: CGFloat = 0.5) -> Data? {\n        return jpegData(compressionQuality: quality)\n    }\n\n    /// SwifterSwift: UIImage Cropped to CGRect.\n    ///\n    /// - Parameter rect: CGRect to crop UIImage to.\n    /// - Returns: cropped UIImage\n    func cropped(to rect: CGRect) -> UIImage {\n        guard rect.size.width <= size.width && rect.size.height <= size.height else { return self }\n        let scaledRect = rect.applying(CGAffineTransform(scaleX: scale, y: scale))\n        guard let image = cgImage?.cropping(to: scaledRect) else { return self }\n        return UIImage(cgImage: image, scale: scale, orientation: imageOrientation)\n    }\n\n    /// SwifterSwift: UIImage scaled to height with respect to aspect ratio.\n    ///\n    /// - Parameters:\n    ///   - toHeight: new height.\n    ///   - opaque: flag indicating whether the bitmap is opaque.\n    /// - Returns: optional scaled UIImage (if applicable).\n    func scaled(toHeight: CGFloat, opaque: Bool = false) -> UIImage? {\n        let scale = toHeight / size.height\n        let newWidth = size.width * scale\n        UIGraphicsBeginImageContextWithOptions(CGSize(width: newWidth, height: toHeight), opaque, self.scale)\n        draw(in: CGRect(x: 0, y: 0, width: newWidth, height: toHeight))\n        let newImage = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return newImage\n    }\n\n    /// SwifterSwift: UIImage scaled to width with respect to aspect ratio.\n    ///\n    /// - Parameters:\n    ///   - toWidth: new width.\n    ///   - opaque: flag indicating whether the bitmap is opaque.\n    /// - Returns: optional scaled UIImage (if applicable).\n    func scaled(toWidth: CGFloat, opaque: Bool = false) -> UIImage? {\n        let scale = toWidth / size.width\n        let newHeight = size.height * scale\n        UIGraphicsBeginImageContextWithOptions(CGSize(width: toWidth, height: newHeight), opaque, self.scale)\n        draw(in: CGRect(x: 0, y: 0, width: toWidth, height: newHeight))\n        let newImage = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return newImage\n    }\n\n    /// SwifterSwift: Creates a copy of the receiver rotated by the given angle.\n    ///\n    ///     // Rotate the image by 180°\n    ///     image.rotated(by: Measurement(value: 180, unit: .degrees))\n    ///\n    /// - Parameter angle: The angle measurement by which to rotate the image.\n    /// - Returns: A new image rotated by the given angle.\n    @available(tvOS 10.0, watchOS 3.0, *)\n    func rotated(by angle: Measurement<UnitAngle>) -> UIImage? {\n        let radians = CGFloat(angle.converted(to: .radians).value)\n\n        let destRect = CGRect(origin: .zero, size: size)\n            .applying(CGAffineTransform(rotationAngle: radians))\n        let roundedDestRect = CGRect(x: destRect.origin.x.rounded(),\n                                     y: destRect.origin.y.rounded(),\n                                     width: destRect.width.rounded(),\n                                     height: destRect.height.rounded())\n\n        UIGraphicsBeginImageContext(roundedDestRect.size)\n        guard let contextRef = UIGraphicsGetCurrentContext() else { return nil }\n\n        contextRef.translateBy(x: roundedDestRect.width / 2, y: roundedDestRect.height / 2)\n        contextRef.rotate(by: radians)\n\n        draw(in: CGRect(origin: CGPoint(x: -size.width / 2,\n                                        y: -size.height / 2),\n                        size: size))\n\n        let newImage = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return newImage\n    }\n\n    /// SwifterSwift: Creates a copy of the receiver rotated by the given angle (in radians).\n    ///\n    ///     // Rotate the image by 180°\n    ///     image.rotated(by: .pi)\n    ///\n    /// - Parameter radians: The angle, in radians, by which to rotate the image.\n    /// - Returns: A new image rotated by the given angle.\n    func rotated(by radians: CGFloat) -> UIImage? {\n        let destRect = CGRect(origin: .zero, size: size)\n            .applying(CGAffineTransform(rotationAngle: radians))\n        let roundedDestRect = CGRect(x: destRect.origin.x.rounded(),\n                                     y: destRect.origin.y.rounded(),\n                                     width: destRect.width.rounded(),\n                                     height: destRect.height.rounded())\n\n        UIGraphicsBeginImageContext(roundedDestRect.size)\n        guard let contextRef = UIGraphicsGetCurrentContext() else { return nil }\n\n        contextRef.translateBy(x: roundedDestRect.width / 2, y: roundedDestRect.height / 2)\n        contextRef.rotate(by: radians)\n\n        draw(in: CGRect(origin: CGPoint(x: -size.width / 2,\n                                        y: -size.height / 2),\n                        size: size))\n\n        let newImage = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return newImage\n    }\n\n    /// SwifterSwift: UIImage filled with color\n    ///\n    /// - Parameter color: color to fill image with.\n    /// - Returns: UIImage filled with given color.\n    func filled(withColor color: UIColor) -> UIImage {\n\n        #if !os(watchOS)\n        if #available(tvOS 10.0, *) {\n            let format = UIGraphicsImageRendererFormat()\n            format.scale = scale\n            let renderer = UIGraphicsImageRenderer(size: size, format: format)\n            return renderer.image { context in\n                color.setFill()\n                context.fill(CGRect(origin: .zero, size: size))\n            }\n        }\n        #endif\n\n        UIGraphicsBeginImageContextWithOptions(size, false, scale)\n        color.setFill()\n        guard let context = UIGraphicsGetCurrentContext() else { return self }\n\n        context.translateBy(x: 0, y: size.height)\n        context.scaleBy(x: 1.0, y: -1.0)\n        context.setBlendMode(CGBlendMode.normal)\n\n        let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)\n        guard let mask = cgImage else { return self }\n        context.clip(to: rect, mask: mask)\n        context.fill(rect)\n\n        let newImage = UIGraphicsGetImageFromCurrentImageContext()!\n        UIGraphicsEndImageContext()\n        return newImage\n    }\n\n    /// SwifterSwift: UIImage tinted with color\n    ///\n    /// - Parameters:\n    ///   - color: color to tint image with.\n    ///   - blendMode: how to blend the tint\n    /// - Returns: UIImage tinted with given color.\n    func tint(_ color: UIColor, blendMode: CGBlendMode, alpha: CGFloat = 1.0) -> UIImage {\n        let drawRect = CGRect(origin: .zero, size: size)\n\n        #if !os(watchOS)\n        if #available(tvOS 10.0, *) {\n            let format = UIGraphicsImageRendererFormat()\n            format.scale = scale\n            return UIGraphicsImageRenderer(size: size, format: format).image { context in\n                color.setFill()\n                context.fill(drawRect)\n                draw(in: drawRect, blendMode: blendMode, alpha: alpha)\n            }\n        }\n        #endif\n\n        UIGraphicsBeginImageContextWithOptions(size, false, scale)\n        defer {\n            UIGraphicsEndImageContext()\n        }\n        let context = UIGraphicsGetCurrentContext()\n        color.setFill()\n        context?.fill(drawRect)\n        draw(in: drawRect, blendMode: blendMode, alpha: alpha)\n        return UIGraphicsGetImageFromCurrentImageContext()!\n    }\n\n    /// SwifterSwift: UImage with background color\n    ///\n    /// - Parameters:\n    ///   - backgroundColor: Color to use as background color\n    /// - Returns: UIImage with a background color that is visible where alpha < 1\n    func withBackgroundColor(_ backgroundColor: UIColor) -> UIImage {\n\n        #if !os(watchOS)\n        if #available(tvOS 10.0, *) {\n            let format = UIGraphicsImageRendererFormat()\n            format.scale = scale\n            return UIGraphicsImageRenderer(size: size, format: format).image { context in\n                backgroundColor.setFill()\n                context.fill(context.format.bounds)\n                draw(at: .zero)\n            }\n        }\n        #endif\n\n        UIGraphicsBeginImageContextWithOptions(size, false, scale)\n        defer { UIGraphicsEndImageContext() }\n\n        backgroundColor.setFill()\n        UIRectFill(CGRect(origin: .zero, size: size))\n        draw(at: .zero)\n\n        return UIGraphicsGetImageFromCurrentImageContext()!\n    }\n\n    /// SwifterSwift: UIImage with rounded corners\n    ///\n    /// - Parameters:\n    ///   - radius: corner radius (optional), resulting image will be round if unspecified\n    /// - Returns: UIImage with all corners rounded\n    func withRoundedCorners(radius: CGFloat? = nil) -> UIImage? {\n        let maxRadius = min(size.width, size.height) / 2\n        let cornerRadius: CGFloat\n        if let radius = radius, radius > 0 && radius <= maxRadius {\n            cornerRadius = radius\n        } else {\n            cornerRadius = maxRadius\n        }\n\n        UIGraphicsBeginImageContextWithOptions(size, false, scale)\n\n        let rect = CGRect(origin: .zero, size: size)\n        UIBezierPath(roundedRect: rect, cornerRadius: cornerRadius).addClip()\n        draw(in: rect)\n\n        let image = UIGraphicsGetImageFromCurrentImageContext()\n        UIGraphicsEndImageContext()\n        return image\n    }\n\n    /// SwifterSwift: Base 64 encoded PNG data of the image.\n    ///\n    /// - returns: Base 64 encoded PNG data of the image as a String.\n    func pngBase64String() -> String? {\n        return pngData()?.base64EncodedString()\n    }\n\n    /// SwifterSwift: Base 64 encoded JPEG data of the image.\n    ///\n    /// - parameter compressionQuality: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality).\n    /// - returns: Base 64 encoded JPEG data of the image as a String.\n    func jpegBase64String(compressionQuality: CGFloat) -> String? {\n        return jpegData(compressionQuality: compressionQuality)?.base64EncodedString()\n    }\n\n}\n\n// MARK: - Initializers\npublic extension UIImage {\n\n    /// SwifterSwift: Create UIImage from color and size.\n    ///\n    /// - Parameters:\n    ///   - color: image fill color.\n    ///   - size: image size.\n    convenience init(color: UIColor, size: CGSize) {\n        UIGraphicsBeginImageContextWithOptions(size, false, 1)\n\n        defer {\n            UIGraphicsEndImageContext()\n        }\n\n        color.setFill()\n        UIRectFill(CGRect(origin: .zero, size: size))\n\n        guard let aCgImage = UIGraphicsGetImageFromCurrentImageContext()?.cgImage else {\n            self.init()\n            return\n        }\n\n        self.init(cgImage: aCgImage)\n    }\n\n    /// SwifterSwift: Create a new image from a base 64 string.\n    ///\n    /// - Parameters:\n    ///   - base64String: a base-64 `String`, representing the image\n    ///   - scale: The scale factor to assume when interpreting the image data created from the base-64 string. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property.\n    convenience init?(base64String: String, scale: CGFloat = 1.0) {\n        guard let data = Data(base64Encoded: base64String) else { return nil }\n        self.init(data: data, scale: scale)\n    }\n\n    /// SwifterSwift: Create a new image from a URL\n    ///\n    /// - Important:\n    ///   Use this method to convert data:// URLs to UIImage objects.\n    ///   Don't use this synchronous initializer to request network-based URLs. For network-based URLs, this method can block the current thread for tens of seconds on a slow network, resulting in a poor user experience, and in iOS, may cause your app to be terminated.\n    ///   Instead, for non-file URLs, consider using this in an asynchronous way, using `dataTask(with:completionHandler:)` method of the URLSession class or a library such as `AlamofireImage`, `Kingfisher`, `SDWebImage`, or others to perform asynchronous network image loading.\n    /// - Parameters:\n    ///   - url: a `URL`, representing the image location\n    ///   - scale: The scale factor to assume when interpreting the image data created from the URL. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property.\n    convenience init?(url: URL, scale: CGFloat = 1.0) throws {\n        let data = try Data(contentsOf: url)\n        self.init(data: data, scale: scale)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIImageViewExtensions.swift",
    "content": "//\n//  UIImageViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/25/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UIImageView {\n\n    /// SwifterSwift: Set image from a URL.\n    ///\n    /// - Parameters:\n    ///   - url: URL of image.\n    ///   - contentMode: imageView content mode (default is .scaleAspectFit).\n    ///   - placeHolder: optional placeholder image\n    ///   - completionHandler: optional completion handler to run when download finishs (default is nil).\n    func download(\n        from url: URL,\n        contentMode: UIView.ContentMode = .scaleAspectFit,\n        placeholder: UIImage? = nil,\n        completionHandler: ((UIImage?) -> Void)? = nil) {\n\n        image = placeholder\n        self.contentMode = contentMode\n        URLSession.shared.dataTask(with: url) { (data, response, _) in\n            guard\n                let httpURLResponse = response as? HTTPURLResponse, httpURLResponse.statusCode == 200,\n                let mimeType = response?.mimeType, mimeType.hasPrefix(\"image\"),\n                let data = data,\n                let image = UIImage(data: data)\n                else {\n                    completionHandler?(nil)\n                    return\n            }\n            DispatchQueue.main.async { [unowned self] in\n                self.image = image\n                completionHandler?(image)\n            }\n            }.resume()\n    }\n\n    /// SwifterSwift: Make image view blurry\n    ///\n    /// - Parameter style: UIBlurEffectStyle (default is .light).\n    func blur(withStyle style: UIBlurEffect.Style = .light) {\n        let blurEffect = UIBlurEffect(style: style)\n        let blurEffectView = UIVisualEffectView(effect: blurEffect)\n        blurEffectView.frame = bounds\n        blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] // for supporting device rotation\n        addSubview(blurEffectView)\n        clipsToBounds = true\n    }\n\n    /// SwifterSwift: Blurred version of an image view\n    ///\n    /// - Parameter style: UIBlurEffectStyle (default is .light).\n    /// - Returns: blurred version of self.\n    func blurred(withStyle style: UIBlurEffect.Style = .light) -> UIImageView {\n        let imgView = self\n        imgView.blur(withStyle: style)\n        return imgView\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UILabelExtensions.swift",
    "content": "//\n//  UILabelExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/23/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UILabel {\n\n    /// SwifterSwift: Initialize a UILabel with text\n    convenience init(text: String?) {\n        self.init()\n        self.text = text\n    }\n\n    /// SwifterSwift: Initialize a UILabel with a text and font style.\n    ///\n    /// - Parameters:\n    ///   - text: the label's text.\n    ///   - style: the text style of the label, used to determine which font should be used.\n    convenience init(text: String, style: UIFont.TextStyle) {\n        self.init()\n        font = UIFont.preferredFont(forTextStyle: style)\n        self.text = text\n    }\n\n    /// SwifterSwift: Required height for a label\n    var requiredHeight: CGFloat {\n        let label = UILabel(frame: CGRect(x: 0, y: 0, width: frame.width, height: CGFloat.greatestFiniteMagnitude))\n        label.numberOfLines = 0\n        label.lineBreakMode = NSLineBreakMode.byWordWrapping\n        label.font = font\n        label.text = text\n        label.attributedText = attributedText\n        label.sizeToFit()\n        return label.frame.height\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UILayoutPriorityExtensions.swift",
    "content": "//\n//  UILayoutPriorityExtensions.swift\n//  SwifterSwift\n//\n//  Created by diamantidis on 8/19/18.\n//  Copyright © 2018 SwifterSwift. All rights reserved.\n//\n\n#if os(iOS) || os(tvOS)\nimport UIKit\n\nextension UILayoutPriority: ExpressibleByFloatLiteral, ExpressibleByIntegerLiteral {\n\n    // MARK: - Initializers\n\n    /// SwifterSwift: Initialize `UILayoutPriority` with a float literal\n    ///\n    ///     constraint.priority = 0.5\n    ///\n    /// - Parameter value: The float value of the constraint\n    public init(floatLiteral value: Float) {\n        self.init(rawValue: value)\n    }\n\n    /// SwifterSwift: Initialize `UILayoutPriority` with an integer literal\n    ///\n    ///     constraint.priority = 5\n    ///\n    /// - Parameter value: The integer value of the constraint\n    public init(integerLiteral value: Int) {\n        self.init(rawValue: Float(value))\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UINavigationBarExtensions.swift",
    "content": "//\n//  UINavigationBarExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/22/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UINavigationBar {\n\n    /// SwifterSwift: Set Navigation Bar title, title color and font.\n    ///\n    /// - Parameters:\n    ///   - font: title font\n    ///   - color: title text color (default is .black).\n    func setTitleFont(_ font: UIFont, color: UIColor = .black) {\n        var attrs = [NSAttributedString.Key: Any]()\n        attrs[.font] = font\n        attrs[.foregroundColor] = color\n        titleTextAttributes = attrs\n    }\n\n    /// SwifterSwift: Make navigation bar transparent.\n    ///\n    /// - Parameter tint: tint color (default is .white).\n    func makeTransparent(withTint tint: UIColor = .white) {\n        isTranslucent = true\n        backgroundColor = .clear\n        barTintColor = .clear\n        setBackgroundImage(UIImage(), for: .default)\n        tintColor = tint\n        titleTextAttributes = [.foregroundColor: tint]\n        shadowImage = UIImage()\n    }\n\n    /// SwifterSwift: Set navigationBar background and text colors\n    ///\n    /// - Parameters:\n    ///   - background: backgound color\n    ///   - text: text color\n    func setColors(background: UIColor, text: UIColor) {\n        isTranslucent = false\n        backgroundColor = background\n        barTintColor = background\n        setBackgroundImage(UIImage(), for: .default)\n        tintColor = text\n        titleTextAttributes = [.foregroundColor: text]\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UINavigationControllerExtensions.swift",
    "content": "//\n//  UINavigationControllerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/6/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UINavigationController {\n\n    /// SwifterSwift: Pop ViewController with completion handler.\n    ///\n    /// - Parameters:\n    ///   - animated: Set this value to true to animate the transition (default is true).\n    ///   - completion: optional completion handler (default is nil).\n    func popViewController(animated: Bool = true, _ completion: (() -> Void)? = nil) {\n        // https://github.com/cotkjaer/UserInterface/blob/master/UserInterface/UIViewController.swift\n        CATransaction.begin()\n        CATransaction.setCompletionBlock(completion)\n        popViewController(animated: animated)\n        CATransaction.commit()\n    }\n\n    /// SwifterSwift: Push ViewController with completion handler.\n    ///\n    /// - Parameters:\n    ///   - viewController: viewController to push.\n    ///   - completion: optional completion handler (default is nil).\n    func pushViewController(_ viewController: UIViewController, completion: (() -> Void)? = nil) {\n        // https://github.com/cotkjaer/UserInterface/blob/master/UserInterface/UIViewController.swift\n        CATransaction.begin()\n        CATransaction.setCompletionBlock(completion)\n        pushViewController(viewController, animated: true)\n        CATransaction.commit()\n    }\n\n    /// SwifterSwift: Make navigation controller's navigation bar transparent.\n    ///\n    /// - Parameter tint: tint color (default is .white).\n    func makeTransparent(withTint tint: UIColor = .white) {\n        navigationBar.setBackgroundImage(UIImage(), for: .default)\n        navigationBar.shadowImage = UIImage()\n        navigationBar.isTranslucent = true\n        navigationBar.tintColor = tint\n        navigationBar.titleTextAttributes = [.foregroundColor: tint]\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UINavigationItemExtensions.swift",
    "content": "//\n//  UINavigationItemExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/28/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UINavigationItem {\n\n    /// SwifterSwift: Replace title label with an image in navigation item.\n    ///\n    /// - Parameter image: UIImage to replace title with.\n    func replaceTitle(with image: UIImage) {\n        let logoImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 30))\n        logoImageView.contentMode = .scaleAspectFit\n        logoImageView.image = image\n        titleView = logoImageView\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIRefreshControlExtensions.swift",
    "content": "//\n//  UIRefreshControlExtensions.swift\n//  SwifterSwift\n//\n//  Created by ratul sharker on 7/24/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if os(iOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UIRefreshControl {\n\n    /// SwifterSwift: Programatically begin refresh control inside of UITableView.\n    ///\n    /// - Parameters:\n    ///   - tableView: UITableView instance, inside which the refresh control is contained.\n    ///   - animated: Boolean, indicates that is the content offset changing should be animated or not.\n    ///   - sendAction: Boolean, indicates that should it fire sendActions method for valueChanged UIControlEvents\n    func beginRefreshing(in tableView: UITableView, animated: Bool, sendAction: Bool = false) {\n        // https://stackoverflow.com/questions/14718850/14719658#14719658\n        assert(superview == tableView, \"Refresh control does not belong to the receiving table view\")\n\n        beginRefreshing()\n        let offsetPoint = CGPoint(x: 0, y: -frame.height)\n        tableView.setContentOffset(offsetPoint, animated: animated)\n\n        if sendAction {\n            sendActions(for: .valueChanged)\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIScrollViewExtensions.swift",
    "content": "//\n//  UIScrollViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by camila oliveira on 22/04/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UIScrollView {\n\n    /// SwifterSwift: Takes a snapshot of an entire ScrollView\n    ///\n    ///    AnySubclassOfUIScroolView().snapshot\n    ///    UITableView().snapshot\n    ///\n    /// - Returns: Snapshot as UIimage for rendered ScrollView\n    var snapshot: UIImage? {\n        // Original Source: https://gist.github.com/thestoics/1204051\n        UIGraphicsBeginImageContextWithOptions(contentSize, false, 0)\n        defer {\n            UIGraphicsEndImageContext()\n        }\n        guard let context = UIGraphicsGetCurrentContext() else { return nil }\n        let previousFrame = frame\n        frame = CGRect(origin: frame.origin, size: contentSize)\n        layer.render(in: context)\n        frame = previousFrame\n        return UIGraphicsGetImageFromCurrentImageContext()\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UISearchBarExtensions.swift",
    "content": "//\n//  UISearchBarExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/23/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && os(iOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UISearchBar {\n\n    /// SwifterSwift: Text field inside search bar (if applicable).\n    var textField: UITextField? {\n        if #available(iOS 13.0, *) {\n            return searchTextField\n        }\n        let subViews = subviews.flatMap { $0.subviews }\n        guard let textField = (subViews.filter { $0 is UITextField }).first as? UITextField else {\n            return nil\n        }\n        return textField\n    }\n\n    /// SwifterSwift: Text with no spaces or new lines in beginning and end (if applicable).\n    var trimmedText: String? {\n        return text?.trimmingCharacters(in: .whitespacesAndNewlines)\n    }\n\n}\n\n// MARK: - Methods\npublic extension UISearchBar {\n\n    /// SwifterSwift: Clear text.\n    func clear() {\n        text = \"\"\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UISegmentedControlExtensions.swift",
    "content": "//\n//  UISegmentedControlExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/28/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UISegmentedControl {\n\n    /// SwifterSwift: Segments titles.\n    var segmentTitles: [String] {\n        get {\n            let range = 0..<numberOfSegments\n            return range.compactMap { titleForSegment(at: $0) }\n        }\n        set {\n            removeAllSegments()\n            for (index, title) in newValue.enumerated() {\n                insertSegment(withTitle: title, at: index, animated: false)\n            }\n        }\n    }\n\n    /// SwifterSwift: Segments images.\n    var segmentImages: [UIImage] {\n        get {\n            let range = 0..<numberOfSegments\n            return range.compactMap { imageForSegment(at: $0) }\n        }\n        set {\n            removeAllSegments()\n            for (index, image) in newValue.enumerated() {\n                insertSegment(with: image, at: index, animated: false)\n            }\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UISliderExtensions.swift",
    "content": "//\n//  UISliderExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/28/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && os(iOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UISlider {\n\n    /// SwifterSwift: Set slide bar value with completion handler.\n    ///\n    /// - Parameters:\n    ///   - value: slider value.\n    ///   - animated: set true to animate value change (default is true).\n    ///   - duration: animation duration in seconds (default is 1 second).\n    ///   - completion: an optional completion handler to run after value is changed (default is nil)\n    func setValue(_ value: Float, animated: Bool = true, duration: TimeInterval = 1, completion: (() -> Void)? = nil) {\n        if animated {\n            UIView.animate(withDuration: duration, animations: {\n                self.setValue(value, animated: true)\n            }, completion: { _ in\n                completion?()\n            })\n        } else {\n            setValue(value, animated: false)\n            completion?()\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIStackViewExtensions.swift",
    "content": "//\n//  UIStackViewExtensions.swift\n//  SwifterSwift-iOS\n//\n//  Created by Benjamin Meyer on 2/18/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Initializers\npublic extension UIStackView {\n\n    /// SwifterSwift: Initialize an UIStackView with an array of UIView and common parameters.\n    ///\n    ///     let stackView = UIStackView(arrangedSubviews: [UIView(), UIView()], axis: .vertical)\n    ///\n    /// - Parameters:\n    ///   - arrangedSubviews: The UIViews to add to the stack.\n    ///   - axis: The axis along which the arranged views are laid out.\n    ///   - spacing: The distance in points between the adjacent edges of the stack view’s arranged views.(default: 0.0)\n    ///   - alignment: The alignment of the arranged subviews perpendicular to the stack view’s axis. (default: .fill)\n    ///   - distribution: The distribution of the arranged views along the stack view’s axis.(default: .fill)\n    convenience init(\n        arrangedSubviews: [UIView],\n        axis: NSLayoutConstraint.Axis,\n        spacing: CGFloat = 0.0,\n        alignment: UIStackView.Alignment = .fill,\n        distribution: UIStackView.Distribution = .fill) {\n\n        self.init(arrangedSubviews: arrangedSubviews)\n        self.axis = axis\n        self.spacing = spacing\n        self.alignment = alignment\n        self.distribution = distribution\n    }\n\n    /// SwifterSwift: Adds array of views to the end of the arrangedSubviews array.\n    ///\n    /// - Parameter views: views array.\n    func addArrangedSubviews(_ views: [UIView]) {\n        for view in views {\n            addArrangedSubview(view)\n        }\n    }\n\n    /// SwifterSwift: Removes all views in stack’s array of arranged subviews.\n    func removeArrangedSubviews() {\n        for view in arrangedSubviews {\n            removeArrangedSubview(view)\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIStoryboardExtensions.swift",
    "content": "//\n//  UIStoryboardExtensions.swift\n//  SwifterSwift\n//\n//  Created by Steven on 2/6/17.\n//  Copyright © 2017 SwifterSwift\n//\n\n#if canImport(UIKit)  && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UIStoryboard {\n\n    /// SwifterSwift: Get main storyboard for application\n    static var main: UIStoryboard? {\n        let bundle = Bundle.main\n        guard let name = bundle.object(forInfoDictionaryKey: \"UIMainStoryboardFile\") as? String else { return nil }\n        return UIStoryboard(name: name, bundle: bundle)\n    }\n\n    /// SwifterSwift: Instantiate a UIViewController using its class name\n    ///\n    /// - Parameter name: UIViewController type\n    /// - Returns: The view controller corresponding to specified class name\n    func instantiateViewController<T: UIViewController>(withClass name: T.Type) -> T? {\n        return instantiateViewController(withIdentifier: String(describing: name)) as? T\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UISwitchExtensions.swift",
    "content": "//\n//  UISwitchExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 08/12/2016.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit)  && os(iOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UISwitch {\n\n    /// SwifterSwift: Toggle a UISwitch\n    ///\n    /// - Parameter animated: set true to animate the change (default is true)\n    func toggle(animated: Bool = true) {\n        setOn(!isOn, animated: animated)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UITabBarExtensions.swift",
    "content": "//\n//  UITabBarExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/28/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UITabBar {\n\n    /// SwifterSwift: Set tabBar colors.\n    ///\n    /// - Parameters:\n    ///   - background: background color.\n    ///   - selectedBackground: background color for selected tab.\n    ///   - item: icon tint color for items.\n    ///   - selectedItem: icon tint color for item.\n    func setColors(\n        background: UIColor? = nil,\n        selectedBackground: UIColor? = nil,\n        item: UIColor? = nil,\n        selectedItem: UIColor? = nil) {\n\n        // background\n        barTintColor = background ?? barTintColor\n\n        // selectedItem\n        tintColor = selectedItem ?? tintColor\n        // shadowImage = UIImage()\n        backgroundImage = UIImage()\n        isTranslucent = false\n\n        // selectedBackgoundColor\n        guard let barItems = items else {\n            return\n        }\n\n        if let selectedbg = selectedBackground {\n            let rect = CGSize(width: frame.width/CGFloat(barItems.count), height: frame.height)\n            selectionIndicatorImage = { (color: UIColor, size: CGSize) -> UIImage in\n                UIGraphicsBeginImageContextWithOptions(size, false, 1)\n                color.setFill()\n                UIRectFill(CGRect(x: 0, y: 0, width: size.width, height: size.height))\n                guard let image = UIGraphicsGetImageFromCurrentImageContext() else { return UIImage() }\n                UIGraphicsEndImageContext()\n                guard let aCgImage = image.cgImage else { return UIImage() }\n                return UIImage(cgImage: aCgImage)\n            }(selectedbg, rect)\n        }\n\n        if let itemColor = item {\n            for barItem in barItems as [UITabBarItem] {\n                // item\n                guard let image = barItem.image else { continue }\n\n                barItem.image = { (image: UIImage, color: UIColor) -> UIImage in\n                    UIGraphicsBeginImageContextWithOptions(image.size, false, image.scale)\n                    color.setFill()\n                    guard let context = UIGraphicsGetCurrentContext() else {\n                        return image\n                    }\n\n                    context.translateBy(x: 0, y: image.size.height)\n                    context.scaleBy(x: 1.0, y: -1.0)\n                    context.setBlendMode(CGBlendMode.normal)\n\n                    let rect = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)\n                    guard let mask = image.cgImage else { return image }\n                    context.clip(to: rect, mask: mask)\n                    context.fill(rect)\n\n                    let newImage = UIGraphicsGetImageFromCurrentImageContext()!\n                    UIGraphicsEndImageContext()\n                    return newImage\n                    }(image, itemColor).withRenderingMode(.alwaysOriginal)\n\n                barItem.setTitleTextAttributes([.foregroundColor: itemColor], for: .normal)\n                if let selected = selectedItem {\n                    barItem.setTitleTextAttributes([.foregroundColor: selected], for: .selected)\n                }\n            }\n        }\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UITableViewExtensions.swift",
    "content": "//\n//  UITableViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/22/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UITableView {\n\n    /// SwifterSwift: Index path of last row in tableView.\n    var indexPathForLastRow: IndexPath? {\n        guard let lastSection = lastSection else { return nil }\n        return indexPathForLastRow(inSection: lastSection)\n    }\n\n    /// SwifterSwift: Index of last section in tableView.\n    var lastSection: Int? {\n        return numberOfSections > 0 ? numberOfSections - 1 : nil\n    }\n\n}\n\n// MARK: - Methods\npublic extension UITableView {\n\n    /// SwifterSwift: Number of all rows in all sections of tableView.\n    ///\n    /// - Returns: The count of all rows in the tableView.\n    func numberOfRows() -> Int {\n        var section = 0\n        var rowCount = 0\n        while section < numberOfSections {\n            rowCount += numberOfRows(inSection: section)\n            section += 1\n        }\n        return rowCount\n    }\n\n    /// SwifterSwift: IndexPath for last row in section.\n    ///\n    /// - Parameter section: section to get last row in.\n    /// - Returns: optional last indexPath for last row in section (if applicable).\n    func indexPathForLastRow(inSection section: Int) -> IndexPath? {\n        guard numberOfSections > 0, section >= 0 else { return nil }\n        guard numberOfRows(inSection: section) > 0  else {\n            return IndexPath(row: 0, section: section)\n        }\n        return IndexPath(row: numberOfRows(inSection: section) - 1, section: section)\n    }\n\n    /// SwifterSwift: Reload data with a completion handler.\n    ///\n    /// - Parameter completion: completion handler to run after reloadData finishes.\n    func reloadData(_ completion: @escaping () -> Void) {\n        UIView.animate(withDuration: 0, animations: {\n            self.reloadData()\n        }, completion: { _ in\n            completion()\n        })\n    }\n\n    /// SwifterSwift: Remove TableFooterView.\n    func removeTableFooterView() {\n        tableFooterView = nil\n    }\n\n    /// SwifterSwift: Remove TableHeaderView.\n    func removeTableHeaderView() {\n        tableHeaderView = nil\n    }\n\n    /// SwifterSwift: Scroll to bottom of TableView.\n    ///\n    /// - Parameter animated: set true to animate scroll (default is true).\n    func scrollToBottom(animated: Bool = true) {\n        let bottomOffset = CGPoint(x: 0, y: contentSize.height - bounds.size.height)\n        setContentOffset(bottomOffset, animated: animated)\n    }\n\n    /// SwifterSwift: Scroll to top of TableView.\n    ///\n    /// - Parameter animated: set true to animate scroll (default is true).\n    func scrollToTop(animated: Bool = true) {\n        setContentOffset(CGPoint.zero, animated: animated)\n    }\n\n    /// SwifterSwift: Dequeue reusable UITableViewCell using class name\n    ///\n    /// - Parameter name: UITableViewCell type\n    /// - Returns: UITableViewCell object with associated class name.\n    func dequeueReusableCell<T: UITableViewCell>(withClass name: T.Type) -> T {\n        guard let cell = dequeueReusableCell(withIdentifier: String(describing: name)) as? T else {\n            fatalError(\"Couldn't find UITableViewCell for \\(String(describing: name)), make sure the cell is registered with table view\")\n        }\n        return cell\n    }\n\n    /// SwifterSwift: Dequeue reusable UITableViewCell using class name for indexPath\n    ///\n    /// - Parameters:\n    ///   - name: UITableViewCell type.\n    ///   - indexPath: location of cell in tableView.\n    /// - Returns: UITableViewCell object with associated class name.\n    func dequeueReusableCell<T: UITableViewCell>(withClass name: T.Type, for indexPath: IndexPath) -> T {\n        guard let cell = dequeueReusableCell(withIdentifier: String(describing: name), for: indexPath) as? T else {\n            fatalError(\"Couldn't find UITableViewCell for \\(String(describing: name)), make sure the cell is registered with table view\")\n        }\n        return cell\n    }\n\n    /// SwifterSwift: Dequeue reusable UITableViewHeaderFooterView using class name\n    ///\n    /// - Parameter name: UITableViewHeaderFooterView type\n    /// - Returns: UITableViewHeaderFooterView object with associated class name.\n    func dequeueReusableHeaderFooterView<T: UITableViewHeaderFooterView>(withClass name: T.Type) -> T {\n        guard let headerFooterView = dequeueReusableHeaderFooterView(withIdentifier: String(describing: name)) as? T else {\n            fatalError(\"Couldn't find UITableViewHeaderFooterView for \\(String(describing: name)), make sure the view is registered with table view\")\n        }\n        return headerFooterView\n    }\n\n    /// SwifterSwift: Register UITableViewHeaderFooterView using class name\n    ///\n    /// - Parameters:\n    ///   - nib: Nib file used to create the header or footer view.\n    ///   - name: UITableViewHeaderFooterView type.\n    func register<T: UITableViewHeaderFooterView>(nib: UINib?, withHeaderFooterViewClass name: T.Type) {\n        register(nib, forHeaderFooterViewReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UITableViewHeaderFooterView using class name\n    ///\n    /// - Parameter name: UITableViewHeaderFooterView type\n    func register<T: UITableViewHeaderFooterView>(headerFooterViewClassWith name: T.Type) {\n        register(T.self, forHeaderFooterViewReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UITableViewCell using class name\n    ///\n    /// - Parameter name: UITableViewCell type\n    func register<T: UITableViewCell>(cellWithClass name: T.Type) {\n        register(T.self, forCellReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UITableViewCell using class name\n    ///\n    /// - Parameters:\n    ///   - nib: Nib file used to create the tableView cell.\n    ///   - name: UITableViewCell type.\n    func register<T: UITableViewCell>(nib: UINib?, withCellClass name: T.Type) {\n        register(nib, forCellReuseIdentifier: String(describing: name))\n    }\n\n    /// SwifterSwift: Register UITableViewCell with .xib file using only its corresponding class.\n    ///               Assumes that the .xib filename and cell class has the same name.\n    ///\n    /// - Parameters:\n    ///   - name: UITableViewCell type.\n    ///   - bundleClass: Class in which the Bundle instance will be based on.\n    func register<T: UITableViewCell>(nibWithCellClass name: T.Type, at bundleClass: AnyClass? = nil) {\n        let identifier = String(describing: name)\n        var bundle: Bundle?\n\n        if let bundleName = bundleClass {\n            bundle = Bundle(for: bundleName)\n        }\n\n        register(UINib(nibName: identifier, bundle: bundle), forCellReuseIdentifier: identifier)\n    }\n\n    /// SwifterSwift: Check whether IndexPath is valid within the tableView\n    ///\n    /// - Parameter indexPath: An IndexPath to check\n    /// - Returns: Boolean value for valid or invalid IndexPath\n    func isValidIndexPath(_ indexPath: IndexPath) -> Bool {\n        return indexPath.section >= 0 &&\n            indexPath.row >= 0 &&\n            indexPath.section < numberOfSections &&\n            indexPath.row < numberOfRows(inSection: indexPath.section)\n    }\n\n    /// SwifterSwift: Safely scroll to possibly invalid IndexPath\n    ///\n    /// - Parameters:\n    ///   - indexPath: Target IndexPath to scroll to\n    ///   - scrollPosition: Scroll position\n    ///   - animated: Whether to animate or not\n    func safeScrollToRow(at indexPath: IndexPath, at scrollPosition: UITableView.ScrollPosition, animated: Bool) {\n        guard indexPath.section < numberOfSections else { return }\n        guard indexPath.row < numberOfRows(inSection: indexPath.section) else { return }\n        scrollToRow(at: indexPath, at: scrollPosition, animated: animated)\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UITextFieldExtensions.swift",
    "content": "//\n//  UITextFieldExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/5/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Enums\npublic extension UITextField {\n\n    /// SwifterSwift: UITextField text type.\n    ///\n    /// - emailAddress: UITextField is used to enter email addresses.\n    /// - password: UITextField is used to enter passwords.\n    /// - generic: UITextField is used to enter generic text.\n    enum TextType {\n        /// SwifterSwift: UITextField is used to enter email addresses.\n        case emailAddress\n\n        /// SwifterSwift: UITextField is used to enter passwords.\n        case password\n\n        /// SwifterSwift: UITextField is used to enter generic text.\n        case generic\n    }\n\n}\n\n// MARK: - Properties\npublic extension UITextField {\n\n    /// SwifterSwift: Set textField for common text types.\n    var textType: TextType {\n        get {\n            if keyboardType == .emailAddress {\n                return .emailAddress\n            } else if isSecureTextEntry {\n                return .password\n            }\n            return .generic\n        }\n        set {\n            switch newValue {\n            case .emailAddress:\n                keyboardType = .emailAddress\n                autocorrectionType = .no\n                autocapitalizationType = .none\n                isSecureTextEntry = false\n                placeholder = \"Email Address\"\n\n            case .password:\n                keyboardType = .asciiCapable\n                autocorrectionType = .no\n                autocapitalizationType = .none\n                isSecureTextEntry = true\n                placeholder = \"Password\"\n\n            case .generic:\n                isSecureTextEntry = false\n            }\n        }\n    }\n\n    /// SwifterSwift: Check if text field is empty.\n    var isEmpty: Bool {\n        return text?.isEmpty == true\n    }\n\n    /// SwifterSwift: Return text with no spaces or new lines in beginning and end.\n    var trimmedText: String? {\n        return text?.trimmingCharacters(in: .whitespacesAndNewlines)\n    }\n\n    /// SwifterSwift: Check if textFields text is a valid email format.\n    ///\n    ///\t\ttextField.text = \"john@doe.com\"\n    ///\t\ttextField.hasValidEmail -> true\n    ///\n    ///\t\ttextField.text = \"swifterswift\"\n    ///\t\ttextField.hasValidEmail -> false\n    ///\n    var hasValidEmail: Bool {\n        // http://stackoverflow.com/questions/25471114/how-to-validate-an-e-mail-address-in-swift\n        return text!.range(of: \"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\\\.[A-Za-z]{2,}\",\n                           options: String.CompareOptions.regularExpression,\n                           range: nil, locale: nil) != nil\n    }\n\n    /// SwifterSwift: Left view tint color.\n    @IBInspectable var leftViewTintColor: UIColor? {\n        get {\n            guard let iconView = leftView as? UIImageView else { return nil }\n            return iconView.tintColor\n        }\n        set {\n            guard let iconView = leftView as? UIImageView else { return }\n            iconView.image = iconView.image?.withRenderingMode(.alwaysTemplate)\n            iconView.tintColor = newValue\n        }\n    }\n\n    /// SwifterSwift: Right view tint color.\n    @IBInspectable var rightViewTintColor: UIColor? {\n        get {\n            guard let iconView = rightView as? UIImageView else { return nil }\n            return iconView.tintColor\n        }\n        set {\n            guard let iconView = rightView as? UIImageView else { return }\n            iconView.image = iconView.image?.withRenderingMode(.alwaysTemplate)\n            iconView.tintColor = newValue\n        }\n    }\n\n}\n\n// MARK: - Methods\npublic extension UITextField {\n\n    /// SwifterSwift: Clear text.\n    func clear() {\n        text = \"\"\n        attributedText = NSAttributedString(string: \"\")\n    }\n\n    /// SwifterSwift: Set placeholder text color.\n    ///\n    /// - Parameter color: placeholder text color.\n    func setPlaceHolderTextColor(_ color: UIColor) {\n        guard let holder = placeholder, !holder.isEmpty else { return }\n        attributedPlaceholder = NSAttributedString(string: holder, attributes: [.foregroundColor: color])\n    }\n\n    /// SwifterSwift: Add padding to the left of the textfield rect.\n    ///\n    /// - Parameter padding: amount of padding to apply to the left of the textfield rect.\n    func addPaddingLeft(_ padding: CGFloat) {\n        let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: padding, height: frame.height))\n        leftView = paddingView\n        leftViewMode = .always\n    }\n\n    /// SwifterSwift: Add padding to the left of the textfield rect.\n    ///\n    /// - Parameters:\n    ///   - image: left image\n    ///   - padding: amount of padding between icon and the left of textfield\n    func addPaddingLeftIcon(_ image: UIImage, padding: CGFloat) {\n        let imageView = UIImageView(image: image)\n        imageView.contentMode = .center\n        leftView = imageView\n        leftView?.frame.size = CGSize(width: image.size.width + padding, height: image.size.height)\n        leftViewMode = .always\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UITextViewExtensions.swift",
    "content": "//\n//  UITextViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 9/28/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UITextView {\n\n    /// SwifterSwift: Clear text.\n    func clear() {\n        text = \"\"\n        attributedText = NSAttributedString(string: \"\")\n    }\n\n    /// SwifterSwift: Scroll to the bottom of text view\n    func scrollToBottom() {\n        // swiftlint:disable:next legacy_constructor\n        let range = NSMakeRange((text as NSString).length - 1, 1)\n        scrollRangeToVisible(range)\n    }\n\n    /// SwifterSwift: Scroll to the top of text view\n    func scrollToTop() {\n        // swiftlint:disable:next legacy_constructor\n        let range = NSMakeRange(0, 1)\n        scrollRangeToVisible(range)\n    }\n\n    /// SwifterSwift: Wrap to the content (Text / Attributed Text).\n    func wrapToContent() {\n        contentInset = .zero\n        scrollIndicatorInsets = .zero\n        contentOffset = .zero\n        textContainerInset = .zero\n        textContainer.lineFragmentPadding = 0\n        sizeToFit()\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIViewControllerExtensions.swift",
    "content": "//\n//  UIViewControllerExtensions.swift\n//  SwifterSwift\n//\n//  Created by Emirhan Erdogan on 07/08/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - Properties\npublic extension UIViewController {\n\n    /// SwifterSwift: Check if ViewController is onscreen and not hidden.\n    var isVisible: Bool {\n        // http://stackoverflow.com/questions/2777438/how-to-tell-if-uiviewcontrollers-view-is-visible\n        return isViewLoaded && view.window != nil\n    }\n\n}\n\n// MARK: - Methods\npublic extension UIViewController {\n\n    /// SwifterSwift: Assign as listener to notification.\n    ///\n    /// - Parameters:\n    ///   - name: notification name.\n    ///   - selector: selector to run with notified.\n    func addNotificationObserver(name: Notification.Name, selector: Selector) {\n        NotificationCenter.default.addObserver(self, selector: selector, name: name, object: nil)\n    }\n\n    /// SwifterSwift: Unassign as listener to notification.\n    ///\n    /// - Parameter name: notification name.\n    func removeNotificationObserver(name: Notification.Name) {\n        NotificationCenter.default.removeObserver(self, name: name, object: nil)\n    }\n\n    /// SwifterSwift: Unassign as listener from all notifications.\n    func removeNotificationsObserver() {\n        NotificationCenter.default.removeObserver(self)\n    }\n\n    /// SwifterSwift: Helper method to display an alert on any UIViewController subclass. Uses UIAlertController to show an alert\n    ///\n    /// - Parameters:\n    ///   - title: title of the alert\n    ///   - message: message/body of the alert\n    ///   - buttonTitles: (Optional)list of button titles for the alert. Default button i.e \"OK\" will be shown if this paramter is nil\n    ///   - highlightedButtonIndex: (Optional) index of the button from buttonTitles that should be highlighted. If this parameter is nil no button will be highlighted\n    ///   - completion: (Optional) completion block to be invoked when any one of the buttons is tapped. It passes the index of the tapped button as an argument\n    /// - Returns: UIAlertController object (discardable).\n    @discardableResult\n    func showAlert(title: String?, message: String?, buttonTitles: [String]? = nil, highlightedButtonIndex: Int? = nil, completion: ((Int) -> Void)? = nil) -> UIAlertController {\n        let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)\n        var allButtons = buttonTitles ?? [String]()\n        if allButtons.count == 0 {\n            allButtons.append(\"OK\")\n        }\n\n        for index in 0..<allButtons.count {\n            let buttonTitle = allButtons[index]\n            let action = UIAlertAction(title: buttonTitle, style: .default, handler: { (_) in\n                completion?(index)\n            })\n            alertController.addAction(action)\n            // Check which button to highlight\n            if let highlightedButtonIndex = highlightedButtonIndex, index == highlightedButtonIndex {\n                alertController.preferredAction = action\n            }\n        }\n        present(alertController, animated: true, completion: nil)\n        return alertController\n    }\n\n    /// SwifterSwift: Helper method to add a UIViewController as a childViewController.\n    ///\n    /// - Parameters:\n    ///   - child: the view controller to add as a child\n    ///   - containerView: the containerView for the child viewcontroller's root view.\n    func addChildViewController(_ child: UIViewController, toContainerView containerView: UIView) {\n        addChild(child)\n        containerView.addSubview(child.view)\n        child.didMove(toParent: self)\n    }\n\n    /// SwifterSwift: Helper method to remove a UIViewController from its parent.\n    func removeViewAndControllerFromParentViewController() {\n        guard parent != nil else { return }\n\n        willMove(toParent: nil)\n        removeFromParent()\n        view.removeFromSuperview()\n    }\n\n    #if os(iOS)\n    /// SwifterSwift: Helper method to present a UIViewController as a popover.\n    ///\n    /// - Parameters:\n    ///   - popoverContent: the view controller to add as a popover.\n    ///   - sourcePoint: the point in which to anchor the popover.\n    ///   - size: the size of the popover. Default uses the popover preferredContentSize.\n    ///   - delegate: the popover's presentationController delegate. Default is nil.\n    ///   - animated: Pass true to animate the presentation; otherwise, pass false.\n    ///   - completion: The block to execute after the presentation finishes. Default is nil.\n    func presentPopover(_ popoverContent: UIViewController, sourcePoint: CGPoint, size: CGSize? = nil, delegate: UIPopoverPresentationControllerDelegate? = nil, animated: Bool = true, completion: (() -> Void)? = nil) {\n        popoverContent.modalPresentationStyle = .popover\n\n        if let size = size {\n            popoverContent.preferredContentSize = size\n        }\n\n        if let popoverPresentationVC = popoverContent.popoverPresentationController {\n            popoverPresentationVC.sourceView = view\n            popoverPresentationVC.sourceRect = CGRect(origin: sourcePoint, size: .zero)\n            popoverPresentationVC.delegate = delegate\n        }\n\n        present(popoverContent, animated: animated, completion: completion)\n    }\n    #endif\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIViewExtensions.swift",
    "content": "//\n//  UIViewExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 8/5/16.\n//  Copyright © 2016 SwifterSwift\n//\n\n#if canImport(UIKit) && !os(watchOS)\nimport UIKit\n\n// MARK: - enums\npublic extension UIView {\n\n    /// SwifterSwift: Shake directions of a view.\n    ///\n    /// - horizontal: Shake left and right.\n    /// - vertical: Shake up and down.\n    enum ShakeDirection {\n        /// SwifterSwift: Shake left and right.\n        case horizontal\n\n        /// SwifterSwift: Shake up and down.\n        case vertical\n    }\n\n    /// SwifterSwift: Angle units.\n    ///\n    /// - degrees: degrees.\n    /// - radians: radians.\n    enum AngleUnit {\n        /// SwifterSwift: degrees.\n        case degrees\n\n        /// SwifterSwift: radians.\n        case radians\n    }\n\n    /// SwifterSwift: Shake animations types.\n    ///\n    /// - linear: linear animation.\n    /// - easeIn: easeIn animation.\n    /// - easeOut: easeOut animation.\n    /// - easeInOut: easeInOut animation.\n    enum ShakeAnimationType {\n        /// SwifterSwift: linear animation.\n        case linear\n\n        /// SwifterSwift: easeIn animation.\n        case easeIn\n\n        /// SwifterSwift: easeOut animation.\n        case easeOut\n\n        /// SwifterSwift: easeInOut animation.\n        case easeInOut\n    }\n\n}\n\n// MARK: - Properties\npublic extension UIView {\n\n    /// SwifterSwift: Border color of view; also inspectable from Storyboard.\n    @IBInspectable var borderColor: UIColor? {\n        get {\n            guard let color = layer.borderColor else { return nil }\n            return UIColor(cgColor: color)\n        }\n        set {\n            guard let color = newValue else {\n                layer.borderColor = nil\n                return\n            }\n            // Fix React-Native conflict issue\n            guard String(describing: type(of: color)) != \"__NSCFType\" else { return }\n            layer.borderColor = color.cgColor\n        }\n    }\n\n    /// SwifterSwift: Border width of view; also inspectable from Storyboard.\n    @IBInspectable var borderWidth: CGFloat {\n        get {\n            return layer.borderWidth\n        }\n        set {\n            layer.borderWidth = newValue\n        }\n    }\n\n    /// SwifterSwift: Corner radius of view; also inspectable from Storyboard.\n    @IBInspectable var cornerRadius: CGFloat {\n        get {\n            return layer.cornerRadius\n        }\n        set {\n            layer.masksToBounds = true\n            layer.cornerRadius = abs(CGFloat(Int(newValue * 100)) / 100)\n        }\n    }\n\n    /// SwifterSwift: Height of view.\n    var height: CGFloat {\n        get {\n            return frame.size.height\n        }\n        set {\n            frame.size.height = newValue\n        }\n    }\n\n    /// SwifterSwift: Check if view is in RTL format.\n    var isRightToLeft: Bool {\n        if #available(tvOS 10.0, *) {\n            return effectiveUserInterfaceLayoutDirection == .rightToLeft\n        } else {\n            return false\n        }\n    }\n\n    /// SwifterSwift: Take screenshot of view (if applicable).\n    var screenshot: UIImage? {\n        UIGraphicsBeginImageContextWithOptions(layer.frame.size, false, 0)\n        defer {\n            UIGraphicsEndImageContext()\n        }\n        guard let context = UIGraphicsGetCurrentContext() else { return nil }\n        layer.render(in: context)\n        return UIGraphicsGetImageFromCurrentImageContext()\n    }\n\n    /// SwifterSwift: Shadow color of view; also inspectable from Storyboard.\n    @IBInspectable var shadowColor: UIColor? {\n        get {\n            guard let color = layer.shadowColor else { return nil }\n            return UIColor(cgColor: color)\n        }\n        set {\n            layer.shadowColor = newValue?.cgColor\n        }\n    }\n\n    /// SwifterSwift: Shadow offset of view; also inspectable from Storyboard.\n    @IBInspectable var shadowOffset: CGSize {\n        get {\n            return layer.shadowOffset\n        }\n        set {\n            layer.shadowOffset = newValue\n        }\n    }\n\n    /// SwifterSwift: Shadow opacity of view; also inspectable from Storyboard.\n    @IBInspectable var shadowOpacity: Float {\n        get {\n            return layer.shadowOpacity\n        }\n        set {\n            layer.shadowOpacity = newValue\n        }\n    }\n\n    /// SwifterSwift: Shadow radius of view; also inspectable from Storyboard.\n    @IBInspectable var shadowRadius: CGFloat {\n        get {\n            return layer.shadowRadius\n        }\n        set {\n            layer.shadowRadius = newValue\n        }\n    }\n\n    /// SwifterSwift: Size of view.\n    var size: CGSize {\n        get {\n            return frame.size\n        }\n        set {\n            width = newValue.width\n            height = newValue.height\n        }\n    }\n\n    /// SwifterSwift: Get view's parent view controller\n    var parentViewController: UIViewController? {\n        weak var parentResponder: UIResponder? = self\n        while parentResponder != nil {\n            parentResponder = parentResponder!.next\n            if let viewController = parentResponder as? UIViewController {\n                return viewController\n            }\n        }\n        return nil\n    }\n\n    /// SwifterSwift: Width of view.\n    var width: CGFloat {\n        get {\n            return frame.size.width\n        }\n        set {\n            frame.size.width = newValue\n        }\n    }\n\n    /// SwifterSwift: x origin of view.\n    var x: CGFloat {\n        get {\n            return frame.origin.x\n        }\n        set {\n            frame.origin.x = newValue\n        }\n    }\n\n    /// SwifterSwift: y origin of view.\n    var y: CGFloat {\n        get {\n            return frame.origin.y\n        }\n        set {\n            frame.origin.y = newValue\n        }\n    }\n\n}\n\n// MARK: - Methods\npublic extension UIView {\n\n    /// SwifterSwift: Recursively find the first responder.\n    func firstResponder() -> UIView? {\n        var views = [UIView](arrayLiteral: self)\n        var index = 0\n        repeat {\n            let view = views[index]\n            if view.isFirstResponder {\n                return view\n            }\n            views.append(contentsOf: view.subviews)\n            index += 1\n        } while index < views.count\n        return nil\n    }\n\n    /// SwifterSwift: Set some or all corners radiuses of view.\n    ///\n    /// - Parameters:\n    ///   - corners: array of corners to change (example: [.bottomLeft, .topRight]).\n    ///   - radius: radius for selected corners.\n    func roundCorners(_ corners: UIRectCorner, radius: CGFloat) {\n        let maskPath = UIBezierPath(\n            roundedRect: bounds,\n            byRoundingCorners: corners,\n            cornerRadii: CGSize(width: radius, height: radius))\n\n        let shape = CAShapeLayer()\n        shape.path = maskPath.cgPath\n        layer.mask = shape\n    }\n\n    /// SwifterSwift: Add shadow to view.\n    ///\n    /// - Parameters:\n    ///   - color: shadow color (default is #137992).\n    ///   - radius: shadow radius (default is 3).\n    ///   - offset: shadow offset (default is .zero).\n    ///   - opacity: shadow opacity (default is 0.5).\n    func addShadow(ofColor color: UIColor = UIColor(red: 0.07, green: 0.47, blue: 0.57, alpha: 1.0), radius: CGFloat = 3, offset: CGSize = .zero, opacity: Float = 0.5) {\n        layer.shadowColor = color.cgColor\n        layer.shadowOffset = offset\n        layer.shadowRadius = radius\n        layer.shadowOpacity = opacity\n        layer.masksToBounds = false\n    }\n\n    /// SwifterSwift: Add array of subviews to view.\n    ///\n    /// - Parameter subviews: array of subviews to add to self.\n    func addSubviews(_ subviews: [UIView]) {\n        subviews.forEach { addSubview($0) }\n    }\n\n    /// SwifterSwift: Fade in view.\n    ///\n    /// - Parameters:\n    ///   - duration: animation duration in seconds (default is 1 second).\n    ///   - completion: optional completion handler to run with animation finishes (default is nil)\n    func fadeIn(duration: TimeInterval = 1, completion: ((Bool) -> Void)? = nil) {\n        if isHidden {\n            isHidden = false\n        }\n        UIView.animate(withDuration: duration, animations: {\n            self.alpha = 1\n        }, completion: completion)\n    }\n\n    /// SwifterSwift: Fade out view.\n    ///\n    /// - Parameters:\n    ///   - duration: animation duration in seconds (default is 1 second).\n    ///   - completion: optional completion handler to run with animation finishes (default is nil)\n    func fadeOut(duration: TimeInterval = 1, completion: ((Bool) -> Void)? = nil) {\n        if isHidden {\n            isHidden = false\n        }\n        UIView.animate(withDuration: duration, animations: {\n            self.alpha = 0\n        }, completion: completion)\n    }\n\n    /// SwifterSwift: Load view from nib.\n    ///\n    /// - Parameters:\n    ///   - name: nib name.\n    ///   - bundle: bundle of nib (default is nil).\n    /// - Returns: optional UIView (if applicable).\n    class func loadFromNib(named name: String, bundle: Bundle? = nil) -> UIView? {\n        return UINib(nibName: name, bundle: bundle).instantiate(withOwner: nil, options: nil)[0] as? UIView\n    }\n\n    /// SwifterSwift: Remove all subviews in view.\n    func removeSubviews() {\n        subviews.forEach({ $0.removeFromSuperview() })\n    }\n\n    /// SwifterSwift: Remove all gesture recognizers from view.\n    func removeGestureRecognizers() {\n        gestureRecognizers?.forEach(removeGestureRecognizer)\n    }\n\n    /// SwifterSwift: Attaches gesture recognizers to the view. Attaching gesture recognizers to a view defines the scope of the represented gesture, causing it to receive touches hit-tested to that view and all of its subviews. The view establishes a strong reference to the gesture recognizers.\n    ///\n    /// - Parameter gestureRecognizers: The array of gesture recognizers to be added to the view.\n    func addGestureRecognizers(_ gestureRecognizers: [UIGestureRecognizer]) {\n        for recognizer in gestureRecognizers {\n            addGestureRecognizer(recognizer)\n        }\n    }\n\n    /// SwifterSwift: Detaches gesture recognizers from the receiving view. This method releases gestureRecognizers in addition to detaching them from the view.\n    ///\n    /// - Parameter gestureRecognizers: The array of gesture recognizers to be removed from the view.\n    func removeGestureRecognizers(_ gestureRecognizers: [UIGestureRecognizer]) {\n        for recognizer in gestureRecognizers {\n            removeGestureRecognizer(recognizer)\n        }\n    }\n\n    /// SwifterSwift: Rotate view by angle on relative axis.\n    ///\n    /// - Parameters:\n    ///   - angle: angle to rotate view by.\n    ///   - type: type of the rotation angle.\n    ///   - animated: set true to animate rotation (default is true).\n    ///   - duration: animation duration in seconds (default is 1 second).\n    ///   - completion: optional completion handler to run with animation finishes (default is nil).\n    func rotate(byAngle angle: CGFloat, ofType type: AngleUnit, animated: Bool = false, duration: TimeInterval = 1, completion: ((Bool) -> Void)? = nil) {\n        let angleWithType = (type == .degrees) ? .pi * angle / 180.0 : angle\n        let aDuration = animated ? duration : 0\n        UIView.animate(withDuration: aDuration, delay: 0, options: .curveLinear, animations: { () -> Void in\n            self.transform = self.transform.rotated(by: angleWithType)\n        }, completion: completion)\n    }\n\n    /// SwifterSwift: Rotate view to angle on fixed axis.\n    ///\n    /// - Parameters:\n    ///   - angle: angle to rotate view to.\n    ///   - type: type of the rotation angle.\n    ///   - animated: set true to animate rotation (default is false).\n    ///   - duration: animation duration in seconds (default is 1 second).\n    ///   - completion: optional completion handler to run with animation finishes (default is nil).\n    func rotate(toAngle angle: CGFloat, ofType type: AngleUnit, animated: Bool = false, duration: TimeInterval = 1, completion: ((Bool) -> Void)? = nil) {\n        let angleWithType = (type == .degrees) ? .pi * angle / 180.0 : angle\n        let aDuration = animated ? duration : 0\n        UIView.animate(withDuration: aDuration, animations: {\n            self.transform = self.transform.concatenating(CGAffineTransform(rotationAngle: angleWithType))\n        }, completion: completion)\n    }\n\n    /// SwifterSwift: Scale view by offset.\n    ///\n    /// - Parameters:\n    ///   - offset: scale offset\n    ///   - animated: set true to animate scaling (default is false).\n    ///   - duration: animation duration in seconds (default is 1 second).\n    ///   - completion: optional completion handler to run with animation finishes (default is nil).\n    func scale(by offset: CGPoint, animated: Bool = false, duration: TimeInterval = 1, completion: ((Bool) -> Void)? = nil) {\n        if animated {\n            UIView.animate(withDuration: duration, delay: 0, options: .curveLinear, animations: { () -> Void in\n                self.transform = self.transform.scaledBy(x: offset.x, y: offset.y)\n            }, completion: completion)\n        } else {\n            transform = transform.scaledBy(x: offset.x, y: offset.y)\n            completion?(true)\n        }\n    }\n\n    /// SwifterSwift: Shake view.\n    ///\n    /// - Parameters:\n    ///   - direction: shake direction (horizontal or vertical), (default is .horizontal)\n    ///   - duration: animation duration in seconds (default is 1 second).\n    ///   - animationType: shake animation type (default is .easeOut).\n    ///   - completion: optional completion handler to run with animation finishes (default is nil).\n    func shake(direction: ShakeDirection = .horizontal, duration: TimeInterval = 1, animationType: ShakeAnimationType = .easeOut, completion:(() -> Void)? = nil) {\n        CATransaction.begin()\n        let animation: CAKeyframeAnimation\n        switch direction {\n        case .horizontal:\n            animation = CAKeyframeAnimation(keyPath: \"transform.translation.x\")\n        case .vertical:\n            animation = CAKeyframeAnimation(keyPath: \"transform.translation.y\")\n        }\n        switch animationType {\n        case .linear:\n            animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)\n        case .easeIn:\n            animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn)\n        case .easeOut:\n            animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)\n        case .easeInOut:\n            animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)\n        }\n        CATransaction.setCompletionBlock(completion)\n        animation.duration = duration\n        animation.values = [-20.0, 20.0, -20.0, 20.0, -10.0, 10.0, -5.0, 5.0, 0.0 ]\n        layer.add(animation, forKey: \"shake\")\n        CATransaction.commit()\n    }\n\n    /// SwifterSwift: Add Visual Format constraints.\n    ///\n    /// - Parameters:\n    ///   - withFormat: visual Format language\n    ///   - views: array of views which will be accessed starting with index 0 (example: [v0], [v1], [v2]..)\n    @available(iOS 9, *) func addConstraints(withFormat: String, views: UIView...) {\n        // https://videos.letsbuildthatapp.com/\n        var viewsDictionary: [String: UIView] = [:]\n        for (index, view) in views.enumerated() {\n            let key = \"v\\(index)\"\n            view.translatesAutoresizingMaskIntoConstraints = false\n            viewsDictionary[key] = view\n        }\n        addConstraints(NSLayoutConstraint.constraints(withVisualFormat: withFormat, options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDictionary))\n    }\n\n    /// SwifterSwift: Anchor all sides of the view into it's superview.\n    @available(iOS 9, *)\n    func fillToSuperview() {\n        // https://videos.letsbuildthatapp.com/\n        translatesAutoresizingMaskIntoConstraints = false\n        if let superview = superview {\n            let left = leftAnchor.constraint(equalTo: superview.leftAnchor)\n            let right = rightAnchor.constraint(equalTo: superview.rightAnchor)\n            let top = topAnchor.constraint(equalTo: superview.topAnchor)\n            let bottom = bottomAnchor.constraint(equalTo: superview.bottomAnchor)\n            NSLayoutConstraint.activate([left, right, top, bottom])\n        }\n    }\n\n    /// SwifterSwift: Add anchors from any side of the current view into the specified anchors and returns the newly added constraints.\n    ///\n    /// - Parameters:\n    ///   - top: current view's top anchor will be anchored into the specified anchor\n    ///   - left: current view's left anchor will be anchored into the specified anchor\n    ///   - bottom: current view's bottom anchor will be anchored into the specified anchor\n    ///   - right: current view's right anchor will be anchored into the specified anchor\n    ///   - topConstant: current view's top anchor margin\n    ///   - leftConstant: current view's left anchor margin\n    ///   - bottomConstant: current view's bottom anchor margin\n    ///   - rightConstant: current view's right anchor margin\n    ///   - widthConstant: current view's width\n    ///   - heightConstant: current view's height\n    /// - Returns: array of newly added constraints (if applicable).\n    @available(iOS 9, *)\n    @discardableResult\n    func anchor(\n        top: NSLayoutYAxisAnchor? = nil,\n        left: NSLayoutXAxisAnchor? = nil,\n        bottom: NSLayoutYAxisAnchor? = nil,\n        right: NSLayoutXAxisAnchor? = nil,\n        topConstant: CGFloat = 0,\n        leftConstant: CGFloat = 0,\n        bottomConstant: CGFloat = 0,\n        rightConstant: CGFloat = 0,\n        widthConstant: CGFloat = 0,\n        heightConstant: CGFloat = 0) -> [NSLayoutConstraint] {\n        // https://videos.letsbuildthatapp.com/\n        translatesAutoresizingMaskIntoConstraints = false\n\n        var anchors = [NSLayoutConstraint]()\n\n        if let top = top {\n            anchors.append(topAnchor.constraint(equalTo: top, constant: topConstant))\n        }\n\n        if let left = left {\n            anchors.append(leftAnchor.constraint(equalTo: left, constant: leftConstant))\n        }\n\n        if let bottom = bottom {\n            anchors.append(bottomAnchor.constraint(equalTo: bottom, constant: -bottomConstant))\n        }\n\n        if let right = right {\n            anchors.append(rightAnchor.constraint(equalTo: right, constant: -rightConstant))\n        }\n\n        if widthConstant > 0 {\n            anchors.append(widthAnchor.constraint(equalToConstant: widthConstant))\n        }\n\n        if heightConstant > 0 {\n            anchors.append(heightAnchor.constraint(equalToConstant: heightConstant))\n        }\n\n        anchors.forEach({$0.isActive = true})\n\n        return anchors\n    }\n\n    /// SwifterSwift: Anchor center X into current view's superview with a constant margin value.\n    ///\n    /// - Parameter constant: constant of the anchor constraint (default is 0).\n    @available(iOS 9, *)\n    func anchorCenterXToSuperview(constant: CGFloat = 0) {\n        // https://videos.letsbuildthatapp.com/\n        translatesAutoresizingMaskIntoConstraints = false\n        if let anchor = superview?.centerXAnchor {\n            centerXAnchor.constraint(equalTo: anchor, constant: constant).isActive = true\n        }\n    }\n\n    /// SwifterSwift: Anchor center Y into current view's superview with a constant margin value.\n    ///\n    /// - Parameter withConstant: constant of the anchor constraint (default is 0).\n    @available(iOS 9, *)\n    func anchorCenterYToSuperview(constant: CGFloat = 0) {\n        // https://videos.letsbuildthatapp.com/\n        translatesAutoresizingMaskIntoConstraints = false\n        if let anchor = superview?.centerYAnchor {\n            centerYAnchor.constraint(equalTo: anchor, constant: constant).isActive = true\n        }\n    }\n\n    /// SwifterSwift: Anchor center X and Y into current view's superview\n    @available(iOS 9, *)\n    func anchorCenterSuperview() {\n        // https://videos.letsbuildthatapp.com/\n        anchorCenterXToSuperview()\n        anchorCenterYToSuperview()\n    }\n\n    /// SwifterSwift: Search all superviews until a view with the condition is found.\n    ///\n    /// - Parameter predicate: predicate to evaluate on superviews.\n    func ancestorView(where predicate: (UIView?) -> Bool) -> UIView? {\n        if predicate(superview) {\n            return superview\n        }\n        return superview?.ancestorView(where: predicate)\n    }\n\n    /// SwifterSwift: Search all superviews until a view with this class is found.\n    ///\n    /// - Parameter name: class of the view to search.\n    func ancestorView<T: UIView>(withClass name: T.Type) -> T? {\n        return ancestorView(where: { $0 is T }) as? T\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift/Sources/SwifterSwift/UIKit/UIWindowExtensions.swift",
    "content": "//\n//  UIWindowExtensions.swift\n//  SwifterSwift\n//\n//  Created by Omar Albeik on 6/2/18.\n//  Copyright © 2018 SwifterSwift\n//\n\n#if canImport(UIKit) && os(iOS)\nimport UIKit\n\n// MARK: - Methods\npublic extension UIWindow {\n\n    /// SwifterSwift: Switch current root view controller with a new view controller.\n    ///\n    /// - Parameters:\n    ///   - viewController: new view controller.\n    ///   - animated: set to true to animate view controller change (default is true).\n    ///   - duration: animation duration in seconds (default is 0.5).\n    ///   - options: animation options (default is .transitionFlipFromRight).\n    ///   - completion: optional completion handler called after view controller is changed.\n    func switchRootViewController(\n        to viewController: UIViewController,\n        animated: Bool = true,\n        duration: TimeInterval = 0.5,\n        options: UIView.AnimationOptions = .transitionFlipFromRight,\n        _ completion: (() -> Void)? = nil) {\n\n        guard animated else {\n            rootViewController = viewController\n            completion?()\n            return\n        }\n\n        UIView.transition(with: self, duration: duration, options: options, animations: {\n            let oldState = UIView.areAnimationsEnabled\n            UIView.setAnimationsEnabled(false)\n            self.rootViewController = viewController\n            UIView.setAnimationsEnabled(oldState)\n        }, completion: { _ in\n            completion?()\n        })\n    }\n\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/SwifterSwift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t03EB7307E9C51C4BF3DA3E4D0C348544 /* URLRequestExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 178FD5068418D4694DA165CE74F05D9E /* URLRequestExtensions.swift */; };\n\t\t07EA34BA5BE9B97AEFC21F035C491D55 /* LocaleExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D119E1C346654B51D3847EDB3DBAF55 /* LocaleExtensions.swift */; };\n\t\t0AAB0088F0554CFBED8D391FDF3C3539 /* SCNCapsuleExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954D39B5E8A6C530E265B4E062DF36BE /* SCNCapsuleExtensions.swift */; };\n\t\t0CBDCAC389F00121CC337E375C2AF667 /* SCNGeometryExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 218323CA0B825E681597113058220A9B /* SCNGeometryExtensions.swift */; };\n\t\t0D922CC19608EB07EE21A4F253D100E3 /* UIImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9871738DE63EB144588651D23C7D18FE /* UIImageExtensions.swift */; };\n\t\t0F62DFAF753D55EDDD354DF4E109524D /* CollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB30716EFACBE1CB02F2790B95774EF3 /* CollectionExtensions.swift */; };\n\t\t111A72E7C6FDF2180B004F6ED44AF41F /* MKPolylineExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A3D274871F89572C27EE3BEC87374B2 /* MKPolylineExtensions.swift */; };\n\t\t13499163560520F8B4050FFEF84C0E84 /* CGSizeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 606283D802087028C59738E507B0B015 /* CGSizeExtensions.swift */; };\n\t\t14F2F38BA898987A3C9BB42C91E2760B /* IntExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0996DEE0A4BC2D8B66C05D71F445C55 /* IntExtensions.swift */; };\n\t\t1656946797E7AAD38BDAACEA7AC8EA1F /* UIColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE65F71A64AD8E6B36330FA08CFF21 /* UIColorExtensions.swift */; };\n\t\t175DB1053FA9CE2BD9FE0D0BD0254DC3 /* CLVisitExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20127FF74C4A327C951325642D4944E /* CLVisitExtensions.swift */; };\n\t\t1A34A8781F259CD72C4DA9315064868C /* UIStoryboardExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 682389727407FCDF01C01A67F93B02A0 /* UIStoryboardExtensions.swift */; };\n\t\t1AE8E1AD45DDCB97CEE21FFAB7D28345 /* BidirectionalCollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56EE9919F12F60AF1834DF30F4A6650B /* BidirectionalCollectionExtensions.swift */; };\n\t\t1C6B4D930A70308B15BB15415B06EA7F /* UIWindowExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CC21ABB1AA407AA5668FC6A22835E7E /* UIWindowExtensions.swift */; };\n\t\t218E5326F4787C9D54B26B79D5B83F48 /* CGColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AB908C282231C49C6C783D879EB7435 /* CGColorExtensions.swift */; };\n\t\t22AC24E6DA3D9330E2166AEB446E5707 /* UILabelExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D342AD86260B6E9550F40CEB3302ADD /* UILabelExtensions.swift */; };\n\t\t2321CE61C077A5A701CACCA6203F8CE3 /* CGPointExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 771250677063121F977F8409A6E40843 /* CGPointExtensions.swift */; };\n\t\t24068E23BB105AA1E2E1B1D0D38C2F05 /* ColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98B578E54F4D46DD9F46F8B9643B2583 /* ColorExtensions.swift */; };\n\t\t2918EE1385CEC0C8CA3951A35718AD4D /* BoolExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BBDA997029AC80DD983E7C192CA28F /* BoolExtensions.swift */; };\n\t\t2EDFF7BCC44E324E761D16DAB43E450E /* SwifterSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4082B1964B4057753713F19AA9DA5E68 /* SwifterSwift-dummy.m */; };\n\t\t2FBDC589C66A74D1A8B250E9E17405A4 /* SCNMaterialExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04043BCF44622F6539E023AAB29BDCB7 /* SCNMaterialExtensions.swift */; };\n\t\t3039712B6792D9194A6A707B1C997762 /* UIStackViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A0FA82E8964599F1944D8C74AA6C575 /* UIStackViewExtensions.swift */; };\n\t\t3420881E860560553A7C4D1D830E9EFB /* DispatchQueueExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1BCCE0DB59E83F57F2523A9ED4BB422 /* DispatchQueueExtensions.swift */; };\n\t\t3DF3BE43A9F5B0A759A819E0168AD786 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76DE2450EE709CAED21FC210C09FD96B /* Foundation.framework */; };\n\t\t4100B04283FBD77405F68111C2F6BCD1 /* CGAffineTransformExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59B2A9D78BF486A8FECF592CD6019F5 /* CGAffineTransformExtensions.swift */; };\n\t\t432E981674837E39A577E90B9F394EC9 /* UIGestureRecognizerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A263F147BA9226700C552AB3E64A51BD /* UIGestureRecognizerExtensions.swift */; };\n\t\t439531DBBD2CD9AC1084835C1AB9D863 /* CAGradientLayerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50260D1481E33470EC6E3110DBCEB733 /* CAGradientLayerExtensions.swift */; };\n\t\t4613FD2CF78609995491E56C211B68F0 /* UISwitchExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CE97146B83CC335037CBFD82946B9A2 /* UISwitchExtensions.swift */; };\n\t\t4AC9316A34881CDA256F5ED70C5E4802 /* UIAlertControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB77ABD38654DABAD05287F11ED8938B /* UIAlertControllerExtensions.swift */; };\n\t\t4F179B540566B805F45D879113E97A56 /* UINavigationControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BAAF1A7A3BF13F8CD868518074B48A1 /* UINavigationControllerExtensions.swift */; };\n\t\t517A98D6A26F35FBB8E5212F1F0B30DE /* DecodableExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E9571F4D88103DC85CAE6A8CC71042F /* DecodableExtensions.swift */; };\n\t\t5239AEFA621DA2C574DCA9C5C79669C7 /* NSViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EE9C83A8C75D96235B8D5DF8701C845 /* NSViewExtensions.swift */; };\n\t\t552673953BD6FC91987BF1395578A0F0 /* NSRegularExpressionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D685340B50903935B27A6C9651E97E3 /* NSRegularExpressionExtensions.swift */; };\n\t\t562C37E302E7B276FEDDE4E12B8E2529 /* UIBezierPathExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C14E1A3B41AB81795D86F65C1FB3E2E3 /* UIBezierPathExtensions.swift */; };\n\t\t5B05CE019FDA65D780C88EEF1F7ADA40 /* EdgeInsetsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C72CC46D0B75E1017579AEACB13C73ED /* EdgeInsetsExtensions.swift */; };\n\t\t5BC092B1771A2008C13B17F0094A84EC /* UIButtonExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 305578AB855FB1E373BBF7A01ECB7215 /* UIButtonExtensions.swift */; };\n\t\t5E9DD323AE7FFDC4E4F8901DE7F6BD6F /* CLLocationArrayExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBEFCB1090C9AA1F9F33EC64EE5D417F /* CLLocationArrayExtensions.swift */; };\n\t\t5EBC1F1F8DBECBB3EC1AB9956B50ED8E /* CLLocationExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD2BC9A218385F4217AC3BFC7BCE7557 /* CLLocationExtensions.swift */; };\n\t\t62DFCE85125759A95E824E2B7930800C /* UITabBarExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDBC1BA1C5FFE410D416BCAEEE0617D9 /* UITabBarExtensions.swift */; };\n\t\t6A31FF4F9A55302C61EF75EEFD35C92A /* CGFloatExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57BDB6938C15EC7B124293A48338F85 /* CGFloatExtensions.swift */; };\n\t\t6BBCCADE90A67FAA3A894A43A2C71B63 /* UILayoutPriorityExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D451642680D2098A7C8B329798692AAE /* UILayoutPriorityExtensions.swift */; };\n\t\t6C4AA88C1F2E94125A694DB9FD432F96 /* UIImageViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23539B9C5507B6E35B4681B217B78D90 /* UIImageViewExtensions.swift */; };\n\t\t6CCCD46A77D45150BB045DAE0403F5D0 /* UICollectionViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DCDC5D0A2730DD39273DD6A5EFB7FE2 /* UICollectionViewExtensions.swift */; };\n\t\t6D556BE5CD6A49E57E62B2701F46B8BB /* SCNVector3Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1FC1CCAB354220891F760C13AB15E7C /* SCNVector3Extensions.swift */; };\n\t\t70243DF7F77AAEE4CF7C408643BEAD21 /* UINavigationItemExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D59851519DBB8F426780D2D371E8C634 /* UINavigationItemExtensions.swift */; };\n\t\t7178911787E3EC7497CF75265D735626 /* DoubleExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BFEC95832D0F042982EBFE4B0D633B /* DoubleExtensions.swift */; };\n\t\t71E2302F9518855C23FB787A2F276CA7 /* DateExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B70CBF4D3BBAAB253AE240E3BD1D2669 /* DateExtensions.swift */; };\n\t\t72D14DC232192E1F1CC5753A27392D6B /* ArrayExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22EE35C81179AFB2C1F3A5963C6B6DB6 /* ArrayExtensions.swift */; };\n\t\t75C339D908FCA80DEB948BC41D3B9621 /* CGRectExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72E62B259520D37285F70EB3E188330D /* CGRectExtensions.swift */; };\n\t\t775826A7565BF8E0DB96E8C92B94F871 /* CalendarExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F8BB10F976CFAAAB4684F53551FAB4 /* CalendarExtensions.swift */; };\n\t\t77FE0D8763867E669155617F0B93E297 /* SKProductExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AB8536E3EB8CD95F15D4DC5E74AFB79 /* SKProductExtensions.swift */; };\n\t\t782D8FD93A4793B4B54A48A36A25E5C7 /* RandomAccessCollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DD624CBAFB637E9FBA4D442D34070B6 /* RandomAccessCollectionExtensions.swift */; };\n\t\t786B4EA5A038B57A5102F8D430985D52 /* StdlibDeprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 928840F843E8E53A543FAEA32BC083DC /* StdlibDeprecated.swift */; };\n\t\t795FFA64B92824C1F216D0E44C28EBF5 /* MKMapViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57CB559FBC6AE7C0E24A71D65D47F26 /* MKMapViewExtensions.swift */; };\n\t\t79D687E344534317A3D139ECAA46302D /* SCNPlaneExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D8A3EDC80884D9624A0D6CA831BB547 /* SCNPlaneExtensions.swift */; };\n\t\t7BD7208E1E33605F855D79CCAF064BDF /* NSPredicateExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4AF4B051BA7E66BE7825AC5BCA78C1F /* NSPredicateExtensions.swift */; };\n\t\t7D47491F730D6EBF3E321AB4460959D8 /* UserDefaultsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE5FFC47499975D687F87DE19D36C6CF /* UserDefaultsExtensions.swift */; };\n\t\t7E8B7D216EAA941BDC5B5DD85B33CFE4 /* URLExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC77D85B8CBC7DC219B7C9CA14D03CD3 /* URLExtensions.swift */; };\n\t\t8121F09E6B03CF7E6F312C06A6EC748D /* SCNShapeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DBF309A1D49A9644FC5789B8820183A /* SCNShapeExtensions.swift */; };\n\t\t825ABFBDE1C9DA71D6D121B5371843F8 /* CharacterExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F06CD5382CDC1E1D370150DACA1B85 /* CharacterExtensions.swift */; };\n\t\t83490435DF0BFE10E5C91885EF8AF568 /* SignedIntegerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA9EC86E7703705BCAAB378942DE5C0A /* SignedIntegerExtensions.swift */; };\n\t\t8D557A151174CA1C5E5E6093CA8754C0 /* StringProtocolExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B71480FF4BFAB3D75E034EF541134FB1 /* StringProtocolExtensions.swift */; };\n\t\t8FEC6BD040A6B6A4B94041B2AA83FF48 /* NotificationCenterExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 905DB01192D878FCDBE7F1D91F4597AE /* NotificationCenterExtensions.swift */; };\n\t\t92F7E733B76493867F3D07D90CA4F3DC /* SKNodeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 358D2D0ECB435DB809D2616D7D4517C1 /* SKNodeExtensions.swift */; };\n\t\t932D82DEC397AF2C3581D2F3B7D2ABA3 /* SequenceExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD6F81758DE2D7A5A39A6A3EFA9541E5 /* SequenceExtensions.swift */; };\n\t\t93E5D4AFCF456D239A1C4D93252425E8 /* UIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945F243DA0454AF69346579BC6424E3D /* UIViewExtensions.swift */; };\n\t\t9491F6FC214E6BF6264DEE0D895A9E32 /* BinaryFloatingPointExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A6BB50E92B8522E6DEAADC99BC1A115 /* BinaryFloatingPointExtensions.swift */; };\n\t\t95766F1D9480E13E3FDB3E1C7F06B902 /* CATransform3DExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA7F3F31756C370D5B14E1EEE0AE5BE4 /* CATransform3DExtensions.swift */; };\n\t\t96DEF1684B8029C6EDDBAD71F7DCD6EC /* UISegmentedControlExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4424FCC7DC1EE80F2693173EB78938FA /* UISegmentedControlExtensions.swift */; };\n\t\t97250638352ACDCD8D1A061BCF67461D /* NSColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 139AACB589F770DA888264EE9B8D9169 /* NSColorExtensions.swift */; };\n\t\t9872F9B4D19118084E21FBCF6822E97E /* UIFontExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1281D19029AB6C4DF1B47DC937885D43 /* UIFontExtensions.swift */; };\n\t\t9C91D78BD8565C4C667DBD8321860470 /* UITextViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60A03B2F4D91E274E8EF0582570038AF /* UITextViewExtensions.swift */; };\n\t\tA22BA32DFC8A4CAC3ABC62B529D73488 /* RangeReplaceableCollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DB68D0BE860C3B820CF39C982C1EAD5 /* RangeReplaceableCollectionExtensions.swift */; };\n\t\tA2786EEF1693912AE814A6785AD9EDBA /* ComparableExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC731D9D9765D6830B6BBFB0F63F651B /* ComparableExtensions.swift */; };\n\t\tA866E7A41110C36E678B6E7E7F519BE2 /* UISliderExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA503D5F851D0024A91C386B9B189F43 /* UISliderExtensions.swift */; };\n\t\tAEF83650746F38895C6F7B21FF325CFB /* CGVectorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74FA355E92810C7AF1733C20C6446796 /* CGVectorExtensions.swift */; };\n\t\tBACECD65B0600451C280C42D23B21FB0 /* UITextFieldExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C67EE97F9A1E69CFCC678E30E14AF0C /* UITextFieldExtensions.swift */; };\n\t\tBCFBA55AC384A970A2061406DE0E0A54 /* NSAttributedStringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30E2A317F359EA8EB151B9E5456D3366 /* NSAttributedStringExtensions.swift */; };\n\t\tC82E1F635BE16DB13EE84170111D5B43 /* MutableCollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BABF94317EADAC29122E24AE86612F3E /* MutableCollectionExtensions.swift */; };\n\t\tC9B88453E903714E2E97A2D9E7E47D4E /* UIViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 447AD35780D46F45EC19687011A1F899 /* UIViewControllerExtensions.swift */; };\n\t\tCC984A78A132F0334BC30997B0877385 /* DataExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D184D60B91C0BA9113DB447A038586B /* DataExtensions.swift */; };\n\t\tCF4B40ACF2D0EBABF294E857405A8731 /* UISearchBarExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72FFE4DE50CDEE9B8D76ECB9A46E340B /* UISearchBarExtensions.swift */; };\n\t\tD121D7E529242400ABFD6779967B71B7 /* UIRefreshControlExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1BFF4E919039710300FEF4082055F84 /* UIRefreshControlExtensions.swift */; };\n\t\tD6D24DA1A68A850F427E829C9DAF6DB7 /* NSImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F2CAE688482AC51AB4C1A2AFEA783AE /* NSImageExtensions.swift */; };\n\t\tD9B29DBA992652124F22B77E88BB8175 /* UIBarButtonItemExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACA77963E017C39A2D8303722AE6F47E /* UIBarButtonItemExtensions.swift */; };\n\t\tDC89265A7CEFBA540B83A9EE80743444 /* FileManagerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35EFC972F3D7BF43CDE63E2D6A0F5986 /* FileManagerExtensions.swift */; };\n\t\tDD014204D6653020B552CF7040B457D1 /* UIDatePickerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C295D93943620A4B6A0961EBE32B3439 /* UIDatePickerExtensions.swift */; };\n\t\tDFB980CF78B1FA065F3A5CE8D967FFB6 /* UIActivityExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE09214E89FD76E9563FA768262C6F44 /* UIActivityExtensions.swift */; };\n\t\tE7BA717E905FB466C590F82D2678DC3F /* KeyedDecodingContainerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0394A8255308C91839463AA740E741FB /* KeyedDecodingContainerExtensions.swift */; };\n\t\tE7BAFD365B0E10E46AF1FBC048EBE0AB /* UINavigationBarExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5ECC2F58C574422B4C30C996557B7A21 /* UINavigationBarExtensions.swift */; };\n\t\tE9A49B82523887E554F2C53B60C98DFE /* DictionaryExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EACA88525495A4E05DE1E1CFD4DBD3C /* DictionaryExtensions.swift */; };\n\t\tEAB799EB9FFE5102852925AB8940564D /* SCNConeExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2E23DB1DEF15AE7C320CCEE6F95E16C /* SCNConeExtensions.swift */; };\n\t\tEAF800C24C4325406BED1BB76A706557 /* OptionalExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC3EA480D615827C74BB57E9B7186DB7 /* OptionalExtensions.swift */; };\n\t\tEC37FDF83867FF75E6B2F8E1A3BC0F7E /* FloatingPointExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94DFECA9BE3583ACDFBB9EE17AF16D44 /* FloatingPointExtensions.swift */; };\n\t\tEEFA37D89A0EDDC560C9C85925F6CA46 /* UIScrollViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 901E737E1A60E866DB4E989D257EE4AD /* UIScrollViewExtensions.swift */; };\n\t\tF1CD4C012EE244450A25885BB6960831 /* SignedNumericExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44756B39FE8C6002C2664696E734634B /* SignedNumericExtensions.swift */; };\n\t\tF4801477E956ED32EAF2B2F10FCB2CC4 /* UIApplicationExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A25FC51E77F378B5FF632FC91519413D /* UIApplicationExtensions.swift */; };\n\t\tF518834379772EE5069D62B8EB881F00 /* SCNBoxExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29131DA8B572A41696F2D440BF6FCCA7 /* SCNBoxExtensions.swift */; };\n\t\tF683F35D64B7E7BE7910DE75644F94B0 /* StringExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC29232BA21F2FD5D0313E4B5A55C720 /* StringExtensions.swift */; };\n\t\tF6F3B08650F9E5DA1D1A905B2BF42518 /* SCNSphereExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ABBC474C3E93D1E93CA97492CBD53B3 /* SCNSphereExtensions.swift */; };\n\t\tF7E6489CD2AA97160BBF965D7FCE9EAE /* FloatExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AF7618364A9C6BCB072DA07D966DF34 /* FloatExtensions.swift */; };\n\t\tFAB79DE5A9A0DDA6110AEFE4DAC792E3 /* SwifterSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = BE2BF4C7CC79826758773F2D7AC81C82 /* SwifterSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFBC9A1A33320B9914F951B23B2E23498 /* UITableViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F7797400C38392F5276C74DC40868A2 /* UITableViewExtensions.swift */; };\n\t\tFD8F1D2703C5DB87EA4A27F031EEF82E /* SCNCylinderExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7F962148CC4465A6AD4E2F84FF403D /* SCNCylinderExtensions.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t0394A8255308C91839463AA740E741FB /* KeyedDecodingContainerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyedDecodingContainerExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/KeyedDecodingContainerExtensions.swift; sourceTree = \"<group>\"; };\n\t\t04043BCF44622F6539E023AAB29BDCB7 /* SCNMaterialExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNMaterialExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNMaterialExtensions.swift; sourceTree = \"<group>\"; };\n\t\t0BAAF1A7A3BF13F8CD868518074B48A1 /* UINavigationControllerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UINavigationControllerExtensions.swift; path = Sources/SwifterSwift/UIKit/UINavigationControllerExtensions.swift; sourceTree = \"<group>\"; };\n\t\t0CE97146B83CC335037CBFD82946B9A2 /* UISwitchExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UISwitchExtensions.swift; path = Sources/SwifterSwift/UIKit/UISwitchExtensions.swift; sourceTree = \"<group>\"; };\n\t\t0EACA88525495A4E05DE1E1CFD4DBD3C /* DictionaryExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DictionaryExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/DictionaryExtensions.swift; sourceTree = \"<group>\"; };\n\t\t1281D19029AB6C4DF1B47DC937885D43 /* UIFontExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIFontExtensions.swift; path = Sources/SwifterSwift/UIKit/UIFontExtensions.swift; sourceTree = \"<group>\"; };\n\t\t139AACB589F770DA888264EE9B8D9169 /* NSColorExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSColorExtensions.swift; path = Sources/SwifterSwift/AppKit/NSColorExtensions.swift; sourceTree = \"<group>\"; };\n\t\t178FD5068418D4694DA165CE74F05D9E /* URLRequestExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = URLRequestExtensions.swift; path = Sources/SwifterSwift/Foundation/URLRequestExtensions.swift; sourceTree = \"<group>\"; };\n\t\t1900A0055F0FD7FC2A2F0CD15D34DC84 /* SwifterSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwifterSwift.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t1D342AD86260B6E9550F40CEB3302ADD /* UILabelExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UILabelExtensions.swift; path = Sources/SwifterSwift/UIKit/UILabelExtensions.swift; sourceTree = \"<group>\"; };\n\t\t1F2CAE688482AC51AB4C1A2AFEA783AE /* NSImageExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSImageExtensions.swift; path = Sources/SwifterSwift/AppKit/NSImageExtensions.swift; sourceTree = \"<group>\"; };\n\t\t1F7797400C38392F5276C74DC40868A2 /* UITableViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UITableViewExtensions.swift; path = Sources/SwifterSwift/UIKit/UITableViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t218323CA0B825E681597113058220A9B /* SCNGeometryExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNGeometryExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNGeometryExtensions.swift; sourceTree = \"<group>\"; };\n\t\t22EE35C81179AFB2C1F3A5963C6B6DB6 /* ArrayExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ArrayExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/ArrayExtensions.swift; sourceTree = \"<group>\"; };\n\t\t23539B9C5507B6E35B4681B217B78D90 /* UIImageViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIImageViewExtensions.swift; path = Sources/SwifterSwift/UIKit/UIImageViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t26F8BB10F976CFAAAB4684F53551FAB4 /* CalendarExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CalendarExtensions.swift; path = Sources/SwifterSwift/Foundation/CalendarExtensions.swift; sourceTree = \"<group>\"; };\n\t\t29131DA8B572A41696F2D440BF6FCCA7 /* SCNBoxExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNBoxExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNBoxExtensions.swift; sourceTree = \"<group>\"; };\n\t\t2AB8536E3EB8CD95F15D4DC5E74AFB79 /* SKProductExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SKProductExtensions.swift; path = Sources/SwifterSwift/StoreKit/SKProductExtensions.swift; sourceTree = \"<group>\"; };\n\t\t2D8A3EDC80884D9624A0D6CA831BB547 /* SCNPlaneExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNPlaneExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNPlaneExtensions.swift; sourceTree = \"<group>\"; };\n\t\t305578AB855FB1E373BBF7A01ECB7215 /* UIButtonExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIButtonExtensions.swift; path = Sources/SwifterSwift/UIKit/UIButtonExtensions.swift; sourceTree = \"<group>\"; };\n\t\t30E2A317F359EA8EB151B9E5456D3366 /* NSAttributedStringExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSAttributedStringExtensions.swift; path = Sources/SwifterSwift/Foundation/NSAttributedStringExtensions.swift; sourceTree = \"<group>\"; };\n\t\t358D2D0ECB435DB809D2616D7D4517C1 /* SKNodeExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SKNodeExtensions.swift; path = Sources/SwifterSwift/SpriteKit/SKNodeExtensions.swift; sourceTree = \"<group>\"; };\n\t\t35EFC972F3D7BF43CDE63E2D6A0F5986 /* FileManagerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FileManagerExtensions.swift; path = Sources/SwifterSwift/Foundation/FileManagerExtensions.swift; sourceTree = \"<group>\"; };\n\t\t372F4FBE84F0525B54F5E1289553BC79 /* SwifterSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SwifterSwift-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t3DB68D0BE860C3B820CF39C982C1EAD5 /* RangeReplaceableCollectionExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RangeReplaceableCollectionExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/RangeReplaceableCollectionExtensions.swift; sourceTree = \"<group>\"; };\n\t\t4082B1964B4057753713F19AA9DA5E68 /* SwifterSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"SwifterSwift-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t4424FCC7DC1EE80F2693173EB78938FA /* UISegmentedControlExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UISegmentedControlExtensions.swift; path = Sources/SwifterSwift/UIKit/UISegmentedControlExtensions.swift; sourceTree = \"<group>\"; };\n\t\t44756B39FE8C6002C2664696E734634B /* SignedNumericExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SignedNumericExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/SignedNumericExtensions.swift; sourceTree = \"<group>\"; };\n\t\t447AD35780D46F45EC19687011A1F899 /* UIViewControllerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIViewControllerExtensions.swift; path = Sources/SwifterSwift/UIKit/UIViewControllerExtensions.swift; sourceTree = \"<group>\"; };\n\t\t4ABBC474C3E93D1E93CA97492CBD53B3 /* SCNSphereExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNSphereExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNSphereExtensions.swift; sourceTree = \"<group>\"; };\n\t\t4AF7618364A9C6BCB072DA07D966DF34 /* FloatExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FloatExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/FloatExtensions.swift; sourceTree = \"<group>\"; };\n\t\t4D119E1C346654B51D3847EDB3DBAF55 /* LocaleExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LocaleExtensions.swift; path = Sources/SwifterSwift/Foundation/LocaleExtensions.swift; sourceTree = \"<group>\"; };\n\t\t4DD624CBAFB637E9FBA4D442D34070B6 /* RandomAccessCollectionExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RandomAccessCollectionExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/RandomAccessCollectionExtensions.swift; sourceTree = \"<group>\"; };\n\t\t50260D1481E33470EC6E3110DBCEB733 /* CAGradientLayerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CAGradientLayerExtensions.swift; path = Sources/SwifterSwift/CoreAnimation/CAGradientLayerExtensions.swift; sourceTree = \"<group>\"; };\n\t\t56EE9919F12F60AF1834DF30F4A6650B /* BidirectionalCollectionExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BidirectionalCollectionExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/BidirectionalCollectionExtensions.swift; sourceTree = \"<group>\"; };\n\t\t5A0FA82E8964599F1944D8C74AA6C575 /* UIStackViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIStackViewExtensions.swift; path = Sources/SwifterSwift/UIKit/UIStackViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t5C67EE97F9A1E69CFCC678E30E14AF0C /* UITextFieldExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UITextFieldExtensions.swift; path = Sources/SwifterSwift/UIKit/UITextFieldExtensions.swift; sourceTree = \"<group>\"; };\n\t\t5DCDC5D0A2730DD39273DD6A5EFB7FE2 /* UICollectionViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UICollectionViewExtensions.swift; path = Sources/SwifterSwift/UIKit/UICollectionViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t5ECC2F58C574422B4C30C996557B7A21 /* UINavigationBarExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UINavigationBarExtensions.swift; path = Sources/SwifterSwift/UIKit/UINavigationBarExtensions.swift; sourceTree = \"<group>\"; };\n\t\t606283D802087028C59738E507B0B015 /* CGSizeExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CGSizeExtensions.swift; path = Sources/SwifterSwift/CoreGraphics/CGSizeExtensions.swift; sourceTree = \"<group>\"; };\n\t\t60A03B2F4D91E274E8EF0582570038AF /* UITextViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UITextViewExtensions.swift; path = Sources/SwifterSwift/UIKit/UITextViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t682389727407FCDF01C01A67F93B02A0 /* UIStoryboardExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIStoryboardExtensions.swift; path = Sources/SwifterSwift/UIKit/UIStoryboardExtensions.swift; sourceTree = \"<group>\"; };\n\t\t6A3D274871F89572C27EE3BEC87374B2 /* MKPolylineExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MKPolylineExtensions.swift; path = Sources/SwifterSwift/MapKit/MKPolylineExtensions.swift; sourceTree = \"<group>\"; };\n\t\t6AB908C282231C49C6C783D879EB7435 /* CGColorExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CGColorExtensions.swift; path = Sources/SwifterSwift/CoreGraphics/CGColorExtensions.swift; sourceTree = \"<group>\"; };\n\t\t6DBF309A1D49A9644FC5789B8820183A /* SCNShapeExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNShapeExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNShapeExtensions.swift; sourceTree = \"<group>\"; };\n\t\t6EE9C83A8C75D96235B8D5DF8701C845 /* NSViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSViewExtensions.swift; path = Sources/SwifterSwift/AppKit/NSViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t6F2EFB40A354412DEB57740124966124 /* SwifterSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"SwifterSwift-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t72E62B259520D37285F70EB3E188330D /* CGRectExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CGRectExtensions.swift; path = Sources/SwifterSwift/CoreGraphics/CGRectExtensions.swift; sourceTree = \"<group>\"; };\n\t\t72FFE4DE50CDEE9B8D76ECB9A46E340B /* UISearchBarExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UISearchBarExtensions.swift; path = Sources/SwifterSwift/UIKit/UISearchBarExtensions.swift; sourceTree = \"<group>\"; };\n\t\t73BFEC95832D0F042982EBFE4B0D633B /* DoubleExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DoubleExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/DoubleExtensions.swift; sourceTree = \"<group>\"; };\n\t\t74FA355E92810C7AF1733C20C6446796 /* CGVectorExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CGVectorExtensions.swift; path = Sources/SwifterSwift/CoreGraphics/CGVectorExtensions.swift; sourceTree = \"<group>\"; };\n\t\t76DE2450EE709CAED21FC210C09FD96B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t771250677063121F977F8409A6E40843 /* CGPointExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CGPointExtensions.swift; path = Sources/SwifterSwift/CoreGraphics/CGPointExtensions.swift; sourceTree = \"<group>\"; };\n\t\t78BBDA997029AC80DD983E7C192CA28F /* BoolExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BoolExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/BoolExtensions.swift; sourceTree = \"<group>\"; };\n\t\t7CC21ABB1AA407AA5668FC6A22835E7E /* UIWindowExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIWindowExtensions.swift; path = Sources/SwifterSwift/UIKit/UIWindowExtensions.swift; sourceTree = \"<group>\"; };\n\t\t7D184D60B91C0BA9113DB447A038586B /* DataExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DataExtensions.swift; path = Sources/SwifterSwift/Foundation/DataExtensions.swift; sourceTree = \"<group>\"; };\n\t\t7F16F0AFDC2F153DB390FA481C6CA674 /* SwifterSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SwifterSwift.modulemap; sourceTree = \"<group>\"; };\n\t\t8A6BB50E92B8522E6DEAADC99BC1A115 /* BinaryFloatingPointExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryFloatingPointExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/BinaryFloatingPointExtensions.swift; sourceTree = \"<group>\"; };\n\t\t8DFE65F71A64AD8E6B36330FA08CFF21 /* UIColorExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIColorExtensions.swift; path = Sources/SwifterSwift/UIKit/UIColorExtensions.swift; sourceTree = \"<group>\"; };\n\t\t8E9571F4D88103DC85CAE6A8CC71042F /* DecodableExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DecodableExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/DecodableExtensions.swift; sourceTree = \"<group>\"; };\n\t\t901E737E1A60E866DB4E989D257EE4AD /* UIScrollViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIScrollViewExtensions.swift; path = Sources/SwifterSwift/UIKit/UIScrollViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t905DB01192D878FCDBE7F1D91F4597AE /* NotificationCenterExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationCenterExtensions.swift; path = Sources/SwifterSwift/Foundation/NotificationCenterExtensions.swift; sourceTree = \"<group>\"; };\n\t\t928840F843E8E53A543FAEA32BC083DC /* StdlibDeprecated.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StdlibDeprecated.swift; path = Sources/SwifterSwift/SwiftStdlib/Deprecated/StdlibDeprecated.swift; sourceTree = \"<group>\"; };\n\t\t92F06CD5382CDC1E1D370150DACA1B85 /* CharacterExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CharacterExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/CharacterExtensions.swift; sourceTree = \"<group>\"; };\n\t\t945F243DA0454AF69346579BC6424E3D /* UIViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIViewExtensions.swift; path = Sources/SwifterSwift/UIKit/UIViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\t94DFECA9BE3583ACDFBB9EE17AF16D44 /* FloatingPointExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FloatingPointExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/FloatingPointExtensions.swift; sourceTree = \"<group>\"; };\n\t\t954D39B5E8A6C530E265B4E062DF36BE /* SCNCapsuleExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNCapsuleExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNCapsuleExtensions.swift; sourceTree = \"<group>\"; };\n\t\t97D8DA6CB02ED5125505335D2CCA262A /* SwifterSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwifterSwift.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t9871738DE63EB144588651D23C7D18FE /* UIImageExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIImageExtensions.swift; path = Sources/SwifterSwift/UIKit/UIImageExtensions.swift; sourceTree = \"<group>\"; };\n\t\t98B578E54F4D46DD9F46F8B9643B2583 /* ColorExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColorExtensions.swift; path = Sources/SwifterSwift/Shared/ColorExtensions.swift; sourceTree = \"<group>\"; };\n\t\t9D685340B50903935B27A6C9651E97E3 /* NSRegularExpressionExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSRegularExpressionExtensions.swift; path = Sources/SwifterSwift/Foundation/NSRegularExpressionExtensions.swift; sourceTree = \"<group>\"; };\n\t\tA25FC51E77F378B5FF632FC91519413D /* UIApplicationExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIApplicationExtensions.swift; path = Sources/SwifterSwift/UIKit/UIApplicationExtensions.swift; sourceTree = \"<group>\"; };\n\t\tA263F147BA9226700C552AB3E64A51BD /* UIGestureRecognizerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIGestureRecognizerExtensions.swift; path = Sources/SwifterSwift/UIKit/UIGestureRecognizerExtensions.swift; sourceTree = \"<group>\"; };\n\t\tAC29232BA21F2FD5D0313E4B5A55C720 /* StringExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StringExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/StringExtensions.swift; sourceTree = \"<group>\"; };\n\t\tAC3EA480D615827C74BB57E9B7186DB7 /* OptionalExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = OptionalExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/OptionalExtensions.swift; sourceTree = \"<group>\"; };\n\t\tACA77963E017C39A2D8303722AE6F47E /* UIBarButtonItemExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIBarButtonItemExtensions.swift; path = Sources/SwifterSwift/UIKit/UIBarButtonItemExtensions.swift; sourceTree = \"<group>\"; };\n\t\tB1BFF4E919039710300FEF4082055F84 /* UIRefreshControlExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIRefreshControlExtensions.swift; path = Sources/SwifterSwift/UIKit/UIRefreshControlExtensions.swift; sourceTree = \"<group>\"; };\n\t\tB57BDB6938C15EC7B124293A48338F85 /* CGFloatExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CGFloatExtensions.swift; path = Sources/SwifterSwift/CoreGraphics/CGFloatExtensions.swift; sourceTree = \"<group>\"; };\n\t\tB57CB559FBC6AE7C0E24A71D65D47F26 /* MKMapViewExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MKMapViewExtensions.swift; path = Sources/SwifterSwift/MapKit/MKMapViewExtensions.swift; sourceTree = \"<group>\"; };\n\t\tB70CBF4D3BBAAB253AE240E3BD1D2669 /* DateExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DateExtensions.swift; path = Sources/SwifterSwift/Foundation/DateExtensions.swift; sourceTree = \"<group>\"; };\n\t\tB71480FF4BFAB3D75E034EF541134FB1 /* StringProtocolExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StringProtocolExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/StringProtocolExtensions.swift; sourceTree = \"<group>\"; };\n\t\tBABF94317EADAC29122E24AE86612F3E /* MutableCollectionExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MutableCollectionExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/MutableCollectionExtensions.swift; sourceTree = \"<group>\"; };\n\t\tBB77ABD38654DABAD05287F11ED8938B /* UIAlertControllerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIAlertControllerExtensions.swift; path = Sources/SwifterSwift/UIKit/UIAlertControllerExtensions.swift; sourceTree = \"<group>\"; };\n\t\tBC77D85B8CBC7DC219B7C9CA14D03CD3 /* URLExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = URLExtensions.swift; path = Sources/SwifterSwift/Foundation/URLExtensions.swift; sourceTree = \"<group>\"; };\n\t\tBD6F81758DE2D7A5A39A6A3EFA9541E5 /* SequenceExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SequenceExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/SequenceExtensions.swift; sourceTree = \"<group>\"; };\n\t\tBE2BF4C7CC79826758773F2D7AC81C82 /* SwifterSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SwifterSwift-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tBE5FFC47499975D687F87DE19D36C6CF /* UserDefaultsExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UserDefaultsExtensions.swift; path = Sources/SwifterSwift/Foundation/UserDefaultsExtensions.swift; sourceTree = \"<group>\"; };\n\t\tC14E1A3B41AB81795D86F65C1FB3E2E3 /* UIBezierPathExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIBezierPathExtensions.swift; path = Sources/SwifterSwift/UIKit/UIBezierPathExtensions.swift; sourceTree = \"<group>\"; };\n\t\tC295D93943620A4B6A0961EBE32B3439 /* UIDatePickerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIDatePickerExtensions.swift; path = Sources/SwifterSwift/UIKit/UIDatePickerExtensions.swift; sourceTree = \"<group>\"; };\n\t\tC2E23DB1DEF15AE7C320CCEE6F95E16C /* SCNConeExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNConeExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNConeExtensions.swift; sourceTree = \"<group>\"; };\n\t\tC3E7BFD79922D2545166916876E56FD5 /* SwifterSwift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SwifterSwift; path = SwifterSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tC72CC46D0B75E1017579AEACB13C73ED /* EdgeInsetsExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EdgeInsetsExtensions.swift; path = Sources/SwifterSwift/Shared/EdgeInsetsExtensions.swift; sourceTree = \"<group>\"; };\n\t\tCA503D5F851D0024A91C386B9B189F43 /* UISliderExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UISliderExtensions.swift; path = Sources/SwifterSwift/UIKit/UISliderExtensions.swift; sourceTree = \"<group>\"; };\n\t\tD20127FF74C4A327C951325642D4944E /* CLVisitExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CLVisitExtensions.swift; path = Sources/SwifterSwift/CoreLocation/CLVisitExtensions.swift; sourceTree = \"<group>\"; };\n\t\tD451642680D2098A7C8B329798692AAE /* UILayoutPriorityExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UILayoutPriorityExtensions.swift; path = Sources/SwifterSwift/UIKit/UILayoutPriorityExtensions.swift; sourceTree = \"<group>\"; };\n\t\tD4AF4B051BA7E66BE7825AC5BCA78C1F /* NSPredicateExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSPredicateExtensions.swift; path = Sources/SwifterSwift/Foundation/NSPredicateExtensions.swift; sourceTree = \"<group>\"; };\n\t\tD59851519DBB8F426780D2D371E8C634 /* UINavigationItemExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UINavigationItemExtensions.swift; path = Sources/SwifterSwift/UIKit/UINavigationItemExtensions.swift; sourceTree = \"<group>\"; };\n\t\tDA7F3F31756C370D5B14E1EEE0AE5BE4 /* CATransform3DExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CATransform3DExtensions.swift; path = Sources/SwifterSwift/CoreAnimation/CATransform3DExtensions.swift; sourceTree = \"<group>\"; };\n\t\tDBEFCB1090C9AA1F9F33EC64EE5D417F /* CLLocationArrayExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CLLocationArrayExtensions.swift; path = Sources/SwifterSwift/CoreLocation/CLLocationArrayExtensions.swift; sourceTree = \"<group>\"; };\n\t\tDD2BC9A218385F4217AC3BFC7BCE7557 /* CLLocationExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CLLocationExtensions.swift; path = Sources/SwifterSwift/CoreLocation/CLLocationExtensions.swift; sourceTree = \"<group>\"; };\n\t\tDE09214E89FD76E9563FA768262C6F44 /* UIActivityExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIActivityExtensions.swift; path = Sources/SwifterSwift/UIKit/UIActivityExtensions.swift; sourceTree = \"<group>\"; };\n\t\tDE7F962148CC4465A6AD4E2F84FF403D /* SCNCylinderExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNCylinderExtensions.swift; path = Sources/SwifterSwift/SceneKit/SCNCylinderExtensions.swift; sourceTree = \"<group>\"; };\n\t\tEDBC1BA1C5FFE410D416BCAEEE0617D9 /* UITabBarExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UITabBarExtensions.swift; path = Sources/SwifterSwift/UIKit/UITabBarExtensions.swift; sourceTree = \"<group>\"; };\n\t\tF0996DEE0A4BC2D8B66C05D71F445C55 /* IntExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IntExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/IntExtensions.swift; sourceTree = \"<group>\"; };\n\t\tF1BCCE0DB59E83F57F2523A9ED4BB422 /* DispatchQueueExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DispatchQueueExtensions.swift; path = Sources/SwifterSwift/Dispatch/DispatchQueueExtensions.swift; sourceTree = \"<group>\"; };\n\t\tF1FC1CCAB354220891F760C13AB15E7C /* SCNVector3Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SCNVector3Extensions.swift; path = Sources/SwifterSwift/SceneKit/SCNVector3Extensions.swift; sourceTree = \"<group>\"; };\n\t\tF59B2A9D78BF486A8FECF592CD6019F5 /* CGAffineTransformExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CGAffineTransformExtensions.swift; path = Sources/SwifterSwift/CoreGraphics/CGAffineTransformExtensions.swift; sourceTree = \"<group>\"; };\n\t\tFA9EC86E7703705BCAAB378942DE5C0A /* SignedIntegerExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SignedIntegerExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/SignedIntegerExtensions.swift; sourceTree = \"<group>\"; };\n\t\tFB30716EFACBE1CB02F2790B95774EF3 /* CollectionExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CollectionExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/CollectionExtensions.swift; sourceTree = \"<group>\"; };\n\t\tFC731D9D9765D6830B6BBFB0F63F651B /* ComparableExtensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ComparableExtensions.swift; path = Sources/SwifterSwift/SwiftStdlib/ComparableExtensions.swift; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t1C2CB0681C86445FB40D30DACAD4C258 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3DF3BE43A9F5B0A759A819E0168AD786 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t09D45F274C0BCF1F0EAF5A62E85870EE /* Dispatch */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = Dispatch;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1EA955DCC84A3AA272E92497F65A2943 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t21637DC1033BB54640EABA698E19FD3C /* Frameworks */,\n\t\t\t\t4050E7EE49EB8280C661940FCC028127 /* Products */,\n\t\t\t\t7E3539F3C93C33894DA02FF1B97102FF /* SwifterSwift */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t21637DC1033BB54640EABA698E19FD3C /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2352CDDAA1A179B84038FD5F68E65CC5 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2352CDDAA1A179B84038FD5F68E65CC5 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t76DE2450EE709CAED21FC210C09FD96B /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t252184C9937BF04C8C175F48E142DC16 /* SwiftStdlib */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = SwiftStdlib;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4050E7EE49EB8280C661940FCC028127 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC3E7BFD79922D2545166916876E56FD5 /* SwifterSwift */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4CDA0020315339C3E2E44135A0C38D20 /* UIKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = UIKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6FF750DE262983C50022B14283BEDC43 /* CoreAnimation */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = CoreAnimation;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7E3539F3C93C33894DA02FF1B97102FF /* SwifterSwift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t22EE35C81179AFB2C1F3A5963C6B6DB6 /* ArrayExtensions.swift */,\n\t\t\t\t56EE9919F12F60AF1834DF30F4A6650B /* BidirectionalCollectionExtensions.swift */,\n\t\t\t\t8A6BB50E92B8522E6DEAADC99BC1A115 /* BinaryFloatingPointExtensions.swift */,\n\t\t\t\t78BBDA997029AC80DD983E7C192CA28F /* BoolExtensions.swift */,\n\t\t\t\t50260D1481E33470EC6E3110DBCEB733 /* CAGradientLayerExtensions.swift */,\n\t\t\t\t26F8BB10F976CFAAAB4684F53551FAB4 /* CalendarExtensions.swift */,\n\t\t\t\tDA7F3F31756C370D5B14E1EEE0AE5BE4 /* CATransform3DExtensions.swift */,\n\t\t\t\tF59B2A9D78BF486A8FECF592CD6019F5 /* CGAffineTransformExtensions.swift */,\n\t\t\t\t6AB908C282231C49C6C783D879EB7435 /* CGColorExtensions.swift */,\n\t\t\t\tB57BDB6938C15EC7B124293A48338F85 /* CGFloatExtensions.swift */,\n\t\t\t\t771250677063121F977F8409A6E40843 /* CGPointExtensions.swift */,\n\t\t\t\t72E62B259520D37285F70EB3E188330D /* CGRectExtensions.swift */,\n\t\t\t\t606283D802087028C59738E507B0B015 /* CGSizeExtensions.swift */,\n\t\t\t\t74FA355E92810C7AF1733C20C6446796 /* CGVectorExtensions.swift */,\n\t\t\t\t92F06CD5382CDC1E1D370150DACA1B85 /* CharacterExtensions.swift */,\n\t\t\t\tDBEFCB1090C9AA1F9F33EC64EE5D417F /* CLLocationArrayExtensions.swift */,\n\t\t\t\tDD2BC9A218385F4217AC3BFC7BCE7557 /* CLLocationExtensions.swift */,\n\t\t\t\tD20127FF74C4A327C951325642D4944E /* CLVisitExtensions.swift */,\n\t\t\t\tFB30716EFACBE1CB02F2790B95774EF3 /* CollectionExtensions.swift */,\n\t\t\t\t98B578E54F4D46DD9F46F8B9643B2583 /* ColorExtensions.swift */,\n\t\t\t\tFC731D9D9765D6830B6BBFB0F63F651B /* ComparableExtensions.swift */,\n\t\t\t\t7D184D60B91C0BA9113DB447A038586B /* DataExtensions.swift */,\n\t\t\t\tB70CBF4D3BBAAB253AE240E3BD1D2669 /* DateExtensions.swift */,\n\t\t\t\t8E9571F4D88103DC85CAE6A8CC71042F /* DecodableExtensions.swift */,\n\t\t\t\t0EACA88525495A4E05DE1E1CFD4DBD3C /* DictionaryExtensions.swift */,\n\t\t\t\tF1BCCE0DB59E83F57F2523A9ED4BB422 /* DispatchQueueExtensions.swift */,\n\t\t\t\t73BFEC95832D0F042982EBFE4B0D633B /* DoubleExtensions.swift */,\n\t\t\t\tC72CC46D0B75E1017579AEACB13C73ED /* EdgeInsetsExtensions.swift */,\n\t\t\t\t35EFC972F3D7BF43CDE63E2D6A0F5986 /* FileManagerExtensions.swift */,\n\t\t\t\t4AF7618364A9C6BCB072DA07D966DF34 /* FloatExtensions.swift */,\n\t\t\t\t94DFECA9BE3583ACDFBB9EE17AF16D44 /* FloatingPointExtensions.swift */,\n\t\t\t\tF0996DEE0A4BC2D8B66C05D71F445C55 /* IntExtensions.swift */,\n\t\t\t\t0394A8255308C91839463AA740E741FB /* KeyedDecodingContainerExtensions.swift */,\n\t\t\t\t4D119E1C346654B51D3847EDB3DBAF55 /* LocaleExtensions.swift */,\n\t\t\t\tB57CB559FBC6AE7C0E24A71D65D47F26 /* MKMapViewExtensions.swift */,\n\t\t\t\t6A3D274871F89572C27EE3BEC87374B2 /* MKPolylineExtensions.swift */,\n\t\t\t\tBABF94317EADAC29122E24AE86612F3E /* MutableCollectionExtensions.swift */,\n\t\t\t\t905DB01192D878FCDBE7F1D91F4597AE /* NotificationCenterExtensions.swift */,\n\t\t\t\t30E2A317F359EA8EB151B9E5456D3366 /* NSAttributedStringExtensions.swift */,\n\t\t\t\t139AACB589F770DA888264EE9B8D9169 /* NSColorExtensions.swift */,\n\t\t\t\t1F2CAE688482AC51AB4C1A2AFEA783AE /* NSImageExtensions.swift */,\n\t\t\t\tD4AF4B051BA7E66BE7825AC5BCA78C1F /* NSPredicateExtensions.swift */,\n\t\t\t\t9D685340B50903935B27A6C9651E97E3 /* NSRegularExpressionExtensions.swift */,\n\t\t\t\t6EE9C83A8C75D96235B8D5DF8701C845 /* NSViewExtensions.swift */,\n\t\t\t\tAC3EA480D615827C74BB57E9B7186DB7 /* OptionalExtensions.swift */,\n\t\t\t\t4DD624CBAFB637E9FBA4D442D34070B6 /* RandomAccessCollectionExtensions.swift */,\n\t\t\t\t3DB68D0BE860C3B820CF39C982C1EAD5 /* RangeReplaceableCollectionExtensions.swift */,\n\t\t\t\t29131DA8B572A41696F2D440BF6FCCA7 /* SCNBoxExtensions.swift */,\n\t\t\t\t954D39B5E8A6C530E265B4E062DF36BE /* SCNCapsuleExtensions.swift */,\n\t\t\t\tC2E23DB1DEF15AE7C320CCEE6F95E16C /* SCNConeExtensions.swift */,\n\t\t\t\tDE7F962148CC4465A6AD4E2F84FF403D /* SCNCylinderExtensions.swift */,\n\t\t\t\t218323CA0B825E681597113058220A9B /* SCNGeometryExtensions.swift */,\n\t\t\t\t04043BCF44622F6539E023AAB29BDCB7 /* SCNMaterialExtensions.swift */,\n\t\t\t\t2D8A3EDC80884D9624A0D6CA831BB547 /* SCNPlaneExtensions.swift */,\n\t\t\t\t6DBF309A1D49A9644FC5789B8820183A /* SCNShapeExtensions.swift */,\n\t\t\t\t4ABBC474C3E93D1E93CA97492CBD53B3 /* SCNSphereExtensions.swift */,\n\t\t\t\tF1FC1CCAB354220891F760C13AB15E7C /* SCNVector3Extensions.swift */,\n\t\t\t\tBD6F81758DE2D7A5A39A6A3EFA9541E5 /* SequenceExtensions.swift */,\n\t\t\t\tFA9EC86E7703705BCAAB378942DE5C0A /* SignedIntegerExtensions.swift */,\n\t\t\t\t44756B39FE8C6002C2664696E734634B /* SignedNumericExtensions.swift */,\n\t\t\t\t358D2D0ECB435DB809D2616D7D4517C1 /* SKNodeExtensions.swift */,\n\t\t\t\t2AB8536E3EB8CD95F15D4DC5E74AFB79 /* SKProductExtensions.swift */,\n\t\t\t\t928840F843E8E53A543FAEA32BC083DC /* StdlibDeprecated.swift */,\n\t\t\t\tAC29232BA21F2FD5D0313E4B5A55C720 /* StringExtensions.swift */,\n\t\t\t\tB71480FF4BFAB3D75E034EF541134FB1 /* StringProtocolExtensions.swift */,\n\t\t\t\tDE09214E89FD76E9563FA768262C6F44 /* UIActivityExtensions.swift */,\n\t\t\t\tBB77ABD38654DABAD05287F11ED8938B /* UIAlertControllerExtensions.swift */,\n\t\t\t\tA25FC51E77F378B5FF632FC91519413D /* UIApplicationExtensions.swift */,\n\t\t\t\tACA77963E017C39A2D8303722AE6F47E /* UIBarButtonItemExtensions.swift */,\n\t\t\t\tC14E1A3B41AB81795D86F65C1FB3E2E3 /* UIBezierPathExtensions.swift */,\n\t\t\t\t305578AB855FB1E373BBF7A01ECB7215 /* UIButtonExtensions.swift */,\n\t\t\t\t5DCDC5D0A2730DD39273DD6A5EFB7FE2 /* UICollectionViewExtensions.swift */,\n\t\t\t\t8DFE65F71A64AD8E6B36330FA08CFF21 /* UIColorExtensions.swift */,\n\t\t\t\tC295D93943620A4B6A0961EBE32B3439 /* UIDatePickerExtensions.swift */,\n\t\t\t\t1281D19029AB6C4DF1B47DC937885D43 /* UIFontExtensions.swift */,\n\t\t\t\tA263F147BA9226700C552AB3E64A51BD /* UIGestureRecognizerExtensions.swift */,\n\t\t\t\t9871738DE63EB144588651D23C7D18FE /* UIImageExtensions.swift */,\n\t\t\t\t23539B9C5507B6E35B4681B217B78D90 /* UIImageViewExtensions.swift */,\n\t\t\t\t1D342AD86260B6E9550F40CEB3302ADD /* UILabelExtensions.swift */,\n\t\t\t\tD451642680D2098A7C8B329798692AAE /* UILayoutPriorityExtensions.swift */,\n\t\t\t\t5ECC2F58C574422B4C30C996557B7A21 /* UINavigationBarExtensions.swift */,\n\t\t\t\t0BAAF1A7A3BF13F8CD868518074B48A1 /* UINavigationControllerExtensions.swift */,\n\t\t\t\tD59851519DBB8F426780D2D371E8C634 /* UINavigationItemExtensions.swift */,\n\t\t\t\tB1BFF4E919039710300FEF4082055F84 /* UIRefreshControlExtensions.swift */,\n\t\t\t\t901E737E1A60E866DB4E989D257EE4AD /* UIScrollViewExtensions.swift */,\n\t\t\t\t72FFE4DE50CDEE9B8D76ECB9A46E340B /* UISearchBarExtensions.swift */,\n\t\t\t\t4424FCC7DC1EE80F2693173EB78938FA /* UISegmentedControlExtensions.swift */,\n\t\t\t\tCA503D5F851D0024A91C386B9B189F43 /* UISliderExtensions.swift */,\n\t\t\t\t5A0FA82E8964599F1944D8C74AA6C575 /* UIStackViewExtensions.swift */,\n\t\t\t\t682389727407FCDF01C01A67F93B02A0 /* UIStoryboardExtensions.swift */,\n\t\t\t\t0CE97146B83CC335037CBFD82946B9A2 /* UISwitchExtensions.swift */,\n\t\t\t\tEDBC1BA1C5FFE410D416BCAEEE0617D9 /* UITabBarExtensions.swift */,\n\t\t\t\t1F7797400C38392F5276C74DC40868A2 /* UITableViewExtensions.swift */,\n\t\t\t\t5C67EE97F9A1E69CFCC678E30E14AF0C /* UITextFieldExtensions.swift */,\n\t\t\t\t60A03B2F4D91E274E8EF0582570038AF /* UITextViewExtensions.swift */,\n\t\t\t\t447AD35780D46F45EC19687011A1F899 /* UIViewControllerExtensions.swift */,\n\t\t\t\t945F243DA0454AF69346579BC6424E3D /* UIViewExtensions.swift */,\n\t\t\t\t7CC21ABB1AA407AA5668FC6A22835E7E /* UIWindowExtensions.swift */,\n\t\t\t\tBC77D85B8CBC7DC219B7C9CA14D03CD3 /* URLExtensions.swift */,\n\t\t\t\t178FD5068418D4694DA165CE74F05D9E /* URLRequestExtensions.swift */,\n\t\t\t\tBE5FFC47499975D687F87DE19D36C6CF /* UserDefaultsExtensions.swift */,\n\t\t\t\tDA2D30645119FB37069C6C54A99A4265 /* AppKit */,\n\t\t\t\t6FF750DE262983C50022B14283BEDC43 /* CoreAnimation */,\n\t\t\t\tD3ECEEF3CC51BAA80DB99EC017BA9385 /* CoreGraphics */,\n\t\t\t\tFF241B031FB76F0B33B95D8B48C704D7 /* CoreLocation */,\n\t\t\t\t09D45F274C0BCF1F0EAF5A62E85870EE /* Dispatch */,\n\t\t\t\t8949DD494B05BAFA1D8F0866B7C5E251 /* Foundation */,\n\t\t\t\tDC43686BA92B7EE9623B7D88377172DB /* MapKit */,\n\t\t\t\tFB5F0B32326AC2E3D365B7F98F0B4781 /* SceneKit */,\n\t\t\t\tE3F89D354A8A79220B9DD9B9A74BCCBD /* SpriteKit */,\n\t\t\t\t8536424DC0FC8CCB595CC6F8400A41A4 /* StoreKit */,\n\t\t\t\tB6EA7C28688A8F621072B79EF1F7EBF7 /* Support Files */,\n\t\t\t\t252184C9937BF04C8C175F48E142DC16 /* SwiftStdlib */,\n\t\t\t\t4CDA0020315339C3E2E44135A0C38D20 /* UIKit */,\n\t\t\t);\n\t\t\tname = SwifterSwift;\n\t\t\tpath = SwifterSwift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8536424DC0FC8CCB595CC6F8400A41A4 /* StoreKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = StoreKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8949DD494B05BAFA1D8F0866B7C5E251 /* Foundation */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = Foundation;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB6EA7C28688A8F621072B79EF1F7EBF7 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7F16F0AFDC2F153DB390FA481C6CA674 /* SwifterSwift.modulemap */,\n\t\t\t\t4082B1964B4057753713F19AA9DA5E68 /* SwifterSwift-dummy.m */,\n\t\t\t\t6F2EFB40A354412DEB57740124966124 /* SwifterSwift-Info.plist */,\n\t\t\t\t372F4FBE84F0525B54F5E1289553BC79 /* SwifterSwift-prefix.pch */,\n\t\t\t\tBE2BF4C7CC79826758773F2D7AC81C82 /* SwifterSwift-umbrella.h */,\n\t\t\t\t97D8DA6CB02ED5125505335D2CCA262A /* SwifterSwift.debug.xcconfig */,\n\t\t\t\t1900A0055F0FD7FC2A2F0CD15D34DC84 /* SwifterSwift.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/SwifterSwift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD3ECEEF3CC51BAA80DB99EC017BA9385 /* CoreGraphics */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = CoreGraphics;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDA2D30645119FB37069C6C54A99A4265 /* AppKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = AppKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDC43686BA92B7EE9623B7D88377172DB /* MapKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = MapKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE3F89D354A8A79220B9DD9B9A74BCCBD /* SpriteKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = SpriteKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tFB5F0B32326AC2E3D365B7F98F0B4781 /* SceneKit */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = SceneKit;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tFF241B031FB76F0B33B95D8B48C704D7 /* CoreLocation */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = CoreLocation;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t0AF2C65D674CF7CF72C0A619932EC405 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tFAB79DE5A9A0DDA6110AEFE4DAC792E3 /* SwifterSwift-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t480FE5A632FE83D1C34E3D143792B43C /* SwifterSwift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = BCE753E9843F3AB9722F2FB8CF09021E /* Build configuration list for PBXNativeTarget \"SwifterSwift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t0AF2C65D674CF7CF72C0A619932EC405 /* Headers */,\n\t\t\t\t24D6BAA63EF8681DF6B37FCF19B5C97B /* Sources */,\n\t\t\t\t1C2CB0681C86445FB40D30DACAD4C258 /* Frameworks */,\n\t\t\t\t8D3C53FAD5927D1BE6CDCE9C32EAA6A8 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = SwifterSwift;\n\t\t\tproductName = SwifterSwift;\n\t\t\tproductReference = C3E7BFD79922D2545166916876E56FD5 /* SwifterSwift */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t51965990A9A124C29BB3ED953766EFC7 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = B035FDBAFC404E09999CF952AEF4D8D6 /* Build configuration list for PBXProject \"SwifterSwift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 1EA955DCC84A3AA272E92497F65A2943;\n\t\t\tproductRefGroup = 4050E7EE49EB8280C661940FCC028127 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t480FE5A632FE83D1C34E3D143792B43C /* SwifterSwift */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t8D3C53FAD5927D1BE6CDCE9C32EAA6A8 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t24D6BAA63EF8681DF6B37FCF19B5C97B /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t72D14DC232192E1F1CC5753A27392D6B /* ArrayExtensions.swift in Sources */,\n\t\t\t\t1AE8E1AD45DDCB97CEE21FFAB7D28345 /* BidirectionalCollectionExtensions.swift in Sources */,\n\t\t\t\t9491F6FC214E6BF6264DEE0D895A9E32 /* BinaryFloatingPointExtensions.swift in Sources */,\n\t\t\t\t2918EE1385CEC0C8CA3951A35718AD4D /* BoolExtensions.swift in Sources */,\n\t\t\t\t439531DBBD2CD9AC1084835C1AB9D863 /* CAGradientLayerExtensions.swift in Sources */,\n\t\t\t\t775826A7565BF8E0DB96E8C92B94F871 /* CalendarExtensions.swift in Sources */,\n\t\t\t\t95766F1D9480E13E3FDB3E1C7F06B902 /* CATransform3DExtensions.swift in Sources */,\n\t\t\t\t4100B04283FBD77405F68111C2F6BCD1 /* CGAffineTransformExtensions.swift in Sources */,\n\t\t\t\t218E5326F4787C9D54B26B79D5B83F48 /* CGColorExtensions.swift in Sources */,\n\t\t\t\t6A31FF4F9A55302C61EF75EEFD35C92A /* CGFloatExtensions.swift in Sources */,\n\t\t\t\t2321CE61C077A5A701CACCA6203F8CE3 /* CGPointExtensions.swift in Sources */,\n\t\t\t\t75C339D908FCA80DEB948BC41D3B9621 /* CGRectExtensions.swift in Sources */,\n\t\t\t\t13499163560520F8B4050FFEF84C0E84 /* CGSizeExtensions.swift in Sources */,\n\t\t\t\tAEF83650746F38895C6F7B21FF325CFB /* CGVectorExtensions.swift in Sources */,\n\t\t\t\t825ABFBDE1C9DA71D6D121B5371843F8 /* CharacterExtensions.swift in Sources */,\n\t\t\t\t5E9DD323AE7FFDC4E4F8901DE7F6BD6F /* CLLocationArrayExtensions.swift in Sources */,\n\t\t\t\t5EBC1F1F8DBECBB3EC1AB9956B50ED8E /* CLLocationExtensions.swift in Sources */,\n\t\t\t\t175DB1053FA9CE2BD9FE0D0BD0254DC3 /* CLVisitExtensions.swift in Sources */,\n\t\t\t\t0F62DFAF753D55EDDD354DF4E109524D /* CollectionExtensions.swift in Sources */,\n\t\t\t\t24068E23BB105AA1E2E1B1D0D38C2F05 /* ColorExtensions.swift in Sources */,\n\t\t\t\tA2786EEF1693912AE814A6785AD9EDBA /* ComparableExtensions.swift in Sources */,\n\t\t\t\tCC984A78A132F0334BC30997B0877385 /* DataExtensions.swift in Sources */,\n\t\t\t\t71E2302F9518855C23FB787A2F276CA7 /* DateExtensions.swift in Sources */,\n\t\t\t\t517A98D6A26F35FBB8E5212F1F0B30DE /* DecodableExtensions.swift in Sources */,\n\t\t\t\tE9A49B82523887E554F2C53B60C98DFE /* DictionaryExtensions.swift in Sources */,\n\t\t\t\t3420881E860560553A7C4D1D830E9EFB /* DispatchQueueExtensions.swift in Sources */,\n\t\t\t\t7178911787E3EC7497CF75265D735626 /* DoubleExtensions.swift in Sources */,\n\t\t\t\t5B05CE019FDA65D780C88EEF1F7ADA40 /* EdgeInsetsExtensions.swift in Sources */,\n\t\t\t\tDC89265A7CEFBA540B83A9EE80743444 /* FileManagerExtensions.swift in Sources */,\n\t\t\t\tF7E6489CD2AA97160BBF965D7FCE9EAE /* FloatExtensions.swift in Sources */,\n\t\t\t\tEC37FDF83867FF75E6B2F8E1A3BC0F7E /* FloatingPointExtensions.swift in Sources */,\n\t\t\t\t14F2F38BA898987A3C9BB42C91E2760B /* IntExtensions.swift in Sources */,\n\t\t\t\tE7BA717E905FB466C590F82D2678DC3F /* KeyedDecodingContainerExtensions.swift in Sources */,\n\t\t\t\t07EA34BA5BE9B97AEFC21F035C491D55 /* LocaleExtensions.swift in Sources */,\n\t\t\t\t795FFA64B92824C1F216D0E44C28EBF5 /* MKMapViewExtensions.swift in Sources */,\n\t\t\t\t111A72E7C6FDF2180B004F6ED44AF41F /* MKPolylineExtensions.swift in Sources */,\n\t\t\t\tC82E1F635BE16DB13EE84170111D5B43 /* MutableCollectionExtensions.swift in Sources */,\n\t\t\t\t8FEC6BD040A6B6A4B94041B2AA83FF48 /* NotificationCenterExtensions.swift in Sources */,\n\t\t\t\tBCFBA55AC384A970A2061406DE0E0A54 /* NSAttributedStringExtensions.swift in Sources */,\n\t\t\t\t97250638352ACDCD8D1A061BCF67461D /* NSColorExtensions.swift in Sources */,\n\t\t\t\tD6D24DA1A68A850F427E829C9DAF6DB7 /* NSImageExtensions.swift in Sources */,\n\t\t\t\t7BD7208E1E33605F855D79CCAF064BDF /* NSPredicateExtensions.swift in Sources */,\n\t\t\t\t552673953BD6FC91987BF1395578A0F0 /* NSRegularExpressionExtensions.swift in Sources */,\n\t\t\t\t5239AEFA621DA2C574DCA9C5C79669C7 /* NSViewExtensions.swift in Sources */,\n\t\t\t\tEAF800C24C4325406BED1BB76A706557 /* OptionalExtensions.swift in Sources */,\n\t\t\t\t782D8FD93A4793B4B54A48A36A25E5C7 /* RandomAccessCollectionExtensions.swift in Sources */,\n\t\t\t\tA22BA32DFC8A4CAC3ABC62B529D73488 /* RangeReplaceableCollectionExtensions.swift in Sources */,\n\t\t\t\tF518834379772EE5069D62B8EB881F00 /* SCNBoxExtensions.swift in Sources */,\n\t\t\t\t0AAB0088F0554CFBED8D391FDF3C3539 /* SCNCapsuleExtensions.swift in Sources */,\n\t\t\t\tEAB799EB9FFE5102852925AB8940564D /* SCNConeExtensions.swift in Sources */,\n\t\t\t\tFD8F1D2703C5DB87EA4A27F031EEF82E /* SCNCylinderExtensions.swift in Sources */,\n\t\t\t\t0CBDCAC389F00121CC337E375C2AF667 /* SCNGeometryExtensions.swift in Sources */,\n\t\t\t\t2FBDC589C66A74D1A8B250E9E17405A4 /* SCNMaterialExtensions.swift in Sources */,\n\t\t\t\t79D687E344534317A3D139ECAA46302D /* SCNPlaneExtensions.swift in Sources */,\n\t\t\t\t8121F09E6B03CF7E6F312C06A6EC748D /* SCNShapeExtensions.swift in Sources */,\n\t\t\t\tF6F3B08650F9E5DA1D1A905B2BF42518 /* SCNSphereExtensions.swift in Sources */,\n\t\t\t\t6D556BE5CD6A49E57E62B2701F46B8BB /* SCNVector3Extensions.swift in Sources */,\n\t\t\t\t932D82DEC397AF2C3581D2F3B7D2ABA3 /* SequenceExtensions.swift in Sources */,\n\t\t\t\t83490435DF0BFE10E5C91885EF8AF568 /* SignedIntegerExtensions.swift in Sources */,\n\t\t\t\tF1CD4C012EE244450A25885BB6960831 /* SignedNumericExtensions.swift in Sources */,\n\t\t\t\t92F7E733B76493867F3D07D90CA4F3DC /* SKNodeExtensions.swift in Sources */,\n\t\t\t\t77FE0D8763867E669155617F0B93E297 /* SKProductExtensions.swift in Sources */,\n\t\t\t\t786B4EA5A038B57A5102F8D430985D52 /* StdlibDeprecated.swift in Sources */,\n\t\t\t\tF683F35D64B7E7BE7910DE75644F94B0 /* StringExtensions.swift in Sources */,\n\t\t\t\t8D557A151174CA1C5E5E6093CA8754C0 /* StringProtocolExtensions.swift in Sources */,\n\t\t\t\t2EDFF7BCC44E324E761D16DAB43E450E /* SwifterSwift-dummy.m in Sources */,\n\t\t\t\tDFB980CF78B1FA065F3A5CE8D967FFB6 /* UIActivityExtensions.swift in Sources */,\n\t\t\t\t4AC9316A34881CDA256F5ED70C5E4802 /* UIAlertControllerExtensions.swift in Sources */,\n\t\t\t\tF4801477E956ED32EAF2B2F10FCB2CC4 /* UIApplicationExtensions.swift in Sources */,\n\t\t\t\tD9B29DBA992652124F22B77E88BB8175 /* UIBarButtonItemExtensions.swift in Sources */,\n\t\t\t\t562C37E302E7B276FEDDE4E12B8E2529 /* UIBezierPathExtensions.swift in Sources */,\n\t\t\t\t5BC092B1771A2008C13B17F0094A84EC /* UIButtonExtensions.swift in Sources */,\n\t\t\t\t6CCCD46A77D45150BB045DAE0403F5D0 /* UICollectionViewExtensions.swift in Sources */,\n\t\t\t\t1656946797E7AAD38BDAACEA7AC8EA1F /* UIColorExtensions.swift in Sources */,\n\t\t\t\tDD014204D6653020B552CF7040B457D1 /* UIDatePickerExtensions.swift in Sources */,\n\t\t\t\t9872F9B4D19118084E21FBCF6822E97E /* UIFontExtensions.swift in Sources */,\n\t\t\t\t432E981674837E39A577E90B9F394EC9 /* UIGestureRecognizerExtensions.swift in Sources */,\n\t\t\t\t0D922CC19608EB07EE21A4F253D100E3 /* UIImageExtensions.swift in Sources */,\n\t\t\t\t6C4AA88C1F2E94125A694DB9FD432F96 /* UIImageViewExtensions.swift in Sources */,\n\t\t\t\t22AC24E6DA3D9330E2166AEB446E5707 /* UILabelExtensions.swift in Sources */,\n\t\t\t\t6BBCCADE90A67FAA3A894A43A2C71B63 /* UILayoutPriorityExtensions.swift in Sources */,\n\t\t\t\tE7BAFD365B0E10E46AF1FBC048EBE0AB /* UINavigationBarExtensions.swift in Sources */,\n\t\t\t\t4F179B540566B805F45D879113E97A56 /* UINavigationControllerExtensions.swift in Sources */,\n\t\t\t\t70243DF7F77AAEE4CF7C408643BEAD21 /* UINavigationItemExtensions.swift in Sources */,\n\t\t\t\tD121D7E529242400ABFD6779967B71B7 /* UIRefreshControlExtensions.swift in Sources */,\n\t\t\t\tEEFA37D89A0EDDC560C9C85925F6CA46 /* UIScrollViewExtensions.swift in Sources */,\n\t\t\t\tCF4B40ACF2D0EBABF294E857405A8731 /* UISearchBarExtensions.swift in Sources */,\n\t\t\t\t96DEF1684B8029C6EDDBAD71F7DCD6EC /* UISegmentedControlExtensions.swift in Sources */,\n\t\t\t\tA866E7A41110C36E678B6E7E7F519BE2 /* UISliderExtensions.swift in Sources */,\n\t\t\t\t3039712B6792D9194A6A707B1C997762 /* UIStackViewExtensions.swift in Sources */,\n\t\t\t\t1A34A8781F259CD72C4DA9315064868C /* UIStoryboardExtensions.swift in Sources */,\n\t\t\t\t4613FD2CF78609995491E56C211B68F0 /* UISwitchExtensions.swift in Sources */,\n\t\t\t\t62DFCE85125759A95E824E2B7930800C /* UITabBarExtensions.swift in Sources */,\n\t\t\t\tFBC9A1A33320B9914F951B23B2E23498 /* UITableViewExtensions.swift in Sources */,\n\t\t\t\tBACECD65B0600451C280C42D23B21FB0 /* UITextFieldExtensions.swift in Sources */,\n\t\t\t\t9C91D78BD8565C4C667DBD8321860470 /* UITextViewExtensions.swift in Sources */,\n\t\t\t\tC9B88453E903714E2E97A2D9E7E47D4E /* UIViewControllerExtensions.swift in Sources */,\n\t\t\t\t93E5D4AFCF456D239A1C4D93252425E8 /* UIViewExtensions.swift in Sources */,\n\t\t\t\t1C6B4D930A70308B15BB15415B06EA7F /* UIWindowExtensions.swift in Sources */,\n\t\t\t\t7E8B7D216EAA941BDC5B5DD85B33CFE4 /* URLExtensions.swift in Sources */,\n\t\t\t\t03EB7307E9C51C4BF3DA3E4D0C348544 /* URLRequestExtensions.swift in Sources */,\n\t\t\t\t7D47491F730D6EBF3E321AB4460959D8 /* UserDefaultsExtensions.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t029D75D552967FAC945A9BFA2050AF98 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 97D8DA6CB02ED5125505335D2CCA262A /* SwifterSwift.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SwifterSwift/SwifterSwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SwifterSwift/SwifterSwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SwifterSwift/SwifterSwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SwifterSwift;\n\t\t\t\tPRODUCT_NAME = SwifterSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t7057D08AABFD809FD326576FA97E9730 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tA497C7C53459B4B15C644F70ED20805E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tF17B13D65CDA6DB28BDAB85852B2C9AB /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 1900A0055F0FD7FC2A2F0CD15D34DC84 /* SwifterSwift.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = NO;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SwifterSwift/SwifterSwift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SwifterSwift/SwifterSwift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 10.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SwifterSwift/SwifterSwift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SwifterSwift;\n\t\t\t\tPRODUCT_NAME = SwifterSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.1;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tB035FDBAFC404E09999CF952AEF4D8D6 /* Build configuration list for PBXProject \"SwifterSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA497C7C53459B4B15C644F70ED20805E /* Debug */,\n\t\t\t\t7057D08AABFD809FD326576FA97E9730 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tBCE753E9843F3AB9722F2FB8CF09021E /* Build configuration list for PBXNativeTarget \"SwifterSwift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t029D75D552967FAC945A9BFA2050AF98 /* Debug */,\n\t\t\t\tF17B13D65CDA6DB28BDAB85852B2C9AB /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 51965990A9A124C29BB3ED953766EFC7 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftyJSON/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2017 Ruoyu Fu\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/SwiftyJSON/README.md",
    "content": "# SwiftyJSON\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) ![CocoaPods](https://img.shields.io/cocoapods/v/SwiftyJSON.svg) ![Platform](https://img.shields.io/badge/platforms-iOS%208.0%20%7C%20macOS%2010.10%20%7C%20tvOS%209.0%20%7C%20watchOS%203.0-F28D00.svg) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)\n\nSwiftyJSON makes it easy to deal with JSON data in Swift.\n\nPlatform | Build Status\n---------| --------------| \n*OS      | [![Travis CI](https://travis-ci.org/SwiftyJSON/SwiftyJSON.svg?branch=master)](https://travis-ci.org/SwiftyJSON/SwiftyJSON)    | \n[Linux](https://github.com/IBM-Swift/SwiftyJSON)      | [![Build Status](https://travis-ci.org/IBM-Swift/SwiftyJSON.svg?branch=master)](https://travis-ci.org/IBM-Swift/SwiftyJSON)     | \n\n\n1. [Why is the typical JSON handling in Swift NOT good](#why-is-the-typical-json-handling-in-swift-not-good)\n2. [Requirements](#requirements)\n3. [Integration](#integration)\n4. [Usage](#usage)\n   - [Initialization](#initialization)\n   - [Subscript](#subscript)\n   - [Loop](#loop)\n   - [Error](#error)\n   - [Optional getter](#optional-getter)\n   - [Non-optional getter](#non-optional-getter)\n   - [Setter](#setter)\n   - [Raw object](#raw-object)\n   - [Literal convertibles](#literal-convertibles)\n   - [Merging](#merging)\n5. [Work with Alamofire](#work-with-alamofire)\n6. [Work with Moya](#work-with-moya)\n7. [SwiftyJSON Model Generator](#swiftyjson-model-generator)\n\n\n## Why is the typical JSON handling in Swift NOT good?\n\nSwift is very strict about types. But although explicit typing is good for saving us from mistakes, it becomes painful when dealing with JSON and other areas that are, by nature, implicit about types.\n\nTake the Twitter API for example. Say we want to retrieve a user's \"name\" value of some tweet in Swift (according to [Twitter's API](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline)).\n\nThe code would look like this:\n\n```swift\nif let statusesArray = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [[String: Any]],\n    let user = statusesArray[0][\"user\"] as? [String: Any],\n    let username = user[\"name\"] as? String {\n    // Finally we got the username\n}\n```\n\nIt's not good.\n\nEven if we use optional chaining, it would be messy:\n\n```swift\nif let JSONObject = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [[String: Any]],\n    let username = (JSONObject[0][\"user\"] as? [String: Any])?[\"name\"] as? String {\n        // There's our username\n}\n```\n\nAn unreadable mess--for something that should really be simple!\n\nWith SwiftyJSON all you have to do is:\n\n```swift\nlet json = JSON(data: dataFromNetworking)\nif let userName = json[0][\"user\"][\"name\"].string {\n  //Now you got your value\n}\n```\n\nAnd don't worry about the Optional Wrapping thing. It's done for you automatically.\n\n```swift\nlet json = JSON(data: dataFromNetworking)\nlet result = json[999999][\"wrong_key\"][\"wrong_name\"]\nif let userName = result.string {\n    //Calm down, take it easy, the \".string\" property still produces the correct Optional String type with safety\n} else {\n    //Print the error\n    print(result.error)\n}\n```\n\n## Requirements\n\n- iOS 8.0+ | macOS 10.10+ | tvOS 9.0+ | watchOS 2.0+\n- Xcode 8\n\n## Integration\n\n#### CocoaPods (iOS 8+, OS X 10.9+)\n\nYou can use [CocoaPods](http://cocoapods.org/) to install `SwiftyJSON` by adding it to your `Podfile`:\n\n```ruby\nplatform :ios, '8.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n    pod 'SwiftyJSON', '~> 4.0'\nend\n```\n\n#### Carthage (iOS 8+, OS X 10.9+)\n\nYou can use [Carthage](https://github.com/Carthage/Carthage) to install `SwiftyJSON` by adding it to your `Cartfile`:\n\n```\ngithub \"SwiftyJSON/SwiftyJSON\" ~> 4.0\n```\n\nIf you use Carthage to build your dependencies, make sure you have added `SwiftyJSON.framework` to the \"Linked Frameworks and Libraries\" section of your target, and have included them in your Carthage framework copying build phase.\n\n#### Swift Package Manager\n\nYou can use [The Swift Package Manager](https://swift.org/package-manager) to install `SwiftyJSON` by adding the proper description to your `Package.swift` file:\n\n```swift\n// swift-tools-version:4.0\nimport PackageDescription\n\nlet package = Package(\n    name: \"YOUR_PROJECT_NAME\",\n    dependencies: [\n        .package(url: \"https://github.com/SwiftyJSON/SwiftyJSON.git\", from: \"4.0.0\"),\n    ]\n)\n```\nThen run `swift build` whenever you get prepared.\n\n#### Manually (iOS 7+, OS X 10.9+)\n\nTo use this library in your project manually you may:  \n\n1. for Projects, just drag SwiftyJSON.swift to the project tree\n2. for Workspaces, include the whole SwiftyJSON.xcodeproj\n\n## Usage\n\n#### Initialization\n\n```swift\nimport SwiftyJSON\n```\n\n```swift\nlet json = JSON(data: dataFromNetworking)\n```\nOr\n\n```swift\nlet json = JSON(jsonObject)\n```\nOr\n\n```swift\nif let dataFromString = jsonString.data(using: .utf8, allowLossyConversion: false) {\n    let json = JSON(data: dataFromString)\n}\n```\n\n#### Subscript\n\n```swift\n// Getting a double from a JSON Array\nlet name = json[0].double\n```\n\n```swift\n// Getting an array of string from a JSON Array\nlet arrayNames =  json[\"users\"].arrayValue.map {$0[\"name\"].stringValue}\n```\n\n```swift\n// Getting a string from a JSON Dictionary\nlet name = json[\"name\"].stringValue\n```\n\n```swift\n// Getting a string using a path to the element\nlet path: [JSONSubscriptType] = [1,\"list\",2,\"name\"]\nlet name = json[path].string\n// Just the same\nlet name = json[1][\"list\"][2][\"name\"].string\n// Alternatively\nlet name = json[1,\"list\",2,\"name\"].string\n```\n\n```swift\n// With a hard way\nlet name = json[].string\n```\n\n```swift\n// With a custom way\nlet keys:[JSONSubscriptType] = [1,\"list\",2,\"name\"]\nlet name = json[keys].string\n```\n\n#### Loop\n\n```swift\n// If json is .Dictionary\nfor (key,subJson):(String, JSON) in json {\n   // Do something you want\n}\n```\n\n*The first element is always a String, even if the JSON is an Array*\n\n```swift\n// If json is .Array\n// The `index` is 0..<json.count's string value\nfor (index,subJson):(String, JSON) in json {\n    // Do something you want\n}\n```\n\n#### Error\n\n##### SwiftyJSON 4.x\n\nSwiftyJSON 4.x introduces an enum type called `SwiftyJSONError`, which includes `unsupportedType`, `indexOutOfBounds`, `elementTooDeep`, `wrongType`, `notExist` and `invalidJSON`, at the same time, `ErrorDomain` are being replaced by `SwiftyJSONError.errorDomain`.\nNote: Those old error types are deprecated in SwiftyJSON 4.x and will be removed in the future release.\n\n##### SwiftyJSON 3.x\n\nUse a subscript to get/set a value in an Array or Dictionary\n\nIf the JSON is:\n*  an array, the app may crash with \"index out-of-bounds.\"\n*  a dictionary, it will be assigned to `nil` without a reason.\n*  not an array or a dictionary, the app may crash with an \"unrecognised selector\" exception.\n\nThis will never happen in SwiftyJSON.\n\n```swift\nlet json = JSON([\"name\", \"age\"])\nif let name = json[999].string {\n    // Do something you want\n} else {\n    print(json[999].error!) // \"Array[999] is out of bounds\"\n}\n```\n\n```swift\nlet json = JSON([\"name\":\"Jack\", \"age\": 25])\nif let name = json[\"address\"].string {\n    // Do something you want\n} else {\n    print(json[\"address\"].error!) // \"Dictionary[\"address\"] does not exist\"\n}\n```\n\n```swift\nlet json = JSON(12345)\nif let age = json[0].string {\n    // Do something you want\n} else {\n    print(json[0])       // \"Array[0] failure, It is not an array\"\n    print(json[0].error!) // \"Array[0] failure, It is not an array\"\n}\n\nif let name = json[\"name\"].string {\n    // Do something you want\n} else {\n    print(json[\"name\"])       // \"Dictionary[\\\"name\"] failure, It is not an dictionary\"\n    print(json[\"name\"].error!) // \"Dictionary[\\\"name\"] failure, It is not an dictionary\"\n}\n```\n\n#### Optional getter\n\n```swift\n// NSNumber\nif let id = json[\"user\"][\"favourites_count\"].number {\n   // Do something you want\n} else {\n   // Print the error\n   print(json[\"user\"][\"favourites_count\"].error!)\n}\n```\n\n```swift\n// String\nif let id = json[\"user\"][\"name\"].string {\n   // Do something you want\n} else {\n   // Print the error\n   print(json[\"user\"][\"name\"].error!)\n}\n```\n\n```swift\n// Bool\nif let id = json[\"user\"][\"is_translator\"].bool {\n   // Do something you want\n} else {\n   // Print the error\n   print(json[\"user\"][\"is_translator\"].error!)\n}\n```\n\n```swift\n// Int\nif let id = json[\"user\"][\"id\"].int {\n   // Do something you want\n} else {\n   // Print the error\n   print(json[\"user\"][\"id\"].error!)\n}\n...\n```\n\n#### Non-optional getter\n\nNon-optional getter is named `xxxValue`\n\n```swift\n// If not a Number or nil, return 0\nlet id: Int = json[\"id\"].intValue\n```\n\n```swift\n// If not a String or nil, return \"\"\nlet name: String = json[\"name\"].stringValue\n```\n\n```swift\n// If not an Array or nil, return []\nlet list: Array<JSON> = json[\"list\"].arrayValue\n```\n\n```swift\n// If not a Dictionary or nil, return [:]\nlet user: Dictionary<String, JSON> = json[\"user\"].dictionaryValue\n```\n\n#### Setter\n\n```swift\njson[\"name\"] = JSON(\"new-name\")\njson[0] = JSON(1)\n```\n\n```swift\njson[\"id\"].int =  1234567890\njson[\"coordinate\"].double =  8766.766\njson[\"name\"].string =  \"Jack\"\njson.arrayObject = [1,2,3,4]\njson.dictionaryObject = [\"name\":\"Jack\", \"age\":25]\n```\n\n#### Raw object\n\n```swift\nlet rawObject: Any = json.object\n```\n\n```swift\nlet rawValue: Any = json.rawValue\n```\n\n```swift\n//convert the JSON to raw NSData\ndo {\n\tlet rawData = try json.rawData()\n  //Do something you want\n} catch {\n\tprint(\"Error \\(error)\")\n}\n```\n\n```swift\n//convert the JSON to a raw String\nif let rawString = json.rawString() {\n  //Do something you want\n} else {\n\tprint(\"json.rawString is nil\")\n}\n```\n\n#### Existence\n\n```swift\n// shows you whether value specified in JSON or not\nif json[\"name\"].exists()\n```\n\n#### Literal convertibles\n\nFor more info about literal convertibles: [Swift Literal Convertibles](http://nshipster.com/swift-literal-convertible/)\n\n```swift\n// StringLiteralConvertible\nlet json: JSON = \"I'm a json\"\n```\n\n```swift\n/ /IntegerLiteralConvertible\nlet json: JSON =  12345\n```\n\n```swift\n// BooleanLiteralConvertible\nlet json: JSON =  true\n```\n\n```swift\n// FloatLiteralConvertible\nlet json: JSON =  2.8765\n```\n\n```swift\n// DictionaryLiteralConvertible\nlet json: JSON =  [\"I\":\"am\", \"a\":\"json\"]\n```\n\n```swift\n// ArrayLiteralConvertible\nlet json: JSON =  [\"I\", \"am\", \"a\", \"json\"]\n```\n\n```swift\n// With subscript in array\nvar json: JSON =  [1,2,3]\njson[0] = 100\njson[1] = 200\njson[2] = 300\njson[999] = 300 // Don't worry, nothing will happen\n```\n\n```swift\n// With subscript in dictionary\nvar json: JSON =  [\"name\": \"Jack\", \"age\": 25]\njson[\"name\"] = \"Mike\"\njson[\"age\"] = \"25\" // It's OK to set String\njson[\"address\"] = \"L.A.\" // Add the \"address\": \"L.A.\" in json\n```\n\n```swift\n// Array & Dictionary\nvar json: JSON =  [\"name\": \"Jack\", \"age\": 25, \"list\": [\"a\", \"b\", \"c\", [\"what\": \"this\"]]]\njson[\"list\"][3][\"what\"] = \"that\"\njson[\"list\",3,\"what\"] = \"that\"\nlet path: [JSONSubscriptType] = [\"list\",3,\"what\"]\njson[path] = \"that\"\n```\n\n```swift\n// With other JSON objects\nlet user: JSON = [\"username\" : \"Steve\", \"password\": \"supersecurepassword\"]\nlet auth: JSON = [\n  \"user\": user.object, // use user.object instead of just user\n  \"apikey\": \"supersecretapitoken\"\n]\n```\n\n#### Merging\n\nIt is possible to merge one JSON into another JSON. Merging a JSON into another JSON adds all non existing values to the original JSON which are only present in the `other` JSON.\n\nIf both JSONs contain a value for the same key, _mostly_ this value gets overwritten in the original JSON, but there are two cases where it provides some special treatment:\n\n- In case of both values being a `JSON.Type.array` the values form the array found in the `other` JSON getting appended to the original JSON's array value.\n- In case of both values being a `JSON.Type.dictionary` both JSON-values are getting merged the same way the encapsulating JSON is merged.\n\nIn a case where two fields in a JSON have different types, the value will get always overwritten.\n\nThere are two different fashions for merging: `merge` modifies the original JSON, whereas `merged` works non-destructively on a copy.\n\n```swift\nlet original: JSON = [\n    \"first_name\": \"John\",\n    \"age\": 20,\n    \"skills\": [\"Coding\", \"Reading\"],\n    \"address\": [\n        \"street\": \"Front St\",\n        \"zip\": \"12345\",\n    ]\n]\n\nlet update: JSON = [\n    \"last_name\": \"Doe\",\n    \"age\": 21,\n    \"skills\": [\"Writing\"],\n    \"address\": [\n        \"zip\": \"12342\",\n        \"city\": \"New York City\"\n    ]\n]\n\nlet updated = original.merge(with: update)\n// [\n//     \"first_name\": \"John\",\n//     \"last_name\": \"Doe\",\n//     \"age\": 21,\n//     \"skills\": [\"Coding\", \"Reading\", \"Writing\"],\n//     \"address\": [\n//         \"street\": \"Front St\",\n//         \"zip\": \"12342\",\n//         \"city\": \"New York City\"\n//     ]\n// ]\n```\n\n## String representation\nThere are two options available:\n- use the default Swift one\n- use a custom one that will handle optionals well and represent `nil` as `\"null\"`:\n```swift\nlet dict = [\"1\":2, \"2\":\"two\", \"3\": nil] as [String: Any?]\nlet json = JSON(dict)\nlet representation = json.rawString(options: [.castNilToNSNull: true])\n// representation is \"{\\\"1\\\":2,\\\"2\\\":\\\"two\\\",\\\"3\\\":null}\", which represents {\"1\":2,\"2\":\"two\",\"3\":null}\n```\n\n## Work with [Alamofire](https://github.com/Alamofire/Alamofire)\n\nSwiftyJSON nicely wraps the result of the Alamofire JSON response handler:\n\n```swift\nAlamofire.request(url, method: .get).validate().responseJSON { response in\n    switch response.result {\n    case .success(let value):\n        let json = JSON(value)\n        print(\"JSON: \\(json)\")\n    case .failure(let error):\n        print(error)\n    }\n}\n```\n\nWe also provide an extension of Alamofire for serializing NSData to SwiftyJSON's JSON.\n\nSee: [Alamofire-SwiftyJSON](https://github.com/SwiftyJSON/Alamofire-SwiftyJSON)\n\n\n## Work with [Moya](https://github.com/Moya/Moya)\n\nSwiftyJSON parse data to JSON:\n\n```swift\nlet provider = MoyaProvider<Backend>()\nprovider.request(.showProducts) { result in\n    switch result {\n    case let .success(moyaResponse):\n        let data = moyaResponse.data\n        let json = JSON(data: data) // convert network data to json\n        print(json)\n    case let .failure(error):\n        print(\"error: \\(error)\")\n    }\n}\n\n```\n\n## SwiftyJSON Model Generator\nTools to generate SwiftyJSON Models\n* [JSON Cafe](http://www.jsoncafe.com/)\n* [JSON Export](https://github.com/Ahmed-Ali/JSONExport)\n"
  },
  {
    "path": "JetChat/Pods/SwiftyJSON/Source/SwiftyJSON/SwiftyJSON.swift",
    "content": "//  SwiftyJSON.swift\n//\n//  Copyright (c) 2014 - 2017 Ruoyu Fu, Pinglin Tang\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n\nimport Foundation\n\n// MARK: - Error\n// swiftlint:disable line_length\npublic enum SwiftyJSONError: Int, Swift.Error {\n    case unsupportedType = 999\n    case indexOutOfBounds = 900\n    case elementTooDeep = 902\n    case wrongType = 901\n    case notExist = 500\n    case invalidJSON = 490\n}\n\nextension SwiftyJSONError: CustomNSError {\n\n    /// return the error domain of SwiftyJSONError\n    public static var errorDomain: String { return \"com.swiftyjson.SwiftyJSON\" }\n\n    /// return the error code of SwiftyJSONError\n    public var errorCode: Int { return self.rawValue }\n\n    /// return the userInfo of SwiftyJSONError\n    public var errorUserInfo: [String: Any] {\n        switch self {\n        case .unsupportedType:\n            return [NSLocalizedDescriptionKey: \"It is an unsupported type.\"]\n        case .indexOutOfBounds:\n            return [NSLocalizedDescriptionKey: \"Array Index is out of bounds.\"]\n        case .wrongType:\n            return [NSLocalizedDescriptionKey: \"Couldn't merge, because the JSONs differ in type on top level.\"]\n        case .notExist:\n            return [NSLocalizedDescriptionKey: \"Dictionary key does not exist.\"]\n        case .invalidJSON:\n            return [NSLocalizedDescriptionKey: \"JSON is invalid.\"]\n        case .elementTooDeep:\n            return [NSLocalizedDescriptionKey: \"Element too deep. Increase maxObjectDepth and make sure there is no reference loop.\"]\n        }\n    }\n}\n\n// MARK: - JSON Type\n\n/**\nJSON's type definitions.\n\nSee http://www.json.org\n*/\npublic enum Type: Int {\n\tcase number\n\tcase string\n\tcase bool\n\tcase array\n\tcase dictionary\n\tcase null\n\tcase unknown\n}\n\n// MARK: - JSON Base\n\npublic struct JSON {\n\n\t/**\n\t Creates a JSON using the data.\n\t\n\t - parameter data: The NSData used to convert to json.Top level object in data is an NSArray or NSDictionary\n\t - parameter opt: The JSON serialization reading options. `[]` by default.\n\t\n\t - returns: The created JSON\n\t */\n    public init(data: Data, options opt: JSONSerialization.ReadingOptions = []) throws {\n        let object: Any = try JSONSerialization.jsonObject(with: data, options: opt)\n        self.init(jsonObject: object)\n    }\n\n    /**\n\t Creates a JSON object\n\t - note: this does not parse a `String` into JSON, instead use `init(parseJSON: String)`\n\t\n\t - parameter object: the object\n\n\t - returns: the created JSON object\n\t */\n    public init(_ object: Any) {\n        switch object {\n        case let object as Data:\n            do {\n                try self.init(data: object)\n            } catch {\n                self.init(jsonObject: NSNull())\n            }\n        default:\n            self.init(jsonObject: object)\n        }\n    }\n\n\t/**\n\t Parses the JSON string into a JSON object\n\t\n\t - parameter json: the JSON string\n\t\n\t - returns: the created JSON object\n\t*/\n\tpublic init(parseJSON jsonString: String) {\n\t\tif let data = jsonString.data(using: .utf8) {\n\t\t\tself.init(data)\n\t\t} else {\n\t\t\tself.init(NSNull())\n\t\t}\n\t}\n\n\t/**\n\t Creates a JSON using the object.\n\t\n\t - parameter jsonObject:  The object must have the following properties: All objects are NSString/String, NSNumber/Int/Float/Double/Bool, NSArray/Array, NSDictionary/Dictionary, or NSNull; All dictionary keys are NSStrings/String; NSNumbers are not NaN or infinity.\n\t\n\t - returns: The created JSON\n\t */\n    fileprivate init(jsonObject: Any) {\n        object = jsonObject\n    }\n\n\t/**\n\t Merges another JSON into this JSON, whereas primitive values which are not present in this JSON are getting added,\n\t present values getting overwritten, array values getting appended and nested JSONs getting merged the same way.\n \n\t - parameter other: The JSON which gets merged into this JSON\n\t\n\t - throws `ErrorWrongType` if the other JSONs differs in type on the top level.\n\t */\n    public mutating func merge(with other: JSON) throws {\n        try self.merge(with: other, typecheck: true)\n    }\n\n\t/**\n\t Merges another JSON into this JSON and returns a new JSON, whereas primitive values which are not present in this JSON are getting added,\n\t present values getting overwritten, array values getting appended and nested JSONS getting merged the same way.\n\t\n\t - parameter other: The JSON which gets merged into this JSON\n\t\n\t - throws `ErrorWrongType` if the other JSONs differs in type on the top level.\n\t\n\t - returns: New merged JSON\n\t */\n    public func merged(with other: JSON) throws -> JSON {\n        var merged = self\n        try merged.merge(with: other, typecheck: true)\n        return merged\n    }\n\n    /**\n     Private woker function which does the actual merging\n     Typecheck is set to true for the first recursion level to prevent total override of the source JSON\n \t*/\n \tfileprivate mutating func merge(with other: JSON, typecheck: Bool) throws {\n        if type == other.type {\n            switch type {\n            case .dictionary:\n                for (key, _) in other {\n                    try self[key].merge(with: other[key], typecheck: false)\n                }\n            case .array:\n                self = JSON(arrayValue + other.arrayValue)\n            default:\n                self = other\n            }\n        } else {\n            if typecheck {\n                throw SwiftyJSONError.wrongType\n            } else {\n                self = other\n            }\n        }\n    }\n\n    /// Private object\n    fileprivate var rawArray: [Any] = []\n    fileprivate var rawDictionary: [String: Any] = [:]\n    fileprivate var rawString: String = \"\"\n    fileprivate var rawNumber: NSNumber = 0\n    fileprivate var rawNull: NSNull = NSNull()\n    fileprivate var rawBool: Bool = false\n\n    /// JSON type, fileprivate setter\n    public fileprivate(set) var type: Type = .null\n\n    /// Error in JSON, fileprivate setter\n    public fileprivate(set) var error: SwiftyJSONError?\n\n    /// Object in JSON\n    public var object: Any {\n        get {\n            switch type {\n            case .array:      return rawArray\n            case .dictionary: return rawDictionary\n            case .string:     return rawString\n            case .number:     return rawNumber\n            case .bool:       return rawBool\n            default:          return rawNull\n            }\n        }\n        set {\n            error = nil\n            switch unwrap(newValue) {\n            case let number as NSNumber:\n                if number.isBool {\n                    type = .bool\n                    rawBool = number.boolValue\n                } else {\n                    type = .number\n                    rawNumber = number\n                }\n            case let string as String:\n                type = .string\n                rawString = string\n            case _ as NSNull:\n                type = .null\n            case nil:\n                type = .null\n            case let array as [Any]:\n                type = .array\n                rawArray = array\n            case let dictionary as [String: Any]:\n                type = .dictionary\n                rawDictionary = dictionary\n            default:\n                type = .unknown\n                error = SwiftyJSONError.unsupportedType\n            }\n        }\n    }\n\n    /// The static null JSON\n    @available(*, unavailable, renamed:\"null\")\n    public static var nullJSON: JSON { return null }\n    public static var null: JSON { return JSON(NSNull()) }\n}\n\n/// Private method to unwarp an object recursively\nprivate func unwrap(_ object: Any) -> Any {\n    switch object {\n    case let json as JSON:\n        return unwrap(json.object)\n    case let array as [Any]:\n        return array.map(unwrap)\n    case let dictionary as [String: Any]:\n        var d = dictionary\n        dictionary.forEach { pair in\n            d[pair.key] = unwrap(pair.value)\n        }\n        return d\n    default:\n        return object\n    }\n}\n\npublic enum Index<T: Any>: Comparable {\n    case array(Int)\n    case dictionary(DictionaryIndex<String, T>)\n    case null\n\n    static public func == (lhs: Index, rhs: Index) -> Bool {\n        switch (lhs, rhs) {\n        case (.array(let left), .array(let right)):           return left == right\n        case (.dictionary(let left), .dictionary(let right)): return left == right\n        case (.null, .null):                                  return true\n        default:                                              return false\n        }\n    }\n\n    static public func < (lhs: Index, rhs: Index) -> Bool {\n        switch (lhs, rhs) {\n        case (.array(let left), .array(let right)):           return left < right\n        case (.dictionary(let left), .dictionary(let right)): return left < right\n        default:                                              return false\n        }\n    }\n}\n\npublic typealias JSONIndex = Index<JSON>\npublic typealias JSONRawIndex = Index<Any>\n\nextension JSON: Swift.Collection {\n\n    public typealias Index = JSONRawIndex\n\n    public var startIndex: Index {\n        switch type {\n        case .array:      return .array(rawArray.startIndex)\n        case .dictionary: return .dictionary(rawDictionary.startIndex)\n        default:          return .null\n        }\n    }\n\n    public var endIndex: Index {\n        switch type {\n        case .array:      return .array(rawArray.endIndex)\n        case .dictionary: return .dictionary(rawDictionary.endIndex)\n        default:          return .null\n        }\n    }\n\n    public func index(after i: Index) -> Index {\n        switch i {\n        case .array(let idx):      return .array(rawArray.index(after: idx))\n        case .dictionary(let idx): return .dictionary(rawDictionary.index(after: idx))\n        default:                   return .null\n        }\n    }\n\n    public subscript (position: Index) -> (String, JSON) {\n        switch position {\n        case .array(let idx):      return (String(idx), JSON(rawArray[idx]))\n        case .dictionary(let idx): return (rawDictionary[idx].key, JSON(rawDictionary[idx].value))\n        default:                   return (\"\", JSON.null)\n        }\n    }\n}\n\n// MARK: - Subscript\n\n/**\n *  To mark both String and Int can be used in subscript.\n */\npublic enum JSONKey {\n    case index(Int)\n    case key(String)\n}\n\npublic protocol JSONSubscriptType {\n    var jsonKey: JSONKey { get }\n}\n\nextension Int: JSONSubscriptType {\n    public var jsonKey: JSONKey {\n        return JSONKey.index(self)\n    }\n}\n\nextension String: JSONSubscriptType {\n    public var jsonKey: JSONKey {\n        return JSONKey.key(self)\n    }\n}\n\nextension JSON {\n\n    /// If `type` is `.array`, return json whose object is `array[index]`, otherwise return null json with error.\n    fileprivate subscript(index index: Int) -> JSON {\n        get {\n            if type != .array {\n                var r = JSON.null\n                r.error = self.error ?? SwiftyJSONError.wrongType\n                return r\n            } else if rawArray.indices.contains(index) {\n                return JSON(rawArray[index])\n            } else {\n                var r = JSON.null\n                r.error = SwiftyJSONError.indexOutOfBounds\n                return r\n            }\n        }\n        set {\n            if type == .array &&\n                rawArray.indices.contains(index) &&\n                newValue.error == nil {\n                rawArray[index] = newValue.object\n            }\n        }\n    }\n\n    /// If `type` is `.dictionary`, return json whose object is `dictionary[key]` , otherwise return null json with error.\n    fileprivate subscript(key key: String) -> JSON {\n        get {\n            var r = JSON.null\n            if type == .dictionary {\n                if let o = rawDictionary[key] {\n                    r = JSON(o)\n                } else {\n                    r.error = SwiftyJSONError.notExist\n                }\n            } else {\n                r.error = self.error ?? SwiftyJSONError.wrongType\n            }\n            return r\n        }\n        set {\n            if type == .dictionary && newValue.error == nil {\n                rawDictionary[key] = newValue.object\n            }\n        }\n    }\n\n    /// If `sub` is `Int`, return `subscript(index:)`; If `sub` is `String`,  return `subscript(key:)`.\n    fileprivate subscript(sub sub: JSONSubscriptType) -> JSON {\n        get {\n            switch sub.jsonKey {\n            case .index(let index): return self[index: index]\n            case .key(let key):     return self[key: key]\n            }\n        }\n        set {\n            switch sub.jsonKey {\n            case .index(let index): self[index: index] = newValue\n            case .key(let key):     self[key: key] = newValue\n            }\n        }\n    }\n\n\t/**\n\t Find a json in the complex data structures by using array of Int and/or String as path.\n\t\n\t Example:\n\t\n\t ```\n\t let json = JSON[data]\n\t let path = [9,\"list\",\"person\",\"name\"]\n\t let name = json[path]\n\t ```\n\t\n\t The same as: let name = json[9][\"list\"][\"person\"][\"name\"]\n\t\n\t - parameter path: The target json's path.\n\t\n\t - returns: Return a json found by the path or a null json with error\n\t */\n    public subscript(path: [JSONSubscriptType]) -> JSON {\n        get {\n            return path.reduce(self) { $0[sub: $1] }\n        }\n        set {\n            switch path.count {\n            case 0: return\n            case 1: self[sub:path[0]].object = newValue.object\n            default:\n                var aPath = path\n                aPath.remove(at: 0)\n                var nextJSON = self[sub: path[0]]\n                nextJSON[aPath] = newValue\n                self[sub: path[0]] = nextJSON\n            }\n        }\n    }\n\n    /**\n     Find a json in the complex data structures by using array of Int and/or String as path.\n\n     - parameter path: The target json's path. Example:\n\n     let name = json[9,\"list\",\"person\",\"name\"]\n\n     The same as: let name = json[9][\"list\"][\"person\"][\"name\"]\n\n     - returns: Return a json found by the path or a null json with error\n     */\n    public subscript(path: JSONSubscriptType...) -> JSON {\n        get {\n            return self[path]\n        }\n        set {\n            self[path] = newValue\n        }\n    }\n}\n\n// MARK: - LiteralConvertible\n\nextension JSON: Swift.ExpressibleByStringLiteral {\n\n    public init(stringLiteral value: StringLiteralType) {\n        self.init(value)\n    }\n\n    public init(extendedGraphemeClusterLiteral value: StringLiteralType) {\n        self.init(value)\n    }\n\n    public init(unicodeScalarLiteral value: StringLiteralType) {\n        self.init(value)\n    }\n}\n\nextension JSON: Swift.ExpressibleByIntegerLiteral {\n\n    public init(integerLiteral value: IntegerLiteralType) {\n        self.init(value)\n    }\n}\n\nextension JSON: Swift.ExpressibleByBooleanLiteral {\n\n    public init(booleanLiteral value: BooleanLiteralType) {\n        self.init(value)\n    }\n}\n\nextension JSON: Swift.ExpressibleByFloatLiteral {\n\n    public init(floatLiteral value: FloatLiteralType) {\n        self.init(value)\n    }\n}\n\nextension JSON: Swift.ExpressibleByDictionaryLiteral {\n    public init(dictionaryLiteral elements: (String, Any)...) {\n        let dictionary = elements.reduce(into: [String: Any](), { $0[$1.0] = $1.1})\n        self.init(dictionary)\n    }\n}\n\nextension JSON: Swift.ExpressibleByArrayLiteral {\n\n    public init(arrayLiteral elements: Any...) {\n        self.init(elements)\n    }\n}\n\n// MARK: - Raw\n\nextension JSON: Swift.RawRepresentable {\n\n    public init?(rawValue: Any) {\n        if JSON(rawValue).type == .unknown {\n            return nil\n        } else {\n            self.init(rawValue)\n        }\n    }\n\n    public var rawValue: Any {\n        return object\n    }\n\n    public func rawData(options opt: JSONSerialization.WritingOptions = JSONSerialization.WritingOptions(rawValue: 0)) throws -> Data {\n        guard JSONSerialization.isValidJSONObject(object) else {\n            throw SwiftyJSONError.invalidJSON\n        }\n\n        return try JSONSerialization.data(withJSONObject: object, options: opt)\n\t}\n\n\tpublic func rawString(_ encoding: String.Encoding = .utf8, options opt: JSONSerialization.WritingOptions = .prettyPrinted) -> String? {\n\t\tdo {\n\t\t\treturn try _rawString(encoding, options: [.jsonSerialization: opt])\n\t\t} catch {\n\t\t\tprint(\"Could not serialize object to JSON because:\", error.localizedDescription)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tpublic func rawString(_ options: [writingOptionsKeys: Any]) -> String? {\n\t\tlet encoding = options[.encoding] as? String.Encoding ?? String.Encoding.utf8\n\t\tlet maxObjectDepth = options[.maxObjextDepth] as? Int ?? 10\n\t\tdo {\n\t\t\treturn try _rawString(encoding, options: options, maxObjectDepth: maxObjectDepth)\n\t\t} catch {\n\t\t\tprint(\"Could not serialize object to JSON because:\", error.localizedDescription)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tfileprivate func _rawString(_ encoding: String.Encoding = .utf8, options: [writingOptionsKeys: Any], maxObjectDepth: Int = 10) throws -> String? {\n        guard maxObjectDepth > 0 else { throw SwiftyJSONError.invalidJSON }\n        switch type {\n        case .dictionary:\n\t\t\tdo {\n\t\t\t\tif !(options[.castNilToNSNull] as? Bool ?? false) {\n\t\t\t\t\tlet jsonOption = options[.jsonSerialization] as? JSONSerialization.WritingOptions ?? JSONSerialization.WritingOptions.prettyPrinted\n\t\t\t\t\tlet data = try rawData(options: jsonOption)\n\t\t\t\t\treturn String(data: data, encoding: encoding)\n\t\t\t\t}\n\n\t\t\t\tguard let dict = object as? [String: Any?] else {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tlet body = try dict.keys.map { key throws -> String in\n\t\t\t\t\tguard let value = dict[key] else {\n\t\t\t\t\t\treturn \"\\\"\\(key)\\\": null\"\n\t\t\t\t\t}\n\t\t\t\t\tguard let unwrappedValue = value else {\n\t\t\t\t\t\treturn \"\\\"\\(key)\\\": null\"\n\t\t\t\t\t}\n\n\t\t\t\t\tlet nestedValue = JSON(unwrappedValue)\n\t\t\t\t\tguard let nestedString = try nestedValue._rawString(encoding, options: options, maxObjectDepth: maxObjectDepth - 1) else {\n\t\t\t\t\t\tthrow SwiftyJSONError.elementTooDeep\n\t\t\t\t\t}\n\t\t\t\t\tif nestedValue.type == .string {\n\t\t\t\t\t\treturn \"\\\"\\(key)\\\": \\\"\\(nestedString.replacingOccurrences(of: \"\\\\\", with: \"\\\\\\\\\").replacingOccurrences(of: \"\\\"\", with: \"\\\\\\\"\"))\\\"\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn \"\\\"\\(key)\\\": \\(nestedString)\"\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn \"{\\(body.joined(separator: \",\"))}\"\n\t\t\t} catch _ {\n\t\t\t\treturn nil\n\t\t\t}\n        case .array:\n            do {\n\t\t\t\tif !(options[.castNilToNSNull] as? Bool ?? false) {\n\t\t\t\t\tlet jsonOption = options[.jsonSerialization] as? JSONSerialization.WritingOptions ?? JSONSerialization.WritingOptions.prettyPrinted\n\t\t\t\t\tlet data = try rawData(options: jsonOption)\n\t\t\t\t\treturn String(data: data, encoding: encoding)\n\t\t\t\t}\n\n                guard let array = object as? [Any?] else {\n                    return nil\n                }\n                let body = try array.map { value throws -> String in\n                    guard let unwrappedValue = value else {\n                        return \"null\"\n                    }\n\n                    let nestedValue = JSON(unwrappedValue)\n                    guard let nestedString = try nestedValue._rawString(encoding, options: options, maxObjectDepth: maxObjectDepth - 1) else {\n                        throw SwiftyJSONError.invalidJSON\n                    }\n                    if nestedValue.type == .string {\n                        return \"\\\"\\(nestedString.replacingOccurrences(of: \"\\\\\", with: \"\\\\\\\\\").replacingOccurrences(of: \"\\\"\", with: \"\\\\\\\"\"))\\\"\"\n                    } else {\n                        return nestedString\n                    }\n                }\n\n                return \"[\\(body.joined(separator: \",\"))]\"\n            } catch _ {\n                return nil\n            }\n        case .string: return rawString\n        case .number: return rawNumber.stringValue\n        case .bool:   return rawBool.description\n        case .null:   return \"null\"\n        default:      return nil\n        }\n    }\n}\n\n// MARK: - Printable, DebugPrintable\n\nextension JSON: Swift.CustomStringConvertible, Swift.CustomDebugStringConvertible {\n\n    public var description: String {\n        return rawString(options: .prettyPrinted) ?? \"unknown\"\n    }\n\n    public var debugDescription: String {\n        return description\n    }\n}\n\n// MARK: - Array\n\nextension JSON {\n\n    //Optional [JSON]\n    public var array: [JSON]? {\n        return type == .array ? rawArray.map { JSON($0) } : nil\n    }\n\n    //Non-optional [JSON]\n    public var arrayValue: [JSON] {\n        return self.array ?? []\n    }\n\n    //Optional [Any]\n    public var arrayObject: [Any]? {\n        get {\n            switch type {\n            case .array: return rawArray\n            default:     return nil\n            }\n        }\n        set {\n            self.object = newValue ?? NSNull()\n        }\n    }\n}\n\n// MARK: - Dictionary\n\nextension JSON {\n\n    //Optional [String : JSON]\n    public var dictionary: [String: JSON]? {\n        if type == .dictionary {\n            var d = [String: JSON](minimumCapacity: rawDictionary.count)\n            rawDictionary.forEach { pair in\n                d[pair.key] = JSON(pair.value)\n            }\n            return d\n        } else {\n            return nil\n        }\n    }\n\n    //Non-optional [String : JSON]\n    public var dictionaryValue: [String: JSON] {\n        return dictionary ?? [:]\n    }\n\n    //Optional [String : Any]\n\n    public var dictionaryObject: [String: Any]? {\n        get {\n            switch type {\n            case .dictionary: return rawDictionary\n            default:          return nil\n            }\n        }\n        set {\n            object = newValue ?? NSNull()\n        }\n    }\n}\n\n// MARK: - Bool\n\nextension JSON { // : Swift.Bool\n\n    //Optional bool\n    public var bool: Bool? {\n        get {\n            switch type {\n            case .bool: return rawBool\n            default:    return nil\n            }\n        }\n        set {\n            object = newValue ?? NSNull()\n        }\n    }\n\n    //Non-optional bool\n    public var boolValue: Bool {\n        get {\n            switch type {\n            case .bool:   return rawBool\n            case .number: return rawNumber.boolValue\n            case .string: return [\"true\", \"y\", \"t\", \"yes\", \"1\"].contains { rawString.caseInsensitiveCompare($0) == .orderedSame }\n            default:      return false\n            }\n        }\n        set {\n            object = newValue\n        }\n    }\n}\n\n// MARK: - String\n\nextension JSON {\n\n    //Optional string\n    public var string: String? {\n        get {\n            switch type {\n            case .string: return object as? String\n            default:      return nil\n            }\n        }\n        set {\n            object = newValue ?? NSNull()\n        }\n    }\n\n    //Non-optional string\n    public var stringValue: String {\n        get {\n            switch type {\n            case .string: return object as? String ?? \"\"\n            case .number: return rawNumber.stringValue\n            case .bool:   return (object as? Bool).map { String($0) } ?? \"\"\n            default:      return \"\"\n            }\n        }\n        set {\n            object = newValue\n        }\n    }\n}\n\n// MARK: - Number\n\nextension JSON {\n\n    //Optional number\n    public var number: NSNumber? {\n        get {\n            switch type {\n            case .number: return rawNumber\n            case .bool:   return NSNumber(value: rawBool ? 1 : 0)\n            default:      return nil\n            }\n        }\n        set {\n            object = newValue ?? NSNull()\n        }\n    }\n\n    //Non-optional number\n    public var numberValue: NSNumber {\n        get {\n            switch type {\n            case .string:\n                let decimal = NSDecimalNumber(string: object as? String)\n                return decimal == .notANumber ? .zero : decimal\n            case .number: return object as? NSNumber ?? NSNumber(value: 0)\n            case .bool: return NSNumber(value: rawBool ? 1 : 0)\n            default: return NSNumber(value: 0.0)\n            }\n        }\n        set {\n            object = newValue\n        }\n    }\n}\n\n// MARK: - Null\n\nextension JSON {\n\n    public var null: NSNull? {\n        set {\n            object = NSNull()\n        }\n        get {\n            switch type {\n            case .null: return rawNull\n            default:    return nil\n            }\n        }\n    }\n    public func exists() -> Bool {\n        if let errorValue = error, (400...1000).contains(errorValue.errorCode) {\n            return false\n        }\n        return true\n    }\n}\n\n// MARK: - URL\n\nextension JSON {\n\n    //Optional URL\n    public var url: URL? {\n        get {\n            switch type {\n            case .string:\n                // Check for existing percent escapes first to prevent double-escaping of % character\n                if rawString.range(of: \"%[0-9A-Fa-f]{2}\", options: .regularExpression, range: nil, locale: nil) != nil {\n                    return Foundation.URL(string: rawString)\n                } else if let encodedString_ = rawString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) {\n                    // We have to use `Foundation.URL` otherwise it conflicts with the variable name.\n                    return Foundation.URL(string: encodedString_)\n                } else {\n                    return nil\n                }\n            default:\n                return nil\n            }\n        }\n        set {\n            object = newValue?.absoluteString ?? NSNull()\n        }\n    }\n}\n\n// MARK: - Int, Double, Float, Int8, Int16, Int32, Int64\n\nextension JSON {\n\n    public var double: Double? {\n        get {\n            return number?.doubleValue\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object = NSNull()\n            }\n        }\n    }\n\n    public var doubleValue: Double {\n        get {\n            return numberValue.doubleValue\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var float: Float? {\n        get {\n            return number?.floatValue\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object = NSNull()\n            }\n        }\n    }\n\n    public var floatValue: Float {\n        get {\n            return numberValue.floatValue\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var int: Int? {\n        get {\n            return number?.intValue\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object = NSNull()\n            }\n        }\n    }\n\n    public var intValue: Int {\n        get {\n            return numberValue.intValue\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var uInt: UInt? {\n        get {\n            return number?.uintValue\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object = NSNull()\n            }\n        }\n    }\n\n    public var uIntValue: UInt {\n        get {\n            return numberValue.uintValue\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var int8: Int8? {\n        get {\n            return number?.int8Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: Int(newValue))\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var int8Value: Int8 {\n        get {\n            return numberValue.int8Value\n        }\n        set {\n            object = NSNumber(value: Int(newValue))\n        }\n    }\n\n    public var uInt8: UInt8? {\n        get {\n            return number?.uint8Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var uInt8Value: UInt8 {\n        get {\n            return numberValue.uint8Value\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var int16: Int16? {\n        get {\n            return number?.int16Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var int16Value: Int16 {\n        get {\n            return numberValue.int16Value\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var uInt16: UInt16? {\n        get {\n            return number?.uint16Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var uInt16Value: UInt16 {\n        get {\n            return numberValue.uint16Value\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var int32: Int32? {\n        get {\n            return number?.int32Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var int32Value: Int32 {\n        get {\n            return numberValue.int32Value\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var uInt32: UInt32? {\n        get {\n            return number?.uint32Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var uInt32Value: UInt32 {\n        get {\n            return numberValue.uint32Value\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var int64: Int64? {\n        get {\n            return number?.int64Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var int64Value: Int64 {\n        get {\n            return numberValue.int64Value\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n\n    public var uInt64: UInt64? {\n        get {\n            return number?.uint64Value\n        }\n        set {\n            if let newValue = newValue {\n                object = NSNumber(value: newValue)\n            } else {\n                object =  NSNull()\n            }\n        }\n    }\n\n    public var uInt64Value: UInt64 {\n        get {\n            return numberValue.uint64Value\n        }\n        set {\n            object = NSNumber(value: newValue)\n        }\n    }\n}\n\n// MARK: - Comparable\n\nextension JSON: Swift.Comparable {}\n\npublic func == (lhs: JSON, rhs: JSON) -> Bool {\n\n    switch (lhs.type, rhs.type) {\n    case (.number, .number): return lhs.rawNumber == rhs.rawNumber\n    case (.string, .string): return lhs.rawString == rhs.rawString\n    case (.bool, .bool):     return lhs.rawBool == rhs.rawBool\n    case (.array, .array):   return lhs.rawArray as NSArray == rhs.rawArray as NSArray\n    case (.dictionary, .dictionary): return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary\n    case (.null, .null):     return true\n    default:                 return false\n    }\n}\n\npublic func <= (lhs: JSON, rhs: JSON) -> Bool {\n\n    switch (lhs.type, rhs.type) {\n    case (.number, .number): return lhs.rawNumber <= rhs.rawNumber\n    case (.string, .string): return lhs.rawString <= rhs.rawString\n    case (.bool, .bool):     return lhs.rawBool == rhs.rawBool\n    case (.array, .array):   return lhs.rawArray as NSArray == rhs.rawArray as NSArray\n    case (.dictionary, .dictionary): return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary\n    case (.null, .null):     return true\n    default:                 return false\n    }\n}\n\npublic func >= (lhs: JSON, rhs: JSON) -> Bool {\n\n    switch (lhs.type, rhs.type) {\n    case (.number, .number): return lhs.rawNumber >= rhs.rawNumber\n    case (.string, .string): return lhs.rawString >= rhs.rawString\n    case (.bool, .bool):     return lhs.rawBool == rhs.rawBool\n    case (.array, .array):   return lhs.rawArray as NSArray == rhs.rawArray as NSArray\n    case (.dictionary, .dictionary): return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary\n    case (.null, .null):     return true\n    default:                 return false\n    }\n}\n\npublic func > (lhs: JSON, rhs: JSON) -> Bool {\n\n    switch (lhs.type, rhs.type) {\n    case (.number, .number): return lhs.rawNumber > rhs.rawNumber\n    case (.string, .string): return lhs.rawString > rhs.rawString\n    default:                 return false\n    }\n}\n\npublic func < (lhs: JSON, rhs: JSON) -> Bool {\n\n    switch (lhs.type, rhs.type) {\n    case (.number, .number): return lhs.rawNumber < rhs.rawNumber\n    case (.string, .string): return lhs.rawString < rhs.rawString\n    default:                 return false\n    }\n}\n\nprivate let trueNumber = NSNumber(value: true)\nprivate let falseNumber = NSNumber(value: false)\nprivate let trueObjCType = String(cString: trueNumber.objCType)\nprivate let falseObjCType = String(cString: falseNumber.objCType)\n\n// MARK: - NSNumber: Comparable\n\nextension NSNumber {\n    fileprivate var isBool: Bool {\n        let objCType = String(cString: self.objCType)\n        if (self.compare(trueNumber) == .orderedSame && objCType == trueObjCType) || (self.compare(falseNumber) == .orderedSame && objCType == falseObjCType) {\n            return true\n        } else {\n            return false\n        }\n    }\n}\n\nfunc == (lhs: NSNumber, rhs: NSNumber) -> Bool {\n    switch (lhs.isBool, rhs.isBool) {\n    case (false, true): return false\n    case (true, false): return false\n    default:            return lhs.compare(rhs) == .orderedSame\n    }\n}\n\nfunc != (lhs: NSNumber, rhs: NSNumber) -> Bool {\n    return !(lhs == rhs)\n}\n\nfunc < (lhs: NSNumber, rhs: NSNumber) -> Bool {\n\n    switch (lhs.isBool, rhs.isBool) {\n    case (false, true): return false\n    case (true, false): return false\n    default:            return lhs.compare(rhs) == .orderedAscending\n    }\n}\n\nfunc > (lhs: NSNumber, rhs: NSNumber) -> Bool {\n\n    switch (lhs.isBool, rhs.isBool) {\n    case (false, true): return false\n    case (true, false): return false\n    default:            return lhs.compare(rhs) == ComparisonResult.orderedDescending\n    }\n}\n\nfunc <= (lhs: NSNumber, rhs: NSNumber) -> Bool {\n\n    switch (lhs.isBool, rhs.isBool) {\n    case (false, true): return false\n    case (true, false): return false\n    default:            return lhs.compare(rhs) != .orderedDescending\n    }\n}\n\nfunc >= (lhs: NSNumber, rhs: NSNumber) -> Bool {\n\n    switch (lhs.isBool, rhs.isBool) {\n    case (false, true): return false\n    case (true, false): return false\n    default:            return lhs.compare(rhs) != .orderedAscending\n    }\n}\n\npublic enum writingOptionsKeys {\n\tcase jsonSerialization\n\tcase castNilToNSNull\n\tcase maxObjextDepth\n\tcase encoding\n}\n\n// MARK: - JSON: Codable\nextension JSON: Codable {\n    private static var codableTypes: [Codable.Type] {\n        return [\n            Bool.self,\n            Int.self,\n            Int8.self,\n            Int16.self,\n            Int32.self,\n            Int64.self,\n            UInt.self,\n            UInt8.self,\n            UInt16.self,\n            UInt32.self,\n            UInt64.self,\n            Double.self,\n            String.self,\n            [JSON].self,\n            [String: JSON].self\n        ]\n    }\n    public init(from decoder: Decoder) throws {\n        var object: Any?\n\n        if let container = try? decoder.singleValueContainer(), !container.decodeNil() {\n            for type in JSON.codableTypes {\n                if object != nil {\n                    break\n                }\n                // try to decode value\n                switch type {\n                case let boolType as Bool.Type:\n                    object = try? container.decode(boolType)\n                case let intType as Int.Type:\n                    object = try? container.decode(intType)\n                case let int8Type as Int8.Type:\n                    object = try? container.decode(int8Type)\n                case let int32Type as Int32.Type:\n                    object = try? container.decode(int32Type)\n                case let int64Type as Int64.Type:\n                    object = try? container.decode(int64Type)\n                case let uintType as UInt.Type:\n                    object = try? container.decode(uintType)\n                case let uint8Type as UInt8.Type:\n                    object = try? container.decode(uint8Type)\n                case let uint16Type as UInt16.Type:\n                    object = try? container.decode(uint16Type)\n                case let uint32Type as UInt32.Type:\n                    object = try? container.decode(uint32Type)\n                case let uint64Type as UInt64.Type:\n                    object = try? container.decode(uint64Type)\n                case let doubleType as Double.Type:\n                    object = try? container.decode(doubleType)\n                case let stringType as String.Type:\n                    object = try? container.decode(stringType)\n                case let jsonValueArrayType as [JSON].Type:\n                    object = try? container.decode(jsonValueArrayType)\n                case let jsonValueDictType as [String: JSON].Type:\n                    object = try? container.decode(jsonValueDictType)\n                default:\n                    break\n                }\n            }\n        }\n        self.init(object ?? NSNull())\n    }\n    public func encode(to encoder: Encoder) throws {\n        var container = encoder.singleValueContainer()\n        if object is NSNull {\n            try container.encodeNil()\n            return\n        }\n        switch object {\n        case let intValue as Int:\n            try container.encode(intValue)\n        case let int8Value as Int8:\n            try container.encode(int8Value)\n        case let int32Value as Int32:\n            try container.encode(int32Value)\n        case let int64Value as Int64:\n            try container.encode(int64Value)\n        case let uintValue as UInt:\n            try container.encode(uintValue)\n        case let uint8Value as UInt8:\n            try container.encode(uint8Value)\n        case let uint16Value as UInt16:\n            try container.encode(uint16Value)\n        case let uint32Value as UInt32:\n            try container.encode(uint32Value)\n        case let uint64Value as UInt64:\n            try container.encode(uint64Value)\n        case let doubleValue as Double:\n            try container.encode(doubleValue)\n        case let boolValue as Bool:\n            try container.encode(boolValue)\n        case let stringValue as String:\n            try container.encode(stringValue)\n        case is [Any]:\n            let jsonValueArray = array ?? []\n            try container.encode(jsonValueArray)\n        case is [String: Any]:\n            let jsonValueDictValue = dictionary ?? [:]\n            try container.encode(jsonValueDictValue)\n        default:\n            break\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/SwiftyJSON.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t1DC122E6EA910518191F7C60A64CC24D /* SwiftyJSON-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D2FC50497B601DC18B15EF1B5E059AC /* SwiftyJSON-dummy.m */; };\n\t\tA49D78D0C7155041B4EFE03A63612EB4 /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07B0484E03EF57BE6DA621E12219052A /* SwiftyJSON.swift */; };\n\t\tD22FBB1AC007CBA495A771771AB7AEB9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76B871EE76375656181F36A66DF40085 /* Foundation.framework */; };\n\t\tFA19CE8ACED0B95E58C2EB90752C2D73 /* SwiftyJSON-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 23DC0335E1CC01DA864D845DF1AD1003 /* SwiftyJSON-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t0779F1807A202C6934362511AA0CE9A3 /* SwiftyJSON-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SwiftyJSON-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t07B0484E03EF57BE6DA621E12219052A /* SwiftyJSON.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftyJSON.swift; path = Source/SwiftyJSON/SwiftyJSON.swift; sourceTree = \"<group>\"; };\n\t\t1D2FC50497B601DC18B15EF1B5E059AC /* SwiftyJSON-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"SwiftyJSON-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t23DC0335E1CC01DA864D845DF1AD1003 /* SwiftyJSON-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"SwiftyJSON-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t75D5393B2B0C68CFE213C6E93D028CFE /* SwiftyJSON.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SwiftyJSON.modulemap; sourceTree = \"<group>\"; };\n\t\t76B871EE76375656181F36A66DF40085 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t89F94BFC621046BB1741819EE8325060 /* SwiftyJSON.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftyJSON.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t8B9A69E0E7C5FAA1B47161BCDF63D1D3 /* SwiftyJSON-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"SwiftyJSON-Info.plist\"; sourceTree = \"<group>\"; };\n\t\tBC01D1DC392A1FBD20641873F9903BA4 /* SwiftyJSON.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftyJSON.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tD113BAD0A911BB872D877DA5A82A9F23 /* SwiftyJSON */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SwiftyJSON; path = SwiftyJSON.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t7E81505D45720E752CA03138892E7970 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tD22FBB1AC007CBA495A771771AB7AEB9 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2E4205A4E476FF7F192C877088D2B328 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5FD9281F280F86AF8DCEE22D3075A7FE /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t53315E374B189C6B1AA087A686126F44 /* SwiftyJSON */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t07B0484E03EF57BE6DA621E12219052A /* SwiftyJSON.swift */,\n\t\t\t\tA2C21521217971D18429BF050CE88000 /* Support Files */,\n\t\t\t);\n\t\t\tname = SwiftyJSON;\n\t\t\tpath = SwiftyJSON;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t5FD9281F280F86AF8DCEE22D3075A7FE /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t76B871EE76375656181F36A66DF40085 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6DF89A472492583C809C1BEEF12C28D2 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD113BAD0A911BB872D877DA5A82A9F23 /* SwiftyJSON */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA2C21521217971D18429BF050CE88000 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t75D5393B2B0C68CFE213C6E93D028CFE /* SwiftyJSON.modulemap */,\n\t\t\t\t1D2FC50497B601DC18B15EF1B5E059AC /* SwiftyJSON-dummy.m */,\n\t\t\t\t8B9A69E0E7C5FAA1B47161BCDF63D1D3 /* SwiftyJSON-Info.plist */,\n\t\t\t\t0779F1807A202C6934362511AA0CE9A3 /* SwiftyJSON-prefix.pch */,\n\t\t\t\t23DC0335E1CC01DA864D845DF1AD1003 /* SwiftyJSON-umbrella.h */,\n\t\t\t\t89F94BFC621046BB1741819EE8325060 /* SwiftyJSON.debug.xcconfig */,\n\t\t\t\tBC01D1DC392A1FBD20641873F9903BA4 /* SwiftyJSON.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/SwiftyJSON\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tC060B5DF9B5B402B03A451ED373E8F1A = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2E4205A4E476FF7F192C877088D2B328 /* Frameworks */,\n\t\t\t\t6DF89A472492583C809C1BEEF12C28D2 /* Products */,\n\t\t\t\t53315E374B189C6B1AA087A686126F44 /* SwiftyJSON */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tF4F057E65015180BA5ABC883DE4FAAF7 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tFA19CE8ACED0B95E58C2EB90752C2D73 /* SwiftyJSON-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tAD1A79042DA54FF6DCBF6C015B0E27B5 /* SwiftyJSON */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = F709B28CE1A018B2C01C271087806C66 /* Build configuration list for PBXNativeTarget \"SwiftyJSON\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tF4F057E65015180BA5ABC883DE4FAAF7 /* Headers */,\n\t\t\t\tA56DA4B355CF0120E812BEC67A8975B2 /* Sources */,\n\t\t\t\t7E81505D45720E752CA03138892E7970 /* Frameworks */,\n\t\t\t\t8F5B5CCF2454979FD6BA8E96AA7FF9DF /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = SwiftyJSON;\n\t\t\tproductName = SwiftyJSON;\n\t\t\tproductReference = D113BAD0A911BB872D877DA5A82A9F23 /* SwiftyJSON */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t4911A93E632B377693AB135E11CC6112 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 9D09FDFF40E526AE302FDF8D4C13AE06 /* Build configuration list for PBXProject \"SwiftyJSON\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = C060B5DF9B5B402B03A451ED373E8F1A;\n\t\t\tproductRefGroup = 6DF89A472492583C809C1BEEF12C28D2 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tAD1A79042DA54FF6DCBF6C015B0E27B5 /* SwiftyJSON */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t8F5B5CCF2454979FD6BA8E96AA7FF9DF /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tA56DA4B355CF0120E812BEC67A8975B2 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tA49D78D0C7155041B4EFE03A63612EB4 /* SwiftyJSON.swift in Sources */,\n\t\t\t\t1DC122E6EA910518191F7C60A64CC24D /* SwiftyJSON-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t1D34A531A96A8F0AB7D3150034D83B44 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 89F94BFC621046BB1741819EE8325060 /* SwiftyJSON.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SwiftyJSON/SwiftyJSON.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SwiftyJSON;\n\t\t\t\tPRODUCT_NAME = SwiftyJSON;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tA056161DAC820D6B05189BF1FB318B10 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tC395E8883E724DFB1D78AEC39A5329A8 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tEE6A7EB8D80D03E8E88A660EE55963FC /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = BC01D1DC392A1FBD20641873F9903BA4 /* SwiftyJSON.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/SwiftyJSON/SwiftyJSON.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = SwiftyJSON;\n\t\t\t\tPRODUCT_NAME = SwiftyJSON;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t9D09FDFF40E526AE302FDF8D4C13AE06 /* Build configuration list for PBXProject \"SwiftyJSON\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA056161DAC820D6B05189BF1FB318B10 /* Debug */,\n\t\t\t\tC395E8883E724DFB1D78AEC39A5329A8 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tF709B28CE1A018B2C01C271087806C66 /* Build configuration list for PBXNativeTarget \"SwiftyJSON\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t1D34A531A96A8F0AB7D3150034D83B44 /* Debug */,\n\t\t\t\tEE6A7EB8D80D03E8E88A660EE55963FC /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 4911A93E632B377693AB135E11CC6112 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016 Zhen Tan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/README.md",
    "content": "# TZImagePickerController\n[![CocoaPods](https://img.shields.io/cocoapods/v/TZImagePickerController.svg?style=flat)](https://github.com/banchichen/TZImagePickerController)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n\n A clone of UIImagePickerController, support picking multiple photos、original photo、video, also allow preview photo and video, support iOS6+.   \n 一个支持多选、选原图和视频的图片选择器，同时有预览功能，支持iOS6+。\n \n## 重要提示1：提issue前，请先对照Demo、常见问题自查！Demo正常说明你可以升级下新版试试。          \n \n## 重要提示2：3.7.5版本修复了iOS15.2下初次授权相册权限时的长时间卡顿&白屏问题，强烈建议尽快更新   \n     关于iOS14模拟器的问题\n PHAuthorizationStatusLimited授权模式下，iOS14模拟器有bug，未授权照片无法显示，真机正常，暂可忽略：https://github.com/banchichen/TZImagePickerController/issues/1347 \n \n     关于升级iOS10和Xcdoe8的提示:    \n 在Xcode8环境下将项目运行在iOS10的设备/模拟器中，访问相册和相机需要额外配置info.plist文件。分别是Privacy - Photo Library Usage Description和Privacy - Camera Usage Description字段，详见Demo中info.plist中的设置。\n    \n     项目截图 1.Demo首页 2.照片列表页 3.照片预览页 4.视频预览页\n<img src=\"https://github.com/banchichen/TZImagePickerController/blob/master/TZImagePickerController/ScreenShots/DemoPage.png\" width=\"40%\" height=\"40%\"><img src=\"https://github.com/banchichen/TZImagePickerController/blob/master/TZImagePickerController/ScreenShots/photoPickerVc.PNG\" width=\"40%\" height=\"40%\">\n<img src=\"https://github.com/banchichen/TZImagePickerController/blob/master/TZImagePickerController/ScreenShots/photoPreviewVc.PNG\" width=\"40%\" height=\"40%\"><img src=\"https://github.com/banchichen/TZImagePickerController/blob/master/TZImagePickerController/ScreenShots/videoPlayerVc.PNG\" width=\"40%\" height=\"40%\">\n\n## 一. Installation 安装\n\n#### CocoaPods\n> pod 'TZImagePickerController'   #iOS8 and later        \n> pod 'TZImagePickerController', '2.2.6'   #iOS6、iOS7        \n\n#### Carthage\n> github \"banchichen/TZImagePickerController\"\n\n#### 手动安装\n> 将TZImagePickerController文件夹拽入项目中，导入头文件：#import \"TZImagePickerController.h\"\n\n## 二. Example 例子\n\n    TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self];\n    \n    // You can get the photos by block, the same as by delegate.\n    // 你可以通过block或者代理，来得到用户选择的照片.\n    [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {\n    \n    }];\n    [self presentViewController:imagePickerVc animated:YES completion:nil];\n  \n## 三. Requirements 要求\n   iOS 6 or later. Requires ARC  \n   iOS6及以上系统可使用. ARC环境.\n   \n   When system version is iOS6 or iOS7,  Using AssetsLibrary.  \n   When system version is iOS8 or later, Using PhotoKit.  \n   如果运行在iOS6或7系统上，用的是AssetsLibrary库获取照片资源。  \n   如果运行在iOS8及以上系统上，用的是PhotoKit库获取照片资源。\n   \n   TZImagePickerController uses Camera、Location、Microphone、Photo Library，you need add these properties to info.plist like Demo：       \n   TZImagePickerController使用了相机、定位、麦克风、相册，请参考Demo添加下列属性到info.plist文件：        \n   \t`Privacy - Camera Usage Description`     \n    `Privacy - Location Usage Description`    \n\t`Privacy - Location When In Use Usage Description`    \n \t`Privacy - Microphone Usage Description`   \n \t`Privacy - Photo Library Usage Description`   \n    `Prevent limited photos access alert`    \n   \n## 四. More 更多 \n\n  If you find a bug, please create a issue.  \n  More information please view code.  \n  如果你发现了bug，请提一个issue。 \n  更多信息详见代码，也可查看我的博客: [我的博客](http://www.jianshu.com/p/1975411a31bb \"半尺尘 - 简书\")\n  \n      关于issue: \n  请尽可能详细地描述**系统版本**、**手机型号**、**库的版本**、**崩溃日志**和**复现步骤**，**请先更新到最新版再测试一下**，如果新版还存在再提~如果已有开启的类似issue，请直接在该issue下评论说出你的问题\n  \n## 五. FAQ 常见问题    \n\n**Q：pod search TZImagePickerController 搜索出来的不是最新版本**       \nA：需要在终端执行cd转换文件路径命令退回到Desktop，然后执行pod setup命令更新本地spec缓存（可能需要几分钟）,然后再搜索就可以了       \n     \n**Q：拍照后照片保存失败**         \nA：请参考issue481：https://github.com/banchichen/TZImagePickerController/issues/481 的信息排查，若还有问题请直接在issue内评论   \n \n**Q：photos数组图片不是原图，如何获取原图？**        \nA：请参考issue457的解释：https://github.com/banchichen/TZImagePickerController/issues/457    \n\n**Q：系统语言是中文/英文，界面上却有部分相册名字、返回按钮显示成了英文/中文？**        \nA：请参考 https://github.com/banchichen/TZImagePickerController/issues/443 和 https://github.com/banchichen/TZImagePickerController/issues/929          \n \n**Q：预览界面能否支持传入NSURL、UIImage对象？**        \nA：3.0.1版本已支持，需新接一个库：[TZImagePreviewController](https://github.com/banchichen/TZImagePreviewController)，请参考里面的Demo使用。       \n\n**Q：设置可选视频的最大/最小时长？照片的最小/最大尺寸？不符合要求的不显示**       \nA：可以的，参照Demo的isAssetCanBeDisplayed方法实现。我会返回asset出来，显示与否你来决定，注意这个是一个同步方法，对于需要根据asset去异步获取的信息如视频的大小、视频是否存在iCloud里来过滤的，无法做到。如果真要这样做，相册打开速度会变慢，你需要改我源码。       \n如果需要显示，选择时才提醒用户不可选，则实现isAssetCanBeSelected，用户选择时会调用它        \n\n**Q：预览页面出现了导航栏？**        \nA：https://github.com/banchichen/TZImagePickerController/issues/652         \n   \n**Q：可否增加微信编辑图片的功能？**           \nA：考虑下，优先级低  \n\n**Q：是否有QQ/微信群/钉钉群？**            \nA：有「钉钉群：33192786」和「QQ群：859033147」，推荐加钉钉群，答疑响应更快         \n\n**Q：想提交一个Pull Request？**           \nA：请先加钉钉群(33192786)说下方案，和我确认下，避免同时改动同一处内容。**一个PR请只修复1个问题，变动内容越少越好**。     \n\n**Q：demo在真机上跑不起来？**             \nA：1、team选你自己的；2、bundleId也改成你自己的或改成一个不会和别人重复的。可参考[简书的这篇博客](https://www.jianshu.com/p/cbe59138fca6)             \n\n**Q：3.6.4以上版本设置导航栏颜色无效？**            \nA：参考Demo里的代码，加上imagePickerVc.navigationBar.standardAppearance的相关设置                     \n\n**Q：设置导航栏颜色无效？导航栏颜色总是白色？**            \nA：是否有集成WRNavigationBar？如有，参考其readme调一下它的wr_setBlackList，把TZImagePickerController相关的控制器放到黑名单里，使得不受WRNavigationBar的影响。如果没有集成，可在issues列表里搜一下看看类似的issue参考下，如实在没头绪，可加群提供个能复现该问题的demo，0~2天给你解决。最近发现WRNavigationBar的黑名单会有不生效的情况，临时解决方案大家可参考：[https://github.com/wangrui460/WRNavigationBar/issues/145](https://github.com/wangrui460/WRNavigationBar/issues/145)                          \n\n**Q：导航栏没了？**            \nA：是否有集成GKNavigationBarViewController？需要升级到2.0.4及以上版本，详见issue：[https://github.com/QuintGao/GKNavigationBarViewController/issues/7](https://github.com/QuintGao/GKNavigationBarViewController/issues/7)。       \n\n**Q：有的视频导出失败？**            \nA：升级到2.2.6及以上版本试试，发现是修正视频转向导致的，2.2.6开始默认不再主动修正。如需打开，可设置needFixComposition为YES，但有几率导致安卓拍的视频导出失败。此外也可参考这个issue：https://github.com/banchichen/TZImagePickerController/issues/1073       \n\n**Q：视频导出慢？**            \nA：视频导出分两步，第一步是通过PHAsset获取AVURLAsset，如是iCloud视频则涉及到网络请求，耗时容易不可控，第二步是通过AVURLAsset把视频保存到沙盒，耗时不算多。但第一步耗时不可控，你可以拷贝我源码出来拿到第一步的进度给用户一个进度提示...     \n\n**Q：有的图片info里没有PHImageFileURLKey？**            \nA：不要去拿PHImageFileURLKey，没用的，只有通过Photos框架才能访问相册照片，光拿一个路径没用。        \n如果需要通过路径上传照片，请先把UIImage保存到沙盒，**用沙盒路径**。           \n如果你上传照片需要一个名字参数，请参考Demo**直接用照片名字**。          \n\n## 六. Release Notes 最近更新     \n\n**3.8.1 iOS14下可添加访问更多照片，详见PR内的评论** [#1526](https://github.com/banchichen/TZImagePickerController/pull/1526)               \n**3.7.6 修复iOS15.2下初次授权相册权限时的长时间卡顿&白屏问题** [#1547](https://github.com/banchichen/TZImagePickerController/issues/1547)               \n**3.6.7 修复Xcode13&iOS15下导航栏颜色异常问题**        \n3.6.2 新增allowEditVideo，单选视频时支持裁剪        \n3.6.0 修复iOS14下iCloud视频导出失败问题        \n**3.5.2 适配iPhone12系列设备**        \n3.4.4 支持Dark Mode      \n3.4.2 适配iOS14，若干问题修复                  \n3.3.2 适配iOS13，若干问题修复                 \n3.2.1 新增裁剪用scaleAspectFillCrop属性，设置为YES后，照片尺寸小于裁剪框时会自动放大撑满                \n3.2.0 加入用NSOperationQueue控制获取原图并发数降低内存的示例          \n3.1.8 批量获取图片时加入队列控制，尝试优化大批量选择图片时CPU和内存占用过高的问题（仍然危险，maxImagesCount谨慎设置过大...）             \n3.1.5 相册内无照片时给出提示，修复快速滑动时内存一直增加的问题           \n3.1.3 适配阿拉伯等语言下从右往左布局的特性         \n3.0.8 新增gifImagePlayBlock允许使用FLAnimatedImage等替换内部的GIF播放方案         \n3.0.7 适配iPhoneXR、XS、XS Max           \n3.0.6 优化保存照片、视频的方法        \n3.0.1 新增对[TZImagePreviewController](https://github.com/banchichen/TZImagePreviewController)库的支持，允许预览UIImage、NSURL、PHAsset对象       \n**3.0.0 去除iOS6和7的适配代码，更轻量，最低支持iOS8**      \n2.2.6 新增needFixComposition属性，默认为NO，不再主动修正视频转向，防止部分安卓拍的视频导出失败（**最后一个支持iOS6和7的版本**）          \n2.1.5 修复开启showSelectedIndex后照片列表页iCloud图片进度条紊乱的bug              \n2.1.4 新增多个页面和组件的样式自定义block，允许自定义绝大多数UI样式              \n2.1.2 新增showPhotoCannotSelectLayer属性，当已选照片张数达到最大可选张数时，可像微信一样让其它照片显示一个提示不可选的浮层            \n2.1.1 新增是否显示图片选中序号的属性，优化一些细节                 \n2.1.0.3 新增拍摄视频功能，优化一些细节           \n2.0.0.6 优化自定义languageBundle的支持，加入使用示例       \n2.0.0.5 优化性能，提高选择器打开速度，新增越南语支持    \n2.0.0.2 新增繁体语言，可设置首选语言，国际化支持更强大；优化一些细节     \n1.9.8  支持Carthage，优化一些细节    \n1.9.6  优化视频预览和gif预览页toolbar在iPhoneX上的样式      \n...   \n1.8.4  加入横竖屏适配；支持视频/gif多选；支持视频和照片一起选    \n1.8.1  新增2个代理方法，支持由上层来决定相册/照片的显示与否     \n...   \n1.7.7  支持GIF图片的播放和选择    \n1.7.6  支持对共享相册和同步相册的显示     \n1.7.5  允许不进入预览页面直接选择照片     \n1.7.4  支持单选模式下裁剪照片，支持任意矩形和圆形裁剪框    \n1.7.3  优化iCloud照片的显示与选择    \n...   \n1.5.0  可把拍照按钮放在外面；可自定义照片排序方式；Demo页的UI大改版，新增若干开关；   \n...      \n1.4.5  性能大幅提升（性能测试截图请去博客查看）；可在照片列表页拍照；Demo大幅优化；   \n...        \n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/NSBundle+TZImagePicker.h",
    "content": "//\n//  NSBundle+TZImagePicker.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 16/08/18.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface NSBundle (TZImagePicker)\n\n+ (NSBundle *)tz_imagePickerBundle;\n\n+ (NSString *)tz_localizedStringForKey:(NSString *)key value:(NSString *)value;\n+ (NSString *)tz_localizedStringForKey:(NSString *)key;\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/NSBundle+TZImagePicker.m",
    "content": "//\n//  NSBundle+TZImagePicker.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 16/08/18.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import \"NSBundle+TZImagePicker.h\"\n#import \"TZImagePickerController.h\"\n\n@implementation NSBundle (TZImagePicker)\n\n+ (NSBundle *)tz_imagePickerBundle {\n#ifdef SWIFT_PACKAGE\n    NSBundle *bundle = SWIFTPM_MODULE_BUNDLE;\n#else\n    NSBundle *bundle = [NSBundle bundleForClass:[TZImagePickerController class]];\n#endif\n    NSURL *url = [bundle URLForResource:@\"TZImagePickerController\" withExtension:@\"bundle\"];\n    bundle = [NSBundle bundleWithURL:url];\n    return bundle;\n}\n\n+ (NSString *)tz_localizedStringForKey:(NSString *)key {\n    return [self tz_localizedStringForKey:key value:@\"\"];\n}\n\n+ (NSString *)tz_localizedStringForKey:(NSString *)key value:(NSString *)value {\n    NSBundle *bundle = [TZImagePickerConfig sharedInstance].languageBundle;\n    NSString *value1 = [bundle localizedStringForKey:key value:value table:nil];\n    return value1;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZAssetCell.h",
    "content": "//\n//  TZAssetCell.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n#import <Photos/Photos.h>\n\ntypedef enum : NSUInteger {\n    TZAssetCellTypePhoto = 0,\n    TZAssetCellTypeLivePhoto,\n    TZAssetCellTypePhotoGif,\n    TZAssetCellTypeVideo,\n    TZAssetCellTypeAudio,\n} TZAssetCellType;\n\n@class TZAssetModel;\n@interface TZAssetCell : UICollectionViewCell\n@property (weak, nonatomic) UIButton *selectPhotoButton;\n@property (weak, nonatomic) UIButton *cannotSelectLayerButton;\n@property (nonatomic, strong) TZAssetModel *model;\n@property (assign, nonatomic) NSInteger index;\n@property (nonatomic, copy) void (^didSelectPhotoBlock)(BOOL);\n@property (nonatomic, assign) TZAssetCellType type;\n@property (nonatomic, assign) BOOL allowPickingGif;\n@property (nonatomic, assign) BOOL allowPickingMultipleVideo;\n@property (nonatomic, copy) NSString *representedAssetIdentifier;\n@property (nonatomic, assign) int32_t imageRequestID;\n\n@property (nonatomic, strong) UIImage *photoSelImage;\n@property (nonatomic, strong) UIImage *photoDefImage;\n\n@property (nonatomic, assign) BOOL showSelectBtn;\n@property (assign, nonatomic) BOOL allowPreview;\n\n@property (nonatomic, copy) void (^assetCellDidSetModelBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);\n@property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);\n@end\n\n\n@class TZAlbumModel;\n@interface TZAlbumCell : UITableViewCell\n@property (nonatomic, strong) TZAlbumModel *model;\n@property (weak, nonatomic) UIButton *selectedCountButton;\n\n@property (nonatomic, copy) void (^albumCellDidSetModelBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);\n@property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);\n@end\n\n\n@interface TZAssetCameraCell : UICollectionViewCell\n@property (nonatomic, strong) UIImageView *imageView;\n@end\n\n\n@interface TZAssetAddMoreCell : TZAssetCameraCell\n@property (nonatomic, strong) UILabel *tipLabel;\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZAssetCell.m",
    "content": "//\n//  TZAssetCell.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import \"TZAssetCell.h\"\n#import \"TZAssetModel.h\"\n#import \"UIView+TZLayout.h\"\n#import \"TZImageManager.h\"\n#import \"TZImagePickerController.h\"\n#import \"TZProgressView.h\"\n\n@interface TZAssetCell ()\n@property (weak, nonatomic) UIImageView *imageView;       // The photo / 照片\n@property (weak, nonatomic) UIImageView *selectImageView;\n@property (weak, nonatomic) UILabel *indexLabel;\n@property (weak, nonatomic) UIView *bottomView;\n@property (weak, nonatomic) UILabel *timeLength;\n@property (strong, nonatomic) UITapGestureRecognizer *tapGesture;\n\n@property (nonatomic, weak) UIImageView *videoImgView;\n@property (nonatomic, strong) TZProgressView *progressView;\n@property (nonatomic, assign) int32_t bigImageRequestID;\n@end\n\n@implementation TZAssetCell\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reload:) name:@\"TZ_PHOTO_PICKER_RELOAD_NOTIFICATION\" object:nil];\n    return self;\n}\n\n- (void)setModel:(TZAssetModel *)model {\n    _model = model;\n    self.representedAssetIdentifier = model.asset.localIdentifier;\n    int32_t imageRequestID = [[TZImageManager manager] getPhotoWithAsset:model.asset photoWidth:self.tz_width completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        // Set the cell's thumbnail image if it's still showing the same asset.\n        if ([self.representedAssetIdentifier isEqualToString:model.asset.localIdentifier]) {\n            self.imageView.image = photo;\n            [self setNeedsLayout];\n        } else {\n            // NSLog(@\"this cell is showing other asset\");\n            [[PHImageManager defaultManager] cancelImageRequest:self.imageRequestID];\n        }\n        if (!isDegraded) {\n            [self hideProgressView];\n            self.imageRequestID = 0;\n        }\n    } progressHandler:nil networkAccessAllowed:NO];\n    if (imageRequestID && self.imageRequestID && imageRequestID != self.imageRequestID) {\n        [[PHImageManager defaultManager] cancelImageRequest:self.imageRequestID];\n        // NSLog(@\"cancelImageRequest %d\",self.imageRequestID);\n    }\n    self.imageRequestID = imageRequestID;\n    self.selectPhotoButton.selected = model.isSelected;\n    self.selectImageView.image = self.selectPhotoButton.isSelected ? self.photoSelImage : self.photoDefImage;\n    self.indexLabel.hidden = !self.selectPhotoButton.isSelected;\n    \n    self.type = (NSInteger)model.type;\n    // 让宽度/高度小于 最小可选照片尺寸 的图片不能选中\n    if (![[TZImageManager manager] isPhotoSelectableWithAsset:model.asset]) {\n        if (_selectImageView.hidden == NO) {\n            self.selectPhotoButton.hidden = YES;\n            _selectImageView.hidden = YES;\n        }\n    }\n    // 如果用户选中了该图片，提前获取一下大图\n    if (model.isSelected) {\n        [self requestBigImage];\n    } else {\n        [self cancelBigImageRequest];\n    }\n    [self setNeedsLayout];\n    \n    if (self.assetCellDidSetModelBlock) {\n        self.assetCellDidSetModelBlock(self, _imageView, _selectImageView, _indexLabel, _bottomView, _timeLength, _videoImgView);\n    }\n}\n\n- (void)setIndex:(NSInteger)index {\n    _index = index;\n    self.indexLabel.text = [NSString stringWithFormat:@\"%zd\", index];\n    [self.contentView bringSubviewToFront:self.indexLabel];\n}\n\n- (void)setShowSelectBtn:(BOOL)showSelectBtn {\n    _showSelectBtn = showSelectBtn;\n    BOOL selectable = [[TZImageManager manager] isPhotoSelectableWithAsset:self.model.asset];\n    if (!self.selectPhotoButton.hidden) {\n        self.selectPhotoButton.hidden = !showSelectBtn || !selectable;\n    }\n    if (!self.selectImageView.hidden) {\n        self.selectImageView.hidden = !showSelectBtn || !selectable;\n    }\n}\n\n- (void)setType:(TZAssetCellType)type {\n    _type = type;\n    if (type == TZAssetCellTypePhoto || type == TZAssetCellTypeLivePhoto || (type == TZAssetCellTypePhotoGif && !self.allowPickingGif) || self.allowPickingMultipleVideo) {\n        _selectImageView.hidden = NO;\n        _selectPhotoButton.hidden = NO;\n        _bottomView.hidden = YES;\n    } else { // Video of Gif\n        _selectImageView.hidden = YES;\n        _selectPhotoButton.hidden = YES;\n    }\n    \n    if (type == TZAssetCellTypeVideo) {\n        self.bottomView.hidden = NO;\n        self.timeLength.text = _model.timeLength;\n        self.videoImgView.hidden = NO;\n        _timeLength.tz_left = self.videoImgView.tz_right;\n        _timeLength.textAlignment = NSTextAlignmentRight;\n    } else if (type == TZAssetCellTypePhotoGif && self.allowPickingGif) {\n        self.bottomView.hidden = NO;\n        self.timeLength.text = @\"GIF\";\n        self.videoImgView.hidden = YES;\n        _timeLength.tz_left = 5;\n        _timeLength.textAlignment = NSTextAlignmentLeft;\n    }\n}\n\n- (void)setAllowPreview:(BOOL)allowPreview {\n    _allowPreview = allowPreview;\n    if (allowPreview) {\n        _imageView.userInteractionEnabled = NO;\n        _tapGesture.enabled = NO;\n    } else {\n        _imageView.userInteractionEnabled = YES;\n        _tapGesture.enabled = YES;\n    }\n}\n\n- (void)selectPhotoButtonClick:(UIButton *)sender {\n    if (self.didSelectPhotoBlock) {\n        self.didSelectPhotoBlock(sender.isSelected);\n    }\n    self.selectImageView.image = sender.isSelected ? self.photoSelImage : self.photoDefImage;\n    if (sender.isSelected) {\n        [UIView showOscillatoryAnimationWithLayer:_selectImageView.layer type:TZOscillatoryAnimationToBigger];\n        // 用户选中了该图片，提前获取一下大图\n        [self requestBigImage];\n    } else { // 取消选中，取消大图的获取\n        [self cancelBigImageRequest];\n    }\n}\n\n/// 只在单选状态且allowPreview为NO时会有该事件\n- (void)didTapImageView {\n    if (self.didSelectPhotoBlock) {\n        self.didSelectPhotoBlock(NO);\n    }\n}\n\n- (void)hideProgressView {\n    if (_progressView) {\n        self.progressView.hidden = YES;\n        self.imageView.alpha = 1.0;\n    }\n}\n\n- (void)requestBigImage {\n    if (_bigImageRequestID) {\n        [[PHImageManager defaultManager] cancelImageRequest:_bigImageRequestID];\n    }\n    \n    _bigImageRequestID = [[TZImageManager manager] requestImageDataForAsset:_model.asset completion:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {\n        BOOL iCloudSyncFailed = !imageData && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];\n        self.model.iCloudFailed = iCloudSyncFailed;\n        if (iCloudSyncFailed && self.didSelectPhotoBlock) {\n            self.didSelectPhotoBlock(YES);\n            self.selectImageView.image = self.photoDefImage;\n        }\n        [self hideProgressView];\n    } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n        if (self.model.isSelected) {\n            progress = progress > 0.02 ? progress : 0.02;;\n            self.progressView.progress = progress;\n            self.progressView.hidden = NO;\n            self.imageView.alpha = 0.4;\n            if (progress >= 1) {\n                [self hideProgressView];\n            }\n        } else {\n            // 快速连续点几次，会EXC_BAD_ACCESS...\n            // *stop = YES;\n            [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;\n            [self cancelBigImageRequest];\n        }\n    }];\n    if (_model.type == TZAssetCellTypeVideo) {\n        [[TZImageManager manager] getVideoWithAsset:_model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {\n            BOOL iCloudSyncFailed = !playerItem && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];\n            self.model.iCloudFailed = iCloudSyncFailed;\n            if (iCloudSyncFailed && self.didSelectPhotoBlock) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    self.didSelectPhotoBlock(YES);\n                    self.selectImageView.image = self.photoDefImage;\n                });\n            }\n        }];\n    }\n}\n\n- (void)cancelBigImageRequest {\n    if (_bigImageRequestID) {\n        [[PHImageManager defaultManager] cancelImageRequest:_bigImageRequestID];\n    }\n    [self hideProgressView];\n}\n\n#pragma mark - Notification\n\n- (void)reload:(NSNotification *)noti {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)noti.object;\n    \n    UIViewController *parentViewController = nil;\n    UIResponder *responder = self.nextResponder;\n    do {\n        if ([responder isKindOfClass:[UIViewController class]]) {\n            parentViewController = (UIViewController *)responder;\n            break;\n        }\n        responder = responder.nextResponder;\n    } while (responder);\n    \n    if (parentViewController.navigationController != tzImagePickerVc) {\n        return;\n    }\n    \n    if (self.model.isSelected && tzImagePickerVc.showSelectedIndex) {\n        self.index = [tzImagePickerVc.selectedAssetIds indexOfObject:self.model.asset.localIdentifier] + 1;\n    }\n    self.indexLabel.hidden = !self.selectPhotoButton.isSelected;\n    BOOL notSelectable = [TZCommonTools isAssetNotSelectable:self.model tzImagePickerVc:tzImagePickerVc];\n    if (notSelectable && tzImagePickerVc.showPhotoCannotSelectLayer && !self.model.isSelected) {\n        self.cannotSelectLayerButton.backgroundColor = tzImagePickerVc.cannotSelectLayerColor;\n        self.cannotSelectLayerButton.hidden = NO;\n    } else {\n        self.cannotSelectLayerButton.hidden = YES;\n    }\n}\n\n#pragma mark - Lazy load\n\n- (UIButton *)selectPhotoButton {\n    if (_selectPhotoButton == nil) {\n        UIButton *selectPhotoButton = [[UIButton alloc] init];\n        [selectPhotoButton addTarget:self action:@selector(selectPhotoButtonClick:) forControlEvents:UIControlEventTouchUpInside];\n        [self.contentView addSubview:selectPhotoButton];\n        _selectPhotoButton = selectPhotoButton;\n    }\n    return _selectPhotoButton;\n}\n\n- (UIImageView *)imageView {\n    if (_imageView == nil) {\n        UIImageView *imageView = [[UIImageView alloc] init];\n        imageView.contentMode = UIViewContentModeScaleAspectFill;\n        imageView.clipsToBounds = YES;\n        [self.contentView addSubview:imageView];\n        _imageView = imageView;\n        \n        _tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapImageView)];\n        [_imageView addGestureRecognizer:_tapGesture];\n        self.allowPreview = self.allowPreview;\n    }\n    return _imageView;\n}\n\n- (UIImageView *)selectImageView {\n    if (_selectImageView == nil) {\n        UIImageView *selectImageView = [[UIImageView alloc] init];\n        selectImageView.contentMode = UIViewContentModeCenter;\n        selectImageView.clipsToBounds = YES;\n        [self.contentView addSubview:selectImageView];\n        _selectImageView = selectImageView;\n    }\n    return _selectImageView;\n}\n\n- (UIView *)bottomView {\n    if (_bottomView == nil) {\n        UIView *bottomView = [[UIView alloc] init];\n        static NSInteger rgb = 0;\n        bottomView.userInteractionEnabled = NO;\n        bottomView.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.8];\n        [self.contentView addSubview:bottomView];\n        _bottomView = bottomView;\n    }\n    return _bottomView;\n}\n\n- (UIButton *)cannotSelectLayerButton {\n    if (_cannotSelectLayerButton == nil) {\n        UIButton *cannotSelectLayerButton = [[UIButton alloc] init];\n        [self.contentView addSubview:cannotSelectLayerButton];\n        _cannotSelectLayerButton = cannotSelectLayerButton;\n    }\n    return _cannotSelectLayerButton;\n}\n\n- (UIImageView *)videoImgView {\n    if (_videoImgView == nil) {\n        UIImageView *videoImgView = [[UIImageView alloc] init];\n        [videoImgView setImage:[UIImage tz_imageNamedFromMyBundle:@\"VideoSendIcon\"]];\n        [self.bottomView addSubview:videoImgView];\n        _videoImgView = videoImgView;\n    }\n    return _videoImgView;\n}\n\n- (UILabel *)timeLength {\n    if (_timeLength == nil) {\n        UILabel *timeLength = [[UILabel alloc] init];\n        timeLength.font = [UIFont boldSystemFontOfSize:11];\n        timeLength.textColor = [UIColor whiteColor];\n        timeLength.textAlignment = NSTextAlignmentRight;\n        [self.bottomView addSubview:timeLength];\n        _timeLength = timeLength;\n    }\n    return _timeLength;\n}\n\n- (UILabel *)indexLabel {\n    if (_indexLabel == nil) {\n        UILabel *indexLabel = [[UILabel alloc] init];\n        indexLabel.font = [UIFont systemFontOfSize:14];\n        indexLabel.adjustsFontSizeToFitWidth = YES;\n        indexLabel.textColor = [UIColor whiteColor];\n        indexLabel.textAlignment = NSTextAlignmentCenter;\n        [self.contentView addSubview:indexLabel];\n        _indexLabel = indexLabel;\n    }\n    return _indexLabel;\n}\n\n- (TZProgressView *)progressView {\n    if (_progressView == nil) {\n        _progressView = [[TZProgressView alloc] init];\n        _progressView.hidden = YES;\n        [self addSubview:_progressView];\n    }\n    return _progressView;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    _cannotSelectLayerButton.frame = self.bounds;\n    if (self.allowPreview) {\n        _selectPhotoButton.frame = CGRectMake(self.tz_width - 44, 0, 44, 44);\n    } else {\n        _selectPhotoButton.frame = self.bounds;\n    }\n    _selectImageView.frame = CGRectMake(self.tz_width - 27, 3, 24, 24);\n    if (_selectImageView.image.size.width <= 27) {\n        _selectImageView.contentMode = UIViewContentModeCenter;\n    } else {\n        _selectImageView.contentMode = UIViewContentModeScaleAspectFit;\n    }\n    _indexLabel.frame = _selectImageView.frame;\n    _imageView.frame = self.bounds;\n\n    static CGFloat progressWH = 20;\n    CGFloat progressXY = (self.tz_width - progressWH) / 2;\n    _progressView.frame = CGRectMake(progressXY, progressXY, progressWH, progressWH);\n\n    _bottomView.frame = CGRectMake(0, self.tz_height - 17, self.tz_width, 17);\n    _videoImgView.frame = CGRectMake(8, 0, 17, 17);\n    _timeLength.frame = CGRectMake(self.videoImgView.tz_right, 0, self.tz_width - self.videoImgView.tz_right - 5, 17);\n    \n    self.type = (NSInteger)self.model.type;\n    self.showSelectBtn = self.showSelectBtn;\n    \n    [self.contentView bringSubviewToFront:_bottomView];\n    [self.contentView bringSubviewToFront:_cannotSelectLayerButton];\n    [self.contentView bringSubviewToFront:_selectPhotoButton];\n    [self.contentView bringSubviewToFront:_selectImageView];\n    [self.contentView bringSubviewToFront:_indexLabel];\n    \n    if (self.assetCellDidLayoutSubviewsBlock) {\n        self.assetCellDidLayoutSubviewsBlock(self, _imageView, _selectImageView, _indexLabel, _bottomView, _timeLength, _videoImgView);\n    }\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n@end\n\n@interface TZAlbumCell ()\n@property (weak, nonatomic) UIImageView *posterImageView;\n@property (weak, nonatomic) UILabel *titleLabel;\n@end\n\n@implementation TZAlbumCell\n\n- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {\n    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];\n    self.backgroundColor = [UIColor whiteColor];\n    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;\n    return self;\n}\n\n- (void)setModel:(TZAlbumModel *)model {\n    _model = model;\n    \n    UIColor *nameColor = UIColor.blackColor;\n    if (@available(iOS 13.0, *)) {\n        nameColor = UIColor.labelColor;\n    }\n    NSMutableAttributedString *nameString = [[NSMutableAttributedString alloc] initWithString:model.name attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:nameColor}];\n    NSAttributedString *countString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@\"  (%zd)\",model.count] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor lightGrayColor]}];\n    [nameString appendAttributedString:countString];\n    self.titleLabel.attributedText = nameString;\n    [[TZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) {\n        self.posterImageView.image = postImage;\n        [self setNeedsLayout];\n    }];\n    if (model.selectedCount) {\n        self.selectedCountButton.hidden = NO;\n        [self.selectedCountButton setTitle:[NSString stringWithFormat:@\"%zd\",model.selectedCount] forState:UIControlStateNormal];\n    } else {\n        self.selectedCountButton.hidden = YES;\n    }\n    \n    if (self.albumCellDidSetModelBlock) {\n        self.albumCellDidSetModelBlock(self, _posterImageView, _titleLabel);\n    }\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    _selectedCountButton.frame = CGRectMake(self.contentView.tz_width - 24, 23, 24, 24);\n    NSInteger titleHeight = ceil(self.titleLabel.font.lineHeight);\n    self.titleLabel.frame = CGRectMake(80, (self.tz_height - titleHeight) / 2, self.tz_width - 80 - 50, titleHeight);\n    self.posterImageView.frame = CGRectMake(0, 0, 70, 70);\n    \n    if (self.albumCellDidLayoutSubviewsBlock) {\n        self.albumCellDidLayoutSubviewsBlock(self, _posterImageView, _titleLabel);\n    }\n}\n\n- (void)layoutSublayersOfLayer:(CALayer *)layer {\n    [super layoutSublayersOfLayer:layer];\n}\n\n#pragma mark - Lazy load\n\n- (UIImageView *)posterImageView {\n    if (_posterImageView == nil) {\n        UIImageView *posterImageView = [[UIImageView alloc] init];\n        posterImageView.contentMode = UIViewContentModeScaleAspectFill;\n        posterImageView.clipsToBounds = YES;\n        [self.contentView addSubview:posterImageView];\n        _posterImageView = posterImageView;\n    }\n    return _posterImageView;\n}\n\n- (UILabel *)titleLabel {\n    if (_titleLabel == nil) {\n        UILabel *titleLabel = [[UILabel alloc] init];\n        titleLabel.font = [UIFont boldSystemFontOfSize:17];\n        if (@available(iOS 13.0, *)) {\n            titleLabel.textColor = UIColor.labelColor;\n        } else {\n            titleLabel.textColor = [UIColor blackColor];\n        }\n        titleLabel.textAlignment = NSTextAlignmentLeft;\n        [self.contentView addSubview:titleLabel];\n        _titleLabel = titleLabel;\n    }\n    return _titleLabel;\n}\n\n- (UIButton *)selectedCountButton {\n    if (_selectedCountButton == nil) {\n        UIButton *selectedCountButton = [[UIButton alloc] init];\n        selectedCountButton.titleLabel.adjustsFontSizeToFitWidth = YES;\n        selectedCountButton.layer.cornerRadius = 12;\n        selectedCountButton.clipsToBounds = YES;\n        selectedCountButton.backgroundColor = [UIColor redColor];\n        [selectedCountButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];\n        selectedCountButton.titleLabel.font = [UIFont systemFontOfSize:15];\n        [self.contentView addSubview:selectedCountButton];\n        _selectedCountButton = selectedCountButton;\n    }\n    return _selectedCountButton;\n}\n\n@end\n\n\n\n@implementation TZAssetCameraCell\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        self.backgroundColor = [UIColor whiteColor];\n        _imageView = [[UIImageView alloc] init];\n        _imageView.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.500];\n        _imageView.contentMode = UIViewContentModeScaleAspectFill;\n        [self.contentView addSubview:_imageView];\n        self.clipsToBounds = YES;\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    _imageView.frame = self.bounds;\n}\n\n@end\n\n\n@implementation TZAssetAddMoreCell\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        _tipLabel = [[UILabel alloc] init];\n        _tipLabel.numberOfLines = 2;\n        _tipLabel.textAlignment = NSTextAlignmentCenter;\n        _tipLabel.font = [UIFont systemFontOfSize:12];\n        _tipLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;\n        CGFloat rgb = 156 / 255.0;\n        _tipLabel.textColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];\n        [self.contentView addSubview:_tipLabel];\n\n        self.clipsToBounds = YES;\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    _tipLabel.frame = CGRectMake(5, self.tz_height / 2, self.tz_width - 10, self.tz_height / 2 - 5);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZAssetModel.h",
    "content": "//\n//  TZAssetModel.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n#import <Photos/Photos.h>\n\ntypedef enum : NSUInteger {\n    TZAssetModelMediaTypePhoto = 0,\n    TZAssetModelMediaTypeLivePhoto,\n    TZAssetModelMediaTypePhotoGif,\n    TZAssetModelMediaTypeVideo,\n    TZAssetModelMediaTypeAudio\n} TZAssetModelMediaType;\n\n@class PHAsset;\n@interface TZAssetModel : NSObject\n\n@property (nonatomic, strong) PHAsset *asset;\n@property (nonatomic, assign) BOOL isSelected;      ///< The select status of a photo, default is No\n@property (nonatomic, assign) TZAssetModelMediaType type;\n@property (nonatomic, copy) NSString *timeLength;\n@property (nonatomic, assign) BOOL iCloudFailed;\n\n/// Init a photo dataModel With a PHAsset\n/// 用一个PHAsset实例，初始化一个照片模型\n+ (instancetype)modelWithAsset:(PHAsset *)asset type:(TZAssetModelMediaType)type;\n+ (instancetype)modelWithAsset:(PHAsset *)asset type:(TZAssetModelMediaType)type timeLength:(NSString *)timeLength;\n\n@end\n\n\n@class PHFetchResult;\n@interface TZAlbumModel : NSObject\n\n@property (nonatomic, strong) NSString *name;        ///< The album name\n@property (nonatomic, assign) NSInteger count;       ///< Count of photos the album contain\n@property (nonatomic, strong) PHFetchResult *result;\n@property (nonatomic, strong) PHAssetCollection *collection;\n@property (nonatomic, strong) PHFetchOptions *options;\n\n@property (nonatomic, strong) NSArray *models;\n@property (nonatomic, strong) NSArray *selectedModels;\n@property (nonatomic, assign) NSUInteger selectedCount;\n\n@property (nonatomic, assign) BOOL isCameraRoll;\n\n- (void)setResult:(PHFetchResult *)result needFetchAssets:(BOOL)needFetchAssets;\n- (void)refreshFetchResult;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZAssetModel.m",
    "content": "//\n//  TZAssetModel.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import \"TZAssetModel.h\"\n#import \"TZImageManager.h\"\n\n@implementation TZAssetModel\n\n+ (instancetype)modelWithAsset:(PHAsset *)asset type:(TZAssetModelMediaType)type{\n    TZAssetModel *model = [[TZAssetModel alloc] init];\n    model.asset = asset;\n    model.isSelected = NO;\n    model.type = type;\n    return model;\n}\n\n+ (instancetype)modelWithAsset:(PHAsset *)asset type:(TZAssetModelMediaType)type timeLength:(NSString *)timeLength {\n    TZAssetModel *model = [self modelWithAsset:asset type:type];\n    model.timeLength = timeLength;\n    return model;\n}\n\n@end\n\n\n\n@implementation TZAlbumModel\n\n- (void)setResult:(PHFetchResult *)result needFetchAssets:(BOOL)needFetchAssets {\n    _result = result;\n    if (needFetchAssets) {\n        [[TZImageManager manager] getAssetsFromFetchResult:result completion:^(NSArray<TZAssetModel *> *models) {\n            self->_models = models;\n            if (self->_selectedModels) {\n                [self checkSelectedModels];\n            }\n        }];\n    }\n}\n\n- (void)refreshFetchResult {\n    PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:self.collection options:self.options];\n    self.count = fetchResult.count;\n    [self setResult:fetchResult];\n}\n\n- (void)setSelectedModels:(NSArray *)selectedModels {\n    _selectedModels = selectedModels;\n    if (_models) {\n        [self checkSelectedModels];\n    }\n}\n\n- (void)checkSelectedModels {\n    self.selectedCount = 0;\n    NSMutableSet *selectedAssets = [NSMutableSet setWithCapacity:_selectedModels.count];\n    for (TZAssetModel *model in _selectedModels) {\n        [selectedAssets addObject:model.asset];\n    }\n    for (TZAssetModel *model in _models) {\n        if ([selectedAssets containsObject:model.asset]) {\n            self.selectedCount ++;\n        }\n    }\n}\n\n- (NSString *)name {\n    if (_name) {\n        return _name;\n    }\n    return @\"\";\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZAuthLimitedFooterTipView.h",
    "content": "//\n//  TZAuthLimitedFooterTipView.h\n//  TZImagePickerController\n//\n//  Created by qiaoxy on 2021/8/24.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface TZAuthLimitedFooterTipView : UIView\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZAuthLimitedFooterTipView.m",
    "content": "//\n//  TZAuthLimitedFooterTipView.m\n//  TZImagePickerController\n//\n//  Created by qiaoxy on 2021/8/24.\n//\n\n#import \"TZAuthLimitedFooterTipView.h\"\n#import \"TZImagePickerController.h\"\n\n@interface TZAuthLimitedFooterTipView()\n@property (nonatomic,strong) UIImageView *tipImgView;\n@property (nonatomic,strong) UILabel *tipLable;\n@property (nonatomic,strong) UIImageView *detailImgView;\n@end\n\n@implementation TZAuthLimitedFooterTipView\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        [self initSubViews];\n    }\n    return self;\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self initSubViews];\n    }\n    return self;\n}\n\n- (void)initSubViews {\n    [self addSubview:self.tipImgView];\n    [self addSubview:self.tipLable];\n    [self addSubview:self.detailImgView];\n    CGFloat margin = 15;\n    CGFloat tipImgViewWH = 20;\n    CGFloat detailImgViewWH = 12;\n    CGFloat screenW = [UIScreen mainScreen].bounds.size.width;\n\n    self.tipImgView.frame = CGRectMake(margin, 0, tipImgViewWH, tipImgViewWH);\n    self.detailImgView.frame = CGRectMake(screenW - margin - detailImgViewWH, 0, detailImgViewWH, detailImgViewWH);\n    \n    CGFloat tipLabelX = CGRectGetMaxX(self.tipImgView.frame) + 10;\n    CGFloat tipLabelW = screenW - tipLabelX - detailImgViewWH - margin - 4;\n    self.tipLable.frame = CGRectMake(tipLabelX, 0, tipLabelW, self.bounds.size.height);\n    \n    self.tipImgView.center = CGPointMake(self.tipImgView.center.x, self.tipLable.center.y);\n    self.detailImgView.center = CGPointMake(self.detailImgView.center.x, self.tipLable.center.y);\n}\n\n#pragma mark - Getter\n\n- (UIImageView *)tipImgView {\n    if (!_tipImgView) {\n        _tipImgView = [[UIImageView alloc] init];\n        _tipImgView.contentMode = UIViewContentModeScaleAspectFit;\n        _tipImgView.image = [UIImage tz_imageNamedFromMyBundle:@\"tip\"];\n    }\n    return _tipImgView;\n}\n\n- (UILabel *)tipLable {\n    if (!_tipLable) {\n        _tipLable = [[UILabel alloc] init];\n        NSString *appName = [TZCommonTools tz_getAppName];\n        _tipLable.text = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Allow %@ to access your all photos\"], appName];\n        _tipLable.numberOfLines = 0;\n        _tipLable.font = [UIFont systemFontOfSize:14];\n        _tipLable.textColor = [UIColor colorWithRed:0.40 green:0.40 blue:0.40 alpha:1.0];\n    }\n    return _tipLable;\n}\n\n- (UIImageView *)detailImgView {\n    if (!_detailImgView) {\n        _detailImgView = [[UIImageView alloc] init];\n        _detailImgView.contentMode = UIViewContentModeScaleAspectFit;\n        _detailImgView.image = [UIImage tz_imageNamedFromMyBundle:@\"right_arrow\"];\n    }\n    return _detailImgView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.h",
    "content": "//\n//  TZGifPhotoPreviewController.h\n//  TZImagePickerController\n//\n//  Created by ttouch on 2016/12/13.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@class TZAssetModel;\n@interface TZGifPhotoPreviewController : UIViewController\n\n@property (nonatomic, strong) TZAssetModel *model;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.m",
    "content": "//\n//  TZGifPhotoPreviewController.m\n//  TZImagePickerController\n//\n//  Created by ttouch on 2016/12/13.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import \"TZGifPhotoPreviewController.h\"\n#import \"TZImagePickerController.h\"\n#import \"TZAssetModel.h\"\n#import \"UIView+TZLayout.h\"\n#import \"TZPhotoPreviewCell.h\"\n#import \"TZImageManager.h\"\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n\n@interface TZGifPhotoPreviewController () {\n    UIView *_toolBar;\n    UIButton *_doneButton;\n    UIProgressView *_progress;\n    \n    TZPhotoPreviewView *_previewView;\n    \n    UIStatusBarStyle _originStatusBarStyle;\n}\n@property (assign, nonatomic) BOOL needShowStatusBar;\n@end\n\n@implementation TZGifPhotoPreviewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.needShowStatusBar = ![UIApplication sharedApplication].statusBarHidden;\n    self.view.backgroundColor = [UIColor blackColor];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc) {\n        self.navigationItem.title = [NSString stringWithFormat:@\"GIF %@\",tzImagePickerVc.previewBtnTitleStr];\n    }\n    [self configPreviewView];\n    [self configBottomToolBar];\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    _originStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;\n    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;\n}\n\n- (void)viewWillDisappear:(BOOL)animated {\n    [super viewWillDisappear:animated];\n    if (self.needShowStatusBar) {\n        [UIApplication sharedApplication].statusBarHidden = NO;\n    }\n    [UIApplication sharedApplication].statusBarStyle = _originStatusBarStyle;\n}\n\n- (void)configPreviewView {\n    _previewView = [[TZPhotoPreviewView alloc] initWithFrame:CGRectZero];\n    _previewView.model = self.model;\n    __weak typeof(self) weakSelf = self;\n    [_previewView setSingleTapGestureBlock:^{\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        [strongSelf signleTapAction];\n    }];\n    [self.view addSubview:_previewView];\n}\n\n- (void)configBottomToolBar {\n    _toolBar = [[UIView alloc] initWithFrame:CGRectZero];\n    CGFloat rgb = 34 / 255.0;\n    _toolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.7];\n    \n    _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc) {\n        [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];\n        [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];\n    } else {\n        [_doneButton setTitle:[NSBundle tz_localizedStringForKey:@\"Done\"] forState:UIControlStateNormal];\n        [_doneButton setTitleColor:[UIColor colorWithRed:(83/255.0) green:(179/255.0) blue:(17/255.0) alpha:1.0] forState:UIControlStateNormal];\n    }\n    [_toolBar addSubview:_doneButton];\n    \n    UILabel *byteLabel = [[UILabel alloc] init];\n    byteLabel.textColor = [UIColor whiteColor];\n    byteLabel.font = [UIFont systemFontOfSize:13];\n    byteLabel.frame = CGRectMake(10, 0, 100, 44);\n    [[TZImageManager manager] getPhotosBytesWithArray:@[_model] completion:^(NSString *totalBytes) {\n        byteLabel.text = totalBytes;\n    }];\n    [_toolBar addSubview:byteLabel];\n    \n    [self.view addSubview:_toolBar];\n    \n    if (tzImagePickerVc.gifPreviewPageUIConfigBlock) {\n        tzImagePickerVc.gifPreviewPageUIConfigBlock(_toolBar, _doneButton);\n    }\n}\n\n- (UIStatusBarStyle)preferredStatusBarStyle {\n    TZImagePickerController *tzImagePicker = (TZImagePickerController *)self.navigationController;\n    if (tzImagePicker && [tzImagePicker isKindOfClass:[TZImagePickerController class]]) {\n        return tzImagePicker.statusBarStyle;\n    }\n    return [super preferredStatusBarStyle];\n}\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n    \n    _previewView.frame = self.view.bounds;\n    _previewView.scrollView.frame = self.view.bounds;\n    CGFloat toolBarHeight = 44 + [TZCommonTools tz_safeAreaInsets].bottom;\n    _toolBar.frame = CGRectMake(0, self.view.tz_height - toolBarHeight, self.view.tz_width, toolBarHeight);\n    [_doneButton sizeToFit];\n    _doneButton.frame = CGRectMake(self.view.tz_width - _doneButton.tz_width - 12, 0, MAX(44, _doneButton.tz_width), 44);\n    \n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc.gifPreviewPageDidLayoutSubviewsBlock) {\n        tzImagePickerVc.gifPreviewPageDidLayoutSubviewsBlock(_toolBar, _doneButton);\n    }\n}\n\n#pragma mark - Click Event\n\n- (void)signleTapAction {\n    _toolBar.hidden = !_toolBar.isHidden;\n    [self.navigationController setNavigationBarHidden:_toolBar.isHidden];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (_toolBar.isHidden) {\n        [UIApplication sharedApplication].statusBarHidden = YES;\n    } else if (tzImagePickerVc.needShowStatusBar) {\n        [UIApplication sharedApplication].statusBarHidden = NO;\n    }\n}\n\n- (void)doneButtonClick {\n    if (self.navigationController) {\n        TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n        if (imagePickerVc.autoDismiss) {\n            [self.navigationController dismissViewControllerAnimated:YES completion:^{\n                [self callDelegateMethod];\n            }];\n        } else {\n            [self callDelegateMethod];\n        }\n    } else {\n        [self dismissViewControllerAnimated:YES completion:^{\n            [self callDelegateMethod];\n        }];\n    }\n}\n\n- (void)callDelegateMethod {\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    UIImage *animatedImage = _previewView.imageView.image;\n    if ([imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingGifImage:sourceAssets:)]) {\n        [imagePickerVc.pickerDelegate imagePickerController:imagePickerVc didFinishPickingGifImage:animatedImage sourceAssets:_model.asset];\n    }\n    if (imagePickerVc.didFinishPickingGifImageHandle) {\n        imagePickerVc.didFinishPickingGifImageHandle(animatedImage,_model.asset);\n    }\n}\n\n#pragma clang diagnostic pop\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImageCropManager.h",
    "content": "//\n//  TZImageCropManager.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 2016/12/5.\n//  Copyright © 2016年 谭真. All rights reserved.\n//  图片裁剪管理类\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n\n@interface TZImageCropManager : NSObject\n\n/// 裁剪框背景的处理\n+ (void)overlayClippingWithView:(UIView *)view cropRect:(CGRect)cropRect containerView:(UIView *)containerView needCircleCrop:(BOOL)needCircleCrop;\n\n/*\n 1.7.2 为了解决多位同学对于图片裁剪的需求，我这两天有空便在研究图片裁剪\n 幸好有tuyou的PhotoTweaks库做参考，裁剪的功能实现起来简单许多\n 该方法和其内部引用的方法基本来自于tuyou的PhotoTweaks库，我做了稍许删减和修改\n 感谢tuyou同学在github开源了优秀的裁剪库PhotoTweaks，表示感谢\n PhotoTweaks库的github链接：https://github.com/itouch2/PhotoTweaks\n */\n/// 获得裁剪后的图片\n+ (UIImage *)cropImageView:(UIImageView *)imageView toRect:(CGRect)rect zoomScale:(double)zoomScale containerView:(UIView *)containerView;\n\n/// 获取圆形图片\n+ (UIImage *)circularClipImage:(UIImage *)image;\n\n@end\n\n\n/// 该分类的代码来自SDWebImage:https://github.com/rs/SDWebImage\n/// 为了防止冲突，我将分类名字和方法名字做了修改\n@interface UIImage (TZGif)\n\n+ (UIImage *)sd_tz_animatedGIFWithData:(NSData *)data;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImageCropManager.m",
    "content": "//\n//  TZImageCropManager.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 2016/12/5.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import \"TZImageCropManager.h\"\n#import \"UIView+TZLayout.h\"\n#import <ImageIO/ImageIO.h>\n#import \"TZImageManager.h\"\n#import \"TZImagePickerController.h\"\n\n@implementation TZImageCropManager\n\n/// 裁剪框背景的处理\n+ (void)overlayClippingWithView:(UIView *)view cropRect:(CGRect)cropRect containerView:(UIView *)containerView needCircleCrop:(BOOL)needCircleCrop {\n    UIBezierPath *path= [UIBezierPath bezierPathWithRect:[UIScreen mainScreen].bounds];\n    CAShapeLayer *layer = [CAShapeLayer layer];\n    if (needCircleCrop) { // 圆形裁剪框\n        [path appendPath:[UIBezierPath bezierPathWithRoundedRect:cropRect cornerRadius:cropRect.size.width / 2]];\n    } else { // 矩形裁剪框\n        [path appendPath:[UIBezierPath bezierPathWithRect:cropRect]];\n    }\n    layer.path = path.CGPath;\n    layer.fillRule = kCAFillRuleEvenOdd;\n    layer.fillColor = [[UIColor blackColor] CGColor];\n    layer.opacity = 0.5;\n    [view.layer addSublayer:layer];\n}\n\n/// 获得裁剪后的图片\n+ (UIImage *)cropImageView:(UIImageView *)imageView toRect:(CGRect)rect zoomScale:(double)zoomScale containerView:(UIView *)containerView {\n    CGAffineTransform transform = CGAffineTransformIdentity;\n    // 平移的处理\n    CGRect imageViewRect = [imageView convertRect:imageView.bounds toView:containerView];\n    CGPoint point = CGPointMake(imageViewRect.origin.x + imageViewRect.size.width / 2, imageViewRect.origin.y + imageViewRect.size.height / 2);\n    CGFloat xMargin = containerView.tz_width - CGRectGetMaxX(rect) - rect.origin.x;\n    CGPoint zeroPoint = CGPointMake((CGRectGetWidth(containerView.frame) - xMargin) / 2, containerView.center.y);\n    CGPoint translation = CGPointMake(point.x - zeroPoint.x, point.y - zeroPoint.y);\n    transform = CGAffineTransformTranslate(transform, translation.x, translation.y);\n    // 缩放的处理\n    transform = CGAffineTransformScale(transform, zoomScale, zoomScale);\n    \n    CGImageRef imageRef = [self newTransformedImage:transform\n                                        sourceImage:imageView.image.CGImage\n                                         sourceSize:imageView.image.size\n                                        outputWidth:rect.size.width * [UIScreen mainScreen].scale\n                                           cropSize:rect.size\n                                      imageViewSize:imageView.frame.size];\n    UIImage *cropedImage = [UIImage imageWithCGImage:imageRef];\n    cropedImage = [[TZImageManager manager] fixOrientation:cropedImage];\n    CGImageRelease(imageRef);\n    return cropedImage;\n}\n\n+ (CGImageRef)newTransformedImage:(CGAffineTransform)transform sourceImage:(CGImageRef)sourceImage sourceSize:(CGSize)sourceSize  outputWidth:(CGFloat)outputWidth cropSize:(CGSize)cropSize imageViewSize:(CGSize)imageViewSize {\n    CGImageRef source = [self newScaledImage:sourceImage toSize:sourceSize];\n    \n    CGFloat aspect = cropSize.height/cropSize.width;\n    CGSize outputSize = CGSizeMake(outputWidth, outputWidth*aspect);\n    \n    CGContextRef context = CGBitmapContextCreate(NULL, outputSize.width, outputSize.height, CGImageGetBitsPerComponent(source), 0, CGImageGetColorSpace(source), CGImageGetBitmapInfo(source));\n    CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);\n    CGContextFillRect(context, CGRectMake(0, 0, outputSize.width, outputSize.height));\n    \n    CGAffineTransform uiCoords = CGAffineTransformMakeScale(outputSize.width / cropSize.width, outputSize.height / cropSize.height);\n    uiCoords = CGAffineTransformTranslate(uiCoords, cropSize.width/2.0, cropSize.height / 2.0);\n    uiCoords = CGAffineTransformScale(uiCoords, 1.0, -1.0);\n    CGContextConcatCTM(context, uiCoords);\n    \n    CGContextConcatCTM(context, transform);\n    CGContextScaleCTM(context, 1.0, -1.0);\n    \n    CGContextDrawImage(context, CGRectMake(-imageViewSize.width/2, -imageViewSize.height/2.0, imageViewSize.width, imageViewSize.height), source);\n    CGImageRef resultRef = CGBitmapContextCreateImage(context);\n    CGContextRelease(context);\n    CGImageRelease(source);\n    return resultRef;\n}\n\n+ (CGImageRef)newScaledImage:(CGImageRef)source toSize:(CGSize)size {\n    CGSize srcSize = size;\n    CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();\n    CGContextRef context = CGBitmapContextCreate(NULL, size.width, size.height, 8, 0, rgbColorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);\n    CGColorSpaceRelease(rgbColorSpace);\n    \n    CGContextSetInterpolationQuality(context, kCGInterpolationNone);\n    CGContextTranslateCTM(context, size.width/2, size.height/2);\n    \n    CGContextDrawImage(context, CGRectMake(-srcSize.width/2, -srcSize.height/2, srcSize.width, srcSize.height), source);\n    \n    CGImageRef resultRef = CGBitmapContextCreateImage(context);\n    CGContextRelease(context);\n    return resultRef;\n}\n\n/// 获取圆形图片\n+ (UIImage *)circularClipImage:(UIImage *)image {\n    UIGraphicsBeginImageContextWithOptions(image.size, NO, [UIScreen mainScreen].scale);\n    \n    CGContextRef ctx = UIGraphicsGetCurrentContext();\n    CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);\n    CGContextAddEllipseInRect(ctx, rect);\n    CGContextClip(ctx);\n    \n    [image drawInRect:rect];\n    UIImage *circleImage = UIGraphicsGetImageFromCurrentImageContext();\n    \n    UIGraphicsEndImageContext();\n    return circleImage;\n}\n\n@end\n\n\n@implementation UIImage (TZGif)\n\n+ (UIImage *)sd_tz_animatedGIFWithData:(NSData *)data {\n    if (!data) {\n        return nil;\n    }\n    \n    CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL);\n    \n    size_t count = CGImageSourceGetCount(source);\n    \n    UIImage *animatedImage;\n    \n    if (count <= 1) {\n        animatedImage = [[UIImage alloc] initWithData:data];\n    }\n    else {\n        // images数组过大时内存会飙升，在这里限制下最大count\n        NSInteger maxCount = [TZImagePickerConfig sharedInstance].gifPreviewMaxImagesCount ?: 50;\n        NSInteger interval = MAX((count + maxCount / 2) / maxCount, 1);\n        \n        NSMutableArray *images = [NSMutableArray array];\n        \n        NSTimeInterval duration = 0.0f;\n        \n        for (size_t i = 0; i < count; i+=interval) {\n            CGImageRef image = CGImageSourceCreateImageAtIndex(source, i, NULL);\n            if (!image) {\n                continue;\n            }\n            \n            duration += [self sd_frameDurationAtIndex:i source:source] * MIN(interval, 3);\n            \n            [images addObject:[UIImage imageWithCGImage:image scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp]];\n            \n            CGImageRelease(image);\n        }\n        \n        if (!duration) {\n            duration = (1.0f / 10.0f) * count;\n        }\n        \n        animatedImage = [UIImage animatedImageWithImages:images duration:duration];\n    }\n    \n    CFRelease(source);\n    \n    return animatedImage;\n}\n\n+ (float)sd_frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source {\n    float frameDuration = 0.1f;\n    CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil);\n    NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties;\n    NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary];\n    \n    NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime];\n    if (delayTimeUnclampedProp) {\n        frameDuration = [delayTimeUnclampedProp floatValue];\n    }\n    else {\n        \n        NSNumber *delayTimeProp = gifProperties[(NSString *)kCGImagePropertyGIFDelayTime];\n        if (delayTimeProp) {\n            frameDuration = [delayTimeProp floatValue];\n        }\n    }\n    \n    // Many annoying ads specify a 0 duration to make an image flash as quickly as possible.\n    // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify\n    // a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082>\n    // for more information.\n    \n    if (frameDuration < 0.011f) {\n        frameDuration = 0.100f;\n    }\n    \n    CFRelease(cfFrameProperties);\n    return frameDuration;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImageManager.h",
    "content": "//\n//  TZImageManager.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 16/1/4.\n//  Copyright © 2016年 谭真. All rights reserved.\n//  图片资源获取管理类\n\n#import <Foundation/Foundation.h>\n#import <UIKit/UIKit.h>\n#import <AVFoundation/AVFoundation.h>\n#import <Photos/Photos.h>\n#import \"TZAssetModel.h\"\n\n@class TZAlbumModel,TZAssetModel;\n@protocol TZImagePickerControllerDelegate;\n@interface TZImageManager : NSObject\n\n@property (nonatomic, strong) PHCachingImageManager *cachingImageManager;\n\n+ (instancetype)manager NS_SWIFT_NAME(default());\n+ (void)deallocManager;\n\n@property (weak, nonatomic) id<TZImagePickerControllerDelegate> pickerDelegate;\n\n@property (nonatomic, assign) BOOL shouldFixOrientation;\n\n@property (nonatomic, assign) BOOL isPreviewNetworkImage;\n\n/// Default is 600px / 默认600像素宽\n@property (nonatomic, assign) CGFloat photoPreviewMaxWidth;\n/// The pixel width of output image, Default is 828px / 导出图片的宽度，默认828像素宽\n@property (nonatomic, assign) CGFloat photoWidth;\n\n/// Default is 4, Use in photos collectionView in TZPhotoPickerController\n/// 默认4列, TZPhotoPickerController中的照片collectionView\n@property (nonatomic, assign) NSInteger columnNumber;\n\n/// Sort photos ascending by modificationDate，Default is YES\n/// 对照片排序，按修改时间升序，默认是YES。如果设置为NO,最新的照片会显示在最前面，内部的拍照按钮会排在第一个\n@property (nonatomic, assign) BOOL sortAscendingByModificationDate;\n\n/// Minimum selectable photo width, Default is 0\n/// 最小可选中的图片宽度，默认是0，小于这个宽度的图片不可选中\n@property (nonatomic, assign) NSInteger minPhotoWidthSelectable;\n@property (nonatomic, assign) NSInteger minPhotoHeightSelectable;\n@property (nonatomic, assign) BOOL hideWhenCanNotSelect;\n\n/// Return YES if Authorized 返回YES如果得到了授权\n- (BOOL)authorizationStatusAuthorized;\n- (void)requestAuthorizationWithCompletion:(void (^)(void))completion;\n- (BOOL)isPHAuthorizationStatusLimited;\n\n/// Get Album 获得相册/相册数组\n- (void)getCameraRollAlbumWithFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion;\n- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion __attribute__((deprecated(\"Use -getCameraRollAlbumWithFetchAssets:completion:. You can config allowPickingImage、allowPickingVideo by TZImagePickerConfig\")));\n- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *models))completion __attribute__((deprecated(\"Use -getAllAlbumsWithFetchAssets:completion:. You can config allowPickingImage、allowPickingVideo by TZImagePickerConfig\")));\n- (void)getAllAlbumsWithFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *models))completion;\n\n/// Get Assets 获得Asset数组\n- (void)getAssetsFromFetchResult:(PHFetchResult *)result completion:(void (^)(NSArray<TZAssetModel *> *models))completion;\n- (void)getAssetsFromFetchResult:(PHFetchResult *)result allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<TZAssetModel *> *models))completion __attribute__((deprecated(\"Use -getAssetsFromFetchResult:completion:. You can config allowPickingImage、allowPickingVideo by TZImagePickerConfig\")));\n- (void)getAssetFromFetchResult:(PHFetchResult *)result atIndex:(NSInteger)index allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAssetModel *model))completion __attribute__((deprecated(\"Use -getAssetFromFetchResult:atIndex:completion:. You can config allowPickingImage、allowPickingVideo by TZImagePickerConfig\")));\n- (void)getAssetFromFetchResult:(PHFetchResult *)result atIndex:(NSInteger)index completion:(void (^)(TZAssetModel *model))completion;\n\n/// Get photo 获得照片\n- (PHImageRequestID)getPostImageWithAlbumModel:(TZAlbumModel *)model completion:(void (^)(UIImage *postImage))completion;\n\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion;\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion;\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler networkAccessAllowed:(BOOL)networkAccessAllowed;\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler networkAccessAllowed:(BOOL)networkAccessAllowed;\n- (PHImageRequestID)requestImageDataForAsset:(PHAsset *)asset completion:(void (^)(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler;\n\n/// Get full Image 获取原图\n/// 如下两个方法completion一般会调多次，一般会先返回缩略图，再返回原图(详见方法内部使用的系统API的说明)，如果info[PHImageResultIsDegradedKey] 为 YES，则表明当前返回的是缩略图，否则是原图。\n- (PHImageRequestID)getOriginalPhotoWithAsset:(PHAsset *)asset completion:(void (^)(UIImage *photo,NSDictionary *info))completion;\n- (PHImageRequestID)getOriginalPhotoWithAsset:(PHAsset *)asset newCompletion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion;\n- (PHImageRequestID)getOriginalPhotoWithAsset:(PHAsset *)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler newCompletion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion;\n// 该方法中，completion只会走一次\n- (PHImageRequestID)getOriginalPhotoDataWithAsset:(PHAsset *)asset completion:(void (^)(NSData *data,NSDictionary *info,BOOL isDegraded))completion;\n- (PHImageRequestID)getOriginalPhotoDataWithAsset:(PHAsset *)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(NSData *data,NSDictionary *info,BOOL isDegraded))completion;\n\n/// Get Image For VideoURL\n- (UIImage *)getImageWithVideoURL:(NSURL *)videoURL;\n\n/// Save photo 保存照片\n- (void)savePhotoWithImage:(UIImage *)image completion:(void (^)(PHAsset *asset, NSError *error))completion;\n- (void)savePhotoWithImage:(UIImage *)image location:(CLLocation *)location completion:(void (^)(PHAsset *asset, NSError *error))completion;\n- (void)savePhotoWithImage:(UIImage *)image meta:(NSDictionary *)meta location:(CLLocation *)location completion:(void (^)(PHAsset *asset, NSError *error))completion;\n\n/// Save video 保存视频\n- (void)saveVideoWithUrl:(NSURL *)url completion:(void (^)(PHAsset *asset, NSError *error))completion;\n- (void)saveVideoWithUrl:(NSURL *)url location:(CLLocation *)location completion:(void (^)(PHAsset *asset, NSError *error))completion;\n\n/// Get video 获得视频\n- (void)getVideoWithAsset:(PHAsset *)asset completion:(void (^)(AVPlayerItem * playerItem, NSDictionary * info))completion;\n- (void)getVideoWithAsset:(PHAsset *)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(AVPlayerItem *, NSDictionary *))completion;\n\n/// Export video 导出视频 presetName: 预设名字，默认值是AVAssetExportPreset640x480\n- (void)getVideoOutputPathWithAsset:(PHAsset *)asset success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure;\n- (void)getVideoOutputPathWithAsset:(PHAsset *)asset presetName:(NSString *)presetName success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure;\n- (void)getVideoOutputPathWithAsset:(PHAsset *)asset presetName:(NSString *)presetName timeRange:(CMTimeRange)timeRange success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure;\n/// 新的导出视频API，解决iOS14 iCloud视频导出失败的问题，未大量测试，请大家多多测试，有问题群里反馈\n- (void)requestVideoOutputPathWithAsset:(PHAsset *)asset presetName:(NSString *)presetName success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure;\n/// 得到视频原始文件地址\n- (void)requestVideoURLWithAsset:(PHAsset *)asset success:(void (^)(NSURL *videoURL))success failure:(void (^)(NSDictionary* info))failure;\n\n/// Get photo bytes 获得一组照片的大小\n- (void)getPhotosBytesWithArray:(NSArray *)photos completion:(void (^)(NSString *totalBytes))completion;\n\n- (BOOL)isCameraRollAlbum:(PHAssetCollection *)metadata;\n\n/// 检查照片大小是否满足最小要求\n- (BOOL)isPhotoSelectableWithAsset:(PHAsset *)asset;\n\n/// 检查照片能否被选中\n- (BOOL)isAssetCannotBeSelected:(PHAsset *)asset;\n\n/// 修正图片转向\n- (UIImage *)fixOrientation:(UIImage *)aImage;\n\n/// 获取asset的资源类型\n- (TZAssetModelMediaType)getAssetType:(PHAsset *)asset;\n/// 缩放图片至新尺寸\n- (UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)size;\n\n/// 判断asset是否是视频\n- (BOOL)isVideo:(PHAsset *)asset;\n\n/// for TZImagePreviewController\n- (NSString *)getNewTimeFromDurationSecond:(NSInteger)duration;\n\n- (TZAssetModel *)createModelWithAsset:(PHAsset *)asset;\n\n@end\n\n//@interface TZSortDescriptor : NSSortDescriptor\n//\n//@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImageManager.m",
    "content": "//\n//  TZImageManager.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 16/1/4.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import \"TZImageManager.h\"\n#import \"TZAssetModel.h\"\n#import \"TZImagePickerController.h\"\n#import <MobileCoreServices/MobileCoreServices.h>\n\n@interface TZImageManager ()\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n@end\n\n@implementation TZImageManager\n\nCGSize AssetGridThumbnailSize;\nCGFloat TZScreenWidth;\nCGFloat TZScreenScale;\n\nstatic TZImageManager *manager;\nstatic dispatch_once_t onceToken;\n\n+ (instancetype)manager {\n    dispatch_once(&onceToken, ^{\n        manager = [[self alloc] init];\n        // manager.cachingImageManager = [[PHCachingImageManager alloc] init];\n        // manager.cachingImageManager.allowsCachingHighQualityImages = YES;\n        \n        [manager configTZScreenWidth];\n    });\n    return manager;\n}\n\n+ (void)deallocManager {\n    onceToken = 0;\n    manager = nil;\n}\n\n- (void)setPhotoWidth:(CGFloat)photoWidth {\n    _photoWidth = photoWidth;\n    TZScreenWidth = photoWidth / 2;\n}\n\n- (void)setColumnNumber:(NSInteger)columnNumber {\n    [self configTZScreenWidth];\n\n    _columnNumber = columnNumber;\n    CGFloat margin = 4;\n    CGFloat itemWH = (TZScreenWidth - 2 * margin - 4) / columnNumber - margin;\n    AssetGridThumbnailSize = CGSizeMake(itemWH * TZScreenScale, itemWH * TZScreenScale);\n}\n\n- (void)configTZScreenWidth {\n    TZScreenWidth = [UIScreen mainScreen].bounds.size.width;\n    // 测试发现，如果scale在plus真机上取到3.0，内存会增大特别多。故这里写死成2.0\n    TZScreenScale = 2.0;\n    if (TZScreenWidth > 700) {\n        TZScreenScale = 1.5;\n    }\n}\n\n- (BOOL)isPHAuthorizationStatusLimited {\n    if (@available(iOS 14,*)) {\n        NSInteger status = [PHPhotoLibrary authorizationStatusForAccessLevel:PHAccessLevelReadWrite];\n        if (status == PHAuthorizationStatusLimited) {\n            return YES;\n        }\n    }\n    return NO;\n}\n\n/// Return YES if Authorized 返回YES如果得到了授权\n- (BOOL)authorizationStatusAuthorized {\n    if (self.isPreviewNetworkImage) {\n        return YES;\n    }\n    NSInteger status = [PHPhotoLibrary authorizationStatus];\n    if (status == 0) {\n        /**\n         * 当某些情况下AuthorizationStatus == AuthorizationStatusNotDetermined时，无法弹出系统首次使用的授权alertView，系统应用设置里亦没有相册的设置，此时将无法使用，故作以下操作，弹出系统首次使用的授权alertView\n         */\n        [self requestAuthorizationWithCompletion:nil];\n    }\n    \n    return status == 3;\n}\n\n- (void)requestAuthorizationWithCompletion:(void (^)(void))completion {\n    void (^callCompletionBlock)(void) = ^(){\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (completion) {\n                completion();\n            }\n        });\n    };\n    \n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {\n            callCompletionBlock();\n        }];\n    });\n}\n\n#pragma mark - Get Album\n\n- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion {\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    config.allowPickingVideo = allowPickingVideo;\n    config.allowPickingImage = allowPickingImage;\n    [self getCameraRollAlbumWithFetchAssets:needFetchAssets completion:completion];\n}\n\n/// Get Album 获得相册/相册数组\n- (void)getCameraRollAlbumWithFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion {\n    __block TZAlbumModel *model;\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    PHFetchOptions *option = [[PHFetchOptions alloc] init];\n    if (!config.allowPickingVideo) option.predicate = [NSPredicate predicateWithFormat:@\"mediaType == %ld\", PHAssetMediaTypeImage];\n    if (!config.allowPickingImage) option.predicate = [NSPredicate predicateWithFormat:@\"mediaType == %ld\",\n                                                PHAssetMediaTypeVideo];\n    // option.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@\"modificationDate\" ascending:self.sortAscendingByModificationDate]];\n    if (!self.sortAscendingByModificationDate) {\n        option.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@\"creationDate\" ascending:self.sortAscendingByModificationDate]];\n    }\n    PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];\n    for (PHAssetCollection *collection in smartAlbums) {\n        // 有可能是PHCollectionList类的的对象，过滤掉\n        if (![collection isKindOfClass:[PHAssetCollection class]]) continue;\n        // 过滤空相册\n        if (collection.estimatedAssetCount <= 0) continue;\n        if ([self isCameraRollAlbum:collection]) {\n            PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];\n            model = [self modelWithResult:fetchResult collection:collection isCameraRoll:YES needFetchAssets:needFetchAssets options:option];\n            if (completion) completion(model);\n            break;\n        }\n    }\n}\n\n- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *))completion {\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    config.allowPickingVideo = allowPickingVideo;\n    config.allowPickingImage = allowPickingImage;\n    [self getAllAlbumsWithFetchAssets:needFetchAssets completion:completion];\n}\n\n- (void)getAllAlbumsWithFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *))completion {\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    NSMutableArray *albumArr = [NSMutableArray array];\n    PHFetchOptions *option = [[PHFetchOptions alloc] init];\n    if (!config.allowPickingVideo) option.predicate = [NSPredicate predicateWithFormat:@\"mediaType == %ld\", PHAssetMediaTypeImage];\n    if (!config.allowPickingImage) option.predicate = [NSPredicate predicateWithFormat:@\"mediaType == %ld\",\n                                                PHAssetMediaTypeVideo];\n    // option.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@\"modificationDate\" ascending:self.sortAscendingByModificationDate]];\n    if (!self.sortAscendingByModificationDate) {\n        option.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@\"creationDate\" ascending:self.sortAscendingByModificationDate]];\n    }\n    // 我的照片流 1.6.10重新加入..\n    PHFetchResult *myPhotoStreamAlbum = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumMyPhotoStream options:nil];\n    PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];\n    PHFetchResult *topLevelUserCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil];\n    PHFetchResult *syncedAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumSyncedAlbum options:nil];\n    PHFetchResult *sharedAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumCloudShared options:nil];\n    NSArray *allAlbums = @[myPhotoStreamAlbum,smartAlbums,topLevelUserCollections,syncedAlbums,sharedAlbums];\n    for (PHFetchResult *fetchResult in allAlbums) {\n        for (PHAssetCollection *collection in fetchResult) {\n            // 有可能是PHCollectionList类的的对象，过滤掉\n            if (![collection isKindOfClass:[PHAssetCollection class]]) continue;\n            // 过滤空相册\n            if (collection.estimatedAssetCount <= 0 && ![self isCameraRollAlbum:collection]) continue;\n            PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];\n            if (fetchResult.count < 1 && ![self isCameraRollAlbum:collection]) continue;\n            \n            if ([self.pickerDelegate respondsToSelector:@selector(isAlbumCanSelect:result:)]) {\n                if (![self.pickerDelegate isAlbumCanSelect:collection.localizedTitle result:fetchResult]) {\n                    continue;\n                }\n            }\n            \n            if (collection.assetCollectionSubtype == PHAssetCollectionSubtypeSmartAlbumAllHidden) continue;\n            if (collection.assetCollectionSubtype == 1000000201) continue; //『最近删除』相册\n            if ([self isCameraRollAlbum:collection]) {\n                [albumArr insertObject:[self modelWithResult:fetchResult collection:collection isCameraRoll:YES needFetchAssets:needFetchAssets options:option] atIndex:0];\n            } else {\n                [albumArr addObject:[self modelWithResult:fetchResult collection:collection isCameraRoll:NO needFetchAssets:needFetchAssets options:option]];\n            }\n        }\n    }\n    if (completion) {\n        completion(albumArr);\n    }\n}\n\n#pragma mark - Get Assets\n\n/// Get Assets 获得照片数组\n- (void)getAssetsFromFetchResult:(PHFetchResult *)result allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<TZAssetModel *> *))completion {\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    config.allowPickingVideo = allowPickingVideo;\n    config.allowPickingImage = allowPickingImage;\n    return [self getAssetsFromFetchResult:result completion:completion];\n}\n\n- (void)getAssetsFromFetchResult:(PHFetchResult *)result completion:(void (^)(NSArray<TZAssetModel *> *))completion {\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    NSMutableArray *photoArr = [NSMutableArray array];\n    [result enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL * _Nonnull stop) {\n        TZAssetModel *model = [self assetModelWithAsset:asset allowPickingVideo:config.allowPickingVideo allowPickingImage:config.allowPickingImage];\n        if (model) {\n            [photoArr addObject:model];\n        }\n    }];\n    if (completion) completion(photoArr);\n}\n\n///  Get asset at index 获得下标为index的单个照片\n///  if index beyond bounds, return nil in callback 如果索引越界, 在回调中返回 nil\n- (void)getAssetFromFetchResult:(PHFetchResult *)result atIndex:(NSInteger)index allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAssetModel *))completion {\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    config.allowPickingVideo = allowPickingVideo;\n    config.allowPickingImage = allowPickingImage;\n    [self getAssetFromFetchResult:result atIndex:index allowPickingVideo:config.allowPickingVideo allowPickingImage:config.allowPickingImage completion:completion];\n}\n\n- (void)getAssetFromFetchResult:(PHFetchResult *)result atIndex:(NSInteger)index completion:(void (^)(TZAssetModel *))completion {\n    PHAsset *asset;\n    @try {\n        asset = result[index];\n    }\n    @catch (NSException* e) {\n        if (completion) completion(nil);\n        return;\n    }\n    TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];\n    TZAssetModel *model = [self assetModelWithAsset:asset allowPickingVideo:config.allowPickingVideo allowPickingImage:config.allowPickingImage];\n    if (completion) completion(model);\n}\n\n- (TZAssetModel *)assetModelWithAsset:(PHAsset *)asset allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage {\n    BOOL canSelect = YES;\n    if ([self.pickerDelegate respondsToSelector:@selector(isAssetCanSelect:)]) {\n        canSelect = [self.pickerDelegate isAssetCanSelect:asset];\n    }\n    if ([self.pickerDelegate respondsToSelector:@selector(isAssetCanBeDisplayed:)]){\n        canSelect = [self.pickerDelegate isAssetCanBeDisplayed:asset];\n    }\n    \n    if (!canSelect) return nil;\n    \n    TZAssetModel *model;\n    TZAssetModelMediaType type = [self getAssetType:asset];\n    if (!allowPickingVideo && type == TZAssetModelMediaTypeVideo) return nil;\n    if (!allowPickingImage && type == TZAssetModelMediaTypePhoto) return nil;\n    if (!allowPickingImage && type == TZAssetModelMediaTypePhotoGif) return nil;\n    \n    PHAsset *phAsset = (PHAsset *)asset;\n    if (self.hideWhenCanNotSelect) {\n        // 过滤掉尺寸不满足要求的图片\n        if (![self isPhotoSelectableWithAsset:phAsset]) {\n            return nil;\n        }\n    }\n    NSString *timeLength = type == TZAssetModelMediaTypeVideo ? [NSString stringWithFormat:@\"%0.0f\",phAsset.duration] : @\"\";\n    timeLength = [self getNewTimeFromDurationSecond:timeLength.integerValue];\n    model = [TZAssetModel modelWithAsset:asset type:type timeLength:timeLength];\n    return model;\n}\n\n- (TZAssetModelMediaType)getAssetType:(PHAsset *)asset {\n    TZAssetModelMediaType type = TZAssetModelMediaTypePhoto;\n    PHAsset *phAsset = (PHAsset *)asset;\n    if (phAsset.mediaType == PHAssetMediaTypeVideo)      type = TZAssetModelMediaTypeVideo;\n    else if (phAsset.mediaType == PHAssetMediaTypeAudio) type = TZAssetModelMediaTypeAudio;\n    else if (phAsset.mediaType == PHAssetMediaTypeImage) {\n        if (@available(iOS 9.1, *)) {\n            // if (asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive) type = TZAssetModelMediaTypeLivePhoto;\n        }\n        // Gif\n        if ([[phAsset valueForKey:@\"filename\"] hasSuffix:@\"GIF\"]) {\n            type = TZAssetModelMediaTypePhotoGif;\n        }\n    }\n    return type;\n}\n\n- (NSString *)getNewTimeFromDurationSecond:(NSInteger)duration {\n    NSString *newTime;\n    if (duration < 10) {\n        newTime = [NSString stringWithFormat:@\"0:0%zd\",duration];\n    } else if (duration < 60) {\n        newTime = [NSString stringWithFormat:@\"0:%zd\",duration];\n    } else {\n        NSInteger min = duration / 60;\n        NSInteger sec = duration - (min * 60);\n        if (sec < 10) {\n            newTime = [NSString stringWithFormat:@\"%zd:0%zd\",min,sec];\n        } else {\n            newTime = [NSString stringWithFormat:@\"%zd:%zd\",min,sec];\n        }\n    }\n    return newTime;\n}\n\n/// Get photo bytes 获得一组照片的大小\n- (void)getPhotosBytesWithArray:(NSArray *)photos completion:(void (^)(NSString *totalBytes))completion {\n    if (!photos || !photos.count) {\n        if (completion) completion(@\"0B\");\n        return;\n    }\n    __block NSInteger dataLength = 0;\n    __block NSInteger assetCount = 0;\n    for (NSInteger i = 0; i < photos.count; i++) {\n        TZAssetModel *model = photos[i];\n        PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];\n        options.resizeMode = PHImageRequestOptionsResizeModeFast;\n        options.networkAccessAllowed = YES;\n        if (model.type == TZAssetModelMediaTypePhotoGif) {\n            options.version = PHImageRequestOptionsVersionOriginal;\n        }\n        [[PHImageManager defaultManager] requestImageDataForAsset:model.asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {\n            if (model.type != TZAssetModelMediaTypeVideo) dataLength += imageData.length;\n            assetCount ++;\n            if (assetCount >= photos.count) {\n                NSString *bytes = [self getBytesFromDataLength:dataLength];\n                if (completion) completion(bytes);\n            }\n        }];\n    }\n}\n\n- (NSString *)getBytesFromDataLength:(NSInteger)dataLength {\n    NSString *bytes;\n    if (dataLength >= 0.1 * (1024 * 1024)) {\n        bytes = [NSString stringWithFormat:@\"%0.1fM\",dataLength/1024/1024.0];\n    } else if (dataLength >= 1024) {\n        bytes = [NSString stringWithFormat:@\"%0.0fK\",dataLength/1024.0];\n    } else {\n        bytes = [NSString stringWithFormat:@\"%zdB\",dataLength];\n    }\n    return bytes;\n}\n\n#pragma mark - Get Photo\n\n/// Get photo 获得照片本身\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset completion:(void (^)(UIImage *, NSDictionary *, BOOL isDegraded))completion {\n    return [self getPhotoWithAsset:asset completion:completion progressHandler:nil networkAccessAllowed:YES];\n}\n\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion {\n    return [self getPhotoWithAsset:asset photoWidth:photoWidth completion:completion progressHandler:nil networkAccessAllowed:YES];\n}\n\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler networkAccessAllowed:(BOOL)networkAccessAllowed {\n    CGFloat fullScreenWidth = TZScreenWidth;\n    if (_photoPreviewMaxWidth > 0 && fullScreenWidth > _photoPreviewMaxWidth) {\n        fullScreenWidth = _photoPreviewMaxWidth;\n    }\n    return [self getPhotoWithAsset:asset photoWidth:fullScreenWidth completion:completion progressHandler:progressHandler networkAccessAllowed:networkAccessAllowed];\n}\n\n- (PHImageRequestID)requestImageDataForAsset:(PHAsset *)asset completion:(void (^)(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler {\n    PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];\n    options.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (progressHandler) {\n                progressHandler(progress, error, stop, info);\n            }\n        });\n    };\n    options.networkAccessAllowed = YES;\n    options.resizeMode = PHImageRequestOptionsResizeModeFast;\n    int32_t imageRequestID = [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {\n        if (completion) completion(imageData,dataUTI,orientation,info);\n    }];\n    return imageRequestID;\n}\n\n- (PHImageRequestID)getPhotoWithAsset:(PHAsset *)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler networkAccessAllowed:(BOOL)networkAccessAllowed {\n    CGSize imageSize;\n    if (photoWidth < TZScreenWidth && photoWidth < _photoPreviewMaxWidth) {\n        imageSize = AssetGridThumbnailSize;\n    } else {\n        PHAsset *phAsset = (PHAsset *)asset;\n        CGFloat aspectRatio = phAsset.pixelWidth / (CGFloat)phAsset.pixelHeight;\n        CGFloat pixelWidth = photoWidth * TZScreenScale;\n        // 超宽图片\n        if (aspectRatio > 1.8) {\n            pixelWidth = pixelWidth * aspectRatio;\n        }\n        // 超高图片\n        if (aspectRatio < 0.2) {\n            pixelWidth = pixelWidth * 0.5;\n        }\n        CGFloat pixelHeight = pixelWidth / aspectRatio;\n        imageSize = CGSizeMake(pixelWidth, pixelHeight);\n    }\n    \n    // 修复获取图片时出现的瞬间内存过高问题\n    // 下面两行代码，来自hsjcom，他的github是：https://github.com/hsjcom 表示感谢\n    PHImageRequestOptions *option = [[PHImageRequestOptions alloc] init];\n    option.resizeMode = PHImageRequestOptionsResizeModeFast;\n    int32_t imageRequestID = [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:imageSize contentMode:PHImageContentModeAspectFill options:option resultHandler:^(UIImage *result, NSDictionary *info) {\n        BOOL cancelled = [[info objectForKey:PHImageCancelledKey] boolValue];\n        if (!cancelled && result) {\n            result = [self fixOrientation:result];\n            if (completion) completion(result,info,[[info objectForKey:PHImageResultIsDegradedKey] boolValue]);\n        }\n        // Download image from iCloud / 从iCloud下载图片\n        if ([info objectForKey:PHImageResultIsInCloudKey] && !result && networkAccessAllowed) {\n            PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];\n            options.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    if (progressHandler) {\n                        progressHandler(progress, error, stop, info);\n                    }\n                });\n            };\n            options.networkAccessAllowed = YES;\n            options.resizeMode = PHImageRequestOptionsResizeModeFast;\n            [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {\n                UIImage *resultImage = [UIImage imageWithData:imageData];\n                if (![TZImagePickerConfig sharedInstance].notScaleImage) {\n                    resultImage = [self scaleImage:resultImage toSize:imageSize];\n                }\n                if (!resultImage && result) {\n                    resultImage = result;\n                }\n                resultImage = [self fixOrientation:resultImage];\n                if (completion) completion(resultImage,info,NO);\n            }];\n        }\n    }];\n    return imageRequestID;\n}\n\n/// Get postImage / 获取封面图\n- (PHImageRequestID)getPostImageWithAlbumModel:(TZAlbumModel *)model completion:(void (^)(UIImage *))completion {\n    id asset = [model.result lastObject];\n    if (!self.sortAscendingByModificationDate) {\n        asset = [model.result firstObject];\n    }\n    if (!asset) {\n        return -1;\n    }\n    return [[TZImageManager manager] getPhotoWithAsset:asset photoWidth:80 completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        if (completion) completion(photo);\n    }];\n}\n\n/// Get Original Photo / 获取原图\n- (PHImageRequestID)getOriginalPhotoWithAsset:(PHAsset *)asset completion:(void (^)(UIImage *photo,NSDictionary *info))completion {\n   return [self getOriginalPhotoWithAsset:asset newCompletion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        if (completion) {\n            completion(photo,info);\n        }\n    }];\n}\n\n- (PHImageRequestID)getOriginalPhotoWithAsset:(PHAsset *)asset newCompletion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion {\n    return [self getOriginalPhotoWithAsset:asset progressHandler:nil newCompletion:completion];\n}\n\n- (PHImageRequestID)getOriginalPhotoWithAsset:(PHAsset *)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler newCompletion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion {\n    PHImageRequestOptions *option = [[PHImageRequestOptions alloc]init];\n    option.networkAccessAllowed = YES;\n    if (progressHandler) {\n        [option setProgressHandler:progressHandler];\n    }\n    option.resizeMode = PHImageRequestOptionsResizeModeFast;\n    return [[PHImageManager defaultManager] requestImageDataForAsset:asset options:option resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {\n        BOOL cancelled = [[info objectForKey:PHImageCancelledKey] boolValue];\n        if (!cancelled && imageData) {\n            UIImage *result = [self fixOrientation:[UIImage imageWithData:imageData]];\n            BOOL isDegraded = [[info objectForKey:PHImageResultIsDegradedKey] boolValue];\n            if (completion) completion(result,info,isDegraded);\n        }\n    }];\n}\n\n- (PHImageRequestID)getOriginalPhotoDataWithAsset:(PHAsset *)asset completion:(void (^)(NSData *data,NSDictionary *info,BOOL isDegraded))completion {\n    return [self getOriginalPhotoDataWithAsset:asset progressHandler:nil completion:completion];\n}\n\n- (PHImageRequestID)getOriginalPhotoDataWithAsset:(PHAsset *)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(NSData *data,NSDictionary *info,BOOL isDegraded))completion {\n    PHImageRequestOptions *option = [[PHImageRequestOptions alloc] init];\n    option.networkAccessAllowed = YES;\n    if ([[asset valueForKey:@\"filename\"] hasSuffix:@\"GIF\"]) {\n        // if version isn't PHImageRequestOptionsVersionOriginal, the gif may cann't play\n        option.version = PHImageRequestOptionsVersionOriginal;\n    }\n    [option setProgressHandler:progressHandler];\n    option.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;\n    return [[PHImageManager defaultManager] requestImageDataForAsset:asset options:option resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {\n        BOOL cancelled = [[info objectForKey:PHImageCancelledKey] boolValue];\n        if (!cancelled && imageData) {\n            if (completion) completion(imageData,info,NO);\n        }\n    }];\n}\n\n- (UIImage *)getImageWithVideoURL:(NSURL *)videoURL {\n    AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:videoURL options:nil];\n    if (!asset) {\n        return nil;\n    }\n    AVAssetImageGenerator *generator =[[AVAssetImageGenerator alloc] initWithAsset:asset];\n    generator.appliesPreferredTrackTransform = YES;\n    generator.apertureMode = AVAssetImageGeneratorApertureModeEncodedPixels;\n    \n    CFTimeInterval time = 0.1;\n    CGImageRef imageRef = [generator copyCGImageAtTime:CMTimeMake(time, 60) actualTime:NULL error:nil];\n    UIImage *image = [[UIImage alloc] initWithCGImage:imageRef];\n    CGImageRelease(imageRef);\n    return image;\n}\n\n#pragma mark - Save photo\n\n- (void)savePhotoWithImage:(UIImage *)image completion:(void (^)(PHAsset *asset, NSError *error))completion {\n    [self savePhotoWithImage:image location:nil completion:completion];\n}\n\n- (void)savePhotoWithImage:(UIImage *)image location:(CLLocation *)location completion:(void (^)(PHAsset *asset, NSError *error))completion {\n    __block NSString *localIdentifier = nil;\n    [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{\n        PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromImage:image];\n        localIdentifier = request.placeholderForCreatedAsset.localIdentifier;\n        if (location) {\n            request.location = location;\n        }\n        request.creationDate = [NSDate date];\n    } completionHandler:^(BOOL success, NSError *error) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (success && completion && localIdentifier) {\n                [self fetchAssetByIocalIdentifier:localIdentifier retryCount:10 completion:completion];\n            } else {\n                if (error) {\n                    NSLog(@\"保存照片出错:%@\",error.localizedDescription);\n                }\n                if (completion) {\n                    completion(nil, error);\n                }\n            }\n        });\n    }];\n}\n\n- (void)savePhotoWithImage:(UIImage *)image meta:(NSDictionary *)meta location:(CLLocation *)location completion:(void (^)(PHAsset *asset, NSError *error))completion {\n    NSData *imageData = UIImageJPEGRepresentation(image, 1.0f);\n    CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)imageData, NULL);\n    NSDateFormatter *formater = [[NSDateFormatter alloc] init];\n    [formater setDateFormat:@\"yyyy-MM-dd-HH:mm:ss-SSS\"];\n    NSString *path = [NSTemporaryDirectory() stringByAppendingFormat:@\"image-%@.jpg\", [formater stringFromDate:[NSDate date]]];\n    NSURL *tmpURL = [NSURL fileURLWithPath:path];\n    CGImageDestinationRef destination = CGImageDestinationCreateWithURL((__bridge CFURLRef)tmpURL, kUTTypeJPEG, 1, NULL);\n    CGImageDestinationAddImageFromSource(destination, source, 0, (__bridge CFDictionaryRef)meta);\n    CGImageDestinationFinalize(destination);\n    CFRelease(source);\n    CFRelease(destination);\n    \n    __block NSString *localIdentifier = nil;\n    [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{\n        PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:tmpURL];\n        localIdentifier = request.placeholderForCreatedAsset.localIdentifier;\n        if (location) {\n            request.location = location;\n        }\n        request.creationDate = [NSDate date];\n    } completionHandler:^(BOOL success, NSError *error) {\n        [[NSFileManager defaultManager] removeItemAtPath:path error:nil];\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (success && completion && localIdentifier) {\n                [self fetchAssetByIocalIdentifier:localIdentifier retryCount:10 completion:completion];\n            } else {\n                if (error) {\n                    NSLog(@\"保存照片出错:%@\",error.localizedDescription);\n                }\n                if (completion) {\n                    completion(nil, error);\n                }\n            }\n        });\n    }];\n}\n\n- (void)fetchAssetByIocalIdentifier:(NSString *)localIdentifier retryCount:(NSInteger)retryCount completion:(void (^)(PHAsset *asset, NSError *error))completion {\n    PHAsset *asset = [[PHAsset fetchAssetsWithLocalIdentifiers:@[localIdentifier] options:nil] firstObject];\n    if (asset || retryCount <= 0) {\n        if (completion) {\n            completion(asset, nil);\n        }\n        return;\n    }\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        [self fetchAssetByIocalIdentifier:localIdentifier retryCount:retryCount - 1 completion:completion];\n    });\n}\n\n#pragma mark - Save video\n\n- (void)saveVideoWithUrl:(NSURL *)url completion:(void (^)(PHAsset *asset, NSError *error))completion {\n    [self saveVideoWithUrl:url location:nil completion:completion];\n}\n\n- (void)saveVideoWithUrl:(NSURL *)url location:(CLLocation *)location completion:(void (^)(PHAsset *asset, NSError *error))completion {\n    __block NSString *localIdentifier = nil;\n    [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{\n        PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:url];\n        localIdentifier = request.placeholderForCreatedAsset.localIdentifier;\n        if (location) {\n            request.location = location;\n        }\n        request.creationDate = [NSDate date];\n    } completionHandler:^(BOOL success, NSError *error) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (success && completion && localIdentifier) {\n                [self fetchAssetByIocalIdentifier:localIdentifier retryCount:10 completion:completion];\n            } else {\n                if (error) {\n                    NSLog(@\"保存视频出错:%@\",error.localizedDescription);\n                }\n                if (completion) {\n                    completion(nil, error);\n                }\n            }\n        });\n    }];\n}\n\n#pragma mark - Get Video\n\n/// Get Video / 获取视频\n- (void)getVideoWithAsset:(PHAsset *)asset completion:(void (^)(AVPlayerItem *, NSDictionary *))completion {\n    [self getVideoWithAsset:asset progressHandler:nil completion:completion];\n}\n\n- (void)getVideoWithAsset:(PHAsset *)asset progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler completion:(void (^)(AVPlayerItem *, NSDictionary *))completion {\n    PHVideoRequestOptions *option = [[PHVideoRequestOptions alloc] init];\n    option.networkAccessAllowed = YES;\n    option.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (progressHandler) {\n                progressHandler(progress, error, stop, info);\n            }\n        });\n    };\n    [[PHImageManager defaultManager] requestPlayerItemForVideo:asset options:option resultHandler:^(AVPlayerItem *playerItem, NSDictionary *info) {\n        if (completion) completion(playerItem,info);\n    }];\n}\n\n#pragma mark - Export video\n\n/// Export Video / 导出视频\n- (void)getVideoOutputPathWithAsset:(PHAsset *)asset success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure {\n    [self getVideoOutputPathWithAsset:asset presetName:AVAssetExportPresetMediumQuality success:success failure:failure];\n}\n\n- (void)getVideoOutputPathWithAsset:(PHAsset *)asset presetName:(NSString *)presetName success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure {\n    [self getVideoOutputPathWithAsset:asset presetName:presetName timeRange:kCMTimeRangeZero success:success failure:failure];\n}\n\n- (void)startExportVideoWithVideoAsset:(AVURLAsset *)videoAsset presetName:(NSString *)presetName success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure {\n    [self startExportVideoWithVideoAsset:videoAsset timeRange:kCMTimeRangeZero presetName:presetName success:success failure:failure];\n}\n\n- (void)getVideoOutputPathWithAsset:(PHAsset *)asset presetName:(NSString *)presetName timeRange:(CMTimeRange)timeRange success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure {\n    if (@available(iOS 14.0, *)) {\n        [self requestVideoOutputPathWithAsset:asset presetName:presetName timeRange:timeRange success:success failure:failure];\n        return;\n    }\n    [[PHImageManager defaultManager] requestAVAssetForVideo:asset options:[self getVideoRequestOptions] resultHandler:^(AVAsset* avasset, AVAudioMix* audioMix, NSDictionary* info){\n        // NSLog(@\"Info:\\n%@\",info);\n        AVURLAsset *videoAsset = (AVURLAsset*)avasset;\n        // NSLog(@\"AVAsset URL: %@\",myAsset.URL);\n        [self startExportVideoWithVideoAsset:videoAsset timeRange:timeRange presetName:presetName success:success failure:failure];\n    }];\n}\n\n- (void)startExportVideoWithVideoAsset:(AVURLAsset *)videoAsset timeRange:(CMTimeRange)timeRange presetName:(NSString *)presetName success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure  {\n    if (!presetName) {\n        presetName = AVAssetExportPresetMediumQuality;\n    }\n    // Find compatible presets by video asset.\n    NSArray *presets = [AVAssetExportSession exportPresetsCompatibleWithAsset:videoAsset];\n    // Begin to compress video\n    // Now we just compress to low resolution if it supports\n    // If you need to upload to the server, but server does't support to upload by streaming,\n    // You can compress the resolution to lower. Or you can support more higher resolution.\n    if ([presets containsObject:presetName]) {\n        AVAssetExportSession *session = [[AVAssetExportSession alloc] initWithAsset:videoAsset presetName:presetName];\n        NSString *outputPath = [self getVideoOutputPath];\n\n        // Optimize for network use.\n        session.shouldOptimizeForNetworkUse = true;\n        if (!CMTimeRangeEqual(timeRange, kCMTimeRangeZero)) {\n            session.timeRange = timeRange;\n        }\n        \n        NSArray *supportedTypeArray = session.supportedFileTypes;\n        if ([supportedTypeArray containsObject:AVFileTypeMPEG4]) {\n            session.outputFileType = AVFileTypeMPEG4;\n        } else if (supportedTypeArray.count == 0) {\n            if (failure) {\n                failure(@\"该视频类型暂不支持导出\", nil);\n            }\n            NSLog(@\"No supported file types 视频类型暂不支持导出\");\n            return;\n        } else {\n            session.outputFileType = [supportedTypeArray objectAtIndex:0];\n            if (videoAsset.URL && videoAsset.URL.lastPathComponent) {\n                outputPath = [outputPath stringByReplacingOccurrencesOfString:@\".mp4\" withString:[NSString stringWithFormat:@\"-%@\", videoAsset.URL.lastPathComponent]];\n            }\n        }\n        // NSLog(@\"video outputPath = %@\",outputPath);\n        session.outputURL = [NSURL fileURLWithPath:outputPath];\n        \n        if (![[NSFileManager defaultManager] fileExistsAtPath:[NSHomeDirectory() stringByAppendingFormat:@\"/tmp\"]]) {\n            [[NSFileManager defaultManager] createDirectoryAtPath:[NSHomeDirectory() stringByAppendingFormat:@\"/tmp\"] withIntermediateDirectories:YES attributes:nil error:nil];\n        }\n        \n        if ([TZImagePickerConfig sharedInstance].needFixComposition) {\n            AVMutableVideoComposition *videoComposition = [self fixedCompositionWithAsset:videoAsset];\n            if (videoComposition.renderSize.width) {\n                // 修正视频转向\n                session.videoComposition = videoComposition;\n            }\n        }\n\n        // Begin to export video to the output path asynchronously.\n        [session exportAsynchronouslyWithCompletionHandler:^(void) {\n            [self handleVideoExportResult:session outputPath:outputPath success:success failure:failure];\n        }];\n    } else {\n        if (failure) {\n            NSString *errorMessage = [NSString stringWithFormat:@\"当前设备不支持该预设:%@\", presetName];\n            failure(errorMessage, nil);\n        }\n    }\n}\n\n- (void)requestVideoOutputPathWithAsset:(PHAsset *)asset presetName:(NSString *)presetName success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure {\n    [self requestVideoOutputPathWithAsset:asset presetName:presetName timeRange:kCMTimeRangeZero success:success failure:failure];\n}\n\n- (void)requestVideoOutputPathWithAsset:(PHAsset *)asset presetName:(NSString *)presetName timeRange:(CMTimeRange)timeRange success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure {\n    if (!presetName) {\n        presetName = AVAssetExportPresetMediumQuality;\n    }\n    [[PHImageManager defaultManager] requestExportSessionForVideo:asset options:[self getVideoRequestOptions] exportPreset:presetName resultHandler:^(AVAssetExportSession *_Nullable exportSession, NSDictionary *_Nullable info) {\n        NSString *outputPath = [self getVideoOutputPath];\n        exportSession.outputURL = [NSURL fileURLWithPath:outputPath];\n        exportSession.shouldOptimizeForNetworkUse = NO;\n        exportSession.outputFileType = AVFileTypeMPEG4;\n        if (!CMTimeRangeEqual(timeRange, kCMTimeRangeZero)) {\n            exportSession.timeRange = timeRange;\n        }\n        [exportSession exportAsynchronouslyWithCompletionHandler:^{\n            [self handleVideoExportResult:exportSession outputPath:outputPath success:success failure:failure];\n        }];\n    }];\n}\n\n- (void)requestVideoURLWithAsset:(PHAsset *)asset success:(void (^)(NSURL *videoURL))success failure:(void (^)(NSDictionary* info))failure {\n    [[PHImageManager defaultManager] requestAVAssetForVideo:asset options:[self getVideoRequestOptions] resultHandler:^(AVAsset* avasset, AVAudioMix* audioMix, NSDictionary* info){\n        // NSLog(@\"AVAsset URL: %@\",myAsset.URL);\n        if ([avasset isKindOfClass:[AVURLAsset class]]) {\n            NSURL *url = [(AVURLAsset *)avasset URL];\n            if (success) {\n                success(url);\n            }\n        } else if (failure) {\n            failure(info);\n        }\n    }];\n}\n\n- (void)handleVideoExportResult:(AVAssetExportSession *)session outputPath:(NSString *)outputPath success:(void (^)(NSString *outputPath))success failure:(void (^)(NSString *errorMessage, NSError *error))failure {\n    dispatch_async(dispatch_get_main_queue(), ^{\n        switch (session.status) {\n            case AVAssetExportSessionStatusUnknown: {\n                NSLog(@\"AVAssetExportSessionStatusUnknown\");\n            }  break;\n            case AVAssetExportSessionStatusWaiting: {\n                NSLog(@\"AVAssetExportSessionStatusWaiting\");\n            }  break;\n            case AVAssetExportSessionStatusExporting: {\n                NSLog(@\"AVAssetExportSessionStatusExporting\");\n            }  break;\n            case AVAssetExportSessionStatusCompleted: {\n                NSLog(@\"AVAssetExportSessionStatusCompleted\");\n                if (success) {\n                    success(outputPath);\n                }\n            }  break;\n            case AVAssetExportSessionStatusFailed: {\n                NSLog(@\"AVAssetExportSessionStatusFailed\");\n                if (failure) {\n                    failure(@\"视频导出失败\", session.error);\n                }\n            }  break;\n            case AVAssetExportSessionStatusCancelled: {\n                NSLog(@\"AVAssetExportSessionStatusCancelled\");\n                if (failure) {\n                    failure(@\"导出任务已被取消\", nil);\n                }\n            }  break;\n            default: break;\n        }\n    });\n}\n\n- (PHVideoRequestOptions *)getVideoRequestOptions {\n    PHVideoRequestOptions* options = [[PHVideoRequestOptions alloc] init];\n    options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;\n    options.networkAccessAllowed = YES;\n    return options;\n}\n\n- (NSString *)getVideoOutputPath {\n    NSDateFormatter *formater = [[NSDateFormatter alloc] init];\n    [formater setDateFormat:@\"yyyy-MM-dd-HH-mm-ss-SSS\"];\n    NSString *outputPath = [NSHomeDirectory() stringByAppendingFormat:@\"/tmp/video-%@-%d.mp4\", [formater stringFromDate:[NSDate date]], arc4random_uniform(10000000)];\n    return outputPath;\n}\n\n- (BOOL)isCameraRollAlbum:(PHAssetCollection *)metadata {\n    NSString *versionStr = [[UIDevice currentDevice].systemVersion stringByReplacingOccurrencesOfString:@\".\" withString:@\"\"];\n    if (versionStr.length <= 1) {\n        versionStr = [versionStr stringByAppendingString:@\"00\"];\n    } else if (versionStr.length <= 2) {\n        versionStr = [versionStr stringByAppendingString:@\"0\"];\n    }\n    CGFloat version = versionStr.floatValue;\n    // 目前已知8.0.0 ~ 8.0.2系统，拍照后的图片会保存在最近添加中\n    if (version >= 800 && version <= 802) {\n        return ((PHAssetCollection *)metadata).assetCollectionSubtype == PHAssetCollectionSubtypeSmartAlbumRecentlyAdded;\n    } else {\n        return ((PHAssetCollection *)metadata).assetCollectionSubtype == PHAssetCollectionSubtypeSmartAlbumUserLibrary;\n    }\n}\n\n/// 检查照片大小是否满足最小要求\n- (BOOL)isPhotoSelectableWithAsset:(PHAsset *)asset {\n    CGSize photoSize = CGSizeMake(asset.pixelWidth, asset.pixelHeight);\n    if (self.minPhotoWidthSelectable > photoSize.width || self.minPhotoHeightSelectable > photoSize.height) {\n        return NO;\n    }\n    return YES;\n}\n\n/// 检查照片能否被选中\n- (BOOL)isAssetCannotBeSelected:(PHAsset *)asset {\n    if ([self.pickerDelegate respondsToSelector:@selector(isAssetCanBeSelected:)]) {\n        BOOL canSelectAsset = [self.pickerDelegate isAssetCanBeSelected:asset];\n        return !canSelectAsset;\n    }\n    return NO;\n}\n\n#pragma mark - Private Method\n\n- (TZAlbumModel *)modelWithResult:(PHFetchResult *)result collection:(PHAssetCollection *)collection isCameraRoll:(BOOL)isCameraRoll needFetchAssets:(BOOL)needFetchAssets options:(PHFetchOptions *)options {\n    TZAlbumModel *model = [[TZAlbumModel alloc] init];\n    [model setResult:result needFetchAssets:needFetchAssets];\n    model.name = collection.localizedTitle;\n    model.collection = collection;\n    model.options = options;\n    model.isCameraRoll = isCameraRoll;\n    model.count = result.count;\n    return model;\n}\n\n/// 缩放图片至新尺寸\n- (UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)size {\n    if (image.size.width > size.width) {\n        UIGraphicsBeginImageContext(size);\n        [image drawInRect:CGRectMake(0, 0, size.width, size.height)];\n        UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        return newImage;\n        \n        /* 好像不怎么管用：https://mp.weixin.qq.com/s/CiqMlEIp1Ir2EJSDGgMooQ\n        CGFloat maxPixelSize = MAX(size.width, size.height);\n        CGImageSourceRef sourceRef = CGImageSourceCreateWithData((__bridge CFDataRef)UIImageJPEGRepresentation(image, 0.9), nil);\n        NSDictionary *options = @{(__bridge id)kCGImageSourceCreateThumbnailFromImageAlways:(__bridge id)kCFBooleanTrue,\n                                  (__bridge id)kCGImageSourceThumbnailMaxPixelSize:[NSNumber numberWithFloat:maxPixelSize]\n                                  };\n        CGImageRef imageRef = CGImageSourceCreateImageAtIndex(sourceRef, 0, (__bridge CFDictionaryRef)options);\n        UIImage *newImage = [UIImage imageWithCGImage:imageRef scale:2 orientation:image.imageOrientation];\n        CGImageRelease(imageRef);\n        CFRelease(sourceRef);\n        return newImage;\n         */\n    } else {\n        return image;\n    }\n}\n\n/// 判断asset是否是视频\n- (BOOL)isVideo:(PHAsset *)asset {\n    return asset.mediaType == PHAssetMediaTypeVideo;\n}\n\n- (TZAssetModel *)createModelWithAsset:(PHAsset *)asset {\n    TZAssetModelMediaType type = [[TZImageManager manager] getAssetType:asset];\n    NSString *timeLength = type == TZAssetModelMediaTypeVideo ? [NSString stringWithFormat:@\"%0.0f\",asset.duration] : @\"\";\n    timeLength = [[TZImageManager manager] getNewTimeFromDurationSecond:timeLength.integerValue];\n    TZAssetModel *model = [TZAssetModel modelWithAsset:asset type:type timeLength:timeLength];\n    return model;\n}\n\n/// 获取优化后的视频转向信息\n- (AVMutableVideoComposition *)fixedCompositionWithAsset:(AVAsset *)videoAsset {\n    AVMutableVideoComposition *videoComposition = [AVMutableVideoComposition videoComposition];\n    // 视频转向\n    int degrees = [self degressFromVideoFileWithAsset:videoAsset];\n    if (degrees != 0) {\n        CGAffineTransform translateToCenter;\n        CGAffineTransform mixedTransform;\n        videoComposition.frameDuration = CMTimeMake(1, 30);\n        \n        NSArray *tracks = [videoAsset tracksWithMediaType:AVMediaTypeVideo];\n        AVAssetTrack *videoTrack = [tracks objectAtIndex:0];\n        \n        AVMutableVideoCompositionInstruction *roateInstruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];\n        roateInstruction.timeRange = CMTimeRangeMake(kCMTimeZero, [videoAsset duration]);\n        AVMutableVideoCompositionLayerInstruction *roateLayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:videoTrack];\n        \n        if (degrees == 90) {\n            // 顺时针旋转90°\n            translateToCenter = CGAffineTransformMakeTranslation(videoTrack.naturalSize.height, 0.0);\n            mixedTransform = CGAffineTransformRotate(translateToCenter,M_PI_2);\n            videoComposition.renderSize = CGSizeMake(videoTrack.naturalSize.height,videoTrack.naturalSize.width);\n            [roateLayerInstruction setTransform:mixedTransform atTime:kCMTimeZero];\n        } else if(degrees == 180){\n            // 顺时针旋转180°\n            translateToCenter = CGAffineTransformMakeTranslation(videoTrack.naturalSize.width, videoTrack.naturalSize.height);\n            mixedTransform = CGAffineTransformRotate(translateToCenter,M_PI);\n            videoComposition.renderSize = CGSizeMake(videoTrack.naturalSize.width,videoTrack.naturalSize.height);\n            [roateLayerInstruction setTransform:mixedTransform atTime:kCMTimeZero];\n        } else if(degrees == 270){\n            // 顺时针旋转270°\n            translateToCenter = CGAffineTransformMakeTranslation(0.0, videoTrack.naturalSize.width);\n            mixedTransform = CGAffineTransformRotate(translateToCenter,M_PI_2*3.0);\n            videoComposition.renderSize = CGSizeMake(videoTrack.naturalSize.height,videoTrack.naturalSize.width);\n            [roateLayerInstruction setTransform:mixedTransform atTime:kCMTimeZero];\n        }\n        \n        roateInstruction.layerInstructions = @[roateLayerInstruction];\n        // 加入视频方向信息\n        videoComposition.instructions = @[roateInstruction];\n    }\n    return videoComposition;\n}\n\n/// 获取视频角度\n- (int)degressFromVideoFileWithAsset:(AVAsset *)asset {\n    int degress = 0;\n    NSArray *tracks = [asset tracksWithMediaType:AVMediaTypeVideo];\n    if([tracks count] > 0) {\n        AVAssetTrack *videoTrack = [tracks objectAtIndex:0];\n        CGAffineTransform t = videoTrack.preferredTransform;\n        if(t.a == 0 && t.b == 1.0 && t.c == -1.0 && t.d == 0){\n            // Portrait\n            degress = 90;\n        } else if(t.a == 0 && t.b == -1.0 && t.c == 1.0 && t.d == 0){\n            // PortraitUpsideDown\n            degress = 270;\n        } else if(t.a == 1.0 && t.b == 0 && t.c == 0 && t.d == 1.0){\n            // LandscapeRight\n            degress = 0;\n        } else if(t.a == -1.0 && t.b == 0 && t.c == 0 && t.d == -1.0){\n            // LandscapeLeft\n            degress = 180;\n        }\n    }\n    return degress;\n}\n\n/// 修正图片转向\n- (UIImage *)fixOrientation:(UIImage *)aImage {\n    if (!self.shouldFixOrientation) return aImage;\n    \n    // No-op if the orientation is already correct\n    if (aImage.imageOrientation == UIImageOrientationUp)\n        return aImage;\n    \n    // We need to calculate the proper transformation to make the image upright.\n    // We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored.\n    CGAffineTransform transform = CGAffineTransformIdentity;\n    \n    switch (aImage.imageOrientation) {\n        case UIImageOrientationDown:\n        case UIImageOrientationDownMirrored:\n            transform = CGAffineTransformTranslate(transform, aImage.size.width, aImage.size.height);\n            transform = CGAffineTransformRotate(transform, M_PI);\n            break;\n            \n        case UIImageOrientationLeft:\n        case UIImageOrientationLeftMirrored:\n            transform = CGAffineTransformTranslate(transform, aImage.size.width, 0);\n            transform = CGAffineTransformRotate(transform, M_PI_2);\n            break;\n            \n        case UIImageOrientationRight:\n        case UIImageOrientationRightMirrored:\n            transform = CGAffineTransformTranslate(transform, 0, aImage.size.height);\n            transform = CGAffineTransformRotate(transform, -M_PI_2);\n            break;\n        default:\n            break;\n    }\n    \n    switch (aImage.imageOrientation) {\n        case UIImageOrientationUpMirrored:\n        case UIImageOrientationDownMirrored:\n            transform = CGAffineTransformTranslate(transform, aImage.size.width, 0);\n            transform = CGAffineTransformScale(transform, -1, 1);\n            break;\n            \n        case UIImageOrientationLeftMirrored:\n        case UIImageOrientationRightMirrored:\n            transform = CGAffineTransformTranslate(transform, aImage.size.height, 0);\n            transform = CGAffineTransformScale(transform, -1, 1);\n            break;\n        default:\n            break;\n    }\n    \n    // Now we draw the underlying CGImage into a new context, applying the transform\n    // calculated above.\n    CGContextRef ctx = CGBitmapContextCreate(NULL, aImage.size.width, aImage.size.height,\n                                             CGImageGetBitsPerComponent(aImage.CGImage), 0,\n                                             CGImageGetColorSpace(aImage.CGImage),\n                                             CGImageGetBitmapInfo(aImage.CGImage));\n    CGContextConcatCTM(ctx, transform);\n    switch (aImage.imageOrientation) {\n        case UIImageOrientationLeft:\n        case UIImageOrientationLeftMirrored:\n        case UIImageOrientationRight:\n        case UIImageOrientationRightMirrored:\n            // Grr...\n            CGContextDrawImage(ctx, CGRectMake(0,0,aImage.size.height,aImage.size.width), aImage.CGImage);\n            break;\n            \n        default:\n            CGContextDrawImage(ctx, CGRectMake(0,0,aImage.size.width,aImage.size.height), aImage.CGImage);\n            break;\n    }\n    \n    // And now we just create a new UIImage from the drawing context\n    CGImageRef cgimg = CGBitmapContextCreateImage(ctx);\n    UIImage *img = [UIImage imageWithCGImage:cgimg];\n    CGContextRelease(ctx);\n    CGImageRelease(cgimg);\n    return img;\n}\n\n#pragma clang diagnostic pop\n\n@end\n\n\n//@implementation TZSortDescriptor\n//\n//- (id)reversedSortDescriptor {\n//    return [NSNumber numberWithBool:![TZImageManager manager].sortAscendingByModificationDate];\n//}\n//\n//@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/ar.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"阿拉伯语\";\n\"OK\"                      = \"حسنا\";\n\"Back\"                    = \"الى الخلف\";\n\"Done\"                    = \"فعله\";\n\"Edit\"                    = \"تعديل\";\n\"Sorry\"                   = \"آسف\";\n\"Cancel\"                  = \"إلغاء\";\n\"Setting\"                 = \"ضبط\";\n\"Photos\"                  = \"الصور\";\n\"Videos\"                  = \"أشرطة فيديو\";\n\"Preview\"                 = \"معاينة\";\n\"Full image\"              = \"الصورة كاملة\";\n\"Processing...\"           = \"معالجة...\";\n\"No Photos or Videos\"     = \"لا توجد صور أو مقاطع فيديو\";\n\"Synchronizing photos from iCloud\" = \"مزامنة الصور من iCloud\";\n\"iCloud sync failed\"    = \"iCloud فشلت المزامنة\";\n\"Can not use camera\"      = \"لا يمكن استخدام الكاميرا\";\n\"Can not choose both video and photo\" = \"لا يمكن اختيار كل من الفيديو والصور\";\n\"Can not choose both photo and GIF\" = \"لا يمكن اختيار كل من الصور و GIF\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"حدد مقطع الفيديو عندما يكون في حالة متعددة، وسنعمل على معالجة مقطع الفيديو كصورة\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"إذا تعذّر الانتقال إلى صفحة \"إعدادات الخصوصية\"، فيرجى الانتقال إلى صفحة \"الإعدادات\" بنفسك، شكرًا لك\";\n\"Select a maximum of %zd photos\" = \"حدد فقط ما يصل إلى %zd صورة\";\n\"Select a minimum of %zd photos\" = \"الرجاء تحديد %zd صورة على الأقل\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"السماح لـ %@ بالوصول إلى الألبوم في \\\"الإعدادات > الخصوصية > الصور\\\"\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"الرجاء السماح لـ %@ بالوصول إلى الكاميرا في \\\"الإعدادات > الخصوصية > الكاميرا\\\"\";\n\"Selected for %ld seconds\" = \"محدد لمدة %ld ثانية\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/de.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"德语\";\n\"OK\"                      = \"OK\";\n\"Back\"                    = \"Zurück\";\n\"Done\"                    = \"Erledigt\";\n\"Edit\"                    = \"Bearbeiten\";\n\"Sorry\"                   = \"Es tut uns leid\";\n\"Cancel\"                  = \"Stornieren\";\n\"Setting\"                 = \"Rahmen\";\n\"Photos\"                  = \"Fotos\";\n\"Videos\"                  = \"Videos\";\n\"Preview\"                 = \"Vorschau\";\n\"Full image\"              = \"Vollbild\";\n\"Processing...\"           = \"Wird bearbeitet...\";\n\"No Photos or Videos\"     = \"Keine Fotos oder Videos\";\n\"Synchronizing photos from iCloud\" = \"Fotos aus iCloud synchronisieren\";\n\"iCloud sync failed\"    = \"iCloud Synchronisierung fehlgeschlagen\";\n\"Can not use camera\"      = \"Kann die Kamera nicht benutzen\";\n\"Can not choose both video and photo\" = \"Video und Foto können nicht ausgewählt werden\";\n\"Can not choose both photo and GIF\" = \"Foto und GIF können nicht ausgewählt werden\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"Wenn Sie das Video im Multi-Status auswählen, wird es als Foto behandelt\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"Sie können nicht zur Seite mit den Datenschutz-Einstellungen springen; bitte navigieren Sie selbst zur Einstellungsseite. Vielen Dank.\";\n\"Select a maximum of %zd photos\" = \"Wählen Sie maximal %zd Bilder aus\";\n\"Select a minimum of %zd photos\" = \"Bitte wählen Sie mindestens %zd Fotos aus\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"Erlauben Sie %@ den Zugriff auf Ihr Album unter: „Einstellungen > Datenschutz > Fotos“\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"Erlauben Sie %@ den Zugriff auf Ihre Kamera unter: „Einstellungen > Datenschutz > Kamera“\";\n\"Selected for %ld seconds\" = \"Ausgewählt für %ld Sekunden\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/es.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"西班牙语\";\n\"OK\"                      = \"DE ACUERDO\";\n\"Back\"                    = \"Espalda\";\n\"Done\"                    = \"Hecho\";\n\"Edit\"                    = \"επεξεργασία\";\n\"Sorry\"                   = \"Lo siento\";\n\"Cancel\"                  = \"Cancelar\";\n\"Setting\"                 = \"Ajuste\";\n\"Photos\"                  = \"Las fotos\";\n\"Videos\"                  = \"Videos\";\n\"Preview\"                 = \"Avance\";\n\"Full image\"              = \"Imagen completa\";\n\"Processing...\"           = \"Tratamiento...\";\n\"No Photos or Videos\"     = \"No hay fotos o videos\";\n\"Synchronizing photos from iCloud\" = \"Sincronizando fotos desde iCloud\";\n\"iCloud sync failed\"    = \"la sincronización falló\";\n\"Can not use camera\"      = \"No puedo usar la camara\";\n\"Can not choose both video and photo\" = \"No se puede elegir tanto el video como la foto.\";\n\"Can not choose both photo and GIF\" = \"No se puede elegir tanto foto como GIF\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"Seleccione el vídeo en estado múltiple, trataremos el vídeo como una fotografía\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"No se puede saltar a la página de ajustes de privacidad, vaya a la página de ajustes manualmente, muchas gracias\";\n\"Select a maximum of %zd photos\" = \"Seleccione solamente hasta %zd imágenes\";\n\"Select a minimum of %zd photos\" = \"Seleccione al menos %zd fotografías\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"Permita que %@ acceda a su galería en \\\"Ajustes > Privacidad > Fotografías\\\"\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"Permita que %@ acceda a su cámara en \\\"Ajustes > Privacidad > Cámara\\\"\";\n\"Selected for %ld seconds\" = \"Seleccionado para %ld segundos\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/fr.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"法语\";\n\"OK\"                      = \"D'accord\";\n\"Back\"                    = \"Retour\";\n\"Done\"                    = \"Terminé\";\n\"Edit\"                    = \"Éditer\";\n\"Sorry\"                   = \"Pardon\";\n\"Cancel\"                  = \"Annuler\";\n\"Setting\"                 = \"Réglage\";\n\"Photos\"                  = \"Photos\";\n\"Videos\"                  = \"Vidéos\";\n\"Preview\"                 = \"Aperçu\";\n\"Full image\"              = \"Image complète\";\n\"Processing...\"           = \"En traitement...\";\n\"No Photos or Videos\"     = \"Aucune photo ou vidéo\";\n\"Synchronizing photos from iCloud\" = \"Synchroniser des photos depuis iCloud\";\n\"iCloud sync failed\"    = \"iCloud échec de la synchronisation\";\n\"Can not use camera\"      = \"Impossible d'utiliser la caméra\";\n\"Can not choose both video and photo\" = \"Impossible de choisir à la fois la vidéo et la photo\";\n\"Can not choose both photo and GIF\" = \"Impossible de choisir à la fois photo et GIF\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"Sélectionnez la vidéo lorsqu’elle est en état multiple, nous la traiterons comme une photo\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"Impossible d'ouvrir la page des paramètres de confidentialité, veuillez accéder vous-même à la page des paramètres, merci\";\n\"Select a maximum of %zd photos\" = \"Vous pouvez uniquement sélectionner un maximum de %zd images\";\n\"Select a minimum of %zd photos\" = \"Veuillez sélectionner un minimum de %zd photos\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"Autorisez %@ à accéder à votre album dans « Paramètres > Confidentialité > Photos »\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"Autorisez %@ à accéder à votre appareil photo dans « Paramètres > Confidentialité > Appareil photo »\";\n\"Selected for %ld seconds\" = \"Sélectionné pendant %ld secondes\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/ja.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"日语\";\n\"OK\"                      = \"OK\";\n\"Back\"                    = \"バック\";\n\"Done\"                    = \"完了\";\n\"Edit\"                    = \"編集する\";\n\"Sorry\"                   = \"ごめんなさい\";\n\"Cancel\"                  = \"キャンセル\";\n\"Setting\"                 = \"設定\";\n\"Photos\"                  = \"写真\";\n\"Videos\"                  = \"動画\";\n\"Preview\"                 = \"プレビュー\";\n\"Full image\"              = \"フルイメージ\";\n\"Processing...\"           = \"処理...\";\n\"No Photos or Videos\"     = \"写真やビデオはありません\";\n\"Synchronizing photos from iCloud\" = \"iCloudから写真を同期する\";\n\"iCloud sync failed\"    = \"iCloud同期に失敗しました\";\n\"Can not use camera\"      = \"カメラが使えない\";\n\"Can not choose both video and photo\" = \"ビデオと写真の両方を選択することはできません\";\n\"Can not choose both photo and GIF\" = \"写真とGIFの両方を選択することはできません\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"多肢選択の状態で、ビデオを選択すると、ビデオをデフォルトに画像として送信します。\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"プライバシー設定画面にジャンプできません。手動で設定画面を表示してください。\";\n\"Select a maximum of %zd photos\" = \"写真は多くとも%zd 枚選択できます。\";\n\"Select a minimum of %zd photos\" = \"少なくとも %zd 枚の写真を選択してください。\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"iPhoneの「設定-プライバシー-写真」のオプションで、r%@の携帯電話のアルバムへのアクセス権限を許可してください。\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"iPhoneの「設定-プライバシー-カメラ」で、%@のカメラへのアクセス権限を許可してください。\";\n\"Selected for %ld seconds\" = \"%ld 秒間選択されました\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/ko-KP.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"朝鲜语\";\n\"OK\"                      = \"그래\";\n\"Back\"                    = \"뒤로\";\n\"Done\"                    = \"완료\";\n\"Edit\"                    = \"편집하다\";\n\"Sorry\"                   = \"미안해요\";\n\"Cancel\"                  = \"취소\";\n\"Setting\"                 = \"설정\";\n\"Photos\"                  = \"사진\";\n\"Videos\"                  = \"동영상\";\n\"Preview\"                 = \"미리 보기\";\n\"Full image\"              = \"전체 이미지\";\n\"Processing...\"           = \"처리...\";\n\"No Photos or Videos\"     = \"아무 사진이 나 동영상\";\n\"Synchronizing photos from iCloud\" = \"ICloud에서 사진을 동기화\";\n\"iCloud sync failed\"    = \"iCloud동기화 실패\";\n\"Can not use camera\"      = \"카메라를 사용할 수 없습니다.\";\n\"Can not choose both video and photo\" = \"비디오와 사진 둘 다를 선택할 수 없습니다.\";\n\"Can not choose both photo and GIF\" = \"사진 및 GIF를 선택할 수 없습니다.\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"다중 선택 모드에서 비디오를 선택하면 비디오를 사진으로 처리합니다.\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"개인 정보 보호 설정 페이지로 바로 이동할 수 없습니다. 설정 페이지로 직접 이동해 주세요. 감사합니다.\";\n\"Select a maximum of %zd photos\" = \"최대 %zd장의 이미지만 선택할 수 있습니다.\";\n\"Select a minimum of %zd photos\" = \"최소 %zd장의 사진을 선택해 주세요.\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"\\\"설정 > 개인 정보 보호 > 사진\\\"에서 %@이(가) 앨범에 접근할 수 있도록 허용하세요.\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"\\\"설정 > 개인 정보 보호 > 카메라\\\"에서 %@이(가) 카메라에 접근할 수 있도록 허용하세요.\";\n\"Selected for %ld seconds\" = \"%ld 초 동안 선택됨\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/pt.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"葡萄牙语\";\n\"OK\"                      = \"Está bem\";\n\"Back\"                    = \"De volta\";\n\"Done\"                    = \"Feito\";\n\"Edit\"                    = \"editar\";\n\"Sorry\"                   = \"Desculpa\";\n\"Cancel\"                  = \"Cancelar\";\n\"Setting\"                 = \"Configuração\";\n\"Photos\"                  = \"Fotos\";\n\"Videos\"                  = \"Vídeos\";\n\"Preview\"                 = \"Visualizar\";\n\"Full image\"              = \"Imagem Completa\";\n\"Processing...\"           = \"Em processamento...\";\n\"No Photos or Videos\"     = \"Sem fotos ou vídeos\";\n\"Synchronizing photos from iCloud\" = \"Sincronizando fotos do iCloud\";\n\"iCloud sync failed\"    = \"iCloud falha na sincronização\";\n\"Can not use camera\"      = \"Não pode usar a câmera\";\n\"Can not choose both video and photo\" = \"Não é possível escolher vídeo e foto\";\n\"Can not choose both photo and GIF\" = \"Não é possível escolher foto e GIF\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"Se estiver em estado múltiplo, selecione a opção vídeo; iremos utilizar o vídeo como uma foto\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"Não é possível avançar para a página de definições de privacidade, aceda à página de definições você mesmo, obrigado\";\n\"Select a maximum of %zd photos\" = \"Selecione apenas %zd imagens,no máximo\";\n\"Select a minimum of %zd photos\" = \"Selecione %zd fotos,no mínimo\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"Permita a %@ aceder ao seu álbum em “Definições > Privacidade > Fotos”\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"Permita a %@ aceder à sua câmara em “Definições > Privacidade > Câmara”\";\n\"Selected for %ld seconds\" = \"Selecionado por %ld segundos\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/ru.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"俄语\";\n\"OK\"                      = \"Хорошо\";\n\"Back\"                    = \"назад\";\n\"Done\"                    = \"Готово\";\n\"Edit\"                    = \"редактировать\";\n\"Sorry\"                   = \"сожалею\";\n\"Cancel\"                  = \"отменить\";\n\"Setting\"                 = \"настройка\";\n\"Photos\"                  = \"Фото\";\n\"Videos\"                  = \"Видео\";\n\"Preview\"                 = \"предварительный просмотр\";\n\"Full image\"              = \"Полное изображение\";\n\"Processing...\"           = \"Обработка ...\";\n\"No Photos or Videos\"     = \"Нет фото или видео\";\n\"Synchronizing photos from iCloud\" = \"Синхронизация фотографий из iCloud\";\n\"iCloud sync failed\"    = \"iCloud сбой синхронизации\";\n\"Can not use camera\"      = \"Не могу использовать камеру\";\n\"Can not choose both video and photo\" = \"Не могу выбрать как видео,так и фото\";\n\"Can not choose both photo and GIF\" = \"Не могу выбрать фото и GIF\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"В случае выбора видео при нахождении в мультирежиме видео будет обработано как фотография\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"Не удается перейти на страницу настроек конфиденциальности. Перейдите на эту страницу самостоятельно\";\n\"Select a maximum of %zd photos\" = \"Вы можете выбрать до %zd изображений\";\n\"Select a minimum of %zd photos\" = \"Вы можете выбрать не менее %zd изображений\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"Разрешите доступ %@ к вашему альбому,перейдя в Настройки > Конфиденциальность > Фото\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"Разрешите доступ %@ к камере вашего устройства,перейдя в Настройки > Конфиденциальность > Камера\";\n\"Selected for %ld seconds\" = \"Выбрано для %ld секунд\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/vi.lproj/Localizable.strings",
    "content": "\"KEY\"                     = \"越南语\";\n\"OK\"                      = \"Xác nhận\";\n\"Back\"                    = \"Quay lại\";\n\"Done\"                    = \"Hoàn thành\";\n\"Edit\"                    = \"biên tập\";\n\"Sorry\"                   = \"Xin lỗi\";\n\"Cancel\"                  = \"Hủy\";\n\"Setting\"                 = \"Cài đặt\";\n\"Photos\"                  = \"Hình\";\n\"Videos\"                  = \"Clip\";\n\"Preview\"                 = \"Xem trước\";\n\"Full image\"              = \"Hình gốc\";\n\"Processing...\"           = \"Đang xử lý...\";\n\"No Photos or Videos\"     = \"Không có ảnh hoặc video\";\n\"Can not use camera\" = \"Máy chụp hình không khả dụng\";\n\"Synchronizing photos from iCloud\" = \"Đang đồng bộ hình ảnh từ ICloud\";\n\"iCloud sync failed\"    = \"iCloud đồng bộ hóa không thành công\";\n\"Can not choose both video and photo\" = \"Trong lúc chọn hình ảnh không cùng lúc chọn video\";\n\"Can not choose both photo and GIF\" = \"Trong lúc chọn hình ảnh không cùng lúc chọn hình GIF\";\n\"Select the video when in multi state, we will handle the video as a photo\" = \"Chọn hình ảnh cùng video, video sẽ bị mặc nhận thành hình ảnh và gửi đi.\";\n\"Can not jump to the privacy settings page, please go to the settings page by self, thank you\" = \"Không thể chuyển tự động qua trang cài đặt riêng tư, bạn hãy thoát ra cà điều chỉnh lại, cám ơn bạn.\";\n\"Select a maximum of %zd photos\" = \"Bạn chỉ được chọn nhiều nhất %zd tấm hình\";\n\"Select a minimum of %zd photos\" = \"Chọn ít nhất %zd tấm hình\";\n\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\" = \"Vui lòng tại mục iPhone \\\" Cài đặt – quyền riêng tư - Ảnh\\\" mở quyền cho phép %@ truy cập ảnh.\";\n\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\" = \"Vui lòng tại mục iPhone \\\" Cài đặt – quyền riêng tư - Ảnh\\\" mở quyền cho phép %@ truy cập máy ảnh\";\n\"Selected for %ld seconds\" = \"Đã chọn cho %ld giây\";\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.h",
    "content": "//\n//  TZImagePickerController.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//  version 3.8.1 - 2022.04.15\n//  更多信息，请前往项目的github地址：https://github.com/banchichen/TZImagePickerController\n\n/*\n 经过测试，比起xib的方式，把TZAssetCell改用纯代码的方式来写，滑动帧数明显提高了（约提高10帧左右）\n \n 最初发现这个问题并修复的是@小鱼周凌宇同学，她的博客地址: http://zhoulingyu.com/\n 表示感谢~\n \n 原来xib确实会导致性能问题啊...大家也要注意了...\n */\n\n#import <UIKit/UIKit.h>\n#import \"TZAssetModel.h\"\n#import \"NSBundle+TZImagePicker.h\"\n#import \"TZImageManager.h\"\n#import \"TZVideoPlayerController.h\"\n#import \"TZGifPhotoPreviewController.h\"\n#import \"TZLocationManager.h\"\n#import \"TZPhotoPreviewController.h\"\n#import \"TZPhotoPreviewCell.h\"\n\n#define CURRENT_SYSTEM_VERSION         [[UIDevice currentDevice] systemVersion]\n#define SYSTEM_VERSION_GREATER_THAN_15 ([CURRENT_SYSTEM_VERSION floatValue] >= 15.0)\n\n@class TZAlbumCell, TZAssetCell;\n@protocol TZImagePickerControllerDelegate;\n@interface TZImagePickerController : UINavigationController\n\n#pragma mark -\n/// Use this init method / 用这个初始化方法\n- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<TZImagePickerControllerDelegate>)delegate;\n- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate;\n- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc;\n/// This init method just for previewing photos / 用这个初始化方法以预览图片\n- (instancetype)initWithSelectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index;\n/// This init method for crop photo / 用这个初始化方法以裁剪图片\n- (instancetype)initCropTypeWithAsset:(PHAsset *)asset photo:(UIImage *)photo completion:(void (^)(UIImage *cropImage,PHAsset *asset))completion;\n\n#pragma mark -\n/// Default is 9 / 默认最大可选9张图片\n@property (nonatomic, assign) NSInteger maxImagesCount;\n\n/// The minimum count photos user must pick, Default is 0\n/// 最小照片必选张数,默认是0\n@property (nonatomic, assign) NSInteger minImagesCount;\n\n/// If the user does not select any pictures, the current picture is automatically selected when the Finish button is clicked,  Default is YES\n/// 如果用户未选择任何图片，在点击完成按钮时自动选中当前图片，默认YES\n@property (nonatomic, assign) BOOL autoSelectCurrentWhenDone;\n\n/// Always enale the done button, not require minimum 1 photo be picked\n/// 让完成按钮一直可以点击，无须最少选择一张图片\n@property (nonatomic, assign) BOOL alwaysEnableDoneBtn;\n\n/// Sort photos ascending by modificationDate，Default is YES\n/// 对照片排序，按修改时间升序，默认是YES。如果设置为NO,最新的照片会显示在最前面，内部的拍照按钮会排在第一个\n@property (nonatomic, assign) BOOL sortAscendingByModificationDate;\n\n/// The pixel width of output image, Default is 828px，you need to set photoPreviewMaxWidth at the same time\n/// 导出图片的宽度，默认828像素宽，你需要同时设置photoPreviewMaxWidth的值\n@property (nonatomic, assign) CGFloat photoWidth;\n\n/// Default is 600px / 默认600像素宽\n@property (nonatomic, assign) CGFloat photoPreviewMaxWidth;\n\n/// Default is 30, While fetching photo, HUD will dismiss automatic if timeout;\n/// 超时时间，默认为30秒，当取图片时间超过30秒还没有取成功时，会自动dismiss HUD；\n@property (nonatomic, assign) NSInteger timeout;\n\n/// Default is YES, if set NO, the original photo button will hide. user can't picking original photo.\n/// 默认为YES，如果设置为NO,原图按钮将隐藏，用户不能选择发送原图\n@property (nonatomic, assign) BOOL allowPickingOriginalPhoto;\n\n/// Default is YES, if set NO, user can't picking video.\n/// 默认为YES，如果设置为NO,用户将不能选择视频\n@property (nonatomic, assign) BOOL allowPickingVideo;\n\n/// Default is NO, if set YES, user can edit video.\n/// 默认为NO，如果设置为YES, 用户能编辑视频\n@property (nonatomic, assign) BOOL allowEditVideo;\n\n/// Export quality of cropped video, Default is AVAssetExportPresetMediumQuality\n/// 裁剪视频的导出质量，默认是 AVAssetExportPresetMediumQuality\n@property (nonatomic, assign) NSString *presetName;\n\n/// Default is 30s. If it exceeds the video duration, it is the video duration.The minimum duration of video crop is 1s.\n/// 默认是30s，如果超过视频时长，则为视频时长，小于1s不裁剪\n@property (nonatomic, assign) NSInteger maxCropVideoDuration;\n\n/// Default is NO, if set YES, The edited video will be automatically saved to the album.\n/// 默认为NO，如果设置为YES，编辑后的视频会自动保存到相册\n@property (nonatomic, assign) BOOL saveEditedVideoToAlbum;\n\n/// Default is NO / 默认为NO，为YES时可以多选视频/gif/图片，和照片共享最大可选张数maxImagesCount的限制\n@property (nonatomic, assign) BOOL allowPickingMultipleVideo;\n\n/// Default is NO, if set YES, user can picking gif image.\n/// 默认为NO，如果设置为YES,用户可以选择gif图片\n@property (nonatomic, assign) BOOL allowPickingGif;\n\n/// Default is YES, if set NO, user can't picking image.\n/// 默认为YES，如果设置为NO,用户将不能选择发送图片\n@property (nonatomic, assign) BOOL allowPickingImage;\n\n/// Default is YES, if set NO, user can't take picture.\n/// 默认为YES，如果设置为NO, 用户将不能拍摄照片\n@property (nonatomic, assign) BOOL allowTakePicture;\n@property (nonatomic, assign) BOOL allowCameraLocation;\n\n/// Default is YES, if set NO, user can't take video.\n/// 默认为YES，如果设置为NO, 用户将不能拍摄视频\n@property(nonatomic, assign) BOOL allowTakeVideo;\n/// Default value is 10 minutes / 视频最大拍摄时间，默认是10分钟，单位是秒\n@property (assign, nonatomic) NSTimeInterval videoMaximumDuration;\n/// Customizing UIImagePickerController's other properties, such as videoQuality / 定制UIImagePickerController的其它属性，比如视频拍摄质量videoQuality\n@property (nonatomic, copy) void(^uiImagePickerControllerSettingBlock)(UIImagePickerController *imagePickerController);\n\n/// 首选语言，如果设置了就用该语言，不设则取当前系统语言。\n/// 支持zh-Hans、zh-Hant、en、vi等值，详见TZImagePickerController.bundle内的语言资源\n@property (copy, nonatomic) NSString *preferredLanguage;\n\n/// 语言bundle，preferredLanguage变化时languageBundle会变化\n/// 可通过手动设置bundle，让选择器支持新的的语言（需要在设置preferredLanguage后设置languageBundle）。欢迎提交PR把语言文件提交上来~\n@property (strong, nonatomic) NSBundle *languageBundle;\n\n/// Default is YES, if set NO, user can't preview photo.\n/// 默认为YES，如果设置为NO,预览按钮将隐藏,用户将不能去预览照片\n@property (nonatomic, assign) BOOL allowPreview;\n\n/// Default is YES, if set NO, the picker don't dismiss itself.\n/// 默认为YES，如果设置为NO, 选择器将不会自己dismiss\n@property(nonatomic, assign) BOOL autoDismiss;\n\n/// Default is NO, if set YES, in the delegate method the photos and infos will be nil, only assets hava value.\n/// 默认为NO，如果设置为YES，代理方法里photos和infos会是nil，只返回assets\n@property (assign, nonatomic) BOOL onlyReturnAsset;\n\n/// Default is NO, if set YES, will show the image's selected index.\n/// 默认为NO，如果设置为YES，会显示照片的选中序号\n@property (assign, nonatomic) BOOL showSelectedIndex;\n\n/// Default is NO, if set YES, when selected photos's count up to maxImagesCount, other photo will show float layer what's color is cannotSelectLayerColor.\n/// 默认是NO，如果设置为YES，当照片选择张数达到maxImagesCount时，其它照片会显示颜色为cannotSelectLayerColor的浮层\n@property (assign, nonatomic) BOOL showPhotoCannotSelectLayer;\n/// Default is white color with 0.8 alpha;\n@property (strong, nonatomic) UIColor *cannotSelectLayerColor;\n\n/// Default is YES, if set NO, the result photo will be scaled to photoWidth pixel width. The photoWidth default is 828px\n/// 默认是YES，如果设置为NO，内部会缩放图片到photoWidth像素宽\n@property (assign, nonatomic) BOOL notScaleImage;\n\n/// 默认是NO，如果设置为YES，导出视频时会修正转向（慎重设为YES，可能导致部分安卓下拍的视频导出失败）\n@property (assign, nonatomic) BOOL needFixComposition;\n\n/// The photos user have selected\n/// 用户选中过的图片数组\n@property (nonatomic, strong) NSMutableArray *selectedAssets;\n@property (nonatomic, strong) NSMutableArray<TZAssetModel *> *selectedModels;\n@property (nonatomic, strong) NSMutableArray *selectedAssetIds;\n- (void)addSelectedModel:(TZAssetModel *)model;\n- (void)removeSelectedModel:(TZAssetModel *)model;\n\n/// Minimum selectable photo width, Default is 0\n/// 最小可选中的图片宽度，默认是0，小于这个宽度的图片不可选中\n@property (nonatomic, assign) NSInteger minPhotoWidthSelectable;\n@property (nonatomic, assign) NSInteger minPhotoHeightSelectable;\n/// Hide the photo what can not be selected, Default is NO\n/// 隐藏不可以选中的图片，默认是NO，不推荐将其设置为YES\n@property (nonatomic, assign) BOOL hideWhenCanNotSelect;\n/// Deprecated, Use statusBarStyle (顶部statusBar 是否为系统默认的黑色，默认为NO)\n@property (nonatomic, assign) BOOL isStatusBarDefault __attribute__((deprecated(\"Use -statusBarStyle.\")));\n/// statusBar的样式，默认为UIStatusBarStyleLightContent\n@property (assign, nonatomic) UIStatusBarStyle statusBarStyle;\n\n#pragma mark -\n/// Single selection mode, valid when maxImagesCount = 1\n/// 单选模式,maxImagesCount为1时才生效\n@property (nonatomic, assign) BOOL showSelectBtn;        ///< 在单选模式下，照片列表页中，显示选择按钮,默认为NO\n@property (nonatomic, assign) BOOL allowCrop;            ///< 允许裁剪,默认为YES，showSelectBtn为NO才生效\n@property (nonatomic, assign) BOOL scaleAspectFillCrop;  ///< 是否图片等比缩放填充cropRect区域，开启后预览页面无法左右滑动切换图片\n@property (nonatomic, assign) CGRect cropRect;           ///< 裁剪框的尺寸\n@property (nonatomic, assign) CGRect cropRectPortrait;   ///< 裁剪框的尺寸(竖屏)\n@property (nonatomic, assign) CGRect cropRectLandscape;  ///< 裁剪框的尺寸(横屏)\n@property (nonatomic, assign) BOOL needCircleCrop;       ///< 需要圆形裁剪框\n@property (nonatomic, assign) NSInteger circleCropRadius;  ///< 圆形裁剪框半径大小\n@property (nonatomic, copy) void (^cropViewSettingBlock)(UIView *cropView);     ///< 自定义裁剪框的其他属性\n@property (nonatomic, copy) void (^navLeftBarButtonSettingBlock)(UIButton *leftButton);     ///< 自定义返回按钮样式及其属性\n\n/// 【自定义各页面/组件的样式】在界面初始化/组件setModel完成后调用，允许外界修改样式等\n@property (nonatomic, copy) void (^photoPickerPageUIConfigBlock)(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine);\n@property (nonatomic, copy) void (^photoPreviewPageUIConfigBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);\n@property (nonatomic, copy) void (^videoPreviewPageUIConfigBlock)(UIButton *playButton, UIView *toolBar, UIButton *editBtn, UIButton *doneButton);\n@property (nonatomic, copy) void (^videoEditViewPageUIConfigBlock)(UIButton *playButton,UILabel *cropVideoDurationLabel, UIButton *editButton, UIButton *doneButton);\n@property (nonatomic, copy) void (^gifPreviewPageUIConfigBlock)(UIView *toolBar, UIButton *doneButton);\n@property (nonatomic, copy) void (^albumPickerPageUIConfigBlock)(UITableView *tableView);\n@property (nonatomic, copy) void (^assetCellDidSetModelBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);\n@property (nonatomic, copy) void (^albumCellDidSetModelBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);\n/// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用，允许外界修改frame等\n@property (nonatomic, copy) void (^photoPickerPageDidLayoutSubviewsBlock)(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine);\n@property (nonatomic, copy) void (^photoPreviewPageDidLayoutSubviewsBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);\n@property (nonatomic, copy) void (^videoPreviewPageDidLayoutSubviewsBlock)(UIButton *playButton, UIView *toolBar, UIButton *editButton, UIButton *doneButton);\n@property (nonatomic, copy) void (^videoEditViewPageDidLayoutSubviewsBlock)(UIButton *playButton, UILabel *cropVideoDurationLabel, UIButton *cancelButton, UIButton *doneButton);\n@property (nonatomic, copy) void (^gifPreviewPageDidLayoutSubviewsBlock)(UIView *toolBar, UIButton *doneButton);\n@property (nonatomic, copy) void (^albumPickerPageDidLayoutSubviewsBlock)(UITableView *tableView);\n@property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);\n@property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);\n/// 自定义各页面/组件的frame】刷新底部状态(refreshNaviBarAndBottomBarState)使用的\n@property (nonatomic, copy) void (^photoPickerPageDidRefreshStateBlock)(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine);\n\n@property (nonatomic, copy) void (^photoPreviewPageDidRefreshStateBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);\n\n#pragma mark -\n- (UIAlertController *)showAlertWithTitle:(NSString *)title;\n- (void)showProgressHUD;\n- (void)hideProgressHUD;\n@property (nonatomic, assign) BOOL isSelectOriginalPhoto;\n@property (assign, nonatomic) BOOL needShowStatusBar;\n\n#pragma mark -\n@property (nonatomic, copy) NSString *takePictureImageName __attribute__((deprecated(\"Use -takePictureImage.\")));\n@property (nonatomic, copy) NSString *photoSelImageName __attribute__((deprecated(\"Use -photoSelImage.\")));\n@property (nonatomic, copy) NSString *photoDefImageName __attribute__((deprecated(\"Use -photoDefImage.\")));\n@property (nonatomic, copy) NSString *photoOriginSelImageName __attribute__((deprecated(\"Use -photoOriginSelImage.\")));\n@property (nonatomic, copy) NSString *photoOriginDefImageName __attribute__((deprecated(\"Use -photoOriginDefImage.\")));\n@property (nonatomic, copy) NSString *photoPreviewOriginDefImageName __attribute__((deprecated(\"Use -photoPreviewOriginDefImage.\")));\n@property (nonatomic, copy) NSString *photoNumberIconImageName __attribute__((deprecated(\"Use -photoNumberIconImage.\")));\n@property (nonatomic, strong) UIImage *takePictureImage;\n@property (nonatomic, strong) UIImage *addMorePhotoImage;\n@property (nonatomic, strong) UIImage *photoSelImage;\n@property (nonatomic, strong) UIImage *photoDefImage;\n@property (nonatomic, strong) UIImage *photoOriginSelImage;\n@property (nonatomic, strong) UIImage *photoOriginDefImage;\n@property (nonatomic, strong) UIImage *photoPreviewOriginDefImage;\n@property (nonatomic, strong) UIImage *photoNumberIconImage;\n\n#pragma mark -\n/// Appearance / 外观颜色 + 按钮文字\n@property (nonatomic, strong) UIColor *oKButtonTitleColorNormal;\n@property (nonatomic, strong) UIColor *oKButtonTitleColorDisabled;\n@property (nonatomic, strong) UIColor *naviBgColor;\n@property (nonatomic, strong) UIColor *naviTitleColor;\n@property (nonatomic, strong) UIFont *naviTitleFont;\n@property (nonatomic, strong) UIColor *barItemTextColor;\n@property (nonatomic, strong) UIFont *barItemTextFont;\n\n@property (nonatomic, copy) NSString *doneBtnTitleStr;\n@property (nonatomic, copy) NSString *cancelBtnTitleStr;\n@property (nonatomic, copy) NSString *previewBtnTitleStr;\n@property (nonatomic, copy) NSString *fullImageBtnTitleStr;\n@property (nonatomic, copy) NSString *settingBtnTitleStr;\n@property (nonatomic, copy) NSString *processHintStr;\n@property (nonatomic, copy) NSString *editBtnTitleStr;\n@property (nonatomic, copy) NSString *editViewCancelBtnTitleStr;\n\n/// Icon theme color, default is green color like wechat, the value is r:31 g:185 b:34. Currently only support image selection icon when showSelectedIndex is YES. If you need it, please set it as soon as possible\n/// icon主题色，默认是微信的绿色，值是r:31 g:185 b:34。目前仅支持showSelectedIndex为YES时的图片选中icon。如需要，请尽早设置它。\n@property (strong, nonatomic) UIColor *iconThemeColor;\n\n#pragma mark -\n- (void)cancelButtonClick;\n\n// For method annotations, see the corresponding method in TZImagePickerControllerDelegate / 方法注释见TZImagePickerControllerDelegate中对应方法\n@property (nonatomic, copy) void (^didFinishPickingPhotosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto);\n@property (nonatomic, copy) void (^didFinishPickingPhotosWithInfosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto,NSArray<NSDictionary *> *infos);\n@property (nonatomic, copy) void (^imagePickerControllerDidCancelHandle)(void);\n@property (nonatomic, copy) void (^didFinishPickingVideoHandle)(UIImage *coverImage,PHAsset *asset);\n@property (nonatomic, copy) void (^didFinishPickingAndEditingVideoHandle)(UIImage *coverImage,NSString *outputPath,NSString *errorMsg);\n@property (nonatomic, copy) void (^didFinishPickingGifImageHandle)(UIImage *animatedImage,id sourceAssets);\n\n@property (nonatomic, weak) id<TZImagePickerControllerDelegate> pickerDelegate;\n\n@end\n\n\n@protocol TZImagePickerControllerDelegate <NSObject>\n@optional\n// The picker should dismiss itself; when it dismissed these callback will be called.\n// You can also set autoDismiss to NO, then the picker don't dismiss itself.\n// If isOriginalPhoto is YES, user picked the original photo.\n// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:].\n// The UIImage Object in photos default width is 828px, you can set it by photoWidth property.\n// 这个照片选择器会自己dismiss，当选择器dismiss的时候，会执行下面的代理方法\n// 你也可以设置autoDismiss属性为NO，选择器就不会自己dismis了\n// 如果isSelectOriginalPhoto为YES，表明用户选择了原图\n// 你可以通过一个asset获得原图，通过这个方法：[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]\n// photos数组里的UIImage对象，默认是828像素宽，你可以通过设置photoWidth属性的值来改变它\n- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;\n- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos;\n- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker;\n\n/// 如果用户选择了某张照片下面的代理方法会被执行\n/// 如果isSelectOriginalPhoto为YES，表明用户选择了原图\n/// 你可以通过一个asset获得原图，通过这个方法：[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]\n- (void)imagePickerController:(TZImagePickerController *)picker didSelectAsset:(PHAsset *)asset photo:(UIImage *)photo isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;\n\n/// 如果用户取消选择了某张照片下面的代理方法会被执行\n/// 如果isSelectOriginalPhoto为YES，表明用户选择了原图\n/// 你可以通过一个asset获得原图，通过这个方法：[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]\n- (void)imagePickerController:(TZImagePickerController *)picker didDeselectAsset:(PHAsset *)asset photo:(UIImage *)photo isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;\n\n// If user picking a video and allowPickingMultipleVideo is NO, this callback will be called.\n// If allowPickingMultipleVideo is YES, will call imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:\n// 如果用户选择了一个视频且allowPickingMultipleVideo是NO，下面的代理方法会被执行\n// 如果allowPickingMultipleVideo是YES，将会调用imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:\n- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(PHAsset *)asset;\n\n// If allowEditVideo is YES and allowPickingMultipleVideo is NO, When user picking a video, this callback will be called.\n// If allowPickingMultipleVideo is YES, video editing is not supported, will call imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:\n// 当allowEditVideo是YES且allowPickingMultipleVideo是NO是，如果用户选择了一个视频，下面的代理方法会被执行\n// 如果allowPickingMultipleVideo是YES，则不支持编辑视频，将会调用imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:\n- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingAndEditingVideo:(UIImage *)coverImage outputPath:(NSString *)outputPath error:(NSString *)errorMsg;\n\n// When saving the edited video to the album fails, this callback will be called.\n// 编辑后的视频自动保存到相册失败时，下面的代理方法会被执行\n- (void)imagePickerController:(TZImagePickerController *)picker didFailToSaveEditedVideoWithError:(NSError *)error;\n\n// If user picking a gif image and allowPickingMultipleVideo is NO, this callback will be called.\n// If allowPickingMultipleVideo is YES, will call imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:\n// 如果用户选择了一个gif图片且allowPickingMultipleVideo是NO，下面的代理方法会被执行\n// 如果allowPickingMultipleVideo是YES，将会调用imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:\n- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingGifImage:(UIImage *)animatedImage sourceAssets:(PHAsset *)asset;\n\n// Decide album show or not't\n// 决定相册显示与否 albumName:相册名字 result:相册原始数据\n- (BOOL)isAlbumCanSelect:(NSString *)albumName result:(PHFetchResult *)result;\n\n// Decide asset show or not't\n// 决定照片显示与否\n- (BOOL)isAssetCanSelect:(PHAsset *)asset __attribute__((deprecated(\"Use -isAssetCanBeDisplayed:.\")));\n- (BOOL)isAssetCanBeDisplayed:(PHAsset *)asset;\n\n// Decide asset can be selected\n// 决定照片能否被选中\n- (BOOL)isAssetCanBeSelected:(PHAsset *)asset;\n@end\n\n\n@interface TZAlbumPickerController : UIViewController\n@property (nonatomic, assign) NSInteger columnNumber;\n@property (assign, nonatomic) BOOL isFirstAppear;\n- (void)configTableView;\n@end\n\n\n@interface UIImage (MyBundle)\n+ (UIImage *)tz_imageNamedFromMyBundle:(NSString *)name;\n@end\n\n\n@interface TZCommonTools : NSObject\n+ (UIEdgeInsets)tz_safeAreaInsets;\n+ (BOOL)tz_isIPhoneX;\n+ (BOOL)tz_isLandscape;\n+ (CGFloat)tz_statusBarHeight;\n// 获得Info.plist数据字典\n+ (NSDictionary *)tz_getInfoDictionary;\n+ (NSString *)tz_getAppName;\n+ (BOOL)tz_isRightToLeftLayout;\n+ (void)configBarButtonItem:(UIBarButtonItem *)item tzImagePickerVc:(TZImagePickerController *)tzImagePickerVc;\n+ (BOOL)isICloudSyncError:(NSError *)error;\n+ (BOOL)isAssetNotSelectable:(TZAssetModel *)model tzImagePickerVc:(TZImagePickerController *)tzImagePickerVc;\n@end\n\n\n@interface TZImagePickerConfig : NSObject\n+ (instancetype)sharedInstance;\n@property (copy, nonatomic) NSString *preferredLanguage;\n@property(nonatomic, assign) BOOL allowPickingImage;\n@property (nonatomic, assign) BOOL allowPickingVideo;\n@property (strong, nonatomic) NSBundle *languageBundle;\n@property (assign, nonatomic) BOOL showSelectedIndex;\n@property (assign, nonatomic) BOOL showPhotoCannotSelectLayer;\n@property (assign, nonatomic) BOOL notScaleImage;\n@property (assign, nonatomic) BOOL needFixComposition;\n\n/// 默认是50，如果一个GIF过大，里面图片个数可能超过1000，会导致内存飙升而崩溃\n@property (assign, nonatomic) NSInteger gifPreviewMaxImagesCount;\n/// 【自定义GIF播放方案】为了避免内存过大，内部默认限制只播放50帧（平均取），可通过gifPreviewMaxImagesCount属性调整，若对GIF预览有更好的效果要求，可实现这个block采用FLAnimatedImage等三方库来播放，但注意FLAnimatedImage有播放速度较慢问题，自行取舍下。\n@property (nonatomic, copy) void (^gifImagePlayBlock)(TZPhotoPreviewView *view, UIImageView *imageView, NSData *gifData, NSDictionary *info);\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.m",
    "content": "//\n//  TZImagePickerController.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//  version 3.8.1 - 2022.04.15\n//  更多信息，请前往项目的github地址：https://github.com/banchichen/TZImagePickerController\n\n#import \"TZImagePickerController.h\"\n#import \"TZPhotoPickerController.h\"\n#import \"TZPhotoPreviewController.h\"\n#import \"TZAssetModel.h\"\n#import \"TZAssetCell.h\"\n#import \"UIView+TZLayout.h\"\n#import \"TZImageManager.h\"\n#import \"TZVideoCropController.h\"\n\n@interface TZImagePickerController () {\n    NSTimer *_timer;\n    UILabel *_tipLabel;\n    UIButton *_settingBtn;\n    BOOL _pushPhotoPickerVc;\n    BOOL _didPushPhotoPickerVc;\n    CGRect _cropRect;\n    \n    UIButton *_progressHUD;\n    UIView *_HUDContainer;\n    UIActivityIndicatorView *_HUDIndicatorView;\n    UILabel *_HUDLabel;\n    \n    UIStatusBarStyle _originStatusBarStyle;\n}\n/// Default is 4, Use in photos collectionView in TZPhotoPickerController\n/// 默认4列, TZPhotoPickerController中的照片collectionView\n@property (nonatomic, assign) NSInteger columnNumber;\n@property (nonatomic, assign) NSInteger HUDTimeoutCount; ///< 超时隐藏HUD计数\n@end\n\n@implementation TZImagePickerController\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        self = [self initWithMaxImagesCount:9 delegate:nil];\n    }\n    return self;\n}\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.needShowStatusBar = ![UIApplication sharedApplication].statusBarHidden;\n    if (@available(iOS 13.0, *)) {\n        self.view.backgroundColor = UIColor.tertiarySystemBackgroundColor;\n    } else {\n        self.view.backgroundColor = [UIColor whiteColor];\n    }\n    self.navigationBar.barStyle = UIBarStyleBlack;\n    self.navigationBar.translucent = YES;\n    [TZImageManager manager].shouldFixOrientation = NO;\n\n    // Default appearance, you can reset these after this method\n    // 默认的外观，你可以在这个方法后重置\n    self.oKButtonTitleColorNormal   = [UIColor colorWithRed:(83/255.0) green:(179/255.0) blue:(17/255.0) alpha:1.0];\n    self.oKButtonTitleColorDisabled = [UIColor colorWithRed:(83/255.0) green:(179/255.0) blue:(17/255.0) alpha:0.5];\n    \n    self.navigationBar.barTintColor = [UIColor colorWithRed:(34/255.0) green:(34/255.0)  blue:(34/255.0) alpha:1.0];\n    self.navigationBar.tintColor = [UIColor whiteColor];\n    self.automaticallyAdjustsScrollViewInsets = NO;\n    if (self.needShowStatusBar) [UIApplication sharedApplication].statusBarHidden = NO;\n}\n\n- (void)setNaviBgColor:(UIColor *)naviBgColor {\n    _naviBgColor = naviBgColor;\n    self.navigationBar.barTintColor = naviBgColor;\n    [self configNavigationBarAppearance];\n}\n\n- (void)setNaviTitleColor:(UIColor *)naviTitleColor {\n    _naviTitleColor = naviTitleColor;\n    [self configNaviTitleAppearance];\n}\n\n- (void)setNaviTitleFont:(UIFont *)naviTitleFont {\n    _naviTitleFont = naviTitleFont;\n    [self configNaviTitleAppearance];\n}\n\n- (void)configNaviTitleAppearance {\n    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];\n    if (self.naviTitleColor) {\n        textAttrs[NSForegroundColorAttributeName] = self.naviTitleColor;\n    }\n    if (self.naviTitleFont) {\n        textAttrs[NSFontAttributeName] = self.naviTitleFont;\n    }\n    self.navigationBar.titleTextAttributes = textAttrs;\n    [self configNavigationBarAppearance];\n}\n\n- (void)configNavigationBarAppearance {\n    if (@available(iOS 13.0, *)) {\n        UINavigationBarAppearance *barAppearance = [[UINavigationBarAppearance alloc] init];\n        if (self.navigationBar.isTranslucent) {\n            UIColor *barTintColor = self.navigationBar.barTintColor;\n            barAppearance.backgroundColor = [barTintColor colorWithAlphaComponent:0.85];\n        } else {\n            barAppearance.backgroundColor = self.navigationBar.barTintColor;\n        }\n        barAppearance.titleTextAttributes = self.navigationBar.titleTextAttributes;\n        self.navigationBar.standardAppearance = barAppearance;\n        self.navigationBar.scrollEdgeAppearance = barAppearance;\n    }\n}\n\n- (void)setBarItemTextFont:(UIFont *)barItemTextFont {\n    _barItemTextFont = barItemTextFont;\n    [self configBarButtonItemAppearance];\n}\n\n- (void)setBarItemTextColor:(UIColor *)barItemTextColor {\n    _barItemTextColor = barItemTextColor;\n    [self configBarButtonItemAppearance];\n}\n\n- (void)setIsStatusBarDefault:(BOOL)isStatusBarDefault {\n    _isStatusBarDefault = isStatusBarDefault;\n    \n    if (isStatusBarDefault) {\n        self.statusBarStyle = UIStatusBarStyleDefault;\n    } else {\n        self.statusBarStyle = UIStatusBarStyleLightContent;\n    }\n}\n\n- (void)configBarButtonItemAppearance {\n    UIBarButtonItem *barItem;\n    if (@available(iOS 9, *)) {\n        barItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]];\n    } else {\n        barItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil];\n    }\n    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];\n    textAttrs[NSForegroundColorAttributeName] = self.barItemTextColor;\n    textAttrs[NSFontAttributeName] = self.barItemTextFont;\n    [barItem setTitleTextAttributes:textAttrs forState:UIControlStateNormal];\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    _originStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;\n    [UIApplication sharedApplication].statusBarStyle = self.statusBarStyle;\n    [self configNavigationBarAppearance];\n}\n\n- (void)viewWillDisappear:(BOOL)animated {\n    [super viewWillDisappear:animated];\n    [UIApplication sharedApplication].statusBarStyle = _originStatusBarStyle;\n    [self hideProgressHUD];\n}\n\n- (UIStatusBarStyle)preferredStatusBarStyle {\n    return self.statusBarStyle;\n}\n\n- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<TZImagePickerControllerDelegate>)delegate {\n    return [self initWithMaxImagesCount:maxImagesCount columnNumber:4 delegate:delegate pushPhotoPickerVc:YES];\n}\n\n- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate {\n    return [self initWithMaxImagesCount:maxImagesCount columnNumber:columnNumber delegate:delegate pushPhotoPickerVc:YES];\n}\n\n- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc {\n    _pushPhotoPickerVc = pushPhotoPickerVc;\n    TZAlbumPickerController *albumPickerVc = [[TZAlbumPickerController alloc] init];\n    albumPickerVc.isFirstAppear = YES;\n    albumPickerVc.columnNumber = columnNumber;\n    self = [super initWithRootViewController:albumPickerVc];\n    if (self) {\n        self.maxImagesCount = maxImagesCount > 0 ? maxImagesCount : 9; // Default is 9 / 默认最大可选9张图片\n        self.pickerDelegate = delegate;\n        self.selectedAssets = [NSMutableArray array];\n        \n        // Allow user picking original photo and video, you also can set No after this method\n        // 默认准许用户选择原图和视频, 你也可以在这个方法后置为NO\n        self.allowPickingOriginalPhoto = YES;\n        self.allowPickingVideo = YES;\n        self.allowPickingImage = YES;\n        self.allowTakePicture = YES;\n        self.allowTakeVideo = YES;\n        self.videoMaximumDuration = 10 * 60;\n        self.sortAscendingByModificationDate = YES;\n        self.autoDismiss = YES;\n        self.columnNumber = columnNumber;\n        [self configDefaultSetting];\n        \n        if (![[TZImageManager manager] authorizationStatusAuthorized]) {\n            _tipLabel = [[UILabel alloc] init];\n            _tipLabel.frame = CGRectMake(8, 120, self.view.tz_width - 16, 60);\n            _tipLabel.textAlignment = NSTextAlignmentCenter;\n            _tipLabel.numberOfLines = 0;\n            _tipLabel.font = [UIFont systemFontOfSize:16];\n            _tipLabel.textColor = [UIColor blackColor];\n            _tipLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;\n\n            NSString *appName = [TZCommonTools tz_getAppName];\n            NSString *tipText = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Allow %@ to access your album in \\\"Settings -> Privacy -> Photos\\\"\"],appName];\n            _tipLabel.text = tipText;\n            [self.view addSubview:_tipLabel];\n            \n            _settingBtn = [UIButton buttonWithType:UIButtonTypeSystem];\n            [_settingBtn setTitle:self.settingBtnTitleStr forState:UIControlStateNormal];\n            _settingBtn.frame = CGRectMake(0, 180, self.view.tz_width, 44);\n            _settingBtn.titleLabel.font = [UIFont systemFontOfSize:18];\n            [_settingBtn addTarget:self action:@selector(settingBtnClick) forControlEvents:UIControlEventTouchUpInside];\n            _settingBtn.autoresizingMask = UIViewAutoresizingFlexibleWidth;\n\n            [self.view addSubview:_settingBtn];\n            \n            if ([PHPhotoLibrary authorizationStatus] == 0) {\n                _timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(observeAuthrizationStatusChange) userInfo:nil repeats:NO];\n            }\n        } else {\n            [self pushPhotoPickerVc];\n        }\n    }\n    return self;\n}\n\n/// This init method just for previewing photos / 用这个初始化方法以预览图片\n- (instancetype)initWithSelectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index{\n    TZPhotoPreviewController *previewVc = [[TZPhotoPreviewController alloc] init];\n    self = [super initWithRootViewController:previewVc];\n    if (self) {\n        self.selectedAssets = [NSMutableArray arrayWithArray:selectedAssets];\n        self.allowPickingOriginalPhoto = self.allowPickingOriginalPhoto;\n        [self configDefaultSetting];\n        \n        previewVc.photos = [NSMutableArray arrayWithArray:selectedPhotos];\n        previewVc.currentIndex = index;\n        __weak typeof(self) weakSelf = self;\n        [previewVc setDoneButtonClickBlockWithPreviewType:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {\n            __strong typeof(weakSelf) strongSelf = weakSelf;\n            if (!strongSelf.autoDismiss) {\n                if (strongSelf.didFinishPickingPhotosHandle) {\n                    strongSelf.didFinishPickingPhotosHandle(photos,assets,isSelectOriginalPhoto);\n                }\n                return;\n            }\n            [strongSelf dismissViewControllerAnimated:YES completion:^{\n                if (!strongSelf) return;\n                if (strongSelf.didFinishPickingPhotosHandle) {\n                    strongSelf.didFinishPickingPhotosHandle(photos,assets,isSelectOriginalPhoto);\n                }\n            }];\n        }];\n    }\n    return self;\n}\n\n/// This init method for crop photo / 用这个初始化方法以裁剪图片\n- (instancetype)initCropTypeWithAsset:(PHAsset *)asset photo:(UIImage *)photo completion:(void (^)(UIImage *cropImage,PHAsset *asset))completion {\n    TZPhotoPreviewController *previewVc = [[TZPhotoPreviewController alloc] init];\n    self = [super initWithRootViewController:previewVc];\n    if (self) {\n        self.maxImagesCount = 1;\n        self.allowPickingImage = YES;\n        self.allowCrop = YES;\n        self.selectedAssets = [NSMutableArray arrayWithArray:@[asset]];\n        [self configDefaultSetting];\n        \n        previewVc.photos = [NSMutableArray arrayWithArray:@[photo]];\n        previewVc.isCropImage = YES;\n        previewVc.currentIndex = 0;\n        __weak typeof(self) weakSelf = self;\n        [previewVc setDoneButtonClickBlockCropMode:^(UIImage *cropImage, id asset) {\n            __strong typeof(weakSelf) strongSelf = weakSelf;\n            [strongSelf dismissViewControllerAnimated:YES completion:^{\n                if (completion) {\n                    completion(cropImage,asset);\n                }\n            }];\n        }];\n    }\n    return self;\n}\n\n- (void)configDefaultSetting {\n    self.autoSelectCurrentWhenDone = YES;\n    self.timeout = 30;\n    self.photoWidth = 828.0;\n    self.photoPreviewMaxWidth = 600;\n    self.naviTitleColor = [UIColor whiteColor];\n    self.naviTitleFont = [UIFont systemFontOfSize:17];\n    self.barItemTextFont = [UIFont systemFontOfSize:15];\n    self.barItemTextColor = [UIColor whiteColor];\n    self.allowPreview = YES;\n    // 2.2.26版本，不主动缩放图片，降低内存占用\n    self.notScaleImage = YES;\n    self.needFixComposition = NO;\n    self.statusBarStyle = UIStatusBarStyleLightContent;\n    self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];\n    self.allowCameraLocation = YES;\n    self.presetName = AVAssetExportPresetMediumQuality;\n    self.maxCropVideoDuration = 30;\n    \n    self.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0];\n    [self configDefaultBtnTitle];\n    \n    CGFloat cropViewWH = MIN(self.view.tz_width, self.view.tz_height) / 3 * 2;\n    self.cropRect = CGRectMake((self.view.tz_width - cropViewWH) / 2, (self.view.tz_height - cropViewWH) / 2, cropViewWH, cropViewWH);\n}\n\n- (void)configDefaultImageName {\n    self.takePictureImageName = @\"takePicture80\";\n    self.photoSelImageName = @\"photo_sel_photoPickerVc\";\n    self.photoDefImageName = @\"photo_def_photoPickerVc\";\n    self.photoNumberIconImage = [self createImageWithColor:nil size:CGSizeMake(24, 24) radius:12]; // @\"photo_number_icon\";\n    self.photoPreviewOriginDefImageName = @\"preview_original_def\";\n    self.photoOriginDefImageName = @\"photo_original_def\";\n    self.photoOriginSelImageName = @\"photo_original_sel\";\n    self.addMorePhotoImage = [UIImage tz_imageNamedFromMyBundle:@\"addMore\"];\n}\n\n- (void)setTakePictureImageName:(NSString *)takePictureImageName {\n    _takePictureImageName = takePictureImageName;\n    _takePictureImage = [UIImage tz_imageNamedFromMyBundle:takePictureImageName];\n}\n\n- (void)setPhotoSelImageName:(NSString *)photoSelImageName {\n    _photoSelImageName = photoSelImageName;\n    _photoSelImage = [UIImage tz_imageNamedFromMyBundle:photoSelImageName];\n}\n\n- (void)setPhotoDefImageName:(NSString *)photoDefImageName {\n    _photoDefImageName = photoDefImageName;\n    _photoDefImage = [UIImage tz_imageNamedFromMyBundle:photoDefImageName];\n}\n\n- (void)setPhotoNumberIconImageName:(NSString *)photoNumberIconImageName {\n    _photoNumberIconImageName = photoNumberIconImageName;\n    _photoNumberIconImage = [UIImage tz_imageNamedFromMyBundle:photoNumberIconImageName];\n}\n\n- (void)setPhotoPreviewOriginDefImageName:(NSString *)photoPreviewOriginDefImageName {\n    _photoPreviewOriginDefImageName = photoPreviewOriginDefImageName;\n    _photoPreviewOriginDefImage = [UIImage tz_imageNamedFromMyBundle:photoPreviewOriginDefImageName];\n}\n\n- (void)setPhotoOriginDefImageName:(NSString *)photoOriginDefImageName {\n    _photoOriginDefImageName = photoOriginDefImageName;\n    _photoOriginDefImage = [UIImage tz_imageNamedFromMyBundle:photoOriginDefImageName];\n}\n\n- (void)setPhotoOriginSelImageName:(NSString *)photoOriginSelImageName {\n    _photoOriginSelImageName = photoOriginSelImageName;\n    _photoOriginSelImage = [UIImage tz_imageNamedFromMyBundle:photoOriginSelImageName];\n}\n\n- (void)setTakePictureImage:(UIImage *)takePictureImage {\n    _takePictureImage = takePictureImage;\n    _takePictureImageName = @\"\";\n}\n\n- (void)setIconThemeColor:(UIColor *)iconThemeColor {\n    _iconThemeColor = iconThemeColor;\n    [self configDefaultImageName];\n}\n\n- (void)configDefaultBtnTitle {\n    self.doneBtnTitleStr = [NSBundle tz_localizedStringForKey:@\"Done\"];\n    self.cancelBtnTitleStr = [NSBundle tz_localizedStringForKey:@\"Cancel\"];\n    self.previewBtnTitleStr = [NSBundle tz_localizedStringForKey:@\"Preview\"];\n    self.fullImageBtnTitleStr = [NSBundle tz_localizedStringForKey:@\"Full image\"];\n    self.settingBtnTitleStr = [NSBundle tz_localizedStringForKey:@\"Setting\"];\n    self.processHintStr = [NSBundle tz_localizedStringForKey:@\"Processing...\"];\n    self.editBtnTitleStr = [NSBundle tz_localizedStringForKey:@\"Edit\"];\n}\n\n- (void)setShowSelectedIndex:(BOOL)showSelectedIndex {\n    _showSelectedIndex = showSelectedIndex;\n    if (showSelectedIndex) {\n        self.photoSelImage = [self createImageWithColor:nil size:CGSizeMake(24, 24) radius:12];\n    }\n    [TZImagePickerConfig sharedInstance].showSelectedIndex = showSelectedIndex;\n}\n\n- (void)setShowPhotoCannotSelectLayer:(BOOL)showPhotoCannotSelectLayer {\n    _showPhotoCannotSelectLayer = showPhotoCannotSelectLayer;\n    [TZImagePickerConfig sharedInstance].showPhotoCannotSelectLayer = showPhotoCannotSelectLayer;\n}\n\n- (void)setNotScaleImage:(BOOL)notScaleImage {\n    _notScaleImage = notScaleImage;\n    [TZImagePickerConfig sharedInstance].notScaleImage = notScaleImage;\n}\n\n- (void)setNeedFixComposition:(BOOL)needFixComposition {\n    _needFixComposition = needFixComposition;\n    [TZImagePickerConfig sharedInstance].needFixComposition = needFixComposition;\n}\n\n- (void)observeAuthrizationStatusChange {\n    [_timer invalidate];\n    _timer = nil;\n    if ([PHPhotoLibrary authorizationStatus] == 0) {\n        _timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(observeAuthrizationStatusChange) userInfo:nil repeats:NO];\n    }\n    \n    if ([[TZImageManager manager] authorizationStatusAuthorized]) {\n        [_tipLabel removeFromSuperview];\n        [_settingBtn removeFromSuperview];\n\n        [self pushPhotoPickerVc];\n        \n        TZAlbumPickerController *albumPickerVc = (TZAlbumPickerController *)self.visibleViewController;\n        if ([albumPickerVc isKindOfClass:[TZAlbumPickerController class]]) {\n            [albumPickerVc configTableView];\n        }\n    }\n}\n\n- (void)pushPhotoPickerVc {\n    _didPushPhotoPickerVc = NO;\n    // 1.6.8 判断是否需要push到照片选择页，如果_pushPhotoPickerVc为NO,则不push\n    if (!_didPushPhotoPickerVc && _pushPhotoPickerVc) {\n        TZPhotoPickerController *photoPickerVc = [[TZPhotoPickerController alloc] init];\n        photoPickerVc.isFirstAppear = YES;\n        photoPickerVc.columnNumber = self.columnNumber;\n        [[TZImageManager manager] getCameraRollAlbumWithFetchAssets:NO completion:^(TZAlbumModel *model) {\n            photoPickerVc.model = model;\n            [self pushViewController:photoPickerVc animated:YES];\n            self->_didPushPhotoPickerVc = YES;\n        }];\n    }\n}\n\n- (UIAlertController *)showAlertWithTitle:(NSString *)title {\n    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];\n    [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle tz_localizedStringForKey:@\"OK\"] style:UIAlertActionStyleDefault handler:nil]];\n    [self presentViewController:alertController animated:YES completion:nil];\n    return alertController;\n}\n\n- (void)showProgressHUD {\n    if (!_progressHUD) {\n        _progressHUD = [UIButton buttonWithType:UIButtonTypeCustom];\n        [_progressHUD setBackgroundColor:[UIColor clearColor]];\n        \n        _HUDContainer = [[UIView alloc] init];\n        _HUDContainer.layer.cornerRadius = 8;\n        _HUDContainer.clipsToBounds = YES;\n        _HUDContainer.backgroundColor = [UIColor darkGrayColor];\n        _HUDContainer.alpha = 0.7;\n        \n        _HUDIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];\n        \n        _HUDLabel = [[UILabel alloc] init];\n        _HUDLabel.textAlignment = NSTextAlignmentCenter;\n        _HUDLabel.text = self.processHintStr;\n        _HUDLabel.font = [UIFont systemFontOfSize:15];\n        _HUDLabel.textColor = [UIColor whiteColor];\n        \n        [_HUDContainer addSubview:_HUDLabel];\n        [_HUDContainer addSubview:_HUDIndicatorView];\n        [_progressHUD addSubview:_HUDContainer];\n    }\n    [_HUDIndicatorView startAnimating];\n    UIWindow *applicationWindow;\n    if ([[[UIApplication sharedApplication] delegate] respondsToSelector:@selector(window)]) {\n        applicationWindow = [[[UIApplication sharedApplication] delegate] window];\n    } else {\n        applicationWindow = [[UIApplication sharedApplication] keyWindow];\n    }\n    [applicationWindow addSubview:_progressHUD];\n    [self.view setNeedsLayout];\n    \n    // if over time, dismiss HUD automatic\n    self.HUDTimeoutCount++;\n    __weak typeof(self) weakSelf = self;\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.timeout * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        strongSelf.HUDTimeoutCount--;\n        if (strongSelf.HUDTimeoutCount <= 0) {\n            strongSelf.HUDTimeoutCount = 0;\n            [strongSelf hideProgressHUD];\n        }\n    });\n}\n\n- (void)hideProgressHUD {\n    if (_progressHUD) {\n        [_HUDIndicatorView stopAnimating];\n        [_progressHUD removeFromSuperview];\n    }\n}\n\n- (void)setMaxImagesCount:(NSInteger)maxImagesCount {\n    _maxImagesCount = maxImagesCount;\n    if (maxImagesCount > 1) {\n        _showSelectBtn = YES;\n        _allowCrop = NO;\n    }\n}\n\n- (void)setShowSelectBtn:(BOOL)showSelectBtn {\n    _showSelectBtn = showSelectBtn;\n    // 多选模式下，不允许让showSelectBtn为NO\n    if (!showSelectBtn && _maxImagesCount > 1) {\n        _showSelectBtn = YES;\n    }\n}\n\n- (void)setAllowCrop:(BOOL)allowCrop {\n    _allowCrop = _maxImagesCount > 1 ? NO : allowCrop;\n    if (allowCrop) { // 允许裁剪的时候，不能选原图和GIF\n        self.allowPickingOriginalPhoto = NO;\n        self.allowPickingGif = NO;\n    }\n}\n\n- (void)setCircleCropRadius:(NSInteger)circleCropRadius {\n    _circleCropRadius = circleCropRadius;\n    self.cropRect = CGRectMake(self.view.tz_width / 2 - circleCropRadius, self.view.tz_height / 2 - _circleCropRadius, _circleCropRadius * 2, _circleCropRadius * 2);\n}\n\n- (void)setCropRect:(CGRect)cropRect {\n    _cropRect = cropRect;\n    if ([TZCommonTools tz_isLandscape]) {\n        _cropRectLandscape = cropRect;\n        CGFloat widthHeight = cropRect.size.height;\n        _cropRectPortrait = CGRectMake(cropRect.origin.y, (self.view.tz_width - widthHeight) / 2, widthHeight, widthHeight);\n    } else {\n        _cropRectPortrait = cropRect;\n        CGFloat widthHeight = cropRect.size.width;\n        _cropRectLandscape = CGRectMake((self.view.tz_height - widthHeight) / 2, cropRect.origin.x, widthHeight, widthHeight);\n    }\n}\n\n- (CGRect)cropRect {\n    CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;\n    BOOL isFullScreen = self.view.tz_height == screenHeight;\n    if (isFullScreen) {\n        return _cropRect;\n    } else {\n        CGRect newCropRect = _cropRect;\n        newCropRect.origin.y -= ((screenHeight - self.view.tz_height) / 2);\n        return newCropRect;\n    }\n}\n\n- (void)setTimeout:(NSInteger)timeout {\n    _timeout = timeout;\n    if (timeout < 5) {\n        _timeout = 5;\n    } else if (_timeout > 600) {\n        _timeout = 600;\n    }\n}\n\n- (void)setPickerDelegate:(id<TZImagePickerControllerDelegate>)pickerDelegate {\n    _pickerDelegate = pickerDelegate;\n    [TZImageManager manager].pickerDelegate = pickerDelegate;\n}\n\n- (void)setColumnNumber:(NSInteger)columnNumber {\n    _columnNumber = columnNumber;\n    if (columnNumber <= 2) {\n        _columnNumber = 2;\n    } else if (columnNumber >= 6) {\n        _columnNumber = 6;\n    }\n    \n    TZAlbumPickerController *albumPickerVc = [self.childViewControllers firstObject];\n    albumPickerVc.columnNumber = _columnNumber;\n    [TZImageManager manager].columnNumber = _columnNumber;\n}\n\n- (void)setMinPhotoWidthSelectable:(NSInteger)minPhotoWidthSelectable {\n    _minPhotoWidthSelectable = minPhotoWidthSelectable;\n    [TZImageManager manager].minPhotoWidthSelectable = minPhotoWidthSelectable;\n}\n\n- (void)setMinPhotoHeightSelectable:(NSInteger)minPhotoHeightSelectable {\n    _minPhotoHeightSelectable = minPhotoHeightSelectable;\n    [TZImageManager manager].minPhotoHeightSelectable = minPhotoHeightSelectable;\n}\n\n- (void)setHideWhenCanNotSelect:(BOOL)hideWhenCanNotSelect {\n    _hideWhenCanNotSelect = hideWhenCanNotSelect;\n    [TZImageManager manager].hideWhenCanNotSelect = hideWhenCanNotSelect;\n}\n\n- (void)setPhotoPreviewMaxWidth:(CGFloat)photoPreviewMaxWidth {\n    _photoPreviewMaxWidth = photoPreviewMaxWidth;\n    if (photoPreviewMaxWidth > 800) {\n        _photoPreviewMaxWidth = 800;\n    } else if (photoPreviewMaxWidth < 500) {\n        _photoPreviewMaxWidth = 500;\n    }\n    [TZImageManager manager].photoPreviewMaxWidth = _photoPreviewMaxWidth;\n}\n\n- (void)setPhotoWidth:(CGFloat)photoWidth {\n    _photoWidth = photoWidth;\n    [TZImageManager manager].photoWidth = photoWidth;\n}\n\n- (void)setSelectedAssets:(NSMutableArray *)selectedAssets {\n    _selectedAssets = selectedAssets;\n    _selectedModels = [NSMutableArray array];\n    _selectedAssetIds = [NSMutableArray array];\n    for (PHAsset *asset in selectedAssets) {\n        TZAssetModel *model = [TZAssetModel modelWithAsset:asset type:[[TZImageManager manager] getAssetType:asset]];\n        model.isSelected = YES;\n        [self addSelectedModel:model];\n    }\n}\n\n- (void)setAllowPickingImage:(BOOL)allowPickingImage {\n    _allowPickingImage = allowPickingImage;\n    [TZImagePickerConfig sharedInstance].allowPickingImage = allowPickingImage;\n    if (!allowPickingImage) {\n        _allowTakePicture = NO;\n    }\n}\n\n- (void)setAllowPickingVideo:(BOOL)allowPickingVideo {\n    _allowPickingVideo = allowPickingVideo;\n    [TZImagePickerConfig sharedInstance].allowPickingVideo = allowPickingVideo;\n    if (!allowPickingVideo) {\n        _allowTakeVideo = NO;\n    }\n}\n\n- (void)setPreferredLanguage:(NSString *)preferredLanguage {\n    _preferredLanguage = preferredLanguage;\n    [TZImagePickerConfig sharedInstance].preferredLanguage = preferredLanguage;\n    [self configDefaultBtnTitle];\n}\n\n- (void)setLanguageBundle:(NSBundle *)languageBundle {\n    _languageBundle = languageBundle;\n    [TZImagePickerConfig sharedInstance].languageBundle = languageBundle;\n    [self configDefaultBtnTitle];\n}\n\n- (void)setSortAscendingByModificationDate:(BOOL)sortAscendingByModificationDate {\n    _sortAscendingByModificationDate = sortAscendingByModificationDate;\n    [TZImageManager manager].sortAscendingByModificationDate = sortAscendingByModificationDate;\n}\n\n- (void)settingBtnClick {\n    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];\n}\n\n- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {\n    viewController.automaticallyAdjustsScrollViewInsets = NO;\n    [super pushViewController:viewController animated:animated];\n}\n\n- (void)dealloc {\n    // NSLog(@\"%@ dealloc\",NSStringFromClass(self.class));\n}\n\n- (void)addSelectedModel:(TZAssetModel *)model {\n    [_selectedModels addObject:model];\n    [_selectedAssetIds addObject:model.asset.localIdentifier];\n}\n\n- (void)removeSelectedModel:(TZAssetModel *)model {\n    [_selectedModels removeObject:model];\n    [_selectedAssetIds removeObject:model.asset.localIdentifier];\n}\n\n- (UIImage *)createImageWithColor:(UIColor *)color size:(CGSize)size radius:(CGFloat)radius {\n    if (!color) {\n        color = self.iconThemeColor;\n    }\n    CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height);\n    UIGraphicsBeginImageContextWithOptions(rect.size, NO, [UIScreen mainScreen].scale);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    CGContextSetFillColorWithColor(context, [color CGColor]);\n    UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:radius];\n    CGContextAddPath(context, path.CGPath);\n    CGContextFillPath(context);\n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\n#pragma mark - UIContentContainer\n\n- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        if (![UIApplication sharedApplication].statusBarHidden) {\n            if (self.needShowStatusBar) [UIApplication sharedApplication].statusBarHidden = NO;\n        }\n    });\n    if (size.width > size.height) {\n        _cropRect = _cropRectLandscape;\n    } else {\n        _cropRect = _cropRectPortrait;\n    }\n}\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n    \n    CGFloat progressHUDY = CGRectGetMaxY(self.navigationBar.frame);\n    _progressHUD.frame = CGRectMake(0, progressHUDY, self.view.tz_width, self.view.tz_height - progressHUDY);\n    _HUDContainer.frame = CGRectMake((self.view.tz_width - 120) / 2, (_progressHUD.tz_height - 90 - progressHUDY) / 2, 120, 90);\n    _HUDIndicatorView.frame = CGRectMake(45, 15, 30, 30);\n    _HUDLabel.frame = CGRectMake(0,40, 120, 50);\n}\n\n#pragma mark - Public\n\n- (void)cancelButtonClick {\n    if (self.autoDismiss) {\n        [self dismissViewControllerAnimated:YES completion:^{\n            [self callDelegateMethod];\n        }];\n    } else {\n        [self callDelegateMethod];\n    }\n}\n\n- (void)callDelegateMethod {\n    if ([self.pickerDelegate respondsToSelector:@selector(tz_imagePickerControllerDidCancel:)]) {\n        [self.pickerDelegate tz_imagePickerControllerDidCancel:self];\n    }\n    if (self.imagePickerControllerDidCancelHandle) {\n        self.imagePickerControllerDidCancelHandle();\n    }\n}\n\n- (UIInterfaceOrientationMask)supportedInterfaceOrientations {\n    if ([self.topViewController isKindOfClass:TZVideoPlayerController.class] && self.topViewController.presentedViewController) {\n        return UIInterfaceOrientationMaskPortrait;\n    }\n    return UIInterfaceOrientationMaskAll;\n}\n\n@end\n\n\n@interface TZAlbumPickerController ()<UITableViewDataSource, UITableViewDelegate, PHPhotoLibraryChangeObserver> {\n    UITableView *_tableView;\n}\n@property (nonatomic, strong) NSMutableArray *albumArr;\n@end\n\n@implementation TZAlbumPickerController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    if ([[TZImageManager manager] authorizationStatusAuthorized] || !SYSTEM_VERSION_GREATER_THAN_15) {\n        [[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];\n    }\n    self.isFirstAppear = YES;\n    if (@available(iOS 13.0, *)) {\n        self.view.backgroundColor = UIColor.tertiarySystemBackgroundColor;\n    } else {\n        self.view.backgroundColor = [UIColor whiteColor];\n    }\n    \n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithTitle:imagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:imagePickerVc action:@selector(cancelButtonClick)];\n    [TZCommonTools configBarButtonItem:cancelItem tzImagePickerVc:imagePickerVc];\n    self.navigationItem.rightBarButtonItem = cancelItem;\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    [imagePickerVc hideProgressHUD];\n    if (imagePickerVc.allowPickingImage) {\n        self.navigationItem.title = [NSBundle tz_localizedStringForKey:@\"Photos\"];\n    } else if (imagePickerVc.allowPickingVideo) {\n        self.navigationItem.title = [NSBundle tz_localizedStringForKey:@\"Videos\"];\n    }\n    \n    if (self.isFirstAppear && !imagePickerVc.navLeftBarButtonSettingBlock) {\n        self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@\"Back\"] style:UIBarButtonItemStylePlain target:nil action:nil];\n    }\n    \n    [self configTableView];\n}\n\n- (void)configTableView {\n    if (![[TZImageManager manager] authorizationStatusAuthorized]) {\n        return;\n    }\n\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (self.isFirstAppear) {\n        [imagePickerVc showProgressHUD];\n    }\n\n    dispatch_async(dispatch_get_global_queue(0, 0), ^{\n        [[TZImageManager manager] getAllAlbumsWithFetchAssets:!self.isFirstAppear completion:^(NSArray<TZAlbumModel *> *models) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                self->_albumArr = [NSMutableArray arrayWithArray:models];\n                for (TZAlbumModel *albumModel in self->_albumArr) {\n                    albumModel.selectedModels = imagePickerVc.selectedModels;\n                }\n                [imagePickerVc hideProgressHUD];\n                \n                if (self.isFirstAppear) {\n                    self.isFirstAppear = NO;\n                    [self configTableView];\n                }\n                \n                if (!self->_tableView) {\n                    self->_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];\n                    self->_tableView.rowHeight = 70;\n                    if (@available(iOS 13.0, *)) {\n                        self->_tableView.backgroundColor = [UIColor tertiarySystemBackgroundColor];\n                    } else {\n                        self->_tableView.backgroundColor = [UIColor whiteColor];\n                    }\n                    self->_tableView.tableFooterView = [[UIView alloc] init];\n                    self->_tableView.dataSource = self;\n                    self->_tableView.delegate = self;\n                    [self->_tableView registerClass:[TZAlbumCell class] forCellReuseIdentifier:@\"TZAlbumCell\"];\n                    [self.view addSubview:self->_tableView];\n                    if (imagePickerVc.albumPickerPageUIConfigBlock) {\n                        imagePickerVc.albumPickerPageUIConfigBlock(self->_tableView);\n                    }\n                } else {\n                    [self->_tableView reloadData];\n                }\n            });\n        }];\n    });\n}\n\n- (void)dealloc {\n    [[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];\n    // NSLog(@\"%@ dealloc\",NSStringFromClass(self.class));\n}\n\n- (UIStatusBarStyle)preferredStatusBarStyle {\n    TZImagePickerController *tzImagePicker = (TZImagePickerController *)self.navigationController;\n    if (tzImagePicker && [tzImagePicker isKindOfClass:[TZImagePickerController class]]) {\n        return tzImagePicker.statusBarStyle;\n    }\n    return [super preferredStatusBarStyle];\n}\n\n#pragma mark - PHPhotoLibraryChangeObserver\n\n- (void)photoLibraryDidChange:(PHChange *)changeInstance {\n    dispatch_async(dispatch_get_main_queue(), ^{\n        [self configTableView];\n    });\n}\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n    \n    CGFloat top = 0;\n    CGFloat tableViewHeight = 0;\n    CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height;\n    BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;\n    BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;\n    if (self.navigationController.navigationBar.isTranslucent) {\n        top = naviBarHeight;\n        if (!isStatusBarHidden && isFullScreen) top += [TZCommonTools tz_statusBarHeight];\n        tableViewHeight = self.view.tz_height - top;\n    } else {\n        tableViewHeight = self.view.tz_height;\n    }\n    _tableView.frame = CGRectMake(0, top, self.view.tz_width, tableViewHeight);\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (imagePickerVc.albumPickerPageDidLayoutSubviewsBlock) {\n        imagePickerVc.albumPickerPageDidLayoutSubviewsBlock(_tableView);\n    }\n}\n\n#pragma mark - UITableViewDataSource && Delegate\n\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {\n    return _albumArr.count;\n}\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n    TZAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@\"TZAlbumCell\"];\n    if (@available(iOS 13.0, *)) {\n        cell.backgroundColor = UIColor.tertiarySystemBackgroundColor;\n    }\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    cell.albumCellDidLayoutSubviewsBlock = imagePickerVc.albumCellDidLayoutSubviewsBlock;\n    cell.albumCellDidSetModelBlock = imagePickerVc.albumCellDidSetModelBlock;\n    cell.selectedCountButton.backgroundColor = imagePickerVc.iconThemeColor;\n    cell.model = _albumArr[indexPath.row];\n    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;\n    return cell;\n}\n\n- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {\n    TZPhotoPickerController *photoPickerVc = [[TZPhotoPickerController alloc] init];\n    photoPickerVc.columnNumber = self.columnNumber;\n    TZAlbumModel *model = _albumArr[indexPath.row];\n    photoPickerVc.model = model;\n    [self.navigationController pushViewController:photoPickerVc animated:YES];\n    [tableView deselectRowAtIndexPath:indexPath animated:NO];\n}\n\n#pragma clang diagnostic pop\n\n@end\n\n\n@implementation UIImage (MyBundle)\n\n+ (UIImage *)tz_imageNamedFromMyBundle:(NSString *)name {\n    NSBundle *imageBundle = [NSBundle tz_imagePickerBundle];\n    name = [name stringByAppendingString:@\"@2x\"];\n    NSString *imagePath = [imageBundle pathForResource:name ofType:@\"png\"];\n    UIImage *image = [UIImage imageWithContentsOfFile:imagePath];\n    if (!image) {\n        // 兼容业务方自己设置图片的方式\n        name = [name stringByReplacingOccurrencesOfString:@\"@2x\" withString:@\"\"];\n        image = [UIImage imageNamed:name];\n    }\n    return image;\n}\n\n@end\n\n\n@implementation TZCommonTools\n\n+ (UIEdgeInsets)tz_safeAreaInsets {\n    UIWindow *window = [UIApplication sharedApplication].windows.firstObject;\n    if (![window isKeyWindow]) {\n        UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;\n        if (CGRectEqualToRect(keyWindow.bounds, [UIScreen mainScreen].bounds)) {\n            window = keyWindow;\n        }\n    }\n    if (@available(iOS 11.0, *)) {\n        UIEdgeInsets insets = [window safeAreaInsets];\n        return insets;\n    }\n    return UIEdgeInsetsZero;\n}\n\n+ (BOOL)tz_isIPhoneX {\n    if ([UIWindow instancesRespondToSelector:@selector(safeAreaInsets)]) {\n        return [self tz_safeAreaInsets].bottom > 0;\n    }\n    return (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) ||\n            CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(812, 375)) ||\n            CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 896)) ||\n            CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(896, 414)) ||\n            CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(390, 844)) ||\n            CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(844, 390)) ||\n            CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(428, 926)) ||\n            CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(926, 428)));\n}\n\n+ (BOOL)tz_isLandscape {\n    if ([UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeRight ||\n        [UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeLeft) {\n        return true;\n    }\n    return false;\n}\n\n+ (CGFloat)tz_statusBarHeight {\n    if ([UIWindow instancesRespondToSelector:@selector(safeAreaInsets)]) {\n        return [self tz_safeAreaInsets].top ?: 20;\n    }\n    return 20;\n}\n\n// 获得Info.plist数据字典\n+ (NSDictionary *)tz_getInfoDictionary {\n    NSDictionary *infoDict = [NSBundle mainBundle].localizedInfoDictionary;\n    if (!infoDict || !infoDict.count) {\n        infoDict = [NSBundle mainBundle].infoDictionary;\n    }\n    if (!infoDict || !infoDict.count) {\n        NSString *path = [[NSBundle mainBundle] pathForResource:@\"Info\" ofType:@\"plist\"];\n        infoDict = [NSDictionary dictionaryWithContentsOfFile:path];\n    }\n    return infoDict ? infoDict : @{};\n}\n\n+ (NSString *)tz_getAppName {\n    NSDictionary *infoDict = [self tz_getInfoDictionary];\n    NSString *appName = [infoDict valueForKey:@\"CFBundleDisplayName\"];\n    if (!appName) appName = [infoDict valueForKey:@\"CFBundleName\"];\n    if (!appName) appName = [infoDict valueForKey:@\"CFBundleExecutable\"];\n    if (!appName) {\n        infoDict = [NSBundle mainBundle].infoDictionary;\n        appName = [infoDict valueForKey:@\"CFBundleDisplayName\"];\n        if (!appName) appName = [infoDict valueForKey:@\"CFBundleName\"];\n        if (!appName) appName = [infoDict valueForKey:@\"CFBundleExecutable\"];\n    }\n    return appName;\n}\n\n+ (BOOL)tz_isRightToLeftLayout {\n    if (@available(iOS 9.0, *)) {\n        if ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:UISemanticContentAttributeUnspecified] == UIUserInterfaceLayoutDirectionRightToLeft) {\n            return YES;\n        }\n    } else {\n        NSString *preferredLanguage = [NSLocale preferredLanguages].firstObject;\n        if ([preferredLanguage hasPrefix:@\"ar-\"]) {\n            return YES;\n        }\n    }\n    return NO;\n}\n\n+ (void)configBarButtonItem:(UIBarButtonItem *)item tzImagePickerVc:(TZImagePickerController *)tzImagePickerVc {\n    item.tintColor = tzImagePickerVc.barItemTextColor;\n    NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];\n    textAttrs[NSForegroundColorAttributeName] = tzImagePickerVc.barItemTextColor;\n    textAttrs[NSFontAttributeName] = tzImagePickerVc.barItemTextFont;\n    [item setTitleTextAttributes:textAttrs forState:UIControlStateNormal];\n    \n    NSMutableDictionary *textAttrsHighlighted = [NSMutableDictionary dictionary];\n    textAttrsHighlighted[NSFontAttributeName] = tzImagePickerVc.barItemTextFont;\n    [item setTitleTextAttributes:textAttrsHighlighted forState:UIControlStateHighlighted];\n}\n\n+ (BOOL)isICloudSyncError:(NSError *)error {\n    if (!error) return NO;\n    if ([error.domain isEqualToString:@\"CKErrorDomain\"] || [error.domain isEqualToString:@\"CloudPhotoLibraryErrorDomain\"]) {\n        return YES;\n    }\n    return NO;\n}\n\n+ (BOOL)isAssetNotSelectable:(TZAssetModel *)model tzImagePickerVc:(TZImagePickerController *)tzImagePickerVc {\n    BOOL notSelectable = tzImagePickerVc.selectedModels.count >= tzImagePickerVc.maxImagesCount;\n    if (tzImagePickerVc.selectedModels && tzImagePickerVc.selectedModels.count > 0 && !tzImagePickerVc.allowPickingMultipleVideo) {\n        if (model.asset.mediaType == PHAssetMediaTypeVideo) {\n            notSelectable = true;\n        }\n    }\n    return notSelectable;\n}\n\n@end\n\n\n@interface TZImagePickerConfig ()\n@property (strong, nonatomic) NSSet *supportedLanguages;\n@end\n\n@implementation TZImagePickerConfig\n\n+ (instancetype)sharedInstance {\n    static dispatch_once_t onceToken;\n    static TZImagePickerConfig *config = nil;\n    dispatch_once(&onceToken, ^{\n        if (config == nil) {\n            config = [[TZImagePickerConfig alloc] init];\n            config.supportedLanguages = [NSSet setWithObjects:@\"zh-Hans\", @\"zh-Hant\", @\"en\", @\"ar\", @\"de\", @\"es\", @\"fr\", @\"ja\", @\"ko-KP\", @\"pt\", @\"ru\", @\"vi\", nil];\n            config.preferredLanguage = nil;\n            config.gifPreviewMaxImagesCount = 50;\n        }\n    });\n    return config;\n}\n\n- (void)setPreferredLanguage:(NSString *)preferredLanguage {\n    _preferredLanguage = preferredLanguage;\n    \n    if (!preferredLanguage || !preferredLanguage.length) {\n        preferredLanguage = [NSLocale preferredLanguages].firstObject;\n    }\n\n    NSString *usedLanguage = @\"en\";\n    for (NSString *language in self.supportedLanguages) {\n        if ([preferredLanguage hasPrefix:language]) {\n            usedLanguage = language;\n            break;\n        }\n    }\n    _languageBundle = [NSBundle bundleWithPath:[[NSBundle tz_imagePickerBundle] pathForResource:usedLanguage ofType:@\"lproj\"]];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImageRequestOperation.h",
    "content": "//\n//  TZImageRequestOperation.h\n//  TZImagePickerControllerFramework\n//\n//  Created by 谭真 on 2018/12/20.\n//  Copyright © 2018 谭真. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n#import <Photos/Photos.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface TZImageRequestOperation : NSOperation\n\ntypedef void(^TZImageRequestCompletedBlock)(UIImage *photo, NSDictionary *info, BOOL isDegraded);\ntypedef void(^TZImageRequestProgressBlock)(double progress, NSError *error, BOOL *stop, NSDictionary *info);\n\n@property (nonatomic, copy, nullable) TZImageRequestCompletedBlock completedBlock;\n@property (nonatomic, copy, nullable) TZImageRequestProgressBlock progressBlock;\n@property (nonatomic, strong, nullable) PHAsset *asset;\n\n@property (assign, nonatomic, getter = isExecuting) BOOL executing;\n@property (assign, nonatomic, getter = isFinished) BOOL finished;\n\n- (instancetype)initWithAsset:(PHAsset *)asset completion:(TZImageRequestCompletedBlock)completionBlock progressHandler:(TZImageRequestProgressBlock)progressHandler;\n- (void)done;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImageRequestOperation.m",
    "content": "//\n//  TZImageRequestOperation.m\n//  TZImagePickerControllerFramework\n//\n//  Created by 谭真 on 2018/12/20.\n//  Copyright © 2018 谭真. All rights reserved.\n//\n\n#import \"TZImageRequestOperation.h\"\n#import \"TZImageManager.h\"\n\n@implementation TZImageRequestOperation\n\n@synthesize executing = _executing;\n@synthesize finished = _finished;\n\n- (instancetype)initWithAsset:(PHAsset *)asset completion:(TZImageRequestCompletedBlock)completionBlock progressHandler:(TZImageRequestProgressBlock)progressHandler {\n    self = [super init];\n    self.asset = asset;\n    self.completedBlock = completionBlock;\n    self.progressBlock = progressHandler;\n    _executing = NO;\n    _finished = NO;\n    return self;\n}\n\n- (void)start {\n    self.executing = YES;\n    [[TZImageManager manager] getPhotoWithAsset:self.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (!isDegraded) {\n                if (self.completedBlock) {\n                    self.completedBlock(photo, info, isDegraded);\n                }\n                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n                    [self done];\n                });\n            }\n        });\n    } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            if (self.progressBlock) {\n                self.progressBlock(progress, error, stop, info);\n            }\n        });\n    } networkAccessAllowed:YES];\n}\n\n- (void)done {\n    self.finished = YES;\n    self.executing = NO;\n    [self reset];\n}\n\n- (void)reset {\n    self.asset = nil;\n    self.completedBlock = nil;\n    self.progressBlock = nil;\n}\n\n- (void)setFinished:(BOOL)finished {\n    [self willChangeValueForKey:@\"isFinished\"];\n    _finished = finished;\n    [self didChangeValueForKey:@\"isFinished\"];\n}\n\n- (void)setExecuting:(BOOL)executing {\n    [self willChangeValueForKey:@\"isExecuting\"];\n    _executing = executing;\n    [self didChangeValueForKey:@\"isExecuting\"];\n}\n\n- (BOOL)isAsynchronous {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZLocationManager.h",
    "content": "//\n//  TZLocationManager.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 2017/06/03.\n//  Copyright © 2017年 谭真. All rights reserved.\n//  定位管理类\n\n\n#import <Foundation/Foundation.h>\n#import <CoreLocation/CoreLocation.h>\n\n@interface TZLocationManager : NSObject\n\n+ (instancetype)manager NS_SWIFT_NAME(default());\n\n/// 开始定位\n- (void)startLocation;\n- (void)startLocationWithSuccessBlock:(void (^)(NSArray<CLLocation *> *))successBlock failureBlock:(void (^)(NSError *error))failureBlock;\n- (void)startLocationWithGeocoderBlock:(void (^)(NSArray *geocoderArray))geocoderBlock;\n- (void)startLocationWithSuccessBlock:(void (^)(NSArray<CLLocation *> *))successBlock failureBlock:(void (^)(NSError *error))failureBlock geocoderBlock:(void (^)(NSArray *geocoderArray))geocoderBlock;\n\n/// 结束定位\n- (void)stopUpdatingLocation;\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZLocationManager.m",
    "content": "//\n//  TZLocationManager.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 2017/06/03.\n//  Copyright © 2017年 谭真. All rights reserved.\n//  定位管理类\n\n#import \"TZLocationManager.h\"\n#import \"TZImagePickerController.h\"\n\n@interface TZLocationManager ()<CLLocationManagerDelegate>\n@property (nonatomic, strong) CLLocationManager *locationManager;\n/// 定位成功的回调block\n@property (nonatomic, copy) void (^successBlock)(NSArray<CLLocation *> *);\n/// 编码成功的回调block\n@property (nonatomic, copy) void (^geocodeBlock)(NSArray *geocodeArray);\n/// 定位失败的回调block\n@property (nonatomic, copy) void (^failureBlock)(NSError *error);\n@end\n\n@implementation TZLocationManager\n\n+ (instancetype)manager {\n    static TZLocationManager *manager;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        manager = [[self alloc] init];\n        manager.locationManager = [[CLLocationManager alloc] init];\n        manager.locationManager.delegate = manager;\n        [manager.locationManager requestWhenInUseAuthorization];\n    });\n    return manager;\n}\n\n- (void)startLocation {\n    [self startLocationWithSuccessBlock:nil failureBlock:nil geocoderBlock:nil];\n}\n\n- (void)startLocationWithSuccessBlock:(void (^)(NSArray<CLLocation *> *))successBlock failureBlock:(void (^)(NSError *error))failureBlock {\n    [self startLocationWithSuccessBlock:successBlock failureBlock:failureBlock geocoderBlock:nil];\n}\n\n- (void)startLocationWithGeocoderBlock:(void (^)(NSArray *geocoderArray))geocoderBlock {\n    [self startLocationWithSuccessBlock:nil failureBlock:nil geocoderBlock:geocoderBlock];\n}\n\n- (void)startLocationWithSuccessBlock:(void (^)(NSArray<CLLocation *> *))successBlock failureBlock:(void (^)(NSError *error))failureBlock geocoderBlock:(void (^)(NSArray *geocoderArray))geocoderBlock {\n    [self.locationManager startUpdatingLocation];\n    _successBlock = successBlock;\n    _geocodeBlock = geocoderBlock;\n    _failureBlock = failureBlock;\n}\n\n- (void)stopUpdatingLocation {\n    [self.locationManager stopUpdatingLocation];\n}\n\n#pragma mark - CLLocationManagerDelegate\n\n/// 地理位置发生改变时触发\n- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations {\n    [manager stopUpdatingLocation];\n    \n    if (_successBlock) {\n        _successBlock(locations);\n    }\n    \n    if (_geocodeBlock && locations.count) {\n        CLGeocoder *geocoder = [[CLGeocoder alloc] init];\n        [geocoder reverseGeocodeLocation:[locations firstObject] completionHandler:^(NSArray *array, NSError *error) {\n            self->_geocodeBlock(array);\n        }];\n    }\n}\n\n/// 定位失败回调方法\n- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error {\n    NSLog(@\"定位失败, 错误: %@\",error);\n    switch([error code]) {\n        case kCLErrorDenied: { // 用户禁止了定位权限\n            \n        } break;\n        default: break;\n    }\n    if (_failureBlock) {\n        _failureBlock(error);\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZPhotoPickerController.h",
    "content": "//\n//  TZPhotoPickerController.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@class TZAlbumModel;\n@interface TZPhotoPickerController : UIViewController\n\n@property (nonatomic, assign) BOOL isFirstAppear;\n@property (nonatomic, assign) NSInteger columnNumber;\n@property (nonatomic, strong) TZAlbumModel *model;\n@end\n\n\n@interface TZCollectionView : UICollectionView\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m",
    "content": "//\n//  TZPhotoPickerController.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import \"TZPhotoPickerController.h\"\n#import \"TZImagePickerController.h\"\n#import \"TZPhotoPreviewController.h\"\n#import \"TZAssetCell.h\"\n#import \"TZAssetModel.h\"\n#import \"UIView+TZLayout.h\"\n#import \"TZImageManager.h\"\n#import \"TZVideoPlayerController.h\"\n#import \"TZGifPhotoPreviewController.h\"\n#import \"TZLocationManager.h\"\n#import <MobileCoreServices/MobileCoreServices.h>\n#import \"TZImageRequestOperation.h\"\n#import \"TZAuthLimitedFooterTipView.h\"\n#import <PhotosUI/PhotosUI.h>\n@interface TZPhotoPickerController ()<UICollectionViewDataSource,UICollectionViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate, PHPhotoLibraryChangeObserver> {\n    NSMutableArray *_models;\n    \n    UIView *_bottomToolBar;\n    UIButton *_previewButton;\n    UIButton *_doneButton;\n    UIImageView *_numberImageView;\n    UILabel *_numberLabel;\n    UIButton *_originalPhotoButton;\n    UILabel *_originalPhotoLabel;\n    UIView *_divideLine;\n    \n    BOOL _shouldScrollToBottom;\n    BOOL _showTakePhotoBtn;\n    BOOL _authorizationLimited;\n    \n    CGFloat _offsetItemCount;\n}\n@property CGRect previousPreheatRect;\n@property (nonatomic, assign) BOOL isSelectOriginalPhoto;\n@property (nonatomic, strong) TZCollectionView *collectionView;\n@property (nonatomic, strong) TZAuthLimitedFooterTipView *authFooterTipView;\n@property (nonatomic, strong) UILabel *noDataLabel;\n@property (strong, nonatomic) UICollectionViewFlowLayout *layout;\n@property (nonatomic, strong) UIImagePickerController *imagePickerVc;\n@property (strong, nonatomic) CLLocation *location;\n@property (nonatomic, strong) NSOperationQueue *operationQueue;\n@property (nonatomic, assign) BOOL isSavingMedia;\n@property (nonatomic, assign) BOOL isFetchingMedia;\n\n@end\n\nstatic CGSize AssetGridThumbnailSize;\nstatic CGFloat itemMargin = 5;\n\n@implementation TZPhotoPickerController\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n- (UIImagePickerController *)imagePickerVc {\n    if (_imagePickerVc == nil) {\n        _imagePickerVc = [[UIImagePickerController alloc] init];\n        _imagePickerVc.delegate = self;\n        // set appearance / 改变相册选择页的导航栏外观\n        _imagePickerVc.navigationBar.barTintColor = self.navigationController.navigationBar.barTintColor;\n        _imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;\n        UIBarButtonItem *tzBarItem, *BarItem;\n        if (@available(iOS 9, *)) {\n            tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]];\n            BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]];\n        } else {\n            tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil];\n            BarItem = [UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil];\n        }\n        NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal];\n        [BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal];\n    }\n    return _imagePickerVc;\n}\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    if ([[TZImageManager manager] authorizationStatusAuthorized] || !SYSTEM_VERSION_GREATER_THAN_15) {\n        [[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];\n    }\n    self.isFirstAppear = YES;\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    _isSelectOriginalPhoto = tzImagePickerVc.isSelectOriginalPhoto;\n    _shouldScrollToBottom = YES;\n    if (@available(iOS 13.0, *)) {\n        self.view.backgroundColor = UIColor.tertiarySystemBackgroundColor;\n    } else {\n        self.view.backgroundColor = [UIColor whiteColor];\n    }\n    self.navigationItem.title = _model.name;\n    UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithTitle:tzImagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:tzImagePickerVc action:@selector(cancelButtonClick)];\n    [TZCommonTools configBarButtonItem:cancelItem tzImagePickerVc:tzImagePickerVc];\n    self.navigationItem.rightBarButtonItem = cancelItem;\n    if (tzImagePickerVc.navLeftBarButtonSettingBlock) {\n        UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        leftButton.frame = CGRectMake(0, 0, 44, 44);\n        [leftButton addTarget:self action:@selector(navLeftBarButtonClick) forControlEvents:UIControlEventTouchUpInside];\n        tzImagePickerVc.navLeftBarButtonSettingBlock(leftButton);\n        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];\n    } else if (tzImagePickerVc.childViewControllers.count) {\n        UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@\"Back\"] style:UIBarButtonItemStylePlain target:self action:@selector(navLeftBarButtonClick)];\n        [TZCommonTools configBarButtonItem:backItem tzImagePickerVc:tzImagePickerVc];\n        [tzImagePickerVc.childViewControllers firstObject].navigationItem.backBarButtonItem = backItem;\n    }\n    _showTakePhotoBtn = _model.isCameraRoll && ((tzImagePickerVc.allowTakePicture && tzImagePickerVc.allowPickingImage) || (tzImagePickerVc.allowTakeVideo && tzImagePickerVc.allowPickingVideo));\n    _authorizationLimited = _model.isCameraRoll && [[TZImageManager manager] isPHAuthorizationStatusLimited];\n    // [self resetCachedAssets];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeStatusBarOrientationNotification:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];\n    \n    self.operationQueue = [[NSOperationQueue alloc] init];\n    self.operationQueue.maxConcurrentOperationCount = 3;\n}\n\n- (void)fetchAssetModels {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (_isFirstAppear && !_model.models.count) {\n        [tzImagePickerVc showProgressHUD];\n    }\n    dispatch_async(dispatch_get_global_queue(0, 0), ^{\n        CGFloat systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];\n        if (!tzImagePickerVc.sortAscendingByModificationDate && self->_isFirstAppear && self->_model.isCameraRoll) {\n            [[TZImageManager manager] getCameraRollAlbumWithFetchAssets:YES completion:^(TZAlbumModel *model) {\n                self->_model = model;\n                self->_models = [NSMutableArray arrayWithArray:self->_model.models];\n                [self initSubviews];\n            }];\n        } else if (self->_showTakePhotoBtn || self->_isFirstAppear || !self.model.models || systemVersion >= 14.0) {\n            [[TZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<TZAssetModel *> *models) {\n                self->_models = [NSMutableArray arrayWithArray:models];\n                [self initSubviews];\n            }];\n        } else {\n            self->_models = [NSMutableArray arrayWithArray:self->_model.models];\n            [self initSubviews];\n        }\n    });\n}\n\n- (void)initSubviews {\n    dispatch_async(dispatch_get_main_queue(), ^{\n        TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n        [tzImagePickerVc hideProgressHUD];\n        \n        [self checkSelectedModels];\n        [self configCollectionView];\n        self->_collectionView.hidden = YES;\n        [self configBottomToolBar];\n        \n        [self prepareScrollCollectionViewToBottom];\n    });\n}\n\n- (void)viewWillDisappear:(BOOL)animated {\n    [super viewWillDisappear:animated];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    tzImagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;\n}\n\n- (BOOL)prefersStatusBarHidden {\n    return NO;\n}\n\n- (UIStatusBarStyle)preferredStatusBarStyle {\n    TZImagePickerController *tzImagePicker = (TZImagePickerController *)self.navigationController;\n    if (tzImagePicker && [tzImagePicker isKindOfClass:[TZImagePickerController class]]) {\n        return tzImagePicker.statusBarStyle;\n    }\n    return [super preferredStatusBarStyle];\n}\n\n- (void)configCollectionView {\n    if (!_collectionView) {\n        _layout = [[UICollectionViewFlowLayout alloc] init];\n        _collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];\n        if (@available(iOS 13.0, *)) {\n            _collectionView.backgroundColor = UIColor.tertiarySystemBackgroundColor;\n        } else {\n            _collectionView.backgroundColor = [UIColor whiteColor];\n        }\n        _collectionView.dataSource = self;\n        _collectionView.delegate = self;\n        _collectionView.alwaysBounceHorizontal = NO;\n        _collectionView.contentInset = UIEdgeInsetsMake(itemMargin, itemMargin, itemMargin, itemMargin);\n        [self.view addSubview:_collectionView];\n        [_collectionView registerClass:[TZAssetCell class] forCellWithReuseIdentifier:@\"TZAssetCell\"];\n        [_collectionView registerClass:[TZAssetCameraCell class] forCellWithReuseIdentifier:@\"TZAssetCameraCell\"];\n        [_collectionView registerClass:[TZAssetAddMoreCell class] forCellWithReuseIdentifier:@\"TZAssetAddMoreCell\"];\n    } else {\n        [_collectionView reloadData];\n    }\n\n    if (!_authFooterTipView && _authorizationLimited) {\n        _authFooterTipView = [[TZAuthLimitedFooterTipView alloc] initWithFrame:CGRectMake(0, 0, self.view.tz_width, 80)];\n        UITapGestureRecognizer *footTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openSettingsApplication)];\n        [_authFooterTipView addGestureRecognizer:footTap];\n        [self.view addSubview:_authFooterTipView];\n    }\n    \n    _collectionView.contentSize = CGSizeMake(self.view.tz_width, (([self getAllCellCount] + self.columnNumber - 1) / self.columnNumber) * self.view.tz_width);\n    if (_models.count == 0) {\n        _noDataLabel = [UILabel new];\n        _noDataLabel.textAlignment = NSTextAlignmentCenter;\n        _noDataLabel.text = [NSBundle tz_localizedStringForKey:@\"No Photos or Videos\"];\n        CGFloat rgb = 153 / 256.0;\n        _noDataLabel.textColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];\n        _noDataLabel.font = [UIFont boldSystemFontOfSize:20];\n        _noDataLabel.frame = _collectionView.bounds;\n        [_collectionView addSubview:_noDataLabel];\n    } else if (_noDataLabel) {\n        [_noDataLabel removeFromSuperview];\n        _noDataLabel = nil;\n    }\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    // Determine the size of the thumbnails to request from the PHCachingImageManager\n    CGFloat scale = 2.0;\n    if ([UIScreen mainScreen].bounds.size.width > 600) {\n        scale = 1.0;\n    }\n    CGSize cellSize = ((UICollectionViewFlowLayout *)_collectionView.collectionViewLayout).itemSize;\n    AssetGridThumbnailSize = CGSizeMake(cellSize.width * scale, cellSize.height * scale);\n    \n    if (!_models) {\n        [self fetchAssetModels];\n    }\n}\n\n- (void)viewDidAppear:(BOOL)animated {\n    [super viewDidAppear:animated];\n    self.isFirstAppear = NO;\n    // [self updateCachedAssets];\n}\n\n- (void)configBottomToolBar {\n    if (_bottomToolBar) return;\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (!tzImagePickerVc.showSelectBtn) return;\n    \n    _bottomToolBar = [[UIView alloc] initWithFrame:CGRectZero];\n    CGFloat rgb = 253 / 255.0;\n    if (@available(iOS 13.0, *)) {\n        _bottomToolBar.backgroundColor = UIColor.tertiarySystemBackgroundColor;\n    } else {\n        _bottomToolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];\n    }\n    \n    _previewButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    [_previewButton addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    _previewButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    [_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal];\n    [_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateDisabled];\n    if (@available(iOS 13.0, *)) {\n        [_previewButton setTitleColor:UIColor.labelColor forState:UIControlStateNormal];\n    } else {\n        [_previewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];\n    }\n    [_previewButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];\n    _previewButton.enabled = tzImagePickerVc.selectedModels.count;\n    \n    if (tzImagePickerVc.allowPickingOriginalPhoto) {\n        _originalPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        _originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, [TZCommonTools tz_isRightToLeftLayout] ? 10 : -10, 0, 0);\n        [_originalPhotoButton addTarget:self action:@selector(originalPhotoButtonClick) forControlEvents:UIControlEventTouchUpInside];\n        _originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16];\n        [_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal];\n        [_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected];\n        [_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];\n        if (@available(iOS 13.0, *)) {\n            [_originalPhotoButton setTitleColor:[UIColor labelColor] forState:UIControlStateSelected];\n        } else {\n            [_originalPhotoButton setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];\n        }\n        [_originalPhotoButton setImage:tzImagePickerVc.photoOriginDefImage forState:UIControlStateNormal];\n        [_originalPhotoButton setImage:tzImagePickerVc.photoOriginSelImage forState:UIControlStateSelected];\n        _originalPhotoButton.imageView.clipsToBounds = YES;\n        _originalPhotoButton.imageView.contentMode = UIViewContentModeScaleAspectFit;\n        _originalPhotoButton.selected = _isSelectOriginalPhoto;\n        _originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0;\n        \n        _originalPhotoLabel = [[UILabel alloc] init];\n        _originalPhotoLabel.textAlignment = NSTextAlignmentLeft;\n        _originalPhotoLabel.font = [UIFont systemFontOfSize:16];\n        if (@available(iOS 13.0, *)) {\n            _originalPhotoLabel.textColor = [UIColor labelColor];\n        } else {\n            _originalPhotoLabel.textColor = [UIColor blackColor];\n        }\n        if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];\n    }\n    \n    _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];\n    [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateDisabled];\n    [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];\n    [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];\n    _doneButton.enabled = tzImagePickerVc.selectedModels.count || tzImagePickerVc.alwaysEnableDoneBtn;\n    \n    _numberImageView = [[UIImageView alloc] initWithImage:tzImagePickerVc.photoNumberIconImage];\n    _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0;\n    _numberImageView.clipsToBounds = YES;\n    _numberImageView.contentMode = UIViewContentModeScaleAspectFit;\n    _numberImageView.backgroundColor = [UIColor clearColor];\n    \n    _numberLabel = [[UILabel alloc] init];\n    _numberLabel.font = [UIFont systemFontOfSize:15];\n    _numberLabel.adjustsFontSizeToFitWidth = YES;\n    _numberLabel.textColor = [UIColor whiteColor];\n    _numberLabel.textAlignment = NSTextAlignmentCenter;\n    _numberLabel.text = [NSString stringWithFormat:@\"%zd\",tzImagePickerVc.selectedModels.count];\n    _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0;\n    _numberLabel.backgroundColor = [UIColor clearColor];\n    _numberLabel.userInteractionEnabled = YES;\n\n    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doneButtonClick)];\n    [_numberLabel addGestureRecognizer:tapGesture];\n    \n    _divideLine = [[UIView alloc] init];\n    CGFloat rgb2 = 222 / 255.0;\n    if (@available(iOS 13.0, *)) {\n        UIColor *divideLineDyColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull trainCollection) {\n            if ([trainCollection userInterfaceStyle] == UIUserInterfaceStyleLight) {\n                return [UIColor colorWithRed:rgb2 green:rgb2 blue:rgb2 alpha:1.0];\n            } else {\n                CGFloat lineDarkRgb = 100 / 255.0;\n                return [UIColor colorWithRed:lineDarkRgb green:lineDarkRgb blue:lineDarkRgb alpha:1.0];\n            }\n        }];\n        _divideLine.backgroundColor = divideLineDyColor;\n    } else {\n        _divideLine.backgroundColor = [UIColor colorWithRed:rgb2 green:rgb2 blue:rgb2 alpha:1.0];\n    }\n    \n    [_bottomToolBar addSubview:_divideLine];\n    [_bottomToolBar addSubview:_previewButton];\n    [_bottomToolBar addSubview:_doneButton];\n    [_bottomToolBar addSubview:_numberImageView];\n    [_bottomToolBar addSubview:_numberLabel];\n    [_bottomToolBar addSubview:_originalPhotoButton];\n    [self.view addSubview:_bottomToolBar];\n    [_originalPhotoButton addSubview:_originalPhotoLabel];\n    \n    if (tzImagePickerVc.photoPickerPageUIConfigBlock) {\n        tzImagePickerVc.photoPickerPageUIConfigBlock(_collectionView, _bottomToolBar, _previewButton, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel, _divideLine);\n    }\n}\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n    \n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    \n    CGFloat top = 0;\n    CGFloat collectionViewHeight = 0;\n    CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height;\n    CGFloat footerTipViewH = _authorizationLimited ? 80 : 0;\n    BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;\n    BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;\n    CGFloat toolBarHeight = 50 + [TZCommonTools tz_safeAreaInsets].bottom;\n    if (self.navigationController.navigationBar.isTranslucent) {\n        top = naviBarHeight;\n        if (!isStatusBarHidden && isFullScreen) top += [TZCommonTools tz_statusBarHeight];\n        collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight - top : self.view.tz_height - top;;\n    } else {\n        collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight : self.view.tz_height;\n    }\n    collectionViewHeight -= footerTipViewH;\n\n    _collectionView.frame = CGRectMake(0, top, self.view.tz_width, collectionViewHeight);\n    _noDataLabel.frame = _collectionView.bounds;\n    CGFloat itemWH = (self.view.tz_width - (self.columnNumber + 1) * itemMargin) / self.columnNumber;\n    _layout.itemSize = CGSizeMake(itemWH, itemWH);\n    _layout.minimumInteritemSpacing = itemMargin;\n    _layout.minimumLineSpacing = itemMargin;\n    [_collectionView setCollectionViewLayout:_layout];\n    if (_offsetItemCount > 0) {\n        CGFloat offsetY = _offsetItemCount * (_layout.itemSize.height + _layout.minimumLineSpacing);\n        [_collectionView setContentOffset:CGPointMake(0, offsetY)];\n    }\n    \n    CGFloat toolBarTop = 0;\n    if (!self.navigationController.navigationBar.isHidden) {\n        toolBarTop = self.view.tz_height - toolBarHeight;\n    } else {\n        CGFloat navigationHeight = naviBarHeight + [TZCommonTools tz_statusBarHeight];\n        toolBarTop = self.view.tz_height - toolBarHeight - navigationHeight;\n    }\n    _bottomToolBar.frame = CGRectMake(0, toolBarTop, self.view.tz_width, toolBarHeight);\n    if (_authFooterTipView) {\n        CGFloat footerTipViewY = _bottomToolBar ? toolBarTop - footerTipViewH : self.view.tz_height - footerTipViewH;\n        _authFooterTipView.frame = CGRectMake(0, footerTipViewY, self.view.tz_width, footerTipViewH);;\n    }\n    CGFloat previewWidth = [tzImagePickerVc.previewBtnTitleStr boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width + 2;\n    if (!tzImagePickerVc.allowPreview) {\n        previewWidth = 0.0;\n    }\n    _previewButton.frame = CGRectMake(10, 3, previewWidth, 44);\n    _previewButton.tz_width = !tzImagePickerVc.showSelectBtn ? 0 : previewWidth;\n    if (tzImagePickerVc.allowPickingOriginalPhoto) {\n        CGFloat fullImageWidth = [tzImagePickerVc.fullImageBtnTitleStr boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil].size.width;\n        _originalPhotoButton.frame = CGRectMake(CGRectGetMaxX(_previewButton.frame), 0, fullImageWidth + 56, 50);\n        _originalPhotoLabel.frame = CGRectMake(fullImageWidth + 46, 0, 80, 50);\n    }\n    [_doneButton sizeToFit];\n    _doneButton.frame = CGRectMake(self.view.tz_width - _doneButton.tz_width - 12, 0, MAX(44, _doneButton.tz_width), 50);\n    _numberImageView.frame = CGRectMake(_doneButton.tz_left - 24 - 5, 13, 24, 24);\n    _numberLabel.frame = _numberImageView.frame;\n    _divideLine.frame = CGRectMake(0, 0, self.view.tz_width, 1);\n    \n    [TZImageManager manager].columnNumber = [TZImageManager manager].columnNumber;\n    [TZImageManager manager].photoWidth = tzImagePickerVc.photoWidth;\n    [self.collectionView reloadData];\n    \n    if (tzImagePickerVc.photoPickerPageDidLayoutSubviewsBlock) {\n        tzImagePickerVc.photoPickerPageDidLayoutSubviewsBlock(_collectionView, _bottomToolBar, _previewButton, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel, _divideLine);\n    }\n}\n\n#pragma mark - Notification\n\n- (void)didChangeStatusBarOrientationNotification:(NSNotification *)noti {\n    _offsetItemCount = _collectionView.contentOffset.y / (_layout.itemSize.height + _layout.minimumLineSpacing);\n}\n\n#pragma mark - Click Event\n- (void)navLeftBarButtonClick{\n    [self.navigationController popViewControllerAnimated:YES];\n}\n- (void)previewButtonClick {\n    TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];\n    [self pushPhotoPrevireViewController:photoPreviewVc needCheckSelectedModels:YES];\n}\n\n- (void)originalPhotoButtonClick {\n    _originalPhotoButton.selected = !_originalPhotoButton.isSelected;\n    _isSelectOriginalPhoto = _originalPhotoButton.isSelected;\n    _originalPhotoLabel.hidden = !_originalPhotoButton.isSelected;\n    if (_isSelectOriginalPhoto) {\n        [self getSelectedPhotoBytes];\n    }\n}\n\n- (void)doneButtonClick {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    // 1.6.8 判断是否满足最小必选张数的限制\n    if (tzImagePickerVc.minImagesCount && tzImagePickerVc.selectedModels.count < tzImagePickerVc.minImagesCount) {\n        NSString *title = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Select a minimum of %zd photos\"], tzImagePickerVc.minImagesCount];\n        [tzImagePickerVc showAlertWithTitle:title];\n        return;\n    }\n    \n    [tzImagePickerVc showProgressHUD];\n    _doneButton.enabled = NO;\n    self.isFetchingMedia = YES;\n    NSMutableArray *assets = [NSMutableArray array];\n    NSMutableArray *photos;\n    NSMutableArray *infoArr;\n    if (tzImagePickerVc.onlyReturnAsset) { // not fetch image\n        for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {\n            TZAssetModel *model = tzImagePickerVc.selectedModels[i];\n            [assets addObject:model.asset];\n        }\n    } else { // fetch image\n        photos = [NSMutableArray array];\n        infoArr = [NSMutableArray array];\n        for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) { [photos addObject:@1];[assets addObject:@1];[infoArr addObject:@1]; }\n        \n        __block BOOL havenotShowAlert = YES;\n        [TZImageManager manager].shouldFixOrientation = YES;\n        __block UIAlertController *alertView;\n        for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {\n            TZAssetModel *model = tzImagePickerVc.selectedModels[i];\n            TZImageRequestOperation *operation = [[TZImageRequestOperation alloc] initWithAsset:model.asset completion:^(UIImage * _Nonnull photo, NSDictionary * _Nonnull info, BOOL isDegraded) {\n                if (isDegraded) return;\n                if (photo) {\n                    if (![TZImagePickerConfig sharedInstance].notScaleImage) {\n                        photo = [[TZImageManager manager] scaleImage:photo toSize:CGSizeMake(tzImagePickerVc.photoWidth, (int)(tzImagePickerVc.photoWidth * photo.size.height / photo.size.width))];\n                    }\n                    [photos replaceObjectAtIndex:i withObject:photo];\n                }\n                if (info)  [infoArr replaceObjectAtIndex:i withObject:info];\n                [assets replaceObjectAtIndex:i withObject:model.asset];\n                \n                for (id item in photos) { if ([item isKindOfClass:[NSNumber class]]) return; }\n                \n                if (havenotShowAlert && alertView) {\n                    [alertView dismissViewControllerAnimated:YES completion:^{\n                        alertView = nil;\n                        [self didGetAllPhotos:photos assets:assets infoArr:infoArr];\n                    }];\n                } else {\n                    [self didGetAllPhotos:photos assets:assets infoArr:infoArr];\n                }\n            } progressHandler:^(double progress, NSError * _Nonnull error, BOOL * _Nonnull stop, NSDictionary * _Nonnull info) {\n                // 如果图片正在从iCloud同步中,提醒用户\n                if (progress < 1 && havenotShowAlert && !alertView) {\n                    alertView = [tzImagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@\"Synchronizing photos from iCloud\"]];\n                    havenotShowAlert = NO;\n                    return;\n                }\n                if (progress >= 1) {\n                    havenotShowAlert = YES;\n                }\n            }];\n            [self.operationQueue addOperation:operation];\n        }\n    }\n    if (tzImagePickerVc.selectedModels.count <= 0 || tzImagePickerVc.onlyReturnAsset) {\n        [self didGetAllPhotos:photos assets:assets infoArr:infoArr];\n    }\n}\n\n- (void)didGetAllPhotos:(NSArray *)photos assets:(NSArray *)assets infoArr:(NSArray *)infoArr {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    [tzImagePickerVc hideProgressHUD];\n    _doneButton.enabled = YES;\n    self.isFetchingMedia = NO;\n\n    if (tzImagePickerVc.autoDismiss) {\n        [self.navigationController dismissViewControllerAnimated:YES completion:^{\n            [self callDelegateMethodWithPhotos:photos assets:assets infoArr:infoArr];\n        }];\n    } else {\n        [self callDelegateMethodWithPhotos:photos assets:assets infoArr:infoArr];\n    }\n}\n\n- (void)callDelegateMethodWithPhotos:(NSArray *)photos assets:(NSArray *)assets infoArr:(NSArray *)infoArr {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc.allowPickingVideo && tzImagePickerVc.maxImagesCount == 1) {\n        if ([[TZImageManager manager] isVideo:[assets firstObject]]) {\n            BOOL triggered = NO;\n            if ([tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingVideo:sourceAssets:)]) {\n                [tzImagePickerVc.pickerDelegate imagePickerController:tzImagePickerVc didFinishPickingVideo:[photos firstObject] sourceAssets:[assets firstObject]];\n                triggered = YES;\n            }\n            if (tzImagePickerVc.didFinishPickingVideoHandle) {\n                tzImagePickerVc.didFinishPickingVideoHandle([photos firstObject], [assets firstObject]);\n                triggered = YES;\n            }\n            if (triggered) return;\n        }\n    }\n    \n    if ([tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:)]) {\n        [tzImagePickerVc.pickerDelegate imagePickerController:tzImagePickerVc didFinishPickingPhotos:photos sourceAssets:assets isSelectOriginalPhoto:_isSelectOriginalPhoto];\n    }\n    if ([tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:infos:)]) {\n        [tzImagePickerVc.pickerDelegate imagePickerController:tzImagePickerVc didFinishPickingPhotos:photos sourceAssets:assets isSelectOriginalPhoto:_isSelectOriginalPhoto infos:infoArr];\n    }\n    if (tzImagePickerVc.didFinishPickingPhotosHandle) {\n        tzImagePickerVc.didFinishPickingPhotosHandle(photos,assets,_isSelectOriginalPhoto);\n    }\n    if (tzImagePickerVc.didFinishPickingPhotosWithInfosHandle) {\n        tzImagePickerVc.didFinishPickingPhotosWithInfosHandle(photos,assets,_isSelectOriginalPhoto,infoArr);\n    }\n}\n\n#pragma mark - UICollectionViewDataSource && Delegate\n\n- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n    return [self getAllCellCount];\n}\n\n- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    // the cell lead to add more photo / 去添加更多照片的cell\n    if (indexPath.item == [self getAddMorePhotoCellIndex]) {\n        TZAssetAddMoreCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"TZAssetAddMoreCell\" forIndexPath:indexPath];\n        cell.imageView.image = tzImagePickerVc.addMorePhotoImage;\n        cell.tipLabel.text = [NSBundle tz_localizedStringForKey:@\"Add more accessible photos\"];\n        cell.imageView.contentMode = UIViewContentModeScaleAspectFit;\n        cell.imageView.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.500];\n        return cell;\n    }\n    // the cell lead to take a picture / 去拍照的cell\n    if (indexPath.item == [self getTakePhotoCellIndex]) {\n        TZAssetCameraCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"TZAssetCameraCell\" forIndexPath:indexPath];\n        cell.imageView.image = tzImagePickerVc.takePictureImage;\n        if ([tzImagePickerVc.takePictureImageName isEqualToString:@\"takePicture80\"]) {\n            cell.imageView.contentMode = UIViewContentModeCenter;\n            CGFloat rgb = 223 / 255.0;\n            cell.imageView.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];\n        } else {\n            cell.imageView.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.500];\n        }\n        return cell;\n    }\n    // the cell dipaly photo or video / 展示照片或视频的cell\n    TZAssetCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"TZAssetCell\" forIndexPath:indexPath];\n    cell.allowPickingMultipleVideo = tzImagePickerVc.allowPickingMultipleVideo;\n    cell.photoDefImage = tzImagePickerVc.photoDefImage;\n    cell.photoSelImage = tzImagePickerVc.photoSelImage;\n    cell.assetCellDidSetModelBlock = tzImagePickerVc.assetCellDidSetModelBlock;\n    cell.assetCellDidLayoutSubviewsBlock = tzImagePickerVc.assetCellDidLayoutSubviewsBlock;\n    TZAssetModel *model;\n    if (tzImagePickerVc.sortAscendingByModificationDate) {\n        model = _models[indexPath.item];\n    } else {\n        NSInteger diff = [self getAllCellCount] - _models.count;\n        model = _models[indexPath.item - diff];;\n    }\n    cell.allowPickingGif = tzImagePickerVc.allowPickingGif;\n    cell.model = model;\n    if (model.isSelected && tzImagePickerVc.showSelectedIndex) {\n        cell.index = [tzImagePickerVc.selectedAssetIds indexOfObject:model.asset.localIdentifier] + 1;\n    }\n    cell.showSelectBtn = tzImagePickerVc.showSelectBtn;\n    cell.allowPreview = tzImagePickerVc.allowPreview;\n    \n    BOOL notSelectable = [TZCommonTools isAssetNotSelectable:model tzImagePickerVc:tzImagePickerVc];\n    if (notSelectable && tzImagePickerVc.showPhotoCannotSelectLayer && !model.isSelected) {\n        cell.cannotSelectLayerButton.backgroundColor = tzImagePickerVc.cannotSelectLayerColor;\n        cell.cannotSelectLayerButton.hidden = NO;\n    } else {\n        cell.cannotSelectLayerButton.hidden = YES;\n    }\n    \n    __weak typeof(cell) weakCell = cell;\n    __weak typeof(self) weakSelf = self;\n    __weak typeof(_numberImageView.layer) weakLayer = _numberImageView.layer;\n    cell.didSelectPhotoBlock = ^(BOOL isSelected) {\n        __strong typeof(weakCell) strongCell = weakCell;\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        __strong typeof(weakLayer) strongLayer = weakLayer;\n        TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)strongSelf.navigationController;\n        // 1. cancel select / 取消选择\n        if (isSelected) {\n            strongCell.selectPhotoButton.selected = NO;\n            model.isSelected = NO;\n            NSArray *selectedModels = [NSArray arrayWithArray:tzImagePickerVc.selectedModels];\n            for (TZAssetModel *model_item in selectedModels) {\n                if ([model.asset.localIdentifier isEqualToString:model_item.asset.localIdentifier]) {\n                    [tzImagePickerVc removeSelectedModel:model_item];\n                    [strongSelf setAsset:model_item.asset isSelect:NO];\n                    break;\n                }\n            }\n            [strongSelf refreshBottomToolBarStatus];\n            if (tzImagePickerVc.showSelectedIndex || tzImagePickerVc.showPhotoCannotSelectLayer) {\n                [[NSNotificationCenter defaultCenter] postNotificationName:@\"TZ_PHOTO_PICKER_RELOAD_NOTIFICATION\" object:strongSelf.navigationController];\n            }\n            [UIView showOscillatoryAnimationWithLayer:strongLayer type:TZOscillatoryAnimationToSmaller];\n            if (strongCell.model.iCloudFailed) {\n                NSString *title = [NSBundle tz_localizedStringForKey:@\"iCloud sync failed\"];\n                [tzImagePickerVc showAlertWithTitle:title];\n            }\n        } else {\n            // 2. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制\n            if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) {\n                if ([[TZImageManager manager] isAssetCannotBeSelected:model.asset]) {\n                    return;\n                }\n                if (!tzImagePickerVc.allowPreview) {\n                    BOOL shouldDone = tzImagePickerVc.maxImagesCount == 1;\n                    if (!tzImagePickerVc.allowPickingMultipleVideo && (model.type == TZAssetModelMediaTypeVideo || model.type == TZAssetModelMediaTypePhotoGif)) {\n                        shouldDone = YES;\n                    }\n                    if (shouldDone) {\n                        model.isSelected = YES;\n                        [tzImagePickerVc addSelectedModel:model];\n                        [strongSelf doneButtonClick];\n                        return;\n                    }\n                }\n                strongCell.selectPhotoButton.selected = YES;\n                model.isSelected = YES;\n                [tzImagePickerVc addSelectedModel:model];\n                if (tzImagePickerVc.showSelectedIndex || tzImagePickerVc.showPhotoCannotSelectLayer) {\n                    [[NSNotificationCenter defaultCenter] postNotificationName:@\"TZ_PHOTO_PICKER_RELOAD_NOTIFICATION\" object:strongSelf.navigationController];\n                }\n                [strongSelf setAsset:model.asset isSelect:YES];\n                [strongSelf refreshBottomToolBarStatus];\n                [UIView showOscillatoryAnimationWithLayer:strongLayer type:TZOscillatoryAnimationToSmaller];\n            } else {\n                NSString *title = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Select a maximum of %zd photos\"], tzImagePickerVc.maxImagesCount];\n                [tzImagePickerVc showAlertWithTitle:title];\n            }\n        }\n    };\n    return cell;\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {\n    // take a photo / 去拍照\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (indexPath.item == [self getAddMorePhotoCellIndex]) {\n        [self addMorePhoto]; return;\n    }\n    if (indexPath.item == [self getTakePhotoCellIndex]) {\n        [self takePhoto]; return;\n    }\n    // preview phote or video / 预览照片或视频\n    NSInteger index = indexPath.item;\n    if (!tzImagePickerVc.sortAscendingByModificationDate) {\n        index -= [self getAllCellCount] - _models.count;\n    }\n    TZAssetModel *model = _models[index];\n    if (model.type == TZAssetModelMediaTypeVideo && !tzImagePickerVc.allowPickingMultipleVideo) {\n        if (tzImagePickerVc.selectedModels.count > 0) {\n            TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n            [imagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@\"Can not choose both video and photo\"]];\n        } else {\n            TZVideoPlayerController *videoPlayerVc = [[TZVideoPlayerController alloc] init];\n            videoPlayerVc.model = model;\n            [self.navigationController pushViewController:videoPlayerVc animated:YES];\n        }\n    } else if (model.type == TZAssetModelMediaTypePhotoGif && tzImagePickerVc.allowPickingGif && !tzImagePickerVc.allowPickingMultipleVideo) {\n        if (tzImagePickerVc.selectedModels.count > 0) {\n            TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n            [imagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@\"Can not choose both photo and GIF\"]];\n        } else {\n            TZGifPhotoPreviewController *gifPreviewVc = [[TZGifPhotoPreviewController alloc] init];\n            gifPreviewVc.model = model;\n            [self.navigationController pushViewController:gifPreviewVc animated:YES];\n        }\n    } else {\n        TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];\n        photoPreviewVc.currentIndex = index;\n        photoPreviewVc.models = _models;\n        [self pushPhotoPrevireViewController:photoPreviewVc];\n    }\n}\n\n#pragma mark - UIScrollViewDelegate\n\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n    // [self updateCachedAssets];\n}\n\n#pragma mark - Private Method\n\n- (NSInteger)getAllCellCount {\n    NSInteger count = _models.count;\n    if (_showTakePhotoBtn) {\n        count += 1;\n    }\n    if (_authorizationLimited) {\n        count += 1;\n    }\n    return count;\n}\n\n- (NSInteger)getTakePhotoCellIndex {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (!_showTakePhotoBtn) {\n        return -1;\n    }\n    if (tzImagePickerVc.sortAscendingByModificationDate) {\n        return [self getAllCellCount] - 1;\n    } else {\n        return 0;\n    }\n}\n\n- (NSInteger)getAddMorePhotoCellIndex {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (!_authorizationLimited) {\n        return -1;\n    }\n    if (tzImagePickerVc.sortAscendingByModificationDate) {\n        if (_showTakePhotoBtn) {\n            return [self getAllCellCount] - 2;\n        }\n        return [self getAllCellCount] - 1;\n    } else {\n        return _showTakePhotoBtn ? 1 : 0;\n    }\n}\n\n/// 拍照按钮点击事件\n- (void)takePhoto {\n    AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];\n    if ((authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)) {\n        \n        // 无权限 做一个友好的提示\n        NSString *appName = [TZCommonTools tz_getAppName];\n\n        NSString *title = [NSBundle tz_localizedStringForKey:@\"Can not use camera\"];\n        NSString *message = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Please allow %@ to access your camera in \\\"Settings -> Privacy -> Camera\\\"\"],appName];\n        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];\n        UIAlertAction *cancelAct = [UIAlertAction actionWithTitle:[NSBundle tz_localizedStringForKey:@\"Cancel\"] style:UIAlertActionStyleCancel handler:nil];\n        [alertController addAction:cancelAct];\n        UIAlertAction *settingAct = [UIAlertAction actionWithTitle:[NSBundle tz_localizedStringForKey:@\"Setting\"] style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {\n            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];\n        }];\n        [alertController addAction:settingAct];\n        [self.navigationController presentViewController:alertController animated:YES completion:nil];\n    } else if (authStatus == AVAuthorizationStatusNotDetermined) {\n        // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏\n        [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {\n            if (granted) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    [self pushImagePickerController];\n                });\n            }\n        }];\n    } else {\n        [self pushImagePickerController];\n    }\n}\n\n- (void)openSettingsApplication {\n    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];\n}\n\n- (void)addMorePhoto {\n    if (@available(iOS 14, *)) {\n        [[PHPhotoLibrary sharedPhotoLibrary] presentLimitedLibraryPickerFromViewController:self];\n    }\n}\n\n// 调用相机\n- (void)pushImagePickerController {\n    // 提前定位\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc.allowCameraLocation) {\n        __weak typeof(self) weakSelf = self;\n        [[TZLocationManager manager] startLocationWithSuccessBlock:^(NSArray<CLLocation *> *locations) {\n            __strong typeof(weakSelf) strongSelf = weakSelf;\n            strongSelf.location = [locations firstObject];\n        } failureBlock:^(NSError *error) {\n            __strong typeof(weakSelf) strongSelf = weakSelf;\n            strongSelf.location = nil;\n        }];\n    }\n    \n    UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera;\n    if ([UIImagePickerController isSourceTypeAvailable: sourceType]) {\n        self.imagePickerVc.sourceType = sourceType;\n        NSMutableArray *mediaTypes = [NSMutableArray array];\n        if (tzImagePickerVc.allowTakePicture) {\n            [mediaTypes addObject:(NSString *)kUTTypeImage];\n        }\n        if (tzImagePickerVc.allowTakeVideo) {\n            [mediaTypes addObject:(NSString *)kUTTypeMovie];\n            self.imagePickerVc.videoMaximumDuration = tzImagePickerVc.videoMaximumDuration;\n        }\n        self.imagePickerVc.mediaTypes= mediaTypes;\n        if (tzImagePickerVc.uiImagePickerControllerSettingBlock) {\n            tzImagePickerVc.uiImagePickerControllerSettingBlock(_imagePickerVc);\n        }\n        [self presentViewController:_imagePickerVc animated:YES completion:nil];\n    } else {\n        NSLog(@\"模拟器中无法打开照相机,请在真机中使用\");\n    }\n}\n\n- (void)refreshBottomToolBarStatus {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    \n    _previewButton.enabled = tzImagePickerVc.selectedModels.count > 0;\n    _doneButton.enabled = tzImagePickerVc.selectedModels.count > 0 || tzImagePickerVc.alwaysEnableDoneBtn;\n    \n    _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0;\n    _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0;\n    _numberLabel.text = [NSString stringWithFormat:@\"%zd\",tzImagePickerVc.selectedModels.count];\n    \n    _originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0;\n    _originalPhotoButton.selected = (_isSelectOriginalPhoto && _originalPhotoButton.enabled);\n    _originalPhotoLabel.hidden = (!_originalPhotoButton.isSelected);\n    if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];\n    \n    if (tzImagePickerVc.photoPickerPageDidRefreshStateBlock) {\n        tzImagePickerVc.photoPickerPageDidRefreshStateBlock(_collectionView, _bottomToolBar, _previewButton, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel, _divideLine);;\n    }\n}\n\n- (void)pushPhotoPrevireViewController:(TZPhotoPreviewController *)photoPreviewVc {\n    [self pushPhotoPrevireViewController:photoPreviewVc needCheckSelectedModels:NO];\n}\n\n- (void)pushPhotoPrevireViewController:(TZPhotoPreviewController *)photoPreviewVc needCheckSelectedModels:(BOOL)needCheckSelectedModels {\n    __weak typeof(self) weakSelf = self;\n    photoPreviewVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;\n    [photoPreviewVc setBackButtonClickBlock:^(BOOL isSelectOriginalPhoto) {\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        strongSelf.isSelectOriginalPhoto = isSelectOriginalPhoto;\n        if (needCheckSelectedModels) {\n            [strongSelf checkSelectedModels];\n        }\n        [strongSelf.collectionView reloadData];\n        [strongSelf refreshBottomToolBarStatus];\n    }];\n    [photoPreviewVc setDoneButtonClickBlock:^(BOOL isSelectOriginalPhoto) {\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        strongSelf.isSelectOriginalPhoto = isSelectOriginalPhoto;\n        [strongSelf doneButtonClick];\n    }];\n    [photoPreviewVc setDoneButtonClickBlockCropMode:^(UIImage *cropedImage, id asset) {\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        NSArray *assets = @[];\n        if (asset) {\n            assets = @[asset];\n        }\n        NSArray *photos = @[];\n        if (cropedImage) {\n            photos = @[cropedImage];\n        }\n        [strongSelf didGetAllPhotos:photos assets:assets infoArr:nil];\n    }];\n    [self.navigationController pushViewController:photoPreviewVc animated:YES];\n}\n\n- (void)getSelectedPhotoBytes {\n    // 越南语 && 5屏幕时会显示不下，暂时这样处理\n    if ([[TZImagePickerConfig sharedInstance].preferredLanguage isEqualToString:@\"vi\"] && self.view.tz_width <= 320) {\n        return;\n    }\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    [[TZImageManager manager] getPhotosBytesWithArray:imagePickerVc.selectedModels completion:^(NSString *totalBytes) {\n        self->_originalPhotoLabel.text = [NSString stringWithFormat:@\"(%@)\",totalBytes];\n    }];\n}\n\n- (void)prepareScrollCollectionViewToBottom {\n    if (_shouldScrollToBottom && _models.count > 0) {\n        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n            [self scrollCollectionViewToBottom];\n            // try fix #1562：https://github.com/banchichen/TZImagePickerController/issues/1562\n            if (@available(iOS 15.0, *)) {\n                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n                    [self scrollCollectionViewToBottom];\n                });\n            }\n        });\n    } else {\n        _collectionView.hidden = NO;\n    }\n}\n\n- (void)scrollCollectionViewToBottom {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    NSInteger item = 0;\n    if (tzImagePickerVc.sortAscendingByModificationDate) {\n        item = [self getAllCellCount] - 1;\n    }\n    [self->_collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:item inSection:0] atScrollPosition:UICollectionViewScrollPositionBottom animated:NO];\n    self->_shouldScrollToBottom = NO;\n    self->_collectionView.hidden = NO;\n}\n\n- (void)checkSelectedModels {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    NSArray *selectedModels = tzImagePickerVc.selectedModels;\n    NSMutableSet *selectedAssets = [NSMutableSet setWithCapacity:selectedModels.count];\n    for (TZAssetModel *model in selectedModels) {\n        [selectedAssets addObject:model.asset];\n    }\n    for (TZAssetModel *model in _models) {\n        model.isSelected = NO;\n        if ([selectedAssets containsObject:model.asset]) {\n            model.isSelected = YES;\n        }\n    }\n}\n\n/// 选中/取消选中某张照片\n- (void)setAsset:(PHAsset *)asset isSelect:(BOOL)isSelect {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (isSelect && [tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didSelectAsset:photo:isSelectOriginalPhoto:)]) {\n        [self callDelegate:asset isSelect:YES];\n    }\n    if (!isSelect && [tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didDeselectAsset:photo:isSelectOriginalPhoto:)]) {\n        [self callDelegate:asset isSelect:NO];\n    }\n}\n\n/// 调用选中/取消选中某张照片的代理方法\n- (void)callDelegate:(PHAsset *)asset isSelect:(BOOL)isSelect {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    __weak typeof(self) weakSelf = self;\n    __weak typeof(tzImagePickerVc) weakImagePickerVc= tzImagePickerVc;\n    [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        if (isDegraded) return;\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        __strong typeof(weakImagePickerVc) strongImagePickerVc = weakImagePickerVc;\n        if (isSelect) {\n            [strongImagePickerVc.pickerDelegate imagePickerController:strongImagePickerVc didSelectAsset:asset photo:photo isSelectOriginalPhoto:strongSelf.isSelectOriginalPhoto];\n        } else {\n            [strongImagePickerVc.pickerDelegate imagePickerController:strongImagePickerVc didDeselectAsset:asset photo:photo isSelectOriginalPhoto:strongSelf.isSelectOriginalPhoto];\n        }\n    }];\n}\n\n#pragma mark - UIImagePickerControllerDelegate\n\n- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {\n    [picker dismissViewControllerAnimated:YES completion:nil];\n    NSString *type = [info objectForKey:UIImagePickerControllerMediaType];\n    if ([type isEqualToString:@\"public.image\"]) {\n        TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n        [imagePickerVc showProgressHUD];\n        UIImage *photo = [info objectForKey:UIImagePickerControllerOriginalImage];\n        NSDictionary *meta = [info objectForKey:UIImagePickerControllerMediaMetadata];\n        if (photo) {\n            self.isSavingMedia = YES;\n            [[TZImageManager manager] savePhotoWithImage:photo meta:meta location:self.location completion:^(PHAsset *asset, NSError *error){\n                self.isSavingMedia = NO;\n                if (!error && asset) {\n                    [self addPHAsset:asset];\n                } else {\n                    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n                    [tzImagePickerVc hideProgressHUD];\n                }\n            }];\n            self.location = nil;\n        }\n    } else if ([type isEqualToString:@\"public.movie\"]) {\n        TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n        [imagePickerVc showProgressHUD];\n        NSURL *videoUrl = [info objectForKey:UIImagePickerControllerMediaURL];\n        if (videoUrl) {\n            self.isSavingMedia = YES;\n            [[TZImageManager manager] saveVideoWithUrl:videoUrl location:self.location completion:^(PHAsset *asset, NSError *error) {\n                self.isSavingMedia = NO;\n                if (!error && asset) {\n                    [self addPHAsset:asset];\n                } else {\n                    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n                    [tzImagePickerVc hideProgressHUD];\n                }\n            }];\n            self.location = nil;\n        }\n    }\n}\n\n- (void)addPHAsset:(PHAsset *)asset {\n    TZAssetModel *assetModel = [[TZImageManager manager] createModelWithAsset:asset];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    [tzImagePickerVc hideProgressHUD];\n    if (tzImagePickerVc.sortAscendingByModificationDate) {\n        [_models addObject:assetModel];\n    } else {\n        [_models insertObject:assetModel atIndex:0];\n    }\n    \n    if (tzImagePickerVc.maxImagesCount <= 1) {\n        if (tzImagePickerVc.allowCrop && asset.mediaType == PHAssetMediaTypeImage) {\n            TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];\n            if (tzImagePickerVc.sortAscendingByModificationDate) {\n                photoPreviewVc.currentIndex = _models.count - 1;\n            } else {\n                photoPreviewVc.currentIndex = 0;\n            }\n            photoPreviewVc.models = _models;\n            [self pushPhotoPrevireViewController:photoPreviewVc];\n        } else if (tzImagePickerVc.selectedModels.count < 1) {\n            [tzImagePickerVc addSelectedModel:assetModel];\n            [self doneButtonClick];\n        }\n        return;\n    }\n    \n    if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) {\n        if (assetModel.type == TZAssetModelMediaTypeVideo && !tzImagePickerVc.allowPickingMultipleVideo) {\n            // 不能多选视频的情况下，不选中拍摄的视频\n        } else {\n            if ([[TZImageManager manager] isAssetCannotBeSelected:assetModel.asset]) {\n                return;\n            }\n            assetModel.isSelected = YES;\n            [tzImagePickerVc addSelectedModel:assetModel];\n            [self refreshBottomToolBarStatus];\n        }\n    }\n    _collectionView.hidden = YES;\n    [_collectionView reloadData];\n    \n    _shouldScrollToBottom = YES;\n    [self prepareScrollCollectionViewToBottom];\n}\n\n- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {\n    [picker dismissViewControllerAnimated:YES completion:nil];\n}\n\n- (void)dealloc {\n    [[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n    // NSLog(@\"%@ dealloc\",NSStringFromClass(self.class));\n}\n\n#pragma mark - PHPhotoLibraryChangeObserver\n\n- (void)photoLibraryDidChange:(PHChange *)changeInstance {\n    if (self.isSavingMedia || self.isFetchingMedia) {\n        return;\n    }\n    dispatch_async(dispatch_get_main_queue(), ^{\n        PHFetchResultChangeDetails *changeDetail = [changeInstance changeDetailsForFetchResult:self.model.result];\n        if (changeDetail == nil) return;\n        if (changeDetail.hasIncrementalChanges == NO) {\n            [self.model refreshFetchResult];\n            [self fetchAssetModels];\n        } else {\n            NSInteger insertedCount = changeDetail.insertedObjects.count;\n            NSInteger removedCount = changeDetail.removedObjects.count;\n            NSInteger changedCount = changeDetail.changedObjects.count;\n            if (insertedCount > 0 || removedCount > 0 || changedCount > 0) {\n                self.model.result = changeDetail.fetchResultAfterChanges;\n                self.model.count = changeDetail.fetchResultAfterChanges.count;\n                [self fetchAssetModels];\n            }\n        }\n    });\n}\n\n#pragma mark - Asset Caching\n\n- (void)resetCachedAssets {\n    [[TZImageManager manager].cachingImageManager stopCachingImagesForAllAssets];\n    self.previousPreheatRect = CGRectZero;\n}\n\n- (void)updateCachedAssets {\n    BOOL isViewVisible = [self isViewLoaded] && [[self view] window] != nil;\n    if (!isViewVisible) { return; }\n    \n    // The preheat window is twice the height of the visible rect.\n    CGRect preheatRect = _collectionView.bounds;\n    preheatRect = CGRectInset(preheatRect, 0.0f, -0.5f * CGRectGetHeight(preheatRect));\n    \n    /*\n     Check if the collection view is showing an area that is significantly\n     different to the last preheated area.\n     */\n    CGFloat delta = ABS(CGRectGetMidY(preheatRect) - CGRectGetMidY(self.previousPreheatRect));\n    if (delta > CGRectGetHeight(_collectionView.bounds) / 3.0f) {\n        \n        // Compute the assets to start caching and to stop caching.\n        NSMutableArray *addedIndexPaths = [NSMutableArray array];\n        NSMutableArray *removedIndexPaths = [NSMutableArray array];\n        \n        [self computeDifferenceBetweenRect:self.previousPreheatRect andRect:preheatRect removedHandler:^(CGRect removedRect) {\n            NSArray *indexPaths = [self aapl_indexPathsForElementsInRect:removedRect];\n            [removedIndexPaths addObjectsFromArray:indexPaths];\n        } addedHandler:^(CGRect addedRect) {\n            NSArray *indexPaths = [self aapl_indexPathsForElementsInRect:addedRect];\n            [addedIndexPaths addObjectsFromArray:indexPaths];\n        }];\n        \n        NSArray *assetsToStartCaching = [self assetsAtIndexPaths:addedIndexPaths];\n        NSArray *assetsToStopCaching = [self assetsAtIndexPaths:removedIndexPaths];\n        \n        // Update the assets the PHCachingImageManager is caching.\n        [[TZImageManager manager].cachingImageManager startCachingImagesForAssets:assetsToStartCaching\n                                                                       targetSize:AssetGridThumbnailSize\n                                                                      contentMode:PHImageContentModeAspectFill\n                                                                          options:nil];\n        [[TZImageManager manager].cachingImageManager stopCachingImagesForAssets:assetsToStopCaching\n                                                                      targetSize:AssetGridThumbnailSize\n                                                                     contentMode:PHImageContentModeAspectFill\n                                                                         options:nil];\n        \n        // Store the preheat rect to compare against in the future.\n        self.previousPreheatRect = preheatRect;\n    }\n}\n\n- (void)computeDifferenceBetweenRect:(CGRect)oldRect andRect:(CGRect)newRect removedHandler:(void (^)(CGRect removedRect))removedHandler addedHandler:(void (^)(CGRect addedRect))addedHandler {\n    if (CGRectIntersectsRect(newRect, oldRect)) {\n        CGFloat oldMaxY = CGRectGetMaxY(oldRect);\n        CGFloat oldMinY = CGRectGetMinY(oldRect);\n        CGFloat newMaxY = CGRectGetMaxY(newRect);\n        CGFloat newMinY = CGRectGetMinY(newRect);\n        \n        if (newMaxY > oldMaxY) {\n            CGRect rectToAdd = CGRectMake(newRect.origin.x, oldMaxY, newRect.size.width, (newMaxY - oldMaxY));\n            addedHandler(rectToAdd);\n        }\n        \n        if (oldMinY > newMinY) {\n            CGRect rectToAdd = CGRectMake(newRect.origin.x, newMinY, newRect.size.width, (oldMinY - newMinY));\n            addedHandler(rectToAdd);\n        }\n        \n        if (newMaxY < oldMaxY) {\n            CGRect rectToRemove = CGRectMake(newRect.origin.x, newMaxY, newRect.size.width, (oldMaxY - newMaxY));\n            removedHandler(rectToRemove);\n        }\n        \n        if (oldMinY < newMinY) {\n            CGRect rectToRemove = CGRectMake(newRect.origin.x, oldMinY, newRect.size.width, (newMinY - oldMinY));\n            removedHandler(rectToRemove);\n        }\n    } else {\n        addedHandler(newRect);\n        removedHandler(oldRect);\n    }\n}\n\n- (NSArray *)assetsAtIndexPaths:(NSArray *)indexPaths {\n    if (indexPaths.count == 0) { return nil; }\n    \n    NSMutableArray *assets = [NSMutableArray arrayWithCapacity:indexPaths.count];\n    for (NSIndexPath *indexPath in indexPaths) {\n        if (indexPath.item < _models.count) {\n            TZAssetModel *model = _models[indexPath.item];\n            [assets addObject:model.asset];\n        }\n    }\n    \n    return assets;\n}\n\n- (NSArray *)aapl_indexPathsForElementsInRect:(CGRect)rect {\n    NSArray *allLayoutAttributes = [_collectionView.collectionViewLayout layoutAttributesForElementsInRect:rect];\n    if (allLayoutAttributes.count == 0) { return nil; }\n    NSMutableArray *indexPaths = [NSMutableArray arrayWithCapacity:allLayoutAttributes.count];\n    for (UICollectionViewLayoutAttributes *layoutAttributes in allLayoutAttributes) {\n        NSIndexPath *indexPath = layoutAttributes.indexPath;\n        [indexPaths addObject:indexPath];\n    }\n    return indexPaths;\n}\n#pragma clang diagnostic pop\n\n@end\n\n\n\n@implementation TZCollectionView\n\n- (BOOL)touchesShouldCancelInContentView:(UIView *)view {\n    if ([view isKindOfClass:[UIControl class]]) {\n        return YES;\n    }\n    return [super touchesShouldCancelInContentView:view];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.h",
    "content": "//\n//  TZPhotoPreviewCell.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@class TZAssetModel;\n@interface TZAssetPreviewCell : UICollectionViewCell\n@property (nonatomic, strong) TZAssetModel *model;\n@property (nonatomic, copy) void (^singleTapGestureBlock)(void);\n- (void)configSubviews;\n- (void)photoPreviewCollectionViewDidScroll;\n@end\n\n\n@class TZAssetModel,TZProgressView,TZPhotoPreviewView;\n@interface TZPhotoPreviewCell : TZAssetPreviewCell\n\n@property (nonatomic, copy) void (^imageProgressUpdateBlock)(double progress);\n\n@property (nonatomic, strong) TZPhotoPreviewView *previewView;\n\n@property (nonatomic, assign) BOOL allowCrop;\n@property (nonatomic, assign) CGRect cropRect;\n@property (nonatomic, assign) BOOL scaleAspectFillCrop;\n\n- (void)recoverSubviews;\n\n@end\n\n\n@interface TZPhotoPreviewView : UIView\n@property (nonatomic, strong) UIImageView *imageView;\n@property (nonatomic, strong) UIScrollView *scrollView;\n@property (nonatomic, strong) UIView *imageContainerView;\n@property (nonatomic, strong) TZProgressView *progressView;\n@property (nonatomic, strong) UIImageView *iCloudErrorIcon;\n@property (nonatomic, strong) UILabel *iCloudErrorLabel;\n@property (nonatomic, copy) void (^iCloudSyncFailedHandle)(id asset, BOOL isSyncFailed);\n\n\n@property (nonatomic, assign) BOOL allowCrop;\n@property (nonatomic, assign) CGRect cropRect;\n@property (nonatomic, assign) BOOL scaleAspectFillCrop;\n@property (nonatomic, strong) TZAssetModel *model;\n@property (nonatomic, strong) id asset;\n@property (nonatomic, copy) void (^singleTapGestureBlock)(void);\n@property (nonatomic, copy) void (^imageProgressUpdateBlock)(double progress);\n\n@property (nonatomic, assign) int32_t imageRequestID;\n\n- (void)recoverSubviews;\n@end\n\n\n@class AVPlayer, AVPlayerLayer;\n@interface TZVideoPreviewCell : TZAssetPreviewCell\n@property (strong, nonatomic) AVPlayer *player;\n@property (strong, nonatomic) AVPlayerLayer *playerLayer;\n@property (strong, nonatomic) UIButton *playButton;\n@property (strong, nonatomic) UIImage *cover;\n@property (nonatomic, strong) NSURL *videoURL;\n@property (nonatomic, strong) UIImageView *iCloudErrorIcon;\n@property (nonatomic, strong) UILabel *iCloudErrorLabel;\n@property (nonatomic, copy) void (^iCloudSyncFailedHandle)(id asset, BOOL isSyncFailed);\n- (void)pausePlayerAndShowNaviBar;\n@end\n\n\n@interface TZGifPreviewCell : TZAssetPreviewCell\n@property (strong, nonatomic) TZPhotoPreviewView *previewView;\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m",
    "content": "//\n//  TZPhotoPreviewCell.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import \"TZPhotoPreviewCell.h\"\n#import \"TZAssetModel.h\"\n#import \"UIView+TZLayout.h\"\n#import \"TZImageManager.h\"\n#import \"TZProgressView.h\"\n#import \"TZImageCropManager.h\"\n#import <MediaPlayer/MediaPlayer.h>\n#import \"TZImagePickerController.h\"\n\n@implementation TZAssetPreviewCell\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        self.backgroundColor = [UIColor blackColor];\n        [self configSubviews];\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(photoPreviewCollectionViewDidScroll) name:@\"photoPreviewCollectionViewDidScroll\" object:nil];\n    }\n    return self;\n}\n\n- (void)configSubviews {\n    \n}\n\n#pragma mark - Notification\n\n- (void)photoPreviewCollectionViewDidScroll {\n    \n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n@end\n\n\n@implementation TZPhotoPreviewCell\n\n- (void)configSubviews {\n    self.previewView = [[TZPhotoPreviewView alloc] initWithFrame:CGRectZero];\n    __weak typeof(self) weakSelf = self;\n    [self.previewView setSingleTapGestureBlock:^{\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        if (strongSelf.singleTapGestureBlock) {\n            strongSelf.singleTapGestureBlock();\n        }\n    }];\n    [self.previewView setImageProgressUpdateBlock:^(double progress) {\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        if (strongSelf.imageProgressUpdateBlock) {\n            strongSelf.imageProgressUpdateBlock(progress);\n        }\n    }];\n    [self.contentView addSubview:self.previewView];\n}\n\n- (void)setModel:(TZAssetModel *)model {\n    [super setModel:model];\n    _previewView.model = model;\n}\n\n- (void)recoverSubviews {\n    [_previewView recoverSubviews];\n}\n\n- (void)setAllowCrop:(BOOL)allowCrop {\n    _allowCrop = allowCrop;\n    _previewView.allowCrop = allowCrop;\n}\n\n- (void)setScaleAspectFillCrop:(BOOL)scaleAspectFillCrop {\n    _scaleAspectFillCrop = scaleAspectFillCrop;\n    _previewView.scaleAspectFillCrop = scaleAspectFillCrop;\n}\n\n- (void)setCropRect:(CGRect)cropRect {\n    _cropRect = cropRect;\n    _previewView.cropRect = cropRect;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    self.previewView.frame = self.bounds;\n}\n\n@end\n\n\n@interface TZPhotoPreviewView ()<UIScrollViewDelegate>\n@property (assign, nonatomic) BOOL isRequestingGIF;\n@end\n\n@implementation TZPhotoPreviewView\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        _scrollView = [[UIScrollView alloc] init];\n        _scrollView.bouncesZoom = YES;\n        _scrollView.maximumZoomScale = 4;\n        _scrollView.minimumZoomScale = 1.0;\n        _scrollView.multipleTouchEnabled = YES;\n        _scrollView.delegate = self;\n        _scrollView.scrollsToTop = NO;\n        _scrollView.showsHorizontalScrollIndicator = NO;\n        _scrollView.showsVerticalScrollIndicator = YES;\n        _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n        _scrollView.delaysContentTouches = NO;\n        _scrollView.canCancelContentTouches = YES;\n        _scrollView.alwaysBounceVertical = NO;\n        if (@available(iOS 11, *)) {\n            _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;\n        }\n        [self addSubview:_scrollView];\n        \n        _imageContainerView = [[UIView alloc] init];\n        _imageContainerView.clipsToBounds = YES;\n        _imageContainerView.contentMode = UIViewContentModeScaleAspectFill;\n        [_scrollView addSubview:_imageContainerView];\n        \n        _imageView = [[UIImageView alloc] init];\n        _imageView.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.500];\n        _imageView.contentMode = UIViewContentModeScaleAspectFill;\n        _imageView.clipsToBounds = YES;\n        [_imageContainerView addSubview:_imageView];\n\n        _iCloudErrorIcon = [[UIImageView alloc] init];\n        _iCloudErrorIcon.image = [UIImage tz_imageNamedFromMyBundle:@\"iCloudError\"];\n        _iCloudErrorIcon.hidden = YES;\n        [self addSubview:_iCloudErrorIcon];\n        _iCloudErrorLabel = [[UILabel alloc] init];\n        _iCloudErrorLabel.font = [UIFont systemFontOfSize:10];\n        _iCloudErrorLabel.textColor = [UIColor whiteColor];\n        _iCloudErrorLabel.text = [NSBundle tz_localizedStringForKey:@\"iCloud sync failed\"];\n        _iCloudErrorLabel.hidden = YES;\n        [self addSubview:_iCloudErrorLabel];\n        \n        UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];\n        [self addGestureRecognizer:tap1];\n        UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];\n        tap2.numberOfTapsRequired = 2;\n        [tap1 requireGestureRecognizerToFail:tap2];\n        [self addGestureRecognizer:tap2];\n        \n        [self configProgressView];\n    }\n    return self;\n}\n\n- (void)configProgressView {\n    _progressView = [[TZProgressView alloc] init];\n    _progressView.hidden = YES;\n    [self addSubview:_progressView];\n}\n\n- (void)setModel:(TZAssetModel *)model {\n    _model = model;\n    self.isRequestingGIF = NO;\n    [_scrollView setZoomScale:1.0 animated:NO];\n    if (model.type == TZAssetModelMediaTypePhotoGif) {\n        // 先显示缩略图\n        [[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n            if (photo) {\n                self.imageView.image = photo;\n            }\n            [self resizeSubviews];\n            if (self.isRequestingGIF) {\n                return;\n            }\n            // 再显示gif动图\n            self.isRequestingGIF = YES;\n            [[TZImageManager manager] getOriginalPhotoDataWithAsset:model.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n                progress = progress > 0.02 ? progress : 0.02;\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    BOOL iCloudSyncFailed = [TZCommonTools isICloudSyncError:error];\n                    self.iCloudErrorLabel.hidden = !iCloudSyncFailed;\n                    self.iCloudErrorIcon.hidden = !iCloudSyncFailed;\n                    if (self.iCloudSyncFailedHandle) {\n                        self.iCloudSyncFailedHandle(model.asset, iCloudSyncFailed);\n                    }\n                    \n                    self.progressView.progress = progress;\n                    if (progress >= 1) {\n                        self.progressView.hidden = YES;\n                    } else {\n                        self.progressView.hidden = NO;\n                    }\n                });\n#ifdef DEBUG\n                NSLog(@\"[TZImagePickerController] getOriginalPhotoDataWithAsset:%f error:%@\", progress, error);\n#endif\n            } completion:^(NSData *data, NSDictionary *info, BOOL isDegraded) {\n                if (!isDegraded) {\n                    self.isRequestingGIF = NO;\n                    self.progressView.hidden = YES;\n                    if ([TZImagePickerConfig sharedInstance].gifImagePlayBlock) {\n                        [TZImagePickerConfig sharedInstance].gifImagePlayBlock(self, self.imageView, data, info);\n                    } else {\n                        self.imageView.image = [UIImage sd_tz_animatedGIFWithData:data];\n                    }\n                    [self resizeSubviews];\n                }\n            }];\n        } progressHandler:nil networkAccessAllowed:NO];\n    } else {\n        self.asset = model.asset;\n    }\n}\n\n- (void)setAsset:(PHAsset *)asset {\n    if (_asset && self.imageRequestID) {\n        [[PHImageManager defaultManager] cancelImageRequest:self.imageRequestID];\n    }\n    \n    _asset = asset;\n    self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        BOOL iCloudSyncFailed = !photo && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];\n        self.iCloudErrorLabel.hidden = !iCloudSyncFailed;\n        self.iCloudErrorIcon.hidden = !iCloudSyncFailed;\n        if (self.iCloudSyncFailedHandle) {\n            self.iCloudSyncFailedHandle(asset, iCloudSyncFailed);\n        }\n        if (![asset isEqual:self->_asset]) return;\n        if (photo) {\n            self.imageView.image = photo;\n        }\n        [self resizeSubviews];\n        if (self.imageView.tz_height && self.allowCrop) {\n            CGFloat scale = MAX(self.cropRect.size.width / self.imageView.tz_width, self.cropRect.size.height / self.imageView.tz_height);\n            if (self.scaleAspectFillCrop && scale > 1) { // 如果设置图片缩放裁剪并且图片需要缩放\n                CGFloat multiple = self.scrollView.maximumZoomScale / self.scrollView.minimumZoomScale;\n                self.scrollView.minimumZoomScale = scale;\n                self.scrollView.maximumZoomScale = scale * MAX(multiple, 2);\n                [self.scrollView setZoomScale:scale animated:YES];\n            }\n        }\n        \n        self->_progressView.hidden = YES;\n        if (self.imageProgressUpdateBlock) {\n            self.imageProgressUpdateBlock(1);\n        }\n        if (!isDegraded) {\n            self.imageRequestID = 0;\n        }\n    } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {\n        if (![asset isEqual:self->_asset]) return;\n        self->_progressView.hidden = NO;\n        [self bringSubviewToFront:self->_progressView];\n        progress = progress > 0.02 ? progress : 0.02;\n        self->_progressView.progress = progress;\n        if (self.imageProgressUpdateBlock && progress < 1) {\n            self.imageProgressUpdateBlock(progress);\n        }\n        \n        if (progress >= 1) {\n            self->_progressView.hidden = YES;\n            self.imageRequestID = 0;\n        }\n    } networkAccessAllowed:YES];\n    \n    [self configMaximumZoomScale];\n}\n\n- (void)recoverSubviews {\n    [_scrollView setZoomScale:_scrollView.minimumZoomScale animated:NO];\n    [self resizeSubviews];\n}\n\n- (void)resizeSubviews {\n    _imageContainerView.tz_origin = CGPointZero;\n    _imageContainerView.tz_width = self.scrollView.tz_width;\n    \n    UIImage *image = _imageView.image;\n    if (image.size.height / image.size.width > self.tz_height / self.scrollView.tz_width) {\n        CGFloat width = image.size.width / image.size.height * self.scrollView.tz_height;\n        if (width < 1 || isnan(width)) width = self.tz_width;\n        width = floor(width);\n        \n        _imageContainerView.tz_width = width;\n        _imageContainerView.tz_height = self.tz_height;\n        _imageContainerView.tz_centerX = self.scrollView.tz_width  / 2;\n    } else {\n        CGFloat height = image.size.height / image.size.width * self.scrollView.tz_width;\n        if (height < 1 || isnan(height)) height = self.tz_height;\n        height = floor(height);\n        _imageContainerView.tz_height = height;\n        _imageContainerView.tz_centerY = self.tz_height / 2;\n    }\n    if (_imageContainerView.tz_height > self.tz_height && _imageContainerView.tz_height - self.tz_height <= 1) {\n        _imageContainerView.tz_height = self.tz_height;\n    }\n    CGFloat contentSizeH = MAX(_imageContainerView.tz_height, self.tz_height);\n    _scrollView.contentSize = CGSizeMake(self.scrollView.tz_width, contentSizeH);\n    [_scrollView scrollRectToVisible:self.bounds animated:NO];\n    _scrollView.alwaysBounceVertical = _imageContainerView.tz_height <= self.tz_height ? NO : YES;\n    _imageView.frame = _imageContainerView.bounds;\n    \n    [self refreshScrollViewContentSize];\n}\n\n- (void)configMaximumZoomScale {\n    _scrollView.maximumZoomScale = _allowCrop ? 6.0 : 4.0;\n    \n    if ([self.asset isKindOfClass:[PHAsset class]]) {\n        PHAsset *phAsset = (PHAsset *)self.asset;\n        CGFloat aspectRatio = phAsset.pixelWidth / (CGFloat)phAsset.pixelHeight;\n        // 优化超宽图片的显示\n        if (aspectRatio > 1.5) {\n            self.scrollView.maximumZoomScale *= aspectRatio / 1.5;\n        }\n    }\n}\n\n- (void)refreshScrollViewContentSize {\n    if (_allowCrop) {\n        // 1.7.2 如果允许裁剪,需要让图片的任意部分都能在裁剪框内，于是对_scrollView做了如下处理：\n        // 1.让contentSize增大(裁剪框右下角的图片部分)\n        CGFloat contentWidthAdd = (MIN(_imageContainerView.tz_width, self.scrollView.tz_width) - _cropRect.size.width) / 2;\n        CGFloat contentHeightAdd = (MIN(_imageContainerView.tz_height, self.scrollView.tz_height) - _cropRect.size.height) / 2;\n        CGFloat newSizeW = MAX(self.scrollView.contentSize.width, self.scrollView.tz_width) + contentWidthAdd;\n        CGFloat newSizeH = MAX(self.scrollView.contentSize.height, self.scrollView.tz_height) + contentHeightAdd;\n        _scrollView.contentSize = CGSizeMake(newSizeW, newSizeH);\n        _scrollView.alwaysBounceVertical = YES;\n        // 2.让scrollView新增滑动区域（裁剪框左上角的图片部分）\n        if (contentHeightAdd > 0 || contentWidthAdd > 0) {\n            _scrollView.contentInset = UIEdgeInsetsMake(MAX(contentHeightAdd, 0), MAX(contentWidthAdd, 0), 0, 0);\n        } else {\n            _scrollView.contentInset = UIEdgeInsetsZero;\n        }\n    }\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    _scrollView.frame = CGRectMake(10, 0, self.tz_width - 20, self.tz_height);\n    static CGFloat progressWH = 40;\n    CGFloat progressX = (self.tz_width - progressWH) / 2;\n    CGFloat progressY = (self.tz_height - progressWH) / 2;\n    _progressView.frame = CGRectMake(progressX, progressY, progressWH, progressWH);\n    [self recoverSubviews];\n    _iCloudErrorIcon.frame = CGRectMake(20, [TZCommonTools tz_statusBarHeight] + 44 + 10, 28, 28);\n    _iCloudErrorLabel.frame = CGRectMake(53, [TZCommonTools tz_statusBarHeight] + 44 + 10, self.tz_width - 63, 28);\n}\n\n#pragma mark - UITapGestureRecognizer Event\n\n- (void)doubleTap:(UITapGestureRecognizer *)tap {\n    if (_scrollView.zoomScale > _scrollView.minimumZoomScale) {\n        _scrollView.contentInset = UIEdgeInsetsZero;\n        [_scrollView setZoomScale:_scrollView.minimumZoomScale animated:YES];\n    } else {\n        CGPoint touchPoint = [tap locationInView:self.imageView];\n        CGFloat newZoomScale = MIN(_scrollView.maximumZoomScale, 2.5);\n        CGFloat xsize = self.frame.size.width / newZoomScale;\n        CGFloat ysize = self.frame.size.height / newZoomScale;\n        [_scrollView zoomToRect:CGRectMake(touchPoint.x - xsize/2, touchPoint.y - ysize/2, xsize, ysize) animated:YES];\n    }\n}\n\n- (void)singleTap:(UITapGestureRecognizer *)tap {\n    if (self.singleTapGestureBlock) {\n        self.singleTapGestureBlock();\n    }\n}\n\n#pragma mark - UIScrollViewDelegate\n\n- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {\n    return _imageContainerView;\n}\n\n- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view {\n    scrollView.contentInset = UIEdgeInsetsZero;\n}\n\n- (void)scrollViewDidZoom:(UIScrollView *)scrollView {\n    [self refreshImageContainerViewCenter];\n}\n\n- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale {\n    [self refreshScrollViewContentSize];\n}\n\n#pragma mark - Private\n\n- (void)refreshImageContainerViewCenter {\n    CGFloat offsetX = (_scrollView.tz_width > _scrollView.contentSize.width) ? ((_scrollView.tz_width - _scrollView.contentSize.width) * 0.5) : 0.0;\n    CGFloat offsetY = (_scrollView.tz_height > _scrollView.contentSize.height) ? ((_scrollView.tz_height - _scrollView.contentSize.height) * 0.5) : 0.0;\n    self.imageContainerView.center = CGPointMake(_scrollView.contentSize.width * 0.5 + offsetX, _scrollView.contentSize.height * 0.5 + offsetY);\n}\n\n@end\n\n\n@implementation TZVideoPreviewCell\n\n- (void)configSubviews {\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActiveNotification) name:UIApplicationWillResignActiveNotification object:nil];\n    _iCloudErrorIcon = [[UIImageView alloc] init];\n    _iCloudErrorIcon.image = [UIImage tz_imageNamedFromMyBundle:@\"iCloudError\"];\n    _iCloudErrorIcon.hidden = YES;\n    _iCloudErrorLabel = [[UILabel alloc] init];\n    _iCloudErrorLabel.font = [UIFont systemFontOfSize:10];\n    _iCloudErrorLabel.textColor = [UIColor whiteColor];\n    _iCloudErrorLabel.text = [NSBundle tz_localizedStringForKey:@\"iCloud sync failed\"];\n    _iCloudErrorLabel.hidden = YES;\n}\n\n- (void)configPlayButton {\n    if (_playButton) {\n        [_playButton removeFromSuperview];\n    }\n    _playButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"] forState:UIControlStateNormal];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlayHL\"] forState:UIControlStateHighlighted];\n    [_playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    _playButton.frame = CGRectMake(0, 64, self.tz_width, self.tz_height - 64 - 44);\n    [self.contentView addSubview:_playButton];\n    [self.contentView addSubview:_iCloudErrorIcon];\n    [self.contentView addSubview:_iCloudErrorLabel];\n}\n\n- (void)setModel:(TZAssetModel *)model {\n    [super setModel:model];\n    [self configMoviePlayer];\n}\n\n- (void)setVideoURL:(NSURL *)videoURL {\n    _videoURL = videoURL;\n    [self configMoviePlayer];\n}\n\n- (void)configMoviePlayer {\n    if (_player) {\n        [_playerLayer removeFromSuperlayer];\n        _playerLayer = nil;\n        [_player pause];\n        _player = nil;\n    }\n    \n    if (self.model && self.model.asset) {\n        [[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n            BOOL iCloudSyncFailed = !photo && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];\n            self.iCloudErrorLabel.hidden = !iCloudSyncFailed;\n            self.iCloudErrorIcon.hidden = !iCloudSyncFailed;\n            if (self.iCloudSyncFailedHandle) {\n                self.iCloudSyncFailedHandle(self.model.asset, iCloudSyncFailed);\n            }\n            if (photo) {\n                self.cover = photo;\n            }\n        }];\n        [[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                BOOL iCloudSyncFailed = !playerItem && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];\n                self.iCloudErrorLabel.hidden = !iCloudSyncFailed;\n                self.iCloudErrorIcon.hidden = !iCloudSyncFailed;\n                if (self.iCloudSyncFailedHandle) {\n                    self.iCloudSyncFailedHandle(self.model.asset, iCloudSyncFailed);\n                }\n                [self configPlayerWithItem:playerItem];\n            });\n        }];\n    } else {\n        AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:self.videoURL];\n        [self configPlayerWithItem:playerItem];\n    }\n}\n\n- (void)configPlayerWithItem:(AVPlayerItem *)playerItem {\n    self.player = [AVPlayer playerWithPlayerItem:playerItem];\n    self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];\n    self.playerLayer.backgroundColor = [UIColor blackColor].CGColor;\n    self.playerLayer.frame = self.bounds;\n    [self.contentView.layer addSublayer:self.playerLayer];\n    [self configPlayButton];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:AVPlayerItemDidPlayToEndTimeNotification object:self.player.currentItem];\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    _playerLayer.frame = self.bounds;\n    _playButton.frame = CGRectMake(0, 64, self.tz_width, self.tz_height - 64 - 44);\n    _iCloudErrorIcon.frame = CGRectMake(20, [TZCommonTools tz_statusBarHeight] + 44 + 10, 28, 28);\n    _iCloudErrorLabel.frame = CGRectMake(53, [TZCommonTools tz_statusBarHeight] + 44 + 10, self.tz_width - 63, 28);\n}\n\n- (void)photoPreviewCollectionViewDidScroll {\n    if (_player && _player.rate != 0.0) {\n        [self pausePlayerAndShowNaviBar];\n    }\n}\n\n#pragma mark - Notification\n\n- (void)appWillResignActiveNotification {\n    if (_player && _player.rate != 0.0) {\n        [self pausePlayerAndShowNaviBar];\n    }\n}\n\n#pragma mark - Click Event\n\n- (void)playButtonClick {\n    CMTime currentTime = _player.currentItem.currentTime;\n    CMTime durationTime = _player.currentItem.duration;\n    if (_player.rate == 0.0f) {\n        [[NSNotificationCenter defaultCenter] postNotificationName:@\"TZ_VIDEO_PLAY_NOTIFICATION\" object:_player];\n        if (currentTime.value == durationTime.value) [_player.currentItem seekToTime:CMTimeMake(0, 1)];\n        [_player play];\n        [_playButton setImage:nil forState:UIControlStateNormal];\n        [UIApplication sharedApplication].statusBarHidden = YES;\n        if (self.singleTapGestureBlock) {\n            self.singleTapGestureBlock();\n        }\n    } else {\n        [self pausePlayerAndShowNaviBar];\n    }\n}\n\n- (void)pausePlayerAndShowNaviBar {\n    [_player pause];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"] forState:UIControlStateNormal];\n    if (self.singleTapGestureBlock) {\n        self.singleTapGestureBlock();\n    }\n}\n\n@end\n\n\n@implementation TZGifPreviewCell\n\n- (void)configSubviews {\n    [self configPreviewView];\n}\n\n- (void)configPreviewView {\n    _previewView = [[TZPhotoPreviewView alloc] initWithFrame:CGRectZero];\n    __weak typeof(self) weakSelf = self;\n    [_previewView setSingleTapGestureBlock:^{\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        [strongSelf signleTapAction];\n    }];\n    [self.contentView addSubview:_previewView];\n}\n\n- (void)setModel:(TZAssetModel *)model {\n    [super setModel:model];\n    _previewView.model = self.model;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    _previewView.frame = self.bounds;\n}\n\n#pragma mark - Click Event\n\n- (void)signleTapAction {    \n    if (self.singleTapGestureBlock) {\n        self.singleTapGestureBlock();\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.h",
    "content": "//\n//  TZPhotoPreviewController.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface TZPhotoPreviewController : UIViewController\n\n@property (nonatomic, strong) NSMutableArray *models;                  ///< All photo models / 所有图片模型数组\n@property (nonatomic, strong) NSMutableArray *photos;                  ///< All photos  / 所有图片数组\n@property (nonatomic, assign) NSInteger currentIndex;           ///< Index of the photo user click / 用户点击的图片的索引\n@property (nonatomic, assign) BOOL isSelectOriginalPhoto;       ///< If YES,return original photo / 是否返回原图\n@property (nonatomic, assign) BOOL isCropImage;\n\n/// Return the new selected photos / 返回最新的选中图片数组\n@property (nonatomic, copy) void (^backButtonClickBlock)(BOOL isSelectOriginalPhoto);\n@property (nonatomic, copy) void (^doneButtonClickBlock)(BOOL isSelectOriginalPhoto);\n@property (nonatomic, copy) void (^doneButtonClickBlockCropMode)(UIImage *cropedImage,id asset);\n@property (nonatomic, copy) void (^doneButtonClickBlockWithPreviewType)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto);\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m",
    "content": "//\n//  TZPhotoPreviewController.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/12/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import \"TZPhotoPreviewController.h\"\n#import \"TZPhotoPreviewCell.h\"\n#import \"TZAssetModel.h\"\n#import \"UIView+TZLayout.h\"\n#import \"TZImagePickerController.h\"\n#import \"TZImageManager.h\"\n#import \"TZImageCropManager.h\"\n\n@interface TZPhotoPreviewController ()<UICollectionViewDataSource,UICollectionViewDelegate,UIScrollViewDelegate> {\n    UICollectionView *_collectionView;\n    UICollectionViewFlowLayout *_layout;\n    NSArray *_photosTemp;\n    NSArray *_assetsTemp;\n    \n    UIView *_naviBar;\n    UIButton *_backButton;\n    UIButton *_selectButton;\n    UILabel *_indexLabel;\n    \n    UIView *_toolBar;\n    UIButton *_doneButton;\n    UIImageView *_numberImageView;\n    UILabel *_numberLabel;\n    UIButton *_originalPhotoButton;\n    UILabel *_originalPhotoLabel;\n    \n    CGFloat _offsetItemCount;\n    \n    BOOL _didSetIsSelectOriginalPhoto;\n}\n@property (nonatomic, assign) BOOL isHideNaviBar;\n@property (nonatomic, strong) UIView *cropBgView;\n@property (nonatomic, strong) UIView *cropView;\n\n@property (nonatomic, assign) double progress;\n@property (strong, nonatomic) UIAlertController *alertView;\n@property (nonatomic, strong) UIView *iCloudErrorView;\n@end\n\n@implementation TZPhotoPreviewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    [TZImageManager manager].shouldFixOrientation = YES;\n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (!_didSetIsSelectOriginalPhoto) {\n        _isSelectOriginalPhoto = _tzImagePickerVc.isSelectOriginalPhoto;\n    }\n    if (!self.models.count) {\n        self.models = [NSMutableArray arrayWithArray:_tzImagePickerVc.selectedModels];\n        _assetsTemp = [NSMutableArray arrayWithArray:_tzImagePickerVc.selectedAssets];\n    }\n    [self configCollectionView];\n    [self configCustomNaviBar];\n    [self configBottomToolBar];\n    self.view.clipsToBounds = YES;\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeStatusBarOrientationNotification:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];\n}\n\n- (void)setIsSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto {\n    _isSelectOriginalPhoto = isSelectOriginalPhoto;\n    _didSetIsSelectOriginalPhoto = YES;\n}\n\n- (void)setPhotos:(NSMutableArray *)photos {\n    _photos = photos;\n    _photosTemp = [NSArray arrayWithArray:photos];\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    [self.navigationController setNavigationBarHidden:YES animated:YES];\n    [UIApplication sharedApplication].statusBarHidden = YES;\n    if (_currentIndex) {\n        [_collectionView setContentOffset:CGPointMake((self.view.tz_width + 20) * self.currentIndex, 0) animated:NO];\n    }\n    [self refreshNaviBarAndBottomBarState];\n}\n\n- (void)viewWillDisappear:(BOOL)animated {\n    [super viewWillDisappear:animated];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc.needShowStatusBar) {\n        [UIApplication sharedApplication].statusBarHidden = NO;\n    }\n    [self.navigationController setNavigationBarHidden:NO animated:YES];\n    [TZImageManager manager].shouldFixOrientation = NO;\n}\n\n- (BOOL)prefersStatusBarHidden {\n    return YES;\n}\n\n- (void)configCustomNaviBar {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    \n    _naviBar = [[UIView alloc] initWithFrame:CGRectZero];\n    _naviBar.backgroundColor = [UIColor colorWithRed:(34/255.0) green:(34/255.0)  blue:(34/255.0) alpha:0.7];\n    \n    _backButton = [[UIButton alloc] initWithFrame:CGRectZero];\n    [_backButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"navi_back\"] forState:UIControlStateNormal];\n    [_backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];\n    [_backButton addTarget:self action:@selector(backButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    \n    _selectButton = [[UIButton alloc] initWithFrame:CGRectZero];\n    [_selectButton setImage:tzImagePickerVc.photoDefImage forState:UIControlStateNormal];\n    [_selectButton setImage:tzImagePickerVc.photoSelImage forState:UIControlStateSelected];\n    _selectButton.imageView.clipsToBounds = YES;\n    _selectButton.imageEdgeInsets = UIEdgeInsetsMake(10, 0, 10, 0);\n    _selectButton.imageView.contentMode = UIViewContentModeScaleAspectFit;\n    [_selectButton addTarget:self action:@selector(select:) forControlEvents:UIControlEventTouchUpInside];\n    _selectButton.hidden = !tzImagePickerVc.showSelectBtn;\n    \n    _indexLabel = [[UILabel alloc] init];\n    _indexLabel.adjustsFontSizeToFitWidth = YES;\n    _indexLabel.font = [UIFont systemFontOfSize:14];\n    _indexLabel.textColor = [UIColor whiteColor];\n    _indexLabel.textAlignment = NSTextAlignmentCenter;\n    \n    [_naviBar addSubview:_selectButton];\n    [_naviBar addSubview:_indexLabel];\n    [_naviBar addSubview:_backButton];\n    [self.view addSubview:_naviBar];\n}\n\n- (void)configBottomToolBar {\n    _toolBar = [[UIView alloc] initWithFrame:CGRectZero];\n    static CGFloat rgb = 34 / 255.0;\n    _toolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.7];\n    \n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (_tzImagePickerVc.allowPickingOriginalPhoto) {\n        _originalPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        _originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, [TZCommonTools tz_isRightToLeftLayout] ? 10 : -10, 0, 0);\n        _originalPhotoButton.backgroundColor = [UIColor clearColor];\n        [_originalPhotoButton addTarget:self action:@selector(originalPhotoButtonClick) forControlEvents:UIControlEventTouchUpInside];\n        _originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:13];\n        [_originalPhotoButton setTitle:_tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal];\n        [_originalPhotoButton setTitle:_tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected];\n        [_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];\n        [_originalPhotoButton setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];\n        [_originalPhotoButton setImage:_tzImagePickerVc.photoPreviewOriginDefImage forState:UIControlStateNormal];\n        [_originalPhotoButton setImage:_tzImagePickerVc.photoOriginSelImage forState:UIControlStateSelected];\n        \n        _originalPhotoLabel = [[UILabel alloc] init];\n        _originalPhotoLabel.textAlignment = NSTextAlignmentLeft;\n        _originalPhotoLabel.font = [UIFont systemFontOfSize:13];\n        _originalPhotoLabel.textColor = [UIColor whiteColor];\n        _originalPhotoLabel.backgroundColor = [UIColor clearColor];\n        if (_isSelectOriginalPhoto) [self showPhotoBytes];\n    }\n    \n    _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    [_doneButton setTitle:_tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];\n    [_doneButton setTitleColor:_tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];\n    \n    _numberImageView = [[UIImageView alloc] initWithImage:_tzImagePickerVc.photoNumberIconImage];\n    _numberImageView.backgroundColor = [UIColor clearColor];\n    _numberImageView.clipsToBounds = YES;\n    _numberImageView.contentMode = UIViewContentModeScaleAspectFit;\n    _numberImageView.hidden = _tzImagePickerVc.selectedModels.count <= 0;\n    \n    _numberLabel = [[UILabel alloc] init];\n    _numberLabel.font = [UIFont systemFontOfSize:15];\n    _numberLabel.adjustsFontSizeToFitWidth = YES;\n    _numberLabel.textColor = [UIColor whiteColor];\n    _numberLabel.textAlignment = NSTextAlignmentCenter;\n    _numberLabel.text = [NSString stringWithFormat:@\"%zd\",_tzImagePickerVc.selectedModels.count];\n    _numberLabel.hidden = _tzImagePickerVc.selectedModels.count <= 0;\n    _numberLabel.backgroundColor = [UIColor clearColor];\n    _numberLabel.userInteractionEnabled = YES;\n    \n    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doneButtonClick)];\n    [_numberLabel addGestureRecognizer:tapGesture];\n    \n    [_originalPhotoButton addSubview:_originalPhotoLabel];\n    [_toolBar addSubview:_doneButton];\n    [_toolBar addSubview:_originalPhotoButton];\n    [_toolBar addSubview:_numberImageView];\n    [_toolBar addSubview:_numberLabel];\n    [self.view addSubview:_toolBar];\n    \n    if (_tzImagePickerVc.photoPreviewPageUIConfigBlock) {\n        _tzImagePickerVc.photoPreviewPageUIConfigBlock(_collectionView, _naviBar, _backButton, _selectButton, _indexLabel, _toolBar, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel);\n    }\n}\n\n- (void)configCollectionView {\n    _layout = [[UICollectionViewFlowLayout alloc] init];\n    _layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;\n    _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];\n    _collectionView.backgroundColor = [UIColor blackColor];\n    _collectionView.dataSource = self;\n    _collectionView.delegate = self;\n    _collectionView.pagingEnabled = YES;\n    _collectionView.scrollsToTop = NO;\n    _collectionView.showsHorizontalScrollIndicator = NO;\n    _collectionView.contentOffset = CGPointMake(0, 0);\n    _collectionView.contentSize = CGSizeMake(self.models.count * (self.view.tz_width + 20), 0);\n    if (@available(iOS 11, *)) {\n        _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;\n    }\n    [self.view addSubview:_collectionView];\n    [_collectionView registerClass:[TZPhotoPreviewCell class] forCellWithReuseIdentifier:@\"TZPhotoPreviewCell\"];\n    [_collectionView registerClass:[TZPhotoPreviewCell class] forCellWithReuseIdentifier:@\"TZPhotoPreviewCellGIF\"];\n    [_collectionView registerClass:[TZVideoPreviewCell class] forCellWithReuseIdentifier:@\"TZVideoPreviewCell\"];\n    [_collectionView registerClass:[TZGifPreviewCell class] forCellWithReuseIdentifier:@\"TZGifPreviewCell\"];\n    \n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (_tzImagePickerVc.scaleAspectFillCrop && _tzImagePickerVc.allowCrop) {\n        _collectionView.scrollEnabled = NO;\n    }\n}\n\n- (void)configCropView {\n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (_tzImagePickerVc.maxImagesCount <= 1 && _tzImagePickerVc.allowCrop && _tzImagePickerVc.allowPickingImage) {\n        [_cropView removeFromSuperview];\n        [_cropBgView removeFromSuperview];\n        \n        _cropBgView = [UIView new];\n        _cropBgView.userInteractionEnabled = NO;\n        _cropBgView.frame = self.view.bounds;\n        _cropBgView.backgroundColor = [UIColor clearColor];\n        [self.view addSubview:_cropBgView];\n        [TZImageCropManager overlayClippingWithView:_cropBgView cropRect:_tzImagePickerVc.cropRect containerView:self.view needCircleCrop:_tzImagePickerVc.needCircleCrop];\n        \n        _cropView = [UIView new];\n        _cropView.userInteractionEnabled = NO;\n        _cropView.frame = _tzImagePickerVc.cropRect;\n        _cropView.backgroundColor = [UIColor clearColor];\n        _cropView.layer.borderColor = [UIColor whiteColor].CGColor;\n        _cropView.layer.borderWidth = 1.0;\n        if (_tzImagePickerVc.needCircleCrop) {\n            _cropView.layer.cornerRadius = _tzImagePickerVc.cropRect.size.width / 2;\n            _cropView.clipsToBounds = YES;\n        }\n        [self.view addSubview:_cropView];\n        if (_tzImagePickerVc.cropViewSettingBlock) {\n            _tzImagePickerVc.cropViewSettingBlock(_cropView);\n        }\n        \n        [self.view bringSubviewToFront:_naviBar];\n        [self.view bringSubviewToFront:_toolBar];\n    }\n}\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    \n    BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;\n    CGFloat statusBarHeight = isFullScreen ? [TZCommonTools tz_statusBarHeight] : 0;\n    CGFloat statusBarHeightInterval = isFullScreen ? (statusBarHeight - 20) : 0;\n    CGFloat naviBarHeight = statusBarHeight + _tzImagePickerVc.navigationBar.tz_height;\n    _naviBar.frame = CGRectMake(0, 0, self.view.tz_width, naviBarHeight);\n    _backButton.frame = CGRectMake(10, 10 + statusBarHeightInterval, 44, 44);\n    _selectButton.frame = CGRectMake(self.view.tz_width - 56, 10 + statusBarHeightInterval, 44, 44);\n    _indexLabel.frame = _selectButton.frame;\n    \n    _layout.itemSize = CGSizeMake(self.view.tz_width + 20, self.view.tz_height);\n    _layout.minimumInteritemSpacing = 0;\n    _layout.minimumLineSpacing = 0;\n    _collectionView.frame = CGRectMake(-10, 0, self.view.tz_width + 20, self.view.tz_height);\n    [_collectionView setCollectionViewLayout:_layout];\n    if (_offsetItemCount > 0) {\n        CGFloat offsetX = _offsetItemCount * _layout.itemSize.width;\n        [_collectionView setContentOffset:CGPointMake(offsetX, 0)];\n    }\n    if (_tzImagePickerVc.allowCrop) {\n        [_collectionView reloadData];\n    }\n    \n    CGFloat toolBarHeight = 44 + [TZCommonTools tz_safeAreaInsets].bottom;\n    CGFloat toolBarTop = self.view.tz_height - toolBarHeight;\n    _toolBar.frame = CGRectMake(0, toolBarTop, self.view.tz_width, toolBarHeight);\n    if (_tzImagePickerVc.allowPickingOriginalPhoto) {\n        CGFloat fullImageWidth = [_tzImagePickerVc.fullImageBtnTitleStr boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} context:nil].size.width;\n        _originalPhotoButton.frame = CGRectMake(0, 0, fullImageWidth + 56, 44);\n        _originalPhotoLabel.frame = CGRectMake(fullImageWidth + 42, 0, 80, 44);\n    }\n    [_doneButton sizeToFit];\n    _doneButton.frame = CGRectMake(self.view.tz_width - _doneButton.tz_width - 12, 0, MAX(44, _doneButton.tz_width), 44);\n    _numberImageView.frame = CGRectMake(_doneButton.tz_left - 24 - 5, 10, 24, 24);\n    _numberLabel.frame = _numberImageView.frame;\n    \n    [self configCropView];\n    \n    if (_tzImagePickerVc.photoPreviewPageDidLayoutSubviewsBlock) {\n        _tzImagePickerVc.photoPreviewPageDidLayoutSubviewsBlock(_collectionView, _naviBar, _backButton, _selectButton, _indexLabel, _toolBar, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel);\n    }\n}\n\n#pragma mark - Notification\n\n- (void)didChangeStatusBarOrientationNotification:(NSNotification *)noti {\n    _offsetItemCount = _collectionView.contentOffset.x / _layout.itemSize.width;\n}\n\n#pragma mark - Click Event\n\n- (void)select:(UIButton *)selectButton {\n    [self select:selectButton refreshCount:YES];\n}\n\n- (void)select:(UIButton *)selectButton refreshCount:(BOOL)refreshCount {\n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    TZAssetModel *model = _models[self.currentIndex];\n    if (!selectButton.isSelected) {\n        // 1. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制\n        if (_tzImagePickerVc.selectedModels.count >= _tzImagePickerVc.maxImagesCount) {\n            NSString *title = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Select a maximum of %zd photos\"], _tzImagePickerVc.maxImagesCount];\n            [_tzImagePickerVc showAlertWithTitle:title];\n            return;\n            // 2. if not over the maxImagesCount / 如果没有超过最大个数限制\n        } else {\n            if ([[TZImageManager manager] isAssetCannotBeSelected:model.asset]) {\n                return;\n            }\n            [_tzImagePickerVc addSelectedModel:model];\n            [self setAsset:model.asset isSelect:YES];\n            if (self.photos) {\n                [_tzImagePickerVc.selectedAssets addObject:_assetsTemp[self.currentIndex]];\n                [self.photos addObject:_photosTemp[self.currentIndex]];\n            }\n            if (model.type == TZAssetModelMediaTypeVideo && !_tzImagePickerVc.allowPickingMultipleVideo) {\n                [_tzImagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@\"Select the video when in multi state, we will handle the video as a photo\"]];\n            }\n        }\n    } else {\n        NSArray *selectedModels = [NSArray arrayWithArray:_tzImagePickerVc.selectedModels];\n        for (TZAssetModel *model_item in selectedModels) {\n            if ([model.asset.localIdentifier isEqualToString:model_item.asset.localIdentifier]) {\n                // 1.6.7版本更新:防止有多个一样的model,一次性被移除了\n                NSArray *selectedModelsTmp = [NSArray arrayWithArray:_tzImagePickerVc.selectedModels];\n                for (NSInteger i = 0; i < selectedModelsTmp.count; i++) {\n                    TZAssetModel *model = selectedModelsTmp[i];\n                    if ([model isEqual:model_item]) {\n                        [_tzImagePickerVc removeSelectedModel:model];\n                        // [_tzImagePickerVc.selectedModels removeObjectAtIndex:i];\n                        break;\n                    }\n                }\n                if (self.photos) {\n                    // 1.6.7版本更新:防止有多个一样的asset,一次性被移除了\n                    NSArray *selectedAssetsTmp = [NSArray arrayWithArray:_tzImagePickerVc.selectedAssets];\n                    for (NSInteger i = 0; i < selectedAssetsTmp.count; i++) {\n                        id asset = selectedAssetsTmp[i];\n                        if ([asset isEqual:_assetsTemp[self.currentIndex]]) {\n                            [_tzImagePickerVc.selectedAssets removeObjectAtIndex:i];\n                            break;\n                        }\n                    }\n                    // [_tzImagePickerVc.selectedAssets removeObject:_assetsTemp[self.currentIndex]];\n                    [self.photos removeObject:_photosTemp[self.currentIndex]];\n                }\n                [self setAsset:model.asset isSelect:NO];\n                break;\n            }\n        }\n    }\n    model.isSelected = !selectButton.isSelected;\n    if (refreshCount) {\n        [self refreshNaviBarAndBottomBarState];\n    }\n    if (model.isSelected) {\n        [UIView showOscillatoryAnimationWithLayer:selectButton.imageView.layer type:TZOscillatoryAnimationToBigger];\n    }\n    [UIView showOscillatoryAnimationWithLayer:_numberImageView.layer type:TZOscillatoryAnimationToSmaller];\n}\n\n- (void)backButtonClick {\n    if (self.navigationController.childViewControllers.count < 2) {\n        [self.navigationController dismissViewControllerAnimated:YES completion:nil];\n        if ([self.navigationController isKindOfClass: [TZImagePickerController class]]) {\n            TZImagePickerController *nav = (TZImagePickerController *)self.navigationController;\n            if (nav.imagePickerControllerDidCancelHandle) {\n                nav.imagePickerControllerDidCancelHandle();\n            }\n        }\n        return;\n    }\n    [self.navigationController popViewControllerAnimated:YES];\n    if (self.backButtonClickBlock) {\n        self.backButtonClickBlock(_isSelectOriginalPhoto);\n    }\n}\n\n- (void)doneButtonClick {\n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    // 如果图片正在从iCloud同步中,提醒用户\n    if (_progress > 0 && _progress < 1 && (_selectButton.isSelected || !_tzImagePickerVc.selectedModels.count )) {\n        _alertView = [_tzImagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@\"Synchronizing photos from iCloud\"]];\n        return;\n    }\n    \n    // 如果没有选中过照片 点击确定时选中当前预览的照片\n    if (_tzImagePickerVc.selectedModels.count == 0 && _tzImagePickerVc.minImagesCount <= 0 && _tzImagePickerVc.autoSelectCurrentWhenDone) {\n        TZAssetModel *model = _models[self.currentIndex];\n        if ([[TZImageManager manager] isAssetCannotBeSelected:model.asset]) {\n            return;\n        }\n        [self select:_selectButton refreshCount:NO];\n    }\n    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.currentIndex inSection:0];\n    TZPhotoPreviewCell *cell = (TZPhotoPreviewCell *)[_collectionView cellForItemAtIndexPath:indexPath];\n    if (_tzImagePickerVc.allowCrop && [cell isKindOfClass:[TZPhotoPreviewCell class]]) { // 裁剪状态\n        _doneButton.enabled = NO;\n        [_tzImagePickerVc showProgressHUD];\n        UIImage *cropedImage = [TZImageCropManager cropImageView:cell.previewView.imageView toRect:_tzImagePickerVc.cropRect zoomScale:cell.previewView.scrollView.zoomScale containerView:self.view];\n        if (_tzImagePickerVc.needCircleCrop) {\n            cropedImage = [TZImageCropManager circularClipImage:cropedImage];\n        }\n        _doneButton.enabled = YES;\n        [_tzImagePickerVc hideProgressHUD];\n        if (self.doneButtonClickBlockCropMode) {\n            TZAssetModel *model = _models[self.currentIndex];\n            self.doneButtonClickBlockCropMode(cropedImage,model.asset);\n        }\n    } else if (self.doneButtonClickBlock) { // 非裁剪状态\n        self.doneButtonClickBlock(_isSelectOriginalPhoto);\n    }\n    if (self.doneButtonClickBlockWithPreviewType) {\n        self.doneButtonClickBlockWithPreviewType(self.photos,_tzImagePickerVc.selectedAssets,self.isSelectOriginalPhoto);\n    }\n}\n\n- (void)originalPhotoButtonClick {\n    TZAssetModel *model = _models[self.currentIndex];\n    if ([[TZImageManager manager] isAssetCannotBeSelected:model.asset]) {\n        return;\n    }\n    _originalPhotoButton.selected = !_originalPhotoButton.isSelected;\n    _isSelectOriginalPhoto = _originalPhotoButton.isSelected;\n    _originalPhotoLabel.hidden = !_originalPhotoButton.isSelected;\n    if (_isSelectOriginalPhoto) {\n        [self showPhotoBytes];\n        if (!_selectButton.isSelected) {\n            // 如果当前已选择照片张数 < 最大可选张数 && 最大可选张数大于1，就选中该张图\n            TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n            if (_tzImagePickerVc.selectedModels.count < _tzImagePickerVc.maxImagesCount && _tzImagePickerVc.showSelectBtn) {\n                [self select:_selectButton];\n            }\n        }\n    }\n}\n\n- (void)didTapPreviewCell {\n    self.isHideNaviBar = !self.isHideNaviBar;\n    _naviBar.hidden = self.isHideNaviBar;\n    _toolBar.hidden = self.isHideNaviBar;\n}\n\n#pragma mark - UIScrollViewDelegate\n\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n    CGFloat offSetWidth = scrollView.contentOffset.x;\n    offSetWidth = offSetWidth +  ((self.view.tz_width + 20) * 0.5);\n    \n    NSInteger currentIndex = offSetWidth / (self.view.tz_width + 20);\n    if (currentIndex < _models.count && _currentIndex != currentIndex) {\n        _currentIndex = currentIndex;\n        [self refreshNaviBarAndBottomBarState];\n    }\n    [[NSNotificationCenter defaultCenter] postNotificationName:@\"photoPreviewCollectionViewDidScroll\" object:nil];\n}\n\n#pragma mark - UICollectionViewDataSource && Delegate\n\n- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n    return _models.count;\n}\n\n- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    TZAssetModel *model = _models[indexPath.item];\n    \n    TZAssetPreviewCell *cell;\n    __weak typeof(self) weakSelf = self;\n    if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypeVideo) {\n        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"TZVideoPreviewCell\" forIndexPath:indexPath];\n        TZVideoPreviewCell *currentCell = (TZVideoPreviewCell *)cell;\n        currentCell.iCloudSyncFailedHandle = ^(id asset, BOOL isSyncFailed) {\n            model.iCloudFailed = isSyncFailed;\n            [weakSelf didICloudSyncStatusChanged:model];\n        };\n    } else if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypePhotoGif && _tzImagePickerVc.allowPickingGif) {\n        cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"TZGifPreviewCell\" forIndexPath:indexPath];\n        TZGifPreviewCell *currentCell = (TZGifPreviewCell *)cell;\n        currentCell.previewView.iCloudSyncFailedHandle = ^(id asset, BOOL isSyncFailed) {\n            model.iCloudFailed = isSyncFailed;\n            [weakSelf didICloudSyncStatusChanged:model];\n        };\n    } else {\n        NSString *reuseId = model.type == TZAssetModelMediaTypePhotoGif ? @\"TZPhotoPreviewCellGIF\" : @\"TZPhotoPreviewCell\";\n        cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseId forIndexPath:indexPath];\n        TZPhotoPreviewCell *photoPreviewCell = (TZPhotoPreviewCell *)cell;\n        photoPreviewCell.cropRect = _tzImagePickerVc.cropRect;\n        photoPreviewCell.allowCrop = _tzImagePickerVc.allowCrop;\n        photoPreviewCell.scaleAspectFillCrop = _tzImagePickerVc.scaleAspectFillCrop;\n        __weak typeof(_collectionView) weakCollectionView = _collectionView;\n        __weak typeof(photoPreviewCell) weakCell = photoPreviewCell;\n        [photoPreviewCell setImageProgressUpdateBlock:^(double progress) {\n            __strong typeof(weakSelf) strongSelf = weakSelf;\n            __strong typeof(weakCollectionView) strongCollectionView = weakCollectionView;\n            __strong typeof(weakCell) strongCell = weakCell;\n            strongSelf.progress = progress;\n            if (progress >= 1) {\n                if (strongSelf.isSelectOriginalPhoto) [strongSelf showPhotoBytes];\n                if (strongSelf.alertView && [strongCollectionView.visibleCells containsObject:strongCell]) {\n                    [strongSelf.alertView dismissViewControllerAnimated:YES completion:^{\n                        strongSelf.alertView = nil;\n                        [strongSelf doneButtonClick];\n                    }];\n                }\n            }\n        }];\n        photoPreviewCell.previewView.iCloudSyncFailedHandle = ^(id asset, BOOL isSyncFailed) {\n            model.iCloudFailed = isSyncFailed;\n            [weakSelf didICloudSyncStatusChanged:model];\n        };\n    }\n    \n    cell.model = model;\n    [cell setSingleTapGestureBlock:^{\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        [strongSelf didTapPreviewCell];\n    }];\n\n    return cell;\n}\n\n- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {\n    if ([cell isKindOfClass:[TZPhotoPreviewCell class]]) {\n        [(TZPhotoPreviewCell *)cell recoverSubviews];\n    }\n}\n\n- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {\n    if ([cell isKindOfClass:[TZPhotoPreviewCell class]]) {\n        [(TZPhotoPreviewCell *)cell recoverSubviews];\n    } else if ([cell isKindOfClass:[TZVideoPreviewCell class]]) {\n        TZVideoPreviewCell *videoCell = (TZVideoPreviewCell *)cell;\n        if (videoCell.player && videoCell.player.rate != 0.0) {\n            [videoCell pausePlayerAndShowNaviBar];\n        }\n    }\n}\n\n#pragma mark - Private Method\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n    // NSLog(@\"%@ dealloc\",NSStringFromClass(self.class));\n}\n\n- (void)refreshNaviBarAndBottomBarState {\n    TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    TZAssetModel *model = _models[self.currentIndex];\n    _selectButton.selected = model.isSelected;\n    [self refreshSelectButtonImageViewContentMode];\n    if (_selectButton.isSelected && _tzImagePickerVc.showSelectedIndex && _tzImagePickerVc.showSelectBtn) {\n        NSString *index = [NSString stringWithFormat:@\"%d\", (int)([_tzImagePickerVc.selectedAssetIds indexOfObject:model.asset.localIdentifier] + 1)];\n        _indexLabel.text = index;\n        _indexLabel.hidden = NO;\n    } else {\n        _indexLabel.hidden = YES;\n    }\n    _numberLabel.text = [NSString stringWithFormat:@\"%zd\",_tzImagePickerVc.selectedModels.count];\n    _numberImageView.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage);\n    _numberLabel.hidden = (_tzImagePickerVc.selectedModels.count <= 0 || _isHideNaviBar || _isCropImage);\n    \n    _originalPhotoButton.selected = _isSelectOriginalPhoto;\n    _originalPhotoLabel.hidden = !_originalPhotoButton.isSelected;\n    if (_isSelectOriginalPhoto) [self showPhotoBytes];\n    \n    // If is previewing video, hide original photo button\n    // 如果正在预览的是视频，隐藏原图按钮\n    if (!_isHideNaviBar) {\n        if (model.type == TZAssetModelMediaTypeVideo) {\n            _originalPhotoButton.hidden = YES;\n            _originalPhotoLabel.hidden = YES;\n        } else {\n            _originalPhotoButton.hidden = NO;\n            if (_isSelectOriginalPhoto) _originalPhotoLabel.hidden = NO;\n        }\n    }\n    \n    _doneButton.hidden = NO;\n    _selectButton.hidden = !_tzImagePickerVc.showSelectBtn;\n    // 让宽度/高度小于 最小可选照片尺寸 的图片不能选中\n    if (![[TZImageManager manager] isPhotoSelectableWithAsset:model.asset]) {\n        _numberLabel.hidden = YES;\n        _numberImageView.hidden = YES;\n        _selectButton.hidden = YES;\n        _originalPhotoButton.hidden = YES;\n        _originalPhotoLabel.hidden = YES;\n        _doneButton.hidden = YES;\n    }\n    // iCloud同步失败的UI刷新\n    [self didICloudSyncStatusChanged:model];\n    if (_tzImagePickerVc.photoPreviewPageDidRefreshStateBlock) {\n        _tzImagePickerVc.photoPreviewPageDidRefreshStateBlock(_collectionView, _naviBar, _backButton, _selectButton, _indexLabel, _toolBar, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel);\n    }\n}\n\n- (void)refreshSelectButtonImageViewContentMode {\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        if (self->_selectButton.imageView.image.size.width <= 27) {\n            self->_selectButton.imageView.contentMode = UIViewContentModeCenter;\n        } else {\n            self->_selectButton.imageView.contentMode = UIViewContentModeScaleAspectFit;\n        }\n    });\n}\n\n- (void)didICloudSyncStatusChanged:(TZAssetModel *)model{\n    dispatch_async(dispatch_get_main_queue(), ^{\n        TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n        // onlyReturnAsset为NO时,依赖TZ返回大图,所以需要有iCloud同步失败的提示,并且不能选择,\n        if (_tzImagePickerVc.onlyReturnAsset) {\n            return;\n        }\n        TZAssetModel *currentModel = self.models[self.currentIndex];\n        if (_tzImagePickerVc.selectedModels.count <= 0) {\n            self->_doneButton.enabled = !currentModel.iCloudFailed;\n        } else {\n            self->_doneButton.enabled = YES;\n        }\n        self->_selectButton.hidden = currentModel.iCloudFailed || !_tzImagePickerVc.showSelectBtn;\n        if (currentModel.iCloudFailed) {\n            self->_originalPhotoButton.hidden = YES;\n            self->_originalPhotoLabel.hidden = YES;\n        }\n    });\n}\n\n- (void)showPhotoBytes {\n    [[TZImageManager manager] getPhotosBytesWithArray:@[_models[self.currentIndex]] completion:^(NSString *totalBytes) {\n        self->_originalPhotoLabel.text = [NSString stringWithFormat:@\"(%@)\",totalBytes];\n    }];\n}\n\n- (NSInteger)currentIndex {\n    return [TZCommonTools tz_isRightToLeftLayout] ? self.models.count - _currentIndex - 1 : _currentIndex;\n}\n\n/// 选中/取消选中某张照片\n- (void)setAsset:(PHAsset *)asset isSelect:(BOOL)isSelect {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (isSelect && [tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didSelectAsset:photo:isSelectOriginalPhoto:)]) {\n        [self callDelegate:asset isSelect:YES];\n    }\n    if (!isSelect && [tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didDeselectAsset:photo:isSelectOriginalPhoto:)]) {\n        [self callDelegate:asset isSelect:NO];\n    }\n}\n\n/// 调用选中/取消选中某张照片的代理方法\n- (void)callDelegate:(PHAsset *)asset isSelect:(BOOL)isSelect {\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    __weak typeof(self) weakSelf = self;\n    __weak typeof(tzImagePickerVc) weakImagePickerVc= tzImagePickerVc;\n    [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        if (isDegraded) return;\n        __strong typeof(weakSelf) strongSelf = weakSelf;\n        __strong typeof(weakImagePickerVc) strongImagePickerVc = weakImagePickerVc;\n        if (isSelect) {\n            [strongImagePickerVc.pickerDelegate imagePickerController:strongImagePickerVc didSelectAsset:asset photo:photo isSelectOriginalPhoto:strongSelf.isSelectOriginalPhoto];\n        } else {\n            [strongImagePickerVc.pickerDelegate imagePickerController:strongImagePickerVc didDeselectAsset:asset photo:photo isSelectOriginalPhoto:strongSelf.isSelectOriginalPhoto];\n        }\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZProgressView.h",
    "content": "//\n//  TZProgressView.h\n//  TZImagePickerController\n//\n//  Created by ttouch on 2016/12/6.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface TZProgressView : UIView\n\n@property (nonatomic, assign) double progress;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZProgressView.m",
    "content": "//\n//  TZProgressView.m\n//  TZImagePickerController\n//\n//  Created by ttouch on 2016/12/6.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import \"TZProgressView.h\"\n\n@interface TZProgressView ()\n@property (nonatomic, strong) CAShapeLayer *progressLayer;\n@end\n\n@implementation TZProgressView\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        self.backgroundColor = [UIColor clearColor];\n        \n        _progressLayer = [CAShapeLayer layer];\n        _progressLayer.fillColor = [[UIColor clearColor] CGColor];\n        _progressLayer.strokeColor = [[UIColor whiteColor] CGColor];\n        _progressLayer.opacity = 1;\n        _progressLayer.lineCap = kCALineCapRound;\n        _progressLayer.lineWidth = 5;\n        \n        [_progressLayer setShadowColor:[UIColor blackColor].CGColor];\n        [_progressLayer setShadowOffset:CGSizeMake(1, 1)];\n        [_progressLayer setShadowOpacity:0.5];\n        [_progressLayer setShadowRadius:2];\n    }\n    return self;\n}\n\n- (void)drawRect:(CGRect)rect {\n    CGPoint center = CGPointMake(rect.size.width / 2, rect.size.height / 2);\n    CGFloat radius = rect.size.width / 2;\n    CGFloat startA = - M_PI_2;\n    CGFloat endA = - M_PI_2 + M_PI * 2 * _progress;\n    _progressLayer.frame = self.bounds;\n    UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:startA endAngle:endA clockwise:YES];\n    _progressLayer.path =[path CGPath];\n    \n    [_progressLayer removeFromSuperlayer];\n    [self.layer addSublayer:_progressLayer];\n}\n\n- (void)setProgress:(double)progress {\n    _progress = progress;\n    [self setNeedsDisplay];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZVideoCropController.h",
    "content": "//\n//  TZVideoCropController.h\n//  TZImagePickerController\n//\n//  Created by 肖兰月 on 2021/5/27.\n//  Copyright © 2021 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class TZAssetModel,TZImagePickerController;\n\n@interface TZVideoCropController : UIViewController<UIViewControllerTransitioningDelegate>\n@property (nonatomic, strong) TZAssetModel *model;\n@property (nonatomic, weak) TZImagePickerController *imagePickerVc;\n@end\n\n@protocol TZVideoEditViewDelegate <NSObject>\n- (void)editViewCropRectBeginChange;\n- (void)editViewCropRectEndChange;\n@end\n\n@interface TZVideoEditView : UIView\n@property (strong, nonatomic) UIImageView *beginImgView;\n@property (strong, nonatomic) UIImageView *endImgView;\n@property (strong, nonatomic) UIView *indicatorLine;\n@property (assign, nonatomic) CGFloat videoDuration;\n@property (assign, nonatomic) NSInteger maxCropVideoDuration;\n@property (assign, nonatomic) CGRect cropRect;\n@property (assign, nonatomic) CGFloat allImgWidth;\n@property (assign, nonatomic) CGFloat minCropRectWidth;\n\n@property (nonatomic, weak) id<TZVideoEditViewDelegate> delegate;\n\n- (void)resetIndicatorLine;\n- (void)indicatorLineAnimateWithDuration:(NSTimeInterval)duration cropRect:(CGRect)cropRect;\n@end\n\n\n\n@interface TZVideoPictureCell : UICollectionViewCell\n@property (strong, nonatomic) UIImageView *imgView;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZVideoCropController.m",
    "content": "//\n//  TZVideoCropController.m\n//  TZImagePickerController\n//\n//  Created by 肖兰月 on 2021/5/27.\n//  Copyright © 2021 谭真. All rights reserved.\n//\n\n#import \"TZVideoCropController.h\"\n#import <MediaPlayer/MediaPlayer.h>\n#import \"UIView+TZLayout.h\"\n#import \"TZImageManager.h\"\n#import \"TZAssetModel.h\"\n#import \"TZImagePickerController.h\"\n\n@interface TZVideoCropController ()<TZVideoEditViewDelegate,UICollectionViewDelegate, UICollectionViewDataSource> {\n    AVPlayer *_player;\n    AVPlayerLayer *_playerLayer;\n    UIButton *_playButton;\n    UIImage *_cover;\n    NSString *_outputPath;\n    NSString *_errorMsg;\n    \n    UIButton *_cancelButton;\n    UIButton *_doneButton;\n    UIProgressView *_progress;\n    UILabel *_cropVideoDurationLabel;\n    \n    AVAssetImageGenerator *_imageGenerator;\n    AVAsset *_asset;\n    \n    CGFloat _collectionViewBeginOffsetX;\n    BOOL _isPlayed;\n    CGFloat _itemW;\n    BOOL _isDraging;\n    \n    UIStatusBarStyle _originStatusBarStyle;\n}\n\n// iCloud无法同步提示UI\n@property (nonatomic, strong) UIView *iCloudErrorView;\n@property (strong, nonatomic) UICollectionView *collectionView;\n@property (strong, nonatomic) TZVideoEditView *videoEditView;\n@property (strong, nonatomic) NSMutableArray *videoImgArray;\n@property (strong, nonatomic) NSArray *imageTimes;\n@property (strong, nonatomic) NSTimer *timer;\n\n@end\n\n@implementation TZVideoCropController\n\n#define VideoEditLeftMargin 40\n#define PanImageWidth 10\n#define MinCropVideoDuration 1\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.view.backgroundColor = [UIColor blackColor];\n    [self configMoviePlayer];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayer) name:UIApplicationWillResignActiveNotification object:nil];\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;\n}\n\n- (void)viewWillDisappear:(BOOL)animated {\n    [super viewWillDisappear:animated];\n    [self stopTimer];\n}\n\n- (void)configMoviePlayer {\n    [[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        BOOL iCloudSyncFailed = !photo && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];\n        self.iCloudErrorView.hidden = !iCloudSyncFailed;\n        self->_doneButton.enabled = !iCloudSyncFailed;\n    }];\n    [[TZImageManager manager] getVideoWithAsset:_model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            self->_asset = playerItem.asset;\n            self->_player = [AVPlayer playerWithPlayerItem:playerItem];\n            self->_playerLayer = [AVPlayerLayer playerLayerWithPlayer:self->_player];\n            self->_playerLayer.frame = self.view.bounds;\n            [self.view.layer addSublayer:self->_playerLayer];\n            [self configPlayButton];\n            [self configBottomToolBar];\n            if (self.imagePickerVc.allowEditVideo) {\n                [self configVideoImageCollectionView];\n                [self configVideoEditView];\n                [self generateVideoImage];\n            }\n            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayer) name:AVPlayerItemDidPlayToEndTimeNotification object:self->_player.currentItem];\n        });\n    }];\n}\n\n- (void)configPlayButton {\n    _playButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"] forState:UIControlStateNormal];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlayHL\"] forState:UIControlStateHighlighted];\n    [_playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    [self.view addSubview:_playButton];\n}\n\n- (void)configBottomToolBar {\n    _cropVideoDurationLabel = UILabel.new;\n    _cropVideoDurationLabel.textAlignment = NSTextAlignmentCenter;\n    _cropVideoDurationLabel.textColor = UIColor.whiteColor;\n    _cropVideoDurationLabel.font = [UIFont systemFontOfSize:12];\n    [self.view addSubview:_cropVideoDurationLabel];\n    \n    _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    _cancelButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    [_cancelButton setTitle:[NSBundle tz_localizedStringForKey:@\"Cancel\"] forState:0];\n    [_cancelButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];\n    [_cancelButton addTarget:self action:@selector(cancelButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    [self.view addSubview:_cancelButton];\n    \n    _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    [_doneButton setTitle:self.imagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];\n    [_doneButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];\n    [_doneButton setTitleColor:self.imagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];\n    [self.view addSubview:_doneButton];\n    \n    if (self.imagePickerVc.videoEditViewPageUIConfigBlock) {\n        self.imagePickerVc.videoEditViewPageUIConfigBlock(_playButton, _cropVideoDurationLabel, _cancelButton, _doneButton);\n    }\n}\n\n- (void)configVideoImageCollectionView {\n    _itemW = (self.view.tz_width - VideoEditLeftMargin * 2 - 2 * PanImageWidth) / 10.0;\n    UICollectionViewFlowLayout *layout = UICollectionViewFlowLayout.new;\n    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;\n    layout.itemSize = CGSizeMake(_itemW, _itemW * 2);\n    layout.minimumLineSpacing = 0;\n    layout.minimumInteritemSpacing = 0;\n    _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];\n    _collectionView.dataSource = self;\n    _collectionView.delegate = self;\n    _collectionView.contentInset = UIEdgeInsetsMake(0, VideoEditLeftMargin + PanImageWidth, 0, VideoEditLeftMargin + PanImageWidth);\n    _collectionView.clipsToBounds = NO;\n    _collectionView.showsHorizontalScrollIndicator = NO;\n    _collectionView.alwaysBounceHorizontal = YES;\n    [_collectionView registerClass:TZVideoPictureCell.class forCellWithReuseIdentifier:@\"TZVideoPictureCell\"];\n    [self.view addSubview:_collectionView];\n}\n\n- (void)configVideoEditView {\n    _videoEditView = TZVideoEditView.new;\n    _videoEditView.backgroundColor = UIColor.clearColor;\n    _videoEditView.delegate = self;\n    _videoEditView.maxCropVideoDuration = self.imagePickerVc.maxCropVideoDuration;\n    [self.view addSubview:_videoEditView];\n}\n\n- (UIStatusBarStyle)preferredStatusBarStyle {\n    if (self.imagePickerVc && [self.imagePickerVc isKindOfClass:[TZImagePickerController class]]) {\n        return self.imagePickerVc.statusBarStyle;\n    }\n    return [super preferredStatusBarStyle];\n}\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n\n    BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;\n    CGFloat statusBarHeight = isFullScreen ? [TZCommonTools tz_statusBarHeight] : 0;\n    CGFloat statusBarAndNaviBarHeight = statusBarHeight + self.navigationController.navigationBar.tz_height;\n    \n    CGFloat toolBarHeight = 44 + [TZCommonTools tz_safeAreaInsets].bottom;\n    CGFloat doneButtonWidth = [_doneButton.currentTitle boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil].size.width;\n    doneButtonWidth = MAX(44, doneButtonWidth);\n    _cancelButton.frame = CGRectMake(12, self.view.tz_height - toolBarHeight, 44, 44);\n    [_cancelButton sizeToFit];\n    _cancelButton.tz_height = 44;\n    _doneButton.frame = CGRectMake(self.view.tz_width - doneButtonWidth - 12, self.view.tz_height - toolBarHeight, doneButtonWidth, 44);\n    _playButton.frame = CGRectMake(0, statusBarAndNaviBarHeight, self.view.tz_width, self.view.tz_height - statusBarAndNaviBarHeight - toolBarHeight);\n    \n    CGFloat collectionViewH = (self.view.tz_width - VideoEditLeftMargin * 2 - 2 * PanImageWidth) / 10.0 * 2;\n    _collectionView.frame = CGRectMake(0, self.view.tz_height - collectionViewH - toolBarHeight - statusBarHeight, self.view.tz_width, collectionViewH);\n    _videoEditView.frame = _collectionView.frame;\n    _cropVideoDurationLabel.frame = CGRectMake(0, _videoEditView.tz_bottom, self.view.tz_width, 20);\n    \n    CGFloat playerLayerHeight = CGRectGetMinY(_collectionView.frame) - statusBarHeight * 2;\n    CGFloat playerLayerWidth = self.view.tz_width/self.view.tz_height * playerLayerHeight;\n    CGFloat playerLayerLeft = (self.view.tz_width - playerLayerWidth) / 2.0;\n    CGRect playerLayerFrame = CGRectMake(playerLayerLeft, statusBarHeight, playerLayerWidth, playerLayerHeight);\n    _playerLayer.frame = playerLayerFrame;\n    _playButton.frame = CGRectMake(0, statusBarAndNaviBarHeight, self.view.tz_width, playerLayerHeight - statusBarAndNaviBarHeight);\n   \n    if (self.imagePickerVc.videoEditViewPageDidLayoutSubviewsBlock) {\n        self.imagePickerVc.videoEditViewPageDidLayoutSubviewsBlock(_playButton, _cropVideoDurationLabel, _cancelButton, _doneButton);\n    }\n}\n\n- (void)generateVideoImage {\n    _imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset:_asset];\n    _imageGenerator.appliesPreferredTrackTransform = YES;\n    _imageGenerator.requestedTimeToleranceBefore = kCMTimeZero;\n    _imageGenerator.requestedTimeToleranceAfter = kCMTimeZero;\n    _imageGenerator.maximumSize = CGSizeMake(100, 100);\n    \n    NSTimeInterval durationSeconds = self.model.asset.duration;\n    self.videoEditView.videoDuration = durationSeconds;\n    \n    NSUInteger imageCount = 10;\n    CGFloat maxCropWidth = self.view.tz_width - (VideoEditLeftMargin + PanImageWidth) * 2;\n    if (durationSeconds <= MinCropVideoDuration) return;\n    if (durationSeconds <= self.imagePickerVc.maxCropVideoDuration) {\n        imageCount = 10;\n        self.videoEditView.allImgWidth = maxCropWidth;\n        _cropVideoDurationLabel.text = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Selected for %ld seconds\"], (NSInteger)durationSeconds];\n    } else {\n        CGFloat singleWidthSecond = maxCropWidth / self.imagePickerVc.maxCropVideoDuration;\n        CGFloat allImgWidth = singleWidthSecond * durationSeconds;\n        self.videoEditView.allImgWidth = allImgWidth;\n        imageCount = allImgWidth / _itemW;\n        _cropVideoDurationLabel.text = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Selected for %ld seconds\"],(long)self.imagePickerVc.maxCropVideoDuration];\n    }\n    NSArray *assetTracks = [_asset tracksWithMediaType:AVMediaTypeVideo];\n    if (!assetTracks.count) {\n        self.iCloudErrorView.hidden = NO;\n        _doneButton.enabled = NO;\n        _cropVideoDurationLabel.hidden = YES;\n        return;\n    };\n    Float64 frameRate = [[_asset tracksWithMediaType:AVMediaTypeVideo][0] nominalFrameRate];;\n    NSMutableArray *times = NSMutableArray.array;\n    NSTimeInterval intervalSecond = durationSeconds/imageCount;\n    CMTime timeFrame;\n    for (NSInteger i = 0; i < imageCount; i++) {\n        timeFrame = CMTimeMake(intervalSecond * i *frameRate, frameRate);\n        NSValue *timeValue = [NSValue valueWithCMTime:timeFrame];\n        [times addObject:timeValue];\n    }\n    self.videoImgArray = NSMutableArray.new;\n    self.imageTimes = times;\n    typeof(self) weakSelf = self;\n    [_imageGenerator generateCGImagesAsynchronouslyForTimes:times completionHandler:^(CMTime requestedTime, CGImageRef  _Nullable image, CMTime actualTime, AVAssetImageGeneratorResult result, NSError * _Nullable error) {\n        if (image) {\n            UIImage *img = [[UIImage alloc] initWithCGImage:image];\n            [weakSelf.videoImgArray addObject:img];\n            dispatch_async(dispatch_get_main_queue(), ^{\n                [weakSelf.collectionView reloadData];\n            });\n        }\n    }];\n}\n\n#pragma mark - UICollectiobViewDataSource & UIcollectionViewDelegate\n\n- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n    return self.videoImgArray.count;\n}\n\n- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n    TZVideoPictureCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@\"TZVideoPictureCell\" forIndexPath:indexPath];\n    cell.imgView.image = self.videoImgArray[indexPath.item];\n    return cell;\n}\n\n#pragma mark - UIScrollViewDelegate\n\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n    if (!_isDraging) return;\n    CGFloat offsetX = scrollView.contentOffset.x;\n    if (offsetX - _collectionViewBeginOffsetX >= self.view.tz_width) {\n        [self.collectionView setContentOffset:CGPointMake(self.view.tz_width + _collectionViewBeginOffsetX, 0) animated:NO];\n    } else if (_collectionViewBeginOffsetX - offsetX >= self.view.tz_width) {\n        [self.collectionView setContentOffset:CGPointMake(_collectionViewBeginOffsetX - self.view.tz_width, 0) animated:NO];\n    }\n    \n    [self editViewCropRectBeginChange];\n}\n\n- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {\n    _isDraging = YES;\n    _collectionViewBeginOffsetX = scrollView.contentOffset.x;\n}\n\n- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {\n    _isDraging = NO;\n    [self editViewCropRectEndChange];\n}\n\n#pragma mark - TZVideoEditViewDelegate\n\n- (void)editViewCropRectBeginChange {\n    [self stopTimer];\n    [_playerLayer.player seekToTime:[self getCropStartTime] toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];\n    \n    NSTimeInterval second = [self getCropVideoDuration];\n    _cropVideoDurationLabel.text = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@\"Selected for %ld seconds\"], (NSInteger)second];\n}\n\n- (void)editViewCropRectEndChange {\n    if (_isPlayed) {\n        [self starTimer];\n    }\n}\n\n#pragma mark - Click Event\n\n- (void)playButtonClick {\n    CMTime currentTime = _player.currentItem.currentTime;\n    CMTime durationTime = _player.currentItem.duration;\n    if (_player.rate == 0.0f) {\n        [[NSNotificationCenter defaultCenter] postNotificationName:@\"TZ_VIDEO_PLAY_NOTIFICATION\" object:_player];\n        if (currentTime.value == durationTime.value) [_player.currentItem seekToTime:CMTimeMake(0, 1)];\n        _isPlayed = YES;\n        [self starTimer];\n        [_playButton setImage:nil forState:UIControlStateNormal];\n    } else {\n        _isPlayed = NO;\n        [self stopTimer];\n        [self pausePlayer];\n    }\n}\n\n- (void)cancelButtonClick {\n    [self dismissViewControllerAnimated:YES completion:nil];\n}\n\n\n- (void)doneButtonClick {\n    if ([[TZImageManager manager] isAssetCannotBeSelected:_model.asset]) {\n        return;\n    }\n    [self stopTimer];\n    \n    TZImagePickerController *imagePickerVc = self.imagePickerVc;\n    [imagePickerVc showProgressHUD];\n    [[TZImageManager manager] getVideoOutputPathWithAsset:_model.asset presetName:imagePickerVc.presetName timeRange:[self getCropVideoTimeRange] success:^(NSString *outputPath) {\n        [imagePickerVc hideProgressHUD];\n        self->_outputPath = outputPath;\n        [self dismissAndCallDelegateMethod];\n    } failure:^(NSString *errorMessage, NSError *error) {\n        [imagePickerVc hideProgressHUD];\n        self->_errorMsg = errorMessage;\n        [self dismissAndCallDelegateMethod];\n    }];\n}\n\n- (void)dismissAndCallDelegateMethod {\n    [self dismissViewControllerAnimated:NO completion:^{\n        [self callDelegateMethod];\n    }];\n    [self.imagePickerVc dismissViewControllerAnimated:YES completion:nil];\n}\n\n- (void)callDelegateMethod {\n    if (_outputPath) {\n        NSURL *videoURL = [NSURL fileURLWithPath:_outputPath];\n        if (self.imagePickerVc.saveEditedVideoToAlbum) {\n            [[TZImageManager manager] saveVideoWithUrl:videoURL completion:^(PHAsset *asset, NSError *error) {\n                if (error) { // 视频保存失败\n                    if ([self.imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFailToSaveEditedVideoWithError:)]) {\n                        [self.imagePickerVc.pickerDelegate imagePickerController:self.imagePickerVc didFailToSaveEditedVideoWithError:error];\n                    }\n                }\n            }];\n        }\n        UIImage *coverImage = [[TZImageManager manager] getImageWithVideoURL:videoURL];\n        if ([self.imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingAndEditingVideo:outputPath:error:)]) {\n            [self.imagePickerVc.pickerDelegate imagePickerController:self.imagePickerVc didFinishPickingAndEditingVideo:coverImage outputPath:_outputPath error:nil];\n        }\n        if (self.imagePickerVc.didFinishPickingAndEditingVideoHandle) {\n            self.imagePickerVc.didFinishPickingAndEditingVideoHandle(coverImage, _outputPath, nil);\n        }\n    } else {\n        if ([self.imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingAndEditingVideo:outputPath:error:)]) {\n            [self.imagePickerVc.pickerDelegate imagePickerController:self.imagePickerVc didFinishPickingAndEditingVideo:nil outputPath:nil error:_errorMsg];\n        }\n        if (self.imagePickerVc.didFinishPickingAndEditingVideoHandle) {\n            self.imagePickerVc.didFinishPickingAndEditingVideoHandle(nil, nil, _errorMsg);\n        }\n    }\n}\n\n#pragma mark - private method\n\n- (CMTime)getCropStartTime {\n    NSTimeInterval second = [self getCropVideoStartSecond];\n    if (second > self.model.asset.duration) {\n        second = roundf(self.model.asset.duration);\n    }\n    return CMTimeMakeWithSeconds(second, _playerLayer.player.currentTime.timescale);\n}\n\n- (CMTimeRange)getCropVideoTimeRange {\n    NSTimeInterval startSecond = [self getCropVideoStartSecond];\n    CMTime start = CMTimeMakeWithSeconds(startSecond, _playerLayer.player.currentTime.timescale);\n    NSTimeInterval second = [self getCropVideoDuration];\n    CMTime duration = CMTimeMakeWithSeconds(second, _playerLayer.player.currentTime.timescale);\n    return CMTimeRangeMake(start, duration);\n}\n\n- (NSTimeInterval)getCropVideoDuration {\n    CGFloat rectW = self.videoEditView.cropRect.size.width;\n    CGFloat contentW = self.videoEditView.allImgWidth;\n    CGFloat second = rectW / contentW * roundf(self.model.asset.duration);\n    return roundf(second);\n}\n\n- (NSTimeInterval)getCropVideoStartSecond {\n    CGFloat offsetX = self.collectionView.contentOffset.x;\n    CGFloat contentW = self.videoEditView.allImgWidth;\n    CGFloat cropRectX = self.videoEditView.cropRect.origin.x - VideoEditLeftMargin - PanImageWidth;\n    NSTimeInterval second = (offsetX + cropRectX) / contentW * roundf(self.model.asset.duration);\n    if (second < 0) second = 0;\n    return roundf(second);\n}\n\n- (CMTime)getTimeOfSeek {\n    NSTimeInterval second = [self getCropVideoStartSecond];\n    if (second > self.model.asset.duration) {\n        second = roundf(self.model.asset.duration);\n    }\n    return CMTimeMakeWithSeconds(second, _playerLayer.player.currentTime.timescale);\n}\n\n- (void)starTimer {\n    [self stopTimer];\n    NSTimeInterval timeInterval = [self getCropVideoDuration];\n    self.timer = [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self selector:@selector(playCropVideo) userInfo:nil repeats:YES];\n    [self.timer fire];\n}\n\n- (void)stopTimer {\n    if (self.timer) {\n        [self.videoEditView resetIndicatorLine];\n        [_player pause];\n        [self.timer invalidate];\n        self.timer = nil;\n    }\n}\n\n- (void)playCropVideo {\n    [_player seekToTime:[self getCropStartTime] toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];\n    [_player play];\n    [self.videoEditView indicatorLineAnimateWithDuration:[self getCropVideoDuration] cropRect:self.videoEditView.cropRect];\n}\n\n#pragma mark - Notification Method\n\n- (void)pausePlayer {\n    [_player pause];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"] forState:UIControlStateNormal];\n}\n\n#pragma mark - lazy\n- (UIView *)iCloudErrorView{\n    if (!_iCloudErrorView) {\n        _iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_statusBarHeight] + 44 + 10, self.view.tz_width, 28)];\n        UIImageView *icloud = [[UIImageView alloc] init];\n        icloud.image = [UIImage tz_imageNamedFromMyBundle:@\"iCloudError\"];\n        icloud.frame = CGRectMake(20, 0, 28, 28);\n        [_iCloudErrorView addSubview:icloud];\n        UILabel *label = [[UILabel alloc] init];\n        label.frame = CGRectMake(53, 0, self.view.tz_width - 63, 28);\n        label.font = [UIFont systemFontOfSize:10];\n        label.textColor = [UIColor whiteColor];\n        label.text = [NSBundle tz_localizedStringForKey:@\"iCloud sync failed\"];\n        [_iCloudErrorView addSubview:label];\n        [self.view addSubview:_iCloudErrorView];\n        _iCloudErrorView.hidden = YES;\n    }\n    return _iCloudErrorView;\n}\n\n- (UIInterfaceOrientationMask)supportedInterfaceOrientations {\n    return UIInterfaceOrientationMaskPortrait;\n}\n\n- (void)dealloc {\n    NSLog(@\"%s\",__func__);\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n#pragma clang diagnostic pop\n\n@end\n\n\n@implementation TZVideoEditView {\n    UILabel *_dragingLabel;\n    CGFloat _itemWidth;\n    CGFloat _beginOffsetX;\n    CGFloat _endOffsetX;\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self =  [super initWithFrame:frame];\n    if (self) {\n        [self initSubViews];\n    }\n    return self;\n}\n\n- (void)initSubViews {\n    _indicatorLine = UIView.new;\n    _indicatorLine.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.7];\n    [self addSubview:_indicatorLine];\n    \n    _beginImgView = UIImageView.new;\n    _beginImgView.image = [UIImage imageNamed:@\"leftVideoEdit\"];\n    _beginImgView.userInteractionEnabled = YES;\n    _beginImgView.tag = 0;\n    UIPanGestureRecognizer *beginPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureAction:)];\n    [_beginImgView addGestureRecognizer:beginPanGesture];\n    [self addSubview:_beginImgView];\n    \n    _endImgView = UIImageView.new;\n    _endImgView.image = [UIImage imageNamed:@\"rightVideoEdit\"];\n    _endImgView.userInteractionEnabled = YES;\n    _endImgView.tag = 1;\n    UIPanGestureRecognizer *endPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureAction:)];\n    [_endImgView addGestureRecognizer:endPanGesture];\n    [self addSubview:_endImgView];\n}\n\n- (void)layoutSubviews {\n    _beginImgView.frame = CGRectMake(VideoEditLeftMargin, 0, PanImageWidth, self.tz_height);\n    _indicatorLine.frame = CGRectMake(_beginImgView.tz_right - 2, 2, 2, self.tz_height - 4);\n    _endImgView.frame = CGRectMake(self.tz_width - PanImageWidth - VideoEditLeftMargin, 0, PanImageWidth, self.tz_height);\n    \n    self.cropRect =  CGRectMake(VideoEditLeftMargin + PanImageWidth, 0, self.tz_width - VideoEditLeftMargin * 2 - PanImageWidth * 2, self.tz_height);\n}\n\n- (void)setAllImgWidth:(CGFloat)allImgWidth {\n    _allImgWidth = allImgWidth;\n    if ((NSInteger)roundf(self.videoDuration) <= 0) {\n        self.minCropRectWidth = allImgWidth;\n        return;\n    }\n    \n    CGFloat scale = MinCropVideoDuration / self.videoDuration;\n    self.minCropRectWidth = scale * allImgWidth;\n}\n\n- (void)setCropRect:(CGRect)cropRect {\n    _cropRect = cropRect;\n    self.beginImgView.tz_left = cropRect.origin.x - PanImageWidth;\n    self.indicatorLine.tz_left = cropRect.origin.x - self.indicatorLine.tz_width;\n    self.endImgView.tz_left = CGRectGetMaxX(cropRect);\n\n    [self setNeedsDisplay];\n}\n\n- (void)drawRect:(CGRect)rect {\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    CGContextClearRect(context, rect);\n    \n    CGPoint topPoints[] = {\n        CGPointMake(self.cropRect.origin.x, 0),\n        CGPointMake(CGRectGetMaxX(self.cropRect), 0)\n    };\n    CGPoint bottomPoints[] = {\n        CGPointMake(self.cropRect.origin.x, self.tz_height),\n        CGPointMake(CGRectGetMaxX(self.cropRect), self.tz_height)\n    };\n\n    CGContextAddLines(context, topPoints, 2);\n    CGContextAddLines(context, bottomPoints, 2);\n    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);\n    CGContextSetLineWidth(context, 4.0);\n    CGContextDrawPath(context, kCGPathStroke);\n}\n\n- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {\n    CGRect beginImgViewFrame = self.beginImgView.frame;\n    beginImgViewFrame.origin.x -= PanImageWidth;\n    beginImgViewFrame.size.width += PanImageWidth * 2;\n    if (CGRectContainsPoint(beginImgViewFrame, point)) return self.beginImgView;\n    \n    CGRect endImgViewFrame = self.endImgView.frame;\n    endImgViewFrame.origin.x -= PanImageWidth;\n    endImgViewFrame.size.width += PanImageWidth * 2;\n    if (CGRectContainsPoint(endImgViewFrame, point)) return self.endImgView;\n    \n    return nil;\n}\n\n#pragma mark - private\n\n- (void)indicatorLineAnimateWithDuration:(NSTimeInterval)duration cropRect:(CGRect)cropRect {\n    [self resetIndicatorLine];\n    [UIView animateWithDuration:duration delay:.0 options:UIViewAnimationOptionCurveLinear animations:^{\n        self.indicatorLine.tz_left = CGRectGetMaxX(cropRect);\n    } completion:nil];\n}\n\n- (void)resetIndicatorLine {\n    [self.indicatorLine.layer removeAllAnimations];\n    self.indicatorLine.tz_left = CGRectGetMinX(self.cropRect) - self.indicatorLine.tz_width;\n}\n\n- (void)panGestureAction:(UIGestureRecognizer *)gesture {\n    CGPoint point = [gesture locationInView:self];\n    CGRect rect = self.cropRect;\n    CGFloat minCropRectLeft = VideoEditLeftMargin + PanImageWidth;\n\n    switch (gesture.view.tag) {\n        case 0: { // 左边拖拽\n            CGFloat maxX = self.endImgView.tz_left - self.minCropRectWidth;\n            point.x = MAX(minCropRectLeft, MIN(point.x, maxX));\n            point.y = 0;\n            \n            rect.size.width = CGRectGetMaxX(rect) - point.x;\n            rect.origin.x = point.x;\n        } break;\n        case 1: { // 右边拖拽\n            minCropRectLeft = CGRectGetMaxX(self.beginImgView.frame) + self.minCropRectWidth;\n            CGFloat  maxX = self.tz_width - VideoEditLeftMargin - PanImageWidth;\n\n            point.x = MAX(minCropRectLeft, MIN(point.x, maxX));\n            point.y = 0;\n\n            rect.size.width = (point.x - rect.origin.x);\n        } break;\n        default:break;\n    }\n    \n    self.cropRect = rect;\n    \n    switch (gesture.state) {\n        case UIGestureRecognizerStateBegan:\n        case UIGestureRecognizerStateChanged: {\n            if (self.delegate && [self.delegate respondsToSelector:@selector(editViewCropRectBeginChange)]) {\n                [self.delegate editViewCropRectBeginChange];\n            }\n        } break;\n        case UIGestureRecognizerStateEnded:\n        case UIGestureRecognizerStateCancelled: {\n            if (self.delegate && [self.delegate respondsToSelector:@selector(editViewCropRectEndChange)]) {\n                [self.delegate editViewCropRectEndChange];\n            }\n        } break;\n        default: break;\n    }\n}\n\n@end\n\n\n\n@implementation TZVideoPictureCell\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self initSubViews];\n    }\n    return self;\n}\n\n- (void)initSubViews {\n    _imgView = [[UIImageView alloc] initWithFrame:self.bounds];\n    _imgView.contentMode = UIViewContentModeScaleAspectFill;\n    _imgView.clipsToBounds = YES;\n    [self.contentView addSubview:_imgView];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZVideoEditedPreviewController.h",
    "content": "//\n//  TZVideoEditedPreviewController.h\n//  TZImagePickerController\n//\n//  Created by 肖兰月 on 2021/5/29.\n//  Copyright © 2021 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface TZVideoEditedPreviewController : UIViewController\n@property (nonatomic, copy) NSURL *videoURL;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZVideoEditedPreviewController.m",
    "content": "//\n//  TZVideoEditedPreviewController.m\n//  TZImagePickerController\n//\n//  Created by 肖兰月 on 2021/5/29.\n//  Copyright © 2021 谭真. All rights reserved.\n//\n\n#import \"TZVideoEditedPreviewController.h\"\n#import <MediaPlayer/MediaPlayer.h>\n#import \"TZImageManager.h\"\n#import \"TZImagePickerController.h\"\n#import \"UIView+TZLayout.h\"\n\n@interface TZVideoEditedPreviewController () {\n    AVPlayer *_player;\n    AVPlayerLayer *_playerLayer;\n    UIButton *_playButton;\n    UIImage *_cover;\n    \n    UIView *_toolBar;\n    UIButton *_doneButton;\n    UIProgressView *_progress;\n    \n    UIStatusBarStyle _originStatusBarStyle;\n}\n\n@end\n\n@implementation TZVideoEditedPreviewController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.view.backgroundColor = [UIColor blackColor];\n    [self configMoviePlayer];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:UIApplicationWillResignActiveNotification object:nil];\n}\n\n- (void)configMoviePlayer {\n    _player = [AVPlayer playerWithURL:self.videoURL];\n    _playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player];\n    [self.view.layer addSublayer:_playerLayer];\n    \n    [self configPlayButton];\n    [self configBottomToolBar];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:AVPlayerItemDidPlayToEndTimeNotification object:self->_player.currentItem];\n}\n\n- (void)configPlayButton {\n    _playButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"] forState:UIControlStateNormal];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlayHL\"] forState:UIControlStateHighlighted];\n    [_playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    [self.view addSubview:_playButton];\n}\n\n- (void)configBottomToolBar {\n    _toolBar = [[UIView alloc] initWithFrame:CGRectZero];\n    CGFloat rgb = 34 / 255.0;\n    _toolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.7];\n    \n    _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc) {\n        [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];\n        [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];\n    } else {\n        [_doneButton setTitle:[NSBundle tz_localizedStringForKey:@\"Done\"] forState:UIControlStateNormal];\n        [_doneButton setTitleColor:[UIColor colorWithRed:(83/255.0) green:(179/255.0) blue:(17/255.0) alpha:1.0] forState:UIControlStateNormal];\n    }\n    [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];\n    [_toolBar addSubview:_doneButton];\n    [self.view addSubview:_toolBar];\n}\n\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n\n    BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;\n    CGFloat statusBarHeight = isFullScreen ? [TZCommonTools tz_statusBarHeight] : 0;\n    CGFloat statusBarAndNaviBarHeight = statusBarHeight + self.navigationController.navigationBar.tz_height;\n    \n    CGFloat toolBarHeight = 44 + [TZCommonTools tz_safeAreaInsets].bottom;\n    _toolBar.frame = CGRectMake(0, self.view.tz_height - toolBarHeight, self.view.tz_width, toolBarHeight);\n    [_doneButton sizeToFit];\n    _doneButton.frame = CGRectMake(self.view.tz_width - _doneButton.tz_width - 12, 0, MAX(44, _doneButton.tz_width), 44);\n    _playButton.frame = CGRectMake(0, statusBarAndNaviBarHeight, self.view.tz_width, self.view.tz_height - statusBarAndNaviBarHeight - toolBarHeight);\n    _playerLayer.frame = self.view.bounds;\n}\n\n#pragma mark - Click Event\n\n- (void)playButtonClick {\n    CMTime currentTime = _player.currentItem.currentTime;\n    CMTime durationTime = _player.currentItem.duration;\n    if (_player.rate == 0.0f) {\n        if (currentTime.value == durationTime.value) [_player.currentItem seekToTime:CMTimeMake(0, 1)];\n        [_player play];\n        _toolBar.hidden = YES;\n        [_playButton setImage:nil forState:UIControlStateNormal];\n    } else {\n        [self pausePlayerAndShowNaviBar];\n    }\n}\n\n- (void)doneButtonClick {\n    [self dismissViewControllerAnimated:YES completion:nil];\n}\n\n#pragma mark - Notification Method\n\n- (void)pausePlayerAndShowNaviBar {\n    [_player pause];\n    _toolBar.hidden = NO;\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"] forState:UIControlStateNormal];\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n#pragma clang diagnostic pop\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZVideoPlayerController.h",
    "content": "//\n//  TZVideoPlayerController.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 16/1/5.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@class TZAssetModel;\n@interface TZVideoPlayerController : UIViewController\n\n@property (nonatomic, strong) TZAssetModel *model;\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m",
    "content": "//\n//  TZVideoPlayerController.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 16/1/5.\n//  Copyright © 2016年 谭真. All rights reserved.\n//\n\n#import \"TZVideoPlayerController.h\"\n#import <MediaPlayer/MediaPlayer.h>\n#import \"UIView+TZLayout.h\"\n#import \"TZImageManager.h\"\n#import \"TZAssetModel.h\"\n#import \"TZImagePickerController.h\"\n#import \"TZPhotoPreviewController.h\"\n#import \"TZVideoCropController.h\"\n\n@interface TZVideoPlayerController () {\n    AVPlayer *_player;\n    AVPlayerLayer *_playerLayer;\n    UIButton *_playButton;\n    UIImage *_playButtonNormalImage;\n    UIImage *_cover;\n    NSString *_outputPath;\n    NSString *_errorMsg;\n    \n    UIView *_toolBar;\n    UIButton *_doneButton;\n    UIButton *_editButton;\n    UIProgressView *_progress;\n    \n    UIStatusBarStyle _originStatusBarStyle;\n}\n@property (assign, nonatomic) BOOL needShowStatusBar;\n\n// iCloud无法同步提示UI\n@property (nonatomic, strong) UIView *iCloudErrorView;\n\n@end\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n\n@implementation TZVideoPlayerController\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    self.needShowStatusBar = ![UIApplication sharedApplication].statusBarHidden;\n    self.view.backgroundColor = [UIColor blackColor];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc) {\n        self.navigationItem.title = tzImagePickerVc.previewBtnTitleStr;\n    }\n    [self configMoviePlayer];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:UIApplicationWillResignActiveNotification object:nil];\n}\n\n- (void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    _originStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;\n    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;\n}\n\n- (void)viewWillDisappear:(BOOL)animated {\n    [super viewWillDisappear:animated];\n    if (self.needShowStatusBar) {\n        [UIApplication sharedApplication].statusBarHidden = NO;\n    }\n    [UIApplication sharedApplication].statusBarStyle = _originStatusBarStyle;\n}\n\n- (void)configMoviePlayer {\n    [[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {\n        BOOL iCloudSyncFailed = !photo && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];\n        self.iCloudErrorView.hidden = !iCloudSyncFailed;\n        if (!isDegraded && photo) {\n            self->_cover = photo;\n            self->_doneButton.enabled = YES;\n            self->_editButton.enabled = YES;\n        }\n    }];\n    [[TZImageManager manager] getVideoWithAsset:_model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {\n        dispatch_async(dispatch_get_main_queue(), ^{\n            self->_player = [AVPlayer playerWithPlayerItem:playerItem];\n            self->_playerLayer = [AVPlayerLayer playerLayerWithPlayer:self->_player];\n            self->_playerLayer.frame = self.view.bounds;\n            [self.view.layer addSublayer:self->_playerLayer];\n            [self addProgressObserver];\n            [self configPlayButton];\n            [self configBottomToolBar];\n            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayerAndShowNaviBar) name:AVPlayerItemDidPlayToEndTimeNotification object:self->_player.currentItem];\n        });\n    }];\n}\n\n/// Show progress，do it next time / 给播放器添加进度更新,下次加上\n- (void)addProgressObserver{\n    AVPlayerItem *playerItem = _player.currentItem;\n    UIProgressView *progress = _progress;\n    [_player addPeriodicTimeObserverForInterval:CMTimeMake(1.0, 1.0) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {\n        float current = CMTimeGetSeconds(time);\n        float total = CMTimeGetSeconds([playerItem duration]);\n        if (current) {\n            [progress setProgress:(current/total) animated:YES];\n        }\n    }];\n}\n\n- (void)configPlayButton {\n    _playButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"] forState:UIControlStateNormal];\n    [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlayHL\"] forState:UIControlStateHighlighted];\n    [_playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    [self.view addSubview:_playButton];\n}\n\n- (void)configBottomToolBar {\n    _toolBar = [[UIView alloc] initWithFrame:CGRectZero];\n    CGFloat rgb = 34 / 255.0;\n    _toolBar.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.7];\n    \n    _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];\n    _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];\n    if (!_cover) {\n        _doneButton.enabled = NO;\n    }\n    [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (tzImagePickerVc) {\n        [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];\n        [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];\n    } else {\n        [_doneButton setTitle:[NSBundle tz_localizedStringForKey:@\"Done\"] forState:UIControlStateNormal];\n        [_doneButton setTitleColor:[UIColor colorWithRed:(83/255.0) green:(179/255.0) blue:(17/255.0) alpha:1.0] forState:UIControlStateNormal];\n    }\n    [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];\n    [_toolBar addSubview:_doneButton];\n    [self.view addSubview:_toolBar];\n    \n    if (tzImagePickerVc && tzImagePickerVc.allowEditVideo && roundf(self.model.asset.duration) > 1) {\n        _editButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        _editButton.titleLabel.font = [UIFont systemFontOfSize:16];\n        if (!_cover) {\n            _editButton.enabled = NO;\n        }\n        [_editButton addTarget:self action:@selector(editButtonClick) forControlEvents:UIControlEventTouchUpInside];\n        [_editButton setTitle:tzImagePickerVc.editBtnTitleStr forState:UIControlStateNormal];\n        [_editButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];\n        [_editButton setTitleColor:tzImagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];\n        [_toolBar addSubview:_editButton];\n    }\n    \n    if (tzImagePickerVc.videoPreviewPageUIConfigBlock) {\n        tzImagePickerVc.videoPreviewPageUIConfigBlock(_playButton, _toolBar, _editButton, _doneButton);\n    }\n}\n\n- (UIStatusBarStyle)preferredStatusBarStyle {\n    TZImagePickerController *tzImagePicker = (TZImagePickerController *)self.navigationController;\n    if (tzImagePicker && [tzImagePicker isKindOfClass:[TZImagePickerController class]]) {\n        return tzImagePicker.statusBarStyle;\n    }\n    return [super preferredStatusBarStyle];\n}\n\n#pragma mark - Layout\n\n- (void)viewDidLayoutSubviews {\n    [super viewDidLayoutSubviews];\n    TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;\n    \n    BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;\n    CGFloat statusBarHeight = isFullScreen ? [TZCommonTools tz_statusBarHeight] : 0;\n    CGFloat statusBarAndNaviBarHeight = statusBarHeight + self.navigationController.navigationBar.tz_height;\n    _playerLayer.frame = self.view.bounds;\n    CGFloat toolBarHeight = 44 + [TZCommonTools tz_safeAreaInsets].bottom;\n    _toolBar.frame = CGRectMake(0, self.view.tz_height - toolBarHeight, self.view.tz_width, toolBarHeight);\n    [_doneButton sizeToFit];\n    _doneButton.frame = CGRectMake(self.view.tz_width - _doneButton.tz_width - 12, 0, MAX(44, _doneButton.tz_width), 44);\n    _playButton.frame = CGRectMake(0, statusBarAndNaviBarHeight, self.view.tz_width, self.view.tz_height - statusBarAndNaviBarHeight - toolBarHeight);\n    if (tzImagePickerVc.allowEditVideo) {\n        _editButton.frame = CGRectMake(12, 0, 44, 44);\n        [_editButton sizeToFit];\n        _editButton.tz_height = 44;\n    }\n    if (tzImagePickerVc.videoPreviewPageDidLayoutSubviewsBlock) {\n        tzImagePickerVc.videoPreviewPageDidLayoutSubviewsBlock(_playButton, _toolBar, _editButton, _doneButton);\n    }\n}\n\n#pragma mark - Click Event\n\n- (void)playButtonClick {\n    CMTime currentTime = _player.currentItem.currentTime;\n    CMTime durationTime = _player.currentItem.duration;\n    if (_player.rate == 0.0f) {\n        [[NSNotificationCenter defaultCenter] postNotificationName:@\"TZ_VIDEO_PLAY_NOTIFICATION\" object:_player];\n        if (currentTime.value == durationTime.value) [_player.currentItem seekToTime:CMTimeMake(0, 1)];\n        [_player play];\n        [self.navigationController setNavigationBarHidden:YES];\n        _toolBar.hidden = YES;\n        _playButtonNormalImage = [_playButton imageForState:UIControlStateNormal];\n        [_playButton setImage:nil forState:UIControlStateNormal];\n        [UIApplication sharedApplication].statusBarHidden = YES;\n    } else {\n        [self pausePlayerAndShowNaviBar];\n    }\n}\n\n- (void)editButtonClick {\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    TZVideoCropController *videoCropVc = [[TZVideoCropController alloc] init];\n    videoCropVc.model = self.model;\n    videoCropVc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;\n    videoCropVc.modalPresentationStyle = UIModalPresentationFullScreen;\n    videoCropVc.modalPresentationCapturesStatusBarAppearance = YES;\n    videoCropVc.imagePickerVc = imagePickerVc;\n    [self presentViewController:videoCropVc animated:YES completion:nil];\n}\n\n- (void)doneButtonClick {\n    if ([[TZImageManager manager] isAssetCannotBeSelected:_model.asset]) {\n        return;\n    }\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (imagePickerVc.allowEditVideo) {\n        [imagePickerVc showProgressHUD];\n        [[TZImageManager manager] getVideoOutputPathWithAsset:_model.asset presetName:imagePickerVc.presetName success:^(NSString *outputPath) {\n            [imagePickerVc hideProgressHUD];\n            self->_outputPath = outputPath;\n            [self dismissAndCallDelegateMethod];\n        } failure:^(NSString *errorMessage, NSError *error) {\n            [imagePickerVc hideProgressHUD];\n            self->_errorMsg = errorMessage;\n            [self dismissAndCallDelegateMethod];\n        }];\n    } else {\n        [self dismissAndCallDelegateMethod];\n    }\n}\n\n- (void)dismissAndCallDelegateMethod {\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (!imagePickerVc) {\n        [self dismissViewControllerAnimated:YES completion:nil];\n        return;\n    }\n    if (imagePickerVc.autoDismiss) {\n        [imagePickerVc dismissViewControllerAnimated:YES completion:^{\n            [self callDelegateMethod];\n        }];\n    } else {\n        [self callDelegateMethod];\n    }\n}\n\n- (void)callDelegateMethod {\n    TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;\n    if (imagePickerVc.allowEditVideo) {\n        if (_outputPath) {\n            if ([imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingAndEditingVideo:outputPath:error:)]) {\n                [imagePickerVc.pickerDelegate imagePickerController:imagePickerVc didFinishPickingAndEditingVideo:self->_cover outputPath:self->_outputPath error:nil];\n            }\n            if (imagePickerVc.didFinishPickingAndEditingVideoHandle) {\n                imagePickerVc.didFinishPickingAndEditingVideoHandle(self->_cover, self->_outputPath, nil);\n            }\n        } else {\n            if ([imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingAndEditingVideo:outputPath:error:)]) {\n                [imagePickerVc.pickerDelegate imagePickerController:imagePickerVc didFinishPickingAndEditingVideo:nil outputPath:nil error:self->_errorMsg];\n            }\n            if (imagePickerVc.didFinishPickingAndEditingVideoHandle) {\n                imagePickerVc.didFinishPickingAndEditingVideoHandle(nil, nil, self->_errorMsg);\n            }\n        }\n    } else {\n        if ([imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingVideo:sourceAssets:)]) {\n            [imagePickerVc.pickerDelegate imagePickerController:imagePickerVc didFinishPickingVideo:_cover sourceAssets:_model.asset];\n        }\n        if (imagePickerVc.didFinishPickingVideoHandle) {\n            imagePickerVc.didFinishPickingVideoHandle(_cover,_model.asset);\n        }\n    }\n}\n\n#pragma mark - Notification Method\n\n- (void)pausePlayerAndShowNaviBar {\n    [_player pause];\n    _toolBar.hidden = NO;\n    [self.navigationController setNavigationBarHidden:NO];\n    UIImage *normalImage = _playButtonNormalImage ?: [UIImage tz_imageNamedFromMyBundle:@\"MMVideoPreviewPlay\"];\n    [_playButton setImage:normalImage forState:UIControlStateNormal];\n    \n    if (self.needShowStatusBar) {\n        [UIApplication sharedApplication].statusBarHidden = NO;\n    }\n}\n\n#pragma mark - lazy\n- (UIView *)iCloudErrorView{\n    if (!_iCloudErrorView) {\n        _iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_statusBarHeight] + 44 + 10, self.view.tz_width, 28)];\n        UIImageView *icloud = [[UIImageView alloc] init];\n        icloud.image = [UIImage tz_imageNamedFromMyBundle:@\"iCloudError\"];\n        icloud.frame = CGRectMake(20, 0, 28, 28);\n        [_iCloudErrorView addSubview:icloud];\n        UILabel *label = [[UILabel alloc] init];\n        label.frame = CGRectMake(53, 0, self.view.tz_width - 63, 28);\n        label.font = [UIFont systemFontOfSize:10];\n        label.textColor = [UIColor whiteColor];\n        label.text = [NSBundle tz_localizedStringForKey:@\"iCloud sync failed\"];\n        [_iCloudErrorView addSubview:label];\n        [self.view addSubview:_iCloudErrorView];\n        _iCloudErrorView.hidden = YES;\n    }\n    return _iCloudErrorView;\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n#pragma clang diagnostic pop\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/UIView+TZLayout.h",
    "content": "//\n//  UIView+TZLayout.h\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/2/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\ntypedef enum : NSUInteger {\n    TZOscillatoryAnimationToBigger,\n    TZOscillatoryAnimationToSmaller,\n} TZOscillatoryAnimationType;\n\n@interface UIView (TZLayout)\n\n@property (nonatomic) CGFloat tz_left;        ///< Shortcut for frame.origin.x.\n@property (nonatomic) CGFloat tz_top;         ///< Shortcut for frame.origin.y\n@property (nonatomic) CGFloat tz_right;       ///< Shortcut for frame.origin.x + frame.size.width\n@property (nonatomic) CGFloat tz_bottom;      ///< Shortcut for frame.origin.y + frame.size.height\n@property (nonatomic) CGFloat tz_width;       ///< Shortcut for frame.size.width.\n@property (nonatomic) CGFloat tz_height;      ///< Shortcut for frame.size.height.\n@property (nonatomic) CGFloat tz_centerX;     ///< Shortcut for center.x\n@property (nonatomic) CGFloat tz_centerY;     ///< Shortcut for center.y\n@property (nonatomic) CGPoint tz_origin;      ///< Shortcut for frame.origin.\n@property (nonatomic) CGSize  tz_size;        ///< Shortcut for frame.size.\n\n+ (void)showOscillatoryAnimationWithLayer:(CALayer *)layer type:(TZOscillatoryAnimationType)type;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController/TZImagePickerController/TZImagePickerController/UIView+TZLayout.m",
    "content": "//\n//  UIView+TZLayout.m\n//  TZImagePickerController\n//\n//  Created by 谭真 on 15/2/24.\n//  Copyright © 2015年 谭真. All rights reserved.\n//\n\n#import \"UIView+TZLayout.h\"\n\n@implementation UIView (TZLayout)\n\n- (CGFloat)tz_left {\n    return self.frame.origin.x;\n}\n\n- (void)setTz_left:(CGFloat)x {\n    CGRect frame = self.frame;\n    frame.origin.x = x;\n    self.frame = frame;\n}\n\n- (CGFloat)tz_top {\n    return self.frame.origin.y;\n}\n\n- (void)setTz_top:(CGFloat)y {\n    CGRect frame = self.frame;\n    frame.origin.y = y;\n    self.frame = frame;\n}\n\n- (CGFloat)tz_right {\n    return self.frame.origin.x + self.frame.size.width;\n}\n\n- (void)setTz_right:(CGFloat)right {\n    CGRect frame = self.frame;\n    frame.origin.x = right - frame.size.width;\n    self.frame = frame;\n}\n\n- (CGFloat)tz_bottom {\n    return self.frame.origin.y + self.frame.size.height;\n}\n\n- (void)setTz_bottom:(CGFloat)bottom {\n    CGRect frame = self.frame;\n    frame.origin.y = bottom - frame.size.height;\n    self.frame = frame;\n}\n\n- (CGFloat)tz_width {\n    return self.frame.size.width;\n}\n\n- (void)setTz_width:(CGFloat)width {\n    CGRect frame = self.frame;\n    frame.size.width = width;\n    self.frame = frame;\n}\n\n- (CGFloat)tz_height {\n    return self.frame.size.height;\n}\n\n- (void)setTz_height:(CGFloat)height {\n    CGRect frame = self.frame;\n    frame.size.height = height;\n    self.frame = frame;\n}\n\n- (CGFloat)tz_centerX {\n    return self.center.x;\n}\n\n- (void)setTz_centerX:(CGFloat)centerX {\n    self.center = CGPointMake(centerX, self.center.y);\n}\n\n- (CGFloat)tz_centerY {\n    return self.center.y;\n}\n\n- (void)setTz_centerY:(CGFloat)centerY {\n    self.center = CGPointMake(self.center.x, centerY);\n}\n\n- (CGPoint)tz_origin {\n    return self.frame.origin;\n}\n\n- (void)setTz_origin:(CGPoint)origin {\n    CGRect frame = self.frame;\n    frame.origin = origin;\n    self.frame = frame;\n}\n\n- (CGSize)tz_size {\n    return self.frame.size;\n}\n\n- (void)setTz_size:(CGSize)size {\n    CGRect frame = self.frame;\n    frame.size = size;\n    self.frame = frame;\n}\n\n+ (void)showOscillatoryAnimationWithLayer:(CALayer *)layer type:(TZOscillatoryAnimationType)type{\n    NSNumber *animationScale1 = type == TZOscillatoryAnimationToBigger ? @(1.15) : @(0.5);\n    NSNumber *animationScale2 = type == TZOscillatoryAnimationToBigger ? @(0.92) : @(1.15);\n    \n    [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{\n        [layer setValue:animationScale1 forKeyPath:@\"transform.scale\"];\n    } completion:^(BOOL finished) {\n        [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{\n            [layer setValue:animationScale2 forKeyPath:@\"transform.scale\"];\n        } completion:^(BOOL finished) {\n            [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut animations:^{\n                [layer setValue:@(1.0) forKeyPath:@\"transform.scale\"];\n            } completion:nil];\n        }];\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/TZImagePickerController.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t034B10F260F7FEAFD9547E2D063C914D /* TZGifPhotoPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E21C136665BF59789EB2133EDFA37F2 /* TZGifPhotoPreviewController.m */; };\n\t\t037D9ECB6247D17E2B5D0F6D8F35420C /* TZImagePickerController-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A23AAD7252C3AE86989A8FE85A8EB9E /* TZImagePickerController-dummy.m */; };\n\t\t0730D0B582AB40AB96FAA74001BEEC33 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E4A393432B58E8A982E19459DFB001C /* Foundation.framework */; };\n\t\t09E8D055B6D21F61BA0583968C91412D /* TZAssetCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 99F459D3428E65B07E238B6454BD2EB2 /* TZAssetCell.m */; };\n\t\t13B36CD5CEA47640ABE19D7A9BFD1A3A /* TZVideoCropController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE2B19D937DAB0FB52768520F9AA6F0E /* TZVideoCropController.m */; };\n\t\t176058F07BE278AE8BC50AE5F2239181 /* TZVideoEditedPreviewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8FD9CF3E67A7B43F0DA6A050140B27DB /* TZVideoEditedPreviewController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t18E8C502FB85F0517471D9153C3C11AD /* TZImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C6610AFA642EA43E40DD712FF0465F4 /* TZImagePickerController.m */; };\n\t\t23180A75EAA1C133E50C5EF5DB253A9C /* TZLocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 63C513DB5CE4C167174054BB2359AA92 /* TZLocationManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t25900CB456C8B34A0BCCFF2DFF17B6CC /* NSBundle+TZImagePicker.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DAFA2AF17496996E11F0AE491360B5 /* NSBundle+TZImagePicker.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t25B31A801B7280EA46996403201DC155 /* TZAssetModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C39F5F0D1A78DA8B296C3EB28597F03 /* TZAssetModel.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3514C46309F2215BA2E9EFBD7B61EAB3 /* TZImagePickerController.bundle in Resources */ = {isa = PBXBuildFile; fileRef = EEA0F901B2C30143CAB062577E9211D0 /* TZImagePickerController.bundle */; };\n\t\t366400DCA09ACD68EA5DCA1213DEC8DB /* TZPhotoPreviewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = EEEF085F33E2A32AAD53D0E633231EF5 /* TZPhotoPreviewCell.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t508495A6ED2780904C9DF9FAAB612C3B /* TZVideoPlayerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3335F26F1BB4517AB1B2932A4202C2E0 /* TZVideoPlayerController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5354F42908B1BCEE5DECDF257F26FEA7 /* TZAssetModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EE620B2F763336A7069DB97E2478C55 /* TZAssetModel.m */; };\n\t\t54893A13ADAE8FA1874A92E157311ACB /* TZAuthLimitedFooterTipView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9590E85381ABB5DCA5A5BB2C8BDA3EF9 /* TZAuthLimitedFooterTipView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t65E6185AD3801C3526C2891C04E4E41C /* TZImagePickerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 401B46BA3C535C9B953B767EC0BA449C /* TZImagePickerController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t68AF51698C5CEA352A18377874BD55CC /* TZPhotoPreviewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 06EC2B0B6C952552E1DABF4B894D4E98 /* TZPhotoPreviewController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6C60E90C70E42BB2C1C3BDC5069953D0 /* TZImageRequestOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = FBADB8D3C76C9234424E2064BC4C2B96 /* TZImageRequestOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t752349FF1269E924F53E4CF0A714A079 /* TZLocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D2D89A2A1FCC74BEFAE3D1233B7EE61 /* TZLocationManager.m */; };\n\t\t767D98A178AAF141CCE6A5FE03DC9E47 /* TZProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 40A2F310E9995E49FC5368A2DD66D9CA /* TZProgressView.m */; };\n\t\t79B4FFE39357632099F104440941DC74 /* TZPhotoPickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = E511D8191689376DF9B852F4469BF9B2 /* TZPhotoPickerController.m */; };\n\t\t805CB18AB38DC45F7FE0E176C5E85E3A /* TZPhotoPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B932A6E4E829379223F210BA5F9085D /* TZPhotoPreviewController.m */; };\n\t\t9000118DE63892C43C76F562A0313D2A /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B43172B64AF87506786D6020CE20734F /* Photos.framework */; };\n\t\t935AF0C6C3DA8F8F4BA8104B21FC1E4F /* TZPhotoPreviewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E99AF284405E2435959EF09B5489F01D /* TZPhotoPreviewCell.m */; };\n\t\t96E90C10582BBF7C30A5ED2B0696D963 /* TZAssetCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B52A1066DAE5FF487DA01471157B277 /* TZAssetCell.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t982FE76A3D77F9E70C6E0892A2805D98 /* TZAuthLimitedFooterTipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 18B71F829D8172FD5AEF3E9E447493F3 /* TZAuthLimitedFooterTipView.m */; };\n\t\t98D9BE282D76D02288B05D448B85183D /* TZImageCropManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3699672A3DC4C9E30F04BED708A79FC1 /* TZImageCropManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB283E2A016CF9BD2139890469A07A930 /* UIView+TZLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F155CC40CDD113F634E7E4B6E7DC8F /* UIView+TZLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB4630D5A8C2186F1E27F9C06E4F7857C /* TZVideoPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5356B272DBF15F3D33939D8341A4B262 /* TZVideoPlayerController.m */; };\n\t\tB954790AAF573D4F02D0830AE25CD9B8 /* TZImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C857115962741A452067E21328147648 /* TZImageManager.m */; };\n\t\tB9F326D39023969724323CAFF8C34FFC /* TZVideoEditedPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE52B8FD5A7B6CCD9E4B603C92F52FCC /* TZVideoEditedPreviewController.m */; };\n\t\tBCEE42145EF2F5D867AF485724436AEF /* TZVideoCropController.h in Headers */ = {isa = PBXBuildFile; fileRef = 288FCC4FB2D4BFCBE3C5DDCE984984CF /* TZVideoCropController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tBDAE73F7AE61B164D587F85AE0ABA4BD /* TZProgressView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F778A426CACCF5A11E1CD26F4480A0B /* TZProgressView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tC21C052721968129963969D49823427F /* TZImagePickerController-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = E5800CCC85CF90D88F0DBEC6D83808DD /* TZImagePickerController-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tC3F1A292EB6419AD7AECF1FCB19A063B /* UIView+TZLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 59955B4A75A957B74BBC0B8E77AD25BA /* UIView+TZLayout.m */; };\n\t\tC7BD6486D6D4AE177907659B7F7F3870 /* NSBundle+TZImagePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = B130CAD9D4B148951593B1120EDDF4C4 /* NSBundle+TZImagePicker.m */; };\n\t\tD23336A5CD373056912FD8BBDC203F39 /* TZImageCropManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 29C53B6138B5F243676AB99CD8EE794B /* TZImageCropManager.m */; };\n\t\tDB4FBBC974C4CAFDD570D7AE544C9623 /* TZImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 146072AEF2BEE6BAB1A10AD83106A444 /* TZImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDEF28854F443A88BE4B5A5154CCFD69A /* PhotosUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86E9858900CEA4F67BD0B616EB926D9C /* PhotosUI.framework */; };\n\t\tE7E703D98D659317CD0D630C4C3B86CA /* TZImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AF7767700AA9039D196EB1061A63662 /* TZImageRequestOperation.m */; };\n\t\tF942B4B0253561ABA81994FA2B948902 /* TZGifPhotoPreviewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 33A214882A65FBEF13E78EDEAACA6002 /* TZGifPhotoPreviewController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tFEB3E4BC159DFE29683AFF9ADCDC6C13 /* TZPhotoPickerController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4117A638E93D156A24975BBF55AEE8 /* TZPhotoPickerController.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t06EC2B0B6C952552E1DABF4B894D4E98 /* TZPhotoPreviewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZPhotoPreviewController.h; path = TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.h; sourceTree = \"<group>\"; };\n\t\t0DBF2C5C77D8316134001812A5BD25EF /* TZImagePickerController */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = TZImagePickerController; path = TZImagePickerController.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t0E4A393432B58E8A982E19459DFB001C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t146072AEF2BEE6BAB1A10AD83106A444 /* TZImageManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZImageManager.h; path = TZImagePickerController/TZImagePickerController/TZImageManager.h; sourceTree = \"<group>\"; };\n\t\t18B71F829D8172FD5AEF3E9E447493F3 /* TZAuthLimitedFooterTipView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZAuthLimitedFooterTipView.m; path = TZImagePickerController/TZImagePickerController/TZAuthLimitedFooterTipView.m; sourceTree = \"<group>\"; };\n\t\t288FCC4FB2D4BFCBE3C5DDCE984984CF /* TZVideoCropController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZVideoCropController.h; path = TZImagePickerController/TZImagePickerController/TZVideoCropController.h; sourceTree = \"<group>\"; };\n\t\t29C53B6138B5F243676AB99CD8EE794B /* TZImageCropManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZImageCropManager.m; path = TZImagePickerController/TZImagePickerController/TZImageCropManager.m; sourceTree = \"<group>\"; };\n\t\t2B932A6E4E829379223F210BA5F9085D /* TZPhotoPreviewController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZPhotoPreviewController.m; path = TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m; sourceTree = \"<group>\"; };\n\t\t2F778A426CACCF5A11E1CD26F4480A0B /* TZProgressView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZProgressView.h; path = TZImagePickerController/TZImagePickerController/TZProgressView.h; sourceTree = \"<group>\"; };\n\t\t3335F26F1BB4517AB1B2932A4202C2E0 /* TZVideoPlayerController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZVideoPlayerController.h; path = TZImagePickerController/TZImagePickerController/TZVideoPlayerController.h; sourceTree = \"<group>\"; };\n\t\t33A214882A65FBEF13E78EDEAACA6002 /* TZGifPhotoPreviewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZGifPhotoPreviewController.h; path = TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.h; sourceTree = \"<group>\"; };\n\t\t3699672A3DC4C9E30F04BED708A79FC1 /* TZImageCropManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZImageCropManager.h; path = TZImagePickerController/TZImagePickerController/TZImageCropManager.h; sourceTree = \"<group>\"; };\n\t\t3AF7767700AA9039D196EB1061A63662 /* TZImageRequestOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZImageRequestOperation.m; path = TZImagePickerController/TZImagePickerController/TZImageRequestOperation.m; sourceTree = \"<group>\"; };\n\t\t3EE620B2F763336A7069DB97E2478C55 /* TZAssetModel.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZAssetModel.m; path = TZImagePickerController/TZImagePickerController/TZAssetModel.m; sourceTree = \"<group>\"; };\n\t\t401B46BA3C535C9B953B767EC0BA449C /* TZImagePickerController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZImagePickerController.h; path = TZImagePickerController/TZImagePickerController/TZImagePickerController.h; sourceTree = \"<group>\"; };\n\t\t404028CEE6475EEF443DBCE7A1361E26 /* TZImagePickerController.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = TZImagePickerController.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t40A2F310E9995E49FC5368A2DD66D9CA /* TZProgressView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZProgressView.m; path = TZImagePickerController/TZImagePickerController/TZProgressView.m; sourceTree = \"<group>\"; };\n\t\t5356B272DBF15F3D33939D8341A4B262 /* TZVideoPlayerController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZVideoPlayerController.m; path = TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m; sourceTree = \"<group>\"; };\n\t\t59955B4A75A957B74BBC0B8E77AD25BA /* UIView+TZLayout.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIView+TZLayout.m\"; path = \"TZImagePickerController/TZImagePickerController/UIView+TZLayout.m\"; sourceTree = \"<group>\"; };\n\t\t63C513DB5CE4C167174054BB2359AA92 /* TZLocationManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZLocationManager.h; path = TZImagePickerController/TZImagePickerController/TZLocationManager.h; sourceTree = \"<group>\"; };\n\t\t6A23AAD7252C3AE86989A8FE85A8EB9E /* TZImagePickerController-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"TZImagePickerController-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t79AF540873E2761FA3E85C022D01098A /* TZImagePickerController.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = TZImagePickerController.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t7C4117A638E93D156A24975BBF55AEE8 /* TZPhotoPickerController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZPhotoPickerController.h; path = TZImagePickerController/TZImagePickerController/TZPhotoPickerController.h; sourceTree = \"<group>\"; };\n\t\t86E9858900CEA4F67BD0B616EB926D9C /* PhotosUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PhotosUI.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/PhotosUI.framework; sourceTree = DEVELOPER_DIR; };\n\t\t8B52A1066DAE5FF487DA01471157B277 /* TZAssetCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZAssetCell.h; path = TZImagePickerController/TZImagePickerController/TZAssetCell.h; sourceTree = \"<group>\"; };\n\t\t8C39F5F0D1A78DA8B296C3EB28597F03 /* TZAssetModel.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZAssetModel.h; path = TZImagePickerController/TZImagePickerController/TZAssetModel.h; sourceTree = \"<group>\"; };\n\t\t8C6610AFA642EA43E40DD712FF0465F4 /* TZImagePickerController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZImagePickerController.m; path = TZImagePickerController/TZImagePickerController/TZImagePickerController.m; sourceTree = \"<group>\"; };\n\t\t8FD9CF3E67A7B43F0DA6A050140B27DB /* TZVideoEditedPreviewController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZVideoEditedPreviewController.h; path = TZImagePickerController/TZImagePickerController/TZVideoEditedPreviewController.h; sourceTree = \"<group>\"; };\n\t\t93F155CC40CDD113F634E7E4B6E7DC8F /* UIView+TZLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIView+TZLayout.h\"; path = \"TZImagePickerController/TZImagePickerController/UIView+TZLayout.h\"; sourceTree = \"<group>\"; };\n\t\t9590E85381ABB5DCA5A5BB2C8BDA3EF9 /* TZAuthLimitedFooterTipView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZAuthLimitedFooterTipView.h; path = TZImagePickerController/TZImagePickerController/TZAuthLimitedFooterTipView.h; sourceTree = \"<group>\"; };\n\t\t99F459D3428E65B07E238B6454BD2EB2 /* TZAssetCell.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZAssetCell.m; path = TZImagePickerController/TZImagePickerController/TZAssetCell.m; sourceTree = \"<group>\"; };\n\t\t9A46BFC226685E337CF52FDB0393AC57 /* TZImagePickerController-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"TZImagePickerController-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t9D2D89A2A1FCC74BEFAE3D1233B7EE61 /* TZLocationManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZLocationManager.m; path = TZImagePickerController/TZImagePickerController/TZLocationManager.m; sourceTree = \"<group>\"; };\n\t\t9E21C136665BF59789EB2133EDFA37F2 /* TZGifPhotoPreviewController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZGifPhotoPreviewController.m; path = TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.m; sourceTree = \"<group>\"; };\n\t\tB130CAD9D4B148951593B1120EDDF4C4 /* NSBundle+TZImagePicker.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSBundle+TZImagePicker.m\"; path = \"TZImagePickerController/TZImagePickerController/NSBundle+TZImagePicker.m\"; sourceTree = \"<group>\"; };\n\t\tB43172B64AF87506786D6020CE20734F /* Photos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Photos.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Photos.framework; sourceTree = DEVELOPER_DIR; };\n\t\tB6DAFA2AF17496996E11F0AE491360B5 /* NSBundle+TZImagePicker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSBundle+TZImagePicker.h\"; path = \"TZImagePickerController/TZImagePickerController/NSBundle+TZImagePicker.h\"; sourceTree = \"<group>\"; };\n\t\tBE1F74B737E26ABD169D9870AE376872 /* TZImagePickerController.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = TZImagePickerController.modulemap; sourceTree = \"<group>\"; };\n\t\tC857115962741A452067E21328147648 /* TZImageManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZImageManager.m; path = TZImagePickerController/TZImagePickerController/TZImageManager.m; sourceTree = \"<group>\"; };\n\t\tCE52B8FD5A7B6CCD9E4B603C92F52FCC /* TZVideoEditedPreviewController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZVideoEditedPreviewController.m; path = TZImagePickerController/TZImagePickerController/TZVideoEditedPreviewController.m; sourceTree = \"<group>\"; };\n\t\tDF7E3EDD4A960A79E0D311767E208B6C /* TZImagePickerController-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"TZImagePickerController-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tE511D8191689376DF9B852F4469BF9B2 /* TZPhotoPickerController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZPhotoPickerController.m; path = TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m; sourceTree = \"<group>\"; };\n\t\tE5800CCC85CF90D88F0DBEC6D83808DD /* TZImagePickerController-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"TZImagePickerController-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tE99AF284405E2435959EF09B5489F01D /* TZPhotoPreviewCell.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZPhotoPreviewCell.m; path = TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m; sourceTree = \"<group>\"; };\n\t\tEE2B19D937DAB0FB52768520F9AA6F0E /* TZVideoCropController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = TZVideoCropController.m; path = TZImagePickerController/TZImagePickerController/TZVideoCropController.m; sourceTree = \"<group>\"; };\n\t\tEEA0F901B2C30143CAB062577E9211D0 /* TZImagePickerController.bundle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = \"wrapper.plug-in\"; name = TZImagePickerController.bundle; path = TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle; sourceTree = \"<group>\"; };\n\t\tEEEF085F33E2A32AAD53D0E633231EF5 /* TZPhotoPreviewCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZPhotoPreviewCell.h; path = TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.h; sourceTree = \"<group>\"; };\n\t\tFBADB8D3C76C9234424E2064BC4C2B96 /* TZImageRequestOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = TZImageRequestOperation.h; path = TZImagePickerController/TZImagePickerController/TZImageRequestOperation.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t0C36196FE3D46A7422F69E1726BC580C /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t0730D0B582AB40AB96FAA74001BEEC33 /* Foundation.framework in Frameworks */,\n\t\t\t\t9000118DE63892C43C76F562A0313D2A /* Photos.framework in Frameworks */,\n\t\t\t\tDEF28854F443A88BE4B5A5154CCFD69A /* PhotosUI.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0A67B964E38F47CE7A0E4880BD407AEA /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA6F2E459F4A0703301C2343C7386E6AF /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1A205C7D38FD0DD0B460DFCB164E261C /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEEA0F901B2C30143CAB062577E9211D0 /* TZImagePickerController.bundle */,\n\t\t\t);\n\t\t\tname = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t39008159B294EAE29777D0A1797B0276 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0A67B964E38F47CE7A0E4880BD407AEA /* Frameworks */,\n\t\t\t\t4C2672EC9F84CBE81BDD3EE0F22FAE85 /* Products */,\n\t\t\t\t4EAF81689127E1647F677EFB3A7FB3B0 /* TZImagePickerController */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C2672EC9F84CBE81BDD3EE0F22FAE85 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0DBF2C5C77D8316134001812A5BD25EF /* TZImagePickerController */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4EAF81689127E1647F677EFB3A7FB3B0 /* TZImagePickerController */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB6DAFA2AF17496996E11F0AE491360B5 /* NSBundle+TZImagePicker.h */,\n\t\t\t\tB130CAD9D4B148951593B1120EDDF4C4 /* NSBundle+TZImagePicker.m */,\n\t\t\t\t8B52A1066DAE5FF487DA01471157B277 /* TZAssetCell.h */,\n\t\t\t\t99F459D3428E65B07E238B6454BD2EB2 /* TZAssetCell.m */,\n\t\t\t\t8C39F5F0D1A78DA8B296C3EB28597F03 /* TZAssetModel.h */,\n\t\t\t\t3EE620B2F763336A7069DB97E2478C55 /* TZAssetModel.m */,\n\t\t\t\t9590E85381ABB5DCA5A5BB2C8BDA3EF9 /* TZAuthLimitedFooterTipView.h */,\n\t\t\t\t18B71F829D8172FD5AEF3E9E447493F3 /* TZAuthLimitedFooterTipView.m */,\n\t\t\t\t33A214882A65FBEF13E78EDEAACA6002 /* TZGifPhotoPreviewController.h */,\n\t\t\t\t9E21C136665BF59789EB2133EDFA37F2 /* TZGifPhotoPreviewController.m */,\n\t\t\t\t3699672A3DC4C9E30F04BED708A79FC1 /* TZImageCropManager.h */,\n\t\t\t\t29C53B6138B5F243676AB99CD8EE794B /* TZImageCropManager.m */,\n\t\t\t\t146072AEF2BEE6BAB1A10AD83106A444 /* TZImageManager.h */,\n\t\t\t\tC857115962741A452067E21328147648 /* TZImageManager.m */,\n\t\t\t\t401B46BA3C535C9B953B767EC0BA449C /* TZImagePickerController.h */,\n\t\t\t\t8C6610AFA642EA43E40DD712FF0465F4 /* TZImagePickerController.m */,\n\t\t\t\tFBADB8D3C76C9234424E2064BC4C2B96 /* TZImageRequestOperation.h */,\n\t\t\t\t3AF7767700AA9039D196EB1061A63662 /* TZImageRequestOperation.m */,\n\t\t\t\t63C513DB5CE4C167174054BB2359AA92 /* TZLocationManager.h */,\n\t\t\t\t9D2D89A2A1FCC74BEFAE3D1233B7EE61 /* TZLocationManager.m */,\n\t\t\t\t7C4117A638E93D156A24975BBF55AEE8 /* TZPhotoPickerController.h */,\n\t\t\t\tE511D8191689376DF9B852F4469BF9B2 /* TZPhotoPickerController.m */,\n\t\t\t\tEEEF085F33E2A32AAD53D0E633231EF5 /* TZPhotoPreviewCell.h */,\n\t\t\t\tE99AF284405E2435959EF09B5489F01D /* TZPhotoPreviewCell.m */,\n\t\t\t\t06EC2B0B6C952552E1DABF4B894D4E98 /* TZPhotoPreviewController.h */,\n\t\t\t\t2B932A6E4E829379223F210BA5F9085D /* TZPhotoPreviewController.m */,\n\t\t\t\t2F778A426CACCF5A11E1CD26F4480A0B /* TZProgressView.h */,\n\t\t\t\t40A2F310E9995E49FC5368A2DD66D9CA /* TZProgressView.m */,\n\t\t\t\t288FCC4FB2D4BFCBE3C5DDCE984984CF /* TZVideoCropController.h */,\n\t\t\t\tEE2B19D937DAB0FB52768520F9AA6F0E /* TZVideoCropController.m */,\n\t\t\t\t8FD9CF3E67A7B43F0DA6A050140B27DB /* TZVideoEditedPreviewController.h */,\n\t\t\t\tCE52B8FD5A7B6CCD9E4B603C92F52FCC /* TZVideoEditedPreviewController.m */,\n\t\t\t\t3335F26F1BB4517AB1B2932A4202C2E0 /* TZVideoPlayerController.h */,\n\t\t\t\t5356B272DBF15F3D33939D8341A4B262 /* TZVideoPlayerController.m */,\n\t\t\t\t93F155CC40CDD113F634E7E4B6E7DC8F /* UIView+TZLayout.h */,\n\t\t\t\t59955B4A75A957B74BBC0B8E77AD25BA /* UIView+TZLayout.m */,\n\t\t\t\t1A205C7D38FD0DD0B460DFCB164E261C /* Resources */,\n\t\t\t\tA6425FA88D907D65F310991D27AABD47 /* Support Files */,\n\t\t\t);\n\t\t\tname = TZImagePickerController;\n\t\t\tpath = TZImagePickerController;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA6425FA88D907D65F310991D27AABD47 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBE1F74B737E26ABD169D9870AE376872 /* TZImagePickerController.modulemap */,\n\t\t\t\t6A23AAD7252C3AE86989A8FE85A8EB9E /* TZImagePickerController-dummy.m */,\n\t\t\t\t9A46BFC226685E337CF52FDB0393AC57 /* TZImagePickerController-Info.plist */,\n\t\t\t\tDF7E3EDD4A960A79E0D311767E208B6C /* TZImagePickerController-prefix.pch */,\n\t\t\t\tE5800CCC85CF90D88F0DBEC6D83808DD /* TZImagePickerController-umbrella.h */,\n\t\t\t\t404028CEE6475EEF443DBCE7A1361E26 /* TZImagePickerController.debug.xcconfig */,\n\t\t\t\t79AF540873E2761FA3E85C022D01098A /* TZImagePickerController.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/TZImagePickerController\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA6F2E459F4A0703301C2343C7386E6AF /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0E4A393432B58E8A982E19459DFB001C /* Foundation.framework */,\n\t\t\t\tB43172B64AF87506786D6020CE20734F /* Photos.framework */,\n\t\t\t\t86E9858900CEA4F67BD0B616EB926D9C /* PhotosUI.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tE53654DA2E7D49372C3BC9A9C4E4FF69 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t25900CB456C8B34A0BCCFF2DFF17B6CC /* NSBundle+TZImagePicker.h in Headers */,\n\t\t\t\t96E90C10582BBF7C30A5ED2B0696D963 /* TZAssetCell.h in Headers */,\n\t\t\t\t25B31A801B7280EA46996403201DC155 /* TZAssetModel.h in Headers */,\n\t\t\t\t54893A13ADAE8FA1874A92E157311ACB /* TZAuthLimitedFooterTipView.h in Headers */,\n\t\t\t\tF942B4B0253561ABA81994FA2B948902 /* TZGifPhotoPreviewController.h in Headers */,\n\t\t\t\t98D9BE282D76D02288B05D448B85183D /* TZImageCropManager.h in Headers */,\n\t\t\t\tDB4FBBC974C4CAFDD570D7AE544C9623 /* TZImageManager.h in Headers */,\n\t\t\t\t65E6185AD3801C3526C2891C04E4E41C /* TZImagePickerController.h in Headers */,\n\t\t\t\tC21C052721968129963969D49823427F /* TZImagePickerController-umbrella.h in Headers */,\n\t\t\t\t6C60E90C70E42BB2C1C3BDC5069953D0 /* TZImageRequestOperation.h in Headers */,\n\t\t\t\t23180A75EAA1C133E50C5EF5DB253A9C /* TZLocationManager.h in Headers */,\n\t\t\t\tFEB3E4BC159DFE29683AFF9ADCDC6C13 /* TZPhotoPickerController.h in Headers */,\n\t\t\t\t366400DCA09ACD68EA5DCA1213DEC8DB /* TZPhotoPreviewCell.h in Headers */,\n\t\t\t\t68AF51698C5CEA352A18377874BD55CC /* TZPhotoPreviewController.h in Headers */,\n\t\t\t\tBDAE73F7AE61B164D587F85AE0ABA4BD /* TZProgressView.h in Headers */,\n\t\t\t\tBCEE42145EF2F5D867AF485724436AEF /* TZVideoCropController.h in Headers */,\n\t\t\t\t176058F07BE278AE8BC50AE5F2239181 /* TZVideoEditedPreviewController.h in Headers */,\n\t\t\t\t508495A6ED2780904C9DF9FAAB612C3B /* TZVideoPlayerController.h in Headers */,\n\t\t\t\tB283E2A016CF9BD2139890469A07A930 /* UIView+TZLayout.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t6090C91802307673CBF0A57EF1608978 /* TZImagePickerController */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = DEF28D4F6A69F3722F75FC0F04BA6086 /* Build configuration list for PBXNativeTarget \"TZImagePickerController\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tE53654DA2E7D49372C3BC9A9C4E4FF69 /* Headers */,\n\t\t\t\tD733F2B532642770F13E221E671077AD /* Sources */,\n\t\t\t\t0C36196FE3D46A7422F69E1726BC580C /* Frameworks */,\n\t\t\t\t2AD7A18BD3529192D23CCBA2375C2FD9 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = TZImagePickerController;\n\t\t\tproductName = TZImagePickerController;\n\t\t\tproductReference = 0DBF2C5C77D8316134001812A5BD25EF /* TZImagePickerController */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t5B50B2C00161813BCE250E120E9466A2 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = A085F08C446C82E654931299CE861F77 /* Build configuration list for PBXProject \"TZImagePickerController\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 39008159B294EAE29777D0A1797B0276;\n\t\t\tproductRefGroup = 4C2672EC9F84CBE81BDD3EE0F22FAE85 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t6090C91802307673CBF0A57EF1608978 /* TZImagePickerController */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t2AD7A18BD3529192D23CCBA2375C2FD9 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3514C46309F2215BA2E9EFBD7B61EAB3 /* TZImagePickerController.bundle in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tD733F2B532642770F13E221E671077AD /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC7BD6486D6D4AE177907659B7F7F3870 /* NSBundle+TZImagePicker.m in Sources */,\n\t\t\t\t09E8D055B6D21F61BA0583968C91412D /* TZAssetCell.m in Sources */,\n\t\t\t\t5354F42908B1BCEE5DECDF257F26FEA7 /* TZAssetModel.m in Sources */,\n\t\t\t\t982FE76A3D77F9E70C6E0892A2805D98 /* TZAuthLimitedFooterTipView.m in Sources */,\n\t\t\t\t034B10F260F7FEAFD9547E2D063C914D /* TZGifPhotoPreviewController.m in Sources */,\n\t\t\t\tD23336A5CD373056912FD8BBDC203F39 /* TZImageCropManager.m in Sources */,\n\t\t\t\tB954790AAF573D4F02D0830AE25CD9B8 /* TZImageManager.m in Sources */,\n\t\t\t\t18E8C502FB85F0517471D9153C3C11AD /* TZImagePickerController.m in Sources */,\n\t\t\t\t037D9ECB6247D17E2B5D0F6D8F35420C /* TZImagePickerController-dummy.m in Sources */,\n\t\t\t\tE7E703D98D659317CD0D630C4C3B86CA /* TZImageRequestOperation.m in Sources */,\n\t\t\t\t752349FF1269E924F53E4CF0A714A079 /* TZLocationManager.m in Sources */,\n\t\t\t\t79B4FFE39357632099F104440941DC74 /* TZPhotoPickerController.m in Sources */,\n\t\t\t\t935AF0C6C3DA8F8F4BA8104B21FC1E4F /* TZPhotoPreviewCell.m in Sources */,\n\t\t\t\t805CB18AB38DC45F7FE0E176C5E85E3A /* TZPhotoPreviewController.m in Sources */,\n\t\t\t\t767D98A178AAF141CCE6A5FE03DC9E47 /* TZProgressView.m in Sources */,\n\t\t\t\t13B36CD5CEA47640ABE19D7A9BFD1A3A /* TZVideoCropController.m in Sources */,\n\t\t\t\tB9F326D39023969724323CAFF8C34FFC /* TZVideoEditedPreviewController.m in Sources */,\n\t\t\t\tB4630D5A8C2186F1E27F9C06E4F7857C /* TZVideoPlayerController.m in Sources */,\n\t\t\t\tC3F1A292EB6419AD7AECF1FCB19A063B /* UIView+TZLayout.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t0F309700BE30714E7E9BE61ED46EC7AC /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 79AF540873E2761FA3E85C022D01098A /* TZImagePickerController.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/TZImagePickerController/TZImagePickerController-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/TZImagePickerController/TZImagePickerController-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/TZImagePickerController/TZImagePickerController.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = TZImagePickerController;\n\t\t\t\tPRODUCT_NAME = TZImagePickerController;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t2F9A407B49CF70DB83DD6D529EA937E6 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t5773AB3F33F744AF16F1FB0119F12533 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tE9138ABF59EA2365B795302D4A6C8250 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 404028CEE6475EEF443DBCE7A1361E26 /* TZImagePickerController.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/TZImagePickerController/TZImagePickerController-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/TZImagePickerController/TZImagePickerController-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/TZImagePickerController/TZImagePickerController.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = TZImagePickerController;\n\t\t\t\tPRODUCT_NAME = TZImagePickerController;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tA085F08C446C82E654931299CE861F77 /* Build configuration list for PBXProject \"TZImagePickerController\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t2F9A407B49CF70DB83DD6D529EA937E6 /* Debug */,\n\t\t\t\t5773AB3F33F744AF16F1FB0119F12533 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDEF28D4F6A69F3722F75FC0F04BA6086 /* Build configuration list for PBXNativeTarget \"TZImagePickerController\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tE9138ABF59EA2365B795302D4A6C8250 /* Debug */,\n\t\t\t\t0F309700BE30714E7E9BE61ED46EC7AC /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 5B50B2C00161813BCE250E120E9466A2 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Alamofire/Alamofire-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.6.1</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Alamofire/Alamofire-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Alamofire : NSObject\n@end\n@implementation PodsDummy_Alamofire\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double AlamofireVersionNumber;\nFOUNDATION_EXPORT const unsigned char AlamofireVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Alamofire/Alamofire.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"CFNetwork\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Alamofire\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Alamofire/Alamofire.modulemap",
    "content": "framework module Alamofire {\n  umbrella header \"Alamofire-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Alamofire/Alamofire.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"CFNetwork\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Alamofire\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.1.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_FDFullscreenPopGesture : NSObject\n@end\n@implementation PodsDummy_FDFullscreenPopGesture\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"UINavigationController+FDFullscreenPopGesture.h\"\n\nFOUNDATION_EXPORT double FDFullscreenPopGestureVersionNumber;\nFOUNDATION_EXPORT const unsigned char FDFullscreenPopGestureVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FDFullscreenPopGesture\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/FDFullscreenPopGesture\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture.modulemap",
    "content": "framework module FDFullscreenPopGesture {\n  umbrella header \"FDFullscreenPopGesture-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/FDFullscreenPopGesture/FDFullscreenPopGesture.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/FDFullscreenPopGesture\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/FDFullscreenPopGesture\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/HandyJSON/HandyJSON-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.0.2</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/HandyJSON/HandyJSON-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_HandyJSON : NSObject\n@end\n@implementation PodsDummy_HandyJSON\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/HandyJSON/HandyJSON-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/HandyJSON/HandyJSON-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"HandyJSON.h\"\n\nFOUNDATION_EXPORT double HandyJSONVersionNumber;\nFOUNDATION_EXPORT const unsigned char HandyJSONVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/HandyJSON/HandyJSON.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HandyJSON\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/HandyJSON\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSWIFT_VERSION = 5.0\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/HandyJSON/HandyJSON.modulemap",
    "content": "framework module HandyJSON {\n  umbrella header \"HandyJSON-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/HandyJSON/HandyJSON.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HandyJSON\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/HandyJSON\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSWIFT_VERSION = 5.0\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListDiffKit/IGListDiffKit-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>4.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListDiffKit/IGListDiffKit-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_IGListDiffKit : NSObject\n@end\n@implementation PodsDummy_IGListDiffKit\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListDiffKit/IGListDiffKit-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListDiffKit/IGListDiffKit-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"IGListAssert.h\"\n#import \"IGListBatchUpdateData.h\"\n#import \"IGListCompatibility.h\"\n#import \"IGListDiff.h\"\n#import \"IGListDiffable.h\"\n#import \"IGListDiffKit.h\"\n#import \"IGListExperiments.h\"\n#import \"IGListIndexPathResult.h\"\n#import \"IGListIndexSetResult.h\"\n#import \"IGListMacros.h\"\n#import \"IGListMoveIndex.h\"\n#import \"IGListMoveIndexPath.h\"\n#import \"NSNumber+IGListDiffable.h\"\n#import \"NSString+IGListDiffable.h\"\n\nFOUNDATION_EXPORT double IGListDiffKitVersionNumber;\nFOUNDATION_EXPORT const unsigned char IGListDiffKitVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListDiffKit/IGListDiffKit.debug.xcconfig",
    "content": "CLANG_CXX_LANGUAGE_STANDARD = c++11\nCLANG_CXX_LIBRARY = libc++\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/IGListDiffKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListDiffKit/IGListDiffKit.modulemap",
    "content": "framework module IGListDiffKit {\n  umbrella header \"IGListDiffKit-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListDiffKit/IGListDiffKit.release.xcconfig",
    "content": "CLANG_CXX_LANGUAGE_STANDARD = c++11\nCLANG_CXX_LIBRARY = libc++\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/IGListDiffKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListKit/IGListKit-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>4.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListKit/IGListKit-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_IGListKit : NSObject\n@end\n@implementation PodsDummy_IGListKit\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListKit/IGListKit-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListKit/IGListKit-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"IGListAdapter.h\"\n#import \"IGListAdapterDataSource.h\"\n#import \"IGListAdapterDelegate.h\"\n#import \"IGListAdapterMoveDelegate.h\"\n#import \"IGListAdapterPerformanceDelegate.h\"\n#import \"IGListAdapterUpdateListener.h\"\n#import \"IGListAdapterUpdater.h\"\n#import \"IGListAdapterUpdaterDelegate.h\"\n#import \"IGListBatchContext.h\"\n#import \"IGListBindable.h\"\n#import \"IGListBindingSectionController.h\"\n#import \"IGListBindingSectionControllerDataSource.h\"\n#import \"IGListBindingSectionControllerSelectionDelegate.h\"\n#import \"IGListCollectionContext.h\"\n#import \"IGListCollectionScrollingTraits.h\"\n#import \"IGListCollectionView.h\"\n#import \"IGListCollectionViewDelegateLayout.h\"\n#import \"IGListCollectionViewLayout.h\"\n#import \"IGListCollectionViewLayoutCompatible.h\"\n#import \"IGListDisplayDelegate.h\"\n#import \"IGListGenericSectionController.h\"\n#import \"IGListKit.h\"\n#import \"IGListReloadDataUpdater.h\"\n#import \"IGListScrollDelegate.h\"\n#import \"IGListSectionController.h\"\n#import \"IGListSingleSectionController.h\"\n#import \"IGListSupplementaryViewSource.h\"\n#import \"IGListTransitionDelegate.h\"\n#import \"IGListUpdatingDelegate.h\"\n#import \"IGListWorkingRangeDelegate.h\"\n\nFOUNDATION_EXPORT double IGListKitVersionNumber;\nFOUNDATION_EXPORT const unsigned char IGListKitVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListKit/IGListKit.debug.xcconfig",
    "content": "CLANG_CXX_LANGUAGE_STANDARD = c++11\nCLANG_CXX_LIBRARY = libc++\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/IGListKit\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -framework \"IGListDiffKit\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/IGListKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListKit/IGListKit.modulemap",
    "content": "framework module IGListKit {\n  umbrella header \"IGListKit-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IGListKit/IGListKit.release.xcconfig",
    "content": "CLANG_CXX_LANGUAGE_STANDARD = c++11\nCLANG_CXX_LIBRARY = libc++\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/IGListKit\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -framework \"IGListDiffKit\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/IGListKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>6.5.9</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_IQKeyboardManagerSwift : NSObject\n@end\n@implementation PodsDummy_IQKeyboardManagerSwift\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double IQKeyboardManagerSwiftVersionNumber;\nFOUNDATION_EXPORT const unsigned char IQKeyboardManagerSwiftVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"CoreGraphics\" -framework \"Foundation\" -framework \"QuartzCore\" -framework \"UIKit\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/IQKeyboardManagerSwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift.modulemap",
    "content": "framework module IQKeyboardManagerSwift {\n  umbrella header \"IQKeyboardManagerSwift-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"CoreGraphics\" -framework \"Foundation\" -framework \"QuartzCore\" -framework \"UIKit\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/IQKeyboardManagerSwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Kingfisher/Kingfisher-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>6.3.1</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Kingfisher/Kingfisher-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Kingfisher : NSObject\n@end\n@implementation PodsDummy_Kingfisher\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Kingfisher/Kingfisher-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Kingfisher/Kingfisher-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double KingfisherVersionNumber;\nFOUNDATION_EXPORT const unsigned char KingfisherVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Kingfisher/Kingfisher.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Accelerate\" -framework \"CFNetwork\" -weak_framework \"Combine\" -weak_framework \"SwiftUI\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Kingfisher\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Kingfisher/Kingfisher.modulemap",
    "content": "framework module Kingfisher {\n  umbrella header \"Kingfisher-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Kingfisher/Kingfisher.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Accelerate\" -framework \"CFNetwork\" -weak_framework \"Combine\" -weak_framework \"SwiftUI\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Kingfisher\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Localize-Swift/Localize-Swift-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>3.2.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Localize-Swift/Localize-Swift-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Localize_Swift : NSObject\n@end\n@implementation PodsDummy_Localize_Swift\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Localize-Swift/Localize-Swift-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Localize-Swift/Localize-Swift-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"Localize_Swift.h\"\n\nFOUNDATION_EXPORT double Localize_SwiftVersionNumber;\nFOUNDATION_EXPORT const unsigned char Localize_SwiftVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Localize-Swift/Localize-Swift.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Localize-Swift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Localize-Swift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSWIFT_VERSION = 5.3\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Localize-Swift/Localize-Swift.modulemap",
    "content": "framework module Localize_Swift {\n  umbrella header \"Localize-Swift-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Localize-Swift/Localize-Swift.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Localize-Swift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Localize-Swift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSWIFT_VERSION = 5.3\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/LookinServer/LookinServer-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.5</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/LookinServer/LookinServer-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_LookinServer : NSObject\n@end\n@implementation PodsDummy_LookinServer\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/LookinServer/LookinServer-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/LookinServer/LookinServer-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"CALayer+LookinServer.h\"\n#import \"NSObject+LookinServer.h\"\n#import \"UIBlurEffect+LookinServer.h\"\n#import \"UIColor+LookinServer.h\"\n#import \"UIGestureRecognizer+LookinServer.h\"\n#import \"UIImage+LookinServer.h\"\n#import \"UIImageView+LookinServer.h\"\n#import \"UILabel+LookinServer.h\"\n#import \"UITableView+LookinServer.h\"\n#import \"UITextField+LookinServer.h\"\n#import \"UITextView+LookinServer.h\"\n#import \"UIView+LookinServer.h\"\n#import \"UIViewController+LookinServer.h\"\n#import \"UIVisualEffectView+LookinServer.h\"\n#import \"LKS_ConnectionManager.h\"\n#import \"LKS_RequestHandler.h\"\n#import \"LKS_AttrModificationHandler.h\"\n#import \"LKS_AttrModificationPatchHandler.h\"\n#import \"LKS_HierarchyDetailsHandler.h\"\n#import \"LKS_LocalInspectManager.h\"\n#import \"LKS_LocalInspectPanelLabelView.h\"\n#import \"LKS_LocalInspectViewController.h\"\n#import \"LookinServer.h\"\n#import \"LKS_AttrGroupsMaker.h\"\n#import \"LKS_EventHandlerMaker.h\"\n#import \"LKS_ExportManager.h\"\n#import \"LKS_Helper.h\"\n#import \"LKS_HierarchyDisplayItemsMaker.h\"\n#import \"LKS_MethodTraceManager.h\"\n#import \"LKS_ObjectRegistry.h\"\n#import \"LKS_TraceManager.h\"\n#import \"LookinServerDefines.h\"\n#import \"LKS_PerspectiveDataSource.h\"\n#import \"LKS_PerspectiveHierarchyCell.h\"\n#import \"LKS_PerspectiveHierarchyView.h\"\n#import \"LKS_PerspectiveItemLayer.h\"\n#import \"LKS_PerspectiveLayer.h\"\n#import \"LKS_PerspectiveManager.h\"\n#import \"LKS_PerspectiveToolbarButtons.h\"\n#import \"LKS_PerspectiveViewController.h\"\n#import \"CALayer+Lookin.h\"\n#import \"NSArray+Lookin.h\"\n#import \"NSObject+Lookin.h\"\n#import \"NSSet+Lookin.h\"\n#import \"NSString+Lookin.h\"\n#import \"LookinAppInfo.h\"\n#import \"LookinAttribute.h\"\n#import \"LookinAttributeModification.h\"\n#import \"LookinAttributesGroup.h\"\n#import \"LookinAttributesSection.h\"\n#import \"LookinAttrIdentifiers.h\"\n#import \"LookinAttrType.h\"\n#import \"LookinAutoLayoutConstraint.h\"\n#import \"LookinCodingValueType.h\"\n#import \"LookinConnectionAttachment.h\"\n#import \"LookinConnectionResponseAttachment.h\"\n#import \"LookinDashboardBlueprint.h\"\n#import \"LookinDefines.h\"\n#import \"LookinDisplayItem.h\"\n#import \"LookinDisplayItemDetail.h\"\n#import \"LookinEventHandler.h\"\n#import \"LookinHierarchyFile.h\"\n#import \"LookinHierarchyInfo.h\"\n#import \"LookinIvarTrace.h\"\n#import \"LookinMethodTraceRecord.h\"\n#import \"LookinObject.h\"\n#import \"LookinScreenshotFetchManager.h\"\n#import \"LookinStaticAsyncUpdateTask.h\"\n#import \"LookinTuple.h\"\n#import \"LookinWeakContainer.h\"\n#import \"LookinMsgAttribute.h\"\n#import \"LookinMsgTargetAction.h\"\n#import \"Lookin_PTChannel.h\"\n#import \"Lookin_PTPrivate.h\"\n#import \"Lookin_PTProtocol.h\"\n#import \"Lookin_PTUSBHub.h\"\n#import \"Peertalk.h\"\n\nFOUNDATION_EXPORT double LookinServerVersionNumber;\nFOUNDATION_EXPORT const unsigned char LookinServerVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/LookinServer/LookinServer.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/LookinServer\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/LookinServer\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/LookinServer/LookinServer.modulemap",
    "content": "framework module LookinServer {\n  umbrella header \"LookinServer-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/LookinServer/LookinServer.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/LookinServer\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/LookinServer\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MBProgressHUD/MBProgressHUD-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.2.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MBProgressHUD/MBProgressHUD-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_MBProgressHUD : NSObject\n@end\n@implementation PodsDummy_MBProgressHUD\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MBProgressHUD/MBProgressHUD-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MBProgressHUD/MBProgressHUD-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"MBProgressHUD.h\"\n\nFOUNDATION_EXPORT double MBProgressHUDVersionNumber;\nFOUNDATION_EXPORT const unsigned char MBProgressHUDVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MBProgressHUD/MBProgressHUD.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"CoreGraphics\" -framework \"QuartzCore\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/MBProgressHUD\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MBProgressHUD/MBProgressHUD.modulemap",
    "content": "framework module MBProgressHUD {\n  umbrella header \"MBProgressHUD-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MBProgressHUD/MBProgressHUD.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"CoreGraphics\" -framework \"QuartzCore\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/MBProgressHUD\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MJRefresh/MJRefresh-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>3.7.5</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MJRefresh/MJRefresh-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_MJRefresh : NSObject\n@end\n@implementation PodsDummy_MJRefresh\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MJRefresh/MJRefresh-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MJRefresh/MJRefresh-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"MJRefreshAutoFooter.h\"\n#import \"MJRefreshBackFooter.h\"\n#import \"MJRefreshComponent.h\"\n#import \"MJRefreshFooter.h\"\n#import \"MJRefreshHeader.h\"\n#import \"MJRefreshTrailer.h\"\n#import \"MJRefreshAutoGifFooter.h\"\n#import \"MJRefreshAutoNormalFooter.h\"\n#import \"MJRefreshAutoStateFooter.h\"\n#import \"MJRefreshBackGifFooter.h\"\n#import \"MJRefreshBackNormalFooter.h\"\n#import \"MJRefreshBackStateFooter.h\"\n#import \"MJRefreshGifHeader.h\"\n#import \"MJRefreshNormalHeader.h\"\n#import \"MJRefreshStateHeader.h\"\n#import \"MJRefreshNormalTrailer.h\"\n#import \"MJRefreshStateTrailer.h\"\n#import \"MJRefresh.h\"\n#import \"MJRefreshConfig.h\"\n#import \"MJRefreshConst.h\"\n#import \"NSBundle+MJRefresh.h\"\n#import \"UICollectionViewLayout+MJRefresh.h\"\n#import \"UIScrollView+MJExtension.h\"\n#import \"UIScrollView+MJRefresh.h\"\n#import \"UIView+MJExtension.h\"\n\nFOUNDATION_EXPORT double MJRefreshVersionNumber;\nFOUNDATION_EXPORT const unsigned char MJRefreshVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MJRefresh/MJRefresh.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/MJRefresh\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MJRefresh/MJRefresh.modulemap",
    "content": "framework module MJRefresh {\n  umbrella header \"MJRefresh-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/MJRefresh/MJRefresh.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/MJRefresh\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Moya/Moya-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>15.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Moya/Moya-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Moya : NSObject\n@end\n@implementation PodsDummy_Moya\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Moya/Moya-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Moya/Moya-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double MoyaVersionNumber;\nFOUNDATION_EXPORT const unsigned char MoyaVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Moya/Moya.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Moya\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Alamofire\" -framework \"CFNetwork\" -framework \"Foundation\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Moya\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Moya/Moya.modulemap",
    "content": "framework module Moya {\n  umbrella header \"Moya-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Moya/Moya.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Moya\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Alamofire\" -framework \"CFNetwork\" -framework \"Foundation\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Moya\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/NSObject+Rx/NSObject+Rx-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.2.2</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/NSObject+Rx/NSObject+Rx-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_NSObject_Rx : NSObject\n@end\n@implementation PodsDummy_NSObject_Rx\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/NSObject+Rx/NSObject+Rx-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/NSObject+Rx/NSObject+Rx-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double NSObject_RxVersionNumber;\nFOUNDATION_EXPORT const unsigned char NSObject_RxVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/NSObject+Rx/NSObject+Rx.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/NSObject+Rx\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/NSObject+Rx\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/NSObject+Rx/NSObject+Rx.modulemap",
    "content": "framework module NSObject_Rx {\n  umbrella header \"NSObject+Rx-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/NSObject+Rx/NSObject+Rx.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/NSObject+Rx\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/NSObject+Rx\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-acknowledgements.markdown",
    "content": "# Acknowledgements\nThis application makes use of the following third party libraries:\n\n## Alamofire\n\nCopyright (c) 2014-2022 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## FDFullscreenPopGesture\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## HandyJSON\n\n   Copyright 1999-2016  Alibaba Group Holding Ltd.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n1. reflection\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Brad Hilton\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n2. ObjectMapper\n\nThe MIT License (MIT)\nCopyright (c) 2014 Hearst\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n## IGListDiffKit\n\nMIT License\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## IGListKit\n\nMIT License\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## IQKeyboardManagerSwift\n\nMIT License\n\nCopyright (c) 2013-2017 Iftekhar Qurashi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n## Kingfisher\n\nThe MIT License (MIT)\n\nCopyright (c) 2019 Wei Wang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## Localize-Swift\n\nCopyright (c) 2015 Roy Marmelstein (http://roysapps.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## LookinServer\n\n                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n\n\n## MBProgressHUD\n\nCopyright © 2009-2020 Matej Bukovinski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n## MJRefresh\n\nCopyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## Moya\n\nThe MIT License (MIT)\n\nCopyright (c) 2014-present Artsy, Ash Furrow\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n## NSObject+Rx\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Ash Furrow\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## R.swift\n\nThe MIT License (MIT)\n\nCopyright (c) 2014-2020 Mathijs Kadijk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## R.swift.Library\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Mathijs Kadijk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## ReachabilitySwift\n\nCopyright (c) 2016 Ashley Mills\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## RxCocoa\n\n**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n## RxRelay\n\n**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n## RxSwift\n\n**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n## RxTheme\n\nCopyright (c) 2018 RxSwiftCommunity\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## SDWebImage\n\nCopyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com\n \nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is furnished\nto do so, subject to the following conditions:\n \nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n\n## SQLiteRepairKit\n\nTencent is pleased to support the open source community by making WCDB available.  \n\nCopyright (C) 2017 THL A29 Limited, a Tencent company.  All rights reserved.\nIf you have downloaded a copy of the WCDB binary from Tencent, please note that \nthe WCDB binary is licensed under the BSD 3-Clause License.\n\nIf you have downloaded a copy of the WCDB source code from Tencent, please note \nthat WCDB source code is licensed under the BSD 3-Clause License, except for \nthe third-party components listed below which are subject to different license \nterms.  Your integration of WCDB into your own projects may require compliance \nwith the BSD 3-Clause License, as well as the other licenses applicable to the \nthird-party components included within WCDB.\n\nA copy of the BSD 3-Clause License is included in this file.\nOther dependencies and licenses:\n \nOpen Source Software Licensed Under the Apache License, Version 2.0: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n\n----------------------------------------------------------------------------------------\n1. Android Source Code  4.3\nCopyright (C) 2006-2011 The Android Open Source Project \n \n \nTerms of the Apache License, Version 2.0:\n---------------------------------------------------\nApache License\n\nVersion 2.0, January 2004\n\nhttp://www.apache.org/licenses/\n \nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n \n1. Definitions.\n \n“License” shall mean the terms and conditions for use, reproduction, and distribution\nas defined by Sections 1 through 9 of this document.\n \n“Licensor” shall mean the copyright owner or entity authorized by the copyright owner\nthat is granting the License.\n \n“Legal Entity” shall mean the union of the acting entity and all other entities that \ncontrol, are controlled by, or are under common control with that entity. For the \npurposes of this definition, “control” means (i) the power, direct or indirect, to \ncause the direction or management of such entity, whether by contract or otherwise, \nor (ii) ownership of fifty percent (50%) or more of the outstanding shares, or \n(iii) beneficial ownership of such entity.\n \n“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions \ngranted by this License.\n \n“Source” form shall mean the preferred form for making modifications, including but \nnot limited to software source code, documentation source, and configuration files.\n \n“Object” form shall mean any form resulting from mechanical transformation or \ntranslation of a Source form, including but not limited to compiled object code, \ngenerated documentation, and conversions to other media types.\n \n“Work” shall mean the work of authorship, whether in Source or Object form, made \navailable under the License, as indicated by a copyright notice that is included \nin or attached to the work (an example is provided in the Appendix below).\n \n“Derivative Works” shall mean any work, whether in Source or Object form, that is \nbased on (or derived from) the Work and for which the editorial revisions, \nannotations, elaborations, or other modifications represent, as a whole, an \noriginal work of authorship. For the purposes of this License, Derivative Works \nshall not include works that remain separable from, or merely link (or bind by \nname) to the interfaces of, the Work and Derivative Works thereof.\n \n“Contribution” shall mean any work of authorship, including the original version \nof the Work and any modifications or additions to that Work or Derivative Works \nthereof, that is intentionally submitted to Licensor for inclusion in the Work \nby the copyright owner or by an individual or Legal Entity authorized to submit \non behalf of the copyright owner. For the purposes of this definition, “submitted” \nmeans any form of electronic, verbal, or written communication sent to the \nLicensor or its representatives, including but not limited to communication on \nelectronic mailing lists, source code control systems, and issue tracking systems \nthat are managed by, or on behalf of, the Licensor for the purpose of discussing \nand improving the Work, but excluding communication that is conspicuously marked \nor otherwise designated in writing by the copyright owner as “Not a Contribution.”\n \n“Contributor” shall mean Licensor and any individual or Legal Entity on behalf \nof whom a Contribution has been received by Licensor and subsequently \nincorporated within the Work.\n \n2. Grant of Copyright License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable copyright license to reproduce, prepare \nDerivative Works of, publicly display, publicly perform, sublicense, and distribute \nthe Work and such Derivative Works in Source or Object form.\n \n3. Grant of Patent License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable (except as stated in this section) patent \nlicense to make, have made, use, offer to sell, sell, import, and otherwise transfer \nthe Work, where such license applies only to those patent claims licensable by such \nContributor that are necessarily infringed by their Contribution(s) alone or by \ncombination of their Contribution(s) with the Work to which such Contribution(s) was \nsubmitted. If You institute patent litigation against any entity (including a \ncross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution \nincorporated within the Work constitutes direct or contributory patent infringement, \nthen any patent licenses granted to You under this License for that Work shall \nterminate as of the date such litigation is filed.\n \n4. Redistribution. You may reproduce and distribute copies of the Work or Derivative \nWorks thereof in any medium, with or without modifications, and in Source or Object \nform, provided that You meet the following conditions:\n \na) You must give any other recipients of the Work or Derivative Works a copy of this \nLicense; and\n \nb) You must cause any modified files to carry prominent notices stating that You \nchanged the files; and\n \nc) You must retain, in the Source form of any Derivative Works that You distribute, \nall copyright, patent, trademark, and attribution notices from the Source form of \nthe Work, excluding those notices that do not pertain to any part of the Derivative \nWorks; and\n \nd) If the Work includes a “NOTICE” text file as part of its distribution, then any \nDerivative Works that You distribute must include a readable copy of the attribution \nnotices contained within such NOTICE file, excluding those notices that do not pertain \nto any part of the Derivative Works, in at least one of the following places: within \na NOTICE text file distributed as part of the Derivative Works; within the Source \nform or documentation, if provided along with the Derivative Works; or, within a \ndisplay generated by the Derivative Works, if and wherever such third-party notices \nnormally appear. The contents of the NOTICE file are for informational purposes only \nand do not modify the License. You may add Your own attribution notices within \nDerivative Works that You distribute, alongside or as an addendum to the NOTICE text \nfrom the Work, provided that such additional attribution notices cannot be construed \nas modifying the License. \n \nYou may add Your own copyright statement to Your modifications and may provide \nadditional or different license terms and conditions for use, reproduction, or \ndistribution of Your modifications, or for any such Derivative Works as a whole, \nprovided Your use, reproduction, and distribution of the Work otherwise complies with \nthe conditions stated in this License. \n \n5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution \nintentionally submitted for inclusion in the Work by You to the Licensor shall be under \nthe terms and conditions of this License, without any additional terms or conditions. \nNotwithstanding the above, nothing herein shall supersede or modify the terms of any \nseparate license agreement you may have executed with Licensor regarding such \nContributions.\n \n6. Trademarks. This License does not grant permission to use the trade names, trademarks, \nservice marks, or product names of the Licensor, except as required for reasonable and \ncustomary use in describing the origin of the Work and reproducing the content of the \nNOTICE file.\n \n7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, \nLicensor provides the Work (and each Contributor provides its Contributions) on an \n“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, \nincluding, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, \nMERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for \ndetermining the appropriateness of using or redistributing the Work and assume any risks \nassociated with Your exercise of permissions under this License.\n \n8. Limitation of Liability. In no event and under no legal theory, whether in tort \n(including negligence), contract, or otherwise, unless required by applicable law (such \nas deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor \nbe liable to You for damages, including any direct, indirect, special, incidental, or \nconsequential damages of any character arising as a result of this License or out of the \nuse or inability to use the Work (including but not limited to damages for loss of \ngoodwill, work stoppage, computer failure or malfunction, or any and all other commercial \ndamages or losses), even if such Contributor has been advised of the possibility of such \ndamages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative \nWorks thereof, You may choose to offer, and charge a fee for, acceptance of support, \nwarranty, indemnity, or other liability obligations and/or rights consistent with this \nLicense. However, in accepting such obligations, You may act only on Your own behalf and \non Your sole responsibility, not on behalf of any other Contributor, and only if You agree \nto indemnify, defend, and hold each Contributor harmless for any liability incurred by, or \nclaims asserted against, such Contributor by reason of your accepting any such warranty or \nadditional liability.\n \nEND OF TERMS AND CONDITIONS\n \nAPPENDIX: How to apply the Apache License to your work\nTo apply the Apache License to your work, attach the following boilerplate notice, with the \nfields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't \ninclude the brackets!) The text should be enclosed in the appropriate comment syntax for \nthe file format. We also recommend that a file or class name and description of purpose be \nincluded on the same \"printed page\" as the copyright notice for easier identification within \nthird-party archives.\n \nCopyright [yyyy] [name of copyright owner]\n \nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n \n \n \nOpen Source Software Licensed Under Public Domain: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLite  3.11.0\n \n \n \nOpen Source Software Licensed Under the OpenSSL License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. OpenSSL  1.0.2j\nCopyright (c) 1998-2016 The OpenSSL Project.\nAll rights reserved.\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \n \n \nTerms of the OpenSSL License:\n---------------------------------------------------\nLICENSE ISSUES:\n--------------------------------------------------------------------\n \nThe OpenSSL toolkit stays under a dual license, i.e. both the conditions of the \nOpenSSL License and the original SSLeay license apply to the toolkit.\nSee below for the actual license texts.\n \nOpenSSL License:\n--------------------------------------------------------------------\nCopyright (c) 1998-2016 The OpenSSL Project.  All rights reserved.\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n \n1. Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n \n2. Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n \n3. All advertising materials mentioning features or use of this software must \ndisplay the following acknowledgment:\n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit. (http://www.openssl.org/)\"\n \n4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to endorse or \npromote products derived from this software without prior written permission. For \nwritten permission, please contact openssl-core@openssl.org.\n \n5. Products derived from this software may not be called \"OpenSSL\" nor may \"OpenSSL\" \nappear in their names without prior written permission of the OpenSSL Project.\n \n6. Redistributions of any form whatsoever must retain the following acknowledgment: \n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/)\"\n \nTHIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR \nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \nSHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE. \n====================================================================\n* This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).  \nThis product includes software written by Tim Hudson (tjh@cryptsoft.com).\n \n \nOriginal SSLeay License:\n--------------------------------------------------------------------\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \nThis package is an SSL implementation written by Eric Young (eay@cryptsoft.com).\nThe implementation was written so as to conform with Netscapes SSL.\n \nThis library is free for commercial and non-commercial use as long as the following \nconditions are aheared to. The following conditions apply to all code found in this \ndistribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. \nThe SSL documentation included with this distribution is covered by the same copyright \nterms except that the holder is Tim Hudson (tjh@cryptsoft.com). \n \nCopyright remains Eric Young's, and as such any Copyright notices in the code are not \nto be removed.  If this package is used in a product, Eric Young should be given \nattribution as the author of the parts of the library used. This can be in the form \nof a textual message at program startup or in documentation (online or textual) \nprovided with the package. \n  \nRedistribution and use in source and binary forms, with or without modification, are \npermitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the copyright notice, this list of \nconditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list \nof conditions and the following disclaimer in the documentation and/or other materials \nprovided with the distribution.\n\n3. All advertising materials mentioning features or use of this software must display \nthe following acknowledgement:\" This product includes cryptographic software written \nby Eric Young (eay@cryptsoft.com)\" The word 'cryptographic' can be left out if the \nrouines from the library being used are not cryptographic related :-).\n\n4. If you include any Windows specific code (or a derivative thereof) from the apps \ndirectory (application code) you must include an acknowledgement: \"This product includes \nsoftware written by Tim Hudson (tjh@cryptsoft.com)\"\n \nTHIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, \nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR \nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE \nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH \nDAMAGE. \n  \nThe licence and distribution terms for any publically available version or derivative of \nthis code cannot be changed.  i.e. this code cannot simply be copied and put under another \ndistribution licence [including the GNU Public Licence.]\n \n \n \nOpen Source Software Licensed Under the ICU License: \n----------------------------------------------------------------------------------------\n1. ICU4C  50.1\nCopyright (c) 1995-2012 International Business Machines Corporation and others\nAll rights reserved.\n \n \nTerms of the ICU License:\n--------------------------------------------------------------------\nICU License - ICU 1.8.1 and later\n \nCOPYRIGHT AND PERMISSION NOTICE\n \nCopyright (c) 1995-2012 International Business Machines Corporation and others\n \nAll rights reserved.\n \nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in the \nSoftware without restriction, including without limitation the rights to use, copy, \nmodify, merge, publish, distribute, and/or sell copies of the Software, and to permit \npersons to whom the Software is furnished to do so, provided that the above copyright \nnotice(s) and this permission notice appear in all copies of the Software and that both \nthe above copyright notice(s) and this permission notice appear in supporting \ndocumentation.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, \nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \nPURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER \nOR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR \nCONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR \nPROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING \nOUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \nExcept as contained in this notice, the name of a copyright holder shall not be used in \nadvertising or otherwise to promote the sale, use or other dealings in this Software \nwithout prior written authorization of the copyright holder.\n \nAll trademarks and registered trademarks mentioned herein are the property of their \nrespective owners.\n \n \nOpen Source Software Licensed Under the BSD 3-Clause License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLCipher  3.4.0\nCopyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n \n \n \nTerms of the BSD 3-Clause License:\n--------------------------------------------------------------------\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n\nl  Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n\nl  Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n\nl  Neither the name of [copyright holder] nor the names of its contributors may be \nused to endorse or promote products derived from this software without specific \nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE.\n\n\n## SnapKit\n\nCopyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## SwiftDate\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 Daniele Margutti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## SwifterSwift\n\nMIT License\n\nCopyright (c) 2015-2018 SwifterSwift (https://github.com/swifterswift)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## SwiftyJSON\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Ruoyu Fu\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## TZImagePickerController\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Zhen Tan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## UITableView+FDTemplateLayoutCell\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## UIView+FDCollapsibleConstraints\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 forkingdog\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## WCDB.swift\n\nTencent is pleased to support the open source community by making WCDB available.  \n\nCopyright (C) 2017 THL A29 Limited, a Tencent company.  All rights reserved.\nIf you have downloaded a copy of the WCDB binary from Tencent, please note that \nthe WCDB binary is licensed under the BSD 3-Clause License.\n\nIf you have downloaded a copy of the WCDB source code from Tencent, please note \nthat WCDB source code is licensed under the BSD 3-Clause License, except for \nthe third-party components listed below which are subject to different license \nterms.  Your integration of WCDB into your own projects may require compliance \nwith the BSD 3-Clause License, as well as the other licenses applicable to the \nthird-party components included within WCDB.\n\nA copy of the BSD 3-Clause License is included in this file.\nOther dependencies and licenses:\n \nOpen Source Software Licensed Under the Apache License, Version 2.0: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n\n----------------------------------------------------------------------------------------\n1. Android Source Code  4.3\nCopyright (C) 2006-2011 The Android Open Source Project \n \n \nTerms of the Apache License, Version 2.0:\n---------------------------------------------------\nApache License\n\nVersion 2.0, January 2004\n\nhttp://www.apache.org/licenses/\n \nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n \n1. Definitions.\n \n“License” shall mean the terms and conditions for use, reproduction, and distribution\nas defined by Sections 1 through 9 of this document.\n \n“Licensor” shall mean the copyright owner or entity authorized by the copyright owner\nthat is granting the License.\n \n“Legal Entity” shall mean the union of the acting entity and all other entities that \ncontrol, are controlled by, or are under common control with that entity. For the \npurposes of this definition, “control” means (i) the power, direct or indirect, to \ncause the direction or management of such entity, whether by contract or otherwise, \nor (ii) ownership of fifty percent (50%) or more of the outstanding shares, or \n(iii) beneficial ownership of such entity.\n \n“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions \ngranted by this License.\n \n“Source” form shall mean the preferred form for making modifications, including but \nnot limited to software source code, documentation source, and configuration files.\n \n“Object” form shall mean any form resulting from mechanical transformation or \ntranslation of a Source form, including but not limited to compiled object code, \ngenerated documentation, and conversions to other media types.\n \n“Work” shall mean the work of authorship, whether in Source or Object form, made \navailable under the License, as indicated by a copyright notice that is included \nin or attached to the work (an example is provided in the Appendix below).\n \n“Derivative Works” shall mean any work, whether in Source or Object form, that is \nbased on (or derived from) the Work and for which the editorial revisions, \nannotations, elaborations, or other modifications represent, as a whole, an \noriginal work of authorship. For the purposes of this License, Derivative Works \nshall not include works that remain separable from, or merely link (or bind by \nname) to the interfaces of, the Work and Derivative Works thereof.\n \n“Contribution” shall mean any work of authorship, including the original version \nof the Work and any modifications or additions to that Work or Derivative Works \nthereof, that is intentionally submitted to Licensor for inclusion in the Work \nby the copyright owner or by an individual or Legal Entity authorized to submit \non behalf of the copyright owner. For the purposes of this definition, “submitted” \nmeans any form of electronic, verbal, or written communication sent to the \nLicensor or its representatives, including but not limited to communication on \nelectronic mailing lists, source code control systems, and issue tracking systems \nthat are managed by, or on behalf of, the Licensor for the purpose of discussing \nand improving the Work, but excluding communication that is conspicuously marked \nor otherwise designated in writing by the copyright owner as “Not a Contribution.”\n \n“Contributor” shall mean Licensor and any individual or Legal Entity on behalf \nof whom a Contribution has been received by Licensor and subsequently \nincorporated within the Work.\n \n2. Grant of Copyright License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable copyright license to reproduce, prepare \nDerivative Works of, publicly display, publicly perform, sublicense, and distribute \nthe Work and such Derivative Works in Source or Object form.\n \n3. Grant of Patent License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable (except as stated in this section) patent \nlicense to make, have made, use, offer to sell, sell, import, and otherwise transfer \nthe Work, where such license applies only to those patent claims licensable by such \nContributor that are necessarily infringed by their Contribution(s) alone or by \ncombination of their Contribution(s) with the Work to which such Contribution(s) was \nsubmitted. If You institute patent litigation against any entity (including a \ncross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution \nincorporated within the Work constitutes direct or contributory patent infringement, \nthen any patent licenses granted to You under this License for that Work shall \nterminate as of the date such litigation is filed.\n \n4. Redistribution. You may reproduce and distribute copies of the Work or Derivative \nWorks thereof in any medium, with or without modifications, and in Source or Object \nform, provided that You meet the following conditions:\n \na) You must give any other recipients of the Work or Derivative Works a copy of this \nLicense; and\n \nb) You must cause any modified files to carry prominent notices stating that You \nchanged the files; and\n \nc) You must retain, in the Source form of any Derivative Works that You distribute, \nall copyright, patent, trademark, and attribution notices from the Source form of \nthe Work, excluding those notices that do not pertain to any part of the Derivative \nWorks; and\n \nd) If the Work includes a “NOTICE” text file as part of its distribution, then any \nDerivative Works that You distribute must include a readable copy of the attribution \nnotices contained within such NOTICE file, excluding those notices that do not pertain \nto any part of the Derivative Works, in at least one of the following places: within \na NOTICE text file distributed as part of the Derivative Works; within the Source \nform or documentation, if provided along with the Derivative Works; or, within a \ndisplay generated by the Derivative Works, if and wherever such third-party notices \nnormally appear. The contents of the NOTICE file are for informational purposes only \nand do not modify the License. You may add Your own attribution notices within \nDerivative Works that You distribute, alongside or as an addendum to the NOTICE text \nfrom the Work, provided that such additional attribution notices cannot be construed \nas modifying the License. \n \nYou may add Your own copyright statement to Your modifications and may provide \nadditional or different license terms and conditions for use, reproduction, or \ndistribution of Your modifications, or for any such Derivative Works as a whole, \nprovided Your use, reproduction, and distribution of the Work otherwise complies with \nthe conditions stated in this License. \n \n5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution \nintentionally submitted for inclusion in the Work by You to the Licensor shall be under \nthe terms and conditions of this License, without any additional terms or conditions. \nNotwithstanding the above, nothing herein shall supersede or modify the terms of any \nseparate license agreement you may have executed with Licensor regarding such \nContributions.\n \n6. Trademarks. This License does not grant permission to use the trade names, trademarks, \nservice marks, or product names of the Licensor, except as required for reasonable and \ncustomary use in describing the origin of the Work and reproducing the content of the \nNOTICE file.\n \n7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, \nLicensor provides the Work (and each Contributor provides its Contributions) on an \n“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, \nincluding, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, \nMERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for \ndetermining the appropriateness of using or redistributing the Work and assume any risks \nassociated with Your exercise of permissions under this License.\n \n8. Limitation of Liability. In no event and under no legal theory, whether in tort \n(including negligence), contract, or otherwise, unless required by applicable law (such \nas deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor \nbe liable to You for damages, including any direct, indirect, special, incidental, or \nconsequential damages of any character arising as a result of this License or out of the \nuse or inability to use the Work (including but not limited to damages for loss of \ngoodwill, work stoppage, computer failure or malfunction, or any and all other commercial \ndamages or losses), even if such Contributor has been advised of the possibility of such \ndamages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative \nWorks thereof, You may choose to offer, and charge a fee for, acceptance of support, \nwarranty, indemnity, or other liability obligations and/or rights consistent with this \nLicense. However, in accepting such obligations, You may act only on Your own behalf and \non Your sole responsibility, not on behalf of any other Contributor, and only if You agree \nto indemnify, defend, and hold each Contributor harmless for any liability incurred by, or \nclaims asserted against, such Contributor by reason of your accepting any such warranty or \nadditional liability.\n \nEND OF TERMS AND CONDITIONS\n \nAPPENDIX: How to apply the Apache License to your work\nTo apply the Apache License to your work, attach the following boilerplate notice, with the \nfields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't \ninclude the brackets!) The text should be enclosed in the appropriate comment syntax for \nthe file format. We also recommend that a file or class name and description of purpose be \nincluded on the same \"printed page\" as the copyright notice for easier identification within \nthird-party archives.\n \nCopyright [yyyy] [name of copyright owner]\n \nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n \n \n \nOpen Source Software Licensed Under Public Domain: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLite  3.11.0\n \n \n \nOpen Source Software Licensed Under the OpenSSL License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. OpenSSL  1.0.2j\nCopyright (c) 1998-2016 The OpenSSL Project.\nAll rights reserved.\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \n \n \nTerms of the OpenSSL License:\n---------------------------------------------------\nLICENSE ISSUES:\n--------------------------------------------------------------------\n \nThe OpenSSL toolkit stays under a dual license, i.e. both the conditions of the \nOpenSSL License and the original SSLeay license apply to the toolkit.\nSee below for the actual license texts.\n \nOpenSSL License:\n--------------------------------------------------------------------\nCopyright (c) 1998-2016 The OpenSSL Project.  All rights reserved.\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n \n1. Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n \n2. Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n \n3. All advertising materials mentioning features or use of this software must \ndisplay the following acknowledgment:\n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit. (http://www.openssl.org/)\"\n \n4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to endorse or \npromote products derived from this software without prior written permission. For \nwritten permission, please contact openssl-core@openssl.org.\n \n5. Products derived from this software may not be called \"OpenSSL\" nor may \"OpenSSL\" \nappear in their names without prior written permission of the OpenSSL Project.\n \n6. Redistributions of any form whatsoever must retain the following acknowledgment: \n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/)\"\n \nTHIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR \nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \nSHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE. \n====================================================================\n* This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).  \nThis product includes software written by Tim Hudson (tjh@cryptsoft.com).\n \n \nOriginal SSLeay License:\n--------------------------------------------------------------------\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \nThis package is an SSL implementation written by Eric Young (eay@cryptsoft.com).\nThe implementation was written so as to conform with Netscapes SSL.\n \nThis library is free for commercial and non-commercial use as long as the following \nconditions are aheared to. The following conditions apply to all code found in this \ndistribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. \nThe SSL documentation included with this distribution is covered by the same copyright \nterms except that the holder is Tim Hudson (tjh@cryptsoft.com). \n \nCopyright remains Eric Young's, and as such any Copyright notices in the code are not \nto be removed.  If this package is used in a product, Eric Young should be given \nattribution as the author of the parts of the library used. This can be in the form \nof a textual message at program startup or in documentation (online or textual) \nprovided with the package. \n  \nRedistribution and use in source and binary forms, with or without modification, are \npermitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the copyright notice, this list of \nconditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list \nof conditions and the following disclaimer in the documentation and/or other materials \nprovided with the distribution.\n\n3. All advertising materials mentioning features or use of this software must display \nthe following acknowledgement:\" This product includes cryptographic software written \nby Eric Young (eay@cryptsoft.com)\" The word 'cryptographic' can be left out if the \nrouines from the library being used are not cryptographic related :-).\n\n4. If you include any Windows specific code (or a derivative thereof) from the apps \ndirectory (application code) you must include an acknowledgement: \"This product includes \nsoftware written by Tim Hudson (tjh@cryptsoft.com)\"\n \nTHIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, \nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR \nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE \nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH \nDAMAGE. \n  \nThe licence and distribution terms for any publically available version or derivative of \nthis code cannot be changed.  i.e. this code cannot simply be copied and put under another \ndistribution licence [including the GNU Public Licence.]\n \n \n \nOpen Source Software Licensed Under the ICU License: \n----------------------------------------------------------------------------------------\n1. ICU4C  50.1\nCopyright (c) 1995-2012 International Business Machines Corporation and others\nAll rights reserved.\n \n \nTerms of the ICU License:\n--------------------------------------------------------------------\nICU License - ICU 1.8.1 and later\n \nCOPYRIGHT AND PERMISSION NOTICE\n \nCopyright (c) 1995-2012 International Business Machines Corporation and others\n \nAll rights reserved.\n \nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in the \nSoftware without restriction, including without limitation the rights to use, copy, \nmodify, merge, publish, distribute, and/or sell copies of the Software, and to permit \npersons to whom the Software is furnished to do so, provided that the above copyright \nnotice(s) and this permission notice appear in all copies of the Software and that both \nthe above copyright notice(s) and this permission notice appear in supporting \ndocumentation.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, \nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \nPURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER \nOR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR \nCONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR \nPROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING \nOUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \nExcept as contained in this notice, the name of a copyright holder shall not be used in \nadvertising or otherwise to promote the sale, use or other dealings in this Software \nwithout prior written authorization of the copyright holder.\n \nAll trademarks and registered trademarks mentioned herein are the property of their \nrespective owners.\n \n \nOpen Source Software Licensed Under the BSD 3-Clause License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLCipher  3.4.0\nCopyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n \n \n \nTerms of the BSD 3-Clause License:\n--------------------------------------------------------------------\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n\nl  Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n\nl  Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n\nl  Neither the name of [copyright holder] nor the names of its contributors may be \nused to endorse or promote products derived from this software without specific \nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE.\n\n\n## WCDBOptimizedSQLCipher\n\nCopyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the name of the ZETETIC LLC nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n## YBImageBrowser\n\nMIT License\n\nCopyright (c) 2019 杨波\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n## YYImage\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 ibireme <ibireme@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n## YYText\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 ibireme <ibireme@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\nGenerated by CocoaPods - https://cocoapods.org\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-acknowledgements.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>PreferenceSpecifiers</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>This application makes use of the following third party libraries:</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Acknowledgements</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2014-2022 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Alamofire</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>FDFullscreenPopGesture</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>   Copyright 1999-2016  Alibaba Group Holding Ltd.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n1. reflection\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Brad Hilton\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n2. ObjectMapper\n\nThe MIT License (MIT)\nCopyright (c) 2014 Hearst\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>Apache License 2.0</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>HandyJSON</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>MIT License\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>IGListDiffKit</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>MIT License\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>IGListKit</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>MIT License\n\nCopyright (c) 2013-2017 Iftekhar Qurashi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>IQKeyboardManagerSwift</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2019 Wei Wang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Kingfisher</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2015 Roy Marmelstein (http://roysapps.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Localize-Swift</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. &lt;https://fsf.org/&gt;\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    &lt;one line to give the program's name and a brief idea of what it does.&gt;\n    Copyright (C) &lt;year&gt;  &lt;name of author&gt;\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see &lt;https://www.gnu.org/licenses/&gt;.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    &lt;program&gt;  Copyright (C) &lt;year&gt;  &lt;name of author&gt;\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n&lt;https://www.gnu.org/licenses/&gt;.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n&lt;https://www.gnu.org/licenses/why-not-lgpl.html&gt;.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>GPL-3.0</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>LookinServer</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright © 2009-2020 Matej Bukovinski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>MBProgressHUD</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2013-2015 MJRefresh (https://github.com/CoderMJLee/MJRefresh)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>MJRefresh</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2014-present Artsy, Ash Furrow\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Moya</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2015 Ash Furrow\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>NSObject+Rx</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2014-2020 Mathijs Kadijk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>R.swift</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2015 Mathijs Kadijk\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>R.swift.Library</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2016 Ashley Mills\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>ReachabilitySwift</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>RxCocoa</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>RxRelay</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>**The MIT License**\n**Copyright © 2015 Krunoslav Zaher, Shai Mishali**\n**All rights reserved.**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>RxSwift</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2018 RxSwiftCommunity\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>RxTheme</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com\n \nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is furnished\nto do so, subject to the following conditions:\n \nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>SDWebImage</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Tencent is pleased to support the open source community by making WCDB available.  \n\nCopyright (C) 2017 THL A29 Limited, a Tencent company.  All rights reserved.\nIf you have downloaded a copy of the WCDB binary from Tencent, please note that \nthe WCDB binary is licensed under the BSD 3-Clause License.\n\nIf you have downloaded a copy of the WCDB source code from Tencent, please note \nthat WCDB source code is licensed under the BSD 3-Clause License, except for \nthe third-party components listed below which are subject to different license \nterms.  Your integration of WCDB into your own projects may require compliance \nwith the BSD 3-Clause License, as well as the other licenses applicable to the \nthird-party components included within WCDB.\n\nA copy of the BSD 3-Clause License is included in this file.\nOther dependencies and licenses:\n \nOpen Source Software Licensed Under the Apache License, Version 2.0: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n\n----------------------------------------------------------------------------------------\n1. Android Source Code  4.3\nCopyright (C) 2006-2011 The Android Open Source Project \n \n \nTerms of the Apache License, Version 2.0:\n---------------------------------------------------\nApache License\n\nVersion 2.0, January 2004\n\nhttp://www.apache.org/licenses/\n \nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n \n1. Definitions.\n \n“License” shall mean the terms and conditions for use, reproduction, and distribution\nas defined by Sections 1 through 9 of this document.\n \n“Licensor” shall mean the copyright owner or entity authorized by the copyright owner\nthat is granting the License.\n \n“Legal Entity” shall mean the union of the acting entity and all other entities that \ncontrol, are controlled by, or are under common control with that entity. For the \npurposes of this definition, “control” means (i) the power, direct or indirect, to \ncause the direction or management of such entity, whether by contract or otherwise, \nor (ii) ownership of fifty percent (50%) or more of the outstanding shares, or \n(iii) beneficial ownership of such entity.\n \n“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions \ngranted by this License.\n \n“Source” form shall mean the preferred form for making modifications, including but \nnot limited to software source code, documentation source, and configuration files.\n \n“Object” form shall mean any form resulting from mechanical transformation or \ntranslation of a Source form, including but not limited to compiled object code, \ngenerated documentation, and conversions to other media types.\n \n“Work” shall mean the work of authorship, whether in Source or Object form, made \navailable under the License, as indicated by a copyright notice that is included \nin or attached to the work (an example is provided in the Appendix below).\n \n“Derivative Works” shall mean any work, whether in Source or Object form, that is \nbased on (or derived from) the Work and for which the editorial revisions, \nannotations, elaborations, or other modifications represent, as a whole, an \noriginal work of authorship. For the purposes of this License, Derivative Works \nshall not include works that remain separable from, or merely link (or bind by \nname) to the interfaces of, the Work and Derivative Works thereof.\n \n“Contribution” shall mean any work of authorship, including the original version \nof the Work and any modifications or additions to that Work or Derivative Works \nthereof, that is intentionally submitted to Licensor for inclusion in the Work \nby the copyright owner or by an individual or Legal Entity authorized to submit \non behalf of the copyright owner. For the purposes of this definition, “submitted” \nmeans any form of electronic, verbal, or written communication sent to the \nLicensor or its representatives, including but not limited to communication on \nelectronic mailing lists, source code control systems, and issue tracking systems \nthat are managed by, or on behalf of, the Licensor for the purpose of discussing \nand improving the Work, but excluding communication that is conspicuously marked \nor otherwise designated in writing by the copyright owner as “Not a Contribution.”\n \n“Contributor” shall mean Licensor and any individual or Legal Entity on behalf \nof whom a Contribution has been received by Licensor and subsequently \nincorporated within the Work.\n \n2. Grant of Copyright License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable copyright license to reproduce, prepare \nDerivative Works of, publicly display, publicly perform, sublicense, and distribute \nthe Work and such Derivative Works in Source or Object form.\n \n3. Grant of Patent License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable (except as stated in this section) patent \nlicense to make, have made, use, offer to sell, sell, import, and otherwise transfer \nthe Work, where such license applies only to those patent claims licensable by such \nContributor that are necessarily infringed by their Contribution(s) alone or by \ncombination of their Contribution(s) with the Work to which such Contribution(s) was \nsubmitted. If You institute patent litigation against any entity (including a \ncross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution \nincorporated within the Work constitutes direct or contributory patent infringement, \nthen any patent licenses granted to You under this License for that Work shall \nterminate as of the date such litigation is filed.\n \n4. Redistribution. You may reproduce and distribute copies of the Work or Derivative \nWorks thereof in any medium, with or without modifications, and in Source or Object \nform, provided that You meet the following conditions:\n \na) You must give any other recipients of the Work or Derivative Works a copy of this \nLicense; and\n \nb) You must cause any modified files to carry prominent notices stating that You \nchanged the files; and\n \nc) You must retain, in the Source form of any Derivative Works that You distribute, \nall copyright, patent, trademark, and attribution notices from the Source form of \nthe Work, excluding those notices that do not pertain to any part of the Derivative \nWorks; and\n \nd) If the Work includes a “NOTICE” text file as part of its distribution, then any \nDerivative Works that You distribute must include a readable copy of the attribution \nnotices contained within such NOTICE file, excluding those notices that do not pertain \nto any part of the Derivative Works, in at least one of the following places: within \na NOTICE text file distributed as part of the Derivative Works; within the Source \nform or documentation, if provided along with the Derivative Works; or, within a \ndisplay generated by the Derivative Works, if and wherever such third-party notices \nnormally appear. The contents of the NOTICE file are for informational purposes only \nand do not modify the License. You may add Your own attribution notices within \nDerivative Works that You distribute, alongside or as an addendum to the NOTICE text \nfrom the Work, provided that such additional attribution notices cannot be construed \nas modifying the License. \n \nYou may add Your own copyright statement to Your modifications and may provide \nadditional or different license terms and conditions for use, reproduction, or \ndistribution of Your modifications, or for any such Derivative Works as a whole, \nprovided Your use, reproduction, and distribution of the Work otherwise complies with \nthe conditions stated in this License. \n \n5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution \nintentionally submitted for inclusion in the Work by You to the Licensor shall be under \nthe terms and conditions of this License, without any additional terms or conditions. \nNotwithstanding the above, nothing herein shall supersede or modify the terms of any \nseparate license agreement you may have executed with Licensor regarding such \nContributions.\n \n6. Trademarks. This License does not grant permission to use the trade names, trademarks, \nservice marks, or product names of the Licensor, except as required for reasonable and \ncustomary use in describing the origin of the Work and reproducing the content of the \nNOTICE file.\n \n7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, \nLicensor provides the Work (and each Contributor provides its Contributions) on an \n“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, \nincluding, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, \nMERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for \ndetermining the appropriateness of using or redistributing the Work and assume any risks \nassociated with Your exercise of permissions under this License.\n \n8. Limitation of Liability. In no event and under no legal theory, whether in tort \n(including negligence), contract, or otherwise, unless required by applicable law (such \nas deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor \nbe liable to You for damages, including any direct, indirect, special, incidental, or \nconsequential damages of any character arising as a result of this License or out of the \nuse or inability to use the Work (including but not limited to damages for loss of \ngoodwill, work stoppage, computer failure or malfunction, or any and all other commercial \ndamages or losses), even if such Contributor has been advised of the possibility of such \ndamages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative \nWorks thereof, You may choose to offer, and charge a fee for, acceptance of support, \nwarranty, indemnity, or other liability obligations and/or rights consistent with this \nLicense. However, in accepting such obligations, You may act only on Your own behalf and \non Your sole responsibility, not on behalf of any other Contributor, and only if You agree \nto indemnify, defend, and hold each Contributor harmless for any liability incurred by, or \nclaims asserted against, such Contributor by reason of your accepting any such warranty or \nadditional liability.\n \nEND OF TERMS AND CONDITIONS\n \nAPPENDIX: How to apply the Apache License to your work\nTo apply the Apache License to your work, attach the following boilerplate notice, with the \nfields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't \ninclude the brackets!) The text should be enclosed in the appropriate comment syntax for \nthe file format. We also recommend that a file or class name and description of purpose be \nincluded on the same \"printed page\" as the copyright notice for easier identification within \nthird-party archives.\n \nCopyright [yyyy] [name of copyright owner]\n \nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n \n \n \nOpen Source Software Licensed Under Public Domain: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLite  3.11.0\n \n \n \nOpen Source Software Licensed Under the OpenSSL License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. OpenSSL  1.0.2j\nCopyright (c) 1998-2016 The OpenSSL Project.\nAll rights reserved.\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \n \n \nTerms of the OpenSSL License:\n---------------------------------------------------\nLICENSE ISSUES:\n--------------------------------------------------------------------\n \nThe OpenSSL toolkit stays under a dual license, i.e. both the conditions of the \nOpenSSL License and the original SSLeay license apply to the toolkit.\nSee below for the actual license texts.\n \nOpenSSL License:\n--------------------------------------------------------------------\nCopyright (c) 1998-2016 The OpenSSL Project.  All rights reserved.\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n \n1. Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n \n2. Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n \n3. All advertising materials mentioning features or use of this software must \ndisplay the following acknowledgment:\n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit. (http://www.openssl.org/)\"\n \n4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to endorse or \npromote products derived from this software without prior written permission. For \nwritten permission, please contact openssl-core@openssl.org.\n \n5. Products derived from this software may not be called \"OpenSSL\" nor may \"OpenSSL\" \nappear in their names without prior written permission of the OpenSSL Project.\n \n6. Redistributions of any form whatsoever must retain the following acknowledgment: \n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/)\"\n \nTHIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR \nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \nSHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE. \n====================================================================\n* This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).  \nThis product includes software written by Tim Hudson (tjh@cryptsoft.com).\n \n \nOriginal SSLeay License:\n--------------------------------------------------------------------\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \nThis package is an SSL implementation written by Eric Young (eay@cryptsoft.com).\nThe implementation was written so as to conform with Netscapes SSL.\n \nThis library is free for commercial and non-commercial use as long as the following \nconditions are aheared to. The following conditions apply to all code found in this \ndistribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. \nThe SSL documentation included with this distribution is covered by the same copyright \nterms except that the holder is Tim Hudson (tjh@cryptsoft.com). \n \nCopyright remains Eric Young's, and as such any Copyright notices in the code are not \nto be removed.  If this package is used in a product, Eric Young should be given \nattribution as the author of the parts of the library used. This can be in the form \nof a textual message at program startup or in documentation (online or textual) \nprovided with the package. \n  \nRedistribution and use in source and binary forms, with or without modification, are \npermitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the copyright notice, this list of \nconditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list \nof conditions and the following disclaimer in the documentation and/or other materials \nprovided with the distribution.\n\n3. All advertising materials mentioning features or use of this software must display \nthe following acknowledgement:\" This product includes cryptographic software written \nby Eric Young (eay@cryptsoft.com)\" The word 'cryptographic' can be left out if the \nrouines from the library being used are not cryptographic related :-).\n\n4. If you include any Windows specific code (or a derivative thereof) from the apps \ndirectory (application code) you must include an acknowledgement: \"This product includes \nsoftware written by Tim Hudson (tjh@cryptsoft.com)\"\n \nTHIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, \nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR \nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE \nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH \nDAMAGE. \n  \nThe licence and distribution terms for any publically available version or derivative of \nthis code cannot be changed.  i.e. this code cannot simply be copied and put under another \ndistribution licence [including the GNU Public Licence.]\n \n \n \nOpen Source Software Licensed Under the ICU License: \n----------------------------------------------------------------------------------------\n1. ICU4C  50.1\nCopyright (c) 1995-2012 International Business Machines Corporation and others\nAll rights reserved.\n \n \nTerms of the ICU License:\n--------------------------------------------------------------------\nICU License - ICU 1.8.1 and later\n \nCOPYRIGHT AND PERMISSION NOTICE\n \nCopyright (c) 1995-2012 International Business Machines Corporation and others\n \nAll rights reserved.\n \nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in the \nSoftware without restriction, including without limitation the rights to use, copy, \nmodify, merge, publish, distribute, and/or sell copies of the Software, and to permit \npersons to whom the Software is furnished to do so, provided that the above copyright \nnotice(s) and this permission notice appear in all copies of the Software and that both \nthe above copyright notice(s) and this permission notice appear in supporting \ndocumentation.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, \nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \nPURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER \nOR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR \nCONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR \nPROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING \nOUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \nExcept as contained in this notice, the name of a copyright holder shall not be used in \nadvertising or otherwise to promote the sale, use or other dealings in this Software \nwithout prior written authorization of the copyright holder.\n \nAll trademarks and registered trademarks mentioned herein are the property of their \nrespective owners.\n \n \nOpen Source Software Licensed Under the BSD 3-Clause License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLCipher  3.4.0\nCopyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n \n \n \nTerms of the BSD 3-Clause License:\n--------------------------------------------------------------------\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n\nl  Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n\nl  Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n\nl  Neither the name of [copyright holder] nor the names of its contributors may be \nused to endorse or promote products derived from this software without specific \nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>BSD</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>SQLiteRepairKit</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>SnapKit</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2018 Daniele Margutti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>SwiftDate</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>MIT License\n\nCopyright (c) 2015-2018 SwifterSwift (https://github.com/swifterswift)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>SwifterSwift</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2017 Ruoyu Fu\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>SwiftyJSON</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2016 Zhen Tan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>TZImagePickerController</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>UITableView+FDTemplateLayoutCell</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2015 forkingdog\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>UIView+FDCollapsibleConstraints</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Tencent is pleased to support the open source community by making WCDB available.  \n\nCopyright (C) 2017 THL A29 Limited, a Tencent company.  All rights reserved.\nIf you have downloaded a copy of the WCDB binary from Tencent, please note that \nthe WCDB binary is licensed under the BSD 3-Clause License.\n\nIf you have downloaded a copy of the WCDB source code from Tencent, please note \nthat WCDB source code is licensed under the BSD 3-Clause License, except for \nthe third-party components listed below which are subject to different license \nterms.  Your integration of WCDB into your own projects may require compliance \nwith the BSD 3-Clause License, as well as the other licenses applicable to the \nthird-party components included within WCDB.\n\nA copy of the BSD 3-Clause License is included in this file.\nOther dependencies and licenses:\n \nOpen Source Software Licensed Under the Apache License, Version 2.0: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n\n----------------------------------------------------------------------------------------\n1. Android Source Code  4.3\nCopyright (C) 2006-2011 The Android Open Source Project \n \n \nTerms of the Apache License, Version 2.0:\n---------------------------------------------------\nApache License\n\nVersion 2.0, January 2004\n\nhttp://www.apache.org/licenses/\n \nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n \n1. Definitions.\n \n“License” shall mean the terms and conditions for use, reproduction, and distribution\nas defined by Sections 1 through 9 of this document.\n \n“Licensor” shall mean the copyright owner or entity authorized by the copyright owner\nthat is granting the License.\n \n“Legal Entity” shall mean the union of the acting entity and all other entities that \ncontrol, are controlled by, or are under common control with that entity. For the \npurposes of this definition, “control” means (i) the power, direct or indirect, to \ncause the direction or management of such entity, whether by contract or otherwise, \nor (ii) ownership of fifty percent (50%) or more of the outstanding shares, or \n(iii) beneficial ownership of such entity.\n \n“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions \ngranted by this License.\n \n“Source” form shall mean the preferred form for making modifications, including but \nnot limited to software source code, documentation source, and configuration files.\n \n“Object” form shall mean any form resulting from mechanical transformation or \ntranslation of a Source form, including but not limited to compiled object code, \ngenerated documentation, and conversions to other media types.\n \n“Work” shall mean the work of authorship, whether in Source or Object form, made \navailable under the License, as indicated by a copyright notice that is included \nin or attached to the work (an example is provided in the Appendix below).\n \n“Derivative Works” shall mean any work, whether in Source or Object form, that is \nbased on (or derived from) the Work and for which the editorial revisions, \nannotations, elaborations, or other modifications represent, as a whole, an \noriginal work of authorship. For the purposes of this License, Derivative Works \nshall not include works that remain separable from, or merely link (or bind by \nname) to the interfaces of, the Work and Derivative Works thereof.\n \n“Contribution” shall mean any work of authorship, including the original version \nof the Work and any modifications or additions to that Work or Derivative Works \nthereof, that is intentionally submitted to Licensor for inclusion in the Work \nby the copyright owner or by an individual or Legal Entity authorized to submit \non behalf of the copyright owner. For the purposes of this definition, “submitted” \nmeans any form of electronic, verbal, or written communication sent to the \nLicensor or its representatives, including but not limited to communication on \nelectronic mailing lists, source code control systems, and issue tracking systems \nthat are managed by, or on behalf of, the Licensor for the purpose of discussing \nand improving the Work, but excluding communication that is conspicuously marked \nor otherwise designated in writing by the copyright owner as “Not a Contribution.”\n \n“Contributor” shall mean Licensor and any individual or Legal Entity on behalf \nof whom a Contribution has been received by Licensor and subsequently \nincorporated within the Work.\n \n2. Grant of Copyright License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable copyright license to reproduce, prepare \nDerivative Works of, publicly display, publicly perform, sublicense, and distribute \nthe Work and such Derivative Works in Source or Object form.\n \n3. Grant of Patent License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable (except as stated in this section) patent \nlicense to make, have made, use, offer to sell, sell, import, and otherwise transfer \nthe Work, where such license applies only to those patent claims licensable by such \nContributor that are necessarily infringed by their Contribution(s) alone or by \ncombination of their Contribution(s) with the Work to which such Contribution(s) was \nsubmitted. If You institute patent litigation against any entity (including a \ncross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution \nincorporated within the Work constitutes direct or contributory patent infringement, \nthen any patent licenses granted to You under this License for that Work shall \nterminate as of the date such litigation is filed.\n \n4. Redistribution. You may reproduce and distribute copies of the Work or Derivative \nWorks thereof in any medium, with or without modifications, and in Source or Object \nform, provided that You meet the following conditions:\n \na) You must give any other recipients of the Work or Derivative Works a copy of this \nLicense; and\n \nb) You must cause any modified files to carry prominent notices stating that You \nchanged the files; and\n \nc) You must retain, in the Source form of any Derivative Works that You distribute, \nall copyright, patent, trademark, and attribution notices from the Source form of \nthe Work, excluding those notices that do not pertain to any part of the Derivative \nWorks; and\n \nd) If the Work includes a “NOTICE” text file as part of its distribution, then any \nDerivative Works that You distribute must include a readable copy of the attribution \nnotices contained within such NOTICE file, excluding those notices that do not pertain \nto any part of the Derivative Works, in at least one of the following places: within \na NOTICE text file distributed as part of the Derivative Works; within the Source \nform or documentation, if provided along with the Derivative Works; or, within a \ndisplay generated by the Derivative Works, if and wherever such third-party notices \nnormally appear. The contents of the NOTICE file are for informational purposes only \nand do not modify the License. You may add Your own attribution notices within \nDerivative Works that You distribute, alongside or as an addendum to the NOTICE text \nfrom the Work, provided that such additional attribution notices cannot be construed \nas modifying the License. \n \nYou may add Your own copyright statement to Your modifications and may provide \nadditional or different license terms and conditions for use, reproduction, or \ndistribution of Your modifications, or for any such Derivative Works as a whole, \nprovided Your use, reproduction, and distribution of the Work otherwise complies with \nthe conditions stated in this License. \n \n5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution \nintentionally submitted for inclusion in the Work by You to the Licensor shall be under \nthe terms and conditions of this License, without any additional terms or conditions. \nNotwithstanding the above, nothing herein shall supersede or modify the terms of any \nseparate license agreement you may have executed with Licensor regarding such \nContributions.\n \n6. Trademarks. This License does not grant permission to use the trade names, trademarks, \nservice marks, or product names of the Licensor, except as required for reasonable and \ncustomary use in describing the origin of the Work and reproducing the content of the \nNOTICE file.\n \n7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, \nLicensor provides the Work (and each Contributor provides its Contributions) on an \n“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, \nincluding, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, \nMERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for \ndetermining the appropriateness of using or redistributing the Work and assume any risks \nassociated with Your exercise of permissions under this License.\n \n8. Limitation of Liability. In no event and under no legal theory, whether in tort \n(including negligence), contract, or otherwise, unless required by applicable law (such \nas deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor \nbe liable to You for damages, including any direct, indirect, special, incidental, or \nconsequential damages of any character arising as a result of this License or out of the \nuse or inability to use the Work (including but not limited to damages for loss of \ngoodwill, work stoppage, computer failure or malfunction, or any and all other commercial \ndamages or losses), even if such Contributor has been advised of the possibility of such \ndamages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative \nWorks thereof, You may choose to offer, and charge a fee for, acceptance of support, \nwarranty, indemnity, or other liability obligations and/or rights consistent with this \nLicense. However, in accepting such obligations, You may act only on Your own behalf and \non Your sole responsibility, not on behalf of any other Contributor, and only if You agree \nto indemnify, defend, and hold each Contributor harmless for any liability incurred by, or \nclaims asserted against, such Contributor by reason of your accepting any such warranty or \nadditional liability.\n \nEND OF TERMS AND CONDITIONS\n \nAPPENDIX: How to apply the Apache License to your work\nTo apply the Apache License to your work, attach the following boilerplate notice, with the \nfields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't \ninclude the brackets!) The text should be enclosed in the appropriate comment syntax for \nthe file format. We also recommend that a file or class name and description of purpose be \nincluded on the same \"printed page\" as the copyright notice for easier identification within \nthird-party archives.\n \nCopyright [yyyy] [name of copyright owner]\n \nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n \n \n \nOpen Source Software Licensed Under Public Domain: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLite  3.11.0\n \n \n \nOpen Source Software Licensed Under the OpenSSL License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. OpenSSL  1.0.2j\nCopyright (c) 1998-2016 The OpenSSL Project.\nAll rights reserved.\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \n \n \nTerms of the OpenSSL License:\n---------------------------------------------------\nLICENSE ISSUES:\n--------------------------------------------------------------------\n \nThe OpenSSL toolkit stays under a dual license, i.e. both the conditions of the \nOpenSSL License and the original SSLeay license apply to the toolkit.\nSee below for the actual license texts.\n \nOpenSSL License:\n--------------------------------------------------------------------\nCopyright (c) 1998-2016 The OpenSSL Project.  All rights reserved.\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n \n1. Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n \n2. Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n \n3. All advertising materials mentioning features or use of this software must \ndisplay the following acknowledgment:\n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit. (http://www.openssl.org/)\"\n \n4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to endorse or \npromote products derived from this software without prior written permission. For \nwritten permission, please contact openssl-core@openssl.org.\n \n5. Products derived from this software may not be called \"OpenSSL\" nor may \"OpenSSL\" \nappear in their names without prior written permission of the OpenSSL Project.\n \n6. Redistributions of any form whatsoever must retain the following acknowledgment: \n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/)\"\n \nTHIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR \nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \nSHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE. \n====================================================================\n* This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).  \nThis product includes software written by Tim Hudson (tjh@cryptsoft.com).\n \n \nOriginal SSLeay License:\n--------------------------------------------------------------------\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \nThis package is an SSL implementation written by Eric Young (eay@cryptsoft.com).\nThe implementation was written so as to conform with Netscapes SSL.\n \nThis library is free for commercial and non-commercial use as long as the following \nconditions are aheared to. The following conditions apply to all code found in this \ndistribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. \nThe SSL documentation included with this distribution is covered by the same copyright \nterms except that the holder is Tim Hudson (tjh@cryptsoft.com). \n \nCopyright remains Eric Young's, and as such any Copyright notices in the code are not \nto be removed.  If this package is used in a product, Eric Young should be given \nattribution as the author of the parts of the library used. This can be in the form \nof a textual message at program startup or in documentation (online or textual) \nprovided with the package. \n  \nRedistribution and use in source and binary forms, with or without modification, are \npermitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the copyright notice, this list of \nconditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list \nof conditions and the following disclaimer in the documentation and/or other materials \nprovided with the distribution.\n\n3. All advertising materials mentioning features or use of this software must display \nthe following acknowledgement:\" This product includes cryptographic software written \nby Eric Young (eay@cryptsoft.com)\" The word 'cryptographic' can be left out if the \nrouines from the library being used are not cryptographic related :-).\n\n4. If you include any Windows specific code (or a derivative thereof) from the apps \ndirectory (application code) you must include an acknowledgement: \"This product includes \nsoftware written by Tim Hudson (tjh@cryptsoft.com)\"\n \nTHIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, \nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR \nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE \nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH \nDAMAGE. \n  \nThe licence and distribution terms for any publically available version or derivative of \nthis code cannot be changed.  i.e. this code cannot simply be copied and put under another \ndistribution licence [including the GNU Public Licence.]\n \n \n \nOpen Source Software Licensed Under the ICU License: \n----------------------------------------------------------------------------------------\n1. ICU4C  50.1\nCopyright (c) 1995-2012 International Business Machines Corporation and others\nAll rights reserved.\n \n \nTerms of the ICU License:\n--------------------------------------------------------------------\nICU License - ICU 1.8.1 and later\n \nCOPYRIGHT AND PERMISSION NOTICE\n \nCopyright (c) 1995-2012 International Business Machines Corporation and others\n \nAll rights reserved.\n \nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in the \nSoftware without restriction, including without limitation the rights to use, copy, \nmodify, merge, publish, distribute, and/or sell copies of the Software, and to permit \npersons to whom the Software is furnished to do so, provided that the above copyright \nnotice(s) and this permission notice appear in all copies of the Software and that both \nthe above copyright notice(s) and this permission notice appear in supporting \ndocumentation.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, \nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \nPURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER \nOR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR \nCONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR \nPROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING \nOUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \nExcept as contained in this notice, the name of a copyright holder shall not be used in \nadvertising or otherwise to promote the sale, use or other dealings in this Software \nwithout prior written authorization of the copyright holder.\n \nAll trademarks and registered trademarks mentioned herein are the property of their \nrespective owners.\n \n \nOpen Source Software Licensed Under the BSD 3-Clause License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLCipher  3.4.0\nCopyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n \n \n \nTerms of the BSD 3-Clause License:\n--------------------------------------------------------------------\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n\nl  Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n\nl  Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n\nl  Neither the name of [copyright holder] nor the names of its contributors may be \nused to endorse or promote products derived from this software without specific \nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>BSD</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>WCDB.swift</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the name of the ZETETIC LLC nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>BSD</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>WCDBOptimizedSQLCipher</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>MIT License\n\nCopyright (c) 2019 杨波\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>YBImageBrowser</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2015 ibireme &lt;ibireme@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>YYImage</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2015 ibireme &lt;ibireme@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>YYText</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Generated by CocoaPods - https://cocoapods.org</string>\n\t\t\t<key>Title</key>\n\t\t\t<string></string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t</array>\n\t<key>StringsTable</key>\n\t<string>Acknowledgements</string>\n\t<key>Title</key>\n\t<string>Acknowledgements</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Pods_FY_IMChat : NSObject\n@end\n@implementation PodsDummy_Pods_FY_IMChat\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-frameworks.sh",
    "content": "#!/bin/sh\nset -e\nset -u\nset -o pipefail\n\nfunction on_error {\n  echo \"$(realpath -mq \"${0}\"):$1: error: Unexpected failure\"\n}\ntrap 'on_error $LINENO' ERR\n\nif [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then\n  # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy\n  # frameworks to, so exit 0 (signalling the script phase was successful).\n  exit 0\nfi\n\necho \"mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nmkdir -p \"${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\nCOCOAPODS_PARALLEL_CODE_SIGN=\"${COCOAPODS_PARALLEL_CODE_SIGN:-false}\"\nSWIFT_STDLIB_PATH=\"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"\nBCSYMBOLMAP_DIR=\"BCSymbolMaps\"\n\n\n# This protects against multiple targets copying the same framework dependency at the same time. The solution\n# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html\nRSYNC_PROTECT_TMP_FILES=(--filter \"P .*.??????\")\n\n# Copies and strips a vendored framework\ninstall_framework()\n{\n  if [ -r \"${BUILT_PRODUCTS_DIR}/$1\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$1\"\n  elif [ -r \"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\"\n  elif [ -r \"$1\" ]; then\n    local source=\"$1\"\n  fi\n\n  local destination=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\n  if [ -L \"${source}\" ]; then\n    echo \"Symlinked...\"\n    source=\"$(readlink -f \"${source}\")\"\n  fi\n\n  if [ -d \"${source}/${BCSYMBOLMAP_DIR}\" ]; then\n    # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied\n    find \"${source}/${BCSYMBOLMAP_DIR}\" -name \"*.bcsymbolmap\"|while read f; do\n      echo \"Installing $f\"\n      install_bcsymbolmap \"$f\" \"$destination\"\n      rm \"$f\"\n    done\n    rmdir \"${source}/${BCSYMBOLMAP_DIR}\"\n  fi\n\n  # Use filter instead of exclude so missing patterns don't throw errors.\n  echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --links --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${destination}\\\"\"\n  rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"\n\n  local basename\n  basename=\"$(basename -s .framework \"$1\")\"\n  binary=\"${destination}/${basename}.framework/${basename}\"\n\n  if ! [ -r \"$binary\" ]; then\n    binary=\"${destination}/${basename}\"\n  elif [ -L \"${binary}\" ]; then\n    echo \"Destination binary is symlinked...\"\n    dirname=\"$(dirname \"${binary}\")\"\n    binary=\"${dirname}/$(readlink \"${binary}\")\"\n  fi\n\n  # Strip invalid architectures so \"fat\" simulator / device frameworks work on device\n  if [[ \"$(file \"$binary\")\" == *\"dynamically linked shared library\"* ]]; then\n    strip_invalid_archs \"$binary\"\n  fi\n\n  # Resign the code if required by the build settings to avoid unstable apps\n  code_sign_if_enabled \"${destination}/$(basename \"$1\")\"\n\n  # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.\n  if [ \"${XCODE_VERSION_MAJOR}\" -lt 7 ]; then\n    local swift_runtime_libs\n    swift_runtime_libs=$(xcrun otool -LX \"$binary\" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u)\n    for lib in $swift_runtime_libs; do\n      echo \"rsync -auv \\\"${SWIFT_STDLIB_PATH}/${lib}\\\" \\\"${destination}\\\"\"\n      rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"\n      code_sign_if_enabled \"${destination}/${lib}\"\n    done\n  fi\n}\n# Copies and strips a vendored dSYM\ninstall_dsym() {\n  local source=\"$1\"\n  warn_missing_arch=${2:-true}\n  if [ -r \"$source\" ]; then\n    # Copy the dSYM into the targets temp dir.\n    echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${DERIVED_FILES_DIR}\\\"\"\n    rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"\n\n    local basename\n    basename=\"$(basename -s .dSYM \"$source\")\"\n    binary_name=\"$(ls \"$source/Contents/Resources/DWARF\")\"\n    binary=\"${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}\"\n\n    # Strip invalid architectures from the dSYM.\n    if [[ \"$(file \"$binary\")\" == *\"Mach-O \"*\"dSYM companion\"* ]]; then\n      strip_invalid_archs \"$binary\" \"$warn_missing_arch\"\n    fi\n    if [[ $STRIP_BINARY_RETVAL == 0 ]]; then\n      # Move the stripped file into its final destination.\n      echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --links --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\\\" \\\"${DWARF_DSYM_FOLDER_PATH}\\\"\"\n      rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"\n    else\n      # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.\n      mkdir -p \"${DWARF_DSYM_FOLDER_PATH}\"\n      touch \"${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM\"\n    fi\n  fi\n}\n\n# Used as a return value for each invocation of `strip_invalid_archs` function.\nSTRIP_BINARY_RETVAL=0\n\n# Strip invalid architectures\nstrip_invalid_archs() {\n  binary=\"$1\"\n  warn_missing_arch=${2:-true}\n  # Get architectures for current target binary\n  binary_archs=\"$(lipo -info \"$binary\" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)\"\n  # Intersect them with the architectures we are building for\n  intersected_archs=\"$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\\n' | sort | uniq -d)\"\n  # If there are no archs supported by this binary then warn the user\n  if [[ -z \"$intersected_archs\" ]]; then\n    if [[ \"$warn_missing_arch\" == \"true\" ]]; then\n      echo \"warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS).\"\n    fi\n    STRIP_BINARY_RETVAL=1\n    return\n  fi\n  stripped=\"\"\n  for arch in $binary_archs; do\n    if ! [[ \"${ARCHS}\" == *\"$arch\"* ]]; then\n      # Strip non-valid architectures in-place\n      lipo -remove \"$arch\" -output \"$binary\" \"$binary\"\n      stripped=\"$stripped $arch\"\n    fi\n  done\n  if [[ \"$stripped\" ]]; then\n    echo \"Stripped $binary of architectures:$stripped\"\n  fi\n  STRIP_BINARY_RETVAL=0\n}\n\n# Copies the bcsymbolmap files of a vendored framework\ninstall_bcsymbolmap() {\n    local bcsymbolmap_path=\"$1\"\n    local destination=\"${BUILT_PRODUCTS_DIR}\"\n    echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${bcsymbolmap_path}\" \"${destination}\"\"\n    rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${bcsymbolmap_path}\" \"${destination}\"\n}\n\n# Signs a framework with the provided identity\ncode_sign_if_enabled() {\n  if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY:-}\" -a \"${CODE_SIGNING_REQUIRED:-}\" != \"NO\" -a \"${CODE_SIGNING_ALLOWED}\" != \"NO\" ]; then\n    # Use the current code_sign_identity\n    echo \"Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}\"\n    local code_sign_cmd=\"/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'\"\n\n    if [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n      code_sign_cmd=\"$code_sign_cmd &\"\n    fi\n    echo \"$code_sign_cmd\"\n    eval \"$code_sign_cmd\"\n  fi\n}\n\nif [[ \"$CONFIGURATION\" == \"Debug\" ]]; then\n  install_framework \"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/FDFullscreenPopGesture/FDFullscreenPopGesture.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/HandyJSON/HandyJSON.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/IGListDiffKit/IGListDiffKit.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/IGListKit/IGListKit.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/Kingfisher/Kingfisher.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/Localize-Swift/Localize_Swift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/LookinServer/LookinServer.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/Moya/Moya.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/NSObject+Rx/NSObject_Rx.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/R.swift.Library/Rswift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/ReachabilitySwift/Reachability.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxTheme/RxTheme.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SQLiteRepairKit/sqliterk.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SwiftDate/SwiftDate.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SwifterSwift/SwifterSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/TZImagePickerController/TZImagePickerController.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/UIView+FDCollapsibleConstraints/UIView_FDCollapsibleConstraints.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/WCDB.swift/WCDBSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/WCDBOptimizedSQLCipher/sqlcipher.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/YBImageBrowser/YBImageBrowser.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/YYImage/YYImage.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/YYText/YYText.framework\"\nfi\nif [[ \"$CONFIGURATION\" == \"Release\" ]]; then\n  install_framework \"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/FDFullscreenPopGesture/FDFullscreenPopGesture.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/HandyJSON/HandyJSON.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/IGListDiffKit/IGListDiffKit.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/IGListKit/IGListKit.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/Kingfisher/Kingfisher.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/Localize-Swift/Localize_Swift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/Moya/Moya.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/NSObject+Rx/NSObject_Rx.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/R.swift.Library/Rswift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/ReachabilitySwift/Reachability.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/RxTheme/RxTheme.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SQLiteRepairKit/sqliterk.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SwiftDate/SwiftDate.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SwifterSwift/SwifterSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/TZImagePickerController/TZImagePickerController.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/UIView+FDCollapsibleConstraints/UIView_FDCollapsibleConstraints.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/WCDB.swift/WCDBSwift.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/WCDBOptimizedSQLCipher/sqlcipher.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/YBImageBrowser/YBImageBrowser.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/YYImage/YYImage.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/YYText/YYText.framework\"\nfi\nif [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n  wait\nfi\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double Pods_FY_IMChatVersionNumber;\nFOUNDATION_EXPORT const unsigned char Pods_FY_IMChatVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat.debug.xcconfig",
    "content": "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/FDFullscreenPopGesture\" \"${PODS_CONFIGURATION_BUILD_DIR}/HandyJSON\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher\" \"${PODS_CONFIGURATION_BUILD_DIR}/Localize-Swift\" \"${PODS_CONFIGURATION_BUILD_DIR}/LookinServer\" \"${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD\" \"${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh\" \"${PODS_CONFIGURATION_BUILD_DIR}/Moya\" \"${PODS_CONFIGURATION_BUILD_DIR}/NSObject+Rx\" \"${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReachabilitySwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxTheme\" \"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage\" \"${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/SnapKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftDate\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwifterSwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON\" \"${PODS_CONFIGURATION_BUILD_DIR}/TZImagePickerController\" \"${PODS_CONFIGURATION_BUILD_DIR}/UITableView+FDTemplateLayoutCell\" \"${PODS_CONFIGURATION_BUILD_DIR}/UIView+FDCollapsibleConstraints\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDB.swift\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\" \"${PODS_CONFIGURATION_BUILD_DIR}/YBImageBrowser\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYImage\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYText\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/FDFullscreenPopGesture/FDFullscreenPopGesture.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/HandyJSON/HandyJSON.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit/IGListDiffKit.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListKit/IGListKit.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher/Kingfisher.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/Localize-Swift/Localize_Swift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/LookinServer/LookinServer.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD/MBProgressHUD.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh/MJRefresh.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/NSObject+Rx/NSObject_Rx.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library/Rswift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReachabilitySwift/Reachability.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay/RxRelay.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxTheme/RxTheme.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit/sqliterk.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftDate/SwiftDate.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwifterSwift/SwifterSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/TZImagePickerController/TZImagePickerController.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/UIView+FDCollapsibleConstraints/UIView_FDCollapsibleConstraints.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDB.swift/WCDBSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher/sqlcipher.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/YBImageBrowser/YBImageBrowser.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYImage/YYImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYText/YYText.framework/Headers\"\nLD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -l\"z\" -framework \"Accelerate\" -framework \"Alamofire\" -framework \"AssetsLibrary\" -framework \"CFNetwork\" -framework \"CoreFoundation\" -framework \"CoreGraphics\" -framework \"CoreTelephony\" -framework \"CoreText\" -framework \"FDFullscreenPopGesture\" -framework \"Foundation\" -framework \"HandyJSON\" -framework \"IGListDiffKit\" -framework \"IGListKit\" -framework \"IQKeyboardManagerSwift\" -framework \"ImageIO\" -framework \"Kingfisher\" -framework \"Localize_Swift\" -framework \"LookinServer\" -framework \"MBProgressHUD\" -framework \"MJRefresh\" -framework \"MobileCoreServices\" -framework \"Moya\" -framework \"NSObject_Rx\" -framework \"Photos\" -framework \"PhotosUI\" -framework \"QuartzCore\" -framework \"Reachability\" -framework \"Rswift\" -framework \"RxCocoa\" -framework \"RxRelay\" -framework \"RxSwift\" -framework \"RxTheme\" -framework \"SDWebImage\" -framework \"Security\" -framework \"SnapKit\" -framework \"SwiftDate\" -framework \"SwifterSwift\" -framework \"SwiftyJSON\" -framework \"SystemConfiguration\" -framework \"TZImagePickerController\" -framework \"UIKit\" -framework \"UITableView_FDTemplateLayoutCell\" -framework \"UIView_FDCollapsibleConstraints\" -framework \"WCDBSwift\" -framework \"YBImageBrowser\" -framework \"YYImage\" -framework \"YYText\" -framework \"sqlcipher\" -framework \"sqliterk\" -weak_framework \"Combine\" -weak_framework \"SwiftUI\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat.modulemap",
    "content": "framework module Pods_FY_IMChat {\n  umbrella header \"Pods-FY-IMChat-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/Pods-FY-IMChat/Pods-FY-IMChat.release.xcconfig",
    "content": "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/FDFullscreenPopGesture\" \"${PODS_CONFIGURATION_BUILD_DIR}/HandyJSON\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher\" \"${PODS_CONFIGURATION_BUILD_DIR}/Localize-Swift\" \"${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD\" \"${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh\" \"${PODS_CONFIGURATION_BUILD_DIR}/Moya\" \"${PODS_CONFIGURATION_BUILD_DIR}/NSObject+Rx\" \"${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReachabilitySwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxTheme\" \"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage\" \"${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/SnapKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftDate\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwifterSwift\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON\" \"${PODS_CONFIGURATION_BUILD_DIR}/TZImagePickerController\" \"${PODS_CONFIGURATION_BUILD_DIR}/UITableView+FDTemplateLayoutCell\" \"${PODS_CONFIGURATION_BUILD_DIR}/UIView+FDCollapsibleConstraints\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDB.swift\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\" \"${PODS_CONFIGURATION_BUILD_DIR}/YBImageBrowser\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYImage\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYText\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/FDFullscreenPopGesture/FDFullscreenPopGesture.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/HandyJSON/HandyJSON.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListDiffKit/IGListDiffKit.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/IGListKit/IGListKit.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/Kingfisher/Kingfisher.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/Localize-Swift/Localize_Swift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/MBProgressHUD/MBProgressHUD.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/MJRefresh/MJRefresh.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/Moya/Moya.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/NSObject+Rx/NSObject_Rx.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library/Rswift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReachabilitySwift/Reachability.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay/RxRelay.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxTheme/RxTheme.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit/sqliterk.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftDate/SwiftDate.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwifterSwift/SwifterSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/TZImagePickerController/TZImagePickerController.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/UITableView+FDTemplateLayoutCell/UITableView_FDTemplateLayoutCell.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/UIView+FDCollapsibleConstraints/UIView_FDCollapsibleConstraints.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDB.swift/WCDBSwift.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher/sqlcipher.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/YBImageBrowser/YBImageBrowser.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYImage/YYImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYText/YYText.framework/Headers\"\nLD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -l\"z\" -framework \"Accelerate\" -framework \"Alamofire\" -framework \"AssetsLibrary\" -framework \"CFNetwork\" -framework \"CoreFoundation\" -framework \"CoreGraphics\" -framework \"CoreTelephony\" -framework \"CoreText\" -framework \"FDFullscreenPopGesture\" -framework \"Foundation\" -framework \"HandyJSON\" -framework \"IGListDiffKit\" -framework \"IGListKit\" -framework \"IQKeyboardManagerSwift\" -framework \"ImageIO\" -framework \"Kingfisher\" -framework \"Localize_Swift\" -framework \"MBProgressHUD\" -framework \"MJRefresh\" -framework \"MobileCoreServices\" -framework \"Moya\" -framework \"NSObject_Rx\" -framework \"Photos\" -framework \"PhotosUI\" -framework \"QuartzCore\" -framework \"Reachability\" -framework \"Rswift\" -framework \"RxCocoa\" -framework \"RxRelay\" -framework \"RxSwift\" -framework \"RxTheme\" -framework \"SDWebImage\" -framework \"Security\" -framework \"SnapKit\" -framework \"SwiftDate\" -framework \"SwifterSwift\" -framework \"SwiftyJSON\" -framework \"SystemConfiguration\" -framework \"TZImagePickerController\" -framework \"UIKit\" -framework \"UITableView_FDTemplateLayoutCell\" -framework \"UIView_FDCollapsibleConstraints\" -framework \"WCDBSwift\" -framework \"YBImageBrowser\" -framework \"YYImage\" -framework \"YYText\" -framework \"sqlcipher\" -framework \"sqliterk\" -weak_framework \"Combine\" -weak_framework \"SwiftUI\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift/R.swift.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/R.swift\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/R.swift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift/R.swift.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/R.swift\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/R.swift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift.Library/R.swift.Library-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.3.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift.Library/R.swift.Library-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_R_swift_Library : NSObject\n@end\n@implementation PodsDummy_R_swift_Library\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift.Library/R.swift.Library-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift.Library/R.swift.Library-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double RswiftVersionNumber;\nFOUNDATION_EXPORT const unsigned char RswiftVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift.Library/R.swift.Library.debug.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/R.swift.Library\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift.Library/R.swift.Library.modulemap",
    "content": "framework module Rswift {\n  umbrella header \"R.swift.Library-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/R.swift.Library/R.swift.Library.release.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/R.swift.Library\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/R.swift.Library\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/ReachabilitySwift/ReachabilitySwift-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/ReachabilitySwift/ReachabilitySwift-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_ReachabilitySwift : NSObject\n@end\n@implementation PodsDummy_ReachabilitySwift\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/ReachabilitySwift/ReachabilitySwift-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/ReachabilitySwift/ReachabilitySwift-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double ReachabilityVersionNumber;\nFOUNDATION_EXPORT const unsigned char ReachabilityVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/ReachabilitySwift/ReachabilitySwift.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ReachabilitySwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"CoreTelephony\" -framework \"SystemConfiguration\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/ReachabilitySwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/ReachabilitySwift/ReachabilitySwift.modulemap",
    "content": "framework module Reachability {\n  umbrella header \"ReachabilitySwift-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/ReachabilitySwift/ReachabilitySwift.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ReachabilitySwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"CoreTelephony\" -framework \"SystemConfiguration\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/ReachabilitySwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxCocoa/RxCocoa-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>6.5.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxCocoa/RxCocoa-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_RxCocoa : NSObject\n@end\n@implementation PodsDummy_RxCocoa\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxCocoa/RxCocoa-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxCocoa/RxCocoa-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"RxCocoaRuntime.h\"\n#import \"_RX.h\"\n#import \"_RXDelegateProxy.h\"\n#import \"_RXKVOObserver.h\"\n#import \"_RXObjCRuntime.h\"\n#import \"RxCocoa.h\"\n\nFOUNDATION_EXPORT double RxCocoaVersionNumber;\nFOUNDATION_EXPORT const unsigned char RxCocoaVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxCocoa/RxCocoa.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"RxRelay\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxCocoa\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxCocoa/RxCocoa.modulemap",
    "content": "framework module RxCocoa {\n  umbrella header \"RxCocoa-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxCocoa/RxCocoa.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"RxRelay\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxCocoa\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxRelay/RxRelay-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>6.5.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxRelay/RxRelay-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_RxRelay : NSObject\n@end\n@implementation PodsDummy_RxRelay\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxRelay/RxRelay-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxRelay/RxRelay-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double RxRelayVersionNumber;\nFOUNDATION_EXPORT const unsigned char RxRelayVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxRelay/RxRelay.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxRelay\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxRelay/RxRelay.modulemap",
    "content": "framework module RxRelay {\n  umbrella header \"RxRelay-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxRelay/RxRelay.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxRelay\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxSwift/RxSwift-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>6.5.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxSwift/RxSwift-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_RxSwift : NSObject\n@end\n@implementation PodsDummy_RxSwift\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxSwift/RxSwift-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxSwift/RxSwift-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double RxSwiftVersionNumber;\nFOUNDATION_EXPORT const unsigned char RxSwiftVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxSwift/RxSwift.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxSwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxSwift/RxSwift.modulemap",
    "content": "framework module RxSwift {\n  umbrella header \"RxSwift-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxSwift/RxSwift.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxSwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxTheme/RxTheme-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>6.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxTheme/RxTheme-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_RxTheme : NSObject\n@end\n@implementation PodsDummy_RxTheme\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxTheme/RxTheme-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxTheme/RxTheme-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double RxThemeVersionNumber;\nFOUNDATION_EXPORT const unsigned char RxThemeVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxTheme/RxTheme.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxTheme\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"RxCocoa\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxTheme\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxTheme/RxTheme.modulemap",
    "content": "framework module RxTheme {\n  umbrella header \"RxTheme-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/RxTheme/RxTheme.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxTheme\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxRelay\" \"${PODS_CONFIGURATION_BUILD_DIR}/RxSwift\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"RxCocoa\" -framework \"RxSwift\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/RxTheme\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SDWebImage/SDWebImage-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.12.5</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_SDWebImage : NSObject\n@end\n@implementation PodsDummy_SDWebImage\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"NSButton+WebCache.h\"\n#import \"NSData+ImageContentType.h\"\n#import \"NSImage+Compatibility.h\"\n#import \"SDAnimatedImage.h\"\n#import \"SDAnimatedImagePlayer.h\"\n#import \"SDAnimatedImageRep.h\"\n#import \"SDAnimatedImageView+WebCache.h\"\n#import \"SDAnimatedImageView.h\"\n#import \"SDDiskCache.h\"\n#import \"SDGraphicsImageRenderer.h\"\n#import \"SDImageAPNGCoder.h\"\n#import \"SDImageAWebPCoder.h\"\n#import \"SDImageCache.h\"\n#import \"SDImageCacheConfig.h\"\n#import \"SDImageCacheDefine.h\"\n#import \"SDImageCachesManager.h\"\n#import \"SDImageCoder.h\"\n#import \"SDImageCoderHelper.h\"\n#import \"SDImageCodersManager.h\"\n#import \"SDImageFrame.h\"\n#import \"SDImageGIFCoder.h\"\n#import \"SDImageGraphics.h\"\n#import \"SDImageHEICCoder.h\"\n#import \"SDImageIOAnimatedCoder.h\"\n#import \"SDImageIOCoder.h\"\n#import \"SDImageLoader.h\"\n#import \"SDImageLoadersManager.h\"\n#import \"SDImageTransformer.h\"\n#import \"SDMemoryCache.h\"\n#import \"SDWebImageCacheKeyFilter.h\"\n#import \"SDWebImageCacheSerializer.h\"\n#import \"SDWebImageCompat.h\"\n#import \"SDWebImageDefine.h\"\n#import \"SDWebImageDownloader.h\"\n#import \"SDWebImageDownloaderConfig.h\"\n#import \"SDWebImageDownloaderDecryptor.h\"\n#import \"SDWebImageDownloaderOperation.h\"\n#import \"SDWebImageDownloaderRequestModifier.h\"\n#import \"SDWebImageDownloaderResponseModifier.h\"\n#import \"SDWebImageError.h\"\n#import \"SDWebImageIndicator.h\"\n#import \"SDWebImageManager.h\"\n#import \"SDWebImageOperation.h\"\n#import \"SDWebImageOptionsProcessor.h\"\n#import \"SDWebImagePrefetcher.h\"\n#import \"SDWebImageTransition.h\"\n#import \"UIButton+WebCache.h\"\n#import \"UIImage+ExtendedCacheData.h\"\n#import \"UIImage+ForceDecode.h\"\n#import \"UIImage+GIF.h\"\n#import \"UIImage+MemoryCacheCost.h\"\n#import \"UIImage+Metadata.h\"\n#import \"UIImage+MultiFormat.h\"\n#import \"UIImage+Transform.h\"\n#import \"UIImageView+HighlightedWebCache.h\"\n#import \"UIImageView+WebCache.h\"\n#import \"UIView+WebCache.h\"\n#import \"UIView+WebCacheOperation.h\"\n#import \"SDWebImage.h\"\n\nFOUNDATION_EXPORT double SDWebImageVersionNumber;\nFOUNDATION_EXPORT const unsigned char SDWebImageVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage\nDERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"ImageIO\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSUPPORTS_MACCATALYST = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap",
    "content": "framework module SDWebImage {\n  umbrella header \"SDWebImage-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage\nDERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"ImageIO\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSUPPORTS_MACCATALYST = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SQLiteRepairKit/SQLiteRepairKit-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.2.2</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SQLiteRepairKit/SQLiteRepairKit-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_SQLiteRepairKit : NSObject\n@end\n@implementation PodsDummy_SQLiteRepairKit\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SQLiteRepairKit/SQLiteRepairKit-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SQLiteRepairKit/SQLiteRepairKit-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"SQLiteRepairKit.h\"\n\nFOUNDATION_EXPORT double sqliterkVersionNumber;\nFOUNDATION_EXPORT const unsigned char sqliterkVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SQLiteRepairKit/SQLiteRepairKit.debug.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_CXX_LANGUAGE_STANDARD = gnu++0x\nCLANG_CXX_LIBRARY = libc++\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 SQLITE_HAS_CODEC WCDB_BUILTIN_SQLCIPHER\nLIBRARY_SEARCH_PATHS[sdk=macosx*] = $(SDKROOT)/usr/lib/system\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -l\"z\" -framework \"Foundation\" -framework \"Security\" -framework \"sqlcipher\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SQLiteRepairKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SQLiteRepairKit/SQLiteRepairKit.modulemap",
    "content": "framework module sqliterk {\n  umbrella header \"SQLiteRepairKit-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SQLiteRepairKit/SQLiteRepairKit.release.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_CXX_LANGUAGE_STANDARD = gnu++0x\nCLANG_CXX_LIBRARY = libc++\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 SQLITE_HAS_CODEC WCDB_BUILTIN_SQLCIPHER\nLIBRARY_SEARCH_PATHS[sdk=macosx*] = $(SDKROOT)/usr/lib/system\nOTHER_LDFLAGS = $(inherited) -l\"c++\" -l\"z\" -framework \"Foundation\" -framework \"Security\" -framework \"sqlcipher\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SQLiteRepairKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SnapKit/SnapKit-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.6.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SnapKit/SnapKit-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_SnapKit : NSObject\n@end\n@implementation PodsDummy_SnapKit\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SnapKit/SnapKit-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SnapKit/SnapKit-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double SnapKitVersionNumber;\nFOUNDATION_EXPORT const unsigned char SnapKitVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SnapKit/SnapKit.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SnapKit/SnapKit.modulemap",
    "content": "framework module SnapKit {\n  umbrella header \"SnapKit-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SnapKit/SnapKit.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftDate/SwiftDate-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>6.3.1</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftDate/SwiftDate-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_SwiftDate : NSObject\n@end\n@implementation PodsDummy_SwiftDate\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftDate/SwiftDate-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftDate/SwiftDate-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double SwiftDateVersionNumber;\nFOUNDATION_EXPORT const unsigned char SwiftDateVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftDate/SwiftDate.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftDate\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftDate\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftDate/SwiftDate.modulemap",
    "content": "framework module SwiftDate {\n  umbrella header \"SwiftDate-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftDate/SwiftDate.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftDate\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftDate\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwifterSwift/SwifterSwift-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.2.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwifterSwift/SwifterSwift-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_SwifterSwift : NSObject\n@end\n@implementation PodsDummy_SwifterSwift\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwifterSwift/SwifterSwift-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwifterSwift/SwifterSwift-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double SwifterSwiftVersionNumber;\nFOUNDATION_EXPORT const unsigned char SwifterSwiftVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwifterSwift/SwifterSwift.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwifterSwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SwifterSwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwifterSwift/SwifterSwift.modulemap",
    "content": "framework module SwifterSwift {\n  umbrella header \"SwifterSwift-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwifterSwift/SwifterSwift.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwifterSwift\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SwifterSwift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.0.1</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_SwiftyJSON : NSObject\n@end\n@implementation PodsDummy_SwiftyJSON\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double SwiftyJSONVersionNumber;\nFOUNDATION_EXPORT const unsigned char SwiftyJSONVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftyJSON\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap",
    "content": "framework module SwiftyJSON {\n  umbrella header \"SwiftyJSON-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftyJSON\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/TZImagePickerController/TZImagePickerController-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>3.8.1</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/TZImagePickerController/TZImagePickerController-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_TZImagePickerController : NSObject\n@end\n@implementation PodsDummy_TZImagePickerController\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/TZImagePickerController/TZImagePickerController-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/TZImagePickerController/TZImagePickerController-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"NSBundle+TZImagePicker.h\"\n#import \"TZAssetCell.h\"\n#import \"TZAssetModel.h\"\n#import \"TZAuthLimitedFooterTipView.h\"\n#import \"TZGifPhotoPreviewController.h\"\n#import \"TZImageCropManager.h\"\n#import \"TZImageManager.h\"\n#import \"TZImagePickerController.h\"\n#import \"TZImageRequestOperation.h\"\n#import \"TZLocationManager.h\"\n#import \"TZPhotoPickerController.h\"\n#import \"TZPhotoPreviewCell.h\"\n#import \"TZPhotoPreviewController.h\"\n#import \"TZProgressView.h\"\n#import \"TZVideoCropController.h\"\n#import \"TZVideoEditedPreviewController.h\"\n#import \"TZVideoPlayerController.h\"\n#import \"UIView+TZLayout.h\"\n\nFOUNDATION_EXPORT double TZImagePickerControllerVersionNumber;\nFOUNDATION_EXPORT const unsigned char TZImagePickerControllerVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/TZImagePickerController/TZImagePickerController.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/TZImagePickerController\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"Photos\" -framework \"PhotosUI\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/TZImagePickerController\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/TZImagePickerController/TZImagePickerController.modulemap",
    "content": "framework module TZImagePickerController {\n  umbrella header \"TZImagePickerController-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/TZImagePickerController/TZImagePickerController.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/TZImagePickerController\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"Photos\" -framework \"PhotosUI\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/TZImagePickerController\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.6.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_UITableView_FDTemplateLayoutCell : NSObject\n@end\n@implementation PodsDummy_UITableView_FDTemplateLayoutCell\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"UITableView+FDIndexPathHeightCache.h\"\n#import \"UITableView+FDKeyedHeightCache.h\"\n#import \"UITableView+FDTemplateLayoutCell.h\"\n#import \"UITableView+FDTemplateLayoutCellDebug.h\"\n\nFOUNDATION_EXPORT double UITableView_FDTemplateLayoutCellVersionNumber;\nFOUNDATION_EXPORT const unsigned char UITableView_FDTemplateLayoutCellVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/UITableView+FDTemplateLayoutCell\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/UITableView+FDTemplateLayoutCell\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.modulemap",
    "content": "framework module UITableView_FDTemplateLayoutCell {\n  umbrella header \"UITableView+FDTemplateLayoutCell-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/UITableView+FDTemplateLayoutCell\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/UITableView+FDTemplateLayoutCell\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.1.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_UIView_FDCollapsibleConstraints : NSObject\n@end\n@implementation PodsDummy_UIView_FDCollapsibleConstraints\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"UIView+FDCollapsibleConstraints.h\"\n\nFOUNDATION_EXPORT double UIView_FDCollapsibleConstraintsVersionNumber;\nFOUNDATION_EXPORT const unsigned char UIView_FDCollapsibleConstraintsVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/UIView+FDCollapsibleConstraints\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/UIView+FDCollapsibleConstraints\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints.modulemap",
    "content": "framework module UIView_FDCollapsibleConstraints {\n  umbrella header \"UIView+FDCollapsibleConstraints-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/UIView+FDCollapsibleConstraints\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/UIView+FDCollapsibleConstraints\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDB.swift/WCDB.swift-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.8</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDB.swift/WCDB.swift-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_WCDB_swift : NSObject\n@end\n@implementation PodsDummy_WCDB_swift\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDB.swift/WCDB.swift-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDB.swift/WCDB.swift-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"SQLite-Bridging.h\"\n#import \"WCDB-Bridging.h\"\n\nFOUNDATION_EXPORT double WCDBSwiftVersionNumber;\nFOUNDATION_EXPORT const unsigned char WCDBSwiftVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDB.swift/WCDB.swift.debug.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/WCDB.swift\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 SQLITE_HAS_CODEC WCDB_BUILTIN_SQLCIPHER\nHEADER_SEARCH_PATHS = $(inherited) ${PODS_ROOT}/WCDBSwift\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nLIBRARY_SEARCH_PATHS[sdk=macosx*] = $(SDKROOT)/usr/lib/system\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\" -framework \"Security\" -framework \"sqlcipher\" -framework \"sqliterk\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nOTHER_SWIFT_FLAGS[config=Debug] = -D DEBUG\nOTHER_SWIFT_FLAGS[config=Debug][sdk=iphoneos*] = -D WCDB_IOS -D DEBUG\nOTHER_SWIFT_FLAGS[config=Debug][sdk=iphonesimulator*] = -D WCDB_IOS -D DEBUG\nOTHER_SWIFT_FLAGS[config=Release][sdk=iphoneos*] = -D WCDB_IOS\nOTHER_SWIFT_FLAGS[config=Release][sdk=iphonesimulator*] = -D WCDB_IOS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/WCDB.swift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSWIFT_WHOLE_MODULE_OPTIMIZATION = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDB.swift/WCDB.swift.modulemap",
    "content": "framework module WCDBSwift {\n  umbrella header \"WCDB.swift-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDB.swift/WCDB.swift.release.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/WCDB.swift\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/SQLiteRepairKit\" \"${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 SQLITE_HAS_CODEC WCDB_BUILTIN_SQLCIPHER\nHEADER_SEARCH_PATHS = $(inherited) ${PODS_ROOT}/WCDBSwift\nLIBRARY_SEARCH_PATHS = $(inherited) \"${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\" /usr/lib/swift\nLIBRARY_SEARCH_PATHS[sdk=macosx*] = $(SDKROOT)/usr/lib/system\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\" -framework \"Security\" -framework \"sqlcipher\" -framework \"sqliterk\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nOTHER_SWIFT_FLAGS[config=Debug] = -D DEBUG\nOTHER_SWIFT_FLAGS[config=Debug][sdk=iphoneos*] = -D WCDB_IOS -D DEBUG\nOTHER_SWIFT_FLAGS[config=Debug][sdk=iphonesimulator*] = -D WCDB_IOS -D DEBUG\nOTHER_SWIFT_FLAGS[config=Release][sdk=iphoneos*] = -D WCDB_IOS\nOTHER_SWIFT_FLAGS[config=Release][sdk=iphonesimulator*] = -D WCDB_IOS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/WCDB.swift\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nSWIFT_WHOLE_MODULE_OPTIMIZATION = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.2.1</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_WCDBOptimizedSQLCipher : NSObject\n@end\n@implementation PodsDummy_WCDBOptimizedSQLCipher\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"sqlite3.h\"\n#import \"fts3_tokenizer.h\"\n\nFOUNDATION_EXPORT double sqlcipherVersionNumber;\nFOUNDATION_EXPORT const unsigned char sqlcipherVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher.debug.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_WARN_COMMA = NO\nCLANG_WARN_CONSTANT_CONVERSION = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCLANG_WARN_STRICT_PROTOTYPES = NO\nCLANG_WARN_UNREACHABLE_CODE = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_API_ARMOR SQLITE_OMIT_BUILTIN_TEST SQLITE_OMIT_AUTORESET SQLITE_ENABLE_UPDATE_DELETE_LIMIT SQLITE_ENABLE_RTREE SQLITE_ENABLE_LOCKING_STYLE=1 SQLITE_SYSTEM_MALLOC SQLITE_OMIT_LOAD_EXTENSION SQLITE_CORE SQLITE_THREADSAFE=2 SQLITE_DEFAULT_CACHE_SIZE=250 SQLITE_DEFAULT_CKPTFULLFSYNC=1 SQLITE_DEFAULT_PAGE_SIZE=4096 SQLITE_OMIT_SHARED_CACHE SQLITE_HAS_CODEC SQLCIPHER_CRYPTO_CC USE_PREAD=1 SQLITE_TEMP_STORE=2 SQLCIPHER_PREPROCESSED HAVE_USLEEP SQLITE_MALLOC_SOFT_LIMIT=0 SQLITE_WCDB_SIGNAL_RETRY=1 SQLITE_DEFAULT_MEMSTATUS=0 SQLITE_ENABLE_COLUMN_METADATA SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 SQLITE_LIKE_DOESNT_MATCH_BLOBS SQLITE_MAX_EXPR_DEPTH=0 SQLITE_OMIT_DEPRECATED SQLITE_OMIT_PROGRESS_CALLBACK SQLITE_OMIT_SHARED_CACHE OMIT_CONSTTIME_MEM OMIT_MEMLOCK SQLITE_ENABLE_FTS3_TOKENIZER SQLITE_WCDB_CHECKPOINT_HANDLER SQLITE_MMAP_READWRITE SQLITE_ENABLE_DBSTAT_VTAB SQLITE_ENABLE_FTS5\nGCC_WARN_64_TO_32_BIT_CONVERSION = NO\nGCC_WARN_UNUSED_FUNCTION = NO\nGCC_WARN_UNUSED_VARIABLE = NO\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\" -framework \"Security\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/WCDBOptimizedSQLCipher\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher.modulemap",
    "content": "framework module sqlcipher {\n  umbrella header \"WCDBOptimizedSQLCipher-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher.release.xcconfig",
    "content": "APPLICATION_EXTENSION_API_ONLY = YES\nCLANG_WARN_COMMA = NO\nCLANG_WARN_CONSTANT_CONVERSION = YES\nCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCLANG_WARN_STRICT_PROTOTYPES = NO\nCLANG_WARN_UNREACHABLE_CODE = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/WCDBOptimizedSQLCipher\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_API_ARMOR SQLITE_OMIT_BUILTIN_TEST SQLITE_OMIT_AUTORESET SQLITE_ENABLE_UPDATE_DELETE_LIMIT SQLITE_ENABLE_RTREE SQLITE_ENABLE_LOCKING_STYLE=1 SQLITE_SYSTEM_MALLOC SQLITE_OMIT_LOAD_EXTENSION SQLITE_CORE SQLITE_THREADSAFE=2 SQLITE_DEFAULT_CACHE_SIZE=250 SQLITE_DEFAULT_CKPTFULLFSYNC=1 SQLITE_DEFAULT_PAGE_SIZE=4096 SQLITE_OMIT_SHARED_CACHE SQLITE_HAS_CODEC SQLCIPHER_CRYPTO_CC USE_PREAD=1 SQLITE_TEMP_STORE=2 SQLCIPHER_PREPROCESSED HAVE_USLEEP SQLITE_MALLOC_SOFT_LIMIT=0 SQLITE_WCDB_SIGNAL_RETRY=1 SQLITE_DEFAULT_MEMSTATUS=0 SQLITE_ENABLE_COLUMN_METADATA SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 SQLITE_LIKE_DOESNT_MATCH_BLOBS SQLITE_MAX_EXPR_DEPTH=0 SQLITE_OMIT_DEPRECATED SQLITE_OMIT_PROGRESS_CALLBACK SQLITE_OMIT_SHARED_CACHE OMIT_CONSTTIME_MEM OMIT_MEMLOCK SQLITE_ENABLE_FTS3_TOKENIZER SQLITE_WCDB_CHECKPOINT_HANDLER SQLITE_MMAP_READWRITE SQLITE_ENABLE_DBSTAT_VTAB SQLITE_ENABLE_FTS5\nGCC_WARN_64_TO_32_BIT_CONVERSION = NO\nGCC_WARN_UNUSED_FUNCTION = NO\nGCC_WARN_UNUSED_VARIABLE = NO\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\" -framework \"Security\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/WCDBOptimizedSQLCipher\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YBImageBrowser/YBImageBrowser-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>3.0.9</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YBImageBrowser/YBImageBrowser-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_YBImageBrowser : NSObject\n@end\n@implementation PodsDummy_YBImageBrowser\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YBImageBrowser/YBImageBrowser-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YBImageBrowser/YBImageBrowser-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"YBIBAuxiliaryViewHandler.h\"\n#import \"YBIBLoadingView.h\"\n#import \"YBIBToastView.h\"\n#import \"NSObject+YBImageBrowser.h\"\n#import \"YBIBAnimatedTransition.h\"\n#import \"YBIBCollectionView.h\"\n#import \"YBIBCollectionViewLayout.h\"\n#import \"YBIBContainerView.h\"\n#import \"YBIBDataMediator.h\"\n#import \"YBIBScreenRotationHandler.h\"\n#import \"YBImageBrowser+Internal.h\"\n#import \"YBIBCopywriter.h\"\n#import \"YBIBIconManager.h\"\n#import \"YBIBPhotoAlbumManager.h\"\n#import \"YBIBSentinel.h\"\n#import \"YBIBUtilities.h\"\n#import \"YBIBImageCache+Internal.h\"\n#import \"YBIBImageCache.h\"\n#import \"YBIBImageCell+Internal.h\"\n#import \"YBIBImageCell.h\"\n#import \"YBIBImageData+Internal.h\"\n#import \"YBIBImageData.h\"\n#import \"YBIBImageLayout.h\"\n#import \"YBIBImageScrollView.h\"\n#import \"YBIBInteractionProfile.h\"\n#import \"YBImage.h\"\n#import \"YBIBCellProtocol.h\"\n#import \"YBIBDataProtocol.h\"\n#import \"YBIBGetBaseInfoProtocol.h\"\n#import \"YBIBOperateBrowserProtocol.h\"\n#import \"YBIBOrientationReceiveProtocol.h\"\n#import \"YBImageBrowserDataSource.h\"\n#import \"YBImageBrowserDelegate.h\"\n#import \"YBIBSheetView.h\"\n#import \"YBIBToolViewHandler.h\"\n#import \"YBIBTopView.h\"\n#import \"YBIBDefaultWebImageMediator.h\"\n#import \"YBIBWebImageMediator.h\"\n#import \"YBImageBrowser.h\"\n#import \"YBIBVideoActionBar.h\"\n#import \"YBIBVideoCell+Internal.h\"\n#import \"YBIBVideoCell.h\"\n#import \"YBIBVideoData+Internal.h\"\n#import \"YBIBVideoData.h\"\n#import \"YBIBVideoTopBar.h\"\n#import \"YBIBVideoView.h\"\n\nFOUNDATION_EXPORT double YBImageBrowserVersionNumber;\nFOUNDATION_EXPORT const unsigned char YBImageBrowserVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YBImageBrowser/YBImageBrowser.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YBImageBrowser\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYImage\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"Accelerate\" -framework \"AssetsLibrary\" -framework \"CoreFoundation\" -framework \"ImageIO\" -framework \"MobileCoreServices\" -framework \"QuartzCore\" -framework \"SDWebImage\" -framework \"UIKit\" -framework \"YYImage\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/YBImageBrowser\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YBImageBrowser/YBImageBrowser.modulemap",
    "content": "framework module YBImageBrowser {\n  umbrella header \"YBImageBrowser-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YBImageBrowser/YBImageBrowser.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YBImageBrowser\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage\" \"${PODS_CONFIGURATION_BUILD_DIR}/YYImage\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"Accelerate\" -framework \"AssetsLibrary\" -framework \"CoreFoundation\" -framework \"ImageIO\" -framework \"MobileCoreServices\" -framework \"QuartzCore\" -framework \"SDWebImage\" -framework \"UIKit\" -framework \"YYImage\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/YBImageBrowser\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYImage/YYImage-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.4</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYImage/YYImage-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_YYImage : NSObject\n@end\n@implementation PodsDummy_YYImage\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYImage/YYImage-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYImage/YYImage-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"YYAnimatedImageView.h\"\n#import \"YYFrameImage.h\"\n#import \"YYImage.h\"\n#import \"YYImageCoder.h\"\n#import \"YYSpriteSheetImage.h\"\n\nFOUNDATION_EXPORT double YYImageVersionNumber;\nFOUNDATION_EXPORT const unsigned char YYImageVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYImage/YYImage.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YYImage\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -l\"z\" -framework \"Accelerate\" -framework \"AssetsLibrary\" -framework \"CoreFoundation\" -framework \"ImageIO\" -framework \"MobileCoreServices\" -framework \"QuartzCore\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/YYImage\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYImage/YYImage.modulemap",
    "content": "framework module YYImage {\n  umbrella header \"YYImage-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYImage/YYImage.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YYImage\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -l\"z\" -framework \"Accelerate\" -framework \"AssetsLibrary\" -framework \"CoreFoundation\" -framework \"ImageIO\" -framework \"MobileCoreServices\" -framework \"QuartzCore\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/YYImage\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYText/YYText-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>${PODS_DEVELOPMENT_LANGUAGE}</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.7</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYText/YYText-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_YYText : NSObject\n@end\n@implementation PodsDummy_YYText\n@end\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYText/YYText-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYText/YYText-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n#import \"YYTextContainerView.h\"\n#import \"YYTextDebugOption.h\"\n#import \"YYTextEffectWindow.h\"\n#import \"YYTextInput.h\"\n#import \"YYTextKeyboardManager.h\"\n#import \"YYTextLayout.h\"\n#import \"YYTextLine.h\"\n#import \"YYTextMagnifier.h\"\n#import \"YYTextSelectionView.h\"\n#import \"YYTextArchiver.h\"\n#import \"YYTextAttribute.h\"\n#import \"YYTextParser.h\"\n#import \"YYTextRubyAnnotation.h\"\n#import \"YYTextRunDelegate.h\"\n#import \"NSAttributedString+YYText.h\"\n#import \"NSParagraphStyle+YYText.h\"\n#import \"UIPasteboard+YYText.h\"\n#import \"UIView+YYText.h\"\n#import \"YYTextAsyncLayer.h\"\n#import \"YYTextTransaction.h\"\n#import \"YYTextUtilities.h\"\n#import \"YYTextWeakProxy.h\"\n#import \"YYLabel.h\"\n#import \"YYText.h\"\n#import \"YYTextView.h\"\n\nFOUNDATION_EXPORT double YYTextVersionNumber;\nFOUNDATION_EXPORT const unsigned char YYTextVersionString[];\n\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYText/YYText.debug.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YYText\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"Accelerate\" -framework \"CoreFoundation\" -framework \"CoreText\" -framework \"MobileCoreServices\" -framework \"QuartzCore\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/YYText\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYText/YYText.modulemap",
    "content": "framework module YYText {\n  umbrella header \"YYText-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "JetChat/Pods/Target Support Files/YYText/YYText.release.xcconfig",
    "content": "CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO\nCONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YYText\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"Accelerate\" -framework \"CoreFoundation\" -framework \"CoreText\" -framework \"MobileCoreServices\" -framework \"QuartzCore\" -framework \"UIKit\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/YYText\nPODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDIndexPathHeightCache.h",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import <UIKit/UIKit.h>\n\n@interface FDIndexPathHeightCache : NSObject\n\n// Enable automatically if you're using index path driven height cache\n@property (nonatomic, assign) BOOL automaticallyInvalidateEnabled;\n\n// Height cache\n- (BOOL)existsHeightAtIndexPath:(NSIndexPath *)indexPath;\n- (void)cacheHeight:(CGFloat)height byIndexPath:(NSIndexPath *)indexPath;\n- (CGFloat)heightForIndexPath:(NSIndexPath *)indexPath;\n- (void)invalidateHeightAtIndexPath:(NSIndexPath *)indexPath;\n- (void)invalidateAllHeightCache;\n\n@end\n\n@interface UITableView (FDIndexPathHeightCache)\n/// Height cache by index path. Generally, you don't need to use it directly.\n@property (nonatomic, strong, readonly) FDIndexPathHeightCache *fd_indexPathHeightCache;\n@end\n\n@interface UITableView (FDIndexPathHeightCacheInvalidation)\n/// Call this method when you want to reload data but don't want to invalidate\n/// all height cache by index path, for example, load more data at the bottom of\n/// table view.\n- (void)fd_reloadDataWithoutInvalidateIndexPathHeightCache;\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDIndexPathHeightCache.m",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import \"UITableView+FDIndexPathHeightCache.h\"\n#import <objc/runtime.h>\n\ntypedef NSMutableArray<NSMutableArray<NSNumber *> *> FDIndexPathHeightsBySection;\n\n@interface FDIndexPathHeightCache ()\n@property (nonatomic, strong) FDIndexPathHeightsBySection *heightsBySectionForPortrait;\n@property (nonatomic, strong) FDIndexPathHeightsBySection *heightsBySectionForLandscape;\n@end\n\n@implementation FDIndexPathHeightCache\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _heightsBySectionForPortrait = [NSMutableArray array];\n        _heightsBySectionForLandscape = [NSMutableArray array];\n    }\n    return self;\n}\n\n- (FDIndexPathHeightsBySection *)heightsBySectionForCurrentOrientation {\n    return UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation) ? self.heightsBySectionForPortrait: self.heightsBySectionForLandscape;\n}\n\n- (void)enumerateAllOrientationsUsingBlock:(void (^)(FDIndexPathHeightsBySection *heightsBySection))block {\n    block(self.heightsBySectionForPortrait);\n    block(self.heightsBySectionForLandscape);\n}\n\n- (BOOL)existsHeightAtIndexPath:(NSIndexPath *)indexPath {\n    [self buildCachesAtIndexPathsIfNeeded:@[indexPath]];\n    NSNumber *number = self.heightsBySectionForCurrentOrientation[indexPath.section][indexPath.row];\n    return ![number isEqualToNumber:@-1];\n}\n\n- (void)cacheHeight:(CGFloat)height byIndexPath:(NSIndexPath *)indexPath {\n    self.automaticallyInvalidateEnabled = YES;\n    [self buildCachesAtIndexPathsIfNeeded:@[indexPath]];\n    self.heightsBySectionForCurrentOrientation[indexPath.section][indexPath.row] = @(height);\n}\n\n- (CGFloat)heightForIndexPath:(NSIndexPath *)indexPath {\n    [self buildCachesAtIndexPathsIfNeeded:@[indexPath]];\n    NSNumber *number = self.heightsBySectionForCurrentOrientation[indexPath.section][indexPath.row];\n#if CGFLOAT_IS_DOUBLE\n    return number.doubleValue;\n#else\n    return number.floatValue;\n#endif\n}\n\n- (void)invalidateHeightAtIndexPath:(NSIndexPath *)indexPath {\n    [self buildCachesAtIndexPathsIfNeeded:@[indexPath]];\n    [self enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n        heightsBySection[indexPath.section][indexPath.row] = @-1;\n    }];\n}\n\n- (void)invalidateAllHeightCache {\n    [self enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n        [heightsBySection removeAllObjects];\n    }];\n}\n\n- (void)buildCachesAtIndexPathsIfNeeded:(NSArray *)indexPaths {\n    // Build every section array or row array which is smaller than given index path.\n    [indexPaths enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, BOOL *stop) {\n        [self buildSectionsIfNeeded:indexPath.section];\n        [self buildRowsIfNeeded:indexPath.row inExistSection:indexPath.section];\n    }];\n}\n\n- (void)buildSectionsIfNeeded:(NSInteger)targetSection {\n    [self enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n        for (NSInteger section = 0; section <= targetSection; ++section) {\n            if (section >= heightsBySection.count) {\n                heightsBySection[section] = [NSMutableArray array];\n            }\n        }\n    }];\n}\n\n- (void)buildRowsIfNeeded:(NSInteger)targetRow inExistSection:(NSInteger)section {\n    [self enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n        NSMutableArray<NSNumber *> *heightsByRow = heightsBySection[section];\n        for (NSInteger row = 0; row <= targetRow; ++row) {\n            if (row >= heightsByRow.count) {\n                heightsByRow[row] = @-1;\n            }\n        }\n    }];\n}\n\n@end\n\n@implementation UITableView (FDIndexPathHeightCache)\n\n- (FDIndexPathHeightCache *)fd_indexPathHeightCache {\n    FDIndexPathHeightCache *cache = objc_getAssociatedObject(self, _cmd);\n    if (!cache) {\n        cache = [FDIndexPathHeightCache new];\n        objc_setAssociatedObject(self, _cmd, cache, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return cache;\n}\n\n@end\n\n// We just forward primary call, in crash report, top most method in stack maybe FD's,\n// but it's really not our bug, you should check whether your table view's data source and\n// displaying cells are not matched when reloading.\nstatic void __FD_TEMPLATE_LAYOUT_CELL_PRIMARY_CALL_IF_CRASH_NOT_OUR_BUG__(void (^callout)(void)) {\n    callout();\n}\n#define FDPrimaryCall(...) do {__FD_TEMPLATE_LAYOUT_CELL_PRIMARY_CALL_IF_CRASH_NOT_OUR_BUG__(^{__VA_ARGS__});} while(0)\n\n@implementation UITableView (FDIndexPathHeightCacheInvalidation)\n\n- (void)fd_reloadDataWithoutInvalidateIndexPathHeightCache {\n    FDPrimaryCall([self fd_reloadData];);\n}\n\n+ (void)load {\n    // All methods that trigger height cache's invalidation\n    SEL selectors[] = {\n        @selector(reloadData),\n        @selector(insertSections:withRowAnimation:),\n        @selector(deleteSections:withRowAnimation:),\n        @selector(reloadSections:withRowAnimation:),\n        @selector(moveSection:toSection:),\n        @selector(insertRowsAtIndexPaths:withRowAnimation:),\n        @selector(deleteRowsAtIndexPaths:withRowAnimation:),\n        @selector(reloadRowsAtIndexPaths:withRowAnimation:),\n        @selector(moveRowAtIndexPath:toIndexPath:)\n    };\n    \n    for (NSUInteger index = 0; index < sizeof(selectors) / sizeof(SEL); ++index) {\n        SEL originalSelector = selectors[index];\n        SEL swizzledSelector = NSSelectorFromString([@\"fd_\" stringByAppendingString:NSStringFromSelector(originalSelector)]);\n        Method originalMethod = class_getInstanceMethod(self, originalSelector);\n        Method swizzledMethod = class_getInstanceMethod(self, swizzledSelector);\n        method_exchangeImplementations(originalMethod, swizzledMethod);\n    }\n}\n\n- (void)fd_reloadData {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n            [heightsBySection removeAllObjects];\n        }];\n    }\n    FDPrimaryCall([self fd_reloadData];);\n}\n\n- (void)fd_insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [sections enumerateIndexesUsingBlock:^(NSUInteger section, BOOL *stop) {\n            [self.fd_indexPathHeightCache buildSectionsIfNeeded:section];\n            [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n                [heightsBySection insertObject:[NSMutableArray array] atIndex:section];\n            }];\n        }];\n    }\n    FDPrimaryCall([self fd_insertSections:sections withRowAnimation:animation];);\n}\n\n- (void)fd_deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [sections enumerateIndexesUsingBlock:^(NSUInteger section, BOOL *stop) {\n            [self.fd_indexPathHeightCache buildSectionsIfNeeded:section];\n            [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n                [heightsBySection removeObjectAtIndex:section];\n            }];\n        }];\n    }\n    FDPrimaryCall([self fd_deleteSections:sections withRowAnimation:animation];);\n}\n\n- (void)fd_reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [sections enumerateIndexesUsingBlock: ^(NSUInteger section, BOOL *stop) {\n            [self.fd_indexPathHeightCache buildSectionsIfNeeded:section];\n            [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n                [heightsBySection[section] removeAllObjects];\n            }];\n\n        }];\n    }\n    FDPrimaryCall([self fd_reloadSections:sections withRowAnimation:animation];);\n}\n\n- (void)fd_moveSection:(NSInteger)section toSection:(NSInteger)newSection {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [self.fd_indexPathHeightCache buildSectionsIfNeeded:section];\n        [self.fd_indexPathHeightCache buildSectionsIfNeeded:newSection];\n        [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n            [heightsBySection exchangeObjectAtIndex:section withObjectAtIndex:newSection];\n        }];\n    }\n    FDPrimaryCall([self fd_moveSection:section toSection:newSection];);\n}\n\n- (void)fd_insertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [self.fd_indexPathHeightCache buildCachesAtIndexPathsIfNeeded:indexPaths];\n        [indexPaths enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, BOOL *stop) {\n            [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n                [heightsBySection[indexPath.section] insertObject:@-1 atIndex:indexPath.row];\n            }];\n        }];\n    }\n    FDPrimaryCall([self fd_insertRowsAtIndexPaths:indexPaths withRowAnimation:animation];);\n}\n\n- (void)fd_deleteRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [self.fd_indexPathHeightCache buildCachesAtIndexPathsIfNeeded:indexPaths];\n        \n        NSMutableDictionary<NSNumber *, NSMutableIndexSet *> *mutableIndexSetsToRemove = [NSMutableDictionary dictionary];\n        [indexPaths enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, BOOL *stop) {\n            NSMutableIndexSet *mutableIndexSet = mutableIndexSetsToRemove[@(indexPath.section)];\n            if (!mutableIndexSet) {\n                mutableIndexSet = [NSMutableIndexSet indexSet];\n                mutableIndexSetsToRemove[@(indexPath.section)] = mutableIndexSet;\n            }\n            [mutableIndexSet addIndex:indexPath.row];\n        }];\n        \n        [mutableIndexSetsToRemove enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, NSIndexSet *indexSet, BOOL *stop) {\n            [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n                [heightsBySection[key.integerValue] removeObjectsAtIndexes:indexSet];\n            }];\n        }];\n    }\n    FDPrimaryCall([self fd_deleteRowsAtIndexPaths:indexPaths withRowAnimation:animation];);\n}\n\n- (void)fd_reloadRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [self.fd_indexPathHeightCache buildCachesAtIndexPathsIfNeeded:indexPaths];\n        [indexPaths enumerateObjectsUsingBlock:^(NSIndexPath *indexPath, NSUInteger idx, BOOL *stop) {\n            [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n                heightsBySection[indexPath.section][indexPath.row] = @-1;\n            }];\n        }];\n    }\n    FDPrimaryCall([self fd_reloadRowsAtIndexPaths:indexPaths withRowAnimation:animation];);\n}\n\n- (void)fd_moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {\n    if (self.fd_indexPathHeightCache.automaticallyInvalidateEnabled) {\n        [self.fd_indexPathHeightCache buildCachesAtIndexPathsIfNeeded:@[sourceIndexPath, destinationIndexPath]];\n        [self.fd_indexPathHeightCache enumerateAllOrientationsUsingBlock:^(FDIndexPathHeightsBySection *heightsBySection) {\n            NSMutableArray<NSNumber *> *sourceRows = heightsBySection[sourceIndexPath.section];\n            NSMutableArray<NSNumber *> *destinationRows = heightsBySection[destinationIndexPath.section];\n            NSNumber *sourceValue = sourceRows[sourceIndexPath.row];\n            NSNumber *destinationValue = destinationRows[destinationIndexPath.row];\n            sourceRows[sourceIndexPath.row] = destinationValue;\n            destinationRows[destinationIndexPath.row] = sourceValue;\n        }];\n    }\n    FDPrimaryCall([self fd_moveRowAtIndexPath:sourceIndexPath toIndexPath:destinationIndexPath];);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.h",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import <UIKit/UIKit.h>\n\n@interface FDKeyedHeightCache : NSObject\n\n- (BOOL)existsHeightForKey:(id<NSCopying>)key;\n- (void)cacheHeight:(CGFloat)height byKey:(id<NSCopying>)key;\n- (CGFloat)heightForKey:(id<NSCopying>)key;\n\n// Invalidation\n- (void)invalidateHeightForKey:(id<NSCopying>)key;\n- (void)invalidateAllHeightCache;\n@end\n\n@interface UITableView (FDKeyedHeightCache)\n\n/// Height cache by key. Generally, you don't need to use it directly.\n@property (nonatomic, strong, readonly) FDKeyedHeightCache *fd_keyedHeightCache;\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDKeyedHeightCache.m",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import \"UITableView+FDKeyedHeightCache.h\"\n#import <objc/runtime.h>\n\n@interface FDKeyedHeightCache ()\n@property (nonatomic, strong) NSMutableDictionary<id<NSCopying>, NSNumber *> *mutableHeightsByKeyForPortrait;\n@property (nonatomic, strong) NSMutableDictionary<id<NSCopying>, NSNumber *> *mutableHeightsByKeyForLandscape;\n@end\n\n@implementation FDKeyedHeightCache\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _mutableHeightsByKeyForPortrait = [NSMutableDictionary dictionary];\n        _mutableHeightsByKeyForLandscape = [NSMutableDictionary dictionary];\n    }\n    return self;\n}\n\n- (NSMutableDictionary<id<NSCopying>, NSNumber *> *)mutableHeightsByKeyForCurrentOrientation {\n    return UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation) ? self.mutableHeightsByKeyForPortrait: self.mutableHeightsByKeyForLandscape;\n}\n\n- (BOOL)existsHeightForKey:(id<NSCopying>)key {\n    NSNumber *number = self.mutableHeightsByKeyForCurrentOrientation[key];\n    return number && ![number isEqualToNumber:@-1];\n}\n\n- (void)cacheHeight:(CGFloat)height byKey:(id<NSCopying>)key {\n    self.mutableHeightsByKeyForCurrentOrientation[key] = @(height);\n}\n\n- (CGFloat)heightForKey:(id<NSCopying>)key {\n#if CGFLOAT_IS_DOUBLE\n    return [self.mutableHeightsByKeyForCurrentOrientation[key] doubleValue];\n#else\n    return [self.mutableHeightsByKeyForCurrentOrientation[key] floatValue];\n#endif\n}\n\n- (void)invalidateHeightForKey:(id<NSCopying>)key {\n    [self.mutableHeightsByKeyForPortrait removeObjectForKey:key];\n    [self.mutableHeightsByKeyForLandscape removeObjectForKey:key];\n}\n\n- (void)invalidateAllHeightCache {\n    [self.mutableHeightsByKeyForPortrait removeAllObjects];\n    [self.mutableHeightsByKeyForLandscape removeAllObjects];\n}\n\n@end\n\n@implementation UITableView (FDKeyedHeightCache)\n\n- (FDKeyedHeightCache *)fd_keyedHeightCache {\n    FDKeyedHeightCache *cache = objc_getAssociatedObject(self, _cmd);\n    if (!cache) {\n        cache = [FDKeyedHeightCache new];\n        objc_setAssociatedObject(self, _cmd, cache, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return cache;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCell.h",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import <UIKit/UIKit.h>\n#import \"UITableView+FDKeyedHeightCache.h\"\n#import \"UITableView+FDIndexPathHeightCache.h\"\n#import \"UITableView+FDTemplateLayoutCellDebug.h\"\n\n@interface UITableView (FDTemplateLayoutCell)\n\n/// Access to internal template layout cell for given reuse identifier.\n/// Generally, you don't need to know these template layout cells.\n///\n/// @param identifier Reuse identifier for cell which must be registered.\n///\n- (__kindof UITableViewCell *)fd_templateCellForReuseIdentifier:(NSString *)identifier;\n\n/// Returns height of cell of type specifed by a reuse identifier and configured\n/// by the configuration block.\n///\n/// The cell would be layed out on a fixed-width, vertically expanding basis with\n/// respect to its dynamic content, using auto layout. Thus, it is imperative that\n/// the cell was set up to be self-satisfied, i.e. its content always determines\n/// its height given the width is equal to the tableview's.\n///\n/// @param identifier A string identifier for retrieving and maintaining template\n///        cells with system's \"-dequeueReusableCellWithIdentifier:\" call.\n/// @param configuration An optional block for configuring and providing content\n///        to the template cell. The configuration should be minimal for scrolling\n///        performance yet sufficient for calculating cell's height.\n///\n- (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier configuration:(void (^)(id cell))configuration;\n\n/// This method does what \"-fd_heightForCellWithIdentifier:configuration\" does, and\n/// calculated height will be cached by its index path, returns a cached height\n/// when needed. Therefore lots of extra height calculations could be saved.\n///\n/// No need to worry about invalidating cached heights when data source changes, it\n/// will be done automatically when you call \"-reloadData\" or any method that triggers\n/// UITableView's reloading.\n///\n/// @param indexPath where this cell's height cache belongs.\n///\n- (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier cacheByIndexPath:(NSIndexPath *)indexPath configuration:(void (^)(id cell))configuration;\n\n/// This method caches height by your model entity's identifier.\n/// If your model's changed, call \"-invalidateHeightForKey:(id <NSCopying>)key\" to\n/// invalidate cache and re-calculate, it's much cheaper and effective than \"cacheByIndexPath\".\n///\n/// @param key model entity's identifier whose data configures a cell.\n///\n- (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier cacheByKey:(id<NSCopying>)key configuration:(void (^)(id cell))configuration;\n\n@end\n\n@interface UITableView (FDTemplateLayoutHeaderFooterView)\n\n/// Returns header or footer view's height that registered in table view with reuse identifier.\n///\n/// Use it after calling \"-[UITableView registerNib/Class:forHeaderFooterViewReuseIdentifier]\",\n/// same with \"-fd_heightForCellWithIdentifier:configuration:\", it will call \"-sizeThatFits:\" for\n/// subclass of UITableViewHeaderFooterView which is not using Auto Layout.\n///\n- (CGFloat)fd_heightForHeaderFooterViewWithIdentifier:(NSString *)identifier configuration:(void (^)(id headerFooterView))configuration;\n\n@end\n\n@interface UITableViewCell (FDTemplateLayoutCell)\n\n/// Indicate this is a template layout cell for calculation only.\n/// You may need this when there are non-UI side effects when configure a cell.\n/// Like:\n///   - (void)configureCell:(FooCell *)cell atIndexPath:(NSIndexPath *)indexPath {\n///       cell.entity = [self entityAtIndexPath:indexPath];\n///       if (!cell.fd_isTemplateLayoutCell) {\n///           [self notifySomething]; // non-UI side effects\n///       }\n///   }\n///\n@property (nonatomic, assign) BOOL fd_isTemplateLayoutCell;\n\n/// Enable to enforce this template layout cell to use \"frame layout\" rather than \"auto layout\",\n/// and will ask cell's height by calling \"-sizeThatFits:\", so you must override this method.\n/// Use this property only when you want to manually control this template layout cell's height\n/// calculation mode, default to NO.\n///\n@property (nonatomic, assign) BOOL fd_enforceFrameLayout;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCell.m",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import \"UITableView+FDTemplateLayoutCell.h\"\n#import <objc/runtime.h>\n\n@implementation UITableView (FDTemplateLayoutCell)\n\n- (CGFloat)fd_systemFittingHeightForConfiguratedCell:(UITableViewCell *)cell {\n    CGFloat contentViewWidth = CGRectGetWidth(self.frame);\n    \n    // If a cell has accessory view or system accessory type, its content view's width is smaller\n    // than cell's by some fixed values.\n    if (cell.accessoryView) {\n        contentViewWidth -= 16 + CGRectGetWidth(cell.accessoryView.frame);\n    } else {\n        static const CGFloat systemAccessoryWidths[] = {\n            [UITableViewCellAccessoryNone] = 0,\n            [UITableViewCellAccessoryDisclosureIndicator] = 34,\n            [UITableViewCellAccessoryDetailDisclosureButton] = 68,\n            [UITableViewCellAccessoryCheckmark] = 40,\n            [UITableViewCellAccessoryDetailButton] = 48\n        };\n        contentViewWidth -= systemAccessoryWidths[cell.accessoryType];\n    }\n    \n    // If not using auto layout, you have to override \"-sizeThatFits:\" to provide a fitting size by yourself.\n    // This is the same height calculation passes used in iOS8 self-sizing cell's implementation.\n    //\n    // 1. Try \"- systemLayoutSizeFittingSize:\" first. (skip this step if 'fd_enforceFrameLayout' set to YES.)\n    // 2. Warning once if step 1 still returns 0 when using AutoLayout\n    // 3. Try \"- sizeThatFits:\" if step 1 returns 0\n    // 4. Use a valid height or default row height (44) if not exist one\n    \n    CGFloat fittingHeight = 0;\n    \n    if (!cell.fd_enforceFrameLayout && contentViewWidth > 0) {\n        // Add a hard width constraint to make dynamic content views (like labels) expand vertically instead\n        // of growing horizontally, in a flow-layout manner.\n        NSLayoutConstraint *widthFenceConstraint = [NSLayoutConstraint constraintWithItem:cell.contentView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:contentViewWidth];\n\n        // [bug fix] after iOS 10.3, Auto Layout engine will add an additional 0 width constraint onto cell's content view, to avoid that, we add constraints to content view's left, right, top and bottom.\n        static BOOL isSystemVersionEqualOrGreaterThen10_2 = NO;\n        static dispatch_once_t onceToken;\n        dispatch_once(&onceToken, ^{\n            isSystemVersionEqualOrGreaterThen10_2 = [UIDevice.currentDevice.systemVersion compare:@\"10.2\" options:NSNumericSearch] != NSOrderedAscending;\n        });\n        \n        NSArray<NSLayoutConstraint *> *edgeConstraints;\n        if (isSystemVersionEqualOrGreaterThen10_2) {\n            // To avoid confilicts, make width constraint softer than required (1000)\n            widthFenceConstraint.priority = UILayoutPriorityRequired - 1;\n            \n            // Build edge constraints\n            NSLayoutConstraint *leftConstraint = [NSLayoutConstraint constraintWithItem:cell.contentView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:cell attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];\n            NSLayoutConstraint *rightConstraint = [NSLayoutConstraint constraintWithItem:cell.contentView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:cell attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];\n            NSLayoutConstraint *topConstraint = [NSLayoutConstraint constraintWithItem:cell.contentView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:cell attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];\n            NSLayoutConstraint *bottomConstraint = [NSLayoutConstraint constraintWithItem:cell.contentView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:cell attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];\n            edgeConstraints = @[leftConstraint, rightConstraint, topConstraint, bottomConstraint];\n            [cell addConstraints:edgeConstraints];\n        }\n        \n        [cell.contentView addConstraint:widthFenceConstraint];\n\n        // Auto layout engine does its math\n        fittingHeight = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;\n        \n        // Clean-ups\n        [cell.contentView removeConstraint:widthFenceConstraint];\n        if (isSystemVersionEqualOrGreaterThen10_2) {\n            [cell removeConstraints:edgeConstraints];\n        }\n        \n        [self fd_debugLog:[NSString stringWithFormat:@\"calculate using system fitting size (AutoLayout) - %@\", @(fittingHeight)]];\n    }\n    \n    if (fittingHeight == 0) {\n#if DEBUG\n        // Warn if using AutoLayout but get zero height.\n        if (cell.contentView.constraints.count > 0) {\n            if (!objc_getAssociatedObject(self, _cmd)) {\n                NSLog(@\"[FDTemplateLayoutCell] Warning once only: Cannot get a proper cell height (now 0) from '- systemFittingSize:'(AutoLayout). You should check how constraints are built in cell, making it into 'self-sizing' cell.\");\n                objc_setAssociatedObject(self, _cmd, @YES, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n            }\n        }\n#endif\n        // Try '- sizeThatFits:' for frame layout.\n        // Note: fitting height should not include separator view.\n        fittingHeight = [cell sizeThatFits:CGSizeMake(contentViewWidth, 0)].height;\n        \n        [self fd_debugLog:[NSString stringWithFormat:@\"calculate using sizeThatFits - %@\", @(fittingHeight)]];\n    }\n    \n    // Still zero height after all above.\n    if (fittingHeight == 0) {\n        // Use default row height.\n        fittingHeight = 44;\n    }\n    \n    // Add 1px extra space for separator line if needed, simulating default UITableViewCell.\n    if (self.separatorStyle != UITableViewCellSeparatorStyleNone) {\n        fittingHeight += 1.0 / [UIScreen mainScreen].scale;\n    }\n    \n    return fittingHeight;\n}\n\n- (__kindof UITableViewCell *)fd_templateCellForReuseIdentifier:(NSString *)identifier {\n    NSAssert(identifier.length > 0, @\"Expect a valid identifier - %@\", identifier);\n    \n    NSMutableDictionary<NSString *, UITableViewCell *> *templateCellsByIdentifiers = objc_getAssociatedObject(self, _cmd);\n    if (!templateCellsByIdentifiers) {\n        templateCellsByIdentifiers = @{}.mutableCopy;\n        objc_setAssociatedObject(self, _cmd, templateCellsByIdentifiers, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    \n    UITableViewCell *templateCell = templateCellsByIdentifiers[identifier];\n    \n    if (!templateCell) {\n        templateCell = [self dequeueReusableCellWithIdentifier:identifier];\n        NSAssert(templateCell != nil, @\"Cell must be registered to table view for identifier - %@\", identifier);\n        templateCell.fd_isTemplateLayoutCell = YES;\n        templateCell.contentView.translatesAutoresizingMaskIntoConstraints = NO;\n        templateCellsByIdentifiers[identifier] = templateCell;\n        [self fd_debugLog:[NSString stringWithFormat:@\"layout cell created - %@\", identifier]];\n    }\n    \n    return templateCell;\n}\n\n- (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier configuration:(void (^)(id cell))configuration {\n    if (!identifier) {\n        return 0;\n    }\n    \n    UITableViewCell *templateLayoutCell = [self fd_templateCellForReuseIdentifier:identifier];\n    \n    // Manually calls to ensure consistent behavior with actual cells. (that are displayed on screen)\n    [templateLayoutCell prepareForReuse];\n    \n    // Customize and provide content for our template cell.\n    if (configuration) {\n        configuration(templateLayoutCell);\n    }\n    \n    return [self fd_systemFittingHeightForConfiguratedCell:templateLayoutCell];\n}\n\n- (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier cacheByIndexPath:(NSIndexPath *)indexPath configuration:(void (^)(id cell))configuration {\n    if (!identifier || !indexPath) {\n        return 0;\n    }\n    \n    // Hit cache\n    if ([self.fd_indexPathHeightCache existsHeightAtIndexPath:indexPath]) {\n        [self fd_debugLog:[NSString stringWithFormat:@\"hit cache by index path[%@:%@] - %@\", @(indexPath.section), @(indexPath.row), @([self.fd_indexPathHeightCache heightForIndexPath:indexPath])]];\n        return [self.fd_indexPathHeightCache heightForIndexPath:indexPath];\n    }\n    \n    CGFloat height = [self fd_heightForCellWithIdentifier:identifier configuration:configuration];\n    [self.fd_indexPathHeightCache cacheHeight:height byIndexPath:indexPath];\n    [self fd_debugLog:[NSString stringWithFormat: @\"cached by index path[%@:%@] - %@\", @(indexPath.section), @(indexPath.row), @(height)]];\n    \n    return height;\n}\n\n- (CGFloat)fd_heightForCellWithIdentifier:(NSString *)identifier cacheByKey:(id<NSCopying>)key configuration:(void (^)(id cell))configuration {\n    if (!identifier || !key) {\n        return 0;\n    }\n    \n    // Hit cache\n    if ([self.fd_keyedHeightCache existsHeightForKey:key]) {\n        CGFloat cachedHeight = [self.fd_keyedHeightCache heightForKey:key];\n        [self fd_debugLog:[NSString stringWithFormat:@\"hit cache by key[%@] - %@\", key, @(cachedHeight)]];\n        return cachedHeight;\n    }\n    \n    CGFloat height = [self fd_heightForCellWithIdentifier:identifier configuration:configuration];\n    [self.fd_keyedHeightCache cacheHeight:height byKey:key];\n    [self fd_debugLog:[NSString stringWithFormat:@\"cached by key[%@] - %@\", key, @(height)]];\n    \n    return height;\n}\n\n@end\n\n@implementation UITableView (FDTemplateLayoutHeaderFooterView)\n\n- (__kindof UITableViewHeaderFooterView *)fd_templateHeaderFooterViewForReuseIdentifier:(NSString *)identifier {\n    NSAssert(identifier.length > 0, @\"Expect a valid identifier - %@\", identifier);\n    \n    NSMutableDictionary<NSString *, UITableViewHeaderFooterView *> *templateHeaderFooterViews = objc_getAssociatedObject(self, _cmd);\n    if (!templateHeaderFooterViews) {\n        templateHeaderFooterViews = @{}.mutableCopy;\n        objc_setAssociatedObject(self, _cmd, templateHeaderFooterViews, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    \n    UITableViewHeaderFooterView *templateHeaderFooterView = templateHeaderFooterViews[identifier];\n    \n    if (!templateHeaderFooterView) {\n        templateHeaderFooterView = [self dequeueReusableHeaderFooterViewWithIdentifier:identifier];\n        NSAssert(templateHeaderFooterView != nil, @\"HeaderFooterView must be registered to table view for identifier - %@\", identifier);\n        templateHeaderFooterView.contentView.translatesAutoresizingMaskIntoConstraints = NO;\n        templateHeaderFooterViews[identifier] = templateHeaderFooterView;\n        [self fd_debugLog:[NSString stringWithFormat:@\"layout header footer view created - %@\", identifier]];\n    }\n    \n    return templateHeaderFooterView;\n}\n\n- (CGFloat)fd_heightForHeaderFooterViewWithIdentifier:(NSString *)identifier configuration:(void (^)(id))configuration {\n    UITableViewHeaderFooterView *templateHeaderFooterView = [self fd_templateHeaderFooterViewForReuseIdentifier:identifier];\n    \n    NSLayoutConstraint *widthFenceConstraint = [NSLayoutConstraint constraintWithItem:templateHeaderFooterView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:CGRectGetWidth(self.frame)];\n    [templateHeaderFooterView addConstraint:widthFenceConstraint];\n    CGFloat fittingHeight = [templateHeaderFooterView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;\n    [templateHeaderFooterView removeConstraint:widthFenceConstraint];\n    \n    if (fittingHeight == 0) {\n        fittingHeight = [templateHeaderFooterView sizeThatFits:CGSizeMake(CGRectGetWidth(self.frame), 0)].height;\n    }\n    \n    return fittingHeight;\n}\n\n@end\n\n@implementation UITableViewCell (FDTemplateLayoutCell)\n\n- (BOOL)fd_isTemplateLayoutCell {\n    return [objc_getAssociatedObject(self, _cmd) boolValue];\n}\n\n- (void)setFd_isTemplateLayoutCell:(BOOL)isTemplateLayoutCell {\n    objc_setAssociatedObject(self, @selector(fd_isTemplateLayoutCell), @(isTemplateLayoutCell), OBJC_ASSOCIATION_RETAIN);\n}\n\n- (BOOL)fd_enforceFrameLayout {\n    return [objc_getAssociatedObject(self, _cmd) boolValue];\n}\n\n- (void)setFd_enforceFrameLayout:(BOOL)enforceFrameLayout {\n    objc_setAssociatedObject(self, @selector(fd_enforceFrameLayout), @(enforceFrameLayout), OBJC_ASSOCIATION_RETAIN);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.h",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import <UIKit/UIKit.h>\n\n@interface UITableView (FDTemplateLayoutCellDebug)\n\n/// Helps to debug or inspect what is this \"FDTemplateLayoutCell\" extention doing,\n/// turning on to print logs when \"creating\", \"calculating\", \"precaching\" or \"hitting cache\".\n///\n/// Default to NO, log by NSLog.\n///\n@property (nonatomic, assign) BOOL fd_debugLogEnabled;\n\n/// Debug log controlled by \"fd_debugLogEnabled\".\n- (void)fd_debugLog:(NSString *)message;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/Classes/UITableView+FDTemplateLayoutCellDebug.m",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import \"UITableView+FDTemplateLayoutCellDebug.h\"\n#import <objc/runtime.h>\n\n@implementation UITableView (FDTemplateLayoutCellDebug)\n\n- (BOOL)fd_debugLogEnabled {\n    return [objc_getAssociatedObject(self, _cmd) boolValue];\n}\n\n- (void)setFd_debugLogEnabled:(BOOL)debugLogEnabled {\n    objc_setAssociatedObject(self, @selector(fd_debugLogEnabled), @(debugLogEnabled), OBJC_ASSOCIATION_RETAIN);\n}\n\n- (void)fd_debugLog:(NSString *)message {\n    if (self.fd_debugLogEnabled) {\n        NSLog(@\"** FDTemplateLayoutCell ** %@\", message);\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell/README.md",
    "content": "# UITableView-FDTemplateLayoutCell\n<img src=\"https://cloud.githubusercontent.com/assets/219689/7244961/4209de32-e816-11e4-87bc-b161c442d348.png\" width=\"640\">\n\n## Overview\nTemplate auto layout cell for **automatically** UITableViewCell height calculating.\n\n![Demo Overview](https://github.com/forkingdog/UITableView-FDTemplateLayoutCell/blob/master/Sceenshots/screenshot2.gif)\n\n## Basic usage\n\nIf you have a **self-satisfied** cell, then all you have to do is: \n\n``` objc\n#import \"UITableView+FDTemplateLayoutCell.h\"\n\n- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath\n{\n    return [tableView fd_heightForCellWithIdentifier:@\"reuse identifer\" configuration:^(id cell) {\n        // Configure this cell with data, same as what you've done in \"-tableView:cellForRowAtIndexPath:\"\n        // Like:\n        //    cell.entity = self.feedEntities[indexPath.row];\n    }];\n}\n```\n\n## Height Caching API\n\nSince iOS8, `-tableView:heightForRowAtIndexPath:` will be called more times than we expect, we can feel these extra calculations when scrolling. So we provide another API with cache by index path:   \n\n``` objc\n- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {\n    return [tableView fd_heightForCellWithIdentifier:@\"identifer\" cacheByIndexPath:indexPath configuration:^(id cell) {\n        // configurations\n    }];\n}\n```\n\nOr, if your entity has an unique identifier, use cache by key API:\n\n``` objc\n- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {\n\tEntity *entity = self.entities[indexPath.row];\n    return [tableView fd_heightForCellWithIdentifier:@\"identifer\" cacheByKey:entity.uid configuration:^(id cell) {\n        // configurations\n    }];\n}\n```\n\n## Frame layout mode\n\n`FDTemplateLayoutCell` offers 2 modes for asking cell's height.  \n\n1. Auto layout mode using \"-systemLayoutSizeFittingSize:\"  \n2. Frame layout mode using \"-sizeThatFits:\"  \n\nGenerally, no need to care about modes, it will **automatically** choose a proper mode by whether you have set auto layout constrants on cell's content view. If you want to enforce frame layout mode, enable this property in your cell's configuration block:  \n\n``` objc\ncell.fd_enforceFrameLayout = YES;\n```\nAnd if you're using frame layout mode, you must override `-sizeThatFits:` in your customized cell and return content view's height (separator excluded)\n\n```\n- (CGSize)sizeThatFits:(CGSize)size {\n    return CGSizeMake(size.width, A+B+C+D+E+....);\n}\n```\n\n## Debug log\n\nDebug log helps to debug or inspect what is this \"FDTemplateLayoutCell\" extention doing, turning on to print logs when \"calculating\", \"precaching\" or \"hitting cache\".Default to \"NO\", log by \"NSLog\".\n\n``` objc\nself.tableView.fd_debugLogEnabled = YES;\n```\n\nIt will print like this:  \n\n``` objc\n** FDTemplateLayoutCell ** layout cell created - FDFeedCell\n** FDTemplateLayoutCell ** calculate - [0:0] 233.5\n** FDTemplateLayoutCell ** calculate - [0:1] 155.5\n** FDTemplateLayoutCell ** calculate - [0:2] 258\n** FDTemplateLayoutCell ** calculate - [0:3] 284\n** FDTemplateLayoutCell ** precached - [0:3] 284\n** FDTemplateLayoutCell ** calculate - [0:4] 278.5\n** FDTemplateLayoutCell ** precached - [0:4] 278.5\n** FDTemplateLayoutCell ** hit cache - [0:3] 284\n** FDTemplateLayoutCell ** hit cache - [0:4] 278.5\n** FDTemplateLayoutCell ** hit cache - [0:5] 156\n** FDTemplateLayoutCell ** hit cache - [0:6] 165\n```\n\n## About self-satisfied cell\n\na fully **self-satisfied** cell is constrainted by auto layout and each edge(\"top\", \"left\", \"bottom\", \"right\") has at least one layout constraint against it. It's the same concept introduced as \"self-sizing cell\" in iOS8 using auto layout.\n\nA bad one :( - missing right and bottom\n![non-self-satisfied](https://github.com/forkingdog/UITableView-FDTemplateLayoutCell/blob/master/Sceenshots/screenshot0.png)   \n\nA good one :)  \n![self-satisfied](https://github.com/forkingdog/UITableView-FDTemplateLayoutCell/blob/master/Sceenshots/screenshot1.png)   \n\n## Notes\n\nA template layout cell is created by `-dequeueReusableCellWithIdentifier:` method, it means that you MUST have registered this cell reuse identifier by one of:  \n\n- A prototype cell of UITableView in storyboard.\n- Use `-registerNib:forCellReuseIdentifier:` \n- Use `-registerClass:forCellReuseIdentifier:`\n\n## 如果你在天朝\n可以看这篇中文博客： \n[http://blog.sunnyxx.com/2015/05/17/cell-height-calculation/](http://blog.sunnyxx.com/2015/05/17/cell-height-calculation/)\n\n## Installation\n\nLatest version: **1.6**\n\n```\npod search UITableView+FDTemplateLayoutCell \n```\nIf you cannot search out the latest version, try:  \n\n```\npod setup\n```\n\n## Release Notes\n\nWe recommend to use the latest release in cocoapods.\n\n- 1.6\nfix bug in iOS 10\n\n- 1.4  \nRefactor, add \"cacheByKey\" mode, bug fixed\n\n- 1.3  \nFrame layout mode, handle cell's accessory view/type\n\n- 1.2  \nPrecache and auto cache invalidation\n\n- 1.1  \nHeight cache\n\n- 1.0  \nBasic automatically height calculation\n\n## License\nMIT\n\n\n"
  },
  {
    "path": "JetChat/Pods/UITableView+FDTemplateLayoutCell.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t1E09C004B341E59C2E6EF2E668A76518 /* UITableView+FDKeyedHeightCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 82452C3953316DA0768AA0BAF17B2594 /* UITableView+FDKeyedHeightCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t36673590C95D380C6403B236780BFC31 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E5FAAA3A51B06A67C696ED935E41340 /* Foundation.framework */; };\n\t\t3CBF43EEF83DE8194D18E099C7FC3F40 /* UITableView+FDIndexPathHeightCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C352D7B5B70A4043D58144481D92AAB /* UITableView+FDIndexPathHeightCache.m */; };\n\t\t49945F48ED36F3CF1A80461A82937029 /* UITableView+FDKeyedHeightCache.m in Sources */ = {isa = PBXBuildFile; fileRef = A5A234572B49383DB54892019DA35358 /* UITableView+FDKeyedHeightCache.m */; };\n\t\t6DB5E67073D5EC2B3198571FD2ACAB5C /* UITableView+FDIndexPathHeightCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E75BFDB8EB235D84AE79D0C5F196B0DB /* UITableView+FDIndexPathHeightCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA9866FC40D8475797539209E1B2A31C9 /* UITableView+FDTemplateLayoutCellDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 27E34899E89FFA5BDA253EA7EBCA6431 /* UITableView+FDTemplateLayoutCellDebug.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB4D47C5DC33D36F28A5A788799CD1EF3 /* UITableView+FDTemplateLayoutCellDebug.m in Sources */ = {isa = PBXBuildFile; fileRef = D7F7D93332977D41F9E7CE0659CCE4F3 /* UITableView+FDTemplateLayoutCellDebug.m */; };\n\t\tCE8464EAFE92933007BFB92179C05E0F /* UITableView+FDTemplateLayoutCell-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = F7307175311F84F3B2DADC2BDFFB1005 /* UITableView+FDTemplateLayoutCell-dummy.m */; };\n\t\tE14C8778B3CBD5CD676EF70FAE924AFA /* UITableView+FDTemplateLayoutCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 52A9A52A7A63F3F47F30FEB0E923CEAF /* UITableView+FDTemplateLayoutCell.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE48801A9C8E280C934BE36571D92D983 /* UITableView+FDTemplateLayoutCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 806B76FC2A5B40189B487760462DC49B /* UITableView+FDTemplateLayoutCell.m */; };\n\t\tF6469A1F27036B5F097C0BCA7B7B394A /* UITableView+FDTemplateLayoutCell-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F130788D63F6973346E8FC80C218AA06 /* UITableView+FDTemplateLayoutCell-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t068521301BA74AE01BBC3D107892363E /* UITableView+FDTemplateLayoutCell */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = \"UITableView+FDTemplateLayoutCell\"; path = UITableView_FDTemplateLayoutCell.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t100476275E9B228EDB05DEED197A76AC /* UITableView+FDTemplateLayoutCell-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"UITableView+FDTemplateLayoutCell-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t27E34899E89FFA5BDA253EA7EBCA6431 /* UITableView+FDTemplateLayoutCellDebug.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UITableView+FDTemplateLayoutCellDebug.h\"; path = \"Classes/UITableView+FDTemplateLayoutCellDebug.h\"; sourceTree = \"<group>\"; };\n\t\t2DC094677C8CD69ECB23037D1D0D499D /* UITableView+FDTemplateLayoutCell-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"UITableView+FDTemplateLayoutCell-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t3B587664BC6B196E21406A09D95CC203 /* UITableView+FDTemplateLayoutCell.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"UITableView+FDTemplateLayoutCell.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t4D50C7257CD7023EAE084324F901DBE4 /* UITableView+FDTemplateLayoutCell.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"UITableView+FDTemplateLayoutCell.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t52A9A52A7A63F3F47F30FEB0E923CEAF /* UITableView+FDTemplateLayoutCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UITableView+FDTemplateLayoutCell.h\"; path = \"Classes/UITableView+FDTemplateLayoutCell.h\"; sourceTree = \"<group>\"; };\n\t\t5C352D7B5B70A4043D58144481D92AAB /* UITableView+FDIndexPathHeightCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UITableView+FDIndexPathHeightCache.m\"; path = \"Classes/UITableView+FDIndexPathHeightCache.m\"; sourceTree = \"<group>\"; };\n\t\t6E5FAAA3A51B06A67C696ED935E41340 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t7814BB124FC91EB45C81F09E705006FA /* UITableView+FDTemplateLayoutCell.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = \"UITableView+FDTemplateLayoutCell.modulemap\"; sourceTree = \"<group>\"; };\n\t\t806B76FC2A5B40189B487760462DC49B /* UITableView+FDTemplateLayoutCell.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UITableView+FDTemplateLayoutCell.m\"; path = \"Classes/UITableView+FDTemplateLayoutCell.m\"; sourceTree = \"<group>\"; };\n\t\t82452C3953316DA0768AA0BAF17B2594 /* UITableView+FDKeyedHeightCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UITableView+FDKeyedHeightCache.h\"; path = \"Classes/UITableView+FDKeyedHeightCache.h\"; sourceTree = \"<group>\"; };\n\t\tA5A234572B49383DB54892019DA35358 /* UITableView+FDKeyedHeightCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UITableView+FDKeyedHeightCache.m\"; path = \"Classes/UITableView+FDKeyedHeightCache.m\"; sourceTree = \"<group>\"; };\n\t\tD7F7D93332977D41F9E7CE0659CCE4F3 /* UITableView+FDTemplateLayoutCellDebug.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UITableView+FDTemplateLayoutCellDebug.m\"; path = \"Classes/UITableView+FDTemplateLayoutCellDebug.m\"; sourceTree = \"<group>\"; };\n\t\tE75BFDB8EB235D84AE79D0C5F196B0DB /* UITableView+FDIndexPathHeightCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UITableView+FDIndexPathHeightCache.h\"; path = \"Classes/UITableView+FDIndexPathHeightCache.h\"; sourceTree = \"<group>\"; };\n\t\tF130788D63F6973346E8FC80C218AA06 /* UITableView+FDTemplateLayoutCell-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"UITableView+FDTemplateLayoutCell-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tF7307175311F84F3B2DADC2BDFFB1005 /* UITableView+FDTemplateLayoutCell-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"UITableView+FDTemplateLayoutCell-dummy.m\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tA93DD8EE5D95222C2CDC9C3A8F7DED2D /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t36673590C95D380C6403B236780BFC31 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t06CF3381C5623FFB8E280DD3F61CF33F /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7814BB124FC91EB45C81F09E705006FA /* UITableView+FDTemplateLayoutCell.modulemap */,\n\t\t\t\tF7307175311F84F3B2DADC2BDFFB1005 /* UITableView+FDTemplateLayoutCell-dummy.m */,\n\t\t\t\t100476275E9B228EDB05DEED197A76AC /* UITableView+FDTemplateLayoutCell-Info.plist */,\n\t\t\t\t2DC094677C8CD69ECB23037D1D0D499D /* UITableView+FDTemplateLayoutCell-prefix.pch */,\n\t\t\t\tF130788D63F6973346E8FC80C218AA06 /* UITableView+FDTemplateLayoutCell-umbrella.h */,\n\t\t\t\t3B587664BC6B196E21406A09D95CC203 /* UITableView+FDTemplateLayoutCell.debug.xcconfig */,\n\t\t\t\t4D50C7257CD7023EAE084324F901DBE4 /* UITableView+FDTemplateLayoutCell.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/UITableView+FDTemplateLayoutCell\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t1DB0E2E5E37A69D0D714DEAD78CB474B /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6E5FAAA3A51B06A67C696ED935E41340 /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4E7E6A26306312417BE85B6DB7307A41 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB53F512F4B0151D43F3B3E5D2FDC2678 /* Frameworks */,\n\t\t\t\tDA533AEF37E42061E1E3740E63232ACB /* Products */,\n\t\t\t\tF56C79E4E6F8B2B5795128785201D960 /* UITableView+FDTemplateLayoutCell */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB53F512F4B0151D43F3B3E5D2FDC2678 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1DB0E2E5E37A69D0D714DEAD78CB474B /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDA533AEF37E42061E1E3740E63232ACB /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t068521301BA74AE01BBC3D107892363E /* UITableView+FDTemplateLayoutCell */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF56C79E4E6F8B2B5795128785201D960 /* UITableView+FDTemplateLayoutCell */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE75BFDB8EB235D84AE79D0C5F196B0DB /* UITableView+FDIndexPathHeightCache.h */,\n\t\t\t\t5C352D7B5B70A4043D58144481D92AAB /* UITableView+FDIndexPathHeightCache.m */,\n\t\t\t\t82452C3953316DA0768AA0BAF17B2594 /* UITableView+FDKeyedHeightCache.h */,\n\t\t\t\tA5A234572B49383DB54892019DA35358 /* UITableView+FDKeyedHeightCache.m */,\n\t\t\t\t52A9A52A7A63F3F47F30FEB0E923CEAF /* UITableView+FDTemplateLayoutCell.h */,\n\t\t\t\t806B76FC2A5B40189B487760462DC49B /* UITableView+FDTemplateLayoutCell.m */,\n\t\t\t\t27E34899E89FFA5BDA253EA7EBCA6431 /* UITableView+FDTemplateLayoutCellDebug.h */,\n\t\t\t\tD7F7D93332977D41F9E7CE0659CCE4F3 /* UITableView+FDTemplateLayoutCellDebug.m */,\n\t\t\t\t06CF3381C5623FFB8E280DD3F61CF33F /* Support Files */,\n\t\t\t);\n\t\t\tname = \"UITableView+FDTemplateLayoutCell\";\n\t\t\tpath = \"UITableView+FDTemplateLayoutCell\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tB1B4A58DDBE40851EC0B667E6FE7AC95 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t6DB5E67073D5EC2B3198571FD2ACAB5C /* UITableView+FDIndexPathHeightCache.h in Headers */,\n\t\t\t\t1E09C004B341E59C2E6EF2E668A76518 /* UITableView+FDKeyedHeightCache.h in Headers */,\n\t\t\t\tE14C8778B3CBD5CD676EF70FAE924AFA /* UITableView+FDTemplateLayoutCell.h in Headers */,\n\t\t\t\tF6469A1F27036B5F097C0BCA7B7B394A /* UITableView+FDTemplateLayoutCell-umbrella.h in Headers */,\n\t\t\t\tA9866FC40D8475797539209E1B2A31C9 /* UITableView+FDTemplateLayoutCellDebug.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tA5CF12962AE63218F7BCE07569CE36DE /* UITableView+FDTemplateLayoutCell */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 1FB8745A3A96FE1E69EFA76886AC9A9F /* Build configuration list for PBXNativeTarget \"UITableView+FDTemplateLayoutCell\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tB1B4A58DDBE40851EC0B667E6FE7AC95 /* Headers */,\n\t\t\t\t2C15DE9B947A05D222094C721939D1C2 /* Sources */,\n\t\t\t\tA93DD8EE5D95222C2CDC9C3A8F7DED2D /* Frameworks */,\n\t\t\t\tC2C1F6CFE3489C83A3173E510AF21D4A /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"UITableView+FDTemplateLayoutCell\";\n\t\t\tproductName = UITableView_FDTemplateLayoutCell;\n\t\t\tproductReference = 068521301BA74AE01BBC3D107892363E /* UITableView+FDTemplateLayoutCell */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t2EA7F5E9F6238B172DAFD82B3E4F0670 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 9E7FFA1E60A4850A886DE5D7EBAA2F29 /* Build configuration list for PBXProject \"UITableView+FDTemplateLayoutCell\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 4E7E6A26306312417BE85B6DB7307A41;\n\t\t\tproductRefGroup = DA533AEF37E42061E1E3740E63232ACB /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tA5CF12962AE63218F7BCE07569CE36DE /* UITableView+FDTemplateLayoutCell */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tC2C1F6CFE3489C83A3173E510AF21D4A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t2C15DE9B947A05D222094C721939D1C2 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t3CBF43EEF83DE8194D18E099C7FC3F40 /* UITableView+FDIndexPathHeightCache.m in Sources */,\n\t\t\t\t49945F48ED36F3CF1A80461A82937029 /* UITableView+FDKeyedHeightCache.m in Sources */,\n\t\t\t\tE48801A9C8E280C934BE36571D92D983 /* UITableView+FDTemplateLayoutCell.m in Sources */,\n\t\t\t\tCE8464EAFE92933007BFB92179C05E0F /* UITableView+FDTemplateLayoutCell-dummy.m in Sources */,\n\t\t\t\tB4D47C5DC33D36F28A5A788799CD1EF3 /* UITableView+FDTemplateLayoutCellDebug.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t4EEE22928CE06EB3E69ABD876122F954 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 4D50C7257CD7023EAE084324F901DBE4 /* UITableView+FDTemplateLayoutCell.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = UITableView_FDTemplateLayoutCell;\n\t\t\t\tPRODUCT_NAME = UITableView_FDTemplateLayoutCell;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t7A064B421160F133E07EFDF298842928 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t7ED7D111F2FDBD39CD2026C3A93239C1 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tEB2F6309973EFAA2CA54B5833F3DE3FA /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 3B587664BC6B196E21406A09D95CC203 /* UITableView+FDTemplateLayoutCell.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/UITableView+FDTemplateLayoutCell/UITableView+FDTemplateLayoutCell.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = UITableView_FDTemplateLayoutCell;\n\t\t\t\tPRODUCT_NAME = UITableView_FDTemplateLayoutCell;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t1FB8745A3A96FE1E69EFA76886AC9A9F /* Build configuration list for PBXNativeTarget \"UITableView+FDTemplateLayoutCell\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tEB2F6309973EFAA2CA54B5833F3DE3FA /* Debug */,\n\t\t\t\t4EEE22928CE06EB3E69ABD876122F954 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t9E7FFA1E60A4850A886DE5D7EBAA2F29 /* Build configuration list for PBXProject \"UITableView+FDTemplateLayoutCell\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t7ED7D111F2FDBD39CD2026C3A93239C1 /* Debug */,\n\t\t\t\t7A064B421160F133E07EFDF298842928 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 2EA7F5E9F6238B172DAFD82B3E4F0670 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/UIView+FDCollapsibleConstraints/Classes/UIView+FDCollapsibleConstraints.h",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import <UIKit/UIKit.h>\n\n/// \"UIView+FDCollapsibleConstraints\" helps to implement flow-layout-like behavior\n/// in Auto Layout (with Interface Builder).\n///\n/// Normally, when a view is to be hidden (which is common in type multiplexing\n/// views or cells), some related constraints in horizontal or vertical direction\n/// should also be disabled (by setting the \"constant\" property to zero as we might\n/// want to reuse the view later) to avoid double margin.\n///\n/// Now with this extension, you could easily achieve this by specifying constraints\n/// to be set to zero when the view is \"collapsed\", as well as setting the\n/// \"fd_collapsed\" property when you set the view hidden or with empty content.\n///\n/// For UIView's with fixed height constraint, in most cases you should use it\n/// with its height constraint and top (or bottom) margin constraint connected\n/// to fd_collapsibleConstraints IBOutletCollection. For UILabel-like intrinsic\n/// content size based views, you typically don't have a height constraint, thus\n/// only need to connect its margin constraint. You'll get the label totally\n/// disappeared by setting its \"title\" to nil and \"fd_collapsed\" to YES.\n@interface UIView (FDCollapsibleConstraints)\n\n/// Assigning this property immediately disables the view's collapsible constraints'\n/// by setting their constants to zero.\n@property (nonatomic, assign) BOOL fd_collapsed;\n\n/// Specify constraints to be affected by \"fd_collapsed\" property by connecting in\n/// Interface Builder.\n@property (nonatomic, copy) IBOutletCollection(NSLayoutConstraint) NSArray *fd_collapsibleConstraints;\n\n@end\n\n@interface UIView (FDAutomaticallyCollapseByIntrinsicContentSize)\n\n/// Enable to automatically collapse constraints in \"fd_collapsibleConstraints\" when\n/// you set or indirectly set this view's \"intrinsicContentSize\" to {0, 0} or absent.\n///\n/// For example:\n///  imageView.image = nil;\n///  label.text = nil, label.text = @\"\";\n///\n/// \"NO\" by default, you may enable it by codes.\n@property (nonatomic, assign) BOOL fd_autoCollapse;\n\n/// \"IBInspectable\" property, more friendly to Interface Builder.\n/// You gonna find this attribute in \"Attribute Inspector\", toggle \"On\" to enable.\n/// Why not a \"fd_\" prefix? Xcode Attribute Inspector will clip it like a shit.\n/// You should not assgin this property directly by code, use \"fd_autoCollapse\" instead.\n@property (nonatomic, assign, getter=fd_autoCollapse) IBInspectable BOOL autoCollapse;\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UIView+FDCollapsibleConstraints/Classes/UIView+FDCollapsibleConstraints.m",
    "content": "// The MIT License (MIT)\n//\n// Copyright (c) 2015-2016 forkingdog ( https://github.com/forkingdog )\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n#import \"UIView+FDCollapsibleConstraints.h\"\n#import <objc/runtime.h>\n\n/// A stored property extension for NSLayoutConstraint's original constant.\n@implementation NSLayoutConstraint (_FDOriginalConstantStorage)\n\n- (void)setFd_originalConstant:(CGFloat)originalConstant\n{\n    objc_setAssociatedObject(self, @selector(fd_originalConstant), @(originalConstant), OBJC_ASSOCIATION_RETAIN);\n}\n\n- (CGFloat)fd_originalConstant\n{\n#if CGFLOAT_IS_DOUBLE\n    return [objc_getAssociatedObject(self, _cmd) doubleValue];\n#else\n    return [objc_getAssociatedObject(self, _cmd) floatValue];\n#endif\n}\n\n@end\n\n@implementation UIView (FDCollapsibleConstraints)\n\n#pragma mark - Hacking KVC\n\n+ (void)load\n{\n    // Swizzle setValue:forKey: to intercept assignments to `fd_collapsibleConstraints`\n    // from Interface Builder. We should not do so by overriding setvalue:forKey:\n    // as the primary class implementation would be bypassed.\n    SEL originalSelector = @selector(setValue:forKey:);\n    SEL swizzledSelector = @selector(fd_setValue:forKey:);\n\n    Class class = UIView.class;\n    Method originalMethod = class_getInstanceMethod(class, originalSelector);\n    Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);\n    \n    method_exchangeImplementations(originalMethod, swizzledMethod);\n}\n\n- (void)fd_setValue:(id)value forKey:(NSString *)key\n{\n    NSString *injectedKey = [NSString stringWithUTF8String:sel_getName(@selector(fd_collapsibleConstraints))];\n    if ([key isEqualToString:injectedKey]) {\n        // This kind of IBOutlet won't trigger property's setter, so we forward it.\n        self.fd_collapsibleConstraints = value;\n    } else {\n        // Forward the rest of KVC's to original implementation.\n        [self fd_setValue:value forKey:key];\n    }\n}\n\n#pragma mark - Dynamic Properties\n\n- (void)setFd_collapsed:(BOOL)collapsed\n{\n    [self.fd_collapsibleConstraints enumerateObjectsUsingBlock:\n     ^(NSLayoutConstraint *constraint, NSUInteger idx, BOOL *stop) {\n         if (collapsed) {\n             constraint.constant = 0;\n         } else {\n             constraint.constant = constraint.fd_originalConstant;\n         } \n     }];\n\n    objc_setAssociatedObject(self, @selector(fd_collapsed), @(collapsed), OBJC_ASSOCIATION_RETAIN);\n}\n\n- (BOOL)fd_collapsed\n{\n    return [objc_getAssociatedObject(self, _cmd) boolValue];\n}\n\n- (NSMutableArray *)fd_collapsibleConstraints\n{\n    NSMutableArray *constraints = objc_getAssociatedObject(self, _cmd);\n    if (!constraints) {\n        constraints = @[].mutableCopy;\n        objc_setAssociatedObject(self, _cmd, constraints, OBJC_ASSOCIATION_RETAIN);\n    }\n    return constraints;\n}\n\n- (void)setFd_collapsibleConstraints:(NSArray *)fd_collapsibleConstraints\n{\n    // Hook assignments to our custom `fd_collapsibleConstraints` property.\n    NSMutableArray *constraints = (NSMutableArray *)self.fd_collapsibleConstraints;\n    \n    [fd_collapsibleConstraints enumerateObjectsUsingBlock:^(NSLayoutConstraint *constraint, NSUInteger idx, BOOL *stop) {\n        // Store original constant value\n        constraint.fd_originalConstant = constraint.constant;\n        [constraints addObject:constraint];\n    }];\n}\n\n@end\n\n@implementation UIView (FDAutomaticallyCollapseByIntrinsicContentSize)\n\n#pragma mark - Hacking \"-updateConstraints\"\n\n+ (void)load\n{\n    // Swizzle to hack \"-updateConstraints\" method\n    SEL originalSelector = @selector(updateConstraints);\n    SEL swizzledSelector = @selector(fd_updateConstraints);\n    \n    Class class = UIView.class;\n    Method originalMethod = class_getInstanceMethod(class, originalSelector);\n    Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);\n    \n    method_exchangeImplementations(originalMethod, swizzledMethod);\n}\n\n- (void)fd_updateConstraints\n{\n    // Call primary method's implementation\n    [self fd_updateConstraints];\n \n    if (self.fd_autoCollapse && self.fd_collapsibleConstraints.count > 0) {\n        \n        // \"Absent\" means this view doesn't have an intrinsic content size, {-1, -1} actually.\n        const CGSize absentIntrinsicContentSize = CGSizeMake(UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric);\n        \n        // Calculated intrinsic content size\n        const CGSize contentSize = [self intrinsicContentSize];\n        \n        // When this view doesn't have one, or has no intrinsic content size after calculating,\n        // it going to be collapsed.\n        if (CGSizeEqualToSize(contentSize, absentIntrinsicContentSize) ||\n            CGSizeEqualToSize(contentSize, CGSizeZero)) {\n            self.fd_collapsed = YES;\n        } else {\n            self.fd_collapsed = NO;\n        }\n    }\n}\n\n#pragma mark - Dynamic Properties\n\n- (BOOL)fd_autoCollapse\n{\n    return [objc_getAssociatedObject(self, _cmd) boolValue];\n}\n\n- (void)setFd_autoCollapse:(BOOL)autoCollapse\n{\n    objc_setAssociatedObject(self, @selector(fd_autoCollapse), @(autoCollapse), OBJC_ASSOCIATION_RETAIN);\n}\n\n- (void)setAutoCollapse:(BOOL)collapse\n{\n    // Just forwarding\n    self.fd_autoCollapse = collapse;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/UIView+FDCollapsibleConstraints/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 forkingdog\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/UIView+FDCollapsibleConstraints/README.md",
    "content": "# UIView-FDCollapsibleConstraints\n![forkingdog](https://cloud.githubusercontent.com/assets/219689/7244961/4209de32-e816-11e4-87bc-b161c442d348.png)\n\n# Overview\n`UIView+FDCollapsibleConstraints` builds to **collapse** a view and its relevant layout constraints. \n\n## Demo 1 \nThis demo collapses the `forkingdog` image view and its bottom margin constraint.  \n\n![view demo](https://github.com/forkingdog/UIView-FDCollapsibleConstraints/blob/master/Sceenshots/screenshot0.gif)  \n\n## Demo 2\n\nThis demo collapses diffent components in cell, according to its data entity, each margin handles right as well.  \n\n![cell demo](https://github.com/forkingdog/UIView-FDCollapsibleConstraints/blob/master/Sceenshots/screenshot1.gif)\n\n# Basic usage\n\n## 1. Select constraints to collapse\nFirst, tell which constraints will be collapsed when the view collapses. We provide a `IBOutletCollection` to make it easier in Interface Builder:  \n\n```\n@property (nonatomic, copy) IBOutletCollection(NSLayoutConstraint) NSArray *fd_collapsibleConstraints;\n```  \n\nYou can assgin it by codes, but it's better to **\"connect lines\"** in Interface Builder:   \n\n![cell demo](https://github.com/forkingdog/UIView-FDCollapsibleConstraints/blob/master/Sceenshots/screenshot2.gif)\n\n## 2. Collapse a view\n\nSelected constraints will collapse:  \n\n```\nview.fd_collapsed = YES;\n```\n\nAnd recover back properly:\n\n```\nview.fd_collapsed = NO;\n```\n\n# Auto collapse\n\n\n\n\n\n\n# License\nMIT\n"
  },
  {
    "path": "JetChat/Pods/UIView+FDCollapsibleConstraints.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t1C010105DDAEBDED0903128348301D7A /* UIView+FDCollapsibleConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 969DA39AF015BA72212F9C847A40C920 /* UIView+FDCollapsibleConstraints.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t47AD5553090FFCD2CE658D3E3DEBF6E5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E7E286CA4A5F14B5DD9A04F50E0C35F /* Foundation.framework */; };\n\t\t972532C9608F31B1987A4AA7487C8598 /* UIView+FDCollapsibleConstraints.m in Sources */ = {isa = PBXBuildFile; fileRef = E5532F5D66F8DFBA9C87DBFBD3D03DBE /* UIView+FDCollapsibleConstraints.m */; };\n\t\t988C9CD86D4AA046390244E14CEB241E /* UIView+FDCollapsibleConstraints-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AC1654DFB40505EC0B615B2275AB355 /* UIView+FDCollapsibleConstraints-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB740C40417952E3870D3F9739BE95A85 /* UIView+FDCollapsibleConstraints-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 46F26C23D78D58B521829731B4FF78FB /* UIView+FDCollapsibleConstraints-dummy.m */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t36609745833675C157CB207E2D81E252 /* UIView+FDCollapsibleConstraints-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"UIView+FDCollapsibleConstraints-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t46F26C23D78D58B521829731B4FF78FB /* UIView+FDCollapsibleConstraints-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"UIView+FDCollapsibleConstraints-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t4AC1654DFB40505EC0B615B2275AB355 /* UIView+FDCollapsibleConstraints-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"UIView+FDCollapsibleConstraints-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t5384065D3B35C59943B009536B20AE94 /* UIView+FDCollapsibleConstraints.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = \"UIView+FDCollapsibleConstraints.modulemap\"; sourceTree = \"<group>\"; };\n\t\t6E7E286CA4A5F14B5DD9A04F50E0C35F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t7EF4ED1716912F813C6E4BE0C2C44C96 /* UIView+FDCollapsibleConstraints.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"UIView+FDCollapsibleConstraints.release.xcconfig\"; sourceTree = \"<group>\"; };\n\t\t8DAFC143C480F429F6084E7122AFF71F /* UIView+FDCollapsibleConstraints */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = \"UIView+FDCollapsibleConstraints\"; path = UIView_FDCollapsibleConstraints.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t969DA39AF015BA72212F9C847A40C920 /* UIView+FDCollapsibleConstraints.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIView+FDCollapsibleConstraints.h\"; path = \"Classes/UIView+FDCollapsibleConstraints.h\"; sourceTree = \"<group>\"; };\n\t\tB7FD4CEFB45302D8C100BA871F0FE618 /* UIView+FDCollapsibleConstraints.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = \"UIView+FDCollapsibleConstraints.debug.xcconfig\"; sourceTree = \"<group>\"; };\n\t\tDB504BB8244B74D2F0261A68F5F718FA /* UIView+FDCollapsibleConstraints-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"UIView+FDCollapsibleConstraints-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tE5532F5D66F8DFBA9C87DBFBD3D03DBE /* UIView+FDCollapsibleConstraints.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIView+FDCollapsibleConstraints.m\"; path = \"Classes/UIView+FDCollapsibleConstraints.m\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t7717BDBAA85A3EAE87C403283B52AC97 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t47AD5553090FFCD2CE658D3E3DEBF6E5 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t2D31B64AFA7CAE50B31E529CBC424368 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD82E421E72FD536B3A6996C9C5BD708E /* Frameworks */,\n\t\t\t\t2E2910AB20145C577898813637C3F217 /* Products */,\n\t\t\t\tE73E9CD5081BC073E14E88BB277DBCE9 /* UIView+FDCollapsibleConstraints */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t2E2910AB20145C577898813637C3F217 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8DAFC143C480F429F6084E7122AFF71F /* UIView+FDCollapsibleConstraints */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t31AB1ACBAB796D939CCA0C500A74BC8D /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6E7E286CA4A5F14B5DD9A04F50E0C35F /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD82E421E72FD536B3A6996C9C5BD708E /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t31AB1ACBAB796D939CCA0C500A74BC8D /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tE73E9CD5081BC073E14E88BB277DBCE9 /* UIView+FDCollapsibleConstraints */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t969DA39AF015BA72212F9C847A40C920 /* UIView+FDCollapsibleConstraints.h */,\n\t\t\t\tE5532F5D66F8DFBA9C87DBFBD3D03DBE /* UIView+FDCollapsibleConstraints.m */,\n\t\t\t\tFE78FC97C32F6FEF2BDE9F30E66D9464 /* Support Files */,\n\t\t\t);\n\t\t\tname = \"UIView+FDCollapsibleConstraints\";\n\t\t\tpath = \"UIView+FDCollapsibleConstraints\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tFE78FC97C32F6FEF2BDE9F30E66D9464 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t5384065D3B35C59943B009536B20AE94 /* UIView+FDCollapsibleConstraints.modulemap */,\n\t\t\t\t46F26C23D78D58B521829731B4FF78FB /* UIView+FDCollapsibleConstraints-dummy.m */,\n\t\t\t\t36609745833675C157CB207E2D81E252 /* UIView+FDCollapsibleConstraints-Info.plist */,\n\t\t\t\tDB504BB8244B74D2F0261A68F5F718FA /* UIView+FDCollapsibleConstraints-prefix.pch */,\n\t\t\t\t4AC1654DFB40505EC0B615B2275AB355 /* UIView+FDCollapsibleConstraints-umbrella.h */,\n\t\t\t\tB7FD4CEFB45302D8C100BA871F0FE618 /* UIView+FDCollapsibleConstraints.debug.xcconfig */,\n\t\t\t\t7EF4ED1716912F813C6E4BE0C2C44C96 /* UIView+FDCollapsibleConstraints.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/UIView+FDCollapsibleConstraints\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t5A1C166569A71C45E808D9E1517E782D /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t1C010105DDAEBDED0903128348301D7A /* UIView+FDCollapsibleConstraints.h in Headers */,\n\t\t\t\t988C9CD86D4AA046390244E14CEB241E /* UIView+FDCollapsibleConstraints-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tF254007166B3EB42A09DBC736355B678 /* UIView+FDCollapsibleConstraints */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 782693A7D7D8F003751D1FC794435C57 /* Build configuration list for PBXNativeTarget \"UIView+FDCollapsibleConstraints\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t5A1C166569A71C45E808D9E1517E782D /* Headers */,\n\t\t\t\t3920B9A4BF7D0AE71208BE9E746B2FAC /* Sources */,\n\t\t\t\t7717BDBAA85A3EAE87C403283B52AC97 /* Frameworks */,\n\t\t\t\t55F99CE7046FC02DB5DCE0E47B16C40A /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"UIView+FDCollapsibleConstraints\";\n\t\t\tproductName = UIView_FDCollapsibleConstraints;\n\t\t\tproductReference = 8DAFC143C480F429F6084E7122AFF71F /* UIView+FDCollapsibleConstraints */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t5800FB358287256DB968AF2A1C0FDC49 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = A1ED46756FA660FF8A0800D053BEAB59 /* Build configuration list for PBXProject \"UIView+FDCollapsibleConstraints\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 2D31B64AFA7CAE50B31E529CBC424368;\n\t\t\tproductRefGroup = 2E2910AB20145C577898813637C3F217 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tF254007166B3EB42A09DBC736355B678 /* UIView+FDCollapsibleConstraints */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t55F99CE7046FC02DB5DCE0E47B16C40A /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t3920B9A4BF7D0AE71208BE9E746B2FAC /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t972532C9608F31B1987A4AA7487C8598 /* UIView+FDCollapsibleConstraints.m in Sources */,\n\t\t\t\tB740C40417952E3870D3F9739BE95A85 /* UIView+FDCollapsibleConstraints-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t32E80501C4B1DA3FE4E7E4878C66D833 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = B7FD4CEFB45302D8C100BA871F0FE618 /* UIView+FDCollapsibleConstraints.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = UIView_FDCollapsibleConstraints;\n\t\t\t\tPRODUCT_NAME = UIView_FDCollapsibleConstraints;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t5256AA0DC59D0083CDE8726C8E8C26B6 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t654552BF04C3A1793C8250C03820F4C3 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7EF4ED1716912F813C6E4BE0C2C44C96 /* UIView+FDCollapsibleConstraints.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/UIView+FDCollapsibleConstraints/UIView+FDCollapsibleConstraints.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = UIView_FDCollapsibleConstraints;\n\t\t\t\tPRODUCT_NAME = UIView_FDCollapsibleConstraints;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t76EB699657929BE2312FC1BE51E58EB6 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t782693A7D7D8F003751D1FC794435C57 /* Build configuration list for PBXNativeTarget \"UIView+FDCollapsibleConstraints\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t32E80501C4B1DA3FE4E7E4878C66D833 /* Debug */,\n\t\t\t\t654552BF04C3A1793C8250C03820F4C3 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tA1ED46756FA660FF8A0800D053BEAB59 /* Build configuration list for PBXProject \"UIView+FDCollapsibleConstraints\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t5256AA0DC59D0083CDE8726C8E8C26B6 /* Debug */,\n\t\t\t\t76EB699657929BE2312FC1BE51E58EB6 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 5800FB358287256DB968AF2A1C0FDC49 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/LICENSE",
    "content": "Tencent is pleased to support the open source community by making WCDB available.  \n\nCopyright (C) 2017 THL A29 Limited, a Tencent company.  All rights reserved.\nIf you have downloaded a copy of the WCDB binary from Tencent, please note that \nthe WCDB binary is licensed under the BSD 3-Clause License.\n\nIf you have downloaded a copy of the WCDB source code from Tencent, please note \nthat WCDB source code is licensed under the BSD 3-Clause License, except for \nthe third-party components listed below which are subject to different license \nterms.  Your integration of WCDB into your own projects may require compliance \nwith the BSD 3-Clause License, as well as the other licenses applicable to the \nthird-party components included within WCDB.\n\nA copy of the BSD 3-Clause License is included in this file.\nOther dependencies and licenses:\n \nOpen Source Software Licensed Under the Apache License, Version 2.0: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n\n----------------------------------------------------------------------------------------\n1. Android Source Code  4.3\nCopyright (C) 2006-2011 The Android Open Source Project \n \n \nTerms of the Apache License, Version 2.0:\n---------------------------------------------------\nApache License\n\nVersion 2.0, January 2004\n\nhttp://www.apache.org/licenses/\n \nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n \n1. Definitions.\n \n“License” shall mean the terms and conditions for use, reproduction, and distribution\nas defined by Sections 1 through 9 of this document.\n \n“Licensor” shall mean the copyright owner or entity authorized by the copyright owner\nthat is granting the License.\n \n“Legal Entity” shall mean the union of the acting entity and all other entities that \ncontrol, are controlled by, or are under common control with that entity. For the \npurposes of this definition, “control” means (i) the power, direct or indirect, to \ncause the direction or management of such entity, whether by contract or otherwise, \nor (ii) ownership of fifty percent (50%) or more of the outstanding shares, or \n(iii) beneficial ownership of such entity.\n \n“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions \ngranted by this License.\n \n“Source” form shall mean the preferred form for making modifications, including but \nnot limited to software source code, documentation source, and configuration files.\n \n“Object” form shall mean any form resulting from mechanical transformation or \ntranslation of a Source form, including but not limited to compiled object code, \ngenerated documentation, and conversions to other media types.\n \n“Work” shall mean the work of authorship, whether in Source or Object form, made \navailable under the License, as indicated by a copyright notice that is included \nin or attached to the work (an example is provided in the Appendix below).\n \n“Derivative Works” shall mean any work, whether in Source or Object form, that is \nbased on (or derived from) the Work and for which the editorial revisions, \nannotations, elaborations, or other modifications represent, as a whole, an \noriginal work of authorship. For the purposes of this License, Derivative Works \nshall not include works that remain separable from, or merely link (or bind by \nname) to the interfaces of, the Work and Derivative Works thereof.\n \n“Contribution” shall mean any work of authorship, including the original version \nof the Work and any modifications or additions to that Work or Derivative Works \nthereof, that is intentionally submitted to Licensor for inclusion in the Work \nby the copyright owner or by an individual or Legal Entity authorized to submit \non behalf of the copyright owner. For the purposes of this definition, “submitted” \nmeans any form of electronic, verbal, or written communication sent to the \nLicensor or its representatives, including but not limited to communication on \nelectronic mailing lists, source code control systems, and issue tracking systems \nthat are managed by, or on behalf of, the Licensor for the purpose of discussing \nand improving the Work, but excluding communication that is conspicuously marked \nor otherwise designated in writing by the copyright owner as “Not a Contribution.”\n \n“Contributor” shall mean Licensor and any individual or Legal Entity on behalf \nof whom a Contribution has been received by Licensor and subsequently \nincorporated within the Work.\n \n2. Grant of Copyright License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable copyright license to reproduce, prepare \nDerivative Works of, publicly display, publicly perform, sublicense, and distribute \nthe Work and such Derivative Works in Source or Object form.\n \n3. Grant of Patent License. Subject to the terms and conditions of this License, \neach Contributor hereby grants to You a perpetual, worldwide, non-exclusive, \nno-charge, royalty-free, irrevocable (except as stated in this section) patent \nlicense to make, have made, use, offer to sell, sell, import, and otherwise transfer \nthe Work, where such license applies only to those patent claims licensable by such \nContributor that are necessarily infringed by their Contribution(s) alone or by \ncombination of their Contribution(s) with the Work to which such Contribution(s) was \nsubmitted. If You institute patent litigation against any entity (including a \ncross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution \nincorporated within the Work constitutes direct or contributory patent infringement, \nthen any patent licenses granted to You under this License for that Work shall \nterminate as of the date such litigation is filed.\n \n4. Redistribution. You may reproduce and distribute copies of the Work or Derivative \nWorks thereof in any medium, with or without modifications, and in Source or Object \nform, provided that You meet the following conditions:\n \na) You must give any other recipients of the Work or Derivative Works a copy of this \nLicense; and\n \nb) You must cause any modified files to carry prominent notices stating that You \nchanged the files; and\n \nc) You must retain, in the Source form of any Derivative Works that You distribute, \nall copyright, patent, trademark, and attribution notices from the Source form of \nthe Work, excluding those notices that do not pertain to any part of the Derivative \nWorks; and\n \nd) If the Work includes a “NOTICE” text file as part of its distribution, then any \nDerivative Works that You distribute must include a readable copy of the attribution \nnotices contained within such NOTICE file, excluding those notices that do not pertain \nto any part of the Derivative Works, in at least one of the following places: within \na NOTICE text file distributed as part of the Derivative Works; within the Source \nform or documentation, if provided along with the Derivative Works; or, within a \ndisplay generated by the Derivative Works, if and wherever such third-party notices \nnormally appear. The contents of the NOTICE file are for informational purposes only \nand do not modify the License. You may add Your own attribution notices within \nDerivative Works that You distribute, alongside or as an addendum to the NOTICE text \nfrom the Work, provided that such additional attribution notices cannot be construed \nas modifying the License. \n \nYou may add Your own copyright statement to Your modifications and may provide \nadditional or different license terms and conditions for use, reproduction, or \ndistribution of Your modifications, or for any such Derivative Works as a whole, \nprovided Your use, reproduction, and distribution of the Work otherwise complies with \nthe conditions stated in this License. \n \n5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution \nintentionally submitted for inclusion in the Work by You to the Licensor shall be under \nthe terms and conditions of this License, without any additional terms or conditions. \nNotwithstanding the above, nothing herein shall supersede or modify the terms of any \nseparate license agreement you may have executed with Licensor regarding such \nContributions.\n \n6. Trademarks. This License does not grant permission to use the trade names, trademarks, \nservice marks, or product names of the Licensor, except as required for reasonable and \ncustomary use in describing the origin of the Work and reproducing the content of the \nNOTICE file.\n \n7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, \nLicensor provides the Work (and each Contributor provides its Contributions) on an \n“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, \nincluding, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, \nMERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for \ndetermining the appropriateness of using or redistributing the Work and assume any risks \nassociated with Your exercise of permissions under this License.\n \n8. Limitation of Liability. In no event and under no legal theory, whether in tort \n(including negligence), contract, or otherwise, unless required by applicable law (such \nas deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor \nbe liable to You for damages, including any direct, indirect, special, incidental, or \nconsequential damages of any character arising as a result of this License or out of the \nuse or inability to use the Work (including but not limited to damages for loss of \ngoodwill, work stoppage, computer failure or malfunction, or any and all other commercial \ndamages or losses), even if such Contributor has been advised of the possibility of such \ndamages.\n\n9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative \nWorks thereof, You may choose to offer, and charge a fee for, acceptance of support, \nwarranty, indemnity, or other liability obligations and/or rights consistent with this \nLicense. However, in accepting such obligations, You may act only on Your own behalf and \non Your sole responsibility, not on behalf of any other Contributor, and only if You agree \nto indemnify, defend, and hold each Contributor harmless for any liability incurred by, or \nclaims asserted against, such Contributor by reason of your accepting any such warranty or \nadditional liability.\n \nEND OF TERMS AND CONDITIONS\n \nAPPENDIX: How to apply the Apache License to your work\nTo apply the Apache License to your work, attach the following boilerplate notice, with the \nfields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't \ninclude the brackets!) The text should be enclosed in the appropriate comment syntax for \nthe file format. We also recommend that a file or class name and description of purpose be \nincluded on the same \"printed page\" as the copyright notice for easier identification within \nthird-party archives.\n \nCopyright [yyyy] [name of copyright owner]\n \nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n \n \n \nOpen Source Software Licensed Under Public Domain: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLite  3.11.0\n \n \n \nOpen Source Software Licensed Under the OpenSSL License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. OpenSSL  1.0.2j\nCopyright (c) 1998-2016 The OpenSSL Project.\nAll rights reserved.\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \n \n \nTerms of the OpenSSL License:\n---------------------------------------------------\nLICENSE ISSUES:\n--------------------------------------------------------------------\n \nThe OpenSSL toolkit stays under a dual license, i.e. both the conditions of the \nOpenSSL License and the original SSLeay license apply to the toolkit.\nSee below for the actual license texts.\n \nOpenSSL License:\n--------------------------------------------------------------------\nCopyright (c) 1998-2016 The OpenSSL Project.  All rights reserved.\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n \n1. Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n \n2. Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n \n3. All advertising materials mentioning features or use of this software must \ndisplay the following acknowledgment:\n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit. (http://www.openssl.org/)\"\n \n4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to endorse or \npromote products derived from this software without prior written permission. For \nwritten permission, please contact openssl-core@openssl.org.\n \n5. Products derived from this software may not be called \"OpenSSL\" nor may \"OpenSSL\" \nappear in their names without prior written permission of the OpenSSL Project.\n \n6. Redistributions of any form whatsoever must retain the following acknowledgment: \n\"This product includes software developed by the OpenSSL Project for use in the \nOpenSSL Toolkit (http://www.openssl.org/)\"\n \nTHIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR \nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF \nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT \nSHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, \nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE. \n====================================================================\n* This product includes cryptographic software written by Eric Young (eay@cryptsoft.com).  \nThis product includes software written by Tim Hudson (tjh@cryptsoft.com).\n \n \nOriginal SSLeay License:\n--------------------------------------------------------------------\nCopyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\nAll rights reserved.\n \nThis package is an SSL implementation written by Eric Young (eay@cryptsoft.com).\nThe implementation was written so as to conform with Netscapes SSL.\n \nThis library is free for commercial and non-commercial use as long as the following \nconditions are aheared to. The following conditions apply to all code found in this \ndistribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. \nThe SSL documentation included with this distribution is covered by the same copyright \nterms except that the holder is Tim Hudson (tjh@cryptsoft.com). \n \nCopyright remains Eric Young's, and as such any Copyright notices in the code are not \nto be removed.  If this package is used in a product, Eric Young should be given \nattribution as the author of the parts of the library used. This can be in the form \nof a textual message at program startup or in documentation (online or textual) \nprovided with the package. \n  \nRedistribution and use in source and binary forms, with or without modification, are \npermitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the copyright notice, this list of \nconditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list \nof conditions and the following disclaimer in the documentation and/or other materials \nprovided with the distribution.\n\n3. All advertising materials mentioning features or use of this software must display \nthe following acknowledgement:\" This product includes cryptographic software written \nby Eric Young (eay@cryptsoft.com)\" The word 'cryptographic' can be left out if the \nrouines from the library being used are not cryptographic related :-).\n\n4. If you include any Windows specific code (or a derivative thereof) from the apps \ndirectory (application code) you must include an acknowledgement: \"This product includes \nsoftware written by Tim Hudson (tjh@cryptsoft.com)\"\n \nTHIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, \nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR \nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE \nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, \nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH \nDAMAGE. \n  \nThe licence and distribution terms for any publically available version or derivative of \nthis code cannot be changed.  i.e. this code cannot simply be copied and put under another \ndistribution licence [including the GNU Public Licence.]\n \n \n \nOpen Source Software Licensed Under the ICU License: \n----------------------------------------------------------------------------------------\n1. ICU4C  50.1\nCopyright (c) 1995-2012 International Business Machines Corporation and others\nAll rights reserved.\n \n \nTerms of the ICU License:\n--------------------------------------------------------------------\nICU License - ICU 1.8.1 and later\n \nCOPYRIGHT AND PERMISSION NOTICE\n \nCopyright (c) 1995-2012 International Business Machines Corporation and others\n \nAll rights reserved.\n \nPermission is hereby granted, free of charge, to any person obtaining a copy of \nthis software and associated documentation files (the \"Software\"), to deal in the \nSoftware without restriction, including without limitation the rights to use, copy, \nmodify, merge, publish, distribute, and/or sell copies of the Software, and to permit \npersons to whom the Software is furnished to do so, provided that the above copyright \nnotice(s) and this permission notice appear in all copies of the Software and that both \nthe above copyright notice(s) and this permission notice appear in supporting \ndocumentation.\n \nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, \nINCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR \nPURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER \nOR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR \nCONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR \nPROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING \nOUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n \nExcept as contained in this notice, the name of a copyright holder shall not be used in \nadvertising or otherwise to promote the sale, use or other dealings in this Software \nwithout prior written authorization of the copyright holder.\n \nAll trademarks and registered trademarks mentioned herein are the property of their \nrespective owners.\n \n \nOpen Source Software Licensed Under the BSD 3-Clause License: \nThe below software in this distribution may have been modified by THL A29 Limited \n(“Tencent Modifications”). \nAll Tencent Modifications are Copyright (C) 2017 THL A29 Limited.\n----------------------------------------------------------------------------------------\n1. SQLCipher  3.4.0\nCopyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n \n \n \nTerms of the BSD 3-Clause License:\n--------------------------------------------------------------------\n \nRedistribution and use in source and binary forms, with or without modification, \nare permitted provided that the following conditions are met:\n\nl  Redistributions of source code must retain the above copyright notice, this list \nof conditions and the following disclaimer.\n\nl  Redistributions in binary form must reproduce the above copyright notice, this \nlist of conditions and the following disclaimer in the documentation and/or other \nmaterials provided with the distribution.\n\nl  Neither the name of [copyright holder] nor the names of its contributors may be \nused to endorse or promote products derived from this software without specific \nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \nIN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \nNOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \nWHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \nPOSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/README.md",
    "content": "# WCDB\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/wcdb/pulls)\n[![Release Version](https://img.shields.io/badge/release-1.0.5-brightgreen.svg)](https://github.com/Tencent/wcdb/releases)\n[![WeChat Approved iOS](https://img.shields.io/badge/Wechat_Approved_iOS-1.0.5-brightgreen.svg)](https://github.com/Tencent/wcdb/blob/master/README.md#wcdb-for-iosmacos)\n[![WeChat Approved Android](https://img.shields.io/badge/Wechat_Approved_Android-1.0.5-brightgreen.svg)](https://github.com/Tencent/wcdb/blob/master/README.md#wcdb-for-android)\n[![Platform](https://img.shields.io/badge/Platform-%20iOS%20%7C%20macOS%20%7C%20Android-brightgreen.svg)](https://github.com/Tencent/wcdb/wiki)\n\n中文版本请参看[这里][wcdb-wiki]\n\nWCDB is an **efficient**, **complete**, **easy-to-use** mobile database framework used in the WeChat application. It's currently available on iOS, macOS and Android.\n\n# WCDB for iOS/macOS\n\n## Features\n\n* **Easy-to-use**. Through WCDB, you can get objects from database in one line code. \n\n  * **WINQ** (WCDB language integrated query): WINQ is a native data querying capability which frees developers from writing glue code to concatenate SQL query strings.\n\n  * **ORM** (Object Relational Mapping): WCDB provides a flexible, easy-to-use ORM for creating tables, indices and constraints, as well as CRUD through ObjC objects.\n\n    ```objective-c\n    [database getObjectsOfClass:WCTSampleConvenient.class\n                      fromTable:tableName\n                          where:WCTSampleConvenient.intValue>=10\n                          limit:20];\n    ```\n\n* **Efficient**. Through the framework layer and sqlcipher source optimization, WCDB have more efficient performance.\n\n  * **Multi-threaded concurrency**: WCDB supports concurrent read-read and read-write access via connection pooling.\n  * **Batch Write Performance Test**.\n    ![](https://raw.githubusercontent.com/wiki/Tencent/wcdb/assets/benchmark/baseline_batch_write.png)\n    For more benchmark data, please refer to [our benchmark][Benchmark-iOS].\n\n* **Complete**.\n\n  * **Encryption Support**: WCDB supports database encryption via [SQLCipher][sqlcipher].\n  * **Corruption recovery**: WCDB provides a built-in repair kit for database corruption recovery.\n  * **Anti-injection**: WCDB provides a built-in protection from SQL injection.\n\n## Getting Started\n\n### Prerequisites\n\n* Apps using WCDB can target: iOS 7 or later, macOS 10.9 or later.\n* Xcode 8.0 or later required.\n* Objective-C++ required.\n\n### Installation\n\n* **Via Cocoapods:**\n  1. Install [CocoaPods.](https://guides.cocoapods.org/using/getting-started.html)\n  2. Run `pod repo update` to make CocoaPods aware of the latest available WCDB versions.\n  3. In your Podfile, add `pod 'WCDB'` to your app target.\n  4. From the command line, run `pod install`.\n  5. Use the `.xcworkspace` file generated by CocoaPods to work on your project.\n  6. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  7. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n* **Via Carthage:** \n  1. Install [Carthage][install-carthage].\n  2. Add `github \"Tencent/WCDB\"` to your Cartfile.\n  3. Run `carthage update`.\n  4. Drag `WCDB.framework` from the appropriate platform directory in `Carthage/Build/` to the `Linked Binary and Libraries` section of your Xcode project’s `Build Phases` settings.\n  5. On your application targets' `Build Phases` settings tab, click the \"+\" icon and choose `New Run Script Phase`. Create a Run Script with  `carthage copy-frameworks` and add the paths to the frameworks under `Input Files`: `$(SRCROOT)/Carthage/Build/iOS/WCDB.framework` or `$(SRCROOT)/Carthage/Build/Mac/WCDB.framework`.\n  6. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  7. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n* **Via Dynamic Framework**: \n  **Note that Dynamic frameworks are not compatible with iOS 7. See “Static Framework” for iOS 7 support.**\n  1. Getting source code from git repository and update the submodule of sqlcipher.\n     - `git clone https://github.com/Tencent/wcdb.git`\n     - `cd wcdb`\n     - `git submodule update --init sqlcipher ` \n  2. Drag `WCDB.xcodeproj` in `wcdb/apple/` into your project.\n  3. Add `WCDB.framework` to the `Enbedded Binaries` section of your Xcode project's `General settings`. **Note that there are two frameworks here and the dynamic one should be chosen. You can check it at `Build Phases`->`Target Dependencies`. The right one is `WCDB` while `WCDB iOS Static is used for static lib.**\n  4. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  5. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n* **Via Static Framework:**\n  1. Getting source code from git repository and update the submodule of sqlcipher.\n     - `git clone https://github.com/Tencent/wcdb.git`\n     - `cd wcdb`\n     - `git submodule update --init sqlcipher ` \n  2. Drag `WCDB.xcodeproj` in `wcdb/apple/` into your project.\n  3. Add `WCDB iOS Static` to the `Target Dependencies` section of your Xcode project's `Build Phases` settings.\n  4. Add `WCDB.framework`， `libz.tbd` to the `Linked Binary and Libraries` section of your Xcode project's `Build Phases` settings. Note that there are two `WCDB.framework`, you should choose the one from `WCDB iOS Static` target.\n  5. Add `-all_load` and `-ObjC` to the `Other Linker Flags` section of your Xcode project's `Build Settings`.\n  6. Add `#import <WCDB/WCDB.h>` at the top of your Objective-C++ source files and start your WCDB journey.\n  7. **Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension `.m` to `.mm`.**\n\n## Tutorials\n\nTutorials can be found [here][iOS-tutorial].\n\n## Documentations\n\n* Documentations can be found on [our Wiki][wcdb-wiki].\n* API references for iOS/macOS can be found [here][wcdb-docs-ios].\n* Performance data can be found on [our benchmark][Benchmark-iOS].\n\n# WCDB for Android\n\n## Features\n\n* Database encryption via [SQLCipher][sqlcipher].\n* ORM/persistence solution via [Room][room] from Android Architecture Components.\n* Concurrent access via connection pooling from modern Android framework.\n* Repair toolkit for database corruption recovery.\n* Database backup and recovery utility optimized for small backup size.\n* Log redirection and various tracing facilities.\n* API 14 (Android 4.0) and above are supported.\n\n## Getting Started\n\nTo include WCDB to your project, choose either way: import via Maven or via AAR package. \n\n### Import via Maven\n\nTo import WCDB via Maven repositories, add the following lines to `build.gradle` on your\napp module: \n\n```gradle\ndependencies {\n    compile 'com.tencent.wcdb:wcdb-android:1.0.8'\n    // Replace \"1.0.8\" to any available version.\n}\n```\n\nThis will cause Gradle to download AAR package from JCenter while building your application.\n\nIf you want to use Room persistence library, you need to add the Google Maven repository to\n`build.gradle` to your **root project**.\n\n```gradle\nallprojects {\n    repositories {\n        jcenter()\n        google()    // Add this line\n    }\n}\n```\n\nAlso add dependencies to module `build.gradle`.\n\n```gradle\ndependencies {\n    compile 'com.tencent.wcdb:room:1.0.8'\n    // Replace \"1.0.8\" to any available version.\n\n    annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'\n    // Don't forget to include Room annotation compiler from Google.\n}\n```\n\n### Import Prebuilt AAR Package\n\n    1. **Download AAR package from release page.**\n    2. **Import the AAR as new module.** In Android Studio, select `File -> New -> New Module...` menu and choose `\"Import JAR/AAR Package\"`.\n    3. **Add a dependency on the new module.** This can be done using `File -> Project Structure...` in Android Studio, or by adding following code to application's `build.gradle`:\n```gradle\ndependencies {\n    // Change \"wcdb\" to the actual module name specified in step 2.\n    compile project(':wcdb')\n}\n```\n\n### Migrate from Plain-text SQLite Databases\n\nWCDB has interfaces very similar to Android SQLite Database APIs. To migrate you application from\nAOSP API, change import path from `android.database.*` to `com.tencent.wcdb.*`, and \n`android.database.sqlite.*` to `com.tencent.wcdb.database.*`. After import path update, \nyour application links to WCDB instead of AOSP API.\n\nTo open or create an encrypted database, use with-password versions of \n`SQLiteDatabase.openOrCreateDatabase()`, `SQLiteOpenHelper.getWritableDatabase()`, \nor `Context.openOrCreateDatabase()`.\n\n*Note: WCDB uses `byte[]` for password instead of `String` in SQLCipher Android Binding.*\n\n```java\nString password = \"MyPassword\";\nSQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(\"/path/to/database\", password.getBytes(), \n        null, null);\n```\n\nSee `sample-encryptdb` for sample for transferring data between plain-text and encrypted\ndatabases.\n\n### Use WCDB with Room\n\nTo use WCDB with Room library, follow the [Room instructions][room]. The only code to change\nis specifying `WCDBOpenHelperFactory` when getting instance of the database.\n\n```java\nSQLiteCipherSpec cipherSpec = new SQLiteCipherSpec()\n        .setPageSize(4096)\n        .setKDFIteration(64000);\n\nWCDBOpenHelperFactory factory = new WCDBOpenHelperFactory()\n        .passphrase(\"passphrase\".getBytes())  // passphrase to the database, remove this line for plain-text\n        .cipherSpec(cipherSpec)               // cipher to use, remove for default settings\n        .writeAheadLoggingEnabled(true)       // enable WAL mode, remove if not needed\n        .asyncCheckpointEnabled(true);        // enable asynchronous checkpoint, remove if not needed\n\nAppDatabase db = Room.databaseBuilder(this, AppDatabase.class, \"app-db\")\n                .allowMainThreadQueries()\n                .openHelperFactory(factory)   // specify WCDBOpenHelperFactory when opening database\n                .build();\n```\n\nSee `sample-persistence` for samples using Room library with WCDB.\nSee `sample-room-with-a-view` for samples using Room library with WCDB and other architecture components from Google.\n\n> `sample-room-with-a-view` comes from Google's CodeLabs with modification of just a few rows. Search for *\\[WCDB\\]* keyword for the modification.\n>\n> See [here][room-codelabs] for the original tutorial.\n\n### Corruption Recovery\n\nSee `sample-repairdb` for instructions how to recover corrupted databases using `RepairKit`.\n\n### Redirect Log Output\n\nBy default, WCDB prints its log message to system logcat. You may want to change this\nbehavior in order to, for example, save logs for troubleshooting. WCDB can redirect\nall of its log outputs to user-defined routine using `Log.setLogger(LogCallback)`\nmethod.\n\n## Build from Sources\n\n### Build WCDB Android with Prebuilt Dependencies\n\nWCDB itself can be built apart from its dependencies using Gradle or Android Studio. \nTo build WCDB Android library, run Gradle on `android` directory:\n\n```bash\n$ cd android\n$ ./gradlew build\n```\n\nBuilding WCDB requires Android NDK installed. If Gradle failed to find your SDK and/or \nNDK, you may need to create a file named `local.properties` on the `android` directory \nwith content:\n\n```\nsdk.dir=path/to/sdk\nndk.dir=path/to/ndk\n```\n\nAndroid Studio will do this for you when the project is imported.\n\n### Build Dependencies from Sources\n\nWCDB depends on OpenSSL crypto library and SQLCipher. You can rebuild all dependencies\nif you wish. In this case, a working C compiler on the host system, Perl 5, Tcl and a \nbash environment is needed to be installed on your system.\n\nTo build dependencies, checkout all submodules, set `ANDROID_NDK_ROOT` environment \nvariable to your NDK path, then run `build-depends-android.sh`:\n\n```bash\n$ export ANDROID_NDK_ROOT=/path/to/ndk\n$ ./build-depends-android.sh\n```\n\nThis will build OpenSSL crypto library and generate SQLCipher amalgamation sources\nand place them to proper locations suitable for WCDB library building.\n\n## Documentations\n\n* Documentations can be found on [our Wiki][wcdb-wiki].\n* API references for Android can be found [here][wcdb-docs-android].\n\n## Contributing\n\nIf you are interested in contributing, check out the [CONTRIBUTING.md], also join our [Tencent OpenSource Plan](https://opensource.tencent.com/contribution).\n\n[install-carthage]: https://github.com/Carthage/Carthage#installing-carthage\n[wcdb-wiki]: https://github.com/Tencent/wcdb/wiki\n[wcdb-docs-ios]: https://tencent.github.io/wcdb/references/ios/index.html\n[wcdb-docs-android]: https://tencent.github.io/wcdb/references/android/index.html\n[sqlcipher]: https://github.com/sqlcipher/sqlcipher\n[room]: https://developer.android.com/topic/libraries/architecture/room\n[room-codelabs]: https://codelabs.developers.google.com/codelabs/android-room-with-a-view\n[iOS-tutorial]: https://github.com/Tencent/wcdb/wiki/iOS-macOS-Tutorial\n[Benchmark-iOS]: https://github.com/Tencent/wcdb/wiki/WCDB-iOS-benchmark\n\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Column.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct Column: Describable {\n    public private(set) var description: String\n\n    public static let all: Column = Column(named: \"*\")\n    public static let rowid: Column = Column(named: \"rowid\")\n\n    public init(named name: String) {\n        description = name\n    }\n\n    public func `in`(table: String) -> Column {\n        return Column(named: \"\\(table).\\(description)\")\n    }\n}\n\nextension Column: ColumnConvertible, ExpressionOperable {\n    public func asColumn() -> Column {\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/ColumnDef.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class ColumnDef: Describable {\n    public private(set) var description: String\n\n    public init(with columnConvertible: ColumnConvertible, and optionalType: ColumnType? = nil) {\n        description = columnConvertible.asColumn().description\n        if let type = optionalType {\n            description.append(\" \\(type.description)\")\n        }\n    }\n\n    @discardableResult\n    public func makePrimary(orderBy term: OrderTerm? = nil,\n                            isAutoIncrement: Bool = false,\n                            onConflict conflict: Conflict? = nil) -> ColumnDef {\n        description.append(\" PRIMARY KEY\")\n        if term != nil {\n            description.append(\" \\(term!.description)\")\n        }\n        if isAutoIncrement {\n            description.append(\" AUTOINCREMENT\")\n        }\n        if conflict != nil {\n            description.append(\" ON CONFLICT \\(conflict!.description)\")\n        }\n        return self\n    }\n\n    public enum DefaultType: Describable {\n        case null\n        case int32(Int32)\n        case int64(Int64)\n        case bool(Bool)\n        case text(String)\n        case float(Double)\n        case BLOB(Data)\n        case expression(Expression)\n        case currentTime\n        case currentDate\n        case currentTimestamp\n\n        public var description: String {\n            switch self {\n            case .null:\n                return \"NULL\"\n            case .int32(let value):\n                return LiteralValue(value).description\n            case .int64(let value):\n                return LiteralValue(value).description\n            case .bool(let value):\n                return LiteralValue(value).description\n            case .text(let value):\n                return LiteralValue(value).description\n            case .float(let value):\n                return LiteralValue(value).description\n            case .BLOB(let value):\n                return LiteralValue(value).description\n            case .expression(let value):\n                return value.description\n            case .currentDate:\n                return \"CURRENT_DATE\"\n            case .currentTime:\n                return \"CURRENT_TIME\"\n            case .currentTimestamp:\n                return \"CURRENT_TIMESTAMP\"\n            }\n        }\n    }\n\n    @discardableResult\n    public func makeDefault(to defaultValue: DefaultType) -> ColumnDef {\n        description.append(\" DEFAULT \\(defaultValue.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func makeNotNull() -> ColumnDef {\n        description.append(\" NOT NULL\")\n        return self\n    }\n\n    @discardableResult\n    public func makeUnique() -> ColumnDef {\n        description.append(\" UNIQUE\")\n        return self\n    }\n\n    @discardableResult\n    public func makeForeignKey(_ foreignKey: ForeignKey) -> ColumnDef {\n        description.append(\" \\(foreignKey.description)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/ColumnIndex.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct ColumnIndex: Describable {\n    public private(set) var description: String\n\n    public init(with columnConvertible: ColumnConvertible, orderBy term: OrderTerm? = nil) {\n        description = columnConvertible.asColumn().description\n        if let wrappedTerm = term {\n            description.append(\" \\(wrappedTerm.description)\")\n        }\n    }\n\n    public init(with expressionConvertible: ExpressionConvertible, orderBy term: OrderTerm? = nil) {\n        description = expressionConvertible.asExpression().description\n        if let wrappedTerm = term {\n            description.append(\" \\(wrappedTerm.description)\")\n        }\n    }\n}\n\nextension ColumnIndex: ColumnIndexConvertible {\n    public func asIndex() -> ColumnIndex {\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/ColumnResult.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class ColumnResult: Describable {\n    public private(set) var description: String\n\n    public init(with expressionConvertible: ExpressionConvertible) {\n        description = expressionConvertible.asExpression().description\n    }\n\n    @discardableResult\n    public func `as`(_ alias: String) -> ColumnResult {\n        description.append(\" AS \" + alias)\n        return self\n    }\n}\n\nextension ColumnResult: ColumnResultConvertible {\n    public func asColumnResult() -> ColumnResult {\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/ColumnType.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic enum ColumnType: Describable {\n    case integer32\n    case integer64\n    case text\n    case float\n    case BLOB\n    case null\n\n    public var description: String {\n        switch self {\n        case .integer32:\n            fallthrough\n        case .integer64:\n            return \"INTEGER\"\n        case .float:\n            return \"REAL\"\n        case .text:\n            return \"TEXT\"\n        case .BLOB:\n            return \"BLOB\"\n        case .null:\n            return \"NULL\"\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Conflict.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic enum Conflict: Describable {\n    case rollback\n    case abort\n    case fail\n    case ignore\n    case replace\n\n    public var description: String {\n        switch self {\n        case .rollback:\n            return \"ROLLBACK\"\n        case .abort:\n            return \"ABORT\"\n        case .fail:\n            return \"FAIL\"\n        case .ignore:\n            return \"IGNORE\"\n        case .replace:\n            return \"REPLACE\"\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Convertible.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol OrderConvertible {\n    func asOrder() -> Order\n}\n\npublic protocol SpecificOrderConvertible: OrderConvertible {\n    func asOrder(by term: OrderTerm?) -> Order\n}\n\nextension SpecificOrderConvertible {\n    public func asOrder() -> Order {\n        return asOrder(by: nil)\n    }\n}\n\npublic protocol SpecificColumnDefConvertible {\n    func asDef(with columnType: ColumnType?) -> ColumnDef\n}\n\npublic protocol ColumnIndexConvertible {\n    func asIndex() -> ColumnIndex\n}\n\npublic protocol SpecificColumnIndexConvertible: ColumnIndexConvertible {\n    func asIndex(orderBy term: OrderTerm?) -> ColumnIndex\n}\n\nextension SpecificColumnIndexConvertible {\n    public func asIndex() -> ColumnIndex {\n        return asIndex(orderBy: nil)\n    }\n}\n\npublic protocol ColumnResultConvertible {\n    func asColumnResult() -> ColumnResult\n}\n\npublic protocol TableOrSubqueryConvertible {\n    func asTableOrSubquery() -> Subquery\n}\n\npublic protocol ExpressionConvertible: ColumnResultConvertible, SpecificOrderConvertible {\n    func asExpression() -> Expression\n}\n\nextension ExpressionConvertible {\n    public func asColumnResult() -> ColumnResult {\n        return ColumnResult(with: asExpression())\n    }\n    public func asOrder(by term: OrderTerm?) -> Order {\n        return Order(with: asExpression(), by: term)\n    }\n}\n\npublic protocol ColumnConvertible: ExpressionConvertible, SpecificColumnIndexConvertible, SpecificColumnDefConvertible {\n    func asColumn() -> Column\n    func `in`(table: String) -> Column\n}\n\nextension ColumnConvertible {\n    public func asExpression() -> Expression {\n        return Expression(with: self)\n    }\n\n    public func asIndex(orderBy term: OrderTerm?) -> ColumnIndex {\n        return ColumnIndex(with: self, orderBy: term)\n    }\n\n    public func asDef(with columnType: ColumnType? = nil) -> ColumnDef {\n        return ColumnDef(with: self, and: columnType)\n    }\n\n    public func `in`(table: String) -> Column {\n        return asColumn().in(table: table)\n    }\n}\n\npublic protocol LiteralValueConvertible: ExpressionConvertible {\n    func asLiteralValue() -> LiteralValue\n}\n\nextension LiteralValueConvertible {\n    public func asExpression() -> Expression {\n        return Expression(with: self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Describable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n//TODO: Refactor: change all winq classes into structs\npublic typealias Describable = CustomStringConvertible\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Expression.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct Expression: Describable {\n    public private(set) var description: String\n\n    public static let bindParameter = Expression(withRaw: \"?\")\n\n    public init(with columnConvertible: ColumnConvertible) {\n        description = columnConvertible.asColumn().description\n    }\n\n    public init(with literalValueConvertible: LiteralValueConvertible) {\n        description = literalValueConvertible.asLiteralValue().description\n    }\n\n    public init(with statementSelect: StatementSelect) {\n        description = statementSelect.description\n    }\n\n    init(withRaw raw: String) {\n        description = raw\n    }\n}\n\nextension Expression: ExpressibleByNilLiteral {\n    public init(nilLiteral value: ()) {\n        self.init(with: LiteralValue(value))\n    }\n}\nextension Expression: ExpressibleByBooleanLiteral {\n    public init(booleanLiteral value: Bool) {\n        self.init(with: LiteralValue(value))\n    }\n}\nextension Expression: ExpressibleByIntegerLiteral {\n    public init(integerLiteral value: Int) {\n        self.init(with: LiteralValue(value))\n    }\n}\nextension Expression: ExpressibleByFloatLiteral {\n    public init(floatLiteral value: Double) {\n        self.init(with: LiteralValue(value))\n    }\n}\nextension Expression: ExpressibleByStringLiteral {\n    public init(stringLiteral value: String) {\n        self.init(with: LiteralValue(value))\n    }\n}\n\nextension Expression: ExpressionOperable {\n    public static func exists(_ statementSelect: StatementSelect) -> Expression {\n        return Expression.operate(prefix: \"EXISTS \", operand: statementSelect)\n    }\n    public static func notExists(_ statementSelect: StatementSelect) -> Expression {\n        return Expression.operate(prefix: \"NOT EXISTS \", operand: statementSelect)\n    }\n\n    public static func combine(_ expressionConvertibleList: ExpressionConvertible...) -> Expression {\n        return combine(expressionConvertibleList)\n    }\n    public static func combine(_ expressionConvertibleList: [ExpressionConvertible]) -> Expression {\n        return Expression(withRaw: \"(\\(expressionConvertibleList.joined()))\")\n    }\n\n    //Function\n    public static func function(named name: String,\n                                _ expressions: ExpressionConvertible...,\n                                isDistinct: Bool = false) -> Expression {\n        return function(named: name, expressions, isDistinct: isDistinct)\n    }\n    public static func function(named name: String,\n                                _ expressions: [ExpressionConvertible],\n                                isDistinct: Bool = false) -> Expression {\n        return Expression.operate(title: name, infix: isDistinct ? \"DISTINCT\" : nil, operands: expressions)\n    }\n\n    public static func `case`(_ expressionConvertible: ExpressionConvertible,\n                              _ flows: (when: ExpressionConvertible, then: ExpressionConvertible)...,\n                              `else`: ExpressionConvertible) -> Expression {\n        return `case`(expressionConvertible.asExpression(), flows, else: `else`.asExpression())\n    }\n    public static func `case`(_ `case`: ExpressionConvertible,\n                              _ flows: [(when: ExpressionConvertible, then: ExpressionConvertible)],\n                              `else`: ExpressionConvertible) -> Expression {\n        var descrption = \"CASE \\(`case`.asExpression().description) \"\n        descrption.append(flows.joined({ \"WHEN \\($0.when) THEN \\($0.then) \" }))\n        descrption.append(\"ELSE \\(`else`.asExpression().description) END\")\n        return Expression(withRaw: descrption)\n    }\n\n    public func asExpression() -> Expression {\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/ForeignKey.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class ForeignKey: Describable {\n    public private(set) var description: String\n\n    public init(withForeignTable table: String, and columnConvertibleList: [ColumnConvertible]) {\n        description = \"REFERENCES \\(table)\"\n        if !columnConvertibleList.isEmpty {\n            description.append(\"(\\(columnConvertibleList.joined(separateBy: \", \")))\")\n        }\n    }\n\n    public convenience init(withForeignTable table: String, and columnConvertibleList: ColumnConvertible...) {\n        self.init(withForeignTable: table, and: columnConvertibleList)\n    }\n\n    public enum Action: Describable {\n        case setNull\n        case setDefault\n        case cascade\n        case restrict\n        case noAction\n\n        public var description: String {\n            switch self {\n            case .setNull:\n                return \"SET NULL\"\n            case .setDefault:\n                return \"SET DEFAULT\"\n            case .cascade:\n                return \"CASCADE\"\n            case .restrict:\n                return \"RESTRICT\"\n            case .noAction:\n                return \"NO ACTION\"\n            }\n        }\n    }\n\n    @discardableResult\n    public func onDelete(_ action: Action) -> ForeignKey {\n        description.append(\" ON DELETE \\(action.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func onUpdate(_ action: Action) -> ForeignKey {\n        description.append(\" ON UPDATE \\(action.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func match(name: String) -> ForeignKey {\n        description.append(\" MATCH \\(name)\")\n        return self\n    }\n\n    public enum Deferrable: Describable {\n        case deferred\n        case immediate\n\n        public var description: String {\n            switch self {\n            case .deferred:\n                return \"INITIALLY DEFERRED\"\n            case .immediate:\n                return \"INITIALLY IMMEDIATE\"\n            }\n        }\n    }\n\n    @discardableResult\n    public func deferrable(_ deferrable: Deferrable) -> ForeignKey {\n        description.append(\" DEFERRABLE \\(deferrable.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func notDeferrable(_ deferrable: Deferrable) -> ForeignKey {\n        description.append(\" NOT DEFERRABLE \\(deferrable.description)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/FundamentalValue.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n// nullable, Int32, Int64, Double, String, Data\npublic struct FundamentalValue {\n    private let base: Any?\n    public let type: ColumnType\n\n    public init(_ _: Void? = nil) {\n        base = nil\n        type = .null\n    }\n\n    public init(_ value: Int32) {\n        base = value\n        type = .integer32\n    }\n\n    public init(_ value: Int64) {\n        base = value\n        type = .integer64\n    }\n\n    public init(_ value: Double) {\n        base = value\n        type = .float\n    }\n\n    public init(_ value: String) {\n        base = value\n        type = .text\n    }\n\n    public init(_ value: Data) {\n        base = value\n        type = .BLOB\n    }\n\n    public init<T: ColumnEncodable>(_ encodedValue: T) {\n        self = encodedValue.archivedValue()\n    }\n\n    public var int32Value: Int32 {\n        switch type {\n        case .integer32:\n            return base as! Int32\n        case .integer64:\n            return Int32(truncatingIfNeeded: base as! Int64)\n        case .float:\n            return Int32(base as! Double)\n        case .text:\n            return Int32(base as! String) ?? 0\n        default:\n            return 0\n        }\n    }\n\n    public var int64Value: Int64 {\n        switch type {\n        case .integer32:\n            return Int64(base as! Int32)\n        case .integer64:\n            return base as! Int64\n        case .float:\n            return Int64(base as! Double)\n        case .text:\n            return Int64(base as! String) ?? 0\n        default:\n            return 0\n        }\n    }\n\n    public var stringValue: String {\n        switch type {\n        case .integer32:\n            return \"\\(base as! Int32)\"\n        case .integer64:\n            return \"\\(base as! Int64)\"\n        case .float:\n            return \"\\(base as! Double)\"\n        case .text:\n            return base as! String\n        case .BLOB:\n            return String(data: base as! Data, encoding: .utf8) ?? \"\"\n        default:\n            return \"\"\n        }\n    }\n\n    public var doubleValue: Double {\n        switch type {\n        case .integer32:\n            return Double(base as! Int32)\n        case .integer64:\n            return Double(base as! Int64)\n        case .float:\n            return base as! Double\n        case .text:\n            return Double(base as! String) ?? 0\n        default:\n            return 0\n        }\n    }\n\n    public var dataValue: Data {\n        switch type {\n        case .integer32:\n            fallthrough\n        case .integer64:\n            fallthrough\n        case .float:\n            fallthrough\n        case .text:\n            return stringValue.data(using: .utf8) ?? Data()\n        case .BLOB:\n            return (base as? Data) ?? Data()\n        default:\n            return Data()\n        }\n    }\n}\n\npublic typealias FundamentalColumn = [FundamentalValue]\npublic typealias FundamentalRow = [FundamentalValue]\n\npublic typealias FundamentalRowXColumn = [FundamentalRow]\n\nextension Array where Element==[FundamentalValue] {\n    public subscript(row row: Array.Index, column column: Array<FundamentalValue>.Index) -> FundamentalValue {\n        return self[row][column]\n    }\n\n    public subscript(row row: Array.Index) -> FundamentalColumn {\n        return self[row]\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Handle.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic typealias Tag = Int\n\npublic final class Handle {\n    private var handle: SQLite3?\n\n    public let path: String\n    public internal(set) var tag: Tag? = nil {\n        didSet {\n            tracer?.userInfo = tag\n        }\n    }\n\n    typealias CommittedHook = (Handle, Int, Void?) -> Void\n    private struct CommittedHookInfo {\n        var onCommitted: CommittedHook\n        weak var handle: Handle?\n    }\n    private var committedHookInfo: CommittedHookInfo?\n\n    private var tracer: Tracer?\n\n    init(withPath path: String) {\n        DispatchQueue.once(name: \"com.tencent.wcdb.handle\") {\n            sqlite3_config_multithread()\n            sqlite3_config_memstatus(Int32(truncating: false))\n            sqlite3_config_log({ (_, code, message) in\n                let msg = (message != nil) ? String(cString: message!) : \"\"\n                Error.reportSQLiteGlobal(code: Int(code), message: msg)\n            }, nil)\n        }\n        self.path = path\n    }\n\n    deinit {\n        try? close()\n    }\n\n    func open() throws {\n        let directory = URL(fileURLWithPath: path).deletingLastPathComponent().path\n        try File.createDirectoryWithIntermediateDirectories(atPath: directory)\n        let rc = sqlite3_open(path, &handle)\n        guard rc == SQLITE_OK else {\n            throw Error.reportSQLite(tag: tag,\n                                     path: path,\n                                     operation: .open,\n                                     code: rc,\n                                     message: String(cString: sqlite3_errmsg(handle))\n            )\n        }\n    }\n\n    func close() throws {\n        let rc = sqlite3_close(handle)\n        guard rc == SQLITE_OK else {\n            throw Error.reportSQLite(tag: tag,\n                                     path: path,\n                                     operation: .close,\n                                     code: rc,\n                                     message: String(cString: sqlite3_errmsg(handle))\n            )\n        }\n        handle = nil\n    }\n\n    public func prepare(_ statement: Statement) throws -> HandleStatement {\n        assert(statement.statementType != .transaction, \"[prepare] a transaction is not allowed, use [exec] instead\")\n        var stmt: OpaquePointer? = nil\n        let rc = sqlite3_prepare_v2(handle, statement.description, -1, &stmt, nil)\n        guard rc==SQLITE_OK else {\n            throw Error.reportSQLite(tag: tag,\n                                     path: path,\n                                     operation: .prepare,\n                                     extendedError: sqlite3_extended_errcode(handle),\n                                     sql: statement.description,\n                                     code: rc,\n                                     message: String(cString: sqlite3_errmsg(handle))\n            )\n        }\n        return HandleStatement(with: stmt!, and: self)\n    }\n\n    public func exec(_ statement: Statement) throws {\n        let rc = sqlite3_exec(handle, statement.description, nil, nil, nil)\n        let result = rc == SQLITE_OK\n        if let tracer = self.tracer {\n            if  statement.statementType == .transaction,\n                let statementTransaction = statement as? StatementTransaction,\n                let transactionType = statementTransaction.transactionType {\n                switch transactionType {\n                case .begin:\n                    if result {\n                        tracer.shouldAggregation = true\n                    }\n                case .commit:\n                    if result {\n                        tracer.shouldAggregation = false\n                    }\n                case .rollback:\n                    tracer.shouldAggregation = false\n                }\n            }\n        }\n        guard result else {\n            throw Error.reportSQLite(tag: tag,\n                                     path: path,\n                                     operation: .exec,\n                                     extendedError: sqlite3_extended_errcode(handle),\n                                     sql: statement.description,\n                                     code: rc,\n                                     message: String(cString: sqlite3_errmsg(handle))\n            )\n        }\n    }\n\n    public var changes: Int {\n        return Int(sqlite3_changes(handle))\n    }\n\n    public var isReadonly: Bool {\n        return sqlite3_db_readonly(handle, nil)==1\n    }\n}\n\n//Cipher\nextension Handle {\n    public func setCipher(key: Data) throws {\n        let rc = key.withUnsafeBytes ({ (bytes: UnsafePointer<Int8>) -> Int32 in\n            return sqlite3_key(handle, bytes, Int32(key.count))\n        })\n        guard rc == SQLITE_OK else {\n            throw Error.reportSQLite(tag: tag,\n                                     path: path,\n                                     operation: .setCipherKey,\n                                     extendedError: sqlite3_extended_errcode(handle),\n                                     code: rc,\n                                     message: String(cString: sqlite3_errmsg(handle))\n            )\n        }\n    }\n}\n\n//Repair\nextension Handle {\n    public static let backupSubfix = \"-backup\"\n\n    public var backupPath: String {\n        return path+Handle.backupSubfix\n    }\n\n    public func backup(withKey optionalKey: Data? = nil) throws {\n        var rc = SQLITE_OK\n        if let key = optionalKey {\n            key.withUnsafeBytes { (bytes: UnsafePointer<Int8>) -> Void in\n                rc = sqliterk_save_master(handle, backupPath, bytes, Int32(key.count))\n            }\n        } else {\n            rc = sqliterk_save_master(handle, backupPath, nil, 0)\n        }\n        guard rc == SQLITERK_OK else {\n            throw Error.reportRepair(path: path,\n                                     operation: .saveMaster,\n                                     code: Int(rc))\n        }\n    }\n\n    public func recover(fromPath source: String,\n                        withPageSize pageSize: Int32,\n                        databaseKey optionalDatabaseKey: Data? = nil,\n                        backupKey optionalBackupKey: Data? = nil) throws {\n        var rc = SQLITERK_OK\n\n        let backupPath = source+Handle.backupSubfix\n\n        let kdfSalt = UnsafeMutablePointer<UInt8>.allocate(capacity: 16)\n        memset(kdfSalt, 0, 16)\n\n        var info: OpaquePointer? = nil\n        let backupSize: Int32 = Int32(optionalBackupKey?.count ?? 0)\n        if let backupKey = optionalBackupKey {\n            backupKey.withUnsafeBytes({ (bytes: UnsafePointer<Int8>) -> Void in\n                rc = sqliterk_load_master(backupPath, bytes, backupSize, nil, 0, &info, kdfSalt)\n            })\n        }else {\n            rc = sqliterk_load_master(backupPath, nil, backupSize, nil, 0, &info, kdfSalt)\n        }\n\n        guard rc == SQLITERK_OK else {\n            throw Error.reportRepair(path: backupPath,\n                                     operation: .repair,\n                                     code: Int(rc))\n        }\n\n        var conf = sqliterk_cipher_conf()\n        conf.page_size = pageSize\n        conf.kdf_salt = UnsafePointer(kdfSalt)\n        conf.use_hmac = 1\n\n        typealias RepairKit = OpaquePointer\n        var rk: RepairKit? = nil\n        \n        let databaseSize: Int32 = Int32(optionalDatabaseKey?.count ?? 0)\n        if let databaseKey = optionalDatabaseKey {\n            databaseKey.withUnsafeBytes({ (bytes: UnsafePointer<Int8>) -> Void in\n                sqliterk_cipher_conf_set_key(&conf, bytes, databaseSize)\n                rc = sqliterk_open(source, &conf, &rk)\n            })\n        }else {\n            sqliterk_cipher_conf_set_key(&conf, nil, 0)\n            rc = sqliterk_open(source, &conf, &rk)\n        }\n        guard rc == SQLITERK_OK else {\n            throw Error.reportRepair(path: source,\n                                     operation: .repair,\n                                     code: Int(rc))\n        }\n\n        rc = sqliterk_output(rk, handle, info, UInt32(SQLITERK_OUTPUT_ALL_TABLES))\n        guard rc == SQLITERK_OK else {\n            throw Error.reportRepair(path: source,\n                                     operation: .repair,\n                                     code: Int(rc))\n        }\n    }\n}\n\nextension Handle {\n    public static let subfixs: [String] = [\"\", \"-wal\", \"-journal\", \"-shm\", Handle.backupSubfix]\n}\n\nextension Handle {\n    public typealias SQLTracer = (String) -> Void\n\n    func lazyTracer() -> Tracer? {\n        if tracer == nil && handle != nil {\n            tracer = Tracer(with: handle!)\n        }\n        return tracer\n    }\n\n    func trace(sql sqlTracer: @escaping SQLTracer) {\n        lazyTracer()?.trace(sql: sqlTracer)\n    }\n\n    public typealias PerformanceTracer = (Tag?, [String: Int], Int64) -> Void // Tag?, (SQL, count), cost\n\n    func trace(performance performanceTracer: @escaping PerformanceTracer) {\n        lazyTracer()?.track(performance: { (sqls, cost, userInfo) in\n            performanceTracer(userInfo as? Tag, sqls, cost)\n        })\n    }\n}\n\n//Commit hook\nextension Handle {\n    func register(onCommitted: @escaping CommittedHook) {\n        committedHookInfo = CommittedHookInfo(onCommitted: onCommitted, handle: self)\n        sqlite3_wal_hook(handle, { (pointer, _, _, pages) -> Int32 in\n            let committedHookInfo = pointer!.assumingMemoryBound(to: CommittedHookInfo.self).pointee\n            committedHookInfo.onCommitted(committedHookInfo.handle!, Int(pages), nil)\n            return SQLITE_OK\n        }, &committedHookInfo)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/HandleStatement.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class HandleStatement {\n    private var stmt: SQLite3Statement?\n\n    private let handle: Handle\n\n    public var path: String {\n        return handle.path\n    }\n\n    public var tag: Tag? {\n        return handle.tag\n    }\n\n    init(with stmt: SQLite3Statement, and handle: Handle) {\n        self.stmt = stmt\n        self.handle = handle\n    }\n\n    deinit {\n        try? finalize()\n    }\n\n    @discardableResult\n    public func step() throws -> Bool {\n        let rc = sqlite3_step(stmt)\n        guard rc==SQLITE_OK || rc==SQLITE_DONE || rc==SQLITE_ROW else {\n            let dbHandle = sqlite3_db_handle(stmt)\n            throw Error.reportSQLite(tag: handle.tag,\n                                     path: handle.path,\n                                     operation: .step,\n                                     extendedError: sqlite3_extended_errcode(dbHandle),\n                                     sql: String(cString: sqlite3_sql(stmt)),\n                                     code: rc,\n                                     message: String(cString: sqlite3_errmsg(dbHandle))\n            )\n        }\n        return rc==SQLITE_ROW\n    }\n\n    public func reset() throws {\n        let rc = sqlite3_reset(stmt)\n        guard rc==SQLITE_OK else {\n            let dbHandle = sqlite3_db_handle(stmt)\n            throw Error.reportSQLite(tag: handle.tag,\n                                     path: handle.path,\n                                     operation: .finalize,\n                                     extendedError: sqlite3_extended_errcode(dbHandle),\n                                     code: rc,\n                                     message: String(cString: sqlite3_errmsg(dbHandle))\n            )\n        }\n    }\n\n    public var changes: Int {\n        return Int(sqlite3_changes(sqlite3_db_handle(stmt)))\n    }\n\n    public func bind(_ value: FundamentalValue, toIndex index: Int) {\n        switch value.type {\n        case .integer32:\n            sqlite3_bind_int(stmt, Int32(index), value.int32Value)\n        case .integer64:\n            sqlite3_bind_int64(stmt, Int32(index), value.int64Value)\n        case .float:\n            sqlite3_bind_double(stmt, Int32(index), value.doubleValue)\n        case .text:\n            sqlite3_bind_text_transient(stmt, Int32(index), value.stringValue, -1)\n        case .BLOB:\n            let data = value.dataValue\n            data.withUnsafeBytes ({ (bytes: UnsafePointer<Int8>) -> Void in\n                sqlite3_bind_blob_transient(stmt, Int32(index), bytes, Int32(data.count))\n            })\n        case .null:\n            sqlite3_bind_null(stmt, Int32(index))\n        }\n    }\n\n    public func bind(_ value: Int32, toIndex index: Int) {\n        sqlite3_bind_int(stmt, Int32(index), value)\n    }\n\n    public func bind(_ value: Int64, toIndex index: Int) {\n        sqlite3_bind_int64(stmt, Int32(index), value)\n    }\n\n    public func bind(_ value: Double, toIndex index: Int) {\n        sqlite3_bind_double(stmt, Int32(index), value)\n    }\n\n    public func bind(_ value: String, toIndex index: Int) {\n        sqlite3_bind_text_transient(stmt, Int32(index), value, -1)\n    }\n\n    public func bind(_ value: Data, toIndex index: Int) {\n        value.withUnsafeBytes ({ (bytes: UnsafePointer<Int8>) -> Void in\n            sqlite3_bind_blob_transient(stmt, Int32(index), bytes, Int32(value.count))\n        })\n    }\n\n    public func bind(_ _: Void?, toIndex index: Int) {\n        sqlite3_bind_null(stmt, Int32(index))\n    }\n\n    public func columnValue(atIndex index: Int) -> FundamentalValue {\n        switch columnType(atIndex: index) {\n        case .integer32:\n            return FundamentalValue(columnValue(atIndex: index, of: Int32.self))\n        case .integer64:\n            return FundamentalValue(columnValue(atIndex: index, of: Int64.self))\n        case .float:\n            return FundamentalValue(columnValue(atIndex: index, of: Double.self))\n        case .text:\n            return FundamentalValue(columnValue(atIndex: index, of: String.self))\n        case .BLOB:\n            return FundamentalValue(columnValue(atIndex: index, of: Data.self))\n        case .null:\n            return FundamentalValue(nil)\n        }\n    }\n\n    public func columnValue(atIndex index: Int, of type: Int32.Type = Int32.self) -> Int32 {\n        return sqlite3_column_int(stmt, Int32(index))\n    }\n\n    public func columnValue(atIndex index: Int, of type: Int64.Type = Int64.self) -> Int64 {\n        return sqlite3_column_int64(stmt, Int32(index))\n    }\n\n    public func columnValue(atIndex index: Int, of type: Double.Type = Double.self) -> Double {\n        return sqlite3_column_double(stmt, Int32(index))\n    }\n\n    public func columnValue(atIndex index: Int, of type: String.Type = String.self) -> String {\n        guard let cString = sqlite3_column_text(stmt, Int32(index)) else {\n            return \"\"\n        }\n        return String(cString: cString)\n    }\n\n    public func columnValue(atIndex index: Int, of type: Data.Type = Data.self) -> Data {\n        guard let bytes = sqlite3_column_blob(stmt, Int32(index)) else {\n            return Data()\n        }\n        let count = Int(sqlite3_column_bytes(stmt, Int32(index)))\n        return Data(bytes: bytes, count: count)\n    }\n\n    public func columnCount() -> Int {\n        return Int(sqlite3_column_count(stmt))\n    }\n\n    public func columnName(atIndex index: Int) -> String {\n        return String(cString: sqlite3_column_name(stmt, Int32(index)))\n    }\n\n    public func columnTableName(atIndex index: Int) -> String {\n        return String(cString: sqlite3_column_table_name(stmt, Int32(index)))\n    }\n\n    public func columnType(atIndex index: Int) -> ColumnType {\n        switch sqlite3_column_type(stmt, Int32(index)) {\n        case SQLITE_INTEGER:\n            return ColumnType.integer64\n        case SQLITE_FLOAT:\n            return ColumnType.float\n        case SQLITE_BLOB:\n            return ColumnType.BLOB\n        case SQLITE_TEXT:\n            return ColumnType.text\n        default:\n            return ColumnType.null\n        }\n    }\n\n    public var lastInsertedRowID: Int64 {\n        return sqlite3_last_insert_rowid(sqlite3_db_handle(stmt))\n    }\n\n    public func finalize() throws {\n        if stmt != nil {\n            let dbHandle = sqlite3_db_handle(stmt)\n            let rc = sqlite3_finalize(stmt)\n            stmt = nil\n            guard rc==SQLITE_OK else {\n                throw Error.reportSQLite(tag: handle.tag,\n                                         path: handle.path,\n                                         operation: .finalize,\n                                         extendedError: sqlite3_extended_errcode(dbHandle),\n                                         code: rc,\n                                         message: String(cString: sqlite3_errmsg(dbHandle))\n                )\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/JoinClause.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class JoinClause: Describable {\n    public private(set) var description: String\n\n    public enum JoinClauseType: Describable {\n        case left\n        case leftOuter\n        case inner\n        case cross\n        public var description: String {\n            switch self {\n            case .left:\n                return \"LEFT\"\n            case .leftOuter:\n                return \"LEFT OUTER\"\n            case .inner:\n                return \"INNER\"\n            case .cross:\n                return \"CROSS\"\n            }\n        }\n    }\n\n    public init(with subqueryConvertible: TableOrSubqueryConvertible) {\n        description = subqueryConvertible.asTableOrSubquery().description\n    }\n\n    @discardableResult\n    private func join(_ subqueryConvertible: TableOrSubqueryConvertible,\n                      with type: JoinClauseType? = nil,\n                      isNatural: Bool = false) -> JoinClause {\n        if isNatural {\n            description.append(\" NATURAL\")\n        }\n        if type != nil {\n            description.append(\" \\(type!.description)\")\n        }\n        description.append(\" JOIN \\(subqueryConvertible.asTableOrSubquery().description)\")\n        return self\n    }\n\n    @discardableResult\n    public func join(_ subqueryConvertible: TableOrSubqueryConvertible,\n                     with type: JoinClauseType? = nil) -> JoinClause {\n        return self.join(subqueryConvertible, with: type, isNatural: false)\n    }\n\n    @discardableResult\n    public func natureJoin(_ subqueryConvertible: TableOrSubqueryConvertible,\n                           with type: JoinClauseType? = nil) -> JoinClause {\n        return self.join(subqueryConvertible, with: type, isNatural: true)\n    }\n\n    @discardableResult\n    public func on(_ expressionConvertible: ExpressionConvertible) -> JoinClause {\n        description.append(\" ON \\(expressionConvertible.asExpression().description)\")\n        return self\n    }\n\n    @discardableResult\n    public func using(_ columnConvertibleList: ColumnConvertible...) -> JoinClause {\n        return using(columnConvertibleList)\n    }\n\n    @discardableResult\n    public func using(_ columnConvertibleList: [ColumnConvertible]) -> JoinClause {\n        description.append(\" USING \\(columnConvertibleList.joined())\")\n        return self\n    }\n}\n\nextension JoinClause: TableOrSubqueryConvertible {\n    public func asTableOrSubquery() -> Subquery {\n        return Subquery(with: self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/LiteralValue.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic struct LiteralValue: Describable {\n    public private(set) var description: String\n\n    public init(_ value: Int32) {\n        description = String(value)\n    }\n\n    public init(_ value: Int64) {\n        description = String(value)\n    }\n\n    public init(_ value: Bool) {\n        description = String(value ? 1 : 0)\n    }\n\n    public init(_ value: Double) {\n        description = String(value)\n    }\n\n    public init(_ value: String) {\n        description = \"'\\(value.replacingOccurrences(of: \"'\", with: \"''\"))'\"\n    }\n\n    public init(_ value: Data) {\n        let string = String(data: value, encoding: .utf8) ?? \"\"\n        description = \"'\\(string.replacingOccurrences(of: \"'\", with: \"''\"))'\"\n    }\n\n    public init(_ value: Void?) {\n        description = \"NULL\"\n    }\n\n    public init(_ value: FundamentalValue) {\n        switch value.type {\n        case .integer32:\n            self.init(value.int32Value)\n        case .integer64:\n            self.init(value.int64Value)\n        case .float:\n            self.init(value.doubleValue)\n        case .text:\n            self.init(value.stringValue)\n        case .BLOB:\n            self.init(value.dataValue)\n        case .null:\n            self.init(nil)\n        }\n    }\n\n    public init<T: ColumnEncodable>(_ encodedValue: T) {\n        self.init(encodedValue.archivedValue())\n    }\n}\n\nextension LiteralValue: ExpressibleByNilLiteral {\n    public init(nilLiteral: ()) {\n        self.init(nilLiteral)\n    }\n}\n\nextension LiteralValue: ExpressibleByIntegerLiteral {\n    public init(integerLiteral value: Int) {\n        self.init(value)\n    }\n}\n\nextension LiteralValue: ExpressibleByBooleanLiteral {\n    public init(booleanLiteral value: Bool) {\n        self.init(value)\n    }\n}\n\nextension LiteralValue: ExpressibleByFloatLiteral {\n    public init(floatLiteral value: Double) {\n        self.init(value)\n    }\n}\n\nextension LiteralValue: ExpressibleByStringLiteral {\n    public init(stringLiteral value: String) {\n        self.init(value)\n    }\n}\n\nextension LiteralValue: LiteralValueConvertible {\n    public func asLiteralValue() -> LiteralValue {\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/ModuleArgument.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct ModuleArgument: Describable {\n    public private(set) var description: String\n\n    public init(with tableConstraint: TableConstraint) {\n        description = tableConstraint.description\n    }\n\n    public init(with columnDef: ColumnDef) {\n        description = columnDef.description\n    }\n\n    public init(left: String, right: String) {\n        description = \"\\(left)=\\(right)\"\n    }\n\n    public init(with tokenize: Tokenize) {\n        self.init(left: \"tokenize\", right: tokenize.module.name)\n    }\n\n    public init(withTokenize tokenize: String) {\n        self.init(left: \"tokenize\", right: tokenize)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Operable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nextension ExpressionConvertible {\n    static func operate(prefix: String, operand: ExpressionConvertible) -> Expression {\n        return Expression(withRaw: \"(\\(prefix)\\(operand.asExpression().description))\")\n    }\n    static func operate(title: String, infix: String?, operands: [ExpressionConvertible]) -> Expression {\n        return Expression(withRaw: \"\\(title)(\\(infix != nil ? infix!+\" \" : \"\")\\(operands.joined()))\")\n    }\n    static func operate(operand: ExpressionConvertible, postfix: String) -> Expression {\n        return Expression(withRaw: \"(\\(operand.asExpression().description) \\(postfix))\")\n    }\n    static func operate(left: ExpressionConvertible,\n                        `operator`: String,\n                        right: ExpressionConvertible) -> Expression {\n        let leftDescription = left.asExpression().description\n        let rightDescription = right.asExpression().description\n        return Expression(withRaw: \"(\\(leftDescription) \\(`operator`) \\(rightDescription))\")\n    }\n    static func operate(one: ExpressionConvertible,\n                        operator1: String,\n                        two: ExpressionConvertible,\n                        operator2: String,\n                        three: ExpressionConvertible) -> Expression {\n        let oneDescription = one.asExpression().description\n        let twoDescription = two.asExpression().description\n        let threeDescription = three.asExpression().description\n        let raws = [oneDescription, operator1, twoDescription, operator2, threeDescription]\n        return Expression(withRaw: \"(\\(raws.joined(separateBy: \" \")))\")\n    }\n}\n\npublic protocol ExpressionCanBeOperated: ExpressionConvertible {\n    static func || <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func && <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func * <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func / <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func % <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func + <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func - <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func << <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func >> <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func & <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func | <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func < <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func <= <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func > <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func >= <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func == <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n\n    static func != <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression\n}\n\nextension ExpressionCanBeOperated {\n    public static func || <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return Expression.operate(left: left, operator: \"OR\", right: right)\n    }\n\n    public static func && <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"AND\", right: right)\n    }\n\n    public static func * <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"*\", right: right)\n    }\n\n    public static func / <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"/\", right: right)\n    }\n\n    public static func % <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"%\", right: right)\n    }\n\n    public static func + <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"+\", right: right)\n    }\n\n    public static func - <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"-\", right: right)\n    }\n\n    public static func << <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"<<\", right: right)\n    }\n\n    public static func >> <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \">>\", right: right)\n    }\n\n    public static func & <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"&\", right: right)\n    }\n\n    public static func | <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"|\", right: right)\n    }\n\n    public static func < <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"<\", right: right)\n    }\n\n    public static func <= <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"<=\", right: right)\n    }\n\n    public static func > <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \">\", right: right)\n    }\n\n    public static func >= <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \">=\", right: right)\n    }\n\n    public static func == <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"=\", right: right)\n    }\n\n    public static func != <ExpressionOperableType: ExpressionOperable>(\n        left: Self, right: ExpressionOperableType) -> Expression {\n        return operate(left: left, operator: \"!=\", right: right)\n    }\n}\n\npublic protocol ExpressionOperable: ExpressionCanBeOperated {\n    //Unary\n    prefix static func ! (operand: Self) -> Expression\n    prefix static func + (operand: Self) -> Expression\n    prefix static func - (operand: Self) -> Expression\n    prefix static func ~ (operand: Self) -> Expression\n\n    //Binary\n    static func || <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self,\n        right: ExpressionConvertibleType) -> Expression\n\n    static func && <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func * <ExpressionConvertibleType: ExpressionConvertible>\n        (left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func / <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func % <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func + <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func - <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func << <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func >> <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func & <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func | <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func < <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func <= <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func > <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func >= <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func == <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    static func != <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression\n\n    func concat(_ operand: ExpressionConvertible) -> Expression\n    func substr(start: ExpressionConvertible, length: ExpressionConvertible) -> Expression\n\n    func like(_ operand: ExpressionConvertible) -> Expression\n    func glob(_ operand: ExpressionConvertible) -> Expression\n    func match(_ operand: ExpressionConvertible) -> Expression\n    func regexp(_ operand: ExpressionConvertible) -> Expression\n\n    func notLike(_ operand: ExpressionConvertible) -> Expression\n    func notGlob(_ operand: ExpressionConvertible) -> Expression\n    func notMatch(_ operand: ExpressionConvertible) -> Expression\n    func notRegexp(_ operand: ExpressionConvertible) -> Expression\n\n    func like(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n    func glob(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n    func match(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n    func regexp(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n\n    func notLike(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n    func notGlob(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n    func notMatch(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n    func notRegexp(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression\n\n    func isNull() -> Expression\n    func isNotNull() -> Expression\n\n    func `is`(_ operand: ExpressionConvertible) -> Expression\n    func isNot(_ operand: ExpressionConvertible) -> Expression\n\n    func between(_ begin: ExpressionConvertible, _ end: ExpressionConvertible) -> Expression\n    func notBetween(_ begin: ExpressionConvertible, _ end: ExpressionConvertible) -> Expression\n\n    func `in`(_ statementSelect: StatementSelect) -> Expression\n    func notIn(_ statementSelect: StatementSelect) -> Expression\n\n    func `in`(_ expressionConvertibleList: ExpressionConvertible...) -> Expression\n    func notIn(_ expressionConvertibleList: ExpressionConvertible...) -> Expression\n\n    func `in`(_ expressionConvertibleList: [ExpressionConvertible]) -> Expression\n    func notIn(_ expressionConvertibleList: [ExpressionConvertible]) -> Expression\n\n    //aggregate functions\n    func avg(isDistinct: Bool) -> Expression\n    func count(isDistinct: Bool) -> Expression\n    func groupConcat(isDistinct: Bool) -> Expression\n    func groupConcat(isDistinct: Bool, separateBy seperator: String) -> Expression\n    func max(isDistinct: Bool) -> Expression\n    func min(isDistinct: Bool) -> Expression\n    func sum(isDistinct: Bool) -> Expression\n    func total(isDistinct: Bool) -> Expression\n\n    //core functions\n    func abs(isDistinct: Bool) -> Expression\n    func hex(isDistinct: Bool) -> Expression\n    func length(isDistinct: Bool) -> Expression\n    func lower(isDistinct: Bool) -> Expression\n    func upper(isDistinct: Bool) -> Expression\n    func round(isDistinct: Bool) -> Expression\n\n    //FTS3\n    func matchinfo() -> Expression\n    func offsets() -> Expression\n    func snippet() -> Expression\n}\n\nextension ExpressionOperable {\n    //Unary\n    public prefix static func ! (operand: Self) -> Expression {\n        return operate(prefix: \"NOT \", operand: operand)\n    }\n    public prefix static func + (operand: Self) -> Expression {\n        return operate(prefix: \"\", operand: operand)\n    }\n    public prefix static func - (operand: Self) -> Expression {\n        return operate(prefix: \"-\", operand: operand)\n    }\n    public prefix static func ~ (operand: Self) -> Expression {\n        return operate(prefix: \"~\", operand: operand)\n    }\n\n    //Binary\n    public static func || <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"OR\", right: right)\n    }\n\n    public static func && <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"AND\", right: right)\n    }\n\n    public static func * <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"*\", right: right)\n    }\n\n    public static func / <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"/\", right: right)\n    }\n\n    public static func % <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"%\", right: right)\n    }\n\n    public static func + <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"+\", right: right)\n    }\n\n    public static func - <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"-\", right: right)\n    }\n\n    public static func << <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"<<\", right: right)\n    }\n\n    public static func >> <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \">>\", right: right)\n    }\n\n    public static func & <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"&\", right: right)\n    }\n\n    public static func | <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"|\", right: right)\n    }\n\n    public static func < <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"<\", right: right)\n    }\n\n    public static func <= <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"<=\", right: right)\n    }\n\n    public static func > <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \">\", right: right)\n    }\n\n    public static func >= <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \">=\", right: right)\n    }\n\n    public static func == <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"=\", right: right)\n    }\n\n    public static func != <ExpressionConvertibleType: ExpressionConvertible>(\n        left: Self, right: ExpressionConvertibleType) -> Expression {\n        return operate(left: left, operator: \"!=\", right: right)\n    }\n\n    public func concat(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"||\", right: operand)\n    }\n    public func substr(start: ExpressionConvertible, length: ExpressionConvertible) -> Expression {\n        let description = asExpression().description\n        let startDescription = start.asExpression().description\n        let lengthDescription = length.asExpression().description\n        return Expression(withRaw: \"SUBSTR(\\(description), \\(startDescription), \\(lengthDescription))\")\n    }\n\n    public func like(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"LIKE\", right: operand)\n    }\n    public func glob(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"GLOB\", right: operand)\n    }\n    public func match(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"MATCH\", right: operand)\n    }\n    public func regexp(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"REGEXP\", right: operand)\n    }\n    public func notLike(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"NOT LIKE\", right: operand)\n    }\n    public func notGlob(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"NOT GLOB\", right: operand)\n    }\n    public func notMatch(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"NOT MATCH\", right: operand)\n    }\n    public func notRegexp(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"NOT REGEXP\", right: operand)\n    }\n\n    public func like(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"LIKE\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n    public func glob(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"GLOB\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n    public func match(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"MATCH\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n    public func regexp(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"REGEXP\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n    public func notLike(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"NOT LIKE\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n    public func notGlob(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"NOT GLOB\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n    public func notMatch(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"NOT MATCH\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n    public func notRegexp(_ operand: ExpressionConvertible, escape: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"NOT REGEXP\", two: operand, operator2: \"ESCAPE\", three: escape)\n    }\n\n    public func isNull() -> Expression {\n        return Self.operate(operand: self, postfix: \"ISNULL\")\n    }\n    public func isNotNull() -> Expression {\n        return Self.operate(operand: self, postfix: \"NOTNULL\")\n    }\n    public func `is`(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"IS\", right: operand)\n    }\n    public func isNot(_ operand: ExpressionConvertible) -> Expression {\n        return Self.operate(left: self, operator: \"IS NOT\", right: operand)\n    }\n    public func between(_ begin: ExpressionConvertible, _ end: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"BETWEEN\", two: begin, operator2: \"AND\", three: end)\n    }\n    public func notBetween(_ begin: ExpressionConvertible, _ end: ExpressionConvertible) -> Expression {\n        return Self.operate(one: self, operator1: \"NOT BETWEEN\", two: begin, operator2: \"AND\", three: end)\n    }\n\n    public func `in`(_ statementSelect: StatementSelect) -> Expression {\n        return Self.operate(prefix: \"IN \", operand: statementSelect)\n    }\n    public func notIn(_ statementSelect: StatementSelect) -> Expression {\n        return Self.operate(prefix: \"NOT IN \", operand: statementSelect)\n    }\n    public func `in`(_ expressionConvertibleList: ExpressionConvertible...) -> Expression {\n        return self.`in`(expressionConvertibleList)\n    }\n    public func notIn(_ expressionConvertibleList: ExpressionConvertible...) -> Expression {\n        return self.notIn(expressionConvertibleList)\n    }\n    public func `in`(_ expressionConvertibleList: [ExpressionConvertible]) -> Expression {\n        return Self.operate(operand: self, postfix: \"IN(\\(expressionConvertibleList.joined()))\")\n    }\n    public func notIn(_ expressionConvertibleList: [ExpressionConvertible]) -> Expression {\n        return Self.operate(operand: self, postfix: \"NOT IN(\\(expressionConvertibleList.joined()))\")\n    }\n\n    //aggregate functions\n    public func avg(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"AVG\", self, isDistinct: isDistinct)\n    }\n    public func count(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"COUNT\", self, isDistinct: isDistinct)\n    }\n    public func groupConcat(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"GROUP_CONCAT\", self, isDistinct: isDistinct)\n    }\n    public func groupConcat(isDistinct: Bool = false, separateBy seperator: String) -> Expression {\n        return Expression.function(named: \"GROUP_CONCAT\", self, seperator, isDistinct: isDistinct)\n    }\n    public func max(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"MAX\", self, isDistinct: isDistinct)\n    }\n    public func min(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"MIN\", self, isDistinct: isDistinct)\n    }\n    public func sum(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"SUM\", self, isDistinct: isDistinct)\n    }\n    public func total(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"TOTAL\", self, isDistinct: isDistinct)\n    }\n    //core functions\n    public func abs(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"ABS\", self, isDistinct: isDistinct)\n    }\n    public func hex(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"HEX\", self, isDistinct: isDistinct)\n    }\n    public func length(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"LENGTH\", self, isDistinct: isDistinct)\n    }\n    public func lower(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"LOWER\", self, isDistinct: isDistinct)\n    }\n    public func upper(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"UPPER\", self, isDistinct: isDistinct)\n    }\n    public func round(isDistinct: Bool = false) -> Expression {\n        return Expression.function(named: \"ROUND\", self, isDistinct: isDistinct)\n    }\n\n    //FTS3\n    public func matchinfo() -> Expression {\n        return Expression.function(named: \"MATCHINFO\", self)\n    }\n    public func offsets() -> Expression {\n        return Expression.function(named: \"OFFSETS\", self)\n    }\n    public func snippet() -> Expression {\n        return Expression.function(named: \"SNIPPET\", self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Order.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct Order: Describable {\n    public private(set) var description: String\n\n    public init(with expressionConvertible: ExpressionConvertible, by term: OrderTerm? = nil) {\n        description = \"\\(expressionConvertible.asExpression().description)\\(term != nil ? \" \"+term!.description : \"\")\"\n    }\n}\n\nextension Order: OrderConvertible {\n    public func asOrder() -> Order {\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/OrderTerm.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic enum OrderTerm: Describable {\n    case ascending\n    case descending\n\n    public var description: String {\n        switch self {\n        case .ascending:\n            return \"ASC\"\n        case .descending:\n            return \"DESC\"\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Pragma.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct Pragma: Describable {\n    public private(set) var description: String\n\n    fileprivate init(named name: String) {\n        description = name\n    }\n\n    public static let applicationId = Pragma(named: \"application_id\")\n    public static let autoVacuum = Pragma(named: \"auto_vacuum\")\n    public static let automaticIndex = Pragma(named: \"automatic_index\")\n    public static let busyTimeout = Pragma(named: \"busy_timeout\")\n    public static let cacheSize = Pragma(named: \"cache_size\")\n    public static let cacheSpill = Pragma(named: \"cache_spill\")\n    public static let caseSensitiveLike = Pragma(named: \"case_sensitive_like\")\n    public static let cellSizeCheck = Pragma(named: \"cell_size_check\")\n    public static let checkpointFullfsync = Pragma(named: \"checkpoint_fullfsync\")\n    public static let cipher = Pragma(named: \"cipher\")\n    public static let cipherAddRandom = Pragma(named: \"cipher_add_random\")\n    public static let cipherDefaultKdfIter = Pragma(named: \"cipher_default_kdf_iter\")\n    public static let cipherDefaultPageSize = Pragma(named: \"cipher_default_page_size\")\n    public static let cipherDefaultUseHmac = Pragma(named: \"cipher_default_use_hmac\")\n    public static let cipherMigrate = Pragma(named: \"cipher_migrate\")\n    public static let cipherProfile = Pragma(named: \"cipher_profile\")\n    public static let cipherProvider = Pragma(named: \"cipher_provider\")\n    public static let cipherProviderVersion = Pragma(named: \"cipher_provider_version\")\n    public static let cipherUseHmac = Pragma(named: \"cipher_use_hmac\")\n    public static let cipherVersion = Pragma(named: \"cipher_version\")\n    public static let cipherPageSize = Pragma(named: \"cipher_page_size\")\n    public static let collationList = Pragma(named: \"collation_list\")\n    public static let compileOptions = Pragma(named: \"compile_options\")\n    public static let countChanges = Pragma(named: \"count_changes\")\n    public static let dataStoreDirectory = Pragma(named: \"data_store_directory\")\n    public static let dataVersion = Pragma(named: \"data_version\")\n    public static let databaseList = Pragma(named: \"database_list\")\n    public static let defaultCacheSize = Pragma(named: \"default_cache_size\")\n    public static let deferForeignKeys = Pragma(named: \"defer_foreign_keys\")\n    public static let emptyResultCallbacks = Pragma(named: \"empty_result_callbacks\")\n    public static let encoding = Pragma(named: \"encoding\")\n    public static let foreignKeyCheck = Pragma(named: \"foreign_key_check\")\n    public static let foreignKeyList = Pragma(named: \"foreign_key_list\")\n    public static let foreignKeys = Pragma(named: \"foreign_keys\")\n    public static let freelistCount = Pragma(named: \"freelist_count\")\n    public static let fullColumnNames = Pragma(named: \"full_column_names\")\n    public static let fullfsync = Pragma(named: \"fullfsync\")\n    public static let ignoreCheckConstraints = Pragma(named: \"ignore_check_constraints\")\n    public static let incrementalVacuum = Pragma(named: \"incremental_vacuum\")\n    public static let indexInfo = Pragma(named: \"index_info\")\n    public static let indexList = Pragma(named: \"index_list\")\n    public static let indexXinfo = Pragma(named: \"index_xinfo\")\n    public static let integrityCheck = Pragma(named: \"integrity_check\")\n    public static let journalMode = Pragma(named: \"journal_mode\")\n    public static let journalSizeLimit = Pragma(named: \"journal_size_limit\")\n    public static let key = Pragma(named: \"key\")\n    public static let kdfIter = Pragma(named: \"kdf_iter\")\n    public static let legacyFileFormat = Pragma(named: \"legacy_file_format\")\n    public static let lockingMode = Pragma(named: \"locking_mode\")\n    public static let maxPageCount = Pragma(named: \"max_page_count\")\n    public static let mmapSize = Pragma(named: \"mmap_size\")\n    public static let pageCount = Pragma(named: \"page_count\")\n    public static let pageSize = Pragma(named: \"page_size\")\n    public static let parserTrace = Pragma(named: \"parser_trace\")\n    public static let queryOnly = Pragma(named: \"query_only\")\n    public static let quickCheck = Pragma(named: \"quick_check\")\n    public static let readUncommitted = Pragma(named: \"read_uncommitted\")\n    public static let recursiveTriggers = Pragma(named: \"recursive_triggers\")\n    public static let rekey = Pragma(named: \"rekey\")\n    public static let reverseUnorderedSelects = Pragma(named: \"reverse_unordered_selects\")\n    public static let schemaVersion = Pragma(named: \"schema_version\")\n    public static let secureDelete = Pragma(named: \"secure_delete\")\n    public static let shortColumnNames = Pragma(named: \"short_column_names\")\n    public static let shrinkMemory = Pragma(named: \"shrink_memory\")\n    public static let softHeapLimit = Pragma(named: \"soft_heap_limit\")\n    public static let stats = Pragma(named: \"stats\")\n    public static let synchronous = Pragma(named: \"synchronous\")\n    public static let tableInfo = Pragma(named: \"table_info\")\n    public static let tempStore = Pragma(named: \"temp_store\")\n    public static let tempStoreDirectory = Pragma(named: \"temp_store_directory\")\n    public static let threads = Pragma(named: \"threads\")\n    public static let userVersion = Pragma(named: \"user_version\")\n    public static let vdbeAddoptrace = Pragma(named: \"vdbe_addoptrace\")\n    public static let vdbeDebug = Pragma(named: \"vdbe_debug\")\n    public static let vdbeListing = Pragma(named: \"vdbe_listing\")\n    public static let vdbeTrace = Pragma(named: \"vdbe_trace\")\n    public static let walAutocheckpoint = Pragma(named: \"wal_autocheckpoint\")\n    public static let walCheckpoint = Pragma(named: \"wal_checkpoint\")\n    public static let writableSchema = Pragma(named: \"writable_schema\")\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Statement.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic enum StatementType {\n    case alterTable\n    case createIndex\n    case createTable\n    case delete\n    case dropIndex\n    case dropTable\n    case insert\n    case pragma\n    case select\n    case transaction\n    case update\n    case createVirtualTable\n    case attach\n    case detach\n    case explain\n    case savepoint\n    case release\n    case rollback\n    case vacuum\n    case reindex\n}\n\npublic protocol Statement: Describable {\n    var statementType: StatementType {get}\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementAlterTable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class StatementAlterTable: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .alterTable\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func alter(table: String) -> StatementAlterTable {\n        description.append(\"ALTER TABLE \\(table)\")\n        return self\n    }\n\n    @discardableResult\n    public func rename(to newTable: String) -> StatementAlterTable {\n        description.append(\" RENAME TO \\(newTable)\")\n        return self\n    }\n\n    @discardableResult\n    public func addColumn(with columnDef: ColumnDef) -> StatementAlterTable {\n        description.append(\" ADD COLUMN \\(columnDef.description)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementAttach.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementAttach: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .attach\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func attach(_ expressionConvertible: ExpressionConvertible, asSchema schema: String) -> StatementAttach {\n        description.append(\"ATTACH \\(expressionConvertible.asExpression().description) AS \\(schema)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementCreateIndex.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class StatementCreateIndex: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .createIndex\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func create(index: String, isUnique: Bool = false, ifNotExists: Bool = true) -> StatementCreateIndex {\n        description.append(\"CREATE \")\n        if isUnique {\n            description.append(\"UNIQUE \")\n        }\n        description.append(\"INDEX \")\n        if ifNotExists {\n            description.append(\"IF NOT EXISTS \")\n        }\n        description.append(index)\n        return self\n    }\n\n    @discardableResult\n    public func on(table: String,\n                   indexesBy columnIndexConvertibleList: ColumnIndexConvertible...) -> StatementCreateIndex {\n        return on(table: table, indexesBy: columnIndexConvertibleList)\n    }\n\n    @discardableResult\n    public func on(table: String,\n                   indexesBy columnIndexConvertibleList: [ColumnIndexConvertible]) -> StatementCreateIndex {\n        description.append(\" ON \\(table)(\\(columnIndexConvertibleList.joined()))\")\n        return self\n    }\n\n    @discardableResult\n    public func `where`(_ expressionConvertible: ExpressionConvertible) -> StatementCreateIndex {\n        let expression = expressionConvertible.asExpression()\n        if !expression.description.isEmpty {\n            description.append(\" WHERE \\(expression.description)\")\n        }\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementCreateTable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementCreateTable: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .createTable\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func create(table: String, ifNotExists: Bool = true,\n                       as statementSelect: StatementSelect) -> StatementCreateTable {\n        description.append(\"CREATE TABLE \")\n        if ifNotExists {\n            description.append(\"IF NOT EXISTS \")\n        }\n        description.append(\"\\(table) AS \\(statementSelect.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func create(table: String,\n                       ifNotExists: Bool = true,\n                       with columnDefs: ColumnDef...,\n                       and tableConstraints: [TableConstraint]? = nil) -> StatementCreateTable {\n        return self.create(table: table, ifNotExists: ifNotExists, with: columnDefs, and: tableConstraints)\n    }\n\n    @discardableResult\n    public func create(table: String,\n                       ifNotExists: Bool = true,\n                       with columnDefs: [ColumnDef],\n                       and optionalTableConstraints: [TableConstraint]? = nil) -> StatementCreateTable {\n        description.append(\"CREATE TABLE \")\n        if ifNotExists {\n            description.append(\"IF NOT EXISTS \")\n        }\n        description.append(\"\\(table)(\\(columnDefs.joined())\")\n        if let tableConstraints = optionalTableConstraints {\n            description.append(\", \\(tableConstraints.joined())\")\n        }\n        description.append(\")\")\n        return self\n    }\n\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementCreateVirtualTable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementCreateVirtualTable: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .createVirtualTable\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func create(virtualTable table: String, ifNotExists: Bool = true) -> StatementCreateVirtualTable {\n        description.append(\"CREATE VIRTUAL TABLE \")\n        if ifNotExists {\n            description.append(\"IF NOT EXISTS \")\n        }\n        description.append(table)\n        return self\n    }\n\n    @discardableResult\n    public func using(module: String, arguments: [ModuleArgument]? = nil) -> StatementCreateVirtualTable {\n        description.append(\" USING \\(module)\")\n        if arguments != nil && !arguments!.isEmpty {\n            description.append(\"(\\(arguments!.joined()))\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func using(module: String, arguments: ModuleArgument...) -> StatementCreateVirtualTable {\n        return using(module: module, arguments: arguments)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementDelete.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementDelete: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .delete\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func delete(fromTable table: String) -> StatementDelete {\n        description.append(\"DELETE FROM \\(table)\")\n        return self\n    }\n\n    @discardableResult\n    public func `where`(_ expressionConvertible: ExpressionConvertible) -> StatementDelete {\n        let expression = expressionConvertible.asExpression()\n        if !expression.description.isEmpty {\n            description.append(\" WHERE \\(expression.description)\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func order(by orderConvertibleList: OrderConvertible...) -> StatementDelete {\n        return order(by: orderConvertibleList)\n    }\n\n    @discardableResult\n    public func order(by orderConvertibleList: [OrderConvertible]) -> StatementDelete {\n        if !orderConvertibleList.isEmpty {\n            description.append(\" ORDER BY \\(orderConvertibleList.joined())\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(from expressionConvertibleFrom: ExpressionConvertible,\n                      to expressionConvertibleTo: ExpressionConvertible) -> StatementDelete {\n        let from = expressionConvertibleFrom.asExpression()\n        if !from.description.isEmpty {\n            description.append(\" LIMIT \\(from.description)\")\n            let to = expressionConvertibleTo.asExpression()\n            if !to.description.isEmpty {\n                description.append(\", \\(to.description)\")\n            }\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(_ expressionConvertibleLimit: ExpressionConvertible) -> StatementDelete {\n        let limit = expressionConvertibleLimit.asExpression()\n        if !limit.description.isEmpty {\n            description.append(\" LIMIT \\(limit.description)\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(_ expressionConvertibleLimit: ExpressionConvertible,\n                      offset expressionConvertibleOffset: ExpressionConvertible) -> StatementDelete {\n        let limit = expressionConvertibleLimit.asExpression()\n        if !limit.description.isEmpty {\n            description.append(\" LIMIT \\(limit.description)\")\n            let offset = expressionConvertibleOffset.asExpression()\n            if !offset.description.isEmpty {\n                description.append(\" OFFSET \\(offset.description)\")\n            }\n        }\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementDetach.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementDetach: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .detach\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func detach(schema: String) -> StatementDetach {\n        description.append(\"DETACH \\(schema)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementDropIndex.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementDropIndex: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .dropIndex\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func drop(index: String, ifExists: Bool = true) -> StatementDropIndex {\n        description.append(\"DROP INDEX \")\n        if ifExists {\n            description.append(\"IF EXISTS \")\n        }\n        description.append(index)\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementDropTable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementDropTable: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .dropTable\n    }\n\n    public init() {}\n\n    public func drop(table: String, ifExists: Bool = true) -> StatementDropTable {\n        description.append(\"DROP TABLE \")\n        if ifExists {\n            description.append(\"IF EXISTS \")\n        }\n        description.append(table)\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementExplain.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementExplain: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .explain\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func explain(_ statement: Statement) -> StatementExplain {\n        description.append(\"EXPLAIN \\(statement.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func explainQueryPlan(_ statement: Statement) -> StatementExplain {\n        description.append(\"EXPLAIN QUERY PLAN \\(statement.description)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementInsert.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementInsert: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .insert\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func insert(intoTable table: String,\n                       with columnConvertibleList: ColumnConvertible...,\n                       onConflict conflict: Conflict? = nil) -> StatementInsert {\n        return insert(intoTable: table, with: columnConvertibleList, onConflict: conflict)\n    }\n\n    @discardableResult\n    public func insert(intoTable table: String,\n                       with columnConvertibleList: [ColumnConvertible]? = nil,\n                       onConflict conflict: Conflict? = nil) -> StatementInsert {\n        description.append(\"INSERT\")\n        if conflict != nil {\n            description.append(\" OR \\(conflict!.description)\")\n        }\n        description.append(\" INTO \\(table)\")\n        if columnConvertibleList != nil {\n            description.append(\"(\\(columnConvertibleList!.joined()))\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func values(_ expressionConvertibleList: ExpressionConvertible...) -> StatementInsert {\n        return values(expressionConvertibleList)\n    }\n\n    @discardableResult\n    public func values(_ expressionConvertibleList: [ExpressionConvertible]) -> StatementInsert {\n        if !expressionConvertibleList.isEmpty {\n            description.append(\" VALUES(\\(expressionConvertibleList.joined()))\")\n        }\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementPragma.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementPragma: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .pragma\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func pragma(_ pragma: Pragma) -> StatementPragma {\n        description.append(\"PRAGMA \\(pragma.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func pragma(_ pragma: Pragma, to literalValueConvertible: LiteralValueConvertible) -> StatementPragma {\n        description.append(\"PRAGMA \\(pragma.description)=\\(literalValueConvertible.asLiteralValue().description)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementReindex.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementReindex: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .reindex\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func reindex(_ name: String) -> StatementReindex {\n        description.append(\"REINDEX \\(name)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementRelease.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementRelease: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .release\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func release(savepoint name: String) -> StatementRelease {\n        description.append(\"RELEASE \\(name)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementRollback.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementRollback: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .rollback\n    }\n\n    public init() {}\n\n    public func rollback(toSavepoint optionalName: String? = nil) -> StatementRollback {\n        description.append(\"ROLLBACK\")\n        if let name = optionalName {\n            description.append(\" TO \\(name)\")\n        }\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementSavepoint.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementSavepoint: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .savepoint\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func savepoint(_ name: String) -> StatementSavepoint {\n        description.append(\"SAVEPOINT \\(name)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementSelect.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementSelect: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .select\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func select(distinct: Bool = false,\n                       _ columnResultConvertibleList: ColumnResultConvertible...) -> StatementSelect {\n        return select(distinct: distinct, columnResultConvertibleList)\n    }\n\n    @discardableResult\n    public func select(distinct: Bool = false,\n                       _ columnResultConvertibleList: [ColumnResultConvertible]) -> StatementSelect {\n        description.append(\"SELECT \")\n        if distinct {\n            description.append(\"DISTINCT \")\n        }\n        description.append(columnResultConvertibleList.joined())\n        return self\n    }\n\n    @discardableResult\n    public func from(_ tableOrSubqueryConvertibleList: TableOrSubqueryConvertible...) -> StatementSelect {\n        return from(tableOrSubqueryConvertibleList)\n    }\n\n    @discardableResult\n    public func from(_ tableOrSubqueryConvertibleList: [TableOrSubqueryConvertible]) -> StatementSelect {\n        description.append(\" FROM \\(tableOrSubqueryConvertibleList.joined())\")\n        return self\n    }\n\n    @discardableResult\n    public func `where`(_ expressionConvertible: ExpressionConvertible) -> StatementSelect {\n        let expression = expressionConvertible.asExpression()\n        if !expression.description.isEmpty {\n            description.append(\" WHERE \\(expression.description)\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func order(by orderConvertibleList: OrderConvertible...) -> StatementSelect {\n        return order(by: orderConvertibleList)\n    }\n\n    @discardableResult\n    public func order(by orderConvertibleList: [OrderConvertible]) -> StatementSelect {\n        if !orderConvertibleList.isEmpty {\n            description.append(\" ORDER BY \\(orderConvertibleList.joined())\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(from expressionConvertibleFrom: ExpressionConvertible,\n                      to expressionConvertibleTo: ExpressionConvertible) -> StatementSelect {\n        let from = expressionConvertibleFrom.asExpression()\n        if !from.description.isEmpty {\n            description.append(\" LIMIT \\(from.description)\")\n            let to = expressionConvertibleTo.asExpression()\n            if !to.description.isEmpty {\n                description.append(\", \\(to.description)\")\n            }\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(_ expressionConvertibleLimit: ExpressionConvertible) -> StatementSelect {\n        let limit = expressionConvertibleLimit.asExpression()\n        if !limit.description.isEmpty {\n            description.append(\" LIMIT \\(limit.description)\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(_ expressionConvertibleLimit: ExpressionConvertible,\n                      offset expressionConvertibleOffset: ExpressionConvertible) -> StatementSelect {\n        let limit = expressionConvertibleLimit.asExpression()\n        if !limit.description.isEmpty {\n            description.append(\" LIMIT \\(limit.description)\")\n            let offset = expressionConvertibleOffset.asExpression()\n            if !offset.description.isEmpty {\n                description.append(\" OFFSET \\(offset.description)\")\n            }\n        }\n        return self\n    }\n\n    @discardableResult\n    public func group(by expressionConvertibleGroupList: ExpressionConvertible...) -> StatementSelect {\n        return group(by: expressionConvertibleGroupList)\n    }\n\n    @discardableResult\n    public func group(by expressionConvertibleGroupList: [ExpressionConvertible]) -> StatementSelect {\n        if !expressionConvertibleGroupList.isEmpty {\n            description.append(\" GROUP BY \\(expressionConvertibleGroupList.joined())\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func having(_ expressionConvertibleHaving: ExpressionConvertible) -> StatementSelect {\n        let having = expressionConvertibleHaving.asExpression()\n        if !having.description.isEmpty {\n            description.append(\" HAVING \\(having.description)\")\n        }\n        return self\n    }\n}\n\nextension StatementSelect: ExpressionConvertible, TableOrSubqueryConvertible {\n    public func asExpression() -> Expression {\n        return Expression(with: self)\n    }\n    public func asTableOrSubquery() -> Subquery {\n        return Subquery(with: self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementTransaction.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementTransaction: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .transaction\n    }\n\n    public init() {}\n\n    public enum TransactionType: Describable {\n        case begin\n        case commit\n        case rollback\n\n        public var description: String {\n            switch self {\n            case .begin:\n                return \"BEGIN\"\n            case .commit:\n                return \"COMMIT\"\n            case .rollback:\n                return \"ROLLBACK\"\n            }\n        }\n    }\n\n    public private(set) var transactionType: TransactionType?\n\n    public enum Mode: Describable {\n        case deferred\n        case immediate\n        case exclusive\n\n        public var description: String {\n            switch self {\n            case .deferred:\n                return \"DEFERRED\"\n            case .immediate:\n                return \"IMMEDIATE\"\n            case .exclusive:\n                return \"EXCLUSIVE\"\n            }\n        }\n    }\n\n    @discardableResult\n    public func begin(_ mode: Mode? = nil) -> StatementTransaction {\n        transactionType = .begin\n        description.append(transactionType!.description)\n        if mode != nil {\n            description.append(\" \\(mode!.description)\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func commit() -> StatementTransaction {\n        transactionType = .commit\n        description.append(transactionType!.description)\n        return self\n    }\n\n    @discardableResult\n    public func rollback() -> StatementTransaction {\n        transactionType = .rollback\n        description.append(transactionType!.description)\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementUpdate.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementUpdate: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .update\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func update(table: String, onConflict conflict: Conflict? = nil) -> StatementUpdate {\n        description.append(\"UPDATE \")\n        if conflict != nil {\n            description.append(\"OR \\(conflict!.description) \")\n        }\n        description.append(table)\n        return self\n    }\n\n    public typealias ValueType = (_: ColumnConvertible, _: ExpressionConvertible)\n\n    @discardableResult\n    public func set(_ values: [ValueType]) -> StatementUpdate {\n        let valueString = values.joined({\n            $0.0.asColumn().description + \"=\" + $0.1.asExpression().description\n        })\n        description.append(\" SET \\(valueString)\")\n        return self\n    }\n\n    @discardableResult\n    public func set(_ values: ValueType...) -> StatementUpdate {\n        return set(values)\n    }\n\n    @discardableResult\n    public func `where`(_ expressionConvertible: ExpressionConvertible) -> StatementUpdate {\n        let expression = expressionConvertible.asExpression()\n        if !expression.description.isEmpty {\n            description.append(\" WHERE \\(expression.description)\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func order(by orderConvertibleList: OrderConvertible...) -> StatementUpdate {\n        return order(by: orderConvertibleList)\n    }\n\n    @discardableResult\n    public func order(by orderConvertibleList: [OrderConvertible]) -> StatementUpdate {\n        if !orderConvertibleList.isEmpty {\n            description.append(\" ORDER BY \\(orderConvertibleList.joined())\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(from expressionConvertibleFrom: ExpressionConvertible,\n                      to expressionConvertibleTo: ExpressionConvertible) -> StatementUpdate {\n        let from = expressionConvertibleFrom.asExpression()\n        if !from.description.isEmpty {\n            description.append(\" LIMIT \\(from.description)\")\n            let to = expressionConvertibleTo.asExpression()\n            if !to.description.isEmpty {\n                description.append(\", \\(to.description)\")\n            }\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(_ expressionConvertibleLimit: ExpressionConvertible) -> StatementUpdate {\n        let limit = expressionConvertibleLimit.asExpression()\n        if !limit.description.isEmpty {\n            description.append(\" LIMIT \\(limit.description)\")\n        }\n        return self\n    }\n\n    @discardableResult\n    public func limit(_ expressionConvertibleLimit: ExpressionConvertible,\n                      offset expressionConvertibleOffset: ExpressionConvertible) -> StatementUpdate {\n        let limit = expressionConvertibleLimit.asExpression()\n        if !limit.description.isEmpty {\n            description.append(\" LIMIT \\(limit.description)\")\n            let offset = expressionConvertibleOffset.asExpression()\n            if !offset.description.isEmpty {\n                description.append(\" OFFSET \\(offset.description)\")\n            }\n        }\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/StatementVacuum.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class StatementVacuum: Statement {\n    public private(set) var description: String = \"\"\n    public var statementType: StatementType {\n        return .vacuum\n    }\n\n    public init() {}\n\n    @discardableResult\n    public func vacuum(schema: String) -> StatementVacuum {\n        description.append(\"VACUUM \\(schema)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Subquery.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class Subquery: Describable {\n    public private(set) var description: String\n\n    public init(with joinClause: JoinClause) {\n        description = \"(\\(joinClause.description))\"\n    }\n\n    public init(with statementSelect: StatementSelect) {\n        description = \"(\\(statementSelect.description))\"\n    }\n\n    public init(withTable table: String) {\n        description = table\n    }\n\n    @discardableResult\n    public func `as`(alias: String) -> Subquery {\n        description.append(\" AS \\(alias)\")\n        return self\n    }\n}\n\nextension Subquery: TableOrSubqueryConvertible {\n    public func asTableOrSubquery() -> Subquery {\n        return self\n    }\n}\n\nextension String: TableOrSubqueryConvertible {\n    public func asTableOrSubquery() -> Subquery {\n        return Subquery(withTable: self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/TableConstraint.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic final class TableConstraint: Describable {\n    public private(set) var description: String\n\n    public init(named name: String) {\n        description = \"CONSTRAINT \\(name)\"\n    }\n\n    @discardableResult\n    public func makePrimary(indexesBy columnIndexConvertibleList: ColumnIndexConvertible...) -> TableConstraint {\n        return makePrimary(indexesBy: columnIndexConvertibleList)\n    }\n\n    @discardableResult\n    public func makePrimary(indexesBy columnIndexConvertibleList: [ColumnIndexConvertible]) -> TableConstraint {\n        description.append(\" PRIMARY KEY(\\(columnIndexConvertibleList.joined()))\")\n        return self\n    }\n\n    @discardableResult\n    public func makeUnique(indexesBy columnIndexConvertibleList: ColumnIndexConvertible...) -> TableConstraint {\n        return makeUnique(indexesBy: columnIndexConvertibleList)\n    }\n\n    @discardableResult\n    public func makeUnique(indexesBy columnIndexConvertibleList: [ColumnIndexConvertible]) -> TableConstraint {\n        description.append(\" UNIQUE(\\(columnIndexConvertibleList.joined()))\")\n        return self\n    }\n\n    @discardableResult\n    public func onConflict(_ conflict: Conflict) -> TableConstraint {\n        description.append(\" ON CONFLICT \\(conflict.description)\")\n        return self\n    }\n\n    @discardableResult\n    public func check(_ expressionConvertible: ExpressionConvertible) -> TableConstraint {\n        description.append(\" CHECK\\(expressionConvertible.asExpression().description)\")\n        return self\n    }\n\n    @discardableResult\n    public func makeForeignKey(_ columnConvertibleList: ColumnConvertible...,\n                               foreignKey: ForeignKey) -> TableConstraint {\n        return makeForeignKey(columnConvertibleList, foreignKey: foreignKey)\n    }\n\n    @discardableResult\n    public func makeForeignKey(_ columnConvertibleList: [ColumnConvertible],\n                               foreignKey: ForeignKey) -> TableConstraint {\n        description.append(\" FOREIGN KEY(\\(columnConvertibleList.joined())) \\(foreignKey.description)\")\n        return self\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Tokenize.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol TokenizerInfoBase: class {\n    init(withArgc argc: Int32, andArgv argv: UnsafePointer<UnsafePointer<Int8>?>?)\n}\n\npublic protocol CursorInfoBase: class {\n    init(withInput pInput: UnsafePointer<Int8>?,\n         count: Int32,\n         tokenizerInfo: TokenizerInfoBase)\n\n    func step(pToken: inout UnsafePointer<Int8>?,\n              count: inout Int32,\n              startOffset: inout Int32,\n              endOffset: inout Int32, position: inout Int32) -> Int32\n}\n\npublic protocol ModuleBase: class {\n    static var name: String {get}\n\n    static var module: sqlite3_tokenizer_module {get}\n\n    static var address: Data {get}\n\n    static func create(argc: Int32,\n                       argv: UnsafePointer<UnsafePointer<Int8>?>?,\n                       ppTokenizer: UnsafeMutablePointer<UnsafeMutablePointer<sqlite3_tokenizer>?>?) -> Int32\n\n    static func destroy(pTokenizer optionalTokenizerPointer: UnsafeMutablePointer<sqlite3_tokenizer>?) -> Int32\n\n    static func open(pTokenizer: UnsafeMutablePointer<sqlite3_tokenizer>?,\n                     pInput: UnsafePointer<Int8>?,\n                     nBytes: Int32,\n                     ppCursor: UnsafeMutablePointer<UnsafeMutablePointer<sqlite3_tokenizer_cursor>?>?) -> Int32\n\n    static func close(pCursor optionalCursorPointer: UnsafeMutablePointer<sqlite3_tokenizer_cursor>?) -> Int32\n\n    static func next(pCursor optionalCursorPointer: UnsafeMutablePointer<sqlite3_tokenizer_cursor>?,\n                     ppToken: UnsafeMutablePointer<UnsafePointer<Int8>?>?,\n                     pnBytes: UnsafeMutablePointer<Int32>?,\n                     piStartOffset: UnsafeMutablePointer<Int32>?,\n                     piEndOffset: UnsafeMutablePointer<Int32>?,\n                     piPosition: UnsafeMutablePointer<Int32>?) -> Int32\n}\n\npublic protocol Module: ModuleBase {\n    associatedtype TokenizerInfo: TokenizerInfoBase\n\n    associatedtype CursorInfo: CursorInfoBase\n}\n\nextension Module {\n    public static func create(argc: Int32,\n                              argv: UnsafePointer<UnsafePointer<Int8>?>?,\n                              ppTokenizer: UnsafeMutablePointer<UnsafeMutablePointer<sqlite3_tokenizer>?>?) -> Int32 {\n        let tokenizerSize = MemoryLayout<Tokenizer>.size\n        let optionalTokenizerRawPointer = sqlite3_malloc(Int32(tokenizerSize))\n        guard let tokenizerRawPointer = optionalTokenizerRawPointer else {\n            return SQLITE_NOMEM\n        }\n        memset(tokenizerRawPointer, 0, tokenizerSize)\n\n        let info = TokenizerInfo(withArgc: argc, andArgv: argv)\n        let tokenizerPointer = tokenizerRawPointer.assumingMemoryBound(to: Tokenizer.self)\n        let opaqueInfo = Unmanaged.passRetained(info).toOpaque()\n        tokenizerPointer.pointee.info = opaqueInfo\n\n        ppTokenizer!.pointee = tokenizerRawPointer.assumingMemoryBound(to: sqlite3_tokenizer.self)\n\n        return SQLITE_OK\n    }\n\n    public static func destroy(pTokenizer optionalTokenizerPointer: UnsafeMutablePointer<sqlite3_tokenizer>?) -> Int32 {\n        if let tokenizerRawPointer = UnsafeMutableRawPointer(optionalTokenizerPointer) {\n            let tokenizerPointer = tokenizerRawPointer.assumingMemoryBound(to: Tokenizer.self)\n            Unmanaged<AnyObject>.fromOpaque(tokenizerPointer.pointee.info).release()\n            sqlite3_free(tokenizerRawPointer)\n        }\n        return SQLITE_OK\n    }\n\n    public static func open(pTokenizer: UnsafeMutablePointer<sqlite3_tokenizer>?,\n                            pInput: UnsafePointer<Int8>?,\n                            nBytes: Int32,\n                            ppCursor: UnsafeMutablePointer<UnsafeMutablePointer<sqlite3_tokenizer_cursor>?>?) -> Int32 {\n        var bytes: Int32 = nBytes\n        if pInput == nil {\n            bytes = 0\n        }else if bytes < 0 {\n            bytes = Int32(strlen(pInput!))\n        }\n\n        let cursorSize = MemoryLayout<Cursor>.size\n        let optionalCursorRawPointer = sqlite3_malloc(Int32(cursorSize))\n        guard let cursorRawPointer = optionalCursorRawPointer else {\n            return SQLITE_NOMEM\n        }\n        memset(cursorRawPointer, 0, cursorSize)\n\n        let tokenizerPointer = UnsafeMutableRawPointer(pTokenizer!).assumingMemoryBound(to: Tokenizer.self)\n        let cursorPointer = cursorRawPointer.assumingMemoryBound(to: Cursor.self)\n        let tokenizerInfo = Unmanaged<TokenizerInfo>.fromOpaque(tokenizerPointer.pointee.info).takeUnretainedValue()\n        let cursorInfo = CursorInfo(withInput: pInput, count: bytes, tokenizerInfo: tokenizerInfo)\n        cursorPointer.pointee.info = Unmanaged.passRetained(cursorInfo).toOpaque()\n\n        ppCursor!.pointee = cursorRawPointer.assumingMemoryBound(to: sqlite3_tokenizer_cursor.self)\n\n        return SQLITE_OK\n    }\n\n    public static func close(pCursor optionalCursorPointer: UnsafeMutablePointer<sqlite3_tokenizer_cursor>?) -> Int32 {\n        if let cursorRawPointer = UnsafeMutableRawPointer(optionalCursorPointer) {\n            let cursorPointer = cursorRawPointer.assumingMemoryBound(to: Cursor.self)\n            Unmanaged<AnyObject>.fromOpaque(cursorPointer.pointee.info).release()\n            sqlite3_free(cursorRawPointer)\n        }\n        return SQLITE_OK\n    }\n\n    public static func next(pCursor optionalCursorPointer: UnsafeMutablePointer<sqlite3_tokenizer_cursor>?,\n                            ppToken: UnsafeMutablePointer<UnsafePointer<Int8>?>?,\n                            pnBytes: UnsafeMutablePointer<Int32>?,\n                            piStartOffset: UnsafeMutablePointer<Int32>?,\n                            piEndOffset: UnsafeMutablePointer<Int32>?,\n                            piPosition: UnsafeMutablePointer<Int32>?) -> Int32 {\n        if let cursorRawPointer = UnsafeMutableRawPointer(optionalCursorPointer) {\n            let cursorPointer = cursorRawPointer.assumingMemoryBound(to: Cursor.self)\n            let cursorInfoPointer = Unmanaged<CursorInfo>.fromOpaque(cursorPointer.pointee.info)\n\n            let rc = cursorInfoPointer.takeUnretainedValue().step(pToken: &ppToken!.pointee,\n                                                                  count: &pnBytes!.pointee,\n                                                                  startOffset: &piStartOffset!.pointee,\n                                                                  endOffset: &piEndOffset!.pointee,\n                                                                  position: &piPosition!.pointee)\n            return rc\n        }\n        return SQLITE_NOMEM\n    }\n}\n\npublic struct Tokenize {\n    let module: ModuleBase.Type\n}\n\npublic struct FTSModule {\n    public let name: String\n}\n\nextension FTSModule {\n    public static let fts3 = FTSModule(name: \"fts3\")\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/abstract/Tracer.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class Tracer {\n    typealias SQLTracer = (String) -> Void // SQL\n    private var sqlTracer: SQLTracer? = nil {\n        didSet {\n            setup()\n        }\n    }\n\n    typealias PerformanceTracer = ([String: Int], Int64, Any?) -> Void // (SQL, count), cost, userInfo\n    private var performanceTracer: PerformanceTracer? = nil {\n        didSet {\n            setup()\n        }\n    }\n    var shouldAggregation = false\n    private var footprint: [String: Int] = [:]\n    private var cost: Int64 = 0\n\n    private let handle: SQLite3\n    var userInfo: Any?\n\n    init(with handle: SQLite3) {\n        self.handle = handle\n    }\n\n    deinit {\n        reportPerformance()\n    }\n\n    struct TraceType: OptionSet {\n        let rawValue: UInt32\n\n        static let stmt = TraceType(rawValue: UInt32(SQLITE_TRACE_STMT))\n        static let profile = TraceType(rawValue: UInt32(SQLITE_TRACE_PROFILE))\n    }\n\n    private var type: TraceType {\n        var type = TraceType()\n        if sqlTracer != nil {\n            type.insert(.stmt)\n        }\n        if performanceTracer != nil {\n            type.insert(.profile)\n        }\n        return type\n    }\n\n    private func setup() {\n        let traceType = self.type\n        guard !traceType.isEmpty else {\n            sqlite3_trace_v2(handle, 0, nil, nil)\n            return\n        }\n        sqlite3_trace_v2(handle, traceType.rawValue, { (flag, context, stmtPointer, costPointer) -> Int32 in\n            let traceType = TraceType(rawValue: flag)\n            let pointer = Unmanaged<Tracer>.fromOpaque(context!)\n            let tracer = pointer.takeUnretainedValue()\n\n            let stmt = OpaquePointer(stmtPointer)\n            guard let csql = sqlite3_sql(stmt) else {\n                return SQLITE_MISUSE\n            }\n            let sql = String(cString: csql)\n            switch traceType {\n            case .stmt:\n                tracer.report(sql: sql)\n            case .profile:\n                let cost: Int64 = UnsafePointer<Int64>(OpaquePointer(costPointer)!).pointee\n\n                //report last track \n                if !tracer.shouldAggregation {\n                    tracer.reportPerformance()\n                }\n\n                tracer.recordPerformance(sql: sql, cost: cost)\n            default: break\n            }\n            return SQLITE_OK\n        }, Unmanaged.passUnretained(self).toOpaque())\n    }\n\n    private func report(sql: String) {\n        guard let sqlTracer = self.sqlTracer else {\n            return\n        }\n        sqlTracer(sql)\n    }\n\n    private func reportPerformance() {\n        guard !footprint.isEmpty else {\n            return\n        }\n        guard let performanceTracer = self.performanceTracer else {\n            return\n        }\n        performanceTracer(footprint, cost, userInfo)\n        footprint.removeAll()\n        cost = 0\n    }\n\n    private func recordPerformance(sql: String, cost: Int64) {\n        self.footprint[sql] = self.footprint[sql] ?? 1\n        self.cost = cost\n    }\n\n    func trace(sql sqlTracer: @escaping SQLTracer) {\n        self.sqlTracer = sqlTracer\n    }\n\n    func track(performance performanceTracer: @escaping PerformanceTracer) {\n        self.performanceTracer = performanceTracer\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/builtin/CodableType.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/*\n * Builtin codable implementation\n *\n * .integer32:\n *      Bool, Int, Int8, Int16, Int32, UInt, UInt8, UInt16, UInt32  \n * .integer64:\n *      Int64, UInt64\n * .float:\n *      Float, Double, Date\n * .text:\n *      String, URL\n * .BLOB:\n *      Data, Array, Dictionary, Set\n *\n */\n\n//Bultin Column Codable\nextension Int8: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer32\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int32Value.toInt8()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt32())\n    }\n}\n\nextension Int16: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer32\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int32Value.toInt16()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt32())\n    }\n}\n\nextension Int32: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer32\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int32Value\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self)\n    }\n}\n\nextension Int64: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer64\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int64Value\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self)\n    }\n}\n\nextension Int: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer64\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int64Value.toInt()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt64())\n    }\n}\n\nextension UInt8: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer32\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int32Value.toUInt8()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt32())\n    }\n}\n\nextension UInt16: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer32\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int32Value.toUInt16()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt32())\n    }\n}\n\nextension UInt32: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer32\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int32Value.toUInt32()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt32())\n    }\n}\n\nextension UInt64: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer64\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int64Value.toUInt64()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt64())\n    }\n}\n\nextension UInt: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer64\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int64Value.toUInt()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt64())\n    }\n}\n\nextension Bool: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .integer32\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.int32Value.toBool()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toInt32())\n    }\n}\n\nextension Float: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .float\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.doubleValue.toFloat()\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.toDouble())\n    }\n}\n\nextension Double: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .float\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.doubleValue\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self)\n    }\n}\n\nextension String: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .text\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.stringValue\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self)\n    }\n}\n\nextension Data: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .BLOB\n    }\n    public init?(with value: FundamentalValue) {\n        self = value.dataValue\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self)\n    }\n}\n\nextension Date: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .float\n    }\n    public init?(with value: FundamentalValue) {\n        self.init(timeIntervalSince1970: value.doubleValue)\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(timeIntervalSince1970)\n    }\n}\n\nextension URL: ColumnCodable, LiteralValueConvertible, ExpressionCanBeOperated {\n    public static var columnType: ColumnType {\n        return .text\n    }\n    public init?(with value: FundamentalValue) {\n        self.init(string: value.stringValue)\n    }\n    public func archivedValue() -> FundamentalValue {\n        return FundamentalValue(self.absoluteString)\n    }\n}\n\nextension Array: ColumnCodable where Element: Codable {\n    public static var columnType: ColumnType {\n        return .BLOB\n    }\n    public init?(with value: FundamentalValue) {\n        guard let decodable = try? JSONDecoder().decode(Array.self, from: value.dataValue) else {\n            return nil\n        }\n        self = decodable\n    }\n    public func archivedValue() -> FundamentalValue {\n        guard let encoded = try? JSONEncoder().encode(self) else {\n            return FundamentalValue(nil)\n        }\n        return FundamentalValue(encoded)\n    }\n}\n\nextension Dictionary: ColumnCodable where Key: Codable, Value: Codable {\n    public static var columnType: ColumnType {\n        return .BLOB\n    }\n    public init?(with value: FundamentalValue) {\n        guard let decodable = try? JSONDecoder().decode(Dictionary.self, from: value.dataValue) else {\n            return nil\n        }\n        self = decodable\n    }\n    public func archivedValue() -> FundamentalValue {\n        guard let encoded = try? JSONEncoder().encode(self) else {\n            return FundamentalValue(nil)\n        }\n        return FundamentalValue(encoded)\n    }\n}\n\nextension Set: ColumnCodable where Element: Codable {\n    public static var columnType: ColumnType {\n        return .BLOB\n    }\n    public init?(with value: FundamentalValue) {\n        guard let decodable = try? JSONDecoder().decode(Set.self, from: value.dataValue) else {\n            return nil\n        }\n        self = decodable\n    }\n    public func archivedValue() -> FundamentalValue {\n        guard let encoded = try? JSONEncoder().encode(self) else {\n            return FundamentalValue(nil)\n        }\n        return FundamentalValue(encoded)\n    }\n}\n\n//JSONCodable\npublic protocol ColumnJSONEncodable: ColumnEncodable {}\nextension ColumnJSONEncodable {\n    public func archivedValue() -> FundamentalValue {\n        guard let encoded = try? JSONEncoder().encode(self) else {\n            return FundamentalValue(nil)\n        }\n        return FundamentalValue(encoded)\n    }\n}\n\npublic protocol ColumnJSONDecodable: ColumnDecodable {}\nextension ColumnJSONDecodable {\n    public init?(with value: FundamentalValue) {\n        guard let decodable = try? JSONDecoder().decode(Self.self, from: value.dataValue) else {\n            return nil\n        }\n        self = decodable\n    }\n}\n\npublic protocol ColumnJSONCodable: ColumnJSONEncodable, ColumnJSONDecodable {}\nextension ColumnJSONCodable {\n    public static var columnType: ColumnType {\n        return .BLOB\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/builtin/CommonStatement.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class CommonStatement {\n    public static let enableFullfsync = StatementPragma().pragma(.fullfsync, to: true)\n\n    public static let getJournalMode = StatementPragma().pragma(.journalMode)\n    public static let enableJournalModeWAL = StatementPragma().pragma(.journalMode, to: \"WAL\")\n\n    public static let enableSynchronousNormal = StatementPragma().pragma(.synchronous, to: \"NORMAL\")\n    public static let enableSynchronousFull = StatementPragma().pragma(.synchronous, to: \"FULL\")\n\n    public static let getLockingMode = StatementPragma().pragma(.lockingMode)\n    public static let enableLockingModeNormal = StatementPragma().pragma(.lockingMode, to: \"NORMAL\")\n\n    public static let checkpoint = StatementPragma().pragma(.walCheckpoint)\n\n    public static let fts3Tokenizer = StatementSelect()\n        .select(Expression.function(named: \"fts3_tokenizer\",\n                                    Array(repeating: Expression.bindParameter, count: 2))\n    )\n\n    public static let beginTransactionImmediate = StatementTransaction().begin(.immediate)\n    public static let commitTransaction = StatementTransaction().commit()\n    public static let rollbackTransaction = StatementTransaction().rollback()\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/builtin/Master.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct Master: TableCodable {\n    public static let builtinTableName: String = \"sqlite_master\"\n\n    public var type: String?\n    public var name: String?\n    public var tableName: String?\n    public var rootpage: Int?\n    public var sql: String?\n\n    public enum CodingKeys: String, CodingTableKey {\n        public typealias Root = Master\n\n        case type\n        case name\n        case tableName = \"tbl_name\"\n        case rootpage\n        case sql\n\n        public static let objectRelationalMapping = TableBinding(Master.CodingKeys.self)\n    }\n\n    public init() {}\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/base/Config.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n//TODO: refactor for configs\npublic struct Configs {\n    public typealias Callback = Config.Callback\n    public typealias Order = Config.Order\n\n    public struct Config: Equatable {\n        public typealias Callback = (Handle) throws -> Void\n        typealias TaggedCallback = Tagged<Callback>\n        public typealias Order = Int\n\n        let name: String\n        let callback: TaggedCallback?\n        let order: Order\n\n        init(named name: String, with callback: @escaping Callback, orderBy order: Order) {\n            self.name = name\n            self.callback = Tagged(callback)\n            self.order = order\n        }\n\n        init(emptyConfigNamed name: String, orderBy order: Order) {\n            self.name = name\n            self.callback = nil\n            self.order = order\n        }\n\n        public static func == (lhs: Config, rhs: Config) -> Bool {\n            return lhs.name == rhs.name && lhs.callback == rhs.callback && lhs.order == rhs.order\n        }\n    }\n\n    private var configs = ContiguousArray<Config>()\n\n    init(_ configs: ContiguousArray<Config>) {\n        self.configs = configs\n    }\n\n    mutating func setConfig(named name: String, with callback: @escaping Callback, orderBy order: Order) {\n        var inserted: Bool = false\n        var newConfigs: ContiguousArray<Config> = configs.reduce(into: ContiguousArray<Config>()) { (result, config) in\n            if !inserted && order < config.order {\n                result.append(Config(named: name, with: callback, orderBy: order))\n                inserted = true\n            } else if name != config.name {\n                result.append(config)\n            }\n        }\n        if !inserted {\n            newConfigs.append(Config(named: name, with: callback, orderBy: order))\n        }\n        configs = newConfigs\n    }\n\n    mutating func setConfig(named name: String, with callback: @escaping Callback) {\n        var inserted: Bool = false\n        var newConfigs: ContiguousArray<Config> = configs.reduce(into: ContiguousArray<Config>()) { (result, config) in\n            if name != config.name {\n                result.append(config)\n            } else {\n                result.append(Config(named: name, with: callback, orderBy: config.order))\n                inserted = true\n            }\n        }\n        if !inserted {\n            newConfigs.append(Config(named: name, with: callback, orderBy: Order.max))\n        }\n        configs = newConfigs\n    }\n\n    func invoke(handle: Handle) throws {\n        let configs = self.configs\n        for config in configs {\n            try config.callback?.value(handle)\n        }\n    }\n\n    func config(by name: String) -> Callback? {\n        let configs = self.configs\n        return configs.first { $0.name == name }?.callback?.value\n    }\n}\n\nextension Configs: Equatable {\n    public static func == (lhs: Configs, rhs: Configs) -> Bool {\n        guard lhs.configs.count == rhs.configs.count else {\n            return false\n        }\n        for i in 0..<lhs.configs.count {\n            guard lhs.configs[i] == rhs.configs[i] else {\n                return false\n            }\n        }\n        return true\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/base/Core.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic class Core: CoreRepresentable {\n    final let recyclableHandlePool: RecyclableHandlePool\n    final var handlePool: HandlePool {\n        return recyclableHandlePool.raw\n    }\n\n    /// The tag of the related database.\n    public var tag: Tag? {\n        return handlePool.tag\n    }\n\n    /// The path of the related database.\n    public final var path: String {\n        return handlePool.path\n    }\n\n    init(with recyclableHandlePool: RecyclableHandlePool) {\n        self.recyclableHandlePool = recyclableHandlePool\n    }\n\n    final func prepare(_ statement: Statement,\n                       in recyclableHandle: RecyclableHandle) throws -> RecyclableHandleStatement {\n        assert(statement.statementType != .transaction,\n               \"Using [begin], [commit], [rollback] or [Exec] method to do a transaction\")\n        let handleStatement = try recyclableHandle.raw.handle.prepare(statement)\n        return RecyclableHandleStatement(recyclableHandle: recyclableHandle, handleStatement: handleStatement)\n    }\n\n    final func exec(_ statement: Statement, in recyclableHandle: RecyclableHandle) throws {\n        assert(statement.statementType != .transaction,\n               \"Using [begin], [commit], [rollback] method to do a transaction\")\n        return try recyclableHandle.raw.handle.exec(statement)\n    }\n\n    func prepare(_ statement: Statement) throws -> RecyclableHandleStatement {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func exec(_ statement: Statement) throws {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    /// Prepare a specific sql.  \n    /// Note that you can use this interface to prepare a SQL that is not contained in the WCDB interface layer\n    ///\n    /// - Parameter statement: WINQ statement\n    /// - Returns: CoreStatement\n    /// - Throws: `Error`\n    public func prepare(_ statement: Statement) throws -> CoreStatement {\n        return CoreStatement(with: self, and: try prepare(statement))\n    }\n\n    public func isTableExists(_ table: String) throws -> Bool {\n        let statementSelect = StatementSelect().select(1).from(table).limit(0)\n        Error.threadedSlient.value = true; defer { Error.threadedSlient.value = false }\n        do {\n            let handleStatement: RecyclableHandleStatement = try prepare(statementSelect)\n            try handleStatement.raw.step()\n            return true\n        } catch let error as Error {\n            guard error.code.value == Int(SQLITE_ERROR) else {\n                throw error\n            }\n        }\n        return false\n    }\n\n    func begin(_ mode: StatementTransaction.Mode = .immediate) throws {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func commit() throws {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func rollback() throws {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    public typealias TransactionClosure = () throws -> Void\n\n    public typealias ControlableTransactionClosure = () throws -> Bool\n\n    /// Run a transaction in closure\n    ///\n    ///     try database.run(transaction: { () throws -> Void in \n    ///         try database.insert(objects: objects, intoTable: table)\n    ///     })\n    ///\n    /// - Parameter transaction: Operation inside transaction\n    /// - Throws: `Error`\n    public func run(transaction: TransactionClosure) throws {\n        try begin(.immediate)\n        do {\n            try transaction()\n            try commit()\n        } catch let error {\n            try? rollback()\n            throw error\n        }\n    }\n\n    /// Run a controllable transaction in closure\n    ///\n    ///     try database.run(controllableTransaction: { () throws -> Bool in \n    ///         try database.insert(objects: objects, intoTable: table)\n    ///         return true // return true to commit transaction and return false to rollback transaction.\n    ///     })\n    ///\n    /// - Parameter controllableTransaction: Operation inside transaction\n    /// - Throws: `Error`\n    public func run(controllableTransaction: ControlableTransactionClosure) throws {\n        try begin(.immediate)\n        var shouldRollback = true\n        do {\n            if try controllableTransaction() {\n                try commit()\n            } else {\n                shouldRollback = false\n                try rollback()\n            }\n        } catch let error {\n            if shouldRollback {\n                try? rollback()\n            }\n            throw error\n        }\n    }\n\n    func run(embeddedTransaction: TransactionClosure) throws {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n}\n\nprotocol CoreRepresentable: class {\n    var tag: Tag? {get}\n    var path: String {get}\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/base/CoreStatement.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// CoreStatement for preparing or executing WINQ sql.\npublic final class CoreStatement {\n    private let core: Core\n    private let recyclableHandleStatement: RecyclableHandleStatement\n\n    init(with core: Core, and recyclableHandleStatement: RecyclableHandleStatement) {\n        self.core = core\n        self.recyclableHandleStatement = recyclableHandleStatement\n    }\n\n    private var handleStatement: HandleStatement {\n        return recyclableHandleStatement.raw\n    }\n\n    /// The wrapper of `sqlite3_bind_*` for binding property of object to index.\n    ///\n    /// - Parameters:\n    ///   - propertyConvertible: `Property` or `CodingTableKey`\n    ///   - object: Table encodable object\n    ///   - index: Begin with 1\n    /// - Throws: `Error`\n    public func bind<TableEncodableType: TableEncodable>(\n        _ propertyConvertible: PropertyConvertible,\n        of object: TableEncodableType,\n        toIndex index: Int = 1) throws {\n        try bind([(propertyConvertible, toIndex: index)], of: object)\n    }\n\n    /// The wrapper of `sqlite3_bind_*` for binding properties of object to indexes.\n    ///\n    /// - Parameters:\n    ///   - indexedPropertyConvertibleList: Indexed `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    /// - Throws: Begin with 1\n    public func bind<TableEncodableType: TableEncodable>(\n        _ indexedPropertyConvertibleList: [(_: PropertyConvertible, toIndex: Int)],\n        of object: TableEncodableType) throws {\n        var hashedKeys: TableEncoder.HashedKey = [:]\n        for args in indexedPropertyConvertibleList {\n            hashedKeys[args.0.codingTableKey.stringValue.hashValue] = args.toIndex\n        }\n        let encoder = TableEncoder(hashedKeys, on: recyclableHandleStatement)\n        try object.encode(to: encoder)\n    }\n\n    /// The wrapper of `sqlite3_bind_*` for binding properties of object.\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    /// - Throws: Begin with 1\n    public func bind<TableEncodableType: TableEncodable>(\n        _ propertyConvertibleList: [PropertyConvertible],\n        of object: TableEncodableType) throws {\n        var hashedKeys: TableEncoder.HashedKey = [:]\n        for (index, propertyConvertible) in propertyConvertibleList.enumerated() {\n            hashedKeys[propertyConvertible.codingTableKey.stringValue.hashValue] = index\n        }\n        let encoder = TableEncoder(hashedKeys, on: recyclableHandleStatement)\n        try object.encode(to: encoder)\n    }\n\n    /// The wrapper of `sqlite3_bind_*` for binding column encodable object.\n    ///\n    /// - Parameters:\n    ///   - value: Column encodable object\n    ///   - index: Begin with 1\n    public func bind(_ value: ColumnEncodable?, toIndex index: Int) {\n        guard let bindingValue = value?.archivedValue() else {\n            handleStatement.bind(nil, toIndex: index)\n            return\n        }\n        handleStatement.bind(bindingValue, toIndex: index)\n    }\n\n    /// The wrapper of `sqlite3_column_*` for getting column decodable value.\n    ///\n    /// - Parameters:\n    ///   - index: Begin with 0\n    ///   - type: Type of column codable object\n    /// - Returns: Same as type\n    public func value(atIndex index: Int, of type: ColumnDecodable.Type) -> ColumnDecodable? {\n        guard handleStatement.columnType(atIndex: index) != .null else {\n            return nil\n        }\n        return type.init(with: handleStatement.columnValue(atIndex: index))\n    }\n\n    /// The wrapper of `sqlite3_column_*` for getting column decodable value.\n    ///\n    /// - Parameters:\n    ///   - index: Begin with 0\n    ///   - type: Type of column codable object\n    /// - Returns: Same as type\n    public func value<ColumnDecodableType: ColumnDecodable>(\n        atIndex index: Int,\n        of type: ColumnDecodableType.Type = ColumnDecodableType.self) -> ColumnDecodableType? {\n        guard handleStatement.columnType(atIndex: index) != .null else {\n            return nil\n        }\n        return type.init(with: handleStatement.columnValue(atIndex: index))\n    }\n\n    /// The wrapper of `sqlite3_column_*` for getting fundamentable value.\n    ///\n    /// - Parameter index: Begin with 0\n    /// - Returns: `Int32`, `Int64`, `Double`, `String`, `Data` or `nil` value.\n    public func value(atIndex index: Int) -> FundamentalValue {\n        switch handleStatement.columnType(atIndex: index) {\n        case .integer32:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Int32.self))\n        case .integer64:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Int64.self))\n        case .float:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Double.self))\n        case .text:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: String.self))\n        case .BLOB:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Data.self))\n        case .null:\n            return FundamentalValue(nil)\n        }\n    }\n\n    /// The wrapper of `sqlite3_column_*` for getting column decodable value.\n    ///\n    /// - Parameters:\n    ///   - name: Name of the column\n    ///   - type: Type of column codable object\n    /// - Returns: Same as type. Nil will be returned if no such a column.\n    public func value<ColumnDecodableType: ColumnDecodable>(\n        byName name: String,\n        of type: ColumnDecodableType.Type = ColumnDecodableType.self) -> ColumnDecodableType? {\n        guard let index = index(byName: name) else {\n            return nil\n        }\n        return value(atIndex: index)\n    }\n\n    /// Get index by column name.\n    ///\n    /// - Parameter name: Name of the column\n    /// - Returns: Index of given column name. Nil will be returned if no such a column.\n    public func index(byName name: String) -> Int? {\n        for index in 0..<handleStatement.columnCount() {\n            if handleStatement.columnName(atIndex: index)==name {\n                return index\n            }\n        }\n        return nil\n    }\n\n    /// The wrapper of `sqlite3_step`\n    ///\n    /// - Returns: True means you can continue stepping while false means the stepping has been completed. \n    /// - Throws: `Error`\n    @discardableResult\n    public func step() throws -> Bool {\n        return try handleStatement.step()\n    }\n\n    /// The wrapper of `sqlite3_reset`\n    ///\n    /// - Throws: `Error`\n    public func reset() throws {\n        try handleStatement.reset()\n    }\n\n    /// The wrapper of `sqlite3_column_type`\n    ///\n    /// - Parameter index: Begin with 0\n    /// - Returns: Type of the column\n    public func columnType(atIndex index: Int) -> ColumnType {\n        return handleStatement.columnType(atIndex: index)\n    }\n\n    /// The wrapper of `sqlite3_column_type`\n    ///\n    /// - Parameter name: Name of the column\n    /// - Returns: Column type. For a non-exists column, `.null` will be returned.\n    public func columnType(byName name: String) -> ColumnType {\n        guard let index = index(byName: name) else {\n            return .null\n        }\n        return columnType(atIndex: index)\n    }\n\n    /// The wrapper of `sqlite3_column_count`.\n    ///\n    /// - Returns: Count of column result\n    public func columnCount() -> Int {\n        return handleStatement.columnCount()\n    }\n\n    /// The wrapper of `sqlite3_column_name`.\n    ///\n    /// - Parameter index: Begin with 0\n    /// - Returns: Column name\n    public func columnName(atIndex index: Int) -> String {\n        return handleStatement.columnName(atIndex: index)\n    }\n\n    /// The wrapper of `sqlite3_column_table_name`.\n    ///\n    /// - Parameter index: Begin with 0\n    /// - Returns: The related table of column at index\n    public func columnTableName(atIndex index: Int) -> String {\n        return handleStatement.columnTableName(atIndex: index)\n    }\n\n    /// The wrapper of `sqlite3_finalize`\n    ///\n    /// - Throws: `Error`\n    public func finalize() throws {\n        try handleStatement.finalize()\n    }\n\n    /// The number of changed rows in the most recent call.  \n    /// It should be called after executing successfully\n    public var changes: Int {\n        return handleStatement.changes\n    }\n\n    /// The row id of most recent insertion.\n    public var lastInsertedRowID: Int64 {\n        return handleStatement.lastInsertedRowID\n    }\n}\n\nextension CoreStatement {\n\n    /// The tag of the related database. \n    public var tag: Tag? {\n        return core.tag\n    }\n\n    /// The path of the related database. \n    public var path: String {\n        return core.path\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/base/Database.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n#if WCDB_IOS\nimport UIKit\n#endif //WCDB_IOS\n\n/// Thread-safe Database object\npublic final class Database: Core {\n\n    /// Init a database from path.  \n    /// Note that all database objects with same path share the same core.\n    /// So you can create multiple database objects. WCDB will manage them automatically.  \n    /// Note that WCDB will not generate a sqlite handle until the first operation, \n    /// which is also called as lazy initialization.\n    ///\n    /// - Parameter path: Path to your database\n    public convenience init(withPath path: String) {\n        self.init(withFileURL: URL(fileURLWithPath: path))\n    }\n\n    /// Init a database from file url.  \n    /// Note that all database objects with same path share the same core. \n    /// So you can create multiple database objects. WCDB will manage them automatically.  \n    /// Note that WCDB will not generate a sqlite handle until the first operation, \n    /// which is also called as lazy initialization.\n    ///\n    /// - Parameter url: File url to your database\n    public init(withFileURL url: URL) {\n        #if swift(>=4.2)\n        #else\n            Error.fatalError(\"Swift 4.2 is required.\")\n        #endif\n        #if WCDB_IOS\n            DispatchQueue.once(name: \"com.Tencent.WCDB.swift.purge\", {\n                let purgeFreeHandleQueue: DispatchQueue = DispatchQueue(label: \"com.Tencent.WCDB.swift.purge\")\n                _ = NotificationCenter.default.addObserver(\n                    forName: UIApplication.didReceiveMemoryWarningNotification,\n                    object: nil,\n                    queue: nil,\n                    using: { (_) in\n                        purgeFreeHandleQueue.async {\n                            Database.purge()\n                        }\n                    })\n            })\n        #endif //WCDB_IOS     \n        super.init(with: HandlePool.getPool(withPath: url.standardizedFileURL.path,\n                                            defaultConfigs: Database.defaultConfigs))\n    }\n\n    /// Init a database from existing tag.  \n    /// Note that all database objects with same path share the same core. \n    /// So you can create multiple database objects. WCDB will manage them automatically.  \n    /// Note that WCDB will not generate a sqlite handle until the first operation, \n    /// which is also called as lazy initialization.  \n    ///\n    /// - Parameter tag: An existing tag.\n    /// - Throws: `Error` while tag is not exists\n    public init(withExistingTag tag: Tag) throws {\n        super.init(with: try HandlePool.getExistingPool(with: tag))\n    }\n\n    init(withExistingPath path: String) throws {\n        super.init(with: try HandlePool.getExistingPool(withPath: path))\n    }\n\n    /// The tag of the database. Default to nil.  \n    /// You should set it on a database and can get it from all kind of Core objects, \n    /// including `Database`, `Table`, `Transaction`, `Select`, `RowSelect`, `MultiSelect`, `Insert`, `Delete`, \n    /// `Update` and so on.   \n    /// Note that core objects with same path share this tag, even they are not the same object.\n    ///\n    ///     let database1 = Database(withPath: path)\n    ///     let database2 = Database(withPath: path)\n    ///     database1.tag = 1\n    ///     print(\"Tag: \\(database2.tag!)\") // print 1\n    ///\n    public override var tag: Tag? {\n        get {\n            return handlePool.tag\n        }\n        set {\n            handlePool.tag = newValue\n        }\n    }\n\n    private static var threadedHandles = ThreadLocal<[String: RecyclableHandle]>(defaultTo: [:])\n\n    private func flowOut() throws -> RecyclableHandle {\n        let threadedHandles = Database.threadedHandles.value\n        if let handle = threadedHandles[path] {\n            return handle\n        }\n        return try handlePool.flowOut()\n    }\n\n    /// Since WCDB is using lazy initialization, \n    /// `init(withPath:)`, `init(withFileURL:)` never failed even the database can't open. \n    /// So you can call this to check whether the database can be opened.  \n    /// Return false if an error occurs during sqlite handle initialization.\n    public var canOpen: Bool {\n        return !handlePool.isDrained || ((try? handlePool.fillOne()) != nil)\n    }\n\n    /// Check database is already opened.\n    public var isOpened: Bool {\n        return !handlePool.isDrained\n    }\n\n    /// Check whether database is blockaded.\n    public var isBlockaded: Bool {\n        return handlePool.isBlockaded\n    }\n\n    public typealias OnClosed = HandlePool.OnDrained\n\n    /// Close the database.  \n    ///     Since Multi-threaded operation is supported in WCDB, \n    ///     other operations in different thread can open the closed database. \n    ///     So this method can make sure database is closed in the `onClosed` block. \n    ///     All other operations will be blocked until this method returns.\n    ///\n    /// A close operation consists of 4 steps:  \n    ///     1. `blockade`, which blocks all other operations.  \n    ///     2. `close`, which waits until all sqlite handles return and closes them.  \n    ///     3. `onClosed`, which trigger the callback.  \n    ///     4. `unblokade`, which unblocks all other opreations.  \n    ///\n    /// You can simply call `close:` to do all steps above or call these separately.  \n    /// Since this method will wait until all sqlite handles return, it may lead to deadlock in some bad practice. \n    ///     The key to avoid deadlock is to make sure all WCDB objects in current thread is dealloced. In detail:  \n    ///     1. You should not keep WCDB objects, including `Insert`, `Delete`, `Update`, `Select`, `RowSelect`, \n    ///        `MultiSelect`, `CoreStatement`, `Transaction`. These objects should not be kept.  \n    ///        You should get them, use them, then release them right away.  \n    ///     2. WCDB objects may not be out of its' scope.  \n    ///     The best practice is to call `close:` in sub-thread and display a loading animation in main thread.  \n    ///\n    ///     //close directly\n    ///     database.close(onClosed: { () throws -> Void in\n    ///         //do something on this closed database\n    ///     })\n    ///\n    ///     //close separately\n    ///     database.blockade()\n    ///     database.close()\n    ///     //do something on this closed database\n    ///     database.unblockade()\n    ///\n    /// - Parameter onClosed: Trigger on database closed.\n    /// - Throws: Rethrows your error.\n    public func close(onClosed: OnClosed) rethrows {\n        try handlePool.drain(onDrained: onClosed)\n    }\n\n    /// Close the database.\n    public func close() {\n        handlePool.drain()\n    }\n\n    /// Blockade the database.\n    public func blockade() {\n        handlePool.blockade()\n    }\n\n    /// Unblockade the database.\n    public func unblockade() {\n        handlePool.unblockade()\n    }\n\n    /// Purge all unused memory of this database.  \n    /// WCDB will cache and reuse some sqlite handles to improve performance.   \n    /// The max count of free sqlite handles is same\n    /// as the number of concurrent threads supported by the hardware implementation.  \n    /// You can call it to save some memory.\n    public func purge() {\n        handlePool.purgeFreeHandles()\n    }\n\n    /// Purge all unused memory of all databases.  \n    /// Note that WCDB will call this interface automatically while it receives memory warning on iOS.\n    public static func purge() {\n        HandlePool.purgeFreeHandlesInAllPools()\n    }\n\n    override func prepare(_ statement: Statement) throws -> RecyclableHandleStatement {\n        let recyclableHandle = try flowOut()\n        return try prepare(statement, in: recyclableHandle)\n    }\n\n    /// Exec a specific sql.  \n    /// Note that you can use this interface to execute a SQL that is not contained in the WCDB interface layer. \n    ///\n    /// - Parameter statement: WINQ statement\n    /// - Throws: `Error`\n    public override func exec(_ statement: Statement) throws {\n        try exec(statement, in: flowOut())\n    }\n\n    /// Separate interface of `run(transaction:)`  \n    /// You should call `begin`, `commit`, `rollback` and all other operations in same thread.  \n    /// To do a cross-thread transaction, use `getTransaction`.\n    /// - Throws: `Error`\n    public override func begin(_ mode: StatementTransaction.Mode = .immediate) throws {\n        let statement = mode == .immediate ?\n            CommonStatement.beginTransactionImmediate :\n            StatementTransaction().begin(mode)\n        let recyableHandlePool = try flowOut()\n        try recyableHandlePool.raw.handle.exec(statement)\n        Database.threadedHandles.value[path] = recyableHandlePool\n    }\n\n    /// Separate interface of `run(transaction:)`  \n    /// You should call `begin`, `commit`, `rollback` and all other operations in same thread. \n    /// To do a cross-thread transaction, use `getTransaction`.\n    /// - Throws: `Error`\n    public override func commit() throws {\n        let recyableHandlePool = try flowOut()\n        try recyableHandlePool.raw.handle.exec(CommonStatement.commitTransaction)\n        Database.threadedHandles.value.removeValue(forKey: path)\n    }\n\n    /// Separate interface of run(transaction:)\n    /// You should call `begin`, `commit`, `rollback` and all other operations in same thread.  \n    /// To do a cross-thread transaction, use `getTransaction`.\n    /// - Throws: `Error`\n    public override func rollback() throws {\n        Database.threadedHandles.value.removeValue(forKey: path)\n        let recyableHandlePool = try flowOut()\n        try recyableHandlePool.raw.handle.exec(CommonStatement.rollbackTransaction)\n    }\n\n    /// Run a embedded transaction in closure  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction, \n    /// otherwise it will be executed within the existing transaction.\n    ///\n    ///     try database.run(embeddedTransaction: { () throws -> Void in \n    ///         try database.insert(objects: objects, intoTable: table)\n    ///     })\n    ///\n    /// - Parameter embeddedTransaction: Operation inside transaction\n    /// - Throws: `Error`\n    public override func run(embeddedTransaction: TransactionClosure) throws {\n        if Database.threadedHandles.value[path] != nil {\n            return try embeddedTransaction()\n        }\n        return try run(transaction: embeddedTransaction)\n    }\n}\n\n//Config\nextension Database {\n\n    /// Set cipher key for a database.   \n    /// For an encrypted database, you must call it before all other operation.  \n    /// The cipher page size defaults to 4096 in WCDB, but it defaults to 1024 in other databases. \n    /// So for an existing database created by other database framework, you should set it to 1024. \n    /// Otherwise, you'd better to use cipher page size with 4096 \n    /// or simply call setCipherKey: interface to get better performance.\n    ///\n    /// - Parameters:\n    ///   - optionalKey: Cipher key. Nil for no cipher.\n    ///   - pageSize: Cipher page size.\n    public func setCipher(key optionalKey: Data?, pageSize: Int = 4096) {\n        if let key = optionalKey {\n            handlePool.setConfig(named: DefaultConfigOrder.cipher.description, with: { (handle: Handle) throws in\n                let statementPragmaPageSize = StatementPragma().pragma(.cipherPageSize, to: pageSize)\n                try handle.setCipher(key: key)\n                try handle.exec(statementPragmaPageSize)\n            })\n        } else {\n            handlePool.setConfig(named: DefaultConfigOrder.cipher.description, with: { (_) in })\n        }\n    }\n\n    public typealias PerformanceTracer = Handle.PerformanceTracer\n    public typealias SQLTracer = Handle.SQLTracer\n\n    static private var performanceTracer = Atomic<PerformanceTracer?>()\n    static private var sqlTracer = Atomic<SQLTracer?>()\n\n    /// You can register a tracer to monitor the performance of all SQLs.  \n    /// It returns  \n    /// 1. The collection of SQLs and the executions count of each SQL.  \n    /// 2. Time consuming in nanoseconds.  \n    /// 3. Tag of database.  \n    ///\n    /// Note that:  \n    /// 1. You should register trace before all db operations.   \n    /// 2. Global tracer will be recovered by db tracer.  \n    ///\n    ///     Database.globalTrace(ofPerformance: { (tag, sqls, cost) in\n    ///         if let wrappedTag = tag {\n    ///             print(\"Tag: \\(wrappedTag) \")\n    ///         }else {\n    ///             print(\"Nil tag\")\n    ///         }\n    ///         sqls.forEach({ (arg) in\n    ///             print(\"SQL: \\(arg.key) Count: \\(arg.value)\")\n    ///         })\n    ///         print(\"Total cost \\(cost) nanoseconds\")\n    ///     })\n    ///\n    /// Tracer may cause wcdb performance degradation, according to your needs to choose whether to open.\n    ///\n    /// - Parameter trace: trace. Nil to disable global preformance trace.\n    public static func globalTrace(ofPerformance trace: @escaping PerformanceTracer) {\n        performanceTracer.assign(trace)\n    }\n    public static func globalTrace(ofPerformance: Void?) {\n        performanceTracer.assign(nil)\n    }\n\n    /// You can register a tracer to monitor the execution of all SQLs.  \n    /// It returns a prepared or executed SQL.  \n    /// Note that you should register trace before all db operations.\n    ///\n    ///     Database.globalTrace(ofSQL: { (sql) in\n    ///         print(\"SQL: \\(sql)\")\n    ///     })\n    ///\n    /// Tracer may cause wcdb performance degradation, according to your needs to choose whether to open.\n    ///\n    /// - Parameter trace: trace. Nil to disable global sql trace.\n    public static func globalTrace(ofSQL trace: @escaping SQLTracer) {\n        sqlTracer.assign(trace)\n    }\n    public static func globalTrace(ofSQL: Void?) {\n        sqlTracer.assign(nil)\n    }\n\n    /// You can register a reporter to monitor all errors.\n    ///\n    ///     Database.globalTrace(ofError: { (error) in\n    ///         switch error.type {\n    ///         case .sqliteGlobal:\n    ///             debugPrint(\"[WCDB][DEBUG] \\(error.description)\")\n    ///         case .warning:\n    ///             print(\"[WCDB][WARNING] \\(error.description)\")\n    ///         default:\n    ///             print(\"[WCDB][ERROR] \\(error.description)\")\n    ///         }\n    ///      })\n    ///\n    /// - Parameter errorReporter: report\n    public static func globalTrace(ofError errorReporter: @escaping Error.Reporter) {\n        Error.setReporter(errorReporter)\n    }\n    public static func globalTrace(ofError: Void?) {\n        Error.setReporter(nil)\n    }\n    /// Reset global error trace to default trace.\n    public static func resetGlobalTraceOfError() {\n        Error.resetReporter()\n    }\n\n    private static let subthreadCheckpointDelay: TimeInterval = 2\n    private static let subthreadCheckpointPages: Int = 1000\n    private static let timedQueue = TimedQueue<String>(withDelay: subthreadCheckpointDelay)\n\n    private static let defaultConfigs: Configs = Configs(ContiguousArray<Configs.Config>(arrayLiteral:\n        Configs.Config(named: DefaultConfigOrder.fileProtection.description, with: { (handle: Handle) throws in\n            #if WCDB_IOS\n                try Handle.subfixs.forEach {\n                    try File.addFirstUserAuthenticationFileProtection(atPath: handle.path+$0)\n                }\n            #endif //WCDB_IOS\n        }, orderBy: DefaultConfigOrder.fileProtection.rawValue),\n        Configs.Config(named: DefaultConfigOrder.trace.description, with: { (handle: Handle) throws in\n            if let sqlTracer = Database.sqlTracer.raw {\n                handle.trace(sql: sqlTracer)\n            }\n            if let performanceTracer = Database.performanceTracer.raw {\n                handle.trace(performance: performanceTracer)\n            }\n        }, orderBy: DefaultConfigOrder.trace.rawValue),\n        Configs.Config(emptyConfigNamed: DefaultConfigOrder.cipher.description,\n                       orderBy: DefaultConfigOrder.cipher.rawValue),\n        Configs.Config(named: DefaultConfigOrder.basic.description, with: { (handle: Handle) throws in\n            guard !handle.isReadonly else {\n                let handleStatement = try handle.prepare(CommonStatement.getJournalMode)\n                try handleStatement.step()\n                let journalMode: String = handleStatement.columnValue(atIndex: 0)\n                try handleStatement.finalize()\n                assert(journalMode.caseInsensitiveCompare(\"WAL\") == ComparisonResult.orderedSame,\n                       \"It is not possible to open read-only WAL databases.\")\n                return\n            }\n            //Locking Mode\n            do {\n                //Get Locking Mode\n                let handleStatement = try handle.prepare(CommonStatement.getLockingMode)\n                try handleStatement.step()\n                let lockingMode: String = handleStatement.columnValue(atIndex: 0)\n                try handleStatement.finalize()\n                //Set Locking Mode\n                if lockingMode.caseInsensitiveCompare(\"NORMAL\") != ComparisonResult.orderedSame {\n                    try handle.exec(CommonStatement.enableLockingModeNormal)\n                }\n            }\n            //Synchronous\n            do {\n                try handle.exec(CommonStatement.enableSynchronousNormal)\n            }\n            //Journal Mode\n            do {\n                //Get Journal Mode\n                let handleStatement = try handle.prepare(CommonStatement.getJournalMode)\n                try handleStatement.step()\n                let journalMode: String = handleStatement.columnValue(atIndex: 0)\n                try handleStatement.finalize()\n                //Set Journal Mode\n                if journalMode.caseInsensitiveCompare(\"WAL\") != ComparisonResult.orderedSame {\n                    try handle.exec(CommonStatement.enableJournalModeWAL)\n                }\n            }\n            //Fullfsync\n            do {\n                try handle.exec(CommonStatement.enableFullfsync)\n            }\n        }, orderBy: DefaultConfigOrder.basic.rawValue),\n        Configs.Config(emptyConfigNamed: DefaultConfigOrder.synchronous.description,\n                       orderBy: DefaultConfigOrder.synchronous.rawValue),\n        Configs.Config(named: DefaultConfigOrder.checkpoint.description, with: { (handle: Handle) throws in\n            handle.register(onCommitted: { (handle, pages, _) in\n                guard pages > subthreadCheckpointPages else {\n                    return\n                }\n                DispatchQueue.once(name: \"com.Tencent.WCDB.swift.checkpoint\", {\n                    DispatchQueue(label: \"com.Tencent.WCDB.swift.checkpoint\").async {\n                        while true {\n                            Database.timedQueue.wait(untilExpired: {\n                                try? Database(withExistingPath: $0).exec(CommonStatement.checkpoint)\n                            })\n                        }\n                    }\n                })\n                Database.timedQueue.reQueue(with: handle.path)\n            })\n        }, orderBy: DefaultConfigOrder.checkpoint.rawValue),\n        Configs.Config(emptyConfigNamed: DefaultConfigOrder.tokenize.description,\n                       orderBy: DefaultConfigOrder.tokenize.rawValue)\n    ))\n\n    /// Default config order\n    public enum DefaultConfigOrder: Int, CustomStringConvertible {\n        case fileProtection = 0\n        case trace = 1\n        case cipher = 2\n        case basic = 3\n        case synchronous = 4\n        case checkpoint = 5\n        case tokenize = 6\n\n        public var description: String {\n            switch self {\n            case .fileProtection:\n                return \"fileProtection\"\n            case .trace:\n                return \"trace\"\n            case .cipher:\n                return \"cipher\"\n            case .basic:\n                return \"basic\"\n            case .synchronous:\n                return \"synchronous\"\n            case .checkpoint:\n                return \"checkpoint\"\n            case .tokenize:\n                return \"tokenize\"\n            }\n        }\n    }\n\n    public typealias Config = HandlePool.Config\n    public typealias ConfigOrder = HandlePool.ConfigOrder\n\n    /// Set config for this database.\n    ///\n    /// Since WCDB is a multi-handle database, an executing handle will not apply this config immediately.  \n    /// Instead, all handles will run this config before its next operation.\n    ///\n    ///     database.setConfig(named: \"demo\", with: { (handle: Handle) throws in\n    ///         try handle.exec(StatementPragma().pragma(.secureDelete, to: true))\n    ///     }, orderBy: 1)\n    ///\n    /// - Parameters:\n    ///   - name: The Identifier for this config\n    ///   - callback: config\n    ///   - order: The smaller number is called first\n    public func setConfig(named name: String, with callback: @escaping Config, orderBy order: ConfigOrder) {\n        handlePool.setConfig(named: name, with: callback, orderBy: order)\n    }\n\n    /// This interface is equivalent to `database.setConfig(named: name, with: callback, orederBy: Int.max)`.\n    ///\n    /// - Parameters:\n    ///   - name: The Identifier for this config\n    ///   - callback: config\n    public func setConfig(named name: String, with callback: @escaping Config) {\n        handlePool.setConfig(named: name, with: callback)\n    }\n\n    /// Set Synchronous for this database. It will disable checkpoint opti to avoid performance degradation.  \n    /// Synchronous can improve the stability of the database and reduce database damage, \n    /// but there will be performance degradation.\n    ///\n    /// - Parameter isFull: enable or disable full synchronous\n    public func setSynchronous(isFull: Bool) {\n        if isFull {\n            handlePool.setConfig(named: DefaultConfigOrder.synchronous.description, with: { (handle: Handle) throws in\n                try handle.exec(CommonStatement.enableSynchronousFull)\n            })\n            handlePool.setConfig(named: DefaultConfigOrder.checkpoint.description, with: { (handle: Handle) throws in\n            })\n        } else {\n            handlePool.setConfig(named: DefaultConfigOrder.synchronous.description, with: { (handle: Handle) throws in\n            })\n            let checkpointConfig = Database.defaultConfigs.config(\n                by: DefaultConfigOrder.checkpoint.description)\n            assert(checkpointConfig != nil,\n                   \"It should not be failed. If you think it's a bug, please report an issue to us.\")\n            handlePool.setConfig(named: DefaultConfigOrder.checkpoint.description,\n                                 with: checkpointConfig!)\n        }\n    }\n\n    /// This interface is equivalent to `database.setTokenizes(tokenizes)`\n    ///\n    /// - Parameter tokenizes: registed tokenizeName. You can use builtin tokenizer named `.WCDB` or `.Apple`\n    public func setTokenizes(_ tokenizes: Tokenize...) {\n        setTokenizes(tokenizes)\n    }\n\n    /// Setup multiple tokenizers with names for current database.\n    ///\n    /// - Parameter tokenizes: registed tokenizeName. You can use builtin tokenizer named .WCDB or .Apple\n    public func setTokenizes(_ tokenizes: [Tokenize]) {\n        handlePool.setConfig(named: DefaultConfigOrder.tokenize.description) { (handle: Handle) throws in\n            try tokenizes.forEach({ (tokenize) in\n                let module = tokenize.module\n                let handleStatement = try handle.prepare(CommonStatement.fts3Tokenizer)\n                handleStatement.bind(module.name, toIndex: 1)\n                handleStatement.bind(module.address, toIndex: 2)\n                try handleStatement.step()\n                try handleStatement.finalize()\n            })\n        }\n    }\n}\n\n//Transaction\nextension Database {\n    /// Generation a `Transaction` object to do a transaction.\n    ///\n    /// - Returns: Transaction\n    /// - Throws: `Error`\n    public func getTransaction() throws -> Transaction {\n        return Transaction(with: recyclableHandlePool, and: try flowOut())\n    }\n}\n\n//Table\nextension Database {\n    /// Get a wrapper from an existing table.\n    ///\n    /// - Parameters:\n    ///   - name: The name of the table.\n    ///   - type: A class conform to TableCodable protocol.\n    /// - Returns: Nil for a non-existent table.\n    /// - Throws: `Error`\n    public func getTable<Root: TableCodable>(\n        named name: String,\n        of type: Root.Type = Root.self) throws -> Table<Root>? {\n        guard try isTableExists(name) else {\n            return nil\n        }\n        return Table<Root>(withDatabase: self, named: name)\n    }\n}\n\n//File\nextension Database {\n    /// Subfix of paths to all database-related files.\n    public static var subfixs: [String] {\n        return Handle.subfixs\n    }\n\n    /// URLs to all database-related files.\n    public var urls: [URL] {\n        return paths.map({ (path) -> URL in\n            return URL(fileURLWithPath: path)\n        })\n    }\n\n    /// Paths to all database-related files.\n    public var paths: [String] {\n        return Database.subfixs.map({ (subfix) -> String in\n            return path+subfix\n        })\n    }\n\n    /// Remove all database-related files.  \n    /// You should call it on a closed database. Otherwise you will get a warning.\n    ///\n    /// - Throws: `Error`\n    public func removeFiles() throws {\n        if !isBlockaded || isOpened {\n            Error.warning(\"Removing files on an opened database may cause unknown results\")\n        }\n        try File.remove(files: paths)\n    }\n\n    /// This interface is equivalent `moveFiles(toDirectory:withExtraFiles:)`\n    ///\n    /// - Parameters:\n    ///   - directory: destination\n    ///   - extraFiles: extraFiles\n    /// - Throws: `Error`\n    public func moveFiles(toDirectory directory: String, withExtraFiles extraFiles: String...) throws {\n        try moveFiles(toDirectory: directory, withExtraFiles: extraFiles)\n    }\n\n    /// Move all database-related files and some extra files to directory safely.  \n    /// You should call it on a closed database. Otherwise you will get a warning and you may get a corrupted database.\n    ///\n    /// - Parameters:\n    ///   - directory: destination\n    ///   - extraFiles: extraFiles\n    /// - Throws: `Error`\n    public func moveFiles(toDirectory directory: String, withExtraFiles extraFiles: [String]) throws {\n        try File.createDirectoryWithIntermediateDirectories(atPath: directory)\n        var recovers: [String] = []\n        let paths = self.paths + extraFiles\n        do {\n            try paths.forEach({ (path) in\n                guard File.isExists(atPath: path) else {\n                    return\n                }\n                let file = path.lastPathComponent\n                let newPaths = directory.stringByAppending(pathComponent: file)\n                if File.isExists(atPath: newPaths) {\n                    try File.remove(files: [newPaths])\n                }\n                try File.hardlink(atPath: path, toPath: newPaths)\n                recovers.append(newPaths)\n            })\n        } catch let error {\n            try? File.remove(files: recovers)\n            throw error\n        }\n        try? File.remove(files: paths)\n    }\n\n    /// Get the space used by the database files.  \n    /// You should call it on a closed database. Otherwise you will get a warning.\n    ///\n    /// - Returns: The sum of files size in bytes.\n    /// - Throws: `Error`\n    public func getFilesSize() throws -> UInt64 {\n        if !isBlockaded || isOpened {\n            Error.warning(\"Getting files size on an opened database may get incorrect results\")\n        }\n        return try File.getSize(ofFiles: paths)\n    }\n}\n\n//Repair\nextension Database {\n    /// Backup metadata to recover.  \n    /// Since metadata will be changed while a table or an index is created or dropped, \n    /// you should call this periodically.\n    ///\n    /// - Parameter key: The cipher key for backup. Nil for non-encrypted.\n    /// - Throws: `Error`\n    public func backup(withKey key: Data? = nil) throws {\n        let handle = try flowOut()\n        try handle.raw.handle.backup(withKey: key)\n    }\n\n    /// Recover data from a corruped db. You'd better to recover a closed database.  \n    ///\n    /// - Parameters:\n    ///   - source: The path to the corrupted database\n    ///   - pageSize: Page size of the corrupted database. It's default to 4096 on iOS. \n    ///               Page size never change unless you can call \"PRAGMA page_size=NewPageSize\" to set it. \n    ///               Also, you can call \"PRAGMA page_size\" to check the current value while database is not corrupted.\n    ///   - databaseKey: The cipher key for corrupeted database\n    ///   - backupKey: The cipher key for backup\n    /// - Throws: `Error`\n    public func recover(fromPath source: String,\n                        withPageSize pageSize: Int32 = 4096,\n                        databaseKey: Data? = nil,\n                        backupKey: Data? = nil) throws {\n        let handle = try flowOut()\n        try handle.raw.handle.recover(fromPath: source,\n                                      withPageSize: pageSize,\n                                      databaseKey: databaseKey,\n                                      backupKey: backupKey)\n    }\n}\n\nextension Database: InsertChainCallInterface {}\nextension Database: UpdateChainCallInterface {}\nextension Database: DeleteChainCallInterface {}\nextension Database: RowSelectChainCallInterface {}\nextension Database: SelectChainCallInterface {}\nextension Database: MultiSelectChainCallInterface {}\n\nextension Database: InsertInterface {}\nextension Database: UpdateInterface {}\nextension Database: DeleteInterface {}\nextension Database: RowSelectInterface {}\nextension Database: SelectInterface {}\nextension Database: TableInterface {}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/base/HandlePool.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class HandlePool {\n    private class Wrap {\n        let handlePool: HandlePool\n        var reference: Int = 0\n        init(_ handlePool: HandlePool) {\n            self.handlePool = handlePool\n        }\n    }\n\n    private static let spin = Spin()\n    private static var pools: [String: Wrap] = [:]\n\n    static func getPool(withPath path: String, defaultConfigs: Configs) -> RecyclableHandlePool {\n        spin.lock(); defer { spin.unlock() }\n        var index = pools.index(forKey: path)\n        if index == nil {\n            let handlePool = HandlePool(withPath: path, defaultConfigs: defaultConfigs)\n            pools[path] = Wrap(handlePool)\n            index = pools.index(forKey: path)\n        }\n        return getExistingPool(atIndex: index!)\n    }\n\n    static func getExistingPool(with tag: Tag) throws -> RecyclableHandlePool {\n        spin.lock(); defer { spin.unlock() }\n        guard let index = pools.index(where: { (arg) -> Bool in\n            return arg.value.handlePool.tag == tag\n        }) else {\n            throw Error.reportCore(tag: tag,\n                                   path: \"\",\n                                   operation: .getPool,\n                                   code: .misuse,\n                                   message: \"Database with tag: \\(tag) is not exists.\")\n        }\n        return getExistingPool(atIndex: index)\n    }\n\n    static func getExistingPool(withPath path: String) throws -> RecyclableHandlePool {\n        spin.lock(); defer { spin.unlock() }\n        guard let index = pools.index(forKey: path) else {\n            throw Error.reportCore(tag: nil,\n                                   path: path,\n                                   operation: .getPool,\n                                   code: .misuse,\n                                   message: \"Database at path: \\(path) is not exists.\")\n        }\n        return getExistingPool(atIndex: index)\n    }\n\n    private static func getExistingPool(atIndex index: Dictionary<String, Wrap>.Index) -> RecyclableHandlePool {\n        let node = pools[index]\n        let path = node.key\n        var wrap = node.value\n        wrap.reference += 1\n        return Recyclable(wrap.handlePool, onRecycled: {\n            spin.lock(); defer { spin.unlock() }\n            let wrap = pools[path]!\n            wrap.reference -= 1\n            if wrap.reference == 0 {\n                pools.removeValue(forKey: path)\n            }\n        })\n    }\n\n    typealias HandleWrap = (handle: Handle, configs: Configs)\n    private let handles = ConcurrentList<HandleWrap>(withCapacityCap: maxHardwareConcurrency)\n\n    var tag: Tag?\n    let path: String\n    private let rwlock = RWLock()\n    private let aliveHandleCount = Atomic<Int>(0)\n    private var configs: Configs\n\n    private init(withPath path: String, defaultConfigs: Configs) {\n        self.path = path\n        self.configs = defaultConfigs\n    }\n\n    var isDrained: Bool {\n        return aliveHandleCount == 0\n    }\n\n    func fillOne() throws {\n        rwlock.lockRead(); defer { rwlock.unlockRead() }\n        let handle = try generate()\n        if handles.pushBack(handle) {\n            aliveHandleCount += 1\n        }\n    }\n\n    private func invoke(handleWrap: inout HandleWrap) throws {\n        let newConfigs = self.configs\n        if newConfigs != handleWrap.configs {\n            try newConfigs.invoke(handle: handleWrap.handle)\n            handleWrap.configs = newConfigs\n        }\n    }\n\n    static private let maxConcurrency = max(maxHardwareConcurrency, 64)\n    static private let maxHardwareConcurrency = ProcessInfo.processInfo.processorCount\n\n    func flowOut() throws -> RecyclableHandle {\n        var unlock = true\n        rwlock.lockRead(); defer {  if unlock { rwlock.unlockRead() } }\n        var handleWrap = handles.popBack()\n        if handleWrap == nil {\n            guard aliveHandleCount < HandlePool.maxConcurrency else {\n                throw Error.reportCore(tag: tag,\n                                       path: path,\n                                       operation: .flowOut,\n                                       code: .exceed,\n                                       message: \"The concurrency of database exceeds the max concurrency\")\n            }\n            handleWrap = try generate()\n            aliveHandleCount += 1\n            if aliveHandleCount > HandlePool.maxHardwareConcurrency {\n                var warning = \"The concurrency of database: \\(tag ?? 0) with \\(aliveHandleCount)\"\n                warning.append(\" exceeds the concurrency of hardware: \\(HandlePool.maxHardwareConcurrency)\")\n                Error.warning(warning)\n            }\n        }\n        handleWrap!.handle.tag = self.tag\n        try invoke(handleWrap: &handleWrap!)\n        unlock = false\n        return RecyclableHandle(handleWrap!, onRecycled: {\n            self.flowBack(handleWrap!)\n        })\n    }\n\n    private func flowBack(_ handleWrap: HandleWrap) {\n        let inserted = handles.pushBack(handleWrap)\n        rwlock.unlockRead()\n        if !inserted {\n            aliveHandleCount -= 1\n        }\n    }\n\n    private func generate() throws -> HandleWrap {\n        let handle = Handle(withPath: path)\n        handle.tag = tag\n        let configs = self.configs\n        try handle.open()\n        try configs.invoke(handle: handle)\n        return HandleWrap(handle: handle, configs: configs)\n    }\n\n    func blockade() {\n        rwlock.lockWrite()\n    }\n\n    func unblockade() {\n        rwlock.unlockWrite()\n    }\n\n    var isBlockaded: Bool {\n        return rwlock.isWriting\n    }\n\n    public typealias OnDrained = () throws -> Void\n\n    func drain(onDrained: OnDrained) rethrows {\n        blockade(); defer { unblockade() }\n        let size = handles.clear()\n        aliveHandleCount -= size\n        try onDrained()\n    }\n\n    func drain() {\n        blockade(); defer { unblockade() }\n        let size = handles.clear()\n        aliveHandleCount -= size\n    }\n\n    func purgeFreeHandles() {\n        rwlock.lockRead(); defer { rwlock.unlockRead() }\n        let size = handles.clear()\n        aliveHandleCount -= size\n    }\n\n    public typealias Config = Configs.Callback\n    public typealias ConfigOrder = Configs.Order\n\n    func setConfig(named name: String, with callback: @escaping Config, orderBy order: ConfigOrder) {\n        configs.setConfig(named: name, with: callback, orderBy: order)\n    }\n\n    func setConfig(named name: String, with callback: @escaping Config) {\n        configs.setConfig(named: name, with: callback)\n    }\n\n    static func purgeFreeHandlesInAllPools() {\n        let handlePools: [HandlePool]!\n        do {\n            spin.lock(); defer { spin.unlock() }\n            handlePools = pools.values.reduce(into: []) { $0.append($1.handlePool) }\n        }\n        handlePools.forEach { $0.purgeFreeHandles() }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/base/RecyclableCore.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\ntypealias RecyclableHandlePool = Recyclable<HandlePool>\n\nfinal class RecyclableHandleStatement: Recyclable<HandleStatement> {\n    private let recyclableHandle: RecyclableHandle\n\n    init(recyclableHandle: RecyclableHandle,\n         handleStatement: HandleStatement) {\n        self.recyclableHandle = recyclableHandle\n        super.init(handleStatement)\n    }\n}\n\ntypealias RecyclableHandle = Recyclable<HandlePool.HandleWrap>\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/base/Transaction.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// Thread-safe Transaction object\npublic final class Transaction: Core {\n    private let recyclableHandle: RecyclableHandle\n    /// Check whether is already in transaction.\n    public private(set) var isInTransaction: Bool = false\n    private var mutex: RecursiveMutex = RecursiveMutex()\n\n    init(with recyclableHandlePool: RecyclableHandlePool, and recyclableHandle: RecyclableHandle) {\n        self.recyclableHandle = recyclableHandle\n        super.init(with: recyclableHandlePool)\n    }\n\n    deinit {\n        if isInTransaction {\n            try? rollback()\n        }\n    }\n\n    private var handle: Handle {\n        return recyclableHandle.raw.handle\n    }\n\n    override func prepare(_ statement: Statement) throws -> RecyclableHandleStatement {\n        mutex.lock(); defer { mutex.unlock() }\n        return try prepare(statement, in: recyclableHandle)\n    }\n\n    /// Exec a specific sql.  \n    /// Note that you can use this interface to execute a SQL that is not contained in the WCDB interface layer. \n    ///\n    /// - Parameter statement: WINQ statement\n    /// - Throws: `Error`\n    public override func exec(_ statement: Statement) throws {\n        mutex.lock(); defer { mutex.unlock() }\n        try exec(statement, in: recyclableHandle)\n    }\n\n    /// Prepare a specific sql.  \n    /// Note that you can use this interface to prepare a SQL that is not contained in the WCDB interface layer\n    ///\n    /// - Parameter statement: WINQ statement\n    /// - Returns: CoreStatement\n    /// - Throws: `Error`\n    public override func prepare(_ statement: Statement) throws -> CoreStatement {\n        mutex.lock(); defer { mutex.unlock() }\n        return try super.prepare(statement)\n    }\n\n    /// Check whether table exists\n    ///\n    /// - Parameter table: The name of the table to be checked.\n    /// - Returns: True if table exists. False if table does not exist.\n    /// - Throws: `Error`\n    public override func isTableExists(_ table: String) throws -> Bool {\n        mutex.lock(); defer { mutex.unlock() }\n        return try super.isTableExists(table)\n    }\n\n    /// Run a transaction in closure\n    ///\n    ///     try transaction.run(transaction: { () throws -> Void in \n    ///         try transaction.insert(objects: objects, intoTable: table)\n    ///     })\n    ///\n    /// - Parameter transaction: Operation inside transaction\n    /// - Throws: `Error`\n    public override func run(transaction: TransactionClosure) throws {\n        mutex.lock(); defer { mutex.unlock() }\n        try super.run(transaction: transaction)\n    }\n\n    /// Run a controllable transaction in closure\n    ///\n    ///     try transaction.run(controllableTransaction: { () throws -> Bool in \n    ///         try transaction.insert(objects: objects, intoTable: table)\n    ///         return true // return true to commit transaction and return false to rollback transaction.\n    ///     })\n    ///\n    /// - Parameter controllableTransaction: Operation inside transaction\n    /// - Throws: `Error`\n    public override func run(controllableTransaction: ControlableTransactionClosure) throws {\n        mutex.lock(); defer { mutex.unlock() }\n        try super.run(controllableTransaction: controllableTransaction)\n    }\n\n    /// Separate interface of `run(transaction:)`  \n    /// You should call `begin`, `commit`, `rollback` and all other operations in same thread.  \n    /// - Throws: `Error`\n    public override func begin(_ mode: StatementTransaction.Mode = .immediate) throws {\n        mutex.lock(); defer { mutex.unlock() }\n        let statement = mode == .immediate ?\n            CommonStatement.beginTransactionImmediate :\n            StatementTransaction().begin(mode)\n        try handle.exec(statement)\n        isInTransaction = true\n    }\n\n    /// Separate interface of `run(transaction:)`  \n    /// You should call `begin`, `commit`, `rollback` and all other operations in same thread. \n    /// - Throws: `Error`\n    public override func commit() throws {\n        mutex.lock(); defer { mutex.unlock() }\n        try handle.exec(CommonStatement.commitTransaction)\n        isInTransaction = false\n    }\n\n    /// Separate interface of run(transaction:)\n    /// You should call `begin`, `commit`, `rollback` and all other operations in same thread.  \n    /// - Throws: `Error`\n    public override func rollback() throws {\n        mutex.lock(); defer { mutex.unlock() }\n        isInTransaction = false\n        try handle.exec(CommonStatement.rollbackTransaction)\n    }\n\n    /// Run a embedded transaction in closure  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction, \n    /// otherwise it will be executed within the existing transaction.\n    ///\n    ///     try transaction.run(embeddedTransaction: { () throws -> Void in \n    ///         try transaction.insert(objects: objects, intoTable: table)\n    ///     })\n    ///\n    /// - Parameter embeddedTransaction: Operation inside transaction\n    /// - Throws: `Error`\n    public override func run(embeddedTransaction: TransactionClosure) throws {\n        mutex.lock(); defer { mutex.unlock() }\n        if isInTransaction {\n            return try embeddedTransaction()\n        }\n        return try run(transaction: embeddedTransaction)\n    }\n\n    /// The number of changed rows in the most recent call.  \n    /// It should be called after executing successfully\n    public var changes: Int {\n        mutex.lock(); defer { mutex.unlock() }\n        return handle.changes\n    }\n}\n\nextension Transaction: InsertChainCallInterface {}\nextension Transaction: UpdateChainCallInterface {}\nextension Transaction: DeleteChainCallInterface {}\nextension Transaction: RowSelectChainCallInterface {}\nextension Transaction: SelectChainCallInterface {}\nextension Transaction: MultiSelectChainCallInterface {}\n\nextension Transaction: InsertInterface {}\nextension Transaction: UpdateInterface {}\nextension Transaction: DeleteInterface {}\nextension Transaction: RowSelectInterface {}\nextension Transaction: SelectInterface {}\nextension Transaction: TableInterface {}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/binding/ColumnConstraintBinding.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct ColumnConstraintBinding {\n    let isPrimary: Bool\n    let isAutoIncrement: Bool\n    let defaultValue: ColumnDef.DefaultType?\n    let conflict: Conflict?\n    let isNotNull: Bool\n    let isUnique: Bool\n    let term: OrderTerm?\n\n    public init(isPrimary: Bool = false,\n                orderBy term: OrderTerm? = nil,\n                isAutoIncrement: Bool = false,\n                onConflict conflict: Conflict? = nil,\n                isNotNull: Bool = false,\n                isUnique: Bool = false,\n                defaultTo defaultValue: ColumnDef.DefaultType? = nil) {\n        self.isPrimary = isPrimary\n        self.isAutoIncrement = isAutoIncrement\n        self.isNotNull = isNotNull\n        self.isUnique = isUnique\n        self.defaultValue = defaultValue\n        self.term = term\n        self.conflict = conflict\n    }\n\n    public init<T: ColumnEncodable>(\n        isPrimary: Bool = false,\n        orderBy term: OrderTerm? = nil,\n        isAutoIncrement: Bool = false,\n        onConflict conflict: Conflict? = nil,\n        isNotNull: Bool = false,\n        isUnique: Bool = false,\n        defaultTo defaultEncodedValue: T) {\n        var defaultValue: ColumnDef.DefaultType!\n        let value = defaultEncodedValue.archivedValue()\n        switch T.columnType {\n        case .integer32:\n            defaultValue = .int32(value.int32Value)\n        case .integer64:\n            defaultValue = .int64(value.int64Value)\n        case .text:\n            defaultValue = .text(value.stringValue)\n        case .float:\n            defaultValue = .float(value.doubleValue)\n        case .BLOB:\n            defaultValue = .BLOB(value.dataValue)\n        case .null:\n            defaultValue = .null\n        }\n        self.init(isPrimary: isPrimary,\n                  orderBy: term,\n                  isAutoIncrement: isAutoIncrement,\n                  onConflict: conflict,\n                  isNotNull: isNotNull,\n                  isUnique: isUnique,\n                  defaultTo: defaultValue)\n    }\n\n    func generateColumnDef(with rawColumnDef: ColumnDef) -> ColumnDef {\n        let columnDef = rawColumnDef\n        if isPrimary {\n            columnDef.makePrimary(orderBy: term, isAutoIncrement: isAutoIncrement, onConflict: conflict)\n        }\n        if isNotNull {\n            columnDef.makeNotNull()\n        }\n        if isUnique {\n            columnDef.makeUnique()\n        }\n        if defaultValue != nil {\n            columnDef.makeDefault(to: defaultValue!)\n        }\n        return columnDef\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/binding/IndexBinding.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\npublic struct IndexBinding {\n    public typealias Subfix = String\n\n    let columnIndexes: [ColumnIndex]\n    let isUnique: Bool\n\n    public init(isUnique: Bool = false, indexesBy columnIndexConvertibleList: [ColumnIndexConvertible]) {\n        self.columnIndexes = columnIndexConvertibleList.asIndexes()\n        self.isUnique = isUnique\n    }\n\n    public init(isUnique: Bool = false,\n                indexesBy columnIndexConvertibleList: ColumnIndexConvertible...) {\n        self.init(isUnique: isUnique, indexesBy: columnIndexConvertibleList)\n    }\n\n    func generateCreateIndexStatement(onTable tableName: String,\n                                      withIndexSubfix indexSubfix: String) -> StatementCreateIndex {\n        return StatementCreateIndex()\n            .create(index: tableName+indexSubfix,\n                    isUnique: isUnique,\n                    ifNotExists: true)\n            .on(table: tableName,\n                indexesBy: columnIndexes)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/binding/Property.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol PropertyConvertible: ColumnConvertible, PropertyRedirectable {\n    var codingTableKey: CodingTableKeyBase {get}\n\n    func asProperty() -> Property\n\n    func `in`(table: String) -> Property\n}\n\npublic typealias PropertyOperable = PropertyConvertible & ExpressionOperable\n\npublic final class Property: Describable {\n    public private(set) var description: String\n    public private(set) var codingTableKey: CodingTableKeyBase\n\n    public init(named name: String, with codingTableKey: CodingTableKeyBase) {\n        self.codingTableKey = codingTableKey\n        self.description = name\n    }\n\n    public init(with codingTableKey: CodingTableKeyBase) {\n        self.codingTableKey = codingTableKey\n        self.description = codingTableKey.stringValue\n    }\n\n    public var name: String {\n        return description\n    }\n}\n\nextension Property: PropertyOperable {\n    public func asProperty() -> Property {\n        return self\n    }\n\n    public func `in`(table: String) -> Property {\n        let column: Column = self.in(table: table)\n        return Property(named: column.description, with: codingTableKey)\n    }\n\n    public func asColumn() -> Column {\n        return Column(named: name)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/binding/Redirectable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol PropertyRedirectable {\n    func `as`(_ propertyConvertible: PropertyConvertible) -> Property\n}\n\nextension PropertyRedirectable where Self: Describable {\n    public func `as`(_ propertyConvertible: PropertyConvertible) -> Property {\n        return Property(named: description, with: propertyConvertible.codingTableKey)\n    }\n}\n\nextension Column: PropertyRedirectable {}\n\nextension ColumnResult: PropertyRedirectable {}\n\nextension Expression: PropertyRedirectable {}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/binding/TableBinding.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class TableBinding<CodingTableKeyType: CodingTableKey> {\n    private let properties: [CodingTableKeyType: Property]\n    let allProperties: [Property]\n    let allKeys: [CodingTableKeyType]\n\n    private lazy var columnTypes: [String: ColumnType] = {\n        // CodingTableKeyType.Root must conform to TableEncodable protocol.\n        let tableDecodableType = CodingTableKeyType.Root.self as! TableDecodableBase.Type\n        return ColumnTypeDecoder.types(of: tableDecodableType)\n    }()\n\n    private lazy var allColumnDef: [ColumnDef] = allKeys.map { (key) -> ColumnDef in\n        return generateColumnDef(with: key)\n    }\n\n    private typealias ColumnConstraintBindingMap = [CodingTableKeyType: ColumnConstraintBinding]\n    private lazy var columnConstraintBindings: ColumnConstraintBindingMap? = CodingTableKeyType.columnConstraintBindings\n\n    private typealias IndexBindingMap = [IndexBinding.Subfix: IndexBinding]\n    private lazy var indexBindings: IndexBindingMap? = CodingTableKeyType.indexBindings\n\n    private typealias TableConstraintBindingMap = [TableConstraintBinding.Name: TableConstraintBinding]\n    private lazy var tableConstraintBindings: TableConstraintBindingMap? = CodingTableKeyType.tableConstraintBindings\n    private lazy var virtualTableBinding: VirtualTableBinding? = CodingTableKeyType.virtualTableBinding\n\n    private lazy var primaryKey: CodingTableKeyType? = {\n        guard let filtered = columnConstraintBindings?.filter({ (args) -> Bool in\n            return args.value.isPrimary\n        }) else {\n            return nil\n        }\n        guard filtered.count == 1 else {\n            assert(filtered.count == 0, \"Only one primary key is supported. Use MultiPrimaryBinding instead\")\n            return nil\n        }\n        return filtered.first!.key\n    }()\n\n    public init(_ type: CodingTableKeyType.Type) {\n        var allProperties: [Property] = []\n        var properties: [CodingTableKeyType: Property] = [:]\n        var allKeys: [CodingTableKeyType] = []\n\n        var i = 0\n        while true {\n            guard let key = (withUnsafePointer(to: &i) {\n                return $0.withMemoryRebound(to: CodingTableKeyType?.self, capacity: 1, { return $0.pointee })\n            }) else {\n                break\n            }\n            allKeys.append(key)\n            i += 1\n        }\n\n        for key in allKeys {\n            let property = Property(with: key)\n            properties[key] = property\n            allProperties.append(property)\n        }\n\n        self.allKeys = allKeys\n        self.properties = properties\n        self.allProperties = allProperties\n\n        #if DEBUG\n        if let tableDecodableType = CodingTableKeyType.Root.self as? TableDecodableBase.Type {\n            let types = ColumnTypeDecoder.types(of: tableDecodableType)\n            let keys = allKeys.filter({ (key) -> Bool in\n                return types.index(forKey: key.stringValue) == nil\n            })\n            assert(keys.count == 0,\n                   \"\"\"\n                   The following keys: \\(keys) can't be decoded. \\\n                   1. Try to change their definition from `let` to `var` or report an issue to us. \\\n                   2. Try to rename the `static` variable with same name.\n                   \"\"\")\n        }\n        #endif\n    }\n\n    typealias TypedCodingTableKeyType = CodingTableKeyType\n    func property<CodingTableKeyType: CodingTableKey>(from codingTableKey: CodingTableKeyType) -> Property {\n        let typedCodingTableKey = codingTableKey as? TypedCodingTableKeyType\n        assert(typedCodingTableKey != nil, \"[\\(codingTableKey)] must conform to CodingTableKey protocol.\")\n        let typedProperty = properties[typedCodingTableKey!]\n        assert(typedProperty != nil, \"It should not be failed. If you think it's a bug, please report an issue to us.\")\n        return typedProperty!\n    }\n\n    func generateColumnDef(with key: CodingTableKeyBase) -> ColumnDef {\n        let codingTableKey = key as? CodingTableKeyType\n        assert(codingTableKey != nil, \"[\\(key)] must conform to CodingTableKey protocol.\")\n        let columnType = columnTypes[codingTableKey!.stringValue]\n        assert(columnType != nil, \"It should not be failed. If you think it's a bug, please report an issue to us.\")\n        var columnDef = ColumnDef(with: codingTableKey!, and: columnType!)\n        if let index = columnConstraintBindings?.index(forKey: codingTableKey!) {\n            columnDef = columnConstraintBindings![index].value.generateColumnDef(with: columnDef)\n        }\n        return columnDef\n    }\n\n    public func generateCreateVirtualTableStatement(named table: String) -> StatementCreateVirtualTable {\n        assert(virtualTableBinding != nil, \"Virtual table binding is not defined\")\n        let columnModuleArguments = allColumnDef.map { ModuleArgument(with: $0) }\n        let tableCostraintArguments = tableConstraintBindings?.map { (tableConstraintBinding) -> ModuleArgument in\n            let key = tableConstraintBinding.key\n            return ModuleArgument(with: tableConstraintBinding.value.generateConstraint(withName: key))\n        } ?? []\n        let arguments = columnModuleArguments + tableCostraintArguments + virtualTableBinding!.arguments\n        return StatementCreateVirtualTable()\n            .create(virtualTable: table)\n            .using(module: virtualTableBinding!.module,\n                   arguments: arguments)\n    }\n\n    public func generateCreateTableStatement(named table: String) -> StatementCreateTable {\n        let tableConstraints = tableConstraintBindings?.map { $0.value.generateConstraint(withName: $0.key) }\n        return StatementCreateTable().create(table: table,\n                                             with: allColumnDef,\n                                             and: tableConstraints)\n    }\n\n    public func generateCreateIndexStatements(onTable table: String) -> [StatementCreateIndex]? {\n        guard let indexBindings = self.indexBindings else {\n            return nil\n        }\n        return indexBindings.map { $0.value.generateCreateIndexStatement(onTable: table, withIndexSubfix: $0.key)}\n    }\n\n    func getPrimaryKey() -> CodingTableKeyBase? {\n        return primaryKey\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/binding/TableConstraintBinding.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol TableConstraintBinding {\n    typealias Name = String\n    func generateConstraint(withName name: String) -> TableConstraint\n}\n\npublic struct MultiPrimaryBinding: TableConstraintBinding {\n    let conflict: Conflict?\n    let columnIndexConvertibleList: [ColumnIndexConvertible]\n\n    public init(indexesBy columnIndexConvertibleList: ColumnIndexConvertible...,\n                onConflict conflict: Conflict? = nil) {\n        self.init(indexesBy: columnIndexConvertibleList, onConflict: conflict)\n    }\n\n    public init(indexesBy columnIndexConvertibleList: [ColumnIndexConvertible],\n                onConflict conflict: Conflict? = nil) {\n        self.columnIndexConvertibleList = columnIndexConvertibleList\n        self.conflict = conflict\n    }\n\n    public func generateConstraint(withName name: String) -> TableConstraint {\n        let tableConstraint = TableConstraint(named: name).makePrimary(indexesBy: columnIndexConvertibleList)\n        if let wrappedConflict = conflict {\n            tableConstraint.onConflict(wrappedConflict)\n        }\n        return tableConstraint\n    }\n}\n\npublic struct MultiUniqueBinding: TableConstraintBinding {\n    let conflict: Conflict?\n    let columnIndexConvertibleList: [ColumnIndexConvertible]\n\n    public init(indexesBy columnIndexConvertibleList: ColumnIndexConvertible...,\n                onConflict conflict: Conflict? = nil) {\n        self.init(indexesBy: columnIndexConvertibleList, onConflict: conflict)\n    }\n\n    public init(indexesBy columnIndexConvertibleList: [ColumnIndexConvertible],\n                onConflict conflict: Conflict? = nil) {\n        self.columnIndexConvertibleList = columnIndexConvertibleList\n        self.conflict = conflict\n    }\n\n    public func generateConstraint(withName name: String) -> TableConstraint {\n        let tableConstraint = TableConstraint(named: name).makeUnique(indexesBy: columnIndexConvertibleList)\n        if let wrappedConflict = conflict {\n            tableConstraint.onConflict(wrappedConflict)\n        }\n        return tableConstraint\n    }\n}\n\npublic struct CheckBinding: TableConstraintBinding {\n    let condition: Expression\n\n    public init(check condition: Expression) {\n        self.condition = condition\n    }\n\n    public func generateConstraint(withName name: String) -> TableConstraint {\n        return TableConstraint(named: name).check(condition)\n    }\n}\n\npublic struct ForeignKeyBinding: TableConstraintBinding {\n    let columnConvertibleList: [ColumnConvertible]\n    let foreignKey: ForeignKey\n\n    public init(_ columnConvertibleList: ColumnConvertible..., foreignKey: ForeignKey) {\n        self.init(columnConvertibleList, foreignKey: foreignKey)\n    }\n\n    public init(_ columnConvertibleList: [ColumnConvertible], foreignKey: ForeignKey) {\n        self.columnConvertibleList = columnConvertibleList\n        self.foreignKey = foreignKey\n    }\n\n    public func generateConstraint(withName name: String) -> TableConstraint {\n        return TableConstraint(named: name).makeForeignKey(columnConvertibleList, foreignKey: foreignKey)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/binding/VirtualTableBinding.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct VirtualTableBinding {\n    let arguments: [ModuleArgument]\n    let module: String\n\n    public init(withModule module: String, and arguments: [ModuleArgument]) {\n        self.module = module\n        self.arguments = arguments\n    }\n\n    public init(withModule module: String, and arguments: ModuleArgument...) {\n        self.init(withModule: module, and: arguments)\n    }\n\n    public init(with module: FTSModule, and arguments: [ModuleArgument]) {\n        self.init(withModule: module.name, and: arguments)\n    }\n\n    public init(with module: FTSModule, and arguments: ModuleArgument...) {\n        self.init(with: module, and: arguments)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/codable/CodingTableKey.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol CodingTableKeyBase: CodingKey {\n    var rootType: TableCodableBase.Type {get}\n}\n\npublic protocol CodingTableKey: CodingTableKeyBase,\n    Hashable,\n    PropertyOperable,\n    RawRepresentable where RawValue == String {\n    associatedtype Root: TableCodableBase\n\n    static var all: [Property] {get}\n    static var any: Column {get}\n\n    static var objectRelationalMapping: TableBinding<Self> {get}\n    static var columnConstraintBindings: [Self: ColumnConstraintBinding]? {get}\n    static var indexBindings: [IndexBinding.Subfix: IndexBinding]? {get}\n    static var tableConstraintBindings: [TableConstraintBinding.Name: TableConstraintBinding]? {get}\n    static var virtualTableBinding: VirtualTableBinding? {get}\n}\n\nextension CodingTableKey {\n    public var rootType: TableCodableBase.Type {\n        return Root.self\n    }\n}\n\nextension CodingTableKey {\n    public static var all: [Property] {\n        return objectRelationalMapping.allProperties\n    }\n    public static var any: Column {\n        return Column.all\n    }\n}\n\nextension CodingTableKey {\n    public static var columnConstraintBindings: [Self: ColumnConstraintBinding]? {\n        return nil\n    }\n\n    public static var indexBindings: [IndexBinding.Subfix: IndexBinding]? {\n        return nil\n    }\n\n    public static var tableConstraintBindings: [TableConstraintBinding.Name: TableConstraintBinding]? {\n        return nil\n    }\n\n    public static var virtualTableBinding: VirtualTableBinding? {\n        return nil\n    }\n}\n\nextension CodingTableKey {\n    public var codingTableKey: CodingTableKeyBase {\n        return self\n    }\n\n    public func `as`(_ propertyConvertible: PropertyConvertible) -> Property {\n        return Property(named: stringValue, with: propertyConvertible.codingTableKey)\n    }\n\n    public func asProperty() -> Property {\n        return Self.objectRelationalMapping.property(from: self)\n    }\n\n    public func `in`(table: String) -> Property {\n        return asProperty().`in`(table: table)\n    }\n\n    public func asExpression() -> Expression {\n        return asColumn().asExpression()\n    }\n\n    public func asColumn() -> Column {\n        return Column(named: stringValue)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/codable/ColumnCodable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n// Column \npublic protocol ColumnCodableBase {\n    static var columnType: ColumnType {get}\n}\n\npublic protocol ColumnEncodable: Encodable, ColumnCodableBase {\n    func archivedValue() -> FundamentalValue\n}\npublic extension ColumnEncodable where Self: LiteralValueConvertible {\n    func asLiteralValue() -> LiteralValue {\n        return LiteralValue(self)\n    }\n}\n\npublic protocol ColumnDecodable: Decodable, ColumnCodableBase {\n    init?(with value: FundamentalValue)\n}\n\npublic typealias ColumnCodable = ColumnCodableBase & ColumnEncodable & ColumnDecodable\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/codable/ColumnTypeDecoder.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class ColumnTypeDecoder: Decoder {\n\n    private var results: [String: ColumnType] = [:]\n\n    static func types(of type: TableDecodableBase.Type) -> [String: ColumnType] {\n        let decoder = ColumnTypeDecoder()\n        _ = try? type.init(from: decoder)\n        return decoder.results\n    }\n\n    func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key: CodingKey {\n        return KeyedDecodingContainer(ColumnTypeDecodingContainer<Key>(with: self))\n    }\n\n    private final class ColumnTypeDecodingContainer<CodingKeys: CodingKey>: KeyedDecodingContainerProtocol {\n\n        typealias Key = CodingKeys\n\n        private let decoder: ColumnTypeDecoder\n\n        private struct SizedPointer {\n            private let pointer: UnsafeMutableRawPointer\n            private let size: Int\n            init<T>(of type: T.Type = T.self) {\n                size = MemoryLayout<T>.size\n                pointer = UnsafeMutableRawPointer.allocate(byteCount: size, alignment: 1)\n                memset(pointer, 0, size)\n            }\n            func deallocate() {\n                pointer.deallocate()\n            }\n            func getPointee<T>(of type: T.Type = T.self) -> T {\n                return pointer.assumingMemoryBound(to: type).pointee\n            }\n        }\n\n        private var sizedPointers: ContiguousArray<SizedPointer>\n\n        init(with decoder: ColumnTypeDecoder) {\n            self.decoder = decoder\n            self.sizedPointers = ContiguousArray<SizedPointer>()\n        }\n\n        deinit {\n            for sizedPointer in sizedPointers {\n                sizedPointer.deallocate()\n            }\n        }\n\n        func contains(_ key: Key) -> Bool {\n            return true\n        }\n\n        func decodeNil(forKey key: Key) throws -> Bool {\n            decoder.results[key.stringValue] = Bool.columnType\n            return false\n        }\n\n        func decode(_ type: Bool.Type, forKey key: Key) throws -> Bool {\n            decoder.results[key.stringValue] = type.columnType\n            return false\n        }\n\n        func decode(_ type: Int.Type, forKey key: Key) throws -> Int {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: Int8.Type, forKey key: Key) throws -> Int8 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: Int16.Type, forKey key: Key) throws -> Int16 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: Int32.Type, forKey key: Key) throws -> Int32 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: Int64.Type, forKey key: Key) throws -> Int64 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: UInt.Type, forKey key: Key) throws -> UInt {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: UInt8.Type, forKey key: Key) throws -> UInt8 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: UInt16.Type, forKey key: Key) throws -> UInt16 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: UInt32.Type, forKey key: Key) throws -> UInt32 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: UInt64.Type, forKey key: Key) throws -> UInt64 {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: Float.Type, forKey key: Key) throws -> Float {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: Double.Type, forKey key: Key) throws -> Double {\n            decoder.results[key.stringValue] = type.columnType\n            return 0\n        }\n\n        func decode(_ type: String.Type, forKey key: Key) throws -> String {\n            decoder.results[key.stringValue] = type.columnType\n            return \"\"\n        }\n\n        func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T: Decodable {\n            // `type` must conform to ColumnDecodableBase protocol\n            let columnDecodableType = type as! ColumnDecodable.Type\n            decoder.results[key.stringValue] = columnDecodableType.columnType\n\n            let sizedPointer = SizedPointer(of: T.self)\n            sizedPointers.append(sizedPointer)\n            return sizedPointer.getPointee()\n        }\n\n        var codingPath: [CodingKey] {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        var allKeys: [Key] {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type,\n                                                 forKey key: Key)\n            throws -> KeyedDecodingContainer<NestedKey> where NestedKey: CodingKey {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func superDecoder() throws -> Decoder {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func superDecoder(forKey key: Key) throws -> Decoder {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n    }\n\n    var codingPath: [CodingKey] {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    var userInfo: [CodingUserInfoKey: Any] {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func unkeyedContainer() throws -> UnkeyedDecodingContainer {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func singleValueContainer() throws -> SingleValueDecodingContainer {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/codable/TableCodable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol TableCodableBase {}\n\npublic protocol TableEncodableBase: Encodable, TableCodableBase {}\n\npublic protocol TableEncodable: TableEncodableBase where CodingKeys.Root == Self {\n    associatedtype CodingKeys: CodingTableKey\n    typealias Properties = CodingKeys\n\n    var isAutoIncrement: Bool {get}\n    var lastInsertedRowID: Int64 {get set}\n}\n\nextension TableEncodable {\n    public var isAutoIncrement: Bool {\n        return false\n    }\n\n    public var lastInsertedRowID: Int64 {\n        get { return Int64.min }\n        set { }\n    }\n}\n\npublic protocol TableDecodableBase: Decodable, TableCodableBase {}\n\npublic protocol TableDecodable: TableDecodableBase where CodingKeys.Root == Self {\n    associatedtype CodingKeys: CodingTableKey\n    typealias Properties = CodingKeys\n}\n\npublic typealias TableCodable = TableEncodable & TableDecodable\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/codable/TableDecoder.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class TableDecoder: Decoder {\n\n    private let recyclableHandleStatement: RecyclableHandleStatement\n\n    typealias HashedKey = [Int: Int] // hash value -> index\n    private let hashedKeys: HashedKey\n\n    private var container: Any?\n\n    init(_ codingTableKeys: [CodingTableKeyBase], on recyclableHandleStatement: RecyclableHandleStatement) {\n        var hashedKeys: HashedKey = [:]\n        for (index, key) in codingTableKeys.enumerated() {\n            hashedKeys[key.stringValue.hashValue] = index\n        }\n        self.hashedKeys = hashedKeys\n        self.recyclableHandleStatement = recyclableHandleStatement\n    }\n\n    init(_ hashedKeys: HashedKey, on recyclableHandleStatement: RecyclableHandleStatement) {\n        self.hashedKeys = hashedKeys\n        self.recyclableHandleStatement = recyclableHandleStatement\n    }\n\n    func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key: CodingKey {\n        if container == nil {\n            container = KeyedDecodingContainer(KeyedDecodingTableContainer<Key>(with: hashedKeys,\n                                                                                on: recyclableHandleStatement.raw))\n        }\n        // It should not be failed. If you think it's a bug, please report an issue to us.\n        return container as! KeyedDecodingContainer<Key>\n    }\n\n    private final class KeyedDecodingTableContainer<CodingKeys: CodingKey> : KeyedDecodingContainerProtocol {\n        typealias Key = CodingKeys\n\n        private let handleStatement: HandleStatement\n\n        private let hashedKeys: HashedKey\n\n        init(with hashedKeys: HashedKey, on handleStatement: HandleStatement) {\n            self.handleStatement = handleStatement\n            self.hashedKeys = hashedKeys\n        }\n\n        private func columnIndex(by key: Key) -> Int {\n            let index = hashedKeys[key.stringValue.hashValue]\n            assert(index != nil, \"If [\\(key)] would not be decoded, please make it optional.\")\n            return index!\n        }\n\n        private func columnIndexIfPresent(by key: Key) -> Int? {\n            return hashedKeys[key.stringValue.hashValue]\n        }\n\n        func contains(_ key: Key) -> Bool {\n            return true\n        }\n\n        //Decode\n        func decodeNil(forKey key: Key) throws -> Bool {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toBool()\n        }\n\n        func decode(_ type: Bool.Type, forKey key: Key) throws -> Bool {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toBool()\n        }\n\n        func decode(_ type: Int.Type, forKey key: Key) throws -> Int {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int64.self).toInt()\n        }\n\n        func decode(_ type: Int8.Type, forKey key: Key) throws -> Int8 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toInt8()\n        }\n\n        func decode(_ type: Int16.Type, forKey key: Key) throws -> Int16 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toInt16()\n        }\n\n        func decode(_ type: Int32.Type, forKey key: Key) throws -> Int32 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decode(_ type: Int64.Type, forKey key: Key) throws -> Int64 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decode(_ type: UInt.Type, forKey key: Key) throws -> UInt {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int64.self).toUInt()\n        }\n\n        func decode(_ type: UInt8.Type, forKey key: Key) throws -> UInt8 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toUInt8()\n        }\n\n        func decode(_ type: UInt16.Type, forKey key: Key) throws -> UInt16 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toUInt16()\n        }\n\n        func decode(_ type: UInt32.Type, forKey key: Key) throws -> UInt32 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toUInt32()\n        }\n\n        func decode(_ type: UInt64.Type, forKey key: Key) throws -> UInt64 {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Int64.self).toUInt64()\n        }\n\n        func decode(_ type: Float.Type, forKey key: Key) throws -> Float {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index, of: Double.self).toFloat()\n        }\n\n        func decode(_ type: Double.Type, forKey key: Key) throws -> Double {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decode(_ type: String.Type, forKey key: Key) throws -> String {\n            let index: Int = columnIndex(by: key)\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decode<Object>(_ type: Object.Type, forKey key: Key) throws -> Object where Object: Decodable {\n            let index: Int = columnIndex(by: key)\n            //`key` must conform to ColumnDecodable protocol.\n            let decodableType = Object.self as! ColumnDecodable.Type\n            guard let wrappedDecoded = decodableType.init(with: handleStatement.columnValue(atIndex: index)) else {\n                throw Error.reportCore(tag: handleStatement.tag,\n                                       path: handleStatement.path,\n                                       operation: .encode,\n                                       code: .misuse,\n                                       message: \"If [\\(key)] would be decoded as nil, please make it optional.\")\n            }\n            //It should not be failed. If you think it's a bug, please report an issue to us.\n            return wrappedDecoded as! Object\n        }\n\n        //Decode if present\n        func decodeIfPresent(_ type: Bool.Type, forKey key: Key) throws -> Bool? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toBool()\n        }\n\n        func decodeIfPresent(_ type: Int.Type, forKey key: Key) throws -> Int? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int64.self).toInt()\n        }\n\n        func decodeIfPresent(_ type: Int8.Type, forKey key: Key) throws -> Int8? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toInt8()\n        }\n\n        func decodeIfPresent(_ type: Int16.Type, forKey key: Key) throws -> Int16? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toInt16()\n        }\n\n        func decodeIfPresent(_ type: Int32.Type, forKey key: Key) throws -> Int32? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decodeIfPresent(_ type: Int64.Type, forKey key: Key) throws -> Int64? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decodeIfPresent(_ type: UInt.Type, forKey key: Key) throws -> UInt? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int64.self).toUInt()\n        }\n\n        func decodeIfPresent(_ type: UInt8.Type, forKey key: Key) throws -> UInt8? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toUInt8()\n        }\n\n        func decodeIfPresent(_ type: UInt16.Type, forKey key: Key) throws -> UInt16? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toUInt16()\n        }\n\n        func decodeIfPresent(_ type: UInt32.Type, forKey key: Key) throws -> UInt32? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int32.self).toUInt32()\n        }\n\n        func decodeIfPresent(_ type: UInt64.Type, forKey key: Key) throws -> UInt64? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Int64.self).toUInt64()\n        }\n\n        func decodeIfPresent(_ type: Float.Type, forKey key: Key) throws -> Float? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index, of: Double.self).toFloat()\n        }\n\n        func decodeIfPresent(_ type: Double.Type, forKey key: Key) throws -> Double? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decodeIfPresent(_ type: String.Type, forKey key: Key) throws -> String? {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            return handleStatement.columnValue(atIndex: index)\n        }\n\n        func decodeIfPresent<Object>(_ type: Object.Type, forKey key: Key) throws -> Object? where Object: Decodable {\n            guard let index = columnIndexIfPresent(by: key), handleStatement.columnType(atIndex: index) != .null else {\n                    return nil\n            }\n            //`key` must conform to ColumnDecodable protocol.\n            let decodableType = Object.self as! ColumnDecodable.Type\n            guard let wrappedDecoded = decodableType.init(with: handleStatement.columnValue(atIndex: index)) else {\n                return nil\n            }\n            //It should not be failed. If you think it's a bug, please report an issue to us.\n            return (wrappedDecoded as! Object)\n        }\n\n        var codingPath: [CodingKey] {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        var allKeys: [Key] {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type,\n                                        forKey key: Key) throws -> KeyedDecodingContainer<NestedKey>\n            where NestedKey: CodingKey {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func nestedUnkeyedContainer(forKey key: Key) throws -> UnkeyedDecodingContainer {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func superDecoder() throws -> Swift.Decoder {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func superDecoder(forKey key: Key) throws -> Swift.Decoder {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n    }\n\n    var codingPath: [CodingKey] {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    var userInfo: [CodingUserInfoKey: Any] {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func unkeyedContainer() throws -> UnkeyedDecodingContainer {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func singleValueContainer() throws -> SingleValueDecodingContainer {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/codable/TableEncoder.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class TableEncoder: Encoder {\n\n    private var container: Any?\n    private var keyedPrimaryKeyEncodableTableContainer: KeyedPrimaryKeyEncodableTableContainer?\n\n    private let recyclableHandleStatement: RecyclableHandleStatement\n\n    typealias HashedKey = [Int: Int] // hash value -> index\n    private let hashedKeys: HashedKey\n\n    var primaryKeyHash: Int?\n    var isPrimaryKeyEncoded = true\n\n    init(_ codingTableKeys: [CodingTableKeyBase],\n         on recyclableHandleStatement: RecyclableHandleStatement) {\n        var hashedKeys: HashedKey = [:]\n        for (index, key) in codingTableKeys.enumerated() {\n            hashedKeys[key.stringValue.hashValue] = index + 1\n        }\n        self.hashedKeys = hashedKeys\n        self.recyclableHandleStatement = recyclableHandleStatement\n    }\n\n    init(_ hashedKeys: HashedKey, on recyclableHandleStatement: RecyclableHandleStatement) {\n        self.hashedKeys = hashedKeys\n        self.recyclableHandleStatement = recyclableHandleStatement\n    }\n\n    func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key: CodingKey {\n        if container == nil {\n            let keyedContainer = KeyedEncodingTableContainer<Key>(with: hashedKeys,\n                                                                  on: recyclableHandleStatement.raw)\n            keyedPrimaryKeyEncodableTableContainer = keyedContainer\n            container = KeyedEncodingContainer(keyedContainer)\n        }\n        if isPrimaryKeyEncoded {\n            keyedPrimaryKeyEncodableTableContainer?.primaryKeyHash = nil\n        } else {\n            keyedPrimaryKeyEncodableTableContainer?.primaryKeyHash = primaryKeyHash\n        }\n        return container as! KeyedEncodingContainer<Key>\n    }\n\n    private class KeyedPrimaryKeyEncodableTableContainer {\n        final var primaryKeyHash: Int?\n    }\n\n    private final class KeyedEncodingTableContainer<CodingKeys: CodingKey>\n        : KeyedPrimaryKeyEncodableTableContainer, KeyedEncodingContainerProtocol {\n        typealias Key = CodingKeys\n\n        private let handleStatement: HandleStatement\n        private let hashedKeys: HashedKey\n\n        init(with hashedKeys: HashedKey,\n             on handleStatement: HandleStatement) {\n            self.hashedKeys = hashedKeys\n            self.handleStatement = handleStatement\n            super.init()\n        }\n\n        private func bindIndex(by hashValue: Int) -> Int? {\n            return hashedKeys[hashValue]\n        }\n\n        func bindPrimaryKeyOrReturnIndex(forKey key: Key) -> Int? {\n            let hashValue = key.stringValue.hashValue\n            guard let index = bindIndex(by: hashValue) else {\n                return nil\n            }\n            guard hashValue == primaryKeyHash else {\n                return index\n            }\n            handleStatement.bind(nil, toIndex: index)\n            return nil\n        }\n\n        func encodeNil(forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(nil, toIndex: index)\n        }\n\n        func encode(_ value: Int, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt64(), toIndex: index)\n        }\n\n        func encode(_ value: Bool, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt32(), toIndex: index)\n        }\n\n        func encode(_ value: Float, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toDouble(), toIndex: index)\n        }\n\n        func encode(_ value: Double, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value, toIndex: index)\n        }\n\n        func encode(_ value: String, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value, toIndex: index)\n        }\n\n        func encode<Object>(_ value: Object, forKey key: Key) throws where Object: Encodable {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            //`key` must conform to ColumnEncodable protocol.\n            let encodableColumnValue = value as! ColumnEncodable\n            handleStatement.bind(encodableColumnValue.archivedValue(), toIndex: index)\n        }\n\n        func encode(_ value: Int8, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt32(), toIndex: index)\n        }\n\n        func encode(_ value: Int16, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt32(), toIndex: index)\n        }\n\n        func encode(_ value: Int32, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value, toIndex: index)\n        }\n\n        func encode(_ value: Int64, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value, toIndex: index)\n        }\n\n        func encode(_ value: UInt, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt64(), toIndex: index)\n        }\n\n        func encode(_ value: UInt8, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt32(), toIndex: index)\n        }\n\n        func encode(_ value: UInt16, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt32(), toIndex: index)\n        }\n\n        func encode(_ value: UInt32, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt32(), toIndex: index)\n        }\n\n        func encode(_ value: UInt64, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            handleStatement.bind(value.toInt64(), toIndex: index)\n        }\n\n        func encodeIfPresent(_ value: Bool?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt32(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: Int?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt64(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: Int8?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt32(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: Int16?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt32(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: Int32?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue, toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: Int64?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue, toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: UInt?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt64(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: UInt8?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt32(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: UInt16?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt32(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: UInt32?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt32(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: UInt64?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toInt64(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: Float?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue.toDouble(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: Double?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue, toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent(_ value: String?, forKey key: Key) throws {\n            guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                return\n            }\n            if let wrappedValue = value {\n                handleStatement.bind(wrappedValue, toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        func encodeIfPresent<Object>(_ value: Object?,\n                                     forKey key: Key) throws\n            where Object: Encodable {\n                guard let index = bindPrimaryKeyOrReturnIndex(forKey: key) else {\n                    return\n                }\n            if value != nil {\n                //`key` must conform to ColumnEncodable protocol.\n                let encodableColumnValue = value! as! ColumnEncodable\n                handleStatement.bind(encodableColumnValue.archivedValue(), toIndex: index)\n            } else {\n                handleStatement.bind(nil, toIndex: index)\n            }\n        }\n\n        var codingPath: [CodingKey] {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func superEncoder() -> Swift.Encoder {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func superEncoder(forKey key: Key) -> Swift.Encoder {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type,\n                                        forKey key: Key) -> KeyedEncodingContainer<NestedKey>\n            where NestedKey: CodingKey {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n\n        func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer {\n            fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n        }\n    }\n\n    var codingPath: [CodingKey] {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    var userInfo: [CodingUserInfoKey: Any] {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func singleValueContainer() -> SingleValueEncodingContainer {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n\n    func unkeyedContainer() -> UnkeyedEncodingContainer {\n        fatalError(\"It should not be called. If you think it's a bug, please report an issue to us.\")\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/fts/WCDBTokenize.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class WCDBTokenizerInfo: TokenizerInfoBase {\n    public required init(withArgc argc: Int32, andArgv argv: UnsafePointer<UnsafePointer<Int8>?>?) {}\n}\n\npublic final class WCDBCursorInfo: CursorInfoBase {\n    private enum TokenType: UInt {\n        case basicMultilingualPlaneLetter = 0x00000001\n        case basicMultilingualPlaneDigit = 0x00000002\n        case basicMultilingualPlaneSymbol = 0x00000003\n        case basicMultilingualPlaneOther = 0x0000FFFF\n        case auxiliaryPlaneOther = 0xFFFFFFFF\n    }\n\n    private let input: UnsafePointer<Int8>!\n    private let inputLength: Int32\n\n    private var position: Int32 = 0\n    private var startOffset: Int32 = 0\n    private var endOffset: Int32 = 0\n\n    private var cursor: Int32 = 0\n    private var cursorTokenType: TokenType?\n    private var cursorTokenLength: Int32 = 0\n    private lazy var symbolCharacterSet: CFCharacterSet? = {\n        var characterSet = CFCharacterSetCreateMutable(kCFAllocatorDefault)\n        CFCharacterSetUnion(characterSet, CFCharacterSetGetPredefined(CFCharacterSetPredefinedSet.control))\n        CFCharacterSetUnion(characterSet, CFCharacterSetGetPredefined(CFCharacterSetPredefinedSet.whitespaceAndNewline))\n        CFCharacterSetUnion(characterSet, CFCharacterSetGetPredefined(CFCharacterSetPredefinedSet.nonBase))\n        CFCharacterSetUnion(characterSet, CFCharacterSetGetPredefined(CFCharacterSetPredefinedSet.punctuation))\n        CFCharacterSetUnion(characterSet, CFCharacterSetGetPredefined(CFCharacterSetPredefinedSet.symbol))\n        CFCharacterSetUnion(characterSet, CFCharacterSetGetPredefined(CFCharacterSetPredefinedSet.illegal))\n        return characterSet\n    }()\n\n    private var lemmaBuffer: [UInt8] = []\n    private var lemmaBufferLength: Int32 = 0 //>0 lemma is not empty\n\n    private var subTokensLengthArray: [UInt8] = []\n    private var subTokensCursor: Int32 = 0\n    private var subTokensDoubleChar: Bool = false\n\n    private var buffer: [UInt8] = []\n    private var bufferLength: Int32 = 0\n\n    public required init(withInput pInput: UnsafePointer<Int8>?, count: Int32, tokenizerInfo: TokenizerInfoBase) {\n        input = pInput\n        inputLength = count\n    }\n\n    func cursorStep() -> Int32 {\n        guard cursor + cursorTokenLength < inputLength else {\n            cursor = inputLength\n            cursorTokenType = nil\n            cursorTokenLength = 0\n            return SQLITE_OK\n        }\n        cursor += cursorTokenLength\n        return cursorSetup()\n    }\n\n    func cursorSetup() -> Int32 {\n        var rc = SQLITE_OK\n        let first = UInt8(bitPattern: input.advanced(by: Int(cursor)).pointee)\n        switch first {\n        case ..<0xC0:\n            cursorTokenLength = 1\n            switch first {\n            case 0x30...0x39:\n                cursorTokenType = .basicMultilingualPlaneDigit\n            case 0x41...0x5a, 0x61...0x7a:\n                cursorTokenType = .basicMultilingualPlaneLetter\n            default:\n                var result = false\n                rc = isSymbol(unicodeChar: UInt16(first), result: &result)\n                guard rc == SQLITE_OK else {\n                    return rc\n                }\n                cursorTokenType = result ? .basicMultilingualPlaneSymbol : .basicMultilingualPlaneOther\n            }\n        case ..<0xF0:\n            var unicode: UInt16 = 0\n            switch first {\n            case ..<0xE0:\n                cursorTokenLength = 2\n                unicode = UInt16(first & 0x1F)\n            default:\n                cursorTokenLength = 3\n                unicode = UInt16(first & 0x0F)\n            }\n            for i in cursor+1..<cursor+cursorTokenLength {\n                guard i < inputLength else {\n                    cursorTokenType = nil\n                    cursorTokenLength = inputLength - i\n                    return SQLITE_OK\n                }\n                unicode = (unicode << 6) | UInt16(UInt8(bitPattern: input.advanced(by: Int(i)).pointee) & 0x3F)\n            }\n            var result = false\n            rc = isSymbol(unicodeChar: unicode, result: &result)\n            guard rc == SQLITE_OK else {\n                return rc\n            }\n            cursorTokenType = result ? .basicMultilingualPlaneSymbol : .basicMultilingualPlaneOther\n        default:\n            cursorTokenType = .auxiliaryPlaneOther\n            switch first {\n            case ..<0xF8:\n                cursorTokenLength = 4\n            case ..<0xFC:\n                cursorTokenLength = 5\n            default:\n                cursorTokenLength = 6\n            }\n        }\n        return SQLITE_OK\n    }\n\n    func isSymbol(unicodeChar: UInt16, result: inout Bool) -> Int32 {\n        guard let symbolCharacterSet = self.symbolCharacterSet else {\n            return SQLITE_NOMEM\n        }\n        result = CFCharacterSetIsCharacterMember(symbolCharacterSet, unicodeChar)\n        return SQLITE_OK\n    }\n\n    static let orthography = NSOrthography(dominantScript: \"Latin\", languageMap: [ \"Latn\": [\"en\"]])\n    func lemmatization(input: UnsafePointer<Int8>, inputLength: Int32) -> Int32 {\n        if inputLength > buffer.count {\n            buffer.expand(toNewSize: Int(inputLength))\n        }\n        for i in 0..<Int(inputLength) {\n            buffer[i] = UInt8(tolower(Int32(input.advanced(by: i).pointee)))\n        }\n        let optionalString = buffer.withUnsafeBytes { (bytes) -> String? in\n            return String(bytes: bytes.baseAddress!.assumingMemoryBound(to: Int8.self),\n                          count: Int(inputLength),\n                          encoding: .ascii)\n        }\n        guard let string = optionalString else {\n            return SQLITE_OK\n        }\n        var optionalLemma: String? = nil\n        string.enumerateLinguisticTags(in: string.startIndex..<string.endIndex,\n                                       scheme: NSLinguisticTagScheme.lemma.rawValue,\n                                       options: NSLinguisticTagger.Options.omitWhitespace,\n                                       orthography: WCDBCursorInfo.orthography,\n                                       invoking: { (tag, _, _, stop) in\n                                        optionalLemma = tag.lowercased()\n                                        stop = true\n        })\n        guard let lemma = optionalLemma,\n            lemma.count > 0,\n            lemma.caseInsensitiveCompare(string) != ComparisonResult.orderedSame else {\n            return SQLITE_OK\n        }\n        lemmaBufferLength = Int32(lemma.count)\n        if lemmaBufferLength > lemmaBuffer.capacity {\n            lemmaBuffer.expand(toNewSize: Int(lemmaBufferLength))\n        }\n        memcpy(&lemmaBuffer, lemma.cString, Int(lemmaBufferLength))\n        return SQLITE_OK\n    }\n\n    func subTokensStep() {\n        self.startOffset = self.subTokensCursor\n        self.bufferLength = Int32(self.subTokensLengthArray[0])\n        if self.subTokensDoubleChar {\n            if self.subTokensLengthArray.count > 1 {\n                self.bufferLength += Int32(self.subTokensLengthArray[1])\n                self.subTokensDoubleChar = false\n            } else {\n                self.subTokensLengthArray.removeAll()\n            }\n        } else {\n            self.subTokensCursor += Int32(subTokensLengthArray[0])\n            self.subTokensLengthArray.removeFirst()\n            self.subTokensDoubleChar = true\n        }\n        self.endOffset = self.startOffset + self.bufferLength\n    }\n\n    public func step(pToken: inout UnsafePointer<Int8>?,\n                     count: inout Int32,\n                     startOffset: inout Int32,\n                     endOffset: inout Int32,\n                     position: inout Int32) -> Int32 {\n        var rc = SQLITE_OK\n        if self.position == 0 {\n            rc = cursorSetup()\n            guard rc == SQLITE_OK else {\n                return rc\n            }\n        }\n\n        if self.lemmaBufferLength == 0 {\n            if self.subTokensLengthArray.isEmpty {\n                guard self.cursorTokenType != nil else {\n                    return SQLITE_DONE\n                }\n\n                //Skip symbol\n                while self.cursorTokenType == .basicMultilingualPlaneSymbol {\n                    rc = cursorStep()\n                    guard rc == SQLITE_OK else {\n                        return rc\n                    }\n                }\n\n                guard let tokenType = self.cursorTokenType else {\n                    return SQLITE_DONE\n                }\n\n                switch tokenType {\n                case .basicMultilingualPlaneLetter:\n                    fallthrough\n                case .basicMultilingualPlaneDigit:\n                    self.startOffset = self.cursor\n                    repeat {\n                        rc = cursorStep()\n                    }while(rc == SQLITE_OK && self.cursorTokenType == tokenType)\n                    guard rc == SQLITE_OK else {\n                        return rc\n                    }\n                    self.endOffset = self.cursor\n                    self.bufferLength = self.endOffset - self.startOffset\n                case .basicMultilingualPlaneOther:\n                    fallthrough\n                case .auxiliaryPlaneOther:\n                    self.subTokensLengthArray.append(UInt8(self.cursorTokenLength))\n                    self.subTokensCursor = self.cursor\n                    self.subTokensDoubleChar = true\n                    rc = cursorStep()\n                    while rc == SQLITE_OK && self.cursorTokenType == tokenType {\n                        self.subTokensLengthArray.append(UInt8(cursorTokenLength))\n                        rc = cursorStep()\n                    }\n                    guard rc == SQLITE_OK else {\n                        return rc\n                    }\n                    subTokensStep()\n                default: break\n                }\n                if tokenType == .basicMultilingualPlaneLetter {\n                    rc = lemmatization(input: self.input.advanced(by: Int(self.startOffset)),\n                                       inputLength: self.bufferLength)\n                    guard rc == SQLITE_OK else {\n                        return rc\n                    }\n                } else {\n                    if self.bufferLength > self.buffer.count {\n                        self.buffer.expand(toNewSize: Int(self.bufferLength))\n                    }\n                    memcpy(&self.buffer, input.advanced(by: Int(self.startOffset)), Int(self.bufferLength))\n                }\n            } else {\n                subTokensStep()\n                if self.bufferLength > self.buffer.capacity {\n                    self.buffer.expand(toNewSize: Int(self.bufferLength))\n                }\n                memcpy(&self.buffer, input.advanced(by: Int(self.startOffset)), Int(self.bufferLength))\n            }\n\n            pToken = self.buffer.withUnsafeBytes { (bytes) -> UnsafePointer<Int8> in\n                return bytes.baseAddress!.assumingMemoryBound(to: Int8.self)\n            }\n            count = self.bufferLength\n        } else {\n            pToken = self.lemmaBuffer.withUnsafeBytes { (bytes) -> UnsafePointer<Int8> in\n                return bytes.baseAddress!.assumingMemoryBound(to: Int8.self)\n            }\n            count = self.lemmaBufferLength\n            self.lemmaBufferLength = 0\n        }\n\n        startOffset = self.startOffset\n        endOffset = self.endOffset\n        self.position += 1\n        position = self.position\n\n        return SQLITE_OK\n    }\n}\n\npublic final class WCDBModule: Module {\n    public typealias TokenizerInfo = WCDBTokenizerInfo\n    public typealias CursorInfo = WCDBCursorInfo\n\n    public static let name = \"WCDB\"\n\n    public private(set) static var module = sqlite3_tokenizer_module(\n        iVersion: 0,\n        xCreate: { (argc, argv, ppTokenizer) -> Int32 in\n            return WCDBModule.create(argc: argc, argv: argv, ppTokenizer: ppTokenizer)\n    },\n        xDestroy: { (pTokenizer) -> Int32 in\n            return WCDBModule.destroy(pTokenizer: pTokenizer)\n    },\n        xOpen: { (pTokenizer, pInput, nBytes, ppCursor) -> Int32 in\n            return WCDBModule.open(pTokenizer: pTokenizer, pInput: pInput, nBytes: nBytes, ppCursor: ppCursor)\n    },\n        xClose: { (pCursor) -> Int32 in\n            return WCDBModule.close(pCursor: pCursor)\n    },\n        xNext: { (pCursor, ppToken, pnBytes, piStartOffset, piEndOffset, piPosition) -> Int32 in\n            return WCDBModule.next(pCursor: pCursor,\n                                   ppToken: ppToken,\n                                   pnBytes: pnBytes,\n                                   piStartOffset: piStartOffset,\n                                   piEndOffset: piEndOffset,\n                                   piPosition: piPosition)\n    },\n        xLanguageid: nil)\n\n    public static let address = { () -> Data in\n        var pointer = UnsafeMutableRawPointer(&module)\n        return Data(bytes: &pointer, count: MemoryLayout.size(ofValue: pointer))\n    }()\n}\n\nextension Tokenize {\n    public static let WCDB = Tokenize(module: WCDBModule.self)\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/ChainCall.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// ChainCall interface for inserting\npublic protocol InsertChainCallInterface: class {\n\n    /// Prepare chain call for inserting of `TableEncodable` object\n    ///\n    /// - Parameters:\n    ///   - cls: Type of table codable object\n    ///   - table: Table name\n    /// - Returns: `Insert`\n    /// - Throws: `Error`\n    func prepareInsert<Root: TableEncodable>(of cls: Root.Type, intoTable table: String) throws -> Insert\n\n    /// Prepare chain call for inserting or replacing of `TableEncodable` object\n    ///\n    /// - Parameters:\n    ///   - cls: Type of table codable object\n    ///   - table: Table name\n    /// - Returns: `Insert`\n    /// - Throws: `Error`\n    func prepareInsertOrReplace<Root: TableEncodable>(of cls: Root.Type, intoTable table: String) throws -> Insert\n\n    /// Prepare chain call for inserting on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list \n    ///   - table: Table name\n    /// - Returns: `Insert`\n    /// - Throws: `Error`\n    func prepareInsert(on propertyConvertibleList: PropertyConvertible..., intoTable table: String) throws -> Insert\n\n    /// Prepare chain call for inserting or replacing on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    /// - Returns: `Insert`\n    /// - Throws: `Error`\n    func prepareInsertOrReplace(on propertyConvertibleList: PropertyConvertible...,\n                                intoTable table: String) throws -> Insert\n\n    /// Prepare chain call for inserting on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    /// - Returns: `Insert`\n    /// - Throws: `Error`\n    func prepareInsert(on propertyConvertibleList: [PropertyConvertible],\n                       intoTable table: String) throws -> Insert\n\n    /// Prepare chain call for inserting or replacing on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    /// - Returns: `Insert`\n    /// - Throws: `Error`\n    func prepareInsertOrReplace(on propertyConvertibleList: [PropertyConvertible],\n                                intoTable table: String) throws -> Insert\n}\n\nextension InsertChainCallInterface where Self: Core {\n    public func prepareInsert<Root: TableEncodable>(of cls: Root.Type, intoTable table: String) throws -> Insert {\n        return try Insert(with: self, named: table, on: cls.Properties.all, isReplace: false)\n    }\n\n    public func prepareInsertOrReplace<Root: TableEncodable>(\n        of cls: Root.Type,\n        intoTable table: String) throws -> Insert {\n        return try Insert(with: self, named: table, on: cls.Properties.all, isReplace: true)\n    }\n\n    public func prepareInsert(on propertyConvertibleList: PropertyConvertible...,\n                              intoTable table: String) throws -> Insert {\n        return try prepareInsert(on: propertyConvertibleList, intoTable: table)\n    }\n\n    public func prepareInsertOrReplace(on propertyConvertibleList: PropertyConvertible...,\n                                       intoTable table: String) throws -> Insert {\n        return try prepareInsertOrReplace(on: propertyConvertibleList, intoTable: table)\n    }\n\n    public func prepareInsert(on propertyConvertibleList: [PropertyConvertible],\n                              intoTable table: String) throws -> Insert {\n        return try Insert(with: self, named: table, on: propertyConvertibleList, isReplace: false)\n    }\n\n    public func prepareInsertOrReplace(on propertyConvertibleList: [PropertyConvertible],\n                                       intoTable table: String) throws -> Insert {\n        return try Insert(with: self, named: table, on: propertyConvertibleList, isReplace: true)\n    }\n}\n\n/// ChainCall interface for deleting\npublic protocol DeleteChainCallInterface: class {\n\n    /// Prepare chain call for deleting on specific properties\n    ///\n    /// - Parameter table: Table name\n    /// - Returns: `Delete`\n    /// - Throws: `Error`\n    func prepareDelete(fromTable table: String) throws -> Delete\n}\n\nextension DeleteChainCallInterface where Self: Core {\n    public func prepareDelete(fromTable table: String) throws -> Delete {\n        return try Delete(with: self, andTableName: table)\n    }\n}\n\n/// ChainCall interface for updating\npublic protocol UpdateChainCallInterface: class {\n\n    /// Prepare chain call for updating on specific properties\n    ///\n    /// - Parameters:\n    ///   - table: Table name\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    /// - Returns: `Update`\n    /// - Throws: `Error`\n    func prepareUpdate(table: String, on propertyConvertibleList: PropertyConvertible...) throws -> Update\n\n    /// Prepare chain call for updating on specific properties\n    ///\n    /// - Parameters:\n    ///   - table: Table name\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    /// - Returns: `Update`\n    /// - Throws: `Error`\n    func prepareUpdate(table: String, on propertyConvertibleList: [PropertyConvertible]) throws -> Update\n}\n\nextension UpdateChainCallInterface where Self: Core {\n    public func prepareUpdate(table: String, on propertyConvertibleList: PropertyConvertible...) throws -> Update {\n        return try prepareUpdate(table: table, on: propertyConvertibleList)\n    }\n\n    public func prepareUpdate(table: String, on propertyConvertibleList: [PropertyConvertible]) throws -> Update {\n        return try Update(with: self, on: propertyConvertibleList, andTable: table)\n    }\n}\n\n/// ChainCall interface for row-selecting\npublic protocol RowSelectChainCallInterface: class {\n\n    /// Prepare chain call for row-selecting on specific column results\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: `ColumnResult` list\n    ///   - tables: Table name list\n    ///   - isDistinct: Is distinct or not\n    /// - Returns: `RowSelect`\n    /// - Throws: `Error`\n    func prepareRowSelect(on columnResultConvertibleList: ColumnResultConvertible...,\n                          fromTables tables: [String],\n                          isDistinct: Bool) throws -> RowSelect\n\n    /// Prepare chain call for row-selecting on specific column results\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: `ColumnResult` list\n    ///   - tables: Table name list\n    ///   - isDistinct: Is distinct or not\n    /// - Returns: `RowSelect`\n    /// - Throws: `Error`\n    func prepareRowSelect(on columnResultConvertibleList: [ColumnResultConvertible],\n                          fromTables tables: [String],\n                          isDistinct: Bool) throws -> RowSelect\n\n    /// Prepare chain call for row-selecting on specific column results\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: `ColumnResult` list\n    ///   - tables: Table name\n    ///   - isDistinct: Is distinct or not\n    /// - Returns: `RowSelect`\n    /// - Throws: `Error`\n    func prepareRowSelect(on columnResultConvertibleList: ColumnResultConvertible...,\n                          fromTable table: String,\n                          isDistinct: Bool) throws -> RowSelect\n\n    /// Prepare chain call for row-selecting on specific column results\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: `ColumnResult` list\n    ///   - tables: Table name\n    ///   - isDistinct: Is distinct or not\n    /// - Returns: `RowSelect`\n    /// - Throws: `Error`\n    func prepareRowSelect(on columnResultConvertibleList: [ColumnResultConvertible],\n                          fromTable table: String,\n                          isDistinct: Bool) throws -> RowSelect\n}\n\nextension RowSelectChainCallInterface where Self: Core {\n    public func prepareRowSelect(on columnResultConvertibleList: ColumnResultConvertible...,\n                                 fromTables tables: [String],\n                                 isDistinct: Bool = false) throws -> RowSelect {\n        return try prepareRowSelect(on: columnResultConvertibleList.isEmpty ?\n            [Column.all] : columnResultConvertibleList,\n                                    fromTables: tables,\n                                    isDistinct: isDistinct)\n    }\n\n    public func prepareRowSelect(on columnResultConvertibleList: [ColumnResultConvertible],\n                                 fromTables tables: [String],\n                                 isDistinct: Bool = false) throws -> RowSelect {\n        return try RowSelect(with: self, results: columnResultConvertibleList, tables: tables, isDistinct: isDistinct)\n    }\n\n    public func prepareRowSelect(on columnResultConvertibleList: ColumnResultConvertible...,\n                                 fromTable table: String,\n                                 isDistinct: Bool = false) throws -> RowSelect {\n        return try prepareRowSelect(on: columnResultConvertibleList.isEmpty ?\n            [Column.all] : columnResultConvertibleList,\n                                    fromTable: table,\n                                    isDistinct: isDistinct)\n    }\n\n    public func prepareRowSelect(on columnResultConvertibleList: [ColumnResultConvertible],\n                                 fromTable table: String,\n                                 isDistinct: Bool = false) throws -> RowSelect {\n        return try RowSelect(with: self,\n                             results: columnResultConvertibleList,\n                             tables: [table],\n                             isDistinct: isDistinct)\n    }\n}\n\n/// ChainCall interface for selecting\npublic protocol SelectChainCallInterface: class {\n\n    /// Prepare chain call for selecting of `TableDecodable` object\n    ///\n    /// - Parameters:\n    ///   - cls: Type of table decodable object\n    ///   - table: Table name\n    ///   - isDistinct: Is distinct or not\n    /// - Returns: `Select`\n    /// - Throws: `Error`\n    func prepareSelect<Root: TableDecodable>(of cls: Root.Type,\n                                             fromTable table: String,\n                                             isDistinct: Bool) throws -> Select\n\n    /// Prepare chain call for selecting on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    ///   - isDistinct: Is distinct or not\n    /// - Returns: `Select`\n    /// - Throws: `Error`\n    func prepareSelect(on propertyConvertibleList: PropertyConvertible...,\n                       fromTable table: String,\n                       isDistinct: Bool) throws -> Select\n\n    /// Prepare chain call for selecting on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    ///   - isDistinct: Is distinct or not\n    /// - Returns: `Select`\n    /// - Throws: `Error`\n    func prepareSelect(on propertyConvertibleList: [PropertyConvertible],\n                       fromTable table: String,\n                       isDistinct: Bool) throws -> Select\n}\n\nextension SelectChainCallInterface where Self: Core {\n    public func prepareSelect<Root: TableDecodable>(of cls: Root.Type,\n                                                    fromTable table: String,\n                                                    isDistinct: Bool = false) throws -> Select {\n        return try Select(with: self, on: cls.Properties.all, table: table, isDistinct: isDistinct)\n    }\n\n    public func prepareSelect(on propertyConvertibleList: PropertyConvertible...,\n                              fromTable table: String,\n                              isDistinct: Bool = false) throws -> Select {\n        return try prepareSelect(on: propertyConvertibleList,\n                                 fromTable: table,\n                                 isDistinct: isDistinct)\n    }\n\n    public func prepareSelect(on propertyConvertibleList: [PropertyConvertible],\n                              fromTable table: String,\n                              isDistinct: Bool = false) throws -> Select {\n        return try Select(with: self, on: propertyConvertibleList, table: table, isDistinct: isDistinct)\n    }\n}\n\n/// ChainCall interface for multi-selecting\npublic protocol MultiSelectChainCallInterface: class {\n\n    /// Prepare chain call for multi-selecting on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - tables: Table name list\n    /// - Returns: `MultiSelect`\n    /// - Throws: `Error`\n    func prepareMultiSelect(on propertyConvertibleList: PropertyConvertible...,\n                            fromTables tables: [String]) throws -> MultiSelect\n\n    /// Prepare chain call for multi-selecting on specific properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - tables: Table name list\n    /// - Returns: `MultiSelect`\n    /// - Throws: `Error`\n    func prepareMultiSelect(on propertyConvertibleList: [PropertyConvertible],\n                            fromTables tables: [String]) throws -> MultiSelect\n}\n\nextension MultiSelectChainCallInterface where Self: Core {\n    public func prepareMultiSelect(on propertyConvertibleList: PropertyConvertible...,\n                                   fromTables tables: [String]) throws -> MultiSelect {\n        return try prepareMultiSelect(on: propertyConvertibleList, fromTables: tables)\n    }\n\n    public func prepareMultiSelect(on propertyConvertibleList: [PropertyConvertible],\n                                   fromTables tables: [String]) throws -> MultiSelect {\n        return try MultiSelect(with: self, on: propertyConvertibleList, tables: tables)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Declare.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic typealias Condition = ExpressionConvertible\npublic typealias Limit = ExpressionConvertible\npublic typealias Offset = ExpressionConvertible\npublic typealias GroupBy = ExpressionConvertible\npublic typealias Having = ExpressionConvertible\npublic typealias OrderBy = OrderConvertible\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Delete.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// Chain call for deleting\npublic final class Delete {\n    private var core: Core\n    private let statement = StatementDelete()\n\n    /// The number of changed rows in the most recent call.\n    /// It should be called after executing successfully\n    public var changes: Int?\n\n    init(with core: Core, andTableName tableName: String) throws {\n        guard tableName.count > 0 else {\n            throw Error.reportInterface(tag: core.tag,\n                                        path: core.path,\n                                        operation: .delete,\n                                        code: .misuse,\n                                        message: \"Nil table name\")\n        }\n        statement.delete(fromTable: tableName)\n        self.core = core\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter condition: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func `where`(_ condition: Condition) -> Delete {\n        statement.where(condition)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter orderList: Order convertible list\n    /// - Returns: `self`\n    @discardableResult\n    public func order(by orderList: OrderBy...) -> Delete {\n        return order(by: orderList)\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter orderList: Order convertible list\n    /// - Returns: `self`\n    @discardableResult\n    public func order(by orderList: [OrderBy]) -> Delete {\n        statement.order(by: orderList)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameters:\n    ///   - begin: Expression convertible\n    ///   - end: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func limit(from begin: Limit, to end: Limit) -> Delete {\n        statement.limit(from: begin, to: end)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter limit: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func limit(_ limit: Limit) -> Delete {\n        statement.limit(limit)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameters:\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func limit(_ limit: Limit, offset: Offset) -> Delete {\n        statement.limit(limit, offset: offset)\n        return self\n    }\n\n    /// Execute the delete chain call.\n    ///\n    /// - Throws: Error\n    public func execute() throws {\n        let recyclableHandleStatement: RecyclableHandleStatement = try core.prepare(statement)\n        let handleStatement = recyclableHandleStatement.raw\n        try handleStatement.step()\n        changes = handleStatement.changes\n    }\n}\n\nextension Delete: CoreRepresentable {\n\n    /// The tag of the related database.\n    public var tag: Tag? {\n        return core.tag\n    }\n\n    /// The path of the related database.\n    public var path: String {\n        return core.path\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Insert.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// Chain call for inserting\npublic final class Insert {\n    private let core: Core\n    private var properties: [PropertyConvertible]?\n    private let name: String\n    private let isReplace: Bool\n\n    init(with core: Core,\n         named name: String,\n         on propertyConvertibleList: [PropertyConvertible]?,\n         isReplace: Bool = false) throws {\n        guard name.count > 0 else {\n            throw Error.reportInterface(tag: core.tag,\n                                        path: core.path,\n                                        operation: .insert,\n                                        code: .misuse,\n                                        message: \"Empty table name\")\n        }\n        self.name = name\n        self.properties = propertyConvertibleList\n        self.isReplace = isReplace\n        self.core = core\n    }\n\n    private var conflict: Conflict? {\n        return isReplace ? Conflict.replace : nil\n    }\n\n    private lazy var statement: StatementInsert = StatementInsert()\n        .insert(intoTable: name,\n                with: properties!,\n                onConflict: self.conflict)\n        .values(Array(repeating: Expression.bindParameter, count: properties!.count))\n\n    /// Execute the insert chain call with objects.\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameter objects: Object to be inserted\n    /// - Throws: Error\n    public func execute<Object: TableEncodable>(with objects: Object...) throws {\n        try execute(with: objects)\n    }\n\n    /// Execute the insert chain call with objects.\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameter objects: Object to be inserted\n    /// - Throws: Error\n    public func execute<Object: TableEncodable>(with objects: [Object]) throws {\n        guard objects.count > 0 else {\n            Error.warning(\"Inserting with an empty/nil object\")\n            return\n        }\n        let orm = Object.CodingKeys.objectRelationalMapping\n        func doInsertObject() throws {\n            properties = properties ?? Object.Properties.all\n            let recyclableHandleStatement: RecyclableHandleStatement = try core.prepare(statement)\n            let handleStatement = recyclableHandleStatement.raw\n            let encoder = TableEncoder(properties!.asCodingTableKeys(), on: recyclableHandleStatement)\n            if !isReplace {\n                encoder.primaryKeyHash = orm.getPrimaryKey()?.stringValue.hashValue\n            }\n\n            for var object in objects {\n                let isAutoIncrement = object.isAutoIncrement\n                encoder.isPrimaryKeyEncoded = !isAutoIncrement\n                try object.encode(to: encoder)\n                try handleStatement.step()\n                if !isReplace && isAutoIncrement {\n                    object.lastInsertedRowID = handleStatement.lastInsertedRowID\n                }\n                try handleStatement.reset()\n            }\n        }\n        return objects.count == 1 ? try doInsertObject() : try core.run(embeddedTransaction: doInsertObject )\n    }\n}\n\nextension Insert: CoreRepresentable {\n    /// The tag of the related database.\n    public var tag: Tag? {\n        return core.tag\n    }\n\n    /// The path of the related database.\n    public var path: String {\n        return core.path\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Interface.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// Convenient interface for inserting\npublic protocol InsertInterface: class {\n\n    /// Execute inserting with `TableEncodable` object on specific(or all) properties\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    /// - Throws: `Error`\n    func insert<Object: TableEncodable>(\n        objects: Object...,\n        on propertyConvertibleList: [PropertyConvertible]?,\n        intoTable table: String) throws\n\n    /// Execute inserting with `TableEncodable` object on specific(or all) properties\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    /// - Throws: `Error`\n    func insert<Object: TableEncodable>(\n        objects: [Object],\n        on propertyConvertibleList: [PropertyConvertible]?,\n        intoTable table: String) throws\n\n    /// Execute inserting or replacing with `TableEncodable` object on specific(or all) properties.  \n    /// It will replace the original row while they have same primary key or row id.\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    /// - Throws: `Error`\n    func insertOrReplace<Object: TableEncodable>(\n        objects: Object...,\n        on propertyConvertibleList: [PropertyConvertible]?,\n        intoTable table: String) throws\n\n    /// Execute inserting or replacing with `TableEncodable` object on specific(or all) properties.  \n    /// It will replace the original row while they have same primary key or row id.\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    /// - Throws: `Error`\n    func insertOrReplace<Object: TableEncodable>(\n        objects: [Object],\n        on propertyConvertibleList: [PropertyConvertible]?,\n        intoTable table: String) throws\n}\n\nextension InsertInterface where Self: Core {\n    public func insert<Object: TableEncodable>(\n        objects: [Object],\n        on propertyConvertibleList: [PropertyConvertible]? = nil,\n        intoTable table: String) throws {\n        let insert = try Insert(with: self, named: table, on: propertyConvertibleList, isReplace: false)\n        return try insert.execute(with: objects)\n    }\n\n    public func insertOrReplace<Object: TableEncodable>(\n        objects: [Object],\n        on propertyConvertibleList: [PropertyConvertible]? = nil,\n        intoTable table: String) throws {\n        let insert = try Insert(with: self, named: table, on: propertyConvertibleList, isReplace: true)\n        return try insert.execute(with: objects)\n    }\n\n    public func insert<Object: TableEncodable>(\n        objects: Object...,\n        on propertyConvertibleList: [PropertyConvertible]? = nil,\n        intoTable table: String) throws {\n        return try insert(objects: objects, on: propertyConvertibleList, intoTable: table)\n    }\n\n    public func insertOrReplace<Object: TableEncodable>(\n        objects: Object...,\n        on propertyConvertibleList: [PropertyConvertible]? = nil,\n        intoTable table: String) throws {\n        return try insertOrReplace(objects: objects, on: propertyConvertibleList, intoTable: table)\n    }\n}\n\n/// Convenient interface for updating\npublic protocol UpdateInterface: class {\n\n    /// Execute updating with `TableEncodable` object on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - table: Table name\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    func update<Object: TableEncodable>(\n        table: String,\n        on propertyConvertibleList: PropertyConvertible...,\n        with object: Object,\n        where condition: Condition?,\n        orderBy orderList: [OrderBy]?,\n        limit: Limit?,\n        offset: Offset?) throws\n\n    /// Execute updating with `TableEncodable` object on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - table: Table name\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    func update<Object: TableEncodable>(\n        table: String,\n        on propertyConvertibleList: [PropertyConvertible],\n        with object: Object,\n        where condition: Condition?,\n        orderBy orderList: [OrderBy]?,\n        limit: Limit?,\n        offset: Offset?) throws\n\n    /// Execute updating with row on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - table: Table name\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    func update(table: String,\n                on propertyConvertibleList: PropertyConvertible...,\n                with row: [ColumnEncodable],\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                limit: Limit?,\n                offset: Offset?) throws\n\n    /// Execute updating with row on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - table: Table name\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    func update(table: String,\n                on propertyConvertibleList: [PropertyConvertible],\n                with row: [ColumnEncodable],\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                limit: Limit?,\n                offset: Offset?) throws\n}\n\nextension UpdateInterface where Self: Core {\n    public func update<Object: TableEncodable>(\n        table: String,\n        on propertyConvertibleList: [PropertyConvertible],\n        with object: Object,\n        where condition: Condition? = nil,\n        orderBy orderList: [OrderBy]? = nil,\n        limit: Limit? = nil,\n        offset: Offset? = nil) throws {\n        let update = try Update(with: self, on: propertyConvertibleList, andTable: table)\n        if condition != nil {\n            update.where(condition!)\n        }\n        if orderList != nil {\n            update.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                update.limit(limit!, offset: offset!)\n            } else {\n                update.limit(limit!)\n            }\n        }\n        return try update.execute(with: object)\n    }\n\n    public func update<Object: TableEncodable>(\n        table: String,\n        on propertyConvertibleList: PropertyConvertible...,\n        with object: Object,\n        where condition: Condition? = nil,\n        orderBy orderList: [OrderBy]? = nil,\n        limit: Limit? = nil,\n        offset: Offset? = nil) throws {\n        return try update(table: table,\n                          on: propertyConvertibleList,\n                          with: object,\n                          where: condition,\n                          orderBy: orderList,\n                          limit: limit,\n                          offset: offset)\n    }\n\n    public func update(table: String,\n                       on propertyConvertibleList: PropertyConvertible...,\n                       with row: [ColumnEncodable],\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        return try update(table: table,\n                          on: propertyConvertibleList,\n                          with: row,\n                          where: condition,\n                          orderBy: orderList,\n                          limit: limit,\n                          offset: offset)\n    }\n\n    public func update(table: String,\n                       on propertyConvertibleList: [PropertyConvertible],\n                       with row: [ColumnEncodable],\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        let update = try Update(with: self, on: propertyConvertibleList, andTable: table)\n        if condition != nil {\n            update.where(condition!)\n        }\n        if orderList != nil {\n            update.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                update.limit(limit!, offset: offset!)\n            } else {\n                update.limit(limit!)\n            }\n        }\n        return try update.execute(with: row)\n    }\n}\n\n/// Convenient interface for deleting\npublic protocol DeleteInterface: class {\n\n    /// Execute deleting \n    ///\n    /// - Parameters:\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    func delete(fromTable table: String,\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                limit: Limit?,\n                offset: Offset?) throws\n}\n\nextension DeleteInterface where Self: Core {\n    public func delete(fromTable table: String,\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        let delete = try Delete(with: self, andTableName: table)\n        if condition != nil {\n            delete.where(condition!)\n        }\n        if orderList != nil {\n            delete.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                delete.limit(limit!, offset: offset!)\n            } else {\n                delete.limit(limit!)\n            }\n        }\n        return try delete.execute()\n    }\n}\n\n/// Convenient interface for row selecting\npublic protocol RowSelectInterface: class {\n\n    /// Get rows by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRowXColumn`\n    /// - Throws: `Error`\n    func getRows(on columnResultConvertibleList: [ColumnResultConvertible],\n                 fromTable table: String,\n                 where condition: Condition?,\n                 orderBy orderList: [OrderBy]?,\n                 limit: Limit?,\n                 offset: Offset?) throws -> FundamentalRowXColumn\n\n    /// Get rows by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRowXColumn`\n    /// - Throws: `Error`\n    func getRows(on columnResultConvertibleList: ColumnResultConvertible...,\n                 fromTable table: String,\n                 where condition: Condition?,\n                 orderBy orderList: [OrderBy]?,\n                 limit: Limit?,\n                 offset: Offset?) throws -> FundamentalRowXColumn\n\n    /// Get row by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRow`\n    /// - Throws: `Error`\n    func getRow(on columnResultConvertibleList: ColumnResultConvertible...,\n                fromTable table: String,\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                offset: Offset?) throws -> FundamentalRow\n\n    /// Get row by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRow`\n    /// - Throws: `Error`\n    func getRow(on columnResultConvertibleList: [ColumnResultConvertible],\n                fromTable table: String,\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                offset: Offset?) throws -> FundamentalRow\n\n    /// Get column by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalColumn`\n    /// - Throws: `Error`\n    func getColumn(on columnResultConvertible: ColumnResultConvertible,\n                   fromTable table: String,\n                   where condition: Condition?,\n                   orderBy orderList: [OrderBy]?,\n                   limit: Limit?,\n                   offset: Offset?) throws -> FundamentalColumn\n\n    /// Get distinct column by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalColumn`\n    /// - Throws: `Error`\n    func getDistinctColumn(on columnResultConvertible: ColumnResultConvertible,\n                           fromTable table: String,\n                           where condition: Condition?,\n                           orderBy orderList: [OrderBy]?,\n                           limit: Limit?,\n                           offset: Offset?) throws -> FundamentalColumn\n\n    /// Get value by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalValue`\n    /// - Throws: `Error`\n    func getValue(on columnResultConvertible: ColumnResultConvertible,\n                  fromTable table: String,\n                  where condition: Condition?,\n                  orderBy orderList: [OrderBy]?,\n                  limit: Limit?,\n                  offset: Offset?) throws -> FundamentalValue\n\n    /// Get distinct value by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalValue`\n    /// - Throws: `Error`\n    func getDistinctValue(on result: ColumnResultConvertible,\n                          fromTable table: String,\n                          where condition: Condition?,\n                          orderBy orderList: [OrderBy]?,\n                          limit: Limit?,\n                          offset: Offset?) throws -> FundamentalValue\n}\n\nextension RowSelectInterface where Self: Core {\n    public func getRows(on columnResultConvertibleList: [ColumnResultConvertible],\n                        fromTable table: String,\n                        where condition: Condition? = nil,\n                        orderBy orderList: [OrderBy]? = nil,\n                        limit: Limit? = nil,\n                        offset: Offset? = nil) throws -> FundamentalRowXColumn {\n        let rowSelect = try RowSelect(with: self,\n                                      results: columnResultConvertibleList,\n                                      tables: [table],\n                                      isDistinct: false)\n        if condition != nil {\n            rowSelect.where(condition!)\n        }\n        if orderList != nil {\n            rowSelect.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                rowSelect.limit(limit!, offset: offset!)\n            } else {\n                rowSelect.limit(limit!)\n            }\n        }\n        return try rowSelect.allRows()\n    }\n\n    public func getRows(on columnResultConvertibleList: ColumnResultConvertible...,\n                        fromTable table: String,\n                        where condition: Condition? = nil,\n                        orderBy orderList: [OrderBy]? = nil,\n                        limit: Limit? = nil,\n                        offset: Offset? = nil) throws -> FundamentalRowXColumn {\n        return try getRows(\n            on: columnResultConvertibleList.isEmpty ? [Column.all] : columnResultConvertibleList,\n            fromTable: table,\n            where: condition,\n            orderBy: orderList,\n            limit: limit,\n            offset: offset)\n    }\n\n    public func getRow(on columnResultConvertibleList: ColumnResultConvertible...,\n                       fromTable table: String,\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       offset: Offset? = nil) throws -> FundamentalRow {\n        return try getRow(\n            on: columnResultConvertibleList.isEmpty ? [Column.all] : columnResultConvertibleList,\n            fromTable: table,\n            where: condition,\n            orderBy: orderList,\n            offset: offset)\n    }\n\n    public func getRow(on columnResultConvertibleList: [ColumnResultConvertible],\n                       fromTable table: String,\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       offset: Offset? = nil) throws -> FundamentalRow {\n        return try getRows(on: columnResultConvertibleList,\n                           fromTable: table,\n                           where: condition,\n                           orderBy: orderList,\n                           limit: 1,\n                           offset: offset).first ?? []\n    }\n\n    public func getColumn(on result: ColumnResultConvertible,\n                          fromTable table: String,\n                          where condition: Condition? = nil,\n                          orderBy orderList: [OrderBy]? = nil,\n                          limit: Limit? = nil,\n                          offset: Offset? = nil) throws -> FundamentalColumn {\n        let rowSelect = try RowSelect(with: self, results: [result], tables: [table], isDistinct: false)\n        if condition != nil {\n            rowSelect.where(condition!)\n        }\n        if orderList != nil {\n            rowSelect.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                rowSelect.limit(limit!, offset: offset!)\n            } else {\n                rowSelect.limit(limit!)\n            }\n        }\n        return try rowSelect.allValues()\n    }\n\n    public func getDistinctColumn(on result: ColumnResultConvertible,\n                                  fromTable table: String,\n                                  where condition: Condition? = nil,\n                                  orderBy orderList: [OrderBy]? = nil,\n                                  limit: Limit? = nil,\n                                  offset: Offset? = nil) throws -> FundamentalColumn {\n        let rowSelect = try RowSelect(with: self, results: [result], tables: [table], isDistinct: true)\n        if condition != nil {\n            rowSelect.where(condition!)\n        }\n        if orderList != nil {\n            rowSelect.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                rowSelect.limit(limit!, offset: offset!)\n            } else {\n                rowSelect.limit(limit!)\n            }\n        }\n        return try rowSelect.allValues()\n    }\n\n    public func getValue(on result: ColumnResultConvertible,\n                         fromTable table: String,\n                         where condition: Condition? = nil,\n                         orderBy orderList: [OrderBy]? = nil,\n                         limit: Limit? = nil,\n                         offset: Offset? = nil) throws -> FundamentalValue {\n        return (try getRows(on: result,\n                            fromTable: table,\n                            where: condition,\n                            orderBy: orderList,\n                            limit: 1,\n                            offset: offset).first?.first) ?? FundamentalValue(nil)\n    }\n\n    public func getDistinctValue(on result: ColumnResultConvertible,\n                                 fromTable table: String,\n                                 where condition: Condition? = nil,\n                                 orderBy orderList: [OrderBy]? = nil,\n                                 limit: Limit? = nil,\n                                 offset: Offset? = nil) throws -> FundamentalValue {\n        return (try getDistinctColumn(on: result, fromTable: table).first) ?? FundamentalValue(nil)\n    }\n}\n\n/// Convenient interface for selecting\npublic protocol SelectInterface: class {\n    //TODO: Add generic property convertible to fit the type\n\n    /// Get objects on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    func getObjects<Object: TableDecodable>(\n        on propertyConvertibleList: [PropertyConvertible],\n        fromTable table: String,\n        where condition: Condition?,\n        orderBy orderList: [OrderBy]?,\n        limit: Limit?,\n        offset: Offset?) throws -> [Object]\n\n    /// Get objects on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    func getObjects<Object: TableDecodable>(\n        on propertyConvertibleList: PropertyConvertible...,\n        fromTable table: String,\n        where condition: Condition?,\n        orderBy orderList: [OrderBy]?,\n        limit: Limit?,\n        offset: Offset?) throws -> [Object]\n\n    /// Get object on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    func getObject<Object: TableDecodable>(\n        on propertyConvertibleList: [PropertyConvertible],\n        fromTable table: String,\n        where condition: Condition?,\n        orderBy orderList: [OrderBy]?,\n        offset: Offset?) throws -> Object?\n\n    /// Get object on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - table: Table name\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - condition: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    func getObject<Object: TableDecodable>(\n        on propertyConvertibleList: PropertyConvertible...,\n        fromTable table: String,\n        where condition: Condition?,\n        orderBy orderList: [OrderBy]?,\n        offset: Offset?) throws -> Object?\n}\n\nextension SelectInterface where Self: Core {\n    public func getObjects<Object: TableDecodable>(\n        on propertyConvertibleList: [PropertyConvertible],\n        fromTable table: String,\n        where condition: Condition? = nil,\n        orderBy orderList: [OrderBy]? = nil,\n        limit: Limit? = nil,\n        offset: Offset? = nil) throws -> [Object] {\n        let select = try Select(with: self, on: propertyConvertibleList, table: table, isDistinct: false)\n        if condition != nil {\n            select.where(condition!)\n        }\n        if orderList != nil {\n            select.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                select.limit(limit!, offset: offset!)\n            } else {\n                select.limit(limit!)\n            }\n        }\n        return try select.allObjects()\n    }\n\n    public func getObjects<Object: TableDecodable>(\n        on propertyConvertibleList: PropertyConvertible...,\n        fromTable table: String,\n        where condition: Condition? = nil,\n        orderBy orderList: [OrderBy]? = nil,\n        limit: Limit? = nil,\n        offset: Offset? = nil) throws -> [Object] {\n        return try getObjects(on: propertyConvertibleList.isEmpty ? Object.Properties.all : propertyConvertibleList,\n                              fromTable: table,\n                              where: condition,\n                              orderBy: orderList,\n                              limit: limit,\n                              offset: offset)\n    }\n\n    public func getObject<Object: TableDecodable>(\n        on propertyConvertibleList: [PropertyConvertible],\n        fromTable table: String,\n        where condition: Condition? = nil,\n        orderBy orderList: [OrderBy]? = nil,\n        offset: Offset? = nil) throws -> Object? {\n        return try getObjects(on: propertyConvertibleList,\n                              fromTable: table,\n                              where: condition,\n                              orderBy: orderList,\n                              limit: 1,\n                              offset: offset).first\n    }\n\n    public func getObject<Object: TableDecodable>(\n        on propertyConvertibleList: PropertyConvertible...,\n        fromTable table: String,\n        where condition: Condition? = nil,\n        orderBy orderList: [OrderBy]? = nil,\n        offset: Offset? = nil) throws -> Object? {\n        return try getObject(on: propertyConvertibleList.isEmpty ? Object.Properties.all : propertyConvertibleList,\n                             fromTable: table,\n                             where: condition,\n                             orderBy: orderList,\n                             offset: offset)\n    }\n}\n\n/// Convenient interface for table related operation\npublic protocol TableInterface: class {\n    /// Create table, related indexes and constraints with specific type\n    ///\n    /// Note that it will create defined indexes automatically.\n    /// The name of index is `\"\\(tableName)\\(indexSubfixName)\"` while `indexSubfixName` is defined by `IndexBinding`. \n    /// BUT, it will not drop the undefined indexes. You should drop it manually.\n    ///\n    /// Note that it will add the newly defined column automatically.\n    /// AND, it will skip the undefined column. It can be very developer-friendly while upgrading your database column.\n    ///\n    /// Note that it will run embedded transaction  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - name: Table name.\n    ///   - rootType: Type of table encodable object\n    /// - Throws: `Error`\n    func create<Root: TableDecodable>(table name: String, of rootType: Root.Type) throws\n\n    /// Create virtual table and constraints with specific type\n    ///\n    /// Note that it will run embedded transaction  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - name: Table name.\n    ///   - rootType: Type of table encodable object\n    /// - Throws: `Error`\n    func create<Root: TableDecodable>(virtualTable name: String, of rootType: Root.Type) throws\n\n    /// Create table manually\n    ///\n    /// - Parameters:\n    ///   - name: Table name\n    ///   - columnDefList: WINQ column definition list\n    ///   - constraintList: WINQ constraint list.\n    /// - Throws: `Error`\n    func create(table name: String, with columnDefList: [ColumnDef], and constraintList: [TableConstraint]?) throws\n\n    /// Create table manually\n    ///\n    /// - Parameters:\n    ///   - name: Table name\n    ///   - columnDefList: WINQ column definition list\n    ///   - constraintList: WINQ constraint list.\n    /// - Throws: `Error`\n    func create(table name: String, with columnDefList: ColumnDef..., and constraintList: [TableConstraint]?) throws\n\n    /// Create new column\n    ///\n    /// - Parameters:\n    ///   - columnDef: WINQ column definition\n    ///   - table: Table name\n    /// - Throws: `Error`\n    func addColumn(with columnDef: ColumnDef, forTable table: String) throws\n\n    /// Drop table\n    ///\n    /// - Parameter name: Table name\n    /// - Throws: `Erro`\n    func drop(table name: String) throws\n\n    /// Create index manually\n    ///\n    /// - Parameters:\n    ///   - name: Index name\n    ///   - columnIndexConvertibleList: WINQ column index list\n    ///   - table: Table name\n    /// - Throws: `Error`\n    func create(index name: String,\n                with columnIndexConvertibleList: [ColumnIndexConvertible],\n                forTable table: String) throws\n\n    /// Create index manually\n    ///\n    /// - Parameters:\n    ///   - name: Index name\n    ///   - columnIndexConvertibleList: WINQ column index list\n    ///   - table: Table name\n    /// - Throws: `Error`\n    func create(index name: String,\n                with columnIndexConvertibleList: ColumnIndexConvertible...,\n                forTable table: String) throws\n\n    /// Drop index\n    ///\n    /// - Parameter name: Index name\n    /// - Throws: `Error`\n    func drop(index name: String) throws\n}\n\nextension TableInterface where Self: Core {\n    public func create<Root: TableDecodable>(\n        table name: String,\n        of rootType: Root.Type) throws {\n        try run(embeddedTransaction: {\n            let orm = Root.CodingKeys.objectRelationalMapping\n            if try isTableExists(name) {\n                var columnNames: [String] = []\n                do {\n                    let statementPragma = StatementPragma().pragma(.tableInfo, to: name)\n                    let recyclableHandleStatement: RecyclableHandleStatement = try prepare(statementPragma)\n                    let handleStatement = recyclableHandleStatement.raw\n                    while try handleStatement.step() {\n                        let columnName: String = handleStatement.columnValue(atIndex: 1)\n                        columnNames.append(columnName)\n                    }\n                }\n                var keys = orm.allKeys\n                for columnName in columnNames {\n                    if let index = keys.index(where: { (key) -> Bool in\n                        return key.stringValue.caseInsensitiveCompare(columnName) == ComparisonResult.orderedSame\n                    }) {\n                        keys.remove(at: index)\n                    } else {\n                        Error.warning(\"Skip column named [\\(columnName)] for table [\\(name)]\")\n                    }\n                }\n                try keys.forEach {\n                    try exec(StatementAlterTable().alter(table: name).addColumn(with: orm.generateColumnDef(with: $0)))\n                }\n            } else {\n                try exec(orm.generateCreateTableStatement(named: name))\n            }\n            try orm.generateCreateIndexStatements(onTable: name)?.forEach { try exec($0) }\n        })\n    }\n\n    public func create<Root: TableDecodable>(virtualTable name: String, of rootType: Root.Type) throws {\n        try run(transaction: {\n            try exec(rootType.CodingKeys.objectRelationalMapping.generateCreateVirtualTableStatement(named: name))\n        })\n    }\n\n    public func create(table name: String,\n                       with columnDefList: ColumnDef...,\n                       and constraintList: [TableConstraint]? = nil) throws {\n        try create(table: name, with: columnDefList, and: constraintList)\n    }\n\n    public func create(table name: String,\n                       with columnDefList: [ColumnDef],\n                       and constraintList: [TableConstraint]? = nil) throws {\n        try exec(StatementCreateTable().create(table: name, with: columnDefList, and: constraintList))\n    }\n\n    public func addColumn(with columnDef: ColumnDef, forTable table: String) throws {\n        try exec(StatementAlterTable().alter(table: table).addColumn(with: columnDef))\n    }\n\n    public func drop(table name: String) throws {\n        try exec(StatementDropTable().drop(table: name))\n    }\n\n    public func create(index name: String,\n                       with columnIndexConvertibleList: ColumnIndexConvertible...,\n                       forTable table: String) throws {\n        try create(index: name, with: columnIndexConvertibleList, forTable: table)\n    }\n\n    public func create(index name: String,\n                       with columnIndexConvertibleList: [ColumnIndexConvertible],\n                       forTable table: String) throws {\n        try exec(StatementCreateIndex().create(index: name).on(table: table, indexesBy: columnIndexConvertibleList))\n    }\n\n    public func drop(index name: String) throws {\n        try exec(StatementDropIndex().drop(index: name))\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/MultiSelect.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// Chain call for multi-selecting\npublic final class MultiSelect: Selectable {\n    private let keys: [CodingTableKeyBase]\n\n    init(with core: Core,\n         on propertyConvertibleList: [PropertyConvertible],\n         tables: [String],\n         isDistinct: Bool = false) throws {\n        guard propertyConvertibleList.count > 0 else {\n            throw Error.reportInterface(tag: core.tag,\n                                        path: core.path,\n                                        operation: .select,\n                                        code: .misuse,\n                                        message: \"Selecting nothing from \\(tables) is invalid\")\n        }\n        guard tables.count > 0 else {\n            throw Error.reportInterface(tag: core.tag,\n                                        path: core.path,\n                                        operation: .select,\n                                        code: .misuse,\n                                        message: \"Empty table\")\n        }\n        self.keys = propertyConvertibleList.map({ (propertyConvertible) -> CodingTableKeyBase in\n            let codingTableKey = propertyConvertible.codingTableKey\n            assert(codingTableKey.rootType is TableDecodableBase.Type,\n                   \"\\(codingTableKey.rootType) must conform to TableDecodable protocol.\")\n            return codingTableKey\n        })\n\n        let statement = StatementSelect().select(distinct: isDistinct, propertyConvertibleList).from(tables)\n        super.init(with: core, statement: statement)\n    }\n\n    private typealias Generator = () throws -> TableDecodableBase\n\n    struct TypedIndexedKeys {\n        let type: TableDecodableBase.Type\n        var indexedKeys: TableDecoder.HashedKey\n        init(_ type: TableDecodableBase.Type, key: String, index: Int) {\n            self.type = type\n            self.indexedKeys = [key.hashValue: index]\n        }\n    }\n    private lazy var generators: [String: Generator] = {\n        var mappedKeys: [String: TypedIndexedKeys] = [:]\n        let handleStatement = try? lazyHandleStatement()\n        assert(handleStatement != nil,\n               \"It should not be failed. If you think it's a bug, please report an issue to us.\")\n        for (index, key) in keys.enumerated() {\n            let tableName = handleStatement!.columnTableName(atIndex: index)\n            var typedIndexedKeys: TypedIndexedKeys! = mappedKeys[tableName]\n            if typedIndexedKeys == nil {\n                let tableDecodableType = key.rootType as? TableDecodableBase.Type\n                assert(tableDecodableType != nil,\n                       \"\\(key.rootType) must conform to TableDecodable protocol.\")\n                typedIndexedKeys = TypedIndexedKeys(tableDecodableType!, key: key.stringValue, index: index)\n            } else {\n                typedIndexedKeys.indexedKeys[key.stringValue.hashValue] = index\n            }\n            mappedKeys[tableName] = typedIndexedKeys\n        }\n        var generators: [String: Generator] = [:]\n        for (tableName, typedIndexedKey) in mappedKeys {\n            let decoder = TableDecoder(typedIndexedKey.indexedKeys, on: optionalRecyclableHandleStatement!)\n            let type = typedIndexedKey.type\n            let generator = { () throws -> TableDecodableBase in\n                return try type.init(from: decoder)\n            }\n            generators[tableName] = generator\n        }\n        return generators\n    }()\n\n    private func extractMultiObject() throws -> [String: TableDecodableBase] {\n        var multiObject: [String: TableDecodableBase] = [:]\n        for (tableName, generator) in generators {\n            multiObject[tableName] = try generator()\n        }\n        return multiObject\n    }\n\n    /// Get next selected object. You can do an iteration using it.\n    ///\n    ///     while let multiObject = try self.nextMultiObject() {\n    ///         let object1 = multiObject[tableName1]\n    ///         let object2 = multiObject[tableName2]\n    ///         //...\n    ///     }\n    ///\n    /// - Returns: Mapping from table name to object. Nil means the end of iteration.\n    /// - Throws: `Error`\n    public func nextMultiObject() throws -> [String: TableDecodableBase]? {\n        guard try next() else {\n            return nil\n        }\n        return try extractMultiObject()\n    }\n\n    /// Get all selected objects.\n    ///\n    /// - Returns: Array contained mapping from table name to object.\n    /// - Throws: `Error`\n    public func allMultiObjects() throws -> [[String: TableDecodableBase]] {\n        var multiObjects: [[String: TableDecodableBase]] = []\n        while try next() {\n            multiObjects.append(try extractMultiObject())\n        }\n        return multiObjects\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/RowSelect.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// Chain call for row-selecting\npublic final class RowSelect: Selectable {\n    init(with core: Core,\n         results columnResultConvertibleList: [ColumnResultConvertible],\n         tables: [String],\n         isDistinct: Bool) throws {\n        guard tables.count > 0 else {\n            throw Error.reportInterface(tag: core.tag,\n                                        path: core.path,\n                                        operation: .select,\n                                        code: .misuse,\n                                        message: \"Empty table\")\n        }\n        let statement = StatementSelect().select(distinct: isDistinct, columnResultConvertibleList).from(tables)\n        super.init(with: core, statement: statement)\n    }\n\n    private func extract(atIndex index: Int) throws -> FundamentalValue {\n        let handleStatement = try self.lazyHandleStatement()\n        switch handleStatement.columnType(atIndex: index) {\n        case .integer32:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Int32.self))\n        case .integer64:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Int64.self))\n        case .float:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Double.self))\n        case .text:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: String.self))\n        case .BLOB:\n            return FundamentalValue(handleStatement.columnValue(atIndex: index, of: Data.self))\n        case .null:\n            return FundamentalValue(nil)\n        }\n    }\n\n    private func extract() throws -> FundamentalRow {\n        var row: FundamentalRow = []\n        let handleStatement = try self.lazyHandleStatement()\n        for index in 0..<handleStatement.columnCount() {\n            row.append(try extract(atIndex: index))\n        }\n        return row\n    }\n\n    /// Get next selected row. You can do an iteration using it.\n    ///\n    ///     while let row = try rowSelect.nextRow() {\n    ///         print(row[0].int32Value)\n    ///         print(row[1].int64Value)\n    ///         print(row[2].doubleValue)\n    ///         print(row[3].stringValue)\n    ///     }\n    ///\n    /// - Returns: Array with `FundamentalValue`. Nil means the end of iteration.\n    /// - Throws: `Error`\n    public func nextRow() throws -> FundamentalRow? {\n        guard try next() else {\n            return nil\n        }\n        return try extract()\n    }\n\n    /// Get all selected row.\n    ///\n    /// - Returns: Array with `Array<FundamentalValue>`\n    /// - Throws: `Error`\n    public func allRows() throws -> FundamentalRowXColumn {\n        var rows: [[FundamentalValue]] = []\n        while try next() {\n            rows.append(try extract())\n        }\n        return rows\n    }\n\n    /// Get next selected value. You can do an iteration using it.\n    ///\n    ///     while let value = try nextValue() {\n    ///         print(value.int32Value)\n    ///     }\n    ///\n    /// - Returns: `FundamentalValue`. Nil means the end of iteration.\n    /// - Throws: `Error`\n    public func nextValue() throws -> FundamentalValue? {\n        guard try next() else {\n            return nil\n        }\n        return try extract(atIndex: 0)\n    }\n\n    /// Get all selected values.\n    ///\n    /// - Returns: Array with `FundamentalValue`.\n    /// - Throws: `Error`\n    public func allValues() throws -> FundamentalColumn {\n        var values: [FundamentalValue] = []\n        while try next() {\n            values.append(try extract(atIndex: 0))\n        }\n        return values\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Select.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic final class Select: Selectable {\n    private let keys: [CodingTableKeyBase]\n\n    private lazy var decoder = TableDecoder(keys, on: optionalRecyclableHandleStatement!)\n\n    init(with core: Core, on propertyConvertibleList: [PropertyConvertible], table: String, isDistinct: Bool) throws {\n        //TODO: Use generic to check all coding table keys conform to same root type\n        keys = propertyConvertibleList.asCodingTableKeys()\n        let statement = StatementSelect().select(distinct: isDistinct, propertyConvertibleList).from(table)\n        super.init(with: core, statement: statement)\n    }\n\n    /// Get next selected object according to the `CodingTableKey`. You can do an iteration using it.\n    ///\n    /// - Returns: Table decodable object according to the `CodingTableKey`. Nil means the end of iteration.\n    /// - Throws: `Error`\n    public func nextObject() throws -> Any? {\n        let rootType = keys[0].rootType as? TableDecodableBase.Type\n        assert(rootType != nil, \"\\(keys[0].rootType) must conform to TableDecodable protocol.\")\n        guard try next() else {\n            return nil\n        }\n        return try rootType!.init(from: decoder)\n    }\n\n    /// Get all selected objects according to the `CodingTableKey`.\n    ///\n    /// - Returns: Table decodable objects according to the `CodingTableKey`\n    /// - Throws: `Error`\n    public func allObjects() throws -> [Any] {\n        let rootType = keys[0].rootType as? TableDecodableBase.Type\n        assert(rootType != nil, \"\\(keys[0].rootType) must conform to TableDecodable protocol.\")\n        var objects: [Any] = []\n        while try next() {\n            objects.append(try rootType!.init(from: decoder))\n        }\n        return objects\n    }\n\n    /// Get next selected object with type. You can do an iteration using it.\n    ///\n    /// - Parameter type: Type of table decodable object\n    /// - Returns: Table decodable object. Nil means the end of iteration.\n    /// - Throws: `Error`\n    public func nextObject<Object: TableDecodable>(of type: Object.Type = Object.self) throws -> Object? {\n        assert(keys is [Object.CodingKeys], \"Properties must belong to \\(Object.self).CodingKeys.\")\n        guard try next() else {\n            return nil\n        }\n        return try Object.init(from: decoder)\n    }\n\n    /// Get all selected objects.\n    ///\n    /// - Parameter type: Type of table decodable object\n    /// - Returns: Table decodable objects.\n    /// - Throws: `Error`\n    public func allObjects<Object: TableDecodable>(of type: Object.Type = Object.self) throws -> [Object] {\n        assert(keys is [Object.CodingKeys], \"Properties must belong to \\(Object.self).CodingKeys.\")\n        var objects: [Object] = []\n        while try next() {\n            objects.append(try Object.init(from: decoder))\n        }\n        return objects\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Selectable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic class Selectable {\n    private final var core: Core\n    final var optionalRecyclableHandleStatement: RecyclableHandleStatement?\n    final var statement: StatementSelect\n\n    init(with core: Core, statement: StatementSelect) {\n        self.statement = statement\n        self.core = core\n    }\n\n    deinit {\n        try? finalize()\n    }\n\n    final func finalize() throws {\n        if let recyclableHandleStatement = optionalRecyclableHandleStatement {\n            try recyclableHandleStatement.raw.finalize()\n            optionalRecyclableHandleStatement = nil\n        }\n    }\n\n    final func lazyHandleStatement() throws -> HandleStatement {\n        if optionalRecyclableHandleStatement == nil {\n            optionalRecyclableHandleStatement = try core.prepare(statement)\n        }\n        return optionalRecyclableHandleStatement!.raw\n    }\n\n    //Since `next()` may throw errors, it can't conform to `Sequence` protocol to fit a `for in` loop.\n    @discardableResult\n    public final func next() throws -> Bool {\n        do {\n            return try lazyHandleStatement().step()\n        } catch let error {\n            try? finalize()\n            throw error\n        }\n    }\n\n    /// WINQ interface\n    ///\n    /// - Parameter condition: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public final func `where`(_ condition: Condition) -> Self {\n        statement.where(condition)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter orderList: Order convertible list\n    /// - Returns: `self`\n    @discardableResult\n    public final func order(by orderConvertibleList: OrderBy...) -> Self {\n        return order(by: orderConvertibleList)\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter orderList: Order convertible list\n    /// - Returns: `self`\n    @discardableResult\n    public final func order(by orderConvertibleList: [OrderBy]) -> Self {\n        statement.order(by: orderConvertibleList)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameters:\n    ///   - begin: Expression convertible\n    ///   - end: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public final func limit(from begin: Limit, to end: Limit) -> Self {\n        statement.limit(from: begin, to: end)\n        return self\n    }\n\n    @discardableResult\n    public final func limit(_ expressionConvertibleLimit: Limit) -> Self {\n        statement.limit(expressionConvertibleLimit)\n        return self\n    }\n\n    @discardableResult\n    public final func limit(_ expressionConvertibleLimit: Limit, offset expressionConvertibleOffset: Offset) -> Self {\n        statement.limit(expressionConvertibleLimit, offset: expressionConvertibleOffset)\n        return self\n    }\n\n    @discardableResult\n    public final func group(by expressionConvertibleGroupList: GroupBy...) -> Self {\n        return group(by: expressionConvertibleGroupList)\n    }\n\n    @discardableResult\n    public final func group(by expressionConvertibleGroupList: [GroupBy]) -> Self {\n        statement.group(by: expressionConvertibleGroupList)\n        return self\n    }\n\n    @discardableResult\n    public final func having(_ expressionConvertibleHaving: Having) -> Self {\n        statement.having(expressionConvertibleHaving)\n        return self\n    }\n}\n\nextension Selectable: CoreRepresentable {\n    /// The tag of the related database.\n    public final var tag: Tag? {\n        return core.tag\n    }\n\n    /// The path of the related database.\n    public final var path: String {\n        return core.path\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Table.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// Convenient table interface\npublic final class Table<Root: TableCodable> {\n    private let database: Database\n\n    /// Table name\n    public let name: String\n\n    /// Table related type\n    public var rootType: Root.Type {\n        return Root.self\n    }\n\n    init(withDatabase database: Database, named name: String, of type: Root.Type = Root.self) {\n        self.database = database\n        self.name = name\n    }\n}\n\nextension Table: CoreRepresentable {\n    public typealias Object = Root\n\n    /// The tag of the related database. \n    public var tag: Tag? {\n        return database.tag\n    }\n\n    /// The path of the related database. \n    public var path: String {\n        return database.path\n    }\n}\n\nextension Table: InsertTableInterface {\n\n    /// Execute inserting with `TableCodable` object on specific(or all) properties\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    /// - Throws: `Error`\n    public func insert(objects: [Object], on propertyConvertibleList: [PropertyConvertible]? = nil) throws {\n        let insert = try Insert(with: self.database, named: self.name, on: propertyConvertibleList, isReplace: false)\n        return try insert.execute(with: objects)\n    }\n\n    /// Execute inserting or replacing with `TableCodable` object on specific(or all) properties.  \n    /// It will replace the original row while they have same primary key or row id.\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    /// - Throws: `Error`\n    public func insertOrReplace(objects: [Object], on propertyConvertibleList: [PropertyConvertible]? = nil) throws {\n        let insert = try Insert(with: self.database, named: self.name, on: propertyConvertibleList, isReplace: true)\n        return try insert.execute(with: objects)\n    }\n\n    /// Execute inserting with `TableCodable` object on specific(or all) properties\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    /// - Throws: `Error`\n    public func insert(objects: Object..., on propertyConvertibleList: [PropertyConvertible]? = nil) throws {\n        return try insert(objects: objects, on: propertyConvertibleList)\n    }\n\n    /// Execute inserting or replacing with `TableCodable` object on specific(or all) properties.  \n    /// It will replace the original row while they have same primary key or row id.\n    ///\n    /// Note that it will run embedded transaction while objects.count>1.  \n    /// The embedded transaction means that it will run a transaction if it's not in other transaction,\n    /// otherwise it will be executed within the existing transaction.\n    ///\n    /// - Parameters:\n    ///   - objects: Table encodable object\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    /// - Throws: `Error`\n    public func insertOrReplace(objects: Object..., on propertyConvertibleList: [PropertyConvertible]? = nil) throws {\n        return try insertOrReplace(objects: objects, on: propertyConvertibleList)\n    }\n}\n\nextension Table: UpdateTableInterface {\n\n    /// Execute updating with `TableCodable` object on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    public func update(on propertyConvertibleList: [PropertyConvertible],\n                       with object: Object,\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        let update = try Update(with: self.database, on: propertyConvertibleList, andTable: self.name)\n        if condition != nil {\n            update.where(condition!)\n        }\n        if orderList != nil {\n            update.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                update.limit(limit!, offset: offset!)\n            } else {\n                update.limit(limit!)\n            }\n        }\n        return try update.execute(with: object)\n    }\n\n    /// Execute updating with `TableCodable` object on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    public func update(on propertyConvertibleList: PropertyConvertible...,\n                       with object: Object,\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        return try update(on: propertyConvertibleList,\n                          with: object,\n                          where: condition,\n                          orderBy: orderList,\n                          limit: limit,\n                          offset: offset)\n    }\n\n    /// Execute updating with row on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    public func update(on propertyConvertibleList: PropertyConvertible...,\n                       with row: [ColumnEncodable],\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        return try update(on: propertyConvertibleList,\n                          with: row,\n                          where: condition,\n                          orderBy: orderList,\n                          limit: limit,\n                          offset: offset)\n    }\n\n    /// Execute updating with row on specific(or all) properties. \n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - object: Table encodable object\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    public func update(on propertyConvertibleList: [PropertyConvertible],\n                       with row: [ColumnEncodable],\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        let update = try Update(with: self.database, on: propertyConvertibleList, andTable: self.name)\n        if condition != nil {\n            update.where(condition!)\n        }\n        if orderList != nil {\n            update.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                update.limit(limit!, offset: offset!)\n            } else {\n                update.limit(limit!)\n            }\n        }\n        return try update.execute(with: row)\n    }\n}\n\nextension Table: DeleteTableInterface {\n\n    /// Execute deleting \n    ///\n    /// - Parameters:\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Throws: `Error`\n    public func delete(where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       limit: Limit? = nil,\n                       offset: Offset? = nil) throws {\n        let delete = try Delete(with: self.database, andTableName: self.name)\n        if condition != nil {\n            delete.where(condition!)\n        }\n        if orderList != nil {\n            delete.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                delete.limit(limit!, offset: offset!)\n            } else {\n                delete.limit(limit!)\n            }\n        }\n        return try delete.execute()\n    }\n}\n\nextension Table: SelectTableInterface {\n\n    /// Get objects on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    public func getObjects(on propertyConvertibleList: [PropertyConvertible],\n                           where condition: Condition? = nil,\n                           orderBy orderList: [OrderBy]? = nil,\n                           limit: Limit? = nil,\n                           offset: Offset? = nil) throws -> [Object] {\n        let select = try Select(with: self.database, on: propertyConvertibleList, table: self.name, isDistinct: false)\n        if condition != nil {\n            select.where(condition!)\n        }\n        if orderList != nil {\n            select.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                select.limit(limit!, offset: offset!)\n            } else {\n                select.limit(limit!)\n            }\n        }\n        return try select.allObjects()\n    }\n\n    /// Get objects on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    public func getObjects(on propertyConvertibleList: PropertyConvertible...,\n                           where condition: Condition? = nil,\n                           orderBy orderList: [OrderBy]? = nil,\n                           limit: Limit? = nil,\n                           offset: Offset? = nil) throws -> [Object] {\n        return try getObjects(on: propertyConvertibleList.isEmpty ? Object.Properties.all : propertyConvertibleList,\n                              where: condition,\n                              orderBy: orderList,\n                              limit: limit,\n                              offset: offset)\n    }\n\n    /// Get object on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    public func getObject(on propertyConvertibleList: [PropertyConvertible],\n                          where condition: Condition? = nil,\n                          orderBy orderList: [OrderBy]? = nil,\n                          offset: Offset? = nil) throws -> Object? {\n        return try getObjects(on: propertyConvertibleList,\n                              where: condition,\n                              orderBy: orderList,\n                              limit: 1,\n                              offset: offset).first\n    }\n\n    /// Get object on specific(or all) properties\n    ///\n    /// - Parameters:\n    ///   - propertyConvertibleList: `Property` or `CodingTableKey` list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: Table decodable objects\n    /// - Throws: `Error`\n    public func getObject(on propertyConvertibleList: PropertyConvertible...,\n                          where condition: Condition? = nil,\n                          orderBy orderList: [OrderBy]? = nil,\n                          offset: Offset? = nil) throws -> Object? {\n        return try getObjects(on: propertyConvertibleList.isEmpty ? Object.Properties.all : propertyConvertibleList,\n                              where: condition,\n                              orderBy: orderList,\n                              limit: 1,\n                              offset: offset).first\n    }\n}\n\nextension Table: RowSelectTableInterface {\n\n    /// Get rows by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRowXColumn`\n    /// - Throws: `Error`\n    public func getRows(on columnResultConvertibleList: [ColumnResultConvertible],\n                        where condition: Condition? = nil,\n                        orderBy orderList: [OrderBy]? = nil,\n                        limit: Limit? = nil,\n                        offset: Offset? = nil) throws -> FundamentalRowXColumn {\n        let rowSelect = try RowSelect(with: self.database,\n                                      results: columnResultConvertibleList,\n                                      tables: [self.name],\n                                      isDistinct: false)\n        if condition != nil {\n            rowSelect.where(condition!)\n        }\n        if orderList != nil {\n            rowSelect.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                rowSelect.limit(limit!, offset: offset!)\n            } else {\n                rowSelect.limit(limit!)\n            }\n        }\n        return try rowSelect.allRows()\n    }\n\n    /// Get rows by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRowXColumn`\n    /// - Throws: `Error`\n    public func getRows(on columnResultConvertibleList: ColumnResultConvertible...,\n                        where condition: Condition? = nil,\n                        orderBy orderList: [OrderBy]? = nil,\n                        limit: Limit? = nil,\n                        offset: Offset? = nil) throws -> FundamentalRowXColumn {\n        return try getRows(on: columnResultConvertibleList.isEmpty ? [Column.all] : columnResultConvertibleList,\n                           where: condition,\n                           orderBy: orderList,\n                           limit: limit,\n                           offset: offset)\n    }\n\n    /// Get row by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRowXColumn`\n    /// - Throws: `Error`\n    public func getRow(on columnResultConvertibleList: ColumnResultConvertible...,\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       offset: Offset? = nil) throws -> FundamentalRow {\n        return try getRows(on: columnResultConvertibleList.isEmpty ? [Column.all] : columnResultConvertibleList,\n                           where: condition,\n                           orderBy: orderList,\n                           limit: 1,\n                           offset: offset).first ?? []\n    }\n\n    /// Get row by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertibleList: WINQ column result list\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalRowXColumn`\n    /// - Throws: `Error`\n    public func getRow(on columnResultConvertibleList: [ColumnResultConvertible],\n                       where condition: Condition? = nil,\n                       orderBy orderList: [OrderBy]? = nil,\n                       offset: Offset? = nil) throws -> FundamentalRow {\n        return try getRows(on: columnResultConvertibleList,\n                           where: condition,\n                           orderBy: orderList,\n                           limit: 1,\n                           offset: offset).first ?? []\n    }\n\n    /// Get column by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalColumn`\n    /// - Throws: `Error`\n    public func getColumn(on result: ColumnResultConvertible,\n                          where condition: Condition? = nil,\n                          orderBy orderList: [OrderBy]? = nil,\n                          limit: Limit? = nil,\n                          offset: Offset? = nil) throws -> FundamentalColumn {\n        let rowSelect = try RowSelect(with: self.database, results: [result], tables: [self.name], isDistinct: false)\n        if condition != nil {\n            rowSelect.where(condition!)\n        }\n        if orderList != nil {\n            rowSelect.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                rowSelect.limit(limit!, offset: offset!)\n            } else {\n                rowSelect.limit(limit!)\n            }\n        }\n        return try rowSelect.allValues()\n    }\n\n    /// Get distinct column by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalColumn`\n    /// - Throws: `Error`\n    public func getDistinctColumn(on result: ColumnResultConvertible,\n                                  where condition: Condition? = nil,\n                                  orderBy orderList: [OrderBy]? = nil,\n                                  limit: Limit? = nil,\n                                  offset: Offset? = nil) throws -> FundamentalColumn {\n        let rowSelect = try RowSelect(with: self.database, results: [result], tables: [self.name], isDistinct: true)\n        if condition != nil {\n            rowSelect.where(condition!)\n        }\n        if orderList != nil {\n            rowSelect.order(by: orderList!)\n        }\n        if limit != nil {\n            if offset != nil {\n                rowSelect.limit(limit!, offset: offset!)\n            } else {\n                rowSelect.limit(limit!)\n            }\n        }\n        return try rowSelect.allValues()\n    }\n\n    /// Get value by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalValue`\n    /// - Throws: `Error`\n    public func getValue(on result: ColumnResultConvertible,\n                         where condition: Condition? = nil,\n                         orderBy orderList: [OrderBy]? = nil,\n                         limit: Limit? = nil,\n                         offset: Offset? = nil) throws -> FundamentalValue {\n        return (try getRows(on: result,\n                            where: condition,\n                            orderBy: orderList,\n                            limit: 1,\n                            offset: offset).first?.first) ?? FundamentalValue(nil)\n    }\n\n    /// Get distinct value by specific selecting\n    ///\n    /// - Parameters:\n    ///   - columnResultConvertible: WINQ column result\n    ///   - condition: Expression convertible\n    ///   - orderList: Order convertible list\n    ///   - offset: Expression convertible\n    /// - Returns: `FundamentalValue`\n    /// - Throws: `Error`\n    public func getDistinctValue(on result: ColumnResultConvertible,\n                                 where condition: Condition? = nil,\n                                 orderBy orderList: [OrderBy]? = nil,\n                                 limit: Limit? = nil,\n                                 offset: Offset? = nil) throws -> FundamentalValue {\n        return (try getDistinctColumn(on: result).first) ?? FundamentalValue(nil)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/TableInterface.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol InsertTableInterface: class {\n    associatedtype Object: TableEncodable\n\n    func insert(objects: Object..., on propertyConvertibleList: [PropertyConvertible]?) throws\n    func insert(objects: [Object], on propertyConvertibleList: [PropertyConvertible]?) throws\n    func insertOrReplace(objects: Object..., on propertyConvertibleList: [PropertyConvertible]?) throws\n    func insertOrReplace(objects: [Object], on propertyConvertibleList: [PropertyConvertible]?) throws\n}\n\npublic protocol UpdateTableInterface: class {\n    associatedtype Object: TableEncodable\n\n    func update(on propertyConvertibleList: PropertyConvertible...,\n                with object: Object,\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                limit: Limit?,\n                offset: Offset?) throws\n    func update(on propertyConvertibleList: [PropertyConvertible],\n                with object: Object,\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                limit: Limit?,\n                offset: Offset?) throws\n    func update(on propertyConvertibleList: PropertyConvertible...,\n                with row: [ColumnEncodable],\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                limit: Limit?,\n                offset: Offset?) throws\n    func update(on propertyConvertibleList: [PropertyConvertible],\n                with row: [ColumnEncodable],\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                limit: Limit?,\n                offset: Offset?) throws\n}\n\npublic protocol DeleteTableInterface: class {\n    func delete(where condition: Condition?, orderBy orderList: [OrderBy]?, limit: Limit?, offset: Offset?) throws\n}\n\npublic protocol RowSelectTableInterface: class {\n    func getRows(on columnResultConvertibleList: [ColumnResultConvertible],\n                 where condition: Condition?,\n                 orderBy orderList: [OrderBy]?,\n                 limit: Limit?,\n                 offset: Offset?) throws -> FundamentalRowXColumn\n    func getRows(on columnResultConvertibleList: ColumnResultConvertible...,\n                 where condition: Condition?,\n                 orderBy orderList: [OrderBy]?,\n                 limit: Limit?,\n                 offset: Offset?) throws -> FundamentalRowXColumn\n\n    func getRow(on columnResultConvertibleList: ColumnResultConvertible...,\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                offset: Offset?) throws -> FundamentalRow\n    func getRow(on columnResultConvertibleList: [ColumnResultConvertible],\n                where condition: Condition?,\n                orderBy orderList: [OrderBy]?,\n                offset: Offset?) throws -> FundamentalRow\n\n    func getColumn(on result: ColumnResultConvertible,\n                   where condition: Condition?,\n                   orderBy orderList: [OrderBy]?,\n                   limit: Limit?,\n                   offset: Offset?) throws -> FundamentalColumn\n    func getDistinctColumn(on result: ColumnResultConvertible,\n                           where condition: Condition?,\n                           orderBy orderList: [OrderBy]?,\n                           limit: Limit?,\n                           offset: Offset?) throws -> FundamentalColumn\n\n    func getValue(on result: ColumnResultConvertible,\n                  where condition: Condition?,\n                  orderBy orderList: [OrderBy]?,\n                  limit: Limit?,\n                  offset: Offset?) throws -> FundamentalValue\n    func getDistinctValue(on result: ColumnResultConvertible,\n                          where condition: Condition?,\n                          orderBy orderList: [OrderBy]?,\n                          limit: Limit?,\n                          offset: Offset?) throws -> FundamentalValue\n}\n\npublic protocol SelectTableInterface: class {\n    associatedtype Object: TableDecodable\n\n    //TODO: Add generic property convertible to fit the type\n    func getObjects(on propertyConvertibleList: [PropertyConvertible],\n                    where condition: Condition?,\n                    orderBy orderList: [OrderBy]?,\n                    limit: Limit?,\n                    offset: Offset?) throws -> [Object]\n    func getObjects(on propertyConvertibleList: PropertyConvertible...,\n                    where condition: Condition?,\n                    orderBy orderList: [OrderBy]?,\n                    limit: Limit?,\n                    offset: Offset?) throws -> [Object]\n\n    func getObject(on propertyConvertibleList: [PropertyConvertible],\n                   where condition: Condition?,\n                   orderBy orderList: [OrderBy]?,\n                   offset: Offset?) throws -> Object?\n    func getObject(on propertyConvertibleList: PropertyConvertible...,\n                   where condition: Condition?,\n                   orderBy orderList: [OrderBy]?,\n                   offset: Offset?) throws -> Object?\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/core/interface/Update.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n/// The chain call for updating\npublic final class Update {\n    private var core: Core\n    private let statement = StatementUpdate()\n    private let keys: [CodingTableKeyBase]\n\n    /// The number of changed rows in the most recent call.\n    /// It should be called after executing successfully\n    public var changes: Int?\n\n    init(with core: Core, on propertyConvertibleList: [PropertyConvertible], andTable table: String) throws {\n        guard propertyConvertibleList.count > 0 else {\n            throw Error.reportInterface(tag: core.tag,\n                                        path: core.path,\n                                        operation: .update,\n                                        code: .misuse,\n                                        message: \"Updating \\(table) with empty property\")\n        }\n        guard table.count > 0 else {\n            throw Error.reportInterface(tag: core.tag,\n                                        path: core.path,\n                                        operation: .update,\n                                        code: .misuse,\n                                        message: \"Nil table name\")\n        }\n        self.keys = propertyConvertibleList.asCodingTableKeys()\n        self.core = core\n        self.statement\n            .update(table: table)\n            .set(propertyConvertibleList.map { (propertyConvertible) -> StatementUpdate.ValueType in\n            return (propertyConvertible, Expression.bindParameter)\n        })\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter condition: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func `where`(_ condition: Condition) -> Update {\n        statement.where(condition)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter orderList: Order convertible list\n    /// - Returns: `self`\n    @discardableResult\n    public func order(by orderList: OrderBy...) -> Update {\n        statement.order(by: orderList)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter orderList: Order convertible list\n    /// - Returns: `self`\n    @discardableResult\n    public func order(by orderList: [OrderBy]) -> Update {\n        statement.order(by: orderList)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameters:\n    ///   - begin: Expression convertible\n    ///   - end: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func limit(from begin: Limit, to end: Limit) -> Update {\n        statement.limit(from: begin, to: end)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameter limit: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func limit(_ limit: Limit) -> Update {\n        statement.limit(limit)\n        return self\n    }\n\n    /// WINQ interface for SQL\n    ///\n    /// - Parameters:\n    ///   - limit: Expression convertible\n    ///   - offset: Expression convertible\n    /// - Returns: `self`\n    @discardableResult\n    public func limit(_ limit: Limit, offset: Offset) -> Update {\n        statement.limit(limit, offset: offset)\n        return self\n    }\n\n    /// Execute the update chain call with object.\n    ///\n    /// - Parameter object: Table encodable object\n    /// - Throws: `Error`\n    public func execute<Object: TableEncodable>(with object: Object) throws {\n        let recyclableHandleStatement: RecyclableHandleStatement = try core.prepare(statement)\n        let handleStatement = recyclableHandleStatement.raw\n        let encoder = TableEncoder(keys, on: recyclableHandleStatement)\n        try object.encode(to: encoder)\n        try handleStatement.step()\n        changes = handleStatement.changes\n    }\n\n    /// Execute the update chain call with row.\n    ///\n    /// - Parameter row: Column encodable row\n    /// - Throws: `Error`\n    public func execute(with row: [ColumnEncodable?]) throws {\n        let recyclableHandleStatement: RecyclableHandleStatement = try core.prepare(statement)\n        let handleStatement = recyclableHandleStatement.raw\n        for (index, value) in row.enumerated() {\n            let bindingIndex = index + 1\n            if let archivedValue = value?.archivedValue() {\n                handleStatement.bind(archivedValue, toIndex: bindingIndex)\n            } else {\n                handleStatement.bind(nil, toIndex: bindingIndex)\n            }\n        }\n        try handleStatement.step()\n        changes = handleStatement.changes\n    }\n}\n\nextension Update: CoreRepresentable {\n\n    /// The tag of the related database.\n    public var tag: Tag? {\n        return core.tag\n    }\n\n    /// The path of the related database.\n    public var path: String {\n        return core.path\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/Atomic.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\nfinal class Atomic<Value> {\n    var raw: Value\n    let spin = Spin()\n\n    init(_ raw: Value) {\n        self.raw = raw\n    }\n\n    var value: Value {\n        spin.lock(); defer { spin.unlock() }\n        return raw\n    }\n\n    func withValue(_ closure: (Value) -> Value) {\n        spin.lock(); defer { spin.unlock() }\n        raw = closure(raw)\n    }\n\n    func assign(_ newValue: Value) {\n        spin.lock(); defer { spin.unlock() }\n        self.raw = newValue\n    }\n}\n\nextension Atomic where Value==Int {\n    static func += (left: Atomic, right: Value) {\n        left.withValue { (value) -> Value in\n            return value + right\n        }\n    }\n\n    static func -= (left: Atomic, right: Value) {\n        left.withValue { (value) -> Value in\n            return value - right\n        }\n    }\n\n    static prefix func ++ (atomic: Atomic) -> Value {\n        var newValue: Value = 0\n        atomic.withValue { (value) -> Value in\n            newValue = value + 1\n            return newValue\n        }\n        return newValue\n    }\n}\n\nextension Atomic where Value: Equatable {\n    static func == (left: Atomic, right: Value) -> Bool {\n        return left.value == right\n    }\n}\n\nextension Atomic where Value: Comparable {\n    static func < (left: Atomic, right: Value) -> Bool {\n        return left.value < right\n    }\n    static func > (left: Atomic, right: Value) -> Bool {\n        return left.value > right\n    }\n}\n\nextension Atomic where Value: OptionalRepresentable {\n    convenience init() {\n        self.init(Value.`nil`)\n    }\n}\n\nextension Atomic: CustomStringConvertible {\n    var description: String {\n        return \"\\(value)\"\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/ConcurrentList.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class ConcurrentList<Value> {\n    var values: [Value] = []\n    let capacityCap: Int\n    let spin = Spin()\n\n    init(withCapacityCap capacityCap: Int) {\n        self.capacityCap = capacityCap\n    }\n\n    func pushBack(_ value: Value) -> Bool {\n        spin.lock(); defer { spin.unlock() }\n        if values.count < capacityCap {\n            values.append(value)\n            return true\n        }\n        return false\n    }\n\n    func popBack() -> Value? {\n        spin.lock(); defer { spin.unlock() }\n        if !values.isEmpty {\n            return values.removeLast()\n        }\n        return nil\n    }\n\n    func clear() -> Int {\n        spin.lock(); defer { spin.unlock() }\n        let count = values.count\n        values.removeAll()\n        return count\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/Convenience.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nextension Array {\n    func joined(_ map: (Element) -> String, separateBy separator: String = \", \") -> String {\n        var flag = false\n        return reduce(into: \"\") { (output, element) in\n            if flag {\n                output.append(separator)\n            } else {\n                flag = true\n            }\n            output.append(map(element))\n        }\n    }\n}\n\nextension Array where Element: StringProtocol {\n    func joined(separateBy separator: String = \", \") -> String {\n        var flag = false\n        return reduce(into: \"\") { (output, element) in\n            if flag {\n                output.append(separator)\n            } else {\n                flag = true\n            }\n            output.append(String(element))\n        }\n    }\n}\n\nextension Array where Element: Describable {\n    func joined(separateBy separator: String = \", \") -> String {\n        return joined({ $0.description }, separateBy: separator)\n    }\n}\n\nextension Array where Element==ColumnResultConvertible {\n    func joined(separateBy separator: String = \", \") -> String {\n        return joined({ $0.asColumnResult().description }, separateBy: separator)\n    }\n}\n\nextension Array where Element==ExpressionConvertible {\n    func joined(separateBy separator: String = \", \") -> String {\n        return joined({ $0.asExpression().description }, separateBy: separator)\n    }\n}\n\nextension Array where Element==ColumnConvertible {\n    func joined(separateBy separator: String = \", \") -> String {\n        return joined({ $0.asColumn().description }, separateBy: separator)\n    }\n}\n\nextension Array where Element==TableOrSubqueryConvertible {\n    func joined(separateBy separator: String = \", \") -> String {\n        return joined({ $0.asTableOrSubquery().description }, separateBy: separator)\n    }\n}\n\nextension Array where Element==OrderConvertible {\n    func joined(separateBy separator: String = \", \") -> String {\n        return joined({ $0.asOrder().description }, separateBy: separator)\n    }\n}\n\nextension Array where Element==ColumnIndexConvertible {\n    func joined(separateBy separator: String = \", \") -> String {\n        return joined({ $0.asIndex().description }, separateBy: separator)\n    }\n\n    func asIndexes() -> [ColumnIndex] {\n        return map { $0.asIndex() }\n    }\n}\n\nextension Array where Element==PropertyConvertible {\n    func asCodingTableKeys() -> [CodingTableKeyBase] {\n        return reduce(into: [CodingTableKeyBase]()) { (result, element) in\n            result.append(element.codingTableKey)\n        }\n    }\n}\n\nextension Array {\n    mutating func expand(toNewSize newSize: Int, fillWith value: Iterator.Element) {\n        if count < newSize {\n            append(contentsOf: repeatElement(value, count: count.distance(to: newSize)))\n        }\n    }\n}\n\nextension Array where Iterator.Element: FixedWidthInteger {\n    mutating func expand(toNewSize newSize: Int) {\n        expand(toNewSize: newSize, fillWith: 0)\n    }\n}\n\nextension Dictionary {\n    func joined(_ map: (Key, Value) -> String, separateBy separator: String = \",\" ) -> String {\n        var flag = false\n        return reduce(into: \"\", { (output, arg) in\n            if flag {\n                output.append(separator)\n            } else {\n                flag = true\n            }\n            output.append(map(arg.key, arg.value))\n        })\n    }\n}\n\nextension String {\n    var lastPathComponent: String {\n        return URL(fileURLWithPath: self).lastPathComponent\n    }\n\n    func stringByAppending(pathComponent: String) -> String {\n        return URL(fileURLWithPath: self).appendingPathComponent(pathComponent).path\n    }\n\n    var cString: UnsafePointer<Int8>? {\n        return UnsafePointer<Int8>((self as NSString).utf8String)\n    }\n\n    init?(bytes: UnsafeRawPointer, count: Int, encoding: String.Encoding) {\n        self.init(data: Data(bytes: bytes, count: count), encoding: encoding)\n    }\n\n    func range(from begin: Int, to end: Int) -> Range<String.Index> {\n        return index(startIndex, offsetBy: begin)..<index(startIndex, offsetBy: end)\n    }\n\n    func range(location: Int, length: Int) -> Range<String.Index> {\n        return range(from: location, to: location + length)\n    }\n}\n\nextension Bool {\n    @inline(__always) func toInt32() -> Int32 {\n        return self ? 1 : 0\n    }\n}\n\nextension Int {\n    @inline(__always) func toInt64() -> Int64 {\n        return Int64(self)\n    }\n}\n\nextension Int8 {\n    @inline(__always) func toInt32() -> Int32 {\n        return Int32(self)\n    }\n}\n\nextension Int16 {\n    @inline(__always) func toInt32() -> Int32 {\n        return Int32(self)\n    }\n}\n\nextension Int32 {\n    @inline(__always) func toBool() -> Bool {\n        return self != 0\n    }\n    @inline(__always) func toInt8() -> Int8 {\n        return Int8(truncatingIfNeeded: self)\n    }\n    @inline(__always) func toInt16() -> Int16 {\n        return Int16(truncatingIfNeeded: self)\n    }\n    @inline(__always) func toUInt8() -> UInt8 {\n        return UInt8(bitPattern: Int8(truncatingIfNeeded: self))\n    }\n    @inline(__always) func toUInt16() -> UInt16 {\n        return UInt16(bitPattern: Int16(truncatingIfNeeded: self))\n    }\n    @inline(__always) func toUInt32() -> UInt32 {\n        return UInt32(bitPattern: self)\n    }\n}\n\nextension Int64 {\n    @inline(__always) func toInt() -> Int {\n        return Int(truncatingIfNeeded: self)\n    }\n    @inline(__always) func toUInt() -> UInt {\n        return UInt(bitPattern: Int(truncatingIfNeeded: self))\n    }\n    @inline(__always) func toUInt64() -> UInt64 {\n        return UInt64(bitPattern: self)\n    }\n}\n\nextension UInt {\n    @inline(__always) func toInt64() -> Int64 {\n        return Int64(bitPattern: UInt64(self))\n    }\n}\n\nextension UInt8 {\n    @inline(__always) func toInt32() -> Int32 {\n        return Int32(bitPattern: UInt32(self))\n    }\n}\n\nextension UInt16 {\n    @inline(__always) func toInt32() -> Int32 {\n        return Int32(bitPattern: UInt32(self))\n    }\n}\n\nextension UInt32 {\n    @inline(__always) func toInt32() -> Int32 {\n        return Int32(bitPattern: self)\n    }\n}\n\nextension UInt64 {\n    @inline(__always) func toInt64() -> Int64 {\n        return Int64(bitPattern: self)\n    }\n}\n\nextension Float {\n    @inline(__always) func toDouble() -> Double {\n        return Double(self)\n    }\n}\n\nextension Double {\n    @inline(__always) func toFloat() -> Float {\n        return Float(self)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/Error.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic struct ErrorValue {\n    public enum ErrorValueType {\n        case int\n        case string\n    }\n    private let value: Any\n    public let type: ErrorValueType\n\n    init(_ value: String) {\n        self.value = value\n        self.type = .string\n    }\n\n    init(_ value: Int) {\n        self.value = value\n        self.type = .int\n    }\n\n    public var intValue: Int {\n        switch type {\n        case .int:\n            return value as! Int\n        case .string:\n            return Int(value as! String) ?? 0\n        }\n    }\n\n    public var stringValue: String {\n        switch type {\n        case .int:\n            return String(value as! Int)\n        case .string:\n            return value as! String\n        }\n    }\n}\n\npublic final class Error: Swift.Error, CustomStringConvertible {\n    public enum Key: Int, CustomStringConvertible {\n        case tag = 1\n        case operation = 2\n        case extendedCode = 3\n        case message = 4\n        case SQL = 5\n        case path = 6\n\n        public var description: String {\n            switch self {\n            case .tag:\n                return \"Tag\"\n            case .operation:\n                return \"Operation\"\n            case .extendedCode:\n                return \"ExtendedCode\"\n            case .message:\n                return \"Message\"\n            case .SQL:\n                return \"SQL\"\n            case .path:\n                return \"Path\"\n            }\n        }\n    }\n\n    public enum ErrorType: Int, CustomStringConvertible {\n        case sqlite = 1\n        case systemCall = 2\n        case core = 3\n        case interface = 4\n        case warning = 6\n        case sqliteGlobal = 7\n        case repair = 8\n\n        public var description: String {\n            switch self {\n            case .sqlite:\n                return \"SQLite\"\n            case .systemCall:\n                return \"SystemCall\"\n            case .core:\n                return \"Core\"\n            case .interface:\n                return \"Interface\"\n            case .warning:\n                return \"Warning\"\n            case .sqliteGlobal:\n                return \"SQLiteGlobal\"\n            case .repair:\n                return \"Repair\"\n            }\n        }\n    }\n\n    public enum Operation {\n        public enum HandleOperation: Int {\n            case open = 1\n            case close = 2\n            case prepare = 3\n            case exec = 4\n            case step = 5\n            case finalize = 6\n            case setCipherKey = 7\n            case isTableExists = 8\n        }\n\n        public enum InterfaceOperation: Int {\n            case handleStatement = 1\n            case insert = 2\n            case update = 3\n            case select = 4\n            case table = 5\n            case chainCall = 6\n            case delete = 7\n        }\n\n        public enum CoreOperation: Int {\n            case prepare = 1\n            case exec = 2\n            case begin = 3\n            case commit = 4\n            case rollback = 5\n            case getThreadedHandle = 6\n            case flowOut = 7\n            case tokenize = 8\n            case encode = 9\n            case decode = 10\n            case getPool = 11\n        }\n\n        public enum SystemCallOperation: Int {\n            case remove = 257 // 1 + 1<<8 Swift not supported\n            case link = 258\n            case createDirectory = 259\n            case getFileSize = 260\n            case getAttributes = 261\n            case setAttributes = 262\n        }\n\n        public enum RepairOperation: Int {\n            case saveMaster\n            case loadMaster\n            case repair\n        }\n\n        case handle(HandleOperation)\n        case interface(InterfaceOperation)\n        case core(CoreOperation)\n        case systemCall(SystemCallOperation)\n        case repair(RepairOperation)\n\n        public var value: Int {\n            switch self {\n            case .handle(let value):\n                return value.rawValue\n            case .interface(let value):\n                return value.rawValue\n            case .core(let value):\n                return value.rawValue\n            case .systemCall(let value):\n                return value.rawValue\n            case .repair(let value):\n                return value.rawValue\n            }\n        }\n    }\n\n    public enum Code {\n        public enum CoreCode: Int {\n            case misuse = 1\n            case exceed = 2\n        }\n\n        public enum InterfaceCode: Int {\n            case ORM = 1\n            case inconsistent = 2\n            case misuse = 4\n        }\n\n        public enum GlobalCode: Int {\n            case warning = 1\n            case abort = 2\n        }\n\n        case repair(Int)\n        case sqliteGlobal(Int)\n        case systemCall(Int)\n        case sqlite(Int)\n        case core(CoreCode)\n        case interface(InterfaceCode)\n        case global(GlobalCode)\n\n        public var value: Int {\n            switch self {\n            case .repair(let value):\n                return value\n            case .sqliteGlobal(let value):\n                return value\n            case .systemCall(let value):\n                return value\n            case .sqlite(let value):\n                return value\n            case .core(let value):\n                return value.rawValue\n            case .interface(let value):\n                return value.rawValue\n            case .global(let value):\n                return value.rawValue\n            }\n        }\n    }\n\n    public typealias Infos = [Error.Key: ErrorValue]\n    public let infos: Infos\n\n    public let type: ErrorType\n    public let code: Error.Code\n\n    private init(type: Error.ErrorType, code: Error.Code, infos: Infos) {\n        self.infos = infos\n        self.type = type\n        self.code = code\n    }\n\n    public var tag: Tag? {\n        return infos[.tag]?.intValue\n    }\n\n    public var operationValue: Int? {\n        return infos[.operation]?.intValue\n    }\n\n    public var extendedCode: Int? {\n        return infos[.extendedCode]?.intValue\n    }\n\n    public var message: String? {\n        return infos[.message]?.stringValue\n    }\n\n    public var sql: String? {\n        return infos[.SQL]?.stringValue\n    }\n\n    public var path: String? {\n        return infos[.path]?.stringValue\n    }\n\n    public var description: String {\n        return \"Code:\\(code), Type:\\(type.description), \\(infos.joined({ \"\\($0.description):\\($1.stringValue)\" }))\"\n    }\n\n    static let threadedSlient = ThreadLocal<Bool>(defaultTo: false)\n\n    public typealias Reporter = (Error) -> Void\n    static private let defaultReporter: Reporter = {\n        switch $0.type {\n        case .sqliteGlobal:\n            debugPrint(\"[WCDB][DEBUG] \\($0.description)\")\n        case .warning:\n            print(\"[WCDB][WARNING] \\($0.description)\")\n        default:\n            print(\"[WCDB][ERROR] \\($0.description)\")\n        }\n    }\n    static private let reporter: Atomic<Reporter?> = Atomic(defaultReporter)\n\n    static public func setReporter(_ reporter: @escaping Reporter) {\n        Error.reporter.assign(reporter)\n    }\n    static public func setReporter(_: Void?) {\n        Error.reporter.assign(nil)\n    }\n    static public func resetReporter() {\n        Error.reporter.assign(defaultReporter)\n    }\n\n    private func report() {\n        guard !Error.threadedSlient.value else {\n            return\n        }\n        Error.reporter.raw?(self)\n    }\n\n    @discardableResult\n    static func report(type: ErrorType,\n                       code: Error.Code,\n                       infos: Error.Infos) -> Error {\n        let error = Error(type: type, code: code, infos: infos)\n        error.report()\n        return error\n    }\n\n    @discardableResult\n    static func reportSQLite(tag: Tag?,\n                             path: String,\n                             operation: Error.Operation.HandleOperation,\n                             extendedError: Int32? = nil,\n                             sql: String? = nil,\n                             code: Int32,\n                             message: String) -> Error {\n        var infos = [\n            Error.Key.operation: ErrorValue(operation.rawValue),\n            Error.Key.message: ErrorValue(message),\n            Error.Key.path: ErrorValue(path)]\n        if extendedError != nil {\n            infos[Error.Key.extendedCode] = ErrorValue(Int(extendedError!))\n        }\n        if sql != nil {\n            infos[Error.Key.SQL] = ErrorValue(sql!)\n        }\n        if tag != nil {\n            infos[Error.Key.tag] = ErrorValue(tag!)\n        }\n        return Error.report(type: .sqlite,\n                            code: .sqlite(Int(code)),\n                            infos: infos)\n    }\n\n    @discardableResult\n    static func reportCore(tag: Tag?,\n                           path: String,\n                           operation: Error.Operation.CoreOperation,\n                           code: Error.Code.CoreCode, message: String) -> Error {\n        var infos = [\n            Error.Key.operation: ErrorValue(operation.rawValue),\n            Error.Key.message: ErrorValue(message),\n            Error.Key.path: ErrorValue(path)]\n        if tag != nil {\n            infos[Error.Key.tag] = ErrorValue(tag!)\n        }\n        return Error.report(type: .core,\n                            code: .core(code),\n                            infos: infos)\n    }\n\n    @discardableResult\n    static func reportInterface(tag: Tag?,\n                                path: String,\n                                operation: Error.Operation.InterfaceOperation,\n                                code: Error.Code.InterfaceCode, message: String) -> Error {\n        var infos = [\n            Error.Key.operation: ErrorValue(operation.rawValue),\n            Error.Key.message: ErrorValue(message),\n            Error.Key.path: ErrorValue(path)]\n        if tag != nil {\n            infos[Error.Key.tag] = ErrorValue(tag!)\n        }\n        return Error.report(type: .interface,\n                            code: .interface(code),\n                            infos: infos)\n    }\n\n    @discardableResult\n    static func reportSystemCall(operation: Error.Operation.SystemCallOperation,\n                                 path: String,\n                                 errno: Int,\n                                 message: String) -> Error {\n        return Error.report(type: .systemCall, code: .systemCall(errno), infos: [\n            Error.Key.operation: ErrorValue(operation.rawValue),\n            Error.Key.message: ErrorValue(message),\n            Error.Key.path: ErrorValue(path)\n            ])\n    }\n\n    @discardableResult\n    static func reportSQLiteGlobal(code: Int,\n                                   message: String) -> Error {\n        return Error.report(type: .sqliteGlobal,\n                            code: .sqliteGlobal(code),\n                            infos: [Error.Key.message: ErrorValue(message)]\n        )\n    }\n\n    @discardableResult\n    static func reportRepair(path: String,\n                             operation: Error.Operation.RepairOperation,\n                             code: Int) -> Error {\n        return Error.report(type: .repair,\n                            code: .repair(code),\n                            infos: [\n                                Error.Key.path: ErrorValue(path),\n                                Error.Key.operation: ErrorValue(operation.rawValue)])\n    }\n\n    static func warning(_ message: String) {\n        Error.report(type: .warning,\n                     code: .global(.warning),\n                     infos: [Error.Key.message: ErrorValue(message)])\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/File.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class File {\n    static func remove(files: [String]) throws {\n        let fileManager = FileManager.default\n        try files.forEach { (file) in\n            do {\n                if fileManager.fileExists(atPath: file) {\n                    try FileManager.default.removeItem(atPath: file)\n                }\n            } catch let error as NSError {\n                throw Error.reportSystemCall(operation: .remove,\n                                             path: file,\n                                             errno: error.code,\n                                             message: error.localizedDescription)\n            }\n        }\n    }\n\n    static func getSize(ofFiles files: [String]) throws -> UInt64 {\n        let fileManager = FileManager.default\n        return try files.reduce(into: 0, { (filesSize, file) in\n            do {\n                filesSize += (try fileManager.attributesOfItem(atPath: file)[.size] as? UInt64) ?? 0\n            } catch let error as NSError {\n                throw Error.reportSystemCall(operation: .getFileSize,\n                                             path: file,\n                                             errno: error.code,\n                                             message: error.localizedDescription)\n            }\n        })\n    }\n\n    static func isExists(atPath path: String) -> Bool {\n        return FileManager.default.fileExists(atPath: path)\n    }\n\n    static func hardlink(atPath source: String, toPath destination: String) throws {\n        do {\n            try FileManager.default.linkItem(atPath: source, toPath: destination)\n        } catch let error as NSError {\n            throw Error.reportSystemCall(operation: .link,\n                                         path: destination,\n                                         errno: error.code,\n                                         message: error.localizedDescription)\n        }\n    }\n\n    static func createDirectoryWithIntermediateDirectories(atPath path: String) throws {\n        do {\n            try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)\n        } catch let error as NSError {\n            throw Error.reportSystemCall(operation: .createDirectory,\n                                         path: path,\n                                         errno: error.code,\n                                         message: error.localizedDescription)\n        }\n    }\n\n#if WCDB_IOS\n    static func addFirstUserAuthenticationFileProtection(atPath path: String) throws {\n        let fileManager = FileManager.default\n        guard fileManager.fileExists(atPath: path) else {\n            return\n        }\n        var attributes: [FileAttributeKey: Any]!\n        do {\n            attributes = try fileManager.attributesOfItem(atPath: path)\n        } catch let error as NSError {\n            throw Error.reportSystemCall(operation: .getAttributes,\n                                         path: path,\n                                         errno: error.code,\n                                         message: error.localizedDescription)\n        }\n        guard let fileProtection = attributes[.protectionKey] as? String,\n            (fileProtection == FileProtectionType.completeUntilFirstUserAuthentication.rawValue\n                || fileProtection == FileProtectionType.none.rawValue) else {\n            return\n        }\n        attributes[.protectionKey] = FileProtectionType.completeUntilFirstUserAuthentication.rawValue\n        do {\n            try fileManager.setAttributes(attributes, ofItemAtPath: path)\n        } catch let error as NSError {\n            throw Error.reportSystemCall(operation: .setAttributes,\n                                         path: path,\n                                         errno: error.code,\n                                         message: error.localizedDescription)\n        }\n    }\n#endif //WCDB_IOS\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/Lock.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nprotocol Lockable: class {\n    func lock()\n    func unlock()\n}\n\n@available(iOS 10.0, OSX 10.12, watchOS 3.0, tvOS 10.0, *)\nfinal class UnfairLock: Lockable {\n    private var unfairLock = os_unfair_lock_s()\n\n    func lock() {\n        os_unfair_lock_lock(&unfairLock)\n    }\n\n    func unlock() {\n        os_unfair_lock_unlock(&unfairLock)\n    }\n}\n\nfinal class Mutex: Lockable {\n    private var mutex = pthread_mutex_t()\n\n    init() {\n        pthread_mutex_init(&mutex, nil)\n    }\n\n    deinit {\n        pthread_mutex_destroy(&mutex)\n    }\n\n    func lock() {\n        pthread_mutex_lock(&mutex)\n    }\n\n    func unlock() {\n        pthread_mutex_unlock(&mutex)\n    }\n}\n\nfinal class RecursiveMutex: Lockable {\n    private var mutex = pthread_mutex_t()\n\n    init() {\n        var attr = pthread_mutexattr_t()\n        pthread_mutexattr_init(&attr)\n        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)\n        pthread_mutex_init(&mutex, &attr)\n    }\n\n    deinit {\n        pthread_mutex_destroy(&mutex)\n    }\n\n    func lock() {\n        pthread_mutex_lock(&mutex)\n    }\n\n    func unlock() {\n        pthread_mutex_unlock(&mutex)\n    }\n}\n\nfinal class Spin: Lockable {\n    private let locker: Lockable\n\n    init() {\n        if #available(iOS 10.0, macOS 10.12, watchOS 3.0, tvOS 10.0, *) {\n            locker = UnfairLock()\n        } else {\n            locker = Mutex()\n        }\n    }\n\n    func lock() {\n        locker.lock()\n    }\n\n    func unlock() {\n        locker.unlock()\n    }\n}\n\nfinal class ConditionLock: Lockable {\n    private var mutex = pthread_mutex_t()\n    private var cond = pthread_cond_t()\n\n    init() {\n        pthread_mutex_init(&mutex, nil)\n        pthread_cond_init(&cond, nil)\n    }\n\n    deinit {\n        pthread_cond_destroy(&cond)\n        pthread_mutex_destroy(&mutex)\n    }\n\n    func lock() {\n        pthread_mutex_lock(&mutex)\n    }\n\n    func unlock() {\n        pthread_mutex_unlock(&mutex)\n    }\n\n    func wait() {\n        pthread_cond_wait(&cond, &mutex)\n    }\n\n    func wait(timeout: TimeInterval) {\n        let integerPart = Int(timeout.nextDown)\n        let fractionalPart = timeout - Double(integerPart)\n        var ts = timespec(tv_sec: integerPart, tv_nsec: Int(fractionalPart * 1000000000))\n\n        pthread_cond_timedwait_relative_np(&cond, &mutex, &ts)\n    }\n\n    func signal() {\n        pthread_cond_signal(&cond)\n    }\n}\n\nextension DispatchQueue {\n    static private let spin = Spin()\n    static private var tracker: Set<String> = []\n\n    static func once(name: String, _ block: () -> Void) {\n        spin.lock(); defer { spin.unlock() }\n        guard !tracker.contains(name) else {\n            return\n        }\n        block()\n        tracker.insert(name)\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/Optional.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\npublic protocol OptionalRepresentable {\n    associatedtype WrappedType\n\n    static var `nil`: Self {get}\n}\n\nextension Optional: OptionalRepresentable {\n    public static var `nil`: Wrapped? {\n        return nil\n    }\n\n    public typealias WrappedType = Wrapped\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/RWLock.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class RWLock {\n    var mutex = pthread_mutex_t()\n    var cond = pthread_cond_t()\n    var reader = 0\n    var writer = 0\n    var pending = 0\n\n    init() {\n        pthread_mutex_init(&mutex, nil)\n        pthread_cond_init(&cond, nil)\n    }\n\n    deinit {\n        pthread_cond_destroy(&cond)\n        pthread_mutex_destroy(&mutex)\n    }\n\n    func lockRead() {\n        pthread_mutex_lock(&mutex); defer { pthread_mutex_unlock(&mutex) }\n        while writer>0 || pending>0 {\n            pthread_cond_wait(&cond, &mutex)\n        }\n        reader += 1\n    }\n\n    func unlockRead() {\n        pthread_mutex_lock(&mutex); defer { pthread_mutex_unlock(&mutex) }\n        reader -= 1\n        if reader == 0 {\n            pthread_cond_broadcast(&cond)\n        }\n    }\n\n    func lockWrite() {\n        pthread_mutex_lock(&mutex); defer { pthread_mutex_unlock(&mutex) }\n        pending += 1\n        while writer>0||reader>0 {\n            pthread_cond_wait(&cond, &mutex)\n        }\n        pending -= 1\n        writer += 1\n    }\n\n    func unlockWrite() {\n        pthread_mutex_lock(&mutex); defer { pthread_mutex_unlock(&mutex) }\n        writer -= 1\n        pthread_cond_broadcast(&cond)\n    }\n\n    var isWriting: Bool {\n        pthread_mutex_lock(&mutex); defer { pthread_mutex_unlock(&mutex) }\n        return writer>0\n    }\n\n//    var isReading: Bool {\n//        pthread_mutex_lock(&mutex); defer { pthread_mutex_unlock(&mutex) }\n//        return reader>0\n//    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/Recyclable.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\n//TODO: Refactor\nclass Recyclable<Value> {\n    typealias OnRecycled = () -> Void\n    let onRecycled: OnRecycled?\n\n    final let raw: Value\n\n    init(_ raw: Value, onRecycled: @escaping OnRecycled) {\n        self.raw = raw\n        self.onRecycled = onRecycled\n    }\n\n    init(_ raw: Value) {\n        self.raw = raw\n        self.onRecycled = nil\n    }\n\n    deinit {\n        if onRecycled != nil {\n            onRecycled!()\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/SQLite-Bridging.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <SQLite-Bridging.h>\n#include <sqlcipher/sqlite3.h>\n\nint sqlite3_bind_text_transient(sqlite3_stmt *a, int b, const char *c, int d)\n{\n    return sqlite3_bind_text(a, b, c, d, SQLITE_TRANSIENT);\n}\n\nint sqlite3_bind_blob_transient(sqlite3_stmt *a, int b, const void *c, int n)\n{\n    return sqlite3_bind_blob(a, b, c, n, SQLITE_TRANSIENT);\n}\n\nint sqlite3_config_multithread(void)\n{\n    return sqlite3_config(SQLITE_CONFIG_MULTITHREAD);\n}\n\nint sqlite3_config_memstatus(int a)\n{\n    return sqlite3_config(SQLITE_CONFIG_MEMSTATUS, a);\n}\n\nint sqlite3_config_log(sqlite3_global_log a, void *b)\n{\n    return sqlite3_config(SQLITE_CONFIG_LOG, a, b);\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/SQLite-Bridging.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef SQLite_Bridging_h\n#define SQLite_Bridging_h\n\n#import <sqlcipher/sqlite3.h>\n#import <sqlcipher/fts3_tokenizer.h>\n\nstruct Tokenizer {\n    sqlite3_tokenizer base;\n    void *info;\n};\ntypedef struct Tokenizer Tokenizer;\n\nstruct Cursor {\n    sqlite3_tokenizer_cursor base;\n    void *info;\n};\ntypedef struct Cursor Cursor;\n\ntypedef struct sqlite3_stmt sqlite3_stmt;\n\nint sqlite3_bind_text_transient(sqlite3_stmt *, int, const char *, int);\n\nint sqlite3_bind_blob_transient(sqlite3_stmt *, int, const void *, int n);\n\nint sqlite3_config_multithread(void);\n\nint sqlite3_config_memstatus(int);\n\ntypedef void (*sqlite3_global_log)(void *, int, const char *);\n\nint sqlite3_config_log(sqlite3_global_log, void *);\n\n#endif /* SQLite_Bridging_h */\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/SQLite-Bridging.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\ntypealias SQLite3 = OpaquePointer\ntypealias SQLite3Statement = OpaquePointer\ntypealias SQLite3Value = OpaquePointer\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/SteadyClock.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nstruct SteadyClock {\n    private var time: TimeInterval //monotonic\n\n    init() {\n        time = ProcessInfo.processInfo.systemUptime\n    }\n\n    private init(with time: TimeInterval) {\n        self.time = time\n    }\n\n    static func >= (lhs: SteadyClock, rhs: SteadyClock) -> Bool {\n        return lhs.time >= rhs.time\n    }\n\n    static func - (lhs: SteadyClock, rhs: SteadyClock) -> TimeInterval {\n        return lhs.time - rhs.time\n    }\n\n    static func + (steadyClock: SteadyClock, timeInterval: TimeInterval) -> SteadyClock {\n        return SteadyClock(with: steadyClock.time + timeInterval)\n    }\n\n    static func now() -> SteadyClock {\n        return SteadyClock()\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/Tagged.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class Counter {\n    static let counter = Atomic<Int>(0)\n\n    static func step() -> Int {\n        return ++counter\n    }\n}\n\nfinal class Tagged<Value>: Equatable {\n    let identifier: Int\n    let value: Value\n\n    init(_ value: Value) {\n        self.value = value\n        self.identifier = Counter.step()\n    }\n\n    static func == (lhs: Tagged, rhs: Tagged) -> Bool {\n        return lhs.identifier == rhs.identifier\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/ThreadLocal.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class ThreadLocal<Value> {\n    private final class Wrapper: RawRepresentable {\n        typealias RawValue = Value\n        var rawValue: RawValue\n        init(rawValue: RawValue) {\n            self.rawValue = rawValue\n        }\n    }\n\n    private var key = pthread_key_t()\n    private let defaultValue: Value\n\n    init(defaultTo defaultValue: Value) {\n        self.defaultValue = defaultValue\n        pthread_key_create(&key, {\n            Unmanaged<AnyObject>.fromOpaque($0).release()\n        })\n    }\n\n    deinit {\n        pthread_key_delete(key)\n    }\n\n    var value: Value {\n        get {\n            guard let pointer = pthread_getspecific(key) else {\n                return defaultValue\n            }\n            return Unmanaged<Wrapper>.fromOpaque(pointer).takeUnretainedValue().rawValue\n        }\n        set {\n            if let pointer = pthread_getspecific(key) {\n                Unmanaged<AnyObject>.fromOpaque(pointer).release()\n            }\n            pthread_setspecific(key, Unmanaged.passRetained(Wrapper(rawValue: newValue)).toOpaque())\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/TimedQueue.swift",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Foundation\n\nfinal class TimedQueue<Key: Hashable> {\n    typealias Element = (key: Key, clock: SteadyClock)\n    typealias List = ContiguousArray<Element>\n    typealias Map = [Key: List.Index]\n\n    let delay: TimeInterval\n\n    let conditionLock = ConditionLock()\n\n    var list: List = []\n    var map: Map = [:]\n\n    init(withDelay delay: TimeInterval) {\n        self.delay = delay\n    }\n\n    func remove(with key: Key) {\n        conditionLock.lock(); defer { conditionLock.unlock() }\n\n        guard let index = map.index(forKey: key) else {\n            return\n        }\n        list.remove(at: map[index].value)\n        map.remove(at: index)\n    }\n\n    func reQueue(with key: Key) {\n        conditionLock.lock(); defer { conditionLock.unlock() }\n\n        let signal = list.isEmpty\n\n        if let index = map.index(forKey: key) {\n            list.remove(at: map[index].value)\n            map.remove(at: index)\n        }\n\n        list.append((key, SteadyClock.now()+delay))\n        map[key] = list.startIndex\n        if signal {\n            conditionLock.signal()\n        }\n    }\n\n    func wait(untilExpired onExpired: (Key) -> Void) {\n        while true {\n            var key: Key!\n            do {\n                conditionLock.lock(); defer { conditionLock.unlock() }\n                guard let element = list.first else {\n                    conditionLock.wait()\n                    continue\n                }\n                let now = SteadyClock.now()\n                guard now >= element.clock else {\n                    conditionLock.wait(timeout: element.clock - now)\n                    continue\n                }\n                key = element.key\n                list.removeFirst()\n                map.removeValue(forKey: key)\n            }\n            onExpired(key)\n            break\n        }\n    }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift/swift/source/util/WCDB-Bridging.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#import <WCDBSwift/SQLite-Bridging.h>\n#import <sqliterk/SQLiteRepairKit.h>\n"
  },
  {
    "path": "JetChat/Pods/WCDB.swift.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t013C49983F0EECA1D8A34DA533D54FDA /* SQLite-Bridging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E08A31B9944C20AF702BFF31487B26 /* SQLite-Bridging.swift */; };\n\t\t027FBB30386906CB7D666487E2FF4A66 /* SteadyClock.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF09C4684DAF5C53F651A12665E712EE /* SteadyClock.swift */; };\n\t\t03E2C5F1955ECD1EF15D82E5EC9B8FD9 /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B686C32813C936FDE11A3DB35EE1223C /* Lock.swift */; };\n\t\t057F01C39FB58FF22E03AFFBB607460B /* StatementDelete.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB30B2758A6A3EB1B0440F07A1AAFE53 /* StatementDelete.swift */; };\n\t\t09B5305126B6501FA25712E8B70A9B21 /* LiteralValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9957C59BB8278AA543EED9EE7B3F717 /* LiteralValue.swift */; };\n\t\t0A44240895C20253A1BEDB25406F0D24 /* ConcurrentList.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4100FB1572B4FFF9BC0823334E46D0A /* ConcurrentList.swift */; };\n\t\t0A735124CB220FF49D59A2839E279005 /* WCDB-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CE2457E3A785CCC1F1BBAF4D3BFC797 /* WCDB-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t0CE6D870E82E92DAC1D268BD09384182 /* StatementUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BEA07CFC06457A8A467D0342B82B515 /* StatementUpdate.swift */; };\n\t\t108CEB813AC77900FA27318731EAB7E7 /* StatementCreateVirtualTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BA94E73A6AA7AFADBF222AD631C2EA3 /* StatementCreateVirtualTable.swift */; };\n\t\t1158B3A7F7B13FE1B18B20E798F9C037 /* StatementDetach.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9858E8604AF48747AACB12A457C85A9 /* StatementDetach.swift */; };\n\t\t164FC431C2C050C58EE8D3FE13AD3B7C /* CommonStatement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BFDC83A079F013EC393EDEA5311AC1F /* CommonStatement.swift */; };\n\t\t1A5AE75CB325FDE0AC2ED71CF101DCD3 /* Delete.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E8F2029D1DA6D5161B42F08326743A4 /* Delete.swift */; };\n\t\t1A9F71623EE8C0788EACB8EC3BCC0B51 /* ForeignKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D3E48F9A5461DD463EE0C3EEF332E81 /* ForeignKey.swift */; };\n\t\t1F99EF46B98800CDB68AF68EA1E262EB /* Tagged.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87EF7DE89F073C5CF0E2E2EF1EDF8403 /* Tagged.swift */; };\n\t\t25F87752AFB1F3692DC3352F345F061A /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2022CF10542329DC8936CACA73E04998 /* Property.swift */; };\n\t\t27285EA438ACA4C7C3FA010768CC874A /* Conflict.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8885D350E8A42497761E274A992B9B73 /* Conflict.swift */; };\n\t\t2742E413003BFBFFE684E5C8AFF9A033 /* Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA215A4BDE4A8A073E0A73804A039E6D /* Transaction.swift */; };\n\t\t27542F22338E7E2D0A2F52B7F98267BF /* HandleStatement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11F25A282B00D6F61100BA139521AD44 /* HandleStatement.swift */; };\n\t\t2D733EC011ADC52E59FC1B434469A9C4 /* StatementPragma.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAABB3B3ABC33ECEAF478AB029E1D1AA /* StatementPragma.swift */; };\n\t\t2FB28D118E2AA9CCD57C014FABFDC43B /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C5BA46911778FF62662D3A5426C702 /* File.swift */; };\n\t\t3081896F89A0CEAF2A6DFA5D27A71D30 /* StatementReindex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72FDDEB9BF881C859C978B9701954B7B /* StatementReindex.swift */; };\n\t\t3507771F850452E52FD00F0240FB87CC /* TableBinding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C0389C7B7CFECA4C3920EF57E7776FA /* TableBinding.swift */; };\n\t\t35AE817FAAD12574525181BD78289CD4 /* WCDBTokenize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B616A9C7C145026160A1AFE77E1A3EC /* WCDBTokenize.swift */; };\n\t\t36C85945DDAA28C3540DD5203E864757 /* Column.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B5711A41F0174277AA69BFCDEFE72C2 /* Column.swift */; };\n\t\t41057DCF05FEA8754E5BBEC9D03D2C9D /* SQLite-Bridging.c in Sources */ = {isa = PBXBuildFile; fileRef = BF6ED89BF4002C56CBA2CE19D641F86C /* SQLite-Bridging.c */; };\n\t\t411540B926330F2B4C0CD1A0B73C7970 /* StatementAlterTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F18E2A59564F802783ED4470309818 /* StatementAlterTable.swift */; };\n\t\t4170027AF8D5B066446C5E63991E8CE4 /* WCDB.swift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 852712D12B3C1B1496D1441A3DA7E0D1 /* WCDB.swift-dummy.m */; };\n\t\t420C83E705B190C9651D39CC25183A98 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = A072A85577232D3602D67420D247B29A /* Database.swift */; };\n\t\t4226345D7B0904E0CDCBCBF8BDBAA85B /* StatementCreateTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F3A6B036B3DC3E9662CB7451A13D9AB /* StatementCreateTable.swift */; };\n\t\t44A50DDDF23FF7261487BFBE84FBCC6F /* CodableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35F0B9AB8B06849F407E79FAE05BA4B1 /* CodableType.swift */; };\n\t\t45E6F826C2A1EB894323A3AB835DDF74 /* Tracer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFA7959A7E09FF6A1C90096FCE5917D7 /* Tracer.swift */; };\n\t\t460B13220E63BB29C50B9A81C920E55C /* TableInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2724EBAEEDA40E053BC7D2972D82C75 /* TableInterface.swift */; };\n\t\t4BC70847EDB20C944B7C2A351C4C835B /* TimedQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61F512DEA5FEBAED06568F9441A7A750 /* TimedQueue.swift */; };\n\t\t4C04341C03D6210505D3AAF473E60C2C /* Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69293118695D0B2F47F645F7DDC212B /* Atomic.swift */; };\n\t\t4D8872457636DC7DE18B1EDD8FF1F68D /* StatementTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98E79C7E6D850BF720AA67DB4A260627 /* StatementTransaction.swift */; };\n\t\t4E35F048A60D684A1AF3A39C65E8627D /* ColumnIndex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 556DEB63AD1B01D869D33C066F258EDF /* ColumnIndex.swift */; };\n\t\t4E45EB2AA7EE071B3AF29273757A5A20 /* Table.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADB932391AEBE2A3A9E779CDC6BC8105 /* Table.swift */; };\n\t\t4EE9AD3E9910A15E43E19B4953EB086E /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = A30DD9370A1DCF87A4E790AE0049A6D2 /* Expression.swift */; };\n\t\t51D5C837D9DE34211B0C02FC784A16EC /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8150A573BDC1D3AC81059AC513F9191 /* Interface.swift */; };\n\t\t5253A5A13AD9217F4A6D962982016F24 /* Recyclable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41556C5905EFD8DE76843D36C798E080 /* Recyclable.swift */; };\n\t\t541ABFAD60FE4CCF0E04C294742060A0 /* Redirectable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6069FE906D31FAAA5A5A51C9268B322E /* Redirectable.swift */; };\n\t\t58AFD8D688AF2FAB15C5BC32E1D931B2 /* WCDB.swift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0D4CFA836F2E528CC0D78A38E5F733BE /* WCDB.swift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t590F28AADEDE7D779CE69EFF2FE4B5FA /* Operable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0A19A0B8631B858C9A51608BD63E32 /* Operable.swift */; };\n\t\t597FA03029BCE471C1A35587575D5739 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A97867C652EC26F33DC49DD65FB7EEF /* Error.swift */; };\n\t\t5C9B13F548604463AA2A1CBB33B81AF6 /* Pragma.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6C26E33616678A12E1A7C495FBED9A /* Pragma.swift */; };\n\t\t5D31B58AA8971222E6E3F4ADA955A3C2 /* ColumnResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40CA9C2304C25B3020B2BF7019736E2A /* ColumnResult.swift */; };\n\t\t60E18F9137E555849F436FB0E538EAAC /* SQLite-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFD9ABD3192FB6F0CFC111E4BEE8691 /* SQLite-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t61982D488EA71F7E4D918CD9FA8DDA6C /* OrderTerm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D22AC97B70A4F6FB69CC0A286A0C8AF /* OrderTerm.swift */; };\n\t\t62123155EAC9628D827282EE79E3ADA8 /* ColumnTypeDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AF3E73D5B06E0DC15057AEAA3572EB8 /* ColumnTypeDecoder.swift */; };\n\t\t636D6CB65315F5F70587FC6CA12A1859 /* Describable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C69153D11363A2714DF4C7CAB842058 /* Describable.swift */; };\n\t\t64F8386A2A23D68CFDA0779FA1187AFB /* Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B1D4127B880F134D921AD7117AA9A4 /* Convenience.swift */; };\n\t\t66C797FDA5E6AEF8F5D9166A0D52DDAD /* Order.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31FF5DAF62E9CF36950C3CA905AFEC47 /* Order.swift */; };\n\t\t73EE699088AAFF42A92738A03ECE1800 /* ThreadLocal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C187450BC6F810CB23539C1FA17CB4C5 /* ThreadLocal.swift */; };\n\t\t75948F0B5BECFD01391CE7784BEAADD7 /* TableConstraintBinding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB0C43C9618877FC8828D1CAD186D17 /* TableConstraintBinding.swift */; };\n\t\t7B06E90A86A20EC975331C2185E7163C /* CodingTableKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8B4A394B4DAE41E5094878EB41D450 /* CodingTableKey.swift */; };\n\t\t7BFBAC1D28016BB288D7814B65E53FBF /* ColumnConstraintBinding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AED83AF31225358668C4DEAADE0EF75 /* ColumnConstraintBinding.swift */; };\n\t\t7BFEC7A885716EF738132187F3D6E8B4 /* RecyclableCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF55B1E1B831714705F639D14C78EEB /* RecyclableCore.swift */; };\n\t\t7D0CAF33CD81F1786DBD53A1780F046F /* VirtualTableBinding.swift in Sources */ = {isa = PBXBuildFile; fileRef = C543EC9361C34A1EE9316FE21535A3AA /* VirtualTableBinding.swift */; };\n\t\t84863242E71D9D5EBD62788E0E2463F1 /* StatementCreateIndex.swift in Sources */ = {isa = PBXBuildFile; fileRef = C23A8F76EA2BE173F73C4C243450DB7C /* StatementCreateIndex.swift */; };\n\t\t8502E94D8CA6CE7A531262889EF319BF /* ColumnDef.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8636DEAD76BFB246F040D3DC6B8E163 /* ColumnDef.swift */; };\n\t\t8A53B7A24C3E4361FB14031B0F8A1458 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6DAE773118685440F8C119A1D0F5E73 /* Config.swift */; };\n\t\t8ADD29697D81A1508C5A436306F5404A /* StatementDropTable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5FA1277FA83A71E00D492B1C940A833 /* StatementDropTable.swift */; };\n\t\t8B674C42B8B88408B148FB437BA872A3 /* Handle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850CFA069C42499D5C735AE5C455A6C2 /* Handle.swift */; };\n\t\t8C8E09AD9884DC975A09D7ADFF1EDFC5 /* Insert.swift in Sources */ = {isa = PBXBuildFile; fileRef = E61D7A41AF5364A0019326AC4C36B881 /* Insert.swift */; };\n\t\t8DD2A2F22AC74D04A0F3310C0B4477CA /* RWLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 250C4BEF407076E8FFF7BE2AA61C4E5A /* RWLock.swift */; };\n\t\t935B19477DBCFD792B7DA59BAB5E5987 /* StatementExplain.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2136B4CB345E0F5522D6E38BE472E8E /* StatementExplain.swift */; };\n\t\t96F2516496AB35A6D00D6469FE37A7E8 /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8237AE1F54F9AD9FF023E544033D4B5D /* Optional.swift */; };\n\t\t9894E474B1A3C23EDBF953CCF7C09721 /* StatementRollback.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62D798F17EF5348E08DF758B97F35FC1 /* StatementRollback.swift */; };\n\t\t9A1BEFAE555EFECAD64F6E650FB39065 /* JoinClause.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2FCF72CEBC9D21F967DB7060D7659E0E /* JoinClause.swift */; };\n\t\t9A326BB36F84A0970CDD0B04EED7FD90 /* Update.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8E3F113A1A6BBDC6BDA3640C627C7CE /* Update.swift */; };\n\t\tA0A39F09D5F414426870C6D45919F9CE /* CoreStatement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C91CD175DA1BB88A2027B09CF48974C /* CoreStatement.swift */; };\n\t\tA18E768F7DCBA92E7300EBA7786BE7B5 /* Master.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B1549E3CE4C7AF651944E5C6CB02D98 /* Master.swift */; };\n\t\tAE37BAF478BDC3ECE38CA8E7CBEBBC80 /* Selectable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73B5C1E80F9096A63A4754C85DA2F25 /* Selectable.swift */; };\n\t\tB1F017764DE4DE2493F9EFBB133B1F61 /* TableCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D14197B2368AB82106A039E2A064446 /* TableCodable.swift */; };\n\t\tB641AC664B036BDFA8B4D32FC40C3038 /* StatementInsert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ACB56B5CEC68AD9F5E791E9BDCE8DBA /* StatementInsert.swift */; };\n\t\tB75738C42FF3E2B1ADD4C093DEA4FA36 /* FundamentalValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818E7628E7138CED02695F2EDE6C209E /* FundamentalValue.swift */; };\n\t\tB7DAADF119C813387EE275612F979CC9 /* RowSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28E20AA21F95F75B43DE81757EADCB33 /* RowSelect.swift */; };\n\t\tB975DD5356F7614B19AEBA695F49B60F /* ChainCall.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBF8021882798D76E0B02F4A5481B4E5 /* ChainCall.swift */; };\n\t\tB992BD920F062A98DB76CAA57CC65016 /* Select.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6FAF1EE7E0958C5A0D4CF010C31215A /* Select.swift */; };\n\t\tBB45D150EA5D8F723BE7B917E33CDA40 /* StatementAttach.swift in Sources */ = {isa = PBXBuildFile; fileRef = 876E5371414417DDF4BEA602518CFA3A /* StatementAttach.swift */; };\n\t\tC0B88E4E8E5C37FDCD5FD19FF1D310E2 /* TableDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C2ED18B51A4C7DD87CCE7295981261F /* TableDecoder.swift */; };\n\t\tC0E494FF213635338AEC64E3A2F2902B /* StatementRelease.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F57086D5E003E32ABBFA302D1DD71A /* StatementRelease.swift */; };\n\t\tC2E0636249C902EAA944FD025C99F6D6 /* TableConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 091CDD59C8ED5A90B7B4852772AD98B0 /* TableConstraint.swift */; };\n\t\tC569E19DB5C136C106A9980145994EC6 /* StatementSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BD960FB3ADAA50C308AABB9D8CDECD3 /* StatementSelect.swift */; };\n\t\tC5D519944ACDC263510487399B391475 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F7325B2767832D11A0011B90C35553B /* Foundation.framework */; };\n\t\tCABCF14E49BA41994954081BF8ABE15C /* StatementVacuum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA0FEBB911E31FCB4314040A892CB75 /* StatementVacuum.swift */; };\n\t\tCD6E19C7279B89860B5B9C5087DB94A8 /* HandlePool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35632D7059C7C3D63BFDAE3C2950F99B /* HandlePool.swift */; };\n\t\tD4373ABC40D7F0C67A742963EE8FF6EB /* Core.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76099F2136F86EB5DD070AEB13864A2 /* Core.swift */; };\n\t\tD631F583C2EA5472A16E5F7AB962CF91 /* Subquery.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0973A02C166F02D2B2BB547B0783968 /* Subquery.swift */; };\n\t\tD9A7050E1F3203213F4E34AEAAAE44E4 /* IndexBinding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F37419A6C8B2273C4C381E263B15D9A /* IndexBinding.swift */; };\n\t\tDA582DC413045D8D18A139F7A390F858 /* TableEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65594E69A47D5B4D128588D57936C5E5 /* TableEncoder.swift */; };\n\t\tE77E7B2339FF313F9E403D38E13AC970 /* Statement.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE14A0D584C0DFDF40A5F5FA4D9097D2 /* Statement.swift */; };\n\t\tE8147E0DEDC9530280573CCD81E3683A /* MultiSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1515A54E06ADA4740E6FE41C28AF8E0A /* MultiSelect.swift */; };\n\t\tEB8C24F2A6056F99304A7F19E4F9A6D3 /* Convertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 289B4713A044588BE0671E1371F51F4C /* Convertible.swift */; };\n\t\tEBE779F57B5DB9845B4231091950A55B /* Tokenize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 780D868999536DD6588F13D551D87EE5 /* Tokenize.swift */; };\n\t\tEC3A07095422AFD616641F8B09AB759D /* StatementDropIndex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B03A3018E6B6D4746F18BF0CCC1CCF2 /* StatementDropIndex.swift */; };\n\t\tEDF37404F21B1CA75000D2FD87315797 /* StatementSavepoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B2677580CE29ECC98DFE7AE0128AF9D /* StatementSavepoint.swift */; };\n\t\tFAEC088031C3391ED364D1AC2D5BE42C /* ColumnCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE229B49576F2A4BC0D0D023C1A6CC22 /* ColumnCodable.swift */; };\n\t\tFCA55725F335187FD21571F95AD07D24 /* ModuleArgument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25CDB6F01644F8DCC4AACD6BA8B3D033 /* ModuleArgument.swift */; };\n\t\tFDE71B5195873F497F5A43A841A88485 /* Declare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5707A207867E6D67EBA1B96EA4485C /* Declare.swift */; };\n\t\tFFF528C305E19A5ECE6C9A1BFFED7C09 /* ColumnType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3299F12080A3B1EFA7669D7E3FFE6D5 /* ColumnType.swift */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\tB53AE04AAEE7B23EFE228ED0AFD8249C /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = A3BC5694ADA3E5F70C591744B5EFCC9C /* WCDBOptimizedSQLCipher.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 8820E4661B26990965C45655F51ED18B;\n\t\t\tremoteInfo = WCDBOptimizedSQLCipher;\n\t\t};\n\t\tF27637A61560590496E5791936F3AD3F /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 27D1A72264D8220BAED8CE47CC9BA36F /* SQLiteRepairKit.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 1A6A317D19224BA6C654767A5DA5460D;\n\t\t\tremoteInfo = SQLiteRepairKit;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t08E08A31B9944C20AF702BFF31487B26 /* SQLite-Bridging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = \"SQLite-Bridging.swift\"; path = \"swift/source/util/SQLite-Bridging.swift\"; sourceTree = \"<group>\"; };\n\t\t091CDD59C8ED5A90B7B4852772AD98B0 /* TableConstraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TableConstraint.swift; path = swift/source/abstract/TableConstraint.swift; sourceTree = \"<group>\"; };\n\t\t0A5707A207867E6D67EBA1B96EA4485C /* Declare.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Declare.swift; path = swift/source/core/interface/Declare.swift; sourceTree = \"<group>\"; };\n\t\t0A97867C652EC26F33DC49DD65FB7EEF /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = swift/source/util/Error.swift; sourceTree = \"<group>\"; };\n\t\t0ACB56B5CEC68AD9F5E791E9BDCE8DBA /* StatementInsert.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementInsert.swift; path = swift/source/abstract/StatementInsert.swift; sourceTree = \"<group>\"; };\n\t\t0B5711A41F0174277AA69BFCDEFE72C2 /* Column.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Column.swift; path = swift/source/abstract/Column.swift; sourceTree = \"<group>\"; };\n\t\t0BFDC83A079F013EC393EDEA5311AC1F /* CommonStatement.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CommonStatement.swift; path = swift/source/builtin/CommonStatement.swift; sourceTree = \"<group>\"; };\n\t\t0C0389C7B7CFECA4C3920EF57E7776FA /* TableBinding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TableBinding.swift; path = swift/source/core/binding/TableBinding.swift; sourceTree = \"<group>\"; };\n\t\t0D4CFA836F2E528CC0D78A38E5F733BE /* WCDB.swift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"WCDB.swift-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t11F25A282B00D6F61100BA139521AD44 /* HandleStatement.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HandleStatement.swift; path = swift/source/abstract/HandleStatement.swift; sourceTree = \"<group>\"; };\n\t\t1515A54E06ADA4740E6FE41C28AF8E0A /* MultiSelect.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultiSelect.swift; path = swift/source/core/interface/MultiSelect.swift; sourceTree = \"<group>\"; };\n\t\t1F0A19A0B8631B858C9A51608BD63E32 /* Operable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Operable.swift; path = swift/source/abstract/Operable.swift; sourceTree = \"<group>\"; };\n\t\t2022CF10542329DC8936CACA73E04998 /* Property.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Property.swift; path = swift/source/core/binding/Property.swift; sourceTree = \"<group>\"; };\n\t\t250C4BEF407076E8FFF7BE2AA61C4E5A /* RWLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RWLock.swift; path = swift/source/util/RWLock.swift; sourceTree = \"<group>\"; };\n\t\t25AB8830D14FEBB1F527B331B408FD4D /* WCDB.swift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = WCDB.swift; path = WCDBSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t25CDB6F01644F8DCC4AACD6BA8B3D033 /* ModuleArgument.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ModuleArgument.swift; path = swift/source/abstract/ModuleArgument.swift; sourceTree = \"<group>\"; };\n\t\t27D1A72264D8220BAED8CE47CC9BA36F /* SQLiteRepairKit */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SQLiteRepairKit; path = SQLiteRepairKit.xcodeproj; sourceTree = \"<group>\"; };\n\t\t289B4713A044588BE0671E1371F51F4C /* Convertible.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Convertible.swift; path = swift/source/abstract/Convertible.swift; sourceTree = \"<group>\"; };\n\t\t28E20AA21F95F75B43DE81757EADCB33 /* RowSelect.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RowSelect.swift; path = swift/source/core/interface/RowSelect.swift; sourceTree = \"<group>\"; };\n\t\t28F18E2A59564F802783ED4470309818 /* StatementAlterTable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementAlterTable.swift; path = swift/source/abstract/StatementAlterTable.swift; sourceTree = \"<group>\"; };\n\t\t2B1549E3CE4C7AF651944E5C6CB02D98 /* Master.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Master.swift; path = swift/source/builtin/Master.swift; sourceTree = \"<group>\"; };\n\t\t2C91CD175DA1BB88A2027B09CF48974C /* CoreStatement.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CoreStatement.swift; path = swift/source/core/base/CoreStatement.swift; sourceTree = \"<group>\"; };\n\t\t2D14197B2368AB82106A039E2A064446 /* TableCodable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TableCodable.swift; path = swift/source/core/codable/TableCodable.swift; sourceTree = \"<group>\"; };\n\t\t2FCF72CEBC9D21F967DB7060D7659E0E /* JoinClause.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JoinClause.swift; path = swift/source/abstract/JoinClause.swift; sourceTree = \"<group>\"; };\n\t\t31FF5DAF62E9CF36950C3CA905AFEC47 /* Order.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Order.swift; path = swift/source/abstract/Order.swift; sourceTree = \"<group>\"; };\n\t\t35632D7059C7C3D63BFDAE3C2950F99B /* HandlePool.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HandlePool.swift; path = swift/source/core/base/HandlePool.swift; sourceTree = \"<group>\"; };\n\t\t35F0B9AB8B06849F407E79FAE05BA4B1 /* CodableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CodableType.swift; path = swift/source/builtin/CodableType.swift; sourceTree = \"<group>\"; };\n\t\t3E8F2029D1DA6D5161B42F08326743A4 /* Delete.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Delete.swift; path = swift/source/core/interface/Delete.swift; sourceTree = \"<group>\"; };\n\t\t3F37419A6C8B2273C4C381E263B15D9A /* IndexBinding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IndexBinding.swift; path = swift/source/core/binding/IndexBinding.swift; sourceTree = \"<group>\"; };\n\t\t40CA9C2304C25B3020B2BF7019736E2A /* ColumnResult.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColumnResult.swift; path = swift/source/abstract/ColumnResult.swift; sourceTree = \"<group>\"; };\n\t\t41556C5905EFD8DE76843D36C798E080 /* Recyclable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Recyclable.swift; path = swift/source/util/Recyclable.swift; sourceTree = \"<group>\"; };\n\t\t4B6C26E33616678A12E1A7C495FBED9A /* Pragma.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Pragma.swift; path = swift/source/abstract/Pragma.swift; sourceTree = \"<group>\"; };\n\t\t4BA0FEBB911E31FCB4314040A892CB75 /* StatementVacuum.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementVacuum.swift; path = swift/source/abstract/StatementVacuum.swift; sourceTree = \"<group>\"; };\n\t\t4BFD9ABD3192FB6F0CFC111E4BEE8691 /* SQLite-Bridging.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"SQLite-Bridging.h\"; path = \"swift/source/util/SQLite-Bridging.h\"; sourceTree = \"<group>\"; };\n\t\t4CE2457E3A785CCC1F1BBAF4D3BFC797 /* WCDB-Bridging.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"WCDB-Bridging.h\"; path = \"swift/source/util/WCDB-Bridging.h\"; sourceTree = \"<group>\"; };\n\t\t4F8B4A394B4DAE41E5094878EB41D450 /* CodingTableKey.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CodingTableKey.swift; path = swift/source/core/codable/CodingTableKey.swift; sourceTree = \"<group>\"; };\n\t\t556DEB63AD1B01D869D33C066F258EDF /* ColumnIndex.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColumnIndex.swift; path = swift/source/abstract/ColumnIndex.swift; sourceTree = \"<group>\"; };\n\t\t56B1D4127B880F134D921AD7117AA9A4 /* Convenience.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Convenience.swift; path = swift/source/util/Convenience.swift; sourceTree = \"<group>\"; };\n\t\t5F3A6B036B3DC3E9662CB7451A13D9AB /* StatementCreateTable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementCreateTable.swift; path = swift/source/abstract/StatementCreateTable.swift; sourceTree = \"<group>\"; };\n\t\t6069FE906D31FAAA5A5A51C9268B322E /* Redirectable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Redirectable.swift; path = swift/source/core/binding/Redirectable.swift; sourceTree = \"<group>\"; };\n\t\t61F512DEA5FEBAED06568F9441A7A750 /* TimedQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimedQueue.swift; path = swift/source/util/TimedQueue.swift; sourceTree = \"<group>\"; };\n\t\t62D798F17EF5348E08DF758B97F35FC1 /* StatementRollback.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementRollback.swift; path = swift/source/abstract/StatementRollback.swift; sourceTree = \"<group>\"; };\n\t\t65594E69A47D5B4D128588D57936C5E5 /* TableEncoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TableEncoder.swift; path = swift/source/core/codable/TableEncoder.swift; sourceTree = \"<group>\"; };\n\t\t6AF3E73D5B06E0DC15057AEAA3572EB8 /* ColumnTypeDecoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColumnTypeDecoder.swift; path = swift/source/core/codable/ColumnTypeDecoder.swift; sourceTree = \"<group>\"; };\n\t\t6BB0C43C9618877FC8828D1CAD186D17 /* TableConstraintBinding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TableConstraintBinding.swift; path = swift/source/core/binding/TableConstraintBinding.swift; sourceTree = \"<group>\"; };\n\t\t6C69153D11363A2714DF4C7CAB842058 /* Describable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Describable.swift; path = swift/source/abstract/Describable.swift; sourceTree = \"<group>\"; };\n\t\t6D3E48F9A5461DD463EE0C3EEF332E81 /* ForeignKey.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ForeignKey.swift; path = swift/source/abstract/ForeignKey.swift; sourceTree = \"<group>\"; };\n\t\t6D794FD8E0619A9A29319C0E5C081F2D /* WCDB.swift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"WCDB.swift-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t72FDDEB9BF881C859C978B9701954B7B /* StatementReindex.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementReindex.swift; path = swift/source/abstract/StatementReindex.swift; sourceTree = \"<group>\"; };\n\t\t74F57086D5E003E32ABBFA302D1DD71A /* StatementRelease.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementRelease.swift; path = swift/source/abstract/StatementRelease.swift; sourceTree = \"<group>\"; };\n\t\t780D868999536DD6588F13D551D87EE5 /* Tokenize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Tokenize.swift; path = swift/source/abstract/Tokenize.swift; sourceTree = \"<group>\"; };\n\t\t7AED83AF31225358668C4DEAADE0EF75 /* ColumnConstraintBinding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColumnConstraintBinding.swift; path = swift/source/core/binding/ColumnConstraintBinding.swift; sourceTree = \"<group>\"; };\n\t\t7B03A3018E6B6D4746F18BF0CCC1CCF2 /* StatementDropIndex.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementDropIndex.swift; path = swift/source/abstract/StatementDropIndex.swift; sourceTree = \"<group>\"; };\n\t\t7F7325B2767832D11A0011B90C35553B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t7F76470DDEFC667342A99BB50D821A2C /* WCDB.swift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = WCDB.swift.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t818E7628E7138CED02695F2EDE6C209E /* FundamentalValue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FundamentalValue.swift; path = swift/source/abstract/FundamentalValue.swift; sourceTree = \"<group>\"; };\n\t\t8237AE1F54F9AD9FF023E544033D4B5D /* Optional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Optional.swift; path = swift/source/util/Optional.swift; sourceTree = \"<group>\"; };\n\t\t850CFA069C42499D5C735AE5C455A6C2 /* Handle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Handle.swift; path = swift/source/abstract/Handle.swift; sourceTree = \"<group>\"; };\n\t\t852712D12B3C1B1496D1441A3DA7E0D1 /* WCDB.swift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"WCDB.swift-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t876E5371414417DDF4BEA602518CFA3A /* StatementAttach.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementAttach.swift; path = swift/source/abstract/StatementAttach.swift; sourceTree = \"<group>\"; };\n\t\t87EF7DE89F073C5CF0E2E2EF1EDF8403 /* Tagged.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Tagged.swift; path = swift/source/util/Tagged.swift; sourceTree = \"<group>\"; };\n\t\t8885D350E8A42497761E274A992B9B73 /* Conflict.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Conflict.swift; path = swift/source/abstract/Conflict.swift; sourceTree = \"<group>\"; };\n\t\t8B2677580CE29ECC98DFE7AE0128AF9D /* StatementSavepoint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementSavepoint.swift; path = swift/source/abstract/StatementSavepoint.swift; sourceTree = \"<group>\"; };\n\t\t8B616A9C7C145026160A1AFE77E1A3EC /* WCDBTokenize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = WCDBTokenize.swift; path = swift/source/core/fts/WCDBTokenize.swift; sourceTree = \"<group>\"; };\n\t\t8BEA07CFC06457A8A467D0342B82B515 /* StatementUpdate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementUpdate.swift; path = swift/source/abstract/StatementUpdate.swift; sourceTree = \"<group>\"; };\n\t\t8D22AC97B70A4F6FB69CC0A286A0C8AF /* OrderTerm.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = OrderTerm.swift; path = swift/source/abstract/OrderTerm.swift; sourceTree = \"<group>\"; };\n\t\t927502B7DA546FD969269DE71CE79192 /* WCDB.swift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = WCDB.swift.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t9308F505A163D227DD4D7E7BA7577B2F /* WCDB.swift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"WCDB.swift-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t97C5BA46911778FF62662D3A5426C702 /* File.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = File.swift; path = swift/source/util/File.swift; sourceTree = \"<group>\"; };\n\t\t98E79C7E6D850BF720AA67DB4A260627 /* StatementTransaction.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementTransaction.swift; path = swift/source/abstract/StatementTransaction.swift; sourceTree = \"<group>\"; };\n\t\t9BA94E73A6AA7AFADBF222AD631C2EA3 /* StatementCreateVirtualTable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementCreateVirtualTable.swift; path = swift/source/abstract/StatementCreateVirtualTable.swift; sourceTree = \"<group>\"; };\n\t\t9BD960FB3ADAA50C308AABB9D8CDECD3 /* StatementSelect.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementSelect.swift; path = swift/source/abstract/StatementSelect.swift; sourceTree = \"<group>\"; };\n\t\t9C2ED18B51A4C7DD87CCE7295981261F /* TableDecoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TableDecoder.swift; path = swift/source/core/codable/TableDecoder.swift; sourceTree = \"<group>\"; };\n\t\tA072A85577232D3602D67420D247B29A /* Database.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Database.swift; path = swift/source/core/base/Database.swift; sourceTree = \"<group>\"; };\n\t\tA30DD9370A1DCF87A4E790AE0049A6D2 /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = swift/source/abstract/Expression.swift; sourceTree = \"<group>\"; };\n\t\tA3BC5694ADA3E5F70C591744B5EFCC9C /* WCDBOptimizedSQLCipher */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = WCDBOptimizedSQLCipher; path = WCDBOptimizedSQLCipher.xcodeproj; sourceTree = \"<group>\"; };\n\t\tAA215A4BDE4A8A073E0A73804A039E6D /* Transaction.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Transaction.swift; path = swift/source/core/base/Transaction.swift; sourceTree = \"<group>\"; };\n\t\tADB932391AEBE2A3A9E779CDC6BC8105 /* Table.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Table.swift; path = swift/source/core/interface/Table.swift; sourceTree = \"<group>\"; };\n\t\tB0973A02C166F02D2B2BB547B0783968 /* Subquery.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Subquery.swift; path = swift/source/abstract/Subquery.swift; sourceTree = \"<group>\"; };\n\t\tB2136B4CB345E0F5522D6E38BE472E8E /* StatementExplain.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementExplain.swift; path = swift/source/abstract/StatementExplain.swift; sourceTree = \"<group>\"; };\n\t\tB686C32813C936FDE11A3DB35EE1223C /* Lock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Lock.swift; path = swift/source/util/Lock.swift; sourceTree = \"<group>\"; };\n\t\tB8E3F113A1A6BBDC6BDA3640C627C7CE /* Update.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Update.swift; path = swift/source/core/interface/Update.swift; sourceTree = \"<group>\"; };\n\t\tB9858E8604AF48747AACB12A457C85A9 /* StatementDetach.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementDetach.swift; path = swift/source/abstract/StatementDetach.swift; sourceTree = \"<group>\"; };\n\t\tBF6ED89BF4002C56CBA2CE19D641F86C /* SQLite-Bridging.c */ = {isa = PBXFileReference; includeInIndex = 1; name = \"SQLite-Bridging.c\"; path = \"swift/source/util/SQLite-Bridging.c\"; sourceTree = \"<group>\"; };\n\t\tBFF55B1E1B831714705F639D14C78EEB /* RecyclableCore.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecyclableCore.swift; path = swift/source/core/base/RecyclableCore.swift; sourceTree = \"<group>\"; };\n\t\tC187450BC6F810CB23539C1FA17CB4C5 /* ThreadLocal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThreadLocal.swift; path = swift/source/util/ThreadLocal.swift; sourceTree = \"<group>\"; };\n\t\tC23A8F76EA2BE173F73C4C243450DB7C /* StatementCreateIndex.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementCreateIndex.swift; path = swift/source/abstract/StatementCreateIndex.swift; sourceTree = \"<group>\"; };\n\t\tC3299F12080A3B1EFA7669D7E3FFE6D5 /* ColumnType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColumnType.swift; path = swift/source/abstract/ColumnType.swift; sourceTree = \"<group>\"; };\n\t\tC543EC9361C34A1EE9316FE21535A3AA /* VirtualTableBinding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VirtualTableBinding.swift; path = swift/source/core/binding/VirtualTableBinding.swift; sourceTree = \"<group>\"; };\n\t\tC69293118695D0B2F47F645F7DDC212B /* Atomic.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Atomic.swift; path = swift/source/util/Atomic.swift; sourceTree = \"<group>\"; };\n\t\tC9957C59BB8278AA543EED9EE7B3F717 /* LiteralValue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LiteralValue.swift; path = swift/source/abstract/LiteralValue.swift; sourceTree = \"<group>\"; };\n\t\tD8636DEAD76BFB246F040D3DC6B8E163 /* ColumnDef.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColumnDef.swift; path = swift/source/abstract/ColumnDef.swift; sourceTree = \"<group>\"; };\n\t\tE4100FB1572B4FFF9BC0823334E46D0A /* ConcurrentList.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConcurrentList.swift; path = swift/source/util/ConcurrentList.swift; sourceTree = \"<group>\"; };\n\t\tE61D7A41AF5364A0019326AC4C36B881 /* Insert.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Insert.swift; path = swift/source/core/interface/Insert.swift; sourceTree = \"<group>\"; };\n\t\tE8150A573BDC1D3AC81059AC513F9191 /* Interface.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Interface.swift; path = swift/source/core/interface/Interface.swift; sourceTree = \"<group>\"; };\n\t\tEAABB3B3ABC33ECEAF478AB029E1D1AA /* StatementPragma.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementPragma.swift; path = swift/source/abstract/StatementPragma.swift; sourceTree = \"<group>\"; };\n\t\tEB02F4F74A4565C0F92FB153D2E560EA /* WCDB.swift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = WCDB.swift.modulemap; sourceTree = \"<group>\"; };\n\t\tEBF8021882798D76E0B02F4A5481B4E5 /* ChainCall.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChainCall.swift; path = swift/source/core/interface/ChainCall.swift; sourceTree = \"<group>\"; };\n\t\tEF09C4684DAF5C53F651A12665E712EE /* SteadyClock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SteadyClock.swift; path = swift/source/util/SteadyClock.swift; sourceTree = \"<group>\"; };\n\t\tEFA7959A7E09FF6A1C90096FCE5917D7 /* Tracer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Tracer.swift; path = swift/source/abstract/Tracer.swift; sourceTree = \"<group>\"; };\n\t\tF2724EBAEEDA40E053BC7D2972D82C75 /* TableInterface.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TableInterface.swift; path = swift/source/core/interface/TableInterface.swift; sourceTree = \"<group>\"; };\n\t\tF5FA1277FA83A71E00D492B1C940A833 /* StatementDropTable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementDropTable.swift; path = swift/source/abstract/StatementDropTable.swift; sourceTree = \"<group>\"; };\n\t\tF6DAE773118685440F8C119A1D0F5E73 /* Config.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Config.swift; path = swift/source/core/base/Config.swift; sourceTree = \"<group>\"; };\n\t\tF6FAF1EE7E0958C5A0D4CF010C31215A /* Select.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Select.swift; path = swift/source/core/interface/Select.swift; sourceTree = \"<group>\"; };\n\t\tF73B5C1E80F9096A63A4754C85DA2F25 /* Selectable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Selectable.swift; path = swift/source/core/interface/Selectable.swift; sourceTree = \"<group>\"; };\n\t\tF76099F2136F86EB5DD070AEB13864A2 /* Core.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Core.swift; path = swift/source/core/base/Core.swift; sourceTree = \"<group>\"; };\n\t\tFB30B2758A6A3EB1B0440F07A1AAFE53 /* StatementDelete.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatementDelete.swift; path = swift/source/abstract/StatementDelete.swift; sourceTree = \"<group>\"; };\n\t\tFE14A0D584C0DFDF40A5F5FA4D9097D2 /* Statement.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Statement.swift; path = swift/source/abstract/Statement.swift; sourceTree = \"<group>\"; };\n\t\tFE229B49576F2A4BC0D0D023C1A6CC22 /* ColumnCodable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColumnCodable.swift; path = swift/source/core/codable/ColumnCodable.swift; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t6FF27EFBD6A895986DFB940400F9F7EF /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC5D519944ACDC263510487399B391475 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t1BAD409412479B7BF8677027E209C837 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t27D1A72264D8220BAED8CE47CC9BA36F /* SQLiteRepairKit */,\n\t\t\t\tA3BC5694ADA3E5F70C591744B5EFCC9C /* WCDBOptimizedSQLCipher */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t350D81E6D2082728231D701E9FC01667 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t1BAD409412479B7BF8677027E209C837 /* Dependencies */,\n\t\t\t\t4DFED91E7A67EAC77DDCFE364BE72B3C /* Frameworks */,\n\t\t\t\t82A12F9016C64B4B732571E309CA7DB2 /* Products */,\n\t\t\t\tD7978CBB9612827C3929E5734BD85C7D /* WCDB.swift */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4DFED91E7A67EAC77DDCFE364BE72B3C /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t69246AF91BAF43213DBF8AE72F9DD7F2 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t66D35A177A3E35081E3B2CDFF9178B60 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEB02F4F74A4565C0F92FB153D2E560EA /* WCDB.swift.modulemap */,\n\t\t\t\t852712D12B3C1B1496D1441A3DA7E0D1 /* WCDB.swift-dummy.m */,\n\t\t\t\t9308F505A163D227DD4D7E7BA7577B2F /* WCDB.swift-Info.plist */,\n\t\t\t\t6D794FD8E0619A9A29319C0E5C081F2D /* WCDB.swift-prefix.pch */,\n\t\t\t\t0D4CFA836F2E528CC0D78A38E5F733BE /* WCDB.swift-umbrella.h */,\n\t\t\t\t7F76470DDEFC667342A99BB50D821A2C /* WCDB.swift.debug.xcconfig */,\n\t\t\t\t927502B7DA546FD969269DE71CE79192 /* WCDB.swift.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/WCDB.swift\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t69246AF91BAF43213DBF8AE72F9DD7F2 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7F7325B2767832D11A0011B90C35553B /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t82A12F9016C64B4B732571E309CA7DB2 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t25AB8830D14FEBB1F527B331B408FD4D /* WCDB.swift */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD7978CBB9612827C3929E5734BD85C7D /* WCDB.swift */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tC69293118695D0B2F47F645F7DDC212B /* Atomic.swift */,\n\t\t\t\tEBF8021882798D76E0B02F4A5481B4E5 /* ChainCall.swift */,\n\t\t\t\t35F0B9AB8B06849F407E79FAE05BA4B1 /* CodableType.swift */,\n\t\t\t\t4F8B4A394B4DAE41E5094878EB41D450 /* CodingTableKey.swift */,\n\t\t\t\t0B5711A41F0174277AA69BFCDEFE72C2 /* Column.swift */,\n\t\t\t\tFE229B49576F2A4BC0D0D023C1A6CC22 /* ColumnCodable.swift */,\n\t\t\t\t7AED83AF31225358668C4DEAADE0EF75 /* ColumnConstraintBinding.swift */,\n\t\t\t\tD8636DEAD76BFB246F040D3DC6B8E163 /* ColumnDef.swift */,\n\t\t\t\t556DEB63AD1B01D869D33C066F258EDF /* ColumnIndex.swift */,\n\t\t\t\t40CA9C2304C25B3020B2BF7019736E2A /* ColumnResult.swift */,\n\t\t\t\tC3299F12080A3B1EFA7669D7E3FFE6D5 /* ColumnType.swift */,\n\t\t\t\t6AF3E73D5B06E0DC15057AEAA3572EB8 /* ColumnTypeDecoder.swift */,\n\t\t\t\t0BFDC83A079F013EC393EDEA5311AC1F /* CommonStatement.swift */,\n\t\t\t\tE4100FB1572B4FFF9BC0823334E46D0A /* ConcurrentList.swift */,\n\t\t\t\tF6DAE773118685440F8C119A1D0F5E73 /* Config.swift */,\n\t\t\t\t8885D350E8A42497761E274A992B9B73 /* Conflict.swift */,\n\t\t\t\t56B1D4127B880F134D921AD7117AA9A4 /* Convenience.swift */,\n\t\t\t\t289B4713A044588BE0671E1371F51F4C /* Convertible.swift */,\n\t\t\t\tF76099F2136F86EB5DD070AEB13864A2 /* Core.swift */,\n\t\t\t\t2C91CD175DA1BB88A2027B09CF48974C /* CoreStatement.swift */,\n\t\t\t\tA072A85577232D3602D67420D247B29A /* Database.swift */,\n\t\t\t\t0A5707A207867E6D67EBA1B96EA4485C /* Declare.swift */,\n\t\t\t\t3E8F2029D1DA6D5161B42F08326743A4 /* Delete.swift */,\n\t\t\t\t6C69153D11363A2714DF4C7CAB842058 /* Describable.swift */,\n\t\t\t\t0A97867C652EC26F33DC49DD65FB7EEF /* Error.swift */,\n\t\t\t\tA30DD9370A1DCF87A4E790AE0049A6D2 /* Expression.swift */,\n\t\t\t\t97C5BA46911778FF62662D3A5426C702 /* File.swift */,\n\t\t\t\t6D3E48F9A5461DD463EE0C3EEF332E81 /* ForeignKey.swift */,\n\t\t\t\t818E7628E7138CED02695F2EDE6C209E /* FundamentalValue.swift */,\n\t\t\t\t850CFA069C42499D5C735AE5C455A6C2 /* Handle.swift */,\n\t\t\t\t35632D7059C7C3D63BFDAE3C2950F99B /* HandlePool.swift */,\n\t\t\t\t11F25A282B00D6F61100BA139521AD44 /* HandleStatement.swift */,\n\t\t\t\t3F37419A6C8B2273C4C381E263B15D9A /* IndexBinding.swift */,\n\t\t\t\tE61D7A41AF5364A0019326AC4C36B881 /* Insert.swift */,\n\t\t\t\tE8150A573BDC1D3AC81059AC513F9191 /* Interface.swift */,\n\t\t\t\t2FCF72CEBC9D21F967DB7060D7659E0E /* JoinClause.swift */,\n\t\t\t\tC9957C59BB8278AA543EED9EE7B3F717 /* LiteralValue.swift */,\n\t\t\t\tB686C32813C936FDE11A3DB35EE1223C /* Lock.swift */,\n\t\t\t\t2B1549E3CE4C7AF651944E5C6CB02D98 /* Master.swift */,\n\t\t\t\t25CDB6F01644F8DCC4AACD6BA8B3D033 /* ModuleArgument.swift */,\n\t\t\t\t1515A54E06ADA4740E6FE41C28AF8E0A /* MultiSelect.swift */,\n\t\t\t\t1F0A19A0B8631B858C9A51608BD63E32 /* Operable.swift */,\n\t\t\t\t8237AE1F54F9AD9FF023E544033D4B5D /* Optional.swift */,\n\t\t\t\t31FF5DAF62E9CF36950C3CA905AFEC47 /* Order.swift */,\n\t\t\t\t8D22AC97B70A4F6FB69CC0A286A0C8AF /* OrderTerm.swift */,\n\t\t\t\t4B6C26E33616678A12E1A7C495FBED9A /* Pragma.swift */,\n\t\t\t\t2022CF10542329DC8936CACA73E04998 /* Property.swift */,\n\t\t\t\t41556C5905EFD8DE76843D36C798E080 /* Recyclable.swift */,\n\t\t\t\tBFF55B1E1B831714705F639D14C78EEB /* RecyclableCore.swift */,\n\t\t\t\t6069FE906D31FAAA5A5A51C9268B322E /* Redirectable.swift */,\n\t\t\t\t28E20AA21F95F75B43DE81757EADCB33 /* RowSelect.swift */,\n\t\t\t\t250C4BEF407076E8FFF7BE2AA61C4E5A /* RWLock.swift */,\n\t\t\t\tF6FAF1EE7E0958C5A0D4CF010C31215A /* Select.swift */,\n\t\t\t\tF73B5C1E80F9096A63A4754C85DA2F25 /* Selectable.swift */,\n\t\t\t\tBF6ED89BF4002C56CBA2CE19D641F86C /* SQLite-Bridging.c */,\n\t\t\t\t4BFD9ABD3192FB6F0CFC111E4BEE8691 /* SQLite-Bridging.h */,\n\t\t\t\t08E08A31B9944C20AF702BFF31487B26 /* SQLite-Bridging.swift */,\n\t\t\t\tFE14A0D584C0DFDF40A5F5FA4D9097D2 /* Statement.swift */,\n\t\t\t\t28F18E2A59564F802783ED4470309818 /* StatementAlterTable.swift */,\n\t\t\t\t876E5371414417DDF4BEA602518CFA3A /* StatementAttach.swift */,\n\t\t\t\tC23A8F76EA2BE173F73C4C243450DB7C /* StatementCreateIndex.swift */,\n\t\t\t\t5F3A6B036B3DC3E9662CB7451A13D9AB /* StatementCreateTable.swift */,\n\t\t\t\t9BA94E73A6AA7AFADBF222AD631C2EA3 /* StatementCreateVirtualTable.swift */,\n\t\t\t\tFB30B2758A6A3EB1B0440F07A1AAFE53 /* StatementDelete.swift */,\n\t\t\t\tB9858E8604AF48747AACB12A457C85A9 /* StatementDetach.swift */,\n\t\t\t\t7B03A3018E6B6D4746F18BF0CCC1CCF2 /* StatementDropIndex.swift */,\n\t\t\t\tF5FA1277FA83A71E00D492B1C940A833 /* StatementDropTable.swift */,\n\t\t\t\tB2136B4CB345E0F5522D6E38BE472E8E /* StatementExplain.swift */,\n\t\t\t\t0ACB56B5CEC68AD9F5E791E9BDCE8DBA /* StatementInsert.swift */,\n\t\t\t\tEAABB3B3ABC33ECEAF478AB029E1D1AA /* StatementPragma.swift */,\n\t\t\t\t72FDDEB9BF881C859C978B9701954B7B /* StatementReindex.swift */,\n\t\t\t\t74F57086D5E003E32ABBFA302D1DD71A /* StatementRelease.swift */,\n\t\t\t\t62D798F17EF5348E08DF758B97F35FC1 /* StatementRollback.swift */,\n\t\t\t\t8B2677580CE29ECC98DFE7AE0128AF9D /* StatementSavepoint.swift */,\n\t\t\t\t9BD960FB3ADAA50C308AABB9D8CDECD3 /* StatementSelect.swift */,\n\t\t\t\t98E79C7E6D850BF720AA67DB4A260627 /* StatementTransaction.swift */,\n\t\t\t\t8BEA07CFC06457A8A467D0342B82B515 /* StatementUpdate.swift */,\n\t\t\t\t4BA0FEBB911E31FCB4314040A892CB75 /* StatementVacuum.swift */,\n\t\t\t\tEF09C4684DAF5C53F651A12665E712EE /* SteadyClock.swift */,\n\t\t\t\tB0973A02C166F02D2B2BB547B0783968 /* Subquery.swift */,\n\t\t\t\tADB932391AEBE2A3A9E779CDC6BC8105 /* Table.swift */,\n\t\t\t\t0C0389C7B7CFECA4C3920EF57E7776FA /* TableBinding.swift */,\n\t\t\t\t2D14197B2368AB82106A039E2A064446 /* TableCodable.swift */,\n\t\t\t\t091CDD59C8ED5A90B7B4852772AD98B0 /* TableConstraint.swift */,\n\t\t\t\t6BB0C43C9618877FC8828D1CAD186D17 /* TableConstraintBinding.swift */,\n\t\t\t\t9C2ED18B51A4C7DD87CCE7295981261F /* TableDecoder.swift */,\n\t\t\t\t65594E69A47D5B4D128588D57936C5E5 /* TableEncoder.swift */,\n\t\t\t\tF2724EBAEEDA40E053BC7D2972D82C75 /* TableInterface.swift */,\n\t\t\t\t87EF7DE89F073C5CF0E2E2EF1EDF8403 /* Tagged.swift */,\n\t\t\t\tC187450BC6F810CB23539C1FA17CB4C5 /* ThreadLocal.swift */,\n\t\t\t\t61F512DEA5FEBAED06568F9441A7A750 /* TimedQueue.swift */,\n\t\t\t\t780D868999536DD6588F13D551D87EE5 /* Tokenize.swift */,\n\t\t\t\tEFA7959A7E09FF6A1C90096FCE5917D7 /* Tracer.swift */,\n\t\t\t\tAA215A4BDE4A8A073E0A73804A039E6D /* Transaction.swift */,\n\t\t\t\tB8E3F113A1A6BBDC6BDA3640C627C7CE /* Update.swift */,\n\t\t\t\tC543EC9361C34A1EE9316FE21535A3AA /* VirtualTableBinding.swift */,\n\t\t\t\t4CE2457E3A785CCC1F1BBAF4D3BFC797 /* WCDB-Bridging.h */,\n\t\t\t\t8B616A9C7C145026160A1AFE77E1A3EC /* WCDBTokenize.swift */,\n\t\t\t\t66D35A177A3E35081E3B2CDFF9178B60 /* Support Files */,\n\t\t\t);\n\t\t\tname = WCDB.swift;\n\t\t\tpath = WCDB.swift;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t3E778AAF43692530078774B231566A67 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t60E18F9137E555849F436FB0E538EAAC /* SQLite-Bridging.h in Headers */,\n\t\t\t\t0A735124CB220FF49D59A2839E279005 /* WCDB-Bridging.h in Headers */,\n\t\t\t\t58AFD8D688AF2FAB15C5BC32E1D931B2 /* WCDB.swift-umbrella.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t4EAAAD4A9736C05D0B4707614E368B84 /* WCDB.swift */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 9B4A5017CADBE63A13DE5E2EE1227B13 /* Build configuration list for PBXNativeTarget \"WCDB.swift\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t3E778AAF43692530078774B231566A67 /* Headers */,\n\t\t\t\t570AFC623D0FC42F102168AF4E718AA2 /* Sources */,\n\t\t\t\t6FF27EFBD6A895986DFB940400F9F7EF /* Frameworks */,\n\t\t\t\tC30CB7672BFD79662B0E8ECAC97D4795 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tF884DD8FAC8AF6846C56A11D92EFBCAD /* PBXTargetDependency */,\n\t\t\t\t85159E469D47CE874338B22DAF9B1816 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = WCDB.swift;\n\t\t\tproductName = WCDBSwift;\n\t\t\tproductReference = 25AB8830D14FEBB1F527B331B408FD4D /* WCDB.swift */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tF986FBAAA2DD46A809EA6A4C46AFACEA /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = F2635CC716BC28B2A821061573912CA4 /* Build configuration list for PBXProject \"WCDB.swift\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 350D81E6D2082728231D701E9FC01667;\n\t\t\tproductRefGroup = 82A12F9016C64B4B732571E309CA7DB2 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = A3BC5694ADA3E5F70C591744B5EFCC9C /* WCDBOptimizedSQLCipher */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 27D1A72264D8220BAED8CE47CC9BA36F /* SQLiteRepairKit */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t4EAAAD4A9736C05D0B4707614E368B84 /* WCDB.swift */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tC30CB7672BFD79662B0E8ECAC97D4795 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t570AFC623D0FC42F102168AF4E718AA2 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t4C04341C03D6210505D3AAF473E60C2C /* Atomic.swift in Sources */,\n\t\t\t\tB975DD5356F7614B19AEBA695F49B60F /* ChainCall.swift in Sources */,\n\t\t\t\t44A50DDDF23FF7261487BFBE84FBCC6F /* CodableType.swift in Sources */,\n\t\t\t\t7B06E90A86A20EC975331C2185E7163C /* CodingTableKey.swift in Sources */,\n\t\t\t\t36C85945DDAA28C3540DD5203E864757 /* Column.swift in Sources */,\n\t\t\t\tFAEC088031C3391ED364D1AC2D5BE42C /* ColumnCodable.swift in Sources */,\n\t\t\t\t7BFBAC1D28016BB288D7814B65E53FBF /* ColumnConstraintBinding.swift in Sources */,\n\t\t\t\t8502E94D8CA6CE7A531262889EF319BF /* ColumnDef.swift in Sources */,\n\t\t\t\t4E35F048A60D684A1AF3A39C65E8627D /* ColumnIndex.swift in Sources */,\n\t\t\t\t5D31B58AA8971222E6E3F4ADA955A3C2 /* ColumnResult.swift in Sources */,\n\t\t\t\tFFF528C305E19A5ECE6C9A1BFFED7C09 /* ColumnType.swift in Sources */,\n\t\t\t\t62123155EAC9628D827282EE79E3ADA8 /* ColumnTypeDecoder.swift in Sources */,\n\t\t\t\t164FC431C2C050C58EE8D3FE13AD3B7C /* CommonStatement.swift in Sources */,\n\t\t\t\t0A44240895C20253A1BEDB25406F0D24 /* ConcurrentList.swift in Sources */,\n\t\t\t\t8A53B7A24C3E4361FB14031B0F8A1458 /* Config.swift in Sources */,\n\t\t\t\t27285EA438ACA4C7C3FA010768CC874A /* Conflict.swift in Sources */,\n\t\t\t\t64F8386A2A23D68CFDA0779FA1187AFB /* Convenience.swift in Sources */,\n\t\t\t\tEB8C24F2A6056F99304A7F19E4F9A6D3 /* Convertible.swift in Sources */,\n\t\t\t\tD4373ABC40D7F0C67A742963EE8FF6EB /* Core.swift in Sources */,\n\t\t\t\tA0A39F09D5F414426870C6D45919F9CE /* CoreStatement.swift in Sources */,\n\t\t\t\t420C83E705B190C9651D39CC25183A98 /* Database.swift in Sources */,\n\t\t\t\tFDE71B5195873F497F5A43A841A88485 /* Declare.swift in Sources */,\n\t\t\t\t1A5AE75CB325FDE0AC2ED71CF101DCD3 /* Delete.swift in Sources */,\n\t\t\t\t636D6CB65315F5F70587FC6CA12A1859 /* Describable.swift in Sources */,\n\t\t\t\t597FA03029BCE471C1A35587575D5739 /* Error.swift in Sources */,\n\t\t\t\t4EE9AD3E9910A15E43E19B4953EB086E /* Expression.swift in Sources */,\n\t\t\t\t2FB28D118E2AA9CCD57C014FABFDC43B /* File.swift in Sources */,\n\t\t\t\t1A9F71623EE8C0788EACB8EC3BCC0B51 /* ForeignKey.swift in Sources */,\n\t\t\t\tB75738C42FF3E2B1ADD4C093DEA4FA36 /* FundamentalValue.swift in Sources */,\n\t\t\t\t8B674C42B8B88408B148FB437BA872A3 /* Handle.swift in Sources */,\n\t\t\t\tCD6E19C7279B89860B5B9C5087DB94A8 /* HandlePool.swift in Sources */,\n\t\t\t\t27542F22338E7E2D0A2F52B7F98267BF /* HandleStatement.swift in Sources */,\n\t\t\t\tD9A7050E1F3203213F4E34AEAAAE44E4 /* IndexBinding.swift in Sources */,\n\t\t\t\t8C8E09AD9884DC975A09D7ADFF1EDFC5 /* Insert.swift in Sources */,\n\t\t\t\t51D5C837D9DE34211B0C02FC784A16EC /* Interface.swift in Sources */,\n\t\t\t\t9A1BEFAE555EFECAD64F6E650FB39065 /* JoinClause.swift in Sources */,\n\t\t\t\t09B5305126B6501FA25712E8B70A9B21 /* LiteralValue.swift in Sources */,\n\t\t\t\t03E2C5F1955ECD1EF15D82E5EC9B8FD9 /* Lock.swift in Sources */,\n\t\t\t\tA18E768F7DCBA92E7300EBA7786BE7B5 /* Master.swift in Sources */,\n\t\t\t\tFCA55725F335187FD21571F95AD07D24 /* ModuleArgument.swift in Sources */,\n\t\t\t\tE8147E0DEDC9530280573CCD81E3683A /* MultiSelect.swift in Sources */,\n\t\t\t\t590F28AADEDE7D779CE69EFF2FE4B5FA /* Operable.swift in Sources */,\n\t\t\t\t96F2516496AB35A6D00D6469FE37A7E8 /* Optional.swift in Sources */,\n\t\t\t\t66C797FDA5E6AEF8F5D9166A0D52DDAD /* Order.swift in Sources */,\n\t\t\t\t61982D488EA71F7E4D918CD9FA8DDA6C /* OrderTerm.swift in Sources */,\n\t\t\t\t5C9B13F548604463AA2A1CBB33B81AF6 /* Pragma.swift in Sources */,\n\t\t\t\t25F87752AFB1F3692DC3352F345F061A /* Property.swift in Sources */,\n\t\t\t\t5253A5A13AD9217F4A6D962982016F24 /* Recyclable.swift in Sources */,\n\t\t\t\t7BFEC7A885716EF738132187F3D6E8B4 /* RecyclableCore.swift in Sources */,\n\t\t\t\t541ABFAD60FE4CCF0E04C294742060A0 /* Redirectable.swift in Sources */,\n\t\t\t\tB7DAADF119C813387EE275612F979CC9 /* RowSelect.swift in Sources */,\n\t\t\t\t8DD2A2F22AC74D04A0F3310C0B4477CA /* RWLock.swift in Sources */,\n\t\t\t\tB992BD920F062A98DB76CAA57CC65016 /* Select.swift in Sources */,\n\t\t\t\tAE37BAF478BDC3ECE38CA8E7CBEBBC80 /* Selectable.swift in Sources */,\n\t\t\t\t41057DCF05FEA8754E5BBEC9D03D2C9D /* SQLite-Bridging.c in Sources */,\n\t\t\t\t013C49983F0EECA1D8A34DA533D54FDA /* SQLite-Bridging.swift in Sources */,\n\t\t\t\tE77E7B2339FF313F9E403D38E13AC970 /* Statement.swift in Sources */,\n\t\t\t\t411540B926330F2B4C0CD1A0B73C7970 /* StatementAlterTable.swift in Sources */,\n\t\t\t\tBB45D150EA5D8F723BE7B917E33CDA40 /* StatementAttach.swift in Sources */,\n\t\t\t\t84863242E71D9D5EBD62788E0E2463F1 /* StatementCreateIndex.swift in Sources */,\n\t\t\t\t4226345D7B0904E0CDCBCBF8BDBAA85B /* StatementCreateTable.swift in Sources */,\n\t\t\t\t108CEB813AC77900FA27318731EAB7E7 /* StatementCreateVirtualTable.swift in Sources */,\n\t\t\t\t057F01C39FB58FF22E03AFFBB607460B /* StatementDelete.swift in Sources */,\n\t\t\t\t1158B3A7F7B13FE1B18B20E798F9C037 /* StatementDetach.swift in Sources */,\n\t\t\t\tEC3A07095422AFD616641F8B09AB759D /* StatementDropIndex.swift in Sources */,\n\t\t\t\t8ADD29697D81A1508C5A436306F5404A /* StatementDropTable.swift in Sources */,\n\t\t\t\t935B19477DBCFD792B7DA59BAB5E5987 /* StatementExplain.swift in Sources */,\n\t\t\t\tB641AC664B036BDFA8B4D32FC40C3038 /* StatementInsert.swift in Sources */,\n\t\t\t\t2D733EC011ADC52E59FC1B434469A9C4 /* StatementPragma.swift in Sources */,\n\t\t\t\t3081896F89A0CEAF2A6DFA5D27A71D30 /* StatementReindex.swift in Sources */,\n\t\t\t\tC0E494FF213635338AEC64E3A2F2902B /* StatementRelease.swift in Sources */,\n\t\t\t\t9894E474B1A3C23EDBF953CCF7C09721 /* StatementRollback.swift in Sources */,\n\t\t\t\tEDF37404F21B1CA75000D2FD87315797 /* StatementSavepoint.swift in Sources */,\n\t\t\t\tC569E19DB5C136C106A9980145994EC6 /* StatementSelect.swift in Sources */,\n\t\t\t\t4D8872457636DC7DE18B1EDD8FF1F68D /* StatementTransaction.swift in Sources */,\n\t\t\t\t0CE6D870E82E92DAC1D268BD09384182 /* StatementUpdate.swift in Sources */,\n\t\t\t\tCABCF14E49BA41994954081BF8ABE15C /* StatementVacuum.swift in Sources */,\n\t\t\t\t027FBB30386906CB7D666487E2FF4A66 /* SteadyClock.swift in Sources */,\n\t\t\t\tD631F583C2EA5472A16E5F7AB962CF91 /* Subquery.swift in Sources */,\n\t\t\t\t4E45EB2AA7EE071B3AF29273757A5A20 /* Table.swift in Sources */,\n\t\t\t\t3507771F850452E52FD00F0240FB87CC /* TableBinding.swift in Sources */,\n\t\t\t\tB1F017764DE4DE2493F9EFBB133B1F61 /* TableCodable.swift in Sources */,\n\t\t\t\tC2E0636249C902EAA944FD025C99F6D6 /* TableConstraint.swift in Sources */,\n\t\t\t\t75948F0B5BECFD01391CE7784BEAADD7 /* TableConstraintBinding.swift in Sources */,\n\t\t\t\tC0B88E4E8E5C37FDCD5FD19FF1D310E2 /* TableDecoder.swift in Sources */,\n\t\t\t\tDA582DC413045D8D18A139F7A390F858 /* TableEncoder.swift in Sources */,\n\t\t\t\t460B13220E63BB29C50B9A81C920E55C /* TableInterface.swift in Sources */,\n\t\t\t\t1F99EF46B98800CDB68AF68EA1E262EB /* Tagged.swift in Sources */,\n\t\t\t\t73EE699088AAFF42A92738A03ECE1800 /* ThreadLocal.swift in Sources */,\n\t\t\t\t4BC70847EDB20C944B7C2A351C4C835B /* TimedQueue.swift in Sources */,\n\t\t\t\tEBE779F57B5DB9845B4231091950A55B /* Tokenize.swift in Sources */,\n\t\t\t\t45E6F826C2A1EB894323A3AB835DDF74 /* Tracer.swift in Sources */,\n\t\t\t\t2742E413003BFBFFE684E5C8AFF9A033 /* Transaction.swift in Sources */,\n\t\t\t\t9A326BB36F84A0970CDD0B04EED7FD90 /* Update.swift in Sources */,\n\t\t\t\t7D0CAF33CD81F1786DBD53A1780F046F /* VirtualTableBinding.swift in Sources */,\n\t\t\t\t4170027AF8D5B066446C5E63991E8CE4 /* WCDB.swift-dummy.m in Sources */,\n\t\t\t\t35AE817FAAD12574525181BD78289CD4 /* WCDBTokenize.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t85159E469D47CE874338B22DAF9B1816 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = WCDBOptimizedSQLCipher;\n\t\t\ttargetProxy = B53AE04AAEE7B23EFE228ED0AFD8249C /* PBXContainerItemProxy */;\n\t\t};\n\t\tF884DD8FAC8AF6846C56A11D92EFBCAD /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SQLiteRepairKit;\n\t\t\ttargetProxy = F27637A61560590496E5791936F3AD3F /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t2F40409524C5D9AD1790324AE7802613 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 927502B7DA546FD969269DE71CE79192 /* WCDB.swift.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/WCDB.swift/WCDB.swift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/WCDB.swift/WCDB.swift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/WCDB.swift/WCDB.swift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = WCDBSwift;\n\t\t\t\tPRODUCT_NAME = WCDBSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t489C4045EB8D7AAB143886206FAC11BF /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7F76470DDEFC667342A99BB50D821A2C /* WCDB.swift.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/WCDB.swift/WCDB.swift-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/WCDB.swift/WCDB.swift-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/WCDB.swift/WCDB.swift.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = WCDBSwift;\n\t\t\t\tPRODUCT_NAME = WCDBSwift;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 4.2;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tD093CE025FB8AA23185865C03B74A811 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tF3B432464B71A29BDA3865FA10236A74 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t9B4A5017CADBE63A13DE5E2EE1227B13 /* Build configuration list for PBXNativeTarget \"WCDB.swift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t489C4045EB8D7AAB143886206FAC11BF /* Debug */,\n\t\t\t\t2F40409524C5D9AD1790324AE7802613 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tF2635CC716BC28B2A821061573912CA4 /* Build configuration list for PBXProject \"WCDB.swift\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD093CE025FB8AA23185865C03B74A811 /* Debug */,\n\t\t\t\tF3B432464B71A29BDA3865FA10236A74 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = F986FBAAA2DD46A809EA6A4C46AFACEA /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/LICENSE",
    "content": "Copyright (c) 2008, ZETETIC LLC\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the name of the ZETETIC LLC nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/README.md",
    "content": "## SQLCipher\n\nSQLCipher extends the [SQLite](https://www.sqlite.org) database library to add security enhancements that make it more suitable for encrypted local data storage such as on-the-fly encryption, tamper evidence, and key derivation. Based on SQLite, SQLCipher closely tracks SQLite and periodically integrates stable SQLite release features.\n\nSQLCipher is maintained by Zetetic, LLC, the official site can be found [here](https://www.zetetic.net/sqlcipher/).\n\n## Features\n\n- Fast performance with as little as 5-15% overhead for encryption on many operations\n- 100% of data in the database file is encrypted\n- Good security practices (CBC mode, HMAC, key derivation)\n- Zero-configuration and application level cryptography\n- Algorithms provided by the peer reviewed OpenSSL crypto library.\n- Configurable crypto providers\n\n## Contributions\n\nWe welcome contributions, to contribute to SQLCipher, a [contributor agreement](https://www.zetetic.net/contributions/) needs to be submitted.  All submissions should be based on the `prerelease` branch.\n\n## Compiling\n\nBuilding SQLCipher is almost the same as compiling a regular version of \nSQLite with two small exceptions: \n\n 1. You *must* define `SQLITE_HAS_CODEC` and `SQLITE_TEMP_STORE=2` when building sqlcipher. \n 2. If compiling against the default OpenSSL crypto provider, you will need to link libcrypto\n \nExample Static linking (replace /opt/local/lib with the path to libcrypto.a). Note in this \nexample, `--enable-tempstore=yes` is setting `SQLITE_TEMP_STORE=2` for the build.\n\n\t$ ./configure --enable-tempstore=yes CFLAGS=\"-DSQLITE_HAS_CODEC\" \\\n\t\tLDFLAGS=\"/opt/local/lib/libcrypto.a\"\n\t$ make\n\nExample Dynamic linking\n\n\t$ ./configure --enable-tempstore=yes CFLAGS=\"-DSQLITE_HAS_CODEC\" \\\n\t\tLDFLAGS=\"-lcrypto\"\n\t$ make\n\n## Encrypting a database\n\nTo specify an encryption passphrase for the database via the SQL interface you \nuse a pragma. The passphrase you enter is passed through PBKDF2 key derivation to\nobtain the encryption key for the database \n\n\tPRAGMA key = 'passphrase';\n\nAlternately, you can specify an exact byte sequence using a blob literal. If you\nuse this method it is your responsibility to ensure that the data you provide a\n64 character hex string, which will be converted directly to 32 bytes (256 bits) of \nkey data without key derivation.\n\n\tPRAGMA key = \"x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'\";\n\nTo encrypt a database programatically you can use the `sqlite3_key` function. \nThe data provided in `pKey` is converted to an encryption key according to the \nsame rules as `PRAGMA key`. \n\n\tint sqlite3_key(sqlite3 *db, const void *pKey, int nKey);\n\n`PRAGMA key` or `sqlite3_key` should be called as the first operation when a database is open.\n\n## Changing a database key\n\nTo change the encryption passphrase for an existing database you may use the rekey pragma\nafter you've supplied the correct database password;\n\n\tPRAGMA key = 'passphrase'; -- start with the existing database passphrase\n\tPRAGMA rekey = 'new-passphrase'; -- rekey will reencrypt with the new passphrase\n\nThe hex rekey pragma may be used to rekey to a specific binary value\n\n\tPRAGMA rekey = \"x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'\";\n\nThis can be accomplished programtically by using sqlite3_rekey;\n  \n\tsqlite3_rekey(sqlite3 *db, const void *pKey, int nKey)\n\n## Support\n\nThe primary avenue for support and discussions is the SQLCipher discuss site:\n\nhttps://discuss.zetetic.net/c/sqlcipher\n\nIssues or support questions on using SQLCipher should be entered into the \nGitHub Issue tracker:\n\nhttps://github.com/sqlcipher/sqlcipher/issues\n\nPlease DO NOT post issues, support questions, or other problems to blog \nposts about SQLCipher as we do not monitor them frequently.\n\nIf you are using SQLCipher in your own software please let us know at \nsupport@zetetic.net!\n\n## License\n\nCopyright (c) 2016, ZETETIC LLC\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the name of the ZETETIC LLC nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3.c",
    "content": "/*\n** 2006 Oct 10\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This is an SQLite module implementing full-text search.\n*/\n\n/*\n** The code in this file is only compiled if:\n**\n**     * The FTS3 module is being built as an extension\n**       (in which case SQLITE_CORE is not defined), or\n**\n**     * The FTS3 module is being built into the core of\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\n*/\n\n/* The full-text index is stored in a series of b+tree (-like)\n** structures called segments which map terms to doclists.  The\n** structures are like b+trees in layout, but are constructed from the\n** bottom up in optimal fashion and are not updatable.  Since trees\n** are built from the bottom up, things will be described from the\n** bottom up.\n**\n**\n**** Varints ****\n** The basic unit of encoding is a variable-length integer called a\n** varint.  We encode variable-length integers in little-endian order\n** using seven bits * per byte as follows:\n**\n** KEY:\n**         A = 0xxxxxxx    7 bits of data and one flag bit\n**         B = 1xxxxxxx    7 bits of data and one flag bit\n**\n**  7 bits - A\n** 14 bits - BA\n** 21 bits - BBA\n** and so on.\n**\n** This is similar in concept to how sqlite encodes \"varints\" but\n** the encoding is not the same.  SQLite varints are big-endian\n** are are limited to 9 bytes in length whereas FTS3 varints are\n** little-endian and can be up to 10 bytes in length (in theory).\n**\n** Example encodings:\n**\n**     1:    0x01\n**   127:    0x7f\n**   128:    0x81 0x00\n**\n**\n**** Document lists ****\n** A doclist (document list) holds a docid-sorted list of hits for a\n** given term.  Doclists hold docids and associated token positions.\n** A docid is the unique integer identifier for a single document.\n** A position is the index of a word within the document.  The first \n** word of the document has a position of 0.\n**\n** FTS3 used to optionally store character offsets using a compile-time\n** option.  But that functionality is no longer supported.\n**\n** A doclist is stored like this:\n**\n** array {\n**   varint docid;          (delta from previous doclist)\n**   array {                (position list for column 0)\n**     varint position;     (2 more than the delta from previous position)\n**   }\n**   array {\n**     varint POS_COLUMN;   (marks start of position list for new column)\n**     varint column;       (index of new column)\n**     array {\n**       varint position;   (2 more than the delta from previous position)\n**     }\n**   }\n**   varint POS_END;        (marks end of positions for this document.\n** }\n**\n** Here, array { X } means zero or more occurrences of X, adjacent in\n** memory.  A \"position\" is an index of a token in the token stream\n** generated by the tokenizer. Note that POS_END and POS_COLUMN occur \n** in the same logical place as the position element, and act as sentinals\n** ending a position list array.  POS_END is 0.  POS_COLUMN is 1.\n** The positions numbers are not stored literally but rather as two more\n** than the difference from the prior position, or the just the position plus\n** 2 for the first position.  Example:\n**\n**   label:       A B C D E  F  G H   I  J K\n**   value:     123 5 9 1 1 14 35 0 234 72 0\n**\n** The 123 value is the first docid.  For column zero in this document\n** there are two matches at positions 3 and 10 (5-2 and 9-2+3).  The 1\n** at D signals the start of a new column; the 1 at E indicates that the\n** new column is column number 1.  There are two positions at 12 and 45\n** (14-2 and 35-2+12).  The 0 at H indicate the end-of-document.  The\n** 234 at I is the delta to next docid (357).  It has one position 70\n** (72-2) and then terminates with the 0 at K.\n**\n** A \"position-list\" is the list of positions for multiple columns for\n** a single docid.  A \"column-list\" is the set of positions for a single\n** column.  Hence, a position-list consists of one or more column-lists,\n** a document record consists of a docid followed by a position-list and\n** a doclist consists of one or more document records.\n**\n** A bare doclist omits the position information, becoming an \n** array of varint-encoded docids.\n**\n**** Segment leaf nodes ****\n** Segment leaf nodes store terms and doclists, ordered by term.  Leaf\n** nodes are written using LeafWriter, and read using LeafReader (to\n** iterate through a single leaf node's data) and LeavesReader (to\n** iterate through a segment's entire leaf layer).  Leaf nodes have\n** the format:\n**\n** varint iHeight;             (height from leaf level, always 0)\n** varint nTerm;               (length of first term)\n** char pTerm[nTerm];          (content of first term)\n** varint nDoclist;            (length of term's associated doclist)\n** char pDoclist[nDoclist];    (content of doclist)\n** array {\n**                             (further terms are delta-encoded)\n**   varint nPrefix;           (length of prefix shared with previous term)\n**   varint nSuffix;           (length of unshared suffix)\n**   char pTermSuffix[nSuffix];(unshared suffix of next term)\n**   varint nDoclist;          (length of term's associated doclist)\n**   char pDoclist[nDoclist];  (content of doclist)\n** }\n**\n** Here, array { X } means zero or more occurrences of X, adjacent in\n** memory.\n**\n** Leaf nodes are broken into blocks which are stored contiguously in\n** the %_segments table in sorted order.  This means that when the end\n** of a node is reached, the next term is in the node with the next\n** greater node id.\n**\n** New data is spilled to a new leaf node when the current node\n** exceeds LEAF_MAX bytes (default 2048).  New data which itself is\n** larger than STANDALONE_MIN (default 1024) is placed in a standalone\n** node (a leaf node with a single term and doclist).  The goal of\n** these settings is to pack together groups of small doclists while\n** making it efficient to directly access large doclists.  The\n** assumption is that large doclists represent terms which are more\n** likely to be query targets.\n**\n** TODO(shess) It may be useful for blocking decisions to be more\n** dynamic.  For instance, it may make more sense to have a 2.5k leaf\n** node rather than splitting into 2k and .5k nodes.  My intuition is\n** that this might extend through 2x or 4x the pagesize.\n**\n**\n**** Segment interior nodes ****\n** Segment interior nodes store blockids for subtree nodes and terms\n** to describe what data is stored by the each subtree.  Interior\n** nodes are written using InteriorWriter, and read using\n** InteriorReader.  InteriorWriters are created as needed when\n** SegmentWriter creates new leaf nodes, or when an interior node\n** itself grows too big and must be split.  The format of interior\n** nodes:\n**\n** varint iHeight;           (height from leaf level, always >0)\n** varint iBlockid;          (block id of node's leftmost subtree)\n** optional {\n**   varint nTerm;           (length of first term)\n**   char pTerm[nTerm];      (content of first term)\n**   array {\n**                                (further terms are delta-encoded)\n**     varint nPrefix;            (length of shared prefix with previous term)\n**     varint nSuffix;            (length of unshared suffix)\n**     char pTermSuffix[nSuffix]; (unshared suffix of next term)\n**   }\n** }\n**\n** Here, optional { X } means an optional element, while array { X }\n** means zero or more occurrences of X, adjacent in memory.\n**\n** An interior node encodes n terms separating n+1 subtrees.  The\n** subtree blocks are contiguous, so only the first subtree's blockid\n** is encoded.  The subtree at iBlockid will contain all terms less\n** than the first term encoded (or all terms if no term is encoded).\n** Otherwise, for terms greater than or equal to pTerm[i] but less\n** than pTerm[i+1], the subtree for that term will be rooted at\n** iBlockid+i.  Interior nodes only store enough term data to\n** distinguish adjacent children (if the rightmost term of the left\n** child is \"something\", and the leftmost term of the right child is\n** \"wicked\", only \"w\" is stored).\n**\n** New data is spilled to a new interior node at the same height when\n** the current node exceeds INTERIOR_MAX bytes (default 2048).\n** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing\n** interior nodes and making the tree too skinny.  The interior nodes\n** at a given height are naturally tracked by interior nodes at\n** height+1, and so on.\n**\n**\n**** Segment directory ****\n** The segment directory in table %_segdir stores meta-information for\n** merging and deleting segments, and also the root node of the\n** segment's tree.\n**\n** The root node is the top node of the segment's tree after encoding\n** the entire segment, restricted to ROOT_MAX bytes (default 1024).\n** This could be either a leaf node or an interior node.  If the top\n** node requires more than ROOT_MAX bytes, it is flushed to %_segments\n** and a new root interior node is generated (which should always fit\n** within ROOT_MAX because it only needs space for 2 varints, the\n** height and the blockid of the previous root).\n**\n** The meta-information in the segment directory is:\n**   level               - segment level (see below)\n**   idx                 - index within level\n**                       - (level,idx uniquely identify a segment)\n**   start_block         - first leaf node\n**   leaves_end_block    - last leaf node\n**   end_block           - last block (including interior nodes)\n**   root                - contents of root node\n**\n** If the root node is a leaf node, then start_block,\n** leaves_end_block, and end_block are all 0.\n**\n**\n**** Segment merging ****\n** To amortize update costs, segments are grouped into levels and\n** merged in batches.  Each increase in level represents exponentially\n** more documents.\n**\n** New documents (actually, document updates) are tokenized and\n** written individually (using LeafWriter) to a level 0 segment, with\n** incrementing idx.  When idx reaches MERGE_COUNT (default 16), all\n** level 0 segments are merged into a single level 1 segment.  Level 1\n** is populated like level 0, and eventually MERGE_COUNT level 1\n** segments are merged to a single level 2 segment (representing\n** MERGE_COUNT^2 updates), and so on.\n**\n** A segment merge traverses all segments at a given level in\n** parallel, performing a straightforward sorted merge.  Since segment\n** leaf nodes are written in to the %_segments table in order, this\n** merge traverses the underlying sqlite disk structures efficiently.\n** After the merge, all segment blocks from the merged level are\n** deleted.\n**\n** MERGE_COUNT controls how often we merge segments.  16 seems to be\n** somewhat of a sweet spot for insertion performance.  32 and 64 show\n** very similar performance numbers to 16 on insertion, though they're\n** a tiny bit slower (perhaps due to more overhead in merge-time\n** sorting).  8 is about 20% slower than 16, 4 about 50% slower than\n** 16, 2 about 66% slower than 16.\n**\n** At query time, high MERGE_COUNT increases the number of segments\n** which need to be scanned and merged.  For instance, with 100k docs\n** inserted:\n**\n**    MERGE_COUNT   segments\n**       16           25\n**        8           12\n**        4           10\n**        2            6\n**\n** This appears to have only a moderate impact on queries for very\n** frequent terms (which are somewhat dominated by segment merge\n** costs), and infrequent and non-existent terms still seem to be fast\n** even with many segments.\n**\n** TODO(shess) That said, it would be nice to have a better query-side\n** argument for MERGE_COUNT of 16.  Also, it is possible/likely that\n** optimizations to things like doclist merging will swing the sweet\n** spot around.\n**\n**\n**\n**** Handling of deletions and updates ****\n** Since we're using a segmented structure, with no docid-oriented\n** index into the term index, we clearly cannot simply update the term\n** index when a document is deleted or updated.  For deletions, we\n** write an empty doclist (varint(docid) varint(POS_END)), for updates\n** we simply write the new doclist.  Segment merges overwrite older\n** data for a particular docid with newer data, so deletes or updates\n** will eventually overtake the earlier data and knock it out.  The\n** query logic likewise merges doclists so that newer data knocks out\n** older data.\n*/\n\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)\n# define SQLITE_CORE 1\n#endif\n\n#include <assert.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdarg.h>\n\n#include \"fts3.h\"\n#ifndef SQLITE_CORE \n# include \"sqlite3ext.h\"\n  SQLITE_EXTENSION_INIT1\n#endif\n\nstatic int fts3EvalNext(Fts3Cursor *pCsr);\nstatic int fts3EvalStart(Fts3Cursor *pCsr);\nstatic int fts3TermSegReaderCursor(\n    Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **);\n\n#ifndef SQLITE_AMALGAMATION\n# if defined(SQLITE_DEBUG)\nint sqlite3Fts3Always(int b) { assert( b ); return b; }\nint sqlite3Fts3Never(int b)  { assert( !b ); return b; }\n# endif\n#endif\n\n/* \n** Write a 64-bit variable-length integer to memory starting at p[0].\n** The length of data written will be between 1 and FTS3_VARINT_MAX bytes.\n** The number of bytes written is returned.\n*/\nint sqlite3Fts3PutVarint(char *p, sqlite_int64 v){\n  unsigned char *q = (unsigned char *) p;\n  sqlite_uint64 vu = v;\n  do{\n    *q++ = (unsigned char) ((vu & 0x7f) | 0x80);\n    vu >>= 7;\n  }while( vu!=0 );\n  q[-1] &= 0x7f;  /* turn off high bit in final byte */\n  assert( q - (unsigned char *)p <= FTS3_VARINT_MAX );\n  return (int) (q - (unsigned char *)p);\n}\n\n#define GETVARINT_STEP(v, ptr, shift, mask1, mask2, var, ret) \\\n  v = (v & mask1) | ( (*ptr++) << shift );                    \\\n  if( (v & mask2)==0 ){ var = v; return ret; }\n#define GETVARINT_INIT(v, ptr, shift, mask1, mask2, var, ret) \\\n  v = (*ptr++);                                               \\\n  if( (v & mask2)==0 ){ var = v; return ret; }\n\n/* \n** Read a 64-bit variable-length integer from memory starting at p[0].\n** Return the number of bytes read, or 0 on error.\n** The value is stored in *v.\n*/\nint sqlite3Fts3GetVarint(const char *p, sqlite_int64 *v){\n  const char *pStart = p;\n  u32 a;\n  u64 b;\n  int shift;\n\n  GETVARINT_INIT(a, p, 0,  0x00,     0x80, *v, 1);\n  GETVARINT_STEP(a, p, 7,  0x7F,     0x4000, *v, 2);\n  GETVARINT_STEP(a, p, 14, 0x3FFF,   0x200000, *v, 3);\n  GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *v, 4);\n  b = (a & 0x0FFFFFFF );\n\n  for(shift=28; shift<=63; shift+=7){\n    u64 c = *p++;\n    b += (c&0x7F) << shift;\n    if( (c & 0x80)==0 ) break;\n  }\n  *v = b;\n  return (int)(p - pStart);\n}\n\n/*\n** Similar to sqlite3Fts3GetVarint(), except that the output is truncated to a\n** 32-bit integer before it is returned.\n*/\nint sqlite3Fts3GetVarint32(const char *p, int *pi){\n  u32 a;\n\n#ifndef fts3GetVarint32\n  GETVARINT_INIT(a, p, 0,  0x00,     0x80, *pi, 1);\n#else\n  a = (*p++);\n  assert( a & 0x80 );\n#endif\n\n  GETVARINT_STEP(a, p, 7,  0x7F,     0x4000, *pi, 2);\n  GETVARINT_STEP(a, p, 14, 0x3FFF,   0x200000, *pi, 3);\n  GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *pi, 4);\n  a = (a & 0x0FFFFFFF );\n  *pi = (int)(a | ((u32)(*p & 0x0F) << 28));\n  return 5;\n}\n\n/*\n** Return the number of bytes required to encode v as a varint\n*/\nint sqlite3Fts3VarintLen(sqlite3_uint64 v){\n  int i = 0;\n  do{\n    i++;\n    v >>= 7;\n  }while( v!=0 );\n  return i;\n}\n\n/*\n** Convert an SQL-style quoted string into a normal string by removing\n** the quote characters.  The conversion is done in-place.  If the\n** input does not begin with a quote character, then this routine\n** is a no-op.\n**\n** Examples:\n**\n**     \"abc\"   becomes   abc\n**     'xyz'   becomes   xyz\n**     [pqr]   becomes   pqr\n**     `mno`   becomes   mno\n**\n*/\nvoid sqlite3Fts3Dequote(char *z){\n  char quote;                     /* Quote character (if any ) */\n\n  quote = z[0];\n  if( quote=='[' || quote=='\\'' || quote=='\"' || quote=='`' ){\n    int iIn = 1;                  /* Index of next byte to read from input */\n    int iOut = 0;                 /* Index of next byte to write to output */\n\n    /* If the first byte was a '[', then the close-quote character is a ']' */\n    if( quote=='[' ) quote = ']';  \n\n    while( z[iIn] ){\n      if( z[iIn]==quote ){\n        if( z[iIn+1]!=quote ) break;\n        z[iOut++] = quote;\n        iIn += 2;\n      }else{\n        z[iOut++] = z[iIn++];\n      }\n    }\n    z[iOut] = '\\0';\n  }\n}\n\n/*\n** Read a single varint from the doclist at *pp and advance *pp to point\n** to the first byte past the end of the varint.  Add the value of the varint\n** to *pVal.\n*/\nstatic void fts3GetDeltaVarint(char **pp, sqlite3_int64 *pVal){\n  sqlite3_int64 iVal;\n  *pp += sqlite3Fts3GetVarint(*pp, &iVal);\n  *pVal += iVal;\n}\n\n/*\n** When this function is called, *pp points to the first byte following a\n** varint that is part of a doclist (or position-list, or any other list\n** of varints). This function moves *pp to point to the start of that varint,\n** and sets *pVal by the varint value.\n**\n** Argument pStart points to the first byte of the doclist that the\n** varint is part of.\n*/\nstatic void fts3GetReverseVarint(\n  char **pp, \n  char *pStart, \n  sqlite3_int64 *pVal\n){\n  sqlite3_int64 iVal;\n  char *p;\n\n  /* Pointer p now points at the first byte past the varint we are \n  ** interested in. So, unless the doclist is corrupt, the 0x80 bit is\n  ** clear on character p[-1]. */\n  for(p = (*pp)-2; p>=pStart && *p&0x80; p--);\n  p++;\n  *pp = p;\n\n  sqlite3Fts3GetVarint(p, &iVal);\n  *pVal = iVal;\n}\n\n/*\n** The xDisconnect() virtual table method.\n*/\nstatic int fts3DisconnectMethod(sqlite3_vtab *pVtab){\n  Fts3Table *p = (Fts3Table *)pVtab;\n  int i;\n\n  assert( p->nPendingData==0 );\n  assert( p->pSegments==0 );\n\n  /* Free any prepared statements held */\n  for(i=0; i<SizeofArray(p->aStmt); i++){\n    sqlite3_finalize(p->aStmt[i]);\n  }\n  sqlite3_free(p->zSegmentsTbl);\n  sqlite3_free(p->zReadExprlist);\n  sqlite3_free(p->zWriteExprlist);\n  sqlite3_free(p->zContentTbl);\n  sqlite3_free(p->zLanguageid);\n\n  /* Invoke the tokenizer destructor to free the tokenizer. */\n  p->pTokenizer->pModule->xDestroy(p->pTokenizer);\n\n  sqlite3_free(p);\n  return SQLITE_OK;\n}\n\n/*\n** Write an error message into *pzErr\n*/\nvoid sqlite3Fts3ErrMsg(char **pzErr, const char *zFormat, ...){\n  va_list ap;\n  sqlite3_free(*pzErr);\n  va_start(ap, zFormat);\n  *pzErr = sqlite3_vmprintf(zFormat, ap);\n  va_end(ap);\n}\n\n/*\n** Construct one or more SQL statements from the format string given\n** and then evaluate those statements. The success code is written\n** into *pRc.\n**\n** If *pRc is initially non-zero then this routine is a no-op.\n*/\nstatic void fts3DbExec(\n  int *pRc,              /* Success code */\n  sqlite3 *db,           /* Database in which to run SQL */\n  const char *zFormat,   /* Format string for SQL */\n  ...                    /* Arguments to the format string */\n){\n  va_list ap;\n  char *zSql;\n  if( *pRc ) return;\n  va_start(ap, zFormat);\n  zSql = sqlite3_vmprintf(zFormat, ap);\n  va_end(ap);\n  if( zSql==0 ){\n    *pRc = SQLITE_NOMEM;\n  }else{\n    *pRc = sqlite3_exec(db, zSql, 0, 0, 0);\n    sqlite3_free(zSql);\n  }\n}\n\n/*\n** The xDestroy() virtual table method.\n*/\nstatic int fts3DestroyMethod(sqlite3_vtab *pVtab){\n  Fts3Table *p = (Fts3Table *)pVtab;\n  int rc = SQLITE_OK;              /* Return code */\n  const char *zDb = p->zDb;        /* Name of database (e.g. \"main\", \"temp\") */\n  sqlite3 *db = p->db;             /* Database handle */\n\n  /* Drop the shadow tables */\n  if( p->zContentTbl==0 ){\n    fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_content'\", zDb, p->zName);\n  }\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_segments'\", zDb,p->zName);\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_segdir'\", zDb, p->zName);\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_docsize'\", zDb, p->zName);\n  fts3DbExec(&rc, db, \"DROP TABLE IF EXISTS %Q.'%q_stat'\", zDb, p->zName);\n\n  /* If everything has worked, invoke fts3DisconnectMethod() to free the\n  ** memory associated with the Fts3Table structure and return SQLITE_OK.\n  ** Otherwise, return an SQLite error code.\n  */\n  return (rc==SQLITE_OK ? fts3DisconnectMethod(pVtab) : rc);\n}\n\n\n/*\n** Invoke sqlite3_declare_vtab() to declare the schema for the FTS3 table\n** passed as the first argument. This is done as part of the xConnect()\n** and xCreate() methods.\n**\n** If *pRc is non-zero when this function is called, it is a no-op. \n** Otherwise, if an error occurs, an SQLite error code is stored in *pRc\n** before returning.\n*/\nstatic void fts3DeclareVtab(int *pRc, Fts3Table *p){\n  if( *pRc==SQLITE_OK ){\n    int i;                        /* Iterator variable */\n    int rc;                       /* Return code */\n    char *zSql;                   /* SQL statement passed to declare_vtab() */\n    char *zCols;                  /* List of user defined columns */\n    const char *zLanguageid;\n\n    zLanguageid = (p->zLanguageid ? p->zLanguageid : \"__langid\");\n    sqlite3_vtab_config(p->db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1);\n\n    /* Create a list of user columns for the virtual table */\n    zCols = sqlite3_mprintf(\"%Q, \", p->azColumn[0]);\n    for(i=1; zCols && i<p->nColumn; i++){\n      zCols = sqlite3_mprintf(\"%z%Q, \", zCols, p->azColumn[i]);\n    }\n\n    /* Create the whole \"CREATE TABLE\" statement to pass to SQLite */\n    zSql = sqlite3_mprintf(\n        \"CREATE TABLE x(%s %Q HIDDEN, docid HIDDEN, %Q HIDDEN)\", \n        zCols, p->zName, zLanguageid\n    );\n    if( !zCols || !zSql ){\n      rc = SQLITE_NOMEM;\n    }else{\n      rc = sqlite3_declare_vtab(p->db, zSql);\n    }\n\n    sqlite3_free(zSql);\n    sqlite3_free(zCols);\n    *pRc = rc;\n  }\n}\n\n/*\n** Create the %_stat table if it does not already exist.\n*/\nvoid sqlite3Fts3CreateStatTable(int *pRc, Fts3Table *p){\n  fts3DbExec(pRc, p->db, \n      \"CREATE TABLE IF NOT EXISTS %Q.'%q_stat'\"\n          \"(id INTEGER PRIMARY KEY, value BLOB);\",\n      p->zDb, p->zName\n  );\n  if( (*pRc)==SQLITE_OK ) p->bHasStat = 1;\n}\n\n/*\n** Create the backing store tables (%_content, %_segments and %_segdir)\n** required by the FTS3 table passed as the only argument. This is done\n** as part of the vtab xCreate() method.\n**\n** If the p->bHasDocsize boolean is true (indicating that this is an\n** FTS4 table, not an FTS3 table) then also create the %_docsize and\n** %_stat tables required by FTS4.\n*/\nstatic int fts3CreateTables(Fts3Table *p){\n  int rc = SQLITE_OK;             /* Return code */\n  int i;                          /* Iterator variable */\n  sqlite3 *db = p->db;            /* The database connection */\n\n  if( p->zContentTbl==0 ){\n    const char *zLanguageid = p->zLanguageid;\n    char *zContentCols;           /* Columns of %_content table */\n\n    /* Create a list of user columns for the content table */\n    zContentCols = sqlite3_mprintf(\"docid INTEGER PRIMARY KEY\");\n    for(i=0; zContentCols && i<p->nColumn; i++){\n      char *z = p->azColumn[i];\n      zContentCols = sqlite3_mprintf(\"%z, 'c%d%q'\", zContentCols, i, z);\n    }\n    if( zLanguageid && zContentCols ){\n      zContentCols = sqlite3_mprintf(\"%z, langid\", zContentCols, zLanguageid);\n    }\n    if( zContentCols==0 ) rc = SQLITE_NOMEM;\n  \n    /* Create the content table */\n    fts3DbExec(&rc, db, \n       \"CREATE TABLE %Q.'%q_content'(%s)\",\n       p->zDb, p->zName, zContentCols\n    );\n    sqlite3_free(zContentCols);\n  }\n\n  /* Create other tables */\n  fts3DbExec(&rc, db, \n      \"CREATE TABLE %Q.'%q_segments'(blockid INTEGER PRIMARY KEY, block BLOB);\",\n      p->zDb, p->zName\n  );\n  fts3DbExec(&rc, db, \n      \"CREATE TABLE %Q.'%q_segdir'(\"\n        \"level INTEGER,\"\n        \"idx INTEGER,\"\n        \"start_block INTEGER,\"\n        \"leaves_end_block INTEGER,\"\n        \"end_block INTEGER,\"\n        \"root BLOB,\"\n        \"PRIMARY KEY(level, idx)\"\n      \");\",\n      p->zDb, p->zName\n  );\n  if( p->bHasDocsize ){\n    fts3DbExec(&rc, db, \n        \"CREATE TABLE %Q.'%q_docsize'(docid INTEGER PRIMARY KEY, size BLOB);\",\n        p->zDb, p->zName\n    );\n  }\n  assert( p->bHasStat==p->bFts4 );\n  if( p->bHasStat ){\n    sqlite3Fts3CreateStatTable(&rc, p);\n  }\n  return rc;\n}\n\n/*\n** Store the current database page-size in bytes in p->nPgsz.\n**\n** If *pRc is non-zero when this function is called, it is a no-op. \n** Otherwise, if an error occurs, an SQLite error code is stored in *pRc\n** before returning.\n*/\nstatic void fts3DatabasePageSize(int *pRc, Fts3Table *p){\n  if( *pRc==SQLITE_OK ){\n    int rc;                       /* Return code */\n    char *zSql;                   /* SQL text \"PRAGMA %Q.page_size\" */\n    sqlite3_stmt *pStmt;          /* Compiled \"PRAGMA %Q.page_size\" statement */\n  \n    zSql = sqlite3_mprintf(\"PRAGMA %Q.page_size\", p->zDb);\n    if( !zSql ){\n      rc = SQLITE_NOMEM;\n    }else{\n      rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0);\n      if( rc==SQLITE_OK ){\n        sqlite3_step(pStmt);\n        p->nPgsz = sqlite3_column_int(pStmt, 0);\n        rc = sqlite3_finalize(pStmt);\n      }else if( rc==SQLITE_AUTH ){\n        p->nPgsz = 1024;\n        rc = SQLITE_OK;\n      }\n    }\n    assert( p->nPgsz>0 || rc!=SQLITE_OK );\n    sqlite3_free(zSql);\n    *pRc = rc;\n  }\n}\n\n/*\n** \"Special\" FTS4 arguments are column specifications of the following form:\n**\n**   <key> = <value>\n**\n** There may not be whitespace surrounding the \"=\" character. The <value> \n** term may be quoted, but the <key> may not.\n*/\nstatic int fts3IsSpecialColumn(\n  const char *z, \n  int *pnKey,\n  char **pzValue\n){\n  char *zValue;\n  const char *zCsr = z;\n\n  while( *zCsr!='=' ){\n    if( *zCsr=='\\0' ) return 0;\n    zCsr++;\n  }\n\n  *pnKey = (int)(zCsr-z);\n  zValue = sqlite3_mprintf(\"%s\", &zCsr[1]);\n  if( zValue ){\n    sqlite3Fts3Dequote(zValue);\n  }\n  *pzValue = zValue;\n  return 1;\n}\n\n/*\n** Append the output of a printf() style formatting to an existing string.\n*/\nstatic void fts3Appendf(\n  int *pRc,                       /* IN/OUT: Error code */\n  char **pz,                      /* IN/OUT: Pointer to string buffer */\n  const char *zFormat,            /* Printf format string to append */\n  ...                             /* Arguments for printf format string */\n){\n  if( *pRc==SQLITE_OK ){\n    va_list ap;\n    char *z;\n    va_start(ap, zFormat);\n    z = sqlite3_vmprintf(zFormat, ap);\n    va_end(ap);\n    if( z && *pz ){\n      char *z2 = sqlite3_mprintf(\"%s%s\", *pz, z);\n      sqlite3_free(z);\n      z = z2;\n    }\n    if( z==0 ) *pRc = SQLITE_NOMEM;\n    sqlite3_free(*pz);\n    *pz = z;\n  }\n}\n\n/*\n** Return a copy of input string zInput enclosed in double-quotes (\") and\n** with all double quote characters escaped. For example:\n**\n**     fts3QuoteId(\"un \\\"zip\\\"\")   ->    \"un \\\"\\\"zip\\\"\\\"\"\n**\n** The pointer returned points to memory obtained from sqlite3_malloc(). It\n** is the callers responsibility to call sqlite3_free() to release this\n** memory.\n*/\nstatic char *fts3QuoteId(char const *zInput){\n  int nRet;\n  char *zRet;\n  nRet = 2 + (int)strlen(zInput)*2 + 1;\n  zRet = sqlite3_malloc(nRet);\n  if( zRet ){\n    int i;\n    char *z = zRet;\n    *(z++) = '\"';\n    for(i=0; zInput[i]; i++){\n      if( zInput[i]=='\"' ) *(z++) = '\"';\n      *(z++) = zInput[i];\n    }\n    *(z++) = '\"';\n    *(z++) = '\\0';\n  }\n  return zRet;\n}\n\n/*\n** Return a list of comma separated SQL expressions and a FROM clause that \n** could be used in a SELECT statement such as the following:\n**\n**     SELECT <list of expressions> FROM %_content AS x ...\n**\n** to return the docid, followed by each column of text data in order\n** from left to write. If parameter zFunc is not NULL, then instead of\n** being returned directly each column of text data is passed to an SQL\n** function named zFunc first. For example, if zFunc is \"unzip\" and the\n** table has the three user-defined columns \"a\", \"b\", and \"c\", the following\n** string is returned:\n**\n**     \"docid, unzip(x.'a'), unzip(x.'b'), unzip(x.'c') FROM %_content AS x\"\n**\n** The pointer returned points to a buffer allocated by sqlite3_malloc(). It\n** is the responsibility of the caller to eventually free it.\n**\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and\n** a NULL pointer is returned). Otherwise, if an OOM error is encountered\n** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If\n** no error occurs, *pRc is left unmodified.\n*/\nstatic char *fts3ReadExprList(Fts3Table *p, const char *zFunc, int *pRc){\n  char *zRet = 0;\n  char *zFree = 0;\n  char *zFunction;\n  int i;\n\n  if( p->zContentTbl==0 ){\n    if( !zFunc ){\n      zFunction = \"\";\n    }else{\n      zFree = zFunction = fts3QuoteId(zFunc);\n    }\n    fts3Appendf(pRc, &zRet, \"docid\");\n    for(i=0; i<p->nColumn; i++){\n      fts3Appendf(pRc, &zRet, \",%s(x.'c%d%q')\", zFunction, i, p->azColumn[i]);\n    }\n    if( p->zLanguageid ){\n      fts3Appendf(pRc, &zRet, \", x.%Q\", \"langid\");\n    }\n    sqlite3_free(zFree);\n  }else{\n    fts3Appendf(pRc, &zRet, \"rowid\");\n    for(i=0; i<p->nColumn; i++){\n      fts3Appendf(pRc, &zRet, \", x.'%q'\", p->azColumn[i]);\n    }\n    if( p->zLanguageid ){\n      fts3Appendf(pRc, &zRet, \", x.%Q\", p->zLanguageid);\n    }\n  }\n  fts3Appendf(pRc, &zRet, \" FROM '%q'.'%q%s' AS x\", \n      p->zDb,\n      (p->zContentTbl ? p->zContentTbl : p->zName),\n      (p->zContentTbl ? \"\" : \"_content\")\n  );\n  return zRet;\n}\n\n/*\n** Return a list of N comma separated question marks, where N is the number\n** of columns in the %_content table (one for the docid plus one for each\n** user-defined text column).\n**\n** If argument zFunc is not NULL, then all but the first question mark\n** is preceded by zFunc and an open bracket, and followed by a closed\n** bracket. For example, if zFunc is \"zip\" and the FTS3 table has three \n** user-defined text columns, the following string is returned:\n**\n**     \"?, zip(?), zip(?), zip(?)\"\n**\n** The pointer returned points to a buffer allocated by sqlite3_malloc(). It\n** is the responsibility of the caller to eventually free it.\n**\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and\n** a NULL pointer is returned). Otherwise, if an OOM error is encountered\n** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If\n** no error occurs, *pRc is left unmodified.\n*/\nstatic char *fts3WriteExprList(Fts3Table *p, const char *zFunc, int *pRc){\n  char *zRet = 0;\n  char *zFree = 0;\n  char *zFunction;\n  int i;\n\n  if( !zFunc ){\n    zFunction = \"\";\n  }else{\n    zFree = zFunction = fts3QuoteId(zFunc);\n  }\n  fts3Appendf(pRc, &zRet, \"?\");\n  for(i=0; i<p->nColumn; i++){\n    fts3Appendf(pRc, &zRet, \",%s(?)\", zFunction);\n  }\n  if( p->zLanguageid ){\n    fts3Appendf(pRc, &zRet, \", ?\");\n  }\n  sqlite3_free(zFree);\n  return zRet;\n}\n\n/*\n** This function interprets the string at (*pp) as a non-negative integer\n** value. It reads the integer and sets *pnOut to the value read, then \n** sets *pp to point to the byte immediately following the last byte of\n** the integer value.\n**\n** Only decimal digits ('0'..'9') may be part of an integer value. \n**\n** If *pp does not being with a decimal digit SQLITE_ERROR is returned and\n** the output value undefined. Otherwise SQLITE_OK is returned.\n**\n** This function is used when parsing the \"prefix=\" FTS4 parameter.\n*/\nstatic int fts3GobbleInt(const char **pp, int *pnOut){\n  const int MAX_NPREFIX = 10000000;\n  const char *p;                  /* Iterator pointer */\n  int nInt = 0;                   /* Output value */\n\n  for(p=*pp; p[0]>='0' && p[0]<='9'; p++){\n    nInt = nInt * 10 + (p[0] - '0');\n    if( nInt>MAX_NPREFIX ){\n      nInt = 0;\n      break;\n    }\n  }\n  if( p==*pp ) return SQLITE_ERROR;\n  *pnOut = nInt;\n  *pp = p;\n  return SQLITE_OK;\n}\n\n/*\n** This function is called to allocate an array of Fts3Index structures\n** representing the indexes maintained by the current FTS table. FTS tables\n** always maintain the main \"terms\" index, but may also maintain one or\n** more \"prefix\" indexes, depending on the value of the \"prefix=\" parameter\n** (if any) specified as part of the CREATE VIRTUAL TABLE statement.\n**\n** Argument zParam is passed the value of the \"prefix=\" option if one was\n** specified, or NULL otherwise.\n**\n** If no error occurs, SQLITE_OK is returned and *apIndex set to point to\n** the allocated array. *pnIndex is set to the number of elements in the\n** array. If an error does occur, an SQLite error code is returned.\n**\n** Regardless of whether or not an error is returned, it is the responsibility\n** of the caller to call sqlite3_free() on the output array to free it.\n*/\nstatic int fts3PrefixParameter(\n  const char *zParam,             /* ABC in prefix=ABC parameter to parse */\n  int *pnIndex,                   /* OUT: size of *apIndex[] array */\n  struct Fts3Index **apIndex      /* OUT: Array of indexes for this table */\n){\n  struct Fts3Index *aIndex;       /* Allocated array */\n  int nIndex = 1;                 /* Number of entries in array */\n\n  if( zParam && zParam[0] ){\n    const char *p;\n    nIndex++;\n    for(p=zParam; *p; p++){\n      if( *p==',' ) nIndex++;\n    }\n  }\n\n  aIndex = sqlite3_malloc(sizeof(struct Fts3Index) * nIndex);\n  *apIndex = aIndex;\n  if( !aIndex ){\n    return SQLITE_NOMEM;\n  }\n\n  memset(aIndex, 0, sizeof(struct Fts3Index) * nIndex);\n  if( zParam ){\n    const char *p = zParam;\n    int i;\n    for(i=1; i<nIndex; i++){\n      int nPrefix = 0;\n      if( fts3GobbleInt(&p, &nPrefix) ) return SQLITE_ERROR;\n      assert( nPrefix>=0 );\n      if( nPrefix==0 ){\n        nIndex--;\n        i--;\n      }else{\n        aIndex[i].nPrefix = nPrefix;\n      }\n      p++;\n    }\n  }\n\n  *pnIndex = nIndex;\n  return SQLITE_OK;\n}\n\n/*\n** This function is called when initializing an FTS4 table that uses the\n** content=xxx option. It determines the number of and names of the columns\n** of the new FTS4 table.\n**\n** The third argument passed to this function is the value passed to the\n** config=xxx option (i.e. \"xxx\"). This function queries the database for\n** a table of that name. If found, the output variables are populated\n** as follows:\n**\n**   *pnCol:   Set to the number of columns table xxx has,\n**\n**   *pnStr:   Set to the total amount of space required to store a copy\n**             of each columns name, including the nul-terminator.\n**\n**   *pazCol:  Set to point to an array of *pnCol strings. Each string is\n**             the name of the corresponding column in table xxx. The array\n**             and its contents are allocated using a single allocation. It\n**             is the responsibility of the caller to free this allocation\n**             by eventually passing the *pazCol value to sqlite3_free().\n**\n** If the table cannot be found, an error code is returned and the output\n** variables are undefined. Or, if an OOM is encountered, SQLITE_NOMEM is\n** returned (and the output variables are undefined).\n*/\nstatic int fts3ContentColumns(\n  sqlite3 *db,                    /* Database handle */\n  const char *zDb,                /* Name of db (i.e. \"main\", \"temp\" etc.) */\n  const char *zTbl,               /* Name of content table */\n  const char ***pazCol,           /* OUT: Malloc'd array of column names */\n  int *pnCol,                     /* OUT: Size of array *pazCol */\n  int *pnStr,                     /* OUT: Bytes of string content */\n  char **pzErr                    /* OUT: error message */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  char *zSql;                     /* \"SELECT *\" statement on zTbl */  \n  sqlite3_stmt *pStmt = 0;        /* Compiled version of zSql */\n\n  zSql = sqlite3_mprintf(\"SELECT * FROM %Q.%Q\", zDb, zTbl);\n  if( !zSql ){\n    rc = SQLITE_NOMEM;\n  }else{\n    rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\n    if( rc!=SQLITE_OK ){\n      sqlite3Fts3ErrMsg(pzErr, \"%s\", sqlite3_errmsg(db));\n    }\n  }\n  sqlite3_free(zSql);\n\n  if( rc==SQLITE_OK ){\n    const char **azCol;           /* Output array */\n    int nStr = 0;                 /* Size of all column names (incl. 0x00) */\n    int nCol;                     /* Number of table columns */\n    int i;                        /* Used to iterate through columns */\n\n    /* Loop through the returned columns. Set nStr to the number of bytes of\n    ** space required to store a copy of each column name, including the\n    ** nul-terminator byte.  */\n    nCol = sqlite3_column_count(pStmt);\n    for(i=0; i<nCol; i++){\n      const char *zCol = sqlite3_column_name(pStmt, i);\n      nStr += (int)strlen(zCol) + 1;\n    }\n\n    /* Allocate and populate the array to return. */\n    azCol = (const char **)sqlite3_malloc(sizeof(char *) * nCol + nStr);\n    if( azCol==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      char *p = (char *)&azCol[nCol];\n      for(i=0; i<nCol; i++){\n        const char *zCol = sqlite3_column_name(pStmt, i);\n        int n = (int)strlen(zCol)+1;\n        memcpy(p, zCol, n);\n        azCol[i] = p;\n        p += n;\n      }\n    }\n    sqlite3_finalize(pStmt);\n\n    /* Set the output variables. */\n    *pnCol = nCol;\n    *pnStr = nStr;\n    *pazCol = azCol;\n  }\n\n  return rc;\n}\n\n/*\n** This function is the implementation of both the xConnect and xCreate\n** methods of the FTS3 virtual table.\n**\n** The argv[] array contains the following:\n**\n**   argv[0]   -> module name  (\"fts3\" or \"fts4\")\n**   argv[1]   -> database name\n**   argv[2]   -> table name\n**   argv[...] -> \"column name\" and other module argument fields.\n*/\nstatic int fts3InitVtab(\n  int isCreate,                   /* True for xCreate, false for xConnect */\n  sqlite3 *db,                    /* The SQLite database connection */\n  void *pAux,                     /* Hash table containing tokenizers */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVTab,          /* Write the resulting vtab structure here */\n  char **pzErr                    /* Write any error message here */\n){\n  Fts3Hash *pHash = (Fts3Hash *)pAux;\n  Fts3Table *p = 0;               /* Pointer to allocated vtab */\n  int rc = SQLITE_OK;             /* Return code */\n  int i;                          /* Iterator variable */\n  int nByte;                      /* Size of allocation used for *p */\n  int iCol;                       /* Column index */\n  int nString = 0;                /* Bytes required to hold all column names */\n  int nCol = 0;                   /* Number of columns in the FTS table */\n  char *zCsr;                     /* Space for holding column names */\n  int nDb;                        /* Bytes required to hold database name */\n  int nName;                      /* Bytes required to hold table name */\n  int isFts4 = (argv[0][3]=='4'); /* True for FTS4, false for FTS3 */\n  const char **aCol;              /* Array of column names */\n  sqlite3_tokenizer *pTokenizer = 0;        /* Tokenizer for this table */\n\n  int nIndex = 0;                 /* Size of aIndex[] array */\n  struct Fts3Index *aIndex = 0;   /* Array of indexes for this table */\n\n  /* The results of parsing supported FTS4 key=value options: */\n  int bNoDocsize = 0;             /* True to omit %_docsize table */\n  int bDescIdx = 0;               /* True to store descending indexes */\n  char *zPrefix = 0;              /* Prefix parameter value (or NULL) */\n  char *zCompress = 0;            /* compress=? parameter (or NULL) */\n  char *zUncompress = 0;          /* uncompress=? parameter (or NULL) */\n  char *zContent = 0;             /* content=? parameter (or NULL) */\n  char *zLanguageid = 0;          /* languageid=? parameter (or NULL) */\n  char **azNotindexed = 0;        /* The set of notindexed= columns */\n  int nNotindexed = 0;            /* Size of azNotindexed[] array */\n\n  assert( strlen(argv[0])==4 );\n  assert( (sqlite3_strnicmp(argv[0], \"fts4\", 4)==0 && isFts4)\n       || (sqlite3_strnicmp(argv[0], \"fts3\", 4)==0 && !isFts4)\n  );\n\n  nDb = (int)strlen(argv[1]) + 1;\n  nName = (int)strlen(argv[2]) + 1;\n\n  nByte = sizeof(const char *) * (argc-2);\n  aCol = (const char **)sqlite3_malloc(nByte);\n  if( aCol ){\n    memset((void*)aCol, 0, nByte);\n    azNotindexed = (char **)sqlite3_malloc(nByte);\n  }\n  if( azNotindexed ){\n    memset(azNotindexed, 0, nByte);\n  }\n  if( !aCol || !azNotindexed ){\n    rc = SQLITE_NOMEM;\n    goto fts3_init_out;\n  }\n\n  /* Loop through all of the arguments passed by the user to the FTS3/4\n  ** module (i.e. all the column names and special arguments). This loop\n  ** does the following:\n  **\n  **   + Figures out the number of columns the FTSX table will have, and\n  **     the number of bytes of space that must be allocated to store copies\n  **     of the column names.\n  **\n  **   + If there is a tokenizer specification included in the arguments,\n  **     initializes the tokenizer pTokenizer.\n  */\n  for(i=3; rc==SQLITE_OK && i<argc; i++){\n    char const *z = argv[i];\n    int nKey;\n    char *zVal;\n\n    /* Check if this is a tokenizer specification */\n    if( !pTokenizer \n     && strlen(z)>8\n     && 0==sqlite3_strnicmp(z, \"tokenize\", 8) \n     && 0==sqlite3Fts3IsIdChar(z[8])\n    ){\n      rc = sqlite3Fts3InitTokenizer(pHash, &z[9], &pTokenizer, pzErr);\n    }\n\n    /* Check if it is an FTS4 special argument. */\n    else if( isFts4 && fts3IsSpecialColumn(z, &nKey, &zVal) ){\n      struct Fts4Option {\n        const char *zOpt;\n        int nOpt;\n      } aFts4Opt[] = {\n        { \"matchinfo\",   9 },     /* 0 -> MATCHINFO */\n        { \"prefix\",      6 },     /* 1 -> PREFIX */\n        { \"compress\",    8 },     /* 2 -> COMPRESS */\n        { \"uncompress\", 10 },     /* 3 -> UNCOMPRESS */\n        { \"order\",       5 },     /* 4 -> ORDER */\n        { \"content\",     7 },     /* 5 -> CONTENT */\n        { \"languageid\", 10 },     /* 6 -> LANGUAGEID */\n        { \"notindexed\", 10 }      /* 7 -> NOTINDEXED */\n      };\n\n      int iOpt;\n      if( !zVal ){\n        rc = SQLITE_NOMEM;\n      }else{\n        for(iOpt=0; iOpt<SizeofArray(aFts4Opt); iOpt++){\n          struct Fts4Option *pOp = &aFts4Opt[iOpt];\n          if( nKey==pOp->nOpt && !sqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){\n            break;\n          }\n        }\n        if( iOpt==SizeofArray(aFts4Opt) ){\n          sqlite3Fts3ErrMsg(pzErr, \"unrecognized parameter: %s\", z);\n          rc = SQLITE_ERROR;\n        }else{\n          switch( iOpt ){\n            case 0:               /* MATCHINFO */\n              if( strlen(zVal)!=4 || sqlite3_strnicmp(zVal, \"fts3\", 4) ){\n                sqlite3Fts3ErrMsg(pzErr, \"unrecognized matchinfo: %s\", zVal);\n                rc = SQLITE_ERROR;\n              }\n              bNoDocsize = 1;\n              break;\n\n            case 1:               /* PREFIX */\n              sqlite3_free(zPrefix);\n              zPrefix = zVal;\n              zVal = 0;\n              break;\n\n            case 2:               /* COMPRESS */\n              sqlite3_free(zCompress);\n              zCompress = zVal;\n              zVal = 0;\n              break;\n\n            case 3:               /* UNCOMPRESS */\n              sqlite3_free(zUncompress);\n              zUncompress = zVal;\n              zVal = 0;\n              break;\n\n            case 4:               /* ORDER */\n              if( (strlen(zVal)!=3 || sqlite3_strnicmp(zVal, \"asc\", 3)) \n               && (strlen(zVal)!=4 || sqlite3_strnicmp(zVal, \"desc\", 4)) \n              ){\n                sqlite3Fts3ErrMsg(pzErr, \"unrecognized order: %s\", zVal);\n                rc = SQLITE_ERROR;\n              }\n              bDescIdx = (zVal[0]=='d' || zVal[0]=='D');\n              break;\n\n            case 5:              /* CONTENT */\n              sqlite3_free(zContent);\n              zContent = zVal;\n              zVal = 0;\n              break;\n\n            case 6:              /* LANGUAGEID */\n              assert( iOpt==6 );\n              sqlite3_free(zLanguageid);\n              zLanguageid = zVal;\n              zVal = 0;\n              break;\n\n            case 7:              /* NOTINDEXED */\n              azNotindexed[nNotindexed++] = zVal;\n              zVal = 0;\n              break;\n          }\n        }\n        sqlite3_free(zVal);\n      }\n    }\n\n    /* Otherwise, the argument is a column name. */\n    else {\n      nString += (int)(strlen(z) + 1);\n      aCol[nCol++] = z;\n    }\n  }\n\n  /* If a content=xxx option was specified, the following:\n  **\n  **   1. Ignore any compress= and uncompress= options.\n  **\n  **   2. If no column names were specified as part of the CREATE VIRTUAL\n  **      TABLE statement, use all columns from the content table.\n  */\n  if( rc==SQLITE_OK && zContent ){\n    sqlite3_free(zCompress); \n    sqlite3_free(zUncompress); \n    zCompress = 0;\n    zUncompress = 0;\n    if( nCol==0 ){\n      sqlite3_free((void*)aCol); \n      aCol = 0;\n      rc = fts3ContentColumns(db, argv[1], zContent,&aCol,&nCol,&nString,pzErr);\n\n      /* If a languageid= option was specified, remove the language id\n      ** column from the aCol[] array. */ \n      if( rc==SQLITE_OK && zLanguageid ){\n        int j;\n        for(j=0; j<nCol; j++){\n          if( sqlite3_stricmp(zLanguageid, aCol[j])==0 ){\n            int k;\n            for(k=j; k<nCol; k++) aCol[k] = aCol[k+1];\n            nCol--;\n            break;\n          }\n        }\n      }\n    }\n  }\n  if( rc!=SQLITE_OK ) goto fts3_init_out;\n\n  if( nCol==0 ){\n    assert( nString==0 );\n    aCol[0] = \"content\";\n    nString = 8;\n    nCol = 1;\n  }\n\n  if( pTokenizer==0 ){\n    rc = sqlite3Fts3InitTokenizer(pHash, \"simple\", &pTokenizer, pzErr);\n    if( rc!=SQLITE_OK ) goto fts3_init_out;\n  }\n  assert( pTokenizer );\n\n  rc = fts3PrefixParameter(zPrefix, &nIndex, &aIndex);\n  if( rc==SQLITE_ERROR ){\n    assert( zPrefix );\n    sqlite3Fts3ErrMsg(pzErr, \"error parsing prefix parameter: %s\", zPrefix);\n  }\n  if( rc!=SQLITE_OK ) goto fts3_init_out;\n\n  /* Allocate and populate the Fts3Table structure. */\n  nByte = sizeof(Fts3Table) +                  /* Fts3Table */\n          nCol * sizeof(char *) +              /* azColumn */\n          nIndex * sizeof(struct Fts3Index) +  /* aIndex */\n          nCol * sizeof(u8) +                  /* abNotindexed */\n          nName +                              /* zName */\n          nDb +                                /* zDb */\n          nString;                             /* Space for azColumn strings */\n  p = (Fts3Table*)sqlite3_malloc(nByte);\n  if( p==0 ){\n    rc = SQLITE_NOMEM;\n    goto fts3_init_out;\n  }\n  memset(p, 0, nByte);\n  p->db = db;\n  p->nColumn = nCol;\n  p->nPendingData = 0;\n  p->azColumn = (char **)&p[1];\n  p->pTokenizer = pTokenizer;\n  p->nMaxPendingData = FTS3_MAX_PENDING_DATA;\n  p->bHasDocsize = (isFts4 && bNoDocsize==0);\n  p->bHasStat = isFts4;\n  p->bFts4 = isFts4;\n  p->bDescIdx = bDescIdx;\n  p->nAutoincrmerge = 0xff;   /* 0xff means setting unknown */\n  p->zContentTbl = zContent;\n  p->zLanguageid = zLanguageid;\n  zContent = 0;\n  zLanguageid = 0;\n  TESTONLY( p->inTransaction = -1 );\n  TESTONLY( p->mxSavepoint = -1 );\n\n  p->aIndex = (struct Fts3Index *)&p->azColumn[nCol];\n  memcpy(p->aIndex, aIndex, sizeof(struct Fts3Index) * nIndex);\n  p->nIndex = nIndex;\n  for(i=0; i<nIndex; i++){\n    fts3HashInit(&p->aIndex[i].hPending, FTS3_HASH_STRING, 1);\n  }\n  p->abNotindexed = (u8 *)&p->aIndex[nIndex];\n\n  /* Fill in the zName and zDb fields of the vtab structure. */\n  zCsr = (char *)&p->abNotindexed[nCol];\n  p->zName = zCsr;\n  memcpy(zCsr, argv[2], nName);\n  zCsr += nName;\n  p->zDb = zCsr;\n  memcpy(zCsr, argv[1], nDb);\n  zCsr += nDb;\n\n  /* Fill in the azColumn array */\n  for(iCol=0; iCol<nCol; iCol++){\n    char *z; \n    int n = 0;\n    z = (char *)sqlite3Fts3NextToken(aCol[iCol], &n);\n    memcpy(zCsr, z, n);\n    zCsr[n] = '\\0';\n    sqlite3Fts3Dequote(zCsr);\n    p->azColumn[iCol] = zCsr;\n    zCsr += n+1;\n    assert( zCsr <= &((char *)p)[nByte] );\n  }\n\n  /* Fill in the abNotindexed array */\n  for(iCol=0; iCol<nCol; iCol++){\n    int n = (int)strlen(p->azColumn[iCol]);\n    for(i=0; i<nNotindexed; i++){\n      char *zNot = azNotindexed[i];\n      if( zNot && n==(int)strlen(zNot)\n       && 0==sqlite3_strnicmp(p->azColumn[iCol], zNot, n) \n      ){\n        p->abNotindexed[iCol] = 1;\n        sqlite3_free(zNot);\n        azNotindexed[i] = 0;\n      }\n    }\n  }\n  for(i=0; i<nNotindexed; i++){\n    if( azNotindexed[i] ){\n      sqlite3Fts3ErrMsg(pzErr, \"no such column: %s\", azNotindexed[i]);\n      rc = SQLITE_ERROR;\n    }\n  }\n\n  if( rc==SQLITE_OK && (zCompress==0)!=(zUncompress==0) ){\n    char const *zMiss = (zCompress==0 ? \"compress\" : \"uncompress\");\n    rc = SQLITE_ERROR;\n    sqlite3Fts3ErrMsg(pzErr, \"missing %s parameter in fts4 constructor\", zMiss);\n  }\n  p->zReadExprlist = fts3ReadExprList(p, zUncompress, &rc);\n  p->zWriteExprlist = fts3WriteExprList(p, zCompress, &rc);\n  if( rc!=SQLITE_OK ) goto fts3_init_out;\n\n  /* If this is an xCreate call, create the underlying tables in the \n  ** database. TODO: For xConnect(), it could verify that said tables exist.\n  */\n  if( isCreate ){\n    rc = fts3CreateTables(p);\n  }\n\n  /* Check to see if a legacy fts3 table has been \"upgraded\" by the\n  ** addition of a %_stat table so that it can use incremental merge.\n  */\n  if( !isFts4 && !isCreate ){\n    p->bHasStat = 2;\n  }\n\n  /* Figure out the page-size for the database. This is required in order to\n  ** estimate the cost of loading large doclists from the database.  */\n  fts3DatabasePageSize(&rc, p);\n  p->nNodeSize = p->nPgsz-35;\n\n  /* Declare the table schema to SQLite. */\n  fts3DeclareVtab(&rc, p);\n\nfts3_init_out:\n  sqlite3_free(zPrefix);\n  sqlite3_free(aIndex);\n  sqlite3_free(zCompress);\n  sqlite3_free(zUncompress);\n  sqlite3_free(zContent);\n  sqlite3_free(zLanguageid);\n  for(i=0; i<nNotindexed; i++) sqlite3_free(azNotindexed[i]);\n  sqlite3_free((void *)aCol);\n  sqlite3_free((void *)azNotindexed);\n  if( rc!=SQLITE_OK ){\n    if( p ){\n      fts3DisconnectMethod((sqlite3_vtab *)p);\n    }else if( pTokenizer ){\n      pTokenizer->pModule->xDestroy(pTokenizer);\n    }\n  }else{\n    assert( p->pSegments==0 );\n    *ppVTab = &p->base;\n  }\n  return rc;\n}\n\n/*\n** The xConnect() and xCreate() methods for the virtual table. All the\n** work is done in function fts3InitVtab().\n*/\nstatic int fts3ConnectMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pAux,                     /* Pointer to tokenizer hash table */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  return fts3InitVtab(0, db, pAux, argc, argv, ppVtab, pzErr);\n}\nstatic int fts3CreateMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pAux,                     /* Pointer to tokenizer hash table */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  return fts3InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr);\n}\n\n/*\n** Set the pIdxInfo->estimatedRows variable to nRow. Unless this\n** extension is currently being used by a version of SQLite too old to\n** support estimatedRows. In that case this function is a no-op.\n*/\nstatic void fts3SetEstimatedRows(sqlite3_index_info *pIdxInfo, i64 nRow){\n#if SQLITE_VERSION_NUMBER>=3008002\n  if( sqlite3_libversion_number()>=3008002 ){\n    pIdxInfo->estimatedRows = nRow;\n  }\n#endif\n}\n\n/*\n** Set the SQLITE_INDEX_SCAN_UNIQUE flag in pIdxInfo->flags. Unless this\n** extension is currently being used by a version of SQLite too old to\n** support index-info flags. In that case this function is a no-op.\n*/\nstatic void fts3SetUniqueFlag(sqlite3_index_info *pIdxInfo){\n#if SQLITE_VERSION_NUMBER>=3008012\n  if( sqlite3_libversion_number()>=3008012 ){\n    pIdxInfo->idxFlags |= SQLITE_INDEX_SCAN_UNIQUE;\n  }\n#endif\n}\n\n/* \n** Implementation of the xBestIndex method for FTS3 tables. There\n** are three possible strategies, in order of preference:\n**\n**   1. Direct lookup by rowid or docid. \n**   2. Full-text search using a MATCH operator on a non-docid column.\n**   3. Linear scan of %_content table.\n*/\nstatic int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){\n  Fts3Table *p = (Fts3Table *)pVTab;\n  int i;                          /* Iterator variable */\n  int iCons = -1;                 /* Index of constraint to use */\n\n  int iLangidCons = -1;           /* Index of langid=x constraint, if present */\n  int iDocidGe = -1;              /* Index of docid>=x constraint, if present */\n  int iDocidLe = -1;              /* Index of docid<=x constraint, if present */\n  int iIdx;\n\n  /* By default use a full table scan. This is an expensive option,\n  ** so search through the constraints to see if a more efficient \n  ** strategy is possible.\n  */\n  pInfo->idxNum = FTS3_FULLSCAN_SEARCH;\n  pInfo->estimatedCost = 5000000;\n  for(i=0; i<pInfo->nConstraint; i++){\n    int bDocid;                 /* True if this constraint is on docid */\n    struct sqlite3_index_constraint *pCons = &pInfo->aConstraint[i];\n    if( pCons->usable==0 ){\n      if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH ){\n        /* There exists an unusable MATCH constraint. This means that if\n        ** the planner does elect to use the results of this call as part\n        ** of the overall query plan the user will see an \"unable to use\n        ** function MATCH in the requested context\" error. To discourage\n        ** this, return a very high cost here.  */\n        pInfo->idxNum = FTS3_FULLSCAN_SEARCH;\n        pInfo->estimatedCost = 1e50;\n        fts3SetEstimatedRows(pInfo, ((sqlite3_int64)1) << 50);\n        return SQLITE_OK;\n      }\n      continue;\n    }\n\n    bDocid = (pCons->iColumn<0 || pCons->iColumn==p->nColumn+1);\n\n    /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */\n    if( iCons<0 && pCons->op==SQLITE_INDEX_CONSTRAINT_EQ && bDocid ){\n      pInfo->idxNum = FTS3_DOCID_SEARCH;\n      pInfo->estimatedCost = 1.0;\n      iCons = i;\n    }\n\n    /* A MATCH constraint. Use a full-text search.\n    **\n    ** If there is more than one MATCH constraint available, use the first\n    ** one encountered. If there is both a MATCH constraint and a direct\n    ** rowid/docid lookup, prefer the MATCH strategy. This is done even \n    ** though the rowid/docid lookup is faster than a MATCH query, selecting\n    ** it would lead to an \"unable to use function MATCH in the requested \n    ** context\" error.\n    */\n    if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH \n     && pCons->iColumn>=0 && pCons->iColumn<=p->nColumn\n    ){\n      pInfo->idxNum = FTS3_FULLTEXT_SEARCH + pCons->iColumn;\n      pInfo->estimatedCost = 2.0;\n      iCons = i;\n    }\n\n    /* Equality constraint on the langid column */\n    if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ \n     && pCons->iColumn==p->nColumn + 2\n    ){\n      iLangidCons = i;\n    }\n\n    if( bDocid ){\n      switch( pCons->op ){\n        case SQLITE_INDEX_CONSTRAINT_GE:\n        case SQLITE_INDEX_CONSTRAINT_GT:\n          iDocidGe = i;\n          break;\n\n        case SQLITE_INDEX_CONSTRAINT_LE:\n        case SQLITE_INDEX_CONSTRAINT_LT:\n          iDocidLe = i;\n          break;\n      }\n    }\n  }\n\n  /* If using a docid=? or rowid=? strategy, set the UNIQUE flag. */\n  if( pInfo->idxNum==FTS3_DOCID_SEARCH ) fts3SetUniqueFlag(pInfo);\n\n  iIdx = 1;\n  if( iCons>=0 ){\n    pInfo->aConstraintUsage[iCons].argvIndex = iIdx++;\n    pInfo->aConstraintUsage[iCons].omit = 1;\n  } \n  if( iLangidCons>=0 ){\n    pInfo->idxNum |= FTS3_HAVE_LANGID;\n    pInfo->aConstraintUsage[iLangidCons].argvIndex = iIdx++;\n  } \n  if( iDocidGe>=0 ){\n    pInfo->idxNum |= FTS3_HAVE_DOCID_GE;\n    pInfo->aConstraintUsage[iDocidGe].argvIndex = iIdx++;\n  } \n  if( iDocidLe>=0 ){\n    pInfo->idxNum |= FTS3_HAVE_DOCID_LE;\n    pInfo->aConstraintUsage[iDocidLe].argvIndex = iIdx++;\n  } \n\n  /* Regardless of the strategy selected, FTS can deliver rows in rowid (or\n  ** docid) order. Both ascending and descending are possible. \n  */\n  if( pInfo->nOrderBy==1 ){\n    struct sqlite3_index_orderby *pOrder = &pInfo->aOrderBy[0];\n    if( pOrder->iColumn<0 || pOrder->iColumn==p->nColumn+1 ){\n      if( pOrder->desc ){\n        pInfo->idxStr = \"DESC\";\n      }else{\n        pInfo->idxStr = \"ASC\";\n      }\n      pInfo->orderByConsumed = 1;\n    }\n  }\n\n  assert( p->pSegments==0 );\n  return SQLITE_OK;\n}\n\n/*\n** Implementation of xOpen method.\n*/\nstatic int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){\n  sqlite3_vtab_cursor *pCsr;               /* Allocated cursor */\n\n  UNUSED_PARAMETER(pVTab);\n\n  /* Allocate a buffer large enough for an Fts3Cursor structure. If the\n  ** allocation succeeds, zero it and return SQLITE_OK. Otherwise, \n  ** if the allocation fails, return SQLITE_NOMEM.\n  */\n  *ppCsr = pCsr = (sqlite3_vtab_cursor *)sqlite3_malloc(sizeof(Fts3Cursor));\n  if( !pCsr ){\n    return SQLITE_NOMEM;\n  }\n  memset(pCsr, 0, sizeof(Fts3Cursor));\n  return SQLITE_OK;\n}\n\n/*\n** Close the cursor.  For additional information see the documentation\n** on the xClose method of the virtual table interface.\n*/\nstatic int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){\n  Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\n  sqlite3_finalize(pCsr->pStmt);\n  sqlite3Fts3ExprFree(pCsr->pExpr);\n  sqlite3Fts3FreeDeferredTokens(pCsr);\n  sqlite3_free(pCsr->aDoclist);\n  sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\n/*\n** If pCsr->pStmt has not been prepared (i.e. if pCsr->pStmt==0), then\n** compose and prepare an SQL statement of the form:\n**\n**    \"SELECT <columns> FROM %_content WHERE rowid = ?\"\n**\n** (or the equivalent for a content=xxx table) and set pCsr->pStmt to\n** it. If an error occurs, return an SQLite error code.\n**\n** Otherwise, set *ppStmt to point to pCsr->pStmt and return SQLITE_OK.\n*/\nstatic int fts3CursorSeekStmt(Fts3Cursor *pCsr, sqlite3_stmt **ppStmt){\n  int rc = SQLITE_OK;\n  if( pCsr->pStmt==0 ){\n    Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;\n    char *zSql;\n    zSql = sqlite3_mprintf(\"SELECT %s WHERE rowid = ?\", p->zReadExprlist);\n    if( !zSql ) return SQLITE_NOMEM;\n    rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);\n    sqlite3_free(zSql);\n  }\n  *ppStmt = pCsr->pStmt;\n  return rc;\n}\n\n/*\n** Position the pCsr->pStmt statement so that it is on the row\n** of the %_content table that contains the last match.  Return\n** SQLITE_OK on success.  \n*/\nstatic int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){\n  int rc = SQLITE_OK;\n  if( pCsr->isRequireSeek ){\n    sqlite3_stmt *pStmt = 0;\n\n    rc = fts3CursorSeekStmt(pCsr, &pStmt);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId);\n      pCsr->isRequireSeek = 0;\n      if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){\n        return SQLITE_OK;\n      }else{\n        rc = sqlite3_reset(pCsr->pStmt);\n        if( rc==SQLITE_OK && ((Fts3Table *)pCsr->base.pVtab)->zContentTbl==0 ){\n          /* If no row was found and no error has occurred, then the %_content\n          ** table is missing a row that is present in the full-text index.\n          ** The data structures are corrupt.  */\n          rc = FTS_CORRUPT_VTAB;\n          pCsr->isEof = 1;\n        }\n      }\n    }\n  }\n\n  if( rc!=SQLITE_OK && pContext ){\n    sqlite3_result_error_code(pContext, rc);\n  }\n  return rc;\n}\n\n/*\n** This function is used to process a single interior node when searching\n** a b-tree for a term or term prefix. The node data is passed to this \n** function via the zNode/nNode parameters. The term to search for is\n** passed in zTerm/nTerm.\n**\n** If piFirst is not NULL, then this function sets *piFirst to the blockid\n** of the child node that heads the sub-tree that may contain the term.\n**\n** If piLast is not NULL, then *piLast is set to the right-most child node\n** that heads a sub-tree that may contain a term for which zTerm/nTerm is\n** a prefix.\n**\n** If an OOM error occurs, SQLITE_NOMEM is returned. Otherwise, SQLITE_OK.\n*/\nstatic int fts3ScanInteriorNode(\n  const char *zTerm,              /* Term to select leaves for */\n  int nTerm,                      /* Size of term zTerm in bytes */\n  const char *zNode,              /* Buffer containing segment interior node */\n  int nNode,                      /* Size of buffer at zNode */\n  sqlite3_int64 *piFirst,         /* OUT: Selected child node */\n  sqlite3_int64 *piLast           /* OUT: Selected child node */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  const char *zCsr = zNode;       /* Cursor to iterate through node */\n  const char *zEnd = &zCsr[nNode];/* End of interior node buffer */\n  char *zBuffer = 0;              /* Buffer to load terms into */\n  int nAlloc = 0;                 /* Size of allocated buffer */\n  int isFirstTerm = 1;            /* True when processing first term on page */\n  sqlite3_int64 iChild;           /* Block id of child node to descend to */\n\n  /* Skip over the 'height' varint that occurs at the start of every \n  ** interior node. Then load the blockid of the left-child of the b-tree\n  ** node into variable iChild.  \n  **\n  ** Even if the data structure on disk is corrupted, this (reading two\n  ** varints from the buffer) does not risk an overread. If zNode is a\n  ** root node, then the buffer comes from a SELECT statement. SQLite does\n  ** not make this guarantee explicitly, but in practice there are always\n  ** either more than 20 bytes of allocated space following the nNode bytes of\n  ** contents, or two zero bytes. Or, if the node is read from the %_segments\n  ** table, then there are always 20 bytes of zeroed padding following the\n  ** nNode bytes of content (see sqlite3Fts3ReadBlock() for details).\n  */\n  zCsr += sqlite3Fts3GetVarint(zCsr, &iChild);\n  zCsr += sqlite3Fts3GetVarint(zCsr, &iChild);\n  if( zCsr>zEnd ){\n    return FTS_CORRUPT_VTAB;\n  }\n  \n  while( zCsr<zEnd && (piFirst || piLast) ){\n    int cmp;                      /* memcmp() result */\n    int nSuffix;                  /* Size of term suffix */\n    int nPrefix = 0;              /* Size of term prefix */\n    int nBuffer;                  /* Total term size */\n  \n    /* Load the next term on the node into zBuffer. Use realloc() to expand\n    ** the size of zBuffer if required.  */\n    if( !isFirstTerm ){\n      zCsr += fts3GetVarint32(zCsr, &nPrefix);\n    }\n    isFirstTerm = 0;\n    zCsr += fts3GetVarint32(zCsr, &nSuffix);\n    \n    if( nPrefix<0 || nSuffix<0 || &zCsr[nSuffix]>zEnd ){\n      rc = FTS_CORRUPT_VTAB;\n      goto finish_scan;\n    }\n    if( nPrefix+nSuffix>nAlloc ){\n      char *zNew;\n      nAlloc = (nPrefix+nSuffix) * 2;\n      zNew = (char *)sqlite3_realloc(zBuffer, nAlloc);\n      if( !zNew ){\n        rc = SQLITE_NOMEM;\n        goto finish_scan;\n      }\n      zBuffer = zNew;\n    }\n    assert( zBuffer );\n    memcpy(&zBuffer[nPrefix], zCsr, nSuffix);\n    nBuffer = nPrefix + nSuffix;\n    zCsr += nSuffix;\n\n    /* Compare the term we are searching for with the term just loaded from\n    ** the interior node. If the specified term is greater than or equal\n    ** to the term from the interior node, then all terms on the sub-tree \n    ** headed by node iChild are smaller than zTerm. No need to search \n    ** iChild.\n    **\n    ** If the interior node term is larger than the specified term, then\n    ** the tree headed by iChild may contain the specified term.\n    */\n    cmp = memcmp(zTerm, zBuffer, (nBuffer>nTerm ? nTerm : nBuffer));\n    if( piFirst && (cmp<0 || (cmp==0 && nBuffer>nTerm)) ){\n      *piFirst = iChild;\n      piFirst = 0;\n    }\n\n    if( piLast && cmp<0 ){\n      *piLast = iChild;\n      piLast = 0;\n    }\n\n    iChild++;\n  };\n\n  if( piFirst ) *piFirst = iChild;\n  if( piLast ) *piLast = iChild;\n\n finish_scan:\n  sqlite3_free(zBuffer);\n  return rc;\n}\n\n\n/*\n** The buffer pointed to by argument zNode (size nNode bytes) contains an\n** interior node of a b-tree segment. The zTerm buffer (size nTerm bytes)\n** contains a term. This function searches the sub-tree headed by the zNode\n** node for the range of leaf nodes that may contain the specified term\n** or terms for which the specified term is a prefix.\n**\n** If piLeaf is not NULL, then *piLeaf is set to the blockid of the \n** left-most leaf node in the tree that may contain the specified term.\n** If piLeaf2 is not NULL, then *piLeaf2 is set to the blockid of the\n** right-most leaf node that may contain a term for which the specified\n** term is a prefix.\n**\n** It is possible that the range of returned leaf nodes does not contain \n** the specified term or any terms for which it is a prefix. However, if the \n** segment does contain any such terms, they are stored within the identified\n** range. Because this function only inspects interior segment nodes (and\n** never loads leaf nodes into memory), it is not possible to be sure.\n**\n** If an error occurs, an error code other than SQLITE_OK is returned.\n*/ \nstatic int fts3SelectLeaf(\n  Fts3Table *p,                   /* Virtual table handle */\n  const char *zTerm,              /* Term to select leaves for */\n  int nTerm,                      /* Size of term zTerm in bytes */\n  const char *zNode,              /* Buffer containing segment interior node */\n  int nNode,                      /* Size of buffer at zNode */\n  sqlite3_int64 *piLeaf,          /* Selected leaf node */\n  sqlite3_int64 *piLeaf2          /* Selected leaf node */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  int iHeight;                    /* Height of this node in tree */\n\n  assert( piLeaf || piLeaf2 );\n\n  fts3GetVarint32(zNode, &iHeight);\n  rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2);\n  assert( !piLeaf2 || !piLeaf || rc!=SQLITE_OK || (*piLeaf<=*piLeaf2) );\n\n  if( rc==SQLITE_OK && iHeight>1 ){\n    char *zBlob = 0;              /* Blob read from %_segments table */\n    int nBlob = 0;                /* Size of zBlob in bytes */\n\n    if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){\n      rc = sqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0);\n      if( rc==SQLITE_OK ){\n        rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, 0);\n      }\n      sqlite3_free(zBlob);\n      piLeaf = 0;\n      zBlob = 0;\n    }\n\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts3ReadBlock(p, piLeaf?*piLeaf:*piLeaf2, &zBlob, &nBlob, 0);\n    }\n    if( rc==SQLITE_OK ){\n      rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, piLeaf2);\n    }\n    sqlite3_free(zBlob);\n  }\n\n  return rc;\n}\n\n/*\n** This function is used to create delta-encoded serialized lists of FTS3 \n** varints. Each call to this function appends a single varint to a list.\n*/\nstatic void fts3PutDeltaVarint(\n  char **pp,                      /* IN/OUT: Output pointer */\n  sqlite3_int64 *piPrev,          /* IN/OUT: Previous value written to list */\n  sqlite3_int64 iVal              /* Write this value to the list */\n){\n  assert( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) );\n  *pp += sqlite3Fts3PutVarint(*pp, iVal-*piPrev);\n  *piPrev = iVal;\n}\n\n/*\n** When this function is called, *ppPoslist is assumed to point to the \n** start of a position-list. After it returns, *ppPoslist points to the\n** first byte after the position-list.\n**\n** A position list is list of positions (delta encoded) and columns for \n** a single document record of a doclist.  So, in other words, this\n** routine advances *ppPoslist so that it points to the next docid in\n** the doclist, or to the first byte past the end of the doclist.\n**\n** If pp is not NULL, then the contents of the position list are copied\n** to *pp. *pp is set to point to the first byte past the last byte copied\n** before this function returns.\n*/\nstatic void fts3PoslistCopy(char **pp, char **ppPoslist){\n  char *pEnd = *ppPoslist;\n  char c = 0;\n\n  /* The end of a position list is marked by a zero encoded as an FTS3 \n  ** varint. A single POS_END (0) byte. Except, if the 0 byte is preceded by\n  ** a byte with the 0x80 bit set, then it is not a varint 0, but the tail\n  ** of some other, multi-byte, value.\n  **\n  ** The following while-loop moves pEnd to point to the first byte that is not \n  ** immediately preceded by a byte with the 0x80 bit set. Then increments\n  ** pEnd once more so that it points to the byte immediately following the\n  ** last byte in the position-list.\n  */\n  while( *pEnd | c ){\n    c = *pEnd++ & 0x80;\n    testcase( c!=0 && (*pEnd)==0 );\n  }\n  pEnd++;  /* Advance past the POS_END terminator byte */\n\n  if( pp ){\n    int n = (int)(pEnd - *ppPoslist);\n    char *p = *pp;\n    memcpy(p, *ppPoslist, n);\n    p += n;\n    *pp = p;\n  }\n  *ppPoslist = pEnd;\n}\n\n/*\n** When this function is called, *ppPoslist is assumed to point to the \n** start of a column-list. After it returns, *ppPoslist points to the\n** to the terminator (POS_COLUMN or POS_END) byte of the column-list.\n**\n** A column-list is list of delta-encoded positions for a single column\n** within a single document within a doclist.\n**\n** The column-list is terminated either by a POS_COLUMN varint (1) or\n** a POS_END varint (0).  This routine leaves *ppPoslist pointing to\n** the POS_COLUMN or POS_END that terminates the column-list.\n**\n** If pp is not NULL, then the contents of the column-list are copied\n** to *pp. *pp is set to point to the first byte past the last byte copied\n** before this function returns.  The POS_COLUMN or POS_END terminator\n** is not copied into *pp.\n*/\nstatic void fts3ColumnlistCopy(char **pp, char **ppPoslist){\n  char *pEnd = *ppPoslist;\n  char c = 0;\n\n  /* A column-list is terminated by either a 0x01 or 0x00 byte that is\n  ** not part of a multi-byte varint.\n  */\n  while( 0xFE & (*pEnd | c) ){\n    c = *pEnd++ & 0x80;\n    testcase( c!=0 && ((*pEnd)&0xfe)==0 );\n  }\n  if( pp ){\n    int n = (int)(pEnd - *ppPoslist);\n    char *p = *pp;\n    memcpy(p, *ppPoslist, n);\n    p += n;\n    *pp = p;\n  }\n  *ppPoslist = pEnd;\n}\n\n/*\n** Value used to signify the end of an position-list. This is safe because\n** it is not possible to have a document with 2^31 terms.\n*/\n#define POSITION_LIST_END 0x7fffffff\n\n/*\n** This function is used to help parse position-lists. When this function is\n** called, *pp may point to the start of the next varint in the position-list\n** being parsed, or it may point to 1 byte past the end of the position-list\n** (in which case **pp will be a terminator bytes POS_END (0) or\n** (1)).\n**\n** If *pp points past the end of the current position-list, set *pi to \n** POSITION_LIST_END and return. Otherwise, read the next varint from *pp,\n** increment the current value of *pi by the value read, and set *pp to\n** point to the next value before returning.\n**\n** Before calling this routine *pi must be initialized to the value of\n** the previous position, or zero if we are reading the first position\n** in the position-list.  Because positions are delta-encoded, the value\n** of the previous position is needed in order to compute the value of\n** the next position.\n*/\nstatic void fts3ReadNextPos(\n  char **pp,                    /* IN/OUT: Pointer into position-list buffer */\n  sqlite3_int64 *pi             /* IN/OUT: Value read from position-list */\n){\n  if( (**pp)&0xFE ){\n    fts3GetDeltaVarint(pp, pi);\n    *pi -= 2;\n  }else{\n    *pi = POSITION_LIST_END;\n  }\n}\n\n/*\n** If parameter iCol is not 0, write an POS_COLUMN (1) byte followed by\n** the value of iCol encoded as a varint to *pp.   This will start a new\n** column list.\n**\n** Set *pp to point to the byte just after the last byte written before \n** returning (do not modify it if iCol==0). Return the total number of bytes\n** written (0 if iCol==0).\n*/\nstatic int fts3PutColNumber(char **pp, int iCol){\n  int n = 0;                      /* Number of bytes written */\n  if( iCol ){\n    char *p = *pp;                /* Output pointer */\n    n = 1 + sqlite3Fts3PutVarint(&p[1], iCol);\n    *p = 0x01;\n    *pp = &p[n];\n  }\n  return n;\n}\n\n/*\n** Compute the union of two position lists.  The output written\n** into *pp contains all positions of both *pp1 and *pp2 in sorted\n** order and with any duplicates removed.  All pointers are\n** updated appropriately.   The caller is responsible for insuring\n** that there is enough space in *pp to hold the complete output.\n*/\nstatic void fts3PoslistMerge(\n  char **pp,                      /* Output buffer */\n  char **pp1,                     /* Left input list */\n  char **pp2                      /* Right input list */\n){\n  char *p = *pp;\n  char *p1 = *pp1;\n  char *p2 = *pp2;\n\n  while( *p1 || *p2 ){\n    int iCol1;         /* The current column index in pp1 */\n    int iCol2;         /* The current column index in pp2 */\n\n    if( *p1==POS_COLUMN ) fts3GetVarint32(&p1[1], &iCol1);\n    else if( *p1==POS_END ) iCol1 = POSITION_LIST_END;\n    else iCol1 = 0;\n\n    if( *p2==POS_COLUMN ) fts3GetVarint32(&p2[1], &iCol2);\n    else if( *p2==POS_END ) iCol2 = POSITION_LIST_END;\n    else iCol2 = 0;\n\n    if( iCol1==iCol2 ){\n      sqlite3_int64 i1 = 0;       /* Last position from pp1 */\n      sqlite3_int64 i2 = 0;       /* Last position from pp2 */\n      sqlite3_int64 iPrev = 0;\n      int n = fts3PutColNumber(&p, iCol1);\n      p1 += n;\n      p2 += n;\n\n      /* At this point, both p1 and p2 point to the start of column-lists\n      ** for the same column (the column with index iCol1 and iCol2).\n      ** A column-list is a list of non-negative delta-encoded varints, each \n      ** incremented by 2 before being stored. Each list is terminated by a\n      ** POS_END (0) or POS_COLUMN (1). The following block merges the two lists\n      ** and writes the results to buffer p. p is left pointing to the byte\n      ** after the list written. No terminator (POS_END or POS_COLUMN) is\n      ** written to the output.\n      */\n      fts3GetDeltaVarint(&p1, &i1);\n      fts3GetDeltaVarint(&p2, &i2);\n      do {\n        fts3PutDeltaVarint(&p, &iPrev, (i1<i2) ? i1 : i2); \n        iPrev -= 2;\n        if( i1==i2 ){\n          fts3ReadNextPos(&p1, &i1);\n          fts3ReadNextPos(&p2, &i2);\n        }else if( i1<i2 ){\n          fts3ReadNextPos(&p1, &i1);\n        }else{\n          fts3ReadNextPos(&p2, &i2);\n        }\n      }while( i1!=POSITION_LIST_END || i2!=POSITION_LIST_END );\n    }else if( iCol1<iCol2 ){\n      p1 += fts3PutColNumber(&p, iCol1);\n      fts3ColumnlistCopy(&p, &p1);\n    }else{\n      p2 += fts3PutColNumber(&p, iCol2);\n      fts3ColumnlistCopy(&p, &p2);\n    }\n  }\n\n  *p++ = POS_END;\n  *pp = p;\n  *pp1 = p1 + 1;\n  *pp2 = p2 + 1;\n}\n\n/*\n** This function is used to merge two position lists into one. When it is\n** called, *pp1 and *pp2 must both point to position lists. A position-list is\n** the part of a doclist that follows each document id. For example, if a row\n** contains:\n**\n**     'a b c'|'x y z'|'a b b a'\n**\n** Then the position list for this row for token 'b' would consist of:\n**\n**     0x02 0x01 0x02 0x03 0x03 0x00\n**\n** When this function returns, both *pp1 and *pp2 are left pointing to the\n** byte following the 0x00 terminator of their respective position lists.\n**\n** If isSaveLeft is 0, an entry is added to the output position list for \n** each position in *pp2 for which there exists one or more positions in\n** *pp1 so that (pos(*pp2)>pos(*pp1) && pos(*pp2)-pos(*pp1)<=nToken). i.e.\n** when the *pp1 token appears before the *pp2 token, but not more than nToken\n** slots before it.\n**\n** e.g. nToken==1 searches for adjacent positions.\n*/\nstatic int fts3PoslistPhraseMerge(\n  char **pp,                      /* IN/OUT: Preallocated output buffer */\n  int nToken,                     /* Maximum difference in token positions */\n  int isSaveLeft,                 /* Save the left position */\n  int isExact,                    /* If *pp1 is exactly nTokens before *pp2 */\n  char **pp1,                     /* IN/OUT: Left input list */\n  char **pp2                      /* IN/OUT: Right input list */\n){\n  char *p = *pp;\n  char *p1 = *pp1;\n  char *p2 = *pp2;\n  int iCol1 = 0;\n  int iCol2 = 0;\n\n  /* Never set both isSaveLeft and isExact for the same invocation. */\n  assert( isSaveLeft==0 || isExact==0 );\n\n  assert( p!=0 && *p1!=0 && *p2!=0 );\n  if( *p1==POS_COLUMN ){ \n    p1++;\n    p1 += fts3GetVarint32(p1, &iCol1);\n  }\n  if( *p2==POS_COLUMN ){ \n    p2++;\n    p2 += fts3GetVarint32(p2, &iCol2);\n  }\n\n  while( 1 ){\n    if( iCol1==iCol2 ){\n      char *pSave = p;\n      sqlite3_int64 iPrev = 0;\n      sqlite3_int64 iPos1 = 0;\n      sqlite3_int64 iPos2 = 0;\n\n      if( iCol1 ){\n        *p++ = POS_COLUMN;\n        p += sqlite3Fts3PutVarint(p, iCol1);\n      }\n\n      assert( *p1!=POS_END && *p1!=POS_COLUMN );\n      assert( *p2!=POS_END && *p2!=POS_COLUMN );\n      fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2;\n      fts3GetDeltaVarint(&p2, &iPos2); iPos2 -= 2;\n\n      while( 1 ){\n        if( iPos2==iPos1+nToken \n         || (isExact==0 && iPos2>iPos1 && iPos2<=iPos1+nToken) \n        ){\n          sqlite3_int64 iSave;\n          iSave = isSaveLeft ? iPos1 : iPos2;\n          fts3PutDeltaVarint(&p, &iPrev, iSave+2); iPrev -= 2;\n          pSave = 0;\n          assert( p );\n        }\n        if( (!isSaveLeft && iPos2<=(iPos1+nToken)) || iPos2<=iPos1 ){\n          if( (*p2&0xFE)==0 ) break;\n          fts3GetDeltaVarint(&p2, &iPos2); iPos2 -= 2;\n        }else{\n          if( (*p1&0xFE)==0 ) break;\n          fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2;\n        }\n      }\n\n      if( pSave ){\n        assert( pp && p );\n        p = pSave;\n      }\n\n      fts3ColumnlistCopy(0, &p1);\n      fts3ColumnlistCopy(0, &p2);\n      assert( (*p1&0xFE)==0 && (*p2&0xFE)==0 );\n      if( 0==*p1 || 0==*p2 ) break;\n\n      p1++;\n      p1 += fts3GetVarint32(p1, &iCol1);\n      p2++;\n      p2 += fts3GetVarint32(p2, &iCol2);\n    }\n\n    /* Advance pointer p1 or p2 (whichever corresponds to the smaller of\n    ** iCol1 and iCol2) so that it points to either the 0x00 that marks the\n    ** end of the position list, or the 0x01 that precedes the next \n    ** column-number in the position list. \n    */\n    else if( iCol1<iCol2 ){\n      fts3ColumnlistCopy(0, &p1);\n      if( 0==*p1 ) break;\n      p1++;\n      p1 += fts3GetVarint32(p1, &iCol1);\n    }else{\n      fts3ColumnlistCopy(0, &p2);\n      if( 0==*p2 ) break;\n      p2++;\n      p2 += fts3GetVarint32(p2, &iCol2);\n    }\n  }\n\n  fts3PoslistCopy(0, &p2);\n  fts3PoslistCopy(0, &p1);\n  *pp1 = p1;\n  *pp2 = p2;\n  if( *pp==p ){\n    return 0;\n  }\n  *p++ = 0x00;\n  *pp = p;\n  return 1;\n}\n\n/*\n** Merge two position-lists as required by the NEAR operator. The argument\n** position lists correspond to the left and right phrases of an expression \n** like:\n**\n**     \"phrase 1\" NEAR \"phrase number 2\"\n**\n** Position list *pp1 corresponds to the left-hand side of the NEAR \n** expression and *pp2 to the right. As usual, the indexes in the position \n** lists are the offsets of the last token in each phrase (tokens \"1\" and \"2\" \n** in the example above).\n**\n** The output position list - written to *pp - is a copy of *pp2 with those\n** entries that are not sufficiently NEAR entries in *pp1 removed.\n*/\nstatic int fts3PoslistNearMerge(\n  char **pp,                      /* Output buffer */\n  char *aTmp,                     /* Temporary buffer space */\n  int nRight,                     /* Maximum difference in token positions */\n  int nLeft,                      /* Maximum difference in token positions */\n  char **pp1,                     /* IN/OUT: Left input list */\n  char **pp2                      /* IN/OUT: Right input list */\n){\n  char *p1 = *pp1;\n  char *p2 = *pp2;\n\n  char *pTmp1 = aTmp;\n  char *pTmp2;\n  char *aTmp2;\n  int res = 1;\n\n  fts3PoslistPhraseMerge(&pTmp1, nRight, 0, 0, pp1, pp2);\n  aTmp2 = pTmp2 = pTmp1;\n  *pp1 = p1;\n  *pp2 = p2;\n  fts3PoslistPhraseMerge(&pTmp2, nLeft, 1, 0, pp2, pp1);\n  if( pTmp1!=aTmp && pTmp2!=aTmp2 ){\n    fts3PoslistMerge(pp, &aTmp, &aTmp2);\n  }else if( pTmp1!=aTmp ){\n    fts3PoslistCopy(pp, &aTmp);\n  }else if( pTmp2!=aTmp2 ){\n    fts3PoslistCopy(pp, &aTmp2);\n  }else{\n    res = 0;\n  }\n\n  return res;\n}\n\n/* \n** An instance of this function is used to merge together the (potentially\n** large number of) doclists for each term that matches a prefix query.\n** See function fts3TermSelectMerge() for details.\n*/\ntypedef struct TermSelect TermSelect;\nstruct TermSelect {\n  char *aaOutput[16];             /* Malloc'd output buffers */\n  int anOutput[16];               /* Size each output buffer in bytes */\n};\n\n/*\n** This function is used to read a single varint from a buffer. Parameter\n** pEnd points 1 byte past the end of the buffer. When this function is\n** called, if *pp points to pEnd or greater, then the end of the buffer\n** has been reached. In this case *pp is set to 0 and the function returns.\n**\n** If *pp does not point to or past pEnd, then a single varint is read\n** from *pp. *pp is then set to point 1 byte past the end of the read varint.\n**\n** If bDescIdx is false, the value read is added to *pVal before returning.\n** If it is true, the value read is subtracted from *pVal before this \n** function returns.\n*/\nstatic void fts3GetDeltaVarint3(\n  char **pp,                      /* IN/OUT: Point to read varint from */\n  char *pEnd,                     /* End of buffer */\n  int bDescIdx,                   /* True if docids are descending */\n  sqlite3_int64 *pVal             /* IN/OUT: Integer value */\n){\n  if( *pp>=pEnd ){\n    *pp = 0;\n  }else{\n    sqlite3_int64 iVal;\n    *pp += sqlite3Fts3GetVarint(*pp, &iVal);\n    if( bDescIdx ){\n      *pVal -= iVal;\n    }else{\n      *pVal += iVal;\n    }\n  }\n}\n\n/*\n** This function is used to write a single varint to a buffer. The varint\n** is written to *pp. Before returning, *pp is set to point 1 byte past the\n** end of the value written.\n**\n** If *pbFirst is zero when this function is called, the value written to\n** the buffer is that of parameter iVal. \n**\n** If *pbFirst is non-zero when this function is called, then the value \n** written is either (iVal-*piPrev) (if bDescIdx is zero) or (*piPrev-iVal)\n** (if bDescIdx is non-zero).\n**\n** Before returning, this function always sets *pbFirst to 1 and *piPrev\n** to the value of parameter iVal.\n*/\nstatic void fts3PutDeltaVarint3(\n  char **pp,                      /* IN/OUT: Output pointer */\n  int bDescIdx,                   /* True for descending docids */\n  sqlite3_int64 *piPrev,          /* IN/OUT: Previous value written to list */\n  int *pbFirst,                   /* IN/OUT: True after first int written */\n  sqlite3_int64 iVal              /* Write this value to the list */\n){\n  sqlite3_int64 iWrite;\n  if( bDescIdx==0 || *pbFirst==0 ){\n    iWrite = iVal - *piPrev;\n  }else{\n    iWrite = *piPrev - iVal;\n  }\n  assert( *pbFirst || *piPrev==0 );\n  assert( *pbFirst==0 || iWrite>0 );\n  *pp += sqlite3Fts3PutVarint(*pp, iWrite);\n  *piPrev = iVal;\n  *pbFirst = 1;\n}\n\n\n/*\n** This macro is used by various functions that merge doclists. The two\n** arguments are 64-bit docid values. If the value of the stack variable\n** bDescDoclist is 0 when this macro is invoked, then it returns (i1-i2). \n** Otherwise, (i2-i1).\n**\n** Using this makes it easier to write code that can merge doclists that are\n** sorted in either ascending or descending order.\n*/\n#define DOCID_CMP(i1, i2) ((bDescDoclist?-1:1) * (i1-i2))\n\n/*\n** This function does an \"OR\" merge of two doclists (output contains all\n** positions contained in either argument doclist). If the docids in the \n** input doclists are sorted in ascending order, parameter bDescDoclist\n** should be false. If they are sorted in ascending order, it should be\n** passed a non-zero value.\n**\n** If no error occurs, *paOut is set to point at an sqlite3_malloc'd buffer\n** containing the output doclist and SQLITE_OK is returned. In this case\n** *pnOut is set to the number of bytes in the output doclist.\n**\n** If an error occurs, an SQLite error code is returned. The output values\n** are undefined in this case.\n*/\nstatic int fts3DoclistOrMerge(\n  int bDescDoclist,               /* True if arguments are desc */\n  char *a1, int n1,               /* First doclist */\n  char *a2, int n2,               /* Second doclist */\n  char **paOut, int *pnOut        /* OUT: Malloc'd doclist */\n){\n  sqlite3_int64 i1 = 0;\n  sqlite3_int64 i2 = 0;\n  sqlite3_int64 iPrev = 0;\n  char *pEnd1 = &a1[n1];\n  char *pEnd2 = &a2[n2];\n  char *p1 = a1;\n  char *p2 = a2;\n  char *p;\n  char *aOut;\n  int bFirstOut = 0;\n\n  *paOut = 0;\n  *pnOut = 0;\n\n  /* Allocate space for the output. Both the input and output doclists\n  ** are delta encoded. If they are in ascending order (bDescDoclist==0),\n  ** then the first docid in each list is simply encoded as a varint. For\n  ** each subsequent docid, the varint stored is the difference between the\n  ** current and previous docid (a positive number - since the list is in\n  ** ascending order).\n  **\n  ** The first docid written to the output is therefore encoded using the \n  ** same number of bytes as it is in whichever of the input lists it is\n  ** read from. And each subsequent docid read from the same input list \n  ** consumes either the same or less bytes as it did in the input (since\n  ** the difference between it and the previous value in the output must\n  ** be a positive value less than or equal to the delta value read from \n  ** the input list). The same argument applies to all but the first docid\n  ** read from the 'other' list. And to the contents of all position lists\n  ** that will be copied and merged from the input to the output.\n  **\n  ** However, if the first docid copied to the output is a negative number,\n  ** then the encoding of the first docid from the 'other' input list may\n  ** be larger in the output than it was in the input (since the delta value\n  ** may be a larger positive integer than the actual docid).\n  **\n  ** The space required to store the output is therefore the sum of the\n  ** sizes of the two inputs, plus enough space for exactly one of the input\n  ** docids to grow. \n  **\n  ** A symetric argument may be made if the doclists are in descending \n  ** order.\n  */\n  aOut = sqlite3_malloc(n1+n2+FTS3_VARINT_MAX-1);\n  if( !aOut ) return SQLITE_NOMEM;\n\n  p = aOut;\n  fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1);\n  fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2);\n  while( p1 || p2 ){\n    sqlite3_int64 iDiff = DOCID_CMP(i1, i2);\n\n    if( p2 && p1 && iDiff==0 ){\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1);\n      fts3PoslistMerge(&p, &p1, &p2);\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\n    }else if( !p2 || (p1 && iDiff<0) ){\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1);\n      fts3PoslistCopy(&p, &p1);\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\n    }else{\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i2);\n      fts3PoslistCopy(&p, &p2);\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\n    }\n  }\n\n  *paOut = aOut;\n  *pnOut = (int)(p-aOut);\n  assert( *pnOut<=n1+n2+FTS3_VARINT_MAX-1 );\n  return SQLITE_OK;\n}\n\n/*\n** This function does a \"phrase\" merge of two doclists. In a phrase merge,\n** the output contains a copy of each position from the right-hand input\n** doclist for which there is a position in the left-hand input doclist\n** exactly nDist tokens before it.\n**\n** If the docids in the input doclists are sorted in ascending order,\n** parameter bDescDoclist should be false. If they are sorted in ascending \n** order, it should be passed a non-zero value.\n**\n** The right-hand input doclist is overwritten by this function.\n*/\nstatic int fts3DoclistPhraseMerge(\n  int bDescDoclist,               /* True if arguments are desc */\n  int nDist,                      /* Distance from left to right (1=adjacent) */\n  char *aLeft, int nLeft,         /* Left doclist */\n  char **paRight, int *pnRight    /* IN/OUT: Right/output doclist */\n){\n  sqlite3_int64 i1 = 0;\n  sqlite3_int64 i2 = 0;\n  sqlite3_int64 iPrev = 0;\n  char *aRight = *paRight;\n  char *pEnd1 = &aLeft[nLeft];\n  char *pEnd2 = &aRight[*pnRight];\n  char *p1 = aLeft;\n  char *p2 = aRight;\n  char *p;\n  int bFirstOut = 0;\n  char *aOut;\n\n  assert( nDist>0 );\n  if( bDescDoclist ){\n    aOut = sqlite3_malloc(*pnRight + FTS3_VARINT_MAX);\n    if( aOut==0 ) return SQLITE_NOMEM;\n  }else{\n    aOut = aRight;\n  }\n  p = aOut;\n\n  fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1);\n  fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2);\n\n  while( p1 && p2 ){\n    sqlite3_int64 iDiff = DOCID_CMP(i1, i2);\n    if( iDiff==0 ){\n      char *pSave = p;\n      sqlite3_int64 iPrevSave = iPrev;\n      int bFirstOutSave = bFirstOut;\n\n      fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1);\n      if( 0==fts3PoslistPhraseMerge(&p, nDist, 0, 1, &p1, &p2) ){\n        p = pSave;\n        iPrev = iPrevSave;\n        bFirstOut = bFirstOutSave;\n      }\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\n    }else if( iDiff<0 ){\n      fts3PoslistCopy(0, &p1);\n      fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1);\n    }else{\n      fts3PoslistCopy(0, &p2);\n      fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2);\n    }\n  }\n\n  *pnRight = (int)(p - aOut);\n  if( bDescDoclist ){\n    sqlite3_free(aRight);\n    *paRight = aOut;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Argument pList points to a position list nList bytes in size. This\n** function checks to see if the position list contains any entries for\n** a token in position 0 (of any column). If so, it writes argument iDelta\n** to the output buffer pOut, followed by a position list consisting only\n** of the entries from pList at position 0, and terminated by an 0x00 byte.\n** The value returned is the number of bytes written to pOut (if any).\n*/\nint sqlite3Fts3FirstFilter(\n  sqlite3_int64 iDelta,           /* Varint that may be written to pOut */\n  char *pList,                    /* Position list (no 0x00 term) */\n  int nList,                      /* Size of pList in bytes */\n  char *pOut                      /* Write output here */\n){\n  int nOut = 0;\n  int bWritten = 0;               /* True once iDelta has been written */\n  char *p = pList;\n  char *pEnd = &pList[nList];\n\n  if( *p!=0x01 ){\n    if( *p==0x02 ){\n      nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta);\n      pOut[nOut++] = 0x02;\n      bWritten = 1;\n    }\n    fts3ColumnlistCopy(0, &p);\n  }\n\n  while( p<pEnd && *p==0x01 ){\n    sqlite3_int64 iCol;\n    p++;\n    p += sqlite3Fts3GetVarint(p, &iCol);\n    if( *p==0x02 ){\n      if( bWritten==0 ){\n        nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta);\n        bWritten = 1;\n      }\n      pOut[nOut++] = 0x01;\n      nOut += sqlite3Fts3PutVarint(&pOut[nOut], iCol);\n      pOut[nOut++] = 0x02;\n    }\n    fts3ColumnlistCopy(0, &p);\n  }\n  if( bWritten ){\n    pOut[nOut++] = 0x00;\n  }\n\n  return nOut;\n}\n\n\n/*\n** Merge all doclists in the TermSelect.aaOutput[] array into a single\n** doclist stored in TermSelect.aaOutput[0]. If successful, delete all\n** other doclists (except the aaOutput[0] one) and return SQLITE_OK.\n**\n** If an OOM error occurs, return SQLITE_NOMEM. In this case it is\n** the responsibility of the caller to free any doclists left in the\n** TermSelect.aaOutput[] array.\n*/\nstatic int fts3TermSelectFinishMerge(Fts3Table *p, TermSelect *pTS){\n  char *aOut = 0;\n  int nOut = 0;\n  int i;\n\n  /* Loop through the doclists in the aaOutput[] array. Merge them all\n  ** into a single doclist.\n  */\n  for(i=0; i<SizeofArray(pTS->aaOutput); i++){\n    if( pTS->aaOutput[i] ){\n      if( !aOut ){\n        aOut = pTS->aaOutput[i];\n        nOut = pTS->anOutput[i];\n        pTS->aaOutput[i] = 0;\n      }else{\n        int nNew;\n        char *aNew;\n\n        int rc = fts3DoclistOrMerge(p->bDescIdx, \n            pTS->aaOutput[i], pTS->anOutput[i], aOut, nOut, &aNew, &nNew\n        );\n        if( rc!=SQLITE_OK ){\n          sqlite3_free(aOut);\n          return rc;\n        }\n\n        sqlite3_free(pTS->aaOutput[i]);\n        sqlite3_free(aOut);\n        pTS->aaOutput[i] = 0;\n        aOut = aNew;\n        nOut = nNew;\n      }\n    }\n  }\n\n  pTS->aaOutput[0] = aOut;\n  pTS->anOutput[0] = nOut;\n  return SQLITE_OK;\n}\n\n/*\n** Merge the doclist aDoclist/nDoclist into the TermSelect object passed\n** as the first argument. The merge is an \"OR\" merge (see function\n** fts3DoclistOrMerge() for details).\n**\n** This function is called with the doclist for each term that matches\n** a queried prefix. It merges all these doclists into one, the doclist\n** for the specified prefix. Since there can be a very large number of\n** doclists to merge, the merging is done pair-wise using the TermSelect\n** object.\n**\n** This function returns SQLITE_OK if the merge is successful, or an\n** SQLite error code (SQLITE_NOMEM) if an error occurs.\n*/\nstatic int fts3TermSelectMerge(\n  Fts3Table *p,                   /* FTS table handle */\n  TermSelect *pTS,                /* TermSelect object to merge into */\n  char *aDoclist,                 /* Pointer to doclist */\n  int nDoclist                    /* Size of aDoclist in bytes */\n){\n  if( pTS->aaOutput[0]==0 ){\n    /* If this is the first term selected, copy the doclist to the output\n    ** buffer using memcpy(). \n    **\n    ** Add FTS3_VARINT_MAX bytes of unused space to the end of the \n    ** allocation. This is so as to ensure that the buffer is big enough\n    ** to hold the current doclist AND'd with any other doclist. If the\n    ** doclists are stored in order=ASC order, this padding would not be\n    ** required (since the size of [doclistA AND doclistB] is always less\n    ** than or equal to the size of [doclistA] in that case). But this is\n    ** not true for order=DESC. For example, a doclist containing (1, -1) \n    ** may be smaller than (-1), as in the first example the -1 may be stored\n    ** as a single-byte delta, whereas in the second it must be stored as a\n    ** FTS3_VARINT_MAX byte varint.\n    **\n    ** Similar padding is added in the fts3DoclistOrMerge() function.\n    */\n    pTS->aaOutput[0] = sqlite3_malloc(nDoclist + FTS3_VARINT_MAX + 1);\n    pTS->anOutput[0] = nDoclist;\n    if( pTS->aaOutput[0] ){\n      memcpy(pTS->aaOutput[0], aDoclist, nDoclist);\n    }else{\n      return SQLITE_NOMEM;\n    }\n  }else{\n    char *aMerge = aDoclist;\n    int nMerge = nDoclist;\n    int iOut;\n\n    for(iOut=0; iOut<SizeofArray(pTS->aaOutput); iOut++){\n      if( pTS->aaOutput[iOut]==0 ){\n        assert( iOut>0 );\n        pTS->aaOutput[iOut] = aMerge;\n        pTS->anOutput[iOut] = nMerge;\n        break;\n      }else{\n        char *aNew;\n        int nNew;\n\n        int rc = fts3DoclistOrMerge(p->bDescIdx, aMerge, nMerge, \n            pTS->aaOutput[iOut], pTS->anOutput[iOut], &aNew, &nNew\n        );\n        if( rc!=SQLITE_OK ){\n          if( aMerge!=aDoclist ) sqlite3_free(aMerge);\n          return rc;\n        }\n\n        if( aMerge!=aDoclist ) sqlite3_free(aMerge);\n        sqlite3_free(pTS->aaOutput[iOut]);\n        pTS->aaOutput[iOut] = 0;\n  \n        aMerge = aNew;\n        nMerge = nNew;\n        if( (iOut+1)==SizeofArray(pTS->aaOutput) ){\n          pTS->aaOutput[iOut] = aMerge;\n          pTS->anOutput[iOut] = nMerge;\n        }\n      }\n    }\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Append SegReader object pNew to the end of the pCsr->apSegment[] array.\n*/\nstatic int fts3SegReaderCursorAppend(\n  Fts3MultiSegReader *pCsr, \n  Fts3SegReader *pNew\n){\n  if( (pCsr->nSegment%16)==0 ){\n    Fts3SegReader **apNew;\n    int nByte = (pCsr->nSegment + 16)*sizeof(Fts3SegReader*);\n    apNew = (Fts3SegReader **)sqlite3_realloc(pCsr->apSegment, nByte);\n    if( !apNew ){\n      sqlite3Fts3SegReaderFree(pNew);\n      return SQLITE_NOMEM;\n    }\n    pCsr->apSegment = apNew;\n  }\n  pCsr->apSegment[pCsr->nSegment++] = pNew;\n  return SQLITE_OK;\n}\n\n/*\n** Add seg-reader objects to the Fts3MultiSegReader object passed as the\n** 8th argument.\n**\n** This function returns SQLITE_OK if successful, or an SQLite error code\n** otherwise.\n*/\nstatic int fts3SegReaderCursor(\n  Fts3Table *p,                   /* FTS3 table handle */\n  int iLangid,                    /* Language id */\n  int iIndex,                     /* Index to search (from 0 to p->nIndex-1) */\n  int iLevel,                     /* Level of segments to scan */\n  const char *zTerm,              /* Term to query for */\n  int nTerm,                      /* Size of zTerm in bytes */\n  int isPrefix,                   /* True for a prefix search */\n  int isScan,                     /* True to scan from zTerm to EOF */\n  Fts3MultiSegReader *pCsr        /* Cursor object to populate */\n){\n  int rc = SQLITE_OK;             /* Error code */\n  sqlite3_stmt *pStmt = 0;        /* Statement to iterate through segments */\n  int rc2;                        /* Result of sqlite3_reset() */\n\n  /* If iLevel is less than 0 and this is not a scan, include a seg-reader \n  ** for the pending-terms. If this is a scan, then this call must be being\n  ** made by an fts4aux module, not an FTS table. In this case calling\n  ** Fts3SegReaderPending might segfault, as the data structures used by \n  ** fts4aux are not completely populated. So it's easiest to filter these\n  ** calls out here.  */\n  if( iLevel<0 && p->aIndex ){\n    Fts3SegReader *pSeg = 0;\n    rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix||isScan, &pSeg);\n    if( rc==SQLITE_OK && pSeg ){\n      rc = fts3SegReaderCursorAppend(pCsr, pSeg);\n    }\n  }\n\n  if( iLevel!=FTS3_SEGCURSOR_PENDING ){\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts3AllSegdirs(p, iLangid, iIndex, iLevel, &pStmt);\n    }\n\n    while( rc==SQLITE_OK && SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){\n      Fts3SegReader *pSeg = 0;\n\n      /* Read the values returned by the SELECT into local variables. */\n      sqlite3_int64 iStartBlock = sqlite3_column_int64(pStmt, 1);\n      sqlite3_int64 iLeavesEndBlock = sqlite3_column_int64(pStmt, 2);\n      sqlite3_int64 iEndBlock = sqlite3_column_int64(pStmt, 3);\n      int nRoot = sqlite3_column_bytes(pStmt, 4);\n      char const *zRoot = sqlite3_column_blob(pStmt, 4);\n\n      /* If zTerm is not NULL, and this segment is not stored entirely on its\n      ** root node, the range of leaves scanned can be reduced. Do this. */\n      if( iStartBlock && zTerm ){\n        sqlite3_int64 *pi = (isPrefix ? &iLeavesEndBlock : 0);\n        rc = fts3SelectLeaf(p, zTerm, nTerm, zRoot, nRoot, &iStartBlock, pi);\n        if( rc!=SQLITE_OK ) goto finished;\n        if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock;\n      }\n \n      rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1, \n          (isPrefix==0 && isScan==0),\n          iStartBlock, iLeavesEndBlock, \n          iEndBlock, zRoot, nRoot, &pSeg\n      );\n      if( rc!=SQLITE_OK ) goto finished;\n      rc = fts3SegReaderCursorAppend(pCsr, pSeg);\n    }\n  }\n\n finished:\n  rc2 = sqlite3_reset(pStmt);\n  if( rc==SQLITE_DONE ) rc = rc2;\n\n  return rc;\n}\n\n/*\n** Set up a cursor object for iterating through a full-text index or a \n** single level therein.\n*/\nint sqlite3Fts3SegReaderCursor(\n  Fts3Table *p,                   /* FTS3 table handle */\n  int iLangid,                    /* Language-id to search */\n  int iIndex,                     /* Index to search (from 0 to p->nIndex-1) */\n  int iLevel,                     /* Level of segments to scan */\n  const char *zTerm,              /* Term to query for */\n  int nTerm,                      /* Size of zTerm in bytes */\n  int isPrefix,                   /* True for a prefix search */\n  int isScan,                     /* True to scan from zTerm to EOF */\n  Fts3MultiSegReader *pCsr       /* Cursor object to populate */\n){\n  assert( iIndex>=0 && iIndex<p->nIndex );\n  assert( iLevel==FTS3_SEGCURSOR_ALL\n      ||  iLevel==FTS3_SEGCURSOR_PENDING \n      ||  iLevel>=0\n  );\n  assert( iLevel<FTS3_SEGDIR_MAXLEVEL );\n  assert( FTS3_SEGCURSOR_ALL<0 && FTS3_SEGCURSOR_PENDING<0 );\n  assert( isPrefix==0 || isScan==0 );\n\n  memset(pCsr, 0, sizeof(Fts3MultiSegReader));\n  return fts3SegReaderCursor(\n      p, iLangid, iIndex, iLevel, zTerm, nTerm, isPrefix, isScan, pCsr\n  );\n}\n\n/*\n** In addition to its current configuration, have the Fts3MultiSegReader\n** passed as the 4th argument also scan the doclist for term zTerm/nTerm.\n**\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\n*/\nstatic int fts3SegReaderCursorAddZero(\n  Fts3Table *p,                   /* FTS virtual table handle */\n  int iLangid,\n  const char *zTerm,              /* Term to scan doclist of */\n  int nTerm,                      /* Number of bytes in zTerm */\n  Fts3MultiSegReader *pCsr        /* Fts3MultiSegReader to modify */\n){\n  return fts3SegReaderCursor(p, \n      iLangid, 0, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 0, 0,pCsr\n  );\n}\n\n/*\n** Open an Fts3MultiSegReader to scan the doclist for term zTerm/nTerm. Or,\n** if isPrefix is true, to scan the doclist for all terms for which \n** zTerm/nTerm is a prefix. If successful, return SQLITE_OK and write\n** a pointer to the new Fts3MultiSegReader to *ppSegcsr. Otherwise, return\n** an SQLite error code.\n**\n** It is the responsibility of the caller to free this object by eventually\n** passing it to fts3SegReaderCursorFree() \n**\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\n** Output parameter *ppSegcsr is set to 0 if an error occurs.\n*/\nstatic int fts3TermSegReaderCursor(\n  Fts3Cursor *pCsr,               /* Virtual table cursor handle */\n  const char *zTerm,              /* Term to query for */\n  int nTerm,                      /* Size of zTerm in bytes */\n  int isPrefix,                   /* True for a prefix search */\n  Fts3MultiSegReader **ppSegcsr   /* OUT: Allocated seg-reader cursor */\n){\n  Fts3MultiSegReader *pSegcsr;    /* Object to allocate and return */\n  int rc = SQLITE_NOMEM;          /* Return code */\n\n  pSegcsr = sqlite3_malloc(sizeof(Fts3MultiSegReader));\n  if( pSegcsr ){\n    int i;\n    int bFound = 0;               /* True once an index has been found */\n    Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;\n\n    if( isPrefix ){\n      for(i=1; bFound==0 && i<p->nIndex; i++){\n        if( p->aIndex[i].nPrefix==nTerm ){\n          bFound = 1;\n          rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, \n              i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 0, 0, pSegcsr\n          );\n          pSegcsr->bLookup = 1;\n        }\n      }\n\n      for(i=1; bFound==0 && i<p->nIndex; i++){\n        if( p->aIndex[i].nPrefix==nTerm+1 ){\n          bFound = 1;\n          rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, \n              i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 1, 0, pSegcsr\n          );\n          if( rc==SQLITE_OK ){\n            rc = fts3SegReaderCursorAddZero(\n                p, pCsr->iLangid, zTerm, nTerm, pSegcsr\n            );\n          }\n        }\n      }\n    }\n\n    if( bFound==0 ){\n      rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, \n          0, FTS3_SEGCURSOR_ALL, zTerm, nTerm, isPrefix, 0, pSegcsr\n      );\n      pSegcsr->bLookup = !isPrefix;\n    }\n  }\n\n  *ppSegcsr = pSegcsr;\n  return rc;\n}\n\n/*\n** Free an Fts3MultiSegReader allocated by fts3TermSegReaderCursor().\n*/\nstatic void fts3SegReaderCursorFree(Fts3MultiSegReader *pSegcsr){\n  sqlite3Fts3SegReaderFinish(pSegcsr);\n  sqlite3_free(pSegcsr);\n}\n\n/*\n** This function retrieves the doclist for the specified term (or term\n** prefix) from the database.\n*/\nstatic int fts3TermSelect(\n  Fts3Table *p,                   /* Virtual table handle */\n  Fts3PhraseToken *pTok,          /* Token to query for */\n  int iColumn,                    /* Column to query (or -ve for all columns) */\n  int *pnOut,                     /* OUT: Size of buffer at *ppOut */\n  char **ppOut                    /* OUT: Malloced result buffer */\n){\n  int rc;                         /* Return code */\n  Fts3MultiSegReader *pSegcsr;    /* Seg-reader cursor for this term */\n  TermSelect tsc;                 /* Object for pair-wise doclist merging */\n  Fts3SegFilter filter;           /* Segment term filter configuration */\n\n  pSegcsr = pTok->pSegcsr;\n  memset(&tsc, 0, sizeof(TermSelect));\n\n  filter.flags = FTS3_SEGMENT_IGNORE_EMPTY | FTS3_SEGMENT_REQUIRE_POS\n        | (pTok->isPrefix ? FTS3_SEGMENT_PREFIX : 0)\n        | (pTok->bFirst ? FTS3_SEGMENT_FIRST : 0)\n        | (iColumn<p->nColumn ? FTS3_SEGMENT_COLUMN_FILTER : 0);\n  filter.iCol = iColumn;\n  filter.zTerm = pTok->z;\n  filter.nTerm = pTok->n;\n\n  rc = sqlite3Fts3SegReaderStart(p, pSegcsr, &filter);\n  while( SQLITE_OK==rc\n      && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pSegcsr)) \n  ){\n    rc = fts3TermSelectMerge(p, &tsc, pSegcsr->aDoclist, pSegcsr->nDoclist);\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = fts3TermSelectFinishMerge(p, &tsc);\n  }\n  if( rc==SQLITE_OK ){\n    *ppOut = tsc.aaOutput[0];\n    *pnOut = tsc.anOutput[0];\n  }else{\n    int i;\n    for(i=0; i<SizeofArray(tsc.aaOutput); i++){\n      sqlite3_free(tsc.aaOutput[i]);\n    }\n  }\n\n  fts3SegReaderCursorFree(pSegcsr);\n  pTok->pSegcsr = 0;\n  return rc;\n}\n\n/*\n** This function counts the total number of docids in the doclist stored\n** in buffer aList[], size nList bytes.\n**\n** If the isPoslist argument is true, then it is assumed that the doclist\n** contains a position-list following each docid. Otherwise, it is assumed\n** that the doclist is simply a list of docids stored as delta encoded \n** varints.\n*/\nstatic int fts3DoclistCountDocids(char *aList, int nList){\n  int nDoc = 0;                   /* Return value */\n  if( aList ){\n    char *aEnd = &aList[nList];   /* Pointer to one byte after EOF */\n    char *p = aList;              /* Cursor */\n    while( p<aEnd ){\n      nDoc++;\n      while( (*p++)&0x80 );     /* Skip docid varint */\n      fts3PoslistCopy(0, &p);   /* Skip over position list */\n    }\n  }\n\n  return nDoc;\n}\n\n/*\n** Advance the cursor to the next row in the %_content table that\n** matches the search criteria.  For a MATCH search, this will be\n** the next row that matches. For a full-table scan, this will be\n** simply the next row in the %_content table.  For a docid lookup,\n** this routine simply sets the EOF flag.\n**\n** Return SQLITE_OK if nothing goes wrong.  SQLITE_OK is returned\n** even if we reach end-of-file.  The fts3EofMethod() will be called\n** subsequently to determine whether or not an EOF was hit.\n*/\nstatic int fts3NextMethod(sqlite3_vtab_cursor *pCursor){\n  int rc;\n  Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;\n  if( pCsr->eSearch==FTS3_DOCID_SEARCH || pCsr->eSearch==FTS3_FULLSCAN_SEARCH ){\n    if( SQLITE_ROW!=sqlite3_step(pCsr->pStmt) ){\n      pCsr->isEof = 1;\n      rc = sqlite3_reset(pCsr->pStmt);\n    }else{\n      pCsr->iPrevId = sqlite3_column_int64(pCsr->pStmt, 0);\n      rc = SQLITE_OK;\n    }\n  }else{\n    rc = fts3EvalNext((Fts3Cursor *)pCursor);\n  }\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\n  return rc;\n}\n\n/*\n** The following are copied from sqliteInt.h.\n**\n** Constants for the largest and smallest possible 64-bit signed integers.\n** These macros are designed to work correctly on both 32-bit and 64-bit\n** compilers.\n*/\n#ifndef SQLITE_AMALGAMATION\n# define LARGEST_INT64  (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))\n# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)\n#endif\n\n/*\n** If the numeric type of argument pVal is \"integer\", then return it\n** converted to a 64-bit signed integer. Otherwise, return a copy of\n** the second parameter, iDefault.\n*/\nstatic sqlite3_int64 fts3DocidRange(sqlite3_value *pVal, i64 iDefault){\n  if( pVal ){\n    int eType = sqlite3_value_numeric_type(pVal);\n    if( eType==SQLITE_INTEGER ){\n      return sqlite3_value_int64(pVal);\n    }\n  }\n  return iDefault;\n}\n\n/*\n** This is the xFilter interface for the virtual table.  See\n** the virtual table xFilter method documentation for additional\n** information.\n**\n** If idxNum==FTS3_FULLSCAN_SEARCH then do a full table scan against\n** the %_content table.\n**\n** If idxNum==FTS3_DOCID_SEARCH then do a docid lookup for a single entry\n** in the %_content table.\n**\n** If idxNum>=FTS3_FULLTEXT_SEARCH then use the full text index.  The\n** column on the left-hand side of the MATCH operator is column\n** number idxNum-FTS3_FULLTEXT_SEARCH, 0 indexed.  argv[0] is the right-hand\n** side of the MATCH operator.\n*/\nstatic int fts3FilterMethod(\n  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */\n  int idxNum,                     /* Strategy index */\n  const char *idxStr,             /* Unused */\n  int nVal,                       /* Number of elements in apVal */\n  sqlite3_value **apVal           /* Arguments for the indexing scheme */\n){\n  int rc = SQLITE_OK;\n  char *zSql;                     /* SQL statement used to access %_content */\n  int eSearch;\n  Fts3Table *p = (Fts3Table *)pCursor->pVtab;\n  Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;\n\n  sqlite3_value *pCons = 0;       /* The MATCH or rowid constraint, if any */\n  sqlite3_value *pLangid = 0;     /* The \"langid = ?\" constraint, if any */\n  sqlite3_value *pDocidGe = 0;    /* The \"docid >= ?\" constraint, if any */\n  sqlite3_value *pDocidLe = 0;    /* The \"docid <= ?\" constraint, if any */\n  int iIdx;\n\n  UNUSED_PARAMETER(idxStr);\n  UNUSED_PARAMETER(nVal);\n\n  eSearch = (idxNum & 0x0000FFFF);\n  assert( eSearch>=0 && eSearch<=(FTS3_FULLTEXT_SEARCH+p->nColumn) );\n  assert( p->pSegments==0 );\n\n  /* Collect arguments into local variables */\n  iIdx = 0;\n  if( eSearch!=FTS3_FULLSCAN_SEARCH ) pCons = apVal[iIdx++];\n  if( idxNum & FTS3_HAVE_LANGID ) pLangid = apVal[iIdx++];\n  if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];\n  if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];\n  assert( iIdx==nVal );\n\n  /* In case the cursor has been used before, clear it now. */\n  sqlite3_finalize(pCsr->pStmt);\n  sqlite3_free(pCsr->aDoclist);\n  sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);\n  sqlite3Fts3ExprFree(pCsr->pExpr);\n  memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));\n\n  /* Set the lower and upper bounds on docids to return */\n  pCsr->iMinDocid = fts3DocidRange(pDocidGe, SMALLEST_INT64);\n  pCsr->iMaxDocid = fts3DocidRange(pDocidLe, LARGEST_INT64);\n\n  if( idxStr ){\n    pCsr->bDesc = (idxStr[0]=='D');\n  }else{\n    pCsr->bDesc = p->bDescIdx;\n  }\n  pCsr->eSearch = (i16)eSearch;\n\n  if( eSearch!=FTS3_DOCID_SEARCH && eSearch!=FTS3_FULLSCAN_SEARCH ){\n    int iCol = eSearch-FTS3_FULLTEXT_SEARCH;\n    const char *zQuery = (const char *)sqlite3_value_text(pCons);\n\n    if( zQuery==0 && sqlite3_value_type(pCons)!=SQLITE_NULL ){\n      return SQLITE_NOMEM;\n    }\n\n    pCsr->iLangid = 0;\n    if( pLangid ) pCsr->iLangid = sqlite3_value_int(pLangid);\n\n    assert( p->base.zErrMsg==0 );\n    rc = sqlite3Fts3ExprParse(p->pTokenizer, pCsr->iLangid,\n        p->azColumn, p->bFts4, p->nColumn, iCol, zQuery, -1, &pCsr->pExpr, \n        &p->base.zErrMsg\n    );\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n\n    rc = fts3EvalStart(pCsr);\n    sqlite3Fts3SegmentsClose(p);\n    if( rc!=SQLITE_OK ) return rc;\n    pCsr->pNextId = pCsr->aDoclist;\n    pCsr->iPrevId = 0;\n  }\n\n  /* Compile a SELECT statement for this cursor. For a full-table-scan, the\n  ** statement loops through all rows of the %_content table. For a\n  ** full-text query or docid lookup, the statement retrieves a single\n  ** row by docid.\n  */\n  if( eSearch==FTS3_FULLSCAN_SEARCH ){\n    if( pDocidGe || pDocidLe ){\n      zSql = sqlite3_mprintf(\n          \"SELECT %s WHERE rowid BETWEEN %lld AND %lld ORDER BY rowid %s\",\n          p->zReadExprlist, pCsr->iMinDocid, pCsr->iMaxDocid,\n          (pCsr->bDesc ? \"DESC\" : \"ASC\")\n      );\n    }else{\n      zSql = sqlite3_mprintf(\"SELECT %s ORDER BY rowid %s\", \n          p->zReadExprlist, (pCsr->bDesc ? \"DESC\" : \"ASC\")\n      );\n    }\n    if( zSql ){\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);\n      sqlite3_free(zSql);\n    }else{\n      rc = SQLITE_NOMEM;\n    }\n  }else if( eSearch==FTS3_DOCID_SEARCH ){\n    rc = fts3CursorSeekStmt(pCsr, &pCsr->pStmt);\n    if( rc==SQLITE_OK ){\n      rc = sqlite3_bind_value(pCsr->pStmt, 1, pCons);\n    }\n  }\n  if( rc!=SQLITE_OK ) return rc;\n\n  return fts3NextMethod(pCursor);\n}\n\n/* \n** This is the xEof method of the virtual table. SQLite calls this \n** routine to find out if it has reached the end of a result set.\n*/\nstatic int fts3EofMethod(sqlite3_vtab_cursor *pCursor){\n  return ((Fts3Cursor *)pCursor)->isEof;\n}\n\n/* \n** This is the xRowid method. The SQLite core calls this routine to\n** retrieve the rowid for the current row of the result set. fts3\n** exposes %_content.docid as the rowid for the virtual table. The\n** rowid should be written to *pRowid.\n*/\nstatic int fts3RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){\n  Fts3Cursor *pCsr = (Fts3Cursor *) pCursor;\n  *pRowid = pCsr->iPrevId;\n  return SQLITE_OK;\n}\n\n/* \n** This is the xColumn method, called by SQLite to request a value from\n** the row that the supplied cursor currently points to.\n**\n** If:\n**\n**   (iCol <  p->nColumn)   -> The value of the iCol'th user column.\n**   (iCol == p->nColumn)   -> Magic column with the same name as the table.\n**   (iCol == p->nColumn+1) -> Docid column\n**   (iCol == p->nColumn+2) -> Langid column\n*/\nstatic int fts3ColumnMethod(\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\n  sqlite3_context *pCtx,          /* Context for sqlite3_result_xxx() calls */\n  int iCol                        /* Index of column to read value from */\n){\n  int rc = SQLITE_OK;             /* Return Code */\n  Fts3Cursor *pCsr = (Fts3Cursor *) pCursor;\n  Fts3Table *p = (Fts3Table *)pCursor->pVtab;\n\n  /* The column value supplied by SQLite must be in range. */\n  assert( iCol>=0 && iCol<=p->nColumn+2 );\n\n  if( iCol==p->nColumn+1 ){\n    /* This call is a request for the \"docid\" column. Since \"docid\" is an \n    ** alias for \"rowid\", use the xRowid() method to obtain the value.\n    */\n    sqlite3_result_int64(pCtx, pCsr->iPrevId);\n  }else if( iCol==p->nColumn ){\n    /* The extra column whose name is the same as the table.\n    ** Return a blob which is a pointer to the cursor.  */\n    sqlite3_result_blob(pCtx, &pCsr, sizeof(pCsr), SQLITE_TRANSIENT);\n  }else if( iCol==p->nColumn+2 && pCsr->pExpr ){\n    sqlite3_result_int64(pCtx, pCsr->iLangid);\n  }else{\n    /* The requested column is either a user column (one that contains \n    ** indexed data), or the language-id column.  */\n    rc = fts3CursorSeek(0, pCsr);\n\n    if( rc==SQLITE_OK ){\n      if( iCol==p->nColumn+2 ){\n        int iLangid = 0;\n        if( p->zLanguageid ){\n          iLangid = sqlite3_column_int(pCsr->pStmt, p->nColumn+1);\n        }\n        sqlite3_result_int(pCtx, iLangid);\n      }else if( sqlite3_data_count(pCsr->pStmt)>(iCol+1) ){\n        sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1));\n      }\n    }\n  }\n\n  assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );\n  return rc;\n}\n\n/* \n** This function is the implementation of the xUpdate callback used by \n** FTS3 virtual tables. It is invoked by SQLite each time a row is to be\n** inserted, updated or deleted.\n*/\nstatic int fts3UpdateMethod(\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\n  int nArg,                       /* Size of argument array */\n  sqlite3_value **apVal,          /* Array of arguments */\n  sqlite_int64 *pRowid            /* OUT: The affected (or effected) rowid */\n){\n  return sqlite3Fts3UpdateMethod(pVtab, nArg, apVal, pRowid);\n}\n\n/*\n** Implementation of xSync() method. Flush the contents of the pending-terms\n** hash-table to the database.\n*/\nstatic int fts3SyncMethod(sqlite3_vtab *pVtab){\n\n  /* Following an incremental-merge operation, assuming that the input\n  ** segments are not completely consumed (the usual case), they are updated\n  ** in place to remove the entries that have already been merged. This\n  ** involves updating the leaf block that contains the smallest unmerged\n  ** entry and each block (if any) between the leaf and the root node. So\n  ** if the height of the input segment b-trees is N, and input segments\n  ** are merged eight at a time, updating the input segments at the end\n  ** of an incremental-merge requires writing (8*(1+N)) blocks. N is usually\n  ** small - often between 0 and 2. So the overhead of the incremental\n  ** merge is somewhere between 8 and 24 blocks. To avoid this overhead\n  ** dwarfing the actual productive work accomplished, the incremental merge\n  ** is only attempted if it will write at least 64 leaf blocks. Hence\n  ** nMinMerge.\n  **\n  ** Of course, updating the input segments also involves deleting a bunch\n  ** of blocks from the segments table. But this is not considered overhead\n  ** as it would also be required by a crisis-merge that used the same input \n  ** segments.\n  */\n  const u32 nMinMerge = 64;       /* Minimum amount of incr-merge work to do */\n\n  Fts3Table *p = (Fts3Table*)pVtab;\n  int rc = sqlite3Fts3PendingTermsFlush(p);\n\n  if( rc==SQLITE_OK \n   && p->nLeafAdd>(nMinMerge/16) \n   && p->nAutoincrmerge && p->nAutoincrmerge!=0xff\n  ){\n    int mxLevel = 0;              /* Maximum relative level value in db */\n    int A;                        /* Incr-merge parameter A */\n\n    rc = sqlite3Fts3MaxLevel(p, &mxLevel);\n    assert( rc==SQLITE_OK || mxLevel==0 );\n    A = p->nLeafAdd * mxLevel;\n    A += (A/2);\n    if( A>(int)nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, p->nAutoincrmerge);\n  }\n  sqlite3Fts3SegmentsClose(p);\n  return rc;\n}\n\n/*\n** If it is currently unknown whether or not the FTS table has an %_stat\n** table (if p->bHasStat==2), attempt to determine this (set p->bHasStat\n** to 0 or 1). Return SQLITE_OK if successful, or an SQLite error code\n** if an error occurs.\n*/\nstatic int fts3SetHasStat(Fts3Table *p){\n  int rc = SQLITE_OK;\n  if( p->bHasStat==2 ){\n    const char *zFmt =\"SELECT 1 FROM %Q.sqlite_master WHERE tbl_name='%q_stat'\";\n    char *zSql = sqlite3_mprintf(zFmt, p->zDb, p->zName);\n    if( zSql ){\n      sqlite3_stmt *pStmt = 0;\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);\n      if( rc==SQLITE_OK ){\n        int bHasStat = (sqlite3_step(pStmt)==SQLITE_ROW);\n        rc = sqlite3_finalize(pStmt);\n        if( rc==SQLITE_OK ) p->bHasStat = bHasStat;\n      }\n      sqlite3_free(zSql);\n    }else{\n      rc = SQLITE_NOMEM;\n    }\n  }\n  return rc;\n}\n\n/*\n** Implementation of xBegin() method. \n*/\nstatic int fts3BeginMethod(sqlite3_vtab *pVtab){\n  Fts3Table *p = (Fts3Table*)pVtab;\n  UNUSED_PARAMETER(pVtab);\n  assert( p->pSegments==0 );\n  assert( p->nPendingData==0 );\n  assert( p->inTransaction!=1 );\n  TESTONLY( p->inTransaction = 1 );\n  TESTONLY( p->mxSavepoint = -1; );\n  p->nLeafAdd = 0;\n  return fts3SetHasStat(p);\n}\n\n/*\n** Implementation of xCommit() method. This is a no-op. The contents of\n** the pending-terms hash-table have already been flushed into the database\n** by fts3SyncMethod().\n*/\nstatic int fts3CommitMethod(sqlite3_vtab *pVtab){\n  TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );\n  UNUSED_PARAMETER(pVtab);\n  assert( p->nPendingData==0 );\n  assert( p->inTransaction!=0 );\n  assert( p->pSegments==0 );\n  TESTONLY( p->inTransaction = 0 );\n  TESTONLY( p->mxSavepoint = -1; );\n  return SQLITE_OK;\n}\n\n/*\n** Implementation of xRollback(). Discard the contents of the pending-terms\n** hash-table. Any changes made to the database are reverted by SQLite.\n*/\nstatic int fts3RollbackMethod(sqlite3_vtab *pVtab){\n  Fts3Table *p = (Fts3Table*)pVtab;\n  sqlite3Fts3PendingTermsClear(p);\n  assert( p->inTransaction!=0 );\n  TESTONLY( p->inTransaction = 0 );\n  TESTONLY( p->mxSavepoint = -1; );\n  return SQLITE_OK;\n}\n\n/*\n** When called, *ppPoslist must point to the byte immediately following the\n** end of a position-list. i.e. ( (*ppPoslist)[-1]==POS_END ). This function\n** moves *ppPoslist so that it instead points to the first byte of the\n** same position list.\n*/\nstatic void fts3ReversePoslist(char *pStart, char **ppPoslist){\n  char *p = &(*ppPoslist)[-2];\n  char c = 0;\n\n  /* Skip backwards passed any trailing 0x00 bytes added by NearTrim() */\n  while( p>pStart && (c=*p--)==0 );\n\n  /* Search backwards for a varint with value zero (the end of the previous \n  ** poslist). This is an 0x00 byte preceded by some byte that does not\n  ** have the 0x80 bit set.  */\n  while( p>pStart && (*p & 0x80) | c ){ \n    c = *p--; \n  }\n  assert( p==pStart || c==0 );\n\n  /* At this point p points to that preceding byte without the 0x80 bit\n  ** set. So to find the start of the poslist, skip forward 2 bytes then\n  ** over a varint. \n  **\n  ** Normally. The other case is that p==pStart and the poslist to return\n  ** is the first in the doclist. In this case do not skip forward 2 bytes.\n  ** The second part of the if condition (c==0 && *ppPoslist>&p[2])\n  ** is required for cases where the first byte of a doclist and the\n  ** doclist is empty. For example, if the first docid is 10, a doclist\n  ** that begins with:\n  **\n  **   0x0A 0x00 <next docid delta varint>\n  */\n  if( p>pStart || (c==0 && *ppPoslist>&p[2]) ){ p = &p[2]; }\n  while( *p++&0x80 );\n  *ppPoslist = p;\n}\n\n/*\n** Helper function used by the implementation of the overloaded snippet(),\n** offsets() and optimize() SQL functions.\n**\n** If the value passed as the third argument is a blob of size\n** sizeof(Fts3Cursor*), then the blob contents are copied to the \n** output variable *ppCsr and SQLITE_OK is returned. Otherwise, an error\n** message is written to context pContext and SQLITE_ERROR returned. The\n** string passed via zFunc is used as part of the error message.\n*/\nstatic int fts3FunctionArg(\n  sqlite3_context *pContext,      /* SQL function call context */\n  const char *zFunc,              /* Function name */\n  sqlite3_value *pVal,            /* argv[0] passed to function */\n  Fts3Cursor **ppCsr              /* OUT: Store cursor handle here */\n){\n  Fts3Cursor *pRet;\n  if( sqlite3_value_type(pVal)!=SQLITE_BLOB \n   || sqlite3_value_bytes(pVal)!=sizeof(Fts3Cursor *)\n  ){\n    char *zErr = sqlite3_mprintf(\"illegal first argument to %s\", zFunc);\n    sqlite3_result_error(pContext, zErr, -1);\n    sqlite3_free(zErr);\n    return SQLITE_ERROR;\n  }\n  memcpy(&pRet, sqlite3_value_blob(pVal), sizeof(Fts3Cursor *));\n  *ppCsr = pRet;\n  return SQLITE_OK;\n}\n\n/*\n** Implementation of the snippet() function for FTS3\n*/\nstatic void fts3SnippetFunc(\n  sqlite3_context *pContext,      /* SQLite function call context */\n  int nVal,                       /* Size of apVal[] array */\n  sqlite3_value **apVal           /* Array of arguments */\n){\n  Fts3Cursor *pCsr;               /* Cursor handle passed through apVal[0] */\n  const char *zStart = \"<b>\";\n  const char *zEnd = \"</b>\";\n  const char *zEllipsis = \"<b>...</b>\";\n  int iCol = -1;\n  int nToken = 15;                /* Default number of tokens in snippet */\n\n  /* There must be at least one argument passed to this function (otherwise\n  ** the non-overloaded version would have been called instead of this one).\n  */\n  assert( nVal>=1 );\n\n  if( nVal>6 ){\n    sqlite3_result_error(pContext, \n        \"wrong number of arguments to function snippet()\", -1);\n    return;\n  }\n  if( fts3FunctionArg(pContext, \"snippet\", apVal[0], &pCsr) ) return;\n\n  switch( nVal ){\n    case 6: nToken = sqlite3_value_int(apVal[5]);\n    case 5: iCol = sqlite3_value_int(apVal[4]);\n    case 4: zEllipsis = (const char*)sqlite3_value_text(apVal[3]);\n    case 3: zEnd = (const char*)sqlite3_value_text(apVal[2]);\n    case 2: zStart = (const char*)sqlite3_value_text(apVal[1]);\n  }\n  if( !zEllipsis || !zEnd || !zStart ){\n    sqlite3_result_error_nomem(pContext);\n  }else if( nToken==0 ){\n    sqlite3_result_text(pContext, \"\", -1, SQLITE_STATIC);\n  }else if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){\n    sqlite3Fts3Snippet(pContext, pCsr, zStart, zEnd, zEllipsis, iCol, nToken);\n  }\n}\n\n/*\n** Implementation of the offsets() function for FTS3\n*/\nstatic void fts3OffsetsFunc(\n  sqlite3_context *pContext,      /* SQLite function call context */\n  int nVal,                       /* Size of argument array */\n  sqlite3_value **apVal           /* Array of arguments */\n){\n  Fts3Cursor *pCsr;               /* Cursor handle passed through apVal[0] */\n\n  UNUSED_PARAMETER(nVal);\n\n  assert( nVal==1 );\n  if( fts3FunctionArg(pContext, \"offsets\", apVal[0], &pCsr) ) return;\n  assert( pCsr );\n  if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){\n    sqlite3Fts3Offsets(pContext, pCsr);\n  }\n}\n\n/* \n** Implementation of the special optimize() function for FTS3. This \n** function merges all segments in the database to a single segment.\n** Example usage is:\n**\n**   SELECT optimize(t) FROM t LIMIT 1;\n**\n** where 't' is the name of an FTS3 table.\n*/\nstatic void fts3OptimizeFunc(\n  sqlite3_context *pContext,      /* SQLite function call context */\n  int nVal,                       /* Size of argument array */\n  sqlite3_value **apVal           /* Array of arguments */\n){\n  int rc;                         /* Return code */\n  Fts3Table *p;                   /* Virtual table handle */\n  Fts3Cursor *pCursor;            /* Cursor handle passed through apVal[0] */\n\n  UNUSED_PARAMETER(nVal);\n\n  assert( nVal==1 );\n  if( fts3FunctionArg(pContext, \"optimize\", apVal[0], &pCursor) ) return;\n  p = (Fts3Table *)pCursor->base.pVtab;\n  assert( p );\n\n  rc = sqlite3Fts3Optimize(p);\n\n  switch( rc ){\n    case SQLITE_OK:\n      sqlite3_result_text(pContext, \"Index optimized\", -1, SQLITE_STATIC);\n      break;\n    case SQLITE_DONE:\n      sqlite3_result_text(pContext, \"Index already optimal\", -1, SQLITE_STATIC);\n      break;\n    default:\n      sqlite3_result_error_code(pContext, rc);\n      break;\n  }\n}\n\n/*\n** Implementation of the matchinfo() function for FTS3\n*/\nstatic void fts3MatchinfoFunc(\n  sqlite3_context *pContext,      /* SQLite function call context */\n  int nVal,                       /* Size of argument array */\n  sqlite3_value **apVal           /* Array of arguments */\n){\n  Fts3Cursor *pCsr;               /* Cursor handle passed through apVal[0] */\n  assert( nVal==1 || nVal==2 );\n  if( SQLITE_OK==fts3FunctionArg(pContext, \"matchinfo\", apVal[0], &pCsr) ){\n    const char *zArg = 0;\n    if( nVal>1 ){\n      zArg = (const char *)sqlite3_value_text(apVal[1]);\n    }\n    sqlite3Fts3Matchinfo(pContext, pCsr, zArg);\n  }\n}\n\n/*\n** This routine implements the xFindFunction method for the FTS3\n** virtual table.\n*/\nstatic int fts3FindFunctionMethod(\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\n  int nArg,                       /* Number of SQL function arguments */\n  const char *zName,              /* Name of SQL function */\n  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), /* OUT: Result */\n  void **ppArg                    /* Unused */\n){\n  struct Overloaded {\n    const char *zName;\n    void (*xFunc)(sqlite3_context*,int,sqlite3_value**);\n  } aOverload[] = {\n    { \"snippet\", fts3SnippetFunc },\n    { \"offsets\", fts3OffsetsFunc },\n    { \"optimize\", fts3OptimizeFunc },\n    { \"matchinfo\", fts3MatchinfoFunc },\n  };\n  int i;                          /* Iterator variable */\n\n  UNUSED_PARAMETER(pVtab);\n  UNUSED_PARAMETER(nArg);\n  UNUSED_PARAMETER(ppArg);\n\n  for(i=0; i<SizeofArray(aOverload); i++){\n    if( strcmp(zName, aOverload[i].zName)==0 ){\n      *pxFunc = aOverload[i].xFunc;\n      return 1;\n    }\n  }\n\n  /* No function of the specified name was found. Return 0. */\n  return 0;\n}\n\n/*\n** Implementation of FTS3 xRename method. Rename an fts3 table.\n*/\nstatic int fts3RenameMethod(\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\n  const char *zName               /* New name of table */\n){\n  Fts3Table *p = (Fts3Table *)pVtab;\n  sqlite3 *db = p->db;            /* Database connection */\n  int rc;                         /* Return Code */\n\n  /* At this point it must be known if the %_stat table exists or not.\n  ** So bHasStat may not be 2.  */\n  rc = fts3SetHasStat(p);\n  \n  /* As it happens, the pending terms table is always empty here. This is\n  ** because an \"ALTER TABLE RENAME TABLE\" statement inside a transaction \n  ** always opens a savepoint transaction. And the xSavepoint() method \n  ** flushes the pending terms table. But leave the (no-op) call to\n  ** PendingTermsFlush() in in case that changes.\n  */\n  assert( p->nPendingData==0 );\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts3PendingTermsFlush(p);\n  }\n\n  if( p->zContentTbl==0 ){\n    fts3DbExec(&rc, db,\n      \"ALTER TABLE %Q.'%q_content'  RENAME TO '%q_content';\",\n      p->zDb, p->zName, zName\n    );\n  }\n\n  if( p->bHasDocsize ){\n    fts3DbExec(&rc, db,\n      \"ALTER TABLE %Q.'%q_docsize'  RENAME TO '%q_docsize';\",\n      p->zDb, p->zName, zName\n    );\n  }\n  if( p->bHasStat ){\n    fts3DbExec(&rc, db,\n      \"ALTER TABLE %Q.'%q_stat'  RENAME TO '%q_stat';\",\n      p->zDb, p->zName, zName\n    );\n  }\n  fts3DbExec(&rc, db,\n    \"ALTER TABLE %Q.'%q_segments' RENAME TO '%q_segments';\",\n    p->zDb, p->zName, zName\n  );\n  fts3DbExec(&rc, db,\n    \"ALTER TABLE %Q.'%q_segdir'   RENAME TO '%q_segdir';\",\n    p->zDb, p->zName, zName\n  );\n  return rc;\n}\n\n/*\n** The xSavepoint() method.\n**\n** Flush the contents of the pending-terms table to disk.\n*/\nstatic int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){\n  int rc = SQLITE_OK;\n  UNUSED_PARAMETER(iSavepoint);\n  assert( ((Fts3Table *)pVtab)->inTransaction );\n  assert( ((Fts3Table *)pVtab)->mxSavepoint < iSavepoint );\n  TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint );\n  if( ((Fts3Table *)pVtab)->bIgnoreSavepoint==0 ){\n    rc = fts3SyncMethod(pVtab);\n  }\n  return rc;\n}\n\n/*\n** The xRelease() method.\n**\n** This is a no-op.\n*/\nstatic int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){\n  TESTONLY( Fts3Table *p = (Fts3Table*)pVtab );\n  UNUSED_PARAMETER(iSavepoint);\n  UNUSED_PARAMETER(pVtab);\n  assert( p->inTransaction );\n  assert( p->mxSavepoint >= iSavepoint );\n  TESTONLY( p->mxSavepoint = iSavepoint-1 );\n  return SQLITE_OK;\n}\n\n/*\n** The xRollbackTo() method.\n**\n** Discard the contents of the pending terms table.\n*/\nstatic int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){\n  Fts3Table *p = (Fts3Table*)pVtab;\n  UNUSED_PARAMETER(iSavepoint);\n  assert( p->inTransaction );\n  assert( p->mxSavepoint >= iSavepoint );\n  TESTONLY( p->mxSavepoint = iSavepoint );\n  sqlite3Fts3PendingTermsClear(p);\n  return SQLITE_OK;\n}\n\nstatic const sqlite3_module fts3Module = {\n  /* iVersion      */ 2,\n  /* xCreate       */ fts3CreateMethod,\n  /* xConnect      */ fts3ConnectMethod,\n  /* xBestIndex    */ fts3BestIndexMethod,\n  /* xDisconnect   */ fts3DisconnectMethod,\n  /* xDestroy      */ fts3DestroyMethod,\n  /* xOpen         */ fts3OpenMethod,\n  /* xClose        */ fts3CloseMethod,\n  /* xFilter       */ fts3FilterMethod,\n  /* xNext         */ fts3NextMethod,\n  /* xEof          */ fts3EofMethod,\n  /* xColumn       */ fts3ColumnMethod,\n  /* xRowid        */ fts3RowidMethod,\n  /* xUpdate       */ fts3UpdateMethod,\n  /* xBegin        */ fts3BeginMethod,\n  /* xSync         */ fts3SyncMethod,\n  /* xCommit       */ fts3CommitMethod,\n  /* xRollback     */ fts3RollbackMethod,\n  /* xFindFunction */ fts3FindFunctionMethod,\n  /* xRename */       fts3RenameMethod,\n  /* xSavepoint    */ fts3SavepointMethod,\n  /* xRelease      */ fts3ReleaseMethod,\n  /* xRollbackTo   */ fts3RollbackToMethod,\n};\n\n/*\n** This function is registered as the module destructor (called when an\n** FTS3 enabled database connection is closed). It frees the memory\n** allocated for the tokenizer hash table.\n*/\nstatic void hashDestroy(void *p){\n  Fts3Hash *pHash = (Fts3Hash *)p;\n  sqlite3Fts3HashClear(pHash);\n  sqlite3_free(pHash);\n}\n\n/*\n** The fts3 built-in tokenizers - \"simple\", \"porter\" and \"icu\"- are \n** implemented in files fts3_tokenizer1.c, fts3_porter.c and fts3_icu.c\n** respectively. The following three forward declarations are for functions\n** declared in these files used to retrieve the respective implementations.\n**\n** Calling sqlite3Fts3SimpleTokenizerModule() sets the value pointed\n** to by the argument to point to the \"simple\" tokenizer implementation.\n** And so on.\n*/\nvoid sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);\nvoid sqlite3Fts3PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule);\n#ifndef SQLITE_DISABLE_FTS3_UNICODE\nvoid sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const**ppModule);\n#endif\n#ifdef SQLITE_ENABLE_ICU\nvoid sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const**ppModule);\n#endif\n\n/*\n** Initialize the fts3 extension. If this extension is built as part\n** of the sqlite library, then this function is called directly by\n** SQLite. If fts3 is built as a dynamically loadable extension, this\n** function is called by the sqlite3_extension_init() entry point.\n*/\nint sqlite3Fts3Init(sqlite3 *db){\n  int rc = SQLITE_OK;\n  Fts3Hash *pHash = 0;\n  const sqlite3_tokenizer_module *pSimple = 0;\n  const sqlite3_tokenizer_module *pPorter = 0;\n#ifndef SQLITE_DISABLE_FTS3_UNICODE\n  const sqlite3_tokenizer_module *pUnicode = 0;\n#endif\n\n#ifdef SQLITE_ENABLE_ICU\n  const sqlite3_tokenizer_module *pIcu = 0;\n  sqlite3Fts3IcuTokenizerModule(&pIcu);\n#endif\n\n#ifndef SQLITE_DISABLE_FTS3_UNICODE\n  sqlite3Fts3UnicodeTokenizer(&pUnicode);\n#endif\n\n#ifdef SQLITE_TEST\n  rc = sqlite3Fts3InitTerm(db);\n  if( rc!=SQLITE_OK ) return rc;\n#endif\n\n  rc = sqlite3Fts3InitAux(db);\n  if( rc!=SQLITE_OK ) return rc;\n\n  sqlite3Fts3SimpleTokenizerModule(&pSimple);\n  sqlite3Fts3PorterTokenizerModule(&pPorter);\n\n  /* Allocate and initialize the hash-table used to store tokenizers. */\n  pHash = sqlite3_malloc(sizeof(Fts3Hash));\n  if( !pHash ){\n    rc = SQLITE_NOMEM;\n  }else{\n    sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);\n  }\n\n  /* Load the built-in tokenizers into the hash table */\n  if( rc==SQLITE_OK ){\n    if( sqlite3Fts3HashInsert(pHash, \"simple\", 7, (void *)pSimple)\n     || sqlite3Fts3HashInsert(pHash, \"porter\", 7, (void *)pPorter) \n\n#ifndef SQLITE_DISABLE_FTS3_UNICODE\n     || sqlite3Fts3HashInsert(pHash, \"unicode61\", 10, (void *)pUnicode) \n#endif\n#ifdef SQLITE_ENABLE_ICU\n     || (pIcu && sqlite3Fts3HashInsert(pHash, \"icu\", 4, (void *)pIcu))\n#endif\n    ){\n      rc = SQLITE_NOMEM;\n    }\n  }\n\n#ifdef SQLITE_TEST\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts3ExprInitTestInterface(db);\n  }\n#endif\n\n  /* Create the virtual table wrapper around the hash-table and overload \n  ** the two scalar functions. If this is successful, register the\n  ** module with sqlite.\n  */\n  if( SQLITE_OK==rc \n   && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, \"fts3_tokenizer\"))\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"snippet\", -1))\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"offsets\", 1))\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"matchinfo\", 1))\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"matchinfo\", 2))\n   && SQLITE_OK==(rc = sqlite3_overload_function(db, \"optimize\", 1))\n  ){\n    rc = sqlite3_create_module_v2(\n        db, \"fts3\", &fts3Module, (void *)pHash, hashDestroy\n    );\n    if( rc==SQLITE_OK ){\n      rc = sqlite3_create_module_v2(\n          db, \"fts4\", &fts3Module, (void *)pHash, 0\n      );\n    }\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts3InitTok(db, (void *)pHash);\n    }\n    return rc;\n  }\n\n\n  /* An error has occurred. Delete the hash table and return the error code. */\n  assert( rc!=SQLITE_OK );\n  if( pHash ){\n    sqlite3Fts3HashClear(pHash);\n    sqlite3_free(pHash);\n  }\n  return rc;\n}\n\n/*\n** Allocate an Fts3MultiSegReader for each token in the expression headed\n** by pExpr. \n**\n** An Fts3SegReader object is a cursor that can seek or scan a range of\n** entries within a single segment b-tree. An Fts3MultiSegReader uses multiple\n** Fts3SegReader objects internally to provide an interface to seek or scan\n** within the union of all segments of a b-tree. Hence the name.\n**\n** If the allocated Fts3MultiSegReader just seeks to a single entry in a\n** segment b-tree (if the term is not a prefix or it is a prefix for which\n** there exists prefix b-tree of the right length) then it may be traversed\n** and merged incrementally. Otherwise, it has to be merged into an in-memory \n** doclist and then traversed.\n*/\nstatic void fts3EvalAllocateReaders(\n  Fts3Cursor *pCsr,               /* FTS cursor handle */\n  Fts3Expr *pExpr,                /* Allocate readers for this expression */\n  int *pnToken,                   /* OUT: Total number of tokens in phrase. */\n  int *pnOr,                      /* OUT: Total number of OR nodes in expr. */\n  int *pRc                        /* IN/OUT: Error code */\n){\n  if( pExpr && SQLITE_OK==*pRc ){\n    if( pExpr->eType==FTSQUERY_PHRASE ){\n      int i;\n      int nToken = pExpr->pPhrase->nToken;\n      *pnToken += nToken;\n      for(i=0; i<nToken; i++){\n        Fts3PhraseToken *pToken = &pExpr->pPhrase->aToken[i];\n        int rc = fts3TermSegReaderCursor(pCsr, \n            pToken->z, pToken->n, pToken->isPrefix, &pToken->pSegcsr\n        );\n        if( rc!=SQLITE_OK ){\n          *pRc = rc;\n          return;\n        }\n      }\n      assert( pExpr->pPhrase->iDoclistToken==0 );\n      pExpr->pPhrase->iDoclistToken = -1;\n    }else{\n      *pnOr += (pExpr->eType==FTSQUERY_OR);\n      fts3EvalAllocateReaders(pCsr, pExpr->pLeft, pnToken, pnOr, pRc);\n      fts3EvalAllocateReaders(pCsr, pExpr->pRight, pnToken, pnOr, pRc);\n    }\n  }\n}\n\n/*\n** Arguments pList/nList contain the doclist for token iToken of phrase p.\n** It is merged into the main doclist stored in p->doclist.aAll/nAll.\n**\n** This function assumes that pList points to a buffer allocated using\n** sqlite3_malloc(). This function takes responsibility for eventually\n** freeing the buffer.\n**\n** SQLITE_OK is returned if successful, or SQLITE_NOMEM if an error occurs.\n*/\nstatic int fts3EvalPhraseMergeToken(\n  Fts3Table *pTab,                /* FTS Table pointer */\n  Fts3Phrase *p,                  /* Phrase to merge pList/nList into */\n  int iToken,                     /* Token pList/nList corresponds to */\n  char *pList,                    /* Pointer to doclist */\n  int nList                       /* Number of bytes in pList */\n){\n  int rc = SQLITE_OK;\n  assert( iToken!=p->iDoclistToken );\n\n  if( pList==0 ){\n    sqlite3_free(p->doclist.aAll);\n    p->doclist.aAll = 0;\n    p->doclist.nAll = 0;\n  }\n\n  else if( p->iDoclistToken<0 ){\n    p->doclist.aAll = pList;\n    p->doclist.nAll = nList;\n  }\n\n  else if( p->doclist.aAll==0 ){\n    sqlite3_free(pList);\n  }\n\n  else {\n    char *pLeft;\n    char *pRight;\n    int nLeft;\n    int nRight;\n    int nDiff;\n\n    if( p->iDoclistToken<iToken ){\n      pLeft = p->doclist.aAll;\n      nLeft = p->doclist.nAll;\n      pRight = pList;\n      nRight = nList;\n      nDiff = iToken - p->iDoclistToken;\n    }else{\n      pRight = p->doclist.aAll;\n      nRight = p->doclist.nAll;\n      pLeft = pList;\n      nLeft = nList;\n      nDiff = p->iDoclistToken - iToken;\n    }\n\n    rc = fts3DoclistPhraseMerge(\n        pTab->bDescIdx, nDiff, pLeft, nLeft, &pRight, &nRight\n    );\n    sqlite3_free(pLeft);\n    p->doclist.aAll = pRight;\n    p->doclist.nAll = nRight;\n  }\n\n  if( iToken>p->iDoclistToken ) p->iDoclistToken = iToken;\n  return rc;\n}\n\n/*\n** Load the doclist for phrase p into p->doclist.aAll/nAll. The loaded doclist\n** does not take deferred tokens into account.\n**\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\n*/\nstatic int fts3EvalPhraseLoad(\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\n  Fts3Phrase *p                   /* Phrase object */\n){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int iToken;\n  int rc = SQLITE_OK;\n\n  for(iToken=0; rc==SQLITE_OK && iToken<p->nToken; iToken++){\n    Fts3PhraseToken *pToken = &p->aToken[iToken];\n    assert( pToken->pDeferred==0 || pToken->pSegcsr==0 );\n\n    if( pToken->pSegcsr ){\n      int nThis = 0;\n      char *pThis = 0;\n      rc = fts3TermSelect(pTab, pToken, p->iColumn, &nThis, &pThis);\n      if( rc==SQLITE_OK ){\n        rc = fts3EvalPhraseMergeToken(pTab, p, iToken, pThis, nThis);\n      }\n    }\n    assert( pToken->pSegcsr==0 );\n  }\n\n  return rc;\n}\n\n/*\n** This function is called on each phrase after the position lists for\n** any deferred tokens have been loaded into memory. It updates the phrases\n** current position list to include only those positions that are really\n** instances of the phrase (after considering deferred tokens). If this\n** means that the phrase does not appear in the current row, doclist.pList\n** and doclist.nList are both zeroed.\n**\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\n*/\nstatic int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){\n  int iToken;                     /* Used to iterate through phrase tokens */\n  char *aPoslist = 0;             /* Position list for deferred tokens */\n  int nPoslist = 0;               /* Number of bytes in aPoslist */\n  int iPrev = -1;                 /* Token number of previous deferred token */\n\n  assert( pPhrase->doclist.bFreeList==0 );\n\n  for(iToken=0; iToken<pPhrase->nToken; iToken++){\n    Fts3PhraseToken *pToken = &pPhrase->aToken[iToken];\n    Fts3DeferredToken *pDeferred = pToken->pDeferred;\n\n    if( pDeferred ){\n      char *pList;\n      int nList;\n      int rc = sqlite3Fts3DeferredTokenList(pDeferred, &pList, &nList);\n      if( rc!=SQLITE_OK ) return rc;\n\n      if( pList==0 ){\n        sqlite3_free(aPoslist);\n        pPhrase->doclist.pList = 0;\n        pPhrase->doclist.nList = 0;\n        return SQLITE_OK;\n\n      }else if( aPoslist==0 ){\n        aPoslist = pList;\n        nPoslist = nList;\n\n      }else{\n        char *aOut = pList;\n        char *p1 = aPoslist;\n        char *p2 = aOut;\n\n        assert( iPrev>=0 );\n        fts3PoslistPhraseMerge(&aOut, iToken-iPrev, 0, 1, &p1, &p2);\n        sqlite3_free(aPoslist);\n        aPoslist = pList;\n        nPoslist = (int)(aOut - aPoslist);\n        if( nPoslist==0 ){\n          sqlite3_free(aPoslist);\n          pPhrase->doclist.pList = 0;\n          pPhrase->doclist.nList = 0;\n          return SQLITE_OK;\n        }\n      }\n      iPrev = iToken;\n    }\n  }\n\n  if( iPrev>=0 ){\n    int nMaxUndeferred = pPhrase->iDoclistToken;\n    if( nMaxUndeferred<0 ){\n      pPhrase->doclist.pList = aPoslist;\n      pPhrase->doclist.nList = nPoslist;\n      pPhrase->doclist.iDocid = pCsr->iPrevId;\n      pPhrase->doclist.bFreeList = 1;\n    }else{\n      int nDistance;\n      char *p1;\n      char *p2;\n      char *aOut;\n\n      if( nMaxUndeferred>iPrev ){\n        p1 = aPoslist;\n        p2 = pPhrase->doclist.pList;\n        nDistance = nMaxUndeferred - iPrev;\n      }else{\n        p1 = pPhrase->doclist.pList;\n        p2 = aPoslist;\n        nDistance = iPrev - nMaxUndeferred;\n      }\n\n      aOut = (char *)sqlite3_malloc(nPoslist+8);\n      if( !aOut ){\n        sqlite3_free(aPoslist);\n        return SQLITE_NOMEM;\n      }\n      \n      pPhrase->doclist.pList = aOut;\n      if( fts3PoslistPhraseMerge(&aOut, nDistance, 0, 1, &p1, &p2) ){\n        pPhrase->doclist.bFreeList = 1;\n        pPhrase->doclist.nList = (int)(aOut - pPhrase->doclist.pList);\n      }else{\n        sqlite3_free(aOut);\n        pPhrase->doclist.pList = 0;\n        pPhrase->doclist.nList = 0;\n      }\n      sqlite3_free(aPoslist);\n    }\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Maximum number of tokens a phrase may have to be considered for the\n** incremental doclists strategy.\n*/\n#define MAX_INCR_PHRASE_TOKENS 4\n\n/*\n** This function is called for each Fts3Phrase in a full-text query \n** expression to initialize the mechanism for returning rows. Once this\n** function has been called successfully on an Fts3Phrase, it may be\n** used with fts3EvalPhraseNext() to iterate through the matching docids.\n**\n** If parameter bOptOk is true, then the phrase may (or may not) use the\n** incremental loading strategy. Otherwise, the entire doclist is loaded into\n** memory within this call.\n**\n** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code.\n*/\nstatic int fts3EvalPhraseStart(Fts3Cursor *pCsr, int bOptOk, Fts3Phrase *p){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int rc = SQLITE_OK;             /* Error code */\n  int i;\n\n  /* Determine if doclists may be loaded from disk incrementally. This is\n  ** possible if the bOptOk argument is true, the FTS doclists will be\n  ** scanned in forward order, and the phrase consists of \n  ** MAX_INCR_PHRASE_TOKENS or fewer tokens, none of which are are \"^first\"\n  ** tokens or prefix tokens that cannot use a prefix-index.  */\n  int bHaveIncr = 0;\n  int bIncrOk = (bOptOk \n   && pCsr->bDesc==pTab->bDescIdx \n   && p->nToken<=MAX_INCR_PHRASE_TOKENS && p->nToken>0\n#ifdef SQLITE_TEST\n   && pTab->bNoIncrDoclist==0\n#endif\n  );\n  for(i=0; bIncrOk==1 && i<p->nToken; i++){\n    Fts3PhraseToken *pToken = &p->aToken[i];\n    if( pToken->bFirst || (pToken->pSegcsr!=0 && !pToken->pSegcsr->bLookup) ){\n      bIncrOk = 0;\n    }\n    if( pToken->pSegcsr ) bHaveIncr = 1;\n  }\n\n  if( bIncrOk && bHaveIncr ){\n    /* Use the incremental approach. */\n    int iCol = (p->iColumn >= pTab->nColumn ? -1 : p->iColumn);\n    for(i=0; rc==SQLITE_OK && i<p->nToken; i++){\n      Fts3PhraseToken *pToken = &p->aToken[i];\n      Fts3MultiSegReader *pSegcsr = pToken->pSegcsr;\n      if( pSegcsr ){\n        rc = sqlite3Fts3MsrIncrStart(pTab, pSegcsr, iCol, pToken->z, pToken->n);\n      }\n    }\n    p->bIncr = 1;\n  }else{\n    /* Load the full doclist for the phrase into memory. */\n    rc = fts3EvalPhraseLoad(pCsr, p);\n    p->bIncr = 0;\n  }\n\n  assert( rc!=SQLITE_OK || p->nToken<1 || p->aToken[0].pSegcsr==0 || p->bIncr );\n  return rc;\n}\n\n/*\n** This function is used to iterate backwards (from the end to start) \n** through doclists. It is used by this module to iterate through phrase\n** doclists in reverse and by the fts3_write.c module to iterate through\n** pending-terms lists when writing to databases with \"order=desc\".\n**\n** The doclist may be sorted in ascending (parameter bDescIdx==0) or \n** descending (parameter bDescIdx==1) order of docid. Regardless, this\n** function iterates from the end of the doclist to the beginning.\n*/\nvoid sqlite3Fts3DoclistPrev(\n  int bDescIdx,                   /* True if the doclist is desc */\n  char *aDoclist,                 /* Pointer to entire doclist */\n  int nDoclist,                   /* Length of aDoclist in bytes */\n  char **ppIter,                  /* IN/OUT: Iterator pointer */\n  sqlite3_int64 *piDocid,         /* IN/OUT: Docid pointer */\n  int *pnList,                    /* OUT: List length pointer */\n  u8 *pbEof                       /* OUT: End-of-file flag */\n){\n  char *p = *ppIter;\n\n  assert( nDoclist>0 );\n  assert( *pbEof==0 );\n  assert( p || *piDocid==0 );\n  assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) );\n\n  if( p==0 ){\n    sqlite3_int64 iDocid = 0;\n    char *pNext = 0;\n    char *pDocid = aDoclist;\n    char *pEnd = &aDoclist[nDoclist];\n    int iMul = 1;\n\n    while( pDocid<pEnd ){\n      sqlite3_int64 iDelta;\n      pDocid += sqlite3Fts3GetVarint(pDocid, &iDelta);\n      iDocid += (iMul * iDelta);\n      pNext = pDocid;\n      fts3PoslistCopy(0, &pDocid);\n      while( pDocid<pEnd && *pDocid==0 ) pDocid++;\n      iMul = (bDescIdx ? -1 : 1);\n    }\n\n    *pnList = (int)(pEnd - pNext);\n    *ppIter = pNext;\n    *piDocid = iDocid;\n  }else{\n    int iMul = (bDescIdx ? -1 : 1);\n    sqlite3_int64 iDelta;\n    fts3GetReverseVarint(&p, aDoclist, &iDelta);\n    *piDocid -= (iMul * iDelta);\n\n    if( p==aDoclist ){\n      *pbEof = 1;\n    }else{\n      char *pSave = p;\n      fts3ReversePoslist(aDoclist, &p);\n      *pnList = (int)(pSave - p);\n    }\n    *ppIter = p;\n  }\n}\n\n/*\n** Iterate forwards through a doclist.\n*/\nvoid sqlite3Fts3DoclistNext(\n  int bDescIdx,                   /* True if the doclist is desc */\n  char *aDoclist,                 /* Pointer to entire doclist */\n  int nDoclist,                   /* Length of aDoclist in bytes */\n  char **ppIter,                  /* IN/OUT: Iterator pointer */\n  sqlite3_int64 *piDocid,         /* IN/OUT: Docid pointer */\n  u8 *pbEof                       /* OUT: End-of-file flag */\n){\n  char *p = *ppIter;\n\n  assert( nDoclist>0 );\n  assert( *pbEof==0 );\n  assert( p || *piDocid==0 );\n  assert( !p || (p>=aDoclist && p<=&aDoclist[nDoclist]) );\n\n  if( p==0 ){\n    p = aDoclist;\n    p += sqlite3Fts3GetVarint(p, piDocid);\n  }else{\n    fts3PoslistCopy(0, &p);\n    while( p<&aDoclist[nDoclist] && *p==0 ) p++; \n    if( p>=&aDoclist[nDoclist] ){\n      *pbEof = 1;\n    }else{\n      sqlite3_int64 iVar;\n      p += sqlite3Fts3GetVarint(p, &iVar);\n      *piDocid += ((bDescIdx ? -1 : 1) * iVar);\n    }\n  }\n\n  *ppIter = p;\n}\n\n/*\n** Advance the iterator pDL to the next entry in pDL->aAll/nAll. Set *pbEof\n** to true if EOF is reached.\n*/\nstatic void fts3EvalDlPhraseNext(\n  Fts3Table *pTab,\n  Fts3Doclist *pDL,\n  u8 *pbEof\n){\n  char *pIter;                            /* Used to iterate through aAll */\n  char *pEnd = &pDL->aAll[pDL->nAll];     /* 1 byte past end of aAll */\n \n  if( pDL->pNextDocid ){\n    pIter = pDL->pNextDocid;\n  }else{\n    pIter = pDL->aAll;\n  }\n\n  if( pIter>=pEnd ){\n    /* We have already reached the end of this doclist. EOF. */\n    *pbEof = 1;\n  }else{\n    sqlite3_int64 iDelta;\n    pIter += sqlite3Fts3GetVarint(pIter, &iDelta);\n    if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){\n      pDL->iDocid += iDelta;\n    }else{\n      pDL->iDocid -= iDelta;\n    }\n    pDL->pList = pIter;\n    fts3PoslistCopy(0, &pIter);\n    pDL->nList = (int)(pIter - pDL->pList);\n\n    /* pIter now points just past the 0x00 that terminates the position-\n    ** list for document pDL->iDocid. However, if this position-list was\n    ** edited in place by fts3EvalNearTrim(), then pIter may not actually\n    ** point to the start of the next docid value. The following line deals\n    ** with this case by advancing pIter past the zero-padding added by\n    ** fts3EvalNearTrim().  */\n    while( pIter<pEnd && *pIter==0 ) pIter++;\n\n    pDL->pNextDocid = pIter;\n    assert( pIter>=&pDL->aAll[pDL->nAll] || *pIter );\n    *pbEof = 0;\n  }\n}\n\n/*\n** Helper type used by fts3EvalIncrPhraseNext() and incrPhraseTokenNext().\n*/\ntypedef struct TokenDoclist TokenDoclist;\nstruct TokenDoclist {\n  int bIgnore;\n  sqlite3_int64 iDocid;\n  char *pList;\n  int nList;\n};\n\n/*\n** Token pToken is an incrementally loaded token that is part of a \n** multi-token phrase. Advance it to the next matching document in the\n** database and populate output variable *p with the details of the new\n** entry. Or, if the iterator has reached EOF, set *pbEof to true.\n**\n** If an error occurs, return an SQLite error code. Otherwise, return \n** SQLITE_OK.\n*/\nstatic int incrPhraseTokenNext(\n  Fts3Table *pTab,                /* Virtual table handle */\n  Fts3Phrase *pPhrase,            /* Phrase to advance token of */\n  int iToken,                     /* Specific token to advance */\n  TokenDoclist *p,                /* OUT: Docid and doclist for new entry */\n  u8 *pbEof                       /* OUT: True if iterator is at EOF */\n){\n  int rc = SQLITE_OK;\n\n  if( pPhrase->iDoclistToken==iToken ){\n    assert( p->bIgnore==0 );\n    assert( pPhrase->aToken[iToken].pSegcsr==0 );\n    fts3EvalDlPhraseNext(pTab, &pPhrase->doclist, pbEof);\n    p->pList = pPhrase->doclist.pList;\n    p->nList = pPhrase->doclist.nList;\n    p->iDocid = pPhrase->doclist.iDocid;\n  }else{\n    Fts3PhraseToken *pToken = &pPhrase->aToken[iToken];\n    assert( pToken->pDeferred==0 );\n    assert( pToken->pSegcsr || pPhrase->iDoclistToken>=0 );\n    if( pToken->pSegcsr ){\n      assert( p->bIgnore==0 );\n      rc = sqlite3Fts3MsrIncrNext(\n          pTab, pToken->pSegcsr, &p->iDocid, &p->pList, &p->nList\n      );\n      if( p->pList==0 ) *pbEof = 1;\n    }else{\n      p->bIgnore = 1;\n    }\n  }\n\n  return rc;\n}\n\n\n/*\n** The phrase iterator passed as the second argument:\n**\n**   * features at least one token that uses an incremental doclist, and \n**\n**   * does not contain any deferred tokens.\n**\n** Advance it to the next matching documnent in the database and populate\n** the Fts3Doclist.pList and nList fields. \n**\n** If there is no \"next\" entry and no error occurs, then *pbEof is set to\n** 1 before returning. Otherwise, if no error occurs and the iterator is\n** successfully advanced, *pbEof is set to 0.\n**\n** If an error occurs, return an SQLite error code. Otherwise, return \n** SQLITE_OK.\n*/\nstatic int fts3EvalIncrPhraseNext(\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\n  Fts3Phrase *p,                  /* Phrase object to advance to next docid */\n  u8 *pbEof                       /* OUT: Set to 1 if EOF */\n){\n  int rc = SQLITE_OK;\n  Fts3Doclist *pDL = &p->doclist;\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  u8 bEof = 0;\n\n  /* This is only called if it is guaranteed that the phrase has at least\n  ** one incremental token. In which case the bIncr flag is set. */\n  assert( p->bIncr==1 );\n\n  if( p->nToken==1 && p->bIncr ){\n    rc = sqlite3Fts3MsrIncrNext(pTab, p->aToken[0].pSegcsr, \n        &pDL->iDocid, &pDL->pList, &pDL->nList\n    );\n    if( pDL->pList==0 ) bEof = 1;\n  }else{\n    int bDescDoclist = pCsr->bDesc;\n    struct TokenDoclist a[MAX_INCR_PHRASE_TOKENS];\n\n    memset(a, 0, sizeof(a));\n    assert( p->nToken<=MAX_INCR_PHRASE_TOKENS );\n    assert( p->iDoclistToken<MAX_INCR_PHRASE_TOKENS );\n\n    while( bEof==0 ){\n      int bMaxSet = 0;\n      sqlite3_int64 iMax = 0;     /* Largest docid for all iterators */\n      int i;                      /* Used to iterate through tokens */\n\n      /* Advance the iterator for each token in the phrase once. */\n      for(i=0; rc==SQLITE_OK && i<p->nToken && bEof==0; i++){\n        rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof);\n        if( a[i].bIgnore==0 && (bMaxSet==0 || DOCID_CMP(iMax, a[i].iDocid)<0) ){\n          iMax = a[i].iDocid;\n          bMaxSet = 1;\n        }\n      }\n      assert( rc!=SQLITE_OK || (p->nToken>=1 && a[p->nToken-1].bIgnore==0) );\n      assert( rc!=SQLITE_OK || bMaxSet );\n\n      /* Keep advancing iterators until they all point to the same document */\n      for(i=0; i<p->nToken; i++){\n        while( rc==SQLITE_OK && bEof==0 \n            && a[i].bIgnore==0 && DOCID_CMP(a[i].iDocid, iMax)<0 \n        ){\n          rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof);\n          if( DOCID_CMP(a[i].iDocid, iMax)>0 ){\n            iMax = a[i].iDocid;\n            i = 0;\n          }\n        }\n      }\n\n      /* Check if the current entries really are a phrase match */\n      if( bEof==0 ){\n        int nList = 0;\n        int nByte = a[p->nToken-1].nList;\n        char *aDoclist = sqlite3_malloc(nByte+1);\n        if( !aDoclist ) return SQLITE_NOMEM;\n        memcpy(aDoclist, a[p->nToken-1].pList, nByte+1);\n\n        for(i=0; i<(p->nToken-1); i++){\n          if( a[i].bIgnore==0 ){\n            char *pL = a[i].pList;\n            char *pR = aDoclist;\n            char *pOut = aDoclist;\n            int nDist = p->nToken-1-i;\n            int res = fts3PoslistPhraseMerge(&pOut, nDist, 0, 1, &pL, &pR);\n            if( res==0 ) break;\n            nList = (int)(pOut - aDoclist);\n          }\n        }\n        if( i==(p->nToken-1) ){\n          pDL->iDocid = iMax;\n          pDL->pList = aDoclist;\n          pDL->nList = nList;\n          pDL->bFreeList = 1;\n          break;\n        }\n        sqlite3_free(aDoclist);\n      }\n    }\n  }\n\n  *pbEof = bEof;\n  return rc;\n}\n\n/*\n** Attempt to move the phrase iterator to point to the next matching docid. \n** If an error occurs, return an SQLite error code. Otherwise, return \n** SQLITE_OK.\n**\n** If there is no \"next\" entry and no error occurs, then *pbEof is set to\n** 1 before returning. Otherwise, if no error occurs and the iterator is\n** successfully advanced, *pbEof is set to 0.\n*/\nstatic int fts3EvalPhraseNext(\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\n  Fts3Phrase *p,                  /* Phrase object to advance to next docid */\n  u8 *pbEof                       /* OUT: Set to 1 if EOF */\n){\n  int rc = SQLITE_OK;\n  Fts3Doclist *pDL = &p->doclist;\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n\n  if( p->bIncr ){\n    rc = fts3EvalIncrPhraseNext(pCsr, p, pbEof);\n  }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){\n    sqlite3Fts3DoclistPrev(pTab->bDescIdx, pDL->aAll, pDL->nAll, \n        &pDL->pNextDocid, &pDL->iDocid, &pDL->nList, pbEof\n    );\n    pDL->pList = pDL->pNextDocid;\n  }else{\n    fts3EvalDlPhraseNext(pTab, pDL, pbEof);\n  }\n\n  return rc;\n}\n\n/*\n**\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\n** Otherwise, fts3EvalPhraseStart() is called on all phrases within the\n** expression. Also the Fts3Expr.bDeferred variable is set to true for any\n** expressions for which all descendent tokens are deferred.\n**\n** If parameter bOptOk is zero, then it is guaranteed that the\n** Fts3Phrase.doclist.aAll/nAll variables contain the entire doclist for\n** each phrase in the expression (subject to deferred token processing).\n** Or, if bOptOk is non-zero, then one or more tokens within the expression\n** may be loaded incrementally, meaning doclist.aAll/nAll is not available.\n**\n** If an error occurs within this function, *pRc is set to an SQLite error\n** code before returning.\n*/\nstatic void fts3EvalStartReaders(\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\n  Fts3Expr *pExpr,                /* Expression to initialize phrases in */\n  int *pRc                        /* IN/OUT: Error code */\n){\n  if( pExpr && SQLITE_OK==*pRc ){\n    if( pExpr->eType==FTSQUERY_PHRASE ){\n      int nToken = pExpr->pPhrase->nToken;\n      if( nToken ){\n        int i;\n        for(i=0; i<nToken; i++){\n          if( pExpr->pPhrase->aToken[i].pDeferred==0 ) break;\n        }\n        pExpr->bDeferred = (i==nToken);\n      }\n      *pRc = fts3EvalPhraseStart(pCsr, 1, pExpr->pPhrase);\n    }else{\n      fts3EvalStartReaders(pCsr, pExpr->pLeft, pRc);\n      fts3EvalStartReaders(pCsr, pExpr->pRight, pRc);\n      pExpr->bDeferred = (pExpr->pLeft->bDeferred && pExpr->pRight->bDeferred);\n    }\n  }\n}\n\n/*\n** An array of the following structures is assembled as part of the process\n** of selecting tokens to defer before the query starts executing (as part\n** of the xFilter() method). There is one element in the array for each\n** token in the FTS expression.\n**\n** Tokens are divided into AND/NEAR clusters. All tokens in a cluster belong\n** to phrases that are connected only by AND and NEAR operators (not OR or\n** NOT). When determining tokens to defer, each AND/NEAR cluster is considered\n** separately. The root of a tokens AND/NEAR cluster is stored in \n** Fts3TokenAndCost.pRoot.\n*/\ntypedef struct Fts3TokenAndCost Fts3TokenAndCost;\nstruct Fts3TokenAndCost {\n  Fts3Phrase *pPhrase;            /* The phrase the token belongs to */\n  int iToken;                     /* Position of token in phrase */\n  Fts3PhraseToken *pToken;        /* The token itself */\n  Fts3Expr *pRoot;                /* Root of NEAR/AND cluster */\n  int nOvfl;                      /* Number of overflow pages to load doclist */\n  int iCol;                       /* The column the token must match */\n};\n\n/*\n** This function is used to populate an allocated Fts3TokenAndCost array.\n**\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\n** Otherwise, if an error occurs during execution, *pRc is set to an\n** SQLite error code.\n*/\nstatic void fts3EvalTokenCosts(\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\n  Fts3Expr *pRoot,                /* Root of current AND/NEAR cluster */\n  Fts3Expr *pExpr,                /* Expression to consider */\n  Fts3TokenAndCost **ppTC,        /* Write new entries to *(*ppTC)++ */\n  Fts3Expr ***ppOr,               /* Write new OR root to *(*ppOr)++ */\n  int *pRc                        /* IN/OUT: Error code */\n){\n  if( *pRc==SQLITE_OK ){\n    if( pExpr->eType==FTSQUERY_PHRASE ){\n      Fts3Phrase *pPhrase = pExpr->pPhrase;\n      int i;\n      for(i=0; *pRc==SQLITE_OK && i<pPhrase->nToken; i++){\n        Fts3TokenAndCost *pTC = (*ppTC)++;\n        pTC->pPhrase = pPhrase;\n        pTC->iToken = i;\n        pTC->pRoot = pRoot;\n        pTC->pToken = &pPhrase->aToken[i];\n        pTC->iCol = pPhrase->iColumn;\n        *pRc = sqlite3Fts3MsrOvfl(pCsr, pTC->pToken->pSegcsr, &pTC->nOvfl);\n      }\n    }else if( pExpr->eType!=FTSQUERY_NOT ){\n      assert( pExpr->eType==FTSQUERY_OR\n           || pExpr->eType==FTSQUERY_AND\n           || pExpr->eType==FTSQUERY_NEAR\n      );\n      assert( pExpr->pLeft && pExpr->pRight );\n      if( pExpr->eType==FTSQUERY_OR ){\n        pRoot = pExpr->pLeft;\n        **ppOr = pRoot;\n        (*ppOr)++;\n      }\n      fts3EvalTokenCosts(pCsr, pRoot, pExpr->pLeft, ppTC, ppOr, pRc);\n      if( pExpr->eType==FTSQUERY_OR ){\n        pRoot = pExpr->pRight;\n        **ppOr = pRoot;\n        (*ppOr)++;\n      }\n      fts3EvalTokenCosts(pCsr, pRoot, pExpr->pRight, ppTC, ppOr, pRc);\n    }\n  }\n}\n\n/*\n** Determine the average document (row) size in pages. If successful,\n** write this value to *pnPage and return SQLITE_OK. Otherwise, return\n** an SQLite error code.\n**\n** The average document size in pages is calculated by first calculating \n** determining the average size in bytes, B. If B is less than the amount\n** of data that will fit on a single leaf page of an intkey table in\n** this database, then the average docsize is 1. Otherwise, it is 1 plus\n** the number of overflow pages consumed by a record B bytes in size.\n*/\nstatic int fts3EvalAverageDocsize(Fts3Cursor *pCsr, int *pnPage){\n  if( pCsr->nRowAvg==0 ){\n    /* The average document size, which is required to calculate the cost\n    ** of each doclist, has not yet been determined. Read the required \n    ** data from the %_stat table to calculate it.\n    **\n    ** Entry 0 of the %_stat table is a blob containing (nCol+1) FTS3 \n    ** varints, where nCol is the number of columns in the FTS3 table.\n    ** The first varint is the number of documents currently stored in\n    ** the table. The following nCol varints contain the total amount of\n    ** data stored in all rows of each column of the table, from left\n    ** to right.\n    */\n    int rc;\n    Fts3Table *p = (Fts3Table*)pCsr->base.pVtab;\n    sqlite3_stmt *pStmt;\n    sqlite3_int64 nDoc = 0;\n    sqlite3_int64 nByte = 0;\n    const char *pEnd;\n    const char *a;\n\n    rc = sqlite3Fts3SelectDoctotal(p, &pStmt);\n    if( rc!=SQLITE_OK ) return rc;\n    a = sqlite3_column_blob(pStmt, 0);\n    assert( a );\n\n    pEnd = &a[sqlite3_column_bytes(pStmt, 0)];\n    a += sqlite3Fts3GetVarint(a, &nDoc);\n    while( a<pEnd ){\n      a += sqlite3Fts3GetVarint(a, &nByte);\n    }\n    if( nDoc==0 || nByte==0 ){\n      sqlite3_reset(pStmt);\n      return FTS_CORRUPT_VTAB;\n    }\n\n    pCsr->nDoc = nDoc;\n    pCsr->nRowAvg = (int)(((nByte / nDoc) + p->nPgsz) / p->nPgsz);\n    assert( pCsr->nRowAvg>0 ); \n    rc = sqlite3_reset(pStmt);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n\n  *pnPage = pCsr->nRowAvg;\n  return SQLITE_OK;\n}\n\n/*\n** This function is called to select the tokens (if any) that will be \n** deferred. The array aTC[] has already been populated when this is\n** called.\n**\n** This function is called once for each AND/NEAR cluster in the \n** expression. Each invocation determines which tokens to defer within\n** the cluster with root node pRoot. See comments above the definition\n** of struct Fts3TokenAndCost for more details.\n**\n** If no error occurs, SQLITE_OK is returned and sqlite3Fts3DeferToken()\n** called on each token to defer. Otherwise, an SQLite error code is\n** returned.\n*/\nstatic int fts3EvalSelectDeferred(\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\n  Fts3Expr *pRoot,                /* Consider tokens with this root node */\n  Fts3TokenAndCost *aTC,          /* Array of expression tokens and costs */\n  int nTC                         /* Number of entries in aTC[] */\n){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int nDocSize = 0;               /* Number of pages per doc loaded */\n  int rc = SQLITE_OK;             /* Return code */\n  int ii;                         /* Iterator variable for various purposes */\n  int nOvfl = 0;                  /* Total overflow pages used by doclists */\n  int nToken = 0;                 /* Total number of tokens in cluster */\n\n  int nMinEst = 0;                /* The minimum count for any phrase so far. */\n  int nLoad4 = 1;                 /* (Phrases that will be loaded)^4. */\n\n  /* Tokens are never deferred for FTS tables created using the content=xxx\n  ** option. The reason being that it is not guaranteed that the content\n  ** table actually contains the same data as the index. To prevent this from\n  ** causing any problems, the deferred token optimization is completely\n  ** disabled for content=xxx tables. */\n  if( pTab->zContentTbl ){\n    return SQLITE_OK;\n  }\n\n  /* Count the tokens in this AND/NEAR cluster. If none of the doclists\n  ** associated with the tokens spill onto overflow pages, or if there is\n  ** only 1 token, exit early. No tokens to defer in this case. */\n  for(ii=0; ii<nTC; ii++){\n    if( aTC[ii].pRoot==pRoot ){\n      nOvfl += aTC[ii].nOvfl;\n      nToken++;\n    }\n  }\n  if( nOvfl==0 || nToken<2 ) return SQLITE_OK;\n\n  /* Obtain the average docsize (in pages). */\n  rc = fts3EvalAverageDocsize(pCsr, &nDocSize);\n  assert( rc!=SQLITE_OK || nDocSize>0 );\n\n\n  /* Iterate through all tokens in this AND/NEAR cluster, in ascending order \n  ** of the number of overflow pages that will be loaded by the pager layer \n  ** to retrieve the entire doclist for the token from the full-text index.\n  ** Load the doclists for tokens that are either:\n  **\n  **   a. The cheapest token in the entire query (i.e. the one visited by the\n  **      first iteration of this loop), or\n  **\n  **   b. Part of a multi-token phrase.\n  **\n  ** After each token doclist is loaded, merge it with the others from the\n  ** same phrase and count the number of documents that the merged doclist\n  ** contains. Set variable \"nMinEst\" to the smallest number of documents in \n  ** any phrase doclist for which 1 or more token doclists have been loaded.\n  ** Let nOther be the number of other phrases for which it is certain that\n  ** one or more tokens will not be deferred.\n  **\n  ** Then, for each token, defer it if loading the doclist would result in\n  ** loading N or more overflow pages into memory, where N is computed as:\n  **\n  **    (nMinEst + 4^nOther - 1) / (4^nOther)\n  */\n  for(ii=0; ii<nToken && rc==SQLITE_OK; ii++){\n    int iTC;                      /* Used to iterate through aTC[] array. */\n    Fts3TokenAndCost *pTC = 0;    /* Set to cheapest remaining token. */\n\n    /* Set pTC to point to the cheapest remaining token. */\n    for(iTC=0; iTC<nTC; iTC++){\n      if( aTC[iTC].pToken && aTC[iTC].pRoot==pRoot \n       && (!pTC || aTC[iTC].nOvfl<pTC->nOvfl) \n      ){\n        pTC = &aTC[iTC];\n      }\n    }\n    assert( pTC );\n\n    if( ii && pTC->nOvfl>=((nMinEst+(nLoad4/4)-1)/(nLoad4/4))*nDocSize ){\n      /* The number of overflow pages to load for this (and therefore all\n      ** subsequent) tokens is greater than the estimated number of pages \n      ** that will be loaded if all subsequent tokens are deferred.\n      */\n      Fts3PhraseToken *pToken = pTC->pToken;\n      rc = sqlite3Fts3DeferToken(pCsr, pToken, pTC->iCol);\n      fts3SegReaderCursorFree(pToken->pSegcsr);\n      pToken->pSegcsr = 0;\n    }else{\n      /* Set nLoad4 to the value of (4^nOther) for the next iteration of the\n      ** for-loop. Except, limit the value to 2^24 to prevent it from \n      ** overflowing the 32-bit integer it is stored in. */\n      if( ii<12 ) nLoad4 = nLoad4*4;\n\n      if( ii==0 || (pTC->pPhrase->nToken>1 && ii!=nToken-1) ){\n        /* Either this is the cheapest token in the entire query, or it is\n        ** part of a multi-token phrase. Either way, the entire doclist will\n        ** (eventually) be loaded into memory. It may as well be now. */\n        Fts3PhraseToken *pToken = pTC->pToken;\n        int nList = 0;\n        char *pList = 0;\n        rc = fts3TermSelect(pTab, pToken, pTC->iCol, &nList, &pList);\n        assert( rc==SQLITE_OK || pList==0 );\n        if( rc==SQLITE_OK ){\n          rc = fts3EvalPhraseMergeToken(\n              pTab, pTC->pPhrase, pTC->iToken,pList,nList\n          );\n        }\n        if( rc==SQLITE_OK ){\n          int nCount;\n          nCount = fts3DoclistCountDocids(\n              pTC->pPhrase->doclist.aAll, pTC->pPhrase->doclist.nAll\n          );\n          if( ii==0 || nCount<nMinEst ) nMinEst = nCount;\n        }\n      }\n    }\n    pTC->pToken = 0;\n  }\n\n  return rc;\n}\n\n/*\n** This function is called from within the xFilter method. It initializes\n** the full-text query currently stored in pCsr->pExpr. To iterate through\n** the results of a query, the caller does:\n**\n**    fts3EvalStart(pCsr);\n**    while( 1 ){\n**      fts3EvalNext(pCsr);\n**      if( pCsr->bEof ) break;\n**      ... return row pCsr->iPrevId to the caller ...\n**    }\n*/\nstatic int fts3EvalStart(Fts3Cursor *pCsr){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int rc = SQLITE_OK;\n  int nToken = 0;\n  int nOr = 0;\n\n  /* Allocate a MultiSegReader for each token in the expression. */\n  fts3EvalAllocateReaders(pCsr, pCsr->pExpr, &nToken, &nOr, &rc);\n\n  /* Determine which, if any, tokens in the expression should be deferred. */\n#ifndef SQLITE_DISABLE_FTS4_DEFERRED\n  if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){\n    Fts3TokenAndCost *aTC;\n    Fts3Expr **apOr;\n    aTC = (Fts3TokenAndCost *)sqlite3_malloc(\n        sizeof(Fts3TokenAndCost) * nToken\n      + sizeof(Fts3Expr *) * nOr * 2\n    );\n    apOr = (Fts3Expr **)&aTC[nToken];\n\n    if( !aTC ){\n      rc = SQLITE_NOMEM;\n    }else{\n      int ii;\n      Fts3TokenAndCost *pTC = aTC;\n      Fts3Expr **ppOr = apOr;\n\n      fts3EvalTokenCosts(pCsr, 0, pCsr->pExpr, &pTC, &ppOr, &rc);\n      nToken = (int)(pTC-aTC);\n      nOr = (int)(ppOr-apOr);\n\n      if( rc==SQLITE_OK ){\n        rc = fts3EvalSelectDeferred(pCsr, 0, aTC, nToken);\n        for(ii=0; rc==SQLITE_OK && ii<nOr; ii++){\n          rc = fts3EvalSelectDeferred(pCsr, apOr[ii], aTC, nToken);\n        }\n      }\n\n      sqlite3_free(aTC);\n    }\n  }\n#endif\n\n  fts3EvalStartReaders(pCsr, pCsr->pExpr, &rc);\n  return rc;\n}\n\n/*\n** Invalidate the current position list for phrase pPhrase.\n*/\nstatic void fts3EvalInvalidatePoslist(Fts3Phrase *pPhrase){\n  if( pPhrase->doclist.bFreeList ){\n    sqlite3_free(pPhrase->doclist.pList);\n  }\n  pPhrase->doclist.pList = 0;\n  pPhrase->doclist.nList = 0;\n  pPhrase->doclist.bFreeList = 0;\n}\n\n/*\n** This function is called to edit the position list associated with\n** the phrase object passed as the fifth argument according to a NEAR\n** condition. For example:\n**\n**     abc NEAR/5 \"def ghi\"\n**\n** Parameter nNear is passed the NEAR distance of the expression (5 in\n** the example above). When this function is called, *paPoslist points to\n** the position list, and *pnToken is the number of phrase tokens in, the\n** phrase on the other side of the NEAR operator to pPhrase. For example,\n** if pPhrase refers to the \"def ghi\" phrase, then *paPoslist points to\n** the position list associated with phrase \"abc\".\n**\n** All positions in the pPhrase position list that are not sufficiently\n** close to a position in the *paPoslist position list are removed. If this\n** leaves 0 positions, zero is returned. Otherwise, non-zero.\n**\n** Before returning, *paPoslist is set to point to the position lsit \n** associated with pPhrase. And *pnToken is set to the number of tokens in\n** pPhrase.\n*/\nstatic int fts3EvalNearTrim(\n  int nNear,                      /* NEAR distance. As in \"NEAR/nNear\". */\n  char *aTmp,                     /* Temporary space to use */\n  char **paPoslist,               /* IN/OUT: Position list */\n  int *pnToken,                   /* IN/OUT: Tokens in phrase of *paPoslist */\n  Fts3Phrase *pPhrase             /* The phrase object to trim the doclist of */\n){\n  int nParam1 = nNear + pPhrase->nToken;\n  int nParam2 = nNear + *pnToken;\n  int nNew;\n  char *p2; \n  char *pOut; \n  int res;\n\n  assert( pPhrase->doclist.pList );\n\n  p2 = pOut = pPhrase->doclist.pList;\n  res = fts3PoslistNearMerge(\n    &pOut, aTmp, nParam1, nParam2, paPoslist, &p2\n  );\n  if( res ){\n    nNew = (int)(pOut - pPhrase->doclist.pList) - 1;\n    assert( pPhrase->doclist.pList[nNew]=='\\0' );\n    assert( nNew<=pPhrase->doclist.nList && nNew>0 );\n    memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew);\n    pPhrase->doclist.nList = nNew;\n    *paPoslist = pPhrase->doclist.pList;\n    *pnToken = pPhrase->nToken;\n  }\n\n  return res;\n}\n\n/*\n** This function is a no-op if *pRc is other than SQLITE_OK when it is called.\n** Otherwise, it advances the expression passed as the second argument to\n** point to the next matching row in the database. Expressions iterate through\n** matching rows in docid order. Ascending order if Fts3Cursor.bDesc is zero,\n** or descending if it is non-zero.\n**\n** If an error occurs, *pRc is set to an SQLite error code. Otherwise, if\n** successful, the following variables in pExpr are set:\n**\n**   Fts3Expr.bEof                (non-zero if EOF - there is no next row)\n**   Fts3Expr.iDocid              (valid if bEof==0. The docid of the next row)\n**\n** If the expression is of type FTSQUERY_PHRASE, and the expression is not\n** at EOF, then the following variables are populated with the position list\n** for the phrase for the visited row:\n**\n**   FTs3Expr.pPhrase->doclist.nList        (length of pList in bytes)\n**   FTs3Expr.pPhrase->doclist.pList        (pointer to position list)\n**\n** It says above that this function advances the expression to the next\n** matching row. This is usually true, but there are the following exceptions:\n**\n**   1. Deferred tokens are not taken into account. If a phrase consists\n**      entirely of deferred tokens, it is assumed to match every row in\n**      the db. In this case the position-list is not populated at all. \n**\n**      Or, if a phrase contains one or more deferred tokens and one or\n**      more non-deferred tokens, then the expression is advanced to the \n**      next possible match, considering only non-deferred tokens. In other\n**      words, if the phrase is \"A B C\", and \"B\" is deferred, the expression\n**      is advanced to the next row that contains an instance of \"A * C\", \n**      where \"*\" may match any single token. The position list in this case\n**      is populated as for \"A * C\" before returning.\n**\n**   2. NEAR is treated as AND. If the expression is \"x NEAR y\", it is \n**      advanced to point to the next row that matches \"x AND y\".\n** \n** See sqlite3Fts3EvalTestDeferred() for details on testing if a row is\n** really a match, taking into account deferred tokens and NEAR operators.\n*/\nstatic void fts3EvalNextRow(\n  Fts3Cursor *pCsr,               /* FTS Cursor handle */\n  Fts3Expr *pExpr,                /* Expr. to advance to next matching row */\n  int *pRc                        /* IN/OUT: Error code */\n){\n  if( *pRc==SQLITE_OK ){\n    int bDescDoclist = pCsr->bDesc;         /* Used by DOCID_CMP() macro */\n    assert( pExpr->bEof==0 );\n    pExpr->bStart = 1;\n\n    switch( pExpr->eType ){\n      case FTSQUERY_NEAR:\n      case FTSQUERY_AND: {\n        Fts3Expr *pLeft = pExpr->pLeft;\n        Fts3Expr *pRight = pExpr->pRight;\n        assert( !pLeft->bDeferred || !pRight->bDeferred );\n\n        if( pLeft->bDeferred ){\n          /* LHS is entirely deferred. So we assume it matches every row.\n          ** Advance the RHS iterator to find the next row visited. */\n          fts3EvalNextRow(pCsr, pRight, pRc);\n          pExpr->iDocid = pRight->iDocid;\n          pExpr->bEof = pRight->bEof;\n        }else if( pRight->bDeferred ){\n          /* RHS is entirely deferred. So we assume it matches every row.\n          ** Advance the LHS iterator to find the next row visited. */\n          fts3EvalNextRow(pCsr, pLeft, pRc);\n          pExpr->iDocid = pLeft->iDocid;\n          pExpr->bEof = pLeft->bEof;\n        }else{\n          /* Neither the RHS or LHS are deferred. */\n          fts3EvalNextRow(pCsr, pLeft, pRc);\n          fts3EvalNextRow(pCsr, pRight, pRc);\n          while( !pLeft->bEof && !pRight->bEof && *pRc==SQLITE_OK ){\n            sqlite3_int64 iDiff = DOCID_CMP(pLeft->iDocid, pRight->iDocid);\n            if( iDiff==0 ) break;\n            if( iDiff<0 ){\n              fts3EvalNextRow(pCsr, pLeft, pRc);\n            }else{\n              fts3EvalNextRow(pCsr, pRight, pRc);\n            }\n          }\n          pExpr->iDocid = pLeft->iDocid;\n          pExpr->bEof = (pLeft->bEof || pRight->bEof);\n          if( pExpr->eType==FTSQUERY_NEAR && pExpr->bEof ){\n            if( pRight->pPhrase && pRight->pPhrase->doclist.aAll ){\n              Fts3Doclist *pDl = &pRight->pPhrase->doclist;\n              while( *pRc==SQLITE_OK && pRight->bEof==0 ){\n                memset(pDl->pList, 0, pDl->nList);\n                fts3EvalNextRow(pCsr, pRight, pRc);\n              }\n            }\n            if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){\n              Fts3Doclist *pDl = &pLeft->pPhrase->doclist;\n              while( *pRc==SQLITE_OK && pLeft->bEof==0 ){\n                memset(pDl->pList, 0, pDl->nList);\n                fts3EvalNextRow(pCsr, pLeft, pRc);\n              }\n            }\n          }\n        }\n        break;\n      }\n  \n      case FTSQUERY_OR: {\n        Fts3Expr *pLeft = pExpr->pLeft;\n        Fts3Expr *pRight = pExpr->pRight;\n        sqlite3_int64 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid);\n\n        assert( pLeft->bStart || pLeft->iDocid==pRight->iDocid );\n        assert( pRight->bStart || pLeft->iDocid==pRight->iDocid );\n\n        if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){\n          fts3EvalNextRow(pCsr, pLeft, pRc);\n        }else if( pLeft->bEof || (pRight->bEof==0 && iCmp>0) ){\n          fts3EvalNextRow(pCsr, pRight, pRc);\n        }else{\n          fts3EvalNextRow(pCsr, pLeft, pRc);\n          fts3EvalNextRow(pCsr, pRight, pRc);\n        }\n\n        pExpr->bEof = (pLeft->bEof && pRight->bEof);\n        iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid);\n        if( pRight->bEof || (pLeft->bEof==0 &&  iCmp<0) ){\n          pExpr->iDocid = pLeft->iDocid;\n        }else{\n          pExpr->iDocid = pRight->iDocid;\n        }\n\n        break;\n      }\n\n      case FTSQUERY_NOT: {\n        Fts3Expr *pLeft = pExpr->pLeft;\n        Fts3Expr *pRight = pExpr->pRight;\n\n        if( pRight->bStart==0 ){\n          fts3EvalNextRow(pCsr, pRight, pRc);\n          assert( *pRc!=SQLITE_OK || pRight->bStart );\n        }\n\n        fts3EvalNextRow(pCsr, pLeft, pRc);\n        if( pLeft->bEof==0 ){\n          while( !*pRc \n              && !pRight->bEof \n              && DOCID_CMP(pLeft->iDocid, pRight->iDocid)>0 \n          ){\n            fts3EvalNextRow(pCsr, pRight, pRc);\n          }\n        }\n        pExpr->iDocid = pLeft->iDocid;\n        pExpr->bEof = pLeft->bEof;\n        break;\n      }\n\n      default: {\n        Fts3Phrase *pPhrase = pExpr->pPhrase;\n        fts3EvalInvalidatePoslist(pPhrase);\n        *pRc = fts3EvalPhraseNext(pCsr, pPhrase, &pExpr->bEof);\n        pExpr->iDocid = pPhrase->doclist.iDocid;\n        break;\n      }\n    }\n  }\n}\n\n/*\n** If *pRc is not SQLITE_OK, or if pExpr is not the root node of a NEAR\n** cluster, then this function returns 1 immediately.\n**\n** Otherwise, it checks if the current row really does match the NEAR \n** expression, using the data currently stored in the position lists \n** (Fts3Expr->pPhrase.doclist.pList/nList) for each phrase in the expression. \n**\n** If the current row is a match, the position list associated with each\n** phrase in the NEAR expression is edited in place to contain only those\n** phrase instances sufficiently close to their peers to satisfy all NEAR\n** constraints. In this case it returns 1. If the NEAR expression does not \n** match the current row, 0 is returned. The position lists may or may not\n** be edited if 0 is returned.\n*/\nstatic int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){\n  int res = 1;\n\n  /* The following block runs if pExpr is the root of a NEAR query.\n  ** For example, the query:\n  **\n  **         \"w\" NEAR \"x\" NEAR \"y\" NEAR \"z\"\n  **\n  ** which is represented in tree form as:\n  **\n  **                               |\n  **                          +--NEAR--+      <-- root of NEAR query\n  **                          |        |\n  **                     +--NEAR--+   \"z\"\n  **                     |        |\n  **                +--NEAR--+   \"y\"\n  **                |        |\n  **               \"w\"      \"x\"\n  **\n  ** The right-hand child of a NEAR node is always a phrase. The \n  ** left-hand child may be either a phrase or a NEAR node. There are\n  ** no exceptions to this - it's the way the parser in fts3_expr.c works.\n  */\n  if( *pRc==SQLITE_OK \n   && pExpr->eType==FTSQUERY_NEAR \n   && pExpr->bEof==0\n   && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)\n  ){\n    Fts3Expr *p; \n    int nTmp = 0;                 /* Bytes of temp space */\n    char *aTmp;                   /* Temp space for PoslistNearMerge() */\n\n    /* Allocate temporary working space. */\n    for(p=pExpr; p->pLeft; p=p->pLeft){\n      nTmp += p->pRight->pPhrase->doclist.nList;\n    }\n    nTmp += p->pPhrase->doclist.nList;\n    if( nTmp==0 ){\n      res = 0;\n    }else{\n      aTmp = sqlite3_malloc(nTmp*2);\n      if( !aTmp ){\n        *pRc = SQLITE_NOMEM;\n        res = 0;\n      }else{\n        char *aPoslist = p->pPhrase->doclist.pList;\n        int nToken = p->pPhrase->nToken;\n\n        for(p=p->pParent;res && p && p->eType==FTSQUERY_NEAR; p=p->pParent){\n          Fts3Phrase *pPhrase = p->pRight->pPhrase;\n          int nNear = p->nNear;\n          res = fts3EvalNearTrim(nNear, aTmp, &aPoslist, &nToken, pPhrase);\n        }\n\n        aPoslist = pExpr->pRight->pPhrase->doclist.pList;\n        nToken = pExpr->pRight->pPhrase->nToken;\n        for(p=pExpr->pLeft; p && res; p=p->pLeft){\n          int nNear;\n          Fts3Phrase *pPhrase;\n          assert( p->pParent && p->pParent->pLeft==p );\n          nNear = p->pParent->nNear;\n          pPhrase = (\n              p->eType==FTSQUERY_NEAR ? p->pRight->pPhrase : p->pPhrase\n              );\n          res = fts3EvalNearTrim(nNear, aTmp, &aPoslist, &nToken, pPhrase);\n        }\n      }\n\n      sqlite3_free(aTmp);\n    }\n  }\n\n  return res;\n}\n\n/*\n** This function is a helper function for sqlite3Fts3EvalTestDeferred().\n** Assuming no error occurs or has occurred, It returns non-zero if the\n** expression passed as the second argument matches the row that pCsr \n** currently points to, or zero if it does not.\n**\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\n** If an error occurs during execution of this function, *pRc is set to \n** the appropriate SQLite error code. In this case the returned value is \n** undefined.\n*/\nstatic int fts3EvalTestExpr(\n  Fts3Cursor *pCsr,               /* FTS cursor handle */\n  Fts3Expr *pExpr,                /* Expr to test. May or may not be root. */\n  int *pRc                        /* IN/OUT: Error code */\n){\n  int bHit = 1;                   /* Return value */\n  if( *pRc==SQLITE_OK ){\n    switch( pExpr->eType ){\n      case FTSQUERY_NEAR:\n      case FTSQUERY_AND:\n        bHit = (\n            fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc)\n         && fts3EvalTestExpr(pCsr, pExpr->pRight, pRc)\n         && fts3EvalNearTest(pExpr, pRc)\n        );\n\n        /* If the NEAR expression does not match any rows, zero the doclist for \n        ** all phrases involved in the NEAR. This is because the snippet(),\n        ** offsets() and matchinfo() functions are not supposed to recognize \n        ** any instances of phrases that are part of unmatched NEAR queries. \n        ** For example if this expression:\n        **\n        **    ... MATCH 'a OR (b NEAR c)'\n        **\n        ** is matched against a row containing:\n        **\n        **        'a b d e'\n        **\n        ** then any snippet() should ony highlight the \"a\" term, not the \"b\"\n        ** (as \"b\" is part of a non-matching NEAR clause).\n        */\n        if( bHit==0 \n         && pExpr->eType==FTSQUERY_NEAR \n         && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)\n        ){\n          Fts3Expr *p;\n          for(p=pExpr; p->pPhrase==0; p=p->pLeft){\n            if( p->pRight->iDocid==pCsr->iPrevId ){\n              fts3EvalInvalidatePoslist(p->pRight->pPhrase);\n            }\n          }\n          if( p->iDocid==pCsr->iPrevId ){\n            fts3EvalInvalidatePoslist(p->pPhrase);\n          }\n        }\n\n        break;\n\n      case FTSQUERY_OR: {\n        int bHit1 = fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc);\n        int bHit2 = fts3EvalTestExpr(pCsr, pExpr->pRight, pRc);\n        bHit = bHit1 || bHit2;\n        break;\n      }\n\n      case FTSQUERY_NOT:\n        bHit = (\n            fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc)\n         && !fts3EvalTestExpr(pCsr, pExpr->pRight, pRc)\n        );\n        break;\n\n      default: {\n#ifndef SQLITE_DISABLE_FTS4_DEFERRED\n        if( pCsr->pDeferred \n         && (pExpr->iDocid==pCsr->iPrevId || pExpr->bDeferred)\n        ){\n          Fts3Phrase *pPhrase = pExpr->pPhrase;\n          assert( pExpr->bDeferred || pPhrase->doclist.bFreeList==0 );\n          if( pExpr->bDeferred ){\n            fts3EvalInvalidatePoslist(pPhrase);\n          }\n          *pRc = fts3EvalDeferredPhrase(pCsr, pPhrase);\n          bHit = (pPhrase->doclist.pList!=0);\n          pExpr->iDocid = pCsr->iPrevId;\n        }else\n#endif\n        {\n          bHit = (pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId);\n        }\n        break;\n      }\n    }\n  }\n  return bHit;\n}\n\n/*\n** This function is called as the second part of each xNext operation when\n** iterating through the results of a full-text query. At this point the\n** cursor points to a row that matches the query expression, with the\n** following caveats:\n**\n**   * Up until this point, \"NEAR\" operators in the expression have been\n**     treated as \"AND\".\n**\n**   * Deferred tokens have not yet been considered.\n**\n** If *pRc is not SQLITE_OK when this function is called, it immediately\n** returns 0. Otherwise, it tests whether or not after considering NEAR\n** operators and deferred tokens the current row is still a match for the\n** expression. It returns 1 if both of the following are true:\n**\n**   1. *pRc is SQLITE_OK when this function returns, and\n**\n**   2. After scanning the current FTS table row for the deferred tokens,\n**      it is determined that the row does *not* match the query.\n**\n** Or, if no error occurs and it seems the current row does match the FTS\n** query, return 0.\n*/\nint sqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc){\n  int rc = *pRc;\n  int bMiss = 0;\n  if( rc==SQLITE_OK ){\n\n    /* If there are one or more deferred tokens, load the current row into\n    ** memory and scan it to determine the position list for each deferred\n    ** token. Then, see if this row is really a match, considering deferred\n    ** tokens and NEAR operators (neither of which were taken into account\n    ** earlier, by fts3EvalNextRow()). \n    */\n    if( pCsr->pDeferred ){\n      rc = fts3CursorSeek(0, pCsr);\n      if( rc==SQLITE_OK ){\n        rc = sqlite3Fts3CacheDeferredDoclists(pCsr);\n      }\n    }\n    bMiss = (0==fts3EvalTestExpr(pCsr, pCsr->pExpr, &rc));\n\n    /* Free the position-lists accumulated for each deferred token above. */\n    sqlite3Fts3FreeDeferredDoclists(pCsr);\n    *pRc = rc;\n  }\n  return (rc==SQLITE_OK && bMiss);\n}\n\n/*\n** Advance to the next document that matches the FTS expression in\n** Fts3Cursor.pExpr.\n*/\nstatic int fts3EvalNext(Fts3Cursor *pCsr){\n  int rc = SQLITE_OK;             /* Return Code */\n  Fts3Expr *pExpr = pCsr->pExpr;\n  assert( pCsr->isEof==0 );\n  if( pExpr==0 ){\n    pCsr->isEof = 1;\n  }else{\n    do {\n      if( pCsr->isRequireSeek==0 ){\n        sqlite3_reset(pCsr->pStmt);\n      }\n      assert( sqlite3_data_count(pCsr->pStmt)==0 );\n      fts3EvalNextRow(pCsr, pExpr, &rc);\n      pCsr->isEof = pExpr->bEof;\n      pCsr->isRequireSeek = 1;\n      pCsr->isMatchinfoNeeded = 1;\n      pCsr->iPrevId = pExpr->iDocid;\n    }while( pCsr->isEof==0 && sqlite3Fts3EvalTestDeferred(pCsr, &rc) );\n  }\n\n  /* Check if the cursor is past the end of the docid range specified\n  ** by Fts3Cursor.iMinDocid/iMaxDocid. If so, set the EOF flag.  */\n  if( rc==SQLITE_OK && (\n        (pCsr->bDesc==0 && pCsr->iPrevId>pCsr->iMaxDocid)\n     || (pCsr->bDesc!=0 && pCsr->iPrevId<pCsr->iMinDocid)\n  )){\n    pCsr->isEof = 1;\n  }\n\n  return rc;\n}\n\n/*\n** Restart interation for expression pExpr so that the next call to\n** fts3EvalNext() visits the first row. Do not allow incremental \n** loading or merging of phrase doclists for this iteration.\n**\n** If *pRc is other than SQLITE_OK when this function is called, it is\n** a no-op. If an error occurs within this function, *pRc is set to an\n** SQLite error code before returning.\n*/\nstatic void fts3EvalRestart(\n  Fts3Cursor *pCsr,\n  Fts3Expr *pExpr,\n  int *pRc\n){\n  if( pExpr && *pRc==SQLITE_OK ){\n    Fts3Phrase *pPhrase = pExpr->pPhrase;\n\n    if( pPhrase ){\n      fts3EvalInvalidatePoslist(pPhrase);\n      if( pPhrase->bIncr ){\n        int i;\n        for(i=0; i<pPhrase->nToken; i++){\n          Fts3PhraseToken *pToken = &pPhrase->aToken[i];\n          assert( pToken->pDeferred==0 );\n          if( pToken->pSegcsr ){\n            sqlite3Fts3MsrIncrRestart(pToken->pSegcsr);\n          }\n        }\n        *pRc = fts3EvalPhraseStart(pCsr, 0, pPhrase);\n      }\n      pPhrase->doclist.pNextDocid = 0;\n      pPhrase->doclist.iDocid = 0;\n      pPhrase->pOrPoslist = 0;\n    }\n\n    pExpr->iDocid = 0;\n    pExpr->bEof = 0;\n    pExpr->bStart = 0;\n\n    fts3EvalRestart(pCsr, pExpr->pLeft, pRc);\n    fts3EvalRestart(pCsr, pExpr->pRight, pRc);\n  }\n}\n\n/*\n** After allocating the Fts3Expr.aMI[] array for each phrase in the \n** expression rooted at pExpr, the cursor iterates through all rows matched\n** by pExpr, calling this function for each row. This function increments\n** the values in Fts3Expr.aMI[] according to the position-list currently\n** found in Fts3Expr.pPhrase->doclist.pList for each of the phrase \n** expression nodes.\n*/\nstatic void fts3EvalUpdateCounts(Fts3Expr *pExpr){\n  if( pExpr ){\n    Fts3Phrase *pPhrase = pExpr->pPhrase;\n    if( pPhrase && pPhrase->doclist.pList ){\n      int iCol = 0;\n      char *p = pPhrase->doclist.pList;\n\n      assert( *p );\n      while( 1 ){\n        u8 c = 0;\n        int iCnt = 0;\n        while( 0xFE & (*p | c) ){\n          if( (c&0x80)==0 ) iCnt++;\n          c = *p++ & 0x80;\n        }\n\n        /* aMI[iCol*3 + 1] = Number of occurrences\n        ** aMI[iCol*3 + 2] = Number of rows containing at least one instance\n        */\n        pExpr->aMI[iCol*3 + 1] += iCnt;\n        pExpr->aMI[iCol*3 + 2] += (iCnt>0);\n        if( *p==0x00 ) break;\n        p++;\n        p += fts3GetVarint32(p, &iCol);\n      }\n    }\n\n    fts3EvalUpdateCounts(pExpr->pLeft);\n    fts3EvalUpdateCounts(pExpr->pRight);\n  }\n}\n\n/*\n** Expression pExpr must be of type FTSQUERY_PHRASE.\n**\n** If it is not already allocated and populated, this function allocates and\n** populates the Fts3Expr.aMI[] array for expression pExpr. If pExpr is part\n** of a NEAR expression, then it also allocates and populates the same array\n** for all other phrases that are part of the NEAR expression.\n**\n** SQLITE_OK is returned if the aMI[] array is successfully allocated and\n** populated. Otherwise, if an error occurs, an SQLite error code is returned.\n*/\nstatic int fts3EvalGatherStats(\n  Fts3Cursor *pCsr,               /* Cursor object */\n  Fts3Expr *pExpr                 /* FTSQUERY_PHRASE expression */\n){\n  int rc = SQLITE_OK;             /* Return code */\n\n  assert( pExpr->eType==FTSQUERY_PHRASE );\n  if( pExpr->aMI==0 ){\n    Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n    Fts3Expr *pRoot;                /* Root of NEAR expression */\n    Fts3Expr *p;                    /* Iterator used for several purposes */\n\n    sqlite3_int64 iPrevId = pCsr->iPrevId;\n    sqlite3_int64 iDocid;\n    u8 bEof;\n\n    /* Find the root of the NEAR expression */\n    pRoot = pExpr;\n    while( pRoot->pParent && pRoot->pParent->eType==FTSQUERY_NEAR ){\n      pRoot = pRoot->pParent;\n    }\n    iDocid = pRoot->iDocid;\n    bEof = pRoot->bEof;\n    assert( pRoot->bStart );\n\n    /* Allocate space for the aMSI[] array of each FTSQUERY_PHRASE node */\n    for(p=pRoot; p; p=p->pLeft){\n      Fts3Expr *pE = (p->eType==FTSQUERY_PHRASE?p:p->pRight);\n      assert( pE->aMI==0 );\n      pE->aMI = (u32 *)sqlite3_malloc(pTab->nColumn * 3 * sizeof(u32));\n      if( !pE->aMI ) return SQLITE_NOMEM;\n      memset(pE->aMI, 0, pTab->nColumn * 3 * sizeof(u32));\n    }\n\n    fts3EvalRestart(pCsr, pRoot, &rc);\n\n    while( pCsr->isEof==0 && rc==SQLITE_OK ){\n\n      do {\n        /* Ensure the %_content statement is reset. */\n        if( pCsr->isRequireSeek==0 ) sqlite3_reset(pCsr->pStmt);\n        assert( sqlite3_data_count(pCsr->pStmt)==0 );\n\n        /* Advance to the next document */\n        fts3EvalNextRow(pCsr, pRoot, &rc);\n        pCsr->isEof = pRoot->bEof;\n        pCsr->isRequireSeek = 1;\n        pCsr->isMatchinfoNeeded = 1;\n        pCsr->iPrevId = pRoot->iDocid;\n      }while( pCsr->isEof==0 \n           && pRoot->eType==FTSQUERY_NEAR \n           && sqlite3Fts3EvalTestDeferred(pCsr, &rc) \n      );\n\n      if( rc==SQLITE_OK && pCsr->isEof==0 ){\n        fts3EvalUpdateCounts(pRoot);\n      }\n    }\n\n    pCsr->isEof = 0;\n    pCsr->iPrevId = iPrevId;\n\n    if( bEof ){\n      pRoot->bEof = bEof;\n    }else{\n      /* Caution: pRoot may iterate through docids in ascending or descending\n      ** order. For this reason, even though it seems more defensive, the \n      ** do loop can not be written:\n      **\n      **   do {...} while( pRoot->iDocid<iDocid && rc==SQLITE_OK );\n      */\n      fts3EvalRestart(pCsr, pRoot, &rc);\n      do {\n        fts3EvalNextRow(pCsr, pRoot, &rc);\n        assert( pRoot->bEof==0 );\n      }while( pRoot->iDocid!=iDocid && rc==SQLITE_OK );\n    }\n  }\n  return rc;\n}\n\n/*\n** This function is used by the matchinfo() module to query a phrase \n** expression node for the following information:\n**\n**   1. The total number of occurrences of the phrase in each column of \n**      the FTS table (considering all rows), and\n**\n**   2. For each column, the number of rows in the table for which the\n**      column contains at least one instance of the phrase.\n**\n** If no error occurs, SQLITE_OK is returned and the values for each column\n** written into the array aiOut as follows:\n**\n**   aiOut[iCol*3 + 1] = Number of occurrences\n**   aiOut[iCol*3 + 2] = Number of rows containing at least one instance\n**\n** Caveats:\n**\n**   * If a phrase consists entirely of deferred tokens, then all output \n**     values are set to the number of documents in the table. In other\n**     words we assume that very common tokens occur exactly once in each \n**     column of each row of the table.\n**\n**   * If a phrase contains some deferred tokens (and some non-deferred \n**     tokens), count the potential occurrence identified by considering\n**     the non-deferred tokens instead of actual phrase occurrences.\n**\n**   * If the phrase is part of a NEAR expression, then only phrase instances\n**     that meet the NEAR constraint are included in the counts.\n*/\nint sqlite3Fts3EvalPhraseStats(\n  Fts3Cursor *pCsr,               /* FTS cursor handle */\n  Fts3Expr *pExpr,                /* Phrase expression */\n  u32 *aiOut                      /* Array to write results into (see above) */\n){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int rc = SQLITE_OK;\n  int iCol;\n\n  if( pExpr->bDeferred && pExpr->pParent->eType!=FTSQUERY_NEAR ){\n    assert( pCsr->nDoc>0 );\n    for(iCol=0; iCol<pTab->nColumn; iCol++){\n      aiOut[iCol*3 + 1] = (u32)pCsr->nDoc;\n      aiOut[iCol*3 + 2] = (u32)pCsr->nDoc;\n    }\n  }else{\n    rc = fts3EvalGatherStats(pCsr, pExpr);\n    if( rc==SQLITE_OK ){\n      assert( pExpr->aMI );\n      for(iCol=0; iCol<pTab->nColumn; iCol++){\n        aiOut[iCol*3 + 1] = pExpr->aMI[iCol*3 + 1];\n        aiOut[iCol*3 + 2] = pExpr->aMI[iCol*3 + 2];\n      }\n    }\n  }\n\n  return rc;\n}\n\n/*\n** The expression pExpr passed as the second argument to this function\n** must be of type FTSQUERY_PHRASE. \n**\n** The returned value is either NULL or a pointer to a buffer containing\n** a position-list indicating the occurrences of the phrase in column iCol\n** of the current row. \n**\n** More specifically, the returned buffer contains 1 varint for each \n** occurrence of the phrase in the column, stored using the normal (delta+2) \n** compression and is terminated by either an 0x01 or 0x00 byte. For example,\n** if the requested column contains \"a b X c d X X\" and the position-list\n** for 'X' is requested, the buffer returned may contain:\n**\n**     0x04 0x05 0x03 0x01   or   0x04 0x05 0x03 0x00\n**\n** This function works regardless of whether or not the phrase is deferred,\n** incremental, or neither.\n*/\nint sqlite3Fts3EvalPhrasePoslist(\n  Fts3Cursor *pCsr,               /* FTS3 cursor object */\n  Fts3Expr *pExpr,                /* Phrase to return doclist for */\n  int iCol,                       /* Column to return position list for */\n  char **ppOut                    /* OUT: Pointer to position list */\n){\n  Fts3Phrase *pPhrase = pExpr->pPhrase;\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  char *pIter;\n  int iThis;\n  sqlite3_int64 iDocid;\n\n  /* If this phrase is applies specifically to some column other than \n  ** column iCol, return a NULL pointer.  */\n  *ppOut = 0;\n  assert( iCol>=0 && iCol<pTab->nColumn );\n  if( (pPhrase->iColumn<pTab->nColumn && pPhrase->iColumn!=iCol) ){\n    return SQLITE_OK;\n  }\n\n  iDocid = pExpr->iDocid;\n  pIter = pPhrase->doclist.pList;\n  if( iDocid!=pCsr->iPrevId || pExpr->bEof ){\n    int rc = SQLITE_OK;\n    int bDescDoclist = pTab->bDescIdx;      /* For DOCID_CMP macro */\n    int bOr = 0;\n    u8 bTreeEof = 0;\n    Fts3Expr *p;                  /* Used to iterate from pExpr to root */\n    Fts3Expr *pNear;              /* Most senior NEAR ancestor (or pExpr) */\n    int bMatch;\n\n    /* Check if this phrase descends from an OR expression node. If not, \n    ** return NULL. Otherwise, the entry that corresponds to docid \n    ** pCsr->iPrevId may lie earlier in the doclist buffer. Or, if the\n    ** tree that the node is part of has been marked as EOF, but the node\n    ** itself is not EOF, then it may point to an earlier entry. */\n    pNear = pExpr;\n    for(p=pExpr->pParent; p; p=p->pParent){\n      if( p->eType==FTSQUERY_OR ) bOr = 1;\n      if( p->eType==FTSQUERY_NEAR ) pNear = p;\n      if( p->bEof ) bTreeEof = 1;\n    }\n    if( bOr==0 ) return SQLITE_OK;\n\n    /* This is the descendent of an OR node. In this case we cannot use\n    ** an incremental phrase. Load the entire doclist for the phrase\n    ** into memory in this case.  */\n    if( pPhrase->bIncr ){\n      int bEofSave = pNear->bEof;\n      fts3EvalRestart(pCsr, pNear, &rc);\n      while( rc==SQLITE_OK && !pNear->bEof ){\n        fts3EvalNextRow(pCsr, pNear, &rc);\n        if( bEofSave==0 && pNear->iDocid==iDocid ) break;\n      }\n      assert( rc!=SQLITE_OK || pPhrase->bIncr==0 );\n    }\n    if( bTreeEof ){\n      while( rc==SQLITE_OK && !pNear->bEof ){\n        fts3EvalNextRow(pCsr, pNear, &rc);\n      }\n    }\n    if( rc!=SQLITE_OK ) return rc;\n\n    bMatch = 1;\n    for(p=pNear; p; p=p->pLeft){\n      u8 bEof = 0;\n      Fts3Expr *pTest = p;\n      Fts3Phrase *pPh;\n      assert( pTest->eType==FTSQUERY_NEAR || pTest->eType==FTSQUERY_PHRASE );\n      if( pTest->eType==FTSQUERY_NEAR ) pTest = pTest->pRight;\n      assert( pTest->eType==FTSQUERY_PHRASE );\n      pPh = pTest->pPhrase;\n\n      pIter = pPh->pOrPoslist;\n      iDocid = pPh->iOrDocid;\n      if( pCsr->bDesc==bDescDoclist ){\n        bEof = !pPh->doclist.nAll ||\n          (pIter >= (pPh->doclist.aAll + pPh->doclist.nAll));\n        while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){\n          sqlite3Fts3DoclistNext(\n              bDescDoclist, pPh->doclist.aAll, pPh->doclist.nAll, \n              &pIter, &iDocid, &bEof\n          );\n        }\n      }else{\n        bEof = !pPh->doclist.nAll || (pIter && pIter<=pPh->doclist.aAll);\n        while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){\n          int dummy;\n          sqlite3Fts3DoclistPrev(\n              bDescDoclist, pPh->doclist.aAll, pPh->doclist.nAll, \n              &pIter, &iDocid, &dummy, &bEof\n              );\n        }\n      }\n      pPh->pOrPoslist = pIter;\n      pPh->iOrDocid = iDocid;\n      if( bEof || iDocid!=pCsr->iPrevId ) bMatch = 0;\n    }\n\n    if( bMatch ){\n      pIter = pPhrase->pOrPoslist;\n    }else{\n      pIter = 0;\n    }\n  }\n  if( pIter==0 ) return SQLITE_OK;\n\n  if( *pIter==0x01 ){\n    pIter++;\n    pIter += fts3GetVarint32(pIter, &iThis);\n  }else{\n    iThis = 0;\n  }\n  while( iThis<iCol ){\n    fts3ColumnlistCopy(0, &pIter);\n    if( *pIter==0x00 ) return SQLITE_OK;\n    pIter++;\n    pIter += fts3GetVarint32(pIter, &iThis);\n  }\n  if( *pIter==0x00 ){\n    pIter = 0;\n  }\n\n  *ppOut = ((iCol==iThis)?pIter:0);\n  return SQLITE_OK;\n}\n\n/*\n** Free all components of the Fts3Phrase structure that were allocated by\n** the eval module. Specifically, this means to free:\n**\n**   * the contents of pPhrase->doclist, and\n**   * any Fts3MultiSegReader objects held by phrase tokens.\n*/\nvoid sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *pPhrase){\n  if( pPhrase ){\n    int i;\n    sqlite3_free(pPhrase->doclist.aAll);\n    fts3EvalInvalidatePoslist(pPhrase);\n    memset(&pPhrase->doclist, 0, sizeof(Fts3Doclist));\n    for(i=0; i<pPhrase->nToken; i++){\n      fts3SegReaderCursorFree(pPhrase->aToken[i].pSegcsr);\n      pPhrase->aToken[i].pSegcsr = 0;\n    }\n  }\n}\n\n\n/*\n** Return SQLITE_CORRUPT_VTAB.\n*/\n#ifdef SQLITE_DEBUG\nint sqlite3Fts3Corrupt(){\n  return SQLITE_CORRUPT_VTAB;\n}\n#endif\n\n#if !SQLITE_CORE\n/*\n** Initialize API pointer table, if required.\n*/\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nint sqlite3_fts3_init(\n  sqlite3 *db, \n  char **pzErrMsg,\n  const sqlite3_api_routines *pApi\n){\n  SQLITE_EXTENSION_INIT2(pApi)\n  return sqlite3Fts3Init(db);\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3.h",
    "content": "/*\n** 2006 Oct 10\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This header file is used by programs that want to link against the\n** FTS3 library.  All it does is declare the sqlite3Fts3Init() interface.\n*/\n#include \"sqlite3.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif  /* __cplusplus */\n\nint sqlite3Fts3Init(sqlite3 *db);\n\n#ifdef __cplusplus\n}  /* extern \"C\" */\n#endif  /* __cplusplus */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3Int.h",
    "content": "/*\n** 2009 Nov 12\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n*/\n#ifndef _FTSINT_H\n#define _FTSINT_H\n\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) \n# define NDEBUG 1\n#endif\n\n/* FTS3/FTS4 require virtual tables */\n#ifdef SQLITE_OMIT_VIRTUALTABLE\n# undef SQLITE_ENABLE_FTS3\n# undef SQLITE_ENABLE_FTS4\n#endif\n\n/*\n** FTS4 is really an extension for FTS3.  It is enabled using the\n** SQLITE_ENABLE_FTS3 macro.  But to avoid confusion we also all\n** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.\n*/\n#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)\n# define SQLITE_ENABLE_FTS3\n#endif\n\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n/* If not building as part of the core, include sqlite3ext.h. */\n#ifndef SQLITE_CORE\n# include \"sqlite3ext.h\" \nSQLITE_EXTENSION_INIT3\n#endif\n\n#include \"sqlite3.h\"\n#include \"fts3_tokenizer.h\"\n#include \"fts3_hash.h\"\n\n/*\n** This constant determines the maximum depth of an FTS expression tree\n** that the library will create and use. FTS uses recursion to perform \n** various operations on the query tree, so the disadvantage of a large\n** limit is that it may allow very large queries to use large amounts\n** of stack space (perhaps causing a stack overflow).\n*/\n#ifndef SQLITE_FTS3_MAX_EXPR_DEPTH\n# define SQLITE_FTS3_MAX_EXPR_DEPTH 12\n#endif\n\n\n/*\n** This constant controls how often segments are merged. Once there are\n** FTS3_MERGE_COUNT segments of level N, they are merged into a single\n** segment of level N+1.\n*/\n#define FTS3_MERGE_COUNT 16\n\n/*\n** This is the maximum amount of data (in bytes) to store in the \n** Fts3Table.pendingTerms hash table. Normally, the hash table is\n** populated as documents are inserted/updated/deleted in a transaction\n** and used to create a new segment when the transaction is committed.\n** However if this limit is reached midway through a transaction, a new \n** segment is created and the hash table cleared immediately.\n*/\n#define FTS3_MAX_PENDING_DATA (1*1024*1024)\n\n/*\n** Macro to return the number of elements in an array. SQLite has a\n** similar macro called ArraySize(). Use a different name to avoid\n** a collision when building an amalgamation with built-in FTS3.\n*/\n#define SizeofArray(X) ((int)(sizeof(X)/sizeof(X[0])))\n\n\n#ifndef MIN\n# define MIN(x,y) ((x)<(y)?(x):(y))\n#endif\n#ifndef MAX\n# define MAX(x,y) ((x)>(y)?(x):(y))\n#endif\n\n/*\n** Maximum length of a varint encoded integer. The varint format is different\n** from that used by SQLite, so the maximum length is 10, not 9.\n*/\n#define FTS3_VARINT_MAX 10\n\n/*\n** FTS4 virtual tables may maintain multiple indexes - one index of all terms\n** in the document set and zero or more prefix indexes. All indexes are stored\n** as one or more b+-trees in the %_segments and %_segdir tables. \n**\n** It is possible to determine which index a b+-tree belongs to based on the\n** value stored in the \"%_segdir.level\" column. Given this value L, the index\n** that the b+-tree belongs to is (L<<10). In other words, all b+-trees with\n** level values between 0 and 1023 (inclusive) belong to index 0, all levels\n** between 1024 and 2047 to index 1, and so on.\n**\n** It is considered impossible for an index to use more than 1024 levels. In \n** theory though this may happen, but only after at least \n** (FTS3_MERGE_COUNT^1024) separate flushes of the pending-terms tables.\n*/\n#define FTS3_SEGDIR_MAXLEVEL      1024\n#define FTS3_SEGDIR_MAXLEVEL_STR \"1024\"\n\n/*\n** The testcase() macro is only used by the amalgamation.  If undefined,\n** make it a no-op.\n*/\n#ifndef testcase\n# define testcase(X)\n#endif\n\n/*\n** Terminator values for position-lists and column-lists.\n*/\n#define POS_COLUMN  (1)     /* Column-list terminator */\n#define POS_END     (0)     /* Position-list terminator */ \n\n/*\n** This section provides definitions to allow the\n** FTS3 extension to be compiled outside of the \n** amalgamation.\n*/\n#ifndef SQLITE_AMALGAMATION\n/*\n** Macros indicating that conditional expressions are always true or\n** false.\n*/\n#ifdef SQLITE_COVERAGE_TEST\n# define ALWAYS(x) (1)\n# define NEVER(X)  (0)\n#elif defined(SQLITE_DEBUG)\n# define ALWAYS(x) sqlite3Fts3Always((x)!=0)\n# define NEVER(x) sqlite3Fts3Never((x)!=0)\nint sqlite3Fts3Always(int b);\nint sqlite3Fts3Never(int b);\n#else\n# define ALWAYS(x) (x)\n# define NEVER(x)  (x)\n#endif\n\n/*\n** Internal types used by SQLite.\n*/\ntypedef unsigned char u8;         /* 1-byte (or larger) unsigned integer */\ntypedef short int i16;            /* 2-byte (or larger) signed integer */\ntypedef unsigned int u32;         /* 4-byte unsigned integer */\ntypedef sqlite3_uint64 u64;       /* 8-byte unsigned integer */\ntypedef sqlite3_int64 i64;        /* 8-byte signed integer */\n\n/*\n** Macro used to suppress compiler warnings for unused parameters.\n*/\n#define UNUSED_PARAMETER(x) (void)(x)\n\n/*\n** Activate assert() only if SQLITE_TEST is enabled.\n*/\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) \n# define NDEBUG 1\n#endif\n\n/*\n** The TESTONLY macro is used to enclose variable declarations or\n** other bits of code that are needed to support the arguments\n** within testcase() and assert() macros.\n*/\n#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)\n# define TESTONLY(X)  X\n#else\n# define TESTONLY(X)\n#endif\n\n#endif /* SQLITE_AMALGAMATION */\n\n#ifdef SQLITE_DEBUG\nint sqlite3Fts3Corrupt(void);\n# define FTS_CORRUPT_VTAB sqlite3Fts3Corrupt()\n#else\n# define FTS_CORRUPT_VTAB SQLITE_CORRUPT_VTAB\n#endif\n\ntypedef struct Fts3Table Fts3Table;\ntypedef struct Fts3Cursor Fts3Cursor;\ntypedef struct Fts3Expr Fts3Expr;\ntypedef struct Fts3Phrase Fts3Phrase;\ntypedef struct Fts3PhraseToken Fts3PhraseToken;\n\ntypedef struct Fts3Doclist Fts3Doclist;\ntypedef struct Fts3SegFilter Fts3SegFilter;\ntypedef struct Fts3DeferredToken Fts3DeferredToken;\ntypedef struct Fts3SegReader Fts3SegReader;\ntypedef struct Fts3MultiSegReader Fts3MultiSegReader;\n\ntypedef struct MatchinfoBuffer MatchinfoBuffer;\n\n/*\n** A connection to a fulltext index is an instance of the following\n** structure. The xCreate and xConnect methods create an instance\n** of this structure and xDestroy and xDisconnect free that instance.\n** All other methods receive a pointer to the structure as one of their\n** arguments.\n*/\nstruct Fts3Table {\n  sqlite3_vtab base;              /* Base class used by SQLite core */\n  sqlite3 *db;                    /* The database connection */\n  const char *zDb;                /* logical database name */\n  const char *zName;              /* virtual table name */\n  int nColumn;                    /* number of named columns in virtual table */\n  char **azColumn;                /* column names.  malloced */\n  u8 *abNotindexed;               /* True for 'notindexed' columns */\n  sqlite3_tokenizer *pTokenizer;  /* tokenizer for inserts and queries */\n  char *zContentTbl;              /* content=xxx option, or NULL */\n  char *zLanguageid;              /* languageid=xxx option, or NULL */\n  int nAutoincrmerge;             /* Value configured by 'automerge' */\n  u32 nLeafAdd;                   /* Number of leaf blocks added this trans */\n\n  /* Precompiled statements used by the implementation. Each of these \n  ** statements is run and reset within a single virtual table API call. \n  */\n  sqlite3_stmt *aStmt[40];\n\n  char *zReadExprlist;\n  char *zWriteExprlist;\n\n  int nNodeSize;                  /* Soft limit for node size */\n  u8 bFts4;                       /* True for FTS4, false for FTS3 */\n  u8 bHasStat;                    /* True if %_stat table exists (2==unknown) */\n  u8 bHasDocsize;                 /* True if %_docsize table exists */\n  u8 bDescIdx;                    /* True if doclists are in reverse order */\n  u8 bIgnoreSavepoint;            /* True to ignore xSavepoint invocations */\n  int nPgsz;                      /* Page size for host database */\n  char *zSegmentsTbl;             /* Name of %_segments table */\n  sqlite3_blob *pSegments;        /* Blob handle open on %_segments table */\n\n  /* \n  ** The following array of hash tables is used to buffer pending index \n  ** updates during transactions. All pending updates buffered at any one\n  ** time must share a common language-id (see the FTS4 langid= feature).\n  ** The current language id is stored in variable iPrevLangid.\n  **\n  ** A single FTS4 table may have multiple full-text indexes. For each index\n  ** there is an entry in the aIndex[] array. Index 0 is an index of all the\n  ** terms that appear in the document set. Each subsequent index in aIndex[]\n  ** is an index of prefixes of a specific length.\n  **\n  ** Variable nPendingData contains an estimate the memory consumed by the \n  ** pending data structures, including hash table overhead, but not including\n  ** malloc overhead.  When nPendingData exceeds nMaxPendingData, all hash\n  ** tables are flushed to disk. Variable iPrevDocid is the docid of the most \n  ** recently inserted record.\n  */\n  int nIndex;                     /* Size of aIndex[] */\n  struct Fts3Index {\n    int nPrefix;                  /* Prefix length (0 for main terms index) */\n    Fts3Hash hPending;            /* Pending terms table for this index */\n  } *aIndex;\n  int nMaxPendingData;            /* Max pending data before flush to disk */\n  int nPendingData;               /* Current bytes of pending data */\n  sqlite_int64 iPrevDocid;        /* Docid of most recently inserted document */\n  int iPrevLangid;                /* Langid of recently inserted document */\n  int bPrevDelete;                /* True if last operation was a delete */\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)\n  /* State variables used for validating that the transaction control\n  ** methods of the virtual table are called at appropriate times.  These\n  ** values do not contribute to FTS functionality; they are used for\n  ** verifying the operation of the SQLite core.\n  */\n  int inTransaction;     /* True after xBegin but before xCommit/xRollback */\n  int mxSavepoint;       /* Largest valid xSavepoint integer */\n#endif\n\n#ifdef SQLITE_TEST\n  /* True to disable the incremental doclist optimization. This is controled\n  ** by special insert command 'test-no-incr-doclist'.  */\n  int bNoIncrDoclist;\n#endif\n};\n\n/*\n** When the core wants to read from the virtual table, it creates a\n** virtual table cursor (an instance of the following structure) using\n** the xOpen method. Cursors are destroyed using the xClose method.\n*/\nstruct Fts3Cursor {\n  sqlite3_vtab_cursor base;       /* Base class used by SQLite core */\n  i16 eSearch;                    /* Search strategy (see below) */\n  u8 isEof;                       /* True if at End Of Results */\n  u8 isRequireSeek;               /* True if must seek pStmt to %_content row */\n  sqlite3_stmt *pStmt;            /* Prepared statement in use by the cursor */\n  Fts3Expr *pExpr;                /* Parsed MATCH query string */\n  int iLangid;                    /* Language being queried for */\n  int nPhrase;                    /* Number of matchable phrases in query */\n  Fts3DeferredToken *pDeferred;   /* Deferred search tokens, if any */\n  sqlite3_int64 iPrevId;          /* Previous id read from aDoclist */\n  char *pNextId;                  /* Pointer into the body of aDoclist */\n  char *aDoclist;                 /* List of docids for full-text queries */\n  int nDoclist;                   /* Size of buffer at aDoclist */\n  u8 bDesc;                       /* True to sort in descending order */\n  int eEvalmode;                  /* An FTS3_EVAL_XX constant */\n  int nRowAvg;                    /* Average size of database rows, in pages */\n  sqlite3_int64 nDoc;             /* Documents in table */\n  i64 iMinDocid;                  /* Minimum docid to return */\n  i64 iMaxDocid;                  /* Maximum docid to return */\n  int isMatchinfoNeeded;          /* True when aMatchinfo[] needs filling in */\n  MatchinfoBuffer *pMIBuffer;     /* Buffer for matchinfo data */\n};\n\n#define FTS3_EVAL_FILTER    0\n#define FTS3_EVAL_NEXT      1\n#define FTS3_EVAL_MATCHINFO 2\n\n/*\n** The Fts3Cursor.eSearch member is always set to one of the following.\n** Actualy, Fts3Cursor.eSearch can be greater than or equal to\n** FTS3_FULLTEXT_SEARCH.  If so, then Fts3Cursor.eSearch - 2 is the index\n** of the column to be searched.  For example, in\n**\n**     CREATE VIRTUAL TABLE ex1 USING fts3(a,b,c,d);\n**     SELECT docid FROM ex1 WHERE b MATCH 'one two three';\n** \n** Because the LHS of the MATCH operator is 2nd column \"b\",\n** Fts3Cursor.eSearch will be set to FTS3_FULLTEXT_SEARCH+1.  (+0 for a,\n** +1 for b, +2 for c, +3 for d.)  If the LHS of MATCH were \"ex1\" \n** indicating that all columns should be searched,\n** then eSearch would be set to FTS3_FULLTEXT_SEARCH+4.\n*/\n#define FTS3_FULLSCAN_SEARCH 0    /* Linear scan of %_content table */\n#define FTS3_DOCID_SEARCH    1    /* Lookup by rowid on %_content table */\n#define FTS3_FULLTEXT_SEARCH 2    /* Full-text index search */\n\n/*\n** The lower 16-bits of the sqlite3_index_info.idxNum value set by\n** the xBestIndex() method contains the Fts3Cursor.eSearch value described\n** above. The upper 16-bits contain a combination of the following\n** bits, used to describe extra constraints on full-text searches.\n*/\n#define FTS3_HAVE_LANGID    0x00010000      /* languageid=? */\n#define FTS3_HAVE_DOCID_GE  0x00020000      /* docid>=? */\n#define FTS3_HAVE_DOCID_LE  0x00040000      /* docid<=? */\n\nstruct Fts3Doclist {\n  char *aAll;                    /* Array containing doclist (or NULL) */\n  int nAll;                      /* Size of a[] in bytes */\n  char *pNextDocid;              /* Pointer to next docid */\n\n  sqlite3_int64 iDocid;          /* Current docid (if pList!=0) */\n  int bFreeList;                 /* True if pList should be sqlite3_free()d */\n  char *pList;                   /* Pointer to position list following iDocid */\n  int nList;                     /* Length of position list */\n};\n\n/*\n** A \"phrase\" is a sequence of one or more tokens that must match in\n** sequence.  A single token is the base case and the most common case.\n** For a sequence of tokens contained in double-quotes (i.e. \"one two three\")\n** nToken will be the number of tokens in the string.\n*/\nstruct Fts3PhraseToken {\n  char *z;                        /* Text of the token */\n  int n;                          /* Number of bytes in buffer z */\n  int isPrefix;                   /* True if token ends with a \"*\" character */\n  int bFirst;                     /* True if token must appear at position 0 */\n\n  /* Variables above this point are populated when the expression is\n  ** parsed (by code in fts3_expr.c). Below this point the variables are\n  ** used when evaluating the expression. */\n  Fts3DeferredToken *pDeferred;   /* Deferred token object for this token */\n  Fts3MultiSegReader *pSegcsr;    /* Segment-reader for this token */\n};\n\nstruct Fts3Phrase {\n  /* Cache of doclist for this phrase. */\n  Fts3Doclist doclist;\n  int bIncr;                 /* True if doclist is loaded incrementally */\n  int iDoclistToken;\n\n  /* Used by sqlite3Fts3EvalPhrasePoslist() if this is a descendent of an\n  ** OR condition.  */\n  char *pOrPoslist;\n  i64 iOrDocid;\n\n  /* Variables below this point are populated by fts3_expr.c when parsing \n  ** a MATCH expression. Everything above is part of the evaluation phase. \n  */\n  int nToken;                /* Number of tokens in the phrase */\n  int iColumn;               /* Index of column this phrase must match */\n  Fts3PhraseToken aToken[1]; /* One entry for each token in the phrase */\n};\n\n/*\n** A tree of these objects forms the RHS of a MATCH operator.\n**\n** If Fts3Expr.eType is FTSQUERY_PHRASE and isLoaded is true, then aDoclist \n** points to a malloced buffer, size nDoclist bytes, containing the results \n** of this phrase query in FTS3 doclist format. As usual, the initial \n** \"Length\" field found in doclists stored on disk is omitted from this \n** buffer.\n**\n** Variable aMI is used only for FTSQUERY_NEAR nodes to store the global\n** matchinfo data. If it is not NULL, it points to an array of size nCol*3,\n** where nCol is the number of columns in the queried FTS table. The array\n** is populated as follows:\n**\n**   aMI[iCol*3 + 0] = Undefined\n**   aMI[iCol*3 + 1] = Number of occurrences\n**   aMI[iCol*3 + 2] = Number of rows containing at least one instance\n**\n** The aMI array is allocated using sqlite3_malloc(). It should be freed \n** when the expression node is.\n*/\nstruct Fts3Expr {\n  int eType;                 /* One of the FTSQUERY_XXX values defined below */\n  int nNear;                 /* Valid if eType==FTSQUERY_NEAR */\n  Fts3Expr *pParent;         /* pParent->pLeft==this or pParent->pRight==this */\n  Fts3Expr *pLeft;           /* Left operand */\n  Fts3Expr *pRight;          /* Right operand */\n  Fts3Phrase *pPhrase;       /* Valid if eType==FTSQUERY_PHRASE */\n\n  /* The following are used by the fts3_eval.c module. */\n  sqlite3_int64 iDocid;      /* Current docid */\n  u8 bEof;                   /* True this expression is at EOF already */\n  u8 bStart;                 /* True if iDocid is valid */\n  u8 bDeferred;              /* True if this expression is entirely deferred */\n\n  /* The following are used by the fts3_snippet.c module. */\n  int iPhrase;               /* Index of this phrase in matchinfo() results */\n  u32 *aMI;                  /* See above */\n};\n\n/*\n** Candidate values for Fts3Query.eType. Note that the order of the first\n** four values is in order of precedence when parsing expressions. For \n** example, the following:\n**\n**   \"a OR b AND c NOT d NEAR e\"\n**\n** is equivalent to:\n**\n**   \"a OR (b AND (c NOT (d NEAR e)))\"\n*/\n#define FTSQUERY_NEAR   1\n#define FTSQUERY_NOT    2\n#define FTSQUERY_AND    3\n#define FTSQUERY_OR     4\n#define FTSQUERY_PHRASE 5\n\n\n/* fts3_write.c */\nint sqlite3Fts3UpdateMethod(sqlite3_vtab*,int,sqlite3_value**,sqlite3_int64*);\nint sqlite3Fts3PendingTermsFlush(Fts3Table *);\nvoid sqlite3Fts3PendingTermsClear(Fts3Table *);\nint sqlite3Fts3Optimize(Fts3Table *);\nint sqlite3Fts3SegReaderNew(int, int, sqlite3_int64,\n  sqlite3_int64, sqlite3_int64, const char *, int, Fts3SegReader**);\nint sqlite3Fts3SegReaderPending(\n  Fts3Table*,int,const char*,int,int,Fts3SegReader**);\nvoid sqlite3Fts3SegReaderFree(Fts3SegReader *);\nint sqlite3Fts3AllSegdirs(Fts3Table*, int, int, int, sqlite3_stmt **);\nint sqlite3Fts3ReadBlock(Fts3Table*, sqlite3_int64, char **, int*, int*);\n\nint sqlite3Fts3SelectDoctotal(Fts3Table *, sqlite3_stmt **);\nint sqlite3Fts3SelectDocsize(Fts3Table *, sqlite3_int64, sqlite3_stmt **);\n\n#ifndef SQLITE_DISABLE_FTS4_DEFERRED\nvoid sqlite3Fts3FreeDeferredTokens(Fts3Cursor *);\nint sqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int);\nint sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *);\nvoid sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *);\nint sqlite3Fts3DeferredTokenList(Fts3DeferredToken *, char **, int *);\n#else\n# define sqlite3Fts3FreeDeferredTokens(x)\n# define sqlite3Fts3DeferToken(x,y,z) SQLITE_OK\n# define sqlite3Fts3CacheDeferredDoclists(x) SQLITE_OK\n# define sqlite3Fts3FreeDeferredDoclists(x)\n# define sqlite3Fts3DeferredTokenList(x,y,z) SQLITE_OK\n#endif\n\nvoid sqlite3Fts3SegmentsClose(Fts3Table *);\nint sqlite3Fts3MaxLevel(Fts3Table *, int *);\n\n/* Special values interpreted by sqlite3SegReaderCursor() */\n#define FTS3_SEGCURSOR_PENDING        -1\n#define FTS3_SEGCURSOR_ALL            -2\n\nint sqlite3Fts3SegReaderStart(Fts3Table*, Fts3MultiSegReader*, Fts3SegFilter*);\nint sqlite3Fts3SegReaderStep(Fts3Table *, Fts3MultiSegReader *);\nvoid sqlite3Fts3SegReaderFinish(Fts3MultiSegReader *);\n\nint sqlite3Fts3SegReaderCursor(Fts3Table *, \n    int, int, int, const char *, int, int, int, Fts3MultiSegReader *);\n\n/* Flags allowed as part of the 4th argument to SegmentReaderIterate() */\n#define FTS3_SEGMENT_REQUIRE_POS   0x00000001\n#define FTS3_SEGMENT_IGNORE_EMPTY  0x00000002\n#define FTS3_SEGMENT_COLUMN_FILTER 0x00000004\n#define FTS3_SEGMENT_PREFIX        0x00000008\n#define FTS3_SEGMENT_SCAN          0x00000010\n#define FTS3_SEGMENT_FIRST         0x00000020\n\n/* Type passed as 4th argument to SegmentReaderIterate() */\nstruct Fts3SegFilter {\n  const char *zTerm;\n  int nTerm;\n  int iCol;\n  int flags;\n};\n\nstruct Fts3MultiSegReader {\n  /* Used internally by sqlite3Fts3SegReaderXXX() calls */\n  Fts3SegReader **apSegment;      /* Array of Fts3SegReader objects */\n  int nSegment;                   /* Size of apSegment array */\n  int nAdvance;                   /* How many seg-readers to advance */\n  Fts3SegFilter *pFilter;         /* Pointer to filter object */\n  char *aBuffer;                  /* Buffer to merge doclists in */\n  int nBuffer;                    /* Allocated size of aBuffer[] in bytes */\n\n  int iColFilter;                 /* If >=0, filter for this column */\n  int bRestart;\n\n  /* Used by fts3.c only. */\n  int nCost;                      /* Cost of running iterator */\n  int bLookup;                    /* True if a lookup of a single entry. */\n\n  /* Output values. Valid only after Fts3SegReaderStep() returns SQLITE_ROW. */\n  char *zTerm;                    /* Pointer to term buffer */\n  int nTerm;                      /* Size of zTerm in bytes */\n  char *aDoclist;                 /* Pointer to doclist buffer */\n  int nDoclist;                   /* Size of aDoclist[] in bytes */\n};\n\nint sqlite3Fts3Incrmerge(Fts3Table*,int,int);\n\n#define fts3GetVarint32(p, piVal) (                                           \\\n  (*(u8*)(p)&0x80) ? sqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \\\n)\n\n/* fts3.c */\nvoid sqlite3Fts3ErrMsg(char**,const char*,...);\nint sqlite3Fts3PutVarint(char *, sqlite3_int64);\nint sqlite3Fts3GetVarint(const char *, sqlite_int64 *);\nint sqlite3Fts3GetVarint32(const char *, int *);\nint sqlite3Fts3VarintLen(sqlite3_uint64);\nvoid sqlite3Fts3Dequote(char *);\nvoid sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,int*,u8*);\nint sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *);\nint sqlite3Fts3FirstFilter(sqlite3_int64, char *, int, char *);\nvoid sqlite3Fts3CreateStatTable(int*, Fts3Table*);\nint sqlite3Fts3EvalTestDeferred(Fts3Cursor *pCsr, int *pRc);\n\n/* fts3_tokenizer.c */\nconst char *sqlite3Fts3NextToken(const char *, int *);\nint sqlite3Fts3InitHashTable(sqlite3 *, Fts3Hash *, const char *);\nint sqlite3Fts3InitTokenizer(Fts3Hash *pHash, const char *, \n    sqlite3_tokenizer **, char **\n);\nint sqlite3Fts3IsIdChar(char);\n\n/* fts3_snippet.c */\nvoid sqlite3Fts3Offsets(sqlite3_context*, Fts3Cursor*);\nvoid sqlite3Fts3Snippet(sqlite3_context *, Fts3Cursor *, const char *,\n  const char *, const char *, int, int\n);\nvoid sqlite3Fts3Matchinfo(sqlite3_context *, Fts3Cursor *, const char *);\nvoid sqlite3Fts3MIBufferFree(MatchinfoBuffer *p);\n\n/* fts3_expr.c */\nint sqlite3Fts3ExprParse(sqlite3_tokenizer *, int,\n  char **, int, int, int, const char *, int, Fts3Expr **, char **\n);\nvoid sqlite3Fts3ExprFree(Fts3Expr *);\n#ifdef SQLITE_TEST\nint sqlite3Fts3ExprInitTestInterface(sqlite3 *db);\nint sqlite3Fts3InitTerm(sqlite3 *db);\n#endif\n\nint sqlite3Fts3OpenTokenizer(sqlite3_tokenizer *, int, const char *, int,\n  sqlite3_tokenizer_cursor **\n);\n\n/* fts3_aux.c */\nint sqlite3Fts3InitAux(sqlite3 *db);\n\nvoid sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *);\n\nint sqlite3Fts3MsrIncrStart(\n    Fts3Table*, Fts3MultiSegReader*, int, const char*, int);\nint sqlite3Fts3MsrIncrNext(\n    Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *);\nint sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **); \nint sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);\nint sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);\n\n/* fts3_tokenize_vtab.c */\nint sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);\n\n/* fts3_unicode2.c (functions generated by parsing unicode text files) */\n#ifndef SQLITE_DISABLE_FTS3_UNICODE\nint sqlite3FtsUnicodeFold(int, int);\nint sqlite3FtsUnicodeIsalnum(int);\nint sqlite3FtsUnicodeIsdiacritic(int);\n#endif\n\n#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */\n#endif /* _FTSINT_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_aux.c",
    "content": "/*\n** 2011 Jan 27\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <string.h>\n#include <assert.h>\n\ntypedef struct Fts3auxTable Fts3auxTable;\ntypedef struct Fts3auxCursor Fts3auxCursor;\n\nstruct Fts3auxTable {\n  sqlite3_vtab base;              /* Base class used by SQLite core */\n  Fts3Table *pFts3Tab;\n};\n\nstruct Fts3auxCursor {\n  sqlite3_vtab_cursor base;       /* Base class used by SQLite core */\n  Fts3MultiSegReader csr;        /* Must be right after \"base\" */\n  Fts3SegFilter filter;\n  char *zStop;\n  int nStop;                      /* Byte-length of string zStop */\n  int iLangid;                    /* Language id to query */\n  int isEof;                      /* True if cursor is at EOF */\n  sqlite3_int64 iRowid;           /* Current rowid */\n\n  int iCol;                       /* Current value of 'col' column */\n  int nStat;                      /* Size of aStat[] array */\n  struct Fts3auxColstats {\n    sqlite3_int64 nDoc;           /* 'documents' values for current csr row */\n    sqlite3_int64 nOcc;           /* 'occurrences' values for current csr row */\n  } *aStat;\n};\n\n/*\n** Schema of the terms table.\n*/\n#define FTS3_AUX_SCHEMA \\\n  \"CREATE TABLE x(term, col, documents, occurrences, languageid HIDDEN)\"\n\n/*\n** This function does all the work for both the xConnect and xCreate methods.\n** These tables have no persistent representation of their own, so xConnect\n** and xCreate are identical operations.\n*/\nstatic int fts3auxConnectMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pUnused,                  /* Unused */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  char const *zDb;                /* Name of database (e.g. \"main\") */\n  char const *zFts3;              /* Name of fts3 table */\n  int nDb;                        /* Result of strlen(zDb) */\n  int nFts3;                      /* Result of strlen(zFts3) */\n  int nByte;                      /* Bytes of space to allocate here */\n  int rc;                         /* value returned by declare_vtab() */\n  Fts3auxTable *p;                /* Virtual table object to return */\n\n  UNUSED_PARAMETER(pUnused);\n\n  /* The user should invoke this in one of two forms:\n  **\n  **     CREATE VIRTUAL TABLE xxx USING fts4aux(fts4-table);\n  **     CREATE VIRTUAL TABLE xxx USING fts4aux(fts4-table-db, fts4-table);\n  */\n  if( argc!=4 && argc!=5 ) goto bad_args;\n\n  zDb = argv[1]; \n  nDb = (int)strlen(zDb);\n  if( argc==5 ){\n    if( nDb==4 && 0==sqlite3_strnicmp(\"temp\", zDb, 4) ){\n      zDb = argv[3]; \n      nDb = (int)strlen(zDb);\n      zFts3 = argv[4];\n    }else{\n      goto bad_args;\n    }\n  }else{\n    zFts3 = argv[3];\n  }\n  nFts3 = (int)strlen(zFts3);\n\n  rc = sqlite3_declare_vtab(db, FTS3_AUX_SCHEMA);\n  if( rc!=SQLITE_OK ) return rc;\n\n  nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2;\n  p = (Fts3auxTable *)sqlite3_malloc(nByte);\n  if( !p ) return SQLITE_NOMEM;\n  memset(p, 0, nByte);\n\n  p->pFts3Tab = (Fts3Table *)&p[1];\n  p->pFts3Tab->zDb = (char *)&p->pFts3Tab[1];\n  p->pFts3Tab->zName = &p->pFts3Tab->zDb[nDb+1];\n  p->pFts3Tab->db = db;\n  p->pFts3Tab->nIndex = 1;\n\n  memcpy((char *)p->pFts3Tab->zDb, zDb, nDb);\n  memcpy((char *)p->pFts3Tab->zName, zFts3, nFts3);\n  sqlite3Fts3Dequote((char *)p->pFts3Tab->zName);\n\n  *ppVtab = (sqlite3_vtab *)p;\n  return SQLITE_OK;\n\n bad_args:\n  sqlite3Fts3ErrMsg(pzErr, \"invalid arguments to fts4aux constructor\");\n  return SQLITE_ERROR;\n}\n\n/*\n** This function does the work for both the xDisconnect and xDestroy methods.\n** These tables have no persistent representation of their own, so xDisconnect\n** and xDestroy are identical operations.\n*/\nstatic int fts3auxDisconnectMethod(sqlite3_vtab *pVtab){\n  Fts3auxTable *p = (Fts3auxTable *)pVtab;\n  Fts3Table *pFts3 = p->pFts3Tab;\n  int i;\n\n  /* Free any prepared statements held */\n  for(i=0; i<SizeofArray(pFts3->aStmt); i++){\n    sqlite3_finalize(pFts3->aStmt[i]);\n  }\n  sqlite3_free(pFts3->zSegmentsTbl);\n  sqlite3_free(p);\n  return SQLITE_OK;\n}\n\n#define FTS4AUX_EQ_CONSTRAINT 1\n#define FTS4AUX_GE_CONSTRAINT 2\n#define FTS4AUX_LE_CONSTRAINT 4\n\n/*\n** xBestIndex - Analyze a WHERE and ORDER BY clause.\n*/\nstatic int fts3auxBestIndexMethod(\n  sqlite3_vtab *pVTab, \n  sqlite3_index_info *pInfo\n){\n  int i;\n  int iEq = -1;\n  int iGe = -1;\n  int iLe = -1;\n  int iLangid = -1;\n  int iNext = 1;                  /* Next free argvIndex value */\n\n  UNUSED_PARAMETER(pVTab);\n\n  /* This vtab delivers always results in \"ORDER BY term ASC\" order. */\n  if( pInfo->nOrderBy==1 \n   && pInfo->aOrderBy[0].iColumn==0 \n   && pInfo->aOrderBy[0].desc==0\n  ){\n    pInfo->orderByConsumed = 1;\n  }\n\n  /* Search for equality and range constraints on the \"term\" column. \n  ** And equality constraints on the hidden \"languageid\" column. */\n  for(i=0; i<pInfo->nConstraint; i++){\n    if( pInfo->aConstraint[i].usable ){\n      int op = pInfo->aConstraint[i].op;\n      int iCol = pInfo->aConstraint[i].iColumn;\n\n      if( iCol==0 ){\n        if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;\n        if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;\n        if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;\n        if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;\n        if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;\n      }\n      if( iCol==4 ){\n        if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iLangid = i;\n      }\n    }\n  }\n\n  if( iEq>=0 ){\n    pInfo->idxNum = FTS4AUX_EQ_CONSTRAINT;\n    pInfo->aConstraintUsage[iEq].argvIndex = iNext++;\n    pInfo->estimatedCost = 5;\n  }else{\n    pInfo->idxNum = 0;\n    pInfo->estimatedCost = 20000;\n    if( iGe>=0 ){\n      pInfo->idxNum += FTS4AUX_GE_CONSTRAINT;\n      pInfo->aConstraintUsage[iGe].argvIndex = iNext++;\n      pInfo->estimatedCost /= 2;\n    }\n    if( iLe>=0 ){\n      pInfo->idxNum += FTS4AUX_LE_CONSTRAINT;\n      pInfo->aConstraintUsage[iLe].argvIndex = iNext++;\n      pInfo->estimatedCost /= 2;\n    }\n  }\n  if( iLangid>=0 ){\n    pInfo->aConstraintUsage[iLangid].argvIndex = iNext++;\n    pInfo->estimatedCost--;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** xOpen - Open a cursor.\n*/\nstatic int fts3auxOpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){\n  Fts3auxCursor *pCsr;            /* Pointer to cursor object to return */\n\n  UNUSED_PARAMETER(pVTab);\n\n  pCsr = (Fts3auxCursor *)sqlite3_malloc(sizeof(Fts3auxCursor));\n  if( !pCsr ) return SQLITE_NOMEM;\n  memset(pCsr, 0, sizeof(Fts3auxCursor));\n\n  *ppCsr = (sqlite3_vtab_cursor *)pCsr;\n  return SQLITE_OK;\n}\n\n/*\n** xClose - Close a cursor.\n*/\nstatic int fts3auxCloseMethod(sqlite3_vtab_cursor *pCursor){\n  Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\n\n  sqlite3Fts3SegmentsClose(pFts3);\n  sqlite3Fts3SegReaderFinish(&pCsr->csr);\n  sqlite3_free((void *)pCsr->filter.zTerm);\n  sqlite3_free(pCsr->zStop);\n  sqlite3_free(pCsr->aStat);\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\nstatic int fts3auxGrowStatArray(Fts3auxCursor *pCsr, int nSize){\n  if( nSize>pCsr->nStat ){\n    struct Fts3auxColstats *aNew;\n    aNew = (struct Fts3auxColstats *)sqlite3_realloc(pCsr->aStat, \n        sizeof(struct Fts3auxColstats) * nSize\n    );\n    if( aNew==0 ) return SQLITE_NOMEM;\n    memset(&aNew[pCsr->nStat], 0, \n        sizeof(struct Fts3auxColstats) * (nSize - pCsr->nStat)\n    );\n    pCsr->aStat = aNew;\n    pCsr->nStat = nSize;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** xNext - Advance the cursor to the next row, if any.\n*/\nstatic int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\n  Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;\n  int rc;\n\n  /* Increment our pretend rowid value. */\n  pCsr->iRowid++;\n\n  for(pCsr->iCol++; pCsr->iCol<pCsr->nStat; pCsr->iCol++){\n    if( pCsr->aStat[pCsr->iCol].nDoc>0 ) return SQLITE_OK;\n  }\n\n  rc = sqlite3Fts3SegReaderStep(pFts3, &pCsr->csr);\n  if( rc==SQLITE_ROW ){\n    int i = 0;\n    int nDoclist = pCsr->csr.nDoclist;\n    char *aDoclist = pCsr->csr.aDoclist;\n    int iCol;\n\n    int eState = 0;\n\n    if( pCsr->zStop ){\n      int n = (pCsr->nStop<pCsr->csr.nTerm) ? pCsr->nStop : pCsr->csr.nTerm;\n      int mc = memcmp(pCsr->zStop, pCsr->csr.zTerm, n);\n      if( mc<0 || (mc==0 && pCsr->csr.nTerm>pCsr->nStop) ){\n        pCsr->isEof = 1;\n        return SQLITE_OK;\n      }\n    }\n\n    if( fts3auxGrowStatArray(pCsr, 2) ) return SQLITE_NOMEM;\n    memset(pCsr->aStat, 0, sizeof(struct Fts3auxColstats) * pCsr->nStat);\n    iCol = 0;\n\n    while( i<nDoclist ){\n      sqlite3_int64 v = 0;\n\n      i += sqlite3Fts3GetVarint(&aDoclist[i], &v);\n      switch( eState ){\n        /* State 0. In this state the integer just read was a docid. */\n        case 0:\n          pCsr->aStat[0].nDoc++;\n          eState = 1;\n          iCol = 0;\n          break;\n\n        /* State 1. In this state we are expecting either a 1, indicating\n        ** that the following integer will be a column number, or the\n        ** start of a position list for column 0.  \n        ** \n        ** The only difference between state 1 and state 2 is that if the\n        ** integer encountered in state 1 is not 0 or 1, then we need to\n        ** increment the column 0 \"nDoc\" count for this term.\n        */\n        case 1:\n          assert( iCol==0 );\n          if( v>1 ){\n            pCsr->aStat[1].nDoc++;\n          }\n          eState = 2;\n          /* fall through */\n\n        case 2:\n          if( v==0 ){       /* 0x00. Next integer will be a docid. */\n            eState = 0;\n          }else if( v==1 ){ /* 0x01. Next integer will be a column number. */\n            eState = 3;\n          }else{            /* 2 or greater. A position. */\n            pCsr->aStat[iCol+1].nOcc++;\n            pCsr->aStat[0].nOcc++;\n          }\n          break;\n\n        /* State 3. The integer just read is a column number. */\n        default: assert( eState==3 );\n          iCol = (int)v;\n          if( fts3auxGrowStatArray(pCsr, iCol+2) ) return SQLITE_NOMEM;\n          pCsr->aStat[iCol+1].nDoc++;\n          eState = 2;\n          break;\n      }\n    }\n\n    pCsr->iCol = 0;\n    rc = SQLITE_OK;\n  }else{\n    pCsr->isEof = 1;\n  }\n  return rc;\n}\n\n/*\n** xFilter - Initialize a cursor to point at the start of its data.\n*/\nstatic int fts3auxFilterMethod(\n  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */\n  int idxNum,                     /* Strategy index */\n  const char *idxStr,             /* Unused */\n  int nVal,                       /* Number of elements in apVal */\n  sqlite3_value **apVal           /* Arguments for the indexing scheme */\n){\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\n  Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;\n  int rc;\n  int isScan = 0;\n  int iLangVal = 0;               /* Language id to query */\n\n  int iEq = -1;                   /* Index of term=? value in apVal */\n  int iGe = -1;                   /* Index of term>=? value in apVal */\n  int iLe = -1;                   /* Index of term<=? value in apVal */\n  int iLangid = -1;               /* Index of languageid=? value in apVal */\n  int iNext = 0;\n\n  UNUSED_PARAMETER(nVal);\n  UNUSED_PARAMETER(idxStr);\n\n  assert( idxStr==0 );\n  assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0\n       || idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT\n       || idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT)\n  );\n\n  if( idxNum==FTS4AUX_EQ_CONSTRAINT ){\n    iEq = iNext++;\n  }else{\n    isScan = 1;\n    if( idxNum & FTS4AUX_GE_CONSTRAINT ){\n      iGe = iNext++;\n    }\n    if( idxNum & FTS4AUX_LE_CONSTRAINT ){\n      iLe = iNext++;\n    }\n  }\n  if( iNext<nVal ){\n    iLangid = iNext++;\n  }\n\n  /* In case this cursor is being reused, close and zero it. */\n  testcase(pCsr->filter.zTerm);\n  sqlite3Fts3SegReaderFinish(&pCsr->csr);\n  sqlite3_free((void *)pCsr->filter.zTerm);\n  sqlite3_free(pCsr->aStat);\n  memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr);\n\n  pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;\n  if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;\n\n  if( iEq>=0 || iGe>=0 ){\n    const unsigned char *zStr = sqlite3_value_text(apVal[0]);\n    assert( (iEq==0 && iGe==-1) || (iEq==-1 && iGe==0) );\n    if( zStr ){\n      pCsr->filter.zTerm = sqlite3_mprintf(\"%s\", zStr);\n      pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]);\n      if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;\n    }\n  }\n\n  if( iLe>=0 ){\n    pCsr->zStop = sqlite3_mprintf(\"%s\", sqlite3_value_text(apVal[iLe]));\n    pCsr->nStop = sqlite3_value_bytes(apVal[iLe]);\n    if( pCsr->zStop==0 ) return SQLITE_NOMEM;\n  }\n  \n  if( iLangid>=0 ){\n    iLangVal = sqlite3_value_int(apVal[iLangid]);\n\n    /* If the user specified a negative value for the languageid, use zero\n    ** instead. This works, as the \"languageid=?\" constraint will also\n    ** be tested by the VDBE layer. The test will always be false (since\n    ** this module will not return a row with a negative languageid), and\n    ** so the overall query will return zero rows.  */\n    if( iLangVal<0 ) iLangVal = 0;\n  }\n  pCsr->iLangid = iLangVal;\n\n  rc = sqlite3Fts3SegReaderCursor(pFts3, iLangVal, 0, FTS3_SEGCURSOR_ALL,\n      pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr\n  );\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter);\n  }\n\n  if( rc==SQLITE_OK ) rc = fts3auxNextMethod(pCursor);\n  return rc;\n}\n\n/*\n** xEof - Return true if the cursor is at EOF, or false otherwise.\n*/\nstatic int fts3auxEofMethod(sqlite3_vtab_cursor *pCursor){\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\n  return pCsr->isEof;\n}\n\n/*\n** xColumn - Return a column value.\n*/\nstatic int fts3auxColumnMethod(\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\n  sqlite3_context *pCtx,          /* Context for sqlite3_result_xxx() calls */\n  int iCol                        /* Index of column to read value from */\n){\n  Fts3auxCursor *p = (Fts3auxCursor *)pCursor;\n\n  assert( p->isEof==0 );\n  switch( iCol ){\n    case 0: /* term */\n      sqlite3_result_text(pCtx, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT);\n      break;\n\n    case 1: /* col */\n      if( p->iCol ){\n        sqlite3_result_int(pCtx, p->iCol-1);\n      }else{\n        sqlite3_result_text(pCtx, \"*\", -1, SQLITE_STATIC);\n      }\n      break;\n\n    case 2: /* documents */\n      sqlite3_result_int64(pCtx, p->aStat[p->iCol].nDoc);\n      break;\n\n    case 3: /* occurrences */\n      sqlite3_result_int64(pCtx, p->aStat[p->iCol].nOcc);\n      break;\n\n    default: /* languageid */\n      assert( iCol==4 );\n      sqlite3_result_int(pCtx, p->iLangid);\n      break;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** xRowid - Return the current rowid for the cursor.\n*/\nstatic int fts3auxRowidMethod(\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\n  sqlite_int64 *pRowid            /* OUT: Rowid value */\n){\n  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;\n  *pRowid = pCsr->iRowid;\n  return SQLITE_OK;\n}\n\n/*\n** Register the fts3aux module with database connection db. Return SQLITE_OK\n** if successful or an error code if sqlite3_create_module() fails.\n*/\nint sqlite3Fts3InitAux(sqlite3 *db){\n  static const sqlite3_module fts3aux_module = {\n     0,                           /* iVersion      */\n     fts3auxConnectMethod,        /* xCreate       */\n     fts3auxConnectMethod,        /* xConnect      */\n     fts3auxBestIndexMethod,      /* xBestIndex    */\n     fts3auxDisconnectMethod,     /* xDisconnect   */\n     fts3auxDisconnectMethod,     /* xDestroy      */\n     fts3auxOpenMethod,           /* xOpen         */\n     fts3auxCloseMethod,          /* xClose        */\n     fts3auxFilterMethod,         /* xFilter       */\n     fts3auxNextMethod,           /* xNext         */\n     fts3auxEofMethod,            /* xEof          */\n     fts3auxColumnMethod,         /* xColumn       */\n     fts3auxRowidMethod,          /* xRowid        */\n     0,                           /* xUpdate       */\n     0,                           /* xBegin        */\n     0,                           /* xSync         */\n     0,                           /* xCommit       */\n     0,                           /* xRollback     */\n     0,                           /* xFindFunction */\n     0,                           /* xRename       */\n     0,                           /* xSavepoint    */\n     0,                           /* xRelease      */\n     0                            /* xRollbackTo   */\n  };\n  int rc;                         /* Return code */\n\n  rc = sqlite3_create_module(db, \"fts4aux\", &fts3aux_module, 0);\n  return rc;\n}\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_expr.c",
    "content": "/*\n** 2008 Nov 28\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This module contains code that implements a parser for fts3 query strings\n** (the right-hand argument to the MATCH operator). Because the supported \n** syntax is relatively simple, the whole tokenizer/parser system is\n** hand-coded. \n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n/*\n** By default, this module parses the legacy syntax that has been \n** traditionally used by fts3. Or, if SQLITE_ENABLE_FTS3_PARENTHESIS\n** is defined, then it uses the new syntax. The differences between\n** the new and the old syntaxes are:\n**\n**  a) The new syntax supports parenthesis. The old does not.\n**\n**  b) The new syntax supports the AND and NOT operators. The old does not.\n**\n**  c) The old syntax supports the \"-\" token qualifier. This is not \n**     supported by the new syntax (it is replaced by the NOT operator).\n**\n**  d) When using the old syntax, the OR operator has a greater precedence\n**     than an implicit AND. When using the new, both implicity and explicit\n**     AND operators have a higher precedence than OR.\n**\n** If compiled with SQLITE_TEST defined, then this module exports the\n** symbol \"int sqlite3_fts3_enable_parentheses\". Setting this variable\n** to zero causes the module to use the old syntax. If it is set to \n** non-zero the new syntax is activated. This is so both syntaxes can\n** be tested using a single build of testfixture.\n**\n** The following describes the syntax supported by the fts3 MATCH\n** operator in a similar format to that used by the lemon parser\n** generator. This module does not use actually lemon, it uses a\n** custom parser.\n**\n**   query ::= andexpr (OR andexpr)*.\n**\n**   andexpr ::= notexpr (AND? notexpr)*.\n**\n**   notexpr ::= nearexpr (NOT nearexpr|-TOKEN)*.\n**   notexpr ::= LP query RP.\n**\n**   nearexpr ::= phrase (NEAR distance_opt nearexpr)*.\n**\n**   distance_opt ::= .\n**   distance_opt ::= / INTEGER.\n**\n**   phrase ::= TOKEN.\n**   phrase ::= COLUMN:TOKEN.\n**   phrase ::= \"TOKEN TOKEN TOKEN...\".\n*/\n\n#ifdef SQLITE_TEST\nint sqlite3_fts3_enable_parentheses = 0;\n#else\n# ifdef SQLITE_ENABLE_FTS3_PARENTHESIS \n#  define sqlite3_fts3_enable_parentheses 1\n# else\n#  define sqlite3_fts3_enable_parentheses 0\n# endif\n#endif\n\n/*\n** Default span for NEAR operators.\n*/\n#define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10\n\n#include <string.h>\n#include <assert.h>\n\n/*\n** isNot:\n**   This variable is used by function getNextNode(). When getNextNode() is\n**   called, it sets ParseContext.isNot to true if the 'next node' is a \n**   FTSQUERY_PHRASE with a unary \"-\" attached to it. i.e. \"mysql\" in the\n**   FTS3 query \"sqlite -mysql\". Otherwise, ParseContext.isNot is set to\n**   zero.\n*/\ntypedef struct ParseContext ParseContext;\nstruct ParseContext {\n  sqlite3_tokenizer *pTokenizer;      /* Tokenizer module */\n  int iLangid;                        /* Language id used with tokenizer */\n  const char **azCol;                 /* Array of column names for fts3 table */\n  int bFts4;                          /* True to allow FTS4-only syntax */\n  int nCol;                           /* Number of entries in azCol[] */\n  int iDefaultCol;                    /* Default column to query */\n  int isNot;                          /* True if getNextNode() sees a unary - */\n  sqlite3_context *pCtx;              /* Write error message here */\n  int nNest;                          /* Number of nested brackets */\n};\n\n/*\n** This function is equivalent to the standard isspace() function. \n**\n** The standard isspace() can be awkward to use safely, because although it\n** is defined to accept an argument of type int, its behavior when passed\n** an integer that falls outside of the range of the unsigned char type\n** is undefined (and sometimes, \"undefined\" means segfault). This wrapper\n** is defined to accept an argument of type char, and always returns 0 for\n** any values that fall outside of the range of the unsigned char type (i.e.\n** negative values).\n*/\nstatic int fts3isspace(char c){\n  return c==' ' || c=='\\t' || c=='\\n' || c=='\\r' || c=='\\v' || c=='\\f';\n}\n\n/*\n** Allocate nByte bytes of memory using sqlite3_malloc(). If successful,\n** zero the memory before returning a pointer to it. If unsuccessful, \n** return NULL.\n*/\nstatic void *fts3MallocZero(int nByte){\n  void *pRet = sqlite3_malloc(nByte);\n  if( pRet ) memset(pRet, 0, nByte);\n  return pRet;\n}\n\nint sqlite3Fts3OpenTokenizer(\n  sqlite3_tokenizer *pTokenizer,\n  int iLangid,\n  const char *z,\n  int n,\n  sqlite3_tokenizer_cursor **ppCsr\n){\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\n  sqlite3_tokenizer_cursor *pCsr = 0;\n  int rc;\n\n  rc = pModule->xOpen(pTokenizer, z, n, &pCsr);\n  assert( rc==SQLITE_OK || pCsr==0 );\n  if( rc==SQLITE_OK ){\n    pCsr->pTokenizer = pTokenizer;\n    if( pModule->iVersion>=1 ){\n      rc = pModule->xLanguageid(pCsr, iLangid);\n      if( rc!=SQLITE_OK ){\n        pModule->xClose(pCsr);\n        pCsr = 0;\n      }\n    }\n  }\n  *ppCsr = pCsr;\n  return rc;\n}\n\n/*\n** Function getNextNode(), which is called by fts3ExprParse(), may itself\n** call fts3ExprParse(). So this forward declaration is required.\n*/\nstatic int fts3ExprParse(ParseContext *, const char *, int, Fts3Expr **, int *);\n\n/*\n** Extract the next token from buffer z (length n) using the tokenizer\n** and other information (column names etc.) in pParse. Create an Fts3Expr\n** structure of type FTSQUERY_PHRASE containing a phrase consisting of this\n** single token and set *ppExpr to point to it. If the end of the buffer is\n** reached before a token is found, set *ppExpr to zero. It is the\n** responsibility of the caller to eventually deallocate the allocated \n** Fts3Expr structure (if any) by passing it to sqlite3_free().\n**\n** Return SQLITE_OK if successful, or SQLITE_NOMEM if a memory allocation\n** fails.\n*/\nstatic int getNextToken(\n  ParseContext *pParse,                   /* fts3 query parse context */\n  int iCol,                               /* Value for Fts3Phrase.iColumn */\n  const char *z, int n,                   /* Input string */\n  Fts3Expr **ppExpr,                      /* OUT: expression */\n  int *pnConsumed                         /* OUT: Number of bytes consumed */\n){\n  sqlite3_tokenizer *pTokenizer = pParse->pTokenizer;\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\n  int rc;\n  sqlite3_tokenizer_cursor *pCursor;\n  Fts3Expr *pRet = 0;\n  int i = 0;\n\n  /* Set variable i to the maximum number of bytes of input to tokenize. */\n  for(i=0; i<n; i++){\n    if( sqlite3_fts3_enable_parentheses && (z[i]=='(' || z[i]==')') ) break;\n    if( z[i]=='\"' ) break;\n  }\n\n  *pnConsumed = i;\n  rc = sqlite3Fts3OpenTokenizer(pTokenizer, pParse->iLangid, z, i, &pCursor);\n  if( rc==SQLITE_OK ){\n    const char *zToken;\n    int nToken = 0, iStart = 0, iEnd = 0, iPosition = 0;\n    int nByte;                               /* total space to allocate */\n\n    rc = pModule->xNext(pCursor, &zToken, &nToken, &iStart, &iEnd, &iPosition);\n    if( rc==SQLITE_OK ){\n      nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase) + nToken;\n      pRet = (Fts3Expr *)fts3MallocZero(nByte);\n      if( !pRet ){\n        rc = SQLITE_NOMEM;\n      }else{\n        pRet->eType = FTSQUERY_PHRASE;\n        pRet->pPhrase = (Fts3Phrase *)&pRet[1];\n        pRet->pPhrase->nToken = 1;\n        pRet->pPhrase->iColumn = iCol;\n        pRet->pPhrase->aToken[0].n = nToken;\n        pRet->pPhrase->aToken[0].z = (char *)&pRet->pPhrase[1];\n        memcpy(pRet->pPhrase->aToken[0].z, zToken, nToken);\n\n        if( iEnd<n && z[iEnd]=='*' ){\n          pRet->pPhrase->aToken[0].isPrefix = 1;\n          iEnd++;\n        }\n\n        while( 1 ){\n          if( !sqlite3_fts3_enable_parentheses \n           && iStart>0 && z[iStart-1]=='-' \n          ){\n            pParse->isNot = 1;\n            iStart--;\n          }else if( pParse->bFts4 && iStart>0 && z[iStart-1]=='^' ){\n            pRet->pPhrase->aToken[0].bFirst = 1;\n            iStart--;\n          }else{\n            break;\n          }\n        }\n\n      }\n      *pnConsumed = iEnd;\n    }else if( i && rc==SQLITE_DONE ){\n      rc = SQLITE_OK;\n    }\n\n    pModule->xClose(pCursor);\n  }\n  \n  *ppExpr = pRet;\n  return rc;\n}\n\n\n/*\n** Enlarge a memory allocation.  If an out-of-memory allocation occurs,\n** then free the old allocation.\n*/\nstatic void *fts3ReallocOrFree(void *pOrig, int nNew){\n  void *pRet = sqlite3_realloc(pOrig, nNew);\n  if( !pRet ){\n    sqlite3_free(pOrig);\n  }\n  return pRet;\n}\n\n/*\n** Buffer zInput, length nInput, contains the contents of a quoted string\n** that appeared as part of an fts3 query expression. Neither quote character\n** is included in the buffer. This function attempts to tokenize the entire\n** input buffer and create an Fts3Expr structure of type FTSQUERY_PHRASE \n** containing the results.\n**\n** If successful, SQLITE_OK is returned and *ppExpr set to point at the\n** allocated Fts3Expr structure. Otherwise, either SQLITE_NOMEM (out of memory\n** error) or SQLITE_ERROR (tokenization error) is returned and *ppExpr set\n** to 0.\n*/\nstatic int getNextString(\n  ParseContext *pParse,                   /* fts3 query parse context */\n  const char *zInput, int nInput,         /* Input string */\n  Fts3Expr **ppExpr                       /* OUT: expression */\n){\n  sqlite3_tokenizer *pTokenizer = pParse->pTokenizer;\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\n  int rc;\n  Fts3Expr *p = 0;\n  sqlite3_tokenizer_cursor *pCursor = 0;\n  char *zTemp = 0;\n  int nTemp = 0;\n\n  const int nSpace = sizeof(Fts3Expr) + sizeof(Fts3Phrase);\n  int nToken = 0;\n\n  /* The final Fts3Expr data structure, including the Fts3Phrase,\n  ** Fts3PhraseToken structures token buffers are all stored as a single \n  ** allocation so that the expression can be freed with a single call to\n  ** sqlite3_free(). Setting this up requires a two pass approach.\n  **\n  ** The first pass, in the block below, uses a tokenizer cursor to iterate\n  ** through the tokens in the expression. This pass uses fts3ReallocOrFree()\n  ** to assemble data in two dynamic buffers:\n  **\n  **   Buffer p: Points to the Fts3Expr structure, followed by the Fts3Phrase\n  **             structure, followed by the array of Fts3PhraseToken \n  **             structures. This pass only populates the Fts3PhraseToken array.\n  **\n  **   Buffer zTemp: Contains copies of all tokens.\n  **\n  ** The second pass, in the block that begins \"if( rc==SQLITE_DONE )\" below,\n  ** appends buffer zTemp to buffer p, and fills in the Fts3Expr and Fts3Phrase\n  ** structures.\n  */\n  rc = sqlite3Fts3OpenTokenizer(\n      pTokenizer, pParse->iLangid, zInput, nInput, &pCursor);\n  if( rc==SQLITE_OK ){\n    int ii;\n    for(ii=0; rc==SQLITE_OK; ii++){\n      const char *zByte;\n      int nByte = 0, iBegin = 0, iEnd = 0, iPos = 0;\n      rc = pModule->xNext(pCursor, &zByte, &nByte, &iBegin, &iEnd, &iPos);\n      if( rc==SQLITE_OK ){\n        Fts3PhraseToken *pToken;\n\n        p = fts3ReallocOrFree(p, nSpace + ii*sizeof(Fts3PhraseToken));\n        if( !p ) goto no_mem;\n\n        zTemp = fts3ReallocOrFree(zTemp, nTemp + nByte);\n        if( !zTemp ) goto no_mem;\n\n        assert( nToken==ii );\n        pToken = &((Fts3Phrase *)(&p[1]))->aToken[ii];\n        memset(pToken, 0, sizeof(Fts3PhraseToken));\n\n        memcpy(&zTemp[nTemp], zByte, nByte);\n        nTemp += nByte;\n\n        pToken->n = nByte;\n        pToken->isPrefix = (iEnd<nInput && zInput[iEnd]=='*');\n        pToken->bFirst = (iBegin>0 && zInput[iBegin-1]=='^');\n        nToken = ii+1;\n      }\n    }\n\n    pModule->xClose(pCursor);\n    pCursor = 0;\n  }\n\n  if( rc==SQLITE_DONE ){\n    int jj;\n    char *zBuf = 0;\n\n    p = fts3ReallocOrFree(p, nSpace + nToken*sizeof(Fts3PhraseToken) + nTemp);\n    if( !p ) goto no_mem;\n    memset(p, 0, (char *)&(((Fts3Phrase *)&p[1])->aToken[0])-(char *)p);\n    p->eType = FTSQUERY_PHRASE;\n    p->pPhrase = (Fts3Phrase *)&p[1];\n    p->pPhrase->iColumn = pParse->iDefaultCol;\n    p->pPhrase->nToken = nToken;\n\n    zBuf = (char *)&p->pPhrase->aToken[nToken];\n    if( zTemp ){\n      memcpy(zBuf, zTemp, nTemp);\n      sqlite3_free(zTemp);\n    }else{\n      assert( nTemp==0 );\n    }\n\n    for(jj=0; jj<p->pPhrase->nToken; jj++){\n      p->pPhrase->aToken[jj].z = zBuf;\n      zBuf += p->pPhrase->aToken[jj].n;\n    }\n    rc = SQLITE_OK;\n  }\n\n  *ppExpr = p;\n  return rc;\nno_mem:\n\n  if( pCursor ){\n    pModule->xClose(pCursor);\n  }\n  sqlite3_free(zTemp);\n  sqlite3_free(p);\n  *ppExpr = 0;\n  return SQLITE_NOMEM;\n}\n\n/*\n** The output variable *ppExpr is populated with an allocated Fts3Expr \n** structure, or set to 0 if the end of the input buffer is reached.\n**\n** Returns an SQLite error code. SQLITE_OK if everything works, SQLITE_NOMEM\n** if a malloc failure occurs, or SQLITE_ERROR if a parse error is encountered.\n** If SQLITE_ERROR is returned, pContext is populated with an error message.\n*/\nstatic int getNextNode(\n  ParseContext *pParse,                   /* fts3 query parse context */\n  const char *z, int n,                   /* Input string */\n  Fts3Expr **ppExpr,                      /* OUT: expression */\n  int *pnConsumed                         /* OUT: Number of bytes consumed */\n){\n  static const struct Fts3Keyword {\n    char *z;                              /* Keyword text */\n    unsigned char n;                      /* Length of the keyword */\n    unsigned char parenOnly;              /* Only valid in paren mode */\n    unsigned char eType;                  /* Keyword code */\n  } aKeyword[] = {\n    { \"OR\" ,  2, 0, FTSQUERY_OR   },\n    { \"AND\",  3, 1, FTSQUERY_AND  },\n    { \"NOT\",  3, 1, FTSQUERY_NOT  },\n    { \"NEAR\", 4, 0, FTSQUERY_NEAR }\n  };\n  int ii;\n  int iCol;\n  int iColLen;\n  int rc;\n  Fts3Expr *pRet = 0;\n\n  const char *zInput = z;\n  int nInput = n;\n\n  pParse->isNot = 0;\n\n  /* Skip over any whitespace before checking for a keyword, an open or\n  ** close bracket, or a quoted string. \n  */\n  while( nInput>0 && fts3isspace(*zInput) ){\n    nInput--;\n    zInput++;\n  }\n  if( nInput==0 ){\n    return SQLITE_DONE;\n  }\n\n  /* See if we are dealing with a keyword. */\n  for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){\n    const struct Fts3Keyword *pKey = &aKeyword[ii];\n\n    if( (pKey->parenOnly & ~sqlite3_fts3_enable_parentheses)!=0 ){\n      continue;\n    }\n\n    if( nInput>=pKey->n && 0==memcmp(zInput, pKey->z, pKey->n) ){\n      int nNear = SQLITE_FTS3_DEFAULT_NEAR_PARAM;\n      int nKey = pKey->n;\n      char cNext;\n\n      /* If this is a \"NEAR\" keyword, check for an explicit nearness. */\n      if( pKey->eType==FTSQUERY_NEAR ){\n        assert( nKey==4 );\n        if( zInput[4]=='/' && zInput[5]>='0' && zInput[5]<='9' ){\n          nNear = 0;\n          for(nKey=5; zInput[nKey]>='0' && zInput[nKey]<='9'; nKey++){\n            nNear = nNear * 10 + (zInput[nKey] - '0');\n          }\n        }\n      }\n\n      /* At this point this is probably a keyword. But for that to be true,\n      ** the next byte must contain either whitespace, an open or close\n      ** parenthesis, a quote character, or EOF. \n      */\n      cNext = zInput[nKey];\n      if( fts3isspace(cNext) \n       || cNext=='\"' || cNext=='(' || cNext==')' || cNext==0\n      ){\n        pRet = (Fts3Expr *)fts3MallocZero(sizeof(Fts3Expr));\n        if( !pRet ){\n          return SQLITE_NOMEM;\n        }\n        pRet->eType = pKey->eType;\n        pRet->nNear = nNear;\n        *ppExpr = pRet;\n        *pnConsumed = (int)((zInput - z) + nKey);\n        return SQLITE_OK;\n      }\n\n      /* Turns out that wasn't a keyword after all. This happens if the\n      ** user has supplied a token such as \"ORacle\". Continue.\n      */\n    }\n  }\n\n  /* See if we are dealing with a quoted phrase. If this is the case, then\n  ** search for the closing quote and pass the whole string to getNextString()\n  ** for processing. This is easy to do, as fts3 has no syntax for escaping\n  ** a quote character embedded in a string.\n  */\n  if( *zInput=='\"' ){\n    for(ii=1; ii<nInput && zInput[ii]!='\"'; ii++);\n    *pnConsumed = (int)((zInput - z) + ii + 1);\n    if( ii==nInput ){\n      return SQLITE_ERROR;\n    }\n    return getNextString(pParse, &zInput[1], ii-1, ppExpr);\n  }\n\n  if( sqlite3_fts3_enable_parentheses ){\n    if( *zInput=='(' ){\n      int nConsumed = 0;\n      pParse->nNest++;\n      rc = fts3ExprParse(pParse, zInput+1, nInput-1, ppExpr, &nConsumed);\n      if( rc==SQLITE_OK && !*ppExpr ){ rc = SQLITE_DONE; }\n      *pnConsumed = (int)(zInput - z) + 1 + nConsumed;\n      return rc;\n    }else if( *zInput==')' ){\n      pParse->nNest--;\n      *pnConsumed = (int)((zInput - z) + 1);\n      *ppExpr = 0;\n      return SQLITE_DONE;\n    }\n  }\n\n  /* If control flows to this point, this must be a regular token, or \n  ** the end of the input. Read a regular token using the sqlite3_tokenizer\n  ** interface. Before doing so, figure out if there is an explicit\n  ** column specifier for the token. \n  **\n  ** TODO: Strangely, it is not possible to associate a column specifier\n  ** with a quoted phrase, only with a single token. Not sure if this was\n  ** an implementation artifact or an intentional decision when fts3 was\n  ** first implemented. Whichever it was, this module duplicates the \n  ** limitation.\n  */\n  iCol = pParse->iDefaultCol;\n  iColLen = 0;\n  for(ii=0; ii<pParse->nCol; ii++){\n    const char *zStr = pParse->azCol[ii];\n    int nStr = (int)strlen(zStr);\n    if( nInput>nStr && zInput[nStr]==':' \n     && sqlite3_strnicmp(zStr, zInput, nStr)==0 \n    ){\n      iCol = ii;\n      iColLen = (int)((zInput - z) + nStr + 1);\n      break;\n    }\n  }\n  rc = getNextToken(pParse, iCol, &z[iColLen], n-iColLen, ppExpr, pnConsumed);\n  *pnConsumed += iColLen;\n  return rc;\n}\n\n/*\n** The argument is an Fts3Expr structure for a binary operator (any type\n** except an FTSQUERY_PHRASE). Return an integer value representing the\n** precedence of the operator. Lower values have a higher precedence (i.e.\n** group more tightly). For example, in the C language, the == operator\n** groups more tightly than ||, and would therefore have a higher precedence.\n**\n** When using the new fts3 query syntax (when SQLITE_ENABLE_FTS3_PARENTHESIS\n** is defined), the order of the operators in precedence from highest to\n** lowest is:\n**\n**   NEAR\n**   NOT\n**   AND (including implicit ANDs)\n**   OR\n**\n** Note that when using the old query syntax, the OR operator has a higher\n** precedence than the AND operator.\n*/\nstatic int opPrecedence(Fts3Expr *p){\n  assert( p->eType!=FTSQUERY_PHRASE );\n  if( sqlite3_fts3_enable_parentheses ){\n    return p->eType;\n  }else if( p->eType==FTSQUERY_NEAR ){\n    return 1;\n  }else if( p->eType==FTSQUERY_OR ){\n    return 2;\n  }\n  assert( p->eType==FTSQUERY_AND );\n  return 3;\n}\n\n/*\n** Argument ppHead contains a pointer to the current head of a query \n** expression tree being parsed. pPrev is the expression node most recently\n** inserted into the tree. This function adds pNew, which is always a binary\n** operator node, into the expression tree based on the relative precedence\n** of pNew and the existing nodes of the tree. This may result in the head\n** of the tree changing, in which case *ppHead is set to the new root node.\n*/\nstatic void insertBinaryOperator(\n  Fts3Expr **ppHead,       /* Pointer to the root node of a tree */\n  Fts3Expr *pPrev,         /* Node most recently inserted into the tree */\n  Fts3Expr *pNew           /* New binary node to insert into expression tree */\n){\n  Fts3Expr *pSplit = pPrev;\n  while( pSplit->pParent && opPrecedence(pSplit->pParent)<=opPrecedence(pNew) ){\n    pSplit = pSplit->pParent;\n  }\n\n  if( pSplit->pParent ){\n    assert( pSplit->pParent->pRight==pSplit );\n    pSplit->pParent->pRight = pNew;\n    pNew->pParent = pSplit->pParent;\n  }else{\n    *ppHead = pNew;\n  }\n  pNew->pLeft = pSplit;\n  pSplit->pParent = pNew;\n}\n\n/*\n** Parse the fts3 query expression found in buffer z, length n. This function\n** returns either when the end of the buffer is reached or an unmatched \n** closing bracket - ')' - is encountered.\n**\n** If successful, SQLITE_OK is returned, *ppExpr is set to point to the\n** parsed form of the expression and *pnConsumed is set to the number of\n** bytes read from buffer z. Otherwise, *ppExpr is set to 0 and SQLITE_NOMEM\n** (out of memory error) or SQLITE_ERROR (parse error) is returned.\n*/\nstatic int fts3ExprParse(\n  ParseContext *pParse,                   /* fts3 query parse context */\n  const char *z, int n,                   /* Text of MATCH query */\n  Fts3Expr **ppExpr,                      /* OUT: Parsed query structure */\n  int *pnConsumed                         /* OUT: Number of bytes consumed */\n){\n  Fts3Expr *pRet = 0;\n  Fts3Expr *pPrev = 0;\n  Fts3Expr *pNotBranch = 0;               /* Only used in legacy parse mode */\n  int nIn = n;\n  const char *zIn = z;\n  int rc = SQLITE_OK;\n  int isRequirePhrase = 1;\n\n  while( rc==SQLITE_OK ){\n    Fts3Expr *p = 0;\n    int nByte = 0;\n\n    rc = getNextNode(pParse, zIn, nIn, &p, &nByte);\n    assert( nByte>0 || (rc!=SQLITE_OK && p==0) );\n    if( rc==SQLITE_OK ){\n      if( p ){\n        int isPhrase;\n\n        if( !sqlite3_fts3_enable_parentheses \n            && p->eType==FTSQUERY_PHRASE && pParse->isNot \n        ){\n          /* Create an implicit NOT operator. */\n          Fts3Expr *pNot = fts3MallocZero(sizeof(Fts3Expr));\n          if( !pNot ){\n            sqlite3Fts3ExprFree(p);\n            rc = SQLITE_NOMEM;\n            goto exprparse_out;\n          }\n          pNot->eType = FTSQUERY_NOT;\n          pNot->pRight = p;\n          p->pParent = pNot;\n          if( pNotBranch ){\n            pNot->pLeft = pNotBranch;\n            pNotBranch->pParent = pNot;\n          }\n          pNotBranch = pNot;\n          p = pPrev;\n        }else{\n          int eType = p->eType;\n          isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft);\n\n          /* The isRequirePhrase variable is set to true if a phrase or\n          ** an expression contained in parenthesis is required. If a\n          ** binary operator (AND, OR, NOT or NEAR) is encounted when\n          ** isRequirePhrase is set, this is a syntax error.\n          */\n          if( !isPhrase && isRequirePhrase ){\n            sqlite3Fts3ExprFree(p);\n            rc = SQLITE_ERROR;\n            goto exprparse_out;\n          }\n\n          if( isPhrase && !isRequirePhrase ){\n            /* Insert an implicit AND operator. */\n            Fts3Expr *pAnd;\n            assert( pRet && pPrev );\n            pAnd = fts3MallocZero(sizeof(Fts3Expr));\n            if( !pAnd ){\n              sqlite3Fts3ExprFree(p);\n              rc = SQLITE_NOMEM;\n              goto exprparse_out;\n            }\n            pAnd->eType = FTSQUERY_AND;\n            insertBinaryOperator(&pRet, pPrev, pAnd);\n            pPrev = pAnd;\n          }\n\n          /* This test catches attempts to make either operand of a NEAR\n           ** operator something other than a phrase. For example, either of\n           ** the following:\n           **\n           **    (bracketed expression) NEAR phrase\n           **    phrase NEAR (bracketed expression)\n           **\n           ** Return an error in either case.\n           */\n          if( pPrev && (\n            (eType==FTSQUERY_NEAR && !isPhrase && pPrev->eType!=FTSQUERY_PHRASE)\n         || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR)\n          )){\n            sqlite3Fts3ExprFree(p);\n            rc = SQLITE_ERROR;\n            goto exprparse_out;\n          }\n\n          if( isPhrase ){\n            if( pRet ){\n              assert( pPrev && pPrev->pLeft && pPrev->pRight==0 );\n              pPrev->pRight = p;\n              p->pParent = pPrev;\n            }else{\n              pRet = p;\n            }\n          }else{\n            insertBinaryOperator(&pRet, pPrev, p);\n          }\n          isRequirePhrase = !isPhrase;\n        }\n        pPrev = p;\n      }\n      assert( nByte>0 );\n    }\n    assert( rc!=SQLITE_OK || (nByte>0 && nByte<=nIn) );\n    nIn -= nByte;\n    zIn += nByte;\n  }\n\n  if( rc==SQLITE_DONE && pRet && isRequirePhrase ){\n    rc = SQLITE_ERROR;\n  }\n\n  if( rc==SQLITE_DONE ){\n    rc = SQLITE_OK;\n    if( !sqlite3_fts3_enable_parentheses && pNotBranch ){\n      if( !pRet ){\n        rc = SQLITE_ERROR;\n      }else{\n        Fts3Expr *pIter = pNotBranch;\n        while( pIter->pLeft ){\n          pIter = pIter->pLeft;\n        }\n        pIter->pLeft = pRet;\n        pRet->pParent = pIter;\n        pRet = pNotBranch;\n      }\n    }\n  }\n  *pnConsumed = n - nIn;\n\nexprparse_out:\n  if( rc!=SQLITE_OK ){\n    sqlite3Fts3ExprFree(pRet);\n    sqlite3Fts3ExprFree(pNotBranch);\n    pRet = 0;\n  }\n  *ppExpr = pRet;\n  return rc;\n}\n\n/*\n** Return SQLITE_ERROR if the maximum depth of the expression tree passed \n** as the only argument is more than nMaxDepth.\n*/\nstatic int fts3ExprCheckDepth(Fts3Expr *p, int nMaxDepth){\n  int rc = SQLITE_OK;\n  if( p ){\n    if( nMaxDepth<0 ){ \n      rc = SQLITE_TOOBIG;\n    }else{\n      rc = fts3ExprCheckDepth(p->pLeft, nMaxDepth-1);\n      if( rc==SQLITE_OK ){\n        rc = fts3ExprCheckDepth(p->pRight, nMaxDepth-1);\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** This function attempts to transform the expression tree at (*pp) to\n** an equivalent but more balanced form. The tree is modified in place.\n** If successful, SQLITE_OK is returned and (*pp) set to point to the \n** new root expression node. \n**\n** nMaxDepth is the maximum allowable depth of the balanced sub-tree.\n**\n** Otherwise, if an error occurs, an SQLite error code is returned and \n** expression (*pp) freed.\n*/\nstatic int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){\n  int rc = SQLITE_OK;             /* Return code */\n  Fts3Expr *pRoot = *pp;          /* Initial root node */\n  Fts3Expr *pFree = 0;            /* List of free nodes. Linked by pParent. */\n  int eType = pRoot->eType;       /* Type of node in this tree */\n\n  if( nMaxDepth==0 ){\n    rc = SQLITE_ERROR;\n  }\n\n  if( rc==SQLITE_OK ){\n    if( (eType==FTSQUERY_AND || eType==FTSQUERY_OR) ){\n      Fts3Expr **apLeaf;\n      apLeaf = (Fts3Expr **)sqlite3_malloc(sizeof(Fts3Expr *) * nMaxDepth);\n      if( 0==apLeaf ){\n        rc = SQLITE_NOMEM;\n      }else{\n        memset(apLeaf, 0, sizeof(Fts3Expr *) * nMaxDepth);\n      }\n\n      if( rc==SQLITE_OK ){\n        int i;\n        Fts3Expr *p;\n\n        /* Set $p to point to the left-most leaf in the tree of eType nodes. */\n        for(p=pRoot; p->eType==eType; p=p->pLeft){\n          assert( p->pParent==0 || p->pParent->pLeft==p );\n          assert( p->pLeft && p->pRight );\n        }\n\n        /* This loop runs once for each leaf in the tree of eType nodes. */\n        while( 1 ){\n          int iLvl;\n          Fts3Expr *pParent = p->pParent;     /* Current parent of p */\n\n          assert( pParent==0 || pParent->pLeft==p );\n          p->pParent = 0;\n          if( pParent ){\n            pParent->pLeft = 0;\n          }else{\n            pRoot = 0;\n          }\n          rc = fts3ExprBalance(&p, nMaxDepth-1);\n          if( rc!=SQLITE_OK ) break;\n\n          for(iLvl=0; p && iLvl<nMaxDepth; iLvl++){\n            if( apLeaf[iLvl]==0 ){\n              apLeaf[iLvl] = p;\n              p = 0;\n            }else{\n              assert( pFree );\n              pFree->pLeft = apLeaf[iLvl];\n              pFree->pRight = p;\n              pFree->pLeft->pParent = pFree;\n              pFree->pRight->pParent = pFree;\n\n              p = pFree;\n              pFree = pFree->pParent;\n              p->pParent = 0;\n              apLeaf[iLvl] = 0;\n            }\n          }\n          if( p ){\n            sqlite3Fts3ExprFree(p);\n            rc = SQLITE_TOOBIG;\n            break;\n          }\n\n          /* If that was the last leaf node, break out of the loop */\n          if( pParent==0 ) break;\n\n          /* Set $p to point to the next leaf in the tree of eType nodes */\n          for(p=pParent->pRight; p->eType==eType; p=p->pLeft);\n\n          /* Remove pParent from the original tree. */\n          assert( pParent->pParent==0 || pParent->pParent->pLeft==pParent );\n          pParent->pRight->pParent = pParent->pParent;\n          if( pParent->pParent ){\n            pParent->pParent->pLeft = pParent->pRight;\n          }else{\n            assert( pParent==pRoot );\n            pRoot = pParent->pRight;\n          }\n\n          /* Link pParent into the free node list. It will be used as an\n          ** internal node of the new tree.  */\n          pParent->pParent = pFree;\n          pFree = pParent;\n        }\n\n        if( rc==SQLITE_OK ){\n          p = 0;\n          for(i=0; i<nMaxDepth; i++){\n            if( apLeaf[i] ){\n              if( p==0 ){\n                p = apLeaf[i];\n                p->pParent = 0;\n              }else{\n                assert( pFree!=0 );\n                pFree->pRight = p;\n                pFree->pLeft = apLeaf[i];\n                pFree->pLeft->pParent = pFree;\n                pFree->pRight->pParent = pFree;\n\n                p = pFree;\n                pFree = pFree->pParent;\n                p->pParent = 0;\n              }\n            }\n          }\n          pRoot = p;\n        }else{\n          /* An error occurred. Delete the contents of the apLeaf[] array \n          ** and pFree list. Everything else is cleaned up by the call to\n          ** sqlite3Fts3ExprFree(pRoot) below.  */\n          Fts3Expr *pDel;\n          for(i=0; i<nMaxDepth; i++){\n            sqlite3Fts3ExprFree(apLeaf[i]);\n          }\n          while( (pDel=pFree)!=0 ){\n            pFree = pDel->pParent;\n            sqlite3_free(pDel);\n          }\n        }\n\n        assert( pFree==0 );\n        sqlite3_free( apLeaf );\n      }\n    }else if( eType==FTSQUERY_NOT ){\n      Fts3Expr *pLeft = pRoot->pLeft;\n      Fts3Expr *pRight = pRoot->pRight;\n\n      pRoot->pLeft = 0;\n      pRoot->pRight = 0;\n      pLeft->pParent = 0;\n      pRight->pParent = 0;\n\n      rc = fts3ExprBalance(&pLeft, nMaxDepth-1);\n      if( rc==SQLITE_OK ){\n        rc = fts3ExprBalance(&pRight, nMaxDepth-1);\n      }\n\n      if( rc!=SQLITE_OK ){\n        sqlite3Fts3ExprFree(pRight);\n        sqlite3Fts3ExprFree(pLeft);\n      }else{\n        assert( pLeft && pRight );\n        pRoot->pLeft = pLeft;\n        pLeft->pParent = pRoot;\n        pRoot->pRight = pRight;\n        pRight->pParent = pRoot;\n      }\n    }\n  }\n  \n  if( rc!=SQLITE_OK ){\n    sqlite3Fts3ExprFree(pRoot);\n    pRoot = 0;\n  }\n  *pp = pRoot;\n  return rc;\n}\n\n/*\n** This function is similar to sqlite3Fts3ExprParse(), with the following\n** differences:\n**\n**   1. It does not do expression rebalancing.\n**   2. It does not check that the expression does not exceed the \n**      maximum allowable depth.\n**   3. Even if it fails, *ppExpr may still be set to point to an \n**      expression tree. It should be deleted using sqlite3Fts3ExprFree()\n**      in this case.\n*/\nstatic int fts3ExprParseUnbalanced(\n  sqlite3_tokenizer *pTokenizer,      /* Tokenizer module */\n  int iLangid,                        /* Language id for tokenizer */\n  char **azCol,                       /* Array of column names for fts3 table */\n  int bFts4,                          /* True to allow FTS4-only syntax */\n  int nCol,                           /* Number of entries in azCol[] */\n  int iDefaultCol,                    /* Default column to query */\n  const char *z, int n,               /* Text of MATCH query */\n  Fts3Expr **ppExpr                   /* OUT: Parsed query structure */\n){\n  int nParsed;\n  int rc;\n  ParseContext sParse;\n\n  memset(&sParse, 0, sizeof(ParseContext));\n  sParse.pTokenizer = pTokenizer;\n  sParse.iLangid = iLangid;\n  sParse.azCol = (const char **)azCol;\n  sParse.nCol = nCol;\n  sParse.iDefaultCol = iDefaultCol;\n  sParse.bFts4 = bFts4;\n  if( z==0 ){\n    *ppExpr = 0;\n    return SQLITE_OK;\n  }\n  if( n<0 ){\n    n = (int)strlen(z);\n  }\n  rc = fts3ExprParse(&sParse, z, n, ppExpr, &nParsed);\n  assert( rc==SQLITE_OK || *ppExpr==0 );\n\n  /* Check for mismatched parenthesis */\n  if( rc==SQLITE_OK && sParse.nNest ){\n    rc = SQLITE_ERROR;\n  }\n  \n  return rc;\n}\n\n/*\n** Parameters z and n contain a pointer to and length of a buffer containing\n** an fts3 query expression, respectively. This function attempts to parse the\n** query expression and create a tree of Fts3Expr structures representing the\n** parsed expression. If successful, *ppExpr is set to point to the head\n** of the parsed expression tree and SQLITE_OK is returned. If an error\n** occurs, either SQLITE_NOMEM (out-of-memory error) or SQLITE_ERROR (parse\n** error) is returned and *ppExpr is set to 0.\n**\n** If parameter n is a negative number, then z is assumed to point to a\n** nul-terminated string and the length is determined using strlen().\n**\n** The first parameter, pTokenizer, is passed the fts3 tokenizer module to\n** use to normalize query tokens while parsing the expression. The azCol[]\n** array, which is assumed to contain nCol entries, should contain the names\n** of each column in the target fts3 table, in order from left to right. \n** Column names must be nul-terminated strings.\n**\n** The iDefaultCol parameter should be passed the index of the table column\n** that appears on the left-hand-side of the MATCH operator (the default\n** column to match against for tokens for which a column name is not explicitly\n** specified as part of the query string), or -1 if tokens may by default\n** match any table column.\n*/\nint sqlite3Fts3ExprParse(\n  sqlite3_tokenizer *pTokenizer,      /* Tokenizer module */\n  int iLangid,                        /* Language id for tokenizer */\n  char **azCol,                       /* Array of column names for fts3 table */\n  int bFts4,                          /* True to allow FTS4-only syntax */\n  int nCol,                           /* Number of entries in azCol[] */\n  int iDefaultCol,                    /* Default column to query */\n  const char *z, int n,               /* Text of MATCH query */\n  Fts3Expr **ppExpr,                  /* OUT: Parsed query structure */\n  char **pzErr                        /* OUT: Error message (sqlite3_malloc) */\n){\n  int rc = fts3ExprParseUnbalanced(\n      pTokenizer, iLangid, azCol, bFts4, nCol, iDefaultCol, z, n, ppExpr\n  );\n  \n  /* Rebalance the expression. And check that its depth does not exceed\n  ** SQLITE_FTS3_MAX_EXPR_DEPTH.  */\n  if( rc==SQLITE_OK && *ppExpr ){\n    rc = fts3ExprBalance(ppExpr, SQLITE_FTS3_MAX_EXPR_DEPTH);\n    if( rc==SQLITE_OK ){\n      rc = fts3ExprCheckDepth(*ppExpr, SQLITE_FTS3_MAX_EXPR_DEPTH);\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    sqlite3Fts3ExprFree(*ppExpr);\n    *ppExpr = 0;\n    if( rc==SQLITE_TOOBIG ){\n      sqlite3Fts3ErrMsg(pzErr,\n          \"FTS expression tree is too large (maximum depth %d)\", \n          SQLITE_FTS3_MAX_EXPR_DEPTH\n      );\n      rc = SQLITE_ERROR;\n    }else if( rc==SQLITE_ERROR ){\n      sqlite3Fts3ErrMsg(pzErr, \"malformed MATCH expression: [%s]\", z);\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Free a single node of an expression tree.\n*/\nstatic void fts3FreeExprNode(Fts3Expr *p){\n  assert( p->eType==FTSQUERY_PHRASE || p->pPhrase==0 );\n  sqlite3Fts3EvalPhraseCleanup(p->pPhrase);\n  sqlite3_free(p->aMI);\n  sqlite3_free(p);\n}\n\n/*\n** Free a parsed fts3 query expression allocated by sqlite3Fts3ExprParse().\n**\n** This function would be simpler if it recursively called itself. But\n** that would mean passing a sufficiently large expression to ExprParse()\n** could cause a stack overflow.\n*/\nvoid sqlite3Fts3ExprFree(Fts3Expr *pDel){\n  Fts3Expr *p;\n  assert( pDel==0 || pDel->pParent==0 );\n  for(p=pDel; p && (p->pLeft||p->pRight); p=(p->pLeft ? p->pLeft : p->pRight)){\n    assert( p->pParent==0 || p==p->pParent->pRight || p==p->pParent->pLeft );\n  }\n  while( p ){\n    Fts3Expr *pParent = p->pParent;\n    fts3FreeExprNode(p);\n    if( pParent && p==pParent->pLeft && pParent->pRight ){\n      p = pParent->pRight;\n      while( p && (p->pLeft || p->pRight) ){\n        assert( p==p->pParent->pRight || p==p->pParent->pLeft );\n        p = (p->pLeft ? p->pLeft : p->pRight);\n      }\n    }else{\n      p = pParent;\n    }\n  }\n}\n\n/****************************************************************************\n*****************************************************************************\n** Everything after this point is just test code.\n*/\n\n#ifdef SQLITE_TEST\n\n#include <stdio.h>\n\n/*\n** Function to query the hash-table of tokenizers (see README.tokenizers).\n*/\nstatic int queryTestTokenizer(\n  sqlite3 *db, \n  const char *zName,  \n  const sqlite3_tokenizer_module **pp\n){\n  int rc;\n  sqlite3_stmt *pStmt;\n  const char zSql[] = \"SELECT fts3_tokenizer(?)\";\n\n  *pp = 0;\n  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);\n  if( SQLITE_ROW==sqlite3_step(pStmt) ){\n    if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){\n      memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));\n    }\n  }\n\n  return sqlite3_finalize(pStmt);\n}\n\n/*\n** Return a pointer to a buffer containing a text representation of the\n** expression passed as the first argument. The buffer is obtained from\n** sqlite3_malloc(). It is the responsibility of the caller to use \n** sqlite3_free() to release the memory. If an OOM condition is encountered,\n** NULL is returned.\n**\n** If the second argument is not NULL, then its contents are prepended to \n** the returned expression text and then freed using sqlite3_free().\n*/\nstatic char *exprToString(Fts3Expr *pExpr, char *zBuf){\n  if( pExpr==0 ){\n    return sqlite3_mprintf(\"\");\n  }\n  switch( pExpr->eType ){\n    case FTSQUERY_PHRASE: {\n      Fts3Phrase *pPhrase = pExpr->pPhrase;\n      int i;\n      zBuf = sqlite3_mprintf(\n          \"%zPHRASE %d 0\", zBuf, pPhrase->iColumn);\n      for(i=0; zBuf && i<pPhrase->nToken; i++){\n        zBuf = sqlite3_mprintf(\"%z %.*s%s\", zBuf, \n            pPhrase->aToken[i].n, pPhrase->aToken[i].z,\n            (pPhrase->aToken[i].isPrefix?\"+\":\"\")\n        );\n      }\n      return zBuf;\n    }\n\n    case FTSQUERY_NEAR:\n      zBuf = sqlite3_mprintf(\"%zNEAR/%d \", zBuf, pExpr->nNear);\n      break;\n    case FTSQUERY_NOT:\n      zBuf = sqlite3_mprintf(\"%zNOT \", zBuf);\n      break;\n    case FTSQUERY_AND:\n      zBuf = sqlite3_mprintf(\"%zAND \", zBuf);\n      break;\n    case FTSQUERY_OR:\n      zBuf = sqlite3_mprintf(\"%zOR \", zBuf);\n      break;\n  }\n\n  if( zBuf ) zBuf = sqlite3_mprintf(\"%z{\", zBuf);\n  if( zBuf ) zBuf = exprToString(pExpr->pLeft, zBuf);\n  if( zBuf ) zBuf = sqlite3_mprintf(\"%z} {\", zBuf);\n\n  if( zBuf ) zBuf = exprToString(pExpr->pRight, zBuf);\n  if( zBuf ) zBuf = sqlite3_mprintf(\"%z}\", zBuf);\n\n  return zBuf;\n}\n\n/*\n** This is the implementation of a scalar SQL function used to test the \n** expression parser. It should be called as follows:\n**\n**   fts3_exprtest(<tokenizer>, <expr>, <column 1>, ...);\n**\n** The first argument, <tokenizer>, is the name of the fts3 tokenizer used\n** to parse the query expression (see README.tokenizers). The second argument\n** is the query expression to parse. Each subsequent argument is the name\n** of a column of the fts3 table that the query expression may refer to.\n** For example:\n**\n**   SELECT fts3_exprtest('simple', 'Bill col2:Bloggs', 'col1', 'col2');\n*/\nstatic void fts3ExprTest(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  sqlite3_tokenizer_module const *pModule = 0;\n  sqlite3_tokenizer *pTokenizer = 0;\n  int rc;\n  char **azCol = 0;\n  const char *zExpr;\n  int nExpr;\n  int nCol;\n  int ii;\n  Fts3Expr *pExpr;\n  char *zBuf = 0;\n  sqlite3 *db = sqlite3_context_db_handle(context);\n\n  if( argc<3 ){\n    sqlite3_result_error(context, \n        \"Usage: fts3_exprtest(tokenizer, expr, col1, ...\", -1\n    );\n    return;\n  }\n\n  rc = queryTestTokenizer(db,\n                          (const char *)sqlite3_value_text(argv[0]), &pModule);\n  if( rc==SQLITE_NOMEM ){\n    sqlite3_result_error_nomem(context);\n    goto exprtest_out;\n  }else if( !pModule ){\n    sqlite3_result_error(context, \"No such tokenizer module\", -1);\n    goto exprtest_out;\n  }\n\n  rc = pModule->xCreate(0, 0, &pTokenizer);\n  assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );\n  if( rc==SQLITE_NOMEM ){\n    sqlite3_result_error_nomem(context);\n    goto exprtest_out;\n  }\n  pTokenizer->pModule = pModule;\n\n  zExpr = (const char *)sqlite3_value_text(argv[1]);\n  nExpr = sqlite3_value_bytes(argv[1]);\n  nCol = argc-2;\n  azCol = (char **)sqlite3_malloc(nCol*sizeof(char *));\n  if( !azCol ){\n    sqlite3_result_error_nomem(context);\n    goto exprtest_out;\n  }\n  for(ii=0; ii<nCol; ii++){\n    azCol[ii] = (char *)sqlite3_value_text(argv[ii+2]);\n  }\n\n  if( sqlite3_user_data(context) ){\n    char *zDummy = 0;\n    rc = sqlite3Fts3ExprParse(\n        pTokenizer, 0, azCol, 0, nCol, nCol, zExpr, nExpr, &pExpr, &zDummy\n    );\n    assert( rc==SQLITE_OK || pExpr==0 );\n    sqlite3_free(zDummy);\n  }else{\n    rc = fts3ExprParseUnbalanced(\n        pTokenizer, 0, azCol, 0, nCol, nCol, zExpr, nExpr, &pExpr\n    );\n  }\n\n  if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM ){\n    sqlite3Fts3ExprFree(pExpr);\n    sqlite3_result_error(context, \"Error parsing expression\", -1);\n  }else if( rc==SQLITE_NOMEM || !(zBuf = exprToString(pExpr, 0)) ){\n    sqlite3_result_error_nomem(context);\n  }else{\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\n    sqlite3_free(zBuf);\n  }\n\n  sqlite3Fts3ExprFree(pExpr);\n\nexprtest_out:\n  if( pModule && pTokenizer ){\n    rc = pModule->xDestroy(pTokenizer);\n  }\n  sqlite3_free(azCol);\n}\n\n/*\n** Register the query expression parser test function fts3_exprtest() \n** with database connection db. \n*/\nint sqlite3Fts3ExprInitTestInterface(sqlite3* db){\n  int rc = sqlite3_create_function(\n      db, \"fts3_exprtest\", -1, SQLITE_UTF8, 0, fts3ExprTest, 0, 0\n  );\n  if( rc==SQLITE_OK ){\n    rc = sqlite3_create_function(db, \"fts3_exprtest_rebalance\", \n        -1, SQLITE_UTF8, (void *)1, fts3ExprTest, 0, 0\n    );\n  }\n  return rc;\n}\n\n#endif\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_hash.c",
    "content": "/*\n** 2001 September 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This is the implementation of generic hash-tables used in SQLite.\n** We've modified it slightly to serve as a standalone hash table\n** implementation for the full-text indexing module.\n*/\n\n/*\n** The code in this file is only compiled if:\n**\n**     * The FTS3 module is being built as an extension\n**       (in which case SQLITE_CORE is not defined), or\n**\n**     * The FTS3 module is being built into the core of\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <assert.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"fts3_hash.h\"\n\n/*\n** Malloc and Free functions\n*/\nstatic void *fts3HashMalloc(int n){\n  void *p = sqlite3_malloc(n);\n  if( p ){\n    memset(p, 0, n);\n  }\n  return p;\n}\nstatic void fts3HashFree(void *p){\n  sqlite3_free(p);\n}\n\n/* Turn bulk memory into a hash table object by initializing the\n** fields of the Hash structure.\n**\n** \"pNew\" is a pointer to the hash table that is to be initialized.\n** keyClass is one of the constants \n** FTS3_HASH_BINARY or FTS3_HASH_STRING.  The value of keyClass \n** determines what kind of key the hash table will use.  \"copyKey\" is\n** true if the hash table should make its own private copy of keys and\n** false if it should just use the supplied pointer.\n*/\nvoid sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){\n  assert( pNew!=0 );\n  assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY );\n  pNew->keyClass = keyClass;\n  pNew->copyKey = copyKey;\n  pNew->first = 0;\n  pNew->count = 0;\n  pNew->htsize = 0;\n  pNew->ht = 0;\n}\n\n/* Remove all entries from a hash table.  Reclaim all memory.\n** Call this routine to delete a hash table or to reset a hash table\n** to the empty state.\n*/\nvoid sqlite3Fts3HashClear(Fts3Hash *pH){\n  Fts3HashElem *elem;         /* For looping over all elements of the table */\n\n  assert( pH!=0 );\n  elem = pH->first;\n  pH->first = 0;\n  fts3HashFree(pH->ht);\n  pH->ht = 0;\n  pH->htsize = 0;\n  while( elem ){\n    Fts3HashElem *next_elem = elem->next;\n    if( pH->copyKey && elem->pKey ){\n      fts3HashFree(elem->pKey);\n    }\n    fts3HashFree(elem);\n    elem = next_elem;\n  }\n  pH->count = 0;\n}\n\n/*\n** Hash and comparison functions when the mode is FTS3_HASH_STRING\n*/\nstatic int fts3StrHash(const void *pKey, int nKey){\n  const char *z = (const char *)pKey;\n  unsigned h = 0;\n  if( nKey<=0 ) nKey = (int) strlen(z);\n  while( nKey > 0  ){\n    h = (h<<3) ^ h ^ *z++;\n    nKey--;\n  }\n  return (int)(h & 0x7fffffff);\n}\nstatic int fts3StrCompare(const void *pKey1, int n1, const void *pKey2, int n2){\n  if( n1!=n2 ) return 1;\n  return strncmp((const char*)pKey1,(const char*)pKey2,n1);\n}\n\n/*\n** Hash and comparison functions when the mode is FTS3_HASH_BINARY\n*/\nstatic int fts3BinHash(const void *pKey, int nKey){\n  int h = 0;\n  const char *z = (const char *)pKey;\n  while( nKey-- > 0 ){\n    h = (h<<3) ^ h ^ *(z++);\n  }\n  return h & 0x7fffffff;\n}\nstatic int fts3BinCompare(const void *pKey1, int n1, const void *pKey2, int n2){\n  if( n1!=n2 ) return 1;\n  return memcmp(pKey1,pKey2,n1);\n}\n\n/*\n** Return a pointer to the appropriate hash function given the key class.\n**\n** The C syntax in this function definition may be unfamilar to some \n** programmers, so we provide the following additional explanation:\n**\n** The name of the function is \"ftsHashFunction\".  The function takes a\n** single parameter \"keyClass\".  The return value of ftsHashFunction()\n** is a pointer to another function.  Specifically, the return value\n** of ftsHashFunction() is a pointer to a function that takes two parameters\n** with types \"const void*\" and \"int\" and returns an \"int\".\n*/\nstatic int (*ftsHashFunction(int keyClass))(const void*,int){\n  if( keyClass==FTS3_HASH_STRING ){\n    return &fts3StrHash;\n  }else{\n    assert( keyClass==FTS3_HASH_BINARY );\n    return &fts3BinHash;\n  }\n}\n\n/*\n** Return a pointer to the appropriate hash function given the key class.\n**\n** For help in interpreted the obscure C code in the function definition,\n** see the header comment on the previous function.\n*/\nstatic int (*ftsCompareFunction(int keyClass))(const void*,int,const void*,int){\n  if( keyClass==FTS3_HASH_STRING ){\n    return &fts3StrCompare;\n  }else{\n    assert( keyClass==FTS3_HASH_BINARY );\n    return &fts3BinCompare;\n  }\n}\n\n/* Link an element into the hash table\n*/\nstatic void fts3HashInsertElement(\n  Fts3Hash *pH,            /* The complete hash table */\n  struct _fts3ht *pEntry,  /* The entry into which pNew is inserted */\n  Fts3HashElem *pNew       /* The element to be inserted */\n){\n  Fts3HashElem *pHead;     /* First element already in pEntry */\n  pHead = pEntry->chain;\n  if( pHead ){\n    pNew->next = pHead;\n    pNew->prev = pHead->prev;\n    if( pHead->prev ){ pHead->prev->next = pNew; }\n    else             { pH->first = pNew; }\n    pHead->prev = pNew;\n  }else{\n    pNew->next = pH->first;\n    if( pH->first ){ pH->first->prev = pNew; }\n    pNew->prev = 0;\n    pH->first = pNew;\n  }\n  pEntry->count++;\n  pEntry->chain = pNew;\n}\n\n\n/* Resize the hash table so that it cantains \"new_size\" buckets.\n** \"new_size\" must be a power of 2.  The hash table might fail \n** to resize if sqliteMalloc() fails.\n**\n** Return non-zero if a memory allocation error occurs.\n*/\nstatic int fts3Rehash(Fts3Hash *pH, int new_size){\n  struct _fts3ht *new_ht;          /* The new hash table */\n  Fts3HashElem *elem, *next_elem;  /* For looping over existing elements */\n  int (*xHash)(const void*,int);   /* The hash function */\n\n  assert( (new_size & (new_size-1))==0 );\n  new_ht = (struct _fts3ht *)fts3HashMalloc( new_size*sizeof(struct _fts3ht) );\n  if( new_ht==0 ) return 1;\n  fts3HashFree(pH->ht);\n  pH->ht = new_ht;\n  pH->htsize = new_size;\n  xHash = ftsHashFunction(pH->keyClass);\n  for(elem=pH->first, pH->first=0; elem; elem = next_elem){\n    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);\n    next_elem = elem->next;\n    fts3HashInsertElement(pH, &new_ht[h], elem);\n  }\n  return 0;\n}\n\n/* This function (for internal use only) locates an element in an\n** hash table that matches the given key.  The hash for this key has\n** already been computed and is passed as the 4th parameter.\n*/\nstatic Fts3HashElem *fts3FindElementByHash(\n  const Fts3Hash *pH, /* The pH to be searched */\n  const void *pKey,   /* The key we are searching for */\n  int nKey,\n  int h               /* The hash for this key. */\n){\n  Fts3HashElem *elem;            /* Used to loop thru the element list */\n  int count;                     /* Number of elements left to test */\n  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */\n\n  if( pH->ht ){\n    struct _fts3ht *pEntry = &pH->ht[h];\n    elem = pEntry->chain;\n    count = pEntry->count;\n    xCompare = ftsCompareFunction(pH->keyClass);\n    while( count-- && elem ){\n      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ \n        return elem;\n      }\n      elem = elem->next;\n    }\n  }\n  return 0;\n}\n\n/* Remove a single entry from the hash table given a pointer to that\n** element and a hash on the element's key.\n*/\nstatic void fts3RemoveElementByHash(\n  Fts3Hash *pH,         /* The pH containing \"elem\" */\n  Fts3HashElem* elem,   /* The element to be removed from the pH */\n  int h                 /* Hash value for the element */\n){\n  struct _fts3ht *pEntry;\n  if( elem->prev ){\n    elem->prev->next = elem->next; \n  }else{\n    pH->first = elem->next;\n  }\n  if( elem->next ){\n    elem->next->prev = elem->prev;\n  }\n  pEntry = &pH->ht[h];\n  if( pEntry->chain==elem ){\n    pEntry->chain = elem->next;\n  }\n  pEntry->count--;\n  if( pEntry->count<=0 ){\n    pEntry->chain = 0;\n  }\n  if( pH->copyKey && elem->pKey ){\n    fts3HashFree(elem->pKey);\n  }\n  fts3HashFree( elem );\n  pH->count--;\n  if( pH->count<=0 ){\n    assert( pH->first==0 );\n    assert( pH->count==0 );\n    fts3HashClear(pH);\n  }\n}\n\nFts3HashElem *sqlite3Fts3HashFindElem(\n  const Fts3Hash *pH, \n  const void *pKey, \n  int nKey\n){\n  int h;                          /* A hash on key */\n  int (*xHash)(const void*,int);  /* The hash function */\n\n  if( pH==0 || pH->ht==0 ) return 0;\n  xHash = ftsHashFunction(pH->keyClass);\n  assert( xHash!=0 );\n  h = (*xHash)(pKey,nKey);\n  assert( (pH->htsize & (pH->htsize-1))==0 );\n  return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));\n}\n\n/* \n** Attempt to locate an element of the hash table pH with a key\n** that matches pKey,nKey.  Return the data for this element if it is\n** found, or NULL if there is no match.\n*/\nvoid *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){\n  Fts3HashElem *pElem;            /* The element that matches key (if any) */\n\n  pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey);\n  return pElem ? pElem->data : 0;\n}\n\n/* Insert an element into the hash table pH.  The key is pKey,nKey\n** and the data is \"data\".\n**\n** If no element exists with a matching key, then a new\n** element is created.  A copy of the key is made if the copyKey\n** flag is set.  NULL is returned.\n**\n** If another element already exists with the same key, then the\n** new data replaces the old data and the old data is returned.\n** The key is not copied in this instance.  If a malloc fails, then\n** the new data is returned and the hash table is unchanged.\n**\n** If the \"data\" parameter to this function is NULL, then the\n** element corresponding to \"key\" is removed from the hash table.\n*/\nvoid *sqlite3Fts3HashInsert(\n  Fts3Hash *pH,        /* The hash table to insert into */\n  const void *pKey,    /* The key */\n  int nKey,            /* Number of bytes in the key */\n  void *data           /* The data */\n){\n  int hraw;                 /* Raw hash value of the key */\n  int h;                    /* the hash of the key modulo hash table size */\n  Fts3HashElem *elem;       /* Used to loop thru the element list */\n  Fts3HashElem *new_elem;   /* New element added to the pH */\n  int (*xHash)(const void*,int);  /* The hash function */\n\n  assert( pH!=0 );\n  xHash = ftsHashFunction(pH->keyClass);\n  assert( xHash!=0 );\n  hraw = (*xHash)(pKey, nKey);\n  assert( (pH->htsize & (pH->htsize-1))==0 );\n  h = hraw & (pH->htsize-1);\n  elem = fts3FindElementByHash(pH,pKey,nKey,h);\n  if( elem ){\n    void *old_data = elem->data;\n    if( data==0 ){\n      fts3RemoveElementByHash(pH,elem,h);\n    }else{\n      elem->data = data;\n    }\n    return old_data;\n  }\n  if( data==0 ) return 0;\n  if( (pH->htsize==0 && fts3Rehash(pH,8))\n   || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))\n  ){\n    pH->count = 0;\n    return data;\n  }\n  assert( pH->htsize>0 );\n  new_elem = (Fts3HashElem*)fts3HashMalloc( sizeof(Fts3HashElem) );\n  if( new_elem==0 ) return data;\n  if( pH->copyKey && pKey!=0 ){\n    new_elem->pKey = fts3HashMalloc( nKey );\n    if( new_elem->pKey==0 ){\n      fts3HashFree(new_elem);\n      return data;\n    }\n    memcpy((void*)new_elem->pKey, pKey, nKey);\n  }else{\n    new_elem->pKey = (void*)pKey;\n  }\n  new_elem->nKey = nKey;\n  pH->count++;\n  assert( pH->htsize>0 );\n  assert( (pH->htsize & (pH->htsize-1))==0 );\n  h = hraw & (pH->htsize-1);\n  fts3HashInsertElement(pH, &pH->ht[h], new_elem);\n  new_elem->data = data;\n  return 0;\n}\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_hash.h",
    "content": "/*\n** 2001 September 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This is the header file for the generic hash-table implementation\n** used in SQLite.  We've modified it slightly to serve as a standalone\n** hash table implementation for the full-text indexing module.\n**\n*/\n#ifndef _FTS3_HASH_H_\n#define _FTS3_HASH_H_\n\n/* Forward declarations of structures. */\ntypedef struct Fts3Hash Fts3Hash;\ntypedef struct Fts3HashElem Fts3HashElem;\n\n/* A complete hash table is an instance of the following structure.\n** The internals of this structure are intended to be opaque -- client\n** code should not attempt to access or modify the fields of this structure\n** directly.  Change this structure only by using the routines below.\n** However, many of the \"procedures\" and \"functions\" for modifying and\n** accessing this structure are really macros, so we can't really make\n** this structure opaque.\n*/\nstruct Fts3Hash {\n  char keyClass;          /* HASH_INT, _POINTER, _STRING, _BINARY */\n  char copyKey;           /* True if copy of key made on insert */\n  int count;              /* Number of entries in this table */\n  Fts3HashElem *first;    /* The first element of the array */\n  int htsize;             /* Number of buckets in the hash table */\n  struct _fts3ht {        /* the hash table */\n    int count;               /* Number of entries with this hash */\n    Fts3HashElem *chain;     /* Pointer to first entry with this hash */\n  } *ht;\n};\n\n/* Each element in the hash table is an instance of the following \n** structure.  All elements are stored on a single doubly-linked list.\n**\n** Again, this structure is intended to be opaque, but it can't really\n** be opaque because it is used by macros.\n*/\nstruct Fts3HashElem {\n  Fts3HashElem *next, *prev; /* Next and previous elements in the table */\n  void *data;                /* Data associated with this element */\n  void *pKey; int nKey;      /* Key associated with this element */\n};\n\n/*\n** There are 2 different modes of operation for a hash table:\n**\n**   FTS3_HASH_STRING        pKey points to a string that is nKey bytes long\n**                           (including the null-terminator, if any).  Case\n**                           is respected in comparisons.\n**\n**   FTS3_HASH_BINARY        pKey points to binary data nKey bytes long. \n**                           memcmp() is used to compare keys.\n**\n** A copy of the key is made if the copyKey parameter to fts3HashInit is 1.  \n*/\n#define FTS3_HASH_STRING    1\n#define FTS3_HASH_BINARY    2\n\n/*\n** Access routines.  To delete, insert a NULL pointer.\n*/\nvoid sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey);\nvoid *sqlite3Fts3HashInsert(Fts3Hash*, const void *pKey, int nKey, void *pData);\nvoid *sqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey);\nvoid sqlite3Fts3HashClear(Fts3Hash*);\nFts3HashElem *sqlite3Fts3HashFindElem(const Fts3Hash *, const void *, int);\n\n/*\n** Shorthand for the functions above\n*/\n#define fts3HashInit     sqlite3Fts3HashInit\n#define fts3HashInsert   sqlite3Fts3HashInsert\n#define fts3HashFind     sqlite3Fts3HashFind\n#define fts3HashClear    sqlite3Fts3HashClear\n#define fts3HashFindElem sqlite3Fts3HashFindElem\n\n/*\n** Macros for looping over all elements of a hash table.  The idiom is\n** like this:\n**\n**   Fts3Hash h;\n**   Fts3HashElem *p;\n**   ...\n**   for(p=fts3HashFirst(&h); p; p=fts3HashNext(p)){\n**     SomeStructure *pData = fts3HashData(p);\n**     // do something with pData\n**   }\n*/\n#define fts3HashFirst(H)  ((H)->first)\n#define fts3HashNext(E)   ((E)->next)\n#define fts3HashData(E)   ((E)->data)\n#define fts3HashKey(E)    ((E)->pKey)\n#define fts3HashKeysize(E) ((E)->nKey)\n\n/*\n** Number of entries in a hash table\n*/\n#define fts3HashCount(H)  ((H)->count)\n\n#endif /* _FTS3_HASH_H_ */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_icu.c",
    "content": "/*\n** 2007 June 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file implements a tokenizer for fts3 based on the ICU library.\n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n#ifdef SQLITE_ENABLE_ICU\n\n#include <assert.h>\n#include <string.h>\n#include \"fts3_tokenizer.h\"\n\n#include <unicode/ubrk.h>\n#include <unicode/ucol.h>\n#include <unicode/ustring.h>\n#include <unicode/utf16.h>\n\ntypedef struct IcuTokenizer IcuTokenizer;\ntypedef struct IcuCursor IcuCursor;\n\nstruct IcuTokenizer {\n  sqlite3_tokenizer base;\n  char *zLocale;\n};\n\nstruct IcuCursor {\n  sqlite3_tokenizer_cursor base;\n\n  UBreakIterator *pIter;      /* ICU break-iterator object */\n  int nChar;                  /* Number of UChar elements in pInput */\n  UChar *aChar;               /* Copy of input using utf-16 encoding */\n  int *aOffset;               /* Offsets of each character in utf-8 input */\n\n  int nBuffer;\n  char *zBuffer;\n\n  int iToken;\n};\n\n/*\n** Create a new tokenizer instance.\n*/\nstatic int icuCreate(\n  int argc,                            /* Number of entries in argv[] */\n  const char * const *argv,            /* Tokenizer creation arguments */\n  sqlite3_tokenizer **ppTokenizer      /* OUT: Created tokenizer */\n){\n  IcuTokenizer *p;\n  int n = 0;\n\n  if( argc>0 ){\n    n = strlen(argv[0])+1;\n  }\n  p = (IcuTokenizer *)sqlite3_malloc(sizeof(IcuTokenizer)+n);\n  if( !p ){\n    return SQLITE_NOMEM;\n  }\n  memset(p, 0, sizeof(IcuTokenizer));\n\n  if( n ){\n    p->zLocale = (char *)&p[1];\n    memcpy(p->zLocale, argv[0], n);\n  }\n\n  *ppTokenizer = (sqlite3_tokenizer *)p;\n\n  return SQLITE_OK;\n}\n\n/*\n** Destroy a tokenizer\n*/\nstatic int icuDestroy(sqlite3_tokenizer *pTokenizer){\n  IcuTokenizer *p = (IcuTokenizer *)pTokenizer;\n  sqlite3_free(p);\n  return SQLITE_OK;\n}\n\n/*\n** Prepare to begin tokenizing a particular string.  The input\n** string to be tokenized is pInput[0..nBytes-1].  A cursor\n** used to incrementally tokenize this string is returned in \n** *ppCursor.\n*/\nstatic int icuOpen(\n  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */\n  const char *zInput,                    /* Input string */\n  int nInput,                            /* Length of zInput in bytes */\n  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */\n){\n  IcuTokenizer *p = (IcuTokenizer *)pTokenizer;\n  IcuCursor *pCsr;\n\n  const int32_t opt = U_FOLD_CASE_DEFAULT;\n  UErrorCode status = U_ZERO_ERROR;\n  int nChar;\n\n  UChar32 c;\n  int iInput = 0;\n  int iOut = 0;\n\n  *ppCursor = 0;\n\n  if( zInput==0 ){\n    nInput = 0;\n    zInput = \"\";\n  }else if( nInput<0 ){\n    nInput = strlen(zInput);\n  }\n  nChar = nInput+1;\n  pCsr = (IcuCursor *)sqlite3_malloc(\n      sizeof(IcuCursor) +                /* IcuCursor */\n      ((nChar+3)&~3) * sizeof(UChar) +   /* IcuCursor.aChar[] */\n      (nChar+1) * sizeof(int)            /* IcuCursor.aOffset[] */\n  );\n  if( !pCsr ){\n    return SQLITE_NOMEM;\n  }\n  memset(pCsr, 0, sizeof(IcuCursor));\n  pCsr->aChar = (UChar *)&pCsr[1];\n  pCsr->aOffset = (int *)&pCsr->aChar[(nChar+3)&~3];\n\n  pCsr->aOffset[iOut] = iInput;\n  U8_NEXT(zInput, iInput, nInput, c); \n  while( c>0 ){\n    int isError = 0;\n    c = u_foldCase(c, opt);\n    U16_APPEND(pCsr->aChar, iOut, nChar, c, isError);\n    if( isError ){\n      sqlite3_free(pCsr);\n      return SQLITE_ERROR;\n    }\n    pCsr->aOffset[iOut] = iInput;\n\n    if( iInput<nInput ){\n      U8_NEXT(zInput, iInput, nInput, c);\n    }else{\n      c = 0;\n    }\n  }\n\n  pCsr->pIter = ubrk_open(UBRK_WORD, p->zLocale, pCsr->aChar, iOut, &status);\n  if( !U_SUCCESS(status) ){\n    sqlite3_free(pCsr);\n    return SQLITE_ERROR;\n  }\n  pCsr->nChar = iOut;\n\n  ubrk_first(pCsr->pIter);\n  *ppCursor = (sqlite3_tokenizer_cursor *)pCsr;\n  return SQLITE_OK;\n}\n\n/*\n** Close a tokenization cursor previously opened by a call to icuOpen().\n*/\nstatic int icuClose(sqlite3_tokenizer_cursor *pCursor){\n  IcuCursor *pCsr = (IcuCursor *)pCursor;\n  ubrk_close(pCsr->pIter);\n  sqlite3_free(pCsr->zBuffer);\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\n/*\n** Extract the next token from a tokenization cursor.\n*/\nstatic int icuNext(\n  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */\n  const char **ppToken,               /* OUT: *ppToken is the token text */\n  int *pnBytes,                       /* OUT: Number of bytes in token */\n  int *piStartOffset,                 /* OUT: Starting offset of token */\n  int *piEndOffset,                   /* OUT: Ending offset of token */\n  int *piPosition                     /* OUT: Position integer of token */\n){\n  IcuCursor *pCsr = (IcuCursor *)pCursor;\n\n  int iStart = 0;\n  int iEnd = 0;\n  int nByte = 0;\n\n  while( iStart==iEnd ){\n    UChar32 c;\n\n    iStart = ubrk_current(pCsr->pIter);\n    iEnd = ubrk_next(pCsr->pIter);\n    if( iEnd==UBRK_DONE ){\n      return SQLITE_DONE;\n    }\n\n    while( iStart<iEnd ){\n      int iWhite = iStart;\n      U16_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c);\n      if( u_isspace(c) ){\n        iStart = iWhite;\n      }else{\n        break;\n      }\n    }\n    assert(iStart<=iEnd);\n  }\n\n  do {\n    UErrorCode status = U_ZERO_ERROR;\n    if( nByte ){\n      char *zNew = sqlite3_realloc(pCsr->zBuffer, nByte);\n      if( !zNew ){\n        return SQLITE_NOMEM;\n      }\n      pCsr->zBuffer = zNew;\n      pCsr->nBuffer = nByte;\n    }\n\n    u_strToUTF8(\n        pCsr->zBuffer, pCsr->nBuffer, &nByte,    /* Output vars */\n        &pCsr->aChar[iStart], iEnd-iStart,       /* Input vars */\n        &status                                  /* Output success/failure */\n    );\n  } while( nByte>pCsr->nBuffer );\n\n  *ppToken = pCsr->zBuffer;\n  *pnBytes = nByte;\n  *piStartOffset = pCsr->aOffset[iStart];\n  *piEndOffset = pCsr->aOffset[iEnd];\n  *piPosition = pCsr->iToken++;\n\n  return SQLITE_OK;\n}\n\n/*\n** The set of routines that implement the simple tokenizer\n*/\nstatic const sqlite3_tokenizer_module icuTokenizerModule = {\n  0,                           /* iVersion    */\n  icuCreate,                   /* xCreate     */\n  icuDestroy,                  /* xCreate     */\n  icuOpen,                     /* xOpen       */\n  icuClose,                    /* xClose      */\n  icuNext,                     /* xNext       */\n  0,                           /* xLanguageid */\n};\n\n/*\n** Set *ppModule to point at the implementation of the ICU tokenizer.\n*/\nvoid sqlite3Fts3IcuTokenizerModule(\n  sqlite3_tokenizer_module const**ppModule\n){\n  *ppModule = &icuTokenizerModule;\n}\n\n#endif /* defined(SQLITE_ENABLE_ICU) */\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_porter.c",
    "content": "/*\n** 2006 September 30\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Implementation of the full-text-search tokenizer that implements\n** a Porter stemmer.\n*/\n\n/*\n** The code in this file is only compiled if:\n**\n**     * The FTS3 module is being built as an extension\n**       (in which case SQLITE_CORE is not defined), or\n**\n**     * The FTS3 module is being built into the core of\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <assert.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"fts3_tokenizer.h\"\n\n/*\n** Class derived from sqlite3_tokenizer\n*/\ntypedef struct porter_tokenizer {\n  sqlite3_tokenizer base;      /* Base class */\n} porter_tokenizer;\n\n/*\n** Class derived from sqlite3_tokenizer_cursor\n*/\ntypedef struct porter_tokenizer_cursor {\n  sqlite3_tokenizer_cursor base;\n  const char *zInput;          /* input we are tokenizing */\n  int nInput;                  /* size of the input */\n  int iOffset;                 /* current position in zInput */\n  int iToken;                  /* index of next token to be returned */\n  char *zToken;                /* storage for current token */\n  int nAllocated;              /* space allocated to zToken buffer */\n} porter_tokenizer_cursor;\n\n\n/*\n** Create a new tokenizer instance.\n*/\nstatic int porterCreate(\n  int argc, const char * const *argv,\n  sqlite3_tokenizer **ppTokenizer\n){\n  porter_tokenizer *t;\n\n  UNUSED_PARAMETER(argc);\n  UNUSED_PARAMETER(argv);\n\n  t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t));\n  if( t==NULL ) return SQLITE_NOMEM;\n  memset(t, 0, sizeof(*t));\n  *ppTokenizer = &t->base;\n  return SQLITE_OK;\n}\n\n/*\n** Destroy a tokenizer\n*/\nstatic int porterDestroy(sqlite3_tokenizer *pTokenizer){\n  sqlite3_free(pTokenizer);\n  return SQLITE_OK;\n}\n\n/*\n** Prepare to begin tokenizing a particular string.  The input\n** string to be tokenized is zInput[0..nInput-1].  A cursor\n** used to incrementally tokenize this string is returned in \n** *ppCursor.\n*/\nstatic int porterOpen(\n  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */\n  const char *zInput, int nInput,        /* String to be tokenized */\n  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */\n){\n  porter_tokenizer_cursor *c;\n\n  UNUSED_PARAMETER(pTokenizer);\n\n  c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));\n  if( c==NULL ) return SQLITE_NOMEM;\n\n  c->zInput = zInput;\n  if( zInput==0 ){\n    c->nInput = 0;\n  }else if( nInput<0 ){\n    c->nInput = (int)strlen(zInput);\n  }else{\n    c->nInput = nInput;\n  }\n  c->iOffset = 0;                 /* start tokenizing at the beginning */\n  c->iToken = 0;\n  c->zToken = NULL;               /* no space allocated, yet. */\n  c->nAllocated = 0;\n\n  *ppCursor = &c->base;\n  return SQLITE_OK;\n}\n\n/*\n** Close a tokenization cursor previously opened by a call to\n** porterOpen() above.\n*/\nstatic int porterClose(sqlite3_tokenizer_cursor *pCursor){\n  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;\n  sqlite3_free(c->zToken);\n  sqlite3_free(c);\n  return SQLITE_OK;\n}\n/*\n** Vowel or consonant\n*/\nstatic const char cType[] = {\n   0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,\n   1, 1, 1, 2, 1\n};\n\n/*\n** isConsonant() and isVowel() determine if their first character in\n** the string they point to is a consonant or a vowel, according\n** to Porter ruls.  \n**\n** A consonate is any letter other than 'a', 'e', 'i', 'o', or 'u'.\n** 'Y' is a consonant unless it follows another consonant,\n** in which case it is a vowel.\n**\n** In these routine, the letters are in reverse order.  So the 'y' rule\n** is that 'y' is a consonant unless it is followed by another\n** consonent.\n*/\nstatic int isVowel(const char*);\nstatic int isConsonant(const char *z){\n  int j;\n  char x = *z;\n  if( x==0 ) return 0;\n  assert( x>='a' && x<='z' );\n  j = cType[x-'a'];\n  if( j<2 ) return j;\n  return z[1]==0 || isVowel(z + 1);\n}\nstatic int isVowel(const char *z){\n  int j;\n  char x = *z;\n  if( x==0 ) return 0;\n  assert( x>='a' && x<='z' );\n  j = cType[x-'a'];\n  if( j<2 ) return 1-j;\n  return isConsonant(z + 1);\n}\n\n/*\n** Let any sequence of one or more vowels be represented by V and let\n** C be sequence of one or more consonants.  Then every word can be\n** represented as:\n**\n**           [C] (VC){m} [V]\n**\n** In prose:  A word is an optional consonant followed by zero or\n** vowel-consonant pairs followed by an optional vowel.  \"m\" is the\n** number of vowel consonant pairs.  This routine computes the value\n** of m for the first i bytes of a word.\n**\n** Return true if the m-value for z is 1 or more.  In other words,\n** return true if z contains at least one vowel that is followed\n** by a consonant.\n**\n** In this routine z[] is in reverse order.  So we are really looking\n** for an instance of a consonant followed by a vowel.\n*/\nstatic int m_gt_0(const char *z){\n  while( isVowel(z) ){ z++; }\n  if( *z==0 ) return 0;\n  while( isConsonant(z) ){ z++; }\n  return *z!=0;\n}\n\n/* Like mgt0 above except we are looking for a value of m which is\n** exactly 1\n*/\nstatic int m_eq_1(const char *z){\n  while( isVowel(z) ){ z++; }\n  if( *z==0 ) return 0;\n  while( isConsonant(z) ){ z++; }\n  if( *z==0 ) return 0;\n  while( isVowel(z) ){ z++; }\n  if( *z==0 ) return 1;\n  while( isConsonant(z) ){ z++; }\n  return *z==0;\n}\n\n/* Like mgt0 above except we are looking for a value of m>1 instead\n** or m>0\n*/\nstatic int m_gt_1(const char *z){\n  while( isVowel(z) ){ z++; }\n  if( *z==0 ) return 0;\n  while( isConsonant(z) ){ z++; }\n  if( *z==0 ) return 0;\n  while( isVowel(z) ){ z++; }\n  if( *z==0 ) return 0;\n  while( isConsonant(z) ){ z++; }\n  return *z!=0;\n}\n\n/*\n** Return TRUE if there is a vowel anywhere within z[0..n-1]\n*/\nstatic int hasVowel(const char *z){\n  while( isConsonant(z) ){ z++; }\n  return *z!=0;\n}\n\n/*\n** Return TRUE if the word ends in a double consonant.\n**\n** The text is reversed here. So we are really looking at\n** the first two characters of z[].\n*/\nstatic int doubleConsonant(const char *z){\n  return isConsonant(z) && z[0]==z[1];\n}\n\n/*\n** Return TRUE if the word ends with three letters which\n** are consonant-vowel-consonent and where the final consonant\n** is not 'w', 'x', or 'y'.\n**\n** The word is reversed here.  So we are really checking the\n** first three letters and the first one cannot be in [wxy].\n*/\nstatic int star_oh(const char *z){\n  return\n    isConsonant(z) &&\n    z[0]!='w' && z[0]!='x' && z[0]!='y' &&\n    isVowel(z+1) &&\n    isConsonant(z+2);\n}\n\n/*\n** If the word ends with zFrom and xCond() is true for the stem\n** of the word that preceeds the zFrom ending, then change the \n** ending to zTo.\n**\n** The input word *pz and zFrom are both in reverse order.  zTo\n** is in normal order. \n**\n** Return TRUE if zFrom matches.  Return FALSE if zFrom does not\n** match.  Not that TRUE is returned even if xCond() fails and\n** no substitution occurs.\n*/\nstatic int stem(\n  char **pz,             /* The word being stemmed (Reversed) */\n  const char *zFrom,     /* If the ending matches this... (Reversed) */\n  const char *zTo,       /* ... change the ending to this (not reversed) */\n  int (*xCond)(const char*)   /* Condition that must be true */\n){\n  char *z = *pz;\n  while( *zFrom && *zFrom==*z ){ z++; zFrom++; }\n  if( *zFrom!=0 ) return 0;\n  if( xCond && !xCond(z) ) return 1;\n  while( *zTo ){\n    *(--z) = *(zTo++);\n  }\n  *pz = z;\n  return 1;\n}\n\n/*\n** This is the fallback stemmer used when the porter stemmer is\n** inappropriate.  The input word is copied into the output with\n** US-ASCII case folding.  If the input word is too long (more\n** than 20 bytes if it contains no digits or more than 6 bytes if\n** it contains digits) then word is truncated to 20 or 6 bytes\n** by taking 10 or 3 bytes from the beginning and end.\n*/\nstatic void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){\n  int i, mx, j;\n  int hasDigit = 0;\n  for(i=0; i<nIn; i++){\n    char c = zIn[i];\n    if( c>='A' && c<='Z' ){\n      zOut[i] = c - 'A' + 'a';\n    }else{\n      if( c>='0' && c<='9' ) hasDigit = 1;\n      zOut[i] = c;\n    }\n  }\n  mx = hasDigit ? 3 : 10;\n  if( nIn>mx*2 ){\n    for(j=mx, i=nIn-mx; i<nIn; i++, j++){\n      zOut[j] = zOut[i];\n    }\n    i = j;\n  }\n  zOut[i] = 0;\n  *pnOut = i;\n}\n\n\n/*\n** Stem the input word zIn[0..nIn-1].  Store the output in zOut.\n** zOut is at least big enough to hold nIn bytes.  Write the actual\n** size of the output word (exclusive of the '\\0' terminator) into *pnOut.\n**\n** Any upper-case characters in the US-ASCII character set ([A-Z])\n** are converted to lower case.  Upper-case UTF characters are\n** unchanged.\n**\n** Words that are longer than about 20 bytes are stemmed by retaining\n** a few bytes from the beginning and the end of the word.  If the\n** word contains digits, 3 bytes are taken from the beginning and\n** 3 bytes from the end.  For long words without digits, 10 bytes\n** are taken from each end.  US-ASCII case folding still applies.\n** \n** If the input word contains not digits but does characters not \n** in [a-zA-Z] then no stemming is attempted and this routine just \n** copies the input into the input into the output with US-ASCII\n** case folding.\n**\n** Stemming never increases the length of the word.  So there is\n** no chance of overflowing the zOut buffer.\n*/\nstatic void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){\n  int i, j;\n  char zReverse[28];\n  char *z, *z2;\n  if( nIn<3 || nIn>=(int)sizeof(zReverse)-7 ){\n    /* The word is too big or too small for the porter stemmer.\n    ** Fallback to the copy stemmer */\n    copy_stemmer(zIn, nIn, zOut, pnOut);\n    return;\n  }\n  for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){\n    char c = zIn[i];\n    if( c>='A' && c<='Z' ){\n      zReverse[j] = c + 'a' - 'A';\n    }else if( c>='a' && c<='z' ){\n      zReverse[j] = c;\n    }else{\n      /* The use of a character not in [a-zA-Z] means that we fallback\n      ** to the copy stemmer */\n      copy_stemmer(zIn, nIn, zOut, pnOut);\n      return;\n    }\n  }\n  memset(&zReverse[sizeof(zReverse)-5], 0, 5);\n  z = &zReverse[j+1];\n\n\n  /* Step 1a */\n  if( z[0]=='s' ){\n    if(\n     !stem(&z, \"sess\", \"ss\", 0) &&\n     !stem(&z, \"sei\", \"i\", 0)  &&\n     !stem(&z, \"ss\", \"ss\", 0)\n    ){\n      z++;\n    }\n  }\n\n  /* Step 1b */  \n  z2 = z;\n  if( stem(&z, \"dee\", \"ee\", m_gt_0) ){\n    /* Do nothing.  The work was all in the test */\n  }else if( \n     (stem(&z, \"gni\", \"\", hasVowel) || stem(&z, \"de\", \"\", hasVowel))\n      && z!=z2\n  ){\n     if( stem(&z, \"ta\", \"ate\", 0) ||\n         stem(&z, \"lb\", \"ble\", 0) ||\n         stem(&z, \"zi\", \"ize\", 0) ){\n       /* Do nothing.  The work was all in the test */\n     }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){\n       z++;\n     }else if( m_eq_1(z) && star_oh(z) ){\n       *(--z) = 'e';\n     }\n  }\n\n  /* Step 1c */\n  if( z[0]=='y' && hasVowel(z+1) ){\n    z[0] = 'i';\n  }\n\n  /* Step 2 */\n  switch( z[1] ){\n   case 'a':\n     if( !stem(&z, \"lanoita\", \"ate\", m_gt_0) ){\n       stem(&z, \"lanoit\", \"tion\", m_gt_0);\n     }\n     break;\n   case 'c':\n     if( !stem(&z, \"icne\", \"ence\", m_gt_0) ){\n       stem(&z, \"icna\", \"ance\", m_gt_0);\n     }\n     break;\n   case 'e':\n     stem(&z, \"rezi\", \"ize\", m_gt_0);\n     break;\n   case 'g':\n     stem(&z, \"igol\", \"log\", m_gt_0);\n     break;\n   case 'l':\n     if( !stem(&z, \"ilb\", \"ble\", m_gt_0) \n      && !stem(&z, \"illa\", \"al\", m_gt_0)\n      && !stem(&z, \"iltne\", \"ent\", m_gt_0)\n      && !stem(&z, \"ile\", \"e\", m_gt_0)\n     ){\n       stem(&z, \"ilsuo\", \"ous\", m_gt_0);\n     }\n     break;\n   case 'o':\n     if( !stem(&z, \"noitazi\", \"ize\", m_gt_0)\n      && !stem(&z, \"noita\", \"ate\", m_gt_0)\n     ){\n       stem(&z, \"rota\", \"ate\", m_gt_0);\n     }\n     break;\n   case 's':\n     if( !stem(&z, \"msila\", \"al\", m_gt_0)\n      && !stem(&z, \"ssenevi\", \"ive\", m_gt_0)\n      && !stem(&z, \"ssenluf\", \"ful\", m_gt_0)\n     ){\n       stem(&z, \"ssensuo\", \"ous\", m_gt_0);\n     }\n     break;\n   case 't':\n     if( !stem(&z, \"itila\", \"al\", m_gt_0)\n      && !stem(&z, \"itivi\", \"ive\", m_gt_0)\n     ){\n       stem(&z, \"itilib\", \"ble\", m_gt_0);\n     }\n     break;\n  }\n\n  /* Step 3 */\n  switch( z[0] ){\n   case 'e':\n     if( !stem(&z, \"etaci\", \"ic\", m_gt_0)\n      && !stem(&z, \"evita\", \"\", m_gt_0)\n     ){\n       stem(&z, \"ezila\", \"al\", m_gt_0);\n     }\n     break;\n   case 'i':\n     stem(&z, \"itici\", \"ic\", m_gt_0);\n     break;\n   case 'l':\n     if( !stem(&z, \"laci\", \"ic\", m_gt_0) ){\n       stem(&z, \"luf\", \"\", m_gt_0);\n     }\n     break;\n   case 's':\n     stem(&z, \"ssen\", \"\", m_gt_0);\n     break;\n  }\n\n  /* Step 4 */\n  switch( z[1] ){\n   case 'a':\n     if( z[0]=='l' && m_gt_1(z+2) ){\n       z += 2;\n     }\n     break;\n   case 'c':\n     if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e')  && m_gt_1(z+4)  ){\n       z += 4;\n     }\n     break;\n   case 'e':\n     if( z[0]=='r' && m_gt_1(z+2) ){\n       z += 2;\n     }\n     break;\n   case 'i':\n     if( z[0]=='c' && m_gt_1(z+2) ){\n       z += 2;\n     }\n     break;\n   case 'l':\n     if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){\n       z += 4;\n     }\n     break;\n   case 'n':\n     if( z[0]=='t' ){\n       if( z[2]=='a' ){\n         if( m_gt_1(z+3) ){\n           z += 3;\n         }\n       }else if( z[2]=='e' ){\n         if( !stem(&z, \"tneme\", \"\", m_gt_1)\n          && !stem(&z, \"tnem\", \"\", m_gt_1)\n         ){\n           stem(&z, \"tne\", \"\", m_gt_1);\n         }\n       }\n     }\n     break;\n   case 'o':\n     if( z[0]=='u' ){\n       if( m_gt_1(z+2) ){\n         z += 2;\n       }\n     }else if( z[3]=='s' || z[3]=='t' ){\n       stem(&z, \"noi\", \"\", m_gt_1);\n     }\n     break;\n   case 's':\n     if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){\n       z += 3;\n     }\n     break;\n   case 't':\n     if( !stem(&z, \"eta\", \"\", m_gt_1) ){\n       stem(&z, \"iti\", \"\", m_gt_1);\n     }\n     break;\n   case 'u':\n     if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){\n       z += 3;\n     }\n     break;\n   case 'v':\n   case 'z':\n     if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){\n       z += 3;\n     }\n     break;\n  }\n\n  /* Step 5a */\n  if( z[0]=='e' ){\n    if( m_gt_1(z+1) ){\n      z++;\n    }else if( m_eq_1(z+1) && !star_oh(z+1) ){\n      z++;\n    }\n  }\n\n  /* Step 5b */\n  if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){\n    z++;\n  }\n\n  /* z[] is now the stemmed word in reverse order.  Flip it back\n  ** around into forward order and return.\n  */\n  *pnOut = i = (int)strlen(z);\n  zOut[i] = 0;\n  while( *z ){\n    zOut[--i] = *(z++);\n  }\n}\n\n/*\n** Characters that can be part of a token.  We assume any character\n** whose value is greater than 0x80 (any UTF character) can be\n** part of a token.  In other words, delimiters all must have\n** values of 0x7f or lower.\n*/\nstatic const char porterIdChar[] = {\n/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */\n};\n#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !porterIdChar[ch-0x30]))\n\n/*\n** Extract the next token from a tokenization cursor.  The cursor must\n** have been opened by a prior call to porterOpen().\n*/\nstatic int porterNext(\n  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by porterOpen */\n  const char **pzToken,               /* OUT: *pzToken is the token text */\n  int *pnBytes,                       /* OUT: Number of bytes in token */\n  int *piStartOffset,                 /* OUT: Starting offset of token */\n  int *piEndOffset,                   /* OUT: Ending offset of token */\n  int *piPosition                     /* OUT: Position integer of token */\n){\n  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;\n  const char *z = c->zInput;\n\n  while( c->iOffset<c->nInput ){\n    int iStartOffset, ch;\n\n    /* Scan past delimiter characters */\n    while( c->iOffset<c->nInput && isDelim(z[c->iOffset]) ){\n      c->iOffset++;\n    }\n\n    /* Count non-delimiter characters. */\n    iStartOffset = c->iOffset;\n    while( c->iOffset<c->nInput && !isDelim(z[c->iOffset]) ){\n      c->iOffset++;\n    }\n\n    if( c->iOffset>iStartOffset ){\n      int n = c->iOffset-iStartOffset;\n      if( n>c->nAllocated ){\n        char *pNew;\n        c->nAllocated = n+20;\n        pNew = sqlite3_realloc(c->zToken, c->nAllocated);\n        if( !pNew ) return SQLITE_NOMEM;\n        c->zToken = pNew;\n      }\n      porter_stemmer(&z[iStartOffset], n, c->zToken, pnBytes);\n      *pzToken = c->zToken;\n      *piStartOffset = iStartOffset;\n      *piEndOffset = c->iOffset;\n      *piPosition = c->iToken++;\n      return SQLITE_OK;\n    }\n  }\n  return SQLITE_DONE;\n}\n\n/*\n** The set of routines that implement the porter-stemmer tokenizer\n*/\nstatic const sqlite3_tokenizer_module porterTokenizerModule = {\n  0,\n  porterCreate,\n  porterDestroy,\n  porterOpen,\n  porterClose,\n  porterNext,\n  0\n};\n\n/*\n** Allocate a new porter tokenizer.  Return a pointer to the new\n** tokenizer in *ppModule\n*/\nvoid sqlite3Fts3PorterTokenizerModule(\n  sqlite3_tokenizer_module const**ppModule\n){\n  *ppModule = &porterTokenizerModule;\n}\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_snippet.c",
    "content": "/*\n** 2009 Oct 23\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n*/\n\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <string.h>\n#include <assert.h>\n\n/*\n** Characters that may appear in the second argument to matchinfo().\n*/\n#define FTS3_MATCHINFO_NPHRASE   'p'        /* 1 value */\n#define FTS3_MATCHINFO_NCOL      'c'        /* 1 value */\n#define FTS3_MATCHINFO_NDOC      'n'        /* 1 value */\n#define FTS3_MATCHINFO_AVGLENGTH 'a'        /* nCol values */\n#define FTS3_MATCHINFO_LENGTH    'l'        /* nCol values */\n#define FTS3_MATCHINFO_LCS       's'        /* nCol values */\n#define FTS3_MATCHINFO_HITS      'x'        /* 3*nCol*nPhrase values */\n#define FTS3_MATCHINFO_LHITS     'y'        /* nCol*nPhrase values */\n#define FTS3_MATCHINFO_LHITS_BM  'b'        /* nCol*nPhrase values */\n\n/*\n** The default value for the second argument to matchinfo(). \n*/\n#define FTS3_MATCHINFO_DEFAULT   \"pcx\"\n\n\n/*\n** Used as an fts3ExprIterate() context when loading phrase doclists to\n** Fts3Expr.aDoclist[]/nDoclist.\n*/\ntypedef struct LoadDoclistCtx LoadDoclistCtx;\nstruct LoadDoclistCtx {\n  Fts3Cursor *pCsr;               /* FTS3 Cursor */\n  int nPhrase;                    /* Number of phrases seen so far */\n  int nToken;                     /* Number of tokens seen so far */\n};\n\n/*\n** The following types are used as part of the implementation of the \n** fts3BestSnippet() routine.\n*/\ntypedef struct SnippetIter SnippetIter;\ntypedef struct SnippetPhrase SnippetPhrase;\ntypedef struct SnippetFragment SnippetFragment;\n\nstruct SnippetIter {\n  Fts3Cursor *pCsr;               /* Cursor snippet is being generated from */\n  int iCol;                       /* Extract snippet from this column */\n  int nSnippet;                   /* Requested snippet length (in tokens) */\n  int nPhrase;                    /* Number of phrases in query */\n  SnippetPhrase *aPhrase;         /* Array of size nPhrase */\n  int iCurrent;                   /* First token of current snippet */\n};\n\nstruct SnippetPhrase {\n  int nToken;                     /* Number of tokens in phrase */\n  char *pList;                    /* Pointer to start of phrase position list */\n  int iHead;                      /* Next value in position list */\n  char *pHead;                    /* Position list data following iHead */\n  int iTail;                      /* Next value in trailing position list */\n  char *pTail;                    /* Position list data following iTail */\n};\n\nstruct SnippetFragment {\n  int iCol;                       /* Column snippet is extracted from */\n  int iPos;                       /* Index of first token in snippet */\n  u64 covered;                    /* Mask of query phrases covered */\n  u64 hlmask;                     /* Mask of snippet terms to highlight */\n};\n\n/*\n** This type is used as an fts3ExprIterate() context object while \n** accumulating the data returned by the matchinfo() function.\n*/\ntypedef struct MatchInfo MatchInfo;\nstruct MatchInfo {\n  Fts3Cursor *pCursor;            /* FTS3 Cursor */\n  int nCol;                       /* Number of columns in table */\n  int nPhrase;                    /* Number of matchable phrases in query */\n  sqlite3_int64 nDoc;             /* Number of docs in database */\n  char flag;\n  u32 *aMatchinfo;                /* Pre-allocated buffer */\n};\n\n/*\n** An instance of this structure is used to manage a pair of buffers, each\n** (nElem * sizeof(u32)) bytes in size. See the MatchinfoBuffer code below\n** for details.\n*/\nstruct MatchinfoBuffer {\n  u8 aRef[3];\n  int nElem;\n  int bGlobal;                    /* Set if global data is loaded */\n  char *zMatchinfo;\n  u32 aMatchinfo[1];\n};\n\n\n/*\n** The snippet() and offsets() functions both return text values. An instance\n** of the following structure is used to accumulate those values while the\n** functions are running. See fts3StringAppend() for details.\n*/\ntypedef struct StrBuffer StrBuffer;\nstruct StrBuffer {\n  char *z;                        /* Pointer to buffer containing string */\n  int n;                          /* Length of z in bytes (excl. nul-term) */\n  int nAlloc;                     /* Allocated size of buffer z in bytes */\n};\n\n\n/*************************************************************************\n** Start of MatchinfoBuffer code.\n*/\n\n/*\n** Allocate a two-slot MatchinfoBuffer object.\n*/\nstatic MatchinfoBuffer *fts3MIBufferNew(int nElem, const char *zMatchinfo){\n  MatchinfoBuffer *pRet;\n  int nByte = sizeof(u32) * (2*nElem + 1) + sizeof(MatchinfoBuffer);\n  int nStr = (int)strlen(zMatchinfo);\n\n  pRet = sqlite3_malloc(nByte + nStr+1);\n  if( pRet ){\n    memset(pRet, 0, nByte);\n    pRet->aMatchinfo[0] = (u8*)(&pRet->aMatchinfo[1]) - (u8*)pRet;\n    pRet->aMatchinfo[1+nElem] = pRet->aMatchinfo[0] + sizeof(u32)*(nElem+1);\n    pRet->nElem = nElem;\n    pRet->zMatchinfo = ((char*)pRet) + nByte;\n    memcpy(pRet->zMatchinfo, zMatchinfo, nStr+1);\n    pRet->aRef[0] = 1;\n  }\n\n  return pRet;\n}\n\nstatic void fts3MIBufferFree(void *p){\n  MatchinfoBuffer *pBuf = (MatchinfoBuffer*)((u8*)p - ((u32*)p)[-1]);\n\n  assert( (u32*)p==&pBuf->aMatchinfo[1] \n       || (u32*)p==&pBuf->aMatchinfo[pBuf->nElem+2] \n  );\n  if( (u32*)p==&pBuf->aMatchinfo[1] ){\n    pBuf->aRef[1] = 0;\n  }else{\n    pBuf->aRef[2] = 0;\n  }\n\n  if( pBuf->aRef[0]==0 && pBuf->aRef[1]==0 && pBuf->aRef[2]==0 ){\n    sqlite3_free(pBuf);\n  }\n}\n\nstatic void (*fts3MIBufferAlloc(MatchinfoBuffer *p, u32 **paOut))(void*){\n  void (*xRet)(void*) = 0;\n  u32 *aOut = 0;\n\n  if( p->aRef[1]==0 ){\n    p->aRef[1] = 1;\n    aOut = &p->aMatchinfo[1];\n    xRet = fts3MIBufferFree;\n  }\n  else if( p->aRef[2]==0 ){\n    p->aRef[2] = 1;\n    aOut = &p->aMatchinfo[p->nElem+2];\n    xRet = fts3MIBufferFree;\n  }else{\n    aOut = (u32*)sqlite3_malloc(p->nElem * sizeof(u32));\n    if( aOut ){\n      xRet = sqlite3_free;\n      if( p->bGlobal ) memcpy(aOut, &p->aMatchinfo[1], p->nElem*sizeof(u32));\n    }\n  }\n\n  *paOut = aOut;\n  return xRet;\n}\n\nstatic void fts3MIBufferSetGlobal(MatchinfoBuffer *p){\n  p->bGlobal = 1;\n  memcpy(&p->aMatchinfo[2+p->nElem], &p->aMatchinfo[1], p->nElem*sizeof(u32));\n}\n\n/*\n** Free a MatchinfoBuffer object allocated using fts3MIBufferNew()\n*/\nvoid sqlite3Fts3MIBufferFree(MatchinfoBuffer *p){\n  if( p ){\n    assert( p->aRef[0]==1 );\n    p->aRef[0] = 0;\n    if( p->aRef[0]==0 && p->aRef[1]==0 && p->aRef[2]==0 ){\n      sqlite3_free(p);\n    }\n  }\n}\n\n/* \n** End of MatchinfoBuffer code.\n*************************************************************************/\n\n\n/*\n** This function is used to help iterate through a position-list. A position\n** list is a list of unique integers, sorted from smallest to largest. Each\n** element of the list is represented by an FTS3 varint that takes the value\n** of the difference between the current element and the previous one plus\n** two. For example, to store the position-list:\n**\n**     4 9 113\n**\n** the three varints:\n**\n**     6 7 106\n**\n** are encoded.\n**\n** When this function is called, *pp points to the start of an element of\n** the list. *piPos contains the value of the previous entry in the list.\n** After it returns, *piPos contains the value of the next element of the\n** list and *pp is advanced to the following varint.\n*/\nstatic void fts3GetDeltaPosition(char **pp, int *piPos){\n  int iVal;\n  *pp += fts3GetVarint32(*pp, &iVal);\n  *piPos += (iVal-2);\n}\n\n/*\n** Helper function for fts3ExprIterate() (see below).\n*/\nstatic int fts3ExprIterate2(\n  Fts3Expr *pExpr,                /* Expression to iterate phrases of */\n  int *piPhrase,                  /* Pointer to phrase counter */\n  int (*x)(Fts3Expr*,int,void*),  /* Callback function to invoke for phrases */\n  void *pCtx                      /* Second argument to pass to callback */\n){\n  int rc;                         /* Return code */\n  int eType = pExpr->eType;     /* Type of expression node pExpr */\n\n  if( eType!=FTSQUERY_PHRASE ){\n    assert( pExpr->pLeft && pExpr->pRight );\n    rc = fts3ExprIterate2(pExpr->pLeft, piPhrase, x, pCtx);\n    if( rc==SQLITE_OK && eType!=FTSQUERY_NOT ){\n      rc = fts3ExprIterate2(pExpr->pRight, piPhrase, x, pCtx);\n    }\n  }else{\n    rc = x(pExpr, *piPhrase, pCtx);\n    (*piPhrase)++;\n  }\n  return rc;\n}\n\n/*\n** Iterate through all phrase nodes in an FTS3 query, except those that\n** are part of a sub-tree that is the right-hand-side of a NOT operator.\n** For each phrase node found, the supplied callback function is invoked.\n**\n** If the callback function returns anything other than SQLITE_OK, \n** the iteration is abandoned and the error code returned immediately.\n** Otherwise, SQLITE_OK is returned after a callback has been made for\n** all eligible phrase nodes.\n*/\nstatic int fts3ExprIterate(\n  Fts3Expr *pExpr,                /* Expression to iterate phrases of */\n  int (*x)(Fts3Expr*,int,void*),  /* Callback function to invoke for phrases */\n  void *pCtx                      /* Second argument to pass to callback */\n){\n  int iPhrase = 0;                /* Variable used as the phrase counter */\n  return fts3ExprIterate2(pExpr, &iPhrase, x, pCtx);\n}\n\n\n/*\n** This is an fts3ExprIterate() callback used while loading the doclists\n** for each phrase into Fts3Expr.aDoclist[]/nDoclist. See also\n** fts3ExprLoadDoclists().\n*/\nstatic int fts3ExprLoadDoclistsCb(Fts3Expr *pExpr, int iPhrase, void *ctx){\n  int rc = SQLITE_OK;\n  Fts3Phrase *pPhrase = pExpr->pPhrase;\n  LoadDoclistCtx *p = (LoadDoclistCtx *)ctx;\n\n  UNUSED_PARAMETER(iPhrase);\n\n  p->nPhrase++;\n  p->nToken += pPhrase->nToken;\n\n  return rc;\n}\n\n/*\n** Load the doclists for each phrase in the query associated with FTS3 cursor\n** pCsr. \n**\n** If pnPhrase is not NULL, then *pnPhrase is set to the number of matchable \n** phrases in the expression (all phrases except those directly or \n** indirectly descended from the right-hand-side of a NOT operator). If \n** pnToken is not NULL, then it is set to the number of tokens in all\n** matchable phrases of the expression.\n*/\nstatic int fts3ExprLoadDoclists(\n  Fts3Cursor *pCsr,               /* Fts3 cursor for current query */\n  int *pnPhrase,                  /* OUT: Number of phrases in query */\n  int *pnToken                    /* OUT: Number of tokens in query */\n){\n  int rc;                         /* Return Code */\n  LoadDoclistCtx sCtx = {0,0,0};  /* Context for fts3ExprIterate() */\n  sCtx.pCsr = pCsr;\n  rc = fts3ExprIterate(pCsr->pExpr, fts3ExprLoadDoclistsCb, (void *)&sCtx);\n  if( pnPhrase ) *pnPhrase = sCtx.nPhrase;\n  if( pnToken ) *pnToken = sCtx.nToken;\n  return rc;\n}\n\nstatic int fts3ExprPhraseCountCb(Fts3Expr *pExpr, int iPhrase, void *ctx){\n  (*(int *)ctx)++;\n  pExpr->iPhrase = iPhrase;\n  return SQLITE_OK;\n}\nstatic int fts3ExprPhraseCount(Fts3Expr *pExpr){\n  int nPhrase = 0;\n  (void)fts3ExprIterate(pExpr, fts3ExprPhraseCountCb, (void *)&nPhrase);\n  return nPhrase;\n}\n\n/*\n** Advance the position list iterator specified by the first two \n** arguments so that it points to the first element with a value greater\n** than or equal to parameter iNext.\n*/\nstatic void fts3SnippetAdvance(char **ppIter, int *piIter, int iNext){\n  char *pIter = *ppIter;\n  if( pIter ){\n    int iIter = *piIter;\n\n    while( iIter<iNext ){\n      if( 0==(*pIter & 0xFE) ){\n        iIter = -1;\n        pIter = 0;\n        break;\n      }\n      fts3GetDeltaPosition(&pIter, &iIter);\n    }\n\n    *piIter = iIter;\n    *ppIter = pIter;\n  }\n}\n\n/*\n** Advance the snippet iterator to the next candidate snippet.\n*/\nstatic int fts3SnippetNextCandidate(SnippetIter *pIter){\n  int i;                          /* Loop counter */\n\n  if( pIter->iCurrent<0 ){\n    /* The SnippetIter object has just been initialized. The first snippet\n    ** candidate always starts at offset 0 (even if this candidate has a\n    ** score of 0.0).\n    */\n    pIter->iCurrent = 0;\n\n    /* Advance the 'head' iterator of each phrase to the first offset that\n    ** is greater than or equal to (iNext+nSnippet).\n    */\n    for(i=0; i<pIter->nPhrase; i++){\n      SnippetPhrase *pPhrase = &pIter->aPhrase[i];\n      fts3SnippetAdvance(&pPhrase->pHead, &pPhrase->iHead, pIter->nSnippet);\n    }\n  }else{\n    int iStart;\n    int iEnd = 0x7FFFFFFF;\n\n    for(i=0; i<pIter->nPhrase; i++){\n      SnippetPhrase *pPhrase = &pIter->aPhrase[i];\n      if( pPhrase->pHead && pPhrase->iHead<iEnd ){\n        iEnd = pPhrase->iHead;\n      }\n    }\n    if( iEnd==0x7FFFFFFF ){\n      return 1;\n    }\n\n    pIter->iCurrent = iStart = iEnd - pIter->nSnippet + 1;\n    for(i=0; i<pIter->nPhrase; i++){\n      SnippetPhrase *pPhrase = &pIter->aPhrase[i];\n      fts3SnippetAdvance(&pPhrase->pHead, &pPhrase->iHead, iEnd+1);\n      fts3SnippetAdvance(&pPhrase->pTail, &pPhrase->iTail, iStart);\n    }\n  }\n\n  return 0;\n}\n\n/*\n** Retrieve information about the current candidate snippet of snippet \n** iterator pIter.\n*/\nstatic void fts3SnippetDetails(\n  SnippetIter *pIter,             /* Snippet iterator */\n  u64 mCovered,                   /* Bitmask of phrases already covered */\n  int *piToken,                   /* OUT: First token of proposed snippet */\n  int *piScore,                   /* OUT: \"Score\" for this snippet */\n  u64 *pmCover,                   /* OUT: Bitmask of phrases covered */\n  u64 *pmHighlight                /* OUT: Bitmask of terms to highlight */\n){\n  int iStart = pIter->iCurrent;   /* First token of snippet */\n  int iScore = 0;                 /* Score of this snippet */\n  int i;                          /* Loop counter */\n  u64 mCover = 0;                 /* Mask of phrases covered by this snippet */\n  u64 mHighlight = 0;             /* Mask of tokens to highlight in snippet */\n\n  for(i=0; i<pIter->nPhrase; i++){\n    SnippetPhrase *pPhrase = &pIter->aPhrase[i];\n    if( pPhrase->pTail ){\n      char *pCsr = pPhrase->pTail;\n      int iCsr = pPhrase->iTail;\n\n      while( iCsr<(iStart+pIter->nSnippet) ){\n        int j;\n        u64 mPhrase = (u64)1 << i;\n        u64 mPos = (u64)1 << (iCsr - iStart);\n        assert( iCsr>=iStart );\n        if( (mCover|mCovered)&mPhrase ){\n          iScore++;\n        }else{\n          iScore += 1000;\n        }\n        mCover |= mPhrase;\n\n        for(j=0; j<pPhrase->nToken; j++){\n          mHighlight |= (mPos>>j);\n        }\n\n        if( 0==(*pCsr & 0x0FE) ) break;\n        fts3GetDeltaPosition(&pCsr, &iCsr);\n      }\n    }\n  }\n\n  /* Set the output variables before returning. */\n  *piToken = iStart;\n  *piScore = iScore;\n  *pmCover = mCover;\n  *pmHighlight = mHighlight;\n}\n\n/*\n** This function is an fts3ExprIterate() callback used by fts3BestSnippet().\n** Each invocation populates an element of the SnippetIter.aPhrase[] array.\n*/\nstatic int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){\n  SnippetIter *p = (SnippetIter *)ctx;\n  SnippetPhrase *pPhrase = &p->aPhrase[iPhrase];\n  char *pCsr;\n  int rc;\n\n  pPhrase->nToken = pExpr->pPhrase->nToken;\n  rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pCsr);\n  assert( rc==SQLITE_OK || pCsr==0 );\n  if( pCsr ){\n    int iFirst = 0;\n    pPhrase->pList = pCsr;\n    fts3GetDeltaPosition(&pCsr, &iFirst);\n    assert( iFirst>=0 );\n    pPhrase->pHead = pCsr;\n    pPhrase->pTail = pCsr;\n    pPhrase->iHead = iFirst;\n    pPhrase->iTail = iFirst;\n  }else{\n    assert( rc!=SQLITE_OK || (\n       pPhrase->pList==0 && pPhrase->pHead==0 && pPhrase->pTail==0 \n    ));\n  }\n\n  return rc;\n}\n\n/*\n** Select the fragment of text consisting of nFragment contiguous tokens \n** from column iCol that represent the \"best\" snippet. The best snippet\n** is the snippet with the highest score, where scores are calculated\n** by adding:\n**\n**   (a) +1 point for each occurrence of a matchable phrase in the snippet.\n**\n**   (b) +1000 points for the first occurrence of each matchable phrase in \n**       the snippet for which the corresponding mCovered bit is not set.\n**\n** The selected snippet parameters are stored in structure *pFragment before\n** returning. The score of the selected snippet is stored in *piScore\n** before returning.\n*/\nstatic int fts3BestSnippet(\n  int nSnippet,                   /* Desired snippet length */\n  Fts3Cursor *pCsr,               /* Cursor to create snippet for */\n  int iCol,                       /* Index of column to create snippet from */\n  u64 mCovered,                   /* Mask of phrases already covered */\n  u64 *pmSeen,                    /* IN/OUT: Mask of phrases seen */\n  SnippetFragment *pFragment,     /* OUT: Best snippet found */\n  int *piScore                    /* OUT: Score of snippet pFragment */\n){\n  int rc;                         /* Return Code */\n  int nList;                      /* Number of phrases in expression */\n  SnippetIter sIter;              /* Iterates through snippet candidates */\n  int nByte;                      /* Number of bytes of space to allocate */\n  int iBestScore = -1;            /* Best snippet score found so far */\n  int i;                          /* Loop counter */\n\n  memset(&sIter, 0, sizeof(sIter));\n\n  /* Iterate through the phrases in the expression to count them. The same\n  ** callback makes sure the doclists are loaded for each phrase.\n  */\n  rc = fts3ExprLoadDoclists(pCsr, &nList, 0);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  /* Now that it is known how many phrases there are, allocate and zero\n  ** the required space using malloc().\n  */\n  nByte = sizeof(SnippetPhrase) * nList;\n  sIter.aPhrase = (SnippetPhrase *)sqlite3_malloc(nByte);\n  if( !sIter.aPhrase ){\n    return SQLITE_NOMEM;\n  }\n  memset(sIter.aPhrase, 0, nByte);\n\n  /* Initialize the contents of the SnippetIter object. Then iterate through\n  ** the set of phrases in the expression to populate the aPhrase[] array.\n  */\n  sIter.pCsr = pCsr;\n  sIter.iCol = iCol;\n  sIter.nSnippet = nSnippet;\n  sIter.nPhrase = nList;\n  sIter.iCurrent = -1;\n  rc = fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void*)&sIter);\n  if( rc==SQLITE_OK ){\n\n    /* Set the *pmSeen output variable. */\n    for(i=0; i<nList; i++){\n      if( sIter.aPhrase[i].pHead ){\n        *pmSeen |= (u64)1 << i;\n      }\n    }\n\n    /* Loop through all candidate snippets. Store the best snippet in \n     ** *pFragment. Store its associated 'score' in iBestScore.\n     */\n    pFragment->iCol = iCol;\n    while( !fts3SnippetNextCandidate(&sIter) ){\n      int iPos;\n      int iScore;\n      u64 mCover;\n      u64 mHighlite;\n      fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover,&mHighlite);\n      assert( iScore>=0 );\n      if( iScore>iBestScore ){\n        pFragment->iPos = iPos;\n        pFragment->hlmask = mHighlite;\n        pFragment->covered = mCover;\n        iBestScore = iScore;\n      }\n    }\n\n    *piScore = iBestScore;\n  }\n  sqlite3_free(sIter.aPhrase);\n  return rc;\n}\n\n\n/*\n** Append a string to the string-buffer passed as the first argument.\n**\n** If nAppend is negative, then the length of the string zAppend is\n** determined using strlen().\n*/\nstatic int fts3StringAppend(\n  StrBuffer *pStr,                /* Buffer to append to */\n  const char *zAppend,            /* Pointer to data to append to buffer */\n  int nAppend                     /* Size of zAppend in bytes (or -1) */\n){\n  if( nAppend<0 ){\n    nAppend = (int)strlen(zAppend);\n  }\n\n  /* If there is insufficient space allocated at StrBuffer.z, use realloc()\n  ** to grow the buffer until so that it is big enough to accomadate the\n  ** appended data.\n  */\n  if( pStr->n+nAppend+1>=pStr->nAlloc ){\n    int nAlloc = pStr->nAlloc+nAppend+100;\n    char *zNew = sqlite3_realloc(pStr->z, nAlloc);\n    if( !zNew ){\n      return SQLITE_NOMEM;\n    }\n    pStr->z = zNew;\n    pStr->nAlloc = nAlloc;\n  }\n  assert( pStr->z!=0 && (pStr->nAlloc >= pStr->n+nAppend+1) );\n\n  /* Append the data to the string buffer. */\n  memcpy(&pStr->z[pStr->n], zAppend, nAppend);\n  pStr->n += nAppend;\n  pStr->z[pStr->n] = '\\0';\n\n  return SQLITE_OK;\n}\n\n/*\n** The fts3BestSnippet() function often selects snippets that end with a\n** query term. That is, the final term of the snippet is always a term\n** that requires highlighting. For example, if 'X' is a highlighted term\n** and '.' is a non-highlighted term, BestSnippet() may select:\n**\n**     ........X.....X\n**\n** This function \"shifts\" the beginning of the snippet forward in the \n** document so that there are approximately the same number of \n** non-highlighted terms to the right of the final highlighted term as there\n** are to the left of the first highlighted term. For example, to this:\n**\n**     ....X.....X....\n**\n** This is done as part of extracting the snippet text, not when selecting\n** the snippet. Snippet selection is done based on doclists only, so there\n** is no way for fts3BestSnippet() to know whether or not the document \n** actually contains terms that follow the final highlighted term. \n*/\nstatic int fts3SnippetShift(\n  Fts3Table *pTab,                /* FTS3 table snippet comes from */\n  int iLangid,                    /* Language id to use in tokenizing */\n  int nSnippet,                   /* Number of tokens desired for snippet */\n  const char *zDoc,               /* Document text to extract snippet from */\n  int nDoc,                       /* Size of buffer zDoc in bytes */\n  int *piPos,                     /* IN/OUT: First token of snippet */\n  u64 *pHlmask                    /* IN/OUT: Mask of tokens to highlight */\n){\n  u64 hlmask = *pHlmask;          /* Local copy of initial highlight-mask */\n\n  if( hlmask ){\n    int nLeft;                    /* Tokens to the left of first highlight */\n    int nRight;                   /* Tokens to the right of last highlight */\n    int nDesired;                 /* Ideal number of tokens to shift forward */\n\n    for(nLeft=0; !(hlmask & ((u64)1 << nLeft)); nLeft++);\n    for(nRight=0; !(hlmask & ((u64)1 << (nSnippet-1-nRight))); nRight++);\n    nDesired = (nLeft-nRight)/2;\n\n    /* Ideally, the start of the snippet should be pushed forward in the\n    ** document nDesired tokens. This block checks if there are actually\n    ** nDesired tokens to the right of the snippet. If so, *piPos and\n    ** *pHlMask are updated to shift the snippet nDesired tokens to the\n    ** right. Otherwise, the snippet is shifted by the number of tokens\n    ** available.\n    */\n    if( nDesired>0 ){\n      int nShift;                 /* Number of tokens to shift snippet by */\n      int iCurrent = 0;           /* Token counter */\n      int rc;                     /* Return Code */\n      sqlite3_tokenizer_module *pMod;\n      sqlite3_tokenizer_cursor *pC;\n      pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;\n\n      /* Open a cursor on zDoc/nDoc. Check if there are (nSnippet+nDesired)\n      ** or more tokens in zDoc/nDoc.\n      */\n      rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, iLangid, zDoc, nDoc, &pC);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){\n        const char *ZDUMMY; int DUMMY1 = 0, DUMMY2 = 0, DUMMY3 = 0;\n        rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &DUMMY2, &DUMMY3, &iCurrent);\n      }\n      pMod->xClose(pC);\n      if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){ return rc; }\n\n      nShift = (rc==SQLITE_DONE)+iCurrent-nSnippet;\n      assert( nShift<=nDesired );\n      if( nShift>0 ){\n        *piPos += nShift;\n        *pHlmask = hlmask >> nShift;\n      }\n    }\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Extract the snippet text for fragment pFragment from cursor pCsr and\n** append it to string buffer pOut.\n*/\nstatic int fts3SnippetText(\n  Fts3Cursor *pCsr,               /* FTS3 Cursor */\n  SnippetFragment *pFragment,     /* Snippet to extract */\n  int iFragment,                  /* Fragment number */\n  int isLast,                     /* True for final fragment in snippet */\n  int nSnippet,                   /* Number of tokens in extracted snippet */\n  const char *zOpen,              /* String inserted before highlighted term */\n  const char *zClose,             /* String inserted after highlighted term */\n  const char *zEllipsis,          /* String inserted between snippets */\n  StrBuffer *pOut                 /* Write output here */\n){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int rc;                         /* Return code */\n  const char *zDoc;               /* Document text to extract snippet from */\n  int nDoc;                       /* Size of zDoc in bytes */\n  int iCurrent = 0;               /* Current token number of document */\n  int iEnd = 0;                   /* Byte offset of end of current token */\n  int isShiftDone = 0;            /* True after snippet is shifted */\n  int iPos = pFragment->iPos;     /* First token of snippet */\n  u64 hlmask = pFragment->hlmask; /* Highlight-mask for snippet */\n  int iCol = pFragment->iCol+1;   /* Query column to extract text from */\n  sqlite3_tokenizer_module *pMod; /* Tokenizer module methods object */\n  sqlite3_tokenizer_cursor *pC;   /* Tokenizer cursor open on zDoc/nDoc */\n  \n  zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol);\n  if( zDoc==0 ){\n    if( sqlite3_column_type(pCsr->pStmt, iCol)!=SQLITE_NULL ){\n      return SQLITE_NOMEM;\n    }\n    return SQLITE_OK;\n  }\n  nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol);\n\n  /* Open a token cursor on the document. */\n  pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;\n  rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc,nDoc,&pC);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  while( rc==SQLITE_OK ){\n    const char *ZDUMMY;           /* Dummy argument used with tokenizer */\n    int DUMMY1 = -1;              /* Dummy argument used with tokenizer */\n    int iBegin = 0;               /* Offset in zDoc of start of token */\n    int iFin = 0;                 /* Offset in zDoc of end of token */\n    int isHighlight = 0;          /* True for highlighted terms */\n\n    /* Variable DUMMY1 is initialized to a negative value above. Elsewhere\n    ** in the FTS code the variable that the third argument to xNext points to\n    ** is initialized to zero before the first (*but not necessarily\n    ** subsequent*) call to xNext(). This is done for a particular application\n    ** that needs to know whether or not the tokenizer is being used for\n    ** snippet generation or for some other purpose.\n    **\n    ** Extreme care is required when writing code to depend on this\n    ** initialization. It is not a documented part of the tokenizer interface.\n    ** If a tokenizer is used directly by any code outside of FTS, this\n    ** convention might not be respected.  */\n    rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &iBegin, &iFin, &iCurrent);\n    if( rc!=SQLITE_OK ){\n      if( rc==SQLITE_DONE ){\n        /* Special case - the last token of the snippet is also the last token\n        ** of the column. Append any punctuation that occurred between the end\n        ** of the previous token and the end of the document to the output. \n        ** Then break out of the loop. */\n        rc = fts3StringAppend(pOut, &zDoc[iEnd], -1);\n      }\n      break;\n    }\n    if( iCurrent<iPos ){ continue; }\n\n    if( !isShiftDone ){\n      int n = nDoc - iBegin;\n      rc = fts3SnippetShift(\n          pTab, pCsr->iLangid, nSnippet, &zDoc[iBegin], n, &iPos, &hlmask\n      );\n      isShiftDone = 1;\n\n      /* Now that the shift has been done, check if the initial \"...\" are\n      ** required. They are required if (a) this is not the first fragment,\n      ** or (b) this fragment does not begin at position 0 of its column. \n      */\n      if( rc==SQLITE_OK ){\n        if( iPos>0 || iFragment>0 ){\n          rc = fts3StringAppend(pOut, zEllipsis, -1);\n        }else if( iBegin ){\n          rc = fts3StringAppend(pOut, zDoc, iBegin);\n        }\n      }\n      if( rc!=SQLITE_OK || iCurrent<iPos ) continue;\n    }\n\n    if( iCurrent>=(iPos+nSnippet) ){\n      if( isLast ){\n        rc = fts3StringAppend(pOut, zEllipsis, -1);\n      }\n      break;\n    }\n\n    /* Set isHighlight to true if this term should be highlighted. */\n    isHighlight = (hlmask & ((u64)1 << (iCurrent-iPos)))!=0;\n\n    if( iCurrent>iPos ) rc = fts3StringAppend(pOut, &zDoc[iEnd], iBegin-iEnd);\n    if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zOpen, -1);\n    if( rc==SQLITE_OK ) rc = fts3StringAppend(pOut, &zDoc[iBegin], iFin-iBegin);\n    if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zClose, -1);\n\n    iEnd = iFin;\n  }\n\n  pMod->xClose(pC);\n  return rc;\n}\n\n\n/*\n** This function is used to count the entries in a column-list (a \n** delta-encoded list of term offsets within a single column of a single \n** row). When this function is called, *ppCollist should point to the\n** beginning of the first varint in the column-list (the varint that\n** contains the position of the first matching term in the column data).\n** Before returning, *ppCollist is set to point to the first byte after\n** the last varint in the column-list (either the 0x00 signifying the end\n** of the position-list, or the 0x01 that precedes the column number of\n** the next column in the position-list).\n**\n** The number of elements in the column-list is returned.\n*/\nstatic int fts3ColumnlistCount(char **ppCollist){\n  char *pEnd = *ppCollist;\n  char c = 0;\n  int nEntry = 0;\n\n  /* A column-list is terminated by either a 0x01 or 0x00. */\n  while( 0xFE & (*pEnd | c) ){\n    c = *pEnd++ & 0x80;\n    if( !c ) nEntry++;\n  }\n\n  *ppCollist = pEnd;\n  return nEntry;\n}\n\n/*\n** This function gathers 'y' or 'b' data for a single phrase.\n*/\nstatic void fts3ExprLHits(\n  Fts3Expr *pExpr,                /* Phrase expression node */\n  MatchInfo *p                    /* Matchinfo context */\n){\n  Fts3Table *pTab = (Fts3Table *)p->pCursor->base.pVtab;\n  int iStart;\n  Fts3Phrase *pPhrase = pExpr->pPhrase;\n  char *pIter = pPhrase->doclist.pList;\n  int iCol = 0;\n\n  assert( p->flag==FTS3_MATCHINFO_LHITS_BM || p->flag==FTS3_MATCHINFO_LHITS );\n  if( p->flag==FTS3_MATCHINFO_LHITS ){\n    iStart = pExpr->iPhrase * p->nCol;\n  }else{\n    iStart = pExpr->iPhrase * ((p->nCol + 31) / 32);\n  }\n\n  while( 1 ){\n    int nHit = fts3ColumnlistCount(&pIter);\n    if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){\n      if( p->flag==FTS3_MATCHINFO_LHITS ){\n        p->aMatchinfo[iStart + iCol] = (u32)nHit;\n      }else if( nHit ){\n        p->aMatchinfo[iStart + (iCol+1)/32] |= (1 << (iCol&0x1F));\n      }\n    }\n    assert( *pIter==0x00 || *pIter==0x01 );\n    if( *pIter!=0x01 ) break;\n    pIter++;\n    pIter += fts3GetVarint32(pIter, &iCol);\n  }\n}\n\n/*\n** Gather the results for matchinfo directives 'y' and 'b'.\n*/\nstatic void fts3ExprLHitGather(\n  Fts3Expr *pExpr,\n  MatchInfo *p\n){\n  assert( (pExpr->pLeft==0)==(pExpr->pRight==0) );\n  if( pExpr->bEof==0 && pExpr->iDocid==p->pCursor->iPrevId ){\n    if( pExpr->pLeft ){\n      fts3ExprLHitGather(pExpr->pLeft, p);\n      fts3ExprLHitGather(pExpr->pRight, p);\n    }else{\n      fts3ExprLHits(pExpr, p);\n    }\n  }\n}\n\n/*\n** fts3ExprIterate() callback used to collect the \"global\" matchinfo stats\n** for a single query. \n**\n** fts3ExprIterate() callback to load the 'global' elements of a\n** FTS3_MATCHINFO_HITS matchinfo array. The global stats are those elements \n** of the matchinfo array that are constant for all rows returned by the \n** current query.\n**\n** Argument pCtx is actually a pointer to a struct of type MatchInfo. This\n** function populates Matchinfo.aMatchinfo[] as follows:\n**\n**   for(iCol=0; iCol<nCol; iCol++){\n**     aMatchinfo[3*iPhrase*nCol + 3*iCol + 1] = X;\n**     aMatchinfo[3*iPhrase*nCol + 3*iCol + 2] = Y;\n**   }\n**\n** where X is the number of matches for phrase iPhrase is column iCol of all\n** rows of the table. Y is the number of rows for which column iCol contains\n** at least one instance of phrase iPhrase.\n**\n** If the phrase pExpr consists entirely of deferred tokens, then all X and\n** Y values are set to nDoc, where nDoc is the number of documents in the \n** file system. This is done because the full-text index doclist is required\n** to calculate these values properly, and the full-text index doclist is\n** not available for deferred tokens.\n*/\nstatic int fts3ExprGlobalHitsCb(\n  Fts3Expr *pExpr,                /* Phrase expression node */\n  int iPhrase,                    /* Phrase number (numbered from zero) */\n  void *pCtx                      /* Pointer to MatchInfo structure */\n){\n  MatchInfo *p = (MatchInfo *)pCtx;\n  return sqlite3Fts3EvalPhraseStats(\n      p->pCursor, pExpr, &p->aMatchinfo[3*iPhrase*p->nCol]\n  );\n}\n\n/*\n** fts3ExprIterate() callback used to collect the \"local\" part of the\n** FTS3_MATCHINFO_HITS array. The local stats are those elements of the \n** array that are different for each row returned by the query.\n*/\nstatic int fts3ExprLocalHitsCb(\n  Fts3Expr *pExpr,                /* Phrase expression node */\n  int iPhrase,                    /* Phrase number */\n  void *pCtx                      /* Pointer to MatchInfo structure */\n){\n  int rc = SQLITE_OK;\n  MatchInfo *p = (MatchInfo *)pCtx;\n  int iStart = iPhrase * p->nCol * 3;\n  int i;\n\n  for(i=0; i<p->nCol && rc==SQLITE_OK; i++){\n    char *pCsr;\n    rc = sqlite3Fts3EvalPhrasePoslist(p->pCursor, pExpr, i, &pCsr);\n    if( pCsr ){\n      p->aMatchinfo[iStart+i*3] = fts3ColumnlistCount(&pCsr);\n    }else{\n      p->aMatchinfo[iStart+i*3] = 0;\n    }\n  }\n\n  return rc;\n}\n\nstatic int fts3MatchinfoCheck(\n  Fts3Table *pTab, \n  char cArg,\n  char **pzErr\n){\n  if( (cArg==FTS3_MATCHINFO_NPHRASE)\n   || (cArg==FTS3_MATCHINFO_NCOL)\n   || (cArg==FTS3_MATCHINFO_NDOC && pTab->bFts4)\n   || (cArg==FTS3_MATCHINFO_AVGLENGTH && pTab->bFts4)\n   || (cArg==FTS3_MATCHINFO_LENGTH && pTab->bHasDocsize)\n   || (cArg==FTS3_MATCHINFO_LCS)\n   || (cArg==FTS3_MATCHINFO_HITS)\n   || (cArg==FTS3_MATCHINFO_LHITS)\n   || (cArg==FTS3_MATCHINFO_LHITS_BM)\n  ){\n    return SQLITE_OK;\n  }\n  sqlite3Fts3ErrMsg(pzErr, \"unrecognized matchinfo request: %c\", cArg);\n  return SQLITE_ERROR;\n}\n\nstatic int fts3MatchinfoSize(MatchInfo *pInfo, char cArg){\n  int nVal;                       /* Number of integers output by cArg */\n\n  switch( cArg ){\n    case FTS3_MATCHINFO_NDOC:\n    case FTS3_MATCHINFO_NPHRASE: \n    case FTS3_MATCHINFO_NCOL: \n      nVal = 1;\n      break;\n\n    case FTS3_MATCHINFO_AVGLENGTH:\n    case FTS3_MATCHINFO_LENGTH:\n    case FTS3_MATCHINFO_LCS:\n      nVal = pInfo->nCol;\n      break;\n\n    case FTS3_MATCHINFO_LHITS:\n      nVal = pInfo->nCol * pInfo->nPhrase;\n      break;\n\n    case FTS3_MATCHINFO_LHITS_BM:\n      nVal = pInfo->nPhrase * ((pInfo->nCol + 31) / 32);\n      break;\n\n    default:\n      assert( cArg==FTS3_MATCHINFO_HITS );\n      nVal = pInfo->nCol * pInfo->nPhrase * 3;\n      break;\n  }\n\n  return nVal;\n}\n\nstatic int fts3MatchinfoSelectDoctotal(\n  Fts3Table *pTab,\n  sqlite3_stmt **ppStmt,\n  sqlite3_int64 *pnDoc,\n  const char **paLen\n){\n  sqlite3_stmt *pStmt;\n  const char *a;\n  sqlite3_int64 nDoc;\n\n  if( !*ppStmt ){\n    int rc = sqlite3Fts3SelectDoctotal(pTab, ppStmt);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n  pStmt = *ppStmt;\n  assert( sqlite3_data_count(pStmt)==1 );\n\n  a = sqlite3_column_blob(pStmt, 0);\n  a += sqlite3Fts3GetVarint(a, &nDoc);\n  if( nDoc==0 ) return FTS_CORRUPT_VTAB;\n  *pnDoc = (u32)nDoc;\n\n  if( paLen ) *paLen = a;\n  return SQLITE_OK;\n}\n\n/*\n** An instance of the following structure is used to store state while \n** iterating through a multi-column position-list corresponding to the\n** hits for a single phrase on a single row in order to calculate the\n** values for a matchinfo() FTS3_MATCHINFO_LCS request.\n*/\ntypedef struct LcsIterator LcsIterator;\nstruct LcsIterator {\n  Fts3Expr *pExpr;                /* Pointer to phrase expression */\n  int iPosOffset;                 /* Tokens count up to end of this phrase */\n  char *pRead;                    /* Cursor used to iterate through aDoclist */\n  int iPos;                       /* Current position */\n};\n\n/* \n** If LcsIterator.iCol is set to the following value, the iterator has\n** finished iterating through all offsets for all columns.\n*/\n#define LCS_ITERATOR_FINISHED 0x7FFFFFFF;\n\nstatic int fts3MatchinfoLcsCb(\n  Fts3Expr *pExpr,                /* Phrase expression node */\n  int iPhrase,                    /* Phrase number (numbered from zero) */\n  void *pCtx                      /* Pointer to MatchInfo structure */\n){\n  LcsIterator *aIter = (LcsIterator *)pCtx;\n  aIter[iPhrase].pExpr = pExpr;\n  return SQLITE_OK;\n}\n\n/*\n** Advance the iterator passed as an argument to the next position. Return\n** 1 if the iterator is at EOF or if it now points to the start of the\n** position list for the next column.\n*/\nstatic int fts3LcsIteratorAdvance(LcsIterator *pIter){\n  char *pRead = pIter->pRead;\n  sqlite3_int64 iRead;\n  int rc = 0;\n\n  pRead += sqlite3Fts3GetVarint(pRead, &iRead);\n  if( iRead==0 || iRead==1 ){\n    pRead = 0;\n    rc = 1;\n  }else{\n    pIter->iPos += (int)(iRead-2);\n  }\n\n  pIter->pRead = pRead;\n  return rc;\n}\n  \n/*\n** This function implements the FTS3_MATCHINFO_LCS matchinfo() flag. \n**\n** If the call is successful, the longest-common-substring lengths for each\n** column are written into the first nCol elements of the pInfo->aMatchinfo[] \n** array before returning. SQLITE_OK is returned in this case.\n**\n** Otherwise, if an error occurs, an SQLite error code is returned and the\n** data written to the first nCol elements of pInfo->aMatchinfo[] is \n** undefined.\n*/\nstatic int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){\n  LcsIterator *aIter;\n  int i;\n  int iCol;\n  int nToken = 0;\n\n  /* Allocate and populate the array of LcsIterator objects. The array\n  ** contains one element for each matchable phrase in the query.\n  **/\n  aIter = sqlite3_malloc(sizeof(LcsIterator) * pCsr->nPhrase);\n  if( !aIter ) return SQLITE_NOMEM;\n  memset(aIter, 0, sizeof(LcsIterator) * pCsr->nPhrase);\n  (void)fts3ExprIterate(pCsr->pExpr, fts3MatchinfoLcsCb, (void*)aIter);\n\n  for(i=0; i<pInfo->nPhrase; i++){\n    LcsIterator *pIter = &aIter[i];\n    nToken -= pIter->pExpr->pPhrase->nToken;\n    pIter->iPosOffset = nToken;\n  }\n\n  for(iCol=0; iCol<pInfo->nCol; iCol++){\n    int nLcs = 0;                 /* LCS value for this column */\n    int nLive = 0;                /* Number of iterators in aIter not at EOF */\n\n    for(i=0; i<pInfo->nPhrase; i++){\n      int rc;\n      LcsIterator *pIt = &aIter[i];\n      rc = sqlite3Fts3EvalPhrasePoslist(pCsr, pIt->pExpr, iCol, &pIt->pRead);\n      if( rc!=SQLITE_OK ) return rc;\n      if( pIt->pRead ){\n        pIt->iPos = pIt->iPosOffset;\n        fts3LcsIteratorAdvance(&aIter[i]);\n        nLive++;\n      }\n    }\n\n    while( nLive>0 ){\n      LcsIterator *pAdv = 0;      /* The iterator to advance by one position */\n      int nThisLcs = 0;           /* LCS for the current iterator positions */\n\n      for(i=0; i<pInfo->nPhrase; i++){\n        LcsIterator *pIter = &aIter[i];\n        if( pIter->pRead==0 ){\n          /* This iterator is already at EOF for this column. */\n          nThisLcs = 0;\n        }else{\n          if( pAdv==0 || pIter->iPos<pAdv->iPos ){\n            pAdv = pIter;\n          }\n          if( nThisLcs==0 || pIter->iPos==pIter[-1].iPos ){\n            nThisLcs++;\n          }else{\n            nThisLcs = 1;\n          }\n          if( nThisLcs>nLcs ) nLcs = nThisLcs;\n        }\n      }\n      if( fts3LcsIteratorAdvance(pAdv) ) nLive--;\n    }\n\n    pInfo->aMatchinfo[iCol] = nLcs;\n  }\n\n  sqlite3_free(aIter);\n  return SQLITE_OK;\n}\n\n/*\n** Populate the buffer pInfo->aMatchinfo[] with an array of integers to\n** be returned by the matchinfo() function. Argument zArg contains the \n** format string passed as the second argument to matchinfo (or the\n** default value \"pcx\" if no second argument was specified). The format\n** string has already been validated and the pInfo->aMatchinfo[] array\n** is guaranteed to be large enough for the output.\n**\n** If bGlobal is true, then populate all fields of the matchinfo() output.\n** If it is false, then assume that those fields that do not change between\n** rows (i.e. FTS3_MATCHINFO_NPHRASE, NCOL, NDOC, AVGLENGTH and part of HITS)\n** have already been populated.\n**\n** Return SQLITE_OK if successful, or an SQLite error code if an error \n** occurs. If a value other than SQLITE_OK is returned, the state the\n** pInfo->aMatchinfo[] buffer is left in is undefined.\n*/\nstatic int fts3MatchinfoValues(\n  Fts3Cursor *pCsr,               /* FTS3 cursor object */\n  int bGlobal,                    /* True to grab the global stats */\n  MatchInfo *pInfo,               /* Matchinfo context object */\n  const char *zArg                /* Matchinfo format string */\n){\n  int rc = SQLITE_OK;\n  int i;\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  sqlite3_stmt *pSelect = 0;\n\n  for(i=0; rc==SQLITE_OK && zArg[i]; i++){\n    pInfo->flag = zArg[i];\n    switch( zArg[i] ){\n      case FTS3_MATCHINFO_NPHRASE:\n        if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nPhrase;\n        break;\n\n      case FTS3_MATCHINFO_NCOL:\n        if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nCol;\n        break;\n        \n      case FTS3_MATCHINFO_NDOC:\n        if( bGlobal ){\n          sqlite3_int64 nDoc = 0;\n          rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0);\n          pInfo->aMatchinfo[0] = (u32)nDoc;\n        }\n        break;\n\n      case FTS3_MATCHINFO_AVGLENGTH: \n        if( bGlobal ){\n          sqlite3_int64 nDoc;     /* Number of rows in table */\n          const char *a;          /* Aggregate column length array */\n\n          rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, &a);\n          if( rc==SQLITE_OK ){\n            int iCol;\n            for(iCol=0; iCol<pInfo->nCol; iCol++){\n              u32 iVal;\n              sqlite3_int64 nToken;\n              a += sqlite3Fts3GetVarint(a, &nToken);\n              iVal = (u32)(((u32)(nToken&0xffffffff)+nDoc/2)/nDoc);\n              pInfo->aMatchinfo[iCol] = iVal;\n            }\n          }\n        }\n        break;\n\n      case FTS3_MATCHINFO_LENGTH: {\n        sqlite3_stmt *pSelectDocsize = 0;\n        rc = sqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize);\n        if( rc==SQLITE_OK ){\n          int iCol;\n          const char *a = sqlite3_column_blob(pSelectDocsize, 0);\n          for(iCol=0; iCol<pInfo->nCol; iCol++){\n            sqlite3_int64 nToken;\n            a += sqlite3Fts3GetVarint(a, &nToken);\n            pInfo->aMatchinfo[iCol] = (u32)nToken;\n          }\n        }\n        sqlite3_reset(pSelectDocsize);\n        break;\n      }\n\n      case FTS3_MATCHINFO_LCS:\n        rc = fts3ExprLoadDoclists(pCsr, 0, 0);\n        if( rc==SQLITE_OK ){\n          rc = fts3MatchinfoLcs(pCsr, pInfo);\n        }\n        break;\n\n      case FTS3_MATCHINFO_LHITS_BM:\n      case FTS3_MATCHINFO_LHITS: {\n        int nZero = fts3MatchinfoSize(pInfo, zArg[i]) * sizeof(u32);\n        memset(pInfo->aMatchinfo, 0, nZero);\n        fts3ExprLHitGather(pCsr->pExpr, pInfo);\n        break;\n      }\n\n      default: {\n        Fts3Expr *pExpr;\n        assert( zArg[i]==FTS3_MATCHINFO_HITS );\n        pExpr = pCsr->pExpr;\n        rc = fts3ExprLoadDoclists(pCsr, 0, 0);\n        if( rc!=SQLITE_OK ) break;\n        if( bGlobal ){\n          if( pCsr->pDeferred ){\n            rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0);\n            if( rc!=SQLITE_OK ) break;\n          }\n          rc = fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo);\n          sqlite3Fts3EvalTestDeferred(pCsr, &rc);\n          if( rc!=SQLITE_OK ) break;\n        }\n        (void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo);\n        break;\n      }\n    }\n\n    pInfo->aMatchinfo += fts3MatchinfoSize(pInfo, zArg[i]);\n  }\n\n  sqlite3_reset(pSelect);\n  return rc;\n}\n\n\n/*\n** Populate pCsr->aMatchinfo[] with data for the current row. The \n** 'matchinfo' data is an array of 32-bit unsigned integers (C type u32).\n*/\nstatic void fts3GetMatchinfo(\n  sqlite3_context *pCtx,        /* Return results here */\n  Fts3Cursor *pCsr,               /* FTS3 Cursor object */\n  const char *zArg                /* Second argument to matchinfo() function */\n){\n  MatchInfo sInfo;\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int rc = SQLITE_OK;\n  int bGlobal = 0;                /* Collect 'global' stats as well as local */\n\n  u32 *aOut = 0;\n  void (*xDestroyOut)(void*) = 0;\n\n  memset(&sInfo, 0, sizeof(MatchInfo));\n  sInfo.pCursor = pCsr;\n  sInfo.nCol = pTab->nColumn;\n\n  /* If there is cached matchinfo() data, but the format string for the \n  ** cache does not match the format string for this request, discard \n  ** the cached data. */\n  if( pCsr->pMIBuffer && strcmp(pCsr->pMIBuffer->zMatchinfo, zArg) ){\n    sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);\n    pCsr->pMIBuffer = 0;\n  }\n\n  /* If Fts3Cursor.pMIBuffer is NULL, then this is the first time the\n  ** matchinfo function has been called for this query. In this case \n  ** allocate the array used to accumulate the matchinfo data and\n  ** initialize those elements that are constant for every row.\n  */\n  if( pCsr->pMIBuffer==0 ){\n    int nMatchinfo = 0;           /* Number of u32 elements in match-info */\n    int i;                        /* Used to iterate through zArg */\n\n    /* Determine the number of phrases in the query */\n    pCsr->nPhrase = fts3ExprPhraseCount(pCsr->pExpr);\n    sInfo.nPhrase = pCsr->nPhrase;\n\n    /* Determine the number of integers in the buffer returned by this call. */\n    for(i=0; zArg[i]; i++){\n      char *zErr = 0;\n      if( fts3MatchinfoCheck(pTab, zArg[i], &zErr) ){\n        sqlite3_result_error(pCtx, zErr, -1);\n        sqlite3_free(zErr);\n        return;\n      }\n      nMatchinfo += fts3MatchinfoSize(&sInfo, zArg[i]);\n    }\n\n    /* Allocate space for Fts3Cursor.aMatchinfo[] and Fts3Cursor.zMatchinfo. */\n    pCsr->pMIBuffer = fts3MIBufferNew(nMatchinfo, zArg);\n    if( !pCsr->pMIBuffer ) rc = SQLITE_NOMEM;\n\n    pCsr->isMatchinfoNeeded = 1;\n    bGlobal = 1;\n  }\n\n  if( rc==SQLITE_OK ){\n    xDestroyOut = fts3MIBufferAlloc(pCsr->pMIBuffer, &aOut);\n    if( xDestroyOut==0 ){\n      rc = SQLITE_NOMEM;\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    sInfo.aMatchinfo = aOut;\n    sInfo.nPhrase = pCsr->nPhrase;\n    rc = fts3MatchinfoValues(pCsr, bGlobal, &sInfo, zArg);\n    if( bGlobal ){\n      fts3MIBufferSetGlobal(pCsr->pMIBuffer);\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    sqlite3_result_error_code(pCtx, rc);\n    if( xDestroyOut ) xDestroyOut(aOut);\n  }else{\n    int n = pCsr->pMIBuffer->nElem * sizeof(u32);\n    sqlite3_result_blob(pCtx, aOut, n, xDestroyOut);\n  }\n}\n\n/*\n** Implementation of snippet() function.\n*/\nvoid sqlite3Fts3Snippet(\n  sqlite3_context *pCtx,          /* SQLite function call context */\n  Fts3Cursor *pCsr,               /* Cursor object */\n  const char *zStart,             /* Snippet start text - \"<b>\" */\n  const char *zEnd,               /* Snippet end text - \"</b>\" */\n  const char *zEllipsis,          /* Snippet ellipsis text - \"<b>...</b>\" */\n  int iCol,                       /* Extract snippet from this column */\n  int nToken                      /* Approximate number of tokens in snippet */\n){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  int rc = SQLITE_OK;\n  int i;\n  StrBuffer res = {0, 0, 0};\n\n  /* The returned text includes up to four fragments of text extracted from\n  ** the data in the current row. The first iteration of the for(...) loop\n  ** below attempts to locate a single fragment of text nToken tokens in \n  ** size that contains at least one instance of all phrases in the query\n  ** expression that appear in the current row. If such a fragment of text\n  ** cannot be found, the second iteration of the loop attempts to locate\n  ** a pair of fragments, and so on.\n  */\n  int nSnippet = 0;               /* Number of fragments in this snippet */\n  SnippetFragment aSnippet[4];    /* Maximum of 4 fragments per snippet */\n  int nFToken = -1;               /* Number of tokens in each fragment */\n\n  if( !pCsr->pExpr ){\n    sqlite3_result_text(pCtx, \"\", 0, SQLITE_STATIC);\n    return;\n  }\n\n  for(nSnippet=1; 1; nSnippet++){\n\n    int iSnip;                    /* Loop counter 0..nSnippet-1 */\n    u64 mCovered = 0;             /* Bitmask of phrases covered by snippet */\n    u64 mSeen = 0;                /* Bitmask of phrases seen by BestSnippet() */\n\n    if( nToken>=0 ){\n      nFToken = (nToken+nSnippet-1) / nSnippet;\n    }else{\n      nFToken = -1 * nToken;\n    }\n\n    for(iSnip=0; iSnip<nSnippet; iSnip++){\n      int iBestScore = -1;        /* Best score of columns checked so far */\n      int iRead;                  /* Used to iterate through columns */\n      SnippetFragment *pFragment = &aSnippet[iSnip];\n\n      memset(pFragment, 0, sizeof(*pFragment));\n\n      /* Loop through all columns of the table being considered for snippets.\n      ** If the iCol argument to this function was negative, this means all\n      ** columns of the FTS3 table. Otherwise, only column iCol is considered.\n      */\n      for(iRead=0; iRead<pTab->nColumn; iRead++){\n        SnippetFragment sF = {0, 0, 0, 0};\n        int iS = 0;\n        if( iCol>=0 && iRead!=iCol ) continue;\n\n        /* Find the best snippet of nFToken tokens in column iRead. */\n        rc = fts3BestSnippet(nFToken, pCsr, iRead, mCovered, &mSeen, &sF, &iS);\n        if( rc!=SQLITE_OK ){\n          goto snippet_out;\n        }\n        if( iS>iBestScore ){\n          *pFragment = sF;\n          iBestScore = iS;\n        }\n      }\n\n      mCovered |= pFragment->covered;\n    }\n\n    /* If all query phrases seen by fts3BestSnippet() are present in at least\n    ** one of the nSnippet snippet fragments, break out of the loop.\n    */\n    assert( (mCovered&mSeen)==mCovered );\n    if( mSeen==mCovered || nSnippet==SizeofArray(aSnippet) ) break;\n  }\n\n  assert( nFToken>0 );\n\n  for(i=0; i<nSnippet && rc==SQLITE_OK; i++){\n    rc = fts3SnippetText(pCsr, &aSnippet[i], \n        i, (i==nSnippet-1), nFToken, zStart, zEnd, zEllipsis, &res\n    );\n  }\n\n snippet_out:\n  sqlite3Fts3SegmentsClose(pTab);\n  if( rc!=SQLITE_OK ){\n    sqlite3_result_error_code(pCtx, rc);\n    sqlite3_free(res.z);\n  }else{\n    sqlite3_result_text(pCtx, res.z, -1, sqlite3_free);\n  }\n}\n\n\ntypedef struct TermOffset TermOffset;\ntypedef struct TermOffsetCtx TermOffsetCtx;\n\nstruct TermOffset {\n  char *pList;                    /* Position-list */\n  int iPos;                       /* Position just read from pList */\n  int iOff;                       /* Offset of this term from read positions */\n};\n\nstruct TermOffsetCtx {\n  Fts3Cursor *pCsr;\n  int iCol;                       /* Column of table to populate aTerm for */\n  int iTerm;\n  sqlite3_int64 iDocid;\n  TermOffset *aTerm;\n};\n\n/*\n** This function is an fts3ExprIterate() callback used by sqlite3Fts3Offsets().\n*/\nstatic int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){\n  TermOffsetCtx *p = (TermOffsetCtx *)ctx;\n  int nTerm;                      /* Number of tokens in phrase */\n  int iTerm;                      /* For looping through nTerm phrase terms */\n  char *pList;                    /* Pointer to position list for phrase */\n  int iPos = 0;                   /* First position in position-list */\n  int rc;\n\n  UNUSED_PARAMETER(iPhrase);\n  rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pList);\n  nTerm = pExpr->pPhrase->nToken;\n  if( pList ){\n    fts3GetDeltaPosition(&pList, &iPos);\n    assert( iPos>=0 );\n  }\n\n  for(iTerm=0; iTerm<nTerm; iTerm++){\n    TermOffset *pT = &p->aTerm[p->iTerm++];\n    pT->iOff = nTerm-iTerm-1;\n    pT->pList = pList;\n    pT->iPos = iPos;\n  }\n\n  return rc;\n}\n\n/*\n** Implementation of offsets() function.\n*/\nvoid sqlite3Fts3Offsets(\n  sqlite3_context *pCtx,          /* SQLite function call context */\n  Fts3Cursor *pCsr                /* Cursor object */\n){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  sqlite3_tokenizer_module const *pMod = pTab->pTokenizer->pModule;\n  int rc;                         /* Return Code */\n  int nToken;                     /* Number of tokens in query */\n  int iCol;                       /* Column currently being processed */\n  StrBuffer res = {0, 0, 0};      /* Result string */\n  TermOffsetCtx sCtx;             /* Context for fts3ExprTermOffsetInit() */\n\n  if( !pCsr->pExpr ){\n    sqlite3_result_text(pCtx, \"\", 0, SQLITE_STATIC);\n    return;\n  }\n\n  memset(&sCtx, 0, sizeof(sCtx));\n  assert( pCsr->isRequireSeek==0 );\n\n  /* Count the number of terms in the query */\n  rc = fts3ExprLoadDoclists(pCsr, 0, &nToken);\n  if( rc!=SQLITE_OK ) goto offsets_out;\n\n  /* Allocate the array of TermOffset iterators. */\n  sCtx.aTerm = (TermOffset *)sqlite3_malloc(sizeof(TermOffset)*nToken);\n  if( 0==sCtx.aTerm ){\n    rc = SQLITE_NOMEM;\n    goto offsets_out;\n  }\n  sCtx.iDocid = pCsr->iPrevId;\n  sCtx.pCsr = pCsr;\n\n  /* Loop through the table columns, appending offset information to \n  ** string-buffer res for each column.\n  */\n  for(iCol=0; iCol<pTab->nColumn; iCol++){\n    sqlite3_tokenizer_cursor *pC; /* Tokenizer cursor */\n    const char *ZDUMMY;           /* Dummy argument used with xNext() */\n    int NDUMMY = 0;               /* Dummy argument used with xNext() */\n    int iStart = 0;\n    int iEnd = 0;\n    int iCurrent = 0;\n    const char *zDoc;\n    int nDoc;\n\n    /* Initialize the contents of sCtx.aTerm[] for column iCol. There is \n    ** no way that this operation can fail, so the return code from\n    ** fts3ExprIterate() can be discarded.\n    */\n    sCtx.iCol = iCol;\n    sCtx.iTerm = 0;\n    (void)fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void*)&sCtx);\n\n    /* Retreive the text stored in column iCol. If an SQL NULL is stored \n    ** in column iCol, jump immediately to the next iteration of the loop.\n    ** If an OOM occurs while retrieving the data (this can happen if SQLite\n    ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM \n    ** to the caller. \n    */\n    zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol+1);\n    nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol+1);\n    if( zDoc==0 ){\n      if( sqlite3_column_type(pCsr->pStmt, iCol+1)==SQLITE_NULL ){\n        continue;\n      }\n      rc = SQLITE_NOMEM;\n      goto offsets_out;\n    }\n\n    /* Initialize a tokenizer iterator to iterate through column iCol. */\n    rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid,\n        zDoc, nDoc, &pC\n    );\n    if( rc!=SQLITE_OK ) goto offsets_out;\n\n    rc = pMod->xNext(pC, &ZDUMMY, &NDUMMY, &iStart, &iEnd, &iCurrent);\n    while( rc==SQLITE_OK ){\n      int i;                      /* Used to loop through terms */\n      int iMinPos = 0x7FFFFFFF;   /* Position of next token */\n      TermOffset *pTerm = 0;      /* TermOffset associated with next token */\n\n      for(i=0; i<nToken; i++){\n        TermOffset *pT = &sCtx.aTerm[i];\n        if( pT->pList && (pT->iPos-pT->iOff)<iMinPos ){\n          iMinPos = pT->iPos-pT->iOff;\n          pTerm = pT;\n        }\n      }\n\n      if( !pTerm ){\n        /* All offsets for this column have been gathered. */\n        rc = SQLITE_DONE;\n      }else{\n        assert( iCurrent<=iMinPos );\n        if( 0==(0xFE&*pTerm->pList) ){\n          pTerm->pList = 0;\n        }else{\n          fts3GetDeltaPosition(&pTerm->pList, &pTerm->iPos);\n        }\n        while( rc==SQLITE_OK && iCurrent<iMinPos ){\n          rc = pMod->xNext(pC, &ZDUMMY, &NDUMMY, &iStart, &iEnd, &iCurrent);\n        }\n        if( rc==SQLITE_OK ){\n          char aBuffer[64];\n          sqlite3_snprintf(sizeof(aBuffer), aBuffer, \n              \"%d %d %d %d \", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart\n          );\n          rc = fts3StringAppend(&res, aBuffer, -1);\n        }else if( rc==SQLITE_DONE && pTab->zContentTbl==0 ){\n          rc = FTS_CORRUPT_VTAB;\n        }\n      }\n    }\n    if( rc==SQLITE_DONE ){\n      rc = SQLITE_OK;\n    }\n\n    pMod->xClose(pC);\n    if( rc!=SQLITE_OK ) goto offsets_out;\n  }\n\n offsets_out:\n  sqlite3_free(sCtx.aTerm);\n  assert( rc!=SQLITE_DONE );\n  sqlite3Fts3SegmentsClose(pTab);\n  if( rc!=SQLITE_OK ){\n    sqlite3_result_error_code(pCtx,  rc);\n    sqlite3_free(res.z);\n  }else{\n    sqlite3_result_text(pCtx, res.z, res.n-1, sqlite3_free);\n  }\n  return;\n}\n\n/*\n** Implementation of matchinfo() function.\n*/\nvoid sqlite3Fts3Matchinfo(\n  sqlite3_context *pContext,      /* Function call context */\n  Fts3Cursor *pCsr,               /* FTS3 table cursor */\n  const char *zArg                /* Second arg to matchinfo() function */\n){\n  Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;\n  const char *zFormat;\n\n  if( zArg ){\n    zFormat = zArg;\n  }else{\n    zFormat = FTS3_MATCHINFO_DEFAULT;\n  }\n\n  if( !pCsr->pExpr ){\n    sqlite3_result_blob(pContext, \"\", 0, SQLITE_STATIC);\n    return;\n  }else{\n    /* Retrieve matchinfo() data. */\n    fts3GetMatchinfo(pContext, pCsr, zFormat);\n    sqlite3Fts3SegmentsClose(pTab);\n  }\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_tokenize_vtab.c",
    "content": "/*\n** 2013 Apr 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains code for the \"fts3tokenize\" virtual table module.\n** An fts3tokenize virtual table is created as follows:\n**\n**   CREATE VIRTUAL TABLE <tbl> USING fts3tokenize(\n**       <tokenizer-name>, <arg-1>, ...\n**   );\n**\n** The table created has the following schema:\n**\n**   CREATE TABLE <tbl>(input, token, start, end, position)\n**\n** When queried, the query must include a WHERE clause of type:\n**\n**   input = <string>\n**\n** The virtual table module tokenizes this <string>, using the FTS3 \n** tokenizer specified by the arguments to the CREATE VIRTUAL TABLE \n** statement and returns one row for each token in the result. With\n** fields set as follows:\n**\n**   input:   Always set to a copy of <string>\n**   token:   A token from the input.\n**   start:   Byte offset of the token within the input <string>.\n**   end:     Byte offset of the byte immediately following the end of the\n**            token within the input string.\n**   pos:     Token offset of token within input.\n**\n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <string.h>\n#include <assert.h>\n\ntypedef struct Fts3tokTable Fts3tokTable;\ntypedef struct Fts3tokCursor Fts3tokCursor;\n\n/*\n** Virtual table structure.\n*/\nstruct Fts3tokTable {\n  sqlite3_vtab base;              /* Base class used by SQLite core */\n  const sqlite3_tokenizer_module *pMod;\n  sqlite3_tokenizer *pTok;\n};\n\n/*\n** Virtual table cursor structure.\n*/\nstruct Fts3tokCursor {\n  sqlite3_vtab_cursor base;       /* Base class used by SQLite core */\n  char *zInput;                   /* Input string */\n  sqlite3_tokenizer_cursor *pCsr; /* Cursor to iterate through zInput */\n  int iRowid;                     /* Current 'rowid' value */\n  const char *zToken;             /* Current 'token' value */\n  int nToken;                     /* Size of zToken in bytes */\n  int iStart;                     /* Current 'start' value */\n  int iEnd;                       /* Current 'end' value */\n  int iPos;                       /* Current 'pos' value */\n};\n\n/*\n** Query FTS for the tokenizer implementation named zName.\n*/\nstatic int fts3tokQueryTokenizer(\n  Fts3Hash *pHash,\n  const char *zName,\n  const sqlite3_tokenizer_module **pp,\n  char **pzErr\n){\n  sqlite3_tokenizer_module *p;\n  int nName = (int)strlen(zName);\n\n  p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1);\n  if( !p ){\n    sqlite3Fts3ErrMsg(pzErr, \"unknown tokenizer: %s\", zName);\n    return SQLITE_ERROR;\n  }\n\n  *pp = p;\n  return SQLITE_OK;\n}\n\n/*\n** The second argument, argv[], is an array of pointers to nul-terminated\n** strings. This function makes a copy of the array and strings into a \n** single block of memory. It then dequotes any of the strings that appear\n** to be quoted.\n**\n** If successful, output parameter *pazDequote is set to point at the\n** array of dequoted strings and SQLITE_OK is returned. The caller is\n** responsible for eventually calling sqlite3_free() to free the array\n** in this case. Or, if an error occurs, an SQLite error code is returned.\n** The final value of *pazDequote is undefined in this case.\n*/\nstatic int fts3tokDequoteArray(\n  int argc,                       /* Number of elements in argv[] */\n  const char * const *argv,       /* Input array */\n  char ***pazDequote              /* Output array */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  if( argc==0 ){\n    *pazDequote = 0;\n  }else{\n    int i;\n    int nByte = 0;\n    char **azDequote;\n\n    for(i=0; i<argc; i++){\n      nByte += (int)(strlen(argv[i]) + 1);\n    }\n\n    *pazDequote = azDequote = sqlite3_malloc(sizeof(char *)*argc + nByte);\n    if( azDequote==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      char *pSpace = (char *)&azDequote[argc];\n      for(i=0; i<argc; i++){\n        int n = (int)strlen(argv[i]);\n        azDequote[i] = pSpace;\n        memcpy(pSpace, argv[i], n+1);\n        sqlite3Fts3Dequote(pSpace);\n        pSpace += (n+1);\n      }\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Schema of the tokenizer table.\n*/\n#define FTS3_TOK_SCHEMA \"CREATE TABLE x(input, token, start, end, position)\"\n\n/*\n** This function does all the work for both the xConnect and xCreate methods.\n** These tables have no persistent representation of their own, so xConnect\n** and xCreate are identical operations.\n**\n**   argv[0]: module name\n**   argv[1]: database name \n**   argv[2]: table name\n**   argv[3]: first argument (tokenizer name)\n*/\nstatic int fts3tokConnectMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pHash,                    /* Hash table of tokenizers */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  Fts3tokTable *pTab = 0;\n  const sqlite3_tokenizer_module *pMod = 0;\n  sqlite3_tokenizer *pTok = 0;\n  int rc;\n  char **azDequote = 0;\n  int nDequote;\n\n  rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA);\n  if( rc!=SQLITE_OK ) return rc;\n\n  nDequote = argc-3;\n  rc = fts3tokDequoteArray(nDequote, &argv[3], &azDequote);\n\n  if( rc==SQLITE_OK ){\n    const char *zModule;\n    if( nDequote<1 ){\n      zModule = \"simple\";\n    }else{\n      zModule = azDequote[0];\n    }\n    rc = fts3tokQueryTokenizer((Fts3Hash*)pHash, zModule, &pMod, pzErr);\n  }\n\n  assert( (rc==SQLITE_OK)==(pMod!=0) );\n  if( rc==SQLITE_OK ){\n    const char * const *azArg = (const char * const *)&azDequote[1];\n    rc = pMod->xCreate((nDequote>1 ? nDequote-1 : 0), azArg, &pTok);\n  }\n\n  if( rc==SQLITE_OK ){\n    pTab = (Fts3tokTable *)sqlite3_malloc(sizeof(Fts3tokTable));\n    if( pTab==0 ){\n      rc = SQLITE_NOMEM;\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    memset(pTab, 0, sizeof(Fts3tokTable));\n    pTab->pMod = pMod;\n    pTab->pTok = pTok;\n    *ppVtab = &pTab->base;\n  }else{\n    if( pTok ){\n      pMod->xDestroy(pTok);\n    }\n  }\n\n  sqlite3_free(azDequote);\n  return rc;\n}\n\n/*\n** This function does the work for both the xDisconnect and xDestroy methods.\n** These tables have no persistent representation of their own, so xDisconnect\n** and xDestroy are identical operations.\n*/\nstatic int fts3tokDisconnectMethod(sqlite3_vtab *pVtab){\n  Fts3tokTable *pTab = (Fts3tokTable *)pVtab;\n\n  pTab->pMod->xDestroy(pTab->pTok);\n  sqlite3_free(pTab);\n  return SQLITE_OK;\n}\n\n/*\n** xBestIndex - Analyze a WHERE and ORDER BY clause.\n*/\nstatic int fts3tokBestIndexMethod(\n  sqlite3_vtab *pVTab, \n  sqlite3_index_info *pInfo\n){\n  int i;\n  UNUSED_PARAMETER(pVTab);\n\n  for(i=0; i<pInfo->nConstraint; i++){\n    if( pInfo->aConstraint[i].usable \n     && pInfo->aConstraint[i].iColumn==0 \n     && pInfo->aConstraint[i].op==SQLITE_INDEX_CONSTRAINT_EQ \n    ){\n      pInfo->idxNum = 1;\n      pInfo->aConstraintUsage[i].argvIndex = 1;\n      pInfo->aConstraintUsage[i].omit = 1;\n      pInfo->estimatedCost = 1;\n      return SQLITE_OK;\n    }\n  }\n\n  pInfo->idxNum = 0;\n  assert( pInfo->estimatedCost>1000000.0 );\n\n  return SQLITE_OK;\n}\n\n/*\n** xOpen - Open a cursor.\n*/\nstatic int fts3tokOpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){\n  Fts3tokCursor *pCsr;\n  UNUSED_PARAMETER(pVTab);\n\n  pCsr = (Fts3tokCursor *)sqlite3_malloc(sizeof(Fts3tokCursor));\n  if( pCsr==0 ){\n    return SQLITE_NOMEM;\n  }\n  memset(pCsr, 0, sizeof(Fts3tokCursor));\n\n  *ppCsr = (sqlite3_vtab_cursor *)pCsr;\n  return SQLITE_OK;\n}\n\n/*\n** Reset the tokenizer cursor passed as the only argument. As if it had\n** just been returned by fts3tokOpenMethod().\n*/\nstatic void fts3tokResetCursor(Fts3tokCursor *pCsr){\n  if( pCsr->pCsr ){\n    Fts3tokTable *pTab = (Fts3tokTable *)(pCsr->base.pVtab);\n    pTab->pMod->xClose(pCsr->pCsr);\n    pCsr->pCsr = 0;\n  }\n  sqlite3_free(pCsr->zInput);\n  pCsr->zInput = 0;\n  pCsr->zToken = 0;\n  pCsr->nToken = 0;\n  pCsr->iStart = 0;\n  pCsr->iEnd = 0;\n  pCsr->iPos = 0;\n  pCsr->iRowid = 0;\n}\n\n/*\n** xClose - Close a cursor.\n*/\nstatic int fts3tokCloseMethod(sqlite3_vtab_cursor *pCursor){\n  Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor;\n\n  fts3tokResetCursor(pCsr);\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\n/*\n** xNext - Advance the cursor to the next row, if any.\n*/\nstatic int fts3tokNextMethod(sqlite3_vtab_cursor *pCursor){\n  Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor;\n  Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab);\n  int rc;                         /* Return code */\n\n  pCsr->iRowid++;\n  rc = pTab->pMod->xNext(pCsr->pCsr,\n      &pCsr->zToken, &pCsr->nToken,\n      &pCsr->iStart, &pCsr->iEnd, &pCsr->iPos\n  );\n\n  if( rc!=SQLITE_OK ){\n    fts3tokResetCursor(pCsr);\n    if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n  }\n\n  return rc;\n}\n\n/*\n** xFilter - Initialize a cursor to point at the start of its data.\n*/\nstatic int fts3tokFilterMethod(\n  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */\n  int idxNum,                     /* Strategy index */\n  const char *idxStr,             /* Unused */\n  int nVal,                       /* Number of elements in apVal */\n  sqlite3_value **apVal           /* Arguments for the indexing scheme */\n){\n  int rc = SQLITE_ERROR;\n  Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor;\n  Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab);\n  UNUSED_PARAMETER(idxStr);\n  UNUSED_PARAMETER(nVal);\n\n  fts3tokResetCursor(pCsr);\n  if( idxNum==1 ){\n    const char *zByte = (const char *)sqlite3_value_text(apVal[0]);\n    int nByte = sqlite3_value_bytes(apVal[0]);\n    pCsr->zInput = sqlite3_malloc(nByte+1);\n    if( pCsr->zInput==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      memcpy(pCsr->zInput, zByte, nByte);\n      pCsr->zInput[nByte] = 0;\n      rc = pTab->pMod->xOpen(pTab->pTok, pCsr->zInput, nByte, &pCsr->pCsr);\n      if( rc==SQLITE_OK ){\n        pCsr->pCsr->pTokenizer = pTab->pTok;\n      }\n    }\n  }\n\n  if( rc!=SQLITE_OK ) return rc;\n  return fts3tokNextMethod(pCursor);\n}\n\n/*\n** xEof - Return true if the cursor is at EOF, or false otherwise.\n*/\nstatic int fts3tokEofMethod(sqlite3_vtab_cursor *pCursor){\n  Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor;\n  return (pCsr->zToken==0);\n}\n\n/*\n** xColumn - Return a column value.\n*/\nstatic int fts3tokColumnMethod(\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\n  sqlite3_context *pCtx,          /* Context for sqlite3_result_xxx() calls */\n  int iCol                        /* Index of column to read value from */\n){\n  Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor;\n\n  /* CREATE TABLE x(input, token, start, end, position) */\n  switch( iCol ){\n    case 0:\n      sqlite3_result_text(pCtx, pCsr->zInput, -1, SQLITE_TRANSIENT);\n      break;\n    case 1:\n      sqlite3_result_text(pCtx, pCsr->zToken, pCsr->nToken, SQLITE_TRANSIENT);\n      break;\n    case 2:\n      sqlite3_result_int(pCtx, pCsr->iStart);\n      break;\n    case 3:\n      sqlite3_result_int(pCtx, pCsr->iEnd);\n      break;\n    default:\n      assert( iCol==4 );\n      sqlite3_result_int(pCtx, pCsr->iPos);\n      break;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** xRowid - Return the current rowid for the cursor.\n*/\nstatic int fts3tokRowidMethod(\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\n  sqlite_int64 *pRowid            /* OUT: Rowid value */\n){\n  Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor;\n  *pRowid = (sqlite3_int64)pCsr->iRowid;\n  return SQLITE_OK;\n}\n\n/*\n** Register the fts3tok module with database connection db. Return SQLITE_OK\n** if successful or an error code if sqlite3_create_module() fails.\n*/\nint sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){\n  static const sqlite3_module fts3tok_module = {\n     0,                           /* iVersion      */\n     fts3tokConnectMethod,        /* xCreate       */\n     fts3tokConnectMethod,        /* xConnect      */\n     fts3tokBestIndexMethod,      /* xBestIndex    */\n     fts3tokDisconnectMethod,     /* xDisconnect   */\n     fts3tokDisconnectMethod,     /* xDestroy      */\n     fts3tokOpenMethod,           /* xOpen         */\n     fts3tokCloseMethod,          /* xClose        */\n     fts3tokFilterMethod,         /* xFilter       */\n     fts3tokNextMethod,           /* xNext         */\n     fts3tokEofMethod,            /* xEof          */\n     fts3tokColumnMethod,         /* xColumn       */\n     fts3tokRowidMethod,          /* xRowid        */\n     0,                           /* xUpdate       */\n     0,                           /* xBegin        */\n     0,                           /* xSync         */\n     0,                           /* xCommit       */\n     0,                           /* xRollback     */\n     0,                           /* xFindFunction */\n     0,                           /* xRename       */\n     0,                           /* xSavepoint    */\n     0,                           /* xRelease      */\n     0                            /* xRollbackTo   */\n  };\n  int rc;                         /* Return code */\n\n  rc = sqlite3_create_module(db, \"fts3tokenize\", &fts3tok_module, (void*)pHash);\n  return rc;\n}\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_tokenizer.c",
    "content": "/*\n** 2007 June 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This is part of an SQLite module implementing full-text search.\n** This particular file implements the generic tokenizer interface.\n*/\n\n/*\n** The code in this file is only compiled if:\n**\n**     * The FTS3 module is being built as an extension\n**       (in which case SQLITE_CORE is not defined), or\n**\n**     * The FTS3 module is being built into the core of\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <assert.h>\n#include <string.h>\n\n/*\n** Return true if the two-argument version of fts3_tokenizer()\n** has been activated via a prior call to sqlite3_db_config(db,\n** SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, 0);\n*/\nstatic int fts3TokenizerEnabled(sqlite3_context *context){\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  int isEnabled = 0;\n  sqlite3_db_config(db,SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,-1,&isEnabled);\n  return isEnabled;\n}\n\n/*\n** Implementation of the SQL scalar function for accessing the underlying \n** hash table. This function may be called as follows:\n**\n**   SELECT <function-name>(<key-name>);\n**   SELECT <function-name>(<key-name>, <pointer>);\n**\n** where <function-name> is the name passed as the second argument\n** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer').\n**\n** If the <pointer> argument is specified, it must be a blob value\n** containing a pointer to be stored as the hash data corresponding\n** to the string <key-name>. If <pointer> is not specified, then\n** the string <key-name> must already exist in the has table. Otherwise,\n** an error is returned.\n**\n** Whether or not the <pointer> argument is specified, the value returned\n** is a blob containing the pointer stored as the hash data corresponding\n** to string <key-name> (after the hash-table is updated, if applicable).\n*/\nstatic void fts3TokenizerFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  Fts3Hash *pHash;\n  void *pPtr = 0;\n  const unsigned char *zName;\n  int nName;\n\n  assert( argc==1 || argc==2 );\n\n  pHash = (Fts3Hash *)sqlite3_user_data(context);\n\n  zName = sqlite3_value_text(argv[0]);\n  nName = sqlite3_value_bytes(argv[0])+1;\n\n  if( argc==2 ){\n    if( fts3TokenizerEnabled(context) ){\n      void *pOld;\n      int n = sqlite3_value_bytes(argv[1]);\n      if( zName==0 || n!=sizeof(pPtr) ){\n        sqlite3_result_error(context, \"argument type mismatch\", -1);\n        return;\n      }\n      pPtr = *(void **)sqlite3_value_blob(argv[1]);\n      pOld = sqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr);\n      if( pOld==pPtr ){\n        sqlite3_result_error(context, \"out of memory\", -1);\n      }\n    }else{\n      sqlite3_result_error(context, \"fts3tokenize disabled\", -1);\n      return;\n    }\n  }else{\n    if( zName ){\n      pPtr = sqlite3Fts3HashFind(pHash, zName, nName);\n    }\n    if( !pPtr ){\n      char *zErr = sqlite3_mprintf(\"unknown tokenizer: %s\", zName);\n      sqlite3_result_error(context, zErr, -1);\n      sqlite3_free(zErr);\n      return;\n    }\n  }\n  sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT);\n}\n\nint sqlite3Fts3IsIdChar(char c){\n  static const char isFtsIdChar[] = {\n      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 0x */\n      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 1x */\n      0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 2x */\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */\n      0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */\n      0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */\n      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */\n  };\n  return (c&0x80 || isFtsIdChar[(int)(c)]);\n}\n\nconst char *sqlite3Fts3NextToken(const char *zStr, int *pn){\n  const char *z1;\n  const char *z2 = 0;\n\n  /* Find the start of the next token. */\n  z1 = zStr;\n  while( z2==0 ){\n    char c = *z1;\n    switch( c ){\n      case '\\0': return 0;        /* No more tokens here */\n      case '\\'':\n      case '\"':\n      case '`': {\n        z2 = z1;\n        while( *++z2 && (*z2!=c || *++z2==c) );\n        break;\n      }\n      case '[':\n        z2 = &z1[1];\n        while( *z2 && z2[0]!=']' ) z2++;\n        if( *z2 ) z2++;\n        break;\n\n      default:\n        if( sqlite3Fts3IsIdChar(*z1) ){\n          z2 = &z1[1];\n          while( sqlite3Fts3IsIdChar(*z2) ) z2++;\n        }else{\n          z1++;\n        }\n    }\n  }\n\n  *pn = (int)(z2-z1);\n  return z1;\n}\n\nint sqlite3Fts3InitTokenizer(\n  Fts3Hash *pHash,                /* Tokenizer hash table */\n  const char *zArg,               /* Tokenizer name */\n  sqlite3_tokenizer **ppTok,      /* OUT: Tokenizer (if applicable) */\n  char **pzErr                    /* OUT: Set to malloced error message */\n){\n  int rc;\n  char *z = (char *)zArg;\n  int n = 0;\n  char *zCopy;\n  char *zEnd;                     /* Pointer to nul-term of zCopy */\n  sqlite3_tokenizer_module *m;\n\n  zCopy = sqlite3_mprintf(\"%s\", zArg);\n  if( !zCopy ) return SQLITE_NOMEM;\n  zEnd = &zCopy[strlen(zCopy)];\n\n  z = (char *)sqlite3Fts3NextToken(zCopy, &n);\n  if( z==0 ){\n    assert( n==0 );\n    z = zCopy;\n  }\n  z[n] = '\\0';\n  sqlite3Fts3Dequote(z);\n\n  m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash,z,(int)strlen(z)+1);\n  if( !m ){\n    sqlite3Fts3ErrMsg(pzErr, \"unknown tokenizer: %s\", z);\n    rc = SQLITE_ERROR;\n  }else{\n    char const **aArg = 0;\n    int iArg = 0;\n    z = &z[n+1];\n    while( z<zEnd && (NULL!=(z = (char *)sqlite3Fts3NextToken(z, &n))) ){\n      int nNew = sizeof(char *)*(iArg+1);\n      char const **aNew = (const char **)sqlite3_realloc((void *)aArg, nNew);\n      if( !aNew ){\n        sqlite3_free(zCopy);\n        sqlite3_free((void *)aArg);\n        return SQLITE_NOMEM;\n      }\n      aArg = aNew;\n      aArg[iArg++] = z;\n      z[n] = '\\0';\n      sqlite3Fts3Dequote(z);\n      z = &z[n+1];\n    }\n    rc = m->xCreate(iArg, aArg, ppTok);\n    assert( rc!=SQLITE_OK || *ppTok );\n    if( rc!=SQLITE_OK ){\n      sqlite3Fts3ErrMsg(pzErr, \"unknown tokenizer\");\n    }else{\n      (*ppTok)->pModule = m; \n    }\n    sqlite3_free((void *)aArg);\n  }\n\n  sqlite3_free(zCopy);\n  return rc;\n}\n\n\n#ifdef SQLITE_TEST\n\n#if defined(INCLUDE_SQLITE_TCL_H)\n#  include \"sqlite_tcl.h\"\n#else\n#  include \"tcl.h\"\n#endif\n#include <string.h>\n\n/*\n** Implementation of a special SQL scalar function for testing tokenizers \n** designed to be used in concert with the Tcl testing framework. This\n** function must be called with two or more arguments:\n**\n**   SELECT <function-name>(<key-name>, ..., <input-string>);\n**\n** where <function-name> is the name passed as the second argument\n** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer')\n** concatenated with the string '_test' (e.g. 'fts3_tokenizer_test').\n**\n** The return value is a string that may be interpreted as a Tcl\n** list. For each token in the <input-string>, three elements are\n** added to the returned list. The first is the token position, the \n** second is the token text (folded, stemmed, etc.) and the third is the\n** substring of <input-string> associated with the token. For example, \n** using the built-in \"simple\" tokenizer:\n**\n**   SELECT fts_tokenizer_test('simple', 'I don't see how');\n**\n** will return the string:\n**\n**   \"{0 i I 1 dont don't 2 see see 3 how how}\"\n**   \n*/\nstatic void testFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  Fts3Hash *pHash;\n  sqlite3_tokenizer_module *p;\n  sqlite3_tokenizer *pTokenizer = 0;\n  sqlite3_tokenizer_cursor *pCsr = 0;\n\n  const char *zErr = 0;\n\n  const char *zName;\n  int nName;\n  const char *zInput;\n  int nInput;\n\n  const char *azArg[64];\n\n  const char *zToken;\n  int nToken = 0;\n  int iStart = 0;\n  int iEnd = 0;\n  int iPos = 0;\n  int i;\n\n  Tcl_Obj *pRet;\n\n  if( argc<2 ){\n    sqlite3_result_error(context, \"insufficient arguments\", -1);\n    return;\n  }\n\n  nName = sqlite3_value_bytes(argv[0]);\n  zName = (const char *)sqlite3_value_text(argv[0]);\n  nInput = sqlite3_value_bytes(argv[argc-1]);\n  zInput = (const char *)sqlite3_value_text(argv[argc-1]);\n\n  pHash = (Fts3Hash *)sqlite3_user_data(context);\n  p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1);\n\n  if( !p ){\n    char *zErr2 = sqlite3_mprintf(\"unknown tokenizer: %s\", zName);\n    sqlite3_result_error(context, zErr2, -1);\n    sqlite3_free(zErr2);\n    return;\n  }\n\n  pRet = Tcl_NewObj();\n  Tcl_IncrRefCount(pRet);\n\n  for(i=1; i<argc-1; i++){\n    azArg[i-1] = (const char *)sqlite3_value_text(argv[i]);\n  }\n\n  if( SQLITE_OK!=p->xCreate(argc-2, azArg, &pTokenizer) ){\n    zErr = \"error in xCreate()\";\n    goto finish;\n  }\n  pTokenizer->pModule = p;\n  if( sqlite3Fts3OpenTokenizer(pTokenizer, 0, zInput, nInput, &pCsr) ){\n    zErr = \"error in xOpen()\";\n    goto finish;\n  }\n\n  while( SQLITE_OK==p->xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos) ){\n    Tcl_ListObjAppendElement(0, pRet, Tcl_NewIntObj(iPos));\n    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));\n    zToken = &zInput[iStart];\n    nToken = iEnd-iStart;\n    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));\n  }\n\n  if( SQLITE_OK!=p->xClose(pCsr) ){\n    zErr = \"error in xClose()\";\n    goto finish;\n  }\n  if( SQLITE_OK!=p->xDestroy(pTokenizer) ){\n    zErr = \"error in xDestroy()\";\n    goto finish;\n  }\n\nfinish:\n  if( zErr ){\n    sqlite3_result_error(context, zErr, -1);\n  }else{\n    sqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT);\n  }\n  Tcl_DecrRefCount(pRet);\n}\n\nstatic\nint registerTokenizer(\n  sqlite3 *db, \n  char *zName, \n  const sqlite3_tokenizer_module *p\n){\n  int rc;\n  sqlite3_stmt *pStmt;\n  const char zSql[] = \"SELECT fts3_tokenizer(?, ?)\";\n\n  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);\n  sqlite3_bind_blob(pStmt, 2, &p, sizeof(p), SQLITE_STATIC);\n  sqlite3_step(pStmt);\n\n  return sqlite3_finalize(pStmt);\n}\n\n\nstatic\nint queryTokenizer(\n  sqlite3 *db, \n  char *zName,  \n  const sqlite3_tokenizer_module **pp\n){\n  int rc;\n  sqlite3_stmt *pStmt;\n  const char zSql[] = \"SELECT fts3_tokenizer(?)\";\n\n  *pp = 0;\n  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);\n  if( SQLITE_ROW==sqlite3_step(pStmt) ){\n    if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){\n      memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));\n    }\n  }\n\n  return sqlite3_finalize(pStmt);\n}\n\nvoid sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);\n\n/*\n** Implementation of the scalar function fts3_tokenizer_internal_test().\n** This function is used for testing only, it is not included in the\n** build unless SQLITE_TEST is defined.\n**\n** The purpose of this is to test that the fts3_tokenizer() function\n** can be used as designed by the C-code in the queryTokenizer and\n** registerTokenizer() functions above. These two functions are repeated\n** in the README.tokenizer file as an example, so it is important to\n** test them.\n**\n** To run the tests, evaluate the fts3_tokenizer_internal_test() scalar\n** function with no arguments. An assert() will fail if a problem is\n** detected. i.e.:\n**\n**     SELECT fts3_tokenizer_internal_test();\n**\n*/\nstatic void intTestFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  int rc;\n  const sqlite3_tokenizer_module *p1;\n  const sqlite3_tokenizer_module *p2;\n  sqlite3 *db = (sqlite3 *)sqlite3_user_data(context);\n\n  UNUSED_PARAMETER(argc);\n  UNUSED_PARAMETER(argv);\n\n  /* Test the query function */\n  sqlite3Fts3SimpleTokenizerModule(&p1);\n  rc = queryTokenizer(db, \"simple\", &p2);\n  assert( rc==SQLITE_OK );\n  assert( p1==p2 );\n  rc = queryTokenizer(db, \"nosuchtokenizer\", &p2);\n  assert( rc==SQLITE_ERROR );\n  assert( p2==0 );\n  assert( 0==strcmp(sqlite3_errmsg(db), \"unknown tokenizer: nosuchtokenizer\") );\n\n  /* Test the storage function */\n  if( fts3TokenizerEnabled(context) ){\n    rc = registerTokenizer(db, \"nosuchtokenizer\", p1);\n    assert( rc==SQLITE_OK );\n    rc = queryTokenizer(db, \"nosuchtokenizer\", &p2);\n    assert( rc==SQLITE_OK );\n    assert( p2==p1 );\n  }\n\n  sqlite3_result_text(context, \"ok\", -1, SQLITE_STATIC);\n}\n\n#endif\n\n/*\n** Set up SQL objects in database db used to access the contents of\n** the hash table pointed to by argument pHash. The hash table must\n** been initialized to use string keys, and to take a private copy \n** of the key when a value is inserted. i.e. by a call similar to:\n**\n**    sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);\n**\n** This function adds a scalar function (see header comment above\n** fts3TokenizerFunc() in this file for details) and, if ENABLE_TABLE is\n** defined at compilation time, a temporary virtual table (see header \n** comment above struct HashTableVtab) to the database schema. Both \n** provide read/write access to the contents of *pHash.\n**\n** The third argument to this function, zName, is used as the name\n** of both the scalar and, if created, the virtual table.\n*/\nint sqlite3Fts3InitHashTable(\n  sqlite3 *db, \n  Fts3Hash *pHash, \n  const char *zName\n){\n  int rc = SQLITE_OK;\n  void *p = (void *)pHash;\n  const int any = SQLITE_ANY;\n\n#ifdef SQLITE_TEST\n  char *zTest = 0;\n  char *zTest2 = 0;\n  void *pdb = (void *)db;\n  zTest = sqlite3_mprintf(\"%s_test\", zName);\n  zTest2 = sqlite3_mprintf(\"%s_internal_test\", zName);\n  if( !zTest || !zTest2 ){\n    rc = SQLITE_NOMEM;\n  }\n#endif\n\n  if( SQLITE_OK==rc ){\n    rc = sqlite3_create_function(db, zName, 1, any, p, fts3TokenizerFunc, 0, 0);\n  }\n  if( SQLITE_OK==rc ){\n    rc = sqlite3_create_function(db, zName, 2, any, p, fts3TokenizerFunc, 0, 0);\n  }\n#ifdef SQLITE_TEST\n  if( SQLITE_OK==rc ){\n    rc = sqlite3_create_function(db, zTest, -1, any, p, testFunc, 0, 0);\n  }\n  if( SQLITE_OK==rc ){\n    rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0);\n  }\n#endif\n\n#ifdef SQLITE_TEST\n  sqlite3_free(zTest);\n  sqlite3_free(zTest2);\n#endif\n\n  return rc;\n}\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_tokenizer.h",
    "content": "/*\n** 2006 July 10\n**\n** The author disclaims copyright to this source code.\n**\n*************************************************************************\n** Defines the interface to tokenizers used by fulltext-search.  There\n** are three basic components:\n**\n** sqlite3_tokenizer_module is a singleton defining the tokenizer\n** interface functions.  This is essentially the class structure for\n** tokenizers.\n**\n** sqlite3_tokenizer is used to define a particular tokenizer, perhaps\n** including customization information defined at creation time.\n**\n** sqlite3_tokenizer_cursor is generated by a tokenizer to generate\n** tokens from a particular input.\n*/\n#ifndef _FTS3_TOKENIZER_H_\n#define _FTS3_TOKENIZER_H_\n\n/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.\n** If tokenizers are to be allowed to call sqlite3_*() functions, then\n** we will need a way to register the API consistently.\n*/\n#include \"sqlite3.h\"\n\n/*\n** Structures used by the tokenizer interface. When a new tokenizer\n** implementation is registered, the caller provides a pointer to\n** an sqlite3_tokenizer_module containing pointers to the callback\n** functions that make up an implementation.\n**\n** When an fts3 table is created, it passes any arguments passed to\n** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the\n** sqlite3_tokenizer_module.xCreate() function of the requested tokenizer\n** implementation. The xCreate() function in turn returns an \n** sqlite3_tokenizer structure representing the specific tokenizer to\n** be used for the fts3 table (customized by the tokenizer clause arguments).\n**\n** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen()\n** method is called. It returns an sqlite3_tokenizer_cursor object\n** that may be used to tokenize a specific input buffer based on\n** the tokenization rules supplied by a specific sqlite3_tokenizer\n** object.\n*/\ntypedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module;\ntypedef struct sqlite3_tokenizer sqlite3_tokenizer;\ntypedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor;\n\nstruct sqlite3_tokenizer_module {\n\n  /*\n  ** Structure version. Should always be set to 0 or 1.\n  */\n  int iVersion;\n\n  /*\n  ** Create a new tokenizer. The values in the argv[] array are the\n  ** arguments passed to the \"tokenizer\" clause of the CREATE VIRTUAL\n  ** TABLE statement that created the fts3 table. For example, if\n  ** the following SQL is executed:\n  **\n  **   CREATE .. USING fts3( ... , tokenizer <tokenizer-name> arg1 arg2)\n  **\n  ** then argc is set to 2, and the argv[] array contains pointers\n  ** to the strings \"arg1\" and \"arg2\".\n  **\n  ** This method should return either SQLITE_OK (0), or an SQLite error \n  ** code. If SQLITE_OK is returned, then *ppTokenizer should be set\n  ** to point at the newly created tokenizer structure. The generic\n  ** sqlite3_tokenizer.pModule variable should not be initialized by\n  ** this callback. The caller will do so.\n  */\n  int (*xCreate)(\n    int argc,                           /* Size of argv array */\n    const char *const*argv,             /* Tokenizer argument strings */\n    sqlite3_tokenizer **ppTokenizer     /* OUT: Created tokenizer */\n  );\n\n  /*\n  ** Destroy an existing tokenizer. The fts3 module calls this method\n  ** exactly once for each successful call to xCreate().\n  */\n  int (*xDestroy)(sqlite3_tokenizer *pTokenizer);\n\n  /*\n  ** Create a tokenizer cursor to tokenize an input buffer. The caller\n  ** is responsible for ensuring that the input buffer remains valid\n  ** until the cursor is closed (using the xClose() method). \n  */\n  int (*xOpen)(\n    sqlite3_tokenizer *pTokenizer,       /* Tokenizer object */\n    const char *pInput, int nBytes,      /* Input buffer */\n    sqlite3_tokenizer_cursor **ppCursor  /* OUT: Created tokenizer cursor */\n  );\n\n  /*\n  ** Destroy an existing tokenizer cursor. The fts3 module calls this \n  ** method exactly once for each successful call to xOpen().\n  */\n  int (*xClose)(sqlite3_tokenizer_cursor *pCursor);\n\n  /*\n  ** Retrieve the next token from the tokenizer cursor pCursor. This\n  ** method should either return SQLITE_OK and set the values of the\n  ** \"OUT\" variables identified below, or SQLITE_DONE to indicate that\n  ** the end of the buffer has been reached, or an SQLite error code.\n  **\n  ** *ppToken should be set to point at a buffer containing the \n  ** normalized version of the token (i.e. after any case-folding and/or\n  ** stemming has been performed). *pnBytes should be set to the length\n  ** of this buffer in bytes. The input text that generated the token is\n  ** identified by the byte offsets returned in *piStartOffset and\n  ** *piEndOffset. *piStartOffset should be set to the index of the first\n  ** byte of the token in the input buffer. *piEndOffset should be set\n  ** to the index of the first byte just past the end of the token in\n  ** the input buffer.\n  **\n  ** The buffer *ppToken is set to point at is managed by the tokenizer\n  ** implementation. It is only required to be valid until the next call\n  ** to xNext() or xClose(). \n  */\n  /* TODO(shess) current implementation requires pInput to be\n  ** nul-terminated.  This should either be fixed, or pInput/nBytes\n  ** should be converted to zInput.\n  */\n  int (*xNext)(\n    sqlite3_tokenizer_cursor *pCursor,   /* Tokenizer cursor */\n    const char **ppToken, int *pnBytes,  /* OUT: Normalized text for token */\n    int *piStartOffset,  /* OUT: Byte offset of token in input buffer */\n    int *piEndOffset,    /* OUT: Byte offset of end of token in input buffer */\n    int *piPosition      /* OUT: Number of tokens returned before this one */\n  );\n\n  /***********************************************************************\n  ** Methods below this point are only available if iVersion>=1.\n  */\n\n  /* \n  ** Configure the language id of a tokenizer cursor.\n  */\n  int (*xLanguageid)(sqlite3_tokenizer_cursor *pCsr, int iLangid);\n};\n\nstruct sqlite3_tokenizer {\n  const sqlite3_tokenizer_module *pModule;  /* The module for this tokenizer */\n  /* Tokenizer implementations will typically add additional fields */\n};\n\nstruct sqlite3_tokenizer_cursor {\n  sqlite3_tokenizer *pTokenizer;       /* Tokenizer for this cursor. */\n  /* Tokenizer implementations will typically add additional fields */\n};\n\nint fts3_global_term_cnt(int iTerm, int iCol);\nint fts3_term_cnt(int iTerm, int iCol);\n\n\n#endif /* _FTS3_TOKENIZER_H_ */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_tokenizer1.c",
    "content": "/*\n** 2006 Oct 10\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** Implementation of the \"simple\" full-text-search tokenizer.\n*/\n\n/*\n** The code in this file is only compiled if:\n**\n**     * The FTS3 module is being built as an extension\n**       (in which case SQLITE_CORE is not defined), or\n**\n**     * The FTS3 module is being built into the core of\n**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).\n*/\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <assert.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"fts3_tokenizer.h\"\n\ntypedef struct simple_tokenizer {\n  sqlite3_tokenizer base;\n  char delim[128];             /* flag ASCII delimiters */\n} simple_tokenizer;\n\ntypedef struct simple_tokenizer_cursor {\n  sqlite3_tokenizer_cursor base;\n  const char *pInput;          /* input we are tokenizing */\n  int nBytes;                  /* size of the input */\n  int iOffset;                 /* current position in pInput */\n  int iToken;                  /* index of next token to be returned */\n  char *pToken;                /* storage for current token */\n  int nTokenAllocated;         /* space allocated to zToken buffer */\n} simple_tokenizer_cursor;\n\n\nstatic int simpleDelim(simple_tokenizer *t, unsigned char c){\n  return c<0x80 && t->delim[c];\n}\nstatic int fts3_isalnum(int x){\n  return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');\n}\n\n/*\n** Create a new tokenizer instance.\n*/\nstatic int simpleCreate(\n  int argc, const char * const *argv,\n  sqlite3_tokenizer **ppTokenizer\n){\n  simple_tokenizer *t;\n\n  t = (simple_tokenizer *) sqlite3_malloc(sizeof(*t));\n  if( t==NULL ) return SQLITE_NOMEM;\n  memset(t, 0, sizeof(*t));\n\n  /* TODO(shess) Delimiters need to remain the same from run to run,\n  ** else we need to reindex.  One solution would be a meta-table to\n  ** track such information in the database, then we'd only want this\n  ** information on the initial create.\n  */\n  if( argc>1 ){\n    int i, n = (int)strlen(argv[1]);\n    for(i=0; i<n; i++){\n      unsigned char ch = argv[1][i];\n      /* We explicitly don't support UTF-8 delimiters for now. */\n      if( ch>=0x80 ){\n        sqlite3_free(t);\n        return SQLITE_ERROR;\n      }\n      t->delim[ch] = 1;\n    }\n  } else {\n    /* Mark non-alphanumeric ASCII characters as delimiters */\n    int i;\n    for(i=1; i<0x80; i++){\n      t->delim[i] = !fts3_isalnum(i) ? -1 : 0;\n    }\n  }\n\n  *ppTokenizer = &t->base;\n  return SQLITE_OK;\n}\n\n/*\n** Destroy a tokenizer\n*/\nstatic int simpleDestroy(sqlite3_tokenizer *pTokenizer){\n  sqlite3_free(pTokenizer);\n  return SQLITE_OK;\n}\n\n/*\n** Prepare to begin tokenizing a particular string.  The input\n** string to be tokenized is pInput[0..nBytes-1].  A cursor\n** used to incrementally tokenize this string is returned in \n** *ppCursor.\n*/\nstatic int simpleOpen(\n  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */\n  const char *pInput, int nBytes,        /* String to be tokenized */\n  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */\n){\n  simple_tokenizer_cursor *c;\n\n  UNUSED_PARAMETER(pTokenizer);\n\n  c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));\n  if( c==NULL ) return SQLITE_NOMEM;\n\n  c->pInput = pInput;\n  if( pInput==0 ){\n    c->nBytes = 0;\n  }else if( nBytes<0 ){\n    c->nBytes = (int)strlen(pInput);\n  }else{\n    c->nBytes = nBytes;\n  }\n  c->iOffset = 0;                 /* start tokenizing at the beginning */\n  c->iToken = 0;\n  c->pToken = NULL;               /* no space allocated, yet. */\n  c->nTokenAllocated = 0;\n\n  *ppCursor = &c->base;\n  return SQLITE_OK;\n}\n\n/*\n** Close a tokenization cursor previously opened by a call to\n** simpleOpen() above.\n*/\nstatic int simpleClose(sqlite3_tokenizer_cursor *pCursor){\n  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;\n  sqlite3_free(c->pToken);\n  sqlite3_free(c);\n  return SQLITE_OK;\n}\n\n/*\n** Extract the next token from a tokenization cursor.  The cursor must\n** have been opened by a prior call to simpleOpen().\n*/\nstatic int simpleNext(\n  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */\n  const char **ppToken,               /* OUT: *ppToken is the token text */\n  int *pnBytes,                       /* OUT: Number of bytes in token */\n  int *piStartOffset,                 /* OUT: Starting offset of token */\n  int *piEndOffset,                   /* OUT: Ending offset of token */\n  int *piPosition                     /* OUT: Position integer of token */\n){\n  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;\n  simple_tokenizer *t = (simple_tokenizer *) pCursor->pTokenizer;\n  unsigned char *p = (unsigned char *)c->pInput;\n\n  while( c->iOffset<c->nBytes ){\n    int iStartOffset;\n\n    /* Scan past delimiter characters */\n    while( c->iOffset<c->nBytes && simpleDelim(t, p[c->iOffset]) ){\n      c->iOffset++;\n    }\n\n    /* Count non-delimiter characters. */\n    iStartOffset = c->iOffset;\n    while( c->iOffset<c->nBytes && !simpleDelim(t, p[c->iOffset]) ){\n      c->iOffset++;\n    }\n\n    if( c->iOffset>iStartOffset ){\n      int i, n = c->iOffset-iStartOffset;\n      if( n>c->nTokenAllocated ){\n        char *pNew;\n        c->nTokenAllocated = n+20;\n        pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);\n        if( !pNew ) return SQLITE_NOMEM;\n        c->pToken = pNew;\n      }\n      for(i=0; i<n; i++){\n        /* TODO(shess) This needs expansion to handle UTF-8\n        ** case-insensitivity.\n        */\n        unsigned char ch = p[iStartOffset+i];\n        c->pToken[i] = (char)((ch>='A' && ch<='Z') ? ch-'A'+'a' : ch);\n      }\n      *ppToken = c->pToken;\n      *pnBytes = n;\n      *piStartOffset = iStartOffset;\n      *piEndOffset = c->iOffset;\n      *piPosition = c->iToken++;\n\n      return SQLITE_OK;\n    }\n  }\n  return SQLITE_DONE;\n}\n\n/*\n** The set of routines that implement the simple tokenizer\n*/\nstatic const sqlite3_tokenizer_module simpleTokenizerModule = {\n  0,\n  simpleCreate,\n  simpleDestroy,\n  simpleOpen,\n  simpleClose,\n  simpleNext,\n  0,\n};\n\n/*\n** Allocate a new simple tokenizer.  Return a pointer to the new\n** tokenizer in *ppModule\n*/\nvoid sqlite3Fts3SimpleTokenizerModule(\n  sqlite3_tokenizer_module const**ppModule\n){\n  *ppModule = &simpleTokenizerModule;\n}\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_unicode.c",
    "content": "/*\n** 2012 May 24\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** Implementation of the \"unicode\" full-text-search tokenizer.\n*/\n\n#ifndef SQLITE_DISABLE_FTS3_UNICODE\n\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <assert.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n\n#include \"fts3_tokenizer.h\"\n\n/*\n** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied\n** from the sqlite3 source file utf.c. If this file is compiled as part\n** of the amalgamation, they are not required.\n*/\n#ifndef SQLITE_AMALGAMATION\n\nstatic const unsigned char sqlite3Utf8Trans1[] = {\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,\n  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,\n};\n\n#define READ_UTF8(zIn, zTerm, c)                           \\\n  c = *(zIn++);                                            \\\n  if( c>=0xc0 ){                                           \\\n    c = sqlite3Utf8Trans1[c-0xc0];                         \\\n    while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){            \\\n      c = (c<<6) + (0x3f & *(zIn++));                      \\\n    }                                                      \\\n    if( c<0x80                                             \\\n        || (c&0xFFFFF800)==0xD800                          \\\n        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }        \\\n  }\n\n#define WRITE_UTF8(zOut, c) {                          \\\n  if( c<0x00080 ){                                     \\\n    *zOut++ = (u8)(c&0xFF);                            \\\n  }                                                    \\\n  else if( c<0x00800 ){                                \\\n    *zOut++ = 0xC0 + (u8)((c>>6)&0x1F);                \\\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\n  }                                                    \\\n  else if( c<0x10000 ){                                \\\n    *zOut++ = 0xE0 + (u8)((c>>12)&0x0F);               \\\n    *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);              \\\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\n  }else{                                               \\\n    *zOut++ = 0xF0 + (u8)((c>>18) & 0x07);             \\\n    *zOut++ = 0x80 + (u8)((c>>12) & 0x3F);             \\\n    *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);              \\\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\n  }                                                    \\\n}\n\n#endif /* ifndef SQLITE_AMALGAMATION */\n\ntypedef struct unicode_tokenizer unicode_tokenizer;\ntypedef struct unicode_cursor unicode_cursor;\n\nstruct unicode_tokenizer {\n  sqlite3_tokenizer base;\n  int bRemoveDiacritic;\n  int nException;\n  int *aiException;\n};\n\nstruct unicode_cursor {\n  sqlite3_tokenizer_cursor base;\n  const unsigned char *aInput;    /* Input text being tokenized */\n  int nInput;                     /* Size of aInput[] in bytes */\n  int iOff;                       /* Current offset within aInput[] */\n  int iToken;                     /* Index of next token to be returned */\n  char *zToken;                   /* storage for current token */\n  int nAlloc;                     /* space allocated at zToken */\n};\n\n\n/*\n** Destroy a tokenizer allocated by unicodeCreate().\n*/\nstatic int unicodeDestroy(sqlite3_tokenizer *pTokenizer){\n  if( pTokenizer ){\n    unicode_tokenizer *p = (unicode_tokenizer *)pTokenizer;\n    sqlite3_free(p->aiException);\n    sqlite3_free(p);\n  }\n  return SQLITE_OK;\n}\n\n/*\n** As part of a tokenchars= or separators= option, the CREATE VIRTUAL TABLE\n** statement has specified that the tokenizer for this table shall consider\n** all characters in string zIn/nIn to be separators (if bAlnum==0) or\n** token characters (if bAlnum==1).\n**\n** For each codepoint in the zIn/nIn string, this function checks if the\n** sqlite3FtsUnicodeIsalnum() function already returns the desired result.\n** If so, no action is taken. Otherwise, the codepoint is added to the \n** unicode_tokenizer.aiException[] array. For the purposes of tokenization,\n** the return value of sqlite3FtsUnicodeIsalnum() is inverted for all\n** codepoints in the aiException[] array.\n**\n** If a standalone diacritic mark (one that sqlite3FtsUnicodeIsdiacritic()\n** identifies as a diacritic) occurs in the zIn/nIn string it is ignored.\n** It is not possible to change the behavior of the tokenizer with respect\n** to these codepoints.\n*/\nstatic int unicodeAddExceptions(\n  unicode_tokenizer *p,           /* Tokenizer to add exceptions to */\n  int bAlnum,                     /* Replace Isalnum() return value with this */\n  const char *zIn,                /* Array of characters to make exceptions */\n  int nIn                         /* Length of z in bytes */\n){\n  const unsigned char *z = (const unsigned char *)zIn;\n  const unsigned char *zTerm = &z[nIn];\n  int iCode;\n  int nEntry = 0;\n\n  assert( bAlnum==0 || bAlnum==1 );\n\n  while( z<zTerm ){\n    READ_UTF8(z, zTerm, iCode);\n    assert( (sqlite3FtsUnicodeIsalnum(iCode) & 0xFFFFFFFE)==0 );\n    if( sqlite3FtsUnicodeIsalnum(iCode)!=bAlnum \n     && sqlite3FtsUnicodeIsdiacritic(iCode)==0 \n    ){\n      nEntry++;\n    }\n  }\n\n  if( nEntry ){\n    int *aNew;                    /* New aiException[] array */\n    int nNew;                     /* Number of valid entries in array aNew[] */\n\n    aNew = sqlite3_realloc(p->aiException, (p->nException+nEntry)*sizeof(int));\n    if( aNew==0 ) return SQLITE_NOMEM;\n    nNew = p->nException;\n\n    z = (const unsigned char *)zIn;\n    while( z<zTerm ){\n      READ_UTF8(z, zTerm, iCode);\n      if( sqlite3FtsUnicodeIsalnum(iCode)!=bAlnum \n       && sqlite3FtsUnicodeIsdiacritic(iCode)==0\n      ){\n        int i, j;\n        for(i=0; i<nNew && aNew[i]<iCode; i++);\n        for(j=nNew; j>i; j--) aNew[j] = aNew[j-1];\n        aNew[i] = iCode;\n        nNew++;\n      }\n    }\n    p->aiException = aNew;\n    p->nException = nNew;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Return true if the p->aiException[] array contains the value iCode.\n*/\nstatic int unicodeIsException(unicode_tokenizer *p, int iCode){\n  if( p->nException>0 ){\n    int *a = p->aiException;\n    int iLo = 0;\n    int iHi = p->nException-1;\n\n    while( iHi>=iLo ){\n      int iTest = (iHi + iLo) / 2;\n      if( iCode==a[iTest] ){\n        return 1;\n      }else if( iCode>a[iTest] ){\n        iLo = iTest+1;\n      }else{\n        iHi = iTest-1;\n      }\n    }\n  }\n\n  return 0;\n}\n\n/*\n** Return true if, for the purposes of tokenization, codepoint iCode is\n** considered a token character (not a separator).\n*/\nstatic int unicodeIsAlnum(unicode_tokenizer *p, int iCode){\n  assert( (sqlite3FtsUnicodeIsalnum(iCode) & 0xFFFFFFFE)==0 );\n  return sqlite3FtsUnicodeIsalnum(iCode) ^ unicodeIsException(p, iCode);\n}\n\n/*\n** Create a new tokenizer instance.\n*/\nstatic int unicodeCreate(\n  int nArg,                       /* Size of array argv[] */\n  const char * const *azArg,      /* Tokenizer creation arguments */\n  sqlite3_tokenizer **pp          /* OUT: New tokenizer handle */\n){\n  unicode_tokenizer *pNew;        /* New tokenizer object */\n  int i;\n  int rc = SQLITE_OK;\n\n  pNew = (unicode_tokenizer *) sqlite3_malloc(sizeof(unicode_tokenizer));\n  if( pNew==NULL ) return SQLITE_NOMEM;\n  memset(pNew, 0, sizeof(unicode_tokenizer));\n  pNew->bRemoveDiacritic = 1;\n\n  for(i=0; rc==SQLITE_OK && i<nArg; i++){\n    const char *z = azArg[i];\n    int n = (int)strlen(z);\n\n    if( n==19 && memcmp(\"remove_diacritics=1\", z, 19)==0 ){\n      pNew->bRemoveDiacritic = 1;\n    }\n    else if( n==19 && memcmp(\"remove_diacritics=0\", z, 19)==0 ){\n      pNew->bRemoveDiacritic = 0;\n    }\n    else if( n>=11 && memcmp(\"tokenchars=\", z, 11)==0 ){\n      rc = unicodeAddExceptions(pNew, 1, &z[11], n-11);\n    }\n    else if( n>=11 && memcmp(\"separators=\", z, 11)==0 ){\n      rc = unicodeAddExceptions(pNew, 0, &z[11], n-11);\n    }\n    else{\n      /* Unrecognized argument */\n      rc  = SQLITE_ERROR;\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    unicodeDestroy((sqlite3_tokenizer *)pNew);\n    pNew = 0;\n  }\n  *pp = (sqlite3_tokenizer *)pNew;\n  return rc;\n}\n\n/*\n** Prepare to begin tokenizing a particular string.  The input\n** string to be tokenized is pInput[0..nBytes-1].  A cursor\n** used to incrementally tokenize this string is returned in \n** *ppCursor.\n*/\nstatic int unicodeOpen(\n  sqlite3_tokenizer *p,           /* The tokenizer */\n  const char *aInput,             /* Input string */\n  int nInput,                     /* Size of string aInput in bytes */\n  sqlite3_tokenizer_cursor **pp   /* OUT: New cursor object */\n){\n  unicode_cursor *pCsr;\n\n  pCsr = (unicode_cursor *)sqlite3_malloc(sizeof(unicode_cursor));\n  if( pCsr==0 ){\n    return SQLITE_NOMEM;\n  }\n  memset(pCsr, 0, sizeof(unicode_cursor));\n\n  pCsr->aInput = (const unsigned char *)aInput;\n  if( aInput==0 ){\n    pCsr->nInput = 0;\n  }else if( nInput<0 ){\n    pCsr->nInput = (int)strlen(aInput);\n  }else{\n    pCsr->nInput = nInput;\n  }\n\n  *pp = &pCsr->base;\n  UNUSED_PARAMETER(p);\n  return SQLITE_OK;\n}\n\n/*\n** Close a tokenization cursor previously opened by a call to\n** simpleOpen() above.\n*/\nstatic int unicodeClose(sqlite3_tokenizer_cursor *pCursor){\n  unicode_cursor *pCsr = (unicode_cursor *) pCursor;\n  sqlite3_free(pCsr->zToken);\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\n/*\n** Extract the next token from a tokenization cursor.  The cursor must\n** have been opened by a prior call to simpleOpen().\n*/\nstatic int unicodeNext(\n  sqlite3_tokenizer_cursor *pC,   /* Cursor returned by simpleOpen */\n  const char **paToken,           /* OUT: Token text */\n  int *pnToken,                   /* OUT: Number of bytes at *paToken */\n  int *piStart,                   /* OUT: Starting offset of token */\n  int *piEnd,                     /* OUT: Ending offset of token */\n  int *piPos                      /* OUT: Position integer of token */\n){\n  unicode_cursor *pCsr = (unicode_cursor *)pC;\n  unicode_tokenizer *p = ((unicode_tokenizer *)pCsr->base.pTokenizer);\n  int iCode = 0;\n  char *zOut;\n  const unsigned char *z = &pCsr->aInput[pCsr->iOff];\n  const unsigned char *zStart = z;\n  const unsigned char *zEnd;\n  const unsigned char *zTerm = &pCsr->aInput[pCsr->nInput];\n\n  /* Scan past any delimiter characters before the start of the next token.\n  ** Return SQLITE_DONE early if this takes us all the way to the end of \n  ** the input.  */\n  while( z<zTerm ){\n    READ_UTF8(z, zTerm, iCode);\n    if( unicodeIsAlnum(p, iCode) ) break;\n    zStart = z;\n  }\n  if( zStart>=zTerm ) return SQLITE_DONE;\n\n  zOut = pCsr->zToken;\n  do {\n    int iOut;\n\n    /* Grow the output buffer if required. */\n    if( (zOut-pCsr->zToken)>=(pCsr->nAlloc-4) ){\n      char *zNew = sqlite3_realloc(pCsr->zToken, pCsr->nAlloc+64);\n      if( !zNew ) return SQLITE_NOMEM;\n      zOut = &zNew[zOut - pCsr->zToken];\n      pCsr->zToken = zNew;\n      pCsr->nAlloc += 64;\n    }\n\n    /* Write the folded case of the last character read to the output */\n    zEnd = z;\n    iOut = sqlite3FtsUnicodeFold(iCode, p->bRemoveDiacritic);\n    if( iOut ){\n      WRITE_UTF8(zOut, iOut);\n    }\n\n    /* If the cursor is not at EOF, read the next character */\n    if( z>=zTerm ) break;\n    READ_UTF8(z, zTerm, iCode);\n  }while( unicodeIsAlnum(p, iCode) \n       || sqlite3FtsUnicodeIsdiacritic(iCode)\n  );\n\n  /* Set the output variables and return. */\n  pCsr->iOff = (int)(z - pCsr->aInput);\n  *paToken = pCsr->zToken;\n  *pnToken = (int)(zOut - pCsr->zToken);\n  *piStart = (int)(zStart - pCsr->aInput);\n  *piEnd = (int)(zEnd - pCsr->aInput);\n  *piPos = pCsr->iToken++;\n  return SQLITE_OK;\n}\n\n/*\n** Set *ppModule to a pointer to the sqlite3_tokenizer_module \n** structure for the unicode tokenizer.\n*/\nvoid sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const **ppModule){\n  static const sqlite3_tokenizer_module module = {\n    0,\n    unicodeCreate,\n    unicodeDestroy,\n    unicodeOpen,\n    unicodeClose,\n    unicodeNext,\n    0,\n  };\n  *ppModule = &module;\n}\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */\n#endif /* ifndef SQLITE_DISABLE_FTS3_UNICODE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_unicode2.c",
    "content": "/*\n** 2012 May 25\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n*/\n\n/*\n** DO NOT EDIT THIS MACHINE GENERATED FILE.\n*/\n\n#ifndef SQLITE_DISABLE_FTS3_UNICODE\n#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)\n\n#include <assert.h>\n\n/*\n** Return true if the argument corresponds to a unicode codepoint\n** classified as either a letter or a number. Otherwise false.\n**\n** The results are undefined if the value passed to this function\n** is less than zero.\n*/\nint sqlite3FtsUnicodeIsalnum(int c){\n  /* Each unsigned integer in the following array corresponds to a contiguous\n  ** range of unicode codepoints that are not either letters or numbers (i.e.\n  ** codepoints for which this function should return 0).\n  **\n  ** The most significant 22 bits in each 32-bit value contain the first \n  ** codepoint in the range. The least significant 10 bits are used to store\n  ** the size of the range (always at least 1). In other words, the value \n  ** ((C<<22) + N) represents a range of N codepoints starting with codepoint \n  ** C. It is not possible to represent a range larger than 1023 codepoints \n  ** using this format.\n  */\n  static const unsigned int aEntry[] = {\n    0x00000030, 0x0000E807, 0x00016C06, 0x0001EC2F, 0x0002AC07,\n    0x0002D001, 0x0002D803, 0x0002EC01, 0x0002FC01, 0x00035C01,\n    0x0003DC01, 0x000B0804, 0x000B480E, 0x000B9407, 0x000BB401,\n    0x000BBC81, 0x000DD401, 0x000DF801, 0x000E1002, 0x000E1C01,\n    0x000FD801, 0x00120808, 0x00156806, 0x00162402, 0x00163C01,\n    0x00164437, 0x0017CC02, 0x00180005, 0x00181816, 0x00187802,\n    0x00192C15, 0x0019A804, 0x0019C001, 0x001B5001, 0x001B580F,\n    0x001B9C07, 0x001BF402, 0x001C000E, 0x001C3C01, 0x001C4401,\n    0x001CC01B, 0x001E980B, 0x001FAC09, 0x001FD804, 0x00205804,\n    0x00206C09, 0x00209403, 0x0020A405, 0x0020C00F, 0x00216403,\n    0x00217801, 0x0023901B, 0x00240004, 0x0024E803, 0x0024F812,\n    0x00254407, 0x00258804, 0x0025C001, 0x00260403, 0x0026F001,\n    0x0026F807, 0x00271C02, 0x00272C03, 0x00275C01, 0x00278802,\n    0x0027C802, 0x0027E802, 0x00280403, 0x0028F001, 0x0028F805,\n    0x00291C02, 0x00292C03, 0x00294401, 0x0029C002, 0x0029D401,\n    0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03,\n    0x002B8802, 0x002BC002, 0x002C0403, 0x002CF001, 0x002CF807,\n    0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802, 0x002DC001,\n    0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804, 0x002F5C01,\n    0x002FCC08, 0x00300403, 0x0030F807, 0x00311803, 0x00312804,\n    0x00315402, 0x00318802, 0x0031FC01, 0x00320802, 0x0032F001,\n    0x0032F807, 0x00331803, 0x00332804, 0x00335402, 0x00338802,\n    0x00340802, 0x0034F807, 0x00351803, 0x00352804, 0x00355C01,\n    0x00358802, 0x0035E401, 0x00360802, 0x00372801, 0x00373C06,\n    0x00375801, 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007,\n    0x0038FC01, 0x00391C09, 0x00396802, 0x003AC401, 0x003AD006,\n    0x003AEC02, 0x003B2006, 0x003C041F, 0x003CD00C, 0x003DC417,\n    0x003E340B, 0x003E6424, 0x003EF80F, 0x003F380D, 0x0040AC14,\n    0x00412806, 0x00415804, 0x00417803, 0x00418803, 0x00419C07,\n    0x0041C404, 0x0042080C, 0x00423C01, 0x00426806, 0x0043EC01,\n    0x004D740C, 0x004E400A, 0x00500001, 0x0059B402, 0x005A0001,\n    0x005A6C02, 0x005BAC03, 0x005C4803, 0x005CC805, 0x005D4802,\n    0x005DC802, 0x005ED023, 0x005F6004, 0x005F7401, 0x0060000F,\n    0x0062A401, 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002,\n    0x0066C011, 0x00672002, 0x00677822, 0x00685C05, 0x00687802,\n    0x0069540A, 0x0069801D, 0x0069FC01, 0x006A8007, 0x006AA006,\n    0x006C0005, 0x006CD011, 0x006D6823, 0x006E0003, 0x006E840D,\n    0x006F980E, 0x006FF004, 0x00709014, 0x0070EC05, 0x0071F802,\n    0x00730008, 0x00734019, 0x0073B401, 0x0073C803, 0x00770027,\n    0x0077F004, 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403,\n    0x007FB403, 0x007FF402, 0x00800065, 0x0081A806, 0x0081E805,\n    0x00822805, 0x0082801A, 0x00834021, 0x00840002, 0x00840C04,\n    0x00842002, 0x00845001, 0x00845803, 0x00847806, 0x00849401,\n    0x00849C01, 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005,\n    0x00852804, 0x00853C01, 0x00864264, 0x00900027, 0x0091000B,\n    0x0092704E, 0x00940200, 0x009C0475, 0x009E53B9, 0x00AD400A,\n    0x00B39406, 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001,\n    0x00B5FC01, 0x00B7804F, 0x00B8C00C, 0x00BA001A, 0x00BA6C59,\n    0x00BC00D6, 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807,\n    0x00C0D802, 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01,\n    0x00C64002, 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E,\n    0x00C94001, 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100,\n    0x01370040, 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10,\n    0x029A7C01, 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402,\n    0x02A00801, 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804,\n    0x02A1D004, 0x02A20002, 0x02A2D011, 0x02A33802, 0x02A38012,\n    0x02A3E003, 0x02A4980A, 0x02A51C0D, 0x02A57C01, 0x02A60004,\n    0x02A6CC1B, 0x02A77802, 0x02A8A40E, 0x02A90C01, 0x02A93002,\n    0x02A97004, 0x02A9DC03, 0x02A9EC01, 0x02AAC001, 0x02AAC803,\n    0x02AADC02, 0x02AAF802, 0x02AB0401, 0x02AB7802, 0x02ABAC07,\n    0x02ABD402, 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02,\n    0x037FFC01, 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802,\n    0x03F7F002, 0x03F8001A, 0x03F88007, 0x03F8C023, 0x03F95013,\n    0x03F9A004, 0x03FBFC01, 0x03FC040F, 0x03FC6807, 0x03FCEC06,\n    0x03FD6C0B, 0x03FF8007, 0x03FFA007, 0x03FFE405, 0x04040003,\n    0x0404DC09, 0x0405E411, 0x0406400C, 0x0407402E, 0x040E7C01,\n    0x040F4001, 0x04215C01, 0x04247C01, 0x0424FC01, 0x04280403,\n    0x04281402, 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009,\n    0x0429FC01, 0x042CE407, 0x04400003, 0x0440E016, 0x04420003,\n    0x0442C012, 0x04440003, 0x04449C0E, 0x04450004, 0x04460003,\n    0x0446CC0E, 0x04471404, 0x045AAC0D, 0x0491C004, 0x05BD442E,\n    0x05BE3C04, 0x074000F6, 0x07440027, 0x0744A4B5, 0x07480046,\n    0x074C0057, 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401,\n    0x075CD401, 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401,\n    0x075F0C01, 0x07BBC002, 0x07C0002C, 0x07C0C064, 0x07C2800F,\n    0x07C2C40E, 0x07C3040F, 0x07C3440F, 0x07C4401F, 0x07C4C03C,\n    0x07C5C02B, 0x07C7981D, 0x07C8402B, 0x07C90009, 0x07C94002,\n    0x07CC0021, 0x07CCC006, 0x07CCDC46, 0x07CE0014, 0x07CE8025,\n    0x07CF1805, 0x07CF8011, 0x07D0003F, 0x07D10001, 0x07D108B6,\n    0x07D3E404, 0x07D4003E, 0x07D50004, 0x07D54018, 0x07D7EC46,\n    0x07D9140B, 0x07DA0046, 0x07DC0074, 0x38000401, 0x38008060,\n    0x380400F0,\n  };\n  static const unsigned int aAscii[4] = {\n    0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001,\n  };\n\n  if( c<128 ){\n    return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 );\n  }else if( c<(1<<22) ){\n    unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;\n    int iRes = 0;\n    int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;\n    int iLo = 0;\n    while( iHi>=iLo ){\n      int iTest = (iHi + iLo) / 2;\n      if( key >= aEntry[iTest] ){\n        iRes = iTest;\n        iLo = iTest+1;\n      }else{\n        iHi = iTest-1;\n      }\n    }\n    assert( aEntry[0]<key );\n    assert( key>=aEntry[iRes] );\n    return (((unsigned int)c) >= ((aEntry[iRes]>>10) + (aEntry[iRes]&0x3FF)));\n  }\n  return 1;\n}\n\n\n/*\n** If the argument is a codepoint corresponding to a lowercase letter\n** in the ASCII range with a diacritic added, return the codepoint\n** of the ASCII letter only. For example, if passed 235 - \"LATIN\n** SMALL LETTER E WITH DIAERESIS\" - return 65 (\"LATIN SMALL LETTER\n** E\"). The resuls of passing a codepoint that corresponds to an\n** uppercase letter are undefined.\n*/\nstatic int remove_diacritic(int c){\n  unsigned short aDia[] = {\n        0,  1797,  1848,  1859,  1891,  1928,  1940,  1995, \n     2024,  2040,  2060,  2110,  2168,  2206,  2264,  2286, \n     2344,  2383,  2472,  2488,  2516,  2596,  2668,  2732, \n     2782,  2842,  2894,  2954,  2984,  3000,  3028,  3336, \n     3456,  3696,  3712,  3728,  3744,  3896,  3912,  3928, \n     3968,  4008,  4040,  4106,  4138,  4170,  4202,  4234, \n     4266,  4296,  4312,  4344,  4408,  4424,  4472,  4504, \n     6148,  6198,  6264,  6280,  6360,  6429,  6505,  6529, \n    61448, 61468, 61534, 61592, 61642, 61688, 61704, 61726, \n    61784, 61800, 61836, 61880, 61914, 61948, 61998, 62122, \n    62154, 62200, 62218, 62302, 62364, 62442, 62478, 62536, \n    62554, 62584, 62604, 62640, 62648, 62656, 62664, 62730, \n    62924, 63050, 63082, 63274, 63390, \n  };\n  char aChar[] = {\n    '\\0', 'a',  'c',  'e',  'i',  'n',  'o',  'u',  'y',  'y',  'a',  'c',  \n    'd',  'e',  'e',  'g',  'h',  'i',  'j',  'k',  'l',  'n',  'o',  'r',  \n    's',  't',  'u',  'u',  'w',  'y',  'z',  'o',  'u',  'a',  'i',  'o',  \n    'u',  'g',  'k',  'o',  'j',  'g',  'n',  'a',  'e',  'i',  'o',  'r',  \n    'u',  's',  't',  'h',  'a',  'e',  'o',  'y',  '\\0', '\\0', '\\0', '\\0', \n    '\\0', '\\0', '\\0', '\\0', 'a',  'b',  'd',  'd',  'e',  'f',  'g',  'h',  \n    'h',  'i',  'k',  'l',  'l',  'm',  'n',  'p',  'r',  'r',  's',  't',  \n    'u',  'v',  'w',  'w',  'x',  'y',  'z',  'h',  't',  'w',  'y',  'a',  \n    'e',  'i',  'o',  'u',  'y',  \n  };\n\n  unsigned int key = (((unsigned int)c)<<3) | 0x00000007;\n  int iRes = 0;\n  int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1;\n  int iLo = 0;\n  while( iHi>=iLo ){\n    int iTest = (iHi + iLo) / 2;\n    if( key >= aDia[iTest] ){\n      iRes = iTest;\n      iLo = iTest+1;\n    }else{\n      iHi = iTest-1;\n    }\n  }\n  assert( key>=aDia[iRes] );\n  return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]);\n}\n\n\n/*\n** Return true if the argument interpreted as a unicode codepoint\n** is a diacritical modifier character.\n*/\nint sqlite3FtsUnicodeIsdiacritic(int c){\n  unsigned int mask0 = 0x08029FDF;\n  unsigned int mask1 = 0x000361F8;\n  if( c<768 || c>817 ) return 0;\n  return (c < 768+32) ?\n      (mask0 & (1 << (c-768))) :\n      (mask1 & (1 << (c-768-32)));\n}\n\n\n/*\n** Interpret the argument as a unicode codepoint. If the codepoint\n** is an upper case character that has a lower case equivalent,\n** return the codepoint corresponding to the lower case version.\n** Otherwise, return a copy of the argument.\n**\n** The results are undefined if the value passed to this function\n** is less than zero.\n*/\nint sqlite3FtsUnicodeFold(int c, int bRemoveDiacritic){\n  /* Each entry in the following array defines a rule for folding a range\n  ** of codepoints to lower case. The rule applies to a range of nRange\n  ** codepoints starting at codepoint iCode.\n  **\n  ** If the least significant bit in flags is clear, then the rule applies\n  ** to all nRange codepoints (i.e. all nRange codepoints are upper case and\n  ** need to be folded). Or, if it is set, then the rule only applies to\n  ** every second codepoint in the range, starting with codepoint C.\n  **\n  ** The 7 most significant bits in flags are an index into the aiOff[]\n  ** array. If a specific codepoint C does require folding, then its lower\n  ** case equivalent is ((C + aiOff[flags>>1]) & 0xFFFF).\n  **\n  ** The contents of this array are generated by parsing the CaseFolding.txt\n  ** file distributed as part of the \"Unicode Character Database\". See\n  ** http://www.unicode.org for details.\n  */\n  static const struct TableEntry {\n    unsigned short iCode;\n    unsigned char flags;\n    unsigned char nRange;\n  } aEntry[] = {\n    {65, 14, 26},          {181, 64, 1},          {192, 14, 23},\n    {216, 14, 7},          {256, 1, 48},          {306, 1, 6},\n    {313, 1, 16},          {330, 1, 46},          {376, 116, 1},\n    {377, 1, 6},           {383, 104, 1},         {385, 50, 1},\n    {386, 1, 4},           {390, 44, 1},          {391, 0, 1},\n    {393, 42, 2},          {395, 0, 1},           {398, 32, 1},\n    {399, 38, 1},          {400, 40, 1},          {401, 0, 1},\n    {403, 42, 1},          {404, 46, 1},          {406, 52, 1},\n    {407, 48, 1},          {408, 0, 1},           {412, 52, 1},\n    {413, 54, 1},          {415, 56, 1},          {416, 1, 6},\n    {422, 60, 1},          {423, 0, 1},           {425, 60, 1},\n    {428, 0, 1},           {430, 60, 1},          {431, 0, 1},\n    {433, 58, 2},          {435, 1, 4},           {439, 62, 1},\n    {440, 0, 1},           {444, 0, 1},           {452, 2, 1},\n    {453, 0, 1},           {455, 2, 1},           {456, 0, 1},\n    {458, 2, 1},           {459, 1, 18},          {478, 1, 18},\n    {497, 2, 1},           {498, 1, 4},           {502, 122, 1},\n    {503, 134, 1},         {504, 1, 40},          {544, 110, 1},\n    {546, 1, 18},          {570, 70, 1},          {571, 0, 1},\n    {573, 108, 1},         {574, 68, 1},          {577, 0, 1},\n    {579, 106, 1},         {580, 28, 1},          {581, 30, 1},\n    {582, 1, 10},          {837, 36, 1},          {880, 1, 4},\n    {886, 0, 1},           {902, 18, 1},          {904, 16, 3},\n    {908, 26, 1},          {910, 24, 2},          {913, 14, 17},\n    {931, 14, 9},          {962, 0, 1},           {975, 4, 1},\n    {976, 140, 1},         {977, 142, 1},         {981, 146, 1},\n    {982, 144, 1},         {984, 1, 24},          {1008, 136, 1},\n    {1009, 138, 1},        {1012, 130, 1},        {1013, 128, 1},\n    {1015, 0, 1},          {1017, 152, 1},        {1018, 0, 1},\n    {1021, 110, 3},        {1024, 34, 16},        {1040, 14, 32},\n    {1120, 1, 34},         {1162, 1, 54},         {1216, 6, 1},\n    {1217, 1, 14},         {1232, 1, 88},         {1329, 22, 38},\n    {4256, 66, 38},        {4295, 66, 1},         {4301, 66, 1},\n    {7680, 1, 150},        {7835, 132, 1},        {7838, 96, 1},\n    {7840, 1, 96},         {7944, 150, 8},        {7960, 150, 6},\n    {7976, 150, 8},        {7992, 150, 8},        {8008, 150, 6},\n    {8025, 151, 8},        {8040, 150, 8},        {8072, 150, 8},\n    {8088, 150, 8},        {8104, 150, 8},        {8120, 150, 2},\n    {8122, 126, 2},        {8124, 148, 1},        {8126, 100, 1},\n    {8136, 124, 4},        {8140, 148, 1},        {8152, 150, 2},\n    {8154, 120, 2},        {8168, 150, 2},        {8170, 118, 2},\n    {8172, 152, 1},        {8184, 112, 2},        {8186, 114, 2},\n    {8188, 148, 1},        {8486, 98, 1},         {8490, 92, 1},\n    {8491, 94, 1},         {8498, 12, 1},         {8544, 8, 16},\n    {8579, 0, 1},          {9398, 10, 26},        {11264, 22, 47},\n    {11360, 0, 1},         {11362, 88, 1},        {11363, 102, 1},\n    {11364, 90, 1},        {11367, 1, 6},         {11373, 84, 1},\n    {11374, 86, 1},        {11375, 80, 1},        {11376, 82, 1},\n    {11378, 0, 1},         {11381, 0, 1},         {11390, 78, 2},\n    {11392, 1, 100},       {11499, 1, 4},         {11506, 0, 1},\n    {42560, 1, 46},        {42624, 1, 24},        {42786, 1, 14},\n    {42802, 1, 62},        {42873, 1, 4},         {42877, 76, 1},\n    {42878, 1, 10},        {42891, 0, 1},         {42893, 74, 1},\n    {42896, 1, 4},         {42912, 1, 10},        {42922, 72, 1},\n    {65313, 14, 26},       \n  };\n  static const unsigned short aiOff[] = {\n   1,     2,     8,     15,    16,    26,    28,    32,    \n   37,    38,    40,    48,    63,    64,    69,    71,    \n   79,    80,    116,   202,   203,   205,   206,   207,   \n   209,   210,   211,   213,   214,   217,   218,   219,   \n   775,   7264,  10792, 10795, 23228, 23256, 30204, 54721, \n   54753, 54754, 54756, 54787, 54793, 54809, 57153, 57274, \n   57921, 58019, 58363, 61722, 65268, 65341, 65373, 65406, \n   65408, 65410, 65415, 65424, 65436, 65439, 65450, 65462, \n   65472, 65476, 65478, 65480, 65482, 65488, 65506, 65511, \n   65514, 65521, 65527, 65528, 65529, \n  };\n\n  int ret = c;\n\n  assert( c>=0 );\n  assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 );\n\n  if( c<128 ){\n    if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');\n  }else if( c<65536 ){\n    int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;\n    int iLo = 0;\n    int iRes = -1;\n\n    while( iHi>=iLo ){\n      int iTest = (iHi + iLo) / 2;\n      int cmp = (c - aEntry[iTest].iCode);\n      if( cmp>=0 ){\n        iRes = iTest;\n        iLo = iTest+1;\n      }else{\n        iHi = iTest-1;\n      }\n    }\n    assert( iRes<0 || c>=aEntry[iRes].iCode );\n\n    if( iRes>=0 ){\n      const struct TableEntry *p = &aEntry[iRes];\n      if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){\n        ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF;\n        assert( ret>0 );\n      }\n    }\n\n    if( bRemoveDiacritic ) ret = remove_diacritic(ret);\n  }\n  \n  else if( c>=66560 && c<66600 ){\n    ret = c + 40;\n  }\n\n  return ret;\n}\n#endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */\n#endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/fts3/fts3_write.c",
    "content": "/*\n** 2009 Oct 23\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file is part of the SQLite FTS3 extension module. Specifically,\n** this file contains code to insert, update and delete rows from FTS3\n** tables. It also contains code to merge FTS3 b-tree segments. Some\n** of the sub-routines used to merge segments are also used by the query \n** code in fts3.c.\n*/\n\n#include \"fts3Int.h\"\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)\n\n#include <string.h>\n#include <assert.h>\n#include <stdlib.h>\n\n\n#define FTS_MAX_APPENDABLE_HEIGHT 16\n\n/*\n** When full-text index nodes are loaded from disk, the buffer that they\n** are loaded into has the following number of bytes of padding at the end \n** of it. i.e. if a full-text index node is 900 bytes in size, then a buffer\n** of 920 bytes is allocated for it.\n**\n** This means that if we have a pointer into a buffer containing node data,\n** it is always safe to read up to two varints from it without risking an\n** overread, even if the node data is corrupted.\n*/\n#define FTS3_NODE_PADDING (FTS3_VARINT_MAX*2)\n\n/*\n** Under certain circumstances, b-tree nodes (doclists) can be loaded into\n** memory incrementally instead of all at once. This can be a big performance\n** win (reduced IO and CPU) if SQLite stops calling the virtual table xNext()\n** method before retrieving all query results (as may happen, for example,\n** if a query has a LIMIT clause).\n**\n** Incremental loading is used for b-tree nodes FTS3_NODE_CHUNK_THRESHOLD \n** bytes and larger. Nodes are loaded in chunks of FTS3_NODE_CHUNKSIZE bytes.\n** The code is written so that the hard lower-limit for each of these values \n** is 1. Clearly such small values would be inefficient, but can be useful \n** for testing purposes.\n**\n** If this module is built with SQLITE_TEST defined, these constants may\n** be overridden at runtime for testing purposes. File fts3_test.c contains\n** a Tcl interface to read and write the values.\n*/\n#ifdef SQLITE_TEST\nint test_fts3_node_chunksize = (4*1024);\nint test_fts3_node_chunk_threshold = (4*1024)*4;\n# define FTS3_NODE_CHUNKSIZE       test_fts3_node_chunksize\n# define FTS3_NODE_CHUNK_THRESHOLD test_fts3_node_chunk_threshold\n#else\n# define FTS3_NODE_CHUNKSIZE (4*1024) \n# define FTS3_NODE_CHUNK_THRESHOLD (FTS3_NODE_CHUNKSIZE*4)\n#endif\n\n/*\n** The two values that may be meaningfully bound to the :1 parameter in\n** statements SQL_REPLACE_STAT and SQL_SELECT_STAT.\n*/\n#define FTS_STAT_DOCTOTAL      0\n#define FTS_STAT_INCRMERGEHINT 1\n#define FTS_STAT_AUTOINCRMERGE 2\n\n/*\n** If FTS_LOG_MERGES is defined, call sqlite3_log() to report each automatic\n** and incremental merge operation that takes place. This is used for \n** debugging FTS only, it should not usually be turned on in production\n** systems.\n*/\n#ifdef FTS3_LOG_MERGES\nstatic void fts3LogMerge(int nMerge, sqlite3_int64 iAbsLevel){\n  sqlite3_log(SQLITE_OK, \"%d-way merge from level %d\", nMerge, (int)iAbsLevel);\n}\n#else\n#define fts3LogMerge(x, y)\n#endif\n\n\ntypedef struct PendingList PendingList;\ntypedef struct SegmentNode SegmentNode;\ntypedef struct SegmentWriter SegmentWriter;\n\n/*\n** An instance of the following data structure is used to build doclists\n** incrementally. See function fts3PendingListAppend() for details.\n*/\nstruct PendingList {\n  int nData;\n  char *aData;\n  int nSpace;\n  sqlite3_int64 iLastDocid;\n  sqlite3_int64 iLastCol;\n  sqlite3_int64 iLastPos;\n};\n\n\n/*\n** Each cursor has a (possibly empty) linked list of the following objects.\n*/\nstruct Fts3DeferredToken {\n  Fts3PhraseToken *pToken;        /* Pointer to corresponding expr token */\n  int iCol;                       /* Column token must occur in */\n  Fts3DeferredToken *pNext;       /* Next in list of deferred tokens */\n  PendingList *pList;             /* Doclist is assembled here */\n};\n\n/*\n** An instance of this structure is used to iterate through the terms on\n** a contiguous set of segment b-tree leaf nodes. Although the details of\n** this structure are only manipulated by code in this file, opaque handles\n** of type Fts3SegReader* are also used by code in fts3.c to iterate through\n** terms when querying the full-text index. See functions:\n**\n**   sqlite3Fts3SegReaderNew()\n**   sqlite3Fts3SegReaderFree()\n**   sqlite3Fts3SegReaderIterate()\n**\n** Methods used to manipulate Fts3SegReader structures:\n**\n**   fts3SegReaderNext()\n**   fts3SegReaderFirstDocid()\n**   fts3SegReaderNextDocid()\n*/\nstruct Fts3SegReader {\n  int iIdx;                       /* Index within level, or 0x7FFFFFFF for PT */\n  u8 bLookup;                     /* True for a lookup only */\n  u8 rootOnly;                    /* True for a root-only reader */\n\n  sqlite3_int64 iStartBlock;      /* Rowid of first leaf block to traverse */\n  sqlite3_int64 iLeafEndBlock;    /* Rowid of final leaf block to traverse */\n  sqlite3_int64 iEndBlock;        /* Rowid of final block in segment (or 0) */\n  sqlite3_int64 iCurrentBlock;    /* Current leaf block (or 0) */\n\n  char *aNode;                    /* Pointer to node data (or NULL) */\n  int nNode;                      /* Size of buffer at aNode (or 0) */\n  int nPopulate;                  /* If >0, bytes of buffer aNode[] loaded */\n  sqlite3_blob *pBlob;            /* If not NULL, blob handle to read node */\n\n  Fts3HashElem **ppNextElem;\n\n  /* Variables set by fts3SegReaderNext(). These may be read directly\n  ** by the caller. They are valid from the time SegmentReaderNew() returns\n  ** until SegmentReaderNext() returns something other than SQLITE_OK\n  ** (i.e. SQLITE_DONE).\n  */\n  int nTerm;                      /* Number of bytes in current term */\n  char *zTerm;                    /* Pointer to current term */\n  int nTermAlloc;                 /* Allocated size of zTerm buffer */\n  char *aDoclist;                 /* Pointer to doclist of current entry */\n  int nDoclist;                   /* Size of doclist in current entry */\n\n  /* The following variables are used by fts3SegReaderNextDocid() to iterate \n  ** through the current doclist (aDoclist/nDoclist).\n  */\n  char *pOffsetList;\n  int nOffsetList;                /* For descending pending seg-readers only */\n  sqlite3_int64 iDocid;\n};\n\n#define fts3SegReaderIsPending(p) ((p)->ppNextElem!=0)\n#define fts3SegReaderIsRootOnly(p) ((p)->rootOnly!=0)\n\n/*\n** An instance of this structure is used to create a segment b-tree in the\n** database. The internal details of this type are only accessed by the\n** following functions:\n**\n**   fts3SegWriterAdd()\n**   fts3SegWriterFlush()\n**   fts3SegWriterFree()\n*/\nstruct SegmentWriter {\n  SegmentNode *pTree;             /* Pointer to interior tree structure */\n  sqlite3_int64 iFirst;           /* First slot in %_segments written */\n  sqlite3_int64 iFree;            /* Next free slot in %_segments */\n  char *zTerm;                    /* Pointer to previous term buffer */\n  int nTerm;                      /* Number of bytes in zTerm */\n  int nMalloc;                    /* Size of malloc'd buffer at zMalloc */\n  char *zMalloc;                  /* Malloc'd space (possibly) used for zTerm */\n  int nSize;                      /* Size of allocation at aData */\n  int nData;                      /* Bytes of data in aData */\n  char *aData;                    /* Pointer to block from malloc() */\n  i64 nLeafData;                  /* Number of bytes of leaf data written */\n};\n\n/*\n** Type SegmentNode is used by the following three functions to create\n** the interior part of the segment b+-tree structures (everything except\n** the leaf nodes). These functions and type are only ever used by code\n** within the fts3SegWriterXXX() family of functions described above.\n**\n**   fts3NodeAddTerm()\n**   fts3NodeWrite()\n**   fts3NodeFree()\n**\n** When a b+tree is written to the database (either as a result of a merge\n** or the pending-terms table being flushed), leaves are written into the \n** database file as soon as they are completely populated. The interior of\n** the tree is assembled in memory and written out only once all leaves have\n** been populated and stored. This is Ok, as the b+-tree fanout is usually\n** very large, meaning that the interior of the tree consumes relatively \n** little memory.\n*/\nstruct SegmentNode {\n  SegmentNode *pParent;           /* Parent node (or NULL for root node) */\n  SegmentNode *pRight;            /* Pointer to right-sibling */\n  SegmentNode *pLeftmost;         /* Pointer to left-most node of this depth */\n  int nEntry;                     /* Number of terms written to node so far */\n  char *zTerm;                    /* Pointer to previous term buffer */\n  int nTerm;                      /* Number of bytes in zTerm */\n  int nMalloc;                    /* Size of malloc'd buffer at zMalloc */\n  char *zMalloc;                  /* Malloc'd space (possibly) used for zTerm */\n  int nData;                      /* Bytes of valid data so far */\n  char *aData;                    /* Node data */\n};\n\n/*\n** Valid values for the second argument to fts3SqlStmt().\n*/\n#define SQL_DELETE_CONTENT             0\n#define SQL_IS_EMPTY                   1\n#define SQL_DELETE_ALL_CONTENT         2 \n#define SQL_DELETE_ALL_SEGMENTS        3\n#define SQL_DELETE_ALL_SEGDIR          4\n#define SQL_DELETE_ALL_DOCSIZE         5\n#define SQL_DELETE_ALL_STAT            6\n#define SQL_SELECT_CONTENT_BY_ROWID    7\n#define SQL_NEXT_SEGMENT_INDEX         8\n#define SQL_INSERT_SEGMENTS            9\n#define SQL_NEXT_SEGMENTS_ID          10\n#define SQL_INSERT_SEGDIR             11\n#define SQL_SELECT_LEVEL              12\n#define SQL_SELECT_LEVEL_RANGE        13\n#define SQL_SELECT_LEVEL_COUNT        14\n#define SQL_SELECT_SEGDIR_MAX_LEVEL   15\n#define SQL_DELETE_SEGDIR_LEVEL       16\n#define SQL_DELETE_SEGMENTS_RANGE     17\n#define SQL_CONTENT_INSERT            18\n#define SQL_DELETE_DOCSIZE            19\n#define SQL_REPLACE_DOCSIZE           20\n#define SQL_SELECT_DOCSIZE            21\n#define SQL_SELECT_STAT               22\n#define SQL_REPLACE_STAT              23\n\n#define SQL_SELECT_ALL_PREFIX_LEVEL   24\n#define SQL_DELETE_ALL_TERMS_SEGDIR   25\n#define SQL_DELETE_SEGDIR_RANGE       26\n#define SQL_SELECT_ALL_LANGID         27\n#define SQL_FIND_MERGE_LEVEL          28\n#define SQL_MAX_LEAF_NODE_ESTIMATE    29\n#define SQL_DELETE_SEGDIR_ENTRY       30\n#define SQL_SHIFT_SEGDIR_ENTRY        31\n#define SQL_SELECT_SEGDIR             32\n#define SQL_CHOMP_SEGDIR              33\n#define SQL_SEGMENT_IS_APPENDABLE     34\n#define SQL_SELECT_INDEXES            35\n#define SQL_SELECT_MXLEVEL            36\n\n#define SQL_SELECT_LEVEL_RANGE2       37\n#define SQL_UPDATE_LEVEL_IDX          38\n#define SQL_UPDATE_LEVEL              39\n\n/*\n** This function is used to obtain an SQLite prepared statement handle\n** for the statement identified by the second argument. If successful,\n** *pp is set to the requested statement handle and SQLITE_OK returned.\n** Otherwise, an SQLite error code is returned and *pp is set to 0.\n**\n** If argument apVal is not NULL, then it must point to an array with\n** at least as many entries as the requested statement has bound \n** parameters. The values are bound to the statements parameters before\n** returning.\n*/\nstatic int fts3SqlStmt(\n  Fts3Table *p,                   /* Virtual table handle */\n  int eStmt,                      /* One of the SQL_XXX constants above */\n  sqlite3_stmt **pp,              /* OUT: Statement handle */\n  sqlite3_value **apVal           /* Values to bind to statement */\n){\n  const char *azSql[] = {\n/* 0  */  \"DELETE FROM %Q.'%q_content' WHERE rowid = ?\",\n/* 1  */  \"SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)\",\n/* 2  */  \"DELETE FROM %Q.'%q_content'\",\n/* 3  */  \"DELETE FROM %Q.'%q_segments'\",\n/* 4  */  \"DELETE FROM %Q.'%q_segdir'\",\n/* 5  */  \"DELETE FROM %Q.'%q_docsize'\",\n/* 6  */  \"DELETE FROM %Q.'%q_stat'\",\n/* 7  */  \"SELECT %s WHERE rowid=?\",\n/* 8  */  \"SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1\",\n/* 9  */  \"REPLACE INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)\",\n/* 10 */  \"SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)\",\n/* 11 */  \"REPLACE INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)\",\n\n          /* Return segments in order from oldest to newest.*/ \n/* 12 */  \"SELECT idx, start_block, leaves_end_block, end_block, root \"\n            \"FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC\",\n/* 13 */  \"SELECT idx, start_block, leaves_end_block, end_block, root \"\n            \"FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\"\n            \"ORDER BY level DESC, idx ASC\",\n\n/* 14 */  \"SELECT count(*) FROM %Q.'%q_segdir' WHERE level = ?\",\n/* 15 */  \"SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\",\n\n/* 16 */  \"DELETE FROM %Q.'%q_segdir' WHERE level = ?\",\n/* 17 */  \"DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?\",\n/* 18 */  \"INSERT INTO %Q.'%q_content' VALUES(%s)\",\n/* 19 */  \"DELETE FROM %Q.'%q_docsize' WHERE docid = ?\",\n/* 20 */  \"REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\",\n/* 21 */  \"SELECT size FROM %Q.'%q_docsize' WHERE docid=?\",\n/* 22 */  \"SELECT value FROM %Q.'%q_stat' WHERE id=?\",\n/* 23 */  \"REPLACE INTO %Q.'%q_stat' VALUES(?,?)\",\n/* 24 */  \"\",\n/* 25 */  \"\",\n\n/* 26 */ \"DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\",\n/* 27 */ \"SELECT ? UNION SELECT level / (1024 * ?) FROM %Q.'%q_segdir'\",\n\n/* This statement is used to determine which level to read the input from\n** when performing an incremental merge. It returns the absolute level number\n** of the oldest level in the db that contains at least ? segments. Or,\n** if no level in the FTS index contains more than ? segments, the statement\n** returns zero rows.  */\n/* 28 */ \"SELECT level, count(*) AS cnt FROM %Q.'%q_segdir' \"\n         \"  GROUP BY level HAVING cnt>=?\"\n         \"  ORDER BY (level %% 1024) ASC LIMIT 1\",\n\n/* Estimate the upper limit on the number of leaf nodes in a new segment\n** created by merging the oldest :2 segments from absolute level :1. See \n** function sqlite3Fts3Incrmerge() for details.  */\n/* 29 */ \"SELECT 2 * total(1 + leaves_end_block - start_block) \"\n         \"  FROM %Q.'%q_segdir' WHERE level = ? AND idx < ?\",\n\n/* SQL_DELETE_SEGDIR_ENTRY\n**   Delete the %_segdir entry on absolute level :1 with index :2.  */\n/* 30 */ \"DELETE FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?\",\n\n/* SQL_SHIFT_SEGDIR_ENTRY\n**   Modify the idx value for the segment with idx=:3 on absolute level :2\n**   to :1.  */\n/* 31 */ \"UPDATE %Q.'%q_segdir' SET idx = ? WHERE level=? AND idx=?\",\n\n/* SQL_SELECT_SEGDIR\n**   Read a single entry from the %_segdir table. The entry from absolute \n**   level :1 with index value :2.  */\n/* 32 */  \"SELECT idx, start_block, leaves_end_block, end_block, root \"\n            \"FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?\",\n\n/* SQL_CHOMP_SEGDIR\n**   Update the start_block (:1) and root (:2) fields of the %_segdir\n**   entry located on absolute level :3 with index :4.  */\n/* 33 */  \"UPDATE %Q.'%q_segdir' SET start_block = ?, root = ?\"\n            \"WHERE level = ? AND idx = ?\",\n\n/* SQL_SEGMENT_IS_APPENDABLE\n**   Return a single row if the segment with end_block=? is appendable. Or\n**   no rows otherwise.  */\n/* 34 */  \"SELECT 1 FROM %Q.'%q_segments' WHERE blockid=? AND block IS NULL\",\n\n/* SQL_SELECT_INDEXES\n**   Return the list of valid segment indexes for absolute level ?  */\n/* 35 */  \"SELECT idx FROM %Q.'%q_segdir' WHERE level=? ORDER BY 1 ASC\",\n\n/* SQL_SELECT_MXLEVEL\n**   Return the largest relative level in the FTS index or indexes.  */\n/* 36 */  \"SELECT max( level %% 1024 ) FROM %Q.'%q_segdir'\",\n\n          /* Return segments in order from oldest to newest.*/ \n/* 37 */  \"SELECT level, idx, end_block \"\n            \"FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? \"\n            \"ORDER BY level DESC, idx ASC\",\n\n          /* Update statements used while promoting segments */\n/* 38 */  \"UPDATE OR FAIL %Q.'%q_segdir' SET level=-1,idx=? \"\n            \"WHERE level=? AND idx=?\",\n/* 39 */  \"UPDATE OR FAIL %Q.'%q_segdir' SET level=? WHERE level=-1\"\n\n  };\n  int rc = SQLITE_OK;\n  sqlite3_stmt *pStmt;\n\n  assert( SizeofArray(azSql)==SizeofArray(p->aStmt) );\n  assert( eStmt<SizeofArray(azSql) && eStmt>=0 );\n  \n  pStmt = p->aStmt[eStmt];\n  if( !pStmt ){\n    char *zSql;\n    if( eStmt==SQL_CONTENT_INSERT ){\n      zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist);\n    }else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){\n      zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist);\n    }else{\n      zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName);\n    }\n    if( !zSql ){\n      rc = SQLITE_NOMEM;\n    }else{\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, NULL);\n      sqlite3_free(zSql);\n      assert( rc==SQLITE_OK || pStmt==0 );\n      p->aStmt[eStmt] = pStmt;\n    }\n  }\n  if( apVal ){\n    int i;\n    int nParam = sqlite3_bind_parameter_count(pStmt);\n    for(i=0; rc==SQLITE_OK && i<nParam; i++){\n      rc = sqlite3_bind_value(pStmt, i+1, apVal[i]);\n    }\n  }\n  *pp = pStmt;\n  return rc;\n}\n\n\nstatic int fts3SelectDocsize(\n  Fts3Table *pTab,                /* FTS3 table handle */\n  sqlite3_int64 iDocid,           /* Docid to bind for SQL_SELECT_DOCSIZE */\n  sqlite3_stmt **ppStmt           /* OUT: Statement handle */\n){\n  sqlite3_stmt *pStmt = 0;        /* Statement requested from fts3SqlStmt() */\n  int rc;                         /* Return code */\n\n  rc = fts3SqlStmt(pTab, SQL_SELECT_DOCSIZE, &pStmt, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pStmt, 1, iDocid);\n    rc = sqlite3_step(pStmt);\n    if( rc!=SQLITE_ROW || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB ){\n      rc = sqlite3_reset(pStmt);\n      if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB;\n      pStmt = 0;\n    }else{\n      rc = SQLITE_OK;\n    }\n  }\n\n  *ppStmt = pStmt;\n  return rc;\n}\n\nint sqlite3Fts3SelectDoctotal(\n  Fts3Table *pTab,                /* Fts3 table handle */\n  sqlite3_stmt **ppStmt           /* OUT: Statement handle */\n){\n  sqlite3_stmt *pStmt = 0;\n  int rc;\n  rc = fts3SqlStmt(pTab, SQL_SELECT_STAT, &pStmt, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL);\n    if( sqlite3_step(pStmt)!=SQLITE_ROW\n     || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB\n    ){\n      rc = sqlite3_reset(pStmt);\n      if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB;\n      pStmt = 0;\n    }\n  }\n  *ppStmt = pStmt;\n  return rc;\n}\n\nint sqlite3Fts3SelectDocsize(\n  Fts3Table *pTab,                /* Fts3 table handle */\n  sqlite3_int64 iDocid,           /* Docid to read size data for */\n  sqlite3_stmt **ppStmt           /* OUT: Statement handle */\n){\n  return fts3SelectDocsize(pTab, iDocid, ppStmt);\n}\n\n/*\n** Similar to fts3SqlStmt(). Except, after binding the parameters in\n** array apVal[] to the SQL statement identified by eStmt, the statement\n** is executed.\n**\n** Returns SQLITE_OK if the statement is successfully executed, or an\n** SQLite error code otherwise.\n*/\nstatic void fts3SqlExec(\n  int *pRC,                /* Result code */\n  Fts3Table *p,            /* The FTS3 table */\n  int eStmt,               /* Index of statement to evaluate */\n  sqlite3_value **apVal    /* Parameters to bind */\n){\n  sqlite3_stmt *pStmt;\n  int rc;\n  if( *pRC ) return;\n  rc = fts3SqlStmt(p, eStmt, &pStmt, apVal); \n  if( rc==SQLITE_OK ){\n    sqlite3_step(pStmt);\n    rc = sqlite3_reset(pStmt);\n  }\n  *pRC = rc;\n}\n\n\n/*\n** This function ensures that the caller has obtained an exclusive \n** shared-cache table-lock on the %_segdir table. This is required before \n** writing data to the fts3 table. If this lock is not acquired first, then\n** the caller may end up attempting to take this lock as part of committing\n** a transaction, causing SQLite to return SQLITE_LOCKED or \n** LOCKED_SHAREDCACHEto a COMMIT command.\n**\n** It is best to avoid this because if FTS3 returns any error when \n** committing a transaction, the whole transaction will be rolled back. \n** And this is not what users expect when they get SQLITE_LOCKED_SHAREDCACHE. \n** It can still happen if the user locks the underlying tables directly \n** instead of accessing them via FTS.\n*/\nstatic int fts3Writelock(Fts3Table *p){\n  int rc = SQLITE_OK;\n  \n  if( p->nPendingData==0 ){\n    sqlite3_stmt *pStmt;\n    rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pStmt, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_null(pStmt, 1);\n      sqlite3_step(pStmt);\n      rc = sqlite3_reset(pStmt);\n    }\n  }\n\n  return rc;\n}\n\n/*\n** FTS maintains a separate indexes for each language-id (a 32-bit integer).\n** Within each language id, a separate index is maintained to store the\n** document terms, and each configured prefix size (configured the FTS \n** \"prefix=\" option). And each index consists of multiple levels (\"relative\n** levels\").\n**\n** All three of these values (the language id, the specific index and the\n** level within the index) are encoded in 64-bit integer values stored\n** in the %_segdir table on disk. This function is used to convert three\n** separate component values into the single 64-bit integer value that\n** can be used to query the %_segdir table.\n**\n** Specifically, each language-id/index combination is allocated 1024 \n** 64-bit integer level values (\"absolute levels\"). The main terms index\n** for language-id 0 is allocate values 0-1023. The first prefix index\n** (if any) for language-id 0 is allocated values 1024-2047. And so on.\n** Language 1 indexes are allocated immediately following language 0.\n**\n** So, for a system with nPrefix prefix indexes configured, the block of\n** absolute levels that corresponds to language-id iLangid and index \n** iIndex starts at absolute level ((iLangid * (nPrefix+1) + iIndex) * 1024).\n*/\nstatic sqlite3_int64 getAbsoluteLevel(\n  Fts3Table *p,                   /* FTS3 table handle */\n  int iLangid,                    /* Language id */\n  int iIndex,                     /* Index in p->aIndex[] */\n  int iLevel                      /* Level of segments */\n){\n  sqlite3_int64 iBase;            /* First absolute level for iLangid/iIndex */\n  assert( iLangid>=0 );\n  assert( p->nIndex>0 );\n  assert( iIndex>=0 && iIndex<p->nIndex );\n\n  iBase = ((sqlite3_int64)iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL;\n  return iBase + iLevel;\n}\n\n/*\n** Set *ppStmt to a statement handle that may be used to iterate through\n** all rows in the %_segdir table, from oldest to newest. If successful,\n** return SQLITE_OK. If an error occurs while preparing the statement, \n** return an SQLite error code.\n**\n** There is only ever one instance of this SQL statement compiled for\n** each FTS3 table.\n**\n** The statement returns the following columns from the %_segdir table:\n**\n**   0: idx\n**   1: start_block\n**   2: leaves_end_block\n**   3: end_block\n**   4: root\n*/\nint sqlite3Fts3AllSegdirs(\n  Fts3Table *p,                   /* FTS3 table */\n  int iLangid,                    /* Language being queried */\n  int iIndex,                     /* Index for p->aIndex[] */\n  int iLevel,                     /* Level to select (relative level) */\n  sqlite3_stmt **ppStmt           /* OUT: Compiled statement */\n){\n  int rc;\n  sqlite3_stmt *pStmt = 0;\n\n  assert( iLevel==FTS3_SEGCURSOR_ALL || iLevel>=0 );\n  assert( iLevel<FTS3_SEGDIR_MAXLEVEL );\n  assert( iIndex>=0 && iIndex<p->nIndex );\n\n  if( iLevel<0 ){\n    /* \"SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ...\" */\n    rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE, &pStmt, 0);\n    if( rc==SQLITE_OK ){ \n      sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0));\n      sqlite3_bind_int64(pStmt, 2, \n          getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1)\n      );\n    }\n  }else{\n    /* \"SELECT * FROM %_segdir WHERE level = ? ORDER BY ...\" */\n    rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0);\n    if( rc==SQLITE_OK ){ \n      sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex,iLevel));\n    }\n  }\n  *ppStmt = pStmt;\n  return rc;\n}\n\n\n/*\n** Append a single varint to a PendingList buffer. SQLITE_OK is returned\n** if successful, or an SQLite error code otherwise.\n**\n** This function also serves to allocate the PendingList structure itself.\n** For example, to create a new PendingList structure containing two\n** varints:\n**\n**   PendingList *p = 0;\n**   fts3PendingListAppendVarint(&p, 1);\n**   fts3PendingListAppendVarint(&p, 2);\n*/\nstatic int fts3PendingListAppendVarint(\n  PendingList **pp,               /* IN/OUT: Pointer to PendingList struct */\n  sqlite3_int64 i                 /* Value to append to data */\n){\n  PendingList *p = *pp;\n\n  /* Allocate or grow the PendingList as required. */\n  if( !p ){\n    p = sqlite3_malloc(sizeof(*p) + 100);\n    if( !p ){\n      return SQLITE_NOMEM;\n    }\n    p->nSpace = 100;\n    p->aData = (char *)&p[1];\n    p->nData = 0;\n  }\n  else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){\n    int nNew = p->nSpace * 2;\n    p = sqlite3_realloc(p, sizeof(*p) + nNew);\n    if( !p ){\n      sqlite3_free(*pp);\n      *pp = 0;\n      return SQLITE_NOMEM;\n    }\n    p->nSpace = nNew;\n    p->aData = (char *)&p[1];\n  }\n\n  /* Append the new serialized varint to the end of the list. */\n  p->nData += sqlite3Fts3PutVarint(&p->aData[p->nData], i);\n  p->aData[p->nData] = '\\0';\n  *pp = p;\n  return SQLITE_OK;\n}\n\n/*\n** Add a docid/column/position entry to a PendingList structure. Non-zero\n** is returned if the structure is sqlite3_realloced as part of adding\n** the entry. Otherwise, zero.\n**\n** If an OOM error occurs, *pRc is set to SQLITE_NOMEM before returning.\n** Zero is always returned in this case. Otherwise, if no OOM error occurs,\n** it is set to SQLITE_OK.\n*/\nstatic int fts3PendingListAppend(\n  PendingList **pp,               /* IN/OUT: PendingList structure */\n  sqlite3_int64 iDocid,           /* Docid for entry to add */\n  sqlite3_int64 iCol,             /* Column for entry to add */\n  sqlite3_int64 iPos,             /* Position of term for entry to add */\n  int *pRc                        /* OUT: Return code */\n){\n  PendingList *p = *pp;\n  int rc = SQLITE_OK;\n\n  assert( !p || p->iLastDocid<=iDocid );\n\n  if( !p || p->iLastDocid!=iDocid ){\n    sqlite3_int64 iDelta = iDocid - (p ? p->iLastDocid : 0);\n    if( p ){\n      assert( p->nData<p->nSpace );\n      assert( p->aData[p->nData]==0 );\n      p->nData++;\n    }\n    if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iDelta)) ){\n      goto pendinglistappend_out;\n    }\n    p->iLastCol = -1;\n    p->iLastPos = 0;\n    p->iLastDocid = iDocid;\n  }\n  if( iCol>0 && p->iLastCol!=iCol ){\n    if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, 1))\n     || SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iCol))\n    ){\n      goto pendinglistappend_out;\n    }\n    p->iLastCol = iCol;\n    p->iLastPos = 0;\n  }\n  if( iCol>=0 ){\n    assert( iPos>p->iLastPos || (iPos==0 && p->iLastPos==0) );\n    rc = fts3PendingListAppendVarint(&p, 2+iPos-p->iLastPos);\n    if( rc==SQLITE_OK ){\n      p->iLastPos = iPos;\n    }\n  }\n\n pendinglistappend_out:\n  *pRc = rc;\n  if( p!=*pp ){\n    *pp = p;\n    return 1;\n  }\n  return 0;\n}\n\n/*\n** Free a PendingList object allocated by fts3PendingListAppend().\n*/\nstatic void fts3PendingListDelete(PendingList *pList){\n  sqlite3_free(pList);\n}\n\n/*\n** Add an entry to one of the pending-terms hash tables.\n*/\nstatic int fts3PendingTermsAddOne(\n  Fts3Table *p,\n  int iCol,\n  int iPos,\n  Fts3Hash *pHash,                /* Pending terms hash table to add entry to */\n  const char *zToken,\n  int nToken\n){\n  PendingList *pList;\n  int rc = SQLITE_OK;\n\n  pList = (PendingList *)fts3HashFind(pHash, zToken, nToken);\n  if( pList ){\n    p->nPendingData -= (pList->nData + nToken + sizeof(Fts3HashElem));\n  }\n  if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){\n    if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){\n      /* Malloc failed while inserting the new entry. This can only \n      ** happen if there was no previous entry for this token.\n      */\n      assert( 0==fts3HashFind(pHash, zToken, nToken) );\n      sqlite3_free(pList);\n      rc = SQLITE_NOMEM;\n    }\n  }\n  if( rc==SQLITE_OK ){\n    p->nPendingData += (pList->nData + nToken + sizeof(Fts3HashElem));\n  }\n  return rc;\n}\n\n/*\n** Tokenize the nul-terminated string zText and add all tokens to the\n** pending-terms hash-table. The docid used is that currently stored in\n** p->iPrevDocid, and the column is specified by argument iCol.\n**\n** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code.\n*/\nstatic int fts3PendingTermsAdd(\n  Fts3Table *p,                   /* Table into which text will be inserted */\n  int iLangid,                    /* Language id to use */\n  const char *zText,              /* Text of document to be inserted */\n  int iCol,                       /* Column into which text is being inserted */\n  u32 *pnWord                     /* IN/OUT: Incr. by number tokens inserted */\n){\n  int rc;\n  int iStart = 0;\n  int iEnd = 0;\n  int iPos = 0;\n  int nWord = 0;\n\n  char const *zToken;\n  int nToken = 0;\n\n  sqlite3_tokenizer *pTokenizer = p->pTokenizer;\n  sqlite3_tokenizer_module const *pModule = pTokenizer->pModule;\n  sqlite3_tokenizer_cursor *pCsr;\n  int (*xNext)(sqlite3_tokenizer_cursor *pCursor,\n      const char**,int*,int*,int*,int*);\n\n  assert( pTokenizer && pModule );\n\n  /* If the user has inserted a NULL value, this function may be called with\n  ** zText==0. In this case, add zero token entries to the hash table and \n  ** return early. */\n  if( zText==0 ){\n    *pnWord = 0;\n    return SQLITE_OK;\n  }\n\n  rc = sqlite3Fts3OpenTokenizer(pTokenizer, iLangid, zText, -1, &pCsr);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  xNext = pModule->xNext;\n  while( SQLITE_OK==rc\n      && SQLITE_OK==(rc = xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos))\n  ){\n    int i;\n    if( iPos>=nWord ) nWord = iPos+1;\n\n    /* Positions cannot be negative; we use -1 as a terminator internally.\n    ** Tokens must have a non-zero length.\n    */\n    if( iPos<0 || !zToken || nToken<=0 ){\n      rc = SQLITE_ERROR;\n      break;\n    }\n\n    /* Add the term to the terms index */\n    rc = fts3PendingTermsAddOne(\n        p, iCol, iPos, &p->aIndex[0].hPending, zToken, nToken\n    );\n    \n    /* Add the term to each of the prefix indexes that it is not too \n    ** short for. */\n    for(i=1; rc==SQLITE_OK && i<p->nIndex; i++){\n      struct Fts3Index *pIndex = &p->aIndex[i];\n      if( nToken<pIndex->nPrefix ) continue;\n      rc = fts3PendingTermsAddOne(\n          p, iCol, iPos, &pIndex->hPending, zToken, pIndex->nPrefix\n      );\n    }\n  }\n\n  pModule->xClose(pCsr);\n  *pnWord += nWord;\n  return (rc==SQLITE_DONE ? SQLITE_OK : rc);\n}\n\n/* \n** Calling this function indicates that subsequent calls to \n** fts3PendingTermsAdd() are to add term/position-list pairs for the\n** contents of the document with docid iDocid.\n*/\nstatic int fts3PendingTermsDocid(\n  Fts3Table *p,                   /* Full-text table handle */\n  int bDelete,                    /* True if this op is a delete */\n  int iLangid,                    /* Language id of row being written */\n  sqlite_int64 iDocid             /* Docid of row being written */\n){\n  assert( iLangid>=0 );\n  assert( bDelete==1 || bDelete==0 );\n\n  /* TODO(shess) Explore whether partially flushing the buffer on\n  ** forced-flush would provide better performance.  I suspect that if\n  ** we ordered the doclists by size and flushed the largest until the\n  ** buffer was half empty, that would let the less frequent terms\n  ** generate longer doclists.\n  */\n  if( iDocid<p->iPrevDocid \n   || (iDocid==p->iPrevDocid && p->bPrevDelete==0)\n   || p->iPrevLangid!=iLangid\n   || p->nPendingData>p->nMaxPendingData \n  ){\n    int rc = sqlite3Fts3PendingTermsFlush(p);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n  p->iPrevDocid = iDocid;\n  p->iPrevLangid = iLangid;\n  p->bPrevDelete = bDelete;\n  return SQLITE_OK;\n}\n\n/*\n** Discard the contents of the pending-terms hash tables. \n*/\nvoid sqlite3Fts3PendingTermsClear(Fts3Table *p){\n  int i;\n  for(i=0; i<p->nIndex; i++){\n    Fts3HashElem *pElem;\n    Fts3Hash *pHash = &p->aIndex[i].hPending;\n    for(pElem=fts3HashFirst(pHash); pElem; pElem=fts3HashNext(pElem)){\n      PendingList *pList = (PendingList *)fts3HashData(pElem);\n      fts3PendingListDelete(pList);\n    }\n    fts3HashClear(pHash);\n  }\n  p->nPendingData = 0;\n}\n\n/*\n** This function is called by the xUpdate() method as part of an INSERT\n** operation. It adds entries for each term in the new record to the\n** pendingTerms hash table.\n**\n** Argument apVal is the same as the similarly named argument passed to\n** fts3InsertData(). Parameter iDocid is the docid of the new row.\n*/\nstatic int fts3InsertTerms(\n  Fts3Table *p, \n  int iLangid, \n  sqlite3_value **apVal, \n  u32 *aSz\n){\n  int i;                          /* Iterator variable */\n  for(i=2; i<p->nColumn+2; i++){\n    int iCol = i-2;\n    if( p->abNotindexed[iCol]==0 ){\n      const char *zText = (const char *)sqlite3_value_text(apVal[i]);\n      int rc = fts3PendingTermsAdd(p, iLangid, zText, iCol, &aSz[iCol]);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      aSz[p->nColumn] += sqlite3_value_bytes(apVal[i]);\n    }\n  }\n  return SQLITE_OK;\n}\n\n/*\n** This function is called by the xUpdate() method for an INSERT operation.\n** The apVal parameter is passed a copy of the apVal argument passed by\n** SQLite to the xUpdate() method. i.e:\n**\n**   apVal[0]                Not used for INSERT.\n**   apVal[1]                rowid\n**   apVal[2]                Left-most user-defined column\n**   ...\n**   apVal[p->nColumn+1]     Right-most user-defined column\n**   apVal[p->nColumn+2]     Hidden column with same name as table\n**   apVal[p->nColumn+3]     Hidden \"docid\" column (alias for rowid)\n**   apVal[p->nColumn+4]     Hidden languageid column\n*/\nstatic int fts3InsertData(\n  Fts3Table *p,                   /* Full-text table */\n  sqlite3_value **apVal,          /* Array of values to insert */\n  sqlite3_int64 *piDocid          /* OUT: Docid for row just inserted */\n){\n  int rc;                         /* Return code */\n  sqlite3_stmt *pContentInsert;   /* INSERT INTO %_content VALUES(...) */\n\n  if( p->zContentTbl ){\n    sqlite3_value *pRowid = apVal[p->nColumn+3];\n    if( sqlite3_value_type(pRowid)==SQLITE_NULL ){\n      pRowid = apVal[1];\n    }\n    if( sqlite3_value_type(pRowid)!=SQLITE_INTEGER ){\n      return SQLITE_CONSTRAINT;\n    }\n    *piDocid = sqlite3_value_int64(pRowid);\n    return SQLITE_OK;\n  }\n\n  /* Locate the statement handle used to insert data into the %_content\n  ** table. The SQL for this statement is:\n  **\n  **   INSERT INTO %_content VALUES(?, ?, ?, ...)\n  **\n  ** The statement features N '?' variables, where N is the number of user\n  ** defined columns in the FTS3 table, plus one for the docid field.\n  */\n  rc = fts3SqlStmt(p, SQL_CONTENT_INSERT, &pContentInsert, &apVal[1]);\n  if( rc==SQLITE_OK && p->zLanguageid ){\n    rc = sqlite3_bind_int(\n        pContentInsert, p->nColumn+2, \n        sqlite3_value_int(apVal[p->nColumn+4])\n    );\n  }\n  if( rc!=SQLITE_OK ) return rc;\n\n  /* There is a quirk here. The users INSERT statement may have specified\n  ** a value for the \"rowid\" field, for the \"docid\" field, or for both.\n  ** Which is a problem, since \"rowid\" and \"docid\" are aliases for the\n  ** same value. For example:\n  **\n  **   INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2);\n  **\n  ** In FTS3, this is an error. It is an error to specify non-NULL values\n  ** for both docid and some other rowid alias.\n  */\n  if( SQLITE_NULL!=sqlite3_value_type(apVal[3+p->nColumn]) ){\n    if( SQLITE_NULL==sqlite3_value_type(apVal[0])\n     && SQLITE_NULL!=sqlite3_value_type(apVal[1])\n    ){\n      /* A rowid/docid conflict. */\n      return SQLITE_ERROR;\n    }\n    rc = sqlite3_bind_value(pContentInsert, 1, apVal[3+p->nColumn]);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n\n  /* Execute the statement to insert the record. Set *piDocid to the \n  ** new docid value. \n  */\n  sqlite3_step(pContentInsert);\n  rc = sqlite3_reset(pContentInsert);\n\n  *piDocid = sqlite3_last_insert_rowid(p->db);\n  return rc;\n}\n\n\n\n/*\n** Remove all data from the FTS3 table. Clear the hash table containing\n** pending terms.\n*/\nstatic int fts3DeleteAll(Fts3Table *p, int bContent){\n  int rc = SQLITE_OK;             /* Return code */\n\n  /* Discard the contents of the pending-terms hash table. */\n  sqlite3Fts3PendingTermsClear(p);\n\n  /* Delete everything from the shadow tables. Except, leave %_content as\n  ** is if bContent is false.  */\n  assert( p->zContentTbl==0 || bContent==0 );\n  if( bContent ) fts3SqlExec(&rc, p, SQL_DELETE_ALL_CONTENT, 0);\n  fts3SqlExec(&rc, p, SQL_DELETE_ALL_SEGMENTS, 0);\n  fts3SqlExec(&rc, p, SQL_DELETE_ALL_SEGDIR, 0);\n  if( p->bHasDocsize ){\n    fts3SqlExec(&rc, p, SQL_DELETE_ALL_DOCSIZE, 0);\n  }\n  if( p->bHasStat ){\n    fts3SqlExec(&rc, p, SQL_DELETE_ALL_STAT, 0);\n  }\n  return rc;\n}\n\n/*\n**\n*/\nstatic int langidFromSelect(Fts3Table *p, sqlite3_stmt *pSelect){\n  int iLangid = 0;\n  if( p->zLanguageid ) iLangid = sqlite3_column_int(pSelect, p->nColumn+1);\n  return iLangid;\n}\n\n/*\n** The first element in the apVal[] array is assumed to contain the docid\n** (an integer) of a row about to be deleted. Remove all terms from the\n** full-text index.\n*/\nstatic void fts3DeleteTerms( \n  int *pRC,               /* Result code */\n  Fts3Table *p,           /* The FTS table to delete from */\n  sqlite3_value *pRowid,  /* The docid to be deleted */\n  u32 *aSz,               /* Sizes of deleted document written here */\n  int *pbFound            /* OUT: Set to true if row really does exist */\n){\n  int rc;\n  sqlite3_stmt *pSelect;\n\n  assert( *pbFound==0 );\n  if( *pRC ) return;\n  rc = fts3SqlStmt(p, SQL_SELECT_CONTENT_BY_ROWID, &pSelect, &pRowid);\n  if( rc==SQLITE_OK ){\n    if( SQLITE_ROW==sqlite3_step(pSelect) ){\n      int i;\n      int iLangid = langidFromSelect(p, pSelect);\n      i64 iDocid = sqlite3_column_int64(pSelect, 0);\n      rc = fts3PendingTermsDocid(p, 1, iLangid, iDocid);\n      for(i=1; rc==SQLITE_OK && i<=p->nColumn; i++){\n        int iCol = i-1;\n        if( p->abNotindexed[iCol]==0 ){\n          const char *zText = (const char *)sqlite3_column_text(pSelect, i);\n          rc = fts3PendingTermsAdd(p, iLangid, zText, -1, &aSz[iCol]);\n          aSz[p->nColumn] += sqlite3_column_bytes(pSelect, i);\n        }\n      }\n      if( rc!=SQLITE_OK ){\n        sqlite3_reset(pSelect);\n        *pRC = rc;\n        return;\n      }\n      *pbFound = 1;\n    }\n    rc = sqlite3_reset(pSelect);\n  }else{\n    sqlite3_reset(pSelect);\n  }\n  *pRC = rc;\n}\n\n/*\n** Forward declaration to account for the circular dependency between\n** functions fts3SegmentMerge() and fts3AllocateSegdirIdx().\n*/\nstatic int fts3SegmentMerge(Fts3Table *, int, int, int);\n\n/* \n** This function allocates a new level iLevel index in the segdir table.\n** Usually, indexes are allocated within a level sequentially starting\n** with 0, so the allocated index is one greater than the value returned\n** by:\n**\n**   SELECT max(idx) FROM %_segdir WHERE level = :iLevel\n**\n** However, if there are already FTS3_MERGE_COUNT indexes at the requested\n** level, they are merged into a single level (iLevel+1) segment and the \n** allocated index is 0.\n**\n** If successful, *piIdx is set to the allocated index slot and SQLITE_OK\n** returned. Otherwise, an SQLite error code is returned.\n*/\nstatic int fts3AllocateSegdirIdx(\n  Fts3Table *p, \n  int iLangid,                    /* Language id */\n  int iIndex,                     /* Index for p->aIndex */\n  int iLevel, \n  int *piIdx\n){\n  int rc;                         /* Return Code */\n  sqlite3_stmt *pNextIdx;         /* Query for next idx at level iLevel */\n  int iNext = 0;                  /* Result of query pNextIdx */\n\n  assert( iLangid>=0 );\n  assert( p->nIndex>=1 );\n\n  /* Set variable iNext to the next available segdir index at level iLevel. */\n  rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pNextIdx, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(\n        pNextIdx, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel)\n    );\n    if( SQLITE_ROW==sqlite3_step(pNextIdx) ){\n      iNext = sqlite3_column_int(pNextIdx, 0);\n    }\n    rc = sqlite3_reset(pNextIdx);\n  }\n\n  if( rc==SQLITE_OK ){\n    /* If iNext is FTS3_MERGE_COUNT, indicating that level iLevel is already\n    ** full, merge all segments in level iLevel into a single iLevel+1\n    ** segment and allocate (newly freed) index 0 at level iLevel. Otherwise,\n    ** if iNext is less than FTS3_MERGE_COUNT, allocate index iNext.\n    */\n    if( iNext>=FTS3_MERGE_COUNT ){\n      fts3LogMerge(16, getAbsoluteLevel(p, iLangid, iIndex, iLevel));\n      rc = fts3SegmentMerge(p, iLangid, iIndex, iLevel);\n      *piIdx = 0;\n    }else{\n      *piIdx = iNext;\n    }\n  }\n\n  return rc;\n}\n\n/*\n** The %_segments table is declared as follows:\n**\n**   CREATE TABLE %_segments(blockid INTEGER PRIMARY KEY, block BLOB)\n**\n** This function reads data from a single row of the %_segments table. The\n** specific row is identified by the iBlockid parameter. If paBlob is not\n** NULL, then a buffer is allocated using sqlite3_malloc() and populated\n** with the contents of the blob stored in the \"block\" column of the \n** identified table row is. Whether or not paBlob is NULL, *pnBlob is set\n** to the size of the blob in bytes before returning.\n**\n** If an error occurs, or the table does not contain the specified row,\n** an SQLite error code is returned. Otherwise, SQLITE_OK is returned. If\n** paBlob is non-NULL, then it is the responsibility of the caller to\n** eventually free the returned buffer.\n**\n** This function may leave an open sqlite3_blob* handle in the\n** Fts3Table.pSegments variable. This handle is reused by subsequent calls\n** to this function. The handle may be closed by calling the\n** sqlite3Fts3SegmentsClose() function. Reusing a blob handle is a handy\n** performance improvement, but the blob handle should always be closed\n** before control is returned to the user (to prevent a lock being held\n** on the database file for longer than necessary). Thus, any virtual table\n** method (xFilter etc.) that may directly or indirectly call this function\n** must call sqlite3Fts3SegmentsClose() before returning.\n*/\nint sqlite3Fts3ReadBlock(\n  Fts3Table *p,                   /* FTS3 table handle */\n  sqlite3_int64 iBlockid,         /* Access the row with blockid=$iBlockid */\n  char **paBlob,                  /* OUT: Blob data in malloc'd buffer */\n  int *pnBlob,                    /* OUT: Size of blob data */\n  int *pnLoad                     /* OUT: Bytes actually loaded */\n){\n  int rc;                         /* Return code */\n\n  /* pnBlob must be non-NULL. paBlob may be NULL or non-NULL. */\n  assert( pnBlob );\n\n  if( p->pSegments ){\n    rc = sqlite3_blob_reopen(p->pSegments, iBlockid);\n  }else{\n    if( 0==p->zSegmentsTbl ){\n      p->zSegmentsTbl = sqlite3_mprintf(\"%s_segments\", p->zName);\n      if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM;\n    }\n    rc = sqlite3_blob_open(\n       p->db, p->zDb, p->zSegmentsTbl, \"block\", iBlockid, 0, &p->pSegments\n    );\n  }\n\n  if( rc==SQLITE_OK ){\n    int nByte = sqlite3_blob_bytes(p->pSegments);\n    *pnBlob = nByte;\n    if( paBlob ){\n      char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING);\n      if( !aByte ){\n        rc = SQLITE_NOMEM;\n      }else{\n        if( pnLoad && nByte>(FTS3_NODE_CHUNK_THRESHOLD) ){\n          nByte = FTS3_NODE_CHUNKSIZE;\n          *pnLoad = nByte;\n        }\n        rc = sqlite3_blob_read(p->pSegments, aByte, nByte, 0);\n        memset(&aByte[nByte], 0, FTS3_NODE_PADDING);\n        if( rc!=SQLITE_OK ){\n          sqlite3_free(aByte);\n          aByte = 0;\n        }\n      }\n      *paBlob = aByte;\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Close the blob handle at p->pSegments, if it is open. See comments above\n** the sqlite3Fts3ReadBlock() function for details.\n*/\nvoid sqlite3Fts3SegmentsClose(Fts3Table *p){\n  sqlite3_blob_close(p->pSegments);\n  p->pSegments = 0;\n}\n    \nstatic int fts3SegReaderIncrRead(Fts3SegReader *pReader){\n  int nRead;                      /* Number of bytes to read */\n  int rc;                         /* Return code */\n\n  nRead = MIN(pReader->nNode - pReader->nPopulate, FTS3_NODE_CHUNKSIZE);\n  rc = sqlite3_blob_read(\n      pReader->pBlob, \n      &pReader->aNode[pReader->nPopulate],\n      nRead,\n      pReader->nPopulate\n  );\n\n  if( rc==SQLITE_OK ){\n    pReader->nPopulate += nRead;\n    memset(&pReader->aNode[pReader->nPopulate], 0, FTS3_NODE_PADDING);\n    if( pReader->nPopulate==pReader->nNode ){\n      sqlite3_blob_close(pReader->pBlob);\n      pReader->pBlob = 0;\n      pReader->nPopulate = 0;\n    }\n  }\n  return rc;\n}\n\nstatic int fts3SegReaderRequire(Fts3SegReader *pReader, char *pFrom, int nByte){\n  int rc = SQLITE_OK;\n  assert( !pReader->pBlob \n       || (pFrom>=pReader->aNode && pFrom<&pReader->aNode[pReader->nNode])\n  );\n  while( pReader->pBlob && rc==SQLITE_OK \n     &&  (pFrom - pReader->aNode + nByte)>pReader->nPopulate\n  ){\n    rc = fts3SegReaderIncrRead(pReader);\n  }\n  return rc;\n}\n\n/*\n** Set an Fts3SegReader cursor to point at EOF.\n*/\nstatic void fts3SegReaderSetEof(Fts3SegReader *pSeg){\n  if( !fts3SegReaderIsRootOnly(pSeg) ){\n    sqlite3_free(pSeg->aNode);\n    sqlite3_blob_close(pSeg->pBlob);\n    pSeg->pBlob = 0;\n  }\n  pSeg->aNode = 0;\n}\n\n/*\n** Move the iterator passed as the first argument to the next term in the\n** segment. If successful, SQLITE_OK is returned. If there is no next term,\n** SQLITE_DONE. Otherwise, an SQLite error code.\n*/\nstatic int fts3SegReaderNext(\n  Fts3Table *p, \n  Fts3SegReader *pReader,\n  int bIncr\n){\n  int rc;                         /* Return code of various sub-routines */\n  char *pNext;                    /* Cursor variable */\n  int nPrefix;                    /* Number of bytes in term prefix */\n  int nSuffix;                    /* Number of bytes in term suffix */\n\n  if( !pReader->aDoclist ){\n    pNext = pReader->aNode;\n  }else{\n    pNext = &pReader->aDoclist[pReader->nDoclist];\n  }\n\n  if( !pNext || pNext>=&pReader->aNode[pReader->nNode] ){\n\n    if( fts3SegReaderIsPending(pReader) ){\n      Fts3HashElem *pElem = *(pReader->ppNextElem);\n      sqlite3_free(pReader->aNode);\n      pReader->aNode = 0;\n      if( pElem ){\n        char *aCopy;\n        PendingList *pList = (PendingList *)fts3HashData(pElem);\n        int nCopy = pList->nData+1;\n        pReader->zTerm = (char *)fts3HashKey(pElem);\n        pReader->nTerm = fts3HashKeysize(pElem);\n        aCopy = (char*)sqlite3_malloc(nCopy);\n        if( !aCopy ) return SQLITE_NOMEM;\n        memcpy(aCopy, pList->aData, nCopy);\n        pReader->nNode = pReader->nDoclist = nCopy;\n        pReader->aNode = pReader->aDoclist = aCopy;\n        pReader->ppNextElem++;\n        assert( pReader->aNode );\n      }\n      return SQLITE_OK;\n    }\n\n    fts3SegReaderSetEof(pReader);\n\n    /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf \n    ** blocks have already been traversed.  */\n    assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock );\n    if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){\n      return SQLITE_OK;\n    }\n\n    rc = sqlite3Fts3ReadBlock(\n        p, ++pReader->iCurrentBlock, &pReader->aNode, &pReader->nNode, \n        (bIncr ? &pReader->nPopulate : 0)\n    );\n    if( rc!=SQLITE_OK ) return rc;\n    assert( pReader->pBlob==0 );\n    if( bIncr && pReader->nPopulate<pReader->nNode ){\n      pReader->pBlob = p->pSegments;\n      p->pSegments = 0;\n    }\n    pNext = pReader->aNode;\n  }\n\n  assert( !fts3SegReaderIsPending(pReader) );\n\n  rc = fts3SegReaderRequire(pReader, pNext, FTS3_VARINT_MAX*2);\n  if( rc!=SQLITE_OK ) return rc;\n  \n  /* Because of the FTS3_NODE_PADDING bytes of padding, the following is \n  ** safe (no risk of overread) even if the node data is corrupted. */\n  pNext += fts3GetVarint32(pNext, &nPrefix);\n  pNext += fts3GetVarint32(pNext, &nSuffix);\n  if( nPrefix<0 || nSuffix<=0 \n   || &pNext[nSuffix]>&pReader->aNode[pReader->nNode] \n  ){\n    return FTS_CORRUPT_VTAB;\n  }\n\n  if( nPrefix+nSuffix>pReader->nTermAlloc ){\n    int nNew = (nPrefix+nSuffix)*2;\n    char *zNew = sqlite3_realloc(pReader->zTerm, nNew);\n    if( !zNew ){\n      return SQLITE_NOMEM;\n    }\n    pReader->zTerm = zNew;\n    pReader->nTermAlloc = nNew;\n  }\n\n  rc = fts3SegReaderRequire(pReader, pNext, nSuffix+FTS3_VARINT_MAX);\n  if( rc!=SQLITE_OK ) return rc;\n\n  memcpy(&pReader->zTerm[nPrefix], pNext, nSuffix);\n  pReader->nTerm = nPrefix+nSuffix;\n  pNext += nSuffix;\n  pNext += fts3GetVarint32(pNext, &pReader->nDoclist);\n  pReader->aDoclist = pNext;\n  pReader->pOffsetList = 0;\n\n  /* Check that the doclist does not appear to extend past the end of the\n  ** b-tree node. And that the final byte of the doclist is 0x00. If either \n  ** of these statements is untrue, then the data structure is corrupt.\n  */\n  if( &pReader->aDoclist[pReader->nDoclist]>&pReader->aNode[pReader->nNode] \n   || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])\n  ){\n    return FTS_CORRUPT_VTAB;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Set the SegReader to point to the first docid in the doclist associated\n** with the current term.\n*/\nstatic int fts3SegReaderFirstDocid(Fts3Table *pTab, Fts3SegReader *pReader){\n  int rc = SQLITE_OK;\n  assert( pReader->aDoclist );\n  assert( !pReader->pOffsetList );\n  if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){\n    u8 bEof = 0;\n    pReader->iDocid = 0;\n    pReader->nOffsetList = 0;\n    sqlite3Fts3DoclistPrev(0,\n        pReader->aDoclist, pReader->nDoclist, &pReader->pOffsetList, \n        &pReader->iDocid, &pReader->nOffsetList, &bEof\n    );\n  }else{\n    rc = fts3SegReaderRequire(pReader, pReader->aDoclist, FTS3_VARINT_MAX);\n    if( rc==SQLITE_OK ){\n      int n = sqlite3Fts3GetVarint(pReader->aDoclist, &pReader->iDocid);\n      pReader->pOffsetList = &pReader->aDoclist[n];\n    }\n  }\n  return rc;\n}\n\n/*\n** Advance the SegReader to point to the next docid in the doclist\n** associated with the current term.\n** \n** If arguments ppOffsetList and pnOffsetList are not NULL, then \n** *ppOffsetList is set to point to the first column-offset list\n** in the doclist entry (i.e. immediately past the docid varint).\n** *pnOffsetList is set to the length of the set of column-offset\n** lists, not including the nul-terminator byte. For example:\n*/\nstatic int fts3SegReaderNextDocid(\n  Fts3Table *pTab,\n  Fts3SegReader *pReader,         /* Reader to advance to next docid */\n  char **ppOffsetList,            /* OUT: Pointer to current position-list */\n  int *pnOffsetList               /* OUT: Length of *ppOffsetList in bytes */\n){\n  int rc = SQLITE_OK;\n  char *p = pReader->pOffsetList;\n  char c = 0;\n\n  assert( p );\n\n  if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){\n    /* A pending-terms seg-reader for an FTS4 table that uses order=desc.\n    ** Pending-terms doclists are always built up in ascending order, so\n    ** we have to iterate through them backwards here. */\n    u8 bEof = 0;\n    if( ppOffsetList ){\n      *ppOffsetList = pReader->pOffsetList;\n      *pnOffsetList = pReader->nOffsetList - 1;\n    }\n    sqlite3Fts3DoclistPrev(0,\n        pReader->aDoclist, pReader->nDoclist, &p, &pReader->iDocid,\n        &pReader->nOffsetList, &bEof\n    );\n    if( bEof ){\n      pReader->pOffsetList = 0;\n    }else{\n      pReader->pOffsetList = p;\n    }\n  }else{\n    char *pEnd = &pReader->aDoclist[pReader->nDoclist];\n\n    /* Pointer p currently points at the first byte of an offset list. The\n    ** following block advances it to point one byte past the end of\n    ** the same offset list. */\n    while( 1 ){\n  \n      /* The following line of code (and the \"p++\" below the while() loop) is\n      ** normally all that is required to move pointer p to the desired \n      ** position. The exception is if this node is being loaded from disk\n      ** incrementally and pointer \"p\" now points to the first byte past\n      ** the populated part of pReader->aNode[].\n      */\n      while( *p | c ) c = *p++ & 0x80;\n      assert( *p==0 );\n  \n      if( pReader->pBlob==0 || p<&pReader->aNode[pReader->nPopulate] ) break;\n      rc = fts3SegReaderIncrRead(pReader);\n      if( rc!=SQLITE_OK ) return rc;\n    }\n    p++;\n  \n    /* If required, populate the output variables with a pointer to and the\n    ** size of the previous offset-list.\n    */\n    if( ppOffsetList ){\n      *ppOffsetList = pReader->pOffsetList;\n      *pnOffsetList = (int)(p - pReader->pOffsetList - 1);\n    }\n\n    /* List may have been edited in place by fts3EvalNearTrim() */\n    while( p<pEnd && *p==0 ) p++;\n  \n    /* If there are no more entries in the doclist, set pOffsetList to\n    ** NULL. Otherwise, set Fts3SegReader.iDocid to the next docid and\n    ** Fts3SegReader.pOffsetList to point to the next offset list before\n    ** returning.\n    */\n    if( p>=pEnd ){\n      pReader->pOffsetList = 0;\n    }else{\n      rc = fts3SegReaderRequire(pReader, p, FTS3_VARINT_MAX);\n      if( rc==SQLITE_OK ){\n        sqlite3_int64 iDelta;\n        pReader->pOffsetList = p + sqlite3Fts3GetVarint(p, &iDelta);\n        if( pTab->bDescIdx ){\n          pReader->iDocid -= iDelta;\n        }else{\n          pReader->iDocid += iDelta;\n        }\n      }\n    }\n  }\n\n  return SQLITE_OK;\n}\n\n\nint sqlite3Fts3MsrOvfl(\n  Fts3Cursor *pCsr, \n  Fts3MultiSegReader *pMsr,\n  int *pnOvfl\n){\n  Fts3Table *p = (Fts3Table*)pCsr->base.pVtab;\n  int nOvfl = 0;\n  int ii;\n  int rc = SQLITE_OK;\n  int pgsz = p->nPgsz;\n\n  assert( p->bFts4 );\n  assert( pgsz>0 );\n\n  for(ii=0; rc==SQLITE_OK && ii<pMsr->nSegment; ii++){\n    Fts3SegReader *pReader = pMsr->apSegment[ii];\n    if( !fts3SegReaderIsPending(pReader) \n     && !fts3SegReaderIsRootOnly(pReader) \n    ){\n      sqlite3_int64 jj;\n      for(jj=pReader->iStartBlock; jj<=pReader->iLeafEndBlock; jj++){\n        int nBlob;\n        rc = sqlite3Fts3ReadBlock(p, jj, 0, &nBlob, 0);\n        if( rc!=SQLITE_OK ) break;\n        if( (nBlob+35)>pgsz ){\n          nOvfl += (nBlob + 34)/pgsz;\n        }\n      }\n    }\n  }\n  *pnOvfl = nOvfl;\n  return rc;\n}\n\n/*\n** Free all allocations associated with the iterator passed as the \n** second argument.\n*/\nvoid sqlite3Fts3SegReaderFree(Fts3SegReader *pReader){\n  if( pReader ){\n    if( !fts3SegReaderIsPending(pReader) ){\n      sqlite3_free(pReader->zTerm);\n    }\n    if( !fts3SegReaderIsRootOnly(pReader) ){\n      sqlite3_free(pReader->aNode);\n    }\n    sqlite3_blob_close(pReader->pBlob);\n  }\n  sqlite3_free(pReader);\n}\n\n/*\n** Allocate a new SegReader object.\n*/\nint sqlite3Fts3SegReaderNew(\n  int iAge,                       /* Segment \"age\". */\n  int bLookup,                    /* True for a lookup only */\n  sqlite3_int64 iStartLeaf,       /* First leaf to traverse */\n  sqlite3_int64 iEndLeaf,         /* Final leaf to traverse */\n  sqlite3_int64 iEndBlock,        /* Final block of segment */\n  const char *zRoot,              /* Buffer containing root node */\n  int nRoot,                      /* Size of buffer containing root node */\n  Fts3SegReader **ppReader        /* OUT: Allocated Fts3SegReader */\n){\n  Fts3SegReader *pReader;         /* Newly allocated SegReader object */\n  int nExtra = 0;                 /* Bytes to allocate segment root node */\n\n  assert( iStartLeaf<=iEndLeaf );\n  if( iStartLeaf==0 ){\n    nExtra = nRoot + FTS3_NODE_PADDING;\n  }\n\n  pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);\n  if( !pReader ){\n    return SQLITE_NOMEM;\n  }\n  memset(pReader, 0, sizeof(Fts3SegReader));\n  pReader->iIdx = iAge;\n  pReader->bLookup = bLookup!=0;\n  pReader->iStartBlock = iStartLeaf;\n  pReader->iLeafEndBlock = iEndLeaf;\n  pReader->iEndBlock = iEndBlock;\n\n  if( nExtra ){\n    /* The entire segment is stored in the root node. */\n    pReader->aNode = (char *)&pReader[1];\n    pReader->rootOnly = 1;\n    pReader->nNode = nRoot;\n    memcpy(pReader->aNode, zRoot, nRoot);\n    memset(&pReader->aNode[nRoot], 0, FTS3_NODE_PADDING);\n  }else{\n    pReader->iCurrentBlock = iStartLeaf-1;\n  }\n  *ppReader = pReader;\n  return SQLITE_OK;\n}\n\n/*\n** This is a comparison function used as a qsort() callback when sorting\n** an array of pending terms by term. This occurs as part of flushing\n** the contents of the pending-terms hash table to the database.\n*/\nstatic int SQLITE_CDECL fts3CompareElemByTerm(\n  const void *lhs,\n  const void *rhs\n){\n  char *z1 = fts3HashKey(*(Fts3HashElem **)lhs);\n  char *z2 = fts3HashKey(*(Fts3HashElem **)rhs);\n  int n1 = fts3HashKeysize(*(Fts3HashElem **)lhs);\n  int n2 = fts3HashKeysize(*(Fts3HashElem **)rhs);\n\n  int n = (n1<n2 ? n1 : n2);\n  int c = memcmp(z1, z2, n);\n  if( c==0 ){\n    c = n1 - n2;\n  }\n  return c;\n}\n\n/*\n** This function is used to allocate an Fts3SegReader that iterates through\n** a subset of the terms stored in the Fts3Table.pendingTerms array.\n**\n** If the isPrefixIter parameter is zero, then the returned SegReader iterates\n** through each term in the pending-terms table. Or, if isPrefixIter is\n** non-zero, it iterates through each term and its prefixes. For example, if\n** the pending terms hash table contains the terms \"sqlite\", \"mysql\" and\n** \"firebird\", then the iterator visits the following 'terms' (in the order\n** shown):\n**\n**   f fi fir fire fireb firebi firebir firebird\n**   m my mys mysq mysql\n**   s sq sql sqli sqlit sqlite\n**\n** Whereas if isPrefixIter is zero, the terms visited are:\n**\n**   firebird mysql sqlite\n*/\nint sqlite3Fts3SegReaderPending(\n  Fts3Table *p,                   /* Virtual table handle */\n  int iIndex,                     /* Index for p->aIndex */\n  const char *zTerm,              /* Term to search for */\n  int nTerm,                      /* Size of buffer zTerm */\n  int bPrefix,                    /* True for a prefix iterator */\n  Fts3SegReader **ppReader        /* OUT: SegReader for pending-terms */\n){\n  Fts3SegReader *pReader = 0;     /* Fts3SegReader object to return */\n  Fts3HashElem *pE;               /* Iterator variable */\n  Fts3HashElem **aElem = 0;       /* Array of term hash entries to scan */\n  int nElem = 0;                  /* Size of array at aElem */\n  int rc = SQLITE_OK;             /* Return Code */\n  Fts3Hash *pHash;\n\n  pHash = &p->aIndex[iIndex].hPending;\n  if( bPrefix ){\n    int nAlloc = 0;               /* Size of allocated array at aElem */\n\n    for(pE=fts3HashFirst(pHash); pE; pE=fts3HashNext(pE)){\n      char *zKey = (char *)fts3HashKey(pE);\n      int nKey = fts3HashKeysize(pE);\n      if( nTerm==0 || (nKey>=nTerm && 0==memcmp(zKey, zTerm, nTerm)) ){\n        if( nElem==nAlloc ){\n          Fts3HashElem **aElem2;\n          nAlloc += 16;\n          aElem2 = (Fts3HashElem **)sqlite3_realloc(\n              aElem, nAlloc*sizeof(Fts3HashElem *)\n          );\n          if( !aElem2 ){\n            rc = SQLITE_NOMEM;\n            nElem = 0;\n            break;\n          }\n          aElem = aElem2;\n        }\n\n        aElem[nElem++] = pE;\n      }\n    }\n\n    /* If more than one term matches the prefix, sort the Fts3HashElem\n    ** objects in term order using qsort(). This uses the same comparison\n    ** callback as is used when flushing terms to disk.\n    */\n    if( nElem>1 ){\n      qsort(aElem, nElem, sizeof(Fts3HashElem *), fts3CompareElemByTerm);\n    }\n\n  }else{\n    /* The query is a simple term lookup that matches at most one term in\n    ** the index. All that is required is a straight hash-lookup. \n    **\n    ** Because the stack address of pE may be accessed via the aElem pointer\n    ** below, the \"Fts3HashElem *pE\" must be declared so that it is valid\n    ** within this entire function, not just this \"else{...}\" block.\n    */\n    pE = fts3HashFindElem(pHash, zTerm, nTerm);\n    if( pE ){\n      aElem = &pE;\n      nElem = 1;\n    }\n  }\n\n  if( nElem>0 ){\n    int nByte = sizeof(Fts3SegReader) + (nElem+1)*sizeof(Fts3HashElem *);\n    pReader = (Fts3SegReader *)sqlite3_malloc(nByte);\n    if( !pReader ){\n      rc = SQLITE_NOMEM;\n    }else{\n      memset(pReader, 0, nByte);\n      pReader->iIdx = 0x7FFFFFFF;\n      pReader->ppNextElem = (Fts3HashElem **)&pReader[1];\n      memcpy(pReader->ppNextElem, aElem, nElem*sizeof(Fts3HashElem *));\n    }\n  }\n\n  if( bPrefix ){\n    sqlite3_free(aElem);\n  }\n  *ppReader = pReader;\n  return rc;\n}\n\n/*\n** Compare the entries pointed to by two Fts3SegReader structures. \n** Comparison is as follows:\n**\n**   1) EOF is greater than not EOF.\n**\n**   2) The current terms (if any) are compared using memcmp(). If one\n**      term is a prefix of another, the longer term is considered the\n**      larger.\n**\n**   3) By segment age. An older segment is considered larger.\n*/\nstatic int fts3SegReaderCmp(Fts3SegReader *pLhs, Fts3SegReader *pRhs){\n  int rc;\n  if( pLhs->aNode && pRhs->aNode ){\n    int rc2 = pLhs->nTerm - pRhs->nTerm;\n    if( rc2<0 ){\n      rc = memcmp(pLhs->zTerm, pRhs->zTerm, pLhs->nTerm);\n    }else{\n      rc = memcmp(pLhs->zTerm, pRhs->zTerm, pRhs->nTerm);\n    }\n    if( rc==0 ){\n      rc = rc2;\n    }\n  }else{\n    rc = (pLhs->aNode==0) - (pRhs->aNode==0);\n  }\n  if( rc==0 ){\n    rc = pRhs->iIdx - pLhs->iIdx;\n  }\n  assert( rc!=0 );\n  return rc;\n}\n\n/*\n** A different comparison function for SegReader structures. In this\n** version, it is assumed that each SegReader points to an entry in\n** a doclist for identical terms. Comparison is made as follows:\n**\n**   1) EOF (end of doclist in this case) is greater than not EOF.\n**\n**   2) By current docid.\n**\n**   3) By segment age. An older segment is considered larger.\n*/\nstatic int fts3SegReaderDoclistCmp(Fts3SegReader *pLhs, Fts3SegReader *pRhs){\n  int rc = (pLhs->pOffsetList==0)-(pRhs->pOffsetList==0);\n  if( rc==0 ){\n    if( pLhs->iDocid==pRhs->iDocid ){\n      rc = pRhs->iIdx - pLhs->iIdx;\n    }else{\n      rc = (pLhs->iDocid > pRhs->iDocid) ? 1 : -1;\n    }\n  }\n  assert( pLhs->aNode && pRhs->aNode );\n  return rc;\n}\nstatic int fts3SegReaderDoclistCmpRev(Fts3SegReader *pLhs, Fts3SegReader *pRhs){\n  int rc = (pLhs->pOffsetList==0)-(pRhs->pOffsetList==0);\n  if( rc==0 ){\n    if( pLhs->iDocid==pRhs->iDocid ){\n      rc = pRhs->iIdx - pLhs->iIdx;\n    }else{\n      rc = (pLhs->iDocid < pRhs->iDocid) ? 1 : -1;\n    }\n  }\n  assert( pLhs->aNode && pRhs->aNode );\n  return rc;\n}\n\n/*\n** Compare the term that the Fts3SegReader object passed as the first argument\n** points to with the term specified by arguments zTerm and nTerm. \n**\n** If the pSeg iterator is already at EOF, return 0. Otherwise, return\n** -ve if the pSeg term is less than zTerm/nTerm, 0 if the two terms are\n** equal, or +ve if the pSeg term is greater than zTerm/nTerm.\n*/\nstatic int fts3SegReaderTermCmp(\n  Fts3SegReader *pSeg,            /* Segment reader object */\n  const char *zTerm,              /* Term to compare to */\n  int nTerm                       /* Size of term zTerm in bytes */\n){\n  int res = 0;\n  if( pSeg->aNode ){\n    if( pSeg->nTerm>nTerm ){\n      res = memcmp(pSeg->zTerm, zTerm, nTerm);\n    }else{\n      res = memcmp(pSeg->zTerm, zTerm, pSeg->nTerm);\n    }\n    if( res==0 ){\n      res = pSeg->nTerm-nTerm;\n    }\n  }\n  return res;\n}\n\n/*\n** Argument apSegment is an array of nSegment elements. It is known that\n** the final (nSegment-nSuspect) members are already in sorted order\n** (according to the comparison function provided). This function shuffles\n** the array around until all entries are in sorted order.\n*/\nstatic void fts3SegReaderSort(\n  Fts3SegReader **apSegment,                     /* Array to sort entries of */\n  int nSegment,                                  /* Size of apSegment array */\n  int nSuspect,                                  /* Unsorted entry count */\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *)  /* Comparison function */\n){\n  int i;                          /* Iterator variable */\n\n  assert( nSuspect<=nSegment );\n\n  if( nSuspect==nSegment ) nSuspect--;\n  for(i=nSuspect-1; i>=0; i--){\n    int j;\n    for(j=i; j<(nSegment-1); j++){\n      Fts3SegReader *pTmp;\n      if( xCmp(apSegment[j], apSegment[j+1])<0 ) break;\n      pTmp = apSegment[j+1];\n      apSegment[j+1] = apSegment[j];\n      apSegment[j] = pTmp;\n    }\n  }\n\n#ifndef NDEBUG\n  /* Check that the list really is sorted now. */\n  for(i=0; i<(nSuspect-1); i++){\n    assert( xCmp(apSegment[i], apSegment[i+1])<0 );\n  }\n#endif\n}\n\n/* \n** Insert a record into the %_segments table.\n*/\nstatic int fts3WriteSegment(\n  Fts3Table *p,                   /* Virtual table handle */\n  sqlite3_int64 iBlock,           /* Block id for new block */\n  char *z,                        /* Pointer to buffer containing block data */\n  int n                           /* Size of buffer z in bytes */\n){\n  sqlite3_stmt *pStmt;\n  int rc = fts3SqlStmt(p, SQL_INSERT_SEGMENTS, &pStmt, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pStmt, 1, iBlock);\n    sqlite3_bind_blob(pStmt, 2, z, n, SQLITE_STATIC);\n    sqlite3_step(pStmt);\n    rc = sqlite3_reset(pStmt);\n  }\n  return rc;\n}\n\n/*\n** Find the largest relative level number in the table. If successful, set\n** *pnMax to this value and return SQLITE_OK. Otherwise, if an error occurs,\n** set *pnMax to zero and return an SQLite error code.\n*/\nint sqlite3Fts3MaxLevel(Fts3Table *p, int *pnMax){\n  int rc;\n  int mxLevel = 0;\n  sqlite3_stmt *pStmt = 0;\n\n  rc = fts3SqlStmt(p, SQL_SELECT_MXLEVEL, &pStmt, 0);\n  if( rc==SQLITE_OK ){\n    if( SQLITE_ROW==sqlite3_step(pStmt) ){\n      mxLevel = sqlite3_column_int(pStmt, 0);\n    }\n    rc = sqlite3_reset(pStmt);\n  }\n  *pnMax = mxLevel;\n  return rc;\n}\n\n/* \n** Insert a record into the %_segdir table.\n*/\nstatic int fts3WriteSegdir(\n  Fts3Table *p,                   /* Virtual table handle */\n  sqlite3_int64 iLevel,           /* Value for \"level\" field (absolute level) */\n  int iIdx,                       /* Value for \"idx\" field */\n  sqlite3_int64 iStartBlock,      /* Value for \"start_block\" field */\n  sqlite3_int64 iLeafEndBlock,    /* Value for \"leaves_end_block\" field */\n  sqlite3_int64 iEndBlock,        /* Value for \"end_block\" field */\n  sqlite3_int64 nLeafData,        /* Bytes of leaf data in segment */\n  char *zRoot,                    /* Blob value for \"root\" field */\n  int nRoot                       /* Number of bytes in buffer zRoot */\n){\n  sqlite3_stmt *pStmt;\n  int rc = fts3SqlStmt(p, SQL_INSERT_SEGDIR, &pStmt, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pStmt, 1, iLevel);\n    sqlite3_bind_int(pStmt, 2, iIdx);\n    sqlite3_bind_int64(pStmt, 3, iStartBlock);\n    sqlite3_bind_int64(pStmt, 4, iLeafEndBlock);\n    if( nLeafData==0 ){\n      sqlite3_bind_int64(pStmt, 5, iEndBlock);\n    }else{\n      char *zEnd = sqlite3_mprintf(\"%lld %lld\", iEndBlock, nLeafData);\n      if( !zEnd ) return SQLITE_NOMEM;\n      sqlite3_bind_text(pStmt, 5, zEnd, -1, sqlite3_free);\n    }\n    sqlite3_bind_blob(pStmt, 6, zRoot, nRoot, SQLITE_STATIC);\n    sqlite3_step(pStmt);\n    rc = sqlite3_reset(pStmt);\n  }\n  return rc;\n}\n\n/*\n** Return the size of the common prefix (if any) shared by zPrev and\n** zNext, in bytes. For example, \n**\n**   fts3PrefixCompress(\"abc\", 3, \"abcdef\", 6)   // returns 3\n**   fts3PrefixCompress(\"abX\", 3, \"abcdef\", 6)   // returns 2\n**   fts3PrefixCompress(\"abX\", 3, \"Xbcdef\", 6)   // returns 0\n*/\nstatic int fts3PrefixCompress(\n  const char *zPrev,              /* Buffer containing previous term */\n  int nPrev,                      /* Size of buffer zPrev in bytes */\n  const char *zNext,              /* Buffer containing next term */\n  int nNext                       /* Size of buffer zNext in bytes */\n){\n  int n;\n  UNUSED_PARAMETER(nNext);\n  for(n=0; n<nPrev && zPrev[n]==zNext[n]; n++);\n  return n;\n}\n\n/*\n** Add term zTerm to the SegmentNode. It is guaranteed that zTerm is larger\n** (according to memcmp) than the previous term.\n*/\nstatic int fts3NodeAddTerm(\n  Fts3Table *p,                   /* Virtual table handle */\n  SegmentNode **ppTree,           /* IN/OUT: SegmentNode handle */ \n  int isCopyTerm,                 /* True if zTerm/nTerm is transient */\n  const char *zTerm,              /* Pointer to buffer containing term */\n  int nTerm                       /* Size of term in bytes */\n){\n  SegmentNode *pTree = *ppTree;\n  int rc;\n  SegmentNode *pNew;\n\n  /* First try to append the term to the current node. Return early if \n  ** this is possible.\n  */\n  if( pTree ){\n    int nData = pTree->nData;     /* Current size of node in bytes */\n    int nReq = nData;             /* Required space after adding zTerm */\n    int nPrefix;                  /* Number of bytes of prefix compression */\n    int nSuffix;                  /* Suffix length */\n\n    nPrefix = fts3PrefixCompress(pTree->zTerm, pTree->nTerm, zTerm, nTerm);\n    nSuffix = nTerm-nPrefix;\n\n    nReq += sqlite3Fts3VarintLen(nPrefix)+sqlite3Fts3VarintLen(nSuffix)+nSuffix;\n    if( nReq<=p->nNodeSize || !pTree->zTerm ){\n\n      if( nReq>p->nNodeSize ){\n        /* An unusual case: this is the first term to be added to the node\n        ** and the static node buffer (p->nNodeSize bytes) is not large\n        ** enough. Use a separately malloced buffer instead This wastes\n        ** p->nNodeSize bytes, but since this scenario only comes about when\n        ** the database contain two terms that share a prefix of almost 2KB, \n        ** this is not expected to be a serious problem. \n        */\n        assert( pTree->aData==(char *)&pTree[1] );\n        pTree->aData = (char *)sqlite3_malloc(nReq);\n        if( !pTree->aData ){\n          return SQLITE_NOMEM;\n        }\n      }\n\n      if( pTree->zTerm ){\n        /* There is no prefix-length field for first term in a node */\n        nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nPrefix);\n      }\n\n      nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nSuffix);\n      memcpy(&pTree->aData[nData], &zTerm[nPrefix], nSuffix);\n      pTree->nData = nData + nSuffix;\n      pTree->nEntry++;\n\n      if( isCopyTerm ){\n        if( pTree->nMalloc<nTerm ){\n          char *zNew = sqlite3_realloc(pTree->zMalloc, nTerm*2);\n          if( !zNew ){\n            return SQLITE_NOMEM;\n          }\n          pTree->nMalloc = nTerm*2;\n          pTree->zMalloc = zNew;\n        }\n        pTree->zTerm = pTree->zMalloc;\n        memcpy(pTree->zTerm, zTerm, nTerm);\n        pTree->nTerm = nTerm;\n      }else{\n        pTree->zTerm = (char *)zTerm;\n        pTree->nTerm = nTerm;\n      }\n      return SQLITE_OK;\n    }\n  }\n\n  /* If control flows to here, it was not possible to append zTerm to the\n  ** current node. Create a new node (a right-sibling of the current node).\n  ** If this is the first node in the tree, the term is added to it.\n  **\n  ** Otherwise, the term is not added to the new node, it is left empty for\n  ** now. Instead, the term is inserted into the parent of pTree. If pTree \n  ** has no parent, one is created here.\n  */\n  pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize);\n  if( !pNew ){\n    return SQLITE_NOMEM;\n  }\n  memset(pNew, 0, sizeof(SegmentNode));\n  pNew->nData = 1 + FTS3_VARINT_MAX;\n  pNew->aData = (char *)&pNew[1];\n\n  if( pTree ){\n    SegmentNode *pParent = pTree->pParent;\n    rc = fts3NodeAddTerm(p, &pParent, isCopyTerm, zTerm, nTerm);\n    if( pTree->pParent==0 ){\n      pTree->pParent = pParent;\n    }\n    pTree->pRight = pNew;\n    pNew->pLeftmost = pTree->pLeftmost;\n    pNew->pParent = pParent;\n    pNew->zMalloc = pTree->zMalloc;\n    pNew->nMalloc = pTree->nMalloc;\n    pTree->zMalloc = 0;\n  }else{\n    pNew->pLeftmost = pNew;\n    rc = fts3NodeAddTerm(p, &pNew, isCopyTerm, zTerm, nTerm); \n  }\n\n  *ppTree = pNew;\n  return rc;\n}\n\n/*\n** Helper function for fts3NodeWrite().\n*/\nstatic int fts3TreeFinishNode(\n  SegmentNode *pTree, \n  int iHeight, \n  sqlite3_int64 iLeftChild\n){\n  int nStart;\n  assert( iHeight>=1 && iHeight<128 );\n  nStart = FTS3_VARINT_MAX - sqlite3Fts3VarintLen(iLeftChild);\n  pTree->aData[nStart] = (char)iHeight;\n  sqlite3Fts3PutVarint(&pTree->aData[nStart+1], iLeftChild);\n  return nStart;\n}\n\n/*\n** Write the buffer for the segment node pTree and all of its peers to the\n** database. Then call this function recursively to write the parent of \n** pTree and its peers to the database. \n**\n** Except, if pTree is a root node, do not write it to the database. Instead,\n** set output variables *paRoot and *pnRoot to contain the root node.\n**\n** If successful, SQLITE_OK is returned and output variable *piLast is\n** set to the largest blockid written to the database (or zero if no\n** blocks were written to the db). Otherwise, an SQLite error code is \n** returned.\n*/\nstatic int fts3NodeWrite(\n  Fts3Table *p,                   /* Virtual table handle */\n  SegmentNode *pTree,             /* SegmentNode handle */\n  int iHeight,                    /* Height of this node in tree */\n  sqlite3_int64 iLeaf,            /* Block id of first leaf node */\n  sqlite3_int64 iFree,            /* Block id of next free slot in %_segments */\n  sqlite3_int64 *piLast,          /* OUT: Block id of last entry written */\n  char **paRoot,                  /* OUT: Data for root node */\n  int *pnRoot                     /* OUT: Size of root node in bytes */\n){\n  int rc = SQLITE_OK;\n\n  if( !pTree->pParent ){\n    /* Root node of the tree. */\n    int nStart = fts3TreeFinishNode(pTree, iHeight, iLeaf);\n    *piLast = iFree-1;\n    *pnRoot = pTree->nData - nStart;\n    *paRoot = &pTree->aData[nStart];\n  }else{\n    SegmentNode *pIter;\n    sqlite3_int64 iNextFree = iFree;\n    sqlite3_int64 iNextLeaf = iLeaf;\n    for(pIter=pTree->pLeftmost; pIter && rc==SQLITE_OK; pIter=pIter->pRight){\n      int nStart = fts3TreeFinishNode(pIter, iHeight, iNextLeaf);\n      int nWrite = pIter->nData - nStart;\n  \n      rc = fts3WriteSegment(p, iNextFree, &pIter->aData[nStart], nWrite);\n      iNextFree++;\n      iNextLeaf += (pIter->nEntry+1);\n    }\n    if( rc==SQLITE_OK ){\n      assert( iNextLeaf==iFree );\n      rc = fts3NodeWrite(\n          p, pTree->pParent, iHeight+1, iFree, iNextFree, piLast, paRoot, pnRoot\n      );\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Free all memory allocations associated with the tree pTree.\n*/\nstatic void fts3NodeFree(SegmentNode *pTree){\n  if( pTree ){\n    SegmentNode *p = pTree->pLeftmost;\n    fts3NodeFree(p->pParent);\n    while( p ){\n      SegmentNode *pRight = p->pRight;\n      if( p->aData!=(char *)&p[1] ){\n        sqlite3_free(p->aData);\n      }\n      assert( pRight==0 || p->zMalloc==0 );\n      sqlite3_free(p->zMalloc);\n      sqlite3_free(p);\n      p = pRight;\n    }\n  }\n}\n\n/*\n** Add a term to the segment being constructed by the SegmentWriter object\n** *ppWriter. When adding the first term to a segment, *ppWriter should\n** be passed NULL. This function will allocate a new SegmentWriter object\n** and return it via the input/output variable *ppWriter in this case.\n**\n** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code.\n*/\nstatic int fts3SegWriterAdd(\n  Fts3Table *p,                   /* Virtual table handle */\n  SegmentWriter **ppWriter,       /* IN/OUT: SegmentWriter handle */ \n  int isCopyTerm,                 /* True if buffer zTerm must be copied */\n  const char *zTerm,              /* Pointer to buffer containing term */\n  int nTerm,                      /* Size of term in bytes */\n  const char *aDoclist,           /* Pointer to buffer containing doclist */\n  int nDoclist                    /* Size of doclist in bytes */\n){\n  int nPrefix;                    /* Size of term prefix in bytes */\n  int nSuffix;                    /* Size of term suffix in bytes */\n  int nReq;                       /* Number of bytes required on leaf page */\n  int nData;\n  SegmentWriter *pWriter = *ppWriter;\n\n  if( !pWriter ){\n    int rc;\n    sqlite3_stmt *pStmt;\n\n    /* Allocate the SegmentWriter structure */\n    pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));\n    if( !pWriter ) return SQLITE_NOMEM;\n    memset(pWriter, 0, sizeof(SegmentWriter));\n    *ppWriter = pWriter;\n\n    /* Allocate a buffer in which to accumulate data */\n    pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);\n    if( !pWriter->aData ) return SQLITE_NOMEM;\n    pWriter->nSize = p->nNodeSize;\n\n    /* Find the next free blockid in the %_segments table */\n    rc = fts3SqlStmt(p, SQL_NEXT_SEGMENTS_ID, &pStmt, 0);\n    if( rc!=SQLITE_OK ) return rc;\n    if( SQLITE_ROW==sqlite3_step(pStmt) ){\n      pWriter->iFree = sqlite3_column_int64(pStmt, 0);\n      pWriter->iFirst = pWriter->iFree;\n    }\n    rc = sqlite3_reset(pStmt);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n  nData = pWriter->nData;\n\n  nPrefix = fts3PrefixCompress(pWriter->zTerm, pWriter->nTerm, zTerm, nTerm);\n  nSuffix = nTerm-nPrefix;\n\n  /* Figure out how many bytes are required by this new entry */\n  nReq = sqlite3Fts3VarintLen(nPrefix) +    /* varint containing prefix size */\n    sqlite3Fts3VarintLen(nSuffix) +         /* varint containing suffix size */\n    nSuffix +                               /* Term suffix */\n    sqlite3Fts3VarintLen(nDoclist) +        /* Size of doclist */\n    nDoclist;                               /* Doclist data */\n\n  if( nData>0 && nData+nReq>p->nNodeSize ){\n    int rc;\n\n    /* The current leaf node is full. Write it out to the database. */\n    rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, nData);\n    if( rc!=SQLITE_OK ) return rc;\n    p->nLeafAdd++;\n\n    /* Add the current term to the interior node tree. The term added to\n    ** the interior tree must:\n    **\n    **   a) be greater than the largest term on the leaf node just written\n    **      to the database (still available in pWriter->zTerm), and\n    **\n    **   b) be less than or equal to the term about to be added to the new\n    **      leaf node (zTerm/nTerm).\n    **\n    ** In other words, it must be the prefix of zTerm 1 byte longer than\n    ** the common prefix (if any) of zTerm and pWriter->zTerm.\n    */\n    assert( nPrefix<nTerm );\n    rc = fts3NodeAddTerm(p, &pWriter->pTree, isCopyTerm, zTerm, nPrefix+1);\n    if( rc!=SQLITE_OK ) return rc;\n\n    nData = 0;\n    pWriter->nTerm = 0;\n\n    nPrefix = 0;\n    nSuffix = nTerm;\n    nReq = 1 +                              /* varint containing prefix size */\n      sqlite3Fts3VarintLen(nTerm) +         /* varint containing suffix size */\n      nTerm +                               /* Term suffix */\n      sqlite3Fts3VarintLen(nDoclist) +      /* Size of doclist */\n      nDoclist;                             /* Doclist data */\n  }\n\n  /* Increase the total number of bytes written to account for the new entry. */\n  pWriter->nLeafData += nReq;\n\n  /* If the buffer currently allocated is too small for this entry, realloc\n  ** the buffer to make it large enough.\n  */\n  if( nReq>pWriter->nSize ){\n    char *aNew = sqlite3_realloc(pWriter->aData, nReq);\n    if( !aNew ) return SQLITE_NOMEM;\n    pWriter->aData = aNew;\n    pWriter->nSize = nReq;\n  }\n  assert( nData+nReq<=pWriter->nSize );\n\n  /* Append the prefix-compressed term and doclist to the buffer. */\n  nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix);\n  nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix);\n  memcpy(&pWriter->aData[nData], &zTerm[nPrefix], nSuffix);\n  nData += nSuffix;\n  nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist);\n  memcpy(&pWriter->aData[nData], aDoclist, nDoclist);\n  pWriter->nData = nData + nDoclist;\n\n  /* Save the current term so that it can be used to prefix-compress the next.\n  ** If the isCopyTerm parameter is true, then the buffer pointed to by\n  ** zTerm is transient, so take a copy of the term data. Otherwise, just\n  ** store a copy of the pointer.\n  */\n  if( isCopyTerm ){\n    if( nTerm>pWriter->nMalloc ){\n      char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);\n      if( !zNew ){\n        return SQLITE_NOMEM;\n      }\n      pWriter->nMalloc = nTerm*2;\n      pWriter->zMalloc = zNew;\n      pWriter->zTerm = zNew;\n    }\n    assert( pWriter->zTerm==pWriter->zMalloc );\n    memcpy(pWriter->zTerm, zTerm, nTerm);\n  }else{\n    pWriter->zTerm = (char *)zTerm;\n  }\n  pWriter->nTerm = nTerm;\n\n  return SQLITE_OK;\n}\n\n/*\n** Flush all data associated with the SegmentWriter object pWriter to the\n** database. This function must be called after all terms have been added\n** to the segment using fts3SegWriterAdd(). If successful, SQLITE_OK is\n** returned. Otherwise, an SQLite error code.\n*/\nstatic int fts3SegWriterFlush(\n  Fts3Table *p,                   /* Virtual table handle */\n  SegmentWriter *pWriter,         /* SegmentWriter to flush to the db */\n  sqlite3_int64 iLevel,           /* Value for 'level' column of %_segdir */\n  int iIdx                        /* Value for 'idx' column of %_segdir */\n){\n  int rc;                         /* Return code */\n  if( pWriter->pTree ){\n    sqlite3_int64 iLast = 0;      /* Largest block id written to database */\n    sqlite3_int64 iLastLeaf;      /* Largest leaf block id written to db */\n    char *zRoot = NULL;           /* Pointer to buffer containing root node */\n    int nRoot = 0;                /* Size of buffer zRoot */\n\n    iLastLeaf = pWriter->iFree;\n    rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData);\n    if( rc==SQLITE_OK ){\n      rc = fts3NodeWrite(p, pWriter->pTree, 1,\n          pWriter->iFirst, pWriter->iFree, &iLast, &zRoot, &nRoot);\n    }\n    if( rc==SQLITE_OK ){\n      rc = fts3WriteSegdir(p, iLevel, iIdx, \n          pWriter->iFirst, iLastLeaf, iLast, pWriter->nLeafData, zRoot, nRoot);\n    }\n  }else{\n    /* The entire tree fits on the root node. Write it to the segdir table. */\n    rc = fts3WriteSegdir(p, iLevel, iIdx, \n        0, 0, 0, pWriter->nLeafData, pWriter->aData, pWriter->nData);\n  }\n  p->nLeafAdd++;\n  return rc;\n}\n\n/*\n** Release all memory held by the SegmentWriter object passed as the \n** first argument.\n*/\nstatic void fts3SegWriterFree(SegmentWriter *pWriter){\n  if( pWriter ){\n    sqlite3_free(pWriter->aData);\n    sqlite3_free(pWriter->zMalloc);\n    fts3NodeFree(pWriter->pTree);\n    sqlite3_free(pWriter);\n  }\n}\n\n/*\n** The first value in the apVal[] array is assumed to contain an integer.\n** This function tests if there exist any documents with docid values that\n** are different from that integer. i.e. if deleting the document with docid\n** pRowid would mean the FTS3 table were empty.\n**\n** If successful, *pisEmpty is set to true if the table is empty except for\n** document pRowid, or false otherwise, and SQLITE_OK is returned. If an\n** error occurs, an SQLite error code is returned.\n*/\nstatic int fts3IsEmpty(Fts3Table *p, sqlite3_value *pRowid, int *pisEmpty){\n  sqlite3_stmt *pStmt;\n  int rc;\n  if( p->zContentTbl ){\n    /* If using the content=xxx option, assume the table is never empty */\n    *pisEmpty = 0;\n    rc = SQLITE_OK;\n  }else{\n    rc = fts3SqlStmt(p, SQL_IS_EMPTY, &pStmt, &pRowid);\n    if( rc==SQLITE_OK ){\n      if( SQLITE_ROW==sqlite3_step(pStmt) ){\n        *pisEmpty = sqlite3_column_int(pStmt, 0);\n      }\n      rc = sqlite3_reset(pStmt);\n    }\n  }\n  return rc;\n}\n\n/*\n** Set *pnMax to the largest segment level in the database for the index\n** iIndex.\n**\n** Segment levels are stored in the 'level' column of the %_segdir table.\n**\n** Return SQLITE_OK if successful, or an SQLite error code if not.\n*/\nstatic int fts3SegmentMaxLevel(\n  Fts3Table *p, \n  int iLangid,\n  int iIndex, \n  sqlite3_int64 *pnMax\n){\n  sqlite3_stmt *pStmt;\n  int rc;\n  assert( iIndex>=0 && iIndex<p->nIndex );\n\n  /* Set pStmt to the compiled version of:\n  **\n  **   SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\n  **\n  ** (1024 is actually the value of macro FTS3_SEGDIR_PREFIXLEVEL_STR).\n  */\n  rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0);\n  if( rc!=SQLITE_OK ) return rc;\n  sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0));\n  sqlite3_bind_int64(pStmt, 2, \n      getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1)\n  );\n  if( SQLITE_ROW==sqlite3_step(pStmt) ){\n    *pnMax = sqlite3_column_int64(pStmt, 0);\n  }\n  return sqlite3_reset(pStmt);\n}\n\n/*\n** iAbsLevel is an absolute level that may be assumed to exist within\n** the database. This function checks if it is the largest level number\n** within its index. Assuming no error occurs, *pbMax is set to 1 if\n** iAbsLevel is indeed the largest level, or 0 otherwise, and SQLITE_OK\n** is returned. If an error occurs, an error code is returned and the\n** final value of *pbMax is undefined.\n*/\nstatic int fts3SegmentIsMaxLevel(Fts3Table *p, i64 iAbsLevel, int *pbMax){\n\n  /* Set pStmt to the compiled version of:\n  **\n  **   SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?\n  **\n  ** (1024 is actually the value of macro FTS3_SEGDIR_PREFIXLEVEL_STR).\n  */\n  sqlite3_stmt *pStmt;\n  int rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0);\n  if( rc!=SQLITE_OK ) return rc;\n  sqlite3_bind_int64(pStmt, 1, iAbsLevel+1);\n  sqlite3_bind_int64(pStmt, 2, \n      ((iAbsLevel/FTS3_SEGDIR_MAXLEVEL)+1) * FTS3_SEGDIR_MAXLEVEL\n  );\n\n  *pbMax = 0;\n  if( SQLITE_ROW==sqlite3_step(pStmt) ){\n    *pbMax = sqlite3_column_type(pStmt, 0)==SQLITE_NULL;\n  }\n  return sqlite3_reset(pStmt);\n}\n\n/*\n** Delete all entries in the %_segments table associated with the segment\n** opened with seg-reader pSeg. This function does not affect the contents\n** of the %_segdir table.\n*/\nstatic int fts3DeleteSegment(\n  Fts3Table *p,                   /* FTS table handle */\n  Fts3SegReader *pSeg             /* Segment to delete */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  if( pSeg->iStartBlock ){\n    sqlite3_stmt *pDelete;        /* SQL statement to delete rows */\n    rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDelete, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pDelete, 1, pSeg->iStartBlock);\n      sqlite3_bind_int64(pDelete, 2, pSeg->iEndBlock);\n      sqlite3_step(pDelete);\n      rc = sqlite3_reset(pDelete);\n    }\n  }\n  return rc;\n}\n\n/*\n** This function is used after merging multiple segments into a single large\n** segment to delete the old, now redundant, segment b-trees. Specifically,\n** it:\n** \n**   1) Deletes all %_segments entries for the segments associated with \n**      each of the SegReader objects in the array passed as the third \n**      argument, and\n**\n**   2) deletes all %_segdir entries with level iLevel, or all %_segdir\n**      entries regardless of level if (iLevel<0).\n**\n** SQLITE_OK is returned if successful, otherwise an SQLite error code.\n*/\nstatic int fts3DeleteSegdir(\n  Fts3Table *p,                   /* Virtual table handle */\n  int iLangid,                    /* Language id */\n  int iIndex,                     /* Index for p->aIndex */\n  int iLevel,                     /* Level of %_segdir entries to delete */\n  Fts3SegReader **apSegment,      /* Array of SegReader objects */\n  int nReader                     /* Size of array apSegment */\n){\n  int rc = SQLITE_OK;             /* Return Code */\n  int i;                          /* Iterator variable */\n  sqlite3_stmt *pDelete = 0;      /* SQL statement to delete rows */\n\n  for(i=0; rc==SQLITE_OK && i<nReader; i++){\n    rc = fts3DeleteSegment(p, apSegment[i]);\n  }\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  assert( iLevel>=0 || iLevel==FTS3_SEGCURSOR_ALL );\n  if( iLevel==FTS3_SEGCURSOR_ALL ){\n    rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_RANGE, &pDelete, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, 0));\n      sqlite3_bind_int64(pDelete, 2, \n          getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1)\n      );\n    }\n  }else{\n    rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pDelete, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(\n          pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel)\n      );\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    sqlite3_step(pDelete);\n    rc = sqlite3_reset(pDelete);\n  }\n\n  return rc;\n}\n\n/*\n** When this function is called, buffer *ppList (size *pnList bytes) contains \n** a position list that may (or may not) feature multiple columns. This\n** function adjusts the pointer *ppList and the length *pnList so that they\n** identify the subset of the position list that corresponds to column iCol.\n**\n** If there are no entries in the input position list for column iCol, then\n** *pnList is set to zero before returning.\n**\n** If parameter bZero is non-zero, then any part of the input list following\n** the end of the output list is zeroed before returning.\n*/\nstatic void fts3ColumnFilter(\n  int iCol,                       /* Column to filter on */\n  int bZero,                      /* Zero out anything following *ppList */\n  char **ppList,                  /* IN/OUT: Pointer to position list */\n  int *pnList                     /* IN/OUT: Size of buffer *ppList in bytes */\n){\n  char *pList = *ppList;\n  int nList = *pnList;\n  char *pEnd = &pList[nList];\n  int iCurrent = 0;\n  char *p = pList;\n\n  assert( iCol>=0 );\n  while( 1 ){\n    char c = 0;\n    while( p<pEnd && (c | *p)&0xFE ) c = *p++ & 0x80;\n  \n    if( iCol==iCurrent ){\n      nList = (int)(p - pList);\n      break;\n    }\n\n    nList -= (int)(p - pList);\n    pList = p;\n    if( nList==0 ){\n      break;\n    }\n    p = &pList[1];\n    p += fts3GetVarint32(p, &iCurrent);\n  }\n\n  if( bZero && &pList[nList]!=pEnd ){\n    memset(&pList[nList], 0, pEnd - &pList[nList]);\n  }\n  *ppList = pList;\n  *pnList = nList;\n}\n\n/*\n** Cache data in the Fts3MultiSegReader.aBuffer[] buffer (overwriting any\n** existing data). Grow the buffer if required.\n**\n** If successful, return SQLITE_OK. Otherwise, if an OOM error is encountered\n** trying to resize the buffer, return SQLITE_NOMEM.\n*/\nstatic int fts3MsrBufferData(\n  Fts3MultiSegReader *pMsr,       /* Multi-segment-reader handle */\n  char *pList,\n  int nList\n){\n  if( nList>pMsr->nBuffer ){\n    char *pNew;\n    pMsr->nBuffer = nList*2;\n    pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer);\n    if( !pNew ) return SQLITE_NOMEM;\n    pMsr->aBuffer = pNew;\n  }\n\n  memcpy(pMsr->aBuffer, pList, nList);\n  return SQLITE_OK;\n}\n\nint sqlite3Fts3MsrIncrNext(\n  Fts3Table *p,                   /* Virtual table handle */\n  Fts3MultiSegReader *pMsr,       /* Multi-segment-reader handle */\n  sqlite3_int64 *piDocid,         /* OUT: Docid value */\n  char **paPoslist,               /* OUT: Pointer to position list */\n  int *pnPoslist                  /* OUT: Size of position list in bytes */\n){\n  int nMerge = pMsr->nAdvance;\n  Fts3SegReader **apSegment = pMsr->apSegment;\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = (\n    p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp\n  );\n\n  if( nMerge==0 ){\n    *paPoslist = 0;\n    return SQLITE_OK;\n  }\n\n  while( 1 ){\n    Fts3SegReader *pSeg;\n    pSeg = pMsr->apSegment[0];\n\n    if( pSeg->pOffsetList==0 ){\n      *paPoslist = 0;\n      break;\n    }else{\n      int rc;\n      char *pList;\n      int nList;\n      int j;\n      sqlite3_int64 iDocid = apSegment[0]->iDocid;\n\n      rc = fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList);\n      j = 1;\n      while( rc==SQLITE_OK \n        && j<nMerge\n        && apSegment[j]->pOffsetList\n        && apSegment[j]->iDocid==iDocid\n      ){\n        rc = fts3SegReaderNextDocid(p, apSegment[j], 0, 0);\n        j++;\n      }\n      if( rc!=SQLITE_OK ) return rc;\n      fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp);\n\n      if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){\n        rc = fts3MsrBufferData(pMsr, pList, nList+1);\n        if( rc!=SQLITE_OK ) return rc;\n        assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 );\n        pList = pMsr->aBuffer;\n      }\n\n      if( pMsr->iColFilter>=0 ){\n        fts3ColumnFilter(pMsr->iColFilter, 1, &pList, &nList);\n      }\n\n      if( nList>0 ){\n        *paPoslist = pList;\n        *piDocid = iDocid;\n        *pnPoslist = nList;\n        break;\n      }\n    }\n  }\n\n  return SQLITE_OK;\n}\n\nstatic int fts3SegReaderStart(\n  Fts3Table *p,                   /* Virtual table handle */\n  Fts3MultiSegReader *pCsr,       /* Cursor object */\n  const char *zTerm,              /* Term searched for (or NULL) */\n  int nTerm                       /* Length of zTerm in bytes */\n){\n  int i;\n  int nSeg = pCsr->nSegment;\n\n  /* If the Fts3SegFilter defines a specific term (or term prefix) to search \n  ** for, then advance each segment iterator until it points to a term of\n  ** equal or greater value than the specified term. This prevents many\n  ** unnecessary merge/sort operations for the case where single segment\n  ** b-tree leaf nodes contain more than one term.\n  */\n  for(i=0; pCsr->bRestart==0 && i<pCsr->nSegment; i++){\n    int res = 0;\n    Fts3SegReader *pSeg = pCsr->apSegment[i];\n    do {\n      int rc = fts3SegReaderNext(p, pSeg, 0);\n      if( rc!=SQLITE_OK ) return rc;\n    }while( zTerm && (res = fts3SegReaderTermCmp(pSeg, zTerm, nTerm))<0 );\n\n    if( pSeg->bLookup && res!=0 ){\n      fts3SegReaderSetEof(pSeg);\n    }\n  }\n  fts3SegReaderSort(pCsr->apSegment, nSeg, nSeg, fts3SegReaderCmp);\n\n  return SQLITE_OK;\n}\n\nint sqlite3Fts3SegReaderStart(\n  Fts3Table *p,                   /* Virtual table handle */\n  Fts3MultiSegReader *pCsr,       /* Cursor object */\n  Fts3SegFilter *pFilter          /* Restrictions on range of iteration */\n){\n  pCsr->pFilter = pFilter;\n  return fts3SegReaderStart(p, pCsr, pFilter->zTerm, pFilter->nTerm);\n}\n\nint sqlite3Fts3MsrIncrStart(\n  Fts3Table *p,                   /* Virtual table handle */\n  Fts3MultiSegReader *pCsr,       /* Cursor object */\n  int iCol,                       /* Column to match on. */\n  const char *zTerm,              /* Term to iterate through a doclist for */\n  int nTerm                       /* Number of bytes in zTerm */\n){\n  int i;\n  int rc;\n  int nSegment = pCsr->nSegment;\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = (\n    p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp\n  );\n\n  assert( pCsr->pFilter==0 );\n  assert( zTerm && nTerm>0 );\n\n  /* Advance each segment iterator until it points to the term zTerm/nTerm. */\n  rc = fts3SegReaderStart(p, pCsr, zTerm, nTerm);\n  if( rc!=SQLITE_OK ) return rc;\n\n  /* Determine how many of the segments actually point to zTerm/nTerm. */\n  for(i=0; i<nSegment; i++){\n    Fts3SegReader *pSeg = pCsr->apSegment[i];\n    if( !pSeg->aNode || fts3SegReaderTermCmp(pSeg, zTerm, nTerm) ){\n      break;\n    }\n  }\n  pCsr->nAdvance = i;\n\n  /* Advance each of the segments to point to the first docid. */\n  for(i=0; i<pCsr->nAdvance; i++){\n    rc = fts3SegReaderFirstDocid(p, pCsr->apSegment[i]);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n  fts3SegReaderSort(pCsr->apSegment, i, i, xCmp);\n\n  assert( iCol<0 || iCol<p->nColumn );\n  pCsr->iColFilter = iCol;\n\n  return SQLITE_OK;\n}\n\n/*\n** This function is called on a MultiSegReader that has been started using\n** sqlite3Fts3MsrIncrStart(). One or more calls to MsrIncrNext() may also\n** have been made. Calling this function puts the MultiSegReader in such\n** a state that if the next two calls are:\n**\n**   sqlite3Fts3SegReaderStart()\n**   sqlite3Fts3SegReaderStep()\n**\n** then the entire doclist for the term is available in \n** MultiSegReader.aDoclist/nDoclist.\n*/\nint sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){\n  int i;                          /* Used to iterate through segment-readers */\n\n  assert( pCsr->zTerm==0 );\n  assert( pCsr->nTerm==0 );\n  assert( pCsr->aDoclist==0 );\n  assert( pCsr->nDoclist==0 );\n\n  pCsr->nAdvance = 0;\n  pCsr->bRestart = 1;\n  for(i=0; i<pCsr->nSegment; i++){\n    pCsr->apSegment[i]->pOffsetList = 0;\n    pCsr->apSegment[i]->nOffsetList = 0;\n    pCsr->apSegment[i]->iDocid = 0;\n  }\n\n  return SQLITE_OK;\n}\n\n\nint sqlite3Fts3SegReaderStep(\n  Fts3Table *p,                   /* Virtual table handle */\n  Fts3MultiSegReader *pCsr        /* Cursor object */\n){\n  int rc = SQLITE_OK;\n\n  int isIgnoreEmpty =  (pCsr->pFilter->flags & FTS3_SEGMENT_IGNORE_EMPTY);\n  int isRequirePos =   (pCsr->pFilter->flags & FTS3_SEGMENT_REQUIRE_POS);\n  int isColFilter =    (pCsr->pFilter->flags & FTS3_SEGMENT_COLUMN_FILTER);\n  int isPrefix =       (pCsr->pFilter->flags & FTS3_SEGMENT_PREFIX);\n  int isScan =         (pCsr->pFilter->flags & FTS3_SEGMENT_SCAN);\n  int isFirst =        (pCsr->pFilter->flags & FTS3_SEGMENT_FIRST);\n\n  Fts3SegReader **apSegment = pCsr->apSegment;\n  int nSegment = pCsr->nSegment;\n  Fts3SegFilter *pFilter = pCsr->pFilter;\n  int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = (\n    p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp\n  );\n\n  if( pCsr->nSegment==0 ) return SQLITE_OK;\n\n  do {\n    int nMerge;\n    int i;\n  \n    /* Advance the first pCsr->nAdvance entries in the apSegment[] array\n    ** forward. Then sort the list in order of current term again.  \n    */\n    for(i=0; i<pCsr->nAdvance; i++){\n      Fts3SegReader *pSeg = apSegment[i];\n      if( pSeg->bLookup ){\n        fts3SegReaderSetEof(pSeg);\n      }else{\n        rc = fts3SegReaderNext(p, pSeg, 0);\n      }\n      if( rc!=SQLITE_OK ) return rc;\n    }\n    fts3SegReaderSort(apSegment, nSegment, pCsr->nAdvance, fts3SegReaderCmp);\n    pCsr->nAdvance = 0;\n\n    /* If all the seg-readers are at EOF, we're finished. return SQLITE_OK. */\n    assert( rc==SQLITE_OK );\n    if( apSegment[0]->aNode==0 ) break;\n\n    pCsr->nTerm = apSegment[0]->nTerm;\n    pCsr->zTerm = apSegment[0]->zTerm;\n\n    /* If this is a prefix-search, and if the term that apSegment[0] points\n    ** to does not share a suffix with pFilter->zTerm/nTerm, then all \n    ** required callbacks have been made. In this case exit early.\n    **\n    ** Similarly, if this is a search for an exact match, and the first term\n    ** of segment apSegment[0] is not a match, exit early.\n    */\n    if( pFilter->zTerm && !isScan ){\n      if( pCsr->nTerm<pFilter->nTerm \n       || (!isPrefix && pCsr->nTerm>pFilter->nTerm)\n       || memcmp(pCsr->zTerm, pFilter->zTerm, pFilter->nTerm) \n      ){\n        break;\n      }\n    }\n\n    nMerge = 1;\n    while( nMerge<nSegment \n        && apSegment[nMerge]->aNode\n        && apSegment[nMerge]->nTerm==pCsr->nTerm \n        && 0==memcmp(pCsr->zTerm, apSegment[nMerge]->zTerm, pCsr->nTerm)\n    ){\n      nMerge++;\n    }\n\n    assert( isIgnoreEmpty || (isRequirePos && !isColFilter) );\n    if( nMerge==1 \n     && !isIgnoreEmpty \n     && !isFirst \n     && (p->bDescIdx==0 || fts3SegReaderIsPending(apSegment[0])==0)\n    ){\n      pCsr->nDoclist = apSegment[0]->nDoclist;\n      if( fts3SegReaderIsPending(apSegment[0]) ){\n        rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist, pCsr->nDoclist);\n        pCsr->aDoclist = pCsr->aBuffer;\n      }else{\n        pCsr->aDoclist = apSegment[0]->aDoclist;\n      }\n      if( rc==SQLITE_OK ) rc = SQLITE_ROW;\n    }else{\n      int nDoclist = 0;           /* Size of doclist */\n      sqlite3_int64 iPrev = 0;    /* Previous docid stored in doclist */\n\n      /* The current term of the first nMerge entries in the array\n      ** of Fts3SegReader objects is the same. The doclists must be merged\n      ** and a single term returned with the merged doclist.\n      */\n      for(i=0; i<nMerge; i++){\n        fts3SegReaderFirstDocid(p, apSegment[i]);\n      }\n      fts3SegReaderSort(apSegment, nMerge, nMerge, xCmp);\n      while( apSegment[0]->pOffsetList ){\n        int j;                    /* Number of segments that share a docid */\n        char *pList = 0;\n        int nList = 0;\n        int nByte;\n        sqlite3_int64 iDocid = apSegment[0]->iDocid;\n        fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList);\n        j = 1;\n        while( j<nMerge\n            && apSegment[j]->pOffsetList\n            && apSegment[j]->iDocid==iDocid\n        ){\n          fts3SegReaderNextDocid(p, apSegment[j], 0, 0);\n          j++;\n        }\n\n        if( isColFilter ){\n          fts3ColumnFilter(pFilter->iCol, 0, &pList, &nList);\n        }\n\n        if( !isIgnoreEmpty || nList>0 ){\n\n          /* Calculate the 'docid' delta value to write into the merged \n          ** doclist. */\n          sqlite3_int64 iDelta;\n          if( p->bDescIdx && nDoclist>0 ){\n            iDelta = iPrev - iDocid;\n          }else{\n            iDelta = iDocid - iPrev;\n          }\n          assert( iDelta>0 || (nDoclist==0 && iDelta==iDocid) );\n          assert( nDoclist>0 || iDelta==iDocid );\n\n          nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);\n          if( nDoclist+nByte>pCsr->nBuffer ){\n            char *aNew;\n            pCsr->nBuffer = (nDoclist+nByte)*2;\n            aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);\n            if( !aNew ){\n              return SQLITE_NOMEM;\n            }\n            pCsr->aBuffer = aNew;\n          }\n\n          if( isFirst ){\n            char *a = &pCsr->aBuffer[nDoclist];\n            int nWrite;\n           \n            nWrite = sqlite3Fts3FirstFilter(iDelta, pList, nList, a);\n            if( nWrite ){\n              iPrev = iDocid;\n              nDoclist += nWrite;\n            }\n          }else{\n            nDoclist += sqlite3Fts3PutVarint(&pCsr->aBuffer[nDoclist], iDelta);\n            iPrev = iDocid;\n            if( isRequirePos ){\n              memcpy(&pCsr->aBuffer[nDoclist], pList, nList);\n              nDoclist += nList;\n              pCsr->aBuffer[nDoclist++] = '\\0';\n            }\n          }\n        }\n\n        fts3SegReaderSort(apSegment, nMerge, j, xCmp);\n      }\n      if( nDoclist>0 ){\n        pCsr->aDoclist = pCsr->aBuffer;\n        pCsr->nDoclist = nDoclist;\n        rc = SQLITE_ROW;\n      }\n    }\n    pCsr->nAdvance = nMerge;\n  }while( rc==SQLITE_OK );\n\n  return rc;\n}\n\n\nvoid sqlite3Fts3SegReaderFinish(\n  Fts3MultiSegReader *pCsr       /* Cursor object */\n){\n  if( pCsr ){\n    int i;\n    for(i=0; i<pCsr->nSegment; i++){\n      sqlite3Fts3SegReaderFree(pCsr->apSegment[i]);\n    }\n    sqlite3_free(pCsr->apSegment);\n    sqlite3_free(pCsr->aBuffer);\n\n    pCsr->nSegment = 0;\n    pCsr->apSegment = 0;\n    pCsr->aBuffer = 0;\n  }\n}\n\n/*\n** Decode the \"end_block\" field, selected by column iCol of the SELECT \n** statement passed as the first argument. \n**\n** The \"end_block\" field may contain either an integer, or a text field\n** containing the text representation of two non-negative integers separated \n** by one or more space (0x20) characters. In the first case, set *piEndBlock \n** to the integer value and *pnByte to zero before returning. In the second, \n** set *piEndBlock to the first value and *pnByte to the second.\n*/\nstatic void fts3ReadEndBlockField(\n  sqlite3_stmt *pStmt, \n  int iCol, \n  i64 *piEndBlock,\n  i64 *pnByte\n){\n  const unsigned char *zText = sqlite3_column_text(pStmt, iCol);\n  if( zText ){\n    int i;\n    int iMul = 1;\n    i64 iVal = 0;\n    for(i=0; zText[i]>='0' && zText[i]<='9'; i++){\n      iVal = iVal*10 + (zText[i] - '0');\n    }\n    *piEndBlock = iVal;\n    while( zText[i]==' ' ) i++;\n    iVal = 0;\n    if( zText[i]=='-' ){\n      i++;\n      iMul = -1;\n    }\n    for(/* no-op */; zText[i]>='0' && zText[i]<='9'; i++){\n      iVal = iVal*10 + (zText[i] - '0');\n    }\n    *pnByte = (iVal * (i64)iMul);\n  }\n}\n\n\n/*\n** A segment of size nByte bytes has just been written to absolute level\n** iAbsLevel. Promote any segments that should be promoted as a result.\n*/\nstatic int fts3PromoteSegments(\n  Fts3Table *p,                   /* FTS table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute level just updated */\n  sqlite3_int64 nByte             /* Size of new segment at iAbsLevel */\n){\n  int rc = SQLITE_OK;\n  sqlite3_stmt *pRange;\n\n  rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE2, &pRange, 0);\n\n  if( rc==SQLITE_OK ){\n    int bOk = 0;\n    i64 iLast = (iAbsLevel/FTS3_SEGDIR_MAXLEVEL + 1) * FTS3_SEGDIR_MAXLEVEL - 1;\n    i64 nLimit = (nByte*3)/2;\n\n    /* Loop through all entries in the %_segdir table corresponding to \n    ** segments in this index on levels greater than iAbsLevel. If there is\n    ** at least one such segment, and it is possible to determine that all \n    ** such segments are smaller than nLimit bytes in size, they will be \n    ** promoted to level iAbsLevel.  */\n    sqlite3_bind_int64(pRange, 1, iAbsLevel+1);\n    sqlite3_bind_int64(pRange, 2, iLast);\n    while( SQLITE_ROW==sqlite3_step(pRange) ){\n      i64 nSize = 0, dummy;\n      fts3ReadEndBlockField(pRange, 2, &dummy, &nSize);\n      if( nSize<=0 || nSize>nLimit ){\n        /* If nSize==0, then the %_segdir.end_block field does not not \n        ** contain a size value. This happens if it was written by an\n        ** old version of FTS. In this case it is not possible to determine\n        ** the size of the segment, and so segment promotion does not\n        ** take place.  */\n        bOk = 0;\n        break;\n      }\n      bOk = 1;\n    }\n    rc = sqlite3_reset(pRange);\n\n    if( bOk ){\n      int iIdx = 0;\n      sqlite3_stmt *pUpdate1 = 0;\n      sqlite3_stmt *pUpdate2 = 0;\n\n      if( rc==SQLITE_OK ){\n        rc = fts3SqlStmt(p, SQL_UPDATE_LEVEL_IDX, &pUpdate1, 0);\n      }\n      if( rc==SQLITE_OK ){\n        rc = fts3SqlStmt(p, SQL_UPDATE_LEVEL, &pUpdate2, 0);\n      }\n\n      if( rc==SQLITE_OK ){\n\n        /* Loop through all %_segdir entries for segments in this index with\n        ** levels equal to or greater than iAbsLevel. As each entry is visited,\n        ** updated it to set (level = -1) and (idx = N), where N is 0 for the\n        ** oldest segment in the range, 1 for the next oldest, and so on.\n        **\n        ** In other words, move all segments being promoted to level -1,\n        ** setting the \"idx\" fields as appropriate to keep them in the same\n        ** order. The contents of level -1 (which is never used, except\n        ** transiently here), will be moved back to level iAbsLevel below.  */\n        sqlite3_bind_int64(pRange, 1, iAbsLevel);\n        while( SQLITE_ROW==sqlite3_step(pRange) ){\n          sqlite3_bind_int(pUpdate1, 1, iIdx++);\n          sqlite3_bind_int(pUpdate1, 2, sqlite3_column_int(pRange, 0));\n          sqlite3_bind_int(pUpdate1, 3, sqlite3_column_int(pRange, 1));\n          sqlite3_step(pUpdate1);\n          rc = sqlite3_reset(pUpdate1);\n          if( rc!=SQLITE_OK ){\n            sqlite3_reset(pRange);\n            break;\n          }\n        }\n      }\n      if( rc==SQLITE_OK ){\n        rc = sqlite3_reset(pRange);\n      }\n\n      /* Move level -1 to level iAbsLevel */\n      if( rc==SQLITE_OK ){\n        sqlite3_bind_int64(pUpdate2, 1, iAbsLevel);\n        sqlite3_step(pUpdate2);\n        rc = sqlite3_reset(pUpdate2);\n      }\n    }\n  }\n\n\n  return rc;\n}\n\n/*\n** Merge all level iLevel segments in the database into a single \n** iLevel+1 segment. Or, if iLevel<0, merge all segments into a\n** single segment with a level equal to the numerically largest level \n** currently present in the database.\n**\n** If this function is called with iLevel<0, but there is only one\n** segment in the database, SQLITE_DONE is returned immediately. \n** Otherwise, if successful, SQLITE_OK is returned. If an error occurs, \n** an SQLite error code is returned.\n*/\nstatic int fts3SegmentMerge(\n  Fts3Table *p, \n  int iLangid,                    /* Language id to merge */\n  int iIndex,                     /* Index in p->aIndex[] to merge */\n  int iLevel                      /* Level to merge */\n){\n  int rc;                         /* Return code */\n  int iIdx = 0;                   /* Index of new segment */\n  sqlite3_int64 iNewLevel = 0;    /* Level/index to create new segment at */\n  SegmentWriter *pWriter = 0;     /* Used to write the new, merged, segment */\n  Fts3SegFilter filter;           /* Segment term filter condition */\n  Fts3MultiSegReader csr;         /* Cursor to iterate through level(s) */\n  int bIgnoreEmpty = 0;           /* True to ignore empty segments */\n  i64 iMaxLevel = 0;              /* Max level number for this index/langid */\n\n  assert( iLevel==FTS3_SEGCURSOR_ALL\n       || iLevel==FTS3_SEGCURSOR_PENDING\n       || iLevel>=0\n  );\n  assert( iLevel<FTS3_SEGDIR_MAXLEVEL );\n  assert( iIndex>=0 && iIndex<p->nIndex );\n\n  rc = sqlite3Fts3SegReaderCursor(p, iLangid, iIndex, iLevel, 0, 0, 1, 0, &csr);\n  if( rc!=SQLITE_OK || csr.nSegment==0 ) goto finished;\n\n  if( iLevel!=FTS3_SEGCURSOR_PENDING ){\n    rc = fts3SegmentMaxLevel(p, iLangid, iIndex, &iMaxLevel);\n    if( rc!=SQLITE_OK ) goto finished;\n  }\n\n  if( iLevel==FTS3_SEGCURSOR_ALL ){\n    /* This call is to merge all segments in the database to a single\n    ** segment. The level of the new segment is equal to the numerically\n    ** greatest segment level currently present in the database for this\n    ** index. The idx of the new segment is always 0.  */\n    if( csr.nSegment==1 && 0==fts3SegReaderIsPending(csr.apSegment[0]) ){\n      rc = SQLITE_DONE;\n      goto finished;\n    }\n    iNewLevel = iMaxLevel;\n    bIgnoreEmpty = 1;\n\n  }else{\n    /* This call is to merge all segments at level iLevel. find the next\n    ** available segment index at level iLevel+1. The call to\n    ** fts3AllocateSegdirIdx() will merge the segments at level iLevel+1 to \n    ** a single iLevel+2 segment if necessary.  */\n    assert( FTS3_SEGCURSOR_PENDING==-1 );\n    iNewLevel = getAbsoluteLevel(p, iLangid, iIndex, iLevel+1);\n    rc = fts3AllocateSegdirIdx(p, iLangid, iIndex, iLevel+1, &iIdx);\n    bIgnoreEmpty = (iLevel!=FTS3_SEGCURSOR_PENDING) && (iNewLevel>iMaxLevel);\n  }\n  if( rc!=SQLITE_OK ) goto finished;\n\n  assert( csr.nSegment>0 );\n  assert( iNewLevel>=getAbsoluteLevel(p, iLangid, iIndex, 0) );\n  assert( iNewLevel<getAbsoluteLevel(p, iLangid, iIndex,FTS3_SEGDIR_MAXLEVEL) );\n\n  memset(&filter, 0, sizeof(Fts3SegFilter));\n  filter.flags = FTS3_SEGMENT_REQUIRE_POS;\n  filter.flags |= (bIgnoreEmpty ? FTS3_SEGMENT_IGNORE_EMPTY : 0);\n\n  rc = sqlite3Fts3SegReaderStart(p, &csr, &filter);\n  while( SQLITE_OK==rc ){\n    rc = sqlite3Fts3SegReaderStep(p, &csr);\n    if( rc!=SQLITE_ROW ) break;\n    rc = fts3SegWriterAdd(p, &pWriter, 1, \n        csr.zTerm, csr.nTerm, csr.aDoclist, csr.nDoclist);\n  }\n  if( rc!=SQLITE_OK ) goto finished;\n  assert( pWriter || bIgnoreEmpty );\n\n  if( iLevel!=FTS3_SEGCURSOR_PENDING ){\n    rc = fts3DeleteSegdir(\n        p, iLangid, iIndex, iLevel, csr.apSegment, csr.nSegment\n    );\n    if( rc!=SQLITE_OK ) goto finished;\n  }\n  if( pWriter ){\n    rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);\n    if( rc==SQLITE_OK ){\n      if( iLevel==FTS3_SEGCURSOR_PENDING || iNewLevel<iMaxLevel ){\n        rc = fts3PromoteSegments(p, iNewLevel, pWriter->nLeafData);\n      }\n    }\n  }\n\n finished:\n  fts3SegWriterFree(pWriter);\n  sqlite3Fts3SegReaderFinish(&csr);\n  return rc;\n}\n\n\n/* \n** Flush the contents of pendingTerms to level 0 segments. \n*/\nint sqlite3Fts3PendingTermsFlush(Fts3Table *p){\n  int rc = SQLITE_OK;\n  int i;\n        \n  for(i=0; rc==SQLITE_OK && i<p->nIndex; i++){\n    rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING);\n    if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n  }\n  sqlite3Fts3PendingTermsClear(p);\n\n  /* Determine the auto-incr-merge setting if unknown.  If enabled,\n  ** estimate the number of leaf blocks of content to be written\n  */\n  if( rc==SQLITE_OK && p->bHasStat\n   && p->nAutoincrmerge==0xff && p->nLeafAdd>0\n  ){\n    sqlite3_stmt *pStmt = 0;\n    rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE);\n      rc = sqlite3_step(pStmt);\n      if( rc==SQLITE_ROW ){\n        p->nAutoincrmerge = sqlite3_column_int(pStmt, 0);\n        if( p->nAutoincrmerge==1 ) p->nAutoincrmerge = 8;\n      }else if( rc==SQLITE_DONE ){\n        p->nAutoincrmerge = 0;\n      }\n      rc = sqlite3_reset(pStmt);\n    }\n  }\n  return rc;\n}\n\n/*\n** Encode N integers as varints into a blob.\n*/\nstatic void fts3EncodeIntArray(\n  int N,             /* The number of integers to encode */\n  u32 *a,            /* The integer values */\n  char *zBuf,        /* Write the BLOB here */\n  int *pNBuf         /* Write number of bytes if zBuf[] used here */\n){\n  int i, j;\n  for(i=j=0; i<N; i++){\n    j += sqlite3Fts3PutVarint(&zBuf[j], (sqlite3_int64)a[i]);\n  }\n  *pNBuf = j;\n}\n\n/*\n** Decode a blob of varints into N integers\n*/\nstatic void fts3DecodeIntArray(\n  int N,             /* The number of integers to decode */\n  u32 *a,            /* Write the integer values */\n  const char *zBuf,  /* The BLOB containing the varints */\n  int nBuf           /* size of the BLOB */\n){\n  int i, j;\n  UNUSED_PARAMETER(nBuf);\n  for(i=j=0; i<N; i++){\n    sqlite3_int64 x;\n    j += sqlite3Fts3GetVarint(&zBuf[j], &x);\n    assert(j<=nBuf);\n    a[i] = (u32)(x & 0xffffffff);\n  }\n}\n\n/*\n** Insert the sizes (in tokens) for each column of the document\n** with docid equal to p->iPrevDocid.  The sizes are encoded as\n** a blob of varints.\n*/\nstatic void fts3InsertDocsize(\n  int *pRC,                       /* Result code */\n  Fts3Table *p,                   /* Table into which to insert */\n  u32 *aSz                        /* Sizes of each column, in tokens */\n){\n  char *pBlob;             /* The BLOB encoding of the document size */\n  int nBlob;               /* Number of bytes in the BLOB */\n  sqlite3_stmt *pStmt;     /* Statement used to insert the encoding */\n  int rc;                  /* Result code from subfunctions */\n\n  if( *pRC ) return;\n  pBlob = sqlite3_malloc( 10*p->nColumn );\n  if( pBlob==0 ){\n    *pRC = SQLITE_NOMEM;\n    return;\n  }\n  fts3EncodeIntArray(p->nColumn, aSz, pBlob, &nBlob);\n  rc = fts3SqlStmt(p, SQL_REPLACE_DOCSIZE, &pStmt, 0);\n  if( rc ){\n    sqlite3_free(pBlob);\n    *pRC = rc;\n    return;\n  }\n  sqlite3_bind_int64(pStmt, 1, p->iPrevDocid);\n  sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, sqlite3_free);\n  sqlite3_step(pStmt);\n  *pRC = sqlite3_reset(pStmt);\n}\n\n/*\n** Record 0 of the %_stat table contains a blob consisting of N varints,\n** where N is the number of user defined columns in the fts3 table plus\n** two. If nCol is the number of user defined columns, then values of the \n** varints are set as follows:\n**\n**   Varint 0:       Total number of rows in the table.\n**\n**   Varint 1..nCol: For each column, the total number of tokens stored in\n**                   the column for all rows of the table.\n**\n**   Varint 1+nCol:  The total size, in bytes, of all text values in all\n**                   columns of all rows of the table.\n**\n*/\nstatic void fts3UpdateDocTotals(\n  int *pRC,                       /* The result code */\n  Fts3Table *p,                   /* Table being updated */\n  u32 *aSzIns,                    /* Size increases */\n  u32 *aSzDel,                    /* Size decreases */\n  int nChng                       /* Change in the number of documents */\n){\n  char *pBlob;             /* Storage for BLOB written into %_stat */\n  int nBlob;               /* Size of BLOB written into %_stat */\n  u32 *a;                  /* Array of integers that becomes the BLOB */\n  sqlite3_stmt *pStmt;     /* Statement for reading and writing */\n  int i;                   /* Loop counter */\n  int rc;                  /* Result code from subfunctions */\n\n  const int nStat = p->nColumn+2;\n\n  if( *pRC ) return;\n  a = sqlite3_malloc( (sizeof(u32)+10)*nStat );\n  if( a==0 ){\n    *pRC = SQLITE_NOMEM;\n    return;\n  }\n  pBlob = (char*)&a[nStat];\n  rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0);\n  if( rc ){\n    sqlite3_free(a);\n    *pRC = rc;\n    return;\n  }\n  sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL);\n  if( sqlite3_step(pStmt)==SQLITE_ROW ){\n    fts3DecodeIntArray(nStat, a,\n         sqlite3_column_blob(pStmt, 0),\n         sqlite3_column_bytes(pStmt, 0));\n  }else{\n    memset(a, 0, sizeof(u32)*(nStat) );\n  }\n  rc = sqlite3_reset(pStmt);\n  if( rc!=SQLITE_OK ){\n    sqlite3_free(a);\n    *pRC = rc;\n    return;\n  }\n  if( nChng<0 && a[0]<(u32)(-nChng) ){\n    a[0] = 0;\n  }else{\n    a[0] += nChng;\n  }\n  for(i=0; i<p->nColumn+1; i++){\n    u32 x = a[i+1];\n    if( x+aSzIns[i] < aSzDel[i] ){\n      x = 0;\n    }else{\n      x = x + aSzIns[i] - aSzDel[i];\n    }\n    a[i+1] = x;\n  }\n  fts3EncodeIntArray(nStat, a, pBlob, &nBlob);\n  rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pStmt, 0);\n  if( rc ){\n    sqlite3_free(a);\n    *pRC = rc;\n    return;\n  }\n  sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL);\n  sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, SQLITE_STATIC);\n  sqlite3_step(pStmt);\n  *pRC = sqlite3_reset(pStmt);\n  sqlite3_free(a);\n}\n\n/*\n** Merge the entire database so that there is one segment for each \n** iIndex/iLangid combination.\n*/\nstatic int fts3DoOptimize(Fts3Table *p, int bReturnDone){\n  int bSeenDone = 0;\n  int rc;\n  sqlite3_stmt *pAllLangid = 0;\n\n  rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);\n  if( rc==SQLITE_OK ){\n    int rc2;\n    sqlite3_bind_int(pAllLangid, 1, p->iPrevLangid);\n    sqlite3_bind_int(pAllLangid, 2, p->nIndex);\n    while( sqlite3_step(pAllLangid)==SQLITE_ROW ){\n      int i;\n      int iLangid = sqlite3_column_int(pAllLangid, 0);\n      for(i=0; rc==SQLITE_OK && i<p->nIndex; i++){\n        rc = fts3SegmentMerge(p, iLangid, i, FTS3_SEGCURSOR_ALL);\n        if( rc==SQLITE_DONE ){\n          bSeenDone = 1;\n          rc = SQLITE_OK;\n        }\n      }\n    }\n    rc2 = sqlite3_reset(pAllLangid);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  sqlite3Fts3SegmentsClose(p);\n  sqlite3Fts3PendingTermsClear(p);\n\n  return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc;\n}\n\n/*\n** This function is called when the user executes the following statement:\n**\n**     INSERT INTO <tbl>(<tbl>) VALUES('rebuild');\n**\n** The entire FTS index is discarded and rebuilt. If the table is one \n** created using the content=xxx option, then the new index is based on\n** the current contents of the xxx table. Otherwise, it is rebuilt based\n** on the contents of the %_content table.\n*/\nstatic int fts3DoRebuild(Fts3Table *p){\n  int rc;                         /* Return Code */\n\n  rc = fts3DeleteAll(p, 0);\n  if( rc==SQLITE_OK ){\n    u32 *aSz = 0;\n    u32 *aSzIns = 0;\n    u32 *aSzDel = 0;\n    sqlite3_stmt *pStmt = 0;\n    int nEntry = 0;\n\n    /* Compose and prepare an SQL statement to loop through the content table */\n    char *zSql = sqlite3_mprintf(\"SELECT %s\" , p->zReadExprlist);\n    if( !zSql ){\n      rc = SQLITE_NOMEM;\n    }else{\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);\n      sqlite3_free(zSql);\n    }\n\n    if( rc==SQLITE_OK ){\n      int nByte = sizeof(u32) * (p->nColumn+1)*3;\n      aSz = (u32 *)sqlite3_malloc(nByte);\n      if( aSz==0 ){\n        rc = SQLITE_NOMEM;\n      }else{\n        memset(aSz, 0, nByte);\n        aSzIns = &aSz[p->nColumn+1];\n        aSzDel = &aSzIns[p->nColumn+1];\n      }\n    }\n\n    while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){\n      int iCol;\n      int iLangid = langidFromSelect(p, pStmt);\n      rc = fts3PendingTermsDocid(p, 0, iLangid, sqlite3_column_int64(pStmt, 0));\n      memset(aSz, 0, sizeof(aSz[0]) * (p->nColumn+1));\n      for(iCol=0; rc==SQLITE_OK && iCol<p->nColumn; iCol++){\n        if( p->abNotindexed[iCol]==0 ){\n          const char *z = (const char *) sqlite3_column_text(pStmt, iCol+1);\n          rc = fts3PendingTermsAdd(p, iLangid, z, iCol, &aSz[iCol]);\n          aSz[p->nColumn] += sqlite3_column_bytes(pStmt, iCol+1);\n        }\n      }\n      if( p->bHasDocsize ){\n        fts3InsertDocsize(&rc, p, aSz);\n      }\n      if( rc!=SQLITE_OK ){\n        sqlite3_finalize(pStmt);\n        pStmt = 0;\n      }else{\n        nEntry++;\n        for(iCol=0; iCol<=p->nColumn; iCol++){\n          aSzIns[iCol] += aSz[iCol];\n        }\n      }\n    }\n    if( p->bFts4 ){\n      fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nEntry);\n    }\n    sqlite3_free(aSz);\n\n    if( pStmt ){\n      int rc2 = sqlite3_finalize(pStmt);\n      if( rc==SQLITE_OK ){\n        rc = rc2;\n      }\n    }\n  }\n\n  return rc;\n}\n\n\n/*\n** This function opens a cursor used to read the input data for an \n** incremental merge operation. Specifically, it opens a cursor to scan\n** the oldest nSeg segments (idx=0 through idx=(nSeg-1)) in absolute \n** level iAbsLevel.\n*/\nstatic int fts3IncrmergeCsr(\n  Fts3Table *p,                   /* FTS3 table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute level to open */\n  int nSeg,                       /* Number of segments to merge */\n  Fts3MultiSegReader *pCsr        /* Cursor object to populate */\n){\n  int rc;                         /* Return Code */\n  sqlite3_stmt *pStmt = 0;        /* Statement used to read %_segdir entry */  \n  int nByte;                      /* Bytes allocated at pCsr->apSegment[] */\n\n  /* Allocate space for the Fts3MultiSegReader.aCsr[] array */\n  memset(pCsr, 0, sizeof(*pCsr));\n  nByte = sizeof(Fts3SegReader *) * nSeg;\n  pCsr->apSegment = (Fts3SegReader **)sqlite3_malloc(nByte);\n\n  if( pCsr->apSegment==0 ){\n    rc = SQLITE_NOMEM;\n  }else{\n    memset(pCsr->apSegment, 0, nByte);\n    rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0);\n  }\n  if( rc==SQLITE_OK ){\n    int i;\n    int rc2;\n    sqlite3_bind_int64(pStmt, 1, iAbsLevel);\n    assert( pCsr->nSegment==0 );\n    for(i=0; rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW && i<nSeg; i++){\n      rc = sqlite3Fts3SegReaderNew(i, 0,\n          sqlite3_column_int64(pStmt, 1),        /* segdir.start_block */\n          sqlite3_column_int64(pStmt, 2),        /* segdir.leaves_end_block */\n          sqlite3_column_int64(pStmt, 3),        /* segdir.end_block */\n          sqlite3_column_blob(pStmt, 4),         /* segdir.root */\n          sqlite3_column_bytes(pStmt, 4),        /* segdir.root */\n          &pCsr->apSegment[i]\n      );\n      pCsr->nSegment++;\n    }\n    rc2 = sqlite3_reset(pStmt);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  return rc;\n}\n\ntypedef struct IncrmergeWriter IncrmergeWriter;\ntypedef struct NodeWriter NodeWriter;\ntypedef struct Blob Blob;\ntypedef struct NodeReader NodeReader;\n\n/*\n** An instance of the following structure is used as a dynamic buffer\n** to build up nodes or other blobs of data in.\n**\n** The function blobGrowBuffer() is used to extend the allocation.\n*/\nstruct Blob {\n  char *a;                        /* Pointer to allocation */\n  int n;                          /* Number of valid bytes of data in a[] */\n  int nAlloc;                     /* Allocated size of a[] (nAlloc>=n) */\n};\n\n/*\n** This structure is used to build up buffers containing segment b-tree \n** nodes (blocks).\n*/\nstruct NodeWriter {\n  sqlite3_int64 iBlock;           /* Current block id */\n  Blob key;                       /* Last key written to the current block */\n  Blob block;                     /* Current block image */\n};\n\n/*\n** An object of this type contains the state required to create or append\n** to an appendable b-tree segment.\n*/\nstruct IncrmergeWriter {\n  int nLeafEst;                   /* Space allocated for leaf blocks */\n  int nWork;                      /* Number of leaf pages flushed */\n  sqlite3_int64 iAbsLevel;        /* Absolute level of input segments */\n  int iIdx;                       /* Index of *output* segment in iAbsLevel+1 */\n  sqlite3_int64 iStart;           /* Block number of first allocated block */\n  sqlite3_int64 iEnd;             /* Block number of last allocated block */\n  sqlite3_int64 nLeafData;        /* Bytes of leaf page data so far */\n  u8 bNoLeafData;                 /* If true, store 0 for segment size */\n  NodeWriter aNodeWriter[FTS_MAX_APPENDABLE_HEIGHT];\n};\n\n/*\n** An object of the following type is used to read data from a single\n** FTS segment node. See the following functions:\n**\n**     nodeReaderInit()\n**     nodeReaderNext()\n**     nodeReaderRelease()\n*/\nstruct NodeReader {\n  const char *aNode;\n  int nNode;\n  int iOff;                       /* Current offset within aNode[] */\n\n  /* Output variables. Containing the current node entry. */\n  sqlite3_int64 iChild;           /* Pointer to child node */\n  Blob term;                      /* Current term */\n  const char *aDoclist;           /* Pointer to doclist */\n  int nDoclist;                   /* Size of doclist in bytes */\n};\n\n/*\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\n** Otherwise, if the allocation at pBlob->a is not already at least nMin\n** bytes in size, extend (realloc) it to be so.\n**\n** If an OOM error occurs, set *pRc to SQLITE_NOMEM and leave pBlob->a\n** unmodified. Otherwise, if the allocation succeeds, update pBlob->nAlloc\n** to reflect the new size of the pBlob->a[] buffer.\n*/\nstatic void blobGrowBuffer(Blob *pBlob, int nMin, int *pRc){\n  if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){\n    int nAlloc = nMin;\n    char *a = (char *)sqlite3_realloc(pBlob->a, nAlloc);\n    if( a ){\n      pBlob->nAlloc = nAlloc;\n      pBlob->a = a;\n    }else{\n      *pRc = SQLITE_NOMEM;\n    }\n  }\n}\n\n/*\n** Attempt to advance the node-reader object passed as the first argument to\n** the next entry on the node. \n**\n** Return an error code if an error occurs (SQLITE_NOMEM is possible). \n** Otherwise return SQLITE_OK. If there is no next entry on the node\n** (e.g. because the current entry is the last) set NodeReader->aNode to\n** NULL to indicate EOF. Otherwise, populate the NodeReader structure output \n** variables for the new entry.\n*/\nstatic int nodeReaderNext(NodeReader *p){\n  int bFirst = (p->term.n==0);    /* True for first term on the node */\n  int nPrefix = 0;                /* Bytes to copy from previous term */\n  int nSuffix = 0;                /* Bytes to append to the prefix */\n  int rc = SQLITE_OK;             /* Return code */\n\n  assert( p->aNode );\n  if( p->iChild && bFirst==0 ) p->iChild++;\n  if( p->iOff>=p->nNode ){\n    /* EOF */\n    p->aNode = 0;\n  }else{\n    if( bFirst==0 ){\n      p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nPrefix);\n    }\n    p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix);\n\n    blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc);\n    if( rc==SQLITE_OK ){\n      memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix);\n      p->term.n = nPrefix+nSuffix;\n      p->iOff += nSuffix;\n      if( p->iChild==0 ){\n        p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &p->nDoclist);\n        p->aDoclist = &p->aNode[p->iOff];\n        p->iOff += p->nDoclist;\n      }\n    }\n  }\n\n  assert( p->iOff<=p->nNode );\n\n  return rc;\n}\n\n/*\n** Release all dynamic resources held by node-reader object *p.\n*/\nstatic void nodeReaderRelease(NodeReader *p){\n  sqlite3_free(p->term.a);\n}\n\n/*\n** Initialize a node-reader object to read the node in buffer aNode/nNode.\n**\n** If successful, SQLITE_OK is returned and the NodeReader object set to \n** point to the first entry on the node (if any). Otherwise, an SQLite\n** error code is returned.\n*/\nstatic int nodeReaderInit(NodeReader *p, const char *aNode, int nNode){\n  memset(p, 0, sizeof(NodeReader));\n  p->aNode = aNode;\n  p->nNode = nNode;\n\n  /* Figure out if this is a leaf or an internal node. */\n  if( p->aNode[0] ){\n    /* An internal node. */\n    p->iOff = 1 + sqlite3Fts3GetVarint(&p->aNode[1], &p->iChild);\n  }else{\n    p->iOff = 1;\n  }\n\n  return nodeReaderNext(p);\n}\n\n/*\n** This function is called while writing an FTS segment each time a leaf o\n** node is finished and written to disk. The key (zTerm/nTerm) is guaranteed\n** to be greater than the largest key on the node just written, but smaller\n** than or equal to the first key that will be written to the next leaf\n** node.\n**\n** The block id of the leaf node just written to disk may be found in\n** (pWriter->aNodeWriter[0].iBlock) when this function is called.\n*/\nstatic int fts3IncrmergePush(\n  Fts3Table *p,                   /* Fts3 table handle */\n  IncrmergeWriter *pWriter,       /* Writer object */\n  const char *zTerm,              /* Term to write to internal node */\n  int nTerm                       /* Bytes at zTerm */\n){\n  sqlite3_int64 iPtr = pWriter->aNodeWriter[0].iBlock;\n  int iLayer;\n\n  assert( nTerm>0 );\n  for(iLayer=1; ALWAYS(iLayer<FTS_MAX_APPENDABLE_HEIGHT); iLayer++){\n    sqlite3_int64 iNextPtr = 0;\n    NodeWriter *pNode = &pWriter->aNodeWriter[iLayer];\n    int rc = SQLITE_OK;\n    int nPrefix;\n    int nSuffix;\n    int nSpace;\n\n    /* Figure out how much space the key will consume if it is written to\n    ** the current node of layer iLayer. Due to the prefix compression, \n    ** the space required changes depending on which node the key is to\n    ** be added to.  */\n    nPrefix = fts3PrefixCompress(pNode->key.a, pNode->key.n, zTerm, nTerm);\n    nSuffix = nTerm - nPrefix;\n    nSpace  = sqlite3Fts3VarintLen(nPrefix);\n    nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix;\n\n    if( pNode->key.n==0 || (pNode->block.n + nSpace)<=p->nNodeSize ){ \n      /* If the current node of layer iLayer contains zero keys, or if adding\n      ** the key to it will not cause it to grow to larger than nNodeSize \n      ** bytes in size, write the key here.  */\n\n      Blob *pBlk = &pNode->block;\n      if( pBlk->n==0 ){\n        blobGrowBuffer(pBlk, p->nNodeSize, &rc);\n        if( rc==SQLITE_OK ){\n          pBlk->a[0] = (char)iLayer;\n          pBlk->n = 1 + sqlite3Fts3PutVarint(&pBlk->a[1], iPtr);\n        }\n      }\n      blobGrowBuffer(pBlk, pBlk->n + nSpace, &rc);\n      blobGrowBuffer(&pNode->key, nTerm, &rc);\n\n      if( rc==SQLITE_OK ){\n        if( pNode->key.n ){\n          pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix);\n        }\n        pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix);\n        memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix);\n        pBlk->n += nSuffix;\n\n        memcpy(pNode->key.a, zTerm, nTerm);\n        pNode->key.n = nTerm;\n      }\n    }else{\n      /* Otherwise, flush the current node of layer iLayer to disk.\n      ** Then allocate a new, empty sibling node. The key will be written\n      ** into the parent of this node. */\n      rc = fts3WriteSegment(p, pNode->iBlock, pNode->block.a, pNode->block.n);\n\n      assert( pNode->block.nAlloc>=p->nNodeSize );\n      pNode->block.a[0] = (char)iLayer;\n      pNode->block.n = 1 + sqlite3Fts3PutVarint(&pNode->block.a[1], iPtr+1);\n\n      iNextPtr = pNode->iBlock;\n      pNode->iBlock++;\n      pNode->key.n = 0;\n    }\n\n    if( rc!=SQLITE_OK || iNextPtr==0 ) return rc;\n    iPtr = iNextPtr;\n  }\n\n  assert( 0 );\n  return 0;\n}\n\n/*\n** Append a term and (optionally) doclist to the FTS segment node currently\n** stored in blob *pNode. The node need not contain any terms, but the\n** header must be written before this function is called.\n**\n** A node header is a single 0x00 byte for a leaf node, or a height varint\n** followed by the left-hand-child varint for an internal node.\n**\n** The term to be appended is passed via arguments zTerm/nTerm. For a \n** leaf node, the doclist is passed as aDoclist/nDoclist. For an internal\n** node, both aDoclist and nDoclist must be passed 0.\n**\n** If the size of the value in blob pPrev is zero, then this is the first\n** term written to the node. Otherwise, pPrev contains a copy of the \n** previous term. Before this function returns, it is updated to contain a\n** copy of zTerm/nTerm.\n**\n** It is assumed that the buffer associated with pNode is already large\n** enough to accommodate the new entry. The buffer associated with pPrev\n** is extended by this function if requrired.\n**\n** If an error (i.e. OOM condition) occurs, an SQLite error code is\n** returned. Otherwise, SQLITE_OK.\n*/\nstatic int fts3AppendToNode(\n  Blob *pNode,                    /* Current node image to append to */\n  Blob *pPrev,                    /* Buffer containing previous term written */\n  const char *zTerm,              /* New term to write */\n  int nTerm,                      /* Size of zTerm in bytes */\n  const char *aDoclist,           /* Doclist (or NULL) to write */\n  int nDoclist                    /* Size of aDoclist in bytes */ \n){\n  int rc = SQLITE_OK;             /* Return code */\n  int bFirst = (pPrev->n==0);     /* True if this is the first term written */\n  int nPrefix;                    /* Size of term prefix in bytes */\n  int nSuffix;                    /* Size of term suffix in bytes */\n\n  /* Node must have already been started. There must be a doclist for a\n  ** leaf node, and there must not be a doclist for an internal node.  */\n  assert( pNode->n>0 );\n  assert( (pNode->a[0]=='\\0')==(aDoclist!=0) );\n\n  blobGrowBuffer(pPrev, nTerm, &rc);\n  if( rc!=SQLITE_OK ) return rc;\n\n  nPrefix = fts3PrefixCompress(pPrev->a, pPrev->n, zTerm, nTerm);\n  nSuffix = nTerm - nPrefix;\n  memcpy(pPrev->a, zTerm, nTerm);\n  pPrev->n = nTerm;\n\n  if( bFirst==0 ){\n    pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nPrefix);\n  }\n  pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nSuffix);\n  memcpy(&pNode->a[pNode->n], &zTerm[nPrefix], nSuffix);\n  pNode->n += nSuffix;\n\n  if( aDoclist ){\n    pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nDoclist);\n    memcpy(&pNode->a[pNode->n], aDoclist, nDoclist);\n    pNode->n += nDoclist;\n  }\n\n  assert( pNode->n<=pNode->nAlloc );\n\n  return SQLITE_OK;\n}\n\n/*\n** Append the current term and doclist pointed to by cursor pCsr to the\n** appendable b-tree segment opened for writing by pWriter.\n**\n** Return SQLITE_OK if successful, or an SQLite error code otherwise.\n*/\nstatic int fts3IncrmergeAppend(\n  Fts3Table *p,                   /* Fts3 table handle */\n  IncrmergeWriter *pWriter,       /* Writer object */\n  Fts3MultiSegReader *pCsr        /* Cursor containing term and doclist */\n){\n  const char *zTerm = pCsr->zTerm;\n  int nTerm = pCsr->nTerm;\n  const char *aDoclist = pCsr->aDoclist;\n  int nDoclist = pCsr->nDoclist;\n  int rc = SQLITE_OK;           /* Return code */\n  int nSpace;                   /* Total space in bytes required on leaf */\n  int nPrefix;                  /* Size of prefix shared with previous term */\n  int nSuffix;                  /* Size of suffix (nTerm - nPrefix) */\n  NodeWriter *pLeaf;            /* Object used to write leaf nodes */\n\n  pLeaf = &pWriter->aNodeWriter[0];\n  nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm);\n  nSuffix = nTerm - nPrefix;\n\n  nSpace  = sqlite3Fts3VarintLen(nPrefix);\n  nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix;\n  nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist;\n\n  /* If the current block is not empty, and if adding this term/doclist\n  ** to the current block would make it larger than Fts3Table.nNodeSize\n  ** bytes, write this block out to the database. */\n  if( pLeaf->block.n>0 && (pLeaf->block.n + nSpace)>p->nNodeSize ){\n    rc = fts3WriteSegment(p, pLeaf->iBlock, pLeaf->block.a, pLeaf->block.n);\n    pWriter->nWork++;\n\n    /* Add the current term to the parent node. The term added to the \n    ** parent must:\n    **\n    **   a) be greater than the largest term on the leaf node just written\n    **      to the database (still available in pLeaf->key), and\n    **\n    **   b) be less than or equal to the term about to be added to the new\n    **      leaf node (zTerm/nTerm).\n    **\n    ** In other words, it must be the prefix of zTerm 1 byte longer than\n    ** the common prefix (if any) of zTerm and pWriter->zTerm.\n    */\n    if( rc==SQLITE_OK ){\n      rc = fts3IncrmergePush(p, pWriter, zTerm, nPrefix+1);\n    }\n\n    /* Advance to the next output block */\n    pLeaf->iBlock++;\n    pLeaf->key.n = 0;\n    pLeaf->block.n = 0;\n\n    nSuffix = nTerm;\n    nSpace  = 1;\n    nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix;\n    nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist;\n  }\n\n  pWriter->nLeafData += nSpace;\n  blobGrowBuffer(&pLeaf->block, pLeaf->block.n + nSpace, &rc);\n  if( rc==SQLITE_OK ){\n    if( pLeaf->block.n==0 ){\n      pLeaf->block.n = 1;\n      pLeaf->block.a[0] = '\\0';\n    }\n    rc = fts3AppendToNode(\n        &pLeaf->block, &pLeaf->key, zTerm, nTerm, aDoclist, nDoclist\n    );\n  }\n\n  return rc;\n}\n\n/*\n** This function is called to release all dynamic resources held by the\n** merge-writer object pWriter, and if no error has occurred, to flush\n** all outstanding node buffers held by pWriter to disk.\n**\n** If *pRc is not SQLITE_OK when this function is called, then no attempt\n** is made to write any data to disk. Instead, this function serves only\n** to release outstanding resources.\n**\n** Otherwise, if *pRc is initially SQLITE_OK and an error occurs while\n** flushing buffers to disk, *pRc is set to an SQLite error code before\n** returning.\n*/\nstatic void fts3IncrmergeRelease(\n  Fts3Table *p,                   /* FTS3 table handle */\n  IncrmergeWriter *pWriter,       /* Merge-writer object */\n  int *pRc                        /* IN/OUT: Error code */\n){\n  int i;                          /* Used to iterate through non-root layers */\n  int iRoot;                      /* Index of root in pWriter->aNodeWriter */\n  NodeWriter *pRoot;              /* NodeWriter for root node */\n  int rc = *pRc;                  /* Error code */\n\n  /* Set iRoot to the index in pWriter->aNodeWriter[] of the output segment \n  ** root node. If the segment fits entirely on a single leaf node, iRoot\n  ** will be set to 0. If the root node is the parent of the leaves, iRoot\n  ** will be 1. And so on.  */\n  for(iRoot=FTS_MAX_APPENDABLE_HEIGHT-1; iRoot>=0; iRoot--){\n    NodeWriter *pNode = &pWriter->aNodeWriter[iRoot];\n    if( pNode->block.n>0 ) break;\n    assert( *pRc || pNode->block.nAlloc==0 );\n    assert( *pRc || pNode->key.nAlloc==0 );\n    sqlite3_free(pNode->block.a);\n    sqlite3_free(pNode->key.a);\n  }\n\n  /* Empty output segment. This is a no-op. */\n  if( iRoot<0 ) return;\n\n  /* The entire output segment fits on a single node. Normally, this means\n  ** the node would be stored as a blob in the \"root\" column of the %_segdir\n  ** table. However, this is not permitted in this case. The problem is that \n  ** space has already been reserved in the %_segments table, and so the \n  ** start_block and end_block fields of the %_segdir table must be populated. \n  ** And, by design or by accident, released versions of FTS cannot handle \n  ** segments that fit entirely on the root node with start_block!=0.\n  **\n  ** Instead, create a synthetic root node that contains nothing but a \n  ** pointer to the single content node. So that the segment consists of a\n  ** single leaf and a single interior (root) node.\n  **\n  ** Todo: Better might be to defer allocating space in the %_segments \n  ** table until we are sure it is needed.\n  */\n  if( iRoot==0 ){\n    Blob *pBlock = &pWriter->aNodeWriter[1].block;\n    blobGrowBuffer(pBlock, 1 + FTS3_VARINT_MAX, &rc);\n    if( rc==SQLITE_OK ){\n      pBlock->a[0] = 0x01;\n      pBlock->n = 1 + sqlite3Fts3PutVarint(\n          &pBlock->a[1], pWriter->aNodeWriter[0].iBlock\n      );\n    }\n    iRoot = 1;\n  }\n  pRoot = &pWriter->aNodeWriter[iRoot];\n\n  /* Flush all currently outstanding nodes to disk. */\n  for(i=0; i<iRoot; i++){\n    NodeWriter *pNode = &pWriter->aNodeWriter[i];\n    if( pNode->block.n>0 && rc==SQLITE_OK ){\n      rc = fts3WriteSegment(p, pNode->iBlock, pNode->block.a, pNode->block.n);\n    }\n    sqlite3_free(pNode->block.a);\n    sqlite3_free(pNode->key.a);\n  }\n\n  /* Write the %_segdir record. */\n  if( rc==SQLITE_OK ){\n    rc = fts3WriteSegdir(p, \n        pWriter->iAbsLevel+1,               /* level */\n        pWriter->iIdx,                      /* idx */\n        pWriter->iStart,                    /* start_block */\n        pWriter->aNodeWriter[0].iBlock,     /* leaves_end_block */\n        pWriter->iEnd,                      /* end_block */\n        (pWriter->bNoLeafData==0 ? pWriter->nLeafData : 0),   /* end_block */\n        pRoot->block.a, pRoot->block.n      /* root */\n    );\n  }\n  sqlite3_free(pRoot->block.a);\n  sqlite3_free(pRoot->key.a);\n\n  *pRc = rc;\n}\n\n/*\n** Compare the term in buffer zLhs (size in bytes nLhs) with that in\n** zRhs (size in bytes nRhs) using memcmp. If one term is a prefix of\n** the other, it is considered to be smaller than the other.\n**\n** Return -ve if zLhs is smaller than zRhs, 0 if it is equal, or +ve\n** if it is greater.\n*/\nstatic int fts3TermCmp(\n  const char *zLhs, int nLhs,     /* LHS of comparison */\n  const char *zRhs, int nRhs      /* RHS of comparison */\n){\n  int nCmp = MIN(nLhs, nRhs);\n  int res;\n\n  res = memcmp(zLhs, zRhs, nCmp);\n  if( res==0 ) res = nLhs - nRhs;\n\n  return res;\n}\n\n\n/*\n** Query to see if the entry in the %_segments table with blockid iEnd is \n** NULL. If no error occurs and the entry is NULL, set *pbRes 1 before\n** returning. Otherwise, set *pbRes to 0. \n**\n** Or, if an error occurs while querying the database, return an SQLite \n** error code. The final value of *pbRes is undefined in this case.\n**\n** This is used to test if a segment is an \"appendable\" segment. If it\n** is, then a NULL entry has been inserted into the %_segments table\n** with blockid %_segdir.end_block.\n*/\nstatic int fts3IsAppendable(Fts3Table *p, sqlite3_int64 iEnd, int *pbRes){\n  int bRes = 0;                   /* Result to set *pbRes to */\n  sqlite3_stmt *pCheck = 0;       /* Statement to query database with */\n  int rc;                         /* Return code */\n\n  rc = fts3SqlStmt(p, SQL_SEGMENT_IS_APPENDABLE, &pCheck, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pCheck, 1, iEnd);\n    if( SQLITE_ROW==sqlite3_step(pCheck) ) bRes = 1;\n    rc = sqlite3_reset(pCheck);\n  }\n  \n  *pbRes = bRes;\n  return rc;\n}\n\n/*\n** This function is called when initializing an incremental-merge operation.\n** It checks if the existing segment with index value iIdx at absolute level \n** (iAbsLevel+1) can be appended to by the incremental merge. If it can, the\n** merge-writer object *pWriter is initialized to write to it.\n**\n** An existing segment can be appended to by an incremental merge if:\n**\n**   * It was initially created as an appendable segment (with all required\n**     space pre-allocated), and\n**\n**   * The first key read from the input (arguments zKey and nKey) is \n**     greater than the largest key currently stored in the potential\n**     output segment.\n*/\nstatic int fts3IncrmergeLoad(\n  Fts3Table *p,                   /* Fts3 table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute level of input segments */\n  int iIdx,                       /* Index of candidate output segment */\n  const char *zKey,               /* First key to write */\n  int nKey,                       /* Number of bytes in nKey */\n  IncrmergeWriter *pWriter        /* Populate this object */\n){\n  int rc;                         /* Return code */\n  sqlite3_stmt *pSelect = 0;      /* SELECT to read %_segdir entry */\n\n  rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR, &pSelect, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_int64 iStart = 0;     /* Value of %_segdir.start_block */\n    sqlite3_int64 iLeafEnd = 0;   /* Value of %_segdir.leaves_end_block */\n    sqlite3_int64 iEnd = 0;       /* Value of %_segdir.end_block */\n    const char *aRoot = 0;        /* Pointer to %_segdir.root buffer */\n    int nRoot = 0;                /* Size of aRoot[] in bytes */\n    int rc2;                      /* Return code from sqlite3_reset() */\n    int bAppendable = 0;          /* Set to true if segment is appendable */\n\n    /* Read the %_segdir entry for index iIdx absolute level (iAbsLevel+1) */\n    sqlite3_bind_int64(pSelect, 1, iAbsLevel+1);\n    sqlite3_bind_int(pSelect, 2, iIdx);\n    if( sqlite3_step(pSelect)==SQLITE_ROW ){\n      iStart = sqlite3_column_int64(pSelect, 1);\n      iLeafEnd = sqlite3_column_int64(pSelect, 2);\n      fts3ReadEndBlockField(pSelect, 3, &iEnd, &pWriter->nLeafData);\n      if( pWriter->nLeafData<0 ){\n        pWriter->nLeafData = pWriter->nLeafData * -1;\n      }\n      pWriter->bNoLeafData = (pWriter->nLeafData==0);\n      nRoot = sqlite3_column_bytes(pSelect, 4);\n      aRoot = sqlite3_column_blob(pSelect, 4);\n    }else{\n      return sqlite3_reset(pSelect);\n    }\n\n    /* Check for the zero-length marker in the %_segments table */\n    rc = fts3IsAppendable(p, iEnd, &bAppendable);\n\n    /* Check that zKey/nKey is larger than the largest key the candidate */\n    if( rc==SQLITE_OK && bAppendable ){\n      char *aLeaf = 0;\n      int nLeaf = 0;\n\n      rc = sqlite3Fts3ReadBlock(p, iLeafEnd, &aLeaf, &nLeaf, 0);\n      if( rc==SQLITE_OK ){\n        NodeReader reader;\n        for(rc = nodeReaderInit(&reader, aLeaf, nLeaf);\n            rc==SQLITE_OK && reader.aNode;\n            rc = nodeReaderNext(&reader)\n        ){\n          assert( reader.aNode );\n        }\n        if( fts3TermCmp(zKey, nKey, reader.term.a, reader.term.n)<=0 ){\n          bAppendable = 0;\n        }\n        nodeReaderRelease(&reader);\n      }\n      sqlite3_free(aLeaf);\n    }\n\n    if( rc==SQLITE_OK && bAppendable ){\n      /* It is possible to append to this segment. Set up the IncrmergeWriter\n      ** object to do so.  */\n      int i;\n      int nHeight = (int)aRoot[0];\n      NodeWriter *pNode;\n\n      pWriter->nLeafEst = (int)((iEnd - iStart) + 1)/FTS_MAX_APPENDABLE_HEIGHT;\n      pWriter->iStart = iStart;\n      pWriter->iEnd = iEnd;\n      pWriter->iAbsLevel = iAbsLevel;\n      pWriter->iIdx = iIdx;\n\n      for(i=nHeight+1; i<FTS_MAX_APPENDABLE_HEIGHT; i++){\n        pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;\n      }\n\n      pNode = &pWriter->aNodeWriter[nHeight];\n      pNode->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight;\n      blobGrowBuffer(&pNode->block, MAX(nRoot, p->nNodeSize), &rc);\n      if( rc==SQLITE_OK ){\n        memcpy(pNode->block.a, aRoot, nRoot);\n        pNode->block.n = nRoot;\n      }\n\n      for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){\n        NodeReader reader;\n        pNode = &pWriter->aNodeWriter[i];\n\n        rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);\n        while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);\n        blobGrowBuffer(&pNode->key, reader.term.n, &rc);\n        if( rc==SQLITE_OK ){\n          memcpy(pNode->key.a, reader.term.a, reader.term.n);\n          pNode->key.n = reader.term.n;\n          if( i>0 ){\n            char *aBlock = 0;\n            int nBlock = 0;\n            pNode = &pWriter->aNodeWriter[i-1];\n            pNode->iBlock = reader.iChild;\n            rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0);\n            blobGrowBuffer(&pNode->block, MAX(nBlock, p->nNodeSize), &rc);\n            if( rc==SQLITE_OK ){\n              memcpy(pNode->block.a, aBlock, nBlock);\n              pNode->block.n = nBlock;\n            }\n            sqlite3_free(aBlock);\n          }\n        }\n        nodeReaderRelease(&reader);\n      }\n    }\n\n    rc2 = sqlite3_reset(pSelect);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  return rc;\n}\n\n/*\n** Determine the largest segment index value that exists within absolute\n** level iAbsLevel+1. If no error occurs, set *piIdx to this value plus\n** one before returning SQLITE_OK. Or, if there are no segments at all \n** within level iAbsLevel, set *piIdx to zero.\n**\n** If an error occurs, return an SQLite error code. The final value of\n** *piIdx is undefined in this case.\n*/\nstatic int fts3IncrmergeOutputIdx( \n  Fts3Table *p,                   /* FTS Table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute index of input segments */\n  int *piIdx                      /* OUT: Next free index at iAbsLevel+1 */\n){\n  int rc;\n  sqlite3_stmt *pOutputIdx = 0;   /* SQL used to find output index */\n\n  rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pOutputIdx, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pOutputIdx, 1, iAbsLevel+1);\n    sqlite3_step(pOutputIdx);\n    *piIdx = sqlite3_column_int(pOutputIdx, 0);\n    rc = sqlite3_reset(pOutputIdx);\n  }\n\n  return rc;\n}\n\n/* \n** Allocate an appendable output segment on absolute level iAbsLevel+1\n** with idx value iIdx.\n**\n** In the %_segdir table, a segment is defined by the values in three\n** columns:\n**\n**     start_block\n**     leaves_end_block\n**     end_block\n**\n** When an appendable segment is allocated, it is estimated that the\n** maximum number of leaf blocks that may be required is the sum of the\n** number of leaf blocks consumed by the input segments, plus the number\n** of input segments, multiplied by two. This value is stored in stack \n** variable nLeafEst.\n**\n** A total of 16*nLeafEst blocks are allocated when an appendable segment\n** is created ((1 + end_block - start_block)==16*nLeafEst). The contiguous\n** array of leaf nodes starts at the first block allocated. The array\n** of interior nodes that are parents of the leaf nodes start at block\n** (start_block + (1 + end_block - start_block) / 16). And so on.\n**\n** In the actual code below, the value \"16\" is replaced with the \n** pre-processor macro FTS_MAX_APPENDABLE_HEIGHT.\n*/\nstatic int fts3IncrmergeWriter( \n  Fts3Table *p,                   /* Fts3 table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute level of input segments */\n  int iIdx,                       /* Index of new output segment */\n  Fts3MultiSegReader *pCsr,       /* Cursor that data will be read from */\n  IncrmergeWriter *pWriter        /* Populate this object */\n){\n  int rc;                         /* Return Code */\n  int i;                          /* Iterator variable */\n  int nLeafEst = 0;               /* Blocks allocated for leaf nodes */\n  sqlite3_stmt *pLeafEst = 0;     /* SQL used to determine nLeafEst */\n  sqlite3_stmt *pFirstBlock = 0;  /* SQL used to determine first block */\n\n  /* Calculate nLeafEst. */\n  rc = fts3SqlStmt(p, SQL_MAX_LEAF_NODE_ESTIMATE, &pLeafEst, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pLeafEst, 1, iAbsLevel);\n    sqlite3_bind_int64(pLeafEst, 2, pCsr->nSegment);\n    if( SQLITE_ROW==sqlite3_step(pLeafEst) ){\n      nLeafEst = sqlite3_column_int(pLeafEst, 0);\n    }\n    rc = sqlite3_reset(pLeafEst);\n  }\n  if( rc!=SQLITE_OK ) return rc;\n\n  /* Calculate the first block to use in the output segment */\n  rc = fts3SqlStmt(p, SQL_NEXT_SEGMENTS_ID, &pFirstBlock, 0);\n  if( rc==SQLITE_OK ){\n    if( SQLITE_ROW==sqlite3_step(pFirstBlock) ){\n      pWriter->iStart = sqlite3_column_int64(pFirstBlock, 0);\n      pWriter->iEnd = pWriter->iStart - 1;\n      pWriter->iEnd += nLeafEst * FTS_MAX_APPENDABLE_HEIGHT;\n    }\n    rc = sqlite3_reset(pFirstBlock);\n  }\n  if( rc!=SQLITE_OK ) return rc;\n\n  /* Insert the marker in the %_segments table to make sure nobody tries\n  ** to steal the space just allocated. This is also used to identify \n  ** appendable segments.  */\n  rc = fts3WriteSegment(p, pWriter->iEnd, 0, 0);\n  if( rc!=SQLITE_OK ) return rc;\n\n  pWriter->iAbsLevel = iAbsLevel;\n  pWriter->nLeafEst = nLeafEst;\n  pWriter->iIdx = iIdx;\n\n  /* Set up the array of NodeWriter objects */\n  for(i=0; i<FTS_MAX_APPENDABLE_HEIGHT; i++){\n    pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Remove an entry from the %_segdir table. This involves running the \n** following two statements:\n**\n**   DELETE FROM %_segdir WHERE level = :iAbsLevel AND idx = :iIdx\n**   UPDATE %_segdir SET idx = idx - 1 WHERE level = :iAbsLevel AND idx > :iIdx\n**\n** The DELETE statement removes the specific %_segdir level. The UPDATE \n** statement ensures that the remaining segments have contiguously allocated\n** idx values.\n*/\nstatic int fts3RemoveSegdirEntry(\n  Fts3Table *p,                   /* FTS3 table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute level to delete from */\n  int iIdx                        /* Index of %_segdir entry to delete */\n){\n  int rc;                         /* Return code */\n  sqlite3_stmt *pDelete = 0;      /* DELETE statement */\n\n  rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_ENTRY, &pDelete, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pDelete, 1, iAbsLevel);\n    sqlite3_bind_int(pDelete, 2, iIdx);\n    sqlite3_step(pDelete);\n    rc = sqlite3_reset(pDelete);\n  }\n\n  return rc;\n}\n\n/*\n** One or more segments have just been removed from absolute level iAbsLevel.\n** Update the 'idx' values of the remaining segments in the level so that\n** the idx values are a contiguous sequence starting from 0.\n*/\nstatic int fts3RepackSegdirLevel(\n  Fts3Table *p,                   /* FTS3 table handle */\n  sqlite3_int64 iAbsLevel         /* Absolute level to repack */\n){\n  int rc;                         /* Return code */\n  int *aIdx = 0;                  /* Array of remaining idx values */\n  int nIdx = 0;                   /* Valid entries in aIdx[] */\n  int nAlloc = 0;                 /* Allocated size of aIdx[] */\n  int i;                          /* Iterator variable */\n  sqlite3_stmt *pSelect = 0;      /* Select statement to read idx values */\n  sqlite3_stmt *pUpdate = 0;      /* Update statement to modify idx values */\n\n  rc = fts3SqlStmt(p, SQL_SELECT_INDEXES, &pSelect, 0);\n  if( rc==SQLITE_OK ){\n    int rc2;\n    sqlite3_bind_int64(pSelect, 1, iAbsLevel);\n    while( SQLITE_ROW==sqlite3_step(pSelect) ){\n      if( nIdx>=nAlloc ){\n        int *aNew;\n        nAlloc += 16;\n        aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int));\n        if( !aNew ){\n          rc = SQLITE_NOMEM;\n          break;\n        }\n        aIdx = aNew;\n      }\n      aIdx[nIdx++] = sqlite3_column_int(pSelect, 0);\n    }\n    rc2 = sqlite3_reset(pSelect);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = fts3SqlStmt(p, SQL_SHIFT_SEGDIR_ENTRY, &pUpdate, 0);\n  }\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pUpdate, 2, iAbsLevel);\n  }\n\n  assert( p->bIgnoreSavepoint==0 );\n  p->bIgnoreSavepoint = 1;\n  for(i=0; rc==SQLITE_OK && i<nIdx; i++){\n    if( aIdx[i]!=i ){\n      sqlite3_bind_int(pUpdate, 3, aIdx[i]);\n      sqlite3_bind_int(pUpdate, 1, i);\n      sqlite3_step(pUpdate);\n      rc = sqlite3_reset(pUpdate);\n    }\n  }\n  p->bIgnoreSavepoint = 0;\n\n  sqlite3_free(aIdx);\n  return rc;\n}\n\nstatic void fts3StartNode(Blob *pNode, int iHeight, sqlite3_int64 iChild){\n  pNode->a[0] = (char)iHeight;\n  if( iChild ){\n    assert( pNode->nAlloc>=1+sqlite3Fts3VarintLen(iChild) );\n    pNode->n = 1 + sqlite3Fts3PutVarint(&pNode->a[1], iChild);\n  }else{\n    assert( pNode->nAlloc>=1 );\n    pNode->n = 1;\n  }\n}\n\n/*\n** The first two arguments are a pointer to and the size of a segment b-tree\n** node. The node may be a leaf or an internal node.\n**\n** This function creates a new node image in blob object *pNew by copying\n** all terms that are greater than or equal to zTerm/nTerm (for leaf nodes)\n** or greater than zTerm/nTerm (for internal nodes) from aNode/nNode.\n*/\nstatic int fts3TruncateNode(\n  const char *aNode,              /* Current node image */\n  int nNode,                      /* Size of aNode in bytes */\n  Blob *pNew,                     /* OUT: Write new node image here */\n  const char *zTerm,              /* Omit all terms smaller than this */\n  int nTerm,                      /* Size of zTerm in bytes */\n  sqlite3_int64 *piBlock          /* OUT: Block number in next layer down */\n){\n  NodeReader reader;              /* Reader object */\n  Blob prev = {0, 0, 0};          /* Previous term written to new node */\n  int rc = SQLITE_OK;             /* Return code */\n  int bLeaf = aNode[0]=='\\0';     /* True for a leaf node */\n\n  /* Allocate required output space */\n  blobGrowBuffer(pNew, nNode, &rc);\n  if( rc!=SQLITE_OK ) return rc;\n  pNew->n = 0;\n\n  /* Populate new node buffer */\n  for(rc = nodeReaderInit(&reader, aNode, nNode); \n      rc==SQLITE_OK && reader.aNode; \n      rc = nodeReaderNext(&reader)\n  ){\n    if( pNew->n==0 ){\n      int res = fts3TermCmp(reader.term.a, reader.term.n, zTerm, nTerm);\n      if( res<0 || (bLeaf==0 && res==0) ) continue;\n      fts3StartNode(pNew, (int)aNode[0], reader.iChild);\n      *piBlock = reader.iChild;\n    }\n    rc = fts3AppendToNode(\n        pNew, &prev, reader.term.a, reader.term.n,\n        reader.aDoclist, reader.nDoclist\n    );\n    if( rc!=SQLITE_OK ) break;\n  }\n  if( pNew->n==0 ){\n    fts3StartNode(pNew, (int)aNode[0], reader.iChild);\n    *piBlock = reader.iChild;\n  }\n  assert( pNew->n<=pNew->nAlloc );\n\n  nodeReaderRelease(&reader);\n  sqlite3_free(prev.a);\n  return rc;\n}\n\n/*\n** Remove all terms smaller than zTerm/nTerm from segment iIdx in absolute \n** level iAbsLevel. This may involve deleting entries from the %_segments\n** table, and modifying existing entries in both the %_segments and %_segdir\n** tables.\n**\n** SQLITE_OK is returned if the segment is updated successfully. Or an\n** SQLite error code otherwise.\n*/\nstatic int fts3TruncateSegment(\n  Fts3Table *p,                   /* FTS3 table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute level of segment to modify */\n  int iIdx,                       /* Index within level of segment to modify */\n  const char *zTerm,              /* Remove terms smaller than this */\n  int nTerm                      /* Number of bytes in buffer zTerm */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  Blob root = {0,0,0};            /* New root page image */\n  Blob block = {0,0,0};           /* Buffer used for any other block */\n  sqlite3_int64 iBlock = 0;       /* Block id */\n  sqlite3_int64 iNewStart = 0;    /* New value for iStartBlock */\n  sqlite3_int64 iOldStart = 0;    /* Old value for iStartBlock */\n  sqlite3_stmt *pFetch = 0;       /* Statement used to fetch segdir */\n\n  rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR, &pFetch, 0);\n  if( rc==SQLITE_OK ){\n    int rc2;                      /* sqlite3_reset() return code */\n    sqlite3_bind_int64(pFetch, 1, iAbsLevel);\n    sqlite3_bind_int(pFetch, 2, iIdx);\n    if( SQLITE_ROW==sqlite3_step(pFetch) ){\n      const char *aRoot = sqlite3_column_blob(pFetch, 4);\n      int nRoot = sqlite3_column_bytes(pFetch, 4);\n      iOldStart = sqlite3_column_int64(pFetch, 1);\n      rc = fts3TruncateNode(aRoot, nRoot, &root, zTerm, nTerm, &iBlock);\n    }\n    rc2 = sqlite3_reset(pFetch);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  while( rc==SQLITE_OK && iBlock ){\n    char *aBlock = 0;\n    int nBlock = 0;\n    iNewStart = iBlock;\n\n    rc = sqlite3Fts3ReadBlock(p, iBlock, &aBlock, &nBlock, 0);\n    if( rc==SQLITE_OK ){\n      rc = fts3TruncateNode(aBlock, nBlock, &block, zTerm, nTerm, &iBlock);\n    }\n    if( rc==SQLITE_OK ){\n      rc = fts3WriteSegment(p, iNewStart, block.a, block.n);\n    }\n    sqlite3_free(aBlock);\n  }\n\n  /* Variable iNewStart now contains the first valid leaf node. */\n  if( rc==SQLITE_OK && iNewStart ){\n    sqlite3_stmt *pDel = 0;\n    rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDel, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pDel, 1, iOldStart);\n      sqlite3_bind_int64(pDel, 2, iNewStart-1);\n      sqlite3_step(pDel);\n      rc = sqlite3_reset(pDel);\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    sqlite3_stmt *pChomp = 0;\n    rc = fts3SqlStmt(p, SQL_CHOMP_SEGDIR, &pChomp, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pChomp, 1, iNewStart);\n      sqlite3_bind_blob(pChomp, 2, root.a, root.n, SQLITE_STATIC);\n      sqlite3_bind_int64(pChomp, 3, iAbsLevel);\n      sqlite3_bind_int(pChomp, 4, iIdx);\n      sqlite3_step(pChomp);\n      rc = sqlite3_reset(pChomp);\n    }\n  }\n\n  sqlite3_free(root.a);\n  sqlite3_free(block.a);\n  return rc;\n}\n\n/*\n** This function is called after an incrmental-merge operation has run to\n** merge (or partially merge) two or more segments from absolute level\n** iAbsLevel.\n**\n** Each input segment is either removed from the db completely (if all of\n** its data was copied to the output segment by the incrmerge operation)\n** or modified in place so that it no longer contains those entries that\n** have been duplicated in the output segment.\n*/\nstatic int fts3IncrmergeChomp(\n  Fts3Table *p,                   /* FTS table handle */\n  sqlite3_int64 iAbsLevel,        /* Absolute level containing segments */\n  Fts3MultiSegReader *pCsr,       /* Chomp all segments opened by this cursor */\n  int *pnRem                      /* Number of segments not deleted */\n){\n  int i;\n  int nRem = 0;\n  int rc = SQLITE_OK;\n\n  for(i=pCsr->nSegment-1; i>=0 && rc==SQLITE_OK; i--){\n    Fts3SegReader *pSeg = 0;\n    int j;\n\n    /* Find the Fts3SegReader object with Fts3SegReader.iIdx==i. It is hiding\n    ** somewhere in the pCsr->apSegment[] array.  */\n    for(j=0; ALWAYS(j<pCsr->nSegment); j++){\n      pSeg = pCsr->apSegment[j];\n      if( pSeg->iIdx==i ) break;\n    }\n    assert( j<pCsr->nSegment && pSeg->iIdx==i );\n\n    if( pSeg->aNode==0 ){\n      /* Seg-reader is at EOF. Remove the entire input segment. */\n      rc = fts3DeleteSegment(p, pSeg);\n      if( rc==SQLITE_OK ){\n        rc = fts3RemoveSegdirEntry(p, iAbsLevel, pSeg->iIdx);\n      }\n      *pnRem = 0;\n    }else{\n      /* The incremental merge did not copy all the data from this \n      ** segment to the upper level. The segment is modified in place\n      ** so that it contains no keys smaller than zTerm/nTerm. */ \n      const char *zTerm = pSeg->zTerm;\n      int nTerm = pSeg->nTerm;\n      rc = fts3TruncateSegment(p, iAbsLevel, pSeg->iIdx, zTerm, nTerm);\n      nRem++;\n    }\n  }\n\n  if( rc==SQLITE_OK && nRem!=pCsr->nSegment ){\n    rc = fts3RepackSegdirLevel(p, iAbsLevel);\n  }\n\n  *pnRem = nRem;\n  return rc;\n}\n\n/*\n** Store an incr-merge hint in the database.\n*/\nstatic int fts3IncrmergeHintStore(Fts3Table *p, Blob *pHint){\n  sqlite3_stmt *pReplace = 0;\n  int rc;                         /* Return code */\n\n  rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pReplace, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int(pReplace, 1, FTS_STAT_INCRMERGEHINT);\n    sqlite3_bind_blob(pReplace, 2, pHint->a, pHint->n, SQLITE_STATIC);\n    sqlite3_step(pReplace);\n    rc = sqlite3_reset(pReplace);\n  }\n\n  return rc;\n}\n\n/*\n** Load an incr-merge hint from the database. The incr-merge hint, if one \n** exists, is stored in the rowid==1 row of the %_stat table.\n**\n** If successful, populate blob *pHint with the value read from the %_stat\n** table and return SQLITE_OK. Otherwise, if an error occurs, return an\n** SQLite error code.\n*/\nstatic int fts3IncrmergeHintLoad(Fts3Table *p, Blob *pHint){\n  sqlite3_stmt *pSelect = 0;\n  int rc;\n\n  pHint->n = 0;\n  rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pSelect, 0);\n  if( rc==SQLITE_OK ){\n    int rc2;\n    sqlite3_bind_int(pSelect, 1, FTS_STAT_INCRMERGEHINT);\n    if( SQLITE_ROW==sqlite3_step(pSelect) ){\n      const char *aHint = sqlite3_column_blob(pSelect, 0);\n      int nHint = sqlite3_column_bytes(pSelect, 0);\n      if( aHint ){\n        blobGrowBuffer(pHint, nHint, &rc);\n        if( rc==SQLITE_OK ){\n          memcpy(pHint->a, aHint, nHint);\n          pHint->n = nHint;\n        }\n      }\n    }\n    rc2 = sqlite3_reset(pSelect);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  return rc;\n}\n\n/*\n** If *pRc is not SQLITE_OK when this function is called, it is a no-op.\n** Otherwise, append an entry to the hint stored in blob *pHint. Each entry\n** consists of two varints, the absolute level number of the input segments \n** and the number of input segments.\n**\n** If successful, leave *pRc set to SQLITE_OK and return. If an error occurs,\n** set *pRc to an SQLite error code before returning.\n*/\nstatic void fts3IncrmergeHintPush(\n  Blob *pHint,                    /* Hint blob to append to */\n  i64 iAbsLevel,                  /* First varint to store in hint */\n  int nInput,                     /* Second varint to store in hint */\n  int *pRc                        /* IN/OUT: Error code */\n){\n  blobGrowBuffer(pHint, pHint->n + 2*FTS3_VARINT_MAX, pRc);\n  if( *pRc==SQLITE_OK ){\n    pHint->n += sqlite3Fts3PutVarint(&pHint->a[pHint->n], iAbsLevel);\n    pHint->n += sqlite3Fts3PutVarint(&pHint->a[pHint->n], (i64)nInput);\n  }\n}\n\n/*\n** Read the last entry (most recently pushed) from the hint blob *pHint\n** and then remove the entry. Write the two values read to *piAbsLevel and \n** *pnInput before returning.\n**\n** If no error occurs, return SQLITE_OK. If the hint blob in *pHint does\n** not contain at least two valid varints, return SQLITE_CORRUPT_VTAB.\n*/\nstatic int fts3IncrmergeHintPop(Blob *pHint, i64 *piAbsLevel, int *pnInput){\n  const int nHint = pHint->n;\n  int i;\n\n  i = pHint->n-2;\n  while( i>0 && (pHint->a[i-1] & 0x80) ) i--;\n  while( i>0 && (pHint->a[i-1] & 0x80) ) i--;\n\n  pHint->n = i;\n  i += sqlite3Fts3GetVarint(&pHint->a[i], piAbsLevel);\n  i += fts3GetVarint32(&pHint->a[i], pnInput);\n  if( i!=nHint ) return FTS_CORRUPT_VTAB;\n\n  return SQLITE_OK;\n}\n\n\n/*\n** Attempt an incremental merge that writes nMerge leaf blocks.\n**\n** Incremental merges happen nMin segments at a time. The segments \n** to be merged are the nMin oldest segments (the ones with the smallest \n** values for the _segdir.idx field) in the highest level that contains \n** at least nMin segments. Multiple merges might occur in an attempt to \n** write the quota of nMerge leaf blocks.\n*/\nint sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){\n  int rc;                         /* Return code */\n  int nRem = nMerge;              /* Number of leaf pages yet to  be written */\n  Fts3MultiSegReader *pCsr;       /* Cursor used to read input data */\n  Fts3SegFilter *pFilter;         /* Filter used with cursor pCsr */\n  IncrmergeWriter *pWriter;       /* Writer object */\n  int nSeg = 0;                   /* Number of input segments */\n  sqlite3_int64 iAbsLevel = 0;    /* Absolute level number to work on */\n  Blob hint = {0, 0, 0};          /* Hint read from %_stat table */\n  int bDirtyHint = 0;             /* True if blob 'hint' has been modified */\n\n  /* Allocate space for the cursor, filter and writer objects */\n  const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter);\n  pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc);\n  if( !pWriter ) return SQLITE_NOMEM;\n  pFilter = (Fts3SegFilter *)&pWriter[1];\n  pCsr = (Fts3MultiSegReader *)&pFilter[1];\n\n  rc = fts3IncrmergeHintLoad(p, &hint);\n  while( rc==SQLITE_OK && nRem>0 ){\n    const i64 nMod = FTS3_SEGDIR_MAXLEVEL * p->nIndex;\n    sqlite3_stmt *pFindLevel = 0; /* SQL used to determine iAbsLevel */\n    int bUseHint = 0;             /* True if attempting to append */\n    int iIdx = 0;                 /* Largest idx in level (iAbsLevel+1) */\n\n    /* Search the %_segdir table for the absolute level with the smallest\n    ** relative level number that contains at least nMin segments, if any.\n    ** If one is found, set iAbsLevel to the absolute level number and\n    ** nSeg to nMin. If no level with at least nMin segments can be found, \n    ** set nSeg to -1.\n    */\n    rc = fts3SqlStmt(p, SQL_FIND_MERGE_LEVEL, &pFindLevel, 0);\n    sqlite3_bind_int(pFindLevel, 1, MAX(2, nMin));\n    if( sqlite3_step(pFindLevel)==SQLITE_ROW ){\n      iAbsLevel = sqlite3_column_int64(pFindLevel, 0);\n      nSeg = sqlite3_column_int(pFindLevel, 1);\n      assert( nSeg>=2 );\n    }else{\n      nSeg = -1;\n    }\n    rc = sqlite3_reset(pFindLevel);\n\n    /* If the hint read from the %_stat table is not empty, check if the\n    ** last entry in it specifies a relative level smaller than or equal\n    ** to the level identified by the block above (if any). If so, this \n    ** iteration of the loop will work on merging at the hinted level.\n    */\n    if( rc==SQLITE_OK && hint.n ){\n      int nHint = hint.n;\n      sqlite3_int64 iHintAbsLevel = 0;      /* Hint level */\n      int nHintSeg = 0;                     /* Hint number of segments */\n\n      rc = fts3IncrmergeHintPop(&hint, &iHintAbsLevel, &nHintSeg);\n      if( nSeg<0 || (iAbsLevel % nMod) >= (iHintAbsLevel % nMod) ){\n        iAbsLevel = iHintAbsLevel;\n        nSeg = nHintSeg;\n        bUseHint = 1;\n        bDirtyHint = 1;\n      }else{\n        /* This undoes the effect of the HintPop() above - so that no entry\n        ** is removed from the hint blob.  */\n        hint.n = nHint;\n      }\n    }\n\n    /* If nSeg is less that zero, then there is no level with at least\n    ** nMin segments and no hint in the %_stat table. No work to do.\n    ** Exit early in this case.  */\n    if( nSeg<0 ) break;\n\n    /* Open a cursor to iterate through the contents of the oldest nSeg \n    ** indexes of absolute level iAbsLevel. If this cursor is opened using \n    ** the 'hint' parameters, it is possible that there are less than nSeg\n    ** segments available in level iAbsLevel. In this case, no work is\n    ** done on iAbsLevel - fall through to the next iteration of the loop \n    ** to start work on some other level.  */\n    memset(pWriter, 0, nAlloc);\n    pFilter->flags = FTS3_SEGMENT_REQUIRE_POS;\n\n    if( rc==SQLITE_OK ){\n      rc = fts3IncrmergeOutputIdx(p, iAbsLevel, &iIdx);\n      assert( bUseHint==1 || bUseHint==0 );\n      if( iIdx==0 || (bUseHint && iIdx==1) ){\n        int bIgnore = 0;\n        rc = fts3SegmentIsMaxLevel(p, iAbsLevel+1, &bIgnore);\n        if( bIgnore ){\n          pFilter->flags |= FTS3_SEGMENT_IGNORE_EMPTY;\n        }\n      }\n    }\n\n    if( rc==SQLITE_OK ){\n      rc = fts3IncrmergeCsr(p, iAbsLevel, nSeg, pCsr);\n    }\n    if( SQLITE_OK==rc && pCsr->nSegment==nSeg\n     && SQLITE_OK==(rc = sqlite3Fts3SegReaderStart(p, pCsr, pFilter))\n     && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pCsr))\n    ){\n      if( bUseHint && iIdx>0 ){\n        const char *zKey = pCsr->zTerm;\n        int nKey = pCsr->nTerm;\n        rc = fts3IncrmergeLoad(p, iAbsLevel, iIdx-1, zKey, nKey, pWriter);\n      }else{\n        rc = fts3IncrmergeWriter(p, iAbsLevel, iIdx, pCsr, pWriter);\n      }\n\n      if( rc==SQLITE_OK && pWriter->nLeafEst ){\n        fts3LogMerge(nSeg, iAbsLevel);\n        do {\n          rc = fts3IncrmergeAppend(p, pWriter, pCsr);\n          if( rc==SQLITE_OK ) rc = sqlite3Fts3SegReaderStep(p, pCsr);\n          if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK;\n        }while( rc==SQLITE_ROW );\n\n        /* Update or delete the input segments */\n        if( rc==SQLITE_OK ){\n          nRem -= (1 + pWriter->nWork);\n          rc = fts3IncrmergeChomp(p, iAbsLevel, pCsr, &nSeg);\n          if( nSeg!=0 ){\n            bDirtyHint = 1;\n            fts3IncrmergeHintPush(&hint, iAbsLevel, nSeg, &rc);\n          }\n        }\n      }\n\n      if( nSeg!=0 ){\n        pWriter->nLeafData = pWriter->nLeafData * -1;\n      }\n      fts3IncrmergeRelease(p, pWriter, &rc);\n      if( nSeg==0 && pWriter->bNoLeafData==0 ){\n        fts3PromoteSegments(p, iAbsLevel+1, pWriter->nLeafData);\n      }\n    }\n\n    sqlite3Fts3SegReaderFinish(pCsr);\n  }\n\n  /* Write the hint values into the %_stat table for the next incr-merger */\n  if( bDirtyHint && rc==SQLITE_OK ){\n    rc = fts3IncrmergeHintStore(p, &hint);\n  }\n\n  sqlite3_free(pWriter);\n  sqlite3_free(hint.a);\n  return rc;\n}\n\n/*\n** Convert the text beginning at *pz into an integer and return\n** its value.  Advance *pz to point to the first character past\n** the integer.\n*/\nstatic int fts3Getint(const char **pz){\n  const char *z = *pz;\n  int i = 0;\n  while( (*z)>='0' && (*z)<='9' ) i = 10*i + *(z++) - '0';\n  *pz = z;\n  return i;\n}\n\n/*\n** Process statements of the form:\n**\n**    INSERT INTO table(table) VALUES('merge=A,B');\n**\n** A and B are integers that decode to be the number of leaf pages\n** written for the merge, and the minimum number of segments on a level\n** before it will be selected for a merge, respectively.\n*/\nstatic int fts3DoIncrmerge(\n  Fts3Table *p,                   /* FTS3 table handle */\n  const char *zParam              /* Nul-terminated string containing \"A,B\" */\n){\n  int rc;\n  int nMin = (FTS3_MERGE_COUNT / 2);\n  int nMerge = 0;\n  const char *z = zParam;\n\n  /* Read the first integer value */\n  nMerge = fts3Getint(&z);\n\n  /* If the first integer value is followed by a ',',  read the second\n  ** integer value. */\n  if( z[0]==',' && z[1]!='\\0' ){\n    z++;\n    nMin = fts3Getint(&z);\n  }\n\n  if( z[0]!='\\0' || nMin<2 ){\n    rc = SQLITE_ERROR;\n  }else{\n    rc = SQLITE_OK;\n    if( !p->bHasStat ){\n      assert( p->bFts4==0 );\n      sqlite3Fts3CreateStatTable(&rc, p);\n    }\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts3Incrmerge(p, nMerge, nMin);\n    }\n    sqlite3Fts3SegmentsClose(p);\n  }\n  return rc;\n}\n\n/*\n** Process statements of the form:\n**\n**    INSERT INTO table(table) VALUES('automerge=X');\n**\n** where X is an integer.  X==0 means to turn automerge off.  X!=0 means\n** turn it on.  The setting is persistent.\n*/\nstatic int fts3DoAutoincrmerge(\n  Fts3Table *p,                   /* FTS3 table handle */\n  const char *zParam              /* Nul-terminated string containing boolean */\n){\n  int rc = SQLITE_OK;\n  sqlite3_stmt *pStmt = 0;\n  p->nAutoincrmerge = fts3Getint(&zParam);\n  if( p->nAutoincrmerge==1 || p->nAutoincrmerge>FTS3_MERGE_COUNT ){\n    p->nAutoincrmerge = 8;\n  }\n  if( !p->bHasStat ){\n    assert( p->bFts4==0 );\n    sqlite3Fts3CreateStatTable(&rc, p);\n    if( rc ) return rc;\n  }\n  rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pStmt, 0);\n  if( rc ) return rc;\n  sqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE);\n  sqlite3_bind_int(pStmt, 2, p->nAutoincrmerge);\n  sqlite3_step(pStmt);\n  rc = sqlite3_reset(pStmt);\n  return rc;\n}\n\n/*\n** Return a 64-bit checksum for the FTS index entry specified by the\n** arguments to this function.\n*/\nstatic u64 fts3ChecksumEntry(\n  const char *zTerm,              /* Pointer to buffer containing term */\n  int nTerm,                      /* Size of zTerm in bytes */\n  int iLangid,                    /* Language id for current row */\n  int iIndex,                     /* Index (0..Fts3Table.nIndex-1) */\n  i64 iDocid,                     /* Docid for current row. */\n  int iCol,                       /* Column number */\n  int iPos                        /* Position */\n){\n  int i;\n  u64 ret = (u64)iDocid;\n\n  ret += (ret<<3) + iLangid;\n  ret += (ret<<3) + iIndex;\n  ret += (ret<<3) + iCol;\n  ret += (ret<<3) + iPos;\n  for(i=0; i<nTerm; i++) ret += (ret<<3) + zTerm[i];\n\n  return ret;\n}\n\n/*\n** Return a checksum of all entries in the FTS index that correspond to\n** language id iLangid. The checksum is calculated by XORing the checksums\n** of each individual entry (see fts3ChecksumEntry()) together.\n**\n** If successful, the checksum value is returned and *pRc set to SQLITE_OK.\n** Otherwise, if an error occurs, *pRc is set to an SQLite error code. The\n** return value is undefined in this case.\n*/\nstatic u64 fts3ChecksumIndex(\n  Fts3Table *p,                   /* FTS3 table handle */\n  int iLangid,                    /* Language id to return cksum for */\n  int iIndex,                     /* Index to cksum (0..p->nIndex-1) */\n  int *pRc                        /* OUT: Return code */\n){\n  Fts3SegFilter filter;\n  Fts3MultiSegReader csr;\n  int rc;\n  u64 cksum = 0;\n\n  assert( *pRc==SQLITE_OK );\n\n  memset(&filter, 0, sizeof(filter));\n  memset(&csr, 0, sizeof(csr));\n  filter.flags =  FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;\n  filter.flags |= FTS3_SEGMENT_SCAN;\n\n  rc = sqlite3Fts3SegReaderCursor(\n      p, iLangid, iIndex, FTS3_SEGCURSOR_ALL, 0, 0, 0, 1,&csr\n  );\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts3SegReaderStart(p, &csr, &filter);\n  }\n\n  if( rc==SQLITE_OK ){\n    while( SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, &csr)) ){\n      char *pCsr = csr.aDoclist;\n      char *pEnd = &pCsr[csr.nDoclist];\n\n      i64 iDocid = 0;\n      i64 iCol = 0;\n      i64 iPos = 0;\n\n      pCsr += sqlite3Fts3GetVarint(pCsr, &iDocid);\n      while( pCsr<pEnd ){\n        i64 iVal = 0;\n        pCsr += sqlite3Fts3GetVarint(pCsr, &iVal);\n        if( pCsr<pEnd ){\n          if( iVal==0 || iVal==1 ){\n            iCol = 0;\n            iPos = 0;\n            if( iVal ){\n              pCsr += sqlite3Fts3GetVarint(pCsr, &iCol);\n            }else{\n              pCsr += sqlite3Fts3GetVarint(pCsr, &iVal);\n              iDocid += iVal;\n            }\n          }else{\n            iPos += (iVal - 2);\n            cksum = cksum ^ fts3ChecksumEntry(\n                csr.zTerm, csr.nTerm, iLangid, iIndex, iDocid,\n                (int)iCol, (int)iPos\n            );\n          }\n        }\n      }\n    }\n  }\n  sqlite3Fts3SegReaderFinish(&csr);\n\n  *pRc = rc;\n  return cksum;\n}\n\n/*\n** Check if the contents of the FTS index match the current contents of the\n** content table. If no error occurs and the contents do match, set *pbOk\n** to true and return SQLITE_OK. Or if the contents do not match, set *pbOk\n** to false before returning.\n**\n** If an error occurs (e.g. an OOM or IO error), return an SQLite error \n** code. The final value of *pbOk is undefined in this case.\n*/\nstatic int fts3IntegrityCheck(Fts3Table *p, int *pbOk){\n  int rc = SQLITE_OK;             /* Return code */\n  u64 cksum1 = 0;                 /* Checksum based on FTS index contents */\n  u64 cksum2 = 0;                 /* Checksum based on %_content contents */\n  sqlite3_stmt *pAllLangid = 0;   /* Statement to return all language-ids */\n\n  /* This block calculates the checksum according to the FTS index. */\n  rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0);\n  if( rc==SQLITE_OK ){\n    int rc2;\n    sqlite3_bind_int(pAllLangid, 1, p->iPrevLangid);\n    sqlite3_bind_int(pAllLangid, 2, p->nIndex);\n    while( rc==SQLITE_OK && sqlite3_step(pAllLangid)==SQLITE_ROW ){\n      int iLangid = sqlite3_column_int(pAllLangid, 0);\n      int i;\n      for(i=0; i<p->nIndex; i++){\n        cksum1 = cksum1 ^ fts3ChecksumIndex(p, iLangid, i, &rc);\n      }\n    }\n    rc2 = sqlite3_reset(pAllLangid);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  /* This block calculates the checksum according to the %_content table */\n  if( rc==SQLITE_OK ){\n    sqlite3_tokenizer_module const *pModule = p->pTokenizer->pModule;\n    sqlite3_stmt *pStmt = 0;\n    char *zSql;\n   \n    zSql = sqlite3_mprintf(\"SELECT %s\" , p->zReadExprlist);\n    if( !zSql ){\n      rc = SQLITE_NOMEM;\n    }else{\n      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);\n      sqlite3_free(zSql);\n    }\n\n    while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){\n      i64 iDocid = sqlite3_column_int64(pStmt, 0);\n      int iLang = langidFromSelect(p, pStmt);\n      int iCol;\n\n      for(iCol=0; rc==SQLITE_OK && iCol<p->nColumn; iCol++){\n        if( p->abNotindexed[iCol]==0 ){\n          const char *zText = (const char *)sqlite3_column_text(pStmt, iCol+1);\n          int nText = sqlite3_column_bytes(pStmt, iCol+1);\n          sqlite3_tokenizer_cursor *pT = 0;\n\n          rc = sqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, nText,&pT);\n          while( rc==SQLITE_OK ){\n            char const *zToken;       /* Buffer containing token */\n            int nToken = 0;           /* Number of bytes in token */\n            int iDum1 = 0, iDum2 = 0; /* Dummy variables */\n            int iPos = 0;             /* Position of token in zText */\n\n            rc = pModule->xNext(pT, &zToken, &nToken, &iDum1, &iDum2, &iPos);\n            if( rc==SQLITE_OK ){\n              int i;\n              cksum2 = cksum2 ^ fts3ChecksumEntry(\n                  zToken, nToken, iLang, 0, iDocid, iCol, iPos\n              );\n              for(i=1; i<p->nIndex; i++){\n                if( p->aIndex[i].nPrefix<=nToken ){\n                  cksum2 = cksum2 ^ fts3ChecksumEntry(\n                      zToken, p->aIndex[i].nPrefix, iLang, i, iDocid, iCol, iPos\n                  );\n                }\n              }\n            }\n          }\n          if( pT ) pModule->xClose(pT);\n          if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n        }\n      }\n    }\n\n    sqlite3_finalize(pStmt);\n  }\n\n  *pbOk = (cksum1==cksum2);\n  return rc;\n}\n\n/*\n** Run the integrity-check. If no error occurs and the current contents of\n** the FTS index are correct, return SQLITE_OK. Or, if the contents of the\n** FTS index are incorrect, return SQLITE_CORRUPT_VTAB.\n**\n** Or, if an error (e.g. an OOM or IO error) occurs, return an SQLite \n** error code.\n**\n** The integrity-check works as follows. For each token and indexed token\n** prefix in the document set, a 64-bit checksum is calculated (by code\n** in fts3ChecksumEntry()) based on the following:\n**\n**     + The index number (0 for the main index, 1 for the first prefix\n**       index etc.),\n**     + The token (or token prefix) text itself, \n**     + The language-id of the row it appears in,\n**     + The docid of the row it appears in,\n**     + The column it appears in, and\n**     + The tokens position within that column.\n**\n** The checksums for all entries in the index are XORed together to create\n** a single checksum for the entire index.\n**\n** The integrity-check code calculates the same checksum in two ways:\n**\n**     1. By scanning the contents of the FTS index, and \n**     2. By scanning and tokenizing the content table.\n**\n** If the two checksums are identical, the integrity-check is deemed to have\n** passed.\n*/\nstatic int fts3DoIntegrityCheck(\n  Fts3Table *p                    /* FTS3 table handle */\n){\n  int rc;\n  int bOk = 0;\n  rc = fts3IntegrityCheck(p, &bOk);\n  if( rc==SQLITE_OK && bOk==0 ) rc = FTS_CORRUPT_VTAB;\n  return rc;\n}\n\n/*\n** Handle a 'special' INSERT of the form:\n**\n**   \"INSERT INTO tbl(tbl) VALUES(<expr>)\"\n**\n** Argument pVal contains the result of <expr>. Currently the only \n** meaningful value to insert is the text 'optimize'.\n*/\nstatic int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){\n  int rc;                         /* Return Code */\n  const char *zVal = (const char *)sqlite3_value_text(pVal);\n  int nVal = sqlite3_value_bytes(pVal);\n\n  if( !zVal ){\n    return SQLITE_NOMEM;\n  }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, \"optimize\", 8) ){\n    rc = fts3DoOptimize(p, 0);\n  }else if( nVal==7 && 0==sqlite3_strnicmp(zVal, \"rebuild\", 7) ){\n    rc = fts3DoRebuild(p);\n  }else if( nVal==15 && 0==sqlite3_strnicmp(zVal, \"integrity-check\", 15) ){\n    rc = fts3DoIntegrityCheck(p);\n  }else if( nVal>6 && 0==sqlite3_strnicmp(zVal, \"merge=\", 6) ){\n    rc = fts3DoIncrmerge(p, &zVal[6]);\n  }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, \"automerge=\", 10) ){\n    rc = fts3DoAutoincrmerge(p, &zVal[10]);\n#ifdef SQLITE_TEST\n  }else if( nVal>9 && 0==sqlite3_strnicmp(zVal, \"nodesize=\", 9) ){\n    p->nNodeSize = atoi(&zVal[9]);\n    rc = SQLITE_OK;\n  }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, \"maxpending=\", 9) ){\n    p->nMaxPendingData = atoi(&zVal[11]);\n    rc = SQLITE_OK;\n  }else if( nVal>21 && 0==sqlite3_strnicmp(zVal, \"test-no-incr-doclist=\", 21) ){\n    p->bNoIncrDoclist = atoi(&zVal[21]);\n    rc = SQLITE_OK;\n#endif\n  }else{\n    rc = SQLITE_ERROR;\n  }\n\n  return rc;\n}\n\n#ifndef SQLITE_DISABLE_FTS4_DEFERRED\n/*\n** Delete all cached deferred doclists. Deferred doclists are cached\n** (allocated) by the sqlite3Fts3CacheDeferredDoclists() function.\n*/\nvoid sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *pCsr){\n  Fts3DeferredToken *pDef;\n  for(pDef=pCsr->pDeferred; pDef; pDef=pDef->pNext){\n    fts3PendingListDelete(pDef->pList);\n    pDef->pList = 0;\n  }\n}\n\n/*\n** Free all entries in the pCsr->pDeffered list. Entries are added to \n** this list using sqlite3Fts3DeferToken().\n*/\nvoid sqlite3Fts3FreeDeferredTokens(Fts3Cursor *pCsr){\n  Fts3DeferredToken *pDef;\n  Fts3DeferredToken *pNext;\n  for(pDef=pCsr->pDeferred; pDef; pDef=pNext){\n    pNext = pDef->pNext;\n    fts3PendingListDelete(pDef->pList);\n    sqlite3_free(pDef);\n  }\n  pCsr->pDeferred = 0;\n}\n\n/*\n** Generate deferred-doclists for all tokens in the pCsr->pDeferred list\n** based on the row that pCsr currently points to.\n**\n** A deferred-doclist is like any other doclist with position information\n** included, except that it only contains entries for a single row of the\n** table, not for all rows.\n*/\nint sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *pCsr){\n  int rc = SQLITE_OK;             /* Return code */\n  if( pCsr->pDeferred ){\n    int i;                        /* Used to iterate through table columns */\n    sqlite3_int64 iDocid;         /* Docid of the row pCsr points to */\n    Fts3DeferredToken *pDef;      /* Used to iterate through deferred tokens */\n  \n    Fts3Table *p = (Fts3Table *)pCsr->base.pVtab;\n    sqlite3_tokenizer *pT = p->pTokenizer;\n    sqlite3_tokenizer_module const *pModule = pT->pModule;\n   \n    assert( pCsr->isRequireSeek==0 );\n    iDocid = sqlite3_column_int64(pCsr->pStmt, 0);\n  \n    for(i=0; i<p->nColumn && rc==SQLITE_OK; i++){\n      if( p->abNotindexed[i]==0 ){\n        const char *zText = (const char *)sqlite3_column_text(pCsr->pStmt, i+1);\n        sqlite3_tokenizer_cursor *pTC = 0;\n\n        rc = sqlite3Fts3OpenTokenizer(pT, pCsr->iLangid, zText, -1, &pTC);\n        while( rc==SQLITE_OK ){\n          char const *zToken;       /* Buffer containing token */\n          int nToken = 0;           /* Number of bytes in token */\n          int iDum1 = 0, iDum2 = 0; /* Dummy variables */\n          int iPos = 0;             /* Position of token in zText */\n\n          rc = pModule->xNext(pTC, &zToken, &nToken, &iDum1, &iDum2, &iPos);\n          for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){\n            Fts3PhraseToken *pPT = pDef->pToken;\n            if( (pDef->iCol>=p->nColumn || pDef->iCol==i)\n                && (pPT->bFirst==0 || iPos==0)\n                && (pPT->n==nToken || (pPT->isPrefix && pPT->n<nToken))\n                && (0==memcmp(zToken, pPT->z, pPT->n))\n              ){\n              fts3PendingListAppend(&pDef->pList, iDocid, i, iPos, &rc);\n            }\n          }\n        }\n        if( pTC ) pModule->xClose(pTC);\n        if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n      }\n    }\n\n    for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){\n      if( pDef->pList ){\n        rc = fts3PendingListAppendVarint(&pDef->pList, 0);\n      }\n    }\n  }\n\n  return rc;\n}\n\nint sqlite3Fts3DeferredTokenList(\n  Fts3DeferredToken *p, \n  char **ppData, \n  int *pnData\n){\n  char *pRet;\n  int nSkip;\n  sqlite3_int64 dummy;\n\n  *ppData = 0;\n  *pnData = 0;\n\n  if( p->pList==0 ){\n    return SQLITE_OK;\n  }\n\n  pRet = (char *)sqlite3_malloc(p->pList->nData);\n  if( !pRet ) return SQLITE_NOMEM;\n\n  nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy);\n  *pnData = p->pList->nData - nSkip;\n  *ppData = pRet;\n  \n  memcpy(pRet, &p->pList->aData[nSkip], *pnData);\n  return SQLITE_OK;\n}\n\n/*\n** Add an entry for token pToken to the pCsr->pDeferred list.\n*/\nint sqlite3Fts3DeferToken(\n  Fts3Cursor *pCsr,               /* Fts3 table cursor */\n  Fts3PhraseToken *pToken,        /* Token to defer */\n  int iCol                        /* Column that token must appear in (or -1) */\n){\n  Fts3DeferredToken *pDeferred;\n  pDeferred = sqlite3_malloc(sizeof(*pDeferred));\n  if( !pDeferred ){\n    return SQLITE_NOMEM;\n  }\n  memset(pDeferred, 0, sizeof(*pDeferred));\n  pDeferred->pToken = pToken;\n  pDeferred->pNext = pCsr->pDeferred; \n  pDeferred->iCol = iCol;\n  pCsr->pDeferred = pDeferred;\n\n  assert( pToken->pDeferred==0 );\n  pToken->pDeferred = pDeferred;\n\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** SQLite value pRowid contains the rowid of a row that may or may not be\n** present in the FTS3 table. If it is, delete it and adjust the contents\n** of subsiduary data structures accordingly.\n*/\nstatic int fts3DeleteByRowid(\n  Fts3Table *p, \n  sqlite3_value *pRowid, \n  int *pnChng,                    /* IN/OUT: Decrement if row is deleted */\n  u32 *aSzDel\n){\n  int rc = SQLITE_OK;             /* Return code */\n  int bFound = 0;                 /* True if *pRowid really is in the table */\n\n  fts3DeleteTerms(&rc, p, pRowid, aSzDel, &bFound);\n  if( bFound && rc==SQLITE_OK ){\n    int isEmpty = 0;              /* Deleting *pRowid leaves the table empty */\n    rc = fts3IsEmpty(p, pRowid, &isEmpty);\n    if( rc==SQLITE_OK ){\n      if( isEmpty ){\n        /* Deleting this row means the whole table is empty. In this case\n        ** delete the contents of all three tables and throw away any\n        ** data in the pendingTerms hash table.  */\n        rc = fts3DeleteAll(p, 1);\n        *pnChng = 0;\n        memset(aSzDel, 0, sizeof(u32) * (p->nColumn+1) * 2);\n      }else{\n        *pnChng = *pnChng - 1;\n        if( p->zContentTbl==0 ){\n          fts3SqlExec(&rc, p, SQL_DELETE_CONTENT, &pRowid);\n        }\n        if( p->bHasDocsize ){\n          fts3SqlExec(&rc, p, SQL_DELETE_DOCSIZE, &pRowid);\n        }\n      }\n    }\n  }\n\n  return rc;\n}\n\n/*\n** This function does the work for the xUpdate method of FTS3 virtual\n** tables. The schema of the virtual table being:\n**\n**     CREATE TABLE <table name>( \n**       <user columns>,\n**       <table name> HIDDEN, \n**       docid HIDDEN, \n**       <langid> HIDDEN\n**     );\n**\n** \n*/\nint sqlite3Fts3UpdateMethod(\n  sqlite3_vtab *pVtab,            /* FTS3 vtab object */\n  int nArg,                       /* Size of argument array */\n  sqlite3_value **apVal,          /* Array of arguments */\n  sqlite_int64 *pRowid            /* OUT: The affected (or effected) rowid */\n){\n  Fts3Table *p = (Fts3Table *)pVtab;\n  int rc = SQLITE_OK;             /* Return Code */\n  int isRemove = 0;               /* True for an UPDATE or DELETE */\n  u32 *aSzIns = 0;                /* Sizes of inserted documents */\n  u32 *aSzDel = 0;                /* Sizes of deleted documents */\n  int nChng = 0;                  /* Net change in number of documents */\n  int bInsertDone = 0;\n\n  /* At this point it must be known if the %_stat table exists or not.\n  ** So bHasStat may not be 2.  */\n  assert( p->bHasStat==0 || p->bHasStat==1 );\n\n  assert( p->pSegments==0 );\n  assert( \n      nArg==1                     /* DELETE operations */\n   || nArg==(2 + p->nColumn + 3)  /* INSERT or UPDATE operations */\n  );\n\n  /* Check for a \"special\" INSERT operation. One of the form:\n  **\n  **   INSERT INTO xyz(xyz) VALUES('command');\n  */\n  if( nArg>1 \n   && sqlite3_value_type(apVal[0])==SQLITE_NULL \n   && sqlite3_value_type(apVal[p->nColumn+2])!=SQLITE_NULL \n  ){\n    rc = fts3SpecialInsert(p, apVal[p->nColumn+2]);\n    goto update_out;\n  }\n\n  if( nArg>1 && sqlite3_value_int(apVal[2 + p->nColumn + 2])<0 ){\n    rc = SQLITE_CONSTRAINT;\n    goto update_out;\n  }\n\n  /* Allocate space to hold the change in document sizes */\n  aSzDel = sqlite3_malloc( sizeof(aSzDel[0])*(p->nColumn+1)*2 );\n  if( aSzDel==0 ){\n    rc = SQLITE_NOMEM;\n    goto update_out;\n  }\n  aSzIns = &aSzDel[p->nColumn+1];\n  memset(aSzDel, 0, sizeof(aSzDel[0])*(p->nColumn+1)*2);\n\n  rc = fts3Writelock(p);\n  if( rc!=SQLITE_OK ) goto update_out;\n\n  /* If this is an INSERT operation, or an UPDATE that modifies the rowid\n  ** value, then this operation requires constraint handling.\n  **\n  ** If the on-conflict mode is REPLACE, this means that the existing row\n  ** should be deleted from the database before inserting the new row. Or,\n  ** if the on-conflict mode is other than REPLACE, then this method must\n  ** detect the conflict and return SQLITE_CONSTRAINT before beginning to\n  ** modify the database file.\n  */\n  if( nArg>1 && p->zContentTbl==0 ){\n    /* Find the value object that holds the new rowid value. */\n    sqlite3_value *pNewRowid = apVal[3+p->nColumn];\n    if( sqlite3_value_type(pNewRowid)==SQLITE_NULL ){\n      pNewRowid = apVal[1];\n    }\n\n    if( sqlite3_value_type(pNewRowid)!=SQLITE_NULL && ( \n        sqlite3_value_type(apVal[0])==SQLITE_NULL\n     || sqlite3_value_int64(apVal[0])!=sqlite3_value_int64(pNewRowid)\n    )){\n      /* The new rowid is not NULL (in this case the rowid will be\n      ** automatically assigned and there is no chance of a conflict), and \n      ** the statement is either an INSERT or an UPDATE that modifies the\n      ** rowid column. So if the conflict mode is REPLACE, then delete any\n      ** existing row with rowid=pNewRowid. \n      **\n      ** Or, if the conflict mode is not REPLACE, insert the new record into \n      ** the %_content table. If we hit the duplicate rowid constraint (or any\n      ** other error) while doing so, return immediately.\n      **\n      ** This branch may also run if pNewRowid contains a value that cannot\n      ** be losslessly converted to an integer. In this case, the eventual \n      ** call to fts3InsertData() (either just below or further on in this\n      ** function) will return SQLITE_MISMATCH. If fts3DeleteByRowid is \n      ** invoked, it will delete zero rows (since no row will have\n      ** docid=$pNewRowid if $pNewRowid is not an integer value).\n      */\n      if( sqlite3_vtab_on_conflict(p->db)==SQLITE_REPLACE ){\n        rc = fts3DeleteByRowid(p, pNewRowid, &nChng, aSzDel);\n      }else{\n        rc = fts3InsertData(p, apVal, pRowid);\n        bInsertDone = 1;\n      }\n    }\n  }\n  if( rc!=SQLITE_OK ){\n    goto update_out;\n  }\n\n  /* If this is a DELETE or UPDATE operation, remove the old record. */\n  if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){\n    assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER );\n    rc = fts3DeleteByRowid(p, apVal[0], &nChng, aSzDel);\n    isRemove = 1;\n  }\n  \n  /* If this is an INSERT or UPDATE operation, insert the new record. */\n  if( nArg>1 && rc==SQLITE_OK ){\n    int iLangid = sqlite3_value_int(apVal[2 + p->nColumn + 2]);\n    if( bInsertDone==0 ){\n      rc = fts3InsertData(p, apVal, pRowid);\n      if( rc==SQLITE_CONSTRAINT && p->zContentTbl==0 ){\n        rc = FTS_CORRUPT_VTAB;\n      }\n    }\n    if( rc==SQLITE_OK && (!isRemove || *pRowid!=p->iPrevDocid ) ){\n      rc = fts3PendingTermsDocid(p, 0, iLangid, *pRowid);\n    }\n    if( rc==SQLITE_OK ){\n      assert( p->iPrevDocid==*pRowid );\n      rc = fts3InsertTerms(p, iLangid, apVal, aSzIns);\n    }\n    if( p->bHasDocsize ){\n      fts3InsertDocsize(&rc, p, aSzIns);\n    }\n    nChng++;\n  }\n\n  if( p->bFts4 ){\n    fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nChng);\n  }\n\n update_out:\n  sqlite3_free(aSzDel);\n  sqlite3Fts3SegmentsClose(p);\n  return rc;\n}\n\n/* \n** Flush any data in the pending-terms hash table to disk. If successful,\n** merge all segments in the database (including the new segment, if \n** there was any data to flush) into a single segment. \n*/\nint sqlite3Fts3Optimize(Fts3Table *p){\n  int rc;\n  rc = sqlite3_exec(p->db, \"SAVEPOINT fts3\", 0, 0, 0);\n  if( rc==SQLITE_OK ){\n    rc = fts3DoOptimize(p, 1);\n    if( rc==SQLITE_OK || rc==SQLITE_DONE ){\n      int rc2 = sqlite3_exec(p->db, \"RELEASE fts3\", 0, 0, 0);\n      if( rc2!=SQLITE_OK ) rc = rc2;\n    }else{\n      sqlite3_exec(p->db, \"ROLLBACK TO fts3\", 0, 0, 0);\n      sqlite3_exec(p->db, \"RELEASE fts3\", 0, 0, 0);\n    }\n  }\n  sqlite3Fts3SegmentsClose(p);\n  return rc;\n}\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/icu/icu.c",
    "content": "/*\n** 2007 May 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** $Id: icu.c,v 1.7 2007/12/13 21:54:11 drh Exp $\n**\n** This file implements an integration between the ICU library \n** (\"International Components for Unicode\", an open-source library \n** for handling unicode data) and SQLite. The integration uses \n** ICU to provide the following to SQLite:\n**\n**   * An implementation of the SQL regexp() function (and hence REGEXP\n**     operator) using the ICU uregex_XX() APIs.\n**\n**   * Implementations of the SQL scalar upper() and lower() functions\n**     for case mapping.\n**\n**   * Integration of ICU and SQLite collation sequences.\n**\n**   * An implementation of the LIKE operator that uses ICU to \n**     provide case-independent matching.\n*/\n\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU)\n\n/* Include ICU headers */\n#include <unicode/utypes.h>\n#include <unicode/uregex.h>\n#include <unicode/ustring.h>\n#include <unicode/ucol.h>\n\n#include <assert.h>\n\n#ifndef SQLITE_CORE\n  #include \"sqlite3ext.h\"\n  SQLITE_EXTENSION_INIT1\n#else\n  #include \"sqlite3.h\"\n#endif\n\n/*\n** Maximum length (in bytes) of the pattern in a LIKE or GLOB\n** operator.\n*/\n#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH\n# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000\n#endif\n\n/*\n** Version of sqlite3_free() that is always a function, never a macro.\n*/\nstatic void xFree(void *p){\n  sqlite3_free(p);\n}\n\n/*\n** This lookup table is used to help decode the first byte of\n** a multi-byte UTF8 character. It is copied here from SQLite source\n** code file utf8.c.\n*/\nstatic const unsigned char icuUtf8Trans1[] = {\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,\n  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,\n};\n\n#define SQLITE_ICU_READ_UTF8(zIn, c)                       \\\n  c = *(zIn++);                                            \\\n  if( c>=0xc0 ){                                           \\\n    c = icuUtf8Trans1[c-0xc0];                             \\\n    while( (*zIn & 0xc0)==0x80 ){                          \\\n      c = (c<<6) + (0x3f & *(zIn++));                      \\\n    }                                                      \\\n  }\n\n#define SQLITE_ICU_SKIP_UTF8(zIn)                          \\\n  assert( *zIn );                                          \\\n  if( *(zIn++)>=0xc0 ){                                    \\\n    while( (*zIn & 0xc0)==0x80 ){zIn++;}                   \\\n  }\n\n\n/*\n** Compare two UTF-8 strings for equality where the first string is\n** a \"LIKE\" expression. Return true (1) if they are the same and \n** false (0) if they are different.\n*/\nstatic int icuLikeCompare(\n  const uint8_t *zPattern,   /* LIKE pattern */\n  const uint8_t *zString,    /* The UTF-8 string to compare against */\n  const UChar32 uEsc         /* The escape character */\n){\n  static const int MATCH_ONE = (UChar32)'_';\n  static const int MATCH_ALL = (UChar32)'%';\n\n  int prevEscape = 0;     /* True if the previous character was uEsc */\n\n  while( 1 ){\n\n    /* Read (and consume) the next character from the input pattern. */\n    UChar32 uPattern;\n    SQLITE_ICU_READ_UTF8(zPattern, uPattern);\n    if( uPattern==0 ) break;\n\n    /* There are now 4 possibilities:\n    **\n    **     1. uPattern is an unescaped match-all character \"%\",\n    **     2. uPattern is an unescaped match-one character \"_\",\n    **     3. uPattern is an unescaped escape character, or\n    **     4. uPattern is to be handled as an ordinary character\n    */\n    if( !prevEscape && uPattern==MATCH_ALL ){\n      /* Case 1. */\n      uint8_t c;\n\n      /* Skip any MATCH_ALL or MATCH_ONE characters that follow a\n      ** MATCH_ALL. For each MATCH_ONE, skip one character in the \n      ** test string.\n      */\n      while( (c=*zPattern) == MATCH_ALL || c == MATCH_ONE ){\n        if( c==MATCH_ONE ){\n          if( *zString==0 ) return 0;\n          SQLITE_ICU_SKIP_UTF8(zString);\n        }\n        zPattern++;\n      }\n\n      if( *zPattern==0 ) return 1;\n\n      while( *zString ){\n        if( icuLikeCompare(zPattern, zString, uEsc) ){\n          return 1;\n        }\n        SQLITE_ICU_SKIP_UTF8(zString);\n      }\n      return 0;\n\n    }else if( !prevEscape && uPattern==MATCH_ONE ){\n      /* Case 2. */\n      if( *zString==0 ) return 0;\n      SQLITE_ICU_SKIP_UTF8(zString);\n\n    }else if( !prevEscape && uPattern==uEsc){\n      /* Case 3. */\n      prevEscape = 1;\n\n    }else{\n      /* Case 4. */\n      UChar32 uString;\n      SQLITE_ICU_READ_UTF8(zString, uString);\n      uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT);\n      uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT);\n      if( uString!=uPattern ){\n        return 0;\n      }\n      prevEscape = 0;\n    }\n  }\n\n  return *zString==0;\n}\n\n/*\n** Implementation of the like() SQL function.  This function implements\n** the build-in LIKE operator.  The first argument to the function is the\n** pattern and the second argument is the string.  So, the SQL statements:\n**\n**       A LIKE B\n**\n** is implemented as like(B, A). If there is an escape character E, \n**\n**       A LIKE B ESCAPE E\n**\n** is mapped to like(B, A, E).\n*/\nstatic void icuLikeFunc(\n  sqlite3_context *context, \n  int argc, \n  sqlite3_value **argv\n){\n  const unsigned char *zA = sqlite3_value_text(argv[0]);\n  const unsigned char *zB = sqlite3_value_text(argv[1]);\n  UChar32 uEsc = 0;\n\n  /* Limit the length of the LIKE or GLOB pattern to avoid problems\n  ** of deep recursion and N*N behavior in patternCompare().\n  */\n  if( sqlite3_value_bytes(argv[0])>SQLITE_MAX_LIKE_PATTERN_LENGTH ){\n    sqlite3_result_error(context, \"LIKE or GLOB pattern too complex\", -1);\n    return;\n  }\n\n\n  if( argc==3 ){\n    /* The escape character string must consist of a single UTF-8 character.\n    ** Otherwise, return an error.\n    */\n    int nE= sqlite3_value_bytes(argv[2]);\n    const unsigned char *zE = sqlite3_value_text(argv[2]);\n    int i = 0;\n    if( zE==0 ) return;\n    U8_NEXT(zE, i, nE, uEsc);\n    if( i!=nE){\n      sqlite3_result_error(context, \n          \"ESCAPE expression must be a single character\", -1);\n      return;\n    }\n  }\n\n  if( zA && zB ){\n    sqlite3_result_int(context, icuLikeCompare(zA, zB, uEsc));\n  }\n}\n\n/*\n** This function is called when an ICU function called from within\n** the implementation of an SQL scalar function returns an error.\n**\n** The scalar function context passed as the first argument is \n** loaded with an error message based on the following two args.\n*/\nstatic void icuFunctionError(\n  sqlite3_context *pCtx,       /* SQLite scalar function context */\n  const char *zName,           /* Name of ICU function that failed */\n  UErrorCode e                 /* Error code returned by ICU function */\n){\n  char zBuf[128];\n  sqlite3_snprintf(128, zBuf, \"ICU error: %s(): %s\", zName, u_errorName(e));\n  zBuf[127] = '\\0';\n  sqlite3_result_error(pCtx, zBuf, -1);\n}\n\n/*\n** Function to delete compiled regexp objects. Registered as\n** a destructor function with sqlite3_set_auxdata().\n*/\nstatic void icuRegexpDelete(void *p){\n  URegularExpression *pExpr = (URegularExpression *)p;\n  uregex_close(pExpr);\n}\n\n/*\n** Implementation of SQLite REGEXP operator. This scalar function takes\n** two arguments. The first is a regular expression pattern to compile\n** the second is a string to match against that pattern. If either \n** argument is an SQL NULL, then NULL Is returned. Otherwise, the result\n** is 1 if the string matches the pattern, or 0 otherwise.\n**\n** SQLite maps the regexp() function to the regexp() operator such\n** that the following two are equivalent:\n**\n**     zString REGEXP zPattern\n**     regexp(zPattern, zString)\n**\n** Uses the following ICU regexp APIs:\n**\n**     uregex_open()\n**     uregex_matches()\n**     uregex_close()\n*/\nstatic void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){\n  UErrorCode status = U_ZERO_ERROR;\n  URegularExpression *pExpr;\n  UBool res;\n  const UChar *zString = sqlite3_value_text16(apArg[1]);\n\n  (void)nArg;  /* Unused parameter */\n\n  /* If the left hand side of the regexp operator is NULL, \n  ** then the result is also NULL. \n  */\n  if( !zString ){\n    return;\n  }\n\n  pExpr = sqlite3_get_auxdata(p, 0);\n  if( !pExpr ){\n    const UChar *zPattern = sqlite3_value_text16(apArg[0]);\n    if( !zPattern ){\n      return;\n    }\n    pExpr = uregex_open(zPattern, -1, 0, 0, &status);\n\n    if( U_SUCCESS(status) ){\n      sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete);\n    }else{\n      assert(!pExpr);\n      icuFunctionError(p, \"uregex_open\", status);\n      return;\n    }\n  }\n\n  /* Configure the text that the regular expression operates on. */\n  uregex_setText(pExpr, zString, -1, &status);\n  if( !U_SUCCESS(status) ){\n    icuFunctionError(p, \"uregex_setText\", status);\n    return;\n  }\n\n  /* Attempt the match */\n  res = uregex_matches(pExpr, 0, &status);\n  if( !U_SUCCESS(status) ){\n    icuFunctionError(p, \"uregex_matches\", status);\n    return;\n  }\n\n  /* Set the text that the regular expression operates on to a NULL\n  ** pointer. This is not really necessary, but it is tidier than \n  ** leaving the regular expression object configured with an invalid\n  ** pointer after this function returns.\n  */\n  uregex_setText(pExpr, 0, 0, &status);\n\n  /* Return 1 or 0. */\n  sqlite3_result_int(p, res ? 1 : 0);\n}\n\n/*\n** Implementations of scalar functions for case mapping - upper() and \n** lower(). Function upper() converts its input to upper-case (ABC).\n** Function lower() converts to lower-case (abc).\n**\n** ICU provides two types of case mapping, \"general\" case mapping and\n** \"language specific\". Refer to ICU documentation for the differences\n** between the two.\n**\n** To utilise \"general\" case mapping, the upper() or lower() scalar \n** functions are invoked with one argument:\n**\n**     upper('ABC') -> 'abc'\n**     lower('abc') -> 'ABC'\n**\n** To access ICU \"language specific\" case mapping, upper() or lower()\n** should be invoked with two arguments. The second argument is the name\n** of the locale to use. Passing an empty string (\"\") or SQL NULL value\n** as the second argument is the same as invoking the 1 argument version\n** of upper() or lower().\n**\n**     lower('I', 'en_us') -> 'i'\n**     lower('I', 'tr_tr') -> '\\u131' (small dotless i)\n**\n** http://www.icu-project.org/userguide/posix.html#case_mappings\n*/\nstatic void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){\n  const UChar *zInput;            /* Pointer to input string */\n  UChar *zOutput = 0;             /* Pointer to output buffer */\n  int nInput;                     /* Size of utf-16 input string in bytes */\n  int nOut;                       /* Size of output buffer in bytes */\n  int cnt;\n  int bToUpper;                   /* True for toupper(), false for tolower() */\n  UErrorCode status;\n  const char *zLocale = 0;\n\n  assert(nArg==1 || nArg==2);\n  bToUpper = (sqlite3_user_data(p)!=0);\n  if( nArg==2 ){\n    zLocale = (const char *)sqlite3_value_text(apArg[1]);\n  }\n\n  zInput = sqlite3_value_text16(apArg[0]);\n  if( !zInput ){\n    return;\n  }\n  nOut = nInput = sqlite3_value_bytes16(apArg[0]);\n  if( nOut==0 ){\n    sqlite3_result_text16(p, \"\", 0, SQLITE_STATIC);\n    return;\n  }\n\n  for(cnt=0; cnt<2; cnt++){\n    UChar *zNew = sqlite3_realloc(zOutput, nOut);\n    if( zNew==0 ){\n      sqlite3_free(zOutput);\n      sqlite3_result_error_nomem(p);\n      return;\n    }\n    zOutput = zNew;\n    status = U_ZERO_ERROR;\n    if( bToUpper ){\n      nOut = 2*u_strToUpper(zOutput,nOut/2,zInput,nInput/2,zLocale,&status);\n    }else{\n      nOut = 2*u_strToLower(zOutput,nOut/2,zInput,nInput/2,zLocale,&status);\n    }\n\n    if( U_SUCCESS(status) ){\n      sqlite3_result_text16(p, zOutput, nOut, xFree);\n    }else if( status==U_BUFFER_OVERFLOW_ERROR ){\n      assert( cnt==0 );\n      continue;\n    }else{\n      icuFunctionError(p, bToUpper ? \"u_strToUpper\" : \"u_strToLower\", status);\n    }\n    return;\n  }\n  assert( 0 );     /* Unreachable */\n}\n\n/*\n** Collation sequence destructor function. The pCtx argument points to\n** a UCollator structure previously allocated using ucol_open().\n*/\nstatic void icuCollationDel(void *pCtx){\n  UCollator *p = (UCollator *)pCtx;\n  ucol_close(p);\n}\n\n/*\n** Collation sequence comparison function. The pCtx argument points to\n** a UCollator structure previously allocated using ucol_open().\n*/\nstatic int icuCollationColl(\n  void *pCtx,\n  int nLeft,\n  const void *zLeft,\n  int nRight,\n  const void *zRight\n){\n  UCollationResult res;\n  UCollator *p = (UCollator *)pCtx;\n  res = ucol_strcoll(p, (UChar *)zLeft, nLeft/2, (UChar *)zRight, nRight/2);\n  switch( res ){\n    case UCOL_LESS:    return -1;\n    case UCOL_GREATER: return +1;\n    case UCOL_EQUAL:   return 0;\n  }\n  assert(!\"Unexpected return value from ucol_strcoll()\");\n  return 0;\n}\n\n/*\n** Implementation of the scalar function icu_load_collation().\n**\n** This scalar function is used to add ICU collation based collation \n** types to an SQLite database connection. It is intended to be called\n** as follows:\n**\n**     SELECT icu_load_collation(<locale>, <collation-name>);\n**\n** Where <locale> is a string containing an ICU locale identifier (i.e.\n** \"en_AU\", \"tr_TR\" etc.) and <collation-name> is the name of the\n** collation sequence to create.\n*/\nstatic void icuLoadCollation(\n  sqlite3_context *p, \n  int nArg, \n  sqlite3_value **apArg\n){\n  sqlite3 *db = (sqlite3 *)sqlite3_user_data(p);\n  UErrorCode status = U_ZERO_ERROR;\n  const char *zLocale;      /* Locale identifier - (eg. \"jp_JP\") */\n  const char *zName;        /* SQL Collation sequence name (eg. \"japanese\") */\n  UCollator *pUCollator;    /* ICU library collation object */\n  int rc;                   /* Return code from sqlite3_create_collation_x() */\n\n  assert(nArg==2);\n  (void)nArg; /* Unused parameter */\n  zLocale = (const char *)sqlite3_value_text(apArg[0]);\n  zName = (const char *)sqlite3_value_text(apArg[1]);\n\n  if( !zLocale || !zName ){\n    return;\n  }\n\n  pUCollator = ucol_open(zLocale, &status);\n  if( !U_SUCCESS(status) ){\n    icuFunctionError(p, \"ucol_open\", status);\n    return;\n  }\n  assert(p);\n\n  rc = sqlite3_create_collation_v2(db, zName, SQLITE_UTF16, (void *)pUCollator, \n      icuCollationColl, icuCollationDel\n  );\n  if( rc!=SQLITE_OK ){\n    ucol_close(pUCollator);\n    sqlite3_result_error(p, \"Error registering collation function\", -1);\n  }\n}\n\n/*\n** Register the ICU extension functions with database db.\n*/\nint sqlite3IcuInit(sqlite3 *db){\n  struct IcuScalar {\n    const char *zName;                        /* Function name */\n    int nArg;                                 /* Number of arguments */\n    int enc;                                  /* Optimal text encoding */\n    void *pContext;                           /* sqlite3_user_data() context */\n    void (*xFunc)(sqlite3_context*,int,sqlite3_value**);\n  } scalars[] = {\n    {\"regexp\", 2, SQLITE_ANY|SQLITE_DETERMINISTIC,          0, icuRegexpFunc},\n\n    {\"lower\",  1, SQLITE_UTF16|SQLITE_DETERMINISTIC,        0, icuCaseFunc16},\n    {\"lower\",  2, SQLITE_UTF16|SQLITE_DETERMINISTIC,        0, icuCaseFunc16},\n    {\"upper\",  1, SQLITE_UTF16|SQLITE_DETERMINISTIC, (void*)1, icuCaseFunc16},\n    {\"upper\",  2, SQLITE_UTF16|SQLITE_DETERMINISTIC, (void*)1, icuCaseFunc16},\n\n    {\"lower\",  1, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, icuCaseFunc16},\n    {\"lower\",  2, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, icuCaseFunc16},\n    {\"upper\",  1, SQLITE_UTF8|SQLITE_DETERMINISTIC,  (void*)1, icuCaseFunc16},\n    {\"upper\",  2, SQLITE_UTF8|SQLITE_DETERMINISTIC,  (void*)1, icuCaseFunc16},\n\n    {\"like\",   2, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, icuLikeFunc},\n    {\"like\",   3, SQLITE_UTF8|SQLITE_DETERMINISTIC,         0, icuLikeFunc},\n\n    {\"icu_load_collation\",  2, SQLITE_UTF8, (void*)db, icuLoadCollation},\n  };\n\n  int rc = SQLITE_OK;\n  int i;\n\n  for(i=0; rc==SQLITE_OK && i<(int)(sizeof(scalars)/sizeof(scalars[0])); i++){\n    struct IcuScalar *p = &scalars[i];\n    rc = sqlite3_create_function(\n        db, p->zName, p->nArg, p->enc, p->pContext, p->xFunc, 0, 0\n    );\n  }\n\n  return rc;\n}\n\n#if !SQLITE_CORE\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nint sqlite3_icu_init(\n  sqlite3 *db, \n  char **pzErrMsg,\n  const sqlite3_api_routines *pApi\n){\n  SQLITE_EXTENSION_INIT2(pApi)\n  return sqlite3IcuInit(db);\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/icu/sqliteicu.h",
    "content": "/*\n** 2008 May 26\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This header file is used by programs that want to link against the\n** ICU extension.  All it does is declare the sqlite3IcuInit() interface.\n*/\n#include \"sqlite3.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif  /* __cplusplus */\n\nint sqlite3IcuInit(sqlite3 *db);\n\n#ifdef __cplusplus\n}  /* extern \"C\" */\n#endif  /* __cplusplus */\n\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/rbu/sqlite3rbu.c",
    "content": "/*\n** 2014 August 30\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n**\n** OVERVIEW \n**\n**  The RBU extension requires that the RBU update be packaged as an\n**  SQLite database. The tables it expects to find are described in\n**  sqlite3rbu.h.  Essentially, for each table xyz in the target database\n**  that the user wishes to write to, a corresponding data_xyz table is\n**  created in the RBU database and populated with one row for each row to\n**  update, insert or delete from the target table.\n** \n**  The update proceeds in three stages:\n** \n**  1) The database is updated. The modified database pages are written\n**     to a *-oal file. A *-oal file is just like a *-wal file, except\n**     that it is named \"<database>-oal\" instead of \"<database>-wal\".\n**     Because regular SQLite clients do not look for file named\n**     \"<database>-oal\", they go on using the original database in\n**     rollback mode while the *-oal file is being generated.\n** \n**     During this stage RBU does not update the database by writing\n**     directly to the target tables. Instead it creates \"imposter\"\n**     tables using the SQLITE_TESTCTRL_IMPOSTER interface that it uses\n**     to update each b-tree individually. All updates required by each\n**     b-tree are completed before moving on to the next, and all\n**     updates are done in sorted key order.\n** \n**  2) The \"<database>-oal\" file is moved to the equivalent \"<database>-wal\"\n**     location using a call to rename(2). Before doing this the RBU\n**     module takes an EXCLUSIVE lock on the database file, ensuring\n**     that there are no other active readers.\n** \n**     Once the EXCLUSIVE lock is released, any other database readers\n**     detect the new *-wal file and read the database in wal mode. At\n**     this point they see the new version of the database - including\n**     the updates made as part of the RBU update.\n** \n**  3) The new *-wal file is checkpointed. This proceeds in the same way \n**     as a regular database checkpoint, except that a single frame is\n**     checkpointed each time sqlite3rbu_step() is called. If the RBU\n**     handle is closed before the entire *-wal file is checkpointed,\n**     the checkpoint progress is saved in the RBU database and the\n**     checkpoint can be resumed by another RBU client at some point in\n**     the future.\n**\n** POTENTIAL PROBLEMS\n** \n**  The rename() call might not be portable. And RBU is not currently\n**  syncing the directory after renaming the file.\n**\n**  When state is saved, any commit to the *-oal file and the commit to\n**  the RBU update database are not atomic. So if the power fails at the\n**  wrong moment they might get out of sync. As the main database will be\n**  committed before the RBU update database this will likely either just\n**  pass unnoticed, or result in SQLITE_CONSTRAINT errors (due to UNIQUE\n**  constraint violations).\n**\n**  If some client does modify the target database mid RBU update, or some\n**  other error occurs, the RBU extension will keep throwing errors. It's\n**  not really clear how to get out of this state. The system could just\n**  by delete the RBU update database and *-oal file and have the device\n**  download the update again and start over.\n**\n**  At present, for an UPDATE, both the new.* and old.* records are\n**  collected in the rbu_xyz table. And for both UPDATEs and DELETEs all\n**  fields are collected.  This means we're probably writing a lot more\n**  data to disk when saving the state of an ongoing update to the RBU\n**  update database than is strictly necessary.\n** \n*/\n\n#include <assert.h>\n#include <string.h>\n#include <stdio.h>\n\n#include \"sqlite3.h\"\n\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU)\n#include \"sqlite3rbu.h\"\n\n#if defined(_WIN32_WCE)\n#include \"windows.h\"\n#endif\n\n/* Maximum number of prepared UPDATE statements held by this module */\n#define SQLITE_RBU_UPDATE_CACHESIZE 16\n\n/*\n** Swap two objects of type TYPE.\n*/\n#if !defined(SQLITE_AMALGAMATION)\n# define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}\n#endif\n\n/*\n** The rbu_state table is used to save the state of a partially applied\n** update so that it can be resumed later. The table consists of integer\n** keys mapped to values as follows:\n**\n** RBU_STATE_STAGE:\n**   May be set to integer values 1, 2, 4 or 5. As follows:\n**       1: the *-rbu file is currently under construction.\n**       2: the *-rbu file has been constructed, but not yet moved \n**          to the *-wal path.\n**       4: the checkpoint is underway.\n**       5: the rbu update has been checkpointed.\n**\n** RBU_STATE_TBL:\n**   Only valid if STAGE==1. The target database name of the table \n**   currently being written.\n**\n** RBU_STATE_IDX:\n**   Only valid if STAGE==1. The target database name of the index \n**   currently being written, or NULL if the main table is currently being\n**   updated.\n**\n** RBU_STATE_ROW:\n**   Only valid if STAGE==1. Number of rows already processed for the current\n**   table/index.\n**\n** RBU_STATE_PROGRESS:\n**   Trbul number of sqlite3rbu_step() calls made so far as part of this\n**   rbu update.\n**\n** RBU_STATE_CKPT:\n**   Valid if STAGE==4. The 64-bit checksum associated with the wal-index\n**   header created by recovering the *-wal file. This is used to detect\n**   cases when another client appends frames to the *-wal file in the\n**   middle of an incremental checkpoint (an incremental checkpoint cannot\n**   be continued if this happens).\n**\n** RBU_STATE_COOKIE:\n**   Valid if STAGE==1. The current change-counter cookie value in the \n**   target db file.\n**\n** RBU_STATE_OALSZ:\n**   Valid if STAGE==1. The size in bytes of the *-oal file.\n*/\n#define RBU_STATE_STAGE        1\n#define RBU_STATE_TBL          2\n#define RBU_STATE_IDX          3\n#define RBU_STATE_ROW          4\n#define RBU_STATE_PROGRESS     5\n#define RBU_STATE_CKPT         6\n#define RBU_STATE_COOKIE       7\n#define RBU_STATE_OALSZ        8\n#define RBU_STATE_PHASEONESTEP 9\n\n#define RBU_STAGE_OAL         1\n#define RBU_STAGE_MOVE        2\n#define RBU_STAGE_CAPTURE     3\n#define RBU_STAGE_CKPT        4\n#define RBU_STAGE_DONE        5\n\n\n#define RBU_CREATE_STATE \\\n  \"CREATE TABLE IF NOT EXISTS %s.rbu_state(k INTEGER PRIMARY KEY, v)\"\n\ntypedef struct RbuFrame RbuFrame;\ntypedef struct RbuObjIter RbuObjIter;\ntypedef struct RbuState RbuState;\ntypedef struct rbu_vfs rbu_vfs;\ntypedef struct rbu_file rbu_file;\ntypedef struct RbuUpdateStmt RbuUpdateStmt;\n\n#if !defined(SQLITE_AMALGAMATION)\ntypedef unsigned int u32;\ntypedef unsigned short u16;\ntypedef unsigned char u8;\ntypedef sqlite3_int64 i64;\n#endif\n\n/*\n** These values must match the values defined in wal.c for the equivalent\n** locks. These are not magic numbers as they are part of the SQLite file\n** format.\n*/\n#define WAL_LOCK_WRITE  0\n#define WAL_LOCK_CKPT   1\n#define WAL_LOCK_READ0  3\n\n#define SQLITE_FCNTL_RBUCNT    5149216\n\n/*\n** A structure to store values read from the rbu_state table in memory.\n*/\nstruct RbuState {\n  int eStage;\n  char *zTbl;\n  char *zIdx;\n  i64 iWalCksum;\n  int nRow;\n  i64 nProgress;\n  u32 iCookie;\n  i64 iOalSz;\n  i64 nPhaseOneStep;\n};\n\nstruct RbuUpdateStmt {\n  char *zMask;                    /* Copy of update mask used with pUpdate */\n  sqlite3_stmt *pUpdate;          /* Last update statement (or NULL) */\n  RbuUpdateStmt *pNext;\n};\n\n/*\n** An iterator of this type is used to iterate through all objects in\n** the target database that require updating. For each such table, the\n** iterator visits, in order:\n**\n**     * the table itself, \n**     * each index of the table (zero or more points to visit), and\n**     * a special \"cleanup table\" state.\n**\n** abIndexed:\n**   If the table has no indexes on it, abIndexed is set to NULL. Otherwise,\n**   it points to an array of flags nTblCol elements in size. The flag is\n**   set for each column that is either a part of the PK or a part of an\n**   index. Or clear otherwise.\n**   \n*/\nstruct RbuObjIter {\n  sqlite3_stmt *pTblIter;         /* Iterate through tables */\n  sqlite3_stmt *pIdxIter;         /* Index iterator */\n  int nTblCol;                    /* Size of azTblCol[] array */\n  char **azTblCol;                /* Array of unquoted target column names */\n  char **azTblType;               /* Array of target column types */\n  int *aiSrcOrder;                /* src table col -> target table col */\n  u8 *abTblPk;                    /* Array of flags, set on target PK columns */\n  u8 *abNotNull;                  /* Array of flags, set on NOT NULL columns */\n  u8 *abIndexed;                  /* Array of flags, set on indexed & PK cols */\n  int eType;                      /* Table type - an RBU_PK_XXX value */\n\n  /* Output variables. zTbl==0 implies EOF. */\n  int bCleanup;                   /* True in \"cleanup\" state */\n  const char *zTbl;               /* Name of target db table */\n  const char *zDataTbl;           /* Name of rbu db table (or null) */\n  const char *zIdx;               /* Name of target db index (or null) */\n  int iTnum;                      /* Root page of current object */\n  int iPkTnum;                    /* If eType==EXTERNAL, root of PK index */\n  int bUnique;                    /* Current index is unique */\n  int nIndex;                     /* Number of aux. indexes on table zTbl */\n\n  /* Statements created by rbuObjIterPrepareAll() */\n  int nCol;                       /* Number of columns in current object */\n  sqlite3_stmt *pSelect;          /* Source data */\n  sqlite3_stmt *pInsert;          /* Statement for INSERT operations */\n  sqlite3_stmt *pDelete;          /* Statement for DELETE ops */\n  sqlite3_stmt *pTmpInsert;       /* Insert into rbu_tmp_$zDataTbl */\n\n  /* Last UPDATE used (for PK b-tree updates only), or NULL. */\n  RbuUpdateStmt *pRbuUpdate;\n};\n\n/*\n** Values for RbuObjIter.eType\n**\n**     0: Table does not exist (error)\n**     1: Table has an implicit rowid.\n**     2: Table has an explicit IPK column.\n**     3: Table has an external PK index.\n**     4: Table is WITHOUT ROWID.\n**     5: Table is a virtual table.\n*/\n#define RBU_PK_NOTABLE        0\n#define RBU_PK_NONE           1\n#define RBU_PK_IPK            2\n#define RBU_PK_EXTERNAL       3\n#define RBU_PK_WITHOUT_ROWID  4\n#define RBU_PK_VTAB           5\n\n\n/*\n** Within the RBU_STAGE_OAL stage, each call to sqlite3rbu_step() performs\n** one of the following operations.\n*/\n#define RBU_INSERT     1          /* Insert on a main table b-tree */\n#define RBU_DELETE     2          /* Delete a row from a main table b-tree */\n#define RBU_REPLACE    3          /* Delete and then insert a row */\n#define RBU_IDX_DELETE 4          /* Delete a row from an aux. index b-tree */\n#define RBU_IDX_INSERT 5          /* Insert on an aux. index b-tree */\n\n#define RBU_UPDATE     6          /* Update a row in a main table b-tree */\n\n/*\n** A single step of an incremental checkpoint - frame iWalFrame of the wal\n** file should be copied to page iDbPage of the database file.\n*/\nstruct RbuFrame {\n  u32 iDbPage;\n  u32 iWalFrame;\n};\n\n/*\n** RBU handle.\n**\n** nPhaseOneStep:\n**   If the RBU database contains an rbu_count table, this value is set to\n**   a running estimate of the number of b-tree operations required to \n**   finish populating the *-oal file. This allows the sqlite3_bp_progress()\n**   API to calculate the permyriadage progress of populating the *-oal file\n**   using the formula:\n**\n**     permyriadage = (10000 * nProgress) / nPhaseOneStep\n**\n**   nPhaseOneStep is initialized to the sum of:\n**\n**     nRow * (nIndex + 1)\n**\n**   for all source tables in the RBU database, where nRow is the number\n**   of rows in the source table and nIndex the number of indexes on the\n**   corresponding target database table.\n**\n**   This estimate is accurate if the RBU update consists entirely of\n**   INSERT operations. However, it is inaccurate if:\n**\n**     * the RBU update contains any UPDATE operations. If the PK specified\n**       for an UPDATE operation does not exist in the target table, then\n**       no b-tree operations are required on index b-trees. Or if the \n**       specified PK does exist, then (nIndex*2) such operations are\n**       required (one delete and one insert on each index b-tree).\n**\n**     * the RBU update contains any DELETE operations for which the specified\n**       PK does not exist. In this case no operations are required on index\n**       b-trees.\n**\n**     * the RBU update contains REPLACE operations. These are similar to\n**       UPDATE operations.\n**\n**   nPhaseOneStep is updated to account for the conditions above during the\n**   first pass of each source table. The updated nPhaseOneStep value is\n**   stored in the rbu_state table if the RBU update is suspended.\n*/\nstruct sqlite3rbu {\n  int eStage;                     /* Value of RBU_STATE_STAGE field */\n  sqlite3 *dbMain;                /* target database handle */\n  sqlite3 *dbRbu;                 /* rbu database handle */\n  char *zTarget;                  /* Path to target db */\n  char *zRbu;                     /* Path to rbu db */\n  char *zState;                   /* Path to state db (or NULL if zRbu) */\n  char zStateDb[5];               /* Db name for state (\"stat\" or \"main\") */\n  int rc;                         /* Value returned by last rbu_step() call */\n  char *zErrmsg;                  /* Error message if rc!=SQLITE_OK */\n  int nStep;                      /* Rows processed for current object */\n  int nProgress;                  /* Rows processed for all objects */\n  RbuObjIter objiter;             /* Iterator for skipping through tbl/idx */\n  const char *zVfsName;           /* Name of automatically created rbu vfs */\n  rbu_file *pTargetFd;            /* File handle open on target db */\n  i64 iOalSz;\n  i64 nPhaseOneStep;\n\n  /* The following state variables are used as part of the incremental\n  ** checkpoint stage (eStage==RBU_STAGE_CKPT). See comments surrounding\n  ** function rbuSetupCheckpoint() for details.  */\n  u32 iMaxFrame;                  /* Largest iWalFrame value in aFrame[] */\n  u32 mLock;\n  int nFrame;                     /* Entries in aFrame[] array */\n  int nFrameAlloc;                /* Allocated size of aFrame[] array */\n  RbuFrame *aFrame;\n  int pgsz;\n  u8 *aBuf;\n  i64 iWalCksum;\n\n  /* Used in RBU vacuum mode only */\n  int nRbu;                       /* Number of RBU VFS in the stack */\n  rbu_file *pRbuFd;               /* Fd for main db of dbRbu */\n};\n\n/*\n** An rbu VFS is implemented using an instance of this structure.\n*/\nstruct rbu_vfs {\n  sqlite3_vfs base;               /* rbu VFS shim methods */\n  sqlite3_vfs *pRealVfs;          /* Underlying VFS */\n  sqlite3_mutex *mutex;           /* Mutex to protect pMain */\n  rbu_file *pMain;                /* Linked list of main db files */\n};\n\n/*\n** Each file opened by an rbu VFS is represented by an instance of\n** the following structure.\n*/\nstruct rbu_file {\n  sqlite3_file base;              /* sqlite3_file methods */\n  sqlite3_file *pReal;            /* Underlying file handle */\n  rbu_vfs *pRbuVfs;               /* Pointer to the rbu_vfs object */\n  sqlite3rbu *pRbu;               /* Pointer to rbu object (rbu target only) */\n\n  int openFlags;                  /* Flags this file was opened with */\n  u32 iCookie;                    /* Cookie value for main db files */\n  u8 iWriteVer;                   /* \"write-version\" value for main db files */\n  u8 bNolock;                     /* True to fail EXCLUSIVE locks */\n\n  int nShm;                       /* Number of entries in apShm[] array */\n  char **apShm;                   /* Array of mmap'd *-shm regions */\n  char *zDel;                     /* Delete this when closing file */\n\n  const char *zWal;               /* Wal filename for this main db file */\n  rbu_file *pWalFd;               /* Wal file descriptor for this main db */\n  rbu_file *pMainNext;            /* Next MAIN_DB file */\n};\n\n/*\n** True for an RBU vacuum handle, or false otherwise.\n*/\n#define rbuIsVacuum(p) ((p)->zTarget==0)\n\n\n/*************************************************************************\n** The following three functions, found below:\n**\n**   rbuDeltaGetInt()\n**   rbuDeltaChecksum()\n**   rbuDeltaApply()\n**\n** are lifted from the fossil source code (http://fossil-scm.org). They\n** are used to implement the scalar SQL function rbu_fossil_delta().\n*/\n\n/*\n** Read bytes from *pz and convert them into a positive integer.  When\n** finished, leave *pz pointing to the first character past the end of\n** the integer.  The *pLen parameter holds the length of the string\n** in *pz and is decremented once for each character in the integer.\n*/\nstatic unsigned int rbuDeltaGetInt(const char **pz, int *pLen){\n  static const signed char zValue[] = {\n    -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, -1, -1, -1,\n    -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, -1, -1, -1,\n    -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, -1, -1, -1,\n     0,  1,  2,  3,  4,  5,  6,  7,    8,  9, -1, -1, -1, -1, -1, -1,\n    -1, 10, 11, 12, 13, 14, 15, 16,   17, 18, 19, 20, 21, 22, 23, 24,\n    25, 26, 27, 28, 29, 30, 31, 32,   33, 34, 35, -1, -1, -1, -1, 36,\n    -1, 37, 38, 39, 40, 41, 42, 43,   44, 45, 46, 47, 48, 49, 50, 51,\n    52, 53, 54, 55, 56, 57, 58, 59,   60, 61, 62, -1, -1, -1, 63, -1,\n  };\n  unsigned int v = 0;\n  int c;\n  unsigned char *z = (unsigned char*)*pz;\n  unsigned char *zStart = z;\n  while( (c = zValue[0x7f&*(z++)])>=0 ){\n     v = (v<<6) + c;\n  }\n  z--;\n  *pLen -= z - zStart;\n  *pz = (char*)z;\n  return v;\n}\n\n/*\n** Compute a 32-bit checksum on the N-byte buffer.  Return the result.\n*/\nstatic unsigned int rbuDeltaChecksum(const char *zIn, size_t N){\n  const unsigned char *z = (const unsigned char *)zIn;\n  unsigned sum0 = 0;\n  unsigned sum1 = 0;\n  unsigned sum2 = 0;\n  unsigned sum3 = 0;\n  while(N >= 16){\n    sum0 += ((unsigned)z[0] + z[4] + z[8] + z[12]);\n    sum1 += ((unsigned)z[1] + z[5] + z[9] + z[13]);\n    sum2 += ((unsigned)z[2] + z[6] + z[10]+ z[14]);\n    sum3 += ((unsigned)z[3] + z[7] + z[11]+ z[15]);\n    z += 16;\n    N -= 16;\n  }\n  while(N >= 4){\n    sum0 += z[0];\n    sum1 += z[1];\n    sum2 += z[2];\n    sum3 += z[3];\n    z += 4;\n    N -= 4;\n  }\n  sum3 += (sum2 << 8) + (sum1 << 16) + (sum0 << 24);\n  switch(N){\n    case 3:   sum3 += (z[2] << 8);\n    case 2:   sum3 += (z[1] << 16);\n    case 1:   sum3 += (z[0] << 24);\n    default:  ;\n  }\n  return sum3;\n}\n\n/*\n** Apply a delta.\n**\n** The output buffer should be big enough to hold the whole output\n** file and a NUL terminator at the end.  The delta_output_size()\n** routine will determine this size for you.\n**\n** The delta string should be null-terminated.  But the delta string\n** may contain embedded NUL characters (if the input and output are\n** binary files) so we also have to pass in the length of the delta in\n** the lenDelta parameter.\n**\n** This function returns the size of the output file in bytes (excluding\n** the final NUL terminator character).  Except, if the delta string is\n** malformed or intended for use with a source file other than zSrc,\n** then this routine returns -1.\n**\n** Refer to the delta_create() documentation above for a description\n** of the delta file format.\n*/\nstatic int rbuDeltaApply(\n  const char *zSrc,      /* The source or pattern file */\n  int lenSrc,            /* Length of the source file */\n  const char *zDelta,    /* Delta to apply to the pattern */\n  int lenDelta,          /* Length of the delta */\n  char *zOut             /* Write the output into this preallocated buffer */\n){\n  unsigned int limit;\n  unsigned int total = 0;\n#ifndef FOSSIL_OMIT_DELTA_CKSUM_TEST\n  char *zOrigOut = zOut;\n#endif\n\n  limit = rbuDeltaGetInt(&zDelta, &lenDelta);\n  if( *zDelta!='\\n' ){\n    /* ERROR: size integer not terminated by \"\\n\" */\n    return -1;\n  }\n  zDelta++; lenDelta--;\n  while( *zDelta && lenDelta>0 ){\n    unsigned int cnt, ofst;\n    cnt = rbuDeltaGetInt(&zDelta, &lenDelta);\n    switch( zDelta[0] ){\n      case '@': {\n        zDelta++; lenDelta--;\n        ofst = rbuDeltaGetInt(&zDelta, &lenDelta);\n        if( lenDelta>0 && zDelta[0]!=',' ){\n          /* ERROR: copy command not terminated by ',' */\n          return -1;\n        }\n        zDelta++; lenDelta--;\n        total += cnt;\n        if( total>limit ){\n          /* ERROR: copy exceeds output file size */\n          return -1;\n        }\n        if( (int)(ofst+cnt) > lenSrc ){\n          /* ERROR: copy extends past end of input */\n          return -1;\n        }\n        memcpy(zOut, &zSrc[ofst], cnt);\n        zOut += cnt;\n        break;\n      }\n      case ':': {\n        zDelta++; lenDelta--;\n        total += cnt;\n        if( total>limit ){\n          /* ERROR:  insert command gives an output larger than predicted */\n          return -1;\n        }\n        if( (int)cnt>lenDelta ){\n          /* ERROR: insert count exceeds size of delta */\n          return -1;\n        }\n        memcpy(zOut, zDelta, cnt);\n        zOut += cnt;\n        zDelta += cnt;\n        lenDelta -= cnt;\n        break;\n      }\n      case ';': {\n        zDelta++; lenDelta--;\n        zOut[0] = 0;\n#ifndef FOSSIL_OMIT_DELTA_CKSUM_TEST\n        if( cnt!=rbuDeltaChecksum(zOrigOut, total) ){\n          /* ERROR:  bad checksum */\n          return -1;\n        }\n#endif\n        if( total!=limit ){\n          /* ERROR: generated size does not match predicted size */\n          return -1;\n        }\n        return total;\n      }\n      default: {\n        /* ERROR: unknown delta operator */\n        return -1;\n      }\n    }\n  }\n  /* ERROR: unterminated delta */\n  return -1;\n}\n\nstatic int rbuDeltaOutputSize(const char *zDelta, int lenDelta){\n  int size;\n  size = rbuDeltaGetInt(&zDelta, &lenDelta);\n  if( *zDelta!='\\n' ){\n    /* ERROR: size integer not terminated by \"\\n\" */\n    return -1;\n  }\n  return size;\n}\n\n/*\n** End of code taken from fossil.\n*************************************************************************/\n\n/*\n** Implementation of SQL scalar function rbu_fossil_delta().\n**\n** This function applies a fossil delta patch to a blob. Exactly two\n** arguments must be passed to this function. The first is the blob to\n** patch and the second the patch to apply. If no error occurs, this\n** function returns the patched blob.\n*/\nstatic void rbuFossilDeltaFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const char *aDelta;\n  int nDelta;\n  const char *aOrig;\n  int nOrig;\n\n  int nOut;\n  int nOut2;\n  char *aOut;\n\n  assert( argc==2 );\n\n  nOrig = sqlite3_value_bytes(argv[0]);\n  aOrig = (const char*)sqlite3_value_blob(argv[0]);\n  nDelta = sqlite3_value_bytes(argv[1]);\n  aDelta = (const char*)sqlite3_value_blob(argv[1]);\n\n  /* Figure out the size of the output */\n  nOut = rbuDeltaOutputSize(aDelta, nDelta);\n  if( nOut<0 ){\n    sqlite3_result_error(context, \"corrupt fossil delta\", -1);\n    return;\n  }\n\n  aOut = sqlite3_malloc(nOut+1);\n  if( aOut==0 ){\n    sqlite3_result_error_nomem(context);\n  }else{\n    nOut2 = rbuDeltaApply(aOrig, nOrig, aDelta, nDelta, aOut);\n    if( nOut2!=nOut ){\n      sqlite3_result_error(context, \"corrupt fossil delta\", -1);\n    }else{\n      sqlite3_result_blob(context, aOut, nOut, sqlite3_free);\n    }\n  }\n}\n\n\n/*\n** Prepare the SQL statement in buffer zSql against database handle db.\n** If successful, set *ppStmt to point to the new statement and return\n** SQLITE_OK. \n**\n** Otherwise, if an error does occur, set *ppStmt to NULL and return\n** an SQLite error code. Additionally, set output variable *pzErrmsg to\n** point to a buffer containing an error message. It is the responsibility\n** of the caller to (eventually) free this buffer using sqlite3_free().\n*/\nstatic int prepareAndCollectError(\n  sqlite3 *db, \n  sqlite3_stmt **ppStmt,\n  char **pzErrmsg,\n  const char *zSql\n){\n  int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0);\n  if( rc!=SQLITE_OK ){\n    *pzErrmsg = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\n    *ppStmt = 0;\n  }\n  return rc;\n}\n\n/*\n** Reset the SQL statement passed as the first argument. Return a copy\n** of the value returned by sqlite3_reset().\n**\n** If an error has occurred, then set *pzErrmsg to point to a buffer\n** containing an error message. It is the responsibility of the caller\n** to eventually free this buffer using sqlite3_free().\n*/\nstatic int resetAndCollectError(sqlite3_stmt *pStmt, char **pzErrmsg){\n  int rc = sqlite3_reset(pStmt);\n  if( rc!=SQLITE_OK ){\n    *pzErrmsg = sqlite3_mprintf(\"%s\", sqlite3_errmsg(sqlite3_db_handle(pStmt)));\n  }\n  return rc;\n}\n\n/*\n** Unless it is NULL, argument zSql points to a buffer allocated using\n** sqlite3_malloc containing an SQL statement. This function prepares the SQL\n** statement against database db and frees the buffer. If statement \n** compilation is successful, *ppStmt is set to point to the new statement \n** handle and SQLITE_OK is returned. \n**\n** Otherwise, if an error occurs, *ppStmt is set to NULL and an error code\n** returned. In this case, *pzErrmsg may also be set to point to an error\n** message. It is the responsibility of the caller to free this error message\n** buffer using sqlite3_free().\n**\n** If argument zSql is NULL, this function assumes that an OOM has occurred.\n** In this case SQLITE_NOMEM is returned and *ppStmt set to NULL.\n*/\nstatic int prepareFreeAndCollectError(\n  sqlite3 *db, \n  sqlite3_stmt **ppStmt,\n  char **pzErrmsg,\n  char *zSql\n){\n  int rc;\n  assert( *pzErrmsg==0 );\n  if( zSql==0 ){\n    rc = SQLITE_NOMEM;\n    *ppStmt = 0;\n  }else{\n    rc = prepareAndCollectError(db, ppStmt, pzErrmsg, zSql);\n    sqlite3_free(zSql);\n  }\n  return rc;\n}\n\n/*\n** Free the RbuObjIter.azTblCol[] and RbuObjIter.abTblPk[] arrays allocated\n** by an earlier call to rbuObjIterCacheTableInfo().\n*/\nstatic void rbuObjIterFreeCols(RbuObjIter *pIter){\n  int i;\n  for(i=0; i<pIter->nTblCol; i++){\n    sqlite3_free(pIter->azTblCol[i]);\n    sqlite3_free(pIter->azTblType[i]);\n  }\n  sqlite3_free(pIter->azTblCol);\n  pIter->azTblCol = 0;\n  pIter->azTblType = 0;\n  pIter->aiSrcOrder = 0;\n  pIter->abTblPk = 0;\n  pIter->abNotNull = 0;\n  pIter->nTblCol = 0;\n  pIter->eType = 0;               /* Invalid value */\n}\n\n/*\n** Finalize all statements and free all allocations that are specific to\n** the current object (table/index pair).\n*/\nstatic void rbuObjIterClearStatements(RbuObjIter *pIter){\n  RbuUpdateStmt *pUp;\n\n  sqlite3_finalize(pIter->pSelect);\n  sqlite3_finalize(pIter->pInsert);\n  sqlite3_finalize(pIter->pDelete);\n  sqlite3_finalize(pIter->pTmpInsert);\n  pUp = pIter->pRbuUpdate;\n  while( pUp ){\n    RbuUpdateStmt *pTmp = pUp->pNext;\n    sqlite3_finalize(pUp->pUpdate);\n    sqlite3_free(pUp);\n    pUp = pTmp;\n  }\n  \n  pIter->pSelect = 0;\n  pIter->pInsert = 0;\n  pIter->pDelete = 0;\n  pIter->pRbuUpdate = 0;\n  pIter->pTmpInsert = 0;\n  pIter->nCol = 0;\n}\n\n/*\n** Clean up any resources allocated as part of the iterator object passed\n** as the only argument.\n*/\nstatic void rbuObjIterFinalize(RbuObjIter *pIter){\n  rbuObjIterClearStatements(pIter);\n  sqlite3_finalize(pIter->pTblIter);\n  sqlite3_finalize(pIter->pIdxIter);\n  rbuObjIterFreeCols(pIter);\n  memset(pIter, 0, sizeof(RbuObjIter));\n}\n\n/*\n** Advance the iterator to the next position.\n**\n** If no error occurs, SQLITE_OK is returned and the iterator is left \n** pointing to the next entry. Otherwise, an error code and message is \n** left in the RBU handle passed as the first argument. A copy of the \n** error code is returned.\n*/\nstatic int rbuObjIterNext(sqlite3rbu *p, RbuObjIter *pIter){\n  int rc = p->rc;\n  if( rc==SQLITE_OK ){\n\n    /* Free any SQLite statements used while processing the previous object */ \n    rbuObjIterClearStatements(pIter);\n    if( pIter->zIdx==0 ){\n      rc = sqlite3_exec(p->dbMain,\n          \"DROP TRIGGER IF EXISTS temp.rbu_insert_tr;\"\n          \"DROP TRIGGER IF EXISTS temp.rbu_update1_tr;\"\n          \"DROP TRIGGER IF EXISTS temp.rbu_update2_tr;\"\n          \"DROP TRIGGER IF EXISTS temp.rbu_delete_tr;\"\n          , 0, 0, &p->zErrmsg\n      );\n    }\n\n    if( rc==SQLITE_OK ){\n      if( pIter->bCleanup ){\n        rbuObjIterFreeCols(pIter);\n        pIter->bCleanup = 0;\n        rc = sqlite3_step(pIter->pTblIter);\n        if( rc!=SQLITE_ROW ){\n          rc = resetAndCollectError(pIter->pTblIter, &p->zErrmsg);\n          pIter->zTbl = 0;\n        }else{\n          pIter->zTbl = (const char*)sqlite3_column_text(pIter->pTblIter, 0);\n          pIter->zDataTbl = (const char*)sqlite3_column_text(pIter->pTblIter,1);\n          rc = (pIter->zDataTbl && pIter->zTbl) ? SQLITE_OK : SQLITE_NOMEM;\n        }\n      }else{\n        if( pIter->zIdx==0 ){\n          sqlite3_stmt *pIdx = pIter->pIdxIter;\n          rc = sqlite3_bind_text(pIdx, 1, pIter->zTbl, -1, SQLITE_STATIC);\n        }\n        if( rc==SQLITE_OK ){\n          rc = sqlite3_step(pIter->pIdxIter);\n          if( rc!=SQLITE_ROW ){\n            rc = resetAndCollectError(pIter->pIdxIter, &p->zErrmsg);\n            pIter->bCleanup = 1;\n            pIter->zIdx = 0;\n          }else{\n            pIter->zIdx = (const char*)sqlite3_column_text(pIter->pIdxIter, 0);\n            pIter->iTnum = sqlite3_column_int(pIter->pIdxIter, 1);\n            pIter->bUnique = sqlite3_column_int(pIter->pIdxIter, 2);\n            rc = pIter->zIdx ? SQLITE_OK : SQLITE_NOMEM;\n          }\n        }\n      }\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    rbuObjIterFinalize(pIter);\n    p->rc = rc;\n  }\n  return rc;\n}\n\n\n/*\n** The implementation of the rbu_target_name() SQL function. This function\n** accepts one or two arguments. The first argument is the name of a table -\n** the name of a table in the RBU database.  The second, if it is present, is 1\n** for a view or 0 for a table. \n**\n** For a non-vacuum RBU handle, if the table name matches the pattern:\n**\n**     data[0-9]_<name>\n**\n** where <name> is any sequence of 1 or more characters, <name> is returned.\n** Otherwise, if the only argument does not match the above pattern, an SQL\n** NULL is returned.\n**\n**     \"data_t1\"     -> \"t1\"\n**     \"data0123_t2\" -> \"t2\"\n**     \"dataAB_t3\"   -> NULL\n**\n** For an rbu vacuum handle, a copy of the first argument is returned if\n** the second argument is either missing or 0 (not a view).\n*/\nstatic void rbuTargetNameFunc(\n  sqlite3_context *pCtx,\n  int argc,\n  sqlite3_value **argv\n){\n  sqlite3rbu *p = sqlite3_user_data(pCtx);\n  const char *zIn;\n  assert( argc==1 || argc==2 );\n\n  zIn = (const char*)sqlite3_value_text(argv[0]);\n  if( zIn ){\n    if( rbuIsVacuum(p) ){\n      if( argc==1 || 0==sqlite3_value_int(argv[1]) ){\n        sqlite3_result_text(pCtx, zIn, -1, SQLITE_STATIC);\n      }\n    }else{\n      if( strlen(zIn)>4 && memcmp(\"data\", zIn, 4)==0 ){\n        int i;\n        for(i=4; zIn[i]>='0' && zIn[i]<='9'; i++);\n        if( zIn[i]=='_' && zIn[i+1] ){\n          sqlite3_result_text(pCtx, &zIn[i+1], -1, SQLITE_STATIC);\n        }\n      }\n    }\n  }\n}\n\n/*\n** Initialize the iterator structure passed as the second argument.\n**\n** If no error occurs, SQLITE_OK is returned and the iterator is left \n** pointing to the first entry. Otherwise, an error code and message is \n** left in the RBU handle passed as the first argument. A copy of the \n** error code is returned.\n*/\nstatic int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){\n  int rc;\n  memset(pIter, 0, sizeof(RbuObjIter));\n\n  rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, \n    sqlite3_mprintf(\n      \"SELECT rbu_target_name(name, type='view') AS target, name \"\n      \"FROM sqlite_master \"\n      \"WHERE type IN ('table', 'view') AND target IS NOT NULL \"\n      \" %s \"\n      \"ORDER BY name\"\n  , rbuIsVacuum(p) ? \"AND rootpage!=0 AND rootpage IS NOT NULL\" : \"\"));\n\n  if( rc==SQLITE_OK ){\n    rc = prepareAndCollectError(p->dbMain, &pIter->pIdxIter, &p->zErrmsg,\n        \"SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' \"\n        \"  FROM main.sqlite_master \"\n        \"  WHERE type='index' AND tbl_name = ?\"\n    );\n  }\n\n  pIter->bCleanup = 1;\n  p->rc = rc;\n  return rbuObjIterNext(p, pIter);\n}\n\n/*\n** This is a wrapper around \"sqlite3_mprintf(zFmt, ...)\". If an OOM occurs,\n** an error code is stored in the RBU handle passed as the first argument.\n**\n** If an error has already occurred (p->rc is already set to something other\n** than SQLITE_OK), then this function returns NULL without modifying the\n** stored error code. In this case it still calls sqlite3_free() on any \n** printf() parameters associated with %z conversions.\n*/\nstatic char *rbuMPrintf(sqlite3rbu *p, const char *zFmt, ...){\n  char *zSql = 0;\n  va_list ap;\n  va_start(ap, zFmt);\n  zSql = sqlite3_vmprintf(zFmt, ap);\n  if( p->rc==SQLITE_OK ){\n    if( zSql==0 ) p->rc = SQLITE_NOMEM;\n  }else{\n    sqlite3_free(zSql);\n    zSql = 0;\n  }\n  va_end(ap);\n  return zSql;\n}\n\n/*\n** Argument zFmt is a sqlite3_mprintf() style format string. The trailing\n** arguments are the usual subsitution values. This function performs\n** the printf() style substitutions and executes the result as an SQL\n** statement on the RBU handles database.\n**\n** If an error occurs, an error code and error message is stored in the\n** RBU handle. If an error has already occurred when this function is\n** called, it is a no-op.\n*/\nstatic int rbuMPrintfExec(sqlite3rbu *p, sqlite3 *db, const char *zFmt, ...){\n  va_list ap;\n  char *zSql;\n  va_start(ap, zFmt);\n  zSql = sqlite3_vmprintf(zFmt, ap);\n  if( p->rc==SQLITE_OK ){\n    if( zSql==0 ){\n      p->rc = SQLITE_NOMEM;\n    }else{\n      p->rc = sqlite3_exec(db, zSql, 0, 0, &p->zErrmsg);\n    }\n  }\n  sqlite3_free(zSql);\n  va_end(ap);\n  return p->rc;\n}\n\n/*\n** Attempt to allocate and return a pointer to a zeroed block of nByte \n** bytes. \n**\n** If an error (i.e. an OOM condition) occurs, return NULL and leave an \n** error code in the rbu handle passed as the first argument. Or, if an \n** error has already occurred when this function is called, return NULL \n** immediately without attempting the allocation or modifying the stored\n** error code.\n*/\nstatic void *rbuMalloc(sqlite3rbu *p, int nByte){\n  void *pRet = 0;\n  if( p->rc==SQLITE_OK ){\n    assert( nByte>0 );\n    pRet = sqlite3_malloc64(nByte);\n    if( pRet==0 ){\n      p->rc = SQLITE_NOMEM;\n    }else{\n      memset(pRet, 0, nByte);\n    }\n  }\n  return pRet;\n}\n\n\n/*\n** Allocate and zero the pIter->azTblCol[] and abTblPk[] arrays so that\n** there is room for at least nCol elements. If an OOM occurs, store an\n** error code in the RBU handle passed as the first argument.\n*/\nstatic void rbuAllocateIterArrays(sqlite3rbu *p, RbuObjIter *pIter, int nCol){\n  int nByte = (2*sizeof(char*) + sizeof(int) + 3*sizeof(u8)) * nCol;\n  char **azNew;\n\n  azNew = (char**)rbuMalloc(p, nByte);\n  if( azNew ){\n    pIter->azTblCol = azNew;\n    pIter->azTblType = &azNew[nCol];\n    pIter->aiSrcOrder = (int*)&pIter->azTblType[nCol];\n    pIter->abTblPk = (u8*)&pIter->aiSrcOrder[nCol];\n    pIter->abNotNull = (u8*)&pIter->abTblPk[nCol];\n    pIter->abIndexed = (u8*)&pIter->abNotNull[nCol];\n  }\n}\n\n/*\n** The first argument must be a nul-terminated string. This function\n** returns a copy of the string in memory obtained from sqlite3_malloc().\n** It is the responsibility of the caller to eventually free this memory\n** using sqlite3_free().\n**\n** If an OOM condition is encountered when attempting to allocate memory,\n** output variable (*pRc) is set to SQLITE_NOMEM before returning. Otherwise,\n** if the allocation succeeds, (*pRc) is left unchanged.\n*/\nstatic char *rbuStrndup(const char *zStr, int *pRc){\n  char *zRet = 0;\n\n  assert( *pRc==SQLITE_OK );\n  if( zStr ){\n    size_t nCopy = strlen(zStr) + 1;\n    zRet = (char*)sqlite3_malloc64(nCopy);\n    if( zRet ){\n      memcpy(zRet, zStr, nCopy);\n    }else{\n      *pRc = SQLITE_NOMEM;\n    }\n  }\n\n  return zRet;\n}\n\n/*\n** Finalize the statement passed as the second argument.\n**\n** If the sqlite3_finalize() call indicates that an error occurs, and the\n** rbu handle error code is not already set, set the error code and error\n** message accordingly.\n*/\nstatic void rbuFinalize(sqlite3rbu *p, sqlite3_stmt *pStmt){\n  sqlite3 *db = sqlite3_db_handle(pStmt);\n  int rc = sqlite3_finalize(pStmt);\n  if( p->rc==SQLITE_OK && rc!=SQLITE_OK ){\n    p->rc = rc;\n    p->zErrmsg = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\n  }\n}\n\n/* Determine the type of a table.\n**\n**   peType is of type (int*), a pointer to an output parameter of type\n**   (int). This call sets the output parameter as follows, depending\n**   on the type of the table specified by parameters dbName and zTbl.\n**\n**     RBU_PK_NOTABLE:       No such table.\n**     RBU_PK_NONE:          Table has an implicit rowid.\n**     RBU_PK_IPK:           Table has an explicit IPK column.\n**     RBU_PK_EXTERNAL:      Table has an external PK index.\n**     RBU_PK_WITHOUT_ROWID: Table is WITHOUT ROWID.\n**     RBU_PK_VTAB:          Table is a virtual table.\n**\n**   Argument *piPk is also of type (int*), and also points to an output\n**   parameter. Unless the table has an external primary key index \n**   (i.e. unless *peType is set to 3), then *piPk is set to zero. Or,\n**   if the table does have an external primary key index, then *piPk\n**   is set to the root page number of the primary key index before\n**   returning.\n**\n** ALGORITHM:\n**\n**   if( no entry exists in sqlite_master ){\n**     return RBU_PK_NOTABLE\n**   }else if( sql for the entry starts with \"CREATE VIRTUAL\" ){\n**     return RBU_PK_VTAB\n**   }else if( \"PRAGMA index_list()\" for the table contains a \"pk\" index ){\n**     if( the index that is the pk exists in sqlite_master ){\n**       *piPK = rootpage of that index.\n**       return RBU_PK_EXTERNAL\n**     }else{\n**       return RBU_PK_WITHOUT_ROWID\n**     }\n**   }else if( \"PRAGMA table_info()\" lists one or more \"pk\" columns ){\n**     return RBU_PK_IPK\n**   }else{\n**     return RBU_PK_NONE\n**   }\n*/\nstatic void rbuTableType(\n  sqlite3rbu *p,\n  const char *zTab,\n  int *peType,\n  int *piTnum,\n  int *piPk\n){\n  /*\n  ** 0) SELECT count(*) FROM sqlite_master where name=%Q AND IsVirtual(%Q)\n  ** 1) PRAGMA index_list = ?\n  ** 2) SELECT count(*) FROM sqlite_master where name=%Q \n  ** 3) PRAGMA table_info = ?\n  */\n  sqlite3_stmt *aStmt[4] = {0, 0, 0, 0};\n\n  *peType = RBU_PK_NOTABLE;\n  *piPk = 0;\n\n  assert( p->rc==SQLITE_OK );\n  p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[0], &p->zErrmsg, \n    sqlite3_mprintf(\n          \"SELECT (sql LIKE 'create virtual%%'), rootpage\"\n          \"  FROM sqlite_master\"\n          \" WHERE name=%Q\", zTab\n  ));\n  if( p->rc!=SQLITE_OK || sqlite3_step(aStmt[0])!=SQLITE_ROW ){\n    /* Either an error, or no such table. */\n    goto rbuTableType_end;\n  }\n  if( sqlite3_column_int(aStmt[0], 0) ){\n    *peType = RBU_PK_VTAB;                     /* virtual table */\n    goto rbuTableType_end;\n  }\n  *piTnum = sqlite3_column_int(aStmt[0], 1);\n\n  p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[1], &p->zErrmsg, \n    sqlite3_mprintf(\"PRAGMA index_list=%Q\",zTab)\n  );\n  if( p->rc ) goto rbuTableType_end;\n  while( sqlite3_step(aStmt[1])==SQLITE_ROW ){\n    const u8 *zOrig = sqlite3_column_text(aStmt[1], 3);\n    const u8 *zIdx = sqlite3_column_text(aStmt[1], 1);\n    if( zOrig && zIdx && zOrig[0]=='p' ){\n      p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[2], &p->zErrmsg, \n          sqlite3_mprintf(\n            \"SELECT rootpage FROM sqlite_master WHERE name = %Q\", zIdx\n      ));\n      if( p->rc==SQLITE_OK ){\n        if( sqlite3_step(aStmt[2])==SQLITE_ROW ){\n          *piPk = sqlite3_column_int(aStmt[2], 0);\n          *peType = RBU_PK_EXTERNAL;\n        }else{\n          *peType = RBU_PK_WITHOUT_ROWID;\n        }\n      }\n      goto rbuTableType_end;\n    }\n  }\n\n  p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[3], &p->zErrmsg, \n    sqlite3_mprintf(\"PRAGMA table_info=%Q\",zTab)\n  );\n  if( p->rc==SQLITE_OK ){\n    while( sqlite3_step(aStmt[3])==SQLITE_ROW ){\n      if( sqlite3_column_int(aStmt[3],5)>0 ){\n        *peType = RBU_PK_IPK;                /* explicit IPK column */\n        goto rbuTableType_end;\n      }\n    }\n    *peType = RBU_PK_NONE;\n  }\n\nrbuTableType_end: {\n    unsigned int i;\n    for(i=0; i<sizeof(aStmt)/sizeof(aStmt[0]); i++){\n      rbuFinalize(p, aStmt[i]);\n    }\n  }\n}\n\n/*\n** This is a helper function for rbuObjIterCacheTableInfo(). It populates\n** the pIter->abIndexed[] array.\n*/\nstatic void rbuObjIterCacheIndexedCols(sqlite3rbu *p, RbuObjIter *pIter){\n  sqlite3_stmt *pList = 0;\n  int bIndex = 0;\n\n  if( p->rc==SQLITE_OK ){\n    memcpy(pIter->abIndexed, pIter->abTblPk, sizeof(u8)*pIter->nTblCol);\n    p->rc = prepareFreeAndCollectError(p->dbMain, &pList, &p->zErrmsg,\n        sqlite3_mprintf(\"PRAGMA main.index_list = %Q\", pIter->zTbl)\n    );\n  }\n\n  pIter->nIndex = 0;\n  while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pList) ){\n    const char *zIdx = (const char*)sqlite3_column_text(pList, 1);\n    sqlite3_stmt *pXInfo = 0;\n    if( zIdx==0 ) break;\n    p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg,\n        sqlite3_mprintf(\"PRAGMA main.index_xinfo = %Q\", zIdx)\n    );\n    while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){\n      int iCid = sqlite3_column_int(pXInfo, 1);\n      if( iCid>=0 ) pIter->abIndexed[iCid] = 1;\n    }\n    rbuFinalize(p, pXInfo);\n    bIndex = 1;\n    pIter->nIndex++;\n  }\n\n  if( pIter->eType==RBU_PK_WITHOUT_ROWID ){\n    /* \"PRAGMA index_list\" includes the main PK b-tree */\n    pIter->nIndex--;\n  }\n\n  rbuFinalize(p, pList);\n  if( bIndex==0 ) pIter->abIndexed = 0;\n}\n\n\n/*\n** If they are not already populated, populate the pIter->azTblCol[],\n** pIter->abTblPk[], pIter->nTblCol and pIter->bRowid variables according to\n** the table (not index) that the iterator currently points to.\n**\n** Return SQLITE_OK if successful, or an SQLite error code otherwise. If\n** an error does occur, an error code and error message are also left in \n** the RBU handle.\n*/\nstatic int rbuObjIterCacheTableInfo(sqlite3rbu *p, RbuObjIter *pIter){\n  if( pIter->azTblCol==0 ){\n    sqlite3_stmt *pStmt = 0;\n    int nCol = 0;\n    int i;                        /* for() loop iterator variable */\n    int bRbuRowid = 0;            /* If input table has column \"rbu_rowid\" */\n    int iOrder = 0;\n    int iTnum = 0;\n\n    /* Figure out the type of table this step will deal with. */\n    assert( pIter->eType==0 );\n    rbuTableType(p, pIter->zTbl, &pIter->eType, &iTnum, &pIter->iPkTnum);\n    if( p->rc==SQLITE_OK && pIter->eType==RBU_PK_NOTABLE ){\n      p->rc = SQLITE_ERROR;\n      p->zErrmsg = sqlite3_mprintf(\"no such table: %s\", pIter->zTbl);\n    }\n    if( p->rc ) return p->rc;\n    if( pIter->zIdx==0 ) pIter->iTnum = iTnum;\n\n    assert( pIter->eType==RBU_PK_NONE || pIter->eType==RBU_PK_IPK \n         || pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_WITHOUT_ROWID\n         || pIter->eType==RBU_PK_VTAB\n    );\n\n    /* Populate the azTblCol[] and nTblCol variables based on the columns\n    ** of the input table. Ignore any input table columns that begin with\n    ** \"rbu_\".  */\n    p->rc = prepareFreeAndCollectError(p->dbRbu, &pStmt, &p->zErrmsg, \n        sqlite3_mprintf(\"SELECT * FROM '%q'\", pIter->zDataTbl)\n    );\n    if( p->rc==SQLITE_OK ){\n      nCol = sqlite3_column_count(pStmt);\n      rbuAllocateIterArrays(p, pIter, nCol);\n    }\n    for(i=0; p->rc==SQLITE_OK && i<nCol; i++){\n      const char *zName = (const char*)sqlite3_column_name(pStmt, i);\n      if( sqlite3_strnicmp(\"rbu_\", zName, 4) ){\n        char *zCopy = rbuStrndup(zName, &p->rc);\n        pIter->aiSrcOrder[pIter->nTblCol] = pIter->nTblCol;\n        pIter->azTblCol[pIter->nTblCol++] = zCopy;\n      }\n      else if( 0==sqlite3_stricmp(\"rbu_rowid\", zName) ){\n        bRbuRowid = 1;\n      }\n    }\n    sqlite3_finalize(pStmt);\n    pStmt = 0;\n\n    if( p->rc==SQLITE_OK\n     && rbuIsVacuum(p)==0\n     && bRbuRowid!=(pIter->eType==RBU_PK_VTAB || pIter->eType==RBU_PK_NONE)\n    ){\n      p->rc = SQLITE_ERROR;\n      p->zErrmsg = sqlite3_mprintf(\n          \"table %q %s rbu_rowid column\", pIter->zDataTbl,\n          (bRbuRowid ? \"may not have\" : \"requires\")\n      );\n    }\n\n    /* Check that all non-HIDDEN columns in the destination table are also\n    ** present in the input table. Populate the abTblPk[], azTblType[] and\n    ** aiTblOrder[] arrays at the same time.  */\n    if( p->rc==SQLITE_OK ){\n      p->rc = prepareFreeAndCollectError(p->dbMain, &pStmt, &p->zErrmsg, \n          sqlite3_mprintf(\"PRAGMA table_info(%Q)\", pIter->zTbl)\n      );\n    }\n    while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){\n      const char *zName = (const char*)sqlite3_column_text(pStmt, 1);\n      if( zName==0 ) break;  /* An OOM - finalize() below returns S_NOMEM */\n      for(i=iOrder; i<pIter->nTblCol; i++){\n        if( 0==strcmp(zName, pIter->azTblCol[i]) ) break;\n      }\n      if( i==pIter->nTblCol ){\n        p->rc = SQLITE_ERROR;\n        p->zErrmsg = sqlite3_mprintf(\"column missing from %q: %s\",\n            pIter->zDataTbl, zName\n        );\n      }else{\n        int iPk = sqlite3_column_int(pStmt, 5);\n        int bNotNull = sqlite3_column_int(pStmt, 3);\n        const char *zType = (const char*)sqlite3_column_text(pStmt, 2);\n\n        if( i!=iOrder ){\n          SWAP(int, pIter->aiSrcOrder[i], pIter->aiSrcOrder[iOrder]);\n          SWAP(char*, pIter->azTblCol[i], pIter->azTblCol[iOrder]);\n        }\n\n        pIter->azTblType[iOrder] = rbuStrndup(zType, &p->rc);\n        pIter->abTblPk[iOrder] = (iPk!=0);\n        pIter->abNotNull[iOrder] = (u8)bNotNull || (iPk!=0);\n        iOrder++;\n      }\n    }\n\n    rbuFinalize(p, pStmt);\n    rbuObjIterCacheIndexedCols(p, pIter);\n    assert( pIter->eType!=RBU_PK_VTAB || pIter->abIndexed==0 );\n    assert( pIter->eType!=RBU_PK_VTAB || pIter->nIndex==0 );\n  }\n\n  return p->rc;\n}\n\n/*\n** This function constructs and returns a pointer to a nul-terminated \n** string containing some SQL clause or list based on one or more of the \n** column names currently stored in the pIter->azTblCol[] array.\n*/\nstatic char *rbuObjIterGetCollist(\n  sqlite3rbu *p,                  /* RBU object */\n  RbuObjIter *pIter               /* Object iterator for column names */\n){\n  char *zList = 0;\n  const char *zSep = \"\";\n  int i;\n  for(i=0; i<pIter->nTblCol; i++){\n    const char *z = pIter->azTblCol[i];\n    zList = rbuMPrintf(p, \"%z%s\\\"%w\\\"\", zList, zSep, z);\n    zSep = \", \";\n  }\n  return zList;\n}\n\n/*\n** This function is used to create a SELECT list (the list of SQL \n** expressions that follows a SELECT keyword) for a SELECT statement \n** used to read from an data_xxx or rbu_tmp_xxx table while updating the \n** index object currently indicated by the iterator object passed as the \n** second argument. A \"PRAGMA index_xinfo = <idxname>\" statement is used \n** to obtain the required information.\n**\n** If the index is of the following form:\n**\n**   CREATE INDEX i1 ON t1(c, b COLLATE nocase);\n**\n** and \"t1\" is a table with an explicit INTEGER PRIMARY KEY column \n** \"ipk\", the returned string is:\n**\n**   \"`c` COLLATE 'BINARY', `b` COLLATE 'NOCASE', `ipk` COLLATE 'BINARY'\"\n**\n** As well as the returned string, three other malloc'd strings are \n** returned via output parameters. As follows:\n**\n**   pzImposterCols: ...\n**   pzImposterPk: ...\n**   pzWhere: ...\n*/\nstatic char *rbuObjIterGetIndexCols(\n  sqlite3rbu *p,                  /* RBU object */\n  RbuObjIter *pIter,              /* Object iterator for column names */\n  char **pzImposterCols,          /* OUT: Columns for imposter table */\n  char **pzImposterPk,            /* OUT: Imposter PK clause */\n  char **pzWhere,                 /* OUT: WHERE clause */\n  int *pnBind                     /* OUT: Trbul number of columns */\n){\n  int rc = p->rc;                 /* Error code */\n  int rc2;                        /* sqlite3_finalize() return code */\n  char *zRet = 0;                 /* String to return */\n  char *zImpCols = 0;             /* String to return via *pzImposterCols */\n  char *zImpPK = 0;               /* String to return via *pzImposterPK */\n  char *zWhere = 0;               /* String to return via *pzWhere */\n  int nBind = 0;                  /* Value to return via *pnBind */\n  const char *zCom = \"\";          /* Set to \", \" later on */\n  const char *zAnd = \"\";          /* Set to \" AND \" later on */\n  sqlite3_stmt *pXInfo = 0;       /* PRAGMA index_xinfo = ? */\n\n  if( rc==SQLITE_OK ){\n    assert( p->zErrmsg==0 );\n    rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg,\n        sqlite3_mprintf(\"PRAGMA main.index_xinfo = %Q\", pIter->zIdx)\n    );\n  }\n\n  while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){\n    int iCid = sqlite3_column_int(pXInfo, 1);\n    int bDesc = sqlite3_column_int(pXInfo, 3);\n    const char *zCollate = (const char*)sqlite3_column_text(pXInfo, 4);\n    const char *zCol;\n    const char *zType;\n\n    if( iCid<0 ){\n      /* An integer primary key. If the table has an explicit IPK, use\n      ** its name. Otherwise, use \"rbu_rowid\".  */\n      if( pIter->eType==RBU_PK_IPK ){\n        int i;\n        for(i=0; pIter->abTblPk[i]==0; i++);\n        assert( i<pIter->nTblCol );\n        zCol = pIter->azTblCol[i];\n      }else if( rbuIsVacuum(p) ){\n        zCol = \"_rowid_\";\n      }else{\n        zCol = \"rbu_rowid\";\n      }\n      zType = \"INTEGER\";\n    }else{\n      zCol = pIter->azTblCol[iCid];\n      zType = pIter->azTblType[iCid];\n    }\n\n    zRet = sqlite3_mprintf(\"%z%s\\\"%w\\\" COLLATE %Q\", zRet, zCom, zCol, zCollate);\n    if( pIter->bUnique==0 || sqlite3_column_int(pXInfo, 5) ){\n      const char *zOrder = (bDesc ? \" DESC\" : \"\");\n      zImpPK = sqlite3_mprintf(\"%z%s\\\"rbu_imp_%d%w\\\"%s\", \n          zImpPK, zCom, nBind, zCol, zOrder\n      );\n    }\n    zImpCols = sqlite3_mprintf(\"%z%s\\\"rbu_imp_%d%w\\\" %s COLLATE %Q\", \n        zImpCols, zCom, nBind, zCol, zType, zCollate\n    );\n    zWhere = sqlite3_mprintf(\n        \"%z%s\\\"rbu_imp_%d%w\\\" IS ?\", zWhere, zAnd, nBind, zCol\n    );\n    if( zRet==0 || zImpPK==0 || zImpCols==0 || zWhere==0 ) rc = SQLITE_NOMEM;\n    zCom = \", \";\n    zAnd = \" AND \";\n    nBind++;\n  }\n\n  rc2 = sqlite3_finalize(pXInfo);\n  if( rc==SQLITE_OK ) rc = rc2;\n\n  if( rc!=SQLITE_OK ){\n    sqlite3_free(zRet);\n    sqlite3_free(zImpCols);\n    sqlite3_free(zImpPK);\n    sqlite3_free(zWhere);\n    zRet = 0;\n    zImpCols = 0;\n    zImpPK = 0;\n    zWhere = 0;\n    p->rc = rc;\n  }\n\n  *pzImposterCols = zImpCols;\n  *pzImposterPk = zImpPK;\n  *pzWhere = zWhere;\n  *pnBind = nBind;\n  return zRet;\n}\n\n/*\n** Assuming the current table columns are \"a\", \"b\" and \"c\", and the zObj\n** paramter is passed \"old\", return a string of the form:\n**\n**     \"old.a, old.b, old.b\"\n**\n** With the column names escaped.\n**\n** For tables with implicit rowids - RBU_PK_EXTERNAL and RBU_PK_NONE, append\n** the text \", old._rowid_\" to the returned value.\n*/\nstatic char *rbuObjIterGetOldlist(\n  sqlite3rbu *p, \n  RbuObjIter *pIter,\n  const char *zObj\n){\n  char *zList = 0;\n  if( p->rc==SQLITE_OK && pIter->abIndexed ){\n    const char *zS = \"\";\n    int i;\n    for(i=0; i<pIter->nTblCol; i++){\n      if( pIter->abIndexed[i] ){\n        const char *zCol = pIter->azTblCol[i];\n        zList = sqlite3_mprintf(\"%z%s%s.\\\"%w\\\"\", zList, zS, zObj, zCol);\n      }else{\n        zList = sqlite3_mprintf(\"%z%sNULL\", zList, zS);\n      }\n      zS = \", \";\n      if( zList==0 ){\n        p->rc = SQLITE_NOMEM;\n        break;\n      }\n    }\n\n    /* For a table with implicit rowids, append \"old._rowid_\" to the list. */\n    if( pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_NONE ){\n      zList = rbuMPrintf(p, \"%z, %s._rowid_\", zList, zObj);\n    }\n  }\n  return zList;\n}\n\n/*\n** Return an expression that can be used in a WHERE clause to match the\n** primary key of the current table. For example, if the table is:\n**\n**   CREATE TABLE t1(a, b, c, PRIMARY KEY(b, c));\n**\n** Return the string:\n**\n**   \"b = ?1 AND c = ?2\"\n*/\nstatic char *rbuObjIterGetWhere(\n  sqlite3rbu *p, \n  RbuObjIter *pIter\n){\n  char *zList = 0;\n  if( pIter->eType==RBU_PK_VTAB || pIter->eType==RBU_PK_NONE ){\n    zList = rbuMPrintf(p, \"_rowid_ = ?%d\", pIter->nTblCol+1);\n  }else if( pIter->eType==RBU_PK_EXTERNAL ){\n    const char *zSep = \"\";\n    int i;\n    for(i=0; i<pIter->nTblCol; i++){\n      if( pIter->abTblPk[i] ){\n        zList = rbuMPrintf(p, \"%z%sc%d=?%d\", zList, zSep, i, i+1);\n        zSep = \" AND \";\n      }\n    }\n    zList = rbuMPrintf(p, \n        \"_rowid_ = (SELECT id FROM rbu_imposter2 WHERE %z)\", zList\n    );\n\n  }else{\n    const char *zSep = \"\";\n    int i;\n    for(i=0; i<pIter->nTblCol; i++){\n      if( pIter->abTblPk[i] ){\n        const char *zCol = pIter->azTblCol[i];\n        zList = rbuMPrintf(p, \"%z%s\\\"%w\\\"=?%d\", zList, zSep, zCol, i+1);\n        zSep = \" AND \";\n      }\n    }\n  }\n  return zList;\n}\n\n/*\n** The SELECT statement iterating through the keys for the current object\n** (p->objiter.pSelect) currently points to a valid row. However, there\n** is something wrong with the rbu_control value in the rbu_control value\n** stored in the (p->nCol+1)'th column. Set the error code and error message\n** of the RBU handle to something reflecting this.\n*/\nstatic void rbuBadControlError(sqlite3rbu *p){\n  p->rc = SQLITE_ERROR;\n  p->zErrmsg = sqlite3_mprintf(\"invalid rbu_control value\");\n}\n\n\n/*\n** Return a nul-terminated string containing the comma separated list of\n** assignments that should be included following the \"SET\" keyword of\n** an UPDATE statement used to update the table object that the iterator\n** passed as the second argument currently points to if the rbu_control\n** column of the data_xxx table entry is set to zMask.\n**\n** The memory for the returned string is obtained from sqlite3_malloc().\n** It is the responsibility of the caller to eventually free it using\n** sqlite3_free(). \n**\n** If an OOM error is encountered when allocating space for the new\n** string, an error code is left in the rbu handle passed as the first\n** argument and NULL is returned. Or, if an error has already occurred\n** when this function is called, NULL is returned immediately, without\n** attempting the allocation or modifying the stored error code.\n*/\nstatic char *rbuObjIterGetSetlist(\n  sqlite3rbu *p,\n  RbuObjIter *pIter,\n  const char *zMask\n){\n  char *zList = 0;\n  if( p->rc==SQLITE_OK ){\n    int i;\n\n    if( (int)strlen(zMask)!=pIter->nTblCol ){\n      rbuBadControlError(p);\n    }else{\n      const char *zSep = \"\";\n      for(i=0; i<pIter->nTblCol; i++){\n        char c = zMask[pIter->aiSrcOrder[i]];\n        if( c=='x' ){\n          zList = rbuMPrintf(p, \"%z%s\\\"%w\\\"=?%d\", \n              zList, zSep, pIter->azTblCol[i], i+1\n          );\n          zSep = \", \";\n        }\n        else if( c=='d' ){\n          zList = rbuMPrintf(p, \"%z%s\\\"%w\\\"=rbu_delta(\\\"%w\\\", ?%d)\", \n              zList, zSep, pIter->azTblCol[i], pIter->azTblCol[i], i+1\n          );\n          zSep = \", \";\n        }\n        else if( c=='f' ){\n          zList = rbuMPrintf(p, \"%z%s\\\"%w\\\"=rbu_fossil_delta(\\\"%w\\\", ?%d)\", \n              zList, zSep, pIter->azTblCol[i], pIter->azTblCol[i], i+1\n          );\n          zSep = \", \";\n        }\n      }\n    }\n  }\n  return zList;\n}\n\n/*\n** Return a nul-terminated string consisting of nByte comma separated\n** \"?\" expressions. For example, if nByte is 3, return a pointer to\n** a buffer containing the string \"?,?,?\".\n**\n** The memory for the returned string is obtained from sqlite3_malloc().\n** It is the responsibility of the caller to eventually free it using\n** sqlite3_free(). \n**\n** If an OOM error is encountered when allocating space for the new\n** string, an error code is left in the rbu handle passed as the first\n** argument and NULL is returned. Or, if an error has already occurred\n** when this function is called, NULL is returned immediately, without\n** attempting the allocation or modifying the stored error code.\n*/\nstatic char *rbuObjIterGetBindlist(sqlite3rbu *p, int nBind){\n  char *zRet = 0;\n  int nByte = nBind*2 + 1;\n\n  zRet = (char*)rbuMalloc(p, nByte);\n  if( zRet ){\n    int i;\n    for(i=0; i<nBind; i++){\n      zRet[i*2] = '?';\n      zRet[i*2+1] = (i+1==nBind) ? '\\0' : ',';\n    }\n  }\n  return zRet;\n}\n\n/*\n** The iterator currently points to a table (not index) of type \n** RBU_PK_WITHOUT_ROWID. This function creates the PRIMARY KEY \n** declaration for the corresponding imposter table. For example,\n** if the iterator points to a table created as:\n**\n**   CREATE TABLE t1(a, b, c, PRIMARY KEY(b, a DESC)) WITHOUT ROWID\n**\n** this function returns:\n**\n**   PRIMARY KEY(\"b\", \"a\" DESC)\n*/\nstatic char *rbuWithoutRowidPK(sqlite3rbu *p, RbuObjIter *pIter){\n  char *z = 0;\n  assert( pIter->zIdx==0 );\n  if( p->rc==SQLITE_OK ){\n    const char *zSep = \"PRIMARY KEY(\";\n    sqlite3_stmt *pXList = 0;     /* PRAGMA index_list = (pIter->zTbl) */\n    sqlite3_stmt *pXInfo = 0;     /* PRAGMA index_xinfo = <pk-index> */\n   \n    p->rc = prepareFreeAndCollectError(p->dbMain, &pXList, &p->zErrmsg,\n        sqlite3_mprintf(\"PRAGMA main.index_list = %Q\", pIter->zTbl)\n    );\n    while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXList) ){\n      const char *zOrig = (const char*)sqlite3_column_text(pXList,3);\n      if( zOrig && strcmp(zOrig, \"pk\")==0 ){\n        const char *zIdx = (const char*)sqlite3_column_text(pXList,1);\n        if( zIdx ){\n          p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg,\n              sqlite3_mprintf(\"PRAGMA main.index_xinfo = %Q\", zIdx)\n          );\n        }\n        break;\n      }\n    }\n    rbuFinalize(p, pXList);\n\n    while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){\n      if( sqlite3_column_int(pXInfo, 5) ){\n        /* int iCid = sqlite3_column_int(pXInfo, 0); */\n        const char *zCol = (const char*)sqlite3_column_text(pXInfo, 2);\n        const char *zDesc = sqlite3_column_int(pXInfo, 3) ? \" DESC\" : \"\";\n        z = rbuMPrintf(p, \"%z%s\\\"%w\\\"%s\", z, zSep, zCol, zDesc);\n        zSep = \", \";\n      }\n    }\n    z = rbuMPrintf(p, \"%z)\", z);\n    rbuFinalize(p, pXInfo);\n  }\n  return z;\n}\n\n/*\n** This function creates the second imposter table used when writing to\n** a table b-tree where the table has an external primary key. If the\n** iterator passed as the second argument does not currently point to\n** a table (not index) with an external primary key, this function is a\n** no-op. \n**\n** Assuming the iterator does point to a table with an external PK, this\n** function creates a WITHOUT ROWID imposter table named \"rbu_imposter2\"\n** used to access that PK index. For example, if the target table is\n** declared as follows:\n**\n**   CREATE TABLE t1(a, b TEXT, c REAL, PRIMARY KEY(b, c));\n**\n** then the imposter table schema is:\n**\n**   CREATE TABLE rbu_imposter2(c1 TEXT, c2 REAL, id INTEGER) WITHOUT ROWID;\n**\n*/\nstatic void rbuCreateImposterTable2(sqlite3rbu *p, RbuObjIter *pIter){\n  if( p->rc==SQLITE_OK && pIter->eType==RBU_PK_EXTERNAL ){\n    int tnum = pIter->iPkTnum;    /* Root page of PK index */\n    sqlite3_stmt *pQuery = 0;     /* SELECT name ... WHERE rootpage = $tnum */\n    const char *zIdx = 0;         /* Name of PK index */\n    sqlite3_stmt *pXInfo = 0;     /* PRAGMA main.index_xinfo = $zIdx */\n    const char *zComma = \"\";\n    char *zCols = 0;              /* Used to build up list of table cols */\n    char *zPk = 0;                /* Used to build up table PK declaration */\n\n    /* Figure out the name of the primary key index for the current table.\n    ** This is needed for the argument to \"PRAGMA index_xinfo\". Set\n    ** zIdx to point to a nul-terminated string containing this name. */\n    p->rc = prepareAndCollectError(p->dbMain, &pQuery, &p->zErrmsg, \n        \"SELECT name FROM sqlite_master WHERE rootpage = ?\"\n    );\n    if( p->rc==SQLITE_OK ){\n      sqlite3_bind_int(pQuery, 1, tnum);\n      if( SQLITE_ROW==sqlite3_step(pQuery) ){\n        zIdx = (const char*)sqlite3_column_text(pQuery, 0);\n      }\n    }\n    if( zIdx ){\n      p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg,\n          sqlite3_mprintf(\"PRAGMA main.index_xinfo = %Q\", zIdx)\n      );\n    }\n    rbuFinalize(p, pQuery);\n\n    while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){\n      int bKey = sqlite3_column_int(pXInfo, 5);\n      if( bKey ){\n        int iCid = sqlite3_column_int(pXInfo, 1);\n        int bDesc = sqlite3_column_int(pXInfo, 3);\n        const char *zCollate = (const char*)sqlite3_column_text(pXInfo, 4);\n        zCols = rbuMPrintf(p, \"%z%sc%d %s COLLATE %s\", zCols, zComma, \n            iCid, pIter->azTblType[iCid], zCollate\n        );\n        zPk = rbuMPrintf(p, \"%z%sc%d%s\", zPk, zComma, iCid, bDesc?\" DESC\":\"\");\n        zComma = \", \";\n      }\n    }\n    zCols = rbuMPrintf(p, \"%z, id INTEGER\", zCols);\n    rbuFinalize(p, pXInfo);\n\n    sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 1, tnum);\n    rbuMPrintfExec(p, p->dbMain,\n        \"CREATE TABLE rbu_imposter2(%z, PRIMARY KEY(%z)) WITHOUT ROWID\", \n        zCols, zPk\n    );\n    sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 0, 0);\n  }\n}\n\n/*\n** If an error has already occurred when this function is called, it \n** immediately returns zero (without doing any work). Or, if an error\n** occurs during the execution of this function, it sets the error code\n** in the sqlite3rbu object indicated by the first argument and returns\n** zero.\n**\n** The iterator passed as the second argument is guaranteed to point to\n** a table (not an index) when this function is called. This function\n** attempts to create any imposter table required to write to the main\n** table b-tree of the table before returning. Non-zero is returned if\n** an imposter table are created, or zero otherwise.\n**\n** An imposter table is required in all cases except RBU_PK_VTAB. Only\n** virtual tables are written to directly. The imposter table has the \n** same schema as the actual target table (less any UNIQUE constraints). \n** More precisely, the \"same schema\" means the same columns, types, \n** collation sequences. For tables that do not have an external PRIMARY\n** KEY, it also means the same PRIMARY KEY declaration.\n*/\nstatic void rbuCreateImposterTable(sqlite3rbu *p, RbuObjIter *pIter){\n  if( p->rc==SQLITE_OK && pIter->eType!=RBU_PK_VTAB ){\n    int tnum = pIter->iTnum;\n    const char *zComma = \"\";\n    char *zSql = 0;\n    int iCol;\n    sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 0, 1);\n\n    for(iCol=0; p->rc==SQLITE_OK && iCol<pIter->nTblCol; iCol++){\n      const char *zPk = \"\";\n      const char *zCol = pIter->azTblCol[iCol];\n      const char *zColl = 0;\n\n      p->rc = sqlite3_table_column_metadata(\n          p->dbMain, \"main\", pIter->zTbl, zCol, 0, &zColl, 0, 0, 0\n      );\n\n      if( pIter->eType==RBU_PK_IPK && pIter->abTblPk[iCol] ){\n        /* If the target table column is an \"INTEGER PRIMARY KEY\", add\n        ** \"PRIMARY KEY\" to the imposter table column declaration. */\n        zPk = \"PRIMARY KEY \";\n      }\n      zSql = rbuMPrintf(p, \"%z%s\\\"%w\\\" %s %sCOLLATE %s%s\", \n          zSql, zComma, zCol, pIter->azTblType[iCol], zPk, zColl,\n          (pIter->abNotNull[iCol] ? \" NOT NULL\" : \"\")\n      );\n      zComma = \", \";\n    }\n\n    if( pIter->eType==RBU_PK_WITHOUT_ROWID ){\n      char *zPk = rbuWithoutRowidPK(p, pIter);\n      if( zPk ){\n        zSql = rbuMPrintf(p, \"%z, %z\", zSql, zPk);\n      }\n    }\n\n    sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 1, tnum);\n    rbuMPrintfExec(p, p->dbMain, \"CREATE TABLE \\\"rbu_imp_%w\\\"(%z)%s\", \n        pIter->zTbl, zSql, \n        (pIter->eType==RBU_PK_WITHOUT_ROWID ? \" WITHOUT ROWID\" : \"\")\n    );\n    sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 0, 0);\n  }\n}\n\n/*\n** Prepare a statement used to insert rows into the \"rbu_tmp_xxx\" table.\n** Specifically a statement of the form:\n**\n**     INSERT INTO rbu_tmp_xxx VALUES(?, ?, ? ...);\n**\n** The number of bound variables is equal to the number of columns in\n** the target table, plus one (for the rbu_control column), plus one more \n** (for the rbu_rowid column) if the target table is an implicit IPK or \n** virtual table.\n*/\nstatic void rbuObjIterPrepareTmpInsert(\n  sqlite3rbu *p, \n  RbuObjIter *pIter,\n  const char *zCollist,\n  const char *zRbuRowid\n){\n  int bRbuRowid = (pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_NONE);\n  char *zBind = rbuObjIterGetBindlist(p, pIter->nTblCol + 1 + bRbuRowid);\n  if( zBind ){\n    assert( pIter->pTmpInsert==0 );\n    p->rc = prepareFreeAndCollectError(\n        p->dbRbu, &pIter->pTmpInsert, &p->zErrmsg, sqlite3_mprintf(\n          \"INSERT INTO %s.'rbu_tmp_%q'(rbu_control,%s%s) VALUES(%z)\", \n          p->zStateDb, pIter->zDataTbl, zCollist, zRbuRowid, zBind\n    ));\n  }\n}\n\nstatic void rbuTmpInsertFunc(\n  sqlite3_context *pCtx, \n  int nVal,\n  sqlite3_value **apVal\n){\n  sqlite3rbu *p = sqlite3_user_data(pCtx);\n  int rc = SQLITE_OK;\n  int i;\n\n  assert( sqlite3_value_int(apVal[0])!=0\n      || p->objiter.eType==RBU_PK_EXTERNAL \n      || p->objiter.eType==RBU_PK_NONE \n  );\n  if( sqlite3_value_int(apVal[0])!=0 ){\n    p->nPhaseOneStep += p->objiter.nIndex;\n  }\n\n  for(i=0; rc==SQLITE_OK && i<nVal; i++){\n    rc = sqlite3_bind_value(p->objiter.pTmpInsert, i+1, apVal[i]);\n  }\n  if( rc==SQLITE_OK ){\n    sqlite3_step(p->objiter.pTmpInsert);\n    rc = sqlite3_reset(p->objiter.pTmpInsert);\n  }\n\n  if( rc!=SQLITE_OK ){\n    sqlite3_result_error_code(pCtx, rc);\n  }\n}\n\n/*\n** Ensure that the SQLite statement handles required to update the \n** target database object currently indicated by the iterator passed \n** as the second argument are available.\n*/\nstatic int rbuObjIterPrepareAll(\n  sqlite3rbu *p, \n  RbuObjIter *pIter,\n  int nOffset                     /* Add \"LIMIT -1 OFFSET $nOffset\" to SELECT */\n){\n  assert( pIter->bCleanup==0 );\n  if( pIter->pSelect==0 && rbuObjIterCacheTableInfo(p, pIter)==SQLITE_OK ){\n    const int tnum = pIter->iTnum;\n    char *zCollist = 0;           /* List of indexed columns */\n    char **pz = &p->zErrmsg;\n    const char *zIdx = pIter->zIdx;\n    char *zLimit = 0;\n\n    if( nOffset ){\n      zLimit = sqlite3_mprintf(\" LIMIT -1 OFFSET %d\", nOffset);\n      if( !zLimit ) p->rc = SQLITE_NOMEM;\n    }\n\n    if( zIdx ){\n      const char *zTbl = pIter->zTbl;\n      char *zImposterCols = 0;    /* Columns for imposter table */\n      char *zImposterPK = 0;      /* Primary key declaration for imposter */\n      char *zWhere = 0;           /* WHERE clause on PK columns */\n      char *zBind = 0;\n      int nBind = 0;\n\n      assert( pIter->eType!=RBU_PK_VTAB );\n      zCollist = rbuObjIterGetIndexCols(\n          p, pIter, &zImposterCols, &zImposterPK, &zWhere, &nBind\n      );\n      zBind = rbuObjIterGetBindlist(p, nBind);\n\n      /* Create the imposter table used to write to this index. */\n      sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 0, 1);\n      sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 1,tnum);\n      rbuMPrintfExec(p, p->dbMain,\n          \"CREATE TABLE \\\"rbu_imp_%w\\\"( %s, PRIMARY KEY( %s ) ) WITHOUT ROWID\",\n          zTbl, zImposterCols, zImposterPK\n      );\n      sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->dbMain, \"main\", 0, 0);\n\n      /* Create the statement to insert index entries */\n      pIter->nCol = nBind;\n      if( p->rc==SQLITE_OK ){\n        p->rc = prepareFreeAndCollectError(\n            p->dbMain, &pIter->pInsert, &p->zErrmsg,\n          sqlite3_mprintf(\"INSERT INTO \\\"rbu_imp_%w\\\" VALUES(%s)\", zTbl, zBind)\n        );\n      }\n\n      /* And to delete index entries */\n      if( rbuIsVacuum(p)==0 && p->rc==SQLITE_OK ){\n        p->rc = prepareFreeAndCollectError(\n            p->dbMain, &pIter->pDelete, &p->zErrmsg,\n          sqlite3_mprintf(\"DELETE FROM \\\"rbu_imp_%w\\\" WHERE %s\", zTbl, zWhere)\n        );\n      }\n\n      /* Create the SELECT statement to read keys in sorted order */\n      if( p->rc==SQLITE_OK ){\n        char *zSql;\n        if( rbuIsVacuum(p) ){\n          zSql = sqlite3_mprintf(\n              \"SELECT %s, 0 AS rbu_control FROM '%q' ORDER BY %s%s\",\n              zCollist, \n              pIter->zDataTbl,\n              zCollist, zLimit\n          );\n        }else\n\n        if( pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_NONE ){\n          zSql = sqlite3_mprintf(\n              \"SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' ORDER BY %s%s\",\n              zCollist, p->zStateDb, pIter->zDataTbl,\n              zCollist, zLimit\n          );\n        }else{\n          zSql = sqlite3_mprintf(\n              \"SELECT %s, rbu_control FROM %s.'rbu_tmp_%q' \"\n              \"UNION ALL \"\n              \"SELECT %s, rbu_control FROM '%q' \"\n              \"WHERE typeof(rbu_control)='integer' AND rbu_control!=1 \"\n              \"ORDER BY %s%s\",\n              zCollist, p->zStateDb, pIter->zDataTbl, \n              zCollist, pIter->zDataTbl, \n              zCollist, zLimit\n          );\n        }\n        p->rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pSelect, pz, zSql);\n      }\n\n      sqlite3_free(zImposterCols);\n      sqlite3_free(zImposterPK);\n      sqlite3_free(zWhere);\n      sqlite3_free(zBind);\n    }else{\n      int bRbuRowid = (pIter->eType==RBU_PK_VTAB)\n                    ||(pIter->eType==RBU_PK_NONE)\n                    ||(pIter->eType==RBU_PK_EXTERNAL && rbuIsVacuum(p));\n      const char *zTbl = pIter->zTbl;       /* Table this step applies to */\n      const char *zWrite;                   /* Imposter table name */\n\n      char *zBindings = rbuObjIterGetBindlist(p, pIter->nTblCol + bRbuRowid);\n      char *zWhere = rbuObjIterGetWhere(p, pIter);\n      char *zOldlist = rbuObjIterGetOldlist(p, pIter, \"old\");\n      char *zNewlist = rbuObjIterGetOldlist(p, pIter, \"new\");\n\n      zCollist = rbuObjIterGetCollist(p, pIter);\n      pIter->nCol = pIter->nTblCol;\n\n      /* Create the imposter table or tables (if required). */\n      rbuCreateImposterTable(p, pIter);\n      rbuCreateImposterTable2(p, pIter);\n      zWrite = (pIter->eType==RBU_PK_VTAB ? \"\" : \"rbu_imp_\");\n\n      /* Create the INSERT statement to write to the target PK b-tree */\n      if( p->rc==SQLITE_OK ){\n        p->rc = prepareFreeAndCollectError(p->dbMain, &pIter->pInsert, pz,\n            sqlite3_mprintf(\n              \"INSERT INTO \\\"%s%w\\\"(%s%s) VALUES(%s)\", \n              zWrite, zTbl, zCollist, (bRbuRowid ? \", _rowid_\" : \"\"), zBindings\n            )\n        );\n      }\n\n      /* Create the DELETE statement to write to the target PK b-tree.\n      ** Because it only performs INSERT operations, this is not required for\n      ** an rbu vacuum handle.  */\n      if( rbuIsVacuum(p)==0 && p->rc==SQLITE_OK ){\n        p->rc = prepareFreeAndCollectError(p->dbMain, &pIter->pDelete, pz,\n            sqlite3_mprintf(\n              \"DELETE FROM \\\"%s%w\\\" WHERE %s\", zWrite, zTbl, zWhere\n            )\n        );\n      }\n\n      if( rbuIsVacuum(p)==0 && pIter->abIndexed ){\n        const char *zRbuRowid = \"\";\n        if( pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_NONE ){\n          zRbuRowid = \", rbu_rowid\";\n        }\n\n        /* Create the rbu_tmp_xxx table and the triggers to populate it. */\n        rbuMPrintfExec(p, p->dbRbu,\n            \"CREATE TABLE IF NOT EXISTS %s.'rbu_tmp_%q' AS \"\n            \"SELECT *%s FROM '%q' WHERE 0;\"\n            , p->zStateDb, pIter->zDataTbl\n            , (pIter->eType==RBU_PK_EXTERNAL ? \", 0 AS rbu_rowid\" : \"\")\n            , pIter->zDataTbl\n        );\n\n        rbuMPrintfExec(p, p->dbMain,\n            \"CREATE TEMP TRIGGER rbu_delete_tr BEFORE DELETE ON \\\"%s%w\\\" \"\n            \"BEGIN \"\n            \"  SELECT rbu_tmp_insert(3, %s);\"\n            \"END;\"\n\n            \"CREATE TEMP TRIGGER rbu_update1_tr BEFORE UPDATE ON \\\"%s%w\\\" \"\n            \"BEGIN \"\n            \"  SELECT rbu_tmp_insert(3, %s);\"\n            \"END;\"\n\n            \"CREATE TEMP TRIGGER rbu_update2_tr AFTER UPDATE ON \\\"%s%w\\\" \"\n            \"BEGIN \"\n            \"  SELECT rbu_tmp_insert(4, %s);\"\n            \"END;\",\n            zWrite, zTbl, zOldlist,\n            zWrite, zTbl, zOldlist,\n            zWrite, zTbl, zNewlist\n        );\n\n        if( pIter->eType==RBU_PK_EXTERNAL || pIter->eType==RBU_PK_NONE ){\n          rbuMPrintfExec(p, p->dbMain,\n              \"CREATE TEMP TRIGGER rbu_insert_tr AFTER INSERT ON \\\"%s%w\\\" \"\n              \"BEGIN \"\n              \"  SELECT rbu_tmp_insert(0, %s);\"\n              \"END;\",\n              zWrite, zTbl, zNewlist\n          );\n        }\n\n        rbuObjIterPrepareTmpInsert(p, pIter, zCollist, zRbuRowid);\n      }\n\n      /* Create the SELECT statement to read keys from data_xxx */\n      if( p->rc==SQLITE_OK ){\n        const char *zRbuRowid = \"\";\n        if( bRbuRowid ){\n          zRbuRowid = rbuIsVacuum(p) ? \",_rowid_ \" : \",rbu_rowid\";\n        }\n        p->rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pSelect, pz,\n            sqlite3_mprintf(\n              \"SELECT %s,%s rbu_control%s FROM '%q'%s\", \n              zCollist, \n              (rbuIsVacuum(p) ? \"0 AS \" : \"\"),\n              zRbuRowid,\n              pIter->zDataTbl, zLimit\n            )\n        );\n      }\n\n      sqlite3_free(zWhere);\n      sqlite3_free(zOldlist);\n      sqlite3_free(zNewlist);\n      sqlite3_free(zBindings);\n    }\n    sqlite3_free(zCollist);\n    sqlite3_free(zLimit);\n  }\n  \n  return p->rc;\n}\n\n/*\n** Set output variable *ppStmt to point to an UPDATE statement that may\n** be used to update the imposter table for the main table b-tree of the\n** table object that pIter currently points to, assuming that the \n** rbu_control column of the data_xyz table contains zMask.\n** \n** If the zMask string does not specify any columns to update, then this\n** is not an error. Output variable *ppStmt is set to NULL in this case.\n*/\nstatic int rbuGetUpdateStmt(\n  sqlite3rbu *p,                  /* RBU handle */\n  RbuObjIter *pIter,              /* Object iterator */\n  const char *zMask,              /* rbu_control value ('x.x.') */\n  sqlite3_stmt **ppStmt           /* OUT: UPDATE statement handle */\n){\n  RbuUpdateStmt **pp;\n  RbuUpdateStmt *pUp = 0;\n  int nUp = 0;\n\n  /* In case an error occurs */\n  *ppStmt = 0;\n\n  /* Search for an existing statement. If one is found, shift it to the front\n  ** of the LRU queue and return immediately. Otherwise, leave nUp pointing\n  ** to the number of statements currently in the cache and pUp to the\n  ** last object in the list.  */\n  for(pp=&pIter->pRbuUpdate; *pp; pp=&((*pp)->pNext)){\n    pUp = *pp;\n    if( strcmp(pUp->zMask, zMask)==0 ){\n      *pp = pUp->pNext;\n      pUp->pNext = pIter->pRbuUpdate;\n      pIter->pRbuUpdate = pUp;\n      *ppStmt = pUp->pUpdate; \n      return SQLITE_OK;\n    }\n    nUp++;\n  }\n  assert( pUp==0 || pUp->pNext==0 );\n\n  if( nUp>=SQLITE_RBU_UPDATE_CACHESIZE ){\n    for(pp=&pIter->pRbuUpdate; *pp!=pUp; pp=&((*pp)->pNext));\n    *pp = 0;\n    sqlite3_finalize(pUp->pUpdate);\n    pUp->pUpdate = 0;\n  }else{\n    pUp = (RbuUpdateStmt*)rbuMalloc(p, sizeof(RbuUpdateStmt)+pIter->nTblCol+1);\n  }\n\n  if( pUp ){\n    char *zWhere = rbuObjIterGetWhere(p, pIter);\n    char *zSet = rbuObjIterGetSetlist(p, pIter, zMask);\n    char *zUpdate = 0;\n\n    pUp->zMask = (char*)&pUp[1];\n    memcpy(pUp->zMask, zMask, pIter->nTblCol);\n    pUp->pNext = pIter->pRbuUpdate;\n    pIter->pRbuUpdate = pUp;\n\n    if( zSet ){\n      const char *zPrefix = \"\";\n\n      if( pIter->eType!=RBU_PK_VTAB ) zPrefix = \"rbu_imp_\";\n      zUpdate = sqlite3_mprintf(\"UPDATE \\\"%s%w\\\" SET %s WHERE %s\", \n          zPrefix, pIter->zTbl, zSet, zWhere\n      );\n      p->rc = prepareFreeAndCollectError(\n          p->dbMain, &pUp->pUpdate, &p->zErrmsg, zUpdate\n      );\n      *ppStmt = pUp->pUpdate;\n    }\n    sqlite3_free(zWhere);\n    sqlite3_free(zSet);\n  }\n\n  return p->rc;\n}\n\nstatic sqlite3 *rbuOpenDbhandle(\n  sqlite3rbu *p, \n  const char *zName, \n  int bUseVfs\n){\n  sqlite3 *db = 0;\n  if( p->rc==SQLITE_OK ){\n    const int flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_URI;\n    p->rc = sqlite3_open_v2(zName, &db, flags, bUseVfs ? p->zVfsName : 0);\n    if( p->rc ){\n      p->zErrmsg = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\n      sqlite3_close(db);\n      db = 0;\n    }\n  }\n  return db;\n}\n\n/*\n** Free an RbuState object allocated by rbuLoadState().\n*/\nstatic void rbuFreeState(RbuState *p){\n  if( p ){\n    sqlite3_free(p->zTbl);\n    sqlite3_free(p->zIdx);\n    sqlite3_free(p);\n  }\n}\n\n/*\n** Allocate an RbuState object and load the contents of the rbu_state \n** table into it. Return a pointer to the new object. It is the \n** responsibility of the caller to eventually free the object using\n** sqlite3_free().\n**\n** If an error occurs, leave an error code and message in the rbu handle\n** and return NULL.\n*/\nstatic RbuState *rbuLoadState(sqlite3rbu *p){\n  RbuState *pRet = 0;\n  sqlite3_stmt *pStmt = 0;\n  int rc;\n  int rc2;\n\n  pRet = (RbuState*)rbuMalloc(p, sizeof(RbuState));\n  if( pRet==0 ) return 0;\n\n  rc = prepareFreeAndCollectError(p->dbRbu, &pStmt, &p->zErrmsg, \n      sqlite3_mprintf(\"SELECT k, v FROM %s.rbu_state\", p->zStateDb)\n  );\n  while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){\n    switch( sqlite3_column_int(pStmt, 0) ){\n      case RBU_STATE_STAGE:\n        pRet->eStage = sqlite3_column_int(pStmt, 1);\n        if( pRet->eStage!=RBU_STAGE_OAL\n         && pRet->eStage!=RBU_STAGE_MOVE\n         && pRet->eStage!=RBU_STAGE_CKPT\n        ){\n          p->rc = SQLITE_CORRUPT;\n        }\n        break;\n\n      case RBU_STATE_TBL:\n        pRet->zTbl = rbuStrndup((char*)sqlite3_column_text(pStmt, 1), &rc);\n        break;\n\n      case RBU_STATE_IDX:\n        pRet->zIdx = rbuStrndup((char*)sqlite3_column_text(pStmt, 1), &rc);\n        break;\n\n      case RBU_STATE_ROW:\n        pRet->nRow = sqlite3_column_int(pStmt, 1);\n        break;\n\n      case RBU_STATE_PROGRESS:\n        pRet->nProgress = sqlite3_column_int64(pStmt, 1);\n        break;\n\n      case RBU_STATE_CKPT:\n        pRet->iWalCksum = sqlite3_column_int64(pStmt, 1);\n        break;\n\n      case RBU_STATE_COOKIE:\n        pRet->iCookie = (u32)sqlite3_column_int64(pStmt, 1);\n        break;\n\n      case RBU_STATE_OALSZ:\n        pRet->iOalSz = (u32)sqlite3_column_int64(pStmt, 1);\n        break;\n\n      case RBU_STATE_PHASEONESTEP:\n        pRet->nPhaseOneStep = sqlite3_column_int64(pStmt, 1);\n        break;\n\n      default:\n        rc = SQLITE_CORRUPT;\n        break;\n    }\n  }\n  rc2 = sqlite3_finalize(pStmt);\n  if( rc==SQLITE_OK ) rc = rc2;\n\n  p->rc = rc;\n  return pRet;\n}\n\n\n/*\n** Open the database handle and attach the RBU database as \"rbu\". If an\n** error occurs, leave an error code and message in the RBU handle.\n*/\nstatic void rbuOpenDatabase(sqlite3rbu *p){\n  assert( p->rc || (p->dbMain==0 && p->dbRbu==0) );\n  assert( p->rc || rbuIsVacuum(p) || p->zTarget!=0 );\n\n  /* Open the RBU database */\n  p->dbRbu = rbuOpenDbhandle(p, p->zRbu, 1);\n\n  if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){\n    sqlite3_file_control(p->dbRbu, \"main\", SQLITE_FCNTL_RBUCNT, (void*)p);\n    if( p->zState==0 ){\n      const char *zFile = sqlite3_db_filename(p->dbRbu, \"main\");\n      p->zState = rbuMPrintf(p, \"file://%s-vacuum?modeof=%s\", zFile, zFile);\n    }\n  }\n\n  /* If using separate RBU and state databases, attach the state database to\n  ** the RBU db handle now.  */\n  if( p->zState ){\n    rbuMPrintfExec(p, p->dbRbu, \"ATTACH %Q AS stat\", p->zState);\n    memcpy(p->zStateDb, \"stat\", 4);\n  }else{\n    memcpy(p->zStateDb, \"main\", 4);\n  }\n\n#if 0\n  if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){\n    p->rc = sqlite3_exec(p->dbRbu, \"BEGIN\", 0, 0, 0);\n  }\n#endif\n\n  /* If it has not already been created, create the rbu_state table */\n  rbuMPrintfExec(p, p->dbRbu, RBU_CREATE_STATE, p->zStateDb);\n\n#if 0\n  if( rbuIsVacuum(p) ){\n    if( p->rc==SQLITE_OK ){\n      int rc2;\n      int bOk = 0;\n      sqlite3_stmt *pCnt = 0;\n      p->rc = prepareAndCollectError(p->dbRbu, &pCnt, &p->zErrmsg,\n          \"SELECT count(*) FROM stat.sqlite_master\"\n      );\n      if( p->rc==SQLITE_OK \n       && sqlite3_step(pCnt)==SQLITE_ROW\n       && 1==sqlite3_column_int(pCnt, 0)\n      ){\n        bOk = 1;\n      }\n      rc2 = sqlite3_finalize(pCnt);\n      if( p->rc==SQLITE_OK ) p->rc = rc2;\n\n      if( p->rc==SQLITE_OK && bOk==0 ){\n        p->rc = SQLITE_ERROR;\n        p->zErrmsg = sqlite3_mprintf(\"invalid state database\");\n      }\n    \n      if( p->rc==SQLITE_OK ){\n        p->rc = sqlite3_exec(p->dbRbu, \"COMMIT\", 0, 0, 0);\n      }\n    }\n  }\n#endif\n\n  if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){\n    int bOpen = 0;\n    int rc;\n    p->nRbu = 0;\n    p->pRbuFd = 0;\n    rc = sqlite3_file_control(p->dbRbu, \"main\", SQLITE_FCNTL_RBUCNT, (void*)p);\n    if( rc!=SQLITE_NOTFOUND ) p->rc = rc;\n    if( p->eStage>=RBU_STAGE_MOVE ){\n      bOpen = 1;\n    }else{\n      RbuState *pState = rbuLoadState(p);\n      if( pState ){\n        bOpen = (pState->eStage>RBU_STAGE_MOVE);\n        rbuFreeState(pState);\n      }\n    }\n    if( bOpen ) p->dbMain = rbuOpenDbhandle(p, p->zRbu, p->nRbu<=1);\n  }\n\n  p->eStage = 0;\n  if( p->rc==SQLITE_OK && p->dbMain==0 ){\n    if( !rbuIsVacuum(p) ){\n      p->dbMain = rbuOpenDbhandle(p, p->zTarget, 1);\n    }else if( p->pRbuFd->pWalFd ){\n      p->rc = SQLITE_ERROR;\n      p->zErrmsg = sqlite3_mprintf(\"cannot vacuum wal mode database\");\n    }else{\n      char *zTarget;\n      char *zExtra = 0;\n      if( strlen(p->zRbu)>=5 && 0==memcmp(\"file:\", p->zRbu, 5) ){\n        zExtra = &p->zRbu[5];\n        while( *zExtra ){\n          if( *zExtra++=='?' ) break;\n        }\n        if( *zExtra=='\\0' ) zExtra = 0;\n      }\n\n      zTarget = sqlite3_mprintf(\"file:%s-vacuum?rbu_memory=1%s%s\", \n          sqlite3_db_filename(p->dbRbu, \"main\"),\n          (zExtra==0 ? \"\" : \"&\"), (zExtra==0 ? \"\" : zExtra)\n      );\n\n      if( zTarget==0 ){\n        p->rc = SQLITE_NOMEM;\n        return;\n      }\n      p->dbMain = rbuOpenDbhandle(p, zTarget, p->nRbu<=1);\n      sqlite3_free(zTarget);\n    }\n  }\n\n  if( p->rc==SQLITE_OK ){\n    p->rc = sqlite3_create_function(p->dbMain, \n        \"rbu_tmp_insert\", -1, SQLITE_UTF8, (void*)p, rbuTmpInsertFunc, 0, 0\n    );\n  }\n\n  if( p->rc==SQLITE_OK ){\n    p->rc = sqlite3_create_function(p->dbMain, \n        \"rbu_fossil_delta\", 2, SQLITE_UTF8, 0, rbuFossilDeltaFunc, 0, 0\n    );\n  }\n\n  if( p->rc==SQLITE_OK ){\n    p->rc = sqlite3_create_function(p->dbRbu, \n        \"rbu_target_name\", -1, SQLITE_UTF8, (void*)p, rbuTargetNameFunc, 0, 0\n    );\n  }\n\n  if( p->rc==SQLITE_OK ){\n    p->rc = sqlite3_file_control(p->dbMain, \"main\", SQLITE_FCNTL_RBU, (void*)p);\n  }\n  rbuMPrintfExec(p, p->dbMain, \"SELECT * FROM sqlite_master\");\n\n  /* Mark the database file just opened as an RBU target database. If \n  ** this call returns SQLITE_NOTFOUND, then the RBU vfs is not in use.\n  ** This is an error.  */\n  if( p->rc==SQLITE_OK ){\n    p->rc = sqlite3_file_control(p->dbMain, \"main\", SQLITE_FCNTL_RBU, (void*)p);\n  }\n\n  if( p->rc==SQLITE_NOTFOUND ){\n    p->rc = SQLITE_ERROR;\n    p->zErrmsg = sqlite3_mprintf(\"rbu vfs not found\");\n  }\n}\n\n/*\n** This routine is a copy of the sqlite3FileSuffix3() routine from the core.\n** It is a no-op unless SQLITE_ENABLE_8_3_NAMES is defined.\n**\n** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database\n** filename in zBaseFilename is a URI with the \"8_3_names=1\" parameter and\n** if filename in z[] has a suffix (a.k.a. \"extension\") that is longer than\n** three characters, then shorten the suffix on z[] to be the last three\n** characters of the original suffix.\n**\n** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always\n** do the suffix shortening regardless of URI parameter.\n**\n** Examples:\n**\n**     test.db-journal    =>   test.nal\n**     test.db-wal        =>   test.wal\n**     test.db-shm        =>   test.shm\n**     test.db-mj7f3319fa =>   test.9fa\n*/\nstatic void rbuFileSuffix3(const char *zBase, char *z){\n#ifdef SQLITE_ENABLE_8_3_NAMES\n#if SQLITE_ENABLE_8_3_NAMES<2\n  if( sqlite3_uri_boolean(zBase, \"8_3_names\", 0) )\n#endif\n  {\n    int i, sz;\n    sz = (int)strlen(z)&0xffffff;\n    for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}\n    if( z[i]=='.' && sz>i+4 ) memmove(&z[i+1], &z[sz-3], 4);\n  }\n#endif\n}\n\n/*\n** Return the current wal-index header checksum for the target database \n** as a 64-bit integer.\n**\n** The checksum is store in the first page of xShmMap memory as an 8-byte \n** blob starting at byte offset 40.\n*/\nstatic i64 rbuShmChecksum(sqlite3rbu *p){\n  i64 iRet = 0;\n  if( p->rc==SQLITE_OK ){\n    sqlite3_file *pDb = p->pTargetFd->pReal;\n    u32 volatile *ptr;\n    p->rc = pDb->pMethods->xShmMap(pDb, 0, 32*1024, 0, (void volatile**)&ptr);\n    if( p->rc==SQLITE_OK ){\n      iRet = ((i64)ptr[10] << 32) + ptr[11];\n    }\n  }\n  return iRet;\n}\n\n/*\n** This function is called as part of initializing or reinitializing an\n** incremental checkpoint. \n**\n** It populates the sqlite3rbu.aFrame[] array with the set of \n** (wal frame -> db page) copy operations required to checkpoint the \n** current wal file, and obtains the set of shm locks required to safely \n** perform the copy operations directly on the file-system.\n**\n** If argument pState is not NULL, then the incremental checkpoint is\n** being resumed. In this case, if the checksum of the wal-index-header\n** following recovery is not the same as the checksum saved in the RbuState\n** object, then the rbu handle is set to DONE state. This occurs if some\n** other client appends a transaction to the wal file in the middle of\n** an incremental checkpoint.\n*/\nstatic void rbuSetupCheckpoint(sqlite3rbu *p, RbuState *pState){\n\n  /* If pState is NULL, then the wal file may not have been opened and\n  ** recovered. Running a read-statement here to ensure that doing so\n  ** does not interfere with the \"capture\" process below.  */\n  if( pState==0 ){\n    p->eStage = 0;\n    if( p->rc==SQLITE_OK ){\n      p->rc = sqlite3_exec(p->dbMain, \"SELECT * FROM sqlite_master\", 0, 0, 0);\n    }\n  }\n\n  /* Assuming no error has occurred, run a \"restart\" checkpoint with the\n  ** sqlite3rbu.eStage variable set to CAPTURE. This turns on the following\n  ** special behaviour in the rbu VFS:\n  **\n  **   * If the exclusive shm WRITER or READ0 lock cannot be obtained,\n  **     the checkpoint fails with SQLITE_BUSY (normally SQLite would\n  **     proceed with running a passive checkpoint instead of failing).\n  **\n  **   * Attempts to read from the *-wal file or write to the database file\n  **     do not perform any IO. Instead, the frame/page combinations that\n  **     would be read/written are recorded in the sqlite3rbu.aFrame[]\n  **     array.\n  **\n  **   * Calls to xShmLock(UNLOCK) to release the exclusive shm WRITER, \n  **     READ0 and CHECKPOINT locks taken as part of the checkpoint are\n  **     no-ops. These locks will not be released until the connection\n  **     is closed.\n  **\n  **   * Attempting to xSync() the database file causes an SQLITE_INTERNAL \n  **     error.\n  **\n  ** As a result, unless an error (i.e. OOM or SQLITE_BUSY) occurs, the\n  ** checkpoint below fails with SQLITE_INTERNAL, and leaves the aFrame[]\n  ** array populated with a set of (frame -> page) mappings. Because the \n  ** WRITER, CHECKPOINT and READ0 locks are still held, it is safe to copy \n  ** data from the wal file into the database file according to the \n  ** contents of aFrame[].\n  */\n  if( p->rc==SQLITE_OK ){\n    int rc2;\n    p->eStage = RBU_STAGE_CAPTURE;\n    rc2 = sqlite3_exec(p->dbMain, \"PRAGMA main.wal_checkpoint=restart\", 0, 0,0);\n    if( rc2!=SQLITE_INTERNAL ) p->rc = rc2;\n  }\n\n  if( p->rc==SQLITE_OK ){\n    p->eStage = RBU_STAGE_CKPT;\n    p->nStep = (pState ? pState->nRow : 0);\n    p->aBuf = rbuMalloc(p, p->pgsz);\n    p->iWalCksum = rbuShmChecksum(p);\n  }\n\n  if( p->rc==SQLITE_OK && pState && pState->iWalCksum!=p->iWalCksum ){\n    p->rc = SQLITE_DONE;\n    p->eStage = RBU_STAGE_DONE;\n  }\n}\n\n/*\n** Called when iAmt bytes are read from offset iOff of the wal file while\n** the rbu object is in capture mode. Record the frame number of the frame\n** being read in the aFrame[] array.\n*/\nstatic int rbuCaptureWalRead(sqlite3rbu *pRbu, i64 iOff, int iAmt){\n  const u32 mReq = (1<<WAL_LOCK_WRITE)|(1<<WAL_LOCK_CKPT)|(1<<WAL_LOCK_READ0);\n  u32 iFrame;\n\n  if( pRbu->mLock!=mReq ){\n    pRbu->rc = SQLITE_BUSY;\n    return SQLITE_INTERNAL;\n  }\n\n  pRbu->pgsz = iAmt;\n  if( pRbu->nFrame==pRbu->nFrameAlloc ){\n    int nNew = (pRbu->nFrameAlloc ? pRbu->nFrameAlloc : 64) * 2;\n    RbuFrame *aNew;\n    aNew = (RbuFrame*)sqlite3_realloc64(pRbu->aFrame, nNew * sizeof(RbuFrame));\n    if( aNew==0 ) return SQLITE_NOMEM;\n    pRbu->aFrame = aNew;\n    pRbu->nFrameAlloc = nNew;\n  }\n\n  iFrame = (u32)((iOff-32) / (i64)(iAmt+24)) + 1;\n  if( pRbu->iMaxFrame<iFrame ) pRbu->iMaxFrame = iFrame;\n  pRbu->aFrame[pRbu->nFrame].iWalFrame = iFrame;\n  pRbu->aFrame[pRbu->nFrame].iDbPage = 0;\n  pRbu->nFrame++;\n  return SQLITE_OK;\n}\n\n/*\n** Called when a page of data is written to offset iOff of the database\n** file while the rbu handle is in capture mode. Record the page number \n** of the page being written in the aFrame[] array.\n*/\nstatic int rbuCaptureDbWrite(sqlite3rbu *pRbu, i64 iOff){\n  pRbu->aFrame[pRbu->nFrame-1].iDbPage = (u32)(iOff / pRbu->pgsz) + 1;\n  return SQLITE_OK;\n}\n\n/*\n** This is called as part of an incremental checkpoint operation. Copy\n** a single frame of data from the wal file into the database file, as\n** indicated by the RbuFrame object.\n*/\nstatic void rbuCheckpointFrame(sqlite3rbu *p, RbuFrame *pFrame){\n  sqlite3_file *pWal = p->pTargetFd->pWalFd->pReal;\n  sqlite3_file *pDb = p->pTargetFd->pReal;\n  i64 iOff;\n\n  assert( p->rc==SQLITE_OK );\n  iOff = (i64)(pFrame->iWalFrame-1) * (p->pgsz + 24) + 32 + 24;\n  p->rc = pWal->pMethods->xRead(pWal, p->aBuf, p->pgsz, iOff);\n  if( p->rc ) return;\n\n  iOff = (i64)(pFrame->iDbPage-1) * p->pgsz;\n  p->rc = pDb->pMethods->xWrite(pDb, p->aBuf, p->pgsz, iOff);\n}\n\n\n/*\n** Take an EXCLUSIVE lock on the database file.\n*/\nstatic void rbuLockDatabase(sqlite3rbu *p){\n  sqlite3_file *pReal = p->pTargetFd->pReal;\n  assert( p->rc==SQLITE_OK );\n  p->rc = pReal->pMethods->xLock(pReal, SQLITE_LOCK_SHARED);\n  if( p->rc==SQLITE_OK ){\n    p->rc = pReal->pMethods->xLock(pReal, SQLITE_LOCK_EXCLUSIVE);\n  }\n}\n\n#if defined(_WIN32_WCE)\nstatic LPWSTR rbuWinUtf8ToUnicode(const char *zFilename){\n  int nChar;\n  LPWSTR zWideFilename;\n\n  nChar = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0);\n  if( nChar==0 ){\n    return 0;\n  }\n  zWideFilename = sqlite3_malloc64( nChar*sizeof(zWideFilename[0]) );\n  if( zWideFilename==0 ){\n    return 0;\n  }\n  memset(zWideFilename, 0, nChar*sizeof(zWideFilename[0]));\n  nChar = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename,\n                                nChar);\n  if( nChar==0 ){\n    sqlite3_free(zWideFilename);\n    zWideFilename = 0;\n  }\n  return zWideFilename;\n}\n#endif\n\n/*\n** The RBU handle is currently in RBU_STAGE_OAL state, with a SHARED lock\n** on the database file. This proc moves the *-oal file to the *-wal path,\n** then reopens the database file (this time in vanilla, non-oal, WAL mode).\n** If an error occurs, leave an error code and error message in the rbu \n** handle.\n*/\nstatic void rbuMoveOalFile(sqlite3rbu *p){\n  const char *zBase = sqlite3_db_filename(p->dbMain, \"main\");\n  const char *zMove = zBase;\n  char *zOal;\n  char *zWal;\n\n  if( rbuIsVacuum(p) ){\n    zMove = sqlite3_db_filename(p->dbRbu, \"main\");\n  }\n  zOal = sqlite3_mprintf(\"%s-oal\", zMove);\n  zWal = sqlite3_mprintf(\"%s-wal\", zMove);\n\n  assert( p->eStage==RBU_STAGE_MOVE );\n  assert( p->rc==SQLITE_OK && p->zErrmsg==0 );\n  if( zWal==0 || zOal==0 ){\n    p->rc = SQLITE_NOMEM;\n  }else{\n    /* Move the *-oal file to *-wal. At this point connection p->db is\n    ** holding a SHARED lock on the target database file (because it is\n    ** in WAL mode). So no other connection may be writing the db. \n    **\n    ** In order to ensure that there are no database readers, an EXCLUSIVE\n    ** lock is obtained here before the *-oal is moved to *-wal.\n    */\n    rbuLockDatabase(p);\n    if( p->rc==SQLITE_OK ){\n      rbuFileSuffix3(zBase, zWal);\n      rbuFileSuffix3(zBase, zOal);\n\n      /* Re-open the databases. */\n      rbuObjIterFinalize(&p->objiter);\n      sqlite3_close(p->dbRbu);\n      sqlite3_close(p->dbMain);\n      p->dbMain = 0;\n      p->dbRbu = 0;\n\n#if defined(_WIN32_WCE)\n      {\n        LPWSTR zWideOal;\n        LPWSTR zWideWal;\n\n        zWideOal = rbuWinUtf8ToUnicode(zOal);\n        if( zWideOal ){\n          zWideWal = rbuWinUtf8ToUnicode(zWal);\n          if( zWideWal ){\n            if( MoveFileW(zWideOal, zWideWal) ){\n              p->rc = SQLITE_OK;\n            }else{\n              p->rc = SQLITE_IOERR;\n            }\n            sqlite3_free(zWideWal);\n          }else{\n            p->rc = SQLITE_IOERR_NOMEM;\n          }\n          sqlite3_free(zWideOal);\n        }else{\n          p->rc = SQLITE_IOERR_NOMEM;\n        }\n      }\n#else\n      p->rc = rename(zOal, zWal) ? SQLITE_IOERR : SQLITE_OK;\n#endif\n\n      if( p->rc==SQLITE_OK ){\n        rbuOpenDatabase(p);\n        rbuSetupCheckpoint(p, 0);\n      }\n    }\n  }\n\n  sqlite3_free(zWal);\n  sqlite3_free(zOal);\n}\n\n/*\n** The SELECT statement iterating through the keys for the current object\n** (p->objiter.pSelect) currently points to a valid row. This function\n** determines the type of operation requested by this row and returns\n** one of the following values to indicate the result:\n**\n**     * RBU_INSERT\n**     * RBU_DELETE\n**     * RBU_IDX_DELETE\n**     * RBU_UPDATE\n**\n** If RBU_UPDATE is returned, then output variable *pzMask is set to\n** point to the text value indicating the columns to update.\n**\n** If the rbu_control field contains an invalid value, an error code and\n** message are left in the RBU handle and zero returned.\n*/\nstatic int rbuStepType(sqlite3rbu *p, const char **pzMask){\n  int iCol = p->objiter.nCol;     /* Index of rbu_control column */\n  int res = 0;                    /* Return value */\n\n  switch( sqlite3_column_type(p->objiter.pSelect, iCol) ){\n    case SQLITE_INTEGER: {\n      int iVal = sqlite3_column_int(p->objiter.pSelect, iCol);\n      switch( iVal ){\n        case 0: res = RBU_INSERT;     break;\n        case 1: res = RBU_DELETE;     break;\n        case 2: res = RBU_REPLACE;    break;\n        case 3: res = RBU_IDX_DELETE; break;\n        case 4: res = RBU_IDX_INSERT; break;\n      }\n      break;\n    }\n\n    case SQLITE_TEXT: {\n      const unsigned char *z = sqlite3_column_text(p->objiter.pSelect, iCol);\n      if( z==0 ){\n        p->rc = SQLITE_NOMEM;\n      }else{\n        *pzMask = (const char*)z;\n      }\n      res = RBU_UPDATE;\n\n      break;\n    }\n\n    default:\n      break;\n  }\n\n  if( res==0 ){\n    rbuBadControlError(p);\n  }\n  return res;\n}\n\n#ifdef SQLITE_DEBUG\n/*\n** Assert that column iCol of statement pStmt is named zName.\n*/\nstatic void assertColumnName(sqlite3_stmt *pStmt, int iCol, const char *zName){\n  const char *zCol = sqlite3_column_name(pStmt, iCol);\n  assert( 0==sqlite3_stricmp(zName, zCol) );\n}\n#else\n# define assertColumnName(x,y,z)\n#endif\n\n/*\n** Argument eType must be one of RBU_INSERT, RBU_DELETE, RBU_IDX_INSERT or\n** RBU_IDX_DELETE. This function performs the work of a single\n** sqlite3rbu_step() call for the type of operation specified by eType.\n*/\nstatic void rbuStepOneOp(sqlite3rbu *p, int eType){\n  RbuObjIter *pIter = &p->objiter;\n  sqlite3_value *pVal;\n  sqlite3_stmt *pWriter;\n  int i;\n\n  assert( p->rc==SQLITE_OK );\n  assert( eType!=RBU_DELETE || pIter->zIdx==0 );\n  assert( eType==RBU_DELETE || eType==RBU_IDX_DELETE\n       || eType==RBU_INSERT || eType==RBU_IDX_INSERT\n  );\n\n  /* If this is a delete, decrement nPhaseOneStep by nIndex. If the DELETE\n  ** statement below does actually delete a row, nPhaseOneStep will be\n  ** incremented by the same amount when SQL function rbu_tmp_insert()\n  ** is invoked by the trigger.  */\n  if( eType==RBU_DELETE ){\n    p->nPhaseOneStep -= p->objiter.nIndex;\n  }\n\n  if( eType==RBU_IDX_DELETE || eType==RBU_DELETE ){\n    pWriter = pIter->pDelete;\n  }else{\n    pWriter = pIter->pInsert;\n  }\n\n  for(i=0; i<pIter->nCol; i++){\n    /* If this is an INSERT into a table b-tree and the table has an\n    ** explicit INTEGER PRIMARY KEY, check that this is not an attempt\n    ** to write a NULL into the IPK column. That is not permitted.  */\n    if( eType==RBU_INSERT \n     && pIter->zIdx==0 && pIter->eType==RBU_PK_IPK && pIter->abTblPk[i] \n     && sqlite3_column_type(pIter->pSelect, i)==SQLITE_NULL\n    ){\n      p->rc = SQLITE_MISMATCH;\n      p->zErrmsg = sqlite3_mprintf(\"datatype mismatch\");\n      return;\n    }\n\n    if( eType==RBU_DELETE && pIter->abTblPk[i]==0 ){\n      continue;\n    }\n\n    pVal = sqlite3_column_value(pIter->pSelect, i);\n    p->rc = sqlite3_bind_value(pWriter, i+1, pVal);\n    if( p->rc ) return;\n  }\n  if( pIter->zIdx==0 ){\n    if( pIter->eType==RBU_PK_VTAB \n     || pIter->eType==RBU_PK_NONE \n     || (pIter->eType==RBU_PK_EXTERNAL && rbuIsVacuum(p)) \n    ){\n      /* For a virtual table, or a table with no primary key, the \n      ** SELECT statement is:\n      **\n      **   SELECT <cols>, rbu_control, rbu_rowid FROM ....\n      **\n      ** Hence column_value(pIter->nCol+1).\n      */\n      assertColumnName(pIter->pSelect, pIter->nCol+1, \n          rbuIsVacuum(p) ? \"rowid\" : \"rbu_rowid\"\n      );\n      pVal = sqlite3_column_value(pIter->pSelect, pIter->nCol+1);\n      p->rc = sqlite3_bind_value(pWriter, pIter->nCol+1, pVal);\n    }\n  }\n  if( p->rc==SQLITE_OK ){\n    sqlite3_step(pWriter);\n    p->rc = resetAndCollectError(pWriter, &p->zErrmsg);\n  }\n}\n\n/*\n** This function does the work for an sqlite3rbu_step() call.\n**\n** The object-iterator (p->objiter) currently points to a valid object,\n** and the input cursor (p->objiter.pSelect) currently points to a valid\n** input row. Perform whatever processing is required and return.\n**\n** If no  error occurs, SQLITE_OK is returned. Otherwise, an error code\n** and message is left in the RBU handle and a copy of the error code\n** returned.\n*/\nstatic int rbuStep(sqlite3rbu *p){\n  RbuObjIter *pIter = &p->objiter;\n  const char *zMask = 0;\n  int eType = rbuStepType(p, &zMask);\n\n  if( eType ){\n    assert( eType==RBU_INSERT     || eType==RBU_DELETE\n         || eType==RBU_REPLACE    || eType==RBU_IDX_DELETE\n         || eType==RBU_IDX_INSERT || eType==RBU_UPDATE\n    );\n    assert( eType!=RBU_UPDATE || pIter->zIdx==0 );\n\n    if( pIter->zIdx==0 && (eType==RBU_IDX_DELETE || eType==RBU_IDX_INSERT) ){\n      rbuBadControlError(p);\n    }\n    else if( eType==RBU_REPLACE ){\n      if( pIter->zIdx==0 ){\n        p->nPhaseOneStep += p->objiter.nIndex;\n        rbuStepOneOp(p, RBU_DELETE);\n      }\n      if( p->rc==SQLITE_OK ) rbuStepOneOp(p, RBU_INSERT);\n    }\n    else if( eType!=RBU_UPDATE ){\n      rbuStepOneOp(p, eType);\n    }\n    else{\n      sqlite3_value *pVal;\n      sqlite3_stmt *pUpdate = 0;\n      assert( eType==RBU_UPDATE );\n      p->nPhaseOneStep -= p->objiter.nIndex;\n      rbuGetUpdateStmt(p, pIter, zMask, &pUpdate);\n      if( pUpdate ){\n        int i;\n        for(i=0; p->rc==SQLITE_OK && i<pIter->nCol; i++){\n          char c = zMask[pIter->aiSrcOrder[i]];\n          pVal = sqlite3_column_value(pIter->pSelect, i);\n          if( pIter->abTblPk[i] || c!='.' ){\n            p->rc = sqlite3_bind_value(pUpdate, i+1, pVal);\n          }\n        }\n        if( p->rc==SQLITE_OK \n         && (pIter->eType==RBU_PK_VTAB || pIter->eType==RBU_PK_NONE) \n        ){\n          /* Bind the rbu_rowid value to column _rowid_ */\n          assertColumnName(pIter->pSelect, pIter->nCol+1, \"rbu_rowid\");\n          pVal = sqlite3_column_value(pIter->pSelect, pIter->nCol+1);\n          p->rc = sqlite3_bind_value(pUpdate, pIter->nCol+1, pVal);\n        }\n        if( p->rc==SQLITE_OK ){\n          sqlite3_step(pUpdate);\n          p->rc = resetAndCollectError(pUpdate, &p->zErrmsg);\n        }\n      }\n    }\n  }\n  return p->rc;\n}\n\n/*\n** Increment the schema cookie of the main database opened by p->dbMain.\n**\n** Or, if this is an RBU vacuum, set the schema cookie of the main db\n** opened by p->dbMain to one more than the schema cookie of the main\n** db opened by p->dbRbu.\n*/\nstatic void rbuIncrSchemaCookie(sqlite3rbu *p){\n  if( p->rc==SQLITE_OK ){\n    sqlite3 *dbread = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain);\n    int iCookie = 1000000;\n    sqlite3_stmt *pStmt;\n\n    p->rc = prepareAndCollectError(dbread, &pStmt, &p->zErrmsg, \n        \"PRAGMA schema_version\"\n    );\n    if( p->rc==SQLITE_OK ){\n      /* Coverage: it may be that this sqlite3_step() cannot fail. There\n      ** is already a transaction open, so the prepared statement cannot\n      ** throw an SQLITE_SCHEMA exception. The only database page the\n      ** statement reads is page 1, which is guaranteed to be in the cache.\n      ** And no memory allocations are required.  */\n      if( SQLITE_ROW==sqlite3_step(pStmt) ){\n        iCookie = sqlite3_column_int(pStmt, 0);\n      }\n      rbuFinalize(p, pStmt);\n    }\n    if( p->rc==SQLITE_OK ){\n      rbuMPrintfExec(p, p->dbMain, \"PRAGMA schema_version = %d\", iCookie+1);\n    }\n  }\n}\n\n/*\n** Update the contents of the rbu_state table within the rbu database. The\n** value stored in the RBU_STATE_STAGE column is eStage. All other values\n** are determined by inspecting the rbu handle passed as the first argument.\n*/\nstatic void rbuSaveState(sqlite3rbu *p, int eStage){\n  if( p->rc==SQLITE_OK || p->rc==SQLITE_DONE ){\n    sqlite3_stmt *pInsert = 0;\n    rbu_file *pFd = (rbuIsVacuum(p) ? p->pRbuFd : p->pTargetFd);\n    int rc;\n\n    assert( p->zErrmsg==0 );\n    rc = prepareFreeAndCollectError(p->dbRbu, &pInsert, &p->zErrmsg, \n        sqlite3_mprintf(\n          \"INSERT OR REPLACE INTO %s.rbu_state(k, v) VALUES \"\n          \"(%d, %d), \"\n          \"(%d, %Q), \"\n          \"(%d, %Q), \"\n          \"(%d, %d), \"\n          \"(%d, %d), \"\n          \"(%d, %lld), \"\n          \"(%d, %lld), \"\n          \"(%d, %lld), \"\n          \"(%d, %lld) \",\n          p->zStateDb,\n          RBU_STATE_STAGE, eStage,\n          RBU_STATE_TBL, p->objiter.zTbl, \n          RBU_STATE_IDX, p->objiter.zIdx, \n          RBU_STATE_ROW, p->nStep, \n          RBU_STATE_PROGRESS, p->nProgress,\n          RBU_STATE_CKPT, p->iWalCksum,\n          RBU_STATE_COOKIE, (i64)pFd->iCookie,\n          RBU_STATE_OALSZ, p->iOalSz,\n          RBU_STATE_PHASEONESTEP, p->nPhaseOneStep\n      )\n    );\n    assert( pInsert==0 || rc==SQLITE_OK );\n\n    if( rc==SQLITE_OK ){\n      sqlite3_step(pInsert);\n      rc = sqlite3_finalize(pInsert);\n    }\n    if( rc!=SQLITE_OK ) p->rc = rc;\n  }\n}\n\n\n/*\n** The second argument passed to this function is the name of a PRAGMA \n** setting - \"page_size\", \"auto_vacuum\", \"user_version\" or \"application_id\".\n** This function executes the following on sqlite3rbu.dbRbu:\n**\n**   \"PRAGMA main.$zPragma\"\n**\n** where $zPragma is the string passed as the second argument, then\n** on sqlite3rbu.dbMain:\n**\n**   \"PRAGMA main.$zPragma = $val\"\n**\n** where $val is the value returned by the first PRAGMA invocation.\n**\n** In short, it copies the value  of the specified PRAGMA setting from\n** dbRbu to dbMain.\n*/\nstatic void rbuCopyPragma(sqlite3rbu *p, const char *zPragma){\n  if( p->rc==SQLITE_OK ){\n    sqlite3_stmt *pPragma = 0;\n    p->rc = prepareFreeAndCollectError(p->dbRbu, &pPragma, &p->zErrmsg, \n        sqlite3_mprintf(\"PRAGMA main.%s\", zPragma)\n    );\n    if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPragma) ){\n      p->rc = rbuMPrintfExec(p, p->dbMain, \"PRAGMA main.%s = %d\",\n          zPragma, sqlite3_column_int(pPragma, 0)\n      );\n    }\n    rbuFinalize(p, pPragma);\n  }\n}\n\n/*\n** The RBU handle passed as the only argument has just been opened and \n** the state database is empty. If this RBU handle was opened for an\n** RBU vacuum operation, create the schema in the target db.\n*/\nstatic void rbuCreateTargetSchema(sqlite3rbu *p){\n  sqlite3_stmt *pSql = 0;\n  sqlite3_stmt *pInsert = 0;\n\n  assert( rbuIsVacuum(p) );\n  p->rc = sqlite3_exec(p->dbMain, \"PRAGMA writable_schema=1\", 0,0, &p->zErrmsg);\n  if( p->rc==SQLITE_OK ){\n    p->rc = prepareAndCollectError(p->dbRbu, &pSql, &p->zErrmsg, \n      \"SELECT sql FROM sqlite_master WHERE sql!='' AND rootpage!=0\"\n      \" AND name!='sqlite_sequence' \"\n      \" ORDER BY type DESC\"\n    );\n  }\n\n  while( p->rc==SQLITE_OK && sqlite3_step(pSql)==SQLITE_ROW ){\n    const char *zSql = (const char*)sqlite3_column_text(pSql, 0);\n    p->rc = sqlite3_exec(p->dbMain, zSql, 0, 0, &p->zErrmsg);\n  }\n  rbuFinalize(p, pSql);\n  if( p->rc!=SQLITE_OK ) return;\n\n  if( p->rc==SQLITE_OK ){\n    p->rc = prepareAndCollectError(p->dbRbu, &pSql, &p->zErrmsg, \n        \"SELECT * FROM sqlite_master WHERE rootpage=0 OR rootpage IS NULL\" \n    );\n  }\n\n  if( p->rc==SQLITE_OK ){\n    p->rc = prepareAndCollectError(p->dbMain, &pInsert, &p->zErrmsg, \n        \"INSERT INTO sqlite_master VALUES(?,?,?,?,?)\"\n    );\n  }\n\n  while( p->rc==SQLITE_OK && sqlite3_step(pSql)==SQLITE_ROW ){\n    int i;\n    for(i=0; i<5; i++){\n      sqlite3_bind_value(pInsert, i+1, sqlite3_column_value(pSql, i));\n    }\n    sqlite3_step(pInsert);\n    p->rc = sqlite3_reset(pInsert);\n  }\n  if( p->rc==SQLITE_OK ){\n    p->rc = sqlite3_exec(p->dbMain, \"PRAGMA writable_schema=0\",0,0,&p->zErrmsg);\n  }\n\n  rbuFinalize(p, pSql);\n  rbuFinalize(p, pInsert);\n}\n\n/*\n** Step the RBU object.\n*/\nint sqlite3rbu_step(sqlite3rbu *p){\n  if( p ){\n    switch( p->eStage ){\n      case RBU_STAGE_OAL: {\n        RbuObjIter *pIter = &p->objiter;\n\n        /* If this is an RBU vacuum operation and the state table was empty\n        ** when this handle was opened, create the target database schema. */\n        if( rbuIsVacuum(p) && p->nProgress==0 && p->rc==SQLITE_OK ){\n          rbuCreateTargetSchema(p);\n          rbuCopyPragma(p, \"user_version\");\n          rbuCopyPragma(p, \"application_id\");\n        }\n\n        while( p->rc==SQLITE_OK && pIter->zTbl ){\n\n          if( pIter->bCleanup ){\n            /* Clean up the rbu_tmp_xxx table for the previous table. It \n            ** cannot be dropped as there are currently active SQL statements.\n            ** But the contents can be deleted.  */\n            if( rbuIsVacuum(p)==0 && pIter->abIndexed ){\n              rbuMPrintfExec(p, p->dbRbu, \n                  \"DELETE FROM %s.'rbu_tmp_%q'\", p->zStateDb, pIter->zDataTbl\n              );\n            }\n          }else{\n            rbuObjIterPrepareAll(p, pIter, 0);\n\n            /* Advance to the next row to process. */\n            if( p->rc==SQLITE_OK ){\n              int rc = sqlite3_step(pIter->pSelect);\n              if( rc==SQLITE_ROW ){\n                p->nProgress++;\n                p->nStep++;\n                return rbuStep(p);\n              }\n              p->rc = sqlite3_reset(pIter->pSelect);\n              p->nStep = 0;\n            }\n          }\n\n          rbuObjIterNext(p, pIter);\n        }\n\n        if( p->rc==SQLITE_OK ){\n          assert( pIter->zTbl==0 );\n          rbuSaveState(p, RBU_STAGE_MOVE);\n          rbuIncrSchemaCookie(p);\n          if( p->rc==SQLITE_OK ){\n            p->rc = sqlite3_exec(p->dbMain, \"COMMIT\", 0, 0, &p->zErrmsg);\n          }\n          if( p->rc==SQLITE_OK ){\n            p->rc = sqlite3_exec(p->dbRbu, \"COMMIT\", 0, 0, &p->zErrmsg);\n          }\n          p->eStage = RBU_STAGE_MOVE;\n        }\n        break;\n      }\n\n      case RBU_STAGE_MOVE: {\n        if( p->rc==SQLITE_OK ){\n          rbuMoveOalFile(p);\n          p->nProgress++;\n        }\n        break;\n      }\n\n      case RBU_STAGE_CKPT: {\n        if( p->rc==SQLITE_OK ){\n          if( p->nStep>=p->nFrame ){\n            sqlite3_file *pDb = p->pTargetFd->pReal;\n  \n            /* Sync the db file */\n            p->rc = pDb->pMethods->xSync(pDb, SQLITE_SYNC_NORMAL);\n  \n            /* Update nBackfill */\n            if( p->rc==SQLITE_OK ){\n              void volatile *ptr;\n              p->rc = pDb->pMethods->xShmMap(pDb, 0, 32*1024, 0, &ptr);\n              if( p->rc==SQLITE_OK ){\n                ((u32 volatile*)ptr)[24] = p->iMaxFrame;\n              }\n            }\n  \n            if( p->rc==SQLITE_OK ){\n              p->eStage = RBU_STAGE_DONE;\n              p->rc = SQLITE_DONE;\n            }\n          }else{\n            RbuFrame *pFrame = &p->aFrame[p->nStep];\n            rbuCheckpointFrame(p, pFrame);\n            p->nStep++;\n          }\n          p->nProgress++;\n        }\n        break;\n      }\n\n      default:\n        break;\n    }\n    return p->rc;\n  }else{\n    return SQLITE_NOMEM;\n  }\n}\n\n/*\n** Compare strings z1 and z2, returning 0 if they are identical, or non-zero\n** otherwise. Either or both argument may be NULL. Two NULL values are\n** considered equal, and NULL is considered distinct from all other values.\n*/\nstatic int rbuStrCompare(const char *z1, const char *z2){\n  if( z1==0 && z2==0 ) return 0;\n  if( z1==0 || z2==0 ) return 1;\n  return (sqlite3_stricmp(z1, z2)!=0);\n}\n\n/*\n** This function is called as part of sqlite3rbu_open() when initializing\n** an rbu handle in OAL stage. If the rbu update has not started (i.e.\n** the rbu_state table was empty) it is a no-op. Otherwise, it arranges\n** things so that the next call to sqlite3rbu_step() continues on from\n** where the previous rbu handle left off.\n**\n** If an error occurs, an error code and error message are left in the\n** rbu handle passed as the first argument.\n*/\nstatic void rbuSetupOal(sqlite3rbu *p, RbuState *pState){\n  assert( p->rc==SQLITE_OK );\n  if( pState->zTbl ){\n    RbuObjIter *pIter = &p->objiter;\n    int rc = SQLITE_OK;\n\n    while( rc==SQLITE_OK && pIter->zTbl && (pIter->bCleanup \n       || rbuStrCompare(pIter->zIdx, pState->zIdx)\n       || rbuStrCompare(pIter->zTbl, pState->zTbl) \n    )){\n      rc = rbuObjIterNext(p, pIter);\n    }\n\n    if( rc==SQLITE_OK && !pIter->zTbl ){\n      rc = SQLITE_ERROR;\n      p->zErrmsg = sqlite3_mprintf(\"rbu_state mismatch error\");\n    }\n\n    if( rc==SQLITE_OK ){\n      p->nStep = pState->nRow;\n      rc = rbuObjIterPrepareAll(p, &p->objiter, p->nStep);\n    }\n\n    p->rc = rc;\n  }\n}\n\n/*\n** If there is a \"*-oal\" file in the file-system corresponding to the\n** target database in the file-system, delete it. If an error occurs,\n** leave an error code and error message in the rbu handle.\n*/\nstatic void rbuDeleteOalFile(sqlite3rbu *p){\n  char *zOal = rbuMPrintf(p, \"%s-oal\", p->zTarget);\n  if( zOal ){\n    sqlite3_vfs *pVfs = sqlite3_vfs_find(0);\n    assert( pVfs && p->rc==SQLITE_OK && p->zErrmsg==0 );\n    pVfs->xDelete(pVfs, zOal, 0);\n    sqlite3_free(zOal);\n  }\n}\n\n/*\n** Allocate a private rbu VFS for the rbu handle passed as the only\n** argument. This VFS will be used unless the call to sqlite3rbu_open()\n** specified a URI with a vfs=? option in place of a target database\n** file name.\n*/\nstatic void rbuCreateVfs(sqlite3rbu *p){\n  int rnd;\n  char zRnd[64];\n\n  assert( p->rc==SQLITE_OK );\n  sqlite3_randomness(sizeof(int), (void*)&rnd);\n  sqlite3_snprintf(sizeof(zRnd), zRnd, \"rbu_vfs_%d\", rnd);\n  p->rc = sqlite3rbu_create_vfs(zRnd, 0);\n  if( p->rc==SQLITE_OK ){\n    sqlite3_vfs *pVfs = sqlite3_vfs_find(zRnd);\n    assert( pVfs );\n    p->zVfsName = pVfs->zName;\n  }\n}\n\n/*\n** Destroy the private VFS created for the rbu handle passed as the only\n** argument by an earlier call to rbuCreateVfs().\n*/\nstatic void rbuDeleteVfs(sqlite3rbu *p){\n  if( p->zVfsName ){\n    sqlite3rbu_destroy_vfs(p->zVfsName);\n    p->zVfsName = 0;\n  }\n}\n\n/*\n** This user-defined SQL function is invoked with a single argument - the\n** name of a table expected to appear in the target database. It returns\n** the number of auxilliary indexes on the table.\n*/\nstatic void rbuIndexCntFunc(\n  sqlite3_context *pCtx, \n  int nVal,\n  sqlite3_value **apVal\n){\n  sqlite3rbu *p = (sqlite3rbu*)sqlite3_user_data(pCtx);\n  sqlite3_stmt *pStmt = 0;\n  char *zErrmsg = 0;\n  int rc;\n\n  assert( nVal==1 );\n  \n  rc = prepareFreeAndCollectError(p->dbMain, &pStmt, &zErrmsg, \n      sqlite3_mprintf(\"SELECT count(*) FROM sqlite_master \"\n        \"WHERE type='index' AND tbl_name = %Q\", sqlite3_value_text(apVal[0]))\n  );\n  if( rc!=SQLITE_OK ){\n    sqlite3_result_error(pCtx, zErrmsg, -1);\n  }else{\n    int nIndex = 0;\n    if( SQLITE_ROW==sqlite3_step(pStmt) ){\n      nIndex = sqlite3_column_int(pStmt, 0);\n    }\n    rc = sqlite3_finalize(pStmt);\n    if( rc==SQLITE_OK ){\n      sqlite3_result_int(pCtx, nIndex);\n    }else{\n      sqlite3_result_error(pCtx, sqlite3_errmsg(p->dbMain), -1);\n    }\n  }\n\n  sqlite3_free(zErrmsg);\n}\n\n/*\n** If the RBU database contains the rbu_count table, use it to initialize\n** the sqlite3rbu.nPhaseOneStep variable. The schema of the rbu_count table\n** is assumed to contain the same columns as:\n**\n**   CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID;\n**\n** There should be one row in the table for each data_xxx table in the\n** database. The 'tbl' column should contain the name of a data_xxx table,\n** and the cnt column the number of rows it contains.\n**\n** sqlite3rbu.nPhaseOneStep is initialized to the sum of (1 + nIndex) * cnt\n** for all rows in the rbu_count table, where nIndex is the number of \n** indexes on the corresponding target database table.\n*/\nstatic void rbuInitPhaseOneSteps(sqlite3rbu *p){\n  if( p->rc==SQLITE_OK ){\n    sqlite3_stmt *pStmt = 0;\n    int bExists = 0;                /* True if rbu_count exists */\n\n    p->nPhaseOneStep = -1;\n\n    p->rc = sqlite3_create_function(p->dbRbu, \n        \"rbu_index_cnt\", 1, SQLITE_UTF8, (void*)p, rbuIndexCntFunc, 0, 0\n    );\n  \n    /* Check for the rbu_count table. If it does not exist, or if an error\n    ** occurs, nPhaseOneStep will be left set to -1. */\n    if( p->rc==SQLITE_OK ){\n      p->rc = prepareAndCollectError(p->dbRbu, &pStmt, &p->zErrmsg,\n          \"SELECT 1 FROM sqlite_master WHERE tbl_name = 'rbu_count'\"\n      );\n    }\n    if( p->rc==SQLITE_OK ){\n      if( SQLITE_ROW==sqlite3_step(pStmt) ){\n        bExists = 1;\n      }\n      p->rc = sqlite3_finalize(pStmt);\n    }\n  \n    if( p->rc==SQLITE_OK && bExists ){\n      p->rc = prepareAndCollectError(p->dbRbu, &pStmt, &p->zErrmsg,\n          \"SELECT sum(cnt * (1 + rbu_index_cnt(rbu_target_name(tbl))))\"\n          \"FROM rbu_count\"\n      );\n      if( p->rc==SQLITE_OK ){\n        if( SQLITE_ROW==sqlite3_step(pStmt) ){\n          p->nPhaseOneStep = sqlite3_column_int64(pStmt, 0);\n        }\n        p->rc = sqlite3_finalize(pStmt);\n      }\n    }\n  }\n}\n\n\nstatic sqlite3rbu *openRbuHandle(\n  const char *zTarget, \n  const char *zRbu,\n  const char *zState\n){\n  sqlite3rbu *p;\n  size_t nTarget = zTarget ? strlen(zTarget) : 0;\n  size_t nRbu = strlen(zRbu);\n  size_t nByte = sizeof(sqlite3rbu) + nTarget+1 + nRbu+1;\n\n  p = (sqlite3rbu*)sqlite3_malloc64(nByte);\n  if( p ){\n    RbuState *pState = 0;\n\n    /* Create the custom VFS. */\n    memset(p, 0, sizeof(sqlite3rbu));\n    rbuCreateVfs(p);\n\n    /* Open the target, RBU and state databases */\n    if( p->rc==SQLITE_OK ){\n      char *pCsr = (char*)&p[1];\n      if( zTarget ){\n        p->zTarget = pCsr;\n        memcpy(p->zTarget, zTarget, nTarget+1);\n        pCsr += nTarget+1;\n      }\n      p->zRbu = pCsr;\n      memcpy(p->zRbu, zRbu, nRbu+1);\n      pCsr += nRbu+1;\n      if( zState ){\n        p->zState = rbuMPrintf(p, \"%s\", zState);\n      }\n      rbuOpenDatabase(p);\n    }\n\n    if( p->rc==SQLITE_OK ){\n      pState = rbuLoadState(p);\n      assert( pState || p->rc!=SQLITE_OK );\n      if( p->rc==SQLITE_OK ){\n\n        if( pState->eStage==0 ){ \n          rbuDeleteOalFile(p);\n          rbuInitPhaseOneSteps(p);\n          p->eStage = RBU_STAGE_OAL;\n        }else{\n          p->eStage = pState->eStage;\n          p->nPhaseOneStep = pState->nPhaseOneStep;\n        }\n        p->nProgress = pState->nProgress;\n        p->iOalSz = pState->iOalSz;\n      }\n    }\n    assert( p->rc!=SQLITE_OK || p->eStage!=0 );\n\n    if( p->rc==SQLITE_OK && p->pTargetFd->pWalFd ){\n      if( p->eStage==RBU_STAGE_OAL ){\n        p->rc = SQLITE_ERROR;\n        p->zErrmsg = sqlite3_mprintf(\"cannot update wal mode database\");\n      }else if( p->eStage==RBU_STAGE_MOVE ){\n        p->eStage = RBU_STAGE_CKPT;\n        p->nStep = 0;\n      }\n    }\n\n    if( p->rc==SQLITE_OK \n     && (p->eStage==RBU_STAGE_OAL || p->eStage==RBU_STAGE_MOVE)\n     && pState->eStage!=0\n    ){\n      rbu_file *pFd = (rbuIsVacuum(p) ? p->pRbuFd : p->pTargetFd);\n      if( pFd->iCookie!=pState->iCookie ){   \n        /* At this point (pTargetFd->iCookie) contains the value of the\n        ** change-counter cookie (the thing that gets incremented when a \n        ** transaction is committed in rollback mode) currently stored on \n        ** page 1 of the database file. */\n        p->rc = SQLITE_BUSY;\n        p->zErrmsg = sqlite3_mprintf(\"database modified during rbu %s\",\n            (rbuIsVacuum(p) ? \"vacuum\" : \"update\")\n        );\n      }\n    }\n\n    if( p->rc==SQLITE_OK ){\n      if( p->eStage==RBU_STAGE_OAL ){\n        sqlite3 *db = p->dbMain;\n        p->rc = sqlite3_exec(p->dbRbu, \"BEGIN\", 0, 0, &p->zErrmsg);\n\n        /* Point the object iterator at the first object */\n        if( p->rc==SQLITE_OK ){\n          p->rc = rbuObjIterFirst(p, &p->objiter);\n        }\n\n        /* If the RBU database contains no data_xxx tables, declare the RBU\n        ** update finished.  */\n        if( p->rc==SQLITE_OK && p->objiter.zTbl==0 ){\n          p->rc = SQLITE_DONE;\n          p->eStage = RBU_STAGE_DONE;\n        }else{\n          if( p->rc==SQLITE_OK && pState->eStage==0 && rbuIsVacuum(p) ){\n            rbuCopyPragma(p, \"page_size\");\n            rbuCopyPragma(p, \"auto_vacuum\");\n          }\n\n          /* Open transactions both databases. The *-oal file is opened or\n          ** created at this point. */\n          if( p->rc==SQLITE_OK ){\n            p->rc = sqlite3_exec(db, \"BEGIN IMMEDIATE\", 0, 0, &p->zErrmsg);\n          }\n\n          /* Check if the main database is a zipvfs db. If it is, set the upper\n          ** level pager to use \"journal_mode=off\". This prevents it from \n          ** generating a large journal using a temp file.  */\n          if( p->rc==SQLITE_OK ){\n            int frc = sqlite3_file_control(db, \"main\", SQLITE_FCNTL_ZIPVFS, 0);\n            if( frc==SQLITE_OK ){\n              p->rc = sqlite3_exec(\n                db, \"PRAGMA journal_mode=off\",0,0,&p->zErrmsg);\n            }\n          }\n\n          if( p->rc==SQLITE_OK ){\n            rbuSetupOal(p, pState);\n          }\n        }\n      }else if( p->eStage==RBU_STAGE_MOVE ){\n        /* no-op */\n      }else if( p->eStage==RBU_STAGE_CKPT ){\n        rbuSetupCheckpoint(p, pState);\n      }else if( p->eStage==RBU_STAGE_DONE ){\n        p->rc = SQLITE_DONE;\n      }else{\n        p->rc = SQLITE_CORRUPT;\n      }\n    }\n\n    rbuFreeState(pState);\n  }\n\n  return p;\n}\n\n/*\n** Allocate and return an RBU handle with all fields zeroed except for the\n** error code, which is set to SQLITE_MISUSE.\n*/\nstatic sqlite3rbu *rbuMisuseError(void){\n  sqlite3rbu *pRet;\n  pRet = sqlite3_malloc64(sizeof(sqlite3rbu));\n  if( pRet ){\n    memset(pRet, 0, sizeof(sqlite3rbu));\n    pRet->rc = SQLITE_MISUSE;\n  }\n  return pRet;\n}\n\n/*\n** Open and return a new RBU handle. \n*/\nsqlite3rbu *sqlite3rbu_open(\n  const char *zTarget, \n  const char *zRbu,\n  const char *zState\n){\n  if( zTarget==0 || zRbu==0 ){ return rbuMisuseError(); }\n  /* TODO: Check that zTarget and zRbu are non-NULL */\n  return openRbuHandle(zTarget, zRbu, zState);\n}\n\n/*\n** Open a handle to begin or resume an RBU VACUUM operation.\n*/\nsqlite3rbu *sqlite3rbu_vacuum(\n  const char *zTarget, \n  const char *zState\n){\n  if( zTarget==0 ){ return rbuMisuseError(); }\n  /* TODO: Check that both arguments are non-NULL */\n  return openRbuHandle(0, zTarget, zState);\n}\n\n/*\n** Return the database handle used by pRbu.\n*/\nsqlite3 *sqlite3rbu_db(sqlite3rbu *pRbu, int bRbu){\n  sqlite3 *db = 0;\n  if( pRbu ){\n    db = (bRbu ? pRbu->dbRbu : pRbu->dbMain);\n  }\n  return db;\n}\n\n\n/*\n** If the error code currently stored in the RBU handle is SQLITE_CONSTRAINT,\n** then edit any error message string so as to remove all occurrences of\n** the pattern \"rbu_imp_[0-9]*\".\n*/\nstatic void rbuEditErrmsg(sqlite3rbu *p){\n  if( p->rc==SQLITE_CONSTRAINT && p->zErrmsg ){\n    unsigned int i;\n    size_t nErrmsg = strlen(p->zErrmsg);\n    for(i=0; i<(nErrmsg-8); i++){\n      if( memcmp(&p->zErrmsg[i], \"rbu_imp_\", 8)==0 ){\n        int nDel = 8;\n        while( p->zErrmsg[i+nDel]>='0' && p->zErrmsg[i+nDel]<='9' ) nDel++;\n        memmove(&p->zErrmsg[i], &p->zErrmsg[i+nDel], nErrmsg + 1 - i - nDel);\n        nErrmsg -= nDel;\n      }\n    }\n  }\n}\n\n/*\n** Close the RBU handle.\n*/\nint sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){\n  int rc;\n  if( p ){\n\n    /* Commit the transaction to the *-oal file. */\n    if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_OAL ){\n      p->rc = sqlite3_exec(p->dbMain, \"COMMIT\", 0, 0, &p->zErrmsg);\n    }\n\n    rbuSaveState(p, p->eStage);\n\n    if( p->rc==SQLITE_OK && p->eStage==RBU_STAGE_OAL ){\n      p->rc = sqlite3_exec(p->dbRbu, \"COMMIT\", 0, 0, &p->zErrmsg);\n    }\n\n    /* Close any open statement handles. */\n    rbuObjIterFinalize(&p->objiter);\n\n    /* If this is an RBU vacuum handle and the vacuum has either finished\n    ** successfully or encountered an error, delete the contents of the \n    ** state table. This causes the next call to sqlite3rbu_vacuum() \n    ** specifying the current target and state databases to start a new\n    ** vacuum from scratch.  */\n    if( rbuIsVacuum(p) && p->rc!=SQLITE_OK && p->dbRbu ){\n      int rc2 = sqlite3_exec(p->dbRbu, \"DELETE FROM stat.rbu_state\", 0, 0, 0);\n      if( p->rc==SQLITE_DONE && rc2!=SQLITE_OK ) p->rc = rc2;\n    }\n\n    /* Close the open database handle and VFS object. */\n    sqlite3_close(p->dbRbu);\n    sqlite3_close(p->dbMain);\n    rbuDeleteVfs(p);\n    sqlite3_free(p->aBuf);\n    sqlite3_free(p->aFrame);\n\n    rbuEditErrmsg(p);\n    rc = p->rc;\n    *pzErrmsg = p->zErrmsg;\n    sqlite3_free(p->zState);\n    sqlite3_free(p);\n  }else{\n    rc = SQLITE_NOMEM;\n    *pzErrmsg = 0;\n  }\n  return rc;\n}\n\n/*\n** Return the total number of key-value operations (inserts, deletes or \n** updates) that have been performed on the target database since the\n** current RBU update was started.\n*/\nsqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu){\n  return pRbu->nProgress;\n}\n\n/*\n** Return permyriadage progress indications for the two main stages of\n** an RBU update.\n*/\nvoid sqlite3rbu_bp_progress(sqlite3rbu *p, int *pnOne, int *pnTwo){\n  const int MAX_PROGRESS = 10000;\n  switch( p->eStage ){\n    case RBU_STAGE_OAL:\n      if( p->nPhaseOneStep>0 ){\n        *pnOne = (int)(MAX_PROGRESS * (i64)p->nProgress/(i64)p->nPhaseOneStep);\n      }else{\n        *pnOne = -1;\n      }\n      *pnTwo = 0;\n      break;\n\n    case RBU_STAGE_MOVE:\n      *pnOne = MAX_PROGRESS;\n      *pnTwo = 0;\n      break;\n\n    case RBU_STAGE_CKPT:\n      *pnOne = MAX_PROGRESS;\n      *pnTwo = (int)(MAX_PROGRESS * (i64)p->nStep / (i64)p->nFrame);\n      break;\n\n    case RBU_STAGE_DONE:\n      *pnOne = MAX_PROGRESS;\n      *pnTwo = MAX_PROGRESS;\n      break;\n\n    default:\n      assert( 0 );\n  }\n}\n\n/*\n** Return the current state of the RBU vacuum or update operation.\n*/\nint sqlite3rbu_state(sqlite3rbu *p){\n  int aRes[] = {\n    0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE,\n    0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE\n  };\n\n  assert( RBU_STAGE_OAL==1 );\n  assert( RBU_STAGE_MOVE==2 );\n  assert( RBU_STAGE_CKPT==4 );\n  assert( RBU_STAGE_DONE==5 );\n  assert( aRes[RBU_STAGE_OAL]==SQLITE_RBU_STATE_OAL );\n  assert( aRes[RBU_STAGE_MOVE]==SQLITE_RBU_STATE_MOVE );\n  assert( aRes[RBU_STAGE_CKPT]==SQLITE_RBU_STATE_CHECKPOINT );\n  assert( aRes[RBU_STAGE_DONE]==SQLITE_RBU_STATE_DONE );\n\n  if( p->rc!=SQLITE_OK && p->rc!=SQLITE_DONE ){\n    return SQLITE_RBU_STATE_ERROR;\n  }else{\n    assert( p->rc!=SQLITE_DONE || p->eStage==RBU_STAGE_DONE );\n    assert( p->eStage==RBU_STAGE_OAL\n         || p->eStage==RBU_STAGE_MOVE\n         || p->eStage==RBU_STAGE_CKPT\n         || p->eStage==RBU_STAGE_DONE\n    );\n    return aRes[p->eStage];\n  }\n}\n\nint sqlite3rbu_savestate(sqlite3rbu *p){\n  int rc = p->rc;\n  if( rc==SQLITE_DONE ) return SQLITE_OK;\n\n  assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE );\n  if( p->eStage==RBU_STAGE_OAL ){\n    assert( rc!=SQLITE_DONE );\n    if( rc==SQLITE_OK ) rc = sqlite3_exec(p->dbMain, \"COMMIT\", 0, 0, 0);\n  }\n\n  p->rc = rc;\n  rbuSaveState(p, p->eStage);\n  rc = p->rc;\n\n  if( p->eStage==RBU_STAGE_OAL ){\n    assert( rc!=SQLITE_DONE );\n    if( rc==SQLITE_OK ) rc = sqlite3_exec(p->dbRbu, \"COMMIT\", 0, 0, 0);\n    if( rc==SQLITE_OK ) rc = sqlite3_exec(p->dbRbu, \"BEGIN IMMEDIATE\", 0, 0, 0);\n    if( rc==SQLITE_OK ) rc = sqlite3_exec(p->dbMain, \"BEGIN IMMEDIATE\", 0, 0,0);\n  }\n\n  p->rc = rc;\n  return rc;\n}\n\n/**************************************************************************\n** Beginning of RBU VFS shim methods. The VFS shim modifies the behaviour\n** of a standard VFS in the following ways:\n**\n** 1. Whenever the first page of a main database file is read or \n**    written, the value of the change-counter cookie is stored in\n**    rbu_file.iCookie. Similarly, the value of the \"write-version\"\n**    database header field is stored in rbu_file.iWriteVer. This ensures\n**    that the values are always trustworthy within an open transaction.\n**\n** 2. Whenever an SQLITE_OPEN_WAL file is opened, the (rbu_file.pWalFd)\n**    member variable of the associated database file descriptor is set\n**    to point to the new file. A mutex protected linked list of all main \n**    db fds opened using a particular RBU VFS is maintained at \n**    rbu_vfs.pMain to facilitate this.\n**\n** 3. Using a new file-control \"SQLITE_FCNTL_RBU\", a main db rbu_file \n**    object can be marked as the target database of an RBU update. This\n**    turns on the following extra special behaviour:\n**\n** 3a. If xAccess() is called to check if there exists a *-wal file \n**     associated with an RBU target database currently in RBU_STAGE_OAL\n**     stage (preparing the *-oal file), the following special handling\n**     applies:\n**\n**      * if the *-wal file does exist, return SQLITE_CANTOPEN. An RBU\n**        target database may not be in wal mode already.\n**\n**      * if the *-wal file does not exist, set the output parameter to\n**        non-zero (to tell SQLite that it does exist) anyway.\n**\n**     Then, when xOpen() is called to open the *-wal file associated with\n**     the RBU target in RBU_STAGE_OAL stage, instead of opening the *-wal\n**     file, the rbu vfs opens the corresponding *-oal file instead. \n**\n** 3b. The *-shm pages returned by xShmMap() for a target db file in\n**     RBU_STAGE_OAL mode are actually stored in heap memory. This is to\n**     avoid creating a *-shm file on disk. Additionally, xShmLock() calls\n**     are no-ops on target database files in RBU_STAGE_OAL mode. This is\n**     because assert() statements in some VFS implementations fail if \n**     xShmLock() is called before xShmMap().\n**\n** 3c. If an EXCLUSIVE lock is attempted on a target database file in any\n**     mode except RBU_STAGE_DONE (all work completed and checkpointed), it \n**     fails with an SQLITE_BUSY error. This is to stop RBU connections\n**     from automatically checkpointing a *-wal (or *-oal) file from within\n**     sqlite3_close().\n**\n** 3d. In RBU_STAGE_CAPTURE mode, all xRead() calls on the wal file, and\n**     all xWrite() calls on the target database file perform no IO. \n**     Instead the frame and page numbers that would be read and written\n**     are recorded. Additionally, successful attempts to obtain exclusive\n**     xShmLock() WRITER, CHECKPOINTER and READ0 locks on the target \n**     database file are recorded. xShmLock() calls to unlock the same\n**     locks are no-ops (so that once obtained, these locks are never\n**     relinquished). Finally, calls to xSync() on the target database\n**     file fail with SQLITE_INTERNAL errors.\n*/\n\nstatic void rbuUnlockShm(rbu_file *p){\n  if( p->pRbu ){\n    int (*xShmLock)(sqlite3_file*,int,int,int) = p->pReal->pMethods->xShmLock;\n    int i;\n    for(i=0; i<SQLITE_SHM_NLOCK;i++){\n      if( (1<<i) & p->pRbu->mLock ){\n        xShmLock(p->pReal, i, 1, SQLITE_SHM_UNLOCK|SQLITE_SHM_EXCLUSIVE);\n      }\n    }\n    p->pRbu->mLock = 0;\n  }\n}\n\n/*\n** Close an rbu file.\n*/\nstatic int rbuVfsClose(sqlite3_file *pFile){\n  rbu_file *p = (rbu_file*)pFile;\n  int rc;\n  int i;\n\n  /* Free the contents of the apShm[] array. And the array itself. */\n  for(i=0; i<p->nShm; i++){\n    sqlite3_free(p->apShm[i]);\n  }\n  sqlite3_free(p->apShm);\n  p->apShm = 0;\n  sqlite3_free(p->zDel);\n\n  if( p->openFlags & SQLITE_OPEN_MAIN_DB ){\n    rbu_file **pp;\n    sqlite3_mutex_enter(p->pRbuVfs->mutex);\n    for(pp=&p->pRbuVfs->pMain; *pp!=p; pp=&((*pp)->pMainNext));\n    *pp = p->pMainNext;\n    sqlite3_mutex_leave(p->pRbuVfs->mutex);\n    rbuUnlockShm(p);\n    p->pReal->pMethods->xShmUnmap(p->pReal, 0);\n  }\n\n  /* Close the underlying file handle */\n  rc = p->pReal->pMethods->xClose(p->pReal);\n  return rc;\n}\n\n\n/*\n** Read and return an unsigned 32-bit big-endian integer from the buffer \n** passed as the only argument.\n*/\nstatic u32 rbuGetU32(u8 *aBuf){\n  return ((u32)aBuf[0] << 24)\n       + ((u32)aBuf[1] << 16)\n       + ((u32)aBuf[2] <<  8)\n       + ((u32)aBuf[3]);\n}\n\n/*\n** Write an unsigned 32-bit value in big-endian format to the supplied\n** buffer.\n*/\nstatic void rbuPutU32(u8 *aBuf, u32 iVal){\n  aBuf[0] = (iVal >> 24) & 0xFF;\n  aBuf[1] = (iVal >> 16) & 0xFF;\n  aBuf[2] = (iVal >>  8) & 0xFF;\n  aBuf[3] = (iVal >>  0) & 0xFF;\n}\n\nstatic void rbuPutU16(u8 *aBuf, u16 iVal){\n  aBuf[0] = (iVal >>  8) & 0xFF;\n  aBuf[1] = (iVal >>  0) & 0xFF;\n}\n\n/*\n** Read data from an rbuVfs-file.\n*/\nstatic int rbuVfsRead(\n  sqlite3_file *pFile, \n  void *zBuf, \n  int iAmt, \n  sqlite_int64 iOfst\n){\n  rbu_file *p = (rbu_file*)pFile;\n  sqlite3rbu *pRbu = p->pRbu;\n  int rc;\n\n  if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){\n    assert( p->openFlags & SQLITE_OPEN_WAL );\n    rc = rbuCaptureWalRead(p->pRbu, iOfst, iAmt);\n  }else{\n    if( pRbu && pRbu->eStage==RBU_STAGE_OAL \n     && (p->openFlags & SQLITE_OPEN_WAL) \n     && iOfst>=pRbu->iOalSz \n    ){\n      rc = SQLITE_OK;\n      memset(zBuf, 0, iAmt);\n    }else{\n      rc = p->pReal->pMethods->xRead(p->pReal, zBuf, iAmt, iOfst);\n#if 1\n      /* If this is being called to read the first page of the target \n      ** database as part of an rbu vacuum operation, synthesize the \n      ** contents of the first page if it does not yet exist. Otherwise,\n      ** SQLite will not check for a *-wal file.  */\n      if( pRbu && rbuIsVacuum(pRbu) \n          && rc==SQLITE_IOERR_SHORT_READ && iOfst==0\n          && (p->openFlags & SQLITE_OPEN_MAIN_DB)\n          && pRbu->rc==SQLITE_OK\n      ){\n        sqlite3_file *pFd = (sqlite3_file*)pRbu->pRbuFd;\n        rc = pFd->pMethods->xRead(pFd, zBuf, iAmt, iOfst);\n        if( rc==SQLITE_OK ){\n          u8 *aBuf = (u8*)zBuf;\n          u32 iRoot = rbuGetU32(&aBuf[52]) ? 1 : 0;\n          rbuPutU32(&aBuf[52], iRoot);      /* largest root page number */\n          rbuPutU32(&aBuf[36], 0);          /* number of free pages */\n          rbuPutU32(&aBuf[32], 0);          /* first page on free list trunk */\n          rbuPutU32(&aBuf[28], 1);          /* size of db file in pages */\n          rbuPutU32(&aBuf[24], pRbu->pRbuFd->iCookie+1);  /* Change counter */\n\n          if( iAmt>100 ){\n            memset(&aBuf[100], 0, iAmt-100);\n            rbuPutU16(&aBuf[105], iAmt & 0xFFFF);\n            aBuf[100] = 0x0D;\n          }\n        }\n      }\n#endif\n    }\n    if( rc==SQLITE_OK && iOfst==0 && (p->openFlags & SQLITE_OPEN_MAIN_DB) ){\n      /* These look like magic numbers. But they are stable, as they are part\n       ** of the definition of the SQLite file format, which may not change. */\n      u8 *pBuf = (u8*)zBuf;\n      p->iCookie = rbuGetU32(&pBuf[24]);\n      p->iWriteVer = pBuf[19];\n    }\n  }\n  return rc;\n}\n\n/*\n** Write data to an rbuVfs-file.\n*/\nstatic int rbuVfsWrite(\n  sqlite3_file *pFile, \n  const void *zBuf, \n  int iAmt, \n  sqlite_int64 iOfst\n){\n  rbu_file *p = (rbu_file*)pFile;\n  sqlite3rbu *pRbu = p->pRbu;\n  int rc;\n\n  if( pRbu && pRbu->eStage==RBU_STAGE_CAPTURE ){\n    assert( p->openFlags & SQLITE_OPEN_MAIN_DB );\n    rc = rbuCaptureDbWrite(p->pRbu, iOfst);\n  }else{\n    if( pRbu && pRbu->eStage==RBU_STAGE_OAL \n     && (p->openFlags & SQLITE_OPEN_WAL) \n     && iOfst>=pRbu->iOalSz\n    ){\n      pRbu->iOalSz = iAmt + iOfst;\n    }\n    rc = p->pReal->pMethods->xWrite(p->pReal, zBuf, iAmt, iOfst);\n    if( rc==SQLITE_OK && iOfst==0 && (p->openFlags & SQLITE_OPEN_MAIN_DB) ){\n      /* These look like magic numbers. But they are stable, as they are part\n      ** of the definition of the SQLite file format, which may not change. */\n      u8 *pBuf = (u8*)zBuf;\n      p->iCookie = rbuGetU32(&pBuf[24]);\n      p->iWriteVer = pBuf[19];\n    }\n  }\n  return rc;\n}\n\n/*\n** Truncate an rbuVfs-file.\n*/\nstatic int rbuVfsTruncate(sqlite3_file *pFile, sqlite_int64 size){\n  rbu_file *p = (rbu_file*)pFile;\n  return p->pReal->pMethods->xTruncate(p->pReal, size);\n}\n\n/*\n** Sync an rbuVfs-file.\n*/\nstatic int rbuVfsSync(sqlite3_file *pFile, int flags){\n  rbu_file *p = (rbu_file *)pFile;\n  if( p->pRbu && p->pRbu->eStage==RBU_STAGE_CAPTURE ){\n    if( p->openFlags & SQLITE_OPEN_MAIN_DB ){\n      return SQLITE_INTERNAL;\n    }\n    return SQLITE_OK;\n  }\n  return p->pReal->pMethods->xSync(p->pReal, flags);\n}\n\n/*\n** Return the current file-size of an rbuVfs-file.\n*/\nstatic int rbuVfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){\n  rbu_file *p = (rbu_file *)pFile;\n  int rc;\n  rc = p->pReal->pMethods->xFileSize(p->pReal, pSize);\n\n  /* If this is an RBU vacuum operation and this is the target database,\n  ** pretend that it has at least one page. Otherwise, SQLite will not\n  ** check for the existance of a *-wal file. rbuVfsRead() contains \n  ** similar logic.  */\n  if( rc==SQLITE_OK && *pSize==0 \n   && p->pRbu && rbuIsVacuum(p->pRbu) \n   && (p->openFlags & SQLITE_OPEN_MAIN_DB)\n  ){\n    *pSize = 1024;\n  }\n  return rc;\n}\n\n/*\n** Lock an rbuVfs-file.\n*/\nstatic int rbuVfsLock(sqlite3_file *pFile, int eLock){\n  rbu_file *p = (rbu_file*)pFile;\n  sqlite3rbu *pRbu = p->pRbu;\n  int rc = SQLITE_OK;\n\n  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );\n  if( eLock==SQLITE_LOCK_EXCLUSIVE \n   && (p->bNolock || (pRbu && pRbu->eStage!=RBU_STAGE_DONE))\n  ){\n    /* Do not allow EXCLUSIVE locks. Preventing SQLite from taking this \n    ** prevents it from checkpointing the database from sqlite3_close(). */\n    rc = SQLITE_BUSY;\n  }else{\n    rc = p->pReal->pMethods->xLock(p->pReal, eLock);\n  }\n\n  return rc;\n}\n\n/*\n** Unlock an rbuVfs-file.\n*/\nstatic int rbuVfsUnlock(sqlite3_file *pFile, int eLock){\n  rbu_file *p = (rbu_file *)pFile;\n  return p->pReal->pMethods->xUnlock(p->pReal, eLock);\n}\n\n/*\n** Check if another file-handle holds a RESERVED lock on an rbuVfs-file.\n*/\nstatic int rbuVfsCheckReservedLock(sqlite3_file *pFile, int *pResOut){\n  rbu_file *p = (rbu_file *)pFile;\n  return p->pReal->pMethods->xCheckReservedLock(p->pReal, pResOut);\n}\n\n/*\n** File control method. For custom operations on an rbuVfs-file.\n*/\nstatic int rbuVfsFileControl(sqlite3_file *pFile, int op, void *pArg){\n  rbu_file *p = (rbu_file *)pFile;\n  int (*xControl)(sqlite3_file*,int,void*) = p->pReal->pMethods->xFileControl;\n  int rc;\n\n  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB)\n       || p->openFlags & (SQLITE_OPEN_TRANSIENT_DB|SQLITE_OPEN_TEMP_JOURNAL)\n  );\n  if( op==SQLITE_FCNTL_RBU ){\n    sqlite3rbu *pRbu = (sqlite3rbu*)pArg;\n\n    /* First try to find another RBU vfs lower down in the vfs stack. If\n    ** one is found, this vfs will operate in pass-through mode. The lower\n    ** level vfs will do the special RBU handling.  */\n    rc = xControl(p->pReal, op, pArg);\n\n    if( rc==SQLITE_NOTFOUND ){\n      /* Now search for a zipvfs instance lower down in the VFS stack. If\n      ** one is found, this is an error.  */\n      void *dummy = 0;\n      rc = xControl(p->pReal, SQLITE_FCNTL_ZIPVFS, &dummy);\n      if( rc==SQLITE_OK ){\n        rc = SQLITE_ERROR;\n        pRbu->zErrmsg = sqlite3_mprintf(\"rbu/zipvfs setup error\");\n      }else if( rc==SQLITE_NOTFOUND ){\n        pRbu->pTargetFd = p;\n        p->pRbu = pRbu;\n        if( p->pWalFd ) p->pWalFd->pRbu = pRbu;\n        rc = SQLITE_OK;\n      }\n    }\n    return rc;\n  }\n  else if( op==SQLITE_FCNTL_RBUCNT ){\n    sqlite3rbu *pRbu = (sqlite3rbu*)pArg;\n    pRbu->nRbu++;\n    pRbu->pRbuFd = p;\n    p->bNolock = 1;\n  }\n\n  rc = xControl(p->pReal, op, pArg);\n  if( rc==SQLITE_OK && op==SQLITE_FCNTL_VFSNAME ){\n    rbu_vfs *pRbuVfs = p->pRbuVfs;\n    char *zIn = *(char**)pArg;\n    char *zOut = sqlite3_mprintf(\"rbu(%s)/%z\", pRbuVfs->base.zName, zIn);\n    *(char**)pArg = zOut;\n    if( zOut==0 ) rc = SQLITE_NOMEM;\n  }\n\n  return rc;\n}\n\n/*\n** Return the sector-size in bytes for an rbuVfs-file.\n*/\nstatic int rbuVfsSectorSize(sqlite3_file *pFile){\n  rbu_file *p = (rbu_file *)pFile;\n  return p->pReal->pMethods->xSectorSize(p->pReal);\n}\n\n/*\n** Return the device characteristic flags supported by an rbuVfs-file.\n*/\nstatic int rbuVfsDeviceCharacteristics(sqlite3_file *pFile){\n  rbu_file *p = (rbu_file *)pFile;\n  return p->pReal->pMethods->xDeviceCharacteristics(p->pReal);\n}\n\n/*\n** Take or release a shared-memory lock.\n*/\nstatic int rbuVfsShmLock(sqlite3_file *pFile, int ofst, int n, int flags){\n  rbu_file *p = (rbu_file*)pFile;\n  sqlite3rbu *pRbu = p->pRbu;\n  int rc = SQLITE_OK;\n\n#ifdef SQLITE_AMALGAMATION\n    assert( WAL_CKPT_LOCK==1 );\n#endif\n\n  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );\n  if( pRbu && (pRbu->eStage==RBU_STAGE_OAL || pRbu->eStage==RBU_STAGE_MOVE) ){\n    /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from\n    ** taking this lock also prevents any checkpoints from occurring. \n    ** todo: really, it's not clear why this might occur, as \n    ** wal_autocheckpoint ought to be turned off.  */\n    if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY;\n  }else{\n    int bCapture = 0;\n    if( n==1 && (flags & SQLITE_SHM_EXCLUSIVE)\n     && pRbu && pRbu->eStage==RBU_STAGE_CAPTURE\n     && (ofst==WAL_LOCK_WRITE || ofst==WAL_LOCK_CKPT || ofst==WAL_LOCK_READ0)\n    ){\n      bCapture = 1;\n    }\n\n    if( bCapture==0 || 0==(flags & SQLITE_SHM_UNLOCK) ){\n      rc = p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);\n      if( bCapture && rc==SQLITE_OK ){\n        pRbu->mLock |= (1 << ofst);\n      }\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Obtain a pointer to a mapping of a single 32KiB page of the *-shm file.\n*/\nstatic int rbuVfsShmMap(\n  sqlite3_file *pFile, \n  int iRegion, \n  int szRegion, \n  int isWrite, \n  void volatile **pp\n){\n  rbu_file *p = (rbu_file*)pFile;\n  int rc = SQLITE_OK;\n  int eStage = (p->pRbu ? p->pRbu->eStage : 0);\n\n  /* If not in RBU_STAGE_OAL, allow this call to pass through. Or, if this\n  ** rbu is in the RBU_STAGE_OAL state, use heap memory for *-shm space \n  ** instead of a file on disk.  */\n  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );\n  if( eStage==RBU_STAGE_OAL || eStage==RBU_STAGE_MOVE ){\n    if( iRegion<=p->nShm ){\n      int nByte = (iRegion+1) * sizeof(char*);\n      char **apNew = (char**)sqlite3_realloc64(p->apShm, nByte);\n      if( apNew==0 ){\n        rc = SQLITE_NOMEM;\n      }else{\n        memset(&apNew[p->nShm], 0, sizeof(char*) * (1 + iRegion - p->nShm));\n        p->apShm = apNew;\n        p->nShm = iRegion+1;\n      }\n    }\n\n    if( rc==SQLITE_OK && p->apShm[iRegion]==0 ){\n      char *pNew = (char*)sqlite3_malloc64(szRegion);\n      if( pNew==0 ){\n        rc = SQLITE_NOMEM;\n      }else{\n        memset(pNew, 0, szRegion);\n        p->apShm[iRegion] = pNew;\n      }\n    }\n\n    if( rc==SQLITE_OK ){\n      *pp = p->apShm[iRegion];\n    }else{\n      *pp = 0;\n    }\n  }else{\n    assert( p->apShm==0 );\n    rc = p->pReal->pMethods->xShmMap(p->pReal, iRegion, szRegion, isWrite, pp);\n  }\n\n  return rc;\n}\n\n/*\n** Memory barrier.\n*/\nstatic void rbuVfsShmBarrier(sqlite3_file *pFile){\n  rbu_file *p = (rbu_file *)pFile;\n  p->pReal->pMethods->xShmBarrier(p->pReal);\n}\n\n/*\n** The xShmUnmap method.\n*/\nstatic int rbuVfsShmUnmap(sqlite3_file *pFile, int delFlag){\n  rbu_file *p = (rbu_file*)pFile;\n  int rc = SQLITE_OK;\n  int eStage = (p->pRbu ? p->pRbu->eStage : 0);\n\n  assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) );\n  if( eStage==RBU_STAGE_OAL || eStage==RBU_STAGE_MOVE ){\n    /* no-op */\n  }else{\n    /* Release the checkpointer and writer locks */\n    rbuUnlockShm(p);\n    rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);\n  }\n  return rc;\n}\n\n/*\n** Given that zWal points to a buffer containing a wal file name passed to \n** either the xOpen() or xAccess() VFS method, return a pointer to the\n** file-handle opened by the same database connection on the corresponding\n** database file.\n*/\nstatic rbu_file *rbuFindMaindb(rbu_vfs *pRbuVfs, const char *zWal){\n  rbu_file *pDb;\n  sqlite3_mutex_enter(pRbuVfs->mutex);\n  for(pDb=pRbuVfs->pMain; pDb && pDb->zWal!=zWal; pDb=pDb->pMainNext){}\n  sqlite3_mutex_leave(pRbuVfs->mutex);\n  return pDb;\n}\n\n/* \n** A main database named zName has just been opened. The following \n** function returns a pointer to a buffer owned by SQLite that contains\n** the name of the *-wal file this db connection will use. SQLite\n** happens to pass a pointer to this buffer when using xAccess()\n** or xOpen() to operate on the *-wal file.  \n*/\nstatic const char *rbuMainToWal(const char *zName, int flags){\n  int n = (int)strlen(zName);\n  const char *z = &zName[n];\n  if( flags & SQLITE_OPEN_URI ){\n    int odd = 0;\n    while( 1 ){\n      if( z[0]==0 ){\n        odd = 1 - odd;\n        if( odd && z[1]==0 ) break;\n      }\n      z++;\n    }\n    z += 2;\n  }else{\n    while( *z==0 ) z++;\n  }\n  z += (n + 8 + 1);\n  return z;\n}\n\n/*\n** Open an rbu file handle.\n*/\nstatic int rbuVfsOpen(\n  sqlite3_vfs *pVfs,\n  const char *zName,\n  sqlite3_file *pFile,\n  int flags,\n  int *pOutFlags\n){\n  static sqlite3_io_methods rbuvfs_io_methods = {\n    2,                            /* iVersion */\n    rbuVfsClose,                  /* xClose */\n    rbuVfsRead,                   /* xRead */\n    rbuVfsWrite,                  /* xWrite */\n    rbuVfsTruncate,               /* xTruncate */\n    rbuVfsSync,                   /* xSync */\n    rbuVfsFileSize,               /* xFileSize */\n    rbuVfsLock,                   /* xLock */\n    rbuVfsUnlock,                 /* xUnlock */\n    rbuVfsCheckReservedLock,      /* xCheckReservedLock */\n    rbuVfsFileControl,            /* xFileControl */\n    rbuVfsSectorSize,             /* xSectorSize */\n    rbuVfsDeviceCharacteristics,  /* xDeviceCharacteristics */\n    rbuVfsShmMap,                 /* xShmMap */\n    rbuVfsShmLock,                /* xShmLock */\n    rbuVfsShmBarrier,             /* xShmBarrier */\n    rbuVfsShmUnmap,               /* xShmUnmap */\n    0, 0                          /* xFetch, xUnfetch */\n  };\n  rbu_vfs *pRbuVfs = (rbu_vfs*)pVfs;\n  sqlite3_vfs *pRealVfs = pRbuVfs->pRealVfs;\n  rbu_file *pFd = (rbu_file *)pFile;\n  int rc = SQLITE_OK;\n  const char *zOpen = zName;\n  int oflags = flags;\n\n  memset(pFd, 0, sizeof(rbu_file));\n  pFd->pReal = (sqlite3_file*)&pFd[1];\n  pFd->pRbuVfs = pRbuVfs;\n  pFd->openFlags = flags;\n  if( zName ){\n    if( flags & SQLITE_OPEN_MAIN_DB ){\n      /* A main database has just been opened. The following block sets\n      ** (pFd->zWal) to point to a buffer owned by SQLite that contains\n      ** the name of the *-wal file this db connection will use. SQLite\n      ** happens to pass a pointer to this buffer when using xAccess()\n      ** or xOpen() to operate on the *-wal file.  */\n      pFd->zWal = rbuMainToWal(zName, flags);\n    }\n    else if( flags & SQLITE_OPEN_WAL ){\n      rbu_file *pDb = rbuFindMaindb(pRbuVfs, zName);\n      if( pDb ){\n        if( pDb->pRbu && pDb->pRbu->eStage==RBU_STAGE_OAL ){\n          /* This call is to open a *-wal file. Intead, open the *-oal. This\n          ** code ensures that the string passed to xOpen() is terminated by a\n          ** pair of '\\0' bytes in case the VFS attempts to extract a URI \n          ** parameter from it.  */\n          const char *zBase = zName;\n          size_t nCopy;\n          char *zCopy;\n          if( rbuIsVacuum(pDb->pRbu) ){\n            zBase = sqlite3_db_filename(pDb->pRbu->dbRbu, \"main\");\n            zBase = rbuMainToWal(zBase, SQLITE_OPEN_URI);\n          }\n          nCopy = strlen(zBase);\n          zCopy = sqlite3_malloc64(nCopy+2);\n          if( zCopy ){\n            memcpy(zCopy, zBase, nCopy);\n            zCopy[nCopy-3] = 'o';\n            zCopy[nCopy] = '\\0';\n            zCopy[nCopy+1] = '\\0';\n            zOpen = (const char*)(pFd->zDel = zCopy);\n          }else{\n            rc = SQLITE_NOMEM;\n          }\n          pFd->pRbu = pDb->pRbu;\n        }\n        pDb->pWalFd = pFd;\n      }\n    }\n  }\n\n  if( oflags & SQLITE_OPEN_MAIN_DB \n   && sqlite3_uri_boolean(zName, \"rbu_memory\", 0) \n  ){\n    assert( oflags & SQLITE_OPEN_MAIN_DB );\n    oflags =  SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |\n              SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE;\n    zOpen = 0;\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = pRealVfs->xOpen(pRealVfs, zOpen, pFd->pReal, oflags, pOutFlags);\n  }\n  if( pFd->pReal->pMethods ){\n    /* The xOpen() operation has succeeded. Set the sqlite3_file.pMethods\n    ** pointer and, if the file is a main database file, link it into the\n    ** mutex protected linked list of all such files.  */\n    pFile->pMethods = &rbuvfs_io_methods;\n    if( flags & SQLITE_OPEN_MAIN_DB ){\n      sqlite3_mutex_enter(pRbuVfs->mutex);\n      pFd->pMainNext = pRbuVfs->pMain;\n      pRbuVfs->pMain = pFd;\n      sqlite3_mutex_leave(pRbuVfs->mutex);\n    }\n  }else{\n    sqlite3_free(pFd->zDel);\n  }\n\n  return rc;\n}\n\n/*\n** Delete the file located at zPath.\n*/\nstatic int rbuVfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  return pRealVfs->xDelete(pRealVfs, zPath, dirSync);\n}\n\n/*\n** Test for access permissions. Return true if the requested permission\n** is available, or false otherwise.\n*/\nstatic int rbuVfsAccess(\n  sqlite3_vfs *pVfs, \n  const char *zPath, \n  int flags, \n  int *pResOut\n){\n  rbu_vfs *pRbuVfs = (rbu_vfs*)pVfs;\n  sqlite3_vfs *pRealVfs = pRbuVfs->pRealVfs;\n  int rc;\n\n  rc = pRealVfs->xAccess(pRealVfs, zPath, flags, pResOut);\n\n  /* If this call is to check if a *-wal file associated with an RBU target\n  ** database connection exists, and the RBU update is in RBU_STAGE_OAL,\n  ** the following special handling is activated:\n  **\n  **   a) if the *-wal file does exist, return SQLITE_CANTOPEN. This\n  **      ensures that the RBU extension never tries to update a database\n  **      in wal mode, even if the first page of the database file has\n  **      been damaged. \n  **\n  **   b) if the *-wal file does not exist, claim that it does anyway,\n  **      causing SQLite to call xOpen() to open it. This call will also\n  **      be intercepted (see the rbuVfsOpen() function) and the *-oal\n  **      file opened instead.\n  */\n  if( rc==SQLITE_OK && flags==SQLITE_ACCESS_EXISTS ){\n    rbu_file *pDb = rbuFindMaindb(pRbuVfs, zPath);\n    if( pDb && pDb->pRbu && pDb->pRbu->eStage==RBU_STAGE_OAL ){\n      if( *pResOut ){\n        rc = SQLITE_CANTOPEN;\n      }else{\n        *pResOut = 1;\n      }\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Populate buffer zOut with the full canonical pathname corresponding\n** to the pathname in zPath. zOut is guaranteed to point to a buffer\n** of at least (DEVSYM_MAX_PATHNAME+1) bytes.\n*/\nstatic int rbuVfsFullPathname(\n  sqlite3_vfs *pVfs, \n  const char *zPath, \n  int nOut, \n  char *zOut\n){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  return pRealVfs->xFullPathname(pRealVfs, zPath, nOut, zOut);\n}\n\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\n/*\n** Open the dynamic library located at zPath and return a handle.\n*/\nstatic void *rbuVfsDlOpen(sqlite3_vfs *pVfs, const char *zPath){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  return pRealVfs->xDlOpen(pRealVfs, zPath);\n}\n\n/*\n** Populate the buffer zErrMsg (size nByte bytes) with a human readable\n** utf-8 string describing the most recent error encountered associated \n** with dynamic libraries.\n*/\nstatic void rbuVfsDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  pRealVfs->xDlError(pRealVfs, nByte, zErrMsg);\n}\n\n/*\n** Return a pointer to the symbol zSymbol in the dynamic library pHandle.\n*/\nstatic void (*rbuVfsDlSym(\n  sqlite3_vfs *pVfs, \n  void *pArg, \n  const char *zSym\n))(void){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  return pRealVfs->xDlSym(pRealVfs, pArg, zSym);\n}\n\n/*\n** Close the dynamic library handle pHandle.\n*/\nstatic void rbuVfsDlClose(sqlite3_vfs *pVfs, void *pHandle){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  pRealVfs->xDlClose(pRealVfs, pHandle);\n}\n#endif /* SQLITE_OMIT_LOAD_EXTENSION */\n\n/*\n** Populate the buffer pointed to by zBufOut with nByte bytes of \n** random data.\n*/\nstatic int rbuVfsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  return pRealVfs->xRandomness(pRealVfs, nByte, zBufOut);\n}\n\n/*\n** Sleep for nMicro microseconds. Return the number of microseconds \n** actually slept.\n*/\nstatic int rbuVfsSleep(sqlite3_vfs *pVfs, int nMicro){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  return pRealVfs->xSleep(pRealVfs, nMicro);\n}\n\n/*\n** Return the current time as a Julian Day number in *pTimeOut.\n*/\nstatic int rbuVfsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){\n  sqlite3_vfs *pRealVfs = ((rbu_vfs*)pVfs)->pRealVfs;\n  return pRealVfs->xCurrentTime(pRealVfs, pTimeOut);\n}\n\n/*\n** No-op.\n*/\nstatic int rbuVfsGetLastError(sqlite3_vfs *pVfs, int a, char *b){\n  return 0;\n}\n\n/*\n** Deregister and destroy an RBU vfs created by an earlier call to\n** sqlite3rbu_create_vfs().\n*/\nvoid sqlite3rbu_destroy_vfs(const char *zName){\n  sqlite3_vfs *pVfs = sqlite3_vfs_find(zName);\n  if( pVfs && pVfs->xOpen==rbuVfsOpen ){\n    sqlite3_mutex_free(((rbu_vfs*)pVfs)->mutex);\n    sqlite3_vfs_unregister(pVfs);\n    sqlite3_free(pVfs);\n  }\n}\n\n/*\n** Create an RBU VFS named zName that accesses the underlying file-system\n** via existing VFS zParent. The new object is registered as a non-default\n** VFS with SQLite before returning.\n*/\nint sqlite3rbu_create_vfs(const char *zName, const char *zParent){\n\n  /* Template for VFS */\n  static sqlite3_vfs vfs_template = {\n    1,                            /* iVersion */\n    0,                            /* szOsFile */\n    0,                            /* mxPathname */\n    0,                            /* pNext */\n    0,                            /* zName */\n    0,                            /* pAppData */\n    rbuVfsOpen,                   /* xOpen */\n    rbuVfsDelete,                 /* xDelete */\n    rbuVfsAccess,                 /* xAccess */\n    rbuVfsFullPathname,           /* xFullPathname */\n\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\n    rbuVfsDlOpen,                 /* xDlOpen */\n    rbuVfsDlError,                /* xDlError */\n    rbuVfsDlSym,                  /* xDlSym */\n    rbuVfsDlClose,                /* xDlClose */\n#else\n    0, 0, 0, 0,\n#endif\n\n    rbuVfsRandomness,             /* xRandomness */\n    rbuVfsSleep,                  /* xSleep */\n    rbuVfsCurrentTime,            /* xCurrentTime */\n    rbuVfsGetLastError,           /* xGetLastError */\n    0,                            /* xCurrentTimeInt64 (version 2) */\n    0, 0, 0                       /* Unimplemented version 3 methods */\n  };\n\n  rbu_vfs *pNew = 0;              /* Newly allocated VFS */\n  int rc = SQLITE_OK;\n  size_t nName;\n  size_t nByte;\n\n  nName = strlen(zName);\n  nByte = sizeof(rbu_vfs) + nName + 1;\n  pNew = (rbu_vfs*)sqlite3_malloc64(nByte);\n  if( pNew==0 ){\n    rc = SQLITE_NOMEM;\n  }else{\n    sqlite3_vfs *pParent;           /* Parent VFS */\n    memset(pNew, 0, nByte);\n    pParent = sqlite3_vfs_find(zParent);\n    if( pParent==0 ){\n      rc = SQLITE_NOTFOUND;\n    }else{\n      char *zSpace;\n      memcpy(&pNew->base, &vfs_template, sizeof(sqlite3_vfs));\n      pNew->base.mxPathname = pParent->mxPathname;\n      pNew->base.szOsFile = sizeof(rbu_file) + pParent->szOsFile;\n      pNew->pRealVfs = pParent;\n      pNew->base.zName = (const char*)(zSpace = (char*)&pNew[1]);\n      memcpy(zSpace, zName, nName);\n\n      /* Allocate the mutex and register the new VFS (not as the default) */\n      pNew->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_RECURSIVE);\n      if( pNew->mutex==0 ){\n        rc = SQLITE_NOMEM;\n      }else{\n        rc = sqlite3_vfs_register(&pNew->base, 0);\n      }\n    }\n\n    if( rc!=SQLITE_OK ){\n      sqlite3_mutex_free(pNew->mutex);\n      sqlite3_free(pNew);\n    }\n  }\n\n  return rc;\n}\n\n\n/**************************************************************************/\n\n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RBU) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/rbu/sqlite3rbu.h",
    "content": "/*\n** 2014 August 30\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains the public interface for the RBU extension. \n*/\n\n/*\n** SUMMARY\n**\n** Writing a transaction containing a large number of operations on \n** b-tree indexes that are collectively larger than the available cache\n** memory can be very inefficient. \n**\n** The problem is that in order to update a b-tree, the leaf page (at least)\n** containing the entry being inserted or deleted must be modified. If the\n** working set of leaves is larger than the available cache memory, then a \n** single leaf that is modified more than once as part of the transaction \n** may be loaded from or written to the persistent media multiple times.\n** Additionally, because the index updates are likely to be applied in\n** random order, access to pages within the database is also likely to be in \n** random order, which is itself quite inefficient.\n**\n** One way to improve the situation is to sort the operations on each index\n** by index key before applying them to the b-tree. This leads to an IO\n** pattern that resembles a single linear scan through the index b-tree,\n** and all but guarantees each modified leaf page is loaded and stored \n** exactly once. SQLite uses this trick to improve the performance of\n** CREATE INDEX commands. This extension allows it to be used to improve\n** the performance of large transactions on existing databases.\n**\n** Additionally, this extension allows the work involved in writing the \n** large transaction to be broken down into sub-transactions performed \n** sequentially by separate processes. This is useful if the system cannot \n** guarantee that a single update process will run for long enough to apply \n** the entire update, for example because the update is being applied on a \n** mobile device that is frequently rebooted. Even after the writer process \n** has committed one or more sub-transactions, other database clients continue\n** to read from the original database snapshot. In other words, partially \n** applied transactions are not visible to other clients. \n**\n** \"RBU\" stands for \"Resumable Bulk Update\". As in a large database update\n** transmitted via a wireless network to a mobile device. A transaction\n** applied using this extension is hence refered to as an \"RBU update\".\n**\n**\n** LIMITATIONS\n**\n** An \"RBU update\" transaction is subject to the following limitations:\n**\n**   * The transaction must consist of INSERT, UPDATE and DELETE operations\n**     only.\n**\n**   * INSERT statements may not use any default values.\n**\n**   * UPDATE and DELETE statements must identify their target rows by \n**     non-NULL PRIMARY KEY values. Rows with NULL values stored in PRIMARY\n**     KEY fields may not be updated or deleted. If the table being written \n**     has no PRIMARY KEY, affected rows must be identified by rowid.\n**\n**   * UPDATE statements may not modify PRIMARY KEY columns.\n**\n**   * No triggers will be fired.\n**\n**   * No foreign key violations are detected or reported.\n**\n**   * CHECK constraints are not enforced.\n**\n**   * No constraint handling mode except for \"OR ROLLBACK\" is supported.\n**\n**\n** PREPARATION\n**\n** An \"RBU update\" is stored as a separate SQLite database. A database\n** containing an RBU update is an \"RBU database\". For each table in the \n** target database to be updated, the RBU database should contain a table\n** named \"data_<target name>\" containing the same set of columns as the\n** target table, and one more - \"rbu_control\". The data_% table should \n** have no PRIMARY KEY or UNIQUE constraints, but each column should have\n** the same type as the corresponding column in the target database.\n** The \"rbu_control\" column should have no type at all. For example, if\n** the target database contains:\n**\n**   CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c UNIQUE);\n**\n** Then the RBU database should contain:\n**\n**   CREATE TABLE data_t1(a INTEGER, b TEXT, c, rbu_control);\n**\n** The order of the columns in the data_% table does not matter.\n**\n** Instead of a regular table, the RBU database may also contain virtual\n** tables or view named using the data_<target> naming scheme. \n**\n** Instead of the plain data_<target> naming scheme, RBU database tables \n** may also be named data<integer>_<target>, where <integer> is any sequence\n** of zero or more numeric characters (0-9). This can be significant because\n** tables within the RBU database are always processed in order sorted by \n** name. By judicious selection of the <integer> portion of the names\n** of the RBU tables the user can therefore control the order in which they\n** are processed. This can be useful, for example, to ensure that \"external\n** content\" FTS4 tables are updated before their underlying content tables.\n**\n** If the target database table is a virtual table or a table that has no\n** PRIMARY KEY declaration, the data_% table must also contain a column \n** named \"rbu_rowid\". This column is mapped to the tables implicit primary \n** key column - \"rowid\". Virtual tables for which the \"rowid\" column does \n** not function like a primary key value cannot be updated using RBU. For \n** example, if the target db contains either of the following:\n**\n**   CREATE VIRTUAL TABLE x1 USING fts3(a, b);\n**   CREATE TABLE x1(a, b)\n**\n** then the RBU database should contain:\n**\n**   CREATE TABLE data_x1(a, b, rbu_rowid, rbu_control);\n**\n** All non-hidden columns (i.e. all columns matched by \"SELECT *\") of the\n** target table must be present in the input table. For virtual tables,\n** hidden columns are optional - they are updated by RBU if present in\n** the input table, or not otherwise. For example, to write to an fts4\n** table with a hidden languageid column such as:\n**\n**   CREATE VIRTUAL TABLE ft1 USING fts4(a, b, languageid='langid');\n**\n** Either of the following input table schemas may be used:\n**\n**   CREATE TABLE data_ft1(a, b, langid, rbu_rowid, rbu_control);\n**   CREATE TABLE data_ft1(a, b, rbu_rowid, rbu_control);\n**\n** For each row to INSERT into the target database as part of the RBU \n** update, the corresponding data_% table should contain a single record\n** with the \"rbu_control\" column set to contain integer value 0. The\n** other columns should be set to the values that make up the new record \n** to insert. \n**\n** If the target database table has an INTEGER PRIMARY KEY, it is not \n** possible to insert a NULL value into the IPK column. Attempting to \n** do so results in an SQLITE_MISMATCH error.\n**\n** For each row to DELETE from the target database as part of the RBU \n** update, the corresponding data_% table should contain a single record\n** with the \"rbu_control\" column set to contain integer value 1. The\n** real primary key values of the row to delete should be stored in the\n** corresponding columns of the data_% table. The values stored in the\n** other columns are not used.\n**\n** For each row to UPDATE from the target database as part of the RBU \n** update, the corresponding data_% table should contain a single record\n** with the \"rbu_control\" column set to contain a value of type text.\n** The real primary key values identifying the row to update should be \n** stored in the corresponding columns of the data_% table row, as should\n** the new values of all columns being update. The text value in the \n** \"rbu_control\" column must contain the same number of characters as\n** there are columns in the target database table, and must consist entirely\n** of 'x' and '.' characters (or in some special cases 'd' - see below). For \n** each column that is being updated, the corresponding character is set to\n** 'x'. For those that remain as they are, the corresponding character of the\n** rbu_control value should be set to '.'. For example, given the tables \n** above, the update statement:\n**\n**   UPDATE t1 SET c = 'usa' WHERE a = 4;\n**\n** is represented by the data_t1 row created by:\n**\n**   INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..x');\n**\n** Instead of an 'x' character, characters of the rbu_control value specified\n** for UPDATEs may also be set to 'd'. In this case, instead of updating the\n** target table with the value stored in the corresponding data_% column, the\n** user-defined SQL function \"rbu_delta()\" is invoked and the result stored in\n** the target table column. rbu_delta() is invoked with two arguments - the\n** original value currently stored in the target table column and the \n** value specified in the data_xxx table.\n**\n** For example, this row:\n**\n**   INSERT INTO data_t1(a, b, c, rbu_control) VALUES(4, NULL, 'usa', '..d');\n**\n** is similar to an UPDATE statement such as: \n**\n**   UPDATE t1 SET c = rbu_delta(c, 'usa') WHERE a = 4;\n**\n** Finally, if an 'f' character appears in place of a 'd' or 's' in an \n** ota_control string, the contents of the data_xxx table column is assumed\n** to be a \"fossil delta\" - a patch to be applied to a blob value in the\n** format used by the fossil source-code management system. In this case\n** the existing value within the target database table must be of type BLOB. \n** It is replaced by the result of applying the specified fossil delta to\n** itself.\n**\n** If the target database table is a virtual table or a table with no PRIMARY\n** KEY, the rbu_control value should not include a character corresponding \n** to the rbu_rowid value. For example, this:\n**\n**   INSERT INTO data_ft1(a, b, rbu_rowid, rbu_control) \n**       VALUES(NULL, 'usa', 12, '.x');\n**\n** causes a result similar to:\n**\n**   UPDATE ft1 SET b = 'usa' WHERE rowid = 12;\n**\n** The data_xxx tables themselves should have no PRIMARY KEY declarations.\n** However, RBU is more efficient if reading the rows in from each data_xxx\n** table in \"rowid\" order is roughly the same as reading them sorted by\n** the PRIMARY KEY of the corresponding target database table. In other \n** words, rows should be sorted using the destination table PRIMARY KEY \n** fields before they are inserted into the data_xxx tables.\n**\n** USAGE\n**\n** The API declared below allows an application to apply an RBU update \n** stored on disk to an existing target database. Essentially, the \n** application:\n**\n**     1) Opens an RBU handle using the sqlite3rbu_open() function.\n**\n**     2) Registers any required virtual table modules with the database\n**        handle returned by sqlite3rbu_db(). Also, if required, register\n**        the rbu_delta() implementation.\n**\n**     3) Calls the sqlite3rbu_step() function one or more times on\n**        the new handle. Each call to sqlite3rbu_step() performs a single\n**        b-tree operation, so thousands of calls may be required to apply \n**        a complete update.\n**\n**     4) Calls sqlite3rbu_close() to close the RBU update handle. If\n**        sqlite3rbu_step() has been called enough times to completely\n**        apply the update to the target database, then the RBU database\n**        is marked as fully applied. Otherwise, the state of the RBU \n**        update application is saved in the RBU database for later \n**        resumption.\n**\n** See comments below for more detail on APIs.\n**\n** If an update is only partially applied to the target database by the\n** time sqlite3rbu_close() is called, various state information is saved \n** within the RBU database. This allows subsequent processes to automatically\n** resume the RBU update from where it left off.\n**\n** To remove all RBU extension state information, returning an RBU database \n** to its original contents, it is sufficient to drop all tables that begin\n** with the prefix \"rbu_\"\n**\n** DATABASE LOCKING\n**\n** An RBU update may not be applied to a database in WAL mode. Attempting\n** to do so is an error (SQLITE_ERROR).\n**\n** While an RBU handle is open, a SHARED lock may be held on the target\n** database file. This means it is possible for other clients to read the\n** database, but not to write it.\n**\n** If an RBU update is started and then suspended before it is completed,\n** then an external client writes to the database, then attempting to resume\n** the suspended RBU update is also an error (SQLITE_BUSY).\n*/\n\n#ifndef _SQLITE3RBU_H\n#define _SQLITE3RBU_H\n\n#include \"sqlite3.h\"              /* Required for error code definitions */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct sqlite3rbu sqlite3rbu;\n\n/*\n** Open an RBU handle.\n**\n** Argument zTarget is the path to the target database. Argument zRbu is\n** the path to the RBU database. Each call to this function must be matched\n** by a call to sqlite3rbu_close(). When opening the databases, RBU passes\n** the SQLITE_CONFIG_URI flag to sqlite3_open_v2(). So if either zTarget\n** or zRbu begin with \"file:\", it will be interpreted as an SQLite \n** database URI, not a regular file name.\n**\n** If the zState argument is passed a NULL value, the RBU extension stores \n** the current state of the update (how many rows have been updated, which \n** indexes are yet to be updated etc.) within the RBU database itself. This\n** can be convenient, as it means that the RBU application does not need to\n** organize removing a separate state file after the update is concluded. \n** Or, if zState is non-NULL, it must be a path to a database file in which \n** the RBU extension can store the state of the update.\n**\n** When resuming an RBU update, the zState argument must be passed the same\n** value as when the RBU update was started.\n**\n** Once the RBU update is finished, the RBU extension does not \n** automatically remove any zState database file, even if it created it.\n**\n** By default, RBU uses the default VFS to access the files on disk. To\n** use a VFS other than the default, an SQLite \"file:\" URI containing a\n** \"vfs=...\" option may be passed as the zTarget option.\n**\n** IMPORTANT NOTE FOR ZIPVFS USERS: The RBU extension works with all of\n** SQLite's built-in VFSs, including the multiplexor VFS. However it does\n** not work out of the box with zipvfs. Refer to the comment describing\n** the zipvfs_create_vfs() API below for details on using RBU with zipvfs.\n*/\nsqlite3rbu *sqlite3rbu_open(\n  const char *zTarget, \n  const char *zRbu,\n  const char *zState\n);\n\n/*\n** Open an RBU handle to perform an RBU vacuum on database file zTarget.\n** An RBU vacuum is similar to SQLite's built-in VACUUM command, except\n** that it can be suspended and resumed like an RBU update.\n**\n** The second argument to this function identifies a database in which \n** to store the state of the RBU vacuum operation if it is suspended. The \n** first time sqlite3rbu_vacuum() is called, to start an RBU vacuum\n** operation, the state database should either not exist or be empty\n** (contain no tables). If an RBU vacuum is suspended by calling \n** sqlite3rbu_close() on the RBU handle before sqlite3rbu_step() has\n** returned SQLITE_DONE, the vacuum state is stored in the state database. \n** The vacuum can be resumed by calling this function to open a new RBU\n** handle specifying the same target and state databases.\n**\n** If the second argument passed to this function is NULL, then the\n** name of the state database is \"<database>-vacuum\", where <database>\n** is the name of the target database file. In this case, on UNIX, if the\n** state database is not already present in the file-system, it is created\n** with the same permissions as the target db is made.\n**\n** This function does not delete the state database after an RBU vacuum\n** is completed, even if it created it. However, if the call to\n** sqlite3rbu_close() returns any value other than SQLITE_OK, the contents\n** of the state tables within the state database are zeroed. This way,\n** the next call to sqlite3rbu_vacuum() opens a handle that starts a \n** new RBU vacuum operation.\n**\n** As with sqlite3rbu_open(), Zipvfs users should rever to the comment\n** describing the sqlite3rbu_create_vfs() API function below for \n** a description of the complications associated with using RBU with \n** zipvfs databases.\n*/\nsqlite3rbu *sqlite3rbu_vacuum(\n  const char *zTarget, \n  const char *zState\n);\n\n/*\n** Internally, each RBU connection uses a separate SQLite database \n** connection to access the target and rbu update databases. This\n** API allows the application direct access to these database handles.\n**\n** The first argument passed to this function must be a valid, open, RBU\n** handle. The second argument should be passed zero to access the target\n** database handle, or non-zero to access the rbu update database handle.\n** Accessing the underlying database handles may be useful in the\n** following scenarios:\n**\n**   * If any target tables are virtual tables, it may be necessary to\n**     call sqlite3_create_module() on the target database handle to \n**     register the required virtual table implementations.\n**\n**   * If the data_xxx tables in the RBU source database are virtual \n**     tables, the application may need to call sqlite3_create_module() on\n**     the rbu update db handle to any required virtual table\n**     implementations.\n**\n**   * If the application uses the \"rbu_delta()\" feature described above,\n**     it must use sqlite3_create_function() or similar to register the\n**     rbu_delta() implementation with the target database handle.\n**\n** If an error has occurred, either while opening or stepping the RBU object,\n** this function may return NULL. The error code and message may be collected\n** when sqlite3rbu_close() is called.\n**\n** Database handles returned by this function remain valid until the next\n** call to any sqlite3rbu_xxx() function other than sqlite3rbu_db().\n*/\nsqlite3 *sqlite3rbu_db(sqlite3rbu*, int bRbu);\n\n/*\n** Do some work towards applying the RBU update to the target db. \n**\n** Return SQLITE_DONE if the update has been completely applied, or \n** SQLITE_OK if no error occurs but there remains work to do to apply\n** the RBU update. If an error does occur, some other error code is \n** returned. \n**\n** Once a call to sqlite3rbu_step() has returned a value other than\n** SQLITE_OK, all subsequent calls on the same RBU handle are no-ops\n** that immediately return the same value.\n*/\nint sqlite3rbu_step(sqlite3rbu *pRbu);\n\n/*\n** Force RBU to save its state to disk.\n**\n** If a power failure or application crash occurs during an update, following\n** system recovery RBU may resume the update from the point at which the state\n** was last saved. In other words, from the most recent successful call to \n** sqlite3rbu_close() or this function.\n**\n** SQLITE_OK is returned if successful, or an SQLite error code otherwise.\n*/\nint sqlite3rbu_savestate(sqlite3rbu *pRbu);\n\n/*\n** Close an RBU handle. \n**\n** If the RBU update has been completely applied, mark the RBU database\n** as fully applied. Otherwise, assuming no error has occurred, save the\n** current state of the RBU update appliation to the RBU database.\n**\n** If an error has already occurred as part of an sqlite3rbu_step()\n** or sqlite3rbu_open() call, or if one occurs within this function, an\n** SQLite error code is returned. Additionally, *pzErrmsg may be set to\n** point to a buffer containing a utf-8 formatted English language error\n** message. It is the responsibility of the caller to eventually free any \n** such buffer using sqlite3_free().\n**\n** Otherwise, if no error occurs, this function returns SQLITE_OK if the\n** update has been partially applied, or SQLITE_DONE if it has been \n** completely applied.\n*/\nint sqlite3rbu_close(sqlite3rbu *pRbu, char **pzErrmsg);\n\n/*\n** Return the total number of key-value operations (inserts, deletes or \n** updates) that have been performed on the target database since the\n** current RBU update was started.\n*/\nsqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu);\n\n/*\n** Obtain permyriadage (permyriadage is to 10000 as percentage is to 100) \n** progress indications for the two stages of an RBU update. This API may\n** be useful for driving GUI progress indicators and similar.\n**\n** An RBU update is divided into two stages:\n**\n**   * Stage 1, in which changes are accumulated in an oal/wal file, and\n**   * Stage 2, in which the contents of the wal file are copied into the\n**     main database.\n**\n** The update is visible to non-RBU clients during stage 2. During stage 1\n** non-RBU reader clients may see the original database.\n**\n** If this API is called during stage 2 of the update, output variable \n** (*pnOne) is set to 10000 to indicate that stage 1 has finished and (*pnTwo)\n** to a value between 0 and 10000 to indicate the permyriadage progress of\n** stage 2. A value of 5000 indicates that stage 2 is half finished, \n** 9000 indicates that it is 90% finished, and so on.\n**\n** If this API is called during stage 1 of the update, output variable \n** (*pnTwo) is set to 0 to indicate that stage 2 has not yet started. The\n** value to which (*pnOne) is set depends on whether or not the RBU \n** database contains an \"rbu_count\" table. The rbu_count table, if it \n** exists, must contain the same columns as the following:\n**\n**   CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID;\n**\n** There must be one row in the table for each source (data_xxx) table within\n** the RBU database. The 'tbl' column should contain the name of the source\n** table. The 'cnt' column should contain the number of rows within the\n** source table.\n**\n** If the rbu_count table is present and populated correctly and this\n** API is called during stage 1, the *pnOne output variable is set to the\n** permyriadage progress of the same stage. If the rbu_count table does\n** not exist, then (*pnOne) is set to -1 during stage 1. If the rbu_count\n** table exists but is not correctly populated, the value of the *pnOne\n** output variable during stage 1 is undefined.\n*/\nvoid sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo);\n\n/*\n** Obtain an indication as to the current stage of an RBU update or vacuum.\n** This function always returns one of the SQLITE_RBU_STATE_XXX constants\n** defined in this file. Return values should be interpreted as follows:\n**\n** SQLITE_RBU_STATE_OAL:\n**   RBU is currently building a *-oal file. The next call to sqlite3rbu_step()\n**   may either add further data to the *-oal file, or compute data that will\n**   be added by a subsequent call.\n**\n** SQLITE_RBU_STATE_MOVE:\n**   RBU has finished building the *-oal file. The next call to sqlite3rbu_step()\n**   will move the *-oal file to the equivalent *-wal path. If the current\n**   operation is an RBU update, then the updated version of the database\n**   file will become visible to ordinary SQLite clients following the next\n**   call to sqlite3rbu_step().\n**\n** SQLITE_RBU_STATE_CHECKPOINT:\n**   RBU is currently performing an incremental checkpoint. The next call to\n**   sqlite3rbu_step() will copy a page of data from the *-wal file into\n**   the target database file.\n**\n** SQLITE_RBU_STATE_DONE:\n**   The RBU operation has finished. Any subsequent calls to sqlite3rbu_step()\n**   will immediately return SQLITE_DONE.\n**\n** SQLITE_RBU_STATE_ERROR:\n**   An error has occurred. Any subsequent calls to sqlite3rbu_step() will\n**   immediately return the SQLite error code associated with the error.\n*/\n#define SQLITE_RBU_STATE_OAL        1\n#define SQLITE_RBU_STATE_MOVE       2\n#define SQLITE_RBU_STATE_CHECKPOINT 3\n#define SQLITE_RBU_STATE_DONE       4\n#define SQLITE_RBU_STATE_ERROR      5\n\nint sqlite3rbu_state(sqlite3rbu *pRbu);\n\n/*\n** Create an RBU VFS named zName that accesses the underlying file-system\n** via existing VFS zParent. Or, if the zParent parameter is passed NULL, \n** then the new RBU VFS uses the default system VFS to access the file-system.\n** The new object is registered as a non-default VFS with SQLite before \n** returning.\n**\n** Part of the RBU implementation uses a custom VFS object. Usually, this\n** object is created and deleted automatically by RBU. \n**\n** The exception is for applications that also use zipvfs. In this case,\n** the custom VFS must be explicitly created by the user before the RBU\n** handle is opened. The RBU VFS should be installed so that the zipvfs\n** VFS uses the RBU VFS, which in turn uses any other VFS layers in use \n** (for example multiplexor) to access the file-system. For example,\n** to assemble an RBU enabled VFS stack that uses both zipvfs and \n** multiplexor (error checking omitted):\n**\n**     // Create a VFS named \"multiplex\" (not the default).\n**     sqlite3_multiplex_initialize(0, 0);\n**\n**     // Create an rbu VFS named \"rbu\" that uses multiplexor. If the\n**     // second argument were replaced with NULL, the \"rbu\" VFS would\n**     // access the file-system via the system default VFS, bypassing the\n**     // multiplexor.\n**     sqlite3rbu_create_vfs(\"rbu\", \"multiplex\");\n**\n**     // Create a zipvfs VFS named \"zipvfs\" that uses rbu.\n**     zipvfs_create_vfs_v3(\"zipvfs\", \"rbu\", 0, xCompressorAlgorithmDetector);\n**\n**     // Make zipvfs the default VFS.\n**     sqlite3_vfs_register(sqlite3_vfs_find(\"zipvfs\"), 1);\n**\n** Because the default VFS created above includes a RBU functionality, it\n** may be used by RBU clients. Attempting to use RBU with a zipvfs VFS stack\n** that does not include the RBU layer results in an error.\n**\n** The overhead of adding the \"rbu\" VFS to the system is negligible for \n** non-RBU users. There is no harm in an application accessing the \n** file-system via \"rbu\" all the time, even if it only uses RBU functionality \n** occasionally.\n*/\nint sqlite3rbu_create_vfs(const char *zName, const char *zParent);\n\n/*\n** Deregister and destroy an RBU vfs created by an earlier call to\n** sqlite3rbu_create_vfs().\n**\n** VFS objects are not reference counted. If a VFS object is destroyed\n** before all database handles that use it have been closed, the results\n** are undefined.\n*/\nvoid sqlite3rbu_destroy_vfs(const char *zName);\n\n#ifdef __cplusplus\n}  /* end of the 'extern \"C\"' block */\n#endif\n\n#endif /* _SQLITE3RBU_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/rtree/rtree.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code for implementations of the r-tree and r*-tree\n** algorithms packaged as an SQLite virtual table module.\n*/\n\n/*\n** Database Format of R-Tree Tables\n** --------------------------------\n**\n** The data structure for a single virtual r-tree table is stored in three \n** native SQLite tables declared as follows. In each case, the '%' character\n** in the table name is replaced with the user-supplied name of the r-tree\n** table.\n**\n**   CREATE TABLE %_node(nodeno INTEGER PRIMARY KEY, data BLOB)\n**   CREATE TABLE %_parent(nodeno INTEGER PRIMARY KEY, parentnode INTEGER)\n**   CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER)\n**\n** The data for each node of the r-tree structure is stored in the %_node\n** table. For each node that is not the root node of the r-tree, there is\n** an entry in the %_parent table associating the node with its parent.\n** And for each row of data in the table, there is an entry in the %_rowid\n** table that maps from the entries rowid to the id of the node that it\n** is stored on.\n**\n** The root node of an r-tree always exists, even if the r-tree table is\n** empty. The nodeno of the root node is always 1. All other nodes in the\n** table must be the same size as the root node. The content of each node\n** is formatted as follows:\n**\n**   1. If the node is the root node (node 1), then the first 2 bytes\n**      of the node contain the tree depth as a big-endian integer.\n**      For non-root nodes, the first 2 bytes are left unused.\n**\n**   2. The next 2 bytes contain the number of entries currently \n**      stored in the node.\n**\n**   3. The remainder of the node contains the node entries. Each entry\n**      consists of a single 8-byte integer followed by an even number\n**      of 4-byte coordinates. For leaf nodes the integer is the rowid\n**      of a record. For internal nodes it is the node number of a\n**      child page.\n*/\n\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RTREE)\n\n#ifndef SQLITE_CORE\n  #include \"sqlite3ext.h\"\n  SQLITE_EXTENSION_INIT1\n#else\n  #include \"sqlite3.h\"\n#endif\n\n#include <string.h>\n#include <assert.h>\n#include <stdio.h>\n\n#ifndef SQLITE_AMALGAMATION\n#include \"sqlite3rtree.h\"\ntypedef sqlite3_int64 i64;\ntypedef unsigned char u8;\ntypedef unsigned short u16;\ntypedef unsigned int u32;\n#endif\n\n/*  The following macro is used to suppress compiler warnings.\n*/\n#ifndef UNUSED_PARAMETER\n# define UNUSED_PARAMETER(x) (void)(x)\n#endif\n\ntypedef struct Rtree Rtree;\ntypedef struct RtreeCursor RtreeCursor;\ntypedef struct RtreeNode RtreeNode;\ntypedef struct RtreeCell RtreeCell;\ntypedef struct RtreeConstraint RtreeConstraint;\ntypedef struct RtreeMatchArg RtreeMatchArg;\ntypedef struct RtreeGeomCallback RtreeGeomCallback;\ntypedef union RtreeCoord RtreeCoord;\ntypedef struct RtreeSearchPoint RtreeSearchPoint;\n\n/* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */\n#define RTREE_MAX_DIMENSIONS 5\n\n/* Size of hash table Rtree.aHash. This hash table is not expected to\n** ever contain very many entries, so a fixed number of buckets is \n** used.\n*/\n#define HASHSIZE 97\n\n/* The xBestIndex method of this virtual table requires an estimate of\n** the number of rows in the virtual table to calculate the costs of\n** various strategies. If possible, this estimate is loaded from the\n** sqlite_stat1 table (with RTREE_MIN_ROWEST as a hard-coded minimum).\n** Otherwise, if no sqlite_stat1 entry is available, use \n** RTREE_DEFAULT_ROWEST.\n*/\n#define RTREE_DEFAULT_ROWEST 1048576\n#define RTREE_MIN_ROWEST         100\n\n/* \n** An rtree virtual-table object.\n*/\nstruct Rtree {\n  sqlite3_vtab base;          /* Base class.  Must be first */\n  sqlite3 *db;                /* Host database connection */\n  int iNodeSize;              /* Size in bytes of each node in the node table */\n  u8 nDim;                    /* Number of dimensions */\n  u8 eCoordType;              /* RTREE_COORD_REAL32 or RTREE_COORD_INT32 */\n  u8 nBytesPerCell;           /* Bytes consumed per cell */\n  int iDepth;                 /* Current depth of the r-tree structure */\n  char *zDb;                  /* Name of database containing r-tree table */\n  char *zName;                /* Name of r-tree table */ \n  int nBusy;                  /* Current number of users of this structure */\n  i64 nRowEst;                /* Estimated number of rows in this table */\n\n  /* List of nodes removed during a CondenseTree operation. List is\n  ** linked together via the pointer normally used for hash chains -\n  ** RtreeNode.pNext. RtreeNode.iNode stores the depth of the sub-tree \n  ** headed by the node (leaf nodes have RtreeNode.iNode==0).\n  */\n  RtreeNode *pDeleted;\n  int iReinsertHeight;        /* Height of sub-trees Reinsert() has run on */\n\n  /* Statements to read/write/delete a record from xxx_node */\n  sqlite3_stmt *pReadNode;\n  sqlite3_stmt *pWriteNode;\n  sqlite3_stmt *pDeleteNode;\n\n  /* Statements to read/write/delete a record from xxx_rowid */\n  sqlite3_stmt *pReadRowid;\n  sqlite3_stmt *pWriteRowid;\n  sqlite3_stmt *pDeleteRowid;\n\n  /* Statements to read/write/delete a record from xxx_parent */\n  sqlite3_stmt *pReadParent;\n  sqlite3_stmt *pWriteParent;\n  sqlite3_stmt *pDeleteParent;\n\n  RtreeNode *aHash[HASHSIZE]; /* Hash table of in-memory nodes. */ \n};\n\n/* Possible values for Rtree.eCoordType: */\n#define RTREE_COORD_REAL32 0\n#define RTREE_COORD_INT32  1\n\n/*\n** If SQLITE_RTREE_INT_ONLY is defined, then this virtual table will\n** only deal with integer coordinates.  No floating point operations\n** will be done.\n*/\n#ifdef SQLITE_RTREE_INT_ONLY\n  typedef sqlite3_int64 RtreeDValue;       /* High accuracy coordinate */\n  typedef int RtreeValue;                  /* Low accuracy coordinate */\n# define RTREE_ZERO 0\n#else\n  typedef double RtreeDValue;              /* High accuracy coordinate */\n  typedef float RtreeValue;                /* Low accuracy coordinate */\n# define RTREE_ZERO 0.0\n#endif\n\n/*\n** When doing a search of an r-tree, instances of the following structure\n** record intermediate results from the tree walk.\n**\n** The id is always a node-id.  For iLevel>=1 the id is the node-id of\n** the node that the RtreeSearchPoint represents.  When iLevel==0, however,\n** the id is of the parent node and the cell that RtreeSearchPoint\n** represents is the iCell-th entry in the parent node.\n*/\nstruct RtreeSearchPoint {\n  RtreeDValue rScore;    /* The score for this node.  Smallest goes first. */\n  sqlite3_int64 id;      /* Node ID */\n  u8 iLevel;             /* 0=entries.  1=leaf node.  2+ for higher */\n  u8 eWithin;            /* PARTLY_WITHIN or FULLY_WITHIN */\n  u8 iCell;              /* Cell index within the node */\n};\n\n/*\n** The minimum number of cells allowed for a node is a third of the \n** maximum. In Gutman's notation:\n**\n**     m = M/3\n**\n** If an R*-tree \"Reinsert\" operation is required, the same number of\n** cells are removed from the overfull node and reinserted into the tree.\n*/\n#define RTREE_MINCELLS(p) ((((p)->iNodeSize-4)/(p)->nBytesPerCell)/3)\n#define RTREE_REINSERT(p) RTREE_MINCELLS(p)\n#define RTREE_MAXCELLS 51\n\n/*\n** The smallest possible node-size is (512-64)==448 bytes. And the largest\n** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates).\n** Therefore all non-root nodes must contain at least 3 entries. Since \n** 2^40 is greater than 2^64, an r-tree structure always has a depth of\n** 40 or less.\n*/\n#define RTREE_MAX_DEPTH 40\n\n\n/*\n** Number of entries in the cursor RtreeNode cache.  The first entry is\n** used to cache the RtreeNode for RtreeCursor.sPoint.  The remaining\n** entries cache the RtreeNode for the first elements of the priority queue.\n*/\n#define RTREE_CACHE_SZ  5\n\n/* \n** An rtree cursor object.\n*/\nstruct RtreeCursor {\n  sqlite3_vtab_cursor base;         /* Base class.  Must be first */\n  u8 atEOF;                         /* True if at end of search */\n  u8 bPoint;                        /* True if sPoint is valid */\n  int iStrategy;                    /* Copy of idxNum search parameter */\n  int nConstraint;                  /* Number of entries in aConstraint */\n  RtreeConstraint *aConstraint;     /* Search constraints. */\n  int nPointAlloc;                  /* Number of slots allocated for aPoint[] */\n  int nPoint;                       /* Number of slots used in aPoint[] */\n  int mxLevel;                      /* iLevel value for root of the tree */\n  RtreeSearchPoint *aPoint;         /* Priority queue for search points */\n  RtreeSearchPoint sPoint;          /* Cached next search point */\n  RtreeNode *aNode[RTREE_CACHE_SZ]; /* Rtree node cache */\n  u32 anQueue[RTREE_MAX_DEPTH+1];   /* Number of queued entries by iLevel */\n};\n\n/* Return the Rtree of a RtreeCursor */\n#define RTREE_OF_CURSOR(X)   ((Rtree*)((X)->base.pVtab))\n\n/*\n** A coordinate can be either a floating point number or a integer.  All\n** coordinates within a single R-Tree are always of the same time.\n*/\nunion RtreeCoord {\n  RtreeValue f;      /* Floating point value */\n  int i;             /* Integer value */\n  u32 u;             /* Unsigned for byte-order conversions */\n};\n\n/*\n** The argument is an RtreeCoord. Return the value stored within the RtreeCoord\n** formatted as a RtreeDValue (double or int64). This macro assumes that local\n** variable pRtree points to the Rtree structure associated with the\n** RtreeCoord.\n*/\n#ifdef SQLITE_RTREE_INT_ONLY\n# define DCOORD(coord) ((RtreeDValue)coord.i)\n#else\n# define DCOORD(coord) (                           \\\n    (pRtree->eCoordType==RTREE_COORD_REAL32) ?      \\\n      ((double)coord.f) :                           \\\n      ((double)coord.i)                             \\\n  )\n#endif\n\n/*\n** A search constraint.\n*/\nstruct RtreeConstraint {\n  int iCoord;                     /* Index of constrained coordinate */\n  int op;                         /* Constraining operation */\n  union {\n    RtreeDValue rValue;             /* Constraint value. */\n    int (*xGeom)(sqlite3_rtree_geometry*,int,RtreeDValue*,int*);\n    int (*xQueryFunc)(sqlite3_rtree_query_info*);\n  } u;\n  sqlite3_rtree_query_info *pInfo;  /* xGeom and xQueryFunc argument */\n};\n\n/* Possible values for RtreeConstraint.op */\n#define RTREE_EQ    0x41  /* A */\n#define RTREE_LE    0x42  /* B */\n#define RTREE_LT    0x43  /* C */\n#define RTREE_GE    0x44  /* D */\n#define RTREE_GT    0x45  /* E */\n#define RTREE_MATCH 0x46  /* F: Old-style sqlite3_rtree_geometry_callback() */\n#define RTREE_QUERY 0x47  /* G: New-style sqlite3_rtree_query_callback() */\n\n\n/* \n** An rtree structure node.\n*/\nstruct RtreeNode {\n  RtreeNode *pParent;         /* Parent node */\n  i64 iNode;                  /* The node number */\n  int nRef;                   /* Number of references to this node */\n  int isDirty;                /* True if the node needs to be written to disk */\n  u8 *zData;                  /* Content of the node, as should be on disk */\n  RtreeNode *pNext;           /* Next node in this hash collision chain */\n};\n\n/* Return the number of cells in a node  */\n#define NCELL(pNode) readInt16(&(pNode)->zData[2])\n\n/* \n** A single cell from a node, deserialized\n*/\nstruct RtreeCell {\n  i64 iRowid;                                 /* Node or entry ID */\n  RtreeCoord aCoord[RTREE_MAX_DIMENSIONS*2];  /* Bounding box coordinates */\n};\n\n\n/*\n** This object becomes the sqlite3_user_data() for the SQL functions\n** that are created by sqlite3_rtree_geometry_callback() and\n** sqlite3_rtree_query_callback() and which appear on the right of MATCH\n** operators in order to constrain a search.\n**\n** xGeom and xQueryFunc are the callback functions.  Exactly one of \n** xGeom and xQueryFunc fields is non-NULL, depending on whether the\n** SQL function was created using sqlite3_rtree_geometry_callback() or\n** sqlite3_rtree_query_callback().\n** \n** This object is deleted automatically by the destructor mechanism in\n** sqlite3_create_function_v2().\n*/\nstruct RtreeGeomCallback {\n  int (*xGeom)(sqlite3_rtree_geometry*, int, RtreeDValue*, int*);\n  int (*xQueryFunc)(sqlite3_rtree_query_info*);\n  void (*xDestructor)(void*);\n  void *pContext;\n};\n\n\n/*\n** Value for the first field of every RtreeMatchArg object. The MATCH\n** operator tests that the first field of a blob operand matches this\n** value to avoid operating on invalid blobs (which could cause a segfault).\n*/\n#define RTREE_GEOMETRY_MAGIC 0x891245AB\n\n/*\n** An instance of this structure (in the form of a BLOB) is returned by\n** the SQL functions that sqlite3_rtree_geometry_callback() and\n** sqlite3_rtree_query_callback() create, and is read as the right-hand\n** operand to the MATCH operator of an R-Tree.\n*/\nstruct RtreeMatchArg {\n  u32 magic;                  /* Always RTREE_GEOMETRY_MAGIC */\n  RtreeGeomCallback cb;       /* Info about the callback functions */\n  int nParam;                 /* Number of parameters to the SQL function */\n  sqlite3_value **apSqlParam; /* Original SQL parameter values */\n  RtreeDValue aParam[1];      /* Values for parameters to the SQL function */\n};\n\n#ifndef MAX\n# define MAX(x,y) ((x) < (y) ? (y) : (x))\n#endif\n#ifndef MIN\n# define MIN(x,y) ((x) > (y) ? (y) : (x))\n#endif\n\n/*\n** Functions to deserialize a 16 bit integer, 32 bit real number and\n** 64 bit integer. The deserialized value is returned.\n*/\nstatic int readInt16(u8 *p){\n  return (p[0]<<8) + p[1];\n}\nstatic void readCoord(u8 *p, RtreeCoord *pCoord){\n  pCoord->u = (\n    (((u32)p[0]) << 24) + \n    (((u32)p[1]) << 16) + \n    (((u32)p[2]) <<  8) + \n    (((u32)p[3]) <<  0)\n  );\n}\nstatic i64 readInt64(u8 *p){\n  return (\n    (((i64)p[0]) << 56) + \n    (((i64)p[1]) << 48) + \n    (((i64)p[2]) << 40) + \n    (((i64)p[3]) << 32) + \n    (((i64)p[4]) << 24) + \n    (((i64)p[5]) << 16) + \n    (((i64)p[6]) <<  8) + \n    (((i64)p[7]) <<  0)\n  );\n}\n\n/*\n** Functions to serialize a 16 bit integer, 32 bit real number and\n** 64 bit integer. The value returned is the number of bytes written\n** to the argument buffer (always 2, 4 and 8 respectively).\n*/\nstatic int writeInt16(u8 *p, int i){\n  p[0] = (i>> 8)&0xFF;\n  p[1] = (i>> 0)&0xFF;\n  return 2;\n}\nstatic int writeCoord(u8 *p, RtreeCoord *pCoord){\n  u32 i;\n  assert( sizeof(RtreeCoord)==4 );\n  assert( sizeof(u32)==4 );\n  i = pCoord->u;\n  p[0] = (i>>24)&0xFF;\n  p[1] = (i>>16)&0xFF;\n  p[2] = (i>> 8)&0xFF;\n  p[3] = (i>> 0)&0xFF;\n  return 4;\n}\nstatic int writeInt64(u8 *p, i64 i){\n  p[0] = (i>>56)&0xFF;\n  p[1] = (i>>48)&0xFF;\n  p[2] = (i>>40)&0xFF;\n  p[3] = (i>>32)&0xFF;\n  p[4] = (i>>24)&0xFF;\n  p[5] = (i>>16)&0xFF;\n  p[6] = (i>> 8)&0xFF;\n  p[7] = (i>> 0)&0xFF;\n  return 8;\n}\n\n/*\n** Increment the reference count of node p.\n*/\nstatic void nodeReference(RtreeNode *p){\n  if( p ){\n    p->nRef++;\n  }\n}\n\n/*\n** Clear the content of node p (set all bytes to 0x00).\n*/\nstatic void nodeZero(Rtree *pRtree, RtreeNode *p){\n  memset(&p->zData[2], 0, pRtree->iNodeSize-2);\n  p->isDirty = 1;\n}\n\n/*\n** Given a node number iNode, return the corresponding key to use\n** in the Rtree.aHash table.\n*/\nstatic int nodeHash(i64 iNode){\n  return iNode % HASHSIZE;\n}\n\n/*\n** Search the node hash table for node iNode. If found, return a pointer\n** to it. Otherwise, return 0.\n*/\nstatic RtreeNode *nodeHashLookup(Rtree *pRtree, i64 iNode){\n  RtreeNode *p;\n  for(p=pRtree->aHash[nodeHash(iNode)]; p && p->iNode!=iNode; p=p->pNext);\n  return p;\n}\n\n/*\n** Add node pNode to the node hash table.\n*/\nstatic void nodeHashInsert(Rtree *pRtree, RtreeNode *pNode){\n  int iHash;\n  assert( pNode->pNext==0 );\n  iHash = nodeHash(pNode->iNode);\n  pNode->pNext = pRtree->aHash[iHash];\n  pRtree->aHash[iHash] = pNode;\n}\n\n/*\n** Remove node pNode from the node hash table.\n*/\nstatic void nodeHashDelete(Rtree *pRtree, RtreeNode *pNode){\n  RtreeNode **pp;\n  if( pNode->iNode!=0 ){\n    pp = &pRtree->aHash[nodeHash(pNode->iNode)];\n    for( ; (*pp)!=pNode; pp = &(*pp)->pNext){ assert(*pp); }\n    *pp = pNode->pNext;\n    pNode->pNext = 0;\n  }\n}\n\n/*\n** Allocate and return new r-tree node. Initially, (RtreeNode.iNode==0),\n** indicating that node has not yet been assigned a node number. It is\n** assigned a node number when nodeWrite() is called to write the\n** node contents out to the database.\n*/\nstatic RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){\n  RtreeNode *pNode;\n  pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode) + pRtree->iNodeSize);\n  if( pNode ){\n    memset(pNode, 0, sizeof(RtreeNode) + pRtree->iNodeSize);\n    pNode->zData = (u8 *)&pNode[1];\n    pNode->nRef = 1;\n    pNode->pParent = pParent;\n    pNode->isDirty = 1;\n    nodeReference(pParent);\n  }\n  return pNode;\n}\n\n/*\n** Obtain a reference to an r-tree node.\n*/\nstatic int nodeAcquire(\n  Rtree *pRtree,             /* R-tree structure */\n  i64 iNode,                 /* Node number to load */\n  RtreeNode *pParent,        /* Either the parent node or NULL */\n  RtreeNode **ppNode         /* OUT: Acquired node */\n){\n  int rc;\n  int rc2 = SQLITE_OK;\n  RtreeNode *pNode;\n\n  /* Check if the requested node is already in the hash table. If so,\n  ** increase its reference count and return it.\n  */\n  if( (pNode = nodeHashLookup(pRtree, iNode)) ){\n    assert( !pParent || !pNode->pParent || pNode->pParent==pParent );\n    if( pParent && !pNode->pParent ){\n      nodeReference(pParent);\n      pNode->pParent = pParent;\n    }\n    pNode->nRef++;\n    *ppNode = pNode;\n    return SQLITE_OK;\n  }\n\n  sqlite3_bind_int64(pRtree->pReadNode, 1, iNode);\n  rc = sqlite3_step(pRtree->pReadNode);\n  if( rc==SQLITE_ROW ){\n    const u8 *zBlob = sqlite3_column_blob(pRtree->pReadNode, 0);\n    if( pRtree->iNodeSize==sqlite3_column_bytes(pRtree->pReadNode, 0) ){\n      pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode)+pRtree->iNodeSize);\n      if( !pNode ){\n        rc2 = SQLITE_NOMEM;\n      }else{\n        pNode->pParent = pParent;\n        pNode->zData = (u8 *)&pNode[1];\n        pNode->nRef = 1;\n        pNode->iNode = iNode;\n        pNode->isDirty = 0;\n        pNode->pNext = 0;\n        memcpy(pNode->zData, zBlob, pRtree->iNodeSize);\n        nodeReference(pParent);\n      }\n    }\n  }\n  rc = sqlite3_reset(pRtree->pReadNode);\n  if( rc==SQLITE_OK ) rc = rc2;\n\n  /* If the root node was just loaded, set pRtree->iDepth to the height\n  ** of the r-tree structure. A height of zero means all data is stored on\n  ** the root node. A height of one means the children of the root node\n  ** are the leaves, and so on. If the depth as specified on the root node\n  ** is greater than RTREE_MAX_DEPTH, the r-tree structure must be corrupt.\n  */\n  if( pNode && iNode==1 ){\n    pRtree->iDepth = readInt16(pNode->zData);\n    if( pRtree->iDepth>RTREE_MAX_DEPTH ){\n      rc = SQLITE_CORRUPT_VTAB;\n    }\n  }\n\n  /* If no error has occurred so far, check if the \"number of entries\"\n  ** field on the node is too large. If so, set the return code to \n  ** SQLITE_CORRUPT_VTAB.\n  */\n  if( pNode && rc==SQLITE_OK ){\n    if( NCELL(pNode)>((pRtree->iNodeSize-4)/pRtree->nBytesPerCell) ){\n      rc = SQLITE_CORRUPT_VTAB;\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    if( pNode!=0 ){\n      nodeHashInsert(pRtree, pNode);\n    }else{\n      rc = SQLITE_CORRUPT_VTAB;\n    }\n    *ppNode = pNode;\n  }else{\n    sqlite3_free(pNode);\n    *ppNode = 0;\n  }\n\n  return rc;\n}\n\n/*\n** Overwrite cell iCell of node pNode with the contents of pCell.\n*/\nstatic void nodeOverwriteCell(\n  Rtree *pRtree,             /* The overall R-Tree */\n  RtreeNode *pNode,          /* The node into which the cell is to be written */\n  RtreeCell *pCell,          /* The cell to write */\n  int iCell                  /* Index into pNode into which pCell is written */\n){\n  int ii;\n  u8 *p = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];\n  p += writeInt64(p, pCell->iRowid);\n  for(ii=0; ii<(pRtree->nDim*2); ii++){\n    p += writeCoord(p, &pCell->aCoord[ii]);\n  }\n  pNode->isDirty = 1;\n}\n\n/*\n** Remove the cell with index iCell from node pNode.\n*/\nstatic void nodeDeleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell){\n  u8 *pDst = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];\n  u8 *pSrc = &pDst[pRtree->nBytesPerCell];\n  int nByte = (NCELL(pNode) - iCell - 1) * pRtree->nBytesPerCell;\n  memmove(pDst, pSrc, nByte);\n  writeInt16(&pNode->zData[2], NCELL(pNode)-1);\n  pNode->isDirty = 1;\n}\n\n/*\n** Insert the contents of cell pCell into node pNode. If the insert\n** is successful, return SQLITE_OK.\n**\n** If there is not enough free space in pNode, return SQLITE_FULL.\n*/\nstatic int nodeInsertCell(\n  Rtree *pRtree,                /* The overall R-Tree */\n  RtreeNode *pNode,             /* Write new cell into this node */\n  RtreeCell *pCell              /* The cell to be inserted */\n){\n  int nCell;                    /* Current number of cells in pNode */\n  int nMaxCell;                 /* Maximum number of cells for pNode */\n\n  nMaxCell = (pRtree->iNodeSize-4)/pRtree->nBytesPerCell;\n  nCell = NCELL(pNode);\n\n  assert( nCell<=nMaxCell );\n  if( nCell<nMaxCell ){\n    nodeOverwriteCell(pRtree, pNode, pCell, nCell);\n    writeInt16(&pNode->zData[2], nCell+1);\n    pNode->isDirty = 1;\n  }\n\n  return (nCell==nMaxCell);\n}\n\n/*\n** If the node is dirty, write it out to the database.\n*/\nstatic int nodeWrite(Rtree *pRtree, RtreeNode *pNode){\n  int rc = SQLITE_OK;\n  if( pNode->isDirty ){\n    sqlite3_stmt *p = pRtree->pWriteNode;\n    if( pNode->iNode ){\n      sqlite3_bind_int64(p, 1, pNode->iNode);\n    }else{\n      sqlite3_bind_null(p, 1);\n    }\n    sqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC);\n    sqlite3_step(p);\n    pNode->isDirty = 0;\n    rc = sqlite3_reset(p);\n    if( pNode->iNode==0 && rc==SQLITE_OK ){\n      pNode->iNode = sqlite3_last_insert_rowid(pRtree->db);\n      nodeHashInsert(pRtree, pNode);\n    }\n  }\n  return rc;\n}\n\n/*\n** Release a reference to a node. If the node is dirty and the reference\n** count drops to zero, the node data is written to the database.\n*/\nstatic int nodeRelease(Rtree *pRtree, RtreeNode *pNode){\n  int rc = SQLITE_OK;\n  if( pNode ){\n    assert( pNode->nRef>0 );\n    pNode->nRef--;\n    if( pNode->nRef==0 ){\n      if( pNode->iNode==1 ){\n        pRtree->iDepth = -1;\n      }\n      if( pNode->pParent ){\n        rc = nodeRelease(pRtree, pNode->pParent);\n      }\n      if( rc==SQLITE_OK ){\n        rc = nodeWrite(pRtree, pNode);\n      }\n      nodeHashDelete(pRtree, pNode);\n      sqlite3_free(pNode);\n    }\n  }\n  return rc;\n}\n\n/*\n** Return the 64-bit integer value associated with cell iCell of\n** node pNode. If pNode is a leaf node, this is a rowid. If it is\n** an internal node, then the 64-bit integer is a child page number.\n*/\nstatic i64 nodeGetRowid(\n  Rtree *pRtree,       /* The overall R-Tree */\n  RtreeNode *pNode,    /* The node from which to extract the ID */\n  int iCell            /* The cell index from which to extract the ID */\n){\n  assert( iCell<NCELL(pNode) );\n  return readInt64(&pNode->zData[4 + pRtree->nBytesPerCell*iCell]);\n}\n\n/*\n** Return coordinate iCoord from cell iCell in node pNode.\n*/\nstatic void nodeGetCoord(\n  Rtree *pRtree,               /* The overall R-Tree */\n  RtreeNode *pNode,            /* The node from which to extract a coordinate */\n  int iCell,                   /* The index of the cell within the node */\n  int iCoord,                  /* Which coordinate to extract */\n  RtreeCoord *pCoord           /* OUT: Space to write result to */\n){\n  readCoord(&pNode->zData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord);\n}\n\n/*\n** Deserialize cell iCell of node pNode. Populate the structure pointed\n** to by pCell with the results.\n*/\nstatic void nodeGetCell(\n  Rtree *pRtree,               /* The overall R-Tree */\n  RtreeNode *pNode,            /* The node containing the cell to be read */\n  int iCell,                   /* Index of the cell within the node */\n  RtreeCell *pCell             /* OUT: Write the cell contents here */\n){\n  u8 *pData;\n  RtreeCoord *pCoord;\n  int ii;\n  pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell);\n  pData = pNode->zData + (12 + pRtree->nBytesPerCell*iCell);\n  pCoord = pCell->aCoord;\n  for(ii=0; ii<pRtree->nDim*2; ii++){\n    readCoord(&pData[ii*4], &pCoord[ii]);\n  }\n}\n\n\n/* Forward declaration for the function that does the work of\n** the virtual table module xCreate() and xConnect() methods.\n*/\nstatic int rtreeInit(\n  sqlite3 *, void *, int, const char *const*, sqlite3_vtab **, char **, int\n);\n\n/* \n** Rtree virtual table module xCreate method.\n*/\nstatic int rtreeCreate(\n  sqlite3 *db,\n  void *pAux,\n  int argc, const char *const*argv,\n  sqlite3_vtab **ppVtab,\n  char **pzErr\n){\n  return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 1);\n}\n\n/* \n** Rtree virtual table module xConnect method.\n*/\nstatic int rtreeConnect(\n  sqlite3 *db,\n  void *pAux,\n  int argc, const char *const*argv,\n  sqlite3_vtab **ppVtab,\n  char **pzErr\n){\n  return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 0);\n}\n\n/*\n** Increment the r-tree reference count.\n*/\nstatic void rtreeReference(Rtree *pRtree){\n  pRtree->nBusy++;\n}\n\n/*\n** Decrement the r-tree reference count. When the reference count reaches\n** zero the structure is deleted.\n*/\nstatic void rtreeRelease(Rtree *pRtree){\n  pRtree->nBusy--;\n  if( pRtree->nBusy==0 ){\n    sqlite3_finalize(pRtree->pReadNode);\n    sqlite3_finalize(pRtree->pWriteNode);\n    sqlite3_finalize(pRtree->pDeleteNode);\n    sqlite3_finalize(pRtree->pReadRowid);\n    sqlite3_finalize(pRtree->pWriteRowid);\n    sqlite3_finalize(pRtree->pDeleteRowid);\n    sqlite3_finalize(pRtree->pReadParent);\n    sqlite3_finalize(pRtree->pWriteParent);\n    sqlite3_finalize(pRtree->pDeleteParent);\n    sqlite3_free(pRtree);\n  }\n}\n\n/* \n** Rtree virtual table module xDisconnect method.\n*/\nstatic int rtreeDisconnect(sqlite3_vtab *pVtab){\n  rtreeRelease((Rtree *)pVtab);\n  return SQLITE_OK;\n}\n\n/* \n** Rtree virtual table module xDestroy method.\n*/\nstatic int rtreeDestroy(sqlite3_vtab *pVtab){\n  Rtree *pRtree = (Rtree *)pVtab;\n  int rc;\n  char *zCreate = sqlite3_mprintf(\n    \"DROP TABLE '%q'.'%q_node';\"\n    \"DROP TABLE '%q'.'%q_rowid';\"\n    \"DROP TABLE '%q'.'%q_parent';\",\n    pRtree->zDb, pRtree->zName, \n    pRtree->zDb, pRtree->zName,\n    pRtree->zDb, pRtree->zName\n  );\n  if( !zCreate ){\n    rc = SQLITE_NOMEM;\n  }else{\n    rc = sqlite3_exec(pRtree->db, zCreate, 0, 0, 0);\n    sqlite3_free(zCreate);\n  }\n  if( rc==SQLITE_OK ){\n    rtreeRelease(pRtree);\n  }\n\n  return rc;\n}\n\n/* \n** Rtree virtual table module xOpen method.\n*/\nstatic int rtreeOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){\n  int rc = SQLITE_NOMEM;\n  RtreeCursor *pCsr;\n\n  pCsr = (RtreeCursor *)sqlite3_malloc(sizeof(RtreeCursor));\n  if( pCsr ){\n    memset(pCsr, 0, sizeof(RtreeCursor));\n    pCsr->base.pVtab = pVTab;\n    rc = SQLITE_OK;\n  }\n  *ppCursor = (sqlite3_vtab_cursor *)pCsr;\n\n  return rc;\n}\n\n\n/*\n** Free the RtreeCursor.aConstraint[] array and its contents.\n*/\nstatic void freeCursorConstraints(RtreeCursor *pCsr){\n  if( pCsr->aConstraint ){\n    int i;                        /* Used to iterate through constraint array */\n    for(i=0; i<pCsr->nConstraint; i++){\n      sqlite3_rtree_query_info *pInfo = pCsr->aConstraint[i].pInfo;\n      if( pInfo ){\n        if( pInfo->xDelUser ) pInfo->xDelUser(pInfo->pUser);\n        sqlite3_free(pInfo);\n      }\n    }\n    sqlite3_free(pCsr->aConstraint);\n    pCsr->aConstraint = 0;\n  }\n}\n\n/* \n** Rtree virtual table module xClose method.\n*/\nstatic int rtreeClose(sqlite3_vtab_cursor *cur){\n  Rtree *pRtree = (Rtree *)(cur->pVtab);\n  int ii;\n  RtreeCursor *pCsr = (RtreeCursor *)cur;\n  freeCursorConstraints(pCsr);\n  sqlite3_free(pCsr->aPoint);\n  for(ii=0; ii<RTREE_CACHE_SZ; ii++) nodeRelease(pRtree, pCsr->aNode[ii]);\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\n/*\n** Rtree virtual table module xEof method.\n**\n** Return non-zero if the cursor does not currently point to a valid \n** record (i.e if the scan has finished), or zero otherwise.\n*/\nstatic int rtreeEof(sqlite3_vtab_cursor *cur){\n  RtreeCursor *pCsr = (RtreeCursor *)cur;\n  return pCsr->atEOF;\n}\n\n/*\n** Convert raw bits from the on-disk RTree record into a coordinate value.\n** The on-disk format is big-endian and needs to be converted for little-\n** endian platforms.  The on-disk record stores integer coordinates if\n** eInt is true and it stores 32-bit floating point records if eInt is\n** false.  a[] is the four bytes of the on-disk record to be decoded.\n** Store the results in \"r\".\n**\n** There are three versions of this macro, one each for little-endian and\n** big-endian processors and a third generic implementation.  The endian-\n** specific implementations are much faster and are preferred if the\n** processor endianness is known at compile-time.  The SQLITE_BYTEORDER\n** macro is part of sqliteInt.h and hence the endian-specific\n** implementation will only be used if this module is compiled as part\n** of the amalgamation.\n*/\n#if defined(SQLITE_BYTEORDER) && SQLITE_BYTEORDER==1234\n#define RTREE_DECODE_COORD(eInt, a, r) {                        \\\n    RtreeCoord c;    /* Coordinate decoded */                   \\\n    memcpy(&c.u,a,4);                                           \\\n    c.u = ((c.u>>24)&0xff)|((c.u>>8)&0xff00)|                   \\\n          ((c.u&0xff)<<24)|((c.u&0xff00)<<8);                   \\\n    r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \\\n}\n#elif defined(SQLITE_BYTEORDER) && SQLITE_BYTEORDER==4321\n#define RTREE_DECODE_COORD(eInt, a, r) {                        \\\n    RtreeCoord c;    /* Coordinate decoded */                   \\\n    memcpy(&c.u,a,4);                                           \\\n    r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \\\n}\n#else\n#define RTREE_DECODE_COORD(eInt, a, r) {                        \\\n    RtreeCoord c;    /* Coordinate decoded */                   \\\n    c.u = ((u32)a[0]<<24) + ((u32)a[1]<<16)                     \\\n           +((u32)a[2]<<8) + a[3];                              \\\n    r = eInt ? (sqlite3_rtree_dbl)c.i : (sqlite3_rtree_dbl)c.f; \\\n}\n#endif\n\n/*\n** Check the RTree node or entry given by pCellData and p against the MATCH\n** constraint pConstraint.  \n*/\nstatic int rtreeCallbackConstraint(\n  RtreeConstraint *pConstraint,  /* The constraint to test */\n  int eInt,                      /* True if RTree holding integer coordinates */\n  u8 *pCellData,                 /* Raw cell content */\n  RtreeSearchPoint *pSearch,     /* Container of this cell */\n  sqlite3_rtree_dbl *prScore,    /* OUT: score for the cell */\n  int *peWithin                  /* OUT: visibility of the cell */\n){\n  int i;                                                /* Loop counter */\n  sqlite3_rtree_query_info *pInfo = pConstraint->pInfo; /* Callback info */\n  int nCoord = pInfo->nCoord;                           /* No. of coordinates */\n  int rc;                                             /* Callback return code */\n  sqlite3_rtree_dbl aCoord[RTREE_MAX_DIMENSIONS*2];   /* Decoded coordinates */\n\n  assert( pConstraint->op==RTREE_MATCH || pConstraint->op==RTREE_QUERY );\n  assert( nCoord==2 || nCoord==4 || nCoord==6 || nCoord==8 || nCoord==10 );\n\n  if( pConstraint->op==RTREE_QUERY && pSearch->iLevel==1 ){\n    pInfo->iRowid = readInt64(pCellData);\n  }\n  pCellData += 8;\n  for(i=0; i<nCoord; i++, pCellData += 4){\n    RTREE_DECODE_COORD(eInt, pCellData, aCoord[i]);\n  }\n  if( pConstraint->op==RTREE_MATCH ){\n    rc = pConstraint->u.xGeom((sqlite3_rtree_geometry*)pInfo,\n                              nCoord, aCoord, &i);\n    if( i==0 ) *peWithin = NOT_WITHIN;\n    *prScore = RTREE_ZERO;\n  }else{\n    pInfo->aCoord = aCoord;\n    pInfo->iLevel = pSearch->iLevel - 1;\n    pInfo->rScore = pInfo->rParentScore = pSearch->rScore;\n    pInfo->eWithin = pInfo->eParentWithin = pSearch->eWithin;\n    rc = pConstraint->u.xQueryFunc(pInfo);\n    if( pInfo->eWithin<*peWithin ) *peWithin = pInfo->eWithin;\n    if( pInfo->rScore<*prScore || *prScore<RTREE_ZERO ){\n      *prScore = pInfo->rScore;\n    }\n  }\n  return rc;\n}\n\n/* \n** Check the internal RTree node given by pCellData against constraint p.\n** If this constraint cannot be satisfied by any child within the node,\n** set *peWithin to NOT_WITHIN.\n*/\nstatic void rtreeNonleafConstraint(\n  RtreeConstraint *p,        /* The constraint to test */\n  int eInt,                  /* True if RTree holds integer coordinates */\n  u8 *pCellData,             /* Raw cell content as appears on disk */\n  int *peWithin              /* Adjust downward, as appropriate */\n){\n  sqlite3_rtree_dbl val;     /* Coordinate value convert to a double */\n\n  /* p->iCoord might point to either a lower or upper bound coordinate\n  ** in a coordinate pair.  But make pCellData point to the lower bound.\n  */\n  pCellData += 8 + 4*(p->iCoord&0xfe);\n\n  assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE \n      || p->op==RTREE_GT || p->op==RTREE_EQ );\n  switch( p->op ){\n    case RTREE_LE:\n    case RTREE_LT:\n    case RTREE_EQ:\n      RTREE_DECODE_COORD(eInt, pCellData, val);\n      /* val now holds the lower bound of the coordinate pair */\n      if( p->u.rValue>=val ) return;\n      if( p->op!=RTREE_EQ ) break;  /* RTREE_LE and RTREE_LT end here */\n      /* Fall through for the RTREE_EQ case */\n\n    default: /* RTREE_GT or RTREE_GE,  or fallthrough of RTREE_EQ */\n      pCellData += 4;\n      RTREE_DECODE_COORD(eInt, pCellData, val);\n      /* val now holds the upper bound of the coordinate pair */\n      if( p->u.rValue<=val ) return;\n  }\n  *peWithin = NOT_WITHIN;\n}\n\n/*\n** Check the leaf RTree cell given by pCellData against constraint p.\n** If this constraint is not satisfied, set *peWithin to NOT_WITHIN.\n** If the constraint is satisfied, leave *peWithin unchanged.\n**\n** The constraint is of the form:  xN op $val\n**\n** The op is given by p->op.  The xN is p->iCoord-th coordinate in\n** pCellData.  $val is given by p->u.rValue.\n*/\nstatic void rtreeLeafConstraint(\n  RtreeConstraint *p,        /* The constraint to test */\n  int eInt,                  /* True if RTree holds integer coordinates */\n  u8 *pCellData,             /* Raw cell content as appears on disk */\n  int *peWithin              /* Adjust downward, as appropriate */\n){\n  RtreeDValue xN;      /* Coordinate value converted to a double */\n\n  assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE \n      || p->op==RTREE_GT || p->op==RTREE_EQ );\n  pCellData += 8 + p->iCoord*4;\n  RTREE_DECODE_COORD(eInt, pCellData, xN);\n  switch( p->op ){\n    case RTREE_LE: if( xN <= p->u.rValue ) return;  break;\n    case RTREE_LT: if( xN <  p->u.rValue ) return;  break;\n    case RTREE_GE: if( xN >= p->u.rValue ) return;  break;\n    case RTREE_GT: if( xN >  p->u.rValue ) return;  break;\n    default:       if( xN == p->u.rValue ) return;  break;\n  }\n  *peWithin = NOT_WITHIN;\n}\n\n/*\n** One of the cells in node pNode is guaranteed to have a 64-bit \n** integer value equal to iRowid. Return the index of this cell.\n*/\nstatic int nodeRowidIndex(\n  Rtree *pRtree, \n  RtreeNode *pNode, \n  i64 iRowid,\n  int *piIndex\n){\n  int ii;\n  int nCell = NCELL(pNode);\n  assert( nCell<200 );\n  for(ii=0; ii<nCell; ii++){\n    if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){\n      *piIndex = ii;\n      return SQLITE_OK;\n    }\n  }\n  return SQLITE_CORRUPT_VTAB;\n}\n\n/*\n** Return the index of the cell containing a pointer to node pNode\n** in its parent. If pNode is the root node, return -1.\n*/\nstatic int nodeParentIndex(Rtree *pRtree, RtreeNode *pNode, int *piIndex){\n  RtreeNode *pParent = pNode->pParent;\n  if( pParent ){\n    return nodeRowidIndex(pRtree, pParent, pNode->iNode, piIndex);\n  }\n  *piIndex = -1;\n  return SQLITE_OK;\n}\n\n/*\n** Compare two search points.  Return negative, zero, or positive if the first\n** is less than, equal to, or greater than the second.\n**\n** The rScore is the primary key.  Smaller rScore values come first.\n** If the rScore is a tie, then use iLevel as the tie breaker with smaller\n** iLevel values coming first.  In this way, if rScore is the same for all\n** SearchPoints, then iLevel becomes the deciding factor and the result\n** is a depth-first search, which is the desired default behavior.\n*/\nstatic int rtreeSearchPointCompare(\n  const RtreeSearchPoint *pA,\n  const RtreeSearchPoint *pB\n){\n  if( pA->rScore<pB->rScore ) return -1;\n  if( pA->rScore>pB->rScore ) return +1;\n  if( pA->iLevel<pB->iLevel ) return -1;\n  if( pA->iLevel>pB->iLevel ) return +1;\n  return 0;\n}\n\n/*\n** Interchange to search points in a cursor.\n*/\nstatic void rtreeSearchPointSwap(RtreeCursor *p, int i, int j){\n  RtreeSearchPoint t = p->aPoint[i];\n  assert( i<j );\n  p->aPoint[i] = p->aPoint[j];\n  p->aPoint[j] = t;\n  i++; j++;\n  if( i<RTREE_CACHE_SZ ){\n    if( j>=RTREE_CACHE_SZ ){\n      nodeRelease(RTREE_OF_CURSOR(p), p->aNode[i]);\n      p->aNode[i] = 0;\n    }else{\n      RtreeNode *pTemp = p->aNode[i];\n      p->aNode[i] = p->aNode[j];\n      p->aNode[j] = pTemp;\n    }\n  }\n}\n\n/*\n** Return the search point with the lowest current score.\n*/\nstatic RtreeSearchPoint *rtreeSearchPointFirst(RtreeCursor *pCur){\n  return pCur->bPoint ? &pCur->sPoint : pCur->nPoint ? pCur->aPoint : 0;\n}\n\n/*\n** Get the RtreeNode for the search point with the lowest score.\n*/\nstatic RtreeNode *rtreeNodeOfFirstSearchPoint(RtreeCursor *pCur, int *pRC){\n  sqlite3_int64 id;\n  int ii = 1 - pCur->bPoint;\n  assert( ii==0 || ii==1 );\n  assert( pCur->bPoint || pCur->nPoint );\n  if( pCur->aNode[ii]==0 ){\n    assert( pRC!=0 );\n    id = ii ? pCur->aPoint[0].id : pCur->sPoint.id;\n    *pRC = nodeAcquire(RTREE_OF_CURSOR(pCur), id, 0, &pCur->aNode[ii]);\n  }\n  return pCur->aNode[ii];\n}\n\n/*\n** Push a new element onto the priority queue\n*/\nstatic RtreeSearchPoint *rtreeEnqueue(\n  RtreeCursor *pCur,    /* The cursor */\n  RtreeDValue rScore,   /* Score for the new search point */\n  u8 iLevel             /* Level for the new search point */\n){\n  int i, j;\n  RtreeSearchPoint *pNew;\n  if( pCur->nPoint>=pCur->nPointAlloc ){\n    int nNew = pCur->nPointAlloc*2 + 8;\n    pNew = sqlite3_realloc(pCur->aPoint, nNew*sizeof(pCur->aPoint[0]));\n    if( pNew==0 ) return 0;\n    pCur->aPoint = pNew;\n    pCur->nPointAlloc = nNew;\n  }\n  i = pCur->nPoint++;\n  pNew = pCur->aPoint + i;\n  pNew->rScore = rScore;\n  pNew->iLevel = iLevel;\n  assert( iLevel<=RTREE_MAX_DEPTH );\n  while( i>0 ){\n    RtreeSearchPoint *pParent;\n    j = (i-1)/2;\n    pParent = pCur->aPoint + j;\n    if( rtreeSearchPointCompare(pNew, pParent)>=0 ) break;\n    rtreeSearchPointSwap(pCur, j, i);\n    i = j;\n    pNew = pParent;\n  }\n  return pNew;\n}\n\n/*\n** Allocate a new RtreeSearchPoint and return a pointer to it.  Return\n** NULL if malloc fails.\n*/\nstatic RtreeSearchPoint *rtreeSearchPointNew(\n  RtreeCursor *pCur,    /* The cursor */\n  RtreeDValue rScore,   /* Score for the new search point */\n  u8 iLevel             /* Level for the new search point */\n){\n  RtreeSearchPoint *pNew, *pFirst;\n  pFirst = rtreeSearchPointFirst(pCur);\n  pCur->anQueue[iLevel]++;\n  if( pFirst==0\n   || pFirst->rScore>rScore \n   || (pFirst->rScore==rScore && pFirst->iLevel>iLevel)\n  ){\n    if( pCur->bPoint ){\n      int ii;\n      pNew = rtreeEnqueue(pCur, rScore, iLevel);\n      if( pNew==0 ) return 0;\n      ii = (int)(pNew - pCur->aPoint) + 1;\n      if( ii<RTREE_CACHE_SZ ){\n        assert( pCur->aNode[ii]==0 );\n        pCur->aNode[ii] = pCur->aNode[0];\n       }else{\n        nodeRelease(RTREE_OF_CURSOR(pCur), pCur->aNode[0]);\n      }\n      pCur->aNode[0] = 0;\n      *pNew = pCur->sPoint;\n    }\n    pCur->sPoint.rScore = rScore;\n    pCur->sPoint.iLevel = iLevel;\n    pCur->bPoint = 1;\n    return &pCur->sPoint;\n  }else{\n    return rtreeEnqueue(pCur, rScore, iLevel);\n  }\n}\n\n#if 0\n/* Tracing routines for the RtreeSearchPoint queue */\nstatic void tracePoint(RtreeSearchPoint *p, int idx, RtreeCursor *pCur){\n  if( idx<0 ){ printf(\" s\"); }else{ printf(\"%2d\", idx); }\n  printf(\" %d.%05lld.%02d %g %d\",\n    p->iLevel, p->id, p->iCell, p->rScore, p->eWithin\n  );\n  idx++;\n  if( idx<RTREE_CACHE_SZ ){\n    printf(\" %p\\n\", pCur->aNode[idx]);\n  }else{\n    printf(\"\\n\");\n  }\n}\nstatic void traceQueue(RtreeCursor *pCur, const char *zPrefix){\n  int ii;\n  printf(\"=== %9s \", zPrefix);\n  if( pCur->bPoint ){\n    tracePoint(&pCur->sPoint, -1, pCur);\n  }\n  for(ii=0; ii<pCur->nPoint; ii++){\n    if( ii>0 || pCur->bPoint ) printf(\"              \");\n    tracePoint(&pCur->aPoint[ii], ii, pCur);\n  }\n}\n# define RTREE_QUEUE_TRACE(A,B) traceQueue(A,B)\n#else\n# define RTREE_QUEUE_TRACE(A,B)   /* no-op */\n#endif\n\n/* Remove the search point with the lowest current score.\n*/\nstatic void rtreeSearchPointPop(RtreeCursor *p){\n  int i, j, k, n;\n  i = 1 - p->bPoint;\n  assert( i==0 || i==1 );\n  if( p->aNode[i] ){\n    nodeRelease(RTREE_OF_CURSOR(p), p->aNode[i]);\n    p->aNode[i] = 0;\n  }\n  if( p->bPoint ){\n    p->anQueue[p->sPoint.iLevel]--;\n    p->bPoint = 0;\n  }else if( p->nPoint ){\n    p->anQueue[p->aPoint[0].iLevel]--;\n    n = --p->nPoint;\n    p->aPoint[0] = p->aPoint[n];\n    if( n<RTREE_CACHE_SZ-1 ){\n      p->aNode[1] = p->aNode[n+1];\n      p->aNode[n+1] = 0;\n    }\n    i = 0;\n    while( (j = i*2+1)<n ){\n      k = j+1;\n      if( k<n && rtreeSearchPointCompare(&p->aPoint[k], &p->aPoint[j])<0 ){\n        if( rtreeSearchPointCompare(&p->aPoint[k], &p->aPoint[i])<0 ){\n          rtreeSearchPointSwap(p, i, k);\n          i = k;\n        }else{\n          break;\n        }\n      }else{\n        if( rtreeSearchPointCompare(&p->aPoint[j], &p->aPoint[i])<0 ){\n          rtreeSearchPointSwap(p, i, j);\n          i = j;\n        }else{\n          break;\n        }\n      }\n    }\n  }\n}\n\n\n/*\n** Continue the search on cursor pCur until the front of the queue\n** contains an entry suitable for returning as a result-set row,\n** or until the RtreeSearchPoint queue is empty, indicating that the\n** query has completed.\n*/\nstatic int rtreeStepToLeaf(RtreeCursor *pCur){\n  RtreeSearchPoint *p;\n  Rtree *pRtree = RTREE_OF_CURSOR(pCur);\n  RtreeNode *pNode;\n  int eWithin;\n  int rc = SQLITE_OK;\n  int nCell;\n  int nConstraint = pCur->nConstraint;\n  int ii;\n  int eInt;\n  RtreeSearchPoint x;\n\n  eInt = pRtree->eCoordType==RTREE_COORD_INT32;\n  while( (p = rtreeSearchPointFirst(pCur))!=0 && p->iLevel>0 ){\n    pNode = rtreeNodeOfFirstSearchPoint(pCur, &rc);\n    if( rc ) return rc;\n    nCell = NCELL(pNode);\n    assert( nCell<200 );\n    while( p->iCell<nCell ){\n      sqlite3_rtree_dbl rScore = (sqlite3_rtree_dbl)-1;\n      u8 *pCellData = pNode->zData + (4+pRtree->nBytesPerCell*p->iCell);\n      eWithin = FULLY_WITHIN;\n      for(ii=0; ii<nConstraint; ii++){\n        RtreeConstraint *pConstraint = pCur->aConstraint + ii;\n        if( pConstraint->op>=RTREE_MATCH ){\n          rc = rtreeCallbackConstraint(pConstraint, eInt, pCellData, p,\n                                       &rScore, &eWithin);\n          if( rc ) return rc;\n        }else if( p->iLevel==1 ){\n          rtreeLeafConstraint(pConstraint, eInt, pCellData, &eWithin);\n        }else{\n          rtreeNonleafConstraint(pConstraint, eInt, pCellData, &eWithin);\n        }\n        if( eWithin==NOT_WITHIN ) break;\n      }\n      p->iCell++;\n      if( eWithin==NOT_WITHIN ) continue;\n      x.iLevel = p->iLevel - 1;\n      if( x.iLevel ){\n        x.id = readInt64(pCellData);\n        x.iCell = 0;\n      }else{\n        x.id = p->id;\n        x.iCell = p->iCell - 1;\n      }\n      if( p->iCell>=nCell ){\n        RTREE_QUEUE_TRACE(pCur, \"POP-S:\");\n        rtreeSearchPointPop(pCur);\n      }\n      if( rScore<RTREE_ZERO ) rScore = RTREE_ZERO;\n      p = rtreeSearchPointNew(pCur, rScore, x.iLevel);\n      if( p==0 ) return SQLITE_NOMEM;\n      p->eWithin = eWithin;\n      p->id = x.id;\n      p->iCell = x.iCell;\n      RTREE_QUEUE_TRACE(pCur, \"PUSH-S:\");\n      break;\n    }\n    if( p->iCell>=nCell ){\n      RTREE_QUEUE_TRACE(pCur, \"POP-Se:\");\n      rtreeSearchPointPop(pCur);\n    }\n  }\n  pCur->atEOF = p==0;\n  return SQLITE_OK;\n}\n\n/* \n** Rtree virtual table module xNext method.\n*/\nstatic int rtreeNext(sqlite3_vtab_cursor *pVtabCursor){\n  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;\n  int rc = SQLITE_OK;\n\n  /* Move to the next entry that matches the configured constraints. */\n  RTREE_QUEUE_TRACE(pCsr, \"POP-Nx:\");\n  rtreeSearchPointPop(pCsr);\n  rc = rtreeStepToLeaf(pCsr);\n  return rc;\n}\n\n/* \n** Rtree virtual table module xRowid method.\n*/\nstatic int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){\n  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;\n  RtreeSearchPoint *p = rtreeSearchPointFirst(pCsr);\n  int rc = SQLITE_OK;\n  RtreeNode *pNode = rtreeNodeOfFirstSearchPoint(pCsr, &rc);\n  if( rc==SQLITE_OK && p ){\n    *pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell);\n  }\n  return rc;\n}\n\n/* \n** Rtree virtual table module xColumn method.\n*/\nstatic int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){\n  Rtree *pRtree = (Rtree *)cur->pVtab;\n  RtreeCursor *pCsr = (RtreeCursor *)cur;\n  RtreeSearchPoint *p = rtreeSearchPointFirst(pCsr);\n  RtreeCoord c;\n  int rc = SQLITE_OK;\n  RtreeNode *pNode = rtreeNodeOfFirstSearchPoint(pCsr, &rc);\n\n  if( rc ) return rc;\n  if( p==0 ) return SQLITE_OK;\n  if( i==0 ){\n    sqlite3_result_int64(ctx, nodeGetRowid(pRtree, pNode, p->iCell));\n  }else{\n    if( rc ) return rc;\n    nodeGetCoord(pRtree, pNode, p->iCell, i-1, &c);\n#ifndef SQLITE_RTREE_INT_ONLY\n    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){\n      sqlite3_result_double(ctx, c.f);\n    }else\n#endif\n    {\n      assert( pRtree->eCoordType==RTREE_COORD_INT32 );\n      sqlite3_result_int(ctx, c.i);\n    }\n  }\n  return SQLITE_OK;\n}\n\n/* \n** Use nodeAcquire() to obtain the leaf node containing the record with \n** rowid iRowid. If successful, set *ppLeaf to point to the node and\n** return SQLITE_OK. If there is no such record in the table, set\n** *ppLeaf to 0 and return SQLITE_OK. If an error occurs, set *ppLeaf\n** to zero and return an SQLite error code.\n*/\nstatic int findLeafNode(\n  Rtree *pRtree,              /* RTree to search */\n  i64 iRowid,                 /* The rowid searching for */\n  RtreeNode **ppLeaf,         /* Write the node here */\n  sqlite3_int64 *piNode       /* Write the node-id here */\n){\n  int rc;\n  *ppLeaf = 0;\n  sqlite3_bind_int64(pRtree->pReadRowid, 1, iRowid);\n  if( sqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){\n    i64 iNode = sqlite3_column_int64(pRtree->pReadRowid, 0);\n    if( piNode ) *piNode = iNode;\n    rc = nodeAcquire(pRtree, iNode, 0, ppLeaf);\n    sqlite3_reset(pRtree->pReadRowid);\n  }else{\n    rc = sqlite3_reset(pRtree->pReadRowid);\n  }\n  return rc;\n}\n\n/*\n** This function is called to configure the RtreeConstraint object passed\n** as the second argument for a MATCH constraint. The value passed as the\n** first argument to this function is the right-hand operand to the MATCH\n** operator.\n*/\nstatic int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){\n  RtreeMatchArg *pBlob;              /* BLOB returned by geometry function */\n  sqlite3_rtree_query_info *pInfo;   /* Callback information */\n  int nBlob;                         /* Size of the geometry function blob */\n  int nExpected;                     /* Expected size of the BLOB */\n\n  /* Check that value is actually a blob. */\n  if( sqlite3_value_type(pValue)!=SQLITE_BLOB ) return SQLITE_ERROR;\n\n  /* Check that the blob is roughly the right size. */\n  nBlob = sqlite3_value_bytes(pValue);\n  if( nBlob<(int)sizeof(RtreeMatchArg) ){\n    return SQLITE_ERROR;\n  }\n\n  pInfo = (sqlite3_rtree_query_info*)sqlite3_malloc( sizeof(*pInfo)+nBlob );\n  if( !pInfo ) return SQLITE_NOMEM;\n  memset(pInfo, 0, sizeof(*pInfo));\n  pBlob = (RtreeMatchArg*)&pInfo[1];\n\n  memcpy(pBlob, sqlite3_value_blob(pValue), nBlob);\n  nExpected = (int)(sizeof(RtreeMatchArg) +\n                    pBlob->nParam*sizeof(sqlite3_value*) +\n                    (pBlob->nParam-1)*sizeof(RtreeDValue));\n  if( pBlob->magic!=RTREE_GEOMETRY_MAGIC || nBlob!=nExpected ){\n    sqlite3_free(pInfo);\n    return SQLITE_ERROR;\n  }\n  pInfo->pContext = pBlob->cb.pContext;\n  pInfo->nParam = pBlob->nParam;\n  pInfo->aParam = pBlob->aParam;\n  pInfo->apSqlParam = pBlob->apSqlParam;\n\n  if( pBlob->cb.xGeom ){\n    pCons->u.xGeom = pBlob->cb.xGeom;\n  }else{\n    pCons->op = RTREE_QUERY;\n    pCons->u.xQueryFunc = pBlob->cb.xQueryFunc;\n  }\n  pCons->pInfo = pInfo;\n  return SQLITE_OK;\n}\n\n/* \n** Rtree virtual table module xFilter method.\n*/\nstatic int rtreeFilter(\n  sqlite3_vtab_cursor *pVtabCursor, \n  int idxNum, const char *idxStr,\n  int argc, sqlite3_value **argv\n){\n  Rtree *pRtree = (Rtree *)pVtabCursor->pVtab;\n  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;\n  RtreeNode *pRoot = 0;\n  int ii;\n  int rc = SQLITE_OK;\n  int iCell = 0;\n\n  rtreeReference(pRtree);\n\n  /* Reset the cursor to the same state as rtreeOpen() leaves it in. */\n  freeCursorConstraints(pCsr);\n  sqlite3_free(pCsr->aPoint);\n  memset(pCsr, 0, sizeof(RtreeCursor));\n  pCsr->base.pVtab = (sqlite3_vtab*)pRtree;\n\n  pCsr->iStrategy = idxNum;\n  if( idxNum==1 ){\n    /* Special case - lookup by rowid. */\n    RtreeNode *pLeaf;        /* Leaf on which the required cell resides */\n    RtreeSearchPoint *p;     /* Search point for the leaf */\n    i64 iRowid = sqlite3_value_int64(argv[0]);\n    i64 iNode = 0;\n    rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode);\n    if( rc==SQLITE_OK && pLeaf!=0 ){\n      p = rtreeSearchPointNew(pCsr, RTREE_ZERO, 0);\n      assert( p!=0 );  /* Always returns pCsr->sPoint */\n      pCsr->aNode[0] = pLeaf;\n      p->id = iNode;\n      p->eWithin = PARTLY_WITHIN;\n      rc = nodeRowidIndex(pRtree, pLeaf, iRowid, &iCell);\n      p->iCell = iCell;\n      RTREE_QUEUE_TRACE(pCsr, \"PUSH-F1:\");\n    }else{\n      pCsr->atEOF = 1;\n    }\n  }else{\n    /* Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array \n    ** with the configured constraints. \n    */\n    rc = nodeAcquire(pRtree, 1, 0, &pRoot);\n    if( rc==SQLITE_OK && argc>0 ){\n      pCsr->aConstraint = sqlite3_malloc(sizeof(RtreeConstraint)*argc);\n      pCsr->nConstraint = argc;\n      if( !pCsr->aConstraint ){\n        rc = SQLITE_NOMEM;\n      }else{\n        memset(pCsr->aConstraint, 0, sizeof(RtreeConstraint)*argc);\n        memset(pCsr->anQueue, 0, sizeof(u32)*(pRtree->iDepth + 1));\n        assert( (idxStr==0 && argc==0)\n                || (idxStr && (int)strlen(idxStr)==argc*2) );\n        for(ii=0; ii<argc; ii++){\n          RtreeConstraint *p = &pCsr->aConstraint[ii];\n          p->op = idxStr[ii*2];\n          p->iCoord = idxStr[ii*2+1]-'0';\n          if( p->op>=RTREE_MATCH ){\n            /* A MATCH operator. The right-hand-side must be a blob that\n            ** can be cast into an RtreeMatchArg object. One created using\n            ** an sqlite3_rtree_geometry_callback() SQL user function.\n            */\n            rc = deserializeGeometry(argv[ii], p);\n            if( rc!=SQLITE_OK ){\n              break;\n            }\n            p->pInfo->nCoord = pRtree->nDim*2;\n            p->pInfo->anQueue = pCsr->anQueue;\n            p->pInfo->mxLevel = pRtree->iDepth + 1;\n          }else{\n#ifdef SQLITE_RTREE_INT_ONLY\n            p->u.rValue = sqlite3_value_int64(argv[ii]);\n#else\n            p->u.rValue = sqlite3_value_double(argv[ii]);\n#endif\n          }\n        }\n      }\n    }\n    if( rc==SQLITE_OK ){\n      RtreeSearchPoint *pNew;\n      pNew = rtreeSearchPointNew(pCsr, RTREE_ZERO, pRtree->iDepth+1);\n      if( pNew==0 ) return SQLITE_NOMEM;\n      pNew->id = 1;\n      pNew->iCell = 0;\n      pNew->eWithin = PARTLY_WITHIN;\n      assert( pCsr->bPoint==1 );\n      pCsr->aNode[0] = pRoot;\n      pRoot = 0;\n      RTREE_QUEUE_TRACE(pCsr, \"PUSH-Fm:\");\n      rc = rtreeStepToLeaf(pCsr);\n    }\n  }\n\n  nodeRelease(pRtree, pRoot);\n  rtreeRelease(pRtree);\n  return rc;\n}\n\n/*\n** Set the pIdxInfo->estimatedRows variable to nRow. Unless this\n** extension is currently being used by a version of SQLite too old to\n** support estimatedRows. In that case this function is a no-op.\n*/\nstatic void setEstimatedRows(sqlite3_index_info *pIdxInfo, i64 nRow){\n#if SQLITE_VERSION_NUMBER>=3008002\n  if( sqlite3_libversion_number()>=3008002 ){\n    pIdxInfo->estimatedRows = nRow;\n  }\n#endif\n}\n\n/*\n** Rtree virtual table module xBestIndex method. There are three\n** table scan strategies to choose from (in order from most to \n** least desirable):\n**\n**   idxNum     idxStr        Strategy\n**   ------------------------------------------------\n**     1        Unused        Direct lookup by rowid.\n**     2        See below     R-tree query or full-table scan.\n**   ------------------------------------------------\n**\n** If strategy 1 is used, then idxStr is not meaningful. If strategy\n** 2 is used, idxStr is formatted to contain 2 bytes for each \n** constraint used. The first two bytes of idxStr correspond to \n** the constraint in sqlite3_index_info.aConstraintUsage[] with\n** (argvIndex==1) etc.\n**\n** The first of each pair of bytes in idxStr identifies the constraint\n** operator as follows:\n**\n**   Operator    Byte Value\n**   ----------------------\n**      =        0x41 ('A')\n**     <=        0x42 ('B')\n**      <        0x43 ('C')\n**     >=        0x44 ('D')\n**      >        0x45 ('E')\n**   MATCH       0x46 ('F')\n**   ----------------------\n**\n** The second of each pair of bytes identifies the coordinate column\n** to which the constraint applies. The leftmost coordinate column\n** is 'a', the second from the left 'b' etc.\n*/\nstatic int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){\n  Rtree *pRtree = (Rtree*)tab;\n  int rc = SQLITE_OK;\n  int ii;\n  int bMatch = 0;                 /* True if there exists a MATCH constraint */\n  i64 nRow;                       /* Estimated rows returned by this scan */\n\n  int iIdx = 0;\n  char zIdxStr[RTREE_MAX_DIMENSIONS*8+1];\n  memset(zIdxStr, 0, sizeof(zIdxStr));\n\n  /* Check if there exists a MATCH constraint - even an unusable one. If there\n  ** is, do not consider the lookup-by-rowid plan as using such a plan would\n  ** require the VDBE to evaluate the MATCH constraint, which is not currently\n  ** possible. */\n  for(ii=0; ii<pIdxInfo->nConstraint; ii++){\n    if( pIdxInfo->aConstraint[ii].op==SQLITE_INDEX_CONSTRAINT_MATCH ){\n      bMatch = 1;\n    }\n  }\n\n  assert( pIdxInfo->idxStr==0 );\n  for(ii=0; ii<pIdxInfo->nConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){\n    struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii];\n\n    if( bMatch==0 && p->usable \n     && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ \n    ){\n      /* We have an equality constraint on the rowid. Use strategy 1. */\n      int jj;\n      for(jj=0; jj<ii; jj++){\n        pIdxInfo->aConstraintUsage[jj].argvIndex = 0;\n        pIdxInfo->aConstraintUsage[jj].omit = 0;\n      }\n      pIdxInfo->idxNum = 1;\n      pIdxInfo->aConstraintUsage[ii].argvIndex = 1;\n      pIdxInfo->aConstraintUsage[jj].omit = 1;\n\n      /* This strategy involves a two rowid lookups on an B-Tree structures\n      ** and then a linear search of an R-Tree node. This should be \n      ** considered almost as quick as a direct rowid lookup (for which \n      ** sqlite uses an internal cost of 0.0). It is expected to return\n      ** a single row.\n      */ \n      pIdxInfo->estimatedCost = 30.0;\n      setEstimatedRows(pIdxInfo, 1);\n      return SQLITE_OK;\n    }\n\n    if( p->usable && (p->iColumn>0 || p->op==SQLITE_INDEX_CONSTRAINT_MATCH) ){\n      u8 op;\n      switch( p->op ){\n        case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; break;\n        case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break;\n        case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break;\n        case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break;\n        case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break;\n        default:\n          assert( p->op==SQLITE_INDEX_CONSTRAINT_MATCH );\n          op = RTREE_MATCH; \n          break;\n      }\n      zIdxStr[iIdx++] = op;\n      zIdxStr[iIdx++] = p->iColumn - 1 + '0';\n      pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2);\n      pIdxInfo->aConstraintUsage[ii].omit = 1;\n    }\n  }\n\n  pIdxInfo->idxNum = 2;\n  pIdxInfo->needToFreeIdxStr = 1;\n  if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf(\"%s\", zIdxStr)) ){\n    return SQLITE_NOMEM;\n  }\n\n  nRow = pRtree->nRowEst >> (iIdx/2);\n  pIdxInfo->estimatedCost = (double)6.0 * (double)nRow;\n  setEstimatedRows(pIdxInfo, nRow);\n\n  return rc;\n}\n\n/*\n** Return the N-dimensional volumn of the cell stored in *p.\n*/\nstatic RtreeDValue cellArea(Rtree *pRtree, RtreeCell *p){\n  RtreeDValue area = (RtreeDValue)1;\n  int ii;\n  for(ii=0; ii<(pRtree->nDim*2); ii+=2){\n    area = (area * (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii])));\n  }\n  return area;\n}\n\n/*\n** Return the margin length of cell p. The margin length is the sum\n** of the objects size in each dimension.\n*/\nstatic RtreeDValue cellMargin(Rtree *pRtree, RtreeCell *p){\n  RtreeDValue margin = (RtreeDValue)0;\n  int ii;\n  for(ii=0; ii<(pRtree->nDim*2); ii+=2){\n    margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));\n  }\n  return margin;\n}\n\n/*\n** Store the union of cells p1 and p2 in p1.\n*/\nstatic void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){\n  int ii;\n  if( pRtree->eCoordType==RTREE_COORD_REAL32 ){\n    for(ii=0; ii<(pRtree->nDim*2); ii+=2){\n      p1->aCoord[ii].f = MIN(p1->aCoord[ii].f, p2->aCoord[ii].f);\n      p1->aCoord[ii+1].f = MAX(p1->aCoord[ii+1].f, p2->aCoord[ii+1].f);\n    }\n  }else{\n    for(ii=0; ii<(pRtree->nDim*2); ii+=2){\n      p1->aCoord[ii].i = MIN(p1->aCoord[ii].i, p2->aCoord[ii].i);\n      p1->aCoord[ii+1].i = MAX(p1->aCoord[ii+1].i, p2->aCoord[ii+1].i);\n    }\n  }\n}\n\n/*\n** Return true if the area covered by p2 is a subset of the area covered\n** by p1. False otherwise.\n*/\nstatic int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){\n  int ii;\n  int isInt = (pRtree->eCoordType==RTREE_COORD_INT32);\n  for(ii=0; ii<(pRtree->nDim*2); ii+=2){\n    RtreeCoord *a1 = &p1->aCoord[ii];\n    RtreeCoord *a2 = &p2->aCoord[ii];\n    if( (!isInt && (a2[0].f<a1[0].f || a2[1].f>a1[1].f)) \n     || ( isInt && (a2[0].i<a1[0].i || a2[1].i>a1[1].i)) \n    ){\n      return 0;\n    }\n  }\n  return 1;\n}\n\n/*\n** Return the amount cell p would grow by if it were unioned with pCell.\n*/\nstatic RtreeDValue cellGrowth(Rtree *pRtree, RtreeCell *p, RtreeCell *pCell){\n  RtreeDValue area;\n  RtreeCell cell;\n  memcpy(&cell, p, sizeof(RtreeCell));\n  area = cellArea(pRtree, &cell);\n  cellUnion(pRtree, &cell, pCell);\n  return (cellArea(pRtree, &cell)-area);\n}\n\nstatic RtreeDValue cellOverlap(\n  Rtree *pRtree, \n  RtreeCell *p, \n  RtreeCell *aCell, \n  int nCell\n){\n  int ii;\n  RtreeDValue overlap = RTREE_ZERO;\n  for(ii=0; ii<nCell; ii++){\n    int jj;\n    RtreeDValue o = (RtreeDValue)1;\n    for(jj=0; jj<(pRtree->nDim*2); jj+=2){\n      RtreeDValue x1, x2;\n      x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));\n      x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));\n      if( x2<x1 ){\n        o = (RtreeDValue)0;\n        break;\n      }else{\n        o = o * (x2-x1);\n      }\n    }\n    overlap += o;\n  }\n  return overlap;\n}\n\n\n/*\n** This function implements the ChooseLeaf algorithm from Gutman[84].\n** ChooseSubTree in r*tree terminology.\n*/\nstatic int ChooseLeaf(\n  Rtree *pRtree,               /* Rtree table */\n  RtreeCell *pCell,            /* Cell to insert into rtree */\n  int iHeight,                 /* Height of sub-tree rooted at pCell */\n  RtreeNode **ppLeaf           /* OUT: Selected leaf page */\n){\n  int rc;\n  int ii;\n  RtreeNode *pNode;\n  rc = nodeAcquire(pRtree, 1, 0, &pNode);\n\n  for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){\n    int iCell;\n    sqlite3_int64 iBest = 0;\n\n    RtreeDValue fMinGrowth = RTREE_ZERO;\n    RtreeDValue fMinArea = RTREE_ZERO;\n\n    int nCell = NCELL(pNode);\n    RtreeCell cell;\n    RtreeNode *pChild;\n\n    RtreeCell *aCell = 0;\n\n    /* Select the child node which will be enlarged the least if pCell\n    ** is inserted into it. Resolve ties by choosing the entry with\n    ** the smallest area.\n    */\n    for(iCell=0; iCell<nCell; iCell++){\n      int bBest = 0;\n      RtreeDValue growth;\n      RtreeDValue area;\n      nodeGetCell(pRtree, pNode, iCell, &cell);\n      growth = cellGrowth(pRtree, &cell, pCell);\n      area = cellArea(pRtree, &cell);\n      if( iCell==0||growth<fMinGrowth||(growth==fMinGrowth && area<fMinArea) ){\n        bBest = 1;\n      }\n      if( bBest ){\n        fMinGrowth = growth;\n        fMinArea = area;\n        iBest = cell.iRowid;\n      }\n    }\n\n    sqlite3_free(aCell);\n    rc = nodeAcquire(pRtree, iBest, pNode, &pChild);\n    nodeRelease(pRtree, pNode);\n    pNode = pChild;\n  }\n\n  *ppLeaf = pNode;\n  return rc;\n}\n\n/*\n** A cell with the same content as pCell has just been inserted into\n** the node pNode. This function updates the bounding box cells in\n** all ancestor elements.\n*/\nstatic int AdjustTree(\n  Rtree *pRtree,                    /* Rtree table */\n  RtreeNode *pNode,                 /* Adjust ancestry of this node. */\n  RtreeCell *pCell                  /* This cell was just inserted */\n){\n  RtreeNode *p = pNode;\n  while( p->pParent ){\n    RtreeNode *pParent = p->pParent;\n    RtreeCell cell;\n    int iCell;\n\n    if( nodeParentIndex(pRtree, p, &iCell) ){\n      return SQLITE_CORRUPT_VTAB;\n    }\n\n    nodeGetCell(pRtree, pParent, iCell, &cell);\n    if( !cellContains(pRtree, &cell, pCell) ){\n      cellUnion(pRtree, &cell, pCell);\n      nodeOverwriteCell(pRtree, pParent, &cell, iCell);\n    }\n \n    p = pParent;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Write mapping (iRowid->iNode) to the <rtree>_rowid table.\n*/\nstatic int rowidWrite(Rtree *pRtree, sqlite3_int64 iRowid, sqlite3_int64 iNode){\n  sqlite3_bind_int64(pRtree->pWriteRowid, 1, iRowid);\n  sqlite3_bind_int64(pRtree->pWriteRowid, 2, iNode);\n  sqlite3_step(pRtree->pWriteRowid);\n  return sqlite3_reset(pRtree->pWriteRowid);\n}\n\n/*\n** Write mapping (iNode->iPar) to the <rtree>_parent table.\n*/\nstatic int parentWrite(Rtree *pRtree, sqlite3_int64 iNode, sqlite3_int64 iPar){\n  sqlite3_bind_int64(pRtree->pWriteParent, 1, iNode);\n  sqlite3_bind_int64(pRtree->pWriteParent, 2, iPar);\n  sqlite3_step(pRtree->pWriteParent);\n  return sqlite3_reset(pRtree->pWriteParent);\n}\n\nstatic int rtreeInsertCell(Rtree *, RtreeNode *, RtreeCell *, int);\n\n\n/*\n** Arguments aIdx, aDistance and aSpare all point to arrays of size\n** nIdx. The aIdx array contains the set of integers from 0 to \n** (nIdx-1) in no particular order. This function sorts the values\n** in aIdx according to the indexed values in aDistance. For\n** example, assuming the inputs:\n**\n**   aIdx      = { 0,   1,   2,   3 }\n**   aDistance = { 5.0, 2.0, 7.0, 6.0 }\n**\n** this function sets the aIdx array to contain:\n**\n**   aIdx      = { 0,   1,   2,   3 }\n**\n** The aSpare array is used as temporary working space by the\n** sorting algorithm.\n*/\nstatic void SortByDistance(\n  int *aIdx, \n  int nIdx, \n  RtreeDValue *aDistance, \n  int *aSpare\n){\n  if( nIdx>1 ){\n    int iLeft = 0;\n    int iRight = 0;\n\n    int nLeft = nIdx/2;\n    int nRight = nIdx-nLeft;\n    int *aLeft = aIdx;\n    int *aRight = &aIdx[nLeft];\n\n    SortByDistance(aLeft, nLeft, aDistance, aSpare);\n    SortByDistance(aRight, nRight, aDistance, aSpare);\n\n    memcpy(aSpare, aLeft, sizeof(int)*nLeft);\n    aLeft = aSpare;\n\n    while( iLeft<nLeft || iRight<nRight ){\n      if( iLeft==nLeft ){\n        aIdx[iLeft+iRight] = aRight[iRight];\n        iRight++;\n      }else if( iRight==nRight ){\n        aIdx[iLeft+iRight] = aLeft[iLeft];\n        iLeft++;\n      }else{\n        RtreeDValue fLeft = aDistance[aLeft[iLeft]];\n        RtreeDValue fRight = aDistance[aRight[iRight]];\n        if( fLeft<fRight ){\n          aIdx[iLeft+iRight] = aLeft[iLeft];\n          iLeft++;\n        }else{\n          aIdx[iLeft+iRight] = aRight[iRight];\n          iRight++;\n        }\n      }\n    }\n\n#if 0\n    /* Check that the sort worked */\n    {\n      int jj;\n      for(jj=1; jj<nIdx; jj++){\n        RtreeDValue left = aDistance[aIdx[jj-1]];\n        RtreeDValue right = aDistance[aIdx[jj]];\n        assert( left<=right );\n      }\n    }\n#endif\n  }\n}\n\n/*\n** Arguments aIdx, aCell and aSpare all point to arrays of size\n** nIdx. The aIdx array contains the set of integers from 0 to \n** (nIdx-1) in no particular order. This function sorts the values\n** in aIdx according to dimension iDim of the cells in aCell. The\n** minimum value of dimension iDim is considered first, the\n** maximum used to break ties.\n**\n** The aSpare array is used as temporary working space by the\n** sorting algorithm.\n*/\nstatic void SortByDimension(\n  Rtree *pRtree,\n  int *aIdx, \n  int nIdx, \n  int iDim, \n  RtreeCell *aCell, \n  int *aSpare\n){\n  if( nIdx>1 ){\n\n    int iLeft = 0;\n    int iRight = 0;\n\n    int nLeft = nIdx/2;\n    int nRight = nIdx-nLeft;\n    int *aLeft = aIdx;\n    int *aRight = &aIdx[nLeft];\n\n    SortByDimension(pRtree, aLeft, nLeft, iDim, aCell, aSpare);\n    SortByDimension(pRtree, aRight, nRight, iDim, aCell, aSpare);\n\n    memcpy(aSpare, aLeft, sizeof(int)*nLeft);\n    aLeft = aSpare;\n    while( iLeft<nLeft || iRight<nRight ){\n      RtreeDValue xleft1 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2]);\n      RtreeDValue xleft2 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2+1]);\n      RtreeDValue xright1 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2]);\n      RtreeDValue xright2 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2+1]);\n      if( (iLeft!=nLeft) && ((iRight==nRight)\n       || (xleft1<xright1)\n       || (xleft1==xright1 && xleft2<xright2)\n      )){\n        aIdx[iLeft+iRight] = aLeft[iLeft];\n        iLeft++;\n      }else{\n        aIdx[iLeft+iRight] = aRight[iRight];\n        iRight++;\n      }\n    }\n\n#if 0\n    /* Check that the sort worked */\n    {\n      int jj;\n      for(jj=1; jj<nIdx; jj++){\n        RtreeDValue xleft1 = aCell[aIdx[jj-1]].aCoord[iDim*2];\n        RtreeDValue xleft2 = aCell[aIdx[jj-1]].aCoord[iDim*2+1];\n        RtreeDValue xright1 = aCell[aIdx[jj]].aCoord[iDim*2];\n        RtreeDValue xright2 = aCell[aIdx[jj]].aCoord[iDim*2+1];\n        assert( xleft1<=xright1 && (xleft1<xright1 || xleft2<=xright2) );\n      }\n    }\n#endif\n  }\n}\n\n/*\n** Implementation of the R*-tree variant of SplitNode from Beckman[1990].\n*/\nstatic int splitNodeStartree(\n  Rtree *pRtree,\n  RtreeCell *aCell,\n  int nCell,\n  RtreeNode *pLeft,\n  RtreeNode *pRight,\n  RtreeCell *pBboxLeft,\n  RtreeCell *pBboxRight\n){\n  int **aaSorted;\n  int *aSpare;\n  int ii;\n\n  int iBestDim = 0;\n  int iBestSplit = 0;\n  RtreeDValue fBestMargin = RTREE_ZERO;\n\n  int nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int));\n\n  aaSorted = (int **)sqlite3_malloc(nByte);\n  if( !aaSorted ){\n    return SQLITE_NOMEM;\n  }\n\n  aSpare = &((int *)&aaSorted[pRtree->nDim])[pRtree->nDim*nCell];\n  memset(aaSorted, 0, nByte);\n  for(ii=0; ii<pRtree->nDim; ii++){\n    int jj;\n    aaSorted[ii] = &((int *)&aaSorted[pRtree->nDim])[ii*nCell];\n    for(jj=0; jj<nCell; jj++){\n      aaSorted[ii][jj] = jj;\n    }\n    SortByDimension(pRtree, aaSorted[ii], nCell, ii, aCell, aSpare);\n  }\n\n  for(ii=0; ii<pRtree->nDim; ii++){\n    RtreeDValue margin = RTREE_ZERO;\n    RtreeDValue fBestOverlap = RTREE_ZERO;\n    RtreeDValue fBestArea = RTREE_ZERO;\n    int iBestLeft = 0;\n    int nLeft;\n\n    for(\n      nLeft=RTREE_MINCELLS(pRtree); \n      nLeft<=(nCell-RTREE_MINCELLS(pRtree)); \n      nLeft++\n    ){\n      RtreeCell left;\n      RtreeCell right;\n      int kk;\n      RtreeDValue overlap;\n      RtreeDValue area;\n\n      memcpy(&left, &aCell[aaSorted[ii][0]], sizeof(RtreeCell));\n      memcpy(&right, &aCell[aaSorted[ii][nCell-1]], sizeof(RtreeCell));\n      for(kk=1; kk<(nCell-1); kk++){\n        if( kk<nLeft ){\n          cellUnion(pRtree, &left, &aCell[aaSorted[ii][kk]]);\n        }else{\n          cellUnion(pRtree, &right, &aCell[aaSorted[ii][kk]]);\n        }\n      }\n      margin += cellMargin(pRtree, &left);\n      margin += cellMargin(pRtree, &right);\n      overlap = cellOverlap(pRtree, &left, &right, 1);\n      area = cellArea(pRtree, &left) + cellArea(pRtree, &right);\n      if( (nLeft==RTREE_MINCELLS(pRtree))\n       || (overlap<fBestOverlap)\n       || (overlap==fBestOverlap && area<fBestArea)\n      ){\n        iBestLeft = nLeft;\n        fBestOverlap = overlap;\n        fBestArea = area;\n      }\n    }\n\n    if( ii==0 || margin<fBestMargin ){\n      iBestDim = ii;\n      fBestMargin = margin;\n      iBestSplit = iBestLeft;\n    }\n  }\n\n  memcpy(pBboxLeft, &aCell[aaSorted[iBestDim][0]], sizeof(RtreeCell));\n  memcpy(pBboxRight, &aCell[aaSorted[iBestDim][iBestSplit]], sizeof(RtreeCell));\n  for(ii=0; ii<nCell; ii++){\n    RtreeNode *pTarget = (ii<iBestSplit)?pLeft:pRight;\n    RtreeCell *pBbox = (ii<iBestSplit)?pBboxLeft:pBboxRight;\n    RtreeCell *pCell = &aCell[aaSorted[iBestDim][ii]];\n    nodeInsertCell(pRtree, pTarget, pCell);\n    cellUnion(pRtree, pBbox, pCell);\n  }\n\n  sqlite3_free(aaSorted);\n  return SQLITE_OK;\n}\n\n\nstatic int updateMapping(\n  Rtree *pRtree, \n  i64 iRowid, \n  RtreeNode *pNode, \n  int iHeight\n){\n  int (*xSetMapping)(Rtree *, sqlite3_int64, sqlite3_int64);\n  xSetMapping = ((iHeight==0)?rowidWrite:parentWrite);\n  if( iHeight>0 ){\n    RtreeNode *pChild = nodeHashLookup(pRtree, iRowid);\n    if( pChild ){\n      nodeRelease(pRtree, pChild->pParent);\n      nodeReference(pNode);\n      pChild->pParent = pNode;\n    }\n  }\n  return xSetMapping(pRtree, iRowid, pNode->iNode);\n}\n\nstatic int SplitNode(\n  Rtree *pRtree,\n  RtreeNode *pNode,\n  RtreeCell *pCell,\n  int iHeight\n){\n  int i;\n  int newCellIsRight = 0;\n\n  int rc = SQLITE_OK;\n  int nCell = NCELL(pNode);\n  RtreeCell *aCell;\n  int *aiUsed;\n\n  RtreeNode *pLeft = 0;\n  RtreeNode *pRight = 0;\n\n  RtreeCell leftbbox;\n  RtreeCell rightbbox;\n\n  /* Allocate an array and populate it with a copy of pCell and \n  ** all cells from node pLeft. Then zero the original node.\n  */\n  aCell = sqlite3_malloc((sizeof(RtreeCell)+sizeof(int))*(nCell+1));\n  if( !aCell ){\n    rc = SQLITE_NOMEM;\n    goto splitnode_out;\n  }\n  aiUsed = (int *)&aCell[nCell+1];\n  memset(aiUsed, 0, sizeof(int)*(nCell+1));\n  for(i=0; i<nCell; i++){\n    nodeGetCell(pRtree, pNode, i, &aCell[i]);\n  }\n  nodeZero(pRtree, pNode);\n  memcpy(&aCell[nCell], pCell, sizeof(RtreeCell));\n  nCell++;\n\n  if( pNode->iNode==1 ){\n    pRight = nodeNew(pRtree, pNode);\n    pLeft = nodeNew(pRtree, pNode);\n    pRtree->iDepth++;\n    pNode->isDirty = 1;\n    writeInt16(pNode->zData, pRtree->iDepth);\n  }else{\n    pLeft = pNode;\n    pRight = nodeNew(pRtree, pLeft->pParent);\n    nodeReference(pLeft);\n  }\n\n  if( !pLeft || !pRight ){\n    rc = SQLITE_NOMEM;\n    goto splitnode_out;\n  }\n\n  memset(pLeft->zData, 0, pRtree->iNodeSize);\n  memset(pRight->zData, 0, pRtree->iNodeSize);\n\n  rc = splitNodeStartree(pRtree, aCell, nCell, pLeft, pRight,\n                         &leftbbox, &rightbbox);\n  if( rc!=SQLITE_OK ){\n    goto splitnode_out;\n  }\n\n  /* Ensure both child nodes have node numbers assigned to them by calling\n  ** nodeWrite(). Node pRight always needs a node number, as it was created\n  ** by nodeNew() above. But node pLeft sometimes already has a node number.\n  ** In this case avoid the all to nodeWrite().\n  */\n  if( SQLITE_OK!=(rc = nodeWrite(pRtree, pRight))\n   || (0==pLeft->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pLeft)))\n  ){\n    goto splitnode_out;\n  }\n\n  rightbbox.iRowid = pRight->iNode;\n  leftbbox.iRowid = pLeft->iNode;\n\n  if( pNode->iNode==1 ){\n    rc = rtreeInsertCell(pRtree, pLeft->pParent, &leftbbox, iHeight+1);\n    if( rc!=SQLITE_OK ){\n      goto splitnode_out;\n    }\n  }else{\n    RtreeNode *pParent = pLeft->pParent;\n    int iCell;\n    rc = nodeParentIndex(pRtree, pLeft, &iCell);\n    if( rc==SQLITE_OK ){\n      nodeOverwriteCell(pRtree, pParent, &leftbbox, iCell);\n      rc = AdjustTree(pRtree, pParent, &leftbbox);\n    }\n    if( rc!=SQLITE_OK ){\n      goto splitnode_out;\n    }\n  }\n  if( (rc = rtreeInsertCell(pRtree, pRight->pParent, &rightbbox, iHeight+1)) ){\n    goto splitnode_out;\n  }\n\n  for(i=0; i<NCELL(pRight); i++){\n    i64 iRowid = nodeGetRowid(pRtree, pRight, i);\n    rc = updateMapping(pRtree, iRowid, pRight, iHeight);\n    if( iRowid==pCell->iRowid ){\n      newCellIsRight = 1;\n    }\n    if( rc!=SQLITE_OK ){\n      goto splitnode_out;\n    }\n  }\n  if( pNode->iNode==1 ){\n    for(i=0; i<NCELL(pLeft); i++){\n      i64 iRowid = nodeGetRowid(pRtree, pLeft, i);\n      rc = updateMapping(pRtree, iRowid, pLeft, iHeight);\n      if( rc!=SQLITE_OK ){\n        goto splitnode_out;\n      }\n    }\n  }else if( newCellIsRight==0 ){\n    rc = updateMapping(pRtree, pCell->iRowid, pLeft, iHeight);\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = nodeRelease(pRtree, pRight);\n    pRight = 0;\n  }\n  if( rc==SQLITE_OK ){\n    rc = nodeRelease(pRtree, pLeft);\n    pLeft = 0;\n  }\n\nsplitnode_out:\n  nodeRelease(pRtree, pRight);\n  nodeRelease(pRtree, pLeft);\n  sqlite3_free(aCell);\n  return rc;\n}\n\n/*\n** If node pLeaf is not the root of the r-tree and its pParent pointer is \n** still NULL, load all ancestor nodes of pLeaf into memory and populate\n** the pLeaf->pParent chain all the way up to the root node.\n**\n** This operation is required when a row is deleted (or updated - an update\n** is implemented as a delete followed by an insert). SQLite provides the\n** rowid of the row to delete, which can be used to find the leaf on which\n** the entry resides (argument pLeaf). Once the leaf is located, this \n** function is called to determine its ancestry.\n*/\nstatic int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){\n  int rc = SQLITE_OK;\n  RtreeNode *pChild = pLeaf;\n  while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){\n    int rc2 = SQLITE_OK;          /* sqlite3_reset() return code */\n    sqlite3_bind_int64(pRtree->pReadParent, 1, pChild->iNode);\n    rc = sqlite3_step(pRtree->pReadParent);\n    if( rc==SQLITE_ROW ){\n      RtreeNode *pTest;           /* Used to test for reference loops */\n      i64 iNode;                  /* Node number of parent node */\n\n      /* Before setting pChild->pParent, test that we are not creating a\n      ** loop of references (as we would if, say, pChild==pParent). We don't\n      ** want to do this as it leads to a memory leak when trying to delete\n      ** the referenced counted node structures.\n      */\n      iNode = sqlite3_column_int64(pRtree->pReadParent, 0);\n      for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent);\n      if( !pTest ){\n        rc2 = nodeAcquire(pRtree, iNode, 0, &pChild->pParent);\n      }\n    }\n    rc = sqlite3_reset(pRtree->pReadParent);\n    if( rc==SQLITE_OK ) rc = rc2;\n    if( rc==SQLITE_OK && !pChild->pParent ) rc = SQLITE_CORRUPT_VTAB;\n    pChild = pChild->pParent;\n  }\n  return rc;\n}\n\nstatic int deleteCell(Rtree *, RtreeNode *, int, int);\n\nstatic int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){\n  int rc;\n  int rc2;\n  RtreeNode *pParent = 0;\n  int iCell;\n\n  assert( pNode->nRef==1 );\n\n  /* Remove the entry in the parent cell. */\n  rc = nodeParentIndex(pRtree, pNode, &iCell);\n  if( rc==SQLITE_OK ){\n    pParent = pNode->pParent;\n    pNode->pParent = 0;\n    rc = deleteCell(pRtree, pParent, iCell, iHeight+1);\n  }\n  rc2 = nodeRelease(pRtree, pParent);\n  if( rc==SQLITE_OK ){\n    rc = rc2;\n  }\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  /* Remove the xxx_node entry. */\n  sqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode);\n  sqlite3_step(pRtree->pDeleteNode);\n  if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteNode)) ){\n    return rc;\n  }\n\n  /* Remove the xxx_parent entry. */\n  sqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode);\n  sqlite3_step(pRtree->pDeleteParent);\n  if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteParent)) ){\n    return rc;\n  }\n  \n  /* Remove the node from the in-memory hash table and link it into\n  ** the Rtree.pDeleted list. Its contents will be re-inserted later on.\n  */\n  nodeHashDelete(pRtree, pNode);\n  pNode->iNode = iHeight;\n  pNode->pNext = pRtree->pDeleted;\n  pNode->nRef++;\n  pRtree->pDeleted = pNode;\n\n  return SQLITE_OK;\n}\n\nstatic int fixBoundingBox(Rtree *pRtree, RtreeNode *pNode){\n  RtreeNode *pParent = pNode->pParent;\n  int rc = SQLITE_OK; \n  if( pParent ){\n    int ii; \n    int nCell = NCELL(pNode);\n    RtreeCell box;                            /* Bounding box for pNode */\n    nodeGetCell(pRtree, pNode, 0, &box);\n    for(ii=1; ii<nCell; ii++){\n      RtreeCell cell;\n      nodeGetCell(pRtree, pNode, ii, &cell);\n      cellUnion(pRtree, &box, &cell);\n    }\n    box.iRowid = pNode->iNode;\n    rc = nodeParentIndex(pRtree, pNode, &ii);\n    if( rc==SQLITE_OK ){\n      nodeOverwriteCell(pRtree, pParent, &box, ii);\n      rc = fixBoundingBox(pRtree, pParent);\n    }\n  }\n  return rc;\n}\n\n/*\n** Delete the cell at index iCell of node pNode. After removing the\n** cell, adjust the r-tree data structure if required.\n*/\nstatic int deleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell, int iHeight){\n  RtreeNode *pParent;\n  int rc;\n\n  if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){\n    return rc;\n  }\n\n  /* Remove the cell from the node. This call just moves bytes around\n  ** the in-memory node image, so it cannot fail.\n  */\n  nodeDeleteCell(pRtree, pNode, iCell);\n\n  /* If the node is not the tree root and now has less than the minimum\n  ** number of cells, remove it from the tree. Otherwise, update the\n  ** cell in the parent node so that it tightly contains the updated\n  ** node.\n  */\n  pParent = pNode->pParent;\n  assert( pParent || pNode->iNode==1 );\n  if( pParent ){\n    if( NCELL(pNode)<RTREE_MINCELLS(pRtree) ){\n      rc = removeNode(pRtree, pNode, iHeight);\n    }else{\n      rc = fixBoundingBox(pRtree, pNode);\n    }\n  }\n\n  return rc;\n}\n\nstatic int Reinsert(\n  Rtree *pRtree, \n  RtreeNode *pNode, \n  RtreeCell *pCell, \n  int iHeight\n){\n  int *aOrder;\n  int *aSpare;\n  RtreeCell *aCell;\n  RtreeDValue *aDistance;\n  int nCell;\n  RtreeDValue aCenterCoord[RTREE_MAX_DIMENSIONS];\n  int iDim;\n  int ii;\n  int rc = SQLITE_OK;\n  int n;\n\n  memset(aCenterCoord, 0, sizeof(RtreeDValue)*RTREE_MAX_DIMENSIONS);\n\n  nCell = NCELL(pNode)+1;\n  n = (nCell+1)&(~1);\n\n  /* Allocate the buffers used by this operation. The allocation is\n  ** relinquished before this function returns.\n  */\n  aCell = (RtreeCell *)sqlite3_malloc(n * (\n    sizeof(RtreeCell)     +         /* aCell array */\n    sizeof(int)           +         /* aOrder array */\n    sizeof(int)           +         /* aSpare array */\n    sizeof(RtreeDValue)             /* aDistance array */\n  ));\n  if( !aCell ){\n    return SQLITE_NOMEM;\n  }\n  aOrder    = (int *)&aCell[n];\n  aSpare    = (int *)&aOrder[n];\n  aDistance = (RtreeDValue *)&aSpare[n];\n\n  for(ii=0; ii<nCell; ii++){\n    if( ii==(nCell-1) ){\n      memcpy(&aCell[ii], pCell, sizeof(RtreeCell));\n    }else{\n      nodeGetCell(pRtree, pNode, ii, &aCell[ii]);\n    }\n    aOrder[ii] = ii;\n    for(iDim=0; iDim<pRtree->nDim; iDim++){\n      aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2]);\n      aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2+1]);\n    }\n  }\n  for(iDim=0; iDim<pRtree->nDim; iDim++){\n    aCenterCoord[iDim] = (aCenterCoord[iDim]/(nCell*(RtreeDValue)2));\n  }\n\n  for(ii=0; ii<nCell; ii++){\n    aDistance[ii] = RTREE_ZERO;\n    for(iDim=0; iDim<pRtree->nDim; iDim++){\n      RtreeDValue coord = (DCOORD(aCell[ii].aCoord[iDim*2+1]) - \n                               DCOORD(aCell[ii].aCoord[iDim*2]));\n      aDistance[ii] += (coord-aCenterCoord[iDim])*(coord-aCenterCoord[iDim]);\n    }\n  }\n\n  SortByDistance(aOrder, nCell, aDistance, aSpare);\n  nodeZero(pRtree, pNode);\n\n  for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){\n    RtreeCell *p = &aCell[aOrder[ii]];\n    nodeInsertCell(pRtree, pNode, p);\n    if( p->iRowid==pCell->iRowid ){\n      if( iHeight==0 ){\n        rc = rowidWrite(pRtree, p->iRowid, pNode->iNode);\n      }else{\n        rc = parentWrite(pRtree, p->iRowid, pNode->iNode);\n      }\n    }\n  }\n  if( rc==SQLITE_OK ){\n    rc = fixBoundingBox(pRtree, pNode);\n  }\n  for(; rc==SQLITE_OK && ii<nCell; ii++){\n    /* Find a node to store this cell in. pNode->iNode currently contains\n    ** the height of the sub-tree headed by the cell.\n    */\n    RtreeNode *pInsert;\n    RtreeCell *p = &aCell[aOrder[ii]];\n    rc = ChooseLeaf(pRtree, p, iHeight, &pInsert);\n    if( rc==SQLITE_OK ){\n      int rc2;\n      rc = rtreeInsertCell(pRtree, pInsert, p, iHeight);\n      rc2 = nodeRelease(pRtree, pInsert);\n      if( rc==SQLITE_OK ){\n        rc = rc2;\n      }\n    }\n  }\n\n  sqlite3_free(aCell);\n  return rc;\n}\n\n/*\n** Insert cell pCell into node pNode. Node pNode is the head of a \n** subtree iHeight high (leaf nodes have iHeight==0).\n*/\nstatic int rtreeInsertCell(\n  Rtree *pRtree,\n  RtreeNode *pNode,\n  RtreeCell *pCell,\n  int iHeight\n){\n  int rc = SQLITE_OK;\n  if( iHeight>0 ){\n    RtreeNode *pChild = nodeHashLookup(pRtree, pCell->iRowid);\n    if( pChild ){\n      nodeRelease(pRtree, pChild->pParent);\n      nodeReference(pNode);\n      pChild->pParent = pNode;\n    }\n  }\n  if( nodeInsertCell(pRtree, pNode, pCell) ){\n    if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){\n      rc = SplitNode(pRtree, pNode, pCell, iHeight);\n    }else{\n      pRtree->iReinsertHeight = iHeight;\n      rc = Reinsert(pRtree, pNode, pCell, iHeight);\n    }\n  }else{\n    rc = AdjustTree(pRtree, pNode, pCell);\n    if( rc==SQLITE_OK ){\n      if( iHeight==0 ){\n        rc = rowidWrite(pRtree, pCell->iRowid, pNode->iNode);\n      }else{\n        rc = parentWrite(pRtree, pCell->iRowid, pNode->iNode);\n      }\n    }\n  }\n  return rc;\n}\n\nstatic int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){\n  int ii;\n  int rc = SQLITE_OK;\n  int nCell = NCELL(pNode);\n\n  for(ii=0; rc==SQLITE_OK && ii<nCell; ii++){\n    RtreeNode *pInsert;\n    RtreeCell cell;\n    nodeGetCell(pRtree, pNode, ii, &cell);\n\n    /* Find a node to store this cell in. pNode->iNode currently contains\n    ** the height of the sub-tree headed by the cell.\n    */\n    rc = ChooseLeaf(pRtree, &cell, (int)pNode->iNode, &pInsert);\n    if( rc==SQLITE_OK ){\n      int rc2;\n      rc = rtreeInsertCell(pRtree, pInsert, &cell, (int)pNode->iNode);\n      rc2 = nodeRelease(pRtree, pInsert);\n      if( rc==SQLITE_OK ){\n        rc = rc2;\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** Select a currently unused rowid for a new r-tree record.\n*/\nstatic int newRowid(Rtree *pRtree, i64 *piRowid){\n  int rc;\n  sqlite3_bind_null(pRtree->pWriteRowid, 1);\n  sqlite3_bind_null(pRtree->pWriteRowid, 2);\n  sqlite3_step(pRtree->pWriteRowid);\n  rc = sqlite3_reset(pRtree->pWriteRowid);\n  *piRowid = sqlite3_last_insert_rowid(pRtree->db);\n  return rc;\n}\n\n/*\n** Remove the entry with rowid=iDelete from the r-tree structure.\n*/\nstatic int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){\n  int rc;                         /* Return code */\n  RtreeNode *pLeaf = 0;           /* Leaf node containing record iDelete */\n  int iCell;                      /* Index of iDelete cell in pLeaf */\n  RtreeNode *pRoot;               /* Root node of rtree structure */\n\n\n  /* Obtain a reference to the root node to initialize Rtree.iDepth */\n  rc = nodeAcquire(pRtree, 1, 0, &pRoot);\n\n  /* Obtain a reference to the leaf node that contains the entry \n  ** about to be deleted. \n  */\n  if( rc==SQLITE_OK ){\n    rc = findLeafNode(pRtree, iDelete, &pLeaf, 0);\n  }\n\n  /* Delete the cell in question from the leaf node. */\n  if( rc==SQLITE_OK ){\n    int rc2;\n    rc = nodeRowidIndex(pRtree, pLeaf, iDelete, &iCell);\n    if( rc==SQLITE_OK ){\n      rc = deleteCell(pRtree, pLeaf, iCell, 0);\n    }\n    rc2 = nodeRelease(pRtree, pLeaf);\n    if( rc==SQLITE_OK ){\n      rc = rc2;\n    }\n  }\n\n  /* Delete the corresponding entry in the <rtree>_rowid table. */\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_int64(pRtree->pDeleteRowid, 1, iDelete);\n    sqlite3_step(pRtree->pDeleteRowid);\n    rc = sqlite3_reset(pRtree->pDeleteRowid);\n  }\n\n  /* Check if the root node now has exactly one child. If so, remove\n  ** it, schedule the contents of the child for reinsertion and \n  ** reduce the tree height by one.\n  **\n  ** This is equivalent to copying the contents of the child into\n  ** the root node (the operation that Gutman's paper says to perform \n  ** in this scenario).\n  */\n  if( rc==SQLITE_OK && pRtree->iDepth>0 && NCELL(pRoot)==1 ){\n    int rc2;\n    RtreeNode *pChild;\n    i64 iChild = nodeGetRowid(pRtree, pRoot, 0);\n    rc = nodeAcquire(pRtree, iChild, pRoot, &pChild);\n    if( rc==SQLITE_OK ){\n      rc = removeNode(pRtree, pChild, pRtree->iDepth-1);\n    }\n    rc2 = nodeRelease(pRtree, pChild);\n    if( rc==SQLITE_OK ) rc = rc2;\n    if( rc==SQLITE_OK ){\n      pRtree->iDepth--;\n      writeInt16(pRoot->zData, pRtree->iDepth);\n      pRoot->isDirty = 1;\n    }\n  }\n\n  /* Re-insert the contents of any underfull nodes removed from the tree. */\n  for(pLeaf=pRtree->pDeleted; pLeaf; pLeaf=pRtree->pDeleted){\n    if( rc==SQLITE_OK ){\n      rc = reinsertNodeContent(pRtree, pLeaf);\n    }\n    pRtree->pDeleted = pLeaf->pNext;\n    sqlite3_free(pLeaf);\n  }\n\n  /* Release the reference to the root node. */\n  if( rc==SQLITE_OK ){\n    rc = nodeRelease(pRtree, pRoot);\n  }else{\n    nodeRelease(pRtree, pRoot);\n  }\n\n  return rc;\n}\n\n/*\n** Rounding constants for float->double conversion.\n*/\n#define RNDTOWARDS  (1.0 - 1.0/8388608.0)  /* Round towards zero */\n#define RNDAWAY     (1.0 + 1.0/8388608.0)  /* Round away from zero */\n\n#if !defined(SQLITE_RTREE_INT_ONLY)\n/*\n** Convert an sqlite3_value into an RtreeValue (presumably a float)\n** while taking care to round toward negative or positive, respectively.\n*/\nstatic RtreeValue rtreeValueDown(sqlite3_value *v){\n  double d = sqlite3_value_double(v);\n  float f = (float)d;\n  if( f>d ){\n    f = (float)(d*(d<0 ? RNDAWAY : RNDTOWARDS));\n  }\n  return f;\n}\nstatic RtreeValue rtreeValueUp(sqlite3_value *v){\n  double d = sqlite3_value_double(v);\n  float f = (float)d;\n  if( f<d ){\n    f = (float)(d*(d<0 ? RNDTOWARDS : RNDAWAY));\n  }\n  return f;\n}\n#endif /* !defined(SQLITE_RTREE_INT_ONLY) */\n\n/*\n** A constraint has failed while inserting a row into an rtree table. \n** Assuming no OOM error occurs, this function sets the error message \n** (at pRtree->base.zErrMsg) to an appropriate value and returns\n** SQLITE_CONSTRAINT.\n**\n** Parameter iCol is the index of the leftmost column involved in the\n** constraint failure. If it is 0, then the constraint that failed is\n** the unique constraint on the id column. Otherwise, it is the rtree\n** (c1<=c2) constraint on columns iCol and iCol+1 that has failed.\n**\n** If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT.\n*/\nstatic int rtreeConstraintError(Rtree *pRtree, int iCol){\n  sqlite3_stmt *pStmt = 0;\n  char *zSql; \n  int rc;\n\n  assert( iCol==0 || iCol%2 );\n  zSql = sqlite3_mprintf(\"SELECT * FROM %Q.%Q\", pRtree->zDb, pRtree->zName);\n  if( zSql ){\n    rc = sqlite3_prepare_v2(pRtree->db, zSql, -1, &pStmt, 0);\n  }else{\n    rc = SQLITE_NOMEM;\n  }\n  sqlite3_free(zSql);\n\n  if( rc==SQLITE_OK ){\n    if( iCol==0 ){\n      const char *zCol = sqlite3_column_name(pStmt, 0);\n      pRtree->base.zErrMsg = sqlite3_mprintf(\n          \"UNIQUE constraint failed: %s.%s\", pRtree->zName, zCol\n      );\n    }else{\n      const char *zCol1 = sqlite3_column_name(pStmt, iCol);\n      const char *zCol2 = sqlite3_column_name(pStmt, iCol+1);\n      pRtree->base.zErrMsg = sqlite3_mprintf(\n          \"rtree constraint failed: %s.(%s<=%s)\", pRtree->zName, zCol1, zCol2\n      );\n    }\n  }\n\n  sqlite3_finalize(pStmt);\n  return (rc==SQLITE_OK ? SQLITE_CONSTRAINT : rc);\n}\n\n\n\n/*\n** The xUpdate method for rtree module virtual tables.\n*/\nstatic int rtreeUpdate(\n  sqlite3_vtab *pVtab, \n  int nData, \n  sqlite3_value **azData, \n  sqlite_int64 *pRowid\n){\n  Rtree *pRtree = (Rtree *)pVtab;\n  int rc = SQLITE_OK;\n  RtreeCell cell;                 /* New cell to insert if nData>1 */\n  int bHaveRowid = 0;             /* Set to 1 after new rowid is determined */\n\n  rtreeReference(pRtree);\n  assert(nData>=1);\n\n  cell.iRowid = 0;  /* Used only to suppress a compiler warning */\n\n  /* Constraint handling. A write operation on an r-tree table may return\n  ** SQLITE_CONSTRAINT for two reasons:\n  **\n  **   1. A duplicate rowid value, or\n  **   2. The supplied data violates the \"x2>=x1\" constraint.\n  **\n  ** In the first case, if the conflict-handling mode is REPLACE, then\n  ** the conflicting row can be removed before proceeding. In the second\n  ** case, SQLITE_CONSTRAINT must be returned regardless of the\n  ** conflict-handling mode specified by the user.\n  */\n  if( nData>1 ){\n    int ii;\n\n    /* Populate the cell.aCoord[] array. The first coordinate is azData[3].\n    **\n    ** NB: nData can only be less than nDim*2+3 if the rtree is mis-declared\n    ** with \"column\" that are interpreted as table constraints.\n    ** Example:  CREATE VIRTUAL TABLE bad USING rtree(x,y,CHECK(y>5));\n    ** This problem was discovered after years of use, so we silently ignore\n    ** these kinds of misdeclared tables to avoid breaking any legacy.\n    */\n    assert( nData<=(pRtree->nDim*2 + 3) );\n\n#ifndef SQLITE_RTREE_INT_ONLY\n    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){\n      for(ii=0; ii<nData-4; ii+=2){\n        cell.aCoord[ii].f = rtreeValueDown(azData[ii+3]);\n        cell.aCoord[ii+1].f = rtreeValueUp(azData[ii+4]);\n        if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){\n          rc = rtreeConstraintError(pRtree, ii+1);\n          goto constraint;\n        }\n      }\n    }else\n#endif\n    {\n      for(ii=0; ii<nData-4; ii+=2){\n        cell.aCoord[ii].i = sqlite3_value_int(azData[ii+3]);\n        cell.aCoord[ii+1].i = sqlite3_value_int(azData[ii+4]);\n        if( cell.aCoord[ii].i>cell.aCoord[ii+1].i ){\n          rc = rtreeConstraintError(pRtree, ii+1);\n          goto constraint;\n        }\n      }\n    }\n\n    /* If a rowid value was supplied, check if it is already present in \n    ** the table. If so, the constraint has failed. */\n    if( sqlite3_value_type(azData[2])!=SQLITE_NULL ){\n      cell.iRowid = sqlite3_value_int64(azData[2]);\n      if( sqlite3_value_type(azData[0])==SQLITE_NULL\n       || sqlite3_value_int64(azData[0])!=cell.iRowid\n      ){\n        int steprc;\n        sqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid);\n        steprc = sqlite3_step(pRtree->pReadRowid);\n        rc = sqlite3_reset(pRtree->pReadRowid);\n        if( SQLITE_ROW==steprc ){\n          if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){\n            rc = rtreeDeleteRowid(pRtree, cell.iRowid);\n          }else{\n            rc = rtreeConstraintError(pRtree, 0);\n            goto constraint;\n          }\n        }\n      }\n      bHaveRowid = 1;\n    }\n  }\n\n  /* If azData[0] is not an SQL NULL value, it is the rowid of a\n  ** record to delete from the r-tree table. The following block does\n  ** just that.\n  */\n  if( sqlite3_value_type(azData[0])!=SQLITE_NULL ){\n    rc = rtreeDeleteRowid(pRtree, sqlite3_value_int64(azData[0]));\n  }\n\n  /* If the azData[] array contains more than one element, elements\n  ** (azData[2]..azData[argc-1]) contain a new record to insert into\n  ** the r-tree structure.\n  */\n  if( rc==SQLITE_OK && nData>1 ){\n    /* Insert the new record into the r-tree */\n    RtreeNode *pLeaf = 0;\n\n    /* Figure out the rowid of the new row. */\n    if( bHaveRowid==0 ){\n      rc = newRowid(pRtree, &cell.iRowid);\n    }\n    *pRowid = cell.iRowid;\n\n    if( rc==SQLITE_OK ){\n      rc = ChooseLeaf(pRtree, &cell, 0, &pLeaf);\n    }\n    if( rc==SQLITE_OK ){\n      int rc2;\n      pRtree->iReinsertHeight = -1;\n      rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0);\n      rc2 = nodeRelease(pRtree, pLeaf);\n      if( rc==SQLITE_OK ){\n        rc = rc2;\n      }\n    }\n  }\n\nconstraint:\n  rtreeRelease(pRtree);\n  return rc;\n}\n\n/*\n** The xRename method for rtree module virtual tables.\n*/\nstatic int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){\n  Rtree *pRtree = (Rtree *)pVtab;\n  int rc = SQLITE_NOMEM;\n  char *zSql = sqlite3_mprintf(\n    \"ALTER TABLE %Q.'%q_node'   RENAME TO \\\"%w_node\\\";\"\n    \"ALTER TABLE %Q.'%q_parent' RENAME TO \\\"%w_parent\\\";\"\n    \"ALTER TABLE %Q.'%q_rowid'  RENAME TO \\\"%w_rowid\\\";\"\n    , pRtree->zDb, pRtree->zName, zNewName \n    , pRtree->zDb, pRtree->zName, zNewName \n    , pRtree->zDb, pRtree->zName, zNewName\n  );\n  if( zSql ){\n    rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0);\n    sqlite3_free(zSql);\n  }\n  return rc;\n}\n\n/*\n** This function populates the pRtree->nRowEst variable with an estimate\n** of the number of rows in the virtual table. If possible, this is based\n** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST.\n*/\nstatic int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){\n  const char *zFmt = \"SELECT stat FROM %Q.sqlite_stat1 WHERE tbl = '%q_rowid'\";\n  char *zSql;\n  sqlite3_stmt *p;\n  int rc;\n  i64 nRow = 0;\n\n  rc = sqlite3_table_column_metadata(\n      db, pRtree->zDb, \"sqlite_stat1\",0,0,0,0,0,0\n  );\n  if( rc!=SQLITE_OK ){\n    pRtree->nRowEst = RTREE_DEFAULT_ROWEST;\n    return rc==SQLITE_ERROR ? SQLITE_OK : rc;\n  }\n  zSql = sqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName);\n  if( zSql==0 ){\n    rc = SQLITE_NOMEM;\n  }else{\n    rc = sqlite3_prepare_v2(db, zSql, -1, &p, 0);\n    if( rc==SQLITE_OK ){\n      if( sqlite3_step(p)==SQLITE_ROW ) nRow = sqlite3_column_int64(p, 0);\n      rc = sqlite3_finalize(p);\n    }else if( rc!=SQLITE_NOMEM ){\n      rc = SQLITE_OK;\n    }\n\n    if( rc==SQLITE_OK ){\n      if( nRow==0 ){\n        pRtree->nRowEst = RTREE_DEFAULT_ROWEST;\n      }else{\n        pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST);\n      }\n    }\n    sqlite3_free(zSql);\n  }\n\n  return rc;\n}\n\nstatic sqlite3_module rtreeModule = {\n  0,                          /* iVersion */\n  rtreeCreate,                /* xCreate - create a table */\n  rtreeConnect,               /* xConnect - connect to an existing table */\n  rtreeBestIndex,             /* xBestIndex - Determine search strategy */\n  rtreeDisconnect,            /* xDisconnect - Disconnect from a table */\n  rtreeDestroy,               /* xDestroy - Drop a table */\n  rtreeOpen,                  /* xOpen - open a cursor */\n  rtreeClose,                 /* xClose - close a cursor */\n  rtreeFilter,                /* xFilter - configure scan constraints */\n  rtreeNext,                  /* xNext - advance a cursor */\n  rtreeEof,                   /* xEof */\n  rtreeColumn,                /* xColumn - read data */\n  rtreeRowid,                 /* xRowid - read data */\n  rtreeUpdate,                /* xUpdate - write data */\n  0,                          /* xBegin - begin transaction */\n  0,                          /* xSync - sync transaction */\n  0,                          /* xCommit - commit transaction */\n  0,                          /* xRollback - rollback transaction */\n  0,                          /* xFindFunction - function overloading */\n  rtreeRename,                /* xRename - rename the table */\n  0,                          /* xSavepoint */\n  0,                          /* xRelease */\n  0                           /* xRollbackTo */\n};\n\nstatic int rtreeSqlInit(\n  Rtree *pRtree, \n  sqlite3 *db, \n  const char *zDb, \n  const char *zPrefix, \n  int isCreate\n){\n  int rc = SQLITE_OK;\n\n  #define N_STATEMENT 9\n  static const char *azSql[N_STATEMENT] = {\n    /* Read and write the xxx_node table */\n    \"SELECT data FROM '%q'.'%q_node' WHERE nodeno = :1\",\n    \"INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(:1, :2)\",\n    \"DELETE FROM '%q'.'%q_node' WHERE nodeno = :1\",\n\n    /* Read and write the xxx_rowid table */\n    \"SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1\",\n    \"INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(:1, :2)\",\n    \"DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1\",\n\n    /* Read and write the xxx_parent table */\n    \"SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = :1\",\n    \"INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(:1, :2)\",\n    \"DELETE FROM '%q'.'%q_parent' WHERE nodeno = :1\"\n  };\n  sqlite3_stmt **appStmt[N_STATEMENT];\n  int i;\n\n  pRtree->db = db;\n\n  if( isCreate ){\n    char *zCreate = sqlite3_mprintf(\n\"CREATE TABLE \\\"%w\\\".\\\"%w_node\\\"(nodeno INTEGER PRIMARY KEY, data BLOB);\"\n\"CREATE TABLE \\\"%w\\\".\\\"%w_rowid\\\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);\"\n\"CREATE TABLE \\\"%w\\\".\\\"%w_parent\\\"(nodeno INTEGER PRIMARY KEY,\"\n                                  \" parentnode INTEGER);\"\n\"INSERT INTO '%q'.'%q_node' VALUES(1, zeroblob(%d))\",\n      zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, pRtree->iNodeSize\n    );\n    if( !zCreate ){\n      return SQLITE_NOMEM;\n    }\n    rc = sqlite3_exec(db, zCreate, 0, 0, 0);\n    sqlite3_free(zCreate);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n  }\n\n  appStmt[0] = &pRtree->pReadNode;\n  appStmt[1] = &pRtree->pWriteNode;\n  appStmt[2] = &pRtree->pDeleteNode;\n  appStmt[3] = &pRtree->pReadRowid;\n  appStmt[4] = &pRtree->pWriteRowid;\n  appStmt[5] = &pRtree->pDeleteRowid;\n  appStmt[6] = &pRtree->pReadParent;\n  appStmt[7] = &pRtree->pWriteParent;\n  appStmt[8] = &pRtree->pDeleteParent;\n\n  rc = rtreeQueryStat1(db, pRtree);\n  for(i=0; i<N_STATEMENT && rc==SQLITE_OK; i++){\n    char *zSql = sqlite3_mprintf(azSql[i], zDb, zPrefix);\n    if( zSql ){\n      rc = sqlite3_prepare_v2(db, zSql, -1, appStmt[i], 0); \n    }else{\n      rc = SQLITE_NOMEM;\n    }\n    sqlite3_free(zSql);\n  }\n\n  return rc;\n}\n\n/*\n** The second argument to this function contains the text of an SQL statement\n** that returns a single integer value. The statement is compiled and executed\n** using database connection db. If successful, the integer value returned\n** is written to *piVal and SQLITE_OK returned. Otherwise, an SQLite error\n** code is returned and the value of *piVal after returning is not defined.\n*/\nstatic int getIntFromStmt(sqlite3 *db, const char *zSql, int *piVal){\n  int rc = SQLITE_NOMEM;\n  if( zSql ){\n    sqlite3_stmt *pStmt = 0;\n    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\n    if( rc==SQLITE_OK ){\n      if( SQLITE_ROW==sqlite3_step(pStmt) ){\n        *piVal = sqlite3_column_int(pStmt, 0);\n      }\n      rc = sqlite3_finalize(pStmt);\n    }\n  }\n  return rc;\n}\n\n/*\n** This function is called from within the xConnect() or xCreate() method to\n** determine the node-size used by the rtree table being created or connected\n** to. If successful, pRtree->iNodeSize is populated and SQLITE_OK returned.\n** Otherwise, an SQLite error code is returned.\n**\n** If this function is being called as part of an xConnect(), then the rtree\n** table already exists. In this case the node-size is determined by inspecting\n** the root node of the tree.\n**\n** Otherwise, for an xCreate(), use 64 bytes less than the database page-size. \n** This ensures that each node is stored on a single database page. If the \n** database page-size is so large that more than RTREE_MAXCELLS entries \n** would fit in a single node, use a smaller node-size.\n*/\nstatic int getNodeSize(\n  sqlite3 *db,                    /* Database handle */\n  Rtree *pRtree,                  /* Rtree handle */\n  int isCreate,                   /* True for xCreate, false for xConnect */\n  char **pzErr                    /* OUT: Error message, if any */\n){\n  int rc;\n  char *zSql;\n  if( isCreate ){\n    int iPageSize = 0;\n    zSql = sqlite3_mprintf(\"PRAGMA %Q.page_size\", pRtree->zDb);\n    rc = getIntFromStmt(db, zSql, &iPageSize);\n    if( rc==SQLITE_OK ){\n      pRtree->iNodeSize = iPageSize-64;\n      if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)<pRtree->iNodeSize ){\n        pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS;\n      }\n    }else{\n      *pzErr = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\n    }\n  }else{\n    zSql = sqlite3_mprintf(\n        \"SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1\",\n        pRtree->zDb, pRtree->zName\n    );\n    rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);\n    if( rc!=SQLITE_OK ){\n      *pzErr = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\n    }\n  }\n\n  sqlite3_free(zSql);\n  return rc;\n}\n\n/* \n** This function is the implementation of both the xConnect and xCreate\n** methods of the r-tree virtual table.\n**\n**   argv[0]   -> module name\n**   argv[1]   -> database name\n**   argv[2]   -> table name\n**   argv[...] -> column names...\n*/\nstatic int rtreeInit(\n  sqlite3 *db,                        /* Database connection */\n  void *pAux,                         /* One of the RTREE_COORD_* constants */\n  int argc, const char *const*argv,   /* Parameters to CREATE TABLE statement */\n  sqlite3_vtab **ppVtab,              /* OUT: New virtual table */\n  char **pzErr,                       /* OUT: Error message, if any */\n  int isCreate                        /* True for xCreate, false for xConnect */\n){\n  int rc = SQLITE_OK;\n  Rtree *pRtree;\n  int nDb;              /* Length of string argv[1] */\n  int nName;            /* Length of string argv[2] */\n  int eCoordType = (pAux ? RTREE_COORD_INT32 : RTREE_COORD_REAL32);\n\n  const char *aErrMsg[] = {\n    0,                                                    /* 0 */\n    \"Wrong number of columns for an rtree table\",         /* 1 */\n    \"Too few columns for an rtree table\",                 /* 2 */\n    \"Too many columns for an rtree table\"                 /* 3 */\n  };\n\n  int iErr = (argc<6) ? 2 : argc>(RTREE_MAX_DIMENSIONS*2+4) ? 3 : argc%2;\n  if( aErrMsg[iErr] ){\n    *pzErr = sqlite3_mprintf(\"%s\", aErrMsg[iErr]);\n    return SQLITE_ERROR;\n  }\n\n  sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1);\n\n  /* Allocate the sqlite3_vtab structure */\n  nDb = (int)strlen(argv[1]);\n  nName = (int)strlen(argv[2]);\n  pRtree = (Rtree *)sqlite3_malloc(sizeof(Rtree)+nDb+nName+2);\n  if( !pRtree ){\n    return SQLITE_NOMEM;\n  }\n  memset(pRtree, 0, sizeof(Rtree)+nDb+nName+2);\n  pRtree->nBusy = 1;\n  pRtree->base.pModule = &rtreeModule;\n  pRtree->zDb = (char *)&pRtree[1];\n  pRtree->zName = &pRtree->zDb[nDb+1];\n  pRtree->nDim = (argc-4)/2;\n  pRtree->nBytesPerCell = 8 + pRtree->nDim*4*2;\n  pRtree->eCoordType = eCoordType;\n  memcpy(pRtree->zDb, argv[1], nDb);\n  memcpy(pRtree->zName, argv[2], nName);\n\n  /* Figure out the node size to use. */\n  rc = getNodeSize(db, pRtree, isCreate, pzErr);\n\n  /* Create/Connect to the underlying relational database schema. If\n  ** that is successful, call sqlite3_declare_vtab() to configure\n  ** the r-tree table schema.\n  */\n  if( rc==SQLITE_OK ){\n    if( (rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate)) ){\n      *pzErr = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\n    }else{\n      char *zSql = sqlite3_mprintf(\"CREATE TABLE x(%s\", argv[3]);\n      char *zTmp;\n      int ii;\n      for(ii=4; zSql && ii<argc; ii++){\n        zTmp = zSql;\n        zSql = sqlite3_mprintf(\"%s, %s\", zTmp, argv[ii]);\n        sqlite3_free(zTmp);\n      }\n      if( zSql ){\n        zTmp = zSql;\n        zSql = sqlite3_mprintf(\"%s);\", zTmp);\n        sqlite3_free(zTmp);\n      }\n      if( !zSql ){\n        rc = SQLITE_NOMEM;\n      }else if( SQLITE_OK!=(rc = sqlite3_declare_vtab(db, zSql)) ){\n        *pzErr = sqlite3_mprintf(\"%s\", sqlite3_errmsg(db));\n      }\n      sqlite3_free(zSql);\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    *ppVtab = (sqlite3_vtab *)pRtree;\n  }else{\n    assert( *ppVtab==0 );\n    assert( pRtree->nBusy==1 );\n    rtreeRelease(pRtree);\n  }\n  return rc;\n}\n\n\n/*\n** Implementation of a scalar function that decodes r-tree nodes to\n** human readable strings. This can be used for debugging and analysis.\n**\n** The scalar function takes two arguments: (1) the number of dimensions\n** to the rtree (between 1 and 5, inclusive) and (2) a blob of data containing\n** an r-tree node.  For a two-dimensional r-tree structure called \"rt\", to\n** deserialize all nodes, a statement like:\n**\n**   SELECT rtreenode(2, data) FROM rt_node;\n**\n** The human readable string takes the form of a Tcl list with one\n** entry for each cell in the r-tree node. Each entry is itself a\n** list, containing the 8-byte rowid/pageno followed by the \n** <num-dimension>*2 coordinates.\n*/\nstatic void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){\n  char *zText = 0;\n  RtreeNode node;\n  Rtree tree;\n  int ii;\n\n  UNUSED_PARAMETER(nArg);\n  memset(&node, 0, sizeof(RtreeNode));\n  memset(&tree, 0, sizeof(Rtree));\n  tree.nDim = sqlite3_value_int(apArg[0]);\n  tree.nBytesPerCell = 8 + 8 * tree.nDim;\n  node.zData = (u8 *)sqlite3_value_blob(apArg[1]);\n\n  for(ii=0; ii<NCELL(&node); ii++){\n    char zCell[512];\n    int nCell = 0;\n    RtreeCell cell;\n    int jj;\n\n    nodeGetCell(&tree, &node, ii, &cell);\n    sqlite3_snprintf(512-nCell,&zCell[nCell],\"%lld\", cell.iRowid);\n    nCell = (int)strlen(zCell);\n    for(jj=0; jj<tree.nDim*2; jj++){\n#ifndef SQLITE_RTREE_INT_ONLY\n      sqlite3_snprintf(512-nCell,&zCell[nCell], \" %g\",\n                       (double)cell.aCoord[jj].f);\n#else\n      sqlite3_snprintf(512-nCell,&zCell[nCell], \" %d\",\n                       cell.aCoord[jj].i);\n#endif\n      nCell = (int)strlen(zCell);\n    }\n\n    if( zText ){\n      char *zTextNew = sqlite3_mprintf(\"%s {%s}\", zText, zCell);\n      sqlite3_free(zText);\n      zText = zTextNew;\n    }else{\n      zText = sqlite3_mprintf(\"{%s}\", zCell);\n    }\n  }\n  \n  sqlite3_result_text(ctx, zText, -1, sqlite3_free);\n}\n\n/* This routine implements an SQL function that returns the \"depth\" parameter\n** from the front of a blob that is an r-tree node.  For example:\n**\n**     SELECT rtreedepth(data) FROM rt_node WHERE nodeno=1;\n**\n** The depth value is 0 for all nodes other than the root node, and the root\n** node always has nodeno=1, so the example above is the primary use for this\n** routine.  This routine is intended for testing and analysis only.\n*/\nstatic void rtreedepth(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){\n  UNUSED_PARAMETER(nArg);\n  if( sqlite3_value_type(apArg[0])!=SQLITE_BLOB \n   || sqlite3_value_bytes(apArg[0])<2\n  ){\n    sqlite3_result_error(ctx, \"Invalid argument to rtreedepth()\", -1); \n  }else{\n    u8 *zBlob = (u8 *)sqlite3_value_blob(apArg[0]);\n    sqlite3_result_int(ctx, readInt16(zBlob));\n  }\n}\n\n/*\n** Register the r-tree module with database handle db. This creates the\n** virtual table module \"rtree\" and the debugging/analysis scalar \n** function \"rtreenode\".\n*/\nint sqlite3RtreeInit(sqlite3 *db){\n  const int utf8 = SQLITE_UTF8;\n  int rc;\n\n  rc = sqlite3_create_function(db, \"rtreenode\", 2, utf8, 0, rtreenode, 0, 0);\n  if( rc==SQLITE_OK ){\n    rc = sqlite3_create_function(db, \"rtreedepth\", 1, utf8, 0,rtreedepth, 0, 0);\n  }\n  if( rc==SQLITE_OK ){\n#ifdef SQLITE_RTREE_INT_ONLY\n    void *c = (void *)RTREE_COORD_INT32;\n#else\n    void *c = (void *)RTREE_COORD_REAL32;\n#endif\n    rc = sqlite3_create_module_v2(db, \"rtree\", &rtreeModule, c, 0);\n  }\n  if( rc==SQLITE_OK ){\n    void *c = (void *)RTREE_COORD_INT32;\n    rc = sqlite3_create_module_v2(db, \"rtree_i32\", &rtreeModule, c, 0);\n  }\n\n  return rc;\n}\n\n/*\n** This routine deletes the RtreeGeomCallback object that was attached\n** one of the SQL functions create by sqlite3_rtree_geometry_callback()\n** or sqlite3_rtree_query_callback().  In other words, this routine is the\n** destructor for an RtreeGeomCallback objecct.  This routine is called when\n** the corresponding SQL function is deleted.\n*/\nstatic void rtreeFreeCallback(void *p){\n  RtreeGeomCallback *pInfo = (RtreeGeomCallback*)p;\n  if( pInfo->xDestructor ) pInfo->xDestructor(pInfo->pContext);\n  sqlite3_free(p);\n}\n\n/*\n** This routine frees the BLOB that is returned by geomCallback().\n*/\nstatic void rtreeMatchArgFree(void *pArg){\n  int i;\n  RtreeMatchArg *p = (RtreeMatchArg*)pArg;\n  for(i=0; i<p->nParam; i++){\n    sqlite3_value_free(p->apSqlParam[i]);\n  }\n  sqlite3_free(p);\n}\n\n/*\n** Each call to sqlite3_rtree_geometry_callback() or\n** sqlite3_rtree_query_callback() creates an ordinary SQLite\n** scalar function that is implemented by this routine.\n**\n** All this function does is construct an RtreeMatchArg object that\n** contains the geometry-checking callback routines and a list of\n** parameters to this function, then return that RtreeMatchArg object\n** as a BLOB.\n**\n** The R-Tree MATCH operator will read the returned BLOB, deserialize\n** the RtreeMatchArg object, and use the RtreeMatchArg object to figure\n** out which elements of the R-Tree should be returned by the query.\n*/\nstatic void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){\n  RtreeGeomCallback *pGeomCtx = (RtreeGeomCallback *)sqlite3_user_data(ctx);\n  RtreeMatchArg *pBlob;\n  int nBlob;\n  int memErr = 0;\n\n  nBlob = sizeof(RtreeMatchArg) + (nArg-1)*sizeof(RtreeDValue)\n           + nArg*sizeof(sqlite3_value*);\n  pBlob = (RtreeMatchArg *)sqlite3_malloc(nBlob);\n  if( !pBlob ){\n    sqlite3_result_error_nomem(ctx);\n  }else{\n    int i;\n    pBlob->magic = RTREE_GEOMETRY_MAGIC;\n    pBlob->cb = pGeomCtx[0];\n    pBlob->apSqlParam = (sqlite3_value**)&pBlob->aParam[nArg];\n    pBlob->nParam = nArg;\n    for(i=0; i<nArg; i++){\n      pBlob->apSqlParam[i] = sqlite3_value_dup(aArg[i]);\n      if( pBlob->apSqlParam[i]==0 ) memErr = 1;\n#ifdef SQLITE_RTREE_INT_ONLY\n      pBlob->aParam[i] = sqlite3_value_int64(aArg[i]);\n#else\n      pBlob->aParam[i] = sqlite3_value_double(aArg[i]);\n#endif\n    }\n    if( memErr ){\n      sqlite3_result_error_nomem(ctx);\n      rtreeMatchArgFree(pBlob);\n    }else{\n      sqlite3_result_blob(ctx, pBlob, nBlob, rtreeMatchArgFree);\n    }\n  }\n}\n\n/*\n** Register a new geometry function for use with the r-tree MATCH operator.\n*/\nint sqlite3_rtree_geometry_callback(\n  sqlite3 *db,                  /* Register SQL function on this connection */\n  const char *zGeom,            /* Name of the new SQL function */\n  int (*xGeom)(sqlite3_rtree_geometry*,int,RtreeDValue*,int*), /* Callback */\n  void *pContext                /* Extra data associated with the callback */\n){\n  RtreeGeomCallback *pGeomCtx;      /* Context object for new user-function */\n\n  /* Allocate and populate the context object. */\n  pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback));\n  if( !pGeomCtx ) return SQLITE_NOMEM;\n  pGeomCtx->xGeom = xGeom;\n  pGeomCtx->xQueryFunc = 0;\n  pGeomCtx->xDestructor = 0;\n  pGeomCtx->pContext = pContext;\n  return sqlite3_create_function_v2(db, zGeom, -1, SQLITE_ANY, \n      (void *)pGeomCtx, geomCallback, 0, 0, rtreeFreeCallback\n  );\n}\n\n/*\n** Register a new 2nd-generation geometry function for use with the\n** r-tree MATCH operator.\n*/\nint sqlite3_rtree_query_callback(\n  sqlite3 *db,                 /* Register SQL function on this connection */\n  const char *zQueryFunc,      /* Name of new SQL function */\n  int (*xQueryFunc)(sqlite3_rtree_query_info*), /* Callback */\n  void *pContext,              /* Extra data passed into the callback */\n  void (*xDestructor)(void*)   /* Destructor for the extra data */\n){\n  RtreeGeomCallback *pGeomCtx;      /* Context object for new user-function */\n\n  /* Allocate and populate the context object. */\n  pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback));\n  if( !pGeomCtx ) return SQLITE_NOMEM;\n  pGeomCtx->xGeom = 0;\n  pGeomCtx->xQueryFunc = xQueryFunc;\n  pGeomCtx->xDestructor = xDestructor;\n  pGeomCtx->pContext = pContext;\n  return sqlite3_create_function_v2(db, zQueryFunc, -1, SQLITE_ANY, \n      (void *)pGeomCtx, geomCallback, 0, 0, rtreeFreeCallback\n  );\n}\n\n#if !SQLITE_CORE\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nint sqlite3_rtree_init(\n  sqlite3 *db,\n  char **pzErrMsg,\n  const sqlite3_api_routines *pApi\n){\n  SQLITE_EXTENSION_INIT2(pApi)\n  return sqlite3RtreeInit(db);\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/rtree/rtree.h",
    "content": "/*\n** 2008 May 26\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This header file is used by programs that want to link against the\n** RTREE library.  All it does is declare the sqlite3RtreeInit() interface.\n*/\n#include \"sqlite3.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif  /* __cplusplus */\n\nint sqlite3RtreeInit(sqlite3 *db);\n\n#ifdef __cplusplus\n}  /* extern \"C\" */\n#endif  /* __cplusplus */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/rtree/sqlite3rtree.h",
    "content": "/*\n** 2010 August 30\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n*/\n\n#ifndef _SQLITE3RTREE_H_\n#define _SQLITE3RTREE_H_\n\n#include <sqlite3.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;\ntypedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;\n\n/* The double-precision datatype used by RTree depends on the\n** SQLITE_RTREE_INT_ONLY compile-time option.\n*/\n#ifdef SQLITE_RTREE_INT_ONLY\n  typedef sqlite3_int64 sqlite3_rtree_dbl;\n#else\n  typedef double sqlite3_rtree_dbl;\n#endif\n\n/*\n** Register a geometry callback named zGeom that can be used as part of an\n** R-Tree geometry query as follows:\n**\n**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)\n*/\nint sqlite3_rtree_geometry_callback(\n  sqlite3 *db,\n  const char *zGeom,\n  int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),\n  void *pContext\n);\n\n\n/*\n** A pointer to a structure of the following type is passed as the first\n** argument to callbacks registered using rtree_geometry_callback().\n*/\nstruct sqlite3_rtree_geometry {\n  void *pContext;                 /* Copy of pContext passed to s_r_g_c() */\n  int nParam;                     /* Size of array aParam[] */\n  sqlite3_rtree_dbl *aParam;      /* Parameters passed to SQL geom function */\n  void *pUser;                    /* Callback implementation user data */\n  void (*xDelUser)(void *);       /* Called by SQLite to clean up pUser */\n};\n\n/*\n** Register a 2nd-generation geometry callback named zScore that can be \n** used as part of an R-Tree geometry query as follows:\n**\n**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)\n*/\nint sqlite3_rtree_query_callback(\n  sqlite3 *db,\n  const char *zQueryFunc,\n  int (*xQueryFunc)(sqlite3_rtree_query_info*),\n  void *pContext,\n  void (*xDestructor)(void*)\n);\n\n\n/*\n** A pointer to a structure of the following type is passed as the \n** argument to scored geometry callback registered using\n** sqlite3_rtree_query_callback().\n**\n** Note that the first 5 fields of this structure are identical to\n** sqlite3_rtree_geometry.  This structure is a subclass of\n** sqlite3_rtree_geometry.\n*/\nstruct sqlite3_rtree_query_info {\n  void *pContext;                   /* pContext from when function registered */\n  int nParam;                       /* Number of function parameters */\n  sqlite3_rtree_dbl *aParam;        /* value of function parameters */\n  void *pUser;                      /* callback can use this, if desired */\n  void (*xDelUser)(void*);          /* function to free pUser */\n  sqlite3_rtree_dbl *aCoord;        /* Coordinates of node or entry to check */\n  unsigned int *anQueue;            /* Number of pending entries in the queue */\n  int nCoord;                       /* Number of coordinates */\n  int iLevel;                       /* Level of current node or entry */\n  int mxLevel;                      /* The largest iLevel value in the tree */\n  sqlite3_int64 iRowid;             /* Rowid for current entry */\n  sqlite3_rtree_dbl rParentScore;   /* Score of parent node */\n  int eParentWithin;                /* Visibility of parent node */\n  int eWithin;                      /* OUT: Visiblity */\n  sqlite3_rtree_dbl rScore;         /* OUT: Write the score here */\n  /* The following fields are only available in 3.8.11 and later */\n  sqlite3_value **apSqlParam;       /* Original SQL values of parameters */\n};\n\n/*\n** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.\n*/\n#define NOT_WITHIN       0   /* Object completely outside of query region */\n#define PARTLY_WITHIN    1   /* Object partially overlaps query region */\n#define FULLY_WITHIN     2   /* Object fully contained within query region */\n\n\n#ifdef __cplusplus\n}  /* end of the 'extern \"C\"' block */\n#endif\n\n#endif  /* ifndef _SQLITE3RTREE_H_ */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/ext/userauth/sqlite3userauth.h",
    "content": "/*\n** 2014-09-08\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains the application interface definitions for the\n** user-authentication extension feature.\n**\n** To compile with the user-authentication feature, append this file to\n** end of an SQLite amalgamation header file (\"sqlite3.h\"), then add\n** the SQLITE_USER_AUTHENTICATION compile-time option.  See the\n** user-auth.txt file in the same source directory as this file for\n** additional information.\n*/\n#ifdef SQLITE_USER_AUTHENTICATION\n\n/*\n** If a database contains the SQLITE_USER table, then the\n** sqlite3_user_authenticate() interface must be invoked with an\n** appropriate username and password prior to enable read and write\n** access to the database.\n**\n** Return SQLITE_OK on success or SQLITE_ERROR if the username/password\n** combination is incorrect or unknown.\n**\n** If the SQLITE_USER table is not present in the database file, then\n** this interface is a harmless no-op returnning SQLITE_OK.\n*/\nint sqlite3_user_authenticate(\n  sqlite3 *db,           /* The database connection */\n  const char *zUsername, /* Username */\n  const char *aPW,       /* Password or credentials */\n  int nPW                /* Number of bytes in aPW[] */\n);\n\n/*\n** The sqlite3_user_add() interface can be used (by an admin user only)\n** to create a new user.  When called on a no-authentication-required\n** database, this routine converts the database into an authentication-\n** required database, automatically makes the added user an\n** administrator, and logs in the current connection as that user.\n** The sqlite3_user_add() interface only works for the \"main\" database, not\n** for any ATTACH-ed databases.  Any call to sqlite3_user_add() by a\n** non-admin user results in an error.\n*/\nint sqlite3_user_add(\n  sqlite3 *db,           /* Database connection */\n  const char *zUsername, /* Username to be added */\n  const char *aPW,       /* Password or credentials */\n  int nPW,               /* Number of bytes in aPW[] */\n  int isAdmin            /* True to give new user admin privilege */\n);\n\n/*\n** The sqlite3_user_change() interface can be used to change a users\n** login credentials or admin privilege.  Any user can change their own\n** login credentials.  Only an admin user can change another users login\n** credentials or admin privilege setting.  No user may change their own \n** admin privilege setting.\n*/\nint sqlite3_user_change(\n  sqlite3 *db,           /* Database connection */\n  const char *zUsername, /* Username to change */\n  const char *aPW,       /* New password or credentials */\n  int nPW,               /* Number of bytes in aPW[] */\n  int isAdmin            /* Modified admin privilege for the user */\n);\n\n/*\n** The sqlite3_user_delete() interface can be used (by an admin user only)\n** to delete a user.  The currently logged-in user cannot be deleted,\n** which guarantees that there is always an admin user and hence that\n** the database cannot be converted into a no-authentication-required\n** database.\n*/\nint sqlite3_user_delete(\n  sqlite3 *db,           /* Database connection */\n  const char *zUsername  /* Username to remove */\n);\n\n#endif /* SQLITE_USER_AUTHENTICATION */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/fts5.c",
    "content": "\n\n#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) \n\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) \n# define NDEBUG 1\n#endif\n#if defined(NDEBUG) && defined(SQLITE_DEBUG)\n# undef NDEBUG\n#endif\n\n#line 1 \"fts5.h\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** Interfaces to extend FTS5. Using the interfaces defined in this file, \n** FTS5 may be extended with:\n**\n**     * custom tokenizers, and\n**     * custom auxiliary functions.\n*/\n\n\n#ifndef _FTS5_H\n#define _FTS5_H\n\n#include \"sqlite3.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*************************************************************************\n** CUSTOM AUXILIARY FUNCTIONS\n**\n** Virtual table implementations may overload SQL functions by implementing\n** the sqlite3_module.xFindFunction() method.\n*/\n\ntypedef struct Fts5ExtensionApi Fts5ExtensionApi;\ntypedef struct Fts5Context Fts5Context;\ntypedef struct Fts5PhraseIter Fts5PhraseIter;\n\ntypedef void (*fts5_extension_function)(\n  const Fts5ExtensionApi *pApi,   /* API offered by current FTS version */\n  Fts5Context *pFts,              /* First arg to pass to pApi functions */\n  sqlite3_context *pCtx,          /* Context for returning result/error */\n  int nVal,                       /* Number of values in apVal[] array */\n  sqlite3_value **apVal           /* Array of trailing arguments */\n);\n\nstruct Fts5PhraseIter {\n  const unsigned char *a;\n  const unsigned char *b;\n};\n\n/*\n** EXTENSION API FUNCTIONS\n**\n** xUserData(pFts):\n**   Return a copy of the context pointer the extension function was \n**   registered with.\n**\n** xColumnTotalSize(pFts, iCol, pnToken):\n**   If parameter iCol is less than zero, set output variable *pnToken\n**   to the total number of tokens in the FTS5 table. Or, if iCol is\n**   non-negative but less than the number of columns in the table, return\n**   the total number of tokens in column iCol, considering all rows in \n**   the FTS5 table.\n**\n**   If parameter iCol is greater than or equal to the number of columns\n**   in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.\n**   an OOM condition or IO error), an appropriate SQLite error code is \n**   returned.\n**\n** xColumnCount(pFts):\n**   Return the number of columns in the table.\n**\n** xColumnSize(pFts, iCol, pnToken):\n**   If parameter iCol is less than zero, set output variable *pnToken\n**   to the total number of tokens in the current row. Or, if iCol is\n**   non-negative but less than the number of columns in the table, set\n**   *pnToken to the number of tokens in column iCol of the current row.\n**\n**   If parameter iCol is greater than or equal to the number of columns\n**   in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.\n**   an OOM condition or IO error), an appropriate SQLite error code is \n**   returned.\n**\n**   This function may be quite inefficient if used with an FTS5 table\n**   created with the \"columnsize=0\" option.\n**\n** xColumnText:\n**   This function attempts to retrieve the text of column iCol of the\n**   current document. If successful, (*pz) is set to point to a buffer\n**   containing the text in utf-8 encoding, (*pn) is set to the size in bytes\n**   (not characters) of the buffer and SQLITE_OK is returned. Otherwise,\n**   if an error occurs, an SQLite error code is returned and the final values\n**   of (*pz) and (*pn) are undefined.\n**\n** xPhraseCount:\n**   Returns the number of phrases in the current query expression.\n**\n** xPhraseSize:\n**   Returns the number of tokens in phrase iPhrase of the query. Phrases\n**   are numbered starting from zero.\n**\n** xInstCount:\n**   Set *pnInst to the total number of occurrences of all phrases within\n**   the query within the current row. Return SQLITE_OK if successful, or\n**   an error code (i.e. SQLITE_NOMEM) if an error occurs.\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. If the FTS5 table is created \n**   with either \"detail=none\" or \"detail=column\" and \"content=\" option \n**   (i.e. if it is a contentless table), then this API always returns 0.\n**\n** xInst:\n**   Query for the details of phrase match iIdx within the current row.\n**   Phrase matches are numbered starting from zero, so the iIdx argument\n**   should be greater than or equal to zero and smaller than the value\n**   output by xInstCount().\n**\n**   Usually, output parameter *piPhrase is set to the phrase number, *piCol\n**   to the column in which it occurs and *piOff the token offset of the\n**   first token of the phrase. The exception is if the table was created\n**   with the offsets=0 option specified. In this case *piOff is always\n**   set to -1.\n**\n**   Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM) \n**   if an error occurs.\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. \n**\n** xRowid:\n**   Returns the rowid of the current row.\n**\n** xTokenize:\n**   Tokenize text using the tokenizer belonging to the FTS5 table.\n**\n** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):\n**   This API function is used to query the FTS table for phrase iPhrase\n**   of the current query. Specifically, a query equivalent to:\n**\n**       ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid\n**\n**   with $p set to a phrase equivalent to the phrase iPhrase of the\n**   current query is executed. Any column filter that applies to\n**   phrase iPhrase of the current query is included in $p. For each \n**   row visited, the callback function passed as the fourth argument \n**   is invoked. The context and API objects passed to the callback \n**   function may be used to access the properties of each matched row.\n**   Invoking Api.xUserData() returns a copy of the pointer passed as \n**   the third argument to pUserData.\n**\n**   If the callback function returns any value other than SQLITE_OK, the\n**   query is abandoned and the xQueryPhrase function returns immediately.\n**   If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.\n**   Otherwise, the error code is propagated upwards.\n**\n**   If the query runs to completion without incident, SQLITE_OK is returned.\n**   Or, if some error occurs before the query completes or is aborted by\n**   the callback, an SQLite error code is returned.\n**\n**\n** xSetAuxdata(pFts5, pAux, xDelete)\n**\n**   Save the pointer passed as the second argument as the extension functions \n**   \"auxiliary data\". The pointer may then be retrieved by the current or any\n**   future invocation of the same fts5 extension function made as part of\n**   of the same MATCH query using the xGetAuxdata() API.\n**\n**   Each extension function is allocated a single auxiliary data slot for\n**   each FTS query (MATCH expression). If the extension function is invoked \n**   more than once for a single FTS query, then all invocations share a \n**   single auxiliary data context.\n**\n**   If there is already an auxiliary data pointer when this function is\n**   invoked, then it is replaced by the new pointer. If an xDelete callback\n**   was specified along with the original pointer, it is invoked at this\n**   point.\n**\n**   The xDelete callback, if one is specified, is also invoked on the\n**   auxiliary data pointer after the FTS5 query has finished.\n**\n**   If an error (e.g. an OOM condition) occurs within this function, an\n**   the auxiliary data is set to NULL and an error code returned. If the\n**   xDelete parameter was not NULL, it is invoked on the auxiliary data\n**   pointer before returning.\n**\n**\n** xGetAuxdata(pFts5, bClear)\n**\n**   Returns the current auxiliary data pointer for the fts5 extension \n**   function. See the xSetAuxdata() method for details.\n**\n**   If the bClear argument is non-zero, then the auxiliary data is cleared\n**   (set to NULL) before this function returns. In this case the xDelete,\n**   if any, is not invoked.\n**\n**\n** xRowCount(pFts5, pnRow)\n**\n**   This function is used to retrieve the total number of rows in the table.\n**   In other words, the same value that would be returned by:\n**\n**        SELECT count(*) FROM ftstable;\n**\n** xPhraseFirst()\n**   This function is used, along with type Fts5PhraseIter and the xPhraseNext\n**   method, to iterate through all instances of a single query phrase within\n**   the current row. This is the same information as is accessible via the\n**   xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient\n**   to use, this API may be faster under some circumstances. To iterate \n**   through instances of phrase iPhrase, use the following code:\n**\n**       Fts5PhraseIter iter;\n**       int iCol, iOff;\n**       for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);\n**           iCol>=0;\n**           pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)\n**       ){\n**         // An instance of phrase iPhrase at offset iOff of column iCol\n**       }\n**\n**   The Fts5PhraseIter structure is defined above. Applications should not\n**   modify this structure directly - it should only be used as shown above\n**   with the xPhraseFirst() and xPhraseNext() API methods (and by\n**   xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. If the FTS5 table is created \n**   with either \"detail=none\" or \"detail=column\" and \"content=\" option \n**   (i.e. if it is a contentless table), then this API always iterates\n**   through an empty set (all calls to xPhraseFirst() set iCol to -1).\n**\n** xPhraseNext()\n**   See xPhraseFirst above.\n**\n** xPhraseFirstColumn()\n**   This function and xPhraseNextColumn() are similar to the xPhraseFirst()\n**   and xPhraseNext() APIs described above. The difference is that instead\n**   of iterating through all instances of a phrase in the current row, these\n**   APIs are used to iterate through the set of columns in the current row\n**   that contain one or more instances of a specified phrase. For example:\n**\n**       Fts5PhraseIter iter;\n**       int iCol;\n**       for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);\n**           iCol>=0;\n**           pApi->xPhraseNextColumn(pFts, &iter, &iCol)\n**       ){\n**         // Column iCol contains at least one instance of phrase iPhrase\n**       }\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" option. If the FTS5 table is created with either \n**   \"detail=none\" \"content=\" option (i.e. if it is a contentless table), \n**   then this API always iterates through an empty set (all calls to \n**   xPhraseFirstColumn() set iCol to -1).\n**\n**   The information accessed using this API and its companion\n**   xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext\n**   (or xInst/xInstCount). The chief advantage of this API is that it is\n**   significantly more efficient than those alternatives when used with\n**   \"detail=column\" tables.  \n**\n** xPhraseNextColumn()\n**   See xPhraseFirstColumn above.\n*/\nstruct Fts5ExtensionApi {\n  int iVersion;                   /* Currently always set to 3 */\n\n  void *(*xUserData)(Fts5Context*);\n\n  int (*xColumnCount)(Fts5Context*);\n  int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);\n  int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);\n\n  int (*xTokenize)(Fts5Context*, \n    const char *pText, int nText, /* Text to tokenize */\n    void *pCtx,                   /* Context passed to xToken() */\n    int (*xToken)(void*, int, const char*, int, int, int)       /* Callback */\n  );\n\n  int (*xPhraseCount)(Fts5Context*);\n  int (*xPhraseSize)(Fts5Context*, int iPhrase);\n\n  int (*xInstCount)(Fts5Context*, int *pnInst);\n  int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff);\n\n  sqlite3_int64 (*xRowid)(Fts5Context*);\n  int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn);\n  int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken);\n\n  int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData,\n    int(*)(const Fts5ExtensionApi*,Fts5Context*,void*)\n  );\n  int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));\n  void *(*xGetAuxdata)(Fts5Context*, int bClear);\n\n  int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);\n  void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);\n\n  int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);\n  void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);\n};\n\n/* \n** CUSTOM AUXILIARY FUNCTIONS\n*************************************************************************/\n\n/*************************************************************************\n** CUSTOM TOKENIZERS\n**\n** Applications may also register custom tokenizer types. A tokenizer \n** is registered by providing fts5 with a populated instance of the \n** following structure. All structure methods must be defined, setting\n** any member of the fts5_tokenizer struct to NULL leads to undefined\n** behaviour. The structure methods are expected to function as follows:\n**\n** xCreate:\n**   This function is used to allocate and initialize a tokenizer instance.\n**   A tokenizer instance is required to actually tokenize text.\n**\n**   The first argument passed to this function is a copy of the (void*)\n**   pointer provided by the application when the fts5_tokenizer object\n**   was registered with FTS5 (the third argument to xCreateTokenizer()). \n**   The second and third arguments are an array of nul-terminated strings\n**   containing the tokenizer arguments, if any, specified following the\n**   tokenizer name as part of the CREATE VIRTUAL TABLE statement used\n**   to create the FTS5 table.\n**\n**   The final argument is an output variable. If successful, (*ppOut) \n**   should be set to point to the new tokenizer handle and SQLITE_OK\n**   returned. If an error occurs, some value other than SQLITE_OK should\n**   be returned. In this case, fts5 assumes that the final value of *ppOut \n**   is undefined.\n**\n** xDelete:\n**   This function is invoked to delete a tokenizer handle previously\n**   allocated using xCreate(). Fts5 guarantees that this function will\n**   be invoked exactly once for each successful call to xCreate().\n**\n** xTokenize:\n**   This function is expected to tokenize the nText byte string indicated \n**   by argument pText. pText may or may not be nul-terminated. The first\n**   argument passed to this function is a pointer to an Fts5Tokenizer object\n**   returned by an earlier call to xCreate().\n**\n**   The second argument indicates the reason that FTS5 is requesting\n**   tokenization of the supplied text. This is always one of the following\n**   four values:\n**\n**   <ul><li> <b>FTS5_TOKENIZE_DOCUMENT</b> - A document is being inserted into\n**            or removed from the FTS table. The tokenizer is being invoked to\n**            determine the set of tokens to add to (or delete from) the\n**            FTS index.\n**\n**       <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed \n**            against the FTS index. The tokenizer is being called to tokenize \n**            a bareword or quoted string specified as part of the query.\n**\n**       <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as\n**            FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is\n**            followed by a \"*\" character, indicating that the last token\n**            returned by the tokenizer will be treated as a token prefix.\n**\n**       <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to \n**            satisfy an fts5_api.xTokenize() request made by an auxiliary\n**            function. Or an fts5_api.xColumnSize() request made by the same\n**            on a columnsize=0 database.  \n**   </ul>\n**\n**   For each token in the input string, the supplied callback xToken() must\n**   be invoked. The first argument to it should be a copy of the pointer\n**   passed as the second argument to xTokenize(). The third and fourth\n**   arguments are a pointer to a buffer containing the token text, and the\n**   size of the token in bytes. The 4th and 5th arguments are the byte offsets\n**   of the first byte of and first byte immediately following the text from\n**   which the token is derived within the input.\n**\n**   The second argument passed to the xToken() callback (\"tflags\") should\n**   normally be set to 0. The exception is if the tokenizer supports \n**   synonyms. In this case see the discussion below for details.\n**\n**   FTS5 assumes the xToken() callback is invoked for each token in the \n**   order that they occur within the input text.\n**\n**   If an xToken() callback returns any value other than SQLITE_OK, then\n**   the tokenization should be abandoned and the xTokenize() method should\n**   immediately return a copy of the xToken() return value. Or, if the\n**   input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,\n**   if an error occurs with the xTokenize() implementation itself, it\n**   may abandon the tokenization and return any error code other than\n**   SQLITE_OK or SQLITE_DONE.\n**\n** SYNONYM SUPPORT\n**\n**   Custom tokenizers may also support synonyms. Consider a case in which a\n**   user wishes to query for a phrase such as \"first place\". Using the \n**   built-in tokenizers, the FTS5 query 'first + place' will match instances\n**   of \"first place\" within the document set, but not alternative forms\n**   such as \"1st place\". In some applications, it would be better to match\n**   all instances of \"first place\" or \"1st place\" regardless of which form\n**   the user specified in the MATCH query text.\n**\n**   There are several ways to approach this in FTS5:\n**\n**   <ol><li> By mapping all synonyms to a single token. In this case, the \n**            In the above example, this means that the tokenizer returns the\n**            same token for inputs \"first\" and \"1st\". Say that token is in\n**            fact \"first\", so that when the user inserts the document \"I won\n**            1st place\" entries are added to the index for tokens \"i\", \"won\",\n**            \"first\" and \"place\". If the user then queries for '1st + place',\n**            the tokenizer substitutes \"first\" for \"1st\" and the query works\n**            as expected.\n**\n**       <li> By adding multiple synonyms for a single term to the FTS index.\n**            In this case, when tokenizing query text, the tokenizer may \n**            provide multiple synonyms for a single term within the document.\n**            FTS5 then queries the index for each synonym individually. For\n**            example, faced with the query:\n**\n**   <codeblock>\n**     ... MATCH 'first place'</codeblock>\n**\n**            the tokenizer offers both \"1st\" and \"first\" as synonyms for the\n**            first token in the MATCH query and FTS5 effectively runs a query \n**            similar to:\n**\n**   <codeblock>\n**     ... MATCH '(first OR 1st) place'</codeblock>\n**\n**            except that, for the purposes of auxiliary functions, the query\n**            still appears to contain just two phrases - \"(first OR 1st)\" \n**            being treated as a single phrase.\n**\n**       <li> By adding multiple synonyms for a single term to the FTS index.\n**            Using this method, when tokenizing document text, the tokenizer\n**            provides multiple synonyms for each token. So that when a \n**            document such as \"I won first place\" is tokenized, entries are\n**            added to the FTS index for \"i\", \"won\", \"first\", \"1st\" and\n**            \"place\".\n**\n**            This way, even if the tokenizer does not provide synonyms\n**            when tokenizing query text (it should not - to do would be\n**            inefficient), it doesn't matter if the user queries for \n**            'first + place' or '1st + place', as there are entires in the\n**            FTS index corresponding to both forms of the first token.\n**   </ol>\n**\n**   Whether it is parsing document or query text, any call to xToken that\n**   specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit\n**   is considered to supply a synonym for the previous token. For example,\n**   when parsing the document \"I won first place\", a tokenizer that supports\n**   synonyms would call xToken() 5 times, as follows:\n**\n**   <codeblock>\n**       xToken(pCtx, 0, \"i\",                      1,  0,  1);\n**       xToken(pCtx, 0, \"won\",                    3,  2,  5);\n**       xToken(pCtx, 0, \"first\",                  5,  6, 11);\n**       xToken(pCtx, FTS5_TOKEN_COLOCATED, \"1st\", 3,  6, 11);\n**       xToken(pCtx, 0, \"place\",                  5, 12, 17);\n**</codeblock>\n**\n**   It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time\n**   xToken() is called. Multiple synonyms may be specified for a single token\n**   by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence. \n**   There is no limit to the number of synonyms that may be provided for a\n**   single token.\n**\n**   In many cases, method (1) above is the best approach. It does not add \n**   extra data to the FTS index or require FTS5 to query for multiple terms,\n**   so it is efficient in terms of disk space and query speed. However, it\n**   does not support prefix queries very well. If, as suggested above, the\n**   token \"first\" is subsituted for \"1st\" by the tokenizer, then the query:\n**\n**   <codeblock>\n**     ... MATCH '1s*'</codeblock>\n**\n**   will not match documents that contain the token \"1st\" (as the tokenizer\n**   will probably not map \"1s\" to any prefix of \"first\").\n**\n**   For full prefix support, method (3) may be preferred. In this case, \n**   because the index contains entries for both \"first\" and \"1st\", prefix\n**   queries such as 'fi*' or '1s*' will match correctly. However, because\n**   extra entries are added to the FTS index, this method uses more space\n**   within the database.\n**\n**   Method (2) offers a midpoint between (1) and (3). Using this method,\n**   a query such as '1s*' will match documents that contain the literal \n**   token \"1st\", but not \"first\" (assuming the tokenizer is not able to\n**   provide synonyms for prefixes). However, a non-prefix query like '1st'\n**   will match against \"1st\" and \"first\". This method does not require\n**   extra disk space, as no extra entries are added to the FTS index. \n**   On the other hand, it may require more CPU cycles to run MATCH queries,\n**   as separate queries of the FTS index are required for each synonym.\n**\n**   When using methods (2) or (3), it is important that the tokenizer only\n**   provide synonyms when tokenizing document text (method (2)) or query\n**   text (method (3)), not both. Doing so will not cause any errors, but is\n**   inefficient.\n*/\ntypedef struct Fts5Tokenizer Fts5Tokenizer;\ntypedef struct fts5_tokenizer fts5_tokenizer;\nstruct fts5_tokenizer {\n  int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);\n  void (*xDelete)(Fts5Tokenizer*);\n  int (*xTokenize)(Fts5Tokenizer*, \n      void *pCtx,\n      int flags,            /* Mask of FTS5_TOKENIZE_* flags */\n      const char *pText, int nText, \n      int (*xToken)(\n        void *pCtx,         /* Copy of 2nd argument to xTokenize() */\n        int tflags,         /* Mask of FTS5_TOKEN_* flags */\n        const char *pToken, /* Pointer to buffer containing token */\n        int nToken,         /* Size of token in bytes */\n        int iStart,         /* Byte offset of token within input text */\n        int iEnd            /* Byte offset of end of token within input text */\n      )\n  );\n};\n\n/* Flags that may be passed as the third argument to xTokenize() */\n#define FTS5_TOKENIZE_QUERY     0x0001\n#define FTS5_TOKENIZE_PREFIX    0x0002\n#define FTS5_TOKENIZE_DOCUMENT  0x0004\n#define FTS5_TOKENIZE_AUX       0x0008\n\n/* Flags that may be passed by the tokenizer implementation back to FTS5\n** as the third argument to the supplied xToken callback. */\n#define FTS5_TOKEN_COLOCATED    0x0001      /* Same position as prev. token */\n\n/*\n** END OF CUSTOM TOKENIZERS\n*************************************************************************/\n\n/*************************************************************************\n** FTS5 EXTENSION REGISTRATION API\n*/\ntypedef struct fts5_api fts5_api;\nstruct fts5_api {\n  int iVersion;                   /* Currently always set to 2 */\n\n  /* Create a new tokenizer */\n  int (*xCreateTokenizer)(\n    fts5_api *pApi,\n    const char *zName,\n    void *pContext,\n    fts5_tokenizer *pTokenizer,\n    void (*xDestroy)(void*)\n  );\n\n  /* Find an existing tokenizer */\n  int (*xFindTokenizer)(\n    fts5_api *pApi,\n    const char *zName,\n    void **ppContext,\n    fts5_tokenizer *pTokenizer\n  );\n\n  /* Create a new auxiliary function */\n  int (*xCreateFunction)(\n    fts5_api *pApi,\n    const char *zName,\n    void *pContext,\n    fts5_extension_function xFunction,\n    void (*xDestroy)(void*)\n  );\n};\n\n/*\n** END OF REGISTRATION API\n*************************************************************************/\n\n#ifdef __cplusplus\n}  /* end of the 'extern \"C\"' block */\n#endif\n\n#endif /* _FTS5_H */\n\n#line 1 \"fts5Int.h\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n*/\n#ifndef _FTS5INT_H\n#define _FTS5INT_H\n\n/* #include \"fts5.h\" */\n#include \"sqlite3ext.h\"\nSQLITE_EXTENSION_INIT1\n\n#include <string.h>\n#include <assert.h>\n\n#ifndef SQLITE_AMALGAMATION\n\ntypedef unsigned char  u8;\ntypedef unsigned int   u32;\ntypedef unsigned short u16;\ntypedef short i16;\ntypedef sqlite3_int64 i64;\ntypedef sqlite3_uint64 u64;\n\n#define ArraySize(x) ((int)(sizeof(x) / sizeof(x[0])))\n\n#define testcase(x)\n#define ALWAYS(x) 1\n#define NEVER(x) 0\n\n#define MIN(x,y) (((x) < (y)) ? (x) : (y))\n#define MAX(x,y) (((x) > (y)) ? (x) : (y))\n\n/*\n** Constants for the largest and smallest possible 64-bit signed integers.\n*/\n# define LARGEST_INT64  (0xffffffff|(((i64)0x7fffffff)<<32))\n# define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)\n\n#endif\n\n/* Truncate very long tokens to this many bytes. Hard limit is \n** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset\n** field that occurs at the start of each leaf page (see fts5_index.c). */\n#define FTS5_MAX_TOKEN_SIZE 32768\n\n/*\n** Maximum number of prefix indexes on single FTS5 table. This must be\n** less than 32. If it is set to anything large than that, an #error\n** directive in fts5_index.c will cause the build to fail.\n*/\n#define FTS5_MAX_PREFIX_INDEXES 31\n\n#define FTS5_DEFAULT_NEARDIST 10\n#define FTS5_DEFAULT_RANK     \"bm25\"\n\n/* Name of rank and rowid columns */\n#define FTS5_RANK_NAME \"rank\"\n#define FTS5_ROWID_NAME \"rowid\"\n\n#ifdef SQLITE_DEBUG\n# define FTS5_CORRUPT sqlite3Fts5Corrupt()\nstatic int sqlite3Fts5Corrupt(void);\n#else\n# define FTS5_CORRUPT SQLITE_CORRUPT_VTAB\n#endif\n\n/*\n** The assert_nc() macro is similar to the assert() macro, except that it\n** is used for assert() conditions that are true only if it can be \n** guranteed that the database is not corrupt.\n*/\n#ifdef SQLITE_DEBUG\nextern int sqlite3_fts5_may_be_corrupt;\n# define assert_nc(x) assert(sqlite3_fts5_may_be_corrupt || (x))\n#else\n# define assert_nc(x) assert(x)\n#endif\n\n/* Mark a function parameter as unused, to suppress nuisance compiler\n** warnings. */\n#ifndef UNUSED_PARAM\n# define UNUSED_PARAM(X)  (void)(X)\n#endif\n\n#ifndef UNUSED_PARAM2\n# define UNUSED_PARAM2(X, Y)  (void)(X), (void)(Y)\n#endif\n\ntypedef struct Fts5Global Fts5Global;\ntypedef struct Fts5Colset Fts5Colset;\n\n/* If a NEAR() clump or phrase may only match a specific set of columns, \n** then an object of the following type is used to record the set of columns.\n** Each entry in the aiCol[] array is a column that may be matched.\n**\n** This object is used by fts5_expr.c and fts5_index.c.\n*/\nstruct Fts5Colset {\n  int nCol;\n  int aiCol[1];\n};\n\n\n\n/**************************************************************************\n** Interface to code in fts5_config.c. fts5_config.c contains contains code\n** to parse the arguments passed to the CREATE VIRTUAL TABLE statement.\n*/\n\ntypedef struct Fts5Config Fts5Config;\n\n/*\n** An instance of the following structure encodes all information that can\n** be gleaned from the CREATE VIRTUAL TABLE statement.\n**\n** And all information loaded from the %_config table.\n**\n** nAutomerge:\n**   The minimum number of segments that an auto-merge operation should\n**   attempt to merge together. A value of 1 sets the object to use the \n**   compile time default. Zero disables auto-merge altogether.\n**\n** zContent:\n**\n** zContentRowid:\n**   The value of the content_rowid= option, if one was specified. Or \n**   the string \"rowid\" otherwise. This text is not quoted - if it is\n**   used as part of an SQL statement it needs to be quoted appropriately.\n**\n** zContentExprlist:\n**\n** pzErrmsg:\n**   This exists in order to allow the fts5_index.c module to return a \n**   decent error message if it encounters a file-format version it does\n**   not understand.\n**\n** bColumnsize:\n**   True if the %_docsize table is created.\n**\n** bPrefixIndex:\n**   This is only used for debugging. If set to false, any prefix indexes\n**   are ignored. This value is configured using:\n**\n**       INSERT INTO tbl(tbl, rank) VALUES('prefix-index', $bPrefixIndex);\n**\n*/\nstruct Fts5Config {\n  sqlite3 *db;                    /* Database handle */\n  char *zDb;                      /* Database holding FTS index (e.g. \"main\") */\n  char *zName;                    /* Name of FTS index */\n  int nCol;                       /* Number of columns */\n  char **azCol;                   /* Column names */\n  u8 *abUnindexed;                /* True for unindexed columns */\n  int nPrefix;                    /* Number of prefix indexes */\n  int *aPrefix;                   /* Sizes in bytes of nPrefix prefix indexes */\n  int eContent;                   /* An FTS5_CONTENT value */\n  char *zContent;                 /* content table */ \n  char *zContentRowid;            /* \"content_rowid=\" option value */ \n  int bColumnsize;                /* \"columnsize=\" option value (dflt==1) */\n  int eDetail;                    /* FTS5_DETAIL_XXX value */\n  char *zContentExprlist;\n  Fts5Tokenizer *pTok;\n  fts5_tokenizer *pTokApi;\n\n  /* Values loaded from the %_config table */\n  int iCookie;                    /* Incremented when %_config is modified */\n  int pgsz;                       /* Approximate page size used in %_data */\n  int nAutomerge;                 /* 'automerge' setting */\n  int nCrisisMerge;               /* Maximum allowed segments per level */\n  int nUsermerge;                 /* 'usermerge' setting */\n  int nHashSize;                  /* Bytes of memory for in-memory hash */\n  char *zRank;                    /* Name of rank function */\n  char *zRankArgs;                /* Arguments to rank function */\n\n  /* If non-NULL, points to sqlite3_vtab.base.zErrmsg. Often NULL. */\n  char **pzErrmsg;\n\n#ifdef SQLITE_DEBUG\n  int bPrefixIndex;               /* True to use prefix-indexes */\n#endif\n};\n\n/* Current expected value of %_config table 'version' field */\n#define FTS5_CURRENT_VERSION 4\n\n#define FTS5_CONTENT_NORMAL   0\n#define FTS5_CONTENT_NONE     1\n#define FTS5_CONTENT_EXTERNAL 2\n\n#define FTS5_DETAIL_FULL    0\n#define FTS5_DETAIL_NONE    1\n#define FTS5_DETAIL_COLUMNS 2\n\n\n\nstatic int sqlite3Fts5ConfigParse(\n    Fts5Global*, sqlite3*, int, const char **, Fts5Config**, char**\n);\nstatic void sqlite3Fts5ConfigFree(Fts5Config*);\n\nstatic int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig);\n\nstatic int sqlite3Fts5Tokenize(\n  Fts5Config *pConfig,            /* FTS5 Configuration object */\n  int flags,                      /* FTS5_TOKENIZE_* flags */\n  const char *pText, int nText,   /* Text to tokenize */\n  void *pCtx,                     /* Context passed to xToken() */\n  int (*xToken)(void*, int, const char*, int, int, int)    /* Callback */\n);\n\nstatic void sqlite3Fts5Dequote(char *z);\n\n/* Load the contents of the %_config table */\nstatic int sqlite3Fts5ConfigLoad(Fts5Config*, int);\n\n/* Set the value of a single config attribute */\nstatic int sqlite3Fts5ConfigSetValue(Fts5Config*, const char*, sqlite3_value*, int*);\n\nstatic int sqlite3Fts5ConfigParseRank(const char*, char**, char**);\n\n/*\n** End of interface to code in fts5_config.c.\n**************************************************************************/\n\n/**************************************************************************\n** Interface to code in fts5_buffer.c.\n*/\n\n/*\n** Buffer object for the incremental building of string data.\n*/\ntypedef struct Fts5Buffer Fts5Buffer;\nstruct Fts5Buffer {\n  u8 *p;\n  int n;\n  int nSpace;\n};\n\nstatic int sqlite3Fts5BufferSize(int*, Fts5Buffer*, u32);\nstatic void sqlite3Fts5BufferAppendVarint(int*, Fts5Buffer*, i64);\nstatic void sqlite3Fts5BufferAppendBlob(int*, Fts5Buffer*, u32, const u8*);\nstatic void sqlite3Fts5BufferAppendString(int *, Fts5Buffer*, const char*);\nstatic void sqlite3Fts5BufferFree(Fts5Buffer*);\nstatic void sqlite3Fts5BufferZero(Fts5Buffer*);\nstatic void sqlite3Fts5BufferSet(int*, Fts5Buffer*, int, const u8*);\nstatic void sqlite3Fts5BufferAppendPrintf(int *, Fts5Buffer*, char *zFmt, ...);\n\nstatic char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...);\n\n#define fts5BufferZero(x)             sqlite3Fts5BufferZero(x)\n#define fts5BufferAppendVarint(a,b,c) sqlite3Fts5BufferAppendVarint(a,b,c)\n#define fts5BufferFree(a)             sqlite3Fts5BufferFree(a)\n#define fts5BufferAppendBlob(a,b,c,d) sqlite3Fts5BufferAppendBlob(a,b,c,d)\n#define fts5BufferSet(a,b,c,d)        sqlite3Fts5BufferSet(a,b,c,d)\n\n#define fts5BufferGrow(pRc,pBuf,nn) ( \\\n  (u32)((pBuf)->n) + (u32)(nn) <= (u32)((pBuf)->nSpace) ? 0 : \\\n    sqlite3Fts5BufferSize((pRc),(pBuf),(nn)+(pBuf)->n) \\\n)\n\n/* Write and decode big-endian 32-bit integer values */\nstatic void sqlite3Fts5Put32(u8*, int);\nstatic int sqlite3Fts5Get32(const u8*);\n\n#define FTS5_POS2COLUMN(iPos) (int)(iPos >> 32)\n#define FTS5_POS2OFFSET(iPos) (int)(iPos & 0xFFFFFFFF)\n\ntypedef struct Fts5PoslistReader Fts5PoslistReader;\nstruct Fts5PoslistReader {\n  /* Variables used only by sqlite3Fts5PoslistIterXXX() functions. */\n  const u8 *a;                    /* Position list to iterate through */\n  int n;                          /* Size of buffer at a[] in bytes */\n  int i;                          /* Current offset in a[] */\n\n  u8 bFlag;                       /* For client use (any custom purpose) */\n\n  /* Output variables */\n  u8 bEof;                        /* Set to true at EOF */\n  i64 iPos;                       /* (iCol<<32) + iPos */\n};\nstatic int sqlite3Fts5PoslistReaderInit(\n  const u8 *a, int n,             /* Poslist buffer to iterate through */\n  Fts5PoslistReader *pIter        /* Iterator object to initialize */\n);\nstatic int sqlite3Fts5PoslistReaderNext(Fts5PoslistReader*);\n\ntypedef struct Fts5PoslistWriter Fts5PoslistWriter;\nstruct Fts5PoslistWriter {\n  i64 iPrev;\n};\nstatic int sqlite3Fts5PoslistWriterAppend(Fts5Buffer*, Fts5PoslistWriter*, i64);\nstatic void sqlite3Fts5PoslistSafeAppend(Fts5Buffer*, i64*, i64);\n\nstatic int sqlite3Fts5PoslistNext64(\n  const u8 *a, int n,             /* Buffer containing poslist */\n  int *pi,                        /* IN/OUT: Offset within a[] */\n  i64 *piOff                      /* IN/OUT: Current offset */\n);\n\n/* Malloc utility */\nstatic void *sqlite3Fts5MallocZero(int *pRc, int nByte);\nstatic char *sqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn);\n\n/* Character set tests (like isspace(), isalpha() etc.) */\nstatic int sqlite3Fts5IsBareword(char t);\n\n\n/* Bucket of terms object used by the integrity-check in offsets=0 mode. */\ntypedef struct Fts5Termset Fts5Termset;\nstatic int sqlite3Fts5TermsetNew(Fts5Termset**);\nstatic int sqlite3Fts5TermsetAdd(Fts5Termset*, int, const char*, int, int *pbPresent);\nstatic void sqlite3Fts5TermsetFree(Fts5Termset*);\n\n/*\n** End of interface to code in fts5_buffer.c.\n**************************************************************************/\n\n/**************************************************************************\n** Interface to code in fts5_index.c. fts5_index.c contains contains code\n** to access the data stored in the %_data table.\n*/\n\ntypedef struct Fts5Index Fts5Index;\ntypedef struct Fts5IndexIter Fts5IndexIter;\n\nstruct Fts5IndexIter {\n  i64 iRowid;\n  const u8 *pData;\n  int nData;\n  u8 bEof;\n};\n\n#define sqlite3Fts5IterEof(x) ((x)->bEof)\n\n/*\n** Values used as part of the flags argument passed to IndexQuery().\n*/\n#define FTS5INDEX_QUERY_PREFIX     0x0001   /* Prefix query */\n#define FTS5INDEX_QUERY_DESC       0x0002   /* Docs in descending rowid order */\n#define FTS5INDEX_QUERY_TEST_NOIDX 0x0004   /* Do not use prefix index */\n#define FTS5INDEX_QUERY_SCAN       0x0008   /* Scan query (fts5vocab) */\n\n/* The following are used internally by the fts5_index.c module. They are\n** defined here only to make it easier to avoid clashes with the flags\n** above. */\n#define FTS5INDEX_QUERY_SKIPEMPTY  0x0010\n#define FTS5INDEX_QUERY_NOOUTPUT   0x0020\n\n/*\n** Create/destroy an Fts5Index object.\n*/\nstatic int sqlite3Fts5IndexOpen(Fts5Config *pConfig, int bCreate, Fts5Index**, char**);\nstatic int sqlite3Fts5IndexClose(Fts5Index *p);\n\n/*\n** Return a simple checksum value based on the arguments.\n*/\nstatic u64 sqlite3Fts5IndexEntryCksum(\n  i64 iRowid, \n  int iCol, \n  int iPos, \n  int iIdx,\n  const char *pTerm,\n  int nTerm\n);\n\n/*\n** Argument p points to a buffer containing utf-8 text that is n bytes in \n** size. Return the number of bytes in the nChar character prefix of the\n** buffer, or 0 if there are less than nChar characters in total.\n*/\nstatic int sqlite3Fts5IndexCharlenToBytelen(\n  const char *p, \n  int nByte, \n  int nChar\n);\n\n/*\n** Open a new iterator to iterate though all rowids that match the \n** specified token or token prefix.\n*/\nstatic int sqlite3Fts5IndexQuery(\n  Fts5Index *p,                   /* FTS index to query */\n  const char *pToken, int nToken, /* Token (or prefix) to query for */\n  int flags,                      /* Mask of FTS5INDEX_QUERY_X flags */\n  Fts5Colset *pColset,            /* Match these columns only */\n  Fts5IndexIter **ppIter          /* OUT: New iterator object */\n);\n\n/*\n** The various operations on open token or token prefix iterators opened\n** using sqlite3Fts5IndexQuery().\n*/\nstatic int sqlite3Fts5IterNext(Fts5IndexIter*);\nstatic int sqlite3Fts5IterNextFrom(Fts5IndexIter*, i64 iMatch);\n\n/*\n** Close an iterator opened by sqlite3Fts5IndexQuery().\n*/\nstatic void sqlite3Fts5IterClose(Fts5IndexIter*);\n\n/*\n** This interface is used by the fts5vocab module.\n*/\nstatic const char *sqlite3Fts5IterTerm(Fts5IndexIter*, int*);\nstatic int sqlite3Fts5IterNextScan(Fts5IndexIter*);\n\n\n/*\n** Insert or remove data to or from the index. Each time a document is \n** added to or removed from the index, this function is called one or more\n** times.\n**\n** For an insert, it must be called once for each token in the new document.\n** If the operation is a delete, it must be called (at least) once for each\n** unique token in the document with an iCol value less than zero. The iPos\n** argument is ignored for a delete.\n*/\nstatic int sqlite3Fts5IndexWrite(\n  Fts5Index *p,                   /* Index to write to */\n  int iCol,                       /* Column token appears in (-ve -> delete) */\n  int iPos,                       /* Position of token within column */\n  const char *pToken, int nToken  /* Token to add or remove to or from index */\n);\n\n/*\n** Indicate that subsequent calls to sqlite3Fts5IndexWrite() pertain to\n** document iDocid.\n*/\nstatic int sqlite3Fts5IndexBeginWrite(\n  Fts5Index *p,                   /* Index to write to */\n  int bDelete,                    /* True if current operation is a delete */\n  i64 iDocid                      /* Docid to add or remove data from */\n);\n\n/*\n** Flush any data stored in the in-memory hash tables to the database.\n** If the bCommit flag is true, also close any open blob handles.\n*/\nstatic int sqlite3Fts5IndexSync(Fts5Index *p, int bCommit);\n\n/*\n** Discard any data stored in the in-memory hash tables. Do not write it\n** to the database. Additionally, assume that the contents of the %_data\n** table may have changed on disk. So any in-memory caches of %_data \n** records must be invalidated.\n*/\nstatic int sqlite3Fts5IndexRollback(Fts5Index *p);\n\n/*\n** Get or set the \"averages\" values.\n*/\nstatic int sqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize);\nstatic int sqlite3Fts5IndexSetAverages(Fts5Index *p, const u8*, int);\n\n/*\n** Functions called by the storage module as part of integrity-check.\n*/\nstatic int sqlite3Fts5IndexIntegrityCheck(Fts5Index*, u64 cksum);\n\n/* \n** Called during virtual module initialization to register UDF \n** fts5_decode() with SQLite \n*/\nstatic int sqlite3Fts5IndexInit(sqlite3*);\n\nstatic int sqlite3Fts5IndexSetCookie(Fts5Index*, int);\n\n/*\n** Return the total number of entries read from the %_data table by \n** this connection since it was created.\n*/\nstatic int sqlite3Fts5IndexReads(Fts5Index *p);\n\nstatic int sqlite3Fts5IndexReinit(Fts5Index *p);\nstatic int sqlite3Fts5IndexOptimize(Fts5Index *p);\nstatic int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge);\nstatic int sqlite3Fts5IndexReset(Fts5Index *p);\n\nstatic int sqlite3Fts5IndexLoadConfig(Fts5Index *p);\n\n/*\n** End of interface to code in fts5_index.c.\n**************************************************************************/\n\n/**************************************************************************\n** Interface to code in fts5_varint.c. \n*/\nstatic int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v);\nstatic int sqlite3Fts5GetVarintLen(u32 iVal);\nstatic u8 sqlite3Fts5GetVarint(const unsigned char*, u64*);\nstatic int sqlite3Fts5PutVarint(unsigned char *p, u64 v);\n\n#define fts5GetVarint32(a,b) sqlite3Fts5GetVarint32(a,(u32*)&b)\n#define fts5GetVarint    sqlite3Fts5GetVarint\n\n#define fts5FastGetVarint32(a, iOff, nVal) {      \\\n  nVal = (a)[iOff++];                             \\\n  if( nVal & 0x80 ){                              \\\n    iOff--;                                       \\\n    iOff += fts5GetVarint32(&(a)[iOff], nVal);    \\\n  }                                               \\\n}\n\n\n/*\n** End of interface to code in fts5_varint.c.\n**************************************************************************/\n\n\n/**************************************************************************\n** Interface to code in fts5.c. \n*/\n\nstatic int sqlite3Fts5GetTokenizer(\n  Fts5Global*, \n  const char **azArg,\n  int nArg,\n  Fts5Tokenizer**,\n  fts5_tokenizer**,\n  char **pzErr\n);\n\nstatic Fts5Index *sqlite3Fts5IndexFromCsrid(Fts5Global*, i64, Fts5Config **);\n\n/*\n** End of interface to code in fts5.c.\n**************************************************************************/\n\n/**************************************************************************\n** Interface to code in fts5_hash.c. \n*/\ntypedef struct Fts5Hash Fts5Hash;\n\n/*\n** Create a hash table, free a hash table.\n*/\nstatic int sqlite3Fts5HashNew(Fts5Config*, Fts5Hash**, int *pnSize);\nstatic void sqlite3Fts5HashFree(Fts5Hash*);\n\nstatic int sqlite3Fts5HashWrite(\n  Fts5Hash*,\n  i64 iRowid,                     /* Rowid for this entry */\n  int iCol,                       /* Column token appears in (-ve -> delete) */\n  int iPos,                       /* Position of token within column */\n  char bByte,\n  const char *pToken, int nToken  /* Token to add or remove to or from index */\n);\n\n/*\n** Empty (but do not delete) a hash table.\n*/\nstatic void sqlite3Fts5HashClear(Fts5Hash*);\n\nstatic int sqlite3Fts5HashQuery(\n  Fts5Hash*,                      /* Hash table to query */\n  const char *pTerm, int nTerm,   /* Query term */\n  const u8 **ppDoclist,           /* OUT: Pointer to doclist for pTerm */\n  int *pnDoclist                  /* OUT: Size of doclist in bytes */\n);\n\nstatic int sqlite3Fts5HashScanInit(\n  Fts5Hash*,                      /* Hash table to query */\n  const char *pTerm, int nTerm    /* Query prefix */\n);\nstatic void sqlite3Fts5HashScanNext(Fts5Hash*);\nstatic int sqlite3Fts5HashScanEof(Fts5Hash*);\nstatic void sqlite3Fts5HashScanEntry(Fts5Hash *,\n  const char **pzTerm,            /* OUT: term (nul-terminated) */\n  const u8 **ppDoclist,           /* OUT: pointer to doclist */\n  int *pnDoclist                  /* OUT: size of doclist in bytes */\n);\n\n\n/*\n** End of interface to code in fts5_hash.c.\n**************************************************************************/\n\n/**************************************************************************\n** Interface to code in fts5_storage.c. fts5_storage.c contains contains \n** code to access the data stored in the %_content and %_docsize tables.\n*/\n\n#define FTS5_STMT_SCAN_ASC  0     /* SELECT rowid, * FROM ... ORDER BY 1 ASC */\n#define FTS5_STMT_SCAN_DESC 1     /* SELECT rowid, * FROM ... ORDER BY 1 DESC */\n#define FTS5_STMT_LOOKUP    2     /* SELECT rowid, * FROM ... WHERE rowid=? */\n\ntypedef struct Fts5Storage Fts5Storage;\n\nstatic int sqlite3Fts5StorageOpen(Fts5Config*, Fts5Index*, int, Fts5Storage**, char**);\nstatic int sqlite3Fts5StorageClose(Fts5Storage *p);\nstatic int sqlite3Fts5StorageRename(Fts5Storage*, const char *zName);\n\nstatic int sqlite3Fts5DropAll(Fts5Config*);\nstatic int sqlite3Fts5CreateTable(Fts5Config*, const char*, const char*, int, char **);\n\nstatic int sqlite3Fts5StorageDelete(Fts5Storage *p, i64, sqlite3_value**);\nstatic int sqlite3Fts5StorageContentInsert(Fts5Storage *p, sqlite3_value**, i64*);\nstatic int sqlite3Fts5StorageIndexInsert(Fts5Storage *p, sqlite3_value**, i64);\n\nstatic int sqlite3Fts5StorageIntegrity(Fts5Storage *p);\n\nstatic int sqlite3Fts5StorageStmt(Fts5Storage *p, int eStmt, sqlite3_stmt**, char**);\nstatic void sqlite3Fts5StorageStmtRelease(Fts5Storage *p, int eStmt, sqlite3_stmt*);\n\nstatic int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol);\nstatic int sqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnAvg);\nstatic int sqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow);\n\nstatic int sqlite3Fts5StorageSync(Fts5Storage *p, int bCommit);\nstatic int sqlite3Fts5StorageRollback(Fts5Storage *p);\n\nstatic int sqlite3Fts5StorageConfigValue(\n    Fts5Storage *p, const char*, sqlite3_value*, int\n);\n\nstatic int sqlite3Fts5StorageDeleteAll(Fts5Storage *p);\nstatic int sqlite3Fts5StorageRebuild(Fts5Storage *p);\nstatic int sqlite3Fts5StorageOptimize(Fts5Storage *p);\nstatic int sqlite3Fts5StorageMerge(Fts5Storage *p, int nMerge);\nstatic int sqlite3Fts5StorageReset(Fts5Storage *p);\n\n/*\n** End of interface to code in fts5_storage.c.\n**************************************************************************/\n\n\n/**************************************************************************\n** Interface to code in fts5_expr.c. \n*/\ntypedef struct Fts5Expr Fts5Expr;\ntypedef struct Fts5ExprNode Fts5ExprNode;\ntypedef struct Fts5Parse Fts5Parse;\ntypedef struct Fts5Token Fts5Token;\ntypedef struct Fts5ExprPhrase Fts5ExprPhrase;\ntypedef struct Fts5ExprNearset Fts5ExprNearset;\n\nstruct Fts5Token {\n  const char *p;                  /* Token text (not NULL terminated) */\n  int n;                          /* Size of buffer p in bytes */\n};\n\n/* Parse a MATCH expression. */\nstatic int sqlite3Fts5ExprNew(\n  Fts5Config *pConfig, \n  const char *zExpr,\n  Fts5Expr **ppNew, \n  char **pzErr\n);\n\n/*\n** for(rc = sqlite3Fts5ExprFirst(pExpr, pIdx, bDesc);\n**     rc==SQLITE_OK && 0==sqlite3Fts5ExprEof(pExpr);\n**     rc = sqlite3Fts5ExprNext(pExpr)\n** ){\n**   // The document with rowid iRowid matches the expression!\n**   i64 iRowid = sqlite3Fts5ExprRowid(pExpr);\n** }\n*/\nstatic int sqlite3Fts5ExprFirst(Fts5Expr*, Fts5Index *pIdx, i64 iMin, int bDesc);\nstatic int sqlite3Fts5ExprNext(Fts5Expr*, i64 iMax);\nstatic int sqlite3Fts5ExprEof(Fts5Expr*);\nstatic i64 sqlite3Fts5ExprRowid(Fts5Expr*);\n\nstatic void sqlite3Fts5ExprFree(Fts5Expr*);\n\n/* Called during startup to register a UDF with SQLite */\nstatic int sqlite3Fts5ExprInit(Fts5Global*, sqlite3*);\n\nstatic int sqlite3Fts5ExprPhraseCount(Fts5Expr*);\nstatic int sqlite3Fts5ExprPhraseSize(Fts5Expr*, int iPhrase);\nstatic int sqlite3Fts5ExprPoslist(Fts5Expr*, int, const u8 **);\n\ntypedef struct Fts5PoslistPopulator Fts5PoslistPopulator;\nstatic Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr*, int);\nstatic int sqlite3Fts5ExprPopulatePoslists(\n    Fts5Config*, Fts5Expr*, Fts5PoslistPopulator*, int, const char*, int\n);\nstatic void sqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64);\n\nstatic int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**);\n\nstatic int sqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *);\n\n/*******************************************\n** The fts5_expr.c API above this point is used by the other hand-written\n** C code in this module. The interfaces below this point are called by\n** the parser code in fts5parse.y.  */\n\nstatic void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...);\n\nstatic Fts5ExprNode *sqlite3Fts5ParseNode(\n  Fts5Parse *pParse,\n  int eType,\n  Fts5ExprNode *pLeft,\n  Fts5ExprNode *pRight,\n  Fts5ExprNearset *pNear\n);\n\nstatic Fts5ExprNode *sqlite3Fts5ParseImplicitAnd(\n  Fts5Parse *pParse,\n  Fts5ExprNode *pLeft,\n  Fts5ExprNode *pRight\n);\n\nstatic Fts5ExprPhrase *sqlite3Fts5ParseTerm(\n  Fts5Parse *pParse, \n  Fts5ExprPhrase *pPhrase, \n  Fts5Token *pToken,\n  int bPrefix\n);\n\nstatic Fts5ExprNearset *sqlite3Fts5ParseNearset(\n  Fts5Parse*, \n  Fts5ExprNearset*,\n  Fts5ExprPhrase* \n);\n\nstatic Fts5Colset *sqlite3Fts5ParseColset(\n  Fts5Parse*, \n  Fts5Colset*, \n  Fts5Token *\n);\n\nstatic void sqlite3Fts5ParsePhraseFree(Fts5ExprPhrase*);\nstatic void sqlite3Fts5ParseNearsetFree(Fts5ExprNearset*);\nstatic void sqlite3Fts5ParseNodeFree(Fts5ExprNode*);\n\nstatic void sqlite3Fts5ParseSetDistance(Fts5Parse*, Fts5ExprNearset*, Fts5Token*);\nstatic void sqlite3Fts5ParseSetColset(Fts5Parse*, Fts5ExprNearset*, Fts5Colset*);\nstatic Fts5Colset *sqlite3Fts5ParseColsetInvert(Fts5Parse*, Fts5Colset*);\nstatic void sqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p);\nstatic void sqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token*);\n\n/*\n** End of interface to code in fts5_expr.c.\n**************************************************************************/\n\n\n\n/**************************************************************************\n** Interface to code in fts5_aux.c. \n*/\n\nstatic int sqlite3Fts5AuxInit(fts5_api*);\n/*\n** End of interface to code in fts5_aux.c.\n**************************************************************************/\n\n/**************************************************************************\n** Interface to code in fts5_tokenizer.c. \n*/\n\nstatic int sqlite3Fts5TokenizerInit(fts5_api*);\n/*\n** End of interface to code in fts5_tokenizer.c.\n**************************************************************************/\n\n/**************************************************************************\n** Interface to code in fts5_vocab.c. \n*/\n\nstatic int sqlite3Fts5VocabInit(Fts5Global*, sqlite3*);\n\n/*\n** End of interface to code in fts5_vocab.c.\n**************************************************************************/\n\n\n/**************************************************************************\n** Interface to automatically generated code in fts5_unicode2.c. \n*/\nstatic int sqlite3Fts5UnicodeIsalnum(int c);\nstatic int sqlite3Fts5UnicodeIsdiacritic(int c);\nstatic int sqlite3Fts5UnicodeFold(int c, int bRemoveDiacritic);\n/*\n** End of interface to code in fts5_unicode2.c.\n**************************************************************************/\n\n#endif\n\n#line 1 \"fts5parse.h\"\n#define FTS5_OR                               1\n#define FTS5_AND                              2\n#define FTS5_NOT                              3\n#define FTS5_TERM                             4\n#define FTS5_COLON                            5\n#define FTS5_LP                               6\n#define FTS5_RP                               7\n#define FTS5_MINUS                            8\n#define FTS5_LCP                              9\n#define FTS5_RCP                             10\n#define FTS5_STRING                          11\n#define FTS5_COMMA                           12\n#define FTS5_PLUS                            13\n#define FTS5_STAR                            14\n\n#line 1 \"fts5parse.c\"\n/*\n** 2000-05-29\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Driver template for the LEMON parser generator.\n**\n** The \"lemon\" program processes an LALR(1) input grammar file, then uses\n** this template to construct a parser.  The \"lemon\" program inserts text\n** at each \"%%\" line.  Also, any \"P-a-r-s-e\" identifer prefix (without the\n** interstitial \"-\" characters) contained in this template is changed into\n** the value of the %name directive from the grammar.  Otherwise, the content\n** of this template is copied straight through into the generate parser\n** source file.\n**\n** The following is the concatenation of all %include directives from the\n** input grammar file:\n*/\n#include <stdio.h>\n/************ Begin %include sections from the grammar ************************/\n#line 47 \"fts5parse.y\"\n\n/* #include \"fts5Int.h\" */\n/* #include \"fts5parse.h\" */\n\n/*\n** Disable all error recovery processing in the parser push-down\n** automaton.\n*/\n#define fts5YYNOERRORRECOVERY 1\n\n/*\n** Make fts5yytestcase() the same as testcase()\n*/\n#define fts5yytestcase(X) testcase(X)\n\n/*\n** Indicate that sqlite3ParserFree() will never be called with a null\n** pointer.\n*/\n#define fts5YYPARSEFREENOTNULL 1\n\n/*\n** Alternative datatype for the argument to the malloc() routine passed\n** into sqlite3ParserAlloc().  The default is size_t.\n*/\n#define fts5YYMALLOCARGTYPE  u64\n\n#line 56 \"fts5parse.c\"\n/**************** End of %include directives **********************************/\n/* These constants specify the various numeric values for terminal symbols\n** in a format understandable to \"makeheaders\".  This section is blank unless\n** \"lemon\" is run with the \"-m\" command-line option.\n***************** Begin makeheaders token definitions *************************/\n/**************** End makeheaders token definitions ***************************/\n\n/* The next sections is a series of control #defines.\n** various aspects of the generated parser.\n**    fts5YYCODETYPE         is the data type used to store the integer codes\n**                       that represent terminal and non-terminal symbols.\n**                       \"unsigned char\" is used if there are fewer than\n**                       256 symbols.  Larger types otherwise.\n**    fts5YYNOCODE           is a number of type fts5YYCODETYPE that is not used for\n**                       any terminal or nonterminal symbol.\n**    fts5YYFALLBACK         If defined, this indicates that one or more tokens\n**                       (also known as: \"terminal symbols\") have fall-back\n**                       values which should be used if the original symbol\n**                       would not parse.  This permits keywords to sometimes\n**                       be used as identifiers, for example.\n**    fts5YYACTIONTYPE       is the data type used for \"action codes\" - numbers\n**                       that indicate what to do in response to the next\n**                       token.\n**    sqlite3Fts5ParserFTS5TOKENTYPE     is the data type used for minor type for terminal\n**                       symbols.  Background: A \"minor type\" is a semantic\n**                       value associated with a terminal or non-terminal\n**                       symbols.  For example, for an \"ID\" terminal symbol,\n**                       the minor type might be the name of the identifier.\n**                       Each non-terminal can have a different minor type.\n**                       Terminal symbols all have the same minor type, though.\n**                       This macros defines the minor type for terminal \n**                       symbols.\n**    fts5YYMINORTYPE        is the data type used for all minor types.\n**                       This is typically a union of many types, one of\n**                       which is sqlite3Fts5ParserFTS5TOKENTYPE.  The entry in the union\n**                       for terminal symbols is called \"fts5yy0\".\n**    fts5YYSTACKDEPTH       is the maximum depth of the parser's stack.  If\n**                       zero the stack is dynamically sized using realloc()\n**    sqlite3Fts5ParserARG_SDECL     A static variable declaration for the %extra_argument\n**    sqlite3Fts5ParserARG_PDECL     A parameter declaration for the %extra_argument\n**    sqlite3Fts5ParserARG_STORE     Code to store %extra_argument into fts5yypParser\n**    sqlite3Fts5ParserARG_FETCH     Code to extract %extra_argument from fts5yypParser\n**    fts5YYERRORSYMBOL      is the code number of the error symbol.  If not\n**                       defined, then do no error processing.\n**    fts5YYNSTATE           the combined number of states.\n**    fts5YYNRULE            the number of rules in the grammar\n**    fts5YY_MAX_SHIFT       Maximum value for shift actions\n**    fts5YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions\n**    fts5YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions\n**    fts5YY_MIN_REDUCE      Maximum value for reduce actions\n**    fts5YY_ERROR_ACTION    The fts5yy_action[] code for syntax error\n**    fts5YY_ACCEPT_ACTION   The fts5yy_action[] code for accept\n**    fts5YY_NO_ACTION       The fts5yy_action[] code for no-op\n*/\n#ifndef INTERFACE\n# define INTERFACE 1\n#endif\n/************* Begin control #defines *****************************************/\n#define fts5YYCODETYPE unsigned char\n#define fts5YYNOCODE 28\n#define fts5YYACTIONTYPE unsigned char\n#define sqlite3Fts5ParserFTS5TOKENTYPE Fts5Token\ntypedef union {\n  int fts5yyinit;\n  sqlite3Fts5ParserFTS5TOKENTYPE fts5yy0;\n  int fts5yy4;\n  Fts5Colset* fts5yy11;\n  Fts5ExprNode* fts5yy24;\n  Fts5ExprNearset* fts5yy46;\n  Fts5ExprPhrase* fts5yy53;\n} fts5YYMINORTYPE;\n#ifndef fts5YYSTACKDEPTH\n#define fts5YYSTACKDEPTH 100\n#endif\n#define sqlite3Fts5ParserARG_SDECL Fts5Parse *pParse;\n#define sqlite3Fts5ParserARG_PDECL ,Fts5Parse *pParse\n#define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse = fts5yypParser->pParse\n#define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse = pParse\n#define fts5YYNSTATE             29\n#define fts5YYNRULE              26\n#define fts5YY_MAX_SHIFT         28\n#define fts5YY_MIN_SHIFTREDUCE   45\n#define fts5YY_MAX_SHIFTREDUCE   70\n#define fts5YY_MIN_REDUCE        71\n#define fts5YY_MAX_REDUCE        96\n#define fts5YY_ERROR_ACTION      97\n#define fts5YY_ACCEPT_ACTION     98\n#define fts5YY_NO_ACTION         99\n/************* End control #defines *******************************************/\n\n/* Define the fts5yytestcase() macro to be a no-op if is not already defined\n** otherwise.\n**\n** Applications can choose to define fts5yytestcase() in the %include section\n** to a macro that can assist in verifying code coverage.  For production\n** code the fts5yytestcase() macro should be turned off.  But it is useful\n** for testing.\n*/\n#ifndef fts5yytestcase\n# define fts5yytestcase(X)\n#endif\n\n\n/* Next are the tables used to determine what action to take based on the\n** current state and lookahead token.  These tables are used to implement\n** functions that take a state number and lookahead value and return an\n** action integer.  \n**\n** Suppose the action integer is N.  Then the action is determined as\n** follows\n**\n**   0 <= N <= fts5YY_MAX_SHIFT             Shift N.  That is, push the lookahead\n**                                      token onto the stack and goto state N.\n**\n**   N between fts5YY_MIN_SHIFTREDUCE       Shift to an arbitrary state then\n**     and fts5YY_MAX_SHIFTREDUCE           reduce by rule N-fts5YY_MIN_SHIFTREDUCE.\n**\n**   N between fts5YY_MIN_REDUCE            Reduce by rule N-fts5YY_MIN_REDUCE\n**     and fts5YY_MAX_REDUCE\n**\n**   N == fts5YY_ERROR_ACTION               A syntax error has occurred.\n**\n**   N == fts5YY_ACCEPT_ACTION              The parser accepts its input.\n**\n**   N == fts5YY_NO_ACTION                  No such action.  Denotes unused\n**                                      slots in the fts5yy_action[] table.\n**\n** The action table is constructed as a single large table named fts5yy_action[].\n** Given state S and lookahead X, the action is computed as either:\n**\n**    (A)   N = fts5yy_action[ fts5yy_shift_ofst[S] + X ]\n**    (B)   N = fts5yy_default[S]\n**\n** The (A) formula is preferred.  The B formula is used instead if:\n**    (1)  The fts5yy_shift_ofst[S]+X value is out of range, or\n**    (2)  fts5yy_lookahead[fts5yy_shift_ofst[S]+X] is not equal to X, or\n**    (3)  fts5yy_shift_ofst[S] equal fts5YY_SHIFT_USE_DFLT.\n** (Implementation note: fts5YY_SHIFT_USE_DFLT is chosen so that\n** fts5YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X.\n** Hence only tests (1) and (2) need to be evaluated.)\n**\n** The formulas above are for computing the action when the lookahead is\n** a terminal symbol.  If the lookahead is a non-terminal (as occurs after\n** a reduce action) then the fts5yy_reduce_ofst[] array is used in place of\n** the fts5yy_shift_ofst[] array and fts5YY_REDUCE_USE_DFLT is used in place of\n** fts5YY_SHIFT_USE_DFLT.\n**\n** The following are the tables generated in this section:\n**\n**  fts5yy_action[]        A single table containing all actions.\n**  fts5yy_lookahead[]     A table containing the lookahead for each entry in\n**                     fts5yy_action.  Used to detect hash collisions.\n**  fts5yy_shift_ofst[]    For each state, the offset into fts5yy_action for\n**                     shifting terminals.\n**  fts5yy_reduce_ofst[]   For each state, the offset into fts5yy_action for\n**                     shifting non-terminals after a reduce.\n**  fts5yy_default[]       Default action for each state.\n**\n*********** Begin parsing tables **********************************************/\n#define fts5YY_ACTTAB_COUNT (85)\nstatic const fts5YYACTIONTYPE fts5yy_action[] = {\n /*     0 */    98,   16,   51,    5,   53,   27,   83,    7,   26,   15,\n /*    10 */    51,    5,   53,   27,   13,   69,   26,   48,   51,    5,\n /*    20 */    53,   27,   19,   11,   26,    9,   20,   51,    5,   53,\n /*    30 */    27,   13,   22,   26,   28,   51,    5,   53,   27,   68,\n /*    40 */     1,   26,   19,   11,   17,    9,   52,   10,   53,   27,\n /*    50 */    23,   24,   26,   54,    3,    4,    2,   26,    6,   21,\n /*    60 */    49,   71,    3,    4,    2,    7,   56,   59,   55,   59,\n /*    70 */     4,    2,   12,   69,   58,   60,   18,   67,   62,   69,\n /*    80 */    25,   66,    8,   14,    2,\n};\nstatic const fts5YYCODETYPE fts5yy_lookahead[] = {\n /*     0 */    16,   17,   18,   19,   20,   21,    5,    6,   24,   17,\n /*    10 */    18,   19,   20,   21,   11,   14,   24,   17,   18,   19,\n /*    20 */    20,   21,    8,    9,   24,   11,   17,   18,   19,   20,\n /*    30 */    21,   11,   12,   24,   17,   18,   19,   20,   21,   26,\n /*    40 */     6,   24,    8,    9,   22,   11,   18,   11,   20,   21,\n /*    50 */    24,   25,   24,   20,    1,    2,    3,   24,   23,   24,\n /*    60 */     7,    0,    1,    2,    3,    6,   10,   11,   10,   11,\n /*    70 */     2,    3,    9,   14,   11,   11,   22,   26,    7,   14,\n /*    80 */    13,   11,    5,   11,    3,\n};\n#define fts5YY_SHIFT_USE_DFLT (85)\n#define fts5YY_SHIFT_COUNT    (28)\n#define fts5YY_SHIFT_MIN      (0)\n#define fts5YY_SHIFT_MAX      (81)\nstatic const unsigned char fts5yy_shift_ofst[] = {\n /*     0 */    34,   34,   34,   34,   34,   14,   20,    3,   36,    1,\n /*    10 */    59,   64,   64,   65,   65,   53,   61,   56,   58,   63,\n /*    20 */    68,   67,   70,   67,   71,   72,   67,   77,   81,\n};\n#define fts5YY_REDUCE_USE_DFLT (-17)\n#define fts5YY_REDUCE_COUNT (14)\n#define fts5YY_REDUCE_MIN   (-16)\n#define fts5YY_REDUCE_MAX   (54)\nstatic const signed char fts5yy_reduce_ofst[] = {\n /*     0 */   -16,   -8,    0,    9,   17,   28,   26,   35,   33,   13,\n /*    10 */    13,   22,   54,   13,   51,\n};\nstatic const fts5YYACTIONTYPE fts5yy_default[] = {\n /*     0 */    97,   97,   97,   97,   97,   76,   91,   97,   97,   96,\n /*    10 */    96,   97,   97,   96,   96,   97,   97,   97,   97,   97,\n /*    20 */    73,   89,   97,   90,   97,   97,   87,   97,   72,\n};\n/********** End of lemon-generated parsing tables *****************************/\n\n/* The next table maps tokens (terminal symbols) into fallback tokens.  \n** If a construct like the following:\n** \n**      %fallback ID X Y Z.\n**\n** appears in the grammar, then ID becomes a fallback token for X, Y,\n** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser\n** but it does not parse, the type of the token is changed to ID and\n** the parse is retried before an error is thrown.\n**\n** This feature can be used, for example, to cause some keywords in a language\n** to revert to identifiers if they keyword does not apply in the context where\n** it appears.\n*/\n#ifdef fts5YYFALLBACK\nstatic const fts5YYCODETYPE fts5yyFallback[] = {\n};\n#endif /* fts5YYFALLBACK */\n\n/* The following structure represents a single element of the\n** parser's stack.  Information stored includes:\n**\n**   +  The state number for the parser at this level of the stack.\n**\n**   +  The value of the token stored at this level of the stack.\n**      (In other words, the \"major\" token.)\n**\n**   +  The semantic value stored at this level of the stack.  This is\n**      the information used by the action routines in the grammar.\n**      It is sometimes called the \"minor\" token.\n**\n** After the \"shift\" half of a SHIFTREDUCE action, the stateno field\n** actually contains the reduce action for the second half of the\n** SHIFTREDUCE.\n*/\nstruct fts5yyStackEntry {\n  fts5YYACTIONTYPE stateno;  /* The state-number, or reduce action in SHIFTREDUCE */\n  fts5YYCODETYPE major;      /* The major token value.  This is the code\n                         ** number for the token at this stack level */\n  fts5YYMINORTYPE minor;     /* The user-supplied minor token value.  This\n                         ** is the value of the token  */\n};\ntypedef struct fts5yyStackEntry fts5yyStackEntry;\n\n/* The state of the parser is completely contained in an instance of\n** the following structure */\nstruct fts5yyParser {\n  fts5yyStackEntry *fts5yytos;          /* Pointer to top element of the stack */\n#ifdef fts5YYTRACKMAXSTACKDEPTH\n  int fts5yyhwm;                    /* High-water mark of the stack */\n#endif\n#ifndef fts5YYNOERRORRECOVERY\n  int fts5yyerrcnt;                 /* Shifts left before out of the error */\n#endif\n  sqlite3Fts5ParserARG_SDECL                /* A place to hold %extra_argument */\n#if fts5YYSTACKDEPTH<=0\n  int fts5yystksz;                  /* Current side of the stack */\n  fts5yyStackEntry *fts5yystack;        /* The parser's stack */\n  fts5yyStackEntry fts5yystk0;          /* First stack entry */\n#else\n  fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH];  /* The parser's stack */\n#endif\n};\ntypedef struct fts5yyParser fts5yyParser;\n\n#ifndef NDEBUG\n#include <stdio.h>\nstatic FILE *fts5yyTraceFILE = 0;\nstatic char *fts5yyTracePrompt = 0;\n#endif /* NDEBUG */\n\n#ifndef NDEBUG\n/* \n** Turn parser tracing on by giving a stream to which to write the trace\n** and a prompt to preface each trace message.  Tracing is turned off\n** by making either argument NULL \n**\n** Inputs:\n** <ul>\n** <li> A FILE* to which trace output should be written.\n**      If NULL, then tracing is turned off.\n** <li> A prefix string written at the beginning of every\n**      line of trace output.  If NULL, then tracing is\n**      turned off.\n** </ul>\n**\n** Outputs:\n** None.\n*/\nstatic void sqlite3Fts5ParserTrace(FILE *TraceFILE, char *zTracePrompt){\n  fts5yyTraceFILE = TraceFILE;\n  fts5yyTracePrompt = zTracePrompt;\n  if( fts5yyTraceFILE==0 ) fts5yyTracePrompt = 0;\n  else if( fts5yyTracePrompt==0 ) fts5yyTraceFILE = 0;\n}\n#endif /* NDEBUG */\n\n#ifndef NDEBUG\n/* For tracing shifts, the names of all terminals and nonterminals\n** are required.  The following table supplies these names */\nstatic const char *const fts5yyTokenName[] = { \n  \"$\",             \"OR\",            \"AND\",           \"NOT\",         \n  \"TERM\",          \"COLON\",         \"LP\",            \"RP\",          \n  \"MINUS\",         \"LCP\",           \"RCP\",           \"STRING\",      \n  \"COMMA\",         \"PLUS\",          \"STAR\",          \"error\",       \n  \"input\",         \"expr\",          \"cnearset\",      \"exprlist\",    \n  \"nearset\",       \"colset\",        \"colsetlist\",    \"nearphrases\", \n  \"phrase\",        \"neardist_opt\",  \"star_opt\",    \n};\n#endif /* NDEBUG */\n\n#ifndef NDEBUG\n/* For tracing reduce actions, the names of all rules are required.\n*/\nstatic const char *const fts5yyRuleName[] = {\n /*   0 */ \"input ::= expr\",\n /*   1 */ \"expr ::= expr AND expr\",\n /*   2 */ \"expr ::= expr OR expr\",\n /*   3 */ \"expr ::= expr NOT expr\",\n /*   4 */ \"expr ::= LP expr RP\",\n /*   5 */ \"expr ::= exprlist\",\n /*   6 */ \"exprlist ::= cnearset\",\n /*   7 */ \"exprlist ::= exprlist cnearset\",\n /*   8 */ \"cnearset ::= nearset\",\n /*   9 */ \"cnearset ::= colset COLON nearset\",\n /*  10 */ \"colset ::= MINUS LCP colsetlist RCP\",\n /*  11 */ \"colset ::= LCP colsetlist RCP\",\n /*  12 */ \"colset ::= STRING\",\n /*  13 */ \"colset ::= MINUS STRING\",\n /*  14 */ \"colsetlist ::= colsetlist STRING\",\n /*  15 */ \"colsetlist ::= STRING\",\n /*  16 */ \"nearset ::= phrase\",\n /*  17 */ \"nearset ::= STRING LP nearphrases neardist_opt RP\",\n /*  18 */ \"nearphrases ::= phrase\",\n /*  19 */ \"nearphrases ::= nearphrases phrase\",\n /*  20 */ \"neardist_opt ::=\",\n /*  21 */ \"neardist_opt ::= COMMA STRING\",\n /*  22 */ \"phrase ::= phrase PLUS STRING star_opt\",\n /*  23 */ \"phrase ::= STRING star_opt\",\n /*  24 */ \"star_opt ::= STAR\",\n /*  25 */ \"star_opt ::=\",\n};\n#endif /* NDEBUG */\n\n\n#if fts5YYSTACKDEPTH<=0\n/*\n** Try to increase the size of the parser stack.  Return the number\n** of errors.  Return 0 on success.\n*/\nstatic int fts5yyGrowStack(fts5yyParser *p){\n  int newSize;\n  int idx;\n  fts5yyStackEntry *pNew;\n\n  newSize = p->fts5yystksz*2 + 100;\n  idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0;\n  if( p->fts5yystack==&p->fts5yystk0 ){\n    pNew = malloc(newSize*sizeof(pNew[0]));\n    if( pNew ) pNew[0] = p->fts5yystk0;\n  }else{\n    pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0]));\n  }\n  if( pNew ){\n    p->fts5yystack = pNew;\n    p->fts5yytos = &p->fts5yystack[idx];\n#ifndef NDEBUG\n    if( fts5yyTraceFILE ){\n      fprintf(fts5yyTraceFILE,\"%sStack grows from %d to %d entries.\\n\",\n              fts5yyTracePrompt, p->fts5yystksz, newSize);\n    }\n#endif\n    p->fts5yystksz = newSize;\n  }\n  return pNew==0; \n}\n#endif\n\n/* Datatype of the argument to the memory allocated passed as the\n** second argument to sqlite3Fts5ParserAlloc() below.  This can be changed by\n** putting an appropriate #define in the %include section of the input\n** grammar.\n*/\n#ifndef fts5YYMALLOCARGTYPE\n# define fts5YYMALLOCARGTYPE size_t\n#endif\n\n/* \n** This function allocates a new parser.\n** The only argument is a pointer to a function which works like\n** malloc.\n**\n** Inputs:\n** A pointer to the function used to allocate memory.\n**\n** Outputs:\n** A pointer to a parser.  This pointer is used in subsequent calls\n** to sqlite3Fts5Parser and sqlite3Fts5ParserFree.\n*/\nstatic void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE)){\n  fts5yyParser *pParser;\n  pParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) );\n  if( pParser ){\n#ifdef fts5YYTRACKMAXSTACKDEPTH\n    pParser->fts5yyhwm = 0;\n#endif\n#if fts5YYSTACKDEPTH<=0\n    pParser->fts5yytos = NULL;\n    pParser->fts5yystack = NULL;\n    pParser->fts5yystksz = 0;\n    if( fts5yyGrowStack(pParser) ){\n      pParser->fts5yystack = &pParser->fts5yystk0;\n      pParser->fts5yystksz = 1;\n    }\n#endif\n#ifndef fts5YYNOERRORRECOVERY\n    pParser->fts5yyerrcnt = -1;\n#endif\n    pParser->fts5yytos = pParser->fts5yystack;\n    pParser->fts5yystack[0].stateno = 0;\n    pParser->fts5yystack[0].major = 0;\n  }\n  return pParser;\n}\n\n/* The following function deletes the \"minor type\" or semantic value\n** associated with a symbol.  The symbol can be either a terminal\n** or nonterminal. \"fts5yymajor\" is the symbol code, and \"fts5yypminor\" is\n** a pointer to the value to be deleted.  The code used to do the \n** deletions is derived from the %destructor and/or %token_destructor\n** directives of the input grammar.\n*/\nstatic void fts5yy_destructor(\n  fts5yyParser *fts5yypParser,    /* The parser */\n  fts5YYCODETYPE fts5yymajor,     /* Type code for object to destroy */\n  fts5YYMINORTYPE *fts5yypminor   /* The object to be destroyed */\n){\n  sqlite3Fts5ParserARG_FETCH;\n  switch( fts5yymajor ){\n    /* Here is inserted the actions which take place when a\n    ** terminal or non-terminal is destroyed.  This can happen\n    ** when the symbol is popped from the stack during a\n    ** reduce or during error processing or when a parser is \n    ** being destroyed before it is finished parsing.\n    **\n    ** Note: during a reduce, the only symbols destroyed are those\n    ** which appear on the RHS of the rule, but which are *not* used\n    ** inside the C code.\n    */\n/********* Begin destructor definitions ***************************************/\n    case 16: /* input */\n{\n#line 83 \"fts5parse.y\"\n (void)pParse; \n#line 517 \"fts5parse.c\"\n}\n      break;\n    case 17: /* expr */\n    case 18: /* cnearset */\n    case 19: /* exprlist */\n{\n#line 89 \"fts5parse.y\"\n sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24)); \n#line 526 \"fts5parse.c\"\n}\n      break;\n    case 20: /* nearset */\n    case 23: /* nearphrases */\n{\n#line 143 \"fts5parse.y\"\n sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46)); \n#line 534 \"fts5parse.c\"\n}\n      break;\n    case 21: /* colset */\n    case 22: /* colsetlist */\n{\n#line 119 \"fts5parse.y\"\n sqlite3_free((fts5yypminor->fts5yy11)); \n#line 542 \"fts5parse.c\"\n}\n      break;\n    case 24: /* phrase */\n{\n#line 174 \"fts5parse.y\"\n sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53)); \n#line 549 \"fts5parse.c\"\n}\n      break;\n/********* End destructor definitions *****************************************/\n    default:  break;   /* If no destructor action specified: do nothing */\n  }\n}\n\n/*\n** Pop the parser's stack once.\n**\n** If there is a destructor routine associated with the token which\n** is popped from the stack, then call it.\n*/\nstatic void fts5yy_pop_parser_stack(fts5yyParser *pParser){\n  fts5yyStackEntry *fts5yytos;\n  assert( pParser->fts5yytos!=0 );\n  assert( pParser->fts5yytos > pParser->fts5yystack );\n  fts5yytos = pParser->fts5yytos--;\n#ifndef NDEBUG\n  if( fts5yyTraceFILE ){\n    fprintf(fts5yyTraceFILE,\"%sPopping %s\\n\",\n      fts5yyTracePrompt,\n      fts5yyTokenName[fts5yytos->major]);\n  }\n#endif\n  fts5yy_destructor(pParser, fts5yytos->major, &fts5yytos->minor);\n}\n\n/* \n** Deallocate and destroy a parser.  Destructors are called for\n** all stack elements before shutting the parser down.\n**\n** If the fts5YYPARSEFREENEVERNULL macro exists (for example because it\n** is defined in a %include section of the input grammar) then it is\n** assumed that the input pointer is never NULL.\n*/\nstatic void sqlite3Fts5ParserFree(\n  void *p,                    /* The parser to be deleted */\n  void (*freeProc)(void*)     /* Function used to reclaim memory */\n){\n  fts5yyParser *pParser = (fts5yyParser*)p;\n#ifndef fts5YYPARSEFREENEVERNULL\n  if( pParser==0 ) return;\n#endif\n  while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser);\n#if fts5YYSTACKDEPTH<=0\n  if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack);\n#endif\n  (*freeProc)((void*)pParser);\n}\n\n/*\n** Return the peak depth of the stack for a parser.\n*/\n#ifdef fts5YYTRACKMAXSTACKDEPTH\nstatic int sqlite3Fts5ParserStackPeak(void *p){\n  fts5yyParser *pParser = (fts5yyParser*)p;\n  return pParser->fts5yyhwm;\n}\n#endif\n\n/*\n** Find the appropriate action for a parser given the terminal\n** look-ahead token iLookAhead.\n*/\nstatic unsigned int fts5yy_find_shift_action(\n  fts5yyParser *pParser,        /* The parser */\n  fts5YYCODETYPE iLookAhead     /* The look-ahead token */\n){\n  int i;\n  int stateno = pParser->fts5yytos->stateno;\n \n  if( stateno>=fts5YY_MIN_REDUCE ) return stateno;\n  assert( stateno <= fts5YY_SHIFT_COUNT );\n  do{\n    i = fts5yy_shift_ofst[stateno];\n    assert( iLookAhead!=fts5YYNOCODE );\n    i += iLookAhead;\n    if( i<0 || i>=fts5YY_ACTTAB_COUNT || fts5yy_lookahead[i]!=iLookAhead ){\n#ifdef fts5YYFALLBACK\n      fts5YYCODETYPE iFallback;            /* Fallback token */\n      if( iLookAhead<sizeof(fts5yyFallback)/sizeof(fts5yyFallback[0])\n             && (iFallback = fts5yyFallback[iLookAhead])!=0 ){\n#ifndef NDEBUG\n        if( fts5yyTraceFILE ){\n          fprintf(fts5yyTraceFILE, \"%sFALLBACK %s => %s\\n\",\n             fts5yyTracePrompt, fts5yyTokenName[iLookAhead], fts5yyTokenName[iFallback]);\n        }\n#endif\n        assert( fts5yyFallback[iFallback]==0 ); /* Fallback loop must terminate */\n        iLookAhead = iFallback;\n        continue;\n      }\n#endif\n#ifdef fts5YYWILDCARD\n      {\n        int j = i - iLookAhead + fts5YYWILDCARD;\n        if( \n#if fts5YY_SHIFT_MIN+fts5YYWILDCARD<0\n          j>=0 &&\n#endif\n#if fts5YY_SHIFT_MAX+fts5YYWILDCARD>=fts5YY_ACTTAB_COUNT\n          j<fts5YY_ACTTAB_COUNT &&\n#endif\n          fts5yy_lookahead[j]==fts5YYWILDCARD && iLookAhead>0\n        ){\n#ifndef NDEBUG\n          if( fts5yyTraceFILE ){\n            fprintf(fts5yyTraceFILE, \"%sWILDCARD %s => %s\\n\",\n               fts5yyTracePrompt, fts5yyTokenName[iLookAhead],\n               fts5yyTokenName[fts5YYWILDCARD]);\n          }\n#endif /* NDEBUG */\n          return fts5yy_action[j];\n        }\n      }\n#endif /* fts5YYWILDCARD */\n      return fts5yy_default[stateno];\n    }else{\n      return fts5yy_action[i];\n    }\n  }while(1);\n}\n\n/*\n** Find the appropriate action for a parser given the non-terminal\n** look-ahead token iLookAhead.\n*/\nstatic int fts5yy_find_reduce_action(\n  int stateno,              /* Current state number */\n  fts5YYCODETYPE iLookAhead     /* The look-ahead token */\n){\n  int i;\n#ifdef fts5YYERRORSYMBOL\n  if( stateno>fts5YY_REDUCE_COUNT ){\n    return fts5yy_default[stateno];\n  }\n#else\n  assert( stateno<=fts5YY_REDUCE_COUNT );\n#endif\n  i = fts5yy_reduce_ofst[stateno];\n  assert( i!=fts5YY_REDUCE_USE_DFLT );\n  assert( iLookAhead!=fts5YYNOCODE );\n  i += iLookAhead;\n#ifdef fts5YYERRORSYMBOL\n  if( i<0 || i>=fts5YY_ACTTAB_COUNT || fts5yy_lookahead[i]!=iLookAhead ){\n    return fts5yy_default[stateno];\n  }\n#else\n  assert( i>=0 && i<fts5YY_ACTTAB_COUNT );\n  assert( fts5yy_lookahead[i]==iLookAhead );\n#endif\n  return fts5yy_action[i];\n}\n\n/*\n** The following routine is called if the stack overflows.\n*/\nstatic void fts5yyStackOverflow(fts5yyParser *fts5yypParser){\n   sqlite3Fts5ParserARG_FETCH;\n   fts5yypParser->fts5yytos--;\n#ifndef NDEBUG\n   if( fts5yyTraceFILE ){\n     fprintf(fts5yyTraceFILE,\"%sStack Overflow!\\n\",fts5yyTracePrompt);\n   }\n#endif\n   while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);\n   /* Here code is inserted which will execute if the parser\n   ** stack every overflows */\n/******** Begin %stack_overflow code ******************************************/\n#line 36 \"fts5parse.y\"\n\n  sqlite3Fts5ParseError(pParse, \"fts5: parser stack overflow\");\n#line 723 \"fts5parse.c\"\n/******** End %stack_overflow code ********************************************/\n   sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument var */\n}\n\n/*\n** Print tracing information for a SHIFT action\n*/\n#ifndef NDEBUG\nstatic void fts5yyTraceShift(fts5yyParser *fts5yypParser, int fts5yyNewState){\n  if( fts5yyTraceFILE ){\n    if( fts5yyNewState<fts5YYNSTATE ){\n      fprintf(fts5yyTraceFILE,\"%sShift '%s', go to state %d\\n\",\n         fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major],\n         fts5yyNewState);\n    }else{\n      fprintf(fts5yyTraceFILE,\"%sShift '%s'\\n\",\n         fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major]);\n    }\n  }\n}\n#else\n# define fts5yyTraceShift(X,Y)\n#endif\n\n/*\n** Perform a shift action.\n*/\nstatic void fts5yy_shift(\n  fts5yyParser *fts5yypParser,          /* The parser to be shifted */\n  int fts5yyNewState,               /* The new state to shift in */\n  int fts5yyMajor,                  /* The major token to shift in */\n  sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor        /* The minor token to shift in */\n){\n  fts5yyStackEntry *fts5yytos;\n  fts5yypParser->fts5yytos++;\n#ifdef fts5YYTRACKMAXSTACKDEPTH\n  if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){\n    fts5yypParser->fts5yyhwm++;\n    assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) );\n  }\n#endif\n#if fts5YYSTACKDEPTH>0 \n  if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){\n    fts5yyStackOverflow(fts5yypParser);\n    return;\n  }\n#else\n  if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){\n    if( fts5yyGrowStack(fts5yypParser) ){\n      fts5yyStackOverflow(fts5yypParser);\n      return;\n    }\n  }\n#endif\n  if( fts5yyNewState > fts5YY_MAX_SHIFT ){\n    fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE;\n  }\n  fts5yytos = fts5yypParser->fts5yytos;\n  fts5yytos->stateno = (fts5YYACTIONTYPE)fts5yyNewState;\n  fts5yytos->major = (fts5YYCODETYPE)fts5yyMajor;\n  fts5yytos->minor.fts5yy0 = fts5yyMinor;\n  fts5yyTraceShift(fts5yypParser, fts5yyNewState);\n}\n\n/* The following table contains information about every rule that\n** is used during the reduce.\n*/\nstatic const struct {\n  fts5YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */\n  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */\n} fts5yyRuleInfo[] = {\n  { 16, 1 },\n  { 17, 3 },\n  { 17, 3 },\n  { 17, 3 },\n  { 17, 3 },\n  { 17, 1 },\n  { 19, 1 },\n  { 19, 2 },\n  { 18, 1 },\n  { 18, 3 },\n  { 21, 4 },\n  { 21, 3 },\n  { 21, 1 },\n  { 21, 2 },\n  { 22, 2 },\n  { 22, 1 },\n  { 20, 1 },\n  { 20, 5 },\n  { 23, 1 },\n  { 23, 2 },\n  { 25, 0 },\n  { 25, 2 },\n  { 24, 4 },\n  { 24, 2 },\n  { 26, 1 },\n  { 26, 0 },\n};\n\nstatic void fts5yy_accept(fts5yyParser*);  /* Forward Declaration */\n\n/*\n** Perform a reduce action and the shift that must immediately\n** follow the reduce.\n*/\nstatic void fts5yy_reduce(\n  fts5yyParser *fts5yypParser,         /* The parser */\n  unsigned int fts5yyruleno        /* Number of the rule by which to reduce */\n){\n  int fts5yygoto;                     /* The next state */\n  int fts5yyact;                      /* The next action */\n  fts5yyStackEntry *fts5yymsp;            /* The top of the parser's stack */\n  int fts5yysize;                     /* Amount to pop the stack */\n  sqlite3Fts5ParserARG_FETCH;\n  fts5yymsp = fts5yypParser->fts5yytos;\n#ifndef NDEBUG\n  if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){\n    fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs;\n    fprintf(fts5yyTraceFILE, \"%sReduce [%s], go to state %d.\\n\", fts5yyTracePrompt,\n      fts5yyRuleName[fts5yyruleno], fts5yymsp[-fts5yysize].stateno);\n  }\n#endif /* NDEBUG */\n\n  /* Check that the stack is large enough to grow by a single entry\n  ** if the RHS of the rule is empty.  This ensures that there is room\n  ** enough on the stack to push the LHS value */\n  if( fts5yyRuleInfo[fts5yyruleno].nrhs==0 ){\n#ifdef fts5YYTRACKMAXSTACKDEPTH\n    if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){\n      fts5yypParser->fts5yyhwm++;\n      assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack));\n    }\n#endif\n#if fts5YYSTACKDEPTH>0 \n    if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){\n      fts5yyStackOverflow(fts5yypParser);\n      return;\n    }\n#else\n    if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){\n      if( fts5yyGrowStack(fts5yypParser) ){\n        fts5yyStackOverflow(fts5yypParser);\n        return;\n      }\n      fts5yymsp = fts5yypParser->fts5yytos;\n    }\n#endif\n  }\n\n  switch( fts5yyruleno ){\n  /* Beginning here are the reduction cases.  A typical example\n  ** follows:\n  **   case 0:\n  **  #line <lineno> <grammarfile>\n  **     { ... }           // User supplied code\n  **  #line <lineno> <thisfile>\n  **     break;\n  */\n/********** Begin reduce actions **********************************************/\n        fts5YYMINORTYPE fts5yylhsminor;\n      case 0: /* input ::= expr */\n#line 82 \"fts5parse.y\"\n{ sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); }\n#line 887 \"fts5parse.c\"\n        break;\n      case 1: /* expr ::= expr AND expr */\n#line 92 \"fts5parse.y\"\n{\n  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);\n}\n#line 894 \"fts5parse.c\"\n  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;\n        break;\n      case 2: /* expr ::= expr OR expr */\n#line 95 \"fts5parse.y\"\n{\n  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);\n}\n#line 902 \"fts5parse.c\"\n  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;\n        break;\n      case 3: /* expr ::= expr NOT expr */\n#line 98 \"fts5parse.y\"\n{\n  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0);\n}\n#line 910 \"fts5parse.c\"\n  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;\n        break;\n      case 4: /* expr ::= LP expr RP */\n#line 102 \"fts5parse.y\"\n{fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;}\n#line 916 \"fts5parse.c\"\n        break;\n      case 5: /* expr ::= exprlist */\n      case 6: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==6);\n#line 103 \"fts5parse.y\"\n{fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;}\n#line 922 \"fts5parse.c\"\n  fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;\n        break;\n      case 7: /* exprlist ::= exprlist cnearset */\n#line 106 \"fts5parse.y\"\n{\n  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24);\n}\n#line 930 \"fts5parse.c\"\n  fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24;\n        break;\n      case 8: /* cnearset ::= nearset */\n#line 110 \"fts5parse.y\"\n{ \n  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); \n}\n#line 938 \"fts5parse.c\"\n  fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24;\n        break;\n      case 9: /* cnearset ::= colset COLON nearset */\n#line 113 \"fts5parse.y\"\n{ \n  sqlite3Fts5ParseSetColset(pParse, fts5yymsp[0].minor.fts5yy46, fts5yymsp[-2].minor.fts5yy11);\n  fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); \n}\n#line 947 \"fts5parse.c\"\n  fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24;\n        break;\n      case 10: /* colset ::= MINUS LCP colsetlist RCP */\n#line 123 \"fts5parse.y\"\n{ \n    fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);\n}\n#line 955 \"fts5parse.c\"\n        break;\n      case 11: /* colset ::= LCP colsetlist RCP */\n#line 126 \"fts5parse.y\"\n{ fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; }\n#line 960 \"fts5parse.c\"\n        break;\n      case 12: /* colset ::= STRING */\n#line 127 \"fts5parse.y\"\n{\n  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);\n}\n#line 967 \"fts5parse.c\"\n  fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;\n        break;\n      case 13: /* colset ::= MINUS STRING */\n#line 130 \"fts5parse.y\"\n{\n  fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0);\n  fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11);\n}\n#line 976 \"fts5parse.c\"\n        break;\n      case 14: /* colsetlist ::= colsetlist STRING */\n#line 135 \"fts5parse.y\"\n{ \n  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); }\n#line 982 \"fts5parse.c\"\n  fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11;\n        break;\n      case 15: /* colsetlist ::= STRING */\n#line 137 \"fts5parse.y\"\n{ \n  fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); \n}\n#line 990 \"fts5parse.c\"\n  fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11;\n        break;\n      case 16: /* nearset ::= phrase */\n#line 146 \"fts5parse.y\"\n{ fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); }\n#line 996 \"fts5parse.c\"\n  fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;\n        break;\n      case 17: /* nearset ::= STRING LP nearphrases neardist_opt RP */\n#line 147 \"fts5parse.y\"\n{\n  sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0);\n  sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0);\n  fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46;\n}\n#line 1006 \"fts5parse.c\"\n  fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46;\n        break;\n      case 18: /* nearphrases ::= phrase */\n#line 153 \"fts5parse.y\"\n{ \n  fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); \n}\n#line 1014 \"fts5parse.c\"\n  fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46;\n        break;\n      case 19: /* nearphrases ::= nearphrases phrase */\n#line 156 \"fts5parse.y\"\n{\n  fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53);\n}\n#line 1022 \"fts5parse.c\"\n  fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46;\n        break;\n      case 20: /* neardist_opt ::= */\n#line 163 \"fts5parse.y\"\n{ fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; }\n#line 1028 \"fts5parse.c\"\n        break;\n      case 21: /* neardist_opt ::= COMMA STRING */\n#line 164 \"fts5parse.y\"\n{ fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; }\n#line 1033 \"fts5parse.c\"\n        break;\n      case 22: /* phrase ::= phrase PLUS STRING star_opt */\n#line 176 \"fts5parse.y\"\n{ \n  fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);\n}\n#line 1040 \"fts5parse.c\"\n  fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53;\n        break;\n      case 23: /* phrase ::= STRING star_opt */\n#line 179 \"fts5parse.y\"\n{ \n  fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4);\n}\n#line 1048 \"fts5parse.c\"\n  fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53;\n        break;\n      case 24: /* star_opt ::= STAR */\n#line 188 \"fts5parse.y\"\n{ fts5yymsp[0].minor.fts5yy4 = 1; }\n#line 1054 \"fts5parse.c\"\n        break;\n      case 25: /* star_opt ::= */\n#line 189 \"fts5parse.y\"\n{ fts5yymsp[1].minor.fts5yy4 = 0; }\n#line 1059 \"fts5parse.c\"\n        break;\n      default:\n        break;\n/********** End reduce actions ************************************************/\n  };\n  assert( fts5yyruleno<sizeof(fts5yyRuleInfo)/sizeof(fts5yyRuleInfo[0]) );\n  fts5yygoto = fts5yyRuleInfo[fts5yyruleno].lhs;\n  fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs;\n  fts5yyact = fts5yy_find_reduce_action(fts5yymsp[-fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto);\n  if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){\n    if( fts5yyact>fts5YY_MAX_SHIFT ){\n      fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE;\n    }\n    fts5yymsp -= fts5yysize-1;\n    fts5yypParser->fts5yytos = fts5yymsp;\n    fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact;\n    fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto;\n    fts5yyTraceShift(fts5yypParser, fts5yyact);\n  }else{\n    assert( fts5yyact == fts5YY_ACCEPT_ACTION );\n    fts5yypParser->fts5yytos -= fts5yysize;\n    fts5yy_accept(fts5yypParser);\n  }\n}\n\n/*\n** The following code executes when the parse fails\n*/\n#ifndef fts5YYNOERRORRECOVERY\nstatic void fts5yy_parse_failed(\n  fts5yyParser *fts5yypParser           /* The parser */\n){\n  sqlite3Fts5ParserARG_FETCH;\n#ifndef NDEBUG\n  if( fts5yyTraceFILE ){\n    fprintf(fts5yyTraceFILE,\"%sFail!\\n\",fts5yyTracePrompt);\n  }\n#endif\n  while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);\n  /* Here code is inserted which will be executed whenever the\n  ** parser fails */\n/************ Begin %parse_failure code ***************************************/\n/************ End %parse_failure code *****************************************/\n  sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\n}\n#endif /* fts5YYNOERRORRECOVERY */\n\n/*\n** The following code executes when a syntax error first occurs.\n*/\nstatic void fts5yy_syntax_error(\n  fts5yyParser *fts5yypParser,           /* The parser */\n  int fts5yymajor,                   /* The major type of the error token */\n  sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor         /* The minor type of the error token */\n){\n  sqlite3Fts5ParserARG_FETCH;\n#define FTS5TOKEN fts5yyminor\n/************ Begin %syntax_error code ****************************************/\n#line 30 \"fts5parse.y\"\n\n  UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */\n  sqlite3Fts5ParseError(\n    pParse, \"fts5: syntax error near \\\"%.*s\\\"\",FTS5TOKEN.n,FTS5TOKEN.p\n  );\n#line 1124 \"fts5parse.c\"\n/************ End %syntax_error code ******************************************/\n  sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\n}\n\n/*\n** The following is executed when the parser accepts\n*/\nstatic void fts5yy_accept(\n  fts5yyParser *fts5yypParser           /* The parser */\n){\n  sqlite3Fts5ParserARG_FETCH;\n#ifndef NDEBUG\n  if( fts5yyTraceFILE ){\n    fprintf(fts5yyTraceFILE,\"%sAccept!\\n\",fts5yyTracePrompt);\n  }\n#endif\n#ifndef fts5YYNOERRORRECOVERY\n  fts5yypParser->fts5yyerrcnt = -1;\n#endif\n  assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack );\n  /* Here code is inserted which will be executed whenever the\n  ** parser accepts */\n/*********** Begin %parse_accept code *****************************************/\n/*********** End %parse_accept code *******************************************/\n  sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\n}\n\n/* The main parser program.\n** The first argument is a pointer to a structure obtained from\n** \"sqlite3Fts5ParserAlloc\" which describes the current state of the parser.\n** The second argument is the major token number.  The third is\n** the minor token.  The fourth optional argument is whatever the\n** user wants (and specified in the grammar) and is available for\n** use by the action routines.\n**\n** Inputs:\n** <ul>\n** <li> A pointer to the parser (an opaque structure.)\n** <li> The major token number.\n** <li> The minor token number.\n** <li> An option argument of a grammar-specified type.\n** </ul>\n**\n** Outputs:\n** None.\n*/\nstatic void sqlite3Fts5Parser(\n  void *fts5yyp,                   /* The parser */\n  int fts5yymajor,                 /* The major token code number */\n  sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor       /* The value for the token */\n  sqlite3Fts5ParserARG_PDECL               /* Optional %extra_argument parameter */\n){\n  fts5YYMINORTYPE fts5yyminorunion;\n  unsigned int fts5yyact;   /* The parser action. */\n#if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)\n  int fts5yyendofinput;     /* True if we are at the end of input */\n#endif\n#ifdef fts5YYERRORSYMBOL\n  int fts5yyerrorhit = 0;   /* True if fts5yymajor has invoked an error */\n#endif\n  fts5yyParser *fts5yypParser;  /* The parser */\n\n  fts5yypParser = (fts5yyParser*)fts5yyp;\n  assert( fts5yypParser->fts5yytos!=0 );\n#if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY)\n  fts5yyendofinput = (fts5yymajor==0);\n#endif\n  sqlite3Fts5ParserARG_STORE;\n\n#ifndef NDEBUG\n  if( fts5yyTraceFILE ){\n    fprintf(fts5yyTraceFILE,\"%sInput '%s'\\n\",fts5yyTracePrompt,fts5yyTokenName[fts5yymajor]);\n  }\n#endif\n\n  do{\n    fts5yyact = fts5yy_find_shift_action(fts5yypParser,(fts5YYCODETYPE)fts5yymajor);\n    if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){\n      fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor);\n#ifndef fts5YYNOERRORRECOVERY\n      fts5yypParser->fts5yyerrcnt--;\n#endif\n      fts5yymajor = fts5YYNOCODE;\n    }else if( fts5yyact <= fts5YY_MAX_REDUCE ){\n      fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE);\n    }else{\n      assert( fts5yyact == fts5YY_ERROR_ACTION );\n      fts5yyminorunion.fts5yy0 = fts5yyminor;\n#ifdef fts5YYERRORSYMBOL\n      int fts5yymx;\n#endif\n#ifndef NDEBUG\n      if( fts5yyTraceFILE ){\n        fprintf(fts5yyTraceFILE,\"%sSyntax Error!\\n\",fts5yyTracePrompt);\n      }\n#endif\n#ifdef fts5YYERRORSYMBOL\n      /* A syntax error has occurred.\n      ** The response to an error depends upon whether or not the\n      ** grammar defines an error token \"ERROR\".  \n      **\n      ** This is what we do if the grammar does define ERROR:\n      **\n      **  * Call the %syntax_error function.\n      **\n      **  * Begin popping the stack until we enter a state where\n      **    it is legal to shift the error symbol, then shift\n      **    the error symbol.\n      **\n      **  * Set the error count to three.\n      **\n      **  * Begin accepting and shifting new tokens.  No new error\n      **    processing will occur until three tokens have been\n      **    shifted successfully.\n      **\n      */\n      if( fts5yypParser->fts5yyerrcnt<0 ){\n        fts5yy_syntax_error(fts5yypParser,fts5yymajor,fts5yyminor);\n      }\n      fts5yymx = fts5yypParser->fts5yytos->major;\n      if( fts5yymx==fts5YYERRORSYMBOL || fts5yyerrorhit ){\n#ifndef NDEBUG\n        if( fts5yyTraceFILE ){\n          fprintf(fts5yyTraceFILE,\"%sDiscard input token %s\\n\",\n             fts5yyTracePrompt,fts5yyTokenName[fts5yymajor]);\n        }\n#endif\n        fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion);\n        fts5yymajor = fts5YYNOCODE;\n      }else{\n        while( fts5yypParser->fts5yytos >= fts5yypParser->fts5yystack\n            && fts5yymx != fts5YYERRORSYMBOL\n            && (fts5yyact = fts5yy_find_reduce_action(\n                        fts5yypParser->fts5yytos->stateno,\n                        fts5YYERRORSYMBOL)) >= fts5YY_MIN_REDUCE\n        ){\n          fts5yy_pop_parser_stack(fts5yypParser);\n        }\n        if( fts5yypParser->fts5yytos < fts5yypParser->fts5yystack || fts5yymajor==0 ){\n          fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion);\n          fts5yy_parse_failed(fts5yypParser);\n#ifndef fts5YYNOERRORRECOVERY\n          fts5yypParser->fts5yyerrcnt = -1;\n#endif\n          fts5yymajor = fts5YYNOCODE;\n        }else if( fts5yymx!=fts5YYERRORSYMBOL ){\n          fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor);\n        }\n      }\n      fts5yypParser->fts5yyerrcnt = 3;\n      fts5yyerrorhit = 1;\n#elif defined(fts5YYNOERRORRECOVERY)\n      /* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to\n      ** do any kind of error recovery.  Instead, simply invoke the syntax\n      ** error routine and continue going as if nothing had happened.\n      **\n      ** Applications can set this macro (for example inside %include) if\n      ** they intend to abandon the parse upon the first syntax error seen.\n      */\n      fts5yy_syntax_error(fts5yypParser,fts5yymajor, fts5yyminor);\n      fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion);\n      fts5yymajor = fts5YYNOCODE;\n      \n#else  /* fts5YYERRORSYMBOL is not defined */\n      /* This is what we do if the grammar does not define ERROR:\n      **\n      **  * Report an error message, and throw away the input token.\n      **\n      **  * If the input token is $, then fail the parse.\n      **\n      ** As before, subsequent error messages are suppressed until\n      ** three input tokens have been successfully shifted.\n      */\n      if( fts5yypParser->fts5yyerrcnt<=0 ){\n        fts5yy_syntax_error(fts5yypParser,fts5yymajor, fts5yyminor);\n      }\n      fts5yypParser->fts5yyerrcnt = 3;\n      fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion);\n      if( fts5yyendofinput ){\n        fts5yy_parse_failed(fts5yypParser);\n#ifndef fts5YYNOERRORRECOVERY\n        fts5yypParser->fts5yyerrcnt = -1;\n#endif\n      }\n      fts5yymajor = fts5YYNOCODE;\n#endif\n    }\n  }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );\n#ifndef NDEBUG\n  if( fts5yyTraceFILE ){\n    fts5yyStackEntry *i;\n    char cDiv = '[';\n    fprintf(fts5yyTraceFILE,\"%sReturn. Stack=\",fts5yyTracePrompt);\n    for(i=&fts5yypParser->fts5yystack[1]; i<=fts5yypParser->fts5yytos; i++){\n      fprintf(fts5yyTraceFILE,\"%c%s\", cDiv, fts5yyTokenName[i->major]);\n      cDiv = ' ';\n    }\n    fprintf(fts5yyTraceFILE,\"]\\n\");\n  }\n#endif\n  return;\n}\n\n#line 1 \"fts5_aux.c\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n*/\n\n\n/* #include \"fts5Int.h\" */\n#include <math.h>                 /* amalgamator: keep */\n\n/*\n** Object used to iterate through all \"coalesced phrase instances\" in \n** a single column of the current row. If the phrase instances in the\n** column being considered do not overlap, this object simply iterates\n** through them. Or, if they do overlap (share one or more tokens in\n** common), each set of overlapping instances is treated as a single\n** match. See documentation for the highlight() auxiliary function for\n** details.\n**\n** Usage is:\n**\n**   for(rc = fts5CInstIterNext(pApi, pFts, iCol, &iter);\n**      (rc==SQLITE_OK && 0==fts5CInstIterEof(&iter);\n**      rc = fts5CInstIterNext(&iter)\n**   ){\n**     printf(\"instance starts at %d, ends at %d\\n\", iter.iStart, iter.iEnd);\n**   }\n**\n*/\ntypedef struct CInstIter CInstIter;\nstruct CInstIter {\n  const Fts5ExtensionApi *pApi;   /* API offered by current FTS version */\n  Fts5Context *pFts;              /* First arg to pass to pApi functions */\n  int iCol;                       /* Column to search */\n  int iInst;                      /* Next phrase instance index */\n  int nInst;                      /* Total number of phrase instances */\n\n  /* Output variables */\n  int iStart;                     /* First token in coalesced phrase instance */\n  int iEnd;                       /* Last token in coalesced phrase instance */\n};\n\n/*\n** Advance the iterator to the next coalesced phrase instance. Return\n** an SQLite error code if an error occurs, or SQLITE_OK otherwise.\n*/\nstatic int fts5CInstIterNext(CInstIter *pIter){\n  int rc = SQLITE_OK;\n  pIter->iStart = -1;\n  pIter->iEnd = -1;\n\n  while( rc==SQLITE_OK && pIter->iInst<pIter->nInst ){\n    int ip; int ic; int io;\n    rc = pIter->pApi->xInst(pIter->pFts, pIter->iInst, &ip, &ic, &io);\n    if( rc==SQLITE_OK ){\n      if( ic==pIter->iCol ){\n        int iEnd = io - 1 + pIter->pApi->xPhraseSize(pIter->pFts, ip);\n        if( pIter->iStart<0 ){\n          pIter->iStart = io;\n          pIter->iEnd = iEnd;\n        }else if( io<=pIter->iEnd ){\n          if( iEnd>pIter->iEnd ) pIter->iEnd = iEnd;\n        }else{\n          break;\n        }\n      }\n      pIter->iInst++;\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Initialize the iterator object indicated by the final parameter to \n** iterate through coalesced phrase instances in column iCol.\n*/\nstatic int fts5CInstIterInit(\n  const Fts5ExtensionApi *pApi,\n  Fts5Context *pFts,\n  int iCol,\n  CInstIter *pIter\n){\n  int rc;\n\n  memset(pIter, 0, sizeof(CInstIter));\n  pIter->pApi = pApi;\n  pIter->pFts = pFts;\n  pIter->iCol = iCol;\n  rc = pApi->xInstCount(pFts, &pIter->nInst);\n\n  if( rc==SQLITE_OK ){\n    rc = fts5CInstIterNext(pIter);\n  }\n\n  return rc;\n}\n\n\n\n/*************************************************************************\n** Start of highlight() implementation.\n*/\ntypedef struct HighlightContext HighlightContext;\nstruct HighlightContext {\n  CInstIter iter;                 /* Coalesced Instance Iterator */\n  int iPos;                       /* Current token offset in zIn[] */\n  int iRangeStart;                /* First token to include */\n  int iRangeEnd;                  /* If non-zero, last token to include */\n  const char *zOpen;              /* Opening highlight */\n  const char *zClose;             /* Closing highlight */\n  const char *zIn;                /* Input text */\n  int nIn;                        /* Size of input text in bytes */\n  int iOff;                       /* Current offset within zIn[] */\n  char *zOut;                     /* Output value */\n};\n\n/*\n** Append text to the HighlightContext output string - p->zOut. Argument\n** z points to a buffer containing n bytes of text to append. If n is \n** negative, everything up until the first '\\0' is appended to the output.\n**\n** If *pRc is set to any value other than SQLITE_OK when this function is \n** called, it is a no-op. If an error (i.e. an OOM condition) is encountered, \n** *pRc is set to an error code before returning. \n*/\nstatic void fts5HighlightAppend(\n  int *pRc, \n  HighlightContext *p, \n  const char *z, int n\n){\n  if( *pRc==SQLITE_OK ){\n    if( n<0 ) n = (int)strlen(z);\n    p->zOut = sqlite3_mprintf(\"%z%.*s\", p->zOut, n, z);\n    if( p->zOut==0 ) *pRc = SQLITE_NOMEM;\n  }\n}\n\n/*\n** Tokenizer callback used by implementation of highlight() function.\n*/\nstatic int fts5HighlightCb(\n  void *pContext,                 /* Pointer to HighlightContext object */\n  int tflags,                     /* Mask of FTS5_TOKEN_* flags */\n  const char *pToken,             /* Buffer containing token */\n  int nToken,                     /* Size of token in bytes */\n  int iStartOff,                  /* Start offset of token */\n  int iEndOff                     /* End offset of token */\n){\n  HighlightContext *p = (HighlightContext*)pContext;\n  int rc = SQLITE_OK;\n  int iPos;\n\n  UNUSED_PARAM2(pToken, nToken);\n\n  if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;\n  iPos = p->iPos++;\n\n  if( p->iRangeEnd>0 ){\n    if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;\n    if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;\n  }\n\n  if( iPos==p->iter.iStart ){\n    fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iStartOff - p->iOff);\n    fts5HighlightAppend(&rc, p, p->zOpen, -1);\n    p->iOff = iStartOff;\n  }\n\n  if( iPos==p->iter.iEnd ){\n    if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){\n      fts5HighlightAppend(&rc, p, p->zOpen, -1);\n    }\n    fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);\n    fts5HighlightAppend(&rc, p, p->zClose, -1);\n    p->iOff = iEndOff;\n    if( rc==SQLITE_OK ){\n      rc = fts5CInstIterNext(&p->iter);\n    }\n  }\n\n  if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){\n    fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);\n    p->iOff = iEndOff;\n    if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){\n      fts5HighlightAppend(&rc, p, p->zClose, -1);\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Implementation of highlight() function.\n*/\nstatic void fts5HighlightFunction(\n  const Fts5ExtensionApi *pApi,   /* API offered by current FTS version */\n  Fts5Context *pFts,              /* First arg to pass to pApi functions */\n  sqlite3_context *pCtx,          /* Context for returning result/error */\n  int nVal,                       /* Number of values in apVal[] array */\n  sqlite3_value **apVal           /* Array of trailing arguments */\n){\n  HighlightContext ctx;\n  int rc;\n  int iCol;\n\n  if( nVal!=3 ){\n    const char *zErr = \"wrong number of arguments to function highlight()\";\n    sqlite3_result_error(pCtx, zErr, -1);\n    return;\n  }\n\n  iCol = sqlite3_value_int(apVal[0]);\n  memset(&ctx, 0, sizeof(HighlightContext));\n  ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);\n  ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);\n  rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);\n\n  if( ctx.zIn ){\n    if( rc==SQLITE_OK ){\n      rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);\n    }\n\n    if( rc==SQLITE_OK ){\n      rc = pApi->xTokenize(pFts, ctx.zIn, ctx.nIn, (void*)&ctx,fts5HighlightCb);\n    }\n    fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff);\n\n    if( rc==SQLITE_OK ){\n      sqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT);\n    }\n    sqlite3_free(ctx.zOut);\n  }\n  if( rc!=SQLITE_OK ){\n    sqlite3_result_error_code(pCtx, rc);\n  }\n}\n/*\n** End of highlight() implementation.\n**************************************************************************/\n\n/*\n** Context object passed to the fts5SentenceFinderCb() function.\n*/\ntypedef struct Fts5SFinder Fts5SFinder;\nstruct Fts5SFinder {\n  int iPos;                       /* Current token position */\n  int nFirstAlloc;                /* Allocated size of aFirst[] */\n  int nFirst;                     /* Number of entries in aFirst[] */\n  int *aFirst;                    /* Array of first token in each sentence */\n  const char *zDoc;               /* Document being tokenized */\n};\n\n/*\n** Add an entry to the Fts5SFinder.aFirst[] array. Grow the array if\n** necessary. Return SQLITE_OK if successful, or SQLITE_NOMEM if an\n** error occurs.\n*/\nstatic int fts5SentenceFinderAdd(Fts5SFinder *p, int iAdd){\n  if( p->nFirstAlloc==p->nFirst ){\n    int nNew = p->nFirstAlloc ? p->nFirstAlloc*2 : 64;\n    int *aNew;\n\n    aNew = (int*)sqlite3_realloc(p->aFirst, nNew*sizeof(int));\n    if( aNew==0 ) return SQLITE_NOMEM;\n    p->aFirst = aNew;\n    p->nFirstAlloc = nNew;\n  }\n  p->aFirst[p->nFirst++] = iAdd;\n  return SQLITE_OK;\n}\n\n/*\n** This function is an xTokenize() callback used by the auxiliary snippet()\n** function. Its job is to identify tokens that are the first in a sentence.\n** For each such token, an entry is added to the SFinder.aFirst[] array.\n*/\nstatic int fts5SentenceFinderCb(\n  void *pContext,                 /* Pointer to HighlightContext object */\n  int tflags,                     /* Mask of FTS5_TOKEN_* flags */\n  const char *pToken,             /* Buffer containing token */\n  int nToken,                     /* Size of token in bytes */\n  int iStartOff,                  /* Start offset of token */\n  int iEndOff                     /* End offset of token */\n){\n  int rc = SQLITE_OK;\n\n  UNUSED_PARAM2(pToken, nToken);\n  UNUSED_PARAM(iEndOff);\n\n  if( (tflags & FTS5_TOKEN_COLOCATED)==0 ){\n    Fts5SFinder *p = (Fts5SFinder*)pContext;\n    if( p->iPos>0 ){\n      int i;\n      char c = 0;\n      for(i=iStartOff-1; i>=0; i--){\n        c = p->zDoc[i];\n        if( c!=' ' && c!='\\t' && c!='\\n' && c!='\\r' ) break;\n      }\n      if( i!=iStartOff-1 && (c=='.' || c==':') ){\n        rc = fts5SentenceFinderAdd(p, p->iPos);\n      }\n    }else{\n      rc = fts5SentenceFinderAdd(p, 0);\n    }\n    p->iPos++;\n  }\n  return rc;\n}\n\nstatic int fts5SnippetScore(\n  const Fts5ExtensionApi *pApi,   /* API offered by current FTS version */\n  Fts5Context *pFts,              /* First arg to pass to pApi functions */\n  int nDocsize,                   /* Size of column in tokens */\n  unsigned char *aSeen,           /* Array with one element per query phrase */\n  int iCol,                       /* Column to score */\n  int iPos,                       /* Starting offset to score */\n  int nToken,                     /* Max tokens per snippet */\n  int *pnScore,                   /* OUT: Score */\n  int *piPos                      /* OUT: Adjusted offset */\n){\n  int rc;\n  int i;\n  int ip = 0;\n  int ic = 0;\n  int iOff = 0;\n  int iFirst = -1;\n  int nInst;\n  int nScore = 0;\n  int iLast = 0;\n\n  rc = pApi->xInstCount(pFts, &nInst);\n  for(i=0; i<nInst && rc==SQLITE_OK; i++){\n    rc = pApi->xInst(pFts, i, &ip, &ic, &iOff);\n    if( rc==SQLITE_OK && ic==iCol && iOff>=iPos && iOff<(iPos+nToken) ){\n      nScore += (aSeen[ip] ? 1 : 1000);\n      aSeen[ip] = 1;\n      if( iFirst<0 ) iFirst = iOff;\n      iLast = iOff + pApi->xPhraseSize(pFts, ip);\n    }\n  }\n\n  *pnScore = nScore;\n  if( piPos ){\n    int iAdj = iFirst - (nToken - (iLast-iFirst)) / 2;\n    if( (iAdj+nToken)>nDocsize ) iAdj = nDocsize - nToken;\n    if( iAdj<0 ) iAdj = 0;\n    *piPos = iAdj;\n  }\n\n  return rc;\n}\n\n/*\n** Implementation of snippet() function.\n*/\nstatic void fts5SnippetFunction(\n  const Fts5ExtensionApi *pApi,   /* API offered by current FTS version */\n  Fts5Context *pFts,              /* First arg to pass to pApi functions */\n  sqlite3_context *pCtx,          /* Context for returning result/error */\n  int nVal,                       /* Number of values in apVal[] array */\n  sqlite3_value **apVal           /* Array of trailing arguments */\n){\n  HighlightContext ctx;\n  int rc = SQLITE_OK;             /* Return code */\n  int iCol;                       /* 1st argument to snippet() */\n  const char *zEllips;            /* 4th argument to snippet() */\n  int nToken;                     /* 5th argument to snippet() */\n  int nInst = 0;                  /* Number of instance matches this row */\n  int i;                          /* Used to iterate through instances */\n  int nPhrase;                    /* Number of phrases in query */\n  unsigned char *aSeen;           /* Array of \"seen instance\" flags */\n  int iBestCol;                   /* Column containing best snippet */\n  int iBestStart = 0;             /* First token of best snippet */\n  int nBestScore = 0;             /* Score of best snippet */\n  int nColSize = 0;               /* Total size of iBestCol in tokens */\n  Fts5SFinder sFinder;            /* Used to find the beginnings of sentences */\n  int nCol;\n\n  if( nVal!=5 ){\n    const char *zErr = \"wrong number of arguments to function snippet()\";\n    sqlite3_result_error(pCtx, zErr, -1);\n    return;\n  }\n\n  nCol = pApi->xColumnCount(pFts);\n  memset(&ctx, 0, sizeof(HighlightContext));\n  iCol = sqlite3_value_int(apVal[0]);\n  ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);\n  ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);\n  zEllips = (const char*)sqlite3_value_text(apVal[3]);\n  nToken = sqlite3_value_int(apVal[4]);\n\n  iBestCol = (iCol>=0 ? iCol : 0);\n  nPhrase = pApi->xPhraseCount(pFts);\n  aSeen = sqlite3_malloc(nPhrase);\n  if( aSeen==0 ){\n    rc = SQLITE_NOMEM;\n  }\n  if( rc==SQLITE_OK ){\n    rc = pApi->xInstCount(pFts, &nInst);\n  }\n\n  memset(&sFinder, 0, sizeof(Fts5SFinder));\n  for(i=0; i<nCol; i++){\n    if( iCol<0 || iCol==i ){\n      int nDoc;\n      int nDocsize;\n      int ii;\n      sFinder.iPos = 0;\n      sFinder.nFirst = 0;\n      rc = pApi->xColumnText(pFts, i, &sFinder.zDoc, &nDoc);\n      if( rc!=SQLITE_OK ) break;\n      rc = pApi->xTokenize(pFts, \n          sFinder.zDoc, nDoc, (void*)&sFinder,fts5SentenceFinderCb\n      );\n      if( rc!=SQLITE_OK ) break;\n      rc = pApi->xColumnSize(pFts, i, &nDocsize);\n      if( rc!=SQLITE_OK ) break;\n\n      for(ii=0; rc==SQLITE_OK && ii<nInst; ii++){\n        int ip, ic, io;\n        int iAdj;\n        int nScore;\n        int jj;\n\n        rc = pApi->xInst(pFts, ii, &ip, &ic, &io);\n        if( ic!=i || rc!=SQLITE_OK ) continue;\n        memset(aSeen, 0, nPhrase);\n        rc = fts5SnippetScore(pApi, pFts, nDocsize, aSeen, i,\n            io, nToken, &nScore, &iAdj\n        );\n        if( rc==SQLITE_OK && nScore>nBestScore ){\n          nBestScore = nScore;\n          iBestCol = i;\n          iBestStart = iAdj;\n          nColSize = nDocsize;\n        }\n\n        if( rc==SQLITE_OK && sFinder.nFirst && nDocsize>nToken ){\n          for(jj=0; jj<(sFinder.nFirst-1); jj++){\n            if( sFinder.aFirst[jj+1]>io ) break;\n          }\n\n          if( sFinder.aFirst[jj]<io ){\n            memset(aSeen, 0, nPhrase);\n            rc = fts5SnippetScore(pApi, pFts, nDocsize, aSeen, i, \n              sFinder.aFirst[jj], nToken, &nScore, 0\n            );\n\n            nScore += (sFinder.aFirst[jj]==0 ? 120 : 100);\n            if( rc==SQLITE_OK && nScore>nBestScore ){\n              nBestScore = nScore;\n              iBestCol = i;\n              iBestStart = sFinder.aFirst[jj];\n              nColSize = nDocsize;\n            }\n          }\n        }\n      }\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = pApi->xColumnText(pFts, iBestCol, &ctx.zIn, &ctx.nIn);\n  }\n  if( rc==SQLITE_OK && nColSize==0 ){\n    rc = pApi->xColumnSize(pFts, iBestCol, &nColSize);\n  }\n  if( ctx.zIn ){\n    if( rc==SQLITE_OK ){\n      rc = fts5CInstIterInit(pApi, pFts, iBestCol, &ctx.iter);\n    }\n\n    ctx.iRangeStart = iBestStart;\n    ctx.iRangeEnd = iBestStart + nToken - 1;\n\n    if( iBestStart>0 ){\n      fts5HighlightAppend(&rc, &ctx, zEllips, -1);\n    }\n\n    /* Advance iterator ctx.iter so that it points to the first coalesced\n    ** phrase instance at or following position iBestStart. */\n    while( ctx.iter.iStart>=0 && ctx.iter.iStart<iBestStart && rc==SQLITE_OK ){\n      rc = fts5CInstIterNext(&ctx.iter);\n    }\n\n    if( rc==SQLITE_OK ){\n      rc = pApi->xTokenize(pFts, ctx.zIn, ctx.nIn, (void*)&ctx,fts5HighlightCb);\n    }\n    if( ctx.iRangeEnd>=(nColSize-1) ){\n      fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff);\n    }else{\n      fts5HighlightAppend(&rc, &ctx, zEllips, -1);\n    }\n  }\n  if( rc==SQLITE_OK ){\n    sqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT);\n  }else{\n    sqlite3_result_error_code(pCtx, rc);\n  }\n  sqlite3_free(ctx.zOut);\n  sqlite3_free(aSeen);\n  sqlite3_free(sFinder.aFirst);\n}\n\n/************************************************************************/\n\n/*\n** The first time the bm25() function is called for a query, an instance\n** of the following structure is allocated and populated.\n*/\ntypedef struct Fts5Bm25Data Fts5Bm25Data;\nstruct Fts5Bm25Data {\n  int nPhrase;                    /* Number of phrases in query */\n  double avgdl;                   /* Average number of tokens in each row */\n  double *aIDF;                   /* IDF for each phrase */\n  double *aFreq;                  /* Array used to calculate phrase freq. */\n};\n\n/*\n** Callback used by fts5Bm25GetData() to count the number of rows in the\n** table matched by each individual phrase within the query.\n*/\nstatic int fts5CountCb(\n  const Fts5ExtensionApi *pApi, \n  Fts5Context *pFts,\n  void *pUserData                 /* Pointer to sqlite3_int64 variable */\n){\n  sqlite3_int64 *pn = (sqlite3_int64*)pUserData;\n  UNUSED_PARAM2(pApi, pFts);\n  (*pn)++;\n  return SQLITE_OK;\n}\n\n/*\n** Set *ppData to point to the Fts5Bm25Data object for the current query. \n** If the object has not already been allocated, allocate and populate it\n** now.\n*/\nstatic int fts5Bm25GetData(\n  const Fts5ExtensionApi *pApi, \n  Fts5Context *pFts,\n  Fts5Bm25Data **ppData           /* OUT: bm25-data object for this query */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  Fts5Bm25Data *p;                /* Object to return */\n\n  p = pApi->xGetAuxdata(pFts, 0);\n  if( p==0 ){\n    int nPhrase;                  /* Number of phrases in query */\n    sqlite3_int64 nRow = 0;       /* Number of rows in table */\n    sqlite3_int64 nToken = 0;     /* Number of tokens in table */\n    int nByte;                    /* Bytes of space to allocate */\n    int i;\n\n    /* Allocate the Fts5Bm25Data object */\n    nPhrase = pApi->xPhraseCount(pFts);\n    nByte = sizeof(Fts5Bm25Data) + nPhrase*2*sizeof(double);\n    p = (Fts5Bm25Data*)sqlite3_malloc(nByte);\n    if( p==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      memset(p, 0, nByte);\n      p->nPhrase = nPhrase;\n      p->aIDF = (double*)&p[1];\n      p->aFreq = &p->aIDF[nPhrase];\n    }\n\n    /* Calculate the average document length for this FTS5 table */\n    if( rc==SQLITE_OK ) rc = pApi->xRowCount(pFts, &nRow);\n    if( rc==SQLITE_OK ) rc = pApi->xColumnTotalSize(pFts, -1, &nToken);\n    if( rc==SQLITE_OK ) p->avgdl = (double)nToken  / (double)nRow;\n\n    /* Calculate an IDF for each phrase in the query */\n    for(i=0; rc==SQLITE_OK && i<nPhrase; i++){\n      sqlite3_int64 nHit = 0;\n      rc = pApi->xQueryPhrase(pFts, i, (void*)&nHit, fts5CountCb);\n      if( rc==SQLITE_OK ){\n        /* Calculate the IDF (Inverse Document Frequency) for phrase i.\n        ** This is done using the standard BM25 formula as found on wikipedia:\n        **\n        **   IDF = log( (N - nHit + 0.5) / (nHit + 0.5) )\n        **\n        ** where \"N\" is the total number of documents in the set and nHit\n        ** is the number that contain at least one instance of the phrase\n        ** under consideration.\n        **\n        ** The problem with this is that if (N < 2*nHit), the IDF is \n        ** negative. Which is undesirable. So the mimimum allowable IDF is\n        ** (1e-6) - roughly the same as a term that appears in just over\n        ** half of set of 5,000,000 documents.  */\n        double idf = log( (nRow - nHit + 0.5) / (nHit + 0.5) );\n        if( idf<=0.0 ) idf = 1e-6;\n        p->aIDF[i] = idf;\n      }\n    }\n\n    if( rc!=SQLITE_OK ){\n      sqlite3_free(p);\n    }else{\n      rc = pApi->xSetAuxdata(pFts, p, sqlite3_free);\n    }\n    if( rc!=SQLITE_OK ) p = 0;\n  }\n  *ppData = p;\n  return rc;\n}\n\n/*\n** Implementation of bm25() function.\n*/\nstatic void fts5Bm25Function(\n  const Fts5ExtensionApi *pApi,   /* API offered by current FTS version */\n  Fts5Context *pFts,              /* First arg to pass to pApi functions */\n  sqlite3_context *pCtx,          /* Context for returning result/error */\n  int nVal,                       /* Number of values in apVal[] array */\n  sqlite3_value **apVal           /* Array of trailing arguments */\n){\n  const double k1 = 1.2;          /* Constant \"k1\" from BM25 formula */\n  const double b = 0.75;          /* Constant \"b\" from BM25 formula */\n  int rc = SQLITE_OK;             /* Error code */\n  double score = 0.0;             /* SQL function return value */\n  Fts5Bm25Data *pData;            /* Values allocated/calculated once only */\n  int i;                          /* Iterator variable */\n  int nInst = 0;                  /* Value returned by xInstCount() */\n  double D = 0.0;                 /* Total number of tokens in row */\n  double *aFreq = 0;              /* Array of phrase freq. for current row */\n\n  /* Calculate the phrase frequency (symbol \"f(qi,D)\" in the documentation)\n  ** for each phrase in the query for the current row. */\n  rc = fts5Bm25GetData(pApi, pFts, &pData);\n  if( rc==SQLITE_OK ){\n    aFreq = pData->aFreq;\n    memset(aFreq, 0, sizeof(double) * pData->nPhrase);\n    rc = pApi->xInstCount(pFts, &nInst);\n  }\n  for(i=0; rc==SQLITE_OK && i<nInst; i++){\n    int ip; int ic; int io;\n    rc = pApi->xInst(pFts, i, &ip, &ic, &io);\n    if( rc==SQLITE_OK ){\n      double w = (nVal > ic) ? sqlite3_value_double(apVal[ic]) : 1.0;\n      aFreq[ip] += w;\n    }\n  }\n\n  /* Figure out the total size of the current row in tokens. */\n  if( rc==SQLITE_OK ){\n    int nTok;\n    rc = pApi->xColumnSize(pFts, -1, &nTok);\n    D = (double)nTok;\n  }\n\n  /* Determine the BM25 score for the current row. */\n  for(i=0; rc==SQLITE_OK && i<pData->nPhrase; i++){\n    score += pData->aIDF[i] * (\n      ( aFreq[i] * (k1 + 1.0) ) / \n      ( aFreq[i] + k1 * (1 - b + b * D / pData->avgdl) )\n    );\n  }\n  \n  /* If no error has occurred, return the calculated score. Otherwise,\n  ** throw an SQL exception.  */\n  if( rc==SQLITE_OK ){\n    sqlite3_result_double(pCtx, -1.0 * score);\n  }else{\n    sqlite3_result_error_code(pCtx, rc);\n  }\n}\n\nstatic int sqlite3Fts5AuxInit(fts5_api *pApi){\n  struct Builtin {\n    const char *zFunc;            /* Function name (nul-terminated) */\n    void *pUserData;              /* User-data pointer */\n    fts5_extension_function xFunc;/* Callback function */\n    void (*xDestroy)(void*);      /* Destructor function */\n  } aBuiltin [] = {\n    { \"snippet\",   0, fts5SnippetFunction, 0 },\n    { \"highlight\", 0, fts5HighlightFunction, 0 },\n    { \"bm25\",      0, fts5Bm25Function,    0 },\n  };\n  int rc = SQLITE_OK;             /* Return code */\n  int i;                          /* To iterate through builtin functions */\n\n  for(i=0; rc==SQLITE_OK && i<ArraySize(aBuiltin); i++){\n    rc = pApi->xCreateFunction(pApi,\n        aBuiltin[i].zFunc,\n        aBuiltin[i].pUserData,\n        aBuiltin[i].xFunc,\n        aBuiltin[i].xDestroy\n    );\n  }\n\n  return rc;\n}\n\n\n\n#line 1 \"fts5_buffer.c\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n*/\n\n\n\n/* #include \"fts5Int.h\" */\n\nstatic int sqlite3Fts5BufferSize(int *pRc, Fts5Buffer *pBuf, u32 nByte){\n  if( (u32)pBuf->nSpace<nByte ){\n    u32 nNew = pBuf->nSpace ? pBuf->nSpace : 64;\n    u8 *pNew;\n    while( nNew<nByte ){\n      nNew = nNew * 2;\n    }\n    pNew = sqlite3_realloc(pBuf->p, nNew);\n    if( pNew==0 ){\n      *pRc = SQLITE_NOMEM;\n      return 1;\n    }else{\n      pBuf->nSpace = nNew;\n      pBuf->p = pNew;\n    }\n  }\n  return 0;\n}\n\n\n/*\n** Encode value iVal as an SQLite varint and append it to the buffer object\n** pBuf. If an OOM error occurs, set the error code in p.\n*/\nstatic void sqlite3Fts5BufferAppendVarint(int *pRc, Fts5Buffer *pBuf, i64 iVal){\n  if( fts5BufferGrow(pRc, pBuf, 9) ) return;\n  pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iVal);\n}\n\nstatic void sqlite3Fts5Put32(u8 *aBuf, int iVal){\n  aBuf[0] = (iVal>>24) & 0x00FF;\n  aBuf[1] = (iVal>>16) & 0x00FF;\n  aBuf[2] = (iVal>> 8) & 0x00FF;\n  aBuf[3] = (iVal>> 0) & 0x00FF;\n}\n\nstatic int sqlite3Fts5Get32(const u8 *aBuf){\n  return (aBuf[0] << 24) + (aBuf[1] << 16) + (aBuf[2] << 8) + aBuf[3];\n}\n\n/*\n** Append buffer nData/pData to buffer pBuf. If an OOM error occurs, set \n** the error code in p. If an error has already occurred when this function\n** is called, it is a no-op.\n*/\nstatic void sqlite3Fts5BufferAppendBlob(\n  int *pRc,\n  Fts5Buffer *pBuf, \n  u32 nData, \n  const u8 *pData\n){\n  assert_nc( *pRc || nData>=0 );\n  if( fts5BufferGrow(pRc, pBuf, nData) ) return;\n  memcpy(&pBuf->p[pBuf->n], pData, nData);\n  pBuf->n += nData;\n}\n\n/*\n** Append the nul-terminated string zStr to the buffer pBuf. This function\n** ensures that the byte following the buffer data is set to 0x00, even \n** though this byte is not included in the pBuf->n count.\n*/\nstatic void sqlite3Fts5BufferAppendString(\n  int *pRc,\n  Fts5Buffer *pBuf, \n  const char *zStr\n){\n  int nStr = (int)strlen(zStr);\n  sqlite3Fts5BufferAppendBlob(pRc, pBuf, nStr+1, (const u8*)zStr);\n  pBuf->n--;\n}\n\n/*\n** Argument zFmt is a printf() style format string. This function performs\n** the printf() style processing, then appends the results to buffer pBuf.\n**\n** Like sqlite3Fts5BufferAppendString(), this function ensures that the byte \n** following the buffer data is set to 0x00, even though this byte is not\n** included in the pBuf->n count.\n*/ \nstatic void sqlite3Fts5BufferAppendPrintf(\n  int *pRc,\n  Fts5Buffer *pBuf, \n  char *zFmt, ...\n){\n  if( *pRc==SQLITE_OK ){\n    char *zTmp;\n    va_list ap;\n    va_start(ap, zFmt);\n    zTmp = sqlite3_vmprintf(zFmt, ap);\n    va_end(ap);\n\n    if( zTmp==0 ){\n      *pRc = SQLITE_NOMEM;\n    }else{\n      sqlite3Fts5BufferAppendString(pRc, pBuf, zTmp);\n      sqlite3_free(zTmp);\n    }\n  }\n}\n\nstatic char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...){\n  char *zRet = 0;\n  if( *pRc==SQLITE_OK ){\n    va_list ap;\n    va_start(ap, zFmt);\n    zRet = sqlite3_vmprintf(zFmt, ap);\n    va_end(ap);\n    if( zRet==0 ){\n      *pRc = SQLITE_NOMEM; \n    }\n  }\n  return zRet;\n}\n \n\n/*\n** Free any buffer allocated by pBuf. Zero the structure before returning.\n*/\nstatic void sqlite3Fts5BufferFree(Fts5Buffer *pBuf){\n  sqlite3_free(pBuf->p);\n  memset(pBuf, 0, sizeof(Fts5Buffer));\n}\n\n/*\n** Zero the contents of the buffer object. But do not free the associated \n** memory allocation.\n*/\nstatic void sqlite3Fts5BufferZero(Fts5Buffer *pBuf){\n  pBuf->n = 0;\n}\n\n/*\n** Set the buffer to contain nData/pData. If an OOM error occurs, leave an\n** the error code in p. If an error has already occurred when this function\n** is called, it is a no-op.\n*/\nstatic void sqlite3Fts5BufferSet(\n  int *pRc,\n  Fts5Buffer *pBuf, \n  int nData, \n  const u8 *pData\n){\n  pBuf->n = 0;\n  sqlite3Fts5BufferAppendBlob(pRc, pBuf, nData, pData);\n}\n\nstatic int sqlite3Fts5PoslistNext64(\n  const u8 *a, int n,             /* Buffer containing poslist */\n  int *pi,                        /* IN/OUT: Offset within a[] */\n  i64 *piOff                      /* IN/OUT: Current offset */\n){\n  int i = *pi;\n  if( i>=n ){\n    /* EOF */\n    *piOff = -1;\n    return 1;  \n  }else{\n    i64 iOff = *piOff;\n    int iVal;\n    fts5FastGetVarint32(a, i, iVal);\n    if( iVal==1 ){\n      fts5FastGetVarint32(a, i, iVal);\n      iOff = ((i64)iVal) << 32;\n      fts5FastGetVarint32(a, i, iVal);\n    }\n    *piOff = iOff + (iVal-2);\n    *pi = i;\n    return 0;\n  }\n}\n\n\n/*\n** Advance the iterator object passed as the only argument. Return true\n** if the iterator reaches EOF, or false otherwise.\n*/\nstatic int sqlite3Fts5PoslistReaderNext(Fts5PoslistReader *pIter){\n  if( sqlite3Fts5PoslistNext64(pIter->a, pIter->n, &pIter->i, &pIter->iPos) ){\n    pIter->bEof = 1;\n  }\n  return pIter->bEof;\n}\n\nstatic int sqlite3Fts5PoslistReaderInit(\n  const u8 *a, int n,             /* Poslist buffer to iterate through */\n  Fts5PoslistReader *pIter        /* Iterator object to initialize */\n){\n  memset(pIter, 0, sizeof(*pIter));\n  pIter->a = a;\n  pIter->n = n;\n  sqlite3Fts5PoslistReaderNext(pIter);\n  return pIter->bEof;\n}\n\n/*\n** Append position iPos to the position list being accumulated in buffer\n** pBuf, which must be already be large enough to hold the new data.\n** The previous position written to this list is *piPrev. *piPrev is set\n** to iPos before returning.\n*/\nstatic void sqlite3Fts5PoslistSafeAppend(\n  Fts5Buffer *pBuf, \n  i64 *piPrev, \n  i64 iPos\n){\n  static const i64 colmask = ((i64)(0x7FFFFFFF)) << 32;\n  if( (iPos & colmask) != (*piPrev & colmask) ){\n    pBuf->p[pBuf->n++] = 1;\n    pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos>>32));\n    *piPrev = (iPos & colmask);\n  }\n  pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], (iPos-*piPrev)+2);\n  *piPrev = iPos;\n}\n\nstatic int sqlite3Fts5PoslistWriterAppend(\n  Fts5Buffer *pBuf, \n  Fts5PoslistWriter *pWriter,\n  i64 iPos\n){\n  int rc = 0;   /* Initialized only to suppress erroneous warning from Clang */\n  if( fts5BufferGrow(&rc, pBuf, 5+5+5) ) return rc;\n  sqlite3Fts5PoslistSafeAppend(pBuf, &pWriter->iPrev, iPos);\n  return SQLITE_OK;\n}\n\nstatic void *sqlite3Fts5MallocZero(int *pRc, int nByte){\n  void *pRet = 0;\n  if( *pRc==SQLITE_OK ){\n    pRet = sqlite3_malloc(nByte);\n    if( pRet==0 && nByte>0 ){\n      *pRc = SQLITE_NOMEM;\n    }else{\n      memset(pRet, 0, nByte);\n    }\n  }\n  return pRet;\n}\n\n/*\n** Return a nul-terminated copy of the string indicated by pIn. If nIn\n** is non-negative, then it is the length of the string in bytes. Otherwise,\n** the length of the string is determined using strlen().\n**\n** It is the responsibility of the caller to eventually free the returned\n** buffer using sqlite3_free(). If an OOM error occurs, NULL is returned. \n*/\nstatic char *sqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn){\n  char *zRet = 0;\n  if( *pRc==SQLITE_OK ){\n    if( nIn<0 ){\n      nIn = (int)strlen(pIn);\n    }\n    zRet = (char*)sqlite3_malloc(nIn+1);\n    if( zRet ){\n      memcpy(zRet, pIn, nIn);\n      zRet[nIn] = '\\0';\n    }else{\n      *pRc = SQLITE_NOMEM;\n    }\n  }\n  return zRet;\n}\n\n\n/*\n** Return true if character 't' may be part of an FTS5 bareword, or false\n** otherwise. Characters that may be part of barewords:\n**\n**   * All non-ASCII characters,\n**   * The 52 upper and lower case ASCII characters, and\n**   * The 10 integer ASCII characters.\n**   * The underscore character \"_\" (0x5F).\n**   * The unicode \"subsitute\" character (0x1A).\n*/\nstatic int sqlite3Fts5IsBareword(char t){\n  u8 aBareword[128] = {\n    0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0,   /* 0x00 .. 0x0F */\n    0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 1, 0, 0, 0, 0, 0,   /* 0x10 .. 0x1F */\n    0, 0, 0, 0, 0, 0, 0, 0,    0, 0, 0, 0, 0, 0, 0, 0,   /* 0x20 .. 0x2F */\n    1, 1, 1, 1, 1, 1, 1, 1,    1, 1, 0, 0, 0, 0, 0, 0,   /* 0x30 .. 0x3F */\n    0, 1, 1, 1, 1, 1, 1, 1,    1, 1, 1, 1, 1, 1, 1, 1,   /* 0x40 .. 0x4F */\n    1, 1, 1, 1, 1, 1, 1, 1,    1, 1, 1, 0, 0, 0, 0, 1,   /* 0x50 .. 0x5F */\n    0, 1, 1, 1, 1, 1, 1, 1,    1, 1, 1, 1, 1, 1, 1, 1,   /* 0x60 .. 0x6F */\n    1, 1, 1, 1, 1, 1, 1, 1,    1, 1, 1, 0, 0, 0, 0, 0    /* 0x70 .. 0x7F */\n  };\n\n  return (t & 0x80) || aBareword[(int)t];\n}\n\n\n/*************************************************************************\n*/\ntypedef struct Fts5TermsetEntry Fts5TermsetEntry;\nstruct Fts5TermsetEntry {\n  char *pTerm;\n  int nTerm;\n  int iIdx;                       /* Index (main or aPrefix[] entry) */\n  Fts5TermsetEntry *pNext;\n};\n\nstruct Fts5Termset {\n  Fts5TermsetEntry *apHash[512];\n};\n\nstatic int sqlite3Fts5TermsetNew(Fts5Termset **pp){\n  int rc = SQLITE_OK;\n  *pp = sqlite3Fts5MallocZero(&rc, sizeof(Fts5Termset));\n  return rc;\n}\n\nstatic int sqlite3Fts5TermsetAdd(\n  Fts5Termset *p, \n  int iIdx,\n  const char *pTerm, int nTerm, \n  int *pbPresent\n){\n  int rc = SQLITE_OK;\n  *pbPresent = 0;\n  if( p ){\n    int i;\n    u32 hash = 13;\n    Fts5TermsetEntry *pEntry;\n\n    /* Calculate a hash value for this term. This is the same hash checksum\n    ** used by the fts5_hash.c module. This is not important for correct\n    ** operation of the module, but is necessary to ensure that some tests\n    ** designed to produce hash table collisions really do work.  */\n    for(i=nTerm-1; i>=0; i--){\n      hash = (hash << 3) ^ hash ^ pTerm[i];\n    }\n    hash = (hash << 3) ^ hash ^ iIdx;\n    hash = hash % ArraySize(p->apHash);\n\n    for(pEntry=p->apHash[hash]; pEntry; pEntry=pEntry->pNext){\n      if( pEntry->iIdx==iIdx \n          && pEntry->nTerm==nTerm \n          && memcmp(pEntry->pTerm, pTerm, nTerm)==0 \n      ){\n        *pbPresent = 1;\n        break;\n      }\n    }\n\n    if( pEntry==0 ){\n      pEntry = sqlite3Fts5MallocZero(&rc, sizeof(Fts5TermsetEntry) + nTerm);\n      if( pEntry ){\n        pEntry->pTerm = (char*)&pEntry[1];\n        pEntry->nTerm = nTerm;\n        pEntry->iIdx = iIdx;\n        memcpy(pEntry->pTerm, pTerm, nTerm);\n        pEntry->pNext = p->apHash[hash];\n        p->apHash[hash] = pEntry;\n      }\n    }\n  }\n\n  return rc;\n}\n\nstatic void sqlite3Fts5TermsetFree(Fts5Termset *p){\n  if( p ){\n    u32 i;\n    for(i=0; i<ArraySize(p->apHash); i++){\n      Fts5TermsetEntry *pEntry = p->apHash[i];\n      while( pEntry ){\n        Fts5TermsetEntry *pDel = pEntry;\n        pEntry = pEntry->pNext;\n        sqlite3_free(pDel);\n      }\n    }\n    sqlite3_free(p);\n  }\n}\n\n#line 1 \"fts5_config.c\"\n/*\n** 2014 Jun 09\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This is an SQLite module implementing full-text search.\n*/\n\n\n/* #include \"fts5Int.h\" */\n\n#define FTS5_DEFAULT_PAGE_SIZE   4050\n#define FTS5_DEFAULT_AUTOMERGE      4\n#define FTS5_DEFAULT_USERMERGE      4\n#define FTS5_DEFAULT_CRISISMERGE   16\n#define FTS5_DEFAULT_HASHSIZE    (1024*1024)\n\n/* Maximum allowed page size */\n#define FTS5_MAX_PAGE_SIZE (128*1024)\n\nstatic int fts5_iswhitespace(char x){\n  return (x==' ');\n}\n\nstatic int fts5_isopenquote(char x){\n  return (x=='\"' || x=='\\'' || x=='[' || x=='`');\n}\n\n/*\n** Argument pIn points to a character that is part of a nul-terminated \n** string. Return a pointer to the first character following *pIn in \n** the string that is not a white-space character.\n*/\nstatic const char *fts5ConfigSkipWhitespace(const char *pIn){\n  const char *p = pIn;\n  if( p ){\n    while( fts5_iswhitespace(*p) ){ p++; }\n  }\n  return p;\n}\n\n/*\n** Argument pIn points to a character that is part of a nul-terminated \n** string. Return a pointer to the first character following *pIn in \n** the string that is not a \"bareword\" character.\n*/\nstatic const char *fts5ConfigSkipBareword(const char *pIn){\n  const char *p = pIn;\n  while ( sqlite3Fts5IsBareword(*p) ) p++;\n  if( p==pIn ) p = 0;\n  return p;\n}\n\nstatic int fts5_isdigit(char a){\n  return (a>='0' && a<='9');\n}\n\n\n\nstatic const char *fts5ConfigSkipLiteral(const char *pIn){\n  const char *p = pIn;\n  switch( *p ){\n    case 'n': case 'N':\n      if( sqlite3_strnicmp(\"null\", p, 4)==0 ){\n        p = &p[4];\n      }else{\n        p = 0;\n      }\n      break;\n\n    case 'x': case 'X':\n      p++;\n      if( *p=='\\'' ){\n        p++;\n        while( (*p>='a' && *p<='f') \n            || (*p>='A' && *p<='F') \n            || (*p>='0' && *p<='9') \n            ){\n          p++;\n        }\n        if( *p=='\\'' && 0==((p-pIn)%2) ){\n          p++;\n        }else{\n          p = 0;\n        }\n      }else{\n        p = 0;\n      }\n      break;\n\n    case '\\'':\n      p++;\n      while( p ){\n        if( *p=='\\'' ){\n          p++;\n          if( *p!='\\'' ) break;\n        }\n        p++;\n        if( *p==0 ) p = 0;\n      }\n      break;\n\n    default:\n      /* maybe a number */\n      if( *p=='+' || *p=='-' ) p++;\n      while( fts5_isdigit(*p) ) p++;\n\n      /* At this point, if the literal was an integer, the parse is \n      ** finished. Or, if it is a floating point value, it may continue\n      ** with either a decimal point or an 'E' character. */\n      if( *p=='.' && fts5_isdigit(p[1]) ){\n        p += 2;\n        while( fts5_isdigit(*p) ) p++;\n      }\n      if( p==pIn ) p = 0;\n\n      break;\n  }\n\n  return p;\n}\n\n/*\n** The first character of the string pointed to by argument z is guaranteed\n** to be an open-quote character (see function fts5_isopenquote()).\n**\n** This function searches for the corresponding close-quote character within\n** the string and, if found, dequotes the string in place and adds a new\n** nul-terminator byte.\n**\n** If the close-quote is found, the value returned is the byte offset of\n** the character immediately following it. Or, if the close-quote is not \n** found, -1 is returned. If -1 is returned, the buffer is left in an \n** undefined state.\n*/\nstatic int fts5Dequote(char *z){\n  char q;\n  int iIn = 1;\n  int iOut = 0;\n  q = z[0];\n\n  /* Set stack variable q to the close-quote character */\n  assert( q=='[' || q=='\\'' || q=='\"' || q=='`' );\n  if( q=='[' ) q = ']';  \n\n  while( ALWAYS(z[iIn]) ){\n    if( z[iIn]==q ){\n      if( z[iIn+1]!=q ){\n        /* Character iIn was the close quote. */\n        iIn++;\n        break;\n      }else{\n        /* Character iIn and iIn+1 form an escaped quote character. Skip\n        ** the input cursor past both and copy a single quote character \n        ** to the output buffer. */\n        iIn += 2;\n        z[iOut++] = q;\n      }\n    }else{\n      z[iOut++] = z[iIn++];\n    }\n  }\n\n  z[iOut] = '\\0';\n  return iIn;\n}\n\n/*\n** Convert an SQL-style quoted string into a normal string by removing\n** the quote characters.  The conversion is done in-place.  If the\n** input does not begin with a quote character, then this routine\n** is a no-op.\n**\n** Examples:\n**\n**     \"abc\"   becomes   abc\n**     'xyz'   becomes   xyz\n**     [pqr]   becomes   pqr\n**     `mno`   becomes   mno\n*/\nstatic void sqlite3Fts5Dequote(char *z){\n  char quote;                     /* Quote character (if any ) */\n\n  assert( 0==fts5_iswhitespace(z[0]) );\n  quote = z[0];\n  if( quote=='[' || quote=='\\'' || quote=='\"' || quote=='`' ){\n    fts5Dequote(z);\n  }\n}\n\n\nstruct Fts5Enum {\n  const char *zName;\n  int eVal;\n};\ntypedef struct Fts5Enum Fts5Enum;\n\nstatic int fts5ConfigSetEnum(\n  const Fts5Enum *aEnum, \n  const char *zEnum, \n  int *peVal\n){\n  int nEnum = (int)strlen(zEnum);\n  int i;\n  int iVal = -1;\n\n  for(i=0; aEnum[i].zName; i++){\n    if( sqlite3_strnicmp(aEnum[i].zName, zEnum, nEnum)==0 ){\n      if( iVal>=0 ) return SQLITE_ERROR;\n      iVal = aEnum[i].eVal;\n    }\n  }\n\n  *peVal = iVal;\n  return iVal<0 ? SQLITE_ERROR : SQLITE_OK;\n}\n\n/*\n** Parse a \"special\" CREATE VIRTUAL TABLE directive and update\n** configuration object pConfig as appropriate.\n**\n** If successful, object pConfig is updated and SQLITE_OK returned. If\n** an error occurs, an SQLite error code is returned and an error message\n** may be left in *pzErr. It is the responsibility of the caller to\n** eventually free any such error message using sqlite3_free().\n*/\nstatic int fts5ConfigParseSpecial(\n  Fts5Global *pGlobal,\n  Fts5Config *pConfig,            /* Configuration object to update */\n  const char *zCmd,               /* Special command to parse */\n  const char *zArg,               /* Argument to parse */\n  char **pzErr                    /* OUT: Error message */\n){\n  int rc = SQLITE_OK;\n  int nCmd = (int)strlen(zCmd);\n  if( sqlite3_strnicmp(\"prefix\", zCmd, nCmd)==0 ){\n    const int nByte = sizeof(int) * FTS5_MAX_PREFIX_INDEXES;\n    const char *p;\n    int bFirst = 1;\n    if( pConfig->aPrefix==0 ){\n      pConfig->aPrefix = sqlite3Fts5MallocZero(&rc, nByte);\n      if( rc ) return rc;\n    }\n\n    p = zArg;\n    while( 1 ){\n      int nPre = 0;\n\n      while( p[0]==' ' ) p++;\n      if( bFirst==0 && p[0]==',' ){\n        p++;\n        while( p[0]==' ' ) p++;\n      }else if( p[0]=='\\0' ){\n        break;\n      }\n      if( p[0]<'0' || p[0]>'9' ){\n        *pzErr = sqlite3_mprintf(\"malformed prefix=... directive\");\n        rc = SQLITE_ERROR;\n        break;\n      }\n\n      if( pConfig->nPrefix==FTS5_MAX_PREFIX_INDEXES ){\n        *pzErr = sqlite3_mprintf(\n            \"too many prefix indexes (max %d)\", FTS5_MAX_PREFIX_INDEXES\n        );\n        rc = SQLITE_ERROR;\n        break;\n      }\n\n      while( p[0]>='0' && p[0]<='9' && nPre<1000 ){\n        nPre = nPre*10 + (p[0] - '0');\n        p++;\n      }\n\n      if( nPre<=0 || nPre>=1000 ){\n        *pzErr = sqlite3_mprintf(\"prefix length out of range (max 999)\");\n        rc = SQLITE_ERROR;\n        break;\n      }\n\n      pConfig->aPrefix[pConfig->nPrefix] = nPre;\n      pConfig->nPrefix++;\n      bFirst = 0;\n    }\n    assert( pConfig->nPrefix<=FTS5_MAX_PREFIX_INDEXES );\n    return rc;\n  }\n\n  if( sqlite3_strnicmp(\"tokenize\", zCmd, nCmd)==0 ){\n    const char *p = (const char*)zArg;\n    int nArg = (int)strlen(zArg) + 1;\n    char **azArg = sqlite3Fts5MallocZero(&rc, sizeof(char*) * nArg);\n    char *pDel = sqlite3Fts5MallocZero(&rc, nArg * 2);\n    char *pSpace = pDel;\n\n    if( azArg && pSpace ){\n      if( pConfig->pTok ){\n        *pzErr = sqlite3_mprintf(\"multiple tokenize=... directives\");\n        rc = SQLITE_ERROR;\n      }else{\n        for(nArg=0; p && *p; nArg++){\n          const char *p2 = fts5ConfigSkipWhitespace(p);\n          if( *p2=='\\'' ){\n            p = fts5ConfigSkipLiteral(p2);\n          }else{\n            p = fts5ConfigSkipBareword(p2);\n          }\n          if( p ){\n            memcpy(pSpace, p2, p-p2);\n            azArg[nArg] = pSpace;\n            sqlite3Fts5Dequote(pSpace);\n            pSpace += (p - p2) + 1;\n            p = fts5ConfigSkipWhitespace(p);\n          }\n        }\n        if( p==0 ){\n          *pzErr = sqlite3_mprintf(\"parse error in tokenize directive\");\n          rc = SQLITE_ERROR;\n        }else{\n          rc = sqlite3Fts5GetTokenizer(pGlobal, \n              (const char**)azArg, nArg, &pConfig->pTok, &pConfig->pTokApi,\n              pzErr\n          );\n        }\n      }\n    }\n\n    sqlite3_free(azArg);\n    sqlite3_free(pDel);\n    return rc;\n  }\n\n  if( sqlite3_strnicmp(\"content\", zCmd, nCmd)==0 ){\n    if( pConfig->eContent!=FTS5_CONTENT_NORMAL ){\n      *pzErr = sqlite3_mprintf(\"multiple content=... directives\");\n      rc = SQLITE_ERROR;\n    }else{\n      if( zArg[0] ){\n        pConfig->eContent = FTS5_CONTENT_EXTERNAL;\n        pConfig->zContent = sqlite3Fts5Mprintf(&rc, \"%Q.%Q\", pConfig->zDb,zArg);\n      }else{\n        pConfig->eContent = FTS5_CONTENT_NONE;\n      }\n    }\n    return rc;\n  }\n\n  if( sqlite3_strnicmp(\"content_rowid\", zCmd, nCmd)==0 ){\n    if( pConfig->zContentRowid ){\n      *pzErr = sqlite3_mprintf(\"multiple content_rowid=... directives\");\n      rc = SQLITE_ERROR;\n    }else{\n      pConfig->zContentRowid = sqlite3Fts5Strndup(&rc, zArg, -1);\n    }\n    return rc;\n  }\n\n  if( sqlite3_strnicmp(\"columnsize\", zCmd, nCmd)==0 ){\n    if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\\0' ){\n      *pzErr = sqlite3_mprintf(\"malformed columnsize=... directive\");\n      rc = SQLITE_ERROR;\n    }else{\n      pConfig->bColumnsize = (zArg[0]=='1');\n    }\n    return rc;\n  }\n\n  if( sqlite3_strnicmp(\"detail\", zCmd, nCmd)==0 ){\n    const Fts5Enum aDetail[] = {\n      { \"none\", FTS5_DETAIL_NONE },\n      { \"full\", FTS5_DETAIL_FULL },\n      { \"columns\", FTS5_DETAIL_COLUMNS },\n      { 0, 0 }\n    };\n\n    if( (rc = fts5ConfigSetEnum(aDetail, zArg, &pConfig->eDetail)) ){\n      *pzErr = sqlite3_mprintf(\"malformed detail=... directive\");\n    }\n    return rc;\n  }\n\n  *pzErr = sqlite3_mprintf(\"unrecognized option: \\\"%.*s\\\"\", nCmd, zCmd);\n  return SQLITE_ERROR;\n}\n\n/*\n** Allocate an instance of the default tokenizer (\"simple\") at \n** Fts5Config.pTokenizer. Return SQLITE_OK if successful, or an SQLite error\n** code if an error occurs.\n*/\nstatic int fts5ConfigDefaultTokenizer(Fts5Global *pGlobal, Fts5Config *pConfig){\n  assert( pConfig->pTok==0 && pConfig->pTokApi==0 );\n  return sqlite3Fts5GetTokenizer(\n      pGlobal, 0, 0, &pConfig->pTok, &pConfig->pTokApi, 0\n  );\n}\n\n/*\n** Gobble up the first bareword or quoted word from the input buffer zIn.\n** Return a pointer to the character immediately following the last in\n** the gobbled word if successful, or a NULL pointer otherwise (failed\n** to find close-quote character).\n**\n** Before returning, set pzOut to point to a new buffer containing a\n** nul-terminated, dequoted copy of the gobbled word. If the word was\n** quoted, *pbQuoted is also set to 1 before returning.\n**\n** If *pRc is other than SQLITE_OK when this function is called, it is\n** a no-op (NULL is returned). Otherwise, if an OOM occurs within this\n** function, *pRc is set to SQLITE_NOMEM before returning. *pRc is *not*\n** set if a parse error (failed to find close quote) occurs.\n*/\nstatic const char *fts5ConfigGobbleWord(\n  int *pRc,                       /* IN/OUT: Error code */\n  const char *zIn,                /* Buffer to gobble string/bareword from */\n  char **pzOut,                   /* OUT: malloc'd buffer containing str/bw */\n  int *pbQuoted                   /* OUT: Set to true if dequoting required */\n){\n  const char *zRet = 0;\n\n  int nIn = (int)strlen(zIn);\n  char *zOut = sqlite3_malloc(nIn+1);\n\n  assert( *pRc==SQLITE_OK );\n  *pbQuoted = 0;\n  *pzOut = 0;\n\n  if( zOut==0 ){\n    *pRc = SQLITE_NOMEM;\n  }else{\n    memcpy(zOut, zIn, nIn+1);\n    if( fts5_isopenquote(zOut[0]) ){\n      int ii = fts5Dequote(zOut);\n      zRet = &zIn[ii];\n      *pbQuoted = 1;\n    }else{\n      zRet = fts5ConfigSkipBareword(zIn);\n      if( zRet ){\n        zOut[zRet-zIn] = '\\0';\n      }\n    }\n  }\n\n  if( zRet==0 ){\n    sqlite3_free(zOut);\n  }else{\n    *pzOut = zOut;\n  }\n\n  return zRet;\n}\n\nstatic int fts5ConfigParseColumn(\n  Fts5Config *p, \n  char *zCol, \n  char *zArg, \n  char **pzErr\n){\n  int rc = SQLITE_OK;\n  if( 0==sqlite3_stricmp(zCol, FTS5_RANK_NAME) \n   || 0==sqlite3_stricmp(zCol, FTS5_ROWID_NAME) \n  ){\n    *pzErr = sqlite3_mprintf(\"reserved fts5 column name: %s\", zCol);\n    rc = SQLITE_ERROR;\n  }else if( zArg ){\n    if( 0==sqlite3_stricmp(zArg, \"unindexed\") ){\n      p->abUnindexed[p->nCol] = 1;\n    }else{\n      *pzErr = sqlite3_mprintf(\"unrecognized column option: %s\", zArg);\n      rc = SQLITE_ERROR;\n    }\n  }\n\n  p->azCol[p->nCol++] = zCol;\n  return rc;\n}\n\n/*\n** Populate the Fts5Config.zContentExprlist string.\n*/\nstatic int fts5ConfigMakeExprlist(Fts5Config *p){\n  int i;\n  int rc = SQLITE_OK;\n  Fts5Buffer buf = {0, 0, 0};\n\n  sqlite3Fts5BufferAppendPrintf(&rc, &buf, \"T.%Q\", p->zContentRowid);\n  if( p->eContent!=FTS5_CONTENT_NONE ){\n    for(i=0; i<p->nCol; i++){\n      if( p->eContent==FTS5_CONTENT_EXTERNAL ){\n        sqlite3Fts5BufferAppendPrintf(&rc, &buf, \", T.%Q\", p->azCol[i]);\n      }else{\n        sqlite3Fts5BufferAppendPrintf(&rc, &buf, \", T.c%d\", i);\n      }\n    }\n  }\n\n  assert( p->zContentExprlist==0 );\n  p->zContentExprlist = (char*)buf.p;\n  return rc;\n}\n\n/*\n** Arguments nArg/azArg contain the string arguments passed to the xCreate\n** or xConnect method of the virtual table. This function attempts to \n** allocate an instance of Fts5Config containing the results of parsing\n** those arguments.\n**\n** If successful, SQLITE_OK is returned and *ppOut is set to point to the\n** new Fts5Config object. If an error occurs, an SQLite error code is \n** returned, *ppOut is set to NULL and an error message may be left in\n** *pzErr. It is the responsibility of the caller to eventually free any \n** such error message using sqlite3_free().\n*/\nstatic int sqlite3Fts5ConfigParse(\n  Fts5Global *pGlobal,\n  sqlite3 *db,\n  int nArg,                       /* Number of arguments */\n  const char **azArg,             /* Array of nArg CREATE VIRTUAL TABLE args */\n  Fts5Config **ppOut,             /* OUT: Results of parse */\n  char **pzErr                    /* OUT: Error message */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  Fts5Config *pRet;               /* New object to return */\n  int i;\n  int nByte;\n\n  *ppOut = pRet = (Fts5Config*)sqlite3_malloc(sizeof(Fts5Config));\n  if( pRet==0 ) return SQLITE_NOMEM;\n  memset(pRet, 0, sizeof(Fts5Config));\n  pRet->db = db;\n  pRet->iCookie = -1;\n\n  nByte = nArg * (sizeof(char*) + sizeof(u8));\n  pRet->azCol = (char**)sqlite3Fts5MallocZero(&rc, nByte);\n  pRet->abUnindexed = (u8*)&pRet->azCol[nArg];\n  pRet->zDb = sqlite3Fts5Strndup(&rc, azArg[1], -1);\n  pRet->zName = sqlite3Fts5Strndup(&rc, azArg[2], -1);\n  pRet->bColumnsize = 1;\n  pRet->eDetail = FTS5_DETAIL_FULL;\n#ifdef SQLITE_DEBUG\n  pRet->bPrefixIndex = 1;\n#endif\n  if( rc==SQLITE_OK && sqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){\n    *pzErr = sqlite3_mprintf(\"reserved fts5 table name: %s\", pRet->zName);\n    rc = SQLITE_ERROR;\n  }\n\n  for(i=3; rc==SQLITE_OK && i<nArg; i++){\n    const char *zOrig = azArg[i];\n    const char *z;\n    char *zOne = 0;\n    char *zTwo = 0;\n    int bOption = 0;\n    int bMustBeCol = 0;\n\n    z = fts5ConfigGobbleWord(&rc, zOrig, &zOne, &bMustBeCol);\n    z = fts5ConfigSkipWhitespace(z);\n    if( z && *z=='=' ){\n      bOption = 1;\n      z++;\n      if( bMustBeCol ) z = 0;\n    }\n    z = fts5ConfigSkipWhitespace(z);\n    if( z && z[0] ){\n      int bDummy;\n      z = fts5ConfigGobbleWord(&rc, z, &zTwo, &bDummy);\n      if( z && z[0] ) z = 0;\n    }\n\n    if( rc==SQLITE_OK ){\n      if( z==0 ){\n        *pzErr = sqlite3_mprintf(\"parse error in \\\"%s\\\"\", zOrig);\n        rc = SQLITE_ERROR;\n      }else{\n        if( bOption ){\n          rc = fts5ConfigParseSpecial(pGlobal, pRet, zOne, zTwo?zTwo:\"\", pzErr);\n        }else{\n          rc = fts5ConfigParseColumn(pRet, zOne, zTwo, pzErr);\n          zOne = 0;\n        }\n      }\n    }\n\n    sqlite3_free(zOne);\n    sqlite3_free(zTwo);\n  }\n\n  /* If a tokenizer= option was successfully parsed, the tokenizer has\n  ** already been allocated. Otherwise, allocate an instance of the default\n  ** tokenizer (unicode61) now.  */\n  if( rc==SQLITE_OK && pRet->pTok==0 ){\n    rc = fts5ConfigDefaultTokenizer(pGlobal, pRet);\n  }\n\n  /* If no zContent option was specified, fill in the default values. */\n  if( rc==SQLITE_OK && pRet->zContent==0 ){\n    const char *zTail = 0;\n    assert( pRet->eContent==FTS5_CONTENT_NORMAL \n         || pRet->eContent==FTS5_CONTENT_NONE \n    );\n    if( pRet->eContent==FTS5_CONTENT_NORMAL ){\n      zTail = \"content\";\n    }else if( pRet->bColumnsize ){\n      zTail = \"docsize\";\n    }\n\n    if( zTail ){\n      pRet->zContent = sqlite3Fts5Mprintf(\n          &rc, \"%Q.'%q_%s'\", pRet->zDb, pRet->zName, zTail\n      );\n    }\n  }\n\n  if( rc==SQLITE_OK && pRet->zContentRowid==0 ){\n    pRet->zContentRowid = sqlite3Fts5Strndup(&rc, \"rowid\", -1);\n  }\n\n  /* Formulate the zContentExprlist text */\n  if( rc==SQLITE_OK ){\n    rc = fts5ConfigMakeExprlist(pRet);\n  }\n\n  if( rc!=SQLITE_OK ){\n    sqlite3Fts5ConfigFree(pRet);\n    *ppOut = 0;\n  }\n  return rc;\n}\n\n/*\n** Free the configuration object passed as the only argument.\n*/\nstatic void sqlite3Fts5ConfigFree(Fts5Config *pConfig){\n  if( pConfig ){\n    int i;\n    if( pConfig->pTok ){\n      pConfig->pTokApi->xDelete(pConfig->pTok);\n    }\n    sqlite3_free(pConfig->zDb);\n    sqlite3_free(pConfig->zName);\n    for(i=0; i<pConfig->nCol; i++){\n      sqlite3_free(pConfig->azCol[i]);\n    }\n    sqlite3_free(pConfig->azCol);\n    sqlite3_free(pConfig->aPrefix);\n    sqlite3_free(pConfig->zRank);\n    sqlite3_free(pConfig->zRankArgs);\n    sqlite3_free(pConfig->zContent);\n    sqlite3_free(pConfig->zContentRowid);\n    sqlite3_free(pConfig->zContentExprlist);\n    sqlite3_free(pConfig);\n  }\n}\n\n/*\n** Call sqlite3_declare_vtab() based on the contents of the configuration\n** object passed as the only argument. Return SQLITE_OK if successful, or\n** an SQLite error code if an error occurs.\n*/\nstatic int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig){\n  int i;\n  int rc = SQLITE_OK;\n  char *zSql;\n\n  zSql = sqlite3Fts5Mprintf(&rc, \"CREATE TABLE x(\");\n  for(i=0; zSql && i<pConfig->nCol; i++){\n    const char *zSep = (i==0?\"\":\", \");\n    zSql = sqlite3Fts5Mprintf(&rc, \"%z%s%Q\", zSql, zSep, pConfig->azCol[i]);\n  }\n  zSql = sqlite3Fts5Mprintf(&rc, \"%z, %Q HIDDEN, %s HIDDEN)\", \n      zSql, pConfig->zName, FTS5_RANK_NAME\n  );\n\n  assert( zSql || rc==SQLITE_NOMEM );\n  if( zSql ){\n    rc = sqlite3_declare_vtab(pConfig->db, zSql);\n    sqlite3_free(zSql);\n  }\n  \n  return rc;\n}\n\n/*\n** Tokenize the text passed via the second and third arguments.\n**\n** The callback is invoked once for each token in the input text. The\n** arguments passed to it are, in order:\n**\n**     void *pCtx          // Copy of 4th argument to sqlite3Fts5Tokenize()\n**     const char *pToken  // Pointer to buffer containing token\n**     int nToken          // Size of token in bytes\n**     int iStart          // Byte offset of start of token within input text\n**     int iEnd            // Byte offset of end of token within input text\n**     int iPos            // Position of token in input (first token is 0)\n**\n** If the callback returns a non-zero value the tokenization is abandoned\n** and no further callbacks are issued. \n**\n** This function returns SQLITE_OK if successful or an SQLite error code\n** if an error occurs. If the tokenization was abandoned early because\n** the callback returned SQLITE_DONE, this is not an error and this function\n** still returns SQLITE_OK. Or, if the tokenization was abandoned early\n** because the callback returned another non-zero value, it is assumed\n** to be an SQLite error code and returned to the caller.\n*/\nstatic int sqlite3Fts5Tokenize(\n  Fts5Config *pConfig,            /* FTS5 Configuration object */\n  int flags,                      /* FTS5_TOKENIZE_* flags */\n  const char *pText, int nText,   /* Text to tokenize */\n  void *pCtx,                     /* Context passed to xToken() */\n  int (*xToken)(void*, int, const char*, int, int, int)    /* Callback */\n){\n  if( pText==0 ) return SQLITE_OK;\n  return pConfig->pTokApi->xTokenize(\n      pConfig->pTok, pCtx, flags, pText, nText, xToken\n  );\n}\n\n/*\n** Argument pIn points to the first character in what is expected to be\n** a comma-separated list of SQL literals followed by a ')' character.\n** If it actually is this, return a pointer to the ')'. Otherwise, return\n** NULL to indicate a parse error.\n*/\nstatic const char *fts5ConfigSkipArgs(const char *pIn){\n  const char *p = pIn;\n  \n  while( 1 ){\n    p = fts5ConfigSkipWhitespace(p);\n    p = fts5ConfigSkipLiteral(p);\n    p = fts5ConfigSkipWhitespace(p);\n    if( p==0 || *p==')' ) break;\n    if( *p!=',' ){\n      p = 0;\n      break;\n    }\n    p++;\n  }\n\n  return p;\n}\n\n/*\n** Parameter zIn contains a rank() function specification. The format of \n** this is:\n**\n**   + Bareword (function name)\n**   + Open parenthesis - \"(\"\n**   + Zero or more SQL literals in a comma separated list\n**   + Close parenthesis - \")\"\n*/\nstatic int sqlite3Fts5ConfigParseRank(\n  const char *zIn,                /* Input string */\n  char **pzRank,                  /* OUT: Rank function name */\n  char **pzRankArgs               /* OUT: Rank function arguments */\n){\n  const char *p = zIn;\n  const char *pRank;\n  char *zRank = 0;\n  char *zRankArgs = 0;\n  int rc = SQLITE_OK;\n\n  *pzRank = 0;\n  *pzRankArgs = 0;\n\n  if( p==0 ){\n    rc = SQLITE_ERROR;\n  }else{\n    p = fts5ConfigSkipWhitespace(p);\n    pRank = p;\n    p = fts5ConfigSkipBareword(p);\n\n    if( p ){\n      zRank = sqlite3Fts5MallocZero(&rc, 1 + p - pRank);\n      if( zRank ) memcpy(zRank, pRank, p-pRank);\n    }else{\n      rc = SQLITE_ERROR;\n    }\n\n    if( rc==SQLITE_OK ){\n      p = fts5ConfigSkipWhitespace(p);\n      if( *p!='(' ) rc = SQLITE_ERROR;\n      p++;\n    }\n    if( rc==SQLITE_OK ){\n      const char *pArgs; \n      p = fts5ConfigSkipWhitespace(p);\n      pArgs = p;\n      if( *p!=')' ){\n        p = fts5ConfigSkipArgs(p);\n        if( p==0 ){\n          rc = SQLITE_ERROR;\n        }else{\n          zRankArgs = sqlite3Fts5MallocZero(&rc, 1 + p - pArgs);\n          if( zRankArgs ) memcpy(zRankArgs, pArgs, p-pArgs);\n        }\n      }\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    sqlite3_free(zRank);\n    assert( zRankArgs==0 );\n  }else{\n    *pzRank = zRank;\n    *pzRankArgs = zRankArgs;\n  }\n  return rc;\n}\n\nstatic int sqlite3Fts5ConfigSetValue(\n  Fts5Config *pConfig, \n  const char *zKey, \n  sqlite3_value *pVal,\n  int *pbBadkey\n){\n  int rc = SQLITE_OK;\n\n  if( 0==sqlite3_stricmp(zKey, \"pgsz\") ){\n    int pgsz = 0;\n    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){\n      pgsz = sqlite3_value_int(pVal);\n    }\n    if( pgsz<=0 || pgsz>FTS5_MAX_PAGE_SIZE ){\n      *pbBadkey = 1;\n    }else{\n      pConfig->pgsz = pgsz;\n    }\n  }\n\n  else if( 0==sqlite3_stricmp(zKey, \"hashsize\") ){\n    int nHashSize = -1;\n    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){\n      nHashSize = sqlite3_value_int(pVal);\n    }\n    if( nHashSize<=0 ){\n      *pbBadkey = 1;\n    }else{\n      pConfig->nHashSize = nHashSize;\n    }\n  }\n\n  else if( 0==sqlite3_stricmp(zKey, \"automerge\") ){\n    int nAutomerge = -1;\n    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){\n      nAutomerge = sqlite3_value_int(pVal);\n    }\n    if( nAutomerge<0 || nAutomerge>64 ){\n      *pbBadkey = 1;\n    }else{\n      if( nAutomerge==1 ) nAutomerge = FTS5_DEFAULT_AUTOMERGE;\n      pConfig->nAutomerge = nAutomerge;\n    }\n  }\n\n  else if( 0==sqlite3_stricmp(zKey, \"usermerge\") ){\n    int nUsermerge = -1;\n    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){\n      nUsermerge = sqlite3_value_int(pVal);\n    }\n    if( nUsermerge<2 || nUsermerge>16 ){\n      *pbBadkey = 1;\n    }else{\n      pConfig->nUsermerge = nUsermerge;\n    }\n  }\n\n  else if( 0==sqlite3_stricmp(zKey, \"crisismerge\") ){\n    int nCrisisMerge = -1;\n    if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){\n      nCrisisMerge = sqlite3_value_int(pVal);\n    }\n    if( nCrisisMerge<0 ){\n      *pbBadkey = 1;\n    }else{\n      if( nCrisisMerge<=1 ) nCrisisMerge = FTS5_DEFAULT_CRISISMERGE;\n      pConfig->nCrisisMerge = nCrisisMerge;\n    }\n  }\n\n  else if( 0==sqlite3_stricmp(zKey, \"rank\") ){\n    const char *zIn = (const char*)sqlite3_value_text(pVal);\n    char *zRank;\n    char *zRankArgs;\n    rc = sqlite3Fts5ConfigParseRank(zIn, &zRank, &zRankArgs);\n    if( rc==SQLITE_OK ){\n      sqlite3_free(pConfig->zRank);\n      sqlite3_free(pConfig->zRankArgs);\n      pConfig->zRank = zRank;\n      pConfig->zRankArgs = zRankArgs;\n    }else if( rc==SQLITE_ERROR ){\n      rc = SQLITE_OK;\n      *pbBadkey = 1;\n    }\n  }else{\n    *pbBadkey = 1;\n  }\n  return rc;\n}\n\n/*\n** Load the contents of the %_config table into memory.\n*/\nstatic int sqlite3Fts5ConfigLoad(Fts5Config *pConfig, int iCookie){\n  const char *zSelect = \"SELECT k, v FROM %Q.'%q_config'\";\n  char *zSql;\n  sqlite3_stmt *p = 0;\n  int rc = SQLITE_OK;\n  int iVersion = 0;\n\n  /* Set default values */\n  pConfig->pgsz = FTS5_DEFAULT_PAGE_SIZE;\n  pConfig->nAutomerge = FTS5_DEFAULT_AUTOMERGE;\n  pConfig->nUsermerge = FTS5_DEFAULT_USERMERGE;\n  pConfig->nCrisisMerge = FTS5_DEFAULT_CRISISMERGE;\n  pConfig->nHashSize = FTS5_DEFAULT_HASHSIZE;\n\n  zSql = sqlite3Fts5Mprintf(&rc, zSelect, pConfig->zDb, pConfig->zName);\n  if( zSql ){\n    rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p, 0);\n    sqlite3_free(zSql);\n  }\n\n  assert( rc==SQLITE_OK || p==0 );\n  if( rc==SQLITE_OK ){\n    while( SQLITE_ROW==sqlite3_step(p) ){\n      const char *zK = (const char*)sqlite3_column_text(p, 0);\n      sqlite3_value *pVal = sqlite3_column_value(p, 1);\n      if( 0==sqlite3_stricmp(zK, \"version\") ){\n        iVersion = sqlite3_value_int(pVal);\n      }else{\n        int bDummy = 0;\n        sqlite3Fts5ConfigSetValue(pConfig, zK, pVal, &bDummy);\n      }\n    }\n    rc = sqlite3_finalize(p);\n  }\n  \n  if( rc==SQLITE_OK && iVersion!=FTS5_CURRENT_VERSION ){\n    rc = SQLITE_ERROR;\n    if( pConfig->pzErrmsg ){\n      assert( 0==*pConfig->pzErrmsg );\n      *pConfig->pzErrmsg = sqlite3_mprintf(\n          \"invalid fts5 file format (found %d, expected %d) - run 'rebuild'\",\n          iVersion, FTS5_CURRENT_VERSION\n      );\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    pConfig->iCookie = iCookie;\n  }\n  return rc;\n}\n\n#line 1 \"fts5_expr.c\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n*/\n\n\n\n/* #include \"fts5Int.h\" */\n/* #include \"fts5parse.h\" */\n\n/*\n** All token types in the generated fts5parse.h file are greater than 0.\n*/\n#define FTS5_EOF 0\n\n#define FTS5_LARGEST_INT64  (0xffffffff|(((i64)0x7fffffff)<<32))\n\ntypedef struct Fts5ExprTerm Fts5ExprTerm;\n\n/*\n** Functions generated by lemon from fts5parse.y.\n*/\nstatic void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64));\nstatic void sqlite3Fts5ParserFree(void*, void (*freeProc)(void*));\nstatic void sqlite3Fts5Parser(void*, int, Fts5Token, Fts5Parse*);\n#ifndef NDEBUG\n#include <stdio.h>\nstatic void sqlite3Fts5ParserTrace(FILE*, char*);\n#endif\n\n\nstruct Fts5Expr {\n  Fts5Index *pIndex;\n  Fts5Config *pConfig;\n  Fts5ExprNode *pRoot;\n  int bDesc;                      /* Iterate in descending rowid order */\n  int nPhrase;                    /* Number of phrases in expression */\n  Fts5ExprPhrase **apExprPhrase;  /* Pointers to phrase objects */\n};\n\n/*\n** eType:\n**   Expression node type. Always one of:\n**\n**       FTS5_AND                 (nChild, apChild valid)\n**       FTS5_OR                  (nChild, apChild valid)\n**       FTS5_NOT                 (nChild, apChild valid)\n**       FTS5_STRING              (pNear valid)\n**       FTS5_TERM                (pNear valid)\n*/\nstruct Fts5ExprNode {\n  int eType;                      /* Node type */\n  int bEof;                       /* True at EOF */\n  int bNomatch;                   /* True if entry is not a match */\n\n  /* Next method for this node. */\n  int (*xNext)(Fts5Expr*, Fts5ExprNode*, int, i64);\n\n  i64 iRowid;                     /* Current rowid */\n  Fts5ExprNearset *pNear;         /* For FTS5_STRING - cluster of phrases */\n\n  /* Child nodes. For a NOT node, this array always contains 2 entries. For \n  ** AND or OR nodes, it contains 2 or more entries.  */\n  int nChild;                     /* Number of child nodes */\n  Fts5ExprNode *apChild[1];       /* Array of child nodes */\n};\n\n#define Fts5NodeIsString(p) ((p)->eType==FTS5_TERM || (p)->eType==FTS5_STRING)\n\n/*\n** Invoke the xNext method of an Fts5ExprNode object. This macro should be\n** used as if it has the same signature as the xNext() methods themselves.\n*/\n#define fts5ExprNodeNext(a,b,c,d) (b)->xNext((a), (b), (c), (d))\n\n/*\n** An instance of the following structure represents a single search term\n** or term prefix.\n*/\nstruct Fts5ExprTerm {\n  int bPrefix;                    /* True for a prefix term */\n  char *zTerm;                    /* nul-terminated term */\n  Fts5IndexIter *pIter;           /* Iterator for this term */\n  Fts5ExprTerm *pSynonym;         /* Pointer to first in list of synonyms */\n};\n\n/*\n** A phrase. One or more terms that must appear in a contiguous sequence\n** within a document for it to match.\n*/\nstruct Fts5ExprPhrase {\n  Fts5ExprNode *pNode;            /* FTS5_STRING node this phrase is part of */\n  Fts5Buffer poslist;             /* Current position list */\n  int nTerm;                      /* Number of entries in aTerm[] */\n  Fts5ExprTerm aTerm[1];          /* Terms that make up this phrase */\n};\n\n/*\n** One or more phrases that must appear within a certain token distance of\n** each other within each matching document.\n*/\nstruct Fts5ExprNearset {\n  int nNear;                      /* NEAR parameter */\n  Fts5Colset *pColset;            /* Columns to search (NULL -> all columns) */\n  int nPhrase;                    /* Number of entries in aPhrase[] array */\n  Fts5ExprPhrase *apPhrase[1];    /* Array of phrase pointers */\n};\n\n\n/*\n** Parse context.\n*/\nstruct Fts5Parse {\n  Fts5Config *pConfig;\n  char *zErr;\n  int rc;\n  int nPhrase;                    /* Size of apPhrase array */\n  Fts5ExprPhrase **apPhrase;      /* Array of all phrases */\n  Fts5ExprNode *pExpr;            /* Result of a successful parse */\n};\n\nstatic void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...){\n  va_list ap;\n  va_start(ap, zFmt);\n  if( pParse->rc==SQLITE_OK ){\n    pParse->zErr = sqlite3_vmprintf(zFmt, ap);\n    pParse->rc = SQLITE_ERROR;\n  }\n  va_end(ap);\n}\n\nstatic int fts5ExprIsspace(char t){\n  return t==' ' || t=='\\t' || t=='\\n' || t=='\\r';\n}\n\n/*\n** Read the first token from the nul-terminated string at *pz.\n*/\nstatic int fts5ExprGetToken(\n  Fts5Parse *pParse, \n  const char **pz,                /* IN/OUT: Pointer into buffer */\n  Fts5Token *pToken\n){\n  const char *z = *pz;\n  int tok;\n\n  /* Skip past any whitespace */\n  while( fts5ExprIsspace(*z) ) z++;\n\n  pToken->p = z;\n  pToken->n = 1;\n  switch( *z ){\n    case '(':  tok = FTS5_LP;    break;\n    case ')':  tok = FTS5_RP;    break;\n    case '{':  tok = FTS5_LCP;   break;\n    case '}':  tok = FTS5_RCP;   break;\n    case ':':  tok = FTS5_COLON; break;\n    case ',':  tok = FTS5_COMMA; break;\n    case '+':  tok = FTS5_PLUS;  break;\n    case '*':  tok = FTS5_STAR;  break;\n    case '-':  tok = FTS5_MINUS; break;\n    case '\\0': tok = FTS5_EOF;   break;\n\n    case '\"': {\n      const char *z2;\n      tok = FTS5_STRING;\n\n      for(z2=&z[1]; 1; z2++){\n        if( z2[0]=='\"' ){\n          z2++;\n          if( z2[0]!='\"' ) break;\n        }\n        if( z2[0]=='\\0' ){\n          sqlite3Fts5ParseError(pParse, \"unterminated string\");\n          return FTS5_EOF;\n        }\n      }\n      pToken->n = (z2 - z);\n      break;\n    }\n\n    default: {\n      const char *z2;\n      if( sqlite3Fts5IsBareword(z[0])==0 ){\n        sqlite3Fts5ParseError(pParse, \"fts5: syntax error near \\\"%.1s\\\"\", z);\n        return FTS5_EOF;\n      }\n      tok = FTS5_STRING;\n      for(z2=&z[1]; sqlite3Fts5IsBareword(*z2); z2++);\n      pToken->n = (z2 - z);\n      if( pToken->n==2 && memcmp(pToken->p, \"OR\", 2)==0 )  tok = FTS5_OR;\n      if( pToken->n==3 && memcmp(pToken->p, \"NOT\", 3)==0 ) tok = FTS5_NOT;\n      if( pToken->n==3 && memcmp(pToken->p, \"AND\", 3)==0 ) tok = FTS5_AND;\n      break;\n    }\n  }\n\n  *pz = &pToken->p[pToken->n];\n  return tok;\n}\n\nstatic void *fts5ParseAlloc(u64 t){ return sqlite3_malloc((int)t); }\nstatic void fts5ParseFree(void *p){ sqlite3_free(p); }\n\nstatic int sqlite3Fts5ExprNew(\n  Fts5Config *pConfig,            /* FTS5 Configuration */\n  const char *zExpr,              /* Expression text */\n  Fts5Expr **ppNew, \n  char **pzErr\n){\n  Fts5Parse sParse;\n  Fts5Token token;\n  const char *z = zExpr;\n  int t;                          /* Next token type */\n  void *pEngine;\n  Fts5Expr *pNew;\n\n  *ppNew = 0;\n  *pzErr = 0;\n  memset(&sParse, 0, sizeof(sParse));\n  pEngine = sqlite3Fts5ParserAlloc(fts5ParseAlloc);\n  if( pEngine==0 ){ return SQLITE_NOMEM; }\n  sParse.pConfig = pConfig;\n\n  do {\n    t = fts5ExprGetToken(&sParse, &z, &token);\n    sqlite3Fts5Parser(pEngine, t, token, &sParse);\n  }while( sParse.rc==SQLITE_OK && t!=FTS5_EOF );\n  sqlite3Fts5ParserFree(pEngine, fts5ParseFree);\n\n  assert( sParse.rc!=SQLITE_OK || sParse.zErr==0 );\n  if( sParse.rc==SQLITE_OK ){\n    *ppNew = pNew = sqlite3_malloc(sizeof(Fts5Expr));\n    if( pNew==0 ){\n      sParse.rc = SQLITE_NOMEM;\n      sqlite3Fts5ParseNodeFree(sParse.pExpr);\n    }else{\n      if( !sParse.pExpr ){\n        const int nByte = sizeof(Fts5ExprNode);\n        pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&sParse.rc, nByte);\n        if( pNew->pRoot ){\n          pNew->pRoot->bEof = 1;\n        }\n      }else{\n        pNew->pRoot = sParse.pExpr;\n      }\n      pNew->pIndex = 0;\n      pNew->pConfig = pConfig;\n      pNew->apExprPhrase = sParse.apPhrase;\n      pNew->nPhrase = sParse.nPhrase;\n      sParse.apPhrase = 0;\n    }\n  }else{\n    sqlite3Fts5ParseNodeFree(sParse.pExpr);\n  }\n\n  sqlite3_free(sParse.apPhrase);\n  *pzErr = sParse.zErr;\n  return sParse.rc;\n}\n\n/*\n** Free the expression node object passed as the only argument.\n*/\nstatic void sqlite3Fts5ParseNodeFree(Fts5ExprNode *p){\n  if( p ){\n    int i;\n    for(i=0; i<p->nChild; i++){\n      sqlite3Fts5ParseNodeFree(p->apChild[i]);\n    }\n    sqlite3Fts5ParseNearsetFree(p->pNear);\n    sqlite3_free(p);\n  }\n}\n\n/*\n** Free the expression object passed as the only argument.\n*/\nstatic void sqlite3Fts5ExprFree(Fts5Expr *p){\n  if( p ){\n    sqlite3Fts5ParseNodeFree(p->pRoot);\n    sqlite3_free(p->apExprPhrase);\n    sqlite3_free(p);\n  }\n}\n\n/*\n** Argument pTerm must be a synonym iterator. Return the current rowid\n** that it points to.\n*/\nstatic i64 fts5ExprSynonymRowid(Fts5ExprTerm *pTerm, int bDesc, int *pbEof){\n  i64 iRet = 0;\n  int bRetValid = 0;\n  Fts5ExprTerm *p;\n\n  assert( pTerm->pSynonym );\n  assert( bDesc==0 || bDesc==1 );\n  for(p=pTerm; p; p=p->pSynonym){\n    if( 0==sqlite3Fts5IterEof(p->pIter) ){\n      i64 iRowid = p->pIter->iRowid;\n      if( bRetValid==0 || (bDesc!=(iRowid<iRet)) ){\n        iRet = iRowid;\n        bRetValid = 1;\n      }\n    }\n  }\n\n  if( pbEof && bRetValid==0 ) *pbEof = 1;\n  return iRet;\n}\n\n/*\n** Argument pTerm must be a synonym iterator.\n*/\nstatic int fts5ExprSynonymList(\n  Fts5ExprTerm *pTerm, \n  i64 iRowid,\n  Fts5Buffer *pBuf,               /* Use this buffer for space if required */\n  u8 **pa, int *pn\n){\n  Fts5PoslistReader aStatic[4];\n  Fts5PoslistReader *aIter = aStatic;\n  int nIter = 0;\n  int nAlloc = 4;\n  int rc = SQLITE_OK;\n  Fts5ExprTerm *p;\n\n  assert( pTerm->pSynonym );\n  for(p=pTerm; p; p=p->pSynonym){\n    Fts5IndexIter *pIter = p->pIter;\n    if( sqlite3Fts5IterEof(pIter)==0 && pIter->iRowid==iRowid ){\n      if( pIter->nData==0 ) continue;\n      if( nIter==nAlloc ){\n        int nByte = sizeof(Fts5PoslistReader) * nAlloc * 2;\n        Fts5PoslistReader *aNew = (Fts5PoslistReader*)sqlite3_malloc(nByte);\n        if( aNew==0 ){\n          rc = SQLITE_NOMEM;\n          goto synonym_poslist_out;\n        }\n        memcpy(aNew, aIter, sizeof(Fts5PoslistReader) * nIter);\n        nAlloc = nAlloc*2;\n        if( aIter!=aStatic ) sqlite3_free(aIter);\n        aIter = aNew;\n      }\n      sqlite3Fts5PoslistReaderInit(pIter->pData, pIter->nData, &aIter[nIter]);\n      assert( aIter[nIter].bEof==0 );\n      nIter++;\n    }\n  }\n\n  if( nIter==1 ){\n    *pa = (u8*)aIter[0].a;\n    *pn = aIter[0].n;\n  }else{\n    Fts5PoslistWriter writer = {0};\n    i64 iPrev = -1;\n    fts5BufferZero(pBuf);\n    while( 1 ){\n      int i;\n      i64 iMin = FTS5_LARGEST_INT64;\n      for(i=0; i<nIter; i++){\n        if( aIter[i].bEof==0 ){\n          if( aIter[i].iPos==iPrev ){\n            if( sqlite3Fts5PoslistReaderNext(&aIter[i]) ) continue;\n          }\n          if( aIter[i].iPos<iMin ){\n            iMin = aIter[i].iPos;\n          }\n        }\n      }\n      if( iMin==FTS5_LARGEST_INT64 || rc!=SQLITE_OK ) break;\n      rc = sqlite3Fts5PoslistWriterAppend(pBuf, &writer, iMin);\n      iPrev = iMin;\n    }\n    if( rc==SQLITE_OK ){\n      *pa = pBuf->p;\n      *pn = pBuf->n;\n    }\n  }\n\n synonym_poslist_out:\n  if( aIter!=aStatic ) sqlite3_free(aIter);\n  return rc;\n}\n\n\n/*\n** All individual term iterators in pPhrase are guaranteed to be valid and\n** pointing to the same rowid when this function is called. This function \n** checks if the current rowid really is a match, and if so populates\n** the pPhrase->poslist buffer accordingly. Output parameter *pbMatch\n** is set to true if this is really a match, or false otherwise.\n**\n** SQLITE_OK is returned if an error occurs, or an SQLite error code \n** otherwise. It is not considered an error code if the current rowid is \n** not a match.\n*/\nstatic int fts5ExprPhraseIsMatch(\n  Fts5ExprNode *pNode,            /* Node pPhrase belongs to */\n  Fts5ExprPhrase *pPhrase,        /* Phrase object to initialize */\n  int *pbMatch                    /* OUT: Set to true if really a match */\n){\n  Fts5PoslistWriter writer = {0};\n  Fts5PoslistReader aStatic[4];\n  Fts5PoslistReader *aIter = aStatic;\n  int i;\n  int rc = SQLITE_OK;\n  \n  fts5BufferZero(&pPhrase->poslist);\n\n  /* If the aStatic[] array is not large enough, allocate a large array\n  ** using sqlite3_malloc(). This approach could be improved upon. */\n  if( pPhrase->nTerm>ArraySize(aStatic) ){\n    int nByte = sizeof(Fts5PoslistReader) * pPhrase->nTerm;\n    aIter = (Fts5PoslistReader*)sqlite3_malloc(nByte);\n    if( !aIter ) return SQLITE_NOMEM;\n  }\n  memset(aIter, 0, sizeof(Fts5PoslistReader) * pPhrase->nTerm);\n\n  /* Initialize a term iterator for each term in the phrase */\n  for(i=0; i<pPhrase->nTerm; i++){\n    Fts5ExprTerm *pTerm = &pPhrase->aTerm[i];\n    int n = 0;\n    int bFlag = 0;\n    u8 *a = 0;\n    if( pTerm->pSynonym ){\n      Fts5Buffer buf = {0, 0, 0};\n      rc = fts5ExprSynonymList(pTerm, pNode->iRowid, &buf, &a, &n);\n      if( rc ){\n        sqlite3_free(a);\n        goto ismatch_out;\n      }\n      if( a==buf.p ) bFlag = 1;\n    }else{\n      a = (u8*)pTerm->pIter->pData;\n      n = pTerm->pIter->nData;\n    }\n    sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]);\n    aIter[i].bFlag = (u8)bFlag;\n    if( aIter[i].bEof ) goto ismatch_out;\n  }\n\n  while( 1 ){\n    int bMatch;\n    i64 iPos = aIter[0].iPos;\n    do {\n      bMatch = 1;\n      for(i=0; i<pPhrase->nTerm; i++){\n        Fts5PoslistReader *pPos = &aIter[i];\n        i64 iAdj = iPos + i;\n        if( pPos->iPos!=iAdj ){\n          bMatch = 0;\n          while( pPos->iPos<iAdj ){\n            if( sqlite3Fts5PoslistReaderNext(pPos) ) goto ismatch_out;\n          }\n          if( pPos->iPos>iAdj ) iPos = pPos->iPos-i;\n        }\n      }\n    }while( bMatch==0 );\n\n    /* Append position iPos to the output */\n    rc = sqlite3Fts5PoslistWriterAppend(&pPhrase->poslist, &writer, iPos);\n    if( rc!=SQLITE_OK ) goto ismatch_out;\n\n    for(i=0; i<pPhrase->nTerm; i++){\n      if( sqlite3Fts5PoslistReaderNext(&aIter[i]) ) goto ismatch_out;\n    }\n  }\n\n ismatch_out:\n  *pbMatch = (pPhrase->poslist.n>0);\n  for(i=0; i<pPhrase->nTerm; i++){\n    if( aIter[i].bFlag ) sqlite3_free((u8*)aIter[i].a);\n  }\n  if( aIter!=aStatic ) sqlite3_free(aIter);\n  return rc;\n}\n\ntypedef struct Fts5LookaheadReader Fts5LookaheadReader;\nstruct Fts5LookaheadReader {\n  const u8 *a;                    /* Buffer containing position list */\n  int n;                          /* Size of buffer a[] in bytes */\n  int i;                          /* Current offset in position list */\n  i64 iPos;                       /* Current position */\n  i64 iLookahead;                 /* Next position */\n};\n\n#define FTS5_LOOKAHEAD_EOF (((i64)1) << 62)\n\nstatic int fts5LookaheadReaderNext(Fts5LookaheadReader *p){\n  p->iPos = p->iLookahead;\n  if( sqlite3Fts5PoslistNext64(p->a, p->n, &p->i, &p->iLookahead) ){\n    p->iLookahead = FTS5_LOOKAHEAD_EOF;\n  }\n  return (p->iPos==FTS5_LOOKAHEAD_EOF);\n}\n\nstatic int fts5LookaheadReaderInit(\n  const u8 *a, int n,             /* Buffer to read position list from */\n  Fts5LookaheadReader *p          /* Iterator object to initialize */\n){\n  memset(p, 0, sizeof(Fts5LookaheadReader));\n  p->a = a;\n  p->n = n;\n  fts5LookaheadReaderNext(p);\n  return fts5LookaheadReaderNext(p);\n}\n\ntypedef struct Fts5NearTrimmer Fts5NearTrimmer;\nstruct Fts5NearTrimmer {\n  Fts5LookaheadReader reader;     /* Input iterator */\n  Fts5PoslistWriter writer;       /* Writer context */\n  Fts5Buffer *pOut;               /* Output poslist */\n};\n\n/*\n** The near-set object passed as the first argument contains more than\n** one phrase. All phrases currently point to the same row. The\n** Fts5ExprPhrase.poslist buffers are populated accordingly. This function\n** tests if the current row contains instances of each phrase sufficiently\n** close together to meet the NEAR constraint. Non-zero is returned if it\n** does, or zero otherwise.\n**\n** If in/out parameter (*pRc) is set to other than SQLITE_OK when this\n** function is called, it is a no-op. Or, if an error (e.g. SQLITE_NOMEM)\n** occurs within this function (*pRc) is set accordingly before returning.\n** The return value is undefined in both these cases.\n** \n** If no error occurs and non-zero (a match) is returned, the position-list\n** of each phrase object is edited to contain only those entries that\n** meet the constraint before returning.\n*/\nstatic int fts5ExprNearIsMatch(int *pRc, Fts5ExprNearset *pNear){\n  Fts5NearTrimmer aStatic[4];\n  Fts5NearTrimmer *a = aStatic;\n  Fts5ExprPhrase **apPhrase = pNear->apPhrase;\n\n  int i;\n  int rc = *pRc;\n  int bMatch;\n\n  assert( pNear->nPhrase>1 );\n\n  /* If the aStatic[] array is not large enough, allocate a large array\n  ** using sqlite3_malloc(). This approach could be improved upon. */\n  if( pNear->nPhrase>ArraySize(aStatic) ){\n    int nByte = sizeof(Fts5NearTrimmer) * pNear->nPhrase;\n    a = (Fts5NearTrimmer*)sqlite3Fts5MallocZero(&rc, nByte);\n  }else{\n    memset(aStatic, 0, sizeof(aStatic));\n  }\n  if( rc!=SQLITE_OK ){\n    *pRc = rc;\n    return 0;\n  }\n\n  /* Initialize a lookahead iterator for each phrase. After passing the\n  ** buffer and buffer size to the lookaside-reader init function, zero\n  ** the phrase poslist buffer. The new poslist for the phrase (containing\n  ** the same entries as the original with some entries removed on account \n  ** of the NEAR constraint) is written over the original even as it is\n  ** being read. This is safe as the entries for the new poslist are a\n  ** subset of the old, so it is not possible for data yet to be read to\n  ** be overwritten.  */\n  for(i=0; i<pNear->nPhrase; i++){\n    Fts5Buffer *pPoslist = &apPhrase[i]->poslist;\n    fts5LookaheadReaderInit(pPoslist->p, pPoslist->n, &a[i].reader);\n    pPoslist->n = 0;\n    a[i].pOut = pPoslist;\n  }\n\n  while( 1 ){\n    int iAdv;\n    i64 iMin;\n    i64 iMax;\n\n    /* This block advances the phrase iterators until they point to a set of\n    ** entries that together comprise a match.  */\n    iMax = a[0].reader.iPos;\n    do {\n      bMatch = 1;\n      for(i=0; i<pNear->nPhrase; i++){\n        Fts5LookaheadReader *pPos = &a[i].reader;\n        iMin = iMax - pNear->apPhrase[i]->nTerm - pNear->nNear;\n        if( pPos->iPos<iMin || pPos->iPos>iMax ){\n          bMatch = 0;\n          while( pPos->iPos<iMin ){\n            if( fts5LookaheadReaderNext(pPos) ) goto ismatch_out;\n          }\n          if( pPos->iPos>iMax ) iMax = pPos->iPos;\n        }\n      }\n    }while( bMatch==0 );\n\n    /* Add an entry to each output position list */\n    for(i=0; i<pNear->nPhrase; i++){\n      i64 iPos = a[i].reader.iPos;\n      Fts5PoslistWriter *pWriter = &a[i].writer;\n      if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){\n        sqlite3Fts5PoslistWriterAppend(a[i].pOut, pWriter, iPos);\n      }\n    }\n\n    iAdv = 0;\n    iMin = a[0].reader.iLookahead;\n    for(i=0; i<pNear->nPhrase; i++){\n      if( a[i].reader.iLookahead < iMin ){\n        iMin = a[i].reader.iLookahead;\n        iAdv = i;\n      }\n    }\n    if( fts5LookaheadReaderNext(&a[iAdv].reader) ) goto ismatch_out;\n  }\n\n  ismatch_out: {\n    int bRet = a[0].pOut->n>0;\n    *pRc = rc;\n    if( a!=aStatic ) sqlite3_free(a);\n    return bRet;\n  }\n}\n\n/*\n** Advance iterator pIter until it points to a value equal to or laster\n** than the initial value of *piLast. If this means the iterator points\n** to a value laster than *piLast, update *piLast to the new lastest value.\n**\n** If the iterator reaches EOF, set *pbEof to true before returning. If\n** an error occurs, set *pRc to an error code. If either *pbEof or *pRc\n** are set, return a non-zero value. Otherwise, return zero.\n*/\nstatic int fts5ExprAdvanceto(\n  Fts5IndexIter *pIter,           /* Iterator to advance */\n  int bDesc,                      /* True if iterator is \"rowid DESC\" */\n  i64 *piLast,                    /* IN/OUT: Lastest rowid seen so far */\n  int *pRc,                       /* OUT: Error code */\n  int *pbEof                      /* OUT: Set to true if EOF */\n){\n  i64 iLast = *piLast;\n  i64 iRowid;\n\n  iRowid = pIter->iRowid;\n  if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast<iRowid) ){\n    int rc = sqlite3Fts5IterNextFrom(pIter, iLast);\n    if( rc || sqlite3Fts5IterEof(pIter) ){\n      *pRc = rc;\n      *pbEof = 1;\n      return 1;\n    }\n    iRowid = pIter->iRowid;\n    assert( (bDesc==0 && iRowid>=iLast) || (bDesc==1 && iRowid<=iLast) );\n  }\n  *piLast = iRowid;\n\n  return 0;\n}\n\nstatic int fts5ExprSynonymAdvanceto(\n  Fts5ExprTerm *pTerm,            /* Term iterator to advance */\n  int bDesc,                      /* True if iterator is \"rowid DESC\" */\n  i64 *piLast,                    /* IN/OUT: Lastest rowid seen so far */\n  int *pRc                        /* OUT: Error code */\n){\n  int rc = SQLITE_OK;\n  i64 iLast = *piLast;\n  Fts5ExprTerm *p;\n  int bEof = 0;\n\n  for(p=pTerm; rc==SQLITE_OK && p; p=p->pSynonym){\n    if( sqlite3Fts5IterEof(p->pIter)==0 ){\n      i64 iRowid = p->pIter->iRowid;\n      if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast<iRowid) ){\n        rc = sqlite3Fts5IterNextFrom(p->pIter, iLast);\n      }\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    *pRc = rc;\n    bEof = 1;\n  }else{\n    *piLast = fts5ExprSynonymRowid(pTerm, bDesc, &bEof);\n  }\n  return bEof;\n}\n\n\nstatic int fts5ExprNearTest(\n  int *pRc,\n  Fts5Expr *pExpr,                /* Expression that pNear is a part of */\n  Fts5ExprNode *pNode             /* The \"NEAR\" node (FTS5_STRING) */\n){\n  Fts5ExprNearset *pNear = pNode->pNear;\n  int rc = *pRc;\n\n  if( pExpr->pConfig->eDetail!=FTS5_DETAIL_FULL ){\n    Fts5ExprTerm *pTerm;\n    Fts5ExprPhrase *pPhrase = pNear->apPhrase[0];\n    pPhrase->poslist.n = 0;\n    for(pTerm=&pPhrase->aTerm[0]; pTerm; pTerm=pTerm->pSynonym){\n      Fts5IndexIter *pIter = pTerm->pIter;\n      if( sqlite3Fts5IterEof(pIter)==0 ){\n        if( pIter->iRowid==pNode->iRowid && pIter->nData>0 ){\n          pPhrase->poslist.n = 1;\n        }\n      }\n    }\n    return pPhrase->poslist.n;\n  }else{\n    int i;\n\n    /* Check that each phrase in the nearset matches the current row.\n    ** Populate the pPhrase->poslist buffers at the same time. If any\n    ** phrase is not a match, break out of the loop early.  */\n    for(i=0; rc==SQLITE_OK && i<pNear->nPhrase; i++){\n      Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];\n      if( pPhrase->nTerm>1 || pPhrase->aTerm[0].pSynonym || pNear->pColset ){\n        int bMatch = 0;\n        rc = fts5ExprPhraseIsMatch(pNode, pPhrase, &bMatch);\n        if( bMatch==0 ) break;\n      }else{\n        Fts5IndexIter *pIter = pPhrase->aTerm[0].pIter;\n        fts5BufferSet(&rc, &pPhrase->poslist, pIter->nData, pIter->pData);\n      }\n    }\n\n    *pRc = rc;\n    if( i==pNear->nPhrase && (i==1 || fts5ExprNearIsMatch(pRc, pNear)) ){\n      return 1;\n    }\n    return 0;\n  }\n}\n\n\n/*\n** Initialize all term iterators in the pNear object. If any term is found\n** to match no documents at all, return immediately without initializing any\n** further iterators.\n*/\nstatic int fts5ExprNearInitAll(\n  Fts5Expr *pExpr,\n  Fts5ExprNode *pNode\n){\n  Fts5ExprNearset *pNear = pNode->pNear;\n  int i, j;\n  int rc = SQLITE_OK;\n  int bEof = 1;\n\n  assert( pNode->bNomatch==0 );\n  for(i=0; rc==SQLITE_OK && i<pNear->nPhrase; i++){\n    Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];\n    for(j=0; j<pPhrase->nTerm; j++){\n      Fts5ExprTerm *pTerm = &pPhrase->aTerm[j];\n      Fts5ExprTerm *p;\n\n      for(p=pTerm; p && rc==SQLITE_OK; p=p->pSynonym){\n        if( p->pIter ){\n          sqlite3Fts5IterClose(p->pIter);\n          p->pIter = 0;\n        }\n        rc = sqlite3Fts5IndexQuery(\n            pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm),\n            (pTerm->bPrefix ? FTS5INDEX_QUERY_PREFIX : 0) |\n            (pExpr->bDesc ? FTS5INDEX_QUERY_DESC : 0),\n            pNear->pColset,\n            &p->pIter\n        );\n        assert( rc==SQLITE_OK || p->pIter==0 );\n        if( p->pIter && 0==sqlite3Fts5IterEof(p->pIter) ){\n          bEof = 0;\n        }\n      }\n\n      if( bEof ) break;\n    }\n    if( bEof ) break;\n  }\n\n  pNode->bEof = bEof;\n  return rc;\n}\n\n/*\n** If pExpr is an ASC iterator, this function returns a value with the\n** same sign as:\n**\n**   (iLhs - iRhs)\n**\n** Otherwise, if this is a DESC iterator, the opposite is returned:\n**\n**   (iRhs - iLhs)\n*/\nstatic int fts5RowidCmp(\n  Fts5Expr *pExpr,\n  i64 iLhs,\n  i64 iRhs\n){\n  assert( pExpr->bDesc==0 || pExpr->bDesc==1 );\n  if( pExpr->bDesc==0 ){\n    if( iLhs<iRhs ) return -1;\n    return (iLhs > iRhs);\n  }else{\n    if( iLhs>iRhs ) return -1;\n    return (iLhs < iRhs);\n  }\n}\n\nstatic void fts5ExprSetEof(Fts5ExprNode *pNode){\n  int i;\n  pNode->bEof = 1;\n  pNode->bNomatch = 0;\n  for(i=0; i<pNode->nChild; i++){\n    fts5ExprSetEof(pNode->apChild[i]);\n  }\n}\n\nstatic void fts5ExprNodeZeroPoslist(Fts5ExprNode *pNode){\n  if( pNode->eType==FTS5_STRING || pNode->eType==FTS5_TERM ){\n    Fts5ExprNearset *pNear = pNode->pNear;\n    int i;\n    for(i=0; i<pNear->nPhrase; i++){\n      Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];\n      pPhrase->poslist.n = 0;\n    }\n  }else{\n    int i;\n    for(i=0; i<pNode->nChild; i++){\n      fts5ExprNodeZeroPoslist(pNode->apChild[i]);\n    }\n  }\n}\n\n\n\n/*\n** Compare the values currently indicated by the two nodes as follows:\n**\n**    res = (*p1) - (*p2)\n**\n** Nodes that point to values that come later in the iteration order are\n** considered to be larger. Nodes at EOF are the largest of all.\n**\n** This means that if the iteration order is ASC, then numerically larger\n** rowids are considered larger. Or if it is the default DESC, numerically\n** smaller rowids are larger.\n*/\nstatic int fts5NodeCompare(\n  Fts5Expr *pExpr,\n  Fts5ExprNode *p1, \n  Fts5ExprNode *p2\n){\n  if( p2->bEof ) return -1;\n  if( p1->bEof ) return +1;\n  return fts5RowidCmp(pExpr, p1->iRowid, p2->iRowid);\n}\n\n/*\n** All individual term iterators in pNear are guaranteed to be valid when\n** this function is called. This function checks if all term iterators\n** point to the same rowid, and if not, advances them until they do.\n** If an EOF is reached before this happens, *pbEof is set to true before\n** returning.\n**\n** SQLITE_OK is returned if an error occurs, or an SQLite error code \n** otherwise. It is not considered an error code if an iterator reaches\n** EOF.\n*/\nstatic int fts5ExprNodeTest_STRING(\n  Fts5Expr *pExpr,                /* Expression pPhrase belongs to */\n  Fts5ExprNode *pNode\n){\n  Fts5ExprNearset *pNear = pNode->pNear;\n  Fts5ExprPhrase *pLeft = pNear->apPhrase[0];\n  int rc = SQLITE_OK;\n  i64 iLast;                      /* Lastest rowid any iterator points to */\n  int i, j;                       /* Phrase and token index, respectively */\n  int bMatch;                     /* True if all terms are at the same rowid */\n  const int bDesc = pExpr->bDesc;\n\n  /* Check that this node should not be FTS5_TERM */\n  assert( pNear->nPhrase>1 \n       || pNear->apPhrase[0]->nTerm>1 \n       || pNear->apPhrase[0]->aTerm[0].pSynonym\n  );\n\n  /* Initialize iLast, the \"lastest\" rowid any iterator points to. If the\n  ** iterator skips through rowids in the default ascending order, this means\n  ** the maximum rowid. Or, if the iterator is \"ORDER BY rowid DESC\", then it\n  ** means the minimum rowid.  */\n  if( pLeft->aTerm[0].pSynonym ){\n    iLast = fts5ExprSynonymRowid(&pLeft->aTerm[0], bDesc, 0);\n  }else{\n    iLast = pLeft->aTerm[0].pIter->iRowid;\n  }\n\n  do {\n    bMatch = 1;\n    for(i=0; i<pNear->nPhrase; i++){\n      Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];\n      for(j=0; j<pPhrase->nTerm; j++){\n        Fts5ExprTerm *pTerm = &pPhrase->aTerm[j];\n        if( pTerm->pSynonym ){\n          i64 iRowid = fts5ExprSynonymRowid(pTerm, bDesc, 0);\n          if( iRowid==iLast ) continue;\n          bMatch = 0;\n          if( fts5ExprSynonymAdvanceto(pTerm, bDesc, &iLast, &rc) ){\n            pNode->bNomatch = 0;\n            pNode->bEof = 1;\n            return rc;\n          }\n        }else{\n          Fts5IndexIter *pIter = pPhrase->aTerm[j].pIter;\n          if( pIter->iRowid==iLast || pIter->bEof ) continue;\n          bMatch = 0;\n          if( fts5ExprAdvanceto(pIter, bDesc, &iLast, &rc, &pNode->bEof) ){\n            return rc;\n          }\n        }\n      }\n    }\n  }while( bMatch==0 );\n\n  pNode->iRowid = iLast;\n  pNode->bNomatch = ((0==fts5ExprNearTest(&rc, pExpr, pNode)) && rc==SQLITE_OK);\n  assert( pNode->bEof==0 || pNode->bNomatch==0 );\n\n  return rc;\n}\n\n/*\n** Advance the first term iterator in the first phrase of pNear. Set output\n** variable *pbEof to true if it reaches EOF or if an error occurs.\n**\n** Return SQLITE_OK if successful, or an SQLite error code if an error\n** occurs.\n*/\nstatic int fts5ExprNodeNext_STRING(\n  Fts5Expr *pExpr,                /* Expression pPhrase belongs to */\n  Fts5ExprNode *pNode,            /* FTS5_STRING or FTS5_TERM node */\n  int bFromValid,\n  i64 iFrom \n){\n  Fts5ExprTerm *pTerm = &pNode->pNear->apPhrase[0]->aTerm[0];\n  int rc = SQLITE_OK;\n\n  pNode->bNomatch = 0;\n  if( pTerm->pSynonym ){\n    int bEof = 1;\n    Fts5ExprTerm *p;\n\n    /* Find the firstest rowid any synonym points to. */\n    i64 iRowid = fts5ExprSynonymRowid(pTerm, pExpr->bDesc, 0);\n\n    /* Advance each iterator that currently points to iRowid. Or, if iFrom\n    ** is valid - each iterator that points to a rowid before iFrom.  */\n    for(p=pTerm; p; p=p->pSynonym){\n      if( sqlite3Fts5IterEof(p->pIter)==0 ){\n        i64 ii = p->pIter->iRowid;\n        if( ii==iRowid \n         || (bFromValid && ii!=iFrom && (ii>iFrom)==pExpr->bDesc) \n        ){\n          if( bFromValid ){\n            rc = sqlite3Fts5IterNextFrom(p->pIter, iFrom);\n          }else{\n            rc = sqlite3Fts5IterNext(p->pIter);\n          }\n          if( rc!=SQLITE_OK ) break;\n          if( sqlite3Fts5IterEof(p->pIter)==0 ){\n            bEof = 0;\n          }\n        }else{\n          bEof = 0;\n        }\n      }\n    }\n\n    /* Set the EOF flag if either all synonym iterators are at EOF or an\n    ** error has occurred.  */\n    pNode->bEof = (rc || bEof);\n  }else{\n    Fts5IndexIter *pIter = pTerm->pIter;\n\n    assert( Fts5NodeIsString(pNode) );\n    if( bFromValid ){\n      rc = sqlite3Fts5IterNextFrom(pIter, iFrom);\n    }else{\n      rc = sqlite3Fts5IterNext(pIter);\n    }\n\n    pNode->bEof = (rc || sqlite3Fts5IterEof(pIter));\n  }\n\n  if( pNode->bEof==0 ){\n    assert( rc==SQLITE_OK );\n    rc = fts5ExprNodeTest_STRING(pExpr, pNode);\n  }\n\n  return rc;\n}\n\n\nstatic int fts5ExprNodeTest_TERM(\n  Fts5Expr *pExpr,                /* Expression that pNear is a part of */\n  Fts5ExprNode *pNode             /* The \"NEAR\" node (FTS5_TERM) */\n){\n  /* As this \"NEAR\" object is actually a single phrase that consists \n  ** of a single term only, grab pointers into the poslist managed by the\n  ** fts5_index.c iterator object. This is much faster than synthesizing \n  ** a new poslist the way we have to for more complicated phrase or NEAR\n  ** expressions.  */\n  Fts5ExprPhrase *pPhrase = pNode->pNear->apPhrase[0];\n  Fts5IndexIter *pIter = pPhrase->aTerm[0].pIter;\n\n  assert( pNode->eType==FTS5_TERM );\n  assert( pNode->pNear->nPhrase==1 && pPhrase->nTerm==1 );\n  assert( pPhrase->aTerm[0].pSynonym==0 );\n\n  pPhrase->poslist.n = pIter->nData;\n  if( pExpr->pConfig->eDetail==FTS5_DETAIL_FULL ){\n    pPhrase->poslist.p = (u8*)pIter->pData;\n  }\n  pNode->iRowid = pIter->iRowid;\n  pNode->bNomatch = (pPhrase->poslist.n==0);\n  return SQLITE_OK;\n}\n\n/*\n** xNext() method for a node of type FTS5_TERM.\n*/\nstatic int fts5ExprNodeNext_TERM(\n  Fts5Expr *pExpr, \n  Fts5ExprNode *pNode,\n  int bFromValid,\n  i64 iFrom\n){\n  int rc;\n  Fts5IndexIter *pIter = pNode->pNear->apPhrase[0]->aTerm[0].pIter;\n\n  assert( pNode->bEof==0 );\n  if( bFromValid ){\n    rc = sqlite3Fts5IterNextFrom(pIter, iFrom);\n  }else{\n    rc = sqlite3Fts5IterNext(pIter);\n  }\n  if( rc==SQLITE_OK && sqlite3Fts5IterEof(pIter)==0 ){\n    rc = fts5ExprNodeTest_TERM(pExpr, pNode);\n  }else{\n    pNode->bEof = 1;\n    pNode->bNomatch = 0;\n  }\n  return rc;\n}\n\nstatic void fts5ExprNodeTest_OR(\n  Fts5Expr *pExpr,                /* Expression of which pNode is a part */\n  Fts5ExprNode *pNode             /* Expression node to test */\n){\n  Fts5ExprNode *pNext = pNode->apChild[0];\n  int i;\n\n  for(i=1; i<pNode->nChild; i++){\n    Fts5ExprNode *pChild = pNode->apChild[i];\n    int cmp = fts5NodeCompare(pExpr, pNext, pChild);\n    if( cmp>0 || (cmp==0 && pChild->bNomatch==0) ){\n      pNext = pChild;\n    }\n  }\n  pNode->iRowid = pNext->iRowid;\n  pNode->bEof = pNext->bEof;\n  pNode->bNomatch = pNext->bNomatch;\n}\n\nstatic int fts5ExprNodeNext_OR(\n  Fts5Expr *pExpr, \n  Fts5ExprNode *pNode,\n  int bFromValid,\n  i64 iFrom\n){\n  int i;\n  i64 iLast = pNode->iRowid;\n\n  for(i=0; i<pNode->nChild; i++){\n    Fts5ExprNode *p1 = pNode->apChild[i];\n    assert( p1->bEof || fts5RowidCmp(pExpr, p1->iRowid, iLast)>=0 );\n    if( p1->bEof==0 ){\n      if( (p1->iRowid==iLast) \n       || (bFromValid && fts5RowidCmp(pExpr, p1->iRowid, iFrom)<0)\n      ){\n        int rc = fts5ExprNodeNext(pExpr, p1, bFromValid, iFrom);\n        if( rc!=SQLITE_OK ) return rc;\n      }\n    }\n  }\n\n  fts5ExprNodeTest_OR(pExpr, pNode);\n  return SQLITE_OK;\n}\n\n/*\n** Argument pNode is an FTS5_AND node.\n*/\nstatic int fts5ExprNodeTest_AND(\n  Fts5Expr *pExpr,                /* Expression pPhrase belongs to */\n  Fts5ExprNode *pAnd              /* FTS5_AND node to advance */\n){\n  int iChild;\n  i64 iLast = pAnd->iRowid;\n  int rc = SQLITE_OK;\n  int bMatch;\n\n  assert( pAnd->bEof==0 );\n  do {\n    pAnd->bNomatch = 0;\n    bMatch = 1;\n    for(iChild=0; iChild<pAnd->nChild; iChild++){\n      Fts5ExprNode *pChild = pAnd->apChild[iChild];\n      int cmp = fts5RowidCmp(pExpr, iLast, pChild->iRowid);\n      if( cmp>0 ){\n        /* Advance pChild until it points to iLast or laster */\n        rc = fts5ExprNodeNext(pExpr, pChild, 1, iLast);\n        if( rc!=SQLITE_OK ) return rc;\n      }\n\n      /* If the child node is now at EOF, so is the parent AND node. Otherwise,\n      ** the child node is guaranteed to have advanced at least as far as\n      ** rowid iLast. So if it is not at exactly iLast, pChild->iRowid is the\n      ** new lastest rowid seen so far.  */\n      assert( pChild->bEof || fts5RowidCmp(pExpr, iLast, pChild->iRowid)<=0 );\n      if( pChild->bEof ){\n        fts5ExprSetEof(pAnd);\n        bMatch = 1;\n        break;\n      }else if( iLast!=pChild->iRowid ){\n        bMatch = 0;\n        iLast = pChild->iRowid;\n      }\n\n      if( pChild->bNomatch ){\n        pAnd->bNomatch = 1;\n      }\n    }\n  }while( bMatch==0 );\n\n  if( pAnd->bNomatch && pAnd!=pExpr->pRoot ){\n    fts5ExprNodeZeroPoslist(pAnd);\n  }\n  pAnd->iRowid = iLast;\n  return SQLITE_OK;\n}\n\nstatic int fts5ExprNodeNext_AND(\n  Fts5Expr *pExpr, \n  Fts5ExprNode *pNode,\n  int bFromValid,\n  i64 iFrom\n){\n  int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);\n  if( rc==SQLITE_OK ){\n    rc = fts5ExprNodeTest_AND(pExpr, pNode);\n  }\n  return rc;\n}\n\nstatic int fts5ExprNodeTest_NOT(\n  Fts5Expr *pExpr,                /* Expression pPhrase belongs to */\n  Fts5ExprNode *pNode             /* FTS5_NOT node to advance */\n){\n  int rc = SQLITE_OK;\n  Fts5ExprNode *p1 = pNode->apChild[0];\n  Fts5ExprNode *p2 = pNode->apChild[1];\n  assert( pNode->nChild==2 );\n\n  while( rc==SQLITE_OK && p1->bEof==0 ){\n    int cmp = fts5NodeCompare(pExpr, p1, p2);\n    if( cmp>0 ){\n      rc = fts5ExprNodeNext(pExpr, p2, 1, p1->iRowid);\n      cmp = fts5NodeCompare(pExpr, p1, p2);\n    }\n    assert( rc!=SQLITE_OK || cmp<=0 );\n    if( cmp || p2->bNomatch ) break;\n    rc = fts5ExprNodeNext(pExpr, p1, 0, 0);\n  }\n  pNode->bEof = p1->bEof;\n  pNode->bNomatch = p1->bNomatch;\n  pNode->iRowid = p1->iRowid;\n  if( p1->bEof ){\n    fts5ExprNodeZeroPoslist(p2);\n  }\n  return rc;\n}\n\nstatic int fts5ExprNodeNext_NOT(\n  Fts5Expr *pExpr, \n  Fts5ExprNode *pNode,\n  int bFromValid,\n  i64 iFrom\n){\n  int rc = fts5ExprNodeNext(pExpr, pNode->apChild[0], bFromValid, iFrom);\n  if( rc==SQLITE_OK ){\n    rc = fts5ExprNodeTest_NOT(pExpr, pNode);\n  }\n  return rc;\n}\n\n/*\n** If pNode currently points to a match, this function returns SQLITE_OK\n** without modifying it. Otherwise, pNode is advanced until it does point\n** to a match or EOF is reached.\n*/\nstatic int fts5ExprNodeTest(\n  Fts5Expr *pExpr,                /* Expression of which pNode is a part */\n  Fts5ExprNode *pNode             /* Expression node to test */\n){\n  int rc = SQLITE_OK;\n  if( pNode->bEof==0 ){\n    switch( pNode->eType ){\n\n      case FTS5_STRING: {\n        rc = fts5ExprNodeTest_STRING(pExpr, pNode);\n        break;\n      }\n\n      case FTS5_TERM: {\n        rc = fts5ExprNodeTest_TERM(pExpr, pNode);\n        break;\n      }\n\n      case FTS5_AND: {\n        rc = fts5ExprNodeTest_AND(pExpr, pNode);\n        break;\n      }\n\n      case FTS5_OR: {\n        fts5ExprNodeTest_OR(pExpr, pNode);\n        break;\n      }\n\n      default: assert( pNode->eType==FTS5_NOT ); {\n        rc = fts5ExprNodeTest_NOT(pExpr, pNode);\n        break;\n      }\n    }\n  }\n  return rc;\n}\n\n \n/*\n** Set node pNode, which is part of expression pExpr, to point to the first\n** match. If there are no matches, set the Node.bEof flag to indicate EOF.\n**\n** Return an SQLite error code if an error occurs, or SQLITE_OK otherwise.\n** It is not an error if there are no matches.\n*/\nstatic int fts5ExprNodeFirst(Fts5Expr *pExpr, Fts5ExprNode *pNode){\n  int rc = SQLITE_OK;\n  pNode->bEof = 0;\n  pNode->bNomatch = 0;\n\n  if( Fts5NodeIsString(pNode) ){\n    /* Initialize all term iterators in the NEAR object. */\n    rc = fts5ExprNearInitAll(pExpr, pNode);\n  }else if( pNode->xNext==0 ){\n    pNode->bEof = 1;\n  }else{\n    int i;\n    int nEof = 0;\n    for(i=0; i<pNode->nChild && rc==SQLITE_OK; i++){\n      Fts5ExprNode *pChild = pNode->apChild[i];\n      rc = fts5ExprNodeFirst(pExpr, pNode->apChild[i]);\n      assert( pChild->bEof==0 || pChild->bEof==1 );\n      nEof += pChild->bEof;\n    }\n    pNode->iRowid = pNode->apChild[0]->iRowid;\n\n    switch( pNode->eType ){\n      case FTS5_AND:\n        if( nEof>0 ) fts5ExprSetEof(pNode);\n        break;\n\n      case FTS5_OR:\n        if( pNode->nChild==nEof ) fts5ExprSetEof(pNode);\n        break;\n\n      default:\n        assert( pNode->eType==FTS5_NOT );\n        pNode->bEof = pNode->apChild[0]->bEof;\n        break;\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = fts5ExprNodeTest(pExpr, pNode);\n  }\n  return rc;\n}\n\n\n/*\n** Begin iterating through the set of documents in index pIdx matched by\n** the MATCH expression passed as the first argument. If the \"bDesc\" \n** parameter is passed a non-zero value, iteration is in descending rowid \n** order. Or, if it is zero, in ascending order.\n**\n** If iterating in ascending rowid order (bDesc==0), the first document\n** visited is that with the smallest rowid that is larger than or equal\n** to parameter iFirst. Or, if iterating in ascending order (bDesc==1),\n** then the first document visited must have a rowid smaller than or\n** equal to iFirst.\n**\n** Return SQLITE_OK if successful, or an SQLite error code otherwise. It\n** is not considered an error if the query does not match any documents.\n*/\nstatic int sqlite3Fts5ExprFirst(Fts5Expr *p, Fts5Index *pIdx, i64 iFirst, int bDesc){\n  Fts5ExprNode *pRoot = p->pRoot;\n  int rc;                         /* Return code */\n\n  p->pIndex = pIdx;\n  p->bDesc = bDesc;\n  rc = fts5ExprNodeFirst(p, pRoot);\n\n  /* If not at EOF but the current rowid occurs earlier than iFirst in\n  ** the iteration order, move to document iFirst or later. */\n  if( pRoot->bEof==0 && fts5RowidCmp(p, pRoot->iRowid, iFirst)<0 ){\n    rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);\n  }\n\n  /* If the iterator is not at a real match, skip forward until it is. */\n  while( pRoot->bNomatch ){\n    assert( pRoot->bEof==0 && rc==SQLITE_OK );\n    rc = fts5ExprNodeNext(p, pRoot, 0, 0);\n  }\n  return rc;\n}\n\n/*\n** Move to the next document \n**\n** Return SQLITE_OK if successful, or an SQLite error code otherwise. It\n** is not considered an error if the query does not match any documents.\n*/\nstatic int sqlite3Fts5ExprNext(Fts5Expr *p, i64 iLast){\n  int rc;\n  Fts5ExprNode *pRoot = p->pRoot;\n  assert( pRoot->bEof==0 && pRoot->bNomatch==0 );\n  do {\n    rc = fts5ExprNodeNext(p, pRoot, 0, 0);\n    assert( pRoot->bNomatch==0 || (rc==SQLITE_OK && pRoot->bEof==0) );\n  }while( pRoot->bNomatch );\n  if( fts5RowidCmp(p, pRoot->iRowid, iLast)>0 ){\n    pRoot->bEof = 1;\n  }\n  return rc;\n}\n\nstatic int sqlite3Fts5ExprEof(Fts5Expr *p){\n  return p->pRoot->bEof;\n}\n\nstatic i64 sqlite3Fts5ExprRowid(Fts5Expr *p){\n  return p->pRoot->iRowid;\n}\n\nstatic int fts5ParseStringFromToken(Fts5Token *pToken, char **pz){\n  int rc = SQLITE_OK;\n  *pz = sqlite3Fts5Strndup(&rc, pToken->p, pToken->n);\n  return rc;\n}\n\n/*\n** Free the phrase object passed as the only argument.\n*/\nstatic void fts5ExprPhraseFree(Fts5ExprPhrase *pPhrase){\n  if( pPhrase ){\n    int i;\n    for(i=0; i<pPhrase->nTerm; i++){\n      Fts5ExprTerm *pSyn;\n      Fts5ExprTerm *pNext;\n      Fts5ExprTerm *pTerm = &pPhrase->aTerm[i];\n      sqlite3_free(pTerm->zTerm);\n      sqlite3Fts5IterClose(pTerm->pIter);\n      for(pSyn=pTerm->pSynonym; pSyn; pSyn=pNext){\n        pNext = pSyn->pSynonym;\n        sqlite3Fts5IterClose(pSyn->pIter);\n        fts5BufferFree((Fts5Buffer*)&pSyn[1]);\n        sqlite3_free(pSyn);\n      }\n    }\n    if( pPhrase->poslist.nSpace>0 ) fts5BufferFree(&pPhrase->poslist);\n    sqlite3_free(pPhrase);\n  }\n}\n\n/*\n** If argument pNear is NULL, then a new Fts5ExprNearset object is allocated\n** and populated with pPhrase. Or, if pNear is not NULL, phrase pPhrase is\n** appended to it and the results returned.\n**\n** If an OOM error occurs, both the pNear and pPhrase objects are freed and\n** NULL returned.\n*/\nstatic Fts5ExprNearset *sqlite3Fts5ParseNearset(\n  Fts5Parse *pParse,              /* Parse context */\n  Fts5ExprNearset *pNear,         /* Existing nearset, or NULL */\n  Fts5ExprPhrase *pPhrase         /* Recently parsed phrase */\n){\n  const int SZALLOC = 8;\n  Fts5ExprNearset *pRet = 0;\n\n  if( pParse->rc==SQLITE_OK ){\n    if( pPhrase==0 ){\n      return pNear;\n    }\n    if( pNear==0 ){\n      int nByte = sizeof(Fts5ExprNearset) + SZALLOC * sizeof(Fts5ExprPhrase*);\n      pRet = sqlite3_malloc(nByte);\n      if( pRet==0 ){\n        pParse->rc = SQLITE_NOMEM;\n      }else{\n        memset(pRet, 0, nByte);\n      }\n    }else if( (pNear->nPhrase % SZALLOC)==0 ){\n      int nNew = pNear->nPhrase + SZALLOC;\n      int nByte = sizeof(Fts5ExprNearset) + nNew * sizeof(Fts5ExprPhrase*);\n\n      pRet = (Fts5ExprNearset*)sqlite3_realloc(pNear, nByte);\n      if( pRet==0 ){\n        pParse->rc = SQLITE_NOMEM;\n      }\n    }else{\n      pRet = pNear;\n    }\n  }\n\n  if( pRet==0 ){\n    assert( pParse->rc!=SQLITE_OK );\n    sqlite3Fts5ParseNearsetFree(pNear);\n    sqlite3Fts5ParsePhraseFree(pPhrase);\n  }else{\n    if( pRet->nPhrase>0 ){\n      Fts5ExprPhrase *pLast = pRet->apPhrase[pRet->nPhrase-1];\n      assert( pLast==pParse->apPhrase[pParse->nPhrase-2] );\n      if( pPhrase->nTerm==0 ){\n        fts5ExprPhraseFree(pPhrase);\n        pRet->nPhrase--;\n        pParse->nPhrase--;\n        pPhrase = pLast;\n      }else if( pLast->nTerm==0 ){\n        fts5ExprPhraseFree(pLast);\n        pParse->apPhrase[pParse->nPhrase-2] = pPhrase;\n        pParse->nPhrase--;\n        pRet->nPhrase--;\n      }\n    }\n    pRet->apPhrase[pRet->nPhrase++] = pPhrase;\n  }\n  return pRet;\n}\n\ntypedef struct TokenCtx TokenCtx;\nstruct TokenCtx {\n  Fts5ExprPhrase *pPhrase;\n  int rc;\n};\n\n/*\n** Callback for tokenizing terms used by ParseTerm().\n*/\nstatic int fts5ParseTokenize(\n  void *pContext,                 /* Pointer to Fts5InsertCtx object */\n  int tflags,                     /* Mask of FTS5_TOKEN_* flags */\n  const char *pToken,             /* Buffer containing token */\n  int nToken,                     /* Size of token in bytes */\n  int iUnused1,                   /* Start offset of token */\n  int iUnused2                    /* End offset of token */\n){\n  int rc = SQLITE_OK;\n  const int SZALLOC = 8;\n  TokenCtx *pCtx = (TokenCtx*)pContext;\n  Fts5ExprPhrase *pPhrase = pCtx->pPhrase;\n\n  UNUSED_PARAM2(iUnused1, iUnused2);\n\n  /* If an error has already occurred, this is a no-op */\n  if( pCtx->rc!=SQLITE_OK ) return pCtx->rc;\n  if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;\n\n  if( pPhrase && pPhrase->nTerm>0 && (tflags & FTS5_TOKEN_COLOCATED) ){\n    Fts5ExprTerm *pSyn;\n    int nByte = sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer) + nToken+1;\n    pSyn = (Fts5ExprTerm*)sqlite3_malloc(nByte);\n    if( pSyn==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      memset(pSyn, 0, nByte);\n      pSyn->zTerm = ((char*)pSyn) + sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer);\n      memcpy(pSyn->zTerm, pToken, nToken);\n      pSyn->pSynonym = pPhrase->aTerm[pPhrase->nTerm-1].pSynonym;\n      pPhrase->aTerm[pPhrase->nTerm-1].pSynonym = pSyn;\n    }\n  }else{\n    Fts5ExprTerm *pTerm;\n    if( pPhrase==0 || (pPhrase->nTerm % SZALLOC)==0 ){\n      Fts5ExprPhrase *pNew;\n      int nNew = SZALLOC + (pPhrase ? pPhrase->nTerm : 0);\n\n      pNew = (Fts5ExprPhrase*)sqlite3_realloc(pPhrase, \n          sizeof(Fts5ExprPhrase) + sizeof(Fts5ExprTerm) * nNew\n      );\n      if( pNew==0 ){\n        rc = SQLITE_NOMEM;\n      }else{\n        if( pPhrase==0 ) memset(pNew, 0, sizeof(Fts5ExprPhrase));\n        pCtx->pPhrase = pPhrase = pNew;\n        pNew->nTerm = nNew - SZALLOC;\n      }\n    }\n\n    if( rc==SQLITE_OK ){\n      pTerm = &pPhrase->aTerm[pPhrase->nTerm++];\n      memset(pTerm, 0, sizeof(Fts5ExprTerm));\n      pTerm->zTerm = sqlite3Fts5Strndup(&rc, pToken, nToken);\n    }\n  }\n\n  pCtx->rc = rc;\n  return rc;\n}\n\n\n/*\n** Free the phrase object passed as the only argument.\n*/\nstatic void sqlite3Fts5ParsePhraseFree(Fts5ExprPhrase *pPhrase){\n  fts5ExprPhraseFree(pPhrase);\n}\n\n/*\n** Free the phrase object passed as the second argument.\n*/\nstatic void sqlite3Fts5ParseNearsetFree(Fts5ExprNearset *pNear){\n  if( pNear ){\n    int i;\n    for(i=0; i<pNear->nPhrase; i++){\n      fts5ExprPhraseFree(pNear->apPhrase[i]);\n    }\n    sqlite3_free(pNear->pColset);\n    sqlite3_free(pNear);\n  }\n}\n\nstatic void sqlite3Fts5ParseFinished(Fts5Parse *pParse, Fts5ExprNode *p){\n  assert( pParse->pExpr==0 );\n  pParse->pExpr = p;\n}\n\n/*\n** This function is called by the parser to process a string token. The\n** string may or may not be quoted. In any case it is tokenized and a\n** phrase object consisting of all tokens returned.\n*/\nstatic Fts5ExprPhrase *sqlite3Fts5ParseTerm(\n  Fts5Parse *pParse,              /* Parse context */\n  Fts5ExprPhrase *pAppend,        /* Phrase to append to */\n  Fts5Token *pToken,              /* String to tokenize */\n  int bPrefix                     /* True if there is a trailing \"*\" */\n){\n  Fts5Config *pConfig = pParse->pConfig;\n  TokenCtx sCtx;                  /* Context object passed to callback */\n  int rc;                         /* Tokenize return code */\n  char *z = 0;\n\n  memset(&sCtx, 0, sizeof(TokenCtx));\n  sCtx.pPhrase = pAppend;\n\n  rc = fts5ParseStringFromToken(pToken, &z);\n  if( rc==SQLITE_OK ){\n    int flags = FTS5_TOKENIZE_QUERY | (bPrefix ? FTS5_TOKENIZE_QUERY : 0);\n    int n;\n    sqlite3Fts5Dequote(z);\n    n = (int)strlen(z);\n    rc = sqlite3Fts5Tokenize(pConfig, flags, z, n, &sCtx, fts5ParseTokenize);\n  }\n  sqlite3_free(z);\n  if( rc || (rc = sCtx.rc) ){\n    pParse->rc = rc;\n    fts5ExprPhraseFree(sCtx.pPhrase);\n    sCtx.pPhrase = 0;\n  }else{\n\n    if( pAppend==0 ){\n      if( (pParse->nPhrase % 8)==0 ){\n        int nByte = sizeof(Fts5ExprPhrase*) * (pParse->nPhrase + 8);\n        Fts5ExprPhrase **apNew;\n        apNew = (Fts5ExprPhrase**)sqlite3_realloc(pParse->apPhrase, nByte);\n        if( apNew==0 ){\n          pParse->rc = SQLITE_NOMEM;\n          fts5ExprPhraseFree(sCtx.pPhrase);\n          return 0;\n        }\n        pParse->apPhrase = apNew;\n      }\n      pParse->nPhrase++;\n    }\n\n    if( sCtx.pPhrase==0 ){\n      /* This happens when parsing a token or quoted phrase that contains\n      ** no token characters at all. (e.g ... MATCH '\"\"'). */\n      sCtx.pPhrase = sqlite3Fts5MallocZero(&pParse->rc, sizeof(Fts5ExprPhrase));\n    }else if( sCtx.pPhrase->nTerm ){\n      sCtx.pPhrase->aTerm[sCtx.pPhrase->nTerm-1].bPrefix = bPrefix;\n    }\n    pParse->apPhrase[pParse->nPhrase-1] = sCtx.pPhrase;\n  }\n\n  return sCtx.pPhrase;\n}\n\n/*\n** Create a new FTS5 expression by cloning phrase iPhrase of the\n** expression passed as the second argument.\n*/\nstatic int sqlite3Fts5ExprClonePhrase(\n  Fts5Expr *pExpr, \n  int iPhrase, \n  Fts5Expr **ppNew\n){\n  int rc = SQLITE_OK;             /* Return code */\n  Fts5ExprPhrase *pOrig;          /* The phrase extracted from pExpr */\n  Fts5Expr *pNew = 0;             /* Expression to return via *ppNew */\n  TokenCtx sCtx = {0,0};          /* Context object for fts5ParseTokenize */\n\n  pOrig = pExpr->apExprPhrase[iPhrase];\n  pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr));\n  if( rc==SQLITE_OK ){\n    pNew->apExprPhrase = (Fts5ExprPhrase**)sqlite3Fts5MallocZero(&rc, \n        sizeof(Fts5ExprPhrase*));\n  }\n  if( rc==SQLITE_OK ){\n    pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&rc, \n        sizeof(Fts5ExprNode));\n  }\n  if( rc==SQLITE_OK ){\n    pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc, \n        sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*));\n  }\n  if( rc==SQLITE_OK ){\n    Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset;\n    if( pColsetOrig ){\n      int nByte = sizeof(Fts5Colset) + (pColsetOrig->nCol-1) * sizeof(int);\n      Fts5Colset *pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte);\n      if( pColset ){ \n        memcpy(pColset, pColsetOrig, nByte);\n      }\n      pNew->pRoot->pNear->pColset = pColset;\n    }\n  }\n\n  if( pOrig->nTerm ){\n    int i;                          /* Used to iterate through phrase terms */\n    for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){\n      int tflags = 0;\n      Fts5ExprTerm *p;\n      for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){\n        const char *zTerm = p->zTerm;\n        rc = fts5ParseTokenize((void*)&sCtx, tflags, zTerm, (int)strlen(zTerm),\n            0, 0);\n        tflags = FTS5_TOKEN_COLOCATED;\n      }\n      if( rc==SQLITE_OK ){\n        sCtx.pPhrase->aTerm[i].bPrefix = pOrig->aTerm[i].bPrefix;\n      }\n    }\n  }else{\n    /* This happens when parsing a token or quoted phrase that contains\n    ** no token characters at all. (e.g ... MATCH '\"\"'). */\n    sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase));\n  }\n\n  if( rc==SQLITE_OK ){\n    /* All the allocations succeeded. Put the expression object together. */\n    pNew->pIndex = pExpr->pIndex;\n    pNew->pConfig = pExpr->pConfig;\n    pNew->nPhrase = 1;\n    pNew->apExprPhrase[0] = sCtx.pPhrase;\n    pNew->pRoot->pNear->apPhrase[0] = sCtx.pPhrase;\n    pNew->pRoot->pNear->nPhrase = 1;\n    sCtx.pPhrase->pNode = pNew->pRoot;\n\n    if( pOrig->nTerm==1 && pOrig->aTerm[0].pSynonym==0 ){\n      pNew->pRoot->eType = FTS5_TERM;\n      pNew->pRoot->xNext = fts5ExprNodeNext_TERM;\n    }else{\n      pNew->pRoot->eType = FTS5_STRING;\n      pNew->pRoot->xNext = fts5ExprNodeNext_STRING;\n    }\n  }else{\n    sqlite3Fts5ExprFree(pNew);\n    fts5ExprPhraseFree(sCtx.pPhrase);\n    pNew = 0;\n  }\n\n  *ppNew = pNew;\n  return rc;\n}\n\n\n/*\n** Token pTok has appeared in a MATCH expression where the NEAR operator\n** is expected. If token pTok does not contain \"NEAR\", store an error\n** in the pParse object.\n*/\nstatic void sqlite3Fts5ParseNear(Fts5Parse *pParse, Fts5Token *pTok){\n  if( pTok->n!=4 || memcmp(\"NEAR\", pTok->p, 4) ){\n    sqlite3Fts5ParseError(\n        pParse, \"fts5: syntax error near \\\"%.*s\\\"\", pTok->n, pTok->p\n    );\n  }\n}\n\nstatic void sqlite3Fts5ParseSetDistance(\n  Fts5Parse *pParse, \n  Fts5ExprNearset *pNear,\n  Fts5Token *p\n){\n  if( pNear ){\n    int nNear = 0;\n    int i;\n    if( p->n ){\n      for(i=0; i<p->n; i++){\n        char c = (char)p->p[i];\n        if( c<'0' || c>'9' ){\n          sqlite3Fts5ParseError(\n              pParse, \"expected integer, got \\\"%.*s\\\"\", p->n, p->p\n              );\n          return;\n        }\n        nNear = nNear * 10 + (p->p[i] - '0');\n      }\n    }else{\n      nNear = FTS5_DEFAULT_NEARDIST;\n    }\n    pNear->nNear = nNear;\n  }\n}\n\n/*\n** The second argument passed to this function may be NULL, or it may be\n** an existing Fts5Colset object. This function returns a pointer to\n** a new colset object containing the contents of (p) with new value column\n** number iCol appended. \n**\n** If an OOM error occurs, store an error code in pParse and return NULL.\n** The old colset object (if any) is not freed in this case.\n*/\nstatic Fts5Colset *fts5ParseColset(\n  Fts5Parse *pParse,              /* Store SQLITE_NOMEM here if required */\n  Fts5Colset *p,                  /* Existing colset object */\n  int iCol                        /* New column to add to colset object */\n){\n  int nCol = p ? p->nCol : 0;     /* Num. columns already in colset object */\n  Fts5Colset *pNew;               /* New colset object to return */\n\n  assert( pParse->rc==SQLITE_OK );\n  assert( iCol>=0 && iCol<pParse->pConfig->nCol );\n\n  pNew = sqlite3_realloc(p, sizeof(Fts5Colset) + sizeof(int)*nCol);\n  if( pNew==0 ){\n    pParse->rc = SQLITE_NOMEM;\n  }else{\n    int *aiCol = pNew->aiCol;\n    int i, j;\n    for(i=0; i<nCol; i++){\n      if( aiCol[i]==iCol ) return pNew;\n      if( aiCol[i]>iCol ) break;\n    }\n    for(j=nCol; j>i; j--){\n      aiCol[j] = aiCol[j-1];\n    }\n    aiCol[i] = iCol;\n    pNew->nCol = nCol+1;\n\n#ifndef NDEBUG\n    /* Check that the array is in order and contains no duplicate entries. */\n    for(i=1; i<pNew->nCol; i++) assert( pNew->aiCol[i]>pNew->aiCol[i-1] );\n#endif\n  }\n\n  return pNew;\n}\n\n/*\n** Allocate and return an Fts5Colset object specifying the inverse of\n** the colset passed as the second argument. Free the colset passed\n** as the second argument before returning.\n*/\nstatic Fts5Colset *sqlite3Fts5ParseColsetInvert(Fts5Parse *pParse, Fts5Colset *p){\n  Fts5Colset *pRet;\n  int nCol = pParse->pConfig->nCol;\n\n  pRet = (Fts5Colset*)sqlite3Fts5MallocZero(&pParse->rc, \n      sizeof(Fts5Colset) + sizeof(int)*nCol\n  );\n  if( pRet ){\n    int i;\n    int iOld = 0;\n    for(i=0; i<nCol; i++){\n      if( iOld>=p->nCol || p->aiCol[iOld]!=i ){\n        pRet->aiCol[pRet->nCol++] = i;\n      }else{\n        iOld++;\n      }\n    }\n  }\n\n  sqlite3_free(p);\n  return pRet;\n}\n\nstatic Fts5Colset *sqlite3Fts5ParseColset(\n  Fts5Parse *pParse,              /* Store SQLITE_NOMEM here if required */\n  Fts5Colset *pColset,            /* Existing colset object */\n  Fts5Token *p\n){\n  Fts5Colset *pRet = 0;\n  int iCol;\n  char *z;                        /* Dequoted copy of token p */\n\n  z = sqlite3Fts5Strndup(&pParse->rc, p->p, p->n);\n  if( pParse->rc==SQLITE_OK ){\n    Fts5Config *pConfig = pParse->pConfig;\n    sqlite3Fts5Dequote(z);\n    for(iCol=0; iCol<pConfig->nCol; iCol++){\n      if( 0==sqlite3_stricmp(pConfig->azCol[iCol], z) ) break;\n    }\n    if( iCol==pConfig->nCol ){\n      sqlite3Fts5ParseError(pParse, \"no such column: %s\", z);\n    }else{\n      pRet = fts5ParseColset(pParse, pColset, iCol);\n    }\n    sqlite3_free(z);\n  }\n\n  if( pRet==0 ){\n    assert( pParse->rc!=SQLITE_OK );\n    sqlite3_free(pColset);\n  }\n\n  return pRet;\n}\n\nstatic void sqlite3Fts5ParseSetColset(\n  Fts5Parse *pParse, \n  Fts5ExprNearset *pNear, \n  Fts5Colset *pColset \n){\n  if( pParse->pConfig->eDetail==FTS5_DETAIL_NONE ){\n    pParse->rc = SQLITE_ERROR;\n    pParse->zErr = sqlite3_mprintf(\n      \"fts5: column queries are not supported (detail=none)\"\n    );\n    sqlite3_free(pColset);\n    return;\n  }\n\n  if( pNear ){\n    pNear->pColset = pColset;\n  }else{\n    sqlite3_free(pColset);\n  }\n}\n\nstatic void fts5ExprAssignXNext(Fts5ExprNode *pNode){\n  switch( pNode->eType ){\n    case FTS5_STRING: {\n      Fts5ExprNearset *pNear = pNode->pNear;\n      if( pNear->nPhrase==1 && pNear->apPhrase[0]->nTerm==1 \n       && pNear->apPhrase[0]->aTerm[0].pSynonym==0\n      ){\n        pNode->eType = FTS5_TERM;\n        pNode->xNext = fts5ExprNodeNext_TERM;\n      }else{\n        pNode->xNext = fts5ExprNodeNext_STRING;\n      }\n      break;\n    };\n\n    case FTS5_OR: {\n      pNode->xNext = fts5ExprNodeNext_OR;\n      break;\n    };\n\n    case FTS5_AND: {\n      pNode->xNext = fts5ExprNodeNext_AND;\n      break;\n    };\n\n    default: assert( pNode->eType==FTS5_NOT ); {\n      pNode->xNext = fts5ExprNodeNext_NOT;\n      break;\n    };\n  }\n}\n\nstatic void fts5ExprAddChildren(Fts5ExprNode *p, Fts5ExprNode *pSub){\n  if( p->eType!=FTS5_NOT && pSub->eType==p->eType ){\n    int nByte = sizeof(Fts5ExprNode*) * pSub->nChild;\n    memcpy(&p->apChild[p->nChild], pSub->apChild, nByte);\n    p->nChild += pSub->nChild;\n    sqlite3_free(pSub);\n  }else{\n    p->apChild[p->nChild++] = pSub;\n  }\n}\n\n/*\n** Allocate and return a new expression object. If anything goes wrong (i.e.\n** OOM error), leave an error code in pParse and return NULL.\n*/\nstatic Fts5ExprNode *sqlite3Fts5ParseNode(\n  Fts5Parse *pParse,              /* Parse context */\n  int eType,                      /* FTS5_STRING, AND, OR or NOT */\n  Fts5ExprNode *pLeft,            /* Left hand child expression */\n  Fts5ExprNode *pRight,           /* Right hand child expression */\n  Fts5ExprNearset *pNear          /* For STRING expressions, the near cluster */\n){\n  Fts5ExprNode *pRet = 0;\n\n  if( pParse->rc==SQLITE_OK ){\n    int nChild = 0;               /* Number of children of returned node */\n    int nByte;                    /* Bytes of space to allocate for this node */\n \n    assert( (eType!=FTS5_STRING && !pNear)\n         || (eType==FTS5_STRING && !pLeft && !pRight)\n    );\n    if( eType==FTS5_STRING && pNear==0 ) return 0;\n    if( eType!=FTS5_STRING && pLeft==0 ) return pRight;\n    if( eType!=FTS5_STRING && pRight==0 ) return pLeft;\n\n    if( eType==FTS5_NOT ){\n      nChild = 2;\n    }else if( eType==FTS5_AND || eType==FTS5_OR ){\n      nChild = 2;\n      if( pLeft->eType==eType ) nChild += pLeft->nChild-1;\n      if( pRight->eType==eType ) nChild += pRight->nChild-1;\n    }\n\n    nByte = sizeof(Fts5ExprNode) + sizeof(Fts5ExprNode*)*(nChild-1);\n    pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);\n\n    if( pRet ){\n      pRet->eType = eType;\n      pRet->pNear = pNear;\n      fts5ExprAssignXNext(pRet);\n      if( eType==FTS5_STRING ){\n        int iPhrase;\n        for(iPhrase=0; iPhrase<pNear->nPhrase; iPhrase++){\n          pNear->apPhrase[iPhrase]->pNode = pRet;\n          if( pNear->apPhrase[iPhrase]->nTerm==0 ){\n            pRet->xNext = 0;\n            pRet->eType = FTS5_EOF;\n          }\n        }\n\n        if( pParse->pConfig->eDetail!=FTS5_DETAIL_FULL \n         && (pNear->nPhrase!=1 || pNear->apPhrase[0]->nTerm>1)\n        ){\n          assert( pParse->rc==SQLITE_OK );\n          pParse->rc = SQLITE_ERROR;\n          assert( pParse->zErr==0 );\n          pParse->zErr = sqlite3_mprintf(\n              \"fts5: %s queries are not supported (detail!=full)\", \n              pNear->nPhrase==1 ? \"phrase\": \"NEAR\"\n          );\n          sqlite3_free(pRet);\n          pRet = 0;\n        }\n\n      }else{\n        fts5ExprAddChildren(pRet, pLeft);\n        fts5ExprAddChildren(pRet, pRight);\n      }\n    }\n  }\n\n  if( pRet==0 ){\n    assert( pParse->rc!=SQLITE_OK );\n    sqlite3Fts5ParseNodeFree(pLeft);\n    sqlite3Fts5ParseNodeFree(pRight);\n    sqlite3Fts5ParseNearsetFree(pNear);\n  }\n  return pRet;\n}\n\nstatic Fts5ExprNode *sqlite3Fts5ParseImplicitAnd(\n  Fts5Parse *pParse,              /* Parse context */\n  Fts5ExprNode *pLeft,            /* Left hand child expression */\n  Fts5ExprNode *pRight            /* Right hand child expression */\n){\n  Fts5ExprNode *pRet = 0;\n  Fts5ExprNode *pPrev;\n\n  if( pParse->rc ){\n    sqlite3Fts5ParseNodeFree(pLeft);\n    sqlite3Fts5ParseNodeFree(pRight);\n  }else{\n\n    assert( pLeft->eType==FTS5_STRING \n        || pLeft->eType==FTS5_TERM\n        || pLeft->eType==FTS5_EOF\n        || pLeft->eType==FTS5_AND\n    );\n    assert( pRight->eType==FTS5_STRING \n        || pRight->eType==FTS5_TERM \n        || pRight->eType==FTS5_EOF \n    );\n\n    if( pLeft->eType==FTS5_AND ){\n      pPrev = pLeft->apChild[pLeft->nChild-1];\n    }else{\n      pPrev = pLeft;\n    }\n    assert( pPrev->eType==FTS5_STRING \n        || pPrev->eType==FTS5_TERM \n        || pPrev->eType==FTS5_EOF \n        );\n\n    if( pRight->eType==FTS5_EOF ){\n      assert( pParse->apPhrase[pParse->nPhrase-1]==pRight->pNear->apPhrase[0] );\n      sqlite3Fts5ParseNodeFree(pRight);\n      pRet = pLeft;\n      pParse->nPhrase--;\n    }\n    else if( pPrev->eType==FTS5_EOF ){\n      Fts5ExprPhrase **ap;\n\n      if( pPrev==pLeft ){\n        pRet = pRight;\n      }else{\n        pLeft->apChild[pLeft->nChild-1] = pRight;\n        pRet = pLeft;\n      }\n\n      ap = &pParse->apPhrase[pParse->nPhrase-1-pRight->pNear->nPhrase];\n      assert( ap[0]==pPrev->pNear->apPhrase[0] );\n      memmove(ap, &ap[1], sizeof(Fts5ExprPhrase*)*pRight->pNear->nPhrase);\n      pParse->nPhrase--;\n\n      sqlite3Fts5ParseNodeFree(pPrev);\n    }\n    else{\n      pRet = sqlite3Fts5ParseNode(pParse, FTS5_AND, pLeft, pRight, 0);\n    }\n  }\n\n  return pRet;\n}\n\nstatic char *fts5ExprTermPrint(Fts5ExprTerm *pTerm){\n  int nByte = 0;\n  Fts5ExprTerm *p;\n  char *zQuoted;\n\n  /* Determine the maximum amount of space required. */\n  for(p=pTerm; p; p=p->pSynonym){\n    nByte += (int)strlen(pTerm->zTerm) * 2 + 3 + 2;\n  }\n  zQuoted = sqlite3_malloc(nByte);\n\n  if( zQuoted ){\n    int i = 0;\n    for(p=pTerm; p; p=p->pSynonym){\n      char *zIn = p->zTerm;\n      zQuoted[i++] = '\"';\n      while( *zIn ){\n        if( *zIn=='\"' ) zQuoted[i++] = '\"';\n        zQuoted[i++] = *zIn++;\n      }\n      zQuoted[i++] = '\"';\n      if( p->pSynonym ) zQuoted[i++] = '|';\n    }\n    if( pTerm->bPrefix ){\n      zQuoted[i++] = ' ';\n      zQuoted[i++] = '*';\n    }\n    zQuoted[i++] = '\\0';\n  }\n  return zQuoted;\n}\n\nstatic char *fts5PrintfAppend(char *zApp, const char *zFmt, ...){\n  char *zNew;\n  va_list ap;\n  va_start(ap, zFmt);\n  zNew = sqlite3_vmprintf(zFmt, ap);\n  va_end(ap);\n  if( zApp && zNew ){\n    char *zNew2 = sqlite3_mprintf(\"%s%s\", zApp, zNew);\n    sqlite3_free(zNew);\n    zNew = zNew2;\n  }\n  sqlite3_free(zApp);\n  return zNew;\n}\n\n/*\n** Compose a tcl-readable representation of expression pExpr. Return a \n** pointer to a buffer containing that representation. It is the \n** responsibility of the caller to at some point free the buffer using \n** sqlite3_free().\n*/\nstatic char *fts5ExprPrintTcl(\n  Fts5Config *pConfig, \n  const char *zNearsetCmd,\n  Fts5ExprNode *pExpr\n){\n  char *zRet = 0;\n  if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){\n    Fts5ExprNearset *pNear = pExpr->pNear;\n    int i; \n    int iTerm;\n\n    zRet = fts5PrintfAppend(zRet, \"%s \", zNearsetCmd);\n    if( zRet==0 ) return 0;\n    if( pNear->pColset ){\n      int *aiCol = pNear->pColset->aiCol;\n      int nCol = pNear->pColset->nCol;\n      if( nCol==1 ){\n        zRet = fts5PrintfAppend(zRet, \"-col %d \", aiCol[0]);\n      }else{\n        zRet = fts5PrintfAppend(zRet, \"-col {%d\", aiCol[0]);\n        for(i=1; i<pNear->pColset->nCol; i++){\n          zRet = fts5PrintfAppend(zRet, \" %d\", aiCol[i]);\n        }\n        zRet = fts5PrintfAppend(zRet, \"} \");\n      }\n      if( zRet==0 ) return 0;\n    }\n\n    if( pNear->nPhrase>1 ){\n      zRet = fts5PrintfAppend(zRet, \"-near %d \", pNear->nNear);\n      if( zRet==0 ) return 0;\n    }\n\n    zRet = fts5PrintfAppend(zRet, \"--\");\n    if( zRet==0 ) return 0;\n\n    for(i=0; i<pNear->nPhrase; i++){\n      Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];\n\n      zRet = fts5PrintfAppend(zRet, \" {\");\n      for(iTerm=0; zRet && iTerm<pPhrase->nTerm; iTerm++){\n        char *zTerm = pPhrase->aTerm[iTerm].zTerm;\n        zRet = fts5PrintfAppend(zRet, \"%s%s\", iTerm==0?\"\":\" \", zTerm);\n        if( pPhrase->aTerm[iTerm].bPrefix ){\n          zRet = fts5PrintfAppend(zRet, \"*\");\n        }\n      }\n\n      if( zRet ) zRet = fts5PrintfAppend(zRet, \"}\");\n      if( zRet==0 ) return 0;\n    }\n\n  }else{\n    char const *zOp = 0;\n    int i;\n    switch( pExpr->eType ){\n      case FTS5_AND: zOp = \"AND\"; break;\n      case FTS5_NOT: zOp = \"NOT\"; break;\n      default: \n        assert( pExpr->eType==FTS5_OR );\n        zOp = \"OR\"; \n        break;\n    }\n\n    zRet = sqlite3_mprintf(\"%s\", zOp);\n    for(i=0; zRet && i<pExpr->nChild; i++){\n      char *z = fts5ExprPrintTcl(pConfig, zNearsetCmd, pExpr->apChild[i]);\n      if( !z ){\n        sqlite3_free(zRet);\n        zRet = 0;\n      }else{\n        zRet = fts5PrintfAppend(zRet, \" [%z]\", z);\n      }\n    }\n  }\n\n  return zRet;\n}\n\nstatic char *fts5ExprPrint(Fts5Config *pConfig, Fts5ExprNode *pExpr){\n  char *zRet = 0;\n  if( pExpr->eType==0 ){\n    return sqlite3_mprintf(\"\\\"\\\"\");\n  }else\n  if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){\n    Fts5ExprNearset *pNear = pExpr->pNear;\n    int i; \n    int iTerm;\n\n    if( pNear->pColset ){\n      int iCol = pNear->pColset->aiCol[0];\n      zRet = fts5PrintfAppend(zRet, \"%s : \", pConfig->azCol[iCol]);\n      if( zRet==0 ) return 0;\n    }\n\n    if( pNear->nPhrase>1 ){\n      zRet = fts5PrintfAppend(zRet, \"NEAR(\");\n      if( zRet==0 ) return 0;\n    }\n\n    for(i=0; i<pNear->nPhrase; i++){\n      Fts5ExprPhrase *pPhrase = pNear->apPhrase[i];\n      if( i!=0 ){\n        zRet = fts5PrintfAppend(zRet, \" \");\n        if( zRet==0 ) return 0;\n      }\n      for(iTerm=0; iTerm<pPhrase->nTerm; iTerm++){\n        char *zTerm = fts5ExprTermPrint(&pPhrase->aTerm[iTerm]);\n        if( zTerm ){\n          zRet = fts5PrintfAppend(zRet, \"%s%s\", iTerm==0?\"\":\" + \", zTerm);\n          sqlite3_free(zTerm);\n        }\n        if( zTerm==0 || zRet==0 ){\n          sqlite3_free(zRet);\n          return 0;\n        }\n      }\n    }\n\n    if( pNear->nPhrase>1 ){\n      zRet = fts5PrintfAppend(zRet, \", %d)\", pNear->nNear);\n      if( zRet==0 ) return 0;\n    }\n\n  }else{\n    char const *zOp = 0;\n    int i;\n\n    switch( pExpr->eType ){\n      case FTS5_AND: zOp = \" AND \"; break;\n      case FTS5_NOT: zOp = \" NOT \"; break;\n      default:  \n        assert( pExpr->eType==FTS5_OR );\n        zOp = \" OR \"; \n        break;\n    }\n\n    for(i=0; i<pExpr->nChild; i++){\n      char *z = fts5ExprPrint(pConfig, pExpr->apChild[i]);\n      if( z==0 ){\n        sqlite3_free(zRet);\n        zRet = 0;\n      }else{\n        int e = pExpr->apChild[i]->eType;\n        int b = (e!=FTS5_STRING && e!=FTS5_TERM && e!=FTS5_EOF);\n        zRet = fts5PrintfAppend(zRet, \"%s%s%z%s\", \n            (i==0 ? \"\" : zOp),\n            (b?\"(\":\"\"), z, (b?\")\":\"\")\n        );\n      }\n      if( zRet==0 ) break;\n    }\n  }\n\n  return zRet;\n}\n\n/*\n** The implementation of user-defined scalar functions fts5_expr() (bTcl==0)\n** and fts5_expr_tcl() (bTcl!=0).\n*/\nstatic void fts5ExprFunction(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args */\n  sqlite3_value **apVal,          /* Function arguments */\n  int bTcl\n){\n  Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx);\n  sqlite3 *db = sqlite3_context_db_handle(pCtx);\n  const char *zExpr = 0;\n  char *zErr = 0;\n  Fts5Expr *pExpr = 0;\n  int rc;\n  int i;\n\n  const char **azConfig;          /* Array of arguments for Fts5Config */\n  const char *zNearsetCmd = \"nearset\";\n  int nConfig;                    /* Size of azConfig[] */\n  Fts5Config *pConfig = 0;\n  int iArg = 1;\n\n  if( nArg<1 ){\n    zErr = sqlite3_mprintf(\"wrong number of arguments to function %s\",\n        bTcl ? \"fts5_expr_tcl\" : \"fts5_expr\"\n    );\n    sqlite3_result_error(pCtx, zErr, -1);\n    sqlite3_free(zErr);\n    return;\n  }\n\n  if( bTcl && nArg>1 ){\n    zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]);\n    iArg = 2;\n  }\n\n  nConfig = 3 + (nArg-iArg);\n  azConfig = (const char**)sqlite3_malloc(sizeof(char*) * nConfig);\n  if( azConfig==0 ){\n    sqlite3_result_error_nomem(pCtx);\n    return;\n  }\n  azConfig[0] = 0;\n  azConfig[1] = \"main\";\n  azConfig[2] = \"tbl\";\n  for(i=3; iArg<nArg; iArg++){\n    azConfig[i++] = (const char*)sqlite3_value_text(apVal[iArg]);\n  }\n\n  zExpr = (const char*)sqlite3_value_text(apVal[0]);\n\n  rc = sqlite3Fts5ConfigParse(pGlobal, db, nConfig, azConfig, &pConfig, &zErr);\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5ExprNew(pConfig, zExpr, &pExpr, &zErr);\n  }\n  if( rc==SQLITE_OK ){\n    char *zText;\n    if( pExpr->pRoot->xNext==0 ){\n      zText = sqlite3_mprintf(\"\");\n    }else if( bTcl ){\n      zText = fts5ExprPrintTcl(pConfig, zNearsetCmd, pExpr->pRoot);\n    }else{\n      zText = fts5ExprPrint(pConfig, pExpr->pRoot);\n    }\n    if( zText==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      sqlite3_result_text(pCtx, zText, -1, SQLITE_TRANSIENT);\n      sqlite3_free(zText);\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    if( zErr ){\n      sqlite3_result_error(pCtx, zErr, -1);\n      sqlite3_free(zErr);\n    }else{\n      sqlite3_result_error_code(pCtx, rc);\n    }\n  }\n  sqlite3_free((void *)azConfig);\n  sqlite3Fts5ConfigFree(pConfig);\n  sqlite3Fts5ExprFree(pExpr);\n}\n\nstatic void fts5ExprFunctionHr(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args */\n  sqlite3_value **apVal           /* Function arguments */\n){\n  fts5ExprFunction(pCtx, nArg, apVal, 0);\n}\nstatic void fts5ExprFunctionTcl(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args */\n  sqlite3_value **apVal           /* Function arguments */\n){\n  fts5ExprFunction(pCtx, nArg, apVal, 1);\n}\n\n/*\n** The implementation of an SQLite user-defined-function that accepts a\n** single integer as an argument. If the integer is an alpha-numeric \n** unicode code point, 1 is returned. Otherwise 0.\n*/\nstatic void fts5ExprIsAlnum(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args */\n  sqlite3_value **apVal           /* Function arguments */\n){\n  int iCode;\n  if( nArg!=1 ){\n    sqlite3_result_error(pCtx, \n        \"wrong number of arguments to function fts5_isalnum\", -1\n    );\n    return;\n  }\n  iCode = sqlite3_value_int(apVal[0]);\n  sqlite3_result_int(pCtx, sqlite3Fts5UnicodeIsalnum(iCode));\n}\n\nstatic void fts5ExprFold(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args */\n  sqlite3_value **apVal           /* Function arguments */\n){\n  if( nArg!=1 && nArg!=2 ){\n    sqlite3_result_error(pCtx, \n        \"wrong number of arguments to function fts5_fold\", -1\n    );\n  }else{\n    int iCode;\n    int bRemoveDiacritics = 0;\n    iCode = sqlite3_value_int(apVal[0]);\n    if( nArg==2 ) bRemoveDiacritics = sqlite3_value_int(apVal[1]);\n    sqlite3_result_int(pCtx, sqlite3Fts5UnicodeFold(iCode, bRemoveDiacritics));\n  }\n}\n\n/*\n** This is called during initialization to register the fts5_expr() scalar\n** UDF with the SQLite handle passed as the only argument.\n*/\nstatic int sqlite3Fts5ExprInit(Fts5Global *pGlobal, sqlite3 *db){\n  struct Fts5ExprFunc {\n    const char *z;\n    void (*x)(sqlite3_context*,int,sqlite3_value**);\n  } aFunc[] = {\n    { \"fts5_expr\",     fts5ExprFunctionHr },\n    { \"fts5_expr_tcl\", fts5ExprFunctionTcl },\n    { \"fts5_isalnum\",  fts5ExprIsAlnum },\n    { \"fts5_fold\",     fts5ExprFold },\n  };\n  int i;\n  int rc = SQLITE_OK;\n  void *pCtx = (void*)pGlobal;\n\n  for(i=0; rc==SQLITE_OK && i<ArraySize(aFunc); i++){\n    struct Fts5ExprFunc *p = &aFunc[i];\n    rc = sqlite3_create_function(db, p->z, -1, SQLITE_UTF8, pCtx, p->x, 0, 0);\n  }\n\n  /* Avoid a warning indicating that sqlite3Fts5ParserTrace() is unused */\n#ifndef NDEBUG\n  (void)sqlite3Fts5ParserTrace;\n#endif\n\n  return rc;\n}\n\n/*\n** Return the number of phrases in expression pExpr.\n*/\nstatic int sqlite3Fts5ExprPhraseCount(Fts5Expr *pExpr){\n  return (pExpr ? pExpr->nPhrase : 0);\n}\n\n/*\n** Return the number of terms in the iPhrase'th phrase in pExpr.\n*/\nstatic int sqlite3Fts5ExprPhraseSize(Fts5Expr *pExpr, int iPhrase){\n  if( iPhrase<0 || iPhrase>=pExpr->nPhrase ) return 0;\n  return pExpr->apExprPhrase[iPhrase]->nTerm;\n}\n\n/*\n** This function is used to access the current position list for phrase\n** iPhrase.\n*/\nstatic int sqlite3Fts5ExprPoslist(Fts5Expr *pExpr, int iPhrase, const u8 **pa){\n  int nRet;\n  Fts5ExprPhrase *pPhrase = pExpr->apExprPhrase[iPhrase];\n  Fts5ExprNode *pNode = pPhrase->pNode;\n  if( pNode->bEof==0 && pNode->iRowid==pExpr->pRoot->iRowid ){\n    *pa = pPhrase->poslist.p;\n    nRet = pPhrase->poslist.n;\n  }else{\n    *pa = 0;\n    nRet = 0;\n  }\n  return nRet;\n}\n\nstruct Fts5PoslistPopulator {\n  Fts5PoslistWriter writer;\n  int bOk;                        /* True if ok to populate */\n  int bMiss;\n};\n\nstatic Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr *pExpr, int bLive){\n  Fts5PoslistPopulator *pRet;\n  pRet = sqlite3_malloc(sizeof(Fts5PoslistPopulator)*pExpr->nPhrase);\n  if( pRet ){\n    int i;\n    memset(pRet, 0, sizeof(Fts5PoslistPopulator)*pExpr->nPhrase);\n    for(i=0; i<pExpr->nPhrase; i++){\n      Fts5Buffer *pBuf = &pExpr->apExprPhrase[i]->poslist;\n      Fts5ExprNode *pNode = pExpr->apExprPhrase[i]->pNode;\n      assert( pExpr->apExprPhrase[i]->nTerm==1 );\n      if( bLive && \n          (pBuf->n==0 || pNode->iRowid!=pExpr->pRoot->iRowid || pNode->bEof)\n      ){\n        pRet[i].bMiss = 1;\n      }else{\n        pBuf->n = 0;\n      }\n    }\n  }\n  return pRet;\n}\n\nstruct Fts5ExprCtx {\n  Fts5Expr *pExpr;\n  Fts5PoslistPopulator *aPopulator;\n  i64 iOff;\n};\ntypedef struct Fts5ExprCtx Fts5ExprCtx;\n\n/*\n** TODO: Make this more efficient!\n*/\nstatic int fts5ExprColsetTest(Fts5Colset *pColset, int iCol){\n  int i;\n  for(i=0; i<pColset->nCol; i++){\n    if( pColset->aiCol[i]==iCol ) return 1;\n  }\n  return 0;\n}\n\nstatic int fts5ExprPopulatePoslistsCb(\n  void *pCtx,                /* Copy of 2nd argument to xTokenize() */\n  int tflags,                /* Mask of FTS5_TOKEN_* flags */\n  const char *pToken,        /* Pointer to buffer containing token */\n  int nToken,                /* Size of token in bytes */\n  int iUnused1,              /* Byte offset of token within input text */\n  int iUnused2               /* Byte offset of end of token within input text */\n){\n  Fts5ExprCtx *p = (Fts5ExprCtx*)pCtx;\n  Fts5Expr *pExpr = p->pExpr;\n  int i;\n\n  UNUSED_PARAM2(iUnused1, iUnused2);\n\n  if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;\n  if( (tflags & FTS5_TOKEN_COLOCATED)==0 ) p->iOff++;\n  for(i=0; i<pExpr->nPhrase; i++){\n    Fts5ExprTerm *pTerm;\n    if( p->aPopulator[i].bOk==0 ) continue;\n    for(pTerm=&pExpr->apExprPhrase[i]->aTerm[0]; pTerm; pTerm=pTerm->pSynonym){\n      int nTerm = (int)strlen(pTerm->zTerm);\n      if( (nTerm==nToken || (nTerm<nToken && pTerm->bPrefix))\n       && memcmp(pTerm->zTerm, pToken, nTerm)==0\n      ){\n        int rc = sqlite3Fts5PoslistWriterAppend(\n            &pExpr->apExprPhrase[i]->poslist, &p->aPopulator[i].writer, p->iOff\n        );\n        if( rc ) return rc;\n        break;\n      }\n    }\n  }\n  return SQLITE_OK;\n}\n\nstatic int sqlite3Fts5ExprPopulatePoslists(\n  Fts5Config *pConfig,\n  Fts5Expr *pExpr, \n  Fts5PoslistPopulator *aPopulator,\n  int iCol, \n  const char *z, int n\n){\n  int i;\n  Fts5ExprCtx sCtx;\n  sCtx.pExpr = pExpr;\n  sCtx.aPopulator = aPopulator;\n  sCtx.iOff = (((i64)iCol) << 32) - 1;\n\n  for(i=0; i<pExpr->nPhrase; i++){\n    Fts5ExprNode *pNode = pExpr->apExprPhrase[i]->pNode;\n    Fts5Colset *pColset = pNode->pNear->pColset;\n    if( (pColset && 0==fts5ExprColsetTest(pColset, iCol)) \n     || aPopulator[i].bMiss\n    ){\n      aPopulator[i].bOk = 0;\n    }else{\n      aPopulator[i].bOk = 1;\n    }\n  }\n\n  return sqlite3Fts5Tokenize(pConfig, \n      FTS5_TOKENIZE_DOCUMENT, z, n, (void*)&sCtx, fts5ExprPopulatePoslistsCb\n  );\n}\n\nstatic void fts5ExprClearPoslists(Fts5ExprNode *pNode){\n  if( pNode->eType==FTS5_TERM || pNode->eType==FTS5_STRING ){\n    pNode->pNear->apPhrase[0]->poslist.n = 0;\n  }else{\n    int i;\n    for(i=0; i<pNode->nChild; i++){\n      fts5ExprClearPoslists(pNode->apChild[i]);\n    }\n  }\n}\n\nstatic int fts5ExprCheckPoslists(Fts5ExprNode *pNode, i64 iRowid){\n  pNode->iRowid = iRowid;\n  pNode->bEof = 0;\n  switch( pNode->eType ){\n    case FTS5_TERM:\n    case FTS5_STRING:\n      return (pNode->pNear->apPhrase[0]->poslist.n>0);\n\n    case FTS5_AND: {\n      int i;\n      for(i=0; i<pNode->nChild; i++){\n        if( fts5ExprCheckPoslists(pNode->apChild[i], iRowid)==0 ){\n          fts5ExprClearPoslists(pNode);\n          return 0;\n        }\n      }\n      break;\n    }\n\n    case FTS5_OR: {\n      int i;\n      int bRet = 0;\n      for(i=0; i<pNode->nChild; i++){\n        if( fts5ExprCheckPoslists(pNode->apChild[i], iRowid) ){\n          bRet = 1;\n        }\n      }\n      return bRet;\n    }\n\n    default: {\n      assert( pNode->eType==FTS5_NOT );\n      if( 0==fts5ExprCheckPoslists(pNode->apChild[0], iRowid)\n          || 0!=fts5ExprCheckPoslists(pNode->apChild[1], iRowid)\n        ){\n        fts5ExprClearPoslists(pNode);\n        return 0;\n      }\n      break;\n    }\n  }\n  return 1;\n}\n\nstatic void sqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){\n  fts5ExprCheckPoslists(pExpr->pRoot, iRowid);\n}\n\n/*\n** This function is only called for detail=columns tables. \n*/\nstatic int sqlite3Fts5ExprPhraseCollist(\n  Fts5Expr *pExpr, \n  int iPhrase, \n  const u8 **ppCollist, \n  int *pnCollist\n){\n  Fts5ExprPhrase *pPhrase = pExpr->apExprPhrase[iPhrase];\n  Fts5ExprNode *pNode = pPhrase->pNode;\n  int rc = SQLITE_OK;\n\n  assert( iPhrase>=0 && iPhrase<pExpr->nPhrase );\n  assert( pExpr->pConfig->eDetail==FTS5_DETAIL_COLUMNS );\n\n  if( pNode->bEof==0 \n   && pNode->iRowid==pExpr->pRoot->iRowid \n   && pPhrase->poslist.n>0\n  ){\n    Fts5ExprTerm *pTerm = &pPhrase->aTerm[0];\n    if( pTerm->pSynonym ){\n      Fts5Buffer *pBuf = (Fts5Buffer*)&pTerm->pSynonym[1];\n      rc = fts5ExprSynonymList(\n          pTerm, pNode->iRowid, pBuf, (u8**)ppCollist, pnCollist\n      );\n    }else{\n      *ppCollist = pPhrase->aTerm[0].pIter->pData;\n      *pnCollist = pPhrase->aTerm[0].pIter->nData;\n    }\n  }else{\n    *ppCollist = 0;\n    *pnCollist = 0;\n  }\n\n  return rc;\n}\n\n\n#line 1 \"fts5_hash.c\"\n/*\n** 2014 August 11\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n*/\n\n\n\n/* #include \"fts5Int.h\" */\n\ntypedef struct Fts5HashEntry Fts5HashEntry;\n\n/*\n** This file contains the implementation of an in-memory hash table used\n** to accumuluate \"term -> doclist\" content before it is flused to a level-0\n** segment.\n*/\n\n\nstruct Fts5Hash {\n  int eDetail;                    /* Copy of Fts5Config.eDetail */\n  int *pnByte;                    /* Pointer to bytes counter */\n  int nEntry;                     /* Number of entries currently in hash */\n  int nSlot;                      /* Size of aSlot[] array */\n  Fts5HashEntry *pScan;           /* Current ordered scan item */\n  Fts5HashEntry **aSlot;          /* Array of hash slots */\n};\n\n/*\n** Each entry in the hash table is represented by an object of the \n** following type. Each object, its key (zKey[]) and its current data\n** are stored in a single memory allocation. The position list data \n** immediately follows the key data in memory.\n**\n** The data that follows the key is in a similar, but not identical format\n** to the doclist data stored in the database. It is:\n**\n**   * Rowid, as a varint\n**   * Position list, without 0x00 terminator.\n**   * Size of previous position list and rowid, as a 4 byte\n**     big-endian integer.\n**\n** iRowidOff:\n**   Offset of last rowid written to data area. Relative to first byte of\n**   structure.\n**\n** nData:\n**   Bytes of data written since iRowidOff.\n*/\nstruct Fts5HashEntry {\n  Fts5HashEntry *pHashNext;       /* Next hash entry with same hash-key */\n  Fts5HashEntry *pScanNext;       /* Next entry in sorted order */\n  \n  int nAlloc;                     /* Total size of allocation */\n  int iSzPoslist;                 /* Offset of space for 4-byte poslist size */\n  int nData;                      /* Total bytes of data (incl. structure) */\n  int nKey;                       /* Length of zKey[] in bytes */\n  u8 bDel;                        /* Set delete-flag @ iSzPoslist */\n  u8 bContent;                    /* Set content-flag (detail=none mode) */\n  i16 iCol;                       /* Column of last value written */\n  int iPos;                       /* Position of last value written */\n  i64 iRowid;                     /* Rowid of last value written */\n  char zKey[8];                   /* Nul-terminated entry key */\n};\n\n/*\n** Size of Fts5HashEntry without the zKey[] array.\n*/\n#define FTS5_HASHENTRYSIZE (sizeof(Fts5HashEntry)-8)\n\n\n\n/*\n** Allocate a new hash table.\n*/\nstatic int sqlite3Fts5HashNew(Fts5Config *pConfig, Fts5Hash **ppNew, int *pnByte){\n  int rc = SQLITE_OK;\n  Fts5Hash *pNew;\n\n  *ppNew = pNew = (Fts5Hash*)sqlite3_malloc(sizeof(Fts5Hash));\n  if( pNew==0 ){\n    rc = SQLITE_NOMEM;\n  }else{\n    int nByte;\n    memset(pNew, 0, sizeof(Fts5Hash));\n    pNew->pnByte = pnByte;\n    pNew->eDetail = pConfig->eDetail;\n\n    pNew->nSlot = 1024;\n    nByte = sizeof(Fts5HashEntry*) * pNew->nSlot;\n    pNew->aSlot = (Fts5HashEntry**)sqlite3_malloc(nByte);\n    if( pNew->aSlot==0 ){\n      sqlite3_free(pNew);\n      *ppNew = 0;\n      rc = SQLITE_NOMEM;\n    }else{\n      memset(pNew->aSlot, 0, nByte);\n    }\n  }\n  return rc;\n}\n\n/*\n** Free a hash table object.\n*/\nstatic void sqlite3Fts5HashFree(Fts5Hash *pHash){\n  if( pHash ){\n    sqlite3Fts5HashClear(pHash);\n    sqlite3_free(pHash->aSlot);\n    sqlite3_free(pHash);\n  }\n}\n\n/*\n** Empty (but do not delete) a hash table.\n*/\nstatic void sqlite3Fts5HashClear(Fts5Hash *pHash){\n  int i;\n  for(i=0; i<pHash->nSlot; i++){\n    Fts5HashEntry *pNext;\n    Fts5HashEntry *pSlot;\n    for(pSlot=pHash->aSlot[i]; pSlot; pSlot=pNext){\n      pNext = pSlot->pHashNext;\n      sqlite3_free(pSlot);\n    }\n  }\n  memset(pHash->aSlot, 0, pHash->nSlot * sizeof(Fts5HashEntry*));\n  pHash->nEntry = 0;\n}\n\nstatic unsigned int fts5HashKey(int nSlot, const u8 *p, int n){\n  int i;\n  unsigned int h = 13;\n  for(i=n-1; i>=0; i--){\n    h = (h << 3) ^ h ^ p[i];\n  }\n  return (h % nSlot);\n}\n\nstatic unsigned int fts5HashKey2(int nSlot, u8 b, const u8 *p, int n){\n  int i;\n  unsigned int h = 13;\n  for(i=n-1; i>=0; i--){\n    h = (h << 3) ^ h ^ p[i];\n  }\n  h = (h << 3) ^ h ^ b;\n  return (h % nSlot);\n}\n\n/*\n** Resize the hash table by doubling the number of slots.\n*/\nstatic int fts5HashResize(Fts5Hash *pHash){\n  int nNew = pHash->nSlot*2;\n  int i;\n  Fts5HashEntry **apNew;\n  Fts5HashEntry **apOld = pHash->aSlot;\n\n  apNew = (Fts5HashEntry**)sqlite3_malloc(nNew*sizeof(Fts5HashEntry*));\n  if( !apNew ) return SQLITE_NOMEM;\n  memset(apNew, 0, nNew*sizeof(Fts5HashEntry*));\n\n  for(i=0; i<pHash->nSlot; i++){\n    while( apOld[i] ){\n      int iHash;\n      Fts5HashEntry *p = apOld[i];\n      apOld[i] = p->pHashNext;\n      iHash = fts5HashKey(nNew, (u8*)p->zKey, (int)strlen(p->zKey));\n      p->pHashNext = apNew[iHash];\n      apNew[iHash] = p;\n    }\n  }\n\n  sqlite3_free(apOld);\n  pHash->nSlot = nNew;\n  pHash->aSlot = apNew;\n  return SQLITE_OK;\n}\n\nstatic void fts5HashAddPoslistSize(Fts5Hash *pHash, Fts5HashEntry *p){\n  if( p->iSzPoslist ){\n    u8 *pPtr = (u8*)p;\n    if( pHash->eDetail==FTS5_DETAIL_NONE ){\n      assert( p->nData==p->iSzPoslist );\n      if( p->bDel ){\n        pPtr[p->nData++] = 0x00;\n        if( p->bContent ){\n          pPtr[p->nData++] = 0x00;\n        }\n      }\n    }else{\n      int nSz = (p->nData - p->iSzPoslist - 1);       /* Size in bytes */\n      int nPos = nSz*2 + p->bDel;                     /* Value of nPos field */\n\n      assert( p->bDel==0 || p->bDel==1 );\n      if( nPos<=127 ){\n        pPtr[p->iSzPoslist] = (u8)nPos;\n      }else{\n        int nByte = sqlite3Fts5GetVarintLen((u32)nPos);\n        memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz);\n        sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos);\n        p->nData += (nByte-1);\n      }\n    }\n\n    p->iSzPoslist = 0;\n    p->bDel = 0;\n    p->bContent = 0;\n  }\n}\n\n/*\n** Add an entry to the in-memory hash table. The key is the concatenation\n** of bByte and (pToken/nToken). The value is (iRowid/iCol/iPos).\n**\n**     (bByte || pToken) -> (iRowid,iCol,iPos)\n**\n** Or, if iCol is negative, then the value is a delete marker.\n*/\nstatic int sqlite3Fts5HashWrite(\n  Fts5Hash *pHash,\n  i64 iRowid,                     /* Rowid for this entry */\n  int iCol,                       /* Column token appears in (-ve -> delete) */\n  int iPos,                       /* Position of token within column */\n  char bByte,                     /* First byte of token */\n  const char *pToken, int nToken  /* Token to add or remove to or from index */\n){\n  unsigned int iHash;\n  Fts5HashEntry *p;\n  u8 *pPtr;\n  int nIncr = 0;                  /* Amount to increment (*pHash->pnByte) by */\n  int bNew;                       /* If non-delete entry should be written */\n  \n  bNew = (pHash->eDetail==FTS5_DETAIL_FULL);\n\n  /* Attempt to locate an existing hash entry */\n  iHash = fts5HashKey2(pHash->nSlot, (u8)bByte, (const u8*)pToken, nToken);\n  for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){\n    if( p->zKey[0]==bByte \n     && p->nKey==nToken\n     && memcmp(&p->zKey[1], pToken, nToken)==0 \n    ){\n      break;\n    }\n  }\n\n  /* If an existing hash entry cannot be found, create a new one. */\n  if( p==0 ){\n    /* Figure out how much space to allocate */\n    int nByte = FTS5_HASHENTRYSIZE + (nToken+1) + 1 + 64;\n    if( nByte<128 ) nByte = 128;\n\n    /* Grow the Fts5Hash.aSlot[] array if necessary. */\n    if( (pHash->nEntry*2)>=pHash->nSlot ){\n      int rc = fts5HashResize(pHash);\n      if( rc!=SQLITE_OK ) return rc;\n      iHash = fts5HashKey2(pHash->nSlot, (u8)bByte, (const u8*)pToken, nToken);\n    }\n\n    /* Allocate new Fts5HashEntry and add it to the hash table. */\n    p = (Fts5HashEntry*)sqlite3_malloc(nByte);\n    if( !p ) return SQLITE_NOMEM;\n    memset(p, 0, FTS5_HASHENTRYSIZE);\n    p->nAlloc = nByte;\n    p->zKey[0] = bByte;\n    memcpy(&p->zKey[1], pToken, nToken);\n    assert( iHash==fts5HashKey(pHash->nSlot, (u8*)p->zKey, nToken+1) );\n    p->nKey = nToken;\n    p->zKey[nToken+1] = '\\0';\n    p->nData = nToken+1 + 1 + FTS5_HASHENTRYSIZE;\n    p->pHashNext = pHash->aSlot[iHash];\n    pHash->aSlot[iHash] = p;\n    pHash->nEntry++;\n\n    /* Add the first rowid field to the hash-entry */\n    p->nData += sqlite3Fts5PutVarint(&((u8*)p)[p->nData], iRowid);\n    p->iRowid = iRowid;\n\n    p->iSzPoslist = p->nData;\n    if( pHash->eDetail!=FTS5_DETAIL_NONE ){\n      p->nData += 1;\n      p->iCol = (pHash->eDetail==FTS5_DETAIL_FULL ? 0 : -1);\n    }\n\n    nIncr += p->nData;\n  }else{\n\n    /* Appending to an existing hash-entry. Check that there is enough \n    ** space to append the largest possible new entry. Worst case scenario \n    ** is:\n    **\n    **     + 9 bytes for a new rowid,\n    **     + 4 byte reserved for the \"poslist size\" varint.\n    **     + 1 byte for a \"new column\" byte,\n    **     + 3 bytes for a new column number (16-bit max) as a varint,\n    **     + 5 bytes for the new position offset (32-bit max).\n    */\n    if( (p->nAlloc - p->nData) < (9 + 4 + 1 + 3 + 5) ){\n      int nNew = p->nAlloc * 2;\n      Fts5HashEntry *pNew;\n      Fts5HashEntry **pp;\n      pNew = (Fts5HashEntry*)sqlite3_realloc(p, nNew);\n      if( pNew==0 ) return SQLITE_NOMEM;\n      pNew->nAlloc = nNew;\n      for(pp=&pHash->aSlot[iHash]; *pp!=p; pp=&(*pp)->pHashNext);\n      *pp = pNew;\n      p = pNew;\n    }\n    nIncr -= p->nData;\n  }\n  assert( (p->nAlloc - p->nData) >= (9 + 4 + 1 + 3 + 5) );\n\n  pPtr = (u8*)p;\n\n  /* If this is a new rowid, append the 4-byte size field for the previous\n  ** entry, and the new rowid for this entry.  */\n  if( iRowid!=p->iRowid ){\n    fts5HashAddPoslistSize(pHash, p);\n    p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iRowid - p->iRowid);\n    p->iRowid = iRowid;\n    bNew = 1;\n    p->iSzPoslist = p->nData;\n    if( pHash->eDetail!=FTS5_DETAIL_NONE ){\n      p->nData += 1;\n      p->iCol = (pHash->eDetail==FTS5_DETAIL_FULL ? 0 : -1);\n      p->iPos = 0;\n    }\n  }\n\n  if( iCol>=0 ){\n    if( pHash->eDetail==FTS5_DETAIL_NONE ){\n      p->bContent = 1;\n    }else{\n      /* Append a new column value, if necessary */\n      assert( iCol>=p->iCol );\n      if( iCol!=p->iCol ){\n        if( pHash->eDetail==FTS5_DETAIL_FULL ){\n          pPtr[p->nData++] = 0x01;\n          p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iCol);\n          p->iCol = (i16)iCol;\n          p->iPos = 0;\n        }else{\n          bNew = 1;\n          p->iCol = (i16)(iPos = iCol);\n        }\n      }\n\n      /* Append the new position offset, if necessary */\n      if( bNew ){\n        p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iPos - p->iPos + 2);\n        p->iPos = iPos;\n      }\n    }\n  }else{\n    /* This is a delete. Set the delete flag. */\n    p->bDel = 1;\n  }\n\n  nIncr += p->nData;\n  *pHash->pnByte += nIncr;\n  return SQLITE_OK;\n}\n\n\n/*\n** Arguments pLeft and pRight point to linked-lists of hash-entry objects,\n** each sorted in key order. This function merges the two lists into a\n** single list and returns a pointer to its first element.\n*/\nstatic Fts5HashEntry *fts5HashEntryMerge(\n  Fts5HashEntry *pLeft,\n  Fts5HashEntry *pRight\n){\n  Fts5HashEntry *p1 = pLeft;\n  Fts5HashEntry *p2 = pRight;\n  Fts5HashEntry *pRet = 0;\n  Fts5HashEntry **ppOut = &pRet;\n\n  while( p1 || p2 ){\n    if( p1==0 ){\n      *ppOut = p2;\n      p2 = 0;\n    }else if( p2==0 ){\n      *ppOut = p1;\n      p1 = 0;\n    }else{\n      int i = 0;\n      while( p1->zKey[i]==p2->zKey[i] ) i++;\n\n      if( ((u8)p1->zKey[i])>((u8)p2->zKey[i]) ){\n        /* p2 is smaller */\n        *ppOut = p2;\n        ppOut = &p2->pScanNext;\n        p2 = p2->pScanNext;\n      }else{\n        /* p1 is smaller */\n        *ppOut = p1;\n        ppOut = &p1->pScanNext;\n        p1 = p1->pScanNext;\n      }\n      *ppOut = 0;\n    }\n  }\n\n  return pRet;\n}\n\n/*\n** Extract all tokens from hash table iHash and link them into a list\n** in sorted order. The hash table is cleared before returning. It is\n** the responsibility of the caller to free the elements of the returned\n** list.\n*/\nstatic int fts5HashEntrySort(\n  Fts5Hash *pHash, \n  const char *pTerm, int nTerm,   /* Query prefix, if any */\n  Fts5HashEntry **ppSorted\n){\n  const int nMergeSlot = 32;\n  Fts5HashEntry **ap;\n  Fts5HashEntry *pList;\n  int iSlot;\n  int i;\n\n  *ppSorted = 0;\n  ap = sqlite3_malloc(sizeof(Fts5HashEntry*) * nMergeSlot);\n  if( !ap ) return SQLITE_NOMEM;\n  memset(ap, 0, sizeof(Fts5HashEntry*) * nMergeSlot);\n\n  for(iSlot=0; iSlot<pHash->nSlot; iSlot++){\n    Fts5HashEntry *pIter;\n    for(pIter=pHash->aSlot[iSlot]; pIter; pIter=pIter->pHashNext){\n      if( pTerm==0 || 0==memcmp(pIter->zKey, pTerm, nTerm) ){\n        Fts5HashEntry *pEntry = pIter;\n        pEntry->pScanNext = 0;\n        for(i=0; ap[i]; i++){\n          pEntry = fts5HashEntryMerge(pEntry, ap[i]);\n          ap[i] = 0;\n        }\n        ap[i] = pEntry;\n      }\n    }\n  }\n\n  pList = 0;\n  for(i=0; i<nMergeSlot; i++){\n    pList = fts5HashEntryMerge(pList, ap[i]);\n  }\n\n  pHash->nEntry = 0;\n  sqlite3_free(ap);\n  *ppSorted = pList;\n  return SQLITE_OK;\n}\n\n/*\n** Query the hash table for a doclist associated with term pTerm/nTerm.\n*/\nstatic int sqlite3Fts5HashQuery(\n  Fts5Hash *pHash,                /* Hash table to query */\n  const char *pTerm, int nTerm,   /* Query term */\n  const u8 **ppDoclist,           /* OUT: Pointer to doclist for pTerm */\n  int *pnDoclist                  /* OUT: Size of doclist in bytes */\n){\n  unsigned int iHash = fts5HashKey(pHash->nSlot, (const u8*)pTerm, nTerm);\n  Fts5HashEntry *p;\n\n  for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){\n    if( memcmp(p->zKey, pTerm, nTerm)==0 && p->zKey[nTerm]==0 ) break;\n  }\n\n  if( p ){\n    fts5HashAddPoslistSize(pHash, p);\n    *ppDoclist = (const u8*)&p->zKey[nTerm+1];\n    *pnDoclist = p->nData - (FTS5_HASHENTRYSIZE + nTerm + 1);\n  }else{\n    *ppDoclist = 0;\n    *pnDoclist = 0;\n  }\n\n  return SQLITE_OK;\n}\n\nstatic int sqlite3Fts5HashScanInit(\n  Fts5Hash *p,                    /* Hash table to query */\n  const char *pTerm, int nTerm    /* Query prefix */\n){\n  return fts5HashEntrySort(p, pTerm, nTerm, &p->pScan);\n}\n\nstatic void sqlite3Fts5HashScanNext(Fts5Hash *p){\n  assert( !sqlite3Fts5HashScanEof(p) );\n  p->pScan = p->pScan->pScanNext;\n}\n\nstatic int sqlite3Fts5HashScanEof(Fts5Hash *p){\n  return (p->pScan==0);\n}\n\nstatic void sqlite3Fts5HashScanEntry(\n  Fts5Hash *pHash,\n  const char **pzTerm,            /* OUT: term (nul-terminated) */\n  const u8 **ppDoclist,           /* OUT: pointer to doclist */\n  int *pnDoclist                  /* OUT: size of doclist in bytes */\n){\n  Fts5HashEntry *p;\n  if( (p = pHash->pScan) ){\n    int nTerm = (int)strlen(p->zKey);\n    fts5HashAddPoslistSize(pHash, p);\n    *pzTerm = p->zKey;\n    *ppDoclist = (const u8*)&p->zKey[nTerm+1];\n    *pnDoclist = p->nData - (FTS5_HASHENTRYSIZE + nTerm + 1);\n  }else{\n    *pzTerm = 0;\n    *ppDoclist = 0;\n    *pnDoclist = 0;\n  }\n}\n\n\n#line 1 \"fts5_index.c\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** Low level access to the FTS index stored in the database file. The \n** routines in this file file implement all read and write access to the\n** %_data table. Other parts of the system access this functionality via\n** the interface defined in fts5Int.h.\n*/\n\n\n/* #include \"fts5Int.h\" */\n\n/*\n** Overview:\n**\n** The %_data table contains all the FTS indexes for an FTS5 virtual table.\n** As well as the main term index, there may be up to 31 prefix indexes.\n** The format is similar to FTS3/4, except that:\n**\n**   * all segment b-tree leaf data is stored in fixed size page records \n**     (e.g. 1000 bytes). A single doclist may span multiple pages. Care is \n**     taken to ensure it is possible to iterate in either direction through \n**     the entries in a doclist, or to seek to a specific entry within a \n**     doclist, without loading it into memory.\n**\n**   * large doclists that span many pages have associated \"doclist index\"\n**     records that contain a copy of the first rowid on each page spanned by\n**     the doclist. This is used to speed up seek operations, and merges of\n**     large doclists with very small doclists.\n**\n**   * extra fields in the \"structure record\" record the state of ongoing\n**     incremental merge operations.\n**\n*/\n\n\n#define FTS5_OPT_WORK_UNIT  1000  /* Number of leaf pages per optimize step */\n#define FTS5_WORK_UNIT      64    /* Number of leaf pages in unit of work */\n\n#define FTS5_MIN_DLIDX_SIZE 4     /* Add dlidx if this many empty pages */\n\n#define FTS5_MAIN_PREFIX '0'\n\n#if FTS5_MAX_PREFIX_INDEXES > 31\n# error \"FTS5_MAX_PREFIX_INDEXES is too large\"\n#endif\n\n/*\n** Details:\n**\n** The %_data table managed by this module,\n**\n**     CREATE TABLE %_data(id INTEGER PRIMARY KEY, block BLOB);\n**\n** , contains the following 5 types of records. See the comments surrounding\n** the FTS5_*_ROWID macros below for a description of how %_data rowids are \n** assigned to each fo them.\n**\n** 1. Structure Records:\n**\n**   The set of segments that make up an index - the index structure - are\n**   recorded in a single record within the %_data table. The record consists\n**   of a single 32-bit configuration cookie value followed by a list of \n**   SQLite varints. If the FTS table features more than one index (because\n**   there are one or more prefix indexes), it is guaranteed that all share\n**   the same cookie value.\n**\n**   Immediately following the configuration cookie, the record begins with\n**   three varints:\n**\n**     + number of levels,\n**     + total number of segments on all levels,\n**     + value of write counter.\n**\n**   Then, for each level from 0 to nMax:\n**\n**     + number of input segments in ongoing merge.\n**     + total number of segments in level.\n**     + for each segment from oldest to newest:\n**         + segment id (always > 0)\n**         + first leaf page number (often 1, always greater than 0)\n**         + final leaf page number\n**\n** 2. The Averages Record:\n**\n**   A single record within the %_data table. The data is a list of varints.\n**   The first value is the number of rows in the index. Then, for each column\n**   from left to right, the total number of tokens in the column for all\n**   rows of the table.\n**\n** 3. Segment leaves:\n**\n**   TERM/DOCLIST FORMAT:\n**\n**     Most of each segment leaf is taken up by term/doclist data. The \n**     general format of term/doclist, starting with the first term\n**     on the leaf page, is:\n**\n**         varint : size of first term\n**         blob:    first term data\n**         doclist: first doclist\n**         zero-or-more {\n**           varint:  number of bytes in common with previous term\n**           varint:  number of bytes of new term data (nNew)\n**           blob:    nNew bytes of new term data\n**           doclist: next doclist\n**         }\n**\n**     doclist format:\n**\n**         varint:  first rowid\n**         poslist: first poslist\n**         zero-or-more {\n**           varint:  rowid delta (always > 0)\n**           poslist: next poslist\n**         }\n**\n**     poslist format:\n**\n**         varint: size of poslist in bytes multiplied by 2, not including\n**                 this field. Plus 1 if this entry carries the \"delete\" flag.\n**         collist: collist for column 0\n**         zero-or-more {\n**           0x01 byte\n**           varint: column number (I)\n**           collist: collist for column I\n**         }\n**\n**     collist format:\n**\n**         varint: first offset + 2\n**         zero-or-more {\n**           varint: offset delta + 2\n**         }\n**\n**   PAGE FORMAT\n**\n**     Each leaf page begins with a 4-byte header containing 2 16-bit \n**     unsigned integer fields in big-endian format. They are:\n**\n**       * The byte offset of the first rowid on the page, if it exists\n**         and occurs before the first term (otherwise 0).\n**\n**       * The byte offset of the start of the page footer. If the page\n**         footer is 0 bytes in size, then this field is the same as the\n**         size of the leaf page in bytes.\n**\n**     The page footer consists of a single varint for each term located\n**     on the page. Each varint is the byte offset of the current term\n**     within the page, delta-compressed against the previous value. In\n**     other words, the first varint in the footer is the byte offset of\n**     the first term, the second is the byte offset of the second less that\n**     of the first, and so on.\n**\n**     The term/doclist format described above is accurate if the entire\n**     term/doclist data fits on a single leaf page. If this is not the case,\n**     the format is changed in two ways:\n**\n**       + if the first rowid on a page occurs before the first term, it\n**         is stored as a literal value:\n**\n**             varint:  first rowid\n**\n**       + the first term on each page is stored in the same way as the\n**         very first term of the segment:\n**\n**             varint : size of first term\n**             blob:    first term data\n**\n** 5. Segment doclist indexes:\n**\n**   Doclist indexes are themselves b-trees, however they usually consist of\n**   a single leaf record only. The format of each doclist index leaf page \n**   is:\n**\n**     * Flags byte. Bits are:\n**         0x01: Clear if leaf is also the root page, otherwise set.\n**\n**     * Page number of fts index leaf page. As a varint.\n**\n**     * First rowid on page indicated by previous field. As a varint.\n**\n**     * A list of varints, one for each subsequent termless page. A \n**       positive delta if the termless page contains at least one rowid, \n**       or an 0x00 byte otherwise.\n**\n**   Internal doclist index nodes are:\n**\n**     * Flags byte. Bits are:\n**         0x01: Clear for root page, otherwise set.\n**\n**     * Page number of first child page. As a varint.\n**\n**     * Copy of first rowid on page indicated by previous field. As a varint.\n**\n**     * A list of delta-encoded varints - the first rowid on each subsequent\n**       child page. \n**\n*/\n\n/*\n** Rowids for the averages and structure records in the %_data table.\n*/\n#define FTS5_AVERAGES_ROWID     1    /* Rowid used for the averages record */\n#define FTS5_STRUCTURE_ROWID   10    /* The structure record */\n\n/*\n** Macros determining the rowids used by segment leaves and dlidx leaves\n** and nodes. All nodes and leaves are stored in the %_data table with large\n** positive rowids.\n**\n** Each segment has a unique non-zero 16-bit id.\n**\n** The rowid for each segment leaf is found by passing the segment id and \n** the leaf page number to the FTS5_SEGMENT_ROWID macro. Leaves are numbered\n** sequentially starting from 1.\n*/\n#define FTS5_DATA_ID_B     16     /* Max seg id number 65535 */\n#define FTS5_DATA_DLI_B     1     /* Doclist-index flag (1 bit) */\n#define FTS5_DATA_HEIGHT_B  5     /* Max dlidx tree height of 32 */\n#define FTS5_DATA_PAGE_B   31     /* Max page number of 2147483648 */\n\n#define fts5_dri(segid, dlidx, height, pgno) (                                 \\\n ((i64)(segid)  << (FTS5_DATA_PAGE_B+FTS5_DATA_HEIGHT_B+FTS5_DATA_DLI_B)) +    \\\n ((i64)(dlidx)  << (FTS5_DATA_PAGE_B + FTS5_DATA_HEIGHT_B)) +                  \\\n ((i64)(height) << (FTS5_DATA_PAGE_B)) +                                       \\\n ((i64)(pgno))                                                                 \\\n)\n\n#define FTS5_SEGMENT_ROWID(segid, pgno)       fts5_dri(segid, 0, 0, pgno)\n#define FTS5_DLIDX_ROWID(segid, height, pgno) fts5_dri(segid, 1, height, pgno)\n\n/*\n** Maximum segments permitted in a single index \n*/\n#define FTS5_MAX_SEGMENT 2000\n\n#ifdef SQLITE_DEBUG\nstatic int sqlite3Fts5Corrupt() { return SQLITE_CORRUPT_VTAB; }\n#endif\n\n\n/*\n** Each time a blob is read from the %_data table, it is padded with this\n** many zero bytes. This makes it easier to decode the various record formats\n** without overreading if the records are corrupt.\n*/\n#define FTS5_DATA_ZERO_PADDING 8\n#define FTS5_DATA_PADDING 20\n\ntypedef struct Fts5Data Fts5Data;\ntypedef struct Fts5DlidxIter Fts5DlidxIter;\ntypedef struct Fts5DlidxLvl Fts5DlidxLvl;\ntypedef struct Fts5DlidxWriter Fts5DlidxWriter;\ntypedef struct Fts5Iter Fts5Iter;\ntypedef struct Fts5PageWriter Fts5PageWriter;\ntypedef struct Fts5SegIter Fts5SegIter;\ntypedef struct Fts5DoclistIter Fts5DoclistIter;\ntypedef struct Fts5SegWriter Fts5SegWriter;\ntypedef struct Fts5Structure Fts5Structure;\ntypedef struct Fts5StructureLevel Fts5StructureLevel;\ntypedef struct Fts5StructureSegment Fts5StructureSegment;\n\nstruct Fts5Data {\n  u8 *p;                          /* Pointer to buffer containing record */\n  int nn;                         /* Size of record in bytes */\n  int szLeaf;                     /* Size of leaf without page-index */\n};\n\n/*\n** One object per %_data table.\n*/\nstruct Fts5Index {\n  Fts5Config *pConfig;            /* Virtual table configuration */\n  char *zDataTbl;                 /* Name of %_data table */\n  int nWorkUnit;                  /* Leaf pages in a \"unit\" of work */\n\n  /*\n  ** Variables related to the accumulation of tokens and doclists within the\n  ** in-memory hash tables before they are flushed to disk.\n  */\n  Fts5Hash *pHash;                /* Hash table for in-memory data */\n  int nPendingData;               /* Current bytes of pending data */\n  i64 iWriteRowid;                /* Rowid for current doc being written */\n  int bDelete;                    /* Current write is a delete */\n\n  /* Error state. */\n  int rc;                         /* Current error code */\n\n  /* State used by the fts5DataXXX() functions. */\n  sqlite3_blob *pReader;          /* RO incr-blob open on %_data table */\n  sqlite3_stmt *pWriter;          /* \"INSERT ... %_data VALUES(?,?)\" */\n  sqlite3_stmt *pDeleter;         /* \"DELETE FROM %_data ... id>=? AND id<=?\" */\n  sqlite3_stmt *pIdxWriter;       /* \"INSERT ... %_idx VALUES(?,?,?,?)\" */\n  sqlite3_stmt *pIdxDeleter;      /* \"DELETE FROM %_idx WHERE segid=? */\n  sqlite3_stmt *pIdxSelect;\n  int nRead;                      /* Total number of blocks read */\n\n  sqlite3_stmt *pDataVersion;\n  i64 iStructVersion;             /* data_version when pStruct read */\n  Fts5Structure *pStruct;         /* Current db structure (or NULL) */\n};\n\nstruct Fts5DoclistIter {\n  u8 *aEof;                       /* Pointer to 1 byte past end of doclist */\n\n  /* Output variables. aPoslist==0 at EOF */\n  i64 iRowid;\n  u8 *aPoslist;\n  int nPoslist;\n  int nSize;\n};\n\n/*\n** The contents of the \"structure\" record for each index are represented\n** using an Fts5Structure record in memory. Which uses instances of the \n** other Fts5StructureXXX types as components.\n*/\nstruct Fts5StructureSegment {\n  int iSegid;                     /* Segment id */\n  int pgnoFirst;                  /* First leaf page number in segment */\n  int pgnoLast;                   /* Last leaf page number in segment */\n};\nstruct Fts5StructureLevel {\n  int nMerge;                     /* Number of segments in incr-merge */\n  int nSeg;                       /* Total number of segments on level */\n  Fts5StructureSegment *aSeg;     /* Array of segments. aSeg[0] is oldest. */\n};\nstruct Fts5Structure {\n  int nRef;                       /* Object reference count */\n  u64 nWriteCounter;              /* Total leaves written to level 0 */\n  int nSegment;                   /* Total segments in this structure */\n  int nLevel;                     /* Number of levels in this index */\n  Fts5StructureLevel aLevel[1];   /* Array of nLevel level objects */\n};\n\n/*\n** An object of type Fts5SegWriter is used to write to segments.\n*/\nstruct Fts5PageWriter {\n  int pgno;                       /* Page number for this page */\n  int iPrevPgidx;                 /* Previous value written into pgidx */\n  Fts5Buffer buf;                 /* Buffer containing leaf data */\n  Fts5Buffer pgidx;               /* Buffer containing page-index */\n  Fts5Buffer term;                /* Buffer containing previous term on page */\n};\nstruct Fts5DlidxWriter {\n  int pgno;                       /* Page number for this page */\n  int bPrevValid;                 /* True if iPrev is valid */\n  i64 iPrev;                      /* Previous rowid value written to page */\n  Fts5Buffer buf;                 /* Buffer containing page data */\n};\nstruct Fts5SegWriter {\n  int iSegid;                     /* Segid to write to */\n  Fts5PageWriter writer;          /* PageWriter object */\n  i64 iPrevRowid;                 /* Previous rowid written to current leaf */\n  u8 bFirstRowidInDoclist;        /* True if next rowid is first in doclist */\n  u8 bFirstRowidInPage;           /* True if next rowid is first in page */\n  /* TODO1: Can use (writer.pgidx.n==0) instead of bFirstTermInPage */\n  u8 bFirstTermInPage;            /* True if next term will be first in leaf */\n  int nLeafWritten;               /* Number of leaf pages written */\n  int nEmpty;                     /* Number of contiguous term-less nodes */\n\n  int nDlidx;                     /* Allocated size of aDlidx[] array */\n  Fts5DlidxWriter *aDlidx;        /* Array of Fts5DlidxWriter objects */\n\n  /* Values to insert into the %_idx table */\n  Fts5Buffer btterm;              /* Next term to insert into %_idx table */\n  int iBtPage;                    /* Page number corresponding to btterm */\n};\n\ntypedef struct Fts5CResult Fts5CResult;\nstruct Fts5CResult {\n  u16 iFirst;                     /* aSeg[] index of firstest iterator */\n  u8 bTermEq;                     /* True if the terms are equal */\n};\n\n/*\n** Object for iterating through a single segment, visiting each term/rowid\n** pair in the segment.\n**\n** pSeg:\n**   The segment to iterate through.\n**\n** iLeafPgno:\n**   Current leaf page number within segment.\n**\n** iLeafOffset:\n**   Byte offset within the current leaf that is the first byte of the \n**   position list data (one byte passed the position-list size field).\n**   rowid field of the current entry. Usually this is the size field of the\n**   position list data. The exception is if the rowid for the current entry \n**   is the last thing on the leaf page.\n**\n** pLeaf:\n**   Buffer containing current leaf page data. Set to NULL at EOF.\n**\n** iTermLeafPgno, iTermLeafOffset:\n**   Leaf page number containing the last term read from the segment. And\n**   the offset immediately following the term data.\n**\n** flags:\n**   Mask of FTS5_SEGITER_XXX values. Interpreted as follows:\n**\n**   FTS5_SEGITER_ONETERM:\n**     If set, set the iterator to point to EOF after the current doclist \n**     has been exhausted. Do not proceed to the next term in the segment.\n**\n**   FTS5_SEGITER_REVERSE:\n**     This flag is only ever set if FTS5_SEGITER_ONETERM is also set. If\n**     it is set, iterate through rowid in descending order instead of the\n**     default ascending order.\n**\n** iRowidOffset/nRowidOffset/aRowidOffset:\n**     These are used if the FTS5_SEGITER_REVERSE flag is set.\n**\n**     For each rowid on the page corresponding to the current term, the\n**     corresponding aRowidOffset[] entry is set to the byte offset of the\n**     start of the \"position-list-size\" field within the page.\n**\n** iTermIdx:\n**     Index of current term on iTermLeafPgno.\n*/\nstruct Fts5SegIter {\n  Fts5StructureSegment *pSeg;     /* Segment to iterate through */\n  int flags;                      /* Mask of configuration flags */\n  int iLeafPgno;                  /* Current leaf page number */\n  Fts5Data *pLeaf;                /* Current leaf data */\n  Fts5Data *pNextLeaf;            /* Leaf page (iLeafPgno+1) */\n  int iLeafOffset;                /* Byte offset within current leaf */\n\n  /* Next method */\n  void (*xNext)(Fts5Index*, Fts5SegIter*, int*);\n\n  /* The page and offset from which the current term was read. The offset \n  ** is the offset of the first rowid in the current doclist.  */\n  int iTermLeafPgno;\n  int iTermLeafOffset;\n\n  int iPgidxOff;                  /* Next offset in pgidx */\n  int iEndofDoclist;\n\n  /* The following are only used if the FTS5_SEGITER_REVERSE flag is set. */\n  int iRowidOffset;               /* Current entry in aRowidOffset[] */\n  int nRowidOffset;               /* Allocated size of aRowidOffset[] array */\n  int *aRowidOffset;              /* Array of offset to rowid fields */\n\n  Fts5DlidxIter *pDlidx;          /* If there is a doclist-index */\n\n  /* Variables populated based on current entry. */\n  Fts5Buffer term;                /* Current term */\n  i64 iRowid;                     /* Current rowid */\n  int nPos;                       /* Number of bytes in current position list */\n  u8 bDel;                        /* True if the delete flag is set */\n};\n\n/*\n** Argument is a pointer to an Fts5Data structure that contains a \n** leaf page.\n*/\n#define ASSERT_SZLEAF_OK(x) assert( \\\n    (x)->szLeaf==(x)->nn || (x)->szLeaf==fts5GetU16(&(x)->p[2]) \\\n)\n\n#define FTS5_SEGITER_ONETERM 0x01\n#define FTS5_SEGITER_REVERSE 0x02\n\n/* \n** Argument is a pointer to an Fts5Data structure that contains a leaf\n** page. This macro evaluates to true if the leaf contains no terms, or\n** false if it contains at least one term.\n*/\n#define fts5LeafIsTermless(x) ((x)->szLeaf >= (x)->nn)\n\n#define fts5LeafTermOff(x, i) (fts5GetU16(&(x)->p[(x)->szLeaf + (i)*2]))\n\n#define fts5LeafFirstRowidOff(x) (fts5GetU16((x)->p))\n\n/*\n** Object for iterating through the merged results of one or more segments,\n** visiting each term/rowid pair in the merged data.\n**\n** nSeg is always a power of two greater than or equal to the number of\n** segments that this object is merging data from. Both the aSeg[] and\n** aFirst[] arrays are sized at nSeg entries. The aSeg[] array is padded\n** with zeroed objects - these are handled as if they were iterators opened\n** on empty segments.\n**\n** The results of comparing segments aSeg[N] and aSeg[N+1], where N is an\n** even number, is stored in aFirst[(nSeg+N)/2]. The \"result\" of the \n** comparison in this context is the index of the iterator that currently\n** points to the smaller term/rowid combination. Iterators at EOF are\n** considered to be greater than all other iterators.\n**\n** aFirst[1] contains the index in aSeg[] of the iterator that points to\n** the smallest key overall. aFirst[0] is unused. \n**\n** poslist:\n**   Used by sqlite3Fts5IterPoslist() when the poslist needs to be buffered.\n**   There is no way to tell if this is populated or not.\n*/\nstruct Fts5Iter {\n  Fts5IndexIter base;             /* Base class containing output vars */\n\n  Fts5Index *pIndex;              /* Index that owns this iterator */\n  Fts5Structure *pStruct;         /* Database structure for this iterator */\n  Fts5Buffer poslist;             /* Buffer containing current poslist */\n  Fts5Colset *pColset;            /* Restrict matches to these columns */\n\n  /* Invoked to set output variables. */\n  void (*xSetOutputs)(Fts5Iter*, Fts5SegIter*);\n\n  int nSeg;                       /* Size of aSeg[] array */\n  int bRev;                       /* True to iterate in reverse order */\n  u8 bSkipEmpty;                  /* True to skip deleted entries */\n\n  i64 iSwitchRowid;               /* Firstest rowid of other than aFirst[1] */\n  Fts5CResult *aFirst;            /* Current merge state (see above) */\n  Fts5SegIter aSeg[1];            /* Array of segment iterators */\n};\n\n\n/*\n** An instance of the following type is used to iterate through the contents\n** of a doclist-index record.\n**\n** pData:\n**   Record containing the doclist-index data.\n**\n** bEof:\n**   Set to true once iterator has reached EOF.\n**\n** iOff:\n**   Set to the current offset within record pData.\n*/\nstruct Fts5DlidxLvl {\n  Fts5Data *pData;              /* Data for current page of this level */\n  int iOff;                     /* Current offset into pData */\n  int bEof;                     /* At EOF already */\n  int iFirstOff;                /* Used by reverse iterators */\n\n  /* Output variables */\n  int iLeafPgno;                /* Page number of current leaf page */\n  i64 iRowid;                   /* First rowid on leaf iLeafPgno */\n};\nstruct Fts5DlidxIter {\n  int nLvl;\n  int iSegid;\n  Fts5DlidxLvl aLvl[1];\n};\n\nstatic void fts5PutU16(u8 *aOut, u16 iVal){\n  aOut[0] = (iVal>>8);\n  aOut[1] = (iVal&0xFF);\n}\n\nstatic u16 fts5GetU16(const u8 *aIn){\n  return ((u16)aIn[0] << 8) + aIn[1];\n} \n\n/*\n** Allocate and return a buffer at least nByte bytes in size.\n**\n** If an OOM error is encountered, return NULL and set the error code in\n** the Fts5Index handle passed as the first argument.\n*/\nstatic void *fts5IdxMalloc(Fts5Index *p, int nByte){\n  return sqlite3Fts5MallocZero(&p->rc, nByte);\n}\n\n/*\n** Compare the contents of the pLeft buffer with the pRight/nRight blob.\n**\n** Return -ve if pLeft is smaller than pRight, 0 if they are equal or\n** +ve if pRight is smaller than pLeft. In other words:\n**\n**     res = *pLeft - *pRight\n*/\n#ifdef SQLITE_DEBUG\nstatic int fts5BufferCompareBlob(\n  Fts5Buffer *pLeft,              /* Left hand side of comparison */\n  const u8 *pRight, int nRight    /* Right hand side of comparison */\n){\n  int nCmp = MIN(pLeft->n, nRight);\n  int res = memcmp(pLeft->p, pRight, nCmp);\n  return (res==0 ? (pLeft->n - nRight) : res);\n}\n#endif\n\n/*\n** Compare the contents of the two buffers using memcmp(). If one buffer\n** is a prefix of the other, it is considered the lesser.\n**\n** Return -ve if pLeft is smaller than pRight, 0 if they are equal or\n** +ve if pRight is smaller than pLeft. In other words:\n**\n**     res = *pLeft - *pRight\n*/\nstatic int fts5BufferCompare(Fts5Buffer *pLeft, Fts5Buffer *pRight){\n  int nCmp = MIN(pLeft->n, pRight->n);\n  int res = memcmp(pLeft->p, pRight->p, nCmp);\n  return (res==0 ? (pLeft->n - pRight->n) : res);\n}\n\nstatic int fts5LeafFirstTermOff(Fts5Data *pLeaf){\n  int ret;\n  fts5GetVarint32(&pLeaf->p[pLeaf->szLeaf], ret);\n  return ret;\n}\n\n/*\n** Close the read-only blob handle, if it is open.\n*/\nstatic void fts5CloseReader(Fts5Index *p){\n  if( p->pReader ){\n    sqlite3_blob *pReader = p->pReader;\n    p->pReader = 0;\n    sqlite3_blob_close(pReader);\n  }\n}\n\n\n/*\n** Retrieve a record from the %_data table.\n**\n** If an error occurs, NULL is returned and an error left in the \n** Fts5Index object.\n*/\nstatic Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){\n  Fts5Data *pRet = 0;\n  if( p->rc==SQLITE_OK ){\n    int rc = SQLITE_OK;\n\n    if( p->pReader ){\n      /* This call may return SQLITE_ABORT if there has been a savepoint\n      ** rollback since it was last used. In this case a new blob handle\n      ** is required.  */\n      sqlite3_blob *pBlob = p->pReader;\n      p->pReader = 0;\n      rc = sqlite3_blob_reopen(pBlob, iRowid);\n      assert( p->pReader==0 );\n      p->pReader = pBlob;\n      if( rc!=SQLITE_OK ){\n        fts5CloseReader(p);\n      }\n      if( rc==SQLITE_ABORT ) rc = SQLITE_OK;\n    }\n\n    /* If the blob handle is not open at this point, open it and seek \n    ** to the requested entry.  */\n    if( p->pReader==0 && rc==SQLITE_OK ){\n      Fts5Config *pConfig = p->pConfig;\n      rc = sqlite3_blob_open(pConfig->db, \n          pConfig->zDb, p->zDataTbl, \"block\", iRowid, 0, &p->pReader\n      );\n    }\n\n    /* If either of the sqlite3_blob_open() or sqlite3_blob_reopen() calls\n    ** above returned SQLITE_ERROR, return SQLITE_CORRUPT_VTAB instead.\n    ** All the reasons those functions might return SQLITE_ERROR - missing\n    ** table, missing row, non-blob/text in block column - indicate \n    ** backing store corruption.  */\n    if( rc==SQLITE_ERROR ) rc = FTS5_CORRUPT;\n\n    if( rc==SQLITE_OK ){\n      u8 *aOut = 0;               /* Read blob data into this buffer */\n      int nByte = sqlite3_blob_bytes(p->pReader);\n      int nAlloc = sizeof(Fts5Data) + nByte + FTS5_DATA_PADDING;\n      pRet = (Fts5Data*)sqlite3_malloc(nAlloc);\n      if( pRet ){\n        pRet->nn = nByte;\n        aOut = pRet->p = (u8*)&pRet[1];\n      }else{\n        rc = SQLITE_NOMEM;\n      }\n\n      if( rc==SQLITE_OK ){\n        rc = sqlite3_blob_read(p->pReader, aOut, nByte, 0);\n      }\n      if( rc!=SQLITE_OK ){\n        sqlite3_free(pRet);\n        pRet = 0;\n      }else{\n        /* TODO1: Fix this */\n        pRet->szLeaf = fts5GetU16(&pRet->p[2]);\n      }\n    }\n    p->rc = rc;\n    p->nRead++;\n  }\n\n  assert( (pRet==0)==(p->rc!=SQLITE_OK) );\n  return pRet;\n}\n\n/*\n** Release a reference to data record returned by an earlier call to\n** fts5DataRead().\n*/\nstatic void fts5DataRelease(Fts5Data *pData){\n  sqlite3_free(pData);\n}\n\nstatic Fts5Data *fts5LeafRead(Fts5Index *p, i64 iRowid){\n  Fts5Data *pRet = fts5DataRead(p, iRowid);\n  if( pRet ){\n    if( pRet->szLeaf>pRet->nn ){\n      p->rc = FTS5_CORRUPT;\n      fts5DataRelease(pRet);\n      pRet = 0;\n    }\n  }\n  return pRet;\n}\n\nstatic int fts5IndexPrepareStmt(\n  Fts5Index *p,\n  sqlite3_stmt **ppStmt,\n  char *zSql\n){\n  if( p->rc==SQLITE_OK ){\n    if( zSql ){\n      p->rc = sqlite3_prepare_v2(p->pConfig->db, zSql, -1, ppStmt, 0);\n    }else{\n      p->rc = SQLITE_NOMEM;\n    }\n  }\n  sqlite3_free(zSql);\n  return p->rc;\n}\n\n\n/*\n** INSERT OR REPLACE a record into the %_data table.\n*/\nstatic void fts5DataWrite(Fts5Index *p, i64 iRowid, const u8 *pData, int nData){\n  if( p->rc!=SQLITE_OK ) return;\n\n  if( p->pWriter==0 ){\n    Fts5Config *pConfig = p->pConfig;\n    fts5IndexPrepareStmt(p, &p->pWriter, sqlite3_mprintf(\n          \"REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)\", \n          pConfig->zDb, pConfig->zName\n    ));\n    if( p->rc ) return;\n  }\n\n  sqlite3_bind_int64(p->pWriter, 1, iRowid);\n  sqlite3_bind_blob(p->pWriter, 2, pData, nData, SQLITE_STATIC);\n  sqlite3_step(p->pWriter);\n  p->rc = sqlite3_reset(p->pWriter);\n}\n\n/*\n** Execute the following SQL:\n**\n**     DELETE FROM %_data WHERE id BETWEEN $iFirst AND $iLast\n*/\nstatic void fts5DataDelete(Fts5Index *p, i64 iFirst, i64 iLast){\n  if( p->rc!=SQLITE_OK ) return;\n\n  if( p->pDeleter==0 ){\n    int rc;\n    Fts5Config *pConfig = p->pConfig;\n    char *zSql = sqlite3_mprintf(\n        \"DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?\", \n          pConfig->zDb, pConfig->zName\n    );\n    if( zSql==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p->pDeleter, 0);\n      sqlite3_free(zSql);\n    }\n    if( rc!=SQLITE_OK ){\n      p->rc = rc;\n      return;\n    }\n  }\n\n  sqlite3_bind_int64(p->pDeleter, 1, iFirst);\n  sqlite3_bind_int64(p->pDeleter, 2, iLast);\n  sqlite3_step(p->pDeleter);\n  p->rc = sqlite3_reset(p->pDeleter);\n}\n\n/*\n** Remove all records associated with segment iSegid.\n*/\nstatic void fts5DataRemoveSegment(Fts5Index *p, int iSegid){\n  i64 iFirst = FTS5_SEGMENT_ROWID(iSegid, 0);\n  i64 iLast = FTS5_SEGMENT_ROWID(iSegid+1, 0)-1;\n  fts5DataDelete(p, iFirst, iLast);\n  if( p->pIdxDeleter==0 ){\n    Fts5Config *pConfig = p->pConfig;\n    fts5IndexPrepareStmt(p, &p->pIdxDeleter, sqlite3_mprintf(\n          \"DELETE FROM '%q'.'%q_idx' WHERE segid=?\",\n          pConfig->zDb, pConfig->zName\n    ));\n  }\n  if( p->rc==SQLITE_OK ){\n    sqlite3_bind_int(p->pIdxDeleter, 1, iSegid);\n    sqlite3_step(p->pIdxDeleter);\n    p->rc = sqlite3_reset(p->pIdxDeleter);\n  }\n}\n\n/*\n** Release a reference to an Fts5Structure object returned by an earlier \n** call to fts5StructureRead() or fts5StructureDecode().\n*/\nstatic void fts5StructureRelease(Fts5Structure *pStruct){\n  if( pStruct && 0>=(--pStruct->nRef) ){\n    int i;\n    assert( pStruct->nRef==0 );\n    for(i=0; i<pStruct->nLevel; i++){\n      sqlite3_free(pStruct->aLevel[i].aSeg);\n    }\n    sqlite3_free(pStruct);\n  }\n}\n\nstatic void fts5StructureRef(Fts5Structure *pStruct){\n  pStruct->nRef++;\n}\n\n/*\n** Deserialize and return the structure record currently stored in serialized\n** form within buffer pData/nData.\n**\n** The Fts5Structure.aLevel[] and each Fts5StructureLevel.aSeg[] array\n** are over-allocated by one slot. This allows the structure contents\n** to be more easily edited.\n**\n** If an error occurs, *ppOut is set to NULL and an SQLite error code\n** returned. Otherwise, *ppOut is set to point to the new object and\n** SQLITE_OK returned.\n*/\nstatic int fts5StructureDecode(\n  const u8 *pData,                /* Buffer containing serialized structure */\n  int nData,                      /* Size of buffer pData in bytes */\n  int *piCookie,                  /* Configuration cookie value */\n  Fts5Structure **ppOut           /* OUT: Deserialized object */\n){\n  int rc = SQLITE_OK;\n  int i = 0;\n  int iLvl;\n  int nLevel = 0;\n  int nSegment = 0;\n  int nByte;                      /* Bytes of space to allocate at pRet */\n  Fts5Structure *pRet = 0;        /* Structure object to return */\n\n  /* Grab the cookie value */\n  if( piCookie ) *piCookie = sqlite3Fts5Get32(pData);\n  i = 4;\n\n  /* Read the total number of levels and segments from the start of the\n  ** structure record.  */\n  i += fts5GetVarint32(&pData[i], nLevel);\n  i += fts5GetVarint32(&pData[i], nSegment);\n  nByte = (\n      sizeof(Fts5Structure) +                    /* Main structure */\n      sizeof(Fts5StructureLevel) * (nLevel-1)    /* aLevel[] array */\n  );\n  pRet = (Fts5Structure*)sqlite3Fts5MallocZero(&rc, nByte);\n\n  if( pRet ){\n    pRet->nRef = 1;\n    pRet->nLevel = nLevel;\n    pRet->nSegment = nSegment;\n    i += sqlite3Fts5GetVarint(&pData[i], &pRet->nWriteCounter);\n\n    for(iLvl=0; rc==SQLITE_OK && iLvl<nLevel; iLvl++){\n      Fts5StructureLevel *pLvl = &pRet->aLevel[iLvl];\n      int nTotal = 0;\n      int iSeg;\n\n      if( i>=nData ){\n        rc = FTS5_CORRUPT;\n      }else{\n        i += fts5GetVarint32(&pData[i], pLvl->nMerge);\n        i += fts5GetVarint32(&pData[i], nTotal);\n        assert( nTotal>=pLvl->nMerge );\n        pLvl->aSeg = (Fts5StructureSegment*)sqlite3Fts5MallocZero(&rc, \n            nTotal * sizeof(Fts5StructureSegment)\n        );\n      }\n\n      if( rc==SQLITE_OK ){\n        pLvl->nSeg = nTotal;\n        for(iSeg=0; iSeg<nTotal; iSeg++){\n          if( i>=nData ){\n            rc = FTS5_CORRUPT;\n            break;\n          }\n          i += fts5GetVarint32(&pData[i], pLvl->aSeg[iSeg].iSegid);\n          i += fts5GetVarint32(&pData[i], pLvl->aSeg[iSeg].pgnoFirst);\n          i += fts5GetVarint32(&pData[i], pLvl->aSeg[iSeg].pgnoLast);\n        }\n      }\n    }\n    if( rc!=SQLITE_OK ){\n      fts5StructureRelease(pRet);\n      pRet = 0;\n    }\n  }\n\n  *ppOut = pRet;\n  return rc;\n}\n\n/*\n**\n*/\nstatic void fts5StructureAddLevel(int *pRc, Fts5Structure **ppStruct){\n  if( *pRc==SQLITE_OK ){\n    Fts5Structure *pStruct = *ppStruct;\n    int nLevel = pStruct->nLevel;\n    int nByte = (\n        sizeof(Fts5Structure) +                  /* Main structure */\n        sizeof(Fts5StructureLevel) * (nLevel+1)  /* aLevel[] array */\n    );\n\n    pStruct = sqlite3_realloc(pStruct, nByte);\n    if( pStruct ){\n      memset(&pStruct->aLevel[nLevel], 0, sizeof(Fts5StructureLevel));\n      pStruct->nLevel++;\n      *ppStruct = pStruct;\n    }else{\n      *pRc = SQLITE_NOMEM;\n    }\n  }\n}\n\n/*\n** Extend level iLvl so that there is room for at least nExtra more\n** segments.\n*/\nstatic void fts5StructureExtendLevel(\n  int *pRc, \n  Fts5Structure *pStruct, \n  int iLvl, \n  int nExtra, \n  int bInsert\n){\n  if( *pRc==SQLITE_OK ){\n    Fts5StructureLevel *pLvl = &pStruct->aLevel[iLvl];\n    Fts5StructureSegment *aNew;\n    int nByte;\n\n    nByte = (pLvl->nSeg + nExtra) * sizeof(Fts5StructureSegment);\n    aNew = sqlite3_realloc(pLvl->aSeg, nByte);\n    if( aNew ){\n      if( bInsert==0 ){\n        memset(&aNew[pLvl->nSeg], 0, sizeof(Fts5StructureSegment) * nExtra);\n      }else{\n        int nMove = pLvl->nSeg * sizeof(Fts5StructureSegment);\n        memmove(&aNew[nExtra], aNew, nMove);\n        memset(aNew, 0, sizeof(Fts5StructureSegment) * nExtra);\n      }\n      pLvl->aSeg = aNew;\n    }else{\n      *pRc = SQLITE_NOMEM;\n    }\n  }\n}\n\nstatic Fts5Structure *fts5StructureReadUncached(Fts5Index *p){\n  Fts5Structure *pRet = 0;\n  Fts5Config *pConfig = p->pConfig;\n  int iCookie;                    /* Configuration cookie */\n  Fts5Data *pData;\n\n  pData = fts5DataRead(p, FTS5_STRUCTURE_ROWID);\n  if( p->rc==SQLITE_OK ){\n    /* TODO: Do we need this if the leaf-index is appended? Probably... */\n    memset(&pData->p[pData->nn], 0, FTS5_DATA_PADDING);\n    p->rc = fts5StructureDecode(pData->p, pData->nn, &iCookie, &pRet);\n    if( p->rc==SQLITE_OK && pConfig->iCookie!=iCookie ){\n      p->rc = sqlite3Fts5ConfigLoad(pConfig, iCookie);\n    }\n    fts5DataRelease(pData);\n    if( p->rc!=SQLITE_OK ){\n      fts5StructureRelease(pRet);\n      pRet = 0;\n    }\n  }\n\n  return pRet;\n}\n\nstatic i64 fts5IndexDataVersion(Fts5Index *p){\n  i64 iVersion = 0;\n\n  if( p->rc==SQLITE_OK ){\n    if( p->pDataVersion==0 ){\n      p->rc = fts5IndexPrepareStmt(p, &p->pDataVersion, \n          sqlite3_mprintf(\"PRAGMA %Q.data_version\", p->pConfig->zDb)\n          );\n      if( p->rc ) return 0;\n    }\n\n    if( SQLITE_ROW==sqlite3_step(p->pDataVersion) ){\n      iVersion = sqlite3_column_int64(p->pDataVersion, 0);\n    }\n    p->rc = sqlite3_reset(p->pDataVersion);\n  }\n\n  return iVersion;\n}\n\n/*\n** Read, deserialize and return the structure record.\n**\n** The Fts5Structure.aLevel[] and each Fts5StructureLevel.aSeg[] array\n** are over-allocated as described for function fts5StructureDecode() \n** above.\n**\n** If an error occurs, NULL is returned and an error code left in the\n** Fts5Index handle. If an error has already occurred when this function\n** is called, it is a no-op.\n*/\nstatic Fts5Structure *fts5StructureRead(Fts5Index *p){\n\n  if( p->pStruct==0 ){\n    p->iStructVersion = fts5IndexDataVersion(p);\n    if( p->rc==SQLITE_OK ){\n      p->pStruct = fts5StructureReadUncached(p);\n    }\n  }\n\n#if 0\n  else{\n    Fts5Structure *pTest = fts5StructureReadUncached(p);\n    if( pTest ){\n      int i, j;\n      assert_nc( p->pStruct->nSegment==pTest->nSegment );\n      assert_nc( p->pStruct->nLevel==pTest->nLevel );\n      for(i=0; i<pTest->nLevel; i++){\n        assert_nc( p->pStruct->aLevel[i].nMerge==pTest->aLevel[i].nMerge );\n        assert_nc( p->pStruct->aLevel[i].nSeg==pTest->aLevel[i].nSeg );\n        for(j=0; j<pTest->aLevel[i].nSeg; j++){\n          Fts5StructureSegment *p1 = &pTest->aLevel[i].aSeg[j];\n          Fts5StructureSegment *p2 = &p->pStruct->aLevel[i].aSeg[j];\n          assert_nc( p1->iSegid==p2->iSegid );\n          assert_nc( p1->pgnoFirst==p2->pgnoFirst );\n          assert_nc( p1->pgnoLast==p2->pgnoLast );\n        }\n      }\n      fts5StructureRelease(pTest);\n    }\n  }\n#endif\n\n  if( p->rc!=SQLITE_OK ) return 0;\n  assert( p->iStructVersion!=0 );\n  assert( p->pStruct!=0 );\n  fts5StructureRef(p->pStruct);\n  return p->pStruct;\n}\n\nstatic void fts5StructureInvalidate(Fts5Index *p){\n  if( p->pStruct ){\n    fts5StructureRelease(p->pStruct);\n    p->pStruct = 0;\n  }\n}\n\n/*\n** Return the total number of segments in index structure pStruct. This\n** function is only ever used as part of assert() conditions.\n*/\n#ifdef SQLITE_DEBUG\nstatic int fts5StructureCountSegments(Fts5Structure *pStruct){\n  int nSegment = 0;               /* Total number of segments */\n  if( pStruct ){\n    int iLvl;                     /* Used to iterate through levels */\n    for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){\n      nSegment += pStruct->aLevel[iLvl].nSeg;\n    }\n  }\n\n  return nSegment;\n}\n#endif\n\n#define fts5BufferSafeAppendBlob(pBuf, pBlob, nBlob) {     \\\n  assert( (pBuf)->nSpace>=((pBuf)->n+nBlob) );             \\\n  memcpy(&(pBuf)->p[(pBuf)->n], pBlob, nBlob);             \\\n  (pBuf)->n += nBlob;                                      \\\n}\n\n#define fts5BufferSafeAppendVarint(pBuf, iVal) {                \\\n  (pBuf)->n += sqlite3Fts5PutVarint(&(pBuf)->p[(pBuf)->n], (iVal));  \\\n  assert( (pBuf)->nSpace>=(pBuf)->n );                          \\\n}\n\n\n/*\n** Serialize and store the \"structure\" record.\n**\n** If an error occurs, leave an error code in the Fts5Index object. If an\n** error has already occurred, this function is a no-op.\n*/\nstatic void fts5StructureWrite(Fts5Index *p, Fts5Structure *pStruct){\n  if( p->rc==SQLITE_OK ){\n    Fts5Buffer buf;               /* Buffer to serialize record into */\n    int iLvl;                     /* Used to iterate through levels */\n    int iCookie;                  /* Cookie value to store */\n\n    assert( pStruct->nSegment==fts5StructureCountSegments(pStruct) );\n    memset(&buf, 0, sizeof(Fts5Buffer));\n\n    /* Append the current configuration cookie */\n    iCookie = p->pConfig->iCookie;\n    if( iCookie<0 ) iCookie = 0;\n\n    if( 0==sqlite3Fts5BufferSize(&p->rc, &buf, 4+9+9+9) ){\n      sqlite3Fts5Put32(buf.p, iCookie);\n      buf.n = 4;\n      fts5BufferSafeAppendVarint(&buf, pStruct->nLevel);\n      fts5BufferSafeAppendVarint(&buf, pStruct->nSegment);\n      fts5BufferSafeAppendVarint(&buf, (i64)pStruct->nWriteCounter);\n    }\n\n    for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){\n      int iSeg;                     /* Used to iterate through segments */\n      Fts5StructureLevel *pLvl = &pStruct->aLevel[iLvl];\n      fts5BufferAppendVarint(&p->rc, &buf, pLvl->nMerge);\n      fts5BufferAppendVarint(&p->rc, &buf, pLvl->nSeg);\n      assert( pLvl->nMerge<=pLvl->nSeg );\n\n      for(iSeg=0; iSeg<pLvl->nSeg; iSeg++){\n        fts5BufferAppendVarint(&p->rc, &buf, pLvl->aSeg[iSeg].iSegid);\n        fts5BufferAppendVarint(&p->rc, &buf, pLvl->aSeg[iSeg].pgnoFirst);\n        fts5BufferAppendVarint(&p->rc, &buf, pLvl->aSeg[iSeg].pgnoLast);\n      }\n    }\n\n    fts5DataWrite(p, FTS5_STRUCTURE_ROWID, buf.p, buf.n);\n    fts5BufferFree(&buf);\n  }\n}\n\n#if 0\nstatic void fts5DebugStructure(int*,Fts5Buffer*,Fts5Structure*);\nstatic void fts5PrintStructure(const char *zCaption, Fts5Structure *pStruct){\n  int rc = SQLITE_OK;\n  Fts5Buffer buf;\n  memset(&buf, 0, sizeof(buf));\n  fts5DebugStructure(&rc, &buf, pStruct);\n  fprintf(stdout, \"%s: %s\\n\", zCaption, buf.p);\n  fflush(stdout);\n  fts5BufferFree(&buf);\n}\n#else\n# define fts5PrintStructure(x,y)\n#endif\n\nstatic int fts5SegmentSize(Fts5StructureSegment *pSeg){\n  return 1 + pSeg->pgnoLast - pSeg->pgnoFirst;\n}\n\n/*\n** Return a copy of index structure pStruct. Except, promote as many \n** segments as possible to level iPromote. If an OOM occurs, NULL is \n** returned.\n*/\nstatic void fts5StructurePromoteTo(\n  Fts5Index *p,\n  int iPromote,\n  int szPromote,\n  Fts5Structure *pStruct\n){\n  int il, is;\n  Fts5StructureLevel *pOut = &pStruct->aLevel[iPromote];\n\n  if( pOut->nMerge==0 ){\n    for(il=iPromote+1; il<pStruct->nLevel; il++){\n      Fts5StructureLevel *pLvl = &pStruct->aLevel[il];\n      if( pLvl->nMerge ) return;\n      for(is=pLvl->nSeg-1; is>=0; is--){\n        int sz = fts5SegmentSize(&pLvl->aSeg[is]);\n        if( sz>szPromote ) return;\n        fts5StructureExtendLevel(&p->rc, pStruct, iPromote, 1, 1);\n        if( p->rc ) return;\n        memcpy(pOut->aSeg, &pLvl->aSeg[is], sizeof(Fts5StructureSegment));\n        pOut->nSeg++;\n        pLvl->nSeg--;\n      }\n    }\n  }\n}\n\n/*\n** A new segment has just been written to level iLvl of index structure\n** pStruct. This function determines if any segments should be promoted\n** as a result. Segments are promoted in two scenarios:\n**\n**   a) If the segment just written is smaller than one or more segments\n**      within the previous populated level, it is promoted to the previous\n**      populated level.\n**\n**   b) If the segment just written is larger than the newest segment on\n**      the next populated level, then that segment, and any other adjacent\n**      segments that are also smaller than the one just written, are \n**      promoted. \n**\n** If one or more segments are promoted, the structure object is updated\n** to reflect this.\n*/\nstatic void fts5StructurePromote(\n  Fts5Index *p,                   /* FTS5 backend object */\n  int iLvl,                       /* Index level just updated */\n  Fts5Structure *pStruct          /* Index structure */\n){\n  if( p->rc==SQLITE_OK ){\n    int iTst;\n    int iPromote = -1;\n    int szPromote = 0;            /* Promote anything this size or smaller */\n    Fts5StructureSegment *pSeg;   /* Segment just written */\n    int szSeg;                    /* Size of segment just written */\n    int nSeg = pStruct->aLevel[iLvl].nSeg;\n\n    if( nSeg==0 ) return;\n    pSeg = &pStruct->aLevel[iLvl].aSeg[pStruct->aLevel[iLvl].nSeg-1];\n    szSeg = (1 + pSeg->pgnoLast - pSeg->pgnoFirst);\n\n    /* Check for condition (a) */\n    for(iTst=iLvl-1; iTst>=0 && pStruct->aLevel[iTst].nSeg==0; iTst--);\n    if( iTst>=0 ){\n      int i;\n      int szMax = 0;\n      Fts5StructureLevel *pTst = &pStruct->aLevel[iTst];\n      assert( pTst->nMerge==0 );\n      for(i=0; i<pTst->nSeg; i++){\n        int sz = pTst->aSeg[i].pgnoLast - pTst->aSeg[i].pgnoFirst + 1;\n        if( sz>szMax ) szMax = sz;\n      }\n      if( szMax>=szSeg ){\n        /* Condition (a) is true. Promote the newest segment on level \n        ** iLvl to level iTst.  */\n        iPromote = iTst;\n        szPromote = szMax;\n      }\n    }\n\n    /* If condition (a) is not met, assume (b) is true. StructurePromoteTo()\n    ** is a no-op if it is not.  */\n    if( iPromote<0 ){\n      iPromote = iLvl;\n      szPromote = szSeg;\n    }\n    fts5StructurePromoteTo(p, iPromote, szPromote, pStruct);\n  }\n}\n\n\n/*\n** Advance the iterator passed as the only argument. If the end of the \n** doclist-index page is reached, return non-zero.\n*/\nstatic int fts5DlidxLvlNext(Fts5DlidxLvl *pLvl){\n  Fts5Data *pData = pLvl->pData;\n\n  if( pLvl->iOff==0 ){\n    assert( pLvl->bEof==0 );\n    pLvl->iOff = 1;\n    pLvl->iOff += fts5GetVarint32(&pData->p[1], pLvl->iLeafPgno);\n    pLvl->iOff += fts5GetVarint(&pData->p[pLvl->iOff], (u64*)&pLvl->iRowid);\n    pLvl->iFirstOff = pLvl->iOff;\n  }else{\n    int iOff;\n    for(iOff=pLvl->iOff; iOff<pData->nn; iOff++){\n      if( pData->p[iOff] ) break; \n    }\n\n    if( iOff<pData->nn ){\n      i64 iVal;\n      pLvl->iLeafPgno += (iOff - pLvl->iOff) + 1;\n      iOff += fts5GetVarint(&pData->p[iOff], (u64*)&iVal);\n      pLvl->iRowid += iVal;\n      pLvl->iOff = iOff;\n    }else{\n      pLvl->bEof = 1;\n    }\n  }\n\n  return pLvl->bEof;\n}\n\n/*\n** Advance the iterator passed as the only argument.\n*/\nstatic int fts5DlidxIterNextR(Fts5Index *p, Fts5DlidxIter *pIter, int iLvl){\n  Fts5DlidxLvl *pLvl = &pIter->aLvl[iLvl];\n\n  assert( iLvl<pIter->nLvl );\n  if( fts5DlidxLvlNext(pLvl) ){\n    if( (iLvl+1) < pIter->nLvl ){\n      fts5DlidxIterNextR(p, pIter, iLvl+1);\n      if( pLvl[1].bEof==0 ){\n        fts5DataRelease(pLvl->pData);\n        memset(pLvl, 0, sizeof(Fts5DlidxLvl));\n        pLvl->pData = fts5DataRead(p, \n            FTS5_DLIDX_ROWID(pIter->iSegid, iLvl, pLvl[1].iLeafPgno)\n        );\n        if( pLvl->pData ) fts5DlidxLvlNext(pLvl);\n      }\n    }\n  }\n\n  return pIter->aLvl[0].bEof;\n}\nstatic int fts5DlidxIterNext(Fts5Index *p, Fts5DlidxIter *pIter){\n  return fts5DlidxIterNextR(p, pIter, 0);\n}\n\n/*\n** The iterator passed as the first argument has the following fields set\n** as follows. This function sets up the rest of the iterator so that it\n** points to the first rowid in the doclist-index.\n**\n**   pData:\n**     pointer to doclist-index record, \n**\n** When this function is called pIter->iLeafPgno is the page number the\n** doclist is associated with (the one featuring the term).\n*/\nstatic int fts5DlidxIterFirst(Fts5DlidxIter *pIter){\n  int i;\n  for(i=0; i<pIter->nLvl; i++){\n    fts5DlidxLvlNext(&pIter->aLvl[i]);\n  }\n  return pIter->aLvl[0].bEof;\n}\n\n\nstatic int fts5DlidxIterEof(Fts5Index *p, Fts5DlidxIter *pIter){\n  return p->rc!=SQLITE_OK || pIter->aLvl[0].bEof;\n}\n\nstatic void fts5DlidxIterLast(Fts5Index *p, Fts5DlidxIter *pIter){\n  int i;\n\n  /* Advance each level to the last entry on the last page */\n  for(i=pIter->nLvl-1; p->rc==SQLITE_OK && i>=0; i--){\n    Fts5DlidxLvl *pLvl = &pIter->aLvl[i];\n    while( fts5DlidxLvlNext(pLvl)==0 );\n    pLvl->bEof = 0;\n\n    if( i>0 ){\n      Fts5DlidxLvl *pChild = &pLvl[-1];\n      fts5DataRelease(pChild->pData);\n      memset(pChild, 0, sizeof(Fts5DlidxLvl));\n      pChild->pData = fts5DataRead(p, \n          FTS5_DLIDX_ROWID(pIter->iSegid, i-1, pLvl->iLeafPgno)\n      );\n    }\n  }\n}\n\n/*\n** Move the iterator passed as the only argument to the previous entry.\n*/\nstatic int fts5DlidxLvlPrev(Fts5DlidxLvl *pLvl){\n  int iOff = pLvl->iOff;\n\n  assert( pLvl->bEof==0 );\n  if( iOff<=pLvl->iFirstOff ){\n    pLvl->bEof = 1;\n  }else{\n    u8 *a = pLvl->pData->p;\n    i64 iVal;\n    int iLimit;\n    int ii;\n    int nZero = 0;\n\n    /* Currently iOff points to the first byte of a varint. This block \n    ** decrements iOff until it points to the first byte of the previous \n    ** varint. Taking care not to read any memory locations that occur\n    ** before the buffer in memory.  */\n    iLimit = (iOff>9 ? iOff-9 : 0);\n    for(iOff--; iOff>iLimit; iOff--){\n      if( (a[iOff-1] & 0x80)==0 ) break;\n    }\n\n    fts5GetVarint(&a[iOff], (u64*)&iVal);\n    pLvl->iRowid -= iVal;\n    pLvl->iLeafPgno--;\n\n    /* Skip backwards past any 0x00 varints. */\n    for(ii=iOff-1; ii>=pLvl->iFirstOff && a[ii]==0x00; ii--){\n      nZero++;\n    }\n    if( ii>=pLvl->iFirstOff && (a[ii] & 0x80) ){\n      /* The byte immediately before the last 0x00 byte has the 0x80 bit\n      ** set. So the last 0x00 is only a varint 0 if there are 8 more 0x80\n      ** bytes before a[ii]. */\n      int bZero = 0;              /* True if last 0x00 counts */\n      if( (ii-8)>=pLvl->iFirstOff ){\n        int j;\n        for(j=1; j<=8 && (a[ii-j] & 0x80); j++);\n        bZero = (j>8);\n      }\n      if( bZero==0 ) nZero--;\n    }\n    pLvl->iLeafPgno -= nZero;\n    pLvl->iOff = iOff - nZero;\n  }\n\n  return pLvl->bEof;\n}\n\nstatic int fts5DlidxIterPrevR(Fts5Index *p, Fts5DlidxIter *pIter, int iLvl){\n  Fts5DlidxLvl *pLvl = &pIter->aLvl[iLvl];\n\n  assert( iLvl<pIter->nLvl );\n  if( fts5DlidxLvlPrev(pLvl) ){\n    if( (iLvl+1) < pIter->nLvl ){\n      fts5DlidxIterPrevR(p, pIter, iLvl+1);\n      if( pLvl[1].bEof==0 ){\n        fts5DataRelease(pLvl->pData);\n        memset(pLvl, 0, sizeof(Fts5DlidxLvl));\n        pLvl->pData = fts5DataRead(p, \n            FTS5_DLIDX_ROWID(pIter->iSegid, iLvl, pLvl[1].iLeafPgno)\n        );\n        if( pLvl->pData ){\n          while( fts5DlidxLvlNext(pLvl)==0 );\n          pLvl->bEof = 0;\n        }\n      }\n    }\n  }\n\n  return pIter->aLvl[0].bEof;\n}\nstatic int fts5DlidxIterPrev(Fts5Index *p, Fts5DlidxIter *pIter){\n  return fts5DlidxIterPrevR(p, pIter, 0);\n}\n\n/*\n** Free a doclist-index iterator object allocated by fts5DlidxIterInit().\n*/\nstatic void fts5DlidxIterFree(Fts5DlidxIter *pIter){\n  if( pIter ){\n    int i;\n    for(i=0; i<pIter->nLvl; i++){\n      fts5DataRelease(pIter->aLvl[i].pData);\n    }\n    sqlite3_free(pIter);\n  }\n}\n\nstatic Fts5DlidxIter *fts5DlidxIterInit(\n  Fts5Index *p,                   /* Fts5 Backend to iterate within */\n  int bRev,                       /* True for ORDER BY ASC */\n  int iSegid,                     /* Segment id */\n  int iLeafPg                     /* Leaf page number to load dlidx for */\n){\n  Fts5DlidxIter *pIter = 0;\n  int i;\n  int bDone = 0;\n\n  for(i=0; p->rc==SQLITE_OK && bDone==0; i++){\n    int nByte = sizeof(Fts5DlidxIter) + i * sizeof(Fts5DlidxLvl);\n    Fts5DlidxIter *pNew;\n\n    pNew = (Fts5DlidxIter*)sqlite3_realloc(pIter, nByte);\n    if( pNew==0 ){\n      p->rc = SQLITE_NOMEM;\n    }else{\n      i64 iRowid = FTS5_DLIDX_ROWID(iSegid, i, iLeafPg);\n      Fts5DlidxLvl *pLvl = &pNew->aLvl[i];\n      pIter = pNew;\n      memset(pLvl, 0, sizeof(Fts5DlidxLvl));\n      pLvl->pData = fts5DataRead(p, iRowid);\n      if( pLvl->pData && (pLvl->pData->p[0] & 0x0001)==0 ){\n        bDone = 1;\n      }\n      pIter->nLvl = i+1;\n    }\n  }\n\n  if( p->rc==SQLITE_OK ){\n    pIter->iSegid = iSegid;\n    if( bRev==0 ){\n      fts5DlidxIterFirst(pIter);\n    }else{\n      fts5DlidxIterLast(p, pIter);\n    }\n  }\n\n  if( p->rc!=SQLITE_OK ){\n    fts5DlidxIterFree(pIter);\n    pIter = 0;\n  }\n\n  return pIter;\n}\n\nstatic i64 fts5DlidxIterRowid(Fts5DlidxIter *pIter){\n  return pIter->aLvl[0].iRowid;\n}\nstatic int fts5DlidxIterPgno(Fts5DlidxIter *pIter){\n  return pIter->aLvl[0].iLeafPgno;\n}\n\n/*\n** Load the next leaf page into the segment iterator.\n*/\nstatic void fts5SegIterNextPage(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegIter *pIter              /* Iterator to advance to next page */\n){\n  Fts5Data *pLeaf;\n  Fts5StructureSegment *pSeg = pIter->pSeg;\n  fts5DataRelease(pIter->pLeaf);\n  pIter->iLeafPgno++;\n  if( pIter->pNextLeaf ){\n    pIter->pLeaf = pIter->pNextLeaf;\n    pIter->pNextLeaf = 0;\n  }else if( pIter->iLeafPgno<=pSeg->pgnoLast ){\n    pIter->pLeaf = fts5LeafRead(p, \n        FTS5_SEGMENT_ROWID(pSeg->iSegid, pIter->iLeafPgno)\n    );\n  }else{\n    pIter->pLeaf = 0;\n  }\n  pLeaf = pIter->pLeaf;\n\n  if( pLeaf ){\n    pIter->iPgidxOff = pLeaf->szLeaf;\n    if( fts5LeafIsTermless(pLeaf) ){\n      pIter->iEndofDoclist = pLeaf->nn+1;\n    }else{\n      pIter->iPgidxOff += fts5GetVarint32(&pLeaf->p[pIter->iPgidxOff],\n          pIter->iEndofDoclist\n      );\n    }\n  }\n}\n\n/*\n** Argument p points to a buffer containing a varint to be interpreted as a\n** position list size field. Read the varint and return the number of bytes\n** read. Before returning, set *pnSz to the number of bytes in the position\n** list, and *pbDel to true if the delete flag is set, or false otherwise.\n*/\nstatic int fts5GetPoslistSize(const u8 *p, int *pnSz, int *pbDel){\n  int nSz;\n  int n = 0;\n  fts5FastGetVarint32(p, n, nSz);\n  assert_nc( nSz>=0 );\n  *pnSz = nSz/2;\n  *pbDel = nSz & 0x0001;\n  return n;\n}\n\n/*\n** Fts5SegIter.iLeafOffset currently points to the first byte of a\n** position-list size field. Read the value of the field and store it\n** in the following variables:\n**\n**   Fts5SegIter.nPos\n**   Fts5SegIter.bDel\n**\n** Leave Fts5SegIter.iLeafOffset pointing to the first byte of the \n** position list content (if any).\n*/\nstatic void fts5SegIterLoadNPos(Fts5Index *p, Fts5SegIter *pIter){\n  if( p->rc==SQLITE_OK ){\n    int iOff = pIter->iLeafOffset;  /* Offset to read at */\n    ASSERT_SZLEAF_OK(pIter->pLeaf);\n    if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){\n      int iEod = MIN(pIter->iEndofDoclist, pIter->pLeaf->szLeaf);\n      pIter->bDel = 0;\n      pIter->nPos = 1;\n      if( iOff<iEod && pIter->pLeaf->p[iOff]==0 ){\n        pIter->bDel = 1;\n        iOff++;\n        if( iOff<iEod && pIter->pLeaf->p[iOff]==0 ){\n          pIter->nPos = 1;\n          iOff++;\n        }else{\n          pIter->nPos = 0;\n        }\n      }\n    }else{\n      int nSz;\n      fts5FastGetVarint32(pIter->pLeaf->p, iOff, nSz);\n      pIter->bDel = (nSz & 0x0001);\n      pIter->nPos = nSz>>1;\n      assert_nc( pIter->nPos>=0 );\n    }\n    pIter->iLeafOffset = iOff;\n  }\n}\n\nstatic void fts5SegIterLoadRowid(Fts5Index *p, Fts5SegIter *pIter){\n  u8 *a = pIter->pLeaf->p;        /* Buffer to read data from */\n  int iOff = pIter->iLeafOffset;\n\n  ASSERT_SZLEAF_OK(pIter->pLeaf);\n  if( iOff>=pIter->pLeaf->szLeaf ){\n    fts5SegIterNextPage(p, pIter);\n    if( pIter->pLeaf==0 ){\n      if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;\n      return;\n    }\n    iOff = 4;\n    a = pIter->pLeaf->p;\n  }\n  iOff += sqlite3Fts5GetVarint(&a[iOff], (u64*)&pIter->iRowid);\n  pIter->iLeafOffset = iOff;\n}\n\n/*\n** Fts5SegIter.iLeafOffset currently points to the first byte of the \n** \"nSuffix\" field of a term. Function parameter nKeep contains the value\n** of the \"nPrefix\" field (if there was one - it is passed 0 if this is\n** the first term in the segment).\n**\n** This function populates:\n**\n**   Fts5SegIter.term\n**   Fts5SegIter.rowid\n**\n** accordingly and leaves (Fts5SegIter.iLeafOffset) set to the content of\n** the first position list. The position list belonging to document \n** (Fts5SegIter.iRowid).\n*/\nstatic void fts5SegIterLoadTerm(Fts5Index *p, Fts5SegIter *pIter, int nKeep){\n  u8 *a = pIter->pLeaf->p;        /* Buffer to read data from */\n  int iOff = pIter->iLeafOffset;  /* Offset to read at */\n  int nNew;                       /* Bytes of new data */\n\n  iOff += fts5GetVarint32(&a[iOff], nNew);\n  if( iOff+nNew>pIter->pLeaf->nn ){\n    p->rc = FTS5_CORRUPT;\n    return;\n  }\n  pIter->term.n = nKeep;\n  fts5BufferAppendBlob(&p->rc, &pIter->term, nNew, &a[iOff]);\n  iOff += nNew;\n  pIter->iTermLeafOffset = iOff;\n  pIter->iTermLeafPgno = pIter->iLeafPgno;\n  pIter->iLeafOffset = iOff;\n\n  if( pIter->iPgidxOff>=pIter->pLeaf->nn ){\n    pIter->iEndofDoclist = pIter->pLeaf->nn+1;\n  }else{\n    int nExtra;\n    pIter->iPgidxOff += fts5GetVarint32(&a[pIter->iPgidxOff], nExtra);\n    pIter->iEndofDoclist += nExtra;\n  }\n\n  fts5SegIterLoadRowid(p, pIter);\n}\n\nstatic void fts5SegIterNext(Fts5Index*, Fts5SegIter*, int*);\nstatic void fts5SegIterNext_Reverse(Fts5Index*, Fts5SegIter*, int*);\nstatic void fts5SegIterNext_None(Fts5Index*, Fts5SegIter*, int*);\n\nstatic void fts5SegIterSetNext(Fts5Index *p, Fts5SegIter *pIter){\n  if( pIter->flags & FTS5_SEGITER_REVERSE ){\n    pIter->xNext = fts5SegIterNext_Reverse;\n  }else if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){\n    pIter->xNext = fts5SegIterNext_None;\n  }else{\n    pIter->xNext = fts5SegIterNext;\n  }\n}\n\n/*\n** Initialize the iterator object pIter to iterate through the entries in\n** segment pSeg. The iterator is left pointing to the first entry when \n** this function returns.\n**\n** If an error occurs, Fts5Index.rc is set to an appropriate error code. If \n** an error has already occurred when this function is called, it is a no-op.\n*/\nstatic void fts5SegIterInit(\n  Fts5Index *p,                   /* FTS index object */\n  Fts5StructureSegment *pSeg,     /* Description of segment */\n  Fts5SegIter *pIter              /* Object to populate */\n){\n  if( pSeg->pgnoFirst==0 ){\n    /* This happens if the segment is being used as an input to an incremental\n    ** merge and all data has already been \"trimmed\". See function\n    ** fts5TrimSegments() for details. In this case leave the iterator empty.\n    ** The caller will see the (pIter->pLeaf==0) and assume the iterator is\n    ** at EOF already. */\n    assert( pIter->pLeaf==0 );\n    return;\n  }\n\n  if( p->rc==SQLITE_OK ){\n    memset(pIter, 0, sizeof(*pIter));\n    fts5SegIterSetNext(p, pIter);\n    pIter->pSeg = pSeg;\n    pIter->iLeafPgno = pSeg->pgnoFirst-1;\n    fts5SegIterNextPage(p, pIter);\n  }\n\n  if( p->rc==SQLITE_OK ){\n    pIter->iLeafOffset = 4;\n    assert_nc( pIter->pLeaf->nn>4 );\n    assert( fts5LeafFirstTermOff(pIter->pLeaf)==4 );\n    pIter->iPgidxOff = pIter->pLeaf->szLeaf+1;\n    fts5SegIterLoadTerm(p, pIter, 0);\n    fts5SegIterLoadNPos(p, pIter);\n  }\n}\n\n/*\n** This function is only ever called on iterators created by calls to\n** Fts5IndexQuery() with the FTS5INDEX_QUERY_DESC flag set.\n**\n** The iterator is in an unusual state when this function is called: the\n** Fts5SegIter.iLeafOffset variable is set to the offset of the start of\n** the position-list size field for the first relevant rowid on the page.\n** Fts5SegIter.rowid is set, but nPos and bDel are not.\n**\n** This function advances the iterator so that it points to the last \n** relevant rowid on the page and, if necessary, initializes the \n** aRowidOffset[] and iRowidOffset variables. At this point the iterator\n** is in its regular state - Fts5SegIter.iLeafOffset points to the first\n** byte of the position list content associated with said rowid.\n*/\nstatic void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){\n  int eDetail = p->pConfig->eDetail;\n  int n = pIter->pLeaf->szLeaf;\n  int i = pIter->iLeafOffset;\n  u8 *a = pIter->pLeaf->p;\n  int iRowidOffset = 0;\n\n  if( n>pIter->iEndofDoclist ){\n    n = pIter->iEndofDoclist;\n  }\n\n  ASSERT_SZLEAF_OK(pIter->pLeaf);\n  while( 1 ){\n    i64 iDelta = 0;\n\n    if( eDetail==FTS5_DETAIL_NONE ){\n      /* todo */\n      if( i<n && a[i]==0 ){\n        i++;\n        if( i<n && a[i]==0 ) i++;\n      }\n    }else{\n      int nPos;\n      int bDummy;\n      i += fts5GetPoslistSize(&a[i], &nPos, &bDummy);\n      i += nPos;\n    }\n    if( i>=n ) break;\n    i += fts5GetVarint(&a[i], (u64*)&iDelta);\n    pIter->iRowid += iDelta;\n\n    /* If necessary, grow the pIter->aRowidOffset[] array. */\n    if( iRowidOffset>=pIter->nRowidOffset ){\n      int nNew = pIter->nRowidOffset + 8;\n      int *aNew = (int*)sqlite3_realloc(pIter->aRowidOffset, nNew*sizeof(int));\n      if( aNew==0 ){\n        p->rc = SQLITE_NOMEM;\n        break;\n      }\n      pIter->aRowidOffset = aNew;\n      pIter->nRowidOffset = nNew;\n    }\n\n    pIter->aRowidOffset[iRowidOffset++] = pIter->iLeafOffset;\n    pIter->iLeafOffset = i;\n  }\n  pIter->iRowidOffset = iRowidOffset;\n  fts5SegIterLoadNPos(p, pIter);\n}\n\n/*\n**\n*/\nstatic void fts5SegIterReverseNewPage(Fts5Index *p, Fts5SegIter *pIter){\n  assert( pIter->flags & FTS5_SEGITER_REVERSE );\n  assert( pIter->flags & FTS5_SEGITER_ONETERM );\n\n  fts5DataRelease(pIter->pLeaf);\n  pIter->pLeaf = 0;\n  while( p->rc==SQLITE_OK && pIter->iLeafPgno>pIter->iTermLeafPgno ){\n    Fts5Data *pNew;\n    pIter->iLeafPgno--;\n    pNew = fts5DataRead(p, FTS5_SEGMENT_ROWID(\n          pIter->pSeg->iSegid, pIter->iLeafPgno\n    ));\n    if( pNew ){\n      /* iTermLeafOffset may be equal to szLeaf if the term is the last\n      ** thing on the page - i.e. the first rowid is on the following page.\n      ** In this case leave pIter->pLeaf==0, this iterator is at EOF. */\n      if( pIter->iLeafPgno==pIter->iTermLeafPgno ){\n        assert( pIter->pLeaf==0 );\n        if( pIter->iTermLeafOffset<pNew->szLeaf ){\n          pIter->pLeaf = pNew;\n          pIter->iLeafOffset = pIter->iTermLeafOffset;\n        }\n      }else{\n        int iRowidOff;\n        iRowidOff = fts5LeafFirstRowidOff(pNew);\n        if( iRowidOff ){\n          pIter->pLeaf = pNew;\n          pIter->iLeafOffset = iRowidOff;\n        }\n      }\n\n      if( pIter->pLeaf ){\n        u8 *a = &pIter->pLeaf->p[pIter->iLeafOffset];\n        pIter->iLeafOffset += fts5GetVarint(a, (u64*)&pIter->iRowid);\n        break;\n      }else{\n        fts5DataRelease(pNew);\n      }\n    }\n  }\n\n  if( pIter->pLeaf ){\n    pIter->iEndofDoclist = pIter->pLeaf->nn+1;\n    fts5SegIterReverseInitPage(p, pIter);\n  }\n}\n\n/*\n** Return true if the iterator passed as the second argument currently\n** points to a delete marker. A delete marker is an entry with a 0 byte\n** position-list.\n*/\nstatic int fts5MultiIterIsEmpty(Fts5Index *p, Fts5Iter *pIter){\n  Fts5SegIter *pSeg = &pIter->aSeg[pIter->aFirst[1].iFirst];\n  return (p->rc==SQLITE_OK && pSeg->pLeaf && pSeg->nPos==0);\n}\n\n/*\n** Advance iterator pIter to the next entry.\n**\n** This version of fts5SegIterNext() is only used by reverse iterators.\n*/\nstatic void fts5SegIterNext_Reverse(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegIter *pIter,             /* Iterator to advance */\n  int *pbUnused                   /* Unused */\n){\n  assert( pIter->flags & FTS5_SEGITER_REVERSE );\n  assert( pIter->pNextLeaf==0 );\n  UNUSED_PARAM(pbUnused);\n\n  if( pIter->iRowidOffset>0 ){\n    u8 *a = pIter->pLeaf->p;\n    int iOff;\n    i64 iDelta;\n\n    pIter->iRowidOffset--;\n    pIter->iLeafOffset = pIter->aRowidOffset[pIter->iRowidOffset];\n    fts5SegIterLoadNPos(p, pIter);\n    iOff = pIter->iLeafOffset;\n    if( p->pConfig->eDetail!=FTS5_DETAIL_NONE ){\n      iOff += pIter->nPos;\n    }\n    fts5GetVarint(&a[iOff], (u64*)&iDelta);\n    pIter->iRowid -= iDelta;\n  }else{\n    fts5SegIterReverseNewPage(p, pIter);\n  }\n}\n\n/*\n** Advance iterator pIter to the next entry.\n**\n** This version of fts5SegIterNext() is only used if detail=none and the\n** iterator is not a reverse direction iterator.\n*/\nstatic void fts5SegIterNext_None(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegIter *pIter,             /* Iterator to advance */\n  int *pbNewTerm                  /* OUT: Set for new term */\n){\n  int iOff;\n\n  assert( p->rc==SQLITE_OK );\n  assert( (pIter->flags & FTS5_SEGITER_REVERSE)==0 );\n  assert( p->pConfig->eDetail==FTS5_DETAIL_NONE );\n\n  ASSERT_SZLEAF_OK(pIter->pLeaf);\n  iOff = pIter->iLeafOffset;\n\n  /* Next entry is on the next page */\n  if( pIter->pSeg && iOff>=pIter->pLeaf->szLeaf ){\n    fts5SegIterNextPage(p, pIter);\n    if( p->rc || pIter->pLeaf==0 ) return;\n    pIter->iRowid = 0;\n    iOff = 4;\n  }\n\n  if( iOff<pIter->iEndofDoclist ){\n    /* Next entry is on the current page */\n    i64 iDelta;\n    iOff += sqlite3Fts5GetVarint(&pIter->pLeaf->p[iOff], (u64*)&iDelta);\n    pIter->iLeafOffset = iOff;\n    pIter->iRowid += iDelta;\n  }else if( (pIter->flags & FTS5_SEGITER_ONETERM)==0 ){\n    if( pIter->pSeg ){\n      int nKeep = 0;\n      if( iOff!=fts5LeafFirstTermOff(pIter->pLeaf) ){\n        iOff += fts5GetVarint32(&pIter->pLeaf->p[iOff], nKeep);\n      }\n      pIter->iLeafOffset = iOff;\n      fts5SegIterLoadTerm(p, pIter, nKeep);\n    }else{\n      const u8 *pList = 0;\n      const char *zTerm = 0;\n      int nList;\n      sqlite3Fts5HashScanNext(p->pHash);\n      sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList);\n      if( pList==0 ) goto next_none_eof;\n      pIter->pLeaf->p = (u8*)pList;\n      pIter->pLeaf->nn = nList;\n      pIter->pLeaf->szLeaf = nList;\n      pIter->iEndofDoclist = nList;\n      sqlite3Fts5BufferSet(&p->rc,&pIter->term, (int)strlen(zTerm), (u8*)zTerm);\n      pIter->iLeafOffset = fts5GetVarint(pList, (u64*)&pIter->iRowid);\n    }\n\n    if( pbNewTerm ) *pbNewTerm = 1;\n  }else{\n    goto next_none_eof;\n  }\n\n  fts5SegIterLoadNPos(p, pIter);\n\n  return;\n next_none_eof:\n  fts5DataRelease(pIter->pLeaf);\n  pIter->pLeaf = 0;\n}\n\n\n/*\n** Advance iterator pIter to the next entry. \n**\n** If an error occurs, Fts5Index.rc is set to an appropriate error code. It \n** is not considered an error if the iterator reaches EOF. If an error has \n** already occurred when this function is called, it is a no-op.\n*/\nstatic void fts5SegIterNext(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegIter *pIter,             /* Iterator to advance */\n  int *pbNewTerm                  /* OUT: Set for new term */\n){\n  Fts5Data *pLeaf = pIter->pLeaf;\n  int iOff;\n  int bNewTerm = 0;\n  int nKeep = 0;\n  u8 *a;\n  int n;\n\n  assert( pbNewTerm==0 || *pbNewTerm==0 );\n  assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );\n\n  /* Search for the end of the position list within the current page. */\n  a = pLeaf->p;\n  n = pLeaf->szLeaf;\n\n  ASSERT_SZLEAF_OK(pLeaf);\n  iOff = pIter->iLeafOffset + pIter->nPos;\n\n  if( iOff<n ){\n    /* The next entry is on the current page. */\n    assert_nc( iOff<=pIter->iEndofDoclist );\n    if( iOff>=pIter->iEndofDoclist ){\n      bNewTerm = 1;\n      if( iOff!=fts5LeafFirstTermOff(pLeaf) ){\n        iOff += fts5GetVarint32(&a[iOff], nKeep);\n      }\n    }else{\n      u64 iDelta;\n      iOff += sqlite3Fts5GetVarint(&a[iOff], &iDelta);\n      pIter->iRowid += iDelta;\n      assert_nc( iDelta>0 );\n    }\n    pIter->iLeafOffset = iOff;\n\n  }else if( pIter->pSeg==0 ){\n    const u8 *pList = 0;\n    const char *zTerm = 0;\n    int nList = 0;\n    assert( (pIter->flags & FTS5_SEGITER_ONETERM) || pbNewTerm );\n    if( 0==(pIter->flags & FTS5_SEGITER_ONETERM) ){\n      sqlite3Fts5HashScanNext(p->pHash);\n      sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList);\n    }\n    if( pList==0 ){\n      fts5DataRelease(pIter->pLeaf);\n      pIter->pLeaf = 0;\n    }else{\n      pIter->pLeaf->p = (u8*)pList;\n      pIter->pLeaf->nn = nList;\n      pIter->pLeaf->szLeaf = nList;\n      pIter->iEndofDoclist = nList+1;\n      sqlite3Fts5BufferSet(&p->rc, &pIter->term, (int)strlen(zTerm),\n          (u8*)zTerm);\n      pIter->iLeafOffset = fts5GetVarint(pList, (u64*)&pIter->iRowid);\n      *pbNewTerm = 1;\n    }\n  }else{\n    iOff = 0;\n    /* Next entry is not on the current page */\n    while( iOff==0 ){\n      fts5SegIterNextPage(p, pIter);\n      pLeaf = pIter->pLeaf;\n      if( pLeaf==0 ) break;\n      ASSERT_SZLEAF_OK(pLeaf);\n      if( (iOff = fts5LeafFirstRowidOff(pLeaf)) && iOff<pLeaf->szLeaf ){\n        iOff += sqlite3Fts5GetVarint(&pLeaf->p[iOff], (u64*)&pIter->iRowid);\n        pIter->iLeafOffset = iOff;\n\n        if( pLeaf->nn>pLeaf->szLeaf ){\n          pIter->iPgidxOff = pLeaf->szLeaf + fts5GetVarint32(\n              &pLeaf->p[pLeaf->szLeaf], pIter->iEndofDoclist\n          );\n        }\n      }\n      else if( pLeaf->nn>pLeaf->szLeaf ){\n        pIter->iPgidxOff = pLeaf->szLeaf + fts5GetVarint32(\n            &pLeaf->p[pLeaf->szLeaf], iOff\n            );\n        pIter->iLeafOffset = iOff;\n        pIter->iEndofDoclist = iOff;\n        bNewTerm = 1;\n      }\n      assert_nc( iOff<pLeaf->szLeaf );\n      if( iOff>pLeaf->szLeaf ){\n        p->rc = FTS5_CORRUPT;\n        return;\n      }\n    }\n  }\n\n  /* Check if the iterator is now at EOF. If so, return early. */\n  if( pIter->pLeaf ){\n    if( bNewTerm ){\n      if( pIter->flags & FTS5_SEGITER_ONETERM ){\n        fts5DataRelease(pIter->pLeaf);\n        pIter->pLeaf = 0;\n      }else{\n        fts5SegIterLoadTerm(p, pIter, nKeep);\n        fts5SegIterLoadNPos(p, pIter);\n        if( pbNewTerm ) *pbNewTerm = 1;\n      }\n    }else{\n      /* The following could be done by calling fts5SegIterLoadNPos(). But\n      ** this block is particularly performance critical, so equivalent\n      ** code is inlined. \n      **\n      ** Later: Switched back to fts5SegIterLoadNPos() because it supports\n      ** detail=none mode. Not ideal.\n      */\n      int nSz;\n      assert( p->rc==SQLITE_OK );\n      fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);\n      pIter->bDel = (nSz & 0x0001);\n      pIter->nPos = nSz>>1;\n      assert_nc( pIter->nPos>=0 );\n    }\n  }\n}\n\n#define SWAPVAL(T, a, b) { T tmp; tmp=a; a=b; b=tmp; }\n\n#define fts5IndexSkipVarint(a, iOff) {            \\\n  int iEnd = iOff+9;                              \\\n  while( (a[iOff++] & 0x80) && iOff<iEnd );       \\\n}\n\n/*\n** Iterator pIter currently points to the first rowid in a doclist. This\n** function sets the iterator up so that iterates in reverse order through\n** the doclist.\n*/\nstatic void fts5SegIterReverse(Fts5Index *p, Fts5SegIter *pIter){\n  Fts5DlidxIter *pDlidx = pIter->pDlidx;\n  Fts5Data *pLast = 0;\n  int pgnoLast = 0;\n\n  if( pDlidx ){\n    int iSegid = pIter->pSeg->iSegid;\n    pgnoLast = fts5DlidxIterPgno(pDlidx);\n    pLast = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, pgnoLast));\n  }else{\n    Fts5Data *pLeaf = pIter->pLeaf;         /* Current leaf data */\n\n    /* Currently, Fts5SegIter.iLeafOffset points to the first byte of\n    ** position-list content for the current rowid. Back it up so that it\n    ** points to the start of the position-list size field. */\n    int iPoslist;\n    if( pIter->iTermLeafPgno==pIter->iLeafPgno ){\n      iPoslist = pIter->iTermLeafOffset;\n    }else{\n      iPoslist = 4;\n    }\n    fts5IndexSkipVarint(pLeaf->p, iPoslist);\n    pIter->iLeafOffset = iPoslist;\n\n    /* If this condition is true then the largest rowid for the current\n    ** term may not be stored on the current page. So search forward to\n    ** see where said rowid really is.  */\n    if( pIter->iEndofDoclist>=pLeaf->szLeaf ){\n      int pgno;\n      Fts5StructureSegment *pSeg = pIter->pSeg;\n\n      /* The last rowid in the doclist may not be on the current page. Search\n      ** forward to find the page containing the last rowid.  */\n      for(pgno=pIter->iLeafPgno+1; !p->rc && pgno<=pSeg->pgnoLast; pgno++){\n        i64 iAbs = FTS5_SEGMENT_ROWID(pSeg->iSegid, pgno);\n        Fts5Data *pNew = fts5DataRead(p, iAbs);\n        if( pNew ){\n          int iRowid, bTermless;\n          iRowid = fts5LeafFirstRowidOff(pNew);\n          bTermless = fts5LeafIsTermless(pNew);\n          if( iRowid ){\n            SWAPVAL(Fts5Data*, pNew, pLast);\n            pgnoLast = pgno;\n          }\n          fts5DataRelease(pNew);\n          if( bTermless==0 ) break;\n        }\n      }\n    }\n  }\n\n  /* If pLast is NULL at this point, then the last rowid for this doclist\n  ** lies on the page currently indicated by the iterator. In this case \n  ** pIter->iLeafOffset is already set to point to the position-list size\n  ** field associated with the first relevant rowid on the page.\n  **\n  ** Or, if pLast is non-NULL, then it is the page that contains the last\n  ** rowid. In this case configure the iterator so that it points to the\n  ** first rowid on this page.\n  */\n  if( pLast ){\n    int iOff;\n    fts5DataRelease(pIter->pLeaf);\n    pIter->pLeaf = pLast;\n    pIter->iLeafPgno = pgnoLast;\n    iOff = fts5LeafFirstRowidOff(pLast);\n    iOff += fts5GetVarint(&pLast->p[iOff], (u64*)&pIter->iRowid);\n    pIter->iLeafOffset = iOff;\n\n    if( fts5LeafIsTermless(pLast) ){\n      pIter->iEndofDoclist = pLast->nn+1;\n    }else{\n      pIter->iEndofDoclist = fts5LeafFirstTermOff(pLast);\n    }\n\n  }\n\n  fts5SegIterReverseInitPage(p, pIter);\n}\n\n/*\n** Iterator pIter currently points to the first rowid of a doclist.\n** There is a doclist-index associated with the final term on the current \n** page. If the current term is the last term on the page, load the \n** doclist-index from disk and initialize an iterator at (pIter->pDlidx).\n*/\nstatic void fts5SegIterLoadDlidx(Fts5Index *p, Fts5SegIter *pIter){\n  int iSeg = pIter->pSeg->iSegid;\n  int bRev = (pIter->flags & FTS5_SEGITER_REVERSE);\n  Fts5Data *pLeaf = pIter->pLeaf; /* Current leaf data */\n\n  assert( pIter->flags & FTS5_SEGITER_ONETERM );\n  assert( pIter->pDlidx==0 );\n\n  /* Check if the current doclist ends on this page. If it does, return\n  ** early without loading the doclist-index (as it belongs to a different\n  ** term. */\n  if( pIter->iTermLeafPgno==pIter->iLeafPgno \n   && pIter->iEndofDoclist<pLeaf->szLeaf \n  ){\n    return;\n  }\n\n  pIter->pDlidx = fts5DlidxIterInit(p, bRev, iSeg, pIter->iTermLeafPgno);\n}\n\n/*\n** The iterator object passed as the second argument currently contains\n** no valid values except for the Fts5SegIter.pLeaf member variable. This\n** function searches the leaf page for a term matching (pTerm/nTerm).\n**\n** If the specified term is found on the page, then the iterator is left\n** pointing to it. If argument bGe is zero and the term is not found,\n** the iterator is left pointing at EOF.\n**\n** If bGe is non-zero and the specified term is not found, then the\n** iterator is left pointing to the smallest term in the segment that\n** is larger than the specified term, even if this term is not on the\n** current page.\n*/\nstatic void fts5LeafSeek(\n  Fts5Index *p,                   /* Leave any error code here */\n  int bGe,                        /* True for a >= search */\n  Fts5SegIter *pIter,             /* Iterator to seek */\n  const u8 *pTerm, int nTerm      /* Term to search for */\n){\n  int iOff;\n  const u8 *a = pIter->pLeaf->p;\n  int szLeaf = pIter->pLeaf->szLeaf;\n  int n = pIter->pLeaf->nn;\n\n  int nMatch = 0;\n  int nKeep = 0;\n  int nNew = 0;\n  int iTermOff;\n  int iPgidx;                     /* Current offset in pgidx */\n  int bEndOfPage = 0;\n\n  assert( p->rc==SQLITE_OK );\n\n  iPgidx = szLeaf;\n  iPgidx += fts5GetVarint32(&a[iPgidx], iTermOff);\n  iOff = iTermOff;\n  if( iOff>n ){\n    p->rc = FTS5_CORRUPT;\n    return;\n  }\n\n  while( 1 ){\n\n    /* Figure out how many new bytes are in this term */\n    fts5FastGetVarint32(a, iOff, nNew);\n    if( nKeep<nMatch ){\n      goto search_failed;\n    }\n\n    assert( nKeep>=nMatch );\n    if( nKeep==nMatch ){\n      int nCmp;\n      int i;\n      nCmp = MIN(nNew, nTerm-nMatch);\n      for(i=0; i<nCmp; i++){\n        if( a[iOff+i]!=pTerm[nMatch+i] ) break;\n      }\n      nMatch += i;\n\n      if( nTerm==nMatch ){\n        if( i==nNew ){\n          goto search_success;\n        }else{\n          goto search_failed;\n        }\n      }else if( i<nNew && a[iOff+i]>pTerm[nMatch] ){\n        goto search_failed;\n      }\n    }\n\n    if( iPgidx>=n ){\n      bEndOfPage = 1;\n      break;\n    }\n\n    iPgidx += fts5GetVarint32(&a[iPgidx], nKeep);\n    iTermOff += nKeep;\n    iOff = iTermOff;\n\n    if( iOff>=n ){\n      p->rc = FTS5_CORRUPT;\n      return;\n    }\n\n    /* Read the nKeep field of the next term. */\n    fts5FastGetVarint32(a, iOff, nKeep);\n  }\n\n search_failed:\n  if( bGe==0 ){\n    fts5DataRelease(pIter->pLeaf);\n    pIter->pLeaf = 0;\n    return;\n  }else if( bEndOfPage ){\n    do {\n      fts5SegIterNextPage(p, pIter);\n      if( pIter->pLeaf==0 ) return;\n      a = pIter->pLeaf->p;\n      if( fts5LeafIsTermless(pIter->pLeaf)==0 ){\n        iPgidx = pIter->pLeaf->szLeaf;\n        iPgidx += fts5GetVarint32(&pIter->pLeaf->p[iPgidx], iOff);\n        if( iOff<4 || iOff>=pIter->pLeaf->szLeaf ){\n          p->rc = FTS5_CORRUPT;\n        }else{\n          nKeep = 0;\n          iTermOff = iOff;\n          n = pIter->pLeaf->nn;\n          iOff += fts5GetVarint32(&a[iOff], nNew);\n          break;\n        }\n      }\n    }while( 1 );\n  }\n\n search_success:\n\n  pIter->iLeafOffset = iOff + nNew;\n  pIter->iTermLeafOffset = pIter->iLeafOffset;\n  pIter->iTermLeafPgno = pIter->iLeafPgno;\n\n  fts5BufferSet(&p->rc, &pIter->term, nKeep, pTerm);\n  fts5BufferAppendBlob(&p->rc, &pIter->term, nNew, &a[iOff]);\n\n  if( iPgidx>=n ){\n    pIter->iEndofDoclist = pIter->pLeaf->nn+1;\n  }else{\n    int nExtra;\n    iPgidx += fts5GetVarint32(&a[iPgidx], nExtra);\n    pIter->iEndofDoclist = iTermOff + nExtra;\n  }\n  pIter->iPgidxOff = iPgidx;\n\n  fts5SegIterLoadRowid(p, pIter);\n  fts5SegIterLoadNPos(p, pIter);\n}\n\nstatic sqlite3_stmt *fts5IdxSelectStmt(Fts5Index *p){\n  if( p->pIdxSelect==0 ){\n    Fts5Config *pConfig = p->pConfig;\n    fts5IndexPrepareStmt(p, &p->pIdxSelect, sqlite3_mprintf(\n          \"SELECT pgno FROM '%q'.'%q_idx' WHERE \"\n          \"segid=? AND term<=? ORDER BY term DESC LIMIT 1\",\n          pConfig->zDb, pConfig->zName\n    ));\n  }\n  return p->pIdxSelect;\n}\n\n/*\n** Initialize the object pIter to point to term pTerm/nTerm within segment\n** pSeg. If there is no such term in the index, the iterator is set to EOF.\n**\n** If an error occurs, Fts5Index.rc is set to an appropriate error code. If \n** an error has already occurred when this function is called, it is a no-op.\n*/\nstatic void fts5SegIterSeekInit(\n  Fts5Index *p,                   /* FTS5 backend */\n  const u8 *pTerm, int nTerm,     /* Term to seek to */\n  int flags,                      /* Mask of FTS5INDEX_XXX flags */\n  Fts5StructureSegment *pSeg,     /* Description of segment */\n  Fts5SegIter *pIter              /* Object to populate */\n){\n  int iPg = 1;\n  int bGe = (flags & FTS5INDEX_QUERY_SCAN);\n  int bDlidx = 0;                 /* True if there is a doclist-index */\n  sqlite3_stmt *pIdxSelect = 0;\n\n  assert( bGe==0 || (flags & FTS5INDEX_QUERY_DESC)==0 );\n  assert( pTerm && nTerm );\n  memset(pIter, 0, sizeof(*pIter));\n  pIter->pSeg = pSeg;\n\n  /* This block sets stack variable iPg to the leaf page number that may\n  ** contain term (pTerm/nTerm), if it is present in the segment. */\n  pIdxSelect = fts5IdxSelectStmt(p);\n  if( p->rc ) return;\n  sqlite3_bind_int(pIdxSelect, 1, pSeg->iSegid);\n  sqlite3_bind_blob(pIdxSelect, 2, pTerm, nTerm, SQLITE_STATIC);\n  if( SQLITE_ROW==sqlite3_step(pIdxSelect) ){\n    i64 val = sqlite3_column_int(pIdxSelect, 0);\n    iPg = (int)(val>>1);\n    bDlidx = (val & 0x0001);\n  }\n  p->rc = sqlite3_reset(pIdxSelect);\n\n  if( iPg<pSeg->pgnoFirst ){\n    iPg = pSeg->pgnoFirst;\n    bDlidx = 0;\n  }\n\n  pIter->iLeafPgno = iPg - 1;\n  fts5SegIterNextPage(p, pIter);\n\n  if( pIter->pLeaf ){\n    fts5LeafSeek(p, bGe, pIter, pTerm, nTerm);\n  }\n\n  if( p->rc==SQLITE_OK && bGe==0 ){\n    pIter->flags |= FTS5_SEGITER_ONETERM;\n    if( pIter->pLeaf ){\n      if( flags & FTS5INDEX_QUERY_DESC ){\n        pIter->flags |= FTS5_SEGITER_REVERSE;\n      }\n      if( bDlidx ){\n        fts5SegIterLoadDlidx(p, pIter);\n      }\n      if( flags & FTS5INDEX_QUERY_DESC ){\n        fts5SegIterReverse(p, pIter);\n      }\n    }\n  }\n\n  fts5SegIterSetNext(p, pIter);\n\n  /* Either:\n  **\n  **   1) an error has occurred, or\n  **   2) the iterator points to EOF, or\n  **   3) the iterator points to an entry with term (pTerm/nTerm), or\n  **   4) the FTS5INDEX_QUERY_SCAN flag was set and the iterator points\n  **      to an entry with a term greater than or equal to (pTerm/nTerm).\n  */\n  assert( p->rc!=SQLITE_OK                                          /* 1 */\n   || pIter->pLeaf==0                                               /* 2 */\n   || fts5BufferCompareBlob(&pIter->term, pTerm, nTerm)==0          /* 3 */\n   || (bGe && fts5BufferCompareBlob(&pIter->term, pTerm, nTerm)>0)  /* 4 */\n  );\n}\n\n/*\n** Initialize the object pIter to point to term pTerm/nTerm within the\n** in-memory hash table. If there is no such term in the hash-table, the \n** iterator is set to EOF.\n**\n** If an error occurs, Fts5Index.rc is set to an appropriate error code. If \n** an error has already occurred when this function is called, it is a no-op.\n*/\nstatic void fts5SegIterHashInit(\n  Fts5Index *p,                   /* FTS5 backend */\n  const u8 *pTerm, int nTerm,     /* Term to seek to */\n  int flags,                      /* Mask of FTS5INDEX_XXX flags */\n  Fts5SegIter *pIter              /* Object to populate */\n){\n  const u8 *pList = 0;\n  int nList = 0;\n  const u8 *z = 0;\n  int n = 0;\n\n  assert( p->pHash );\n  assert( p->rc==SQLITE_OK );\n\n  if( pTerm==0 || (flags & FTS5INDEX_QUERY_SCAN) ){\n    p->rc = sqlite3Fts5HashScanInit(p->pHash, (const char*)pTerm, nTerm);\n    sqlite3Fts5HashScanEntry(p->pHash, (const char**)&z, &pList, &nList);\n    n = (z ? (int)strlen((const char*)z) : 0);\n  }else{\n    pIter->flags |= FTS5_SEGITER_ONETERM;\n    sqlite3Fts5HashQuery(p->pHash, (const char*)pTerm, nTerm, &pList, &nList);\n    z = pTerm;\n    n = nTerm;\n  }\n\n  if( pList ){\n    Fts5Data *pLeaf;\n    sqlite3Fts5BufferSet(&p->rc, &pIter->term, n, z);\n    pLeaf = fts5IdxMalloc(p, sizeof(Fts5Data));\n    if( pLeaf==0 ) return;\n    pLeaf->p = (u8*)pList;\n    pLeaf->nn = pLeaf->szLeaf = nList;\n    pIter->pLeaf = pLeaf;\n    pIter->iLeafOffset = fts5GetVarint(pLeaf->p, (u64*)&pIter->iRowid);\n    pIter->iEndofDoclist = pLeaf->nn;\n\n    if( flags & FTS5INDEX_QUERY_DESC ){\n      pIter->flags |= FTS5_SEGITER_REVERSE;\n      fts5SegIterReverseInitPage(p, pIter);\n    }else{\n      fts5SegIterLoadNPos(p, pIter);\n    }\n  }\n\n  fts5SegIterSetNext(p, pIter);\n}\n\n/*\n** Zero the iterator passed as the only argument.\n*/\nstatic void fts5SegIterClear(Fts5SegIter *pIter){\n  fts5BufferFree(&pIter->term);\n  fts5DataRelease(pIter->pLeaf);\n  fts5DataRelease(pIter->pNextLeaf);\n  fts5DlidxIterFree(pIter->pDlidx);\n  sqlite3_free(pIter->aRowidOffset);\n  memset(pIter, 0, sizeof(Fts5SegIter));\n}\n\n#ifdef SQLITE_DEBUG\n\n/*\n** This function is used as part of the big assert() procedure implemented by\n** fts5AssertMultiIterSetup(). It ensures that the result currently stored\n** in *pRes is the correct result of comparing the current positions of the\n** two iterators.\n*/\nstatic void fts5AssertComparisonResult(\n  Fts5Iter *pIter, \n  Fts5SegIter *p1,\n  Fts5SegIter *p2,\n  Fts5CResult *pRes\n){\n  int i1 = p1 - pIter->aSeg;\n  int i2 = p2 - pIter->aSeg;\n\n  if( p1->pLeaf || p2->pLeaf ){\n    if( p1->pLeaf==0 ){\n      assert( pRes->iFirst==i2 );\n    }else if( p2->pLeaf==0 ){\n      assert( pRes->iFirst==i1 );\n    }else{\n      int nMin = MIN(p1->term.n, p2->term.n);\n      int res = memcmp(p1->term.p, p2->term.p, nMin);\n      if( res==0 ) res = p1->term.n - p2->term.n;\n\n      if( res==0 ){\n        assert( pRes->bTermEq==1 );\n        assert( p1->iRowid!=p2->iRowid );\n        res = ((p1->iRowid > p2->iRowid)==pIter->bRev) ? -1 : 1;\n      }else{\n        assert( pRes->bTermEq==0 );\n      }\n\n      if( res<0 ){\n        assert( pRes->iFirst==i1 );\n      }else{\n        assert( pRes->iFirst==i2 );\n      }\n    }\n  }\n}\n\n/*\n** This function is a no-op unless SQLITE_DEBUG is defined when this module\n** is compiled. In that case, this function is essentially an assert() \n** statement used to verify that the contents of the pIter->aFirst[] array\n** are correct.\n*/\nstatic void fts5AssertMultiIterSetup(Fts5Index *p, Fts5Iter *pIter){\n  if( p->rc==SQLITE_OK ){\n    Fts5SegIter *pFirst = &pIter->aSeg[ pIter->aFirst[1].iFirst ];\n    int i;\n\n    assert( (pFirst->pLeaf==0)==pIter->base.bEof );\n\n    /* Check that pIter->iSwitchRowid is set correctly. */\n    for(i=0; i<pIter->nSeg; i++){\n      Fts5SegIter *p1 = &pIter->aSeg[i];\n      assert( p1==pFirst \n           || p1->pLeaf==0 \n           || fts5BufferCompare(&pFirst->term, &p1->term) \n           || p1->iRowid==pIter->iSwitchRowid\n           || (p1->iRowid<pIter->iSwitchRowid)==pIter->bRev\n      );\n    }\n\n    for(i=0; i<pIter->nSeg; i+=2){\n      Fts5SegIter *p1 = &pIter->aSeg[i];\n      Fts5SegIter *p2 = &pIter->aSeg[i+1];\n      Fts5CResult *pRes = &pIter->aFirst[(pIter->nSeg + i) / 2];\n      fts5AssertComparisonResult(pIter, p1, p2, pRes);\n    }\n\n    for(i=1; i<(pIter->nSeg / 2); i+=2){\n      Fts5SegIter *p1 = &pIter->aSeg[ pIter->aFirst[i*2].iFirst ];\n      Fts5SegIter *p2 = &pIter->aSeg[ pIter->aFirst[i*2+1].iFirst ];\n      Fts5CResult *pRes = &pIter->aFirst[i];\n      fts5AssertComparisonResult(pIter, p1, p2, pRes);\n    }\n  }\n}\n#else\n# define fts5AssertMultiIterSetup(x,y)\n#endif\n\n/*\n** Do the comparison necessary to populate pIter->aFirst[iOut].\n**\n** If the returned value is non-zero, then it is the index of an entry\n** in the pIter->aSeg[] array that is (a) not at EOF, and (b) pointing\n** to a key that is a duplicate of another, higher priority, \n** segment-iterator in the pSeg->aSeg[] array.\n*/\nstatic int fts5MultiIterDoCompare(Fts5Iter *pIter, int iOut){\n  int i1;                         /* Index of left-hand Fts5SegIter */\n  int i2;                         /* Index of right-hand Fts5SegIter */\n  int iRes;\n  Fts5SegIter *p1;                /* Left-hand Fts5SegIter */\n  Fts5SegIter *p2;                /* Right-hand Fts5SegIter */\n  Fts5CResult *pRes = &pIter->aFirst[iOut];\n\n  assert( iOut<pIter->nSeg && iOut>0 );\n  assert( pIter->bRev==0 || pIter->bRev==1 );\n\n  if( iOut>=(pIter->nSeg/2) ){\n    i1 = (iOut - pIter->nSeg/2) * 2;\n    i2 = i1 + 1;\n  }else{\n    i1 = pIter->aFirst[iOut*2].iFirst;\n    i2 = pIter->aFirst[iOut*2+1].iFirst;\n  }\n  p1 = &pIter->aSeg[i1];\n  p2 = &pIter->aSeg[i2];\n\n  pRes->bTermEq = 0;\n  if( p1->pLeaf==0 ){           /* If p1 is at EOF */\n    iRes = i2;\n  }else if( p2->pLeaf==0 ){     /* If p2 is at EOF */\n    iRes = i1;\n  }else{\n    int res = fts5BufferCompare(&p1->term, &p2->term);\n    if( res==0 ){\n      assert( i2>i1 );\n      assert( i2!=0 );\n      pRes->bTermEq = 1;\n      if( p1->iRowid==p2->iRowid ){\n        p1->bDel = p2->bDel;\n        return i2;\n      }\n      res = ((p1->iRowid > p2->iRowid)==pIter->bRev) ? -1 : +1;\n    }\n    assert( res!=0 );\n    if( res<0 ){\n      iRes = i1;\n    }else{\n      iRes = i2;\n    }\n  }\n\n  pRes->iFirst = (u16)iRes;\n  return 0;\n}\n\n/*\n** Move the seg-iter so that it points to the first rowid on page iLeafPgno.\n** It is an error if leaf iLeafPgno does not exist or contains no rowids.\n*/\nstatic void fts5SegIterGotoPage(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegIter *pIter,             /* Iterator to advance */\n  int iLeafPgno\n){\n  assert( iLeafPgno>pIter->iLeafPgno );\n\n  if( iLeafPgno>pIter->pSeg->pgnoLast ){\n    p->rc = FTS5_CORRUPT;\n  }else{\n    fts5DataRelease(pIter->pNextLeaf);\n    pIter->pNextLeaf = 0;\n    pIter->iLeafPgno = iLeafPgno-1;\n    fts5SegIterNextPage(p, pIter);\n    assert( p->rc!=SQLITE_OK || pIter->iLeafPgno==iLeafPgno );\n\n    if( p->rc==SQLITE_OK ){\n      int iOff;\n      u8 *a = pIter->pLeaf->p;\n      int n = pIter->pLeaf->szLeaf;\n\n      iOff = fts5LeafFirstRowidOff(pIter->pLeaf);\n      if( iOff<4 || iOff>=n ){\n        p->rc = FTS5_CORRUPT;\n      }else{\n        iOff += fts5GetVarint(&a[iOff], (u64*)&pIter->iRowid);\n        pIter->iLeafOffset = iOff;\n        fts5SegIterLoadNPos(p, pIter);\n      }\n    }\n  }\n}\n\n/*\n** Advance the iterator passed as the second argument until it is at or \n** past rowid iFrom. Regardless of the value of iFrom, the iterator is\n** always advanced at least once.\n*/\nstatic void fts5SegIterNextFrom(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegIter *pIter,             /* Iterator to advance */\n  i64 iMatch                      /* Advance iterator at least this far */\n){\n  int bRev = (pIter->flags & FTS5_SEGITER_REVERSE);\n  Fts5DlidxIter *pDlidx = pIter->pDlidx;\n  int iLeafPgno = pIter->iLeafPgno;\n  int bMove = 1;\n\n  assert( pIter->flags & FTS5_SEGITER_ONETERM );\n  assert( pIter->pDlidx );\n  assert( pIter->pLeaf );\n\n  if( bRev==0 ){\n    while( !fts5DlidxIterEof(p, pDlidx) && iMatch>fts5DlidxIterRowid(pDlidx) ){\n      iLeafPgno = fts5DlidxIterPgno(pDlidx);\n      fts5DlidxIterNext(p, pDlidx);\n    }\n    assert_nc( iLeafPgno>=pIter->iLeafPgno || p->rc );\n    if( iLeafPgno>pIter->iLeafPgno ){\n      fts5SegIterGotoPage(p, pIter, iLeafPgno);\n      bMove = 0;\n    }\n  }else{\n    assert( pIter->pNextLeaf==0 );\n    assert( iMatch<pIter->iRowid );\n    while( !fts5DlidxIterEof(p, pDlidx) && iMatch<fts5DlidxIterRowid(pDlidx) ){\n      fts5DlidxIterPrev(p, pDlidx);\n    }\n    iLeafPgno = fts5DlidxIterPgno(pDlidx);\n\n    assert( fts5DlidxIterEof(p, pDlidx) || iLeafPgno<=pIter->iLeafPgno );\n\n    if( iLeafPgno<pIter->iLeafPgno ){\n      pIter->iLeafPgno = iLeafPgno+1;\n      fts5SegIterReverseNewPage(p, pIter);\n      bMove = 0;\n    }\n  }\n\n  do{\n    if( bMove && p->rc==SQLITE_OK ) pIter->xNext(p, pIter, 0);\n    if( pIter->pLeaf==0 ) break;\n    if( bRev==0 && pIter->iRowid>=iMatch ) break;\n    if( bRev!=0 && pIter->iRowid<=iMatch ) break;\n    bMove = 1;\n  }while( p->rc==SQLITE_OK );\n}\n\n\n/*\n** Free the iterator object passed as the second argument.\n*/\nstatic void fts5MultiIterFree(Fts5Iter *pIter){\n  if( pIter ){\n    int i;\n    for(i=0; i<pIter->nSeg; i++){\n      fts5SegIterClear(&pIter->aSeg[i]);\n    }\n    fts5StructureRelease(pIter->pStruct);\n    fts5BufferFree(&pIter->poslist);\n    sqlite3_free(pIter);\n  }\n}\n\nstatic void fts5MultiIterAdvanced(\n  Fts5Index *p,                   /* FTS5 backend to iterate within */\n  Fts5Iter *pIter,                /* Iterator to update aFirst[] array for */\n  int iChanged,                   /* Index of sub-iterator just advanced */\n  int iMinset                     /* Minimum entry in aFirst[] to set */\n){\n  int i;\n  for(i=(pIter->nSeg+iChanged)/2; i>=iMinset && p->rc==SQLITE_OK; i=i/2){\n    int iEq;\n    if( (iEq = fts5MultiIterDoCompare(pIter, i)) ){\n      Fts5SegIter *pSeg = &pIter->aSeg[iEq];\n      assert( p->rc==SQLITE_OK );\n      pSeg->xNext(p, pSeg, 0);\n      i = pIter->nSeg + iEq;\n    }\n  }\n}\n\n/*\n** Sub-iterator iChanged of iterator pIter has just been advanced. It still\n** points to the same term though - just a different rowid. This function\n** attempts to update the contents of the pIter->aFirst[] accordingly.\n** If it does so successfully, 0 is returned. Otherwise 1.\n**\n** If non-zero is returned, the caller should call fts5MultiIterAdvanced()\n** on the iterator instead. That function does the same as this one, except\n** that it deals with more complicated cases as well.\n*/ \nstatic int fts5MultiIterAdvanceRowid(\n  Fts5Iter *pIter,                /* Iterator to update aFirst[] array for */\n  int iChanged,                   /* Index of sub-iterator just advanced */\n  Fts5SegIter **ppFirst\n){\n  Fts5SegIter *pNew = &pIter->aSeg[iChanged];\n\n  if( pNew->iRowid==pIter->iSwitchRowid\n   || (pNew->iRowid<pIter->iSwitchRowid)==pIter->bRev\n  ){\n    int i;\n    Fts5SegIter *pOther = &pIter->aSeg[iChanged ^ 0x0001];\n    pIter->iSwitchRowid = pIter->bRev ? SMALLEST_INT64 : LARGEST_INT64;\n    for(i=(pIter->nSeg+iChanged)/2; 1; i=i/2){\n      Fts5CResult *pRes = &pIter->aFirst[i];\n\n      assert( pNew->pLeaf );\n      assert( pRes->bTermEq==0 || pOther->pLeaf );\n\n      if( pRes->bTermEq ){\n        if( pNew->iRowid==pOther->iRowid ){\n          return 1;\n        }else if( (pOther->iRowid>pNew->iRowid)==pIter->bRev ){\n          pIter->iSwitchRowid = pOther->iRowid;\n          pNew = pOther;\n        }else if( (pOther->iRowid>pIter->iSwitchRowid)==pIter->bRev ){\n          pIter->iSwitchRowid = pOther->iRowid;\n        }\n      }\n      pRes->iFirst = (u16)(pNew - pIter->aSeg);\n      if( i==1 ) break;\n\n      pOther = &pIter->aSeg[ pIter->aFirst[i ^ 0x0001].iFirst ];\n    }\n  }\n\n  *ppFirst = pNew;\n  return 0;\n}\n\n/*\n** Set the pIter->bEof variable based on the state of the sub-iterators.\n*/\nstatic void fts5MultiIterSetEof(Fts5Iter *pIter){\n  Fts5SegIter *pSeg = &pIter->aSeg[ pIter->aFirst[1].iFirst ];\n  pIter->base.bEof = pSeg->pLeaf==0;\n  pIter->iSwitchRowid = pSeg->iRowid;\n}\n\n/*\n** Move the iterator to the next entry. \n**\n** If an error occurs, an error code is left in Fts5Index.rc. It is not \n** considered an error if the iterator reaches EOF, or if it is already at \n** EOF when this function is called.\n*/\nstatic void fts5MultiIterNext(\n  Fts5Index *p, \n  Fts5Iter *pIter,\n  int bFrom,                      /* True if argument iFrom is valid */\n  i64 iFrom                       /* Advance at least as far as this */\n){\n  int bUseFrom = bFrom;\n  assert( pIter->base.bEof==0 );\n  while( p->rc==SQLITE_OK ){\n    int iFirst = pIter->aFirst[1].iFirst;\n    int bNewTerm = 0;\n    Fts5SegIter *pSeg = &pIter->aSeg[iFirst];\n    assert( p->rc==SQLITE_OK );\n    if( bUseFrom && pSeg->pDlidx ){\n      fts5SegIterNextFrom(p, pSeg, iFrom);\n    }else{\n      pSeg->xNext(p, pSeg, &bNewTerm);\n    }\n\n    if( pSeg->pLeaf==0 || bNewTerm \n     || fts5MultiIterAdvanceRowid(pIter, iFirst, &pSeg)\n    ){\n      fts5MultiIterAdvanced(p, pIter, iFirst, 1);\n      fts5MultiIterSetEof(pIter);\n      pSeg = &pIter->aSeg[pIter->aFirst[1].iFirst];\n      if( pSeg->pLeaf==0 ) return;\n    }\n\n    fts5AssertMultiIterSetup(p, pIter);\n    assert( pSeg==&pIter->aSeg[pIter->aFirst[1].iFirst] && pSeg->pLeaf );\n    if( pIter->bSkipEmpty==0 || pSeg->nPos ){\n      pIter->xSetOutputs(pIter, pSeg);\n      return;\n    }\n    bUseFrom = 0;\n  }\n}\n\nstatic void fts5MultiIterNext2(\n  Fts5Index *p, \n  Fts5Iter *pIter,\n  int *pbNewTerm                  /* OUT: True if *might* be new term */\n){\n  assert( pIter->bSkipEmpty );\n  if( p->rc==SQLITE_OK ){\n    do {\n      int iFirst = pIter->aFirst[1].iFirst;\n      Fts5SegIter *pSeg = &pIter->aSeg[iFirst];\n      int bNewTerm = 0;\n\n      assert( p->rc==SQLITE_OK );\n      pSeg->xNext(p, pSeg, &bNewTerm);\n      if( pSeg->pLeaf==0 || bNewTerm \n       || fts5MultiIterAdvanceRowid(pIter, iFirst, &pSeg)\n      ){\n        fts5MultiIterAdvanced(p, pIter, iFirst, 1);\n        fts5MultiIterSetEof(pIter);\n        *pbNewTerm = 1;\n      }else{\n        *pbNewTerm = 0;\n      }\n      fts5AssertMultiIterSetup(p, pIter);\n\n    }while( fts5MultiIterIsEmpty(p, pIter) );\n  }\n}\n\nstatic void fts5IterSetOutputs_Noop(Fts5Iter *pUnused1, Fts5SegIter *pUnused2){\n  UNUSED_PARAM2(pUnused1, pUnused2);\n}\n\nstatic Fts5Iter *fts5MultiIterAlloc(\n  Fts5Index *p,                   /* FTS5 backend to iterate within */\n  int nSeg\n){\n  Fts5Iter *pNew;\n  int nSlot;                      /* Power of two >= nSeg */\n\n  for(nSlot=2; nSlot<nSeg; nSlot=nSlot*2);\n  pNew = fts5IdxMalloc(p, \n      sizeof(Fts5Iter) +                  /* pNew */\n      sizeof(Fts5SegIter) * (nSlot-1) +   /* pNew->aSeg[] */\n      sizeof(Fts5CResult) * nSlot         /* pNew->aFirst[] */\n  );\n  if( pNew ){\n    pNew->nSeg = nSlot;\n    pNew->aFirst = (Fts5CResult*)&pNew->aSeg[nSlot];\n    pNew->pIndex = p;\n    pNew->xSetOutputs = fts5IterSetOutputs_Noop;\n  }\n  return pNew;\n}\n\nstatic void fts5PoslistCallback(\n  Fts5Index *pUnused, \n  void *pContext, \n  const u8 *pChunk, int nChunk\n){\n  UNUSED_PARAM(pUnused);\n  assert_nc( nChunk>=0 );\n  if( nChunk>0 ){\n    fts5BufferSafeAppendBlob((Fts5Buffer*)pContext, pChunk, nChunk);\n  }\n}\n\ntypedef struct PoslistCallbackCtx PoslistCallbackCtx;\nstruct PoslistCallbackCtx {\n  Fts5Buffer *pBuf;               /* Append to this buffer */\n  Fts5Colset *pColset;            /* Restrict matches to this column */\n  int eState;                     /* See above */\n};\n\ntypedef struct PoslistOffsetsCtx PoslistOffsetsCtx;\nstruct PoslistOffsetsCtx {\n  Fts5Buffer *pBuf;               /* Append to this buffer */\n  Fts5Colset *pColset;            /* Restrict matches to this column */\n  int iRead;\n  int iWrite;\n};\n\n/*\n** TODO: Make this more efficient!\n*/\nstatic int fts5IndexColsetTest(Fts5Colset *pColset, int iCol){\n  int i;\n  for(i=0; i<pColset->nCol; i++){\n    if( pColset->aiCol[i]==iCol ) return 1;\n  }\n  return 0;\n}\n\nstatic void fts5PoslistOffsetsCallback(\n  Fts5Index *pUnused, \n  void *pContext, \n  const u8 *pChunk, int nChunk\n){\n  PoslistOffsetsCtx *pCtx = (PoslistOffsetsCtx*)pContext;\n  UNUSED_PARAM(pUnused);\n  assert_nc( nChunk>=0 );\n  if( nChunk>0 ){\n    int i = 0;\n    while( i<nChunk ){\n      int iVal;\n      i += fts5GetVarint32(&pChunk[i], iVal);\n      iVal += pCtx->iRead - 2;\n      pCtx->iRead = iVal;\n      if( fts5IndexColsetTest(pCtx->pColset, iVal) ){\n        fts5BufferSafeAppendVarint(pCtx->pBuf, iVal + 2 - pCtx->iWrite);\n        pCtx->iWrite = iVal;\n      }\n    }\n  }\n}\n\nstatic void fts5PoslistFilterCallback(\n  Fts5Index *pUnused,\n  void *pContext, \n  const u8 *pChunk, int nChunk\n){\n  PoslistCallbackCtx *pCtx = (PoslistCallbackCtx*)pContext;\n  UNUSED_PARAM(pUnused);\n  assert_nc( nChunk>=0 );\n  if( nChunk>0 ){\n    /* Search through to find the first varint with value 1. This is the\n    ** start of the next columns hits. */\n    int i = 0;\n    int iStart = 0;\n\n    if( pCtx->eState==2 ){\n      int iCol;\n      fts5FastGetVarint32(pChunk, i, iCol);\n      if( fts5IndexColsetTest(pCtx->pColset, iCol) ){\n        pCtx->eState = 1;\n        fts5BufferSafeAppendVarint(pCtx->pBuf, 1);\n      }else{\n        pCtx->eState = 0;\n      }\n    }\n\n    do {\n      while( i<nChunk && pChunk[i]!=0x01 ){\n        while( pChunk[i] & 0x80 ) i++;\n        i++;\n      }\n      if( pCtx->eState ){\n        fts5BufferSafeAppendBlob(pCtx->pBuf, &pChunk[iStart], i-iStart);\n      }\n      if( i<nChunk ){\n        int iCol;\n        iStart = i;\n        i++;\n        if( i>=nChunk ){\n          pCtx->eState = 2;\n        }else{\n          fts5FastGetVarint32(pChunk, i, iCol);\n          pCtx->eState = fts5IndexColsetTest(pCtx->pColset, iCol);\n          if( pCtx->eState ){\n            fts5BufferSafeAppendBlob(pCtx->pBuf, &pChunk[iStart], i-iStart);\n            iStart = i;\n          }\n        }\n      }\n    }while( i<nChunk );\n  }\n}\n\nstatic void fts5ChunkIterate(\n  Fts5Index *p,                   /* Index object */\n  Fts5SegIter *pSeg,              /* Poslist of this iterator */\n  void *pCtx,                     /* Context pointer for xChunk callback */\n  void (*xChunk)(Fts5Index*, void*, const u8*, int)\n){\n  int nRem = pSeg->nPos;          /* Number of bytes still to come */\n  Fts5Data *pData = 0;\n  u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset];\n  int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset);\n  int pgno = pSeg->iLeafPgno;\n  int pgnoSave = 0;\n\n  /* This function does notmwork with detail=none databases. */\n  assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );\n\n  if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){\n    pgnoSave = pgno+1;\n  }\n\n  while( 1 ){\n    xChunk(p, pCtx, pChunk, nChunk);\n    nRem -= nChunk;\n    fts5DataRelease(pData);\n    if( nRem<=0 ){\n      break;\n    }else{\n      pgno++;\n      pData = fts5DataRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));\n      if( pData==0 ) break;\n      pChunk = &pData->p[4];\n      nChunk = MIN(nRem, pData->szLeaf - 4);\n      if( pgno==pgnoSave ){\n        assert( pSeg->pNextLeaf==0 );\n        pSeg->pNextLeaf = pData;\n        pData = 0;\n      }\n    }\n  }\n}\n\n/*\n** Iterator pIter currently points to a valid entry (not EOF). This\n** function appends the position list data for the current entry to\n** buffer pBuf. It does not make a copy of the position-list size\n** field.\n*/\nstatic void fts5SegiterPoslist(\n  Fts5Index *p,\n  Fts5SegIter *pSeg,\n  Fts5Colset *pColset,\n  Fts5Buffer *pBuf\n){\n  if( 0==fts5BufferGrow(&p->rc, pBuf, pSeg->nPos) ){\n    if( pColset==0 ){\n      fts5ChunkIterate(p, pSeg, (void*)pBuf, fts5PoslistCallback);\n    }else{\n      if( p->pConfig->eDetail==FTS5_DETAIL_FULL ){\n        PoslistCallbackCtx sCtx;\n        sCtx.pBuf = pBuf;\n        sCtx.pColset = pColset;\n        sCtx.eState = fts5IndexColsetTest(pColset, 0);\n        assert( sCtx.eState==0 || sCtx.eState==1 );\n        fts5ChunkIterate(p, pSeg, (void*)&sCtx, fts5PoslistFilterCallback);\n      }else{\n        PoslistOffsetsCtx sCtx;\n        memset(&sCtx, 0, sizeof(sCtx));\n        sCtx.pBuf = pBuf;\n        sCtx.pColset = pColset;\n        fts5ChunkIterate(p, pSeg, (void*)&sCtx, fts5PoslistOffsetsCallback);\n      }\n    }\n  }\n}\n\n/*\n** IN/OUT parameter (*pa) points to a position list n bytes in size. If\n** the position list contains entries for column iCol, then (*pa) is set\n** to point to the sub-position-list for that column and the number of\n** bytes in it returned. Or, if the argument position list does not\n** contain any entries for column iCol, return 0.\n*/\nstatic int fts5IndexExtractCol(\n  const u8 **pa,                  /* IN/OUT: Pointer to poslist */\n  int n,                          /* IN: Size of poslist in bytes */\n  int iCol                        /* Column to extract from poslist */\n){\n  int iCurrent = 0;               /* Anything before the first 0x01 is col 0 */\n  const u8 *p = *pa;\n  const u8 *pEnd = &p[n];         /* One byte past end of position list */\n\n  while( iCol>iCurrent ){\n    /* Advance pointer p until it points to pEnd or an 0x01 byte that is\n    ** not part of a varint. Note that it is not possible for a negative\n    ** or extremely large varint to occur within an uncorrupted position \n    ** list. So the last byte of each varint may be assumed to have a clear\n    ** 0x80 bit.  */\n    while( *p!=0x01 ){\n      while( *p++ & 0x80 );\n      if( p>=pEnd ) return 0;\n    }\n    *pa = p++;\n    iCurrent = *p++;\n    if( iCurrent & 0x80 ){\n      p--;\n      p += fts5GetVarint32(p, iCurrent);\n    }\n  }\n  if( iCol!=iCurrent ) return 0;\n\n  /* Advance pointer p until it points to pEnd or an 0x01 byte that is\n  ** not part of a varint */\n  while( p<pEnd && *p!=0x01 ){\n    while( *p++ & 0x80 );\n  }\n\n  return p - (*pa);\n}\n\nstatic int fts5IndexExtractColset (\n  Fts5Colset *pColset,            /* Colset to filter on */\n  const u8 *pPos, int nPos,       /* Position list */\n  Fts5Buffer *pBuf                /* Output buffer */\n){\n  int rc = SQLITE_OK;\n  int i;\n\n  fts5BufferZero(pBuf);\n  for(i=0; i<pColset->nCol; i++){\n    const u8 *pSub = pPos;\n    int nSub = fts5IndexExtractCol(&pSub, nPos, pColset->aiCol[i]);\n    if( nSub ){\n      fts5BufferAppendBlob(&rc, pBuf, nSub, pSub);\n    }\n  }\n  return rc;\n}\n\n/*\n** xSetOutputs callback used by detail=none tables.\n*/\nstatic void fts5IterSetOutputs_None(Fts5Iter *pIter, Fts5SegIter *pSeg){\n  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_NONE );\n  pIter->base.iRowid = pSeg->iRowid;\n  pIter->base.nData = pSeg->nPos;\n}\n\n/*\n** xSetOutputs callback used by detail=full and detail=col tables when no\n** column filters are specified.\n*/\nstatic void fts5IterSetOutputs_Nocolset(Fts5Iter *pIter, Fts5SegIter *pSeg){\n  pIter->base.iRowid = pSeg->iRowid;\n  pIter->base.nData = pSeg->nPos;\n\n  assert( pIter->pIndex->pConfig->eDetail!=FTS5_DETAIL_NONE );\n  assert( pIter->pColset==0 );\n\n  if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){\n    /* All data is stored on the current page. Populate the output \n    ** variables to point into the body of the page object. */\n    pIter->base.pData = &pSeg->pLeaf->p[pSeg->iLeafOffset];\n  }else{\n    /* The data is distributed over two or more pages. Copy it into the\n    ** Fts5Iter.poslist buffer and then set the output pointer to point\n    ** to this buffer.  */\n    fts5BufferZero(&pIter->poslist);\n    fts5SegiterPoslist(pIter->pIndex, pSeg, 0, &pIter->poslist);\n    pIter->base.pData = pIter->poslist.p;\n  }\n}\n\n/*\n** xSetOutputs callback used when the Fts5Colset object has nCol==0 (match\n** against no columns at all).\n*/\nstatic void fts5IterSetOutputs_ZeroColset(Fts5Iter *pIter, Fts5SegIter *pSeg){\n  UNUSED_PARAM(pSeg);\n  pIter->base.nData = 0;\n}\n\n/*\n** xSetOutputs callback used by detail=col when there is a column filter\n** and there are 100 or more columns. Also called as a fallback from\n** fts5IterSetOutputs_Col100 if the column-list spans more than one page.\n*/\nstatic void fts5IterSetOutputs_Col(Fts5Iter *pIter, Fts5SegIter *pSeg){\n  fts5BufferZero(&pIter->poslist);\n  fts5SegiterPoslist(pIter->pIndex, pSeg, pIter->pColset, &pIter->poslist);\n  pIter->base.iRowid = pSeg->iRowid;\n  pIter->base.pData = pIter->poslist.p;\n  pIter->base.nData = pIter->poslist.n;\n}\n\n/*\n** xSetOutputs callback used when: \n**\n**   * detail=col,\n**   * there is a column filter, and\n**   * the table contains 100 or fewer columns. \n**\n** The last point is to ensure all column numbers are stored as \n** single-byte varints.\n*/\nstatic void fts5IterSetOutputs_Col100(Fts5Iter *pIter, Fts5SegIter *pSeg){\n\n  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_COLUMNS );\n  assert( pIter->pColset );\n\n  if( pSeg->iLeafOffset+pSeg->nPos>pSeg->pLeaf->szLeaf ){\n    fts5IterSetOutputs_Col(pIter, pSeg);\n  }else{\n    u8 *a = (u8*)&pSeg->pLeaf->p[pSeg->iLeafOffset];\n    u8 *pEnd = (u8*)&a[pSeg->nPos]; \n    int iPrev = 0;\n    int *aiCol = pIter->pColset->aiCol;\n    int *aiColEnd = &aiCol[pIter->pColset->nCol];\n\n    u8 *aOut = pIter->poslist.p;\n    int iPrevOut = 0;\n\n    pIter->base.iRowid = pSeg->iRowid;\n\n    while( a<pEnd ){\n      iPrev += (int)a++[0] - 2;\n      while( *aiCol<iPrev ){\n        aiCol++;\n        if( aiCol==aiColEnd ) goto setoutputs_col_out;\n      }\n      if( *aiCol==iPrev ){\n        *aOut++ = (u8)((iPrev - iPrevOut) + 2);\n        iPrevOut = iPrev;\n      }\n    }\n\nsetoutputs_col_out:\n    pIter->base.pData = pIter->poslist.p;\n    pIter->base.nData = aOut - pIter->poslist.p;\n  }\n}\n\n/*\n** xSetOutputs callback used by detail=full when there is a column filter.\n*/\nstatic void fts5IterSetOutputs_Full(Fts5Iter *pIter, Fts5SegIter *pSeg){\n  Fts5Colset *pColset = pIter->pColset;\n  pIter->base.iRowid = pSeg->iRowid;\n\n  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );\n  assert( pColset );\n\n  if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){\n    /* All data is stored on the current page. Populate the output \n    ** variables to point into the body of the page object. */\n    const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];\n    if( pColset->nCol==1 ){\n      pIter->base.nData = fts5IndexExtractCol(&a, pSeg->nPos,pColset->aiCol[0]);\n      pIter->base.pData = a;\n    }else{\n      fts5BufferZero(&pIter->poslist);\n      fts5IndexExtractColset(pColset, a, pSeg->nPos, &pIter->poslist);\n      pIter->base.pData = pIter->poslist.p;\n      pIter->base.nData = pIter->poslist.n;\n    }\n  }else{\n    /* The data is distributed over two or more pages. Copy it into the\n    ** Fts5Iter.poslist buffer and then set the output pointer to point\n    ** to this buffer.  */\n    fts5BufferZero(&pIter->poslist);\n    fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);\n    pIter->base.pData = pIter->poslist.p;\n    pIter->base.nData = pIter->poslist.n;\n  }\n}\n\nstatic void fts5IterSetOutputCb(int *pRc, Fts5Iter *pIter){\n  if( *pRc==SQLITE_OK ){\n    Fts5Config *pConfig = pIter->pIndex->pConfig;\n    if( pConfig->eDetail==FTS5_DETAIL_NONE ){\n      pIter->xSetOutputs = fts5IterSetOutputs_None;\n    }\n\n    else if( pIter->pColset==0 ){\n      pIter->xSetOutputs = fts5IterSetOutputs_Nocolset;\n    }\n\n    else if( pIter->pColset->nCol==0 ){\n      pIter->xSetOutputs = fts5IterSetOutputs_ZeroColset;\n    }\n\n    else if( pConfig->eDetail==FTS5_DETAIL_FULL ){\n      pIter->xSetOutputs = fts5IterSetOutputs_Full;\n    }\n\n    else{\n      assert( pConfig->eDetail==FTS5_DETAIL_COLUMNS );\n      if( pConfig->nCol<=100 ){\n        pIter->xSetOutputs = fts5IterSetOutputs_Col100;\n        sqlite3Fts5BufferSize(pRc, &pIter->poslist, pConfig->nCol);\n      }else{\n        pIter->xSetOutputs = fts5IterSetOutputs_Col;\n      }\n    }\n  }\n}\n\n\n/*\n** Allocate a new Fts5Iter object.\n**\n** The new object will be used to iterate through data in structure pStruct.\n** If iLevel is -ve, then all data in all segments is merged. Or, if iLevel\n** is zero or greater, data from the first nSegment segments on level iLevel\n** is merged.\n**\n** The iterator initially points to the first term/rowid entry in the \n** iterated data.\n*/\nstatic void fts5MultiIterNew(\n  Fts5Index *p,                   /* FTS5 backend to iterate within */\n  Fts5Structure *pStruct,         /* Structure of specific index */\n  int flags,                      /* FTS5INDEX_QUERY_XXX flags */\n  Fts5Colset *pColset,            /* Colset to filter on (or NULL) */\n  const u8 *pTerm, int nTerm,     /* Term to seek to (or NULL/0) */\n  int iLevel,                     /* Level to iterate (-1 for all) */\n  int nSegment,                   /* Number of segments to merge (iLevel>=0) */\n  Fts5Iter **ppOut                /* New object */\n){\n  int nSeg = 0;                   /* Number of segment-iters in use */\n  int iIter = 0;                  /* */\n  int iSeg;                       /* Used to iterate through segments */\n  Fts5StructureLevel *pLvl;\n  Fts5Iter *pNew;\n\n  assert( (pTerm==0 && nTerm==0) || iLevel<0 );\n\n  /* Allocate space for the new multi-seg-iterator. */\n  if( p->rc==SQLITE_OK ){\n    if( iLevel<0 ){\n      assert( pStruct->nSegment==fts5StructureCountSegments(pStruct) );\n      nSeg = pStruct->nSegment;\n      nSeg += (p->pHash ? 1 : 0);\n    }else{\n      nSeg = MIN(pStruct->aLevel[iLevel].nSeg, nSegment);\n    }\n  }\n  *ppOut = pNew = fts5MultiIterAlloc(p, nSeg);\n  if( pNew==0 ) return;\n  pNew->bRev = (0!=(flags & FTS5INDEX_QUERY_DESC));\n  pNew->bSkipEmpty = (0!=(flags & FTS5INDEX_QUERY_SKIPEMPTY));\n  pNew->pStruct = pStruct;\n  pNew->pColset = pColset;\n  fts5StructureRef(pStruct);\n  if( (flags & FTS5INDEX_QUERY_NOOUTPUT)==0 ){\n    fts5IterSetOutputCb(&p->rc, pNew);\n  }\n\n  /* Initialize each of the component segment iterators. */\n  if( p->rc==SQLITE_OK ){\n    if( iLevel<0 ){\n      Fts5StructureLevel *pEnd = &pStruct->aLevel[pStruct->nLevel];\n      if( p->pHash ){\n        /* Add a segment iterator for the current contents of the hash table. */\n        Fts5SegIter *pIter = &pNew->aSeg[iIter++];\n        fts5SegIterHashInit(p, pTerm, nTerm, flags, pIter);\n      }\n      for(pLvl=&pStruct->aLevel[0]; pLvl<pEnd; pLvl++){\n        for(iSeg=pLvl->nSeg-1; iSeg>=0; iSeg--){\n          Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];\n          Fts5SegIter *pIter = &pNew->aSeg[iIter++];\n          if( pTerm==0 ){\n            fts5SegIterInit(p, pSeg, pIter);\n          }else{\n            fts5SegIterSeekInit(p, pTerm, nTerm, flags, pSeg, pIter);\n          }\n        }\n      }\n    }else{\n      pLvl = &pStruct->aLevel[iLevel];\n      for(iSeg=nSeg-1; iSeg>=0; iSeg--){\n        fts5SegIterInit(p, &pLvl->aSeg[iSeg], &pNew->aSeg[iIter++]);\n      }\n    }\n    assert( iIter==nSeg );\n  }\n\n  /* If the above was successful, each component iterators now points \n  ** to the first entry in its segment. In this case initialize the \n  ** aFirst[] array. Or, if an error has occurred, free the iterator\n  ** object and set the output variable to NULL.  */\n  if( p->rc==SQLITE_OK ){\n    for(iIter=pNew->nSeg-1; iIter>0; iIter--){\n      int iEq;\n      if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){\n        Fts5SegIter *pSeg = &pNew->aSeg[iEq];\n        if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0);\n        fts5MultiIterAdvanced(p, pNew, iEq, iIter);\n      }\n    }\n    fts5MultiIterSetEof(pNew);\n    fts5AssertMultiIterSetup(p, pNew);\n\n    if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){\n      fts5MultiIterNext(p, pNew, 0, 0);\n    }else if( pNew->base.bEof==0 ){\n      Fts5SegIter *pSeg = &pNew->aSeg[pNew->aFirst[1].iFirst];\n      pNew->xSetOutputs(pNew, pSeg);\n    }\n\n  }else{\n    fts5MultiIterFree(pNew);\n    *ppOut = 0;\n  }\n}\n\n/*\n** Create an Fts5Iter that iterates through the doclist provided\n** as the second argument.\n*/\nstatic void fts5MultiIterNew2(\n  Fts5Index *p,                   /* FTS5 backend to iterate within */\n  Fts5Data *pData,                /* Doclist to iterate through */\n  int bDesc,                      /* True for descending rowid order */\n  Fts5Iter **ppOut                /* New object */\n){\n  Fts5Iter *pNew;\n  pNew = fts5MultiIterAlloc(p, 2);\n  if( pNew ){\n    Fts5SegIter *pIter = &pNew->aSeg[1];\n\n    pIter->flags = FTS5_SEGITER_ONETERM;\n    if( pData->szLeaf>0 ){\n      pIter->pLeaf = pData;\n      pIter->iLeafOffset = fts5GetVarint(pData->p, (u64*)&pIter->iRowid);\n      pIter->iEndofDoclist = pData->nn;\n      pNew->aFirst[1].iFirst = 1;\n      if( bDesc ){\n        pNew->bRev = 1;\n        pIter->flags |= FTS5_SEGITER_REVERSE;\n        fts5SegIterReverseInitPage(p, pIter);\n      }else{\n        fts5SegIterLoadNPos(p, pIter);\n      }\n      pData = 0;\n    }else{\n      pNew->base.bEof = 1;\n    }\n    fts5SegIterSetNext(p, pIter);\n\n    *ppOut = pNew;\n  }\n\n  fts5DataRelease(pData);\n}\n\n/*\n** Return true if the iterator is at EOF or if an error has occurred. \n** False otherwise.\n*/\nstatic int fts5MultiIterEof(Fts5Index *p, Fts5Iter *pIter){\n  assert( p->rc \n      || (pIter->aSeg[ pIter->aFirst[1].iFirst ].pLeaf==0)==pIter->base.bEof \n  );\n  return (p->rc || pIter->base.bEof);\n}\n\n/*\n** Return the rowid of the entry that the iterator currently points\n** to. If the iterator points to EOF when this function is called the\n** results are undefined.\n*/\nstatic i64 fts5MultiIterRowid(Fts5Iter *pIter){\n  assert( pIter->aSeg[ pIter->aFirst[1].iFirst ].pLeaf );\n  return pIter->aSeg[ pIter->aFirst[1].iFirst ].iRowid;\n}\n\n/*\n** Move the iterator to the next entry at or following iMatch.\n*/\nstatic void fts5MultiIterNextFrom(\n  Fts5Index *p, \n  Fts5Iter *pIter, \n  i64 iMatch\n){\n  while( 1 ){\n    i64 iRowid;\n    fts5MultiIterNext(p, pIter, 1, iMatch);\n    if( fts5MultiIterEof(p, pIter) ) break;\n    iRowid = fts5MultiIterRowid(pIter);\n    if( pIter->bRev==0 && iRowid>=iMatch ) break;\n    if( pIter->bRev!=0 && iRowid<=iMatch ) break;\n  }\n}\n\n/*\n** Return a pointer to a buffer containing the term associated with the \n** entry that the iterator currently points to.\n*/\nstatic const u8 *fts5MultiIterTerm(Fts5Iter *pIter, int *pn){\n  Fts5SegIter *p = &pIter->aSeg[ pIter->aFirst[1].iFirst ];\n  *pn = p->term.n;\n  return p->term.p;\n}\n\n/*\n** Allocate a new segment-id for the structure pStruct. The new segment\n** id must be between 1 and 65335 inclusive, and must not be used by \n** any currently existing segment. If a free segment id cannot be found,\n** SQLITE_FULL is returned.\n**\n** If an error has already occurred, this function is a no-op. 0 is \n** returned in this case.\n*/\nstatic int fts5AllocateSegid(Fts5Index *p, Fts5Structure *pStruct){\n  int iSegid = 0;\n\n  if( p->rc==SQLITE_OK ){\n    if( pStruct->nSegment>=FTS5_MAX_SEGMENT ){\n      p->rc = SQLITE_FULL;\n    }else{\n      /* FTS5_MAX_SEGMENT is currently defined as 2000. So the following\n      ** array is 63 elements, or 252 bytes, in size.  */\n      u32 aUsed[(FTS5_MAX_SEGMENT+31) / 32];\n      int iLvl, iSeg;\n      int i;\n      u32 mask;\n      memset(aUsed, 0, sizeof(aUsed));\n      for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){\n        for(iSeg=0; iSeg<pStruct->aLevel[iLvl].nSeg; iSeg++){\n          int iId = pStruct->aLevel[iLvl].aSeg[iSeg].iSegid;\n          if( iId<=FTS5_MAX_SEGMENT ){\n            aUsed[(iId-1) / 32] |= 1 << ((iId-1) % 32);\n          }\n        }\n      }\n\n      for(i=0; aUsed[i]==0xFFFFFFFF; i++);\n      mask = aUsed[i];\n      for(iSegid=0; mask & (1 << iSegid); iSegid++);\n      iSegid += 1 + i*32;\n\n#ifdef SQLITE_DEBUG\n      for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){\n        for(iSeg=0; iSeg<pStruct->aLevel[iLvl].nSeg; iSeg++){\n          assert( iSegid!=pStruct->aLevel[iLvl].aSeg[iSeg].iSegid );\n        }\n      }\n      assert( iSegid>0 && iSegid<=FTS5_MAX_SEGMENT );\n\n      {\n        sqlite3_stmt *pIdxSelect = fts5IdxSelectStmt(p);\n        if( p->rc==SQLITE_OK ){\n          u8 aBlob[2] = {0xff, 0xff};\n          sqlite3_bind_int(pIdxSelect, 1, iSegid);\n          sqlite3_bind_blob(pIdxSelect, 2, aBlob, 2, SQLITE_STATIC);\n          assert( sqlite3_step(pIdxSelect)!=SQLITE_ROW );\n          p->rc = sqlite3_reset(pIdxSelect);\n        }\n      }\n#endif\n    }\n  }\n\n  return iSegid;\n}\n\n/*\n** Discard all data currently cached in the hash-tables.\n*/\nstatic void fts5IndexDiscardData(Fts5Index *p){\n  assert( p->pHash || p->nPendingData==0 );\n  if( p->pHash ){\n    sqlite3Fts5HashClear(p->pHash);\n    p->nPendingData = 0;\n  }\n}\n\n/*\n** Return the size of the prefix, in bytes, that buffer \n** (pNew/<length-unknown>) shares with buffer (pOld/nOld).\n**\n** Buffer (pNew/<length-unknown>) is guaranteed to be greater \n** than buffer (pOld/nOld).\n*/\nstatic int fts5PrefixCompress(int nOld, const u8 *pOld, const u8 *pNew){\n  int i;\n  for(i=0; i<nOld; i++){\n    if( pOld[i]!=pNew[i] ) break;\n  }\n  return i;\n}\n\nstatic void fts5WriteDlidxClear(\n  Fts5Index *p, \n  Fts5SegWriter *pWriter,\n  int bFlush                      /* If true, write dlidx to disk */\n){\n  int i;\n  assert( bFlush==0 || (pWriter->nDlidx>0 && pWriter->aDlidx[0].buf.n>0) );\n  for(i=0; i<pWriter->nDlidx; i++){\n    Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[i];\n    if( pDlidx->buf.n==0 ) break;\n    if( bFlush ){\n      assert( pDlidx->pgno!=0 );\n      fts5DataWrite(p, \n          FTS5_DLIDX_ROWID(pWriter->iSegid, i, pDlidx->pgno),\n          pDlidx->buf.p, pDlidx->buf.n\n      );\n    }\n    sqlite3Fts5BufferZero(&pDlidx->buf);\n    pDlidx->bPrevValid = 0;\n  }\n}\n\n/*\n** Grow the pWriter->aDlidx[] array to at least nLvl elements in size.\n** Any new array elements are zeroed before returning.\n*/\nstatic int fts5WriteDlidxGrow(\n  Fts5Index *p,\n  Fts5SegWriter *pWriter,\n  int nLvl\n){\n  if( p->rc==SQLITE_OK && nLvl>=pWriter->nDlidx ){\n    Fts5DlidxWriter *aDlidx = (Fts5DlidxWriter*)sqlite3_realloc(\n        pWriter->aDlidx, sizeof(Fts5DlidxWriter) * nLvl\n    );\n    if( aDlidx==0 ){\n      p->rc = SQLITE_NOMEM;\n    }else{\n      int nByte = sizeof(Fts5DlidxWriter) * (nLvl - pWriter->nDlidx);\n      memset(&aDlidx[pWriter->nDlidx], 0, nByte);\n      pWriter->aDlidx = aDlidx;\n      pWriter->nDlidx = nLvl;\n    }\n  }\n  return p->rc;\n}\n\n/*\n** If the current doclist-index accumulating in pWriter->aDlidx[] is large\n** enough, flush it to disk and return 1. Otherwise discard it and return\n** zero.\n*/\nstatic int fts5WriteFlushDlidx(Fts5Index *p, Fts5SegWriter *pWriter){\n  int bFlag = 0;\n\n  /* If there were FTS5_MIN_DLIDX_SIZE or more empty leaf pages written\n  ** to the database, also write the doclist-index to disk.  */\n  if( pWriter->aDlidx[0].buf.n>0 && pWriter->nEmpty>=FTS5_MIN_DLIDX_SIZE ){\n    bFlag = 1;\n  }\n  fts5WriteDlidxClear(p, pWriter, bFlag);\n  pWriter->nEmpty = 0;\n  return bFlag;\n}\n\n/*\n** This function is called whenever processing of the doclist for the \n** last term on leaf page (pWriter->iBtPage) is completed. \n**\n** The doclist-index for that term is currently stored in-memory within the\n** Fts5SegWriter.aDlidx[] array. If it is large enough, this function\n** writes it out to disk. Or, if it is too small to bother with, discards\n** it.\n**\n** Fts5SegWriter.btterm currently contains the first term on page iBtPage.\n*/\nstatic void fts5WriteFlushBtree(Fts5Index *p, Fts5SegWriter *pWriter){\n  int bFlag;\n\n  assert( pWriter->iBtPage || pWriter->nEmpty==0 );\n  if( pWriter->iBtPage==0 ) return;\n  bFlag = fts5WriteFlushDlidx(p, pWriter);\n\n  if( p->rc==SQLITE_OK ){\n    const char *z = (pWriter->btterm.n>0?(const char*)pWriter->btterm.p:\"\");\n    /* The following was already done in fts5WriteInit(): */\n    /* sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); */\n    sqlite3_bind_blob(p->pIdxWriter, 2, z, pWriter->btterm.n, SQLITE_STATIC);\n    sqlite3_bind_int64(p->pIdxWriter, 3, bFlag + ((i64)pWriter->iBtPage<<1));\n    sqlite3_step(p->pIdxWriter);\n    p->rc = sqlite3_reset(p->pIdxWriter);\n  }\n  pWriter->iBtPage = 0;\n}\n\n/*\n** This is called once for each leaf page except the first that contains\n** at least one term. Argument (nTerm/pTerm) is the split-key - a term that\n** is larger than all terms written to earlier leaves, and equal to or\n** smaller than the first term on the new leaf.\n**\n** If an error occurs, an error code is left in Fts5Index.rc. If an error\n** has already occurred when this function is called, it is a no-op.\n*/\nstatic void fts5WriteBtreeTerm(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegWriter *pWriter,         /* Writer object */\n  int nTerm, const u8 *pTerm      /* First term on new page */\n){\n  fts5WriteFlushBtree(p, pWriter);\n  fts5BufferSet(&p->rc, &pWriter->btterm, nTerm, pTerm);\n  pWriter->iBtPage = pWriter->writer.pgno;\n}\n\n/*\n** This function is called when flushing a leaf page that contains no\n** terms at all to disk.\n*/\nstatic void fts5WriteBtreeNoTerm(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5SegWriter *pWriter          /* Writer object */\n){\n  /* If there were no rowids on the leaf page either and the doclist-index\n  ** has already been started, append an 0x00 byte to it.  */\n  if( pWriter->bFirstRowidInPage && pWriter->aDlidx[0].buf.n>0 ){\n    Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[0];\n    assert( pDlidx->bPrevValid );\n    sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, 0);\n  }\n\n  /* Increment the \"number of sequential leaves without a term\" counter. */\n  pWriter->nEmpty++;\n}\n\nstatic i64 fts5DlidxExtractFirstRowid(Fts5Buffer *pBuf){\n  i64 iRowid;\n  int iOff;\n\n  iOff = 1 + fts5GetVarint(&pBuf->p[1], (u64*)&iRowid);\n  fts5GetVarint(&pBuf->p[iOff], (u64*)&iRowid);\n  return iRowid;\n}\n\n/*\n** Rowid iRowid has just been appended to the current leaf page. It is the\n** first on the page. This function appends an appropriate entry to the current\n** doclist-index.\n*/\nstatic void fts5WriteDlidxAppend(\n  Fts5Index *p, \n  Fts5SegWriter *pWriter, \n  i64 iRowid\n){\n  int i;\n  int bDone = 0;\n\n  for(i=0; p->rc==SQLITE_OK && bDone==0; i++){\n    i64 iVal;\n    Fts5DlidxWriter *pDlidx = &pWriter->aDlidx[i];\n\n    if( pDlidx->buf.n>=p->pConfig->pgsz ){\n      /* The current doclist-index page is full. Write it to disk and push\n      ** a copy of iRowid (which will become the first rowid on the next\n      ** doclist-index leaf page) up into the next level of the b-tree \n      ** hierarchy. If the node being flushed is currently the root node,\n      ** also push its first rowid upwards. */\n      pDlidx->buf.p[0] = 0x01;    /* Not the root node */\n      fts5DataWrite(p, \n          FTS5_DLIDX_ROWID(pWriter->iSegid, i, pDlidx->pgno),\n          pDlidx->buf.p, pDlidx->buf.n\n      );\n      fts5WriteDlidxGrow(p, pWriter, i+2);\n      pDlidx = &pWriter->aDlidx[i];\n      if( p->rc==SQLITE_OK && pDlidx[1].buf.n==0 ){\n        i64 iFirst = fts5DlidxExtractFirstRowid(&pDlidx->buf);\n\n        /* This was the root node. Push its first rowid up to the new root. */\n        pDlidx[1].pgno = pDlidx->pgno;\n        sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, 0);\n        sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, pDlidx->pgno);\n        sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx[1].buf, iFirst);\n        pDlidx[1].bPrevValid = 1;\n        pDlidx[1].iPrev = iFirst;\n      }\n\n      sqlite3Fts5BufferZero(&pDlidx->buf);\n      pDlidx->bPrevValid = 0;\n      pDlidx->pgno++;\n    }else{\n      bDone = 1;\n    }\n\n    if( pDlidx->bPrevValid ){\n      iVal = iRowid - pDlidx->iPrev;\n    }else{\n      i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno);\n      assert( pDlidx->buf.n==0 );\n      sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, !bDone);\n      sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iPgno);\n      iVal = iRowid;\n    }\n\n    sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iVal);\n    pDlidx->bPrevValid = 1;\n    pDlidx->iPrev = iRowid;\n  }\n}\n\nstatic void fts5WriteFlushLeaf(Fts5Index *p, Fts5SegWriter *pWriter){\n  static const u8 zero[] = { 0x00, 0x00, 0x00, 0x00 };\n  Fts5PageWriter *pPage = &pWriter->writer;\n  i64 iRowid;\n\nstatic int nCall = 0;\nnCall++;\n\n  assert( (pPage->pgidx.n==0)==(pWriter->bFirstTermInPage) );\n\n  /* Set the szLeaf header field. */\n  assert( 0==fts5GetU16(&pPage->buf.p[2]) );\n  fts5PutU16(&pPage->buf.p[2], (u16)pPage->buf.n);\n\n  if( pWriter->bFirstTermInPage ){\n    /* No term was written to this page. */\n    assert( pPage->pgidx.n==0 );\n    fts5WriteBtreeNoTerm(p, pWriter);\n  }else{\n    /* Append the pgidx to the page buffer. Set the szLeaf header field. */\n    fts5BufferAppendBlob(&p->rc, &pPage->buf, pPage->pgidx.n, pPage->pgidx.p);\n  }\n\n  /* Write the page out to disk */\n  iRowid = FTS5_SEGMENT_ROWID(pWriter->iSegid, pPage->pgno);\n  fts5DataWrite(p, iRowid, pPage->buf.p, pPage->buf.n);\n\n  /* Initialize the next page. */\n  fts5BufferZero(&pPage->buf);\n  fts5BufferZero(&pPage->pgidx);\n  fts5BufferAppendBlob(&p->rc, &pPage->buf, 4, zero);\n  pPage->iPrevPgidx = 0;\n  pPage->pgno++;\n\n  /* Increase the leaves written counter */\n  pWriter->nLeafWritten++;\n\n  /* The new leaf holds no terms or rowids */\n  pWriter->bFirstTermInPage = 1;\n  pWriter->bFirstRowidInPage = 1;\n}\n\n/*\n** Append term pTerm/nTerm to the segment being written by the writer passed\n** as the second argument.\n**\n** If an error occurs, set the Fts5Index.rc error code. If an error has \n** already occurred, this function is a no-op.\n*/\nstatic void fts5WriteAppendTerm(\n  Fts5Index *p, \n  Fts5SegWriter *pWriter,\n  int nTerm, const u8 *pTerm \n){\n  int nPrefix;                    /* Bytes of prefix compression for term */\n  Fts5PageWriter *pPage = &pWriter->writer;\n  Fts5Buffer *pPgidx = &pWriter->writer.pgidx;\n\n  assert( p->rc==SQLITE_OK );\n  assert( pPage->buf.n>=4 );\n  assert( pPage->buf.n>4 || pWriter->bFirstTermInPage );\n\n  /* If the current leaf page is full, flush it to disk. */\n  if( (pPage->buf.n + pPgidx->n + nTerm + 2)>=p->pConfig->pgsz ){\n    if( pPage->buf.n>4 ){\n      fts5WriteFlushLeaf(p, pWriter);\n    }\n    fts5BufferGrow(&p->rc, &pPage->buf, nTerm+FTS5_DATA_PADDING);\n  }\n  \n  /* TODO1: Updating pgidx here. */\n  pPgidx->n += sqlite3Fts5PutVarint(\n      &pPgidx->p[pPgidx->n], pPage->buf.n - pPage->iPrevPgidx\n  );\n  pPage->iPrevPgidx = pPage->buf.n;\n#if 0\n  fts5PutU16(&pPgidx->p[pPgidx->n], pPage->buf.n);\n  pPgidx->n += 2;\n#endif\n\n  if( pWriter->bFirstTermInPage ){\n    nPrefix = 0;\n    if( pPage->pgno!=1 ){\n      /* This is the first term on a leaf that is not the leftmost leaf in\n      ** the segment b-tree. In this case it is necessary to add a term to\n      ** the b-tree hierarchy that is (a) larger than the largest term \n      ** already written to the segment and (b) smaller than or equal to\n      ** this term. In other words, a prefix of (pTerm/nTerm) that is one\n      ** byte longer than the longest prefix (pTerm/nTerm) shares with the\n      ** previous term. \n      **\n      ** Usually, the previous term is available in pPage->term. The exception\n      ** is if this is the first term written in an incremental-merge step.\n      ** In this case the previous term is not available, so just write a\n      ** copy of (pTerm/nTerm) into the parent node. This is slightly\n      ** inefficient, but still correct.  */\n      int n = nTerm;\n      if( pPage->term.n ){\n        n = 1 + fts5PrefixCompress(pPage->term.n, pPage->term.p, pTerm);\n      }\n      fts5WriteBtreeTerm(p, pWriter, n, pTerm);\n      pPage = &pWriter->writer;\n    }\n  }else{\n    nPrefix = fts5PrefixCompress(pPage->term.n, pPage->term.p, pTerm);\n    fts5BufferAppendVarint(&p->rc, &pPage->buf, nPrefix);\n  }\n\n  /* Append the number of bytes of new data, then the term data itself\n  ** to the page. */\n  fts5BufferAppendVarint(&p->rc, &pPage->buf, nTerm - nPrefix);\n  fts5BufferAppendBlob(&p->rc, &pPage->buf, nTerm - nPrefix, &pTerm[nPrefix]);\n\n  /* Update the Fts5PageWriter.term field. */\n  fts5BufferSet(&p->rc, &pPage->term, nTerm, pTerm);\n  pWriter->bFirstTermInPage = 0;\n\n  pWriter->bFirstRowidInPage = 0;\n  pWriter->bFirstRowidInDoclist = 1;\n\n  assert( p->rc || (pWriter->nDlidx>0 && pWriter->aDlidx[0].buf.n==0) );\n  pWriter->aDlidx[0].pgno = pPage->pgno;\n}\n\n/*\n** Append a rowid and position-list size field to the writers output. \n*/\nstatic void fts5WriteAppendRowid(\n  Fts5Index *p, \n  Fts5SegWriter *pWriter,\n  i64 iRowid\n){\n  if( p->rc==SQLITE_OK ){\n    Fts5PageWriter *pPage = &pWriter->writer;\n\n    if( (pPage->buf.n + pPage->pgidx.n)>=p->pConfig->pgsz ){\n      fts5WriteFlushLeaf(p, pWriter);\n    }\n\n    /* If this is to be the first rowid written to the page, set the \n    ** rowid-pointer in the page-header. Also append a value to the dlidx\n    ** buffer, in case a doclist-index is required.  */\n    if( pWriter->bFirstRowidInPage ){\n      fts5PutU16(pPage->buf.p, (u16)pPage->buf.n);\n      fts5WriteDlidxAppend(p, pWriter, iRowid);\n    }\n\n    /* Write the rowid. */\n    if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){\n      fts5BufferAppendVarint(&p->rc, &pPage->buf, iRowid);\n    }else{\n      assert( p->rc || iRowid>pWriter->iPrevRowid );\n      fts5BufferAppendVarint(&p->rc, &pPage->buf, iRowid - pWriter->iPrevRowid);\n    }\n    pWriter->iPrevRowid = iRowid;\n    pWriter->bFirstRowidInDoclist = 0;\n    pWriter->bFirstRowidInPage = 0;\n  }\n}\n\nstatic void fts5WriteAppendPoslistData(\n  Fts5Index *p, \n  Fts5SegWriter *pWriter, \n  const u8 *aData, \n  int nData\n){\n  Fts5PageWriter *pPage = &pWriter->writer;\n  const u8 *a = aData;\n  int n = nData;\n  \n  assert( p->pConfig->pgsz>0 );\n  while( p->rc==SQLITE_OK \n     && (pPage->buf.n + pPage->pgidx.n + n)>=p->pConfig->pgsz \n  ){\n    int nReq = p->pConfig->pgsz - pPage->buf.n - pPage->pgidx.n;\n    int nCopy = 0;\n    while( nCopy<nReq ){\n      i64 dummy;\n      nCopy += fts5GetVarint(&a[nCopy], (u64*)&dummy);\n    }\n    fts5BufferAppendBlob(&p->rc, &pPage->buf, nCopy, a);\n    a += nCopy;\n    n -= nCopy;\n    fts5WriteFlushLeaf(p, pWriter);\n  }\n  if( n>0 ){\n    fts5BufferAppendBlob(&p->rc, &pPage->buf, n, a);\n  }\n}\n\n/*\n** Flush any data cached by the writer object to the database. Free any\n** allocations associated with the writer.\n*/\nstatic void fts5WriteFinish(\n  Fts5Index *p, \n  Fts5SegWriter *pWriter,         /* Writer object */\n  int *pnLeaf                     /* OUT: Number of leaf pages in b-tree */\n){\n  int i;\n  Fts5PageWriter *pLeaf = &pWriter->writer;\n  if( p->rc==SQLITE_OK ){\n    assert( pLeaf->pgno>=1 );\n    if( pLeaf->buf.n>4 ){\n      fts5WriteFlushLeaf(p, pWriter);\n    }\n    *pnLeaf = pLeaf->pgno-1;\n    if( pLeaf->pgno>1 ){\n      fts5WriteFlushBtree(p, pWriter);\n    }\n  }\n  fts5BufferFree(&pLeaf->term);\n  fts5BufferFree(&pLeaf->buf);\n  fts5BufferFree(&pLeaf->pgidx);\n  fts5BufferFree(&pWriter->btterm);\n\n  for(i=0; i<pWriter->nDlidx; i++){\n    sqlite3Fts5BufferFree(&pWriter->aDlidx[i].buf);\n  }\n  sqlite3_free(pWriter->aDlidx);\n}\n\nstatic void fts5WriteInit(\n  Fts5Index *p, \n  Fts5SegWriter *pWriter, \n  int iSegid\n){\n  const int nBuffer = p->pConfig->pgsz + FTS5_DATA_PADDING;\n\n  memset(pWriter, 0, sizeof(Fts5SegWriter));\n  pWriter->iSegid = iSegid;\n\n  fts5WriteDlidxGrow(p, pWriter, 1);\n  pWriter->writer.pgno = 1;\n  pWriter->bFirstTermInPage = 1;\n  pWriter->iBtPage = 1;\n\n  assert( pWriter->writer.buf.n==0 );\n  assert( pWriter->writer.pgidx.n==0 );\n\n  /* Grow the two buffers to pgsz + padding bytes in size. */\n  sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.pgidx, nBuffer);\n  sqlite3Fts5BufferSize(&p->rc, &pWriter->writer.buf, nBuffer);\n\n  if( p->pIdxWriter==0 ){\n    Fts5Config *pConfig = p->pConfig;\n    fts5IndexPrepareStmt(p, &p->pIdxWriter, sqlite3_mprintf(\n          \"INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)\", \n          pConfig->zDb, pConfig->zName\n    ));\n  }\n\n  if( p->rc==SQLITE_OK ){\n    /* Initialize the 4-byte leaf-page header to 0x00. */\n    memset(pWriter->writer.buf.p, 0, 4);\n    pWriter->writer.buf.n = 4;\n\n    /* Bind the current output segment id to the index-writer. This is an\n    ** optimization over binding the same value over and over as rows are\n    ** inserted into %_idx by the current writer.  */\n    sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid);\n  }\n}\n\n/*\n** Iterator pIter was used to iterate through the input segments of on an\n** incremental merge operation. This function is called if the incremental\n** merge step has finished but the input has not been completely exhausted.\n*/\nstatic void fts5TrimSegments(Fts5Index *p, Fts5Iter *pIter){\n  int i;\n  Fts5Buffer buf;\n  memset(&buf, 0, sizeof(Fts5Buffer));\n  for(i=0; i<pIter->nSeg; i++){\n    Fts5SegIter *pSeg = &pIter->aSeg[i];\n    if( pSeg->pSeg==0 ){\n      /* no-op */\n    }else if( pSeg->pLeaf==0 ){\n      /* All keys from this input segment have been transfered to the output.\n      ** Set both the first and last page-numbers to 0 to indicate that the\n      ** segment is now empty. */\n      pSeg->pSeg->pgnoLast = 0;\n      pSeg->pSeg->pgnoFirst = 0;\n    }else{\n      int iOff = pSeg->iTermLeafOffset;     /* Offset on new first leaf page */\n      i64 iLeafRowid;\n      Fts5Data *pData;\n      int iId = pSeg->pSeg->iSegid;\n      u8 aHdr[4] = {0x00, 0x00, 0x00, 0x00};\n\n      iLeafRowid = FTS5_SEGMENT_ROWID(iId, pSeg->iTermLeafPgno);\n      pData = fts5DataRead(p, iLeafRowid);\n      if( pData ){\n        fts5BufferZero(&buf);\n        fts5BufferGrow(&p->rc, &buf, pData->nn);\n        fts5BufferAppendBlob(&p->rc, &buf, sizeof(aHdr), aHdr);\n        fts5BufferAppendVarint(&p->rc, &buf, pSeg->term.n);\n        fts5BufferAppendBlob(&p->rc, &buf, pSeg->term.n, pSeg->term.p);\n        fts5BufferAppendBlob(&p->rc, &buf, pData->szLeaf-iOff, &pData->p[iOff]);\n        if( p->rc==SQLITE_OK ){\n          /* Set the szLeaf field */\n          fts5PutU16(&buf.p[2], (u16)buf.n);\n        }\n\n        /* Set up the new page-index array */\n        fts5BufferAppendVarint(&p->rc, &buf, 4);\n        if( pSeg->iLeafPgno==pSeg->iTermLeafPgno \n         && pSeg->iEndofDoclist<pData->szLeaf \n        ){\n          int nDiff = pData->szLeaf - pSeg->iEndofDoclist;\n          fts5BufferAppendVarint(&p->rc, &buf, buf.n - 1 - nDiff - 4);\n          fts5BufferAppendBlob(&p->rc, &buf, \n              pData->nn - pSeg->iPgidxOff, &pData->p[pSeg->iPgidxOff]\n          );\n        }\n\n        fts5DataRelease(pData);\n        pSeg->pSeg->pgnoFirst = pSeg->iTermLeafPgno;\n        fts5DataDelete(p, FTS5_SEGMENT_ROWID(iId, 1), iLeafRowid);\n        fts5DataWrite(p, iLeafRowid, buf.p, buf.n);\n      }\n    }\n  }\n  fts5BufferFree(&buf);\n}\n\nstatic void fts5MergeChunkCallback(\n  Fts5Index *p, \n  void *pCtx, \n  const u8 *pChunk, int nChunk\n){\n  Fts5SegWriter *pWriter = (Fts5SegWriter*)pCtx;\n  fts5WriteAppendPoslistData(p, pWriter, pChunk, nChunk);\n}\n\n/*\n**\n*/\nstatic void fts5IndexMergeLevel(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5Structure **ppStruct,       /* IN/OUT: Stucture of index */\n  int iLvl,                       /* Level to read input from */\n  int *pnRem                      /* Write up to this many output leaves */\n){\n  Fts5Structure *pStruct = *ppStruct;\n  Fts5StructureLevel *pLvl = &pStruct->aLevel[iLvl];\n  Fts5StructureLevel *pLvlOut;\n  Fts5Iter *pIter = 0;       /* Iterator to read input data */\n  int nRem = pnRem ? *pnRem : 0;  /* Output leaf pages left to write */\n  int nInput;                     /* Number of input segments */\n  Fts5SegWriter writer;           /* Writer object */\n  Fts5StructureSegment *pSeg;     /* Output segment */\n  Fts5Buffer term;\n  int bOldest;                    /* True if the output segment is the oldest */\n  int eDetail = p->pConfig->eDetail;\n  const int flags = FTS5INDEX_QUERY_NOOUTPUT;\n\n  assert( iLvl<pStruct->nLevel );\n  assert( pLvl->nMerge<=pLvl->nSeg );\n\n  memset(&writer, 0, sizeof(Fts5SegWriter));\n  memset(&term, 0, sizeof(Fts5Buffer));\n  if( pLvl->nMerge ){\n    pLvlOut = &pStruct->aLevel[iLvl+1];\n    assert( pLvlOut->nSeg>0 );\n    nInput = pLvl->nMerge;\n    pSeg = &pLvlOut->aSeg[pLvlOut->nSeg-1];\n\n    fts5WriteInit(p, &writer, pSeg->iSegid);\n    writer.writer.pgno = pSeg->pgnoLast+1;\n    writer.iBtPage = 0;\n  }else{\n    int iSegid = fts5AllocateSegid(p, pStruct);\n\n    /* Extend the Fts5Structure object as required to ensure the output\n    ** segment exists. */\n    if( iLvl==pStruct->nLevel-1 ){\n      fts5StructureAddLevel(&p->rc, ppStruct);\n      pStruct = *ppStruct;\n    }\n    fts5StructureExtendLevel(&p->rc, pStruct, iLvl+1, 1, 0);\n    if( p->rc ) return;\n    pLvl = &pStruct->aLevel[iLvl];\n    pLvlOut = &pStruct->aLevel[iLvl+1];\n\n    fts5WriteInit(p, &writer, iSegid);\n\n    /* Add the new segment to the output level */\n    pSeg = &pLvlOut->aSeg[pLvlOut->nSeg];\n    pLvlOut->nSeg++;\n    pSeg->pgnoFirst = 1;\n    pSeg->iSegid = iSegid;\n    pStruct->nSegment++;\n\n    /* Read input from all segments in the input level */\n    nInput = pLvl->nSeg;\n  }\n  bOldest = (pLvlOut->nSeg==1 && pStruct->nLevel==iLvl+2);\n\n  assert( iLvl>=0 );\n  for(fts5MultiIterNew(p, pStruct, flags, 0, 0, 0, iLvl, nInput, &pIter);\n      fts5MultiIterEof(p, pIter)==0;\n      fts5MultiIterNext(p, pIter, 0, 0)\n  ){\n    Fts5SegIter *pSegIter = &pIter->aSeg[ pIter->aFirst[1].iFirst ];\n    int nPos;                     /* position-list size field value */\n    int nTerm;\n    const u8 *pTerm;\n\n    /* Check for key annihilation. */\n    if( pSegIter->nPos==0 && (bOldest || pSegIter->bDel==0) ) continue;\n\n    pTerm = fts5MultiIterTerm(pIter, &nTerm);\n    if( nTerm!=term.n || memcmp(pTerm, term.p, nTerm) ){\n      if( pnRem && writer.nLeafWritten>nRem ){\n        break;\n      }\n\n      /* This is a new term. Append a term to the output segment. */\n      fts5WriteAppendTerm(p, &writer, nTerm, pTerm);\n      fts5BufferSet(&p->rc, &term, nTerm, pTerm);\n    }\n\n    /* Append the rowid to the output */\n    /* WRITEPOSLISTSIZE */\n    fts5WriteAppendRowid(p, &writer, fts5MultiIterRowid(pIter));\n\n    if( eDetail==FTS5_DETAIL_NONE ){\n      if( pSegIter->bDel ){\n        fts5BufferAppendVarint(&p->rc, &writer.writer.buf, 0);\n        if( pSegIter->nPos>0 ){\n          fts5BufferAppendVarint(&p->rc, &writer.writer.buf, 0);\n        }\n      }\n    }else{\n      /* Append the position-list data to the output */\n      nPos = pSegIter->nPos*2 + pSegIter->bDel;\n      fts5BufferAppendVarint(&p->rc, &writer.writer.buf, nPos);\n      fts5ChunkIterate(p, pSegIter, (void*)&writer, fts5MergeChunkCallback);\n    }\n  }\n\n  /* Flush the last leaf page to disk. Set the output segment b-tree height\n  ** and last leaf page number at the same time.  */\n  fts5WriteFinish(p, &writer, &pSeg->pgnoLast);\n\n  if( fts5MultiIterEof(p, pIter) ){\n    int i;\n\n    /* Remove the redundant segments from the %_data table */\n    for(i=0; i<nInput; i++){\n      fts5DataRemoveSegment(p, pLvl->aSeg[i].iSegid);\n    }\n\n    /* Remove the redundant segments from the input level */\n    if( pLvl->nSeg!=nInput ){\n      int nMove = (pLvl->nSeg - nInput) * sizeof(Fts5StructureSegment);\n      memmove(pLvl->aSeg, &pLvl->aSeg[nInput], nMove);\n    }\n    pStruct->nSegment -= nInput;\n    pLvl->nSeg -= nInput;\n    pLvl->nMerge = 0;\n    if( pSeg->pgnoLast==0 ){\n      pLvlOut->nSeg--;\n      pStruct->nSegment--;\n    }\n  }else{\n    assert( pSeg->pgnoLast>0 );\n    fts5TrimSegments(p, pIter);\n    pLvl->nMerge = nInput;\n  }\n\n  fts5MultiIterFree(pIter);\n  fts5BufferFree(&term);\n  if( pnRem ) *pnRem -= writer.nLeafWritten;\n}\n\n/*\n** Do up to nPg pages of automerge work on the index.\n**\n** Return true if any changes were actually made, or false otherwise.\n*/\nstatic int fts5IndexMerge(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5Structure **ppStruct,       /* IN/OUT: Current structure of index */\n  int nPg,                        /* Pages of work to do */\n  int nMin                        /* Minimum number of segments to merge */\n){\n  int nRem = nPg;\n  int bRet = 0;\n  Fts5Structure *pStruct = *ppStruct;\n  while( nRem>0 && p->rc==SQLITE_OK ){\n    int iLvl;                   /* To iterate through levels */\n    int iBestLvl = 0;           /* Level offering the most input segments */\n    int nBest = 0;              /* Number of input segments on best level */\n\n    /* Set iBestLvl to the level to read input segments from. */\n    assert( pStruct->nLevel>0 );\n    for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){\n      Fts5StructureLevel *pLvl = &pStruct->aLevel[iLvl];\n      if( pLvl->nMerge ){\n        if( pLvl->nMerge>nBest ){\n          iBestLvl = iLvl;\n          nBest = pLvl->nMerge;\n        }\n        break;\n      }\n      if( pLvl->nSeg>nBest ){\n        nBest = pLvl->nSeg;\n        iBestLvl = iLvl;\n      }\n    }\n\n    /* If nBest is still 0, then the index must be empty. */\n#ifdef SQLITE_DEBUG\n    for(iLvl=0; nBest==0 && iLvl<pStruct->nLevel; iLvl++){\n      assert( pStruct->aLevel[iLvl].nSeg==0 );\n    }\n#endif\n\n    if( nBest<nMin && pStruct->aLevel[iBestLvl].nMerge==0 ){\n      break;\n    }\n    bRet = 1;\n    fts5IndexMergeLevel(p, &pStruct, iBestLvl, &nRem);\n    if( p->rc==SQLITE_OK && pStruct->aLevel[iBestLvl].nMerge==0 ){\n      fts5StructurePromote(p, iBestLvl+1, pStruct);\n    }\n  }\n  *ppStruct = pStruct;\n  return bRet;\n}\n\n/*\n** A total of nLeaf leaf pages of data has just been flushed to a level-0\n** segment. This function updates the write-counter accordingly and, if\n** necessary, performs incremental merge work.\n**\n** If an error occurs, set the Fts5Index.rc error code. If an error has \n** already occurred, this function is a no-op.\n*/\nstatic void fts5IndexAutomerge(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5Structure **ppStruct,       /* IN/OUT: Current structure of index */\n  int nLeaf                       /* Number of output leaves just written */\n){\n  if( p->rc==SQLITE_OK && p->pConfig->nAutomerge>0 ){\n    Fts5Structure *pStruct = *ppStruct;\n    u64 nWrite;                   /* Initial value of write-counter */\n    int nWork;                    /* Number of work-quanta to perform */\n    int nRem;                     /* Number of leaf pages left to write */\n\n    /* Update the write-counter. While doing so, set nWork. */\n    nWrite = pStruct->nWriteCounter;\n    nWork = (int)(((nWrite + nLeaf) / p->nWorkUnit) - (nWrite / p->nWorkUnit));\n    pStruct->nWriteCounter += nLeaf;\n    nRem = (int)(p->nWorkUnit * nWork * pStruct->nLevel);\n\n    fts5IndexMerge(p, ppStruct, nRem, p->pConfig->nAutomerge);\n  }\n}\n\nstatic void fts5IndexCrisismerge(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5Structure **ppStruct        /* IN/OUT: Current structure of index */\n){\n  const int nCrisis = p->pConfig->nCrisisMerge;\n  Fts5Structure *pStruct = *ppStruct;\n  int iLvl = 0;\n\n  assert( p->rc!=SQLITE_OK || pStruct->nLevel>0 );\n  while( p->rc==SQLITE_OK && pStruct->aLevel[iLvl].nSeg>=nCrisis ){\n    fts5IndexMergeLevel(p, &pStruct, iLvl, 0);\n    assert( p->rc!=SQLITE_OK || pStruct->nLevel>(iLvl+1) );\n    fts5StructurePromote(p, iLvl+1, pStruct);\n    iLvl++;\n  }\n  *ppStruct = pStruct;\n}\n\nstatic int fts5IndexReturn(Fts5Index *p){\n  int rc = p->rc;\n  p->rc = SQLITE_OK;\n  return rc;\n}\n\ntypedef struct Fts5FlushCtx Fts5FlushCtx;\nstruct Fts5FlushCtx {\n  Fts5Index *pIdx;\n  Fts5SegWriter writer; \n};\n\n/*\n** Buffer aBuf[] contains a list of varints, all small enough to fit\n** in a 32-bit integer. Return the size of the largest prefix of this \n** list nMax bytes or less in size.\n*/\nstatic int fts5PoslistPrefix(const u8 *aBuf, int nMax){\n  int ret;\n  u32 dummy;\n  ret = fts5GetVarint32(aBuf, dummy);\n  if( ret<nMax ){\n    while( 1 ){\n      int i = fts5GetVarint32(&aBuf[ret], dummy);\n      if( (ret + i) > nMax ) break;\n      ret += i;\n    }\n  }\n  return ret;\n}\n\n/*\n** Flush the contents of in-memory hash table iHash to a new level-0 \n** segment on disk. Also update the corresponding structure record.\n**\n** If an error occurs, set the Fts5Index.rc error code. If an error has \n** already occurred, this function is a no-op.\n*/\nstatic void fts5FlushOneHash(Fts5Index *p){\n  Fts5Hash *pHash = p->pHash;\n  Fts5Structure *pStruct;\n  int iSegid;\n  int pgnoLast = 0;                 /* Last leaf page number in segment */\n\n  /* Obtain a reference to the index structure and allocate a new segment-id\n  ** for the new level-0 segment.  */\n  pStruct = fts5StructureRead(p);\n  iSegid = fts5AllocateSegid(p, pStruct);\n  fts5StructureInvalidate(p);\n\n  if( iSegid ){\n    const int pgsz = p->pConfig->pgsz;\n    int eDetail = p->pConfig->eDetail;\n    Fts5StructureSegment *pSeg;   /* New segment within pStruct */\n    Fts5Buffer *pBuf;             /* Buffer in which to assemble leaf page */\n    Fts5Buffer *pPgidx;           /* Buffer in which to assemble pgidx */\n\n    Fts5SegWriter writer;\n    fts5WriteInit(p, &writer, iSegid);\n\n    pBuf = &writer.writer.buf;\n    pPgidx = &writer.writer.pgidx;\n\n    /* fts5WriteInit() should have initialized the buffers to (most likely)\n    ** the maximum space required. */\n    assert( p->rc || pBuf->nSpace>=(pgsz + FTS5_DATA_PADDING) );\n    assert( p->rc || pPgidx->nSpace>=(pgsz + FTS5_DATA_PADDING) );\n\n    /* Begin scanning through hash table entries. This loop runs once for each\n    ** term/doclist currently stored within the hash table. */\n    if( p->rc==SQLITE_OK ){\n      p->rc = sqlite3Fts5HashScanInit(pHash, 0, 0);\n    }\n    while( p->rc==SQLITE_OK && 0==sqlite3Fts5HashScanEof(pHash) ){\n      const char *zTerm;          /* Buffer containing term */\n      const u8 *pDoclist;         /* Pointer to doclist for this term */\n      int nDoclist;               /* Size of doclist in bytes */\n\n      /* Write the term for this entry to disk. */\n      sqlite3Fts5HashScanEntry(pHash, &zTerm, &pDoclist, &nDoclist);\n      fts5WriteAppendTerm(p, &writer, (int)strlen(zTerm), (const u8*)zTerm);\n\n      assert( writer.bFirstRowidInPage==0 );\n      if( pgsz>=(pBuf->n + pPgidx->n + nDoclist + 1) ){\n        /* The entire doclist will fit on the current leaf. */\n        fts5BufferSafeAppendBlob(pBuf, pDoclist, nDoclist);\n      }else{\n        i64 iRowid = 0;\n        i64 iDelta = 0;\n        int iOff = 0;\n\n        /* The entire doclist will not fit on this leaf. The following \n        ** loop iterates through the poslists that make up the current \n        ** doclist.  */\n        while( p->rc==SQLITE_OK && iOff<nDoclist ){\n          iOff += fts5GetVarint(&pDoclist[iOff], (u64*)&iDelta);\n          iRowid += iDelta;\n          \n          if( writer.bFirstRowidInPage ){\n            fts5PutU16(&pBuf->p[0], (u16)pBuf->n);   /* first rowid on page */\n            pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid);\n            writer.bFirstRowidInPage = 0;\n            fts5WriteDlidxAppend(p, &writer, iRowid);\n          }else{\n            pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta);\n          }\n          assert( pBuf->n<=pBuf->nSpace );\n\n          if( eDetail==FTS5_DETAIL_NONE ){\n            if( iOff<nDoclist && pDoclist[iOff]==0 ){\n              pBuf->p[pBuf->n++] = 0;\n              iOff++;\n              if( iOff<nDoclist && pDoclist[iOff]==0 ){\n                pBuf->p[pBuf->n++] = 0;\n                iOff++;\n              }\n            }\n            if( (pBuf->n + pPgidx->n)>=pgsz ){\n              fts5WriteFlushLeaf(p, &writer);\n            }\n          }else{\n            int bDummy;\n            int nPos;\n            int nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy);\n            nCopy += nPos;\n            if( (pBuf->n + pPgidx->n + nCopy) <= pgsz ){\n              /* The entire poslist will fit on the current leaf. So copy\n              ** it in one go. */\n              fts5BufferSafeAppendBlob(pBuf, &pDoclist[iOff], nCopy);\n            }else{\n              /* The entire poslist will not fit on this leaf. So it needs\n              ** to be broken into sections. The only qualification being\n              ** that each varint must be stored contiguously.  */\n              const u8 *pPoslist = &pDoclist[iOff];\n              int iPos = 0;\n              while( p->rc==SQLITE_OK ){\n                int nSpace = pgsz - pBuf->n - pPgidx->n;\n                int n = 0;\n                if( (nCopy - iPos)<=nSpace ){\n                  n = nCopy - iPos;\n                }else{\n                  n = fts5PoslistPrefix(&pPoslist[iPos], nSpace);\n                }\n                assert( n>0 );\n                fts5BufferSafeAppendBlob(pBuf, &pPoslist[iPos], n);\n                iPos += n;\n                if( (pBuf->n + pPgidx->n)>=pgsz ){\n                  fts5WriteFlushLeaf(p, &writer);\n                }\n                if( iPos>=nCopy ) break;\n              }\n            }\n            iOff += nCopy;\n          }\n        }\n      }\n\n      /* TODO2: Doclist terminator written here. */\n      /* pBuf->p[pBuf->n++] = '\\0'; */\n      assert( pBuf->n<=pBuf->nSpace );\n      sqlite3Fts5HashScanNext(pHash);\n    }\n    sqlite3Fts5HashClear(pHash);\n    fts5WriteFinish(p, &writer, &pgnoLast);\n\n    /* Update the Fts5Structure. It is written back to the database by the\n    ** fts5StructureRelease() call below.  */\n    if( pStruct->nLevel==0 ){\n      fts5StructureAddLevel(&p->rc, &pStruct);\n    }\n    fts5StructureExtendLevel(&p->rc, pStruct, 0, 1, 0);\n    if( p->rc==SQLITE_OK ){\n      pSeg = &pStruct->aLevel[0].aSeg[ pStruct->aLevel[0].nSeg++ ];\n      pSeg->iSegid = iSegid;\n      pSeg->pgnoFirst = 1;\n      pSeg->pgnoLast = pgnoLast;\n      pStruct->nSegment++;\n    }\n    fts5StructurePromote(p, 0, pStruct);\n  }\n\n  fts5IndexAutomerge(p, &pStruct, pgnoLast);\n  fts5IndexCrisismerge(p, &pStruct);\n  fts5StructureWrite(p, pStruct);\n  fts5StructureRelease(pStruct);\n}\n\n/*\n** Flush any data stored in the in-memory hash tables to the database.\n*/\nstatic void fts5IndexFlush(Fts5Index *p){\n  /* Unless it is empty, flush the hash table to disk */\n  if( p->nPendingData ){\n    assert( p->pHash );\n    p->nPendingData = 0;\n    fts5FlushOneHash(p);\n  }\n}\n\nstatic Fts5Structure *fts5IndexOptimizeStruct(\n  Fts5Index *p, \n  Fts5Structure *pStruct\n){\n  Fts5Structure *pNew = 0;\n  int nByte = sizeof(Fts5Structure);\n  int nSeg = pStruct->nSegment;\n  int i;\n\n  /* Figure out if this structure requires optimization. A structure does\n  ** not require optimization if either:\n  **\n  **  + it consists of fewer than two segments, or \n  **  + all segments are on the same level, or\n  **  + all segments except one are currently inputs to a merge operation.\n  **\n  ** In the first case, return NULL. In the second, increment the ref-count\n  ** on *pStruct and return a copy of the pointer to it.\n  */\n  if( nSeg<2 ) return 0;\n  for(i=0; i<pStruct->nLevel; i++){\n    int nThis = pStruct->aLevel[i].nSeg;\n    if( nThis==nSeg || (nThis==nSeg-1 && pStruct->aLevel[i].nMerge==nThis) ){\n      fts5StructureRef(pStruct);\n      return pStruct;\n    }\n    assert( pStruct->aLevel[i].nMerge<=nThis );\n  }\n\n  nByte += (pStruct->nLevel+1) * sizeof(Fts5StructureLevel);\n  pNew = (Fts5Structure*)sqlite3Fts5MallocZero(&p->rc, nByte);\n\n  if( pNew ){\n    Fts5StructureLevel *pLvl;\n    nByte = nSeg * sizeof(Fts5StructureSegment);\n    pNew->nLevel = pStruct->nLevel+1;\n    pNew->nRef = 1;\n    pNew->nWriteCounter = pStruct->nWriteCounter;\n    pLvl = &pNew->aLevel[pStruct->nLevel];\n    pLvl->aSeg = (Fts5StructureSegment*)sqlite3Fts5MallocZero(&p->rc, nByte);\n    if( pLvl->aSeg ){\n      int iLvl, iSeg;\n      int iSegOut = 0;\n      /* Iterate through all segments, from oldest to newest. Add them to\n      ** the new Fts5Level object so that pLvl->aSeg[0] is the oldest\n      ** segment in the data structure.  */\n      for(iLvl=pStruct->nLevel-1; iLvl>=0; iLvl--){\n        for(iSeg=0; iSeg<pStruct->aLevel[iLvl].nSeg; iSeg++){\n          pLvl->aSeg[iSegOut] = pStruct->aLevel[iLvl].aSeg[iSeg];\n          iSegOut++;\n        }\n      }\n      pNew->nSegment = pLvl->nSeg = nSeg;\n    }else{\n      sqlite3_free(pNew);\n      pNew = 0;\n    }\n  }\n\n  return pNew;\n}\n\nstatic int sqlite3Fts5IndexOptimize(Fts5Index *p){\n  Fts5Structure *pStruct;\n  Fts5Structure *pNew = 0;\n\n  assert( p->rc==SQLITE_OK );\n  fts5IndexFlush(p);\n  pStruct = fts5StructureRead(p);\n  fts5StructureInvalidate(p);\n\n  if( pStruct ){\n    pNew = fts5IndexOptimizeStruct(p, pStruct);\n  }\n  fts5StructureRelease(pStruct);\n\n  assert( pNew==0 || pNew->nSegment>0 );\n  if( pNew ){\n    int iLvl;\n    for(iLvl=0; pNew->aLevel[iLvl].nSeg==0; iLvl++){}\n    while( p->rc==SQLITE_OK && pNew->aLevel[iLvl].nSeg>0 ){\n      int nRem = FTS5_OPT_WORK_UNIT;\n      fts5IndexMergeLevel(p, &pNew, iLvl, &nRem);\n    }\n\n    fts5StructureWrite(p, pNew);\n    fts5StructureRelease(pNew);\n  }\n\n  return fts5IndexReturn(p); \n}\n\n/*\n** This is called to implement the special \"VALUES('merge', $nMerge)\"\n** INSERT command.\n*/\nstatic int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge){\n  Fts5Structure *pStruct = fts5StructureRead(p);\n  if( pStruct ){\n    int nMin = p->pConfig->nUsermerge;\n    fts5StructureInvalidate(p);\n    if( nMerge<0 ){\n      Fts5Structure *pNew = fts5IndexOptimizeStruct(p, pStruct);\n      fts5StructureRelease(pStruct);\n      pStruct = pNew;\n      nMin = 2;\n      nMerge = nMerge*-1;\n    }\n    if( pStruct && pStruct->nLevel ){\n      if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){\n        fts5StructureWrite(p, pStruct);\n      }\n    }\n    fts5StructureRelease(pStruct);\n  }\n  return fts5IndexReturn(p);\n}\n\nstatic void fts5AppendRowid(\n  Fts5Index *p,\n  i64 iDelta,\n  Fts5Iter *pUnused,\n  Fts5Buffer *pBuf\n){\n  UNUSED_PARAM(pUnused);\n  fts5BufferAppendVarint(&p->rc, pBuf, iDelta);\n}\n\nstatic void fts5AppendPoslist(\n  Fts5Index *p,\n  i64 iDelta,\n  Fts5Iter *pMulti,\n  Fts5Buffer *pBuf\n){\n  int nData = pMulti->base.nData;\n  assert( nData>0 );\n  if( p->rc==SQLITE_OK && 0==fts5BufferGrow(&p->rc, pBuf, nData+9+9) ){\n    fts5BufferSafeAppendVarint(pBuf, iDelta);\n    fts5BufferSafeAppendVarint(pBuf, nData*2);\n    fts5BufferSafeAppendBlob(pBuf, pMulti->base.pData, nData);\n  }\n}\n\n\nstatic void fts5DoclistIterNext(Fts5DoclistIter *pIter){\n  u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;\n\n  assert( pIter->aPoslist );\n  if( p>=pIter->aEof ){\n    pIter->aPoslist = 0;\n  }else{\n    i64 iDelta;\n\n    p += fts5GetVarint(p, (u64*)&iDelta);\n    pIter->iRowid += iDelta;\n\n    /* Read position list size */\n    if( p[0] & 0x80 ){\n      int nPos;\n      pIter->nSize = fts5GetVarint32(p, nPos);\n      pIter->nPoslist = (nPos>>1);\n    }else{\n      pIter->nPoslist = ((int)(p[0])) >> 1;\n      pIter->nSize = 1;\n    }\n\n    pIter->aPoslist = p;\n  }\n}\n\nstatic void fts5DoclistIterInit(\n  Fts5Buffer *pBuf, \n  Fts5DoclistIter *pIter\n){\n  memset(pIter, 0, sizeof(*pIter));\n  pIter->aPoslist = pBuf->p;\n  pIter->aEof = &pBuf->p[pBuf->n];\n  fts5DoclistIterNext(pIter);\n}\n\n#if 0\n/*\n** Append a doclist to buffer pBuf.\n**\n** This function assumes that space within the buffer has already been\n** allocated.\n*/\nstatic void fts5MergeAppendDocid(\n  Fts5Buffer *pBuf,               /* Buffer to write to */\n  i64 *piLastRowid,               /* IN/OUT: Previous rowid written (if any) */\n  i64 iRowid                      /* Rowid to append */\n){\n  assert( pBuf->n!=0 || (*piLastRowid)==0 );\n  fts5BufferSafeAppendVarint(pBuf, iRowid - *piLastRowid);\n  *piLastRowid = iRowid;\n}\n#endif\n\n#define fts5MergeAppendDocid(pBuf, iLastRowid, iRowid) {       \\\n  assert( (pBuf)->n!=0 || (iLastRowid)==0 );                   \\\n  fts5BufferSafeAppendVarint((pBuf), (iRowid) - (iLastRowid)); \\\n  (iLastRowid) = (iRowid);                                     \\\n}\n\n/*\n** Swap the contents of buffer *p1 with that of *p2.\n*/\nstatic void fts5BufferSwap(Fts5Buffer *p1, Fts5Buffer *p2){\n  Fts5Buffer tmp = *p1;\n  *p1 = *p2;\n  *p2 = tmp;\n}\n\nstatic void fts5NextRowid(Fts5Buffer *pBuf, int *piOff, i64 *piRowid){\n  int i = *piOff;\n  if( i>=pBuf->n ){\n    *piOff = -1;\n  }else{\n    u64 iVal;\n    *piOff = i + sqlite3Fts5GetVarint(&pBuf->p[i], &iVal);\n    *piRowid += iVal;\n  }\n}\n\n/*\n** This is the equivalent of fts5MergePrefixLists() for detail=none mode.\n** In this case the buffers consist of a delta-encoded list of rowids only.\n*/\nstatic void fts5MergeRowidLists(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5Buffer *p1,                 /* First list to merge */\n  Fts5Buffer *p2                  /* Second list to merge */\n){\n  int i1 = 0;\n  int i2 = 0;\n  i64 iRowid1 = 0;\n  i64 iRowid2 = 0;\n  i64 iOut = 0;\n\n  Fts5Buffer out;\n  memset(&out, 0, sizeof(out));\n  sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);\n  if( p->rc ) return;\n\n  fts5NextRowid(p1, &i1, &iRowid1);\n  fts5NextRowid(p2, &i2, &iRowid2);\n  while( i1>=0 || i2>=0 ){\n    if( i1>=0 && (i2<0 || iRowid1<iRowid2) ){\n      assert( iOut==0 || iRowid1>iOut );\n      fts5BufferSafeAppendVarint(&out, iRowid1 - iOut);\n      iOut = iRowid1;\n      fts5NextRowid(p1, &i1, &iRowid1);\n    }else{\n      assert( iOut==0 || iRowid2>iOut );\n      fts5BufferSafeAppendVarint(&out, iRowid2 - iOut);\n      iOut = iRowid2;\n      if( i1>=0 && iRowid1==iRowid2 ){\n        fts5NextRowid(p1, &i1, &iRowid1);\n      }\n      fts5NextRowid(p2, &i2, &iRowid2);\n    }\n  }\n\n  fts5BufferSwap(&out, p1);\n  fts5BufferFree(&out);\n}\n\n/*\n** Buffers p1 and p2 contain doclists. This function merges the content\n** of the two doclists together and sets buffer p1 to the result before\n** returning.\n**\n** If an error occurs, an error code is left in p->rc. If an error has\n** already occurred, this function is a no-op.\n*/\nstatic void fts5MergePrefixLists(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5Buffer *p1,                 /* First list to merge */\n  Fts5Buffer *p2                  /* Second list to merge */\n){\n  if( p2->n ){\n    i64 iLastRowid = 0;\n    Fts5DoclistIter i1;\n    Fts5DoclistIter i2;\n    Fts5Buffer out = {0, 0, 0};\n    Fts5Buffer tmp = {0, 0, 0};\n\n    if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n) ) return;\n    fts5DoclistIterInit(p1, &i1);\n    fts5DoclistIterInit(p2, &i2);\n\n    while( 1 ){\n      if( i1.iRowid<i2.iRowid ){\n        /* Copy entry from i1 */\n        fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);\n        fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.nPoslist+i1.nSize);\n        fts5DoclistIterNext(&i1);\n        if( i1.aPoslist==0 ) break;\n      }\n      else if( i2.iRowid!=i1.iRowid ){\n        /* Copy entry from i2 */\n        fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);\n        fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.nPoslist+i2.nSize);\n        fts5DoclistIterNext(&i2);\n        if( i2.aPoslist==0 ) break;\n      }\n      else{\n        /* Merge the two position lists. */ \n        i64 iPos1 = 0;\n        i64 iPos2 = 0;\n        int iOff1 = 0;\n        int iOff2 = 0;\n        u8 *a1 = &i1.aPoslist[i1.nSize];\n        u8 *a2 = &i2.aPoslist[i2.nSize];\n\n        i64 iPrev = 0;\n        Fts5PoslistWriter writer;\n        memset(&writer, 0, sizeof(writer));\n\n        fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);\n        fts5BufferZero(&tmp);\n        sqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist);\n        if( p->rc ) break;\n\n        sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);\n        sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);\n        assert( iPos1>=0 && iPos2>=0 );\n\n        if( iPos1<iPos2 ){\n          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);\n          sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);\n        }else{\n          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);\n          sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);\n        }\n\n        if( iPos1>=0 && iPos2>=0 ){\n          while( 1 ){\n            if( iPos1<iPos2 ){\n              if( iPos1!=iPrev ){\n                sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);\n              }\n              sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1);\n              if( iPos1<0 ) break;\n            }else{\n              assert( iPos2!=iPrev );\n              sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);\n              sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2);\n              if( iPos2<0 ) break;\n            }\n          }\n        }\n\n        if( iPos1>=0 ){\n          if( iPos1!=iPrev ){\n            sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1);\n          }\n          fts5BufferSafeAppendBlob(&tmp, &a1[iOff1], i1.nPoslist-iOff1);\n        }else{\n          assert( iPos2>=0 && iPos2!=iPrev );\n          sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos2);\n          fts5BufferSafeAppendBlob(&tmp, &a2[iOff2], i2.nPoslist-iOff2);\n        }\n\n        /* WRITEPOSLISTSIZE */\n        fts5BufferSafeAppendVarint(&out, tmp.n * 2);\n        fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);\n        fts5DoclistIterNext(&i1);\n        fts5DoclistIterNext(&i2);\n        if( i1.aPoslist==0 || i2.aPoslist==0 ) break;\n      }\n    }\n\n    if( i1.aPoslist ){\n      fts5MergeAppendDocid(&out, iLastRowid, i1.iRowid);\n      fts5BufferSafeAppendBlob(&out, i1.aPoslist, i1.aEof - i1.aPoslist);\n    }\n    else if( i2.aPoslist ){\n      fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid);\n      fts5BufferSafeAppendBlob(&out, i2.aPoslist, i2.aEof - i2.aPoslist);\n    }\n\n    fts5BufferSet(&p->rc, p1, out.n, out.p);\n    fts5BufferFree(&tmp);\n    fts5BufferFree(&out);\n  }\n}\n\nstatic void fts5SetupPrefixIter(\n  Fts5Index *p,                   /* Index to read from */\n  int bDesc,                      /* True for \"ORDER BY rowid DESC\" */\n  const u8 *pToken,               /* Buffer containing prefix to match */\n  int nToken,                     /* Size of buffer pToken in bytes */\n  Fts5Colset *pColset,            /* Restrict matches to these columns */\n  Fts5Iter **ppIter          /* OUT: New iterator */\n){\n  Fts5Structure *pStruct;\n  Fts5Buffer *aBuf;\n  const int nBuf = 32;\n\n  void (*xMerge)(Fts5Index*, Fts5Buffer*, Fts5Buffer*);\n  void (*xAppend)(Fts5Index*, i64, Fts5Iter*, Fts5Buffer*);\n  if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){\n    xMerge = fts5MergeRowidLists;\n    xAppend = fts5AppendRowid;\n  }else{\n    xMerge = fts5MergePrefixLists;\n    xAppend = fts5AppendPoslist;\n  }\n\n  aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);\n  pStruct = fts5StructureRead(p);\n\n  if( aBuf && pStruct ){\n    const int flags = FTS5INDEX_QUERY_SCAN \n                    | FTS5INDEX_QUERY_SKIPEMPTY \n                    | FTS5INDEX_QUERY_NOOUTPUT;\n    int i;\n    i64 iLastRowid = 0;\n    Fts5Iter *p1 = 0;     /* Iterator used to gather data from index */\n    Fts5Data *pData;\n    Fts5Buffer doclist;\n    int bNewTerm = 1;\n\n    memset(&doclist, 0, sizeof(doclist));\n    fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);\n    fts5IterSetOutputCb(&p->rc, p1);\n    for( /* no-op */ ;\n        fts5MultiIterEof(p, p1)==0;\n        fts5MultiIterNext2(p, p1, &bNewTerm)\n    ){\n      Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];\n      int nTerm = pSeg->term.n;\n      const u8 *pTerm = pSeg->term.p;\n      p1->xSetOutputs(p1, pSeg);\n\n      assert_nc( memcmp(pToken, pTerm, MIN(nToken, nTerm))<=0 );\n      if( bNewTerm ){\n        if( nTerm<nToken || memcmp(pToken, pTerm, nToken) ) break;\n      }\n\n      if( p1->base.nData==0 ) continue;\n\n      if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){\n        for(i=0; p->rc==SQLITE_OK && doclist.n; i++){\n          assert( i<nBuf );\n          if( aBuf[i].n==0 ){\n            fts5BufferSwap(&doclist, &aBuf[i]);\n            fts5BufferZero(&doclist);\n          }else{\n            xMerge(p, &doclist, &aBuf[i]);\n            fts5BufferZero(&aBuf[i]);\n          }\n        }\n        iLastRowid = 0;\n      }\n\n      xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);\n      iLastRowid = p1->base.iRowid;\n    }\n\n    for(i=0; i<nBuf; i++){\n      if( p->rc==SQLITE_OK ){\n        xMerge(p, &doclist, &aBuf[i]);\n      }\n      fts5BufferFree(&aBuf[i]);\n    }\n    fts5MultiIterFree(p1);\n\n    pData = fts5IdxMalloc(p, sizeof(Fts5Data) + doclist.n);\n    if( pData ){\n      pData->p = (u8*)&pData[1];\n      pData->nn = pData->szLeaf = doclist.n;\n      memcpy(pData->p, doclist.p, doclist.n);\n      fts5MultiIterNew2(p, pData, bDesc, ppIter);\n    }\n    fts5BufferFree(&doclist);\n  }\n\n  fts5StructureRelease(pStruct);\n  sqlite3_free(aBuf);\n}\n\n\n/*\n** Indicate that all subsequent calls to sqlite3Fts5IndexWrite() pertain\n** to the document with rowid iRowid.\n*/\nstatic int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){\n  assert( p->rc==SQLITE_OK );\n\n  /* Allocate the hash table if it has not already been allocated */\n  if( p->pHash==0 ){\n    p->rc = sqlite3Fts5HashNew(p->pConfig, &p->pHash, &p->nPendingData);\n  }\n\n  /* Flush the hash table to disk if required */\n  if( iRowid<p->iWriteRowid \n   || (iRowid==p->iWriteRowid && p->bDelete==0)\n   || (p->nPendingData > p->pConfig->nHashSize) \n  ){\n    fts5IndexFlush(p);\n  }\n\n  p->iWriteRowid = iRowid;\n  p->bDelete = bDelete;\n  return fts5IndexReturn(p);\n}\n\n/*\n** Commit data to disk.\n*/\nstatic int sqlite3Fts5IndexSync(Fts5Index *p, int bCommit){\n  assert( p->rc==SQLITE_OK );\n  fts5IndexFlush(p);\n  if( bCommit ) fts5CloseReader(p);\n  return fts5IndexReturn(p);\n}\n\n/*\n** Discard any data stored in the in-memory hash tables. Do not write it\n** to the database. Additionally, assume that the contents of the %_data\n** table may have changed on disk. So any in-memory caches of %_data \n** records must be invalidated.\n*/\nstatic int sqlite3Fts5IndexRollback(Fts5Index *p){\n  fts5CloseReader(p);\n  fts5IndexDiscardData(p);\n  fts5StructureInvalidate(p);\n  /* assert( p->rc==SQLITE_OK ); */\n  return SQLITE_OK;\n}\n\n/*\n** The %_data table is completely empty when this function is called. This\n** function populates it with the initial structure objects for each index,\n** and the initial version of the \"averages\" record (a zero-byte blob).\n*/\nstatic int sqlite3Fts5IndexReinit(Fts5Index *p){\n  Fts5Structure s;\n  fts5StructureInvalidate(p);\n  memset(&s, 0, sizeof(Fts5Structure));\n  fts5DataWrite(p, FTS5_AVERAGES_ROWID, (const u8*)\"\", 0);\n  fts5StructureWrite(p, &s);\n  return fts5IndexReturn(p);\n}\n\n/*\n** Open a new Fts5Index handle. If the bCreate argument is true, create\n** and initialize the underlying %_data table.\n**\n** If successful, set *pp to point to the new object and return SQLITE_OK.\n** Otherwise, set *pp to NULL and return an SQLite error code.\n*/\nstatic int sqlite3Fts5IndexOpen(\n  Fts5Config *pConfig, \n  int bCreate, \n  Fts5Index **pp,\n  char **pzErr\n){\n  int rc = SQLITE_OK;\n  Fts5Index *p;                   /* New object */\n\n  *pp = p = (Fts5Index*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Index));\n  if( rc==SQLITE_OK ){\n    p->pConfig = pConfig;\n    p->nWorkUnit = FTS5_WORK_UNIT;\n    p->zDataTbl = sqlite3Fts5Mprintf(&rc, \"%s_data\", pConfig->zName);\n    if( p->zDataTbl && bCreate ){\n      rc = sqlite3Fts5CreateTable(\n          pConfig, \"data\", \"id INTEGER PRIMARY KEY, block BLOB\", 0, pzErr\n      );\n      if( rc==SQLITE_OK ){\n        rc = sqlite3Fts5CreateTable(pConfig, \"idx\", \n            \"segid, term, pgno, PRIMARY KEY(segid, term)\", \n            1, pzErr\n        );\n      }\n      if( rc==SQLITE_OK ){\n        rc = sqlite3Fts5IndexReinit(p);\n      }\n    }\n  }\n\n  assert( rc!=SQLITE_OK || p->rc==SQLITE_OK );\n  if( rc ){\n    sqlite3Fts5IndexClose(p);\n    *pp = 0;\n  }\n  return rc;\n}\n\n/*\n** Close a handle opened by an earlier call to sqlite3Fts5IndexOpen().\n*/\nstatic int sqlite3Fts5IndexClose(Fts5Index *p){\n  int rc = SQLITE_OK;\n  if( p ){\n    assert( p->pReader==0 );\n    fts5StructureInvalidate(p);\n    sqlite3_finalize(p->pWriter);\n    sqlite3_finalize(p->pDeleter);\n    sqlite3_finalize(p->pIdxWriter);\n    sqlite3_finalize(p->pIdxDeleter);\n    sqlite3_finalize(p->pIdxSelect);\n    sqlite3_finalize(p->pDataVersion);\n    sqlite3Fts5HashFree(p->pHash);\n    sqlite3_free(p->zDataTbl);\n    sqlite3_free(p);\n  }\n  return rc;\n}\n\n/*\n** Argument p points to a buffer containing utf-8 text that is n bytes in \n** size. Return the number of bytes in the nChar character prefix of the\n** buffer, or 0 if there are less than nChar characters in total.\n*/\nstatic int sqlite3Fts5IndexCharlenToBytelen(\n  const char *p, \n  int nByte, \n  int nChar\n){\n  int n = 0;\n  int i;\n  for(i=0; i<nChar; i++){\n    if( n>=nByte ) return 0;      /* Input contains fewer than nChar chars */\n    if( (unsigned char)p[n++]>=0xc0 ){\n      while( (p[n] & 0xc0)==0x80 ) n++;\n    }\n  }\n  return n;\n}\n\n/*\n** pIn is a UTF-8 encoded string, nIn bytes in size. Return the number of\n** unicode characters in the string.\n*/\nstatic int fts5IndexCharlen(const char *pIn, int nIn){\n  int nChar = 0;            \n  int i = 0;\n  while( i<nIn ){\n    if( (unsigned char)pIn[i++]>=0xc0 ){\n      while( i<nIn && (pIn[i] & 0xc0)==0x80 ) i++;\n    }\n    nChar++;\n  }\n  return nChar;\n}\n\n/*\n** Insert or remove data to or from the index. Each time a document is \n** added to or removed from the index, this function is called one or more\n** times.\n**\n** For an insert, it must be called once for each token in the new document.\n** If the operation is a delete, it must be called (at least) once for each\n** unique token in the document with an iCol value less than zero. The iPos\n** argument is ignored for a delete.\n*/\nstatic int sqlite3Fts5IndexWrite(\n  Fts5Index *p,                   /* Index to write to */\n  int iCol,                       /* Column token appears in (-ve -> delete) */\n  int iPos,                       /* Position of token within column */\n  const char *pToken, int nToken  /* Token to add or remove to or from index */\n){\n  int i;                          /* Used to iterate through indexes */\n  int rc = SQLITE_OK;             /* Return code */\n  Fts5Config *pConfig = p->pConfig;\n\n  assert( p->rc==SQLITE_OK );\n  assert( (iCol<0)==p->bDelete );\n\n  /* Add the entry to the main terms index. */\n  rc = sqlite3Fts5HashWrite(\n      p->pHash, p->iWriteRowid, iCol, iPos, FTS5_MAIN_PREFIX, pToken, nToken\n  );\n\n  for(i=0; i<pConfig->nPrefix && rc==SQLITE_OK; i++){\n    const int nChar = pConfig->aPrefix[i];\n    int nByte = sqlite3Fts5IndexCharlenToBytelen(pToken, nToken, nChar);\n    if( nByte ){\n      rc = sqlite3Fts5HashWrite(p->pHash, \n          p->iWriteRowid, iCol, iPos, (char)(FTS5_MAIN_PREFIX+i+1), pToken,\n          nByte\n      );\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Open a new iterator to iterate though all rowid that match the \n** specified token or token prefix.\n*/\nstatic int sqlite3Fts5IndexQuery(\n  Fts5Index *p,                   /* FTS index to query */\n  const char *pToken, int nToken, /* Token (or prefix) to query for */\n  int flags,                      /* Mask of FTS5INDEX_QUERY_X flags */\n  Fts5Colset *pColset,            /* Match these columns only */\n  Fts5IndexIter **ppIter          /* OUT: New iterator object */\n){\n  Fts5Config *pConfig = p->pConfig;\n  Fts5Iter *pRet = 0;\n  Fts5Buffer buf = {0, 0, 0};\n\n  /* If the QUERY_SCAN flag is set, all other flags must be clear. */\n  assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );\n\n  if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){\n    int iIdx = 0;                 /* Index to search */\n    memcpy(&buf.p[1], pToken, nToken);\n\n    /* Figure out which index to search and set iIdx accordingly. If this\n    ** is a prefix query for which there is no prefix index, set iIdx to\n    ** greater than pConfig->nPrefix to indicate that the query will be\n    ** satisfied by scanning multiple terms in the main index.\n    **\n    ** If the QUERY_TEST_NOIDX flag was specified, then this must be a\n    ** prefix-query. Instead of using a prefix-index (if one exists), \n    ** evaluate the prefix query using the main FTS index. This is used\n    ** for internal sanity checking by the integrity-check in debug \n    ** mode only.  */\n#ifdef SQLITE_DEBUG\n    if( pConfig->bPrefixIndex==0 || (flags & FTS5INDEX_QUERY_TEST_NOIDX) ){\n      assert( flags & FTS5INDEX_QUERY_PREFIX );\n      iIdx = 1+pConfig->nPrefix;\n    }else\n#endif\n    if( flags & FTS5INDEX_QUERY_PREFIX ){\n      int nChar = fts5IndexCharlen(pToken, nToken);\n      for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){\n        if( pConfig->aPrefix[iIdx-1]==nChar ) break;\n      }\n    }\n\n    if( iIdx<=pConfig->nPrefix ){\n      /* Straight index lookup */\n      Fts5Structure *pStruct = fts5StructureRead(p);\n      buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx);\n      if( pStruct ){\n        fts5MultiIterNew(p, pStruct, flags | FTS5INDEX_QUERY_SKIPEMPTY, \n            pColset, buf.p, nToken+1, -1, 0, &pRet\n        );\n        fts5StructureRelease(pStruct);\n      }\n    }else{\n      /* Scan multiple terms in the main index */\n      int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;\n      buf.p[0] = FTS5_MAIN_PREFIX;\n      fts5SetupPrefixIter(p, bDesc, buf.p, nToken+1, pColset, &pRet);\n      assert( p->rc!=SQLITE_OK || pRet->pColset==0 );\n      fts5IterSetOutputCb(&p->rc, pRet);\n      if( p->rc==SQLITE_OK ){\n        Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];\n        if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);\n      }\n    }\n\n    if( p->rc ){\n      sqlite3Fts5IterClose(&pRet->base);\n      pRet = 0;\n      fts5CloseReader(p);\n    }\n\n    *ppIter = &pRet->base;\n    sqlite3Fts5BufferFree(&buf);\n  }\n  return fts5IndexReturn(p);\n}\n\n/*\n** Return true if the iterator passed as the only argument is at EOF.\n*/\n/*\n** Move to the next matching rowid. \n*/\nstatic int sqlite3Fts5IterNext(Fts5IndexIter *pIndexIter){\n  Fts5Iter *pIter = (Fts5Iter*)pIndexIter;\n  assert( pIter->pIndex->rc==SQLITE_OK );\n  fts5MultiIterNext(pIter->pIndex, pIter, 0, 0);\n  return fts5IndexReturn(pIter->pIndex);\n}\n\n/*\n** Move to the next matching term/rowid. Used by the fts5vocab module.\n*/\nstatic int sqlite3Fts5IterNextScan(Fts5IndexIter *pIndexIter){\n  Fts5Iter *pIter = (Fts5Iter*)pIndexIter;\n  Fts5Index *p = pIter->pIndex;\n\n  assert( pIter->pIndex->rc==SQLITE_OK );\n\n  fts5MultiIterNext(p, pIter, 0, 0);\n  if( p->rc==SQLITE_OK ){\n    Fts5SegIter *pSeg = &pIter->aSeg[ pIter->aFirst[1].iFirst ];\n    if( pSeg->pLeaf && pSeg->term.p[0]!=FTS5_MAIN_PREFIX ){\n      fts5DataRelease(pSeg->pLeaf);\n      pSeg->pLeaf = 0;\n      pIter->base.bEof = 1;\n    }\n  }\n\n  return fts5IndexReturn(pIter->pIndex);\n}\n\n/*\n** Move to the next matching rowid that occurs at or after iMatch. The\n** definition of \"at or after\" depends on whether this iterator iterates\n** in ascending or descending rowid order.\n*/\nstatic int sqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){\n  Fts5Iter *pIter = (Fts5Iter*)pIndexIter;\n  fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch);\n  return fts5IndexReturn(pIter->pIndex);\n}\n\n/*\n** Return the current term.\n*/\nstatic const char *sqlite3Fts5IterTerm(Fts5IndexIter *pIndexIter, int *pn){\n  int n;\n  const char *z = (const char*)fts5MultiIterTerm((Fts5Iter*)pIndexIter, &n);\n  *pn = n-1;\n  return &z[1];\n}\n\n/*\n** Close an iterator opened by an earlier call to sqlite3Fts5IndexQuery().\n*/\nstatic void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){\n  if( pIndexIter ){\n    Fts5Iter *pIter = (Fts5Iter*)pIndexIter;\n    Fts5Index *pIndex = pIter->pIndex;\n    fts5MultiIterFree(pIter);\n    fts5CloseReader(pIndex);\n  }\n}\n\n/*\n** Read and decode the \"averages\" record from the database. \n**\n** Parameter anSize must point to an array of size nCol, where nCol is\n** the number of user defined columns in the FTS table.\n*/\nstatic int sqlite3Fts5IndexGetAverages(Fts5Index *p, i64 *pnRow, i64 *anSize){\n  int nCol = p->pConfig->nCol;\n  Fts5Data *pData;\n\n  *pnRow = 0;\n  memset(anSize, 0, sizeof(i64) * nCol);\n  pData = fts5DataRead(p, FTS5_AVERAGES_ROWID);\n  if( p->rc==SQLITE_OK && pData->nn ){\n    int i = 0;\n    int iCol;\n    i += fts5GetVarint(&pData->p[i], (u64*)pnRow);\n    for(iCol=0; i<pData->nn && iCol<nCol; iCol++){\n      i += fts5GetVarint(&pData->p[i], (u64*)&anSize[iCol]);\n    }\n  }\n\n  fts5DataRelease(pData);\n  return fts5IndexReturn(p);\n}\n\n/*\n** Replace the current \"averages\" record with the contents of the buffer \n** supplied as the second argument.\n*/\nstatic int sqlite3Fts5IndexSetAverages(Fts5Index *p, const u8 *pData, int nData){\n  assert( p->rc==SQLITE_OK );\n  fts5DataWrite(p, FTS5_AVERAGES_ROWID, pData, nData);\n  return fts5IndexReturn(p);\n}\n\n/*\n** Return the total number of blocks this module has read from the %_data\n** table since it was created.\n*/\nstatic int sqlite3Fts5IndexReads(Fts5Index *p){\n  return p->nRead;\n}\n\n/*\n** Set the 32-bit cookie value stored at the start of all structure \n** records to the value passed as the second argument.\n**\n** Return SQLITE_OK if successful, or an SQLite error code if an error\n** occurs.\n*/\nstatic int sqlite3Fts5IndexSetCookie(Fts5Index *p, int iNew){\n  int rc;                              /* Return code */\n  Fts5Config *pConfig = p->pConfig;    /* Configuration object */\n  u8 aCookie[4];                       /* Binary representation of iNew */\n  sqlite3_blob *pBlob = 0;\n\n  assert( p->rc==SQLITE_OK );\n  sqlite3Fts5Put32(aCookie, iNew);\n\n  rc = sqlite3_blob_open(pConfig->db, pConfig->zDb, p->zDataTbl, \n      \"block\", FTS5_STRUCTURE_ROWID, 1, &pBlob\n  );\n  if( rc==SQLITE_OK ){\n    sqlite3_blob_write(pBlob, aCookie, 4, 0);\n    rc = sqlite3_blob_close(pBlob);\n  }\n\n  return rc;\n}\n\nstatic int sqlite3Fts5IndexLoadConfig(Fts5Index *p){\n  Fts5Structure *pStruct;\n  pStruct = fts5StructureRead(p);\n  fts5StructureRelease(pStruct);\n  return fts5IndexReturn(p);\n}\n\n\n/*************************************************************************\n**************************************************************************\n** Below this point is the implementation of the integrity-check \n** functionality.\n*/\n\n/*\n** Return a simple checksum value based on the arguments.\n*/\nstatic u64 sqlite3Fts5IndexEntryCksum(\n  i64 iRowid, \n  int iCol, \n  int iPos, \n  int iIdx,\n  const char *pTerm,\n  int nTerm\n){\n  int i;\n  u64 ret = iRowid;\n  ret += (ret<<3) + iCol;\n  ret += (ret<<3) + iPos;\n  if( iIdx>=0 ) ret += (ret<<3) + (FTS5_MAIN_PREFIX + iIdx);\n  for(i=0; i<nTerm; i++) ret += (ret<<3) + pTerm[i];\n  return ret;\n}\n\n#ifdef SQLITE_DEBUG\n/*\n** This function is purely an internal test. It does not contribute to \n** FTS functionality, or even the integrity-check, in any way.\n**\n** Instead, it tests that the same set of pgno/rowid combinations are \n** visited regardless of whether the doclist-index identified by parameters\n** iSegid/iLeaf is iterated in forwards or reverse order.\n*/\nstatic void fts5TestDlidxReverse(\n  Fts5Index *p, \n  int iSegid,                     /* Segment id to load from */\n  int iLeaf                       /* Load doclist-index for this leaf */\n){\n  Fts5DlidxIter *pDlidx = 0;\n  u64 cksum1 = 13;\n  u64 cksum2 = 13;\n\n  for(pDlidx=fts5DlidxIterInit(p, 0, iSegid, iLeaf);\n      fts5DlidxIterEof(p, pDlidx)==0;\n      fts5DlidxIterNext(p, pDlidx)\n  ){\n    i64 iRowid = fts5DlidxIterRowid(pDlidx);\n    int pgno = fts5DlidxIterPgno(pDlidx);\n    assert( pgno>iLeaf );\n    cksum1 += iRowid + ((i64)pgno<<32);\n  }\n  fts5DlidxIterFree(pDlidx);\n  pDlidx = 0;\n\n  for(pDlidx=fts5DlidxIterInit(p, 1, iSegid, iLeaf);\n      fts5DlidxIterEof(p, pDlidx)==0;\n      fts5DlidxIterPrev(p, pDlidx)\n  ){\n    i64 iRowid = fts5DlidxIterRowid(pDlidx);\n    int pgno = fts5DlidxIterPgno(pDlidx);\n    assert( fts5DlidxIterPgno(pDlidx)>iLeaf );\n    cksum2 += iRowid + ((i64)pgno<<32);\n  }\n  fts5DlidxIterFree(pDlidx);\n  pDlidx = 0;\n\n  if( p->rc==SQLITE_OK && cksum1!=cksum2 ) p->rc = FTS5_CORRUPT;\n}\n\nstatic int fts5QueryCksum(\n  Fts5Index *p,                   /* Fts5 index object */\n  int iIdx,\n  const char *z,                  /* Index key to query for */\n  int n,                          /* Size of index key in bytes */\n  int flags,                      /* Flags for Fts5IndexQuery */\n  u64 *pCksum                     /* IN/OUT: Checksum value */\n){\n  int eDetail = p->pConfig->eDetail;\n  u64 cksum = *pCksum;\n  Fts5IndexIter *pIter = 0;\n  int rc = sqlite3Fts5IndexQuery(p, z, n, flags, 0, &pIter);\n\n  while( rc==SQLITE_OK && 0==sqlite3Fts5IterEof(pIter) ){\n    i64 rowid = pIter->iRowid;\n\n    if( eDetail==FTS5_DETAIL_NONE ){\n      cksum ^= sqlite3Fts5IndexEntryCksum(rowid, 0, 0, iIdx, z, n);\n    }else{\n      Fts5PoslistReader sReader;\n      for(sqlite3Fts5PoslistReaderInit(pIter->pData, pIter->nData, &sReader);\n          sReader.bEof==0;\n          sqlite3Fts5PoslistReaderNext(&sReader)\n      ){\n        int iCol = FTS5_POS2COLUMN(sReader.iPos);\n        int iOff = FTS5_POS2OFFSET(sReader.iPos);\n        cksum ^= sqlite3Fts5IndexEntryCksum(rowid, iCol, iOff, iIdx, z, n);\n      }\n    }\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts5IterNext(pIter);\n    }\n  }\n  sqlite3Fts5IterClose(pIter);\n\n  *pCksum = cksum;\n  return rc;\n}\n\n\n/*\n** This function is also purely an internal test. It does not contribute to \n** FTS functionality, or even the integrity-check, in any way.\n*/\nstatic void fts5TestTerm(\n  Fts5Index *p, \n  Fts5Buffer *pPrev,              /* Previous term */\n  const char *z, int n,           /* Possibly new term to test */\n  u64 expected,\n  u64 *pCksum\n){\n  int rc = p->rc;\n  if( pPrev->n==0 ){\n    fts5BufferSet(&rc, pPrev, n, (const u8*)z);\n  }else\n  if( rc==SQLITE_OK && (pPrev->n!=n || memcmp(pPrev->p, z, n)) ){\n    u64 cksum3 = *pCksum;\n    const char *zTerm = (const char*)&pPrev->p[1];  /* term sans prefix-byte */\n    int nTerm = pPrev->n-1;            /* Size of zTerm in bytes */\n    int iIdx = (pPrev->p[0] - FTS5_MAIN_PREFIX);\n    int flags = (iIdx==0 ? 0 : FTS5INDEX_QUERY_PREFIX);\n    u64 ck1 = 0;\n    u64 ck2 = 0;\n\n    /* Check that the results returned for ASC and DESC queries are\n    ** the same. If not, call this corruption.  */\n    rc = fts5QueryCksum(p, iIdx, zTerm, nTerm, flags, &ck1);\n    if( rc==SQLITE_OK ){\n      int f = flags|FTS5INDEX_QUERY_DESC;\n      rc = fts5QueryCksum(p, iIdx, zTerm, nTerm, f, &ck2);\n    }\n    if( rc==SQLITE_OK && ck1!=ck2 ) rc = FTS5_CORRUPT;\n\n    /* If this is a prefix query, check that the results returned if the\n    ** the index is disabled are the same. In both ASC and DESC order. \n    **\n    ** This check may only be performed if the hash table is empty. This\n    ** is because the hash table only supports a single scan query at\n    ** a time, and the multi-iter loop from which this function is called\n    ** is already performing such a scan. */\n    if( p->nPendingData==0 ){\n      if( iIdx>0 && rc==SQLITE_OK ){\n        int f = flags|FTS5INDEX_QUERY_TEST_NOIDX;\n        ck2 = 0;\n        rc = fts5QueryCksum(p, iIdx, zTerm, nTerm, f, &ck2);\n        if( rc==SQLITE_OK && ck1!=ck2 ) rc = FTS5_CORRUPT;\n      }\n      if( iIdx>0 && rc==SQLITE_OK ){\n        int f = flags|FTS5INDEX_QUERY_TEST_NOIDX|FTS5INDEX_QUERY_DESC;\n        ck2 = 0;\n        rc = fts5QueryCksum(p, iIdx, zTerm, nTerm, f, &ck2);\n        if( rc==SQLITE_OK && ck1!=ck2 ) rc = FTS5_CORRUPT;\n      }\n    }\n\n    cksum3 ^= ck1;\n    fts5BufferSet(&rc, pPrev, n, (const u8*)z);\n\n    if( rc==SQLITE_OK && cksum3!=expected ){\n      rc = FTS5_CORRUPT;\n    }\n    *pCksum = cksum3;\n  }\n  p->rc = rc;\n}\n \n#else\n# define fts5TestDlidxReverse(x,y,z)\n# define fts5TestTerm(u,v,w,x,y,z)\n#endif\n\n/*\n** Check that:\n**\n**   1) All leaves of pSeg between iFirst and iLast (inclusive) exist and\n**      contain zero terms.\n**   2) All leaves of pSeg between iNoRowid and iLast (inclusive) exist and\n**      contain zero rowids.\n*/\nstatic void fts5IndexIntegrityCheckEmpty(\n  Fts5Index *p,\n  Fts5StructureSegment *pSeg,     /* Segment to check internal consistency */\n  int iFirst,\n  int iNoRowid,\n  int iLast\n){\n  int i;\n\n  /* Now check that the iter.nEmpty leaves following the current leaf\n  ** (a) exist and (b) contain no terms. */\n  for(i=iFirst; p->rc==SQLITE_OK && i<=iLast; i++){\n    Fts5Data *pLeaf = fts5DataRead(p, FTS5_SEGMENT_ROWID(pSeg->iSegid, i));\n    if( pLeaf ){\n      if( !fts5LeafIsTermless(pLeaf) ) p->rc = FTS5_CORRUPT;\n      if( i>=iNoRowid && 0!=fts5LeafFirstRowidOff(pLeaf) ) p->rc = FTS5_CORRUPT;\n    }\n    fts5DataRelease(pLeaf);\n  }\n}\n\nstatic void fts5IntegrityCheckPgidx(Fts5Index *p, Fts5Data *pLeaf){\n  int iTermOff = 0;\n  int ii;\n\n  Fts5Buffer buf1 = {0,0,0};\n  Fts5Buffer buf2 = {0,0,0};\n\n  ii = pLeaf->szLeaf;\n  while( ii<pLeaf->nn && p->rc==SQLITE_OK ){\n    int res;\n    int iOff;\n    int nIncr;\n\n    ii += fts5GetVarint32(&pLeaf->p[ii], nIncr);\n    iTermOff += nIncr;\n    iOff = iTermOff;\n\n    if( iOff>=pLeaf->szLeaf ){\n      p->rc = FTS5_CORRUPT;\n    }else if( iTermOff==nIncr ){\n      int nByte;\n      iOff += fts5GetVarint32(&pLeaf->p[iOff], nByte);\n      if( (iOff+nByte)>pLeaf->szLeaf ){\n        p->rc = FTS5_CORRUPT;\n      }else{\n        fts5BufferSet(&p->rc, &buf1, nByte, &pLeaf->p[iOff]);\n      }\n    }else{\n      int nKeep, nByte;\n      iOff += fts5GetVarint32(&pLeaf->p[iOff], nKeep);\n      iOff += fts5GetVarint32(&pLeaf->p[iOff], nByte);\n      if( nKeep>buf1.n || (iOff+nByte)>pLeaf->szLeaf ){\n        p->rc = FTS5_CORRUPT;\n      }else{\n        buf1.n = nKeep;\n        fts5BufferAppendBlob(&p->rc, &buf1, nByte, &pLeaf->p[iOff]);\n      }\n\n      if( p->rc==SQLITE_OK ){\n        res = fts5BufferCompare(&buf1, &buf2);\n        if( res<=0 ) p->rc = FTS5_CORRUPT;\n      }\n    }\n    fts5BufferSet(&p->rc, &buf2, buf1.n, buf1.p);\n  }\n\n  fts5BufferFree(&buf1);\n  fts5BufferFree(&buf2);\n}\n\nstatic void fts5IndexIntegrityCheckSegment(\n  Fts5Index *p,                   /* FTS5 backend object */\n  Fts5StructureSegment *pSeg      /* Segment to check internal consistency */\n){\n  Fts5Config *pConfig = p->pConfig;\n  sqlite3_stmt *pStmt = 0;\n  int rc2;\n  int iIdxPrevLeaf = pSeg->pgnoFirst-1;\n  int iDlidxPrevLeaf = pSeg->pgnoLast;\n\n  if( pSeg->pgnoFirst==0 ) return;\n\n  fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf(\n      \"SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d\",\n      pConfig->zDb, pConfig->zName, pSeg->iSegid\n  ));\n\n  /* Iterate through the b-tree hierarchy.  */\n  while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){\n    i64 iRow;                     /* Rowid for this leaf */\n    Fts5Data *pLeaf;              /* Data for this leaf */\n\n    int nIdxTerm = sqlite3_column_bytes(pStmt, 1);\n    const char *zIdxTerm = (const char*)sqlite3_column_text(pStmt, 1);\n    int iIdxLeaf = sqlite3_column_int(pStmt, 2);\n    int bIdxDlidx = sqlite3_column_int(pStmt, 3);\n\n    /* If the leaf in question has already been trimmed from the segment, \n    ** ignore this b-tree entry. Otherwise, load it into memory. */\n    if( iIdxLeaf<pSeg->pgnoFirst ) continue;\n    iRow = FTS5_SEGMENT_ROWID(pSeg->iSegid, iIdxLeaf);\n    pLeaf = fts5DataRead(p, iRow);\n    if( pLeaf==0 ) break;\n\n    /* Check that the leaf contains at least one term, and that it is equal\n    ** to or larger than the split-key in zIdxTerm.  Also check that if there\n    ** is also a rowid pointer within the leaf page header, it points to a\n    ** location before the term.  */\n    if( pLeaf->nn<=pLeaf->szLeaf ){\n      p->rc = FTS5_CORRUPT;\n    }else{\n      int iOff;                   /* Offset of first term on leaf */\n      int iRowidOff;              /* Offset of first rowid on leaf */\n      int nTerm;                  /* Size of term on leaf in bytes */\n      int res;                    /* Comparison of term and split-key */\n\n      iOff = fts5LeafFirstTermOff(pLeaf);\n      iRowidOff = fts5LeafFirstRowidOff(pLeaf);\n      if( iRowidOff>=iOff ){\n        p->rc = FTS5_CORRUPT;\n      }else{\n        iOff += fts5GetVarint32(&pLeaf->p[iOff], nTerm);\n        res = memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm));\n        if( res==0 ) res = nTerm - nIdxTerm;\n        if( res<0 ) p->rc = FTS5_CORRUPT;\n      }\n\n      fts5IntegrityCheckPgidx(p, pLeaf);\n    }\n    fts5DataRelease(pLeaf);\n    if( p->rc ) break;\n\n    /* Now check that the iter.nEmpty leaves following the current leaf\n    ** (a) exist and (b) contain no terms. */\n    fts5IndexIntegrityCheckEmpty(\n        p, pSeg, iIdxPrevLeaf+1, iDlidxPrevLeaf+1, iIdxLeaf-1\n    );\n    if( p->rc ) break;\n\n    /* If there is a doclist-index, check that it looks right. */\n    if( bIdxDlidx ){\n      Fts5DlidxIter *pDlidx = 0;  /* For iterating through doclist index */\n      int iPrevLeaf = iIdxLeaf;\n      int iSegid = pSeg->iSegid;\n      int iPg = 0;\n      i64 iKey;\n\n      for(pDlidx=fts5DlidxIterInit(p, 0, iSegid, iIdxLeaf);\n          fts5DlidxIterEof(p, pDlidx)==0;\n          fts5DlidxIterNext(p, pDlidx)\n      ){\n\n        /* Check any rowid-less pages that occur before the current leaf. */\n        for(iPg=iPrevLeaf+1; iPg<fts5DlidxIterPgno(pDlidx); iPg++){\n          iKey = FTS5_SEGMENT_ROWID(iSegid, iPg);\n          pLeaf = fts5DataRead(p, iKey);\n          if( pLeaf ){\n            if( fts5LeafFirstRowidOff(pLeaf)!=0 ) p->rc = FTS5_CORRUPT;\n            fts5DataRelease(pLeaf);\n          }\n        }\n        iPrevLeaf = fts5DlidxIterPgno(pDlidx);\n\n        /* Check that the leaf page indicated by the iterator really does\n        ** contain the rowid suggested by the same. */\n        iKey = FTS5_SEGMENT_ROWID(iSegid, iPrevLeaf);\n        pLeaf = fts5DataRead(p, iKey);\n        if( pLeaf ){\n          i64 iRowid;\n          int iRowidOff = fts5LeafFirstRowidOff(pLeaf);\n          ASSERT_SZLEAF_OK(pLeaf);\n          if( iRowidOff>=pLeaf->szLeaf ){\n            p->rc = FTS5_CORRUPT;\n          }else{\n            fts5GetVarint(&pLeaf->p[iRowidOff], (u64*)&iRowid);\n            if( iRowid!=fts5DlidxIterRowid(pDlidx) ) p->rc = FTS5_CORRUPT;\n          }\n          fts5DataRelease(pLeaf);\n        }\n      }\n\n      iDlidxPrevLeaf = iPg;\n      fts5DlidxIterFree(pDlidx);\n      fts5TestDlidxReverse(p, iSegid, iIdxLeaf);\n    }else{\n      iDlidxPrevLeaf = pSeg->pgnoLast;\n      /* TODO: Check there is no doclist index */\n    }\n\n    iIdxPrevLeaf = iIdxLeaf;\n  }\n\n  rc2 = sqlite3_finalize(pStmt);\n  if( p->rc==SQLITE_OK ) p->rc = rc2;\n\n  /* Page iter.iLeaf must now be the rightmost leaf-page in the segment */\n#if 0\n  if( p->rc==SQLITE_OK && iter.iLeaf!=pSeg->pgnoLast ){\n    p->rc = FTS5_CORRUPT;\n  }\n#endif\n}\n\n\n/*\n** Run internal checks to ensure that the FTS index (a) is internally \n** consistent and (b) contains entries for which the XOR of the checksums\n** as calculated by sqlite3Fts5IndexEntryCksum() is cksum.\n**\n** Return SQLITE_CORRUPT if any of the internal checks fail, or if the\n** checksum does not match. Return SQLITE_OK if all checks pass without\n** error, or some other SQLite error code if another error (e.g. OOM)\n** occurs.\n*/\nstatic int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum){\n  int eDetail = p->pConfig->eDetail;\n  u64 cksum2 = 0;                 /* Checksum based on contents of indexes */\n  Fts5Buffer poslist = {0,0,0};   /* Buffer used to hold a poslist */\n  Fts5Iter *pIter;                /* Used to iterate through entire index */\n  Fts5Structure *pStruct;         /* Index structure */\n\n#ifdef SQLITE_DEBUG\n  /* Used by extra internal tests only run if NDEBUG is not defined */\n  u64 cksum3 = 0;                 /* Checksum based on contents of indexes */\n  Fts5Buffer term = {0,0,0};      /* Buffer used to hold most recent term */\n#endif\n  const int flags = FTS5INDEX_QUERY_NOOUTPUT;\n  \n  /* Load the FTS index structure */\n  pStruct = fts5StructureRead(p);\n\n  /* Check that the internal nodes of each segment match the leaves */\n  if( pStruct ){\n    int iLvl, iSeg;\n    for(iLvl=0; iLvl<pStruct->nLevel; iLvl++){\n      for(iSeg=0; iSeg<pStruct->aLevel[iLvl].nSeg; iSeg++){\n        Fts5StructureSegment *pSeg = &pStruct->aLevel[iLvl].aSeg[iSeg];\n        fts5IndexIntegrityCheckSegment(p, pSeg);\n      }\n    }\n  }\n\n  /* The cksum argument passed to this function is a checksum calculated\n  ** based on all expected entries in the FTS index (including prefix index\n  ** entries). This block checks that a checksum calculated based on the\n  ** actual contents of FTS index is identical.\n  **\n  ** Two versions of the same checksum are calculated. The first (stack\n  ** variable cksum2) based on entries extracted from the full-text index\n  ** while doing a linear scan of each individual index in turn. \n  **\n  ** As each term visited by the linear scans, a separate query for the\n  ** same term is performed. cksum3 is calculated based on the entries\n  ** extracted by these queries.\n  */\n  for(fts5MultiIterNew(p, pStruct, flags, 0, 0, 0, -1, 0, &pIter);\n      fts5MultiIterEof(p, pIter)==0;\n      fts5MultiIterNext(p, pIter, 0, 0)\n  ){\n    int n;                      /* Size of term in bytes */\n    i64 iPos = 0;               /* Position read from poslist */\n    int iOff = 0;               /* Offset within poslist */\n    i64 iRowid = fts5MultiIterRowid(pIter);\n    char *z = (char*)fts5MultiIterTerm(pIter, &n);\n\n    /* If this is a new term, query for it. Update cksum3 with the results. */\n    fts5TestTerm(p, &term, z, n, cksum2, &cksum3);\n\n    if( eDetail==FTS5_DETAIL_NONE ){\n      if( 0==fts5MultiIterIsEmpty(p, pIter) ){\n        cksum2 ^= sqlite3Fts5IndexEntryCksum(iRowid, 0, 0, -1, z, n);\n      }\n    }else{\n      poslist.n = 0;\n      fts5SegiterPoslist(p, &pIter->aSeg[pIter->aFirst[1].iFirst], 0, &poslist);\n      while( 0==sqlite3Fts5PoslistNext64(poslist.p, poslist.n, &iOff, &iPos) ){\n        int iCol = FTS5_POS2COLUMN(iPos);\n        int iTokOff = FTS5_POS2OFFSET(iPos);\n        cksum2 ^= sqlite3Fts5IndexEntryCksum(iRowid, iCol, iTokOff, -1, z, n);\n      }\n    }\n  }\n  fts5TestTerm(p, &term, 0, 0, cksum2, &cksum3);\n\n  fts5MultiIterFree(pIter);\n  if( p->rc==SQLITE_OK && cksum!=cksum2 ) p->rc = FTS5_CORRUPT;\n\n  fts5StructureRelease(pStruct);\n#ifdef SQLITE_DEBUG\n  fts5BufferFree(&term);\n#endif\n  fts5BufferFree(&poslist);\n  return fts5IndexReturn(p);\n}\n\n/*************************************************************************\n**************************************************************************\n** Below this point is the implementation of the fts5_decode() scalar\n** function only.\n*/\n\n/*\n** Decode a segment-data rowid from the %_data table. This function is\n** the opposite of macro FTS5_SEGMENT_ROWID().\n*/\nstatic void fts5DecodeRowid(\n  i64 iRowid,                     /* Rowid from %_data table */\n  int *piSegid,                   /* OUT: Segment id */\n  int *pbDlidx,                   /* OUT: Dlidx flag */\n  int *piHeight,                  /* OUT: Height */\n  int *piPgno                     /* OUT: Page number */\n){\n  *piPgno = (int)(iRowid & (((i64)1 << FTS5_DATA_PAGE_B) - 1));\n  iRowid >>= FTS5_DATA_PAGE_B;\n\n  *piHeight = (int)(iRowid & (((i64)1 << FTS5_DATA_HEIGHT_B) - 1));\n  iRowid >>= FTS5_DATA_HEIGHT_B;\n\n  *pbDlidx = (int)(iRowid & 0x0001);\n  iRowid >>= FTS5_DATA_DLI_B;\n\n  *piSegid = (int)(iRowid & (((i64)1 << FTS5_DATA_ID_B) - 1));\n}\n\nstatic void fts5DebugRowid(int *pRc, Fts5Buffer *pBuf, i64 iKey){\n  int iSegid, iHeight, iPgno, bDlidx;       /* Rowid compenents */\n  fts5DecodeRowid(iKey, &iSegid, &bDlidx, &iHeight, &iPgno);\n\n  if( iSegid==0 ){\n    if( iKey==FTS5_AVERAGES_ROWID ){\n      sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \"{averages} \");\n    }else{\n      sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \"{structure}\");\n    }\n  }\n  else{\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \"{%ssegid=%d h=%d pgno=%d}\",\n        bDlidx ? \"dlidx \" : \"\", iSegid, iHeight, iPgno\n    );\n  }\n}\n\nstatic void fts5DebugStructure(\n  int *pRc,                       /* IN/OUT: error code */\n  Fts5Buffer *pBuf,\n  Fts5Structure *p\n){\n  int iLvl, iSeg;                 /* Iterate through levels, segments */\n\n  for(iLvl=0; iLvl<p->nLevel; iLvl++){\n    Fts5StructureLevel *pLvl = &p->aLevel[iLvl];\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \n        \" {lvl=%d nMerge=%d nSeg=%d\", iLvl, pLvl->nMerge, pLvl->nSeg\n    );\n    for(iSeg=0; iSeg<pLvl->nSeg; iSeg++){\n      Fts5StructureSegment *pSeg = &pLvl->aSeg[iSeg];\n      sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \" {id=%d leaves=%d..%d}\", \n          pSeg->iSegid, pSeg->pgnoFirst, pSeg->pgnoLast\n      );\n    }\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \"}\");\n  }\n}\n\n/*\n** This is part of the fts5_decode() debugging aid.\n**\n** Arguments pBlob/nBlob contain a serialized Fts5Structure object. This\n** function appends a human-readable representation of the same object\n** to the buffer passed as the second argument. \n*/\nstatic void fts5DecodeStructure(\n  int *pRc,                       /* IN/OUT: error code */\n  Fts5Buffer *pBuf,\n  const u8 *pBlob, int nBlob\n){\n  int rc;                         /* Return code */\n  Fts5Structure *p = 0;           /* Decoded structure object */\n\n  rc = fts5StructureDecode(pBlob, nBlob, 0, &p);\n  if( rc!=SQLITE_OK ){\n    *pRc = rc;\n    return;\n  }\n\n  fts5DebugStructure(pRc, pBuf, p);\n  fts5StructureRelease(p);\n}\n\n/*\n** This is part of the fts5_decode() debugging aid.\n**\n** Arguments pBlob/nBlob contain an \"averages\" record. This function \n** appends a human-readable representation of record to the buffer passed \n** as the second argument. \n*/\nstatic void fts5DecodeAverages(\n  int *pRc,                       /* IN/OUT: error code */\n  Fts5Buffer *pBuf,\n  const u8 *pBlob, int nBlob\n){\n  int i = 0;\n  const char *zSpace = \"\";\n\n  while( i<nBlob ){\n    u64 iVal;\n    i += sqlite3Fts5GetVarint(&pBlob[i], &iVal);\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \"%s%d\", zSpace, (int)iVal);\n    zSpace = \" \";\n  }\n}\n\n/*\n** Buffer (a/n) is assumed to contain a list of serialized varints. Read\n** each varint and append its string representation to buffer pBuf. Return\n** after either the input buffer is exhausted or a 0 value is read.\n**\n** The return value is the number of bytes read from the input buffer.\n*/\nstatic int fts5DecodePoslist(int *pRc, Fts5Buffer *pBuf, const u8 *a, int n){\n  int iOff = 0;\n  while( iOff<n ){\n    int iVal;\n    iOff += fts5GetVarint32(&a[iOff], iVal);\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \" %d\", iVal);\n  }\n  return iOff;\n}\n\n/*\n** The start of buffer (a/n) contains the start of a doclist. The doclist\n** may or may not finish within the buffer. This function appends a text\n** representation of the part of the doclist that is present to buffer\n** pBuf. \n**\n** The return value is the number of bytes read from the input buffer.\n*/\nstatic int fts5DecodeDoclist(int *pRc, Fts5Buffer *pBuf, const u8 *a, int n){\n  i64 iDocid = 0;\n  int iOff = 0;\n\n  if( n>0 ){\n    iOff = sqlite3Fts5GetVarint(a, (u64*)&iDocid);\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \" id=%lld\", iDocid);\n  }\n  while( iOff<n ){\n    int nPos;\n    int bDel;\n    iOff += fts5GetPoslistSize(&a[iOff], &nPos, &bDel);\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \" nPos=%d%s\", nPos, bDel?\"*\":\"\");\n    iOff += fts5DecodePoslist(pRc, pBuf, &a[iOff], MIN(n-iOff, nPos));\n    if( iOff<n ){\n      i64 iDelta;\n      iOff += sqlite3Fts5GetVarint(&a[iOff], (u64*)&iDelta);\n      iDocid += iDelta;\n      sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \" id=%lld\", iDocid);\n    }\n  }\n\n  return iOff;\n}\n\n/*\n** This function is part of the fts5_decode() debugging function. It is \n** only ever used with detail=none tables.\n**\n** Buffer (pData/nData) contains a doclist in the format used by detail=none\n** tables. This function appends a human-readable version of that list to\n** buffer pBuf.\n**\n** If *pRc is other than SQLITE_OK when this function is called, it is a\n** no-op. If an OOM or other error occurs within this function, *pRc is\n** set to an SQLite error code before returning. The final state of buffer\n** pBuf is undefined in this case.\n*/\nstatic void fts5DecodeRowidList(\n  int *pRc,                       /* IN/OUT: Error code */\n  Fts5Buffer *pBuf,               /* Buffer to append text to */\n  const u8 *pData, int nData      /* Data to decode list-of-rowids from */\n){\n  int i = 0;\n  i64 iRowid = 0;\n\n  while( i<nData ){\n    const char *zApp = \"\";\n    u64 iVal;\n    i += sqlite3Fts5GetVarint(&pData[i], &iVal);\n    iRowid += iVal;\n\n    if( i<nData && pData[i]==0x00 ){\n      i++;\n      if( i<nData && pData[i]==0x00 ){\n        i++;\n        zApp = \"+\";\n      }else{\n        zApp = \"*\";\n      }\n    }\n\n    sqlite3Fts5BufferAppendPrintf(pRc, pBuf, \" %lld%s\", iRowid, zApp);\n  }\n}\n\n/*\n** The implementation of user-defined scalar function fts5_decode().\n*/\nstatic void fts5DecodeFunction(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args (always 2) */\n  sqlite3_value **apVal           /* Function arguments */\n){\n  i64 iRowid;                     /* Rowid for record being decoded */\n  int iSegid,iHeight,iPgno,bDlidx;/* Rowid components */\n  const u8 *aBlob; int n;         /* Record to decode */\n  u8 *a = 0;\n  Fts5Buffer s;                   /* Build up text to return here */\n  int rc = SQLITE_OK;             /* Return code */\n  int nSpace = 0;\n  int eDetailNone = (sqlite3_user_data(pCtx)!=0);\n\n  assert( nArg==2 );\n  UNUSED_PARAM(nArg);\n  memset(&s, 0, sizeof(Fts5Buffer));\n  iRowid = sqlite3_value_int64(apVal[0]);\n\n  /* Make a copy of the second argument (a blob) in aBlob[]. The aBlob[]\n  ** copy is followed by FTS5_DATA_ZERO_PADDING 0x00 bytes, which prevents\n  ** buffer overreads even if the record is corrupt.  */\n  n = sqlite3_value_bytes(apVal[1]);\n  aBlob = sqlite3_value_blob(apVal[1]);\n  nSpace = n + FTS5_DATA_ZERO_PADDING;\n  a = (u8*)sqlite3Fts5MallocZero(&rc, nSpace);\n  if( a==0 ) goto decode_out;\n  memcpy(a, aBlob, n);\n\n\n  fts5DecodeRowid(iRowid, &iSegid, &bDlidx, &iHeight, &iPgno);\n\n  fts5DebugRowid(&rc, &s, iRowid);\n  if( bDlidx ){\n    Fts5Data dlidx;\n    Fts5DlidxLvl lvl;\n\n    dlidx.p = a;\n    dlidx.nn = n;\n\n    memset(&lvl, 0, sizeof(Fts5DlidxLvl));\n    lvl.pData = &dlidx;\n    lvl.iLeafPgno = iPgno;\n\n    for(fts5DlidxLvlNext(&lvl); lvl.bEof==0; fts5DlidxLvlNext(&lvl)){\n      sqlite3Fts5BufferAppendPrintf(&rc, &s, \n          \" %d(%lld)\", lvl.iLeafPgno, lvl.iRowid\n      );\n    }\n  }else if( iSegid==0 ){\n    if( iRowid==FTS5_AVERAGES_ROWID ){\n      fts5DecodeAverages(&rc, &s, a, n);\n    }else{\n      fts5DecodeStructure(&rc, &s, a, n);\n    }\n  }else if( eDetailNone ){\n    Fts5Buffer term;              /* Current term read from page */\n    int szLeaf;\n    int iPgidxOff = szLeaf = fts5GetU16(&a[2]);\n    int iTermOff;\n    int nKeep = 0;\n    int iOff;\n\n    memset(&term, 0, sizeof(Fts5Buffer));\n\n    /* Decode any entries that occur before the first term. */\n    if( szLeaf<n ){\n      iPgidxOff += fts5GetVarint32(&a[iPgidxOff], iTermOff);\n    }else{\n      iTermOff = szLeaf;\n    }\n    fts5DecodeRowidList(&rc, &s, &a[4], iTermOff-4);\n\n    iOff = iTermOff;\n    while( iOff<szLeaf ){\n      int nAppend;\n\n      /* Read the term data for the next term*/\n      iOff += fts5GetVarint32(&a[iOff], nAppend);\n      term.n = nKeep;\n      fts5BufferAppendBlob(&rc, &term, nAppend, &a[iOff]);\n      sqlite3Fts5BufferAppendPrintf(\n          &rc, &s, \" term=%.*s\", term.n, (const char*)term.p\n      );\n      iOff += nAppend;\n\n      /* Figure out where the doclist for this term ends */\n      if( iPgidxOff<n ){\n        int nIncr;\n        iPgidxOff += fts5GetVarint32(&a[iPgidxOff], nIncr);\n        iTermOff += nIncr;\n      }else{\n        iTermOff = szLeaf;\n      }\n\n      fts5DecodeRowidList(&rc, &s, &a[iOff], iTermOff-iOff);\n      iOff = iTermOff;\n      if( iOff<szLeaf ){\n        iOff += fts5GetVarint32(&a[iOff], nKeep);\n      }\n    }\n\n    fts5BufferFree(&term);\n  }else{\n    Fts5Buffer term;              /* Current term read from page */\n    int szLeaf;                   /* Offset of pgidx in a[] */\n    int iPgidxOff;\n    int iPgidxPrev = 0;           /* Previous value read from pgidx */\n    int iTermOff = 0;\n    int iRowidOff = 0;\n    int iOff;\n    int nDoclist;\n\n    memset(&term, 0, sizeof(Fts5Buffer));\n\n    if( n<4 ){\n      sqlite3Fts5BufferSet(&rc, &s, 7, (const u8*)\"corrupt\");\n      goto decode_out;\n    }else{\n      iRowidOff = fts5GetU16(&a[0]);\n      iPgidxOff = szLeaf = fts5GetU16(&a[2]);\n      if( iPgidxOff<n ){\n        fts5GetVarint32(&a[iPgidxOff], iTermOff);\n      }\n    }\n\n    /* Decode the position list tail at the start of the page */\n    if( iRowidOff!=0 ){\n      iOff = iRowidOff;\n    }else if( iTermOff!=0 ){\n      iOff = iTermOff;\n    }else{\n      iOff = szLeaf;\n    }\n    fts5DecodePoslist(&rc, &s, &a[4], iOff-4);\n\n    /* Decode any more doclist data that appears on the page before the\n    ** first term. */\n    nDoclist = (iTermOff ? iTermOff : szLeaf) - iOff;\n    fts5DecodeDoclist(&rc, &s, &a[iOff], nDoclist);\n\n    while( iPgidxOff<n ){\n      int bFirst = (iPgidxOff==szLeaf);     /* True for first term on page */\n      int nByte;                            /* Bytes of data */\n      int iEnd;\n      \n      iPgidxOff += fts5GetVarint32(&a[iPgidxOff], nByte);\n      iPgidxPrev += nByte;\n      iOff = iPgidxPrev;\n\n      if( iPgidxOff<n ){\n        fts5GetVarint32(&a[iPgidxOff], nByte);\n        iEnd = iPgidxPrev + nByte;\n      }else{\n        iEnd = szLeaf;\n      }\n\n      if( bFirst==0 ){\n        iOff += fts5GetVarint32(&a[iOff], nByte);\n        term.n = nByte;\n      }\n      iOff += fts5GetVarint32(&a[iOff], nByte);\n      fts5BufferAppendBlob(&rc, &term, nByte, &a[iOff]);\n      iOff += nByte;\n\n      sqlite3Fts5BufferAppendPrintf(\n          &rc, &s, \" term=%.*s\", term.n, (const char*)term.p\n      );\n      iOff += fts5DecodeDoclist(&rc, &s, &a[iOff], iEnd-iOff);\n    }\n\n    fts5BufferFree(&term);\n  }\n  \n decode_out:\n  sqlite3_free(a);\n  if( rc==SQLITE_OK ){\n    sqlite3_result_text(pCtx, (const char*)s.p, s.n, SQLITE_TRANSIENT);\n  }else{\n    sqlite3_result_error_code(pCtx, rc);\n  }\n  fts5BufferFree(&s);\n}\n\n/*\n** The implementation of user-defined scalar function fts5_rowid().\n*/\nstatic void fts5RowidFunction(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args (always 2) */\n  sqlite3_value **apVal           /* Function arguments */\n){\n  const char *zArg;\n  if( nArg==0 ){\n    sqlite3_result_error(pCtx, \"should be: fts5_rowid(subject, ....)\", -1);\n  }else{\n    zArg = (const char*)sqlite3_value_text(apVal[0]);\n    if( 0==sqlite3_stricmp(zArg, \"segment\") ){\n      i64 iRowid;\n      int segid, pgno;\n      if( nArg!=3 ){\n        sqlite3_result_error(pCtx, \n            \"should be: fts5_rowid('segment', segid, pgno))\", -1\n        );\n      }else{\n        segid = sqlite3_value_int(apVal[1]);\n        pgno = sqlite3_value_int(apVal[2]);\n        iRowid = FTS5_SEGMENT_ROWID(segid, pgno);\n        sqlite3_result_int64(pCtx, iRowid);\n      }\n    }else{\n      sqlite3_result_error(pCtx, \n        \"first arg to fts5_rowid() must be 'segment'\" , -1\n      );\n    }\n  }\n}\n\n/*\n** This is called as part of registering the FTS5 module with database\n** connection db. It registers several user-defined scalar functions useful\n** with FTS5.\n**\n** If successful, SQLITE_OK is returned. If an error occurs, some other\n** SQLite error code is returned instead.\n*/\nstatic int sqlite3Fts5IndexInit(sqlite3 *db){\n  int rc = sqlite3_create_function(\n      db, \"fts5_decode\", 2, SQLITE_UTF8, 0, fts5DecodeFunction, 0, 0\n  );\n\n  if( rc==SQLITE_OK ){\n    rc = sqlite3_create_function(\n        db, \"fts5_decode_none\", 2, \n        SQLITE_UTF8, (void*)db, fts5DecodeFunction, 0, 0\n    );\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = sqlite3_create_function(\n        db, \"fts5_rowid\", -1, SQLITE_UTF8, 0, fts5RowidFunction, 0, 0\n    );\n  }\n  return rc;\n}\n\n\nstatic int sqlite3Fts5IndexReset(Fts5Index *p){\n  assert( p->pStruct==0 || p->iStructVersion!=0 );\n  if( fts5IndexDataVersion(p)!=p->iStructVersion ){\n    fts5StructureInvalidate(p);\n  }\n  return fts5IndexReturn(p);\n}\n\n#line 1 \"fts5_main.c\"\n/*\n** 2014 Jun 09\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This is an SQLite module implementing full-text search.\n*/\n\n\n/* #include \"fts5Int.h\" */\n\n/*\n** This variable is set to false when running tests for which the on disk\n** structures should not be corrupt. Otherwise, true. If it is false, extra\n** assert() conditions in the fts5 code are activated - conditions that are\n** only true if it is guaranteed that the fts5 database is not corrupt.\n*/\nint sqlite3_fts5_may_be_corrupt = 1;\n\n\ntypedef struct Fts5Auxdata Fts5Auxdata;\ntypedef struct Fts5Auxiliary Fts5Auxiliary;\ntypedef struct Fts5Cursor Fts5Cursor;\ntypedef struct Fts5Sorter Fts5Sorter;\ntypedef struct Fts5Table Fts5Table;\ntypedef struct Fts5TokenizerModule Fts5TokenizerModule;\n\n/*\n** NOTES ON TRANSACTIONS: \n**\n** SQLite invokes the following virtual table methods as transactions are \n** opened and closed by the user:\n**\n**     xBegin():    Start of a new transaction.\n**     xSync():     Initial part of two-phase commit.\n**     xCommit():   Final part of two-phase commit.\n**     xRollback(): Rollback the transaction.\n**\n** Anything that is required as part of a commit that may fail is performed\n** in the xSync() callback. Current versions of SQLite ignore any errors \n** returned by xCommit().\n**\n** And as sub-transactions are opened/closed:\n**\n**     xSavepoint(int S):  Open savepoint S.\n**     xRelease(int S):    Commit and close savepoint S.\n**     xRollbackTo(int S): Rollback to start of savepoint S.\n**\n** During a write-transaction the fts5_index.c module may cache some data \n** in-memory. It is flushed to disk whenever xSync(), xRelease() or\n** xSavepoint() is called. And discarded whenever xRollback() or xRollbackTo() \n** is called.\n**\n** Additionally, if SQLITE_DEBUG is defined, an instance of the following\n** structure is used to record the current transaction state. This information\n** is not required, but it is used in the assert() statements executed by\n** function fts5CheckTransactionState() (see below).\n*/\nstruct Fts5TransactionState {\n  int eState;                     /* 0==closed, 1==open, 2==synced */\n  int iSavepoint;                 /* Number of open savepoints (0 -> none) */\n};\n\n/*\n** A single object of this type is allocated when the FTS5 module is \n** registered with a database handle. It is used to store pointers to\n** all registered FTS5 extensions - tokenizers and auxiliary functions.\n*/\nstruct Fts5Global {\n  fts5_api api;                   /* User visible part of object (see fts5.h) */\n  sqlite3 *db;                    /* Associated database connection */ \n  i64 iNextId;                    /* Used to allocate unique cursor ids */\n  Fts5Auxiliary *pAux;            /* First in list of all aux. functions */\n  Fts5TokenizerModule *pTok;      /* First in list of all tokenizer modules */\n  Fts5TokenizerModule *pDfltTok;  /* Default tokenizer module */\n  Fts5Cursor *pCsr;               /* First in list of all open cursors */\n};\n\n/*\n** Each auxiliary function registered with the FTS5 module is represented\n** by an object of the following type. All such objects are stored as part\n** of the Fts5Global.pAux list.\n*/\nstruct Fts5Auxiliary {\n  Fts5Global *pGlobal;            /* Global context for this function */\n  char *zFunc;                    /* Function name (nul-terminated) */\n  void *pUserData;                /* User-data pointer */\n  fts5_extension_function xFunc;  /* Callback function */\n  void (*xDestroy)(void*);        /* Destructor function */\n  Fts5Auxiliary *pNext;           /* Next registered auxiliary function */\n};\n\n/*\n** Each tokenizer module registered with the FTS5 module is represented\n** by an object of the following type. All such objects are stored as part\n** of the Fts5Global.pTok list.\n*/\nstruct Fts5TokenizerModule {\n  char *zName;                    /* Name of tokenizer */\n  void *pUserData;                /* User pointer passed to xCreate() */\n  fts5_tokenizer x;               /* Tokenizer functions */\n  void (*xDestroy)(void*);        /* Destructor function */\n  Fts5TokenizerModule *pNext;     /* Next registered tokenizer module */\n};\n\n/*\n** Virtual-table object.\n*/\nstruct Fts5Table {\n  sqlite3_vtab base;              /* Base class used by SQLite core */\n  Fts5Config *pConfig;            /* Virtual table configuration */\n  Fts5Index *pIndex;              /* Full-text index */\n  Fts5Storage *pStorage;          /* Document store */\n  Fts5Global *pGlobal;            /* Global (connection wide) data */\n  Fts5Cursor *pSortCsr;           /* Sort data from this cursor */\n#ifdef SQLITE_DEBUG\n  struct Fts5TransactionState ts;\n#endif\n};\n\nstruct Fts5MatchPhrase {\n  Fts5Buffer *pPoslist;           /* Pointer to current poslist */\n  int nTerm;                      /* Size of phrase in terms */\n};\n\n/*\n** pStmt:\n**   SELECT rowid, <fts> FROM <fts> ORDER BY +rank;\n**\n** aIdx[]:\n**   There is one entry in the aIdx[] array for each phrase in the query,\n**   the value of which is the offset within aPoslist[] following the last \n**   byte of the position list for the corresponding phrase.\n*/\nstruct Fts5Sorter {\n  sqlite3_stmt *pStmt;\n  i64 iRowid;                     /* Current rowid */\n  const u8 *aPoslist;             /* Position lists for current row */\n  int nIdx;                       /* Number of entries in aIdx[] */\n  int aIdx[1];                    /* Offsets into aPoslist for current row */\n};\n\n\n/*\n** Virtual-table cursor object.\n**\n** iSpecial:\n**   If this is a 'special' query (refer to function fts5SpecialMatch()), \n**   then this variable contains the result of the query. \n**\n** iFirstRowid, iLastRowid:\n**   These variables are only used for FTS5_PLAN_MATCH cursors. Assuming the\n**   cursor iterates in ascending order of rowids, iFirstRowid is the lower\n**   limit of rowids to return, and iLastRowid the upper. In other words, the\n**   WHERE clause in the user's query might have been:\n**\n**       <tbl> MATCH <expr> AND rowid BETWEEN $iFirstRowid AND $iLastRowid\n**\n**   If the cursor iterates in descending order of rowid, iFirstRowid\n**   is the upper limit (i.e. the \"first\" rowid visited) and iLastRowid\n**   the lower.\n*/\nstruct Fts5Cursor {\n  sqlite3_vtab_cursor base;       /* Base class used by SQLite core */\n  Fts5Cursor *pNext;              /* Next cursor in Fts5Cursor.pCsr list */\n  int *aColumnSize;               /* Values for xColumnSize() */\n  i64 iCsrId;                     /* Cursor id */\n\n  /* Zero from this point onwards on cursor reset */\n  int ePlan;                      /* FTS5_PLAN_XXX value */\n  int bDesc;                      /* True for \"ORDER BY rowid DESC\" queries */\n  i64 iFirstRowid;                /* Return no rowids earlier than this */\n  i64 iLastRowid;                 /* Return no rowids later than this */\n  sqlite3_stmt *pStmt;            /* Statement used to read %_content */\n  Fts5Expr *pExpr;                /* Expression for MATCH queries */\n  Fts5Sorter *pSorter;            /* Sorter for \"ORDER BY rank\" queries */\n  int csrflags;                   /* Mask of cursor flags (see below) */\n  i64 iSpecial;                   /* Result of special query */\n\n  /* \"rank\" function. Populated on demand from vtab.xColumn(). */\n  char *zRank;                    /* Custom rank function */\n  char *zRankArgs;                /* Custom rank function args */\n  Fts5Auxiliary *pRank;           /* Rank callback (or NULL) */\n  int nRankArg;                   /* Number of trailing arguments for rank() */\n  sqlite3_value **apRankArg;      /* Array of trailing arguments */\n  sqlite3_stmt *pRankArgStmt;     /* Origin of objects in apRankArg[] */\n\n  /* Auxiliary data storage */\n  Fts5Auxiliary *pAux;            /* Currently executing extension function */\n  Fts5Auxdata *pAuxdata;          /* First in linked list of saved aux-data */\n\n  /* Cache used by auxiliary functions xInst() and xInstCount() */\n  Fts5PoslistReader *aInstIter;   /* One for each phrase */\n  int nInstAlloc;                 /* Size of aInst[] array (entries / 3) */\n  int nInstCount;                 /* Number of phrase instances */\n  int *aInst;                     /* 3 integers per phrase instance */\n};\n\n/*\n** Bits that make up the \"idxNum\" parameter passed indirectly by \n** xBestIndex() to xFilter().\n*/\n#define FTS5_BI_MATCH        0x0001         /* <tbl> MATCH ? */\n#define FTS5_BI_RANK         0x0002         /* rank MATCH ? */\n#define FTS5_BI_ROWID_EQ     0x0004         /* rowid == ? */\n#define FTS5_BI_ROWID_LE     0x0008         /* rowid <= ? */\n#define FTS5_BI_ROWID_GE     0x0010         /* rowid >= ? */\n\n#define FTS5_BI_ORDER_RANK   0x0020\n#define FTS5_BI_ORDER_ROWID  0x0040\n#define FTS5_BI_ORDER_DESC   0x0080\n\n/*\n** Values for Fts5Cursor.csrflags\n*/\n#define FTS5CSR_EOF               0x01\n#define FTS5CSR_REQUIRE_CONTENT   0x02\n#define FTS5CSR_REQUIRE_DOCSIZE   0x04\n#define FTS5CSR_REQUIRE_INST      0x08\n#define FTS5CSR_FREE_ZRANK        0x10\n#define FTS5CSR_REQUIRE_RESEEK    0x20\n#define FTS5CSR_REQUIRE_POSLIST   0x40\n\n#define BitFlagAllTest(x,y) (((x) & (y))==(y))\n#define BitFlagTest(x,y)    (((x) & (y))!=0)\n\n\n/*\n** Macros to Set(), Clear() and Test() cursor flags.\n*/\n#define CsrFlagSet(pCsr, flag)   ((pCsr)->csrflags |= (flag))\n#define CsrFlagClear(pCsr, flag) ((pCsr)->csrflags &= ~(flag))\n#define CsrFlagTest(pCsr, flag)  ((pCsr)->csrflags & (flag))\n\nstruct Fts5Auxdata {\n  Fts5Auxiliary *pAux;            /* Extension to which this belongs */\n  void *pPtr;                     /* Pointer value */\n  void(*xDelete)(void*);          /* Destructor */\n  Fts5Auxdata *pNext;             /* Next object in linked list */\n};\n\n#ifdef SQLITE_DEBUG\n#define FTS5_BEGIN      1\n#define FTS5_SYNC       2\n#define FTS5_COMMIT     3\n#define FTS5_ROLLBACK   4\n#define FTS5_SAVEPOINT  5\n#define FTS5_RELEASE    6\n#define FTS5_ROLLBACKTO 7\nstatic void fts5CheckTransactionState(Fts5Table *p, int op, int iSavepoint){\n  switch( op ){\n    case FTS5_BEGIN:\n      assert( p->ts.eState==0 );\n      p->ts.eState = 1;\n      p->ts.iSavepoint = -1;\n      break;\n\n    case FTS5_SYNC:\n      assert( p->ts.eState==1 );\n      p->ts.eState = 2;\n      break;\n\n    case FTS5_COMMIT:\n      assert( p->ts.eState==2 );\n      p->ts.eState = 0;\n      break;\n\n    case FTS5_ROLLBACK:\n      assert( p->ts.eState==1 || p->ts.eState==2 || p->ts.eState==0 );\n      p->ts.eState = 0;\n      break;\n\n    case FTS5_SAVEPOINT:\n      assert( p->ts.eState==1 );\n      assert( iSavepoint>=0 );\n      assert( iSavepoint>p->ts.iSavepoint );\n      p->ts.iSavepoint = iSavepoint;\n      break;\n      \n    case FTS5_RELEASE:\n      assert( p->ts.eState==1 );\n      assert( iSavepoint>=0 );\n      assert( iSavepoint<=p->ts.iSavepoint );\n      p->ts.iSavepoint = iSavepoint-1;\n      break;\n\n    case FTS5_ROLLBACKTO:\n      assert( p->ts.eState==1 );\n      assert( iSavepoint>=0 );\n      assert( iSavepoint<=p->ts.iSavepoint );\n      p->ts.iSavepoint = iSavepoint;\n      break;\n  }\n}\n#else\n# define fts5CheckTransactionState(x,y,z)\n#endif\n\n/*\n** Return true if pTab is a contentless table.\n*/\nstatic int fts5IsContentless(Fts5Table *pTab){\n  return pTab->pConfig->eContent==FTS5_CONTENT_NONE;\n}\n\n/*\n** Delete a virtual table handle allocated by fts5InitVtab(). \n*/\nstatic void fts5FreeVtab(Fts5Table *pTab){\n  if( pTab ){\n    sqlite3Fts5IndexClose(pTab->pIndex);\n    sqlite3Fts5StorageClose(pTab->pStorage);\n    sqlite3Fts5ConfigFree(pTab->pConfig);\n    sqlite3_free(pTab);\n  }\n}\n\n/*\n** The xDisconnect() virtual table method.\n*/\nstatic int fts5DisconnectMethod(sqlite3_vtab *pVtab){\n  fts5FreeVtab((Fts5Table*)pVtab);\n  return SQLITE_OK;\n}\n\n/*\n** The xDestroy() virtual table method.\n*/\nstatic int fts5DestroyMethod(sqlite3_vtab *pVtab){\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  int rc = sqlite3Fts5DropAll(pTab->pConfig);\n  if( rc==SQLITE_OK ){\n    fts5FreeVtab((Fts5Table*)pVtab);\n  }\n  return rc;\n}\n\n/*\n** This function is the implementation of both the xConnect and xCreate\n** methods of the FTS3 virtual table.\n**\n** The argv[] array contains the following:\n**\n**   argv[0]   -> module name  (\"fts5\")\n**   argv[1]   -> database name\n**   argv[2]   -> table name\n**   argv[...] -> \"column name\" and other module argument fields.\n*/\nstatic int fts5InitVtab(\n  int bCreate,                    /* True for xCreate, false for xConnect */\n  sqlite3 *db,                    /* The SQLite database connection */\n  void *pAux,                     /* Hash table containing tokenizers */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVTab,          /* Write the resulting vtab structure here */\n  char **pzErr                    /* Write any error message here */\n){\n  Fts5Global *pGlobal = (Fts5Global*)pAux;\n  const char **azConfig = (const char**)argv;\n  int rc = SQLITE_OK;             /* Return code */\n  Fts5Config *pConfig = 0;        /* Results of parsing argc/argv */\n  Fts5Table *pTab = 0;            /* New virtual table object */\n\n  /* Allocate the new vtab object and parse the configuration */\n  pTab = (Fts5Table*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Table));\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5ConfigParse(pGlobal, db, argc, azConfig, &pConfig, pzErr);\n    assert( (rc==SQLITE_OK && *pzErr==0) || pConfig==0 );\n  }\n  if( rc==SQLITE_OK ){\n    pTab->pConfig = pConfig;\n    pTab->pGlobal = pGlobal;\n  }\n\n  /* Open the index sub-system */\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->pIndex, pzErr);\n  }\n\n  /* Open the storage sub-system */\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5StorageOpen(\n        pConfig, pTab->pIndex, bCreate, &pTab->pStorage, pzErr\n    );\n  }\n\n  /* Call sqlite3_declare_vtab() */\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5ConfigDeclareVtab(pConfig);\n  }\n\n  /* Load the initial configuration */\n  if( rc==SQLITE_OK ){\n    assert( pConfig->pzErrmsg==0 );\n    pConfig->pzErrmsg = pzErr;\n    rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);\n    sqlite3Fts5IndexRollback(pTab->pIndex);\n    pConfig->pzErrmsg = 0;\n  }\n\n  if( rc!=SQLITE_OK ){\n    fts5FreeVtab(pTab);\n    pTab = 0;\n  }else if( bCreate ){\n    fts5CheckTransactionState(pTab, FTS5_BEGIN, 0);\n  }\n  *ppVTab = (sqlite3_vtab*)pTab;\n  return rc;\n}\n\n/*\n** The xConnect() and xCreate() methods for the virtual table. All the\n** work is done in function fts5InitVtab().\n*/\nstatic int fts5ConnectMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pAux,                     /* Pointer to tokenizer hash table */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  return fts5InitVtab(0, db, pAux, argc, argv, ppVtab, pzErr);\n}\nstatic int fts5CreateMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pAux,                     /* Pointer to tokenizer hash table */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  return fts5InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr);\n}\n\n/*\n** The different query plans.\n*/\n#define FTS5_PLAN_MATCH          1       /* (<tbl> MATCH ?) */\n#define FTS5_PLAN_SOURCE         2       /* A source cursor for SORTED_MATCH */\n#define FTS5_PLAN_SPECIAL        3       /* An internal query */\n#define FTS5_PLAN_SORTED_MATCH   4       /* (<tbl> MATCH ? ORDER BY rank) */\n#define FTS5_PLAN_SCAN           5       /* No usable constraint */\n#define FTS5_PLAN_ROWID          6       /* (rowid = ?) */\n\n/*\n** Set the SQLITE_INDEX_SCAN_UNIQUE flag in pIdxInfo->flags. Unless this\n** extension is currently being used by a version of SQLite too old to\n** support index-info flags. In that case this function is a no-op.\n*/\nstatic void fts5SetUniqueFlag(sqlite3_index_info *pIdxInfo){\n#if SQLITE_VERSION_NUMBER>=3008012\n#ifndef SQLITE_CORE\n  if( sqlite3_libversion_number()>=3008012 )\n#endif\n  {\n    pIdxInfo->idxFlags |= SQLITE_INDEX_SCAN_UNIQUE;\n  }\n#endif\n}\n\n/*\n** Implementation of the xBestIndex method for FTS5 tables. Within the \n** WHERE constraint, it searches for the following:\n**\n**   1. A MATCH constraint against the special column.\n**   2. A MATCH constraint against the \"rank\" column.\n**   3. An == constraint against the rowid column.\n**   4. A < or <= constraint against the rowid column.\n**   5. A > or >= constraint against the rowid column.\n**\n** Within the ORDER BY, either:\n**\n**   5. ORDER BY rank [ASC|DESC]\n**   6. ORDER BY rowid [ASC|DESC]\n**\n** Costs are assigned as follows:\n**\n**  a) If an unusable MATCH operator is present in the WHERE clause, the\n**     cost is unconditionally set to 1e50 (a really big number).\n**\n**  a) If a MATCH operator is present, the cost depends on the other\n**     constraints also present. As follows:\n**\n**       * No other constraints:         cost=1000.0\n**       * One rowid range constraint:   cost=750.0\n**       * Both rowid range constraints: cost=500.0\n**       * An == rowid constraint:       cost=100.0\n**\n**  b) Otherwise, if there is no MATCH:\n**\n**       * No other constraints:         cost=1000000.0\n**       * One rowid range constraint:   cost=750000.0\n**       * Both rowid range constraints: cost=250000.0\n**       * An == rowid constraint:       cost=10.0\n**\n** Costs are not modified by the ORDER BY clause.\n*/\nstatic int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){\n  Fts5Table *pTab = (Fts5Table*)pVTab;\n  Fts5Config *pConfig = pTab->pConfig;\n  int idxFlags = 0;               /* Parameter passed through to xFilter() */\n  int bHasMatch;\n  int iNext;\n  int i;\n\n  struct Constraint {\n    int op;                       /* Mask against sqlite3_index_constraint.op */\n    int fts5op;                   /* FTS5 mask for idxFlags */\n    int iCol;                     /* 0==rowid, 1==tbl, 2==rank */\n    int omit;                     /* True to omit this if found */\n    int iConsIndex;               /* Index in pInfo->aConstraint[] */\n  } aConstraint[] = {\n    {SQLITE_INDEX_CONSTRAINT_MATCH|SQLITE_INDEX_CONSTRAINT_EQ, \n                                    FTS5_BI_MATCH,    1, 1, -1},\n    {SQLITE_INDEX_CONSTRAINT_MATCH|SQLITE_INDEX_CONSTRAINT_EQ, \n                                    FTS5_BI_RANK,     2, 1, -1},\n    {SQLITE_INDEX_CONSTRAINT_EQ,    FTS5_BI_ROWID_EQ, 0, 0, -1},\n    {SQLITE_INDEX_CONSTRAINT_LT|SQLITE_INDEX_CONSTRAINT_LE, \n                                    FTS5_BI_ROWID_LE, 0, 0, -1},\n    {SQLITE_INDEX_CONSTRAINT_GT|SQLITE_INDEX_CONSTRAINT_GE, \n                                    FTS5_BI_ROWID_GE, 0, 0, -1},\n  };\n\n  int aColMap[3];\n  aColMap[0] = -1;\n  aColMap[1] = pConfig->nCol;\n  aColMap[2] = pConfig->nCol+1;\n\n  /* Set idxFlags flags for all WHERE clause terms that will be used. */\n  for(i=0; i<pInfo->nConstraint; i++){\n    struct sqlite3_index_constraint *p = &pInfo->aConstraint[i];\n    int j;\n    for(j=0; j<ArraySize(aConstraint); j++){\n      struct Constraint *pC = &aConstraint[j];\n      if( p->iColumn==aColMap[pC->iCol] && p->op & pC->op ){\n        if( p->usable ){\n          pC->iConsIndex = i;\n          idxFlags |= pC->fts5op;\n        }else if( j==0 ){\n          /* As there exists an unusable MATCH constraint this is an \n          ** unusable plan. Set a prohibitively high cost. */\n          pInfo->estimatedCost = 1e50;\n          return SQLITE_OK;\n        }\n      }\n    }\n  }\n\n  /* Set idxFlags flags for the ORDER BY clause */\n  if( pInfo->nOrderBy==1 ){\n    int iSort = pInfo->aOrderBy[0].iColumn;\n    if( iSort==(pConfig->nCol+1) && BitFlagTest(idxFlags, FTS5_BI_MATCH) ){\n      idxFlags |= FTS5_BI_ORDER_RANK;\n    }else if( iSort==-1 ){\n      idxFlags |= FTS5_BI_ORDER_ROWID;\n    }\n    if( BitFlagTest(idxFlags, FTS5_BI_ORDER_RANK|FTS5_BI_ORDER_ROWID) ){\n      pInfo->orderByConsumed = 1;\n      if( pInfo->aOrderBy[0].desc ){\n        idxFlags |= FTS5_BI_ORDER_DESC;\n      }\n    }\n  }\n\n  /* Calculate the estimated cost based on the flags set in idxFlags. */\n  bHasMatch = BitFlagTest(idxFlags, FTS5_BI_MATCH);\n  if( BitFlagTest(idxFlags, FTS5_BI_ROWID_EQ) ){\n    pInfo->estimatedCost = bHasMatch ? 100.0 : 10.0;\n    if( bHasMatch==0 ) fts5SetUniqueFlag(pInfo);\n  }else if( BitFlagAllTest(idxFlags, FTS5_BI_ROWID_LE|FTS5_BI_ROWID_GE) ){\n    pInfo->estimatedCost = bHasMatch ? 500.0 : 250000.0;\n  }else if( BitFlagTest(idxFlags, FTS5_BI_ROWID_LE|FTS5_BI_ROWID_GE) ){\n    pInfo->estimatedCost = bHasMatch ? 750.0 : 750000.0;\n  }else{\n    pInfo->estimatedCost = bHasMatch ? 1000.0 : 1000000.0;\n  }\n\n  /* Assign argvIndex values to each constraint in use. */\n  iNext = 1;\n  for(i=0; i<ArraySize(aConstraint); i++){\n    struct Constraint *pC = &aConstraint[i];\n    if( pC->iConsIndex>=0 ){\n      pInfo->aConstraintUsage[pC->iConsIndex].argvIndex = iNext++;\n      pInfo->aConstraintUsage[pC->iConsIndex].omit = (unsigned char)pC->omit;\n    }\n  }\n\n  pInfo->idxNum = idxFlags;\n  return SQLITE_OK;\n}\n\nstatic int fts5NewTransaction(Fts5Table *pTab){\n  Fts5Cursor *pCsr;\n  for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){\n    if( pCsr->base.pVtab==(sqlite3_vtab*)pTab ) return SQLITE_OK;\n  }\n  return sqlite3Fts5StorageReset(pTab->pStorage);\n}\n\n/*\n** Implementation of xOpen method.\n*/\nstatic int fts5OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){\n  Fts5Table *pTab = (Fts5Table*)pVTab;\n  Fts5Config *pConfig = pTab->pConfig;\n  Fts5Cursor *pCsr = 0;           /* New cursor object */\n  int nByte;                      /* Bytes of space to allocate */\n  int rc;                         /* Return code */\n\n  rc = fts5NewTransaction(pTab);\n  if( rc==SQLITE_OK ){\n    nByte = sizeof(Fts5Cursor) + pConfig->nCol * sizeof(int);\n    pCsr = (Fts5Cursor*)sqlite3_malloc(nByte);\n    if( pCsr ){\n      Fts5Global *pGlobal = pTab->pGlobal;\n      memset(pCsr, 0, nByte);\n      pCsr->aColumnSize = (int*)&pCsr[1];\n      pCsr->pNext = pGlobal->pCsr;\n      pGlobal->pCsr = pCsr;\n      pCsr->iCsrId = ++pGlobal->iNextId;\n    }else{\n      rc = SQLITE_NOMEM;\n    }\n  }\n  *ppCsr = (sqlite3_vtab_cursor*)pCsr;\n  return rc;\n}\n\nstatic int fts5StmtType(Fts5Cursor *pCsr){\n  if( pCsr->ePlan==FTS5_PLAN_SCAN ){\n    return (pCsr->bDesc) ? FTS5_STMT_SCAN_DESC : FTS5_STMT_SCAN_ASC;\n  }\n  return FTS5_STMT_LOOKUP;\n}\n\n/*\n** This function is called after the cursor passed as the only argument\n** is moved to point at a different row. It clears all cached data \n** specific to the previous row stored by the cursor object.\n*/\nstatic void fts5CsrNewrow(Fts5Cursor *pCsr){\n  CsrFlagSet(pCsr, \n      FTS5CSR_REQUIRE_CONTENT \n    | FTS5CSR_REQUIRE_DOCSIZE \n    | FTS5CSR_REQUIRE_INST \n    | FTS5CSR_REQUIRE_POSLIST \n  );\n}\n\nstatic void fts5FreeCursorComponents(Fts5Cursor *pCsr){\n  Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n  Fts5Auxdata *pData;\n  Fts5Auxdata *pNext;\n\n  sqlite3_free(pCsr->aInstIter);\n  sqlite3_free(pCsr->aInst);\n  if( pCsr->pStmt ){\n    int eStmt = fts5StmtType(pCsr);\n    sqlite3Fts5StorageStmtRelease(pTab->pStorage, eStmt, pCsr->pStmt);\n  }\n  if( pCsr->pSorter ){\n    Fts5Sorter *pSorter = pCsr->pSorter;\n    sqlite3_finalize(pSorter->pStmt);\n    sqlite3_free(pSorter);\n  }\n\n  if( pCsr->ePlan!=FTS5_PLAN_SOURCE ){\n    sqlite3Fts5ExprFree(pCsr->pExpr);\n  }\n\n  for(pData=pCsr->pAuxdata; pData; pData=pNext){\n    pNext = pData->pNext;\n    if( pData->xDelete ) pData->xDelete(pData->pPtr);\n    sqlite3_free(pData);\n  }\n\n  sqlite3_finalize(pCsr->pRankArgStmt);\n  sqlite3_free(pCsr->apRankArg);\n\n  if( CsrFlagTest(pCsr, FTS5CSR_FREE_ZRANK) ){\n    sqlite3_free(pCsr->zRank);\n    sqlite3_free(pCsr->zRankArgs);\n  }\n\n  memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan - (u8*)pCsr));\n}\n\n\n/*\n** Close the cursor.  For additional information see the documentation\n** on the xClose method of the virtual table interface.\n*/\nstatic int fts5CloseMethod(sqlite3_vtab_cursor *pCursor){\n  if( pCursor ){\n    Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);\n    Fts5Cursor *pCsr = (Fts5Cursor*)pCursor;\n    Fts5Cursor **pp;\n\n    fts5FreeCursorComponents(pCsr);\n    /* Remove the cursor from the Fts5Global.pCsr list */\n    for(pp=&pTab->pGlobal->pCsr; (*pp)!=pCsr; pp=&(*pp)->pNext);\n    *pp = pCsr->pNext;\n\n    sqlite3_free(pCsr);\n  }\n  return SQLITE_OK;\n}\n\nstatic int fts5SorterNext(Fts5Cursor *pCsr){\n  Fts5Sorter *pSorter = pCsr->pSorter;\n  int rc;\n\n  rc = sqlite3_step(pSorter->pStmt);\n  if( rc==SQLITE_DONE ){\n    rc = SQLITE_OK;\n    CsrFlagSet(pCsr, FTS5CSR_EOF);\n  }else if( rc==SQLITE_ROW ){\n    const u8 *a;\n    const u8 *aBlob;\n    int nBlob;\n    int i;\n    int iOff = 0;\n    rc = SQLITE_OK;\n\n    pSorter->iRowid = sqlite3_column_int64(pSorter->pStmt, 0);\n    nBlob = sqlite3_column_bytes(pSorter->pStmt, 1);\n    aBlob = a = sqlite3_column_blob(pSorter->pStmt, 1);\n\n    /* nBlob==0 in detail=none mode. */\n    if( nBlob>0 ){\n      for(i=0; i<(pSorter->nIdx-1); i++){\n        int iVal;\n        a += fts5GetVarint32(a, iVal);\n        iOff += iVal;\n        pSorter->aIdx[i] = iOff;\n      }\n      pSorter->aIdx[i] = &aBlob[nBlob] - a;\n      pSorter->aPoslist = a;\n    }\n\n    fts5CsrNewrow(pCsr);\n  }\n\n  return rc;\n}\n\n\n/*\n** Set the FTS5CSR_REQUIRE_RESEEK flag on all FTS5_PLAN_MATCH cursors \n** open on table pTab.\n*/\nstatic void fts5TripCursors(Fts5Table *pTab){\n  Fts5Cursor *pCsr;\n  for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){\n    if( pCsr->ePlan==FTS5_PLAN_MATCH\n     && pCsr->base.pVtab==(sqlite3_vtab*)pTab \n    ){\n      CsrFlagSet(pCsr, FTS5CSR_REQUIRE_RESEEK);\n    }\n  }\n}\n\n/*\n** If the REQUIRE_RESEEK flag is set on the cursor passed as the first\n** argument, close and reopen all Fts5IndexIter iterators that the cursor \n** is using. Then attempt to move the cursor to a rowid equal to or laster\n** (in the cursors sort order - ASC or DESC) than the current rowid. \n**\n** If the new rowid is not equal to the old, set output parameter *pbSkip\n** to 1 before returning. Otherwise, leave it unchanged.\n**\n** Return SQLITE_OK if successful or if no reseek was required, or an \n** error code if an error occurred.\n*/\nstatic int fts5CursorReseek(Fts5Cursor *pCsr, int *pbSkip){\n  int rc = SQLITE_OK;\n  assert( *pbSkip==0 );\n  if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_RESEEK) ){\n    Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n    int bDesc = pCsr->bDesc;\n    i64 iRowid = sqlite3Fts5ExprRowid(pCsr->pExpr);\n\n    rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->pIndex, iRowid, bDesc);\n    if( rc==SQLITE_OK &&  iRowid!=sqlite3Fts5ExprRowid(pCsr->pExpr) ){\n      *pbSkip = 1;\n    }\n\n    CsrFlagClear(pCsr, FTS5CSR_REQUIRE_RESEEK);\n    fts5CsrNewrow(pCsr);\n    if( sqlite3Fts5ExprEof(pCsr->pExpr) ){\n      CsrFlagSet(pCsr, FTS5CSR_EOF);\n      *pbSkip = 1;\n    }\n  }\n  return rc;\n}\n\n\n/*\n** Advance the cursor to the next row in the table that matches the \n** search criteria.\n**\n** Return SQLITE_OK if nothing goes wrong.  SQLITE_OK is returned\n** even if we reach end-of-file.  The fts5EofMethod() will be called\n** subsequently to determine whether or not an EOF was hit.\n*/\nstatic int fts5NextMethod(sqlite3_vtab_cursor *pCursor){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCursor;\n  int rc;\n\n  assert( (pCsr->ePlan<3)==\n          (pCsr->ePlan==FTS5_PLAN_MATCH || pCsr->ePlan==FTS5_PLAN_SOURCE) \n  );\n  assert( !CsrFlagTest(pCsr, FTS5CSR_EOF) );\n\n  if( pCsr->ePlan<3 ){\n    int bSkip = 0;\n    if( (rc = fts5CursorReseek(pCsr, &bSkip)) || bSkip ) return rc;\n    rc = sqlite3Fts5ExprNext(pCsr->pExpr, pCsr->iLastRowid);\n    CsrFlagSet(pCsr, sqlite3Fts5ExprEof(pCsr->pExpr));\n    fts5CsrNewrow(pCsr);\n  }else{\n    switch( pCsr->ePlan ){\n      case FTS5_PLAN_SPECIAL: {\n        CsrFlagSet(pCsr, FTS5CSR_EOF);\n        rc = SQLITE_OK;\n        break;\n      }\n  \n      case FTS5_PLAN_SORTED_MATCH: {\n        rc = fts5SorterNext(pCsr);\n        break;\n      }\n  \n      default:\n        rc = sqlite3_step(pCsr->pStmt);\n        if( rc!=SQLITE_ROW ){\n          CsrFlagSet(pCsr, FTS5CSR_EOF);\n          rc = sqlite3_reset(pCsr->pStmt);\n        }else{\n          rc = SQLITE_OK;\n        }\n        break;\n    }\n  }\n  \n  return rc;\n}\n\n\nstatic int fts5PrepareStatement(\n  sqlite3_stmt **ppStmt,\n  Fts5Config *pConfig, \n  const char *zFmt,\n  ...\n){\n  sqlite3_stmt *pRet = 0;\n  int rc;\n  char *zSql;\n  va_list ap;\n\n  va_start(ap, zFmt);\n  zSql = sqlite3_vmprintf(zFmt, ap);\n  if( zSql==0 ){\n    rc = SQLITE_NOMEM; \n  }else{\n    rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pRet, 0);\n    if( rc!=SQLITE_OK ){\n      *pConfig->pzErrmsg = sqlite3_mprintf(\"%s\", sqlite3_errmsg(pConfig->db));\n    }\n    sqlite3_free(zSql);\n  }\n\n  va_end(ap);\n  *ppStmt = pRet;\n  return rc;\n} \n\nstatic int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){\n  Fts5Config *pConfig = pTab->pConfig;\n  Fts5Sorter *pSorter;\n  int nPhrase;\n  int nByte;\n  int rc;\n  const char *zRank = pCsr->zRank;\n  const char *zRankArgs = pCsr->zRankArgs;\n  \n  nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr);\n  nByte = sizeof(Fts5Sorter) + sizeof(int) * (nPhrase-1);\n  pSorter = (Fts5Sorter*)sqlite3_malloc(nByte);\n  if( pSorter==0 ) return SQLITE_NOMEM;\n  memset(pSorter, 0, nByte);\n  pSorter->nIdx = nPhrase;\n\n  /* TODO: It would be better to have some system for reusing statement\n  ** handles here, rather than preparing a new one for each query. But that\n  ** is not possible as SQLite reference counts the virtual table objects.\n  ** And since the statement required here reads from this very virtual \n  ** table, saving it creates a circular reference.\n  **\n  ** If SQLite a built-in statement cache, this wouldn't be a problem. */\n  rc = fts5PrepareStatement(&pSorter->pStmt, pConfig,\n      \"SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s\",\n      pConfig->zDb, pConfig->zName, zRank, pConfig->zName,\n      (zRankArgs ? \", \" : \"\"),\n      (zRankArgs ? zRankArgs : \"\"),\n      bDesc ? \"DESC\" : \"ASC\"\n  );\n\n  pCsr->pSorter = pSorter;\n  if( rc==SQLITE_OK ){\n    assert( pTab->pSortCsr==0 );\n    pTab->pSortCsr = pCsr;\n    rc = fts5SorterNext(pCsr);\n    pTab->pSortCsr = 0;\n  }\n\n  if( rc!=SQLITE_OK ){\n    sqlite3_finalize(pSorter->pStmt);\n    sqlite3_free(pSorter);\n    pCsr->pSorter = 0;\n  }\n\n  return rc;\n}\n\nstatic int fts5CursorFirst(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){\n  int rc;\n  Fts5Expr *pExpr = pCsr->pExpr;\n  rc = sqlite3Fts5ExprFirst(pExpr, pTab->pIndex, pCsr->iFirstRowid, bDesc);\n  if( sqlite3Fts5ExprEof(pExpr) ){\n    CsrFlagSet(pCsr, FTS5CSR_EOF);\n  }\n  fts5CsrNewrow(pCsr);\n  return rc;\n}\n\n/*\n** Process a \"special\" query. A special query is identified as one with a\n** MATCH expression that begins with a '*' character. The remainder of\n** the text passed to the MATCH operator are used as  the special query\n** parameters.\n*/\nstatic int fts5SpecialMatch(\n  Fts5Table *pTab, \n  Fts5Cursor *pCsr, \n  const char *zQuery\n){\n  int rc = SQLITE_OK;             /* Return code */\n  const char *z = zQuery;         /* Special query text */\n  int n;                          /* Number of bytes in text at z */\n\n  while( z[0]==' ' ) z++;\n  for(n=0; z[n] && z[n]!=' '; n++);\n\n  assert( pTab->base.zErrMsg==0 );\n  pCsr->ePlan = FTS5_PLAN_SPECIAL;\n\n  if( 0==sqlite3_strnicmp(\"reads\", z, n) ){\n    pCsr->iSpecial = sqlite3Fts5IndexReads(pTab->pIndex);\n  }\n  else if( 0==sqlite3_strnicmp(\"id\", z, n) ){\n    pCsr->iSpecial = pCsr->iCsrId;\n  }\n  else{\n    /* An unrecognized directive. Return an error message. */\n    pTab->base.zErrMsg = sqlite3_mprintf(\"unknown special query: %.*s\", n, z);\n    rc = SQLITE_ERROR;\n  }\n\n  return rc;\n}\n\n/*\n** Search for an auxiliary function named zName that can be used with table\n** pTab. If one is found, return a pointer to the corresponding Fts5Auxiliary\n** structure. Otherwise, if no such function exists, return NULL.\n*/\nstatic Fts5Auxiliary *fts5FindAuxiliary(Fts5Table *pTab, const char *zName){\n  Fts5Auxiliary *pAux;\n\n  for(pAux=pTab->pGlobal->pAux; pAux; pAux=pAux->pNext){\n    if( sqlite3_stricmp(zName, pAux->zFunc)==0 ) return pAux;\n  }\n\n  /* No function of the specified name was found. Return 0. */\n  return 0;\n}\n\n\nstatic int fts5FindRankFunction(Fts5Cursor *pCsr){\n  Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n  Fts5Config *pConfig = pTab->pConfig;\n  int rc = SQLITE_OK;\n  Fts5Auxiliary *pAux = 0;\n  const char *zRank = pCsr->zRank;\n  const char *zRankArgs = pCsr->zRankArgs;\n\n  if( zRankArgs ){\n    char *zSql = sqlite3Fts5Mprintf(&rc, \"SELECT %s\", zRankArgs);\n    if( zSql ){\n      sqlite3_stmt *pStmt = 0;\n      rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pStmt, 0);\n      sqlite3_free(zSql);\n      assert( rc==SQLITE_OK || pCsr->pRankArgStmt==0 );\n      if( rc==SQLITE_OK ){\n        if( SQLITE_ROW==sqlite3_step(pStmt) ){\n          int nByte;\n          pCsr->nRankArg = sqlite3_column_count(pStmt);\n          nByte = sizeof(sqlite3_value*)*pCsr->nRankArg;\n          pCsr->apRankArg = (sqlite3_value**)sqlite3Fts5MallocZero(&rc, nByte);\n          if( rc==SQLITE_OK ){\n            int i;\n            for(i=0; i<pCsr->nRankArg; i++){\n              pCsr->apRankArg[i] = sqlite3_column_value(pStmt, i);\n            }\n          }\n          pCsr->pRankArgStmt = pStmt;\n        }else{\n          rc = sqlite3_finalize(pStmt);\n          assert( rc!=SQLITE_OK );\n        }\n      }\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    pAux = fts5FindAuxiliary(pTab, zRank);\n    if( pAux==0 ){\n      assert( pTab->base.zErrMsg==0 );\n      pTab->base.zErrMsg = sqlite3_mprintf(\"no such function: %s\", zRank);\n      rc = SQLITE_ERROR;\n    }\n  }\n\n  pCsr->pRank = pAux;\n  return rc;\n}\n\n\nstatic int fts5CursorParseRank(\n  Fts5Config *pConfig,\n  Fts5Cursor *pCsr, \n  sqlite3_value *pRank\n){\n  int rc = SQLITE_OK;\n  if( pRank ){\n    const char *z = (const char*)sqlite3_value_text(pRank);\n    char *zRank = 0;\n    char *zRankArgs = 0;\n\n    if( z==0 ){\n      if( sqlite3_value_type(pRank)==SQLITE_NULL ) rc = SQLITE_ERROR;\n    }else{\n      rc = sqlite3Fts5ConfigParseRank(z, &zRank, &zRankArgs);\n    }\n    if( rc==SQLITE_OK ){\n      pCsr->zRank = zRank;\n      pCsr->zRankArgs = zRankArgs;\n      CsrFlagSet(pCsr, FTS5CSR_FREE_ZRANK);\n    }else if( rc==SQLITE_ERROR ){\n      pCsr->base.pVtab->zErrMsg = sqlite3_mprintf(\n          \"parse error in rank function: %s\", z\n      );\n    }\n  }else{\n    if( pConfig->zRank ){\n      pCsr->zRank = (char*)pConfig->zRank;\n      pCsr->zRankArgs = (char*)pConfig->zRankArgs;\n    }else{\n      pCsr->zRank = (char*)FTS5_DEFAULT_RANK;\n      pCsr->zRankArgs = 0;\n    }\n  }\n  return rc;\n}\n\nstatic i64 fts5GetRowidLimit(sqlite3_value *pVal, i64 iDefault){\n  if( pVal ){\n    int eType = sqlite3_value_numeric_type(pVal);\n    if( eType==SQLITE_INTEGER ){\n      return sqlite3_value_int64(pVal);\n    }\n  }\n  return iDefault;\n}\n\n/*\n** This is the xFilter interface for the virtual table.  See\n** the virtual table xFilter method documentation for additional\n** information.\n** \n** There are three possible query strategies:\n**\n**   1. Full-text search using a MATCH operator.\n**   2. A by-rowid lookup.\n**   3. A full-table scan.\n*/\nstatic int fts5FilterMethod(\n  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */\n  int idxNum,                     /* Strategy index */\n  const char *zUnused,            /* Unused */\n  int nVal,                       /* Number of elements in apVal */\n  sqlite3_value **apVal           /* Arguments for the indexing scheme */\n){\n  Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);\n  Fts5Config *pConfig = pTab->pConfig;\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCursor;\n  int rc = SQLITE_OK;             /* Error code */\n  int iVal = 0;                   /* Counter for apVal[] */\n  int bDesc;                      /* True if ORDER BY [rank|rowid] DESC */\n  int bOrderByRank;               /* True if ORDER BY rank */\n  sqlite3_value *pMatch = 0;      /* <tbl> MATCH ? expression (or NULL) */\n  sqlite3_value *pRank = 0;       /* rank MATCH ? expression (or NULL) */\n  sqlite3_value *pRowidEq = 0;    /* rowid = ? expression (or NULL) */\n  sqlite3_value *pRowidLe = 0;    /* rowid <= ? expression (or NULL) */\n  sqlite3_value *pRowidGe = 0;    /* rowid >= ? expression (or NULL) */\n  char **pzErrmsg = pConfig->pzErrmsg;\n\n  UNUSED_PARAM(zUnused);\n  UNUSED_PARAM(nVal);\n\n  if( pCsr->ePlan ){\n    fts5FreeCursorComponents(pCsr);\n    memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan-(u8*)pCsr));\n  }\n\n  assert( pCsr->pStmt==0 );\n  assert( pCsr->pExpr==0 );\n  assert( pCsr->csrflags==0 );\n  assert( pCsr->pRank==0 );\n  assert( pCsr->zRank==0 );\n  assert( pCsr->zRankArgs==0 );\n\n  assert( pzErrmsg==0 || pzErrmsg==&pTab->base.zErrMsg );\n  pConfig->pzErrmsg = &pTab->base.zErrMsg;\n\n  /* Decode the arguments passed through to this function.\n  **\n  ** Note: The following set of if(...) statements must be in the same\n  ** order as the corresponding entries in the struct at the top of\n  ** fts5BestIndexMethod().  */\n  if( BitFlagTest(idxNum, FTS5_BI_MATCH) ) pMatch = apVal[iVal++];\n  if( BitFlagTest(idxNum, FTS5_BI_RANK) ) pRank = apVal[iVal++];\n  if( BitFlagTest(idxNum, FTS5_BI_ROWID_EQ) ) pRowidEq = apVal[iVal++];\n  if( BitFlagTest(idxNum, FTS5_BI_ROWID_LE) ) pRowidLe = apVal[iVal++];\n  if( BitFlagTest(idxNum, FTS5_BI_ROWID_GE) ) pRowidGe = apVal[iVal++];\n  assert( iVal==nVal );\n  bOrderByRank = ((idxNum & FTS5_BI_ORDER_RANK) ? 1 : 0);\n  pCsr->bDesc = bDesc = ((idxNum & FTS5_BI_ORDER_DESC) ? 1 : 0);\n\n  /* Set the cursor upper and lower rowid limits. Only some strategies \n  ** actually use them. This is ok, as the xBestIndex() method leaves the\n  ** sqlite3_index_constraint.omit flag clear for range constraints\n  ** on the rowid field.  */\n  if( pRowidEq ){\n    pRowidLe = pRowidGe = pRowidEq;\n  }\n  if( bDesc ){\n    pCsr->iFirstRowid = fts5GetRowidLimit(pRowidLe, LARGEST_INT64);\n    pCsr->iLastRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64);\n  }else{\n    pCsr->iLastRowid = fts5GetRowidLimit(pRowidLe, LARGEST_INT64);\n    pCsr->iFirstRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64);\n  }\n\n  if( pTab->pSortCsr ){\n    /* If pSortCsr is non-NULL, then this call is being made as part of \n    ** processing for a \"... MATCH <expr> ORDER BY rank\" query (ePlan is\n    ** set to FTS5_PLAN_SORTED_MATCH). pSortCsr is the cursor that will\n    ** return results to the user for this query. The current cursor \n    ** (pCursor) is used to execute the query issued by function \n    ** fts5CursorFirstSorted() above.  */\n    assert( pRowidEq==0 && pRowidLe==0 && pRowidGe==0 && pRank==0 );\n    assert( nVal==0 && pMatch==0 && bOrderByRank==0 && bDesc==0 );\n    assert( pCsr->iLastRowid==LARGEST_INT64 );\n    assert( pCsr->iFirstRowid==SMALLEST_INT64 );\n    pCsr->ePlan = FTS5_PLAN_SOURCE;\n    pCsr->pExpr = pTab->pSortCsr->pExpr;\n    rc = fts5CursorFirst(pTab, pCsr, bDesc);\n  }else if( pMatch ){\n    const char *zExpr = (const char*)sqlite3_value_text(apVal[0]);\n    if( zExpr==0 ) zExpr = \"\";\n\n    rc = fts5CursorParseRank(pConfig, pCsr, pRank);\n    if( rc==SQLITE_OK ){\n      if( zExpr[0]=='*' ){\n        /* The user has issued a query of the form \"MATCH '*...'\". This\n        ** indicates that the MATCH expression is not a full text query,\n        ** but a request for an internal parameter.  */\n        rc = fts5SpecialMatch(pTab, pCsr, &zExpr[1]);\n      }else{\n        char **pzErr = &pTab->base.zErrMsg;\n        rc = sqlite3Fts5ExprNew(pConfig, zExpr, &pCsr->pExpr, pzErr);\n        if( rc==SQLITE_OK ){\n          if( bOrderByRank ){\n            pCsr->ePlan = FTS5_PLAN_SORTED_MATCH;\n            rc = fts5CursorFirstSorted(pTab, pCsr, bDesc);\n          }else{\n            pCsr->ePlan = FTS5_PLAN_MATCH;\n            rc = fts5CursorFirst(pTab, pCsr, bDesc);\n          }\n        }\n      }\n    }\n  }else if( pConfig->zContent==0 ){\n    *pConfig->pzErrmsg = sqlite3_mprintf(\n        \"%s: table does not support scanning\", pConfig->zName\n    );\n    rc = SQLITE_ERROR;\n  }else{\n    /* This is either a full-table scan (ePlan==FTS5_PLAN_SCAN) or a lookup\n    ** by rowid (ePlan==FTS5_PLAN_ROWID).  */\n    pCsr->ePlan = (pRowidEq ? FTS5_PLAN_ROWID : FTS5_PLAN_SCAN);\n    rc = sqlite3Fts5StorageStmt(\n        pTab->pStorage, fts5StmtType(pCsr), &pCsr->pStmt, &pTab->base.zErrMsg\n    );\n    if( rc==SQLITE_OK ){\n      if( pCsr->ePlan==FTS5_PLAN_ROWID ){\n        sqlite3_bind_value(pCsr->pStmt, 1, apVal[0]);\n      }else{\n        sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iFirstRowid);\n        sqlite3_bind_int64(pCsr->pStmt, 2, pCsr->iLastRowid);\n      }\n      rc = fts5NextMethod(pCursor);\n    }\n  }\n\n  pConfig->pzErrmsg = pzErrmsg;\n  return rc;\n}\n\n/* \n** This is the xEof method of the virtual table. SQLite calls this \n** routine to find out if it has reached the end of a result set.\n*/\nstatic int fts5EofMethod(sqlite3_vtab_cursor *pCursor){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCursor;\n  return (CsrFlagTest(pCsr, FTS5CSR_EOF) ? 1 : 0);\n}\n\n/*\n** Return the rowid that the cursor currently points to.\n*/\nstatic i64 fts5CursorRowid(Fts5Cursor *pCsr){\n  assert( pCsr->ePlan==FTS5_PLAN_MATCH \n       || pCsr->ePlan==FTS5_PLAN_SORTED_MATCH \n       || pCsr->ePlan==FTS5_PLAN_SOURCE \n  );\n  if( pCsr->pSorter ){\n    return pCsr->pSorter->iRowid;\n  }else{\n    return sqlite3Fts5ExprRowid(pCsr->pExpr);\n  }\n}\n\n/* \n** This is the xRowid method. The SQLite core calls this routine to\n** retrieve the rowid for the current row of the result set. fts5\n** exposes %_content.rowid as the rowid for the virtual table. The\n** rowid should be written to *pRowid.\n*/\nstatic int fts5RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCursor;\n  int ePlan = pCsr->ePlan;\n  \n  assert( CsrFlagTest(pCsr, FTS5CSR_EOF)==0 );\n  switch( ePlan ){\n    case FTS5_PLAN_SPECIAL:\n      *pRowid = 0;\n      break;\n\n    case FTS5_PLAN_SOURCE:\n    case FTS5_PLAN_MATCH:\n    case FTS5_PLAN_SORTED_MATCH:\n      *pRowid = fts5CursorRowid(pCsr);\n      break;\n\n    default:\n      *pRowid = sqlite3_column_int64(pCsr->pStmt, 0);\n      break;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** If the cursor requires seeking (bSeekRequired flag is set), seek it.\n** Return SQLITE_OK if no error occurs, or an SQLite error code otherwise.\n**\n** If argument bErrormsg is true and an error occurs, an error message may\n** be left in sqlite3_vtab.zErrMsg.\n*/\nstatic int fts5SeekCursor(Fts5Cursor *pCsr, int bErrormsg){\n  int rc = SQLITE_OK;\n\n  /* If the cursor does not yet have a statement handle, obtain one now. */ \n  if( pCsr->pStmt==0 ){\n    Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n    int eStmt = fts5StmtType(pCsr);\n    rc = sqlite3Fts5StorageStmt(\n        pTab->pStorage, eStmt, &pCsr->pStmt, (bErrormsg?&pTab->base.zErrMsg:0)\n    );\n    assert( rc!=SQLITE_OK || pTab->base.zErrMsg==0 );\n    assert( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) );\n  }\n\n  if( rc==SQLITE_OK && CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) ){\n    assert( pCsr->pExpr );\n    sqlite3_reset(pCsr->pStmt);\n    sqlite3_bind_int64(pCsr->pStmt, 1, fts5CursorRowid(pCsr));\n    rc = sqlite3_step(pCsr->pStmt);\n    if( rc==SQLITE_ROW ){\n      rc = SQLITE_OK;\n      CsrFlagClear(pCsr, FTS5CSR_REQUIRE_CONTENT);\n    }else{\n      rc = sqlite3_reset(pCsr->pStmt);\n      if( rc==SQLITE_OK ){\n        rc = FTS5_CORRUPT;\n      }\n    }\n  }\n  return rc;\n}\n\nstatic void fts5SetVtabError(Fts5Table *p, const char *zFormat, ...){\n  va_list ap;                     /* ... printf arguments */\n  va_start(ap, zFormat);\n  assert( p->base.zErrMsg==0 );\n  p->base.zErrMsg = sqlite3_vmprintf(zFormat, ap);\n  va_end(ap);\n}\n\n/*\n** This function is called to handle an FTS INSERT command. In other words,\n** an INSERT statement of the form:\n**\n**     INSERT INTO fts(fts) VALUES($pCmd)\n**     INSERT INTO fts(fts, rank) VALUES($pCmd, $pVal)\n**\n** Argument pVal is the value assigned to column \"fts\" by the INSERT \n** statement. This function returns SQLITE_OK if successful, or an SQLite\n** error code if an error occurs.\n**\n** The commands implemented by this function are documented in the \"Special\n** INSERT Directives\" section of the documentation. It should be updated if\n** more commands are added to this function.\n*/\nstatic int fts5SpecialInsert(\n  Fts5Table *pTab,                /* Fts5 table object */\n  const char *zCmd,               /* Text inserted into table-name column */\n  sqlite3_value *pVal             /* Value inserted into rank column */\n){\n  Fts5Config *pConfig = pTab->pConfig;\n  int rc = SQLITE_OK;\n  int bError = 0;\n\n  if( 0==sqlite3_stricmp(\"delete-all\", zCmd) ){\n    if( pConfig->eContent==FTS5_CONTENT_NORMAL ){\n      fts5SetVtabError(pTab, \n          \"'delete-all' may only be used with a \"\n          \"contentless or external content fts5 table\"\n      );\n      rc = SQLITE_ERROR;\n    }else{\n      rc = sqlite3Fts5StorageDeleteAll(pTab->pStorage);\n    }\n  }else if( 0==sqlite3_stricmp(\"rebuild\", zCmd) ){\n    if( pConfig->eContent==FTS5_CONTENT_NONE ){\n      fts5SetVtabError(pTab, \n          \"'rebuild' may not be used with a contentless fts5 table\"\n      );\n      rc = SQLITE_ERROR;\n    }else{\n      rc = sqlite3Fts5StorageRebuild(pTab->pStorage);\n    }\n  }else if( 0==sqlite3_stricmp(\"optimize\", zCmd) ){\n    rc = sqlite3Fts5StorageOptimize(pTab->pStorage);\n  }else if( 0==sqlite3_stricmp(\"merge\", zCmd) ){\n    int nMerge = sqlite3_value_int(pVal);\n    rc = sqlite3Fts5StorageMerge(pTab->pStorage, nMerge);\n  }else if( 0==sqlite3_stricmp(\"integrity-check\", zCmd) ){\n    rc = sqlite3Fts5StorageIntegrity(pTab->pStorage);\n#ifdef SQLITE_DEBUG\n  }else if( 0==sqlite3_stricmp(\"prefix-index\", zCmd) ){\n    pConfig->bPrefixIndex = sqlite3_value_int(pVal);\n#endif\n  }else{\n    rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts5ConfigSetValue(pTab->pConfig, zCmd, pVal, &bError);\n    }\n    if( rc==SQLITE_OK ){\n      if( bError ){\n        rc = SQLITE_ERROR;\n      }else{\n        rc = sqlite3Fts5StorageConfigValue(pTab->pStorage, zCmd, pVal, 0);\n      }\n    }\n  }\n  return rc;\n}\n\nstatic int fts5SpecialDelete(\n  Fts5Table *pTab, \n  sqlite3_value **apVal\n){\n  int rc = SQLITE_OK;\n  int eType1 = sqlite3_value_type(apVal[1]);\n  if( eType1==SQLITE_INTEGER ){\n    sqlite3_int64 iDel = sqlite3_value_int64(apVal[1]);\n    rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, &apVal[2]);\n  }\n  return rc;\n}\n\nstatic void fts5StorageInsert(\n  int *pRc, \n  Fts5Table *pTab, \n  sqlite3_value **apVal, \n  i64 *piRowid\n){\n  int rc = *pRc;\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, piRowid);\n  }\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *piRowid);\n  }\n  *pRc = rc;\n}\n\n/* \n** This function is the implementation of the xUpdate callback used by \n** FTS3 virtual tables. It is invoked by SQLite each time a row is to be\n** inserted, updated or deleted.\n**\n** A delete specifies a single argument - the rowid of the row to remove.\n** \n** Update and insert operations pass:\n**\n**   1. The \"old\" rowid, or NULL.\n**   2. The \"new\" rowid.\n**   3. Values for each of the nCol matchable columns.\n**   4. Values for the two hidden columns (<tablename> and \"rank\").\n*/\nstatic int fts5UpdateMethod(\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\n  int nArg,                       /* Size of argument array */\n  sqlite3_value **apVal,          /* Array of arguments */\n  sqlite_int64 *pRowid            /* OUT: The affected (or effected) rowid */\n){\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  Fts5Config *pConfig = pTab->pConfig;\n  int eType0;                     /* value_type() of apVal[0] */\n  int rc = SQLITE_OK;             /* Return code */\n\n  /* A transaction must be open when this is called. */\n  assert( pTab->ts.eState==1 );\n\n  assert( pVtab->zErrMsg==0 );\n  assert( nArg==1 || nArg==(2+pConfig->nCol+2) );\n  assert( nArg==1 \n      || sqlite3_value_type(apVal[1])==SQLITE_INTEGER \n      || sqlite3_value_type(apVal[1])==SQLITE_NULL \n  );\n  assert( pTab->pConfig->pzErrmsg==0 );\n  pTab->pConfig->pzErrmsg = &pTab->base.zErrMsg;\n\n  /* Put any active cursors into REQUIRE_SEEK state. */\n  fts5TripCursors(pTab);\n\n  eType0 = sqlite3_value_type(apVal[0]);\n  if( eType0==SQLITE_NULL \n   && sqlite3_value_type(apVal[2+pConfig->nCol])!=SQLITE_NULL \n  ){\n    /* A \"special\" INSERT op. These are handled separately. */\n    const char *z = (const char*)sqlite3_value_text(apVal[2+pConfig->nCol]);\n    if( pConfig->eContent!=FTS5_CONTENT_NORMAL \n      && 0==sqlite3_stricmp(\"delete\", z) \n    ){\n      rc = fts5SpecialDelete(pTab, apVal);\n    }else{\n      rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);\n    }\n  }else{\n    /* A regular INSERT, UPDATE or DELETE statement. The trick here is that\n    ** any conflict on the rowid value must be detected before any \n    ** modifications are made to the database file. There are 4 cases:\n    **\n    **   1) DELETE\n    **   2) UPDATE (rowid not modified)\n    **   3) UPDATE (rowid modified)\n    **   4) INSERT\n    **\n    ** Cases 3 and 4 may violate the rowid constraint.\n    */\n    int eConflict = SQLITE_ABORT;\n    if( pConfig->eContent==FTS5_CONTENT_NORMAL ){\n      eConflict = sqlite3_vtab_on_conflict(pConfig->db);\n    }\n\n    assert( eType0==SQLITE_INTEGER || eType0==SQLITE_NULL );\n    assert( nArg!=1 || eType0==SQLITE_INTEGER );\n\n    /* Filter out attempts to run UPDATE or DELETE on contentless tables.\n    ** This is not suported.  */\n    if( eType0==SQLITE_INTEGER && fts5IsContentless(pTab) ){\n      pTab->base.zErrMsg = sqlite3_mprintf(\n          \"cannot %s contentless fts5 table: %s\", \n          (nArg>1 ? \"UPDATE\" : \"DELETE from\"), pConfig->zName\n      );\n      rc = SQLITE_ERROR;\n    }\n\n    /* DELETE */\n    else if( nArg==1 ){\n      i64 iDel = sqlite3_value_int64(apVal[0]);  /* Rowid to delete */\n      rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel, 0);\n    }\n\n    /* INSERT */\n    else if( eType0!=SQLITE_INTEGER ){     \n      /* If this is a REPLACE, first remove the current entry (if any) */\n      if( eConflict==SQLITE_REPLACE \n       && sqlite3_value_type(apVal[1])==SQLITE_INTEGER \n      ){\n        i64 iNew = sqlite3_value_int64(apVal[1]);  /* Rowid to delete */\n        rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0);\n      }\n      fts5StorageInsert(&rc, pTab, apVal, pRowid);\n    }\n\n    /* UPDATE */\n    else{\n      i64 iOld = sqlite3_value_int64(apVal[0]);  /* Old rowid */\n      i64 iNew = sqlite3_value_int64(apVal[1]);  /* New rowid */\n      if( iOld!=iNew ){\n        if( eConflict==SQLITE_REPLACE ){\n          rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0);\n          if( rc==SQLITE_OK ){\n            rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0);\n          }\n          fts5StorageInsert(&rc, pTab, apVal, pRowid);\n        }else{\n          rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, pRowid);\n          if( rc==SQLITE_OK ){\n            rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0);\n          }\n          if( rc==SQLITE_OK ){\n            rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *pRowid);\n          }\n        }\n      }else{\n        rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld, 0);\n        fts5StorageInsert(&rc, pTab, apVal, pRowid);\n      }\n    }\n  }\n\n  pTab->pConfig->pzErrmsg = 0;\n  return rc;\n}\n\n/*\n** Implementation of xSync() method. \n*/\nstatic int fts5SyncMethod(sqlite3_vtab *pVtab){\n  int rc;\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  fts5CheckTransactionState(pTab, FTS5_SYNC, 0);\n  pTab->pConfig->pzErrmsg = &pTab->base.zErrMsg;\n  fts5TripCursors(pTab);\n  rc = sqlite3Fts5StorageSync(pTab->pStorage, 1);\n  pTab->pConfig->pzErrmsg = 0;\n  return rc;\n}\n\n/*\n** Implementation of xBegin() method. \n*/\nstatic int fts5BeginMethod(sqlite3_vtab *pVtab){\n  fts5CheckTransactionState((Fts5Table*)pVtab, FTS5_BEGIN, 0);\n  fts5NewTransaction((Fts5Table*)pVtab);\n  return SQLITE_OK;\n}\n\n/*\n** Implementation of xCommit() method. This is a no-op. The contents of\n** the pending-terms hash-table have already been flushed into the database\n** by fts5SyncMethod().\n*/\nstatic int fts5CommitMethod(sqlite3_vtab *pVtab){\n  UNUSED_PARAM(pVtab);  /* Call below is a no-op for NDEBUG builds */\n  fts5CheckTransactionState((Fts5Table*)pVtab, FTS5_COMMIT, 0);\n  return SQLITE_OK;\n}\n\n/*\n** Implementation of xRollback(). Discard the contents of the pending-terms\n** hash-table. Any changes made to the database are reverted by SQLite.\n*/\nstatic int fts5RollbackMethod(sqlite3_vtab *pVtab){\n  int rc;\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0);\n  rc = sqlite3Fts5StorageRollback(pTab->pStorage);\n  return rc;\n}\n\nstatic int fts5CsrPoslist(Fts5Cursor*, int, const u8**, int*);\n\nstatic void *fts5ApiUserData(Fts5Context *pCtx){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  return pCsr->pAux->pUserData;\n}\n\nstatic int fts5ApiColumnCount(Fts5Context *pCtx){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  return ((Fts5Table*)(pCsr->base.pVtab))->pConfig->nCol;\n}\n\nstatic int fts5ApiColumnTotalSize(\n  Fts5Context *pCtx, \n  int iCol, \n  sqlite3_int64 *pnToken\n){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n  return sqlite3Fts5StorageSize(pTab->pStorage, iCol, pnToken);\n}\n\nstatic int fts5ApiRowCount(Fts5Context *pCtx, i64 *pnRow){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n  return sqlite3Fts5StorageRowCount(pTab->pStorage, pnRow);\n}\n\nstatic int fts5ApiTokenize(\n  Fts5Context *pCtx, \n  const char *pText, int nText, \n  void *pUserData,\n  int (*xToken)(void*, int, const char*, int, int, int)\n){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n  return sqlite3Fts5Tokenize(\n      pTab->pConfig, FTS5_TOKENIZE_AUX, pText, nText, pUserData, xToken\n  );\n}\n\nstatic int fts5ApiPhraseCount(Fts5Context *pCtx){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  return sqlite3Fts5ExprPhraseCount(pCsr->pExpr);\n}\n\nstatic int fts5ApiPhraseSize(Fts5Context *pCtx, int iPhrase){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  return sqlite3Fts5ExprPhraseSize(pCsr->pExpr, iPhrase);\n}\n\nstatic int fts5ApiColumnText(\n  Fts5Context *pCtx, \n  int iCol, \n  const char **pz, \n  int *pn\n){\n  int rc = SQLITE_OK;\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  if( fts5IsContentless((Fts5Table*)(pCsr->base.pVtab)) ){\n    *pz = 0;\n    *pn = 0;\n  }else{\n    rc = fts5SeekCursor(pCsr, 0);\n    if( rc==SQLITE_OK ){\n      *pz = (const char*)sqlite3_column_text(pCsr->pStmt, iCol+1);\n      *pn = sqlite3_column_bytes(pCsr->pStmt, iCol+1);\n    }\n  }\n  return rc;\n}\n\nstatic int fts5CsrPoslist(\n  Fts5Cursor *pCsr, \n  int iPhrase, \n  const u8 **pa,\n  int *pn\n){\n  Fts5Config *pConfig = ((Fts5Table*)(pCsr->base.pVtab))->pConfig;\n  int rc = SQLITE_OK;\n  int bLive = (pCsr->pSorter==0);\n\n  if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_POSLIST) ){\n\n    if( pConfig->eDetail!=FTS5_DETAIL_FULL ){\n      Fts5PoslistPopulator *aPopulator;\n      int i;\n      aPopulator = sqlite3Fts5ExprClearPoslists(pCsr->pExpr, bLive);\n      if( aPopulator==0 ) rc = SQLITE_NOMEM;\n      for(i=0; i<pConfig->nCol && rc==SQLITE_OK; i++){\n        int n; const char *z;\n        rc = fts5ApiColumnText((Fts5Context*)pCsr, i, &z, &n);\n        if( rc==SQLITE_OK ){\n          rc = sqlite3Fts5ExprPopulatePoslists(\n              pConfig, pCsr->pExpr, aPopulator, i, z, n\n          );\n        }\n      }\n      sqlite3_free(aPopulator);\n\n      if( pCsr->pSorter ){\n        sqlite3Fts5ExprCheckPoslists(pCsr->pExpr, pCsr->pSorter->iRowid);\n      }\n    }\n    CsrFlagClear(pCsr, FTS5CSR_REQUIRE_POSLIST);\n  }\n\n  if( pCsr->pSorter && pConfig->eDetail==FTS5_DETAIL_FULL ){\n    Fts5Sorter *pSorter = pCsr->pSorter;\n    int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]);\n    *pn = pSorter->aIdx[iPhrase] - i1;\n    *pa = &pSorter->aPoslist[i1];\n  }else{\n    *pn = sqlite3Fts5ExprPoslist(pCsr->pExpr, iPhrase, pa);\n  }\n\n  return rc;\n}\n\n/*\n** Ensure that the Fts5Cursor.nInstCount and aInst[] variables are populated\n** correctly for the current view. Return SQLITE_OK if successful, or an\n** SQLite error code otherwise.\n*/\nstatic int fts5CacheInstArray(Fts5Cursor *pCsr){\n  int rc = SQLITE_OK;\n  Fts5PoslistReader *aIter;       /* One iterator for each phrase */\n  int nIter;                      /* Number of iterators/phrases */\n  \n  nIter = sqlite3Fts5ExprPhraseCount(pCsr->pExpr);\n  if( pCsr->aInstIter==0 ){\n    int nByte = sizeof(Fts5PoslistReader) * nIter;\n    pCsr->aInstIter = (Fts5PoslistReader*)sqlite3Fts5MallocZero(&rc, nByte);\n  }\n  aIter = pCsr->aInstIter;\n\n  if( aIter ){\n    int nInst = 0;                /* Number instances seen so far */\n    int i;\n\n    /* Initialize all iterators */\n    for(i=0; i<nIter && rc==SQLITE_OK; i++){\n      const u8 *a;\n      int n; \n      rc = fts5CsrPoslist(pCsr, i, &a, &n);\n      if( rc==SQLITE_OK ){\n        sqlite3Fts5PoslistReaderInit(a, n, &aIter[i]);\n      }\n    }\n\n    if( rc==SQLITE_OK ){\n      while( 1 ){\n        int *aInst;\n        int iBest = -1;\n        for(i=0; i<nIter; i++){\n          if( (aIter[i].bEof==0) \n              && (iBest<0 || aIter[i].iPos<aIter[iBest].iPos) \n            ){\n            iBest = i;\n          }\n        }\n        if( iBest<0 ) break;\n\n        nInst++;\n        if( nInst>=pCsr->nInstAlloc ){\n          pCsr->nInstAlloc = pCsr->nInstAlloc ? pCsr->nInstAlloc*2 : 32;\n          aInst = (int*)sqlite3_realloc(\n              pCsr->aInst, pCsr->nInstAlloc*sizeof(int)*3\n              );\n          if( aInst ){\n            pCsr->aInst = aInst;\n          }else{\n            rc = SQLITE_NOMEM;\n            break;\n          }\n        }\n\n        aInst = &pCsr->aInst[3 * (nInst-1)];\n        aInst[0] = iBest;\n        aInst[1] = FTS5_POS2COLUMN(aIter[iBest].iPos);\n        aInst[2] = FTS5_POS2OFFSET(aIter[iBest].iPos);\n        sqlite3Fts5PoslistReaderNext(&aIter[iBest]);\n      }\n    }\n\n    pCsr->nInstCount = nInst;\n    CsrFlagClear(pCsr, FTS5CSR_REQUIRE_INST);\n  }\n  return rc;\n}\n\nstatic int fts5ApiInstCount(Fts5Context *pCtx, int *pnInst){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  int rc = SQLITE_OK;\n  if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_INST)==0 \n   || SQLITE_OK==(rc = fts5CacheInstArray(pCsr)) ){\n    *pnInst = pCsr->nInstCount;\n  }\n  return rc;\n}\n\nstatic int fts5ApiInst(\n  Fts5Context *pCtx, \n  int iIdx, \n  int *piPhrase, \n  int *piCol, \n  int *piOff\n){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  int rc = SQLITE_OK;\n  if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_INST)==0 \n   || SQLITE_OK==(rc = fts5CacheInstArray(pCsr)) \n  ){\n    if( iIdx<0 || iIdx>=pCsr->nInstCount ){\n      rc = SQLITE_RANGE;\n#if 0\n    }else if( fts5IsOffsetless((Fts5Table*)pCsr->base.pVtab) ){\n      *piPhrase = pCsr->aInst[iIdx*3];\n      *piCol = pCsr->aInst[iIdx*3 + 2];\n      *piOff = -1;\n#endif\n    }else{\n      *piPhrase = pCsr->aInst[iIdx*3];\n      *piCol = pCsr->aInst[iIdx*3 + 1];\n      *piOff = pCsr->aInst[iIdx*3 + 2];\n    }\n  }\n  return rc;\n}\n\nstatic sqlite3_int64 fts5ApiRowid(Fts5Context *pCtx){\n  return fts5CursorRowid((Fts5Cursor*)pCtx);\n}\n\nstatic int fts5ColumnSizeCb(\n  void *pContext,                 /* Pointer to int */\n  int tflags,\n  const char *pUnused,            /* Buffer containing token */\n  int nUnused,                    /* Size of token in bytes */\n  int iUnused1,                   /* Start offset of token */\n  int iUnused2                    /* End offset of token */\n){\n  int *pCnt = (int*)pContext;\n  UNUSED_PARAM2(pUnused, nUnused);\n  UNUSED_PARAM2(iUnused1, iUnused2);\n  if( (tflags & FTS5_TOKEN_COLOCATED)==0 ){\n    (*pCnt)++;\n  }\n  return SQLITE_OK;\n}\n\nstatic int fts5ApiColumnSize(Fts5Context *pCtx, int iCol, int *pnToken){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n  Fts5Config *pConfig = pTab->pConfig;\n  int rc = SQLITE_OK;\n\n  if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_DOCSIZE) ){\n    if( pConfig->bColumnsize ){\n      i64 iRowid = fts5CursorRowid(pCsr);\n      rc = sqlite3Fts5StorageDocsize(pTab->pStorage, iRowid, pCsr->aColumnSize);\n    }else if( pConfig->zContent==0 ){\n      int i;\n      for(i=0; i<pConfig->nCol; i++){\n        if( pConfig->abUnindexed[i]==0 ){\n          pCsr->aColumnSize[i] = -1;\n        }\n      }\n    }else{\n      int i;\n      for(i=0; rc==SQLITE_OK && i<pConfig->nCol; i++){\n        if( pConfig->abUnindexed[i]==0 ){\n          const char *z; int n;\n          void *p = (void*)(&pCsr->aColumnSize[i]);\n          pCsr->aColumnSize[i] = 0;\n          rc = fts5ApiColumnText(pCtx, i, &z, &n);\n          if( rc==SQLITE_OK ){\n            rc = sqlite3Fts5Tokenize(\n                pConfig, FTS5_TOKENIZE_AUX, z, n, p, fts5ColumnSizeCb\n            );\n          }\n        }\n      }\n    }\n    CsrFlagClear(pCsr, FTS5CSR_REQUIRE_DOCSIZE);\n  }\n  if( iCol<0 ){\n    int i;\n    *pnToken = 0;\n    for(i=0; i<pConfig->nCol; i++){\n      *pnToken += pCsr->aColumnSize[i];\n    }\n  }else if( iCol<pConfig->nCol ){\n    *pnToken = pCsr->aColumnSize[iCol];\n  }else{\n    *pnToken = 0;\n    rc = SQLITE_RANGE;\n  }\n  return rc;\n}\n\n/*\n** Implementation of the xSetAuxdata() method.\n*/\nstatic int fts5ApiSetAuxdata(\n  Fts5Context *pCtx,              /* Fts5 context */\n  void *pPtr,                     /* Pointer to save as auxdata */\n  void(*xDelete)(void*)           /* Destructor for pPtr (or NULL) */\n){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Auxdata *pData;\n\n  /* Search through the cursors list of Fts5Auxdata objects for one that\n  ** corresponds to the currently executing auxiliary function.  */\n  for(pData=pCsr->pAuxdata; pData; pData=pData->pNext){\n    if( pData->pAux==pCsr->pAux ) break;\n  }\n\n  if( pData ){\n    if( pData->xDelete ){\n      pData->xDelete(pData->pPtr);\n    }\n  }else{\n    int rc = SQLITE_OK;\n    pData = (Fts5Auxdata*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Auxdata));\n    if( pData==0 ){\n      if( xDelete ) xDelete(pPtr);\n      return rc;\n    }\n    pData->pAux = pCsr->pAux;\n    pData->pNext = pCsr->pAuxdata;\n    pCsr->pAuxdata = pData;\n  }\n\n  pData->xDelete = xDelete;\n  pData->pPtr = pPtr;\n  return SQLITE_OK;\n}\n\nstatic void *fts5ApiGetAuxdata(Fts5Context *pCtx, int bClear){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Auxdata *pData;\n  void *pRet = 0;\n\n  for(pData=pCsr->pAuxdata; pData; pData=pData->pNext){\n    if( pData->pAux==pCsr->pAux ) break;\n  }\n\n  if( pData ){\n    pRet = pData->pPtr;\n    if( bClear ){\n      pData->pPtr = 0;\n      pData->xDelete = 0;\n    }\n  }\n\n  return pRet;\n}\n\nstatic void fts5ApiPhraseNext(\n  Fts5Context *pUnused, \n  Fts5PhraseIter *pIter, \n  int *piCol, int *piOff\n){\n  UNUSED_PARAM(pUnused);\n  if( pIter->a>=pIter->b ){\n    *piCol = -1;\n    *piOff = -1;\n  }else{\n    int iVal;\n    pIter->a += fts5GetVarint32(pIter->a, iVal);\n    if( iVal==1 ){\n      pIter->a += fts5GetVarint32(pIter->a, iVal);\n      *piCol = iVal;\n      *piOff = 0;\n      pIter->a += fts5GetVarint32(pIter->a, iVal);\n    }\n    *piOff += (iVal-2);\n  }\n}\n\nstatic int fts5ApiPhraseFirst(\n  Fts5Context *pCtx, \n  int iPhrase, \n  Fts5PhraseIter *pIter, \n  int *piCol, int *piOff\n){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  int n;\n  int rc = fts5CsrPoslist(pCsr, iPhrase, &pIter->a, &n);\n  if( rc==SQLITE_OK ){\n    pIter->b = &pIter->a[n];\n    *piCol = 0;\n    *piOff = 0;\n    fts5ApiPhraseNext(pCtx, pIter, piCol, piOff);\n  }\n  return rc;\n}\n\nstatic void fts5ApiPhraseNextColumn(\n  Fts5Context *pCtx, \n  Fts5PhraseIter *pIter, \n  int *piCol\n){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Config *pConfig = ((Fts5Table*)(pCsr->base.pVtab))->pConfig;\n\n  if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){\n    if( pIter->a>=pIter->b ){\n      *piCol = -1;\n    }else{\n      int iIncr;\n      pIter->a += fts5GetVarint32(&pIter->a[0], iIncr);\n      *piCol += (iIncr-2);\n    }\n  }else{\n    while( 1 ){\n      int dummy;\n      if( pIter->a>=pIter->b ){\n        *piCol = -1;\n        return;\n      }\n      if( pIter->a[0]==0x01 ) break;\n      pIter->a += fts5GetVarint32(pIter->a, dummy);\n    }\n    pIter->a += 1 + fts5GetVarint32(&pIter->a[1], *piCol);\n  }\n}\n\nstatic int fts5ApiPhraseFirstColumn(\n  Fts5Context *pCtx, \n  int iPhrase, \n  Fts5PhraseIter *pIter, \n  int *piCol\n){\n  int rc = SQLITE_OK;\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Config *pConfig = ((Fts5Table*)(pCsr->base.pVtab))->pConfig;\n\n  if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){\n    Fts5Sorter *pSorter = pCsr->pSorter;\n    int n;\n    if( pSorter ){\n      int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]);\n      n = pSorter->aIdx[iPhrase] - i1;\n      pIter->a = &pSorter->aPoslist[i1];\n    }else{\n      rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, iPhrase, &pIter->a, &n);\n    }\n    if( rc==SQLITE_OK ){\n      pIter->b = &pIter->a[n];\n      *piCol = 0;\n      fts5ApiPhraseNextColumn(pCtx, pIter, piCol);\n    }\n  }else{\n    int n;\n    rc = fts5CsrPoslist(pCsr, iPhrase, &pIter->a, &n);\n    if( rc==SQLITE_OK ){\n      pIter->b = &pIter->a[n];\n      if( n<=0 ){\n        *piCol = -1;\n      }else if( pIter->a[0]==0x01 ){\n        pIter->a += 1 + fts5GetVarint32(&pIter->a[1], *piCol);\n      }else{\n        *piCol = 0;\n      }\n    }\n  }\n\n  return rc;\n}\n\n\nstatic int fts5ApiQueryPhrase(Fts5Context*, int, void*, \n    int(*)(const Fts5ExtensionApi*, Fts5Context*, void*)\n);\n\nstatic const Fts5ExtensionApi sFts5Api = {\n  2,                            /* iVersion */\n  fts5ApiUserData,\n  fts5ApiColumnCount,\n  fts5ApiRowCount,\n  fts5ApiColumnTotalSize,\n  fts5ApiTokenize,\n  fts5ApiPhraseCount,\n  fts5ApiPhraseSize,\n  fts5ApiInstCount,\n  fts5ApiInst,\n  fts5ApiRowid,\n  fts5ApiColumnText,\n  fts5ApiColumnSize,\n  fts5ApiQueryPhrase,\n  fts5ApiSetAuxdata,\n  fts5ApiGetAuxdata,\n  fts5ApiPhraseFirst,\n  fts5ApiPhraseNext,\n  fts5ApiPhraseFirstColumn,\n  fts5ApiPhraseNextColumn,\n};\n\n/*\n** Implementation of API function xQueryPhrase().\n*/\nstatic int fts5ApiQueryPhrase(\n  Fts5Context *pCtx, \n  int iPhrase, \n  void *pUserData,\n  int(*xCallback)(const Fts5ExtensionApi*, Fts5Context*, void*)\n){\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCtx;\n  Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);\n  int rc;\n  Fts5Cursor *pNew = 0;\n\n  rc = fts5OpenMethod(pCsr->base.pVtab, (sqlite3_vtab_cursor**)&pNew);\n  if( rc==SQLITE_OK ){\n    pNew->ePlan = FTS5_PLAN_MATCH;\n    pNew->iFirstRowid = SMALLEST_INT64;\n    pNew->iLastRowid = LARGEST_INT64;\n    pNew->base.pVtab = (sqlite3_vtab*)pTab;\n    rc = sqlite3Fts5ExprClonePhrase(pCsr->pExpr, iPhrase, &pNew->pExpr);\n  }\n\n  if( rc==SQLITE_OK ){\n    for(rc = fts5CursorFirst(pTab, pNew, 0);\n        rc==SQLITE_OK && CsrFlagTest(pNew, FTS5CSR_EOF)==0;\n        rc = fts5NextMethod((sqlite3_vtab_cursor*)pNew)\n    ){\n      rc = xCallback(&sFts5Api, (Fts5Context*)pNew, pUserData);\n      if( rc!=SQLITE_OK ){\n        if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n        break;\n      }\n    }\n  }\n\n  fts5CloseMethod((sqlite3_vtab_cursor*)pNew);\n  return rc;\n}\n\nstatic void fts5ApiInvoke(\n  Fts5Auxiliary *pAux,\n  Fts5Cursor *pCsr,\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  assert( pCsr->pAux==0 );\n  pCsr->pAux = pAux;\n  pAux->xFunc(&sFts5Api, (Fts5Context*)pCsr, context, argc, argv);\n  pCsr->pAux = 0;\n}\n\nstatic Fts5Cursor *fts5CursorFromCsrid(Fts5Global *pGlobal, i64 iCsrId){\n  Fts5Cursor *pCsr;\n  for(pCsr=pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){\n    if( pCsr->iCsrId==iCsrId ) break;\n  }\n  return pCsr;\n}\n\nstatic void fts5ApiCallback(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n\n  Fts5Auxiliary *pAux;\n  Fts5Cursor *pCsr;\n  i64 iCsrId;\n\n  assert( argc>=1 );\n  pAux = (Fts5Auxiliary*)sqlite3_user_data(context);\n  iCsrId = sqlite3_value_int64(argv[0]);\n\n  pCsr = fts5CursorFromCsrid(pAux->pGlobal, iCsrId);\n  if( pCsr==0 ){\n    char *zErr = sqlite3_mprintf(\"no such cursor: %lld\", iCsrId);\n    sqlite3_result_error(context, zErr, -1);\n    sqlite3_free(zErr);\n  }else{\n    fts5ApiInvoke(pAux, pCsr, context, argc-1, &argv[1]);\n  }\n}\n\n\n/*\n** Given cursor id iId, return a pointer to the corresponding Fts5Index \n** object. Or NULL If the cursor id does not exist.\n**\n** If successful, set *ppConfig to point to the associated config object \n** before returning.\n*/\nstatic Fts5Index *sqlite3Fts5IndexFromCsrid(\n  Fts5Global *pGlobal,            /* FTS5 global context for db handle */\n  i64 iCsrId,                     /* Id of cursor to find */\n  Fts5Config **ppConfig           /* OUT: Configuration object */\n){\n  Fts5Cursor *pCsr;\n  Fts5Table *pTab;\n\n  pCsr = fts5CursorFromCsrid(pGlobal, iCsrId);\n  pTab = (Fts5Table*)pCsr->base.pVtab;\n  *ppConfig = pTab->pConfig;\n\n  return pTab->pIndex;\n}\n\n/*\n** Return a \"position-list blob\" corresponding to the current position of\n** cursor pCsr via sqlite3_result_blob(). A position-list blob contains\n** the current position-list for each phrase in the query associated with\n** cursor pCsr.\n**\n** A position-list blob begins with (nPhrase-1) varints, where nPhrase is\n** the number of phrases in the query. Following the varints are the\n** concatenated position lists for each phrase, in order.\n**\n** The first varint (if it exists) contains the size of the position list\n** for phrase 0. The second (same disclaimer) contains the size of position\n** list 1. And so on. There is no size field for the final position list,\n** as it can be derived from the total size of the blob.\n*/\nstatic int fts5PoslistBlob(sqlite3_context *pCtx, Fts5Cursor *pCsr){\n  int i;\n  int rc = SQLITE_OK;\n  int nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr);\n  Fts5Buffer val;\n\n  memset(&val, 0, sizeof(Fts5Buffer));\n  switch( ((Fts5Table*)(pCsr->base.pVtab))->pConfig->eDetail ){\n    case FTS5_DETAIL_FULL:\n\n      /* Append the varints */\n      for(i=0; i<(nPhrase-1); i++){\n        const u8 *dummy;\n        int nByte = sqlite3Fts5ExprPoslist(pCsr->pExpr, i, &dummy);\n        sqlite3Fts5BufferAppendVarint(&rc, &val, nByte);\n      }\n\n      /* Append the position lists */\n      for(i=0; i<nPhrase; i++){\n        const u8 *pPoslist;\n        int nPoslist;\n        nPoslist = sqlite3Fts5ExprPoslist(pCsr->pExpr, i, &pPoslist);\n        sqlite3Fts5BufferAppendBlob(&rc, &val, nPoslist, pPoslist);\n      }\n      break;\n\n    case FTS5_DETAIL_COLUMNS:\n\n      /* Append the varints */\n      for(i=0; rc==SQLITE_OK && i<(nPhrase-1); i++){\n        const u8 *dummy;\n        int nByte;\n        rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, i, &dummy, &nByte);\n        sqlite3Fts5BufferAppendVarint(&rc, &val, nByte);\n      }\n\n      /* Append the position lists */\n      for(i=0; rc==SQLITE_OK && i<nPhrase; i++){\n        const u8 *pPoslist;\n        int nPoslist;\n        rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, i, &pPoslist, &nPoslist);\n        sqlite3Fts5BufferAppendBlob(&rc, &val, nPoslist, pPoslist);\n      }\n      break;\n\n    default:\n      break;\n  }\n\n  sqlite3_result_blob(pCtx, val.p, val.n, sqlite3_free);\n  return rc;\n}\n\n/* \n** This is the xColumn method, called by SQLite to request a value from\n** the row that the supplied cursor currently points to.\n*/\nstatic int fts5ColumnMethod(\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\n  sqlite3_context *pCtx,          /* Context for sqlite3_result_xxx() calls */\n  int iCol                        /* Index of column to read value from */\n){\n  Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);\n  Fts5Config *pConfig = pTab->pConfig;\n  Fts5Cursor *pCsr = (Fts5Cursor*)pCursor;\n  int rc = SQLITE_OK;\n  \n  assert( CsrFlagTest(pCsr, FTS5CSR_EOF)==0 );\n\n  if( pCsr->ePlan==FTS5_PLAN_SPECIAL ){\n    if( iCol==pConfig->nCol ){\n      sqlite3_result_int64(pCtx, pCsr->iSpecial);\n    }\n  }else\n\n  if( iCol==pConfig->nCol ){\n    /* User is requesting the value of the special column with the same name\n    ** as the table. Return the cursor integer id number. This value is only\n    ** useful in that it may be passed as the first argument to an FTS5\n    ** auxiliary function.  */\n    sqlite3_result_int64(pCtx, pCsr->iCsrId);\n  }else if( iCol==pConfig->nCol+1 ){\n\n    /* The value of the \"rank\" column. */\n    if( pCsr->ePlan==FTS5_PLAN_SOURCE ){\n      fts5PoslistBlob(pCtx, pCsr);\n    }else if( \n        pCsr->ePlan==FTS5_PLAN_MATCH\n     || pCsr->ePlan==FTS5_PLAN_SORTED_MATCH\n    ){\n      if( pCsr->pRank || SQLITE_OK==(rc = fts5FindRankFunction(pCsr)) ){\n        fts5ApiInvoke(pCsr->pRank, pCsr, pCtx, pCsr->nRankArg, pCsr->apRankArg);\n      }\n    }\n  }else if( !fts5IsContentless(pTab) ){\n    rc = fts5SeekCursor(pCsr, 1);\n    if( rc==SQLITE_OK ){\n      sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1));\n    }\n  }\n  return rc;\n}\n\n\n/*\n** This routine implements the xFindFunction method for the FTS3\n** virtual table.\n*/\nstatic int fts5FindFunctionMethod(\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\n  int nUnused,                    /* Number of SQL function arguments */\n  const char *zName,              /* Name of SQL function */\n  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), /* OUT: Result */\n  void **ppArg                    /* OUT: User data for *pxFunc */\n){\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  Fts5Auxiliary *pAux;\n\n  UNUSED_PARAM(nUnused);\n  pAux = fts5FindAuxiliary(pTab, zName);\n  if( pAux ){\n    *pxFunc = fts5ApiCallback;\n    *ppArg = (void*)pAux;\n    return 1;\n  }\n\n  /* No function of the specified name was found. Return 0. */\n  return 0;\n}\n\n/*\n** Implementation of FTS5 xRename method. Rename an fts5 table.\n*/\nstatic int fts5RenameMethod(\n  sqlite3_vtab *pVtab,            /* Virtual table handle */\n  const char *zName               /* New name of table */\n){\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  return sqlite3Fts5StorageRename(pTab->pStorage, zName);\n}\n\n/*\n** The xSavepoint() method.\n**\n** Flush the contents of the pending-terms table to disk.\n*/\nstatic int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  UNUSED_PARAM(iSavepoint);  /* Call below is a no-op for NDEBUG builds */\n  fts5CheckTransactionState(pTab, FTS5_SAVEPOINT, iSavepoint);\n  fts5TripCursors(pTab);\n  return sqlite3Fts5StorageSync(pTab->pStorage, 0);\n}\n\n/*\n** The xRelease() method.\n**\n** This is a no-op.\n*/\nstatic int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  UNUSED_PARAM(iSavepoint);  /* Call below is a no-op for NDEBUG builds */\n  fts5CheckTransactionState(pTab, FTS5_RELEASE, iSavepoint);\n  fts5TripCursors(pTab);\n  return sqlite3Fts5StorageSync(pTab->pStorage, 0);\n}\n\n/*\n** The xRollbackTo() method.\n**\n** Discard the contents of the pending terms table.\n*/\nstatic int fts5RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){\n  Fts5Table *pTab = (Fts5Table*)pVtab;\n  UNUSED_PARAM(iSavepoint);  /* Call below is a no-op for NDEBUG builds */\n  fts5CheckTransactionState(pTab, FTS5_ROLLBACKTO, iSavepoint);\n  fts5TripCursors(pTab);\n  return sqlite3Fts5StorageRollback(pTab->pStorage);\n}\n\n/*\n** Register a new auxiliary function with global context pGlobal.\n*/\nstatic int fts5CreateAux(\n  fts5_api *pApi,                 /* Global context (one per db handle) */\n  const char *zName,              /* Name of new function */\n  void *pUserData,                /* User data for aux. function */\n  fts5_extension_function xFunc,  /* Aux. function implementation */\n  void(*xDestroy)(void*)          /* Destructor for pUserData */\n){\n  Fts5Global *pGlobal = (Fts5Global*)pApi;\n  int rc = sqlite3_overload_function(pGlobal->db, zName, -1);\n  if( rc==SQLITE_OK ){\n    Fts5Auxiliary *pAux;\n    int nName;                      /* Size of zName in bytes, including \\0 */\n    int nByte;                      /* Bytes of space to allocate */\n\n    nName = (int)strlen(zName) + 1;\n    nByte = sizeof(Fts5Auxiliary) + nName;\n    pAux = (Fts5Auxiliary*)sqlite3_malloc(nByte);\n    if( pAux ){\n      memset(pAux, 0, nByte);\n      pAux->zFunc = (char*)&pAux[1];\n      memcpy(pAux->zFunc, zName, nName);\n      pAux->pGlobal = pGlobal;\n      pAux->pUserData = pUserData;\n      pAux->xFunc = xFunc;\n      pAux->xDestroy = xDestroy;\n      pAux->pNext = pGlobal->pAux;\n      pGlobal->pAux = pAux;\n    }else{\n      rc = SQLITE_NOMEM;\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Register a new tokenizer. This is the implementation of the \n** fts5_api.xCreateTokenizer() method.\n*/\nstatic int fts5CreateTokenizer(\n  fts5_api *pApi,                 /* Global context (one per db handle) */\n  const char *zName,              /* Name of new function */\n  void *pUserData,                /* User data for aux. function */\n  fts5_tokenizer *pTokenizer,     /* Tokenizer implementation */\n  void(*xDestroy)(void*)          /* Destructor for pUserData */\n){\n  Fts5Global *pGlobal = (Fts5Global*)pApi;\n  Fts5TokenizerModule *pNew;\n  int nName;                      /* Size of zName and its \\0 terminator */\n  int nByte;                      /* Bytes of space to allocate */\n  int rc = SQLITE_OK;\n\n  nName = (int)strlen(zName) + 1;\n  nByte = sizeof(Fts5TokenizerModule) + nName;\n  pNew = (Fts5TokenizerModule*)sqlite3_malloc(nByte);\n  if( pNew ){\n    memset(pNew, 0, nByte);\n    pNew->zName = (char*)&pNew[1];\n    memcpy(pNew->zName, zName, nName);\n    pNew->pUserData = pUserData;\n    pNew->x = *pTokenizer;\n    pNew->xDestroy = xDestroy;\n    pNew->pNext = pGlobal->pTok;\n    pGlobal->pTok = pNew;\n    if( pNew->pNext==0 ){\n      pGlobal->pDfltTok = pNew;\n    }\n  }else{\n    rc = SQLITE_NOMEM;\n  }\n\n  return rc;\n}\n\nstatic Fts5TokenizerModule *fts5LocateTokenizer(\n  Fts5Global *pGlobal, \n  const char *zName\n){\n  Fts5TokenizerModule *pMod = 0;\n\n  if( zName==0 ){\n    pMod = pGlobal->pDfltTok;\n  }else{\n    for(pMod=pGlobal->pTok; pMod; pMod=pMod->pNext){\n      if( sqlite3_stricmp(zName, pMod->zName)==0 ) break;\n    }\n  }\n\n  return pMod;\n}\n\n/*\n** Find a tokenizer. This is the implementation of the \n** fts5_api.xFindTokenizer() method.\n*/\nstatic int fts5FindTokenizer(\n  fts5_api *pApi,                 /* Global context (one per db handle) */\n  const char *zName,              /* Name of new function */\n  void **ppUserData,\n  fts5_tokenizer *pTokenizer      /* Populate this object */\n){\n  int rc = SQLITE_OK;\n  Fts5TokenizerModule *pMod;\n\n  pMod = fts5LocateTokenizer((Fts5Global*)pApi, zName);\n  if( pMod ){\n    *pTokenizer = pMod->x;\n    *ppUserData = pMod->pUserData;\n  }else{\n    memset(pTokenizer, 0, sizeof(fts5_tokenizer));\n    rc = SQLITE_ERROR;\n  }\n\n  return rc;\n}\n\nstatic int sqlite3Fts5GetTokenizer(\n  Fts5Global *pGlobal, \n  const char **azArg,\n  int nArg,\n  Fts5Tokenizer **ppTok,\n  fts5_tokenizer **ppTokApi,\n  char **pzErr\n){\n  Fts5TokenizerModule *pMod;\n  int rc = SQLITE_OK;\n\n  pMod = fts5LocateTokenizer(pGlobal, nArg==0 ? 0 : azArg[0]);\n  if( pMod==0 ){\n    assert( nArg>0 );\n    rc = SQLITE_ERROR;\n    *pzErr = sqlite3_mprintf(\"no such tokenizer: %s\", azArg[0]);\n  }else{\n    rc = pMod->x.xCreate(pMod->pUserData, &azArg[1], (nArg?nArg-1:0), ppTok);\n    *ppTokApi = &pMod->x;\n    if( rc!=SQLITE_OK && pzErr ){\n      *pzErr = sqlite3_mprintf(\"error in tokenizer constructor\");\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    *ppTokApi = 0;\n    *ppTok = 0;\n  }\n\n  return rc;\n}\n\nstatic void fts5ModuleDestroy(void *pCtx){\n  Fts5TokenizerModule *pTok, *pNextTok;\n  Fts5Auxiliary *pAux, *pNextAux;\n  Fts5Global *pGlobal = (Fts5Global*)pCtx;\n\n  for(pAux=pGlobal->pAux; pAux; pAux=pNextAux){\n    pNextAux = pAux->pNext;\n    if( pAux->xDestroy ) pAux->xDestroy(pAux->pUserData);\n    sqlite3_free(pAux);\n  }\n\n  for(pTok=pGlobal->pTok; pTok; pTok=pNextTok){\n    pNextTok = pTok->pNext;\n    if( pTok->xDestroy ) pTok->xDestroy(pTok->pUserData);\n    sqlite3_free(pTok);\n  }\n\n  sqlite3_free(pGlobal);\n}\n\nstatic void fts5Fts5Func(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args */\n  sqlite3_value **apUnused        /* Function arguments */\n){\n  Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx);\n  char buf[8];\n  UNUSED_PARAM2(nArg, apUnused);\n  assert( nArg==0 );\n  assert( sizeof(buf)>=sizeof(pGlobal) );\n  memcpy(buf, (void*)&pGlobal, sizeof(pGlobal));\n  sqlite3_result_blob(pCtx, buf, sizeof(pGlobal), SQLITE_TRANSIENT);\n}\n\n/*\n** Implementation of fts5_source_id() function.\n*/\nstatic void fts5SourceIdFunc(\n  sqlite3_context *pCtx,          /* Function call context */\n  int nArg,                       /* Number of args */\n  sqlite3_value **apUnused        /* Function arguments */\n){\n  assert( nArg==0 );\n  UNUSED_PARAM2(nArg, apUnused);\n  sqlite3_result_text(pCtx, \"fts5: 2016-11-28 19:13:37 bbd85d235f7037c6a033a9690534391ffeacecc8\", -1, SQLITE_TRANSIENT);\n}\n\nstatic int fts5Init(sqlite3 *db){\n  static const sqlite3_module fts5Mod = {\n    /* iVersion      */ 2,\n    /* xCreate       */ fts5CreateMethod,\n    /* xConnect      */ fts5ConnectMethod,\n    /* xBestIndex    */ fts5BestIndexMethod,\n    /* xDisconnect   */ fts5DisconnectMethod,\n    /* xDestroy      */ fts5DestroyMethod,\n    /* xOpen         */ fts5OpenMethod,\n    /* xClose        */ fts5CloseMethod,\n    /* xFilter       */ fts5FilterMethod,\n    /* xNext         */ fts5NextMethod,\n    /* xEof          */ fts5EofMethod,\n    /* xColumn       */ fts5ColumnMethod,\n    /* xRowid        */ fts5RowidMethod,\n    /* xUpdate       */ fts5UpdateMethod,\n    /* xBegin        */ fts5BeginMethod,\n    /* xSync         */ fts5SyncMethod,\n    /* xCommit       */ fts5CommitMethod,\n    /* xRollback     */ fts5RollbackMethod,\n    /* xFindFunction */ fts5FindFunctionMethod,\n    /* xRename       */ fts5RenameMethod,\n    /* xSavepoint    */ fts5SavepointMethod,\n    /* xRelease      */ fts5ReleaseMethod,\n    /* xRollbackTo   */ fts5RollbackToMethod,\n  };\n\n  int rc;\n  Fts5Global *pGlobal = 0;\n\n  pGlobal = (Fts5Global*)sqlite3_malloc(sizeof(Fts5Global));\n  if( pGlobal==0 ){\n    rc = SQLITE_NOMEM;\n  }else{\n    void *p = (void*)pGlobal;\n    memset(pGlobal, 0, sizeof(Fts5Global));\n    pGlobal->db = db;\n    pGlobal->api.iVersion = 2;\n    pGlobal->api.xCreateFunction = fts5CreateAux;\n    pGlobal->api.xCreateTokenizer = fts5CreateTokenizer;\n    pGlobal->api.xFindTokenizer = fts5FindTokenizer;\n    rc = sqlite3_create_module_v2(db, \"fts5\", &fts5Mod, p, fts5ModuleDestroy);\n    if( rc==SQLITE_OK ) rc = sqlite3Fts5IndexInit(db);\n    if( rc==SQLITE_OK ) rc = sqlite3Fts5ExprInit(pGlobal, db);\n    if( rc==SQLITE_OK ) rc = sqlite3Fts5AuxInit(&pGlobal->api);\n    if( rc==SQLITE_OK ) rc = sqlite3Fts5TokenizerInit(&pGlobal->api);\n    if( rc==SQLITE_OK ) rc = sqlite3Fts5VocabInit(pGlobal, db);\n    if( rc==SQLITE_OK ){\n      rc = sqlite3_create_function(\n          db, \"fts5\", 0, SQLITE_UTF8, p, fts5Fts5Func, 0, 0\n      );\n    }\n    if( rc==SQLITE_OK ){\n      rc = sqlite3_create_function(\n          db, \"fts5_source_id\", 0, SQLITE_UTF8, p, fts5SourceIdFunc, 0, 0\n      );\n    }\n  }\n\n  /* If SQLITE_FTS5_ENABLE_TEST_MI is defined, assume that the file\n  ** fts5_test_mi.c is compiled and linked into the executable. And call\n  ** its entry point to enable the matchinfo() demo.  */\n#ifdef SQLITE_FTS5_ENABLE_TEST_MI\n  if( rc==SQLITE_OK ){\n    extern int sqlite3Fts5TestRegisterMatchinfo(sqlite3*);\n    rc = sqlite3Fts5TestRegisterMatchinfo(db);\n  }\n#endif\n\n  return rc;\n}\n\n/*\n** The following functions are used to register the module with SQLite. If\n** this module is being built as part of the SQLite core (SQLITE_CORE is\n** defined), then sqlite3_open() will call sqlite3Fts5Init() directly.\n**\n** Or, if this module is being built as a loadable extension, \n** sqlite3Fts5Init() is omitted and the two standard entry points\n** sqlite3_fts_init() and sqlite3_fts5_init() defined instead.\n*/\n#ifndef SQLITE_CORE\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nint sqlite3_fts_init(\n  sqlite3 *db,\n  char **pzErrMsg,\n  const sqlite3_api_routines *pApi\n){\n  SQLITE_EXTENSION_INIT2(pApi);\n  (void)pzErrMsg;  /* Unused parameter */\n  return fts5Init(db);\n}\n\n#ifdef _WIN32\n__declspec(dllexport)\n#endif\nint sqlite3_fts5_init(\n  sqlite3 *db,\n  char **pzErrMsg,\n  const sqlite3_api_routines *pApi\n){\n  SQLITE_EXTENSION_INIT2(pApi);\n  (void)pzErrMsg;  /* Unused parameter */\n  return fts5Init(db);\n}\n#else\nint sqlite3Fts5Init(sqlite3 *db){\n  return fts5Init(db);\n}\n#endif\n\n#line 1 \"fts5_storage.c\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n*/\n\n\n\n/* #include \"fts5Int.h\" */\n\nstruct Fts5Storage {\n  Fts5Config *pConfig;\n  Fts5Index *pIndex;\n  int bTotalsValid;               /* True if nTotalRow/aTotalSize[] are valid */\n  i64 nTotalRow;                  /* Total number of rows in FTS table */\n  i64 *aTotalSize;                /* Total sizes of each column */ \n  sqlite3_stmt *aStmt[11];\n};\n\n\n#if FTS5_STMT_SCAN_ASC!=0 \n# error \"FTS5_STMT_SCAN_ASC mismatch\" \n#endif\n#if FTS5_STMT_SCAN_DESC!=1 \n# error \"FTS5_STMT_SCAN_DESC mismatch\" \n#endif\n#if FTS5_STMT_LOOKUP!=2\n# error \"FTS5_STMT_LOOKUP mismatch\" \n#endif\n\n#define FTS5_STMT_INSERT_CONTENT  3\n#define FTS5_STMT_REPLACE_CONTENT 4\n#define FTS5_STMT_DELETE_CONTENT  5\n#define FTS5_STMT_REPLACE_DOCSIZE  6\n#define FTS5_STMT_DELETE_DOCSIZE  7\n#define FTS5_STMT_LOOKUP_DOCSIZE  8\n#define FTS5_STMT_REPLACE_CONFIG 9\n#define FTS5_STMT_SCAN 10\n\n/*\n** Prepare the two insert statements - Fts5Storage.pInsertContent and\n** Fts5Storage.pInsertDocsize - if they have not already been prepared.\n** Return SQLITE_OK if successful, or an SQLite error code if an error\n** occurs.\n*/\nstatic int fts5StorageGetStmt(\n  Fts5Storage *p,                 /* Storage handle */\n  int eStmt,                      /* FTS5_STMT_XXX constant */\n  sqlite3_stmt **ppStmt,          /* OUT: Prepared statement handle */\n  char **pzErrMsg                 /* OUT: Error message (if any) */\n){\n  int rc = SQLITE_OK;\n\n  /* If there is no %_docsize table, there should be no requests for \n  ** statements to operate on it.  */\n  assert( p->pConfig->bColumnsize || (\n        eStmt!=FTS5_STMT_REPLACE_DOCSIZE \n     && eStmt!=FTS5_STMT_DELETE_DOCSIZE \n     && eStmt!=FTS5_STMT_LOOKUP_DOCSIZE \n  ));\n\n  assert( eStmt>=0 && eStmt<ArraySize(p->aStmt) );\n  if( p->aStmt[eStmt]==0 ){\n    const char *azStmt[] = {\n      \"SELECT %s FROM %s T WHERE T.%Q >= ? AND T.%Q <= ? ORDER BY T.%Q ASC\",\n      \"SELECT %s FROM %s T WHERE T.%Q <= ? AND T.%Q >= ? ORDER BY T.%Q DESC\",\n      \"SELECT %s FROM %s T WHERE T.%Q=?\",               /* LOOKUP  */\n\n      \"INSERT INTO %Q.'%q_content' VALUES(%s)\",         /* INSERT_CONTENT  */\n      \"REPLACE INTO %Q.'%q_content' VALUES(%s)\",        /* REPLACE_CONTENT */\n      \"DELETE FROM %Q.'%q_content' WHERE id=?\",         /* DELETE_CONTENT  */\n      \"REPLACE INTO %Q.'%q_docsize' VALUES(?,?)\",       /* REPLACE_DOCSIZE  */\n      \"DELETE FROM %Q.'%q_docsize' WHERE id=?\",         /* DELETE_DOCSIZE  */\n\n      \"SELECT sz FROM %Q.'%q_docsize' WHERE id=?\",      /* LOOKUP_DOCSIZE  */\n\n      \"REPLACE INTO %Q.'%q_config' VALUES(?,?)\",        /* REPLACE_CONFIG */\n      \"SELECT %s FROM %s AS T\",                         /* SCAN */\n    };\n    Fts5Config *pC = p->pConfig;\n    char *zSql = 0;\n\n    switch( eStmt ){\n      case FTS5_STMT_SCAN:\n        zSql = sqlite3_mprintf(azStmt[eStmt], \n            pC->zContentExprlist, pC->zContent\n        );\n        break;\n\n      case FTS5_STMT_SCAN_ASC:\n      case FTS5_STMT_SCAN_DESC:\n        zSql = sqlite3_mprintf(azStmt[eStmt], pC->zContentExprlist, \n            pC->zContent, pC->zContentRowid, pC->zContentRowid,\n            pC->zContentRowid\n        );\n        break;\n\n      case FTS5_STMT_LOOKUP:\n        zSql = sqlite3_mprintf(azStmt[eStmt], \n            pC->zContentExprlist, pC->zContent, pC->zContentRowid\n        );\n        break;\n\n      case FTS5_STMT_INSERT_CONTENT: \n      case FTS5_STMT_REPLACE_CONTENT: {\n        int nCol = pC->nCol + 1;\n        char *zBind;\n        int i;\n\n        zBind = sqlite3_malloc(1 + nCol*2);\n        if( zBind ){\n          for(i=0; i<nCol; i++){\n            zBind[i*2] = '?';\n            zBind[i*2 + 1] = ',';\n          }\n          zBind[i*2-1] = '\\0';\n          zSql = sqlite3_mprintf(azStmt[eStmt], pC->zDb, pC->zName, zBind);\n          sqlite3_free(zBind);\n        }\n        break;\n      }\n\n      default:\n        zSql = sqlite3_mprintf(azStmt[eStmt], pC->zDb, pC->zName);\n        break;\n    }\n\n    if( zSql==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      rc = sqlite3_prepare_v2(pC->db, zSql, -1, &p->aStmt[eStmt], 0);\n      sqlite3_free(zSql);\n      if( rc!=SQLITE_OK && pzErrMsg ){\n        *pzErrMsg = sqlite3_mprintf(\"%s\", sqlite3_errmsg(pC->db));\n      }\n    }\n  }\n\n  *ppStmt = p->aStmt[eStmt];\n  sqlite3_reset(*ppStmt);\n  return rc;\n}\n\n\nstatic int fts5ExecPrintf(\n  sqlite3 *db,\n  char **pzErr,\n  const char *zFormat,\n  ...\n){\n  int rc;\n  va_list ap;                     /* ... printf arguments */\n  char *zSql;\n\n  va_start(ap, zFormat);\n  zSql = sqlite3_vmprintf(zFormat, ap);\n\n  if( zSql==0 ){\n    rc = SQLITE_NOMEM;\n  }else{\n    rc = sqlite3_exec(db, zSql, 0, 0, pzErr);\n    sqlite3_free(zSql);\n  }\n\n  va_end(ap);\n  return rc;\n}\n\n/*\n** Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error\n** code otherwise.\n*/\nstatic int sqlite3Fts5DropAll(Fts5Config *pConfig){\n  int rc = fts5ExecPrintf(pConfig->db, 0, \n      \"DROP TABLE IF EXISTS %Q.'%q_data';\"\n      \"DROP TABLE IF EXISTS %Q.'%q_idx';\"\n      \"DROP TABLE IF EXISTS %Q.'%q_config';\",\n      pConfig->zDb, pConfig->zName,\n      pConfig->zDb, pConfig->zName,\n      pConfig->zDb, pConfig->zName\n  );\n  if( rc==SQLITE_OK && pConfig->bColumnsize ){\n    rc = fts5ExecPrintf(pConfig->db, 0, \n        \"DROP TABLE IF EXISTS %Q.'%q_docsize';\",\n        pConfig->zDb, pConfig->zName\n    );\n  }\n  if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){\n    rc = fts5ExecPrintf(pConfig->db, 0, \n        \"DROP TABLE IF EXISTS %Q.'%q_content';\",\n        pConfig->zDb, pConfig->zName\n    );\n  }\n  return rc;\n}\n\nstatic void fts5StorageRenameOne(\n  Fts5Config *pConfig,            /* Current FTS5 configuration */\n  int *pRc,                       /* IN/OUT: Error code */\n  const char *zTail,              /* Tail of table name e.g. \"data\", \"config\" */\n  const char *zName               /* New name of FTS5 table */\n){\n  if( *pRc==SQLITE_OK ){\n    *pRc = fts5ExecPrintf(pConfig->db, 0, \n        \"ALTER TABLE %Q.'%q_%s' RENAME TO '%q_%s';\",\n        pConfig->zDb, pConfig->zName, zTail, zName, zTail\n    );\n  }\n}\n\nstatic int sqlite3Fts5StorageRename(Fts5Storage *pStorage, const char *zName){\n  Fts5Config *pConfig = pStorage->pConfig;\n  int rc = sqlite3Fts5StorageSync(pStorage, 1);\n\n  fts5StorageRenameOne(pConfig, &rc, \"data\", zName);\n  fts5StorageRenameOne(pConfig, &rc, \"idx\", zName);\n  fts5StorageRenameOne(pConfig, &rc, \"config\", zName);\n  if( pConfig->bColumnsize ){\n    fts5StorageRenameOne(pConfig, &rc, \"docsize\", zName);\n  }\n  if( pConfig->eContent==FTS5_CONTENT_NORMAL ){\n    fts5StorageRenameOne(pConfig, &rc, \"content\", zName);\n  }\n  return rc;\n}\n\n/*\n** Create the shadow table named zPost, with definition zDefn. Return\n** SQLITE_OK if successful, or an SQLite error code otherwise.\n*/\nstatic int sqlite3Fts5CreateTable(\n  Fts5Config *pConfig,            /* FTS5 configuration */\n  const char *zPost,              /* Shadow table to create (e.g. \"content\") */\n  const char *zDefn,              /* Columns etc. for shadow table */\n  int bWithout,                   /* True for without rowid */\n  char **pzErr                    /* OUT: Error message */\n){\n  int rc;\n  char *zErr = 0;\n\n  rc = fts5ExecPrintf(pConfig->db, &zErr, \"CREATE TABLE %Q.'%q_%q'(%s)%s\",\n      pConfig->zDb, pConfig->zName, zPost, zDefn, \n#ifndef SQLITE_FTS5_NO_WITHOUT_ROWID\n      bWithout?\" WITHOUT ROWID\":\n#endif\n      \"\"\n  );\n  if( zErr ){\n    *pzErr = sqlite3_mprintf(\n        \"fts5: error creating shadow table %q_%s: %s\", \n        pConfig->zName, zPost, zErr\n    );\n    sqlite3_free(zErr);\n  }\n\n  return rc;\n}\n\n/*\n** Open a new Fts5Index handle. If the bCreate argument is true, create\n** and initialize the underlying tables \n**\n** If successful, set *pp to point to the new object and return SQLITE_OK.\n** Otherwise, set *pp to NULL and return an SQLite error code.\n*/\nstatic int sqlite3Fts5StorageOpen(\n  Fts5Config *pConfig, \n  Fts5Index *pIndex, \n  int bCreate, \n  Fts5Storage **pp,\n  char **pzErr                    /* OUT: Error message */\n){\n  int rc = SQLITE_OK;\n  Fts5Storage *p;                 /* New object */\n  int nByte;                      /* Bytes of space to allocate */\n\n  nByte = sizeof(Fts5Storage)               /* Fts5Storage object */\n        + pConfig->nCol * sizeof(i64);      /* Fts5Storage.aTotalSize[] */\n  *pp = p = (Fts5Storage*)sqlite3_malloc(nByte);\n  if( !p ) return SQLITE_NOMEM;\n\n  memset(p, 0, nByte);\n  p->aTotalSize = (i64*)&p[1];\n  p->pConfig = pConfig;\n  p->pIndex = pIndex;\n\n  if( bCreate ){\n    if( pConfig->eContent==FTS5_CONTENT_NORMAL ){\n      int nDefn = 32 + pConfig->nCol*10;\n      char *zDefn = sqlite3_malloc(32 + pConfig->nCol * 10);\n      if( zDefn==0 ){\n        rc = SQLITE_NOMEM;\n      }else{\n        int i;\n        int iOff;\n        sqlite3_snprintf(nDefn, zDefn, \"id INTEGER PRIMARY KEY\");\n        iOff = (int)strlen(zDefn);\n        for(i=0; i<pConfig->nCol; i++){\n          sqlite3_snprintf(nDefn-iOff, &zDefn[iOff], \", c%d\", i);\n          iOff += (int)strlen(&zDefn[iOff]);\n        }\n        rc = sqlite3Fts5CreateTable(pConfig, \"content\", zDefn, 0, pzErr);\n      }\n      sqlite3_free(zDefn);\n    }\n\n    if( rc==SQLITE_OK && pConfig->bColumnsize ){\n      rc = sqlite3Fts5CreateTable(\n          pConfig, \"docsize\", \"id INTEGER PRIMARY KEY, sz BLOB\", 0, pzErr\n      );\n    }\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts5CreateTable(\n          pConfig, \"config\", \"k PRIMARY KEY, v\", 1, pzErr\n      );\n    }\n    if( rc==SQLITE_OK ){\n      rc = sqlite3Fts5StorageConfigValue(p, \"version\", 0, FTS5_CURRENT_VERSION);\n    }\n  }\n\n  if( rc ){\n    sqlite3Fts5StorageClose(p);\n    *pp = 0;\n  }\n  return rc;\n}\n\n/*\n** Close a handle opened by an earlier call to sqlite3Fts5StorageOpen().\n*/\nstatic int sqlite3Fts5StorageClose(Fts5Storage *p){\n  int rc = SQLITE_OK;\n  if( p ){\n    int i;\n\n    /* Finalize all SQL statements */\n    for(i=0; i<ArraySize(p->aStmt); i++){\n      sqlite3_finalize(p->aStmt[i]);\n    }\n\n    sqlite3_free(p);\n  }\n  return rc;\n}\n\ntypedef struct Fts5InsertCtx Fts5InsertCtx;\nstruct Fts5InsertCtx {\n  Fts5Storage *pStorage;\n  int iCol;\n  int szCol;                      /* Size of column value in tokens */\n};\n\n/*\n** Tokenization callback used when inserting tokens into the FTS index.\n*/\nstatic int fts5StorageInsertCallback(\n  void *pContext,                 /* Pointer to Fts5InsertCtx object */\n  int tflags,\n  const char *pToken,             /* Buffer containing token */\n  int nToken,                     /* Size of token in bytes */\n  int iUnused1,                   /* Start offset of token */\n  int iUnused2                    /* End offset of token */\n){\n  Fts5InsertCtx *pCtx = (Fts5InsertCtx*)pContext;\n  Fts5Index *pIdx = pCtx->pStorage->pIndex;\n  UNUSED_PARAM2(iUnused1, iUnused2);\n  if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;\n  if( (tflags & FTS5_TOKEN_COLOCATED)==0 || pCtx->szCol==0 ){\n    pCtx->szCol++;\n  }\n  return sqlite3Fts5IndexWrite(pIdx, pCtx->iCol, pCtx->szCol-1, pToken, nToken);\n}\n\n/*\n** If a row with rowid iDel is present in the %_content table, add the\n** delete-markers to the FTS index necessary to delete it. Do not actually\n** remove the %_content row at this time though.\n*/\nstatic int fts5StorageDeleteFromIndex(\n  Fts5Storage *p, \n  i64 iDel, \n  sqlite3_value **apVal\n){\n  Fts5Config *pConfig = p->pConfig;\n  sqlite3_stmt *pSeek = 0;        /* SELECT to read row iDel from %_data */\n  int rc;                         /* Return code */\n  int rc2;                        /* sqlite3_reset() return code */\n  int iCol;\n  Fts5InsertCtx ctx;\n\n  if( apVal==0 ){\n    rc = fts5StorageGetStmt(p, FTS5_STMT_LOOKUP, &pSeek, 0);\n    if( rc!=SQLITE_OK ) return rc;\n    sqlite3_bind_int64(pSeek, 1, iDel);\n    if( sqlite3_step(pSeek)!=SQLITE_ROW ){\n      return sqlite3_reset(pSeek);\n    }\n  }\n\n  ctx.pStorage = p;\n  ctx.iCol = -1;\n  rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 1, iDel);\n  for(iCol=1; rc==SQLITE_OK && iCol<=pConfig->nCol; iCol++){\n    if( pConfig->abUnindexed[iCol-1]==0 ){\n      const char *zText;\n      int nText;\n      if( pSeek ){\n        zText = (const char*)sqlite3_column_text(pSeek, iCol);\n        nText = sqlite3_column_bytes(pSeek, iCol);\n      }else{\n        zText = (const char*)sqlite3_value_text(apVal[iCol-1]);\n        nText = sqlite3_value_bytes(apVal[iCol-1]);\n      }\n      ctx.szCol = 0;\n      rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, \n          zText, nText, (void*)&ctx, fts5StorageInsertCallback\n      );\n      p->aTotalSize[iCol-1] -= (i64)ctx.szCol;\n    }\n  }\n  p->nTotalRow--;\n\n  rc2 = sqlite3_reset(pSeek);\n  if( rc==SQLITE_OK ) rc = rc2;\n  return rc;\n}\n\n\n/*\n** Insert a record into the %_docsize table. Specifically, do:\n**\n**   INSERT OR REPLACE INTO %_docsize(id, sz) VALUES(iRowid, pBuf);\n**\n** If there is no %_docsize table (as happens if the columnsize=0 option\n** is specified when the FTS5 table is created), this function is a no-op.\n*/\nstatic int fts5StorageInsertDocsize(\n  Fts5Storage *p,                 /* Storage module to write to */\n  i64 iRowid,                     /* id value */\n  Fts5Buffer *pBuf                /* sz value */\n){\n  int rc = SQLITE_OK;\n  if( p->pConfig->bColumnsize ){\n    sqlite3_stmt *pReplace = 0;\n    rc = fts5StorageGetStmt(p, FTS5_STMT_REPLACE_DOCSIZE, &pReplace, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pReplace, 1, iRowid);\n      sqlite3_bind_blob(pReplace, 2, pBuf->p, pBuf->n, SQLITE_STATIC);\n      sqlite3_step(pReplace);\n      rc = sqlite3_reset(pReplace);\n    }\n  }\n  return rc;\n}\n\n/*\n** Load the contents of the \"averages\" record from disk into the \n** p->nTotalRow and p->aTotalSize[] variables. If successful, and if\n** argument bCache is true, set the p->bTotalsValid flag to indicate\n** that the contents of aTotalSize[] and nTotalRow are valid until\n** further notice.\n**\n** Return SQLITE_OK if successful, or an SQLite error code if an error\n** occurs.\n*/\nstatic int fts5StorageLoadTotals(Fts5Storage *p, int bCache){\n  int rc = SQLITE_OK;\n  if( p->bTotalsValid==0 ){\n    rc = sqlite3Fts5IndexGetAverages(p->pIndex, &p->nTotalRow, p->aTotalSize);\n    p->bTotalsValid = bCache;\n  }\n  return rc;\n}\n\n/*\n** Store the current contents of the p->nTotalRow and p->aTotalSize[] \n** variables in the \"averages\" record on disk.\n**\n** Return SQLITE_OK if successful, or an SQLite error code if an error\n** occurs.\n*/\nstatic int fts5StorageSaveTotals(Fts5Storage *p){\n  int nCol = p->pConfig->nCol;\n  int i;\n  Fts5Buffer buf;\n  int rc = SQLITE_OK;\n  memset(&buf, 0, sizeof(buf));\n\n  sqlite3Fts5BufferAppendVarint(&rc, &buf, p->nTotalRow);\n  for(i=0; i<nCol; i++){\n    sqlite3Fts5BufferAppendVarint(&rc, &buf, p->aTotalSize[i]);\n  }\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5IndexSetAverages(p->pIndex, buf.p, buf.n);\n  }\n  sqlite3_free(buf.p);\n\n  return rc;\n}\n\n/*\n** Remove a row from the FTS table.\n*/\nstatic int sqlite3Fts5StorageDelete(Fts5Storage *p, i64 iDel, sqlite3_value **apVal){\n  Fts5Config *pConfig = p->pConfig;\n  int rc;\n  sqlite3_stmt *pDel = 0;\n\n  assert( pConfig->eContent!=FTS5_CONTENT_NORMAL || apVal==0 );\n  rc = fts5StorageLoadTotals(p, 1);\n\n  /* Delete the index records */\n  if( rc==SQLITE_OK ){\n    rc = fts5StorageDeleteFromIndex(p, iDel, apVal);\n  }\n\n  /* Delete the %_docsize record */\n  if( rc==SQLITE_OK && pConfig->bColumnsize ){\n    rc = fts5StorageGetStmt(p, FTS5_STMT_DELETE_DOCSIZE, &pDel, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pDel, 1, iDel);\n      sqlite3_step(pDel);\n      rc = sqlite3_reset(pDel);\n    }\n  }\n\n  /* Delete the %_content record */\n  if( pConfig->eContent==FTS5_CONTENT_NORMAL ){\n    if( rc==SQLITE_OK ){\n      rc = fts5StorageGetStmt(p, FTS5_STMT_DELETE_CONTENT, &pDel, 0);\n    }\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_int64(pDel, 1, iDel);\n      sqlite3_step(pDel);\n      rc = sqlite3_reset(pDel);\n    }\n  }\n\n  /* Write the averages record */\n  if( rc==SQLITE_OK ){\n    rc = fts5StorageSaveTotals(p);\n  }\n\n  return rc;\n}\n\n/*\n** Delete all entries in the FTS5 index.\n*/\nstatic int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){\n  Fts5Config *pConfig = p->pConfig;\n  int rc;\n\n  /* Delete the contents of the %_data and %_docsize tables. */\n  rc = fts5ExecPrintf(pConfig->db, 0,\n      \"DELETE FROM %Q.'%q_data';\" \n      \"DELETE FROM %Q.'%q_idx';\",\n      pConfig->zDb, pConfig->zName,\n      pConfig->zDb, pConfig->zName\n  );\n  if( rc==SQLITE_OK && pConfig->bColumnsize ){\n    rc = fts5ExecPrintf(pConfig->db, 0,\n        \"DELETE FROM %Q.'%q_docsize';\",\n        pConfig->zDb, pConfig->zName\n    );\n  }\n\n  /* Reinitialize the %_data table. This call creates the initial structure\n  ** and averages records.  */\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5IndexReinit(p->pIndex);\n  }\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5StorageConfigValue(p, \"version\", 0, FTS5_CURRENT_VERSION);\n  }\n  return rc;\n}\n\nstatic int sqlite3Fts5StorageRebuild(Fts5Storage *p){\n  Fts5Buffer buf = {0,0,0};\n  Fts5Config *pConfig = p->pConfig;\n  sqlite3_stmt *pScan = 0;\n  Fts5InsertCtx ctx;\n  int rc;\n\n  memset(&ctx, 0, sizeof(Fts5InsertCtx));\n  ctx.pStorage = p;\n  rc = sqlite3Fts5StorageDeleteAll(p);\n  if( rc==SQLITE_OK ){\n    rc = fts5StorageLoadTotals(p, 1);\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, 0);\n  }\n\n  while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pScan) ){\n    i64 iRowid = sqlite3_column_int64(pScan, 0);\n\n    sqlite3Fts5BufferZero(&buf);\n    rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);\n    for(ctx.iCol=0; rc==SQLITE_OK && ctx.iCol<pConfig->nCol; ctx.iCol++){\n      ctx.szCol = 0;\n      if( pConfig->abUnindexed[ctx.iCol]==0 ){\n        rc = sqlite3Fts5Tokenize(pConfig, \n            FTS5_TOKENIZE_DOCUMENT,\n            (const char*)sqlite3_column_text(pScan, ctx.iCol+1),\n            sqlite3_column_bytes(pScan, ctx.iCol+1),\n            (void*)&ctx,\n            fts5StorageInsertCallback\n        );\n      }\n      sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);\n      p->aTotalSize[ctx.iCol] += (i64)ctx.szCol;\n    }\n    p->nTotalRow++;\n\n    if( rc==SQLITE_OK ){\n      rc = fts5StorageInsertDocsize(p, iRowid, &buf);\n    }\n  }\n  sqlite3_free(buf.p);\n\n  /* Write the averages record */\n  if( rc==SQLITE_OK ){\n    rc = fts5StorageSaveTotals(p);\n  }\n  return rc;\n}\n\nstatic int sqlite3Fts5StorageOptimize(Fts5Storage *p){\n  return sqlite3Fts5IndexOptimize(p->pIndex);\n}\n\nstatic int sqlite3Fts5StorageMerge(Fts5Storage *p, int nMerge){\n  return sqlite3Fts5IndexMerge(p->pIndex, nMerge);\n}\n\nstatic int sqlite3Fts5StorageReset(Fts5Storage *p){\n  return sqlite3Fts5IndexReset(p->pIndex);\n}\n\n/*\n** Allocate a new rowid. This is used for \"external content\" tables when\n** a NULL value is inserted into the rowid column. The new rowid is allocated\n** by inserting a dummy row into the %_docsize table. The dummy will be\n** overwritten later.\n**\n** If the %_docsize table does not exist, SQLITE_MISMATCH is returned. In\n** this case the user is required to provide a rowid explicitly.\n*/\nstatic int fts5StorageNewRowid(Fts5Storage *p, i64 *piRowid){\n  int rc = SQLITE_MISMATCH;\n  if( p->pConfig->bColumnsize ){\n    sqlite3_stmt *pReplace = 0;\n    rc = fts5StorageGetStmt(p, FTS5_STMT_REPLACE_DOCSIZE, &pReplace, 0);\n    if( rc==SQLITE_OK ){\n      sqlite3_bind_null(pReplace, 1);\n      sqlite3_bind_null(pReplace, 2);\n      sqlite3_step(pReplace);\n      rc = sqlite3_reset(pReplace);\n    }\n    if( rc==SQLITE_OK ){\n      *piRowid = sqlite3_last_insert_rowid(p->pConfig->db);\n    }\n  }\n  return rc;\n}\n\n/*\n** Insert a new row into the FTS content table.\n*/\nstatic int sqlite3Fts5StorageContentInsert(\n  Fts5Storage *p, \n  sqlite3_value **apVal, \n  i64 *piRowid\n){\n  Fts5Config *pConfig = p->pConfig;\n  int rc = SQLITE_OK;\n\n  /* Insert the new row into the %_content table. */\n  if( pConfig->eContent!=FTS5_CONTENT_NORMAL ){\n    if( sqlite3_value_type(apVal[1])==SQLITE_INTEGER ){\n      *piRowid = sqlite3_value_int64(apVal[1]);\n    }else{\n      rc = fts5StorageNewRowid(p, piRowid);\n    }\n  }else{\n    sqlite3_stmt *pInsert = 0;    /* Statement to write %_content table */\n    int i;                        /* Counter variable */\n    rc = fts5StorageGetStmt(p, FTS5_STMT_INSERT_CONTENT, &pInsert, 0);\n    for(i=1; rc==SQLITE_OK && i<=pConfig->nCol+1; i++){\n      rc = sqlite3_bind_value(pInsert, i, apVal[i]);\n    }\n    if( rc==SQLITE_OK ){\n      sqlite3_step(pInsert);\n      rc = sqlite3_reset(pInsert);\n    }\n    *piRowid = sqlite3_last_insert_rowid(pConfig->db);\n  }\n\n  return rc;\n}\n\n/*\n** Insert new entries into the FTS index and %_docsize table.\n*/\nstatic int sqlite3Fts5StorageIndexInsert(\n  Fts5Storage *p, \n  sqlite3_value **apVal, \n  i64 iRowid\n){\n  Fts5Config *pConfig = p->pConfig;\n  int rc = SQLITE_OK;             /* Return code */\n  Fts5InsertCtx ctx;              /* Tokenization callback context object */\n  Fts5Buffer buf;                 /* Buffer used to build up %_docsize blob */\n\n  memset(&buf, 0, sizeof(Fts5Buffer));\n  ctx.pStorage = p;\n  rc = fts5StorageLoadTotals(p, 1);\n\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5IndexBeginWrite(p->pIndex, 0, iRowid);\n  }\n  for(ctx.iCol=0; rc==SQLITE_OK && ctx.iCol<pConfig->nCol; ctx.iCol++){\n    ctx.szCol = 0;\n    if( pConfig->abUnindexed[ctx.iCol]==0 ){\n      rc = sqlite3Fts5Tokenize(pConfig, \n          FTS5_TOKENIZE_DOCUMENT,\n          (const char*)sqlite3_value_text(apVal[ctx.iCol+2]),\n          sqlite3_value_bytes(apVal[ctx.iCol+2]),\n          (void*)&ctx,\n          fts5StorageInsertCallback\n      );\n    }\n    sqlite3Fts5BufferAppendVarint(&rc, &buf, ctx.szCol);\n    p->aTotalSize[ctx.iCol] += (i64)ctx.szCol;\n  }\n  p->nTotalRow++;\n\n  /* Write the %_docsize record */\n  if( rc==SQLITE_OK ){\n    rc = fts5StorageInsertDocsize(p, iRowid, &buf);\n  }\n  sqlite3_free(buf.p);\n\n  /* Write the averages record */\n  if( rc==SQLITE_OK ){\n    rc = fts5StorageSaveTotals(p);\n  }\n\n  return rc;\n}\n\nstatic int fts5StorageCount(Fts5Storage *p, const char *zSuffix, i64 *pnRow){\n  Fts5Config *pConfig = p->pConfig;\n  char *zSql;\n  int rc;\n\n  zSql = sqlite3_mprintf(\"SELECT count(*) FROM %Q.'%q_%s'\", \n      pConfig->zDb, pConfig->zName, zSuffix\n  );\n  if( zSql==0 ){\n    rc = SQLITE_NOMEM;\n  }else{\n    sqlite3_stmt *pCnt = 0;\n    rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pCnt, 0);\n    if( rc==SQLITE_OK ){\n      if( SQLITE_ROW==sqlite3_step(pCnt) ){\n        *pnRow = sqlite3_column_int64(pCnt, 0);\n      }\n      rc = sqlite3_finalize(pCnt);\n    }\n  }\n\n  sqlite3_free(zSql);\n  return rc;\n}\n\n/*\n** Context object used by sqlite3Fts5StorageIntegrity().\n*/\ntypedef struct Fts5IntegrityCtx Fts5IntegrityCtx;\nstruct Fts5IntegrityCtx {\n  i64 iRowid;\n  int iCol;\n  int szCol;\n  u64 cksum;\n  Fts5Termset *pTermset;\n  Fts5Config *pConfig;\n};\n\n\n/*\n** Tokenization callback used by integrity check.\n*/\nstatic int fts5StorageIntegrityCallback(\n  void *pContext,                 /* Pointer to Fts5IntegrityCtx object */\n  int tflags,\n  const char *pToken,             /* Buffer containing token */\n  int nToken,                     /* Size of token in bytes */\n  int iUnused1,                   /* Start offset of token */\n  int iUnused2                    /* End offset of token */\n){\n  Fts5IntegrityCtx *pCtx = (Fts5IntegrityCtx*)pContext;\n  Fts5Termset *pTermset = pCtx->pTermset;\n  int bPresent;\n  int ii;\n  int rc = SQLITE_OK;\n  int iPos;\n  int iCol;\n\n  UNUSED_PARAM2(iUnused1, iUnused2);\n  if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;\n\n  if( (tflags & FTS5_TOKEN_COLOCATED)==0 || pCtx->szCol==0 ){\n    pCtx->szCol++;\n  }\n\n  switch( pCtx->pConfig->eDetail ){\n    case FTS5_DETAIL_FULL:\n      iPos = pCtx->szCol-1;\n      iCol = pCtx->iCol;\n      break;\n\n    case FTS5_DETAIL_COLUMNS:\n      iPos = pCtx->iCol;\n      iCol = 0;\n      break;\n\n    default:\n      assert( pCtx->pConfig->eDetail==FTS5_DETAIL_NONE );\n      iPos = 0;\n      iCol = 0;\n      break;\n  }\n\n  rc = sqlite3Fts5TermsetAdd(pTermset, 0, pToken, nToken, &bPresent);\n  if( rc==SQLITE_OK && bPresent==0 ){\n    pCtx->cksum ^= sqlite3Fts5IndexEntryCksum(\n        pCtx->iRowid, iCol, iPos, 0, pToken, nToken\n    );\n  }\n\n  for(ii=0; rc==SQLITE_OK && ii<pCtx->pConfig->nPrefix; ii++){\n    const int nChar = pCtx->pConfig->aPrefix[ii];\n    int nByte = sqlite3Fts5IndexCharlenToBytelen(pToken, nToken, nChar);\n    if( nByte ){\n      rc = sqlite3Fts5TermsetAdd(pTermset, ii+1, pToken, nByte, &bPresent);\n      if( bPresent==0 ){\n        pCtx->cksum ^= sqlite3Fts5IndexEntryCksum(\n            pCtx->iRowid, iCol, iPos, ii+1, pToken, nByte\n        );\n      }\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Check that the contents of the FTS index match that of the %_content\n** table. Return SQLITE_OK if they do, or SQLITE_CORRUPT if not. Return\n** some other SQLite error code if an error occurs while attempting to\n** determine this.\n*/\nstatic int sqlite3Fts5StorageIntegrity(Fts5Storage *p){\n  Fts5Config *pConfig = p->pConfig;\n  int rc;                         /* Return code */\n  int *aColSize;                  /* Array of size pConfig->nCol */\n  i64 *aTotalSize;                /* Array of size pConfig->nCol */\n  Fts5IntegrityCtx ctx;\n  sqlite3_stmt *pScan;\n\n  memset(&ctx, 0, sizeof(Fts5IntegrityCtx));\n  ctx.pConfig = p->pConfig;\n  aTotalSize = (i64*)sqlite3_malloc(pConfig->nCol * (sizeof(int)+sizeof(i64)));\n  if( !aTotalSize ) return SQLITE_NOMEM;\n  aColSize = (int*)&aTotalSize[pConfig->nCol];\n  memset(aTotalSize, 0, sizeof(i64) * pConfig->nCol);\n\n  /* Generate the expected index checksum based on the contents of the\n  ** %_content table. This block stores the checksum in ctx.cksum. */\n  rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, 0);\n  if( rc==SQLITE_OK ){\n    int rc2;\n    while( SQLITE_ROW==sqlite3_step(pScan) ){\n      int i;\n      ctx.iRowid = sqlite3_column_int64(pScan, 0);\n      ctx.szCol = 0;\n      if( pConfig->bColumnsize ){\n        rc = sqlite3Fts5StorageDocsize(p, ctx.iRowid, aColSize);\n      }\n      if( rc==SQLITE_OK && pConfig->eDetail==FTS5_DETAIL_NONE ){\n        rc = sqlite3Fts5TermsetNew(&ctx.pTermset);\n      }\n      for(i=0; rc==SQLITE_OK && i<pConfig->nCol; i++){\n        if( pConfig->abUnindexed[i] ) continue;\n        ctx.iCol = i;\n        ctx.szCol = 0;\n        if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){\n          rc = sqlite3Fts5TermsetNew(&ctx.pTermset);\n        }\n        if( rc==SQLITE_OK ){\n          rc = sqlite3Fts5Tokenize(pConfig, \n              FTS5_TOKENIZE_DOCUMENT,\n              (const char*)sqlite3_column_text(pScan, i+1),\n              sqlite3_column_bytes(pScan, i+1),\n              (void*)&ctx,\n              fts5StorageIntegrityCallback\n          );\n        }\n        if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){\n          rc = FTS5_CORRUPT;\n        }\n        aTotalSize[i] += ctx.szCol;\n        if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){\n          sqlite3Fts5TermsetFree(ctx.pTermset);\n          ctx.pTermset = 0;\n        }\n      }\n      sqlite3Fts5TermsetFree(ctx.pTermset);\n      ctx.pTermset = 0;\n\n      if( rc!=SQLITE_OK ) break;\n    }\n    rc2 = sqlite3_reset(pScan);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n\n  /* Test that the \"totals\" (sometimes called \"averages\") record looks Ok */\n  if( rc==SQLITE_OK ){\n    int i;\n    rc = fts5StorageLoadTotals(p, 0);\n    for(i=0; rc==SQLITE_OK && i<pConfig->nCol; i++){\n      if( p->aTotalSize[i]!=aTotalSize[i] ) rc = FTS5_CORRUPT;\n    }\n  }\n\n  /* Check that the %_docsize and %_content tables contain the expected\n  ** number of rows.  */\n  if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){\n    i64 nRow = 0;\n    rc = fts5StorageCount(p, \"content\", &nRow);\n    if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;\n  }\n  if( rc==SQLITE_OK && pConfig->bColumnsize ){\n    i64 nRow = 0;\n    rc = fts5StorageCount(p, \"docsize\", &nRow);\n    if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;\n  }\n\n  /* Pass the expected checksum down to the FTS index module. It will\n  ** verify, amongst other things, that it matches the checksum generated by\n  ** inspecting the index itself.  */\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5IndexIntegrityCheck(p->pIndex, ctx.cksum);\n  }\n\n  sqlite3_free(aTotalSize);\n  return rc;\n}\n\n/*\n** Obtain an SQLite statement handle that may be used to read data from the\n** %_content table.\n*/\nstatic int sqlite3Fts5StorageStmt(\n  Fts5Storage *p, \n  int eStmt, \n  sqlite3_stmt **pp, \n  char **pzErrMsg\n){\n  int rc;\n  assert( eStmt==FTS5_STMT_SCAN_ASC \n       || eStmt==FTS5_STMT_SCAN_DESC\n       || eStmt==FTS5_STMT_LOOKUP\n  );\n  rc = fts5StorageGetStmt(p, eStmt, pp, pzErrMsg);\n  if( rc==SQLITE_OK ){\n    assert( p->aStmt[eStmt]==*pp );\n    p->aStmt[eStmt] = 0;\n  }\n  return rc;\n}\n\n/*\n** Release an SQLite statement handle obtained via an earlier call to\n** sqlite3Fts5StorageStmt(). The eStmt parameter passed to this function\n** must match that passed to the sqlite3Fts5StorageStmt() call.\n*/\nstatic void sqlite3Fts5StorageStmtRelease(\n  Fts5Storage *p, \n  int eStmt, \n  sqlite3_stmt *pStmt\n){\n  assert( eStmt==FTS5_STMT_SCAN_ASC\n       || eStmt==FTS5_STMT_SCAN_DESC\n       || eStmt==FTS5_STMT_LOOKUP\n  );\n  if( p->aStmt[eStmt]==0 ){\n    sqlite3_reset(pStmt);\n    p->aStmt[eStmt] = pStmt;\n  }else{\n    sqlite3_finalize(pStmt);\n  }\n}\n\nstatic int fts5StorageDecodeSizeArray(\n  int *aCol, int nCol,            /* Array to populate */\n  const u8 *aBlob, int nBlob      /* Record to read varints from */\n){\n  int i;\n  int iOff = 0;\n  for(i=0; i<nCol; i++){\n    if( iOff>=nBlob ) return 1;\n    iOff += fts5GetVarint32(&aBlob[iOff], aCol[i]);\n  }\n  return (iOff!=nBlob);\n}\n\n/*\n** Argument aCol points to an array of integers containing one entry for\n** each table column. This function reads the %_docsize record for the\n** specified rowid and populates aCol[] with the results.\n**\n** An SQLite error code is returned if an error occurs, or SQLITE_OK\n** otherwise.\n*/\nstatic int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol){\n  int nCol = p->pConfig->nCol;    /* Number of user columns in table */\n  sqlite3_stmt *pLookup = 0;      /* Statement to query %_docsize */\n  int rc;                         /* Return Code */\n\n  assert( p->pConfig->bColumnsize );\n  rc = fts5StorageGetStmt(p, FTS5_STMT_LOOKUP_DOCSIZE, &pLookup, 0);\n  if( rc==SQLITE_OK ){\n    int bCorrupt = 1;\n    sqlite3_bind_int64(pLookup, 1, iRowid);\n    if( SQLITE_ROW==sqlite3_step(pLookup) ){\n      const u8 *aBlob = sqlite3_column_blob(pLookup, 0);\n      int nBlob = sqlite3_column_bytes(pLookup, 0);\n      if( 0==fts5StorageDecodeSizeArray(aCol, nCol, aBlob, nBlob) ){\n        bCorrupt = 0;\n      }\n    }\n    rc = sqlite3_reset(pLookup);\n    if( bCorrupt && rc==SQLITE_OK ){\n      rc = FTS5_CORRUPT;\n    }\n  }\n\n  return rc;\n}\n\nstatic int sqlite3Fts5StorageSize(Fts5Storage *p, int iCol, i64 *pnToken){\n  int rc = fts5StorageLoadTotals(p, 0);\n  if( rc==SQLITE_OK ){\n    *pnToken = 0;\n    if( iCol<0 ){\n      int i;\n      for(i=0; i<p->pConfig->nCol; i++){\n        *pnToken += p->aTotalSize[i];\n      }\n    }else if( iCol<p->pConfig->nCol ){\n      *pnToken = p->aTotalSize[iCol];\n    }else{\n      rc = SQLITE_RANGE;\n    }\n  }\n  return rc;\n}\n\nstatic int sqlite3Fts5StorageRowCount(Fts5Storage *p, i64 *pnRow){\n  int rc = fts5StorageLoadTotals(p, 0);\n  if( rc==SQLITE_OK ){\n    *pnRow = p->nTotalRow;\n  }\n  return rc;\n}\n\n/*\n** Flush any data currently held in-memory to disk.\n*/\nstatic int sqlite3Fts5StorageSync(Fts5Storage *p, int bCommit){\n  if( bCommit && p->bTotalsValid ){\n    int rc = fts5StorageSaveTotals(p);\n    p->bTotalsValid = 0;\n    if( rc!=SQLITE_OK ) return rc;\n  }\n  return sqlite3Fts5IndexSync(p->pIndex, bCommit);\n}\n\nstatic int sqlite3Fts5StorageRollback(Fts5Storage *p){\n  p->bTotalsValid = 0;\n  return sqlite3Fts5IndexRollback(p->pIndex);\n}\n\nstatic int sqlite3Fts5StorageConfigValue(\n  Fts5Storage *p, \n  const char *z,\n  sqlite3_value *pVal,\n  int iVal\n){\n  sqlite3_stmt *pReplace = 0;\n  int rc = fts5StorageGetStmt(p, FTS5_STMT_REPLACE_CONFIG, &pReplace, 0);\n  if( rc==SQLITE_OK ){\n    sqlite3_bind_text(pReplace, 1, z, -1, SQLITE_STATIC);\n    if( pVal ){\n      sqlite3_bind_value(pReplace, 2, pVal);\n    }else{\n      sqlite3_bind_int(pReplace, 2, iVal);\n    }\n    sqlite3_step(pReplace);\n    rc = sqlite3_reset(pReplace);\n  }\n  if( rc==SQLITE_OK && pVal ){\n    int iNew = p->pConfig->iCookie + 1;\n    rc = sqlite3Fts5IndexSetCookie(p->pIndex, iNew);\n    if( rc==SQLITE_OK ){\n      p->pConfig->iCookie = iNew;\n    }\n  }\n  return rc;\n}\n\n#line 1 \"fts5_tokenize.c\"\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n*/\n\n\n/* #include \"fts5Int.h\" */\n\n/**************************************************************************\n** Start of ascii tokenizer implementation.\n*/\n\n/*\n** For tokenizers with no \"unicode\" modifier, the set of token characters\n** is the same as the set of ASCII range alphanumeric characters. \n*/\nstatic unsigned char aAsciiTokenChar[128] = {\n  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,   /* 0x00..0x0F */\n  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,   /* 0x10..0x1F */\n  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,   /* 0x20..0x2F */\n  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 0, 0, 0, 0, 0, 0,   /* 0x30..0x3F */\n  0, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   /* 0x40..0x4F */\n  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 0, 0, 0, 0, 0,   /* 0x50..0x5F */\n  0, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   /* 0x60..0x6F */\n  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 0, 0, 0, 0, 0,   /* 0x70..0x7F */\n};\n\ntypedef struct AsciiTokenizer AsciiTokenizer;\nstruct AsciiTokenizer {\n  unsigned char aTokenChar[128];\n};\n\nstatic void fts5AsciiAddExceptions(\n  AsciiTokenizer *p, \n  const char *zArg, \n  int bTokenChars\n){\n  int i;\n  for(i=0; zArg[i]; i++){\n    if( (zArg[i] & 0x80)==0 ){\n      p->aTokenChar[(int)zArg[i]] = (unsigned char)bTokenChars;\n    }\n  }\n}\n\n/*\n** Delete a \"ascii\" tokenizer.\n*/\nstatic void fts5AsciiDelete(Fts5Tokenizer *p){\n  sqlite3_free(p);\n}\n\n/*\n** Create an \"ascii\" tokenizer.\n*/\nstatic int fts5AsciiCreate(\n  void *pUnused, \n  const char **azArg, int nArg,\n  Fts5Tokenizer **ppOut\n){\n  int rc = SQLITE_OK;\n  AsciiTokenizer *p = 0;\n  UNUSED_PARAM(pUnused);\n  if( nArg%2 ){\n    rc = SQLITE_ERROR;\n  }else{\n    p = sqlite3_malloc(sizeof(AsciiTokenizer));\n    if( p==0 ){\n      rc = SQLITE_NOMEM;\n    }else{\n      int i;\n      memset(p, 0, sizeof(AsciiTokenizer));\n      memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar));\n      for(i=0; rc==SQLITE_OK && i<nArg; i+=2){\n        const char *zArg = azArg[i+1];\n        if( 0==sqlite3_stricmp(azArg[i], \"tokenchars\") ){\n          fts5AsciiAddExceptions(p, zArg, 1);\n        }else\n        if( 0==sqlite3_stricmp(azArg[i], \"separators\") ){\n          fts5AsciiAddExceptions(p, zArg, 0);\n        }else{\n          rc = SQLITE_ERROR;\n        }\n      }\n      if( rc!=SQLITE_OK ){\n        fts5AsciiDelete((Fts5Tokenizer*)p);\n        p = 0;\n      }\n    }\n  }\n\n  *ppOut = (Fts5Tokenizer*)p;\n  return rc;\n}\n\n\nstatic void asciiFold(char *aOut, const char *aIn, int nByte){\n  int i;\n  for(i=0; i<nByte; i++){\n    char c = aIn[i];\n    if( c>='A' && c<='Z' ) c += 32;\n    aOut[i] = c;\n  }\n}\n\n/*\n** Tokenize some text using the ascii tokenizer.\n*/\nstatic int fts5AsciiTokenize(\n  Fts5Tokenizer *pTokenizer,\n  void *pCtx,\n  int iUnused,\n  const char *pText, int nText,\n  int (*xToken)(void*, int, const char*, int nToken, int iStart, int iEnd)\n){\n  AsciiTokenizer *p = (AsciiTokenizer*)pTokenizer;\n  int rc = SQLITE_OK;\n  int ie;\n  int is = 0;\n\n  char aFold[64];\n  int nFold = sizeof(aFold);\n  char *pFold = aFold;\n  unsigned char *a = p->aTokenChar;\n\n  UNUSED_PARAM(iUnused);\n\n  while( is<nText && rc==SQLITE_OK ){\n    int nByte;\n\n    /* Skip any leading divider characters. */\n    while( is<nText && ((pText[is]&0x80)==0 && a[(int)pText[is]]==0) ){\n      is++;\n    }\n    if( is==nText ) break;\n\n    /* Count the token characters */\n    ie = is+1;\n    while( ie<nText && ((pText[ie]&0x80) || a[(int)pText[ie]] ) ){\n      ie++;\n    }\n\n    /* Fold to lower case */\n    nByte = ie-is;\n    if( nByte>nFold ){\n      if( pFold!=aFold ) sqlite3_free(pFold);\n      pFold = sqlite3_malloc(nByte*2);\n      if( pFold==0 ){\n        rc = SQLITE_NOMEM;\n        break;\n      }\n      nFold = nByte*2;\n    }\n    asciiFold(pFold, &pText[is], nByte);\n\n    /* Invoke the token callback */\n    rc = xToken(pCtx, 0, pFold, nByte, is, ie);\n    is = ie+1;\n  }\n  \n  if( pFold!=aFold ) sqlite3_free(pFold);\n  if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n  return rc;\n}\n\n/**************************************************************************\n** Start of unicode61 tokenizer implementation.\n*/\n\n\n/*\n** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied\n** from the sqlite3 source file utf.c. If this file is compiled as part\n** of the amalgamation, they are not required.\n*/\n#ifndef SQLITE_AMALGAMATION\n\nstatic const unsigned char sqlite3Utf8Trans1[] = {\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,\n  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,\n};\n\n#define READ_UTF8(zIn, zTerm, c)                           \\\n  c = *(zIn++);                                            \\\n  if( c>=0xc0 ){                                           \\\n    c = sqlite3Utf8Trans1[c-0xc0];                         \\\n    while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){            \\\n      c = (c<<6) + (0x3f & *(zIn++));                      \\\n    }                                                      \\\n    if( c<0x80                                             \\\n        || (c&0xFFFFF800)==0xD800                          \\\n        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }        \\\n  }\n\n\n#define WRITE_UTF8(zOut, c) {                          \\\n  if( c<0x00080 ){                                     \\\n    *zOut++ = (unsigned char)(c&0xFF);                 \\\n  }                                                    \\\n  else if( c<0x00800 ){                                \\\n    *zOut++ = 0xC0 + (unsigned char)((c>>6)&0x1F);     \\\n    *zOut++ = 0x80 + (unsigned char)(c & 0x3F);        \\\n  }                                                    \\\n  else if( c<0x10000 ){                                \\\n    *zOut++ = 0xE0 + (unsigned char)((c>>12)&0x0F);    \\\n    *zOut++ = 0x80 + (unsigned char)((c>>6) & 0x3F);   \\\n    *zOut++ = 0x80 + (unsigned char)(c & 0x3F);        \\\n  }else{                                               \\\n    *zOut++ = 0xF0 + (unsigned char)((c>>18) & 0x07);  \\\n    *zOut++ = 0x80 + (unsigned char)((c>>12) & 0x3F);  \\\n    *zOut++ = 0x80 + (unsigned char)((c>>6) & 0x3F);   \\\n    *zOut++ = 0x80 + (unsigned char)(c & 0x3F);        \\\n  }                                                    \\\n}\n\n#endif /* ifndef SQLITE_AMALGAMATION */\n\ntypedef struct Unicode61Tokenizer Unicode61Tokenizer;\nstruct Unicode61Tokenizer {\n  unsigned char aTokenChar[128];  /* ASCII range token characters */\n  char *aFold;                    /* Buffer to fold text into */\n  int nFold;                      /* Size of aFold[] in bytes */\n  int bRemoveDiacritic;           /* True if remove_diacritics=1 is set */\n  int nException;\n  int *aiException;\n};\n\nstatic int fts5UnicodeAddExceptions(\n  Unicode61Tokenizer *p,          /* Tokenizer object */\n  const char *z,                  /* Characters to treat as exceptions */\n  int bTokenChars                 /* 1 for 'tokenchars', 0 for 'separators' */\n){\n  int rc = SQLITE_OK;\n  int n = (int)strlen(z);\n  int *aNew;\n\n  if( n>0 ){\n    aNew = (int*)sqlite3_realloc(p->aiException, (n+p->nException)*sizeof(int));\n    if( aNew ){\n      int nNew = p->nException;\n      const unsigned char *zCsr = (const unsigned char*)z;\n      const unsigned char *zTerm = (const unsigned char*)&z[n];\n      while( zCsr<zTerm ){\n        int iCode;\n        int bToken;\n        READ_UTF8(zCsr, zTerm, iCode);\n        if( iCode<128 ){\n          p->aTokenChar[iCode] = (unsigned char)bTokenChars;\n        }else{\n          bToken = sqlite3Fts5UnicodeIsalnum(iCode);\n          assert( (bToken==0 || bToken==1) ); \n          assert( (bTokenChars==0 || bTokenChars==1) );\n          if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){\n            int i;\n            for(i=0; i<nNew; i++){\n              if( aNew[i]>iCode ) break;\n            }\n            memmove(&aNew[i+1], &aNew[i], (nNew-i)*sizeof(int));\n            aNew[i] = iCode;\n            nNew++;\n          }\n        }\n      }\n      p->aiException = aNew;\n      p->nException = nNew;\n    }else{\n      rc = SQLITE_NOMEM;\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Return true if the p->aiException[] array contains the value iCode.\n*/\nstatic int fts5UnicodeIsException(Unicode61Tokenizer *p, int iCode){\n  if( p->nException>0 ){\n    int *a = p->aiException;\n    int iLo = 0;\n    int iHi = p->nException-1;\n\n    while( iHi>=iLo ){\n      int iTest = (iHi + iLo) / 2;\n      if( iCode==a[iTest] ){\n        return 1;\n      }else if( iCode>a[iTest] ){\n        iLo = iTest+1;\n      }else{\n        iHi = iTest-1;\n      }\n    }\n  }\n\n  return 0;\n}\n\n/*\n** Delete a \"unicode61\" tokenizer.\n*/\nstatic void fts5UnicodeDelete(Fts5Tokenizer *pTok){\n  if( pTok ){\n    Unicode61Tokenizer *p = (Unicode61Tokenizer*)pTok;\n    sqlite3_free(p->aiException);\n    sqlite3_free(p->aFold);\n    sqlite3_free(p);\n  }\n  return;\n}\n\n/*\n** Create a \"unicode61\" tokenizer.\n*/\nstatic int fts5UnicodeCreate(\n  void *pUnused, \n  const char **azArg, int nArg,\n  Fts5Tokenizer **ppOut\n){\n  int rc = SQLITE_OK;             /* Return code */\n  Unicode61Tokenizer *p = 0;      /* New tokenizer object */ \n\n  UNUSED_PARAM(pUnused);\n\n  if( nArg%2 ){\n    rc = SQLITE_ERROR;\n  }else{\n    p = (Unicode61Tokenizer*)sqlite3_malloc(sizeof(Unicode61Tokenizer));\n    if( p ){\n      int i;\n      memset(p, 0, sizeof(Unicode61Tokenizer));\n      memcpy(p->aTokenChar, aAsciiTokenChar, sizeof(aAsciiTokenChar));\n      p->bRemoveDiacritic = 1;\n      p->nFold = 64;\n      p->aFold = sqlite3_malloc(p->nFold * sizeof(char));\n      if( p->aFold==0 ){\n        rc = SQLITE_NOMEM;\n      }\n      for(i=0; rc==SQLITE_OK && i<nArg; i+=2){\n        const char *zArg = azArg[i+1];\n        if( 0==sqlite3_stricmp(azArg[i], \"remove_diacritics\") ){\n          if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1] ){\n            rc = SQLITE_ERROR;\n          }\n          p->bRemoveDiacritic = (zArg[0]=='1');\n        }else\n        if( 0==sqlite3_stricmp(azArg[i], \"tokenchars\") ){\n          rc = fts5UnicodeAddExceptions(p, zArg, 1);\n        }else\n        if( 0==sqlite3_stricmp(azArg[i], \"separators\") ){\n          rc = fts5UnicodeAddExceptions(p, zArg, 0);\n        }else{\n          rc = SQLITE_ERROR;\n        }\n      }\n    }else{\n      rc = SQLITE_NOMEM;\n    }\n    if( rc!=SQLITE_OK ){\n      fts5UnicodeDelete((Fts5Tokenizer*)p);\n      p = 0;\n    }\n    *ppOut = (Fts5Tokenizer*)p;\n  }\n  return rc;\n}\n\n/*\n** Return true if, for the purposes of tokenizing with the tokenizer\n** passed as the first argument, codepoint iCode is considered a token \n** character (not a separator).\n*/\nstatic int fts5UnicodeIsAlnum(Unicode61Tokenizer *p, int iCode){\n  assert( (sqlite3Fts5UnicodeIsalnum(iCode) & 0xFFFFFFFE)==0 );\n  return sqlite3Fts5UnicodeIsalnum(iCode) ^ fts5UnicodeIsException(p, iCode);\n}\n\nstatic int fts5UnicodeTokenize(\n  Fts5Tokenizer *pTokenizer,\n  void *pCtx,\n  int iUnused,\n  const char *pText, int nText,\n  int (*xToken)(void*, int, const char*, int nToken, int iStart, int iEnd)\n){\n  Unicode61Tokenizer *p = (Unicode61Tokenizer*)pTokenizer;\n  int rc = SQLITE_OK;\n  unsigned char *a = p->aTokenChar;\n\n  unsigned char *zTerm = (unsigned char*)&pText[nText];\n  unsigned char *zCsr = (unsigned char *)pText;\n\n  /* Output buffer */\n  char *aFold = p->aFold;\n  int nFold = p->nFold;\n  const char *pEnd = &aFold[nFold-6];\n\n  UNUSED_PARAM(iUnused);\n\n  /* Each iteration of this loop gobbles up a contiguous run of separators,\n  ** then the next token.  */\n  while( rc==SQLITE_OK ){\n    int iCode;                    /* non-ASCII codepoint read from input */\n    char *zOut = aFold;\n    int is;\n    int ie;\n\n    /* Skip any separator characters. */\n    while( 1 ){\n      if( zCsr>=zTerm ) goto tokenize_done;\n      if( *zCsr & 0x80 ) {\n        /* A character outside of the ascii range. Skip past it if it is\n        ** a separator character. Or break out of the loop if it is not. */\n        is = zCsr - (unsigned char*)pText;\n        READ_UTF8(zCsr, zTerm, iCode);\n        if( fts5UnicodeIsAlnum(p, iCode) ){\n          goto non_ascii_tokenchar;\n        }\n      }else{\n        if( a[*zCsr] ){\n          is = zCsr - (unsigned char*)pText;\n          goto ascii_tokenchar;\n        }\n        zCsr++;\n      }\n    }\n\n    /* Run through the tokenchars. Fold them into the output buffer along\n    ** the way.  */\n    while( zCsr<zTerm ){\n\n      /* Grow the output buffer so that there is sufficient space to fit the\n      ** largest possible utf-8 character.  */\n      if( zOut>pEnd ){\n        aFold = sqlite3_malloc(nFold*2);\n        if( aFold==0 ){\n          rc = SQLITE_NOMEM;\n          goto tokenize_done;\n        }\n        zOut = &aFold[zOut - p->aFold];\n        memcpy(aFold, p->aFold, nFold);\n        sqlite3_free(p->aFold);\n        p->aFold = aFold;\n        p->nFold = nFold = nFold*2;\n        pEnd = &aFold[nFold-6];\n      }\n\n      if( *zCsr & 0x80 ){\n        /* An non-ascii-range character. Fold it into the output buffer if\n        ** it is a token character, or break out of the loop if it is not. */\n        READ_UTF8(zCsr, zTerm, iCode);\n        if( fts5UnicodeIsAlnum(p,iCode)||sqlite3Fts5UnicodeIsdiacritic(iCode) ){\n non_ascii_tokenchar:\n          iCode = sqlite3Fts5UnicodeFold(iCode, p->bRemoveDiacritic);\n          if( iCode ) WRITE_UTF8(zOut, iCode);\n        }else{\n          break;\n        }\n      }else if( a[*zCsr]==0 ){\n        /* An ascii-range separator character. End of token. */\n        break; \n      }else{\n ascii_tokenchar:\n        if( *zCsr>='A' && *zCsr<='Z' ){\n          *zOut++ = *zCsr + 32;\n        }else{\n          *zOut++ = *zCsr;\n        }\n        zCsr++;\n      }\n      ie = zCsr - (unsigned char*)pText;\n    }\n\n    /* Invoke the token callback */\n    rc = xToken(pCtx, 0, aFold, zOut-aFold, is, ie); \n  }\n  \n tokenize_done:\n  if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n  return rc;\n}\n\n/**************************************************************************\n** Start of porter stemmer implementation.\n*/\n\n/* Any tokens larger than this (in bytes) are passed through without\n** stemming. */\n#define FTS5_PORTER_MAX_TOKEN 64\n\ntypedef struct PorterTokenizer PorterTokenizer;\nstruct PorterTokenizer {\n  fts5_tokenizer tokenizer;       /* Parent tokenizer module */\n  Fts5Tokenizer *pTokenizer;      /* Parent tokenizer instance */\n  char aBuf[FTS5_PORTER_MAX_TOKEN + 64];\n};\n\n/*\n** Delete a \"porter\" tokenizer.\n*/\nstatic void fts5PorterDelete(Fts5Tokenizer *pTok){\n  if( pTok ){\n    PorterTokenizer *p = (PorterTokenizer*)pTok;\n    if( p->pTokenizer ){\n      p->tokenizer.xDelete(p->pTokenizer);\n    }\n    sqlite3_free(p);\n  }\n}\n\n/*\n** Create a \"porter\" tokenizer.\n*/\nstatic int fts5PorterCreate(\n  void *pCtx, \n  const char **azArg, int nArg,\n  Fts5Tokenizer **ppOut\n){\n  fts5_api *pApi = (fts5_api*)pCtx;\n  int rc = SQLITE_OK;\n  PorterTokenizer *pRet;\n  void *pUserdata = 0;\n  const char *zBase = \"unicode61\";\n\n  if( nArg>0 ){\n    zBase = azArg[0];\n  }\n\n  pRet = (PorterTokenizer*)sqlite3_malloc(sizeof(PorterTokenizer));\n  if( pRet ){\n    memset(pRet, 0, sizeof(PorterTokenizer));\n    rc = pApi->xFindTokenizer(pApi, zBase, &pUserdata, &pRet->tokenizer);\n  }else{\n    rc = SQLITE_NOMEM;\n  }\n  if( rc==SQLITE_OK ){\n    int nArg2 = (nArg>0 ? nArg-1 : 0);\n    const char **azArg2 = (nArg2 ? &azArg[1] : 0);\n    rc = pRet->tokenizer.xCreate(pUserdata, azArg2, nArg2, &pRet->pTokenizer);\n  }\n\n  if( rc!=SQLITE_OK ){\n    fts5PorterDelete((Fts5Tokenizer*)pRet);\n    pRet = 0;\n  }\n  *ppOut = (Fts5Tokenizer*)pRet;\n  return rc;\n}\n\ntypedef struct PorterContext PorterContext;\nstruct PorterContext {\n  void *pCtx;\n  int (*xToken)(void*, int, const char*, int, int, int);\n  char *aBuf;\n};\n\ntypedef struct PorterRule PorterRule;\nstruct PorterRule {\n  const char *zSuffix;\n  int nSuffix;\n  int (*xCond)(char *zStem, int nStem);\n  const char *zOutput;\n  int nOutput;\n};\n\n#if 0\nstatic int fts5PorterApply(char *aBuf, int *pnBuf, PorterRule *aRule){\n  int ret = -1;\n  int nBuf = *pnBuf;\n  PorterRule *p;\n\n  for(p=aRule; p->zSuffix; p++){\n    assert( strlen(p->zSuffix)==p->nSuffix );\n    assert( strlen(p->zOutput)==p->nOutput );\n    if( nBuf<p->nSuffix ) continue;\n    if( 0==memcmp(&aBuf[nBuf - p->nSuffix], p->zSuffix, p->nSuffix) ) break;\n  }\n\n  if( p->zSuffix ){\n    int nStem = nBuf - p->nSuffix;\n    if( p->xCond==0 || p->xCond(aBuf, nStem) ){\n      memcpy(&aBuf[nStem], p->zOutput, p->nOutput);\n      *pnBuf = nStem + p->nOutput;\n      ret = p - aRule;\n    }\n  }\n\n  return ret;\n}\n#endif\n\nstatic int fts5PorterIsVowel(char c, int bYIsVowel){\n  return (\n      c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')\n  );\n}\n\nstatic int fts5PorterGobbleVC(char *zStem, int nStem, int bPrevCons){\n  int i;\n  int bCons = bPrevCons;\n\n  /* Scan for a vowel */\n  for(i=0; i<nStem; i++){\n    if( 0==(bCons = !fts5PorterIsVowel(zStem[i], bCons)) ) break;\n  }\n\n  /* Scan for a consonent */\n  for(i++; i<nStem; i++){\n    if( (bCons = !fts5PorterIsVowel(zStem[i], bCons)) ) return i+1;\n  }\n  return 0;\n}\n\n/* porter rule condition: (m > 0) */\nstatic int fts5Porter_MGt0(char *zStem, int nStem){\n  return !!fts5PorterGobbleVC(zStem, nStem, 0);\n}\n\n/* porter rule condition: (m > 1) */\nstatic int fts5Porter_MGt1(char *zStem, int nStem){\n  int n;\n  n = fts5PorterGobbleVC(zStem, nStem, 0);\n  if( n && fts5PorterGobbleVC(&zStem[n], nStem-n, 1) ){\n    return 1;\n  }\n  return 0;\n}\n\n/* porter rule condition: (m = 1) */\nstatic int fts5Porter_MEq1(char *zStem, int nStem){\n  int n;\n  n = fts5PorterGobbleVC(zStem, nStem, 0);\n  if( n && 0==fts5PorterGobbleVC(&zStem[n], nStem-n, 1) ){\n    return 1;\n  }\n  return 0;\n}\n\n/* porter rule condition: (*o) */\nstatic int fts5Porter_Ostar(char *zStem, int nStem){\n  if( zStem[nStem-1]=='w' || zStem[nStem-1]=='x' || zStem[nStem-1]=='y' ){\n    return 0;\n  }else{\n    int i;\n    int mask = 0;\n    int bCons = 0;\n    for(i=0; i<nStem; i++){\n      bCons = !fts5PorterIsVowel(zStem[i], bCons);\n      assert( bCons==0 || bCons==1 );\n      mask = (mask << 1) + bCons;\n    }\n    return ((mask & 0x0007)==0x0005);\n  }\n}\n\n/* porter rule condition: (m > 1 and (*S or *T)) */\nstatic int fts5Porter_MGt1_and_S_or_T(char *zStem, int nStem){\n  assert( nStem>0 );\n  return (zStem[nStem-1]=='s' || zStem[nStem-1]=='t') \n      && fts5Porter_MGt1(zStem, nStem);\n}\n\n/* porter rule condition: (*v*) */\nstatic int fts5Porter_Vowel(char *zStem, int nStem){\n  int i;\n  for(i=0; i<nStem; i++){\n    if( fts5PorterIsVowel(zStem[i], i>0) ){\n      return 1;\n    }\n  }\n  return 0;\n}\n\n\n/**************************************************************************\n***************************************************************************\n** GENERATED CODE STARTS HERE (mkportersteps.tcl)\n*/\n\nstatic int fts5PorterStep4(char *aBuf, int *pnBuf){\n  int ret = 0;\n  int nBuf = *pnBuf;\n  switch( aBuf[nBuf-2] ){\n    \n    case 'a': \n      if( nBuf>2 && 0==memcmp(\"al\", &aBuf[nBuf-2], 2) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-2) ){\n          *pnBuf = nBuf - 2;\n        }\n      }\n      break;\n  \n    case 'c': \n      if( nBuf>4 && 0==memcmp(\"ance\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-4) ){\n          *pnBuf = nBuf - 4;\n        }\n      }else if( nBuf>4 && 0==memcmp(\"ence\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-4) ){\n          *pnBuf = nBuf - 4;\n        }\n      }\n      break;\n  \n    case 'e': \n      if( nBuf>2 && 0==memcmp(\"er\", &aBuf[nBuf-2], 2) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-2) ){\n          *pnBuf = nBuf - 2;\n        }\n      }\n      break;\n  \n    case 'i': \n      if( nBuf>2 && 0==memcmp(\"ic\", &aBuf[nBuf-2], 2) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-2) ){\n          *pnBuf = nBuf - 2;\n        }\n      }\n      break;\n  \n    case 'l': \n      if( nBuf>4 && 0==memcmp(\"able\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-4) ){\n          *pnBuf = nBuf - 4;\n        }\n      }else if( nBuf>4 && 0==memcmp(\"ible\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-4) ){\n          *pnBuf = nBuf - 4;\n        }\n      }\n      break;\n  \n    case 'n': \n      if( nBuf>3 && 0==memcmp(\"ant\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }else if( nBuf>5 && 0==memcmp(\"ement\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-5) ){\n          *pnBuf = nBuf - 5;\n        }\n      }else if( nBuf>4 && 0==memcmp(\"ment\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-4) ){\n          *pnBuf = nBuf - 4;\n        }\n      }else if( nBuf>3 && 0==memcmp(\"ent\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }\n      break;\n  \n    case 'o': \n      if( nBuf>3 && 0==memcmp(\"ion\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1_and_S_or_T(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }else if( nBuf>2 && 0==memcmp(\"ou\", &aBuf[nBuf-2], 2) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-2) ){\n          *pnBuf = nBuf - 2;\n        }\n      }\n      break;\n  \n    case 's': \n      if( nBuf>3 && 0==memcmp(\"ism\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }\n      break;\n  \n    case 't': \n      if( nBuf>3 && 0==memcmp(\"ate\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }else if( nBuf>3 && 0==memcmp(\"iti\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }\n      break;\n  \n    case 'u': \n      if( nBuf>3 && 0==memcmp(\"ous\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }\n      break;\n  \n    case 'v': \n      if( nBuf>3 && 0==memcmp(\"ive\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }\n      break;\n  \n    case 'z': \n      if( nBuf>3 && 0==memcmp(\"ize\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt1(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }\n      break;\n  \n  }\n  return ret;\n}\n  \n\nstatic int fts5PorterStep1B2(char *aBuf, int *pnBuf){\n  int ret = 0;\n  int nBuf = *pnBuf;\n  switch( aBuf[nBuf-2] ){\n    \n    case 'a': \n      if( nBuf>2 && 0==memcmp(\"at\", &aBuf[nBuf-2], 2) ){\n        memcpy(&aBuf[nBuf-2], \"ate\", 3);\n        *pnBuf = nBuf - 2 + 3;\n        ret = 1;\n      }\n      break;\n  \n    case 'b': \n      if( nBuf>2 && 0==memcmp(\"bl\", &aBuf[nBuf-2], 2) ){\n        memcpy(&aBuf[nBuf-2], \"ble\", 3);\n        *pnBuf = nBuf - 2 + 3;\n        ret = 1;\n      }\n      break;\n  \n    case 'i': \n      if( nBuf>2 && 0==memcmp(\"iz\", &aBuf[nBuf-2], 2) ){\n        memcpy(&aBuf[nBuf-2], \"ize\", 3);\n        *pnBuf = nBuf - 2 + 3;\n        ret = 1;\n      }\n      break;\n  \n  }\n  return ret;\n}\n  \n\nstatic int fts5PorterStep2(char *aBuf, int *pnBuf){\n  int ret = 0;\n  int nBuf = *pnBuf;\n  switch( aBuf[nBuf-2] ){\n    \n    case 'a': \n      if( nBuf>7 && 0==memcmp(\"ational\", &aBuf[nBuf-7], 7) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-7) ){\n          memcpy(&aBuf[nBuf-7], \"ate\", 3);\n          *pnBuf = nBuf - 7 + 3;\n        }\n      }else if( nBuf>6 && 0==memcmp(\"tional\", &aBuf[nBuf-6], 6) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-6) ){\n          memcpy(&aBuf[nBuf-6], \"tion\", 4);\n          *pnBuf = nBuf - 6 + 4;\n        }\n      }\n      break;\n  \n    case 'c': \n      if( nBuf>4 && 0==memcmp(\"enci\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          memcpy(&aBuf[nBuf-4], \"ence\", 4);\n          *pnBuf = nBuf - 4 + 4;\n        }\n      }else if( nBuf>4 && 0==memcmp(\"anci\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          memcpy(&aBuf[nBuf-4], \"ance\", 4);\n          *pnBuf = nBuf - 4 + 4;\n        }\n      }\n      break;\n  \n    case 'e': \n      if( nBuf>4 && 0==memcmp(\"izer\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          memcpy(&aBuf[nBuf-4], \"ize\", 3);\n          *pnBuf = nBuf - 4 + 3;\n        }\n      }\n      break;\n  \n    case 'g': \n      if( nBuf>4 && 0==memcmp(\"logi\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          memcpy(&aBuf[nBuf-4], \"log\", 3);\n          *pnBuf = nBuf - 4 + 3;\n        }\n      }\n      break;\n  \n    case 'l': \n      if( nBuf>3 && 0==memcmp(\"bli\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-3) ){\n          memcpy(&aBuf[nBuf-3], \"ble\", 3);\n          *pnBuf = nBuf - 3 + 3;\n        }\n      }else if( nBuf>4 && 0==memcmp(\"alli\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          memcpy(&aBuf[nBuf-4], \"al\", 2);\n          *pnBuf = nBuf - 4 + 2;\n        }\n      }else if( nBuf>5 && 0==memcmp(\"entli\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"ent\", 3);\n          *pnBuf = nBuf - 5 + 3;\n        }\n      }else if( nBuf>3 && 0==memcmp(\"eli\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-3) ){\n          memcpy(&aBuf[nBuf-3], \"e\", 1);\n          *pnBuf = nBuf - 3 + 1;\n        }\n      }else if( nBuf>5 && 0==memcmp(\"ousli\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"ous\", 3);\n          *pnBuf = nBuf - 5 + 3;\n        }\n      }\n      break;\n  \n    case 'o': \n      if( nBuf>7 && 0==memcmp(\"ization\", &aBuf[nBuf-7], 7) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-7) ){\n          memcpy(&aBuf[nBuf-7], \"ize\", 3);\n          *pnBuf = nBuf - 7 + 3;\n        }\n      }else if( nBuf>5 && 0==memcmp(\"ation\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"ate\", 3);\n          *pnBuf = nBuf - 5 + 3;\n        }\n      }else if( nBuf>4 && 0==memcmp(\"ator\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          memcpy(&aBuf[nBuf-4], \"ate\", 3);\n          *pnBuf = nBuf - 4 + 3;\n        }\n      }\n      break;\n  \n    case 's': \n      if( nBuf>5 && 0==memcmp(\"alism\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"al\", 2);\n          *pnBuf = nBuf - 5 + 2;\n        }\n      }else if( nBuf>7 && 0==memcmp(\"iveness\", &aBuf[nBuf-7], 7) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-7) ){\n          memcpy(&aBuf[nBuf-7], \"ive\", 3);\n          *pnBuf = nBuf - 7 + 3;\n        }\n      }else if( nBuf>7 && 0==memcmp(\"fulness\", &aBuf[nBuf-7], 7) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-7) ){\n          memcpy(&aBuf[nBuf-7], \"ful\", 3);\n          *pnBuf = nBuf - 7 + 3;\n        }\n      }else if( nBuf>7 && 0==memcmp(\"ousness\", &aBuf[nBuf-7], 7) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-7) ){\n          memcpy(&aBuf[nBuf-7], \"ous\", 3);\n          *pnBuf = nBuf - 7 + 3;\n        }\n      }\n      break;\n  \n    case 't': \n      if( nBuf>5 && 0==memcmp(\"aliti\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"al\", 2);\n          *pnBuf = nBuf - 5 + 2;\n        }\n      }else if( nBuf>5 && 0==memcmp(\"iviti\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"ive\", 3);\n          *pnBuf = nBuf - 5 + 3;\n        }\n      }else if( nBuf>6 && 0==memcmp(\"biliti\", &aBuf[nBuf-6], 6) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-6) ){\n          memcpy(&aBuf[nBuf-6], \"ble\", 3);\n          *pnBuf = nBuf - 6 + 3;\n        }\n      }\n      break;\n  \n  }\n  return ret;\n}\n  \n\nstatic int fts5PorterStep3(char *aBuf, int *pnBuf){\n  int ret = 0;\n  int nBuf = *pnBuf;\n  switch( aBuf[nBuf-2] ){\n    \n    case 'a': \n      if( nBuf>4 && 0==memcmp(\"ical\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          memcpy(&aBuf[nBuf-4], \"ic\", 2);\n          *pnBuf = nBuf - 4 + 2;\n        }\n      }\n      break;\n  \n    case 's': \n      if( nBuf>4 && 0==memcmp(\"ness\", &aBuf[nBuf-4], 4) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-4) ){\n          *pnBuf = nBuf - 4;\n        }\n      }\n      break;\n  \n    case 't': \n      if( nBuf>5 && 0==memcmp(\"icate\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"ic\", 2);\n          *pnBuf = nBuf - 5 + 2;\n        }\n      }else if( nBuf>5 && 0==memcmp(\"iciti\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"ic\", 2);\n          *pnBuf = nBuf - 5 + 2;\n        }\n      }\n      break;\n  \n    case 'u': \n      if( nBuf>3 && 0==memcmp(\"ful\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n        }\n      }\n      break;\n  \n    case 'v': \n      if( nBuf>5 && 0==memcmp(\"ative\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          *pnBuf = nBuf - 5;\n        }\n      }\n      break;\n  \n    case 'z': \n      if( nBuf>5 && 0==memcmp(\"alize\", &aBuf[nBuf-5], 5) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-5) ){\n          memcpy(&aBuf[nBuf-5], \"al\", 2);\n          *pnBuf = nBuf - 5 + 2;\n        }\n      }\n      break;\n  \n  }\n  return ret;\n}\n  \n\nstatic int fts5PorterStep1B(char *aBuf, int *pnBuf){\n  int ret = 0;\n  int nBuf = *pnBuf;\n  switch( aBuf[nBuf-2] ){\n    \n    case 'e': \n      if( nBuf>3 && 0==memcmp(\"eed\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_MGt0(aBuf, nBuf-3) ){\n          memcpy(&aBuf[nBuf-3], \"ee\", 2);\n          *pnBuf = nBuf - 3 + 2;\n        }\n      }else if( nBuf>2 && 0==memcmp(\"ed\", &aBuf[nBuf-2], 2) ){\n        if( fts5Porter_Vowel(aBuf, nBuf-2) ){\n          *pnBuf = nBuf - 2;\n          ret = 1;\n        }\n      }\n      break;\n  \n    case 'n': \n      if( nBuf>3 && 0==memcmp(\"ing\", &aBuf[nBuf-3], 3) ){\n        if( fts5Porter_Vowel(aBuf, nBuf-3) ){\n          *pnBuf = nBuf - 3;\n          ret = 1;\n        }\n      }\n      break;\n  \n  }\n  return ret;\n}\n  \n/* \n** GENERATED CODE ENDS HERE (mkportersteps.tcl)\n***************************************************************************\n**************************************************************************/\n\nstatic void fts5PorterStep1A(char *aBuf, int *pnBuf){\n  int nBuf = *pnBuf;\n  if( aBuf[nBuf-1]=='s' ){\n    if( aBuf[nBuf-2]=='e' ){\n      if( (nBuf>4 && aBuf[nBuf-4]=='s' && aBuf[nBuf-3]=='s') \n       || (nBuf>3 && aBuf[nBuf-3]=='i' )\n      ){\n        *pnBuf = nBuf-2;\n      }else{\n        *pnBuf = nBuf-1;\n      }\n    }\n    else if( aBuf[nBuf-2]!='s' ){\n      *pnBuf = nBuf-1;\n    }\n  }\n}\n\nstatic int fts5PorterCb(\n  void *pCtx, \n  int tflags,\n  const char *pToken, \n  int nToken, \n  int iStart, \n  int iEnd\n){\n  PorterContext *p = (PorterContext*)pCtx;\n\n  char *aBuf;\n  int nBuf;\n\n  if( nToken>FTS5_PORTER_MAX_TOKEN || nToken<3 ) goto pass_through;\n  aBuf = p->aBuf;\n  nBuf = nToken;\n  memcpy(aBuf, pToken, nBuf);\n\n  /* Step 1. */\n  fts5PorterStep1A(aBuf, &nBuf);\n  if( fts5PorterStep1B(aBuf, &nBuf) ){\n    if( fts5PorterStep1B2(aBuf, &nBuf)==0 ){\n      char c = aBuf[nBuf-1];\n      if( fts5PorterIsVowel(c, 0)==0 \n       && c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2] \n      ){\n        nBuf--;\n      }else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){\n        aBuf[nBuf++] = 'e';\n      }\n    }\n  }\n\n  /* Step 1C. */\n  if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){\n    aBuf[nBuf-1] = 'i';\n  }\n\n  /* Steps 2 through 4. */\n  fts5PorterStep2(aBuf, &nBuf);\n  fts5PorterStep3(aBuf, &nBuf);\n  fts5PorterStep4(aBuf, &nBuf);\n\n  /* Step 5a. */\n  assert( nBuf>0 );\n  if( aBuf[nBuf-1]=='e' ){\n    if( fts5Porter_MGt1(aBuf, nBuf-1) \n     || (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1))\n    ){\n      nBuf--;\n    }\n  }\n\n  /* Step 5b. */\n  if( nBuf>1 && aBuf[nBuf-1]=='l' \n   && aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1) \n  ){\n    nBuf--;\n  }\n\n  return p->xToken(p->pCtx, tflags, aBuf, nBuf, iStart, iEnd);\n\n pass_through:\n  return p->xToken(p->pCtx, tflags, pToken, nToken, iStart, iEnd);\n}\n\n/*\n** Tokenize using the porter tokenizer.\n*/\nstatic int fts5PorterTokenize(\n  Fts5Tokenizer *pTokenizer,\n  void *pCtx,\n  int flags,\n  const char *pText, int nText,\n  int (*xToken)(void*, int, const char*, int nToken, int iStart, int iEnd)\n){\n  PorterTokenizer *p = (PorterTokenizer*)pTokenizer;\n  PorterContext sCtx;\n  sCtx.xToken = xToken;\n  sCtx.pCtx = pCtx;\n  sCtx.aBuf = p->aBuf;\n  return p->tokenizer.xTokenize(\n      p->pTokenizer, (void*)&sCtx, flags, pText, nText, fts5PorterCb\n  );\n}\n\n/*\n** Register all built-in tokenizers with FTS5.\n*/\nstatic int sqlite3Fts5TokenizerInit(fts5_api *pApi){\n  struct BuiltinTokenizer {\n    const char *zName;\n    fts5_tokenizer x;\n  } aBuiltin[] = {\n    { \"unicode61\", {fts5UnicodeCreate, fts5UnicodeDelete, fts5UnicodeTokenize}},\n    { \"ascii\",     {fts5AsciiCreate, fts5AsciiDelete, fts5AsciiTokenize }},\n    { \"porter\",    {fts5PorterCreate, fts5PorterDelete, fts5PorterTokenize }},\n  };\n  \n  int rc = SQLITE_OK;             /* Return code */\n  int i;                          /* To iterate through builtin functions */\n\n  for(i=0; rc==SQLITE_OK && i<ArraySize(aBuiltin); i++){\n    rc = pApi->xCreateTokenizer(pApi,\n        aBuiltin[i].zName,\n        (void*)pApi,\n        &aBuiltin[i].x,\n        0\n    );\n  }\n\n  return rc;\n}\n\n\n\n#line 1 \"fts5_unicode2.c\"\n/*\n** 2012 May 25\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n*/\n\n/*\n** DO NOT EDIT THIS MACHINE GENERATED FILE.\n*/\n\n\n#include <assert.h>\n\n/*\n** Return true if the argument corresponds to a unicode codepoint\n** classified as either a letter or a number. Otherwise false.\n**\n** The results are undefined if the value passed to this function\n** is less than zero.\n*/\nstatic int sqlite3Fts5UnicodeIsalnum(int c){\n  /* Each unsigned integer in the following array corresponds to a contiguous\n  ** range of unicode codepoints that are not either letters or numbers (i.e.\n  ** codepoints for which this function should return 0).\n  **\n  ** The most significant 22 bits in each 32-bit value contain the first \n  ** codepoint in the range. The least significant 10 bits are used to store\n  ** the size of the range (always at least 1). In other words, the value \n  ** ((C<<22) + N) represents a range of N codepoints starting with codepoint \n  ** C. It is not possible to represent a range larger than 1023 codepoints \n  ** using this format.\n  */\n  static const unsigned int aEntry[] = {\n    0x00000030, 0x0000E807, 0x00016C06, 0x0001EC2F, 0x0002AC07,\n    0x0002D001, 0x0002D803, 0x0002EC01, 0x0002FC01, 0x00035C01,\n    0x0003DC01, 0x000B0804, 0x000B480E, 0x000B9407, 0x000BB401,\n    0x000BBC81, 0x000DD401, 0x000DF801, 0x000E1002, 0x000E1C01,\n    0x000FD801, 0x00120808, 0x00156806, 0x00162402, 0x00163C01,\n    0x00164437, 0x0017CC02, 0x00180005, 0x00181816, 0x00187802,\n    0x00192C15, 0x0019A804, 0x0019C001, 0x001B5001, 0x001B580F,\n    0x001B9C07, 0x001BF402, 0x001C000E, 0x001C3C01, 0x001C4401,\n    0x001CC01B, 0x001E980B, 0x001FAC09, 0x001FD804, 0x00205804,\n    0x00206C09, 0x00209403, 0x0020A405, 0x0020C00F, 0x00216403,\n    0x00217801, 0x0023901B, 0x00240004, 0x0024E803, 0x0024F812,\n    0x00254407, 0x00258804, 0x0025C001, 0x00260403, 0x0026F001,\n    0x0026F807, 0x00271C02, 0x00272C03, 0x00275C01, 0x00278802,\n    0x0027C802, 0x0027E802, 0x00280403, 0x0028F001, 0x0028F805,\n    0x00291C02, 0x00292C03, 0x00294401, 0x0029C002, 0x0029D401,\n    0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03,\n    0x002B8802, 0x002BC002, 0x002C0403, 0x002CF001, 0x002CF807,\n    0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802, 0x002DC001,\n    0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804, 0x002F5C01,\n    0x002FCC08, 0x00300403, 0x0030F807, 0x00311803, 0x00312804,\n    0x00315402, 0x00318802, 0x0031FC01, 0x00320802, 0x0032F001,\n    0x0032F807, 0x00331803, 0x00332804, 0x00335402, 0x00338802,\n    0x00340802, 0x0034F807, 0x00351803, 0x00352804, 0x00355C01,\n    0x00358802, 0x0035E401, 0x00360802, 0x00372801, 0x00373C06,\n    0x00375801, 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007,\n    0x0038FC01, 0x00391C09, 0x00396802, 0x003AC401, 0x003AD006,\n    0x003AEC02, 0x003B2006, 0x003C041F, 0x003CD00C, 0x003DC417,\n    0x003E340B, 0x003E6424, 0x003EF80F, 0x003F380D, 0x0040AC14,\n    0x00412806, 0x00415804, 0x00417803, 0x00418803, 0x00419C07,\n    0x0041C404, 0x0042080C, 0x00423C01, 0x00426806, 0x0043EC01,\n    0x004D740C, 0x004E400A, 0x00500001, 0x0059B402, 0x005A0001,\n    0x005A6C02, 0x005BAC03, 0x005C4803, 0x005CC805, 0x005D4802,\n    0x005DC802, 0x005ED023, 0x005F6004, 0x005F7401, 0x0060000F,\n    0x0062A401, 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002,\n    0x0066C011, 0x00672002, 0x00677822, 0x00685C05, 0x00687802,\n    0x0069540A, 0x0069801D, 0x0069FC01, 0x006A8007, 0x006AA006,\n    0x006C0005, 0x006CD011, 0x006D6823, 0x006E0003, 0x006E840D,\n    0x006F980E, 0x006FF004, 0x00709014, 0x0070EC05, 0x0071F802,\n    0x00730008, 0x00734019, 0x0073B401, 0x0073C803, 0x00770027,\n    0x0077F004, 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403,\n    0x007FB403, 0x007FF402, 0x00800065, 0x0081A806, 0x0081E805,\n    0x00822805, 0x0082801A, 0x00834021, 0x00840002, 0x00840C04,\n    0x00842002, 0x00845001, 0x00845803, 0x00847806, 0x00849401,\n    0x00849C01, 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005,\n    0x00852804, 0x00853C01, 0x00864264, 0x00900027, 0x0091000B,\n    0x0092704E, 0x00940200, 0x009C0475, 0x009E53B9, 0x00AD400A,\n    0x00B39406, 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001,\n    0x00B5FC01, 0x00B7804F, 0x00B8C00C, 0x00BA001A, 0x00BA6C59,\n    0x00BC00D6, 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807,\n    0x00C0D802, 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01,\n    0x00C64002, 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E,\n    0x00C94001, 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100,\n    0x01370040, 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10,\n    0x029A7C01, 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402,\n    0x02A00801, 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804,\n    0x02A1D004, 0x02A20002, 0x02A2D011, 0x02A33802, 0x02A38012,\n    0x02A3E003, 0x02A4980A, 0x02A51C0D, 0x02A57C01, 0x02A60004,\n    0x02A6CC1B, 0x02A77802, 0x02A8A40E, 0x02A90C01, 0x02A93002,\n    0x02A97004, 0x02A9DC03, 0x02A9EC01, 0x02AAC001, 0x02AAC803,\n    0x02AADC02, 0x02AAF802, 0x02AB0401, 0x02AB7802, 0x02ABAC07,\n    0x02ABD402, 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02,\n    0x037FFC01, 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802,\n    0x03F7F002, 0x03F8001A, 0x03F88007, 0x03F8C023, 0x03F95013,\n    0x03F9A004, 0x03FBFC01, 0x03FC040F, 0x03FC6807, 0x03FCEC06,\n    0x03FD6C0B, 0x03FF8007, 0x03FFA007, 0x03FFE405, 0x04040003,\n    0x0404DC09, 0x0405E411, 0x0406400C, 0x0407402E, 0x040E7C01,\n    0x040F4001, 0x04215C01, 0x04247C01, 0x0424FC01, 0x04280403,\n    0x04281402, 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009,\n    0x0429FC01, 0x042CE407, 0x04400003, 0x0440E016, 0x04420003,\n    0x0442C012, 0x04440003, 0x04449C0E, 0x04450004, 0x04460003,\n    0x0446CC0E, 0x04471404, 0x045AAC0D, 0x0491C004, 0x05BD442E,\n    0x05BE3C04, 0x074000F6, 0x07440027, 0x0744A4B5, 0x07480046,\n    0x074C0057, 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401,\n    0x075CD401, 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401,\n    0x075F0C01, 0x07BBC002, 0x07C0002C, 0x07C0C064, 0x07C2800F,\n    0x07C2C40E, 0x07C3040F, 0x07C3440F, 0x07C4401F, 0x07C4C03C,\n    0x07C5C02B, 0x07C7981D, 0x07C8402B, 0x07C90009, 0x07C94002,\n    0x07CC0021, 0x07CCC006, 0x07CCDC46, 0x07CE0014, 0x07CE8025,\n    0x07CF1805, 0x07CF8011, 0x07D0003F, 0x07D10001, 0x07D108B6,\n    0x07D3E404, 0x07D4003E, 0x07D50004, 0x07D54018, 0x07D7EC46,\n    0x07D9140B, 0x07DA0046, 0x07DC0074, 0x38000401, 0x38008060,\n    0x380400F0,\n  };\n  static const unsigned int aAscii[4] = {\n    0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001,\n  };\n\n  if( (unsigned int)c<128 ){\n    return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 );\n  }else if( (unsigned int)c<(1<<22) ){\n    unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;\n    int iRes = 0;\n    int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;\n    int iLo = 0;\n    while( iHi>=iLo ){\n      int iTest = (iHi + iLo) / 2;\n      if( key >= aEntry[iTest] ){\n        iRes = iTest;\n        iLo = iTest+1;\n      }else{\n        iHi = iTest-1;\n      }\n    }\n    assert( aEntry[0]<key );\n    assert( key>=aEntry[iRes] );\n    return (((unsigned int)c) >= ((aEntry[iRes]>>10) + (aEntry[iRes]&0x3FF)));\n  }\n  return 1;\n}\n\n\n/*\n** If the argument is a codepoint corresponding to a lowercase letter\n** in the ASCII range with a diacritic added, return the codepoint\n** of the ASCII letter only. For example, if passed 235 - \"LATIN\n** SMALL LETTER E WITH DIAERESIS\" - return 65 (\"LATIN SMALL LETTER\n** E\"). The resuls of passing a codepoint that corresponds to an\n** uppercase letter are undefined.\n*/\nstatic int fts5_remove_diacritic(int c){\n  unsigned short aDia[] = {\n        0,  1797,  1848,  1859,  1891,  1928,  1940,  1995, \n     2024,  2040,  2060,  2110,  2168,  2206,  2264,  2286, \n     2344,  2383,  2472,  2488,  2516,  2596,  2668,  2732, \n     2782,  2842,  2894,  2954,  2984,  3000,  3028,  3336, \n     3456,  3696,  3712,  3728,  3744,  3896,  3912,  3928, \n     3968,  4008,  4040,  4106,  4138,  4170,  4202,  4234, \n     4266,  4296,  4312,  4344,  4408,  4424,  4472,  4504, \n     6148,  6198,  6264,  6280,  6360,  6429,  6505,  6529, \n    61448, 61468, 61534, 61592, 61642, 61688, 61704, 61726, \n    61784, 61800, 61836, 61880, 61914, 61948, 61998, 62122, \n    62154, 62200, 62218, 62302, 62364, 62442, 62478, 62536, \n    62554, 62584, 62604, 62640, 62648, 62656, 62664, 62730, \n    62924, 63050, 63082, 63274, 63390, \n  };\n  char aChar[] = {\n    '\\0', 'a',  'c',  'e',  'i',  'n',  'o',  'u',  'y',  'y',  'a',  'c',  \n    'd',  'e',  'e',  'g',  'h',  'i',  'j',  'k',  'l',  'n',  'o',  'r',  \n    's',  't',  'u',  'u',  'w',  'y',  'z',  'o',  'u',  'a',  'i',  'o',  \n    'u',  'g',  'k',  'o',  'j',  'g',  'n',  'a',  'e',  'i',  'o',  'r',  \n    'u',  's',  't',  'h',  'a',  'e',  'o',  'y',  '\\0', '\\0', '\\0', '\\0', \n    '\\0', '\\0', '\\0', '\\0', 'a',  'b',  'd',  'd',  'e',  'f',  'g',  'h',  \n    'h',  'i',  'k',  'l',  'l',  'm',  'n',  'p',  'r',  'r',  's',  't',  \n    'u',  'v',  'w',  'w',  'x',  'y',  'z',  'h',  't',  'w',  'y',  'a',  \n    'e',  'i',  'o',  'u',  'y',  \n  };\n\n  unsigned int key = (((unsigned int)c)<<3) | 0x00000007;\n  int iRes = 0;\n  int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1;\n  int iLo = 0;\n  while( iHi>=iLo ){\n    int iTest = (iHi + iLo) / 2;\n    if( key >= aDia[iTest] ){\n      iRes = iTest;\n      iLo = iTest+1;\n    }else{\n      iHi = iTest-1;\n    }\n  }\n  assert( key>=aDia[iRes] );\n  return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]);\n}\n\n\n/*\n** Return true if the argument interpreted as a unicode codepoint\n** is a diacritical modifier character.\n*/\nstatic int sqlite3Fts5UnicodeIsdiacritic(int c){\n  unsigned int mask0 = 0x08029FDF;\n  unsigned int mask1 = 0x000361F8;\n  if( c<768 || c>817 ) return 0;\n  return (c < 768+32) ?\n      (mask0 & (1 << (c-768))) :\n      (mask1 & (1 << (c-768-32)));\n}\n\n\n/*\n** Interpret the argument as a unicode codepoint. If the codepoint\n** is an upper case character that has a lower case equivalent,\n** return the codepoint corresponding to the lower case version.\n** Otherwise, return a copy of the argument.\n**\n** The results are undefined if the value passed to this function\n** is less than zero.\n*/\nstatic int sqlite3Fts5UnicodeFold(int c, int bRemoveDiacritic){\n  /* Each entry in the following array defines a rule for folding a range\n  ** of codepoints to lower case. The rule applies to a range of nRange\n  ** codepoints starting at codepoint iCode.\n  **\n  ** If the least significant bit in flags is clear, then the rule applies\n  ** to all nRange codepoints (i.e. all nRange codepoints are upper case and\n  ** need to be folded). Or, if it is set, then the rule only applies to\n  ** every second codepoint in the range, starting with codepoint C.\n  **\n  ** The 7 most significant bits in flags are an index into the aiOff[]\n  ** array. If a specific codepoint C does require folding, then its lower\n  ** case equivalent is ((C + aiOff[flags>>1]) & 0xFFFF).\n  **\n  ** The contents of this array are generated by parsing the CaseFolding.txt\n  ** file distributed as part of the \"Unicode Character Database\". See\n  ** http://www.unicode.org for details.\n  */\n  static const struct TableEntry {\n    unsigned short iCode;\n    unsigned char flags;\n    unsigned char nRange;\n  } aEntry[] = {\n    {65, 14, 26},          {181, 64, 1},          {192, 14, 23},\n    {216, 14, 7},          {256, 1, 48},          {306, 1, 6},\n    {313, 1, 16},          {330, 1, 46},          {376, 116, 1},\n    {377, 1, 6},           {383, 104, 1},         {385, 50, 1},\n    {386, 1, 4},           {390, 44, 1},          {391, 0, 1},\n    {393, 42, 2},          {395, 0, 1},           {398, 32, 1},\n    {399, 38, 1},          {400, 40, 1},          {401, 0, 1},\n    {403, 42, 1},          {404, 46, 1},          {406, 52, 1},\n    {407, 48, 1},          {408, 0, 1},           {412, 52, 1},\n    {413, 54, 1},          {415, 56, 1},          {416, 1, 6},\n    {422, 60, 1},          {423, 0, 1},           {425, 60, 1},\n    {428, 0, 1},           {430, 60, 1},          {431, 0, 1},\n    {433, 58, 2},          {435, 1, 4},           {439, 62, 1},\n    {440, 0, 1},           {444, 0, 1},           {452, 2, 1},\n    {453, 0, 1},           {455, 2, 1},           {456, 0, 1},\n    {458, 2, 1},           {459, 1, 18},          {478, 1, 18},\n    {497, 2, 1},           {498, 1, 4},           {502, 122, 1},\n    {503, 134, 1},         {504, 1, 40},          {544, 110, 1},\n    {546, 1, 18},          {570, 70, 1},          {571, 0, 1},\n    {573, 108, 1},         {574, 68, 1},          {577, 0, 1},\n    {579, 106, 1},         {580, 28, 1},          {581, 30, 1},\n    {582, 1, 10},          {837, 36, 1},          {880, 1, 4},\n    {886, 0, 1},           {902, 18, 1},          {904, 16, 3},\n    {908, 26, 1},          {910, 24, 2},          {913, 14, 17},\n    {931, 14, 9},          {962, 0, 1},           {975, 4, 1},\n    {976, 140, 1},         {977, 142, 1},         {981, 146, 1},\n    {982, 144, 1},         {984, 1, 24},          {1008, 136, 1},\n    {1009, 138, 1},        {1012, 130, 1},        {1013, 128, 1},\n    {1015, 0, 1},          {1017, 152, 1},        {1018, 0, 1},\n    {1021, 110, 3},        {1024, 34, 16},        {1040, 14, 32},\n    {1120, 1, 34},         {1162, 1, 54},         {1216, 6, 1},\n    {1217, 1, 14},         {1232, 1, 88},         {1329, 22, 38},\n    {4256, 66, 38},        {4295, 66, 1},         {4301, 66, 1},\n    {7680, 1, 150},        {7835, 132, 1},        {7838, 96, 1},\n    {7840, 1, 96},         {7944, 150, 8},        {7960, 150, 6},\n    {7976, 150, 8},        {7992, 150, 8},        {8008, 150, 6},\n    {8025, 151, 8},        {8040, 150, 8},        {8072, 150, 8},\n    {8088, 150, 8},        {8104, 150, 8},        {8120, 150, 2},\n    {8122, 126, 2},        {8124, 148, 1},        {8126, 100, 1},\n    {8136, 124, 4},        {8140, 148, 1},        {8152, 150, 2},\n    {8154, 120, 2},        {8168, 150, 2},        {8170, 118, 2},\n    {8172, 152, 1},        {8184, 112, 2},        {8186, 114, 2},\n    {8188, 148, 1},        {8486, 98, 1},         {8490, 92, 1},\n    {8491, 94, 1},         {8498, 12, 1},         {8544, 8, 16},\n    {8579, 0, 1},          {9398, 10, 26},        {11264, 22, 47},\n    {11360, 0, 1},         {11362, 88, 1},        {11363, 102, 1},\n    {11364, 90, 1},        {11367, 1, 6},         {11373, 84, 1},\n    {11374, 86, 1},        {11375, 80, 1},        {11376, 82, 1},\n    {11378, 0, 1},         {11381, 0, 1},         {11390, 78, 2},\n    {11392, 1, 100},       {11499, 1, 4},         {11506, 0, 1},\n    {42560, 1, 46},        {42624, 1, 24},        {42786, 1, 14},\n    {42802, 1, 62},        {42873, 1, 4},         {42877, 76, 1},\n    {42878, 1, 10},        {42891, 0, 1},         {42893, 74, 1},\n    {42896, 1, 4},         {42912, 1, 10},        {42922, 72, 1},\n    {65313, 14, 26},       \n  };\n  static const unsigned short aiOff[] = {\n   1,     2,     8,     15,    16,    26,    28,    32,    \n   37,    38,    40,    48,    63,    64,    69,    71,    \n   79,    80,    116,   202,   203,   205,   206,   207,   \n   209,   210,   211,   213,   214,   217,   218,   219,   \n   775,   7264,  10792, 10795, 23228, 23256, 30204, 54721, \n   54753, 54754, 54756, 54787, 54793, 54809, 57153, 57274, \n   57921, 58019, 58363, 61722, 65268, 65341, 65373, 65406, \n   65408, 65410, 65415, 65424, 65436, 65439, 65450, 65462, \n   65472, 65476, 65478, 65480, 65482, 65488, 65506, 65511, \n   65514, 65521, 65527, 65528, 65529, \n  };\n\n  int ret = c;\n\n  assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 );\n\n  if( c<128 ){\n    if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');\n  }else if( c<65536 ){\n    const struct TableEntry *p;\n    int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1;\n    int iLo = 0;\n    int iRes = -1;\n\n    assert( c>aEntry[0].iCode );\n    while( iHi>=iLo ){\n      int iTest = (iHi + iLo) / 2;\n      int cmp = (c - aEntry[iTest].iCode);\n      if( cmp>=0 ){\n        iRes = iTest;\n        iLo = iTest+1;\n      }else{\n        iHi = iTest-1;\n      }\n    }\n\n    assert( iRes>=0 && c>=aEntry[iRes].iCode );\n    p = &aEntry[iRes];\n    if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){\n      ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF;\n      assert( ret>0 );\n    }\n\n    if( bRemoveDiacritic ) ret = fts5_remove_diacritic(ret);\n  }\n  \n  else if( c>=66560 && c<66600 ){\n    ret = c + 40;\n  }\n\n  return ret;\n}\n\n#line 1 \"fts5_varint.c\"\n/*\n** 2015 May 30\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** Routines for varint serialization and deserialization.\n*/\n\n\n/* #include \"fts5Int.h\" */\n\n/*\n** This is a copy of the sqlite3GetVarint32() routine from the SQLite core.\n** Except, this version does handle the single byte case that the core\n** version depends on being handled before its function is called.\n*/\nstatic int sqlite3Fts5GetVarint32(const unsigned char *p, u32 *v){\n  u32 a,b;\n\n  /* The 1-byte case. Overwhelmingly the most common. */\n  a = *p;\n  /* a: p0 (unmasked) */\n  if (!(a&0x80))\n  {\n    /* Values between 0 and 127 */\n    *v = a;\n    return 1;\n  }\n\n  /* The 2-byte case */\n  p++;\n  b = *p;\n  /* b: p1 (unmasked) */\n  if (!(b&0x80))\n  {\n    /* Values between 128 and 16383 */\n    a &= 0x7f;\n    a = a<<7;\n    *v = a | b;\n    return 2;\n  }\n\n  /* The 3-byte case */\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p0<<14 | p2 (unmasked) */\n  if (!(a&0x80))\n  {\n    /* Values between 16384 and 2097151 */\n    a &= (0x7f<<14)|(0x7f);\n    b &= 0x7f;\n    b = b<<7;\n    *v = a | b;\n    return 3;\n  }\n\n  /* A 32-bit varint is used to store size information in btrees.\n  ** Objects are rarely larger than 2MiB limit of a 3-byte varint.\n  ** A 3-byte varint is sufficient, for example, to record the size\n  ** of a 1048569-byte BLOB or string.\n  **\n  ** We only unroll the first 1-, 2-, and 3- byte cases.  The very\n  ** rare larger cases can be handled by the slower 64-bit varint\n  ** routine.\n  */\n  {\n    u64 v64;\n    u8 n;\n    p -= 2;\n    n = sqlite3Fts5GetVarint(p, &v64);\n    *v = (u32)v64;\n    assert( n>3 && n<=9 );\n    return n;\n  }\n}\n\n\n/*\n** Bitmasks used by sqlite3GetVarint().  These precomputed constants\n** are defined here rather than simply putting the constant expressions\n** inline in order to work around bugs in the RVT compiler.\n**\n** SLOT_2_0     A mask for  (0x7f<<14) | 0x7f\n**\n** SLOT_4_2_0   A mask for  (0x7f<<28) | SLOT_2_0\n*/\n#define SLOT_2_0     0x001fc07f\n#define SLOT_4_2_0   0xf01fc07f\n\n/*\n** Read a 64-bit variable-length integer from memory starting at p[0].\n** Return the number of bytes read.  The value is stored in *v.\n*/\nstatic u8 sqlite3Fts5GetVarint(const unsigned char *p, u64 *v){\n  u32 a,b,s;\n\n  a = *p;\n  /* a: p0 (unmasked) */\n  if (!(a&0x80))\n  {\n    *v = a;\n    return 1;\n  }\n\n  p++;\n  b = *p;\n  /* b: p1 (unmasked) */\n  if (!(b&0x80))\n  {\n    a &= 0x7f;\n    a = a<<7;\n    a |= b;\n    *v = a;\n    return 2;\n  }\n\n  /* Verify that constants are precomputed correctly */\n  assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );\n  assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );\n\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p0<<14 | p2 (unmasked) */\n  if (!(a&0x80))\n  {\n    a &= SLOT_2_0;\n    b &= 0x7f;\n    b = b<<7;\n    a |= b;\n    *v = a;\n    return 3;\n  }\n\n  /* CSE1 from below */\n  a &= SLOT_2_0;\n  p++;\n  b = b<<14;\n  b |= *p;\n  /* b: p1<<14 | p3 (unmasked) */\n  if (!(b&0x80))\n  {\n    b &= SLOT_2_0;\n    /* moved CSE1 up */\n    /* a &= (0x7f<<14)|(0x7f); */\n    a = a<<7;\n    a |= b;\n    *v = a;\n    return 4;\n  }\n\n  /* a: p0<<14 | p2 (masked) */\n  /* b: p1<<14 | p3 (unmasked) */\n  /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\n  /* moved CSE1 up */\n  /* a &= (0x7f<<14)|(0x7f); */\n  b &= SLOT_2_0;\n  s = a;\n  /* s: p0<<14 | p2 (masked) */\n\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p0<<28 | p2<<14 | p4 (unmasked) */\n  if (!(a&0x80))\n  {\n    /* we can skip these cause they were (effectively) done above in calc'ing s */\n    /* a &= (0x7f<<28)|(0x7f<<14)|(0x7f); */\n    /* b &= (0x7f<<14)|(0x7f); */\n    b = b<<7;\n    a |= b;\n    s = s>>18;\n    *v = ((u64)s)<<32 | a;\n    return 5;\n  }\n\n  /* 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\n  s = s<<7;\n  s |= b;\n  /* s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\n\n  p++;\n  b = b<<14;\n  b |= *p;\n  /* b: p1<<28 | p3<<14 | p5 (unmasked) */\n  if (!(b&0x80))\n  {\n    /* we can skip this cause it was (effectively) done above in calc'ing s */\n    /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */\n    a &= SLOT_2_0;\n    a = a<<7;\n    a |= b;\n    s = s>>18;\n    *v = ((u64)s)<<32 | a;\n    return 6;\n  }\n\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p2<<28 | p4<<14 | p6 (unmasked) */\n  if (!(a&0x80))\n  {\n    a &= SLOT_4_2_0;\n    b &= SLOT_2_0;\n    b = b<<7;\n    a |= b;\n    s = s>>11;\n    *v = ((u64)s)<<32 | a;\n    return 7;\n  }\n\n  /* CSE2 from below */\n  a &= SLOT_2_0;\n  p++;\n  b = b<<14;\n  b |= *p;\n  /* b: p3<<28 | p5<<14 | p7 (unmasked) */\n  if (!(b&0x80))\n  {\n    b &= SLOT_4_2_0;\n    /* moved CSE2 up */\n    /* a &= (0x7f<<14)|(0x7f); */\n    a = a<<7;\n    a |= b;\n    s = s>>4;\n    *v = ((u64)s)<<32 | a;\n    return 8;\n  }\n\n  p++;\n  a = a<<15;\n  a |= *p;\n  /* a: p4<<29 | p6<<15 | p8 (unmasked) */\n\n  /* moved CSE2 up */\n  /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */\n  b &= SLOT_2_0;\n  b = b<<8;\n  a |= b;\n\n  s = s<<4;\n  b = p[-4];\n  b &= 0x7f;\n  b = b>>3;\n  s |= b;\n\n  *v = ((u64)s)<<32 | a;\n\n  return 9;\n}\n\n/*\n** The variable-length integer encoding is as follows:\n**\n** KEY:\n**         A = 0xxxxxxx    7 bits of data and one flag bit\n**         B = 1xxxxxxx    7 bits of data and one flag bit\n**         C = xxxxxxxx    8 bits of data\n**\n**  7 bits - A\n** 14 bits - BA\n** 21 bits - BBA\n** 28 bits - BBBA\n** 35 bits - BBBBA\n** 42 bits - BBBBBA\n** 49 bits - BBBBBBA\n** 56 bits - BBBBBBBA\n** 64 bits - BBBBBBBBC\n*/\n\n#ifdef SQLITE_NOINLINE\n# define FTS5_NOINLINE SQLITE_NOINLINE\n#else\n# define FTS5_NOINLINE\n#endif\n\n/*\n** Write a 64-bit variable-length integer to memory starting at p[0].\n** The length of data write will be between 1 and 9 bytes.  The number\n** of bytes written is returned.\n**\n** A variable-length integer consists of the lower 7 bits of each byte\n** for all bytes that have the 8th bit set and one byte with the 8th\n** bit clear.  Except, if we get to the 9th byte, it stores the full\n** 8 bits and is the last byte.\n*/\nstatic int FTS5_NOINLINE fts5PutVarint64(unsigned char *p, u64 v){\n  int i, j, n;\n  u8 buf[10];\n  if( v & (((u64)0xff000000)<<32) ){\n    p[8] = (u8)v;\n    v >>= 8;\n    for(i=7; i>=0; i--){\n      p[i] = (u8)((v & 0x7f) | 0x80);\n      v >>= 7;\n    }\n    return 9;\n  }    \n  n = 0;\n  do{\n    buf[n++] = (u8)((v & 0x7f) | 0x80);\n    v >>= 7;\n  }while( v!=0 );\n  buf[0] &= 0x7f;\n  assert( n<=9 );\n  for(i=0, j=n-1; j>=0; j--, i++){\n    p[i] = buf[j];\n  }\n  return n;\n}\n\nstatic int sqlite3Fts5PutVarint(unsigned char *p, u64 v){\n  if( v<=0x7f ){\n    p[0] = v&0x7f;\n    return 1;\n  }\n  if( v<=0x3fff ){\n    p[0] = ((v>>7)&0x7f)|0x80;\n    p[1] = v&0x7f;\n    return 2;\n  }\n  return fts5PutVarint64(p,v);\n}\n\n\nstatic int sqlite3Fts5GetVarintLen(u32 iVal){\n#if 0\n  if( iVal<(1 << 7 ) ) return 1;\n#endif\n  assert( iVal>=(1 << 7) );\n  if( iVal<(1 << 14) ) return 2;\n  if( iVal<(1 << 21) ) return 3;\n  if( iVal<(1 << 28) ) return 4;\n  return 5;\n}\n\n\n#line 1 \"fts5_vocab.c\"\n/*\n** 2015 May 08\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This is an SQLite virtual table module implementing direct access to an\n** existing FTS5 index. The module may create several different types of \n** tables:\n**\n** col:\n**     CREATE TABLE vocab(term, col, doc, cnt, PRIMARY KEY(term, col));\n**\n**   One row for each term/column combination. The value of $doc is set to\n**   the number of fts5 rows that contain at least one instance of term\n**   $term within column $col. Field $cnt is set to the total number of \n**   instances of term $term in column $col (in any row of the fts5 table). \n**\n** row:\n**     CREATE TABLE vocab(term, doc, cnt, PRIMARY KEY(term));\n**\n**   One row for each term in the database. The value of $doc is set to\n**   the number of fts5 rows that contain at least one instance of term\n**   $term. Field $cnt is set to the total number of instances of term \n**   $term in the database.\n*/\n\n\n/* #include \"fts5Int.h\" */\n\n\ntypedef struct Fts5VocabTable Fts5VocabTable;\ntypedef struct Fts5VocabCursor Fts5VocabCursor;\n\nstruct Fts5VocabTable {\n  sqlite3_vtab base;\n  char *zFts5Tbl;                 /* Name of fts5 table */\n  char *zFts5Db;                  /* Db containing fts5 table */\n  sqlite3 *db;                    /* Database handle */\n  Fts5Global *pGlobal;            /* FTS5 global object for this database */\n  int eType;                      /* FTS5_VOCAB_COL or ROW */\n};\n\nstruct Fts5VocabCursor {\n  sqlite3_vtab_cursor base;\n  sqlite3_stmt *pStmt;            /* Statement holding lock on pIndex */\n  Fts5Index *pIndex;              /* Associated FTS5 index */\n\n  int bEof;                       /* True if this cursor is at EOF */\n  Fts5IndexIter *pIter;           /* Term/rowid iterator object */\n\n  int nLeTerm;                    /* Size of zLeTerm in bytes */\n  char *zLeTerm;                  /* (term <= $zLeTerm) paramater, or NULL */\n\n  /* These are used by 'col' tables only */\n  Fts5Config *pConfig;            /* Fts5 table configuration */\n  int iCol;\n  i64 *aCnt;\n  i64 *aDoc;\n\n  /* Output values used by 'row' and 'col' tables */\n  i64 rowid;                      /* This table's current rowid value */\n  Fts5Buffer term;                /* Current value of 'term' column */\n};\n\n#define FTS5_VOCAB_COL    0\n#define FTS5_VOCAB_ROW    1\n\n#define FTS5_VOCAB_COL_SCHEMA  \"term, col, doc, cnt\"\n#define FTS5_VOCAB_ROW_SCHEMA  \"term, doc, cnt\"\n\n/*\n** Bits for the mask used as the idxNum value by xBestIndex/xFilter.\n*/\n#define FTS5_VOCAB_TERM_EQ 0x01\n#define FTS5_VOCAB_TERM_GE 0x02\n#define FTS5_VOCAB_TERM_LE 0x04\n\n\n/*\n** Translate a string containing an fts5vocab table type to an \n** FTS5_VOCAB_XXX constant. If successful, set *peType to the output\n** value and return SQLITE_OK. Otherwise, set *pzErr to an error message\n** and return SQLITE_ERROR.\n*/\nstatic int fts5VocabTableType(const char *zType, char **pzErr, int *peType){\n  int rc = SQLITE_OK;\n  char *zCopy = sqlite3Fts5Strndup(&rc, zType, -1);\n  if( rc==SQLITE_OK ){\n    sqlite3Fts5Dequote(zCopy);\n    if( sqlite3_stricmp(zCopy, \"col\")==0 ){\n      *peType = FTS5_VOCAB_COL;\n    }else\n\n    if( sqlite3_stricmp(zCopy, \"row\")==0 ){\n      *peType = FTS5_VOCAB_ROW;\n    }else\n    {\n      *pzErr = sqlite3_mprintf(\"fts5vocab: unknown table type: %Q\", zCopy);\n      rc = SQLITE_ERROR;\n    }\n    sqlite3_free(zCopy);\n  }\n\n  return rc;\n}\n\n\n/*\n** The xDisconnect() virtual table method.\n*/\nstatic int fts5VocabDisconnectMethod(sqlite3_vtab *pVtab){\n  Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab;\n  sqlite3_free(pTab);\n  return SQLITE_OK;\n}\n\n/*\n** The xDestroy() virtual table method.\n*/\nstatic int fts5VocabDestroyMethod(sqlite3_vtab *pVtab){\n  Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab;\n  sqlite3_free(pTab);\n  return SQLITE_OK;\n}\n\n/*\n** This function is the implementation of both the xConnect and xCreate\n** methods of the FTS3 virtual table.\n**\n** The argv[] array contains the following:\n**\n**   argv[0]   -> module name  (\"fts5vocab\")\n**   argv[1]   -> database name\n**   argv[2]   -> table name\n**\n** then:\n**\n**   argv[3]   -> name of fts5 table\n**   argv[4]   -> type of fts5vocab table\n**\n** or, for tables in the TEMP schema only.\n**\n**   argv[3]   -> name of fts5 tables database\n**   argv[4]   -> name of fts5 table\n**   argv[5]   -> type of fts5vocab table\n*/\nstatic int fts5VocabInitVtab(\n  sqlite3 *db,                    /* The SQLite database connection */\n  void *pAux,                     /* Pointer to Fts5Global object */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVTab,          /* Write the resulting vtab structure here */\n  char **pzErr                    /* Write any error message here */\n){\n  const char *azSchema[] = { \n    \"CREATE TABlE vocab(\" FTS5_VOCAB_COL_SCHEMA  \")\", \n    \"CREATE TABlE vocab(\" FTS5_VOCAB_ROW_SCHEMA  \")\"\n  };\n\n  Fts5VocabTable *pRet = 0;\n  int rc = SQLITE_OK;             /* Return code */\n  int bDb;\n\n  bDb = (argc==6 && strlen(argv[1])==4 && memcmp(\"temp\", argv[1], 4)==0);\n\n  if( argc!=5 && bDb==0 ){\n    *pzErr = sqlite3_mprintf(\"wrong number of vtable arguments\");\n    rc = SQLITE_ERROR;\n  }else{\n    int nByte;                      /* Bytes of space to allocate */\n    const char *zDb = bDb ? argv[3] : argv[1];\n    const char *zTab = bDb ? argv[4] : argv[3];\n    const char *zType = bDb ? argv[5] : argv[4];\n    int nDb = (int)strlen(zDb)+1; \n    int nTab = (int)strlen(zTab)+1;\n    int eType = 0;\n    \n    rc = fts5VocabTableType(zType, pzErr, &eType);\n    if( rc==SQLITE_OK ){\n      assert( eType>=0 && eType<ArraySize(azSchema) );\n      rc = sqlite3_declare_vtab(db, azSchema[eType]);\n    }\n\n    nByte = sizeof(Fts5VocabTable) + nDb + nTab;\n    pRet = sqlite3Fts5MallocZero(&rc, nByte);\n    if( pRet ){\n      pRet->pGlobal = (Fts5Global*)pAux;\n      pRet->eType = eType;\n      pRet->db = db;\n      pRet->zFts5Tbl = (char*)&pRet[1];\n      pRet->zFts5Db = &pRet->zFts5Tbl[nTab];\n      memcpy(pRet->zFts5Tbl, zTab, nTab);\n      memcpy(pRet->zFts5Db, zDb, nDb);\n      sqlite3Fts5Dequote(pRet->zFts5Tbl);\n      sqlite3Fts5Dequote(pRet->zFts5Db);\n    }\n  }\n\n  *ppVTab = (sqlite3_vtab*)pRet;\n  return rc;\n}\n\n\n/*\n** The xConnect() and xCreate() methods for the virtual table. All the\n** work is done in function fts5VocabInitVtab().\n*/\nstatic int fts5VocabConnectMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pAux,                     /* Pointer to tokenizer hash table */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  return fts5VocabInitVtab(db, pAux, argc, argv, ppVtab, pzErr);\n}\nstatic int fts5VocabCreateMethod(\n  sqlite3 *db,                    /* Database connection */\n  void *pAux,                     /* Pointer to tokenizer hash table */\n  int argc,                       /* Number of elements in argv array */\n  const char * const *argv,       /* xCreate/xConnect argument array */\n  sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */\n  char **pzErr                    /* OUT: sqlite3_malloc'd error message */\n){\n  return fts5VocabInitVtab(db, pAux, argc, argv, ppVtab, pzErr);\n}\n\n/* \n** Implementation of the xBestIndex method.\n*/\nstatic int fts5VocabBestIndexMethod(\n  sqlite3_vtab *pUnused,\n  sqlite3_index_info *pInfo\n){\n  int i;\n  int iTermEq = -1;\n  int iTermGe = -1;\n  int iTermLe = -1;\n  int idxNum = 0;\n  int nArg = 0;\n\n  UNUSED_PARAM(pUnused);\n\n  for(i=0; i<pInfo->nConstraint; i++){\n    struct sqlite3_index_constraint *p = &pInfo->aConstraint[i];\n    if( p->usable==0 ) continue;\n    if( p->iColumn==0 ){          /* term column */\n      if( p->op==SQLITE_INDEX_CONSTRAINT_EQ ) iTermEq = i;\n      if( p->op==SQLITE_INDEX_CONSTRAINT_LE ) iTermLe = i;\n      if( p->op==SQLITE_INDEX_CONSTRAINT_LT ) iTermLe = i;\n      if( p->op==SQLITE_INDEX_CONSTRAINT_GE ) iTermGe = i;\n      if( p->op==SQLITE_INDEX_CONSTRAINT_GT ) iTermGe = i;\n    }\n  }\n\n  if( iTermEq>=0 ){\n    idxNum |= FTS5_VOCAB_TERM_EQ;\n    pInfo->aConstraintUsage[iTermEq].argvIndex = ++nArg;\n    pInfo->estimatedCost = 100;\n  }else{\n    pInfo->estimatedCost = 1000000;\n    if( iTermGe>=0 ){\n      idxNum |= FTS5_VOCAB_TERM_GE;\n      pInfo->aConstraintUsage[iTermGe].argvIndex = ++nArg;\n      pInfo->estimatedCost = pInfo->estimatedCost / 2;\n    }\n    if( iTermLe>=0 ){\n      idxNum |= FTS5_VOCAB_TERM_LE;\n      pInfo->aConstraintUsage[iTermLe].argvIndex = ++nArg;\n      pInfo->estimatedCost = pInfo->estimatedCost / 2;\n    }\n  }\n\n  /* This virtual table always delivers results in ascending order of\n  ** the \"term\" column (column 0). So if the user has requested this\n  ** specifically - \"ORDER BY term\" or \"ORDER BY term ASC\" - set the\n  ** sqlite3_index_info.orderByConsumed flag to tell the core the results\n  ** are already in sorted order.  */\n  if( pInfo->nOrderBy==1 \n   && pInfo->aOrderBy[0].iColumn==0 \n   && pInfo->aOrderBy[0].desc==0\n  ){\n    pInfo->orderByConsumed = 1;\n  }\n\n  pInfo->idxNum = idxNum;\n  return SQLITE_OK;\n}\n\n/*\n** Implementation of xOpen method.\n*/\nstatic int fts5VocabOpenMethod(\n  sqlite3_vtab *pVTab, \n  sqlite3_vtab_cursor **ppCsr\n){\n  Fts5VocabTable *pTab = (Fts5VocabTable*)pVTab;\n  Fts5Index *pIndex = 0;\n  Fts5Config *pConfig = 0;\n  Fts5VocabCursor *pCsr = 0;\n  int rc = SQLITE_OK;\n  sqlite3_stmt *pStmt = 0;\n  char *zSql = 0;\n\n  zSql = sqlite3Fts5Mprintf(&rc,\n      \"SELECT t.%Q FROM %Q.%Q AS t WHERE t.%Q MATCH '*id'\",\n      pTab->zFts5Tbl, pTab->zFts5Db, pTab->zFts5Tbl, pTab->zFts5Tbl\n  );\n  if( zSql ){\n    rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0);\n  }\n  sqlite3_free(zSql);\n  assert( rc==SQLITE_OK || pStmt==0 );\n  if( rc==SQLITE_ERROR ) rc = SQLITE_OK;\n\n  if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){\n    i64 iId = sqlite3_column_int64(pStmt, 0);\n    pIndex = sqlite3Fts5IndexFromCsrid(pTab->pGlobal, iId, &pConfig);\n  }\n\n  if( rc==SQLITE_OK && pIndex==0 ){\n    rc = sqlite3_finalize(pStmt);\n    pStmt = 0;\n    if( rc==SQLITE_OK ){\n      pVTab->zErrMsg = sqlite3_mprintf(\n          \"no such fts5 table: %s.%s\", pTab->zFts5Db, pTab->zFts5Tbl\n      );\n      rc = SQLITE_ERROR;\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    int nByte = pConfig->nCol * sizeof(i64) * 2 + sizeof(Fts5VocabCursor);\n    pCsr = (Fts5VocabCursor*)sqlite3Fts5MallocZero(&rc, nByte);\n  }\n\n  if( pCsr ){\n    pCsr->pIndex = pIndex;\n    pCsr->pStmt = pStmt;\n    pCsr->pConfig = pConfig;\n    pCsr->aCnt = (i64*)&pCsr[1];\n    pCsr->aDoc = &pCsr->aCnt[pConfig->nCol];\n  }else{\n    sqlite3_finalize(pStmt);\n  }\n\n  *ppCsr = (sqlite3_vtab_cursor*)pCsr;\n  return rc;\n}\n\nstatic void fts5VocabResetCursor(Fts5VocabCursor *pCsr){\n  pCsr->rowid = 0;\n  sqlite3Fts5IterClose(pCsr->pIter);\n  pCsr->pIter = 0;\n  sqlite3_free(pCsr->zLeTerm);\n  pCsr->nLeTerm = -1;\n  pCsr->zLeTerm = 0;\n}\n\n/*\n** Close the cursor.  For additional information see the documentation\n** on the xClose method of the virtual table interface.\n*/\nstatic int fts5VocabCloseMethod(sqlite3_vtab_cursor *pCursor){\n  Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;\n  fts5VocabResetCursor(pCsr);\n  sqlite3Fts5BufferFree(&pCsr->term);\n  sqlite3_finalize(pCsr->pStmt);\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\n\n/*\n** Advance the cursor to the next row in the table.\n*/\nstatic int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){\n  Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;\n  Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab;\n  int rc = SQLITE_OK;\n  int nCol = pCsr->pConfig->nCol;\n\n  pCsr->rowid++;\n\n  if( pTab->eType==FTS5_VOCAB_COL ){\n    for(pCsr->iCol++; pCsr->iCol<nCol; pCsr->iCol++){\n      if( pCsr->aDoc[pCsr->iCol] ) break;\n    }\n  }\n\n  if( pTab->eType==FTS5_VOCAB_ROW || pCsr->iCol>=nCol ){\n    if( sqlite3Fts5IterEof(pCsr->pIter) ){\n      pCsr->bEof = 1;\n    }else{\n      const char *zTerm;\n      int nTerm;\n\n      zTerm = sqlite3Fts5IterTerm(pCsr->pIter, &nTerm);\n      if( pCsr->nLeTerm>=0 ){\n        int nCmp = MIN(nTerm, pCsr->nLeTerm);\n        int bCmp = memcmp(pCsr->zLeTerm, zTerm, nCmp);\n        if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm<nTerm) ){\n          pCsr->bEof = 1;\n          return SQLITE_OK;\n        }\n      }\n\n      sqlite3Fts5BufferSet(&rc, &pCsr->term, nTerm, (const u8*)zTerm);\n      memset(pCsr->aCnt, 0, nCol * sizeof(i64));\n      memset(pCsr->aDoc, 0, nCol * sizeof(i64));\n      pCsr->iCol = 0;\n\n      assert( pTab->eType==FTS5_VOCAB_COL || pTab->eType==FTS5_VOCAB_ROW );\n      while( rc==SQLITE_OK ){\n        const u8 *pPos; int nPos;   /* Position list */\n        i64 iPos = 0;               /* 64-bit position read from poslist */\n        int iOff = 0;               /* Current offset within position list */\n\n        pPos = pCsr->pIter->pData;\n        nPos = pCsr->pIter->nData;\n        switch( pCsr->pConfig->eDetail ){\n          case FTS5_DETAIL_FULL:\n            pPos = pCsr->pIter->pData;\n            nPos = pCsr->pIter->nData;\n            if( pTab->eType==FTS5_VOCAB_ROW ){\n              while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){\n                pCsr->aCnt[0]++;\n              }\n              pCsr->aDoc[0]++;\n            }else{\n              int iCol = -1;\n              while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){\n                int ii = FTS5_POS2COLUMN(iPos);\n                pCsr->aCnt[ii]++;\n                if( iCol!=ii ){\n                  if( ii>=nCol ){\n                    rc = FTS5_CORRUPT;\n                    break;\n                  }\n                  pCsr->aDoc[ii]++;\n                  iCol = ii;\n                }\n              }\n            }\n            break;\n\n          case FTS5_DETAIL_COLUMNS:\n            if( pTab->eType==FTS5_VOCAB_ROW ){\n              pCsr->aDoc[0]++;\n            }else{\n              while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff,&iPos) ){\n                assert_nc( iPos>=0 && iPos<nCol );\n                if( iPos>=nCol ){\n                  rc = FTS5_CORRUPT;\n                  break;\n                }\n                pCsr->aDoc[iPos]++;\n              }\n            }\n            break;\n\n          default: \n            assert( pCsr->pConfig->eDetail==FTS5_DETAIL_NONE );\n            pCsr->aDoc[0]++;\n            break;\n        }\n\n        if( rc==SQLITE_OK ){\n          rc = sqlite3Fts5IterNextScan(pCsr->pIter);\n        }\n\n        if( rc==SQLITE_OK ){\n          zTerm = sqlite3Fts5IterTerm(pCsr->pIter, &nTerm);\n          if( nTerm!=pCsr->term.n || memcmp(zTerm, pCsr->term.p, nTerm) ){\n            break;\n          }\n          if( sqlite3Fts5IterEof(pCsr->pIter) ) break;\n        }\n      }\n    }\n  }\n\n  if( rc==SQLITE_OK && pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){\n    while( pCsr->aDoc[pCsr->iCol]==0 ) pCsr->iCol++;\n    assert( pCsr->iCol<pCsr->pConfig->nCol );\n  }\n  return rc;\n}\n\n/*\n** This is the xFilter implementation for the virtual table.\n*/\nstatic int fts5VocabFilterMethod(\n  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */\n  int idxNum,                     /* Strategy index */\n  const char *zUnused,            /* Unused */\n  int nUnused,                    /* Number of elements in apVal */\n  sqlite3_value **apVal           /* Arguments for the indexing scheme */\n){\n  Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;\n  int rc = SQLITE_OK;\n\n  int iVal = 0;\n  int f = FTS5INDEX_QUERY_SCAN;\n  const char *zTerm = 0;\n  int nTerm = 0;\n\n  sqlite3_value *pEq = 0;\n  sqlite3_value *pGe = 0;\n  sqlite3_value *pLe = 0;\n\n  UNUSED_PARAM2(zUnused, nUnused);\n\n  fts5VocabResetCursor(pCsr);\n  if( idxNum & FTS5_VOCAB_TERM_EQ ) pEq = apVal[iVal++];\n  if( idxNum & FTS5_VOCAB_TERM_GE ) pGe = apVal[iVal++];\n  if( idxNum & FTS5_VOCAB_TERM_LE ) pLe = apVal[iVal++];\n\n  if( pEq ){\n    zTerm = (const char *)sqlite3_value_text(pEq);\n    nTerm = sqlite3_value_bytes(pEq);\n    f = 0;\n  }else{\n    if( pGe ){\n      zTerm = (const char *)sqlite3_value_text(pGe);\n      nTerm = sqlite3_value_bytes(pGe);\n    }\n    if( pLe ){\n      const char *zCopy = (const char *)sqlite3_value_text(pLe);\n      pCsr->nLeTerm = sqlite3_value_bytes(pLe);\n      pCsr->zLeTerm = sqlite3_malloc(pCsr->nLeTerm+1);\n      if( pCsr->zLeTerm==0 ){\n        rc = SQLITE_NOMEM;\n      }else{\n        memcpy(pCsr->zLeTerm, zCopy, pCsr->nLeTerm+1);\n      }\n    }\n  }\n\n\n  if( rc==SQLITE_OK ){\n    rc = sqlite3Fts5IndexQuery(pCsr->pIndex, zTerm, nTerm, f, 0, &pCsr->pIter);\n  }\n  if( rc==SQLITE_OK ){\n    rc = fts5VocabNextMethod(pCursor);\n  }\n\n  return rc;\n}\n\n/* \n** This is the xEof method of the virtual table. SQLite calls this \n** routine to find out if it has reached the end of a result set.\n*/\nstatic int fts5VocabEofMethod(sqlite3_vtab_cursor *pCursor){\n  Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;\n  return pCsr->bEof;\n}\n\nstatic int fts5VocabColumnMethod(\n  sqlite3_vtab_cursor *pCursor,   /* Cursor to retrieve value from */\n  sqlite3_context *pCtx,          /* Context for sqlite3_result_xxx() calls */\n  int iCol                        /* Index of column to read value from */\n){\n  Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;\n  int eDetail = pCsr->pConfig->eDetail;\n  int eType = ((Fts5VocabTable*)(pCursor->pVtab))->eType;\n  i64 iVal = 0;\n\n  if( iCol==0 ){\n    sqlite3_result_text(\n        pCtx, (const char*)pCsr->term.p, pCsr->term.n, SQLITE_TRANSIENT\n    );\n  }else if( eType==FTS5_VOCAB_COL ){\n    assert( iCol==1 || iCol==2 || iCol==3 );\n    if( iCol==1 ){\n      if( eDetail!=FTS5_DETAIL_NONE ){\n        const char *z = pCsr->pConfig->azCol[pCsr->iCol];\n        sqlite3_result_text(pCtx, z, -1, SQLITE_STATIC);\n      }\n    }else if( iCol==2 ){\n      iVal = pCsr->aDoc[pCsr->iCol];\n    }else{\n      iVal = pCsr->aCnt[pCsr->iCol];\n    }\n  }else{\n    assert( iCol==1 || iCol==2 );\n    if( iCol==1 ){\n      iVal = pCsr->aDoc[0];\n    }else{\n      iVal = pCsr->aCnt[0];\n    }\n  }\n\n  if( iVal>0 ) sqlite3_result_int64(pCtx, iVal);\n  return SQLITE_OK;\n}\n\n/* \n** This is the xRowid method. The SQLite core calls this routine to\n** retrieve the rowid for the current row of the result set. The\n** rowid should be written to *pRowid.\n*/\nstatic int fts5VocabRowidMethod(\n  sqlite3_vtab_cursor *pCursor, \n  sqlite_int64 *pRowid\n){\n  Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;\n  *pRowid = pCsr->rowid;\n  return SQLITE_OK;\n}\n\nstatic int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){\n  static const sqlite3_module fts5Vocab = {\n    /* iVersion      */ 2,\n    /* xCreate       */ fts5VocabCreateMethod,\n    /* xConnect      */ fts5VocabConnectMethod,\n    /* xBestIndex    */ fts5VocabBestIndexMethod,\n    /* xDisconnect   */ fts5VocabDisconnectMethod,\n    /* xDestroy      */ fts5VocabDestroyMethod,\n    /* xOpen         */ fts5VocabOpenMethod,\n    /* xClose        */ fts5VocabCloseMethod,\n    /* xFilter       */ fts5VocabFilterMethod,\n    /* xNext         */ fts5VocabNextMethod,\n    /* xEof          */ fts5VocabEofMethod,\n    /* xColumn       */ fts5VocabColumnMethod,\n    /* xRowid        */ fts5VocabRowidMethod,\n    /* xUpdate       */ 0,\n    /* xBegin        */ 0,\n    /* xSync         */ 0,\n    /* xCommit       */ 0,\n    /* xRollback     */ 0,\n    /* xFindFunction */ 0,\n    /* xRename       */ 0,\n    /* xSavepoint    */ 0,\n    /* xRelease      */ 0,\n    /* xRollbackTo   */ 0,\n  };\n  void *p = (void*)pGlobal;\n\n  return sqlite3_create_module_v2(db, \"fts5vocab\", &fts5Vocab, p, 0);\n}\n\n\n\n\n    \n#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/fts5.h",
    "content": "/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** Interfaces to extend FTS5. Using the interfaces defined in this file, \n** FTS5 may be extended with:\n**\n**     * custom tokenizers, and\n**     * custom auxiliary functions.\n*/\n\n\n#ifndef _FTS5_H\n#define _FTS5_H\n\n#include \"sqlite3.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*************************************************************************\n** CUSTOM AUXILIARY FUNCTIONS\n**\n** Virtual table implementations may overload SQL functions by implementing\n** the sqlite3_module.xFindFunction() method.\n*/\n\ntypedef struct Fts5ExtensionApi Fts5ExtensionApi;\ntypedef struct Fts5Context Fts5Context;\ntypedef struct Fts5PhraseIter Fts5PhraseIter;\n\ntypedef void (*fts5_extension_function)(\n  const Fts5ExtensionApi *pApi,   /* API offered by current FTS version */\n  Fts5Context *pFts,              /* First arg to pass to pApi functions */\n  sqlite3_context *pCtx,          /* Context for returning result/error */\n  int nVal,                       /* Number of values in apVal[] array */\n  sqlite3_value **apVal           /* Array of trailing arguments */\n);\n\nstruct Fts5PhraseIter {\n  const unsigned char *a;\n  const unsigned char *b;\n};\n\n/*\n** EXTENSION API FUNCTIONS\n**\n** xUserData(pFts):\n**   Return a copy of the context pointer the extension function was \n**   registered with.\n**\n** xColumnTotalSize(pFts, iCol, pnToken):\n**   If parameter iCol is less than zero, set output variable *pnToken\n**   to the total number of tokens in the FTS5 table. Or, if iCol is\n**   non-negative but less than the number of columns in the table, return\n**   the total number of tokens in column iCol, considering all rows in \n**   the FTS5 table.\n**\n**   If parameter iCol is greater than or equal to the number of columns\n**   in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.\n**   an OOM condition or IO error), an appropriate SQLite error code is \n**   returned.\n**\n** xColumnCount(pFts):\n**   Return the number of columns in the table.\n**\n** xColumnSize(pFts, iCol, pnToken):\n**   If parameter iCol is less than zero, set output variable *pnToken\n**   to the total number of tokens in the current row. Or, if iCol is\n**   non-negative but less than the number of columns in the table, set\n**   *pnToken to the number of tokens in column iCol of the current row.\n**\n**   If parameter iCol is greater than or equal to the number of columns\n**   in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.\n**   an OOM condition or IO error), an appropriate SQLite error code is \n**   returned.\n**\n**   This function may be quite inefficient if used with an FTS5 table\n**   created with the \"columnsize=0\" option.\n**\n** xColumnText:\n**   This function attempts to retrieve the text of column iCol of the\n**   current document. If successful, (*pz) is set to point to a buffer\n**   containing the text in utf-8 encoding, (*pn) is set to the size in bytes\n**   (not characters) of the buffer and SQLITE_OK is returned. Otherwise,\n**   if an error occurs, an SQLite error code is returned and the final values\n**   of (*pz) and (*pn) are undefined.\n**\n** xPhraseCount:\n**   Returns the number of phrases in the current query expression.\n**\n** xPhraseSize:\n**   Returns the number of tokens in phrase iPhrase of the query. Phrases\n**   are numbered starting from zero.\n**\n** xInstCount:\n**   Set *pnInst to the total number of occurrences of all phrases within\n**   the query within the current row. Return SQLITE_OK if successful, or\n**   an error code (i.e. SQLITE_NOMEM) if an error occurs.\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. If the FTS5 table is created \n**   with either \"detail=none\" or \"detail=column\" and \"content=\" option \n**   (i.e. if it is a contentless table), then this API always returns 0.\n**\n** xInst:\n**   Query for the details of phrase match iIdx within the current row.\n**   Phrase matches are numbered starting from zero, so the iIdx argument\n**   should be greater than or equal to zero and smaller than the value\n**   output by xInstCount().\n**\n**   Usually, output parameter *piPhrase is set to the phrase number, *piCol\n**   to the column in which it occurs and *piOff the token offset of the\n**   first token of the phrase. The exception is if the table was created\n**   with the offsets=0 option specified. In this case *piOff is always\n**   set to -1.\n**\n**   Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM) \n**   if an error occurs.\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. \n**\n** xRowid:\n**   Returns the rowid of the current row.\n**\n** xTokenize:\n**   Tokenize text using the tokenizer belonging to the FTS5 table.\n**\n** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):\n**   This API function is used to query the FTS table for phrase iPhrase\n**   of the current query. Specifically, a query equivalent to:\n**\n**       ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid\n**\n**   with $p set to a phrase equivalent to the phrase iPhrase of the\n**   current query is executed. Any column filter that applies to\n**   phrase iPhrase of the current query is included in $p. For each \n**   row visited, the callback function passed as the fourth argument \n**   is invoked. The context and API objects passed to the callback \n**   function may be used to access the properties of each matched row.\n**   Invoking Api.xUserData() returns a copy of the pointer passed as \n**   the third argument to pUserData.\n**\n**   If the callback function returns any value other than SQLITE_OK, the\n**   query is abandoned and the xQueryPhrase function returns immediately.\n**   If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.\n**   Otherwise, the error code is propagated upwards.\n**\n**   If the query runs to completion without incident, SQLITE_OK is returned.\n**   Or, if some error occurs before the query completes or is aborted by\n**   the callback, an SQLite error code is returned.\n**\n**\n** xSetAuxdata(pFts5, pAux, xDelete)\n**\n**   Save the pointer passed as the second argument as the extension functions \n**   \"auxiliary data\". The pointer may then be retrieved by the current or any\n**   future invocation of the same fts5 extension function made as part of\n**   of the same MATCH query using the xGetAuxdata() API.\n**\n**   Each extension function is allocated a single auxiliary data slot for\n**   each FTS query (MATCH expression). If the extension function is invoked \n**   more than once for a single FTS query, then all invocations share a \n**   single auxiliary data context.\n**\n**   If there is already an auxiliary data pointer when this function is\n**   invoked, then it is replaced by the new pointer. If an xDelete callback\n**   was specified along with the original pointer, it is invoked at this\n**   point.\n**\n**   The xDelete callback, if one is specified, is also invoked on the\n**   auxiliary data pointer after the FTS5 query has finished.\n**\n**   If an error (e.g. an OOM condition) occurs within this function, an\n**   the auxiliary data is set to NULL and an error code returned. If the\n**   xDelete parameter was not NULL, it is invoked on the auxiliary data\n**   pointer before returning.\n**\n**\n** xGetAuxdata(pFts5, bClear)\n**\n**   Returns the current auxiliary data pointer for the fts5 extension \n**   function. See the xSetAuxdata() method for details.\n**\n**   If the bClear argument is non-zero, then the auxiliary data is cleared\n**   (set to NULL) before this function returns. In this case the xDelete,\n**   if any, is not invoked.\n**\n**\n** xRowCount(pFts5, pnRow)\n**\n**   This function is used to retrieve the total number of rows in the table.\n**   In other words, the same value that would be returned by:\n**\n**        SELECT count(*) FROM ftstable;\n**\n** xPhraseFirst()\n**   This function is used, along with type Fts5PhraseIter and the xPhraseNext\n**   method, to iterate through all instances of a single query phrase within\n**   the current row. This is the same information as is accessible via the\n**   xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient\n**   to use, this API may be faster under some circumstances. To iterate \n**   through instances of phrase iPhrase, use the following code:\n**\n**       Fts5PhraseIter iter;\n**       int iCol, iOff;\n**       for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);\n**           iCol>=0;\n**           pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)\n**       ){\n**         // An instance of phrase iPhrase at offset iOff of column iCol\n**       }\n**\n**   The Fts5PhraseIter structure is defined above. Applications should not\n**   modify this structure directly - it should only be used as shown above\n**   with the xPhraseFirst() and xPhraseNext() API methods (and by\n**   xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. If the FTS5 table is created \n**   with either \"detail=none\" or \"detail=column\" and \"content=\" option \n**   (i.e. if it is a contentless table), then this API always iterates\n**   through an empty set (all calls to xPhraseFirst() set iCol to -1).\n**\n** xPhraseNext()\n**   See xPhraseFirst above.\n**\n** xPhraseFirstColumn()\n**   This function and xPhraseNextColumn() are similar to the xPhraseFirst()\n**   and xPhraseNext() APIs described above. The difference is that instead\n**   of iterating through all instances of a phrase in the current row, these\n**   APIs are used to iterate through the set of columns in the current row\n**   that contain one or more instances of a specified phrase. For example:\n**\n**       Fts5PhraseIter iter;\n**       int iCol;\n**       for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);\n**           iCol>=0;\n**           pApi->xPhraseNextColumn(pFts, &iter, &iCol)\n**       ){\n**         // Column iCol contains at least one instance of phrase iPhrase\n**       }\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" option. If the FTS5 table is created with either \n**   \"detail=none\" \"content=\" option (i.e. if it is a contentless table), \n**   then this API always iterates through an empty set (all calls to \n**   xPhraseFirstColumn() set iCol to -1).\n**\n**   The information accessed using this API and its companion\n**   xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext\n**   (or xInst/xInstCount). The chief advantage of this API is that it is\n**   significantly more efficient than those alternatives when used with\n**   \"detail=column\" tables.  \n**\n** xPhraseNextColumn()\n**   See xPhraseFirstColumn above.\n*/\nstruct Fts5ExtensionApi {\n  int iVersion;                   /* Currently always set to 3 */\n\n  void *(*xUserData)(Fts5Context*);\n\n  int (*xColumnCount)(Fts5Context*);\n  int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);\n  int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);\n\n  int (*xTokenize)(Fts5Context*, \n    const char *pText, int nText, /* Text to tokenize */\n    void *pCtx,                   /* Context passed to xToken() */\n    int (*xToken)(void*, int, const char*, int, int, int)       /* Callback */\n  );\n\n  int (*xPhraseCount)(Fts5Context*);\n  int (*xPhraseSize)(Fts5Context*, int iPhrase);\n\n  int (*xInstCount)(Fts5Context*, int *pnInst);\n  int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff);\n\n  sqlite3_int64 (*xRowid)(Fts5Context*);\n  int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn);\n  int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken);\n\n  int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData,\n    int(*)(const Fts5ExtensionApi*,Fts5Context*,void*)\n  );\n  int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));\n  void *(*xGetAuxdata)(Fts5Context*, int bClear);\n\n  int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);\n  void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);\n\n  int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);\n  void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);\n};\n\n/* \n** CUSTOM AUXILIARY FUNCTIONS\n*************************************************************************/\n\n/*************************************************************************\n** CUSTOM TOKENIZERS\n**\n** Applications may also register custom tokenizer types. A tokenizer \n** is registered by providing fts5 with a populated instance of the \n** following structure. All structure methods must be defined, setting\n** any member of the fts5_tokenizer struct to NULL leads to undefined\n** behaviour. The structure methods are expected to function as follows:\n**\n** xCreate:\n**   This function is used to allocate and initialize a tokenizer instance.\n**   A tokenizer instance is required to actually tokenize text.\n**\n**   The first argument passed to this function is a copy of the (void*)\n**   pointer provided by the application when the fts5_tokenizer object\n**   was registered with FTS5 (the third argument to xCreateTokenizer()). \n**   The second and third arguments are an array of nul-terminated strings\n**   containing the tokenizer arguments, if any, specified following the\n**   tokenizer name as part of the CREATE VIRTUAL TABLE statement used\n**   to create the FTS5 table.\n**\n**   The final argument is an output variable. If successful, (*ppOut) \n**   should be set to point to the new tokenizer handle and SQLITE_OK\n**   returned. If an error occurs, some value other than SQLITE_OK should\n**   be returned. In this case, fts5 assumes that the final value of *ppOut \n**   is undefined.\n**\n** xDelete:\n**   This function is invoked to delete a tokenizer handle previously\n**   allocated using xCreate(). Fts5 guarantees that this function will\n**   be invoked exactly once for each successful call to xCreate().\n**\n** xTokenize:\n**   This function is expected to tokenize the nText byte string indicated \n**   by argument pText. pText may or may not be nul-terminated. The first\n**   argument passed to this function is a pointer to an Fts5Tokenizer object\n**   returned by an earlier call to xCreate().\n**\n**   The second argument indicates the reason that FTS5 is requesting\n**   tokenization of the supplied text. This is always one of the following\n**   four values:\n**\n**   <ul><li> <b>FTS5_TOKENIZE_DOCUMENT</b> - A document is being inserted into\n**            or removed from the FTS table. The tokenizer is being invoked to\n**            determine the set of tokens to add to (or delete from) the\n**            FTS index.\n**\n**       <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed \n**            against the FTS index. The tokenizer is being called to tokenize \n**            a bareword or quoted string specified as part of the query.\n**\n**       <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as\n**            FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is\n**            followed by a \"*\" character, indicating that the last token\n**            returned by the tokenizer will be treated as a token prefix.\n**\n**       <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to \n**            satisfy an fts5_api.xTokenize() request made by an auxiliary\n**            function. Or an fts5_api.xColumnSize() request made by the same\n**            on a columnsize=0 database.  \n**   </ul>\n**\n**   For each token in the input string, the supplied callback xToken() must\n**   be invoked. The first argument to it should be a copy of the pointer\n**   passed as the second argument to xTokenize(). The third and fourth\n**   arguments are a pointer to a buffer containing the token text, and the\n**   size of the token in bytes. The 4th and 5th arguments are the byte offsets\n**   of the first byte of and first byte immediately following the text from\n**   which the token is derived within the input.\n**\n**   The second argument passed to the xToken() callback (\"tflags\") should\n**   normally be set to 0. The exception is if the tokenizer supports \n**   synonyms. In this case see the discussion below for details.\n**\n**   FTS5 assumes the xToken() callback is invoked for each token in the \n**   order that they occur within the input text.\n**\n**   If an xToken() callback returns any value other than SQLITE_OK, then\n**   the tokenization should be abandoned and the xTokenize() method should\n**   immediately return a copy of the xToken() return value. Or, if the\n**   input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,\n**   if an error occurs with the xTokenize() implementation itself, it\n**   may abandon the tokenization and return any error code other than\n**   SQLITE_OK or SQLITE_DONE.\n**\n** SYNONYM SUPPORT\n**\n**   Custom tokenizers may also support synonyms. Consider a case in which a\n**   user wishes to query for a phrase such as \"first place\". Using the \n**   built-in tokenizers, the FTS5 query 'first + place' will match instances\n**   of \"first place\" within the document set, but not alternative forms\n**   such as \"1st place\". In some applications, it would be better to match\n**   all instances of \"first place\" or \"1st place\" regardless of which form\n**   the user specified in the MATCH query text.\n**\n**   There are several ways to approach this in FTS5:\n**\n**   <ol><li> By mapping all synonyms to a single token. In this case, the \n**            In the above example, this means that the tokenizer returns the\n**            same token for inputs \"first\" and \"1st\". Say that token is in\n**            fact \"first\", so that when the user inserts the document \"I won\n**            1st place\" entries are added to the index for tokens \"i\", \"won\",\n**            \"first\" and \"place\". If the user then queries for '1st + place',\n**            the tokenizer substitutes \"first\" for \"1st\" and the query works\n**            as expected.\n**\n**       <li> By adding multiple synonyms for a single term to the FTS index.\n**            In this case, when tokenizing query text, the tokenizer may \n**            provide multiple synonyms for a single term within the document.\n**            FTS5 then queries the index for each synonym individually. For\n**            example, faced with the query:\n**\n**   <codeblock>\n**     ... MATCH 'first place'</codeblock>\n**\n**            the tokenizer offers both \"1st\" and \"first\" as synonyms for the\n**            first token in the MATCH query and FTS5 effectively runs a query \n**            similar to:\n**\n**   <codeblock>\n**     ... MATCH '(first OR 1st) place'</codeblock>\n**\n**            except that, for the purposes of auxiliary functions, the query\n**            still appears to contain just two phrases - \"(first OR 1st)\" \n**            being treated as a single phrase.\n**\n**       <li> By adding multiple synonyms for a single term to the FTS index.\n**            Using this method, when tokenizing document text, the tokenizer\n**            provides multiple synonyms for each token. So that when a \n**            document such as \"I won first place\" is tokenized, entries are\n**            added to the FTS index for \"i\", \"won\", \"first\", \"1st\" and\n**            \"place\".\n**\n**            This way, even if the tokenizer does not provide synonyms\n**            when tokenizing query text (it should not - to do would be\n**            inefficient), it doesn't matter if the user queries for \n**            'first + place' or '1st + place', as there are entires in the\n**            FTS index corresponding to both forms of the first token.\n**   </ol>\n**\n**   Whether it is parsing document or query text, any call to xToken that\n**   specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit\n**   is considered to supply a synonym for the previous token. For example,\n**   when parsing the document \"I won first place\", a tokenizer that supports\n**   synonyms would call xToken() 5 times, as follows:\n**\n**   <codeblock>\n**       xToken(pCtx, 0, \"i\",                      1,  0,  1);\n**       xToken(pCtx, 0, \"won\",                    3,  2,  5);\n**       xToken(pCtx, 0, \"first\",                  5,  6, 11);\n**       xToken(pCtx, FTS5_TOKEN_COLOCATED, \"1st\", 3,  6, 11);\n**       xToken(pCtx, 0, \"place\",                  5, 12, 17);\n**</codeblock>\n**\n**   It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time\n**   xToken() is called. Multiple synonyms may be specified for a single token\n**   by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence. \n**   There is no limit to the number of synonyms that may be provided for a\n**   single token.\n**\n**   In many cases, method (1) above is the best approach. It does not add \n**   extra data to the FTS index or require FTS5 to query for multiple terms,\n**   so it is efficient in terms of disk space and query speed. However, it\n**   does not support prefix queries very well. If, as suggested above, the\n**   token \"first\" is subsituted for \"1st\" by the tokenizer, then the query:\n**\n**   <codeblock>\n**     ... MATCH '1s*'</codeblock>\n**\n**   will not match documents that contain the token \"1st\" (as the tokenizer\n**   will probably not map \"1s\" to any prefix of \"first\").\n**\n**   For full prefix support, method (3) may be preferred. In this case, \n**   because the index contains entries for both \"first\" and \"1st\", prefix\n**   queries such as 'fi*' or '1s*' will match correctly. However, because\n**   extra entries are added to the FTS index, this method uses more space\n**   within the database.\n**\n**   Method (2) offers a midpoint between (1) and (3). Using this method,\n**   a query such as '1s*' will match documents that contain the literal \n**   token \"1st\", but not \"first\" (assuming the tokenizer is not able to\n**   provide synonyms for prefixes). However, a non-prefix query like '1st'\n**   will match against \"1st\" and \"first\". This method does not require\n**   extra disk space, as no extra entries are added to the FTS index. \n**   On the other hand, it may require more CPU cycles to run MATCH queries,\n**   as separate queries of the FTS index are required for each synonym.\n**\n**   When using methods (2) or (3), it is important that the tokenizer only\n**   provide synonyms when tokenizing document text (method (2)) or query\n**   text (method (3)), not both. Doing so will not cause any errors, but is\n**   inefficient.\n*/\ntypedef struct Fts5Tokenizer Fts5Tokenizer;\ntypedef struct fts5_tokenizer fts5_tokenizer;\nstruct fts5_tokenizer {\n  int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);\n  void (*xDelete)(Fts5Tokenizer*);\n  int (*xTokenize)(Fts5Tokenizer*, \n      void *pCtx,\n      int flags,            /* Mask of FTS5_TOKENIZE_* flags */\n      const char *pText, int nText, \n      int (*xToken)(\n        void *pCtx,         /* Copy of 2nd argument to xTokenize() */\n        int tflags,         /* Mask of FTS5_TOKEN_* flags */\n        const char *pToken, /* Pointer to buffer containing token */\n        int nToken,         /* Size of token in bytes */\n        int iStart,         /* Byte offset of token within input text */\n        int iEnd            /* Byte offset of end of token within input text */\n      )\n  );\n};\n\n/* Flags that may be passed as the third argument to xTokenize() */\n#define FTS5_TOKENIZE_QUERY     0x0001\n#define FTS5_TOKENIZE_PREFIX    0x0002\n#define FTS5_TOKENIZE_DOCUMENT  0x0004\n#define FTS5_TOKENIZE_AUX       0x0008\n\n/* Flags that may be passed by the tokenizer implementation back to FTS5\n** as the third argument to the supplied xToken callback. */\n#define FTS5_TOKEN_COLOCATED    0x0001      /* Same position as prev. token */\n\n/*\n** END OF CUSTOM TOKENIZERS\n*************************************************************************/\n\n/*************************************************************************\n** FTS5 EXTENSION REGISTRATION API\n*/\ntypedef struct fts5_api fts5_api;\nstruct fts5_api {\n  int iVersion;                   /* Currently always set to 2 */\n\n  /* Create a new tokenizer */\n  int (*xCreateTokenizer)(\n    fts5_api *pApi,\n    const char *zName,\n    void *pContext,\n    fts5_tokenizer *pTokenizer,\n    void (*xDestroy)(void*)\n  );\n\n  /* Find an existing tokenizer */\n  int (*xFindTokenizer)(\n    fts5_api *pApi,\n    const char *zName,\n    void **ppContext,\n    fts5_tokenizer *pTokenizer\n  );\n\n  /* Create a new auxiliary function */\n  int (*xCreateFunction)(\n    fts5_api *pApi,\n    const char *zName,\n    void *pContext,\n    fts5_extension_function xFunction,\n    void (*xDestroy)(void*)\n  );\n};\n\n/*\n** END OF REGISTRATION API\n*************************************************************************/\n\n#ifdef __cplusplus\n}  /* end of the 'extern \"C\"' block */\n#endif\n\n#endif /* _FTS5_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/keywordhash.h",
    "content": "/***** This file contains automatically generated code ******\n**\n** The code in this file has been automatically generated by\n**\n**   sqlite/tool/mkkeywordhash.c\n**\n** The code in this file implements a function that determines whether\n** or not a given identifier is really an SQL keyword.  The same thing\n** might be implemented more directly using a hand-written hash table.\n** But by using this automatically generated code, the size of the code\n** is substantially reduced.  This is important for embedded applications\n** on platforms with limited memory.\n*/\n/* Hash score: 182 */\nstatic int keywordCode(const char *z, int n, int *pType){\n  /* zText[] encodes 834 bytes of keywords in 554 bytes */\n  /*   REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT       */\n  /*   ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE         */\n  /*   XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY         */\n  /*   UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE         */\n  /*   BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH     */\n  /*   IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN     */\n  /*   WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT         */\n  /*   CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL        */\n  /*   FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING        */\n  /*   VACUUMVIEWINITIALLY                                                */\n  static const char zText[553] = {\n    'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',\n    'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',\n    'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',\n    'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',\n    'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',\n    'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',\n    'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',\n    'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',\n    'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',\n    'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',\n    'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',\n    'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',\n    'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',\n    'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',\n    'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',\n    'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',\n    'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',\n    'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',\n    'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',\n    'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',\n    'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',\n    'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',\n    'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',\n    'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',\n    'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',\n    'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',\n    'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',\n    'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',\n    'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',\n    'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',\n    'V','I','E','W','I','N','I','T','I','A','L','L','Y',\n  };\n  static const unsigned char aHash[127] = {\n      76, 105, 117,  74,   0,  45,   0,   0,  82,   0,  77,   0,   0,\n      42,  12,  78,  15,   0, 116,  85,  54, 112,   0,  19,   0,   0,\n     121,   0, 119, 115,   0,  22,  93,   0,   9,   0,   0,  70,  71,\n       0,  69,   6,   0,  48,  90, 102,   0, 118, 101,   0,   0,  44,\n       0, 103,  24,   0,  17,   0, 122,  53,  23,   0,   5, 110,  25,\n      96,   0,   0, 124, 106,  60, 123,  57,  28,  55,   0,  91,   0,\n     100,  26,   0,  99,   0,   0,   0,  95,  92,  97,  88, 109,  14,\n      39, 108,   0,  81,   0,  18,  89, 111,  32,   0, 120,  80, 113,\n      62,  46,  84,   0,   0,  94,  40,  59, 114,   0,  36,   0,   0,\n      29,   0,  86,  63,  64,   0,  20,  61,   0,  56,\n  };\n  static const unsigned char aNext[124] = {\n       0,   0,   0,   0,   4,   0,   0,   0,   0,   0,   0,   0,   0,\n       0,   2,   0,   0,   0,   0,   0,   0,  13,   0,   0,   0,   0,\n       0,   7,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n       0,   0,   0,   0,  33,   0,  21,   0,   0,   0,   0,   0,  50,\n       0,  43,   3,  47,   0,   0,   0,   0,  30,   0,  58,   0,  38,\n       0,   0,   0,   1,  66,   0,   0,  67,   0,  41,   0,   0,   0,\n       0,   0,   0,  49,  65,   0,   0,   0,   0,  31,  52,  16,  34,\n      10,   0,   0,   0,   0,   0,   0,   0,  11,  72,  79,   0,   8,\n       0, 104,  98,   0, 107,   0,  87,   0,  75,  51,   0,  27,  37,\n      73,  83,   0,  35,  68,   0,   0,\n  };\n  static const unsigned char aLen[124] = {\n       7,   7,   5,   4,   6,   4,   5,   3,   6,   7,   3,   6,   6,\n       7,   7,   3,   8,   2,   6,   5,   4,   4,   3,  10,   4,   6,\n      11,   6,   2,   7,   5,   5,   9,   6,   9,   9,   7,  10,  10,\n       4,   6,   2,   3,   9,   4,   2,   6,   5,   7,   4,   5,   7,\n       6,   6,   5,   6,   5,   5,   9,   7,   7,   3,   2,   4,   4,\n       7,   3,   6,   4,   7,   6,  12,   6,   9,   4,   6,   5,   4,\n       7,   6,   5,   6,   7,   5,   4,   5,   6,   5,   7,   3,   7,\n      13,   2,   2,   4,   6,   6,   8,   5,  17,  12,   7,   8,   8,\n       2,   4,   4,   4,   4,   4,   2,   2,   6,   5,   8,   5,   8,\n       3,   5,   5,   6,   4,   9,   3,\n  };\n  static const unsigned short int aOffset[124] = {\n       0,   2,   2,   8,   9,  14,  16,  20,  23,  25,  25,  29,  33,\n      36,  41,  46,  48,  53,  54,  59,  62,  65,  67,  69,  78,  81,\n      86,  91,  95,  96, 101, 105, 109, 117, 122, 128, 136, 142, 152,\n     159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,\n     199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,\n     250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,\n     320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,\n     387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,\n     460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,\n     521, 524, 529, 534, 540, 544, 549,\n  };\n  static const unsigned char aCode[124] = {\n    TK_REINDEX,    TK_INDEXED,    TK_INDEX,      TK_DESC,       TK_ESCAPE,     \n    TK_EACH,       TK_CHECK,      TK_KEY,        TK_BEFORE,     TK_FOREIGN,    \n    TK_FOR,        TK_IGNORE,     TK_LIKE_KW,    TK_EXPLAIN,    TK_INSTEAD,    \n    TK_ADD,        TK_DATABASE,   TK_AS,         TK_SELECT,     TK_TABLE,      \n    TK_JOIN_KW,    TK_THEN,       TK_END,        TK_DEFERRABLE, TK_ELSE,       \n    TK_EXCEPT,     TK_TRANSACTION,TK_ACTION,     TK_ON,         TK_JOIN_KW,    \n    TK_ALTER,      TK_RAISE,      TK_EXCLUSIVE,  TK_EXISTS,     TK_SAVEPOINT,  \n    TK_INTERSECT,  TK_TRIGGER,    TK_REFERENCES, TK_CONSTRAINT, TK_INTO,       \n    TK_OFFSET,     TK_OF,         TK_SET,        TK_TEMP,       TK_TEMP,       \n    TK_OR,         TK_UNIQUE,     TK_QUERY,      TK_WITHOUT,    TK_WITH,       \n    TK_JOIN_KW,    TK_RELEASE,    TK_ATTACH,     TK_HAVING,     TK_GROUP,      \n    TK_UPDATE,     TK_BEGIN,      TK_JOIN_KW,    TK_RECURSIVE,  TK_BETWEEN,    \n    TK_NOTNULL,    TK_NOT,        TK_NO,         TK_NULL,       TK_LIKE_KW,    \n    TK_CASCADE,    TK_ASC,        TK_DELETE,     TK_CASE,       TK_COLLATE,    \n    TK_CREATE,     TK_CTIME_KW,   TK_DETACH,     TK_IMMEDIATE,  TK_JOIN,       \n    TK_INSERT,     TK_MATCH,      TK_PLAN,       TK_ANALYZE,    TK_PRAGMA,     \n    TK_ABORT,      TK_VALUES,     TK_VIRTUAL,    TK_LIMIT,      TK_WHEN,       \n    TK_WHERE,      TK_RENAME,     TK_AFTER,      TK_REPLACE,    TK_AND,        \n    TK_DEFAULT,    TK_AUTOINCR,   TK_TO,         TK_IN,         TK_CAST,       \n    TK_COLUMNKW,   TK_COMMIT,     TK_CONFLICT,   TK_JOIN_KW,    TK_CTIME_KW,   \n    TK_CTIME_KW,   TK_PRIMARY,    TK_DEFERRED,   TK_DISTINCT,   TK_IS,         \n    TK_DROP,       TK_FAIL,       TK_FROM,       TK_JOIN_KW,    TK_LIKE_KW,    \n    TK_BY,         TK_IF,         TK_ISNULL,     TK_ORDER,      TK_RESTRICT,   \n    TK_JOIN_KW,    TK_ROLLBACK,   TK_ROW,        TK_UNION,      TK_USING,      \n    TK_VACUUM,     TK_VIEW,       TK_INITIALLY,  TK_ALL,        \n  };\n  int i, j;\n  const char *zKW;\n  if( n>=2 ){\n    i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;\n    for(i=((int)aHash[i])-1; i>=0; i=((int)aNext[i])-1){\n      if( aLen[i]!=n ) continue;\n      j = 0;\n      zKW = &zText[aOffset[i]];\n#ifdef SQLITE_ASCII\n      while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }\n#endif\n#ifdef SQLITE_EBCDIC\n      while( j<n && toupper(z[j])==zKW[j] ){ j++; }\n#endif\n      if( j<n ) continue;\n      testcase( i==0 ); /* REINDEX */\n      testcase( i==1 ); /* INDEXED */\n      testcase( i==2 ); /* INDEX */\n      testcase( i==3 ); /* DESC */\n      testcase( i==4 ); /* ESCAPE */\n      testcase( i==5 ); /* EACH */\n      testcase( i==6 ); /* CHECK */\n      testcase( i==7 ); /* KEY */\n      testcase( i==8 ); /* BEFORE */\n      testcase( i==9 ); /* FOREIGN */\n      testcase( i==10 ); /* FOR */\n      testcase( i==11 ); /* IGNORE */\n      testcase( i==12 ); /* REGEXP */\n      testcase( i==13 ); /* EXPLAIN */\n      testcase( i==14 ); /* INSTEAD */\n      testcase( i==15 ); /* ADD */\n      testcase( i==16 ); /* DATABASE */\n      testcase( i==17 ); /* AS */\n      testcase( i==18 ); /* SELECT */\n      testcase( i==19 ); /* TABLE */\n      testcase( i==20 ); /* LEFT */\n      testcase( i==21 ); /* THEN */\n      testcase( i==22 ); /* END */\n      testcase( i==23 ); /* DEFERRABLE */\n      testcase( i==24 ); /* ELSE */\n      testcase( i==25 ); /* EXCEPT */\n      testcase( i==26 ); /* TRANSACTION */\n      testcase( i==27 ); /* ACTION */\n      testcase( i==28 ); /* ON */\n      testcase( i==29 ); /* NATURAL */\n      testcase( i==30 ); /* ALTER */\n      testcase( i==31 ); /* RAISE */\n      testcase( i==32 ); /* EXCLUSIVE */\n      testcase( i==33 ); /* EXISTS */\n      testcase( i==34 ); /* SAVEPOINT */\n      testcase( i==35 ); /* INTERSECT */\n      testcase( i==36 ); /* TRIGGER */\n      testcase( i==37 ); /* REFERENCES */\n      testcase( i==38 ); /* CONSTRAINT */\n      testcase( i==39 ); /* INTO */\n      testcase( i==40 ); /* OFFSET */\n      testcase( i==41 ); /* OF */\n      testcase( i==42 ); /* SET */\n      testcase( i==43 ); /* TEMPORARY */\n      testcase( i==44 ); /* TEMP */\n      testcase( i==45 ); /* OR */\n      testcase( i==46 ); /* UNIQUE */\n      testcase( i==47 ); /* QUERY */\n      testcase( i==48 ); /* WITHOUT */\n      testcase( i==49 ); /* WITH */\n      testcase( i==50 ); /* OUTER */\n      testcase( i==51 ); /* RELEASE */\n      testcase( i==52 ); /* ATTACH */\n      testcase( i==53 ); /* HAVING */\n      testcase( i==54 ); /* GROUP */\n      testcase( i==55 ); /* UPDATE */\n      testcase( i==56 ); /* BEGIN */\n      testcase( i==57 ); /* INNER */\n      testcase( i==58 ); /* RECURSIVE */\n      testcase( i==59 ); /* BETWEEN */\n      testcase( i==60 ); /* NOTNULL */\n      testcase( i==61 ); /* NOT */\n      testcase( i==62 ); /* NO */\n      testcase( i==63 ); /* NULL */\n      testcase( i==64 ); /* LIKE */\n      testcase( i==65 ); /* CASCADE */\n      testcase( i==66 ); /* ASC */\n      testcase( i==67 ); /* DELETE */\n      testcase( i==68 ); /* CASE */\n      testcase( i==69 ); /* COLLATE */\n      testcase( i==70 ); /* CREATE */\n      testcase( i==71 ); /* CURRENT_DATE */\n      testcase( i==72 ); /* DETACH */\n      testcase( i==73 ); /* IMMEDIATE */\n      testcase( i==74 ); /* JOIN */\n      testcase( i==75 ); /* INSERT */\n      testcase( i==76 ); /* MATCH */\n      testcase( i==77 ); /* PLAN */\n      testcase( i==78 ); /* ANALYZE */\n      testcase( i==79 ); /* PRAGMA */\n      testcase( i==80 ); /* ABORT */\n      testcase( i==81 ); /* VALUES */\n      testcase( i==82 ); /* VIRTUAL */\n      testcase( i==83 ); /* LIMIT */\n      testcase( i==84 ); /* WHEN */\n      testcase( i==85 ); /* WHERE */\n      testcase( i==86 ); /* RENAME */\n      testcase( i==87 ); /* AFTER */\n      testcase( i==88 ); /* REPLACE */\n      testcase( i==89 ); /* AND */\n      testcase( i==90 ); /* DEFAULT */\n      testcase( i==91 ); /* AUTOINCREMENT */\n      testcase( i==92 ); /* TO */\n      testcase( i==93 ); /* IN */\n      testcase( i==94 ); /* CAST */\n      testcase( i==95 ); /* COLUMN */\n      testcase( i==96 ); /* COMMIT */\n      testcase( i==97 ); /* CONFLICT */\n      testcase( i==98 ); /* CROSS */\n      testcase( i==99 ); /* CURRENT_TIMESTAMP */\n      testcase( i==100 ); /* CURRENT_TIME */\n      testcase( i==101 ); /* PRIMARY */\n      testcase( i==102 ); /* DEFERRED */\n      testcase( i==103 ); /* DISTINCT */\n      testcase( i==104 ); /* IS */\n      testcase( i==105 ); /* DROP */\n      testcase( i==106 ); /* FAIL */\n      testcase( i==107 ); /* FROM */\n      testcase( i==108 ); /* FULL */\n      testcase( i==109 ); /* GLOB */\n      testcase( i==110 ); /* BY */\n      testcase( i==111 ); /* IF */\n      testcase( i==112 ); /* ISNULL */\n      testcase( i==113 ); /* ORDER */\n      testcase( i==114 ); /* RESTRICT */\n      testcase( i==115 ); /* RIGHT */\n      testcase( i==116 ); /* ROLLBACK */\n      testcase( i==117 ); /* ROW */\n      testcase( i==118 ); /* UNION */\n      testcase( i==119 ); /* USING */\n      testcase( i==120 ); /* VACUUM */\n      testcase( i==121 ); /* VIEW */\n      testcase( i==122 ); /* INITIALLY */\n      testcase( i==123 ); /* ALL */\n      *pType = aCode[i];\n      break;\n    }\n  }\n  return n;\n}\nint sqlite3KeywordCode(const unsigned char *z, int n){\n  int id = TK_ID;\n  keywordCode((char*)z, n, &id);\n  return id;\n}\n#define SQLITE_N_KEYWORD 124\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/opcodes.c",
    "content": "/* Automatically generated.  Do not edit */\n/* See the tool/mkopcodec.tcl script for details. */\n#if !defined(SQLITE_OMIT_EXPLAIN) \\\n || defined(VDBE_PROFILE) \\\n || defined(SQLITE_DEBUG)\n#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG)\n# define OpHelp(X) \"\\0\" X\n#else\n# define OpHelp(X)\n#endif\nconst char *sqlite3OpcodeName(int i){\n static const char *const azName[] = {\n    /*   0 */ \"Savepoint\"        OpHelp(\"\"),\n    /*   1 */ \"AutoCommit\"       OpHelp(\"\"),\n    /*   2 */ \"Transaction\"      OpHelp(\"\"),\n    /*   3 */ \"SorterNext\"       OpHelp(\"\"),\n    /*   4 */ \"PrevIfOpen\"       OpHelp(\"\"),\n    /*   5 */ \"NextIfOpen\"       OpHelp(\"\"),\n    /*   6 */ \"Prev\"             OpHelp(\"\"),\n    /*   7 */ \"Next\"             OpHelp(\"\"),\n    /*   8 */ \"Checkpoint\"       OpHelp(\"\"),\n    /*   9 */ \"JournalMode\"      OpHelp(\"\"),\n    /*  10 */ \"Vacuum\"           OpHelp(\"\"),\n    /*  11 */ \"VFilter\"          OpHelp(\"iplan=r[P3] zplan='P4'\"),\n    /*  12 */ \"VUpdate\"          OpHelp(\"data=r[P3@P2]\"),\n    /*  13 */ \"Goto\"             OpHelp(\"\"),\n    /*  14 */ \"Gosub\"            OpHelp(\"\"),\n    /*  15 */ \"InitCoroutine\"    OpHelp(\"\"),\n    /*  16 */ \"Yield\"            OpHelp(\"\"),\n    /*  17 */ \"MustBeInt\"        OpHelp(\"\"),\n    /*  18 */ \"Jump\"             OpHelp(\"\"),\n    /*  19 */ \"Not\"              OpHelp(\"r[P2]= !r[P1]\"),\n    /*  20 */ \"Once\"             OpHelp(\"\"),\n    /*  21 */ \"If\"               OpHelp(\"\"),\n    /*  22 */ \"IfNot\"            OpHelp(\"\"),\n    /*  23 */ \"SeekLT\"           OpHelp(\"key=r[P3@P4]\"),\n    /*  24 */ \"SeekLE\"           OpHelp(\"key=r[P3@P4]\"),\n    /*  25 */ \"SeekGE\"           OpHelp(\"key=r[P3@P4]\"),\n    /*  26 */ \"SeekGT\"           OpHelp(\"key=r[P3@P4]\"),\n    /*  27 */ \"Or\"               OpHelp(\"r[P3]=(r[P1] || r[P2])\"),\n    /*  28 */ \"And\"              OpHelp(\"r[P3]=(r[P1] && r[P2])\"),\n    /*  29 */ \"NoConflict\"       OpHelp(\"key=r[P3@P4]\"),\n    /*  30 */ \"NotFound\"         OpHelp(\"key=r[P3@P4]\"),\n    /*  31 */ \"Found\"            OpHelp(\"key=r[P3@P4]\"),\n    /*  32 */ \"SeekRowid\"        OpHelp(\"intkey=r[P3]\"),\n    /*  33 */ \"NotExists\"        OpHelp(\"intkey=r[P3]\"),\n    /*  34 */ \"IsNull\"           OpHelp(\"if r[P1]==NULL goto P2\"),\n    /*  35 */ \"NotNull\"          OpHelp(\"if r[P1]!=NULL goto P2\"),\n    /*  36 */ \"Ne\"               OpHelp(\"IF r[P3]!=r[P1]\"),\n    /*  37 */ \"Eq\"               OpHelp(\"IF r[P3]==r[P1]\"),\n    /*  38 */ \"Gt\"               OpHelp(\"IF r[P3]>r[P1]\"),\n    /*  39 */ \"Le\"               OpHelp(\"IF r[P3]<=r[P1]\"),\n    /*  40 */ \"Lt\"               OpHelp(\"IF r[P3]<r[P1]\"),\n    /*  41 */ \"Ge\"               OpHelp(\"IF r[P3]>=r[P1]\"),\n    /*  42 */ \"ElseNotEq\"        OpHelp(\"\"),\n    /*  43 */ \"BitAnd\"           OpHelp(\"r[P3]=r[P1]&r[P2]\"),\n    /*  44 */ \"BitOr\"            OpHelp(\"r[P3]=r[P1]|r[P2]\"),\n    /*  45 */ \"ShiftLeft\"        OpHelp(\"r[P3]=r[P2]<<r[P1]\"),\n    /*  46 */ \"ShiftRight\"       OpHelp(\"r[P3]=r[P2]>>r[P1]\"),\n    /*  47 */ \"Add\"              OpHelp(\"r[P3]=r[P1]+r[P2]\"),\n    /*  48 */ \"Subtract\"         OpHelp(\"r[P3]=r[P2]-r[P1]\"),\n    /*  49 */ \"Multiply\"         OpHelp(\"r[P3]=r[P1]*r[P2]\"),\n    /*  50 */ \"Divide\"           OpHelp(\"r[P3]=r[P2]/r[P1]\"),\n    /*  51 */ \"Remainder\"        OpHelp(\"r[P3]=r[P2]%r[P1]\"),\n    /*  52 */ \"Concat\"           OpHelp(\"r[P3]=r[P2]+r[P1]\"),\n    /*  53 */ \"Last\"             OpHelp(\"\"),\n    /*  54 */ \"BitNot\"           OpHelp(\"r[P1]= ~r[P1]\"),\n    /*  55 */ \"SorterSort\"       OpHelp(\"\"),\n    /*  56 */ \"Sort\"             OpHelp(\"\"),\n    /*  57 */ \"Rewind\"           OpHelp(\"\"),\n    /*  58 */ \"IdxLE\"            OpHelp(\"key=r[P3@P4]\"),\n    /*  59 */ \"IdxGT\"            OpHelp(\"key=r[P3@P4]\"),\n    /*  60 */ \"IdxLT\"            OpHelp(\"key=r[P3@P4]\"),\n    /*  61 */ \"IdxGE\"            OpHelp(\"key=r[P3@P4]\"),\n    /*  62 */ \"RowSetRead\"       OpHelp(\"r[P3]=rowset(P1)\"),\n    /*  63 */ \"RowSetTest\"       OpHelp(\"if r[P3] in rowset(P1) goto P2\"),\n    /*  64 */ \"Program\"          OpHelp(\"\"),\n    /*  65 */ \"FkIfZero\"         OpHelp(\"if fkctr[P1]==0 goto P2\"),\n    /*  66 */ \"IfPos\"            OpHelp(\"if r[P1]>0 then r[P1]-=P3, goto P2\"),\n    /*  67 */ \"IfNotZero\"        OpHelp(\"if r[P1]!=0 then r[P1]-=P3, goto P2\"),\n    /*  68 */ \"DecrJumpZero\"     OpHelp(\"if (--r[P1])==0 goto P2\"),\n    /*  69 */ \"IncrVacuum\"       OpHelp(\"\"),\n    /*  70 */ \"VNext\"            OpHelp(\"\"),\n    /*  71 */ \"Init\"             OpHelp(\"Start at P2\"),\n    /*  72 */ \"Return\"           OpHelp(\"\"),\n    /*  73 */ \"EndCoroutine\"     OpHelp(\"\"),\n    /*  74 */ \"HaltIfNull\"       OpHelp(\"if r[P3]=null halt\"),\n    /*  75 */ \"Halt\"             OpHelp(\"\"),\n    /*  76 */ \"Integer\"          OpHelp(\"r[P2]=P1\"),\n    /*  77 */ \"Int64\"            OpHelp(\"r[P2]=P4\"),\n    /*  78 */ \"String\"           OpHelp(\"r[P2]='P4' (len=P1)\"),\n    /*  79 */ \"Null\"             OpHelp(\"r[P2..P3]=NULL\"),\n    /*  80 */ \"SoftNull\"         OpHelp(\"r[P1]=NULL\"),\n    /*  81 */ \"Blob\"             OpHelp(\"r[P2]=P4 (len=P1)\"),\n    /*  82 */ \"Variable\"         OpHelp(\"r[P2]=parameter(P1,P4)\"),\n    /*  83 */ \"Move\"             OpHelp(\"r[P2@P3]=r[P1@P3]\"),\n    /*  84 */ \"Copy\"             OpHelp(\"r[P2@P3+1]=r[P1@P3+1]\"),\n    /*  85 */ \"SCopy\"            OpHelp(\"r[P2]=r[P1]\"),\n    /*  86 */ \"IntCopy\"          OpHelp(\"r[P2]=r[P1]\"),\n    /*  87 */ \"ResultRow\"        OpHelp(\"output=r[P1@P2]\"),\n    /*  88 */ \"CollSeq\"          OpHelp(\"\"),\n    /*  89 */ \"Function0\"        OpHelp(\"r[P3]=func(r[P2@P5])\"),\n    /*  90 */ \"Function\"         OpHelp(\"r[P3]=func(r[P2@P5])\"),\n    /*  91 */ \"AddImm\"           OpHelp(\"r[P1]=r[P1]+P2\"),\n    /*  92 */ \"RealAffinity\"     OpHelp(\"\"),\n    /*  93 */ \"Cast\"             OpHelp(\"affinity(r[P1])\"),\n    /*  94 */ \"Permutation\"      OpHelp(\"\"),\n    /*  95 */ \"Compare\"          OpHelp(\"r[P1@P3] <-> r[P2@P3]\"),\n    /*  96 */ \"Column\"           OpHelp(\"r[P3]=PX\"),\n    /*  97 */ \"String8\"          OpHelp(\"r[P2]='P4'\"),\n    /*  98 */ \"Affinity\"         OpHelp(\"affinity(r[P1@P2])\"),\n    /*  99 */ \"MakeRecord\"       OpHelp(\"r[P3]=mkrec(r[P1@P2])\"),\n    /* 100 */ \"Count\"            OpHelp(\"r[P2]=count()\"),\n    /* 101 */ \"ReadCookie\"       OpHelp(\"\"),\n    /* 102 */ \"SetCookie\"        OpHelp(\"\"),\n    /* 103 */ \"ReopenIdx\"        OpHelp(\"root=P2 iDb=P3\"),\n    /* 104 */ \"OpenRead\"         OpHelp(\"root=P2 iDb=P3\"),\n    /* 105 */ \"OpenWrite\"        OpHelp(\"root=P2 iDb=P3\"),\n    /* 106 */ \"OpenAutoindex\"    OpHelp(\"nColumn=P2\"),\n    /* 107 */ \"OpenEphemeral\"    OpHelp(\"nColumn=P2\"),\n    /* 108 */ \"SorterOpen\"       OpHelp(\"\"),\n    /* 109 */ \"SequenceTest\"     OpHelp(\"if( cursor[P1].ctr++ ) pc = P2\"),\n    /* 110 */ \"OpenPseudo\"       OpHelp(\"P3 columns in r[P2]\"),\n    /* 111 */ \"Close\"            OpHelp(\"\"),\n    /* 112 */ \"ColumnsUsed\"      OpHelp(\"\"),\n    /* 113 */ \"Sequence\"         OpHelp(\"r[P2]=cursor[P1].ctr++\"),\n    /* 114 */ \"NewRowid\"         OpHelp(\"r[P2]=rowid\"),\n    /* 115 */ \"Insert\"           OpHelp(\"intkey=r[P3] data=r[P2]\"),\n    /* 116 */ \"InsertInt\"        OpHelp(\"intkey=P3 data=r[P2]\"),\n    /* 117 */ \"Delete\"           OpHelp(\"\"),\n    /* 118 */ \"ResetCount\"       OpHelp(\"\"),\n    /* 119 */ \"SorterCompare\"    OpHelp(\"if key(P1)!=trim(r[P3],P4) goto P2\"),\n    /* 120 */ \"SorterData\"       OpHelp(\"r[P2]=data\"),\n    /* 121 */ \"RowKey\"           OpHelp(\"r[P2]=key\"),\n    /* 122 */ \"RowData\"          OpHelp(\"r[P2]=data\"),\n    /* 123 */ \"Rowid\"            OpHelp(\"r[P2]=rowid\"),\n    /* 124 */ \"NullRow\"          OpHelp(\"\"),\n    /* 125 */ \"SorterInsert\"     OpHelp(\"\"),\n    /* 126 */ \"IdxInsert\"        OpHelp(\"key=r[P2]\"),\n    /* 127 */ \"IdxDelete\"        OpHelp(\"key=r[P2@P3]\"),\n    /* 128 */ \"Seek\"             OpHelp(\"Move P3 to P1.rowid\"),\n    /* 129 */ \"IdxRowid\"         OpHelp(\"r[P2]=rowid\"),\n    /* 130 */ \"Destroy\"          OpHelp(\"\"),\n    /* 131 */ \"Clear\"            OpHelp(\"\"),\n    /* 132 */ \"Real\"             OpHelp(\"r[P2]=P4\"),\n    /* 133 */ \"ResetSorter\"      OpHelp(\"\"),\n    /* 134 */ \"CreateIndex\"      OpHelp(\"r[P2]=root iDb=P1\"),\n    /* 135 */ \"CreateTable\"      OpHelp(\"r[P2]=root iDb=P1\"),\n    /* 136 */ \"ParseSchema\"      OpHelp(\"\"),\n    /* 137 */ \"LoadAnalysis\"     OpHelp(\"\"),\n    /* 138 */ \"DropTable\"        OpHelp(\"\"),\n    /* 139 */ \"DropIndex\"        OpHelp(\"\"),\n    /* 140 */ \"DropTrigger\"      OpHelp(\"\"),\n    /* 141 */ \"IntegrityCk\"      OpHelp(\"\"),\n    /* 142 */ \"RowSetAdd\"        OpHelp(\"rowset(P1)=r[P2]\"),\n    /* 143 */ \"Param\"            OpHelp(\"\"),\n    /* 144 */ \"FkCounter\"        OpHelp(\"fkctr[P1]+=P2\"),\n    /* 145 */ \"MemMax\"           OpHelp(\"r[P1]=max(r[P1],r[P2])\"),\n    /* 146 */ \"OffsetLimit\"      OpHelp(\"if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)\"),\n    /* 147 */ \"AggStep0\"         OpHelp(\"accum=r[P3] step(r[P2@P5])\"),\n    /* 148 */ \"AggStep\"          OpHelp(\"accum=r[P3] step(r[P2@P5])\"),\n    /* 149 */ \"AggFinal\"         OpHelp(\"accum=r[P1] N=P2\"),\n    /* 150 */ \"Expire\"           OpHelp(\"\"),\n    /* 151 */ \"TableLock\"        OpHelp(\"iDb=P1 root=P2 write=P3\"),\n    /* 152 */ \"VBegin\"           OpHelp(\"\"),\n    /* 153 */ \"VCreate\"          OpHelp(\"\"),\n    /* 154 */ \"VDestroy\"         OpHelp(\"\"),\n    /* 155 */ \"VOpen\"            OpHelp(\"\"),\n    /* 156 */ \"VColumn\"          OpHelp(\"r[P3]=vcolumn(P2)\"),\n    /* 157 */ \"VRename\"          OpHelp(\"\"),\n    /* 158 */ \"Pagecount\"        OpHelp(\"\"),\n    /* 159 */ \"MaxPgcnt\"         OpHelp(\"\"),\n    /* 160 */ \"CursorHint\"       OpHelp(\"\"),\n    /* 161 */ \"Noop\"             OpHelp(\"\"),\n    /* 162 */ \"Explain\"          OpHelp(\"\"),\n  };\n  return azName[i];\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/opcodes.h",
    "content": "/* Automatically generated.  Do not edit */\n/* See the tool/mkopcodeh.tcl script for details */\n#define OP_Savepoint       0\n#define OP_AutoCommit      1\n#define OP_Transaction     2\n#define OP_SorterNext      3\n#define OP_PrevIfOpen      4\n#define OP_NextIfOpen      5\n#define OP_Prev            6\n#define OP_Next            7\n#define OP_Checkpoint      8\n#define OP_JournalMode     9\n#define OP_Vacuum         10\n#define OP_VFilter        11 /* synopsis: iplan=r[P3] zplan='P4'           */\n#define OP_VUpdate        12 /* synopsis: data=r[P3@P2]                    */\n#define OP_Goto           13\n#define OP_Gosub          14\n#define OP_InitCoroutine  15\n#define OP_Yield          16\n#define OP_MustBeInt      17\n#define OP_Jump           18\n#define OP_Not            19 /* same as TK_NOT, synopsis: r[P2]= !r[P1]    */\n#define OP_Once           20\n#define OP_If             21\n#define OP_IfNot          22\n#define OP_SeekLT         23 /* synopsis: key=r[P3@P4]                     */\n#define OP_SeekLE         24 /* synopsis: key=r[P3@P4]                     */\n#define OP_SeekGE         25 /* synopsis: key=r[P3@P4]                     */\n#define OP_SeekGT         26 /* synopsis: key=r[P3@P4]                     */\n#define OP_Or             27 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */\n#define OP_And            28 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */\n#define OP_NoConflict     29 /* synopsis: key=r[P3@P4]                     */\n#define OP_NotFound       30 /* synopsis: key=r[P3@P4]                     */\n#define OP_Found          31 /* synopsis: key=r[P3@P4]                     */\n#define OP_SeekRowid      32 /* synopsis: intkey=r[P3]                     */\n#define OP_NotExists      33 /* synopsis: intkey=r[P3]                     */\n#define OP_IsNull         34 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */\n#define OP_NotNull        35 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */\n#define OP_Ne             36 /* same as TK_NE, synopsis: IF r[P3]!=r[P1]   */\n#define OP_Eq             37 /* same as TK_EQ, synopsis: IF r[P3]==r[P1]   */\n#define OP_Gt             38 /* same as TK_GT, synopsis: IF r[P3]>r[P1]    */\n#define OP_Le             39 /* same as TK_LE, synopsis: IF r[P3]<=r[P1]   */\n#define OP_Lt             40 /* same as TK_LT, synopsis: IF r[P3]<r[P1]    */\n#define OP_Ge             41 /* same as TK_GE, synopsis: IF r[P3]>=r[P1]   */\n#define OP_ElseNotEq      42 /* same as TK_ESCAPE                          */\n#define OP_BitAnd         43 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */\n#define OP_BitOr          44 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */\n#define OP_ShiftLeft      45 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */\n#define OP_ShiftRight     46 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */\n#define OP_Add            47 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */\n#define OP_Subtract       48 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */\n#define OP_Multiply       49 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */\n#define OP_Divide         50 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */\n#define OP_Remainder      51 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */\n#define OP_Concat         52 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */\n#define OP_Last           53\n#define OP_BitNot         54 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */\n#define OP_SorterSort     55\n#define OP_Sort           56\n#define OP_Rewind         57\n#define OP_IdxLE          58 /* synopsis: key=r[P3@P4]                     */\n#define OP_IdxGT          59 /* synopsis: key=r[P3@P4]                     */\n#define OP_IdxLT          60 /* synopsis: key=r[P3@P4]                     */\n#define OP_IdxGE          61 /* synopsis: key=r[P3@P4]                     */\n#define OP_RowSetRead     62 /* synopsis: r[P3]=rowset(P1)                 */\n#define OP_RowSetTest     63 /* synopsis: if r[P3] in rowset(P1) goto P2   */\n#define OP_Program        64\n#define OP_FkIfZero       65 /* synopsis: if fkctr[P1]==0 goto P2          */\n#define OP_IfPos          66 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */\n#define OP_IfNotZero      67 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */\n#define OP_DecrJumpZero   68 /* synopsis: if (--r[P1])==0 goto P2          */\n#define OP_IncrVacuum     69\n#define OP_VNext          70\n#define OP_Init           71 /* synopsis: Start at P2                      */\n#define OP_Return         72\n#define OP_EndCoroutine   73\n#define OP_HaltIfNull     74 /* synopsis: if r[P3]=null halt               */\n#define OP_Halt           75\n#define OP_Integer        76 /* synopsis: r[P2]=P1                         */\n#define OP_Int64          77 /* synopsis: r[P2]=P4                         */\n#define OP_String         78 /* synopsis: r[P2]='P4' (len=P1)              */\n#define OP_Null           79 /* synopsis: r[P2..P3]=NULL                   */\n#define OP_SoftNull       80 /* synopsis: r[P1]=NULL                       */\n#define OP_Blob           81 /* synopsis: r[P2]=P4 (len=P1)                */\n#define OP_Variable       82 /* synopsis: r[P2]=parameter(P1,P4)           */\n#define OP_Move           83 /* synopsis: r[P2@P3]=r[P1@P3]                */\n#define OP_Copy           84 /* synopsis: r[P2@P3+1]=r[P1@P3+1]            */\n#define OP_SCopy          85 /* synopsis: r[P2]=r[P1]                      */\n#define OP_IntCopy        86 /* synopsis: r[P2]=r[P1]                      */\n#define OP_ResultRow      87 /* synopsis: output=r[P1@P2]                  */\n#define OP_CollSeq        88\n#define OP_Function0      89 /* synopsis: r[P3]=func(r[P2@P5])             */\n#define OP_Function       90 /* synopsis: r[P3]=func(r[P2@P5])             */\n#define OP_AddImm         91 /* synopsis: r[P1]=r[P1]+P2                   */\n#define OP_RealAffinity   92\n#define OP_Cast           93 /* synopsis: affinity(r[P1])                  */\n#define OP_Permutation    94\n#define OP_Compare        95 /* synopsis: r[P1@P3] <-> r[P2@P3]            */\n#define OP_Column         96 /* synopsis: r[P3]=PX                         */\n#define OP_String8        97 /* same as TK_STRING, synopsis: r[P2]='P4'    */\n#define OP_Affinity       98 /* synopsis: affinity(r[P1@P2])               */\n#define OP_MakeRecord     99 /* synopsis: r[P3]=mkrec(r[P1@P2])            */\n#define OP_Count         100 /* synopsis: r[P2]=count()                    */\n#define OP_ReadCookie    101\n#define OP_SetCookie     102\n#define OP_ReopenIdx     103 /* synopsis: root=P2 iDb=P3                   */\n#define OP_OpenRead      104 /* synopsis: root=P2 iDb=P3                   */\n#define OP_OpenWrite     105 /* synopsis: root=P2 iDb=P3                   */\n#define OP_OpenAutoindex 106 /* synopsis: nColumn=P2                       */\n#define OP_OpenEphemeral 107 /* synopsis: nColumn=P2                       */\n#define OP_SorterOpen    108\n#define OP_SequenceTest  109 /* synopsis: if( cursor[P1].ctr++ ) pc = P2   */\n#define OP_OpenPseudo    110 /* synopsis: P3 columns in r[P2]              */\n#define OP_Close         111\n#define OP_ColumnsUsed   112\n#define OP_Sequence      113 /* synopsis: r[P2]=cursor[P1].ctr++           */\n#define OP_NewRowid      114 /* synopsis: r[P2]=rowid                      */\n#define OP_Insert        115 /* synopsis: intkey=r[P3] data=r[P2]          */\n#define OP_InsertInt     116 /* synopsis: intkey=P3 data=r[P2]             */\n#define OP_Delete        117\n#define OP_ResetCount    118\n#define OP_SorterCompare 119 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */\n#define OP_SorterData    120 /* synopsis: r[P2]=data                       */\n#define OP_RowKey        121 /* synopsis: r[P2]=key                        */\n#define OP_RowData       122 /* synopsis: r[P2]=data                       */\n#define OP_Rowid         123 /* synopsis: r[P2]=rowid                      */\n#define OP_NullRow       124\n#define OP_SorterInsert  125\n#define OP_IdxInsert     126 /* synopsis: key=r[P2]                        */\n#define OP_IdxDelete     127 /* synopsis: key=r[P2@P3]                     */\n#define OP_Seek          128 /* synopsis: Move P3 to P1.rowid              */\n#define OP_IdxRowid      129 /* synopsis: r[P2]=rowid                      */\n#define OP_Destroy       130\n#define OP_Clear         131\n#define OP_Real          132 /* same as TK_FLOAT, synopsis: r[P2]=P4       */\n#define OP_ResetSorter   133\n#define OP_CreateIndex   134 /* synopsis: r[P2]=root iDb=P1                */\n#define OP_CreateTable   135 /* synopsis: r[P2]=root iDb=P1                */\n#define OP_ParseSchema   136\n#define OP_LoadAnalysis  137\n#define OP_DropTable     138\n#define OP_DropIndex     139\n#define OP_DropTrigger   140\n#define OP_IntegrityCk   141\n#define OP_RowSetAdd     142 /* synopsis: rowset(P1)=r[P2]                 */\n#define OP_Param         143\n#define OP_FkCounter     144 /* synopsis: fkctr[P1]+=P2                    */\n#define OP_MemMax        145 /* synopsis: r[P1]=max(r[P1],r[P2])           */\n#define OP_OffsetLimit   146 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */\n#define OP_AggStep0      147 /* synopsis: accum=r[P3] step(r[P2@P5])       */\n#define OP_AggStep       148 /* synopsis: accum=r[P3] step(r[P2@P5])       */\n#define OP_AggFinal      149 /* synopsis: accum=r[P1] N=P2                 */\n#define OP_Expire        150\n#define OP_TableLock     151 /* synopsis: iDb=P1 root=P2 write=P3          */\n#define OP_VBegin        152\n#define OP_VCreate       153\n#define OP_VDestroy      154\n#define OP_VOpen         155\n#define OP_VColumn       156 /* synopsis: r[P3]=vcolumn(P2)                */\n#define OP_VRename       157\n#define OP_Pagecount     158\n#define OP_MaxPgcnt      159\n#define OP_CursorHint    160\n#define OP_Noop          161\n#define OP_Explain       162\n\n/* Properties such as \"out2\" or \"jump\" that are specified in\n** comments following the \"case\" for each opcode in the vdbe.c\n** are encoded into bitvectors as follows:\n*/\n#define OPFLG_JUMP        0x01  /* jump:  P2 holds jmp target */\n#define OPFLG_IN1         0x02  /* in1:   P1 is an input */\n#define OPFLG_IN2         0x04  /* in2:   P2 is an input */\n#define OPFLG_IN3         0x08  /* in3:   P3 is an input */\n#define OPFLG_OUT2        0x10  /* out2:  P2 is an output */\n#define OPFLG_OUT3        0x20  /* out3:  P3 is an output */\n#define OPFLG_INITIALIZER {\\\n/*   0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,\\\n/*   8 */ 0x00, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01,\\\n/*  16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\\\n/*  24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\\\n/*  32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\\\n/*  40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\\\n/*  48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\\\n/*  56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b,\\\n/*  64 */ 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01,\\\n/*  72 */ 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10,\\\n/*  80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00,\\\n/*  88 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\\\n/*  96 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\\\n/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\\\n/* 112 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\\\n/* 120 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00,\\\n/* 128 */ 0x00, 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10,\\\n/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,\\\n/* 144 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\\\n/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\\\n/* 160 */ 0x00, 0x00, 0x00,}\n\n/* The sqlite3P2Values() routine is able to run faster if it knows\n** the value of the largest JUMP opcode.  The smaller the maximum\n** JUMP opcode the better, so the mkopcodeh.tcl script that\n** generated this include file strives to group all JUMP opcodes\n** together near the beginning of the list.\n*/\n#define SQLITE_MX_JUMP_OPCODE  71  /* Maximum JUMP opcode */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/parse.c",
    "content": "/*\n** 2000-05-29\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Driver template for the LEMON parser generator.\n**\n** The \"lemon\" program processes an LALR(1) input grammar file, then uses\n** this template to construct a parser.  The \"lemon\" program inserts text\n** at each \"%%\" line.  Also, any \"P-a-r-s-e\" identifer prefix (without the\n** interstitial \"-\" characters) contained in this template is changed into\n** the value of the %name directive from the grammar.  Otherwise, the content\n** of this template is copied straight through into the generate parser\n** source file.\n**\n** The following is the concatenation of all %include directives from the\n** input grammar file:\n*/\n#include <stdio.h>\n/************ Begin %include sections from the grammar ************************/\n#line 48 \"parse.y\"\n\n#include \"sqliteInt.h\"\n\n/*\n** Disable all error recovery processing in the parser push-down\n** automaton.\n*/\n#define YYNOERRORRECOVERY 1\n\n/*\n** Make yytestcase() the same as testcase()\n*/\n#define yytestcase(X) testcase(X)\n\n/*\n** Indicate that sqlite3ParserFree() will never be called with a null\n** pointer.\n*/\n#define YYPARSEFREENEVERNULL 1\n\n/*\n** Alternative datatype for the argument to the malloc() routine passed\n** into sqlite3ParserAlloc().  The default is size_t.\n*/\n#define YYMALLOCARGTYPE  u64\n\n/*\n** An instance of this structure holds information about the\n** LIMIT clause of a SELECT statement.\n*/\nstruct LimitVal {\n  Expr *pLimit;    /* The LIMIT expression.  NULL if there is no limit */\n  Expr *pOffset;   /* The OFFSET expression.  NULL if there is none */\n};\n\n/*\n** An instance of the following structure describes the event of a\n** TRIGGER.  \"a\" is the event type, one of TK_UPDATE, TK_INSERT,\n** TK_DELETE, or TK_INSTEAD.  If the event is of the form\n**\n**      UPDATE ON (a,b,c)\n**\n** Then the \"b\" IdList records the list \"a,b,c\".\n*/\nstruct TrigEvent { int a; IdList * b; };\n\n/*\n** Disable lookaside memory allocation for objects that might be\n** shared across database connections.\n*/\nstatic void disableLookaside(Parse *pParse){\n  pParse->disableLookaside++;\n  pParse->db->lookaside.bDisable++;\n}\n\n#line 402 \"parse.y\"\n\n  /*\n  ** For a compound SELECT statement, make sure p->pPrior->pNext==p for\n  ** all elements in the list.  And make sure list length does not exceed\n  ** SQLITE_LIMIT_COMPOUND_SELECT.\n  */\n  static void parserDoubleLinkSelect(Parse *pParse, Select *p){\n    if( p->pPrior ){\n      Select *pNext = 0, *pLoop;\n      int mxSelect, cnt = 0;\n      for(pLoop=p; pLoop; pNext=pLoop, pLoop=pLoop->pPrior, cnt++){\n        pLoop->pNext = pNext;\n        pLoop->selFlags |= SF_Compound;\n      }\n      if( (p->selFlags & SF_MultiValue)==0 && \n        (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 &&\n        cnt>mxSelect\n      ){\n        sqlite3ErrorMsg(pParse, \"too many terms in compound SELECT\");\n      }\n    }\n  }\n#line 825 \"parse.y\"\n\n  /* This is a utility routine used to set the ExprSpan.zStart and\n  ** ExprSpan.zEnd values of pOut so that the span covers the complete\n  ** range of text beginning with pStart and going to the end of pEnd.\n  */\n  static void spanSet(ExprSpan *pOut, Token *pStart, Token *pEnd){\n    pOut->zStart = pStart->z;\n    pOut->zEnd = &pEnd->z[pEnd->n];\n  }\n\n  /* Construct a new Expr object from a single identifier.  Use the\n  ** new Expr to populate pOut.  Set the span of pOut to be the identifier\n  ** that created the expression.\n  */\n  static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token t){\n    Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1);\n    if( p ){\n      memset(p, 0, sizeof(Expr));\n      p->op = (u8)op;\n      p->flags = EP_Leaf;\n      p->iAgg = -1;\n      p->u.zToken = (char*)&p[1];\n      memcpy(p->u.zToken, t.z, t.n);\n      p->u.zToken[t.n] = 0;\n      if( sqlite3Isquote(p->u.zToken[0]) ){\n        if( p->u.zToken[0]=='\"' ) p->flags |= EP_DblQuoted;\n        sqlite3Dequote(p->u.zToken);\n      }\n#if SQLITE_MAX_EXPR_DEPTH>0\n      p->nHeight = 1;\n#endif  \n    }\n    pOut->pExpr = p;\n    pOut->zStart = t.z;\n    pOut->zEnd = &t.z[t.n];\n  }\n#line 941 \"parse.y\"\n\n  /* This routine constructs a binary expression node out of two ExprSpan\n  ** objects and uses the result to populate a new ExprSpan object.\n  */\n  static void spanBinaryExpr(\n    Parse *pParse,      /* The parsing context.  Errors accumulate here */\n    int op,             /* The binary operation */\n    ExprSpan *pLeft,    /* The left operand, and output */\n    ExprSpan *pRight    /* The right operand */\n  ){\n    pLeft->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0);\n    pLeft->zEnd = pRight->zEnd;\n  }\n\n  /* If doNot is true, then add a TK_NOT Expr-node wrapper around the\n  ** outside of *ppExpr.\n  */\n  static void exprNot(Parse *pParse, int doNot, ExprSpan *pSpan){\n    if( doNot ){\n      pSpan->pExpr = sqlite3PExpr(pParse, TK_NOT, pSpan->pExpr, 0, 0);\n    }\n  }\n#line 1015 \"parse.y\"\n\n  /* Construct an expression node for a unary postfix operator\n  */\n  static void spanUnaryPostfix(\n    Parse *pParse,         /* Parsing context to record errors */\n    int op,                /* The operator */\n    ExprSpan *pOperand,    /* The operand, and output */\n    Token *pPostOp         /* The operand token for setting the span */\n  ){\n    pOperand->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);\n    pOperand->zEnd = &pPostOp->z[pPostOp->n];\n  }                           \n#line 1032 \"parse.y\"\n\n  /* A routine to convert a binary TK_IS or TK_ISNOT expression into a\n  ** unary TK_ISNULL or TK_NOTNULL expression. */\n  static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){\n    sqlite3 *db = pParse->db;\n    if( pA && pY && pY->op==TK_NULL ){\n      pA->op = (u8)op;\n      sqlite3ExprDelete(db, pA->pRight);\n      pA->pRight = 0;\n    }\n  }\n#line 1060 \"parse.y\"\n\n  /* Construct an expression node for a unary prefix operator\n  */\n  static void spanUnaryPrefix(\n    ExprSpan *pOut,        /* Write the new expression node here */\n    Parse *pParse,         /* Parsing context to record errors */\n    int op,                /* The operator */\n    ExprSpan *pOperand,    /* The operand */\n    Token *pPreOp         /* The operand token for setting the span */\n  ){\n    pOut->zStart = pPreOp->z;\n    pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0);\n    pOut->zEnd = pOperand->zEnd;\n  }\n#line 1272 \"parse.y\"\n\n  /* Add a single new term to an ExprList that is used to store a\n  ** list of identifiers.  Report an error if the ID list contains\n  ** a COLLATE clause or an ASC or DESC keyword, except ignore the\n  ** error while parsing a legacy schema.\n  */\n  static ExprList *parserAddExprIdListTerm(\n    Parse *pParse,\n    ExprList *pPrior,\n    Token *pIdToken,\n    int hasCollate,\n    int sortOrder\n  ){\n    ExprList *p = sqlite3ExprListAppend(pParse, pPrior, 0);\n    if( (hasCollate || sortOrder!=SQLITE_SO_UNDEFINED)\n        && pParse->db->init.busy==0\n    ){\n      sqlite3ErrorMsg(pParse, \"syntax error after column name \\\"%.*s\\\"\",\n                         pIdToken->n, pIdToken->z);\n    }\n    sqlite3ExprListSetName(pParse, p, pIdToken, 1);\n    return p;\n  }\n#line 231 \"parse.c\"\n/**************** End of %include directives **********************************/\n/* These constants specify the various numeric values for terminal symbols\n** in a format understandable to \"makeheaders\".  This section is blank unless\n** \"lemon\" is run with the \"-m\" command-line option.\n***************** Begin makeheaders token definitions *************************/\n/**************** End makeheaders token definitions ***************************/\n\n/* The next sections is a series of control #defines.\n** various aspects of the generated parser.\n**    YYCODETYPE         is the data type used to store the integer codes\n**                       that represent terminal and non-terminal symbols.\n**                       \"unsigned char\" is used if there are fewer than\n**                       256 symbols.  Larger types otherwise.\n**    YYNOCODE           is a number of type YYCODETYPE that is not used for\n**                       any terminal or nonterminal symbol.\n**    YYFALLBACK         If defined, this indicates that one or more tokens\n**                       (also known as: \"terminal symbols\") have fall-back\n**                       values which should be used if the original symbol\n**                       would not parse.  This permits keywords to sometimes\n**                       be used as identifiers, for example.\n**    YYACTIONTYPE       is the data type used for \"action codes\" - numbers\n**                       that indicate what to do in response to the next\n**                       token.\n**    sqlite3ParserTOKENTYPE     is the data type used for minor type for terminal\n**                       symbols.  Background: A \"minor type\" is a semantic\n**                       value associated with a terminal or non-terminal\n**                       symbols.  For example, for an \"ID\" terminal symbol,\n**                       the minor type might be the name of the identifier.\n**                       Each non-terminal can have a different minor type.\n**                       Terminal symbols all have the same minor type, though.\n**                       This macros defines the minor type for terminal \n**                       symbols.\n**    YYMINORTYPE        is the data type used for all minor types.\n**                       This is typically a union of many types, one of\n**                       which is sqlite3ParserTOKENTYPE.  The entry in the union\n**                       for terminal symbols is called \"yy0\".\n**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If\n**                       zero the stack is dynamically sized using realloc()\n**    sqlite3ParserARG_SDECL     A static variable declaration for the %extra_argument\n**    sqlite3ParserARG_PDECL     A parameter declaration for the %extra_argument\n**    sqlite3ParserARG_STORE     Code to store %extra_argument into yypParser\n**    sqlite3ParserARG_FETCH     Code to extract %extra_argument from yypParser\n**    YYERRORSYMBOL      is the code number of the error symbol.  If not\n**                       defined, then do no error processing.\n**    YYNSTATE           the combined number of states.\n**    YYNRULE            the number of rules in the grammar\n**    YY_MAX_SHIFT       Maximum value for shift actions\n**    YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions\n**    YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions\n**    YY_MIN_REDUCE      Maximum value for reduce actions\n**    YY_ERROR_ACTION    The yy_action[] code for syntax error\n**    YY_ACCEPT_ACTION   The yy_action[] code for accept\n**    YY_NO_ACTION       The yy_action[] code for no-op\n*/\n#ifndef INTERFACE\n# define INTERFACE 1\n#endif\n/************* Begin control #defines *****************************************/\n#define YYCODETYPE unsigned char\n#define YYNOCODE 252\n#define YYACTIONTYPE unsigned short int\n#define YYWILDCARD 96\n#define sqlite3ParserTOKENTYPE Token\ntypedef union {\n  int yyinit;\n  sqlite3ParserTOKENTYPE yy0;\n  Expr* yy72;\n  TriggerStep* yy145;\n  ExprList* yy148;\n  SrcList* yy185;\n  ExprSpan yy190;\n  int yy194;\n  Select* yy243;\n  IdList* yy254;\n  With* yy285;\n  struct TrigEvent yy332;\n  struct LimitVal yy354;\n  struct {int value; int mask;} yy497;\n} YYMINORTYPE;\n#ifndef YYSTACKDEPTH\n#define YYSTACKDEPTH 100\n#endif\n#define sqlite3ParserARG_SDECL Parse *pParse;\n#define sqlite3ParserARG_PDECL ,Parse *pParse\n#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse\n#define sqlite3ParserARG_STORE yypParser->pParse = pParse\n#define YYFALLBACK 1\n#define YYNSTATE             460\n#define YYNRULE              332\n#define YY_MAX_SHIFT         459\n#define YY_MIN_SHIFTREDUCE   672\n#define YY_MAX_SHIFTREDUCE   1003\n#define YY_MIN_REDUCE        1004\n#define YY_MAX_REDUCE        1335\n#define YY_ERROR_ACTION      1336\n#define YY_ACCEPT_ACTION     1337\n#define YY_NO_ACTION         1338\n/************* End control #defines *******************************************/\n\n/* Define the yytestcase() macro to be a no-op if is not already defined\n** otherwise.\n**\n** Applications can choose to define yytestcase() in the %include section\n** to a macro that can assist in verifying code coverage.  For production\n** code the yytestcase() macro should be turned off.  But it is useful\n** for testing.\n*/\n#ifndef yytestcase\n# define yytestcase(X)\n#endif\n\n\n/* Next are the tables used to determine what action to take based on the\n** current state and lookahead token.  These tables are used to implement\n** functions that take a state number and lookahead value and return an\n** action integer.  \n**\n** Suppose the action integer is N.  Then the action is determined as\n** follows\n**\n**   0 <= N <= YY_MAX_SHIFT             Shift N.  That is, push the lookahead\n**                                      token onto the stack and goto state N.\n**\n**   N between YY_MIN_SHIFTREDUCE       Shift to an arbitrary state then\n**     and YY_MAX_SHIFTREDUCE           reduce by rule N-YY_MIN_SHIFTREDUCE.\n**\n**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE\n**     and YY_MAX_REDUCE\n**\n**   N == YY_ERROR_ACTION               A syntax error has occurred.\n**\n**   N == YY_ACCEPT_ACTION              The parser accepts its input.\n**\n**   N == YY_NO_ACTION                  No such action.  Denotes unused\n**                                      slots in the yy_action[] table.\n**\n** The action table is constructed as a single large table named yy_action[].\n** Given state S and lookahead X, the action is computed as either:\n**\n**    (A)   N = yy_action[ yy_shift_ofst[S] + X ]\n**    (B)   N = yy_default[S]\n**\n** The (A) formula is preferred.  The B formula is used instead if:\n**    (1)  The yy_shift_ofst[S]+X value is out of range, or\n**    (2)  yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or\n**    (3)  yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT.\n** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that\n** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X.\n** Hence only tests (1) and (2) need to be evaluated.)\n**\n** The formulas above are for computing the action when the lookahead is\n** a terminal symbol.  If the lookahead is a non-terminal (as occurs after\n** a reduce action) then the yy_reduce_ofst[] array is used in place of\n** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of\n** YY_SHIFT_USE_DFLT.\n**\n** The following are the tables generated in this section:\n**\n**  yy_action[]        A single table containing all actions.\n**  yy_lookahead[]     A table containing the lookahead for each entry in\n**                     yy_action.  Used to detect hash collisions.\n**  yy_shift_ofst[]    For each state, the offset into yy_action for\n**                     shifting terminals.\n**  yy_reduce_ofst[]   For each state, the offset into yy_action for\n**                     shifting non-terminals after a reduce.\n**  yy_default[]       Default action for each state.\n**\n*********** Begin parsing tables **********************************************/\n#define YY_ACTTAB_COUNT (1570)\nstatic const YYACTIONTYPE yy_action[] = {\n /*     0 */   329,  836,  355,  829,    5,  203,  203,  823,   99,  100,\n /*    10 */    90,  846,  846,  858,  861,  850,  850,   97,   97,   98,\n /*    20 */    98,   98,   98,  305,   96,   96,   96,   96,   95,   95,\n /*    30 */    94,   94,   94,   93,  355,  329,  981,  981,  828,  828,\n /*    40 */   830,  951,  358,   99,  100,   90,  846,  846,  858,  861,\n /*    50 */   850,  850,   97,   97,   98,   98,   98,   98,  342,   96,\n /*    60 */    96,   96,   96,   95,   95,   94,   94,   94,   93,  355,\n /*    70 */    95,   95,   94,   94,   94,   93,  355,  795,  981,  981,\n /*    80 */   329,   94,   94,   94,   93,  355,  796,   75,   99,  100,\n /*    90 */    90,  846,  846,  858,  861,  850,  850,   97,   97,   98,\n /*   100 */    98,   98,   98,  454,   96,   96,   96,   96,   95,   95,\n /*   110 */    94,   94,   94,   93,  355, 1337,  155,  155,    2,  329,\n /*   120 */   279,  146,  132,   52,   52,   93,  355,   99,  100,   90,\n /*   130 */   846,  846,  858,  861,  850,  850,   97,   97,   98,   98,\n /*   140 */    98,   98,  101,   96,   96,   96,   96,   95,   95,   94,\n /*   150 */    94,   94,   93,  355,  962,  962,  329,  272,  432,  417,\n /*   160 */   415,   61,  756,  756,   99,  100,   90,  846,  846,  858,\n /*   170 */   861,  850,  850,   97,   97,   98,   98,   98,   98,   60,\n /*   180 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,\n /*   190 */   355,  329,  274,  333,  277,  281,  963,  964,  250,   99,\n /*   200 */   100,   90,  846,  846,  858,  861,  850,  850,   97,   97,\n /*   210 */    98,   98,   98,   98,  305,   96,   96,   96,   96,   95,\n /*   220 */    95,   94,   94,   94,   93,  355,  329,  942, 1330,  702,\n /*   230 */   710, 1330,  242,  416,   99,  100,   90,  846,  846,  858,\n /*   240 */   861,  850,  850,   97,   97,   98,   98,   98,   98,  351,\n /*   250 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,\n /*   260 */   355,  329,  942, 1331,  388,  703, 1331,  385,  383,   99,\n /*   270 */   100,   90,  846,  846,  858,  861,  850,  850,   97,   97,\n /*   280 */    98,   98,   98,   98,  705,   96,   96,   96,   96,   95,\n /*   290 */    95,   94,   94,   94,   93,  355,  329,   92,   89,  178,\n /*   300 */   837,  940,  377,  704,   99,  100,   90,  846,  846,  858,\n /*   310 */   861,  850,  850,   97,   97,   98,   98,   98,   98,  379,\n /*   320 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,\n /*   330 */   355,  329, 1280,  951,  358,  822,  940,  743,  743,   99,\n /*   340 */   100,   90,  846,  846,  858,  861,  850,  850,   97,   97,\n /*   350 */    98,   98,   98,   98,  230,   96,   96,   96,   96,   95,\n /*   360 */    95,   94,   94,   94,   93,  355,  329,  973,  227,   92,\n /*   370 */    89,  178,  377,  304,   99,  100,   90,  846,  846,  858,\n /*   380 */   861,  850,  850,   97,   97,   98,   98,   98,   98,  925,\n /*   390 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,\n /*   400 */   355,  329,  453,  451,  451,  451,  147,  741,  741,   99,\n /*   410 */   100,   90,  846,  846,  858,  861,  850,  850,   97,   97,\n /*   420 */    98,   98,   98,   98,  300,   96,   96,   96,   96,   95,\n /*   430 */    95,   94,   94,   94,   93,  355,  329,  423,  231,  962,\n /*   440 */   962,  158,   25,  426,   99,  100,   90,  846,  846,  858,\n /*   450 */   861,  850,  850,   97,   97,   98,   98,   98,   98,  454,\n /*   460 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,\n /*   470 */   355,  447,  224,  224,  424,  962,  962,  966,  329,   52,\n /*   480 */    52,  963,  964,  176,  419,   78,   99,  100,   90,  846,\n /*   490 */   846,  858,  861,  850,  850,   97,   97,   98,   98,   98,\n /*   500 */    98,  383,   96,   96,   96,   96,   95,   95,   94,   94,\n /*   510 */    94,   93,  355,  329,  432,  422,  302,  963,  964,  966,\n /*   520 */    81,   99,   88,   90,  846,  846,  858,  861,  850,  850,\n /*   530 */    97,   97,   98,   98,   98,   98,  721,   96,   96,   96,\n /*   540 */    96,   95,   95,   94,   94,   94,   93,  355,  329,  847,\n /*   550 */   847,  859,  862, 1000,  322,  347,  383,  100,   90,  846,\n /*   560 */   846,  858,  861,  850,  850,   97,   97,   98,   98,   98,\n /*   570 */    98,  454,   96,   96,   96,   96,   95,   95,   94,   94,\n /*   580 */    94,   93,  355,  329,  354,  354,  354,  264,  381,  344,\n /*   590 */   933,   52,   52,   90,  846,  846,  858,  861,  850,  850,\n /*   600 */    97,   97,   98,   98,   98,   98,  365,   96,   96,   96,\n /*   610 */    96,   95,   95,   94,   94,   94,   93,  355,   86,  449,\n /*   620 */   851,    3, 1207,  365,  364,  382,  348,  817,  962,  962,\n /*   630 */  1304,   86,  449,  733,    3,  212,  169,  291,  409,  286,\n /*   640 */   408,  199,  232,  454,  304,  764,   83,   84,  284,  245,\n /*   650 */   266,  369,  253,   85,  356,  356,   92,   89,  178,   83,\n /*   660 */    84,  242,  416,   52,   52,  452,   85,  356,  356,  246,\n /*   670 */   963,  964,  194,  459,  674,  406,  403,  402,  452,  243,\n /*   680 */   221,  114,  438,  780,  365,  454,  401,  272,  751,  224,\n /*   690 */   224,  132,  132,  198,  836,  438,  456,  455,  432,  431,\n /*   700 */   823,  419,  738,  717,  132,   52,   52,  836,  272,  456,\n /*   710 */   455,  738,  194,  823,  367,  406,  403,  402,  454, 1275,\n /*   720 */  1275,   23,  962,  962,   86,  449,  401,    3,  228,  433,\n /*   730 */   899,  828,  828,  830,  831,   19,  203,  724,   52,   52,\n /*   740 */   432,  412,  443,  249,  828,  828,  830,  831,   19,  229,\n /*   750 */   407,  153,   83,   84,  765,  177,  241,  454,  725,   85,\n /*   760 */   356,  356,  120,  157,  963,  964,   58,  981,  413,  359,\n /*   770 */   334,  452,  272,  432,  434,  324,  794,   32,   32,   86,\n /*   780 */   449,  780,    3,  345,   98,   98,   98,   98,  438,   96,\n /*   790 */    96,   96,   96,   95,   95,   94,   94,   94,   93,  355,\n /*   800 */   836,  120,  456,  455,  817,  891,  823,   83,   84,  981,\n /*   810 */   817,  132,  414,  924,   85,  356,  356,  132,  411,  793,\n /*   820 */   962,  962,   92,   89,  178,  921,  452,  266,  374,  265,\n /*   830 */    82,  918,   80,  266,  374,  265,  780,  828,  828,  830,\n /*   840 */   831,   19,  938,  438,   96,   96,   96,   96,   95,   95,\n /*   850 */    94,   94,   94,   93,  355,  836,   74,  456,  455,  962,\n /*   860 */   962,  823,  963,  964,  120,   92,   89,  178,  949,    2,\n /*   870 */   922,  969,  272,    1,  980,   76,  449,  766,    3,  712,\n /*   880 */   905,  905,  391,  962,  962,  761,  923,  375,  744,  782,\n /*   890 */   760,  261,  828,  828,  830,  831,   19,  421,  745,  454,\n /*   900 */    24,  963,  964,   83,   84,  373,  962,  962,  177,  226,\n /*   910 */    85,  356,  356,  889,  319,  318,  317,  215,  315,   10,\n /*   920 */    10,  687,  452,  353,  352,  963,  964,  913,  781,  157,\n /*   930 */   120,  962,  962,  341,  780,  420,  715,  314,  454,  438,\n /*   940 */   454,  325,  454,  795,  103,  200,  175,  454,  963,  964,\n /*   950 */   912,  836,  796,  456,  455,    9,    9,  823,   10,   10,\n /*   960 */    52,   52,   51,   51,  180,  720,  248,   10,   10,  171,\n /*   970 */   170,  167,  343,  963,  964,  247,  988,  706,  706,  454,\n /*   980 */   719,  233,  690,  986,  893,  987,  182,  918,  828,  828,\n /*   990 */   830,  831,   19,  183,  260,  427,  132,  181,  398,   10,\n /*  1000 */    10,  893,  895,  753,  962,  962,  921,  272,  989,  198,\n /*  1010 */   989,  353,  352,  429,  419,  303,  821,  836,  330,  829,\n /*  1020 */   120,  336,  133,  823,  272,   98,   98,   98,   98,   91,\n /*  1030 */    96,   96,   96,   96,   95,   95,   94,   94,   94,   93,\n /*  1040 */   355,  157,  814,  375,  386,  363,  963,  964,  362,  272,\n /*  1050 */   454,  922,  372,  328,  828,  828,  830,  454,  713,  454,\n /*  1060 */   268,  384,  893,  454,  881,  750,  257,  923,  259,  437,\n /*  1070 */    36,   36,  234,  454,  234,  120,  273,   37,   37,   12,\n /*  1080 */    12,  338,  276,   27,   27,  454,  334,  118,  454,  162,\n /*  1090 */   746,  284,  454,   38,   38,  454,  989,  360,  989,  454,\n /*  1100 */   713, 1214,  454,  132,  454,   39,   39,  454,   40,   40,\n /*  1110 */   454,  366,   41,   41,  454,   42,   42,  454,  258,   28,\n /*  1120 */    28,  454,   29,   29,   31,   31,  454,   43,   43,  454,\n /*  1130 */    44,   44,  454,  718,   45,   45,  454,   11,   11,  771,\n /*  1140 */   454,   46,   46,  454,  272,  454,  105,  105,  454,   47,\n /*  1150 */    47,  454,   48,   48,  454,  237,   33,   33,  454,  172,\n /*  1160 */    49,   49,  454,   50,   50,   34,   34,  278,  122,  122,\n /*  1170 */   454,  123,  123,  454,  124,  124,  454,  902,   56,   56,\n /*  1180 */   454,  901,   35,   35,  454,  271,  454,  821,  454,  821,\n /*  1190 */   106,  106,  454,   53,   53,  389,  107,  107,  454,  821,\n /*  1200 */   108,  108,  821,  454,  104,  104,  121,  121,  119,  119,\n /*  1210 */   454,  117,  112,  112,  454,  280,  454,  225,  111,  111,\n /*  1220 */   454,  734,  454,  109,  109,  454,  677,  678,  679,  916,\n /*  1230 */   110,  110,  321, 1002,   55,   55,   57,   57,  696,  335,\n /*  1240 */    54,   54,   26,   26,  700,   30,   30,  321,  941,  197,\n /*  1250 */   196,  195,  339,  285,  340,  450,  335,  749,  693,  440,\n /*  1260 */   444,  448,  120,   72,  390,  223,  175,  349,  761,  937,\n /*  1270 */    20,  290,  323,  760,  819,  376,  378,  202,  202,  202,\n /*  1280 */   267,  399,  289,   74,  208,   21,  700,  723,  722,  888,\n /*  1290 */   120,  120,  120,  120,  120,  758,  282,  832,   77,   74,\n /*  1300 */   730,  731,  789,  787,  884,  202, 1003,  208,  898,  897,\n /*  1310 */   898,  897,  698,  820,  767,  116,  778, 1294,  435,  436,\n /*  1320 */   306, 1003,  394,  307,  827,  701,  695,  684,  159,  293,\n /*  1330 */   683,  888,  685,  956,  295,  218,  297,    7,  320,  832,\n /*  1340 */   173,  252,  263,  368,  256,  915,  380,  717,  299,  439,\n /*  1350 */   312,  168,  959,  997,  135,  404,  994,  288,  886,  885,\n /*  1360 */   205,  932,  930,   59,  337,   62,  144,  156,  102,  430,\n /*  1370 */   809,   72,  130,  251,  137,  370,  371,  397,  185,  160,\n /*  1380 */   387,  189,   67,  393,  139,  140,  141,  779,  142,  148,\n /*  1390 */   816,  806,  255,  900,  254,  270,  219,  154,  190,  917,\n /*  1400 */   880,  395,  410,  275,  326,  191,  737,  736,  686,  735,\n /*  1410 */   346,  728,  192,  327,  715,  425,    6,   71,  350,   79,\n /*  1420 */   775,  292,  204,  776,  709,  774,  294,  296,  301,  773,\n /*  1430 */   287,  708,  866,  298,  707,  971,  757,  213,  428,  442,\n /*  1440 */   238,  727,  446,   73,  239,  240,  692,   22,  957,  457,\n /*  1450 */   214,  216,  217,  458,  681,  680,  675,  125,  115,  126,\n /*  1460 */   673,  235,  357,  166,  127,  244,  179,  361,  308,  309,\n /*  1470 */   310,  311,  896,  113,  815,  331,  894,  136,  128,  332,\n /*  1480 */   747,  138,  262,  911,  143,  184,  145,   63,  129,   64,\n /*  1490 */   914,   65,   66,  186,  187,  910,    8,   13,  188,  903,\n /*  1500 */   202,  991,  269,  149,  392,  150,  689,  161,  396,  289,\n /*  1510 */   193,  283,  151,  134,   68,  400,  405,   14,   15,  726,\n /*  1520 */    69,  236,  835,  834,  864,  755,  131,   16,   70,  759,\n /*  1530 */     4,  201,  174,  418,  220,  222,  788,  152,  868,  783,\n /*  1540 */    77,   17,   74,   18,  879,  865,  863,  920,  210,  919,\n /*  1550 */   207,  206,  946,  163,  441,  211,  947,  164,  209,  165,\n /*  1560 */   445,  867,  833,  699,   87, 1296, 1295,  313,  316,  952,\n};\nstatic const YYCODETYPE yy_lookahead[] = {\n /*     0 */    19,   95,   53,   97,   22,   24,   24,  101,   27,   28,\n /*    10 */    29,   30,   31,   32,   33,   34,   35,   36,   37,   38,\n /*    20 */    39,   40,   41,  152,   43,   44,   45,   46,   47,   48,\n /*    30 */    49,   50,   51,   52,   53,   19,   55,   55,  132,  133,\n /*    40 */   134,    1,    2,   27,   28,   29,   30,   31,   32,   33,\n /*    50 */    34,   35,   36,   37,   38,   39,   40,   41,  187,   43,\n /*    60 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,\n /*    70 */    47,   48,   49,   50,   51,   52,   53,   61,   97,   97,\n /*    80 */    19,   49,   50,   51,   52,   53,   70,   26,   27,   28,\n /*    90 */    29,   30,   31,   32,   33,   34,   35,   36,   37,   38,\n /*   100 */    39,   40,   41,  152,   43,   44,   45,   46,   47,   48,\n /*   110 */    49,   50,   51,   52,   53,  144,  145,  146,  147,   19,\n /*   120 */    16,   22,   92,  172,  173,   52,   53,   27,   28,   29,\n /*   130 */    30,   31,   32,   33,   34,   35,   36,   37,   38,   39,\n /*   140 */    40,   41,   81,   43,   44,   45,   46,   47,   48,   49,\n /*   150 */    50,   51,   52,   53,   55,   56,   19,  152,  207,  208,\n /*   160 */   115,   24,  117,  118,   27,   28,   29,   30,   31,   32,\n /*   170 */    33,   34,   35,   36,   37,   38,   39,   40,   41,   79,\n /*   180 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,\n /*   190 */    53,   19,   88,  157,   90,   23,   97,   98,  193,   27,\n /*   200 */    28,   29,   30,   31,   32,   33,   34,   35,   36,   37,\n /*   210 */    38,   39,   40,   41,  152,   43,   44,   45,   46,   47,\n /*   220 */    48,   49,   50,   51,   52,   53,   19,   22,   23,  172,\n /*   230 */    23,   26,  119,  120,   27,   28,   29,   30,   31,   32,\n /*   240 */    33,   34,   35,   36,   37,   38,   39,   40,   41,  187,\n /*   250 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,\n /*   260 */    53,   19,   22,   23,  228,   23,   26,  231,  152,   27,\n /*   270 */    28,   29,   30,   31,   32,   33,   34,   35,   36,   37,\n /*   280 */    38,   39,   40,   41,  172,   43,   44,   45,   46,   47,\n /*   290 */    48,   49,   50,   51,   52,   53,   19,  221,  222,  223,\n /*   300 */    23,   96,  152,  172,   27,   28,   29,   30,   31,   32,\n /*   310 */    33,   34,   35,   36,   37,   38,   39,   40,   41,  152,\n /*   320 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,\n /*   330 */    53,   19,    0,    1,    2,   23,   96,  190,  191,   27,\n /*   340 */    28,   29,   30,   31,   32,   33,   34,   35,   36,   37,\n /*   350 */    38,   39,   40,   41,  238,   43,   44,   45,   46,   47,\n /*   360 */    48,   49,   50,   51,   52,   53,   19,  185,  218,  221,\n /*   370 */   222,  223,  152,  152,   27,   28,   29,   30,   31,   32,\n /*   380 */    33,   34,   35,   36,   37,   38,   39,   40,   41,  241,\n /*   390 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,\n /*   400 */    53,   19,  152,  168,  169,  170,   22,  190,  191,   27,\n /*   410 */    28,   29,   30,   31,   32,   33,   34,   35,   36,   37,\n /*   420 */    38,   39,   40,   41,  152,   43,   44,   45,   46,   47,\n /*   430 */    48,   49,   50,   51,   52,   53,   19,   19,  218,   55,\n /*   440 */    56,   24,   22,  152,   27,   28,   29,   30,   31,   32,\n /*   450 */    33,   34,   35,   36,   37,   38,   39,   40,   41,  152,\n /*   460 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,\n /*   470 */    53,  250,  194,  195,   56,   55,   56,   55,   19,  172,\n /*   480 */   173,   97,   98,  152,  206,  138,   27,   28,   29,   30,\n /*   490 */    31,   32,   33,   34,   35,   36,   37,   38,   39,   40,\n /*   500 */    41,  152,   43,   44,   45,   46,   47,   48,   49,   50,\n /*   510 */    51,   52,   53,   19,  207,  208,  152,   97,   98,   97,\n /*   520 */   138,   27,   28,   29,   30,   31,   32,   33,   34,   35,\n /*   530 */    36,   37,   38,   39,   40,   41,  181,   43,   44,   45,\n /*   540 */    46,   47,   48,   49,   50,   51,   52,   53,   19,   30,\n /*   550 */    31,   32,   33,  247,  248,   19,  152,   28,   29,   30,\n /*   560 */    31,   32,   33,   34,   35,   36,   37,   38,   39,   40,\n /*   570 */    41,  152,   43,   44,   45,   46,   47,   48,   49,   50,\n /*   580 */    51,   52,   53,   19,  168,  169,  170,  238,   19,   53,\n /*   590 */   152,  172,  173,   29,   30,   31,   32,   33,   34,   35,\n /*   600 */    36,   37,   38,   39,   40,   41,  152,   43,   44,   45,\n /*   610 */    46,   47,   48,   49,   50,   51,   52,   53,   19,   20,\n /*   620 */   101,   22,   23,  169,  170,   56,  207,   85,   55,   56,\n /*   630 */    23,   19,   20,   26,   22,   99,  100,  101,  102,  103,\n /*   640 */   104,  105,  238,  152,  152,  210,   47,   48,  112,  152,\n /*   650 */   108,  109,  110,   54,   55,   56,  221,  222,  223,   47,\n /*   660 */    48,  119,  120,  172,  173,   66,   54,   55,   56,  152,\n /*   670 */    97,   98,   99,  148,  149,  102,  103,  104,   66,  154,\n /*   680 */    23,  156,   83,   26,  230,  152,  113,  152,  163,  194,\n /*   690 */   195,   92,   92,   30,   95,   83,   97,   98,  207,  208,\n /*   700 */   101,  206,  179,  180,   92,  172,  173,   95,  152,   97,\n /*   710 */    98,  188,   99,  101,  219,  102,  103,  104,  152,  119,\n /*   720 */   120,  196,   55,   56,   19,   20,  113,   22,  193,  163,\n /*   730 */    11,  132,  133,  134,  135,  136,   24,   65,  172,  173,\n /*   740 */   207,  208,  250,  152,  132,  133,  134,  135,  136,  193,\n /*   750 */    78,   84,   47,   48,   49,   98,  199,  152,   86,   54,\n /*   760 */    55,   56,  196,  152,   97,   98,  209,   55,  163,  244,\n /*   770 */   107,   66,  152,  207,  208,  164,  175,  172,  173,   19,\n /*   780 */    20,  124,   22,  111,   38,   39,   40,   41,   83,   43,\n /*   790 */    44,   45,   46,   47,   48,   49,   50,   51,   52,   53,\n /*   800 */    95,  196,   97,   98,   85,  152,  101,   47,   48,   97,\n /*   810 */    85,   92,  207,  193,   54,   55,   56,   92,   49,  175,\n /*   820 */    55,   56,  221,  222,  223,   12,   66,  108,  109,  110,\n /*   830 */   137,  163,  139,  108,  109,  110,   26,  132,  133,  134,\n /*   840 */   135,  136,  152,   83,   43,   44,   45,   46,   47,   48,\n /*   850 */    49,   50,   51,   52,   53,   95,   26,   97,   98,   55,\n /*   860 */    56,  101,   97,   98,  196,  221,  222,  223,  146,  147,\n /*   870 */    57,  171,  152,   22,   26,   19,   20,   49,   22,  179,\n /*   880 */   108,  109,  110,   55,   56,  116,   73,  219,   75,  124,\n /*   890 */   121,  152,  132,  133,  134,  135,  136,  163,   85,  152,\n /*   900 */   232,   97,   98,   47,   48,  237,   55,   56,   98,    5,\n /*   910 */    54,   55,   56,  193,   10,   11,   12,   13,   14,  172,\n /*   920 */   173,   17,   66,   47,   48,   97,   98,  152,  124,  152,\n /*   930 */   196,   55,   56,  186,  124,  152,  106,  160,  152,   83,\n /*   940 */   152,  164,  152,   61,   22,  211,  212,  152,   97,   98,\n /*   950 */   152,   95,   70,   97,   98,  172,  173,  101,  172,  173,\n /*   960 */   172,  173,  172,  173,   60,  181,   62,  172,  173,   47,\n /*   970 */    48,  123,  186,   97,   98,   71,  100,   55,   56,  152,\n /*   980 */   181,  186,   21,  107,  152,  109,   82,  163,  132,  133,\n /*   990 */   134,  135,  136,   89,   16,  207,   92,   93,   19,  172,\n /*  1000 */   173,  169,  170,  195,   55,   56,   12,  152,  132,   30,\n /*  1010 */   134,   47,   48,  186,  206,  225,  152,   95,  114,   97,\n /*  1020 */   196,  245,  246,  101,  152,   38,   39,   40,   41,   42,\n /*  1030 */    43,   44,   45,   46,   47,   48,   49,   50,   51,   52,\n /*  1040 */    53,  152,  163,  219,  152,  141,   97,   98,  193,  152,\n /*  1050 */   152,   57,   91,  164,  132,  133,  134,  152,   55,  152,\n /*  1060 */   152,  237,  230,  152,  103,  193,   88,   73,   90,   75,\n /*  1070 */   172,  173,  183,  152,  185,  196,  152,  172,  173,  172,\n /*  1080 */   173,  217,  152,  172,  173,  152,  107,   22,  152,   24,\n /*  1090 */   193,  112,  152,  172,  173,  152,  132,  242,  134,  152,\n /*  1100 */    97,  140,  152,   92,  152,  172,  173,  152,  172,  173,\n /*  1110 */   152,  100,  172,  173,  152,  172,  173,  152,  140,  172,\n /*  1120 */   173,  152,  172,  173,  172,  173,  152,  172,  173,  152,\n /*  1130 */   172,  173,  152,  152,  172,  173,  152,  172,  173,  213,\n /*  1140 */   152,  172,  173,  152,  152,  152,  172,  173,  152,  172,\n /*  1150 */   173,  152,  172,  173,  152,  210,  172,  173,  152,   26,\n /*  1160 */   172,  173,  152,  172,  173,  172,  173,  152,  172,  173,\n /*  1170 */   152,  172,  173,  152,  172,  173,  152,   59,  172,  173,\n /*  1180 */   152,   63,  172,  173,  152,  193,  152,  152,  152,  152,\n /*  1190 */   172,  173,  152,  172,  173,   77,  172,  173,  152,  152,\n /*  1200 */   172,  173,  152,  152,  172,  173,  172,  173,  172,  173,\n /*  1210 */   152,   22,  172,  173,  152,  152,  152,   22,  172,  173,\n /*  1220 */   152,  152,  152,  172,  173,  152,    7,    8,    9,  163,\n /*  1230 */   172,  173,   22,   23,  172,  173,  172,  173,  166,  167,\n /*  1240 */   172,  173,  172,  173,   55,  172,  173,   22,   23,  108,\n /*  1250 */   109,  110,  217,  152,  217,  166,  167,  163,  163,  163,\n /*  1260 */   163,  163,  196,  130,  217,  211,  212,  217,  116,   23,\n /*  1270 */    22,  101,   26,  121,   23,   23,   23,   26,   26,   26,\n /*  1280 */    23,   23,  112,   26,   26,   37,   97,  100,  101,   55,\n /*  1290 */   196,  196,  196,  196,  196,   23,   23,   55,   26,   26,\n /*  1300 */     7,    8,   23,  152,   23,   26,   96,   26,  132,  132,\n /*  1310 */   134,  134,   23,  152,  152,   26,  152,  122,  152,  191,\n /*  1320 */   152,   96,  234,  152,  152,  152,  152,  152,  197,  210,\n /*  1330 */   152,   97,  152,  152,  210,  233,  210,  198,  150,   97,\n /*  1340 */   184,  201,  239,  214,  214,  201,  239,  180,  214,  227,\n /*  1350 */   200,  198,  155,   67,  243,  176,   69,  175,  175,  175,\n /*  1360 */   122,  159,  159,  240,  159,  240,   22,  220,  129,  126,\n /*  1370 */   205,  130,   27,  204,  189,   18,  159,   18,  158,  220,\n /*  1380 */   159,  158,  137,   74,  192,  192,  192,  159,  192,  189,\n /*  1390 */   189,  205,  201,  236,  204,  235,  159,   22,  158,  201,\n /*  1400 */   201,  177,  107,  159,  177,  158,  174,  174,  159,  174,\n /*  1410 */    76,  182,  158,  177,  106,  125,   22,  107,   53,  137,\n /*  1420 */   216,  215,  159,  216,  174,  216,  215,  215,  159,  216,\n /*  1430 */   174,  176,  224,  215,  174,  174,  205,   25,  127,  177,\n /*  1440 */   226,  182,  177,  128,  229,  229,  162,   26,   13,  161,\n /*  1450 */   153,  153,    6,  151,  151,  151,  151,  165,  178,  165,\n /*  1460 */     4,  178,    3,   22,  165,  142,   15,   94,  204,  203,\n /*  1470 */   202,  201,   23,   16,  120,  249,   23,  131,  111,  249,\n /*  1480 */    20,  123,   16,    1,  123,  125,  131,   37,  111,   37,\n /*  1490 */    56,   37,   37,   64,  122,    1,    5,   22,  107,   80,\n /*  1500 */    26,   87,  140,   80,   72,  107,   20,   24,   19,  112,\n /*  1510 */   105,   23,   22,  246,   22,   79,   79,   22,   22,   58,\n /*  1520 */    22,   79,   23,   23,   23,  116,   68,   22,   26,   23,\n /*  1530 */    22,   64,  122,   26,   23,   23,   56,   22,   11,  124,\n /*  1540 */    26,   64,   26,   64,   23,   23,   23,   23,  122,   23,\n /*  1550 */    22,   26,   23,   22,   24,  122,   23,   22,   26,   22,\n /*  1560 */    24,   23,   23,   23,   22,  122,  122,   23,   15,    1,\n};\n#define YY_SHIFT_USE_DFLT (1570)\n#define YY_SHIFT_COUNT    (459)\n#define YY_SHIFT_MIN      (-94)\n#define YY_SHIFT_MAX      (1568)\nstatic const short yy_shift_ofst[] = {\n /*     0 */    40,  599,  904,  612,  760,  760,  760,  760,  725,  -19,\n /*    10 */    16,   16,  100,  760,  760,  760,  760,  760,  760,  760,\n /*    20 */   876,  876,  573,  542,  719,  600,   61,  137,  172,  207,\n /*    30 */   242,  277,  312,  347,  382,  417,  459,  459,  459,  459,\n /*    40 */   459,  459,  459,  459,  459,  459,  459,  459,  459,  459,\n /*    50 */   459,  459,  459,  494,  459,  529,  564,  564,  705,  760,\n /*    60 */   760,  760,  760,  760,  760,  760,  760,  760,  760,  760,\n /*    70 */   760,  760,  760,  760,  760,  760,  760,  760,  760,  760,\n /*    80 */   760,  760,  760,  760,  760,  760,  760,  760,  760,  760,\n /*    90 */   856,  760,  760,  760,  760,  760,  760,  760,  760,  760,\n /*   100 */   760,  760,  760,  760,  987,  746,  746,  746,  746,  746,\n /*   110 */   801,   23,   32,  949,  961,  979,  964,  964,  949,   73,\n /*   120 */   113,  -51, 1570, 1570, 1570,  536,  536,  536,   99,   99,\n /*   130 */   813,  813,  667,  205,  240,  949,  949,  949,  949,  949,\n /*   140 */   949,  949,  949,  949,  949,  949,  949,  949,  949,  949,\n /*   150 */   949,  949,  949,  949,  949,  332, 1011,  422,  422,  113,\n /*   160 */    30,   30,   30,   30,   30,   30, 1570, 1570, 1570,  922,\n /*   170 */   -94,  -94,  384,  613,  828,  420,  765,  804,  851,  949,\n /*   180 */   949,  949,  949,  949,  949,  949,  949,  949,  949,  949,\n /*   190 */   949,  949,  949,  949,  949,  672,  672,  672,  949,  949,\n /*   200 */   657,  949,  949,  949,  -18,  949,  949,  994,  949,  949,\n /*   210 */   949,  949,  949,  949,  949,  949,  949,  949,  772, 1118,\n /*   220 */   712,  712,  712,  810,   45,  769, 1219, 1133,  418,  418,\n /*   230 */   569, 1133,  569,  830,  607,  663,  882,  418,  693,  882,\n /*   240 */   882,  848, 1152, 1065, 1286, 1238, 1238, 1287, 1287, 1238,\n /*   250 */  1344, 1239, 1243, 1345, 1239, 1243, 1241, 1357, 1357, 1357,\n /*   260 */  1357, 1238, 1359, 1241, 1344, 1345, 1345, 1241, 1238, 1359,\n /*   270 */  1245, 1309, 1238, 1238, 1359, 1375, 1238, 1359, 1238, 1359,\n /*   280 */  1375, 1295, 1295, 1295, 1334, 1375, 1295, 1308, 1295, 1334,\n /*   290 */  1295, 1295, 1290, 1310, 1290, 1310, 1290, 1310, 1290, 1310,\n /*   300 */  1238, 1394, 1238, 1282, 1375, 1365, 1365, 1375, 1239, 1243,\n /*   310 */  1315, 1311, 1241, 1412, 1421, 1435, 1435, 1446, 1446, 1446,\n /*   320 */  1446, 1570, 1570, 1570, 1570, 1570, 1570, 1570, 1570,  519,\n /*   330 */   978, 1210, 1225,  104, 1141, 1189, 1246, 1248, 1251, 1252,\n /*   340 */  1253, 1257, 1258, 1273, 1003, 1187, 1293, 1170, 1272, 1279,\n /*   350 */  1234, 1281, 1176, 1177, 1289, 1242, 1195, 1456, 1459, 1441,\n /*   360 */  1323, 1451, 1373, 1457, 1449, 1453, 1354, 1346, 1367, 1358,\n /*   370 */  1460, 1360, 1466, 1482, 1361, 1355, 1450, 1452, 1454, 1455,\n /*   380 */  1377, 1434, 1429, 1372, 1494, 1491, 1475, 1391, 1362, 1419,\n /*   390 */  1474, 1423, 1414, 1432, 1398, 1483, 1486, 1489, 1397, 1405,\n /*   400 */  1490, 1436, 1492, 1495, 1488, 1496, 1437, 1461, 1498, 1442,\n /*   410 */  1458, 1499, 1500, 1501, 1502, 1409, 1505, 1506, 1508, 1507,\n /*   420 */  1410, 1511, 1512, 1480, 1467, 1515, 1415, 1514, 1477, 1516,\n /*   430 */  1479, 1521, 1514, 1522, 1523, 1524, 1525, 1526, 1528, 1527,\n /*   440 */  1529, 1531, 1530, 1532, 1533, 1535, 1536, 1532, 1538, 1537,\n /*   450 */  1539, 1540, 1542, 1426, 1433, 1443, 1444, 1544, 1553, 1568,\n};\n#define YY_REDUCE_USE_DFLT (-130)\n#define YY_REDUCE_COUNT (328)\n#define YY_REDUCE_MIN   (-129)\n#define YY_REDUCE_MAX   (1305)\nstatic const short yy_reduce_ofst[] = {\n /*     0 */   -29,  566,  525,  605,  -49,  307,  491,  533,  668,  435,\n /*    10 */   601,  644,  148,  747,  786,  795,  419,  788,  827,  790,\n /*    20 */   454,  832,  889,  495,  824,  734,   76,   76,   76,   76,\n /*    30 */    76,   76,   76,   76,   76,   76,   76,   76,   76,   76,\n /*    40 */    76,   76,   76,   76,   76,   76,   76,   76,   76,   76,\n /*    50 */    76,   76,   76,   76,   76,   76,   76,   76,  783,  898,\n /*    60 */   905,  907,  911,  921,  933,  936,  940,  943,  947,  950,\n /*    70 */   952,  955,  958,  962,  965,  969,  974,  977,  980,  984,\n /*    80 */   988,  991,  993,  996,  999, 1002, 1006, 1010, 1018, 1021,\n /*    90 */  1024, 1028, 1032, 1034, 1036, 1040, 1046, 1051, 1058, 1062,\n /*   100 */  1064, 1068, 1070, 1073,   76,   76,   76,   76,   76,   76,\n /*   110 */    76,   76,   76,  855,   36,  523,  235,  416,  777,   76,\n /*   120 */   278,   76,   76,   76,   76,  700,  700,  700,  150,  220,\n /*   130 */   147,  217,  221,  306,  306,  611,    5,  535,  556,  620,\n /*   140 */   720,  872,  897,  116,  864,  349, 1035, 1037,  404, 1047,\n /*   150 */   992, -129, 1050,  492,   62,  722,  879, 1072, 1089,  808,\n /*   160 */  1066, 1094, 1095, 1096, 1097, 1098,  776, 1054,  557,   57,\n /*   170 */   112,  131,  167,  182,  250,  272,  291,  331,  364,  438,\n /*   180 */   497,  517,  591,  653,  690,  739,  775,  798,  892,  908,\n /*   190 */   924,  930, 1015, 1063, 1069,  355,  784,  799,  981, 1101,\n /*   200 */   926, 1151, 1161, 1162,  945, 1164, 1166, 1128, 1168, 1171,\n /*   210 */  1172,  250, 1173, 1174, 1175, 1178, 1180, 1181, 1088, 1102,\n /*   220 */  1119, 1124, 1126,  926, 1131, 1139, 1188, 1140, 1129, 1130,\n /*   230 */  1103, 1144, 1107, 1179, 1156, 1167, 1182, 1134, 1122, 1183,\n /*   240 */  1184, 1150, 1153, 1197, 1111, 1202, 1203, 1123, 1125, 1205,\n /*   250 */  1147, 1165, 1169, 1185, 1186, 1190, 1191, 1192, 1193, 1194,\n /*   260 */  1196, 1217, 1220, 1198, 1159, 1200, 1201, 1199, 1221, 1223,\n /*   270 */  1157, 1160, 1228, 1237, 1240, 1224, 1244, 1247, 1249, 1254,\n /*   280 */  1227, 1232, 1233, 1235, 1229, 1236, 1250, 1255, 1256, 1259,\n /*   290 */  1260, 1261, 1204, 1206, 1207, 1211, 1209, 1212, 1213, 1218,\n /*   300 */  1263, 1208, 1269, 1214, 1262, 1215, 1216, 1265, 1231, 1264,\n /*   310 */  1266, 1268, 1270, 1284, 1288, 1297, 1298, 1302, 1303, 1304,\n /*   320 */  1305, 1226, 1230, 1267, 1292, 1294, 1280, 1283, 1299,\n};\nstatic const YYACTIONTYPE yy_default[] = {\n /*     0 */  1285, 1275, 1275, 1275, 1207, 1207, 1207, 1207, 1275, 1100,\n /*    10 */  1129, 1129, 1259, 1336, 1336, 1336, 1336, 1336, 1336, 1206,\n /*    20 */  1336, 1336, 1336, 1336, 1275, 1104, 1135, 1336, 1336, 1336,\n /*    30 */  1336, 1208, 1209, 1336, 1336, 1336, 1258, 1260, 1145, 1144,\n /*    40 */  1143, 1142, 1241, 1116, 1140, 1133, 1137, 1208, 1202, 1203,\n /*    50 */  1201, 1205, 1209, 1336, 1136, 1171, 1186, 1170, 1336, 1336,\n /*    60 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*    70 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*    80 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*    90 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   100 */  1336, 1336, 1336, 1336, 1180, 1185, 1192, 1184, 1181, 1173,\n /*   110 */  1172, 1174, 1175, 1336, 1023, 1071, 1336, 1336, 1336, 1176,\n /*   120 */  1336, 1177, 1189, 1188, 1187, 1266, 1293, 1292, 1336, 1336,\n /*   130 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   140 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   150 */  1336, 1336, 1336, 1336, 1336, 1285, 1275, 1029, 1029, 1336,\n /*   160 */  1275, 1275, 1275, 1275, 1275, 1275, 1271, 1104, 1095, 1336,\n /*   170 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   180 */  1263, 1261, 1336, 1222, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   190 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   200 */  1336, 1336, 1336, 1336, 1100, 1336, 1336, 1336, 1336, 1336,\n /*   210 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1287, 1336, 1236,\n /*   220 */  1100, 1100, 1100, 1102, 1084, 1094, 1008, 1139, 1118, 1118,\n /*   230 */  1325, 1139, 1325, 1046, 1307, 1043, 1129, 1118, 1204, 1129,\n /*   240 */  1129, 1101, 1094, 1336, 1328, 1109, 1109, 1327, 1327, 1109,\n /*   250 */  1150, 1134, 1123, 1074, 1134, 1123, 1139, 1080, 1080, 1080,\n /*   260 */  1080, 1109, 1020, 1139, 1150, 1074, 1074, 1139, 1109, 1020,\n /*   270 */  1240, 1322, 1109, 1109, 1020, 1215, 1109, 1020, 1109, 1020,\n /*   280 */  1215, 1072, 1072, 1072, 1061, 1215, 1072, 1046, 1072, 1061,\n /*   290 */  1072, 1072, 1122, 1117, 1122, 1117, 1122, 1117, 1122, 1117,\n /*   300 */  1109, 1210, 1109, 1336, 1215, 1219, 1219, 1215, 1134, 1123,\n /*   310 */  1132, 1130, 1139, 1026, 1064, 1290, 1290, 1286, 1286, 1286,\n /*   320 */  1286, 1333, 1333, 1271, 1302, 1302, 1048, 1048, 1302, 1336,\n /*   330 */  1336, 1336, 1336, 1336, 1336, 1297, 1336, 1224, 1336, 1336,\n /*   340 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   350 */  1336, 1336, 1336, 1336, 1336, 1336, 1156, 1336, 1004, 1268,\n /*   360 */  1336, 1336, 1267, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   370 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   380 */  1336, 1336, 1336, 1324, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   390 */  1239, 1238, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   400 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   410 */  1336, 1336, 1336, 1336, 1336, 1086, 1336, 1336, 1336, 1311,\n /*   420 */  1336, 1336, 1336, 1336, 1336, 1336, 1336, 1131, 1336, 1124,\n /*   430 */  1336, 1336, 1315, 1336, 1336, 1336, 1336, 1336, 1336, 1336,\n /*   440 */  1336, 1336, 1336, 1277, 1336, 1336, 1336, 1276, 1336, 1336,\n /*   450 */  1336, 1336, 1336, 1158, 1336, 1157, 1161, 1336, 1014, 1336,\n};\n/********** End of lemon-generated parsing tables *****************************/\n\n/* The next table maps tokens (terminal symbols) into fallback tokens.  \n** If a construct like the following:\n** \n**      %fallback ID X Y Z.\n**\n** appears in the grammar, then ID becomes a fallback token for X, Y,\n** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser\n** but it does not parse, the type of the token is changed to ID and\n** the parse is retried before an error is thrown.\n**\n** This feature can be used, for example, to cause some keywords in a language\n** to revert to identifiers if they keyword does not apply in the context where\n** it appears.\n*/\n#ifdef YYFALLBACK\nstatic const YYCODETYPE yyFallback[] = {\n    0,  /*          $ => nothing */\n    0,  /*       SEMI => nothing */\n   55,  /*    EXPLAIN => ID */\n   55,  /*      QUERY => ID */\n   55,  /*       PLAN => ID */\n   55,  /*      BEGIN => ID */\n    0,  /* TRANSACTION => nothing */\n   55,  /*   DEFERRED => ID */\n   55,  /*  IMMEDIATE => ID */\n   55,  /*  EXCLUSIVE => ID */\n    0,  /*     COMMIT => nothing */\n   55,  /*        END => ID */\n   55,  /*   ROLLBACK => ID */\n   55,  /*  SAVEPOINT => ID */\n   55,  /*    RELEASE => ID */\n    0,  /*         TO => nothing */\n    0,  /*      TABLE => nothing */\n    0,  /*     CREATE => nothing */\n   55,  /*         IF => ID */\n    0,  /*        NOT => nothing */\n    0,  /*     EXISTS => nothing */\n   55,  /*       TEMP => ID */\n    0,  /*         LP => nothing */\n    0,  /*         RP => nothing */\n    0,  /*         AS => nothing */\n   55,  /*    WITHOUT => ID */\n    0,  /*      COMMA => nothing */\n    0,  /*         OR => nothing */\n    0,  /*        AND => nothing */\n    0,  /*         IS => nothing */\n   55,  /*      MATCH => ID */\n   55,  /*    LIKE_KW => ID */\n    0,  /*    BETWEEN => nothing */\n    0,  /*         IN => nothing */\n    0,  /*     ISNULL => nothing */\n    0,  /*    NOTNULL => nothing */\n    0,  /*         NE => nothing */\n    0,  /*         EQ => nothing */\n    0,  /*         GT => nothing */\n    0,  /*         LE => nothing */\n    0,  /*         LT => nothing */\n    0,  /*         GE => nothing */\n    0,  /*     ESCAPE => nothing */\n    0,  /*     BITAND => nothing */\n    0,  /*      BITOR => nothing */\n    0,  /*     LSHIFT => nothing */\n    0,  /*     RSHIFT => nothing */\n    0,  /*       PLUS => nothing */\n    0,  /*      MINUS => nothing */\n    0,  /*       STAR => nothing */\n    0,  /*      SLASH => nothing */\n    0,  /*        REM => nothing */\n    0,  /*     CONCAT => nothing */\n    0,  /*    COLLATE => nothing */\n    0,  /*     BITNOT => nothing */\n    0,  /*         ID => nothing */\n    0,  /*    INDEXED => nothing */\n   55,  /*      ABORT => ID */\n   55,  /*     ACTION => ID */\n   55,  /*      AFTER => ID */\n   55,  /*    ANALYZE => ID */\n   55,  /*        ASC => ID */\n   55,  /*     ATTACH => ID */\n   55,  /*     BEFORE => ID */\n   55,  /*         BY => ID */\n   55,  /*    CASCADE => ID */\n   55,  /*       CAST => ID */\n   55,  /*   COLUMNKW => ID */\n   55,  /*   CONFLICT => ID */\n   55,  /*   DATABASE => ID */\n   55,  /*       DESC => ID */\n   55,  /*     DETACH => ID */\n   55,  /*       EACH => ID */\n   55,  /*       FAIL => ID */\n   55,  /*        FOR => ID */\n   55,  /*     IGNORE => ID */\n   55,  /*  INITIALLY => ID */\n   55,  /*    INSTEAD => ID */\n   55,  /*         NO => ID */\n   55,  /*        KEY => ID */\n   55,  /*         OF => ID */\n   55,  /*     OFFSET => ID */\n   55,  /*     PRAGMA => ID */\n   55,  /*      RAISE => ID */\n   55,  /*  RECURSIVE => ID */\n   55,  /*    REPLACE => ID */\n   55,  /*   RESTRICT => ID */\n   55,  /*        ROW => ID */\n   55,  /*    TRIGGER => ID */\n   55,  /*     VACUUM => ID */\n   55,  /*       VIEW => ID */\n   55,  /*    VIRTUAL => ID */\n   55,  /*       WITH => ID */\n   55,  /*    REINDEX => ID */\n   55,  /*     RENAME => ID */\n   55,  /*   CTIME_KW => ID */\n};\n#endif /* YYFALLBACK */\n\n/* The following structure represents a single element of the\n** parser's stack.  Information stored includes:\n**\n**   +  The state number for the parser at this level of the stack.\n**\n**   +  The value of the token stored at this level of the stack.\n**      (In other words, the \"major\" token.)\n**\n**   +  The semantic value stored at this level of the stack.  This is\n**      the information used by the action routines in the grammar.\n**      It is sometimes called the \"minor\" token.\n**\n** After the \"shift\" half of a SHIFTREDUCE action, the stateno field\n** actually contains the reduce action for the second half of the\n** SHIFTREDUCE.\n*/\nstruct yyStackEntry {\n  YYACTIONTYPE stateno;  /* The state-number, or reduce action in SHIFTREDUCE */\n  YYCODETYPE major;      /* The major token value.  This is the code\n                         ** number for the token at this stack level */\n  YYMINORTYPE minor;     /* The user-supplied minor token value.  This\n                         ** is the value of the token  */\n};\ntypedef struct yyStackEntry yyStackEntry;\n\n/* The state of the parser is completely contained in an instance of\n** the following structure */\nstruct yyParser {\n  yyStackEntry *yytos;          /* Pointer to top element of the stack */\n#ifdef YYTRACKMAXSTACKDEPTH\n  int yyhwm;                    /* High-water mark of the stack */\n#endif\n#ifndef YYNOERRORRECOVERY\n  int yyerrcnt;                 /* Shifts left before out of the error */\n#endif\n  sqlite3ParserARG_SDECL                /* A place to hold %extra_argument */\n#if YYSTACKDEPTH<=0\n  int yystksz;                  /* Current side of the stack */\n  yyStackEntry *yystack;        /* The parser's stack */\n  yyStackEntry yystk0;          /* First stack entry */\n#else\n  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */\n#endif\n};\ntypedef struct yyParser yyParser;\n\n#ifndef NDEBUG\n#include <stdio.h>\nstatic FILE *yyTraceFILE = 0;\nstatic char *yyTracePrompt = 0;\n#endif /* NDEBUG */\n\n#ifndef NDEBUG\n/* \n** Turn parser tracing on by giving a stream to which to write the trace\n** and a prompt to preface each trace message.  Tracing is turned off\n** by making either argument NULL \n**\n** Inputs:\n** <ul>\n** <li> A FILE* to which trace output should be written.\n**      If NULL, then tracing is turned off.\n** <li> A prefix string written at the beginning of every\n**      line of trace output.  If NULL, then tracing is\n**      turned off.\n** </ul>\n**\n** Outputs:\n** None.\n*/\nvoid sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){\n  yyTraceFILE = TraceFILE;\n  yyTracePrompt = zTracePrompt;\n  if( yyTraceFILE==0 ) yyTracePrompt = 0;\n  else if( yyTracePrompt==0 ) yyTraceFILE = 0;\n}\n#endif /* NDEBUG */\n\n#ifndef NDEBUG\n/* For tracing shifts, the names of all terminals and nonterminals\n** are required.  The following table supplies these names */\nstatic const char *const yyTokenName[] = { \n  \"$\",             \"SEMI\",          \"EXPLAIN\",       \"QUERY\",       \n  \"PLAN\",          \"BEGIN\",         \"TRANSACTION\",   \"DEFERRED\",    \n  \"IMMEDIATE\",     \"EXCLUSIVE\",     \"COMMIT\",        \"END\",         \n  \"ROLLBACK\",      \"SAVEPOINT\",     \"RELEASE\",       \"TO\",          \n  \"TABLE\",         \"CREATE\",        \"IF\",            \"NOT\",         \n  \"EXISTS\",        \"TEMP\",          \"LP\",            \"RP\",          \n  \"AS\",            \"WITHOUT\",       \"COMMA\",         \"OR\",          \n  \"AND\",           \"IS\",            \"MATCH\",         \"LIKE_KW\",     \n  \"BETWEEN\",       \"IN\",            \"ISNULL\",        \"NOTNULL\",     \n  \"NE\",            \"EQ\",            \"GT\",            \"LE\",          \n  \"LT\",            \"GE\",            \"ESCAPE\",        \"BITAND\",      \n  \"BITOR\",         \"LSHIFT\",        \"RSHIFT\",        \"PLUS\",        \n  \"MINUS\",         \"STAR\",          \"SLASH\",         \"REM\",         \n  \"CONCAT\",        \"COLLATE\",       \"BITNOT\",        \"ID\",          \n  \"INDEXED\",       \"ABORT\",         \"ACTION\",        \"AFTER\",       \n  \"ANALYZE\",       \"ASC\",           \"ATTACH\",        \"BEFORE\",      \n  \"BY\",            \"CASCADE\",       \"CAST\",          \"COLUMNKW\",    \n  \"CONFLICT\",      \"DATABASE\",      \"DESC\",          \"DETACH\",      \n  \"EACH\",          \"FAIL\",          \"FOR\",           \"IGNORE\",      \n  \"INITIALLY\",     \"INSTEAD\",       \"NO\",            \"KEY\",         \n  \"OF\",            \"OFFSET\",        \"PRAGMA\",        \"RAISE\",       \n  \"RECURSIVE\",     \"REPLACE\",       \"RESTRICT\",      \"ROW\",         \n  \"TRIGGER\",       \"VACUUM\",        \"VIEW\",          \"VIRTUAL\",     \n  \"WITH\",          \"REINDEX\",       \"RENAME\",        \"CTIME_KW\",    \n  \"ANY\",           \"STRING\",        \"JOIN_KW\",       \"CONSTRAINT\",  \n  \"DEFAULT\",       \"NULL\",          \"PRIMARY\",       \"UNIQUE\",      \n  \"CHECK\",         \"REFERENCES\",    \"AUTOINCR\",      \"ON\",          \n  \"INSERT\",        \"DELETE\",        \"UPDATE\",        \"SET\",         \n  \"DEFERRABLE\",    \"FOREIGN\",       \"DROP\",          \"UNION\",       \n  \"ALL\",           \"EXCEPT\",        \"INTERSECT\",     \"SELECT\",      \n  \"VALUES\",        \"DISTINCT\",      \"DOT\",           \"FROM\",        \n  \"JOIN\",          \"USING\",         \"ORDER\",         \"GROUP\",       \n  \"HAVING\",        \"LIMIT\",         \"WHERE\",         \"INTO\",        \n  \"FLOAT\",         \"BLOB\",          \"INTEGER\",       \"VARIABLE\",    \n  \"CASE\",          \"WHEN\",          \"THEN\",          \"ELSE\",        \n  \"INDEX\",         \"ALTER\",         \"ADD\",           \"error\",       \n  \"input\",         \"cmdlist\",       \"ecmd\",          \"explain\",     \n  \"cmdx\",          \"cmd\",           \"transtype\",     \"trans_opt\",   \n  \"nm\",            \"savepoint_opt\",  \"create_table\",  \"create_table_args\",\n  \"createkw\",      \"temp\",          \"ifnotexists\",   \"dbnm\",        \n  \"columnlist\",    \"conslist_opt\",  \"table_options\",  \"select\",      \n  \"columnname\",    \"carglist\",      \"typetoken\",     \"typename\",    \n  \"signed\",        \"plus_num\",      \"minus_num\",     \"ccons\",       \n  \"term\",          \"expr\",          \"onconf\",        \"sortorder\",   \n  \"autoinc\",       \"eidlist_opt\",   \"refargs\",       \"defer_subclause\",\n  \"refarg\",        \"refact\",        \"init_deferred_pred_opt\",  \"conslist\",    \n  \"tconscomma\",    \"tcons\",         \"sortlist\",      \"eidlist\",     \n  \"defer_subclause_opt\",  \"orconf\",        \"resolvetype\",   \"raisetype\",   \n  \"ifexists\",      \"fullname\",      \"selectnowith\",  \"oneselect\",   \n  \"with\",          \"multiselect_op\",  \"distinct\",      \"selcollist\",  \n  \"from\",          \"where_opt\",     \"groupby_opt\",   \"having_opt\",  \n  \"orderby_opt\",   \"limit_opt\",     \"values\",        \"nexprlist\",   \n  \"exprlist\",      \"sclp\",          \"as\",            \"seltablist\",  \n  \"stl_prefix\",    \"joinop\",        \"indexed_opt\",   \"on_opt\",      \n  \"using_opt\",     \"idlist\",        \"setlist\",       \"insert_cmd\",  \n  \"idlist_opt\",    \"likeop\",        \"between_op\",    \"in_op\",       \n  \"paren_exprlist\",  \"case_operand\",  \"case_exprlist\",  \"case_else\",   \n  \"uniqueflag\",    \"collate\",       \"nmnum\",         \"trigger_decl\",\n  \"trigger_cmd_list\",  \"trigger_time\",  \"trigger_event\",  \"foreach_clause\",\n  \"when_clause\",   \"trigger_cmd\",   \"trnm\",          \"tridxby\",     \n  \"database_kw_opt\",  \"key_opt\",       \"add_column_fullname\",  \"kwcolumn_opt\",\n  \"create_vtab\",   \"vtabarglist\",   \"vtabarg\",       \"vtabargtoken\",\n  \"lp\",            \"anylist\",       \"wqlist\",      \n};\n#endif /* NDEBUG */\n\n#ifndef NDEBUG\n/* For tracing reduce actions, the names of all rules are required.\n*/\nstatic const char *const yyRuleName[] = {\n /*   0 */ \"explain ::= EXPLAIN\",\n /*   1 */ \"explain ::= EXPLAIN QUERY PLAN\",\n /*   2 */ \"cmdx ::= cmd\",\n /*   3 */ \"cmd ::= BEGIN transtype trans_opt\",\n /*   4 */ \"transtype ::=\",\n /*   5 */ \"transtype ::= DEFERRED\",\n /*   6 */ \"transtype ::= IMMEDIATE\",\n /*   7 */ \"transtype ::= EXCLUSIVE\",\n /*   8 */ \"cmd ::= COMMIT trans_opt\",\n /*   9 */ \"cmd ::= END trans_opt\",\n /*  10 */ \"cmd ::= ROLLBACK trans_opt\",\n /*  11 */ \"cmd ::= SAVEPOINT nm\",\n /*  12 */ \"cmd ::= RELEASE savepoint_opt nm\",\n /*  13 */ \"cmd ::= ROLLBACK trans_opt TO savepoint_opt nm\",\n /*  14 */ \"create_table ::= createkw temp TABLE ifnotexists nm dbnm\",\n /*  15 */ \"createkw ::= CREATE\",\n /*  16 */ \"ifnotexists ::=\",\n /*  17 */ \"ifnotexists ::= IF NOT EXISTS\",\n /*  18 */ \"temp ::= TEMP\",\n /*  19 */ \"temp ::=\",\n /*  20 */ \"create_table_args ::= LP columnlist conslist_opt RP table_options\",\n /*  21 */ \"create_table_args ::= AS select\",\n /*  22 */ \"table_options ::=\",\n /*  23 */ \"table_options ::= WITHOUT nm\",\n /*  24 */ \"columnname ::= nm typetoken\",\n /*  25 */ \"typetoken ::=\",\n /*  26 */ \"typetoken ::= typename LP signed RP\",\n /*  27 */ \"typetoken ::= typename LP signed COMMA signed RP\",\n /*  28 */ \"typename ::= typename ID|STRING\",\n /*  29 */ \"ccons ::= CONSTRAINT nm\",\n /*  30 */ \"ccons ::= DEFAULT term\",\n /*  31 */ \"ccons ::= DEFAULT LP expr RP\",\n /*  32 */ \"ccons ::= DEFAULT PLUS term\",\n /*  33 */ \"ccons ::= DEFAULT MINUS term\",\n /*  34 */ \"ccons ::= DEFAULT ID|INDEXED\",\n /*  35 */ \"ccons ::= NOT NULL onconf\",\n /*  36 */ \"ccons ::= PRIMARY KEY sortorder onconf autoinc\",\n /*  37 */ \"ccons ::= UNIQUE onconf\",\n /*  38 */ \"ccons ::= CHECK LP expr RP\",\n /*  39 */ \"ccons ::= REFERENCES nm eidlist_opt refargs\",\n /*  40 */ \"ccons ::= defer_subclause\",\n /*  41 */ \"ccons ::= COLLATE ID|STRING\",\n /*  42 */ \"autoinc ::=\",\n /*  43 */ \"autoinc ::= AUTOINCR\",\n /*  44 */ \"refargs ::=\",\n /*  45 */ \"refargs ::= refargs refarg\",\n /*  46 */ \"refarg ::= MATCH nm\",\n /*  47 */ \"refarg ::= ON INSERT refact\",\n /*  48 */ \"refarg ::= ON DELETE refact\",\n /*  49 */ \"refarg ::= ON UPDATE refact\",\n /*  50 */ \"refact ::= SET NULL\",\n /*  51 */ \"refact ::= SET DEFAULT\",\n /*  52 */ \"refact ::= CASCADE\",\n /*  53 */ \"refact ::= RESTRICT\",\n /*  54 */ \"refact ::= NO ACTION\",\n /*  55 */ \"defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt\",\n /*  56 */ \"defer_subclause ::= DEFERRABLE init_deferred_pred_opt\",\n /*  57 */ \"init_deferred_pred_opt ::=\",\n /*  58 */ \"init_deferred_pred_opt ::= INITIALLY DEFERRED\",\n /*  59 */ \"init_deferred_pred_opt ::= INITIALLY IMMEDIATE\",\n /*  60 */ \"conslist_opt ::=\",\n /*  61 */ \"tconscomma ::= COMMA\",\n /*  62 */ \"tcons ::= CONSTRAINT nm\",\n /*  63 */ \"tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf\",\n /*  64 */ \"tcons ::= UNIQUE LP sortlist RP onconf\",\n /*  65 */ \"tcons ::= CHECK LP expr RP onconf\",\n /*  66 */ \"tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt\",\n /*  67 */ \"defer_subclause_opt ::=\",\n /*  68 */ \"onconf ::=\",\n /*  69 */ \"onconf ::= ON CONFLICT resolvetype\",\n /*  70 */ \"orconf ::=\",\n /*  71 */ \"orconf ::= OR resolvetype\",\n /*  72 */ \"resolvetype ::= IGNORE\",\n /*  73 */ \"resolvetype ::= REPLACE\",\n /*  74 */ \"cmd ::= DROP TABLE ifexists fullname\",\n /*  75 */ \"ifexists ::= IF EXISTS\",\n /*  76 */ \"ifexists ::=\",\n /*  77 */ \"cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select\",\n /*  78 */ \"cmd ::= DROP VIEW ifexists fullname\",\n /*  79 */ \"cmd ::= select\",\n /*  80 */ \"select ::= with selectnowith\",\n /*  81 */ \"selectnowith ::= selectnowith multiselect_op oneselect\",\n /*  82 */ \"multiselect_op ::= UNION\",\n /*  83 */ \"multiselect_op ::= UNION ALL\",\n /*  84 */ \"multiselect_op ::= EXCEPT|INTERSECT\",\n /*  85 */ \"oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt\",\n /*  86 */ \"values ::= VALUES LP nexprlist RP\",\n /*  87 */ \"values ::= values COMMA LP exprlist RP\",\n /*  88 */ \"distinct ::= DISTINCT\",\n /*  89 */ \"distinct ::= ALL\",\n /*  90 */ \"distinct ::=\",\n /*  91 */ \"sclp ::=\",\n /*  92 */ \"selcollist ::= sclp expr as\",\n /*  93 */ \"selcollist ::= sclp STAR\",\n /*  94 */ \"selcollist ::= sclp nm DOT STAR\",\n /*  95 */ \"as ::= AS nm\",\n /*  96 */ \"as ::=\",\n /*  97 */ \"from ::=\",\n /*  98 */ \"from ::= FROM seltablist\",\n /*  99 */ \"stl_prefix ::= seltablist joinop\",\n /* 100 */ \"stl_prefix ::=\",\n /* 101 */ \"seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt\",\n /* 102 */ \"seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt\",\n /* 103 */ \"seltablist ::= stl_prefix LP select RP as on_opt using_opt\",\n /* 104 */ \"seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt\",\n /* 105 */ \"dbnm ::=\",\n /* 106 */ \"dbnm ::= DOT nm\",\n /* 107 */ \"fullname ::= nm dbnm\",\n /* 108 */ \"joinop ::= COMMA|JOIN\",\n /* 109 */ \"joinop ::= JOIN_KW JOIN\",\n /* 110 */ \"joinop ::= JOIN_KW nm JOIN\",\n /* 111 */ \"joinop ::= JOIN_KW nm nm JOIN\",\n /* 112 */ \"on_opt ::= ON expr\",\n /* 113 */ \"on_opt ::=\",\n /* 114 */ \"indexed_opt ::=\",\n /* 115 */ \"indexed_opt ::= INDEXED BY nm\",\n /* 116 */ \"indexed_opt ::= NOT INDEXED\",\n /* 117 */ \"using_opt ::= USING LP idlist RP\",\n /* 118 */ \"using_opt ::=\",\n /* 119 */ \"orderby_opt ::=\",\n /* 120 */ \"orderby_opt ::= ORDER BY sortlist\",\n /* 121 */ \"sortlist ::= sortlist COMMA expr sortorder\",\n /* 122 */ \"sortlist ::= expr sortorder\",\n /* 123 */ \"sortorder ::= ASC\",\n /* 124 */ \"sortorder ::= DESC\",\n /* 125 */ \"sortorder ::=\",\n /* 126 */ \"groupby_opt ::=\",\n /* 127 */ \"groupby_opt ::= GROUP BY nexprlist\",\n /* 128 */ \"having_opt ::=\",\n /* 129 */ \"having_opt ::= HAVING expr\",\n /* 130 */ \"limit_opt ::=\",\n /* 131 */ \"limit_opt ::= LIMIT expr\",\n /* 132 */ \"limit_opt ::= LIMIT expr OFFSET expr\",\n /* 133 */ \"limit_opt ::= LIMIT expr COMMA expr\",\n /* 134 */ \"cmd ::= with DELETE FROM fullname indexed_opt where_opt orderby_opt limit_opt\",\n /* 135 */ \"where_opt ::=\",\n /* 136 */ \"where_opt ::= WHERE expr\",\n /* 137 */ \"cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt orderby_opt limit_opt\",\n /* 138 */ \"setlist ::= setlist COMMA nm EQ expr\",\n /* 139 */ \"setlist ::= setlist COMMA LP idlist RP EQ expr\",\n /* 140 */ \"setlist ::= nm EQ expr\",\n /* 141 */ \"setlist ::= LP idlist RP EQ expr\",\n /* 142 */ \"cmd ::= with insert_cmd INTO fullname idlist_opt select\",\n /* 143 */ \"cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES\",\n /* 144 */ \"insert_cmd ::= INSERT orconf\",\n /* 145 */ \"insert_cmd ::= REPLACE\",\n /* 146 */ \"idlist_opt ::=\",\n /* 147 */ \"idlist_opt ::= LP idlist RP\",\n /* 148 */ \"idlist ::= idlist COMMA nm\",\n /* 149 */ \"idlist ::= nm\",\n /* 150 */ \"expr ::= LP expr RP\",\n /* 151 */ \"term ::= NULL\",\n /* 152 */ \"expr ::= ID|INDEXED\",\n /* 153 */ \"expr ::= JOIN_KW\",\n /* 154 */ \"expr ::= nm DOT nm\",\n /* 155 */ \"expr ::= nm DOT nm DOT nm\",\n /* 156 */ \"term ::= FLOAT|BLOB\",\n /* 157 */ \"term ::= STRING\",\n /* 158 */ \"term ::= INTEGER\",\n /* 159 */ \"expr ::= VARIABLE\",\n /* 160 */ \"expr ::= expr COLLATE ID|STRING\",\n /* 161 */ \"expr ::= CAST LP expr AS typetoken RP\",\n /* 162 */ \"expr ::= ID|INDEXED LP distinct exprlist RP\",\n /* 163 */ \"expr ::= ID|INDEXED LP STAR RP\",\n /* 164 */ \"term ::= CTIME_KW\",\n /* 165 */ \"expr ::= LP nexprlist COMMA expr RP\",\n /* 166 */ \"expr ::= expr AND expr\",\n /* 167 */ \"expr ::= expr OR expr\",\n /* 168 */ \"expr ::= expr LT|GT|GE|LE expr\",\n /* 169 */ \"expr ::= expr EQ|NE expr\",\n /* 170 */ \"expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr\",\n /* 171 */ \"expr ::= expr PLUS|MINUS expr\",\n /* 172 */ \"expr ::= expr STAR|SLASH|REM expr\",\n /* 173 */ \"expr ::= expr CONCAT expr\",\n /* 174 */ \"likeop ::= LIKE_KW|MATCH\",\n /* 175 */ \"likeop ::= NOT LIKE_KW|MATCH\",\n /* 176 */ \"expr ::= expr likeop expr\",\n /* 177 */ \"expr ::= expr likeop expr ESCAPE expr\",\n /* 178 */ \"expr ::= expr ISNULL|NOTNULL\",\n /* 179 */ \"expr ::= expr NOT NULL\",\n /* 180 */ \"expr ::= expr IS expr\",\n /* 181 */ \"expr ::= expr IS NOT expr\",\n /* 182 */ \"expr ::= NOT expr\",\n /* 183 */ \"expr ::= BITNOT expr\",\n /* 184 */ \"expr ::= MINUS expr\",\n /* 185 */ \"expr ::= PLUS expr\",\n /* 186 */ \"between_op ::= BETWEEN\",\n /* 187 */ \"between_op ::= NOT BETWEEN\",\n /* 188 */ \"expr ::= expr between_op expr AND expr\",\n /* 189 */ \"in_op ::= IN\",\n /* 190 */ \"in_op ::= NOT IN\",\n /* 191 */ \"expr ::= expr in_op LP exprlist RP\",\n /* 192 */ \"expr ::= LP select RP\",\n /* 193 */ \"expr ::= expr in_op LP select RP\",\n /* 194 */ \"expr ::= expr in_op nm dbnm paren_exprlist\",\n /* 195 */ \"expr ::= EXISTS LP select RP\",\n /* 196 */ \"expr ::= CASE case_operand case_exprlist case_else END\",\n /* 197 */ \"case_exprlist ::= case_exprlist WHEN expr THEN expr\",\n /* 198 */ \"case_exprlist ::= WHEN expr THEN expr\",\n /* 199 */ \"case_else ::= ELSE expr\",\n /* 200 */ \"case_else ::=\",\n /* 201 */ \"case_operand ::= expr\",\n /* 202 */ \"case_operand ::=\",\n /* 203 */ \"exprlist ::=\",\n /* 204 */ \"nexprlist ::= nexprlist COMMA expr\",\n /* 205 */ \"nexprlist ::= expr\",\n /* 206 */ \"paren_exprlist ::=\",\n /* 207 */ \"paren_exprlist ::= LP exprlist RP\",\n /* 208 */ \"cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt\",\n /* 209 */ \"uniqueflag ::= UNIQUE\",\n /* 210 */ \"uniqueflag ::=\",\n /* 211 */ \"eidlist_opt ::=\",\n /* 212 */ \"eidlist_opt ::= LP eidlist RP\",\n /* 213 */ \"eidlist ::= eidlist COMMA nm collate sortorder\",\n /* 214 */ \"eidlist ::= nm collate sortorder\",\n /* 215 */ \"collate ::=\",\n /* 216 */ \"collate ::= COLLATE ID|STRING\",\n /* 217 */ \"cmd ::= DROP INDEX ifexists fullname\",\n /* 218 */ \"cmd ::= VACUUM\",\n /* 219 */ \"cmd ::= VACUUM nm\",\n /* 220 */ \"cmd ::= PRAGMA nm dbnm\",\n /* 221 */ \"cmd ::= PRAGMA nm dbnm EQ nmnum\",\n /* 222 */ \"cmd ::= PRAGMA nm dbnm LP nmnum RP\",\n /* 223 */ \"cmd ::= PRAGMA nm dbnm EQ minus_num\",\n /* 224 */ \"cmd ::= PRAGMA nm dbnm LP minus_num RP\",\n /* 225 */ \"plus_num ::= PLUS INTEGER|FLOAT\",\n /* 226 */ \"minus_num ::= MINUS INTEGER|FLOAT\",\n /* 227 */ \"cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END\",\n /* 228 */ \"trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause\",\n /* 229 */ \"trigger_time ::= BEFORE\",\n /* 230 */ \"trigger_time ::= AFTER\",\n /* 231 */ \"trigger_time ::= INSTEAD OF\",\n /* 232 */ \"trigger_time ::=\",\n /* 233 */ \"trigger_event ::= DELETE|INSERT\",\n /* 234 */ \"trigger_event ::= UPDATE\",\n /* 235 */ \"trigger_event ::= UPDATE OF idlist\",\n /* 236 */ \"when_clause ::=\",\n /* 237 */ \"when_clause ::= WHEN expr\",\n /* 238 */ \"trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI\",\n /* 239 */ \"trigger_cmd_list ::= trigger_cmd SEMI\",\n /* 240 */ \"trnm ::= nm DOT nm\",\n /* 241 */ \"tridxby ::= INDEXED BY nm\",\n /* 242 */ \"tridxby ::= NOT INDEXED\",\n /* 243 */ \"trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt\",\n /* 244 */ \"trigger_cmd ::= insert_cmd INTO trnm idlist_opt select\",\n /* 245 */ \"trigger_cmd ::= DELETE FROM trnm tridxby where_opt\",\n /* 246 */ \"trigger_cmd ::= select\",\n /* 247 */ \"expr ::= RAISE LP IGNORE RP\",\n /* 248 */ \"expr ::= RAISE LP raisetype COMMA nm RP\",\n /* 249 */ \"raisetype ::= ROLLBACK\",\n /* 250 */ \"raisetype ::= ABORT\",\n /* 251 */ \"raisetype ::= FAIL\",\n /* 252 */ \"cmd ::= DROP TRIGGER ifexists fullname\",\n /* 253 */ \"cmd ::= ATTACH database_kw_opt expr AS expr key_opt\",\n /* 254 */ \"cmd ::= DETACH database_kw_opt expr\",\n /* 255 */ \"key_opt ::=\",\n /* 256 */ \"key_opt ::= KEY expr\",\n /* 257 */ \"cmd ::= REINDEX\",\n /* 258 */ \"cmd ::= REINDEX nm dbnm\",\n /* 259 */ \"cmd ::= ANALYZE\",\n /* 260 */ \"cmd ::= ANALYZE nm dbnm\",\n /* 261 */ \"cmd ::= ALTER TABLE fullname RENAME TO nm\",\n /* 262 */ \"cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist\",\n /* 263 */ \"add_column_fullname ::= fullname\",\n /* 264 */ \"cmd ::= create_vtab\",\n /* 265 */ \"cmd ::= create_vtab LP vtabarglist RP\",\n /* 266 */ \"create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm\",\n /* 267 */ \"vtabarg ::=\",\n /* 268 */ \"vtabargtoken ::= ANY\",\n /* 269 */ \"vtabargtoken ::= lp anylist RP\",\n /* 270 */ \"lp ::= LP\",\n /* 271 */ \"with ::=\",\n /* 272 */ \"with ::= WITH wqlist\",\n /* 273 */ \"with ::= WITH RECURSIVE wqlist\",\n /* 274 */ \"wqlist ::= nm eidlist_opt AS LP select RP\",\n /* 275 */ \"wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP\",\n /* 276 */ \"input ::= cmdlist\",\n /* 277 */ \"cmdlist ::= cmdlist ecmd\",\n /* 278 */ \"cmdlist ::= ecmd\",\n /* 279 */ \"ecmd ::= SEMI\",\n /* 280 */ \"ecmd ::= explain cmdx SEMI\",\n /* 281 */ \"explain ::=\",\n /* 282 */ \"trans_opt ::=\",\n /* 283 */ \"trans_opt ::= TRANSACTION\",\n /* 284 */ \"trans_opt ::= TRANSACTION nm\",\n /* 285 */ \"savepoint_opt ::= SAVEPOINT\",\n /* 286 */ \"savepoint_opt ::=\",\n /* 287 */ \"cmd ::= create_table create_table_args\",\n /* 288 */ \"columnlist ::= columnlist COMMA columnname carglist\",\n /* 289 */ \"columnlist ::= columnname carglist\",\n /* 290 */ \"nm ::= ID|INDEXED\",\n /* 291 */ \"nm ::= STRING\",\n /* 292 */ \"nm ::= JOIN_KW\",\n /* 293 */ \"typetoken ::= typename\",\n /* 294 */ \"typename ::= ID|STRING\",\n /* 295 */ \"signed ::= plus_num\",\n /* 296 */ \"signed ::= minus_num\",\n /* 297 */ \"carglist ::= carglist ccons\",\n /* 298 */ \"carglist ::=\",\n /* 299 */ \"ccons ::= NULL onconf\",\n /* 300 */ \"conslist_opt ::= COMMA conslist\",\n /* 301 */ \"conslist ::= conslist tconscomma tcons\",\n /* 302 */ \"conslist ::= tcons\",\n /* 303 */ \"tconscomma ::=\",\n /* 304 */ \"defer_subclause_opt ::= defer_subclause\",\n /* 305 */ \"resolvetype ::= raisetype\",\n /* 306 */ \"selectnowith ::= oneselect\",\n /* 307 */ \"oneselect ::= values\",\n /* 308 */ \"sclp ::= selcollist COMMA\",\n /* 309 */ \"as ::= ID|STRING\",\n /* 310 */ \"expr ::= term\",\n /* 311 */ \"exprlist ::= nexprlist\",\n /* 312 */ \"nmnum ::= plus_num\",\n /* 313 */ \"nmnum ::= nm\",\n /* 314 */ \"nmnum ::= ON\",\n /* 315 */ \"nmnum ::= DELETE\",\n /* 316 */ \"nmnum ::= DEFAULT\",\n /* 317 */ \"plus_num ::= INTEGER|FLOAT\",\n /* 318 */ \"foreach_clause ::=\",\n /* 319 */ \"foreach_clause ::= FOR EACH ROW\",\n /* 320 */ \"trnm ::= nm\",\n /* 321 */ \"tridxby ::=\",\n /* 322 */ \"database_kw_opt ::= DATABASE\",\n /* 323 */ \"database_kw_opt ::=\",\n /* 324 */ \"kwcolumn_opt ::=\",\n /* 325 */ \"kwcolumn_opt ::= COLUMNKW\",\n /* 326 */ \"vtabarglist ::= vtabarg\",\n /* 327 */ \"vtabarglist ::= vtabarglist COMMA vtabarg\",\n /* 328 */ \"vtabarg ::= vtabarg vtabargtoken\",\n /* 329 */ \"anylist ::=\",\n /* 330 */ \"anylist ::= anylist LP anylist RP\",\n /* 331 */ \"anylist ::= anylist ANY\",\n};\n#endif /* NDEBUG */\n\n\n#if YYSTACKDEPTH<=0\n/*\n** Try to increase the size of the parser stack.  Return the number\n** of errors.  Return 0 on success.\n*/\nstatic int yyGrowStack(yyParser *p){\n  int newSize;\n  int idx;\n  yyStackEntry *pNew;\n\n  newSize = p->yystksz*2 + 100;\n  idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;\n  if( p->yystack==&p->yystk0 ){\n    pNew = malloc(newSize*sizeof(pNew[0]));\n    if( pNew ) pNew[0] = p->yystk0;\n  }else{\n    pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));\n  }\n  if( pNew ){\n    p->yystack = pNew;\n    p->yytos = &p->yystack[idx];\n#ifndef NDEBUG\n    if( yyTraceFILE ){\n      fprintf(yyTraceFILE,\"%sStack grows from %d to %d entries.\\n\",\n              yyTracePrompt, p->yystksz, newSize);\n    }\n#endif\n    p->yystksz = newSize;\n  }\n  return pNew==0; \n}\n#endif\n\n/* Datatype of the argument to the memory allocated passed as the\n** second argument to sqlite3ParserAlloc() below.  This can be changed by\n** putting an appropriate #define in the %include section of the input\n** grammar.\n*/\n#ifndef YYMALLOCARGTYPE\n# define YYMALLOCARGTYPE size_t\n#endif\n\n/* \n** This function allocates a new parser.\n** The only argument is a pointer to a function which works like\n** malloc.\n**\n** Inputs:\n** A pointer to the function used to allocate memory.\n**\n** Outputs:\n** A pointer to a parser.  This pointer is used in subsequent calls\n** to sqlite3Parser and sqlite3ParserFree.\n*/\nvoid *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){\n  yyParser *pParser;\n  pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );\n  if( pParser ){\n#ifdef YYTRACKMAXSTACKDEPTH\n    pParser->yyhwm = 0;\n#endif\n#if YYSTACKDEPTH<=0\n    pParser->yytos = NULL;\n    pParser->yystack = NULL;\n    pParser->yystksz = 0;\n    if( yyGrowStack(pParser) ){\n      pParser->yystack = &pParser->yystk0;\n      pParser->yystksz = 1;\n    }\n#endif\n#ifndef YYNOERRORRECOVERY\n    pParser->yyerrcnt = -1;\n#endif\n    pParser->yytos = pParser->yystack;\n    pParser->yystack[0].stateno = 0;\n    pParser->yystack[0].major = 0;\n  }\n  return pParser;\n}\n\n/* The following function deletes the \"minor type\" or semantic value\n** associated with a symbol.  The symbol can be either a terminal\n** or nonterminal. \"yymajor\" is the symbol code, and \"yypminor\" is\n** a pointer to the value to be deleted.  The code used to do the \n** deletions is derived from the %destructor and/or %token_destructor\n** directives of the input grammar.\n*/\nstatic void yy_destructor(\n  yyParser *yypParser,    /* The parser */\n  YYCODETYPE yymajor,     /* Type code for object to destroy */\n  YYMINORTYPE *yypminor   /* The object to be destroyed */\n){\n  sqlite3ParserARG_FETCH;\n  switch( yymajor ){\n    /* Here is inserted the actions which take place when a\n    ** terminal or non-terminal is destroyed.  This can happen\n    ** when the symbol is popped from the stack during a\n    ** reduce or during error processing or when a parser is \n    ** being destroyed before it is finished parsing.\n    **\n    ** Note: during a reduce, the only symbols destroyed are those\n    ** which appear on the RHS of the rule, but which are *not* used\n    ** inside the C code.\n    */\n/********* Begin destructor definitions ***************************************/\n    case 163: /* select */\n    case 194: /* selectnowith */\n    case 195: /* oneselect */\n    case 206: /* values */\n{\n#line 396 \"parse.y\"\nsqlite3SelectDelete(pParse->db, (yypminor->yy243));\n#line 1575 \"parse.c\"\n}\n      break;\n    case 172: /* term */\n    case 173: /* expr */\n{\n#line 823 \"parse.y\"\nsqlite3ExprDelete(pParse->db, (yypminor->yy190).pExpr);\n#line 1583 \"parse.c\"\n}\n      break;\n    case 177: /* eidlist_opt */\n    case 186: /* sortlist */\n    case 187: /* eidlist */\n    case 199: /* selcollist */\n    case 202: /* groupby_opt */\n    case 204: /* orderby_opt */\n    case 207: /* nexprlist */\n    case 208: /* exprlist */\n    case 209: /* sclp */\n    case 218: /* setlist */\n    case 224: /* paren_exprlist */\n    case 226: /* case_exprlist */\n{\n#line 1270 \"parse.y\"\nsqlite3ExprListDelete(pParse->db, (yypminor->yy148));\n#line 1601 \"parse.c\"\n}\n      break;\n    case 193: /* fullname */\n    case 200: /* from */\n    case 211: /* seltablist */\n    case 212: /* stl_prefix */\n{\n#line 628 \"parse.y\"\nsqlite3SrcListDelete(pParse->db, (yypminor->yy185));\n#line 1611 \"parse.c\"\n}\n      break;\n    case 196: /* with */\n    case 250: /* wqlist */\n{\n#line 1547 \"parse.y\"\nsqlite3WithDelete(pParse->db, (yypminor->yy285));\n#line 1619 \"parse.c\"\n}\n      break;\n    case 201: /* where_opt */\n    case 203: /* having_opt */\n    case 215: /* on_opt */\n    case 225: /* case_operand */\n    case 227: /* case_else */\n    case 236: /* when_clause */\n    case 241: /* key_opt */\n{\n#line 744 \"parse.y\"\nsqlite3ExprDelete(pParse->db, (yypminor->yy72));\n#line 1632 \"parse.c\"\n}\n      break;\n    case 216: /* using_opt */\n    case 217: /* idlist */\n    case 220: /* idlist_opt */\n{\n#line 662 \"parse.y\"\nsqlite3IdListDelete(pParse->db, (yypminor->yy254));\n#line 1641 \"parse.c\"\n}\n      break;\n    case 232: /* trigger_cmd_list */\n    case 237: /* trigger_cmd */\n{\n#line 1384 \"parse.y\"\nsqlite3DeleteTriggerStep(pParse->db, (yypminor->yy145));\n#line 1649 \"parse.c\"\n}\n      break;\n    case 234: /* trigger_event */\n{\n#line 1370 \"parse.y\"\nsqlite3IdListDelete(pParse->db, (yypminor->yy332).b);\n#line 1656 \"parse.c\"\n}\n      break;\n/********* End destructor definitions *****************************************/\n    default:  break;   /* If no destructor action specified: do nothing */\n  }\n}\n\n/*\n** Pop the parser's stack once.\n**\n** If there is a destructor routine associated with the token which\n** is popped from the stack, then call it.\n*/\nstatic void yy_pop_parser_stack(yyParser *pParser){\n  yyStackEntry *yytos;\n  assert( pParser->yytos!=0 );\n  assert( pParser->yytos > pParser->yystack );\n  yytos = pParser->yytos--;\n#ifndef NDEBUG\n  if( yyTraceFILE ){\n    fprintf(yyTraceFILE,\"%sPopping %s\\n\",\n      yyTracePrompt,\n      yyTokenName[yytos->major]);\n  }\n#endif\n  yy_destructor(pParser, yytos->major, &yytos->minor);\n}\n\n/* \n** Deallocate and destroy a parser.  Destructors are called for\n** all stack elements before shutting the parser down.\n**\n** If the YYPARSEFREENEVERNULL macro exists (for example because it\n** is defined in a %include section of the input grammar) then it is\n** assumed that the input pointer is never NULL.\n*/\nvoid sqlite3ParserFree(\n  void *p,                    /* The parser to be deleted */\n  void (*freeProc)(void*)     /* Function used to reclaim memory */\n){\n  yyParser *pParser = (yyParser*)p;\n#ifndef YYPARSEFREENEVERNULL\n  if( pParser==0 ) return;\n#endif\n  while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);\n#if YYSTACKDEPTH<=0\n  if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);\n#endif\n  (*freeProc)((void*)pParser);\n}\n\n/*\n** Return the peak depth of the stack for a parser.\n*/\n#ifdef YYTRACKMAXSTACKDEPTH\nint sqlite3ParserStackPeak(void *p){\n  yyParser *pParser = (yyParser*)p;\n  return pParser->yyhwm;\n}\n#endif\n\n/*\n** Find the appropriate action for a parser given the terminal\n** look-ahead token iLookAhead.\n*/\nstatic unsigned int yy_find_shift_action(\n  yyParser *pParser,        /* The parser */\n  YYCODETYPE iLookAhead     /* The look-ahead token */\n){\n  int i;\n  int stateno = pParser->yytos->stateno;\n \n  if( stateno>=YY_MIN_REDUCE ) return stateno;\n  assert( stateno <= YY_SHIFT_COUNT );\n  do{\n    i = yy_shift_ofst[stateno];\n    assert( iLookAhead!=YYNOCODE );\n    i += iLookAhead;\n    if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){\n#ifdef YYFALLBACK\n      YYCODETYPE iFallback;            /* Fallback token */\n      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])\n             && (iFallback = yyFallback[iLookAhead])!=0 ){\n#ifndef NDEBUG\n        if( yyTraceFILE ){\n          fprintf(yyTraceFILE, \"%sFALLBACK %s => %s\\n\",\n             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);\n        }\n#endif\n        assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */\n        iLookAhead = iFallback;\n        continue;\n      }\n#endif\n#ifdef YYWILDCARD\n      {\n        int j = i - iLookAhead + YYWILDCARD;\n        if( \n#if YY_SHIFT_MIN+YYWILDCARD<0\n          j>=0 &&\n#endif\n#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT\n          j<YY_ACTTAB_COUNT &&\n#endif\n          yy_lookahead[j]==YYWILDCARD && iLookAhead>0\n        ){\n#ifndef NDEBUG\n          if( yyTraceFILE ){\n            fprintf(yyTraceFILE, \"%sWILDCARD %s => %s\\n\",\n               yyTracePrompt, yyTokenName[iLookAhead],\n               yyTokenName[YYWILDCARD]);\n          }\n#endif /* NDEBUG */\n          return yy_action[j];\n        }\n      }\n#endif /* YYWILDCARD */\n      return yy_default[stateno];\n    }else{\n      return yy_action[i];\n    }\n  }while(1);\n}\n\n/*\n** Find the appropriate action for a parser given the non-terminal\n** look-ahead token iLookAhead.\n*/\nstatic int yy_find_reduce_action(\n  int stateno,              /* Current state number */\n  YYCODETYPE iLookAhead     /* The look-ahead token */\n){\n  int i;\n#ifdef YYERRORSYMBOL\n  if( stateno>YY_REDUCE_COUNT ){\n    return yy_default[stateno];\n  }\n#else\n  assert( stateno<=YY_REDUCE_COUNT );\n#endif\n  i = yy_reduce_ofst[stateno];\n  assert( i!=YY_REDUCE_USE_DFLT );\n  assert( iLookAhead!=YYNOCODE );\n  i += iLookAhead;\n#ifdef YYERRORSYMBOL\n  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){\n    return yy_default[stateno];\n  }\n#else\n  assert( i>=0 && i<YY_ACTTAB_COUNT );\n  assert( yy_lookahead[i]==iLookAhead );\n#endif\n  return yy_action[i];\n}\n\n/*\n** The following routine is called if the stack overflows.\n*/\nstatic void yyStackOverflow(yyParser *yypParser){\n   sqlite3ParserARG_FETCH;\n   yypParser->yytos--;\n#ifndef NDEBUG\n   if( yyTraceFILE ){\n     fprintf(yyTraceFILE,\"%sStack Overflow!\\n\",yyTracePrompt);\n   }\n#endif\n   while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);\n   /* Here code is inserted which will execute if the parser\n   ** stack every overflows */\n/******** Begin %stack_overflow code ******************************************/\n#line 37 \"parse.y\"\n\n  sqlite3ErrorMsg(pParse, \"parser stack overflow\");\n#line 1830 \"parse.c\"\n/******** End %stack_overflow code ********************************************/\n   sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */\n}\n\n/*\n** Print tracing information for a SHIFT action\n*/\n#ifndef NDEBUG\nstatic void yyTraceShift(yyParser *yypParser, int yyNewState){\n  if( yyTraceFILE ){\n    if( yyNewState<YYNSTATE ){\n      fprintf(yyTraceFILE,\"%sShift '%s', go to state %d\\n\",\n         yyTracePrompt,yyTokenName[yypParser->yytos->major],\n         yyNewState);\n    }else{\n      fprintf(yyTraceFILE,\"%sShift '%s'\\n\",\n         yyTracePrompt,yyTokenName[yypParser->yytos->major]);\n    }\n  }\n}\n#else\n# define yyTraceShift(X,Y)\n#endif\n\n/*\n** Perform a shift action.\n*/\nstatic void yy_shift(\n  yyParser *yypParser,          /* The parser to be shifted */\n  int yyNewState,               /* The new state to shift in */\n  int yyMajor,                  /* The major token to shift in */\n  sqlite3ParserTOKENTYPE yyMinor        /* The minor token to shift in */\n){\n  yyStackEntry *yytos;\n  yypParser->yytos++;\n#ifdef YYTRACKMAXSTACKDEPTH\n  if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){\n    yypParser->yyhwm++;\n    assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );\n  }\n#endif\n#if YYSTACKDEPTH>0 \n  if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){\n    yyStackOverflow(yypParser);\n    return;\n  }\n#else\n  if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){\n    if( yyGrowStack(yypParser) ){\n      yyStackOverflow(yypParser);\n      return;\n    }\n  }\n#endif\n  if( yyNewState > YY_MAX_SHIFT ){\n    yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;\n  }\n  yytos = yypParser->yytos;\n  yytos->stateno = (YYACTIONTYPE)yyNewState;\n  yytos->major = (YYCODETYPE)yyMajor;\n  yytos->minor.yy0 = yyMinor;\n  yyTraceShift(yypParser, yyNewState);\n}\n\n/* The following table contains information about every rule that\n** is used during the reduce.\n*/\nstatic const struct {\n  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */\n  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */\n} yyRuleInfo[] = {\n  { 147, 1 },\n  { 147, 3 },\n  { 148, 1 },\n  { 149, 3 },\n  { 150, 0 },\n  { 150, 1 },\n  { 150, 1 },\n  { 150, 1 },\n  { 149, 2 },\n  { 149, 2 },\n  { 149, 2 },\n  { 149, 2 },\n  { 149, 3 },\n  { 149, 5 },\n  { 154, 6 },\n  { 156, 1 },\n  { 158, 0 },\n  { 158, 3 },\n  { 157, 1 },\n  { 157, 0 },\n  { 155, 5 },\n  { 155, 2 },\n  { 162, 0 },\n  { 162, 2 },\n  { 164, 2 },\n  { 166, 0 },\n  { 166, 4 },\n  { 166, 6 },\n  { 167, 2 },\n  { 171, 2 },\n  { 171, 2 },\n  { 171, 4 },\n  { 171, 3 },\n  { 171, 3 },\n  { 171, 2 },\n  { 171, 3 },\n  { 171, 5 },\n  { 171, 2 },\n  { 171, 4 },\n  { 171, 4 },\n  { 171, 1 },\n  { 171, 2 },\n  { 176, 0 },\n  { 176, 1 },\n  { 178, 0 },\n  { 178, 2 },\n  { 180, 2 },\n  { 180, 3 },\n  { 180, 3 },\n  { 180, 3 },\n  { 181, 2 },\n  { 181, 2 },\n  { 181, 1 },\n  { 181, 1 },\n  { 181, 2 },\n  { 179, 3 },\n  { 179, 2 },\n  { 182, 0 },\n  { 182, 2 },\n  { 182, 2 },\n  { 161, 0 },\n  { 184, 1 },\n  { 185, 2 },\n  { 185, 7 },\n  { 185, 5 },\n  { 185, 5 },\n  { 185, 10 },\n  { 188, 0 },\n  { 174, 0 },\n  { 174, 3 },\n  { 189, 0 },\n  { 189, 2 },\n  { 190, 1 },\n  { 190, 1 },\n  { 149, 4 },\n  { 192, 2 },\n  { 192, 0 },\n  { 149, 9 },\n  { 149, 4 },\n  { 149, 1 },\n  { 163, 2 },\n  { 194, 3 },\n  { 197, 1 },\n  { 197, 2 },\n  { 197, 1 },\n  { 195, 9 },\n  { 206, 4 },\n  { 206, 5 },\n  { 198, 1 },\n  { 198, 1 },\n  { 198, 0 },\n  { 209, 0 },\n  { 199, 3 },\n  { 199, 2 },\n  { 199, 4 },\n  { 210, 2 },\n  { 210, 0 },\n  { 200, 0 },\n  { 200, 2 },\n  { 212, 2 },\n  { 212, 0 },\n  { 211, 7 },\n  { 211, 9 },\n  { 211, 7 },\n  { 211, 7 },\n  { 159, 0 },\n  { 159, 2 },\n  { 193, 2 },\n  { 213, 1 },\n  { 213, 2 },\n  { 213, 3 },\n  { 213, 4 },\n  { 215, 2 },\n  { 215, 0 },\n  { 214, 0 },\n  { 214, 3 },\n  { 214, 2 },\n  { 216, 4 },\n  { 216, 0 },\n  { 204, 0 },\n  { 204, 3 },\n  { 186, 4 },\n  { 186, 2 },\n  { 175, 1 },\n  { 175, 1 },\n  { 175, 0 },\n  { 202, 0 },\n  { 202, 3 },\n  { 203, 0 },\n  { 203, 2 },\n  { 205, 0 },\n  { 205, 2 },\n  { 205, 4 },\n  { 205, 4 },\n  { 149, 8 },\n  { 201, 0 },\n  { 201, 2 },\n  { 149, 10 },\n  { 218, 5 },\n  { 218, 7 },\n  { 218, 3 },\n  { 218, 5 },\n  { 149, 6 },\n  { 149, 7 },\n  { 219, 2 },\n  { 219, 1 },\n  { 220, 0 },\n  { 220, 3 },\n  { 217, 3 },\n  { 217, 1 },\n  { 173, 3 },\n  { 172, 1 },\n  { 173, 1 },\n  { 173, 1 },\n  { 173, 3 },\n  { 173, 5 },\n  { 172, 1 },\n  { 172, 1 },\n  { 172, 1 },\n  { 173, 1 },\n  { 173, 3 },\n  { 173, 6 },\n  { 173, 5 },\n  { 173, 4 },\n  { 172, 1 },\n  { 173, 5 },\n  { 173, 3 },\n  { 173, 3 },\n  { 173, 3 },\n  { 173, 3 },\n  { 173, 3 },\n  { 173, 3 },\n  { 173, 3 },\n  { 173, 3 },\n  { 221, 1 },\n  { 221, 2 },\n  { 173, 3 },\n  { 173, 5 },\n  { 173, 2 },\n  { 173, 3 },\n  { 173, 3 },\n  { 173, 4 },\n  { 173, 2 },\n  { 173, 2 },\n  { 173, 2 },\n  { 173, 2 },\n  { 222, 1 },\n  { 222, 2 },\n  { 173, 5 },\n  { 223, 1 },\n  { 223, 2 },\n  { 173, 5 },\n  { 173, 3 },\n  { 173, 5 },\n  { 173, 5 },\n  { 173, 4 },\n  { 173, 5 },\n  { 226, 5 },\n  { 226, 4 },\n  { 227, 2 },\n  { 227, 0 },\n  { 225, 1 },\n  { 225, 0 },\n  { 208, 0 },\n  { 207, 3 },\n  { 207, 1 },\n  { 224, 0 },\n  { 224, 3 },\n  { 149, 12 },\n  { 228, 1 },\n  { 228, 0 },\n  { 177, 0 },\n  { 177, 3 },\n  { 187, 5 },\n  { 187, 3 },\n  { 229, 0 },\n  { 229, 2 },\n  { 149, 4 },\n  { 149, 1 },\n  { 149, 2 },\n  { 149, 3 },\n  { 149, 5 },\n  { 149, 6 },\n  { 149, 5 },\n  { 149, 6 },\n  { 169, 2 },\n  { 170, 2 },\n  { 149, 5 },\n  { 231, 11 },\n  { 233, 1 },\n  { 233, 1 },\n  { 233, 2 },\n  { 233, 0 },\n  { 234, 1 },\n  { 234, 1 },\n  { 234, 3 },\n  { 236, 0 },\n  { 236, 2 },\n  { 232, 3 },\n  { 232, 2 },\n  { 238, 3 },\n  { 239, 3 },\n  { 239, 2 },\n  { 237, 7 },\n  { 237, 5 },\n  { 237, 5 },\n  { 237, 1 },\n  { 173, 4 },\n  { 173, 6 },\n  { 191, 1 },\n  { 191, 1 },\n  { 191, 1 },\n  { 149, 4 },\n  { 149, 6 },\n  { 149, 3 },\n  { 241, 0 },\n  { 241, 2 },\n  { 149, 1 },\n  { 149, 3 },\n  { 149, 1 },\n  { 149, 3 },\n  { 149, 6 },\n  { 149, 7 },\n  { 242, 1 },\n  { 149, 1 },\n  { 149, 4 },\n  { 244, 8 },\n  { 246, 0 },\n  { 247, 1 },\n  { 247, 3 },\n  { 248, 1 },\n  { 196, 0 },\n  { 196, 2 },\n  { 196, 3 },\n  { 250, 6 },\n  { 250, 8 },\n  { 144, 1 },\n  { 145, 2 },\n  { 145, 1 },\n  { 146, 1 },\n  { 146, 3 },\n  { 147, 0 },\n  { 151, 0 },\n  { 151, 1 },\n  { 151, 2 },\n  { 153, 1 },\n  { 153, 0 },\n  { 149, 2 },\n  { 160, 4 },\n  { 160, 2 },\n  { 152, 1 },\n  { 152, 1 },\n  { 152, 1 },\n  { 166, 1 },\n  { 167, 1 },\n  { 168, 1 },\n  { 168, 1 },\n  { 165, 2 },\n  { 165, 0 },\n  { 171, 2 },\n  { 161, 2 },\n  { 183, 3 },\n  { 183, 1 },\n  { 184, 0 },\n  { 188, 1 },\n  { 190, 1 },\n  { 194, 1 },\n  { 195, 1 },\n  { 209, 2 },\n  { 210, 1 },\n  { 173, 1 },\n  { 208, 1 },\n  { 230, 1 },\n  { 230, 1 },\n  { 230, 1 },\n  { 230, 1 },\n  { 230, 1 },\n  { 169, 1 },\n  { 235, 0 },\n  { 235, 3 },\n  { 238, 1 },\n  { 239, 0 },\n  { 240, 1 },\n  { 240, 0 },\n  { 243, 0 },\n  { 243, 1 },\n  { 245, 1 },\n  { 245, 3 },\n  { 246, 2 },\n  { 249, 0 },\n  { 249, 4 },\n  { 249, 2 },\n};\n\nstatic void yy_accept(yyParser*);  /* Forward Declaration */\n\n/*\n** Perform a reduce action and the shift that must immediately\n** follow the reduce.\n*/\nstatic void yy_reduce(\n  yyParser *yypParser,         /* The parser */\n  unsigned int yyruleno        /* Number of the rule by which to reduce */\n){\n  int yygoto;                     /* The next state */\n  int yyact;                      /* The next action */\n  yyStackEntry *yymsp;            /* The top of the parser's stack */\n  int yysize;                     /* Amount to pop the stack */\n  sqlite3ParserARG_FETCH;\n  yymsp = yypParser->yytos;\n#ifndef NDEBUG\n  if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){\n    yysize = yyRuleInfo[yyruleno].nrhs;\n    fprintf(yyTraceFILE, \"%sReduce [%s], go to state %d.\\n\", yyTracePrompt,\n      yyRuleName[yyruleno], yymsp[-yysize].stateno);\n  }\n#endif /* NDEBUG */\n\n  /* Check that the stack is large enough to grow by a single entry\n  ** if the RHS of the rule is empty.  This ensures that there is room\n  ** enough on the stack to push the LHS value */\n  if( yyRuleInfo[yyruleno].nrhs==0 ){\n#ifdef YYTRACKMAXSTACKDEPTH\n    if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){\n      yypParser->yyhwm++;\n      assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));\n    }\n#endif\n#if YYSTACKDEPTH>0 \n    if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){\n      yyStackOverflow(yypParser);\n      return;\n    }\n#else\n    if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){\n      if( yyGrowStack(yypParser) ){\n        yyStackOverflow(yypParser);\n        return;\n      }\n      yymsp = yypParser->yytos;\n    }\n#endif\n  }\n\n  switch( yyruleno ){\n  /* Beginning here are the reduction cases.  A typical example\n  ** follows:\n  **   case 0:\n  **  #line <lineno> <grammarfile>\n  **     { ... }           // User supplied code\n  **  #line <lineno> <thisfile>\n  **     break;\n  */\n/********** Begin reduce actions **********************************************/\n        YYMINORTYPE yylhsminor;\n      case 0: /* explain ::= EXPLAIN */\n#line 113 \"parse.y\"\n{ pParse->explain = 1; }\n#line 2300 \"parse.c\"\n        break;\n      case 1: /* explain ::= EXPLAIN QUERY PLAN */\n#line 114 \"parse.y\"\n{ pParse->explain = 2; }\n#line 2305 \"parse.c\"\n        break;\n      case 2: /* cmdx ::= cmd */\n#line 116 \"parse.y\"\n{ sqlite3FinishCoding(pParse); }\n#line 2310 \"parse.c\"\n        break;\n      case 3: /* cmd ::= BEGIN transtype trans_opt */\n#line 121 \"parse.y\"\n{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy194);}\n#line 2315 \"parse.c\"\n        break;\n      case 4: /* transtype ::= */\n#line 126 \"parse.y\"\n{yymsp[1].minor.yy194 = TK_DEFERRED;}\n#line 2320 \"parse.c\"\n        break;\n      case 5: /* transtype ::= DEFERRED */\n      case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);\n      case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);\n#line 127 \"parse.y\"\n{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/}\n#line 2327 \"parse.c\"\n        break;\n      case 8: /* cmd ::= COMMIT trans_opt */\n      case 9: /* cmd ::= END trans_opt */ yytestcase(yyruleno==9);\n#line 130 \"parse.y\"\n{sqlite3CommitTransaction(pParse);}\n#line 2333 \"parse.c\"\n        break;\n      case 10: /* cmd ::= ROLLBACK trans_opt */\n#line 132 \"parse.y\"\n{sqlite3RollbackTransaction(pParse);}\n#line 2338 \"parse.c\"\n        break;\n      case 11: /* cmd ::= SAVEPOINT nm */\n#line 136 \"parse.y\"\n{\n  sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);\n}\n#line 2345 \"parse.c\"\n        break;\n      case 12: /* cmd ::= RELEASE savepoint_opt nm */\n#line 139 \"parse.y\"\n{\n  sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);\n}\n#line 2352 \"parse.c\"\n        break;\n      case 13: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */\n#line 142 \"parse.y\"\n{\n  sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);\n}\n#line 2359 \"parse.c\"\n        break;\n      case 14: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */\n#line 149 \"parse.y\"\n{\n   sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194);\n}\n#line 2366 \"parse.c\"\n        break;\n      case 15: /* createkw ::= CREATE */\n#line 152 \"parse.y\"\n{disableLookaside(pParse);}\n#line 2371 \"parse.c\"\n        break;\n      case 16: /* ifnotexists ::= */\n      case 19: /* temp ::= */ yytestcase(yyruleno==19);\n      case 22: /* table_options ::= */ yytestcase(yyruleno==22);\n      case 42: /* autoinc ::= */ yytestcase(yyruleno==42);\n      case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);\n      case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);\n      case 76: /* ifexists ::= */ yytestcase(yyruleno==76);\n      case 90: /* distinct ::= */ yytestcase(yyruleno==90);\n      case 215: /* collate ::= */ yytestcase(yyruleno==215);\n#line 155 \"parse.y\"\n{yymsp[1].minor.yy194 = 0;}\n#line 2384 \"parse.c\"\n        break;\n      case 17: /* ifnotexists ::= IF NOT EXISTS */\n#line 156 \"parse.y\"\n{yymsp[-2].minor.yy194 = 1;}\n#line 2389 \"parse.c\"\n        break;\n      case 18: /* temp ::= TEMP */\n      case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);\n#line 159 \"parse.y\"\n{yymsp[0].minor.yy194 = 1;}\n#line 2395 \"parse.c\"\n        break;\n      case 20: /* create_table_args ::= LP columnlist conslist_opt RP table_options */\n#line 162 \"parse.y\"\n{\n  sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0);\n}\n#line 2402 \"parse.c\"\n        break;\n      case 21: /* create_table_args ::= AS select */\n#line 165 \"parse.y\"\n{\n  sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243);\n  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);\n}\n#line 2410 \"parse.c\"\n        break;\n      case 23: /* table_options ::= WITHOUT nm */\n#line 171 \"parse.y\"\n{\n  if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,\"rowid\",5)==0 ){\n    yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid;\n  }else{\n    yymsp[-1].minor.yy194 = 0;\n    sqlite3ErrorMsg(pParse, \"unknown table option: %.*s\", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);\n  }\n}\n#line 2422 \"parse.c\"\n        break;\n      case 24: /* columnname ::= nm typetoken */\n#line 181 \"parse.y\"\n{sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}\n#line 2427 \"parse.c\"\n        break;\n      case 25: /* typetoken ::= */\n      case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);\n      case 96: /* as ::= */ yytestcase(yyruleno==96);\n#line 246 \"parse.y\"\n{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}\n#line 2434 \"parse.c\"\n        break;\n      case 26: /* typetoken ::= typename LP signed RP */\n#line 248 \"parse.y\"\n{\n  yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);\n}\n#line 2441 \"parse.c\"\n        break;\n      case 27: /* typetoken ::= typename LP signed COMMA signed RP */\n#line 251 \"parse.y\"\n{\n  yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);\n}\n#line 2448 \"parse.c\"\n        break;\n      case 28: /* typename ::= typename ID|STRING */\n#line 256 \"parse.y\"\n{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}\n#line 2453 \"parse.c\"\n        break;\n      case 29: /* ccons ::= CONSTRAINT nm */\n      case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);\n#line 265 \"parse.y\"\n{pParse->constraintName = yymsp[0].minor.yy0;}\n#line 2459 \"parse.c\"\n        break;\n      case 30: /* ccons ::= DEFAULT term */\n      case 32: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==32);\n#line 266 \"parse.y\"\n{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);}\n#line 2465 \"parse.c\"\n        break;\n      case 31: /* ccons ::= DEFAULT LP expr RP */\n#line 267 \"parse.y\"\n{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);}\n#line 2470 \"parse.c\"\n        break;\n      case 33: /* ccons ::= DEFAULT MINUS term */\n#line 269 \"parse.y\"\n{\n  ExprSpan v;\n  v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0, 0);\n  v.zStart = yymsp[-1].minor.yy0.z;\n  v.zEnd = yymsp[0].minor.yy190.zEnd;\n  sqlite3AddDefaultValue(pParse,&v);\n}\n#line 2481 \"parse.c\"\n        break;\n      case 34: /* ccons ::= DEFAULT ID|INDEXED */\n#line 276 \"parse.y\"\n{\n  ExprSpan v;\n  spanExpr(&v, pParse, TK_STRING, yymsp[0].minor.yy0);\n  sqlite3AddDefaultValue(pParse,&v);\n}\n#line 2490 \"parse.c\"\n        break;\n      case 35: /* ccons ::= NOT NULL onconf */\n#line 286 \"parse.y\"\n{sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);}\n#line 2495 \"parse.c\"\n        break;\n      case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */\n#line 288 \"parse.y\"\n{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);}\n#line 2500 \"parse.c\"\n        break;\n      case 37: /* ccons ::= UNIQUE onconf */\n#line 289 \"parse.y\"\n{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0,\n                                   SQLITE_IDXTYPE_UNIQUE);}\n#line 2506 \"parse.c\"\n        break;\n      case 38: /* ccons ::= CHECK LP expr RP */\n#line 291 \"parse.y\"\n{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);}\n#line 2511 \"parse.c\"\n        break;\n      case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */\n#line 293 \"parse.y\"\n{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);}\n#line 2516 \"parse.c\"\n        break;\n      case 40: /* ccons ::= defer_subclause */\n#line 294 \"parse.y\"\n{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);}\n#line 2521 \"parse.c\"\n        break;\n      case 41: /* ccons ::= COLLATE ID|STRING */\n#line 295 \"parse.y\"\n{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}\n#line 2526 \"parse.c\"\n        break;\n      case 44: /* refargs ::= */\n#line 308 \"parse.y\"\n{ yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */}\n#line 2531 \"parse.c\"\n        break;\n      case 45: /* refargs ::= refargs refarg */\n#line 309 \"parse.y\"\n{ yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; }\n#line 2536 \"parse.c\"\n        break;\n      case 46: /* refarg ::= MATCH nm */\n#line 311 \"parse.y\"\n{ yymsp[-1].minor.yy497.value = 0;     yymsp[-1].minor.yy497.mask = 0x000000; }\n#line 2541 \"parse.c\"\n        break;\n      case 47: /* refarg ::= ON INSERT refact */\n#line 312 \"parse.y\"\n{ yymsp[-2].minor.yy497.value = 0;     yymsp[-2].minor.yy497.mask = 0x000000; }\n#line 2546 \"parse.c\"\n        break;\n      case 48: /* refarg ::= ON DELETE refact */\n#line 313 \"parse.y\"\n{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194;     yymsp[-2].minor.yy497.mask = 0x0000ff; }\n#line 2551 \"parse.c\"\n        break;\n      case 49: /* refarg ::= ON UPDATE refact */\n#line 314 \"parse.y\"\n{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8;  yymsp[-2].minor.yy497.mask = 0x00ff00; }\n#line 2556 \"parse.c\"\n        break;\n      case 50: /* refact ::= SET NULL */\n#line 316 \"parse.y\"\n{ yymsp[-1].minor.yy194 = OE_SetNull;  /* EV: R-33326-45252 */}\n#line 2561 \"parse.c\"\n        break;\n      case 51: /* refact ::= SET DEFAULT */\n#line 317 \"parse.y\"\n{ yymsp[-1].minor.yy194 = OE_SetDflt;  /* EV: R-33326-45252 */}\n#line 2566 \"parse.c\"\n        break;\n      case 52: /* refact ::= CASCADE */\n#line 318 \"parse.y\"\n{ yymsp[0].minor.yy194 = OE_Cascade;  /* EV: R-33326-45252 */}\n#line 2571 \"parse.c\"\n        break;\n      case 53: /* refact ::= RESTRICT */\n#line 319 \"parse.y\"\n{ yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */}\n#line 2576 \"parse.c\"\n        break;\n      case 54: /* refact ::= NO ACTION */\n#line 320 \"parse.y\"\n{ yymsp[-1].minor.yy194 = OE_None;     /* EV: R-33326-45252 */}\n#line 2581 \"parse.c\"\n        break;\n      case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */\n#line 322 \"parse.y\"\n{yymsp[-2].minor.yy194 = 0;}\n#line 2586 \"parse.c\"\n        break;\n      case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */\n      case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);\n      case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);\n#line 323 \"parse.y\"\n{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}\n#line 2593 \"parse.c\"\n        break;\n      case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */\n      case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);\n      case 187: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==187);\n      case 190: /* in_op ::= NOT IN */ yytestcase(yyruleno==190);\n      case 216: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==216);\n#line 326 \"parse.y\"\n{yymsp[-1].minor.yy194 = 1;}\n#line 2602 \"parse.c\"\n        break;\n      case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */\n#line 327 \"parse.y\"\n{yymsp[-1].minor.yy194 = 0;}\n#line 2607 \"parse.c\"\n        break;\n      case 61: /* tconscomma ::= COMMA */\n#line 333 \"parse.y\"\n{pParse->constraintName.n = 0;}\n#line 2612 \"parse.c\"\n        break;\n      case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */\n#line 337 \"parse.y\"\n{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);}\n#line 2617 \"parse.c\"\n        break;\n      case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */\n#line 339 \"parse.y\"\n{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0,\n                                       SQLITE_IDXTYPE_UNIQUE);}\n#line 2623 \"parse.c\"\n        break;\n      case 65: /* tcons ::= CHECK LP expr RP onconf */\n#line 342 \"parse.y\"\n{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);}\n#line 2628 \"parse.c\"\n        break;\n      case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */\n#line 344 \"parse.y\"\n{\n    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194);\n    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194);\n}\n#line 2636 \"parse.c\"\n        break;\n      case 68: /* onconf ::= */\n      case 70: /* orconf ::= */ yytestcase(yyruleno==70);\n#line 358 \"parse.y\"\n{yymsp[1].minor.yy194 = OE_Default;}\n#line 2642 \"parse.c\"\n        break;\n      case 69: /* onconf ::= ON CONFLICT resolvetype */\n#line 359 \"parse.y\"\n{yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;}\n#line 2647 \"parse.c\"\n        break;\n      case 72: /* resolvetype ::= IGNORE */\n#line 363 \"parse.y\"\n{yymsp[0].minor.yy194 = OE_Ignore;}\n#line 2652 \"parse.c\"\n        break;\n      case 73: /* resolvetype ::= REPLACE */\n      case 145: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==145);\n#line 364 \"parse.y\"\n{yymsp[0].minor.yy194 = OE_Replace;}\n#line 2658 \"parse.c\"\n        break;\n      case 74: /* cmd ::= DROP TABLE ifexists fullname */\n#line 368 \"parse.y\"\n{\n  sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194);\n}\n#line 2665 \"parse.c\"\n        break;\n      case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */\n#line 379 \"parse.y\"\n{\n  sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194);\n}\n#line 2672 \"parse.c\"\n        break;\n      case 78: /* cmd ::= DROP VIEW ifexists fullname */\n#line 382 \"parse.y\"\n{\n  sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194);\n}\n#line 2679 \"parse.c\"\n        break;\n      case 79: /* cmd ::= select */\n#line 389 \"parse.y\"\n{\n  SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};\n  sqlite3Select(pParse, yymsp[0].minor.yy243, &dest);\n  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);\n}\n#line 2688 \"parse.c\"\n        break;\n      case 80: /* select ::= with selectnowith */\n#line 426 \"parse.y\"\n{\n  Select *p = yymsp[0].minor.yy243;\n  if( p ){\n    p->pWith = yymsp[-1].minor.yy285;\n    parserDoubleLinkSelect(pParse, p);\n  }else{\n    sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy285);\n  }\n  yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/\n}\n#line 2702 \"parse.c\"\n        break;\n      case 81: /* selectnowith ::= selectnowith multiselect_op oneselect */\n#line 439 \"parse.y\"\n{\n  Select *pRhs = yymsp[0].minor.yy243;\n  Select *pLhs = yymsp[-2].minor.yy243;\n  if( pRhs && pRhs->pPrior ){\n    SrcList *pFrom;\n    Token x;\n    x.n = 0;\n    parserDoubleLinkSelect(pParse, pRhs);\n    pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);\n    pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0,0);\n  }\n  if( pRhs ){\n    pRhs->op = (u8)yymsp[-1].minor.yy194;\n    pRhs->pPrior = pLhs;\n    if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;\n    pRhs->selFlags &= ~SF_MultiValue;\n    if( yymsp[-1].minor.yy194!=TK_ALL ) pParse->hasCompound = 1;\n  }else{\n    sqlite3SelectDelete(pParse->db, pLhs);\n  }\n  yymsp[-2].minor.yy243 = pRhs;\n}\n#line 2728 \"parse.c\"\n        break;\n      case 82: /* multiselect_op ::= UNION */\n      case 84: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==84);\n#line 462 \"parse.y\"\n{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/}\n#line 2734 \"parse.c\"\n        break;\n      case 83: /* multiselect_op ::= UNION ALL */\n#line 463 \"parse.y\"\n{yymsp[-1].minor.yy194 = TK_ALL;}\n#line 2739 \"parse.c\"\n        break;\n      case 85: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */\n#line 467 \"parse.y\"\n{\n#if SELECTTRACE_ENABLED\n  Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/\n#endif\n  yymsp[-8].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy148,yymsp[-5].minor.yy185,yymsp[-4].minor.yy72,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-1].minor.yy148,yymsp[-7].minor.yy194,yymsp[0].minor.yy354.pLimit,yymsp[0].minor.yy354.pOffset);\n#if SELECTTRACE_ENABLED\n  /* Populate the Select.zSelName[] string that is used to help with\n  ** query planner debugging, to differentiate between multiple Select\n  ** objects in a complex query.\n  **\n  ** If the SELECT keyword is immediately followed by a C-style comment\n  ** then extract the first few alphanumeric characters from within that\n  ** comment to be the zSelName value.  Otherwise, the label is #N where\n  ** is an integer that is incremented with each SELECT statement seen.\n  */\n  if( yymsp[-8].minor.yy243!=0 ){\n    const char *z = s.z+6;\n    int i;\n    sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, \"#%d\",\n                     ++pParse->nSelect);\n    while( z[0]==' ' ) z++;\n    if( z[0]=='/' && z[1]=='*' ){\n      z += 2;\n      while( z[0]==' ' ) z++;\n      for(i=0; sqlite3Isalnum(z[i]); i++){}\n      sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, \"%.*s\", i, z);\n    }\n  }\n#endif /* SELECTRACE_ENABLED */\n}\n#line 2773 \"parse.c\"\n        break;\n      case 86: /* values ::= VALUES LP nexprlist RP */\n#line 501 \"parse.y\"\n{\n  yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0);\n}\n#line 2780 \"parse.c\"\n        break;\n      case 87: /* values ::= values COMMA LP exprlist RP */\n#line 504 \"parse.y\"\n{\n  Select *pRight, *pLeft = yymsp[-4].minor.yy243;\n  pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0);\n  if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;\n  if( pRight ){\n    pRight->op = TK_ALL;\n    pRight->pPrior = pLeft;\n    yymsp[-4].minor.yy243 = pRight;\n  }else{\n    yymsp[-4].minor.yy243 = pLeft;\n  }\n}\n#line 2796 \"parse.c\"\n        break;\n      case 88: /* distinct ::= DISTINCT */\n#line 521 \"parse.y\"\n{yymsp[0].minor.yy194 = SF_Distinct;}\n#line 2801 \"parse.c\"\n        break;\n      case 89: /* distinct ::= ALL */\n#line 522 \"parse.y\"\n{yymsp[0].minor.yy194 = SF_All;}\n#line 2806 \"parse.c\"\n        break;\n      case 91: /* sclp ::= */\n      case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);\n      case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);\n      case 203: /* exprlist ::= */ yytestcase(yyruleno==203);\n      case 206: /* paren_exprlist ::= */ yytestcase(yyruleno==206);\n      case 211: /* eidlist_opt ::= */ yytestcase(yyruleno==211);\n#line 535 \"parse.y\"\n{yymsp[1].minor.yy148 = 0;}\n#line 2816 \"parse.c\"\n        break;\n      case 92: /* selcollist ::= sclp expr as */\n#line 536 \"parse.y\"\n{\n   yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);\n   if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1);\n   sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190);\n}\n#line 2825 \"parse.c\"\n        break;\n      case 93: /* selcollist ::= sclp STAR */\n#line 541 \"parse.y\"\n{\n  Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);\n  yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p);\n}\n#line 2833 \"parse.c\"\n        break;\n      case 94: /* selcollist ::= sclp nm DOT STAR */\n#line 545 \"parse.y\"\n{\n  Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0, 0);\n  Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);\n  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);\n  yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);\n}\n#line 2843 \"parse.c\"\n        break;\n      case 95: /* as ::= AS nm */\n      case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);\n      case 225: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==225);\n      case 226: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==226);\n#line 556 \"parse.y\"\n{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}\n#line 2851 \"parse.c\"\n        break;\n      case 97: /* from ::= */\n#line 570 \"parse.y\"\n{yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}\n#line 2856 \"parse.c\"\n        break;\n      case 98: /* from ::= FROM seltablist */\n#line 571 \"parse.y\"\n{\n  yymsp[-1].minor.yy185 = yymsp[0].minor.yy185;\n  sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185);\n}\n#line 2864 \"parse.c\"\n        break;\n      case 99: /* stl_prefix ::= seltablist joinop */\n#line 579 \"parse.y\"\n{\n   if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194;\n}\n#line 2871 \"parse.c\"\n        break;\n      case 100: /* stl_prefix ::= */\n#line 582 \"parse.y\"\n{yymsp[1].minor.yy185 = 0;}\n#line 2876 \"parse.c\"\n        break;\n      case 101: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */\n#line 584 \"parse.y\"\n{\n  yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);\n  sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0);\n}\n#line 2884 \"parse.c\"\n        break;\n      case 102: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */\n#line 589 \"parse.y\"\n{\n  yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);\n  sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148);\n}\n#line 2892 \"parse.c\"\n        break;\n      case 103: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */\n#line 595 \"parse.y\"\n{\n    yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);\n  }\n#line 2899 \"parse.c\"\n        break;\n      case 104: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */\n#line 599 \"parse.y\"\n{\n    if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){\n      yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185;\n    }else if( yymsp[-4].minor.yy185->nSrc==1 ){\n      yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);\n      if( yymsp[-6].minor.yy185 ){\n        struct SrcList_item *pNew = &yymsp[-6].minor.yy185->a[yymsp[-6].minor.yy185->nSrc-1];\n        struct SrcList_item *pOld = yymsp[-4].minor.yy185->a;\n        pNew->zName = pOld->zName;\n        pNew->zDatabase = pOld->zDatabase;\n        pNew->pSelect = pOld->pSelect;\n        pOld->zName = pOld->zDatabase = 0;\n        pOld->pSelect = 0;\n      }\n      sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy185);\n    }else{\n      Select *pSubquery;\n      sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy185);\n      pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy185,0,0,0,0,SF_NestedFrom,0,0);\n      yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);\n    }\n  }\n#line 2925 \"parse.c\"\n        break;\n      case 105: /* dbnm ::= */\n      case 114: /* indexed_opt ::= */ yytestcase(yyruleno==114);\n#line 624 \"parse.y\"\n{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}\n#line 2931 \"parse.c\"\n        break;\n      case 107: /* fullname ::= nm dbnm */\n#line 630 \"parse.y\"\n{yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}\n#line 2936 \"parse.c\"\n        break;\n      case 108: /* joinop ::= COMMA|JOIN */\n#line 633 \"parse.y\"\n{ yymsp[0].minor.yy194 = JT_INNER; }\n#line 2941 \"parse.c\"\n        break;\n      case 109: /* joinop ::= JOIN_KW JOIN */\n#line 635 \"parse.y\"\n{yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0);  /*X-overwrites-A*/}\n#line 2946 \"parse.c\"\n        break;\n      case 110: /* joinop ::= JOIN_KW nm JOIN */\n#line 637 \"parse.y\"\n{yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}\n#line 2951 \"parse.c\"\n        break;\n      case 111: /* joinop ::= JOIN_KW nm nm JOIN */\n#line 639 \"parse.y\"\n{yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}\n#line 2956 \"parse.c\"\n        break;\n      case 112: /* on_opt ::= ON expr */\n      case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);\n      case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);\n      case 199: /* case_else ::= ELSE expr */ yytestcase(yyruleno==199);\n#line 643 \"parse.y\"\n{yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}\n#line 2964 \"parse.c\"\n        break;\n      case 113: /* on_opt ::= */\n      case 128: /* having_opt ::= */ yytestcase(yyruleno==128);\n      case 135: /* where_opt ::= */ yytestcase(yyruleno==135);\n      case 200: /* case_else ::= */ yytestcase(yyruleno==200);\n      case 202: /* case_operand ::= */ yytestcase(yyruleno==202);\n#line 644 \"parse.y\"\n{yymsp[1].minor.yy72 = 0;}\n#line 2973 \"parse.c\"\n        break;\n      case 115: /* indexed_opt ::= INDEXED BY nm */\n#line 658 \"parse.y\"\n{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}\n#line 2978 \"parse.c\"\n        break;\n      case 116: /* indexed_opt ::= NOT INDEXED */\n#line 659 \"parse.y\"\n{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}\n#line 2983 \"parse.c\"\n        break;\n      case 117: /* using_opt ::= USING LP idlist RP */\n#line 663 \"parse.y\"\n{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;}\n#line 2988 \"parse.c\"\n        break;\n      case 118: /* using_opt ::= */\n      case 146: /* idlist_opt ::= */ yytestcase(yyruleno==146);\n#line 664 \"parse.y\"\n{yymsp[1].minor.yy254 = 0;}\n#line 2994 \"parse.c\"\n        break;\n      case 120: /* orderby_opt ::= ORDER BY sortlist */\n      case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127);\n#line 678 \"parse.y\"\n{yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;}\n#line 3000 \"parse.c\"\n        break;\n      case 121: /* sortlist ::= sortlist COMMA expr sortorder */\n#line 679 \"parse.y\"\n{\n  yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr);\n  sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194);\n}\n#line 3008 \"parse.c\"\n        break;\n      case 122: /* sortlist ::= expr sortorder */\n#line 683 \"parse.y\"\n{\n  yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/\n  sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194);\n}\n#line 3016 \"parse.c\"\n        break;\n      case 123: /* sortorder ::= ASC */\n#line 690 \"parse.y\"\n{yymsp[0].minor.yy194 = SQLITE_SO_ASC;}\n#line 3021 \"parse.c\"\n        break;\n      case 124: /* sortorder ::= DESC */\n#line 691 \"parse.y\"\n{yymsp[0].minor.yy194 = SQLITE_SO_DESC;}\n#line 3026 \"parse.c\"\n        break;\n      case 125: /* sortorder ::= */\n#line 692 \"parse.y\"\n{yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;}\n#line 3031 \"parse.c\"\n        break;\n      case 130: /* limit_opt ::= */\n#line 717 \"parse.y\"\n{yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;}\n#line 3036 \"parse.c\"\n        break;\n      case 131: /* limit_opt ::= LIMIT expr */\n#line 718 \"parse.y\"\n{yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;}\n#line 3041 \"parse.c\"\n        break;\n      case 132: /* limit_opt ::= LIMIT expr OFFSET expr */\n#line 720 \"parse.y\"\n{yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;}\n#line 3046 \"parse.c\"\n        break;\n      case 133: /* limit_opt ::= LIMIT expr COMMA expr */\n#line 722 \"parse.y\"\n{yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;}\n#line 3051 \"parse.c\"\n        break;\n      case 134: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt orderby_opt limit_opt */\n#line 728 \"parse.y\"\n{\n  sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1);\n  sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0);\n  yymsp[-2].minor.yy72 = sqlite3LimitWhere(pParse, yymsp[-4].minor.yy185, yymsp[-2].minor.yy72, yymsp[-1].minor.yy148, yymsp[0].minor.yy354.pLimit, yymsp[0].minor.yy354.pOffset, \"DELETE\");\n  sqlite3DeleteFrom(pParse,yymsp[-4].minor.yy185,yymsp[-2].minor.yy72);\n}\n#line 3061 \"parse.c\"\n        break;\n      case 137: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt orderby_opt limit_opt */\n#line 753 \"parse.y\"\n{\n  sqlite3WithPush(pParse, yymsp[-9].minor.yy285, 1);\n  sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-5].minor.yy0);\n  sqlite3ExprListCheckLength(pParse,yymsp[-3].minor.yy148,\"set list\"); \n  yymsp[-2].minor.yy72 = sqlite3LimitWhere(pParse, yymsp[-6].minor.yy185, yymsp[-2].minor.yy72, yymsp[-1].minor.yy148, yymsp[0].minor.yy354.pLimit, yymsp[0].minor.yy354.pOffset, \"UPDATE\");\n  sqlite3Update(pParse,yymsp[-6].minor.yy185,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-7].minor.yy194);\n}\n#line 3072 \"parse.c\"\n        break;\n      case 138: /* setlist ::= setlist COMMA nm EQ expr */\n#line 774 \"parse.y\"\n{\n  yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);\n  sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1);\n}\n#line 3080 \"parse.c\"\n        break;\n      case 139: /* setlist ::= setlist COMMA LP idlist RP EQ expr */\n#line 778 \"parse.y\"\n{\n  yymsp[-6].minor.yy148 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy148, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);\n}\n#line 3087 \"parse.c\"\n        break;\n      case 140: /* setlist ::= nm EQ expr */\n#line 781 \"parse.y\"\n{\n  yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr);\n  sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1);\n}\n#line 3095 \"parse.c\"\n  yymsp[-2].minor.yy148 = yylhsminor.yy148;\n        break;\n      case 141: /* setlist ::= LP idlist RP EQ expr */\n#line 785 \"parse.y\"\n{\n  yymsp[-4].minor.yy148 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);\n}\n#line 3103 \"parse.c\"\n        break;\n      case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */\n#line 791 \"parse.y\"\n{\n  sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);\n  sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194);\n}\n#line 3111 \"parse.c\"\n        break;\n      case 143: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */\n#line 796 \"parse.y\"\n{\n  sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1);\n  sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194);\n}\n#line 3119 \"parse.c\"\n        break;\n      case 147: /* idlist_opt ::= LP idlist RP */\n#line 811 \"parse.y\"\n{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}\n#line 3124 \"parse.c\"\n        break;\n      case 148: /* idlist ::= idlist COMMA nm */\n#line 813 \"parse.y\"\n{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}\n#line 3129 \"parse.c\"\n        break;\n      case 149: /* idlist ::= nm */\n#line 815 \"parse.y\"\n{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}\n#line 3134 \"parse.c\"\n        break;\n      case 150: /* expr ::= LP expr RP */\n#line 865 \"parse.y\"\n{spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/  yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;}\n#line 3139 \"parse.c\"\n        break;\n      case 151: /* term ::= NULL */\n      case 156: /* term ::= FLOAT|BLOB */ yytestcase(yyruleno==156);\n      case 157: /* term ::= STRING */ yytestcase(yyruleno==157);\n#line 866 \"parse.y\"\n{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/}\n#line 3146 \"parse.c\"\n        break;\n      case 152: /* expr ::= ID|INDEXED */\n      case 153: /* expr ::= JOIN_KW */ yytestcase(yyruleno==153);\n#line 867 \"parse.y\"\n{spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}\n#line 3152 \"parse.c\"\n        break;\n      case 154: /* expr ::= nm DOT nm */\n#line 869 \"parse.y\"\n{\n  Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);\n  Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);\n  spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/\n  yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);\n}\n#line 3162 \"parse.c\"\n        break;\n      case 155: /* expr ::= nm DOT nm DOT nm */\n#line 875 \"parse.y\"\n{\n  Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);\n  Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);\n  Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);\n  Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);\n  spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/\n  yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);\n}\n#line 3174 \"parse.c\"\n        break;\n      case 158: /* term ::= INTEGER */\n#line 885 \"parse.y\"\n{\n  yylhsminor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);\n  yylhsminor.yy190.zStart = yymsp[0].minor.yy0.z;\n  yylhsminor.yy190.zEnd = yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n;\n  if( yylhsminor.yy190.pExpr ) yylhsminor.yy190.pExpr->flags |= EP_Leaf;\n}\n#line 3184 \"parse.c\"\n  yymsp[0].minor.yy190 = yylhsminor.yy190;\n        break;\n      case 159: /* expr ::= VARIABLE */\n#line 891 \"parse.y\"\n{\n  if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){\n    u32 n = yymsp[0].minor.yy0.n;\n    spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0);\n    sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr, n);\n  }else{\n    /* When doing a nested parse, one can include terms in an expression\n    ** that look like this:   #1 #2 ...  These terms refer to registers\n    ** in the virtual machine.  #N is the N-th register. */\n    Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/\n    assert( t.n>=2 );\n    spanSet(&yymsp[0].minor.yy190, &t, &t);\n    if( pParse->nested==0 ){\n      sqlite3ErrorMsg(pParse, \"near \\\"%T\\\": syntax error\", &t);\n      yymsp[0].minor.yy190.pExpr = 0;\n    }else{\n      yymsp[0].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, 0);\n      if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable);\n    }\n  }\n}\n#line 3210 \"parse.c\"\n        break;\n      case 160: /* expr ::= expr COLLATE ID|STRING */\n#line 912 \"parse.y\"\n{\n  yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1);\n  yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\n}\n#line 3218 \"parse.c\"\n        break;\n      case 161: /* expr ::= CAST LP expr AS typetoken RP */\n#line 917 \"parse.y\"\n{\n  spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/\n  yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy190.pExpr, 0, &yymsp[-1].minor.yy0);\n}\n#line 3226 \"parse.c\"\n        break;\n      case 162: /* expr ::= ID|INDEXED LP distinct exprlist RP */\n#line 922 \"parse.y\"\n{\n  if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){\n    sqlite3ErrorMsg(pParse, \"too many arguments on function %T\", &yymsp[-4].minor.yy0);\n  }\n  yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0);\n  spanSet(&yylhsminor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);\n  if( yymsp[-2].minor.yy194==SF_Distinct && yylhsminor.yy190.pExpr ){\n    yylhsminor.yy190.pExpr->flags |= EP_Distinct;\n  }\n}\n#line 3240 \"parse.c\"\n  yymsp[-4].minor.yy190 = yylhsminor.yy190;\n        break;\n      case 163: /* expr ::= ID|INDEXED LP STAR RP */\n#line 932 \"parse.y\"\n{\n  yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);\n  spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);\n}\n#line 3249 \"parse.c\"\n  yymsp[-3].minor.yy190 = yylhsminor.yy190;\n        break;\n      case 164: /* term ::= CTIME_KW */\n#line 936 \"parse.y\"\n{\n  yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);\n  spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);\n}\n#line 3258 \"parse.c\"\n  yymsp[0].minor.yy190 = yylhsminor.yy190;\n        break;\n      case 165: /* expr ::= LP nexprlist COMMA expr RP */\n#line 965 \"parse.y\"\n{\n  ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy148, yymsp[-1].minor.yy190.pExpr);\n  yylhsminor.yy190.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0, 0);\n  if( yylhsminor.yy190.pExpr ){\n    yylhsminor.yy190.pExpr->x.pList = pList;\n    spanSet(&yylhsminor.yy190, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);\n  }else{\n    sqlite3ExprListDelete(pParse->db, pList);\n  }\n}\n#line 3273 \"parse.c\"\n  yymsp[-4].minor.yy190 = yylhsminor.yy190;\n        break;\n      case 166: /* expr ::= expr AND expr */\n      case 167: /* expr ::= expr OR expr */ yytestcase(yyruleno==167);\n      case 168: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==168);\n      case 169: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==169);\n      case 170: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==170);\n      case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);\n      case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);\n      case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);\n#line 976 \"parse.y\"\n{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}\n#line 3286 \"parse.c\"\n        break;\n      case 174: /* likeop ::= LIKE_KW|MATCH */\n#line 989 \"parse.y\"\n{yymsp[0].minor.yy0=yymsp[0].minor.yy0;/*A-overwrites-X*/}\n#line 3291 \"parse.c\"\n        break;\n      case 175: /* likeop ::= NOT LIKE_KW|MATCH */\n#line 990 \"parse.y\"\n{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}\n#line 3296 \"parse.c\"\n        break;\n      case 176: /* expr ::= expr likeop expr */\n#line 991 \"parse.y\"\n{\n  ExprList *pList;\n  int bNot = yymsp[-1].minor.yy0.n & 0x80000000;\n  yymsp[-1].minor.yy0.n &= 0x7fffffff;\n  pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy190.pExpr);\n  yymsp[-2].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0);\n  exprNot(pParse, bNot, &yymsp[-2].minor.yy190);\n  yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;\n  if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;\n}\n#line 3311 \"parse.c\"\n        break;\n      case 177: /* expr ::= expr likeop expr ESCAPE expr */\n#line 1002 \"parse.y\"\n{\n  ExprList *pList;\n  int bNot = yymsp[-3].minor.yy0.n & 0x80000000;\n  yymsp[-3].minor.yy0.n &= 0x7fffffff;\n  pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy190.pExpr);\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);\n  yymsp[-4].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0);\n  exprNot(pParse, bNot, &yymsp[-4].minor.yy190);\n  yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;\n  if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;\n}\n#line 3327 \"parse.c\"\n        break;\n      case 178: /* expr ::= expr ISNULL|NOTNULL */\n#line 1029 \"parse.y\"\n{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}\n#line 3332 \"parse.c\"\n        break;\n      case 179: /* expr ::= expr NOT NULL */\n#line 1030 \"parse.y\"\n{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}\n#line 3337 \"parse.c\"\n        break;\n      case 180: /* expr ::= expr IS expr */\n#line 1051 \"parse.y\"\n{\n  spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);\n  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);\n}\n#line 3345 \"parse.c\"\n        break;\n      case 181: /* expr ::= expr IS NOT expr */\n#line 1055 \"parse.y\"\n{\n  spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);\n  binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);\n}\n#line 3353 \"parse.c\"\n        break;\n      case 182: /* expr ::= NOT expr */\n      case 183: /* expr ::= BITNOT expr */ yytestcase(yyruleno==183);\n#line 1079 \"parse.y\"\n{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}\n#line 3359 \"parse.c\"\n        break;\n      case 184: /* expr ::= MINUS expr */\n#line 1083 \"parse.y\"\n{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}\n#line 3364 \"parse.c\"\n        break;\n      case 185: /* expr ::= PLUS expr */\n#line 1085 \"parse.y\"\n{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}\n#line 3369 \"parse.c\"\n        break;\n      case 186: /* between_op ::= BETWEEN */\n      case 189: /* in_op ::= IN */ yytestcase(yyruleno==189);\n#line 1088 \"parse.y\"\n{yymsp[0].minor.yy194 = 0;}\n#line 3375 \"parse.c\"\n        break;\n      case 188: /* expr ::= expr between_op expr AND expr */\n#line 1090 \"parse.y\"\n{\n  ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);\n  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);\n  yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0, 0);\n  if( yymsp[-4].minor.yy190.pExpr ){\n    yymsp[-4].minor.yy190.pExpr->x.pList = pList;\n  }else{\n    sqlite3ExprListDelete(pParse->db, pList);\n  } \n  exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);\n  yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;\n}\n#line 3391 \"parse.c\"\n        break;\n      case 191: /* expr ::= expr in_op LP exprlist RP */\n#line 1106 \"parse.y\"\n{\n    if( yymsp[-1].minor.yy148==0 ){\n      /* Expressions of the form\n      **\n      **      expr1 IN ()\n      **      expr1 NOT IN ()\n      **\n      ** simplify to constants 0 (false) and 1 (true), respectively,\n      ** regardless of the value of expr1.\n      */\n      sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy190.pExpr);\n      yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy194]);\n    }else if( yymsp[-1].minor.yy148->nExpr==1 ){\n      /* Expressions of the form:\n      **\n      **      expr1 IN (?1)\n      **      expr1 NOT IN (?2)\n      **\n      ** with exactly one value on the RHS can be simplified to something\n      ** like this:\n      **\n      **      expr1 == ?1\n      **      expr1 <> ?2\n      **\n      ** But, the RHS of the == or <> is marked with the EP_Generic flag\n      ** so that it may not contribute to the computation of comparison\n      ** affinity or the collating sequence to use for comparison.  Otherwise,\n      ** the semantics would be subtly different from IN or NOT IN.\n      */\n      Expr *pRHS = yymsp[-1].minor.yy148->a[0].pExpr;\n      yymsp[-1].minor.yy148->a[0].pExpr = 0;\n      sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148);\n      /* pRHS cannot be NULL because a malloc error would have been detected\n      ** before now and control would have never reached this point */\n      if( ALWAYS(pRHS) ){\n        pRHS->flags &= ~EP_Collate;\n        pRHS->flags |= EP_Generic;\n      }\n      yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, yymsp[-3].minor.yy194 ? TK_NE : TK_EQ, yymsp[-4].minor.yy190.pExpr, pRHS, 0);\n    }else{\n      yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0);\n      if( yymsp[-4].minor.yy190.pExpr ){\n        yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy148;\n        sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr);\n      }else{\n        sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148);\n      }\n      exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);\n    }\n    yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\n  }\n#line 3446 \"parse.c\"\n        break;\n      case 192: /* expr ::= LP select RP */\n#line 1157 \"parse.y\"\n{\n    spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/\n    yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);\n    sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);\n  }\n#line 3455 \"parse.c\"\n        break;\n      case 193: /* expr ::= expr in_op LP select RP */\n#line 1162 \"parse.y\"\n{\n    yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0);\n    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);\n    exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);\n    yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];\n  }\n#line 3465 \"parse.c\"\n        break;\n      case 194: /* expr ::= expr in_op nm dbnm paren_exprlist */\n#line 1168 \"parse.y\"\n{\n    SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);\n    Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);\n    if( yymsp[0].minor.yy148 )  sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);\n    yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0);\n    sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);\n    exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);\n    yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];\n  }\n#line 3478 \"parse.c\"\n        break;\n      case 195: /* expr ::= EXISTS LP select RP */\n#line 1177 \"parse.y\"\n{\n    Expr *p;\n    spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/\n    p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);\n    sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);\n  }\n#line 3488 \"parse.c\"\n        break;\n      case 196: /* expr ::= CASE case_operand case_exprlist case_else END */\n#line 1186 \"parse.y\"\n{\n  spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-C*/\n  yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0, 0);\n  if( yymsp[-4].minor.yy190.pExpr ){\n    yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;\n    sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr);\n  }else{\n    sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);\n    sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);\n  }\n}\n#line 3503 \"parse.c\"\n        break;\n      case 197: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */\n#line 1199 \"parse.y\"\n{\n  yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);\n  yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);\n}\n#line 3511 \"parse.c\"\n        break;\n      case 198: /* case_exprlist ::= WHEN expr THEN expr */\n#line 1203 \"parse.y\"\n{\n  yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);\n  yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);\n}\n#line 3519 \"parse.c\"\n        break;\n      case 201: /* case_operand ::= expr */\n#line 1213 \"parse.y\"\n{yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}\n#line 3524 \"parse.c\"\n        break;\n      case 204: /* nexprlist ::= nexprlist COMMA expr */\n#line 1224 \"parse.y\"\n{yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}\n#line 3529 \"parse.c\"\n        break;\n      case 205: /* nexprlist ::= expr */\n#line 1226 \"parse.y\"\n{yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}\n#line 3534 \"parse.c\"\n        break;\n      case 207: /* paren_exprlist ::= LP exprlist RP */\n      case 212: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==212);\n#line 1234 \"parse.y\"\n{yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}\n#line 3540 \"parse.c\"\n        break;\n      case 208: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */\n#line 1241 \"parse.y\"\n{\n  sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, \n                     sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,\n                      &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);\n}\n#line 3549 \"parse.c\"\n        break;\n      case 209: /* uniqueflag ::= UNIQUE */\n      case 250: /* raisetype ::= ABORT */ yytestcase(yyruleno==250);\n#line 1248 \"parse.y\"\n{yymsp[0].minor.yy194 = OE_Abort;}\n#line 3555 \"parse.c\"\n        break;\n      case 210: /* uniqueflag ::= */\n#line 1249 \"parse.y\"\n{yymsp[1].minor.yy194 = OE_None;}\n#line 3560 \"parse.c\"\n        break;\n      case 213: /* eidlist ::= eidlist COMMA nm collate sortorder */\n#line 1299 \"parse.y\"\n{\n  yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);\n}\n#line 3567 \"parse.c\"\n        break;\n      case 214: /* eidlist ::= nm collate sortorder */\n#line 1302 \"parse.y\"\n{\n  yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/\n}\n#line 3574 \"parse.c\"\n        break;\n      case 217: /* cmd ::= DROP INDEX ifexists fullname */\n#line 1313 \"parse.y\"\n{sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}\n#line 3579 \"parse.c\"\n        break;\n      case 218: /* cmd ::= VACUUM */\n#line 1319 \"parse.y\"\n{sqlite3Vacuum(pParse,0);}\n#line 3584 \"parse.c\"\n        break;\n      case 219: /* cmd ::= VACUUM nm */\n#line 1320 \"parse.y\"\n{sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}\n#line 3589 \"parse.c\"\n        break;\n      case 220: /* cmd ::= PRAGMA nm dbnm */\n#line 1327 \"parse.y\"\n{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}\n#line 3594 \"parse.c\"\n        break;\n      case 221: /* cmd ::= PRAGMA nm dbnm EQ nmnum */\n#line 1328 \"parse.y\"\n{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}\n#line 3599 \"parse.c\"\n        break;\n      case 222: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */\n#line 1329 \"parse.y\"\n{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}\n#line 3604 \"parse.c\"\n        break;\n      case 223: /* cmd ::= PRAGMA nm dbnm EQ minus_num */\n#line 1331 \"parse.y\"\n{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}\n#line 3609 \"parse.c\"\n        break;\n      case 224: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */\n#line 1333 \"parse.y\"\n{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}\n#line 3614 \"parse.c\"\n        break;\n      case 227: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */\n#line 1349 \"parse.y\"\n{\n  Token all;\n  all.z = yymsp[-3].minor.yy0.z;\n  all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;\n  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);\n}\n#line 3624 \"parse.c\"\n        break;\n      case 228: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */\n#line 1358 \"parse.y\"\n{\n  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);\n  yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/\n}\n#line 3632 \"parse.c\"\n        break;\n      case 229: /* trigger_time ::= BEFORE */\n#line 1364 \"parse.y\"\n{ yymsp[0].minor.yy194 = TK_BEFORE; }\n#line 3637 \"parse.c\"\n        break;\n      case 230: /* trigger_time ::= AFTER */\n#line 1365 \"parse.y\"\n{ yymsp[0].minor.yy194 = TK_AFTER;  }\n#line 3642 \"parse.c\"\n        break;\n      case 231: /* trigger_time ::= INSTEAD OF */\n#line 1366 \"parse.y\"\n{ yymsp[-1].minor.yy194 = TK_INSTEAD;}\n#line 3647 \"parse.c\"\n        break;\n      case 232: /* trigger_time ::= */\n#line 1367 \"parse.y\"\n{ yymsp[1].minor.yy194 = TK_BEFORE; }\n#line 3652 \"parse.c\"\n        break;\n      case 233: /* trigger_event ::= DELETE|INSERT */\n      case 234: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==234);\n#line 1371 \"parse.y\"\n{yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}\n#line 3658 \"parse.c\"\n        break;\n      case 235: /* trigger_event ::= UPDATE OF idlist */\n#line 1373 \"parse.y\"\n{yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}\n#line 3663 \"parse.c\"\n        break;\n      case 236: /* when_clause ::= */\n      case 255: /* key_opt ::= */ yytestcase(yyruleno==255);\n#line 1380 \"parse.y\"\n{ yymsp[1].minor.yy72 = 0; }\n#line 3669 \"parse.c\"\n        break;\n      case 237: /* when_clause ::= WHEN expr */\n      case 256: /* key_opt ::= KEY expr */ yytestcase(yyruleno==256);\n#line 1381 \"parse.y\"\n{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }\n#line 3675 \"parse.c\"\n        break;\n      case 238: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */\n#line 1385 \"parse.y\"\n{\n  assert( yymsp[-2].minor.yy145!=0 );\n  yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;\n  yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;\n}\n#line 3684 \"parse.c\"\n        break;\n      case 239: /* trigger_cmd_list ::= trigger_cmd SEMI */\n#line 1390 \"parse.y\"\n{ \n  assert( yymsp[-1].minor.yy145!=0 );\n  yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;\n}\n#line 3692 \"parse.c\"\n        break;\n      case 240: /* trnm ::= nm DOT nm */\n#line 1401 \"parse.y\"\n{\n  yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;\n  sqlite3ErrorMsg(pParse, \n        \"qualified table names are not allowed on INSERT, UPDATE, and DELETE \"\n        \"statements within triggers\");\n}\n#line 3702 \"parse.c\"\n        break;\n      case 241: /* tridxby ::= INDEXED BY nm */\n#line 1413 \"parse.y\"\n{\n  sqlite3ErrorMsg(pParse,\n        \"the INDEXED BY clause is not allowed on UPDATE or DELETE statements \"\n        \"within triggers\");\n}\n#line 3711 \"parse.c\"\n        break;\n      case 242: /* tridxby ::= NOT INDEXED */\n#line 1418 \"parse.y\"\n{\n  sqlite3ErrorMsg(pParse,\n        \"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements \"\n        \"within triggers\");\n}\n#line 3720 \"parse.c\"\n        break;\n      case 243: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */\n#line 1431 \"parse.y\"\n{yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}\n#line 3725 \"parse.c\"\n        break;\n      case 244: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */\n#line 1435 \"parse.y\"\n{yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}\n#line 3730 \"parse.c\"\n        break;\n      case 245: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */\n#line 1439 \"parse.y\"\n{yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}\n#line 3735 \"parse.c\"\n        break;\n      case 246: /* trigger_cmd ::= select */\n#line 1443 \"parse.y\"\n{yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}\n#line 3740 \"parse.c\"\n        break;\n      case 247: /* expr ::= RAISE LP IGNORE RP */\n#line 1446 \"parse.y\"\n{\n  spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-X*/\n  yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); \n  if( yymsp[-3].minor.yy190.pExpr ){\n    yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;\n  }\n}\n#line 3751 \"parse.c\"\n        break;\n      case 248: /* expr ::= RAISE LP raisetype COMMA nm RP */\n#line 1453 \"parse.y\"\n{\n  spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);  /*A-overwrites-X*/\n  yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); \n  if( yymsp[-5].minor.yy190.pExpr ) {\n    yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;\n  }\n}\n#line 3762 \"parse.c\"\n        break;\n      case 249: /* raisetype ::= ROLLBACK */\n#line 1463 \"parse.y\"\n{yymsp[0].minor.yy194 = OE_Rollback;}\n#line 3767 \"parse.c\"\n        break;\n      case 251: /* raisetype ::= FAIL */\n#line 1465 \"parse.y\"\n{yymsp[0].minor.yy194 = OE_Fail;}\n#line 3772 \"parse.c\"\n        break;\n      case 252: /* cmd ::= DROP TRIGGER ifexists fullname */\n#line 1470 \"parse.y\"\n{\n  sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);\n}\n#line 3779 \"parse.c\"\n        break;\n      case 253: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */\n#line 1477 \"parse.y\"\n{\n  sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);\n}\n#line 3786 \"parse.c\"\n        break;\n      case 254: /* cmd ::= DETACH database_kw_opt expr */\n#line 1480 \"parse.y\"\n{\n  sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);\n}\n#line 3793 \"parse.c\"\n        break;\n      case 257: /* cmd ::= REINDEX */\n#line 1495 \"parse.y\"\n{sqlite3Reindex(pParse, 0, 0);}\n#line 3798 \"parse.c\"\n        break;\n      case 258: /* cmd ::= REINDEX nm dbnm */\n#line 1496 \"parse.y\"\n{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}\n#line 3803 \"parse.c\"\n        break;\n      case 259: /* cmd ::= ANALYZE */\n#line 1501 \"parse.y\"\n{sqlite3Analyze(pParse, 0, 0);}\n#line 3808 \"parse.c\"\n        break;\n      case 260: /* cmd ::= ANALYZE nm dbnm */\n#line 1502 \"parse.y\"\n{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}\n#line 3813 \"parse.c\"\n        break;\n      case 261: /* cmd ::= ALTER TABLE fullname RENAME TO nm */\n#line 1507 \"parse.y\"\n{\n  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);\n}\n#line 3820 \"parse.c\"\n        break;\n      case 262: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */\n#line 1511 \"parse.y\"\n{\n  yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;\n  sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);\n}\n#line 3828 \"parse.c\"\n        break;\n      case 263: /* add_column_fullname ::= fullname */\n#line 1515 \"parse.y\"\n{\n  disableLookaside(pParse);\n  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);\n}\n#line 3836 \"parse.c\"\n        break;\n      case 264: /* cmd ::= create_vtab */\n#line 1525 \"parse.y\"\n{sqlite3VtabFinishParse(pParse,0);}\n#line 3841 \"parse.c\"\n        break;\n      case 265: /* cmd ::= create_vtab LP vtabarglist RP */\n#line 1526 \"parse.y\"\n{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}\n#line 3846 \"parse.c\"\n        break;\n      case 266: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */\n#line 1528 \"parse.y\"\n{\n    sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);\n}\n#line 3853 \"parse.c\"\n        break;\n      case 267: /* vtabarg ::= */\n#line 1533 \"parse.y\"\n{sqlite3VtabArgInit(pParse);}\n#line 3858 \"parse.c\"\n        break;\n      case 268: /* vtabargtoken ::= ANY */\n      case 269: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==269);\n      case 270: /* lp ::= LP */ yytestcase(yyruleno==270);\n#line 1535 \"parse.y\"\n{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}\n#line 3865 \"parse.c\"\n        break;\n      case 271: /* with ::= */\n#line 1550 \"parse.y\"\n{yymsp[1].minor.yy285 = 0;}\n#line 3870 \"parse.c\"\n        break;\n      case 272: /* with ::= WITH wqlist */\n#line 1552 \"parse.y\"\n{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }\n#line 3875 \"parse.c\"\n        break;\n      case 273: /* with ::= WITH RECURSIVE wqlist */\n#line 1553 \"parse.y\"\n{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }\n#line 3880 \"parse.c\"\n        break;\n      case 274: /* wqlist ::= nm eidlist_opt AS LP select RP */\n#line 1555 \"parse.y\"\n{\n  yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/\n}\n#line 3887 \"parse.c\"\n        break;\n      case 275: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */\n#line 1558 \"parse.y\"\n{\n  yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);\n}\n#line 3894 \"parse.c\"\n        break;\n      default:\n      /* (276) input ::= cmdlist */ yytestcase(yyruleno==276);\n      /* (277) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==277);\n      /* (278) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=278);\n      /* (279) ecmd ::= SEMI */ yytestcase(yyruleno==279);\n      /* (280) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==280);\n      /* (281) explain ::= */ yytestcase(yyruleno==281);\n      /* (282) trans_opt ::= */ yytestcase(yyruleno==282);\n      /* (283) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==283);\n      /* (284) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==284);\n      /* (285) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==285);\n      /* (286) savepoint_opt ::= */ yytestcase(yyruleno==286);\n      /* (287) cmd ::= create_table create_table_args */ yytestcase(yyruleno==287);\n      /* (288) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==288);\n      /* (289) columnlist ::= columnname carglist */ yytestcase(yyruleno==289);\n      /* (290) nm ::= ID|INDEXED */ yytestcase(yyruleno==290);\n      /* (291) nm ::= STRING */ yytestcase(yyruleno==291);\n      /* (292) nm ::= JOIN_KW */ yytestcase(yyruleno==292);\n      /* (293) typetoken ::= typename */ yytestcase(yyruleno==293);\n      /* (294) typename ::= ID|STRING */ yytestcase(yyruleno==294);\n      /* (295) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);\n      /* (296) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=296);\n      /* (297) carglist ::= carglist ccons */ yytestcase(yyruleno==297);\n      /* (298) carglist ::= */ yytestcase(yyruleno==298);\n      /* (299) ccons ::= NULL onconf */ yytestcase(yyruleno==299);\n      /* (300) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==300);\n      /* (301) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==301);\n      /* (302) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=302);\n      /* (303) tconscomma ::= */ yytestcase(yyruleno==303);\n      /* (304) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=304);\n      /* (305) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=305);\n      /* (306) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=306);\n      /* (307) oneselect ::= values */ yytestcase(yyruleno==307);\n      /* (308) sclp ::= selcollist COMMA */ yytestcase(yyruleno==308);\n      /* (309) as ::= ID|STRING */ yytestcase(yyruleno==309);\n      /* (310) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=310);\n      /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);\n      /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);\n      /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);\n      /* (314) nmnum ::= ON */ yytestcase(yyruleno==314);\n      /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);\n      /* (316) nmnum ::= DEFAULT */ yytestcase(yyruleno==316);\n      /* (317) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==317);\n      /* (318) foreach_clause ::= */ yytestcase(yyruleno==318);\n      /* (319) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==319);\n      /* (320) trnm ::= nm */ yytestcase(yyruleno==320);\n      /* (321) tridxby ::= */ yytestcase(yyruleno==321);\n      /* (322) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==322);\n      /* (323) database_kw_opt ::= */ yytestcase(yyruleno==323);\n      /* (324) kwcolumn_opt ::= */ yytestcase(yyruleno==324);\n      /* (325) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==325);\n      /* (326) vtabarglist ::= vtabarg */ yytestcase(yyruleno==326);\n      /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==327);\n      /* (328) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==328);\n      /* (329) anylist ::= */ yytestcase(yyruleno==329);\n      /* (330) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==330);\n      /* (331) anylist ::= anylist ANY */ yytestcase(yyruleno==331);\n        break;\n/********** End reduce actions ************************************************/\n  };\n  assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );\n  yygoto = yyRuleInfo[yyruleno].lhs;\n  yysize = yyRuleInfo[yyruleno].nrhs;\n  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);\n  if( yyact <= YY_MAX_SHIFTREDUCE ){\n    if( yyact>YY_MAX_SHIFT ){\n      yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;\n    }\n    yymsp -= yysize-1;\n    yypParser->yytos = yymsp;\n    yymsp->stateno = (YYACTIONTYPE)yyact;\n    yymsp->major = (YYCODETYPE)yygoto;\n    yyTraceShift(yypParser, yyact);\n  }else{\n    assert( yyact == YY_ACCEPT_ACTION );\n    yypParser->yytos -= yysize;\n    yy_accept(yypParser);\n  }\n}\n\n/*\n** The following code executes when the parse fails\n*/\n#ifndef YYNOERRORRECOVERY\nstatic void yy_parse_failed(\n  yyParser *yypParser           /* The parser */\n){\n  sqlite3ParserARG_FETCH;\n#ifndef NDEBUG\n  if( yyTraceFILE ){\n    fprintf(yyTraceFILE,\"%sFail!\\n\",yyTracePrompt);\n  }\n#endif\n  while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);\n  /* Here code is inserted which will be executed whenever the\n  ** parser fails */\n/************ Begin %parse_failure code ***************************************/\n/************ End %parse_failure code *****************************************/\n  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\n}\n#endif /* YYNOERRORRECOVERY */\n\n/*\n** The following code executes when a syntax error first occurs.\n*/\nstatic void yy_syntax_error(\n  yyParser *yypParser,           /* The parser */\n  int yymajor,                   /* The major type of the error token */\n  sqlite3ParserTOKENTYPE yyminor         /* The minor type of the error token */\n){\n  sqlite3ParserARG_FETCH;\n#define TOKEN yyminor\n/************ Begin %syntax_error code ****************************************/\n#line 32 \"parse.y\"\n\n  UNUSED_PARAMETER(yymajor);  /* Silence some compiler warnings */\n  assert( TOKEN.z[0] );  /* The tokenizer always gives us a token */\n  sqlite3ErrorMsg(pParse, \"near \\\"%T\\\": syntax error\", &TOKEN);\n#line 4014 \"parse.c\"\n/************ End %syntax_error code ******************************************/\n  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\n}\n\n/*\n** The following is executed when the parser accepts\n*/\nstatic void yy_accept(\n  yyParser *yypParser           /* The parser */\n){\n  sqlite3ParserARG_FETCH;\n#ifndef NDEBUG\n  if( yyTraceFILE ){\n    fprintf(yyTraceFILE,\"%sAccept!\\n\",yyTracePrompt);\n  }\n#endif\n#ifndef YYNOERRORRECOVERY\n  yypParser->yyerrcnt = -1;\n#endif\n  assert( yypParser->yytos==yypParser->yystack );\n  /* Here code is inserted which will be executed whenever the\n  ** parser accepts */\n/*********** Begin %parse_accept code *****************************************/\n/*********** End %parse_accept code *******************************************/\n  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */\n}\n\n/* The main parser program.\n** The first argument is a pointer to a structure obtained from\n** \"sqlite3ParserAlloc\" which describes the current state of the parser.\n** The second argument is the major token number.  The third is\n** the minor token.  The fourth optional argument is whatever the\n** user wants (and specified in the grammar) and is available for\n** use by the action routines.\n**\n** Inputs:\n** <ul>\n** <li> A pointer to the parser (an opaque structure.)\n** <li> The major token number.\n** <li> The minor token number.\n** <li> An option argument of a grammar-specified type.\n** </ul>\n**\n** Outputs:\n** None.\n*/\nvoid sqlite3Parser(\n  void *yyp,                   /* The parser */\n  int yymajor,                 /* The major token code number */\n  sqlite3ParserTOKENTYPE yyminor       /* The value for the token */\n  sqlite3ParserARG_PDECL               /* Optional %extra_argument parameter */\n){\n  YYMINORTYPE yyminorunion;\n  unsigned int yyact;   /* The parser action. */\n#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)\n  int yyendofinput;     /* True if we are at the end of input */\n#endif\n#ifdef YYERRORSYMBOL\n  int yyerrorhit = 0;   /* True if yymajor has invoked an error */\n#endif\n  yyParser *yypParser;  /* The parser */\n\n  yypParser = (yyParser*)yyp;\n  assert( yypParser->yytos!=0 );\n#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)\n  yyendofinput = (yymajor==0);\n#endif\n  sqlite3ParserARG_STORE;\n\n#ifndef NDEBUG\n  if( yyTraceFILE ){\n    fprintf(yyTraceFILE,\"%sInput '%s'\\n\",yyTracePrompt,yyTokenName[yymajor]);\n  }\n#endif\n\n  do{\n    yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);\n    if( yyact <= YY_MAX_SHIFTREDUCE ){\n      yy_shift(yypParser,yyact,yymajor,yyminor);\n#ifndef YYNOERRORRECOVERY\n      yypParser->yyerrcnt--;\n#endif\n      yymajor = YYNOCODE;\n    }else if( yyact <= YY_MAX_REDUCE ){\n      yy_reduce(yypParser,yyact-YY_MIN_REDUCE);\n    }else{\n      assert( yyact == YY_ERROR_ACTION );\n      yyminorunion.yy0 = yyminor;\n#ifdef YYERRORSYMBOL\n      int yymx;\n#endif\n#ifndef NDEBUG\n      if( yyTraceFILE ){\n        fprintf(yyTraceFILE,\"%sSyntax Error!\\n\",yyTracePrompt);\n      }\n#endif\n#ifdef YYERRORSYMBOL\n      /* A syntax error has occurred.\n      ** The response to an error depends upon whether or not the\n      ** grammar defines an error token \"ERROR\".  \n      **\n      ** This is what we do if the grammar does define ERROR:\n      **\n      **  * Call the %syntax_error function.\n      **\n      **  * Begin popping the stack until we enter a state where\n      **    it is legal to shift the error symbol, then shift\n      **    the error symbol.\n      **\n      **  * Set the error count to three.\n      **\n      **  * Begin accepting and shifting new tokens.  No new error\n      **    processing will occur until three tokens have been\n      **    shifted successfully.\n      **\n      */\n      if( yypParser->yyerrcnt<0 ){\n        yy_syntax_error(yypParser,yymajor,yyminor);\n      }\n      yymx = yypParser->yytos->major;\n      if( yymx==YYERRORSYMBOL || yyerrorhit ){\n#ifndef NDEBUG\n        if( yyTraceFILE ){\n          fprintf(yyTraceFILE,\"%sDiscard input token %s\\n\",\n             yyTracePrompt,yyTokenName[yymajor]);\n        }\n#endif\n        yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);\n        yymajor = YYNOCODE;\n      }else{\n        while( yypParser->yytos >= yypParser->yystack\n            && yymx != YYERRORSYMBOL\n            && (yyact = yy_find_reduce_action(\n                        yypParser->yytos->stateno,\n                        YYERRORSYMBOL)) >= YY_MIN_REDUCE\n        ){\n          yy_pop_parser_stack(yypParser);\n        }\n        if( yypParser->yytos < yypParser->yystack || yymajor==0 ){\n          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);\n          yy_parse_failed(yypParser);\n#ifndef YYNOERRORRECOVERY\n          yypParser->yyerrcnt = -1;\n#endif\n          yymajor = YYNOCODE;\n        }else if( yymx!=YYERRORSYMBOL ){\n          yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);\n        }\n      }\n      yypParser->yyerrcnt = 3;\n      yyerrorhit = 1;\n#elif defined(YYNOERRORRECOVERY)\n      /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to\n      ** do any kind of error recovery.  Instead, simply invoke the syntax\n      ** error routine and continue going as if nothing had happened.\n      **\n      ** Applications can set this macro (for example inside %include) if\n      ** they intend to abandon the parse upon the first syntax error seen.\n      */\n      yy_syntax_error(yypParser,yymajor, yyminor);\n      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);\n      yymajor = YYNOCODE;\n      \n#else  /* YYERRORSYMBOL is not defined */\n      /* This is what we do if the grammar does not define ERROR:\n      **\n      **  * Report an error message, and throw away the input token.\n      **\n      **  * If the input token is $, then fail the parse.\n      **\n      ** As before, subsequent error messages are suppressed until\n      ** three input tokens have been successfully shifted.\n      */\n      if( yypParser->yyerrcnt<=0 ){\n        yy_syntax_error(yypParser,yymajor, yyminor);\n      }\n      yypParser->yyerrcnt = 3;\n      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);\n      if( yyendofinput ){\n        yy_parse_failed(yypParser);\n#ifndef YYNOERRORRECOVERY\n        yypParser->yyerrcnt = -1;\n#endif\n      }\n      yymajor = YYNOCODE;\n#endif\n    }\n  }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );\n#ifndef NDEBUG\n  if( yyTraceFILE ){\n    yyStackEntry *i;\n    char cDiv = '[';\n    fprintf(yyTraceFILE,\"%sReturn. Stack=\",yyTracePrompt);\n    for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){\n      fprintf(yyTraceFILE,\"%c%s\", cDiv, yyTokenName[i->major]);\n      cDiv = ' ';\n    }\n    fprintf(yyTraceFILE,\"]\\n\");\n  }\n#endif\n  return;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/parse.h",
    "content": "#define TK_SEMI                             1\n#define TK_EXPLAIN                          2\n#define TK_QUERY                            3\n#define TK_PLAN                             4\n#define TK_BEGIN                            5\n#define TK_TRANSACTION                      6\n#define TK_DEFERRED                         7\n#define TK_IMMEDIATE                        8\n#define TK_EXCLUSIVE                        9\n#define TK_COMMIT                          10\n#define TK_END                             11\n#define TK_ROLLBACK                        12\n#define TK_SAVEPOINT                       13\n#define TK_RELEASE                         14\n#define TK_TO                              15\n#define TK_TABLE                           16\n#define TK_CREATE                          17\n#define TK_IF                              18\n#define TK_NOT                             19\n#define TK_EXISTS                          20\n#define TK_TEMP                            21\n#define TK_LP                              22\n#define TK_RP                              23\n#define TK_AS                              24\n#define TK_WITHOUT                         25\n#define TK_COMMA                           26\n#define TK_OR                              27\n#define TK_AND                             28\n#define TK_IS                              29\n#define TK_MATCH                           30\n#define TK_LIKE_KW                         31\n#define TK_BETWEEN                         32\n#define TK_IN                              33\n#define TK_ISNULL                          34\n#define TK_NOTNULL                         35\n#define TK_NE                              36\n#define TK_EQ                              37\n#define TK_GT                              38\n#define TK_LE                              39\n#define TK_LT                              40\n#define TK_GE                              41\n#define TK_ESCAPE                          42\n#define TK_BITAND                          43\n#define TK_BITOR                           44\n#define TK_LSHIFT                          45\n#define TK_RSHIFT                          46\n#define TK_PLUS                            47\n#define TK_MINUS                           48\n#define TK_STAR                            49\n#define TK_SLASH                           50\n#define TK_REM                             51\n#define TK_CONCAT                          52\n#define TK_COLLATE                         53\n#define TK_BITNOT                          54\n#define TK_ID                              55\n#define TK_INDEXED                         56\n#define TK_ABORT                           57\n#define TK_ACTION                          58\n#define TK_AFTER                           59\n#define TK_ANALYZE                         60\n#define TK_ASC                             61\n#define TK_ATTACH                          62\n#define TK_BEFORE                          63\n#define TK_BY                              64\n#define TK_CASCADE                         65\n#define TK_CAST                            66\n#define TK_COLUMNKW                        67\n#define TK_CONFLICT                        68\n#define TK_DATABASE                        69\n#define TK_DESC                            70\n#define TK_DETACH                          71\n#define TK_EACH                            72\n#define TK_FAIL                            73\n#define TK_FOR                             74\n#define TK_IGNORE                          75\n#define TK_INITIALLY                       76\n#define TK_INSTEAD                         77\n#define TK_NO                              78\n#define TK_KEY                             79\n#define TK_OF                              80\n#define TK_OFFSET                          81\n#define TK_PRAGMA                          82\n#define TK_RAISE                           83\n#define TK_RECURSIVE                       84\n#define TK_REPLACE                         85\n#define TK_RESTRICT                        86\n#define TK_ROW                             87\n#define TK_TRIGGER                         88\n#define TK_VACUUM                          89\n#define TK_VIEW                            90\n#define TK_VIRTUAL                         91\n#define TK_WITH                            92\n#define TK_REINDEX                         93\n#define TK_RENAME                          94\n#define TK_CTIME_KW                        95\n#define TK_ANY                             96\n#define TK_STRING                          97\n#define TK_JOIN_KW                         98\n#define TK_CONSTRAINT                      99\n#define TK_DEFAULT                        100\n#define TK_NULL                           101\n#define TK_PRIMARY                        102\n#define TK_UNIQUE                         103\n#define TK_CHECK                          104\n#define TK_REFERENCES                     105\n#define TK_AUTOINCR                       106\n#define TK_ON                             107\n#define TK_INSERT                         108\n#define TK_DELETE                         109\n#define TK_UPDATE                         110\n#define TK_SET                            111\n#define TK_DEFERRABLE                     112\n#define TK_FOREIGN                        113\n#define TK_DROP                           114\n#define TK_UNION                          115\n#define TK_ALL                            116\n#define TK_EXCEPT                         117\n#define TK_INTERSECT                      118\n#define TK_SELECT                         119\n#define TK_VALUES                         120\n#define TK_DISTINCT                       121\n#define TK_DOT                            122\n#define TK_FROM                           123\n#define TK_JOIN                           124\n#define TK_USING                          125\n#define TK_ORDER                          126\n#define TK_GROUP                          127\n#define TK_HAVING                         128\n#define TK_LIMIT                          129\n#define TK_WHERE                          130\n#define TK_INTO                           131\n#define TK_FLOAT                          132\n#define TK_BLOB                           133\n#define TK_INTEGER                        134\n#define TK_VARIABLE                       135\n#define TK_CASE                           136\n#define TK_WHEN                           137\n#define TK_THEN                           138\n#define TK_ELSE                           139\n#define TK_INDEX                          140\n#define TK_ALTER                          141\n#define TK_ADD                            142\n#define TK_TO_TEXT                        143\n#define TK_TO_BLOB                        144\n#define TK_TO_NUMERIC                     145\n#define TK_TO_INT                         146\n#define TK_TO_REAL                        147\n#define TK_ISNOT                          148\n#define TK_END_OF_FILE                    149\n#define TK_UNCLOSED_STRING                150\n#define TK_FUNCTION                       151\n#define TK_COLUMN                         152\n#define TK_AGG_FUNCTION                   153\n#define TK_AGG_COLUMN                     154\n#define TK_UMINUS                         155\n#define TK_UPLUS                          156\n#define TK_REGISTER                       157\n#define TK_VECTOR                         158\n#define TK_SELECT_COLUMN                  159\n#define TK_ASTERISK                       160\n#define TK_SPAN                           161\n#define TK_SPACE                          162\n#define TK_ILLEGAL                        163\n\n/* The token codes above must all fit in 8 bits */\n#define TKFLG_MASK           0xff  \n\n/* Flags that can be added to a token code when it is not\n** being stored in a u8: */\n#define TKFLG_DONTFOLD       0x100  /* Omit constant folding optimizations */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/sqlite3.h",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This header file defines the interface that the SQLite library\n** presents to client programs.  If a C-function, structure, datatype,\n** or constant definition does not appear in this file, then it is\n** not a published API of SQLite, is subject to change without\n** notice, and should not be referenced by programs that use SQLite.\n**\n** Some of the definitions that are in this file are marked as\n** \"experimental\".  Experimental interfaces are normally new\n** features recently added to SQLite.  We do not anticipate changes\n** to experimental interfaces but reserve the right to make minor changes\n** if experience from use \"in the wild\" suggest such changes are prudent.\n**\n** The official C-language API documentation for SQLite is derived\n** from comments in this file.  This file is the authoritative source\n** on how SQLite interfaces are supposed to operate.\n**\n** The name of this file under configuration management is \"sqlite.h.in\".\n** The makefile makes some minor changes to this file (such as inserting\n** the version number) and changes its name to \"sqlite3.h\" as\n** part of the build process.\n*/\n#ifndef SQLITE3_H\n#define SQLITE3_H\n#include <stdarg.h>     /* Needed for the definition of va_list */\n\n/*\n** Make sure we can call this stuff from C++.\n*/\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/*\n** Provide the ability to override linkage features of the interface.\n*/\n#ifndef SQLITE_EXTERN\n# define SQLITE_EXTERN extern\n#endif\n#ifndef SQLITE_API\n# define SQLITE_API\n#endif\n#ifndef SQLITE_CDECL\n# define SQLITE_CDECL\n#endif\n#ifndef SQLITE_APICALL\n# define SQLITE_APICALL\n#endif\n#ifndef SQLITE_STDCALL\n# define SQLITE_STDCALL SQLITE_APICALL\n#endif\n#ifndef SQLITE_CALLBACK\n# define SQLITE_CALLBACK\n#endif\n#ifndef SQLITE_SYSAPI\n# define SQLITE_SYSAPI\n#endif\n\n/*\n** These no-op macros are used in front of interfaces to mark those\n** interfaces as either deprecated or experimental.  New applications\n** should not use deprecated interfaces - they are supported for backwards\n** compatibility only.  Application writers should be aware that\n** experimental interfaces are subject to change in point releases.\n**\n** These macros used to resolve to various kinds of compiler magic that\n** would generate warning messages when they were used.  But that\n** compiler magic ended up generating such a flurry of bug reports\n** that we have taken it all out and gone back to using simple\n** noop macros.\n*/\n#define SQLITE_DEPRECATED\n#define SQLITE_EXPERIMENTAL\n\n/*\n** Ensure these symbols were not defined by some previous header file.\n*/\n#ifdef SQLITE_VERSION\n# undef SQLITE_VERSION\n#endif\n#ifdef SQLITE_VERSION_NUMBER\n# undef SQLITE_VERSION_NUMBER\n#endif\n\n/*\n** CAPI3REF: Compile-Time Library Version Numbers\n**\n** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header\n** evaluates to a string literal that is the SQLite version in the\n** format \"X.Y.Z\" where X is the major version number (always 3 for\n** SQLite3) and Y is the minor version number and Z is the release number.)^\n** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer\n** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same\n** numbers used in [SQLITE_VERSION].)^\n** The SQLITE_VERSION_NUMBER for any given release of SQLite will also\n** be larger than the release from which it is derived.  Either Y will\n** be held constant and Z will be incremented or else Y will be incremented\n** and Z will be reset to zero.\n**\n** Since [version 3.6.18] ([dateof:3.6.18]), \n** SQLite source code has been stored in the\n** <a href=\"http://www.fossil-scm.org/\">Fossil configuration management\n** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to\n** a string which identifies a particular check-in of SQLite\n** within its configuration management system.  ^The SQLITE_SOURCE_ID\n** string contains the date and time of the check-in (UTC) and an SHA1\n** hash of the entire source tree.\n**\n** See also: [sqlite3_libversion()],\n** [sqlite3_libversion_number()], [sqlite3_sourceid()],\n** [sqlite_version()] and [sqlite_source_id()].\n*/\n#define SQLITE_VERSION        \"3.15.2\"\n#define SQLITE_VERSION_NUMBER 3015002\n#define SQLITE_SOURCE_ID      \"2016-11-28 19:13:37 bbd85d235f7037c6a033a9690534391ffeacecc8\"\n\n/*\n** CAPI3REF: Run-Time Library Version Numbers\n** KEYWORDS: sqlite3_version, sqlite3_sourceid\n**\n** These interfaces provide the same information as the [SQLITE_VERSION],\n** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros\n** but are associated with the library instead of the header file.  ^(Cautious\n** programmers might include assert() statements in their application to\n** verify that values returned by these interfaces match the macros in\n** the header, and thus ensure that the application is\n** compiled with matching library and header files.\n**\n** <blockquote><pre>\n** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );\n** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );\n** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );\n** </pre></blockquote>)^\n**\n** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]\n** macro.  ^The sqlite3_libversion() function returns a pointer to the\n** to the sqlite3_version[] string constant.  The sqlite3_libversion()\n** function is provided for use in DLLs since DLL users usually do not have\n** direct access to string constants within the DLL.  ^The\n** sqlite3_libversion_number() function returns an integer equal to\n** [SQLITE_VERSION_NUMBER].  ^The sqlite3_sourceid() function returns \n** a pointer to a string constant whose value is the same as the \n** [SQLITE_SOURCE_ID] C preprocessor macro.\n**\n** See also: [sqlite_version()] and [sqlite_source_id()].\n*/\nSQLITE_API SQLITE_EXTERN const char sqlite3_version[];\nSQLITE_API const char *sqlite3_libversion(void);\nSQLITE_API const char *sqlite3_sourceid(void);\nSQLITE_API int sqlite3_libversion_number(void);\n\n/*\n** CAPI3REF: Run-Time Library Compilation Options Diagnostics\n**\n** ^The sqlite3_compileoption_used() function returns 0 or 1 \n** indicating whether the specified option was defined at \n** compile time.  ^The SQLITE_ prefix may be omitted from the \n** option name passed to sqlite3_compileoption_used().  \n**\n** ^The sqlite3_compileoption_get() function allows iterating\n** over the list of options that were defined at compile time by\n** returning the N-th compile time option string.  ^If N is out of range,\n** sqlite3_compileoption_get() returns a NULL pointer.  ^The SQLITE_ \n** prefix is omitted from any strings returned by \n** sqlite3_compileoption_get().\n**\n** ^Support for the diagnostic functions sqlite3_compileoption_used()\n** and sqlite3_compileoption_get() may be omitted by specifying the \n** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.\n**\n** See also: SQL functions [sqlite_compileoption_used()] and\n** [sqlite_compileoption_get()] and the [compile_options pragma].\n*/\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\nSQLITE_API int sqlite3_compileoption_used(const char *zOptName);\nSQLITE_API const char *sqlite3_compileoption_get(int N);\n#endif\n\n/*\n** CAPI3REF: Test To See If The Library Is Threadsafe\n**\n** ^The sqlite3_threadsafe() function returns zero if and only if\n** SQLite was compiled with mutexing code omitted due to the\n** [SQLITE_THREADSAFE] compile-time option being set to 0.\n**\n** SQLite can be compiled with or without mutexes.  When\n** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes\n** are enabled and SQLite is threadsafe.  When the\n** [SQLITE_THREADSAFE] macro is 0, \n** the mutexes are omitted.  Without the mutexes, it is not safe\n** to use SQLite concurrently from more than one thread.\n**\n** Enabling mutexes incurs a measurable performance penalty.\n** So if speed is of utmost importance, it makes sense to disable\n** the mutexes.  But for maximum safety, mutexes should be enabled.\n** ^The default behavior is for mutexes to be enabled.\n**\n** This interface can be used by an application to make sure that the\n** version of SQLite that it is linking against was compiled with\n** the desired setting of the [SQLITE_THREADSAFE] macro.\n**\n** This interface only reports on the compile-time mutex setting\n** of the [SQLITE_THREADSAFE] flag.  If SQLite is compiled with\n** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but\n** can be fully or partially disabled using a call to [sqlite3_config()]\n** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],\n** or [SQLITE_CONFIG_SERIALIZED].  ^(The return value of the\n** sqlite3_threadsafe() function shows only the compile-time setting of\n** thread safety, not any run-time changes to that setting made by\n** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()\n** is unchanged by calls to sqlite3_config().)^\n**\n** See the [threading mode] documentation for additional information.\n*/\nSQLITE_API int sqlite3_threadsafe(void);\n\n/*\n** CAPI3REF: Database Connection Handle\n** KEYWORDS: {database connection} {database connections}\n**\n** Each open SQLite database is represented by a pointer to an instance of\n** the opaque structure named \"sqlite3\".  It is useful to think of an sqlite3\n** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and\n** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]\n** and [sqlite3_close_v2()] are its destructors.  There are many other\n** interfaces (such as\n** [sqlite3_prepare_v2()], [sqlite3_create_function()], and\n** [sqlite3_busy_timeout()] to name but three) that are methods on an\n** sqlite3 object.\n*/\ntypedef struct sqlite3 sqlite3;\n\n/*\n** CAPI3REF: 64-Bit Integer Types\n** KEYWORDS: sqlite_int64 sqlite_uint64\n**\n** Because there is no cross-platform way to specify 64-bit integer types\n** SQLite includes typedefs for 64-bit signed and unsigned integers.\n**\n** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.\n** The sqlite_int64 and sqlite_uint64 types are supported for backwards\n** compatibility only.\n**\n** ^The sqlite3_int64 and sqlite_int64 types can store integer values\n** between -9223372036854775808 and +9223372036854775807 inclusive.  ^The\n** sqlite3_uint64 and sqlite_uint64 types can store integer values \n** between 0 and +18446744073709551615 inclusive.\n*/\n#ifdef SQLITE_INT64_TYPE\n  typedef SQLITE_INT64_TYPE sqlite_int64;\n  typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;\n#elif defined(_MSC_VER) || defined(__BORLANDC__)\n  typedef __int64 sqlite_int64;\n  typedef unsigned __int64 sqlite_uint64;\n#else\n  typedef long long int sqlite_int64;\n  typedef unsigned long long int sqlite_uint64;\n#endif\ntypedef sqlite_int64 sqlite3_int64;\ntypedef sqlite_uint64 sqlite3_uint64;\n\n/*\n** If compiling for a processor that lacks floating point support,\n** substitute integer for floating-point.\n*/\n#ifdef SQLITE_OMIT_FLOATING_POINT\n# define double sqlite3_int64\n#endif\n\n/*\n** CAPI3REF: Closing A Database Connection\n** DESTRUCTOR: sqlite3\n**\n** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors\n** for the [sqlite3] object.\n** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if\n** the [sqlite3] object is successfully destroyed and all associated\n** resources are deallocated.\n**\n** ^If the database connection is associated with unfinalized prepared\n** statements or unfinished sqlite3_backup objects then sqlite3_close()\n** will leave the database connection open and return [SQLITE_BUSY].\n** ^If sqlite3_close_v2() is called with unfinalized prepared statements\n** and/or unfinished sqlite3_backups, then the database connection becomes\n** an unusable \"zombie\" which will automatically be deallocated when the\n** last prepared statement is finalized or the last sqlite3_backup is\n** finished.  The sqlite3_close_v2() interface is intended for use with\n** host languages that are garbage collected, and where the order in which\n** destructors are called is arbitrary.\n**\n** Applications should [sqlite3_finalize | finalize] all [prepared statements],\n** [sqlite3_blob_close | close] all [BLOB handles], and \n** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated\n** with the [sqlite3] object prior to attempting to close the object.  ^If\n** sqlite3_close_v2() is called on a [database connection] that still has\n** outstanding [prepared statements], [BLOB handles], and/or\n** [sqlite3_backup] objects then it returns [SQLITE_OK] and the deallocation\n** of resources is deferred until all [prepared statements], [BLOB handles],\n** and [sqlite3_backup] objects are also destroyed.\n**\n** ^If an [sqlite3] object is destroyed while a transaction is open,\n** the transaction is automatically rolled back.\n**\n** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]\n** must be either a NULL\n** pointer or an [sqlite3] object pointer obtained\n** from [sqlite3_open()], [sqlite3_open16()], or\n** [sqlite3_open_v2()], and not previously closed.\n** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer\n** argument is a harmless no-op.\n*/\nSQLITE_API int sqlite3_close(sqlite3*);\nSQLITE_API int sqlite3_close_v2(sqlite3*);\n\n/*\n** The type for a callback function.\n** This is legacy and deprecated.  It is included for historical\n** compatibility and is not documented.\n*/\ntypedef int (*sqlite3_callback)(void*,int,char**, char**);\n\n/*\n** CAPI3REF: One-Step Query Execution Interface\n** METHOD: sqlite3\n**\n** The sqlite3_exec() interface is a convenience wrapper around\n** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],\n** that allows an application to run multiple statements of SQL\n** without having to use a lot of C code. \n**\n** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,\n** semicolon-separate SQL statements passed into its 2nd argument,\n** in the context of the [database connection] passed in as its 1st\n** argument.  ^If the callback function of the 3rd argument to\n** sqlite3_exec() is not NULL, then it is invoked for each result row\n** coming out of the evaluated SQL statements.  ^The 4th argument to\n** sqlite3_exec() is relayed through to the 1st argument of each\n** callback invocation.  ^If the callback pointer to sqlite3_exec()\n** is NULL, then no callback is ever invoked and result rows are\n** ignored.\n**\n** ^If an error occurs while evaluating the SQL statements passed into\n** sqlite3_exec(), then execution of the current statement stops and\n** subsequent statements are skipped.  ^If the 5th parameter to sqlite3_exec()\n** is not NULL then any error message is written into memory obtained\n** from [sqlite3_malloc()] and passed back through the 5th parameter.\n** To avoid memory leaks, the application should invoke [sqlite3_free()]\n** on error message strings returned through the 5th parameter of\n** sqlite3_exec() after the error message string is no longer needed.\n** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors\n** occur, then sqlite3_exec() sets the pointer in its 5th parameter to\n** NULL before returning.\n**\n** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()\n** routine returns SQLITE_ABORT without invoking the callback again and\n** without running any subsequent SQL statements.\n**\n** ^The 2nd argument to the sqlite3_exec() callback function is the\n** number of columns in the result.  ^The 3rd argument to the sqlite3_exec()\n** callback is an array of pointers to strings obtained as if from\n** [sqlite3_column_text()], one for each column.  ^If an element of a\n** result row is NULL then the corresponding string pointer for the\n** sqlite3_exec() callback is a NULL pointer.  ^The 4th argument to the\n** sqlite3_exec() callback is an array of pointers to strings where each\n** entry represents the name of corresponding result column as obtained\n** from [sqlite3_column_name()].\n**\n** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer\n** to an empty string, or a pointer that contains only whitespace and/or \n** SQL comments, then no SQL statements are evaluated and the database\n** is not changed.\n**\n** Restrictions:\n**\n** <ul>\n** <li> The application must ensure that the 1st parameter to sqlite3_exec()\n**      is a valid and open [database connection].\n** <li> The application must not close the [database connection] specified by\n**      the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.\n** <li> The application must not modify the SQL statement text passed into\n**      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.\n** </ul>\n*/\nSQLITE_API int sqlite3_exec(\n  sqlite3*,                                  /* An open database */\n  const char *sql,                           /* SQL to be evaluated */\n  int (*callback)(void*,int,char**,char**),  /* Callback function */\n  void *,                                    /* 1st argument to callback */\n  char **errmsg                              /* Error msg written here */\n);\n\n/*\n** CAPI3REF: Result Codes\n** KEYWORDS: {result code definitions}\n**\n** Many SQLite functions return an integer result code from the set shown\n** here in order to indicate success or failure.\n**\n** New error codes may be added in future versions of SQLite.\n**\n** See also: [extended result code definitions]\n*/\n#define SQLITE_OK           0   /* Successful result */\n/* beginning-of-error-codes */\n#define SQLITE_ERROR        1   /* SQL error or missing database */\n#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */\n#define SQLITE_PERM         3   /* Access permission denied */\n#define SQLITE_ABORT        4   /* Callback routine requested an abort */\n#define SQLITE_BUSY         5   /* The database file is locked */\n#define SQLITE_LOCKED       6   /* A table in the database is locked */\n#define SQLITE_NOMEM        7   /* A malloc() failed */\n#define SQLITE_READONLY     8   /* Attempt to write a readonly database */\n#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/\n#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */\n#define SQLITE_CORRUPT     11   /* The database disk image is malformed */\n#define SQLITE_NOTFOUND    12   /* Unknown opcode in sqlite3_file_control() */\n#define SQLITE_FULL        13   /* Insertion failed because database is full */\n#define SQLITE_CANTOPEN    14   /* Unable to open the database file */\n#define SQLITE_PROTOCOL    15   /* Database lock protocol error */\n#define SQLITE_EMPTY       16   /* Database is empty */\n#define SQLITE_SCHEMA      17   /* The database schema changed */\n#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */\n#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */\n#define SQLITE_MISMATCH    20   /* Data type mismatch */\n#define SQLITE_MISUSE      21   /* Library used incorrectly */\n#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */\n#define SQLITE_AUTH        23   /* Authorization denied */\n#define SQLITE_FORMAT      24   /* Auxiliary database format error */\n#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */\n#define SQLITE_NOTADB      26   /* File opened that is not a database file */\n#define SQLITE_NOTICE      27   /* Notifications from sqlite3_log() */\n#define SQLITE_WARNING     28   /* Warnings from sqlite3_log() */\n#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */\n#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */\n/* end-of-error-codes */\n\n/*\n** CAPI3REF: Extended Result Codes\n** KEYWORDS: {extended result code definitions}\n**\n** In its default configuration, SQLite API routines return one of 30 integer\n** [result codes].  However, experience has shown that many of\n** these result codes are too coarse-grained.  They do not provide as\n** much information about problems as programmers might like.  In an effort to\n** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]\n** and later) include\n** support for additional result codes that provide more detailed information\n** about errors. These [extended result codes] are enabled or disabled\n** on a per database connection basis using the\n** [sqlite3_extended_result_codes()] API.  Or, the extended code for\n** the most recent error can be obtained using\n** [sqlite3_extended_errcode()].\n*/\n#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))\n#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))\n#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))\n#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))\n#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))\n#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))\n#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))\n#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))\n#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))\n#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))\n#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))\n#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))\n#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))\n#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))\n#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))\n#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))\n#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))\n#define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))\n#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))\n#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))\n#define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))\n#define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))\n#define SQLITE_IOERR_DELETE_NOENT      (SQLITE_IOERR | (23<<8))\n#define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))\n#define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))\n#define SQLITE_IOERR_CONVPATH          (SQLITE_IOERR | (26<<8))\n#define SQLITE_IOERR_VNODE             (SQLITE_IOERR | (27<<8))\n#define SQLITE_IOERR_AUTH              (SQLITE_IOERR | (28<<8))\n#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))\n#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))\n#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))\n#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))\n#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))\n#define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))\n#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))\n#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))\n#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))\n#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))\n#define SQLITE_READONLY_ROLLBACK       (SQLITE_READONLY | (3<<8))\n#define SQLITE_READONLY_DBMOVED        (SQLITE_READONLY | (4<<8))\n#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))\n#define SQLITE_CONSTRAINT_CHECK        (SQLITE_CONSTRAINT | (1<<8))\n#define SQLITE_CONSTRAINT_COMMITHOOK   (SQLITE_CONSTRAINT | (2<<8))\n#define SQLITE_CONSTRAINT_FOREIGNKEY   (SQLITE_CONSTRAINT | (3<<8))\n#define SQLITE_CONSTRAINT_FUNCTION     (SQLITE_CONSTRAINT | (4<<8))\n#define SQLITE_CONSTRAINT_NOTNULL      (SQLITE_CONSTRAINT | (5<<8))\n#define SQLITE_CONSTRAINT_PRIMARYKEY   (SQLITE_CONSTRAINT | (6<<8))\n#define SQLITE_CONSTRAINT_TRIGGER      (SQLITE_CONSTRAINT | (7<<8))\n#define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))\n#define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))\n#define SQLITE_CONSTRAINT_ROWID        (SQLITE_CONSTRAINT |(10<<8))\n#define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))\n#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))\n#define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))\n#define SQLITE_AUTH_USER               (SQLITE_AUTH | (1<<8))\n#define SQLITE_OK_LOAD_PERMANENTLY     (SQLITE_OK | (1<<8))\n\n/*\n** CAPI3REF: Flags For File Open Operations\n**\n** These bit values are intended for use in the\n** 3rd parameter to the [sqlite3_open_v2()] interface and\n** in the 4th parameter to the [sqlite3_vfs.xOpen] method.\n*/\n#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */\n#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */\n#define SQLITE_OPEN_AUTOPROXY        0x00000020  /* VFS only */\n#define SQLITE_OPEN_URI              0x00000040  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_MEMORY           0x00000080  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */\n#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */\n#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */\n#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */\n#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */\n#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */\n#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */\n#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */\n#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */\n\n/* Reserved:                         0x00F00000 */\n\n/*\n** CAPI3REF: Device Characteristics\n**\n** The xDeviceCharacteristics method of the [sqlite3_io_methods]\n** object returns an integer which is a vector of these\n** bit values expressing I/O characteristics of the mass storage\n** device that holds the file that the [sqlite3_io_methods]\n** refers to.\n**\n** The SQLITE_IOCAP_ATOMIC property means that all writes of\n** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values\n** mean that writes of blocks that are nnn bytes in size and\n** are aligned to an address which is an integer multiple of\n** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means\n** that when data is appended to a file, the data is appended\n** first then the size of the file is extended, never the other\n** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that\n** information is written to disk in the same order as calls\n** to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that\n** after reboot following a crash or power loss, the only bytes in a\n** file that were written at the application level might have changed\n** and that adjacent bytes, even bytes within the same sector are\n** guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN\n** flag indicate that a file cannot be deleted when open.  The\n** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on\n** read-only media and cannot be changed even by processes with\n** elevated privileges.\n*/\n#define SQLITE_IOCAP_ATOMIC                 0x00000001\n#define SQLITE_IOCAP_ATOMIC512              0x00000002\n#define SQLITE_IOCAP_ATOMIC1K               0x00000004\n#define SQLITE_IOCAP_ATOMIC2K               0x00000008\n#define SQLITE_IOCAP_ATOMIC4K               0x00000010\n#define SQLITE_IOCAP_ATOMIC8K               0x00000020\n#define SQLITE_IOCAP_ATOMIC16K              0x00000040\n#define SQLITE_IOCAP_ATOMIC32K              0x00000080\n#define SQLITE_IOCAP_ATOMIC64K              0x00000100\n#define SQLITE_IOCAP_SAFE_APPEND            0x00000200\n#define SQLITE_IOCAP_SEQUENTIAL             0x00000400\n#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  0x00000800\n#define SQLITE_IOCAP_POWERSAFE_OVERWRITE    0x00001000\n#define SQLITE_IOCAP_IMMUTABLE              0x00002000\n\n/*\n** CAPI3REF: File Locking Levels\n**\n** SQLite uses one of these integer values as the second\n** argument to calls it makes to the xLock() and xUnlock() methods\n** of an [sqlite3_io_methods] object.\n*/\n#define SQLITE_LOCK_NONE          0\n#define SQLITE_LOCK_SHARED        1\n#define SQLITE_LOCK_RESERVED      2\n#define SQLITE_LOCK_PENDING       3\n#define SQLITE_LOCK_EXCLUSIVE     4\n\n/*\n** CAPI3REF: Synchronization Type Flags\n**\n** When SQLite invokes the xSync() method of an\n** [sqlite3_io_methods] object it uses a combination of\n** these integer values as the second argument.\n**\n** When the SQLITE_SYNC_DATAONLY flag is used, it means that the\n** sync operation only needs to flush data to mass storage.  Inode\n** information need not be flushed. If the lower four bits of the flag\n** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.\n** If the lower four bits equal SQLITE_SYNC_FULL, that means\n** to use Mac OS X style fullsync instead of fsync().\n**\n** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags\n** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL\n** settings.  The [synchronous pragma] determines when calls to the\n** xSync VFS method occur and applies uniformly across all platforms.\n** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how\n** energetic or rigorous or forceful the sync operations are and\n** only make a difference on Mac OSX for the default SQLite code.\n** (Third-party VFS implementations might also make the distinction\n** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the\n** operating systems natively supported by SQLite, only Mac OSX\n** cares about the difference.)\n*/\n#define SQLITE_SYNC_NORMAL        0x00002\n#define SQLITE_SYNC_FULL          0x00003\n#define SQLITE_SYNC_DATAONLY      0x00010\n\n/*\n** CAPI3REF: OS Interface Open File Handle\n**\n** An [sqlite3_file] object represents an open file in the \n** [sqlite3_vfs | OS interface layer].  Individual OS interface\n** implementations will\n** want to subclass this object by appending additional fields\n** for their own use.  The pMethods entry is a pointer to an\n** [sqlite3_io_methods] object that defines methods for performing\n** I/O operations on the open file.\n*/\ntypedef struct sqlite3_file sqlite3_file;\nstruct sqlite3_file {\n  const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */\n};\n\n/*\n** CAPI3REF: OS Interface File Virtual Methods Object\n**\n** Every file opened by the [sqlite3_vfs.xOpen] method populates an\n** [sqlite3_file] object (or, more commonly, a subclass of the\n** [sqlite3_file] object) with a pointer to an instance of this object.\n** This object defines the methods used to perform various operations\n** against the open file represented by the [sqlite3_file] object.\n**\n** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element \n** to a non-NULL pointer, then the sqlite3_io_methods.xClose method\n** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The\n** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]\n** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element\n** to NULL.\n**\n** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or\n** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().\n** The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]\n** flag may be ORed in to indicate that only the data of the file\n** and not its inode needs to be synced.\n**\n** The integer values to xLock() and xUnlock() are one of\n** <ul>\n** <li> [SQLITE_LOCK_NONE],\n** <li> [SQLITE_LOCK_SHARED],\n** <li> [SQLITE_LOCK_RESERVED],\n** <li> [SQLITE_LOCK_PENDING], or\n** <li> [SQLITE_LOCK_EXCLUSIVE].\n** </ul>\n** xLock() increases the lock. xUnlock() decreases the lock.\n** The xCheckReservedLock() method checks whether any database connection,\n** either in this process or in some other process, is holding a RESERVED,\n** PENDING, or EXCLUSIVE lock on the file.  It returns true\n** if such a lock exists and false otherwise.\n**\n** The xFileControl() method is a generic interface that allows custom\n** VFS implementations to directly control an open file using the\n** [sqlite3_file_control()] interface.  The second \"op\" argument is an\n** integer opcode.  The third argument is a generic pointer intended to\n** point to a structure that may contain arguments or space in which to\n** write return values.  Potential uses for xFileControl() might be\n** functions to enable blocking locks with timeouts, to change the\n** locking strategy (for example to use dot-file locks), to inquire\n** about the status of a lock, or to break stale locks.  The SQLite\n** core reserves all opcodes less than 100 for its own use.\n** A [file control opcodes | list of opcodes] less than 100 is available.\n** Applications that define a custom xFileControl method should use opcodes\n** greater than 100 to avoid conflicts.  VFS implementations should\n** return [SQLITE_NOTFOUND] for file control opcodes that they do not\n** recognize.\n**\n** The xSectorSize() method returns the sector size of the\n** device that underlies the file.  The sector size is the\n** minimum write that can be performed without disturbing\n** other bytes in the file.  The xDeviceCharacteristics()\n** method returns a bit vector describing behaviors of the\n** underlying device:\n**\n** <ul>\n** <li> [SQLITE_IOCAP_ATOMIC]\n** <li> [SQLITE_IOCAP_ATOMIC512]\n** <li> [SQLITE_IOCAP_ATOMIC1K]\n** <li> [SQLITE_IOCAP_ATOMIC2K]\n** <li> [SQLITE_IOCAP_ATOMIC4K]\n** <li> [SQLITE_IOCAP_ATOMIC8K]\n** <li> [SQLITE_IOCAP_ATOMIC16K]\n** <li> [SQLITE_IOCAP_ATOMIC32K]\n** <li> [SQLITE_IOCAP_ATOMIC64K]\n** <li> [SQLITE_IOCAP_SAFE_APPEND]\n** <li> [SQLITE_IOCAP_SEQUENTIAL]\n** </ul>\n**\n** The SQLITE_IOCAP_ATOMIC property means that all writes of\n** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values\n** mean that writes of blocks that are nnn bytes in size and\n** are aligned to an address which is an integer multiple of\n** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means\n** that when data is appended to a file, the data is appended\n** first then the size of the file is extended, never the other\n** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that\n** information is written to disk in the same order as calls\n** to xWrite().\n**\n** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill\n** in the unread portions of the buffer with zeros.  A VFS that\n** fails to zero-fill short reads might seem to work.  However,\n** failure to zero-fill short reads will eventually lead to\n** database corruption.\n*/\ntypedef struct sqlite3_io_methods sqlite3_io_methods;\nstruct sqlite3_io_methods {\n  int iVersion;\n  int (*xClose)(sqlite3_file*);\n  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);\n  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);\n  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);\n  int (*xSync)(sqlite3_file*, int flags);\n  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);\n  int (*xLock)(sqlite3_file*, int);\n  int (*xUnlock)(sqlite3_file*, int);\n  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);\n  int (*xFileControl)(sqlite3_file*, int op, void *pArg);\n  int (*xSectorSize)(sqlite3_file*);\n  int (*xDeviceCharacteristics)(sqlite3_file*);\n  /* Methods above are valid for version 1 */\n  int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);\n  int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);\n  void (*xShmBarrier)(sqlite3_file*);\n  int (*xShmUnmap)(sqlite3_file*, int deleteFlag);\n  /* Methods above are valid for version 2 */\n  int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);\n  int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);\n  /* Methods above are valid for version 3 */\n  /* Additional methods may be added in future releases */\n};\n\n/*\n** CAPI3REF: Standard File Control Opcodes\n** KEYWORDS: {file control opcodes} {file control opcode}\n**\n** These integer constants are opcodes for the xFileControl method\n** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]\n** interface.\n**\n** <ul>\n** <li>[[SQLITE_FCNTL_LOCKSTATE]]\n** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This\n** opcode causes the xFileControl method to write the current state of\n** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],\n** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])\n** into an integer that the pArg argument points to. This capability\n** is used during testing and is only available when the SQLITE_TEST\n** compile-time option is used.\n**\n** <li>[[SQLITE_FCNTL_SIZE_HINT]]\n** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS\n** layer a hint of how large the database file will grow to be during the\n** current transaction.  This hint is not guaranteed to be accurate but it\n** is often close.  The underlying VFS might choose to preallocate database\n** file space based on this hint in order to help writes to the database\n** file run faster.\n**\n** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]\n** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS\n** extends and truncates the database file in chunks of a size specified\n** by the user. The fourth argument to [sqlite3_file_control()] should \n** point to an integer (type int) containing the new chunk-size to use\n** for the nominated database. Allocating database file space in large\n** chunks (say 1MB at a time), may reduce file-system fragmentation and\n** improve performance on some systems.\n**\n** <li>[[SQLITE_FCNTL_FILE_POINTER]]\n** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer\n** to the [sqlite3_file] object associated with a particular database\n** connection.  See also [SQLITE_FCNTL_JOURNAL_POINTER].\n**\n** <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]\n** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer\n** to the [sqlite3_file] object associated with the journal file (either\n** the [rollback journal] or the [write-ahead log]) for a particular database\n** connection.  See also [SQLITE_FCNTL_FILE_POINTER].\n**\n** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]\n** No longer in use.\n**\n** <li>[[SQLITE_FCNTL_SYNC]]\n** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and\n** sent to the VFS immediately before the xSync method is invoked on a\n** database file descriptor. Or, if the xSync method is not invoked \n** because the user has configured SQLite with \n** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place \n** of the xSync method. In most cases, the pointer argument passed with\n** this file-control is NULL. However, if the database file is being synced\n** as part of a multi-database commit, the argument points to a nul-terminated\n** string containing the transactions master-journal file name. VFSes that \n** do not need this signal should silently ignore this opcode. Applications \n** should not call [sqlite3_file_control()] with this opcode as doing so may \n** disrupt the operation of the specialized VFSes that do require it.  \n**\n** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]\n** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite\n** and sent to the VFS after a transaction has been committed immediately\n** but before the database is unlocked. VFSes that do not need this signal\n** should silently ignore this opcode. Applications should not call\n** [sqlite3_file_control()] with this opcode as doing so may disrupt the \n** operation of the specialized VFSes that do require it.  \n**\n** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]\n** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic\n** retry counts and intervals for certain disk I/O operations for the\n** windows [VFS] in order to provide robustness in the presence of\n** anti-virus programs.  By default, the windows VFS will retry file read,\n** file write, and file delete operations up to 10 times, with a delay\n** of 25 milliseconds before the first retry and with the delay increasing\n** by an additional 25 milliseconds with each subsequent retry.  This\n** opcode allows these two values (10 retries and 25 milliseconds of delay)\n** to be adjusted.  The values are changed for all database connections\n** within the same process.  The argument is a pointer to an array of two\n** integers where the first integer i the new retry count and the second\n** integer is the delay.  If either integer is negative, then the setting\n** is not changed but instead the prior value of that setting is written\n** into the array entry, allowing the current retry settings to be\n** interrogated.  The zDbName parameter is ignored.\n**\n** <li>[[SQLITE_FCNTL_PERSIST_WAL]]\n** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the\n** persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary\n** write ahead log and shared memory files used for transaction control\n** are automatically deleted when the latest connection to the database\n** closes.  Setting persistent WAL mode causes those files to persist after\n** close.  Persisting the files is useful when other processes that do not\n** have write permission on the directory containing the database file want\n** to read the database file, as the WAL and shared memory files must exist\n** in order for the database to be readable.  The fourth parameter to\n** [sqlite3_file_control()] for this opcode should be a pointer to an integer.\n** That integer is 0 to disable persistent WAL mode or 1 to enable persistent\n** WAL mode.  If the integer is -1, then it is overwritten with the current\n** WAL persistence setting.\n**\n** <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]\n** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the\n** persistent \"powersafe-overwrite\" or \"PSOW\" setting.  The PSOW setting\n** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the\n** xDeviceCharacteristics methods. The fourth parameter to\n** [sqlite3_file_control()] for this opcode should be a pointer to an integer.\n** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage\n** mode.  If the integer is -1, then it is overwritten with the current\n** zero-damage mode setting.\n**\n** <li>[[SQLITE_FCNTL_OVERWRITE]]\n** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening\n** a write transaction to indicate that, unless it is rolled back for some\n** reason, the entire database file will be overwritten by the current \n** transaction. This is used by VACUUM operations.\n**\n** <li>[[SQLITE_FCNTL_VFSNAME]]\n** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of\n** all [VFSes] in the VFS stack.  The names are of all VFS shims and the\n** final bottom-level VFS are written into memory obtained from \n** [sqlite3_malloc()] and the result is stored in the char* variable\n** that the fourth parameter of [sqlite3_file_control()] points to.\n** The caller is responsible for freeing the memory when done.  As with\n** all file-control actions, there is no guarantee that this will actually\n** do anything.  Callers should initialize the char* variable to a NULL\n** pointer in case this file-control is not implemented.  This file-control\n** is intended for diagnostic use only.\n**\n** <li>[[SQLITE_FCNTL_VFS_POINTER]]\n** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level\n** [VFSes] currently in use.  ^(The argument X in\n** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be\n** of type \"[sqlite3_vfs] **\".  This opcodes will set *X\n** to a pointer to the top-level VFS.)^\n** ^When there are multiple VFS shims in the stack, this opcode finds the\n** upper-most shim only.\n**\n** <li>[[SQLITE_FCNTL_PRAGMA]]\n** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] \n** file control is sent to the open [sqlite3_file] object corresponding\n** to the database file to which the pragma statement refers. ^The argument\n** to the [SQLITE_FCNTL_PRAGMA] file control is an array of\n** pointers to strings (char**) in which the second element of the array\n** is the name of the pragma and the third element is the argument to the\n** pragma or NULL if the pragma has no argument.  ^The handler for an\n** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element\n** of the char** argument point to a string obtained from [sqlite3_mprintf()]\n** or the equivalent and that string will become the result of the pragma or\n** the error message if the pragma fails. ^If the\n** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal \n** [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]\n** file control returns [SQLITE_OK], then the parser assumes that the\n** VFS has handled the PRAGMA itself and the parser generates a no-op\n** prepared statement if result string is NULL, or that returns a copy\n** of the result string if the string is non-NULL.\n** ^If the [SQLITE_FCNTL_PRAGMA] file control returns\n** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means\n** that the VFS encountered an error while handling the [PRAGMA] and the\n** compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]\n** file control occurs at the beginning of pragma statement analysis and so\n** it is able to override built-in [PRAGMA] statements.\n**\n** <li>[[SQLITE_FCNTL_BUSYHANDLER]]\n** ^The [SQLITE_FCNTL_BUSYHANDLER]\n** file-control may be invoked by SQLite on the database file handle\n** shortly after it is opened in order to provide a custom VFS with access\n** to the connections busy-handler callback. The argument is of type (void **)\n** - an array of two (void *) values. The first (void *) actually points\n** to a function of type (int (*)(void *)). In order to invoke the connections\n** busy-handler, this function should be invoked with the second (void *) in\n** the array as the only argument. If it returns non-zero, then the operation\n** should be retried. If it returns zero, the custom VFS should abandon the\n** current operation.\n**\n** <li>[[SQLITE_FCNTL_TEMPFILENAME]]\n** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control\n** to have SQLite generate a\n** temporary filename using the same algorithm that is followed to generate\n** temporary filenames for TEMP tables and other internal uses.  The\n** argument should be a char** which will be filled with the filename\n** written into memory obtained from [sqlite3_malloc()].  The caller should\n** invoke [sqlite3_free()] on the result to avoid a memory leak.\n**\n** <li>[[SQLITE_FCNTL_MMAP_SIZE]]\n** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the\n** maximum number of bytes that will be used for memory-mapped I/O.\n** The argument is a pointer to a value of type sqlite3_int64 that\n** is an advisory maximum number of bytes in the file to memory map.  The\n** pointer is overwritten with the old value.  The limit is not changed if\n** the value originally pointed to is negative, and so the current limit \n** can be queried by passing in a pointer to a negative number.  This\n** file-control is used internally to implement [PRAGMA mmap_size].\n**\n** <li>[[SQLITE_FCNTL_TRACE]]\n** The [SQLITE_FCNTL_TRACE] file control provides advisory information\n** to the VFS about what the higher layers of the SQLite stack are doing.\n** This file control is used by some VFS activity tracing [shims].\n** The argument is a zero-terminated string.  Higher layers in the\n** SQLite stack may generate instances of this file control if\n** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.\n**\n** <li>[[SQLITE_FCNTL_HAS_MOVED]]\n** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a\n** pointer to an integer and it writes a boolean into that integer depending\n** on whether or not the file has been renamed, moved, or deleted since it\n** was first opened.\n**\n** <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]\n** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the\n** underlying native file handle associated with a file handle.  This file\n** control interprets its argument as a pointer to a native file handle and\n** writes the resulting value there.\n**\n** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]\n** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This\n** opcode causes the xFileControl method to swap the file handle with the one\n** pointed to by the pArg argument.  This capability is used during testing\n** and only needs to be supported when SQLITE_TEST is defined.\n**\n** <li>[[SQLITE_FCNTL_WAL_BLOCK]]\n** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might\n** be advantageous to block on the next WAL lock if the lock is not immediately\n** available.  The WAL subsystem issues this signal during rare\n** circumstances in order to fix a problem with priority inversion.\n** Applications should <em>not</em> use this file-control.\n**\n** <li>[[SQLITE_FCNTL_ZIPVFS]]\n** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other\n** VFS should return SQLITE_NOTFOUND for this opcode.\n**\n** <li>[[SQLITE_FCNTL_RBU]]\n** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by\n** the RBU extension only.  All other VFS should return SQLITE_NOTFOUND for\n** this opcode.  \n** </ul>\n*/\n#define SQLITE_FCNTL_LOCKSTATE               1\n#define SQLITE_FCNTL_GET_LOCKPROXYFILE       2\n#define SQLITE_FCNTL_SET_LOCKPROXYFILE       3\n#define SQLITE_FCNTL_LAST_ERRNO              4\n#define SQLITE_FCNTL_SIZE_HINT               5\n#define SQLITE_FCNTL_CHUNK_SIZE              6\n#define SQLITE_FCNTL_FILE_POINTER            7\n#define SQLITE_FCNTL_SYNC_OMITTED            8\n#define SQLITE_FCNTL_WIN32_AV_RETRY          9\n#define SQLITE_FCNTL_PERSIST_WAL            10\n#define SQLITE_FCNTL_OVERWRITE              11\n#define SQLITE_FCNTL_VFSNAME                12\n#define SQLITE_FCNTL_POWERSAFE_OVERWRITE    13\n#define SQLITE_FCNTL_PRAGMA                 14\n#define SQLITE_FCNTL_BUSYHANDLER            15\n#define SQLITE_FCNTL_TEMPFILENAME           16\n#define SQLITE_FCNTL_MMAP_SIZE              18\n#define SQLITE_FCNTL_TRACE                  19\n#define SQLITE_FCNTL_HAS_MOVED              20\n#define SQLITE_FCNTL_SYNC                   21\n#define SQLITE_FCNTL_COMMIT_PHASETWO        22\n#define SQLITE_FCNTL_WIN32_SET_HANDLE       23\n#define SQLITE_FCNTL_WAL_BLOCK              24\n#define SQLITE_FCNTL_ZIPVFS                 25\n#define SQLITE_FCNTL_RBU                    26\n#define SQLITE_FCNTL_VFS_POINTER            27\n#define SQLITE_FCNTL_JOURNAL_POINTER        28\n#define SQLITE_FCNTL_WIN32_GET_HANDLE       29\n\n/* deprecated names */\n#define SQLITE_GET_LOCKPROXYFILE      SQLITE_FCNTL_GET_LOCKPROXYFILE\n#define SQLITE_SET_LOCKPROXYFILE      SQLITE_FCNTL_SET_LOCKPROXYFILE\n#define SQLITE_LAST_ERRNO             SQLITE_FCNTL_LAST_ERRNO\n\n\n/*\n** CAPI3REF: Mutex Handle\n**\n** The mutex module within SQLite defines [sqlite3_mutex] to be an\n** abstract type for a mutex object.  The SQLite core never looks\n** at the internal representation of an [sqlite3_mutex].  It only\n** deals with pointers to the [sqlite3_mutex] object.\n**\n** Mutexes are created using [sqlite3_mutex_alloc()].\n*/\ntypedef struct sqlite3_mutex sqlite3_mutex;\n\n/*\n** CAPI3REF: Loadable Extension Thunk\n**\n** A pointer to the opaque sqlite3_api_routines structure is passed as\n** the third parameter to entry points of [loadable extensions].  This\n** structure must be typedefed in order to work around compiler warnings\n** on some platforms.\n*/\ntypedef struct sqlite3_api_routines sqlite3_api_routines;\n\n/*\n** CAPI3REF: OS Interface Object\n**\n** An instance of the sqlite3_vfs object defines the interface between\n** the SQLite core and the underlying operating system.  The \"vfs\"\n** in the name of the object stands for \"virtual file system\".  See\n** the [VFS | VFS documentation] for further information.\n**\n** The value of the iVersion field is initially 1 but may be larger in\n** future versions of SQLite.  Additional fields may be appended to this\n** object when the iVersion value is increased.  Note that the structure\n** of the sqlite3_vfs object changes in the transaction between\n** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not\n** modified.\n**\n** The szOsFile field is the size of the subclassed [sqlite3_file]\n** structure used by this VFS.  mxPathname is the maximum length of\n** a pathname in this VFS.\n**\n** Registered sqlite3_vfs objects are kept on a linked list formed by\n** the pNext pointer.  The [sqlite3_vfs_register()]\n** and [sqlite3_vfs_unregister()] interfaces manage this list\n** in a thread-safe way.  The [sqlite3_vfs_find()] interface\n** searches the list.  Neither the application code nor the VFS\n** implementation should use the pNext pointer.\n**\n** The pNext field is the only field in the sqlite3_vfs\n** structure that SQLite will ever modify.  SQLite will only access\n** or modify this field while holding a particular static mutex.\n** The application should never modify anything within the sqlite3_vfs\n** object once the object has been registered.\n**\n** The zName field holds the name of the VFS module.  The name must\n** be unique across all VFS modules.\n**\n** [[sqlite3_vfs.xOpen]]\n** ^SQLite guarantees that the zFilename parameter to xOpen\n** is either a NULL pointer or string obtained\n** from xFullPathname() with an optional suffix added.\n** ^If a suffix is added to the zFilename parameter, it will\n** consist of a single \"-\" character followed by no more than\n** 11 alphanumeric and/or \"-\" characters.\n** ^SQLite further guarantees that\n** the string will be valid and unchanged until xClose() is\n** called. Because of the previous sentence,\n** the [sqlite3_file] can safely store a pointer to the\n** filename if it needs to remember the filename for some reason.\n** If the zFilename parameter to xOpen is a NULL pointer then xOpen\n** must invent its own temporary name for the file.  ^Whenever the \n** xFilename parameter is NULL it will also be the case that the\n** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].\n**\n** The flags argument to xOpen() includes all bits set in\n** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]\n** or [sqlite3_open16()] is used, then flags includes at least\n** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. \n** If xOpen() opens a file read-only then it sets *pOutFlags to\n** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.\n**\n** ^(SQLite will also add one of the following flags to the xOpen()\n** call, depending on the object being opened:\n**\n** <ul>\n** <li>  [SQLITE_OPEN_MAIN_DB]\n** <li>  [SQLITE_OPEN_MAIN_JOURNAL]\n** <li>  [SQLITE_OPEN_TEMP_DB]\n** <li>  [SQLITE_OPEN_TEMP_JOURNAL]\n** <li>  [SQLITE_OPEN_TRANSIENT_DB]\n** <li>  [SQLITE_OPEN_SUBJOURNAL]\n** <li>  [SQLITE_OPEN_MASTER_JOURNAL]\n** <li>  [SQLITE_OPEN_WAL]\n** </ul>)^\n**\n** The file I/O implementation can use the object type flags to\n** change the way it deals with files.  For example, an application\n** that does not care about crash recovery or rollback might make\n** the open of a journal file a no-op.  Writes to this journal would\n** also be no-ops, and any attempt to read the journal would return\n** SQLITE_IOERR.  Or the implementation might recognize that a database\n** file will be doing page-aligned sector reads and writes in a random\n** order and set up its I/O subsystem accordingly.\n**\n** SQLite might also add one of the following flags to the xOpen method:\n**\n** <ul>\n** <li> [SQLITE_OPEN_DELETEONCLOSE]\n** <li> [SQLITE_OPEN_EXCLUSIVE]\n** </ul>\n**\n** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be\n** deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]\n** will be set for TEMP databases and their journals, transient\n** databases, and subjournals.\n**\n** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction\n** with the [SQLITE_OPEN_CREATE] flag, which are both directly\n** analogous to the O_EXCL and O_CREAT flags of the POSIX open()\n** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the \n** SQLITE_OPEN_CREATE, is used to indicate that file should always\n** be created, and that it is an error if it already exists.\n** It is <i>not</i> used to indicate the file should be opened \n** for exclusive access.\n**\n** ^At least szOsFile bytes of memory are allocated by SQLite\n** to hold the  [sqlite3_file] structure passed as the third\n** argument to xOpen.  The xOpen method does not have to\n** allocate the structure; it should just fill it in.  Note that\n** the xOpen method must set the sqlite3_file.pMethods to either\n** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do\n** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods\n** element will be valid after xOpen returns regardless of the success\n** or failure of the xOpen call.\n**\n** [[sqlite3_vfs.xAccess]]\n** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]\n** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to\n** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]\n** to test whether a file is at least readable.   The file can be a\n** directory.\n**\n** ^SQLite will always allocate at least mxPathname+1 bytes for the\n** output buffer xFullPathname.  The exact size of the output buffer\n** is also passed as a parameter to both  methods. If the output buffer\n** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is\n** handled as a fatal error by SQLite, vfs implementations should endeavor\n** to prevent this by setting mxPathname to a sufficiently large value.\n**\n** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()\n** interfaces are not strictly a part of the filesystem, but they are\n** included in the VFS structure for completeness.\n** The xRandomness() function attempts to return nBytes bytes\n** of good-quality randomness into zOut.  The return value is\n** the actual number of bytes of randomness obtained.\n** The xSleep() method causes the calling thread to sleep for at\n** least the number of microseconds given.  ^The xCurrentTime()\n** method returns a Julian Day Number for the current date and time as\n** a floating point value.\n** ^The xCurrentTimeInt64() method returns, as an integer, the Julian\n** Day Number multiplied by 86400000 (the number of milliseconds in \n** a 24-hour day).  \n** ^SQLite will use the xCurrentTimeInt64() method to get the current\n** date and time if that method is available (if iVersion is 2 or \n** greater and the function pointer is not NULL) and will fall back\n** to xCurrentTime() if xCurrentTimeInt64() is unavailable.\n**\n** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces\n** are not used by the SQLite core.  These optional interfaces are provided\n** by some VFSes to facilitate testing of the VFS code. By overriding \n** system calls with functions under its control, a test program can\n** simulate faults and error conditions that would otherwise be difficult\n** or impossible to induce.  The set of system calls that can be overridden\n** varies from one VFS to another, and from one version of the same VFS to the\n** next.  Applications that use these interfaces must be prepared for any\n** or all of these interfaces to be NULL or for their behavior to change\n** from one release to the next.  Applications must not attempt to access\n** any of these methods if the iVersion of the VFS is less than 3.\n*/\ntypedef struct sqlite3_vfs sqlite3_vfs;\ntypedef void (*sqlite3_syscall_ptr)(void);\nstruct sqlite3_vfs {\n  int iVersion;            /* Structure version number (currently 3) */\n  int szOsFile;            /* Size of subclassed sqlite3_file */\n  int mxPathname;          /* Maximum file pathname length */\n  sqlite3_vfs *pNext;      /* Next registered VFS */\n  const char *zName;       /* Name of this virtual file system */\n  void *pAppData;          /* Pointer to application-specific data */\n  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,\n               int flags, int *pOutFlags);\n  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);\n  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);\n  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);\n  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);\n  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);\n  void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);\n  void (*xDlClose)(sqlite3_vfs*, void*);\n  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);\n  int (*xSleep)(sqlite3_vfs*, int microseconds);\n  int (*xCurrentTime)(sqlite3_vfs*, double*);\n  int (*xGetLastError)(sqlite3_vfs*, int, char *);\n  /*\n  ** The methods above are in version 1 of the sqlite_vfs object\n  ** definition.  Those that follow are added in version 2 or later\n  */\n  int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);\n  /*\n  ** The methods above are in versions 1 and 2 of the sqlite_vfs object.\n  ** Those below are for version 3 and greater.\n  */\n  int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);\n  sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);\n  const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);\n  /*\n  ** The methods above are in versions 1 through 3 of the sqlite_vfs object.\n  ** New fields may be appended in future versions.  The iVersion\n  ** value will increment whenever this happens. \n  */\n};\n\n/*\n** CAPI3REF: Flags for the xAccess VFS method\n**\n** These integer constants can be used as the third parameter to\n** the xAccess method of an [sqlite3_vfs] object.  They determine\n** what kind of permissions the xAccess method is looking for.\n** With SQLITE_ACCESS_EXISTS, the xAccess method\n** simply checks whether the file exists.\n** With SQLITE_ACCESS_READWRITE, the xAccess method\n** checks whether the named directory is both readable and writable\n** (in other words, if files can be added, removed, and renamed within\n** the directory).\n** The SQLITE_ACCESS_READWRITE constant is currently used only by the\n** [temp_store_directory pragma], though this could change in a future\n** release of SQLite.\n** With SQLITE_ACCESS_READ, the xAccess method\n** checks whether the file is readable.  The SQLITE_ACCESS_READ constant is\n** currently unused, though it might be used in a future release of\n** SQLite.\n*/\n#define SQLITE_ACCESS_EXISTS    0\n#define SQLITE_ACCESS_READWRITE 1   /* Used by PRAGMA temp_store_directory */\n#define SQLITE_ACCESS_READ      2   /* Unused */\n\n/*\n** CAPI3REF: Flags for the xShmLock VFS method\n**\n** These integer constants define the various locking operations\n** allowed by the xShmLock method of [sqlite3_io_methods].  The\n** following are the only legal combinations of flags to the\n** xShmLock method:\n**\n** <ul>\n** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_SHARED\n** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE\n** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED\n** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE\n** </ul>\n**\n** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as\n** was given on the corresponding lock.  \n**\n** The xShmLock method can transition between unlocked and SHARED or\n** between unlocked and EXCLUSIVE.  It cannot transition between SHARED\n** and EXCLUSIVE.\n*/\n#define SQLITE_SHM_UNLOCK       1\n#define SQLITE_SHM_LOCK         2\n#define SQLITE_SHM_SHARED       4\n#define SQLITE_SHM_EXCLUSIVE    8\n\n/*\n** CAPI3REF: Maximum xShmLock index\n**\n** The xShmLock method on [sqlite3_io_methods] may use values\n** between 0 and this upper bound as its \"offset\" argument.\n** The SQLite core will never attempt to acquire or release a\n** lock outside of this range\n*/\n#define SQLITE_SHM_NLOCK        8\n\n\n/*\n** CAPI3REF: Initialize The SQLite Library\n**\n** ^The sqlite3_initialize() routine initializes the\n** SQLite library.  ^The sqlite3_shutdown() routine\n** deallocates any resources that were allocated by sqlite3_initialize().\n** These routines are designed to aid in process initialization and\n** shutdown on embedded systems.  Workstation applications using\n** SQLite normally do not need to invoke either of these routines.\n**\n** A call to sqlite3_initialize() is an \"effective\" call if it is\n** the first time sqlite3_initialize() is invoked during the lifetime of\n** the process, or if it is the first time sqlite3_initialize() is invoked\n** following a call to sqlite3_shutdown().  ^(Only an effective call\n** of sqlite3_initialize() does any initialization.  All other calls\n** are harmless no-ops.)^\n**\n** A call to sqlite3_shutdown() is an \"effective\" call if it is the first\n** call to sqlite3_shutdown() since the last sqlite3_initialize().  ^(Only\n** an effective call to sqlite3_shutdown() does any deinitialization.\n** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^\n**\n** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()\n** is not.  The sqlite3_shutdown() interface must only be called from a\n** single thread.  All open [database connections] must be closed and all\n** other SQLite resources must be deallocated prior to invoking\n** sqlite3_shutdown().\n**\n** Among other things, ^sqlite3_initialize() will invoke\n** sqlite3_os_init().  Similarly, ^sqlite3_shutdown()\n** will invoke sqlite3_os_end().\n**\n** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.\n** ^If for some reason, sqlite3_initialize() is unable to initialize\n** the library (perhaps it is unable to allocate a needed resource such\n** as a mutex) it returns an [error code] other than [SQLITE_OK].\n**\n** ^The sqlite3_initialize() routine is called internally by many other\n** SQLite interfaces so that an application usually does not need to\n** invoke sqlite3_initialize() directly.  For example, [sqlite3_open()]\n** calls sqlite3_initialize() so the SQLite library will be automatically\n** initialized when [sqlite3_open()] is called if it has not be initialized\n** already.  ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]\n** compile-time option, then the automatic calls to sqlite3_initialize()\n** are omitted and the application must call sqlite3_initialize() directly\n** prior to using any other SQLite interface.  For maximum portability,\n** it is recommended that applications always invoke sqlite3_initialize()\n** directly prior to using any other SQLite interface.  Future releases\n** of SQLite may require this.  In other words, the behavior exhibited\n** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the\n** default behavior in some future release of SQLite.\n**\n** The sqlite3_os_init() routine does operating-system specific\n** initialization of the SQLite library.  The sqlite3_os_end()\n** routine undoes the effect of sqlite3_os_init().  Typical tasks\n** performed by these routines include allocation or deallocation\n** of static resources, initialization of global variables,\n** setting up a default [sqlite3_vfs] module, or setting up\n** a default configuration using [sqlite3_config()].\n**\n** The application should never invoke either sqlite3_os_init()\n** or sqlite3_os_end() directly.  The application should only invoke\n** sqlite3_initialize() and sqlite3_shutdown().  The sqlite3_os_init()\n** interface is called automatically by sqlite3_initialize() and\n** sqlite3_os_end() is called by sqlite3_shutdown().  Appropriate\n** implementations for sqlite3_os_init() and sqlite3_os_end()\n** are built into SQLite when it is compiled for Unix, Windows, or OS/2.\n** When [custom builds | built for other platforms]\n** (using the [SQLITE_OS_OTHER=1] compile-time\n** option) the application must supply a suitable implementation for\n** sqlite3_os_init() and sqlite3_os_end().  An application-supplied\n** implementation of sqlite3_os_init() or sqlite3_os_end()\n** must return [SQLITE_OK] on success and some other [error code] upon\n** failure.\n*/\nSQLITE_API int sqlite3_initialize(void);\nSQLITE_API int sqlite3_shutdown(void);\nSQLITE_API int sqlite3_os_init(void);\nSQLITE_API int sqlite3_os_end(void);\n\n/*\n** CAPI3REF: Configuring The SQLite Library\n**\n** The sqlite3_config() interface is used to make global configuration\n** changes to SQLite in order to tune SQLite to the specific needs of\n** the application.  The default configuration is recommended for most\n** applications and so this routine is usually not necessary.  It is\n** provided to support rare applications with unusual needs.\n**\n** <b>The sqlite3_config() interface is not threadsafe. The application\n** must ensure that no other SQLite interfaces are invoked by other\n** threads while sqlite3_config() is running.</b>\n**\n** The sqlite3_config() interface\n** may only be invoked prior to library initialization using\n** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].\n** ^If sqlite3_config() is called after [sqlite3_initialize()] and before\n** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.\n** Note, however, that ^sqlite3_config() can be called as part of the\n** implementation of an application-defined [sqlite3_os_init()].\n**\n** The first argument to sqlite3_config() is an integer\n** [configuration option] that determines\n** what property of SQLite is to be configured.  Subsequent arguments\n** vary depending on the [configuration option]\n** in the first argument.\n**\n** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].\n** ^If the option is unknown or SQLite is unable to set the option\n** then this routine returns a non-zero [error code].\n*/\nSQLITE_API int sqlite3_config(int, ...);\n\n/*\n** CAPI3REF: Configure database connections\n** METHOD: sqlite3\n**\n** The sqlite3_db_config() interface is used to make configuration\n** changes to a [database connection].  The interface is similar to\n** [sqlite3_config()] except that the changes apply to a single\n** [database connection] (specified in the first argument).\n**\n** The second argument to sqlite3_db_config(D,V,...)  is the\n** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code \n** that indicates what aspect of the [database connection] is being configured.\n** Subsequent arguments vary depending on the configuration verb.\n**\n** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if\n** the call is considered successful.\n*/\nSQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);\n\n/*\n** CAPI3REF: Memory Allocation Routines\n**\n** An instance of this object defines the interface between SQLite\n** and low-level memory allocation routines.\n**\n** This object is used in only one place in the SQLite interface.\n** A pointer to an instance of this object is the argument to\n** [sqlite3_config()] when the configuration option is\n** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].  \n** By creating an instance of this object\n** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])\n** during configuration, an application can specify an alternative\n** memory allocation subsystem for SQLite to use for all of its\n** dynamic memory needs.\n**\n** Note that SQLite comes with several [built-in memory allocators]\n** that are perfectly adequate for the overwhelming majority of applications\n** and that this object is only useful to a tiny minority of applications\n** with specialized memory allocation requirements.  This object is\n** also used during testing of SQLite in order to specify an alternative\n** memory allocator that simulates memory out-of-memory conditions in\n** order to verify that SQLite recovers gracefully from such\n** conditions.\n**\n** The xMalloc, xRealloc, and xFree methods must work like the\n** malloc(), realloc() and free() functions from the standard C library.\n** ^SQLite guarantees that the second argument to\n** xRealloc is always a value returned by a prior call to xRoundup.\n**\n** xSize should return the allocated size of a memory allocation\n** previously obtained from xMalloc or xRealloc.  The allocated size\n** is always at least as big as the requested size but may be larger.\n**\n** The xRoundup method returns what would be the allocated size of\n** a memory allocation given a particular requested size.  Most memory\n** allocators round up memory allocations at least to the next multiple\n** of 8.  Some allocators round up to a larger multiple or to a power of 2.\n** Every memory allocation request coming in through [sqlite3_malloc()]\n** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, \n** that causes the corresponding memory allocation to fail.\n**\n** The xInit method initializes the memory allocator.  For example,\n** it might allocate any require mutexes or initialize internal data\n** structures.  The xShutdown method is invoked (indirectly) by\n** [sqlite3_shutdown()] and should deallocate any resources acquired\n** by xInit.  The pAppData pointer is used as the only parameter to\n** xInit and xShutdown.\n**\n** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes\n** the xInit method, so the xInit method need not be threadsafe.  The\n** xShutdown method is only called from [sqlite3_shutdown()] so it does\n** not need to be threadsafe either.  For all other methods, SQLite\n** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the\n** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which\n** it is by default) and so the methods are automatically serialized.\n** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other\n** methods must be threadsafe or else make their own arrangements for\n** serialization.\n**\n** SQLite will never invoke xInit() more than once without an intervening\n** call to xShutdown().\n*/\ntypedef struct sqlite3_mem_methods sqlite3_mem_methods;\nstruct sqlite3_mem_methods {\n  void *(*xMalloc)(int);         /* Memory allocation function */\n  void (*xFree)(void*);          /* Free a prior allocation */\n  void *(*xRealloc)(void*,int);  /* Resize an allocation */\n  int (*xSize)(void*);           /* Return the size of an allocation */\n  int (*xRoundup)(int);          /* Round up request size to allocation size */\n  int (*xInit)(void*);           /* Initialize the memory allocator */\n  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */\n  void *pAppData;                /* Argument to xInit() and xShutdown() */\n};\n\n/*\n** CAPI3REF: Configuration Options\n** KEYWORDS: {configuration option}\n**\n** These constants are the available integer configuration options that\n** can be passed as the first argument to the [sqlite3_config()] interface.\n**\n** New configuration options may be added in future releases of SQLite.\n** Existing configuration options might be discontinued.  Applications\n** should check the return code from [sqlite3_config()] to make sure that\n** the call worked.  The [sqlite3_config()] interface will return a\n** non-zero [error code] if a discontinued or unsupported configuration option\n** is invoked.\n**\n** <dl>\n** [[SQLITE_CONFIG_SINGLETHREAD]] <dt>SQLITE_CONFIG_SINGLETHREAD</dt>\n** <dd>There are no arguments to this option.  ^This option sets the\n** [threading mode] to Single-thread.  In other words, it disables\n** all mutexing and puts SQLite into a mode where it can only be used\n** by a single thread.   ^If SQLite is compiled with\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\n** it is not possible to change the [threading mode] from its default\n** value of Single-thread and so [sqlite3_config()] will return \n** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD\n** configuration option.</dd>\n**\n** [[SQLITE_CONFIG_MULTITHREAD]] <dt>SQLITE_CONFIG_MULTITHREAD</dt>\n** <dd>There are no arguments to this option.  ^This option sets the\n** [threading mode] to Multi-thread.  In other words, it disables\n** mutexing on [database connection] and [prepared statement] objects.\n** The application is responsible for serializing access to\n** [database connections] and [prepared statements].  But other mutexes\n** are enabled so that SQLite will be safe to use in a multi-threaded\n** environment as long as no two threads attempt to use the same\n** [database connection] at the same time.  ^If SQLite is compiled with\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\n** it is not possible to set the Multi-thread [threading mode] and\n** [sqlite3_config()] will return [SQLITE_ERROR] if called with the\n** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>\n**\n** [[SQLITE_CONFIG_SERIALIZED]] <dt>SQLITE_CONFIG_SERIALIZED</dt>\n** <dd>There are no arguments to this option.  ^This option sets the\n** [threading mode] to Serialized. In other words, this option enables\n** all mutexes including the recursive\n** mutexes on [database connection] and [prepared statement] objects.\n** In this mode (which is the default when SQLite is compiled with\n** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access\n** to [database connections] and [prepared statements] so that the\n** application is free to use the same [database connection] or the\n** same [prepared statement] in different threads at the same time.\n** ^If SQLite is compiled with\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\n** it is not possible to set the Serialized [threading mode] and\n** [sqlite3_config()] will return [SQLITE_ERROR] if called with the\n** SQLITE_CONFIG_SERIALIZED configuration option.</dd>\n**\n** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>\n** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is \n** a pointer to an instance of the [sqlite3_mem_methods] structure.\n** The argument specifies\n** alternative low-level memory allocation routines to be used in place of\n** the memory allocation routines built into SQLite.)^ ^SQLite makes\n** its own private copy of the content of the [sqlite3_mem_methods] structure\n** before the [sqlite3_config()] call returns.</dd>\n**\n** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>\n** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which\n** is a pointer to an instance of the [sqlite3_mem_methods] structure.\n** The [sqlite3_mem_methods]\n** structure is filled with the currently defined memory allocation routines.)^\n** This option can be used to overload the default memory allocation\n** routines with a wrapper that simulations memory allocation failure or\n** tracks memory usage, for example. </dd>\n**\n** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>\n** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,\n** interpreted as a boolean, which enables or disables the collection of\n** memory allocation statistics. ^(When memory allocation statistics are\n** disabled, the following SQLite interfaces become non-operational:\n**   <ul>\n**   <li> [sqlite3_memory_used()]\n**   <li> [sqlite3_memory_highwater()]\n**   <li> [sqlite3_soft_heap_limit64()]\n**   <li> [sqlite3_status64()]\n**   </ul>)^\n** ^Memory allocation statistics are enabled by default unless SQLite is\n** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory\n** allocation statistics are disabled by default.\n** </dd>\n**\n** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>\n** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer\n** that SQLite can use for scratch memory.  ^(There are three arguments\n** to SQLITE_CONFIG_SCRATCH:  A pointer an 8-byte\n** aligned memory buffer from which the scratch allocations will be\n** drawn, the size of each scratch allocation (sz),\n** and the maximum number of scratch allocations (N).)^\n** The first argument must be a pointer to an 8-byte aligned buffer\n** of at least sz*N bytes of memory.\n** ^SQLite will not use more than one scratch buffers per thread.\n** ^SQLite will never request a scratch buffer that is more than 6\n** times the database page size.\n** ^If SQLite needs needs additional\n** scratch memory beyond what is provided by this configuration option, then \n** [sqlite3_malloc()] will be used to obtain the memory needed.<p>\n** ^When the application provides any amount of scratch memory using\n** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large\n** [sqlite3_malloc|heap allocations].\n** This can help [Robson proof|prevent memory allocation failures] due to heap\n** fragmentation in low-memory embedded systems.\n** </dd>\n**\n** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>\n** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool\n** that SQLite can use for the database page cache with the default page\n** cache implementation.  \n** This configuration option is a no-op if an application-define page\n** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].\n** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to\n** 8-byte aligned memory (pMem), the size of each page cache line (sz),\n** and the number of cache lines (N).\n** The sz argument should be the size of the largest database page\n** (a power of two between 512 and 65536) plus some extra bytes for each\n** page header.  ^The number of extra bytes needed by the page header\n** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ].\n** ^It is harmless, apart from the wasted memory,\n** for the sz parameter to be larger than necessary.  The pMem\n** argument must be either a NULL pointer or a pointer to an 8-byte\n** aligned block of memory of at least sz*N bytes, otherwise\n** subsequent behavior is undefined.\n** ^When pMem is not NULL, SQLite will strive to use the memory provided\n** to satisfy page cache needs, falling back to [sqlite3_malloc()] if\n** a page cache line is larger than sz bytes or if all of the pMem buffer\n** is exhausted.\n** ^If pMem is NULL and N is non-zero, then each database connection\n** does an initial bulk allocation for page cache memory\n** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or\n** of -1024*N bytes if N is negative, . ^If additional\n** page cache memory is needed beyond what is provided by the initial\n** allocation, then SQLite goes to [sqlite3_malloc()] separately for each\n** additional cache line. </dd>\n**\n** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>\n** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer \n** that SQLite will use for all of its dynamic memory allocation needs\n** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and\n** [SQLITE_CONFIG_PAGECACHE].\n** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled\n** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns\n** [SQLITE_ERROR] if invoked otherwise.\n** ^There are three arguments to SQLITE_CONFIG_HEAP:\n** An 8-byte aligned pointer to the memory,\n** the number of bytes in the memory buffer, and the minimum allocation size.\n** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts\n** to using its default memory allocator (the system malloc() implementation),\n** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  ^If the\n** memory pointer is not NULL then the alternative memory\n** allocator is engaged to handle all of SQLites memory allocation needs.\n** The first pointer (the memory pointer) must be aligned to an 8-byte\n** boundary or subsequent behavior of SQLite will be undefined.\n** The minimum allocation size is capped at 2**12. Reasonable values\n** for the minimum allocation size are 2**5 through 2**8.</dd>\n**\n** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>\n** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a\n** pointer to an instance of the [sqlite3_mutex_methods] structure.\n** The argument specifies alternative low-level mutex routines to be used\n** in place the mutex routines built into SQLite.)^  ^SQLite makes a copy of\n** the content of the [sqlite3_mutex_methods] structure before the call to\n** [sqlite3_config()] returns. ^If SQLite is compiled with\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\n** the entire mutexing subsystem is omitted from the build and hence calls to\n** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will\n** return [SQLITE_ERROR].</dd>\n**\n** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>\n** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which\n** is a pointer to an instance of the [sqlite3_mutex_methods] structure.  The\n** [sqlite3_mutex_methods]\n** structure is filled with the currently defined mutex routines.)^\n** This option can be used to overload the default mutex allocation\n** routines with a wrapper used to track mutex usage for performance\n** profiling or testing, for example.   ^If SQLite is compiled with\n** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then\n** the entire mutexing subsystem is omitted from the build and hence calls to\n** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will\n** return [SQLITE_ERROR].</dd>\n**\n** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>\n** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine\n** the default size of lookaside memory on each [database connection].\n** The first argument is the\n** size of each lookaside buffer slot and the second is the number of\n** slots allocated to each database connection.)^  ^(SQLITE_CONFIG_LOOKASIDE\n** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]\n** option to [sqlite3_db_config()] can be used to change the lookaside\n** configuration on individual connections.)^ </dd>\n**\n** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>\n** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is \n** a pointer to an [sqlite3_pcache_methods2] object.  This object specifies\n** the interface to a custom page cache implementation.)^\n** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>\n**\n** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>\n** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which\n** is a pointer to an [sqlite3_pcache_methods2] object.  SQLite copies of\n** the current page cache implementation into that object.)^ </dd>\n**\n** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>\n** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite\n** global [error log].\n** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a\n** function with a call signature of void(*)(void*,int,const char*), \n** and a pointer to void. ^If the function pointer is not NULL, it is\n** invoked by [sqlite3_log()] to process each logging event.  ^If the\n** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.\n** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is\n** passed through as the first parameter to the application-defined logger\n** function whenever that function is invoked.  ^The second parameter to\n** the logger function is a copy of the first parameter to the corresponding\n** [sqlite3_log()] call and is intended to be a [result code] or an\n** [extended result code].  ^The third parameter passed to the logger is\n** log message after formatting via [sqlite3_snprintf()].\n** The SQLite logging interface is not reentrant; the logger function\n** supplied by the application must not invoke any SQLite interface.\n** In a multi-threaded application, the application-defined logger\n** function must be threadsafe. </dd>\n**\n** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI\n** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.\n** If non-zero, then URI handling is globally enabled. If the parameter is zero,\n** then URI handling is globally disabled.)^ ^If URI handling is globally\n** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],\n** [sqlite3_open16()] or\n** specified as part of [ATTACH] commands are interpreted as URIs, regardless\n** of whether or not the [SQLITE_OPEN_URI] flag is set when the database\n** connection is opened. ^If it is globally disabled, filenames are\n** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the\n** database connection is opened. ^(By default, URI handling is globally\n** disabled. The default value may be changed by compiling with the\n** [SQLITE_USE_URI] symbol defined.)^\n**\n** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN\n** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer\n** argument which is interpreted as a boolean in order to enable or disable\n** the use of covering indices for full table scans in the query optimizer.\n** ^The default setting is determined\n** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is \"on\"\n** if that compile-time option is omitted.\n** The ability to disable the use of covering indices for full table scans\n** is because some incorrectly coded legacy applications might malfunction\n** when the optimization is enabled.  Providing the ability to\n** disable the optimization allows the older, buggy application code to work\n** without change even with newer versions of SQLite.\n**\n** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]\n** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE\n** <dd> These options are obsolete and should not be used by new code.\n** They are retained for backwards compatibility but are now no-ops.\n** </dd>\n**\n** [[SQLITE_CONFIG_SQLLOG]]\n** <dt>SQLITE_CONFIG_SQLLOG\n** <dd>This option is only available if sqlite is compiled with the\n** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should\n** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int).\n** The second should be of type (void*). The callback is invoked by the library\n** in three separate circumstances, identified by the value passed as the\n** fourth parameter. If the fourth parameter is 0, then the database connection\n** passed as the second argument has just been opened. The third argument\n** points to a buffer containing the name of the main database file. If the\n** fourth parameter is 1, then the SQL statement that the third parameter\n** points to has just been executed. Or, if the fourth parameter is 2, then\n** the connection being passed as the second parameter is being closed. The\n** third parameter is passed NULL In this case.  An example of using this\n** configuration option can be seen in the \"test_sqllog.c\" source file in\n** the canonical SQLite source tree.</dd>\n**\n** [[SQLITE_CONFIG_MMAP_SIZE]]\n** <dt>SQLITE_CONFIG_MMAP_SIZE\n** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values\n** that are the default mmap size limit (the default setting for\n** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.\n** ^The default setting can be overridden by each database connection using\n** either the [PRAGMA mmap_size] command, or by using the\n** [SQLITE_FCNTL_MMAP_SIZE] file control.  ^(The maximum allowed mmap size\n** will be silently truncated if necessary so that it does not exceed the\n** compile-time maximum mmap size set by the\n** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^\n** ^If either argument to this option is negative, then that argument is\n** changed to its compile-time default.\n**\n** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]\n** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE\n** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is\n** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro\n** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value\n** that specifies the maximum size of the created heap.\n**\n** [[SQLITE_CONFIG_PCACHE_HDRSZ]]\n** <dt>SQLITE_CONFIG_PCACHE_HDRSZ\n** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which\n** is a pointer to an integer and writes into that integer the number of extra\n** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].\n** The amount of extra space required can change depending on the compiler,\n** target platform, and SQLite version.\n**\n** [[SQLITE_CONFIG_PMASZ]]\n** <dt>SQLITE_CONFIG_PMASZ\n** <dd>^The SQLITE_CONFIG_PMASZ option takes a single parameter which\n** is an unsigned integer and sets the \"Minimum PMA Size\" for the multithreaded\n** sorter to that integer.  The default minimum PMA Size is set by the\n** [SQLITE_SORTER_PMASZ] compile-time option.  New threads are launched\n** to help with sort operations when multithreaded sorting\n** is enabled (using the [PRAGMA threads] command) and the amount of content\n** to be sorted exceeds the page size times the minimum of the\n** [PRAGMA cache_size] setting and this value.\n**\n** [[SQLITE_CONFIG_STMTJRNL_SPILL]]\n** <dt>SQLITE_CONFIG_STMTJRNL_SPILL\n** <dd>^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which\n** becomes the [statement journal] spill-to-disk threshold.  \n** [Statement journals] are held in memory until their size (in bytes)\n** exceeds this threshold, at which point they are written to disk.\n** Or if the threshold is -1, statement journals are always held\n** exclusively in memory.\n** Since many statement journals never become large, setting the spill\n** threshold to a value such as 64KiB can greatly reduce the amount of\n** I/O required to support statement rollback.\n** The default value for this setting is controlled by the\n** [SQLITE_STMTJRNL_SPILL] compile-time option.\n** </dl>\n*/\n#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */\n#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */\n#define SQLITE_CONFIG_SERIALIZED    3  /* nil */\n#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */\n#define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */\n#define SQLITE_CONFIG_SCRATCH       6  /* void*, int sz, int N */\n#define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */\n#define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */\n#define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */\n#define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */\n#define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* */\n/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ \n#define SQLITE_CONFIG_LOOKASIDE    13  /* int int */\n#define SQLITE_CONFIG_PCACHE       14  /* no-op */\n#define SQLITE_CONFIG_GETPCACHE    15  /* no-op */\n#define SQLITE_CONFIG_LOG          16  /* xFunc, void* */\n#define SQLITE_CONFIG_URI          17  /* int */\n#define SQLITE_CONFIG_PCACHE2      18  /* sqlite3_pcache_methods2* */\n#define SQLITE_CONFIG_GETPCACHE2   19  /* sqlite3_pcache_methods2* */\n#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20  /* int */\n#define SQLITE_CONFIG_SQLLOG       21  /* xSqllog, void* */\n#define SQLITE_CONFIG_MMAP_SIZE    22  /* sqlite3_int64, sqlite3_int64 */\n#define SQLITE_CONFIG_WIN32_HEAPSIZE      23  /* int nByte */\n#define SQLITE_CONFIG_PCACHE_HDRSZ        24  /* int *psz */\n#define SQLITE_CONFIG_PMASZ               25  /* unsigned int szPma */\n#define SQLITE_CONFIG_STMTJRNL_SPILL      26  /* int nByte */\n\n/*\n** CAPI3REF: Database Connection Configuration Options\n**\n** These constants are the available integer configuration options that\n** can be passed as the second argument to the [sqlite3_db_config()] interface.\n**\n** New configuration options may be added in future releases of SQLite.\n** Existing configuration options might be discontinued.  Applications\n** should check the return code from [sqlite3_db_config()] to make sure that\n** the call worked.  ^The [sqlite3_db_config()] interface will return a\n** non-zero [error code] if a discontinued or unsupported configuration option\n** is invoked.\n**\n** <dl>\n** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>\n** <dd> ^This option takes three additional arguments that determine the \n** [lookaside memory allocator] configuration for the [database connection].\n** ^The first argument (the third parameter to [sqlite3_db_config()] is a\n** pointer to a memory buffer to use for lookaside memory.\n** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb\n** may be NULL in which case SQLite will allocate the\n** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the\n** size of each lookaside buffer slot.  ^The third argument is the number of\n** slots.  The size of the buffer in the first argument must be greater than\n** or equal to the product of the second and third arguments.  The buffer\n** must be aligned to an 8-byte boundary.  ^If the second argument to\n** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally\n** rounded down to the next smaller multiple of 8.  ^(The lookaside memory\n** configuration for a database connection can only be changed when that\n** connection is not currently using lookaside memory, or in other words\n** when the \"current value\" returned by\n** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero.\n** Any attempt to change the lookaside memory configuration when lookaside\n** memory is in use leaves the configuration unchanged and returns \n** [SQLITE_BUSY].)^</dd>\n**\n** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>\n** <dd> ^This option is used to enable or disable the enforcement of\n** [foreign key constraints].  There should be two additional arguments.\n** The first argument is an integer which is 0 to disable FK enforcement,\n** positive to enable FK enforcement or negative to leave FK enforcement\n** unchanged.  The second parameter is a pointer to an integer into which\n** is written 0 or 1 to indicate whether FK enforcement is off or on\n** following this call.  The second parameter may be a NULL pointer, in\n** which case the FK enforcement setting is not reported back. </dd>\n**\n** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>\n** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].\n** There should be two additional arguments.\n** The first argument is an integer which is 0 to disable triggers,\n** positive to enable triggers or negative to leave the setting unchanged.\n** The second parameter is a pointer to an integer into which\n** is written 0 or 1 to indicate whether triggers are disabled or enabled\n** following this call.  The second parameter may be a NULL pointer, in\n** which case the trigger setting is not reported back. </dd>\n**\n** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>\n** <dd> ^This option is used to enable or disable the two-argument\n** version of the [fts3_tokenizer()] function which is part of the\n** [FTS3] full-text search engine extension.\n** There should be two additional arguments.\n** The first argument is an integer which is 0 to disable fts3_tokenizer() or\n** positive to enable fts3_tokenizer() or negative to leave the setting\n** unchanged.\n** The second parameter is a pointer to an integer into which\n** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled\n** following this call.  The second parameter may be a NULL pointer, in\n** which case the new setting is not reported back. </dd>\n**\n** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>\n** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()]\n** interface independently of the [load_extension()] SQL function.\n** The [sqlite3_enable_load_extension()] API enables or disables both the\n** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].\n** There should be two additional arguments.\n** When the first argument to this interface is 1, then only the C-API is\n** enabled and the SQL function remains disabled.  If the first argument to\n** this interface is 0, then both the C-API and the SQL function are disabled.\n** If the first argument is -1, then no changes are made to state of either the\n** C-API or the SQL function.\n** The second parameter is a pointer to an integer into which\n** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface\n** is disabled or enabled following this call.  The second parameter may\n** be a NULL pointer, in which case the new setting is not reported back.\n** </dd>\n**\n** <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>\n** <dd> ^This option is used to change the name of the \"main\" database\n** schema.  ^The sole argument is a pointer to a constant UTF8 string\n** which will become the new schema name in place of \"main\".  ^SQLite\n** does not make a copy of the new main schema name string, so the application\n** must ensure that the argument passed into this DBCONFIG option is unchanged\n** until after the database connection closes.\n** </dd>\n**\n** </dl>\n*/\n#define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */\n#define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */\n#define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */\n#define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */\n#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */\n#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */\n\n\n/*\n** CAPI3REF: Enable Or Disable Extended Result Codes\n** METHOD: sqlite3\n**\n** ^The sqlite3_extended_result_codes() routine enables or disables the\n** [extended result codes] feature of SQLite. ^The extended result\n** codes are disabled by default for historical compatibility.\n*/\nSQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);\n\n/*\n** CAPI3REF: Last Insert Rowid\n** METHOD: sqlite3\n**\n** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)\n** has a unique 64-bit signed\n** integer key called the [ROWID | \"rowid\"]. ^The rowid is always available\n** as an undeclared column named ROWID, OID, or _ROWID_ as long as those\n** names are not also used by explicitly declared columns. ^If\n** the table has a column of type [INTEGER PRIMARY KEY] then that column\n** is another alias for the rowid.\n**\n** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the \n** most recent successful [INSERT] into a rowid table or [virtual table]\n** on database connection D.\n** ^Inserts into [WITHOUT ROWID] tables are not recorded.\n** ^If no successful [INSERT]s into rowid tables\n** have ever occurred on the database connection D, \n** then sqlite3_last_insert_rowid(D) returns zero.\n**\n** ^(If an [INSERT] occurs within a trigger or within a [virtual table]\n** method, then this routine will return the [rowid] of the inserted\n** row as long as the trigger or virtual table method is running.\n** But once the trigger or virtual table method ends, the value returned \n** by this routine reverts to what it was before the trigger or virtual\n** table method began.)^\n**\n** ^An [INSERT] that fails due to a constraint violation is not a\n** successful [INSERT] and does not change the value returned by this\n** routine.  ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,\n** and INSERT OR ABORT make no changes to the return value of this\n** routine when their insertion fails.  ^(When INSERT OR REPLACE\n** encounters a constraint violation, it does not fail.  The\n** INSERT continues to completion after deleting rows that caused\n** the constraint problem so INSERT OR REPLACE will always change\n** the return value of this interface.)^\n**\n** ^For the purposes of this routine, an [INSERT] is considered to\n** be successful even if it is subsequently rolled back.\n**\n** This function is accessible to SQL statements via the\n** [last_insert_rowid() SQL function].\n**\n** If a separate thread performs a new [INSERT] on the same\n** database connection while the [sqlite3_last_insert_rowid()]\n** function is running and thus changes the last insert [rowid],\n** then the value returned by [sqlite3_last_insert_rowid()] is\n** unpredictable and might not equal either the old or the new\n** last insert [rowid].\n*/\nSQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);\n\n/*\n** CAPI3REF: Count The Number Of Rows Modified\n** METHOD: sqlite3\n**\n** ^This function returns the number of rows modified, inserted or\n** deleted by the most recently completed INSERT, UPDATE or DELETE\n** statement on the database connection specified by the only parameter.\n** ^Executing any other type of SQL statement does not modify the value\n** returned by this function.\n**\n** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are\n** considered - auxiliary changes caused by [CREATE TRIGGER | triggers], \n** [foreign key actions] or [REPLACE] constraint resolution are not counted.\n** \n** Changes to a view that are intercepted by \n** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value \n** returned by sqlite3_changes() immediately after an INSERT, UPDATE or \n** DELETE statement run on a view is always zero. Only changes made to real \n** tables are counted.\n**\n** Things are more complicated if the sqlite3_changes() function is\n** executed while a trigger program is running. This may happen if the\n** program uses the [changes() SQL function], or if some other callback\n** function invokes sqlite3_changes() directly. Essentially:\n** \n** <ul>\n**   <li> ^(Before entering a trigger program the value returned by\n**        sqlite3_changes() function is saved. After the trigger program \n**        has finished, the original value is restored.)^\n** \n**   <li> ^(Within a trigger program each INSERT, UPDATE and DELETE \n**        statement sets the value returned by sqlite3_changes() \n**        upon completion as normal. Of course, this value will not include \n**        any changes performed by sub-triggers, as the sqlite3_changes() \n**        value will be saved and restored after each sub-trigger has run.)^\n** </ul>\n** \n** ^This means that if the changes() SQL function (or similar) is used\n** by the first INSERT, UPDATE or DELETE statement within a trigger, it \n** returns the value as set when the calling statement began executing.\n** ^If it is used by the second or subsequent such statement within a trigger \n** program, the value returned reflects the number of rows modified by the \n** previous INSERT, UPDATE or DELETE statement within the same trigger.\n**\n** See also the [sqlite3_total_changes()] interface, the\n** [count_changes pragma], and the [changes() SQL function].\n**\n** If a separate thread makes changes on the same database connection\n** while [sqlite3_changes()] is running then the value returned\n** is unpredictable and not meaningful.\n*/\nSQLITE_API int sqlite3_changes(sqlite3*);\n\n/*\n** CAPI3REF: Total Number Of Rows Modified\n** METHOD: sqlite3\n**\n** ^This function returns the total number of rows inserted, modified or\n** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed\n** since the database connection was opened, including those executed as\n** part of trigger programs. ^Executing any other type of SQL statement\n** does not affect the value returned by sqlite3_total_changes().\n** \n** ^Changes made as part of [foreign key actions] are included in the\n** count, but those made as part of REPLACE constraint resolution are\n** not. ^Changes to a view that are intercepted by INSTEAD OF triggers \n** are not counted.\n** \n** See also the [sqlite3_changes()] interface, the\n** [count_changes pragma], and the [total_changes() SQL function].\n**\n** If a separate thread makes changes on the same database connection\n** while [sqlite3_total_changes()] is running then the value\n** returned is unpredictable and not meaningful.\n*/\nSQLITE_API int sqlite3_total_changes(sqlite3*);\n\n/*\n** CAPI3REF: Interrupt A Long-Running Query\n** METHOD: sqlite3\n**\n** ^This function causes any pending database operation to abort and\n** return at its earliest opportunity. This routine is typically\n** called in response to a user action such as pressing \"Cancel\"\n** or Ctrl-C where the user wants a long query operation to halt\n** immediately.\n**\n** ^It is safe to call this routine from a thread different from the\n** thread that is currently running the database operation.  But it\n** is not safe to call this routine with a [database connection] that\n** is closed or might close before sqlite3_interrupt() returns.\n**\n** ^If an SQL operation is very nearly finished at the time when\n** sqlite3_interrupt() is called, then it might not have an opportunity\n** to be interrupted and might continue to completion.\n**\n** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].\n** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE\n** that is inside an explicit transaction, then the entire transaction\n** will be rolled back automatically.\n**\n** ^The sqlite3_interrupt(D) call is in effect until all currently running\n** SQL statements on [database connection] D complete.  ^Any new SQL statements\n** that are started after the sqlite3_interrupt() call and before the \n** running statements reaches zero are interrupted as if they had been\n** running prior to the sqlite3_interrupt() call.  ^New SQL statements\n** that are started after the running statement count reaches zero are\n** not effected by the sqlite3_interrupt().\n** ^A call to sqlite3_interrupt(D) that occurs when there are no running\n** SQL statements is a no-op and has no effect on SQL statements\n** that are started after the sqlite3_interrupt() call returns.\n**\n** If the database connection closes while [sqlite3_interrupt()]\n** is running then bad things will likely happen.\n*/\nSQLITE_API void sqlite3_interrupt(sqlite3*);\n\n/*\n** CAPI3REF: Determine If An SQL Statement Is Complete\n**\n** These routines are useful during command-line input to determine if the\n** currently entered text seems to form a complete SQL statement or\n** if additional input is needed before sending the text into\n** SQLite for parsing.  ^These routines return 1 if the input string\n** appears to be a complete SQL statement.  ^A statement is judged to be\n** complete if it ends with a semicolon token and is not a prefix of a\n** well-formed CREATE TRIGGER statement.  ^Semicolons that are embedded within\n** string literals or quoted identifier names or comments are not\n** independent tokens (they are part of the token in which they are\n** embedded) and thus do not count as a statement terminator.  ^Whitespace\n** and comments that follow the final semicolon are ignored.\n**\n** ^These routines return 0 if the statement is incomplete.  ^If a\n** memory allocation fails, then SQLITE_NOMEM is returned.\n**\n** ^These routines do not parse the SQL statements thus\n** will not detect syntactically incorrect SQL.\n**\n** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior \n** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked\n** automatically by sqlite3_complete16().  If that initialization fails,\n** then the return value from sqlite3_complete16() will be non-zero\n** regardless of whether or not the input SQL is complete.)^\n**\n** The input to [sqlite3_complete()] must be a zero-terminated\n** UTF-8 string.\n**\n** The input to [sqlite3_complete16()] must be a zero-terminated\n** UTF-16 string in native byte order.\n*/\nSQLITE_API int sqlite3_complete(const char *sql);\nSQLITE_API int sqlite3_complete16(const void *sql);\n\n/*\n** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors\n** KEYWORDS: {busy-handler callback} {busy handler}\n** METHOD: sqlite3\n**\n** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X\n** that might be invoked with argument P whenever\n** an attempt is made to access a database table associated with\n** [database connection] D when another thread\n** or process has the table locked.\n** The sqlite3_busy_handler() interface is used to implement\n** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout].\n**\n** ^If the busy callback is NULL, then [SQLITE_BUSY]\n** is returned immediately upon encountering the lock.  ^If the busy callback\n** is not NULL, then the callback might be invoked with two arguments.\n**\n** ^The first argument to the busy handler is a copy of the void* pointer which\n** is the third argument to sqlite3_busy_handler().  ^The second argument to\n** the busy handler callback is the number of times that the busy handler has\n** been invoked previously for the same locking event.  ^If the\n** busy callback returns 0, then no additional attempts are made to\n** access the database and [SQLITE_BUSY] is returned\n** to the application.\n** ^If the callback returns non-zero, then another attempt\n** is made to access the database and the cycle repeats.\n**\n** The presence of a busy handler does not guarantee that it will be invoked\n** when there is lock contention. ^If SQLite determines that invoking the busy\n** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]\n** to the application instead of invoking the \n** busy handler.\n** Consider a scenario where one process is holding a read lock that\n** it is trying to promote to a reserved lock and\n** a second process is holding a reserved lock that it is trying\n** to promote to an exclusive lock.  The first process cannot proceed\n** because it is blocked by the second and the second process cannot\n** proceed because it is blocked by the first.  If both processes\n** invoke the busy handlers, neither will make any progress.  Therefore,\n** SQLite returns [SQLITE_BUSY] for the first process, hoping that this\n** will induce the first process to release its read lock and allow\n** the second process to proceed.\n**\n** ^The default busy callback is NULL.\n**\n** ^(There can only be a single busy handler defined for each\n** [database connection].  Setting a new busy handler clears any\n** previously set handler.)^  ^Note that calling [sqlite3_busy_timeout()]\n** or evaluating [PRAGMA busy_timeout=N] will change the\n** busy handler and thus clear any previously set busy handler.\n**\n** The busy callback should not take any actions which modify the\n** database connection that invoked the busy handler.  In other words,\n** the busy handler is not reentrant.  Any such actions\n** result in undefined behavior.\n** \n** A busy handler must not close the database connection\n** or [prepared statement] that invoked the busy handler.\n*/\nSQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);\n\n/*\n** CAPI3REF: Set A Busy Timeout\n** METHOD: sqlite3\n**\n** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps\n** for a specified amount of time when a table is locked.  ^The handler\n** will sleep multiple times until at least \"ms\" milliseconds of sleeping\n** have accumulated.  ^After at least \"ms\" milliseconds of sleeping,\n** the handler returns 0 which causes [sqlite3_step()] to return\n** [SQLITE_BUSY].\n**\n** ^Calling this routine with an argument less than or equal to zero\n** turns off all busy handlers.\n**\n** ^(There can only be a single busy handler for a particular\n** [database connection] at any given moment.  If another busy handler\n** was defined  (using [sqlite3_busy_handler()]) prior to calling\n** this routine, that other busy handler is cleared.)^\n**\n** See also:  [PRAGMA busy_timeout]\n*/\nSQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);\n\n/*\n** CAPI3REF: Convenience Routines For Running Queries\n** METHOD: sqlite3\n**\n** This is a legacy interface that is preserved for backwards compatibility.\n** Use of this interface is not recommended.\n**\n** Definition: A <b>result table</b> is memory data structure created by the\n** [sqlite3_get_table()] interface.  A result table records the\n** complete query results from one or more queries.\n**\n** The table conceptually has a number of rows and columns.  But\n** these numbers are not part of the result table itself.  These\n** numbers are obtained separately.  Let N be the number of rows\n** and M be the number of columns.\n**\n** A result table is an array of pointers to zero-terminated UTF-8 strings.\n** There are (N+1)*M elements in the array.  The first M pointers point\n** to zero-terminated strings that  contain the names of the columns.\n** The remaining entries all point to query results.  NULL values result\n** in NULL pointers.  All other values are in their UTF-8 zero-terminated\n** string representation as returned by [sqlite3_column_text()].\n**\n** A result table might consist of one or more memory allocations.\n** It is not safe to pass a result table directly to [sqlite3_free()].\n** A result table should be deallocated using [sqlite3_free_table()].\n**\n** ^(As an example of the result table format, suppose a query result\n** is as follows:\n**\n** <blockquote><pre>\n**        Name        | Age\n**        -----------------------\n**        Alice       | 43\n**        Bob         | 28\n**        Cindy       | 21\n** </pre></blockquote>\n**\n** There are two column (M==2) and three rows (N==3).  Thus the\n** result table has 8 entries.  Suppose the result table is stored\n** in an array names azResult.  Then azResult holds this content:\n**\n** <blockquote><pre>\n**        azResult&#91;0] = \"Name\";\n**        azResult&#91;1] = \"Age\";\n**        azResult&#91;2] = \"Alice\";\n**        azResult&#91;3] = \"43\";\n**        azResult&#91;4] = \"Bob\";\n**        azResult&#91;5] = \"28\";\n**        azResult&#91;6] = \"Cindy\";\n**        azResult&#91;7] = \"21\";\n** </pre></blockquote>)^\n**\n** ^The sqlite3_get_table() function evaluates one or more\n** semicolon-separated SQL statements in the zero-terminated UTF-8\n** string of its 2nd parameter and returns a result table to the\n** pointer given in its 3rd parameter.\n**\n** After the application has finished with the result from sqlite3_get_table(),\n** it must pass the result table pointer to sqlite3_free_table() in order to\n** release the memory that was malloced.  Because of the way the\n** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling\n** function must not try to call [sqlite3_free()] directly.  Only\n** [sqlite3_free_table()] is able to release the memory properly and safely.\n**\n** The sqlite3_get_table() interface is implemented as a wrapper around\n** [sqlite3_exec()].  The sqlite3_get_table() routine does not have access\n** to any internal data structures of SQLite.  It uses only the public\n** interface defined here.  As a consequence, errors that occur in the\n** wrapper layer outside of the internal [sqlite3_exec()] call are not\n** reflected in subsequent calls to [sqlite3_errcode()] or\n** [sqlite3_errmsg()].\n*/\nSQLITE_API int sqlite3_get_table(\n  sqlite3 *db,          /* An open database */\n  const char *zSql,     /* SQL to be evaluated */\n  char ***pazResult,    /* Results of the query */\n  int *pnRow,           /* Number of result rows written here */\n  int *pnColumn,        /* Number of result columns written here */\n  char **pzErrmsg       /* Error msg written here */\n);\nSQLITE_API void sqlite3_free_table(char **result);\n\n/*\n** CAPI3REF: Formatted String Printing Functions\n**\n** These routines are work-alikes of the \"printf()\" family of functions\n** from the standard C library.\n** These routines understand most of the common K&R formatting options,\n** plus some additional non-standard formats, detailed below.\n** Note that some of the more obscure formatting options from recent\n** C-library standards are omitted from this implementation.\n**\n** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their\n** results into memory obtained from [sqlite3_malloc()].\n** The strings returned by these two routines should be\n** released by [sqlite3_free()].  ^Both routines return a\n** NULL pointer if [sqlite3_malloc()] is unable to allocate enough\n** memory to hold the resulting string.\n**\n** ^(The sqlite3_snprintf() routine is similar to \"snprintf()\" from\n** the standard C library.  The result is written into the\n** buffer supplied as the second parameter whose size is given by\n** the first parameter. Note that the order of the\n** first two parameters is reversed from snprintf().)^  This is an\n** historical accident that cannot be fixed without breaking\n** backwards compatibility.  ^(Note also that sqlite3_snprintf()\n** returns a pointer to its buffer instead of the number of\n** characters actually written into the buffer.)^  We admit that\n** the number of characters written would be a more useful return\n** value but we cannot change the implementation of sqlite3_snprintf()\n** now without breaking compatibility.\n**\n** ^As long as the buffer size is greater than zero, sqlite3_snprintf()\n** guarantees that the buffer is always zero-terminated.  ^The first\n** parameter \"n\" is the total size of the buffer, including space for\n** the zero terminator.  So the longest string that can be completely\n** written will be n-1 characters.\n**\n** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().\n**\n** These routines all implement some additional formatting\n** options that are useful for constructing SQL statements.\n** All of the usual printf() formatting options apply.  In addition, there\n** is are \"%q\", \"%Q\", \"%w\" and \"%z\" options.\n**\n** ^(The %q option works like %s in that it substitutes a nul-terminated\n** string from the argument list.  But %q also doubles every '\\'' character.\n** %q is designed for use inside a string literal.)^  By doubling each '\\''\n** character it escapes that character and allows it to be inserted into\n** the string.\n**\n** For example, assume the string variable zText contains text as follows:\n**\n** <blockquote><pre>\n**  char *zText = \"It's a happy day!\";\n** </pre></blockquote>\n**\n** One can use this text in an SQL statement as follows:\n**\n** <blockquote><pre>\n**  char *zSQL = sqlite3_mprintf(\"INSERT INTO table VALUES('%q')\", zText);\n**  sqlite3_exec(db, zSQL, 0, 0, 0);\n**  sqlite3_free(zSQL);\n** </pre></blockquote>\n**\n** Because the %q format string is used, the '\\'' character in zText\n** is escaped and the SQL generated is as follows:\n**\n** <blockquote><pre>\n**  INSERT INTO table1 VALUES('It''s a happy day!')\n** </pre></blockquote>\n**\n** This is correct.  Had we used %s instead of %q, the generated SQL\n** would have looked like this:\n**\n** <blockquote><pre>\n**  INSERT INTO table1 VALUES('It's a happy day!');\n** </pre></blockquote>\n**\n** This second example is an SQL syntax error.  As a general rule you should\n** always use %q instead of %s when inserting text into a string literal.\n**\n** ^(The %Q option works like %q except it also adds single quotes around\n** the outside of the total string.  Additionally, if the parameter in the\n** argument list is a NULL pointer, %Q substitutes the text \"NULL\" (without\n** single quotes).)^  So, for example, one could say:\n**\n** <blockquote><pre>\n**  char *zSQL = sqlite3_mprintf(\"INSERT INTO table VALUES(%Q)\", zText);\n**  sqlite3_exec(db, zSQL, 0, 0, 0);\n**  sqlite3_free(zSQL);\n** </pre></blockquote>\n**\n** The code above will render a correct SQL statement in the zSQL\n** variable even if the zText variable is a NULL pointer.\n**\n** ^(The \"%w\" formatting option is like \"%q\" except that it expects to\n** be contained within double-quotes instead of single quotes, and it\n** escapes the double-quote character instead of the single-quote\n** character.)^  The \"%w\" formatting option is intended for safely inserting\n** table and column names into a constructed SQL statement.\n**\n** ^(The \"%z\" formatting option works like \"%s\" but with the\n** addition that after the string has been read and copied into\n** the result, [sqlite3_free()] is called on the input string.)^\n*/\nSQLITE_API char *sqlite3_mprintf(const char*,...);\nSQLITE_API char *sqlite3_vmprintf(const char*, va_list);\nSQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);\nSQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);\n\n/*\n** CAPI3REF: Memory Allocation Subsystem\n**\n** The SQLite core uses these three routines for all of its own\n** internal memory allocation needs. \"Core\" in the previous sentence\n** does not include operating-system specific VFS implementation.  The\n** Windows VFS uses native malloc() and free() for some operations.\n**\n** ^The sqlite3_malloc() routine returns a pointer to a block\n** of memory at least N bytes in length, where N is the parameter.\n** ^If sqlite3_malloc() is unable to obtain sufficient free\n** memory, it returns a NULL pointer.  ^If the parameter N to\n** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns\n** a NULL pointer.\n**\n** ^The sqlite3_malloc64(N) routine works just like\n** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead\n** of a signed 32-bit integer.\n**\n** ^Calling sqlite3_free() with a pointer previously returned\n** by sqlite3_malloc() or sqlite3_realloc() releases that memory so\n** that it might be reused.  ^The sqlite3_free() routine is\n** a no-op if is called with a NULL pointer.  Passing a NULL pointer\n** to sqlite3_free() is harmless.  After being freed, memory\n** should neither be read nor written.  Even reading previously freed\n** memory might result in a segmentation fault or other severe error.\n** Memory corruption, a segmentation fault, or other severe error\n** might result if sqlite3_free() is called with a non-NULL pointer that\n** was not obtained from sqlite3_malloc() or sqlite3_realloc().\n**\n** ^The sqlite3_realloc(X,N) interface attempts to resize a\n** prior memory allocation X to be at least N bytes.\n** ^If the X parameter to sqlite3_realloc(X,N)\n** is a NULL pointer then its behavior is identical to calling\n** sqlite3_malloc(N).\n** ^If the N parameter to sqlite3_realloc(X,N) is zero or\n** negative then the behavior is exactly the same as calling\n** sqlite3_free(X).\n** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation\n** of at least N bytes in size or NULL if insufficient memory is available.\n** ^If M is the size of the prior allocation, then min(N,M) bytes\n** of the prior allocation are copied into the beginning of buffer returned\n** by sqlite3_realloc(X,N) and the prior allocation is freed.\n** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the\n** prior allocation is not freed.\n**\n** ^The sqlite3_realloc64(X,N) interfaces works the same as\n** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead\n** of a 32-bit signed integer.\n**\n** ^If X is a memory allocation previously obtained from sqlite3_malloc(),\n** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then\n** sqlite3_msize(X) returns the size of that memory allocation in bytes.\n** ^The value returned by sqlite3_msize(X) might be larger than the number\n** of bytes requested when X was allocated.  ^If X is a NULL pointer then\n** sqlite3_msize(X) returns zero.  If X points to something that is not\n** the beginning of memory allocation, or if it points to a formerly\n** valid memory allocation that has now been freed, then the behavior\n** of sqlite3_msize(X) is undefined and possibly harmful.\n**\n** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),\n** sqlite3_malloc64(), and sqlite3_realloc64()\n** is always aligned to at least an 8 byte boundary, or to a\n** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time\n** option is used.\n**\n** In SQLite version 3.5.0 and 3.5.1, it was possible to define\n** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in\n** implementation of these routines to be omitted.  That capability\n** is no longer provided.  Only built-in memory allocators can be used.\n**\n** Prior to SQLite version 3.7.10, the Windows OS interface layer called\n** the system malloc() and free() directly when converting\n** filenames between the UTF-8 encoding used by SQLite\n** and whatever filename encoding is used by the particular Windows\n** installation.  Memory allocation errors were detected, but\n** they were reported back as [SQLITE_CANTOPEN] or\n** [SQLITE_IOERR] rather than [SQLITE_NOMEM].\n**\n** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]\n** must be either NULL or else pointers obtained from a prior\n** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have\n** not yet been released.\n**\n** The application must not read or write any part of\n** a block of memory after it has been released using\n** [sqlite3_free()] or [sqlite3_realloc()].\n*/\nSQLITE_API void *sqlite3_malloc(int);\nSQLITE_API void *sqlite3_malloc64(sqlite3_uint64);\nSQLITE_API void *sqlite3_realloc(void*, int);\nSQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);\nSQLITE_API void sqlite3_free(void*);\nSQLITE_API sqlite3_uint64 sqlite3_msize(void*);\n\n/*\n** CAPI3REF: Memory Allocator Statistics\n**\n** SQLite provides these two interfaces for reporting on the status\n** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]\n** routines, which form the built-in memory allocation subsystem.\n**\n** ^The [sqlite3_memory_used()] routine returns the number of bytes\n** of memory currently outstanding (malloced but not freed).\n** ^The [sqlite3_memory_highwater()] routine returns the maximum\n** value of [sqlite3_memory_used()] since the high-water mark\n** was last reset.  ^The values returned by [sqlite3_memory_used()] and\n** [sqlite3_memory_highwater()] include any overhead\n** added by SQLite in its implementation of [sqlite3_malloc()],\n** but not overhead added by the any underlying system library\n** routines that [sqlite3_malloc()] may call.\n**\n** ^The memory high-water mark is reset to the current value of\n** [sqlite3_memory_used()] if and only if the parameter to\n** [sqlite3_memory_highwater()] is true.  ^The value returned\n** by [sqlite3_memory_highwater(1)] is the high-water mark\n** prior to the reset.\n*/\nSQLITE_API sqlite3_int64 sqlite3_memory_used(void);\nSQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);\n\n/*\n** CAPI3REF: Pseudo-Random Number Generator\n**\n** SQLite contains a high-quality pseudo-random number generator (PRNG) used to\n** select random [ROWID | ROWIDs] when inserting new records into a table that\n** already uses the largest possible [ROWID].  The PRNG is also used for\n** the build-in random() and randomblob() SQL functions.  This interface allows\n** applications to access the same PRNG for other purposes.\n**\n** ^A call to this routine stores N bytes of randomness into buffer P.\n** ^The P parameter can be a NULL pointer.\n**\n** ^If this routine has not been previously called or if the previous\n** call had N less than one or a NULL pointer for P, then the PRNG is\n** seeded using randomness obtained from the xRandomness method of\n** the default [sqlite3_vfs] object.\n** ^If the previous call to this routine had an N of 1 or more and a\n** non-NULL P then the pseudo-randomness is generated\n** internally and without recourse to the [sqlite3_vfs] xRandomness\n** method.\n*/\nSQLITE_API void sqlite3_randomness(int N, void *P);\n\n/*\n** CAPI3REF: Compile-Time Authorization Callbacks\n** METHOD: sqlite3\n**\n** ^This routine registers an authorizer callback with a particular\n** [database connection], supplied in the first argument.\n** ^The authorizer callback is invoked as SQL statements are being compiled\n** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],\n** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  ^At various\n** points during the compilation process, as logic is being created\n** to perform various actions, the authorizer callback is invoked to\n** see if those actions are allowed.  ^The authorizer callback should\n** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the\n** specific action but allow the SQL statement to continue to be\n** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be\n** rejected with an error.  ^If the authorizer callback returns\n** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]\n** then the [sqlite3_prepare_v2()] or equivalent call that triggered\n** the authorizer will fail with an error message.\n**\n** When the callback returns [SQLITE_OK], that means the operation\n** requested is ok.  ^When the callback returns [SQLITE_DENY], the\n** [sqlite3_prepare_v2()] or equivalent call that triggered the\n** authorizer will fail with an error message explaining that\n** access is denied. \n**\n** ^The first parameter to the authorizer callback is a copy of the third\n** parameter to the sqlite3_set_authorizer() interface. ^The second parameter\n** to the callback is an integer [SQLITE_COPY | action code] that specifies\n** the particular action to be authorized. ^The third through sixth parameters\n** to the callback are zero-terminated strings that contain additional\n** details about the action to be authorized.\n**\n** ^If the action code is [SQLITE_READ]\n** and the callback returns [SQLITE_IGNORE] then the\n** [prepared statement] statement is constructed to substitute\n** a NULL value in place of the table column that would have\n** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]\n** return can be used to deny an untrusted user access to individual\n** columns of a table.\n** ^If the action code is [SQLITE_DELETE] and the callback returns\n** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the\n** [truncate optimization] is disabled and all rows are deleted individually.\n**\n** An authorizer is used when [sqlite3_prepare | preparing]\n** SQL statements from an untrusted source, to ensure that the SQL statements\n** do not try to access data they are not allowed to see, or that they do not\n** try to execute malicious statements that damage the database.  For\n** example, an application may allow a user to enter arbitrary\n** SQL queries for evaluation by a database.  But the application does\n** not want the user to be able to make arbitrary changes to the\n** database.  An authorizer could then be put in place while the\n** user-entered SQL is being [sqlite3_prepare | prepared] that\n** disallows everything except [SELECT] statements.\n**\n** Applications that need to process SQL from untrusted sources\n** might also consider lowering resource limits using [sqlite3_limit()]\n** and limiting database size using the [max_page_count] [PRAGMA]\n** in addition to using an authorizer.\n**\n** ^(Only a single authorizer can be in place on a database connection\n** at a time.  Each call to sqlite3_set_authorizer overrides the\n** previous call.)^  ^Disable the authorizer by installing a NULL callback.\n** The authorizer is disabled by default.\n**\n** The authorizer callback must not do anything that will modify\n** the database connection that invoked the authorizer callback.\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\n** database connections for the meaning of \"modify\" in this paragraph.\n**\n** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the\n** statement might be re-prepared during [sqlite3_step()] due to a \n** schema change.  Hence, the application should ensure that the\n** correct authorizer callback remains in place during the [sqlite3_step()].\n**\n** ^Note that the authorizer callback is invoked only during\n** [sqlite3_prepare()] or its variants.  Authorization is not\n** performed during statement evaluation in [sqlite3_step()], unless\n** as stated in the previous paragraph, sqlite3_step() invokes\n** sqlite3_prepare_v2() to reprepare a statement after a schema change.\n*/\nSQLITE_API int sqlite3_set_authorizer(\n  sqlite3*,\n  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),\n  void *pUserData\n);\n\n/*\n** CAPI3REF: Authorizer Return Codes\n**\n** The [sqlite3_set_authorizer | authorizer callback function] must\n** return either [SQLITE_OK] or one of these two constants in order\n** to signal SQLite whether or not the action is permitted.  See the\n** [sqlite3_set_authorizer | authorizer documentation] for additional\n** information.\n**\n** Note that SQLITE_IGNORE is also used as a [conflict resolution mode]\n** returned from the [sqlite3_vtab_on_conflict()] interface.\n*/\n#define SQLITE_DENY   1   /* Abort the SQL statement with an error */\n#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */\n\n/*\n** CAPI3REF: Authorizer Action Codes\n**\n** The [sqlite3_set_authorizer()] interface registers a callback function\n** that is invoked to authorize certain SQL statement actions.  The\n** second parameter to the callback is an integer code that specifies\n** what action is being authorized.  These are the integer action codes that\n** the authorizer callback may be passed.\n**\n** These action code values signify what kind of operation is to be\n** authorized.  The 3rd and 4th parameters to the authorization\n** callback function will be parameters or NULL depending on which of these\n** codes is used as the second parameter.  ^(The 5th parameter to the\n** authorizer callback is the name of the database (\"main\", \"temp\",\n** etc.) if applicable.)^  ^The 6th parameter to the authorizer callback\n** is the name of the inner-most trigger or view that is responsible for\n** the access attempt or NULL if this access attempt is directly from\n** top-level SQL code.\n*/\n/******************************************* 3rd ************ 4th ***********/\n#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */\n#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */\n#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */\n#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */\n#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */\n#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */\n#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */\n#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */\n#define SQLITE_DELETE                9   /* Table Name      NULL            */\n#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */\n#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */\n#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */\n#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */\n#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */\n#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */\n#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */\n#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */\n#define SQLITE_INSERT               18   /* Table Name      NULL            */\n#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */\n#define SQLITE_READ                 20   /* Table Name      Column Name     */\n#define SQLITE_SELECT               21   /* NULL            NULL            */\n#define SQLITE_TRANSACTION          22   /* Operation       NULL            */\n#define SQLITE_UPDATE               23   /* Table Name      Column Name     */\n#define SQLITE_ATTACH               24   /* Filename        NULL            */\n#define SQLITE_DETACH               25   /* Database Name   NULL            */\n#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */\n#define SQLITE_REINDEX              27   /* Index Name      NULL            */\n#define SQLITE_ANALYZE              28   /* Table Name      NULL            */\n#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */\n#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */\n#define SQLITE_FUNCTION             31   /* NULL            Function Name   */\n#define SQLITE_SAVEPOINT            32   /* Operation       Savepoint Name  */\n#define SQLITE_COPY                  0   /* No longer used */\n#define SQLITE_RECURSIVE            33   /* NULL            NULL            */\n\n/*\n** CAPI3REF: Tracing And Profiling Functions\n** METHOD: sqlite3\n**\n** These routines are deprecated. Use the [sqlite3_trace_v2()] interface\n** instead of the routines described here.\n**\n** These routines register callback functions that can be used for\n** tracing and profiling the execution of SQL statements.\n**\n** ^The callback function registered by sqlite3_trace() is invoked at\n** various times when an SQL statement is being run by [sqlite3_step()].\n** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the\n** SQL statement text as the statement first begins executing.\n** ^(Additional sqlite3_trace() callbacks might occur\n** as each triggered subprogram is entered.  The callbacks for triggers\n** contain a UTF-8 SQL comment that identifies the trigger.)^\n**\n** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit\n** the length of [bound parameter] expansion in the output of sqlite3_trace().\n**\n** ^The callback function registered by sqlite3_profile() is invoked\n** as each SQL statement finishes.  ^The profile callback contains\n** the original statement text and an estimate of wall-clock time\n** of how long that statement took to run.  ^The profile callback\n** time is in units of nanoseconds, however the current implementation\n** is only capable of millisecond resolution so the six least significant\n** digits in the time are meaningless.  Future versions of SQLite\n** might provide greater resolution on the profiler callback.  The\n** sqlite3_profile() function is considered experimental and is\n** subject to change in future versions of SQLite.\n*/\nSQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,\n   void(*xTrace)(void*,const char*), void*);\nSQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,\n   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);\n\n/*\n** CAPI3REF: SQL Trace Event Codes\n** KEYWORDS: SQLITE_TRACE\n**\n** These constants identify classes of events that can be monitored\n** using the [sqlite3_trace_v2()] tracing logic.  The third argument\n** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of\n** the following constants.  ^The first argument to the trace callback\n** is one of the following constants.\n**\n** New tracing constants may be added in future releases.\n**\n** ^A trace callback has four arguments: xCallback(T,C,P,X).\n** ^The T argument is one of the integer type codes above.\n** ^The C argument is a copy of the context pointer passed in as the\n** fourth argument to [sqlite3_trace_v2()].\n** The P and X arguments are pointers whose meanings depend on T.\n**\n** <dl>\n** [[SQLITE_TRACE_STMT]] <dt>SQLITE_TRACE_STMT</dt>\n** <dd>^An SQLITE_TRACE_STMT callback is invoked when a prepared statement\n** first begins running and possibly at other times during the\n** execution of the prepared statement, such as at the start of each\n** trigger subprogram. ^The P argument is a pointer to the\n** [prepared statement]. ^The X argument is a pointer to a string which\n** is the unexpanded SQL text of the prepared statement or an SQL comment \n** that indicates the invocation of a trigger.  ^The callback can compute\n** the same text that would have been returned by the legacy [sqlite3_trace()]\n** interface by using the X argument when X begins with \"--\" and invoking\n** [sqlite3_expanded_sql(P)] otherwise.\n**\n** [[SQLITE_TRACE_PROFILE]] <dt>SQLITE_TRACE_PROFILE</dt>\n** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same\n** information as is provided by the [sqlite3_profile()] callback.\n** ^The P argument is a pointer to the [prepared statement] and the\n** X argument points to a 64-bit integer which is the estimated of\n** the number of nanosecond that the prepared statement took to run.\n** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.\n**\n** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt>\n** <dd>^An SQLITE_TRACE_ROW callback is invoked whenever a prepared\n** statement generates a single row of result.  \n** ^The P argument is a pointer to the [prepared statement] and the\n** X argument is unused.\n**\n** [[SQLITE_TRACE_CLOSE]] <dt>SQLITE_TRACE_CLOSE</dt>\n** <dd>^An SQLITE_TRACE_CLOSE callback is invoked when a database\n** connection closes.\n** ^The P argument is a pointer to the [database connection] object\n** and the X argument is unused.\n** </dl>\n*/\n#define SQLITE_TRACE_STMT       0x01\n#define SQLITE_TRACE_PROFILE    0x02\n#define SQLITE_TRACE_ROW        0x04\n#define SQLITE_TRACE_CLOSE      0x08\n\n/*\n** CAPI3REF: SQL Trace Hook\n** METHOD: sqlite3\n**\n** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback\n** function X against [database connection] D, using property mask M\n** and context pointer P.  ^If the X callback is\n** NULL or if the M mask is zero, then tracing is disabled.  The\n** M argument should be the bitwise OR-ed combination of\n** zero or more [SQLITE_TRACE] constants.\n**\n** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides \n** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2().\n**\n** ^The X callback is invoked whenever any of the events identified by \n** mask M occur.  ^The integer return value from the callback is currently\n** ignored, though this may change in future releases.  Callback\n** implementations should return zero to ensure future compatibility.\n**\n** ^A trace callback is invoked with four arguments: callback(T,C,P,X).\n** ^The T argument is one of the [SQLITE_TRACE]\n** constants to indicate why the callback was invoked.\n** ^The C argument is a copy of the context pointer.\n** The P and X arguments are pointers whose meanings depend on T.\n**\n** The sqlite3_trace_v2() interface is intended to replace the legacy\n** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which\n** are deprecated.\n*/\nSQLITE_API int sqlite3_trace_v2(\n  sqlite3*,\n  unsigned uMask,\n  int(*xCallback)(unsigned,void*,void*,void*),\n  void *pCtx\n);\n\n/*\n** CAPI3REF: Query Progress Callbacks\n** METHOD: sqlite3\n**\n** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback\n** function X to be invoked periodically during long running calls to\n** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for\n** database connection D.  An example use for this\n** interface is to keep a GUI updated during a large query.\n**\n** ^The parameter P is passed through as the only parameter to the \n** callback function X.  ^The parameter N is the approximate number of \n** [virtual machine instructions] that are evaluated between successive\n** invocations of the callback X.  ^If N is less than one then the progress\n** handler is disabled.\n**\n** ^Only a single progress handler may be defined at one time per\n** [database connection]; setting a new progress handler cancels the\n** old one.  ^Setting parameter X to NULL disables the progress handler.\n** ^The progress handler is also disabled by setting N to a value less\n** than 1.\n**\n** ^If the progress callback returns non-zero, the operation is\n** interrupted.  This feature can be used to implement a\n** \"Cancel\" button on a GUI progress dialog box.\n**\n** The progress handler callback must not do anything that will modify\n** the database connection that invoked the progress handler.\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\n** database connections for the meaning of \"modify\" in this paragraph.\n**\n*/\nSQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);\n\n/*\n** CAPI3REF: Opening A New Database Connection\n** CONSTRUCTOR: sqlite3\n**\n** ^These routines open an SQLite database file as specified by the \n** filename argument. ^The filename argument is interpreted as UTF-8 for\n** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte\n** order for sqlite3_open16(). ^(A [database connection] handle is usually\n** returned in *ppDb, even if an error occurs.  The only exception is that\n** if SQLite is unable to allocate memory to hold the [sqlite3] object,\n** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]\n** object.)^ ^(If the database is opened (and/or created) successfully, then\n** [SQLITE_OK] is returned.  Otherwise an [error code] is returned.)^ ^The\n** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain\n** an English language description of the error following a failure of any\n** of the sqlite3_open() routines.\n**\n** ^The default encoding will be UTF-8 for databases created using\n** sqlite3_open() or sqlite3_open_v2().  ^The default encoding for databases\n** created using sqlite3_open16() will be UTF-16 in the native byte order.\n**\n** Whether or not an error occurs when it is opened, resources\n** associated with the [database connection] handle should be released by\n** passing it to [sqlite3_close()] when it is no longer required.\n**\n** The sqlite3_open_v2() interface works like sqlite3_open()\n** except that it accepts two additional parameters for additional control\n** over the new database connection.  ^(The flags parameter to\n** sqlite3_open_v2() can take one of\n** the following three values, optionally combined with the \n** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],\n** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^\n**\n** <dl>\n** ^(<dt>[SQLITE_OPEN_READONLY]</dt>\n** <dd>The database is opened in read-only mode.  If the database does not\n** already exist, an error is returned.</dd>)^\n**\n** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>\n** <dd>The database is opened for reading and writing if possible, or reading\n** only if the file is write protected by the operating system.  In either\n** case the database must already exist, otherwise an error is returned.</dd>)^\n**\n** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>\n** <dd>The database is opened for reading and writing, and is created if\n** it does not already exist. This is the behavior that is always used for\n** sqlite3_open() and sqlite3_open16().</dd>)^\n** </dl>\n**\n** If the 3rd parameter to sqlite3_open_v2() is not one of the\n** combinations shown above optionally combined with other\n** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]\n** then the behavior is undefined.\n**\n** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection\n** opens in the multi-thread [threading mode] as long as the single-thread\n** mode has not been set at compile-time or start-time.  ^If the\n** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens\n** in the serialized [threading mode] unless single-thread was\n** previously selected at compile-time or start-time.\n** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be\n** eligible to use [shared cache mode], regardless of whether or not shared\n** cache is enabled using [sqlite3_enable_shared_cache()].  ^The\n** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not\n** participate in [shared cache mode] even if it is enabled.\n**\n** ^The fourth parameter to sqlite3_open_v2() is the name of the\n** [sqlite3_vfs] object that defines the operating system interface that\n** the new database connection should use.  ^If the fourth parameter is\n** a NULL pointer then the default [sqlite3_vfs] object is used.\n**\n** ^If the filename is \":memory:\", then a private, temporary in-memory database\n** is created for the connection.  ^This in-memory database will vanish when\n** the database connection is closed.  Future versions of SQLite might\n** make use of additional special filenames that begin with the \":\" character.\n** It is recommended that when a database filename actually does begin with\n** a \":\" character you should prefix the filename with a pathname such as\n** \"./\" to avoid ambiguity.\n**\n** ^If the filename is an empty string, then a private, temporary\n** on-disk database will be created.  ^This private database will be\n** automatically deleted as soon as the database connection is closed.\n**\n** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>\n**\n** ^If [URI filename] interpretation is enabled, and the filename argument\n** begins with \"file:\", then the filename is interpreted as a URI. ^URI\n** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is\n** set in the fourth argument to sqlite3_open_v2(), or if it has\n** been enabled globally using the [SQLITE_CONFIG_URI] option with the\n** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.\n** As of SQLite version 3.7.7, URI filename interpretation is turned off\n** by default, but future releases of SQLite might enable URI filename\n** interpretation by default.  See \"[URI filenames]\" for additional\n** information.\n**\n** URI filenames are parsed according to RFC 3986. ^If the URI contains an\n** authority, then it must be either an empty string or the string \n** \"localhost\". ^If the authority is not an empty string or \"localhost\", an \n** error is returned to the caller. ^The fragment component of a URI, if \n** present, is ignored.\n**\n** ^SQLite uses the path component of the URI as the name of the disk file\n** which contains the database. ^If the path begins with a '/' character, \n** then it is interpreted as an absolute path. ^If the path does not begin \n** with a '/' (meaning that the authority section is omitted from the URI)\n** then the path is interpreted as a relative path. \n** ^(On windows, the first component of an absolute path \n** is a drive specification (e.g. \"C:\").)^\n**\n** [[core URI query parameters]]\n** The query component of a URI may contain parameters that are interpreted\n** either by SQLite itself, or by a [VFS | custom VFS implementation].\n** SQLite and its built-in [VFSes] interpret the\n** following query parameters:\n**\n** <ul>\n**   <li> <b>vfs</b>: ^The \"vfs\" parameter may be used to specify the name of\n**     a VFS object that provides the operating system interface that should\n**     be used to access the database file on disk. ^If this option is set to\n**     an empty string the default VFS object is used. ^Specifying an unknown\n**     VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is\n**     present, then the VFS specified by the option takes precedence over\n**     the value passed as the fourth parameter to sqlite3_open_v2().\n**\n**   <li> <b>mode</b>: ^(The mode parameter may be set to either \"ro\", \"rw\",\n**     \"rwc\", or \"memory\". Attempting to set it to any other value is\n**     an error)^. \n**     ^If \"ro\" is specified, then the database is opened for read-only \n**     access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the \n**     third argument to sqlite3_open_v2(). ^If the mode option is set to \n**     \"rw\", then the database is opened for read-write (but not create) \n**     access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had \n**     been set. ^Value \"rwc\" is equivalent to setting both \n**     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE.  ^If the mode option is\n**     set to \"memory\" then a pure [in-memory database] that never reads\n**     or writes from disk is used. ^It is an error to specify a value for\n**     the mode parameter that is less restrictive than that specified by\n**     the flags passed in the third parameter to sqlite3_open_v2().\n**\n**   <li> <b>cache</b>: ^The cache parameter may be set to either \"shared\" or\n**     \"private\". ^Setting it to \"shared\" is equivalent to setting the\n**     SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to\n**     sqlite3_open_v2(). ^Setting the cache parameter to \"private\" is \n**     equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.\n**     ^If sqlite3_open_v2() is used and the \"cache\" parameter is present in\n**     a URI filename, its value overrides any behavior requested by setting\n**     SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.\n**\n**  <li> <b>psow</b>: ^The psow parameter indicates whether or not the\n**     [powersafe overwrite] property does or does not apply to the\n**     storage media on which the database file resides.\n**\n**  <li> <b>nolock</b>: ^The nolock parameter is a boolean query parameter\n**     which if set disables file locking in rollback journal modes.  This\n**     is useful for accessing a database on a filesystem that does not\n**     support locking.  Caution:  Database corruption might result if two\n**     or more processes write to the same database and any one of those\n**     processes uses nolock=1.\n**\n**  <li> <b>immutable</b>: ^The immutable parameter is a boolean query\n**     parameter that indicates that the database file is stored on\n**     read-only media.  ^When immutable is set, SQLite assumes that the\n**     database file cannot be changed, even by a process with higher\n**     privilege, and so the database is opened read-only and all locking\n**     and change detection is disabled.  Caution: Setting the immutable\n**     property on a database file that does in fact change can result\n**     in incorrect query results and/or [SQLITE_CORRUPT] errors.\n**     See also: [SQLITE_IOCAP_IMMUTABLE].\n**       \n** </ul>\n**\n** ^Specifying an unknown parameter in the query component of a URI is not an\n** error.  Future versions of SQLite might understand additional query\n** parameters.  See \"[query parameters with special meaning to SQLite]\" for\n** additional information.\n**\n** [[URI filename examples]] <h3>URI filename examples</h3>\n**\n** <table border=\"1\" align=center cellpadding=5>\n** <tr><th> URI filenames <th> Results\n** <tr><td> file:data.db <td> \n**          Open the file \"data.db\" in the current directory.\n** <tr><td> file:/home/fred/data.db<br>\n**          file:///home/fred/data.db <br> \n**          file://localhost/home/fred/data.db <br> <td> \n**          Open the database file \"/home/fred/data.db\".\n** <tr><td> file://darkstar/home/fred/data.db <td> \n**          An error. \"darkstar\" is not a recognized authority.\n** <tr><td style=\"white-space:nowrap\"> \n**          file:///C:/Documents%20and%20Settings/fred/Desktop/data.db\n**     <td> Windows only: Open the file \"data.db\" on fred's desktop on drive\n**          C:. Note that the %20 escaping in this example is not strictly \n**          necessary - space characters can be used literally\n**          in URI filenames.\n** <tr><td> file:data.db?mode=ro&cache=private <td> \n**          Open file \"data.db\" in the current directory for read-only access.\n**          Regardless of whether or not shared-cache mode is enabled by\n**          default, use a private cache.\n** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>\n**          Open file \"/home/fred/data.db\". Use the special VFS \"unix-dotfile\"\n**          that uses dot-files in place of posix advisory locking.\n** <tr><td> file:data.db?mode=readonly <td> \n**          An error. \"readonly\" is not a valid option for the \"mode\" parameter.\n** </table>\n**\n** ^URI hexadecimal escape sequences (%HH) are supported within the path and\n** query components of a URI. A hexadecimal escape sequence consists of a\n** percent sign - \"%\" - followed by exactly two hexadecimal digits \n** specifying an octet value. ^Before the path or query components of a\n** URI filename are interpreted, they are encoded using UTF-8 and all \n** hexadecimal escape sequences replaced by a single byte containing the\n** corresponding octet. If this process generates an invalid UTF-8 encoding,\n** the results are undefined.\n**\n** <b>Note to Windows users:</b>  The encoding used for the filename argument\n** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever\n** codepage is currently defined.  Filenames containing international\n** characters must be converted to UTF-8 prior to passing them into\n** sqlite3_open() or sqlite3_open_v2().\n**\n** <b>Note to Windows Runtime users:</b>  The temporary directory must be set\n** prior to calling sqlite3_open() or sqlite3_open_v2().  Otherwise, various\n** features that require the use of temporary files may fail.\n**\n** See also: [sqlite3_temp_directory]\n*/\nSQLITE_API int sqlite3_open(\n  const char *filename,   /* Database filename (UTF-8) */\n  sqlite3 **ppDb          /* OUT: SQLite db handle */\n);\nSQLITE_API int sqlite3_open16(\n  const void *filename,   /* Database filename (UTF-16) */\n  sqlite3 **ppDb          /* OUT: SQLite db handle */\n);\nSQLITE_API int sqlite3_open_v2(\n  const char *filename,   /* Database filename (UTF-8) */\n  sqlite3 **ppDb,         /* OUT: SQLite db handle */\n  int flags,              /* Flags */\n  const char *zVfs        /* Name of VFS module to use */\n);\n\n/*\n** CAPI3REF: Obtain Values For URI Parameters\n**\n** These are utility routines, useful to VFS implementations, that check\n** to see if a database file was a URI that contained a specific query \n** parameter, and if so obtains the value of that query parameter.\n**\n** If F is the database filename pointer passed into the xOpen() method of \n** a VFS implementation when the flags parameter to xOpen() has one or \n** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and\n** P is the name of the query parameter, then\n** sqlite3_uri_parameter(F,P) returns the value of the P\n** parameter if it exists or a NULL pointer if P does not appear as a \n** query parameter on F.  If P is a query parameter of F\n** has no explicit value, then sqlite3_uri_parameter(F,P) returns\n** a pointer to an empty string.\n**\n** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean\n** parameter and returns true (1) or false (0) according to the value\n** of P.  The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the\n** value of query parameter P is one of \"yes\", \"true\", or \"on\" in any\n** case or if the value begins with a non-zero number.  The \n** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of\n** query parameter P is one of \"no\", \"false\", or \"off\" in any case or\n** if the value begins with a numeric zero.  If P is not a query\n** parameter on F or if the value of P is does not match any of the\n** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).\n**\n** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a\n** 64-bit signed integer and returns that integer, or D if P does not\n** exist.  If the value of P is something other than an integer, then\n** zero is returned.\n** \n** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and\n** sqlite3_uri_boolean(F,P,B) returns B.  If F is not a NULL pointer and\n** is not a database file pathname pointer that SQLite passed into the xOpen\n** VFS method, then the behavior of this routine is undefined and probably\n** undesirable.\n*/\nSQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);\nSQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);\nSQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);\n\n\n/*\n** CAPI3REF: Error Codes And Messages\n** METHOD: sqlite3\n**\n** ^If the most recent sqlite3_* API call associated with \n** [database connection] D failed, then the sqlite3_errcode(D) interface\n** returns the numeric [result code] or [extended result code] for that\n** API call.\n** If the most recent API call was successful,\n** then the return value from sqlite3_errcode() is undefined.\n** ^The sqlite3_extended_errcode()\n** interface is the same except that it always returns the \n** [extended result code] even when extended result codes are\n** disabled.\n**\n** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language\n** text that describes the error, as either UTF-8 or UTF-16 respectively.\n** ^(Memory to hold the error message string is managed internally.\n** The application does not need to worry about freeing the result.\n** However, the error string might be overwritten or deallocated by\n** subsequent calls to other SQLite interface functions.)^\n**\n** ^The sqlite3_errstr() interface returns the English-language text\n** that describes the [result code], as UTF-8.\n** ^(Memory to hold the error message string is managed internally\n** and must not be freed by the application)^.\n**\n** When the serialized [threading mode] is in use, it might be the\n** case that a second error occurs on a separate thread in between\n** the time of the first error and the call to these interfaces.\n** When that happens, the second error will be reported since these\n** interfaces always report the most recent result.  To avoid\n** this, each thread can obtain exclusive use of the [database connection] D\n** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning\n** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after\n** all calls to the interfaces listed here are completed.\n**\n** If an interface fails with SQLITE_MISUSE, that means the interface\n** was invoked incorrectly by the application.  In that case, the\n** error code and message may or may not be set.\n*/\nSQLITE_API int sqlite3_errcode(sqlite3 *db);\nSQLITE_API int sqlite3_extended_errcode(sqlite3 *db);\nSQLITE_API const char *sqlite3_errmsg(sqlite3*);\nSQLITE_API const void *sqlite3_errmsg16(sqlite3*);\nSQLITE_API const char *sqlite3_errstr(int);\n\n/*\n** CAPI3REF: Prepared Statement Object\n** KEYWORDS: {prepared statement} {prepared statements}\n**\n** An instance of this object represents a single SQL statement that\n** has been compiled into binary form and is ready to be evaluated.\n**\n** Think of each SQL statement as a separate computer program.  The\n** original SQL text is source code.  A prepared statement object \n** is the compiled object code.  All SQL must be converted into a\n** prepared statement before it can be run.\n**\n** The life-cycle of a prepared statement object usually goes like this:\n**\n** <ol>\n** <li> Create the prepared statement object using [sqlite3_prepare_v2()].\n** <li> Bind values to [parameters] using the sqlite3_bind_*()\n**      interfaces.\n** <li> Run the SQL by calling [sqlite3_step()] one or more times.\n** <li> Reset the prepared statement using [sqlite3_reset()] then go back\n**      to step 2.  Do this zero or more times.\n** <li> Destroy the object using [sqlite3_finalize()].\n** </ol>\n*/\ntypedef struct sqlite3_stmt sqlite3_stmt;\n\n/*\n** CAPI3REF: Run-time Limits\n** METHOD: sqlite3\n**\n** ^(This interface allows the size of various constructs to be limited\n** on a connection by connection basis.  The first parameter is the\n** [database connection] whose limit is to be set or queried.  The\n** second parameter is one of the [limit categories] that define a\n** class of constructs to be size limited.  The third parameter is the\n** new limit for that construct.)^\n**\n** ^If the new limit is a negative number, the limit is unchanged.\n** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a \n** [limits | hard upper bound]\n** set at compile-time by a C preprocessor macro called\n** [limits | SQLITE_MAX_<i>NAME</i>].\n** (The \"_LIMIT_\" in the name is changed to \"_MAX_\".))^\n** ^Attempts to increase a limit above its hard upper bound are\n** silently truncated to the hard upper bound.\n**\n** ^Regardless of whether or not the limit was changed, the \n** [sqlite3_limit()] interface returns the prior value of the limit.\n** ^Hence, to find the current value of a limit without changing it,\n** simply invoke this interface with the third parameter set to -1.\n**\n** Run-time limits are intended for use in applications that manage\n** both their own internal database and also databases that are controlled\n** by untrusted external sources.  An example application might be a\n** web browser that has its own databases for storing history and\n** separate databases controlled by JavaScript applications downloaded\n** off the Internet.  The internal databases can be given the\n** large, default limits.  Databases managed by external sources can\n** be given much smaller limits designed to prevent a denial of service\n** attack.  Developers might also want to use the [sqlite3_set_authorizer()]\n** interface to further control untrusted SQL.  The size of the database\n** created by an untrusted script can be contained using the\n** [max_page_count] [PRAGMA].\n**\n** New run-time limit categories may be added in future releases.\n*/\nSQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);\n\n/*\n** CAPI3REF: Run-Time Limit Categories\n** KEYWORDS: {limit category} {*limit categories}\n**\n** These constants define various performance limits\n** that can be lowered at run-time using [sqlite3_limit()].\n** The synopsis of the meanings of the various limits is shown below.\n** Additional information is available at [limits | Limits in SQLite].\n**\n** <dl>\n** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>\n** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^\n**\n** [[SQLITE_LIMIT_SQL_LENGTH]] ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>\n** <dd>The maximum length of an SQL statement, in bytes.</dd>)^\n**\n** [[SQLITE_LIMIT_COLUMN]] ^(<dt>SQLITE_LIMIT_COLUMN</dt>\n** <dd>The maximum number of columns in a table definition or in the\n** result set of a [SELECT] or the maximum number of columns in an index\n** or in an ORDER BY or GROUP BY clause.</dd>)^\n**\n** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>\n** <dd>The maximum depth of the parse tree on any expression.</dd>)^\n**\n** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>\n** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^\n**\n** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>\n** <dd>The maximum number of instructions in a virtual machine program\n** used to implement an SQL statement.  This limit is not currently\n** enforced, though that might be added in some future release of\n** SQLite.</dd>)^\n**\n** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>\n** <dd>The maximum number of arguments on a function.</dd>)^\n**\n** [[SQLITE_LIMIT_ATTACHED]] ^(<dt>SQLITE_LIMIT_ATTACHED</dt>\n** <dd>The maximum number of [ATTACH | attached databases].)^</dd>\n**\n** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]]\n** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>\n** <dd>The maximum length of the pattern argument to the [LIKE] or\n** [GLOB] operators.</dd>)^\n**\n** [[SQLITE_LIMIT_VARIABLE_NUMBER]]\n** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>\n** <dd>The maximum index number of any [parameter] in an SQL statement.)^\n**\n** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>\n** <dd>The maximum depth of recursion for triggers.</dd>)^\n**\n** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>\n** <dd>The maximum number of auxiliary worker threads that a single\n** [prepared statement] may start.</dd>)^\n** </dl>\n*/\n#define SQLITE_LIMIT_LENGTH                    0\n#define SQLITE_LIMIT_SQL_LENGTH                1\n#define SQLITE_LIMIT_COLUMN                    2\n#define SQLITE_LIMIT_EXPR_DEPTH                3\n#define SQLITE_LIMIT_COMPOUND_SELECT           4\n#define SQLITE_LIMIT_VDBE_OP                   5\n#define SQLITE_LIMIT_FUNCTION_ARG              6\n#define SQLITE_LIMIT_ATTACHED                  7\n#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH       8\n#define SQLITE_LIMIT_VARIABLE_NUMBER           9\n#define SQLITE_LIMIT_TRIGGER_DEPTH            10\n#define SQLITE_LIMIT_WORKER_THREADS           11\n\n/*\n** CAPI3REF: Compiling An SQL Statement\n** KEYWORDS: {SQL statement compiler}\n** METHOD: sqlite3\n** CONSTRUCTOR: sqlite3_stmt\n**\n** To execute an SQL query, it must first be compiled into a byte-code\n** program using one of these routines.\n**\n** The first argument, \"db\", is a [database connection] obtained from a\n** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or\n** [sqlite3_open16()].  The database connection must not have been closed.\n**\n** The second argument, \"zSql\", is the statement to be compiled, encoded\n** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()\n** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()\n** use UTF-16.\n**\n** ^If the nByte argument is negative, then zSql is read up to the\n** first zero terminator. ^If nByte is positive, then it is the\n** number of bytes read from zSql.  ^If nByte is zero, then no prepared\n** statement is generated.\n** If the caller knows that the supplied string is nul-terminated, then\n** there is a small performance advantage to passing an nByte parameter that\n** is the number of bytes in the input string <i>including</i>\n** the nul-terminator.\n**\n** ^If pzTail is not NULL then *pzTail is made to point to the first byte\n** past the end of the first SQL statement in zSql.  These routines only\n** compile the first statement in zSql, so *pzTail is left pointing to\n** what remains uncompiled.\n**\n** ^*ppStmt is left pointing to a compiled [prepared statement] that can be\n** executed using [sqlite3_step()].  ^If there is an error, *ppStmt is set\n** to NULL.  ^If the input text contains no SQL (if the input is an empty\n** string or a comment) then *ppStmt is set to NULL.\n** The calling procedure is responsible for deleting the compiled\n** SQL statement using [sqlite3_finalize()] after it has finished with it.\n** ppStmt may not be NULL.\n**\n** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];\n** otherwise an [error code] is returned.\n**\n** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are\n** recommended for all new programs. The two older interfaces are retained\n** for backwards compatibility, but their use is discouraged.\n** ^In the \"v2\" interfaces, the prepared statement\n** that is returned (the [sqlite3_stmt] object) contains a copy of the\n** original SQL text. This causes the [sqlite3_step()] interface to\n** behave differently in three ways:\n**\n** <ol>\n** <li>\n** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it\n** always used to do, [sqlite3_step()] will automatically recompile the SQL\n** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY]\n** retries will occur before sqlite3_step() gives up and returns an error.\n** </li>\n**\n** <li>\n** ^When an error occurs, [sqlite3_step()] will return one of the detailed\n** [error codes] or [extended error codes].  ^The legacy behavior was that\n** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code\n** and the application would have to make a second call to [sqlite3_reset()]\n** in order to find the underlying cause of the problem. With the \"v2\" prepare\n** interfaces, the underlying reason for the error is returned immediately.\n** </li>\n**\n** <li>\n** ^If the specific value bound to [parameter | host parameter] in the \n** WHERE clause might influence the choice of query plan for a statement,\n** then the statement will be automatically recompiled, as if there had been \n** a schema change, on the first  [sqlite3_step()] call following any change\n** to the [sqlite3_bind_text | bindings] of that [parameter]. \n** ^The specific value of WHERE-clause [parameter] might influence the \n** choice of query plan if the parameter is the left-hand side of a [LIKE]\n** or [GLOB] operator or if the parameter is compared to an indexed column\n** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.\n** </li>\n** </ol>\n*/\nSQLITE_API int sqlite3_prepare(\n  sqlite3 *db,            /* Database handle */\n  const char *zSql,       /* SQL statement, UTF-8 encoded */\n  int nByte,              /* Maximum length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\n  const char **pzTail     /* OUT: Pointer to unused portion of zSql */\n);\nSQLITE_API int sqlite3_prepare_v2(\n  sqlite3 *db,            /* Database handle */\n  const char *zSql,       /* SQL statement, UTF-8 encoded */\n  int nByte,              /* Maximum length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\n  const char **pzTail     /* OUT: Pointer to unused portion of zSql */\n);\nSQLITE_API int sqlite3_prepare16(\n  sqlite3 *db,            /* Database handle */\n  const void *zSql,       /* SQL statement, UTF-16 encoded */\n  int nByte,              /* Maximum length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\n  const void **pzTail     /* OUT: Pointer to unused portion of zSql */\n);\nSQLITE_API int sqlite3_prepare16_v2(\n  sqlite3 *db,            /* Database handle */\n  const void *zSql,       /* SQL statement, UTF-16 encoded */\n  int nByte,              /* Maximum length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */\n  const void **pzTail     /* OUT: Pointer to unused portion of zSql */\n);\n\n/*\n** CAPI3REF: Retrieving Statement SQL\n** METHOD: sqlite3_stmt\n**\n** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8\n** SQL text used to create [prepared statement] P if P was\n** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].\n** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8\n** string containing the SQL text of prepared statement P with\n** [bound parameters] expanded.\n**\n** ^(For example, if a prepared statement is created using the SQL\n** text \"SELECT $abc,:xyz\" and if parameter $abc is bound to integer 2345\n** and parameter :xyz is unbound, then sqlite3_sql() will return\n** the original string, \"SELECT $abc,:xyz\" but sqlite3_expanded_sql()\n** will return \"SELECT 2345,NULL\".)^\n**\n** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory\n** is available to hold the result, or if the result would exceed the\n** the maximum string length determined by the [SQLITE_LIMIT_LENGTH].\n**\n** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of\n** bound parameter expansions.  ^The [SQLITE_OMIT_TRACE] compile-time\n** option causes sqlite3_expanded_sql() to always return NULL.\n**\n** ^The string returned by sqlite3_sql(P) is managed by SQLite and is\n** automatically freed when the prepared statement is finalized.\n** ^The string returned by sqlite3_expanded_sql(P), on the other hand,\n** is obtained from [sqlite3_malloc()] and must be free by the application\n** by passing it to [sqlite3_free()].\n*/\nSQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);\nSQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);\n\n/*\n** CAPI3REF: Determine If An SQL Statement Writes The Database\n** METHOD: sqlite3_stmt\n**\n** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if\n** and only if the [prepared statement] X makes no direct changes to\n** the content of the database file.\n**\n** Note that [application-defined SQL functions] or\n** [virtual tables] might change the database indirectly as a side effect.  \n** ^(For example, if an application defines a function \"eval()\" that \n** calls [sqlite3_exec()], then the following SQL statement would\n** change the database file through side-effects:\n**\n** <blockquote><pre>\n**    SELECT eval('DELETE FROM t1') FROM t2;\n** </pre></blockquote>\n**\n** But because the [SELECT] statement does not change the database file\n** directly, sqlite3_stmt_readonly() would still return true.)^\n**\n** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],\n** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,\n** since the statements themselves do not actually modify the database but\n** rather they control the timing of when other statements modify the \n** database.  ^The [ATTACH] and [DETACH] statements also cause\n** sqlite3_stmt_readonly() to return true since, while those statements\n** change the configuration of a database connection, they do not make \n** changes to the content of the database files on disk.\n*/\nSQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);\n\n/*\n** CAPI3REF: Determine If A Prepared Statement Has Been Reset\n** METHOD: sqlite3_stmt\n**\n** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the\n** [prepared statement] S has been stepped at least once using \n** [sqlite3_step(S)] but has neither run to completion (returned\n** [SQLITE_DONE] from [sqlite3_step(S)]) nor\n** been reset using [sqlite3_reset(S)].  ^The sqlite3_stmt_busy(S)\n** interface returns false if S is a NULL pointer.  If S is not a \n** NULL pointer and is not a pointer to a valid [prepared statement]\n** object, then the behavior is undefined and probably undesirable.\n**\n** This interface can be used in combination [sqlite3_next_stmt()]\n** to locate all prepared statements associated with a database \n** connection that are in need of being reset.  This can be used,\n** for example, in diagnostic routines to search for prepared \n** statements that are holding a transaction open.\n*/\nSQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);\n\n/*\n** CAPI3REF: Dynamically Typed Value Object\n** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}\n**\n** SQLite uses the sqlite3_value object to represent all values\n** that can be stored in a database table. SQLite uses dynamic typing\n** for the values it stores.  ^Values stored in sqlite3_value objects\n** can be integers, floating point values, strings, BLOBs, or NULL.\n**\n** An sqlite3_value object may be either \"protected\" or \"unprotected\".\n** Some interfaces require a protected sqlite3_value.  Other interfaces\n** will accept either a protected or an unprotected sqlite3_value.\n** Every interface that accepts sqlite3_value arguments specifies\n** whether or not it requires a protected sqlite3_value.  The\n** [sqlite3_value_dup()] interface can be used to construct a new \n** protected sqlite3_value from an unprotected sqlite3_value.\n**\n** The terms \"protected\" and \"unprotected\" refer to whether or not\n** a mutex is held.  An internal mutex is held for a protected\n** sqlite3_value object but no mutex is held for an unprotected\n** sqlite3_value object.  If SQLite is compiled to be single-threaded\n** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)\n** or if SQLite is run in one of reduced mutex modes \n** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]\n** then there is no distinction between protected and unprotected\n** sqlite3_value objects and they can be used interchangeably.  However,\n** for maximum code portability it is recommended that applications\n** still make the distinction between protected and unprotected\n** sqlite3_value objects even when not strictly required.\n**\n** ^The sqlite3_value objects that are passed as parameters into the\n** implementation of [application-defined SQL functions] are protected.\n** ^The sqlite3_value object returned by\n** [sqlite3_column_value()] is unprotected.\n** Unprotected sqlite3_value objects may only be used with\n** [sqlite3_result_value()] and [sqlite3_bind_value()].\n** The [sqlite3_value_blob | sqlite3_value_type()] family of\n** interfaces require protected sqlite3_value objects.\n*/\ntypedef struct Mem sqlite3_value;\n\n/*\n** CAPI3REF: SQL Function Context Object\n**\n** The context in which an SQL function executes is stored in an\n** sqlite3_context object.  ^A pointer to an sqlite3_context object\n** is always first parameter to [application-defined SQL functions].\n** The application-defined SQL function implementation will pass this\n** pointer through into calls to [sqlite3_result_int | sqlite3_result()],\n** [sqlite3_aggregate_context()], [sqlite3_user_data()],\n** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],\n** and/or [sqlite3_set_auxdata()].\n*/\ntypedef struct sqlite3_context sqlite3_context;\n\n/*\n** CAPI3REF: Binding Values To Prepared Statements\n** KEYWORDS: {host parameter} {host parameters} {host parameter name}\n** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}\n** METHOD: sqlite3_stmt\n**\n** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,\n** literals may be replaced by a [parameter] that matches one of following\n** templates:\n**\n** <ul>\n** <li>  ?\n** <li>  ?NNN\n** <li>  :VVV\n** <li>  @VVV\n** <li>  $VVV\n** </ul>\n**\n** In the templates above, NNN represents an integer literal,\n** and VVV represents an alphanumeric identifier.)^  ^The values of these\n** parameters (also called \"host parameter names\" or \"SQL parameters\")\n** can be set using the sqlite3_bind_*() routines defined here.\n**\n** ^The first argument to the sqlite3_bind_*() routines is always\n** a pointer to the [sqlite3_stmt] object returned from\n** [sqlite3_prepare_v2()] or its variants.\n**\n** ^The second argument is the index of the SQL parameter to be set.\n** ^The leftmost SQL parameter has an index of 1.  ^When the same named\n** SQL parameter is used more than once, second and subsequent\n** occurrences have the same index as the first occurrence.\n** ^The index for named parameters can be looked up using the\n** [sqlite3_bind_parameter_index()] API if desired.  ^The index\n** for \"?NNN\" parameters is the value of NNN.\n** ^The NNN value must be between 1 and the [sqlite3_limit()]\n** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).\n**\n** ^The third argument is the value to bind to the parameter.\n** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16()\n** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter\n** is ignored and the end result is the same as sqlite3_bind_null().\n**\n** ^(In those routines that have a fourth argument, its value is the\n** number of bytes in the parameter.  To be clear: the value is the\n** number of <u>bytes</u> in the value, not the number of characters.)^\n** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()\n** is negative, then the length of the string is\n** the number of bytes up to the first zero terminator.\n** If the fourth parameter to sqlite3_bind_blob() is negative, then\n** the behavior is undefined.\n** If a non-negative fourth parameter is provided to sqlite3_bind_text()\n** or sqlite3_bind_text16() or sqlite3_bind_text64() then\n** that parameter must be the byte offset\n** where the NUL terminator would occur assuming the string were NUL\n** terminated.  If any NUL characters occur at byte offsets less than \n** the value of the fourth parameter then the resulting string value will\n** contain embedded NULs.  The result of expressions involving strings\n** with embedded NULs is undefined.\n**\n** ^The fifth argument to the BLOB and string binding interfaces\n** is a destructor used to dispose of the BLOB or\n** string after SQLite has finished with it.  ^The destructor is called\n** to dispose of the BLOB or string even if the call to bind API fails.\n** ^If the fifth argument is\n** the special value [SQLITE_STATIC], then SQLite assumes that the\n** information is in static, unmanaged space and does not need to be freed.\n** ^If the fifth argument has the value [SQLITE_TRANSIENT], then\n** SQLite makes its own private copy of the data immediately, before\n** the sqlite3_bind_*() routine returns.\n**\n** ^The sixth argument to sqlite3_bind_text64() must be one of\n** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]\n** to specify the encoding of the text in the third parameter.  If\n** the sixth argument to sqlite3_bind_text64() is not one of the\n** allowed values shown above, or if the text encoding is different\n** from the encoding specified by the sixth parameter, then the behavior\n** is undefined.\n**\n** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that\n** is filled with zeroes.  ^A zeroblob uses a fixed amount of memory\n** (just an integer to hold its size) while it is being processed.\n** Zeroblobs are intended to serve as placeholders for BLOBs whose\n** content is later written using\n** [sqlite3_blob_open | incremental BLOB I/O] routines.\n** ^A negative value for the zeroblob results in a zero-length BLOB.\n**\n** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer\n** for the [prepared statement] or with a prepared statement for which\n** [sqlite3_step()] has been called more recently than [sqlite3_reset()],\n** then the call will return [SQLITE_MISUSE].  If any sqlite3_bind_()\n** routine is passed a [prepared statement] that has been finalized, the\n** result is undefined and probably harmful.\n**\n** ^Bindings are not cleared by the [sqlite3_reset()] routine.\n** ^Unbound parameters are interpreted as NULL.\n**\n** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an\n** [error code] if anything goes wrong.\n** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB\n** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or\n** [SQLITE_MAX_LENGTH].\n** ^[SQLITE_RANGE] is returned if the parameter\n** index is out of range.  ^[SQLITE_NOMEM] is returned if malloc() fails.\n**\n** See also: [sqlite3_bind_parameter_count()],\n** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].\n*/\nSQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));\nSQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,\n                        void(*)(void*));\nSQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);\nSQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);\nSQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);\nSQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);\nSQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));\nSQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));\nSQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,\n                         void(*)(void*), unsigned char encoding);\nSQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);\nSQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);\nSQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);\n\n/*\n** CAPI3REF: Number Of SQL Parameters\n** METHOD: sqlite3_stmt\n**\n** ^This routine can be used to find the number of [SQL parameters]\n** in a [prepared statement].  SQL parameters are tokens of the\n** form \"?\", \"?NNN\", \":AAA\", \"$AAA\", or \"@AAA\" that serve as\n** placeholders for values that are [sqlite3_bind_blob | bound]\n** to the parameters at a later time.\n**\n** ^(This routine actually returns the index of the largest (rightmost)\n** parameter. For all forms except ?NNN, this will correspond to the\n** number of unique parameters.  If parameters of the ?NNN form are used,\n** there may be gaps in the list.)^\n**\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\n** [sqlite3_bind_parameter_name()], and\n** [sqlite3_bind_parameter_index()].\n*/\nSQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);\n\n/*\n** CAPI3REF: Name Of A Host Parameter\n** METHOD: sqlite3_stmt\n**\n** ^The sqlite3_bind_parameter_name(P,N) interface returns\n** the name of the N-th [SQL parameter] in the [prepared statement] P.\n** ^(SQL parameters of the form \"?NNN\" or \":AAA\" or \"@AAA\" or \"$AAA\"\n** have a name which is the string \"?NNN\" or \":AAA\" or \"@AAA\" or \"$AAA\"\n** respectively.\n** In other words, the initial \":\" or \"$\" or \"@\" or \"?\"\n** is included as part of the name.)^\n** ^Parameters of the form \"?\" without a following integer have no name\n** and are referred to as \"nameless\" or \"anonymous parameters\".\n**\n** ^The first host parameter has an index of 1, not 0.\n**\n** ^If the value N is out of range or if the N-th parameter is\n** nameless, then NULL is returned.  ^The returned string is\n** always in UTF-8 encoding even if the named parameter was\n** originally specified as UTF-16 in [sqlite3_prepare16()] or\n** [sqlite3_prepare16_v2()].\n**\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\n** [sqlite3_bind_parameter_count()], and\n** [sqlite3_bind_parameter_index()].\n*/\nSQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);\n\n/*\n** CAPI3REF: Index Of A Parameter With A Given Name\n** METHOD: sqlite3_stmt\n**\n** ^Return the index of an SQL parameter given its name.  ^The\n** index value returned is suitable for use as the second\n** parameter to [sqlite3_bind_blob|sqlite3_bind()].  ^A zero\n** is returned if no matching parameter is found.  ^The parameter\n** name must be given in UTF-8 even if the original statement\n** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].\n**\n** See also: [sqlite3_bind_blob|sqlite3_bind()],\n** [sqlite3_bind_parameter_count()], and\n** [sqlite3_bind_parameter_name()].\n*/\nSQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);\n\n/*\n** CAPI3REF: Reset All Bindings On A Prepared Statement\n** METHOD: sqlite3_stmt\n**\n** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset\n** the [sqlite3_bind_blob | bindings] on a [prepared statement].\n** ^Use this routine to reset all host parameters to NULL.\n*/\nSQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);\n\n/*\n** CAPI3REF: Number Of Columns In A Result Set\n** METHOD: sqlite3_stmt\n**\n** ^Return the number of columns in the result set returned by the\n** [prepared statement]. ^This routine returns 0 if pStmt is an SQL\n** statement that does not return data (for example an [UPDATE]).\n**\n** See also: [sqlite3_data_count()]\n*/\nSQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);\n\n/*\n** CAPI3REF: Column Names In A Result Set\n** METHOD: sqlite3_stmt\n**\n** ^These routines return the name assigned to a particular column\n** in the result set of a [SELECT] statement.  ^The sqlite3_column_name()\n** interface returns a pointer to a zero-terminated UTF-8 string\n** and sqlite3_column_name16() returns a pointer to a zero-terminated\n** UTF-16 string.  ^The first parameter is the [prepared statement]\n** that implements the [SELECT] statement. ^The second parameter is the\n** column number.  ^The leftmost column is number 0.\n**\n** ^The returned string pointer is valid until either the [prepared statement]\n** is destroyed by [sqlite3_finalize()] or until the statement is automatically\n** reprepared by the first call to [sqlite3_step()] for a particular run\n** or until the next call to\n** sqlite3_column_name() or sqlite3_column_name16() on the same column.\n**\n** ^If sqlite3_malloc() fails during the processing of either routine\n** (for example during a conversion from UTF-8 to UTF-16) then a\n** NULL pointer is returned.\n**\n** ^The name of a result column is the value of the \"AS\" clause for\n** that column, if there is an AS clause.  If there is no AS clause\n** then the name of the column is unspecified and may change from\n** one release of SQLite to the next.\n*/\nSQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);\nSQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);\n\n/*\n** CAPI3REF: Source Of Data In A Query Result\n** METHOD: sqlite3_stmt\n**\n** ^These routines provide a means to determine the database, table, and\n** table column that is the origin of a particular result column in\n** [SELECT] statement.\n** ^The name of the database or table or column can be returned as\n** either a UTF-8 or UTF-16 string.  ^The _database_ routines return\n** the database name, the _table_ routines return the table name, and\n** the origin_ routines return the column name.\n** ^The returned string is valid until the [prepared statement] is destroyed\n** using [sqlite3_finalize()] or until the statement is automatically\n** reprepared by the first call to [sqlite3_step()] for a particular run\n** or until the same information is requested\n** again in a different encoding.\n**\n** ^The names returned are the original un-aliased names of the\n** database, table, and column.\n**\n** ^The first argument to these interfaces is a [prepared statement].\n** ^These functions return information about the Nth result column returned by\n** the statement, where N is the second function argument.\n** ^The left-most column is column 0 for these routines.\n**\n** ^If the Nth column returned by the statement is an expression or\n** subquery and is not a column value, then all of these functions return\n** NULL.  ^These routine might also return NULL if a memory allocation error\n** occurs.  ^Otherwise, they return the name of the attached database, table,\n** or column that query result column was extracted from.\n**\n** ^As with all other SQLite APIs, those whose names end with \"16\" return\n** UTF-16 encoded strings and the other functions return UTF-8.\n**\n** ^These APIs are only available if the library was compiled with the\n** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.\n**\n** If two or more threads call one or more of these routines against the same\n** prepared statement and column at the same time then the results are\n** undefined.\n**\n** If two or more threads call one or more\n** [sqlite3_column_database_name | column metadata interfaces]\n** for the same [prepared statement] and result column\n** at the same time then the results are undefined.\n*/\nSQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);\nSQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);\nSQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);\nSQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);\nSQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);\nSQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);\n\n/*\n** CAPI3REF: Declared Datatype Of A Query Result\n** METHOD: sqlite3_stmt\n**\n** ^(The first parameter is a [prepared statement].\n** If this statement is a [SELECT] statement and the Nth column of the\n** returned result set of that [SELECT] is a table column (not an\n** expression or subquery) then the declared type of the table\n** column is returned.)^  ^If the Nth column of the result set is an\n** expression or subquery, then a NULL pointer is returned.\n** ^The returned string is always UTF-8 encoded.\n**\n** ^(For example, given the database schema:\n**\n** CREATE TABLE t1(c1 VARIANT);\n**\n** and the following statement to be compiled:\n**\n** SELECT c1 + 1, c1 FROM t1;\n**\n** this routine would return the string \"VARIANT\" for the second result\n** column (i==1), and a NULL pointer for the first result column (i==0).)^\n**\n** ^SQLite uses dynamic run-time typing.  ^So just because a column\n** is declared to contain a particular type does not mean that the\n** data stored in that column is of the declared type.  SQLite is\n** strongly typed, but the typing is dynamic not static.  ^Type\n** is associated with individual values, not with the containers\n** used to hold those values.\n*/\nSQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);\nSQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);\n\n/*\n** CAPI3REF: Evaluate An SQL Statement\n** METHOD: sqlite3_stmt\n**\n** After a [prepared statement] has been prepared using either\n** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy\n** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function\n** must be called one or more times to evaluate the statement.\n**\n** The details of the behavior of the sqlite3_step() interface depend\n** on whether the statement was prepared using the newer \"v2\" interface\n** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy\n** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the\n** new \"v2\" interface is recommended for new applications but the legacy\n** interface will continue to be supported.\n**\n** ^In the legacy interface, the return value will be either [SQLITE_BUSY],\n** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].\n** ^With the \"v2\" interface, any of the other [result codes] or\n** [extended result codes] might be returned as well.\n**\n** ^[SQLITE_BUSY] means that the database engine was unable to acquire the\n** database locks it needs to do its job.  ^If the statement is a [COMMIT]\n** or occurs outside of an explicit transaction, then you can retry the\n** statement.  If the statement is not a [COMMIT] and occurs within an\n** explicit transaction then you should rollback the transaction before\n** continuing.\n**\n** ^[SQLITE_DONE] means that the statement has finished executing\n** successfully.  sqlite3_step() should not be called again on this virtual\n** machine without first calling [sqlite3_reset()] to reset the virtual\n** machine back to its initial state.\n**\n** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]\n** is returned each time a new row of data is ready for processing by the\n** caller. The values may be accessed using the [column access functions].\n** sqlite3_step() is called again to retrieve the next row of data.\n**\n** ^[SQLITE_ERROR] means that a run-time error (such as a constraint\n** violation) has occurred.  sqlite3_step() should not be called again on\n** the VM. More information may be found by calling [sqlite3_errmsg()].\n** ^With the legacy interface, a more specific error code (for example,\n** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)\n** can be obtained by calling [sqlite3_reset()] on the\n** [prepared statement].  ^In the \"v2\" interface,\n** the more specific error code is returned directly by sqlite3_step().\n**\n** [SQLITE_MISUSE] means that the this routine was called inappropriately.\n** Perhaps it was called on a [prepared statement] that has\n** already been [sqlite3_finalize | finalized] or on one that had\n** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could\n** be the case that the same database connection is being used by two or\n** more threads at the same moment in time.\n**\n** For all versions of SQLite up to and including 3.6.23.1, a call to\n** [sqlite3_reset()] was required after sqlite3_step() returned anything\n** other than [SQLITE_ROW] before any subsequent invocation of\n** sqlite3_step().  Failure to reset the prepared statement using \n** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from\n** sqlite3_step().  But after [version 3.6.23.1] ([dateof:3.6.23.1],\n** sqlite3_step() began\n** calling [sqlite3_reset()] automatically in this circumstance rather\n** than returning [SQLITE_MISUSE].  This is not considered a compatibility\n** break because any application that ever receives an SQLITE_MISUSE error\n** is broken by definition.  The [SQLITE_OMIT_AUTORESET] compile-time option\n** can be used to restore the legacy behavior.\n**\n** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()\n** API always returns a generic error code, [SQLITE_ERROR], following any\n** error other than [SQLITE_BUSY] and [SQLITE_MISUSE].  You must call\n** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the\n** specific [error codes] that better describes the error.\n** We admit that this is a goofy design.  The problem has been fixed\n** with the \"v2\" interface.  If you prepare all of your SQL statements\n** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead\n** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,\n** then the more specific [error codes] are returned directly\n** by sqlite3_step().  The use of the \"v2\" interface is recommended.\n*/\nSQLITE_API int sqlite3_step(sqlite3_stmt*);\n\n/*\n** CAPI3REF: Number of columns in a result set\n** METHOD: sqlite3_stmt\n**\n** ^The sqlite3_data_count(P) interface returns the number of columns in the\n** current row of the result set of [prepared statement] P.\n** ^If prepared statement P does not have results ready to return\n** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of\n** interfaces) then sqlite3_data_count(P) returns 0.\n** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.\n** ^The sqlite3_data_count(P) routine returns 0 if the previous call to\n** [sqlite3_step](P) returned [SQLITE_DONE].  ^The sqlite3_data_count(P)\n** will return non-zero if previous call to [sqlite3_step](P) returned\n** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]\n** where it always returns zero since each step of that multi-step\n** pragma returns 0 columns of data.\n**\n** See also: [sqlite3_column_count()]\n*/\nSQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);\n\n/*\n** CAPI3REF: Fundamental Datatypes\n** KEYWORDS: SQLITE_TEXT\n**\n** ^(Every value in SQLite has one of five fundamental datatypes:\n**\n** <ul>\n** <li> 64-bit signed integer\n** <li> 64-bit IEEE floating point number\n** <li> string\n** <li> BLOB\n** <li> NULL\n** </ul>)^\n**\n** These constants are codes for each of those types.\n**\n** Note that the SQLITE_TEXT constant was also used in SQLite version 2\n** for a completely different meaning.  Software that links against both\n** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not\n** SQLITE_TEXT.\n*/\n#define SQLITE_INTEGER  1\n#define SQLITE_FLOAT    2\n#define SQLITE_BLOB     4\n#define SQLITE_NULL     5\n#ifdef SQLITE_TEXT\n# undef SQLITE_TEXT\n#else\n# define SQLITE_TEXT     3\n#endif\n#define SQLITE3_TEXT     3\n\n/*\n** CAPI3REF: Result Values From A Query\n** KEYWORDS: {column access functions}\n** METHOD: sqlite3_stmt\n**\n** ^These routines return information about a single column of the current\n** result row of a query.  ^In every case the first argument is a pointer\n** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]\n** that was returned from [sqlite3_prepare_v2()] or one of its variants)\n** and the second argument is the index of the column for which information\n** should be returned. ^The leftmost column of the result set has the index 0.\n** ^The number of columns in the result can be determined using\n** [sqlite3_column_count()].\n**\n** If the SQL statement does not currently point to a valid row, or if the\n** column index is out of range, the result is undefined.\n** These routines may only be called when the most recent call to\n** [sqlite3_step()] has returned [SQLITE_ROW] and neither\n** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.\n** If any of these routines are called after [sqlite3_reset()] or\n** [sqlite3_finalize()] or after [sqlite3_step()] has returned\n** something other than [SQLITE_ROW], the results are undefined.\n** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]\n** are called from a different thread while any of these routines\n** are pending, then the results are undefined.\n**\n** ^The sqlite3_column_type() routine returns the\n** [SQLITE_INTEGER | datatype code] for the initial data type\n** of the result column.  ^The returned value is one of [SQLITE_INTEGER],\n** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value\n** returned by sqlite3_column_type() is only meaningful if no type\n** conversions have occurred as described below.  After a type conversion,\n** the value returned by sqlite3_column_type() is undefined.  Future\n** versions of SQLite may change the behavior of sqlite3_column_type()\n** following a type conversion.\n**\n** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()\n** routine returns the number of bytes in that BLOB or string.\n** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts\n** the string to UTF-8 and then returns the number of bytes.\n** ^If the result is a numeric value then sqlite3_column_bytes() uses\n** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns\n** the number of bytes in that string.\n** ^If the result is NULL, then sqlite3_column_bytes() returns zero.\n**\n** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()\n** routine returns the number of bytes in that BLOB or string.\n** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts\n** the string to UTF-16 and then returns the number of bytes.\n** ^If the result is a numeric value then sqlite3_column_bytes16() uses\n** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns\n** the number of bytes in that string.\n** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.\n**\n** ^The values returned by [sqlite3_column_bytes()] and \n** [sqlite3_column_bytes16()] do not include the zero terminators at the end\n** of the string.  ^For clarity: the values returned by\n** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of\n** bytes in the string, not the number of characters.\n**\n** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),\n** even empty strings, are always zero-terminated.  ^The return\n** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.\n**\n** <b>Warning:</b> ^The object returned by [sqlite3_column_value()] is an\n** [unprotected sqlite3_value] object.  In a multithreaded environment,\n** an unprotected sqlite3_value object may only be used safely with\n** [sqlite3_bind_value()] and [sqlite3_result_value()].\n** If the [unprotected sqlite3_value] object returned by\n** [sqlite3_column_value()] is used in any other way, including calls\n** to routines like [sqlite3_value_int()], [sqlite3_value_text()],\n** or [sqlite3_value_bytes()], the behavior is not threadsafe.\n**\n** These routines attempt to convert the value where appropriate.  ^For\n** example, if the internal representation is FLOAT and a text result\n** is requested, [sqlite3_snprintf()] is used internally to perform the\n** conversion automatically.  ^(The following table details the conversions\n** that are applied:\n**\n** <blockquote>\n** <table border=\"1\">\n** <tr><th> Internal<br>Type <th> Requested<br>Type <th>  Conversion\n**\n** <tr><td>  NULL    <td> INTEGER   <td> Result is 0\n** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0\n** <tr><td>  NULL    <td>   TEXT    <td> Result is a NULL pointer\n** <tr><td>  NULL    <td>   BLOB    <td> Result is a NULL pointer\n** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float\n** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer\n** <tr><td> INTEGER  <td>   BLOB    <td> Same as INTEGER->TEXT\n** <tr><td>  FLOAT   <td> INTEGER   <td> [CAST] to INTEGER\n** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float\n** <tr><td>  FLOAT   <td>   BLOB    <td> [CAST] to BLOB\n** <tr><td>  TEXT    <td> INTEGER   <td> [CAST] to INTEGER\n** <tr><td>  TEXT    <td>  FLOAT    <td> [CAST] to REAL\n** <tr><td>  TEXT    <td>   BLOB    <td> No change\n** <tr><td>  BLOB    <td> INTEGER   <td> [CAST] to INTEGER\n** <tr><td>  BLOB    <td>  FLOAT    <td> [CAST] to REAL\n** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed\n** </table>\n** </blockquote>)^\n**\n** Note that when type conversions occur, pointers returned by prior\n** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or\n** sqlite3_column_text16() may be invalidated.\n** Type conversions and pointer invalidations might occur\n** in the following cases:\n**\n** <ul>\n** <li> The initial content is a BLOB and sqlite3_column_text() or\n**      sqlite3_column_text16() is called.  A zero-terminator might\n**      need to be added to the string.</li>\n** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or\n**      sqlite3_column_text16() is called.  The content must be converted\n**      to UTF-16.</li>\n** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or\n**      sqlite3_column_text() is called.  The content must be converted\n**      to UTF-8.</li>\n** </ul>\n**\n** ^Conversions between UTF-16be and UTF-16le are always done in place and do\n** not invalidate a prior pointer, though of course the content of the buffer\n** that the prior pointer references will have been modified.  Other kinds\n** of conversion are done in place when it is possible, but sometimes they\n** are not possible and in those cases prior pointers are invalidated.\n**\n** The safest policy is to invoke these routines\n** in one of the following ways:\n**\n** <ul>\n**  <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>\n**  <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>\n**  <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>\n** </ul>\n**\n** In other words, you should call sqlite3_column_text(),\n** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result\n** into the desired format, then invoke sqlite3_column_bytes() or\n** sqlite3_column_bytes16() to find the size of the result.  Do not mix calls\n** to sqlite3_column_text() or sqlite3_column_blob() with calls to\n** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()\n** with calls to sqlite3_column_bytes().\n**\n** ^The pointers returned are valid until a type conversion occurs as\n** described above, or until [sqlite3_step()] or [sqlite3_reset()] or\n** [sqlite3_finalize()] is called.  ^The memory space used to hold strings\n** and BLOBs is freed automatically.  Do <em>not</em> pass the pointers returned\n** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into\n** [sqlite3_free()].\n**\n** ^(If a memory allocation error occurs during the evaluation of any\n** of these routines, a default value is returned.  The default value\n** is either the integer 0, the floating point number 0.0, or a NULL\n** pointer.  Subsequent calls to [sqlite3_errcode()] will return\n** [SQLITE_NOMEM].)^\n*/\nSQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);\nSQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);\nSQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);\nSQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);\nSQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);\nSQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);\nSQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);\nSQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);\nSQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);\nSQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);\n\n/*\n** CAPI3REF: Destroy A Prepared Statement Object\n** DESTRUCTOR: sqlite3_stmt\n**\n** ^The sqlite3_finalize() function is called to delete a [prepared statement].\n** ^If the most recent evaluation of the statement encountered no errors\n** or if the statement is never been evaluated, then sqlite3_finalize() returns\n** SQLITE_OK.  ^If the most recent evaluation of statement S failed, then\n** sqlite3_finalize(S) returns the appropriate [error code] or\n** [extended error code].\n**\n** ^The sqlite3_finalize(S) routine can be called at any point during\n** the life cycle of [prepared statement] S:\n** before statement S is ever evaluated, after\n** one or more calls to [sqlite3_reset()], or after any call\n** to [sqlite3_step()] regardless of whether or not the statement has\n** completed execution.\n**\n** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.\n**\n** The application must finalize every [prepared statement] in order to avoid\n** resource leaks.  It is a grievous error for the application to try to use\n** a prepared statement after it has been finalized.  Any use of a prepared\n** statement after it has been finalized can result in undefined and\n** undesirable behavior such as segfaults and heap corruption.\n*/\nSQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);\n\n/*\n** CAPI3REF: Reset A Prepared Statement Object\n** METHOD: sqlite3_stmt\n**\n** The sqlite3_reset() function is called to reset a [prepared statement]\n** object back to its initial state, ready to be re-executed.\n** ^Any SQL statement variables that had values bound to them using\n** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.\n** Use [sqlite3_clear_bindings()] to reset the bindings.\n**\n** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S\n** back to the beginning of its program.\n**\n** ^If the most recent call to [sqlite3_step(S)] for the\n** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],\n** or if [sqlite3_step(S)] has never before been called on S,\n** then [sqlite3_reset(S)] returns [SQLITE_OK].\n**\n** ^If the most recent call to [sqlite3_step(S)] for the\n** [prepared statement] S indicated an error, then\n** [sqlite3_reset(S)] returns an appropriate [error code].\n**\n** ^The [sqlite3_reset(S)] interface does not change the values\n** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.\n*/\nSQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);\n\n/*\n** CAPI3REF: Create Or Redefine SQL Functions\n** KEYWORDS: {function creation routines}\n** KEYWORDS: {application-defined SQL function}\n** KEYWORDS: {application-defined SQL functions}\n** METHOD: sqlite3\n**\n** ^These functions (collectively known as \"function creation routines\")\n** are used to add SQL functions or aggregates or to redefine the behavior\n** of existing SQL functions or aggregates.  The only differences between\n** these routines are the text encoding expected for\n** the second parameter (the name of the function being created)\n** and the presence or absence of a destructor callback for\n** the application data pointer.\n**\n** ^The first parameter is the [database connection] to which the SQL\n** function is to be added.  ^If an application uses more than one database\n** connection then application-defined SQL functions must be added\n** to each database connection separately.\n**\n** ^The second parameter is the name of the SQL function to be created or\n** redefined.  ^The length of the name is limited to 255 bytes in a UTF-8\n** representation, exclusive of the zero-terminator.  ^Note that the name\n** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.  \n** ^Any attempt to create a function with a longer name\n** will result in [SQLITE_MISUSE] being returned.\n**\n** ^The third parameter (nArg)\n** is the number of arguments that the SQL function or\n** aggregate takes. ^If this parameter is -1, then the SQL function or\n** aggregate may take any number of arguments between 0 and the limit\n** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]).  If the third\n** parameter is less than -1 or greater than 127 then the behavior is\n** undefined.\n**\n** ^The fourth parameter, eTextRep, specifies what\n** [SQLITE_UTF8 | text encoding] this SQL function prefers for\n** its parameters.  The application should set this parameter to\n** [SQLITE_UTF16LE] if the function implementation invokes \n** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the\n** implementation invokes [sqlite3_value_text16be()] on an input, or\n** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8]\n** otherwise.  ^The same SQL function may be registered multiple times using\n** different preferred text encodings, with different implementations for\n** each encoding.\n** ^When multiple implementations of the same function are available, SQLite\n** will pick the one that involves the least amount of data conversion.\n**\n** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC]\n** to signal that the function will always return the same result given\n** the same inputs within a single SQL statement.  Most SQL functions are\n** deterministic.  The built-in [random()] SQL function is an example of a\n** function that is not deterministic.  The SQLite query planner is able to\n** perform additional optimizations on deterministic functions, so use\n** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.\n**\n** ^(The fifth parameter is an arbitrary pointer.  The implementation of the\n** function can gain access to this pointer using [sqlite3_user_data()].)^\n**\n** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are\n** pointers to C-language functions that implement the SQL function or\n** aggregate. ^A scalar SQL function requires an implementation of the xFunc\n** callback only; NULL pointers must be passed as the xStep and xFinal\n** parameters. ^An aggregate SQL function requires an implementation of xStep\n** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing\n** SQL function or aggregate, pass NULL pointers for all three function\n** callbacks.\n**\n** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL,\n** then it is destructor for the application data pointer. \n** The destructor is invoked when the function is deleted, either by being\n** overloaded or when the database connection closes.)^\n** ^The destructor is also invoked if the call to\n** sqlite3_create_function_v2() fails.\n** ^When the destructor callback of the tenth parameter is invoked, it\n** is passed a single argument which is a copy of the application data \n** pointer which was the fifth parameter to sqlite3_create_function_v2().\n**\n** ^It is permitted to register multiple implementations of the same\n** functions with the same name but with either differing numbers of\n** arguments or differing preferred text encodings.  ^SQLite will use\n** the implementation that most closely matches the way in which the\n** SQL function is used.  ^A function implementation with a non-negative\n** nArg parameter is a better match than a function implementation with\n** a negative nArg.  ^A function where the preferred text encoding\n** matches the database encoding is a better\n** match than a function where the encoding is different.  \n** ^A function where the encoding difference is between UTF16le and UTF16be\n** is a closer match than a function where the encoding difference is\n** between UTF8 and UTF16.\n**\n** ^Built-in functions may be overloaded by new application-defined functions.\n**\n** ^An application-defined function is permitted to call other\n** SQLite interfaces.  However, such calls must not\n** close the database connection nor finalize or reset the prepared\n** statement in which the function is running.\n*/\nSQLITE_API int sqlite3_create_function(\n  sqlite3 *db,\n  const char *zFunctionName,\n  int nArg,\n  int eTextRep,\n  void *pApp,\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\n  void (*xFinal)(sqlite3_context*)\n);\nSQLITE_API int sqlite3_create_function16(\n  sqlite3 *db,\n  const void *zFunctionName,\n  int nArg,\n  int eTextRep,\n  void *pApp,\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\n  void (*xFinal)(sqlite3_context*)\n);\nSQLITE_API int sqlite3_create_function_v2(\n  sqlite3 *db,\n  const char *zFunctionName,\n  int nArg,\n  int eTextRep,\n  void *pApp,\n  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\n  void (*xFinal)(sqlite3_context*),\n  void(*xDestroy)(void*)\n);\n\n/*\n** CAPI3REF: Text Encodings\n**\n** These constant define integer codes that represent the various\n** text encodings supported by SQLite.\n*/\n#define SQLITE_UTF8           1    /* IMP: R-37514-35566 */\n#define SQLITE_UTF16LE        2    /* IMP: R-03371-37637 */\n#define SQLITE_UTF16BE        3    /* IMP: R-51971-34154 */\n#define SQLITE_UTF16          4    /* Use native byte order */\n#define SQLITE_ANY            5    /* Deprecated */\n#define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */\n\n/*\n** CAPI3REF: Function Flags\n**\n** These constants may be ORed together with the \n** [SQLITE_UTF8 | preferred text encoding] as the fourth argument\n** to [sqlite3_create_function()], [sqlite3_create_function16()], or\n** [sqlite3_create_function_v2()].\n*/\n#define SQLITE_DETERMINISTIC    0x800\n\n/*\n** CAPI3REF: Deprecated Functions\n** DEPRECATED\n**\n** These functions are [deprecated].  In order to maintain\n** backwards compatibility with older code, these functions continue \n** to be supported.  However, new applications should avoid\n** the use of these functions.  To encourage programmers to avoid\n** these functions, we will not explain what they do.\n*/\n#ifndef SQLITE_OMIT_DEPRECATED\nSQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);\nSQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);\nSQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);\nSQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);\nSQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);\nSQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),\n                      void*,sqlite3_int64);\n#endif\n\n/*\n** CAPI3REF: Obtaining SQL Values\n** METHOD: sqlite3_value\n**\n** The C-language implementation of SQL functions and aggregates uses\n** this set of interface routines to access the parameter values on\n** the function or aggregate.  \n**\n** The xFunc (for scalar functions) or xStep (for aggregates) parameters\n** to [sqlite3_create_function()] and [sqlite3_create_function16()]\n** define callbacks that implement the SQL functions and aggregates.\n** The 3rd parameter to these callbacks is an array of pointers to\n** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for\n** each parameter to the SQL function.  These routines are used to\n** extract values from the [sqlite3_value] objects.\n**\n** These routines work only with [protected sqlite3_value] objects.\n** Any attempt to use these routines on an [unprotected sqlite3_value]\n** object results in undefined behavior.\n**\n** ^These routines work just like the corresponding [column access functions]\n** except that these routines take a single [protected sqlite3_value] object\n** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.\n**\n** ^The sqlite3_value_text16() interface extracts a UTF-16 string\n** in the native byte-order of the host machine.  ^The\n** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces\n** extract UTF-16 strings as big-endian and little-endian respectively.\n**\n** ^(The sqlite3_value_numeric_type() interface attempts to apply\n** numeric affinity to the value.  This means that an attempt is\n** made to convert the value to an integer or floating point.  If\n** such a conversion is possible without loss of information (in other\n** words, if the value is a string that looks like a number)\n** then the conversion is performed.  Otherwise no conversion occurs.\n** The [SQLITE_INTEGER | datatype] after conversion is returned.)^\n**\n** Please pay particular attention to the fact that the pointer returned\n** from [sqlite3_value_blob()], [sqlite3_value_text()], or\n** [sqlite3_value_text16()] can be invalidated by a subsequent call to\n** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],\n** or [sqlite3_value_text16()].\n**\n** These routines must be called from the same thread as\n** the SQL function that supplied the [sqlite3_value*] parameters.\n*/\nSQLITE_API const void *sqlite3_value_blob(sqlite3_value*);\nSQLITE_API int sqlite3_value_bytes(sqlite3_value*);\nSQLITE_API int sqlite3_value_bytes16(sqlite3_value*);\nSQLITE_API double sqlite3_value_double(sqlite3_value*);\nSQLITE_API int sqlite3_value_int(sqlite3_value*);\nSQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);\nSQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);\nSQLITE_API const void *sqlite3_value_text16(sqlite3_value*);\nSQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);\nSQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);\nSQLITE_API int sqlite3_value_type(sqlite3_value*);\nSQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);\n\n/*\n** CAPI3REF: Finding The Subtype Of SQL Values\n** METHOD: sqlite3_value\n**\n** The sqlite3_value_subtype(V) function returns the subtype for\n** an [application-defined SQL function] argument V.  The subtype\n** information can be used to pass a limited amount of context from\n** one SQL function to another.  Use the [sqlite3_result_subtype()]\n** routine to set the subtype for the return value of an SQL function.\n**\n** SQLite makes no use of subtype itself.  It merely passes the subtype\n** from the result of one [application-defined SQL function] into the\n** input of another.\n*/\nSQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);\n\n/*\n** CAPI3REF: Copy And Free SQL Values\n** METHOD: sqlite3_value\n**\n** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]\n** object D and returns a pointer to that copy.  ^The [sqlite3_value] returned\n** is a [protected sqlite3_value] object even if the input is not.\n** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a\n** memory allocation fails.\n**\n** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object\n** previously obtained from [sqlite3_value_dup()].  ^If V is a NULL pointer\n** then sqlite3_value_free(V) is a harmless no-op.\n*/\nSQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);\nSQLITE_API void sqlite3_value_free(sqlite3_value*);\n\n/*\n** CAPI3REF: Obtain Aggregate Function Context\n** METHOD: sqlite3_context\n**\n** Implementations of aggregate SQL functions use this\n** routine to allocate memory for storing their state.\n**\n** ^The first time the sqlite3_aggregate_context(C,N) routine is called \n** for a particular aggregate function, SQLite\n** allocates N of memory, zeroes out that memory, and returns a pointer\n** to the new memory. ^On second and subsequent calls to\n** sqlite3_aggregate_context() for the same aggregate function instance,\n** the same buffer is returned.  Sqlite3_aggregate_context() is normally\n** called once for each invocation of the xStep callback and then one\n** last time when the xFinal callback is invoked.  ^(When no rows match\n** an aggregate query, the xStep() callback of the aggregate function\n** implementation is never called and xFinal() is called exactly once.\n** In those cases, sqlite3_aggregate_context() might be called for the\n** first time from within xFinal().)^\n**\n** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer \n** when first called if N is less than or equal to zero or if a memory\n** allocate error occurs.\n**\n** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is\n** determined by the N parameter on first successful call.  Changing the\n** value of N in subsequent call to sqlite3_aggregate_context() within\n** the same aggregate function instance will not resize the memory\n** allocation.)^  Within the xFinal callback, it is customary to set\n** N=0 in calls to sqlite3_aggregate_context(C,N) so that no \n** pointless memory allocations occur.\n**\n** ^SQLite automatically frees the memory allocated by \n** sqlite3_aggregate_context() when the aggregate query concludes.\n**\n** The first parameter must be a copy of the\n** [sqlite3_context | SQL function context] that is the first parameter\n** to the xStep or xFinal callback routine that implements the aggregate\n** function.\n**\n** This routine must be called from the same thread in which\n** the aggregate SQL function is running.\n*/\nSQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);\n\n/*\n** CAPI3REF: User Data For Functions\n** METHOD: sqlite3_context\n**\n** ^The sqlite3_user_data() interface returns a copy of\n** the pointer that was the pUserData parameter (the 5th parameter)\n** of the [sqlite3_create_function()]\n** and [sqlite3_create_function16()] routines that originally\n** registered the application defined function.\n**\n** This routine must be called from the same thread in which\n** the application-defined function is running.\n*/\nSQLITE_API void *sqlite3_user_data(sqlite3_context*);\n\n/*\n** CAPI3REF: Database Connection For Functions\n** METHOD: sqlite3_context\n**\n** ^The sqlite3_context_db_handle() interface returns a copy of\n** the pointer to the [database connection] (the 1st parameter)\n** of the [sqlite3_create_function()]\n** and [sqlite3_create_function16()] routines that originally\n** registered the application defined function.\n*/\nSQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);\n\n/*\n** CAPI3REF: Function Auxiliary Data\n** METHOD: sqlite3_context\n**\n** These functions may be used by (non-aggregate) SQL functions to\n** associate metadata with argument values. If the same value is passed to\n** multiple invocations of the same SQL function during query execution, under\n** some circumstances the associated metadata may be preserved.  An example\n** of where this might be useful is in a regular-expression matching\n** function. The compiled version of the regular expression can be stored as\n** metadata associated with the pattern string.  \n** Then as long as the pattern string remains the same,\n** the compiled regular expression can be reused on multiple\n** invocations of the same function.\n**\n** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata\n** associated by the sqlite3_set_auxdata() function with the Nth argument\n** value to the application-defined function. ^If there is no metadata\n** associated with the function argument, this sqlite3_get_auxdata() interface\n** returns a NULL pointer.\n**\n** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th\n** argument of the application-defined function.  ^Subsequent\n** calls to sqlite3_get_auxdata(C,N) return P from the most recent\n** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or\n** NULL if the metadata has been discarded.\n** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,\n** SQLite will invoke the destructor function X with parameter P exactly\n** once, when the metadata is discarded.\n** SQLite is free to discard the metadata at any time, including: <ul>\n** <li> ^(when the corresponding function parameter changes)^, or\n** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the\n**      SQL statement)^, or\n** <li> ^(when sqlite3_set_auxdata() is invoked again on the same\n**       parameter)^, or\n** <li> ^(during the original sqlite3_set_auxdata() call when a memory \n**      allocation error occurs.)^ </ul>\n**\n** Note the last bullet in particular.  The destructor X in \n** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the\n** sqlite3_set_auxdata() interface even returns.  Hence sqlite3_set_auxdata()\n** should be called near the end of the function implementation and the\n** function implementation should not make any use of P after\n** sqlite3_set_auxdata() has been called.\n**\n** ^(In practice, metadata is preserved between function calls for\n** function parameters that are compile-time constants, including literal\n** values and [parameters] and expressions composed from the same.)^\n**\n** These routines must be called from the same thread in which\n** the SQL function is running.\n*/\nSQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);\nSQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));\n\n\n/*\n** CAPI3REF: Constants Defining Special Destructor Behavior\n**\n** These are special values for the destructor that is passed in as the\n** final argument to routines like [sqlite3_result_blob()].  ^If the destructor\n** argument is SQLITE_STATIC, it means that the content pointer is constant\n** and will never change.  It does not need to be destroyed.  ^The\n** SQLITE_TRANSIENT value means that the content will likely change in\n** the near future and that SQLite should make its own private copy of\n** the content before returning.\n**\n** The typedef is necessary to work around problems in certain\n** C++ compilers.\n*/\ntypedef void (*sqlite3_destructor_type)(void*);\n#define SQLITE_STATIC      ((sqlite3_destructor_type)0)\n#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)\n\n/*\n** CAPI3REF: Setting The Result Of An SQL Function\n** METHOD: sqlite3_context\n**\n** These routines are used by the xFunc or xFinal callbacks that\n** implement SQL functions and aggregates.  See\n** [sqlite3_create_function()] and [sqlite3_create_function16()]\n** for additional information.\n**\n** These functions work very much like the [parameter binding] family of\n** functions used to bind values to host parameters in prepared statements.\n** Refer to the [SQL parameter] documentation for additional information.\n**\n** ^The sqlite3_result_blob() interface sets the result from\n** an application-defined function to be the BLOB whose content is pointed\n** to by the second parameter and which is N bytes long where N is the\n** third parameter.\n**\n** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)\n** interfaces set the result of the application-defined function to be\n** a BLOB containing all zero bytes and N bytes in size.\n**\n** ^The sqlite3_result_double() interface sets the result from\n** an application-defined function to be a floating point value specified\n** by its 2nd argument.\n**\n** ^The sqlite3_result_error() and sqlite3_result_error16() functions\n** cause the implemented SQL function to throw an exception.\n** ^SQLite uses the string pointed to by the\n** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()\n** as the text of an error message.  ^SQLite interprets the error\n** message string from sqlite3_result_error() as UTF-8. ^SQLite\n** interprets the string from sqlite3_result_error16() as UTF-16 in native\n** byte order.  ^If the third parameter to sqlite3_result_error()\n** or sqlite3_result_error16() is negative then SQLite takes as the error\n** message all text up through the first zero character.\n** ^If the third parameter to sqlite3_result_error() or\n** sqlite3_result_error16() is non-negative then SQLite takes that many\n** bytes (not characters) from the 2nd parameter as the error message.\n** ^The sqlite3_result_error() and sqlite3_result_error16()\n** routines make a private copy of the error message text before\n** they return.  Hence, the calling function can deallocate or\n** modify the text after they return without harm.\n** ^The sqlite3_result_error_code() function changes the error code\n** returned by SQLite as a result of an error in a function.  ^By default,\n** the error code is SQLITE_ERROR.  ^A subsequent call to sqlite3_result_error()\n** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.\n**\n** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an\n** error indicating that a string or BLOB is too long to represent.\n**\n** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an\n** error indicating that a memory allocation failed.\n**\n** ^The sqlite3_result_int() interface sets the return value\n** of the application-defined function to be the 32-bit signed integer\n** value given in the 2nd argument.\n** ^The sqlite3_result_int64() interface sets the return value\n** of the application-defined function to be the 64-bit signed integer\n** value given in the 2nd argument.\n**\n** ^The sqlite3_result_null() interface sets the return value\n** of the application-defined function to be NULL.\n**\n** ^The sqlite3_result_text(), sqlite3_result_text16(),\n** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces\n** set the return value of the application-defined function to be\n** a text string which is represented as UTF-8, UTF-16 native byte order,\n** UTF-16 little endian, or UTF-16 big endian, respectively.\n** ^The sqlite3_result_text64() interface sets the return value of an\n** application-defined function to be a text string in an encoding\n** specified by the fifth (and last) parameter, which must be one\n** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].\n** ^SQLite takes the text result from the application from\n** the 2nd parameter of the sqlite3_result_text* interfaces.\n** ^If the 3rd parameter to the sqlite3_result_text* interfaces\n** is negative, then SQLite takes result text from the 2nd parameter\n** through the first zero character.\n** ^If the 3rd parameter to the sqlite3_result_text* interfaces\n** is non-negative, then as many bytes (not characters) of the text\n** pointed to by the 2nd parameter are taken as the application-defined\n** function result.  If the 3rd parameter is non-negative, then it\n** must be the byte offset into the string where the NUL terminator would\n** appear if the string where NUL terminated.  If any NUL characters occur\n** in the string at a byte offset that is less than the value of the 3rd\n** parameter, then the resulting string will contain embedded NULs and the\n** result of expressions operating on strings with embedded NULs is undefined.\n** ^If the 4th parameter to the sqlite3_result_text* interfaces\n** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that\n** function as the destructor on the text or BLOB result when it has\n** finished using that result.\n** ^If the 4th parameter to the sqlite3_result_text* interfaces or to\n** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite\n** assumes that the text or BLOB result is in constant space and does not\n** copy the content of the parameter nor call a destructor on the content\n** when it has finished using that result.\n** ^If the 4th parameter to the sqlite3_result_text* interfaces\n** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT\n** then SQLite makes a copy of the result into space obtained from\n** from [sqlite3_malloc()] before it returns.\n**\n** ^The sqlite3_result_value() interface sets the result of\n** the application-defined function to be a copy of the\n** [unprotected sqlite3_value] object specified by the 2nd parameter.  ^The\n** sqlite3_result_value() interface makes a copy of the [sqlite3_value]\n** so that the [sqlite3_value] specified in the parameter may change or\n** be deallocated after sqlite3_result_value() returns without harm.\n** ^A [protected sqlite3_value] object may always be used where an\n** [unprotected sqlite3_value] object is required, so either\n** kind of [sqlite3_value] object can be used with this interface.\n**\n** If these routines are called from within the different thread\n** than the one containing the application-defined function that received\n** the [sqlite3_context] pointer, the results are undefined.\n*/\nSQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));\nSQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,\n                           sqlite3_uint64,void(*)(void*));\nSQLITE_API void sqlite3_result_double(sqlite3_context*, double);\nSQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);\nSQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);\nSQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);\nSQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);\nSQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);\nSQLITE_API void sqlite3_result_int(sqlite3_context*, int);\nSQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);\nSQLITE_API void sqlite3_result_null(sqlite3_context*);\nSQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));\nSQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,\n                           void(*)(void*), unsigned char encoding);\nSQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));\nSQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));\nSQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));\nSQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);\nSQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);\nSQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);\n\n\n/*\n** CAPI3REF: Setting The Subtype Of An SQL Function\n** METHOD: sqlite3_context\n**\n** The sqlite3_result_subtype(C,T) function causes the subtype of\n** the result from the [application-defined SQL function] with \n** [sqlite3_context] C to be the value T.  Only the lower 8 bits \n** of the subtype T are preserved in current versions of SQLite;\n** higher order bits are discarded.\n** The number of subtype bytes preserved by SQLite might increase\n** in future releases of SQLite.\n*/\nSQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);\n\n/*\n** CAPI3REF: Define New Collating Sequences\n** METHOD: sqlite3\n**\n** ^These functions add, remove, or modify a [collation] associated\n** with the [database connection] specified as the first argument.\n**\n** ^The name of the collation is a UTF-8 string\n** for sqlite3_create_collation() and sqlite3_create_collation_v2()\n** and a UTF-16 string in native byte order for sqlite3_create_collation16().\n** ^Collation names that compare equal according to [sqlite3_strnicmp()] are\n** considered to be the same name.\n**\n** ^(The third argument (eTextRep) must be one of the constants:\n** <ul>\n** <li> [SQLITE_UTF8],\n** <li> [SQLITE_UTF16LE],\n** <li> [SQLITE_UTF16BE],\n** <li> [SQLITE_UTF16], or\n** <li> [SQLITE_UTF16_ALIGNED].\n** </ul>)^\n** ^The eTextRep argument determines the encoding of strings passed\n** to the collating function callback, xCallback.\n** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep\n** force strings to be UTF16 with native byte order.\n** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin\n** on an even byte address.\n**\n** ^The fourth argument, pArg, is an application data pointer that is passed\n** through as the first argument to the collating function callback.\n**\n** ^The fifth argument, xCallback, is a pointer to the collating function.\n** ^Multiple collating functions can be registered using the same name but\n** with different eTextRep parameters and SQLite will use whichever\n** function requires the least amount of data transformation.\n** ^If the xCallback argument is NULL then the collating function is\n** deleted.  ^When all collating functions having the same name are deleted,\n** that collation is no longer usable.\n**\n** ^The collating function callback is invoked with a copy of the pArg \n** application data pointer and with two strings in the encoding specified\n** by the eTextRep argument.  The collating function must return an\n** integer that is negative, zero, or positive\n** if the first string is less than, equal to, or greater than the second,\n** respectively.  A collating function must always return the same answer\n** given the same inputs.  If two or more collating functions are registered\n** to the same collation name (using different eTextRep values) then all\n** must give an equivalent answer when invoked with equivalent strings.\n** The collating function must obey the following properties for all\n** strings A, B, and C:\n**\n** <ol>\n** <li> If A==B then B==A.\n** <li> If A==B and B==C then A==C.\n** <li> If A&lt;B THEN B&gt;A.\n** <li> If A&lt;B and B&lt;C then A&lt;C.\n** </ol>\n**\n** If a collating function fails any of the above constraints and that\n** collating function is  registered and used, then the behavior of SQLite\n** is undefined.\n**\n** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()\n** with the addition that the xDestroy callback is invoked on pArg when\n** the collating function is deleted.\n** ^Collating functions are deleted when they are overridden by later\n** calls to the collation creation functions or when the\n** [database connection] is closed using [sqlite3_close()].\n**\n** ^The xDestroy callback is <u>not</u> called if the \n** sqlite3_create_collation_v2() function fails.  Applications that invoke\n** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should \n** check the return code and dispose of the application data pointer\n** themselves rather than expecting SQLite to deal with it for them.\n** This is different from every other SQLite interface.  The inconsistency \n** is unfortunate but cannot be changed without breaking backwards \n** compatibility.\n**\n** See also:  [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].\n*/\nSQLITE_API int sqlite3_create_collation(\n  sqlite3*, \n  const char *zName, \n  int eTextRep, \n  void *pArg,\n  int(*xCompare)(void*,int,const void*,int,const void*)\n);\nSQLITE_API int sqlite3_create_collation_v2(\n  sqlite3*, \n  const char *zName, \n  int eTextRep, \n  void *pArg,\n  int(*xCompare)(void*,int,const void*,int,const void*),\n  void(*xDestroy)(void*)\n);\nSQLITE_API int sqlite3_create_collation16(\n  sqlite3*, \n  const void *zName,\n  int eTextRep, \n  void *pArg,\n  int(*xCompare)(void*,int,const void*,int,const void*)\n);\n\n/*\n** CAPI3REF: Collation Needed Callbacks\n** METHOD: sqlite3\n**\n** ^To avoid having to register all collation sequences before a database\n** can be used, a single callback function may be registered with the\n** [database connection] to be invoked whenever an undefined collation\n** sequence is required.\n**\n** ^If the function is registered using the sqlite3_collation_needed() API,\n** then it is passed the names of undefined collation sequences as strings\n** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,\n** the names are passed as UTF-16 in machine native byte order.\n** ^A call to either function replaces the existing collation-needed callback.\n**\n** ^(When the callback is invoked, the first argument passed is a copy\n** of the second argument to sqlite3_collation_needed() or\n** sqlite3_collation_needed16().  The second argument is the database\n** connection.  The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],\n** or [SQLITE_UTF16LE], indicating the most desirable form of the collation\n** sequence function required.  The fourth parameter is the name of the\n** required collation sequence.)^\n**\n** The callback function should register the desired collation using\n** [sqlite3_create_collation()], [sqlite3_create_collation16()], or\n** [sqlite3_create_collation_v2()].\n*/\nSQLITE_API int sqlite3_collation_needed(\n  sqlite3*, \n  void*, \n  void(*)(void*,sqlite3*,int eTextRep,const char*)\n);\nSQLITE_API int sqlite3_collation_needed16(\n  sqlite3*, \n  void*,\n  void(*)(void*,sqlite3*,int eTextRep,const void*)\n);\n\n#ifdef SQLITE_HAS_CODEC\n/*\n** Specify the key for an encrypted database.  This routine should be\n** called right after sqlite3_open().\n**\n** The code to implement this API is not available in the public release\n** of SQLite.\n*/\nSQLITE_API int sqlite3_key(\n  sqlite3 *db,                   /* Database to be rekeyed */\n  const void *pKey, int nKey     /* The key */\n);\nSQLITE_API int sqlite3_key_v2(\n  sqlite3 *db,                   /* Database to be rekeyed */\n  const char *zDbName,           /* Name of the database */\n  const void *pKey, int nKey     /* The key */\n);\n\n/*\n** Change the key on an open database.  If the current database is not\n** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the\n** database is decrypted.\n**\n** The code to implement this API is not available in the public release\n** of SQLite.\n*/\nSQLITE_API int sqlite3_rekey(\n  sqlite3 *db,                   /* Database to be rekeyed */\n  const void *pKey, int nKey     /* The new key */\n);\nSQLITE_API int sqlite3_rekey_v2(\n  sqlite3 *db,                   /* Database to be rekeyed */\n  const char *zDbName,           /* Name of the database */\n  const void *pKey, int nKey     /* The new key */\n);\n\n/*\n** Specify the activation key for a SEE database.  Unless \n** activated, none of the SEE routines will work.\n*/\nSQLITE_API void sqlite3_activate_see(\n  const char *zPassPhrase        /* Activation phrase */\n);\n#endif\n\n#ifdef SQLITE_ENABLE_CEROD\n/*\n** Specify the activation key for a CEROD database.  Unless \n** activated, none of the CEROD routines will work.\n*/\nSQLITE_API void sqlite3_activate_cerod(\n  const char *zPassPhrase        /* Activation phrase */\n);\n#endif\n\n/*\n** CAPI3REF: Suspend Execution For A Short Time\n**\n** The sqlite3_sleep() function causes the current thread to suspend execution\n** for at least a number of milliseconds specified in its parameter.\n**\n** If the operating system does not support sleep requests with\n** millisecond time resolution, then the time will be rounded up to\n** the nearest second. The number of milliseconds of sleep actually\n** requested from the operating system is returned.\n**\n** ^SQLite implements this interface by calling the xSleep()\n** method of the default [sqlite3_vfs] object.  If the xSleep() method\n** of the default VFS is not implemented correctly, or not implemented at\n** all, then the behavior of sqlite3_sleep() may deviate from the description\n** in the previous paragraphs.\n*/\nSQLITE_API int sqlite3_sleep(int);\n\n/*\n** CAPI3REF: Name Of The Folder Holding Temporary Files\n**\n** ^(If this global variable is made to point to a string which is\n** the name of a folder (a.k.a. directory), then all temporary files\n** created by SQLite when using a built-in [sqlite3_vfs | VFS]\n** will be placed in that directory.)^  ^If this variable\n** is a NULL pointer, then SQLite performs a search for an appropriate\n** temporary file directory.\n**\n** Applications are strongly discouraged from using this global variable.\n** It is required to set a temporary folder on Windows Runtime (WinRT).\n** But for all other platforms, it is highly recommended that applications\n** neither read nor write this variable.  This global variable is a relic\n** that exists for backwards compatibility of legacy applications and should\n** be avoided in new projects.\n**\n** It is not safe to read or modify this variable in more than one\n** thread at a time.  It is not safe to read or modify this variable\n** if a [database connection] is being used at the same time in a separate\n** thread.\n** It is intended that this variable be set once\n** as part of process initialization and before any SQLite interface\n** routines have been called and that this variable remain unchanged\n** thereafter.\n**\n** ^The [temp_store_directory pragma] may modify this variable and cause\n** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,\n** the [temp_store_directory pragma] always assumes that any string\n** that this variable points to is held in memory obtained from \n** [sqlite3_malloc] and the pragma may attempt to free that memory\n** using [sqlite3_free].\n** Hence, if this variable is modified directly, either it should be\n** made NULL or made to point to memory obtained from [sqlite3_malloc]\n** or else the use of the [temp_store_directory pragma] should be avoided.\n** Except when requested by the [temp_store_directory pragma], SQLite\n** does not free the memory that sqlite3_temp_directory points to.  If\n** the application wants that memory to be freed, it must do\n** so itself, taking care to only do so after all [database connection]\n** objects have been destroyed.\n**\n** <b>Note to Windows Runtime users:</b>  The temporary directory must be set\n** prior to calling [sqlite3_open] or [sqlite3_open_v2].  Otherwise, various\n** features that require the use of temporary files may fail.  Here is an\n** example of how to do this using C++ with the Windows Runtime:\n**\n** <blockquote><pre>\n** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->\n** &nbsp;     TemporaryFolder->Path->Data();\n** char zPathBuf&#91;MAX_PATH + 1&#93;;\n** memset(zPathBuf, 0, sizeof(zPathBuf));\n** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),\n** &nbsp;     NULL, NULL);\n** sqlite3_temp_directory = sqlite3_mprintf(\"%s\", zPathBuf);\n** </pre></blockquote>\n*/\nSQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;\n\n/*\n** CAPI3REF: Name Of The Folder Holding Database Files\n**\n** ^(If this global variable is made to point to a string which is\n** the name of a folder (a.k.a. directory), then all database files\n** specified with a relative pathname and created or accessed by\n** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed\n** to be relative to that directory.)^ ^If this variable is a NULL\n** pointer, then SQLite assumes that all database files specified\n** with a relative pathname are relative to the current directory\n** for the process.  Only the windows VFS makes use of this global\n** variable; it is ignored by the unix VFS.\n**\n** Changing the value of this variable while a database connection is\n** open can result in a corrupt database.\n**\n** It is not safe to read or modify this variable in more than one\n** thread at a time.  It is not safe to read or modify this variable\n** if a [database connection] is being used at the same time in a separate\n** thread.\n** It is intended that this variable be set once\n** as part of process initialization and before any SQLite interface\n** routines have been called and that this variable remain unchanged\n** thereafter.\n**\n** ^The [data_store_directory pragma] may modify this variable and cause\n** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,\n** the [data_store_directory pragma] always assumes that any string\n** that this variable points to is held in memory obtained from \n** [sqlite3_malloc] and the pragma may attempt to free that memory\n** using [sqlite3_free].\n** Hence, if this variable is modified directly, either it should be\n** made NULL or made to point to memory obtained from [sqlite3_malloc]\n** or else the use of the [data_store_directory pragma] should be avoided.\n*/\nSQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;\n\n/*\n** CAPI3REF: Test For Auto-Commit Mode\n** KEYWORDS: {autocommit mode}\n** METHOD: sqlite3\n**\n** ^The sqlite3_get_autocommit() interface returns non-zero or\n** zero if the given database connection is or is not in autocommit mode,\n** respectively.  ^Autocommit mode is on by default.\n** ^Autocommit mode is disabled by a [BEGIN] statement.\n** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].\n**\n** If certain kinds of errors occur on a statement within a multi-statement\n** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],\n** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the\n** transaction might be rolled back automatically.  The only way to\n** find out whether SQLite automatically rolled back the transaction after\n** an error is to use this function.\n**\n** If another thread changes the autocommit status of the database\n** connection while this routine is running, then the return value\n** is undefined.\n*/\nSQLITE_API int sqlite3_get_autocommit(sqlite3*);\n\n/*\n** CAPI3REF: Find The Database Handle Of A Prepared Statement\n** METHOD: sqlite3_stmt\n**\n** ^The sqlite3_db_handle interface returns the [database connection] handle\n** to which a [prepared statement] belongs.  ^The [database connection]\n** returned by sqlite3_db_handle is the same [database connection]\n** that was the first argument\n** to the [sqlite3_prepare_v2()] call (or its variants) that was used to\n** create the statement in the first place.\n*/\nSQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);\n\n/*\n** CAPI3REF: Return The Filename For A Database Connection\n** METHOD: sqlite3\n**\n** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename\n** associated with database N of connection D.  ^The main database file\n** has the name \"main\".  If there is no attached database N on the database\n** connection D, or if database N is a temporary or in-memory database, then\n** a NULL pointer is returned.\n**\n** ^The filename returned by this function is the output of the\n** xFullPathname method of the [VFS].  ^In other words, the filename\n** will be an absolute pathname, even if the filename used\n** to open the database originally was a URI or relative pathname.\n*/\nSQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);\n\n/*\n** CAPI3REF: Determine if a database is read-only\n** METHOD: sqlite3\n**\n** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N\n** of connection D is read-only, 0 if it is read/write, or -1 if N is not\n** the name of a database on connection D.\n*/\nSQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);\n\n/*\n** CAPI3REF: Find the next prepared statement\n** METHOD: sqlite3\n**\n** ^This interface returns a pointer to the next [prepared statement] after\n** pStmt associated with the [database connection] pDb.  ^If pStmt is NULL\n** then this interface returns a pointer to the first prepared statement\n** associated with the database connection pDb.  ^If no prepared statement\n** satisfies the conditions of this routine, it returns NULL.\n**\n** The [database connection] pointer D in a call to\n** [sqlite3_next_stmt(D,S)] must refer to an open database\n** connection and in particular must not be a NULL pointer.\n*/\nSQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);\n\n/*\n** CAPI3REF: Commit And Rollback Notification Callbacks\n** METHOD: sqlite3\n**\n** ^The sqlite3_commit_hook() interface registers a callback\n** function to be invoked whenever a transaction is [COMMIT | committed].\n** ^Any callback set by a previous call to sqlite3_commit_hook()\n** for the same database connection is overridden.\n** ^The sqlite3_rollback_hook() interface registers a callback\n** function to be invoked whenever a transaction is [ROLLBACK | rolled back].\n** ^Any callback set by a previous call to sqlite3_rollback_hook()\n** for the same database connection is overridden.\n** ^The pArg argument is passed through to the callback.\n** ^If the callback on a commit hook function returns non-zero,\n** then the commit is converted into a rollback.\n**\n** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions\n** return the P argument from the previous call of the same function\n** on the same [database connection] D, or NULL for\n** the first call for each function on D.\n**\n** The commit and rollback hook callbacks are not reentrant.\n** The callback implementation must not do anything that will modify\n** the database connection that invoked the callback.  Any actions\n** to modify the database connection must be deferred until after the\n** completion of the [sqlite3_step()] call that triggered the commit\n** or rollback hook in the first place.\n** Note that running any other SQL statements, including SELECT statements,\n** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify\n** the database connections for the meaning of \"modify\" in this paragraph.\n**\n** ^Registering a NULL function disables the callback.\n**\n** ^When the commit hook callback routine returns zero, the [COMMIT]\n** operation is allowed to continue normally.  ^If the commit hook\n** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].\n** ^The rollback hook is invoked on a rollback that results from a commit\n** hook returning non-zero, just as it would be with any other rollback.\n**\n** ^For the purposes of this API, a transaction is said to have been\n** rolled back if an explicit \"ROLLBACK\" statement is executed, or\n** an error or constraint causes an implicit rollback to occur.\n** ^The rollback callback is not invoked if a transaction is\n** automatically rolled back because the database connection is closed.\n**\n** See also the [sqlite3_update_hook()] interface.\n*/\nSQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);\nSQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);\n\n/*\n** CAPI3REF: Data Change Notification Callbacks\n** METHOD: sqlite3\n**\n** ^The sqlite3_update_hook() interface registers a callback function\n** with the [database connection] identified by the first argument\n** to be invoked whenever a row is updated, inserted or deleted in\n** a [rowid table].\n** ^Any callback set by a previous call to this function\n** for the same database connection is overridden.\n**\n** ^The second argument is a pointer to the function to invoke when a\n** row is updated, inserted or deleted in a rowid table.\n** ^The first argument to the callback is a copy of the third argument\n** to sqlite3_update_hook().\n** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],\n** or [SQLITE_UPDATE], depending on the operation that caused the callback\n** to be invoked.\n** ^The third and fourth arguments to the callback contain pointers to the\n** database and table name containing the affected row.\n** ^The final callback parameter is the [rowid] of the row.\n** ^In the case of an update, this is the [rowid] after the update takes place.\n**\n** ^(The update hook is not invoked when internal system tables are\n** modified (i.e. sqlite_master and sqlite_sequence).)^\n** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.\n**\n** ^In the current implementation, the update hook\n** is not invoked when duplication rows are deleted because of an\n** [ON CONFLICT | ON CONFLICT REPLACE] clause.  ^Nor is the update hook\n** invoked when rows are deleted using the [truncate optimization].\n** The exceptions defined in this paragraph might change in a future\n** release of SQLite.\n**\n** The update hook implementation must not do anything that will modify\n** the database connection that invoked the update hook.  Any actions\n** to modify the database connection must be deferred until after the\n** completion of the [sqlite3_step()] call that triggered the update hook.\n** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their\n** database connections for the meaning of \"modify\" in this paragraph.\n**\n** ^The sqlite3_update_hook(D,C,P) function\n** returns the P argument from the previous call\n** on the same [database connection] D, or NULL for\n** the first call on D.\n**\n** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],\n** and [sqlite3_preupdate_hook()] interfaces.\n*/\nSQLITE_API void *sqlite3_update_hook(\n  sqlite3*, \n  void(*)(void *,int ,char const *,char const *,sqlite3_int64),\n  void*\n);\n\n/*\n** CAPI3REF: Enable Or Disable Shared Pager Cache\n**\n** ^(This routine enables or disables the sharing of the database cache\n** and schema data structures between [database connection | connections]\n** to the same database. Sharing is enabled if the argument is true\n** and disabled if the argument is false.)^\n**\n** ^Cache sharing is enabled and disabled for an entire process.\n** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). \n** In prior versions of SQLite,\n** sharing was enabled or disabled for each thread separately.\n**\n** ^(The cache sharing mode set by this interface effects all subsequent\n** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].\n** Existing database connections continue use the sharing mode\n** that was in effect at the time they were opened.)^\n**\n** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled\n** successfully.  An [error code] is returned otherwise.)^\n**\n** ^Shared cache is disabled by default. But this might change in\n** future releases of SQLite.  Applications that care about shared\n** cache setting should set it explicitly.\n**\n** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0\n** and will always return SQLITE_MISUSE. On those systems, \n** shared cache mode should be enabled per-database connection via \n** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].\n**\n** This interface is threadsafe on processors where writing a\n** 32-bit integer is atomic.\n**\n** See Also:  [SQLite Shared-Cache Mode]\n*/\nSQLITE_API int sqlite3_enable_shared_cache(int);\n\n/*\n** CAPI3REF: Attempt To Free Heap Memory\n**\n** ^The sqlite3_release_memory() interface attempts to free N bytes\n** of heap memory by deallocating non-essential memory allocations\n** held by the database library.   Memory used to cache database\n** pages to improve performance is an example of non-essential memory.\n** ^sqlite3_release_memory() returns the number of bytes actually freed,\n** which might be more or less than the amount requested.\n** ^The sqlite3_release_memory() routine is a no-op returning zero\n** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].\n**\n** See also: [sqlite3_db_release_memory()]\n*/\nSQLITE_API int sqlite3_release_memory(int);\n\n/*\n** CAPI3REF: Free Memory Used By A Database Connection\n** METHOD: sqlite3\n**\n** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap\n** memory as possible from database connection D. Unlike the\n** [sqlite3_release_memory()] interface, this interface is in effect even\n** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is\n** omitted.\n**\n** See also: [sqlite3_release_memory()]\n*/\nSQLITE_API int sqlite3_db_release_memory(sqlite3*);\n\n/*\n** CAPI3REF: Impose A Limit On Heap Size\n**\n** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the\n** soft limit on the amount of heap memory that may be allocated by SQLite.\n** ^SQLite strives to keep heap memory utilization below the soft heap\n** limit by reducing the number of pages held in the page cache\n** as heap memory usages approaches the limit.\n** ^The soft heap limit is \"soft\" because even though SQLite strives to stay\n** below the limit, it will exceed the limit rather than generate\n** an [SQLITE_NOMEM] error.  In other words, the soft heap limit \n** is advisory only.\n**\n** ^The return value from sqlite3_soft_heap_limit64() is the size of\n** the soft heap limit prior to the call, or negative in the case of an\n** error.  ^If the argument N is negative\n** then no change is made to the soft heap limit.  Hence, the current\n** size of the soft heap limit can be determined by invoking\n** sqlite3_soft_heap_limit64() with a negative argument.\n**\n** ^If the argument N is zero then the soft heap limit is disabled.\n**\n** ^(The soft heap limit is not enforced in the current implementation\n** if one or more of following conditions are true:\n**\n** <ul>\n** <li> The soft heap limit is set to zero.\n** <li> Memory accounting is disabled using a combination of the\n**      [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and\n**      the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.\n** <li> An alternative page cache implementation is specified using\n**      [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).\n** <li> The page cache allocates from its own memory pool supplied\n**      by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than\n**      from the heap.\n** </ul>)^\n**\n** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]), \n** the soft heap limit is enforced\n** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT]\n** compile-time option is invoked.  With [SQLITE_ENABLE_MEMORY_MANAGEMENT],\n** the soft heap limit is enforced on every memory allocation.  Without\n** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced\n** when memory is allocated by the page cache.  Testing suggests that because\n** the page cache is the predominate memory user in SQLite, most\n** applications will achieve adequate soft heap limit enforcement without\n** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT].\n**\n** The circumstances under which SQLite will enforce the soft heap limit may\n** changes in future releases of SQLite.\n*/\nSQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);\n\n/*\n** CAPI3REF: Deprecated Soft Heap Limit Interface\n** DEPRECATED\n**\n** This is a deprecated version of the [sqlite3_soft_heap_limit64()]\n** interface.  This routine is provided for historical compatibility\n** only.  All new applications should use the\n** [sqlite3_soft_heap_limit64()] interface rather than this one.\n*/\nSQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);\n\n\n/*\n** CAPI3REF: Extract Metadata About A Column Of A Table\n** METHOD: sqlite3\n**\n** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns\n** information about column C of table T in database D\n** on [database connection] X.)^  ^The sqlite3_table_column_metadata()\n** interface returns SQLITE_OK and fills in the non-NULL pointers in\n** the final five arguments with appropriate values if the specified\n** column exists.  ^The sqlite3_table_column_metadata() interface returns\n** SQLITE_ERROR and if the specified column does not exist.\n** ^If the column-name parameter to sqlite3_table_column_metadata() is a\n** NULL pointer, then this routine simply checks for the existence of the\n** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it\n** does not.\n**\n** ^The column is identified by the second, third and fourth parameters to\n** this function. ^(The second parameter is either the name of the database\n** (i.e. \"main\", \"temp\", or an attached database) containing the specified\n** table or NULL.)^ ^If it is NULL, then all attached databases are searched\n** for the table using the same algorithm used by the database engine to\n** resolve unqualified table references.\n**\n** ^The third and fourth parameters to this function are the table and column\n** name of the desired column, respectively.\n**\n** ^Metadata is returned by writing to the memory locations passed as the 5th\n** and subsequent parameters to this function. ^Any of these arguments may be\n** NULL, in which case the corresponding element of metadata is omitted.\n**\n** ^(<blockquote>\n** <table border=\"1\">\n** <tr><th> Parameter <th> Output<br>Type <th>  Description\n**\n** <tr><td> 5th <td> const char* <td> Data type\n** <tr><td> 6th <td> const char* <td> Name of default collation sequence\n** <tr><td> 7th <td> int         <td> True if column has a NOT NULL constraint\n** <tr><td> 8th <td> int         <td> True if column is part of the PRIMARY KEY\n** <tr><td> 9th <td> int         <td> True if column is [AUTOINCREMENT]\n** </table>\n** </blockquote>)^\n**\n** ^The memory pointed to by the character pointers returned for the\n** declaration type and collation sequence is valid until the next\n** call to any SQLite API function.\n**\n** ^If the specified table is actually a view, an [error code] is returned.\n**\n** ^If the specified column is \"rowid\", \"oid\" or \"_rowid_\" and the table \n** is not a [WITHOUT ROWID] table and an\n** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output\n** parameters are set for the explicitly declared column. ^(If there is no\n** [INTEGER PRIMARY KEY] column, then the outputs\n** for the [rowid] are set as follows:\n**\n** <pre>\n**     data type: \"INTEGER\"\n**     collation sequence: \"BINARY\"\n**     not null: 0\n**     primary key: 1\n**     auto increment: 0\n** </pre>)^\n**\n** ^This function causes all database schemas to be read from disk and\n** parsed, if that has not already been done, and returns an error if\n** any errors are encountered while loading the schema.\n*/\nSQLITE_API int sqlite3_table_column_metadata(\n  sqlite3 *db,                /* Connection handle */\n  const char *zDbName,        /* Database name or NULL */\n  const char *zTableName,     /* Table name */\n  const char *zColumnName,    /* Column name */\n  char const **pzDataType,    /* OUTPUT: Declared data type */\n  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */\n  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */\n  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */\n  int *pAutoinc               /* OUTPUT: True if column is auto-increment */\n);\n\n/*\n** CAPI3REF: Load An Extension\n** METHOD: sqlite3\n**\n** ^This interface loads an SQLite extension library from the named file.\n**\n** ^The sqlite3_load_extension() interface attempts to load an\n** [SQLite extension] library contained in the file zFile.  If\n** the file cannot be loaded directly, attempts are made to load\n** with various operating-system specific extensions added.\n** So for example, if \"samplelib\" cannot be loaded, then names like\n** \"samplelib.so\" or \"samplelib.dylib\" or \"samplelib.dll\" might\n** be tried also.\n**\n** ^The entry point is zProc.\n** ^(zProc may be 0, in which case SQLite will try to come up with an\n** entry point name on its own.  It first tries \"sqlite3_extension_init\".\n** If that does not work, it constructs a name \"sqlite3_X_init\" where the\n** X is consists of the lower-case equivalent of all ASCII alphabetic\n** characters in the filename from the last \"/\" to the first following\n** \".\" and omitting any initial \"lib\".)^\n** ^The sqlite3_load_extension() interface returns\n** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.\n** ^If an error occurs and pzErrMsg is not 0, then the\n** [sqlite3_load_extension()] interface shall attempt to\n** fill *pzErrMsg with error message text stored in memory\n** obtained from [sqlite3_malloc()]. The calling function\n** should free this memory by calling [sqlite3_free()].\n**\n** ^Extension loading must be enabled using\n** [sqlite3_enable_load_extension()] or\n** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL)\n** prior to calling this API,\n** otherwise an error will be returned.\n**\n** <b>Security warning:</b> It is recommended that the \n** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this\n** interface.  The use of the [sqlite3_enable_load_extension()] interface\n** should be avoided.  This will keep the SQL function [load_extension()]\n** disabled and prevent SQL injections from giving attackers\n** access to extension loading capabilities.\n**\n** See also the [load_extension() SQL function].\n*/\nSQLITE_API int sqlite3_load_extension(\n  sqlite3 *db,          /* Load the extension into this database connection */\n  const char *zFile,    /* Name of the shared library containing extension */\n  const char *zProc,    /* Entry point.  Derived from zFile if 0 */\n  char **pzErrMsg       /* Put error message here if not 0 */\n);\n\n/*\n** CAPI3REF: Enable Or Disable Extension Loading\n** METHOD: sqlite3\n**\n** ^So as not to open security holes in older applications that are\n** unprepared to deal with [extension loading], and as a means of disabling\n** [extension loading] while evaluating user-entered SQL, the following API\n** is provided to turn the [sqlite3_load_extension()] mechanism on and off.\n**\n** ^Extension loading is off by default.\n** ^Call the sqlite3_enable_load_extension() routine with onoff==1\n** to turn extension loading on and call it with onoff==0 to turn\n** it back off again.\n**\n** ^This interface enables or disables both the C-API\n** [sqlite3_load_extension()] and the SQL function [load_extension()].\n** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)\n** to enable or disable only the C-API.)^\n**\n** <b>Security warning:</b> It is recommended that extension loading\n** be disabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method\n** rather than this interface, so the [load_extension()] SQL function\n** remains disabled. This will prevent SQL injections from giving attackers\n** access to extension loading capabilities.\n*/\nSQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);\n\n/*\n** CAPI3REF: Automatically Load Statically Linked Extensions\n**\n** ^This interface causes the xEntryPoint() function to be invoked for\n** each new [database connection] that is created.  The idea here is that\n** xEntryPoint() is the entry point for a statically linked [SQLite extension]\n** that is to be automatically loaded into all new database connections.\n**\n** ^(Even though the function prototype shows that xEntryPoint() takes\n** no arguments and returns void, SQLite invokes xEntryPoint() with three\n** arguments and expects an integer result as if the signature of the\n** entry point where as follows:\n**\n** <blockquote><pre>\n** &nbsp;  int xEntryPoint(\n** &nbsp;    sqlite3 *db,\n** &nbsp;    const char **pzErrMsg,\n** &nbsp;    const struct sqlite3_api_routines *pThunk\n** &nbsp;  );\n** </pre></blockquote>)^\n**\n** If the xEntryPoint routine encounters an error, it should make *pzErrMsg\n** point to an appropriate error message (obtained from [sqlite3_mprintf()])\n** and return an appropriate [error code].  ^SQLite ensures that *pzErrMsg\n** is NULL before calling the xEntryPoint().  ^SQLite will invoke\n** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns.  ^If any\n** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],\n** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.\n**\n** ^Calling sqlite3_auto_extension(X) with an entry point X that is already\n** on the list of automatic extensions is a harmless no-op. ^No entry point\n** will be called more than once for each database connection that is opened.\n**\n** See also: [sqlite3_reset_auto_extension()]\n** and [sqlite3_cancel_auto_extension()]\n*/\nSQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));\n\n/*\n** CAPI3REF: Cancel Automatic Extension Loading\n**\n** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the\n** initialization routine X that was registered using a prior call to\n** [sqlite3_auto_extension(X)].  ^The [sqlite3_cancel_auto_extension(X)]\n** routine returns 1 if initialization routine X was successfully \n** unregistered and it returns 0 if X was not on the list of initialization\n** routines.\n*/\nSQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));\n\n/*\n** CAPI3REF: Reset Automatic Extension Loading\n**\n** ^This interface disables all automatic extensions previously\n** registered using [sqlite3_auto_extension()].\n*/\nSQLITE_API void sqlite3_reset_auto_extension(void);\n\n/*\n** The interface to the virtual-table mechanism is currently considered\n** to be experimental.  The interface might change in incompatible ways.\n** If this is a problem for you, do not use the interface at this time.\n**\n** When the virtual-table mechanism stabilizes, we will declare the\n** interface fixed, support it indefinitely, and remove this comment.\n*/\n\n/*\n** Structures used by the virtual table interface\n*/\ntypedef struct sqlite3_vtab sqlite3_vtab;\ntypedef struct sqlite3_index_info sqlite3_index_info;\ntypedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;\ntypedef struct sqlite3_module sqlite3_module;\n\n/*\n** CAPI3REF: Virtual Table Object\n** KEYWORDS: sqlite3_module {virtual table module}\n**\n** This structure, sometimes called a \"virtual table module\", \n** defines the implementation of a [virtual tables].  \n** This structure consists mostly of methods for the module.\n**\n** ^A virtual table module is created by filling in a persistent\n** instance of this structure and passing a pointer to that instance\n** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].\n** ^The registration remains valid until it is replaced by a different\n** module or until the [database connection] closes.  The content\n** of this structure must not change while it is registered with\n** any database connection.\n*/\nstruct sqlite3_module {\n  int iVersion;\n  int (*xCreate)(sqlite3*, void *pAux,\n               int argc, const char *const*argv,\n               sqlite3_vtab **ppVTab, char**);\n  int (*xConnect)(sqlite3*, void *pAux,\n               int argc, const char *const*argv,\n               sqlite3_vtab **ppVTab, char**);\n  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);\n  int (*xDisconnect)(sqlite3_vtab *pVTab);\n  int (*xDestroy)(sqlite3_vtab *pVTab);\n  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);\n  int (*xClose)(sqlite3_vtab_cursor*);\n  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,\n                int argc, sqlite3_value **argv);\n  int (*xNext)(sqlite3_vtab_cursor*);\n  int (*xEof)(sqlite3_vtab_cursor*);\n  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);\n  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);\n  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);\n  int (*xBegin)(sqlite3_vtab *pVTab);\n  int (*xSync)(sqlite3_vtab *pVTab);\n  int (*xCommit)(sqlite3_vtab *pVTab);\n  int (*xRollback)(sqlite3_vtab *pVTab);\n  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,\n                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),\n                       void **ppArg);\n  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);\n  /* The methods above are in version 1 of the sqlite_module object. Those \n  ** below are for version 2 and greater. */\n  int (*xSavepoint)(sqlite3_vtab *pVTab, int);\n  int (*xRelease)(sqlite3_vtab *pVTab, int);\n  int (*xRollbackTo)(sqlite3_vtab *pVTab, int);\n};\n\n/*\n** CAPI3REF: Virtual Table Indexing Information\n** KEYWORDS: sqlite3_index_info\n**\n** The sqlite3_index_info structure and its substructures is used as part\n** of the [virtual table] interface to\n** pass information into and receive the reply from the [xBestIndex]\n** method of a [virtual table module].  The fields under **Inputs** are the\n** inputs to xBestIndex and are read-only.  xBestIndex inserts its\n** results into the **Outputs** fields.\n**\n** ^(The aConstraint[] array records WHERE clause constraints of the form:\n**\n** <blockquote>column OP expr</blockquote>\n**\n** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is\n** stored in aConstraint[].op using one of the\n** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^\n** ^(The index of the column is stored in\n** aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the\n** expr on the right-hand side can be evaluated (and thus the constraint\n** is usable) and false if it cannot.)^\n**\n** ^The optimizer automatically inverts terms of the form \"expr OP column\"\n** and makes other simplifications to the WHERE clause in an attempt to\n** get as many WHERE clause terms into the form shown above as possible.\n** ^The aConstraint[] array only reports WHERE clause terms that are\n** relevant to the particular virtual table being queried.\n**\n** ^Information about the ORDER BY clause is stored in aOrderBy[].\n** ^Each term of aOrderBy records a column of the ORDER BY clause.\n**\n** The colUsed field indicates which columns of the virtual table may be\n** required by the current scan. Virtual table columns are numbered from\n** zero in the order in which they appear within the CREATE TABLE statement\n** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),\n** the corresponding bit is set within the colUsed mask if the column may be\n** required by SQLite. If the table has at least 64 columns and any column\n** to the right of the first 63 is required, then bit 63 of colUsed is also\n** set. In other words, column iCol may be required if the expression\n** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to \n** non-zero.\n**\n** The [xBestIndex] method must fill aConstraintUsage[] with information\n** about what parameters to pass to xFilter.  ^If argvIndex>0 then\n** the right-hand side of the corresponding aConstraint[] is evaluated\n** and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit\n** is true, then the constraint is assumed to be fully handled by the\n** virtual table and is not checked again by SQLite.)^\n**\n** ^The idxNum and idxPtr values are recorded and passed into the\n** [xFilter] method.\n** ^[sqlite3_free()] is used to free idxPtr if and only if\n** needToFreeIdxPtr is true.\n**\n** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in\n** the correct order to satisfy the ORDER BY clause so that no separate\n** sorting step is required.\n**\n** ^The estimatedCost value is an estimate of the cost of a particular\n** strategy. A cost of N indicates that the cost of the strategy is similar\n** to a linear scan of an SQLite table with N rows. A cost of log(N) \n** indicates that the expense of the operation is similar to that of a\n** binary search on a unique indexed field of an SQLite table with N rows.\n**\n** ^The estimatedRows value is an estimate of the number of rows that\n** will be returned by the strategy.\n**\n** The xBestIndex method may optionally populate the idxFlags field with a \n** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -\n** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite\n** assumes that the strategy may visit at most one row. \n**\n** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then\n** SQLite also assumes that if a call to the xUpdate() method is made as\n** part of the same statement to delete or update a virtual table row and the\n** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback\n** any database changes. In other words, if the xUpdate() returns\n** SQLITE_CONSTRAINT, the database contents must be exactly as they were\n** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not\n** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by\n** the xUpdate method are automatically rolled back by SQLite.\n**\n** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info\n** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). \n** If a virtual table extension is\n** used with an SQLite version earlier than 3.8.2, the results of attempting \n** to read or write the estimatedRows field are undefined (but are likely \n** to included crashing the application). The estimatedRows field should\n** therefore only be used if [sqlite3_libversion_number()] returns a\n** value greater than or equal to 3008002. Similarly, the idxFlags field\n** was added for [version 3.9.0] ([dateof:3.9.0]). \n** It may therefore only be used if\n** sqlite3_libversion_number() returns a value greater than or equal to\n** 3009000.\n*/\nstruct sqlite3_index_info {\n  /* Inputs */\n  int nConstraint;           /* Number of entries in aConstraint */\n  struct sqlite3_index_constraint {\n     int iColumn;              /* Column constrained.  -1 for ROWID */\n     unsigned char op;         /* Constraint operator */\n     unsigned char usable;     /* True if this constraint is usable */\n     int iTermOffset;          /* Used internally - xBestIndex should ignore */\n  } *aConstraint;            /* Table of WHERE clause constraints */\n  int nOrderBy;              /* Number of terms in the ORDER BY clause */\n  struct sqlite3_index_orderby {\n     int iColumn;              /* Column number */\n     unsigned char desc;       /* True for DESC.  False for ASC. */\n  } *aOrderBy;               /* The ORDER BY clause */\n  /* Outputs */\n  struct sqlite3_index_constraint_usage {\n    int argvIndex;           /* if >0, constraint is part of argv to xFilter */\n    unsigned char omit;      /* Do not code a test for this constraint */\n  } *aConstraintUsage;\n  int idxNum;                /* Number used to identify the index */\n  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */\n  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */\n  int orderByConsumed;       /* True if output is already ordered */\n  double estimatedCost;           /* Estimated cost of using this index */\n  /* Fields below are only available in SQLite 3.8.2 and later */\n  sqlite3_int64 estimatedRows;    /* Estimated number of rows returned */\n  /* Fields below are only available in SQLite 3.9.0 and later */\n  int idxFlags;              /* Mask of SQLITE_INDEX_SCAN_* flags */\n  /* Fields below are only available in SQLite 3.10.0 and later */\n  sqlite3_uint64 colUsed;    /* Input: Mask of columns used by statement */\n};\n\n/*\n** CAPI3REF: Virtual Table Scan Flags\n*/\n#define SQLITE_INDEX_SCAN_UNIQUE      1     /* Scan visits at most 1 row */\n\n/*\n** CAPI3REF: Virtual Table Constraint Operator Codes\n**\n** These macros defined the allowed values for the\n** [sqlite3_index_info].aConstraint[].op field.  Each value represents\n** an operator that is part of a constraint term in the wHERE clause of\n** a query that uses a [virtual table].\n*/\n#define SQLITE_INDEX_CONSTRAINT_EQ      2\n#define SQLITE_INDEX_CONSTRAINT_GT      4\n#define SQLITE_INDEX_CONSTRAINT_LE      8\n#define SQLITE_INDEX_CONSTRAINT_LT     16\n#define SQLITE_INDEX_CONSTRAINT_GE     32\n#define SQLITE_INDEX_CONSTRAINT_MATCH  64\n#define SQLITE_INDEX_CONSTRAINT_LIKE   65\n#define SQLITE_INDEX_CONSTRAINT_GLOB   66\n#define SQLITE_INDEX_CONSTRAINT_REGEXP 67\n\n/*\n** CAPI3REF: Register A Virtual Table Implementation\n** METHOD: sqlite3\n**\n** ^These routines are used to register a new [virtual table module] name.\n** ^Module names must be registered before\n** creating a new [virtual table] using the module and before using a\n** preexisting [virtual table] for the module.\n**\n** ^The module name is registered on the [database connection] specified\n** by the first parameter.  ^The name of the module is given by the \n** second parameter.  ^The third parameter is a pointer to\n** the implementation of the [virtual table module].   ^The fourth\n** parameter is an arbitrary client data pointer that is passed through\n** into the [xCreate] and [xConnect] methods of the virtual table module\n** when a new virtual table is be being created or reinitialized.\n**\n** ^The sqlite3_create_module_v2() interface has a fifth parameter which\n** is a pointer to a destructor for the pClientData.  ^SQLite will\n** invoke the destructor function (if it is not NULL) when SQLite\n** no longer needs the pClientData pointer.  ^The destructor will also\n** be invoked if the call to sqlite3_create_module_v2() fails.\n** ^The sqlite3_create_module()\n** interface is equivalent to sqlite3_create_module_v2() with a NULL\n** destructor.\n*/\nSQLITE_API int sqlite3_create_module(\n  sqlite3 *db,               /* SQLite connection to register module with */\n  const char *zName,         /* Name of the module */\n  const sqlite3_module *p,   /* Methods for the module */\n  void *pClientData          /* Client data for xCreate/xConnect */\n);\nSQLITE_API int sqlite3_create_module_v2(\n  sqlite3 *db,               /* SQLite connection to register module with */\n  const char *zName,         /* Name of the module */\n  const sqlite3_module *p,   /* Methods for the module */\n  void *pClientData,         /* Client data for xCreate/xConnect */\n  void(*xDestroy)(void*)     /* Module destructor function */\n);\n\n/*\n** CAPI3REF: Virtual Table Instance Object\n** KEYWORDS: sqlite3_vtab\n**\n** Every [virtual table module] implementation uses a subclass\n** of this object to describe a particular instance\n** of the [virtual table].  Each subclass will\n** be tailored to the specific needs of the module implementation.\n** The purpose of this superclass is to define certain fields that are\n** common to all module implementations.\n**\n** ^Virtual tables methods can set an error message by assigning a\n** string obtained from [sqlite3_mprintf()] to zErrMsg.  The method should\n** take care that any prior string is freed by a call to [sqlite3_free()]\n** prior to assigning a new string to zErrMsg.  ^After the error message\n** is delivered up to the client application, the string will be automatically\n** freed by sqlite3_free() and the zErrMsg field will be zeroed.\n*/\nstruct sqlite3_vtab {\n  const sqlite3_module *pModule;  /* The module for this virtual table */\n  int nRef;                       /* Number of open cursors */\n  char *zErrMsg;                  /* Error message from sqlite3_mprintf() */\n  /* Virtual table implementations will typically add additional fields */\n};\n\n/*\n** CAPI3REF: Virtual Table Cursor Object\n** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}\n**\n** Every [virtual table module] implementation uses a subclass of the\n** following structure to describe cursors that point into the\n** [virtual table] and are used\n** to loop through the virtual table.  Cursors are created using the\n** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed\n** by the [sqlite3_module.xClose | xClose] method.  Cursors are used\n** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods\n** of the module.  Each module implementation will define\n** the content of a cursor structure to suit its own needs.\n**\n** This superclass exists in order to define fields of the cursor that\n** are common to all implementations.\n*/\nstruct sqlite3_vtab_cursor {\n  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */\n  /* Virtual table implementations will typically add additional fields */\n};\n\n/*\n** CAPI3REF: Declare The Schema Of A Virtual Table\n**\n** ^The [xCreate] and [xConnect] methods of a\n** [virtual table module] call this interface\n** to declare the format (the names and datatypes of the columns) of\n** the virtual tables they implement.\n*/\nSQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);\n\n/*\n** CAPI3REF: Overload A Function For A Virtual Table\n** METHOD: sqlite3\n**\n** ^(Virtual tables can provide alternative implementations of functions\n** using the [xFindFunction] method of the [virtual table module].  \n** But global versions of those functions\n** must exist in order to be overloaded.)^\n**\n** ^(This API makes sure a global version of a function with a particular\n** name and number of parameters exists.  If no such function exists\n** before this API is called, a new function is created.)^  ^The implementation\n** of the new function always causes an exception to be thrown.  So\n** the new function is not good for anything by itself.  Its only\n** purpose is to be a placeholder function that can be overloaded\n** by a [virtual table].\n*/\nSQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);\n\n/*\n** The interface to the virtual-table mechanism defined above (back up\n** to a comment remarkably similar to this one) is currently considered\n** to be experimental.  The interface might change in incompatible ways.\n** If this is a problem for you, do not use the interface at this time.\n**\n** When the virtual-table mechanism stabilizes, we will declare the\n** interface fixed, support it indefinitely, and remove this comment.\n*/\n\n/*\n** CAPI3REF: A Handle To An Open BLOB\n** KEYWORDS: {BLOB handle} {BLOB handles}\n**\n** An instance of this object represents an open BLOB on which\n** [sqlite3_blob_open | incremental BLOB I/O] can be performed.\n** ^Objects of this type are created by [sqlite3_blob_open()]\n** and destroyed by [sqlite3_blob_close()].\n** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces\n** can be used to read or write small subsections of the BLOB.\n** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.\n*/\ntypedef struct sqlite3_blob sqlite3_blob;\n\n/*\n** CAPI3REF: Open A BLOB For Incremental I/O\n** METHOD: sqlite3\n** CONSTRUCTOR: sqlite3_blob\n**\n** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located\n** in row iRow, column zColumn, table zTable in database zDb;\n** in other words, the same BLOB that would be selected by:\n**\n** <pre>\n**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;\n** </pre>)^\n**\n** ^(Parameter zDb is not the filename that contains the database, but \n** rather the symbolic name of the database. For attached databases, this is\n** the name that appears after the AS keyword in the [ATTACH] statement.\n** For the main database file, the database name is \"main\". For TEMP\n** tables, the database name is \"temp\".)^\n**\n** ^If the flags parameter is non-zero, then the BLOB is opened for read\n** and write access. ^If the flags parameter is zero, the BLOB is opened for\n** read-only access.\n**\n** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored\n** in *ppBlob. Otherwise an [error code] is returned and, unless the error\n** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided\n** the API is not misused, it is always safe to call [sqlite3_blob_close()] \n** on *ppBlob after this function it returns.\n**\n** This function fails with SQLITE_ERROR if any of the following are true:\n** <ul>\n**   <li> ^(Database zDb does not exist)^, \n**   <li> ^(Table zTable does not exist within database zDb)^, \n**   <li> ^(Table zTable is a WITHOUT ROWID table)^, \n**   <li> ^(Column zColumn does not exist)^,\n**   <li> ^(Row iRow is not present in the table)^,\n**   <li> ^(The specified column of row iRow contains a value that is not\n**         a TEXT or BLOB value)^,\n**   <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE \n**         constraint and the blob is being opened for read/write access)^,\n**   <li> ^([foreign key constraints | Foreign key constraints] are enabled, \n**         column zColumn is part of a [child key] definition and the blob is\n**         being opened for read/write access)^.\n** </ul>\n**\n** ^Unless it returns SQLITE_MISUSE, this function sets the \n** [database connection] error code and message accessible via \n** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. \n**\n**\n** ^(If the row that a BLOB handle points to is modified by an\n** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects\n** then the BLOB handle is marked as \"expired\".\n** This is true if any column of the row is changed, even a column\n** other than the one the BLOB handle is open on.)^\n** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for\n** an expired BLOB handle fail with a return code of [SQLITE_ABORT].\n** ^(Changes written into a BLOB prior to the BLOB expiring are not\n** rolled back by the expiration of the BLOB.  Such changes will eventually\n** commit if the transaction continues to completion.)^\n**\n** ^Use the [sqlite3_blob_bytes()] interface to determine the size of\n** the opened blob.  ^The size of a blob may not be changed by this\n** interface.  Use the [UPDATE] SQL command to change the size of a\n** blob.\n**\n** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces\n** and the built-in [zeroblob] SQL function may be used to create a \n** zero-filled blob to read or write using the incremental-blob interface.\n**\n** To avoid a resource leak, every open [BLOB handle] should eventually\n** be released by a call to [sqlite3_blob_close()].\n*/\nSQLITE_API int sqlite3_blob_open(\n  sqlite3*,\n  const char *zDb,\n  const char *zTable,\n  const char *zColumn,\n  sqlite3_int64 iRow,\n  int flags,\n  sqlite3_blob **ppBlob\n);\n\n/*\n** CAPI3REF: Move a BLOB Handle to a New Row\n** METHOD: sqlite3_blob\n**\n** ^This function is used to move an existing blob handle so that it points\n** to a different row of the same database table. ^The new row is identified\n** by the rowid value passed as the second argument. Only the row can be\n** changed. ^The database, table and column on which the blob handle is open\n** remain the same. Moving an existing blob handle to a new row can be\n** faster than closing the existing handle and opening a new one.\n**\n** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -\n** it must exist and there must be either a blob or text value stored in\n** the nominated column.)^ ^If the new row is not present in the table, or if\n** it does not contain a blob or text value, or if another error occurs, an\n** SQLite error code is returned and the blob handle is considered aborted.\n** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or\n** [sqlite3_blob_reopen()] on an aborted blob handle immediately return\n** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle\n** always returns zero.\n**\n** ^This function sets the database handle error code and message.\n*/\nSQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);\n\n/*\n** CAPI3REF: Close A BLOB Handle\n** DESTRUCTOR: sqlite3_blob\n**\n** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed\n** unconditionally.  Even if this routine returns an error code, the \n** handle is still closed.)^\n**\n** ^If the blob handle being closed was opened for read-write access, and if\n** the database is in auto-commit mode and there are no other open read-write\n** blob handles or active write statements, the current transaction is\n** committed. ^If an error occurs while committing the transaction, an error\n** code is returned and the transaction rolled back.\n**\n** Calling this function with an argument that is not a NULL pointer or an\n** open blob handle results in undefined behaviour. ^Calling this routine \n** with a null pointer (such as would be returned by a failed call to \n** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function\n** is passed a valid open blob handle, the values returned by the \n** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.\n*/\nSQLITE_API int sqlite3_blob_close(sqlite3_blob *);\n\n/*\n** CAPI3REF: Return The Size Of An Open BLOB\n** METHOD: sqlite3_blob\n**\n** ^Returns the size in bytes of the BLOB accessible via the \n** successfully opened [BLOB handle] in its only argument.  ^The\n** incremental blob I/O routines can only read or overwriting existing\n** blob content; they cannot change the size of a blob.\n**\n** This routine only works on a [BLOB handle] which has been created\n** by a prior successful call to [sqlite3_blob_open()] and which has not\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\n** to this routine results in undefined and probably undesirable behavior.\n*/\nSQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);\n\n/*\n** CAPI3REF: Read Data From A BLOB Incrementally\n** METHOD: sqlite3_blob\n**\n** ^(This function is used to read data from an open [BLOB handle] into a\n** caller-supplied buffer. N bytes of data are copied into buffer Z\n** from the open BLOB, starting at offset iOffset.)^\n**\n** ^If offset iOffset is less than N bytes from the end of the BLOB,\n** [SQLITE_ERROR] is returned and no data is read.  ^If N or iOffset is\n** less than zero, [SQLITE_ERROR] is returned and no data is read.\n** ^The size of the blob (and hence the maximum value of N+iOffset)\n** can be determined using the [sqlite3_blob_bytes()] interface.\n**\n** ^An attempt to read from an expired [BLOB handle] fails with an\n** error code of [SQLITE_ABORT].\n**\n** ^(On success, sqlite3_blob_read() returns SQLITE_OK.\n** Otherwise, an [error code] or an [extended error code] is returned.)^\n**\n** This routine only works on a [BLOB handle] which has been created\n** by a prior successful call to [sqlite3_blob_open()] and which has not\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\n** to this routine results in undefined and probably undesirable behavior.\n**\n** See also: [sqlite3_blob_write()].\n*/\nSQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);\n\n/*\n** CAPI3REF: Write Data Into A BLOB Incrementally\n** METHOD: sqlite3_blob\n**\n** ^(This function is used to write data into an open [BLOB handle] from a\n** caller-supplied buffer. N bytes of data are copied from the buffer Z\n** into the open BLOB, starting at offset iOffset.)^\n**\n** ^(On success, sqlite3_blob_write() returns SQLITE_OK.\n** Otherwise, an  [error code] or an [extended error code] is returned.)^\n** ^Unless SQLITE_MISUSE is returned, this function sets the \n** [database connection] error code and message accessible via \n** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions. \n**\n** ^If the [BLOB handle] passed as the first argument was not opened for\n** writing (the flags parameter to [sqlite3_blob_open()] was zero),\n** this function returns [SQLITE_READONLY].\n**\n** This function may only modify the contents of the BLOB; it is\n** not possible to increase the size of a BLOB using this API.\n** ^If offset iOffset is less than N bytes from the end of the BLOB,\n** [SQLITE_ERROR] is returned and no data is written. The size of the \n** BLOB (and hence the maximum value of N+iOffset) can be determined \n** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less \n** than zero [SQLITE_ERROR] is returned and no data is written.\n**\n** ^An attempt to write to an expired [BLOB handle] fails with an\n** error code of [SQLITE_ABORT].  ^Writes to the BLOB that occurred\n** before the [BLOB handle] expired are not rolled back by the\n** expiration of the handle, though of course those changes might\n** have been overwritten by the statement that expired the BLOB handle\n** or by other independent statements.\n**\n** This routine only works on a [BLOB handle] which has been created\n** by a prior successful call to [sqlite3_blob_open()] and which has not\n** been closed by [sqlite3_blob_close()].  Passing any other pointer in\n** to this routine results in undefined and probably undesirable behavior.\n**\n** See also: [sqlite3_blob_read()].\n*/\nSQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);\n\n/*\n** CAPI3REF: Virtual File System Objects\n**\n** A virtual filesystem (VFS) is an [sqlite3_vfs] object\n** that SQLite uses to interact\n** with the underlying operating system.  Most SQLite builds come with a\n** single default VFS that is appropriate for the host computer.\n** New VFSes can be registered and existing VFSes can be unregistered.\n** The following interfaces are provided.\n**\n** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.\n** ^Names are case sensitive.\n** ^Names are zero-terminated UTF-8 strings.\n** ^If there is no match, a NULL pointer is returned.\n** ^If zVfsName is NULL then the default VFS is returned.\n**\n** ^New VFSes are registered with sqlite3_vfs_register().\n** ^Each new VFS becomes the default VFS if the makeDflt flag is set.\n** ^The same VFS can be registered multiple times without injury.\n** ^To make an existing VFS into the default VFS, register it again\n** with the makeDflt flag set.  If two different VFSes with the\n** same name are registered, the behavior is undefined.  If a\n** VFS is registered with a name that is NULL or an empty string,\n** then the behavior is undefined.\n**\n** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.\n** ^(If the default VFS is unregistered, another VFS is chosen as\n** the default.  The choice for the new VFS is arbitrary.)^\n*/\nSQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);\nSQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);\nSQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);\n\n/*\n** CAPI3REF: Mutexes\n**\n** The SQLite core uses these routines for thread\n** synchronization. Though they are intended for internal\n** use by SQLite, code that links against SQLite is\n** permitted to use any of these routines.\n**\n** The SQLite source code contains multiple implementations\n** of these mutex routines.  An appropriate implementation\n** is selected automatically at compile-time.  The following\n** implementations are available in the SQLite core:\n**\n** <ul>\n** <li>   SQLITE_MUTEX_PTHREADS\n** <li>   SQLITE_MUTEX_W32\n** <li>   SQLITE_MUTEX_NOOP\n** </ul>\n**\n** The SQLITE_MUTEX_NOOP implementation is a set of routines\n** that does no real locking and is appropriate for use in\n** a single-threaded application.  The SQLITE_MUTEX_PTHREADS and\n** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix\n** and Windows.\n**\n** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor\n** macro defined (with \"-DSQLITE_MUTEX_APPDEF=1\"), then no mutex\n** implementation is included with the library. In this case the\n** application must supply a custom mutex implementation using the\n** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function\n** before calling sqlite3_initialize() or any other public sqlite3_\n** function that calls sqlite3_initialize().\n**\n** ^The sqlite3_mutex_alloc() routine allocates a new\n** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()\n** routine returns NULL if it is unable to allocate the requested\n** mutex.  The argument to sqlite3_mutex_alloc() must one of these\n** integer constants:\n**\n** <ul>\n** <li>  SQLITE_MUTEX_FAST\n** <li>  SQLITE_MUTEX_RECURSIVE\n** <li>  SQLITE_MUTEX_STATIC_MASTER\n** <li>  SQLITE_MUTEX_STATIC_MEM\n** <li>  SQLITE_MUTEX_STATIC_OPEN\n** <li>  SQLITE_MUTEX_STATIC_PRNG\n** <li>  SQLITE_MUTEX_STATIC_LRU\n** <li>  SQLITE_MUTEX_STATIC_PMEM\n** <li>  SQLITE_MUTEX_STATIC_APP1\n** <li>  SQLITE_MUTEX_STATIC_APP2\n** <li>  SQLITE_MUTEX_STATIC_APP3\n** <li>  SQLITE_MUTEX_STATIC_VFS1\n** <li>  SQLITE_MUTEX_STATIC_VFS2\n** <li>  SQLITE_MUTEX_STATIC_VFS3\n** </ul>\n**\n** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)\n** cause sqlite3_mutex_alloc() to create\n** a new mutex.  ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE\n** is used but not necessarily so when SQLITE_MUTEX_FAST is used.\n** The mutex implementation does not need to make a distinction\n** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does\n** not want to.  SQLite will only request a recursive mutex in\n** cases where it really needs one.  If a faster non-recursive mutex\n** implementation is available on the host platform, the mutex subsystem\n** might return such a mutex in response to SQLITE_MUTEX_FAST.\n**\n** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other\n** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return\n** a pointer to a static preexisting mutex.  ^Nine static mutexes are\n** used by the current version of SQLite.  Future versions of SQLite\n** may add additional static mutexes.  Static mutexes are for internal\n** use by SQLite only.  Applications that use SQLite mutexes should\n** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or\n** SQLITE_MUTEX_RECURSIVE.\n**\n** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST\n** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()\n** returns a different mutex on every call.  ^For the static\n** mutex types, the same mutex is returned on every call that has\n** the same type number.\n**\n** ^The sqlite3_mutex_free() routine deallocates a previously\n** allocated dynamic mutex.  Attempting to deallocate a static\n** mutex results in undefined behavior.\n**\n** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\n** to enter a mutex.  ^If another thread is already within the mutex,\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\n** SQLITE_BUSY.  ^The sqlite3_mutex_try() interface returns [SQLITE_OK]\n** upon successful entry.  ^(Mutexes created using\n** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.\n** In such cases, the\n** mutex must be exited an equal number of times before another thread\n** can enter.)^  If the same thread tries to enter any mutex other\n** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.\n**\n** ^(Some systems (for example, Windows 95) do not support the operation\n** implemented by sqlite3_mutex_try().  On those systems, sqlite3_mutex_try()\n** will always return SQLITE_BUSY. The SQLite core only ever uses\n** sqlite3_mutex_try() as an optimization so this is acceptable \n** behavior.)^\n**\n** ^The sqlite3_mutex_leave() routine exits a mutex that was\n** previously entered by the same thread.   The behavior\n** is undefined if the mutex is not currently entered by the\n** calling thread or is not currently allocated.\n**\n** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or\n** sqlite3_mutex_leave() is a NULL pointer, then all three routines\n** behave as no-ops.\n**\n** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].\n*/\nSQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);\nSQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);\nSQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);\nSQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);\nSQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);\n\n/*\n** CAPI3REF: Mutex Methods Object\n**\n** An instance of this structure defines the low-level routines\n** used to allocate and use mutexes.\n**\n** Usually, the default mutex implementations provided by SQLite are\n** sufficient, however the application has the option of substituting a custom\n** implementation for specialized deployments or systems for which SQLite\n** does not provide a suitable implementation. In this case, the application\n** creates and populates an instance of this structure to pass\n** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.\n** Additionally, an instance of this structure can be used as an\n** output variable when querying the system for the current mutex\n** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.\n**\n** ^The xMutexInit method defined by this structure is invoked as\n** part of system initialization by the sqlite3_initialize() function.\n** ^The xMutexInit routine is called by SQLite exactly once for each\n** effective call to [sqlite3_initialize()].\n**\n** ^The xMutexEnd method defined by this structure is invoked as\n** part of system shutdown by the sqlite3_shutdown() function. The\n** implementation of this method is expected to release all outstanding\n** resources obtained by the mutex methods implementation, especially\n** those obtained by the xMutexInit method.  ^The xMutexEnd()\n** interface is invoked exactly once for each call to [sqlite3_shutdown()].\n**\n** ^(The remaining seven methods defined by this structure (xMutexAlloc,\n** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and\n** xMutexNotheld) implement the following interfaces (respectively):\n**\n** <ul>\n**   <li>  [sqlite3_mutex_alloc()] </li>\n**   <li>  [sqlite3_mutex_free()] </li>\n**   <li>  [sqlite3_mutex_enter()] </li>\n**   <li>  [sqlite3_mutex_try()] </li>\n**   <li>  [sqlite3_mutex_leave()] </li>\n**   <li>  [sqlite3_mutex_held()] </li>\n**   <li>  [sqlite3_mutex_notheld()] </li>\n** </ul>)^\n**\n** The only difference is that the public sqlite3_XXX functions enumerated\n** above silently ignore any invocations that pass a NULL pointer instead\n** of a valid mutex handle. The implementations of the methods defined\n** by this structure are not required to handle this case, the results\n** of passing a NULL pointer instead of a valid mutex handle are undefined\n** (i.e. it is acceptable to provide an implementation that segfaults if\n** it is passed a NULL pointer).\n**\n** The xMutexInit() method must be threadsafe.  It must be harmless to\n** invoke xMutexInit() multiple times within the same process and without\n** intervening calls to xMutexEnd().  Second and subsequent calls to\n** xMutexInit() must be no-ops.\n**\n** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]\n** and its associates).  Similarly, xMutexAlloc() must not use SQLite memory\n** allocation for a static mutex.  ^However xMutexAlloc() may use SQLite\n** memory allocation for a fast or recursive mutex.\n**\n** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is\n** called, but only if the prior call to xMutexInit returned SQLITE_OK.\n** If xMutexInit fails in any way, it is expected to clean up after itself\n** prior to returning.\n*/\ntypedef struct sqlite3_mutex_methods sqlite3_mutex_methods;\nstruct sqlite3_mutex_methods {\n  int (*xMutexInit)(void);\n  int (*xMutexEnd)(void);\n  sqlite3_mutex *(*xMutexAlloc)(int);\n  void (*xMutexFree)(sqlite3_mutex *);\n  void (*xMutexEnter)(sqlite3_mutex *);\n  int (*xMutexTry)(sqlite3_mutex *);\n  void (*xMutexLeave)(sqlite3_mutex *);\n  int (*xMutexHeld)(sqlite3_mutex *);\n  int (*xMutexNotheld)(sqlite3_mutex *);\n};\n\n/*\n** CAPI3REF: Mutex Verification Routines\n**\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines\n** are intended for use inside assert() statements.  The SQLite core\n** never uses these routines except inside an assert() and applications\n** are advised to follow the lead of the core.  The SQLite core only\n** provides implementations for these routines when it is compiled\n** with the SQLITE_DEBUG flag.  External mutex implementations\n** are only required to provide these routines if SQLITE_DEBUG is\n** defined and if NDEBUG is not defined.\n**\n** These routines should return true if the mutex in their argument\n** is held or not held, respectively, by the calling thread.\n**\n** The implementation is not required to provide versions of these\n** routines that actually work. If the implementation does not provide working\n** versions of these routines, it should at least provide stubs that always\n** return true so that one does not get spurious assertion failures.\n**\n** If the argument to sqlite3_mutex_held() is a NULL pointer then\n** the routine should return 1.   This seems counter-intuitive since\n** clearly the mutex cannot be held if it does not exist.  But\n** the reason the mutex does not exist is because the build is not\n** using mutexes.  And we do not want the assert() containing the\n** call to sqlite3_mutex_held() to fail, so a non-zero return is\n** the appropriate thing to do.  The sqlite3_mutex_notheld()\n** interface should also return 1 when given a NULL pointer.\n*/\n#ifndef NDEBUG\nSQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);\nSQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);\n#endif\n\n/*\n** CAPI3REF: Mutex Types\n**\n** The [sqlite3_mutex_alloc()] interface takes a single argument\n** which is one of these integer constants.\n**\n** The set of static mutexes may change from one SQLite release to the\n** next.  Applications that override the built-in mutex logic must be\n** prepared to accommodate additional static mutexes.\n*/\n#define SQLITE_MUTEX_FAST             0\n#define SQLITE_MUTEX_RECURSIVE        1\n#define SQLITE_MUTEX_STATIC_MASTER    2\n#define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */\n#define SQLITE_MUTEX_STATIC_MEM2      4  /* NOT USED */\n#define SQLITE_MUTEX_STATIC_OPEN      4  /* sqlite3BtreeOpen() */\n#define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_randomness() */\n#define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */\n#define SQLITE_MUTEX_STATIC_LRU2      7  /* NOT USED */\n#define SQLITE_MUTEX_STATIC_PMEM      7  /* sqlite3PageMalloc() */\n#define SQLITE_MUTEX_STATIC_APP1      8  /* For use by application */\n#define SQLITE_MUTEX_STATIC_APP2      9  /* For use by application */\n#define SQLITE_MUTEX_STATIC_APP3     10  /* For use by application */\n#define SQLITE_MUTEX_STATIC_VFS1     11  /* For use by built-in VFS */\n#define SQLITE_MUTEX_STATIC_VFS2     12  /* For use by extension VFS */\n#define SQLITE_MUTEX_STATIC_VFS3     13  /* For use by application VFS */\n\n/*\n** CAPI3REF: Retrieve the mutex for a database connection\n** METHOD: sqlite3\n**\n** ^This interface returns a pointer the [sqlite3_mutex] object that \n** serializes access to the [database connection] given in the argument\n** when the [threading mode] is Serialized.\n** ^If the [threading mode] is Single-thread or Multi-thread then this\n** routine returns a NULL pointer.\n*/\nSQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);\n\n/*\n** CAPI3REF: Low-Level Control Of Database Files\n** METHOD: sqlite3\n**\n** ^The [sqlite3_file_control()] interface makes a direct call to the\n** xFileControl method for the [sqlite3_io_methods] object associated\n** with a particular database identified by the second argument. ^The\n** name of the database is \"main\" for the main database or \"temp\" for the\n** TEMP database, or the name that appears after the AS keyword for\n** databases that are added using the [ATTACH] SQL command.\n** ^A NULL pointer can be used in place of \"main\" to refer to the\n** main database file.\n** ^The third and fourth parameters to this routine\n** are passed directly through to the second and third parameters of\n** the xFileControl method.  ^The return value of the xFileControl\n** method becomes the return value of this routine.\n**\n** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes\n** a pointer to the underlying [sqlite3_file] object to be written into\n** the space pointed to by the 4th parameter.  ^The SQLITE_FCNTL_FILE_POINTER\n** case is a short-circuit path which does not actually invoke the\n** underlying sqlite3_io_methods.xFileControl method.\n**\n** ^If the second parameter (zDbName) does not match the name of any\n** open database file, then SQLITE_ERROR is returned.  ^This error\n** code is not remembered and will not be recalled by [sqlite3_errcode()]\n** or [sqlite3_errmsg()].  The underlying xFileControl method might\n** also return SQLITE_ERROR.  There is no way to distinguish between\n** an incorrect zDbName and an SQLITE_ERROR return from the underlying\n** xFileControl method.\n**\n** See also: [SQLITE_FCNTL_LOCKSTATE]\n*/\nSQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);\n\n/*\n** CAPI3REF: Testing Interface\n**\n** ^The sqlite3_test_control() interface is used to read out internal\n** state of SQLite and to inject faults into SQLite for testing\n** purposes.  ^The first parameter is an operation code that determines\n** the number, meaning, and operation of all subsequent parameters.\n**\n** This interface is not for use by applications.  It exists solely\n** for verifying the correct operation of the SQLite library.  Depending\n** on how the SQLite library is compiled, this interface might not exist.\n**\n** The details of the operation codes, their meanings, the parameters\n** they take, and what they do are all subject to change without notice.\n** Unlike most of the SQLite API, this function is not guaranteed to\n** operate consistently from one release to the next.\n*/\nSQLITE_API int sqlite3_test_control(int op, ...);\n\n/*\n** CAPI3REF: Testing Interface Operation Codes\n**\n** These constants are the valid operation code parameters used\n** as the first argument to [sqlite3_test_control()].\n**\n** These parameters and their meanings are subject to change\n** without notice.  These values are for testing purposes only.\n** Applications should not use any of these parameters or the\n** [sqlite3_test_control()] interface.\n*/\n#define SQLITE_TESTCTRL_FIRST                    5\n#define SQLITE_TESTCTRL_PRNG_SAVE                5\n#define SQLITE_TESTCTRL_PRNG_RESTORE             6\n#define SQLITE_TESTCTRL_PRNG_RESET               7\n#define SQLITE_TESTCTRL_BITVEC_TEST              8\n#define SQLITE_TESTCTRL_FAULT_INSTALL            9\n#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10\n#define SQLITE_TESTCTRL_PENDING_BYTE            11\n#define SQLITE_TESTCTRL_ASSERT                  12\n#define SQLITE_TESTCTRL_ALWAYS                  13\n#define SQLITE_TESTCTRL_RESERVE                 14\n#define SQLITE_TESTCTRL_OPTIMIZATIONS           15\n#define SQLITE_TESTCTRL_ISKEYWORD               16\n#define SQLITE_TESTCTRL_SCRATCHMALLOC           17\n#define SQLITE_TESTCTRL_LOCALTIME_FAULT         18\n#define SQLITE_TESTCTRL_EXPLAIN_STMT            19  /* NOT USED */\n#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD    19\n#define SQLITE_TESTCTRL_NEVER_CORRUPT           20\n#define SQLITE_TESTCTRL_VDBE_COVERAGE           21\n#define SQLITE_TESTCTRL_BYTEORDER               22\n#define SQLITE_TESTCTRL_ISINIT                  23\n#define SQLITE_TESTCTRL_SORTER_MMAP             24\n#define SQLITE_TESTCTRL_IMPOSTER                25\n#define SQLITE_TESTCTRL_LAST                    25\n\n/*\n** CAPI3REF: SQLite Runtime Status\n**\n** ^These interfaces are used to retrieve runtime status information\n** about the performance of SQLite, and optionally to reset various\n** highwater marks.  ^The first argument is an integer code for\n** the specific parameter to measure.  ^(Recognized integer codes\n** are of the form [status parameters | SQLITE_STATUS_...].)^\n** ^The current value of the parameter is returned into *pCurrent.\n** ^The highest recorded value is returned in *pHighwater.  ^If the\n** resetFlag is true, then the highest record value is reset after\n** *pHighwater is written.  ^(Some parameters do not record the highest\n** value.  For those parameters\n** nothing is written into *pHighwater and the resetFlag is ignored.)^\n** ^(Other parameters record only the highwater mark and not the current\n** value.  For these latter parameters nothing is written into *pCurrent.)^\n**\n** ^The sqlite3_status() and sqlite3_status64() routines return\n** SQLITE_OK on success and a non-zero [error code] on failure.\n**\n** If either the current value or the highwater mark is too large to\n** be represented by a 32-bit integer, then the values returned by\n** sqlite3_status() are undefined.\n**\n** See also: [sqlite3_db_status()]\n*/\nSQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);\nSQLITE_API int sqlite3_status64(\n  int op,\n  sqlite3_int64 *pCurrent,\n  sqlite3_int64 *pHighwater,\n  int resetFlag\n);\n\n\n/*\n** CAPI3REF: Status Parameters\n** KEYWORDS: {status parameters}\n**\n** These integer constants designate various run-time status parameters\n** that can be returned by [sqlite3_status()].\n**\n** <dl>\n** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>\n** <dd>This parameter is the current amount of memory checked out\n** using [sqlite3_malloc()], either directly or indirectly.  The\n** figure includes calls made to [sqlite3_malloc()] by the application\n** and internal memory usage by the SQLite library.  Scratch memory\n** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache\n** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in\n** this parameter.  The amount returned is the sum of the allocation\n** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^\n**\n** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>\n** <dd>This parameter records the largest memory allocation request\n** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their\n** internal equivalents).  Only the value returned in the\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \n** The value written into the *pCurrent parameter is undefined.</dd>)^\n**\n** [[SQLITE_STATUS_MALLOC_COUNT]] ^(<dt>SQLITE_STATUS_MALLOC_COUNT</dt>\n** <dd>This parameter records the number of separate memory allocations\n** currently checked out.</dd>)^\n**\n** [[SQLITE_STATUS_PAGECACHE_USED]] ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>\n** <dd>This parameter returns the number of pages used out of the\n** [pagecache memory allocator] that was configured using \n** [SQLITE_CONFIG_PAGECACHE].  The\n** value returned is in pages, not in bytes.</dd>)^\n**\n** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] \n** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>\n** <dd>This parameter returns the number of bytes of page cache\n** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]\n** buffer and where forced to overflow to [sqlite3_malloc()].  The\n** returned value includes allocations that overflowed because they\n** where too large (they were larger than the \"sz\" parameter to\n** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because\n** no space was left in the page cache.</dd>)^\n**\n** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>\n** <dd>This parameter records the largest memory allocation request\n** handed to [pagecache memory allocator].  Only the value returned in the\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \n** The value written into the *pCurrent parameter is undefined.</dd>)^\n**\n** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>\n** <dd>This parameter returns the number of allocations used out of the\n** [scratch memory allocator] configured using\n** [SQLITE_CONFIG_SCRATCH].  The value returned is in allocations, not\n** in bytes.  Since a single thread may only have one scratch allocation\n** outstanding at time, this parameter also reports the number of threads\n** using scratch memory at the same time.</dd>)^\n**\n** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>\n** <dd>This parameter returns the number of bytes of scratch memory\n** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]\n** buffer and where forced to overflow to [sqlite3_malloc()].  The values\n** returned include overflows because the requested allocation was too\n** larger (that is, because the requested allocation was larger than the\n** \"sz\" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer\n** slots were available.\n** </dd>)^\n**\n** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>\n** <dd>This parameter records the largest memory allocation request\n** handed to [scratch memory allocator].  Only the value returned in the\n** *pHighwater parameter to [sqlite3_status()] is of interest.  \n** The value written into the *pCurrent parameter is undefined.</dd>)^\n**\n** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>\n** <dd>The *pHighwater parameter records the deepest parser stack. \n** The *pCurrent value is undefined.  The *pHighwater value is only\n** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^\n** </dl>\n**\n** New status parameters may be added from time to time.\n*/\n#define SQLITE_STATUS_MEMORY_USED          0\n#define SQLITE_STATUS_PAGECACHE_USED       1\n#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2\n#define SQLITE_STATUS_SCRATCH_USED         3\n#define SQLITE_STATUS_SCRATCH_OVERFLOW     4\n#define SQLITE_STATUS_MALLOC_SIZE          5\n#define SQLITE_STATUS_PARSER_STACK         6\n#define SQLITE_STATUS_PAGECACHE_SIZE       7\n#define SQLITE_STATUS_SCRATCH_SIZE         8\n#define SQLITE_STATUS_MALLOC_COUNT         9\n\n/*\n** CAPI3REF: Database Connection Status\n** METHOD: sqlite3\n**\n** ^This interface is used to retrieve runtime status information \n** about a single [database connection].  ^The first argument is the\n** database connection object to be interrogated.  ^The second argument\n** is an integer constant, taken from the set of\n** [SQLITE_DBSTATUS options], that\n** determines the parameter to interrogate.  The set of \n** [SQLITE_DBSTATUS options] is likely\n** to grow in future releases of SQLite.\n**\n** ^The current value of the requested parameter is written into *pCur\n** and the highest instantaneous value is written into *pHiwtr.  ^If\n** the resetFlg is true, then the highest instantaneous value is\n** reset back down to the current value.\n**\n** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a\n** non-zero [error code] on failure.\n**\n** See also: [sqlite3_status()] and [sqlite3_stmt_status()].\n*/\nSQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);\n\n/*\n** CAPI3REF: Status Parameters for database connections\n** KEYWORDS: {SQLITE_DBSTATUS options}\n**\n** These constants are the available integer \"verbs\" that can be passed as\n** the second argument to the [sqlite3_db_status()] interface.\n**\n** New verbs may be added in future releases of SQLite. Existing verbs\n** might be discontinued. Applications should check the return code from\n** [sqlite3_db_status()] to make sure that the call worked.\n** The [sqlite3_db_status()] interface will return a non-zero error code\n** if a discontinued or unsupported verb is invoked.\n**\n** <dl>\n** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>\n** <dd>This parameter returns the number of lookaside memory slots currently\n** checked out.</dd>)^\n**\n** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>\n** <dd>This parameter returns the number malloc attempts that were \n** satisfied using lookaside memory. Only the high-water value is meaningful;\n** the current value is always zero.)^\n**\n** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]\n** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>\n** <dd>This parameter returns the number malloc attempts that might have\n** been satisfied using lookaside memory but failed due to the amount of\n** memory requested being larger than the lookaside slot size.\n** Only the high-water value is meaningful;\n** the current value is always zero.)^\n**\n** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]\n** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>\n** <dd>This parameter returns the number malloc attempts that might have\n** been satisfied using lookaside memory but failed due to all lookaside\n** memory already being in use.\n** Only the high-water value is meaningful;\n** the current value is always zero.)^\n**\n** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>\n** <dd>This parameter returns the approximate number of bytes of heap\n** memory used by all pager caches associated with the database connection.)^\n** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.\n**\n** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]] \n** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>\n** <dd>This parameter is similar to DBSTATUS_CACHE_USED, except that if a\n** pager cache is shared between two or more connections the bytes of heap\n** memory used by that pager cache is divided evenly between the attached\n** connections.)^  In other words, if none of the pager caches associated\n** with the database connection are shared, this request returns the same\n** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are\n** shared, the value returned by this call will be smaller than that returned\n** by DBSTATUS_CACHE_USED. ^The highwater mark associated with\n** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.\n**\n** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>\n** <dd>This parameter returns the approximate number of bytes of heap\n** memory used to store the schema for all databases associated\n** with the connection - main, temp, and any [ATTACH]-ed databases.)^ \n** ^The full amount of memory used by the schemas is reported, even if the\n** schema memory is shared with other database connections due to\n** [shared cache mode] being enabled.\n** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.\n**\n** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>\n** <dd>This parameter returns the approximate number of bytes of heap\n** and lookaside memory used by all prepared statements associated with\n** the database connection.)^\n** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.\n** </dd>\n**\n** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(<dt>SQLITE_DBSTATUS_CACHE_HIT</dt>\n** <dd>This parameter returns the number of pager cache hits that have\n** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT \n** is always 0.\n** </dd>\n**\n** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>\n** <dd>This parameter returns the number of pager cache misses that have\n** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS \n** is always 0.\n** </dd>\n**\n** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(<dt>SQLITE_DBSTATUS_CACHE_WRITE</dt>\n** <dd>This parameter returns the number of dirty cache entries that have\n** been written to disk. Specifically, the number of pages written to the\n** wal file in wal mode databases, or the number of pages written to the\n** database file in rollback mode databases. Any pages written as part of\n** transaction rollback or database recovery operations are not included.\n** If an IO or other error occurs while writing a page to disk, the effect\n** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The\n** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.\n** </dd>\n**\n** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>\n** <dd>This parameter returns zero for the current value if and only if\n** all foreign key constraints (deferred or immediate) have been\n** resolved.)^  ^The highwater mark is always 0.\n** </dd>\n** </dl>\n*/\n#define SQLITE_DBSTATUS_LOOKASIDE_USED       0\n#define SQLITE_DBSTATUS_CACHE_USED           1\n#define SQLITE_DBSTATUS_SCHEMA_USED          2\n#define SQLITE_DBSTATUS_STMT_USED            3\n#define SQLITE_DBSTATUS_LOOKASIDE_HIT        4\n#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE  5\n#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL  6\n#define SQLITE_DBSTATUS_CACHE_HIT            7\n#define SQLITE_DBSTATUS_CACHE_MISS           8\n#define SQLITE_DBSTATUS_CACHE_WRITE          9\n#define SQLITE_DBSTATUS_DEFERRED_FKS        10\n#define SQLITE_DBSTATUS_CACHE_USED_SHARED   11\n#define SQLITE_DBSTATUS_MAX                 11   /* Largest defined DBSTATUS */\n\n\n/*\n** CAPI3REF: Prepared Statement Status\n** METHOD: sqlite3_stmt\n**\n** ^(Each prepared statement maintains various\n** [SQLITE_STMTSTATUS counters] that measure the number\n** of times it has performed specific operations.)^  These counters can\n** be used to monitor the performance characteristics of the prepared\n** statements.  For example, if the number of table steps greatly exceeds\n** the number of table searches or result rows, that would tend to indicate\n** that the prepared statement is using a full table scan rather than\n** an index.  \n**\n** ^(This interface is used to retrieve and reset counter values from\n** a [prepared statement].  The first argument is the prepared statement\n** object to be interrogated.  The second argument\n** is an integer code for a specific [SQLITE_STMTSTATUS counter]\n** to be interrogated.)^\n** ^The current value of the requested counter is returned.\n** ^If the resetFlg is true, then the counter is reset to zero after this\n** interface call returns.\n**\n** See also: [sqlite3_status()] and [sqlite3_db_status()].\n*/\nSQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);\n\n/*\n** CAPI3REF: Status Parameters for prepared statements\n** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}\n**\n** These preprocessor macros define integer codes that name counter\n** values associated with the [sqlite3_stmt_status()] interface.\n** The meanings of the various counters are as follows:\n**\n** <dl>\n** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]] <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>\n** <dd>^This is the number of times that SQLite has stepped forward in\n** a table as part of a full table scan.  Large numbers for this counter\n** may indicate opportunities for performance improvement through \n** careful use of indices.</dd>\n**\n** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>\n** <dd>^This is the number of sort operations that have occurred.\n** A non-zero value in this counter may indicate an opportunity to\n** improvement performance through careful use of indices.</dd>\n**\n** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>\n** <dd>^This is the number of rows inserted into transient indices that\n** were created automatically in order to help joins run faster.\n** A non-zero value in this counter may indicate an opportunity to\n** improvement performance by adding permanent indices that do not\n** need to be reinitialized each time the statement is run.</dd>\n**\n** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>\n** <dd>^This is the number of virtual machine operations executed\n** by the prepared statement if that number is less than or equal\n** to 2147483647.  The number of virtual machine operations can be \n** used as a proxy for the total work done by the prepared statement.\n** If the number of virtual machine operations exceeds 2147483647\n** then the value returned by this statement status code is undefined.\n** </dd>\n** </dl>\n*/\n#define SQLITE_STMTSTATUS_FULLSCAN_STEP     1\n#define SQLITE_STMTSTATUS_SORT              2\n#define SQLITE_STMTSTATUS_AUTOINDEX         3\n#define SQLITE_STMTSTATUS_VM_STEP           4\n\n/*\n** CAPI3REF: Custom Page Cache Object\n**\n** The sqlite3_pcache type is opaque.  It is implemented by\n** the pluggable module.  The SQLite core has no knowledge of\n** its size or internal structure and never deals with the\n** sqlite3_pcache object except by holding and passing pointers\n** to the object.\n**\n** See [sqlite3_pcache_methods2] for additional information.\n*/\ntypedef struct sqlite3_pcache sqlite3_pcache;\n\n/*\n** CAPI3REF: Custom Page Cache Object\n**\n** The sqlite3_pcache_page object represents a single page in the\n** page cache.  The page cache will allocate instances of this\n** object.  Various methods of the page cache use pointers to instances\n** of this object as parameters or as their return value.\n**\n** See [sqlite3_pcache_methods2] for additional information.\n*/\ntypedef struct sqlite3_pcache_page sqlite3_pcache_page;\nstruct sqlite3_pcache_page {\n  void *pBuf;        /* The content of the page */\n  void *pExtra;      /* Extra information associated with the page */\n};\n\n/*\n** CAPI3REF: Application Defined Page Cache.\n** KEYWORDS: {page cache}\n**\n** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can\n** register an alternative page cache implementation by passing in an \n** instance of the sqlite3_pcache_methods2 structure.)^\n** In many applications, most of the heap memory allocated by \n** SQLite is used for the page cache.\n** By implementing a \n** custom page cache using this API, an application can better control\n** the amount of memory consumed by SQLite, the way in which \n** that memory is allocated and released, and the policies used to \n** determine exactly which parts of a database file are cached and for \n** how long.\n**\n** The alternative page cache mechanism is an\n** extreme measure that is only needed by the most demanding applications.\n** The built-in page cache is recommended for most uses.\n**\n** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an\n** internal buffer by SQLite within the call to [sqlite3_config].  Hence\n** the application may discard the parameter after the call to\n** [sqlite3_config()] returns.)^\n**\n** [[the xInit() page cache method]]\n** ^(The xInit() method is called once for each effective \n** call to [sqlite3_initialize()])^\n** (usually only once during the lifetime of the process). ^(The xInit()\n** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^\n** The intent of the xInit() method is to set up global data structures \n** required by the custom page cache implementation. \n** ^(If the xInit() method is NULL, then the \n** built-in default page cache is used instead of the application defined\n** page cache.)^\n**\n** [[the xShutdown() page cache method]]\n** ^The xShutdown() method is called by [sqlite3_shutdown()].\n** It can be used to clean up \n** any outstanding resources before process shutdown, if required.\n** ^The xShutdown() method may be NULL.\n**\n** ^SQLite automatically serializes calls to the xInit method,\n** so the xInit method need not be threadsafe.  ^The\n** xShutdown method is only called from [sqlite3_shutdown()] so it does\n** not need to be threadsafe either.  All other methods must be threadsafe\n** in multithreaded applications.\n**\n** ^SQLite will never invoke xInit() more than once without an intervening\n** call to xShutdown().\n**\n** [[the xCreate() page cache methods]]\n** ^SQLite invokes the xCreate() method to construct a new cache instance.\n** SQLite will typically create one cache instance for each open database file,\n** though this is not guaranteed. ^The\n** first parameter, szPage, is the size in bytes of the pages that must\n** be allocated by the cache.  ^szPage will always a power of two.  ^The\n** second parameter szExtra is a number of bytes of extra storage \n** associated with each page cache entry.  ^The szExtra parameter will\n** a number less than 250.  SQLite will use the\n** extra szExtra bytes on each page to store metadata about the underlying\n** database page on disk.  The value passed into szExtra depends\n** on the SQLite version, the target platform, and how SQLite was compiled.\n** ^The third argument to xCreate(), bPurgeable, is true if the cache being\n** created will be used to cache database pages of a file stored on disk, or\n** false if it is used for an in-memory database. The cache implementation\n** does not have to do anything special based with the value of bPurgeable;\n** it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will\n** never invoke xUnpin() except to deliberately delete a page.\n** ^In other words, calls to xUnpin() on a cache with bPurgeable set to\n** false will always have the \"discard\" flag set to true.  \n** ^Hence, a cache created with bPurgeable false will\n** never contain any unpinned pages.\n**\n** [[the xCachesize() page cache method]]\n** ^(The xCachesize() method may be called at any time by SQLite to set the\n** suggested maximum cache-size (number of pages stored by) the cache\n** instance passed as the first argument. This is the value configured using\n** the SQLite \"[PRAGMA cache_size]\" command.)^  As with the bPurgeable\n** parameter, the implementation is not required to do anything with this\n** value; it is advisory only.\n**\n** [[the xPagecount() page cache methods]]\n** The xPagecount() method must return the number of pages currently\n** stored in the cache, both pinned and unpinned.\n** \n** [[the xFetch() page cache methods]]\n** The xFetch() method locates a page in the cache and returns a pointer to \n** an sqlite3_pcache_page object associated with that page, or a NULL pointer.\n** The pBuf element of the returned sqlite3_pcache_page object will be a\n** pointer to a buffer of szPage bytes used to store the content of a \n** single database page.  The pExtra element of sqlite3_pcache_page will be\n** a pointer to the szExtra bytes of extra storage that SQLite has requested\n** for each entry in the page cache.\n**\n** The page to be fetched is determined by the key. ^The minimum key value\n** is 1.  After it has been retrieved using xFetch, the page is considered\n** to be \"pinned\".\n**\n** If the requested page is already in the page cache, then the page cache\n** implementation must return a pointer to the page buffer with its content\n** intact.  If the requested page is not already in the cache, then the\n** cache implementation should use the value of the createFlag\n** parameter to help it determined what action to take:\n**\n** <table border=1 width=85% align=center>\n** <tr><th> createFlag <th> Behavior when page is not already in cache\n** <tr><td> 0 <td> Do not allocate a new page.  Return NULL.\n** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.\n**                 Otherwise return NULL.\n** <tr><td> 2 <td> Make every effort to allocate a new page.  Only return\n**                 NULL if allocating a new page is effectively impossible.\n** </table>\n**\n** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite\n** will only use a createFlag of 2 after a prior call with a createFlag of 1\n** failed.)^  In between the to xFetch() calls, SQLite may\n** attempt to unpin one or more cache pages by spilling the content of\n** pinned pages to disk and synching the operating system disk cache.\n**\n** [[the xUnpin() page cache method]]\n** ^xUnpin() is called by SQLite with a pointer to a currently pinned page\n** as its second argument.  If the third parameter, discard, is non-zero,\n** then the page must be evicted from the cache.\n** ^If the discard parameter is\n** zero, then the page may be discarded or retained at the discretion of\n** page cache implementation. ^The page cache implementation\n** may choose to evict unpinned pages at any time.\n**\n** The cache must not perform any reference counting. A single \n** call to xUnpin() unpins the page regardless of the number of prior calls \n** to xFetch().\n**\n** [[the xRekey() page cache methods]]\n** The xRekey() method is used to change the key value associated with the\n** page passed as the second argument. If the cache\n** previously contains an entry associated with newKey, it must be\n** discarded. ^Any prior cache entry associated with newKey is guaranteed not\n** to be pinned.\n**\n** When SQLite calls the xTruncate() method, the cache must discard all\n** existing cache entries with page numbers (keys) greater than or equal\n** to the value of the iLimit parameter passed to xTruncate(). If any\n** of these pages are pinned, they are implicitly unpinned, meaning that\n** they can be safely discarded.\n**\n** [[the xDestroy() page cache method]]\n** ^The xDestroy() method is used to delete a cache allocated by xCreate().\n** All resources associated with the specified cache should be freed. ^After\n** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]\n** handle invalid, and will not use it with any other sqlite3_pcache_methods2\n** functions.\n**\n** [[the xShrink() page cache method]]\n** ^SQLite invokes the xShrink() method when it wants the page cache to\n** free up as much of heap memory as possible.  The page cache implementation\n** is not obligated to free any memory, but well-behaved implementations should\n** do their best.\n*/\ntypedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;\nstruct sqlite3_pcache_methods2 {\n  int iVersion;\n  void *pArg;\n  int (*xInit)(void*);\n  void (*xShutdown)(void*);\n  sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);\n  void (*xCachesize)(sqlite3_pcache*, int nCachesize);\n  int (*xPagecount)(sqlite3_pcache*);\n  sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);\n  void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);\n  void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, \n      unsigned oldKey, unsigned newKey);\n  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);\n  void (*xDestroy)(sqlite3_pcache*);\n  void (*xShrink)(sqlite3_pcache*);\n};\n\n/*\n** This is the obsolete pcache_methods object that has now been replaced\n** by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is\n** retained in the header file for backwards compatibility only.\n*/\ntypedef struct sqlite3_pcache_methods sqlite3_pcache_methods;\nstruct sqlite3_pcache_methods {\n  void *pArg;\n  int (*xInit)(void*);\n  void (*xShutdown)(void*);\n  sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);\n  void (*xCachesize)(sqlite3_pcache*, int nCachesize);\n  int (*xPagecount)(sqlite3_pcache*);\n  void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);\n  void (*xUnpin)(sqlite3_pcache*, void*, int discard);\n  void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);\n  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);\n  void (*xDestroy)(sqlite3_pcache*);\n};\n\n\n/*\n** CAPI3REF: Online Backup Object\n**\n** The sqlite3_backup object records state information about an ongoing\n** online backup operation.  ^The sqlite3_backup object is created by\n** a call to [sqlite3_backup_init()] and is destroyed by a call to\n** [sqlite3_backup_finish()].\n**\n** See Also: [Using the SQLite Online Backup API]\n*/\ntypedef struct sqlite3_backup sqlite3_backup;\n\n/*\n** CAPI3REF: Online Backup API.\n**\n** The backup API copies the content of one database into another.\n** It is useful either for creating backups of databases or\n** for copying in-memory databases to or from persistent files. \n**\n** See Also: [Using the SQLite Online Backup API]\n**\n** ^SQLite holds a write transaction open on the destination database file\n** for the duration of the backup operation.\n** ^The source database is read-locked only while it is being read;\n** it is not locked continuously for the entire backup operation.\n** ^Thus, the backup may be performed on a live source database without\n** preventing other database connections from\n** reading or writing to the source database while the backup is underway.\n** \n** ^(To perform a backup operation: \n**   <ol>\n**     <li><b>sqlite3_backup_init()</b> is called once to initialize the\n**         backup, \n**     <li><b>sqlite3_backup_step()</b> is called one or more times to transfer \n**         the data between the two databases, and finally\n**     <li><b>sqlite3_backup_finish()</b> is called to release all resources \n**         associated with the backup operation. \n**   </ol>)^\n** There should be exactly one call to sqlite3_backup_finish() for each\n** successful call to sqlite3_backup_init().\n**\n** [[sqlite3_backup_init()]] <b>sqlite3_backup_init()</b>\n**\n** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the \n** [database connection] associated with the destination database \n** and the database name, respectively.\n** ^The database name is \"main\" for the main database, \"temp\" for the\n** temporary database, or the name specified after the AS keyword in\n** an [ATTACH] statement for an attached database.\n** ^The S and M arguments passed to \n** sqlite3_backup_init(D,N,S,M) identify the [database connection]\n** and database name of the source database, respectively.\n** ^The source and destination [database connections] (parameters S and D)\n** must be different or else sqlite3_backup_init(D,N,S,M) will fail with\n** an error.\n**\n** ^A call to sqlite3_backup_init() will fail, returning NULL, if \n** there is already a read or read-write transaction open on the \n** destination database.\n**\n** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is\n** returned and an error code and error message are stored in the\n** destination [database connection] D.\n** ^The error code and message for the failed call to sqlite3_backup_init()\n** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or\n** [sqlite3_errmsg16()] functions.\n** ^A successful call to sqlite3_backup_init() returns a pointer to an\n** [sqlite3_backup] object.\n** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and\n** sqlite3_backup_finish() functions to perform the specified backup \n** operation.\n**\n** [[sqlite3_backup_step()]] <b>sqlite3_backup_step()</b>\n**\n** ^Function sqlite3_backup_step(B,N) will copy up to N pages between \n** the source and destination databases specified by [sqlite3_backup] object B.\n** ^If N is negative, all remaining source pages are copied. \n** ^If sqlite3_backup_step(B,N) successfully copies N pages and there\n** are still more pages to be copied, then the function returns [SQLITE_OK].\n** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages\n** from source to destination, then it returns [SQLITE_DONE].\n** ^If an error occurs while running sqlite3_backup_step(B,N),\n** then an [error code] is returned. ^As well as [SQLITE_OK] and\n** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],\n** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an\n** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.\n**\n** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if\n** <ol>\n** <li> the destination database was opened read-only, or\n** <li> the destination database is using write-ahead-log journaling\n** and the destination and source page sizes differ, or\n** <li> the destination database is an in-memory database and the\n** destination and source page sizes differ.\n** </ol>)^\n**\n** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then\n** the [sqlite3_busy_handler | busy-handler function]\n** is invoked (if one is specified). ^If the \n** busy-handler returns non-zero before the lock is available, then \n** [SQLITE_BUSY] is returned to the caller. ^In this case the call to\n** sqlite3_backup_step() can be retried later. ^If the source\n** [database connection]\n** is being used to write to the source database when sqlite3_backup_step()\n** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this\n** case the call to sqlite3_backup_step() can be retried later on. ^(If\n** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or\n** [SQLITE_READONLY] is returned, then \n** there is no point in retrying the call to sqlite3_backup_step(). These \n** errors are considered fatal.)^  The application must accept \n** that the backup operation has failed and pass the backup operation handle \n** to the sqlite3_backup_finish() to release associated resources.\n**\n** ^The first call to sqlite3_backup_step() obtains an exclusive lock\n** on the destination file. ^The exclusive lock is not released until either \n** sqlite3_backup_finish() is called or the backup operation is complete \n** and sqlite3_backup_step() returns [SQLITE_DONE].  ^Every call to\n** sqlite3_backup_step() obtains a [shared lock] on the source database that\n** lasts for the duration of the sqlite3_backup_step() call.\n** ^Because the source database is not locked between calls to\n** sqlite3_backup_step(), the source database may be modified mid-way\n** through the backup process.  ^If the source database is modified by an\n** external process or via a database connection other than the one being\n** used by the backup operation, then the backup will be automatically\n** restarted by the next call to sqlite3_backup_step(). ^If the source \n** database is modified by the using the same database connection as is used\n** by the backup operation, then the backup database is automatically\n** updated at the same time.\n**\n** [[sqlite3_backup_finish()]] <b>sqlite3_backup_finish()</b>\n**\n** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the \n** application wishes to abandon the backup operation, the application\n** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().\n** ^The sqlite3_backup_finish() interfaces releases all\n** resources associated with the [sqlite3_backup] object. \n** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any\n** active write-transaction on the destination database is rolled back.\n** The [sqlite3_backup] object is invalid\n** and may not be used following a call to sqlite3_backup_finish().\n**\n** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no\n** sqlite3_backup_step() errors occurred, regardless or whether or not\n** sqlite3_backup_step() completed.\n** ^If an out-of-memory condition or IO error occurred during any prior\n** sqlite3_backup_step() call on the same [sqlite3_backup] object, then\n** sqlite3_backup_finish() returns the corresponding [error code].\n**\n** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()\n** is not a permanent error and does not affect the return value of\n** sqlite3_backup_finish().\n**\n** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]]\n** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>\n**\n** ^The sqlite3_backup_remaining() routine returns the number of pages still\n** to be backed up at the conclusion of the most recent sqlite3_backup_step().\n** ^The sqlite3_backup_pagecount() routine returns the total number of pages\n** in the source database at the conclusion of the most recent\n** sqlite3_backup_step().\n** ^(The values returned by these functions are only updated by\n** sqlite3_backup_step(). If the source database is modified in a way that\n** changes the size of the source database or the number of pages remaining,\n** those changes are not reflected in the output of sqlite3_backup_pagecount()\n** and sqlite3_backup_remaining() until after the next\n** sqlite3_backup_step().)^\n**\n** <b>Concurrent Usage of Database Handles</b>\n**\n** ^The source [database connection] may be used by the application for other\n** purposes while a backup operation is underway or being initialized.\n** ^If SQLite is compiled and configured to support threadsafe database\n** connections, then the source database connection may be used concurrently\n** from within other threads.\n**\n** However, the application must guarantee that the destination \n** [database connection] is not passed to any other API (by any thread) after \n** sqlite3_backup_init() is called and before the corresponding call to\n** sqlite3_backup_finish().  SQLite does not currently check to see\n** if the application incorrectly accesses the destination [database connection]\n** and so no error code is reported, but the operations may malfunction\n** nevertheless.  Use of the destination database connection while a\n** backup is in progress might also also cause a mutex deadlock.\n**\n** If running in [shared cache mode], the application must\n** guarantee that the shared cache used by the destination database\n** is not accessed while the backup is running. In practice this means\n** that the application must guarantee that the disk file being \n** backed up to is not accessed by any connection within the process,\n** not just the specific connection that was passed to sqlite3_backup_init().\n**\n** The [sqlite3_backup] object itself is partially threadsafe. Multiple \n** threads may safely make multiple concurrent calls to sqlite3_backup_step().\n** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()\n** APIs are not strictly speaking threadsafe. If they are invoked at the\n** same time as another thread is invoking sqlite3_backup_step() it is\n** possible that they return invalid values.\n*/\nSQLITE_API sqlite3_backup *sqlite3_backup_init(\n  sqlite3 *pDest,                        /* Destination database handle */\n  const char *zDestName,                 /* Destination database name */\n  sqlite3 *pSource,                      /* Source database handle */\n  const char *zSourceName                /* Source database name */\n);\nSQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);\nSQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);\nSQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);\nSQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);\n\n/*\n** CAPI3REF: Unlock Notification\n** METHOD: sqlite3\n**\n** ^When running in shared-cache mode, a database operation may fail with\n** an [SQLITE_LOCKED] error if the required locks on the shared-cache or\n** individual tables within the shared-cache cannot be obtained. See\n** [SQLite Shared-Cache Mode] for a description of shared-cache locking. \n** ^This API may be used to register a callback that SQLite will invoke \n** when the connection currently holding the required lock relinquishes it.\n** ^This API is only available if the library was compiled with the\n** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.\n**\n** See Also: [Using the SQLite Unlock Notification Feature].\n**\n** ^Shared-cache locks are released when a database connection concludes\n** its current transaction, either by committing it or rolling it back. \n**\n** ^When a connection (known as the blocked connection) fails to obtain a\n** shared-cache lock and SQLITE_LOCKED is returned to the caller, the\n** identity of the database connection (the blocking connection) that\n** has locked the required resource is stored internally. ^After an \n** application receives an SQLITE_LOCKED error, it may call the\n** sqlite3_unlock_notify() method with the blocked connection handle as \n** the first argument to register for a callback that will be invoked\n** when the blocking connections current transaction is concluded. ^The\n** callback is invoked from within the [sqlite3_step] or [sqlite3_close]\n** call that concludes the blocking connections transaction.\n**\n** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,\n** there is a chance that the blocking connection will have already\n** concluded its transaction by the time sqlite3_unlock_notify() is invoked.\n** If this happens, then the specified callback is invoked immediately,\n** from within the call to sqlite3_unlock_notify().)^\n**\n** ^If the blocked connection is attempting to obtain a write-lock on a\n** shared-cache table, and more than one other connection currently holds\n** a read-lock on the same table, then SQLite arbitrarily selects one of \n** the other connections to use as the blocking connection.\n**\n** ^(There may be at most one unlock-notify callback registered by a \n** blocked connection. If sqlite3_unlock_notify() is called when the\n** blocked connection already has a registered unlock-notify callback,\n** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is\n** called with a NULL pointer as its second argument, then any existing\n** unlock-notify callback is canceled. ^The blocked connections \n** unlock-notify callback may also be canceled by closing the blocked\n** connection using [sqlite3_close()].\n**\n** The unlock-notify callback is not reentrant. If an application invokes\n** any sqlite3_xxx API functions from within an unlock-notify callback, a\n** crash or deadlock may be the result.\n**\n** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always\n** returns SQLITE_OK.\n**\n** <b>Callback Invocation Details</b>\n**\n** When an unlock-notify callback is registered, the application provides a \n** single void* pointer that is passed to the callback when it is invoked.\n** However, the signature of the callback function allows SQLite to pass\n** it an array of void* context pointers. The first argument passed to\n** an unlock-notify callback is a pointer to an array of void* pointers,\n** and the second is the number of entries in the array.\n**\n** When a blocking connections transaction is concluded, there may be\n** more than one blocked connection that has registered for an unlock-notify\n** callback. ^If two or more such blocked connections have specified the\n** same callback function, then instead of invoking the callback function\n** multiple times, it is invoked once with the set of void* context pointers\n** specified by the blocked connections bundled together into an array.\n** This gives the application an opportunity to prioritize any actions \n** related to the set of unblocked database connections.\n**\n** <b>Deadlock Detection</b>\n**\n** Assuming that after registering for an unlock-notify callback a \n** database waits for the callback to be issued before taking any further\n** action (a reasonable assumption), then using this API may cause the\n** application to deadlock. For example, if connection X is waiting for\n** connection Y's transaction to be concluded, and similarly connection\n** Y is waiting on connection X's transaction, then neither connection\n** will proceed and the system may remain deadlocked indefinitely.\n**\n** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock\n** detection. ^If a given call to sqlite3_unlock_notify() would put the\n** system in a deadlocked state, then SQLITE_LOCKED is returned and no\n** unlock-notify callback is registered. The system is said to be in\n** a deadlocked state if connection A has registered for an unlock-notify\n** callback on the conclusion of connection B's transaction, and connection\n** B has itself registered for an unlock-notify callback when connection\n** A's transaction is concluded. ^Indirect deadlock is also detected, so\n** the system is also considered to be deadlocked if connection B has\n** registered for an unlock-notify callback on the conclusion of connection\n** C's transaction, where connection C is waiting on connection A. ^Any\n** number of levels of indirection are allowed.\n**\n** <b>The \"DROP TABLE\" Exception</b>\n**\n** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost \n** always appropriate to call sqlite3_unlock_notify(). There is however,\n** one exception. When executing a \"DROP TABLE\" or \"DROP INDEX\" statement,\n** SQLite checks if there are any currently executing SELECT statements\n** that belong to the same connection. If there are, SQLITE_LOCKED is\n** returned. In this case there is no \"blocking connection\", so invoking\n** sqlite3_unlock_notify() results in the unlock-notify callback being\n** invoked immediately. If the application then re-attempts the \"DROP TABLE\"\n** or \"DROP INDEX\" query, an infinite loop might be the result.\n**\n** One way around this problem is to check the extended error code returned\n** by an sqlite3_step() call. ^(If there is a blocking connection, then the\n** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in\n** the special \"DROP TABLE/INDEX\" case, the extended error code is just \n** SQLITE_LOCKED.)^\n*/\nSQLITE_API int sqlite3_unlock_notify(\n  sqlite3 *pBlocked,                          /* Waiting connection */\n  void (*xNotify)(void **apArg, int nArg),    /* Callback function to invoke */\n  void *pNotifyArg                            /* Argument to pass to xNotify */\n);\n\n\n/*\n** CAPI3REF: String Comparison\n**\n** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications\n** and extensions to compare the contents of two buffers containing UTF-8\n** strings in a case-independent fashion, using the same definition of \"case\n** independence\" that SQLite uses internally when comparing identifiers.\n*/\nSQLITE_API int sqlite3_stricmp(const char *, const char *);\nSQLITE_API int sqlite3_strnicmp(const char *, const char *, int);\n\n/*\n** CAPI3REF: String Globbing\n*\n** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if\n** string X matches the [GLOB] pattern P.\n** ^The definition of [GLOB] pattern matching used in\n** [sqlite3_strglob(P,X)] is the same as for the \"X GLOB P\" operator in the\n** SQL dialect understood by SQLite.  ^The [sqlite3_strglob(P,X)] function\n** is case sensitive.\n**\n** Note that this routine returns zero on a match and non-zero if the strings\n** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].\n**\n** See also: [sqlite3_strlike()].\n*/\nSQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);\n\n/*\n** CAPI3REF: String LIKE Matching\n*\n** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if\n** string X matches the [LIKE] pattern P with escape character E.\n** ^The definition of [LIKE] pattern matching used in\n** [sqlite3_strlike(P,X,E)] is the same as for the \"X LIKE P ESCAPE E\"\n** operator in the SQL dialect understood by SQLite.  ^For \"X LIKE P\" without\n** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0.\n** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case\n** insensitive - equivalent upper and lower case ASCII characters match\n** one another.\n**\n** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though\n** only ASCII characters are case folded.\n**\n** Note that this routine returns zero on a match and non-zero if the strings\n** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].\n**\n** See also: [sqlite3_strglob()].\n*/\nSQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);\n\n/*\n** CAPI3REF: Error Logging Interface\n**\n** ^The [sqlite3_log()] interface writes a message into the [error log]\n** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].\n** ^If logging is enabled, the zFormat string and subsequent arguments are\n** used with [sqlite3_snprintf()] to generate the final output string.\n**\n** The sqlite3_log() interface is intended for use by extensions such as\n** virtual tables, collating functions, and SQL functions.  While there is\n** nothing to prevent an application from calling sqlite3_log(), doing so\n** is considered bad form.\n**\n** The zFormat string must not be NULL.\n**\n** To avoid deadlocks and other threading problems, the sqlite3_log() routine\n** will not use dynamically allocated memory.  The log message is stored in\n** a fixed-length buffer on the stack.  If the log message is longer than\n** a few hundred characters, it will be truncated to the length of the\n** buffer.\n*/\nSQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);\n\n/*\n** CAPI3REF: Write-Ahead Log Commit Hook\n** METHOD: sqlite3\n**\n** ^The [sqlite3_wal_hook()] function is used to register a callback that\n** is invoked each time data is committed to a database in wal mode.\n**\n** ^(The callback is invoked by SQLite after the commit has taken place and \n** the associated write-lock on the database released)^, so the implementation \n** may read, write or [checkpoint] the database as required.\n**\n** ^The first parameter passed to the callback function when it is invoked\n** is a copy of the third parameter passed to sqlite3_wal_hook() when\n** registering the callback. ^The second is a copy of the database handle.\n** ^The third parameter is the name of the database that was written to -\n** either \"main\" or the name of an [ATTACH]-ed database. ^The fourth parameter\n** is the number of pages currently in the write-ahead log file,\n** including those that were just committed.\n**\n** The callback function should normally return [SQLITE_OK].  ^If an error\n** code is returned, that error will propagate back up through the\n** SQLite code base to cause the statement that provoked the callback\n** to report an error, though the commit will have still occurred. If the\n** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value\n** that does not correspond to any valid SQLite error code, the results\n** are undefined.\n**\n** A single database handle may have at most a single write-ahead log callback \n** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any\n** previously registered write-ahead log callback. ^Note that the\n** [sqlite3_wal_autocheckpoint()] interface and the\n** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will\n** overwrite any prior [sqlite3_wal_hook()] settings.\n*/\nSQLITE_API void *sqlite3_wal_hook(\n  sqlite3*, \n  int(*)(void *,sqlite3*,const char*,int),\n  void*\n);\n\n/*\n** CAPI3REF: Configure an auto-checkpoint\n** METHOD: sqlite3\n**\n** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around\n** [sqlite3_wal_hook()] that causes any database on [database connection] D\n** to automatically [checkpoint]\n** after committing a transaction if there are N or\n** more frames in the [write-ahead log] file.  ^Passing zero or \n** a negative value as the nFrame parameter disables automatic\n** checkpoints entirely.\n**\n** ^The callback registered by this function replaces any existing callback\n** registered using [sqlite3_wal_hook()].  ^Likewise, registering a callback\n** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism\n** configured by this function.\n**\n** ^The [wal_autocheckpoint pragma] can be used to invoke this interface\n** from SQL.\n**\n** ^Checkpoints initiated by this mechanism are\n** [sqlite3_wal_checkpoint_v2|PASSIVE].\n**\n** ^Every new [database connection] defaults to having the auto-checkpoint\n** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]\n** pages.  The use of this interface\n** is only necessary if the default setting is found to be suboptimal\n** for a particular application.\n*/\nSQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);\n\n/*\n** CAPI3REF: Checkpoint a database\n** METHOD: sqlite3\n**\n** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to\n** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^\n**\n** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the \n** [write-ahead log] for database X on [database connection] D to be\n** transferred into the database file and for the write-ahead log to\n** be reset.  See the [checkpointing] documentation for addition\n** information.\n**\n** This interface used to be the only way to cause a checkpoint to\n** occur.  But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]\n** interface was added.  This interface is retained for backwards\n** compatibility and as a convenience for applications that need to manually\n** start a callback but which do not need the full power (and corresponding\n** complication) of [sqlite3_wal_checkpoint_v2()].\n*/\nSQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);\n\n/*\n** CAPI3REF: Checkpoint a database\n** METHOD: sqlite3\n**\n** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint\n** operation on database X of [database connection] D in mode M.  Status\n** information is written back into integers pointed to by L and C.)^\n** ^(The M parameter must be a valid [checkpoint mode]:)^\n**\n** <dl>\n** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>\n**   ^Checkpoint as many frames as possible without waiting for any database \n**   readers or writers to finish, then sync the database file if all frames \n**   in the log were checkpointed. ^The [busy-handler callback]\n**   is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.  \n**   ^On the other hand, passive mode might leave the checkpoint unfinished\n**   if there are concurrent readers or writers.\n**\n** <dt>SQLITE_CHECKPOINT_FULL<dd>\n**   ^This mode blocks (it invokes the\n**   [sqlite3_busy_handler|busy-handler callback]) until there is no\n**   database writer and all readers are reading from the most recent database\n**   snapshot. ^It then checkpoints all frames in the log file and syncs the\n**   database file. ^This mode blocks new database writers while it is pending,\n**   but new database readers are allowed to continue unimpeded.\n**\n** <dt>SQLITE_CHECKPOINT_RESTART<dd>\n**   ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition\n**   that after checkpointing the log file it blocks (calls the \n**   [busy-handler callback])\n**   until all readers are reading from the database file only. ^This ensures \n**   that the next writer will restart the log file from the beginning.\n**   ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new\n**   database writer attempts while it is pending, but does not impede readers.\n**\n** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>\n**   ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the\n**   addition that it also truncates the log file to zero bytes just prior\n**   to a successful return.\n** </dl>\n**\n** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in\n** the log file or to -1 if the checkpoint could not run because\n** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not\n** NULL,then *pnCkpt is set to the total number of checkpointed frames in the\n** log file (including any that were already checkpointed before the function\n** was called) or to -1 if the checkpoint could not run due to an error or\n** because the database is not in WAL mode. ^Note that upon successful\n** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been\n** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.\n**\n** ^All calls obtain an exclusive \"checkpoint\" lock on the database file. ^If\n** any other process is running a checkpoint operation at the same time, the \n** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a \n** busy-handler configured, it will not be invoked in this case.\n**\n** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the \n** exclusive \"writer\" lock on the database file. ^If the writer lock cannot be\n** obtained immediately, and a busy-handler is configured, it is invoked and\n** the writer lock retried until either the busy-handler returns 0 or the lock\n** is successfully obtained. ^The busy-handler is also invoked while waiting for\n** database readers as described above. ^If the busy-handler returns 0 before\n** the writer lock is obtained or while waiting for database readers, the\n** checkpoint operation proceeds from that point in the same way as \n** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible \n** without blocking any further. ^SQLITE_BUSY is returned in this case.\n**\n** ^If parameter zDb is NULL or points to a zero length string, then the\n** specified operation is attempted on all WAL databases [attached] to \n** [database connection] db.  In this case the\n** values written to output parameters *pnLog and *pnCkpt are undefined. ^If \n** an SQLITE_BUSY error is encountered when processing one or more of the \n** attached WAL databases, the operation is still attempted on any remaining \n** attached databases and SQLITE_BUSY is returned at the end. ^If any other \n** error occurs while processing an attached database, processing is abandoned \n** and the error code is returned to the caller immediately. ^If no error \n** (SQLITE_BUSY or otherwise) is encountered while processing the attached \n** databases, SQLITE_OK is returned.\n**\n** ^If database zDb is the name of an attached database that is not in WAL\n** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If\n** zDb is not NULL (or a zero length string) and is not the name of any\n** attached database, SQLITE_ERROR is returned to the caller.\n**\n** ^Unless it returns SQLITE_MISUSE,\n** the sqlite3_wal_checkpoint_v2() interface\n** sets the error information that is queried by\n** [sqlite3_errcode()] and [sqlite3_errmsg()].\n**\n** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface\n** from SQL.\n*/\nSQLITE_API int sqlite3_wal_checkpoint_v2(\n  sqlite3 *db,                    /* Database handle */\n  const char *zDb,                /* Name of attached database (or NULL) */\n  int eMode,                      /* SQLITE_CHECKPOINT_* value */\n  int *pnLog,                     /* OUT: Size of WAL log in frames */\n  int *pnCkpt                     /* OUT: Total number of frames checkpointed */\n);\n    \n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\n/*\n** Register a handler when checkpoint will/did happen.\n**\n** When checkpoint will run, this handler will be invoked with parameter -1. Checkpoint will be abort if it returns non-zero result.\n**\n** When checkpoint did run, this handler will be invoked with the result code of the checkpoint routine, which is always greater than or equal to 0. The return value of the handler will be ignored.\n*/\nSQLITE_API int sqlite3_wal_checkpoint_handler(sqlite3*,int(*)(void*,int),void*);\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n/*\n** CAPI3REF: Checkpoint Mode Values\n** KEYWORDS: {checkpoint mode}\n**\n** These constants define all valid values for the \"checkpoint mode\" passed\n** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.\n** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the\n** meaning of each of these checkpoint modes.\n*/\n#define SQLITE_CHECKPOINT_PASSIVE  0  /* Do as much as possible w/o blocking */\n#define SQLITE_CHECKPOINT_FULL     1  /* Wait for writers, then checkpoint */\n#define SQLITE_CHECKPOINT_RESTART  2  /* Like FULL but wait for for readers */\n#define SQLITE_CHECKPOINT_TRUNCATE 3  /* Like RESTART but also truncate WAL */\n\n/*\n** CAPI3REF: Virtual Table Interface Configuration\n**\n** This function may be called by either the [xConnect] or [xCreate] method\n** of a [virtual table] implementation to configure\n** various facets of the virtual table interface.\n**\n** If this interface is invoked outside the context of an xConnect or\n** xCreate virtual table method then the behavior is undefined.\n**\n** At present, there is only one option that may be configured using\n** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].)  Further options\n** may be added in the future.\n*/\nSQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);\n\n/*\n** CAPI3REF: Virtual Table Configuration Options\n**\n** These macros define the various options to the\n** [sqlite3_vtab_config()] interface that [virtual table] implementations\n** can use to customize and optimize their behavior.\n**\n** <dl>\n** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT\n** <dd>Calls of the form\n** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,\n** where X is an integer.  If X is zero, then the [virtual table] whose\n** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not\n** support constraints.  In this configuration (which is the default) if\n** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire\n** statement is rolled back as if [ON CONFLICT | OR ABORT] had been\n** specified as part of the users SQL statement, regardless of the actual\n** ON CONFLICT mode specified.\n**\n** If X is non-zero, then the virtual table implementation guarantees\n** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before\n** any modifications to internal or persistent data structures have been made.\n** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite \n** is able to roll back a statement or database transaction, and abandon\n** or continue processing the current SQL statement as appropriate. \n** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns\n** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode\n** had been ABORT.\n**\n** Virtual table implementations that are required to handle OR REPLACE\n** must do so within the [xUpdate] method. If a call to the \n** [sqlite3_vtab_on_conflict()] function indicates that the current ON \n** CONFLICT policy is REPLACE, the virtual table implementation should \n** silently replace the appropriate rows within the xUpdate callback and\n** return SQLITE_OK. Or, if this is not possible, it may return\n** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT \n** constraint handling.\n** </dl>\n*/\n#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1\n\n/*\n** CAPI3REF: Determine The Virtual Table Conflict Policy\n**\n** This function may only be called from within a call to the [xUpdate] method\n** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The\n** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],\n** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode\n** of the SQL statement that triggered the call to the [xUpdate] method of the\n** [virtual table].\n*/\nSQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);\n\n/*\n** CAPI3REF: Conflict resolution modes\n** KEYWORDS: {conflict resolution mode}\n**\n** These constants are returned by [sqlite3_vtab_on_conflict()] to\n** inform a [virtual table] implementation what the [ON CONFLICT] mode\n** is for the SQL statement being evaluated.\n**\n** Note that the [SQLITE_IGNORE] constant is also used as a potential\n** return value from the [sqlite3_set_authorizer()] callback and that\n** [SQLITE_ABORT] is also a [result code].\n*/\n#define SQLITE_ROLLBACK 1\n/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */\n#define SQLITE_FAIL     3\n/* #define SQLITE_ABORT 4  // Also an error code */\n#define SQLITE_REPLACE  5\n\n/*\n** CAPI3REF: Prepared Statement Scan Status Opcodes\n** KEYWORDS: {scanstatus options}\n**\n** The following constants can be used for the T parameter to the\n** [sqlite3_stmt_scanstatus(S,X,T,V)] interface.  Each constant designates a\n** different metric for sqlite3_stmt_scanstatus() to return.\n**\n** When the value returned to V is a string, space to hold that string is\n** managed by the prepared statement S and will be automatically freed when\n** S is finalized.\n**\n** <dl>\n** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>\n** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be\n** set to the total number of times that the X-th loop has run.</dd>\n**\n** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>\n** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set\n** to the total number of rows examined by all iterations of the X-th loop.</dd>\n**\n** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>\n** <dd>^The \"double\" variable pointed to by the T parameter will be set to the\n** query planner's estimate for the average number of rows output from each\n** iteration of the X-th loop.  If the query planner's estimates was accurate,\n** then this value will approximate the quotient NVISIT/NLOOP and the\n** product of this value for all prior loops with the same SELECTID will\n** be the NLOOP value for the current loop.\n**\n** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>\n** <dd>^The \"const char *\" variable pointed to by the T parameter will be set\n** to a zero-terminated UTF-8 string containing the name of the index or table\n** used for the X-th loop.\n**\n** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>\n** <dd>^The \"const char *\" variable pointed to by the T parameter will be set\n** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]\n** description for the X-th loop.\n**\n** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>\n** <dd>^The \"int\" variable pointed to by the T parameter will be set to the\n** \"select-id\" for the X-th loop.  The select-id identifies which query or\n** subquery the loop is part of.  The main query has a select-id of zero.\n** The select-id is the same value as is output in the first column\n** of an [EXPLAIN QUERY PLAN] query.\n** </dl>\n*/\n#define SQLITE_SCANSTAT_NLOOP    0\n#define SQLITE_SCANSTAT_NVISIT   1\n#define SQLITE_SCANSTAT_EST      2\n#define SQLITE_SCANSTAT_NAME     3\n#define SQLITE_SCANSTAT_EXPLAIN  4\n#define SQLITE_SCANSTAT_SELECTID 5\n\n/*\n** CAPI3REF: Prepared Statement Scan Status\n** METHOD: sqlite3_stmt\n**\n** This interface returns information about the predicted and measured\n** performance for pStmt.  Advanced applications can use this\n** interface to compare the predicted and the measured performance and\n** issue warnings and/or rerun [ANALYZE] if discrepancies are found.\n**\n** Since this interface is expected to be rarely used, it is only\n** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]\n** compile-time option.\n**\n** The \"iScanStatusOp\" parameter determines which status information to return.\n** The \"iScanStatusOp\" must be one of the [scanstatus options] or the behavior\n** of this interface is undefined.\n** ^The requested measurement is written into a variable pointed to by\n** the \"pOut\" parameter.\n** Parameter \"idx\" identifies the specific loop to retrieve statistics for.\n** Loops are numbered starting from zero. ^If idx is out of range - less than\n** zero or greater than or equal to the total number of loops used to implement\n** the statement - a non-zero value is returned and the variable that pOut\n** points to is unchanged.\n**\n** ^Statistics might not be available for all loops in all statements. ^In cases\n** where there exist loops with no available statistics, this function behaves\n** as if the loop did not exist - it returns non-zero and leave the variable\n** that pOut points to unchanged.\n**\n** See also: [sqlite3_stmt_scanstatus_reset()]\n*/\nSQLITE_API int sqlite3_stmt_scanstatus(\n  sqlite3_stmt *pStmt,      /* Prepared statement for which info desired */\n  int idx,                  /* Index of loop to report on */\n  int iScanStatusOp,        /* Information desired.  SQLITE_SCANSTAT_* */\n  void *pOut                /* Result written here */\n);     \n\n/*\n** CAPI3REF: Zero Scan-Status Counters\n** METHOD: sqlite3_stmt\n**\n** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.\n**\n** This API is only available if the library is built with pre-processor\n** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.\n*/\nSQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);\n\n/*\n** CAPI3REF: Flush caches to disk mid-transaction\n**\n** ^If a write-transaction is open on [database connection] D when the\n** [sqlite3_db_cacheflush(D)] interface invoked, any dirty\n** pages in the pager-cache that are not currently in use are written out \n** to disk. A dirty page may be in use if a database cursor created by an\n** active SQL statement is reading from it, or if it is page 1 of a database\n** file (page 1 is always \"in use\").  ^The [sqlite3_db_cacheflush(D)]\n** interface flushes caches for all schemas - \"main\", \"temp\", and\n** any [attached] databases.\n**\n** ^If this function needs to obtain extra database locks before dirty pages \n** can be flushed to disk, it does so. ^If those locks cannot be obtained \n** immediately and there is a busy-handler callback configured, it is invoked\n** in the usual manner. ^If the required lock still cannot be obtained, then\n** the database is skipped and an attempt made to flush any dirty pages\n** belonging to the next (if any) database. ^If any databases are skipped\n** because locks cannot be obtained, but no other error occurs, this\n** function returns SQLITE_BUSY.\n**\n** ^If any other error occurs while flushing dirty pages to disk (for\n** example an IO error or out-of-memory condition), then processing is\n** abandoned and an SQLite [error code] is returned to the caller immediately.\n**\n** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.\n**\n** ^This function does not set the database handle error code or message\n** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.\n*/\nSQLITE_API int sqlite3_db_cacheflush(sqlite3*);\n\n/*\n** CAPI3REF: The pre-update hook.\n**\n** ^These interfaces are only available if SQLite is compiled using the\n** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.\n**\n** ^The [sqlite3_preupdate_hook()] interface registers a callback function\n** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation\n** on a [rowid table].\n** ^At most one preupdate hook may be registered at a time on a single\n** [database connection]; each call to [sqlite3_preupdate_hook()] overrides\n** the previous setting.\n** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()]\n** with a NULL pointer as the second parameter.\n** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as\n** the first parameter to callbacks.\n**\n** ^The preupdate hook only fires for changes to [rowid tables]; the preupdate\n** hook is not invoked for changes to [virtual tables] or [WITHOUT ROWID]\n** tables.\n**\n** ^The second parameter to the preupdate callback is a pointer to\n** the [database connection] that registered the preupdate hook.\n** ^The third parameter to the preupdate callback is one of the constants\n** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the\n** kind of update operation that is about to occur.\n** ^(The fourth parameter to the preupdate callback is the name of the\n** database within the database connection that is being modified.  This\n** will be \"main\" for the main database or \"temp\" for TEMP tables or \n** the name given after the AS keyword in the [ATTACH] statement for attached\n** databases.)^\n** ^The fifth parameter to the preupdate callback is the name of the\n** table that is being modified.\n** ^The sixth parameter to the preupdate callback is the initial [rowid] of the\n** row being changes for SQLITE_UPDATE and SQLITE_DELETE changes and is\n** undefined for SQLITE_INSERT changes.\n** ^The seventh parameter to the preupdate callback is the final [rowid] of\n** the row being changed for SQLITE_UPDATE and SQLITE_INSERT changes and is\n** undefined for SQLITE_DELETE changes.\n**\n** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],\n** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces\n** provide additional information about a preupdate event. These routines\n** may only be called from within a preupdate callback.  Invoking any of\n** these routines from outside of a preupdate callback or with a\n** [database connection] pointer that is different from the one supplied\n** to the preupdate callback results in undefined and probably undesirable\n** behavior.\n**\n** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns\n** in the row that is being inserted, updated, or deleted.\n**\n** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to\n** a [protected sqlite3_value] that contains the value of the Nth column of\n** the table row before it is updated.  The N parameter must be between 0\n** and one less than the number of columns or the behavior will be\n** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE\n** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the\n** behavior is undefined.  The [sqlite3_value] that P points to\n** will be destroyed when the preupdate callback returns.\n**\n** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to\n** a [protected sqlite3_value] that contains the value of the Nth column of\n** the table row after it is updated.  The N parameter must be between 0\n** and one less than the number of columns or the behavior will be\n** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE\n** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the\n** behavior is undefined.  The [sqlite3_value] that P points to\n** will be destroyed when the preupdate callback returns.\n**\n** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate\n** callback was invoked as a result of a direct insert, update, or delete\n** operation; or 1 for inserts, updates, or deletes invoked by top-level \n** triggers; or 2 for changes resulting from triggers called by top-level\n** triggers; and so forth.\n**\n** See also:  [sqlite3_update_hook()]\n*/\nSQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_preupdate_hook(\n  sqlite3 *db,\n  void(*xPreUpdate)(\n    void *pCtx,                   /* Copy of third arg to preupdate_hook() */\n    sqlite3 *db,                  /* Database handle */\n    int op,                       /* SQLITE_UPDATE, DELETE or INSERT */\n    char const *zDb,              /* Database name */\n    char const *zName,            /* Table name */\n    sqlite3_int64 iKey1,          /* Rowid of row about to be deleted/updated */\n    sqlite3_int64 iKey2           /* New rowid value (for a rowid UPDATE) */\n  ),\n  void*\n);\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_count(sqlite3 *);\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_depth(sqlite3 *);\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);\n\n/*\n** CAPI3REF: Low-level system error code\n**\n** ^Attempt to return the underlying operating system error code or error\n** number that caused the most recent I/O error or failure to open a file.\n** The return value is OS-dependent.  For example, on unix systems, after\n** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be\n** called to get back the underlying \"errno\" that caused the problem, such\n** as ENOSPC, EAUTH, EISDIR, and so forth.  \n*/\nSQLITE_API int sqlite3_system_errno(sqlite3*);\n\n/*\n** CAPI3REF: Database Snapshot\n** KEYWORDS: {snapshot}\n** EXPERIMENTAL\n**\n** An instance of the snapshot object records the state of a [WAL mode]\n** database for some specific point in history.\n**\n** In [WAL mode], multiple [database connections] that are open on the\n** same database file can each be reading a different historical version\n** of the database file.  When a [database connection] begins a read\n** transaction, that connection sees an unchanging copy of the database\n** as it existed for the point in time when the transaction first started.\n** Subsequent changes to the database from other connections are not seen\n** by the reader until a new read transaction is started.\n**\n** The sqlite3_snapshot object records state information about an historical\n** version of the database file so that it is possible to later open a new read\n** transaction that sees that historical version of the database rather than\n** the most recent version.\n**\n** The constructor for this object is [sqlite3_snapshot_get()].  The\n** [sqlite3_snapshot_open()] method causes a fresh read transaction to refer\n** to an historical snapshot (if possible).  The destructor for \n** sqlite3_snapshot objects is [sqlite3_snapshot_free()].\n*/\ntypedef struct sqlite3_snapshot sqlite3_snapshot;\n\n/*\n** CAPI3REF: Record A Database Snapshot\n** EXPERIMENTAL\n**\n** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a\n** new [sqlite3_snapshot] object that records the current state of\n** schema S in database connection D.  ^On success, the\n** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly\n** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.\n** ^If schema S of [database connection] D is not a [WAL mode] database\n** that is in a read transaction, then [sqlite3_snapshot_get(D,S,P)]\n** leaves the *P value unchanged and returns an appropriate [error code].\n**\n** The [sqlite3_snapshot] object returned from a successful call to\n** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]\n** to avoid a memory leak.\n**\n** The [sqlite3_snapshot_get()] interface is only available when the\n** SQLITE_ENABLE_SNAPSHOT compile-time option is used.\n*/\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(\n  sqlite3 *db,\n  const char *zSchema,\n  sqlite3_snapshot **ppSnapshot\n);\n\n/*\n** CAPI3REF: Start a read transaction on an historical snapshot\n** EXPERIMENTAL\n**\n** ^The [sqlite3_snapshot_open(D,S,P)] interface starts a\n** read transaction for schema S of\n** [database connection] D such that the read transaction\n** refers to historical [snapshot] P, rather than the most\n** recent change to the database.\n** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success\n** or an appropriate [error code] if it fails.\n**\n** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be\n** the first operation following the [BEGIN] that takes the schema S\n** out of [autocommit mode].\n** ^In other words, schema S must not currently be in\n** a transaction for [sqlite3_snapshot_open(D,S,P)] to work, but the\n** database connection D must be out of [autocommit mode].\n** ^A [snapshot] will fail to open if it has been overwritten by a\n** [checkpoint].\n** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the\n** database connection D does not know that the database file for\n** schema S is in [WAL mode].  A database connection might not know\n** that the database file is in [WAL mode] if there has been no prior\n** I/O on that database connection, or if the database entered [WAL mode] \n** after the most recent I/O on the database connection.)^\n** (Hint: Run \"[PRAGMA application_id]\" against a newly opened\n** database connection in order to make it ready to use snapshots.)\n**\n** The [sqlite3_snapshot_open()] interface is only available when the\n** SQLITE_ENABLE_SNAPSHOT compile-time option is used.\n*/\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(\n  sqlite3 *db,\n  const char *zSchema,\n  sqlite3_snapshot *pSnapshot\n);\n\n/*\n** CAPI3REF: Destroy a snapshot\n** EXPERIMENTAL\n**\n** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.\n** The application must eventually free every [sqlite3_snapshot] object\n** using this routine to avoid a memory leak.\n**\n** The [sqlite3_snapshot_free()] interface is only available when the\n** SQLITE_ENABLE_SNAPSHOT compile-time option is used.\n*/\nSQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);\n\n/*\n** CAPI3REF: Compare the ages of two snapshot handles.\n** EXPERIMENTAL\n**\n** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages\n** of two valid snapshot handles. \n**\n** If the two snapshot handles are not associated with the same database \n** file, the result of the comparison is undefined. \n**\n** Additionally, the result of the comparison is only valid if both of the\n** snapshot handles were obtained by calling sqlite3_snapshot_get() since the\n** last time the wal file was deleted. The wal file is deleted when the\n** database is changed back to rollback mode or when the number of database\n** clients drops to zero. If either snapshot handle was obtained before the \n** wal file was last deleted, the value returned by this function \n** is undefined.\n**\n** Otherwise, this API returns a negative value if P1 refers to an older\n** snapshot than P2, zero if the two handles refer to the same database\n** snapshot, and a positive value if P1 is a newer snapshot than P2.\n*/\nSQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(\n  sqlite3_snapshot *p1,\n  sqlite3_snapshot *p2\n);\n\n/*\n** Undo the hack that converts floating point types to integer for\n** builds on processors without floating point support.\n*/\n#ifdef SQLITE_OMIT_FLOATING_POINT\n# undef double\n#endif\n\n#ifdef __cplusplus\n}  /* End of the 'extern \"C\"' block */\n#endif\n#endif /* SQLITE3_H */\n\n/******** Begin file sqlite3rtree.h *********/\n/*\n** 2010 August 30\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n*/\n\n#ifndef _SQLITE3RTREE_H_\n#define _SQLITE3RTREE_H_\n\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;\ntypedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;\n\n/* The double-precision datatype used by RTree depends on the\n** SQLITE_RTREE_INT_ONLY compile-time option.\n*/\n#ifdef SQLITE_RTREE_INT_ONLY\n  typedef sqlite3_int64 sqlite3_rtree_dbl;\n#else\n  typedef double sqlite3_rtree_dbl;\n#endif\n\n/*\n** Register a geometry callback named zGeom that can be used as part of an\n** R-Tree geometry query as follows:\n**\n**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)\n*/\nSQLITE_API int sqlite3_rtree_geometry_callback(\n  sqlite3 *db,\n  const char *zGeom,\n  int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),\n  void *pContext\n);\n\n\n/*\n** A pointer to a structure of the following type is passed as the first\n** argument to callbacks registered using rtree_geometry_callback().\n*/\nstruct sqlite3_rtree_geometry {\n  void *pContext;                 /* Copy of pContext passed to s_r_g_c() */\n  int nParam;                     /* Size of array aParam[] */\n  sqlite3_rtree_dbl *aParam;      /* Parameters passed to SQL geom function */\n  void *pUser;                    /* Callback implementation user data */\n  void (*xDelUser)(void *);       /* Called by SQLite to clean up pUser */\n};\n\n/*\n** Register a 2nd-generation geometry callback named zScore that can be \n** used as part of an R-Tree geometry query as follows:\n**\n**   SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)\n*/\nSQLITE_API int sqlite3_rtree_query_callback(\n  sqlite3 *db,\n  const char *zQueryFunc,\n  int (*xQueryFunc)(sqlite3_rtree_query_info*),\n  void *pContext,\n  void (*xDestructor)(void*)\n);\n\n\n/*\n** A pointer to a structure of the following type is passed as the \n** argument to scored geometry callback registered using\n** sqlite3_rtree_query_callback().\n**\n** Note that the first 5 fields of this structure are identical to\n** sqlite3_rtree_geometry.  This structure is a subclass of\n** sqlite3_rtree_geometry.\n*/\nstruct sqlite3_rtree_query_info {\n  void *pContext;                   /* pContext from when function registered */\n  int nParam;                       /* Number of function parameters */\n  sqlite3_rtree_dbl *aParam;        /* value of function parameters */\n  void *pUser;                      /* callback can use this, if desired */\n  void (*xDelUser)(void*);          /* function to free pUser */\n  sqlite3_rtree_dbl *aCoord;        /* Coordinates of node or entry to check */\n  unsigned int *anQueue;            /* Number of pending entries in the queue */\n  int nCoord;                       /* Number of coordinates */\n  int iLevel;                       /* Level of current node or entry */\n  int mxLevel;                      /* The largest iLevel value in the tree */\n  sqlite3_int64 iRowid;             /* Rowid for current entry */\n  sqlite3_rtree_dbl rParentScore;   /* Score of parent node */\n  int eParentWithin;                /* Visibility of parent node */\n  int eWithin;                      /* OUT: Visiblity */\n  sqlite3_rtree_dbl rScore;         /* OUT: Write the score here */\n  /* The following fields are only available in 3.8.11 and later */\n  sqlite3_value **apSqlParam;       /* Original SQL values of parameters */\n};\n\n/*\n** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.\n*/\n#define NOT_WITHIN       0   /* Object completely outside of query region */\n#define PARTLY_WITHIN    1   /* Object partially overlaps query region */\n#define FULLY_WITHIN     2   /* Object fully contained within query region */\n\n\n#ifdef __cplusplus\n}  /* end of the 'extern \"C\"' block */\n#endif\n\n#endif  /* ifndef _SQLITE3RTREE_H_ */\n\n/******** End of sqlite3rtree.h *********/\n/******** Begin file sqlite3session.h *********/\n\n#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)\n#define __SQLITESESSION_H_ 1\n\n/*\n** Make sure we can call this stuff from C++.\n*/\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/*\n** CAPI3REF: Session Object Handle\n*/\ntypedef struct sqlite3_session sqlite3_session;\n\n/*\n** CAPI3REF: Changeset Iterator Handle\n*/\ntypedef struct sqlite3_changeset_iter sqlite3_changeset_iter;\n\n/*\n** CAPI3REF: Create A New Session Object\n**\n** Create a new session object attached to database handle db. If successful,\n** a pointer to the new object is written to *ppSession and SQLITE_OK is\n** returned. If an error occurs, *ppSession is set to NULL and an SQLite\n** error code (e.g. SQLITE_NOMEM) is returned.\n**\n** It is possible to create multiple session objects attached to a single\n** database handle.\n**\n** Session objects created using this function should be deleted using the\n** [sqlite3session_delete()] function before the database handle that they\n** are attached to is itself closed. If the database handle is closed before\n** the session object is deleted, then the results of calling any session\n** module function, including [sqlite3session_delete()] on the session object\n** are undefined.\n**\n** Because the session module uses the [sqlite3_preupdate_hook()] API, it\n** is not possible for an application to register a pre-update hook on a\n** database handle that has one or more session objects attached. Nor is\n** it possible to create a session object attached to a database handle for\n** which a pre-update hook is already defined. The results of attempting \n** either of these things are undefined.\n**\n** The session object will be used to create changesets for tables in\n** database zDb, where zDb is either \"main\", or \"temp\", or the name of an\n** attached database. It is not an error if database zDb is not attached\n** to the database when the session object is created.\n*/\nint sqlite3session_create(\n  sqlite3 *db,                    /* Database handle */\n  const char *zDb,                /* Name of db (e.g. \"main\") */\n  sqlite3_session **ppSession     /* OUT: New session object */\n);\n\n/*\n** CAPI3REF: Delete A Session Object\n**\n** Delete a session object previously allocated using \n** [sqlite3session_create()]. Once a session object has been deleted, the\n** results of attempting to use pSession with any other session module\n** function are undefined.\n**\n** Session objects must be deleted before the database handle to which they\n** are attached is closed. Refer to the documentation for \n** [sqlite3session_create()] for details.\n*/\nvoid sqlite3session_delete(sqlite3_session *pSession);\n\n\n/*\n** CAPI3REF: Enable Or Disable A Session Object\n**\n** Enable or disable the recording of changes by a session object. When\n** enabled, a session object records changes made to the database. When\n** disabled - it does not. A newly created session object is enabled.\n** Refer to the documentation for [sqlite3session_changeset()] for further\n** details regarding how enabling and disabling a session object affects\n** the eventual changesets.\n**\n** Passing zero to this function disables the session. Passing a value\n** greater than zero enables it. Passing a value less than zero is a \n** no-op, and may be used to query the current state of the session.\n**\n** The return value indicates the final state of the session object: 0 if \n** the session is disabled, or 1 if it is enabled.\n*/\nint sqlite3session_enable(sqlite3_session *pSession, int bEnable);\n\n/*\n** CAPI3REF: Set Or Clear the Indirect Change Flag\n**\n** Each change recorded by a session object is marked as either direct or\n** indirect. A change is marked as indirect if either:\n**\n** <ul>\n**   <li> The session object \"indirect\" flag is set when the change is\n**        made, or\n**   <li> The change is made by an SQL trigger or foreign key action \n**        instead of directly as a result of a users SQL statement.\n** </ul>\n**\n** If a single row is affected by more than one operation within a session,\n** then the change is considered indirect if all operations meet the criteria\n** for an indirect change above, or direct otherwise.\n**\n** This function is used to set, clear or query the session object indirect\n** flag.  If the second argument passed to this function is zero, then the\n** indirect flag is cleared. If it is greater than zero, the indirect flag\n** is set. Passing a value less than zero does not modify the current value\n** of the indirect flag, and may be used to query the current state of the \n** indirect flag for the specified session object.\n**\n** The return value indicates the final state of the indirect flag: 0 if \n** it is clear, or 1 if it is set.\n*/\nint sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);\n\n/*\n** CAPI3REF: Attach A Table To A Session Object\n**\n** If argument zTab is not NULL, then it is the name of a table to attach\n** to the session object passed as the first argument. All subsequent changes \n** made to the table while the session object is enabled will be recorded. See \n** documentation for [sqlite3session_changeset()] for further details.\n**\n** Or, if argument zTab is NULL, then changes are recorded for all tables\n** in the database. If additional tables are added to the database (by \n** executing \"CREATE TABLE\" statements) after this call is made, changes for \n** the new tables are also recorded.\n**\n** Changes can only be recorded for tables that have a PRIMARY KEY explicitly\n** defined as part of their CREATE TABLE statement. It does not matter if the \n** PRIMARY KEY is an \"INTEGER PRIMARY KEY\" (rowid alias) or not. The PRIMARY\n** KEY may consist of a single column, or may be a composite key.\n** \n** It is not an error if the named table does not exist in the database. Nor\n** is it an error if the named table does not have a PRIMARY KEY. However,\n** no changes will be recorded in either of these scenarios.\n**\n** Changes are not recorded for individual rows that have NULL values stored\n** in one or more of their PRIMARY KEY columns.\n**\n** SQLITE_OK is returned if the call completes without error. Or, if an error \n** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.\n*/\nint sqlite3session_attach(\n  sqlite3_session *pSession,      /* Session object */\n  const char *zTab                /* Table name */\n);\n\n/*\n** CAPI3REF: Set a table filter on a Session Object.\n**\n** The second argument (xFilter) is the \"filter callback\". For changes to rows \n** in tables that are not attached to the Session object, the filter is called\n** to determine whether changes to the table's rows should be tracked or not. \n** If xFilter returns 0, changes is not tracked. Note that once a table is \n** attached, xFilter will not be called again.\n*/\nvoid sqlite3session_table_filter(\n  sqlite3_session *pSession,      /* Session object */\n  int(*xFilter)(\n    void *pCtx,                   /* Copy of third arg to _filter_table() */\n    const char *zTab              /* Table name */\n  ),\n  void *pCtx                      /* First argument passed to xFilter */\n);\n\n/*\n** CAPI3REF: Generate A Changeset From A Session Object\n**\n** Obtain a changeset containing changes to the tables attached to the \n** session object passed as the first argument. If successful, \n** set *ppChangeset to point to a buffer containing the changeset \n** and *pnChangeset to the size of the changeset in bytes before returning\n** SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to\n** zero and return an SQLite error code.\n**\n** A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes,\n** each representing a change to a single row of an attached table. An INSERT\n** change contains the values of each field of a new database row. A DELETE\n** contains the original values of each field of a deleted database row. An\n** UPDATE change contains the original values of each field of an updated\n** database row along with the updated values for each updated non-primary-key\n** column. It is not possible for an UPDATE change to represent a change that\n** modifies the values of primary key columns. If such a change is made, it\n** is represented in a changeset as a DELETE followed by an INSERT.\n**\n** Changes are not recorded for rows that have NULL values stored in one or \n** more of their PRIMARY KEY columns. If such a row is inserted or deleted,\n** no corresponding change is present in the changesets returned by this\n** function. If an existing row with one or more NULL values stored in\n** PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL,\n** only an INSERT is appears in the changeset. Similarly, if an existing row\n** with non-NULL PRIMARY KEY values is updated so that one or more of its\n** PRIMARY KEY columns are set to NULL, the resulting changeset contains a\n** DELETE change only.\n**\n** The contents of a changeset may be traversed using an iterator created\n** using the [sqlite3changeset_start()] API. A changeset may be applied to\n** a database with a compatible schema using the [sqlite3changeset_apply()]\n** API.\n**\n** Within a changeset generated by this function, all changes related to a\n** single table are grouped together. In other words, when iterating through\n** a changeset or when applying a changeset to a database, all changes related\n** to a single table are processed before moving on to the next table. Tables\n** are sorted in the same order in which they were attached (or auto-attached)\n** to the sqlite3_session object. The order in which the changes related to\n** a single table are stored is undefined.\n**\n** Following a successful call to this function, it is the responsibility of\n** the caller to eventually free the buffer that *ppChangeset points to using\n** [sqlite3_free()].\n**\n** <h3>Changeset Generation</h3>\n**\n** Once a table has been attached to a session object, the session object\n** records the primary key values of all new rows inserted into the table.\n** It also records the original primary key and other column values of any\n** deleted or updated rows. For each unique primary key value, data is only\n** recorded once - the first time a row with said primary key is inserted,\n** updated or deleted in the lifetime of the session.\n**\n** There is one exception to the previous paragraph: when a row is inserted,\n** updated or deleted, if one or more of its primary key columns contain a\n** NULL value, no record of the change is made.\n**\n** The session object therefore accumulates two types of records - those\n** that consist of primary key values only (created when the user inserts\n** a new record) and those that consist of the primary key values and the\n** original values of other table columns (created when the users deletes\n** or updates a record).\n**\n** When this function is called, the requested changeset is created using\n** both the accumulated records and the current contents of the database\n** file. Specifically:\n**\n** <ul>\n**   <li> For each record generated by an insert, the database is queried\n**        for a row with a matching primary key. If one is found, an INSERT\n**        change is added to the changeset. If no such row is found, no change \n**        is added to the changeset.\n**\n**   <li> For each record generated by an update or delete, the database is \n**        queried for a row with a matching primary key. If such a row is\n**        found and one or more of the non-primary key fields have been\n**        modified from their original values, an UPDATE change is added to \n**        the changeset. Or, if no such row is found in the table, a DELETE \n**        change is added to the changeset. If there is a row with a matching\n**        primary key in the database, but all fields contain their original\n**        values, no change is added to the changeset.\n** </ul>\n**\n** This means, amongst other things, that if a row is inserted and then later\n** deleted while a session object is active, neither the insert nor the delete\n** will be present in the changeset. Or if a row is deleted and then later a \n** row with the same primary key values inserted while a session object is\n** active, the resulting changeset will contain an UPDATE change instead of\n** a DELETE and an INSERT.\n**\n** When a session object is disabled (see the [sqlite3session_enable()] API),\n** it does not accumulate records when rows are inserted, updated or deleted.\n** This may appear to have some counter-intuitive effects if a single row\n** is written to more than once during a session. For example, if a row\n** is inserted while a session object is enabled, then later deleted while \n** the same session object is disabled, no INSERT record will appear in the\n** changeset, even though the delete took place while the session was disabled.\n** Or, if one field of a row is updated while a session is disabled, and \n** another field of the same row is updated while the session is enabled, the\n** resulting changeset will contain an UPDATE change that updates both fields.\n*/\nint sqlite3session_changeset(\n  sqlite3_session *pSession,      /* Session object */\n  int *pnChangeset,               /* OUT: Size of buffer at *ppChangeset */\n  void **ppChangeset              /* OUT: Buffer containing changeset */\n);\n\n/*\n** CAPI3REF: Load The Difference Between Tables Into A Session \n**\n** If it is not already attached to the session object passed as the first\n** argument, this function attaches table zTbl in the same manner as the\n** [sqlite3session_attach()] function. If zTbl does not exist, or if it\n** does not have a primary key, this function is a no-op (but does not return\n** an error).\n**\n** Argument zFromDb must be the name of a database (\"main\", \"temp\" etc.)\n** attached to the same database handle as the session object that contains \n** a table compatible with the table attached to the session by this function.\n** A table is considered compatible if it:\n**\n** <ul>\n**   <li> Has the same name,\n**   <li> Has the same set of columns declared in the same order, and\n**   <li> Has the same PRIMARY KEY definition.\n** </ul>\n**\n** If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables\n** are compatible but do not have any PRIMARY KEY columns, it is not an error\n** but no changes are added to the session object. As with other session\n** APIs, tables without PRIMARY KEYs are simply ignored.\n**\n** This function adds a set of changes to the session object that could be\n** used to update the table in database zFrom (call this the \"from-table\") \n** so that its content is the same as the table attached to the session \n** object (call this the \"to-table\"). Specifically:\n**\n** <ul>\n**   <li> For each row (primary key) that exists in the to-table but not in \n**     the from-table, an INSERT record is added to the session object.\n**\n**   <li> For each row (primary key) that exists in the to-table but not in \n**     the from-table, a DELETE record is added to the session object.\n**\n**   <li> For each row (primary key) that exists in both tables, but features \n**     different in each, an UPDATE record is added to the session.\n** </ul>\n**\n** To clarify, if this function is called and then a changeset constructed\n** using [sqlite3session_changeset()], then after applying that changeset to \n** database zFrom the contents of the two compatible tables would be \n** identical.\n**\n** It an error if database zFrom does not exist or does not contain the\n** required compatible table.\n**\n** If the operation successful, SQLITE_OK is returned. Otherwise, an SQLite\n** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg\n** may be set to point to a buffer containing an English language error \n** message. It is the responsibility of the caller to free this buffer using\n** sqlite3_free().\n*/\nint sqlite3session_diff(\n  sqlite3_session *pSession,\n  const char *zFromDb,\n  const char *zTbl,\n  char **pzErrMsg\n);\n\n\n/*\n** CAPI3REF: Generate A Patchset From A Session Object\n**\n** The differences between a patchset and a changeset are that:\n**\n** <ul>\n**   <li> DELETE records consist of the primary key fields only. The \n**        original values of other fields are omitted.\n**   <li> The original values of any modified fields are omitted from \n**        UPDATE records.\n** </ul>\n**\n** A patchset blob may be used with up to date versions of all \n** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(), \n** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly,\n** attempting to use a patchset blob with old versions of the\n** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error. \n**\n** Because the non-primary key \"old.*\" fields are omitted, no \n** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset\n** is passed to the sqlite3changeset_apply() API. Other conflict types work\n** in the same way as for changesets.\n**\n** Changes within a patchset are ordered in the same way as for changesets\n** generated by the sqlite3session_changeset() function (i.e. all changes for\n** a single table are grouped together, tables appear in the order in which\n** they were attached to the session object).\n*/\nint sqlite3session_patchset(\n  sqlite3_session *pSession,      /* Session object */\n  int *pnPatchset,                /* OUT: Size of buffer at *ppChangeset */\n  void **ppPatchset               /* OUT: Buffer containing changeset */\n);\n\n/*\n** CAPI3REF: Test if a changeset has recorded any changes.\n**\n** Return non-zero if no changes to attached tables have been recorded by \n** the session object passed as the first argument. Otherwise, if one or \n** more changes have been recorded, return zero.\n**\n** Even if this function returns zero, it is possible that calling\n** [sqlite3session_changeset()] on the session handle may still return a\n** changeset that contains no changes. This can happen when a row in \n** an attached table is modified and then later on the original values \n** are restored. However, if this function returns non-zero, then it is\n** guaranteed that a call to sqlite3session_changeset() will return a \n** changeset containing zero changes.\n*/\nint sqlite3session_isempty(sqlite3_session *pSession);\n\n/*\n** CAPI3REF: Create An Iterator To Traverse A Changeset \n**\n** Create an iterator used to iterate through the contents of a changeset.\n** If successful, *pp is set to point to the iterator handle and SQLITE_OK\n** is returned. Otherwise, if an error occurs, *pp is set to zero and an\n** SQLite error code is returned.\n**\n** The following functions can be used to advance and query a changeset \n** iterator created by this function:\n**\n** <ul>\n**   <li> [sqlite3changeset_next()]\n**   <li> [sqlite3changeset_op()]\n**   <li> [sqlite3changeset_new()]\n**   <li> [sqlite3changeset_old()]\n** </ul>\n**\n** It is the responsibility of the caller to eventually destroy the iterator\n** by passing it to [sqlite3changeset_finalize()]. The buffer containing the\n** changeset (pChangeset) must remain valid until after the iterator is\n** destroyed.\n**\n** Assuming the changeset blob was created by one of the\n** [sqlite3session_changeset()], [sqlite3changeset_concat()] or\n** [sqlite3changeset_invert()] functions, all changes within the changeset \n** that apply to a single table are grouped together. This means that when \n** an application iterates through a changeset using an iterator created by \n** this function, all changes that relate to a single table are visited \n** consecutively. There is no chance that the iterator will visit a change \n** the applies to table X, then one for table Y, and then later on visit \n** another change for table X.\n*/\nint sqlite3changeset_start(\n  sqlite3_changeset_iter **pp,    /* OUT: New changeset iterator handle */\n  int nChangeset,                 /* Size of changeset blob in bytes */\n  void *pChangeset                /* Pointer to blob containing changeset */\n);\n\n\n/*\n** CAPI3REF: Advance A Changeset Iterator\n**\n** This function may only be used with iterators created by function\n** [sqlite3changeset_start()]. If it is called on an iterator passed to\n** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE\n** is returned and the call has no effect.\n**\n** Immediately after an iterator is created by sqlite3changeset_start(), it\n** does not point to any change in the changeset. Assuming the changeset\n** is not empty, the first call to this function advances the iterator to\n** point to the first change in the changeset. Each subsequent call advances\n** the iterator to point to the next change in the changeset (if any). If\n** no error occurs and the iterator points to a valid change after a call\n** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned. \n** Otherwise, if all changes in the changeset have already been visited,\n** SQLITE_DONE is returned.\n**\n** If an error occurs, an SQLite error code is returned. Possible error \n** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or \n** SQLITE_NOMEM.\n*/\nint sqlite3changeset_next(sqlite3_changeset_iter *pIter);\n\n/*\n** CAPI3REF: Obtain The Current Operation From A Changeset Iterator\n**\n** The pIter argument passed to this function may either be an iterator\n** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator\n** created by [sqlite3changeset_start()]. In the latter case, the most recent\n** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this\n** is not the case, this function returns [SQLITE_MISUSE].\n**\n** If argument pzTab is not NULL, then *pzTab is set to point to a\n** nul-terminated utf-8 encoded string containing the name of the table\n** affected by the current change. The buffer remains valid until either\n** sqlite3changeset_next() is called on the iterator or until the \n** conflict-handler function returns. If pnCol is not NULL, then *pnCol is \n** set to the number of columns in the table affected by the change. If\n** pbIncorrect is not NULL, then *pbIndirect is set to true (1) if the change\n** is an indirect change, or false (0) otherwise. See the documentation for\n** [sqlite3session_indirect()] for a description of direct and indirect\n** changes. Finally, if pOp is not NULL, then *pOp is set to one of \n** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the \n** type of change that the iterator currently points to.\n**\n** If no error occurs, SQLITE_OK is returned. If an error does occur, an\n** SQLite error code is returned. The values of the output variables may not\n** be trusted in this case.\n*/\nint sqlite3changeset_op(\n  sqlite3_changeset_iter *pIter,  /* Iterator object */\n  const char **pzTab,             /* OUT: Pointer to table name */\n  int *pnCol,                     /* OUT: Number of columns in table */\n  int *pOp,                       /* OUT: SQLITE_INSERT, DELETE or UPDATE */\n  int *pbIndirect                 /* OUT: True for an 'indirect' change */\n);\n\n/*\n** CAPI3REF: Obtain The Primary Key Definition Of A Table\n**\n** For each modified table, a changeset includes the following:\n**\n** <ul>\n**   <li> The number of columns in the table, and\n**   <li> Which of those columns make up the tables PRIMARY KEY.\n** </ul>\n**\n** This function is used to find which columns comprise the PRIMARY KEY of\n** the table modified by the change that iterator pIter currently points to.\n** If successful, *pabPK is set to point to an array of nCol entries, where\n** nCol is the number of columns in the table. Elements of *pabPK are set to\n** 0x01 if the corresponding column is part of the tables primary key, or\n** 0x00 if it is not.\n**\n** If argument pnCol is not NULL, then *pnCol is set to the number of columns\n** in the table.\n**\n** If this function is called when the iterator does not point to a valid\n** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,\n** SQLITE_OK is returned and the output variables populated as described\n** above.\n*/\nint sqlite3changeset_pk(\n  sqlite3_changeset_iter *pIter,  /* Iterator object */\n  unsigned char **pabPK,          /* OUT: Array of boolean - true for PK cols */\n  int *pnCol                      /* OUT: Number of entries in output array */\n);\n\n/*\n** CAPI3REF: Obtain old.* Values From A Changeset Iterator\n**\n** The pIter argument passed to this function may either be an iterator\n** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator\n** created by [sqlite3changeset_start()]. In the latter case, the most recent\n** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. \n** Furthermore, it may only be called if the type of change that the iterator\n** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise,\n** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.\n**\n** Argument iVal must be greater than or equal to 0, and less than the number\n** of columns in the table affected by the current change. Otherwise,\n** [SQLITE_RANGE] is returned and *ppValue is set to NULL.\n**\n** If successful, this function sets *ppValue to point to a protected\n** sqlite3_value object containing the iVal'th value from the vector of \n** original row values stored as part of the UPDATE or DELETE change and\n** returns SQLITE_OK. The name of the function comes from the fact that this \n** is similar to the \"old.*\" columns available to update or delete triggers.\n**\n** If some other error occurs (e.g. an OOM condition), an SQLite error code\n** is returned and *ppValue is set to NULL.\n*/\nint sqlite3changeset_old(\n  sqlite3_changeset_iter *pIter,  /* Changeset iterator */\n  int iVal,                       /* Column number */\n  sqlite3_value **ppValue         /* OUT: Old value (or NULL pointer) */\n);\n\n/*\n** CAPI3REF: Obtain new.* Values From A Changeset Iterator\n**\n** The pIter argument passed to this function may either be an iterator\n** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator\n** created by [sqlite3changeset_start()]. In the latter case, the most recent\n** call to [sqlite3changeset_next()] must have returned SQLITE_ROW. \n** Furthermore, it may only be called if the type of change that the iterator\n** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise,\n** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.\n**\n** Argument iVal must be greater than or equal to 0, and less than the number\n** of columns in the table affected by the current change. Otherwise,\n** [SQLITE_RANGE] is returned and *ppValue is set to NULL.\n**\n** If successful, this function sets *ppValue to point to a protected\n** sqlite3_value object containing the iVal'th value from the vector of \n** new row values stored as part of the UPDATE or INSERT change and\n** returns SQLITE_OK. If the change is an UPDATE and does not include\n** a new value for the requested column, *ppValue is set to NULL and \n** SQLITE_OK returned. The name of the function comes from the fact that \n** this is similar to the \"new.*\" columns available to update or delete \n** triggers.\n**\n** If some other error occurs (e.g. an OOM condition), an SQLite error code\n** is returned and *ppValue is set to NULL.\n*/\nint sqlite3changeset_new(\n  sqlite3_changeset_iter *pIter,  /* Changeset iterator */\n  int iVal,                       /* Column number */\n  sqlite3_value **ppValue         /* OUT: New value (or NULL pointer) */\n);\n\n/*\n** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator\n**\n** This function should only be used with iterator objects passed to a\n** conflict-handler callback by [sqlite3changeset_apply()] with either\n** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function\n** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue\n** is set to NULL.\n**\n** Argument iVal must be greater than or equal to 0, and less than the number\n** of columns in the table affected by the current change. Otherwise,\n** [SQLITE_RANGE] is returned and *ppValue is set to NULL.\n**\n** If successful, this function sets *ppValue to point to a protected\n** sqlite3_value object containing the iVal'th value from the \n** \"conflicting row\" associated with the current conflict-handler callback\n** and returns SQLITE_OK.\n**\n** If some other error occurs (e.g. an OOM condition), an SQLite error code\n** is returned and *ppValue is set to NULL.\n*/\nint sqlite3changeset_conflict(\n  sqlite3_changeset_iter *pIter,  /* Changeset iterator */\n  int iVal,                       /* Column number */\n  sqlite3_value **ppValue         /* OUT: Value from conflicting row */\n);\n\n/*\n** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations\n**\n** This function may only be called with an iterator passed to an\n** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case\n** it sets the output variable to the total number of known foreign key\n** violations in the destination database and returns SQLITE_OK.\n**\n** In all other cases this function returns SQLITE_MISUSE.\n*/\nint sqlite3changeset_fk_conflicts(\n  sqlite3_changeset_iter *pIter,  /* Changeset iterator */\n  int *pnOut                      /* OUT: Number of FK violations */\n);\n\n\n/*\n** CAPI3REF: Finalize A Changeset Iterator\n**\n** This function is used to finalize an iterator allocated with\n** [sqlite3changeset_start()].\n**\n** This function should only be called on iterators created using the\n** [sqlite3changeset_start()] function. If an application calls this\n** function with an iterator passed to a conflict-handler by\n** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the\n** call has no effect.\n**\n** If an error was encountered within a call to an sqlite3changeset_xxx()\n** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an \n** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding\n** to that error is returned by this function. Otherwise, SQLITE_OK is\n** returned. This is to allow the following pattern (pseudo-code):\n**\n**   sqlite3changeset_start();\n**   while( SQLITE_ROW==sqlite3changeset_next() ){\n**     // Do something with change.\n**   }\n**   rc = sqlite3changeset_finalize();\n**   if( rc!=SQLITE_OK ){\n**     // An error has occurred \n**   }\n*/\nint sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);\n\n/*\n** CAPI3REF: Invert A Changeset\n**\n** This function is used to \"invert\" a changeset object. Applying an inverted\n** changeset to a database reverses the effects of applying the uninverted\n** changeset. Specifically:\n**\n** <ul>\n**   <li> Each DELETE change is changed to an INSERT, and\n**   <li> Each INSERT change is changed to a DELETE, and\n**   <li> For each UPDATE change, the old.* and new.* values are exchanged.\n** </ul>\n**\n** This function does not change the order in which changes appear within\n** the changeset. It merely reverses the sense of each individual change.\n**\n** If successful, a pointer to a buffer containing the inverted changeset\n** is stored in *ppOut, the size of the same buffer is stored in *pnOut, and\n** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are\n** zeroed and an SQLite error code returned.\n**\n** It is the responsibility of the caller to eventually call sqlite3_free()\n** on the *ppOut pointer to free the buffer allocation following a successful \n** call to this function.\n**\n** WARNING/TODO: This function currently assumes that the input is a valid\n** changeset. If it is not, the results are undefined.\n*/\nint sqlite3changeset_invert(\n  int nIn, const void *pIn,       /* Input changeset */\n  int *pnOut, void **ppOut        /* OUT: Inverse of input */\n);\n\n/*\n** CAPI3REF: Concatenate Two Changeset Objects\n**\n** This function is used to concatenate two changesets, A and B, into a \n** single changeset. The result is a changeset equivalent to applying\n** changeset A followed by changeset B. \n**\n** This function combines the two input changesets using an \n** sqlite3_changegroup object. Calling it produces similar results as the\n** following code fragment:\n**\n**   sqlite3_changegroup *pGrp;\n**   rc = sqlite3_changegroup_new(&pGrp);\n**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);\n**   if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);\n**   if( rc==SQLITE_OK ){\n**     rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);\n**   }else{\n**     *ppOut = 0;\n**     *pnOut = 0;\n**   }\n**\n** Refer to the sqlite3_changegroup documentation below for details.\n*/\nint sqlite3changeset_concat(\n  int nA,                         /* Number of bytes in buffer pA */\n  void *pA,                       /* Pointer to buffer containing changeset A */\n  int nB,                         /* Number of bytes in buffer pB */\n  void *pB,                       /* Pointer to buffer containing changeset B */\n  int *pnOut,                     /* OUT: Number of bytes in output changeset */\n  void **ppOut                    /* OUT: Buffer containing output changeset */\n);\n\n\n/*\n** CAPI3REF: Changegroup Handle\n*/\ntypedef struct sqlite3_changegroup sqlite3_changegroup;\n\n/*\n** CAPI3REF: Create A New Changegroup Object\n**\n** An sqlite3_changegroup object is used to combine two or more changesets\n** (or patchsets) into a single changeset (or patchset). A single changegroup\n** object may combine changesets or patchsets, but not both. The output is\n** always in the same format as the input.\n**\n** If successful, this function returns SQLITE_OK and populates (*pp) with\n** a pointer to a new sqlite3_changegroup object before returning. The caller\n** should eventually free the returned object using a call to \n** sqlite3changegroup_delete(). If an error occurs, an SQLite error code\n** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.\n**\n** The usual usage pattern for an sqlite3_changegroup object is as follows:\n**\n** <ul>\n**   <li> It is created using a call to sqlite3changegroup_new().\n**\n**   <li> Zero or more changesets (or patchsets) are added to the object\n**        by calling sqlite3changegroup_add().\n**\n**   <li> The result of combining all input changesets together is obtained \n**        by the application via a call to sqlite3changegroup_output().\n**\n**   <li> The object is deleted using a call to sqlite3changegroup_delete().\n** </ul>\n**\n** Any number of calls to add() and output() may be made between the calls to\n** new() and delete(), and in any order.\n**\n** As well as the regular sqlite3changegroup_add() and \n** sqlite3changegroup_output() functions, also available are the streaming\n** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().\n*/\nint sqlite3changegroup_new(sqlite3_changegroup **pp);\n\n/*\n** CAPI3REF: Add A Changeset To A Changegroup\n**\n** Add all changes within the changeset (or patchset) in buffer pData (size\n** nData bytes) to the changegroup. \n**\n** If the buffer contains a patchset, then all prior calls to this function\n** on the same changegroup object must also have specified patchsets. Or, if\n** the buffer contains a changeset, so must have the earlier calls to this\n** function. Otherwise, SQLITE_ERROR is returned and no changes are added\n** to the changegroup.\n**\n** Rows within the changeset and changegroup are identified by the values in\n** their PRIMARY KEY columns. A change in the changeset is considered to\n** apply to the same row as a change already present in the changegroup if\n** the two rows have the same primary key.\n**\n** Changes to rows that do not already appear in the changegroup are\n** simply copied into it. Or, if both the new changeset and the changegroup\n** contain changes that apply to a single row, the final contents of the\n** changegroup depends on the type of each change, as follows:\n**\n** <table border=1 style=\"margin-left:8ex;margin-right:8ex\">\n**   <tr><th style=\"white-space:pre\">Existing Change  </th>\n**       <th style=\"white-space:pre\">New Change       </th>\n**       <th>Output Change\n**   <tr><td>INSERT <td>INSERT <td>\n**       The new change is ignored. This case does not occur if the new\n**       changeset was recorded immediately after the changesets already\n**       added to the changegroup.\n**   <tr><td>INSERT <td>UPDATE <td>\n**       The INSERT change remains in the changegroup. The values in the \n**       INSERT change are modified as if the row was inserted by the\n**       existing change and then updated according to the new change.\n**   <tr><td>INSERT <td>DELETE <td>\n**       The existing INSERT is removed from the changegroup. The DELETE is\n**       not added.\n**   <tr><td>UPDATE <td>INSERT <td>\n**       The new change is ignored. This case does not occur if the new\n**       changeset was recorded immediately after the changesets already\n**       added to the changegroup.\n**   <tr><td>UPDATE <td>UPDATE <td>\n**       The existing UPDATE remains within the changegroup. It is amended \n**       so that the accompanying values are as if the row was updated once \n**       by the existing change and then again by the new change.\n**   <tr><td>UPDATE <td>DELETE <td>\n**       The existing UPDATE is replaced by the new DELETE within the\n**       changegroup.\n**   <tr><td>DELETE <td>INSERT <td>\n**       If one or more of the column values in the row inserted by the\n**       new change differ from those in the row deleted by the existing \n**       change, the existing DELETE is replaced by an UPDATE within the\n**       changegroup. Otherwise, if the inserted row is exactly the same \n**       as the deleted row, the existing DELETE is simply discarded.\n**   <tr><td>DELETE <td>UPDATE <td>\n**       The new change is ignored. This case does not occur if the new\n**       changeset was recorded immediately after the changesets already\n**       added to the changegroup.\n**   <tr><td>DELETE <td>DELETE <td>\n**       The new change is ignored. This case does not occur if the new\n**       changeset was recorded immediately after the changesets already\n**       added to the changegroup.\n** </table>\n**\n** If the new changeset contains changes to a table that is already present\n** in the changegroup, then the number of columns and the position of the\n** primary key columns for the table must be consistent. If this is not the\n** case, this function fails with SQLITE_SCHEMA. If the input changeset\n** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is\n** returned. Or, if an out-of-memory condition occurs during processing, this\n** function returns SQLITE_NOMEM. In all cases, if an error occurs the\n** final contents of the changegroup is undefined.\n**\n** If no error occurs, SQLITE_OK is returned.\n*/\nint sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);\n\n/*\n** CAPI3REF: Obtain A Composite Changeset From A Changegroup\n**\n** Obtain a buffer containing a changeset (or patchset) representing the\n** current contents of the changegroup. If the inputs to the changegroup\n** were themselves changesets, the output is a changeset. Or, if the\n** inputs were patchsets, the output is also a patchset.\n**\n** As with the output of the sqlite3session_changeset() and\n** sqlite3session_patchset() functions, all changes related to a single\n** table are grouped together in the output of this function. Tables appear\n** in the same order as for the very first changeset added to the changegroup.\n** If the second or subsequent changesets added to the changegroup contain\n** changes for tables that do not appear in the first changeset, they are\n** appended onto the end of the output changeset, again in the order in\n** which they are first encountered.\n**\n** If an error occurs, an SQLite error code is returned and the output\n** variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK\n** is returned and the output variables are set to the size of and a \n** pointer to the output buffer, respectively. In this case it is the\n** responsibility of the caller to eventually free the buffer using a\n** call to sqlite3_free().\n*/\nint sqlite3changegroup_output(\n  sqlite3_changegroup*,\n  int *pnData,                    /* OUT: Size of output buffer in bytes */\n  void **ppData                   /* OUT: Pointer to output buffer */\n);\n\n/*\n** CAPI3REF: Delete A Changegroup Object\n*/\nvoid sqlite3changegroup_delete(sqlite3_changegroup*);\n\n/*\n** CAPI3REF: Apply A Changeset To A Database\n**\n** Apply a changeset to a database. This function attempts to update the\n** \"main\" database attached to handle db with the changes found in the\n** changeset passed via the second and third arguments.\n**\n** The fourth argument (xFilter) passed to this function is the \"filter\n** callback\". If it is not NULL, then for each table affected by at least one\n** change in the changeset, the filter callback is invoked with\n** the table name as the second argument, and a copy of the context pointer\n** passed as the sixth argument to this function as the first. If the \"filter\n** callback\" returns zero, then no attempt is made to apply any changes to \n** the table. Otherwise, if the return value is non-zero or the xFilter\n** argument to this function is NULL, all changes related to the table are\n** attempted.\n**\n** For each table that is not excluded by the filter callback, this function \n** tests that the target database contains a compatible table. A table is \n** considered compatible if all of the following are true:\n**\n** <ul>\n**   <li> The table has the same name as the name recorded in the \n**        changeset, and\n**   <li> The table has the same number of columns as recorded in the \n**        changeset, and\n**   <li> The table has primary key columns in the same position as \n**        recorded in the changeset.\n** </ul>\n**\n** If there is no compatible table, it is not an error, but none of the\n** changes associated with the table are applied. A warning message is issued\n** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most\n** one such warning is issued for each table in the changeset.\n**\n** For each change for which there is a compatible table, an attempt is made \n** to modify the table contents according to the UPDATE, INSERT or DELETE \n** change. If a change cannot be applied cleanly, the conflict handler \n** function passed as the fifth argument to sqlite3changeset_apply() may be \n** invoked. A description of exactly when the conflict handler is invoked for \n** each type of change is below.\n**\n** Unlike the xFilter argument, xConflict may not be passed NULL. The results\n** of passing anything other than a valid function pointer as the xConflict\n** argument are undefined.\n**\n** Each time the conflict handler function is invoked, it must return one\n** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or \n** [SQLITE_CHANGESET_REPLACE]. SQLITE_CHANGESET_REPLACE may only be returned\n** if the second argument passed to the conflict handler is either\n** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler\n** returns an illegal value, any changes already made are rolled back and\n** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different \n** actions are taken by sqlite3changeset_apply() depending on the value\n** returned by each invocation of the conflict-handler function. Refer to\n** the documentation for the three \n** [SQLITE_CHANGESET_OMIT|available return values] for details.\n**\n** <dl>\n** <dt>DELETE Changes<dd>\n**   For each DELETE change, this function checks if the target database \n**   contains a row with the same primary key value (or values) as the \n**   original row values stored in the changeset. If it does, and the values \n**   stored in all non-primary key columns also match the values stored in \n**   the changeset the row is deleted from the target database.\n**\n**   If a row with matching primary key values is found, but one or more of\n**   the non-primary key fields contains a value different from the original\n**   row value stored in the changeset, the conflict-handler function is\n**   invoked with [SQLITE_CHANGESET_DATA] as the second argument.\n**\n**   If no row with matching primary key values is found in the database,\n**   the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]\n**   passed as the second argument.\n**\n**   If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT\n**   (which can only happen if a foreign key constraint is violated), the\n**   conflict-handler function is invoked with [SQLITE_CHANGESET_CONSTRAINT]\n**   passed as the second argument. This includes the case where the DELETE\n**   operation is attempted because an earlier call to the conflict handler\n**   function returned [SQLITE_CHANGESET_REPLACE].\n**\n** <dt>INSERT Changes<dd>\n**   For each INSERT change, an attempt is made to insert the new row into\n**   the database.\n**\n**   If the attempt to insert the row fails because the database already \n**   contains a row with the same primary key values, the conflict handler\n**   function is invoked with the second argument set to \n**   [SQLITE_CHANGESET_CONFLICT].\n**\n**   If the attempt to insert the row fails because of some other constraint\n**   violation (e.g. NOT NULL or UNIQUE), the conflict handler function is \n**   invoked with the second argument set to [SQLITE_CHANGESET_CONSTRAINT].\n**   This includes the case where the INSERT operation is re-attempted because \n**   an earlier call to the conflict handler function returned \n**   [SQLITE_CHANGESET_REPLACE].\n**\n** <dt>UPDATE Changes<dd>\n**   For each UPDATE change, this function checks if the target database \n**   contains a row with the same primary key value (or values) as the \n**   original row values stored in the changeset. If it does, and the values \n**   stored in all non-primary key columns also match the values stored in \n**   the changeset the row is updated within the target database.\n**\n**   If a row with matching primary key values is found, but one or more of\n**   the non-primary key fields contains a value different from an original\n**   row value stored in the changeset, the conflict-handler function is\n**   invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since\n**   UPDATE changes only contain values for non-primary key fields that are\n**   to be modified, only those fields need to match the original values to\n**   avoid the SQLITE_CHANGESET_DATA conflict-handler callback.\n**\n**   If no row with matching primary key values is found in the database,\n**   the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]\n**   passed as the second argument.\n**\n**   If the UPDATE operation is attempted, but SQLite returns \n**   SQLITE_CONSTRAINT, the conflict-handler function is invoked with \n**   [SQLITE_CHANGESET_CONSTRAINT] passed as the second argument.\n**   This includes the case where the UPDATE operation is attempted after \n**   an earlier call to the conflict handler function returned\n**   [SQLITE_CHANGESET_REPLACE].  \n** </dl>\n**\n** It is safe to execute SQL statements, including those that write to the\n** table that the callback related to, from within the xConflict callback.\n** This can be used to further customize the applications conflict\n** resolution strategy.\n**\n** All changes made by this function are enclosed in a savepoint transaction.\n** If any other error (aside from a constraint failure when attempting to\n** write to the target database) occurs, then the savepoint transaction is\n** rolled back, restoring the target database to its original state, and an \n** SQLite error code returned.\n*/\nint sqlite3changeset_apply(\n  sqlite3 *db,                    /* Apply change to \"main\" db of this handle */\n  int nChangeset,                 /* Size of changeset in bytes */\n  void *pChangeset,               /* Changeset blob */\n  int(*xFilter)(\n    void *pCtx,                   /* Copy of sixth arg to _apply() */\n    const char *zTab              /* Table name */\n  ),\n  int(*xConflict)(\n    void *pCtx,                   /* Copy of sixth arg to _apply() */\n    int eConflict,                /* DATA, MISSING, CONFLICT, CONSTRAINT */\n    sqlite3_changeset_iter *p     /* Handle describing change and conflict */\n  ),\n  void *pCtx                      /* First argument passed to xConflict */\n);\n\n/* \n** CAPI3REF: Constants Passed To The Conflict Handler\n**\n** Values that may be passed as the second argument to a conflict-handler.\n**\n** <dl>\n** <dt>SQLITE_CHANGESET_DATA<dd>\n**   The conflict handler is invoked with CHANGESET_DATA as the second argument\n**   when processing a DELETE or UPDATE change if a row with the required\n**   PRIMARY KEY fields is present in the database, but one or more other \n**   (non primary-key) fields modified by the update do not contain the \n**   expected \"before\" values.\n** \n**   The conflicting row, in this case, is the database row with the matching\n**   primary key.\n** \n** <dt>SQLITE_CHANGESET_NOTFOUND<dd>\n**   The conflict handler is invoked with CHANGESET_NOTFOUND as the second\n**   argument when processing a DELETE or UPDATE change if a row with the\n**   required PRIMARY KEY fields is not present in the database.\n** \n**   There is no conflicting row in this case. The results of invoking the\n**   sqlite3changeset_conflict() API are undefined.\n** \n** <dt>SQLITE_CHANGESET_CONFLICT<dd>\n**   CHANGESET_CONFLICT is passed as the second argument to the conflict\n**   handler while processing an INSERT change if the operation would result \n**   in duplicate primary key values.\n** \n**   The conflicting row in this case is the database row with the matching\n**   primary key.\n**\n** <dt>SQLITE_CHANGESET_FOREIGN_KEY<dd>\n**   If foreign key handling is enabled, and applying a changeset leaves the\n**   database in a state containing foreign key violations, the conflict \n**   handler is invoked with CHANGESET_FOREIGN_KEY as the second argument\n**   exactly once before the changeset is committed. If the conflict handler\n**   returns CHANGESET_OMIT, the changes, including those that caused the\n**   foreign key constraint violation, are committed. Or, if it returns\n**   CHANGESET_ABORT, the changeset is rolled back.\n**\n**   No current or conflicting row information is provided. The only function\n**   it is possible to call on the supplied sqlite3_changeset_iter handle\n**   is sqlite3changeset_fk_conflicts().\n** \n** <dt>SQLITE_CHANGESET_CONSTRAINT<dd>\n**   If any other constraint violation occurs while applying a change (i.e. \n**   a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is \n**   invoked with CHANGESET_CONSTRAINT as the second argument.\n** \n**   There is no conflicting row in this case. The results of invoking the\n**   sqlite3changeset_conflict() API are undefined.\n**\n** </dl>\n*/\n#define SQLITE_CHANGESET_DATA        1\n#define SQLITE_CHANGESET_NOTFOUND    2\n#define SQLITE_CHANGESET_CONFLICT    3\n#define SQLITE_CHANGESET_CONSTRAINT  4\n#define SQLITE_CHANGESET_FOREIGN_KEY 5\n\n/* \n** CAPI3REF: Constants Returned By The Conflict Handler\n**\n** A conflict handler callback must return one of the following three values.\n**\n** <dl>\n** <dt>SQLITE_CHANGESET_OMIT<dd>\n**   If a conflict handler returns this value no special action is taken. The\n**   change that caused the conflict is not applied. The session module \n**   continues to the next change in the changeset.\n**\n** <dt>SQLITE_CHANGESET_REPLACE<dd>\n**   This value may only be returned if the second argument to the conflict\n**   handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this\n**   is not the case, any changes applied so far are rolled back and the \n**   call to sqlite3changeset_apply() returns SQLITE_MISUSE.\n**\n**   If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict\n**   handler, then the conflicting row is either updated or deleted, depending\n**   on the type of change.\n**\n**   If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict\n**   handler, then the conflicting row is removed from the database and a\n**   second attempt to apply the change is made. If this second attempt fails,\n**   the original row is restored to the database before continuing.\n**\n** <dt>SQLITE_CHANGESET_ABORT<dd>\n**   If this value is returned, any changes applied so far are rolled back \n**   and the call to sqlite3changeset_apply() returns SQLITE_ABORT.\n** </dl>\n*/\n#define SQLITE_CHANGESET_OMIT       0\n#define SQLITE_CHANGESET_REPLACE    1\n#define SQLITE_CHANGESET_ABORT      2\n\n/*\n** CAPI3REF: Streaming Versions of API functions.\n**\n** The six streaming API xxx_strm() functions serve similar purposes to the \n** corresponding non-streaming API functions:\n**\n** <table border=1 style=\"margin-left:8ex;margin-right:8ex\">\n**   <tr><th>Streaming function<th>Non-streaming equivalent</th>\n**   <tr><td>sqlite3changeset_apply_str<td>[sqlite3changeset_apply] \n**   <tr><td>sqlite3changeset_concat_str<td>[sqlite3changeset_concat] \n**   <tr><td>sqlite3changeset_invert_str<td>[sqlite3changeset_invert] \n**   <tr><td>sqlite3changeset_start_str<td>[sqlite3changeset_start] \n**   <tr><td>sqlite3session_changeset_str<td>[sqlite3session_changeset] \n**   <tr><td>sqlite3session_patchset_str<td>[sqlite3session_patchset] \n** </table>\n**\n** Non-streaming functions that accept changesets (or patchsets) as input\n** require that the entire changeset be stored in a single buffer in memory. \n** Similarly, those that return a changeset or patchset do so by returning \n** a pointer to a single large buffer allocated using sqlite3_malloc(). \n** Normally this is convenient. However, if an application running in a \n** low-memory environment is required to handle very large changesets, the\n** large contiguous memory allocations required can become onerous.\n**\n** In order to avoid this problem, instead of a single large buffer, input\n** is passed to a streaming API functions by way of a callback function that\n** the sessions module invokes to incrementally request input data as it is\n** required. In all cases, a pair of API function parameters such as\n**\n**  <pre>\n**  &nbsp;     int nChangeset,\n**  &nbsp;     void *pChangeset,\n**  </pre>\n**\n** Is replaced by:\n**\n**  <pre>\n**  &nbsp;     int (*xInput)(void *pIn, void *pData, int *pnData),\n**  &nbsp;     void *pIn,\n**  </pre>\n**\n** Each time the xInput callback is invoked by the sessions module, the first\n** argument passed is a copy of the supplied pIn context pointer. The second \n** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no \n** error occurs the xInput method should copy up to (*pnData) bytes of data \n** into the buffer and set (*pnData) to the actual number of bytes copied \n** before returning SQLITE_OK. If the input is completely exhausted, (*pnData) \n** should be set to zero to indicate this. Or, if an error occurs, an SQLite \n** error code should be returned. In all cases, if an xInput callback returns\n** an error, all processing is abandoned and the streaming API function\n** returns a copy of the error code to the caller.\n**\n** In the case of sqlite3changeset_start_strm(), the xInput callback may be\n** invoked by the sessions module at any point during the lifetime of the\n** iterator. If such an xInput callback returns an error, the iterator enters\n** an error state, whereby all subsequent calls to iterator functions \n** immediately fail with the same error code as returned by xInput.\n**\n** Similarly, streaming API functions that return changesets (or patchsets)\n** return them in chunks by way of a callback function instead of via a\n** pointer to a single large buffer. In this case, a pair of parameters such\n** as:\n**\n**  <pre>\n**  &nbsp;     int *pnChangeset,\n**  &nbsp;     void **ppChangeset,\n**  </pre>\n**\n** Is replaced by:\n**\n**  <pre>\n**  &nbsp;     int (*xOutput)(void *pOut, const void *pData, int nData),\n**  &nbsp;     void *pOut\n**  </pre>\n**\n** The xOutput callback is invoked zero or more times to return data to\n** the application. The first parameter passed to each call is a copy of the\n** pOut pointer supplied by the application. The second parameter, pData,\n** points to a buffer nData bytes in size containing the chunk of output\n** data being returned. If the xOutput callback successfully processes the\n** supplied data, it should return SQLITE_OK to indicate success. Otherwise,\n** it should return some other SQLite error code. In this case processing\n** is immediately abandoned and the streaming API function returns a copy\n** of the xOutput error code to the application.\n**\n** The sessions module never invokes an xOutput callback with the third \n** parameter set to a value less than or equal to zero. Other than this,\n** no guarantees are made as to the size of the chunks of data returned.\n*/\nint sqlite3changeset_apply_strm(\n  sqlite3 *db,                    /* Apply change to \"main\" db of this handle */\n  int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */\n  void *pIn,                                          /* First arg for xInput */\n  int(*xFilter)(\n    void *pCtx,                   /* Copy of sixth arg to _apply() */\n    const char *zTab              /* Table name */\n  ),\n  int(*xConflict)(\n    void *pCtx,                   /* Copy of sixth arg to _apply() */\n    int eConflict,                /* DATA, MISSING, CONFLICT, CONSTRAINT */\n    sqlite3_changeset_iter *p     /* Handle describing change and conflict */\n  ),\n  void *pCtx                      /* First argument passed to xConflict */\n);\nint sqlite3changeset_concat_strm(\n  int (*xInputA)(void *pIn, void *pData, int *pnData),\n  void *pInA,\n  int (*xInputB)(void *pIn, void *pData, int *pnData),\n  void *pInB,\n  int (*xOutput)(void *pOut, const void *pData, int nData),\n  void *pOut\n);\nint sqlite3changeset_invert_strm(\n  int (*xInput)(void *pIn, void *pData, int *pnData),\n  void *pIn,\n  int (*xOutput)(void *pOut, const void *pData, int nData),\n  void *pOut\n);\nint sqlite3changeset_start_strm(\n  sqlite3_changeset_iter **pp,\n  int (*xInput)(void *pIn, void *pData, int *pnData),\n  void *pIn\n);\nint sqlite3session_changeset_strm(\n  sqlite3_session *pSession,\n  int (*xOutput)(void *pOut, const void *pData, int nData),\n  void *pOut\n);\nint sqlite3session_patchset_strm(\n  sqlite3_session *pSession,\n  int (*xOutput)(void *pOut, const void *pData, int nData),\n  void *pOut\n);\nint sqlite3changegroup_add_strm(sqlite3_changegroup*, \n    int (*xInput)(void *pIn, void *pData, int *pnData),\n    void *pIn\n);\nint sqlite3changegroup_output_strm(sqlite3_changegroup*,\n    int (*xOutput)(void *pOut, const void *pData, int nData), \n    void *pOut\n);\n\n\n/*\n** Make sure we can call this stuff from C++.\n*/\n#ifdef __cplusplus\n}\n#endif\n\n#endif  /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */\n\n/******** End of sqlite3session.h *********/\n/******** Begin file fts5.h *********/\n/*\n** 2014 May 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** Interfaces to extend FTS5. Using the interfaces defined in this file, \n** FTS5 may be extended with:\n**\n**     * custom tokenizers, and\n**     * custom auxiliary functions.\n*/\n\n\n#ifndef _FTS5_H\n#define _FTS5_H\n\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*************************************************************************\n** CUSTOM AUXILIARY FUNCTIONS\n**\n** Virtual table implementations may overload SQL functions by implementing\n** the sqlite3_module.xFindFunction() method.\n*/\n\ntypedef struct Fts5ExtensionApi Fts5ExtensionApi;\ntypedef struct Fts5Context Fts5Context;\ntypedef struct Fts5PhraseIter Fts5PhraseIter;\n\ntypedef void (*fts5_extension_function)(\n  const Fts5ExtensionApi *pApi,   /* API offered by current FTS version */\n  Fts5Context *pFts,              /* First arg to pass to pApi functions */\n  sqlite3_context *pCtx,          /* Context for returning result/error */\n  int nVal,                       /* Number of values in apVal[] array */\n  sqlite3_value **apVal           /* Array of trailing arguments */\n);\n\nstruct Fts5PhraseIter {\n  const unsigned char *a;\n  const unsigned char *b;\n};\n\n/*\n** EXTENSION API FUNCTIONS\n**\n** xUserData(pFts):\n**   Return a copy of the context pointer the extension function was \n**   registered with.\n**\n** xColumnTotalSize(pFts, iCol, pnToken):\n**   If parameter iCol is less than zero, set output variable *pnToken\n**   to the total number of tokens in the FTS5 table. Or, if iCol is\n**   non-negative but less than the number of columns in the table, return\n**   the total number of tokens in column iCol, considering all rows in \n**   the FTS5 table.\n**\n**   If parameter iCol is greater than or equal to the number of columns\n**   in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.\n**   an OOM condition or IO error), an appropriate SQLite error code is \n**   returned.\n**\n** xColumnCount(pFts):\n**   Return the number of columns in the table.\n**\n** xColumnSize(pFts, iCol, pnToken):\n**   If parameter iCol is less than zero, set output variable *pnToken\n**   to the total number of tokens in the current row. Or, if iCol is\n**   non-negative but less than the number of columns in the table, set\n**   *pnToken to the number of tokens in column iCol of the current row.\n**\n**   If parameter iCol is greater than or equal to the number of columns\n**   in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.\n**   an OOM condition or IO error), an appropriate SQLite error code is \n**   returned.\n**\n**   This function may be quite inefficient if used with an FTS5 table\n**   created with the \"columnsize=0\" option.\n**\n** xColumnText:\n**   This function attempts to retrieve the text of column iCol of the\n**   current document. If successful, (*pz) is set to point to a buffer\n**   containing the text in utf-8 encoding, (*pn) is set to the size in bytes\n**   (not characters) of the buffer and SQLITE_OK is returned. Otherwise,\n**   if an error occurs, an SQLite error code is returned and the final values\n**   of (*pz) and (*pn) are undefined.\n**\n** xPhraseCount:\n**   Returns the number of phrases in the current query expression.\n**\n** xPhraseSize:\n**   Returns the number of tokens in phrase iPhrase of the query. Phrases\n**   are numbered starting from zero.\n**\n** xInstCount:\n**   Set *pnInst to the total number of occurrences of all phrases within\n**   the query within the current row. Return SQLITE_OK if successful, or\n**   an error code (i.e. SQLITE_NOMEM) if an error occurs.\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. If the FTS5 table is created \n**   with either \"detail=none\" or \"detail=column\" and \"content=\" option \n**   (i.e. if it is a contentless table), then this API always returns 0.\n**\n** xInst:\n**   Query for the details of phrase match iIdx within the current row.\n**   Phrase matches are numbered starting from zero, so the iIdx argument\n**   should be greater than or equal to zero and smaller than the value\n**   output by xInstCount().\n**\n**   Usually, output parameter *piPhrase is set to the phrase number, *piCol\n**   to the column in which it occurs and *piOff the token offset of the\n**   first token of the phrase. The exception is if the table was created\n**   with the offsets=0 option specified. In this case *piOff is always\n**   set to -1.\n**\n**   Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM) \n**   if an error occurs.\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. \n**\n** xRowid:\n**   Returns the rowid of the current row.\n**\n** xTokenize:\n**   Tokenize text using the tokenizer belonging to the FTS5 table.\n**\n** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):\n**   This API function is used to query the FTS table for phrase iPhrase\n**   of the current query. Specifically, a query equivalent to:\n**\n**       ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid\n**\n**   with $p set to a phrase equivalent to the phrase iPhrase of the\n**   current query is executed. Any column filter that applies to\n**   phrase iPhrase of the current query is included in $p. For each \n**   row visited, the callback function passed as the fourth argument \n**   is invoked. The context and API objects passed to the callback \n**   function may be used to access the properties of each matched row.\n**   Invoking Api.xUserData() returns a copy of the pointer passed as \n**   the third argument to pUserData.\n**\n**   If the callback function returns any value other than SQLITE_OK, the\n**   query is abandoned and the xQueryPhrase function returns immediately.\n**   If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.\n**   Otherwise, the error code is propagated upwards.\n**\n**   If the query runs to completion without incident, SQLITE_OK is returned.\n**   Or, if some error occurs before the query completes or is aborted by\n**   the callback, an SQLite error code is returned.\n**\n**\n** xSetAuxdata(pFts5, pAux, xDelete)\n**\n**   Save the pointer passed as the second argument as the extension functions \n**   \"auxiliary data\". The pointer may then be retrieved by the current or any\n**   future invocation of the same fts5 extension function made as part of\n**   of the same MATCH query using the xGetAuxdata() API.\n**\n**   Each extension function is allocated a single auxiliary data slot for\n**   each FTS query (MATCH expression). If the extension function is invoked \n**   more than once for a single FTS query, then all invocations share a \n**   single auxiliary data context.\n**\n**   If there is already an auxiliary data pointer when this function is\n**   invoked, then it is replaced by the new pointer. If an xDelete callback\n**   was specified along with the original pointer, it is invoked at this\n**   point.\n**\n**   The xDelete callback, if one is specified, is also invoked on the\n**   auxiliary data pointer after the FTS5 query has finished.\n**\n**   If an error (e.g. an OOM condition) occurs within this function, an\n**   the auxiliary data is set to NULL and an error code returned. If the\n**   xDelete parameter was not NULL, it is invoked on the auxiliary data\n**   pointer before returning.\n**\n**\n** xGetAuxdata(pFts5, bClear)\n**\n**   Returns the current auxiliary data pointer for the fts5 extension \n**   function. See the xSetAuxdata() method for details.\n**\n**   If the bClear argument is non-zero, then the auxiliary data is cleared\n**   (set to NULL) before this function returns. In this case the xDelete,\n**   if any, is not invoked.\n**\n**\n** xRowCount(pFts5, pnRow)\n**\n**   This function is used to retrieve the total number of rows in the table.\n**   In other words, the same value that would be returned by:\n**\n**        SELECT count(*) FROM ftstable;\n**\n** xPhraseFirst()\n**   This function is used, along with type Fts5PhraseIter and the xPhraseNext\n**   method, to iterate through all instances of a single query phrase within\n**   the current row. This is the same information as is accessible via the\n**   xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient\n**   to use, this API may be faster under some circumstances. To iterate \n**   through instances of phrase iPhrase, use the following code:\n**\n**       Fts5PhraseIter iter;\n**       int iCol, iOff;\n**       for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);\n**           iCol>=0;\n**           pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)\n**       ){\n**         // An instance of phrase iPhrase at offset iOff of column iCol\n**       }\n**\n**   The Fts5PhraseIter structure is defined above. Applications should not\n**   modify this structure directly - it should only be used as shown above\n**   with the xPhraseFirst() and xPhraseNext() API methods (and by\n**   xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" or \"detail=column\" option. If the FTS5 table is created \n**   with either \"detail=none\" or \"detail=column\" and \"content=\" option \n**   (i.e. if it is a contentless table), then this API always iterates\n**   through an empty set (all calls to xPhraseFirst() set iCol to -1).\n**\n** xPhraseNext()\n**   See xPhraseFirst above.\n**\n** xPhraseFirstColumn()\n**   This function and xPhraseNextColumn() are similar to the xPhraseFirst()\n**   and xPhraseNext() APIs described above. The difference is that instead\n**   of iterating through all instances of a phrase in the current row, these\n**   APIs are used to iterate through the set of columns in the current row\n**   that contain one or more instances of a specified phrase. For example:\n**\n**       Fts5PhraseIter iter;\n**       int iCol;\n**       for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);\n**           iCol>=0;\n**           pApi->xPhraseNextColumn(pFts, &iter, &iCol)\n**       ){\n**         // Column iCol contains at least one instance of phrase iPhrase\n**       }\n**\n**   This API can be quite slow if used with an FTS5 table created with the\n**   \"detail=none\" option. If the FTS5 table is created with either \n**   \"detail=none\" \"content=\" option (i.e. if it is a contentless table), \n**   then this API always iterates through an empty set (all calls to \n**   xPhraseFirstColumn() set iCol to -1).\n**\n**   The information accessed using this API and its companion\n**   xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext\n**   (or xInst/xInstCount). The chief advantage of this API is that it is\n**   significantly more efficient than those alternatives when used with\n**   \"detail=column\" tables.  \n**\n** xPhraseNextColumn()\n**   See xPhraseFirstColumn above.\n*/\nstruct Fts5ExtensionApi {\n  int iVersion;                   /* Currently always set to 3 */\n\n  void *(*xUserData)(Fts5Context*);\n\n  int (*xColumnCount)(Fts5Context*);\n  int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);\n  int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);\n\n  int (*xTokenize)(Fts5Context*, \n    const char *pText, int nText, /* Text to tokenize */\n    void *pCtx,                   /* Context passed to xToken() */\n    int (*xToken)(void*, int, const char*, int, int, int)       /* Callback */\n  );\n\n  int (*xPhraseCount)(Fts5Context*);\n  int (*xPhraseSize)(Fts5Context*, int iPhrase);\n\n  int (*xInstCount)(Fts5Context*, int *pnInst);\n  int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff);\n\n  sqlite3_int64 (*xRowid)(Fts5Context*);\n  int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn);\n  int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken);\n\n  int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData,\n    int(*)(const Fts5ExtensionApi*,Fts5Context*,void*)\n  );\n  int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));\n  void *(*xGetAuxdata)(Fts5Context*, int bClear);\n\n  int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);\n  void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);\n\n  int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);\n  void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);\n};\n\n/* \n** CUSTOM AUXILIARY FUNCTIONS\n*************************************************************************/\n\n/*************************************************************************\n** CUSTOM TOKENIZERS\n**\n** Applications may also register custom tokenizer types. A tokenizer \n** is registered by providing fts5 with a populated instance of the \n** following structure. All structure methods must be defined, setting\n** any member of the fts5_tokenizer struct to NULL leads to undefined\n** behaviour. The structure methods are expected to function as follows:\n**\n** xCreate:\n**   This function is used to allocate and initialize a tokenizer instance.\n**   A tokenizer instance is required to actually tokenize text.\n**\n**   The first argument passed to this function is a copy of the (void*)\n**   pointer provided by the application when the fts5_tokenizer object\n**   was registered with FTS5 (the third argument to xCreateTokenizer()). \n**   The second and third arguments are an array of nul-terminated strings\n**   containing the tokenizer arguments, if any, specified following the\n**   tokenizer name as part of the CREATE VIRTUAL TABLE statement used\n**   to create the FTS5 table.\n**\n**   The final argument is an output variable. If successful, (*ppOut) \n**   should be set to point to the new tokenizer handle and SQLITE_OK\n**   returned. If an error occurs, some value other than SQLITE_OK should\n**   be returned. In this case, fts5 assumes that the final value of *ppOut \n**   is undefined.\n**\n** xDelete:\n**   This function is invoked to delete a tokenizer handle previously\n**   allocated using xCreate(). Fts5 guarantees that this function will\n**   be invoked exactly once for each successful call to xCreate().\n**\n** xTokenize:\n**   This function is expected to tokenize the nText byte string indicated \n**   by argument pText. pText may or may not be nul-terminated. The first\n**   argument passed to this function is a pointer to an Fts5Tokenizer object\n**   returned by an earlier call to xCreate().\n**\n**   The second argument indicates the reason that FTS5 is requesting\n**   tokenization of the supplied text. This is always one of the following\n**   four values:\n**\n**   <ul><li> <b>FTS5_TOKENIZE_DOCUMENT</b> - A document is being inserted into\n**            or removed from the FTS table. The tokenizer is being invoked to\n**            determine the set of tokens to add to (or delete from) the\n**            FTS index.\n**\n**       <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed \n**            against the FTS index. The tokenizer is being called to tokenize \n**            a bareword or quoted string specified as part of the query.\n**\n**       <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as\n**            FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is\n**            followed by a \"*\" character, indicating that the last token\n**            returned by the tokenizer will be treated as a token prefix.\n**\n**       <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to \n**            satisfy an fts5_api.xTokenize() request made by an auxiliary\n**            function. Or an fts5_api.xColumnSize() request made by the same\n**            on a columnsize=0 database.  \n**   </ul>\n**\n**   For each token in the input string, the supplied callback xToken() must\n**   be invoked. The first argument to it should be a copy of the pointer\n**   passed as the second argument to xTokenize(). The third and fourth\n**   arguments are a pointer to a buffer containing the token text, and the\n**   size of the token in bytes. The 4th and 5th arguments are the byte offsets\n**   of the first byte of and first byte immediately following the text from\n**   which the token is derived within the input.\n**\n**   The second argument passed to the xToken() callback (\"tflags\") should\n**   normally be set to 0. The exception is if the tokenizer supports \n**   synonyms. In this case see the discussion below for details.\n**\n**   FTS5 assumes the xToken() callback is invoked for each token in the \n**   order that they occur within the input text.\n**\n**   If an xToken() callback returns any value other than SQLITE_OK, then\n**   the tokenization should be abandoned and the xTokenize() method should\n**   immediately return a copy of the xToken() return value. Or, if the\n**   input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,\n**   if an error occurs with the xTokenize() implementation itself, it\n**   may abandon the tokenization and return any error code other than\n**   SQLITE_OK or SQLITE_DONE.\n**\n** SYNONYM SUPPORT\n**\n**   Custom tokenizers may also support synonyms. Consider a case in which a\n**   user wishes to query for a phrase such as \"first place\". Using the \n**   built-in tokenizers, the FTS5 query 'first + place' will match instances\n**   of \"first place\" within the document set, but not alternative forms\n**   such as \"1st place\". In some applications, it would be better to match\n**   all instances of \"first place\" or \"1st place\" regardless of which form\n**   the user specified in the MATCH query text.\n**\n**   There are several ways to approach this in FTS5:\n**\n**   <ol><li> By mapping all synonyms to a single token. In this case, the \n**            In the above example, this means that the tokenizer returns the\n**            same token for inputs \"first\" and \"1st\". Say that token is in\n**            fact \"first\", so that when the user inserts the document \"I won\n**            1st place\" entries are added to the index for tokens \"i\", \"won\",\n**            \"first\" and \"place\". If the user then queries for '1st + place',\n**            the tokenizer substitutes \"first\" for \"1st\" and the query works\n**            as expected.\n**\n**       <li> By adding multiple synonyms for a single term to the FTS index.\n**            In this case, when tokenizing query text, the tokenizer may \n**            provide multiple synonyms for a single term within the document.\n**            FTS5 then queries the index for each synonym individually. For\n**            example, faced with the query:\n**\n**   <codeblock>\n**     ... MATCH 'first place'</codeblock>\n**\n**            the tokenizer offers both \"1st\" and \"first\" as synonyms for the\n**            first token in the MATCH query and FTS5 effectively runs a query \n**            similar to:\n**\n**   <codeblock>\n**     ... MATCH '(first OR 1st) place'</codeblock>\n**\n**            except that, for the purposes of auxiliary functions, the query\n**            still appears to contain just two phrases - \"(first OR 1st)\" \n**            being treated as a single phrase.\n**\n**       <li> By adding multiple synonyms for a single term to the FTS index.\n**            Using this method, when tokenizing document text, the tokenizer\n**            provides multiple synonyms for each token. So that when a \n**            document such as \"I won first place\" is tokenized, entries are\n**            added to the FTS index for \"i\", \"won\", \"first\", \"1st\" and\n**            \"place\".\n**\n**            This way, even if the tokenizer does not provide synonyms\n**            when tokenizing query text (it should not - to do would be\n**            inefficient), it doesn't matter if the user queries for \n**            'first + place' or '1st + place', as there are entires in the\n**            FTS index corresponding to both forms of the first token.\n**   </ol>\n**\n**   Whether it is parsing document or query text, any call to xToken that\n**   specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit\n**   is considered to supply a synonym for the previous token. For example,\n**   when parsing the document \"I won first place\", a tokenizer that supports\n**   synonyms would call xToken() 5 times, as follows:\n**\n**   <codeblock>\n**       xToken(pCtx, 0, \"i\",                      1,  0,  1);\n**       xToken(pCtx, 0, \"won\",                    3,  2,  5);\n**       xToken(pCtx, 0, \"first\",                  5,  6, 11);\n**       xToken(pCtx, FTS5_TOKEN_COLOCATED, \"1st\", 3,  6, 11);\n**       xToken(pCtx, 0, \"place\",                  5, 12, 17);\n**</codeblock>\n**\n**   It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time\n**   xToken() is called. Multiple synonyms may be specified for a single token\n**   by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence. \n**   There is no limit to the number of synonyms that may be provided for a\n**   single token.\n**\n**   In many cases, method (1) above is the best approach. It does not add \n**   extra data to the FTS index or require FTS5 to query for multiple terms,\n**   so it is efficient in terms of disk space and query speed. However, it\n**   does not support prefix queries very well. If, as suggested above, the\n**   token \"first\" is subsituted for \"1st\" by the tokenizer, then the query:\n**\n**   <codeblock>\n**     ... MATCH '1s*'</codeblock>\n**\n**   will not match documents that contain the token \"1st\" (as the tokenizer\n**   will probably not map \"1s\" to any prefix of \"first\").\n**\n**   For full prefix support, method (3) may be preferred. In this case, \n**   because the index contains entries for both \"first\" and \"1st\", prefix\n**   queries such as 'fi*' or '1s*' will match correctly. However, because\n**   extra entries are added to the FTS index, this method uses more space\n**   within the database.\n**\n**   Method (2) offers a midpoint between (1) and (3). Using this method,\n**   a query such as '1s*' will match documents that contain the literal \n**   token \"1st\", but not \"first\" (assuming the tokenizer is not able to\n**   provide synonyms for prefixes). However, a non-prefix query like '1st'\n**   will match against \"1st\" and \"first\". This method does not require\n**   extra disk space, as no extra entries are added to the FTS index. \n**   On the other hand, it may require more CPU cycles to run MATCH queries,\n**   as separate queries of the FTS index are required for each synonym.\n**\n**   When using methods (2) or (3), it is important that the tokenizer only\n**   provide synonyms when tokenizing document text (method (2)) or query\n**   text (method (3)), not both. Doing so will not cause any errors, but is\n**   inefficient.\n*/\ntypedef struct Fts5Tokenizer Fts5Tokenizer;\ntypedef struct fts5_tokenizer fts5_tokenizer;\nstruct fts5_tokenizer {\n  int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);\n  void (*xDelete)(Fts5Tokenizer*);\n  int (*xTokenize)(Fts5Tokenizer*, \n      void *pCtx,\n      int flags,            /* Mask of FTS5_TOKENIZE_* flags */\n      const char *pText, int nText, \n      int (*xToken)(\n        void *pCtx,         /* Copy of 2nd argument to xTokenize() */\n        int tflags,         /* Mask of FTS5_TOKEN_* flags */\n        const char *pToken, /* Pointer to buffer containing token */\n        int nToken,         /* Size of token in bytes */\n        int iStart,         /* Byte offset of token within input text */\n        int iEnd            /* Byte offset of end of token within input text */\n      )\n  );\n};\n\n/* Flags that may be passed as the third argument to xTokenize() */\n#define FTS5_TOKENIZE_QUERY     0x0001\n#define FTS5_TOKENIZE_PREFIX    0x0002\n#define FTS5_TOKENIZE_DOCUMENT  0x0004\n#define FTS5_TOKENIZE_AUX       0x0008\n\n/* Flags that may be passed by the tokenizer implementation back to FTS5\n** as the third argument to the supplied xToken callback. */\n#define FTS5_TOKEN_COLOCATED    0x0001      /* Same position as prev. token */\n\n/*\n** END OF CUSTOM TOKENIZERS\n*************************************************************************/\n\n/*************************************************************************\n** FTS5 EXTENSION REGISTRATION API\n*/\ntypedef struct fts5_api fts5_api;\nstruct fts5_api {\n  int iVersion;                   /* Currently always set to 2 */\n\n  /* Create a new tokenizer */\n  int (*xCreateTokenizer)(\n    fts5_api *pApi,\n    const char *zName,\n    void *pContext,\n    fts5_tokenizer *pTokenizer,\n    void (*xDestroy)(void*)\n  );\n\n  /* Find an existing tokenizer */\n  int (*xFindTokenizer)(\n    fts5_api *pApi,\n    const char *zName,\n    void **ppContext,\n    fts5_tokenizer *pTokenizer\n  );\n\n  /* Create a new auxiliary function */\n  int (*xCreateFunction)(\n    fts5_api *pApi,\n    const char *zName,\n    void *pContext,\n    fts5_extension_function xFunction,\n    void (*xDestroy)(void*)\n  );\n};\n\n/*\n** END OF REGISTRATION API\n*************************************************************************/\n\n#ifdef __cplusplus\n}  /* end of the 'extern \"C\"' block */\n#endif\n\n#endif /* _FTS5_H */\n\n/******** End of fts5.h *********/\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/alter.c",
    "content": "/*\n** 2005 February 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains C code routines that used to generate VDBE code\n** that implements the ALTER TABLE command.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** The code in this file only exists if we are not omitting the\n** ALTER TABLE logic from the build.\n*/\n#ifndef SQLITE_OMIT_ALTERTABLE\n\n\n/*\n** This function is used by SQL generated to implement the \n** ALTER TABLE command. The first argument is the text of a CREATE TABLE or\n** CREATE INDEX command. The second is a table name. The table name in \n** the CREATE TABLE or CREATE INDEX statement is replaced with the third\n** argument and the result returned. Examples:\n**\n** sqlite_rename_table('CREATE TABLE abc(a, b, c)', 'def')\n**     -> 'CREATE TABLE def(a, b, c)'\n**\n** sqlite_rename_table('CREATE INDEX i ON abc(a)', 'def')\n**     -> 'CREATE INDEX i ON def(a, b, c)'\n*/\nstatic void renameTableFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **argv\n){\n  unsigned char const *zSql = sqlite3_value_text(argv[0]);\n  unsigned char const *zTableName = sqlite3_value_text(argv[1]);\n\n  int token;\n  Token tname;\n  unsigned char const *zCsr = zSql;\n  int len = 0;\n  char *zRet;\n\n  sqlite3 *db = sqlite3_context_db_handle(context);\n\n  UNUSED_PARAMETER(NotUsed);\n\n  /* The principle used to locate the table name in the CREATE TABLE \n  ** statement is that the table name is the first non-space token that\n  ** is immediately followed by a TK_LP or TK_USING token.\n  */\n  if( zSql ){\n    do {\n      if( !*zCsr ){\n        /* Ran out of input before finding an opening bracket. Return NULL. */\n        return;\n      }\n\n      /* Store the token that zCsr points to in tname. */\n      tname.z = (char*)zCsr;\n      tname.n = len;\n\n      /* Advance zCsr to the next token. Store that token type in 'token',\n      ** and its length in 'len' (to be used next iteration of this loop).\n      */\n      do {\n        zCsr += len;\n        len = sqlite3GetToken(zCsr, &token);\n      } while( token==TK_SPACE );\n      assert( len>0 );\n    } while( token!=TK_LP && token!=TK_USING );\n\n    zRet = sqlite3MPrintf(db, \"%.*s\\\"%w\\\"%s\", (int)(((u8*)tname.z) - zSql),\n       zSql, zTableName, tname.z+tname.n);\n    sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);\n  }\n}\n\n/*\n** This C function implements an SQL user function that is used by SQL code\n** generated by the ALTER TABLE ... RENAME command to modify the definition\n** of any foreign key constraints that use the table being renamed as the \n** parent table. It is passed three arguments:\n**\n**   1) The complete text of the CREATE TABLE statement being modified,\n**   2) The old name of the table being renamed, and\n**   3) The new name of the table being renamed.\n**\n** It returns the new CREATE TABLE statement. For example:\n**\n**   sqlite_rename_parent('CREATE TABLE t1(a REFERENCES t2)', 't2', 't3')\n**       -> 'CREATE TABLE t1(a REFERENCES t3)'\n*/\n#ifndef SQLITE_OMIT_FOREIGN_KEY\nstatic void renameParentFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **argv\n){\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  char *zOutput = 0;\n  char *zResult;\n  unsigned char const *zInput = sqlite3_value_text(argv[0]);\n  unsigned char const *zOld = sqlite3_value_text(argv[1]);\n  unsigned char const *zNew = sqlite3_value_text(argv[2]);\n\n  unsigned const char *z;         /* Pointer to token */\n  int n;                          /* Length of token z */\n  int token;                      /* Type of token */\n\n  UNUSED_PARAMETER(NotUsed);\n  if( zInput==0 || zOld==0 ) return;\n  for(z=zInput; *z; z=z+n){\n    n = sqlite3GetToken(z, &token);\n    if( token==TK_REFERENCES ){\n      char *zParent;\n      do {\n        z += n;\n        n = sqlite3GetToken(z, &token);\n      }while( token==TK_SPACE );\n\n      if( token==TK_ILLEGAL ) break;\n      zParent = sqlite3DbStrNDup(db, (const char *)z, n);\n      if( zParent==0 ) break;\n      sqlite3Dequote(zParent);\n      if( 0==sqlite3StrICmp((const char *)zOld, zParent) ){\n        char *zOut = sqlite3MPrintf(db, \"%s%.*s\\\"%w\\\"\", \n            (zOutput?zOutput:\"\"), (int)(z-zInput), zInput, (const char *)zNew\n        );\n        sqlite3DbFree(db, zOutput);\n        zOutput = zOut;\n        zInput = &z[n];\n      }\n      sqlite3DbFree(db, zParent);\n    }\n  }\n\n  zResult = sqlite3MPrintf(db, \"%s%s\", (zOutput?zOutput:\"\"), zInput), \n  sqlite3_result_text(context, zResult, -1, SQLITE_DYNAMIC);\n  sqlite3DbFree(db, zOutput);\n}\n#endif\n\n#ifndef SQLITE_OMIT_TRIGGER\n/* This function is used by SQL generated to implement the\n** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER \n** statement. The second is a table name. The table name in the CREATE \n** TRIGGER statement is replaced with the third argument and the result \n** returned. This is analagous to renameTableFunc() above, except for CREATE\n** TRIGGER, not CREATE INDEX and CREATE TABLE.\n*/\nstatic void renameTriggerFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **argv\n){\n  unsigned char const *zSql = sqlite3_value_text(argv[0]);\n  unsigned char const *zTableName = sqlite3_value_text(argv[1]);\n\n  int token;\n  Token tname;\n  int dist = 3;\n  unsigned char const *zCsr = zSql;\n  int len = 0;\n  char *zRet;\n  sqlite3 *db = sqlite3_context_db_handle(context);\n\n  UNUSED_PARAMETER(NotUsed);\n\n  /* The principle used to locate the table name in the CREATE TRIGGER \n  ** statement is that the table name is the first token that is immediately\n  ** preceded by either TK_ON or TK_DOT and immediately followed by one\n  ** of TK_WHEN, TK_BEGIN or TK_FOR.\n  */\n  if( zSql ){\n    do {\n\n      if( !*zCsr ){\n        /* Ran out of input before finding the table name. Return NULL. */\n        return;\n      }\n\n      /* Store the token that zCsr points to in tname. */\n      tname.z = (char*)zCsr;\n      tname.n = len;\n\n      /* Advance zCsr to the next token. Store that token type in 'token',\n      ** and its length in 'len' (to be used next iteration of this loop).\n      */\n      do {\n        zCsr += len;\n        len = sqlite3GetToken(zCsr, &token);\n      }while( token==TK_SPACE );\n      assert( len>0 );\n\n      /* Variable 'dist' stores the number of tokens read since the most\n      ** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN \n      ** token is read and 'dist' equals 2, the condition stated above\n      ** to be met.\n      **\n      ** Note that ON cannot be a database, table or column name, so\n      ** there is no need to worry about syntax like \n      ** \"CREATE TRIGGER ... ON ON.ON BEGIN ...\" etc.\n      */\n      dist++;\n      if( token==TK_DOT || token==TK_ON ){\n        dist = 0;\n      }\n    } while( dist!=2 || (token!=TK_WHEN && token!=TK_FOR && token!=TK_BEGIN) );\n\n    /* Variable tname now contains the token that is the old table-name\n    ** in the CREATE TRIGGER statement.\n    */\n    zRet = sqlite3MPrintf(db, \"%.*s\\\"%w\\\"%s\", (int)(((u8*)tname.z) - zSql),\n       zSql, zTableName, tname.z+tname.n);\n    sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);\n  }\n}\n#endif   /* !SQLITE_OMIT_TRIGGER */\n\n/*\n** Register built-in functions used to help implement ALTER TABLE\n*/\nvoid sqlite3AlterFunctions(void){\n  static FuncDef aAlterTableFuncs[] = {\n    FUNCTION(sqlite_rename_table,   2, 0, 0, renameTableFunc),\n#ifndef SQLITE_OMIT_TRIGGER\n    FUNCTION(sqlite_rename_trigger, 2, 0, 0, renameTriggerFunc),\n#endif\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n    FUNCTION(sqlite_rename_parent,  3, 0, 0, renameParentFunc),\n#endif\n  };\n  sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs));\n}\n\n/*\n** This function is used to create the text of expressions of the form:\n**\n**   name=<constant1> OR name=<constant2> OR ...\n**\n** If argument zWhere is NULL, then a pointer string containing the text \n** \"name=<constant>\" is returned, where <constant> is the quoted version\n** of the string passed as argument zConstant. The returned buffer is\n** allocated using sqlite3DbMalloc(). It is the responsibility of the\n** caller to ensure that it is eventually freed.\n**\n** If argument zWhere is not NULL, then the string returned is \n** \"<where> OR name=<constant>\", where <where> is the contents of zWhere.\n** In this case zWhere is passed to sqlite3DbFree() before returning.\n** \n*/\nstatic char *whereOrName(sqlite3 *db, char *zWhere, char *zConstant){\n  char *zNew;\n  if( !zWhere ){\n    zNew = sqlite3MPrintf(db, \"name=%Q\", zConstant);\n  }else{\n    zNew = sqlite3MPrintf(db, \"%s OR name=%Q\", zWhere, zConstant);\n    sqlite3DbFree(db, zWhere);\n  }\n  return zNew;\n}\n\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\n/*\n** Generate the text of a WHERE expression which can be used to select all\n** tables that have foreign key constraints that refer to table pTab (i.e.\n** constraints for which pTab is the parent table) from the sqlite_master\n** table.\n*/\nstatic char *whereForeignKeys(Parse *pParse, Table *pTab){\n  FKey *p;\n  char *zWhere = 0;\n  for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\n    zWhere = whereOrName(pParse->db, zWhere, p->pFrom->zName);\n  }\n  return zWhere;\n}\n#endif\n\n/*\n** Generate the text of a WHERE expression which can be used to select all\n** temporary triggers on table pTab from the sqlite_temp_master table. If\n** table pTab has no temporary triggers, or is itself stored in the \n** temporary database, NULL is returned.\n*/\nstatic char *whereTempTriggers(Parse *pParse, Table *pTab){\n  Trigger *pTrig;\n  char *zWhere = 0;\n  const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */\n\n  /* If the table is not located in the temp-db (in which case NULL is \n  ** returned, loop through the tables list of triggers. For each trigger\n  ** that is not part of the temp-db schema, add a clause to the WHERE \n  ** expression being built up in zWhere.\n  */\n  if( pTab->pSchema!=pTempSchema ){\n    sqlite3 *db = pParse->db;\n    for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){\n      if( pTrig->pSchema==pTempSchema ){\n        zWhere = whereOrName(db, zWhere, pTrig->zName);\n      }\n    }\n  }\n  if( zWhere ){\n    char *zNew = sqlite3MPrintf(pParse->db, \"type='trigger' AND (%s)\", zWhere);\n    sqlite3DbFree(pParse->db, zWhere);\n    zWhere = zNew;\n  }\n  return zWhere;\n}\n\n/*\n** Generate code to drop and reload the internal representation of table\n** pTab from the database, including triggers and temporary triggers.\n** Argument zName is the name of the table in the database schema at\n** the time the generated code is executed. This can be different from\n** pTab->zName if this function is being called to code part of an \n** \"ALTER TABLE RENAME TO\" statement.\n*/\nstatic void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){\n  Vdbe *v;\n  char *zWhere;\n  int iDb;                   /* Index of database containing pTab */\n#ifndef SQLITE_OMIT_TRIGGER\n  Trigger *pTrig;\n#endif\n\n  v = sqlite3GetVdbe(pParse);\n  if( NEVER(v==0) ) return;\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n  assert( iDb>=0 );\n\n#ifndef SQLITE_OMIT_TRIGGER\n  /* Drop any table triggers from the internal schema. */\n  for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){\n    int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);\n    assert( iTrigDb==iDb || iTrigDb==1 );\n    sqlite3VdbeAddOp4(v, OP_DropTrigger, iTrigDb, 0, 0, pTrig->zName, 0);\n  }\n#endif\n\n  /* Drop the table and index from the internal schema.  */\n  sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);\n\n  /* Reload the table, index and permanent trigger schemas. */\n  zWhere = sqlite3MPrintf(pParse->db, \"tbl_name=%Q\", zName);\n  if( !zWhere ) return;\n  sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);\n\n#ifndef SQLITE_OMIT_TRIGGER\n  /* Now, if the table is not stored in the temp database, reload any temp \n  ** triggers. Don't use IN(...) in case SQLITE_OMIT_SUBQUERY is defined. \n  */\n  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){\n    sqlite3VdbeAddParseSchemaOp(v, 1, zWhere);\n  }\n#endif\n}\n\n/*\n** Parameter zName is the name of a table that is about to be altered\n** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN).\n** If the table is a system table, this function leaves an error message\n** in pParse->zErr (system tables may not be altered) and returns non-zero.\n**\n** Or, if zName is not a system table, zero is returned.\n*/\nstatic int isSystemTable(Parse *pParse, const char *zName){\n  if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, \"sqlite_\", 7) ){\n    sqlite3ErrorMsg(pParse, \"table %s may not be altered\", zName);\n    return 1;\n  }\n  return 0;\n}\n\n/*\n** Generate code to implement the \"ALTER TABLE xxx RENAME TO yyy\" \n** command. \n*/\nvoid sqlite3AlterRenameTable(\n  Parse *pParse,            /* Parser context. */\n  SrcList *pSrc,            /* The table to rename. */\n  Token *pName              /* The new table name. */\n){\n  int iDb;                  /* Database that contains the table */\n  char *zDb;                /* Name of database iDb */\n  Table *pTab;              /* Table being renamed */\n  char *zName = 0;          /* NULL-terminated version of pName */ \n  sqlite3 *db = pParse->db; /* Database connection */\n  int nTabName;             /* Number of UTF-8 characters in zTabName */\n  const char *zTabName;     /* Original name of the table */\n  Vdbe *v;\n#ifndef SQLITE_OMIT_TRIGGER\n  char *zWhere = 0;         /* Where clause to locate temp triggers */\n#endif\n  VTable *pVTab = 0;        /* Non-zero if this is a v-tab with an xRename() */\n  int savedDbFlags;         /* Saved value of db->flags */\n\n  savedDbFlags = db->flags;  \n  if( NEVER(db->mallocFailed) ) goto exit_rename_table;\n  assert( pSrc->nSrc==1 );\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\n\n  pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);\n  if( !pTab ) goto exit_rename_table;\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n  zDb = db->aDb[iDb].zDbSName;\n  db->flags |= SQLITE_PreferBuiltin;\n\n  /* Get a NULL terminated version of the new table name. */\n  zName = sqlite3NameFromToken(db, pName);\n  if( !zName ) goto exit_rename_table;\n\n  /* Check that a table or index named 'zName' does not already exist\n  ** in database iDb. If so, this is an error.\n  */\n  if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){\n    sqlite3ErrorMsg(pParse, \n        \"there is already another table or index with this name: %s\", zName);\n    goto exit_rename_table;\n  }\n\n  /* Make sure it is not a system table being altered, or a reserved name\n  ** that the table is being renamed to.\n  */\n  if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){\n    goto exit_rename_table;\n  }\n  if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto\n    exit_rename_table;\n  }\n\n#ifndef SQLITE_OMIT_VIEW\n  if( pTab->pSelect ){\n    sqlite3ErrorMsg(pParse, \"view %s may not be altered\", pTab->zName);\n    goto exit_rename_table;\n  }\n#endif\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  /* Invoke the authorization callback. */\n  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){\n    goto exit_rename_table;\n  }\n#endif\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\n    goto exit_rename_table;\n  }\n  if( IsVirtual(pTab) ){\n    pVTab = sqlite3GetVTable(db, pTab);\n    if( pVTab->pVtab->pModule->xRename==0 ){\n      pVTab = 0;\n    }\n  }\n#endif\n\n  /* Begin a transaction for database iDb. \n  ** Then modify the schema cookie (since the ALTER TABLE modifies the\n  ** schema). Open a statement transaction if the table is a virtual\n  ** table.\n  */\n  v = sqlite3GetVdbe(pParse);\n  if( v==0 ){\n    goto exit_rename_table;\n  }\n  sqlite3BeginWriteOperation(pParse, pVTab!=0, iDb);\n  sqlite3ChangeCookie(pParse, iDb);\n\n  /* If this is a virtual table, invoke the xRename() function if\n  ** one is defined. The xRename() callback will modify the names\n  ** of any resources used by the v-table implementation (including other\n  ** SQLite tables) that are identified by the name of the virtual table.\n  */\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( pVTab ){\n    int i = ++pParse->nMem;\n    sqlite3VdbeLoadString(v, i, zName);\n    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);\n    sqlite3MayAbort(pParse);\n  }\n#endif\n\n  /* figure out how many UTF-8 characters are in zName */\n  zTabName = pTab->zName;\n  nTabName = sqlite3Utf8CharLen(zTabName, -1);\n\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\n  if( db->flags&SQLITE_ForeignKeys ){\n    /* If foreign-key support is enabled, rewrite the CREATE TABLE \n    ** statements corresponding to all child tables of foreign key constraints\n    ** for which the renamed table is the parent table.  */\n    if( (zWhere=whereForeignKeys(pParse, pTab))!=0 ){\n      sqlite3NestedParse(pParse, \n          \"UPDATE \\\"%w\\\".%s SET \"\n              \"sql = sqlite_rename_parent(sql, %Q, %Q) \"\n              \"WHERE %s;\", zDb, SCHEMA_TABLE(iDb), zTabName, zName, zWhere);\n      sqlite3DbFree(db, zWhere);\n    }\n  }\n#endif\n\n  /* Modify the sqlite_master table to use the new table name. */\n  sqlite3NestedParse(pParse,\n      \"UPDATE %Q.%s SET \"\n#ifdef SQLITE_OMIT_TRIGGER\n          \"sql = sqlite_rename_table(sql, %Q), \"\n#else\n          \"sql = CASE \"\n            \"WHEN type = 'trigger' THEN sqlite_rename_trigger(sql, %Q)\"\n            \"ELSE sqlite_rename_table(sql, %Q) END, \"\n#endif\n          \"tbl_name = %Q, \"\n          \"name = CASE \"\n            \"WHEN type='table' THEN %Q \"\n            \"WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN \"\n             \"'sqlite_autoindex_' || %Q || substr(name,%d+18) \"\n            \"ELSE name END \"\n      \"WHERE tbl_name=%Q COLLATE nocase AND \"\n          \"(type='table' OR type='index' OR type='trigger');\", \n      zDb, SCHEMA_TABLE(iDb), zName, zName, zName, \n#ifndef SQLITE_OMIT_TRIGGER\n      zName,\n#endif\n      zName, nTabName, zTabName\n  );\n\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n  /* If the sqlite_sequence table exists in this database, then update \n  ** it with the new table name.\n  */\n  if( sqlite3FindTable(db, \"sqlite_sequence\", zDb) ){\n    sqlite3NestedParse(pParse,\n        \"UPDATE \\\"%w\\\".sqlite_sequence set name = %Q WHERE name = %Q\",\n        zDb, zName, pTab->zName);\n  }\n#endif\n\n#ifndef SQLITE_OMIT_TRIGGER\n  /* If there are TEMP triggers on this table, modify the sqlite_temp_master\n  ** table. Don't do this if the table being ALTERed is itself located in\n  ** the temp database.\n  */\n  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){\n    sqlite3NestedParse(pParse, \n        \"UPDATE sqlite_temp_master SET \"\n            \"sql = sqlite_rename_trigger(sql, %Q), \"\n            \"tbl_name = %Q \"\n            \"WHERE %s;\", zName, zName, zWhere);\n    sqlite3DbFree(db, zWhere);\n  }\n#endif\n\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\n  if( db->flags&SQLITE_ForeignKeys ){\n    FKey *p;\n    for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\n      Table *pFrom = p->pFrom;\n      if( pFrom!=pTab ){\n        reloadTableSchema(pParse, p->pFrom, pFrom->zName);\n      }\n    }\n  }\n#endif\n\n  /* Drop and reload the internal table schema. */\n  reloadTableSchema(pParse, pTab, zName);\n\nexit_rename_table:\n  sqlite3SrcListDelete(db, pSrc);\n  sqlite3DbFree(db, zName);\n  db->flags = savedDbFlags;\n}\n\n/*\n** This function is called after an \"ALTER TABLE ... ADD\" statement\n** has been parsed. Argument pColDef contains the text of the new\n** column definition.\n**\n** The Table structure pParse->pNewTable was extended to include\n** the new column during parsing.\n*/\nvoid sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){\n  Table *pNew;              /* Copy of pParse->pNewTable */\n  Table *pTab;              /* Table being altered */\n  int iDb;                  /* Database number */\n  const char *zDb;          /* Database name */\n  const char *zTab;         /* Table name */\n  char *zCol;               /* Null-terminated column definition */\n  Column *pCol;             /* The new column */\n  Expr *pDflt;              /* Default value for the new column */\n  sqlite3 *db;              /* The database connection; */\n  Vdbe *v = pParse->pVdbe;  /* The prepared statement under construction */\n  int r1;                   /* Temporary registers */\n\n  db = pParse->db;\n  if( pParse->nErr || db->mallocFailed ) return;\n  assert( v!=0 );\n  pNew = pParse->pNewTable;\n  assert( pNew );\n\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\n  iDb = sqlite3SchemaToIndex(db, pNew->pSchema);\n  zDb = db->aDb[iDb].zDbSName;\n  zTab = &pNew->zName[16];  /* Skip the \"sqlite_altertab_\" prefix on the name */\n  pCol = &pNew->aCol[pNew->nCol-1];\n  pDflt = pCol->pDflt;\n  pTab = sqlite3FindTable(db, zTab, zDb);\n  assert( pTab );\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  /* Invoke the authorization callback. */\n  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){\n    return;\n  }\n#endif\n\n  /* If the default value for the new column was specified with a \n  ** literal NULL, then set pDflt to 0. This simplifies checking\n  ** for an SQL NULL default below.\n  */\n  assert( pDflt==0 || pDflt->op==TK_SPAN );\n  if( pDflt && pDflt->pLeft->op==TK_NULL ){\n    pDflt = 0;\n  }\n\n  /* Check that the new column is not specified as PRIMARY KEY or UNIQUE.\n  ** If there is a NOT NULL constraint, then the default value for the\n  ** column must not be NULL.\n  */\n  if( pCol->colFlags & COLFLAG_PRIMKEY ){\n    sqlite3ErrorMsg(pParse, \"Cannot add a PRIMARY KEY column\");\n    return;\n  }\n  if( pNew->pIndex ){\n    sqlite3ErrorMsg(pParse, \"Cannot add a UNIQUE column\");\n    return;\n  }\n  if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){\n    sqlite3ErrorMsg(pParse, \n        \"Cannot add a REFERENCES column with non-NULL default value\");\n    return;\n  }\n  if( pCol->notNull && !pDflt ){\n    sqlite3ErrorMsg(pParse, \n        \"Cannot add a NOT NULL column with default value NULL\");\n    return;\n  }\n\n  /* Ensure the default expression is something that sqlite3ValueFromExpr()\n  ** can handle (i.e. not CURRENT_TIME etc.)\n  */\n  if( pDflt ){\n    sqlite3_value *pVal = 0;\n    int rc;\n    rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_BLOB, &pVal);\n    assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );\n    if( rc!=SQLITE_OK ){\n      assert( db->mallocFailed == 1 );\n      return;\n    }\n    if( !pVal ){\n      sqlite3ErrorMsg(pParse, \"Cannot add a column with non-constant default\");\n      return;\n    }\n    sqlite3ValueFree(pVal);\n  }\n\n  /* Modify the CREATE TABLE statement. */\n  zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);\n  if( zCol ){\n    char *zEnd = &zCol[pColDef->n-1];\n    int savedDbFlags = db->flags;\n    while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){\n      *zEnd-- = '\\0';\n    }\n    db->flags |= SQLITE_PreferBuiltin;\n    sqlite3NestedParse(pParse, \n        \"UPDATE \\\"%w\\\".%s SET \"\n          \"sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) \"\n        \"WHERE type = 'table' AND name = %Q\", \n      zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,\n      zTab\n    );\n    sqlite3DbFree(db, zCol);\n    db->flags = savedDbFlags;\n  }\n\n  /* Make sure the schema version is at least 3.  But do not upgrade\n  ** from less than 3 to 4, as that will corrupt any preexisting DESC\n  ** index.\n  */\n  r1 = sqlite3GetTempReg(pParse);\n  sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT);\n  sqlite3VdbeUsesBtree(v, iDb);\n  sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2);\n  sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2);\n  VdbeCoverage(v);\n  sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3);\n  sqlite3ReleaseTempReg(pParse, r1);\n\n  /* Reload the schema of the modified table. */\n  reloadTableSchema(pParse, pTab, pTab->zName);\n}\n\n/*\n** This function is called by the parser after the table-name in\n** an \"ALTER TABLE <table-name> ADD\" statement is parsed. Argument \n** pSrc is the full-name of the table being altered.\n**\n** This routine makes a (partial) copy of the Table structure\n** for the table being altered and sets Parse.pNewTable to point\n** to it. Routines called by the parser as the column definition\n** is parsed (i.e. sqlite3AddColumn()) add the new Column data to \n** the copy. The copy of the Table structure is deleted by tokenize.c \n** after parsing is finished.\n**\n** Routine sqlite3AlterFinishAddColumn() will be called to complete\n** coding the \"ALTER TABLE ... ADD\" statement.\n*/\nvoid sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){\n  Table *pNew;\n  Table *pTab;\n  Vdbe *v;\n  int iDb;\n  int i;\n  int nAlloc;\n  sqlite3 *db = pParse->db;\n\n  /* Look up the table being altered. */\n  assert( pParse->pNewTable==0 );\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\n  if( db->mallocFailed ) goto exit_begin_add_column;\n  pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);\n  if( !pTab ) goto exit_begin_add_column;\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( IsVirtual(pTab) ){\n    sqlite3ErrorMsg(pParse, \"virtual tables may not be altered\");\n    goto exit_begin_add_column;\n  }\n#endif\n\n  /* Make sure this is not an attempt to ALTER a view. */\n  if( pTab->pSelect ){\n    sqlite3ErrorMsg(pParse, \"Cannot add a column to a view\");\n    goto exit_begin_add_column;\n  }\n  if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){\n    goto exit_begin_add_column;\n  }\n\n  assert( pTab->addColOffset>0 );\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n\n  /* Put a copy of the Table struct in Parse.pNewTable for the\n  ** sqlite3AddColumn() function and friends to modify.  But modify\n  ** the name by adding an \"sqlite_altertab_\" prefix.  By adding this\n  ** prefix, we insure that the name will not collide with an existing\n  ** table because user table are not allowed to have the \"sqlite_\"\n  ** prefix on their name.\n  */\n  pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table));\n  if( !pNew ) goto exit_begin_add_column;\n  pParse->pNewTable = pNew;\n  pNew->nRef = 1;\n  pNew->nCol = pTab->nCol;\n  assert( pNew->nCol>0 );\n  nAlloc = (((pNew->nCol-1)/8)*8)+8;\n  assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 );\n  pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc);\n  pNew->zName = sqlite3MPrintf(db, \"sqlite_altertab_%s\", pTab->zName);\n  if( !pNew->aCol || !pNew->zName ){\n    assert( db->mallocFailed );\n    goto exit_begin_add_column;\n  }\n  memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol);\n  for(i=0; i<pNew->nCol; i++){\n    Column *pCol = &pNew->aCol[i];\n    pCol->zName = sqlite3DbStrDup(db, pCol->zName);\n    pCol->zColl = 0;\n    pCol->pDflt = 0;\n  }\n  pNew->pSchema = db->aDb[iDb].pSchema;\n  pNew->addColOffset = pTab->addColOffset;\n  pNew->nRef = 1;\n\n  /* Begin a transaction and increment the schema cookie.  */\n  sqlite3BeginWriteOperation(pParse, 0, iDb);\n  v = sqlite3GetVdbe(pParse);\n  if( !v ) goto exit_begin_add_column;\n  sqlite3ChangeCookie(pParse, iDb);\n\nexit_begin_add_column:\n  sqlite3SrcListDelete(db, pSrc);\n  return;\n}\n#endif  /* SQLITE_ALTER_TABLE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/analyze.c",
    "content": "/*\n** 2005-07-08\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code associated with the ANALYZE command.\n**\n** The ANALYZE command gather statistics about the content of tables\n** and indices.  These statistics are made available to the query planner\n** to help it make better decisions about how to perform queries.\n**\n** The following system tables are or have been supported:\n**\n**    CREATE TABLE sqlite_stat1(tbl, idx, stat);\n**    CREATE TABLE sqlite_stat2(tbl, idx, sampleno, sample);\n**    CREATE TABLE sqlite_stat3(tbl, idx, nEq, nLt, nDLt, sample);\n**    CREATE TABLE sqlite_stat4(tbl, idx, nEq, nLt, nDLt, sample);\n**\n** Additional tables might be added in future releases of SQLite.\n** The sqlite_stat2 table is not created or used unless the SQLite version\n** is between 3.6.18 and 3.7.8, inclusive, and unless SQLite is compiled\n** with SQLITE_ENABLE_STAT2.  The sqlite_stat2 table is deprecated.\n** The sqlite_stat2 table is superseded by sqlite_stat3, which is only\n** created and used by SQLite versions 3.7.9 and later and with\n** SQLITE_ENABLE_STAT3 defined.  The functionality of sqlite_stat3\n** is a superset of sqlite_stat2.  The sqlite_stat4 is an enhanced\n** version of sqlite_stat3 and is only available when compiled with\n** SQLITE_ENABLE_STAT4 and in SQLite versions 3.8.1 and later.  It is\n** not possible to enable both STAT3 and STAT4 at the same time.  If they\n** are both enabled, then STAT4 takes precedence.\n**\n** For most applications, sqlite_stat1 provides all the statistics required\n** for the query planner to make good choices.\n**\n** Format of sqlite_stat1:\n**\n** There is normally one row per index, with the index identified by the\n** name in the idx column.  The tbl column is the name of the table to\n** which the index belongs.  In each such row, the stat column will be\n** a string consisting of a list of integers.  The first integer in this\n** list is the number of rows in the index.  (This is the same as the\n** number of rows in the table, except for partial indices.)  The second\n** integer is the average number of rows in the index that have the same\n** value in the first column of the index.  The third integer is the average\n** number of rows in the index that have the same value for the first two\n** columns.  The N-th integer (for N>1) is the average number of rows in \n** the index which have the same value for the first N-1 columns.  For\n** a K-column index, there will be K+1 integers in the stat column.  If\n** the index is unique, then the last integer will be 1.\n**\n** The list of integers in the stat column can optionally be followed\n** by the keyword \"unordered\".  The \"unordered\" keyword, if it is present,\n** must be separated from the last integer by a single space.  If the\n** \"unordered\" keyword is present, then the query planner assumes that\n** the index is unordered and will not use the index for a range query.\n** \n** If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat\n** column contains a single integer which is the (estimated) number of\n** rows in the table identified by sqlite_stat1.tbl.\n**\n** Format of sqlite_stat2:\n**\n** The sqlite_stat2 is only created and is only used if SQLite is compiled\n** with SQLITE_ENABLE_STAT2 and if the SQLite version number is between\n** 3.6.18 and 3.7.8.  The \"stat2\" table contains additional information\n** about the distribution of keys within an index.  The index is identified by\n** the \"idx\" column and the \"tbl\" column is the name of the table to which\n** the index belongs.  There are usually 10 rows in the sqlite_stat2\n** table for each index.\n**\n** The sqlite_stat2 entries for an index that have sampleno between 0 and 9\n** inclusive are samples of the left-most key value in the index taken at\n** evenly spaced points along the index.  Let the number of samples be S\n** (10 in the standard build) and let C be the number of rows in the index.\n** Then the sampled rows are given by:\n**\n**     rownumber = (i*C*2 + C)/(S*2)\n**\n** For i between 0 and S-1.  Conceptually, the index space is divided into\n** S uniform buckets and the samples are the middle row from each bucket.\n**\n** The format for sqlite_stat2 is recorded here for legacy reference.  This\n** version of SQLite does not support sqlite_stat2.  It neither reads nor\n** writes the sqlite_stat2 table.  This version of SQLite only supports\n** sqlite_stat3.\n**\n** Format for sqlite_stat3:\n**\n** The sqlite_stat3 format is a subset of sqlite_stat4.  Hence, the\n** sqlite_stat4 format will be described first.  Further information\n** about sqlite_stat3 follows the sqlite_stat4 description.\n**\n** Format for sqlite_stat4:\n**\n** As with sqlite_stat2, the sqlite_stat4 table contains histogram data\n** to aid the query planner in choosing good indices based on the values\n** that indexed columns are compared against in the WHERE clauses of\n** queries.\n**\n** The sqlite_stat4 table contains multiple entries for each index.\n** The idx column names the index and the tbl column is the table of the\n** index.  If the idx and tbl columns are the same, then the sample is\n** of the INTEGER PRIMARY KEY.  The sample column is a blob which is the\n** binary encoding of a key from the index.  The nEq column is a\n** list of integers.  The first integer is the approximate number\n** of entries in the index whose left-most column exactly matches\n** the left-most column of the sample.  The second integer in nEq\n** is the approximate number of entries in the index where the\n** first two columns match the first two columns of the sample.\n** And so forth.  nLt is another list of integers that show the approximate\n** number of entries that are strictly less than the sample.  The first\n** integer in nLt contains the number of entries in the index where the\n** left-most column is less than the left-most column of the sample.\n** The K-th integer in the nLt entry is the number of index entries \n** where the first K columns are less than the first K columns of the\n** sample.  The nDLt column is like nLt except that it contains the \n** number of distinct entries in the index that are less than the\n** sample.\n**\n** There can be an arbitrary number of sqlite_stat4 entries per index.\n** The ANALYZE command will typically generate sqlite_stat4 tables\n** that contain between 10 and 40 samples which are distributed across\n** the key space, though not uniformly, and which include samples with\n** large nEq values.\n**\n** Format for sqlite_stat3 redux:\n**\n** The sqlite_stat3 table is like sqlite_stat4 except that it only\n** looks at the left-most column of the index.  The sqlite_stat3.sample\n** column contains the actual value of the left-most column instead\n** of a blob encoding of the complete index key as is found in\n** sqlite_stat4.sample.  The nEq, nLt, and nDLt entries of sqlite_stat3\n** all contain just a single integer which is the same as the first\n** integer in the equivalent columns in sqlite_stat4.\n*/\n#ifndef SQLITE_OMIT_ANALYZE\n#include \"sqliteInt.h\"\n\n#if defined(SQLITE_ENABLE_STAT4)\n# define IsStat4     1\n# define IsStat3     0\n#elif defined(SQLITE_ENABLE_STAT3)\n# define IsStat4     0\n# define IsStat3     1\n#else\n# define IsStat4     0\n# define IsStat3     0\n# undef SQLITE_STAT4_SAMPLES\n# define SQLITE_STAT4_SAMPLES 1\n#endif\n#define IsStat34    (IsStat3+IsStat4)  /* 1 for STAT3 or STAT4. 0 otherwise */\n\n/*\n** This routine generates code that opens the sqlite_statN tables.\n** The sqlite_stat1 table is always relevant.  sqlite_stat2 is now\n** obsolete.  sqlite_stat3 and sqlite_stat4 are only opened when\n** appropriate compile-time options are provided.\n**\n** If the sqlite_statN tables do not previously exist, it is created.\n**\n** Argument zWhere may be a pointer to a buffer containing a table name,\n** or it may be a NULL pointer. If it is not NULL, then all entries in\n** the sqlite_statN tables associated with the named table are deleted.\n** If zWhere==0, then code is generated to delete all stat table entries.\n*/\nstatic void openStatTable(\n  Parse *pParse,          /* Parsing context */\n  int iDb,                /* The database we are looking in */\n  int iStatCur,           /* Open the sqlite_stat1 table on this cursor */\n  const char *zWhere,     /* Delete entries for this table or index */\n  const char *zWhereType  /* Either \"tbl\" or \"idx\" */\n){\n  static const struct {\n    const char *zName;\n    const char *zCols;\n  } aTable[] = {\n    { \"sqlite_stat1\", \"tbl,idx,stat\" },\n#if defined(SQLITE_ENABLE_STAT4)\n    { \"sqlite_stat4\", \"tbl,idx,neq,nlt,ndlt,sample\" },\n    { \"sqlite_stat3\", 0 },\n#elif defined(SQLITE_ENABLE_STAT3)\n    { \"sqlite_stat3\", \"tbl,idx,neq,nlt,ndlt,sample\" },\n    { \"sqlite_stat4\", 0 },\n#else\n    { \"sqlite_stat3\", 0 },\n    { \"sqlite_stat4\", 0 },\n#endif\n  };\n  int i;\n  sqlite3 *db = pParse->db;\n  Db *pDb;\n  Vdbe *v = sqlite3GetVdbe(pParse);\n  int aRoot[ArraySize(aTable)];\n  u8 aCreateTbl[ArraySize(aTable)];\n\n  if( v==0 ) return;\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\n  assert( sqlite3VdbeDb(v)==db );\n  pDb = &db->aDb[iDb];\n\n  /* Create new statistic tables if they do not exist, or clear them\n  ** if they do already exist.\n  */\n  for(i=0; i<ArraySize(aTable); i++){\n    const char *zTab = aTable[i].zName;\n    Table *pStat;\n    if( (pStat = sqlite3FindTable(db, zTab, pDb->zDbSName))==0 ){\n      if( aTable[i].zCols ){\n        /* The sqlite_statN table does not exist. Create it. Note that a \n        ** side-effect of the CREATE TABLE statement is to leave the rootpage \n        ** of the new table in register pParse->regRoot. This is important \n        ** because the OpenWrite opcode below will be needing it. */\n        sqlite3NestedParse(pParse,\n            \"CREATE TABLE %Q.%s(%s)\", pDb->zDbSName, zTab, aTable[i].zCols\n        );\n        aRoot[i] = pParse->regRoot;\n        aCreateTbl[i] = OPFLAG_P2ISREG;\n      }\n    }else{\n      /* The table already exists. If zWhere is not NULL, delete all entries \n      ** associated with the table zWhere. If zWhere is NULL, delete the\n      ** entire contents of the table. */\n      aRoot[i] = pStat->tnum;\n      aCreateTbl[i] = 0;\n      sqlite3TableLock(pParse, iDb, aRoot[i], 1, zTab);\n      if( zWhere ){\n        sqlite3NestedParse(pParse,\n           \"DELETE FROM %Q.%s WHERE %s=%Q\",\n           pDb->zDbSName, zTab, zWhereType, zWhere\n        );\n      }else{\n        /* The sqlite_stat[134] table already exists.  Delete all rows. */\n        sqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], iDb);\n      }\n    }\n  }\n\n  /* Open the sqlite_stat[134] tables for writing. */\n  for(i=0; aTable[i].zCols; i++){\n    assert( i<ArraySize(aTable) );\n    sqlite3VdbeAddOp4Int(v, OP_OpenWrite, iStatCur+i, aRoot[i], iDb, 3);\n    sqlite3VdbeChangeP5(v, aCreateTbl[i]);\n    VdbeComment((v, aTable[i].zName));\n  }\n}\n\n/*\n** Recommended number of samples for sqlite_stat4\n*/\n#ifndef SQLITE_STAT4_SAMPLES\n# define SQLITE_STAT4_SAMPLES 24\n#endif\n\n/*\n** Three SQL functions - stat_init(), stat_push(), and stat_get() -\n** share an instance of the following structure to hold their state\n** information.\n*/\ntypedef struct Stat4Accum Stat4Accum;\ntypedef struct Stat4Sample Stat4Sample;\nstruct Stat4Sample {\n  tRowcnt *anEq;                  /* sqlite_stat4.nEq */\n  tRowcnt *anDLt;                 /* sqlite_stat4.nDLt */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  tRowcnt *anLt;                  /* sqlite_stat4.nLt */\n  union {\n    i64 iRowid;                     /* Rowid in main table of the key */\n    u8 *aRowid;                     /* Key for WITHOUT ROWID tables */\n  } u;\n  u32 nRowid;                     /* Sizeof aRowid[] */\n  u8 isPSample;                   /* True if a periodic sample */\n  int iCol;                       /* If !isPSample, the reason for inclusion */\n  u32 iHash;                      /* Tiebreaker hash */\n#endif\n};                                                    \nstruct Stat4Accum {\n  tRowcnt nRow;             /* Number of rows in the entire table */\n  tRowcnt nPSample;         /* How often to do a periodic sample */\n  int nCol;                 /* Number of columns in index + pk/rowid */\n  int nKeyCol;              /* Number of index columns w/o the pk/rowid */\n  int mxSample;             /* Maximum number of samples to accumulate */\n  Stat4Sample current;      /* Current row as a Stat4Sample */\n  u32 iPrn;                 /* Pseudo-random number used for sampling */\n  Stat4Sample *aBest;       /* Array of nCol best samples */\n  int iMin;                 /* Index in a[] of entry with minimum score */\n  int nSample;              /* Current number of samples */\n  int iGet;                 /* Index of current sample accessed by stat_get() */\n  Stat4Sample *a;           /* Array of mxSample Stat4Sample objects */\n  sqlite3 *db;              /* Database connection, for malloc() */\n};\n\n/* Reclaim memory used by a Stat4Sample\n*/\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\nstatic void sampleClear(sqlite3 *db, Stat4Sample *p){\n  assert( db!=0 );\n  if( p->nRowid ){\n    sqlite3DbFree(db, p->u.aRowid);\n    p->nRowid = 0;\n  }\n}\n#endif\n\n/* Initialize the BLOB value of a ROWID\n*/\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\nstatic void sampleSetRowid(sqlite3 *db, Stat4Sample *p, int n, const u8 *pData){\n  assert( db!=0 );\n  if( p->nRowid ) sqlite3DbFree(db, p->u.aRowid);\n  p->u.aRowid = sqlite3DbMallocRawNN(db, n);\n  if( p->u.aRowid ){\n    p->nRowid = n;\n    memcpy(p->u.aRowid, pData, n);\n  }else{\n    p->nRowid = 0;\n  }\n}\n#endif\n\n/* Initialize the INTEGER value of a ROWID.\n*/\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\nstatic void sampleSetRowidInt64(sqlite3 *db, Stat4Sample *p, i64 iRowid){\n  assert( db!=0 );\n  if( p->nRowid ) sqlite3DbFree(db, p->u.aRowid);\n  p->nRowid = 0;\n  p->u.iRowid = iRowid;\n}\n#endif\n\n\n/*\n** Copy the contents of object (*pFrom) into (*pTo).\n*/\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\nstatic void sampleCopy(Stat4Accum *p, Stat4Sample *pTo, Stat4Sample *pFrom){\n  pTo->isPSample = pFrom->isPSample;\n  pTo->iCol = pFrom->iCol;\n  pTo->iHash = pFrom->iHash;\n  memcpy(pTo->anEq, pFrom->anEq, sizeof(tRowcnt)*p->nCol);\n  memcpy(pTo->anLt, pFrom->anLt, sizeof(tRowcnt)*p->nCol);\n  memcpy(pTo->anDLt, pFrom->anDLt, sizeof(tRowcnt)*p->nCol);\n  if( pFrom->nRowid ){\n    sampleSetRowid(p->db, pTo, pFrom->nRowid, pFrom->u.aRowid);\n  }else{\n    sampleSetRowidInt64(p->db, pTo, pFrom->u.iRowid);\n  }\n}\n#endif\n\n/*\n** Reclaim all memory of a Stat4Accum structure.\n*/\nstatic void stat4Destructor(void *pOld){\n  Stat4Accum *p = (Stat4Accum*)pOld;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  int i;\n  for(i=0; i<p->nCol; i++) sampleClear(p->db, p->aBest+i);\n  for(i=0; i<p->mxSample; i++) sampleClear(p->db, p->a+i);\n  sampleClear(p->db, &p->current);\n#endif\n  sqlite3DbFree(p->db, p);\n}\n\n/*\n** Implementation of the stat_init(N,K,C) SQL function. The three parameters\n** are:\n**     N:    The number of columns in the index including the rowid/pk (note 1)\n**     K:    The number of columns in the index excluding the rowid/pk.\n**     C:    The number of rows in the index (note 2)\n**\n** Note 1:  In the special case of the covering index that implements a\n** WITHOUT ROWID table, N is the number of PRIMARY KEY columns, not the\n** total number of columns in the table.\n**\n** Note 2:  C is only used for STAT3 and STAT4.\n**\n** For indexes on ordinary rowid tables, N==K+1.  But for indexes on\n** WITHOUT ROWID tables, N=K+P where P is the number of columns in the\n** PRIMARY KEY of the table.  The covering index that implements the\n** original WITHOUT ROWID table as N==K as a special case.\n**\n** This routine allocates the Stat4Accum object in heap memory. The return \n** value is a pointer to the Stat4Accum object.  The datatype of the\n** return value is BLOB, but it is really just a pointer to the Stat4Accum\n** object.\n*/\nstatic void statInit(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  Stat4Accum *p;\n  int nCol;                       /* Number of columns in index being sampled */\n  int nKeyCol;                    /* Number of key columns */\n  int nColUp;                     /* nCol rounded up for alignment */\n  int n;                          /* Bytes of space to allocate */\n  sqlite3 *db;                    /* Database connection */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  int mxSample = SQLITE_STAT4_SAMPLES;\n#endif\n\n  /* Decode the three function arguments */\n  UNUSED_PARAMETER(argc);\n  nCol = sqlite3_value_int(argv[0]);\n  assert( nCol>0 );\n  nColUp = sizeof(tRowcnt)<8 ? (nCol+1)&~1 : nCol;\n  nKeyCol = sqlite3_value_int(argv[1]);\n  assert( nKeyCol<=nCol );\n  assert( nKeyCol>0 );\n\n  /* Allocate the space required for the Stat4Accum object */\n  n = sizeof(*p) \n    + sizeof(tRowcnt)*nColUp                  /* Stat4Accum.anEq */\n    + sizeof(tRowcnt)*nColUp                  /* Stat4Accum.anDLt */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    + sizeof(tRowcnt)*nColUp                  /* Stat4Accum.anLt */\n    + sizeof(Stat4Sample)*(nCol+mxSample)     /* Stat4Accum.aBest[], a[] */\n    + sizeof(tRowcnt)*3*nColUp*(nCol+mxSample)\n#endif\n  ;\n  db = sqlite3_context_db_handle(context);\n  p = sqlite3DbMallocZero(db, n);\n  if( p==0 ){\n    sqlite3_result_error_nomem(context);\n    return;\n  }\n\n  p->db = db;\n  p->nRow = 0;\n  p->nCol = nCol;\n  p->nKeyCol = nKeyCol;\n  p->current.anDLt = (tRowcnt*)&p[1];\n  p->current.anEq = &p->current.anDLt[nColUp];\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  {\n    u8 *pSpace;                     /* Allocated space not yet assigned */\n    int i;                          /* Used to iterate through p->aSample[] */\n\n    p->iGet = -1;\n    p->mxSample = mxSample;\n    p->nPSample = (tRowcnt)(sqlite3_value_int64(argv[2])/(mxSample/3+1) + 1);\n    p->current.anLt = &p->current.anEq[nColUp];\n    p->iPrn = 0x689e962d*(u32)nCol ^ 0xd0944565*(u32)sqlite3_value_int(argv[2]);\n  \n    /* Set up the Stat4Accum.a[] and aBest[] arrays */\n    p->a = (struct Stat4Sample*)&p->current.anLt[nColUp];\n    p->aBest = &p->a[mxSample];\n    pSpace = (u8*)(&p->a[mxSample+nCol]);\n    for(i=0; i<(mxSample+nCol); i++){\n      p->a[i].anEq = (tRowcnt *)pSpace; pSpace += (sizeof(tRowcnt) * nColUp);\n      p->a[i].anLt = (tRowcnt *)pSpace; pSpace += (sizeof(tRowcnt) * nColUp);\n      p->a[i].anDLt = (tRowcnt *)pSpace; pSpace += (sizeof(tRowcnt) * nColUp);\n    }\n    assert( (pSpace - (u8*)p)==n );\n  \n    for(i=0; i<nCol; i++){\n      p->aBest[i].iCol = i;\n    }\n  }\n#endif\n\n  /* Return a pointer to the allocated object to the caller.  Note that\n  ** only the pointer (the 2nd parameter) matters.  The size of the object\n  ** (given by the 3rd parameter) is never used and can be any positive\n  ** value. */\n  sqlite3_result_blob(context, p, sizeof(*p), stat4Destructor);\n}\nstatic const FuncDef statInitFuncdef = {\n  2+IsStat34,      /* nArg */\n  SQLITE_UTF8,     /* funcFlags */\n  0,               /* pUserData */\n  0,               /* pNext */\n  statInit,        /* xSFunc */\n  0,               /* xFinalize */\n  \"stat_init\",     /* zName */\n  {0}\n};\n\n#ifdef SQLITE_ENABLE_STAT4\n/*\n** pNew and pOld are both candidate non-periodic samples selected for \n** the same column (pNew->iCol==pOld->iCol). Ignoring this column and \n** considering only any trailing columns and the sample hash value, this\n** function returns true if sample pNew is to be preferred over pOld.\n** In other words, if we assume that the cardinalities of the selected\n** column for pNew and pOld are equal, is pNew to be preferred over pOld.\n**\n** This function assumes that for each argument sample, the contents of\n** the anEq[] array from pSample->anEq[pSample->iCol+1] onwards are valid. \n*/\nstatic int sampleIsBetterPost(\n  Stat4Accum *pAccum, \n  Stat4Sample *pNew, \n  Stat4Sample *pOld\n){\n  int nCol = pAccum->nCol;\n  int i;\n  assert( pNew->iCol==pOld->iCol );\n  for(i=pNew->iCol+1; i<nCol; i++){\n    if( pNew->anEq[i]>pOld->anEq[i] ) return 1;\n    if( pNew->anEq[i]<pOld->anEq[i] ) return 0;\n  }\n  if( pNew->iHash>pOld->iHash ) return 1;\n  return 0;\n}\n#endif\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/*\n** Return true if pNew is to be preferred over pOld.\n**\n** This function assumes that for each argument sample, the contents of\n** the anEq[] array from pSample->anEq[pSample->iCol] onwards are valid. \n*/\nstatic int sampleIsBetter(\n  Stat4Accum *pAccum, \n  Stat4Sample *pNew, \n  Stat4Sample *pOld\n){\n  tRowcnt nEqNew = pNew->anEq[pNew->iCol];\n  tRowcnt nEqOld = pOld->anEq[pOld->iCol];\n\n  assert( pOld->isPSample==0 && pNew->isPSample==0 );\n  assert( IsStat4 || (pNew->iCol==0 && pOld->iCol==0) );\n\n  if( (nEqNew>nEqOld) ) return 1;\n#ifdef SQLITE_ENABLE_STAT4\n  if( nEqNew==nEqOld ){\n    if( pNew->iCol<pOld->iCol ) return 1;\n    return (pNew->iCol==pOld->iCol && sampleIsBetterPost(pAccum, pNew, pOld));\n  }\n  return 0;\n#else\n  return (nEqNew==nEqOld && pNew->iHash>pOld->iHash);\n#endif\n}\n\n/*\n** Copy the contents of sample *pNew into the p->a[] array. If necessary,\n** remove the least desirable sample from p->a[] to make room.\n*/\nstatic void sampleInsert(Stat4Accum *p, Stat4Sample *pNew, int nEqZero){\n  Stat4Sample *pSample = 0;\n  int i;\n\n  assert( IsStat4 || nEqZero==0 );\n\n#ifdef SQLITE_ENABLE_STAT4\n  if( pNew->isPSample==0 ){\n    Stat4Sample *pUpgrade = 0;\n    assert( pNew->anEq[pNew->iCol]>0 );\n\n    /* This sample is being added because the prefix that ends in column \n    ** iCol occurs many times in the table. However, if we have already\n    ** added a sample that shares this prefix, there is no need to add\n    ** this one. Instead, upgrade the priority of the highest priority\n    ** existing sample that shares this prefix.  */\n    for(i=p->nSample-1; i>=0; i--){\n      Stat4Sample *pOld = &p->a[i];\n      if( pOld->anEq[pNew->iCol]==0 ){\n        if( pOld->isPSample ) return;\n        assert( pOld->iCol>pNew->iCol );\n        assert( sampleIsBetter(p, pNew, pOld) );\n        if( pUpgrade==0 || sampleIsBetter(p, pOld, pUpgrade) ){\n          pUpgrade = pOld;\n        }\n      }\n    }\n    if( pUpgrade ){\n      pUpgrade->iCol = pNew->iCol;\n      pUpgrade->anEq[pUpgrade->iCol] = pNew->anEq[pUpgrade->iCol];\n      goto find_new_min;\n    }\n  }\n#endif\n\n  /* If necessary, remove sample iMin to make room for the new sample. */\n  if( p->nSample>=p->mxSample ){\n    Stat4Sample *pMin = &p->a[p->iMin];\n    tRowcnt *anEq = pMin->anEq;\n    tRowcnt *anLt = pMin->anLt;\n    tRowcnt *anDLt = pMin->anDLt;\n    sampleClear(p->db, pMin);\n    memmove(pMin, &pMin[1], sizeof(p->a[0])*(p->nSample-p->iMin-1));\n    pSample = &p->a[p->nSample-1];\n    pSample->nRowid = 0;\n    pSample->anEq = anEq;\n    pSample->anDLt = anDLt;\n    pSample->anLt = anLt;\n    p->nSample = p->mxSample-1;\n  }\n\n  /* The \"rows less-than\" for the rowid column must be greater than that\n  ** for the last sample in the p->a[] array. Otherwise, the samples would\n  ** be out of order. */\n#ifdef SQLITE_ENABLE_STAT4\n  assert( p->nSample==0 \n       || pNew->anLt[p->nCol-1] > p->a[p->nSample-1].anLt[p->nCol-1] );\n#endif\n\n  /* Insert the new sample */\n  pSample = &p->a[p->nSample];\n  sampleCopy(p, pSample, pNew);\n  p->nSample++;\n\n  /* Zero the first nEqZero entries in the anEq[] array. */\n  memset(pSample->anEq, 0, sizeof(tRowcnt)*nEqZero);\n\n#ifdef SQLITE_ENABLE_STAT4\n find_new_min:\n#endif\n  if( p->nSample>=p->mxSample ){\n    int iMin = -1;\n    for(i=0; i<p->mxSample; i++){\n      if( p->a[i].isPSample ) continue;\n      if( iMin<0 || sampleIsBetter(p, &p->a[iMin], &p->a[i]) ){\n        iMin = i;\n      }\n    }\n    assert( iMin>=0 );\n    p->iMin = iMin;\n  }\n}\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n/*\n** Field iChng of the index being scanned has changed. So at this point\n** p->current contains a sample that reflects the previous row of the\n** index. The value of anEq[iChng] and subsequent anEq[] elements are\n** correct at this point.\n*/\nstatic void samplePushPrevious(Stat4Accum *p, int iChng){\n#ifdef SQLITE_ENABLE_STAT4\n  int i;\n\n  /* Check if any samples from the aBest[] array should be pushed\n  ** into IndexSample.a[] at this point.  */\n  for(i=(p->nCol-2); i>=iChng; i--){\n    Stat4Sample *pBest = &p->aBest[i];\n    pBest->anEq[i] = p->current.anEq[i];\n    if( p->nSample<p->mxSample || sampleIsBetter(p, pBest, &p->a[p->iMin]) ){\n      sampleInsert(p, pBest, i);\n    }\n  }\n\n  /* Update the anEq[] fields of any samples already collected. */\n  for(i=p->nSample-1; i>=0; i--){\n    int j;\n    for(j=iChng; j<p->nCol; j++){\n      if( p->a[i].anEq[j]==0 ) p->a[i].anEq[j] = p->current.anEq[j];\n    }\n  }\n#endif\n\n#if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4)\n  if( iChng==0 ){\n    tRowcnt nLt = p->current.anLt[0];\n    tRowcnt nEq = p->current.anEq[0];\n\n    /* Check if this is to be a periodic sample. If so, add it. */\n    if( (nLt/p->nPSample)!=(nLt+nEq)/p->nPSample ){\n      p->current.isPSample = 1;\n      sampleInsert(p, &p->current, 0);\n      p->current.isPSample = 0;\n    }else \n\n    /* Or if it is a non-periodic sample. Add it in this case too. */\n    if( p->nSample<p->mxSample \n     || sampleIsBetter(p, &p->current, &p->a[p->iMin]) \n    ){\n      sampleInsert(p, &p->current, 0);\n    }\n  }\n#endif\n\n#ifndef SQLITE_ENABLE_STAT3_OR_STAT4\n  UNUSED_PARAMETER( p );\n  UNUSED_PARAMETER( iChng );\n#endif\n}\n\n/*\n** Implementation of the stat_push SQL function:  stat_push(P,C,R)\n** Arguments:\n**\n**    P     Pointer to the Stat4Accum object created by stat_init()\n**    C     Index of left-most column to differ from previous row\n**    R     Rowid for the current row.  Might be a key record for\n**          WITHOUT ROWID tables.\n**\n** This SQL function always returns NULL.  It's purpose it to accumulate\n** statistical data and/or samples in the Stat4Accum object about the\n** index being analyzed.  The stat_get() SQL function will later be used to\n** extract relevant information for constructing the sqlite_statN tables.\n**\n** The R parameter is only used for STAT3 and STAT4\n*/\nstatic void statPush(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  int i;\n\n  /* The three function arguments */\n  Stat4Accum *p = (Stat4Accum*)sqlite3_value_blob(argv[0]);\n  int iChng = sqlite3_value_int(argv[1]);\n\n  UNUSED_PARAMETER( argc );\n  UNUSED_PARAMETER( context );\n  assert( p->nCol>0 );\n  assert( iChng<p->nCol );\n\n  if( p->nRow==0 ){\n    /* This is the first call to this function. Do initialization. */\n    for(i=0; i<p->nCol; i++) p->current.anEq[i] = 1;\n  }else{\n    /* Second and subsequent calls get processed here */\n    samplePushPrevious(p, iChng);\n\n    /* Update anDLt[], anLt[] and anEq[] to reflect the values that apply\n    ** to the current row of the index. */\n    for(i=0; i<iChng; i++){\n      p->current.anEq[i]++;\n    }\n    for(i=iChng; i<p->nCol; i++){\n      p->current.anDLt[i]++;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n      p->current.anLt[i] += p->current.anEq[i];\n#endif\n      p->current.anEq[i] = 1;\n    }\n  }\n  p->nRow++;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  if( sqlite3_value_type(argv[2])==SQLITE_INTEGER ){\n    sampleSetRowidInt64(p->db, &p->current, sqlite3_value_int64(argv[2]));\n  }else{\n    sampleSetRowid(p->db, &p->current, sqlite3_value_bytes(argv[2]),\n                                       sqlite3_value_blob(argv[2]));\n  }\n  p->current.iHash = p->iPrn = p->iPrn*1103515245 + 12345;\n#endif\n\n#ifdef SQLITE_ENABLE_STAT4\n  {\n    tRowcnt nLt = p->current.anLt[p->nCol-1];\n\n    /* Check if this is to be a periodic sample. If so, add it. */\n    if( (nLt/p->nPSample)!=(nLt+1)/p->nPSample ){\n      p->current.isPSample = 1;\n      p->current.iCol = 0;\n      sampleInsert(p, &p->current, p->nCol-1);\n      p->current.isPSample = 0;\n    }\n\n    /* Update the aBest[] array. */\n    for(i=0; i<(p->nCol-1); i++){\n      p->current.iCol = i;\n      if( i>=iChng || sampleIsBetterPost(p, &p->current, &p->aBest[i]) ){\n        sampleCopy(p, &p->aBest[i], &p->current);\n      }\n    }\n  }\n#endif\n}\nstatic const FuncDef statPushFuncdef = {\n  2+IsStat34,      /* nArg */\n  SQLITE_UTF8,     /* funcFlags */\n  0,               /* pUserData */\n  0,               /* pNext */\n  statPush,        /* xSFunc */\n  0,               /* xFinalize */\n  \"stat_push\",     /* zName */\n  {0}\n};\n\n#define STAT_GET_STAT1 0          /* \"stat\" column of stat1 table */\n#define STAT_GET_ROWID 1          /* \"rowid\" column of stat[34] entry */\n#define STAT_GET_NEQ   2          /* \"neq\" column of stat[34] entry */\n#define STAT_GET_NLT   3          /* \"nlt\" column of stat[34] entry */\n#define STAT_GET_NDLT  4          /* \"ndlt\" column of stat[34] entry */\n\n/*\n** Implementation of the stat_get(P,J) SQL function.  This routine is\n** used to query statistical information that has been gathered into\n** the Stat4Accum object by prior calls to stat_push().  The P parameter\n** has type BLOB but it is really just a pointer to the Stat4Accum object.\n** The content to returned is determined by the parameter J\n** which is one of the STAT_GET_xxxx values defined above.\n**\n** If neither STAT3 nor STAT4 are enabled, then J is always\n** STAT_GET_STAT1 and is hence omitted and this routine becomes\n** a one-parameter function, stat_get(P), that always returns the\n** stat1 table entry information.\n*/\nstatic void statGet(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  Stat4Accum *p = (Stat4Accum*)sqlite3_value_blob(argv[0]);\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  /* STAT3 and STAT4 have a parameter on this routine. */\n  int eCall = sqlite3_value_int(argv[1]);\n  assert( argc==2 );\n  assert( eCall==STAT_GET_STAT1 || eCall==STAT_GET_NEQ \n       || eCall==STAT_GET_ROWID || eCall==STAT_GET_NLT\n       || eCall==STAT_GET_NDLT \n  );\n  if( eCall==STAT_GET_STAT1 )\n#else\n  assert( argc==1 );\n#endif\n  {\n    /* Return the value to store in the \"stat\" column of the sqlite_stat1\n    ** table for this index.\n    **\n    ** The value is a string composed of a list of integers describing \n    ** the index. The first integer in the list is the total number of \n    ** entries in the index. There is one additional integer in the list \n    ** for each indexed column. This additional integer is an estimate of\n    ** the number of rows matched by a stabbing query on the index using\n    ** a key with the corresponding number of fields. In other words,\n    ** if the index is on columns (a,b) and the sqlite_stat1 value is \n    ** \"100 10 2\", then SQLite estimates that:\n    **\n    **   * the index contains 100 rows,\n    **   * \"WHERE a=?\" matches 10 rows, and\n    **   * \"WHERE a=? AND b=?\" matches 2 rows.\n    **\n    ** If D is the count of distinct values and K is the total number of \n    ** rows, then each estimate is computed as:\n    **\n    **        I = (K+D-1)/D\n    */\n    char *z;\n    int i;\n\n    char *zRet = sqlite3MallocZero( (p->nKeyCol+1)*25 );\n    if( zRet==0 ){\n      sqlite3_result_error_nomem(context);\n      return;\n    }\n\n    sqlite3_snprintf(24, zRet, \"%llu\", (u64)p->nRow);\n    z = zRet + sqlite3Strlen30(zRet);\n    for(i=0; i<p->nKeyCol; i++){\n      u64 nDistinct = p->current.anDLt[i] + 1;\n      u64 iVal = (p->nRow + nDistinct - 1) / nDistinct;\n      sqlite3_snprintf(24, z, \" %llu\", iVal);\n      z += sqlite3Strlen30(z);\n      assert( p->current.anEq[i] );\n    }\n    assert( z[0]=='\\0' && z>zRet );\n\n    sqlite3_result_text(context, zRet, -1, sqlite3_free);\n  }\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  else if( eCall==STAT_GET_ROWID ){\n    if( p->iGet<0 ){\n      samplePushPrevious(p, 0);\n      p->iGet = 0;\n    }\n    if( p->iGet<p->nSample ){\n      Stat4Sample *pS = p->a + p->iGet;\n      if( pS->nRowid==0 ){\n        sqlite3_result_int64(context, pS->u.iRowid);\n      }else{\n        sqlite3_result_blob(context, pS->u.aRowid, pS->nRowid,\n                            SQLITE_TRANSIENT);\n      }\n    }\n  }else{\n    tRowcnt *aCnt = 0;\n\n    assert( p->iGet<p->nSample );\n    switch( eCall ){\n      case STAT_GET_NEQ:  aCnt = p->a[p->iGet].anEq; break;\n      case STAT_GET_NLT:  aCnt = p->a[p->iGet].anLt; break;\n      default: {\n        aCnt = p->a[p->iGet].anDLt; \n        p->iGet++;\n        break;\n      }\n    }\n\n    if( IsStat3 ){\n      sqlite3_result_int64(context, (i64)aCnt[0]);\n    }else{\n      char *zRet = sqlite3MallocZero(p->nCol * 25);\n      if( zRet==0 ){\n        sqlite3_result_error_nomem(context);\n      }else{\n        int i;\n        char *z = zRet;\n        for(i=0; i<p->nCol; i++){\n          sqlite3_snprintf(24, z, \"%llu \", (u64)aCnt[i]);\n          z += sqlite3Strlen30(z);\n        }\n        assert( z[0]=='\\0' && z>zRet );\n        z[-1] = '\\0';\n        sqlite3_result_text(context, zRet, -1, sqlite3_free);\n      }\n    }\n  }\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n#ifndef SQLITE_DEBUG\n  UNUSED_PARAMETER( argc );\n#endif\n}\nstatic const FuncDef statGetFuncdef = {\n  1+IsStat34,      /* nArg */\n  SQLITE_UTF8,     /* funcFlags */\n  0,               /* pUserData */\n  0,               /* pNext */\n  statGet,         /* xSFunc */\n  0,               /* xFinalize */\n  \"stat_get\",      /* zName */\n  {0}\n};\n\nstatic void callStatGet(Vdbe *v, int regStat4, int iParam, int regOut){\n  assert( regOut!=regStat4 && regOut!=regStat4+1 );\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  sqlite3VdbeAddOp2(v, OP_Integer, iParam, regStat4+1);\n#elif SQLITE_DEBUG\n  assert( iParam==STAT_GET_STAT1 );\n#else\n  UNUSED_PARAMETER( iParam );\n#endif\n  sqlite3VdbeAddOp4(v, OP_Function0, 0, regStat4, regOut,\n                    (char*)&statGetFuncdef, P4_FUNCDEF);\n  sqlite3VdbeChangeP5(v, 1 + IsStat34);\n}\n\n/*\n** Generate code to do an analysis of all indices associated with\n** a single table.\n*/\nstatic void analyzeOneTable(\n  Parse *pParse,   /* Parser context */\n  Table *pTab,     /* Table whose indices are to be analyzed */\n  Index *pOnlyIdx, /* If not NULL, only analyze this one index */\n  int iStatCur,    /* Index of VdbeCursor that writes the sqlite_stat1 table */\n  int iMem,        /* Available memory locations begin here */\n  int iTab         /* Next available cursor */\n){\n  sqlite3 *db = pParse->db;    /* Database handle */\n  Index *pIdx;                 /* An index to being analyzed */\n  int iIdxCur;                 /* Cursor open on index being analyzed */\n  int iTabCur;                 /* Table cursor */\n  Vdbe *v;                     /* The virtual machine being built up */\n  int i;                       /* Loop counter */\n  int jZeroRows = -1;          /* Jump from here if number of rows is zero */\n  int iDb;                     /* Index of database containing pTab */\n  u8 needTableCnt = 1;         /* True to count the table */\n  int regNewRowid = iMem++;    /* Rowid for the inserted record */\n  int regStat4 = iMem++;       /* Register to hold Stat4Accum object */\n  int regChng = iMem++;        /* Index of changed index field */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  int regRowid = iMem++;       /* Rowid argument passed to stat_push() */\n#endif\n  int regTemp = iMem++;        /* Temporary use register */\n  int regTabname = iMem++;     /* Register containing table name */\n  int regIdxname = iMem++;     /* Register containing index name */\n  int regStat1 = iMem++;       /* Value for the stat column of sqlite_stat1 */\n  int regPrev = iMem;          /* MUST BE LAST (see below) */\n\n  pParse->nMem = MAX(pParse->nMem, iMem);\n  v = sqlite3GetVdbe(pParse);\n  if( v==0 || NEVER(pTab==0) ){\n    return;\n  }\n  if( pTab->tnum==0 ){\n    /* Do not gather statistics on views or virtual tables */\n    return;\n  }\n  if( sqlite3_strlike(\"sqlite_%\", pTab->zName, 0)==0 ){\n    /* Do not gather statistics on system tables */\n    return;\n  }\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n  assert( iDb>=0 );\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,\n      db->aDb[iDb].zDbSName ) ){\n    return;\n  }\n#endif\n\n  /* Establish a read-lock on the table at the shared-cache level. \n  ** Open a read-only cursor on the table. Also allocate a cursor number\n  ** to use for scanning indexes (iIdxCur). No index cursor is opened at\n  ** this time though.  */\n  sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\n  iTabCur = iTab++;\n  iIdxCur = iTab++;\n  pParse->nTab = MAX(pParse->nTab, iTab);\n  sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);\n  sqlite3VdbeLoadString(v, regTabname, pTab->zName);\n\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n    int nCol;                     /* Number of columns in pIdx. \"N\" */\n    int addrRewind;               /* Address of \"OP_Rewind iIdxCur\" */\n    int addrNextRow;              /* Address of \"next_row:\" */\n    const char *zIdxName;         /* Name of the index */\n    int nColTest;                 /* Number of columns to test for changes */\n\n    if( pOnlyIdx && pOnlyIdx!=pIdx ) continue;\n    if( pIdx->pPartIdxWhere==0 ) needTableCnt = 0;\n    if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){\n      nCol = pIdx->nKeyCol;\n      zIdxName = pTab->zName;\n      nColTest = nCol - 1;\n    }else{\n      nCol = pIdx->nColumn;\n      zIdxName = pIdx->zName;\n      nColTest = pIdx->uniqNotNull ? pIdx->nKeyCol-1 : nCol-1;\n    }\n\n    /* Populate the register containing the index name. */\n    sqlite3VdbeLoadString(v, regIdxname, zIdxName);\n    VdbeComment((v, \"Analysis for %s.%s\", pTab->zName, zIdxName));\n\n    /*\n    ** Pseudo-code for loop that calls stat_push():\n    **\n    **   Rewind csr\n    **   if eof(csr) goto end_of_scan;\n    **   regChng = 0\n    **   goto chng_addr_0;\n    **\n    **  next_row:\n    **   regChng = 0\n    **   if( idx(0) != regPrev(0) ) goto chng_addr_0\n    **   regChng = 1\n    **   if( idx(1) != regPrev(1) ) goto chng_addr_1\n    **   ...\n    **   regChng = N\n    **   goto chng_addr_N\n    **\n    **  chng_addr_0:\n    **   regPrev(0) = idx(0)\n    **  chng_addr_1:\n    **   regPrev(1) = idx(1)\n    **  ...\n    **\n    **  endDistinctTest:\n    **   regRowid = idx(rowid)\n    **   stat_push(P, regChng, regRowid)\n    **   Next csr\n    **   if !eof(csr) goto next_row;\n    **\n    **  end_of_scan:\n    */\n\n    /* Make sure there are enough memory cells allocated to accommodate \n    ** the regPrev array and a trailing rowid (the rowid slot is required\n    ** when building a record to insert into the sample column of \n    ** the sqlite_stat4 table.  */\n    pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);\n\n    /* Open a read-only cursor on the index being analyzed. */\n    assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );\n    sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);\n    sqlite3VdbeSetP4KeyInfo(pParse, pIdx);\n    VdbeComment((v, \"%s\", pIdx->zName));\n\n    /* Invoke the stat_init() function. The arguments are:\n    ** \n    **    (1) the number of columns in the index including the rowid\n    **        (or for a WITHOUT ROWID table, the number of PK columns),\n    **    (2) the number of columns in the key without the rowid/pk\n    **    (3) the number of rows in the index,\n    **\n    **\n    ** The third argument is only used for STAT3 and STAT4\n    */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+3);\n#endif\n    sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat4+1);\n    sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regStat4+2);\n    sqlite3VdbeAddOp4(v, OP_Function0, 0, regStat4+1, regStat4,\n                     (char*)&statInitFuncdef, P4_FUNCDEF);\n    sqlite3VdbeChangeP5(v, 2+IsStat34);\n\n    /* Implementation of the following:\n    **\n    **   Rewind csr\n    **   if eof(csr) goto end_of_scan;\n    **   regChng = 0\n    **   goto next_push_0;\n    **\n    */\n    addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur);\n    VdbeCoverage(v);\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng);\n    addrNextRow = sqlite3VdbeCurrentAddr(v);\n\n    if( nColTest>0 ){\n      int endDistinctTest = sqlite3VdbeMakeLabel(v);\n      int *aGotoChng;               /* Array of jump instruction addresses */\n      aGotoChng = sqlite3DbMallocRawNN(db, sizeof(int)*nColTest);\n      if( aGotoChng==0 ) continue;\n\n      /*\n      **  next_row:\n      **   regChng = 0\n      **   if( idx(0) != regPrev(0) ) goto chng_addr_0\n      **   regChng = 1\n      **   if( idx(1) != regPrev(1) ) goto chng_addr_1\n      **   ...\n      **   regChng = N\n      **   goto endDistinctTest\n      */\n      sqlite3VdbeAddOp0(v, OP_Goto);\n      addrNextRow = sqlite3VdbeCurrentAddr(v);\n      if( nColTest==1 && pIdx->nKeyCol==1 && IsUniqueIndex(pIdx) ){\n        /* For a single-column UNIQUE index, once we have found a non-NULL\n        ** row, we know that all the rest will be distinct, so skip \n        ** subsequent distinctness tests. */\n        sqlite3VdbeAddOp2(v, OP_NotNull, regPrev, endDistinctTest);\n        VdbeCoverage(v);\n      }\n      for(i=0; i<nColTest; i++){\n        char *pColl = (char*)sqlite3LocateCollSeq(pParse, pIdx->azColl[i]);\n        sqlite3VdbeAddOp2(v, OP_Integer, i, regChng);\n        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regTemp);\n        aGotoChng[i] = \n        sqlite3VdbeAddOp4(v, OP_Ne, regTemp, 0, regPrev+i, pColl, P4_COLLSEQ);\n        sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);\n        VdbeCoverage(v);\n      }\n      sqlite3VdbeAddOp2(v, OP_Integer, nColTest, regChng);\n      sqlite3VdbeGoto(v, endDistinctTest);\n  \n  \n      /*\n      **  chng_addr_0:\n      **   regPrev(0) = idx(0)\n      **  chng_addr_1:\n      **   regPrev(1) = idx(1)\n      **  ...\n      */\n      sqlite3VdbeJumpHere(v, addrNextRow-1);\n      for(i=0; i<nColTest; i++){\n        sqlite3VdbeJumpHere(v, aGotoChng[i]);\n        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regPrev+i);\n      }\n      sqlite3VdbeResolveLabel(v, endDistinctTest);\n      sqlite3DbFree(db, aGotoChng);\n    }\n  \n    /*\n    **  chng_addr_N:\n    **   regRowid = idx(rowid)            // STAT34 only\n    **   stat_push(P, regChng, regRowid)  // 3rd parameter STAT34 only\n    **   Next csr\n    **   if !eof(csr) goto next_row;\n    */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    assert( regRowid==(regStat4+2) );\n    if( HasRowid(pTab) ){\n      sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, regRowid);\n    }else{\n      Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable);\n      int j, k, regKey;\n      regKey = sqlite3GetTempRange(pParse, pPk->nKeyCol);\n      for(j=0; j<pPk->nKeyCol; j++){\n        k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]);\n        assert( k>=0 && k<pTab->nCol );\n        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, regKey+j);\n        VdbeComment((v, \"%s\", pTab->aCol[pPk->aiColumn[j]].zName));\n      }\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regKey, pPk->nKeyCol, regRowid);\n      sqlite3ReleaseTempRange(pParse, regKey, pPk->nKeyCol);\n    }\n#endif\n    assert( regChng==(regStat4+1) );\n    sqlite3VdbeAddOp4(v, OP_Function0, 1, regStat4, regTemp,\n                     (char*)&statPushFuncdef, P4_FUNCDEF);\n    sqlite3VdbeChangeP5(v, 2+IsStat34);\n    sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, addrNextRow); VdbeCoverage(v);\n\n    /* Add the entry to the stat1 table. */\n    callStatGet(v, regStat4, STAT_GET_STAT1, regStat1);\n    assert( \"BBB\"[0]==SQLITE_AFF_TEXT );\n    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, \"BBB\", 0);\n    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid);\n    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid);\n    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\n\n    /* Add the entries to the stat3 or stat4 table. */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    {\n      int regEq = regStat1;\n      int regLt = regStat1+1;\n      int regDLt = regStat1+2;\n      int regSample = regStat1+3;\n      int regCol = regStat1+4;\n      int regSampleRowid = regCol + nCol;\n      int addrNext;\n      int addrIsNull;\n      u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;\n\n      pParse->nMem = MAX(pParse->nMem, regCol+nCol);\n\n      addrNext = sqlite3VdbeCurrentAddr(v);\n      callStatGet(v, regStat4, STAT_GET_ROWID, regSampleRowid);\n      addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);\n      VdbeCoverage(v);\n      callStatGet(v, regStat4, STAT_GET_NEQ, regEq);\n      callStatGet(v, regStat4, STAT_GET_NLT, regLt);\n      callStatGet(v, regStat4, STAT_GET_NDLT, regDLt);\n      sqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0);\n      /* We know that the regSampleRowid row exists because it was read by\n      ** the previous loop.  Thus the not-found jump of seekOp will never\n      ** be taken */\n      VdbeCoverageNeverTaken(v);\n#ifdef SQLITE_ENABLE_STAT3\n      sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iTabCur, 0, regSample);\n#else\n      for(i=0; i<nCol; i++){\n        sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iTabCur, i, regCol+i);\n      }\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, nCol, regSample);\n#endif\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regTabname, 6, regTemp);\n      sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid);\n      sqlite3VdbeAddOp3(v, OP_Insert, iStatCur+1, regTemp, regNewRowid);\n      sqlite3VdbeAddOp2(v, OP_Goto, 1, addrNext); /* P1==1 for end-of-loop */\n      sqlite3VdbeJumpHere(v, addrIsNull);\n    }\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n    /* End of analysis */\n    sqlite3VdbeJumpHere(v, addrRewind);\n  }\n\n\n  /* Create a single sqlite_stat1 entry containing NULL as the index\n  ** name and the row count as the content.\n  */\n  if( pOnlyIdx==0 && needTableCnt ){\n    VdbeComment((v, \"%s\", pTab->zName));\n    sqlite3VdbeAddOp2(v, OP_Count, iTabCur, regStat1);\n    jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1); VdbeCoverage(v);\n    sqlite3VdbeAddOp2(v, OP_Null, 0, regIdxname);\n    assert( \"BBB\"[0]==SQLITE_AFF_TEXT );\n    sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, \"BBB\", 0);\n    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid);\n    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid);\n    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\n    sqlite3VdbeJumpHere(v, jZeroRows);\n  }\n}\n\n\n/*\n** Generate code that will cause the most recent index analysis to\n** be loaded into internal hash tables where is can be used.\n*/\nstatic void loadAnalysis(Parse *pParse, int iDb){\n  Vdbe *v = sqlite3GetVdbe(pParse);\n  if( v ){\n    sqlite3VdbeAddOp1(v, OP_LoadAnalysis, iDb);\n  }\n}\n\n/*\n** Generate code that will do an analysis of an entire database\n*/\nstatic void analyzeDatabase(Parse *pParse, int iDb){\n  sqlite3 *db = pParse->db;\n  Schema *pSchema = db->aDb[iDb].pSchema;    /* Schema of database iDb */\n  HashElem *k;\n  int iStatCur;\n  int iMem;\n  int iTab;\n\n  sqlite3BeginWriteOperation(pParse, 0, iDb);\n  iStatCur = pParse->nTab;\n  pParse->nTab += 3;\n  openStatTable(pParse, iDb, iStatCur, 0, 0);\n  iMem = pParse->nMem+1;\n  iTab = pParse->nTab;\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){\n    Table *pTab = (Table*)sqliteHashData(k);\n    analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);\n  }\n  loadAnalysis(pParse, iDb);\n}\n\n/*\n** Generate code that will do an analysis of a single table in\n** a database.  If pOnlyIdx is not NULL then it is a single index\n** in pTab that should be analyzed.\n*/\nstatic void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){\n  int iDb;\n  int iStatCur;\n\n  assert( pTab!=0 );\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n  sqlite3BeginWriteOperation(pParse, 0, iDb);\n  iStatCur = pParse->nTab;\n  pParse->nTab += 3;\n  if( pOnlyIdx ){\n    openStatTable(pParse, iDb, iStatCur, pOnlyIdx->zName, \"idx\");\n  }else{\n    openStatTable(pParse, iDb, iStatCur, pTab->zName, \"tbl\");\n  }\n  analyzeOneTable(pParse, pTab, pOnlyIdx, iStatCur,pParse->nMem+1,pParse->nTab);\n  loadAnalysis(pParse, iDb);\n}\n\n/*\n** Generate code for the ANALYZE command.  The parser calls this routine\n** when it recognizes an ANALYZE command.\n**\n**        ANALYZE                            -- 1\n**        ANALYZE  <database>                -- 2\n**        ANALYZE  ?<database>.?<tablename>  -- 3\n**\n** Form 1 causes all indices in all attached databases to be analyzed.\n** Form 2 analyzes all indices the single database named.\n** Form 3 analyzes all indices associated with the named table.\n*/\nvoid sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){\n  sqlite3 *db = pParse->db;\n  int iDb;\n  int i;\n  char *z, *zDb;\n  Table *pTab;\n  Index *pIdx;\n  Token *pTableName;\n  Vdbe *v;\n\n  /* Read the database schema. If an error occurs, leave an error message\n  ** and code in pParse and return NULL. */\n  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\n    return;\n  }\n\n  assert( pName2!=0 || pName1==0 );\n  if( pName1==0 ){\n    /* Form 1:  Analyze everything */\n    for(i=0; i<db->nDb; i++){\n      if( i==1 ) continue;  /* Do not analyze the TEMP database */\n      analyzeDatabase(pParse, i);\n    }\n  }else if( pName2->n==0 ){\n    /* Form 2:  Analyze the database or table named */\n    iDb = sqlite3FindDb(db, pName1);\n    if( iDb>=0 ){\n      analyzeDatabase(pParse, iDb);\n    }else{\n      z = sqlite3NameFromToken(db, pName1);\n      if( z ){\n        if( (pIdx = sqlite3FindIndex(db, z, 0))!=0 ){\n          analyzeTable(pParse, pIdx->pTable, pIdx);\n        }else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){\n          analyzeTable(pParse, pTab, 0);\n        }\n        sqlite3DbFree(db, z);\n      }\n    }\n  }else{\n    /* Form 3: Analyze the fully qualified table name */\n    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);\n    if( iDb>=0 ){\n      zDb = db->aDb[iDb].zDbSName;\n      z = sqlite3NameFromToken(db, pTableName);\n      if( z ){\n        if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){\n          analyzeTable(pParse, pIdx->pTable, pIdx);\n        }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){\n          analyzeTable(pParse, pTab, 0);\n        }\n        sqlite3DbFree(db, z);\n      }\n    }   \n  }\n  v = sqlite3GetVdbe(pParse);\n  if( v ) sqlite3VdbeAddOp0(v, OP_Expire);\n}\n\n/*\n** Used to pass information from the analyzer reader through to the\n** callback routine.\n*/\ntypedef struct analysisInfo analysisInfo;\nstruct analysisInfo {\n  sqlite3 *db;\n  const char *zDatabase;\n};\n\n/*\n** The first argument points to a nul-terminated string containing a\n** list of space separated integers. Read the first nOut of these into\n** the array aOut[].\n*/\nstatic void decodeIntArray(\n  char *zIntArray,       /* String containing int array to decode */\n  int nOut,              /* Number of slots in aOut[] */\n  tRowcnt *aOut,         /* Store integers here */\n  LogEst *aLog,          /* Or, if aOut==0, here */\n  Index *pIndex          /* Handle extra flags for this index, if not NULL */\n){\n  char *z = zIntArray;\n  int c;\n  int i;\n  tRowcnt v;\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  if( z==0 ) z = \"\";\n#else\n  assert( z!=0 );\n#endif\n  for(i=0; *z && i<nOut; i++){\n    v = 0;\n    while( (c=z[0])>='0' && c<='9' ){\n      v = v*10 + c - '0';\n      z++;\n    }\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    if( aOut ) aOut[i] = v;\n    if( aLog ) aLog[i] = sqlite3LogEst(v);\n#else\n    assert( aOut==0 );\n    UNUSED_PARAMETER(aOut);\n    assert( aLog!=0 );\n    aLog[i] = sqlite3LogEst(v);\n#endif\n    if( *z==' ' ) z++;\n  }\n#ifndef SQLITE_ENABLE_STAT3_OR_STAT4\n  assert( pIndex!=0 ); {\n#else\n  if( pIndex ){\n#endif\n    pIndex->bUnordered = 0;\n    pIndex->noSkipScan = 0;\n    while( z[0] ){\n      if( sqlite3_strglob(\"unordered*\", z)==0 ){\n        pIndex->bUnordered = 1;\n      }else if( sqlite3_strglob(\"sz=[0-9]*\", z)==0 ){\n        pIndex->szIdxRow = sqlite3LogEst(sqlite3Atoi(z+3));\n      }else if( sqlite3_strglob(\"noskipscan*\", z)==0 ){\n        pIndex->noSkipScan = 1;\n      }\n#ifdef SQLITE_ENABLE_COSTMULT\n      else if( sqlite3_strglob(\"costmult=[0-9]*\",z)==0 ){\n        pIndex->pTable->costMult = sqlite3LogEst(sqlite3Atoi(z+9));\n      }\n#endif\n      while( z[0]!=0 && z[0]!=' ' ) z++;\n      while( z[0]==' ' ) z++;\n    }\n  }\n}\n\n/*\n** This callback is invoked once for each index when reading the\n** sqlite_stat1 table.  \n**\n**     argv[0] = name of the table\n**     argv[1] = name of the index (might be NULL)\n**     argv[2] = results of analysis - on integer for each column\n**\n** Entries for which argv[1]==NULL simply record the number of rows in\n** the table.\n*/\nstatic int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){\n  analysisInfo *pInfo = (analysisInfo*)pData;\n  Index *pIndex;\n  Table *pTable;\n  const char *z;\n\n  assert( argc==3 );\n  UNUSED_PARAMETER2(NotUsed, argc);\n\n  if( argv==0 || argv[0]==0 || argv[2]==0 ){\n    return 0;\n  }\n  pTable = sqlite3FindTable(pInfo->db, argv[0], pInfo->zDatabase);\n  if( pTable==0 ){\n    return 0;\n  }\n  if( argv[1]==0 ){\n    pIndex = 0;\n  }else if( sqlite3_stricmp(argv[0],argv[1])==0 ){\n    pIndex = sqlite3PrimaryKeyIndex(pTable);\n  }else{\n    pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase);\n  }\n  z = argv[2];\n\n  if( pIndex ){\n    tRowcnt *aiRowEst = 0;\n    int nCol = pIndex->nKeyCol+1;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    /* Index.aiRowEst may already be set here if there are duplicate \n    ** sqlite_stat1 entries for this index. In that case just clobber\n    ** the old data with the new instead of allocating a new array.  */\n    if( pIndex->aiRowEst==0 ){\n      pIndex->aiRowEst = (tRowcnt*)sqlite3MallocZero(sizeof(tRowcnt) * nCol);\n      if( pIndex->aiRowEst==0 ) sqlite3OomFault(pInfo->db);\n    }\n    aiRowEst = pIndex->aiRowEst;\n#endif\n    pIndex->bUnordered = 0;\n    decodeIntArray((char*)z, nCol, aiRowEst, pIndex->aiRowLogEst, pIndex);\n    if( pIndex->pPartIdxWhere==0 ) pTable->nRowLogEst = pIndex->aiRowLogEst[0];\n  }else{\n    Index fakeIdx;\n    fakeIdx.szIdxRow = pTable->szTabRow;\n#ifdef SQLITE_ENABLE_COSTMULT\n    fakeIdx.pTable = pTable;\n#endif\n    decodeIntArray((char*)z, 1, 0, &pTable->nRowLogEst, &fakeIdx);\n    pTable->szTabRow = fakeIdx.szIdxRow;\n  }\n\n  return 0;\n}\n\n/*\n** If the Index.aSample variable is not NULL, delete the aSample[] array\n** and its contents.\n*/\nvoid sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  if( pIdx->aSample ){\n    int j;\n    for(j=0; j<pIdx->nSample; j++){\n      IndexSample *p = &pIdx->aSample[j];\n      sqlite3DbFree(db, p->p);\n    }\n    sqlite3DbFree(db, pIdx->aSample);\n  }\n  if( db && db->pnBytesFreed==0 ){\n    pIdx->nSample = 0;\n    pIdx->aSample = 0;\n  }\n#else\n  UNUSED_PARAMETER(db);\n  UNUSED_PARAMETER(pIdx);\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n}\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/*\n** Populate the pIdx->aAvgEq[] array based on the samples currently\n** stored in pIdx->aSample[]. \n*/\nstatic void initAvgEq(Index *pIdx){\n  if( pIdx ){\n    IndexSample *aSample = pIdx->aSample;\n    IndexSample *pFinal = &aSample[pIdx->nSample-1];\n    int iCol;\n    int nCol = 1;\n    if( pIdx->nSampleCol>1 ){\n      /* If this is stat4 data, then calculate aAvgEq[] values for all\n      ** sample columns except the last. The last is always set to 1, as\n      ** once the trailing PK fields are considered all index keys are\n      ** unique.  */\n      nCol = pIdx->nSampleCol-1;\n      pIdx->aAvgEq[nCol] = 1;\n    }\n    for(iCol=0; iCol<nCol; iCol++){\n      int nSample = pIdx->nSample;\n      int i;                    /* Used to iterate through samples */\n      tRowcnt sumEq = 0;        /* Sum of the nEq values */\n      tRowcnt avgEq = 0;\n      tRowcnt nRow;             /* Number of rows in index */\n      i64 nSum100 = 0;          /* Number of terms contributing to sumEq */\n      i64 nDist100;             /* Number of distinct values in index */\n\n      if( !pIdx->aiRowEst || iCol>=pIdx->nKeyCol || pIdx->aiRowEst[iCol+1]==0 ){\n        nRow = pFinal->anLt[iCol];\n        nDist100 = (i64)100 * pFinal->anDLt[iCol];\n        nSample--;\n      }else{\n        nRow = pIdx->aiRowEst[0];\n        nDist100 = ((i64)100 * pIdx->aiRowEst[0]) / pIdx->aiRowEst[iCol+1];\n      }\n      pIdx->nRowEst0 = nRow;\n\n      /* Set nSum to the number of distinct (iCol+1) field prefixes that\n      ** occur in the stat4 table for this index. Set sumEq to the sum of \n      ** the nEq values for column iCol for the same set (adding the value \n      ** only once where there exist duplicate prefixes).  */\n      for(i=0; i<nSample; i++){\n        if( i==(pIdx->nSample-1)\n         || aSample[i].anDLt[iCol]!=aSample[i+1].anDLt[iCol] \n        ){\n          sumEq += aSample[i].anEq[iCol];\n          nSum100 += 100;\n        }\n      }\n\n      if( nDist100>nSum100 ){\n        avgEq = ((i64)100 * (nRow - sumEq))/(nDist100 - nSum100);\n      }\n      if( avgEq==0 ) avgEq = 1;\n      pIdx->aAvgEq[iCol] = avgEq;\n    }\n  }\n}\n\n/*\n** Look up an index by name.  Or, if the name of a WITHOUT ROWID table\n** is supplied instead, find the PRIMARY KEY index for that table.\n*/\nstatic Index *findIndexOrPrimaryKey(\n  sqlite3 *db,\n  const char *zName,\n  const char *zDb\n){\n  Index *pIdx = sqlite3FindIndex(db, zName, zDb);\n  if( pIdx==0 ){\n    Table *pTab = sqlite3FindTable(db, zName, zDb);\n    if( pTab && !HasRowid(pTab) ) pIdx = sqlite3PrimaryKeyIndex(pTab);\n  }\n  return pIdx;\n}\n\n/*\n** Load the content from either the sqlite_stat4 or sqlite_stat3 table \n** into the relevant Index.aSample[] arrays.\n**\n** Arguments zSql1 and zSql2 must point to SQL statements that return\n** data equivalent to the following (statements are different for stat3,\n** see the caller of this function for details):\n**\n**    zSql1: SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\n**    zSql2: SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\n**\n** where %Q is replaced with the database name before the SQL is executed.\n*/\nstatic int loadStatTbl(\n  sqlite3 *db,                  /* Database handle */\n  int bStat3,                   /* Assume single column records only */\n  const char *zSql1,            /* SQL statement 1 (see above) */\n  const char *zSql2,            /* SQL statement 2 (see above) */\n  const char *zDb               /* Database name (e.g. \"main\") */\n){\n  int rc;                       /* Result codes from subroutines */\n  sqlite3_stmt *pStmt = 0;      /* An SQL statement being run */\n  char *zSql;                   /* Text of the SQL statement */\n  Index *pPrevIdx = 0;          /* Previous index in the loop */\n  IndexSample *pSample;         /* A slot in pIdx->aSample[] */\n\n  assert( db->lookaside.bDisable );\n  zSql = sqlite3MPrintf(db, zSql1, zDb);\n  if( !zSql ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\n  sqlite3DbFree(db, zSql);\n  if( rc ) return rc;\n\n  while( sqlite3_step(pStmt)==SQLITE_ROW ){\n    int nIdxCol = 1;              /* Number of columns in stat4 records */\n\n    char *zIndex;   /* Index name */\n    Index *pIdx;    /* Pointer to the index object */\n    int nSample;    /* Number of samples */\n    int nByte;      /* Bytes of space required */\n    int i;          /* Bytes of space required */\n    tRowcnt *pSpace;\n\n    zIndex = (char *)sqlite3_column_text(pStmt, 0);\n    if( zIndex==0 ) continue;\n    nSample = sqlite3_column_int(pStmt, 1);\n    pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);\n    assert( pIdx==0 || bStat3 || pIdx->nSample==0 );\n    /* Index.nSample is non-zero at this point if data has already been\n    ** loaded from the stat4 table. In this case ignore stat3 data.  */\n    if( pIdx==0 || pIdx->nSample ) continue;\n    if( bStat3==0 ){\n      assert( !HasRowid(pIdx->pTable) || pIdx->nColumn==pIdx->nKeyCol+1 );\n      if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){\n        nIdxCol = pIdx->nKeyCol;\n      }else{\n        nIdxCol = pIdx->nColumn;\n      }\n    }\n    pIdx->nSampleCol = nIdxCol;\n    nByte = sizeof(IndexSample) * nSample;\n    nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample;\n    nByte += nIdxCol * sizeof(tRowcnt);     /* Space for Index.aAvgEq[] */\n\n    pIdx->aSample = sqlite3DbMallocZero(db, nByte);\n    if( pIdx->aSample==0 ){\n      sqlite3_finalize(pStmt);\n      return SQLITE_NOMEM_BKPT;\n    }\n    pSpace = (tRowcnt*)&pIdx->aSample[nSample];\n    pIdx->aAvgEq = pSpace; pSpace += nIdxCol;\n    for(i=0; i<nSample; i++){\n      pIdx->aSample[i].anEq = pSpace; pSpace += nIdxCol;\n      pIdx->aSample[i].anLt = pSpace; pSpace += nIdxCol;\n      pIdx->aSample[i].anDLt = pSpace; pSpace += nIdxCol;\n    }\n    assert( ((u8*)pSpace)-nByte==(u8*)(pIdx->aSample) );\n  }\n  rc = sqlite3_finalize(pStmt);\n  if( rc ) return rc;\n\n  zSql = sqlite3MPrintf(db, zSql2, zDb);\n  if( !zSql ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\n  sqlite3DbFree(db, zSql);\n  if( rc ) return rc;\n\n  while( sqlite3_step(pStmt)==SQLITE_ROW ){\n    char *zIndex;                 /* Index name */\n    Index *pIdx;                  /* Pointer to the index object */\n    int nCol = 1;                 /* Number of columns in index */\n\n    zIndex = (char *)sqlite3_column_text(pStmt, 0);\n    if( zIndex==0 ) continue;\n    pIdx = findIndexOrPrimaryKey(db, zIndex, zDb);\n    if( pIdx==0 ) continue;\n    /* This next condition is true if data has already been loaded from \n    ** the sqlite_stat4 table. In this case ignore stat3 data.  */\n    nCol = pIdx->nSampleCol;\n    if( bStat3 && nCol>1 ) continue;\n    if( pIdx!=pPrevIdx ){\n      initAvgEq(pPrevIdx);\n      pPrevIdx = pIdx;\n    }\n    pSample = &pIdx->aSample[pIdx->nSample];\n    decodeIntArray((char*)sqlite3_column_text(pStmt,1),nCol,pSample->anEq,0,0);\n    decodeIntArray((char*)sqlite3_column_text(pStmt,2),nCol,pSample->anLt,0,0);\n    decodeIntArray((char*)sqlite3_column_text(pStmt,3),nCol,pSample->anDLt,0,0);\n\n    /* Take a copy of the sample. Add two 0x00 bytes the end of the buffer.\n    ** This is in case the sample record is corrupted. In that case, the\n    ** sqlite3VdbeRecordCompare() may read up to two varints past the\n    ** end of the allocated buffer before it realizes it is dealing with\n    ** a corrupt record. Adding the two 0x00 bytes prevents this from causing\n    ** a buffer overread.  */\n    pSample->n = sqlite3_column_bytes(pStmt, 4);\n    pSample->p = sqlite3DbMallocZero(db, pSample->n + 2);\n    if( pSample->p==0 ){\n      sqlite3_finalize(pStmt);\n      return SQLITE_NOMEM_BKPT;\n    }\n    memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n);\n    pIdx->nSample++;\n  }\n  rc = sqlite3_finalize(pStmt);\n  if( rc==SQLITE_OK ) initAvgEq(pPrevIdx);\n  return rc;\n}\n\n/*\n** Load content from the sqlite_stat4 and sqlite_stat3 tables into \n** the Index.aSample[] arrays of all indices.\n*/\nstatic int loadStat4(sqlite3 *db, const char *zDb){\n  int rc = SQLITE_OK;             /* Result codes from subroutines */\n\n  assert( db->lookaside.bDisable );\n  if( sqlite3FindTable(db, \"sqlite_stat4\", zDb) ){\n    rc = loadStatTbl(db, 0,\n      \"SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx\", \n      \"SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4\",\n      zDb\n    );\n  }\n\n  if( rc==SQLITE_OK && sqlite3FindTable(db, \"sqlite_stat3\", zDb) ){\n    rc = loadStatTbl(db, 1,\n      \"SELECT idx,count(*) FROM %Q.sqlite_stat3 GROUP BY idx\", \n      \"SELECT idx,neq,nlt,ndlt,sqlite_record(sample) FROM %Q.sqlite_stat3\",\n      zDb\n    );\n  }\n\n  return rc;\n}\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n/*\n** Load the content of the sqlite_stat1 and sqlite_stat3/4 tables. The\n** contents of sqlite_stat1 are used to populate the Index.aiRowEst[]\n** arrays. The contents of sqlite_stat3/4 are used to populate the\n** Index.aSample[] arrays.\n**\n** If the sqlite_stat1 table is not present in the database, SQLITE_ERROR\n** is returned. In this case, even if SQLITE_ENABLE_STAT3/4 was defined \n** during compilation and the sqlite_stat3/4 table is present, no data is \n** read from it.\n**\n** If SQLITE_ENABLE_STAT3/4 was defined during compilation and the \n** sqlite_stat4 table is not present in the database, SQLITE_ERROR is\n** returned. However, in this case, data is read from the sqlite_stat1\n** table (if it is present) before returning.\n**\n** If an OOM error occurs, this function always sets db->mallocFailed.\n** This means if the caller does not care about other errors, the return\n** code may be ignored.\n*/\nint sqlite3AnalysisLoad(sqlite3 *db, int iDb){\n  analysisInfo sInfo;\n  HashElem *i;\n  char *zSql;\n  int rc = SQLITE_OK;\n\n  assert( iDb>=0 && iDb<db->nDb );\n  assert( db->aDb[iDb].pBt!=0 );\n\n  /* Clear any prior statistics */\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){\n    Index *pIdx = sqliteHashData(i);\n    pIdx->aiRowLogEst[0] = 0;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    sqlite3DeleteIndexSamples(db, pIdx);\n    pIdx->aSample = 0;\n#endif\n  }\n\n  /* Load new statistics out of the sqlite_stat1 table */\n  sInfo.db = db;\n  sInfo.zDatabase = db->aDb[iDb].zDbSName;\n  if( sqlite3FindTable(db, \"sqlite_stat1\", sInfo.zDatabase)!=0 ){\n    zSql = sqlite3MPrintf(db, \n        \"SELECT tbl,idx,stat FROM %Q.sqlite_stat1\", sInfo.zDatabase);\n    if( zSql==0 ){\n      rc = SQLITE_NOMEM_BKPT;\n    }else{\n      rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);\n      sqlite3DbFree(db, zSql);\n    }\n  }\n\n  /* Set appropriate defaults on all indexes not in the sqlite_stat1 table */\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){\n    Index *pIdx = sqliteHashData(i);\n    if( pIdx->aiRowLogEst[0]==0 ) sqlite3DefaultRowEst(pIdx);\n  }\n\n  /* Load the statistics from the sqlite_stat4 table. */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){\n    db->lookaside.bDisable++;\n    rc = loadStat4(db, sInfo.zDatabase);\n    db->lookaside.bDisable--;\n  }\n  for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){\n    Index *pIdx = sqliteHashData(i);\n    sqlite3_free(pIdx->aiRowEst);\n    pIdx->aiRowEst = 0;\n  }\n#endif\n\n  if( rc==SQLITE_NOMEM ){\n    sqlite3OomFault(db);\n  }\n  return rc;\n}\n\n\n#endif /* SQLITE_OMIT_ANALYZE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/attach.c",
    "content": "/*\n** 2003 April 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used to implement the ATTACH and DETACH commands.\n*/\n#include \"sqliteInt.h\"\n\n#ifndef SQLITE_OMIT_ATTACH\n/*\n** Resolve an expression that was part of an ATTACH or DETACH statement. This\n** is slightly different from resolving a normal SQL expression, because simple\n** identifiers are treated as strings, not possible column names or aliases.\n**\n** i.e. if the parser sees:\n**\n**     ATTACH DATABASE abc AS def\n**\n** it treats the two expressions as literal strings 'abc' and 'def' instead of\n** looking for columns of the same name.\n**\n** This only applies to the root node of pExpr, so the statement:\n**\n**     ATTACH DATABASE abc||def AS 'db2'\n**\n** will fail because neither abc or def can be resolved.\n*/\nstatic int resolveAttachExpr(NameContext *pName, Expr *pExpr)\n{\n  int rc = SQLITE_OK;\n  if( pExpr ){\n    if( pExpr->op!=TK_ID ){\n      rc = sqlite3ResolveExprNames(pName, pExpr);\n    }else{\n      pExpr->op = TK_STRING;\n    }\n  }\n  return rc;\n}\n\n/*\n** An SQL user-function registered to do the work of an ATTACH statement. The\n** three arguments to the function come directly from an attach statement:\n**\n**     ATTACH DATABASE x AS y KEY z\n**\n**     SELECT sqlite_attach(x, y, z)\n**\n** If the optional \"KEY z\" syntax is omitted, an SQL NULL is passed as the\n** third argument.\n*/\nstatic void attachFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **argv\n){\n  int i;\n  int rc = 0;\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  const char *zName;\n  const char *zFile;\n  char *zPath = 0;\n  char *zErr = 0;\n  unsigned int flags;\n  Db *aNew;\n  char *zErrDyn = 0;\n  sqlite3_vfs *pVfs;\n\n  UNUSED_PARAMETER(NotUsed);\n\n  zFile = (const char *)sqlite3_value_text(argv[0]);\n  zName = (const char *)sqlite3_value_text(argv[1]);\n  if( zFile==0 ) zFile = \"\";\n  if( zName==0 ) zName = \"\";\n\n  /* Check for the following errors:\n  **\n  **     * Too many attached databases,\n  **     * Transaction currently open\n  **     * Specified database name already being used.\n  */\n  if( db->nDb>=db->aLimit[SQLITE_LIMIT_ATTACHED]+2 ){\n    zErrDyn = sqlite3MPrintf(db, \"too many attached databases - max %d\", \n      db->aLimit[SQLITE_LIMIT_ATTACHED]\n    );\n    goto attach_error;\n  }\n  if( !db->autoCommit ){\n    zErrDyn = sqlite3MPrintf(db, \"cannot ATTACH database within transaction\");\n    goto attach_error;\n  }\n  for(i=0; i<db->nDb; i++){\n    char *z = db->aDb[i].zDbSName;\n    assert( z && zName );\n    if( sqlite3StrICmp(z, zName)==0 ){\n      zErrDyn = sqlite3MPrintf(db, \"database %s is already in use\", zName);\n      goto attach_error;\n    }\n  }\n\n  /* Allocate the new entry in the db->aDb[] array and initialize the schema\n  ** hash tables.\n  */\n  if( db->aDb==db->aDbStatic ){\n    aNew = sqlite3DbMallocRawNN(db, sizeof(db->aDb[0])*3 );\n    if( aNew==0 ) return;\n    memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2);\n  }else{\n    aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) );\n    if( aNew==0 ) return;\n  }\n  db->aDb = aNew;\n  aNew = &db->aDb[db->nDb];\n  memset(aNew, 0, sizeof(*aNew));\n\n  /* Open the database file. If the btree is successfully opened, use\n  ** it to obtain the database schema. At this point the schema may\n  ** or may not be initialized.\n  */\n  flags = db->openFlags;\n  rc = sqlite3ParseUri(db->pVfs->zName, zFile, &flags, &pVfs, &zPath, &zErr);\n  if( rc!=SQLITE_OK ){\n    if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);\n    sqlite3_result_error(context, zErr, -1);\n    sqlite3_free(zErr);\n    return;\n  }\n  assert( pVfs );\n  flags |= SQLITE_OPEN_MAIN_DB;\n  rc = sqlite3BtreeOpen(pVfs, zPath, db, &aNew->pBt, 0, flags);\n  sqlite3_free( zPath );\n  db->nDb++;\n  if( rc==SQLITE_CONSTRAINT ){\n    rc = SQLITE_ERROR;\n    zErrDyn = sqlite3MPrintf(db, \"database is already attached\");\n  }else if( rc==SQLITE_OK ){\n    Pager *pPager;\n    aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);\n    if( !aNew->pSchema ){\n      rc = SQLITE_NOMEM_BKPT;\n    }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){\n      zErrDyn = sqlite3MPrintf(db, \n        \"attached databases must use the same text encoding as main database\");\n      rc = SQLITE_ERROR;\n    }\n    sqlite3BtreeEnter(aNew->pBt);\n    pPager = sqlite3BtreePager(aNew->pBt);\n    sqlite3PagerLockingMode(pPager, db->dfltLockMode);\n    sqlite3BtreeSecureDelete(aNew->pBt,\n                             sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) );\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\n    sqlite3BtreeSetPagerFlags(aNew->pBt,\n                      PAGER_SYNCHRONOUS_FULL | (db->flags & PAGER_FLAGS_MASK));\n#endif\n    sqlite3BtreeLeave(aNew->pBt);\n  }\n  aNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;\n  aNew->zDbSName = sqlite3DbStrDup(db, zName);\n  if( rc==SQLITE_OK && aNew->zDbSName==0 ){\n    rc = SQLITE_NOMEM_BKPT;\n  }\n\n\n#ifdef SQLITE_HAS_CODEC\n  if( rc==SQLITE_OK ){\n    extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);\n    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);\n    int nKey;\n    char *zKey;\n    int t = sqlite3_value_type(argv[2]);\n    switch( t ){\n      case SQLITE_INTEGER:\n      case SQLITE_FLOAT:\n        zErrDyn = sqlite3DbStrDup(db, \"Invalid key value\");\n        rc = SQLITE_ERROR;\n        break;\n        \n      case SQLITE_TEXT:\n      case SQLITE_BLOB:\n        nKey = sqlite3_value_bytes(argv[2]);\n        zKey = (char *)sqlite3_value_blob(argv[2]);\n        rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);\n        break;\n\n      case SQLITE_NULL:\n        /* No key specified.  Use the key from the main database */\n        sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);\n        if( nKey || sqlite3BtreeGetOptimalReserve(db->aDb[0].pBt)>0 ){\n          rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);\n        }\n        break;\n    }\n  }\n#endif\n\n  /* If the file was opened successfully, read the schema for the new database.\n  ** If this fails, or if opening the file failed, then close the file and \n  ** remove the entry from the db->aDb[] array. i.e. put everything back the way\n  ** we found it.\n  */\n  if( rc==SQLITE_OK ){\n    sqlite3BtreeEnterAll(db);\n    rc = sqlite3Init(db, &zErrDyn);\n    sqlite3BtreeLeaveAll(db);\n  }\n#ifdef SQLITE_USER_AUTHENTICATION\n  if( rc==SQLITE_OK ){\n    u8 newAuth = 0;\n    rc = sqlite3UserAuthCheckLogin(db, zName, &newAuth);\n    if( newAuth<db->auth.authLevel ){\n      rc = SQLITE_AUTH_USER;\n    }\n  }\n#endif\n  if( rc ){\n    int iDb = db->nDb - 1;\n    assert( iDb>=2 );\n    if( db->aDb[iDb].pBt ){\n      sqlite3BtreeClose(db->aDb[iDb].pBt);\n      db->aDb[iDb].pBt = 0;\n      db->aDb[iDb].pSchema = 0;\n    }\n    sqlite3ResetAllSchemasOfConnection(db);\n    db->nDb = iDb;\n    if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){\n      sqlite3OomFault(db);\n      sqlite3DbFree(db, zErrDyn);\n      zErrDyn = sqlite3MPrintf(db, \"out of memory\");\n    }else if( zErrDyn==0 ){\n      zErrDyn = sqlite3MPrintf(db, \"unable to open database: %s\", zFile);\n    }\n    goto attach_error;\n  }\n  \n  return;\n\nattach_error:\n  /* Return an error if we get here */\n  if( zErrDyn ){\n    sqlite3_result_error(context, zErrDyn, -1);\n    sqlite3DbFree(db, zErrDyn);\n  }\n  if( rc ) sqlite3_result_error_code(context, rc);\n}\n\n/*\n** An SQL user-function registered to do the work of an DETACH statement. The\n** three arguments to the function come directly from a detach statement:\n**\n**     DETACH DATABASE x\n**\n**     SELECT sqlite_detach(x)\n*/\nstatic void detachFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **argv\n){\n  const char *zName = (const char *)sqlite3_value_text(argv[0]);\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  int i;\n  Db *pDb = 0;\n  char zErr[128];\n\n  UNUSED_PARAMETER(NotUsed);\n\n  if( zName==0 ) zName = \"\";\n  for(i=0; i<db->nDb; i++){\n    pDb = &db->aDb[i];\n    if( pDb->pBt==0 ) continue;\n    if( sqlite3StrICmp(pDb->zDbSName, zName)==0 ) break;\n  }\n\n  if( i>=db->nDb ){\n    sqlite3_snprintf(sizeof(zErr),zErr, \"no such database: %s\", zName);\n    goto detach_error;\n  }\n  if( i<2 ){\n    sqlite3_snprintf(sizeof(zErr),zErr, \"cannot detach database %s\", zName);\n    goto detach_error;\n  }\n  if( !db->autoCommit ){\n    sqlite3_snprintf(sizeof(zErr), zErr,\n                     \"cannot DETACH database within transaction\");\n    goto detach_error;\n  }\n  if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){\n    sqlite3_snprintf(sizeof(zErr),zErr, \"database %s is locked\", zName);\n    goto detach_error;\n  }\n\n  sqlite3BtreeClose(pDb->pBt);\n  pDb->pBt = 0;\n  pDb->pSchema = 0;\n  sqlite3CollapseDatabaseArray(db);\n  return;\n\ndetach_error:\n  sqlite3_result_error(context, zErr, -1);\n}\n\n/*\n** This procedure generates VDBE code for a single invocation of either the\n** sqlite_detach() or sqlite_attach() SQL user functions.\n*/\nstatic void codeAttach(\n  Parse *pParse,       /* The parser context */\n  int type,            /* Either SQLITE_ATTACH or SQLITE_DETACH */\n  FuncDef const *pFunc,/* FuncDef wrapper for detachFunc() or attachFunc() */\n  Expr *pAuthArg,      /* Expression to pass to authorization callback */\n  Expr *pFilename,     /* Name of database file */\n  Expr *pDbname,       /* Name of the database to use internally */\n  Expr *pKey           /* Database key for encryption extension */\n){\n  int rc;\n  NameContext sName;\n  Vdbe *v;\n  sqlite3* db = pParse->db;\n  int regArgs;\n\n  if( pParse->nErr ) goto attach_end;\n  memset(&sName, 0, sizeof(NameContext));\n  sName.pParse = pParse;\n\n  if( \n      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pFilename)) ||\n      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pDbname)) ||\n      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pKey))\n  ){\n    goto attach_end;\n  }\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  if( pAuthArg ){\n    char *zAuthArg;\n    if( pAuthArg->op==TK_STRING ){\n      zAuthArg = pAuthArg->u.zToken;\n    }else{\n      zAuthArg = 0;\n    }\n    rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0);\n    if(rc!=SQLITE_OK ){\n      goto attach_end;\n    }\n  }\n#endif /* SQLITE_OMIT_AUTHORIZATION */\n\n\n  v = sqlite3GetVdbe(pParse);\n  regArgs = sqlite3GetTempRange(pParse, 4);\n  sqlite3ExprCode(pParse, pFilename, regArgs);\n  sqlite3ExprCode(pParse, pDbname, regArgs+1);\n  sqlite3ExprCode(pParse, pKey, regArgs+2);\n\n  assert( v || db->mallocFailed );\n  if( v ){\n    sqlite3VdbeAddOp4(v, OP_Function0, 0, regArgs+3-pFunc->nArg, regArgs+3,\n                      (char *)pFunc, P4_FUNCDEF);\n    assert( pFunc->nArg==-1 || (pFunc->nArg&0xff)==pFunc->nArg );\n    sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg));\n \n    /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this\n    ** statement only). For DETACH, set it to false (expire all existing\n    ** statements).\n    */\n    sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH));\n  }\n  \nattach_end:\n  sqlite3ExprDelete(db, pFilename);\n  sqlite3ExprDelete(db, pDbname);\n  sqlite3ExprDelete(db, pKey);\n}\n\n/*\n** Called by the parser to compile a DETACH statement.\n**\n**     DETACH pDbname\n*/\nvoid sqlite3Detach(Parse *pParse, Expr *pDbname){\n  static const FuncDef detach_func = {\n    1,                /* nArg */\n    SQLITE_UTF8,      /* funcFlags */\n    0,                /* pUserData */\n    0,                /* pNext */\n    detachFunc,       /* xSFunc */\n    0,                /* xFinalize */\n    \"sqlite_detach\",  /* zName */\n    {0}\n  };\n  codeAttach(pParse, SQLITE_DETACH, &detach_func, pDbname, 0, 0, pDbname);\n}\n\n/*\n** Called by the parser to compile an ATTACH statement.\n**\n**     ATTACH p AS pDbname KEY pKey\n*/\nvoid sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){\n  static const FuncDef attach_func = {\n    3,                /* nArg */\n    SQLITE_UTF8,      /* funcFlags */\n    0,                /* pUserData */\n    0,                /* pNext */\n    attachFunc,       /* xSFunc */\n    0,                /* xFinalize */\n    \"sqlite_attach\",  /* zName */\n    {0}\n  };\n  codeAttach(pParse, SQLITE_ATTACH, &attach_func, p, p, pDbname, pKey);\n}\n#endif /* SQLITE_OMIT_ATTACH */\n\n/*\n** Initialize a DbFixer structure.  This routine must be called prior\n** to passing the structure to one of the sqliteFixAAAA() routines below.\n*/\nvoid sqlite3FixInit(\n  DbFixer *pFix,      /* The fixer to be initialized */\n  Parse *pParse,      /* Error messages will be written here */\n  int iDb,            /* This is the database that must be used */\n  const char *zType,  /* \"view\", \"trigger\", or \"index\" */\n  const Token *pName  /* Name of the view, trigger, or index */\n){\n  sqlite3 *db;\n\n  db = pParse->db;\n  assert( db->nDb>iDb );\n  pFix->pParse = pParse;\n  pFix->zDb = db->aDb[iDb].zDbSName;\n  pFix->pSchema = db->aDb[iDb].pSchema;\n  pFix->zType = zType;\n  pFix->pName = pName;\n  pFix->bVarOnly = (iDb==1);\n}\n\n/*\n** The following set of routines walk through the parse tree and assign\n** a specific database to all table references where the database name\n** was left unspecified in the original SQL statement.  The pFix structure\n** must have been initialized by a prior call to sqlite3FixInit().\n**\n** These routines are used to make sure that an index, trigger, or\n** view in one database does not refer to objects in a different database.\n** (Exception: indices, triggers, and views in the TEMP database are\n** allowed to refer to anything.)  If a reference is explicitly made\n** to an object in a different database, an error message is added to\n** pParse->zErrMsg and these routines return non-zero.  If everything\n** checks out, these routines return 0.\n*/\nint sqlite3FixSrcList(\n  DbFixer *pFix,       /* Context of the fixation */\n  SrcList *pList       /* The Source list to check and modify */\n){\n  int i;\n  const char *zDb;\n  struct SrcList_item *pItem;\n\n  if( NEVER(pList==0) ) return 0;\n  zDb = pFix->zDb;\n  for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){\n    if( pFix->bVarOnly==0 ){\n      if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){\n        sqlite3ErrorMsg(pFix->pParse,\n            \"%s %T cannot reference objects in database %s\",\n            pFix->zType, pFix->pName, pItem->zDatabase);\n        return 1;\n      }\n      sqlite3DbFree(pFix->pParse->db, pItem->zDatabase);\n      pItem->zDatabase = 0;\n      pItem->pSchema = pFix->pSchema;\n    }\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)\n    if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;\n    if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;\n#endif\n  }\n  return 0;\n}\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)\nint sqlite3FixSelect(\n  DbFixer *pFix,       /* Context of the fixation */\n  Select *pSelect      /* The SELECT statement to be fixed to one database */\n){\n  while( pSelect ){\n    if( sqlite3FixExprList(pFix, pSelect->pEList) ){\n      return 1;\n    }\n    if( sqlite3FixSrcList(pFix, pSelect->pSrc) ){\n      return 1;\n    }\n    if( sqlite3FixExpr(pFix, pSelect->pWhere) ){\n      return 1;\n    }\n    if( sqlite3FixExprList(pFix, pSelect->pGroupBy) ){\n      return 1;\n    }\n    if( sqlite3FixExpr(pFix, pSelect->pHaving) ){\n      return 1;\n    }\n    if( sqlite3FixExprList(pFix, pSelect->pOrderBy) ){\n      return 1;\n    }\n    if( sqlite3FixExpr(pFix, pSelect->pLimit) ){\n      return 1;\n    }\n    if( sqlite3FixExpr(pFix, pSelect->pOffset) ){\n      return 1;\n    }\n    pSelect = pSelect->pPrior;\n  }\n  return 0;\n}\nint sqlite3FixExpr(\n  DbFixer *pFix,     /* Context of the fixation */\n  Expr *pExpr        /* The expression to be fixed to one database */\n){\n  while( pExpr ){\n    if( pExpr->op==TK_VARIABLE ){\n      if( pFix->pParse->db->init.busy ){\n        pExpr->op = TK_NULL;\n      }else{\n        sqlite3ErrorMsg(pFix->pParse, \"%s cannot use variables\", pFix->zType);\n        return 1;\n      }\n    }\n    if( ExprHasProperty(pExpr, EP_TokenOnly|EP_Leaf) ) break;\n    if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n      if( sqlite3FixSelect(pFix, pExpr->x.pSelect) ) return 1;\n    }else{\n      if( sqlite3FixExprList(pFix, pExpr->x.pList) ) return 1;\n    }\n    if( sqlite3FixExpr(pFix, pExpr->pRight) ){\n      return 1;\n    }\n    pExpr = pExpr->pLeft;\n  }\n  return 0;\n}\nint sqlite3FixExprList(\n  DbFixer *pFix,     /* Context of the fixation */\n  ExprList *pList    /* The expression to be fixed to one database */\n){\n  int i;\n  struct ExprList_item *pItem;\n  if( pList==0 ) return 0;\n  for(i=0, pItem=pList->a; i<pList->nExpr; i++, pItem++){\n    if( sqlite3FixExpr(pFix, pItem->pExpr) ){\n      return 1;\n    }\n  }\n  return 0;\n}\n#endif\n\n#ifndef SQLITE_OMIT_TRIGGER\nint sqlite3FixTriggerStep(\n  DbFixer *pFix,     /* Context of the fixation */\n  TriggerStep *pStep /* The trigger step be fixed to one database */\n){\n  while( pStep ){\n    if( sqlite3FixSelect(pFix, pStep->pSelect) ){\n      return 1;\n    }\n    if( sqlite3FixExpr(pFix, pStep->pWhere) ){\n      return 1;\n    }\n    if( sqlite3FixExprList(pFix, pStep->pExprList) ){\n      return 1;\n    }\n    pStep = pStep->pNext;\n  }\n  return 0;\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/auth.c",
    "content": "/*\n** 2003 January 11\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used to implement the sqlite3_set_authorizer()\n** API.  This facility is an optional feature of the library.  Embedded\n** systems that do not need this facility may omit it by recompiling\n** the library with -DSQLITE_OMIT_AUTHORIZATION=1\n*/\n#include \"sqliteInt.h\"\n\n/*\n** All of the code in this file may be omitted by defining a single\n** macro.\n*/\n#ifndef SQLITE_OMIT_AUTHORIZATION\n\n/*\n** Set or clear the access authorization function.\n**\n** The access authorization function is be called during the compilation\n** phase to verify that the user has read and/or write access permission on\n** various fields of the database.  The first argument to the auth function\n** is a copy of the 3rd argument to this routine.  The second argument\n** to the auth function is one of these constants:\n**\n**       SQLITE_CREATE_INDEX\n**       SQLITE_CREATE_TABLE\n**       SQLITE_CREATE_TEMP_INDEX\n**       SQLITE_CREATE_TEMP_TABLE\n**       SQLITE_CREATE_TEMP_TRIGGER\n**       SQLITE_CREATE_TEMP_VIEW\n**       SQLITE_CREATE_TRIGGER\n**       SQLITE_CREATE_VIEW\n**       SQLITE_DELETE\n**       SQLITE_DROP_INDEX\n**       SQLITE_DROP_TABLE\n**       SQLITE_DROP_TEMP_INDEX\n**       SQLITE_DROP_TEMP_TABLE\n**       SQLITE_DROP_TEMP_TRIGGER\n**       SQLITE_DROP_TEMP_VIEW\n**       SQLITE_DROP_TRIGGER\n**       SQLITE_DROP_VIEW\n**       SQLITE_INSERT\n**       SQLITE_PRAGMA\n**       SQLITE_READ\n**       SQLITE_SELECT\n**       SQLITE_TRANSACTION\n**       SQLITE_UPDATE\n**\n** The third and fourth arguments to the auth function are the name of\n** the table and the column that are being accessed.  The auth function\n** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE.  If\n** SQLITE_OK is returned, it means that access is allowed.  SQLITE_DENY\n** means that the SQL statement will never-run - the sqlite3_exec() call\n** will return with an error.  SQLITE_IGNORE means that the SQL statement\n** should run but attempts to read the specified column will return NULL\n** and attempts to write the column will be ignored.\n**\n** Setting the auth function to NULL disables this hook.  The default\n** setting of the auth function is NULL.\n*/\nint sqlite3_set_authorizer(\n  sqlite3 *db,\n  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),\n  void *pArg\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  db->xAuth = (sqlite3_xauth)xAuth;\n  db->pAuthArg = pArg;\n  sqlite3ExpirePreparedStatements(db);\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n\n/*\n** Write an error message into pParse->zErrMsg that explains that the\n** user-supplied authorization function returned an illegal value.\n*/\nstatic void sqliteAuthBadReturnCode(Parse *pParse){\n  sqlite3ErrorMsg(pParse, \"authorizer malfunction\");\n  pParse->rc = SQLITE_ERROR;\n}\n\n/*\n** Invoke the authorization callback for permission to read column zCol from\n** table zTab in database zDb. This function assumes that an authorization\n** callback has been registered (i.e. that sqlite3.xAuth is not NULL).\n**\n** If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed\n** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE\n** is treated as SQLITE_DENY. In this case an error is left in pParse.\n*/\nint sqlite3AuthReadCol(\n  Parse *pParse,                  /* The parser context */\n  const char *zTab,               /* Table name */\n  const char *zCol,               /* Column name */\n  int iDb                         /* Index of containing database. */\n){\n  sqlite3 *db = pParse->db;          /* Database handle */\n  char *zDb = db->aDb[iDb].zDbSName; /* Schema name of attached database */\n  int rc;                            /* Auth callback return code */\n\n  if( db->init.busy ) return SQLITE_OK;\n  rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext\n#ifdef SQLITE_USER_AUTHENTICATION\n                 ,db->auth.zAuthUser\n#endif\n                );\n  if( rc==SQLITE_DENY ){\n    if( db->nDb>2 || iDb!=0 ){\n      sqlite3ErrorMsg(pParse, \"access to %s.%s.%s is prohibited\",zDb,zTab,zCol);\n    }else{\n      sqlite3ErrorMsg(pParse, \"access to %s.%s is prohibited\", zTab, zCol);\n    }\n    pParse->rc = SQLITE_AUTH;\n  }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){\n    sqliteAuthBadReturnCode(pParse);\n  }\n  return rc;\n}\n\n/*\n** The pExpr should be a TK_COLUMN expression.  The table referred to\n** is in pTabList or else it is the NEW or OLD table of a trigger.  \n** Check to see if it is OK to read this particular column.\n**\n** If the auth function returns SQLITE_IGNORE, change the TK_COLUMN \n** instruction into a TK_NULL.  If the auth function returns SQLITE_DENY,\n** then generate an error.\n*/\nvoid sqlite3AuthRead(\n  Parse *pParse,        /* The parser context */\n  Expr *pExpr,          /* The expression to check authorization on */\n  Schema *pSchema,      /* The schema of the expression */\n  SrcList *pTabList     /* All table that pExpr might refer to */\n){\n  sqlite3 *db = pParse->db;\n  Table *pTab = 0;      /* The table being read */\n  const char *zCol;     /* Name of the column of the table */\n  int iSrc;             /* Index in pTabList->a[] of table being read */\n  int iDb;              /* The index of the database the expression refers to */\n  int iCol;             /* Index of column in table */\n\n  if( db->xAuth==0 ) return;\n  iDb = sqlite3SchemaToIndex(pParse->db, pSchema);\n  if( iDb<0 ){\n    /* An attempt to read a column out of a subquery or other\n    ** temporary table. */\n    return;\n  }\n\n  assert( pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER );\n  if( pExpr->op==TK_TRIGGER ){\n    pTab = pParse->pTriggerTab;\n  }else{\n    assert( pTabList );\n    for(iSrc=0; ALWAYS(iSrc<pTabList->nSrc); iSrc++){\n      if( pExpr->iTable==pTabList->a[iSrc].iCursor ){\n        pTab = pTabList->a[iSrc].pTab;\n        break;\n      }\n    }\n  }\n  iCol = pExpr->iColumn;\n  if( NEVER(pTab==0) ) return;\n\n  if( iCol>=0 ){\n    assert( iCol<pTab->nCol );\n    zCol = pTab->aCol[iCol].zName;\n  }else if( pTab->iPKey>=0 ){\n    assert( pTab->iPKey<pTab->nCol );\n    zCol = pTab->aCol[pTab->iPKey].zName;\n  }else{\n    zCol = \"ROWID\";\n  }\n  assert( iDb>=0 && iDb<db->nDb );\n  if( SQLITE_IGNORE==sqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){\n    pExpr->op = TK_NULL;\n  }\n}\n\n/*\n** Do an authorization check using the code and arguments given.  Return\n** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY.  If SQLITE_DENY\n** is returned, then the error count and error message in pParse are\n** modified appropriately.\n*/\nint sqlite3AuthCheck(\n  Parse *pParse,\n  int code,\n  const char *zArg1,\n  const char *zArg2,\n  const char *zArg3\n){\n  sqlite3 *db = pParse->db;\n  int rc;\n\n  /* Don't do any authorization checks if the database is initialising\n  ** or if the parser is being invoked from within sqlite3_declare_vtab.\n  */\n  if( db->init.busy || IN_DECLARE_VTAB ){\n    return SQLITE_OK;\n  }\n\n  if( db->xAuth==0 ){\n    return SQLITE_OK;\n  }\n  rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext\n#ifdef SQLITE_USER_AUTHENTICATION\n                 ,db->auth.zAuthUser\n#endif\n                );\n  if( rc==SQLITE_DENY ){\n    sqlite3ErrorMsg(pParse, \"not authorized\");\n    pParse->rc = SQLITE_AUTH;\n  }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){\n    rc = SQLITE_DENY;\n    sqliteAuthBadReturnCode(pParse);\n  }\n  return rc;\n}\n\n/*\n** Push an authorization context.  After this routine is called, the\n** zArg3 argument to authorization callbacks will be zContext until\n** popped.  Or if pParse==0, this routine is a no-op.\n*/\nvoid sqlite3AuthContextPush(\n  Parse *pParse,\n  AuthContext *pContext, \n  const char *zContext\n){\n  assert( pParse );\n  pContext->pParse = pParse;\n  pContext->zAuthContext = pParse->zAuthContext;\n  pParse->zAuthContext = zContext;\n}\n\n/*\n** Pop an authorization context that was previously pushed\n** by sqlite3AuthContextPush\n*/\nvoid sqlite3AuthContextPop(AuthContext *pContext){\n  if( pContext->pParse ){\n    pContext->pParse->zAuthContext = pContext->zAuthContext;\n    pContext->pParse = 0;\n  }\n}\n\n#endif /* SQLITE_OMIT_AUTHORIZATION */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/backup.c",
    "content": "/*\n** 2009 January 28\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the implementation of the sqlite3_backup_XXX() \n** API functions and the related features.\n*/\n#include \"sqliteInt.h\"\n#include \"btreeInt.h\"\n\n/*\n** Structure allocated for each backup operation.\n*/\nstruct sqlite3_backup {\n  sqlite3* pDestDb;        /* Destination database handle */\n  Btree *pDest;            /* Destination b-tree file */\n  u32 iDestSchema;         /* Original schema cookie in destination */\n  int bDestLocked;         /* True once a write-transaction is open on pDest */\n\n  Pgno iNext;              /* Page number of the next source page to copy */\n  sqlite3* pSrcDb;         /* Source database handle */\n  Btree *pSrc;             /* Source b-tree file */\n\n  int rc;                  /* Backup process error code */\n\n  /* These two variables are set by every call to backup_step(). They are\n  ** read by calls to backup_remaining() and backup_pagecount().\n  */\n  Pgno nRemaining;         /* Number of pages left to copy */\n  Pgno nPagecount;         /* Total number of pages to copy */\n\n  int isAttached;          /* True once backup has been registered with pager */\n  sqlite3_backup *pNext;   /* Next backup associated with source pager */\n};\n\n/*\n** THREAD SAFETY NOTES:\n**\n**   Once it has been created using backup_init(), a single sqlite3_backup\n**   structure may be accessed via two groups of thread-safe entry points:\n**\n**     * Via the sqlite3_backup_XXX() API function backup_step() and \n**       backup_finish(). Both these functions obtain the source database\n**       handle mutex and the mutex associated with the source BtShared \n**       structure, in that order.\n**\n**     * Via the BackupUpdate() and BackupRestart() functions, which are\n**       invoked by the pager layer to report various state changes in\n**       the page cache associated with the source database. The mutex\n**       associated with the source database BtShared structure will always \n**       be held when either of these functions are invoked.\n**\n**   The other sqlite3_backup_XXX() API functions, backup_remaining() and\n**   backup_pagecount() are not thread-safe functions. If they are called\n**   while some other thread is calling backup_step() or backup_finish(),\n**   the values returned may be invalid. There is no way for a call to\n**   BackupUpdate() or BackupRestart() to interfere with backup_remaining()\n**   or backup_pagecount().\n**\n**   Depending on the SQLite configuration, the database handles and/or\n**   the Btree objects may have their own mutexes that require locking.\n**   Non-sharable Btrees (in-memory databases for example), do not have\n**   associated mutexes.\n*/\n\n/*\n** Return a pointer corresponding to database zDb (i.e. \"main\", \"temp\")\n** in connection handle pDb. If such a database cannot be found, return\n** a NULL pointer and write an error message to pErrorDb.\n**\n** If the \"temp\" database is requested, it may need to be opened by this \n** function. If an error occurs while doing so, return 0 and write an \n** error message to pErrorDb.\n*/\nstatic Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){\n  int i = sqlite3FindDbName(pDb, zDb);\n\n  if( i==1 ){\n    Parse sParse;\n    int rc = 0;\n    memset(&sParse, 0, sizeof(sParse));\n    sParse.db = pDb;\n    if( sqlite3OpenTempDatabase(&sParse) ){\n      sqlite3ErrorWithMsg(pErrorDb, sParse.rc, \"%s\", sParse.zErrMsg);\n      rc = SQLITE_ERROR;\n    }\n    sqlite3DbFree(pErrorDb, sParse.zErrMsg);\n    sqlite3ParserReset(&sParse);\n    if( rc ){\n      return 0;\n    }\n  }\n\n  if( i<0 ){\n    sqlite3ErrorWithMsg(pErrorDb, SQLITE_ERROR, \"unknown database %s\", zDb);\n    return 0;\n  }\n\n  return pDb->aDb[i].pBt;\n}\n\n/*\n** Attempt to set the page size of the destination to match the page size\n** of the source.\n*/\nstatic int setDestPgsz(sqlite3_backup *p){\n  int rc;\n  rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0);\n  return rc;\n}\n\n/*\n** Check that there is no open read-transaction on the b-tree passed as the\n** second argument. If there is not, return SQLITE_OK. Otherwise, if there\n** is an open read-transaction, return SQLITE_ERROR and leave an error \n** message in database handle db.\n*/\nstatic int checkReadTransaction(sqlite3 *db, Btree *p){\n  if( sqlite3BtreeIsInReadTrans(p) ){\n    sqlite3ErrorWithMsg(db, SQLITE_ERROR, \"destination database is in use\");\n    return SQLITE_ERROR;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Create an sqlite3_backup process to copy the contents of zSrcDb from\n** connection handle pSrcDb to zDestDb in pDestDb. If successful, return\n** a pointer to the new sqlite3_backup object.\n**\n** If an error occurs, NULL is returned and an error code and error message\n** stored in database handle pDestDb.\n*/\nsqlite3_backup *sqlite3_backup_init(\n  sqlite3* pDestDb,                     /* Database to write to */\n  const char *zDestDb,                  /* Name of database within pDestDb */\n  sqlite3* pSrcDb,                      /* Database connection to read from */\n  const char *zSrcDb                    /* Name of database within pSrcDb */\n){\n  sqlite3_backup *p;                    /* Value to return */\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(pSrcDb)||!sqlite3SafetyCheckOk(pDestDb) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n\n  /* Lock the source database handle. The destination database\n  ** handle is not locked in this routine, but it is locked in\n  ** sqlite3_backup_step(). The user is required to ensure that no\n  ** other thread accesses the destination handle for the duration\n  ** of the backup operation.  Any attempt to use the destination\n  ** database connection while a backup is in progress may cause\n  ** a malfunction or a deadlock.\n  */\n  sqlite3_mutex_enter(pSrcDb->mutex);\n  sqlite3_mutex_enter(pDestDb->mutex);\n\n  if( pSrcDb==pDestDb ){\n    sqlite3ErrorWithMsg(\n        pDestDb, SQLITE_ERROR, \"source and destination must be distinct\"\n    );\n    p = 0;\n  }else {\n    /* Allocate space for a new sqlite3_backup object...\n    ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a\n    ** call to sqlite3_backup_init() and is destroyed by a call to\n    ** sqlite3_backup_finish(). */\n    p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup));\n    if( !p ){\n      sqlite3Error(pDestDb, SQLITE_NOMEM_BKPT);\n    }\n  }\n\n  /* If the allocation succeeded, populate the new object. */\n  if( p ){\n    p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb);\n    p->pDest = findBtree(pDestDb, pDestDb, zDestDb);\n    p->pDestDb = pDestDb;\n    p->pSrcDb = pSrcDb;\n    p->iNext = 1;\n    p->isAttached = 0;\n\n    if( 0==p->pSrc || 0==p->pDest \n     || checkReadTransaction(pDestDb, p->pDest)!=SQLITE_OK \n     ){\n      /* One (or both) of the named databases did not exist or an OOM\n      ** error was hit. Or there is a transaction open on the destination\n      ** database. The error has already been written into the pDestDb \n      ** handle. All that is left to do here is free the sqlite3_backup \n      ** structure.  */\n      sqlite3_free(p);\n      p = 0;\n    }\n  }\n  if( p ){\n    p->pSrc->nBackup++;\n  }\n\n  sqlite3_mutex_leave(pDestDb->mutex);\n  sqlite3_mutex_leave(pSrcDb->mutex);\n  return p;\n}\n\n/*\n** Argument rc is an SQLite error code. Return true if this error is \n** considered fatal if encountered during a backup operation. All errors\n** are considered fatal except for SQLITE_BUSY and SQLITE_LOCKED.\n*/\nstatic int isFatalError(int rc){\n  return (rc!=SQLITE_OK && rc!=SQLITE_BUSY && ALWAYS(rc!=SQLITE_LOCKED));\n}\n\n/*\n** Parameter zSrcData points to a buffer containing the data for \n** page iSrcPg from the source database. Copy this data into the \n** destination database.\n*/\nstatic int backupOnePage(\n  sqlite3_backup *p,              /* Backup handle */\n  Pgno iSrcPg,                    /* Source database page to backup */\n  const u8 *zSrcData,             /* Source database page data */\n  int bUpdate                     /* True for an update, false otherwise */\n){\n  Pager * const pDestPager = sqlite3BtreePager(p->pDest);\n  const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc);\n  int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest);\n  const int nCopy = MIN(nSrcPgsz, nDestPgsz);\n  const i64 iEnd = (i64)iSrcPg*(i64)nSrcPgsz;\n#ifdef SQLITE_HAS_CODEC\n  /* Use BtreeGetReserveNoMutex() for the source b-tree, as although it is\n  ** guaranteed that the shared-mutex is held by this thread, handle\n  ** p->pSrc may not actually be the owner.  */\n  int nSrcReserve = sqlite3BtreeGetReserveNoMutex(p->pSrc);\n  int nDestReserve = sqlite3BtreeGetOptimalReserve(p->pDest);\n#endif\n  int rc = SQLITE_OK;\n  i64 iOff;\n\n  assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 );\n  assert( p->bDestLocked );\n  assert( !isFatalError(p->rc) );\n  assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) );\n  assert( zSrcData );\n\n  /* Catch the case where the destination is an in-memory database and the\n  ** page sizes of the source and destination differ. \n  */\n  if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){\n    rc = SQLITE_READONLY;\n  }\n\n#ifdef SQLITE_HAS_CODEC\n  /* Backup is not possible if the page size of the destination is changing\n  ** and a codec is in use.\n  */\n#if defined (SQLCIPHER_PREPROCESSED)\n    extern void *sqlite3PagerGetCodec(Pager *pPager);\n#endif /* SQLCIPHER_PREPROCESSED */\n  if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){\n    rc = SQLITE_READONLY;\n  }\n\n  /* Backup is not possible if the number of bytes of reserve space differ\n  ** between source and destination.  If there is a difference, try to\n  ** fix the destination to agree with the source.  If that is not possible,\n  ** then the backup cannot proceed.\n  */\n  if( nSrcReserve!=nDestReserve ){\n    u32 newPgsz = nSrcPgsz;\n    rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve);\n    if( rc==SQLITE_OK && newPgsz!=nSrcPgsz ) rc = SQLITE_READONLY;\n  }\n#endif\n\n  /* This loop runs once for each destination page spanned by the source \n  ** page. For each iteration, variable iOff is set to the byte offset\n  ** of the destination page.\n  */\n  for(iOff=iEnd-(i64)nSrcPgsz; rc==SQLITE_OK && iOff<iEnd; iOff+=nDestPgsz){\n    DbPage *pDestPg = 0;\n    Pgno iDest = (Pgno)(iOff/nDestPgsz)+1;\n    if( iDest==PENDING_BYTE_PAGE(p->pDest->pBt) ) continue;\n    if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg, 0))\n     && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg))\n    ){\n      const u8 *zIn = &zSrcData[iOff%nSrcPgsz];\n      u8 *zDestData = sqlite3PagerGetData(pDestPg);\n      u8 *zOut = &zDestData[iOff%nDestPgsz];\n\n      /* Copy the data from the source page into the destination page.\n      ** Then clear the Btree layer MemPage.isInit flag. Both this module\n      ** and the pager code use this trick (clearing the first byte\n      ** of the page 'extra' space to invalidate the Btree layers\n      ** cached parse of the page). MemPage.isInit is marked \n      ** \"MUST BE FIRST\" for this purpose.\n      */\n      memcpy(zOut, zIn, nCopy);\n      ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0;\n      if( iOff==0 && bUpdate==0 ){\n        sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc));\n      }\n    }\n    sqlite3PagerUnref(pDestPg);\n  }\n\n  return rc;\n}\n\n/*\n** If pFile is currently larger than iSize bytes, then truncate it to\n** exactly iSize bytes. If pFile is not larger than iSize bytes, then\n** this function is a no-op.\n**\n** Return SQLITE_OK if everything is successful, or an SQLite error \n** code if an error occurs.\n*/\nstatic int backupTruncateFile(sqlite3_file *pFile, i64 iSize){\n  i64 iCurrent;\n  int rc = sqlite3OsFileSize(pFile, &iCurrent);\n  if( rc==SQLITE_OK && iCurrent>iSize ){\n    rc = sqlite3OsTruncate(pFile, iSize);\n  }\n  return rc;\n}\n\n/*\n** Register this backup object with the associated source pager for\n** callbacks when pages are changed or the cache invalidated.\n*/\nstatic void attachBackupObject(sqlite3_backup *p){\n  sqlite3_backup **pp;\n  assert( sqlite3BtreeHoldsMutex(p->pSrc) );\n  pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));\n  p->pNext = *pp;\n  *pp = p;\n  p->isAttached = 1;\n}\n\n/*\n** Copy nPage pages from the source b-tree to the destination.\n*/\nint sqlite3_backup_step(sqlite3_backup *p, int nPage){\n  int rc;\n  int destMode;       /* Destination journal mode */\n  int pgszSrc = 0;    /* Source page size */\n  int pgszDest = 0;   /* Destination page size */\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( p==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(p->pSrcDb->mutex);\n  sqlite3BtreeEnter(p->pSrc);\n  if( p->pDestDb ){\n    sqlite3_mutex_enter(p->pDestDb->mutex);\n  }\n\n  rc = p->rc;\n  if( !isFatalError(rc) ){\n    Pager * const pSrcPager = sqlite3BtreePager(p->pSrc);     /* Source pager */\n    Pager * const pDestPager = sqlite3BtreePager(p->pDest);   /* Dest pager */\n    int ii;                            /* Iterator variable */\n    int nSrcPage = -1;                 /* Size of source db in pages */\n    int bCloseTrans = 0;               /* True if src db requires unlocking */\n\n    /* If the source pager is currently in a write-transaction, return\n    ** SQLITE_BUSY immediately.\n    */\n    if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){\n      rc = SQLITE_BUSY;\n    }else{\n      rc = SQLITE_OK;\n    }\n\n    /* If there is no open read-transaction on the source database, open\n    ** one now. If a transaction is opened here, then it will be closed\n    ** before this function exits.\n    */\n    if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){\n      rc = sqlite3BtreeBeginTrans(p->pSrc, 0);\n      bCloseTrans = 1;\n    }\n\n    /* If the destination database has not yet been locked (i.e. if this\n    ** is the first call to backup_step() for the current backup operation),\n    ** try to set its page size to the same as the source database. This\n    ** is especially important on ZipVFS systems, as in that case it is\n    ** not possible to create a database file that uses one page size by\n    ** writing to it with another.  */\n    if( p->bDestLocked==0 && rc==SQLITE_OK && setDestPgsz(p)==SQLITE_NOMEM ){\n      rc = SQLITE_NOMEM;\n    }\n\n    /* Lock the destination database, if it is not locked already. */\n    if( SQLITE_OK==rc && p->bDestLocked==0\n     && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2)) \n    ){\n      p->bDestLocked = 1;\n      sqlite3BtreeGetMeta(p->pDest, BTREE_SCHEMA_VERSION, &p->iDestSchema);\n    }\n\n    /* Do not allow backup if the destination database is in WAL mode\n    ** and the page sizes are different between source and destination */\n    pgszSrc = sqlite3BtreeGetPageSize(p->pSrc);\n    pgszDest = sqlite3BtreeGetPageSize(p->pDest);\n    destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest));\n    if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){\n      rc = SQLITE_READONLY;\n    }\n  \n    /* Now that there is a read-lock on the source database, query the\n    ** source pager for the number of pages in the database.\n    */\n    nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc);\n    assert( nSrcPage>=0 );\n    for(ii=0; (nPage<0 || ii<nPage) && p->iNext<=(Pgno)nSrcPage && !rc; ii++){\n      const Pgno iSrcPg = p->iNext;                 /* Source page number */\n      if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){\n        DbPage *pSrcPg;                             /* Source page object */\n        rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg,PAGER_GET_READONLY);\n        if( rc==SQLITE_OK ){\n          rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg), 0);\n          sqlite3PagerUnref(pSrcPg);\n        }\n      }\n      p->iNext++;\n    }\n    if( rc==SQLITE_OK ){\n      p->nPagecount = nSrcPage;\n      p->nRemaining = nSrcPage+1-p->iNext;\n      if( p->iNext>(Pgno)nSrcPage ){\n        rc = SQLITE_DONE;\n      }else if( !p->isAttached ){\n        attachBackupObject(p);\n      }\n    }\n  \n    /* Update the schema version field in the destination database. This\n    ** is to make sure that the schema-version really does change in\n    ** the case where the source and destination databases have the\n    ** same schema version.\n    */\n    if( rc==SQLITE_DONE ){\n      if( nSrcPage==0 ){\n        rc = sqlite3BtreeNewDb(p->pDest);\n        nSrcPage = 1;\n      }\n      if( rc==SQLITE_OK || rc==SQLITE_DONE ){\n        rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1);\n      }\n      if( rc==SQLITE_OK ){\n        if( p->pDestDb ){\n          sqlite3ResetAllSchemasOfConnection(p->pDestDb);\n        }\n        if( destMode==PAGER_JOURNALMODE_WAL ){\n          rc = sqlite3BtreeSetVersion(p->pDest, 2);\n        }\n      }\n      if( rc==SQLITE_OK ){\n        int nDestTruncate;\n        /* Set nDestTruncate to the final number of pages in the destination\n        ** database. The complication here is that the destination page\n        ** size may be different to the source page size. \n        **\n        ** If the source page size is smaller than the destination page size, \n        ** round up. In this case the call to sqlite3OsTruncate() below will\n        ** fix the size of the file. However it is important to call\n        ** sqlite3PagerTruncateImage() here so that any pages in the \n        ** destination file that lie beyond the nDestTruncate page mark are\n        ** journalled by PagerCommitPhaseOne() before they are destroyed\n        ** by the file truncation.\n        */\n        assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) );\n        assert( pgszDest==sqlite3BtreeGetPageSize(p->pDest) );\n        if( pgszSrc<pgszDest ){\n          int ratio = pgszDest/pgszSrc;\n          nDestTruncate = (nSrcPage+ratio-1)/ratio;\n          if( nDestTruncate==(int)PENDING_BYTE_PAGE(p->pDest->pBt) ){\n            nDestTruncate--;\n          }\n        }else{\n          nDestTruncate = nSrcPage * (pgszSrc/pgszDest);\n        }\n        assert( nDestTruncate>0 );\n\n        if( pgszSrc<pgszDest ){\n          /* If the source page-size is smaller than the destination page-size,\n          ** two extra things may need to happen:\n          **\n          **   * The destination may need to be truncated, and\n          **\n          **   * Data stored on the pages immediately following the \n          **     pending-byte page in the source database may need to be\n          **     copied into the destination database.\n          */\n          const i64 iSize = (i64)pgszSrc * (i64)nSrcPage;\n          sqlite3_file * const pFile = sqlite3PagerFile(pDestPager);\n          Pgno iPg;\n          int nDstPage;\n          i64 iOff;\n          i64 iEnd;\n\n          assert( pFile );\n          assert( nDestTruncate==0 \n              || (i64)nDestTruncate*(i64)pgszDest >= iSize || (\n                nDestTruncate==(int)(PENDING_BYTE_PAGE(p->pDest->pBt)-1)\n             && iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+pgszDest\n          ));\n\n          /* This block ensures that all data required to recreate the original\n          ** database has been stored in the journal for pDestPager and the\n          ** journal synced to disk. So at this point we may safely modify\n          ** the database file in any way, knowing that if a power failure\n          ** occurs, the original database will be reconstructed from the \n          ** journal file.  */\n          sqlite3PagerPagecount(pDestPager, &nDstPage);\n          for(iPg=nDestTruncate; rc==SQLITE_OK && iPg<=(Pgno)nDstPage; iPg++){\n            if( iPg!=PENDING_BYTE_PAGE(p->pDest->pBt) ){\n              DbPage *pPg;\n              rc = sqlite3PagerGet(pDestPager, iPg, &pPg, 0);\n              if( rc==SQLITE_OK ){\n                rc = sqlite3PagerWrite(pPg);\n                sqlite3PagerUnref(pPg);\n              }\n            }\n          }\n          if( rc==SQLITE_OK ){\n            rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1);\n          }\n\n          /* Write the extra pages and truncate the database file as required */\n          iEnd = MIN(PENDING_BYTE + pgszDest, iSize);\n          for(\n            iOff=PENDING_BYTE+pgszSrc; \n            rc==SQLITE_OK && iOff<iEnd; \n            iOff+=pgszSrc\n          ){\n            PgHdr *pSrcPg = 0;\n            const Pgno iSrcPg = (Pgno)((iOff/pgszSrc)+1);\n            rc = sqlite3PagerGet(pSrcPager, iSrcPg, &pSrcPg, 0);\n            if( rc==SQLITE_OK ){\n              u8 *zData = sqlite3PagerGetData(pSrcPg);\n              rc = sqlite3OsWrite(pFile, zData, pgszSrc, iOff);\n            }\n            sqlite3PagerUnref(pSrcPg);\n          }\n          if( rc==SQLITE_OK ){\n            rc = backupTruncateFile(pFile, iSize);\n          }\n\n          /* Sync the database file to disk. */\n          if( rc==SQLITE_OK ){\n            rc = sqlite3PagerSync(pDestPager, 0);\n          }\n        }else{\n          sqlite3PagerTruncateImage(pDestPager, nDestTruncate);\n          rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 0);\n        }\n    \n        /* Finish committing the transaction to the destination database. */\n        if( SQLITE_OK==rc\n         && SQLITE_OK==(rc = sqlite3BtreeCommitPhaseTwo(p->pDest, 0))\n        ){\n          rc = SQLITE_DONE;\n        }\n      }\n    }\n  \n    /* If bCloseTrans is true, then this function opened a read transaction\n    ** on the source database. Close the read transaction here. There is\n    ** no need to check the return values of the btree methods here, as\n    ** \"committing\" a read-only transaction cannot fail.\n    */\n    if( bCloseTrans ){\n      TESTONLY( int rc2 );\n      TESTONLY( rc2  = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0);\n      TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0);\n      assert( rc2==SQLITE_OK );\n    }\n  \n    if( rc==SQLITE_IOERR_NOMEM ){\n      rc = SQLITE_NOMEM_BKPT;\n    }\n    p->rc = rc;\n  }\n  if( p->pDestDb ){\n    sqlite3_mutex_leave(p->pDestDb->mutex);\n  }\n  sqlite3BtreeLeave(p->pSrc);\n  sqlite3_mutex_leave(p->pSrcDb->mutex);\n  return rc;\n}\n\n/*\n** Release all resources associated with an sqlite3_backup* handle.\n*/\nint sqlite3_backup_finish(sqlite3_backup *p){\n  sqlite3_backup **pp;                 /* Ptr to head of pagers backup list */\n  sqlite3 *pSrcDb;                     /* Source database connection */\n  int rc;                              /* Value to return */\n\n  /* Enter the mutexes */\n  if( p==0 ) return SQLITE_OK;\n  pSrcDb = p->pSrcDb;\n  sqlite3_mutex_enter(pSrcDb->mutex);\n  sqlite3BtreeEnter(p->pSrc);\n  if( p->pDestDb ){\n    sqlite3_mutex_enter(p->pDestDb->mutex);\n  }\n\n  /* Detach this backup from the source pager. */\n  if( p->pDestDb ){\n    p->pSrc->nBackup--;\n  }\n  if( p->isAttached ){\n    pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc));\n    while( *pp!=p ){\n      pp = &(*pp)->pNext;\n    }\n    *pp = p->pNext;\n  }\n\n  /* If a transaction is still open on the Btree, roll it back. */\n  sqlite3BtreeRollback(p->pDest, SQLITE_OK, 0);\n\n  /* Set the error code of the destination database handle. */\n  rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;\n  if( p->pDestDb ){\n    sqlite3Error(p->pDestDb, rc);\n\n    /* Exit the mutexes and free the backup context structure. */\n    sqlite3LeaveMutexAndCloseZombie(p->pDestDb);\n  }\n  sqlite3BtreeLeave(p->pSrc);\n  if( p->pDestDb ){\n    /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a\n    ** call to sqlite3_backup_init() and is destroyed by a call to\n    ** sqlite3_backup_finish(). */\n    sqlite3_free(p);\n  }\n  sqlite3LeaveMutexAndCloseZombie(pSrcDb);\n  return rc;\n}\n\n/*\n** Return the number of pages still to be backed up as of the most recent\n** call to sqlite3_backup_step().\n*/\nint sqlite3_backup_remaining(sqlite3_backup *p){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( p==0 ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  return p->nRemaining;\n}\n\n/*\n** Return the total number of pages in the source database as of the most \n** recent call to sqlite3_backup_step().\n*/\nint sqlite3_backup_pagecount(sqlite3_backup *p){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( p==0 ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  return p->nPagecount;\n}\n\n/*\n** This function is called after the contents of page iPage of the\n** source database have been modified. If page iPage has already been \n** copied into the destination database, then the data written to the\n** destination is now invalidated. The destination copy of iPage needs\n** to be updated with the new data before the backup operation is\n** complete.\n**\n** It is assumed that the mutex associated with the BtShared object\n** corresponding to the source database is held when this function is\n** called.\n*/\nstatic SQLITE_NOINLINE void backupUpdate(\n  sqlite3_backup *p,\n  Pgno iPage,\n  const u8 *aData\n){\n  assert( p!=0 );\n  do{\n    assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );\n    if( !isFatalError(p->rc) && iPage<p->iNext ){\n      /* The backup process p has already copied page iPage. But now it\n      ** has been modified by a transaction on the source pager. Copy\n      ** the new data into the backup.\n      */\n      int rc;\n      assert( p->pDestDb );\n      sqlite3_mutex_enter(p->pDestDb->mutex);\n      rc = backupOnePage(p, iPage, aData, 1);\n      sqlite3_mutex_leave(p->pDestDb->mutex);\n      assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED );\n      if( rc!=SQLITE_OK ){\n        p->rc = rc;\n      }\n    }\n  }while( (p = p->pNext)!=0 );\n}\nvoid sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, const u8 *aData){\n  if( pBackup ) backupUpdate(pBackup, iPage, aData);\n}\n\n/*\n** Restart the backup process. This is called when the pager layer\n** detects that the database has been modified by an external database\n** connection. In this case there is no way of knowing which of the\n** pages that have been copied into the destination database are still \n** valid and which are not, so the entire process needs to be restarted.\n**\n** It is assumed that the mutex associated with the BtShared object\n** corresponding to the source database is held when this function is\n** called.\n*/\nvoid sqlite3BackupRestart(sqlite3_backup *pBackup){\n  sqlite3_backup *p;                   /* Iterator variable */\n  for(p=pBackup; p; p=p->pNext){\n    assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );\n    p->iNext = 1;\n  }\n}\n\n#ifndef SQLITE_OMIT_VACUUM\n/*\n** Copy the complete content of pBtFrom into pBtTo.  A transaction\n** must be active for both files.\n**\n** The size of file pTo may be reduced by this operation. If anything \n** goes wrong, the transaction on pTo is rolled back. If successful, the \n** transaction is committed before returning.\n*/\nint sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){\n  int rc;\n  sqlite3_file *pFd;              /* File descriptor for database pTo */\n  sqlite3_backup b;\n  sqlite3BtreeEnter(pTo);\n  sqlite3BtreeEnter(pFrom);\n\n  assert( sqlite3BtreeIsInTrans(pTo) );\n  pFd = sqlite3PagerFile(sqlite3BtreePager(pTo));\n  if( pFd->pMethods ){\n    i64 nByte = sqlite3BtreeGetPageSize(pFrom)*(i64)sqlite3BtreeLastPage(pFrom);\n    rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte);\n    if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;\n    if( rc ) goto copy_finished;\n  }\n\n  /* Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set\n  ** to 0. This is used by the implementations of sqlite3_backup_step()\n  ** and sqlite3_backup_finish() to detect that they are being called\n  ** from this function, not directly by the user.\n  */\n  memset(&b, 0, sizeof(b));\n  b.pSrcDb = pFrom->db;\n  b.pSrc = pFrom;\n  b.pDest = pTo;\n  b.iNext = 1;\n\n#ifdef SQLITE_HAS_CODEC\n  sqlite3PagerAlignReserve(sqlite3BtreePager(pTo), sqlite3BtreePager(pFrom));\n#endif\n\n  /* 0x7FFFFFFF is the hard limit for the number of pages in a database\n  ** file. By passing this as the number of pages to copy to\n  ** sqlite3_backup_step(), we can guarantee that the copy finishes \n  ** within a single call (unless an error occurs). The assert() statement\n  ** checks this assumption - (p->rc) should be set to either SQLITE_DONE \n  ** or an error code.  */\n  sqlite3_backup_step(&b, 0x7FFFFFFF);\n  assert( b.rc!=SQLITE_OK );\n\n  rc = sqlite3_backup_finish(&b);\n  if( rc==SQLITE_OK ){\n    pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED;\n  }else{\n    sqlite3PagerClearCache(sqlite3BtreePager(b.pDest));\n  }\n\n  assert( sqlite3BtreeIsInTrans(pTo)==0 );\ncopy_finished:\n  sqlite3BtreeLeave(pFrom);\n  sqlite3BtreeLeave(pTo);\n  return rc;\n}\n#endif /* SQLITE_OMIT_VACUUM */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/bitvec.c",
    "content": "/*\n** 2008 February 16\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file implements an object that represents a fixed-length\n** bitmap.  Bits are numbered starting with 1.\n**\n** A bitmap is used to record which pages of a database file have been\n** journalled during a transaction, or which pages have the \"dont-write\"\n** property.  Usually only a few pages are meet either condition.\n** So the bitmap is usually sparse and has low cardinality.\n** But sometimes (for example when during a DROP of a large table) most\n** or all of the pages in a database can get journalled.  In those cases, \n** the bitmap becomes dense with high cardinality.  The algorithm needs \n** to handle both cases well.\n**\n** The size of the bitmap is fixed when the object is created.\n**\n** All bits are clear when the bitmap is created.  Individual bits\n** may be set or cleared one at a time.\n**\n** Test operations are about 100 times more common that set operations.\n** Clear operations are exceedingly rare.  There are usually between\n** 5 and 500 set operations per Bitvec object, though the number of sets can\n** sometimes grow into tens of thousands or larger.  The size of the\n** Bitvec object is the number of pages in the database file at the\n** start of a transaction, and is thus usually less than a few thousand,\n** but can be as large as 2 billion for a really big database.\n*/\n#include \"sqliteInt.h\"\n\n/* Size of the Bitvec structure in bytes. */\n#define BITVEC_SZ        512\n\n/* Round the union size down to the nearest pointer boundary, since that's how \n** it will be aligned within the Bitvec struct. */\n#define BITVEC_USIZE \\\n    (((BITVEC_SZ-(3*sizeof(u32)))/sizeof(Bitvec*))*sizeof(Bitvec*))\n\n/* Type of the array \"element\" for the bitmap representation. \n** Should be a power of 2, and ideally, evenly divide into BITVEC_USIZE. \n** Setting this to the \"natural word\" size of your CPU may improve\n** performance. */\n#define BITVEC_TELEM     u8\n/* Size, in bits, of the bitmap element. */\n#define BITVEC_SZELEM    8\n/* Number of elements in a bitmap array. */\n#define BITVEC_NELEM     (BITVEC_USIZE/sizeof(BITVEC_TELEM))\n/* Number of bits in the bitmap array. */\n#define BITVEC_NBIT      (BITVEC_NELEM*BITVEC_SZELEM)\n\n/* Number of u32 values in hash table. */\n#define BITVEC_NINT      (BITVEC_USIZE/sizeof(u32))\n/* Maximum number of entries in hash table before \n** sub-dividing and re-hashing. */\n#define BITVEC_MXHASH    (BITVEC_NINT/2)\n/* Hashing function for the aHash representation.\n** Empirical testing showed that the *37 multiplier \n** (an arbitrary prime)in the hash function provided \n** no fewer collisions than the no-op *1. */\n#define BITVEC_HASH(X)   (((X)*1)%BITVEC_NINT)\n\n#define BITVEC_NPTR      (BITVEC_USIZE/sizeof(Bitvec *))\n\n\n/*\n** A bitmap is an instance of the following structure.\n**\n** This bitmap records the existence of zero or more bits\n** with values between 1 and iSize, inclusive.\n**\n** There are three possible representations of the bitmap.\n** If iSize<=BITVEC_NBIT, then Bitvec.u.aBitmap[] is a straight\n** bitmap.  The least significant bit is bit 1.\n**\n** If iSize>BITVEC_NBIT and iDivisor==0 then Bitvec.u.aHash[] is\n** a hash table that will hold up to BITVEC_MXHASH distinct values.\n**\n** Otherwise, the value i is redirected into one of BITVEC_NPTR\n** sub-bitmaps pointed to by Bitvec.u.apSub[].  Each subbitmap\n** handles up to iDivisor separate values of i.  apSub[0] holds\n** values between 1 and iDivisor.  apSub[1] holds values between\n** iDivisor+1 and 2*iDivisor.  apSub[N] holds values between\n** N*iDivisor+1 and (N+1)*iDivisor.  Each subbitmap is normalized\n** to hold deal with values between 1 and iDivisor.\n*/\nstruct Bitvec {\n  u32 iSize;      /* Maximum bit index.  Max iSize is 4,294,967,296. */\n  u32 nSet;       /* Number of bits that are set - only valid for aHash\n                  ** element.  Max is BITVEC_NINT.  For BITVEC_SZ of 512,\n                  ** this would be 125. */\n  u32 iDivisor;   /* Number of bits handled by each apSub[] entry. */\n                  /* Should >=0 for apSub element. */\n                  /* Max iDivisor is max(u32) / BITVEC_NPTR + 1.  */\n                  /* For a BITVEC_SZ of 512, this would be 34,359,739. */\n  union {\n    BITVEC_TELEM aBitmap[BITVEC_NELEM];    /* Bitmap representation */\n    u32 aHash[BITVEC_NINT];      /* Hash table representation */\n    Bitvec *apSub[BITVEC_NPTR];  /* Recursive representation */\n  } u;\n};\n\n/*\n** Create a new bitmap object able to handle bits between 0 and iSize,\n** inclusive.  Return a pointer to the new object.  Return NULL if \n** malloc fails.\n*/\nBitvec *sqlite3BitvecCreate(u32 iSize){\n  Bitvec *p;\n  assert( sizeof(*p)==BITVEC_SZ );\n  p = sqlite3MallocZero( sizeof(*p) );\n  if( p ){\n    p->iSize = iSize;\n  }\n  return p;\n}\n\n/*\n** Check to see if the i-th bit is set.  Return true or false.\n** If p is NULL (if the bitmap has not been created) or if\n** i is out of range, then return false.\n*/\nint sqlite3BitvecTestNotNull(Bitvec *p, u32 i){\n  assert( p!=0 );\n  i--;\n  if( i>=p->iSize ) return 0;\n  while( p->iDivisor ){\n    u32 bin = i/p->iDivisor;\n    i = i%p->iDivisor;\n    p = p->u.apSub[bin];\n    if (!p) {\n      return 0;\n    }\n  }\n  if( p->iSize<=BITVEC_NBIT ){\n    return (p->u.aBitmap[i/BITVEC_SZELEM] & (1<<(i&(BITVEC_SZELEM-1))))!=0;\n  } else{\n    u32 h = BITVEC_HASH(i++);\n    while( p->u.aHash[h] ){\n      if( p->u.aHash[h]==i ) return 1;\n      h = (h+1) % BITVEC_NINT;\n    }\n    return 0;\n  }\n}\nint sqlite3BitvecTest(Bitvec *p, u32 i){\n  return p!=0 && sqlite3BitvecTestNotNull(p,i);\n}\n\n/*\n** Set the i-th bit.  Return 0 on success and an error code if\n** anything goes wrong.\n**\n** This routine might cause sub-bitmaps to be allocated.  Failing\n** to get the memory needed to hold the sub-bitmap is the only\n** that can go wrong with an insert, assuming p and i are valid.\n**\n** The calling function must ensure that p is a valid Bitvec object\n** and that the value for \"i\" is within range of the Bitvec object.\n** Otherwise the behavior is undefined.\n*/\nint sqlite3BitvecSet(Bitvec *p, u32 i){\n  u32 h;\n  if( p==0 ) return SQLITE_OK;\n  assert( i>0 );\n  assert( i<=p->iSize );\n  i--;\n  while((p->iSize > BITVEC_NBIT) && p->iDivisor) {\n    u32 bin = i/p->iDivisor;\n    i = i%p->iDivisor;\n    if( p->u.apSub[bin]==0 ){\n      p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );\n      if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM_BKPT;\n    }\n    p = p->u.apSub[bin];\n  }\n  if( p->iSize<=BITVEC_NBIT ){\n    p->u.aBitmap[i/BITVEC_SZELEM] |= 1 << (i&(BITVEC_SZELEM-1));\n    return SQLITE_OK;\n  }\n  h = BITVEC_HASH(i++);\n  /* if there wasn't a hash collision, and this doesn't */\n  /* completely fill the hash, then just add it without */\n  /* worring about sub-dividing and re-hashing. */\n  if( !p->u.aHash[h] ){\n    if (p->nSet<(BITVEC_NINT-1)) {\n      goto bitvec_set_end;\n    } else {\n      goto bitvec_set_rehash;\n    }\n  }\n  /* there was a collision, check to see if it's already */\n  /* in hash, if not, try to find a spot for it */\n  do {\n    if( p->u.aHash[h]==i ) return SQLITE_OK;\n    h++;\n    if( h>=BITVEC_NINT ) h = 0;\n  } while( p->u.aHash[h] );\n  /* we didn't find it in the hash.  h points to the first */\n  /* available free spot. check to see if this is going to */\n  /* make our hash too \"full\".  */\nbitvec_set_rehash:\n  if( p->nSet>=BITVEC_MXHASH ){\n    unsigned int j;\n    int rc;\n    u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash));\n    if( aiValues==0 ){\n      return SQLITE_NOMEM_BKPT;\n    }else{\n      memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));\n      memset(p->u.apSub, 0, sizeof(p->u.apSub));\n      p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR;\n      rc = sqlite3BitvecSet(p, i);\n      for(j=0; j<BITVEC_NINT; j++){\n        if( aiValues[j] ) rc |= sqlite3BitvecSet(p, aiValues[j]);\n      }\n      sqlite3StackFree(0, aiValues);\n      return rc;\n    }\n  }\nbitvec_set_end:\n  p->nSet++;\n  p->u.aHash[h] = i;\n  return SQLITE_OK;\n}\n\n/*\n** Clear the i-th bit.\n**\n** pBuf must be a pointer to at least BITVEC_SZ bytes of temporary storage\n** that BitvecClear can use to rebuilt its hash table.\n*/\nvoid sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){\n  if( p==0 ) return;\n  assert( i>0 );\n  i--;\n  while( p->iDivisor ){\n    u32 bin = i/p->iDivisor;\n    i = i%p->iDivisor;\n    p = p->u.apSub[bin];\n    if (!p) {\n      return;\n    }\n  }\n  if( p->iSize<=BITVEC_NBIT ){\n    p->u.aBitmap[i/BITVEC_SZELEM] &= ~(1 << (i&(BITVEC_SZELEM-1)));\n  }else{\n    unsigned int j;\n    u32 *aiValues = pBuf;\n    memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));\n    memset(p->u.aHash, 0, sizeof(p->u.aHash));\n    p->nSet = 0;\n    for(j=0; j<BITVEC_NINT; j++){\n      if( aiValues[j] && aiValues[j]!=(i+1) ){\n        u32 h = BITVEC_HASH(aiValues[j]-1);\n        p->nSet++;\n        while( p->u.aHash[h] ){\n          h++;\n          if( h>=BITVEC_NINT ) h = 0;\n        }\n        p->u.aHash[h] = aiValues[j];\n      }\n    }\n  }\n}\n\n/*\n** Destroy a bitmap object.  Reclaim all memory used.\n*/\nvoid sqlite3BitvecDestroy(Bitvec *p){\n  if( p==0 ) return;\n  if( p->iDivisor ){\n    unsigned int i;\n    for(i=0; i<BITVEC_NPTR; i++){\n      sqlite3BitvecDestroy(p->u.apSub[i]);\n    }\n  }\n  sqlite3_free(p);\n}\n\n/*\n** Return the value of the iSize parameter specified when Bitvec *p\n** was created.\n*/\nu32 sqlite3BitvecSize(Bitvec *p){\n  return p->iSize;\n}\n\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n/*\n** Let V[] be an array of unsigned characters sufficient to hold\n** up to N bits.  Let I be an integer between 0 and N.  0<=I<N.\n** Then the following macros can be used to set, clear, or test\n** individual bits within V.\n*/\n#define SETBIT(V,I)      V[I>>3] |= (1<<(I&7))\n#define CLEARBIT(V,I)    V[I>>3] &= ~(1<<(I&7))\n#define TESTBIT(V,I)     (V[I>>3]&(1<<(I&7)))!=0\n\n/*\n** This routine runs an extensive test of the Bitvec code.\n**\n** The input is an array of integers that acts as a program\n** to test the Bitvec.  The integers are opcodes followed\n** by 0, 1, or 3 operands, depending on the opcode.  Another\n** opcode follows immediately after the last operand.\n**\n** There are 6 opcodes numbered from 0 through 5.  0 is the\n** \"halt\" opcode and causes the test to end.\n**\n**    0          Halt and return the number of errors\n**    1 N S X    Set N bits beginning with S and incrementing by X\n**    2 N S X    Clear N bits beginning with S and incrementing by X\n**    3 N        Set N randomly chosen bits\n**    4 N        Clear N randomly chosen bits\n**    5 N S X    Set N bits from S increment X in array only, not in bitvec\n**\n** The opcodes 1 through 4 perform set and clear operations are performed\n** on both a Bitvec object and on a linear array of bits obtained from malloc.\n** Opcode 5 works on the linear array only, not on the Bitvec.\n** Opcode 5 is used to deliberately induce a fault in order to\n** confirm that error detection works.\n**\n** At the conclusion of the test the linear array is compared\n** against the Bitvec object.  If there are any differences,\n** an error is returned.  If they are the same, zero is returned.\n**\n** If a memory allocation error occurs, return -1.\n*/\nint sqlite3BitvecBuiltinTest(int sz, int *aOp){\n  Bitvec *pBitvec = 0;\n  unsigned char *pV = 0;\n  int rc = -1;\n  int i, nx, pc, op;\n  void *pTmpSpace;\n\n  /* Allocate the Bitvec to be tested and a linear array of\n  ** bits to act as the reference */\n  pBitvec = sqlite3BitvecCreate( sz );\n  pV = sqlite3MallocZero( (sz+7)/8 + 1 );\n  pTmpSpace = sqlite3_malloc64(BITVEC_SZ);\n  if( pBitvec==0 || pV==0 || pTmpSpace==0  ) goto bitvec_end;\n\n  /* NULL pBitvec tests */\n  sqlite3BitvecSet(0, 1);\n  sqlite3BitvecClear(0, 1, pTmpSpace);\n\n  /* Run the program */\n  pc = 0;\n  while( (op = aOp[pc])!=0 ){\n    switch( op ){\n      case 1:\n      case 2:\n      case 5: {\n        nx = 4;\n        i = aOp[pc+2] - 1;\n        aOp[pc+2] += aOp[pc+3];\n        break;\n      }\n      case 3:\n      case 4: \n      default: {\n        nx = 2;\n        sqlite3_randomness(sizeof(i), &i);\n        break;\n      }\n    }\n    if( (--aOp[pc+1]) > 0 ) nx = 0;\n    pc += nx;\n    i = (i & 0x7fffffff)%sz;\n    if( (op & 1)!=0 ){\n      SETBIT(pV, (i+1));\n      if( op!=5 ){\n        if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end;\n      }\n    }else{\n      CLEARBIT(pV, (i+1));\n      sqlite3BitvecClear(pBitvec, i+1, pTmpSpace);\n    }\n  }\n\n  /* Test to make sure the linear array exactly matches the\n  ** Bitvec object.  Start with the assumption that they do\n  ** match (rc==0).  Change rc to non-zero if a discrepancy\n  ** is found.\n  */\n  rc = sqlite3BitvecTest(0,0) + sqlite3BitvecTest(pBitvec, sz+1)\n          + sqlite3BitvecTest(pBitvec, 0)\n          + (sqlite3BitvecSize(pBitvec) - sz);\n  for(i=1; i<=sz; i++){\n    if(  (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){\n      rc = i;\n      break;\n    }\n  }\n\n  /* Free allocated structure */\nbitvec_end:\n  sqlite3_free(pTmpSpace);\n  sqlite3_free(pV);\n  sqlite3BitvecDestroy(pBitvec);\n  return rc;\n}\n#endif /* SQLITE_OMIT_BUILTIN_TEST */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/btmutex.c",
    "content": "/*\n** 2007 August 27\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains code used to implement mutexes on Btree objects.\n** This code really belongs in btree.c.  But btree.c is getting too\n** big and we want to break it down some.  This packaged seemed like\n** a good breakout.\n*/\n#include \"btreeInt.h\"\n#ifndef SQLITE_OMIT_SHARED_CACHE\n#if SQLITE_THREADSAFE\n\n/*\n** Obtain the BtShared mutex associated with B-Tree handle p. Also,\n** set BtShared.db to the database handle associated with p and the\n** p->locked boolean to true.\n*/\nstatic void lockBtreeMutex(Btree *p){\n  assert( p->locked==0 );\n  assert( sqlite3_mutex_notheld(p->pBt->mutex) );\n  assert( sqlite3_mutex_held(p->db->mutex) );\n\n  sqlite3_mutex_enter(p->pBt->mutex);\n  p->pBt->db = p->db;\n  p->locked = 1;\n}\n\n/*\n** Release the BtShared mutex associated with B-Tree handle p and\n** clear the p->locked boolean.\n*/\nstatic void SQLITE_NOINLINE unlockBtreeMutex(Btree *p){\n  BtShared *pBt = p->pBt;\n  assert( p->locked==1 );\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  assert( p->db==pBt->db );\n\n  sqlite3_mutex_leave(pBt->mutex);\n  p->locked = 0;\n}\n\n/* Forward reference */\nstatic void SQLITE_NOINLINE btreeLockCarefully(Btree *p);\n\n/*\n** Enter a mutex on the given BTree object.\n**\n** If the object is not sharable, then no mutex is ever required\n** and this routine is a no-op.  The underlying mutex is non-recursive.\n** But we keep a reference count in Btree.wantToLock so the behavior\n** of this interface is recursive.\n**\n** To avoid deadlocks, multiple Btrees are locked in the same order\n** by all database connections.  The p->pNext is a list of other\n** Btrees belonging to the same database connection as the p Btree\n** which need to be locked after p.  If we cannot get a lock on\n** p, then first unlock all of the others on p->pNext, then wait\n** for the lock to become available on p, then relock all of the\n** subsequent Btrees that desire a lock.\n*/\nvoid sqlite3BtreeEnter(Btree *p){\n  /* Some basic sanity checking on the Btree.  The list of Btrees\n  ** connected by pNext and pPrev should be in sorted order by\n  ** Btree.pBt value. All elements of the list should belong to\n  ** the same connection. Only shared Btrees are on the list. */\n  assert( p->pNext==0 || p->pNext->pBt>p->pBt );\n  assert( p->pPrev==0 || p->pPrev->pBt<p->pBt );\n  assert( p->pNext==0 || p->pNext->db==p->db );\n  assert( p->pPrev==0 || p->pPrev->db==p->db );\n  assert( p->sharable || (p->pNext==0 && p->pPrev==0) );\n\n  /* Check for locking consistency */\n  assert( !p->locked || p->wantToLock>0 );\n  assert( p->sharable || p->wantToLock==0 );\n\n  /* We should already hold a lock on the database connection */\n  assert( sqlite3_mutex_held(p->db->mutex) );\n\n  /* Unless the database is sharable and unlocked, then BtShared.db\n  ** should already be set correctly. */\n  assert( (p->locked==0 && p->sharable) || p->pBt->db==p->db );\n\n  if( !p->sharable ) return;\n  p->wantToLock++;\n  if( p->locked ) return;\n  btreeLockCarefully(p);\n}\n\n/* This is a helper function for sqlite3BtreeLock(). By moving\n** complex, but seldom used logic, out of sqlite3BtreeLock() and\n** into this routine, we avoid unnecessary stack pointer changes\n** and thus help the sqlite3BtreeLock() routine to run much faster\n** in the common case.\n*/\nstatic void SQLITE_NOINLINE btreeLockCarefully(Btree *p){\n  Btree *pLater;\n\n  /* In most cases, we should be able to acquire the lock we\n  ** want without having to go through the ascending lock\n  ** procedure that follows.  Just be sure not to block.\n  */\n  if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){\n    p->pBt->db = p->db;\n    p->locked = 1;\n    return;\n  }\n\n  /* To avoid deadlock, first release all locks with a larger\n  ** BtShared address.  Then acquire our lock.  Then reacquire\n  ** the other BtShared locks that we used to hold in ascending\n  ** order.\n  */\n  for(pLater=p->pNext; pLater; pLater=pLater->pNext){\n    assert( pLater->sharable );\n    assert( pLater->pNext==0 || pLater->pNext->pBt>pLater->pBt );\n    assert( !pLater->locked || pLater->wantToLock>0 );\n    if( pLater->locked ){\n      unlockBtreeMutex(pLater);\n    }\n  }\n  lockBtreeMutex(p);\n  for(pLater=p->pNext; pLater; pLater=pLater->pNext){\n    if( pLater->wantToLock ){\n      lockBtreeMutex(pLater);\n    }\n  }\n}\n\n\n/*\n** Exit the recursive mutex on a Btree.\n*/\nvoid sqlite3BtreeLeave(Btree *p){\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  if( p->sharable ){\n    assert( p->wantToLock>0 );\n    p->wantToLock--;\n    if( p->wantToLock==0 ){\n      unlockBtreeMutex(p);\n    }\n  }\n}\n\n#ifndef NDEBUG\n/*\n** Return true if the BtShared mutex is held on the btree, or if the\n** B-Tree is not marked as sharable.\n**\n** This routine is used only from within assert() statements.\n*/\nint sqlite3BtreeHoldsMutex(Btree *p){\n  assert( p->sharable==0 || p->locked==0 || p->wantToLock>0 );\n  assert( p->sharable==0 || p->locked==0 || p->db==p->pBt->db );\n  assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->pBt->mutex) );\n  assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->db->mutex) );\n\n  return (p->sharable==0 || p->locked);\n}\n#endif\n\n\n/*\n** Enter the mutex on every Btree associated with a database\n** connection.  This is needed (for example) prior to parsing\n** a statement since we will be comparing table and column names\n** against all schemas and we do not want those schemas being\n** reset out from under us.\n**\n** There is a corresponding leave-all procedures.\n**\n** Enter the mutexes in accending order by BtShared pointer address\n** to avoid the possibility of deadlock when two threads with\n** two or more btrees in common both try to lock all their btrees\n** at the same instant.\n*/\nvoid sqlite3BtreeEnterAll(sqlite3 *db){\n  int i;\n  Btree *p;\n  assert( sqlite3_mutex_held(db->mutex) );\n  for(i=0; i<db->nDb; i++){\n    p = db->aDb[i].pBt;\n    if( p ) sqlite3BtreeEnter(p);\n  }\n}\nvoid sqlite3BtreeLeaveAll(sqlite3 *db){\n  int i;\n  Btree *p;\n  assert( sqlite3_mutex_held(db->mutex) );\n  for(i=0; i<db->nDb; i++){\n    p = db->aDb[i].pBt;\n    if( p ) sqlite3BtreeLeave(p);\n  }\n}\n\n#ifndef NDEBUG\n/*\n** Return true if the current thread holds the database connection\n** mutex and all required BtShared mutexes.\n**\n** This routine is used inside assert() statements only.\n*/\nint sqlite3BtreeHoldsAllMutexes(sqlite3 *db){\n  int i;\n  if( !sqlite3_mutex_held(db->mutex) ){\n    return 0;\n  }\n  for(i=0; i<db->nDb; i++){\n    Btree *p;\n    p = db->aDb[i].pBt;\n    if( p && p->sharable &&\n         (p->wantToLock==0 || !sqlite3_mutex_held(p->pBt->mutex)) ){\n      return 0;\n    }\n  }\n  return 1;\n}\n#endif /* NDEBUG */\n\n#ifndef NDEBUG\n/*\n** Return true if the correct mutexes are held for accessing the\n** db->aDb[iDb].pSchema structure.  The mutexes required for schema\n** access are:\n**\n**   (1) The mutex on db\n**   (2) if iDb!=1, then the mutex on db->aDb[iDb].pBt.\n**\n** If pSchema is not NULL, then iDb is computed from pSchema and\n** db using sqlite3SchemaToIndex().\n*/\nint sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){\n  Btree *p;\n  assert( db!=0 );\n  if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);\n  assert( iDb>=0 && iDb<db->nDb );\n  if( !sqlite3_mutex_held(db->mutex) ) return 0;\n  if( iDb==1 ) return 1;\n  p = db->aDb[iDb].pBt;\n  assert( p!=0 );\n  return p->sharable==0 || p->locked==1;\n}\n#endif /* NDEBUG */\n\n#else /* SQLITE_THREADSAFE>0 above.  SQLITE_THREADSAFE==0 below */\n/*\n** The following are special cases for mutex enter routines for use\n** in single threaded applications that use shared cache.  Except for\n** these two routines, all mutex operations are no-ops in that case and\n** are null #defines in btree.h.\n**\n** If shared cache is disabled, then all btree mutex routines, including\n** the ones below, are no-ops and are null #defines in btree.h.\n*/\n\nvoid sqlite3BtreeEnter(Btree *p){\n  p->pBt->db = p->db;\n}\nvoid sqlite3BtreeEnterAll(sqlite3 *db){\n  int i;\n  for(i=0; i<db->nDb; i++){\n    Btree *p = db->aDb[i].pBt;\n    if( p ){\n      p->pBt->db = p->db;\n    }\n  }\n}\n#endif /* if SQLITE_THREADSAFE */\n\n#ifndef SQLITE_OMIT_INCRBLOB\n/*\n** Enter a mutex on a Btree given a cursor owned by that Btree. \n**\n** These entry points are used by incremental I/O only. Enter() is required \n** any time OMIT_SHARED_CACHE is not defined, regardless of whether or not \n** the build is threadsafe. Leave() is only required by threadsafe builds.\n*/\nvoid sqlite3BtreeEnterCursor(BtCursor *pCur){\n  sqlite3BtreeEnter(pCur->pBtree);\n}\n# if SQLITE_THREADSAFE\nvoid sqlite3BtreeLeaveCursor(BtCursor *pCur){\n  sqlite3BtreeLeave(pCur->pBtree);\n}\n# endif\n#endif /* ifndef SQLITE_OMIT_INCRBLOB */\n\n#endif /* ifndef SQLITE_OMIT_SHARED_CACHE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/btree.c",
    "content": "/*\n** 2004 April 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file implements an external (disk-based) database using BTrees.\n** See the header comment on \"btreeInt.h\" for additional information.\n** Including a description of file format and an overview of operation.\n*/\n#include \"btreeInt.h\"\n\n/*\n** The header string that appears at the beginning of every\n** SQLite database.\n*/\nstatic const char zMagicHeader[] = SQLITE_FILE_HEADER;\n\n/*\n** Set this global variable to 1 to enable tracing using the TRACE\n** macro.\n*/\n#if 0\nint sqlite3BtreeTrace=1;  /* True to enable tracing */\n# define TRACE(X)  if(sqlite3BtreeTrace){printf X;fflush(stdout);}\n#else\n# define TRACE(X)\n#endif\n\n/*\n** Extract a 2-byte big-endian integer from an array of unsigned bytes.\n** But if the value is zero, make it 65536.\n**\n** This routine is used to extract the \"offset to cell content area\" value\n** from the header of a btree page.  If the page size is 65536 and the page\n** is empty, the offset should be 65536, but the 2-byte value stores zero.\n** This routine makes the necessary adjustment to 65536.\n*/\n#define get2byteNotZero(X)  (((((int)get2byte(X))-1)&0xffff)+1)\n\n/*\n** Values passed as the 5th argument to allocateBtreePage()\n*/\n#define BTALLOC_ANY   0           /* Allocate any page */\n#define BTALLOC_EXACT 1           /* Allocate exact page if possible */\n#define BTALLOC_LE    2           /* Allocate any page <= the parameter */\n\n/*\n** Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not \n** defined, or 0 if it is. For example:\n**\n**   bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum);\n*/\n#ifndef SQLITE_OMIT_AUTOVACUUM\n#define IfNotOmitAV(expr) (expr)\n#else\n#define IfNotOmitAV(expr) 0\n#endif\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n/*\n** A list of BtShared objects that are eligible for participation\n** in shared cache.  This variable has file scope during normal builds,\n** but the test harness needs to access it so we make it global for \n** test builds.\n**\n** Access to this variable is protected by SQLITE_MUTEX_STATIC_MASTER.\n*/\n#ifdef SQLITE_TEST\nBtShared *SQLITE_WSD sqlite3SharedCacheList = 0;\n#else\nstatic BtShared *SQLITE_WSD sqlite3SharedCacheList = 0;\n#endif\n#endif /* SQLITE_OMIT_SHARED_CACHE */\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n/*\n** Enable or disable the shared pager and schema features.\n**\n** This routine has no effect on existing database connections.\n** The shared cache setting effects only future calls to\n** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().\n*/\nint sqlite3_enable_shared_cache(int enable){\n  sqlite3GlobalConfig.sharedCacheEnabled = enable;\n  return SQLITE_OK;\n}\n#endif\n\n\n\n#ifdef SQLITE_OMIT_SHARED_CACHE\n  /*\n  ** The functions querySharedCacheTableLock(), setSharedCacheTableLock(),\n  ** and clearAllSharedCacheTableLocks()\n  ** manipulate entries in the BtShared.pLock linked list used to store\n  ** shared-cache table level locks. If the library is compiled with the\n  ** shared-cache feature disabled, then there is only ever one user\n  ** of each BtShared structure and so this locking is not necessary. \n  ** So define the lock related functions as no-ops.\n  */\n  #define querySharedCacheTableLock(a,b,c) SQLITE_OK\n  #define setSharedCacheTableLock(a,b,c) SQLITE_OK\n  #define clearAllSharedCacheTableLocks(a)\n  #define downgradeAllSharedCacheTableLocks(a)\n  #define hasSharedCacheTableLock(a,b,c,d) 1\n  #define hasReadConflicts(a, b) 0\n#endif\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n\n#ifdef SQLITE_DEBUG\n/*\n**** This function is only used as part of an assert() statement. ***\n**\n** Check to see if pBtree holds the required locks to read or write to the \n** table with root page iRoot.   Return 1 if it does and 0 if not.\n**\n** For example, when writing to a table with root-page iRoot via \n** Btree connection pBtree:\n**\n**    assert( hasSharedCacheTableLock(pBtree, iRoot, 0, WRITE_LOCK) );\n**\n** When writing to an index that resides in a sharable database, the \n** caller should have first obtained a lock specifying the root page of\n** the corresponding table. This makes things a bit more complicated,\n** as this module treats each table as a separate structure. To determine\n** the table corresponding to the index being written, this\n** function has to search through the database schema.\n**\n** Instead of a lock on the table/index rooted at page iRoot, the caller may\n** hold a write-lock on the schema table (root page 1). This is also\n** acceptable.\n*/\nstatic int hasSharedCacheTableLock(\n  Btree *pBtree,         /* Handle that must hold lock */\n  Pgno iRoot,            /* Root page of b-tree */\n  int isIndex,           /* True if iRoot is the root of an index b-tree */\n  int eLockType          /* Required lock type (READ_LOCK or WRITE_LOCK) */\n){\n  Schema *pSchema = (Schema *)pBtree->pBt->pSchema;\n  Pgno iTab = 0;\n  BtLock *pLock;\n\n  /* If this database is not shareable, or if the client is reading\n  ** and has the read-uncommitted flag set, then no lock is required. \n  ** Return true immediately.\n  */\n  if( (pBtree->sharable==0)\n   || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted))\n  ){\n    return 1;\n  }\n\n  /* If the client is reading  or writing an index and the schema is\n  ** not loaded, then it is too difficult to actually check to see if\n  ** the correct locks are held.  So do not bother - just return true.\n  ** This case does not come up very often anyhow.\n  */\n  if( isIndex && (!pSchema || (pSchema->schemaFlags&DB_SchemaLoaded)==0) ){\n    return 1;\n  }\n\n  /* Figure out the root-page that the lock should be held on. For table\n  ** b-trees, this is just the root page of the b-tree being read or\n  ** written. For index b-trees, it is the root page of the associated\n  ** table.  */\n  if( isIndex ){\n    HashElem *p;\n    for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){\n      Index *pIdx = (Index *)sqliteHashData(p);\n      if( pIdx->tnum==(int)iRoot ){\n        if( iTab ){\n          /* Two or more indexes share the same root page.  There must\n          ** be imposter tables.  So just return true.  The assert is not\n          ** useful in that case. */\n          return 1;\n        }\n        iTab = pIdx->pTable->tnum;\n      }\n    }\n  }else{\n    iTab = iRoot;\n  }\n\n  /* Search for the required lock. Either a write-lock on root-page iTab, a \n  ** write-lock on the schema table, or (if the client is reading) a\n  ** read-lock on iTab will suffice. Return 1 if any of these are found.  */\n  for(pLock=pBtree->pBt->pLock; pLock; pLock=pLock->pNext){\n    if( pLock->pBtree==pBtree \n     && (pLock->iTable==iTab || (pLock->eLock==WRITE_LOCK && pLock->iTable==1))\n     && pLock->eLock>=eLockType \n    ){\n      return 1;\n    }\n  }\n\n  /* Failed to find the required lock. */\n  return 0;\n}\n#endif /* SQLITE_DEBUG */\n\n#ifdef SQLITE_DEBUG\n/*\n**** This function may be used as part of assert() statements only. ****\n**\n** Return true if it would be illegal for pBtree to write into the\n** table or index rooted at iRoot because other shared connections are\n** simultaneously reading that same table or index.\n**\n** It is illegal for pBtree to write if some other Btree object that\n** shares the same BtShared object is currently reading or writing\n** the iRoot table.  Except, if the other Btree object has the\n** read-uncommitted flag set, then it is OK for the other object to\n** have a read cursor.\n**\n** For example, before writing to any part of the table or index\n** rooted at page iRoot, one should call:\n**\n**    assert( !hasReadConflicts(pBtree, iRoot) );\n*/\nstatic int hasReadConflicts(Btree *pBtree, Pgno iRoot){\n  BtCursor *p;\n  for(p=pBtree->pBt->pCursor; p; p=p->pNext){\n    if( p->pgnoRoot==iRoot \n     && p->pBtree!=pBtree\n     && 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted)\n    ){\n      return 1;\n    }\n  }\n  return 0;\n}\n#endif    /* #ifdef SQLITE_DEBUG */\n\n/*\n** Query to see if Btree handle p may obtain a lock of type eLock \n** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return\n** SQLITE_OK if the lock may be obtained (by calling\n** setSharedCacheTableLock()), or SQLITE_LOCKED if not.\n*/\nstatic int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){\n  BtShared *pBt = p->pBt;\n  BtLock *pIter;\n\n  assert( sqlite3BtreeHoldsMutex(p) );\n  assert( eLock==READ_LOCK || eLock==WRITE_LOCK );\n  assert( p->db!=0 );\n  assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 );\n  \n  /* If requesting a write-lock, then the Btree must have an open write\n  ** transaction on this file. And, obviously, for this to be so there \n  ** must be an open write transaction on the file itself.\n  */\n  assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );\n  assert( eLock==READ_LOCK || pBt->inTransaction==TRANS_WRITE );\n  \n  /* This routine is a no-op if the shared-cache is not enabled */\n  if( !p->sharable ){\n    return SQLITE_OK;\n  }\n\n  /* If some other connection is holding an exclusive lock, the\n  ** requested lock may not be obtained.\n  */\n  if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){\n    sqlite3ConnectionBlocked(p->db, pBt->pWriter->db);\n    return SQLITE_LOCKED_SHAREDCACHE;\n  }\n\n  for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){\n    /* The condition (pIter->eLock!=eLock) in the following if(...) \n    ** statement is a simplification of:\n    **\n    **   (eLock==WRITE_LOCK || pIter->eLock==WRITE_LOCK)\n    **\n    ** since we know that if eLock==WRITE_LOCK, then no other connection\n    ** may hold a WRITE_LOCK on any table in this file (since there can\n    ** only be a single writer).\n    */\n    assert( pIter->eLock==READ_LOCK || pIter->eLock==WRITE_LOCK );\n    assert( eLock==READ_LOCK || pIter->pBtree==p || pIter->eLock==READ_LOCK);\n    if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){\n      sqlite3ConnectionBlocked(p->db, pIter->pBtree->db);\n      if( eLock==WRITE_LOCK ){\n        assert( p==pBt->pWriter );\n        pBt->btsFlags |= BTS_PENDING;\n      }\n      return SQLITE_LOCKED_SHAREDCACHE;\n    }\n  }\n  return SQLITE_OK;\n}\n#endif /* !SQLITE_OMIT_SHARED_CACHE */\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n/*\n** Add a lock on the table with root-page iTable to the shared-btree used\n** by Btree handle p. Parameter eLock must be either READ_LOCK or \n** WRITE_LOCK.\n**\n** This function assumes the following:\n**\n**   (a) The specified Btree object p is connected to a sharable\n**       database (one with the BtShared.sharable flag set), and\n**\n**   (b) No other Btree objects hold a lock that conflicts\n**       with the requested lock (i.e. querySharedCacheTableLock() has\n**       already been called and returned SQLITE_OK).\n**\n** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM \n** is returned if a malloc attempt fails.\n*/\nstatic int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){\n  BtShared *pBt = p->pBt;\n  BtLock *pLock = 0;\n  BtLock *pIter;\n\n  assert( sqlite3BtreeHoldsMutex(p) );\n  assert( eLock==READ_LOCK || eLock==WRITE_LOCK );\n  assert( p->db!=0 );\n\n  /* A connection with the read-uncommitted flag set will never try to\n  ** obtain a read-lock using this function. The only read-lock obtained\n  ** by a connection in read-uncommitted mode is on the sqlite_master \n  ** table, and that lock is obtained in BtreeBeginTrans().  */\n  assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK );\n\n  /* This function should only be called on a sharable b-tree after it \n  ** has been determined that no other b-tree holds a conflicting lock.  */\n  assert( p->sharable );\n  assert( SQLITE_OK==querySharedCacheTableLock(p, iTable, eLock) );\n\n  /* First search the list for an existing lock on this table. */\n  for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){\n    if( pIter->iTable==iTable && pIter->pBtree==p ){\n      pLock = pIter;\n      break;\n    }\n  }\n\n  /* If the above search did not find a BtLock struct associating Btree p\n  ** with table iTable, allocate one and link it into the list.\n  */\n  if( !pLock ){\n    pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock));\n    if( !pLock ){\n      return SQLITE_NOMEM_BKPT;\n    }\n    pLock->iTable = iTable;\n    pLock->pBtree = p;\n    pLock->pNext = pBt->pLock;\n    pBt->pLock = pLock;\n  }\n\n  /* Set the BtLock.eLock variable to the maximum of the current lock\n  ** and the requested lock. This means if a write-lock was already held\n  ** and a read-lock requested, we don't incorrectly downgrade the lock.\n  */\n  assert( WRITE_LOCK>READ_LOCK );\n  if( eLock>pLock->eLock ){\n    pLock->eLock = eLock;\n  }\n\n  return SQLITE_OK;\n}\n#endif /* !SQLITE_OMIT_SHARED_CACHE */\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n/*\n** Release all the table locks (locks obtained via calls to\n** the setSharedCacheTableLock() procedure) held by Btree object p.\n**\n** This function assumes that Btree p has an open read or write \n** transaction. If it does not, then the BTS_PENDING flag\n** may be incorrectly cleared.\n*/\nstatic void clearAllSharedCacheTableLocks(Btree *p){\n  BtShared *pBt = p->pBt;\n  BtLock **ppIter = &pBt->pLock;\n\n  assert( sqlite3BtreeHoldsMutex(p) );\n  assert( p->sharable || 0==*ppIter );\n  assert( p->inTrans>0 );\n\n  while( *ppIter ){\n    BtLock *pLock = *ppIter;\n    assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree );\n    assert( pLock->pBtree->inTrans>=pLock->eLock );\n    if( pLock->pBtree==p ){\n      *ppIter = pLock->pNext;\n      assert( pLock->iTable!=1 || pLock==&p->lock );\n      if( pLock->iTable!=1 ){\n        sqlite3_free(pLock);\n      }\n    }else{\n      ppIter = &pLock->pNext;\n    }\n  }\n\n  assert( (pBt->btsFlags & BTS_PENDING)==0 || pBt->pWriter );\n  if( pBt->pWriter==p ){\n    pBt->pWriter = 0;\n    pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);\n  }else if( pBt->nTransaction==2 ){\n    /* This function is called when Btree p is concluding its \n    ** transaction. If there currently exists a writer, and p is not\n    ** that writer, then the number of locks held by connections other\n    ** than the writer must be about to drop to zero. In this case\n    ** set the BTS_PENDING flag to 0.\n    **\n    ** If there is not currently a writer, then BTS_PENDING must\n    ** be zero already. So this next line is harmless in that case.\n    */\n    pBt->btsFlags &= ~BTS_PENDING;\n  }\n}\n\n/*\n** This function changes all write-locks held by Btree p into read-locks.\n*/\nstatic void downgradeAllSharedCacheTableLocks(Btree *p){\n  BtShared *pBt = p->pBt;\n  if( pBt->pWriter==p ){\n    BtLock *pLock;\n    pBt->pWriter = 0;\n    pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING);\n    for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){\n      assert( pLock->eLock==READ_LOCK || pLock->pBtree==p );\n      pLock->eLock = READ_LOCK;\n    }\n  }\n}\n\n#endif /* SQLITE_OMIT_SHARED_CACHE */\n\nstatic void releasePage(MemPage *pPage);  /* Forward reference */\n\n/*\n***** This routine is used inside of assert() only ****\n**\n** Verify that the cursor holds the mutex on its BtShared\n*/\n#ifdef SQLITE_DEBUG\nstatic int cursorHoldsMutex(BtCursor *p){\n  return sqlite3_mutex_held(p->pBt->mutex);\n}\n\n/* Verify that the cursor and the BtShared agree about what is the current\n** database connetion. This is important in shared-cache mode. If the database \n** connection pointers get out-of-sync, it is possible for routines like\n** btreeInitPage() to reference an stale connection pointer that references a\n** a connection that has already closed.  This routine is used inside assert()\n** statements only and for the purpose of double-checking that the btree code\n** does keep the database connection pointers up-to-date.\n*/\nstatic int cursorOwnsBtShared(BtCursor *p){\n  assert( cursorHoldsMutex(p) );\n  return (p->pBtree->db==p->pBt->db);\n}\n#endif\n\n/*\n** Invalidate the overflow cache of the cursor passed as the first argument.\n** on the shared btree structure pBt.\n*/\n#define invalidateOverflowCache(pCur) (pCur->curFlags &= ~BTCF_ValidOvfl)\n\n/*\n** Invalidate the overflow page-list cache for all cursors opened\n** on the shared btree structure pBt.\n*/\nstatic void invalidateAllOverflowCache(BtShared *pBt){\n  BtCursor *p;\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  for(p=pBt->pCursor; p; p=p->pNext){\n    invalidateOverflowCache(p);\n  }\n}\n\n#ifndef SQLITE_OMIT_INCRBLOB\n/*\n** This function is called before modifying the contents of a table\n** to invalidate any incrblob cursors that are open on the\n** row or one of the rows being modified.\n**\n** If argument isClearTable is true, then the entire contents of the\n** table is about to be deleted. In this case invalidate all incrblob\n** cursors open on any row within the table with root-page pgnoRoot.\n**\n** Otherwise, if argument isClearTable is false, then the row with\n** rowid iRow is being replaced or deleted. In this case invalidate\n** only those incrblob cursors open on that specific row.\n*/\nstatic void invalidateIncrblobCursors(\n  Btree *pBtree,          /* The database file to check */\n  i64 iRow,               /* The rowid that might be changing */\n  int isClearTable        /* True if all rows are being deleted */\n){\n  BtCursor *p;\n  if( pBtree->hasIncrblobCur==0 ) return;\n  assert( sqlite3BtreeHoldsMutex(pBtree) );\n  pBtree->hasIncrblobCur = 0;\n  for(p=pBtree->pBt->pCursor; p; p=p->pNext){\n    if( (p->curFlags & BTCF_Incrblob)!=0 ){\n      pBtree->hasIncrblobCur = 1;\n      if( isClearTable || p->info.nKey==iRow ){\n        p->eState = CURSOR_INVALID;\n      }\n    }\n  }\n}\n\n#else\n  /* Stub function when INCRBLOB is omitted */\n  #define invalidateIncrblobCursors(x,y,z)\n#endif /* SQLITE_OMIT_INCRBLOB */\n\n/*\n** Set bit pgno of the BtShared.pHasContent bitvec. This is called \n** when a page that previously contained data becomes a free-list leaf \n** page.\n**\n** The BtShared.pHasContent bitvec exists to work around an obscure\n** bug caused by the interaction of two useful IO optimizations surrounding\n** free-list leaf pages:\n**\n**   1) When all data is deleted from a page and the page becomes\n**      a free-list leaf page, the page is not written to the database\n**      (as free-list leaf pages contain no meaningful data). Sometimes\n**      such a page is not even journalled (as it will not be modified,\n**      why bother journalling it?).\n**\n**   2) When a free-list leaf page is reused, its content is not read\n**      from the database or written to the journal file (why should it\n**      be, if it is not at all meaningful?).\n**\n** By themselves, these optimizations work fine and provide a handy\n** performance boost to bulk delete or insert operations. However, if\n** a page is moved to the free-list and then reused within the same\n** transaction, a problem comes up. If the page is not journalled when\n** it is moved to the free-list and it is also not journalled when it\n** is extracted from the free-list and reused, then the original data\n** may be lost. In the event of a rollback, it may not be possible\n** to restore the database to its original configuration.\n**\n** The solution is the BtShared.pHasContent bitvec. Whenever a page is \n** moved to become a free-list leaf page, the corresponding bit is\n** set in the bitvec. Whenever a leaf page is extracted from the free-list,\n** optimization 2 above is omitted if the corresponding bit is already\n** set in BtShared.pHasContent. The contents of the bitvec are cleared\n** at the end of every transaction.\n*/\nstatic int btreeSetHasContent(BtShared *pBt, Pgno pgno){\n  int rc = SQLITE_OK;\n  if( !pBt->pHasContent ){\n    assert( pgno<=pBt->nPage );\n    pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage);\n    if( !pBt->pHasContent ){\n      rc = SQLITE_NOMEM_BKPT;\n    }\n  }\n  if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){\n    rc = sqlite3BitvecSet(pBt->pHasContent, pgno);\n  }\n  return rc;\n}\n\n/*\n** Query the BtShared.pHasContent vector.\n**\n** This function is called when a free-list leaf page is removed from the\n** free-list for reuse. It returns false if it is safe to retrieve the\n** page from the pager layer with the 'no-content' flag set. True otherwise.\n*/\nstatic int btreeGetHasContent(BtShared *pBt, Pgno pgno){\n  Bitvec *p = pBt->pHasContent;\n  return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno)));\n}\n\n/*\n** Clear (destroy) the BtShared.pHasContent bitvec. This should be\n** invoked at the conclusion of each write-transaction.\n*/\nstatic void btreeClearHasContent(BtShared *pBt){\n  sqlite3BitvecDestroy(pBt->pHasContent);\n  pBt->pHasContent = 0;\n}\n\n/*\n** Release all of the apPage[] pages for a cursor.\n*/\nstatic void btreeReleaseAllCursorPages(BtCursor *pCur){\n  int i;\n  for(i=0; i<=pCur->iPage; i++){\n    releasePage(pCur->apPage[i]);\n    pCur->apPage[i] = 0;\n  }\n  pCur->iPage = -1;\n}\n\n/*\n** The cursor passed as the only argument must point to a valid entry\n** when this function is called (i.e. have eState==CURSOR_VALID). This\n** function saves the current cursor key in variables pCur->nKey and\n** pCur->pKey. SQLITE_OK is returned if successful or an SQLite error \n** code otherwise.\n**\n** If the cursor is open on an intkey table, then the integer key\n** (the rowid) is stored in pCur->nKey and pCur->pKey is left set to\n** NULL. If the cursor is open on a non-intkey table, then pCur->pKey is \n** set to point to a malloced buffer pCur->nKey bytes in size containing \n** the key.\n*/\nstatic int saveCursorKey(BtCursor *pCur){\n  int rc = SQLITE_OK;\n  assert( CURSOR_VALID==pCur->eState );\n  assert( 0==pCur->pKey );\n  assert( cursorHoldsMutex(pCur) );\n\n  if( pCur->curIntKey ){\n    /* Only the rowid is required for a table btree */\n    pCur->nKey = sqlite3BtreeIntegerKey(pCur);\n  }else{\n    /* For an index btree, save the complete key content */\n    void *pKey;\n    pCur->nKey = sqlite3BtreePayloadSize(pCur);\n    pKey = sqlite3Malloc( pCur->nKey );\n    if( pKey ){\n      rc = sqlite3BtreeKey(pCur, 0, (int)pCur->nKey, pKey);\n      if( rc==SQLITE_OK ){\n        pCur->pKey = pKey;\n      }else{\n        sqlite3_free(pKey);\n      }\n    }else{\n      rc = SQLITE_NOMEM_BKPT;\n    }\n  }\n  assert( !pCur->curIntKey || !pCur->pKey );\n  return rc;\n}\n\n/*\n** Save the current cursor position in the variables BtCursor.nKey \n** and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK.\n**\n** The caller must ensure that the cursor is valid (has eState==CURSOR_VALID)\n** prior to calling this routine.  \n*/\nstatic int saveCursorPosition(BtCursor *pCur){\n  int rc;\n\n  assert( CURSOR_VALID==pCur->eState || CURSOR_SKIPNEXT==pCur->eState );\n  assert( 0==pCur->pKey );\n  assert( cursorHoldsMutex(pCur) );\n\n  if( pCur->eState==CURSOR_SKIPNEXT ){\n    pCur->eState = CURSOR_VALID;\n  }else{\n    pCur->skipNext = 0;\n  }\n\n  rc = saveCursorKey(pCur);\n  if( rc==SQLITE_OK ){\n    btreeReleaseAllCursorPages(pCur);\n    pCur->eState = CURSOR_REQUIRESEEK;\n  }\n\n  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl|BTCF_AtLast);\n  return rc;\n}\n\n/* Forward reference */\nstatic int SQLITE_NOINLINE saveCursorsOnList(BtCursor*,Pgno,BtCursor*);\n\n/*\n** Save the positions of all cursors (except pExcept) that are open on\n** the table with root-page iRoot.  \"Saving the cursor position\" means that\n** the location in the btree is remembered in such a way that it can be\n** moved back to the same spot after the btree has been modified.  This\n** routine is called just before cursor pExcept is used to modify the\n** table, for example in BtreeDelete() or BtreeInsert().\n**\n** If there are two or more cursors on the same btree, then all such \n** cursors should have their BTCF_Multiple flag set.  The btreeCursor()\n** routine enforces that rule.  This routine only needs to be called in\n** the uncommon case when pExpect has the BTCF_Multiple flag set.\n**\n** If pExpect!=NULL and if no other cursors are found on the same root-page,\n** then the BTCF_Multiple flag on pExpect is cleared, to avoid another\n** pointless call to this routine.\n**\n** Implementation note:  This routine merely checks to see if any cursors\n** need to be saved.  It calls out to saveCursorsOnList() in the (unusual)\n** event that cursors are in need to being saved.\n*/\nstatic int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){\n  BtCursor *p;\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( pExcept==0 || pExcept->pBt==pBt );\n  for(p=pBt->pCursor; p; p=p->pNext){\n    if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ) break;\n  }\n  if( p ) return saveCursorsOnList(p, iRoot, pExcept);\n  if( pExcept ) pExcept->curFlags &= ~BTCF_Multiple;\n  return SQLITE_OK;\n}\n\n/* This helper routine to saveAllCursors does the actual work of saving\n** the cursors if and when a cursor is found that actually requires saving.\n** The common case is that no cursors need to be saved, so this routine is\n** broken out from its caller to avoid unnecessary stack pointer movement.\n*/\nstatic int SQLITE_NOINLINE saveCursorsOnList(\n  BtCursor *p,         /* The first cursor that needs saving */\n  Pgno iRoot,          /* Only save cursor with this iRoot. Save all if zero */\n  BtCursor *pExcept    /* Do not save this cursor */\n){\n  do{\n    if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){\n      if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){\n        int rc = saveCursorPosition(p);\n        if( SQLITE_OK!=rc ){\n          return rc;\n        }\n      }else{\n        testcase( p->iPage>0 );\n        btreeReleaseAllCursorPages(p);\n      }\n    }\n    p = p->pNext;\n  }while( p );\n  return SQLITE_OK;\n}\n\n/*\n** Clear the current cursor position.\n*/\nvoid sqlite3BtreeClearCursor(BtCursor *pCur){\n  assert( cursorHoldsMutex(pCur) );\n  sqlite3_free(pCur->pKey);\n  pCur->pKey = 0;\n  pCur->eState = CURSOR_INVALID;\n}\n\n/*\n** In this version of BtreeMoveto, pKey is a packed index record\n** such as is generated by the OP_MakeRecord opcode.  Unpack the\n** record and then call BtreeMovetoUnpacked() to do the work.\n*/\nstatic int btreeMoveto(\n  BtCursor *pCur,     /* Cursor open on the btree to be searched */\n  const void *pKey,   /* Packed key if the btree is an index */\n  i64 nKey,           /* Integer key for tables.  Size of pKey for indices */\n  int bias,           /* Bias search to the high end */\n  int *pRes           /* Write search results here */\n){\n  int rc;                    /* Status code */\n  UnpackedRecord *pIdxKey;   /* Unpacked index key */\n  char aSpace[384];          /* Temp space for pIdxKey - to avoid a malloc */\n  char *pFree = 0;\n\n  if( pKey ){\n    assert( nKey==(i64)(int)nKey );\n    pIdxKey = sqlite3VdbeAllocUnpackedRecord(\n        pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree\n    );\n    if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT;\n    sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey);\n    if( pIdxKey->nField==0 ){\n      sqlite3DbFree(pCur->pKeyInfo->db, pFree);\n      return SQLITE_CORRUPT_BKPT;\n    }\n  }else{\n    pIdxKey = 0;\n  }\n  rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes);\n  if( pFree ){\n    sqlite3DbFree(pCur->pKeyInfo->db, pFree);\n  }\n  return rc;\n}\n\n/*\n** Restore the cursor to the position it was in (or as close to as possible)\n** when saveCursorPosition() was called. Note that this call deletes the \n** saved position info stored by saveCursorPosition(), so there can be\n** at most one effective restoreCursorPosition() call after each \n** saveCursorPosition().\n*/\nstatic int btreeRestoreCursorPosition(BtCursor *pCur){\n  int rc;\n  int skipNext;\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pCur->eState>=CURSOR_REQUIRESEEK );\n  if( pCur->eState==CURSOR_FAULT ){\n    return pCur->skipNext;\n  }\n  pCur->eState = CURSOR_INVALID;\n  rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &skipNext);\n  if( rc==SQLITE_OK ){\n    sqlite3_free(pCur->pKey);\n    pCur->pKey = 0;\n    assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID );\n    pCur->skipNext |= skipNext;\n    if( pCur->skipNext && pCur->eState==CURSOR_VALID ){\n      pCur->eState = CURSOR_SKIPNEXT;\n    }\n  }\n  return rc;\n}\n\n#define restoreCursorPosition(p) \\\n  (p->eState>=CURSOR_REQUIRESEEK ? \\\n         btreeRestoreCursorPosition(p) : \\\n         SQLITE_OK)\n\n/*\n** Determine whether or not a cursor has moved from the position where\n** it was last placed, or has been invalidated for any other reason.\n** Cursors can move when the row they are pointing at is deleted out\n** from under them, for example.  Cursor might also move if a btree\n** is rebalanced.\n**\n** Calling this routine with a NULL cursor pointer returns false.\n**\n** Use the separate sqlite3BtreeCursorRestore() routine to restore a cursor\n** back to where it ought to be if this routine returns true.\n*/\nint sqlite3BtreeCursorHasMoved(BtCursor *pCur){\n  return pCur->eState!=CURSOR_VALID;\n}\n\n/*\n** This routine restores a cursor back to its original position after it\n** has been moved by some outside activity (such as a btree rebalance or\n** a row having been deleted out from under the cursor).  \n**\n** On success, the *pDifferentRow parameter is false if the cursor is left\n** pointing at exactly the same row.  *pDifferntRow is the row the cursor\n** was pointing to has been deleted, forcing the cursor to point to some\n** nearby row.\n**\n** This routine should only be called for a cursor that just returned\n** TRUE from sqlite3BtreeCursorHasMoved().\n*/\nint sqlite3BtreeCursorRestore(BtCursor *pCur, int *pDifferentRow){\n  int rc;\n\n  assert( pCur!=0 );\n  assert( pCur->eState!=CURSOR_VALID );\n  rc = restoreCursorPosition(pCur);\n  if( rc ){\n    *pDifferentRow = 1;\n    return rc;\n  }\n  if( pCur->eState!=CURSOR_VALID ){\n    *pDifferentRow = 1;\n  }else{\n    assert( pCur->skipNext==0 );\n    *pDifferentRow = 0;\n  }\n  return SQLITE_OK;\n}\n\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n/*\n** Provide hints to the cursor.  The particular hint given (and the type\n** and number of the varargs parameters) is determined by the eHintType\n** parameter.  See the definitions of the BTREE_HINT_* macros for details.\n*/\nvoid sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){\n  /* Used only by system that substitute their own storage engine */\n}\n#endif\n\n/*\n** Provide flag hints to the cursor.\n*/\nvoid sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){\n  assert( x==BTREE_SEEK_EQ || x==BTREE_BULKLOAD || x==0 );\n  pCur->hints = x;\n}\n\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n/*\n** Given a page number of a regular database page, return the page\n** number for the pointer-map page that contains the entry for the\n** input page number.\n**\n** Return 0 (not a valid page) for pgno==1 since there is\n** no pointer map associated with page 1.  The integrity_check logic\n** requires that ptrmapPageno(*,1)!=1.\n*/\nstatic Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){\n  int nPagesPerMapPage;\n  Pgno iPtrMap, ret;\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  if( pgno<2 ) return 0;\n  nPagesPerMapPage = (pBt->usableSize/5)+1;\n  iPtrMap = (pgno-2)/nPagesPerMapPage;\n  ret = (iPtrMap*nPagesPerMapPage) + 2; \n  if( ret==PENDING_BYTE_PAGE(pBt) ){\n    ret++;\n  }\n  return ret;\n}\n\n/*\n** Write an entry into the pointer map.\n**\n** This routine updates the pointer map entry for page number 'key'\n** so that it maps to type 'eType' and parent page number 'pgno'.\n**\n** If *pRC is initially non-zero (non-SQLITE_OK) then this routine is\n** a no-op.  If an error occurs, the appropriate error code is written\n** into *pRC.\n*/\nstatic void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){\n  DbPage *pDbPage;  /* The pointer map page */\n  u8 *pPtrmap;      /* The pointer map data */\n  Pgno iPtrmap;     /* The pointer map page number */\n  int offset;       /* Offset in pointer map page */\n  int rc;           /* Return code from subfunctions */\n\n  if( *pRC ) return;\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  /* The master-journal page number must never be used as a pointer map page */\n  assert( 0==PTRMAP_ISPAGE(pBt, PENDING_BYTE_PAGE(pBt)) );\n\n  assert( pBt->autoVacuum );\n  if( key==0 ){\n    *pRC = SQLITE_CORRUPT_BKPT;\n    return;\n  }\n  iPtrmap = PTRMAP_PAGENO(pBt, key);\n  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0);\n  if( rc!=SQLITE_OK ){\n    *pRC = rc;\n    return;\n  }\n  offset = PTRMAP_PTROFFSET(iPtrmap, key);\n  if( offset<0 ){\n    *pRC = SQLITE_CORRUPT_BKPT;\n    goto ptrmap_exit;\n  }\n  assert( offset <= (int)pBt->usableSize-5 );\n  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);\n\n  if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){\n    TRACE((\"PTRMAP_UPDATE: %d->(%d,%d)\\n\", key, eType, parent));\n    *pRC= rc = sqlite3PagerWrite(pDbPage);\n    if( rc==SQLITE_OK ){\n      pPtrmap[offset] = eType;\n      put4byte(&pPtrmap[offset+1], parent);\n    }\n  }\n\nptrmap_exit:\n  sqlite3PagerUnref(pDbPage);\n}\n\n/*\n** Read an entry from the pointer map.\n**\n** This routine retrieves the pointer map entry for page 'key', writing\n** the type and parent page number to *pEType and *pPgno respectively.\n** An error code is returned if something goes wrong, otherwise SQLITE_OK.\n*/\nstatic int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){\n  DbPage *pDbPage;   /* The pointer map page */\n  int iPtrmap;       /* Pointer map page index */\n  u8 *pPtrmap;       /* Pointer map page data */\n  int offset;        /* Offset of entry in pointer map */\n  int rc;\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n\n  iPtrmap = PTRMAP_PAGENO(pBt, key);\n  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0);\n  if( rc!=0 ){\n    return rc;\n  }\n  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);\n\n  offset = PTRMAP_PTROFFSET(iPtrmap, key);\n  if( offset<0 ){\n    sqlite3PagerUnref(pDbPage);\n    return SQLITE_CORRUPT_BKPT;\n  }\n  assert( offset <= (int)pBt->usableSize-5 );\n  assert( pEType!=0 );\n  *pEType = pPtrmap[offset];\n  if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);\n\n  sqlite3PagerUnref(pDbPage);\n  if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;\n  return SQLITE_OK;\n}\n\n#else /* if defined SQLITE_OMIT_AUTOVACUUM */\n  #define ptrmapPut(w,x,y,z,rc)\n  #define ptrmapGet(w,x,y,z) SQLITE_OK\n  #define ptrmapPutOvflPtr(x, y, rc)\n#endif\n\n/*\n** Given a btree page and a cell index (0 means the first cell on\n** the page, 1 means the second cell, and so forth) return a pointer\n** to the cell content.\n**\n** findCellPastPtr() does the same except it skips past the initial\n** 4-byte child pointer found on interior pages, if there is one.\n**\n** This routine works only for pages that do not contain overflow cells.\n*/\n#define findCell(P,I) \\\n  ((P)->aData + ((P)->maskPage & get2byteAligned(&(P)->aCellIdx[2*(I)])))\n#define findCellPastPtr(P,I) \\\n  ((P)->aDataOfst + ((P)->maskPage & get2byteAligned(&(P)->aCellIdx[2*(I)])))\n\n\n/*\n** This is common tail processing for btreeParseCellPtr() and\n** btreeParseCellPtrIndex() for the case when the cell does not fit entirely\n** on a single B-tree page.  Make necessary adjustments to the CellInfo\n** structure.\n*/\nstatic SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(\n  MemPage *pPage,         /* Page containing the cell */\n  u8 *pCell,              /* Pointer to the cell text. */\n  CellInfo *pInfo         /* Fill in this structure */\n){\n  /* If the payload will not fit completely on the local page, we have\n  ** to decide how much to store locally and how much to spill onto\n  ** overflow pages.  The strategy is to minimize the amount of unused\n  ** space on overflow pages while keeping the amount of local storage\n  ** in between minLocal and maxLocal.\n  **\n  ** Warning:  changing the way overflow payload is distributed in any\n  ** way will result in an incompatible file format.\n  */\n  int minLocal;  /* Minimum amount of payload held locally */\n  int maxLocal;  /* Maximum amount of payload held locally */\n  int surplus;   /* Overflow payload available for local storage */\n\n  minLocal = pPage->minLocal;\n  maxLocal = pPage->maxLocal;\n  surplus = minLocal + (pInfo->nPayload - minLocal)%(pPage->pBt->usableSize-4);\n  testcase( surplus==maxLocal );\n  testcase( surplus==maxLocal+1 );\n  if( surplus <= maxLocal ){\n    pInfo->nLocal = (u16)surplus;\n  }else{\n    pInfo->nLocal = (u16)minLocal;\n  }\n  pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;\n}\n\n/*\n** The following routines are implementations of the MemPage.xParseCell()\n** method.\n**\n** Parse a cell content block and fill in the CellInfo structure.\n**\n** btreeParseCellPtr()        =>   table btree leaf nodes\n** btreeParseCellNoPayload()  =>   table btree internal nodes\n** btreeParseCellPtrIndex()   =>   index btree nodes\n**\n** There is also a wrapper function btreeParseCell() that works for\n** all MemPage types and that references the cell by index rather than\n** by pointer.\n*/\nstatic void btreeParseCellPtrNoPayload(\n  MemPage *pPage,         /* Page containing the cell */\n  u8 *pCell,              /* Pointer to the cell text. */\n  CellInfo *pInfo         /* Fill in this structure */\n){\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( pPage->leaf==0 );\n  assert( pPage->childPtrSize==4 );\n#ifndef SQLITE_DEBUG\n  UNUSED_PARAMETER(pPage);\n#endif\n  pInfo->nSize = 4 + getVarint(&pCell[4], (u64*)&pInfo->nKey);\n  pInfo->nPayload = 0;\n  pInfo->nLocal = 0;\n  pInfo->pPayload = 0;\n  return;\n}\nstatic void btreeParseCellPtr(\n  MemPage *pPage,         /* Page containing the cell */\n  u8 *pCell,              /* Pointer to the cell text. */\n  CellInfo *pInfo         /* Fill in this structure */\n){\n  u8 *pIter;              /* For scanning through pCell */\n  u32 nPayload;           /* Number of bytes of cell payload */\n  u64 iKey;               /* Extracted Key value */\n\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( pPage->leaf==0 || pPage->leaf==1 );\n  assert( pPage->intKeyLeaf );\n  assert( pPage->childPtrSize==0 );\n  pIter = pCell;\n\n  /* The next block of code is equivalent to:\n  **\n  **     pIter += getVarint32(pIter, nPayload);\n  **\n  ** The code is inlined to avoid a function call.\n  */\n  nPayload = *pIter;\n  if( nPayload>=0x80 ){\n    u8 *pEnd = &pIter[8];\n    nPayload &= 0x7f;\n    do{\n      nPayload = (nPayload<<7) | (*++pIter & 0x7f);\n    }while( (*pIter)>=0x80 && pIter<pEnd );\n  }\n  pIter++;\n\n  /* The next block of code is equivalent to:\n  **\n  **     pIter += getVarint(pIter, (u64*)&pInfo->nKey);\n  **\n  ** The code is inlined to avoid a function call.\n  */\n  iKey = *pIter;\n  if( iKey>=0x80 ){\n    u8 *pEnd = &pIter[7];\n    iKey &= 0x7f;\n    while(1){\n      iKey = (iKey<<7) | (*++pIter & 0x7f);\n      if( (*pIter)<0x80 ) break;\n      if( pIter>=pEnd ){\n        iKey = (iKey<<8) | *++pIter;\n        break;\n      }\n    }\n  }\n  pIter++;\n\n  pInfo->nKey = *(i64*)&iKey;\n  pInfo->nPayload = nPayload;\n  pInfo->pPayload = pIter;\n  testcase( nPayload==pPage->maxLocal );\n  testcase( nPayload==pPage->maxLocal+1 );\n  if( nPayload<=pPage->maxLocal ){\n    /* This is the (easy) common case where the entire payload fits\n    ** on the local page.  No overflow is required.\n    */\n    pInfo->nSize = nPayload + (u16)(pIter - pCell);\n    if( pInfo->nSize<4 ) pInfo->nSize = 4;\n    pInfo->nLocal = (u16)nPayload;\n  }else{\n    btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);\n  }\n}\nstatic void btreeParseCellPtrIndex(\n  MemPage *pPage,         /* Page containing the cell */\n  u8 *pCell,              /* Pointer to the cell text. */\n  CellInfo *pInfo         /* Fill in this structure */\n){\n  u8 *pIter;              /* For scanning through pCell */\n  u32 nPayload;           /* Number of bytes of cell payload */\n\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( pPage->leaf==0 || pPage->leaf==1 );\n  assert( pPage->intKeyLeaf==0 );\n  pIter = pCell + pPage->childPtrSize;\n  nPayload = *pIter;\n  if( nPayload>=0x80 ){\n    u8 *pEnd = &pIter[8];\n    nPayload &= 0x7f;\n    do{\n      nPayload = (nPayload<<7) | (*++pIter & 0x7f);\n    }while( *(pIter)>=0x80 && pIter<pEnd );\n  }\n  pIter++;\n  pInfo->nKey = nPayload;\n  pInfo->nPayload = nPayload;\n  pInfo->pPayload = pIter;\n  testcase( nPayload==pPage->maxLocal );\n  testcase( nPayload==pPage->maxLocal+1 );\n  if( nPayload<=pPage->maxLocal ){\n    /* This is the (easy) common case where the entire payload fits\n    ** on the local page.  No overflow is required.\n    */\n    pInfo->nSize = nPayload + (u16)(pIter - pCell);\n    if( pInfo->nSize<4 ) pInfo->nSize = 4;\n    pInfo->nLocal = (u16)nPayload;\n  }else{\n    btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);\n  }\n}\nstatic void btreeParseCell(\n  MemPage *pPage,         /* Page containing the cell */\n  int iCell,              /* The cell index.  First cell is 0 */\n  CellInfo *pInfo         /* Fill in this structure */\n){\n  pPage->xParseCell(pPage, findCell(pPage, iCell), pInfo);\n}\n\n/*\n** The following routines are implementations of the MemPage.xCellSize\n** method.\n**\n** Compute the total number of bytes that a Cell needs in the cell\n** data area of the btree-page.  The return number includes the cell\n** data header and the local payload, but not any overflow page or\n** the space used by the cell pointer.\n**\n** cellSizePtrNoPayload()    =>   table internal nodes\n** cellSizePtr()             =>   all index nodes & table leaf nodes\n*/\nstatic u16 cellSizePtr(MemPage *pPage, u8 *pCell){\n  u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */\n  u8 *pEnd;                                /* End mark for a varint */\n  u32 nSize;                               /* Size value to return */\n\n#ifdef SQLITE_DEBUG\n  /* The value returned by this function should always be the same as\n  ** the (CellInfo.nSize) value found by doing a full parse of the\n  ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of\n  ** this function verifies that this invariant is not violated. */\n  CellInfo debuginfo;\n  pPage->xParseCell(pPage, pCell, &debuginfo);\n#endif\n\n  nSize = *pIter;\n  if( nSize>=0x80 ){\n    pEnd = &pIter[8];\n    nSize &= 0x7f;\n    do{\n      nSize = (nSize<<7) | (*++pIter & 0x7f);\n    }while( *(pIter)>=0x80 && pIter<pEnd );\n  }\n  pIter++;\n  if( pPage->intKey ){\n    /* pIter now points at the 64-bit integer key value, a variable length \n    ** integer. The following block moves pIter to point at the first byte\n    ** past the end of the key value. */\n    pEnd = &pIter[9];\n    while( (*pIter++)&0x80 && pIter<pEnd );\n  }\n  testcase( nSize==pPage->maxLocal );\n  testcase( nSize==pPage->maxLocal+1 );\n  if( nSize<=pPage->maxLocal ){\n    nSize += (u32)(pIter - pCell);\n    if( nSize<4 ) nSize = 4;\n  }else{\n    int minLocal = pPage->minLocal;\n    nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);\n    testcase( nSize==pPage->maxLocal );\n    testcase( nSize==pPage->maxLocal+1 );\n    if( nSize>pPage->maxLocal ){\n      nSize = minLocal;\n    }\n    nSize += 4 + (u16)(pIter - pCell);\n  }\n  assert( nSize==debuginfo.nSize || CORRUPT_DB );\n  return (u16)nSize;\n}\nstatic u16 cellSizePtrNoPayload(MemPage *pPage, u8 *pCell){\n  u8 *pIter = pCell + 4; /* For looping over bytes of pCell */\n  u8 *pEnd;              /* End mark for a varint */\n\n#ifdef SQLITE_DEBUG\n  /* The value returned by this function should always be the same as\n  ** the (CellInfo.nSize) value found by doing a full parse of the\n  ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of\n  ** this function verifies that this invariant is not violated. */\n  CellInfo debuginfo;\n  pPage->xParseCell(pPage, pCell, &debuginfo);\n#else\n  UNUSED_PARAMETER(pPage);\n#endif\n\n  assert( pPage->childPtrSize==4 );\n  pEnd = pIter + 9;\n  while( (*pIter++)&0x80 && pIter<pEnd );\n  assert( debuginfo.nSize==(u16)(pIter - pCell) || CORRUPT_DB );\n  return (u16)(pIter - pCell);\n}\n\n\n#ifdef SQLITE_DEBUG\n/* This variation on cellSizePtr() is used inside of assert() statements\n** only. */\nstatic u16 cellSize(MemPage *pPage, int iCell){\n  return pPage->xCellSize(pPage, findCell(pPage, iCell));\n}\n#endif\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n/*\n** If the cell pCell, part of page pPage contains a pointer\n** to an overflow page, insert an entry into the pointer-map\n** for the overflow page.\n*/\nstatic void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){\n  CellInfo info;\n  if( *pRC ) return;\n  assert( pCell!=0 );\n  pPage->xParseCell(pPage, pCell, &info);\n  if( info.nLocal<info.nPayload ){\n    Pgno ovfl = get4byte(&pCell[info.nSize-4]);\n    ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC);\n  }\n}\n#endif\n\n\n/*\n** Defragment the page given.  All Cells are moved to the\n** end of the page and all free space is collected into one\n** big FreeBlk that occurs in between the header and cell\n** pointer array and the cell content area.\n**\n** EVIDENCE-OF: R-44582-60138 SQLite may from time to time reorganize a\n** b-tree page so that there are no freeblocks or fragment bytes, all\n** unused bytes are contained in the unallocated space region, and all\n** cells are packed tightly at the end of the page.\n*/\nstatic int defragmentPage(MemPage *pPage){\n  int i;                     /* Loop counter */\n  int pc;                    /* Address of the i-th cell */\n  int hdr;                   /* Offset to the page header */\n  int size;                  /* Size of a cell */\n  int usableSize;            /* Number of usable bytes on a page */\n  int cellOffset;            /* Offset to the cell pointer array */\n  int cbrk;                  /* Offset to the cell content area */\n  int nCell;                 /* Number of cells on the page */\n  unsigned char *data;       /* The page data */\n  unsigned char *temp;       /* Temp area for cell content */\n  unsigned char *src;        /* Source of content */\n  int iCellFirst;            /* First allowable cell index */\n  int iCellLast;             /* Last possible cell index */\n\n\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n  assert( pPage->pBt!=0 );\n  assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );\n  assert( pPage->nOverflow==0 );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  temp = 0;\n  src = data = pPage->aData;\n  hdr = pPage->hdrOffset;\n  cellOffset = pPage->cellOffset;\n  nCell = pPage->nCell;\n  assert( nCell==get2byte(&data[hdr+3]) );\n  usableSize = pPage->pBt->usableSize;\n  cbrk = usableSize;\n  iCellFirst = cellOffset + 2*nCell;\n  iCellLast = usableSize - 4;\n  for(i=0; i<nCell; i++){\n    u8 *pAddr;     /* The i-th cell pointer */\n    pAddr = &data[cellOffset + i*2];\n    pc = get2byte(pAddr);\n    testcase( pc==iCellFirst );\n    testcase( pc==iCellLast );\n    /* These conditions have already been verified in btreeInitPage()\n    ** if PRAGMA cell_size_check=ON.\n    */\n    if( pc<iCellFirst || pc>iCellLast ){\n      return SQLITE_CORRUPT_BKPT;\n    }\n    assert( pc>=iCellFirst && pc<=iCellLast );\n    size = pPage->xCellSize(pPage, &src[pc]);\n    cbrk -= size;\n    if( cbrk<iCellFirst || pc+size>usableSize ){\n      return SQLITE_CORRUPT_BKPT;\n    }\n    assert( cbrk+size<=usableSize && cbrk>=iCellFirst );\n    testcase( cbrk+size==usableSize );\n    testcase( pc+size==usableSize );\n    put2byte(pAddr, cbrk);\n    if( temp==0 ){\n      int x;\n      if( cbrk==pc ) continue;\n      temp = sqlite3PagerTempSpace(pPage->pBt->pPager);\n      x = get2byte(&data[hdr+5]);\n      memcpy(&temp[x], &data[x], (cbrk+size) - x);\n      src = temp;\n    }\n    memcpy(&data[cbrk], &src[pc], size);\n  }\n  assert( cbrk>=iCellFirst );\n  put2byte(&data[hdr+5], cbrk);\n  data[hdr+1] = 0;\n  data[hdr+2] = 0;\n  data[hdr+7] = 0;\n  memset(&data[iCellFirst], 0, cbrk-iCellFirst);\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n  if( cbrk-iCellFirst!=pPage->nFree ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Search the free-list on page pPg for space to store a cell nByte bytes in\n** size. If one can be found, return a pointer to the space and remove it\n** from the free-list.\n**\n** If no suitable space can be found on the free-list, return NULL.\n**\n** This function may detect corruption within pPg.  If corruption is\n** detected then *pRc is set to SQLITE_CORRUPT and NULL is returned.\n**\n** Slots on the free list that are between 1 and 3 bytes larger than nByte\n** will be ignored if adding the extra space to the fragmentation count\n** causes the fragmentation count to exceed 60.\n*/\nstatic u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){\n  const int hdr = pPg->hdrOffset;\n  u8 * const aData = pPg->aData;\n  int iAddr = hdr + 1;\n  int pc = get2byte(&aData[iAddr]);\n  int x;\n  int usableSize = pPg->pBt->usableSize;\n\n  assert( pc>0 );\n  do{\n    int size;            /* Size of the free slot */\n    /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of\n    ** increasing offset. */\n    if( pc>usableSize-4 || pc<iAddr+4 ){\n      *pRc = SQLITE_CORRUPT_BKPT;\n      return 0;\n    }\n    /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each\n    ** freeblock form a big-endian integer which is the size of the freeblock\n    ** in bytes, including the 4-byte header. */\n    size = get2byte(&aData[pc+2]);\n    if( (x = size - nByte)>=0 ){\n      testcase( x==4 );\n      testcase( x==3 );\n      if( pc < pPg->cellOffset+2*pPg->nCell || size+pc > usableSize ){\n        *pRc = SQLITE_CORRUPT_BKPT;\n        return 0;\n      }else if( x<4 ){\n        /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total\n        ** number of bytes in fragments may not exceed 60. */\n        if( aData[hdr+7]>57 ) return 0;\n\n        /* Remove the slot from the free-list. Update the number of\n        ** fragmented bytes within the page. */\n        memcpy(&aData[iAddr], &aData[pc], 2);\n        aData[hdr+7] += (u8)x;\n      }else{\n        /* The slot remains on the free-list. Reduce its size to account\n         ** for the portion used by the new allocation. */\n        put2byte(&aData[pc+2], x);\n      }\n      return &aData[pc + x];\n    }\n    iAddr = pc;\n    pc = get2byte(&aData[pc]);\n  }while( pc );\n\n  return 0;\n}\n\n/*\n** Allocate nByte bytes of space from within the B-Tree page passed\n** as the first argument. Write into *pIdx the index into pPage->aData[]\n** of the first byte of allocated space. Return either SQLITE_OK or\n** an error code (usually SQLITE_CORRUPT).\n**\n** The caller guarantees that there is sufficient space to make the\n** allocation.  This routine might need to defragment in order to bring\n** all the space together, however.  This routine will avoid using\n** the first two bytes past the cell pointer area since presumably this\n** allocation is being made in order to insert a new cell, so we will\n** also end up needing a new cell pointer.\n*/\nstatic int allocateSpace(MemPage *pPage, int nByte, int *pIdx){\n  const int hdr = pPage->hdrOffset;    /* Local cache of pPage->hdrOffset */\n  u8 * const data = pPage->aData;      /* Local cache of pPage->aData */\n  int top;                             /* First byte of cell content area */\n  int rc = SQLITE_OK;                  /* Integer return code */\n  int gap;        /* First byte of gap between cell pointers and cell content */\n  \n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n  assert( pPage->pBt );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( nByte>=0 );  /* Minimum cell size is 4 */\n  assert( pPage->nFree>=nByte );\n  assert( pPage->nOverflow==0 );\n  assert( nByte < (int)(pPage->pBt->usableSize-8) );\n\n  assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf );\n  gap = pPage->cellOffset + 2*pPage->nCell;\n  assert( gap<=65536 );\n  /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size\n  ** and the reserved space is zero (the usual value for reserved space)\n  ** then the cell content offset of an empty page wants to be 65536.\n  ** However, that integer is too large to be stored in a 2-byte unsigned\n  ** integer, so a value of 0 is used in its place. */\n  top = get2byte(&data[hdr+5]);\n  assert( top<=(int)pPage->pBt->usableSize ); /* Prevent by getAndInitPage() */\n  if( gap>top ){\n    if( top==0 && pPage->pBt->usableSize==65536 ){\n      top = 65536;\n    }else{\n      return SQLITE_CORRUPT_BKPT;\n    }\n  }\n\n  /* If there is enough space between gap and top for one more cell pointer\n  ** array entry offset, and if the freelist is not empty, then search the\n  ** freelist looking for a free slot big enough to satisfy the request.\n  */\n  testcase( gap+2==top );\n  testcase( gap+1==top );\n  testcase( gap==top );\n  if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){\n    u8 *pSpace = pageFindSlot(pPage, nByte, &rc);\n    if( pSpace ){\n      assert( pSpace>=data && (pSpace - data)<65536 );\n      *pIdx = (int)(pSpace - data);\n      return SQLITE_OK;\n    }else if( rc ){\n      return rc;\n    }\n  }\n\n  /* The request could not be fulfilled using a freelist slot.  Check\n  ** to see if defragmentation is necessary.\n  */\n  testcase( gap+2+nByte==top );\n  if( gap+2+nByte>top ){\n    assert( pPage->nCell>0 || CORRUPT_DB );\n    rc = defragmentPage(pPage);\n    if( rc ) return rc;\n    top = get2byteNotZero(&data[hdr+5]);\n    assert( gap+nByte<=top );\n  }\n\n\n  /* Allocate memory from the gap in between the cell pointer array\n  ** and the cell content area.  The btreeInitPage() call has already\n  ** validated the freelist.  Given that the freelist is valid, there\n  ** is no way that the allocation can extend off the end of the page.\n  ** The assert() below verifies the previous sentence.\n  */\n  top -= nByte;\n  put2byte(&data[hdr+5], top);\n  assert( top+nByte <= (int)pPage->pBt->usableSize );\n  *pIdx = top;\n  return SQLITE_OK;\n}\n\n/*\n** Return a section of the pPage->aData to the freelist.\n** The first byte of the new free block is pPage->aData[iStart]\n** and the size of the block is iSize bytes.\n**\n** Adjacent freeblocks are coalesced.\n**\n** Note that even though the freeblock list was checked by btreeInitPage(),\n** that routine will not detect overlap between cells or freeblocks.  Nor\n** does it detect cells or freeblocks that encrouch into the reserved bytes\n** at the end of the page.  So do additional corruption checks inside this\n** routine and return SQLITE_CORRUPT if any problems are found.\n*/\nstatic int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){\n  u16 iPtr;                             /* Address of ptr to next freeblock */\n  u16 iFreeBlk;                         /* Address of the next freeblock */\n  u8 hdr;                               /* Page header size.  0 or 100 */\n  u8 nFrag = 0;                         /* Reduction in fragmentation */\n  u16 iOrigSize = iSize;                /* Original value of iSize */\n  u32 iLast = pPage->pBt->usableSize-4; /* Largest possible freeblock offset */\n  u32 iEnd = iStart + iSize;            /* First byte past the iStart buffer */\n  unsigned char *data = pPage->aData;   /* Page content */\n\n  assert( pPage->pBt!=0 );\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n  assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize );\n  assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( iSize>=4 );   /* Minimum cell size is 4 */\n  assert( iStart<=iLast );\n\n  /* Overwrite deleted information with zeros when the secure_delete\n  ** option is enabled */\n  if( pPage->pBt->btsFlags & BTS_SECURE_DELETE ){\n    memset(&data[iStart], 0, iSize);\n  }\n\n  /* The list of freeblocks must be in ascending order.  Find the \n  ** spot on the list where iStart should be inserted.\n  */\n  hdr = pPage->hdrOffset;\n  iPtr = hdr + 1;\n  if( data[iPtr+1]==0 && data[iPtr]==0 ){\n    iFreeBlk = 0;  /* Shortcut for the case when the freelist is empty */\n  }else{\n    while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){\n      if( iFreeBlk<iPtr+4 ){\n        if( iFreeBlk==0 ) break;\n        return SQLITE_CORRUPT_BKPT;\n      }\n      iPtr = iFreeBlk;\n    }\n    if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT;\n    assert( iFreeBlk>iPtr || iFreeBlk==0 );\n  \n    /* At this point:\n    **    iFreeBlk:   First freeblock after iStart, or zero if none\n    **    iPtr:       The address of a pointer to iFreeBlk\n    **\n    ** Check to see if iFreeBlk should be coalesced onto the end of iStart.\n    */\n    if( iFreeBlk && iEnd+3>=iFreeBlk ){\n      nFrag = iFreeBlk - iEnd;\n      if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_BKPT;\n      iEnd = iFreeBlk + get2byte(&data[iFreeBlk+2]);\n      if( iEnd > pPage->pBt->usableSize ) return SQLITE_CORRUPT_BKPT;\n      iSize = iEnd - iStart;\n      iFreeBlk = get2byte(&data[iFreeBlk]);\n    }\n  \n    /* If iPtr is another freeblock (that is, if iPtr is not the freelist\n    ** pointer in the page header) then check to see if iStart should be\n    ** coalesced onto the end of iPtr.\n    */\n    if( iPtr>hdr+1 ){\n      int iPtrEnd = iPtr + get2byte(&data[iPtr+2]);\n      if( iPtrEnd+3>=iStart ){\n        if( iPtrEnd>iStart ) return SQLITE_CORRUPT_BKPT;\n        nFrag += iStart - iPtrEnd;\n        iSize = iEnd - iPtr;\n        iStart = iPtr;\n      }\n    }\n    if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_BKPT;\n    data[hdr+7] -= nFrag;\n  }\n  if( iStart==get2byte(&data[hdr+5]) ){\n    /* The new freeblock is at the beginning of the cell content area,\n    ** so just extend the cell content area rather than create another\n    ** freelist entry */\n    if( iPtr!=hdr+1 ) return SQLITE_CORRUPT_BKPT;\n    put2byte(&data[hdr+1], iFreeBlk);\n    put2byte(&data[hdr+5], iEnd);\n  }else{\n    /* Insert the new freeblock into the freelist */\n    put2byte(&data[iPtr], iStart);\n    put2byte(&data[iStart], iFreeBlk);\n    put2byte(&data[iStart+2], iSize);\n  }\n  pPage->nFree += iOrigSize;\n  return SQLITE_OK;\n}\n\n/*\n** Decode the flags byte (the first byte of the header) for a page\n** and initialize fields of the MemPage structure accordingly.\n**\n** Only the following combinations are supported.  Anything different\n** indicates a corrupt database files:\n**\n**         PTF_ZERODATA\n**         PTF_ZERODATA | PTF_LEAF\n**         PTF_LEAFDATA | PTF_INTKEY\n**         PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF\n*/\nstatic int decodeFlags(MemPage *pPage, int flagByte){\n  BtShared *pBt;     /* A copy of pPage->pBt */\n\n  assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  pPage->leaf = (u8)(flagByte>>3);  assert( PTF_LEAF == 1<<3 );\n  flagByte &= ~PTF_LEAF;\n  pPage->childPtrSize = 4-4*pPage->leaf;\n  pPage->xCellSize = cellSizePtr;\n  pBt = pPage->pBt;\n  if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){\n    /* EVIDENCE-OF: R-07291-35328 A value of 5 (0x05) means the page is an\n    ** interior table b-tree page. */\n    assert( (PTF_LEAFDATA|PTF_INTKEY)==5 );\n    /* EVIDENCE-OF: R-26900-09176 A value of 13 (0x0d) means the page is a\n    ** leaf table b-tree page. */\n    assert( (PTF_LEAFDATA|PTF_INTKEY|PTF_LEAF)==13 );\n    pPage->intKey = 1;\n    if( pPage->leaf ){\n      pPage->intKeyLeaf = 1;\n      pPage->xParseCell = btreeParseCellPtr;\n    }else{\n      pPage->intKeyLeaf = 0;\n      pPage->xCellSize = cellSizePtrNoPayload;\n      pPage->xParseCell = btreeParseCellPtrNoPayload;\n    }\n    pPage->maxLocal = pBt->maxLeaf;\n    pPage->minLocal = pBt->minLeaf;\n  }else if( flagByte==PTF_ZERODATA ){\n    /* EVIDENCE-OF: R-43316-37308 A value of 2 (0x02) means the page is an\n    ** interior index b-tree page. */\n    assert( (PTF_ZERODATA)==2 );\n    /* EVIDENCE-OF: R-59615-42828 A value of 10 (0x0a) means the page is a\n    ** leaf index b-tree page. */\n    assert( (PTF_ZERODATA|PTF_LEAF)==10 );\n    pPage->intKey = 0;\n    pPage->intKeyLeaf = 0;\n    pPage->xParseCell = btreeParseCellPtrIndex;\n    pPage->maxLocal = pBt->maxLocal;\n    pPage->minLocal = pBt->minLocal;\n  }else{\n    /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is\n    ** an error. */\n    return SQLITE_CORRUPT_BKPT;\n  }\n  pPage->max1bytePayload = pBt->max1bytePayload;\n  return SQLITE_OK;\n}\n\n/*\n** Initialize the auxiliary information for a disk block.\n**\n** Return SQLITE_OK on success.  If we see that the page does\n** not contain a well-formed database page, then return \n** SQLITE_CORRUPT.  Note that a return of SQLITE_OK does not\n** guarantee that the page is well-formed.  It only shows that\n** we failed to detect any corruption.\n*/\nstatic int btreeInitPage(MemPage *pPage){\n\n  assert( pPage->pBt!=0 );\n  assert( pPage->pBt->db!=0 );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );\n  assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );\n  assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );\n\n  if( !pPage->isInit ){\n    u16 pc;            /* Address of a freeblock within pPage->aData[] */\n    u8 hdr;            /* Offset to beginning of page header */\n    u8 *data;          /* Equal to pPage->aData */\n    BtShared *pBt;        /* The main btree structure */\n    int usableSize;    /* Amount of usable space on each page */\n    u16 cellOffset;    /* Offset from start of page to first cell pointer */\n    int nFree;         /* Number of unused bytes on the page */\n    int top;           /* First byte of the cell content area */\n    int iCellFirst;    /* First allowable cell or freeblock offset */\n    int iCellLast;     /* Last possible cell or freeblock offset */\n\n    pBt = pPage->pBt;\n\n    hdr = pPage->hdrOffset;\n    data = pPage->aData;\n    /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating\n    ** the b-tree page type. */\n    if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;\n    assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );\n    pPage->maskPage = (u16)(pBt->pageSize - 1);\n    pPage->nOverflow = 0;\n    usableSize = pBt->usableSize;\n    pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;\n    pPage->aDataEnd = &data[usableSize];\n    pPage->aCellIdx = &data[cellOffset];\n    pPage->aDataOfst = &data[pPage->childPtrSize];\n    /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates\n    ** the start of the cell content area. A zero value for this integer is\n    ** interpreted as 65536. */\n    top = get2byteNotZero(&data[hdr+5]);\n    /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the\n    ** number of cells on the page. */\n    pPage->nCell = get2byte(&data[hdr+3]);\n    if( pPage->nCell>MX_CELL(pBt) ){\n      /* To many cells for a single page.  The page must be corrupt */\n      return SQLITE_CORRUPT_BKPT;\n    }\n    testcase( pPage->nCell==MX_CELL(pBt) );\n    /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only\n    ** possible for a root page of a table that contains no rows) then the\n    ** offset to the cell content area will equal the page size minus the\n    ** bytes of reserved space. */\n    assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );\n\n    /* A malformed database page might cause us to read past the end\n    ** of page when parsing a cell.  \n    **\n    ** The following block of code checks early to see if a cell extends\n    ** past the end of a page boundary and causes SQLITE_CORRUPT to be \n    ** returned if it does.\n    */\n    iCellFirst = cellOffset + 2*pPage->nCell;\n    iCellLast = usableSize - 4;\n    if( pBt->db->flags & SQLITE_CellSizeCk ){\n      int i;            /* Index into the cell pointer array */\n      int sz;           /* Size of a cell */\n\n      if( !pPage->leaf ) iCellLast--;\n      for(i=0; i<pPage->nCell; i++){\n        pc = get2byteAligned(&data[cellOffset+i*2]);\n        testcase( pc==iCellFirst );\n        testcase( pc==iCellLast );\n        if( pc<iCellFirst || pc>iCellLast ){\n          return SQLITE_CORRUPT_BKPT;\n        }\n        sz = pPage->xCellSize(pPage, &data[pc]);\n        testcase( pc+sz==usableSize );\n        if( pc+sz>usableSize ){\n          return SQLITE_CORRUPT_BKPT;\n        }\n      }\n      if( !pPage->leaf ) iCellLast++;\n    }  \n\n    /* Compute the total free space on the page\n    ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the\n    ** start of the first freeblock on the page, or is zero if there are no\n    ** freeblocks. */\n    pc = get2byte(&data[hdr+1]);\n    nFree = data[hdr+7] + top;  /* Init nFree to non-freeblock free space */\n    while( pc>0 ){\n      u16 next, size;\n      if( pc<iCellFirst || pc>iCellLast ){\n        /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will\n        ** always be at least one cell before the first freeblock.\n        **\n        ** Or, the freeblock is off the end of the page\n        */\n        return SQLITE_CORRUPT_BKPT; \n      }\n      next = get2byte(&data[pc]);\n      size = get2byte(&data[pc+2]);\n      if( (next>0 && next<=pc+size+3) || pc+size>usableSize ){\n        /* Free blocks must be in ascending order. And the last byte of\n        ** the free-block must lie on the database page.  */\n        return SQLITE_CORRUPT_BKPT; \n      }\n      nFree = nFree + size;\n      pc = next;\n    }\n\n    /* At this point, nFree contains the sum of the offset to the start\n    ** of the cell-content area plus the number of free bytes within\n    ** the cell-content area. If this is greater than the usable-size\n    ** of the page, then the page must be corrupted. This check also\n    ** serves to verify that the offset to the start of the cell-content\n    ** area, according to the page header, lies within the page.\n    */\n    if( nFree>usableSize ){\n      return SQLITE_CORRUPT_BKPT; \n    }\n    pPage->nFree = (u16)(nFree - iCellFirst);\n    pPage->isInit = 1;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Set up a raw page so that it looks like a database page holding\n** no entries.\n*/\nstatic void zeroPage(MemPage *pPage, int flags){\n  unsigned char *data = pPage->aData;\n  BtShared *pBt = pPage->pBt;\n  u8 hdr = pPage->hdrOffset;\n  u16 first;\n\n  assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );\n  assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );\n  assert( sqlite3PagerGetData(pPage->pDbPage) == data );\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  if( pBt->btsFlags & BTS_SECURE_DELETE ){\n    memset(&data[hdr], 0, pBt->usableSize - hdr);\n  }\n  data[hdr] = (char)flags;\n  first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);\n  memset(&data[hdr+1], 0, 4);\n  data[hdr+7] = 0;\n  put2byte(&data[hdr+5], pBt->usableSize);\n  pPage->nFree = (u16)(pBt->usableSize - first);\n  decodeFlags(pPage, flags);\n  pPage->cellOffset = first;\n  pPage->aDataEnd = &data[pBt->usableSize];\n  pPage->aCellIdx = &data[first];\n  pPage->aDataOfst = &data[pPage->childPtrSize];\n  pPage->nOverflow = 0;\n  assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );\n  pPage->maskPage = (u16)(pBt->pageSize - 1);\n  pPage->nCell = 0;\n  pPage->isInit = 1;\n}\n\n\n/*\n** Convert a DbPage obtained from the pager into a MemPage used by\n** the btree layer.\n*/\nstatic MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){\n  MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);\n  if( pgno!=pPage->pgno ){\n    pPage->aData = sqlite3PagerGetData(pDbPage);\n    pPage->pDbPage = pDbPage;\n    pPage->pBt = pBt;\n    pPage->pgno = pgno;\n    pPage->hdrOffset = pgno==1 ? 100 : 0;\n  }\n  assert( pPage->aData==sqlite3PagerGetData(pDbPage) );\n  return pPage; \n}\n\n/*\n** Get a page from the pager.  Initialize the MemPage.pBt and\n** MemPage.aData elements if needed.  See also: btreeGetUnusedPage().\n**\n** If the PAGER_GET_NOCONTENT flag is set, it means that we do not care\n** about the content of the page at this time.  So do not go to the disk\n** to fetch the content.  Just fill in the content with zeros for now.\n** If in the future we call sqlite3PagerWrite() on this page, that\n** means we have started to be concerned about content and the disk\n** read should occur at that point.\n*/\nstatic int btreeGetPage(\n  BtShared *pBt,       /* The btree */\n  Pgno pgno,           /* Number of the page to fetch */\n  MemPage **ppPage,    /* Return the page in this parameter */\n  int flags            /* PAGER_GET_NOCONTENT or PAGER_GET_READONLY */\n){\n  int rc;\n  DbPage *pDbPage;\n\n  assert( flags==0 || flags==PAGER_GET_NOCONTENT || flags==PAGER_GET_READONLY );\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, flags);\n  if( rc ) return rc;\n  *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt);\n  return SQLITE_OK;\n}\n\n/*\n** Retrieve a page from the pager cache. If the requested page is not\n** already in the pager cache return NULL. Initialize the MemPage.pBt and\n** MemPage.aData elements if needed.\n*/\nstatic MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){\n  DbPage *pDbPage;\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  pDbPage = sqlite3PagerLookup(pBt->pPager, pgno);\n  if( pDbPage ){\n    return btreePageFromDbPage(pDbPage, pgno, pBt);\n  }\n  return 0;\n}\n\n/*\n** Return the size of the database file in pages. If there is any kind of\n** error, return ((unsigned int)-1).\n*/\nstatic Pgno btreePagecount(BtShared *pBt){\n  return pBt->nPage;\n}\nu32 sqlite3BtreeLastPage(Btree *p){\n  assert( sqlite3BtreeHoldsMutex(p) );\n  assert( ((p->pBt->nPage)&0x8000000)==0 );\n  return btreePagecount(p->pBt);\n}\n\n/*\n** Get a page from the pager and initialize it.\n**\n** If pCur!=0 then the page is being fetched as part of a moveToChild()\n** call.  Do additional sanity checking on the page in this case.\n** And if the fetch fails, this routine must decrement pCur->iPage.\n**\n** The page is fetched as read-write unless pCur is not NULL and is\n** a read-only cursor.\n**\n** If an error occurs, then *ppPage is undefined. It\n** may remain unchanged, or it may be set to an invalid value.\n*/\nstatic int getAndInitPage(\n  BtShared *pBt,                  /* The database file */\n  Pgno pgno,                      /* Number of the page to get */\n  MemPage **ppPage,               /* Write the page pointer here */\n  BtCursor *pCur,                 /* Cursor to receive the page, or NULL */\n  int bReadOnly                   /* True for a read-only page */\n){\n  int rc;\n  DbPage *pDbPage;\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( pCur==0 || ppPage==&pCur->apPage[pCur->iPage] );\n  assert( pCur==0 || bReadOnly==pCur->curPagerFlags );\n  assert( pCur==0 || pCur->iPage>0 );\n\n  if( pgno>btreePagecount(pBt) ){\n    rc = SQLITE_CORRUPT_BKPT;\n    goto getAndInitPage_error;\n  }\n  rc = sqlite3PagerGet(pBt->pPager, pgno, (DbPage**)&pDbPage, bReadOnly);\n  if( rc ){\n    goto getAndInitPage_error;\n  }\n  *ppPage = (MemPage*)sqlite3PagerGetExtra(pDbPage);\n  if( (*ppPage)->isInit==0 ){\n    btreePageFromDbPage(pDbPage, pgno, pBt);\n    rc = btreeInitPage(*ppPage);\n    if( rc!=SQLITE_OK ){\n      releasePage(*ppPage);\n      goto getAndInitPage_error;\n    }\n  }\n  assert( (*ppPage)->pgno==pgno );\n  assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) );\n\n  /* If obtaining a child page for a cursor, we must verify that the page is\n  ** compatible with the root page. */\n  if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){\n    rc = SQLITE_CORRUPT_BKPT;\n    releasePage(*ppPage);\n    goto getAndInitPage_error;\n  }\n  return SQLITE_OK;\n\ngetAndInitPage_error:\n  if( pCur ) pCur->iPage--;\n  testcase( pgno==0 );\n  assert( pgno!=0 || rc==SQLITE_CORRUPT );\n  return rc;\n}\n\n/*\n** Release a MemPage.  This should be called once for each prior\n** call to btreeGetPage.\n*/\nstatic void releasePageNotNull(MemPage *pPage){\n  assert( pPage->aData );\n  assert( pPage->pBt );\n  assert( pPage->pDbPage!=0 );\n  assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );\n  assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  sqlite3PagerUnrefNotNull(pPage->pDbPage);\n}\nstatic void releasePage(MemPage *pPage){\n  if( pPage ) releasePageNotNull(pPage);\n}\n\n/*\n** Get an unused page.\n**\n** This works just like btreeGetPage() with the addition:\n**\n**   *  If the page is already in use for some other purpose, immediately\n**      release it and return an SQLITE_CURRUPT error.\n**   *  Make sure the isInit flag is clear\n*/\nstatic int btreeGetUnusedPage(\n  BtShared *pBt,       /* The btree */\n  Pgno pgno,           /* Number of the page to fetch */\n  MemPage **ppPage,    /* Return the page in this parameter */\n  int flags            /* PAGER_GET_NOCONTENT or PAGER_GET_READONLY */\n){\n  int rc = btreeGetPage(pBt, pgno, ppPage, flags);\n  if( rc==SQLITE_OK ){\n    if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){\n      releasePage(*ppPage);\n      *ppPage = 0;\n      return SQLITE_CORRUPT_BKPT;\n    }\n    (*ppPage)->isInit = 0;\n  }else{\n    *ppPage = 0;\n  }\n  return rc;\n}\n\n\n/*\n** During a rollback, when the pager reloads information into the cache\n** so that the cache is restored to its original state at the start of\n** the transaction, for each page restored this routine is called.\n**\n** This routine needs to reset the extra data section at the end of the\n** page to agree with the restored data.\n*/\nstatic void pageReinit(DbPage *pData){\n  MemPage *pPage;\n  pPage = (MemPage *)sqlite3PagerGetExtra(pData);\n  assert( sqlite3PagerPageRefcount(pData)>0 );\n  if( pPage->isInit ){\n    assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n    pPage->isInit = 0;\n    if( sqlite3PagerPageRefcount(pData)>1 ){\n      /* pPage might not be a btree page;  it might be an overflow page\n      ** or ptrmap page or a free page.  In those cases, the following\n      ** call to btreeInitPage() will likely return SQLITE_CORRUPT.\n      ** But no harm is done by this.  And it is very important that\n      ** btreeInitPage() be called on every btree page so we make\n      ** the call for every page that comes in for re-initing. */\n      btreeInitPage(pPage);\n    }\n  }\n}\n\n/*\n** Invoke the busy handler for a btree.\n*/\nstatic int btreeInvokeBusyHandler(void *pArg){\n  BtShared *pBt = (BtShared*)pArg;\n  assert( pBt->db );\n  assert( sqlite3_mutex_held(pBt->db->mutex) );\n  return sqlite3InvokeBusyHandler(&pBt->db->busyHandler);\n}\n\n/*\n** Open a database file.\n** \n** zFilename is the name of the database file.  If zFilename is NULL\n** then an ephemeral database is created.  The ephemeral database might\n** be exclusively in memory, or it might use a disk-based memory cache.\n** Either way, the ephemeral database will be automatically deleted \n** when sqlite3BtreeClose() is called.\n**\n** If zFilename is \":memory:\" then an in-memory database is created\n** that is automatically destroyed when it is closed.\n**\n** The \"flags\" parameter is a bitmask that might contain bits like\n** BTREE_OMIT_JOURNAL and/or BTREE_MEMORY.\n**\n** If the database is already opened in the same database connection\n** and we are in shared cache mode, then the open will fail with an\n** SQLITE_CONSTRAINT error.  We cannot allow two or more BtShared\n** objects in the same database connection since doing so will lead\n** to problems with locking.\n*/\nint sqlite3BtreeOpen(\n  sqlite3_vfs *pVfs,      /* VFS to use for this b-tree */\n  const char *zFilename,  /* Name of the file containing the BTree database */\n  sqlite3 *db,            /* Associated database handle */\n  Btree **ppBtree,        /* Pointer to new Btree object written here */\n  int flags,              /* Options */\n  int vfsFlags            /* Flags passed through to sqlite3_vfs.xOpen() */\n){\n  BtShared *pBt = 0;             /* Shared part of btree structure */\n  Btree *p;                      /* Handle to return */\n  sqlite3_mutex *mutexOpen = 0;  /* Prevents a race condition. Ticket #3537 */\n  int rc = SQLITE_OK;            /* Result code from this function */\n  u8 nReserve;                   /* Byte of unused space on each page */\n  unsigned char zDbHeader[100];  /* Database header content */\n\n  /* True if opening an ephemeral, temporary database */\n  const int isTempDb = zFilename==0 || zFilename[0]==0;\n\n  /* Set the variable isMemdb to true for an in-memory database, or \n  ** false for a file-based database.\n  */\n#ifdef SQLITE_OMIT_MEMORYDB\n  const int isMemdb = 0;\n#else\n  const int isMemdb = (zFilename && strcmp(zFilename, \":memory:\")==0)\n                       || (isTempDb && sqlite3TempInMemory(db))\n                       || (vfsFlags & SQLITE_OPEN_MEMORY)!=0;\n#endif\n\n  assert( db!=0 );\n  assert( pVfs!=0 );\n  assert( sqlite3_mutex_held(db->mutex) );\n  assert( (flags&0xff)==flags );   /* flags fit in 8 bits */\n\n  /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */\n  assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 );\n\n  /* A BTREE_SINGLE database is always a temporary and/or ephemeral */\n  assert( (flags & BTREE_SINGLE)==0 || isTempDb );\n\n  if( isMemdb ){\n    flags |= BTREE_MEMORY;\n  }\n  if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){\n    vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;\n  }\n  p = sqlite3MallocZero(sizeof(Btree));\n  if( !p ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  p->inTrans = TRANS_NONE;\n  p->db = db;\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  p->lock.pBtree = p;\n  p->lock.iTable = 1;\n#endif\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)\n  /*\n  ** If this Btree is a candidate for shared cache, try to find an\n  ** existing BtShared object that we can share with\n  */\n  if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){\n    if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){\n      int nFilename = sqlite3Strlen30(zFilename)+1;\n      int nFullPathname = pVfs->mxPathname+1;\n      char *zFullPathname = sqlite3Malloc(MAX(nFullPathname,nFilename));\n      MUTEX_LOGIC( sqlite3_mutex *mutexShared; )\n\n      p->sharable = 1;\n      if( !zFullPathname ){\n        sqlite3_free(p);\n        return SQLITE_NOMEM_BKPT;\n      }\n      if( isMemdb ){\n        memcpy(zFullPathname, zFilename, nFilename);\n      }else{\n        rc = sqlite3OsFullPathname(pVfs, zFilename,\n                                   nFullPathname, zFullPathname);\n        if( rc ){\n          sqlite3_free(zFullPathname);\n          sqlite3_free(p);\n          return rc;\n        }\n      }\n#if SQLITE_THREADSAFE\n      mutexOpen = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_OPEN);\n      sqlite3_mutex_enter(mutexOpen);\n      mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n      sqlite3_mutex_enter(mutexShared);\n#endif\n      for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){\n        assert( pBt->nRef>0 );\n        if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager, 0))\n                 && sqlite3PagerVfs(pBt->pPager)==pVfs ){\n          int iDb;\n          for(iDb=db->nDb-1; iDb>=0; iDb--){\n            Btree *pExisting = db->aDb[iDb].pBt;\n            if( pExisting && pExisting->pBt==pBt ){\n              sqlite3_mutex_leave(mutexShared);\n              sqlite3_mutex_leave(mutexOpen);\n              sqlite3_free(zFullPathname);\n              sqlite3_free(p);\n              return SQLITE_CONSTRAINT;\n            }\n          }\n          p->pBt = pBt;\n          pBt->nRef++;\n          break;\n        }\n      }\n      sqlite3_mutex_leave(mutexShared);\n      sqlite3_free(zFullPathname);\n    }\n#ifdef SQLITE_DEBUG\n    else{\n      /* In debug mode, we mark all persistent databases as sharable\n      ** even when they are not.  This exercises the locking code and\n      ** gives more opportunity for asserts(sqlite3_mutex_held())\n      ** statements to find locking problems.\n      */\n      p->sharable = 1;\n    }\n#endif\n  }\n#endif\n  if( pBt==0 ){\n    /*\n    ** The following asserts make sure that structures used by the btree are\n    ** the right size.  This is to guard against size changes that result\n    ** when compiling on a different architecture.\n    */\n    assert( sizeof(i64)==8 );\n    assert( sizeof(u64)==8 );\n    assert( sizeof(u32)==4 );\n    assert( sizeof(u16)==2 );\n    assert( sizeof(Pgno)==4 );\n  \n    pBt = sqlite3MallocZero( sizeof(*pBt) );\n    if( pBt==0 ){\n      rc = SQLITE_NOMEM_BKPT;\n      goto btree_open_out;\n    }\n    rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,\n                          EXTRA_SIZE, flags, vfsFlags, pageReinit);\n    if( rc==SQLITE_OK ){\n      sqlite3PagerSetMmapLimit(pBt->pPager, db->szMmap);\n      rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);\n    }\n    if( rc!=SQLITE_OK ){\n      goto btree_open_out;\n    }\n    pBt->openFlags = (u8)flags;\n    pBt->db = db;\n    sqlite3PagerSetBusyhandler(pBt->pPager, btreeInvokeBusyHandler, pBt);\n    p->pBt = pBt;\n  \n    pBt->pCursor = 0;\n    pBt->pPage1 = 0;\n    if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;\n#ifdef SQLITE_SECURE_DELETE\n    pBt->btsFlags |= BTS_SECURE_DELETE;\n#endif\n    /* EVIDENCE-OF: R-51873-39618 The page size for a database file is\n    ** determined by the 2-byte integer located at an offset of 16 bytes from\n    ** the beginning of the database file. */\n    pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);\n    if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE\n         || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){\n      pBt->pageSize = 0;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      /* If the magic name \":memory:\" will create an in-memory database, then\n      ** leave the autoVacuum mode at 0 (do not auto-vacuum), even if\n      ** SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if\n      ** SQLITE_OMIT_MEMORYDB has been defined, then \":memory:\" is just a\n      ** regular file-name. In this case the auto-vacuum applies as per normal.\n      */\n      if( zFilename && !isMemdb ){\n        pBt->autoVacuum = (SQLITE_DEFAULT_AUTOVACUUM ? 1 : 0);\n        pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);\n      }\n#endif\n      nReserve = 0;\n    }else{\n      /* EVIDENCE-OF: R-37497-42412 The size of the reserved region is\n      ** determined by the one-byte unsigned integer found at an offset of 20\n      ** into the database file header. */\n      nReserve = zDbHeader[20];\n      pBt->btsFlags |= BTS_PAGESIZE_FIXED;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);\n      pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);\n#endif\n    }\n    rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);\n    if( rc ) goto btree_open_out;\n    pBt->usableSize = pBt->pageSize - nReserve;\n    assert( (pBt->pageSize & 7)==0 );  /* 8-byte alignment of pageSize */\n   \n#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)\n    /* Add the new BtShared object to the linked list sharable BtShareds.\n    */\n    pBt->nRef = 1;\n    if( p->sharable ){\n      MUTEX_LOGIC( sqlite3_mutex *mutexShared; )\n      MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);)\n      if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){\n        pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);\n        if( pBt->mutex==0 ){\n          rc = SQLITE_NOMEM_BKPT;\n          goto btree_open_out;\n        }\n      }\n      sqlite3_mutex_enter(mutexShared);\n      pBt->pNext = GLOBAL(BtShared*,sqlite3SharedCacheList);\n      GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt;\n      sqlite3_mutex_leave(mutexShared);\n    }\n#endif\n  }\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)\n  /* If the new Btree uses a sharable pBtShared, then link the new\n  ** Btree into the list of all sharable Btrees for the same connection.\n  ** The list is kept in ascending order by pBt address.\n  */\n  if( p->sharable ){\n    int i;\n    Btree *pSib;\n    for(i=0; i<db->nDb; i++){\n      if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){\n        while( pSib->pPrev ){ pSib = pSib->pPrev; }\n        if( (uptr)p->pBt<(uptr)pSib->pBt ){\n          p->pNext = pSib;\n          p->pPrev = 0;\n          pSib->pPrev = p;\n        }else{\n          while( pSib->pNext && (uptr)pSib->pNext->pBt<(uptr)p->pBt ){\n            pSib = pSib->pNext;\n          }\n          p->pNext = pSib->pNext;\n          p->pPrev = pSib;\n          if( p->pNext ){\n            p->pNext->pPrev = p;\n          }\n          pSib->pNext = p;\n        }\n        break;\n      }\n    }\n  }\n#endif\n  *ppBtree = p;\n\nbtree_open_out:\n  if( rc!=SQLITE_OK ){\n    if( pBt && pBt->pPager ){\n      sqlite3PagerClose(pBt->pPager);\n    }\n    sqlite3_free(pBt);\n    sqlite3_free(p);\n    *ppBtree = 0;\n  }else{\n    /* If the B-Tree was successfully opened, set the pager-cache size to the\n    ** default value. Except, when opening on an existing shared pager-cache,\n    ** do not change the pager-cache size.\n    */\n    if( sqlite3BtreeSchema(p, 0, 0)==0 ){\n      sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE);\n    }\n  }\n  if( mutexOpen ){\n    assert( sqlite3_mutex_held(mutexOpen) );\n    sqlite3_mutex_leave(mutexOpen);\n  }\n  assert( rc!=SQLITE_OK || sqlite3BtreeConnectionCount(*ppBtree)>0 );\n  return rc;\n}\n\n/*\n** Decrement the BtShared.nRef counter.  When it reaches zero,\n** remove the BtShared structure from the sharing list.  Return\n** true if the BtShared.nRef counter reaches zero and return\n** false if it is still positive.\n*/\nstatic int removeFromSharingList(BtShared *pBt){\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  MUTEX_LOGIC( sqlite3_mutex *pMaster; )\n  BtShared *pList;\n  int removed = 0;\n\n  assert( sqlite3_mutex_notheld(pBt->mutex) );\n  MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )\n  sqlite3_mutex_enter(pMaster);\n  pBt->nRef--;\n  if( pBt->nRef<=0 ){\n    if( GLOBAL(BtShared*,sqlite3SharedCacheList)==pBt ){\n      GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt->pNext;\n    }else{\n      pList = GLOBAL(BtShared*,sqlite3SharedCacheList);\n      while( ALWAYS(pList) && pList->pNext!=pBt ){\n        pList=pList->pNext;\n      }\n      if( ALWAYS(pList) ){\n        pList->pNext = pBt->pNext;\n      }\n    }\n    if( SQLITE_THREADSAFE ){\n      sqlite3_mutex_free(pBt->mutex);\n    }\n    removed = 1;\n  }\n  sqlite3_mutex_leave(pMaster);\n  return removed;\n#else\n  return 1;\n#endif\n}\n\n/*\n** Make sure pBt->pTmpSpace points to an allocation of \n** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child\n** pointer.\n*/\nstatic void allocateTempSpace(BtShared *pBt){\n  if( !pBt->pTmpSpace ){\n    pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );\n\n    /* One of the uses of pBt->pTmpSpace is to format cells before\n    ** inserting them into a leaf page (function fillInCell()). If\n    ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes\n    ** by the various routines that manipulate binary cells. Which\n    ** can mean that fillInCell() only initializes the first 2 or 3\n    ** bytes of pTmpSpace, but that the first 4 bytes are copied from\n    ** it into a database page. This is not actually a problem, but it\n    ** does cause a valgrind error when the 1 or 2 bytes of unitialized \n    ** data is passed to system call write(). So to avoid this error,\n    ** zero the first 4 bytes of temp space here.\n    **\n    ** Also:  Provide four bytes of initialized space before the\n    ** beginning of pTmpSpace as an area available to prepend the\n    ** left-child pointer to the beginning of a cell.\n    */\n    if( pBt->pTmpSpace ){\n      memset(pBt->pTmpSpace, 0, 8);\n      pBt->pTmpSpace += 4;\n    }\n  }\n}\n\n/*\n** Free the pBt->pTmpSpace allocation\n*/\nstatic void freeTempSpace(BtShared *pBt){\n  if( pBt->pTmpSpace ){\n    pBt->pTmpSpace -= 4;\n    sqlite3PageFree(pBt->pTmpSpace);\n    pBt->pTmpSpace = 0;\n  }\n}\n\n/*\n** Close an open database and invalidate all cursors.\n*/\nint sqlite3BtreeClose(Btree *p){\n  BtShared *pBt = p->pBt;\n  BtCursor *pCur;\n\n  /* Close all cursors opened via this handle.  */\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  sqlite3BtreeEnter(p);\n  pCur = pBt->pCursor;\n  while( pCur ){\n    BtCursor *pTmp = pCur;\n    pCur = pCur->pNext;\n    if( pTmp->pBtree==p ){\n      sqlite3BtreeCloseCursor(pTmp);\n    }\n  }\n\n  /* Rollback any active transaction and free the handle structure.\n  ** The call to sqlite3BtreeRollback() drops any table-locks held by\n  ** this handle.\n  */\n  sqlite3BtreeRollback(p, SQLITE_OK, 0);\n  sqlite3BtreeLeave(p);\n\n  /* If there are still other outstanding references to the shared-btree\n  ** structure, return now. The remainder of this procedure cleans \n  ** up the shared-btree.\n  */\n  assert( p->wantToLock==0 && p->locked==0 );\n  if( !p->sharable || removeFromSharingList(pBt) ){\n    /* The pBt is no longer on the sharing list, so we can access\n    ** it without having to hold the mutex.\n    **\n    ** Clean out and delete the BtShared object.\n    */\n    assert( !pBt->pCursor );\n    sqlite3PagerClose(pBt->pPager);\n    if( pBt->xFreeSchema && pBt->pSchema ){\n      pBt->xFreeSchema(pBt->pSchema);\n    }\n    sqlite3DbFree(0, pBt->pSchema);\n    freeTempSpace(pBt);\n    sqlite3_free(pBt);\n  }\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  assert( p->wantToLock==0 );\n  assert( p->locked==0 );\n  if( p->pPrev ) p->pPrev->pNext = p->pNext;\n  if( p->pNext ) p->pNext->pPrev = p->pPrev;\n#endif\n\n  sqlite3_free(p);\n  return SQLITE_OK;\n}\n\n/*\n** Change the \"soft\" limit on the number of pages in the cache.\n** Unused and unmodified pages will be recycled when the number of\n** pages in the cache exceeds this soft limit.  But the size of the\n** cache is allowed to grow larger than this limit if it contains\n** dirty pages or pages still in active use.\n*/\nint sqlite3BtreeSetCacheSize(Btree *p, int mxPage){\n  BtShared *pBt = p->pBt;\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  sqlite3BtreeEnter(p);\n  sqlite3PagerSetCachesize(pBt->pPager, mxPage);\n  sqlite3BtreeLeave(p);\n  return SQLITE_OK;\n}\n\n/*\n** Change the \"spill\" limit on the number of pages in the cache.\n** If the number of pages exceeds this limit during a write transaction,\n** the pager might attempt to \"spill\" pages to the journal early in\n** order to free up memory.\n**\n** The value returned is the current spill size.  If zero is passed\n** as an argument, no changes are made to the spill size setting, so\n** using mxPage of 0 is a way to query the current spill size.\n*/\nint sqlite3BtreeSetSpillSize(Btree *p, int mxPage){\n  BtShared *pBt = p->pBt;\n  int res;\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  sqlite3BtreeEnter(p);\n  res = sqlite3PagerSetSpillsize(pBt->pPager, mxPage);\n  sqlite3BtreeLeave(p);\n  return res;\n}\n\n#if SQLITE_MAX_MMAP_SIZE>0\n/*\n** Change the limit on the amount of the database file that may be\n** memory mapped.\n*/\nint sqlite3BtreeSetMmapLimit(Btree *p, sqlite3_int64 szMmap){\n  BtShared *pBt = p->pBt;\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  sqlite3BtreeEnter(p);\n  sqlite3PagerSetMmapLimit(pBt->pPager, szMmap);\n  sqlite3BtreeLeave(p);\n  return SQLITE_OK;\n}\n#endif /* SQLITE_MAX_MMAP_SIZE>0 */\n\n/*\n** Change the way data is synced to disk in order to increase or decrease\n** how well the database resists damage due to OS crashes and power\n** failures.  Level 1 is the same as asynchronous (no syncs() occur and\n** there is a high probability of damage)  Level 2 is the default.  There\n** is a very low but non-zero probability of damage.  Level 3 reduces the\n** probability of damage to near zero but with a write performance reduction.\n*/\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\nint sqlite3BtreeSetPagerFlags(\n  Btree *p,              /* The btree to set the safety level on */\n  unsigned pgFlags       /* Various PAGER_* flags */\n){\n  BtShared *pBt = p->pBt;\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  sqlite3BtreeEnter(p);\n  sqlite3PagerSetFlags(pBt->pPager, pgFlags);\n  sqlite3BtreeLeave(p);\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** Change the default pages size and the number of reserved bytes per page.\n** Or, if the page size has already been fixed, return SQLITE_READONLY \n** without changing anything.\n**\n** The page size must be a power of 2 between 512 and 65536.  If the page\n** size supplied does not meet this constraint then the page size is not\n** changed.\n**\n** Page sizes are constrained to be a power of two so that the region\n** of the database file used for locking (beginning at PENDING_BYTE,\n** the first byte past the 1GB boundary, 0x40000000) needs to occur\n** at the beginning of a page.\n**\n** If parameter nReserve is less than zero, then the number of reserved\n** bytes per page is left unchanged.\n**\n** If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size\n** and autovacuum mode can no longer be changed.\n*/\nint sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){\n  int rc = SQLITE_OK;\n  BtShared *pBt = p->pBt;\n  assert( nReserve>=-1 && nReserve<=255 );\n  sqlite3BtreeEnter(p);\n#if SQLITE_HAS_CODEC\n  if( nReserve>pBt->optimalReserve ) pBt->optimalReserve = (u8)nReserve;\n#endif\n  if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){\n    sqlite3BtreeLeave(p);\n    return SQLITE_READONLY;\n  }\n  if( nReserve<0 ){\n    nReserve = pBt->pageSize - pBt->usableSize;\n  }\n  assert( nReserve>=0 && nReserve<=255 );\n  if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&\n        ((pageSize-1)&pageSize)==0 ){\n    assert( (pageSize & 7)==0 );\n    assert( !pBt->pCursor );\n    pBt->pageSize = (u32)pageSize;\n    freeTempSpace(pBt);\n  }\n  rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);\n  pBt->usableSize = pBt->pageSize - (u16)nReserve;\n  if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED;\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** Return the currently defined page size\n*/\nint sqlite3BtreeGetPageSize(Btree *p){\n  return p->pBt->pageSize;\n}\n\n/*\n** This function is similar to sqlite3BtreeGetReserve(), except that it\n** may only be called if it is guaranteed that the b-tree mutex is already\n** held.\n**\n** This is useful in one special case in the backup API code where it is\n** known that the shared b-tree mutex is held, but the mutex on the \n** database handle that owns *p is not. In this case if sqlite3BtreeEnter()\n** were to be called, it might collide with some other operation on the\n** database handle that owns *p, causing undefined behavior.\n*/\nint sqlite3BtreeGetReserveNoMutex(Btree *p){\n  int n;\n  assert( sqlite3_mutex_held(p->pBt->mutex) );\n  n = p->pBt->pageSize - p->pBt->usableSize;\n  return n;\n}\n\n/*\n** Return the number of bytes of space at the end of every page that\n** are intentually left unused.  This is the \"reserved\" space that is\n** sometimes used by extensions.\n**\n** If SQLITE_HAS_MUTEX is defined then the number returned is the\n** greater of the current reserved space and the maximum requested\n** reserve space.\n*/\nint sqlite3BtreeGetOptimalReserve(Btree *p){\n  int n;\n  sqlite3BtreeEnter(p);\n  n = sqlite3BtreeGetReserveNoMutex(p);\n#ifdef SQLITE_HAS_CODEC\n  if( n<p->pBt->optimalReserve ) n = p->pBt->optimalReserve;\n#endif\n  sqlite3BtreeLeave(p);\n  return n;\n}\n\n\n/*\n** Set the maximum page count for a database if mxPage is positive.\n** No changes are made if mxPage is 0 or negative.\n** Regardless of the value of mxPage, return the maximum page count.\n*/\nint sqlite3BtreeMaxPageCount(Btree *p, int mxPage){\n  int n;\n  sqlite3BtreeEnter(p);\n  n = sqlite3PagerMaxPageCount(p->pBt->pPager, mxPage);\n  sqlite3BtreeLeave(p);\n  return n;\n}\n\n/*\n** Set the BTS_SECURE_DELETE flag if newFlag is 0 or 1.  If newFlag is -1,\n** then make no changes.  Always return the value of the BTS_SECURE_DELETE\n** setting after the change.\n*/\nint sqlite3BtreeSecureDelete(Btree *p, int newFlag){\n  int b;\n  if( p==0 ) return 0;\n  sqlite3BtreeEnter(p);\n  if( newFlag>=0 ){\n    p->pBt->btsFlags &= ~BTS_SECURE_DELETE;\n    if( newFlag ) p->pBt->btsFlags |= BTS_SECURE_DELETE;\n  } \n  b = (p->pBt->btsFlags & BTS_SECURE_DELETE)!=0;\n  sqlite3BtreeLeave(p);\n  return b;\n}\n\n/*\n** Change the 'auto-vacuum' property of the database. If the 'autoVacuum'\n** parameter is non-zero, then auto-vacuum mode is enabled. If zero, it\n** is disabled. The default value for the auto-vacuum property is \n** determined by the SQLITE_DEFAULT_AUTOVACUUM macro.\n*/\nint sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){\n#ifdef SQLITE_OMIT_AUTOVACUUM\n  return SQLITE_READONLY;\n#else\n  BtShared *pBt = p->pBt;\n  int rc = SQLITE_OK;\n  u8 av = (u8)autoVacuum;\n\n  sqlite3BtreeEnter(p);\n  if( (pBt->btsFlags & BTS_PAGESIZE_FIXED)!=0 && (av ?1:0)!=pBt->autoVacuum ){\n    rc = SQLITE_READONLY;\n  }else{\n    pBt->autoVacuum = av ?1:0;\n    pBt->incrVacuum = av==2 ?1:0;\n  }\n  sqlite3BtreeLeave(p);\n  return rc;\n#endif\n}\n\n/*\n** Return the value of the 'auto-vacuum' property. If auto-vacuum is \n** enabled 1 is returned. Otherwise 0.\n*/\nint sqlite3BtreeGetAutoVacuum(Btree *p){\n#ifdef SQLITE_OMIT_AUTOVACUUM\n  return BTREE_AUTOVACUUM_NONE;\n#else\n  int rc;\n  sqlite3BtreeEnter(p);\n  rc = (\n    (!p->pBt->autoVacuum)?BTREE_AUTOVACUUM_NONE:\n    (!p->pBt->incrVacuum)?BTREE_AUTOVACUUM_FULL:\n    BTREE_AUTOVACUUM_INCR\n  );\n  sqlite3BtreeLeave(p);\n  return rc;\n#endif\n}\n\n\n/*\n** Get a reference to pPage1 of the database file.  This will\n** also acquire a readlock on that file.\n**\n** SQLITE_OK is returned on success.  If the file is not a\n** well-formed database file, then SQLITE_CORRUPT is returned.\n** SQLITE_BUSY is returned if the database is locked.  SQLITE_NOMEM\n** is returned if we run out of memory. \n*/\nstatic int lockBtree(BtShared *pBt){\n  int rc;              /* Result code from subfunctions */\n  MemPage *pPage1;     /* Page 1 of the database file */\n  int nPage;           /* Number of pages in the database */\n  int nPageFile = 0;   /* Number of pages in the database file */\n  int nPageHeader;     /* Number of pages in the database according to hdr */\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( pBt->pPage1==0 );\n  rc = sqlite3PagerSharedLock(pBt->pPager);\n  if( rc!=SQLITE_OK ) return rc;\n  rc = btreeGetPage(pBt, 1, &pPage1, 0);\n  if( rc!=SQLITE_OK ) return rc;\n\n  /* Do some checking to help insure the file we opened really is\n  ** a valid database file. \n  */\n  nPage = nPageHeader = get4byte(28+(u8*)pPage1->aData);\n  sqlite3PagerPagecount(pBt->pPager, &nPageFile);\n  if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){\n    nPage = nPageFile;\n  }\n  if( nPage>0 ){\n    u32 pageSize;\n    u32 usableSize;\n    u8 *page1 = pPage1->aData;\n    rc = SQLITE_NOTADB;\n    /* EVIDENCE-OF: R-43737-39999 Every valid SQLite database file begins\n    ** with the following 16 bytes (in hex): 53 51 4c 69 74 65 20 66 6f 72 6d\n    ** 61 74 20 33 00. */\n    if( memcmp(page1, zMagicHeader, 16)!=0 ){\n      goto page1_init_failed;\n    }\n\n#ifdef SQLITE_OMIT_WAL\n    if( page1[18]>1 ){\n      pBt->btsFlags |= BTS_READ_ONLY;\n    }\n    if( page1[19]>1 ){\n      goto page1_init_failed;\n    }\n#else\n    if( page1[18]>2 ){\n      pBt->btsFlags |= BTS_READ_ONLY;\n    }\n    if( page1[19]>2 ){\n      goto page1_init_failed;\n    }\n\n    /* If the write version is set to 2, this database should be accessed\n    ** in WAL mode. If the log is not already open, open it now. Then \n    ** return SQLITE_OK and return without populating BtShared.pPage1.\n    ** The caller detects this and calls this function again. This is\n    ** required as the version of page 1 currently in the page1 buffer\n    ** may not be the latest version - there may be a newer one in the log\n    ** file.\n    */\n    if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){\n      int isOpen = 0;\n      rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen);\n      if( rc!=SQLITE_OK ){\n        goto page1_init_failed;\n      }else{\n#if SQLITE_DEFAULT_SYNCHRONOUS!=SQLITE_DEFAULT_WAL_SYNCHRONOUS\n        sqlite3 *db;\n        Db *pDb;\n        if( (db=pBt->db)!=0 && (pDb=db->aDb)!=0 ){\n          while( pDb->pBt==0 || pDb->pBt->pBt!=pBt ){ pDb++; }\n          if( pDb->bSyncSet==0\n           && pDb->safety_level==SQLITE_DEFAULT_SYNCHRONOUS+1\n          ){\n            pDb->safety_level = SQLITE_DEFAULT_WAL_SYNCHRONOUS+1;\n            sqlite3PagerSetFlags(pBt->pPager,\n               pDb->safety_level | (db->flags & PAGER_FLAGS_MASK));\n          }\n        }\n#endif\n        if( isOpen==0 ){\n          releasePage(pPage1);\n          return SQLITE_OK;\n        }\n      }\n      rc = SQLITE_NOTADB;\n    }\n#endif\n\n    /* EVIDENCE-OF: R-15465-20813 The maximum and minimum embedded payload\n    ** fractions and the leaf payload fraction values must be 64, 32, and 32.\n    **\n    ** The original design allowed these amounts to vary, but as of\n    ** version 3.6.0, we require them to be fixed.\n    */\n    if( memcmp(&page1[21], \"\\100\\040\\040\",3)!=0 ){\n      goto page1_init_failed;\n    }\n    /* EVIDENCE-OF: R-51873-39618 The page size for a database file is\n    ** determined by the 2-byte integer located at an offset of 16 bytes from\n    ** the beginning of the database file. */\n    pageSize = (page1[16]<<8) | (page1[17]<<16);\n    /* EVIDENCE-OF: R-25008-21688 The size of a page is a power of two\n    ** between 512 and 65536 inclusive. */\n    if( ((pageSize-1)&pageSize)!=0\n     || pageSize>SQLITE_MAX_PAGE_SIZE \n     || pageSize<=256 \n    ){\n      goto page1_init_failed;\n    }\n    assert( (pageSize & 7)==0 );\n    /* EVIDENCE-OF: R-59310-51205 The \"reserved space\" size in the 1-byte\n    ** integer at offset 20 is the number of bytes of space at the end of\n    ** each page to reserve for extensions. \n    **\n    ** EVIDENCE-OF: R-37497-42412 The size of the reserved region is\n    ** determined by the one-byte unsigned integer found at an offset of 20\n    ** into the database file header. */\n    usableSize = pageSize - page1[20];\n    if( (u32)pageSize!=pBt->pageSize ){\n      /* After reading the first page of the database assuming a page size\n      ** of BtShared.pageSize, we have discovered that the page-size is\n      ** actually pageSize. Unlock the database, leave pBt->pPage1 at\n      ** zero and return SQLITE_OK. The caller will call this function\n      ** again with the correct page-size.\n      */\n      releasePage(pPage1);\n      pBt->usableSize = usableSize;\n      pBt->pageSize = pageSize;\n      freeTempSpace(pBt);\n      rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize,\n                                   pageSize-usableSize);\n      return rc;\n    }\n    if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){\n      rc = SQLITE_CORRUPT_BKPT;\n      goto page1_init_failed;\n    }\n    /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to\n    ** be less than 480. In other words, if the page size is 512, then the\n    ** reserved space size cannot exceed 32. */\n    if( usableSize<480 ){\n      goto page1_init_failed;\n    }\n    pBt->pageSize = pageSize;\n    pBt->usableSize = usableSize;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);\n    pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0);\n#endif\n  }\n\n  /* maxLocal is the maximum amount of payload to store locally for\n  ** a cell.  Make sure it is small enough so that at least minFanout\n  ** cells can will fit on one page.  We assume a 10-byte page header.\n  ** Besides the payload, the cell must store:\n  **     2-byte pointer to the cell\n  **     4-byte child pointer\n  **     9-byte nKey value\n  **     4-byte nData value\n  **     4-byte overflow page pointer\n  ** So a cell consists of a 2-byte pointer, a header which is as much as\n  ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow\n  ** page pointer.\n  */\n  pBt->maxLocal = (u16)((pBt->usableSize-12)*64/255 - 23);\n  pBt->minLocal = (u16)((pBt->usableSize-12)*32/255 - 23);\n  pBt->maxLeaf = (u16)(pBt->usableSize - 35);\n  pBt->minLeaf = (u16)((pBt->usableSize-12)*32/255 - 23);\n  if( pBt->maxLocal>127 ){\n    pBt->max1bytePayload = 127;\n  }else{\n    pBt->max1bytePayload = (u8)pBt->maxLocal;\n  }\n  assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );\n  pBt->pPage1 = pPage1;\n  pBt->nPage = nPage;\n  return SQLITE_OK;\n\npage1_init_failed:\n  releasePage(pPage1);\n  pBt->pPage1 = 0;\n  return rc;\n}\n\n#ifndef NDEBUG\n/*\n** Return the number of cursors open on pBt. This is for use\n** in assert() expressions, so it is only compiled if NDEBUG is not\n** defined.\n**\n** Only write cursors are counted if wrOnly is true.  If wrOnly is\n** false then all cursors are counted.\n**\n** For the purposes of this routine, a cursor is any cursor that\n** is capable of reading or writing to the database.  Cursors that\n** have been tripped into the CURSOR_FAULT state are not counted.\n*/\nstatic int countValidCursors(BtShared *pBt, int wrOnly){\n  BtCursor *pCur;\n  int r = 0;\n  for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){\n    if( (wrOnly==0 || (pCur->curFlags & BTCF_WriteFlag)!=0)\n     && pCur->eState!=CURSOR_FAULT ) r++; \n  }\n  return r;\n}\n#endif\n\n/*\n** If there are no outstanding cursors and we are not in the middle\n** of a transaction but there is a read lock on the database, then\n** this routine unrefs the first page of the database file which \n** has the effect of releasing the read lock.\n**\n** If there is a transaction in progress, this routine is a no-op.\n*/\nstatic void unlockBtreeIfUnused(BtShared *pBt){\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( countValidCursors(pBt,0)==0 || pBt->inTransaction>TRANS_NONE );\n  if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){\n    MemPage *pPage1 = pBt->pPage1;\n    assert( pPage1->aData );\n    assert( sqlite3PagerRefcount(pBt->pPager)==1 );\n    pBt->pPage1 = 0;\n    releasePageNotNull(pPage1);\n  }\n}\n\n/*\n** If pBt points to an empty file then convert that empty file\n** into a new empty database by initializing the first page of\n** the database.\n*/\nstatic int newDatabase(BtShared *pBt){\n  MemPage *pP1;\n  unsigned char *data;\n  int rc;\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  if( pBt->nPage>0 ){\n    return SQLITE_OK;\n  }\n  pP1 = pBt->pPage1;\n  assert( pP1!=0 );\n  data = pP1->aData;\n  rc = sqlite3PagerWrite(pP1->pDbPage);\n  if( rc ) return rc;\n  memcpy(data, zMagicHeader, sizeof(zMagicHeader));\n  assert( sizeof(zMagicHeader)==16 );\n  data[16] = (u8)((pBt->pageSize>>8)&0xff);\n  data[17] = (u8)((pBt->pageSize>>16)&0xff);\n  data[18] = 1;\n  data[19] = 1;\n  assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);\n  data[20] = (u8)(pBt->pageSize - pBt->usableSize);\n  data[21] = 64;\n  data[22] = 32;\n  data[23] = 32;\n  memset(&data[24], 0, 100-24);\n  zeroPage(pP1, PTF_INTKEY|PTF_LEAF|PTF_LEAFDATA );\n  pBt->btsFlags |= BTS_PAGESIZE_FIXED;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  assert( pBt->autoVacuum==1 || pBt->autoVacuum==0 );\n  assert( pBt->incrVacuum==1 || pBt->incrVacuum==0 );\n  put4byte(&data[36 + 4*4], pBt->autoVacuum);\n  put4byte(&data[36 + 7*4], pBt->incrVacuum);\n#endif\n  pBt->nPage = 1;\n  data[31] = 1;\n  return SQLITE_OK;\n}\n\n/*\n** Initialize the first page of the database file (creating a database\n** consisting of a single page and no schema objects). Return SQLITE_OK\n** if successful, or an SQLite error code otherwise.\n*/\nint sqlite3BtreeNewDb(Btree *p){\n  int rc;\n  sqlite3BtreeEnter(p);\n  p->pBt->nPage = 0;\n  rc = newDatabase(p->pBt);\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** Attempt to start a new transaction. A write-transaction\n** is started if the second argument is nonzero, otherwise a read-\n** transaction.  If the second argument is 2 or more and exclusive\n** transaction is started, meaning that no other process is allowed\n** to access the database.  A preexisting transaction may not be\n** upgraded to exclusive by calling this routine a second time - the\n** exclusivity flag only works for a new transaction.\n**\n** A write-transaction must be started before attempting any \n** changes to the database.  None of the following routines \n** will work unless a transaction is started first:\n**\n**      sqlite3BtreeCreateTable()\n**      sqlite3BtreeCreateIndex()\n**      sqlite3BtreeClearTable()\n**      sqlite3BtreeDropTable()\n**      sqlite3BtreeInsert()\n**      sqlite3BtreeDelete()\n**      sqlite3BtreeUpdateMeta()\n**\n** If an initial attempt to acquire the lock fails because of lock contention\n** and the database was previously unlocked, then invoke the busy handler\n** if there is one.  But if there was previously a read-lock, do not\n** invoke the busy handler - just return SQLITE_BUSY.  SQLITE_BUSY is \n** returned when there is already a read-lock in order to avoid a deadlock.\n**\n** Suppose there are two processes A and B.  A has a read lock and B has\n** a reserved lock.  B tries to promote to exclusive but is blocked because\n** of A's read lock.  A tries to promote to reserved but is blocked by B.\n** One or the other of the two processes must give way or there can be\n** no progress.  By returning SQLITE_BUSY and not invoking the busy callback\n** when A already has a read lock, we encourage A to give up and let B\n** proceed.\n*/\nint sqlite3BtreeBeginTrans(Btree *p, int wrflag){\n  BtShared *pBt = p->pBt;\n  int rc = SQLITE_OK;\n\n  sqlite3BtreeEnter(p);\n  btreeIntegrity(p);\n\n  /* If the btree is already in a write-transaction, or it\n  ** is already in a read-transaction and a read-transaction\n  ** is requested, this is a no-op.\n  */\n  if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){\n    goto trans_begun;\n  }\n  assert( pBt->inTransaction==TRANS_WRITE || IfNotOmitAV(pBt->bDoTruncate)==0 );\n\n  /* Write transactions are not possible on a read-only database */\n  if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){\n    rc = SQLITE_READONLY;\n    goto trans_begun;\n  }\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  {\n    sqlite3 *pBlock = 0;\n    /* If another database handle has already opened a write transaction \n    ** on this shared-btree structure and a second write transaction is\n    ** requested, return SQLITE_LOCKED.\n    */\n    if( (wrflag && pBt->inTransaction==TRANS_WRITE)\n     || (pBt->btsFlags & BTS_PENDING)!=0\n    ){\n      pBlock = pBt->pWriter->db;\n    }else if( wrflag>1 ){\n      BtLock *pIter;\n      for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){\n        if( pIter->pBtree!=p ){\n          pBlock = pIter->pBtree->db;\n          break;\n        }\n      }\n    }\n    if( pBlock ){\n      sqlite3ConnectionBlocked(p->db, pBlock);\n      rc = SQLITE_LOCKED_SHAREDCACHE;\n      goto trans_begun;\n    }\n  }\n#endif\n\n  /* Any read-only or read-write transaction implies a read-lock on \n  ** page 1. So if some other shared-cache client already has a write-lock \n  ** on page 1, the transaction cannot be opened. */\n  rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK);\n  if( SQLITE_OK!=rc ) goto trans_begun;\n\n  pBt->btsFlags &= ~BTS_INITIALLY_EMPTY;\n  if( pBt->nPage==0 ) pBt->btsFlags |= BTS_INITIALLY_EMPTY;\n#if SQLITE_WCDB_SIGNAL_RETRY\n  WCDBPagerSetWait(pBt->pPager, 1);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n  do {\n    /* Call lockBtree() until either pBt->pPage1 is populated or\n    ** lockBtree() returns something other than SQLITE_OK. lockBtree()\n    ** may return SQLITE_OK but leave pBt->pPage1 set to 0 if after\n    ** reading page 1 it discovers that the page-size of the database \n    ** file is not pBt->pageSize. In this case lockBtree() will update\n    ** pBt->pageSize to the page-size of the file on disk.\n    */\n    while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) );\n\n    if( rc==SQLITE_OK && wrflag ){\n      if( (pBt->btsFlags & BTS_READ_ONLY)!=0 ){\n        rc = SQLITE_READONLY;\n      }else{\n        rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db));\n        if( rc==SQLITE_OK ){\n          rc = newDatabase(pBt);\n        }\n      }\n    }\n  \n    if( rc!=SQLITE_OK ){\n      unlockBtreeIfUnused(pBt);\n    }\n  }while( (rc&0xFF)==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE &&\n          btreeInvokeBusyHandler(pBt) );\n  \n#if SQLITE_WCDB_SIGNAL_RETRY\n  WCDBPagerSetWait(pBt->pPager, 0);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n  if( rc==SQLITE_OK ){\n    if( p->inTrans==TRANS_NONE ){\n      pBt->nTransaction++;\n#ifndef SQLITE_OMIT_SHARED_CACHE\n      if( p->sharable ){\n        assert( p->lock.pBtree==p && p->lock.iTable==1 );\n        p->lock.eLock = READ_LOCK;\n        p->lock.pNext = pBt->pLock;\n        pBt->pLock = &p->lock;\n      }\n#endif\n    }\n    p->inTrans = (wrflag?TRANS_WRITE:TRANS_READ);\n    if( p->inTrans>pBt->inTransaction ){\n      pBt->inTransaction = p->inTrans;\n    }\n    if( wrflag ){\n      MemPage *pPage1 = pBt->pPage1;\n#ifndef SQLITE_OMIT_SHARED_CACHE\n      assert( !pBt->pWriter );\n      pBt->pWriter = p;\n      pBt->btsFlags &= ~BTS_EXCLUSIVE;\n      if( wrflag>1 ) pBt->btsFlags |= BTS_EXCLUSIVE;\n#endif\n\n      /* If the db-size header field is incorrect (as it may be if an old\n      ** client has been writing the database file), update it now. Doing\n      ** this sooner rather than later means the database size can safely \n      ** re-read the database size from page 1 if a savepoint or transaction\n      ** rollback occurs within the transaction.\n      */\n      if( pBt->nPage!=get4byte(&pPage1->aData[28]) ){\n        rc = sqlite3PagerWrite(pPage1->pDbPage);\n        if( rc==SQLITE_OK ){\n          put4byte(&pPage1->aData[28], pBt->nPage);\n        }\n      }\n    }\n  }\n\n\ntrans_begun:\n  if( rc==SQLITE_OK && wrflag ){\n    /* This call makes sure that the pager has the correct number of\n    ** open savepoints. If the second parameter is greater than 0 and\n    ** the sub-journal is not already open, then it will be opened here.\n    */\n    rc = sqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint);\n  }\n\n  btreeIntegrity(p);\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n\n/*\n** Set the pointer-map entries for all children of page pPage. Also, if\n** pPage contains cells that point to overflow pages, set the pointer\n** map entries for the overflow pages as well.\n*/\nstatic int setChildPtrmaps(MemPage *pPage){\n  int i;                             /* Counter variable */\n  int nCell;                         /* Number of cells in page pPage */\n  int rc;                            /* Return code */\n  BtShared *pBt = pPage->pBt;\n  u8 isInitOrig = pPage->isInit;\n  Pgno pgno = pPage->pgno;\n\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  rc = btreeInitPage(pPage);\n  if( rc!=SQLITE_OK ){\n    goto set_child_ptrmaps_out;\n  }\n  nCell = pPage->nCell;\n\n  for(i=0; i<nCell; i++){\n    u8 *pCell = findCell(pPage, i);\n\n    ptrmapPutOvflPtr(pPage, pCell, &rc);\n\n    if( !pPage->leaf ){\n      Pgno childPgno = get4byte(pCell);\n      ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);\n    }\n  }\n\n  if( !pPage->leaf ){\n    Pgno childPgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);\n    ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc);\n  }\n\nset_child_ptrmaps_out:\n  pPage->isInit = isInitOrig;\n  return rc;\n}\n\n/*\n** Somewhere on pPage is a pointer to page iFrom.  Modify this pointer so\n** that it points to iTo. Parameter eType describes the type of pointer to\n** be modified, as  follows:\n**\n** PTRMAP_BTREE:     pPage is a btree-page. The pointer points at a child \n**                   page of pPage.\n**\n** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow\n**                   page pointed to by one of the cells on pPage.\n**\n** PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next\n**                   overflow page in the list.\n*/\nstatic int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n  if( eType==PTRMAP_OVERFLOW2 ){\n    /* The pointer is always the first 4 bytes of the page in this case.  */\n    if( get4byte(pPage->aData)!=iFrom ){\n      return SQLITE_CORRUPT_BKPT;\n    }\n    put4byte(pPage->aData, iTo);\n  }else{\n    u8 isInitOrig = pPage->isInit;\n    int i;\n    int nCell;\n    int rc;\n\n    rc = btreeInitPage(pPage);\n    if( rc ) return rc;\n    nCell = pPage->nCell;\n\n    for(i=0; i<nCell; i++){\n      u8 *pCell = findCell(pPage, i);\n      if( eType==PTRMAP_OVERFLOW1 ){\n        CellInfo info;\n        pPage->xParseCell(pPage, pCell, &info);\n        if( info.nLocal<info.nPayload\n         && pCell+info.nSize-1<=pPage->aData+pPage->maskPage\n         && iFrom==get4byte(pCell+info.nSize-4)\n        ){\n          put4byte(pCell+info.nSize-4, iTo);\n          break;\n        }\n      }else{\n        if( get4byte(pCell)==iFrom ){\n          put4byte(pCell, iTo);\n          break;\n        }\n      }\n    }\n  \n    if( i==nCell ){\n      if( eType!=PTRMAP_BTREE || \n          get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){\n        return SQLITE_CORRUPT_BKPT;\n      }\n      put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);\n    }\n\n    pPage->isInit = isInitOrig;\n  }\n  return SQLITE_OK;\n}\n\n\n/*\n** Move the open database page pDbPage to location iFreePage in the \n** database. The pDbPage reference remains valid.\n**\n** The isCommit flag indicates that there is no need to remember that\n** the journal needs to be sync()ed before database page pDbPage->pgno \n** can be written to. The caller has already promised not to write to that\n** page.\n*/\nstatic int relocatePage(\n  BtShared *pBt,           /* Btree */\n  MemPage *pDbPage,        /* Open page to move */\n  u8 eType,                /* Pointer map 'type' entry for pDbPage */\n  Pgno iPtrPage,           /* Pointer map 'page-no' entry for pDbPage */\n  Pgno iFreePage,          /* The location to move pDbPage to */\n  int isCommit             /* isCommit flag passed to sqlite3PagerMovepage */\n){\n  MemPage *pPtrPage;   /* The page that contains a pointer to pDbPage */\n  Pgno iDbPage = pDbPage->pgno;\n  Pager *pPager = pBt->pPager;\n  int rc;\n\n  assert( eType==PTRMAP_OVERFLOW2 || eType==PTRMAP_OVERFLOW1 || \n      eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE );\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( pDbPage->pBt==pBt );\n\n  /* Move page iDbPage from its current location to page number iFreePage */\n  TRACE((\"AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\\n\", \n      iDbPage, iFreePage, iPtrPage, eType));\n  rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n  pDbPage->pgno = iFreePage;\n\n  /* If pDbPage was a btree-page, then it may have child pages and/or cells\n  ** that point to overflow pages. The pointer map entries for all these\n  ** pages need to be changed.\n  **\n  ** If pDbPage is an overflow page, then the first 4 bytes may store a\n  ** pointer to a subsequent overflow page. If this is the case, then\n  ** the pointer map needs to be updated for the subsequent overflow page.\n  */\n  if( eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ){\n    rc = setChildPtrmaps(pDbPage);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n  }else{\n    Pgno nextOvfl = get4byte(pDbPage->aData);\n    if( nextOvfl!=0 ){\n      ptrmapPut(pBt, nextOvfl, PTRMAP_OVERFLOW2, iFreePage, &rc);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n    }\n  }\n\n  /* Fix the database pointer on page iPtrPage that pointed at iDbPage so\n  ** that it points at iFreePage. Also fix the pointer map entry for\n  ** iPtrPage.\n  */\n  if( eType!=PTRMAP_ROOTPAGE ){\n    rc = btreeGetPage(pBt, iPtrPage, &pPtrPage, 0);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    rc = sqlite3PagerWrite(pPtrPage->pDbPage);\n    if( rc!=SQLITE_OK ){\n      releasePage(pPtrPage);\n      return rc;\n    }\n    rc = modifyPagePointer(pPtrPage, iDbPage, iFreePage, eType);\n    releasePage(pPtrPage);\n    if( rc==SQLITE_OK ){\n      ptrmapPut(pBt, iFreePage, eType, iPtrPage, &rc);\n    }\n  }\n  return rc;\n}\n\n/* Forward declaration required by incrVacuumStep(). */\nstatic int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);\n\n/*\n** Perform a single step of an incremental-vacuum. If successful, return\n** SQLITE_OK. If there is no work to do (and therefore no point in \n** calling this function again), return SQLITE_DONE. Or, if an error \n** occurs, return some other error code.\n**\n** More specifically, this function attempts to re-organize the database so \n** that the last page of the file currently in use is no longer in use.\n**\n** Parameter nFin is the number of pages that this database would contain\n** were this function called until it returns SQLITE_DONE.\n**\n** If the bCommit parameter is non-zero, this function assumes that the \n** caller will keep calling incrVacuumStep() until it returns SQLITE_DONE \n** or an error. bCommit is passed true for an auto-vacuum-on-commit \n** operation, or false for an incremental vacuum.\n*/\nstatic int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg, int bCommit){\n  Pgno nFreeList;           /* Number of pages still on the free-list */\n  int rc;\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( iLastPg>nFin );\n\n  if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){\n    u8 eType;\n    Pgno iPtrPage;\n\n    nFreeList = get4byte(&pBt->pPage1->aData[36]);\n    if( nFreeList==0 ){\n      return SQLITE_DONE;\n    }\n\n    rc = ptrmapGet(pBt, iLastPg, &eType, &iPtrPage);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    if( eType==PTRMAP_ROOTPAGE ){\n      return SQLITE_CORRUPT_BKPT;\n    }\n\n    if( eType==PTRMAP_FREEPAGE ){\n      if( bCommit==0 ){\n        /* Remove the page from the files free-list. This is not required\n        ** if bCommit is non-zero. In that case, the free-list will be\n        ** truncated to zero after this function returns, so it doesn't \n        ** matter if it still contains some garbage entries.\n        */\n        Pgno iFreePg;\n        MemPage *pFreePg;\n        rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iLastPg, BTALLOC_EXACT);\n        if( rc!=SQLITE_OK ){\n          return rc;\n        }\n        assert( iFreePg==iLastPg );\n        releasePage(pFreePg);\n      }\n    } else {\n      Pgno iFreePg;             /* Index of free page to move pLastPg to */\n      MemPage *pLastPg;\n      u8 eMode = BTALLOC_ANY;   /* Mode parameter for allocateBtreePage() */\n      Pgno iNear = 0;           /* nearby parameter for allocateBtreePage() */\n\n      rc = btreeGetPage(pBt, iLastPg, &pLastPg, 0);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n\n      /* If bCommit is zero, this loop runs exactly once and page pLastPg\n      ** is swapped with the first free page pulled off the free list.\n      **\n      ** On the other hand, if bCommit is greater than zero, then keep\n      ** looping until a free-page located within the first nFin pages\n      ** of the file is found.\n      */\n      if( bCommit==0 ){\n        eMode = BTALLOC_LE;\n        iNear = nFin;\n      }\n      do {\n        MemPage *pFreePg;\n        rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iNear, eMode);\n        if( rc!=SQLITE_OK ){\n          releasePage(pLastPg);\n          return rc;\n        }\n        releasePage(pFreePg);\n      }while( bCommit && iFreePg>nFin );\n      assert( iFreePg<iLastPg );\n      \n      rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, bCommit);\n      releasePage(pLastPg);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n    }\n  }\n\n  if( bCommit==0 ){\n    do {\n      iLastPg--;\n    }while( iLastPg==PENDING_BYTE_PAGE(pBt) || PTRMAP_ISPAGE(pBt, iLastPg) );\n    pBt->bDoTruncate = 1;\n    pBt->nPage = iLastPg;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** The database opened by the first argument is an auto-vacuum database\n** nOrig pages in size containing nFree free pages. Return the expected \n** size of the database in pages following an auto-vacuum operation.\n*/\nstatic Pgno finalDbSize(BtShared *pBt, Pgno nOrig, Pgno nFree){\n  int nEntry;                     /* Number of entries on one ptrmap page */\n  Pgno nPtrmap;                   /* Number of PtrMap pages to be freed */\n  Pgno nFin;                      /* Return value */\n\n  nEntry = pBt->usableSize/5;\n  nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+nEntry)/nEntry;\n  nFin = nOrig - nFree - nPtrmap;\n  if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin<PENDING_BYTE_PAGE(pBt) ){\n    nFin--;\n  }\n  while( PTRMAP_ISPAGE(pBt, nFin) || nFin==PENDING_BYTE_PAGE(pBt) ){\n    nFin--;\n  }\n\n  return nFin;\n}\n\n/*\n** A write-transaction must be opened before calling this function.\n** It performs a single unit of work towards an incremental vacuum.\n**\n** If the incremental vacuum is finished after this function has run,\n** SQLITE_DONE is returned. If it is not finished, but no error occurred,\n** SQLITE_OK is returned. Otherwise an SQLite error code. \n*/\nint sqlite3BtreeIncrVacuum(Btree *p){\n  int rc;\n  BtShared *pBt = p->pBt;\n\n  sqlite3BtreeEnter(p);\n  assert( pBt->inTransaction==TRANS_WRITE && p->inTrans==TRANS_WRITE );\n  if( !pBt->autoVacuum ){\n    rc = SQLITE_DONE;\n  }else{\n    Pgno nOrig = btreePagecount(pBt);\n    Pgno nFree = get4byte(&pBt->pPage1->aData[36]);\n    Pgno nFin = finalDbSize(pBt, nOrig, nFree);\n\n    if( nOrig<nFin ){\n      rc = SQLITE_CORRUPT_BKPT;\n    }else if( nFree>0 ){\n      rc = saveAllCursors(pBt, 0, 0);\n      if( rc==SQLITE_OK ){\n        invalidateAllOverflowCache(pBt);\n        rc = incrVacuumStep(pBt, nFin, nOrig, 0);\n      }\n      if( rc==SQLITE_OK ){\n        rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\n        put4byte(&pBt->pPage1->aData[28], pBt->nPage);\n      }\n    }else{\n      rc = SQLITE_DONE;\n    }\n  }\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** This routine is called prior to sqlite3PagerCommit when a transaction\n** is committed for an auto-vacuum database.\n**\n** If SQLITE_OK is returned, then *pnTrunc is set to the number of pages\n** the database file should be truncated to during the commit process. \n** i.e. the database has been reorganized so that only the first *pnTrunc\n** pages are in use.\n*/\nstatic int autoVacuumCommit(BtShared *pBt){\n  int rc = SQLITE_OK;\n  Pager *pPager = pBt->pPager;\n  VVA_ONLY( int nRef = sqlite3PagerRefcount(pPager); )\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  invalidateAllOverflowCache(pBt);\n  assert(pBt->autoVacuum);\n  if( !pBt->incrVacuum ){\n    Pgno nFin;         /* Number of pages in database after autovacuuming */\n    Pgno nFree;        /* Number of pages on the freelist initially */\n    Pgno iFree;        /* The next page to be freed */\n    Pgno nOrig;        /* Database size before freeing */\n\n    nOrig = btreePagecount(pBt);\n    if( PTRMAP_ISPAGE(pBt, nOrig) || nOrig==PENDING_BYTE_PAGE(pBt) ){\n      /* It is not possible to create a database for which the final page\n      ** is either a pointer-map page or the pending-byte page. If one\n      ** is encountered, this indicates corruption.\n      */\n      return SQLITE_CORRUPT_BKPT;\n    }\n\n    nFree = get4byte(&pBt->pPage1->aData[36]);\n    nFin = finalDbSize(pBt, nOrig, nFree);\n    if( nFin>nOrig ) return SQLITE_CORRUPT_BKPT;\n    if( nFin<nOrig ){\n      rc = saveAllCursors(pBt, 0, 0);\n    }\n    for(iFree=nOrig; iFree>nFin && rc==SQLITE_OK; iFree--){\n      rc = incrVacuumStep(pBt, nFin, iFree, 1);\n    }\n    if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){\n      rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\n      put4byte(&pBt->pPage1->aData[32], 0);\n      put4byte(&pBt->pPage1->aData[36], 0);\n      put4byte(&pBt->pPage1->aData[28], nFin);\n      pBt->bDoTruncate = 1;\n      pBt->nPage = nFin;\n    }\n    if( rc!=SQLITE_OK ){\n      sqlite3PagerRollback(pPager);\n    }\n  }\n\n  assert( nRef>=sqlite3PagerRefcount(pPager) );\n  return rc;\n}\n\n#else /* ifndef SQLITE_OMIT_AUTOVACUUM */\n# define setChildPtrmaps(x) SQLITE_OK\n#endif\n\n/*\n** This routine does the first phase of a two-phase commit.  This routine\n** causes a rollback journal to be created (if it does not already exist)\n** and populated with enough information so that if a power loss occurs\n** the database can be restored to its original state by playing back\n** the journal.  Then the contents of the journal are flushed out to\n** the disk.  After the journal is safely on oxide, the changes to the\n** database are written into the database file and flushed to oxide.\n** At the end of this call, the rollback journal still exists on the\n** disk and we are still holding all locks, so the transaction has not\n** committed.  See sqlite3BtreeCommitPhaseTwo() for the second phase of the\n** commit process.\n**\n** This call is a no-op if no write-transaction is currently active on pBt.\n**\n** Otherwise, sync the database file for the btree pBt. zMaster points to\n** the name of a master journal file that should be written into the\n** individual journal file, or is NULL, indicating no master journal file \n** (single database transaction).\n**\n** When this is called, the master journal should already have been\n** created, populated with this journal pointer and synced to disk.\n**\n** Once this is routine has returned, the only thing required to commit\n** the write-transaction for this database file is to delete the journal.\n*/\nint sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){\n  int rc = SQLITE_OK;\n  if( p->inTrans==TRANS_WRITE ){\n    BtShared *pBt = p->pBt;\n    sqlite3BtreeEnter(p);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( pBt->autoVacuum ){\n      rc = autoVacuumCommit(pBt);\n      if( rc!=SQLITE_OK ){\n        sqlite3BtreeLeave(p);\n        return rc;\n      }\n    }\n    if( pBt->bDoTruncate ){\n      sqlite3PagerTruncateImage(pBt->pPager, pBt->nPage);\n    }\n#endif\n    rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zMaster, 0);\n    sqlite3BtreeLeave(p);\n  }\n  return rc;\n}\n\n/*\n** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()\n** at the conclusion of a transaction.\n*/\nstatic void btreeEndTransaction(Btree *p){\n  BtShared *pBt = p->pBt;\n  sqlite3 *db = p->db;\n  assert( sqlite3BtreeHoldsMutex(p) );\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  pBt->bDoTruncate = 0;\n#endif\n  if( p->inTrans>TRANS_NONE && db->nVdbeRead>1 ){\n    /* If there are other active statements that belong to this database\n    ** handle, downgrade to a read-only transaction. The other statements\n    ** may still be reading from the database.  */\n    downgradeAllSharedCacheTableLocks(p);\n    p->inTrans = TRANS_READ;\n  }else{\n    /* If the handle had any kind of transaction open, decrement the \n    ** transaction count of the shared btree. If the transaction count \n    ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused()\n    ** call below will unlock the pager.  */\n    if( p->inTrans!=TRANS_NONE ){\n      clearAllSharedCacheTableLocks(p);\n      pBt->nTransaction--;\n      if( 0==pBt->nTransaction ){\n        pBt->inTransaction = TRANS_NONE;\n      }\n    }\n\n    /* Set the current transaction state to TRANS_NONE and unlock the \n    ** pager if this call closed the only read or write transaction.  */\n    p->inTrans = TRANS_NONE;\n    unlockBtreeIfUnused(pBt);\n  }\n\n  btreeIntegrity(p);\n}\n\n/*\n** Commit the transaction currently in progress.\n**\n** This routine implements the second phase of a 2-phase commit.  The\n** sqlite3BtreeCommitPhaseOne() routine does the first phase and should\n** be invoked prior to calling this routine.  The sqlite3BtreeCommitPhaseOne()\n** routine did all the work of writing information out to disk and flushing the\n** contents so that they are written onto the disk platter.  All this\n** routine has to do is delete or truncate or zero the header in the\n** the rollback journal (which causes the transaction to commit) and\n** drop locks.\n**\n** Normally, if an error occurs while the pager layer is attempting to \n** finalize the underlying journal file, this function returns an error and\n** the upper layer will attempt a rollback. However, if the second argument\n** is non-zero then this b-tree transaction is part of a multi-file \n** transaction. In this case, the transaction has already been committed \n** (by deleting a master journal file) and the caller will ignore this \n** functions return code. So, even if an error occurs in the pager layer,\n** reset the b-tree objects internal state to indicate that the write\n** transaction has been closed. This is quite safe, as the pager will have\n** transitioned to the error state.\n**\n** This will release the write lock on the database file.  If there\n** are no active cursors, it also releases the read lock.\n*/\nint sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){\n\n  if( p->inTrans==TRANS_NONE ) return SQLITE_OK;\n  sqlite3BtreeEnter(p);\n  btreeIntegrity(p);\n\n  /* If the handle has a write-transaction open, commit the shared-btrees \n  ** transaction and set the shared state to TRANS_READ.\n  */\n  if( p->inTrans==TRANS_WRITE ){\n    int rc;\n    BtShared *pBt = p->pBt;\n    assert( pBt->inTransaction==TRANS_WRITE );\n    assert( pBt->nTransaction>0 );\n    rc = sqlite3PagerCommitPhaseTwo(pBt->pPager);\n    if( rc!=SQLITE_OK && bCleanup==0 ){\n      sqlite3BtreeLeave(p);\n      return rc;\n    }\n    p->iDataVersion--;  /* Compensate for pPager->iDataVersion++; */\n    pBt->inTransaction = TRANS_READ;\n    btreeClearHasContent(pBt);\n  }\n\n  btreeEndTransaction(p);\n  sqlite3BtreeLeave(p);\n  return SQLITE_OK;\n}\n\n/*\n** Do both phases of a commit.\n*/\nint sqlite3BtreeCommit(Btree *p){\n  int rc;\n  sqlite3BtreeEnter(p);\n  rc = sqlite3BtreeCommitPhaseOne(p, 0);\n  if( rc==SQLITE_OK ){\n    rc = sqlite3BtreeCommitPhaseTwo(p, 0);\n  }\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** This routine sets the state to CURSOR_FAULT and the error\n** code to errCode for every cursor on any BtShared that pBtree\n** references.  Or if the writeOnly flag is set to 1, then only\n** trip write cursors and leave read cursors unchanged.\n**\n** Every cursor is a candidate to be tripped, including cursors\n** that belong to other database connections that happen to be\n** sharing the cache with pBtree.\n**\n** This routine gets called when a rollback occurs. If the writeOnly\n** flag is true, then only write-cursors need be tripped - read-only\n** cursors save their current positions so that they may continue \n** following the rollback. Or, if writeOnly is false, all cursors are \n** tripped. In general, writeOnly is false if the transaction being\n** rolled back modified the database schema. In this case b-tree root\n** pages may be moved or deleted from the database altogether, making\n** it unsafe for read cursors to continue.\n**\n** If the writeOnly flag is true and an error is encountered while \n** saving the current position of a read-only cursor, all cursors, \n** including all read-cursors are tripped.\n**\n** SQLITE_OK is returned if successful, or if an error occurs while\n** saving a cursor position, an SQLite error code.\n*/\nint sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){\n  BtCursor *p;\n  int rc = SQLITE_OK;\n\n  assert( (writeOnly==0 || writeOnly==1) && BTCF_WriteFlag==1 );\n  if( pBtree ){\n    sqlite3BtreeEnter(pBtree);\n    for(p=pBtree->pBt->pCursor; p; p=p->pNext){\n      int i;\n      if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){\n        if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){\n          rc = saveCursorPosition(p);\n          if( rc!=SQLITE_OK ){\n            (void)sqlite3BtreeTripAllCursors(pBtree, rc, 0);\n            break;\n          }\n        }\n      }else{\n        sqlite3BtreeClearCursor(p);\n        p->eState = CURSOR_FAULT;\n        p->skipNext = errCode;\n      }\n      for(i=0; i<=p->iPage; i++){\n        releasePage(p->apPage[i]);\n        p->apPage[i] = 0;\n      }\n    }\n    sqlite3BtreeLeave(pBtree);\n  }\n  return rc;\n}\n\n/*\n** Rollback the transaction in progress.\n**\n** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).\n** Only write cursors are tripped if writeOnly is true but all cursors are\n** tripped if writeOnly is false.  Any attempt to use\n** a tripped cursor will result in an error.\n**\n** This will release the write lock on the database file.  If there\n** are no active cursors, it also releases the read lock.\n*/\nint sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){\n  int rc;\n  BtShared *pBt = p->pBt;\n  MemPage *pPage1;\n\n  assert( writeOnly==1 || writeOnly==0 );\n  assert( tripCode==SQLITE_ABORT_ROLLBACK || tripCode==SQLITE_OK );\n  sqlite3BtreeEnter(p);\n  if( tripCode==SQLITE_OK ){\n    rc = tripCode = saveAllCursors(pBt, 0, 0);\n    if( rc ) writeOnly = 0;\n  }else{\n    rc = SQLITE_OK;\n  }\n  if( tripCode ){\n    int rc2 = sqlite3BtreeTripAllCursors(p, tripCode, writeOnly);\n    assert( rc==SQLITE_OK || (writeOnly==0 && rc2==SQLITE_OK) );\n    if( rc2!=SQLITE_OK ) rc = rc2;\n  }\n  btreeIntegrity(p);\n\n  if( p->inTrans==TRANS_WRITE ){\n    int rc2;\n\n    assert( TRANS_WRITE==pBt->inTransaction );\n    rc2 = sqlite3PagerRollback(pBt->pPager);\n    if( rc2!=SQLITE_OK ){\n      rc = rc2;\n    }\n\n    /* The rollback may have destroyed the pPage1->aData value.  So\n    ** call btreeGetPage() on page 1 again to make\n    ** sure pPage1->aData is set correctly. */\n    if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){\n      int nPage = get4byte(28+(u8*)pPage1->aData);\n      testcase( nPage==0 );\n      if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);\n      testcase( pBt->nPage!=nPage );\n      pBt->nPage = nPage;\n      releasePage(pPage1);\n    }\n    assert( countValidCursors(pBt, 1)==0 );\n    pBt->inTransaction = TRANS_READ;\n    btreeClearHasContent(pBt);\n  }\n\n  btreeEndTransaction(p);\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** Start a statement subtransaction. The subtransaction can be rolled\n** back independently of the main transaction. You must start a transaction \n** before starting a subtransaction. The subtransaction is ended automatically \n** if the main transaction commits or rolls back.\n**\n** Statement subtransactions are used around individual SQL statements\n** that are contained within a BEGIN...COMMIT block.  If a constraint\n** error occurs within the statement, the effect of that one statement\n** can be rolled back without having to rollback the entire transaction.\n**\n** A statement sub-transaction is implemented as an anonymous savepoint. The\n** value passed as the second parameter is the total number of savepoints,\n** including the new anonymous savepoint, open on the B-Tree. i.e. if there\n** are no active savepoints and no other statement-transactions open,\n** iStatement is 1. This anonymous savepoint can be released or rolled back\n** using the sqlite3BtreeSavepoint() function.\n*/\nint sqlite3BtreeBeginStmt(Btree *p, int iStatement){\n  int rc;\n  BtShared *pBt = p->pBt;\n  sqlite3BtreeEnter(p);\n  assert( p->inTrans==TRANS_WRITE );\n  assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );\n  assert( iStatement>0 );\n  assert( iStatement>p->db->nSavepoint );\n  assert( pBt->inTransaction==TRANS_WRITE );\n  /* At the pager level, a statement transaction is a savepoint with\n  ** an index greater than all savepoints created explicitly using\n  ** SQL statements. It is illegal to open, release or rollback any\n  ** such savepoints while the statement transaction savepoint is active.\n  */\n  rc = sqlite3PagerOpenSavepoint(pBt->pPager, iStatement);\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** The second argument to this function, op, is always SAVEPOINT_ROLLBACK\n** or SAVEPOINT_RELEASE. This function either releases or rolls back the\n** savepoint identified by parameter iSavepoint, depending on the value \n** of op.\n**\n** Normally, iSavepoint is greater than or equal to zero. However, if op is\n** SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the \n** contents of the entire transaction are rolled back. This is different\n** from a normal transaction rollback, as no locks are released and the\n** transaction remains open.\n*/\nint sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){\n  int rc = SQLITE_OK;\n  if( p && p->inTrans==TRANS_WRITE ){\n    BtShared *pBt = p->pBt;\n    assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK );\n    assert( iSavepoint>=0 || (iSavepoint==-1 && op==SAVEPOINT_ROLLBACK) );\n    sqlite3BtreeEnter(p);\n    rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint);\n    if( rc==SQLITE_OK ){\n      if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){\n        pBt->nPage = 0;\n      }\n      rc = newDatabase(pBt);\n      pBt->nPage = get4byte(28 + pBt->pPage1->aData);\n\n      /* The database size was written into the offset 28 of the header\n      ** when the transaction started, so we know that the value at offset\n      ** 28 is nonzero. */\n      assert( pBt->nPage>0 );\n    }\n    sqlite3BtreeLeave(p);\n  }\n  return rc;\n}\n\n/*\n** Create a new cursor for the BTree whose root is on the page\n** iTable. If a read-only cursor is requested, it is assumed that\n** the caller already has at least a read-only transaction open\n** on the database already. If a write-cursor is requested, then\n** the caller is assumed to have an open write transaction.\n**\n** If the BTREE_WRCSR bit of wrFlag is clear, then the cursor can only\n** be used for reading.  If the BTREE_WRCSR bit is set, then the cursor\n** can be used for reading or for writing if other conditions for writing\n** are also met.  These are the conditions that must be met in order\n** for writing to be allowed:\n**\n** 1:  The cursor must have been opened with wrFlag containing BTREE_WRCSR\n**\n** 2:  Other database connections that share the same pager cache\n**     but which are not in the READ_UNCOMMITTED state may not have\n**     cursors open with wrFlag==0 on the same table.  Otherwise\n**     the changes made by this write cursor would be visible to\n**     the read cursors in the other database connection.\n**\n** 3:  The database must be writable (not on read-only media)\n**\n** 4:  There must be an active transaction.\n**\n** The BTREE_FORDELETE bit of wrFlag may optionally be set if BTREE_WRCSR\n** is set.  If FORDELETE is set, that is a hint to the implementation that\n** this cursor will only be used to seek to and delete entries of an index\n** as part of a larger DELETE statement.  The FORDELETE hint is not used by\n** this implementation.  But in a hypothetical alternative storage engine \n** in which index entries are automatically deleted when corresponding table\n** rows are deleted, the FORDELETE flag is a hint that all SEEK and DELETE\n** operations on this cursor can be no-ops and all READ operations can \n** return a null row (2-bytes: 0x01 0x00).\n**\n** No checking is done to make sure that page iTable really is the\n** root page of a b-tree.  If it is not, then the cursor acquired\n** will not work correctly.\n**\n** It is assumed that the sqlite3BtreeCursorZero() has been called\n** on pCur to initialize the memory space prior to invoking this routine.\n*/\nstatic int btreeCursor(\n  Btree *p,                              /* The btree */\n  int iTable,                            /* Root page of table to open */\n  int wrFlag,                            /* 1 to write. 0 read-only */\n  struct KeyInfo *pKeyInfo,              /* First arg to comparison function */\n  BtCursor *pCur                         /* Space for new cursor */\n){\n  BtShared *pBt = p->pBt;                /* Shared b-tree handle */\n  BtCursor *pX;                          /* Looping over other all cursors */\n\n  assert( sqlite3BtreeHoldsMutex(p) );\n  assert( wrFlag==0 \n       || wrFlag==BTREE_WRCSR \n       || wrFlag==(BTREE_WRCSR|BTREE_FORDELETE) \n  );\n\n  /* The following assert statements verify that if this is a sharable \n  ** b-tree database, the connection is holding the required table locks, \n  ** and that no other connection has any open cursor that conflicts with \n  ** this lock.  */\n  assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, (wrFlag?2:1)) );\n  assert( wrFlag==0 || !hasReadConflicts(p, iTable) );\n\n  /* Assert that the caller has opened the required transaction. */\n  assert( p->inTrans>TRANS_NONE );\n  assert( wrFlag==0 || p->inTrans==TRANS_WRITE );\n  assert( pBt->pPage1 && pBt->pPage1->aData );\n  assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 );\n\n  if( wrFlag ){\n    allocateTempSpace(pBt);\n    if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT;\n  }\n  if( iTable==1 && btreePagecount(pBt)==0 ){\n    assert( wrFlag==0 );\n    iTable = 0;\n  }\n\n  /* Now that no other errors can occur, finish filling in the BtCursor\n  ** variables and link the cursor into the BtShared list.  */\n  pCur->pgnoRoot = (Pgno)iTable;\n  pCur->iPage = -1;\n  pCur->pKeyInfo = pKeyInfo;\n  pCur->pBtree = p;\n  pCur->pBt = pBt;\n  pCur->curFlags = wrFlag ? BTCF_WriteFlag : 0;\n  pCur->curPagerFlags = wrFlag ? 0 : PAGER_GET_READONLY;\n  /* If there are two or more cursors on the same btree, then all such\n  ** cursors *must* have the BTCF_Multiple flag set. */\n  for(pX=pBt->pCursor; pX; pX=pX->pNext){\n    if( pX->pgnoRoot==(Pgno)iTable ){\n      pX->curFlags |= BTCF_Multiple;\n      pCur->curFlags |= BTCF_Multiple;\n    }\n  }\n  pCur->pNext = pBt->pCursor;\n  pBt->pCursor = pCur;\n  pCur->eState = CURSOR_INVALID;\n  return SQLITE_OK;\n}\nint sqlite3BtreeCursor(\n  Btree *p,                                   /* The btree */\n  int iTable,                                 /* Root page of table to open */\n  int wrFlag,                                 /* 1 to write. 0 read-only */\n  struct KeyInfo *pKeyInfo,                   /* First arg to xCompare() */\n  BtCursor *pCur                              /* Write new cursor here */\n){\n  int rc;\n  if( iTable<1 ){\n    rc = SQLITE_CORRUPT_BKPT;\n  }else{\n    sqlite3BtreeEnter(p);\n    rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur);\n    sqlite3BtreeLeave(p);\n  }\n  return rc;\n}\n\n/*\n** Return the size of a BtCursor object in bytes.\n**\n** This interfaces is needed so that users of cursors can preallocate\n** sufficient storage to hold a cursor.  The BtCursor object is opaque\n** to users so they cannot do the sizeof() themselves - they must call\n** this routine.\n*/\nint sqlite3BtreeCursorSize(void){\n  return ROUND8(sizeof(BtCursor));\n}\n\n/*\n** Initialize memory that will be converted into a BtCursor object.\n**\n** The simple approach here would be to memset() the entire object\n** to zero.  But it turns out that the apPage[] and aiIdx[] arrays\n** do not need to be zeroed and they are large, so we can save a lot\n** of run-time by skipping the initialization of those elements.\n*/\nvoid sqlite3BtreeCursorZero(BtCursor *p){\n  memset(p, 0, offsetof(BtCursor, iPage));\n}\n\n/*\n** Close a cursor.  The read lock on the database file is released\n** when the last cursor is closed.\n*/\nint sqlite3BtreeCloseCursor(BtCursor *pCur){\n  Btree *pBtree = pCur->pBtree;\n  if( pBtree ){\n    int i;\n    BtShared *pBt = pCur->pBt;\n    sqlite3BtreeEnter(pBtree);\n    sqlite3BtreeClearCursor(pCur);\n    assert( pBt->pCursor!=0 );\n    if( pBt->pCursor==pCur ){\n      pBt->pCursor = pCur->pNext;\n    }else{\n      BtCursor *pPrev = pBt->pCursor;\n      do{\n        if( pPrev->pNext==pCur ){\n          pPrev->pNext = pCur->pNext;\n          break;\n        }\n        pPrev = pPrev->pNext;\n      }while( ALWAYS(pPrev) );\n    }\n    for(i=0; i<=pCur->iPage; i++){\n      releasePage(pCur->apPage[i]);\n    }\n    unlockBtreeIfUnused(pBt);\n    sqlite3_free(pCur->aOverflow);\n    /* sqlite3_free(pCur); */\n    sqlite3BtreeLeave(pBtree);\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Make sure the BtCursor* given in the argument has a valid\n** BtCursor.info structure.  If it is not already valid, call\n** btreeParseCell() to fill it in.\n**\n** BtCursor.info is a cache of the information in the current cell.\n** Using this cache reduces the number of calls to btreeParseCell().\n*/\n#ifndef NDEBUG\n  static void assertCellInfo(BtCursor *pCur){\n    CellInfo info;\n    int iPage = pCur->iPage;\n    memset(&info, 0, sizeof(info));\n    btreeParseCell(pCur->apPage[iPage], pCur->aiIdx[iPage], &info);\n    assert( CORRUPT_DB || memcmp(&info, &pCur->info, sizeof(info))==0 );\n  }\n#else\n  #define assertCellInfo(x)\n#endif\nstatic SQLITE_NOINLINE void getCellInfo(BtCursor *pCur){\n  if( pCur->info.nSize==0 ){\n    int iPage = pCur->iPage;\n    pCur->curFlags |= BTCF_ValidNKey;\n    btreeParseCell(pCur->apPage[iPage],pCur->aiIdx[iPage],&pCur->info);\n  }else{\n    assertCellInfo(pCur);\n  }\n}\n\n#ifndef NDEBUG  /* The next routine used only within assert() statements */\n/*\n** Return true if the given BtCursor is valid.  A valid cursor is one\n** that is currently pointing to a row in a (non-empty) table.\n** This is a verification routine is used only within assert() statements.\n*/\nint sqlite3BtreeCursorIsValid(BtCursor *pCur){\n  return pCur && pCur->eState==CURSOR_VALID;\n}\n#endif /* NDEBUG */\n\n/*\n** Return the value of the integer key or \"rowid\" for a table btree.\n** This routine is only valid for a cursor that is pointing into a\n** ordinary table btree.  If the cursor points to an index btree or\n** is invalid, the result of this routine is undefined.\n*/\ni64 sqlite3BtreeIntegerKey(BtCursor *pCur){\n  assert( cursorHoldsMutex(pCur) );\n  assert( pCur->eState==CURSOR_VALID );\n  assert( pCur->curIntKey );\n  getCellInfo(pCur);\n  return pCur->info.nKey;\n}\n\n/*\n** Return the number of bytes of payload for the entry that pCur is\n** currently pointing to.  For table btrees, this will be the amount\n** of data.  For index btrees, this will be the size of the key.\n**\n** The caller must guarantee that the cursor is pointing to a non-NULL\n** valid entry.  In other words, the calling procedure must guarantee\n** that the cursor has Cursor.eState==CURSOR_VALID.\n*/\nu32 sqlite3BtreePayloadSize(BtCursor *pCur){\n  assert( cursorHoldsMutex(pCur) );\n  assert( pCur->eState==CURSOR_VALID );\n  getCellInfo(pCur);\n  return pCur->info.nPayload;\n}\n\n/*\n** Given the page number of an overflow page in the database (parameter\n** ovfl), this function finds the page number of the next page in the \n** linked list of overflow pages. If possible, it uses the auto-vacuum\n** pointer-map data instead of reading the content of page ovfl to do so. \n**\n** If an error occurs an SQLite error code is returned. Otherwise:\n**\n** The page number of the next overflow page in the linked list is \n** written to *pPgnoNext. If page ovfl is the last page in its linked \n** list, *pPgnoNext is set to zero. \n**\n** If ppPage is not NULL, and a reference to the MemPage object corresponding\n** to page number pOvfl was obtained, then *ppPage is set to point to that\n** reference. It is the responsibility of the caller to call releasePage()\n** on *ppPage to free the reference. In no reference was obtained (because\n** the pointer-map was used to obtain the value for *pPgnoNext), then\n** *ppPage is set to zero.\n*/\nstatic int getOverflowPage(\n  BtShared *pBt,               /* The database file */\n  Pgno ovfl,                   /* Current overflow page number */\n  MemPage **ppPage,            /* OUT: MemPage handle (may be NULL) */\n  Pgno *pPgnoNext              /* OUT: Next overflow page number */\n){\n  Pgno next = 0;\n  MemPage *pPage = 0;\n  int rc = SQLITE_OK;\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert(pPgnoNext);\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  /* Try to find the next page in the overflow list using the\n  ** autovacuum pointer-map pages. Guess that the next page in \n  ** the overflow list is page number (ovfl+1). If that guess turns \n  ** out to be wrong, fall back to loading the data of page \n  ** number ovfl to determine the next page number.\n  */\n  if( pBt->autoVacuum ){\n    Pgno pgno;\n    Pgno iGuess = ovfl+1;\n    u8 eType;\n\n    while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){\n      iGuess++;\n    }\n\n    if( iGuess<=btreePagecount(pBt) ){\n      rc = ptrmapGet(pBt, iGuess, &eType, &pgno);\n      if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){\n        next = iGuess;\n        rc = SQLITE_DONE;\n      }\n    }\n  }\n#endif\n\n  assert( next==0 || rc==SQLITE_DONE );\n  if( rc==SQLITE_OK ){\n    rc = btreeGetPage(pBt, ovfl, &pPage, (ppPage==0) ? PAGER_GET_READONLY : 0);\n    assert( rc==SQLITE_OK || pPage==0 );\n    if( rc==SQLITE_OK ){\n      next = get4byte(pPage->aData);\n    }\n  }\n\n  *pPgnoNext = next;\n  if( ppPage ){\n    *ppPage = pPage;\n  }else{\n    releasePage(pPage);\n  }\n  return (rc==SQLITE_DONE ? SQLITE_OK : rc);\n}\n\n/*\n** Copy data from a buffer to a page, or from a page to a buffer.\n**\n** pPayload is a pointer to data stored on database page pDbPage.\n** If argument eOp is false, then nByte bytes of data are copied\n** from pPayload to the buffer pointed at by pBuf. If eOp is true,\n** then sqlite3PagerWrite() is called on pDbPage and nByte bytes\n** of data are copied from the buffer pBuf to pPayload.\n**\n** SQLITE_OK is returned on success, otherwise an error code.\n*/\nstatic int copyPayload(\n  void *pPayload,           /* Pointer to page data */\n  void *pBuf,               /* Pointer to buffer */\n  int nByte,                /* Number of bytes to copy */\n  int eOp,                  /* 0 -> copy from page, 1 -> copy to page */\n  DbPage *pDbPage           /* Page containing pPayload */\n){\n  if( eOp ){\n    /* Copy data from buffer to page (a write operation) */\n    int rc = sqlite3PagerWrite(pDbPage);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    memcpy(pPayload, pBuf, nByte);\n  }else{\n    /* Copy data from page to buffer (a read operation) */\n    memcpy(pBuf, pPayload, nByte);\n  }\n  return SQLITE_OK;\n}\n\n/*\n** This function is used to read or overwrite payload information\n** for the entry that the pCur cursor is pointing to. The eOp\n** argument is interpreted as follows:\n**\n**   0: The operation is a read. Populate the overflow cache.\n**   1: The operation is a write. Populate the overflow cache.\n**   2: The operation is a read. Do not populate the overflow cache.\n**\n** A total of \"amt\" bytes are read or written beginning at \"offset\".\n** Data is read to or from the buffer pBuf.\n**\n** The content being read or written might appear on the main page\n** or be scattered out on multiple overflow pages.\n**\n** If the current cursor entry uses one or more overflow pages and the\n** eOp argument is not 2, this function may allocate space for and lazily \n** populates the overflow page-list cache array (BtCursor.aOverflow). \n** Subsequent calls use this cache to make seeking to the supplied offset \n** more efficient.\n**\n** Once an overflow page-list cache has been allocated, it may be\n** invalidated if some other cursor writes to the same table, or if\n** the cursor is moved to a different row. Additionally, in auto-vacuum\n** mode, the following events may invalidate an overflow page-list cache.\n**\n**   * An incremental vacuum,\n**   * A commit in auto_vacuum=\"full\" mode,\n**   * Creating a table (may require moving an overflow page).\n*/\nstatic int accessPayload(\n  BtCursor *pCur,      /* Cursor pointing to entry to read from */\n  u32 offset,          /* Begin reading this far into payload */\n  u32 amt,             /* Read this many bytes */\n  unsigned char *pBuf, /* Write the bytes into this buffer */ \n  int eOp              /* zero to read. non-zero to write. */\n){\n  unsigned char *aPayload;\n  int rc = SQLITE_OK;\n  int iIdx = 0;\n  MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */\n  BtShared *pBt = pCur->pBt;                  /* Btree this cursor belongs to */\n#ifdef SQLITE_DIRECT_OVERFLOW_READ\n  unsigned char * const pBufStart = pBuf;\n  int bEnd;                                 /* True if reading to end of data */\n#endif\n\n  assert( pPage );\n  assert( pCur->eState==CURSOR_VALID );\n  assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );\n  assert( cursorHoldsMutex(pCur) );\n  assert( eOp!=2 || offset==0 );    /* Always start from beginning for eOp==2 */\n\n  getCellInfo(pCur);\n  aPayload = pCur->info.pPayload;\n#ifdef SQLITE_DIRECT_OVERFLOW_READ\n  bEnd = offset+amt==pCur->info.nPayload;\n#endif\n  assert( offset+amt <= pCur->info.nPayload );\n\n  assert( aPayload > pPage->aData );\n  if( (uptr)(aPayload - pPage->aData) > (pBt->usableSize - pCur->info.nLocal) ){\n    /* Trying to read or write past the end of the data is an error.  The\n    ** conditional above is really:\n    **    &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]\n    ** but is recast into its current form to avoid integer overflow problems\n    */\n    return SQLITE_CORRUPT_BKPT;\n  }\n\n  /* Check if data must be read/written to/from the btree page itself. */\n  if( offset<pCur->info.nLocal ){\n    int a = amt;\n    if( a+offset>pCur->info.nLocal ){\n      a = pCur->info.nLocal - offset;\n    }\n    rc = copyPayload(&aPayload[offset], pBuf, a, (eOp & 0x01), pPage->pDbPage);\n    offset = 0;\n    pBuf += a;\n    amt -= a;\n  }else{\n    offset -= pCur->info.nLocal;\n  }\n\n\n  if( rc==SQLITE_OK && amt>0 ){\n    const u32 ovflSize = pBt->usableSize - 4;  /* Bytes content per ovfl page */\n    Pgno nextPage;\n\n    nextPage = get4byte(&aPayload[pCur->info.nLocal]);\n\n    /* If the BtCursor.aOverflow[] has not been allocated, allocate it now.\n    ** Except, do not allocate aOverflow[] for eOp==2.\n    **\n    ** The aOverflow[] array is sized at one entry for each overflow page\n    ** in the overflow chain. The page number of the first overflow page is\n    ** stored in aOverflow[0], etc. A value of 0 in the aOverflow[] array\n    ** means \"not yet known\" (the cache is lazily populated).\n    */\n    if( eOp!=2 && (pCur->curFlags & BTCF_ValidOvfl)==0 ){\n      int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize;\n      if( nOvfl>pCur->nOvflAlloc ){\n        Pgno *aNew = (Pgno*)sqlite3Realloc(\n            pCur->aOverflow, nOvfl*2*sizeof(Pgno)\n        );\n        if( aNew==0 ){\n          rc = SQLITE_NOMEM_BKPT;\n        }else{\n          pCur->nOvflAlloc = nOvfl*2;\n          pCur->aOverflow = aNew;\n        }\n      }\n      if( rc==SQLITE_OK ){\n        memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno));\n        pCur->curFlags |= BTCF_ValidOvfl;\n      }\n    }\n\n    /* If the overflow page-list cache has been allocated and the\n    ** entry for the first required overflow page is valid, skip\n    ** directly to it.\n    */\n    if( (pCur->curFlags & BTCF_ValidOvfl)!=0\n     && pCur->aOverflow[offset/ovflSize]\n    ){\n      iIdx = (offset/ovflSize);\n      nextPage = pCur->aOverflow[iIdx];\n      offset = (offset%ovflSize);\n    }\n\n    for( ; rc==SQLITE_OK && amt>0 && nextPage; iIdx++){\n\n      /* If required, populate the overflow page-list cache. */\n      if( (pCur->curFlags & BTCF_ValidOvfl)!=0 ){\n        assert( pCur->aOverflow[iIdx]==0\n                || pCur->aOverflow[iIdx]==nextPage\n                || CORRUPT_DB );\n        pCur->aOverflow[iIdx] = nextPage;\n      }\n\n      if( offset>=ovflSize ){\n        /* The only reason to read this page is to obtain the page\n        ** number for the next page in the overflow chain. The page\n        ** data is not required. So first try to lookup the overflow\n        ** page-list cache, if any, then fall back to the getOverflowPage()\n        ** function.\n        **\n        ** Note that the aOverflow[] array must be allocated because eOp!=2\n        ** here.  If eOp==2, then offset==0 and this branch is never taken.\n        */\n        assert( eOp!=2 );\n        assert( pCur->curFlags & BTCF_ValidOvfl );\n        assert( pCur->pBtree->db==pBt->db );\n        if( pCur->aOverflow[iIdx+1] ){\n          nextPage = pCur->aOverflow[iIdx+1];\n        }else{\n          rc = getOverflowPage(pBt, nextPage, 0, &nextPage);\n        }\n        offset -= ovflSize;\n      }else{\n        /* Need to read this page properly. It contains some of the\n        ** range of data that is being read (eOp==0) or written (eOp!=0).\n        */\n#ifdef SQLITE_DIRECT_OVERFLOW_READ\n        sqlite3_file *fd;\n#endif\n        int a = amt;\n        if( a + offset > ovflSize ){\n          a = ovflSize - offset;\n        }\n\n#ifdef SQLITE_DIRECT_OVERFLOW_READ\n        /* If all the following are true:\n        **\n        **   1) this is a read operation, and \n        **   2) data is required from the start of this overflow page, and\n        **   3) the database is file-backed, and\n        **   4) there is no open write-transaction, and\n        **   5) the database is not a WAL database,\n        **   6) all data from the page is being read.\n        **   7) at least 4 bytes have already been read into the output buffer \n        **\n        ** then data can be read directly from the database file into the\n        ** output buffer, bypassing the page-cache altogether. This speeds\n        ** up loading large records that span many overflow pages.\n        */\n        if( (eOp&0x01)==0                                      /* (1) */\n         && offset==0                                          /* (2) */\n         && (bEnd || a==ovflSize)                              /* (6) */\n         && pBt->inTransaction==TRANS_READ                     /* (4) */\n         && (fd = sqlite3PagerFile(pBt->pPager))->pMethods     /* (3) */\n         && 0==sqlite3PagerUseWal(pBt->pPager)                 /* (5) */\n         && &pBuf[-4]>=pBufStart                               /* (7) */\n        ){\n          u8 aSave[4];\n          u8 *aWrite = &pBuf[-4];\n          assert( aWrite>=pBufStart );                         /* hence (7) */\n          memcpy(aSave, aWrite, 4);\n          rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1));\n          nextPage = get4byte(aWrite);\n          memcpy(aWrite, aSave, 4);\n        }else\n#endif\n\n        {\n          DbPage *pDbPage;\n          rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage,\n              ((eOp&0x01)==0 ? PAGER_GET_READONLY : 0)\n          );\n          if( rc==SQLITE_OK ){\n            aPayload = sqlite3PagerGetData(pDbPage);\n            nextPage = get4byte(aPayload);\n            rc = copyPayload(&aPayload[offset+4], pBuf, a, (eOp&0x01), pDbPage);\n            sqlite3PagerUnref(pDbPage);\n            offset = 0;\n          }\n        }\n        amt -= a;\n        pBuf += a;\n      }\n    }\n  }\n\n  if( rc==SQLITE_OK && amt>0 ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n  return rc;\n}\n\n/*\n** Read part of the key associated with cursor pCur.  Exactly\n** \"amt\" bytes will be transferred into pBuf[].  The transfer\n** begins at \"offset\".\n**\n** The caller must ensure that pCur is pointing to a valid row\n** in the table.\n**\n** Return SQLITE_OK on success or an error code if anything goes\n** wrong.  An error is returned if \"offset+amt\" is larger than\n** the available payload.\n*/\nint sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){\n  assert( cursorHoldsMutex(pCur) );\n  assert( pCur->eState==CURSOR_VALID );\n  assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] );\n  assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\n  return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);\n}\n\n/*\n** Read part of the data associated with cursor pCur.  Exactly\n** \"amt\" bytes will be transfered into pBuf[].  The transfer\n** begins at \"offset\".\n**\n** Return SQLITE_OK on success or an error code if anything goes\n** wrong.  An error is returned if \"offset+amt\" is larger than\n** the available payload.\n*/\nint sqlite3BtreeData(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){\n  int rc;\n\n#ifndef SQLITE_OMIT_INCRBLOB\n  if ( pCur->eState==CURSOR_INVALID ){\n    return SQLITE_ABORT;\n  }\n#endif\n\n  assert( cursorOwnsBtShared(pCur) );\n  rc = restoreCursorPosition(pCur);\n  if( rc==SQLITE_OK ){\n    assert( pCur->eState==CURSOR_VALID );\n    assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] );\n    assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\n    rc = accessPayload(pCur, offset, amt, pBuf, 0);\n  }\n  return rc;\n}\n\n/*\n** Return a pointer to payload information from the entry that the \n** pCur cursor is pointing to.  The pointer is to the beginning of\n** the key if index btrees (pPage->intKey==0) and is the data for\n** table btrees (pPage->intKey==1). The number of bytes of available\n** key/data is written into *pAmt.  If *pAmt==0, then the value\n** returned will not be a valid pointer.\n**\n** This routine is an optimization.  It is common for the entire key\n** and data to fit on the local page and for there to be no overflow\n** pages.  When that is so, this routine can be used to access the\n** key and data without making a copy.  If the key and/or data spills\n** onto overflow pages, then accessPayload() must be used to reassemble\n** the key/data and copy it into a preallocated buffer.\n**\n** The pointer returned by this routine looks directly into the cached\n** page of the database.  The data might change or move the next time\n** any btree routine is called.\n*/\nstatic const void *fetchPayload(\n  BtCursor *pCur,      /* Cursor pointing to entry to read from */\n  u32 *pAmt            /* Write the number of available bytes here */\n){\n  u32 amt;\n  assert( pCur!=0 && pCur->iPage>=0 && pCur->apPage[pCur->iPage]);\n  assert( pCur->eState==CURSOR_VALID );\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\n  assert( pCur->info.nSize>0 );\n  assert( pCur->info.pPayload>pCur->apPage[pCur->iPage]->aData || CORRUPT_DB );\n  assert( pCur->info.pPayload<pCur->apPage[pCur->iPage]->aDataEnd ||CORRUPT_DB);\n  amt = (int)(pCur->apPage[pCur->iPage]->aDataEnd - pCur->info.pPayload);\n  if( pCur->info.nLocal<amt ) amt = pCur->info.nLocal;\n  *pAmt = amt;\n  return (void*)pCur->info.pPayload;\n}\n\n\n/*\n** For the entry that cursor pCur is point to, return as\n** many bytes of the key or data as are available on the local\n** b-tree page.  Write the number of available bytes into *pAmt.\n**\n** The pointer returned is ephemeral.  The key/data may move\n** or be destroyed on the next call to any Btree routine,\n** including calls from other threads against the same cache.\n** Hence, a mutex on the BtShared should be held prior to calling\n** this routine.\n**\n** These routines is used to get quick access to key and data\n** in the common case where no overflow pages are used.\n*/\nconst void *sqlite3BtreePayloadFetch(BtCursor *pCur, u32 *pAmt){\n  return fetchPayload(pCur, pAmt);\n}\n\n\n/*\n** Move the cursor down to a new child page.  The newPgno argument is the\n** page number of the child page to move to.\n**\n** This function returns SQLITE_CORRUPT if the page-header flags field of\n** the new child page does not match the flags field of the parent (i.e.\n** if an intkey page appears to be the parent of a non-intkey page, or\n** vice-versa).\n*/\nstatic int moveToChild(BtCursor *pCur, u32 newPgno){\n  BtShared *pBt = pCur->pBt;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pCur->eState==CURSOR_VALID );\n  assert( pCur->iPage<BTCURSOR_MAX_DEPTH );\n  assert( pCur->iPage>=0 );\n  if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n  pCur->info.nSize = 0;\n  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);\n  pCur->iPage++;\n  pCur->aiIdx[pCur->iPage] = 0;\n  return getAndInitPage(pBt, newPgno, &pCur->apPage[pCur->iPage],\n                        pCur, pCur->curPagerFlags);\n}\n\n#if SQLITE_DEBUG\n/*\n** Page pParent is an internal (non-leaf) tree page. This function \n** asserts that page number iChild is the left-child if the iIdx'th\n** cell in page pParent. Or, if iIdx is equal to the total number of\n** cells in pParent, that page number iChild is the right-child of\n** the page.\n*/\nstatic void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){\n  if( CORRUPT_DB ) return;  /* The conditions tested below might not be true\n                            ** in a corrupt database */\n  assert( iIdx<=pParent->nCell );\n  if( iIdx==pParent->nCell ){\n    assert( get4byte(&pParent->aData[pParent->hdrOffset+8])==iChild );\n  }else{\n    assert( get4byte(findCell(pParent, iIdx))==iChild );\n  }\n}\n#else\n#  define assertParentIndex(x,y,z) \n#endif\n\n/*\n** Move the cursor up to the parent page.\n**\n** pCur->idx is set to the cell index that contains the pointer\n** to the page we are coming from.  If we are coming from the\n** right-most child page then pCur->idx is set to one more than\n** the largest cell index.\n*/\nstatic void moveToParent(BtCursor *pCur){\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pCur->eState==CURSOR_VALID );\n  assert( pCur->iPage>0 );\n  assert( pCur->apPage[pCur->iPage] );\n  assertParentIndex(\n    pCur->apPage[pCur->iPage-1], \n    pCur->aiIdx[pCur->iPage-1], \n    pCur->apPage[pCur->iPage]->pgno\n  );\n  testcase( pCur->aiIdx[pCur->iPage-1] > pCur->apPage[pCur->iPage-1]->nCell );\n  pCur->info.nSize = 0;\n  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);\n  releasePageNotNull(pCur->apPage[pCur->iPage--]);\n}\n\n/*\n** Move the cursor to point to the root page of its b-tree structure.\n**\n** If the table has a virtual root page, then the cursor is moved to point\n** to the virtual root page instead of the actual root page. A table has a\n** virtual root page when the actual root page contains no cells and a \n** single child page. This can only happen with the table rooted at page 1.\n**\n** If the b-tree structure is empty, the cursor state is set to \n** CURSOR_INVALID. Otherwise, the cursor is set to point to the first\n** cell located on the root (or virtual root) page and the cursor state\n** is set to CURSOR_VALID.\n**\n** If this function returns successfully, it may be assumed that the\n** page-header flags indicate that the [virtual] root-page is the expected \n** kind of b-tree page (i.e. if when opening the cursor the caller did not\n** specify a KeyInfo structure the flags byte is set to 0x05 or 0x0D,\n** indicating a table b-tree, or if the caller did specify a KeyInfo \n** structure the flags byte is set to 0x02 or 0x0A, indicating an index\n** b-tree).\n*/\nstatic int moveToRoot(BtCursor *pCur){\n  MemPage *pRoot;\n  int rc = SQLITE_OK;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( CURSOR_INVALID < CURSOR_REQUIRESEEK );\n  assert( CURSOR_VALID   < CURSOR_REQUIRESEEK );\n  assert( CURSOR_FAULT   > CURSOR_REQUIRESEEK );\n  if( pCur->eState>=CURSOR_REQUIRESEEK ){\n    if( pCur->eState==CURSOR_FAULT ){\n      assert( pCur->skipNext!=SQLITE_OK );\n      return pCur->skipNext;\n    }\n    sqlite3BtreeClearCursor(pCur);\n  }\n\n  if( pCur->iPage>=0 ){\n    while( pCur->iPage ){\n      assert( pCur->apPage[pCur->iPage]!=0 );\n      releasePageNotNull(pCur->apPage[pCur->iPage--]);\n    }\n  }else if( pCur->pgnoRoot==0 ){\n    pCur->eState = CURSOR_INVALID;\n    return SQLITE_OK;\n  }else{\n    assert( pCur->iPage==(-1) );\n    rc = getAndInitPage(pCur->pBtree->pBt, pCur->pgnoRoot, &pCur->apPage[0],\n                        0, pCur->curPagerFlags);\n    if( rc!=SQLITE_OK ){\n      pCur->eState = CURSOR_INVALID;\n      return rc;\n    }\n    pCur->iPage = 0;\n    pCur->curIntKey = pCur->apPage[0]->intKey;\n  }\n  pRoot = pCur->apPage[0];\n  assert( pRoot->pgno==pCur->pgnoRoot );\n\n  /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor\n  ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is\n  ** NULL, the caller expects a table b-tree. If this is not the case,\n  ** return an SQLITE_CORRUPT error. \n  **\n  ** Earlier versions of SQLite assumed that this test could not fail\n  ** if the root page was already loaded when this function was called (i.e.\n  ** if pCur->iPage>=0). But this is not so if the database is corrupted \n  ** in such a way that page pRoot is linked into a second b-tree table \n  ** (or the freelist).  */\n  assert( pRoot->intKey==1 || pRoot->intKey==0 );\n  if( pRoot->isInit==0 || (pCur->pKeyInfo==0)!=pRoot->intKey ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n\n  pCur->aiIdx[0] = 0;\n  pCur->info.nSize = 0;\n  pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl);\n\n  if( pRoot->nCell>0 ){\n    pCur->eState = CURSOR_VALID;\n  }else if( !pRoot->leaf ){\n    Pgno subpage;\n    if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;\n    subpage = get4byte(&pRoot->aData[pRoot->hdrOffset+8]);\n    pCur->eState = CURSOR_VALID;\n    rc = moveToChild(pCur, subpage);\n  }else{\n    pCur->eState = CURSOR_INVALID;\n  }\n  return rc;\n}\n\n/*\n** Move the cursor down to the left-most leaf entry beneath the\n** entry to which it is currently pointing.\n**\n** The left-most leaf is the one with the smallest key - the first\n** in ascending order.\n*/\nstatic int moveToLeftmost(BtCursor *pCur){\n  Pgno pgno;\n  int rc = SQLITE_OK;\n  MemPage *pPage;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pCur->eState==CURSOR_VALID );\n  while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){\n    assert( pCur->aiIdx[pCur->iPage]<pPage->nCell );\n    pgno = get4byte(findCell(pPage, pCur->aiIdx[pCur->iPage]));\n    rc = moveToChild(pCur, pgno);\n  }\n  return rc;\n}\n\n/*\n** Move the cursor down to the right-most leaf entry beneath the\n** page to which it is currently pointing.  Notice the difference\n** between moveToLeftmost() and moveToRightmost().  moveToLeftmost()\n** finds the left-most entry beneath the *entry* whereas moveToRightmost()\n** finds the right-most entry beneath the *page*.\n**\n** The right-most entry is the one with the largest key - the last\n** key in ascending order.\n*/\nstatic int moveToRightmost(BtCursor *pCur){\n  Pgno pgno;\n  int rc = SQLITE_OK;\n  MemPage *pPage = 0;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pCur->eState==CURSOR_VALID );\n  while( !(pPage = pCur->apPage[pCur->iPage])->leaf ){\n    pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);\n    pCur->aiIdx[pCur->iPage] = pPage->nCell;\n    rc = moveToChild(pCur, pgno);\n    if( rc ) return rc;\n  }\n  pCur->aiIdx[pCur->iPage] = pPage->nCell-1;\n  assert( pCur->info.nSize==0 );\n  assert( (pCur->curFlags & BTCF_ValidNKey)==0 );\n  return SQLITE_OK;\n}\n\n/* Move the cursor to the first entry in the table.  Return SQLITE_OK\n** on success.  Set *pRes to 0 if the cursor actually points to something\n** or set *pRes to 1 if the table is empty.\n*/\nint sqlite3BtreeFirst(BtCursor *pCur, int *pRes){\n  int rc;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\n  rc = moveToRoot(pCur);\n  if( rc==SQLITE_OK ){\n    if( pCur->eState==CURSOR_INVALID ){\n      assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );\n      *pRes = 1;\n    }else{\n      assert( pCur->apPage[pCur->iPage]->nCell>0 );\n      *pRes = 0;\n      rc = moveToLeftmost(pCur);\n    }\n  }\n  return rc;\n}\n\n/* Move the cursor to the last entry in the table.  Return SQLITE_OK\n** on success.  Set *pRes to 0 if the cursor actually points to something\n** or set *pRes to 1 if the table is empty.\n*/\nint sqlite3BtreeLast(BtCursor *pCur, int *pRes){\n  int rc;\n \n  assert( cursorOwnsBtShared(pCur) );\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\n\n  /* If the cursor already points to the last entry, this is a no-op. */\n  if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){\n#ifdef SQLITE_DEBUG\n    /* This block serves to assert() that the cursor really does point \n    ** to the last entry in the b-tree. */\n    int ii;\n    for(ii=0; ii<pCur->iPage; ii++){\n      assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );\n    }\n    assert( pCur->aiIdx[pCur->iPage]==pCur->apPage[pCur->iPage]->nCell-1 );\n    assert( pCur->apPage[pCur->iPage]->leaf );\n#endif\n    return SQLITE_OK;\n  }\n\n  rc = moveToRoot(pCur);\n  if( rc==SQLITE_OK ){\n    if( CURSOR_INVALID==pCur->eState ){\n      assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );\n      *pRes = 1;\n    }else{\n      assert( pCur->eState==CURSOR_VALID );\n      *pRes = 0;\n      rc = moveToRightmost(pCur);\n      if( rc==SQLITE_OK ){\n        pCur->curFlags |= BTCF_AtLast;\n      }else{\n        pCur->curFlags &= ~BTCF_AtLast;\n      }\n   \n    }\n  }\n  return rc;\n}\n\n/* Move the cursor so that it points to an entry near the key \n** specified by pIdxKey or intKey.   Return a success code.\n**\n** For INTKEY tables, the intKey parameter is used.  pIdxKey \n** must be NULL.  For index tables, pIdxKey is used and intKey\n** is ignored.\n**\n** If an exact match is not found, then the cursor is always\n** left pointing at a leaf page which would hold the entry if it\n** were present.  The cursor might point to an entry that comes\n** before or after the key.\n**\n** An integer is written into *pRes which is the result of\n** comparing the key with the entry to which the cursor is \n** pointing.  The meaning of the integer written into\n** *pRes is as follows:\n**\n**     *pRes<0      The cursor is left pointing at an entry that\n**                  is smaller than intKey/pIdxKey or if the table is empty\n**                  and the cursor is therefore left point to nothing.\n**\n**     *pRes==0     The cursor is left pointing at an entry that\n**                  exactly matches intKey/pIdxKey.\n**\n**     *pRes>0      The cursor is left pointing at an entry that\n**                  is larger than intKey/pIdxKey.\n**\n** For index tables, the pIdxKey->eqSeen field is set to 1 if there\n** exists an entry in the table that exactly matches pIdxKey.  \n*/\nint sqlite3BtreeMovetoUnpacked(\n  BtCursor *pCur,          /* The cursor to be moved */\n  UnpackedRecord *pIdxKey, /* Unpacked index key */\n  i64 intKey,              /* The table key */\n  int biasRight,           /* If true, bias the search to the high end */\n  int *pRes                /* Write search results here */\n){\n  int rc;\n  RecordCompare xRecordCompare;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );\n  assert( pRes );\n  assert( (pIdxKey==0)==(pCur->pKeyInfo==0) );\n  assert( pCur->eState!=CURSOR_VALID || (pIdxKey==0)==(pCur->curIntKey!=0) );\n\n  /* If the cursor is already positioned at the point we are trying\n  ** to move to, then just return without doing any work */\n  if( pIdxKey==0\n   && pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0\n  ){\n    if( pCur->info.nKey==intKey ){\n      *pRes = 0;\n      return SQLITE_OK;\n    }\n    if( (pCur->curFlags & BTCF_AtLast)!=0 && pCur->info.nKey<intKey ){\n      *pRes = -1;\n      return SQLITE_OK;\n    }\n  }\n\n  if( pIdxKey ){\n    xRecordCompare = sqlite3VdbeFindCompare(pIdxKey);\n    pIdxKey->errCode = 0;\n    assert( pIdxKey->default_rc==1 \n         || pIdxKey->default_rc==0 \n         || pIdxKey->default_rc==-1\n    );\n  }else{\n    xRecordCompare = 0; /* All keys are integers */\n  }\n\n  rc = moveToRoot(pCur);\n  if( rc ){\n    return rc;\n  }\n  assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage] );\n  assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->isInit );\n  assert( pCur->eState==CURSOR_INVALID || pCur->apPage[pCur->iPage]->nCell>0 );\n  if( pCur->eState==CURSOR_INVALID ){\n    *pRes = -1;\n    assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );\n    return SQLITE_OK;\n  }\n  assert( pCur->apPage[0]->intKey==pCur->curIntKey );\n  assert( pCur->curIntKey || pIdxKey );\n  for(;;){\n    int lwr, upr, idx, c;\n    Pgno chldPg;\n    MemPage *pPage = pCur->apPage[pCur->iPage];\n    u8 *pCell;                          /* Pointer to current cell in pPage */\n\n    /* pPage->nCell must be greater than zero. If this is the root-page\n    ** the cursor would have been INVALID above and this for(;;) loop\n    ** not run. If this is not the root-page, then the moveToChild() routine\n    ** would have already detected db corruption. Similarly, pPage must\n    ** be the right kind (index or table) of b-tree page. Otherwise\n    ** a moveToChild() or moveToRoot() call would have detected corruption.  */\n    assert( pPage->nCell>0 );\n    assert( pPage->intKey==(pIdxKey==0) );\n    lwr = 0;\n    upr = pPage->nCell-1;\n    assert( biasRight==0 || biasRight==1 );\n    idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */\n    pCur->aiIdx[pCur->iPage] = (u16)idx;\n    if( xRecordCompare==0 ){\n      for(;;){\n        i64 nCellKey;\n        pCell = findCellPastPtr(pPage, idx);\n        if( pPage->intKeyLeaf ){\n          while( 0x80 <= *(pCell++) ){\n            if( pCell>=pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;\n          }\n        }\n        getVarint(pCell, (u64*)&nCellKey);\n        if( nCellKey<intKey ){\n          lwr = idx+1;\n          if( lwr>upr ){ c = -1; break; }\n        }else if( nCellKey>intKey ){\n          upr = idx-1;\n          if( lwr>upr ){ c = +1; break; }\n        }else{\n          assert( nCellKey==intKey );\n          pCur->curFlags |= BTCF_ValidNKey;\n          pCur->info.nKey = nCellKey;\n          pCur->aiIdx[pCur->iPage] = (u16)idx;\n          if( !pPage->leaf ){\n            lwr = idx;\n            goto moveto_next_layer;\n          }else{\n            *pRes = 0;\n            rc = SQLITE_OK;\n            goto moveto_finish;\n          }\n        }\n        assert( lwr+upr>=0 );\n        idx = (lwr+upr)>>1;  /* idx = (lwr+upr)/2; */\n      }\n    }else{\n      for(;;){\n        int nCell;  /* Size of the pCell cell in bytes */\n        pCell = findCellPastPtr(pPage, idx);\n\n        /* The maximum supported page-size is 65536 bytes. This means that\n        ** the maximum number of record bytes stored on an index B-Tree\n        ** page is less than 16384 bytes and may be stored as a 2-byte\n        ** varint. This information is used to attempt to avoid parsing \n        ** the entire cell by checking for the cases where the record is \n        ** stored entirely within the b-tree page by inspecting the first \n        ** 2 bytes of the cell.\n        */\n        nCell = pCell[0];\n        if( nCell<=pPage->max1bytePayload ){\n          /* This branch runs if the record-size field of the cell is a\n          ** single byte varint and the record fits entirely on the main\n          ** b-tree page.  */\n          testcase( pCell+nCell+1==pPage->aDataEnd );\n          c = xRecordCompare(nCell, (void*)&pCell[1], pIdxKey);\n        }else if( !(pCell[1] & 0x80) \n          && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal\n        ){\n          /* The record-size field is a 2 byte varint and the record \n          ** fits entirely on the main b-tree page.  */\n          testcase( pCell+nCell+2==pPage->aDataEnd );\n          c = xRecordCompare(nCell, (void*)&pCell[2], pIdxKey);\n        }else{\n          /* The record flows over onto one or more overflow pages. In\n          ** this case the whole cell needs to be parsed, a buffer allocated\n          ** and accessPayload() used to retrieve the record into the\n          ** buffer before VdbeRecordCompare() can be called. \n          **\n          ** If the record is corrupt, the xRecordCompare routine may read\n          ** up to two varints past the end of the buffer. An extra 18 \n          ** bytes of padding is allocated at the end of the buffer in\n          ** case this happens.  */\n          void *pCellKey;\n          u8 * const pCellBody = pCell - pPage->childPtrSize;\n          pPage->xParseCell(pPage, pCellBody, &pCur->info);\n          nCell = (int)pCur->info.nKey;\n          testcase( nCell<0 );   /* True if key size is 2^32 or more */\n          testcase( nCell==0 );  /* Invalid key size:  0x80 0x80 0x00 */\n          testcase( nCell==1 );  /* Invalid key size:  0x80 0x80 0x01 */\n          testcase( nCell==2 );  /* Minimum legal index key size */\n          if( nCell<2 ){\n            rc = SQLITE_CORRUPT_BKPT;\n            goto moveto_finish;\n          }\n          pCellKey = sqlite3Malloc( nCell+18 );\n          if( pCellKey==0 ){\n            rc = SQLITE_NOMEM_BKPT;\n            goto moveto_finish;\n          }\n          pCur->aiIdx[pCur->iPage] = (u16)idx;\n          rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 2);\n          if( rc ){\n            sqlite3_free(pCellKey);\n            goto moveto_finish;\n          }\n          c = xRecordCompare(nCell, pCellKey, pIdxKey);\n          sqlite3_free(pCellKey);\n        }\n        assert( \n            (pIdxKey->errCode!=SQLITE_CORRUPT || c==0)\n         && (pIdxKey->errCode!=SQLITE_NOMEM || pCur->pBtree->db->mallocFailed)\n        );\n        if( c<0 ){\n          lwr = idx+1;\n        }else if( c>0 ){\n          upr = idx-1;\n        }else{\n          assert( c==0 );\n          *pRes = 0;\n          rc = SQLITE_OK;\n          pCur->aiIdx[pCur->iPage] = (u16)idx;\n          if( pIdxKey->errCode ) rc = SQLITE_CORRUPT;\n          goto moveto_finish;\n        }\n        if( lwr>upr ) break;\n        assert( lwr+upr>=0 );\n        idx = (lwr+upr)>>1;  /* idx = (lwr+upr)/2 */\n      }\n    }\n    assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) );\n    assert( pPage->isInit );\n    if( pPage->leaf ){\n      assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\n      pCur->aiIdx[pCur->iPage] = (u16)idx;\n      *pRes = c;\n      rc = SQLITE_OK;\n      goto moveto_finish;\n    }\nmoveto_next_layer:\n    if( lwr>=pPage->nCell ){\n      chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]);\n    }else{\n      chldPg = get4byte(findCell(pPage, lwr));\n    }\n    pCur->aiIdx[pCur->iPage] = (u16)lwr;\n    rc = moveToChild(pCur, chldPg);\n    if( rc ) break;\n  }\nmoveto_finish:\n  pCur->info.nSize = 0;\n  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);\n  return rc;\n}\n\n\n/*\n** Return TRUE if the cursor is not pointing at an entry of the table.\n**\n** TRUE will be returned after a call to sqlite3BtreeNext() moves\n** past the last entry in the table or sqlite3BtreePrev() moves past\n** the first entry.  TRUE is also returned if the table is empty.\n*/\nint sqlite3BtreeEof(BtCursor *pCur){\n  /* TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries\n  ** have been deleted? This API will need to change to return an error code\n  ** as well as the boolean result value.\n  */\n  return (CURSOR_VALID!=pCur->eState);\n}\n\n/*\n** Advance the cursor to the next entry in the database.  If\n** successful then set *pRes=0.  If the cursor\n** was already pointing to the last entry in the database before\n** this routine was called, then set *pRes=1.\n**\n** The main entry point is sqlite3BtreeNext().  That routine is optimized\n** for the common case of merely incrementing the cell counter BtCursor.aiIdx\n** to the next cell on the current page.  The (slower) btreeNext() helper\n** routine is called when it is necessary to move to a different page or\n** to restore the cursor.\n**\n** The calling function will set *pRes to 0 or 1.  The initial *pRes value\n** will be 1 if the cursor being stepped corresponds to an SQL index and\n** if this routine could have been skipped if that SQL index had been\n** a unique index.  Otherwise the caller will have set *pRes to zero.\n** Zero is the common case. The btree implementation is free to use the\n** initial *pRes value as a hint to improve performance, but the current\n** SQLite btree implementation does not. (Note that the comdb2 btree\n** implementation does use this hint, however.)\n*/\nstatic SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){\n  int rc;\n  int idx;\n  MemPage *pPage;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );\n  assert( *pRes==0 );\n  if( pCur->eState!=CURSOR_VALID ){\n    assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );\n    rc = restoreCursorPosition(pCur);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    if( CURSOR_INVALID==pCur->eState ){\n      *pRes = 1;\n      return SQLITE_OK;\n    }\n    if( pCur->skipNext ){\n      assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );\n      pCur->eState = CURSOR_VALID;\n      if( pCur->skipNext>0 ){\n        pCur->skipNext = 0;\n        return SQLITE_OK;\n      }\n      pCur->skipNext = 0;\n    }\n  }\n\n  pPage = pCur->apPage[pCur->iPage];\n  idx = ++pCur->aiIdx[pCur->iPage];\n  assert( pPage->isInit );\n\n  /* If the database file is corrupt, it is possible for the value of idx \n  ** to be invalid here. This can only occur if a second cursor modifies\n  ** the page while cursor pCur is holding a reference to it. Which can\n  ** only happen if the database is corrupt in such a way as to link the\n  ** page into more than one b-tree structure. */\n  testcase( idx>pPage->nCell );\n\n  if( idx>=pPage->nCell ){\n    if( !pPage->leaf ){\n      rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));\n      if( rc ) return rc;\n      return moveToLeftmost(pCur);\n    }\n    do{\n      if( pCur->iPage==0 ){\n        *pRes = 1;\n        pCur->eState = CURSOR_INVALID;\n        return SQLITE_OK;\n      }\n      moveToParent(pCur);\n      pPage = pCur->apPage[pCur->iPage];\n    }while( pCur->aiIdx[pCur->iPage]>=pPage->nCell );\n    if( pPage->intKey ){\n      return sqlite3BtreeNext(pCur, pRes);\n    }else{\n      return SQLITE_OK;\n    }\n  }\n  if( pPage->leaf ){\n    return SQLITE_OK;\n  }else{\n    return moveToLeftmost(pCur);\n  }\n}\nint sqlite3BtreeNext(BtCursor *pCur, int *pRes){\n  MemPage *pPage;\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pRes!=0 );\n  assert( *pRes==0 || *pRes==1 );\n  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );\n  pCur->info.nSize = 0;\n  pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);\n  *pRes = 0;\n  if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur, pRes);\n  pPage = pCur->apPage[pCur->iPage];\n  if( (++pCur->aiIdx[pCur->iPage])>=pPage->nCell ){\n    pCur->aiIdx[pCur->iPage]--;\n    return btreeNext(pCur, pRes);\n  }\n  if( pPage->leaf ){\n    return SQLITE_OK;\n  }else{\n    return moveToLeftmost(pCur);\n  }\n}\n\n/*\n** Step the cursor to the back to the previous entry in the database.  If\n** successful then set *pRes=0.  If the cursor\n** was already pointing to the first entry in the database before\n** this routine was called, then set *pRes=1.\n**\n** The main entry point is sqlite3BtreePrevious().  That routine is optimized\n** for the common case of merely decrementing the cell counter BtCursor.aiIdx\n** to the previous cell on the current page.  The (slower) btreePrevious()\n** helper routine is called when it is necessary to move to a different page\n** or to restore the cursor.\n**\n** The calling function will set *pRes to 0 or 1.  The initial *pRes value\n** will be 1 if the cursor being stepped corresponds to an SQL index and\n** if this routine could have been skipped if that SQL index had been\n** a unique index.  Otherwise the caller will have set *pRes to zero.\n** Zero is the common case. The btree implementation is free to use the\n** initial *pRes value as a hint to improve performance, but the current\n** SQLite btree implementation does not. (Note that the comdb2 btree\n** implementation does use this hint, however.)\n*/\nstatic SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){\n  int rc;\n  MemPage *pPage;\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pRes!=0 );\n  assert( *pRes==0 );\n  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );\n  assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );\n  assert( pCur->info.nSize==0 );\n  if( pCur->eState!=CURSOR_VALID ){\n    rc = restoreCursorPosition(pCur);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    if( CURSOR_INVALID==pCur->eState ){\n      *pRes = 1;\n      return SQLITE_OK;\n    }\n    if( pCur->skipNext ){\n      assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );\n      pCur->eState = CURSOR_VALID;\n      if( pCur->skipNext<0 ){\n        pCur->skipNext = 0;\n        return SQLITE_OK;\n      }\n      pCur->skipNext = 0;\n    }\n  }\n\n  pPage = pCur->apPage[pCur->iPage];\n  assert( pPage->isInit );\n  if( !pPage->leaf ){\n    int idx = pCur->aiIdx[pCur->iPage];\n    rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));\n    if( rc ) return rc;\n    rc = moveToRightmost(pCur);\n  }else{\n    while( pCur->aiIdx[pCur->iPage]==0 ){\n      if( pCur->iPage==0 ){\n        pCur->eState = CURSOR_INVALID;\n        *pRes = 1;\n        return SQLITE_OK;\n      }\n      moveToParent(pCur);\n    }\n    assert( pCur->info.nSize==0 );\n    assert( (pCur->curFlags & (BTCF_ValidNKey|BTCF_ValidOvfl))==0 );\n\n    pCur->aiIdx[pCur->iPage]--;\n    pPage = pCur->apPage[pCur->iPage];\n    if( pPage->intKey && !pPage->leaf ){\n      rc = sqlite3BtreePrevious(pCur, pRes);\n    }else{\n      rc = SQLITE_OK;\n    }\n  }\n  return rc;\n}\nint sqlite3BtreePrevious(BtCursor *pCur, int *pRes){\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pRes!=0 );\n  assert( *pRes==0 || *pRes==1 );\n  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );\n  *pRes = 0;\n  pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey);\n  pCur->info.nSize = 0;\n  if( pCur->eState!=CURSOR_VALID\n   || pCur->aiIdx[pCur->iPage]==0\n   || pCur->apPage[pCur->iPage]->leaf==0\n  ){\n    return btreePrevious(pCur, pRes);\n  }\n  pCur->aiIdx[pCur->iPage]--;\n  return SQLITE_OK;\n}\n\n/*\n** Allocate a new page from the database file.\n**\n** The new page is marked as dirty.  (In other words, sqlite3PagerWrite()\n** has already been called on the new page.)  The new page has also\n** been referenced and the calling routine is responsible for calling\n** sqlite3PagerUnref() on the new page when it is done.\n**\n** SQLITE_OK is returned on success.  Any other return value indicates\n** an error.  *ppPage is set to NULL in the event of an error.\n**\n** If the \"nearby\" parameter is not 0, then an effort is made to \n** locate a page close to the page number \"nearby\".  This can be used in an\n** attempt to keep related pages close to each other in the database file,\n** which in turn can make database access faster.\n**\n** If the eMode parameter is BTALLOC_EXACT and the nearby page exists\n** anywhere on the free-list, then it is guaranteed to be returned.  If\n** eMode is BTALLOC_LT then the page returned will be less than or equal\n** to nearby if any such page exists.  If eMode is BTALLOC_ANY then there\n** are no restrictions on which page is returned.\n*/\nstatic int allocateBtreePage(\n  BtShared *pBt,         /* The btree */\n  MemPage **ppPage,      /* Store pointer to the allocated page here */\n  Pgno *pPgno,           /* Store the page number here */\n  Pgno nearby,           /* Search for a page near this one */\n  u8 eMode               /* BTALLOC_EXACT, BTALLOC_LT, or BTALLOC_ANY */\n){\n  MemPage *pPage1;\n  int rc;\n  u32 n;     /* Number of pages on the freelist */\n  u32 k;     /* Number of leaves on the trunk of the freelist */\n  MemPage *pTrunk = 0;\n  MemPage *pPrevTrunk = 0;\n  Pgno mxPage;     /* Total size of the database file */\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );\n  pPage1 = pBt->pPage1;\n  mxPage = btreePagecount(pBt);\n  /* EVIDENCE-OF: R-05119-02637 The 4-byte big-endian integer at offset 36\n  ** stores stores the total number of pages on the freelist. */\n  n = get4byte(&pPage1->aData[36]);\n  testcase( n==mxPage-1 );\n  if( n>=mxPage ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n  if( n>0 ){\n    /* There are pages on the freelist.  Reuse one of those pages. */\n    Pgno iTrunk;\n    u8 searchList = 0; /* If the free-list must be searched for 'nearby' */\n    u32 nSearch = 0;   /* Count of the number of search attempts */\n    \n    /* If eMode==BTALLOC_EXACT and a query of the pointer-map\n    ** shows that the page 'nearby' is somewhere on the free-list, then\n    ** the entire-list will be searched for that page.\n    */\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( eMode==BTALLOC_EXACT ){\n      if( nearby<=mxPage ){\n        u8 eType;\n        assert( nearby>0 );\n        assert( pBt->autoVacuum );\n        rc = ptrmapGet(pBt, nearby, &eType, 0);\n        if( rc ) return rc;\n        if( eType==PTRMAP_FREEPAGE ){\n          searchList = 1;\n        }\n      }\n    }else if( eMode==BTALLOC_LE ){\n      searchList = 1;\n    }\n#endif\n\n    /* Decrement the free-list count by 1. Set iTrunk to the index of the\n    ** first free-list trunk page. iPrevTrunk is initially 1.\n    */\n    rc = sqlite3PagerWrite(pPage1->pDbPage);\n    if( rc ) return rc;\n    put4byte(&pPage1->aData[36], n-1);\n\n    /* The code within this loop is run only once if the 'searchList' variable\n    ** is not true. Otherwise, it runs once for each trunk-page on the\n    ** free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT)\n    ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT)\n    */\n    do {\n      pPrevTrunk = pTrunk;\n      if( pPrevTrunk ){\n        /* EVIDENCE-OF: R-01506-11053 The first integer on a freelist trunk page\n        ** is the page number of the next freelist trunk page in the list or\n        ** zero if this is the last freelist trunk page. */\n        iTrunk = get4byte(&pPrevTrunk->aData[0]);\n      }else{\n        /* EVIDENCE-OF: R-59841-13798 The 4-byte big-endian integer at offset 32\n        ** stores the page number of the first page of the freelist, or zero if\n        ** the freelist is empty. */\n        iTrunk = get4byte(&pPage1->aData[32]);\n      }\n      testcase( iTrunk==mxPage );\n      if( iTrunk>mxPage || nSearch++ > n ){\n        rc = SQLITE_CORRUPT_BKPT;\n      }else{\n        rc = btreeGetUnusedPage(pBt, iTrunk, &pTrunk, 0);\n      }\n      if( rc ){\n        pTrunk = 0;\n        goto end_allocate_page;\n      }\n      assert( pTrunk!=0 );\n      assert( pTrunk->aData!=0 );\n      /* EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page\n      ** is the number of leaf page pointers to follow. */\n      k = get4byte(&pTrunk->aData[4]);\n      if( k==0 && !searchList ){\n        /* The trunk has no leaves and the list is not being searched. \n        ** So extract the trunk page itself and use it as the newly \n        ** allocated page */\n        assert( pPrevTrunk==0 );\n        rc = sqlite3PagerWrite(pTrunk->pDbPage);\n        if( rc ){\n          goto end_allocate_page;\n        }\n        *pPgno = iTrunk;\n        memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);\n        *ppPage = pTrunk;\n        pTrunk = 0;\n        TRACE((\"ALLOCATE: %d trunk - %d free pages left\\n\", *pPgno, n-1));\n      }else if( k>(u32)(pBt->usableSize/4 - 2) ){\n        /* Value of k is out of range.  Database corruption */\n        rc = SQLITE_CORRUPT_BKPT;\n        goto end_allocate_page;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      }else if( searchList \n            && (nearby==iTrunk || (iTrunk<nearby && eMode==BTALLOC_LE)) \n      ){\n        /* The list is being searched and this trunk page is the page\n        ** to allocate, regardless of whether it has leaves.\n        */\n        *pPgno = iTrunk;\n        *ppPage = pTrunk;\n        searchList = 0;\n        rc = sqlite3PagerWrite(pTrunk->pDbPage);\n        if( rc ){\n          goto end_allocate_page;\n        }\n        if( k==0 ){\n          if( !pPrevTrunk ){\n            memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);\n          }else{\n            rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);\n            if( rc!=SQLITE_OK ){\n              goto end_allocate_page;\n            }\n            memcpy(&pPrevTrunk->aData[0], &pTrunk->aData[0], 4);\n          }\n        }else{\n          /* The trunk page is required by the caller but it contains \n          ** pointers to free-list leaves. The first leaf becomes a trunk\n          ** page in this case.\n          */\n          MemPage *pNewTrunk;\n          Pgno iNewTrunk = get4byte(&pTrunk->aData[8]);\n          if( iNewTrunk>mxPage ){ \n            rc = SQLITE_CORRUPT_BKPT;\n            goto end_allocate_page;\n          }\n          testcase( iNewTrunk==mxPage );\n          rc = btreeGetUnusedPage(pBt, iNewTrunk, &pNewTrunk, 0);\n          if( rc!=SQLITE_OK ){\n            goto end_allocate_page;\n          }\n          rc = sqlite3PagerWrite(pNewTrunk->pDbPage);\n          if( rc!=SQLITE_OK ){\n            releasePage(pNewTrunk);\n            goto end_allocate_page;\n          }\n          memcpy(&pNewTrunk->aData[0], &pTrunk->aData[0], 4);\n          put4byte(&pNewTrunk->aData[4], k-1);\n          memcpy(&pNewTrunk->aData[8], &pTrunk->aData[12], (k-1)*4);\n          releasePage(pNewTrunk);\n          if( !pPrevTrunk ){\n            assert( sqlite3PagerIswriteable(pPage1->pDbPage) );\n            put4byte(&pPage1->aData[32], iNewTrunk);\n          }else{\n            rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);\n            if( rc ){\n              goto end_allocate_page;\n            }\n            put4byte(&pPrevTrunk->aData[0], iNewTrunk);\n          }\n        }\n        pTrunk = 0;\n        TRACE((\"ALLOCATE: %d trunk - %d free pages left\\n\", *pPgno, n-1));\n#endif\n      }else if( k>0 ){\n        /* Extract a leaf from the trunk */\n        u32 closest;\n        Pgno iPage;\n        unsigned char *aData = pTrunk->aData;\n        if( nearby>0 ){\n          u32 i;\n          closest = 0;\n          if( eMode==BTALLOC_LE ){\n            for(i=0; i<k; i++){\n              iPage = get4byte(&aData[8+i*4]);\n              if( iPage<=nearby ){\n                closest = i;\n                break;\n              }\n            }\n          }else{\n            int dist;\n            dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);\n            for(i=1; i<k; i++){\n              int d2 = sqlite3AbsInt32(get4byte(&aData[8+i*4]) - nearby);\n              if( d2<dist ){\n                closest = i;\n                dist = d2;\n              }\n            }\n          }\n        }else{\n          closest = 0;\n        }\n\n        iPage = get4byte(&aData[8+closest*4]);\n        testcase( iPage==mxPage );\n        if( iPage>mxPage ){\n          rc = SQLITE_CORRUPT_BKPT;\n          goto end_allocate_page;\n        }\n        testcase( iPage==mxPage );\n        if( !searchList \n         || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE)) \n        ){\n          int noContent;\n          *pPgno = iPage;\n          TRACE((\"ALLOCATE: %d was leaf %d of %d on trunk %d\"\n                 \": %d more free pages\\n\",\n                 *pPgno, closest+1, k, pTrunk->pgno, n-1));\n          rc = sqlite3PagerWrite(pTrunk->pDbPage);\n          if( rc ) goto end_allocate_page;\n          if( closest<k-1 ){\n            memcpy(&aData[8+closest*4], &aData[4+k*4], 4);\n          }\n          put4byte(&aData[4], k-1);\n          noContent = !btreeGetHasContent(pBt, *pPgno)? PAGER_GET_NOCONTENT : 0;\n          rc = btreeGetUnusedPage(pBt, *pPgno, ppPage, noContent);\n          if( rc==SQLITE_OK ){\n            rc = sqlite3PagerWrite((*ppPage)->pDbPage);\n            if( rc!=SQLITE_OK ){\n              releasePage(*ppPage);\n              *ppPage = 0;\n            }\n          }\n          searchList = 0;\n        }\n      }\n      releasePage(pPrevTrunk);\n      pPrevTrunk = 0;\n    }while( searchList );\n  }else{\n    /* There are no pages on the freelist, so append a new page to the\n    ** database image.\n    **\n    ** Normally, new pages allocated by this block can be requested from the\n    ** pager layer with the 'no-content' flag set. This prevents the pager\n    ** from trying to read the pages content from disk. However, if the\n    ** current transaction has already run one or more incremental-vacuum\n    ** steps, then the page we are about to allocate may contain content\n    ** that is required in the event of a rollback. In this case, do\n    ** not set the no-content flag. This causes the pager to load and journal\n    ** the current page content before overwriting it.\n    **\n    ** Note that the pager will not actually attempt to load or journal \n    ** content for any page that really does lie past the end of the database\n    ** file on disk. So the effects of disabling the no-content optimization\n    ** here are confined to those pages that lie between the end of the\n    ** database image and the end of the database file.\n    */\n    int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate))? PAGER_GET_NOCONTENT:0;\n\n    rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\n    if( rc ) return rc;\n    pBt->nPage++;\n    if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, pBt->nPage) ){\n      /* If *pPgno refers to a pointer-map page, allocate two new pages\n      ** at the end of the file instead of one. The first allocated page\n      ** becomes a new pointer-map page, the second is used by the caller.\n      */\n      MemPage *pPg = 0;\n      TRACE((\"ALLOCATE: %d from end of file (pointer-map page)\\n\", pBt->nPage));\n      assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );\n      rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);\n      if( rc==SQLITE_OK ){\n        rc = sqlite3PagerWrite(pPg->pDbPage);\n        releasePage(pPg);\n      }\n      if( rc ) return rc;\n      pBt->nPage++;\n      if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ){ pBt->nPage++; }\n    }\n#endif\n    put4byte(28 + (u8*)pBt->pPage1->aData, pBt->nPage);\n    *pPgno = pBt->nPage;\n\n    assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );\n    rc = btreeGetUnusedPage(pBt, *pPgno, ppPage, bNoContent);\n    if( rc ) return rc;\n    rc = sqlite3PagerWrite((*ppPage)->pDbPage);\n    if( rc!=SQLITE_OK ){\n      releasePage(*ppPage);\n      *ppPage = 0;\n    }\n    TRACE((\"ALLOCATE: %d from end of file\\n\", *pPgno));\n  }\n\n  assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );\n\nend_allocate_page:\n  releasePage(pTrunk);\n  releasePage(pPrevTrunk);\n  assert( rc!=SQLITE_OK || sqlite3PagerPageRefcount((*ppPage)->pDbPage)<=1 );\n  assert( rc!=SQLITE_OK || (*ppPage)->isInit==0 );\n  return rc;\n}\n\n/*\n** This function is used to add page iPage to the database file free-list. \n** It is assumed that the page is not already a part of the free-list.\n**\n** The value passed as the second argument to this function is optional.\n** If the caller happens to have a pointer to the MemPage object \n** corresponding to page iPage handy, it may pass it as the second value. \n** Otherwise, it may pass NULL.\n**\n** If a pointer to a MemPage object is passed as the second argument,\n** its reference count is not altered by this function.\n*/\nstatic int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){\n  MemPage *pTrunk = 0;                /* Free-list trunk page */\n  Pgno iTrunk = 0;                    /* Page number of free-list trunk page */ \n  MemPage *pPage1 = pBt->pPage1;      /* Local reference to page 1 */\n  MemPage *pPage;                     /* Page being freed. May be NULL. */\n  int rc;                             /* Return Code */\n  int nFree;                          /* Initial number of pages on free-list */\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( CORRUPT_DB || iPage>1 );\n  assert( !pMemPage || pMemPage->pgno==iPage );\n\n  if( iPage<2 ) return SQLITE_CORRUPT_BKPT;\n  if( pMemPage ){\n    pPage = pMemPage;\n    sqlite3PagerRef(pPage->pDbPage);\n  }else{\n    pPage = btreePageLookup(pBt, iPage);\n  }\n\n  /* Increment the free page count on pPage1 */\n  rc = sqlite3PagerWrite(pPage1->pDbPage);\n  if( rc ) goto freepage_out;\n  nFree = get4byte(&pPage1->aData[36]);\n  put4byte(&pPage1->aData[36], nFree+1);\n\n  if( pBt->btsFlags & BTS_SECURE_DELETE ){\n    /* If the secure_delete option is enabled, then\n    ** always fully overwrite deleted information with zeros.\n    */\n    if( (!pPage && ((rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0) )\n     ||            ((rc = sqlite3PagerWrite(pPage->pDbPage))!=0)\n    ){\n      goto freepage_out;\n    }\n    memset(pPage->aData, 0, pPage->pBt->pageSize);\n  }\n\n  /* If the database supports auto-vacuum, write an entry in the pointer-map\n  ** to indicate that the page is free.\n  */\n  if( ISAUTOVACUUM ){\n    ptrmapPut(pBt, iPage, PTRMAP_FREEPAGE, 0, &rc);\n    if( rc ) goto freepage_out;\n  }\n\n  /* Now manipulate the actual database free-list structure. There are two\n  ** possibilities. If the free-list is currently empty, or if the first\n  ** trunk page in the free-list is full, then this page will become a\n  ** new free-list trunk page. Otherwise, it will become a leaf of the\n  ** first trunk page in the current free-list. This block tests if it\n  ** is possible to add the page as a new free-list leaf.\n  */\n  if( nFree!=0 ){\n    u32 nLeaf;                /* Initial number of leaf cells on trunk page */\n\n    iTrunk = get4byte(&pPage1->aData[32]);\n    rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0);\n    if( rc!=SQLITE_OK ){\n      goto freepage_out;\n    }\n\n    nLeaf = get4byte(&pTrunk->aData[4]);\n    assert( pBt->usableSize>32 );\n    if( nLeaf > (u32)pBt->usableSize/4 - 2 ){\n      rc = SQLITE_CORRUPT_BKPT;\n      goto freepage_out;\n    }\n    if( nLeaf < (u32)pBt->usableSize/4 - 8 ){\n      /* In this case there is room on the trunk page to insert the page\n      ** being freed as a new leaf.\n      **\n      ** Note that the trunk page is not really full until it contains\n      ** usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have\n      ** coded.  But due to a coding error in versions of SQLite prior to\n      ** 3.6.0, databases with freelist trunk pages holding more than\n      ** usableSize/4 - 8 entries will be reported as corrupt.  In order\n      ** to maintain backwards compatibility with older versions of SQLite,\n      ** we will continue to restrict the number of entries to usableSize/4 - 8\n      ** for now.  At some point in the future (once everyone has upgraded\n      ** to 3.6.0 or later) we should consider fixing the conditional above\n      ** to read \"usableSize/4-2\" instead of \"usableSize/4-8\".\n      **\n      ** EVIDENCE-OF: R-19920-11576 However, newer versions of SQLite still\n      ** avoid using the last six entries in the freelist trunk page array in\n      ** order that database files created by newer versions of SQLite can be\n      ** read by older versions of SQLite.\n      */\n      rc = sqlite3PagerWrite(pTrunk->pDbPage);\n      if( rc==SQLITE_OK ){\n        put4byte(&pTrunk->aData[4], nLeaf+1);\n        put4byte(&pTrunk->aData[8+nLeaf*4], iPage);\n        if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){\n          sqlite3PagerDontWrite(pPage->pDbPage);\n        }\n        rc = btreeSetHasContent(pBt, iPage);\n      }\n      TRACE((\"FREE-PAGE: %d leaf on trunk page %d\\n\",pPage->pgno,pTrunk->pgno));\n      goto freepage_out;\n    }\n  }\n\n  /* If control flows to this point, then it was not possible to add the\n  ** the page being freed as a leaf page of the first trunk in the free-list.\n  ** Possibly because the free-list is empty, or possibly because the \n  ** first trunk in the free-list is full. Either way, the page being freed\n  ** will become the new first trunk page in the free-list.\n  */\n  if( pPage==0 && SQLITE_OK!=(rc = btreeGetPage(pBt, iPage, &pPage, 0)) ){\n    goto freepage_out;\n  }\n  rc = sqlite3PagerWrite(pPage->pDbPage);\n  if( rc!=SQLITE_OK ){\n    goto freepage_out;\n  }\n  put4byte(pPage->aData, iTrunk);\n  put4byte(&pPage->aData[4], 0);\n  put4byte(&pPage1->aData[32], iPage);\n  TRACE((\"FREE-PAGE: %d new trunk page replacing %d\\n\", pPage->pgno, iTrunk));\n\nfreepage_out:\n  if( pPage ){\n    pPage->isInit = 0;\n  }\n  releasePage(pPage);\n  releasePage(pTrunk);\n  return rc;\n}\nstatic void freePage(MemPage *pPage, int *pRC){\n  if( (*pRC)==SQLITE_OK ){\n    *pRC = freePage2(pPage->pBt, pPage, pPage->pgno);\n  }\n}\n\n/*\n** Free any overflow pages associated with the given Cell.  Write the\n** local Cell size (the number of bytes on the original page, omitting\n** overflow) into *pnSize.\n*/\nstatic int clearCell(\n  MemPage *pPage,          /* The page that contains the Cell */\n  unsigned char *pCell,    /* First byte of the Cell */\n  u16 *pnSize              /* Write the size of the Cell here */\n){\n  BtShared *pBt = pPage->pBt;\n  CellInfo info;\n  Pgno ovflPgno;\n  int rc;\n  int nOvfl;\n  u32 ovflPageSize;\n\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  pPage->xParseCell(pPage, pCell, &info);\n  *pnSize = info.nSize;\n  if( info.nLocal==info.nPayload ){\n    return SQLITE_OK;  /* No overflow pages. Return without doing anything */\n  }\n  if( pCell+info.nSize-1 > pPage->aData+pPage->maskPage ){\n    return SQLITE_CORRUPT_BKPT;  /* Cell extends past end of page */\n  }\n  ovflPgno = get4byte(pCell + info.nSize - 4);\n  assert( pBt->usableSize > 4 );\n  ovflPageSize = pBt->usableSize - 4;\n  nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;\n  assert( nOvfl>0 || \n    (CORRUPT_DB && (info.nPayload + ovflPageSize)<ovflPageSize)\n  );\n  while( nOvfl-- ){\n    Pgno iNext = 0;\n    MemPage *pOvfl = 0;\n    if( ovflPgno<2 || ovflPgno>btreePagecount(pBt) ){\n      /* 0 is not a legal page number and page 1 cannot be an \n      ** overflow page. Therefore if ovflPgno<2 or past the end of the \n      ** file the database must be corrupt. */\n      return SQLITE_CORRUPT_BKPT;\n    }\n    if( nOvfl ){\n      rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext);\n      if( rc ) return rc;\n    }\n\n    if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )\n     && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1\n    ){\n      /* There is no reason any cursor should have an outstanding reference \n      ** to an overflow page belonging to a cell that is being deleted/updated.\n      ** So if there exists more than one reference to this page, then it \n      ** must not really be an overflow page and the database must be corrupt. \n      ** It is helpful to detect this before calling freePage2(), as \n      ** freePage2() may zero the page contents if secure-delete mode is\n      ** enabled. If this 'overflow' page happens to be a page that the\n      ** caller is iterating through or using in some other way, this\n      ** can be problematic.\n      */\n      rc = SQLITE_CORRUPT_BKPT;\n    }else{\n      rc = freePage2(pBt, pOvfl, ovflPgno);\n    }\n\n    if( pOvfl ){\n      sqlite3PagerUnref(pOvfl->pDbPage);\n    }\n    if( rc ) return rc;\n    ovflPgno = iNext;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Create the byte sequence used to represent a cell on page pPage\n** and write that byte sequence into pCell[].  Overflow pages are\n** allocated and filled in as necessary.  The calling procedure\n** is responsible for making sure sufficient space has been allocated\n** for pCell[].\n**\n** Note that pCell does not necessary need to point to the pPage->aData\n** area.  pCell might point to some temporary storage.  The cell will\n** be constructed in this temporary area then copied into pPage->aData\n** later.\n*/\nstatic int fillInCell(\n  MemPage *pPage,                /* The page that contains the cell */\n  unsigned char *pCell,          /* Complete text of the cell */\n  const BtreePayload *pX,        /* Payload with which to construct the cell */\n  int *pnSize                    /* Write cell size here */\n){\n  int nPayload;\n  const u8 *pSrc;\n  int nSrc, n, rc;\n  int spaceLeft;\n  MemPage *pOvfl = 0;\n  MemPage *pToRelease = 0;\n  unsigned char *pPrior;\n  unsigned char *pPayload;\n  BtShared *pBt = pPage->pBt;\n  Pgno pgnoOvfl = 0;\n  int nHeader;\n\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n\n  /* pPage is not necessarily writeable since pCell might be auxiliary\n  ** buffer space that is separate from the pPage buffer area */\n  assert( pCell<pPage->aData || pCell>=&pPage->aData[pBt->pageSize]\n            || sqlite3PagerIswriteable(pPage->pDbPage) );\n\n  /* Fill in the header. */\n  nHeader = pPage->childPtrSize;\n  if( pPage->intKey ){\n    nPayload = pX->nData + pX->nZero;\n    pSrc = pX->pData;\n    nSrc = pX->nData;\n    assert( pPage->intKeyLeaf ); /* fillInCell() only called for leaves */\n    nHeader += putVarint32(&pCell[nHeader], nPayload);\n    nHeader += putVarint(&pCell[nHeader], *(u64*)&pX->nKey);\n  }else{\n    assert( pX->nKey<=0x7fffffff && pX->pKey!=0 );\n    nSrc = nPayload = (int)pX->nKey;\n    pSrc = pX->pKey;\n    nHeader += putVarint32(&pCell[nHeader], nPayload);\n  }\n  \n  /* Fill in the payload */\n  if( nPayload<=pPage->maxLocal ){\n    n = nHeader + nPayload;\n    testcase( n==3 );\n    testcase( n==4 );\n    if( n<4 ) n = 4;\n    *pnSize = n;\n    spaceLeft = nPayload;\n    pPrior = pCell;\n  }else{\n    int mn = pPage->minLocal;\n    n = mn + (nPayload - mn) % (pPage->pBt->usableSize - 4);\n    testcase( n==pPage->maxLocal );\n    testcase( n==pPage->maxLocal+1 );\n    if( n > pPage->maxLocal ) n = mn;\n    spaceLeft = n;\n    *pnSize = n + nHeader + 4;\n    pPrior = &pCell[nHeader+n];\n  }\n  pPayload = &pCell[nHeader];\n\n  /* At this point variables should be set as follows:\n  **\n  **   nPayload           Total payload size in bytes\n  **   pPayload           Begin writing payload here\n  **   spaceLeft          Space available at pPayload.  If nPayload>spaceLeft,\n  **                      that means content must spill into overflow pages.\n  **   *pnSize            Size of the local cell (not counting overflow pages)\n  **   pPrior             Where to write the pgno of the first overflow page\n  **\n  ** Use a call to btreeParseCellPtr() to verify that the values above\n  ** were computed correctly.\n  */\n#if SQLITE_DEBUG\n  {\n    CellInfo info;\n    pPage->xParseCell(pPage, pCell, &info);\n    assert( nHeader==(int)(info.pPayload - pCell) );\n    assert( info.nKey==pX->nKey );\n    assert( *pnSize == info.nSize );\n    assert( spaceLeft == info.nLocal );\n  }\n#endif\n\n  /* Write the payload into the local Cell and any extra into overflow pages */\n  while( nPayload>0 ){\n    if( spaceLeft==0 ){\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */\n      if( pBt->autoVacuum ){\n        do{\n          pgnoOvfl++;\n        } while( \n          PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) \n        );\n      }\n#endif\n      rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, 0);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      /* If the database supports auto-vacuum, and the second or subsequent\n      ** overflow page is being allocated, add an entry to the pointer-map\n      ** for that page now. \n      **\n      ** If this is the first overflow page, then write a partial entry \n      ** to the pointer-map. If we write nothing to this pointer-map slot,\n      ** then the optimistic overflow chain processing in clearCell()\n      ** may misinterpret the uninitialized values and delete the\n      ** wrong pages from the database.\n      */\n      if( pBt->autoVacuum && rc==SQLITE_OK ){\n        u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1);\n        ptrmapPut(pBt, pgnoOvfl, eType, pgnoPtrmap, &rc);\n        if( rc ){\n          releasePage(pOvfl);\n        }\n      }\n#endif\n      if( rc ){\n        releasePage(pToRelease);\n        return rc;\n      }\n\n      /* If pToRelease is not zero than pPrior points into the data area\n      ** of pToRelease.  Make sure pToRelease is still writeable. */\n      assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );\n\n      /* If pPrior is part of the data area of pPage, then make sure pPage\n      ** is still writeable */\n      assert( pPrior<pPage->aData || pPrior>=&pPage->aData[pBt->pageSize]\n            || sqlite3PagerIswriteable(pPage->pDbPage) );\n\n      put4byte(pPrior, pgnoOvfl);\n      releasePage(pToRelease);\n      pToRelease = pOvfl;\n      pPrior = pOvfl->aData;\n      put4byte(pPrior, 0);\n      pPayload = &pOvfl->aData[4];\n      spaceLeft = pBt->usableSize - 4;\n    }\n    n = nPayload;\n    if( n>spaceLeft ) n = spaceLeft;\n\n    /* If pToRelease is not zero than pPayload points into the data area\n    ** of pToRelease.  Make sure pToRelease is still writeable. */\n    assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );\n\n    /* If pPayload is part of the data area of pPage, then make sure pPage\n    ** is still writeable */\n    assert( pPayload<pPage->aData || pPayload>=&pPage->aData[pBt->pageSize]\n            || sqlite3PagerIswriteable(pPage->pDbPage) );\n\n    if( nSrc>0 ){\n      if( n>nSrc ) n = nSrc;\n      assert( pSrc );\n      memcpy(pPayload, pSrc, n);\n    }else{\n      memset(pPayload, 0, n);\n    }\n    nPayload -= n;\n    pPayload += n;\n    pSrc += n;\n    nSrc -= n;\n    spaceLeft -= n;\n  }\n  releasePage(pToRelease);\n  return SQLITE_OK;\n}\n\n/*\n** Remove the i-th cell from pPage.  This routine effects pPage only.\n** The cell content is not freed or deallocated.  It is assumed that\n** the cell content has been copied someplace else.  This routine just\n** removes the reference to the cell from pPage.\n**\n** \"sz\" must be the number of bytes in the cell.\n*/\nstatic void dropCell(MemPage *pPage, int idx, int sz, int *pRC){\n  u32 pc;         /* Offset to cell content of cell being deleted */\n  u8 *data;       /* pPage->aData */\n  u8 *ptr;        /* Used to move bytes around within data[] */\n  int rc;         /* The return code */\n  int hdr;        /* Beginning of the header.  0 most pages.  100 page 1 */\n\n  if( *pRC ) return;\n\n  assert( idx>=0 && idx<pPage->nCell );\n  assert( CORRUPT_DB || sz==cellSize(pPage, idx) );\n  assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  data = pPage->aData;\n  ptr = &pPage->aCellIdx[2*idx];\n  pc = get2byte(ptr);\n  hdr = pPage->hdrOffset;\n  testcase( pc==get2byte(&data[hdr+5]) );\n  testcase( pc+sz==pPage->pBt->usableSize );\n  if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){\n    *pRC = SQLITE_CORRUPT_BKPT;\n    return;\n  }\n  rc = freeSpace(pPage, pc, sz);\n  if( rc ){\n    *pRC = rc;\n    return;\n  }\n  pPage->nCell--;\n  if( pPage->nCell==0 ){\n    memset(&data[hdr+1], 0, 4);\n    data[hdr+7] = 0;\n    put2byte(&data[hdr+5], pPage->pBt->usableSize);\n    pPage->nFree = pPage->pBt->usableSize - pPage->hdrOffset\n                       - pPage->childPtrSize - 8;\n  }else{\n    memmove(ptr, ptr+2, 2*(pPage->nCell - idx));\n    put2byte(&data[hdr+3], pPage->nCell);\n    pPage->nFree += 2;\n  }\n}\n\n/*\n** Insert a new cell on pPage at cell index \"i\".  pCell points to the\n** content of the cell.\n**\n** If the cell content will fit on the page, then put it there.  If it\n** will not fit, then make a copy of the cell content into pTemp if\n** pTemp is not null.  Regardless of pTemp, allocate a new entry\n** in pPage->apOvfl[] and make it point to the cell content (either\n** in pTemp or the original pCell) and also record its index. \n** Allocating a new entry in pPage->aCell[] implies that \n** pPage->nOverflow is incremented.\n**\n** *pRC must be SQLITE_OK when this routine is called.\n*/\nstatic void insertCell(\n  MemPage *pPage,   /* Page into which we are copying */\n  int i,            /* New cell becomes the i-th cell of the page */\n  u8 *pCell,        /* Content of the new cell */\n  int sz,           /* Bytes of content in pCell */\n  u8 *pTemp,        /* Temp storage space for pCell, if needed */\n  Pgno iChild,      /* If non-zero, replace first 4 bytes with this value */\n  int *pRC          /* Read and write return code from here */\n){\n  int idx = 0;      /* Where to write new cell content in data[] */\n  int j;            /* Loop counter */\n  u8 *data;         /* The content of the whole page */\n  u8 *pIns;         /* The point in pPage->aCellIdx[] where no cell inserted */\n\n  assert( *pRC==SQLITE_OK );\n  assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );\n  assert( MX_CELL(pPage->pBt)<=10921 );\n  assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB );\n  assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) );\n  assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) );\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  /* The cell should normally be sized correctly.  However, when moving a\n  ** malformed cell from a leaf page to an interior page, if the cell size\n  ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size\n  ** might be less than 8 (leaf-size + pointer) on the interior node.  Hence\n  ** the term after the || in the following assert(). */\n  assert( sz==pPage->xCellSize(pPage, pCell) || (sz==8 && iChild>0) );\n  if( pPage->nOverflow || sz+2>pPage->nFree ){\n    if( pTemp ){\n      memcpy(pTemp, pCell, sz);\n      pCell = pTemp;\n    }\n    if( iChild ){\n      put4byte(pCell, iChild);\n    }\n    j = pPage->nOverflow++;\n    assert( j<(int)(sizeof(pPage->apOvfl)/sizeof(pPage->apOvfl[0])) );\n    pPage->apOvfl[j] = pCell;\n    pPage->aiOvfl[j] = (u16)i;\n\n    /* When multiple overflows occur, they are always sequential and in\n    ** sorted order.  This invariants arise because multiple overflows can\n    ** only occur when inserting divider cells into the parent page during\n    ** balancing, and the dividers are adjacent and sorted.\n    */\n    assert( j==0 || pPage->aiOvfl[j-1]<(u16)i ); /* Overflows in sorted order */\n    assert( j==0 || i==pPage->aiOvfl[j-1]+1 );   /* Overflows are sequential */\n  }else{\n    int rc = sqlite3PagerWrite(pPage->pDbPage);\n    if( rc!=SQLITE_OK ){\n      *pRC = rc;\n      return;\n    }\n    assert( sqlite3PagerIswriteable(pPage->pDbPage) );\n    data = pPage->aData;\n    assert( &data[pPage->cellOffset]==pPage->aCellIdx );\n    rc = allocateSpace(pPage, sz, &idx);\n    if( rc ){ *pRC = rc; return; }\n    /* The allocateSpace() routine guarantees the following properties\n    ** if it returns successfully */\n    assert( idx >= 0 );\n    assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB );\n    assert( idx+sz <= (int)pPage->pBt->usableSize );\n    pPage->nFree -= (u16)(2 + sz);\n    memcpy(&data[idx], pCell, sz);\n    if( iChild ){\n      put4byte(&data[idx], iChild);\n    }\n    pIns = pPage->aCellIdx + i*2;\n    memmove(pIns+2, pIns, 2*(pPage->nCell - i));\n    put2byte(pIns, idx);\n    pPage->nCell++;\n    /* increment the cell count */\n    if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;\n    assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell );\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( pPage->pBt->autoVacuum ){\n      /* The cell may contain a pointer to an overflow page. If so, write\n      ** the entry for the overflow page into the pointer map.\n      */\n      ptrmapPutOvflPtr(pPage, pCell, pRC);\n    }\n#endif\n  }\n}\n\n/*\n** A CellArray object contains a cache of pointers and sizes for a\n** consecutive sequence of cells that might be held on multiple pages.\n*/\ntypedef struct CellArray CellArray;\nstruct CellArray {\n  int nCell;              /* Number of cells in apCell[] */\n  MemPage *pRef;          /* Reference page */\n  u8 **apCell;            /* All cells begin balanced */\n  u16 *szCell;            /* Local size of all cells in apCell[] */\n};\n\n/*\n** Make sure the cell sizes at idx, idx+1, ..., idx+N-1 have been\n** computed.\n*/\nstatic void populateCellCache(CellArray *p, int idx, int N){\n  assert( idx>=0 && idx+N<=p->nCell );\n  while( N>0 ){\n    assert( p->apCell[idx]!=0 );\n    if( p->szCell[idx]==0 ){\n      p->szCell[idx] = p->pRef->xCellSize(p->pRef, p->apCell[idx]);\n    }else{\n      assert( CORRUPT_DB ||\n              p->szCell[idx]==p->pRef->xCellSize(p->pRef, p->apCell[idx]) );\n    }\n    idx++;\n    N--;\n  }\n}\n\n/*\n** Return the size of the Nth element of the cell array\n*/\nstatic SQLITE_NOINLINE u16 computeCellSize(CellArray *p, int N){\n  assert( N>=0 && N<p->nCell );\n  assert( p->szCell[N]==0 );\n  p->szCell[N] = p->pRef->xCellSize(p->pRef, p->apCell[N]);\n  return p->szCell[N];\n}\nstatic u16 cachedCellSize(CellArray *p, int N){\n  assert( N>=0 && N<p->nCell );\n  if( p->szCell[N] ) return p->szCell[N];\n  return computeCellSize(p, N);\n}\n\n/*\n** Array apCell[] contains pointers to nCell b-tree page cells. The \n** szCell[] array contains the size in bytes of each cell. This function\n** replaces the current contents of page pPg with the contents of the cell\n** array.\n**\n** Some of the cells in apCell[] may currently be stored in pPg. This\n** function works around problems caused by this by making a copy of any \n** such cells before overwriting the page data.\n**\n** The MemPage.nFree field is invalidated by this function. It is the \n** responsibility of the caller to set it correctly.\n*/\nstatic int rebuildPage(\n  MemPage *pPg,                   /* Edit this page */\n  int nCell,                      /* Final number of cells on page */\n  u8 **apCell,                    /* Array of cells */\n  u16 *szCell                     /* Array of cell sizes */\n){\n  const int hdr = pPg->hdrOffset;          /* Offset of header on pPg */\n  u8 * const aData = pPg->aData;           /* Pointer to data for pPg */\n  const int usableSize = pPg->pBt->usableSize;\n  u8 * const pEnd = &aData[usableSize];\n  int i;\n  u8 *pCellptr = pPg->aCellIdx;\n  u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);\n  u8 *pData;\n\n  i = get2byte(&aData[hdr+5]);\n  memcpy(&pTmp[i], &aData[i], usableSize - i);\n\n  pData = pEnd;\n  for(i=0; i<nCell; i++){\n    u8 *pCell = apCell[i];\n    if( SQLITE_WITHIN(pCell,aData,pEnd) ){\n      pCell = &pTmp[pCell - aData];\n    }\n    pData -= szCell[i];\n    put2byte(pCellptr, (pData - aData));\n    pCellptr += 2;\n    if( pData < pCellptr ) return SQLITE_CORRUPT_BKPT;\n    memcpy(pData, pCell, szCell[i]);\n    assert( szCell[i]==pPg->xCellSize(pPg, pCell) || CORRUPT_DB );\n    testcase( szCell[i]!=pPg->xCellSize(pPg,pCell) );\n  }\n\n  /* The pPg->nFree field is now set incorrectly. The caller will fix it. */\n  pPg->nCell = nCell;\n  pPg->nOverflow = 0;\n\n  put2byte(&aData[hdr+1], 0);\n  put2byte(&aData[hdr+3], pPg->nCell);\n  put2byte(&aData[hdr+5], pData - aData);\n  aData[hdr+7] = 0x00;\n  return SQLITE_OK;\n}\n\n/*\n** Array apCell[] contains nCell pointers to b-tree cells. Array szCell\n** contains the size in bytes of each such cell. This function attempts to \n** add the cells stored in the array to page pPg. If it cannot (because \n** the page needs to be defragmented before the cells will fit), non-zero\n** is returned. Otherwise, if the cells are added successfully, zero is\n** returned.\n**\n** Argument pCellptr points to the first entry in the cell-pointer array\n** (part of page pPg) to populate. After cell apCell[0] is written to the\n** page body, a 16-bit offset is written to pCellptr. And so on, for each\n** cell in the array. It is the responsibility of the caller to ensure\n** that it is safe to overwrite this part of the cell-pointer array.\n**\n** When this function is called, *ppData points to the start of the \n** content area on page pPg. If the size of the content area is extended,\n** *ppData is updated to point to the new start of the content area\n** before returning.\n**\n** Finally, argument pBegin points to the byte immediately following the\n** end of the space required by this page for the cell-pointer area (for\n** all cells - not just those inserted by the current call). If the content\n** area must be extended to before this point in order to accomodate all\n** cells in apCell[], then the cells do not fit and non-zero is returned.\n*/\nstatic int pageInsertArray(\n  MemPage *pPg,                   /* Page to add cells to */\n  u8 *pBegin,                     /* End of cell-pointer array */\n  u8 **ppData,                    /* IN/OUT: Page content -area pointer */\n  u8 *pCellptr,                   /* Pointer to cell-pointer area */\n  int iFirst,                     /* Index of first cell to add */\n  int nCell,                      /* Number of cells to add to pPg */\n  CellArray *pCArray              /* Array of cells */\n){\n  int i;\n  u8 *aData = pPg->aData;\n  u8 *pData = *ppData;\n  int iEnd = iFirst + nCell;\n  assert( CORRUPT_DB || pPg->hdrOffset==0 );    /* Never called on page 1 */\n  for(i=iFirst; i<iEnd; i++){\n    int sz, rc;\n    u8 *pSlot;\n    sz = cachedCellSize(pCArray, i);\n    if( (aData[1]==0 && aData[2]==0) || (pSlot = pageFindSlot(pPg,sz,&rc))==0 ){\n      if( (pData - pBegin)<sz ) return 1;\n      pData -= sz;\n      pSlot = pData;\n    }\n    /* pSlot and pCArray->apCell[i] will never overlap on a well-formed\n    ** database.  But they might for a corrupt database.  Hence use memmove()\n    ** since memcpy() sends SIGABORT with overlapping buffers on OpenBSD */\n    assert( (pSlot+sz)<=pCArray->apCell[i]\n         || pSlot>=(pCArray->apCell[i]+sz)\n         || CORRUPT_DB );\n    memmove(pSlot, pCArray->apCell[i], sz);\n    put2byte(pCellptr, (pSlot - aData));\n    pCellptr += 2;\n  }\n  *ppData = pData;\n  return 0;\n}\n\n/*\n** Array apCell[] contains nCell pointers to b-tree cells. Array szCell \n** contains the size in bytes of each such cell. This function adds the\n** space associated with each cell in the array that is currently stored \n** within the body of pPg to the pPg free-list. The cell-pointers and other\n** fields of the page are not updated.\n**\n** This function returns the total number of cells added to the free-list.\n*/\nstatic int pageFreeArray(\n  MemPage *pPg,                   /* Page to edit */\n  int iFirst,                     /* First cell to delete */\n  int nCell,                      /* Cells to delete */\n  CellArray *pCArray              /* Array of cells */\n){\n  u8 * const aData = pPg->aData;\n  u8 * const pEnd = &aData[pPg->pBt->usableSize];\n  u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize];\n  int nRet = 0;\n  int i;\n  int iEnd = iFirst + nCell;\n  u8 *pFree = 0;\n  int szFree = 0;\n\n  for(i=iFirst; i<iEnd; i++){\n    u8 *pCell = pCArray->apCell[i];\n    if( SQLITE_WITHIN(pCell, pStart, pEnd) ){\n      int sz;\n      /* No need to use cachedCellSize() here.  The sizes of all cells that\n      ** are to be freed have already been computing while deciding which\n      ** cells need freeing */\n      sz = pCArray->szCell[i];  assert( sz>0 );\n      if( pFree!=(pCell + sz) ){\n        if( pFree ){\n          assert( pFree>aData && (pFree - aData)<65536 );\n          freeSpace(pPg, (u16)(pFree - aData), szFree);\n        }\n        pFree = pCell;\n        szFree = sz;\n        if( pFree+sz>pEnd ) return 0;\n      }else{\n        pFree = pCell;\n        szFree += sz;\n      }\n      nRet++;\n    }\n  }\n  if( pFree ){\n    assert( pFree>aData && (pFree - aData)<65536 );\n    freeSpace(pPg, (u16)(pFree - aData), szFree);\n  }\n  return nRet;\n}\n\n/*\n** apCell[] and szCell[] contains pointers to and sizes of all cells in the\n** pages being balanced.  The current page, pPg, has pPg->nCell cells starting\n** with apCell[iOld].  After balancing, this page should hold nNew cells\n** starting at apCell[iNew].\n**\n** This routine makes the necessary adjustments to pPg so that it contains\n** the correct cells after being balanced.\n**\n** The pPg->nFree field is invalid when this function returns. It is the\n** responsibility of the caller to set it correctly.\n*/\nstatic int editPage(\n  MemPage *pPg,                   /* Edit this page */\n  int iOld,                       /* Index of first cell currently on page */\n  int iNew,                       /* Index of new first cell on page */\n  int nNew,                       /* Final number of cells on page */\n  CellArray *pCArray              /* Array of cells and sizes */\n){\n  u8 * const aData = pPg->aData;\n  const int hdr = pPg->hdrOffset;\n  u8 *pBegin = &pPg->aCellIdx[nNew * 2];\n  int nCell = pPg->nCell;       /* Cells stored on pPg */\n  u8 *pData;\n  u8 *pCellptr;\n  int i;\n  int iOldEnd = iOld + pPg->nCell + pPg->nOverflow;\n  int iNewEnd = iNew + nNew;\n\n#ifdef SQLITE_DEBUG\n  u8 *pTmp = sqlite3PagerTempSpace(pPg->pBt->pPager);\n  memcpy(pTmp, aData, pPg->pBt->usableSize);\n#endif\n\n  /* Remove cells from the start and end of the page */\n  if( iOld<iNew ){\n    int nShift = pageFreeArray(pPg, iOld, iNew-iOld, pCArray);\n    memmove(pPg->aCellIdx, &pPg->aCellIdx[nShift*2], nCell*2);\n    nCell -= nShift;\n  }\n  if( iNewEnd < iOldEnd ){\n    nCell -= pageFreeArray(pPg, iNewEnd, iOldEnd - iNewEnd, pCArray);\n  }\n\n  pData = &aData[get2byteNotZero(&aData[hdr+5])];\n  if( pData<pBegin ) goto editpage_fail;\n\n  /* Add cells to the start of the page */\n  if( iNew<iOld ){\n    int nAdd = MIN(nNew,iOld-iNew);\n    assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB );\n    pCellptr = pPg->aCellIdx;\n    memmove(&pCellptr[nAdd*2], pCellptr, nCell*2);\n    if( pageInsertArray(\n          pPg, pBegin, &pData, pCellptr,\n          iNew, nAdd, pCArray\n    ) ) goto editpage_fail;\n    nCell += nAdd;\n  }\n\n  /* Add any overflow cells */\n  for(i=0; i<pPg->nOverflow; i++){\n    int iCell = (iOld + pPg->aiOvfl[i]) - iNew;\n    if( iCell>=0 && iCell<nNew ){\n      pCellptr = &pPg->aCellIdx[iCell * 2];\n      memmove(&pCellptr[2], pCellptr, (nCell - iCell) * 2);\n      nCell++;\n      if( pageInsertArray(\n            pPg, pBegin, &pData, pCellptr,\n            iCell+iNew, 1, pCArray\n      ) ) goto editpage_fail;\n    }\n  }\n\n  /* Append cells to the end of the page */\n  pCellptr = &pPg->aCellIdx[nCell*2];\n  if( pageInsertArray(\n        pPg, pBegin, &pData, pCellptr,\n        iNew+nCell, nNew-nCell, pCArray\n  ) ) goto editpage_fail;\n\n  pPg->nCell = nNew;\n  pPg->nOverflow = 0;\n\n  put2byte(&aData[hdr+3], pPg->nCell);\n  put2byte(&aData[hdr+5], pData - aData);\n\n#ifdef SQLITE_DEBUG\n  for(i=0; i<nNew && !CORRUPT_DB; i++){\n    u8 *pCell = pCArray->apCell[i+iNew];\n    int iOff = get2byteAligned(&pPg->aCellIdx[i*2]);\n    if( SQLITE_WITHIN(pCell, aData, &aData[pPg->pBt->usableSize]) ){\n      pCell = &pTmp[pCell - aData];\n    }\n    assert( 0==memcmp(pCell, &aData[iOff],\n            pCArray->pRef->xCellSize(pCArray->pRef, pCArray->apCell[i+iNew])) );\n  }\n#endif\n\n  return SQLITE_OK;\n editpage_fail:\n  /* Unable to edit this page. Rebuild it from scratch instead. */\n  populateCellCache(pCArray, iNew, nNew);\n  return rebuildPage(pPg, nNew, &pCArray->apCell[iNew], &pCArray->szCell[iNew]);\n}\n\n/*\n** The following parameters determine how many adjacent pages get involved\n** in a balancing operation.  NN is the number of neighbors on either side\n** of the page that participate in the balancing operation.  NB is the\n** total number of pages that participate, including the target page and\n** NN neighbors on either side.\n**\n** The minimum value of NN is 1 (of course).  Increasing NN above 1\n** (to 2 or 3) gives a modest improvement in SELECT and DELETE performance\n** in exchange for a larger degradation in INSERT and UPDATE performance.\n** The value of NN appears to give the best results overall.\n*/\n#define NN 1             /* Number of neighbors on either side of pPage */\n#define NB (NN*2+1)      /* Total pages involved in the balance */\n\n\n#ifndef SQLITE_OMIT_QUICKBALANCE\n/*\n** This version of balance() handles the common special case where\n** a new entry is being inserted on the extreme right-end of the\n** tree, in other words, when the new entry will become the largest\n** entry in the tree.\n**\n** Instead of trying to balance the 3 right-most leaf pages, just add\n** a new page to the right-hand side and put the one new entry in\n** that page.  This leaves the right side of the tree somewhat\n** unbalanced.  But odds are that we will be inserting new entries\n** at the end soon afterwards so the nearly empty page will quickly\n** fill up.  On average.\n**\n** pPage is the leaf page which is the right-most page in the tree.\n** pParent is its parent.  pPage must have a single overflow entry\n** which is also the right-most entry on the page.\n**\n** The pSpace buffer is used to store a temporary copy of the divider\n** cell that will be inserted into pParent. Such a cell consists of a 4\n** byte page number followed by a variable length integer. In other\n** words, at most 13 bytes. Hence the pSpace buffer must be at\n** least 13 bytes in size.\n*/\nstatic int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){\n  BtShared *const pBt = pPage->pBt;    /* B-Tree Database */\n  MemPage *pNew;                       /* Newly allocated page */\n  int rc;                              /* Return Code */\n  Pgno pgnoNew;                        /* Page number of pNew */\n\n  assert( sqlite3_mutex_held(pPage->pBt->mutex) );\n  assert( sqlite3PagerIswriteable(pParent->pDbPage) );\n  assert( pPage->nOverflow==1 );\n\n  /* This error condition is now caught prior to reaching this function */\n  if( NEVER(pPage->nCell==0) ) return SQLITE_CORRUPT_BKPT;\n\n  /* Allocate a new page. This page will become the right-sibling of \n  ** pPage. Make the parent page writable, so that the new divider cell\n  ** may be inserted. If both these operations are successful, proceed.\n  */\n  rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);\n\n  if( rc==SQLITE_OK ){\n\n    u8 *pOut = &pSpace[4];\n    u8 *pCell = pPage->apOvfl[0];\n    u16 szCell = pPage->xCellSize(pPage, pCell);\n    u8 *pStop;\n\n    assert( sqlite3PagerIswriteable(pNew->pDbPage) );\n    assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) );\n    zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF);\n    rc = rebuildPage(pNew, 1, &pCell, &szCell);\n    if( NEVER(rc) ) return rc;\n    pNew->nFree = pBt->usableSize - pNew->cellOffset - 2 - szCell;\n\n    /* If this is an auto-vacuum database, update the pointer map\n    ** with entries for the new page, and any pointer from the \n    ** cell on the page to an overflow page. If either of these\n    ** operations fails, the return code is set, but the contents\n    ** of the parent page are still manipulated by thh code below.\n    ** That is Ok, at this point the parent page is guaranteed to\n    ** be marked as dirty. Returning an error code will cause a\n    ** rollback, undoing any changes made to the parent page.\n    */\n    if( ISAUTOVACUUM ){\n      ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc);\n      if( szCell>pNew->minLocal ){\n        ptrmapPutOvflPtr(pNew, pCell, &rc);\n      }\n    }\n  \n    /* Create a divider cell to insert into pParent. The divider cell\n    ** consists of a 4-byte page number (the page number of pPage) and\n    ** a variable length key value (which must be the same value as the\n    ** largest key on pPage).\n    **\n    ** To find the largest key value on pPage, first find the right-most \n    ** cell on pPage. The first two fields of this cell are the \n    ** record-length (a variable length integer at most 32-bits in size)\n    ** and the key value (a variable length integer, may have any value).\n    ** The first of the while(...) loops below skips over the record-length\n    ** field. The second while(...) loop copies the key value from the\n    ** cell on pPage into the pSpace buffer.\n    */\n    pCell = findCell(pPage, pPage->nCell-1);\n    pStop = &pCell[9];\n    while( (*(pCell++)&0x80) && pCell<pStop );\n    pStop = &pCell[9];\n    while( ((*(pOut++) = *(pCell++))&0x80) && pCell<pStop );\n\n    /* Insert the new divider cell into pParent. */\n    if( rc==SQLITE_OK ){\n      insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace),\n                   0, pPage->pgno, &rc);\n    }\n\n    /* Set the right-child pointer of pParent to point to the new page. */\n    put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew);\n  \n    /* Release the reference to the new page. */\n    releasePage(pNew);\n  }\n\n  return rc;\n}\n#endif /* SQLITE_OMIT_QUICKBALANCE */\n\n#if 0\n/*\n** This function does not contribute anything to the operation of SQLite.\n** it is sometimes activated temporarily while debugging code responsible \n** for setting pointer-map entries.\n*/\nstatic int ptrmapCheckPages(MemPage **apPage, int nPage){\n  int i, j;\n  for(i=0; i<nPage; i++){\n    Pgno n;\n    u8 e;\n    MemPage *pPage = apPage[i];\n    BtShared *pBt = pPage->pBt;\n    assert( pPage->isInit );\n\n    for(j=0; j<pPage->nCell; j++){\n      CellInfo info;\n      u8 *z;\n     \n      z = findCell(pPage, j);\n      pPage->xParseCell(pPage, z, &info);\n      if( info.nLocal<info.nPayload ){\n        Pgno ovfl = get4byte(&z[info.nSize-4]);\n        ptrmapGet(pBt, ovfl, &e, &n);\n        assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 );\n      }\n      if( !pPage->leaf ){\n        Pgno child = get4byte(z);\n        ptrmapGet(pBt, child, &e, &n);\n        assert( n==pPage->pgno && e==PTRMAP_BTREE );\n      }\n    }\n    if( !pPage->leaf ){\n      Pgno child = get4byte(&pPage->aData[pPage->hdrOffset+8]);\n      ptrmapGet(pBt, child, &e, &n);\n      assert( n==pPage->pgno && e==PTRMAP_BTREE );\n    }\n  }\n  return 1;\n}\n#endif\n\n/*\n** This function is used to copy the contents of the b-tree node stored \n** on page pFrom to page pTo. If page pFrom was not a leaf page, then\n** the pointer-map entries for each child page are updated so that the\n** parent page stored in the pointer map is page pTo. If pFrom contained\n** any cells with overflow page pointers, then the corresponding pointer\n** map entries are also updated so that the parent page is page pTo.\n**\n** If pFrom is currently carrying any overflow cells (entries in the\n** MemPage.apOvfl[] array), they are not copied to pTo. \n**\n** Before returning, page pTo is reinitialized using btreeInitPage().\n**\n** The performance of this function is not critical. It is only used by \n** the balance_shallower() and balance_deeper() procedures, neither of\n** which are called often under normal circumstances.\n*/\nstatic void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){\n  if( (*pRC)==SQLITE_OK ){\n    BtShared * const pBt = pFrom->pBt;\n    u8 * const aFrom = pFrom->aData;\n    u8 * const aTo = pTo->aData;\n    int const iFromHdr = pFrom->hdrOffset;\n    int const iToHdr = ((pTo->pgno==1) ? 100 : 0);\n    int rc;\n    int iData;\n  \n  \n    assert( pFrom->isInit );\n    assert( pFrom->nFree>=iToHdr );\n    assert( get2byte(&aFrom[iFromHdr+5]) <= (int)pBt->usableSize );\n  \n    /* Copy the b-tree node content from page pFrom to page pTo. */\n    iData = get2byte(&aFrom[iFromHdr+5]);\n    memcpy(&aTo[iData], &aFrom[iData], pBt->usableSize-iData);\n    memcpy(&aTo[iToHdr], &aFrom[iFromHdr], pFrom->cellOffset + 2*pFrom->nCell);\n  \n    /* Reinitialize page pTo so that the contents of the MemPage structure\n    ** match the new data. The initialization of pTo can actually fail under\n    ** fairly obscure circumstances, even though it is a copy of initialized \n    ** page pFrom.\n    */\n    pTo->isInit = 0;\n    rc = btreeInitPage(pTo);\n    if( rc!=SQLITE_OK ){\n      *pRC = rc;\n      return;\n    }\n  \n    /* If this is an auto-vacuum database, update the pointer-map entries\n    ** for any b-tree or overflow pages that pTo now contains the pointers to.\n    */\n    if( ISAUTOVACUUM ){\n      *pRC = setChildPtrmaps(pTo);\n    }\n  }\n}\n\n/*\n** This routine redistributes cells on the iParentIdx'th child of pParent\n** (hereafter \"the page\") and up to 2 siblings so that all pages have about the\n** same amount of free space. Usually a single sibling on either side of the\n** page are used in the balancing, though both siblings might come from one\n** side if the page is the first or last child of its parent. If the page \n** has fewer than 2 siblings (something which can only happen if the page\n** is a root page or a child of a root page) then all available siblings\n** participate in the balancing.\n**\n** The number of siblings of the page might be increased or decreased by \n** one or two in an effort to keep pages nearly full but not over full. \n**\n** Note that when this routine is called, some of the cells on the page\n** might not actually be stored in MemPage.aData[]. This can happen\n** if the page is overfull. This routine ensures that all cells allocated\n** to the page and its siblings fit into MemPage.aData[] before returning.\n**\n** In the course of balancing the page and its siblings, cells may be\n** inserted into or removed from the parent page (pParent). Doing so\n** may cause the parent page to become overfull or underfull. If this\n** happens, it is the responsibility of the caller to invoke the correct\n** balancing routine to fix this problem (see the balance() routine). \n**\n** If this routine fails for any reason, it might leave the database\n** in a corrupted state. So if this routine fails, the database should\n** be rolled back.\n**\n** The third argument to this function, aOvflSpace, is a pointer to a\n** buffer big enough to hold one page. If while inserting cells into the parent\n** page (pParent) the parent page becomes overfull, this buffer is\n** used to store the parent's overflow cells. Because this function inserts\n** a maximum of four divider cells into the parent page, and the maximum\n** size of a cell stored within an internal node is always less than 1/4\n** of the page-size, the aOvflSpace[] buffer is guaranteed to be large\n** enough for all overflow cells.\n**\n** If aOvflSpace is set to a null pointer, this function returns \n** SQLITE_NOMEM.\n*/\nstatic int balance_nonroot(\n  MemPage *pParent,               /* Parent page of siblings being balanced */\n  int iParentIdx,                 /* Index of \"the page\" in pParent */\n  u8 *aOvflSpace,                 /* page-size bytes of space for parent ovfl */\n  int isRoot,                     /* True if pParent is a root-page */\n  int bBulk                       /* True if this call is part of a bulk load */\n){\n  BtShared *pBt;               /* The whole database */\n  int nMaxCells = 0;           /* Allocated size of apCell, szCell, aFrom. */\n  int nNew = 0;                /* Number of pages in apNew[] */\n  int nOld;                    /* Number of pages in apOld[] */\n  int i, j, k;                 /* Loop counters */\n  int nxDiv;                   /* Next divider slot in pParent->aCell[] */\n  int rc = SQLITE_OK;          /* The return code */\n  u16 leafCorrection;          /* 4 if pPage is a leaf.  0 if not */\n  int leafData;                /* True if pPage is a leaf of a LEAFDATA tree */\n  int usableSpace;             /* Bytes in pPage beyond the header */\n  int pageFlags;               /* Value of pPage->aData[0] */\n  int iSpace1 = 0;             /* First unused byte of aSpace1[] */\n  int iOvflSpace = 0;          /* First unused byte of aOvflSpace[] */\n  int szScratch;               /* Size of scratch memory requested */\n  MemPage *apOld[NB];          /* pPage and up to two siblings */\n  MemPage *apNew[NB+2];        /* pPage and up to NB siblings after balancing */\n  u8 *pRight;                  /* Location in parent of right-sibling pointer */\n  u8 *apDiv[NB-1];             /* Divider cells in pParent */\n  int cntNew[NB+2];            /* Index in b.paCell[] of cell after i-th page */\n  int cntOld[NB+2];            /* Old index in b.apCell[] */\n  int szNew[NB+2];             /* Combined size of cells placed on i-th page */\n  u8 *aSpace1;                 /* Space for copies of dividers cells */\n  Pgno pgno;                   /* Temp var to store a page number in */\n  u8 abDone[NB+2];             /* True after i'th new page is populated */\n  Pgno aPgno[NB+2];            /* Page numbers of new pages before shuffling */\n  Pgno aPgOrder[NB+2];         /* Copy of aPgno[] used for sorting pages */\n  u16 aPgFlags[NB+2];          /* flags field of new pages before shuffling */\n  CellArray b;                  /* Parsed information on cells being balanced */\n\n  memset(abDone, 0, sizeof(abDone));\n  b.nCell = 0;\n  b.apCell = 0;\n  pBt = pParent->pBt;\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  assert( sqlite3PagerIswriteable(pParent->pDbPage) );\n\n#if 0\n  TRACE((\"BALANCE: begin page %d child of %d\\n\", pPage->pgno, pParent->pgno));\n#endif\n\n  /* At this point pParent may have at most one overflow cell. And if\n  ** this overflow cell is present, it must be the cell with \n  ** index iParentIdx. This scenario comes about when this function\n  ** is called (indirectly) from sqlite3BtreeDelete().\n  */\n  assert( pParent->nOverflow==0 || pParent->nOverflow==1 );\n  assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx );\n\n  if( !aOvflSpace ){\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  /* Find the sibling pages to balance. Also locate the cells in pParent \n  ** that divide the siblings. An attempt is made to find NN siblings on \n  ** either side of pPage. More siblings are taken from one side, however, \n  ** if there are fewer than NN siblings on the other side. If pParent\n  ** has NB or fewer children then all children of pParent are taken.  \n  **\n  ** This loop also drops the divider cells from the parent page. This\n  ** way, the remainder of the function does not have to deal with any\n  ** overflow cells in the parent page, since if any existed they will\n  ** have already been removed.\n  */\n  i = pParent->nOverflow + pParent->nCell;\n  if( i<2 ){\n    nxDiv = 0;\n  }else{\n    assert( bBulk==0 || bBulk==1 );\n    if( iParentIdx==0 ){                 \n      nxDiv = 0;\n    }else if( iParentIdx==i ){\n      nxDiv = i-2+bBulk;\n    }else{\n      nxDiv = iParentIdx-1;\n    }\n    i = 2-bBulk;\n  }\n  nOld = i+1;\n  if( (i+nxDiv-pParent->nOverflow)==pParent->nCell ){\n    pRight = &pParent->aData[pParent->hdrOffset+8];\n  }else{\n    pRight = findCell(pParent, i+nxDiv-pParent->nOverflow);\n  }\n  pgno = get4byte(pRight);\n  while( 1 ){\n    rc = getAndInitPage(pBt, pgno, &apOld[i], 0, 0);\n    if( rc ){\n      memset(apOld, 0, (i+1)*sizeof(MemPage*));\n      goto balance_cleanup;\n    }\n    nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;\n    if( (i--)==0 ) break;\n\n    if( i+nxDiv==pParent->aiOvfl[0] && pParent->nOverflow ){\n      apDiv[i] = pParent->apOvfl[0];\n      pgno = get4byte(apDiv[i]);\n      szNew[i] = pParent->xCellSize(pParent, apDiv[i]);\n      pParent->nOverflow = 0;\n    }else{\n      apDiv[i] = findCell(pParent, i+nxDiv-pParent->nOverflow);\n      pgno = get4byte(apDiv[i]);\n      szNew[i] = pParent->xCellSize(pParent, apDiv[i]);\n\n      /* Drop the cell from the parent page. apDiv[i] still points to\n      ** the cell within the parent, even though it has been dropped.\n      ** This is safe because dropping a cell only overwrites the first\n      ** four bytes of it, and this function does not need the first\n      ** four bytes of the divider cell. So the pointer is safe to use\n      ** later on.  \n      **\n      ** But not if we are in secure-delete mode. In secure-delete mode,\n      ** the dropCell() routine will overwrite the entire cell with zeroes.\n      ** In this case, temporarily copy the cell into the aOvflSpace[]\n      ** buffer. It will be copied out again as soon as the aSpace[] buffer\n      ** is allocated.  */\n      if( pBt->btsFlags & BTS_SECURE_DELETE ){\n        int iOff;\n\n        iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);\n        if( (iOff+szNew[i])>(int)pBt->usableSize ){\n          rc = SQLITE_CORRUPT_BKPT;\n          memset(apOld, 0, (i+1)*sizeof(MemPage*));\n          goto balance_cleanup;\n        }else{\n          memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]);\n          apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData];\n        }\n      }\n      dropCell(pParent, i+nxDiv-pParent->nOverflow, szNew[i], &rc);\n    }\n  }\n\n  /* Make nMaxCells a multiple of 4 in order to preserve 8-byte\n  ** alignment */\n  nMaxCells = (nMaxCells + 3)&~3;\n\n  /*\n  ** Allocate space for memory structures\n  */\n  szScratch =\n       nMaxCells*sizeof(u8*)                       /* b.apCell */\n     + nMaxCells*sizeof(u16)                       /* b.szCell */\n     + pBt->pageSize;                              /* aSpace1 */\n\n  /* EVIDENCE-OF: R-28375-38319 SQLite will never request a scratch buffer\n  ** that is more than 6 times the database page size. */\n  assert( szScratch<=6*(int)pBt->pageSize );\n  b.apCell = sqlite3ScratchMalloc( szScratch ); \n  if( b.apCell==0 ){\n    rc = SQLITE_NOMEM_BKPT;\n    goto balance_cleanup;\n  }\n  b.szCell = (u16*)&b.apCell[nMaxCells];\n  aSpace1 = (u8*)&b.szCell[nMaxCells];\n  assert( EIGHT_BYTE_ALIGNMENT(aSpace1) );\n\n  /*\n  ** Load pointers to all cells on sibling pages and the divider cells\n  ** into the local b.apCell[] array.  Make copies of the divider cells\n  ** into space obtained from aSpace1[]. The divider cells have already\n  ** been removed from pParent.\n  **\n  ** If the siblings are on leaf pages, then the child pointers of the\n  ** divider cells are stripped from the cells before they are copied\n  ** into aSpace1[].  In this way, all cells in b.apCell[] are without\n  ** child pointers.  If siblings are not leaves, then all cell in\n  ** b.apCell[] include child pointers.  Either way, all cells in b.apCell[]\n  ** are alike.\n  **\n  ** leafCorrection:  4 if pPage is a leaf.  0 if pPage is not a leaf.\n  **       leafData:  1 if pPage holds key+data and pParent holds only keys.\n  */\n  b.pRef = apOld[0];\n  leafCorrection = b.pRef->leaf*4;\n  leafData = b.pRef->intKeyLeaf;\n  for(i=0; i<nOld; i++){\n    MemPage *pOld = apOld[i];\n    int limit = pOld->nCell;\n    u8 *aData = pOld->aData;\n    u16 maskPage = pOld->maskPage;\n    u8 *piCell = aData + pOld->cellOffset;\n    u8 *piEnd;\n\n    /* Verify that all sibling pages are of the same \"type\" (table-leaf,\n    ** table-interior, index-leaf, or index-interior).\n    */\n    if( pOld->aData[0]!=apOld[0]->aData[0] ){\n      rc = SQLITE_CORRUPT_BKPT;\n      goto balance_cleanup;\n    }\n\n    /* Load b.apCell[] with pointers to all cells in pOld.  If pOld\n    ** constains overflow cells, include them in the b.apCell[] array\n    ** in the correct spot.\n    **\n    ** Note that when there are multiple overflow cells, it is always the\n    ** case that they are sequential and adjacent.  This invariant arises\n    ** because multiple overflows can only occurs when inserting divider\n    ** cells into a parent on a prior balance, and divider cells are always\n    ** adjacent and are inserted in order.  There is an assert() tagged\n    ** with \"NOTE 1\" in the overflow cell insertion loop to prove this\n    ** invariant.\n    **\n    ** This must be done in advance.  Once the balance starts, the cell\n    ** offset section of the btree page will be overwritten and we will no\n    ** long be able to find the cells if a pointer to each cell is not saved\n    ** first.\n    */\n    memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow));\n    if( pOld->nOverflow>0 ){\n      limit = pOld->aiOvfl[0];\n      for(j=0; j<limit; j++){\n        b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));\n        piCell += 2;\n        b.nCell++;\n      }\n      for(k=0; k<pOld->nOverflow; k++){\n        assert( k==0 || pOld->aiOvfl[k-1]+1==pOld->aiOvfl[k] );/* NOTE 1 */\n        b.apCell[b.nCell] = pOld->apOvfl[k];\n        b.nCell++;\n      }\n    }\n    piEnd = aData + pOld->cellOffset + 2*pOld->nCell;\n    while( piCell<piEnd ){\n      assert( b.nCell<nMaxCells );\n      b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell));\n      piCell += 2;\n      b.nCell++;\n    }\n\n    cntOld[i] = b.nCell;\n    if( i<nOld-1 && !leafData){\n      u16 sz = (u16)szNew[i];\n      u8 *pTemp;\n      assert( b.nCell<nMaxCells );\n      b.szCell[b.nCell] = sz;\n      pTemp = &aSpace1[iSpace1];\n      iSpace1 += sz;\n      assert( sz<=pBt->maxLocal+23 );\n      assert( iSpace1 <= (int)pBt->pageSize );\n      memcpy(pTemp, apDiv[i], sz);\n      b.apCell[b.nCell] = pTemp+leafCorrection;\n      assert( leafCorrection==0 || leafCorrection==4 );\n      b.szCell[b.nCell] = b.szCell[b.nCell] - leafCorrection;\n      if( !pOld->leaf ){\n        assert( leafCorrection==0 );\n        assert( pOld->hdrOffset==0 );\n        /* The right pointer of the child page pOld becomes the left\n        ** pointer of the divider cell */\n        memcpy(b.apCell[b.nCell], &pOld->aData[8], 4);\n      }else{\n        assert( leafCorrection==4 );\n        while( b.szCell[b.nCell]<4 ){\n          /* Do not allow any cells smaller than 4 bytes. If a smaller cell\n          ** does exist, pad it with 0x00 bytes. */\n          assert( b.szCell[b.nCell]==3 || CORRUPT_DB );\n          assert( b.apCell[b.nCell]==&aSpace1[iSpace1-3] || CORRUPT_DB );\n          aSpace1[iSpace1++] = 0x00;\n          b.szCell[b.nCell]++;\n        }\n      }\n      b.nCell++;\n    }\n  }\n\n  /*\n  ** Figure out the number of pages needed to hold all b.nCell cells.\n  ** Store this number in \"k\".  Also compute szNew[] which is the total\n  ** size of all cells on the i-th page and cntNew[] which is the index\n  ** in b.apCell[] of the cell that divides page i from page i+1.  \n  ** cntNew[k] should equal b.nCell.\n  **\n  ** Values computed by this block:\n  **\n  **           k: The total number of sibling pages\n  **    szNew[i]: Spaced used on the i-th sibling page.\n  **   cntNew[i]: Index in b.apCell[] and b.szCell[] for the first cell to\n  **              the right of the i-th sibling page.\n  ** usableSpace: Number of bytes of space available on each sibling.\n  ** \n  */\n  usableSpace = pBt->usableSize - 12 + leafCorrection;\n  for(i=0; i<nOld; i++){\n    MemPage *p = apOld[i];\n    szNew[i] = usableSpace - p->nFree;\n    if( szNew[i]<0 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }\n    for(j=0; j<p->nOverflow; j++){\n      szNew[i] += 2 + p->xCellSize(p, p->apOvfl[j]);\n    }\n    cntNew[i] = cntOld[i];\n  }\n  k = nOld;\n  for(i=0; i<k; i++){\n    int sz;\n    while( szNew[i]>usableSpace ){\n      if( i+1>=k ){\n        k = i+2;\n        if( k>NB+2 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }\n        szNew[k-1] = 0;\n        cntNew[k-1] = b.nCell;\n      }\n      sz = 2 + cachedCellSize(&b, cntNew[i]-1);\n      szNew[i] -= sz;\n      if( !leafData ){\n        if( cntNew[i]<b.nCell ){\n          sz = 2 + cachedCellSize(&b, cntNew[i]);\n        }else{\n          sz = 0;\n        }\n      }\n      szNew[i+1] += sz;\n      cntNew[i]--;\n    }\n    while( cntNew[i]<b.nCell ){\n      sz = 2 + cachedCellSize(&b, cntNew[i]);\n      if( szNew[i]+sz>usableSpace ) break;\n      szNew[i] += sz;\n      cntNew[i]++;\n      if( !leafData ){\n        if( cntNew[i]<b.nCell ){\n          sz = 2 + cachedCellSize(&b, cntNew[i]);\n        }else{\n          sz = 0;\n        }\n      }\n      szNew[i+1] -= sz;\n    }\n    if( cntNew[i]>=b.nCell ){\n      k = i+1;\n    }else if( cntNew[i] <= (i>0 ? cntNew[i-1] : 0) ){\n      rc = SQLITE_CORRUPT_BKPT;\n      goto balance_cleanup;\n    }\n  }\n\n  /*\n  ** The packing computed by the previous block is biased toward the siblings\n  ** on the left side (siblings with smaller keys). The left siblings are\n  ** always nearly full, while the right-most sibling might be nearly empty.\n  ** The next block of code attempts to adjust the packing of siblings to\n  ** get a better balance.\n  **\n  ** This adjustment is more than an optimization.  The packing above might\n  ** be so out of balance as to be illegal.  For example, the right-most\n  ** sibling might be completely empty.  This adjustment is not optional.\n  */\n  for(i=k-1; i>0; i--){\n    int szRight = szNew[i];  /* Size of sibling on the right */\n    int szLeft = szNew[i-1]; /* Size of sibling on the left */\n    int r;              /* Index of right-most cell in left sibling */\n    int d;              /* Index of first cell to the left of right sibling */\n\n    r = cntNew[i-1] - 1;\n    d = r + 1 - leafData;\n    (void)cachedCellSize(&b, d);\n    do{\n      assert( d<nMaxCells );\n      assert( r<nMaxCells );\n      (void)cachedCellSize(&b, r);\n      if( szRight!=0\n       && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+(i==k-1?0:2)))){\n        break;\n      }\n      szRight += b.szCell[d] + 2;\n      szLeft -= b.szCell[r] + 2;\n      cntNew[i-1] = r;\n      r--;\n      d--;\n    }while( r>=0 );\n    szNew[i] = szRight;\n    szNew[i-1] = szLeft;\n    if( cntNew[i-1] <= (i>1 ? cntNew[i-2] : 0) ){\n      rc = SQLITE_CORRUPT_BKPT;\n      goto balance_cleanup;\n    }\n  }\n\n  /* Sanity check:  For a non-corrupt database file one of the follwing\n  ** must be true:\n  **    (1) We found one or more cells (cntNew[0])>0), or\n  **    (2) pPage is a virtual root page.  A virtual root page is when\n  **        the real root page is page 1 and we are the only child of\n  **        that page.\n  */\n  assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);\n  TRACE((\"BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\\n\",\n    apOld[0]->pgno, apOld[0]->nCell,\n    nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,\n    nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0\n  ));\n\n  /*\n  ** Allocate k new pages.  Reuse old pages where possible.\n  */\n  pageFlags = apOld[0]->aData[0];\n  for(i=0; i<k; i++){\n    MemPage *pNew;\n    if( i<nOld ){\n      pNew = apNew[i] = apOld[i];\n      apOld[i] = 0;\n      rc = sqlite3PagerWrite(pNew->pDbPage);\n      nNew++;\n      if( rc ) goto balance_cleanup;\n    }else{\n      assert( i>0 );\n      rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0);\n      if( rc ) goto balance_cleanup;\n      zeroPage(pNew, pageFlags);\n      apNew[i] = pNew;\n      nNew++;\n      cntOld[i] = b.nCell;\n\n      /* Set the pointer-map entry for the new sibling page. */\n      if( ISAUTOVACUUM ){\n        ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc);\n        if( rc!=SQLITE_OK ){\n          goto balance_cleanup;\n        }\n      }\n    }\n  }\n\n  /*\n  ** Reassign page numbers so that the new pages are in ascending order. \n  ** This helps to keep entries in the disk file in order so that a scan\n  ** of the table is closer to a linear scan through the file. That in turn \n  ** helps the operating system to deliver pages from the disk more rapidly.\n  **\n  ** An O(n^2) insertion sort algorithm is used, but since n is never more \n  ** than (NB+2) (a small constant), that should not be a problem.\n  **\n  ** When NB==3, this one optimization makes the database about 25% faster \n  ** for large insertions and deletions.\n  */\n  for(i=0; i<nNew; i++){\n    aPgOrder[i] = aPgno[i] = apNew[i]->pgno;\n    aPgFlags[i] = apNew[i]->pDbPage->flags;\n    for(j=0; j<i; j++){\n      if( aPgno[j]==aPgno[i] ){\n        /* This branch is taken if the set of sibling pages somehow contains\n        ** duplicate entries. This can happen if the database is corrupt. \n        ** It would be simpler to detect this as part of the loop below, but\n        ** we do the detection here in order to avoid populating the pager\n        ** cache with two separate objects associated with the same\n        ** page number.  */\n        assert( CORRUPT_DB );\n        rc = SQLITE_CORRUPT_BKPT;\n        goto balance_cleanup;\n      }\n    }\n  }\n  for(i=0; i<nNew; i++){\n    int iBest = 0;                /* aPgno[] index of page number to use */\n    for(j=1; j<nNew; j++){\n      if( aPgOrder[j]<aPgOrder[iBest] ) iBest = j;\n    }\n    pgno = aPgOrder[iBest];\n    aPgOrder[iBest] = 0xffffffff;\n    if( iBest!=i ){\n      if( iBest>i ){\n        sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0);\n      }\n      sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]);\n      apNew[i]->pgno = pgno;\n    }\n  }\n\n  TRACE((\"BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) \"\n         \"%d(%d nc=%d) %d(%d nc=%d)\\n\",\n    apNew[0]->pgno, szNew[0], cntNew[0],\n    nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,\n    nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,\n    nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,\n    nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,\n    nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0,\n    nNew>=4 ? cntNew[3] - cntNew[2] - !leafData : 0,\n    nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0,\n    nNew>=5 ? cntNew[4] - cntNew[3] - !leafData : 0\n  ));\n\n  assert( sqlite3PagerIswriteable(pParent->pDbPage) );\n  put4byte(pRight, apNew[nNew-1]->pgno);\n\n  /* If the sibling pages are not leaves, ensure that the right-child pointer\n  ** of the right-most new sibling page is set to the value that was \n  ** originally in the same field of the right-most old sibling page. */\n  if( (pageFlags & PTF_LEAF)==0 && nOld!=nNew ){\n    MemPage *pOld = (nNew>nOld ? apNew : apOld)[nOld-1];\n    memcpy(&apNew[nNew-1]->aData[8], &pOld->aData[8], 4);\n  }\n\n  /* Make any required updates to pointer map entries associated with \n  ** cells stored on sibling pages following the balance operation. Pointer\n  ** map entries associated with divider cells are set by the insertCell()\n  ** routine. The associated pointer map entries are:\n  **\n  **   a) if the cell contains a reference to an overflow chain, the\n  **      entry associated with the first page in the overflow chain, and\n  **\n  **   b) if the sibling pages are not leaves, the child page associated\n  **      with the cell.\n  **\n  ** If the sibling pages are not leaves, then the pointer map entry \n  ** associated with the right-child of each sibling may also need to be \n  ** updated. This happens below, after the sibling pages have been \n  ** populated, not here.\n  */\n  if( ISAUTOVACUUM ){\n    MemPage *pNew = apNew[0];\n    u8 *aOld = pNew->aData;\n    int cntOldNext = pNew->nCell + pNew->nOverflow;\n    int usableSize = pBt->usableSize;\n    int iNew = 0;\n    int iOld = 0;\n\n    for(i=0; i<b.nCell; i++){\n      u8 *pCell = b.apCell[i];\n      if( i==cntOldNext ){\n        MemPage *pOld = (++iOld)<nNew ? apNew[iOld] : apOld[iOld];\n        cntOldNext += pOld->nCell + pOld->nOverflow + !leafData;\n        aOld = pOld->aData;\n      }\n      if( i==cntNew[iNew] ){\n        pNew = apNew[++iNew];\n        if( !leafData ) continue;\n      }\n\n      /* Cell pCell is destined for new sibling page pNew. Originally, it\n      ** was either part of sibling page iOld (possibly an overflow cell), \n      ** or else the divider cell to the left of sibling page iOld. So,\n      ** if sibling page iOld had the same page number as pNew, and if\n      ** pCell really was a part of sibling page iOld (not a divider or\n      ** overflow cell), we can skip updating the pointer map entries.  */\n      if( iOld>=nNew\n       || pNew->pgno!=aPgno[iOld]\n       || !SQLITE_WITHIN(pCell,aOld,&aOld[usableSize])\n      ){\n        if( !leafCorrection ){\n          ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno, &rc);\n        }\n        if( cachedCellSize(&b,i)>pNew->minLocal ){\n          ptrmapPutOvflPtr(pNew, pCell, &rc);\n        }\n        if( rc ) goto balance_cleanup;\n      }\n    }\n  }\n\n  /* Insert new divider cells into pParent. */\n  for(i=0; i<nNew-1; i++){\n    u8 *pCell;\n    u8 *pTemp;\n    int sz;\n    MemPage *pNew = apNew[i];\n    j = cntNew[i];\n\n    assert( j<nMaxCells );\n    assert( b.apCell[j]!=0 );\n    pCell = b.apCell[j];\n    sz = b.szCell[j] + leafCorrection;\n    pTemp = &aOvflSpace[iOvflSpace];\n    if( !pNew->leaf ){\n      memcpy(&pNew->aData[8], pCell, 4);\n    }else if( leafData ){\n      /* If the tree is a leaf-data tree, and the siblings are leaves, \n      ** then there is no divider cell in b.apCell[]. Instead, the divider \n      ** cell consists of the integer key for the right-most cell of \n      ** the sibling-page assembled above only.\n      */\n      CellInfo info;\n      j--;\n      pNew->xParseCell(pNew, b.apCell[j], &info);\n      pCell = pTemp;\n      sz = 4 + putVarint(&pCell[4], info.nKey);\n      pTemp = 0;\n    }else{\n      pCell -= 4;\n      /* Obscure case for non-leaf-data trees: If the cell at pCell was\n      ** previously stored on a leaf node, and its reported size was 4\n      ** bytes, then it may actually be smaller than this \n      ** (see btreeParseCellPtr(), 4 bytes is the minimum size of\n      ** any cell). But it is important to pass the correct size to \n      ** insertCell(), so reparse the cell now.\n      **\n      ** This can only happen for b-trees used to evaluate \"IN (SELECT ...)\"\n      ** and WITHOUT ROWID tables with exactly one column which is the\n      ** primary key.\n      */\n      if( b.szCell[j]==4 ){\n        assert(leafCorrection==4);\n        sz = pParent->xCellSize(pParent, pCell);\n      }\n    }\n    iOvflSpace += sz;\n    assert( sz<=pBt->maxLocal+23 );\n    assert( iOvflSpace <= (int)pBt->pageSize );\n    insertCell(pParent, nxDiv+i, pCell, sz, pTemp, pNew->pgno, &rc);\n    if( rc!=SQLITE_OK ) goto balance_cleanup;\n    assert( sqlite3PagerIswriteable(pParent->pDbPage) );\n  }\n\n  /* Now update the actual sibling pages. The order in which they are updated\n  ** is important, as this code needs to avoid disrupting any page from which\n  ** cells may still to be read. In practice, this means:\n  **\n  **  (1) If cells are moving left (from apNew[iPg] to apNew[iPg-1])\n  **      then it is not safe to update page apNew[iPg] until after\n  **      the left-hand sibling apNew[iPg-1] has been updated.\n  **\n  **  (2) If cells are moving right (from apNew[iPg] to apNew[iPg+1])\n  **      then it is not safe to update page apNew[iPg] until after\n  **      the right-hand sibling apNew[iPg+1] has been updated.\n  **\n  ** If neither of the above apply, the page is safe to update.\n  **\n  ** The iPg value in the following loop starts at nNew-1 goes down\n  ** to 0, then back up to nNew-1 again, thus making two passes over\n  ** the pages.  On the initial downward pass, only condition (1) above\n  ** needs to be tested because (2) will always be true from the previous\n  ** step.  On the upward pass, both conditions are always true, so the\n  ** upwards pass simply processes pages that were missed on the downward\n  ** pass.\n  */\n  for(i=1-nNew; i<nNew; i++){\n    int iPg = i<0 ? -i : i;\n    assert( iPg>=0 && iPg<nNew );\n    if( abDone[iPg] ) continue;         /* Skip pages already processed */\n    if( i>=0                            /* On the upwards pass, or... */\n     || cntOld[iPg-1]>=cntNew[iPg-1]    /* Condition (1) is true */\n    ){\n      int iNew;\n      int iOld;\n      int nNewCell;\n\n      /* Verify condition (1):  If cells are moving left, update iPg\n      ** only after iPg-1 has already been updated. */\n      assert( iPg==0 || cntOld[iPg-1]>=cntNew[iPg-1] || abDone[iPg-1] );\n\n      /* Verify condition (2):  If cells are moving right, update iPg\n      ** only after iPg+1 has already been updated. */\n      assert( cntNew[iPg]>=cntOld[iPg] || abDone[iPg+1] );\n\n      if( iPg==0 ){\n        iNew = iOld = 0;\n        nNewCell = cntNew[0];\n      }else{\n        iOld = iPg<nOld ? (cntOld[iPg-1] + !leafData) : b.nCell;\n        iNew = cntNew[iPg-1] + !leafData;\n        nNewCell = cntNew[iPg] - iNew;\n      }\n\n      rc = editPage(apNew[iPg], iOld, iNew, nNewCell, &b);\n      if( rc ) goto balance_cleanup;\n      abDone[iPg]++;\n      apNew[iPg]->nFree = usableSpace-szNew[iPg];\n      assert( apNew[iPg]->nOverflow==0 );\n      assert( apNew[iPg]->nCell==nNewCell );\n    }\n  }\n\n  /* All pages have been processed exactly once */\n  assert( memcmp(abDone, \"\\01\\01\\01\\01\\01\", nNew)==0 );\n\n  assert( nOld>0 );\n  assert( nNew>0 );\n\n  if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){\n    /* The root page of the b-tree now contains no cells. The only sibling\n    ** page is the right-child of the parent. Copy the contents of the\n    ** child page into the parent, decreasing the overall height of the\n    ** b-tree structure by one. This is described as the \"balance-shallower\"\n    ** sub-algorithm in some documentation.\n    **\n    ** If this is an auto-vacuum database, the call to copyNodeContent() \n    ** sets all pointer-map entries corresponding to database image pages \n    ** for which the pointer is stored within the content being copied.\n    **\n    ** It is critical that the child page be defragmented before being\n    ** copied into the parent, because if the parent is page 1 then it will\n    ** by smaller than the child due to the database header, and so all the\n    ** free space needs to be up front.\n    */\n    assert( nNew==1 || CORRUPT_DB );\n    rc = defragmentPage(apNew[0]);\n    testcase( rc!=SQLITE_OK );\n    assert( apNew[0]->nFree == \n        (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2)\n      || rc!=SQLITE_OK\n    );\n    copyNodeContent(apNew[0], pParent, &rc);\n    freePage(apNew[0], &rc);\n  }else if( ISAUTOVACUUM && !leafCorrection ){\n    /* Fix the pointer map entries associated with the right-child of each\n    ** sibling page. All other pointer map entries have already been taken\n    ** care of.  */\n    for(i=0; i<nNew; i++){\n      u32 key = get4byte(&apNew[i]->aData[8]);\n      ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);\n    }\n  }\n\n  assert( pParent->isInit );\n  TRACE((\"BALANCE: finished: old=%d new=%d cells=%d\\n\",\n          nOld, nNew, b.nCell));\n\n  /* Free any old pages that were not reused as new pages.\n  */\n  for(i=nNew; i<nOld; i++){\n    freePage(apOld[i], &rc);\n  }\n\n#if 0\n  if( ISAUTOVACUUM && rc==SQLITE_OK && apNew[0]->isInit ){\n    /* The ptrmapCheckPages() contains assert() statements that verify that\n    ** all pointer map pages are set correctly. This is helpful while \n    ** debugging. This is usually disabled because a corrupt database may\n    ** cause an assert() statement to fail.  */\n    ptrmapCheckPages(apNew, nNew);\n    ptrmapCheckPages(&pParent, 1);\n  }\n#endif\n\n  /*\n  ** Cleanup before returning.\n  */\nbalance_cleanup:\n  sqlite3ScratchFree(b.apCell);\n  for(i=0; i<nOld; i++){\n    releasePage(apOld[i]);\n  }\n  for(i=0; i<nNew; i++){\n    releasePage(apNew[i]);\n  }\n\n  return rc;\n}\n\n\n/*\n** This function is called when the root page of a b-tree structure is\n** overfull (has one or more overflow pages).\n**\n** A new child page is allocated and the contents of the current root\n** page, including overflow cells, are copied into the child. The root\n** page is then overwritten to make it an empty page with the right-child \n** pointer pointing to the new page.\n**\n** Before returning, all pointer-map entries corresponding to pages \n** that the new child-page now contains pointers to are updated. The\n** entry corresponding to the new right-child pointer of the root\n** page is also updated.\n**\n** If successful, *ppChild is set to contain a reference to the child \n** page and SQLITE_OK is returned. In this case the caller is required\n** to call releasePage() on *ppChild exactly once. If an error occurs,\n** an error code is returned and *ppChild is set to 0.\n*/\nstatic int balance_deeper(MemPage *pRoot, MemPage **ppChild){\n  int rc;                        /* Return value from subprocedures */\n  MemPage *pChild = 0;           /* Pointer to a new child page */\n  Pgno pgnoChild = 0;            /* Page number of the new child page */\n  BtShared *pBt = pRoot->pBt;    /* The BTree */\n\n  assert( pRoot->nOverflow>0 );\n  assert( sqlite3_mutex_held(pBt->mutex) );\n\n  /* Make pRoot, the root page of the b-tree, writable. Allocate a new \n  ** page that will become the new right-child of pPage. Copy the contents\n  ** of the node stored on pRoot into the new child page.\n  */\n  rc = sqlite3PagerWrite(pRoot->pDbPage);\n  if( rc==SQLITE_OK ){\n    rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0);\n    copyNodeContent(pRoot, pChild, &rc);\n    if( ISAUTOVACUUM ){\n      ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc);\n    }\n  }\n  if( rc ){\n    *ppChild = 0;\n    releasePage(pChild);\n    return rc;\n  }\n  assert( sqlite3PagerIswriteable(pChild->pDbPage) );\n  assert( sqlite3PagerIswriteable(pRoot->pDbPage) );\n  assert( pChild->nCell==pRoot->nCell );\n\n  TRACE((\"BALANCE: copy root %d into %d\\n\", pRoot->pgno, pChild->pgno));\n\n  /* Copy the overflow cells from pRoot to pChild */\n  memcpy(pChild->aiOvfl, pRoot->aiOvfl,\n         pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));\n  memcpy(pChild->apOvfl, pRoot->apOvfl,\n         pRoot->nOverflow*sizeof(pRoot->apOvfl[0]));\n  pChild->nOverflow = pRoot->nOverflow;\n\n  /* Zero the contents of pRoot. Then install pChild as the right-child. */\n  zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF);\n  put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild);\n\n  *ppChild = pChild;\n  return SQLITE_OK;\n}\n\n/*\n** The page that pCur currently points to has just been modified in\n** some way. This function figures out if this modification means the\n** tree needs to be balanced, and if so calls the appropriate balancing \n** routine. Balancing routines are:\n**\n**   balance_quick()\n**   balance_deeper()\n**   balance_nonroot()\n*/\nstatic int balance(BtCursor *pCur){\n  int rc = SQLITE_OK;\n  const int nMin = pCur->pBt->usableSize * 2 / 3;\n  u8 aBalanceQuickSpace[13];\n  u8 *pFree = 0;\n\n  VVA_ONLY( int balance_quick_called = 0 );\n  VVA_ONLY( int balance_deeper_called = 0 );\n\n  do {\n    int iPage = pCur->iPage;\n    MemPage *pPage = pCur->apPage[iPage];\n\n    if( iPage==0 ){\n      if( pPage->nOverflow ){\n        /* The root page of the b-tree is overfull. In this case call the\n        ** balance_deeper() function to create a new child for the root-page\n        ** and copy the current contents of the root-page to it. The\n        ** next iteration of the do-loop will balance the child page.\n        */ \n        assert( balance_deeper_called==0 );\n        VVA_ONLY( balance_deeper_called++ );\n        rc = balance_deeper(pPage, &pCur->apPage[1]);\n        if( rc==SQLITE_OK ){\n          pCur->iPage = 1;\n          pCur->aiIdx[0] = 0;\n          pCur->aiIdx[1] = 0;\n          assert( pCur->apPage[1]->nOverflow );\n        }\n      }else{\n        break;\n      }\n    }else if( pPage->nOverflow==0 && pPage->nFree<=nMin ){\n      break;\n    }else{\n      MemPage * const pParent = pCur->apPage[iPage-1];\n      int const iIdx = pCur->aiIdx[iPage-1];\n\n      rc = sqlite3PagerWrite(pParent->pDbPage);\n      if( rc==SQLITE_OK ){\n#ifndef SQLITE_OMIT_QUICKBALANCE\n        if( pPage->intKeyLeaf\n         && pPage->nOverflow==1\n         && pPage->aiOvfl[0]==pPage->nCell\n         && pParent->pgno!=1\n         && pParent->nCell==iIdx\n        ){\n          /* Call balance_quick() to create a new sibling of pPage on which\n          ** to store the overflow cell. balance_quick() inserts a new cell\n          ** into pParent, which may cause pParent overflow. If this\n          ** happens, the next iteration of the do-loop will balance pParent \n          ** use either balance_nonroot() or balance_deeper(). Until this\n          ** happens, the overflow cell is stored in the aBalanceQuickSpace[]\n          ** buffer. \n          **\n          ** The purpose of the following assert() is to check that only a\n          ** single call to balance_quick() is made for each call to this\n          ** function. If this were not verified, a subtle bug involving reuse\n          ** of the aBalanceQuickSpace[] might sneak in.\n          */\n          assert( balance_quick_called==0 ); \n          VVA_ONLY( balance_quick_called++ );\n          rc = balance_quick(pParent, pPage, aBalanceQuickSpace);\n        }else\n#endif\n        {\n          /* In this case, call balance_nonroot() to redistribute cells\n          ** between pPage and up to 2 of its sibling pages. This involves\n          ** modifying the contents of pParent, which may cause pParent to\n          ** become overfull or underfull. The next iteration of the do-loop\n          ** will balance the parent page to correct this.\n          ** \n          ** If the parent page becomes overfull, the overflow cell or cells\n          ** are stored in the pSpace buffer allocated immediately below. \n          ** A subsequent iteration of the do-loop will deal with this by\n          ** calling balance_nonroot() (balance_deeper() may be called first,\n          ** but it doesn't deal with overflow cells - just moves them to a\n          ** different page). Once this subsequent call to balance_nonroot() \n          ** has completed, it is safe to release the pSpace buffer used by\n          ** the previous call, as the overflow cell data will have been \n          ** copied either into the body of a database page or into the new\n          ** pSpace buffer passed to the latter call to balance_nonroot().\n          */\n          u8 *pSpace = sqlite3PageMalloc(pCur->pBt->pageSize);\n          rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1,\n                               pCur->hints&BTREE_BULKLOAD);\n          if( pFree ){\n            /* If pFree is not NULL, it points to the pSpace buffer used \n            ** by a previous call to balance_nonroot(). Its contents are\n            ** now stored either on real database pages or within the \n            ** new pSpace buffer, so it may be safely freed here. */\n            sqlite3PageFree(pFree);\n          }\n\n          /* The pSpace buffer will be freed after the next call to\n          ** balance_nonroot(), or just before this function returns, whichever\n          ** comes first. */\n          pFree = pSpace;\n        }\n      }\n\n      pPage->nOverflow = 0;\n\n      /* The next iteration of the do-loop balances the parent page. */\n      releasePage(pPage);\n      pCur->iPage--;\n      assert( pCur->iPage>=0 );\n    }\n  }while( rc==SQLITE_OK );\n\n  if( pFree ){\n    sqlite3PageFree(pFree);\n  }\n  return rc;\n}\n\n\n/*\n** Insert a new record into the BTree.  The content of the new record\n** is described by the pX object.  The pCur cursor is used only to\n** define what table the record should be inserted into, and is left\n** pointing at a random location.\n**\n** For a table btree (used for rowid tables), only the pX.nKey value of\n** the key is used. The pX.pKey value must be NULL.  The pX.nKey is the\n** rowid or INTEGER PRIMARY KEY of the row.  The pX.nData,pData,nZero fields\n** hold the content of the row.\n**\n** For an index btree (used for indexes and WITHOUT ROWID tables), the\n** key is an arbitrary byte sequence stored in pX.pKey,nKey.  The \n** pX.pData,nData,nZero fields must be zero.\n**\n** If the seekResult parameter is non-zero, then a successful call to\n** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already\n** been performed. seekResult is the search result returned (a negative\n** number if pCur points at an entry that is smaller than (pKey, nKey), or\n** a positive value if pCur points at an entry that is larger than \n** (pKey, nKey)). \n**\n** If the seekResult parameter is non-zero, then the caller guarantees that\n** cursor pCur is pointing at the existing copy of a row that is to be\n** overwritten.  If the seekResult parameter is 0, then cursor pCur may\n** point to any entry or to no entry at all and so this function has to seek\n** the cursor before the new key can be inserted.\n*/\nint sqlite3BtreeInsert(\n  BtCursor *pCur,                /* Insert data into the table of this cursor */\n  const BtreePayload *pX,        /* Content of the row to be inserted */\n  int appendBias,                /* True if this is likely an append */\n  int seekResult                 /* Result of prior MovetoUnpacked() call */\n){\n  int rc;\n  int loc = seekResult;          /* -1: before desired location  +1: after */\n  int szNew = 0;\n  int idx;\n  MemPage *pPage;\n  Btree *p = pCur->pBtree;\n  BtShared *pBt = p->pBt;\n  unsigned char *oldCell;\n  unsigned char *newCell = 0;\n\n  if( pCur->eState==CURSOR_FAULT ){\n    assert( pCur->skipNext!=SQLITE_OK );\n    return pCur->skipNext;\n  }\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( (pCur->curFlags & BTCF_WriteFlag)!=0\n              && pBt->inTransaction==TRANS_WRITE\n              && (pBt->btsFlags & BTS_READ_ONLY)==0 );\n  assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );\n\n  /* Assert that the caller has been consistent. If this cursor was opened\n  ** expecting an index b-tree, then the caller should be inserting blob\n  ** keys with no associated data. If the cursor was opened expecting an\n  ** intkey table, the caller should be inserting integer keys with a\n  ** blob of associated data.  */\n  assert( (pX->pKey==0)==(pCur->pKeyInfo==0) );\n\n  /* Save the positions of any other cursors open on this table.\n  **\n  ** In some cases, the call to btreeMoveto() below is a no-op. For\n  ** example, when inserting data into a table with auto-generated integer\n  ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the \n  ** integer key to use. It then calls this function to actually insert the \n  ** data into the intkey B-Tree. In this case btreeMoveto() recognizes\n  ** that the cursor is already where it needs to be and returns without\n  ** doing any work. To avoid thwarting these optimizations, it is important\n  ** not to clear the cursor here.\n  */\n  if( pCur->curFlags & BTCF_Multiple ){\n    rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur);\n    if( rc ) return rc;\n  }\n\n  if( pCur->pKeyInfo==0 ){\n    assert( pX->pKey==0 );\n    /* If this is an insert into a table b-tree, invalidate any incrblob \n    ** cursors open on the row being replaced */\n    invalidateIncrblobCursors(p, pX->nKey, 0);\n\n    /* If the cursor is currently on the last row and we are appending a\n    ** new row onto the end, set the \"loc\" to avoid an unnecessary\n    ** btreeMoveto() call */\n    if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey>0\n      && pCur->info.nKey==pX->nKey-1 ){\n       loc = -1;\n    }else if( loc==0 ){\n      rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, appendBias, &loc);\n      if( rc ) return rc;\n    }\n  }else if( loc==0 ){\n    rc = btreeMoveto(pCur, pX->pKey, pX->nKey, appendBias, &loc);\n    if( rc ) return rc;\n  }\n  assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );\n\n  pPage = pCur->apPage[pCur->iPage];\n  assert( pPage->intKey || pX->nKey>=0 );\n  assert( pPage->leaf || !pPage->intKey );\n\n  TRACE((\"INSERT: table=%d nkey=%lld ndata=%d page=%d %s\\n\",\n          pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,\n          loc==0 ? \"overwrite\" : \"new entry\"));\n  assert( pPage->isInit );\n  newCell = pBt->pTmpSpace;\n  assert( newCell!=0 );\n  rc = fillInCell(pPage, newCell, pX, &szNew);\n  if( rc ) goto end_insert;\n  assert( szNew==pPage->xCellSize(pPage, newCell) );\n  assert( szNew <= MX_CELL_SIZE(pBt) );\n  idx = pCur->aiIdx[pCur->iPage];\n  if( loc==0 ){\n    u16 szOld;\n    assert( idx<pPage->nCell );\n    rc = sqlite3PagerWrite(pPage->pDbPage);\n    if( rc ){\n      goto end_insert;\n    }\n    oldCell = findCell(pPage, idx);\n    if( !pPage->leaf ){\n      memcpy(newCell, oldCell, 4);\n    }\n    rc = clearCell(pPage, oldCell, &szOld);\n    dropCell(pPage, idx, szOld, &rc);\n    if( rc ) goto end_insert;\n  }else if( loc<0 && pPage->nCell>0 ){\n    assert( pPage->leaf );\n    idx = ++pCur->aiIdx[pCur->iPage];\n  }else{\n    assert( pPage->leaf );\n  }\n  insertCell(pPage, idx, newCell, szNew, 0, 0, &rc);\n  assert( pPage->nOverflow==0 || rc==SQLITE_OK );\n  assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 );\n\n  /* If no error has occurred and pPage has an overflow cell, call balance() \n  ** to redistribute the cells within the tree. Since balance() may move\n  ** the cursor, zero the BtCursor.info.nSize and BTCF_ValidNKey\n  ** variables.\n  **\n  ** Previous versions of SQLite called moveToRoot() to move the cursor\n  ** back to the root page as balance() used to invalidate the contents\n  ** of BtCursor.apPage[] and BtCursor.aiIdx[]. Instead of doing that,\n  ** set the cursor state to \"invalid\". This makes common insert operations\n  ** slightly faster.\n  **\n  ** There is a subtle but important optimization here too. When inserting\n  ** multiple records into an intkey b-tree using a single cursor (as can\n  ** happen while processing an \"INSERT INTO ... SELECT\" statement), it\n  ** is advantageous to leave the cursor pointing to the last entry in\n  ** the b-tree if possible. If the cursor is left pointing to the last\n  ** entry in the table, and the next row inserted has an integer key\n  ** larger than the largest existing key, it is possible to insert the\n  ** row without seeking the cursor. This can be a big performance boost.\n  */\n  pCur->info.nSize = 0;\n  if( pPage->nOverflow ){\n    assert( rc==SQLITE_OK );\n    pCur->curFlags &= ~(BTCF_ValidNKey);\n    rc = balance(pCur);\n\n    /* Must make sure nOverflow is reset to zero even if the balance()\n    ** fails. Internal data structure corruption will result otherwise. \n    ** Also, set the cursor state to invalid. This stops saveCursorPosition()\n    ** from trying to save the current position of the cursor.  */\n    pCur->apPage[pCur->iPage]->nOverflow = 0;\n    pCur->eState = CURSOR_INVALID;\n  }\n  assert( pCur->apPage[pCur->iPage]->nOverflow==0 );\n\nend_insert:\n  return rc;\n}\n\n/*\n** Delete the entry that the cursor is pointing to. \n**\n** If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then\n** the cursor is left pointing at an arbitrary location after the delete.\n** But if that bit is set, then the cursor is left in a state such that\n** the next call to BtreeNext() or BtreePrev() moves it to the same row\n** as it would have been on if the call to BtreeDelete() had been omitted.\n**\n** The BTREE_AUXDELETE bit of flags indicates that is one of several deletes\n** associated with a single table entry and its indexes.  Only one of those\n** deletes is considered the \"primary\" delete.  The primary delete occurs\n** on a cursor that is not a BTREE_FORDELETE cursor.  All but one delete\n** operation on non-FORDELETE cursors is tagged with the AUXDELETE flag.\n** The BTREE_AUXDELETE bit is a hint that is not used by this implementation,\n** but which might be used by alternative storage engines.\n*/\nint sqlite3BtreeDelete(BtCursor *pCur, u8 flags){\n  Btree *p = pCur->pBtree;\n  BtShared *pBt = p->pBt;              \n  int rc;                              /* Return code */\n  MemPage *pPage;                      /* Page to delete cell from */\n  unsigned char *pCell;                /* Pointer to cell to delete */\n  int iCellIdx;                        /* Index of cell to delete */\n  int iCellDepth;                      /* Depth of node containing pCell */ \n  u16 szCell;                          /* Size of the cell being deleted */\n  int bSkipnext = 0;                   /* Leaf cursor in SKIPNEXT state */\n  u8 bPreserve = flags & BTREE_SAVEPOSITION;  /* Keep cursor valid */\n\n  assert( cursorOwnsBtShared(pCur) );\n  assert( pBt->inTransaction==TRANS_WRITE );\n  assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );\n  assert( pCur->curFlags & BTCF_WriteFlag );\n  assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );\n  assert( !hasReadConflicts(p, pCur->pgnoRoot) );\n  assert( pCur->aiIdx[pCur->iPage]<pCur->apPage[pCur->iPage]->nCell );\n  assert( pCur->eState==CURSOR_VALID );\n  assert( (flags & ~(BTREE_SAVEPOSITION | BTREE_AUXDELETE))==0 );\n\n  iCellDepth = pCur->iPage;\n  iCellIdx = pCur->aiIdx[iCellDepth];\n  pPage = pCur->apPage[iCellDepth];\n  pCell = findCell(pPage, iCellIdx);\n\n  /* If the bPreserve flag is set to true, then the cursor position must\n  ** be preserved following this delete operation. If the current delete\n  ** will cause a b-tree rebalance, then this is done by saving the cursor\n  ** key and leaving the cursor in CURSOR_REQUIRESEEK state before \n  ** returning. \n  **\n  ** Or, if the current delete will not cause a rebalance, then the cursor\n  ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately\n  ** before or after the deleted entry. In this case set bSkipnext to true.  */\n  if( bPreserve ){\n    if( !pPage->leaf \n     || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3)\n    ){\n      /* A b-tree rebalance will be required after deleting this entry.\n      ** Save the cursor key.  */\n      rc = saveCursorKey(pCur);\n      if( rc ) return rc;\n    }else{\n      bSkipnext = 1;\n    }\n  }\n\n  /* If the page containing the entry to delete is not a leaf page, move\n  ** the cursor to the largest entry in the tree that is smaller than\n  ** the entry being deleted. This cell will replace the cell being deleted\n  ** from the internal node. The 'previous' entry is used for this instead\n  ** of the 'next' entry, as the previous entry is always a part of the\n  ** sub-tree headed by the child page of the cell being deleted. This makes\n  ** balancing the tree following the delete operation easier.  */\n  if( !pPage->leaf ){\n    int notUsed = 0;\n    rc = sqlite3BtreePrevious(pCur, &notUsed);\n    if( rc ) return rc;\n  }\n\n  /* Save the positions of any other cursors open on this table before\n  ** making any modifications.  */\n  if( pCur->curFlags & BTCF_Multiple ){\n    rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur);\n    if( rc ) return rc;\n  }\n\n  /* If this is a delete operation to remove a row from a table b-tree,\n  ** invalidate any incrblob cursors open on the row being deleted.  */\n  if( pCur->pKeyInfo==0 ){\n    invalidateIncrblobCursors(p, pCur->info.nKey, 0);\n  }\n\n  /* Make the page containing the entry to be deleted writable. Then free any\n  ** overflow pages associated with the entry and finally remove the cell\n  ** itself from within the page.  */\n  rc = sqlite3PagerWrite(pPage->pDbPage);\n  if( rc ) return rc;\n  rc = clearCell(pPage, pCell, &szCell);\n  dropCell(pPage, iCellIdx, szCell, &rc);\n  if( rc ) return rc;\n\n  /* If the cell deleted was not located on a leaf page, then the cursor\n  ** is currently pointing to the largest entry in the sub-tree headed\n  ** by the child-page of the cell that was just deleted from an internal\n  ** node. The cell from the leaf node needs to be moved to the internal\n  ** node to replace the deleted cell.  */\n  if( !pPage->leaf ){\n    MemPage *pLeaf = pCur->apPage[pCur->iPage];\n    int nCell;\n    Pgno n = pCur->apPage[iCellDepth+1]->pgno;\n    unsigned char *pTmp;\n\n    pCell = findCell(pLeaf, pLeaf->nCell-1);\n    if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT;\n    nCell = pLeaf->xCellSize(pLeaf, pCell);\n    assert( MX_CELL_SIZE(pBt) >= nCell );\n    pTmp = pBt->pTmpSpace;\n    assert( pTmp!=0 );\n    rc = sqlite3PagerWrite(pLeaf->pDbPage);\n    if( rc==SQLITE_OK ){\n      insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc);\n    }\n    dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc);\n    if( rc ) return rc;\n  }\n\n  /* Balance the tree. If the entry deleted was located on a leaf page,\n  ** then the cursor still points to that page. In this case the first\n  ** call to balance() repairs the tree, and the if(...) condition is\n  ** never true.\n  **\n  ** Otherwise, if the entry deleted was on an internal node page, then\n  ** pCur is pointing to the leaf page from which a cell was removed to\n  ** replace the cell deleted from the internal node. This is slightly\n  ** tricky as the leaf node may be underfull, and the internal node may\n  ** be either under or overfull. In this case run the balancing algorithm\n  ** on the leaf node first. If the balance proceeds far enough up the\n  ** tree that we can be sure that any problem in the internal node has\n  ** been corrected, so be it. Otherwise, after balancing the leaf node,\n  ** walk the cursor up the tree to the internal node and balance it as \n  ** well.  */\n  rc = balance(pCur);\n  if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){\n    while( pCur->iPage>iCellDepth ){\n      releasePage(pCur->apPage[pCur->iPage--]);\n    }\n    rc = balance(pCur);\n  }\n\n  if( rc==SQLITE_OK ){\n    if( bSkipnext ){\n      assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) );\n      assert( pPage==pCur->apPage[pCur->iPage] || CORRUPT_DB );\n      assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );\n      pCur->eState = CURSOR_SKIPNEXT;\n      if( iCellIdx>=pPage->nCell ){\n        pCur->skipNext = -1;\n        pCur->aiIdx[iCellDepth] = pPage->nCell-1;\n      }else{\n        pCur->skipNext = 1;\n      }\n    }else{\n      rc = moveToRoot(pCur);\n      if( bPreserve ){\n        pCur->eState = CURSOR_REQUIRESEEK;\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** Create a new BTree table.  Write into *piTable the page\n** number for the root page of the new table.\n**\n** The type of type is determined by the flags parameter.  Only the\n** following values of flags are currently in use.  Other values for\n** flags might not work:\n**\n**     BTREE_INTKEY|BTREE_LEAFDATA     Used for SQL tables with rowid keys\n**     BTREE_ZERODATA                  Used for SQL indices\n*/\nstatic int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){\n  BtShared *pBt = p->pBt;\n  MemPage *pRoot;\n  Pgno pgnoRoot;\n  int rc;\n  int ptfFlags;          /* Page-type flage for the root page of new table */\n\n  assert( sqlite3BtreeHoldsMutex(p) );\n  assert( pBt->inTransaction==TRANS_WRITE );\n  assert( (pBt->btsFlags & BTS_READ_ONLY)==0 );\n\n#ifdef SQLITE_OMIT_AUTOVACUUM\n  rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);\n  if( rc ){\n    return rc;\n  }\n#else\n  if( pBt->autoVacuum ){\n    Pgno pgnoMove;      /* Move a page here to make room for the root-page */\n    MemPage *pPageMove; /* The page to move to. */\n\n    /* Creating a new table may probably require moving an existing database\n    ** to make room for the new tables root page. In case this page turns\n    ** out to be an overflow page, delete all overflow page-map caches\n    ** held by open cursors.\n    */\n    invalidateAllOverflowCache(pBt);\n\n    /* Read the value of meta[3] from the database to determine where the\n    ** root page of the new table should go. meta[3] is the largest root-page\n    ** created so far, so the new root-page is (meta[3]+1).\n    */\n    sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot);\n    pgnoRoot++;\n\n    /* The new root-page may not be allocated on a pointer-map page, or the\n    ** PENDING_BYTE page.\n    */\n    while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||\n        pgnoRoot==PENDING_BYTE_PAGE(pBt) ){\n      pgnoRoot++;\n    }\n    assert( pgnoRoot>=3 || CORRUPT_DB );\n    testcase( pgnoRoot<3 );\n\n    /* Allocate a page. The page that currently resides at pgnoRoot will\n    ** be moved to the allocated page (unless the allocated page happens\n    ** to reside at pgnoRoot).\n    */\n    rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, BTALLOC_EXACT);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n\n    if( pgnoMove!=pgnoRoot ){\n      /* pgnoRoot is the page that will be used for the root-page of\n      ** the new table (assuming an error did not occur). But we were\n      ** allocated pgnoMove. If required (i.e. if it was not allocated\n      ** by extending the file), the current page at position pgnoMove\n      ** is already journaled.\n      */\n      u8 eType = 0;\n      Pgno iPtrPage = 0;\n\n      /* Save the positions of any open cursors. This is required in\n      ** case they are holding a reference to an xFetch reference\n      ** corresponding to page pgnoRoot.  */\n      rc = saveAllCursors(pBt, 0, 0);\n      releasePage(pPageMove);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n\n      /* Move the page currently at pgnoRoot to pgnoMove. */\n      rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);\n      if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){\n        rc = SQLITE_CORRUPT_BKPT;\n      }\n      if( rc!=SQLITE_OK ){\n        releasePage(pRoot);\n        return rc;\n      }\n      assert( eType!=PTRMAP_ROOTPAGE );\n      assert( eType!=PTRMAP_FREEPAGE );\n      rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0);\n      releasePage(pRoot);\n\n      /* Obtain the page at pgnoRoot */\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      rc = sqlite3PagerWrite(pRoot->pDbPage);\n      if( rc!=SQLITE_OK ){\n        releasePage(pRoot);\n        return rc;\n      }\n    }else{\n      pRoot = pPageMove;\n    } \n\n    /* Update the pointer-map and meta-data with the new root-page number. */\n    ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0, &rc);\n    if( rc ){\n      releasePage(pRoot);\n      return rc;\n    }\n\n    /* When the new root page was allocated, page 1 was made writable in\n    ** order either to increase the database filesize, or to decrement the\n    ** freelist count.  Hence, the sqlite3BtreeUpdateMeta() call cannot fail.\n    */\n    assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) );\n    rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot);\n    if( NEVER(rc) ){\n      releasePage(pRoot);\n      return rc;\n    }\n\n  }else{\n    rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);\n    if( rc ) return rc;\n  }\n#endif\n  assert( sqlite3PagerIswriteable(pRoot->pDbPage) );\n  if( createTabFlags & BTREE_INTKEY ){\n    ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF;\n  }else{\n    ptfFlags = PTF_ZERODATA | PTF_LEAF;\n  }\n  zeroPage(pRoot, ptfFlags);\n  sqlite3PagerUnref(pRoot->pDbPage);\n  assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 );\n  *piTable = (int)pgnoRoot;\n  return SQLITE_OK;\n}\nint sqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){\n  int rc;\n  sqlite3BtreeEnter(p);\n  rc = btreeCreateTable(p, piTable, flags);\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** Erase the given database page and all its children.  Return\n** the page to the freelist.\n*/\nstatic int clearDatabasePage(\n  BtShared *pBt,           /* The BTree that contains the table */\n  Pgno pgno,               /* Page number to clear */\n  int freePageFlag,        /* Deallocate page if true */\n  int *pnChange            /* Add number of Cells freed to this counter */\n){\n  MemPage *pPage;\n  int rc;\n  unsigned char *pCell;\n  int i;\n  int hdr;\n  u16 szCell;\n\n  assert( sqlite3_mutex_held(pBt->mutex) );\n  if( pgno>btreePagecount(pBt) ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n  rc = getAndInitPage(pBt, pgno, &pPage, 0, 0);\n  if( rc ) return rc;\n  if( pPage->bBusy ){\n    rc = SQLITE_CORRUPT_BKPT;\n    goto cleardatabasepage_out;\n  }\n  pPage->bBusy = 1;\n  hdr = pPage->hdrOffset;\n  for(i=0; i<pPage->nCell; i++){\n    pCell = findCell(pPage, i);\n    if( !pPage->leaf ){\n      rc = clearDatabasePage(pBt, get4byte(pCell), 1, pnChange);\n      if( rc ) goto cleardatabasepage_out;\n    }\n    rc = clearCell(pPage, pCell, &szCell);\n    if( rc ) goto cleardatabasepage_out;\n  }\n  if( !pPage->leaf ){\n    rc = clearDatabasePage(pBt, get4byte(&pPage->aData[hdr+8]), 1, pnChange);\n    if( rc ) goto cleardatabasepage_out;\n  }else if( pnChange ){\n    assert( pPage->intKey || CORRUPT_DB );\n    testcase( !pPage->intKey );\n    *pnChange += pPage->nCell;\n  }\n  if( freePageFlag ){\n    freePage(pPage, &rc);\n  }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){\n    zeroPage(pPage, pPage->aData[hdr] | PTF_LEAF);\n  }\n\ncleardatabasepage_out:\n  pPage->bBusy = 0;\n  releasePage(pPage);\n  return rc;\n}\n\n/*\n** Delete all information from a single table in the database.  iTable is\n** the page number of the root of the table.  After this routine returns,\n** the root page is empty, but still exists.\n**\n** This routine will fail with SQLITE_LOCKED if there are any open\n** read cursors on the table.  Open write cursors are moved to the\n** root of the table.\n**\n** If pnChange is not NULL, then table iTable must be an intkey table. The\n** integer value pointed to by pnChange is incremented by the number of\n** entries in the table.\n*/\nint sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){\n  int rc;\n  BtShared *pBt = p->pBt;\n  sqlite3BtreeEnter(p);\n  assert( p->inTrans==TRANS_WRITE );\n\n  rc = saveAllCursors(pBt, (Pgno)iTable, 0);\n\n  if( SQLITE_OK==rc ){\n    /* Invalidate all incrblob cursors open on table iTable (assuming iTable\n    ** is the root of a table b-tree - if it is not, the following call is\n    ** a no-op).  */\n    invalidateIncrblobCursors(p, 0, 1);\n    rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange);\n  }\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n/*\n** Delete all information from the single table that pCur is open on.\n**\n** This routine only work for pCur on an ephemeral table.\n*/\nint sqlite3BtreeClearTableOfCursor(BtCursor *pCur){\n  return sqlite3BtreeClearTable(pCur->pBtree, pCur->pgnoRoot, 0);\n}\n\n/*\n** Erase all information in a table and add the root of the table to\n** the freelist.  Except, the root of the principle table (the one on\n** page 1) is never added to the freelist.\n**\n** This routine will fail with SQLITE_LOCKED if there are any open\n** cursors on the table.\n**\n** If AUTOVACUUM is enabled and the page at iTable is not the last\n** root page in the database file, then the last root page \n** in the database file is moved into the slot formerly occupied by\n** iTable and that last slot formerly occupied by the last root page\n** is added to the freelist instead of iTable.  In this say, all\n** root pages are kept at the beginning of the database file, which\n** is necessary for AUTOVACUUM to work right.  *piMoved is set to the \n** page number that used to be the last root page in the file before\n** the move.  If no page gets moved, *piMoved is set to 0.\n** The last root page is recorded in meta[3] and the value of\n** meta[3] is updated by this procedure.\n*/\nstatic int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){\n  int rc;\n  MemPage *pPage = 0;\n  BtShared *pBt = p->pBt;\n\n  assert( sqlite3BtreeHoldsMutex(p) );\n  assert( p->inTrans==TRANS_WRITE );\n\n  /* It is illegal to drop a table if any cursors are open on the\n  ** database. This is because in auto-vacuum mode the backend may\n  ** need to move another root-page to fill a gap left by the deleted\n  ** root page. If an open cursor was using this page a problem would \n  ** occur.\n  **\n  ** This error is caught long before control reaches this point.\n  */\n  if( NEVER(pBt->pCursor) ){\n    sqlite3ConnectionBlocked(p->db, pBt->pCursor->pBtree->db);\n    return SQLITE_LOCKED_SHAREDCACHE;\n  }\n\n  /*\n  ** It is illegal to drop the sqlite_master table on page 1.  But again,\n  ** this error is caught long before reaching this point.\n  */\n  if( NEVER(iTable<2) ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n\n  rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0);\n  if( rc ) return rc;\n  rc = sqlite3BtreeClearTable(p, iTable, 0);\n  if( rc ){\n    releasePage(pPage);\n    return rc;\n  }\n\n  *piMoved = 0;\n\n#ifdef SQLITE_OMIT_AUTOVACUUM\n  freePage(pPage, &rc);\n  releasePage(pPage);\n#else\n  if( pBt->autoVacuum ){\n    Pgno maxRootPgno;\n    sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &maxRootPgno);\n\n    if( iTable==maxRootPgno ){\n      /* If the table being dropped is the table with the largest root-page\n      ** number in the database, put the root page on the free list. \n      */\n      freePage(pPage, &rc);\n      releasePage(pPage);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n    }else{\n      /* The table being dropped does not have the largest root-page\n      ** number in the database. So move the page that does into the \n      ** gap left by the deleted root-page.\n      */\n      MemPage *pMove;\n      releasePage(pPage);\n      rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      rc = relocatePage(pBt, pMove, PTRMAP_ROOTPAGE, 0, iTable, 0);\n      releasePage(pMove);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      pMove = 0;\n      rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0);\n      freePage(pMove, &rc);\n      releasePage(pMove);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n      *piMoved = maxRootPgno;\n    }\n\n    /* Set the new 'max-root-page' value in the database header. This\n    ** is the old value less one, less one more if that happens to\n    ** be a root-page number, less one again if that is the\n    ** PENDING_BYTE_PAGE.\n    */\n    maxRootPgno--;\n    while( maxRootPgno==PENDING_BYTE_PAGE(pBt)\n           || PTRMAP_ISPAGE(pBt, maxRootPgno) ){\n      maxRootPgno--;\n    }\n    assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) );\n\n    rc = sqlite3BtreeUpdateMeta(p, 4, maxRootPgno);\n  }else{\n    freePage(pPage, &rc);\n    releasePage(pPage);\n  }\n#endif\n  return rc;  \n}\nint sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){\n  int rc;\n  sqlite3BtreeEnter(p);\n  rc = btreeDropTable(p, iTable, piMoved);\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n\n/*\n** This function may only be called if the b-tree connection already\n** has a read or write transaction open on the database.\n**\n** Read the meta-information out of a database file.  Meta[0]\n** is the number of free pages currently in the database.  Meta[1]\n** through meta[15] are available for use by higher layers.  Meta[0]\n** is read-only, the others are read/write.\n** \n** The schema layer numbers meta values differently.  At the schema\n** layer (and the SetCookie and ReadCookie opcodes) the number of\n** free pages is not visible.  So Cookie[0] is the same as Meta[1].\n**\n** This routine treats Meta[BTREE_DATA_VERSION] as a special case.  Instead\n** of reading the value out of the header, it instead loads the \"DataVersion\"\n** from the pager.  The BTREE_DATA_VERSION value is not actually stored in the\n** database file.  It is a number computed by the pager.  But its access\n** pattern is the same as header meta values, and so it is convenient to\n** read it from this routine.\n*/\nvoid sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){\n  BtShared *pBt = p->pBt;\n\n  sqlite3BtreeEnter(p);\n  assert( p->inTrans>TRANS_NONE );\n  assert( SQLITE_OK==querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK) );\n  assert( pBt->pPage1 );\n  assert( idx>=0 && idx<=15 );\n\n  if( idx==BTREE_DATA_VERSION ){\n    *pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iDataVersion;\n  }else{\n    *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]);\n  }\n\n  /* If auto-vacuum is disabled in this build and this is an auto-vacuum\n  ** database, mark the database as read-only.  */\n#ifdef SQLITE_OMIT_AUTOVACUUM\n  if( idx==BTREE_LARGEST_ROOT_PAGE && *pMeta>0 ){\n    pBt->btsFlags |= BTS_READ_ONLY;\n  }\n#endif\n\n  sqlite3BtreeLeave(p);\n}\n\n/*\n** Write meta-information back into the database.  Meta[0] is\n** read-only and may not be written.\n*/\nint sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){\n  BtShared *pBt = p->pBt;\n  unsigned char *pP1;\n  int rc;\n  assert( idx>=1 && idx<=15 );\n  sqlite3BtreeEnter(p);\n  assert( p->inTrans==TRANS_WRITE );\n  assert( pBt->pPage1!=0 );\n  pP1 = pBt->pPage1->aData;\n  rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\n  if( rc==SQLITE_OK ){\n    put4byte(&pP1[36 + idx*4], iMeta);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( idx==BTREE_INCR_VACUUM ){\n      assert( pBt->autoVacuum || iMeta==0 );\n      assert( iMeta==0 || iMeta==1 );\n      pBt->incrVacuum = (u8)iMeta;\n    }\n#endif\n  }\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n#ifndef SQLITE_OMIT_BTREECOUNT\n/*\n** The first argument, pCur, is a cursor opened on some b-tree. Count the\n** number of entries in the b-tree and write the result to *pnEntry.\n**\n** SQLITE_OK is returned if the operation is successfully executed. \n** Otherwise, if an error is encountered (i.e. an IO error or database\n** corruption) an SQLite error code is returned.\n*/\nint sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){\n  i64 nEntry = 0;                      /* Value to return in *pnEntry */\n  int rc;                              /* Return code */\n\n  if( pCur->pgnoRoot==0 ){\n    *pnEntry = 0;\n    return SQLITE_OK;\n  }\n  rc = moveToRoot(pCur);\n\n  /* Unless an error occurs, the following loop runs one iteration for each\n  ** page in the B-Tree structure (not including overflow pages). \n  */\n  while( rc==SQLITE_OK ){\n    int iIdx;                          /* Index of child node in parent */\n    MemPage *pPage;                    /* Current page of the b-tree */\n\n    /* If this is a leaf page or the tree is not an int-key tree, then \n    ** this page contains countable entries. Increment the entry counter\n    ** accordingly.\n    */\n    pPage = pCur->apPage[pCur->iPage];\n    if( pPage->leaf || !pPage->intKey ){\n      nEntry += pPage->nCell;\n    }\n\n    /* pPage is a leaf node. This loop navigates the cursor so that it \n    ** points to the first interior cell that it points to the parent of\n    ** the next page in the tree that has not yet been visited. The\n    ** pCur->aiIdx[pCur->iPage] value is set to the index of the parent cell\n    ** of the page, or to the number of cells in the page if the next page\n    ** to visit is the right-child of its parent.\n    **\n    ** If all pages in the tree have been visited, return SQLITE_OK to the\n    ** caller.\n    */\n    if( pPage->leaf ){\n      do {\n        if( pCur->iPage==0 ){\n          /* All pages of the b-tree have been visited. Return successfully. */\n          *pnEntry = nEntry;\n          return moveToRoot(pCur);\n        }\n        moveToParent(pCur);\n      }while ( pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell );\n\n      pCur->aiIdx[pCur->iPage]++;\n      pPage = pCur->apPage[pCur->iPage];\n    }\n\n    /* Descend to the child node of the cell that the cursor currently \n    ** points at. This is the right-child if (iIdx==pPage->nCell).\n    */\n    iIdx = pCur->aiIdx[pCur->iPage];\n    if( iIdx==pPage->nCell ){\n      rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));\n    }else{\n      rc = moveToChild(pCur, get4byte(findCell(pPage, iIdx)));\n    }\n  }\n\n  /* An error has occurred. Return an error code. */\n  return rc;\n}\n#endif\n\n/*\n** Return the pager associated with a BTree.  This routine is used for\n** testing and debugging only.\n*/\nPager *sqlite3BtreePager(Btree *p){\n  return p->pBt->pPager;\n}\n\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\n/*\n** Append a message to the error message string.\n*/\nstatic void checkAppendMsg(\n  IntegrityCk *pCheck,\n  const char *zFormat,\n  ...\n){\n  va_list ap;\n  if( !pCheck->mxErr ) return;\n  pCheck->mxErr--;\n  pCheck->nErr++;\n  va_start(ap, zFormat);\n  if( pCheck->errMsg.nChar ){\n    sqlite3StrAccumAppend(&pCheck->errMsg, \"\\n\", 1);\n  }\n  if( pCheck->zPfx ){\n    sqlite3XPrintf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2);\n  }\n  sqlite3VXPrintf(&pCheck->errMsg, zFormat, ap);\n  va_end(ap);\n  if( pCheck->errMsg.accError==STRACCUM_NOMEM ){\n    pCheck->mallocFailed = 1;\n  }\n}\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\n\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\n\n/*\n** Return non-zero if the bit in the IntegrityCk.aPgRef[] array that\n** corresponds to page iPg is already set.\n*/\nstatic int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){\n  assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 );\n  return (pCheck->aPgRef[iPg/8] & (1 << (iPg & 0x07)));\n}\n\n/*\n** Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg.\n*/\nstatic void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){\n  assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 );\n  pCheck->aPgRef[iPg/8] |= (1 << (iPg & 0x07));\n}\n\n\n/*\n** Add 1 to the reference count for page iPage.  If this is the second\n** reference to the page, add an error message to pCheck->zErrMsg.\n** Return 1 if there are 2 or more references to the page and 0 if\n** if this is the first reference to the page.\n**\n** Also check that the page number is in bounds.\n*/\nstatic int checkRef(IntegrityCk *pCheck, Pgno iPage){\n  if( iPage==0 ) return 1;\n  if( iPage>pCheck->nPage ){\n    checkAppendMsg(pCheck, \"invalid page number %d\", iPage);\n    return 1;\n  }\n  if( getPageReferenced(pCheck, iPage) ){\n    checkAppendMsg(pCheck, \"2nd reference to page %d\", iPage);\n    return 1;\n  }\n  setPageReferenced(pCheck, iPage);\n  return 0;\n}\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n/*\n** Check that the entry in the pointer-map for page iChild maps to \n** page iParent, pointer type ptrType. If not, append an error message\n** to pCheck.\n*/\nstatic void checkPtrmap(\n  IntegrityCk *pCheck,   /* Integrity check context */\n  Pgno iChild,           /* Child page number */\n  u8 eType,              /* Expected pointer map type */\n  Pgno iParent           /* Expected pointer map parent page number */\n){\n  int rc;\n  u8 ePtrmapType;\n  Pgno iPtrmapParent;\n\n  rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);\n  if( rc!=SQLITE_OK ){\n    if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) pCheck->mallocFailed = 1;\n    checkAppendMsg(pCheck, \"Failed to read ptrmap key=%d\", iChild);\n    return;\n  }\n\n  if( ePtrmapType!=eType || iPtrmapParent!=iParent ){\n    checkAppendMsg(pCheck,\n      \"Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)\", \n      iChild, eType, iParent, ePtrmapType, iPtrmapParent);\n  }\n}\n#endif\n\n/*\n** Check the integrity of the freelist or of an overflow page list.\n** Verify that the number of pages on the list is N.\n*/\nstatic void checkList(\n  IntegrityCk *pCheck,  /* Integrity checking context */\n  int isFreeList,       /* True for a freelist.  False for overflow page list */\n  int iPage,            /* Page number for first page in the list */\n  int N                 /* Expected number of pages in the list */\n){\n  int i;\n  int expected = N;\n  int iFirst = iPage;\n  while( N-- > 0 && pCheck->mxErr ){\n    DbPage *pOvflPage;\n    unsigned char *pOvflData;\n    if( iPage<1 ){\n      checkAppendMsg(pCheck,\n         \"%d of %d pages missing from overflow list starting at %d\",\n          N+1, expected, iFirst);\n      break;\n    }\n    if( checkRef(pCheck, iPage) ) break;\n    if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){\n      checkAppendMsg(pCheck, \"failed to get page %d\", iPage);\n      break;\n    }\n    pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);\n    if( isFreeList ){\n      int n = get4byte(&pOvflData[4]);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      if( pCheck->pBt->autoVacuum ){\n        checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);\n      }\n#endif\n      if( n>(int)pCheck->pBt->usableSize/4-2 ){\n        checkAppendMsg(pCheck,\n           \"freelist leaf count too big on page %d\", iPage);\n        N--;\n      }else{\n        for(i=0; i<n; i++){\n          Pgno iFreePage = get4byte(&pOvflData[8+i*4]);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n          if( pCheck->pBt->autoVacuum ){\n            checkPtrmap(pCheck, iFreePage, PTRMAP_FREEPAGE, 0);\n          }\n#endif\n          checkRef(pCheck, iFreePage);\n        }\n        N -= n;\n      }\n    }\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    else{\n      /* If this database supports auto-vacuum and iPage is not the last\n      ** page in this overflow list, check that the pointer-map entry for\n      ** the following page matches iPage.\n      */\n      if( pCheck->pBt->autoVacuum && N>0 ){\n        i = get4byte(pOvflData);\n        checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage);\n      }\n    }\n#endif\n    iPage = get4byte(pOvflData);\n    sqlite3PagerUnref(pOvflPage);\n\n    if( isFreeList && N<(iPage!=0) ){\n      checkAppendMsg(pCheck, \"free-page count in header is too small\");\n    }\n  }\n}\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\n\n/*\n** An implementation of a min-heap.\n**\n** aHeap[0] is the number of elements on the heap.  aHeap[1] is the\n** root element.  The daughter nodes of aHeap[N] are aHeap[N*2]\n** and aHeap[N*2+1].\n**\n** The heap property is this:  Every node is less than or equal to both\n** of its daughter nodes.  A consequence of the heap property is that the\n** root node aHeap[1] is always the minimum value currently in the heap.\n**\n** The btreeHeapInsert() routine inserts an unsigned 32-bit number onto\n** the heap, preserving the heap property.  The btreeHeapPull() routine\n** removes the root element from the heap (the minimum value in the heap)\n** and then moves other nodes around as necessary to preserve the heap\n** property.\n**\n** This heap is used for cell overlap and coverage testing.  Each u32\n** entry represents the span of a cell or freeblock on a btree page.  \n** The upper 16 bits are the index of the first byte of a range and the\n** lower 16 bits are the index of the last byte of that range.\n*/\nstatic void btreeHeapInsert(u32 *aHeap, u32 x){\n  u32 j, i = ++aHeap[0];\n  aHeap[i] = x;\n  while( (j = i/2)>0 && aHeap[j]>aHeap[i] ){\n    x = aHeap[j];\n    aHeap[j] = aHeap[i];\n    aHeap[i] = x;\n    i = j;\n  }\n}\nstatic int btreeHeapPull(u32 *aHeap, u32 *pOut){\n  u32 j, i, x;\n  if( (x = aHeap[0])==0 ) return 0;\n  *pOut = aHeap[1];\n  aHeap[1] = aHeap[x];\n  aHeap[x] = 0xffffffff;\n  aHeap[0]--;\n  i = 1;\n  while( (j = i*2)<=aHeap[0] ){\n    if( aHeap[j]>aHeap[j+1] ) j++;\n    if( aHeap[i]<aHeap[j] ) break;\n    x = aHeap[i];\n    aHeap[i] = aHeap[j];\n    aHeap[j] = x;\n    i = j;\n  }\n  return 1;  \n}\n\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\n/*\n** Do various sanity checks on a single page of a tree.  Return\n** the tree depth.  Root pages return 0.  Parents of root pages\n** return 1, and so forth.\n** \n** These checks are done:\n**\n**      1.  Make sure that cells and freeblocks do not overlap\n**          but combine to completely cover the page.\n**      2.  Make sure integer cell keys are in order.\n**      3.  Check the integrity of overflow pages.\n**      4.  Recursively call checkTreePage on all children.\n**      5.  Verify that the depth of all children is the same.\n*/\nstatic int checkTreePage(\n  IntegrityCk *pCheck,  /* Context for the sanity check */\n  int iPage,            /* Page number of the page to check */\n  i64 *piMinKey,        /* Write minimum integer primary key here */\n  i64 maxKey            /* Error if integer primary key greater than this */\n){\n  MemPage *pPage = 0;      /* The page being analyzed */\n  int i;                   /* Loop counter */\n  int rc;                  /* Result code from subroutine call */\n  int depth = -1, d2;      /* Depth of a subtree */\n  int pgno;                /* Page number */\n  int nFrag;               /* Number of fragmented bytes on the page */\n  int hdr;                 /* Offset to the page header */\n  int cellStart;           /* Offset to the start of the cell pointer array */\n  int nCell;               /* Number of cells */\n  int doCoverageCheck = 1; /* True if cell coverage checking should be done */\n  int keyCanBeEqual = 1;   /* True if IPK can be equal to maxKey\n                           ** False if IPK must be strictly less than maxKey */\n  u8 *data;                /* Page content */\n  u8 *pCell;               /* Cell content */\n  u8 *pCellIdx;            /* Next element of the cell pointer array */\n  BtShared *pBt;           /* The BtShared object that owns pPage */\n  u32 pc;                  /* Address of a cell */\n  u32 usableSize;          /* Usable size of the page */\n  u32 contentOffset;       /* Offset to the start of the cell content area */\n  u32 *heap = 0;           /* Min-heap used for checking cell coverage */\n  u32 x, prev = 0;         /* Next and previous entry on the min-heap */\n  const char *saved_zPfx = pCheck->zPfx;\n  int saved_v1 = pCheck->v1;\n  int saved_v2 = pCheck->v2;\n  u8 savedIsInit = 0;\n\n  /* Check that the page exists\n  */\n  pBt = pCheck->pBt;\n  usableSize = pBt->usableSize;\n  if( iPage==0 ) return 0;\n  if( checkRef(pCheck, iPage) ) return 0;\n  pCheck->zPfx = \"Page %d: \";\n  pCheck->v1 = iPage;\n  if( (rc = btreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){\n    checkAppendMsg(pCheck,\n       \"unable to get the page. error code=%d\", rc);\n    goto end_of_check;\n  }\n\n  /* Clear MemPage.isInit to make sure the corruption detection code in\n  ** btreeInitPage() is executed.  */\n  savedIsInit = pPage->isInit;\n  pPage->isInit = 0;\n  if( (rc = btreeInitPage(pPage))!=0 ){\n    assert( rc==SQLITE_CORRUPT );  /* The only possible error from InitPage */\n    checkAppendMsg(pCheck,\n                   \"btreeInitPage() returns error code %d\", rc);\n    goto end_of_check;\n  }\n  data = pPage->aData;\n  hdr = pPage->hdrOffset;\n\n  /* Set up for cell analysis */\n  pCheck->zPfx = \"On tree page %d cell %d: \";\n  contentOffset = get2byteNotZero(&data[hdr+5]);\n  assert( contentOffset<=usableSize );  /* Enforced by btreeInitPage() */\n\n  /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the\n  ** number of cells on the page. */\n  nCell = get2byte(&data[hdr+3]);\n  assert( pPage->nCell==nCell );\n\n  /* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page\n  ** immediately follows the b-tree page header. */\n  cellStart = hdr + 12 - 4*pPage->leaf;\n  assert( pPage->aCellIdx==&data[cellStart] );\n  pCellIdx = &data[cellStart + 2*(nCell-1)];\n\n  if( !pPage->leaf ){\n    /* Analyze the right-child page of internal pages */\n    pgno = get4byte(&data[hdr+8]);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( pBt->autoVacuum ){\n      pCheck->zPfx = \"On page %d at right child: \";\n      checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);\n    }\n#endif\n    depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);\n    keyCanBeEqual = 0;\n  }else{\n    /* For leaf pages, the coverage check will occur in the same loop\n    ** as the other cell checks, so initialize the heap.  */\n    heap = pCheck->heap;\n    heap[0] = 0;\n  }\n\n  /* EVIDENCE-OF: R-02776-14802 The cell pointer array consists of K 2-byte\n  ** integer offsets to the cell contents. */\n  for(i=nCell-1; i>=0 && pCheck->mxErr; i--){\n    CellInfo info;\n\n    /* Check cell size */\n    pCheck->v2 = i;\n    assert( pCellIdx==&data[cellStart + i*2] );\n    pc = get2byteAligned(pCellIdx);\n    pCellIdx -= 2;\n    if( pc<contentOffset || pc>usableSize-4 ){\n      checkAppendMsg(pCheck, \"Offset %d out of range %d..%d\",\n                             pc, contentOffset, usableSize-4);\n      doCoverageCheck = 0;\n      continue;\n    }\n    pCell = &data[pc];\n    pPage->xParseCell(pPage, pCell, &info);\n    if( pc+info.nSize>usableSize ){\n      checkAppendMsg(pCheck, \"Extends off end of page\");\n      doCoverageCheck = 0;\n      continue;\n    }\n\n    /* Check for integer primary key out of range */\n    if( pPage->intKey ){\n      if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){\n        checkAppendMsg(pCheck, \"Rowid %lld out of order\", info.nKey);\n      }\n      maxKey = info.nKey;\n    }\n\n    /* Check the content overflow list */\n    if( info.nPayload>info.nLocal ){\n      int nPage;       /* Number of pages on the overflow chain */\n      Pgno pgnoOvfl;   /* First page of the overflow chain */\n      assert( pc + info.nSize - 4 <= usableSize );\n      nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);\n      pgnoOvfl = get4byte(&pCell[info.nSize - 4]);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      if( pBt->autoVacuum ){\n        checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage);\n      }\n#endif\n      checkList(pCheck, 0, pgnoOvfl, nPage);\n    }\n\n    if( !pPage->leaf ){\n      /* Check sanity of left child page for internal pages */\n      pgno = get4byte(pCell);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n      if( pBt->autoVacuum ){\n        checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);\n      }\n#endif\n      d2 = checkTreePage(pCheck, pgno, &maxKey, maxKey);\n      keyCanBeEqual = 0;\n      if( d2!=depth ){\n        checkAppendMsg(pCheck, \"Child page depth differs\");\n        depth = d2;\n      }\n    }else{\n      /* Populate the coverage-checking heap for leaf pages */\n      btreeHeapInsert(heap, (pc<<16)|(pc+info.nSize-1));\n    }\n  }\n  *piMinKey = maxKey;\n\n  /* Check for complete coverage of the page\n  */\n  pCheck->zPfx = 0;\n  if( doCoverageCheck && pCheck->mxErr>0 ){\n    /* For leaf pages, the min-heap has already been initialized and the\n    ** cells have already been inserted.  But for internal pages, that has\n    ** not yet been done, so do it now */\n    if( !pPage->leaf ){\n      heap = pCheck->heap;\n      heap[0] = 0;\n      for(i=nCell-1; i>=0; i--){\n        u32 size;\n        pc = get2byteAligned(&data[cellStart+i*2]);\n        size = pPage->xCellSize(pPage, &data[pc]);\n        btreeHeapInsert(heap, (pc<<16)|(pc+size-1));\n      }\n    }\n    /* Add the freeblocks to the min-heap\n    **\n    ** EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header\n    ** is the offset of the first freeblock, or zero if there are no\n    ** freeblocks on the page. \n    */\n    i = get2byte(&data[hdr+1]);\n    while( i>0 ){\n      int size, j;\n      assert( (u32)i<=usableSize-4 );     /* Enforced by btreeInitPage() */\n      size = get2byte(&data[i+2]);\n      assert( (u32)(i+size)<=usableSize );  /* Enforced by btreeInitPage() */\n      btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));\n      /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a\n      ** big-endian integer which is the offset in the b-tree page of the next\n      ** freeblock in the chain, or zero if the freeblock is the last on the\n      ** chain. */\n      j = get2byte(&data[i]);\n      /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of\n      ** increasing offset. */\n      assert( j==0 || j>i+size );  /* Enforced by btreeInitPage() */\n      assert( (u32)j<=usableSize-4 );   /* Enforced by btreeInitPage() */\n      i = j;\n    }\n    /* Analyze the min-heap looking for overlap between cells and/or \n    ** freeblocks, and counting the number of untracked bytes in nFrag.\n    ** \n    ** Each min-heap entry is of the form:    (start_address<<16)|end_address.\n    ** There is an implied first entry the covers the page header, the cell\n    ** pointer index, and the gap between the cell pointer index and the start\n    ** of cell content.  \n    **\n    ** The loop below pulls entries from the min-heap in order and compares\n    ** the start_address against the previous end_address.  If there is an\n    ** overlap, that means bytes are used multiple times.  If there is a gap,\n    ** that gap is added to the fragmentation count.\n    */\n    nFrag = 0;\n    prev = contentOffset - 1;   /* Implied first min-heap entry */\n    while( btreeHeapPull(heap,&x) ){\n      if( (prev&0xffff)>=(x>>16) ){\n        checkAppendMsg(pCheck,\n          \"Multiple uses for byte %u of page %d\", x>>16, iPage);\n        break;\n      }else{\n        nFrag += (x>>16) - (prev&0xffff) - 1;\n        prev = x;\n      }\n    }\n    nFrag += usableSize - (prev&0xffff) - 1;\n    /* EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments\n    ** is stored in the fifth field of the b-tree page header.\n    ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the\n    ** number of fragmented free bytes within the cell content area.\n    */\n    if( heap[0]==0 && nFrag!=data[hdr+7] ){\n      checkAppendMsg(pCheck,\n          \"Fragmentation of %d bytes reported as %d on page %d\",\n          nFrag, data[hdr+7], iPage);\n    }\n  }\n\nend_of_check:\n  if( !doCoverageCheck ) pPage->isInit = savedIsInit;\n  releasePage(pPage);\n  pCheck->zPfx = saved_zPfx;\n  pCheck->v1 = saved_v1;\n  pCheck->v2 = saved_v2;\n  return depth+1;\n}\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\n\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\n/*\n** This routine does a complete check of the given BTree file.  aRoot[] is\n** an array of pages numbers were each page number is the root page of\n** a table.  nRoot is the number of entries in aRoot.\n**\n** A read-only or read-write transaction must be opened before calling\n** this function.\n**\n** Write the number of error seen in *pnErr.  Except for some memory\n** allocation errors,  an error message held in memory obtained from\n** malloc is returned if *pnErr is non-zero.  If *pnErr==0 then NULL is\n** returned.  If a memory allocation error occurs, NULL is returned.\n*/\nchar *sqlite3BtreeIntegrityCheck(\n  Btree *p,     /* The btree to be checked */\n  int *aRoot,   /* An array of root pages numbers for individual trees */\n  int nRoot,    /* Number of entries in aRoot[] */\n  int mxErr,    /* Stop reporting errors after this many */\n  int *pnErr    /* Write number of errors seen to this variable */\n){\n  Pgno i;\n  IntegrityCk sCheck;\n  BtShared *pBt = p->pBt;\n  int savedDbFlags = pBt->db->flags;\n  char zErr[100];\n  VVA_ONLY( int nRef );\n\n  sqlite3BtreeEnter(p);\n  assert( p->inTrans>TRANS_NONE && pBt->inTransaction>TRANS_NONE );\n  VVA_ONLY( nRef = sqlite3PagerRefcount(pBt->pPager) );\n  assert( nRef>=0 );\n  sCheck.pBt = pBt;\n  sCheck.pPager = pBt->pPager;\n  sCheck.nPage = btreePagecount(sCheck.pBt);\n  sCheck.mxErr = mxErr;\n  sCheck.nErr = 0;\n  sCheck.mallocFailed = 0;\n  sCheck.zPfx = 0;\n  sCheck.v1 = 0;\n  sCheck.v2 = 0;\n  sCheck.aPgRef = 0;\n  sCheck.heap = 0;\n  sqlite3StrAccumInit(&sCheck.errMsg, 0, zErr, sizeof(zErr), SQLITE_MAX_LENGTH);\n  sCheck.errMsg.printfFlags = SQLITE_PRINTF_INTERNAL;\n  if( sCheck.nPage==0 ){\n    goto integrity_ck_cleanup;\n  }\n\n  sCheck.aPgRef = sqlite3MallocZero((sCheck.nPage / 8)+ 1);\n  if( !sCheck.aPgRef ){\n    sCheck.mallocFailed = 1;\n    goto integrity_ck_cleanup;\n  }\n  sCheck.heap = (u32*)sqlite3PageMalloc( pBt->pageSize );\n  if( sCheck.heap==0 ){\n    sCheck.mallocFailed = 1;\n    goto integrity_ck_cleanup;\n  }\n\n  i = PENDING_BYTE_PAGE(pBt);\n  if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);\n\n  /* Check the integrity of the freelist\n  */\n  sCheck.zPfx = \"Main freelist: \";\n  checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),\n            get4byte(&pBt->pPage1->aData[36]));\n  sCheck.zPfx = 0;\n\n  /* Check all the tables.\n  */\n  testcase( pBt->db->flags & SQLITE_CellSizeCk );\n  pBt->db->flags &= ~SQLITE_CellSizeCk;\n  for(i=0; (int)i<nRoot && sCheck.mxErr; i++){\n    i64 notUsed;\n    if( aRoot[i]==0 ) continue;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( pBt->autoVacuum && aRoot[i]>1 ){\n      checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0);\n    }\n#endif\n    checkTreePage(&sCheck, aRoot[i], &notUsed, LARGEST_INT64);\n  }\n  pBt->db->flags = savedDbFlags;\n\n  /* Make sure every page in the file is referenced\n  */\n  for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){\n#ifdef SQLITE_OMIT_AUTOVACUUM\n    if( getPageReferenced(&sCheck, i)==0 ){\n      checkAppendMsg(&sCheck, \"Page %d is never used\", i);\n    }\n#else\n    /* If the database supports auto-vacuum, make sure no tables contain\n    ** references to pointer-map pages.\n    */\n    if( getPageReferenced(&sCheck, i)==0 && \n       (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){\n      checkAppendMsg(&sCheck, \"Page %d is never used\", i);\n    }\n    if( getPageReferenced(&sCheck, i)!=0 && \n       (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){\n      checkAppendMsg(&sCheck, \"Pointer map page %d is referenced\", i);\n    }\n#endif\n  }\n\n  /* Clean  up and report errors.\n  */\nintegrity_ck_cleanup:\n  sqlite3PageFree(sCheck.heap);\n  sqlite3_free(sCheck.aPgRef);\n  if( sCheck.mallocFailed ){\n    sqlite3StrAccumReset(&sCheck.errMsg);\n    sCheck.nErr++;\n  }\n  *pnErr = sCheck.nErr;\n  if( sCheck.nErr==0 ) sqlite3StrAccumReset(&sCheck.errMsg);\n  /* Make sure this analysis did not leave any unref() pages. */\n  assert( nRef==sqlite3PagerRefcount(pBt->pPager) );\n  sqlite3BtreeLeave(p);\n  return sqlite3StrAccumFinish(&sCheck.errMsg);\n}\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\n\n/*\n** Return the full pathname of the underlying database file.  Return\n** an empty string if the database is in-memory or a TEMP database.\n**\n** The pager filename is invariant as long as the pager is\n** open so it is safe to access without the BtShared mutex.\n*/\nconst char *sqlite3BtreeGetFilename(Btree *p){\n  assert( p->pBt->pPager!=0 );\n  return sqlite3PagerFilename(p->pBt->pPager, 1);\n}\n\n/*\n** Return the pathname of the journal file for this database. The return\n** value of this routine is the same regardless of whether the journal file\n** has been created or not.\n**\n** The pager journal filename is invariant as long as the pager is\n** open so it is safe to access without the BtShared mutex.\n*/\nconst char *sqlite3BtreeGetJournalname(Btree *p){\n  assert( p->pBt->pPager!=0 );\n  return sqlite3PagerJournalname(p->pBt->pPager);\n}\n\n/*\n** Return non-zero if a transaction is active.\n*/\nint sqlite3BtreeIsInTrans(Btree *p){\n  assert( p==0 || sqlite3_mutex_held(p->db->mutex) );\n  return (p && (p->inTrans==TRANS_WRITE));\n}\n\n#ifndef SQLITE_OMIT_WAL\n/*\n** Run a checkpoint on the Btree passed as the first argument.\n**\n** Return SQLITE_LOCKED if this or any other connection has an open \n** transaction on the shared-cache the argument Btree is connected to.\n**\n** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.\n*/\nint sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int *pnCkpt){\n  int rc = SQLITE_OK;\n  if( p ){\n    BtShared *pBt = p->pBt;\n    sqlite3BtreeEnter(p);\n    if( pBt->inTransaction!=TRANS_NONE ){\n      rc = SQLITE_LOCKED;\n    }else{\n      rc = sqlite3PagerCheckpoint(pBt->pPager, eMode, pnLog, pnCkpt);\n    }\n    sqlite3BtreeLeave(p);\n  }\n  return rc;\n}\n\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\nint sqlite3BtreeCheckpointHandler(Btree* p,\n                                  int(*xCheckpoint)(void *,int),\n                                  void* pArg){\n  int rc = SQLITE_MISUSE;\n  if( p ){\n    BtShared *pBt = p->pBt;\n    sqlite3BtreeEnter(p);\n    rc = sqlite3PagerWalCheckpointHandler(pBt->pPager, xCheckpoint, pArg);\n    sqlite3BtreeLeave(p);\n  }\n  return rc;\n}\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n#endif\n\n/*\n** Return non-zero if a read (or write) transaction is active.\n*/\nint sqlite3BtreeIsInReadTrans(Btree *p){\n  assert( p );\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  return p->inTrans!=TRANS_NONE;\n}\n\nint sqlite3BtreeIsInBackup(Btree *p){\n  assert( p );\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  return p->nBackup!=0;\n}\n\n/*\n** This function returns a pointer to a blob of memory associated with\n** a single shared-btree. The memory is used by client code for its own\n** purposes (for example, to store a high-level schema associated with \n** the shared-btree). The btree layer manages reference counting issues.\n**\n** The first time this is called on a shared-btree, nBytes bytes of memory\n** are allocated, zeroed, and returned to the caller. For each subsequent \n** call the nBytes parameter is ignored and a pointer to the same blob\n** of memory returned. \n**\n** If the nBytes parameter is 0 and the blob of memory has not yet been\n** allocated, a null pointer is returned. If the blob has already been\n** allocated, it is returned as normal.\n**\n** Just before the shared-btree is closed, the function passed as the \n** xFree argument when the memory allocation was made is invoked on the \n** blob of allocated memory. The xFree function should not call sqlite3_free()\n** on the memory, the btree layer does that.\n*/\nvoid *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){\n  BtShared *pBt = p->pBt;\n  sqlite3BtreeEnter(p);\n  if( !pBt->pSchema && nBytes ){\n    pBt->pSchema = sqlite3DbMallocZero(0, nBytes);\n    pBt->xFreeSchema = xFree;\n  }\n  sqlite3BtreeLeave(p);\n  return pBt->pSchema;\n}\n\n/*\n** Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared \n** btree as the argument handle holds an exclusive lock on the \n** sqlite_master table. Otherwise SQLITE_OK.\n*/\nint sqlite3BtreeSchemaLocked(Btree *p){\n  int rc;\n  assert( sqlite3_mutex_held(p->db->mutex) );\n  sqlite3BtreeEnter(p);\n  rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK);\n  assert( rc==SQLITE_OK || rc==SQLITE_LOCKED_SHAREDCACHE );\n  sqlite3BtreeLeave(p);\n  return rc;\n}\n\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n/*\n** Obtain a lock on the table whose root page is iTab.  The\n** lock is a write lock if isWritelock is true or a read lock\n** if it is false.\n*/\nint sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){\n  int rc = SQLITE_OK;\n  assert( p->inTrans!=TRANS_NONE );\n  if( p->sharable ){\n    u8 lockType = READ_LOCK + isWriteLock;\n    assert( READ_LOCK+1==WRITE_LOCK );\n    assert( isWriteLock==0 || isWriteLock==1 );\n\n    sqlite3BtreeEnter(p);\n    rc = querySharedCacheTableLock(p, iTab, lockType);\n    if( rc==SQLITE_OK ){\n      rc = setSharedCacheTableLock(p, iTab, lockType);\n    }\n    sqlite3BtreeLeave(p);\n  }\n  return rc;\n}\n#endif\n\n#ifndef SQLITE_OMIT_INCRBLOB\n/*\n** Argument pCsr must be a cursor opened for writing on an \n** INTKEY table currently pointing at a valid table entry. \n** This function modifies the data stored as part of that entry.\n**\n** Only the data content may only be modified, it is not possible to \n** change the length of the data stored. If this function is called with\n** parameters that attempt to write past the end of the existing data,\n** no modifications are made and SQLITE_CORRUPT is returned.\n*/\nint sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){\n  int rc;\n  assert( cursorOwnsBtShared(pCsr) );\n  assert( sqlite3_mutex_held(pCsr->pBtree->db->mutex) );\n  assert( pCsr->curFlags & BTCF_Incrblob );\n\n  rc = restoreCursorPosition(pCsr);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n  assert( pCsr->eState!=CURSOR_REQUIRESEEK );\n  if( pCsr->eState!=CURSOR_VALID ){\n    return SQLITE_ABORT;\n  }\n\n  /* Save the positions of all other cursors open on this table. This is\n  ** required in case any of them are holding references to an xFetch\n  ** version of the b-tree page modified by the accessPayload call below.\n  **\n  ** Note that pCsr must be open on a INTKEY table and saveCursorPosition()\n  ** and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence\n  ** saveAllCursors can only return SQLITE_OK.\n  */\n  VVA_ONLY(rc =) saveAllCursors(pCsr->pBt, pCsr->pgnoRoot, pCsr);\n  assert( rc==SQLITE_OK );\n\n  /* Check some assumptions: \n  **   (a) the cursor is open for writing,\n  **   (b) there is a read/write transaction open,\n  **   (c) the connection holds a write-lock on the table (if required),\n  **   (d) there are no conflicting read-locks, and\n  **   (e) the cursor points at a valid row of an intKey table.\n  */\n  if( (pCsr->curFlags & BTCF_WriteFlag)==0 ){\n    return SQLITE_READONLY;\n  }\n  assert( (pCsr->pBt->btsFlags & BTS_READ_ONLY)==0\n              && pCsr->pBt->inTransaction==TRANS_WRITE );\n  assert( hasSharedCacheTableLock(pCsr->pBtree, pCsr->pgnoRoot, 0, 2) );\n  assert( !hasReadConflicts(pCsr->pBtree, pCsr->pgnoRoot) );\n  assert( pCsr->apPage[pCsr->iPage]->intKey );\n\n  return accessPayload(pCsr, offset, amt, (unsigned char *)z, 1);\n}\n\n/* \n** Mark this cursor as an incremental blob cursor.\n*/\nvoid sqlite3BtreeIncrblobCursor(BtCursor *pCur){\n  pCur->curFlags |= BTCF_Incrblob;\n  pCur->pBtree->hasIncrblobCur = 1;\n}\n#endif\n\n/*\n** Set both the \"read version\" (single byte at byte offset 18) and \n** \"write version\" (single byte at byte offset 19) fields in the database\n** header to iVersion.\n*/\nint sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){\n  BtShared *pBt = pBtree->pBt;\n  int rc;                         /* Return code */\n \n  assert( iVersion==1 || iVersion==2 );\n\n  /* If setting the version fields to 1, do not automatically open the\n  ** WAL connection, even if the version fields are currently set to 2.\n  */\n  pBt->btsFlags &= ~BTS_NO_WAL;\n  if( iVersion==1 ) pBt->btsFlags |= BTS_NO_WAL;\n\n  rc = sqlite3BtreeBeginTrans(pBtree, 0);\n  if( rc==SQLITE_OK ){\n    u8 *aData = pBt->pPage1->aData;\n    if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){\n      rc = sqlite3BtreeBeginTrans(pBtree, 2);\n      if( rc==SQLITE_OK ){\n        rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);\n        if( rc==SQLITE_OK ){\n          aData[18] = (u8)iVersion;\n          aData[19] = (u8)iVersion;\n        }\n      }\n    }\n  }\n\n  pBt->btsFlags &= ~BTS_NO_WAL;\n  return rc;\n}\n\n/*\n** Return true if the cursor has a hint specified.  This routine is\n** only used from within assert() statements\n*/\nint sqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned int mask){\n  return (pCsr->hints & mask)!=0;\n}\n\n/*\n** Return true if the given Btree is read-only.\n*/\nint sqlite3BtreeIsReadonly(Btree *p){\n  return (p->pBt->btsFlags & BTS_READ_ONLY)!=0;\n}\n\n/*\n** Return the size of the header added to each page by this module.\n*/\nint sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); }\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE)\n/*\n** Return true if the Btree passed as the only argument is sharable.\n*/\nint sqlite3BtreeSharable(Btree *p){\n  return p->sharable;\n}\n\n/*\n** Return the number of connections to the BtShared object accessed by\n** the Btree handle passed as the only argument. For private caches \n** this is always 1. For shared caches it may be 1 or greater.\n*/\nint sqlite3BtreeConnectionCount(Btree *p){\n  testcase( p->sharable );\n  return p->pBt->nRef;\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/btree.h",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This header file defines the interface that the sqlite B-Tree file\n** subsystem.  See comments in the source code for a detailed description\n** of what each interface routine does.\n*/\n#ifndef SQLITE_BTREE_H\n#define SQLITE_BTREE_H\n\n/* TODO: This definition is just included so other modules compile. It\n** needs to be revisited.\n*/\n#define SQLITE_N_BTREE_META 16\n\n/*\n** If defined as non-zero, auto-vacuum is enabled by default. Otherwise\n** it must be turned on for each database using \"PRAGMA auto_vacuum = 1\".\n*/\n#ifndef SQLITE_DEFAULT_AUTOVACUUM\n  #define SQLITE_DEFAULT_AUTOVACUUM 0\n#endif\n\n#define BTREE_AUTOVACUUM_NONE 0        /* Do not do auto-vacuum */\n#define BTREE_AUTOVACUUM_FULL 1        /* Do full auto-vacuum */\n#define BTREE_AUTOVACUUM_INCR 2        /* Incremental vacuum */\n\n/*\n** Forward declarations of structure\n*/\ntypedef struct Btree Btree;\ntypedef struct BtCursor BtCursor;\ntypedef struct BtShared BtShared;\ntypedef struct BtreePayload BtreePayload;\n\n\nint sqlite3BtreeOpen(\n  sqlite3_vfs *pVfs,       /* VFS to use with this b-tree */\n  const char *zFilename,   /* Name of database file to open */\n  sqlite3 *db,             /* Associated database connection */\n  Btree **ppBtree,         /* Return open Btree* here */\n  int flags,               /* Flags */\n  int vfsFlags             /* Flags passed through to VFS open */\n);\n\n/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the\n** following values.\n**\n** NOTE:  These values must match the corresponding PAGER_ values in\n** pager.h.\n*/\n#define BTREE_OMIT_JOURNAL  1  /* Do not create or use a rollback journal */\n#define BTREE_MEMORY        2  /* This is an in-memory DB */\n#define BTREE_SINGLE        4  /* The file contains at most 1 b-tree */\n#define BTREE_UNORDERED     8  /* Use of a hash implementation is OK */\n\nint sqlite3BtreeClose(Btree*);\nint sqlite3BtreeSetCacheSize(Btree*,int);\nint sqlite3BtreeSetSpillSize(Btree*,int);\n#if SQLITE_MAX_MMAP_SIZE>0\n  int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64);\n#endif\nint sqlite3BtreeSetPagerFlags(Btree*,unsigned);\nint sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix);\nint sqlite3BtreeGetPageSize(Btree*);\nint sqlite3BtreeMaxPageCount(Btree*,int);\nu32 sqlite3BtreeLastPage(Btree*);\nint sqlite3BtreeSecureDelete(Btree*,int);\nint sqlite3BtreeGetOptimalReserve(Btree*);\nint sqlite3BtreeGetReserveNoMutex(Btree *p);\nint sqlite3BtreeSetAutoVacuum(Btree *, int);\nint sqlite3BtreeGetAutoVacuum(Btree *);\nint sqlite3BtreeBeginTrans(Btree*,int);\nint sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);\nint sqlite3BtreeCommitPhaseTwo(Btree*, int);\nint sqlite3BtreeCommit(Btree*);\nint sqlite3BtreeRollback(Btree*,int,int);\nint sqlite3BtreeBeginStmt(Btree*,int);\nint sqlite3BtreeCreateTable(Btree*, int*, int flags);\nint sqlite3BtreeIsInTrans(Btree*);\nint sqlite3BtreeIsInReadTrans(Btree*);\nint sqlite3BtreeIsInBackup(Btree*);\nvoid *sqlite3BtreeSchema(Btree *, int, void(*)(void *));\nint sqlite3BtreeSchemaLocked(Btree *pBtree);\n#ifndef SQLITE_OMIT_SHARED_CACHE\nint sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock);\n#endif\nint sqlite3BtreeSavepoint(Btree *, int, int);\n\nconst char *sqlite3BtreeGetFilename(Btree *);\nconst char *sqlite3BtreeGetJournalname(Btree *);\nint sqlite3BtreeCopyFile(Btree *, Btree *);\n\nint sqlite3BtreeIncrVacuum(Btree *);\n\n/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR\n** of the flags shown below.\n**\n** Every SQLite table must have either BTREE_INTKEY or BTREE_BLOBKEY set.\n** With BTREE_INTKEY, the table key is a 64-bit integer and arbitrary data\n** is stored in the leaves.  (BTREE_INTKEY is used for SQL tables.)  With\n** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored\n** anywhere - the key is the content.  (BTREE_BLOBKEY is used for SQL\n** indices.)\n*/\n#define BTREE_INTKEY     1    /* Table has only 64-bit signed integer keys */\n#define BTREE_BLOBKEY    2    /* Table has keys only - no data */\n\nint sqlite3BtreeDropTable(Btree*, int, int*);\nint sqlite3BtreeClearTable(Btree*, int, int*);\nint sqlite3BtreeClearTableOfCursor(BtCursor*);\nint sqlite3BtreeTripAllCursors(Btree*, int, int);\n\nvoid sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);\nint sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);\n\nint sqlite3BtreeNewDb(Btree *p);\n\n/*\n** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta\n** should be one of the following values. The integer values are assigned \n** to constants so that the offset of the corresponding field in an\n** SQLite database header may be found using the following formula:\n**\n**   offset = 36 + (idx * 4)\n**\n** For example, the free-page-count field is located at byte offset 36 of\n** the database file header. The incr-vacuum-flag field is located at\n** byte offset 64 (== 36+4*7).\n**\n** The BTREE_DATA_VERSION value is not really a value stored in the header.\n** It is a read-only number computed by the pager.  But we merge it with\n** the header value access routines since its access pattern is the same.\n** Call it a \"virtual meta value\".\n*/\n#define BTREE_FREE_PAGE_COUNT     0\n#define BTREE_SCHEMA_VERSION      1\n#define BTREE_FILE_FORMAT         2\n#define BTREE_DEFAULT_CACHE_SIZE  3\n#define BTREE_LARGEST_ROOT_PAGE   4\n#define BTREE_TEXT_ENCODING       5\n#define BTREE_USER_VERSION        6\n#define BTREE_INCR_VACUUM         7\n#define BTREE_APPLICATION_ID      8\n#define BTREE_DATA_VERSION        15  /* A virtual meta-value */\n\n/*\n** Kinds of hints that can be passed into the sqlite3BtreeCursorHint()\n** interface.\n**\n** BTREE_HINT_RANGE  (arguments: Expr*, Mem*)\n**\n**     The first argument is an Expr* (which is guaranteed to be constant for\n**     the lifetime of the cursor) that defines constraints on which rows\n**     might be fetched with this cursor.  The Expr* tree may contain\n**     TK_REGISTER nodes that refer to values stored in the array of registers\n**     passed as the second parameter.  In other words, if Expr.op==TK_REGISTER\n**     then the value of the node is the value in Mem[pExpr.iTable].  Any\n**     TK_COLUMN node in the expression tree refers to the Expr.iColumn-th\n**     column of the b-tree of the cursor.  The Expr tree will not contain\n**     any function calls nor subqueries nor references to b-trees other than\n**     the cursor being hinted.\n**\n**     The design of the _RANGE hint is aid b-tree implementations that try\n**     to prefetch content from remote machines - to provide those\n**     implementations with limits on what needs to be prefetched and thereby\n**     reduce network bandwidth.\n**\n** Note that BTREE_HINT_FLAGS with BTREE_BULKLOAD is the only hint used by\n** standard SQLite.  The other hints are provided for extentions that use\n** the SQLite parser and code generator but substitute their own storage\n** engine.\n*/\n#define BTREE_HINT_RANGE 0       /* Range constraints on queries */\n\n/*\n** Values that may be OR'd together to form the argument to the\n** BTREE_HINT_FLAGS hint for sqlite3BtreeCursorHint():\n**\n** The BTREE_BULKLOAD flag is set on index cursors when the index is going\n** to be filled with content that is already in sorted order.\n**\n** The BTREE_SEEK_EQ flag is set on cursors that will get OP_SeekGE or\n** OP_SeekLE opcodes for a range search, but where the range of entries\n** selected will all have the same key.  In other words, the cursor will\n** be used only for equality key searches.\n**\n*/\n#define BTREE_BULKLOAD 0x00000001  /* Used to full index in sorted order */\n#define BTREE_SEEK_EQ  0x00000002  /* EQ seeks only - no range seeks */\n\n/* \n** Flags passed as the third argument to sqlite3BtreeCursor().\n**\n** For read-only cursors the wrFlag argument is always zero. For read-write\n** cursors it may be set to either (BTREE_WRCSR|BTREE_FORDELETE) or just\n** (BTREE_WRCSR). If the BTREE_FORDELETE bit is set, then the cursor will\n** only be used by SQLite for the following:\n**\n**   * to seek to and then delete specific entries, and/or\n**\n**   * to read values that will be used to create keys that other\n**     BTREE_FORDELETE cursors will seek to and delete.\n**\n** The BTREE_FORDELETE flag is an optimization hint.  It is not used by\n** by this, the native b-tree engine of SQLite, but it is available to\n** alternative storage engines that might be substituted in place of this\n** b-tree system.  For alternative storage engines in which a delete of\n** the main table row automatically deletes corresponding index rows,\n** the FORDELETE flag hint allows those alternative storage engines to\n** skip a lot of work.  Namely:  FORDELETE cursors may treat all SEEK\n** and DELETE operations as no-ops, and any READ operation against a\n** FORDELETE cursor may return a null row: 0x01 0x00.\n*/\n#define BTREE_WRCSR     0x00000004     /* read-write cursor */\n#define BTREE_FORDELETE 0x00000008     /* Cursor is for seek/delete only */\n\nint sqlite3BtreeCursor(\n  Btree*,                              /* BTree containing table to open */\n  int iTable,                          /* Index of root page */\n  int wrFlag,                          /* 1 for writing.  0 for read-only */\n  struct KeyInfo*,                     /* First argument to compare function */\n  BtCursor *pCursor                    /* Space to write cursor structure */\n);\nint sqlite3BtreeCursorSize(void);\nvoid sqlite3BtreeCursorZero(BtCursor*);\nvoid sqlite3BtreeCursorHintFlags(BtCursor*, unsigned);\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\nvoid sqlite3BtreeCursorHint(BtCursor*, int, ...);\n#endif\n\nint sqlite3BtreeCloseCursor(BtCursor*);\nint sqlite3BtreeMovetoUnpacked(\n  BtCursor*,\n  UnpackedRecord *pUnKey,\n  i64 intKey,\n  int bias,\n  int *pRes\n);\nint sqlite3BtreeCursorHasMoved(BtCursor*);\nint sqlite3BtreeCursorRestore(BtCursor*, int*);\nint sqlite3BtreeDelete(BtCursor*, u8 flags);\n\n/* Allowed flags for the 2nd argument to sqlite3BtreeDelete() */\n#define BTREE_SAVEPOSITION 0x02  /* Leave cursor pointing at NEXT or PREV */\n#define BTREE_AUXDELETE    0x04  /* not the primary delete operation */\n\n/* An instance of the BtreePayload object describes the content of a single\n** entry in either an index or table btree.\n**\n** Index btrees (used for indexes and also WITHOUT ROWID tables) contain\n** an arbitrary key and no data.  These btrees have pKey,nKey set to their\n** key and pData,nData,nZero set to zero.\n**\n** Table btrees (used for rowid tables) contain an integer rowid used as\n** the key and passed in the nKey field.  The pKey field is zero.  \n** pData,nData hold the content of the new entry.  nZero extra zero bytes\n** are appended to the end of the content when constructing the entry.\n**\n** This object is used to pass information into sqlite3BtreeInsert().  The\n** same information used to be passed as five separate parameters.  But placing\n** the information into this object helps to keep the interface more \n** organized and understandable, and it also helps the resulting code to\n** run a little faster by using fewer registers for parameter passing.\n*/\nstruct BtreePayload {\n  const void *pKey;       /* Key content for indexes.  NULL for tables */\n  sqlite3_int64 nKey;     /* Size of pKey for indexes.  PRIMARY KEY for tabs */\n  const void *pData;      /* Data for tables.  NULL for indexes */\n  int nData;              /* Size of pData.  0 if none. */\n  int nZero;              /* Extra zero data appended after pData,nData */\n};\n\nint sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload,\n                       int bias, int seekResult);\nint sqlite3BtreeFirst(BtCursor*, int *pRes);\nint sqlite3BtreeLast(BtCursor*, int *pRes);\nint sqlite3BtreeNext(BtCursor*, int *pRes);\nint sqlite3BtreeEof(BtCursor*);\nint sqlite3BtreePrevious(BtCursor*, int *pRes);\ni64 sqlite3BtreeIntegerKey(BtCursor*);\nint sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);\nconst void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt);\nu32 sqlite3BtreePayloadSize(BtCursor*);\nint sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);\n\nchar *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);\nstruct Pager *sqlite3BtreePager(Btree*);\n\n#ifndef SQLITE_OMIT_INCRBLOB\nint sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);\nvoid sqlite3BtreeIncrblobCursor(BtCursor *);\n#endif\nvoid sqlite3BtreeClearCursor(BtCursor *);\nint sqlite3BtreeSetVersion(Btree *pBt, int iVersion);\nint sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);\nint sqlite3BtreeIsReadonly(Btree *pBt);\nint sqlite3HeaderSizeBtree(void);\n\n#ifndef NDEBUG\nint sqlite3BtreeCursorIsValid(BtCursor*);\n#endif\n\n#ifndef SQLITE_OMIT_BTREECOUNT\nint sqlite3BtreeCount(BtCursor *, i64 *);\n#endif\n\n#ifdef SQLITE_TEST\nint sqlite3BtreeCursorInfo(BtCursor*, int*, int);\nvoid sqlite3BtreeCursorList(Btree*);\n#endif\n\n#ifndef SQLITE_OMIT_WAL\n  int sqlite3BtreeCheckpoint(Btree*, int, int *, int *);\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\n  int sqlite3BtreeCheckpointHandler(Btree*, int(*)(void *,int), void*);\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n#endif\n\n/*\n** If we are not using shared cache, then there is no need to\n** use mutexes to access the BtShared structures.  So make the\n** Enter and Leave procedures no-ops.\n*/\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  void sqlite3BtreeEnter(Btree*);\n  void sqlite3BtreeEnterAll(sqlite3*);\n  int sqlite3BtreeSharable(Btree*);\n  void sqlite3BtreeEnterCursor(BtCursor*);\n  int sqlite3BtreeConnectionCount(Btree*);\n#else\n# define sqlite3BtreeEnter(X) \n# define sqlite3BtreeEnterAll(X)\n# define sqlite3BtreeSharable(X) 0\n# define sqlite3BtreeEnterCursor(X)\n# define sqlite3BtreeConnectionCount(X) 1\n#endif\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE\n  void sqlite3BtreeLeave(Btree*);\n  void sqlite3BtreeLeaveCursor(BtCursor*);\n  void sqlite3BtreeLeaveAll(sqlite3*);\n#ifndef NDEBUG\n  /* These routines are used inside assert() statements only. */\n  int sqlite3BtreeHoldsMutex(Btree*);\n  int sqlite3BtreeHoldsAllMutexes(sqlite3*);\n  int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);\n#endif\n#else\n\n# define sqlite3BtreeLeave(X)\n# define sqlite3BtreeLeaveCursor(X)\n# define sqlite3BtreeLeaveAll(X)\n\n# define sqlite3BtreeHoldsMutex(X) 1\n# define sqlite3BtreeHoldsAllMutexes(X) 1\n# define sqlite3SchemaMutexHeld(X,Y,Z) 1\n#endif\n\n\n#endif /* SQLITE_BTREE_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/btreeInt.h",
    "content": "/*\n** 2004 April 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file implements an external (disk-based) database using BTrees.\n** For a detailed discussion of BTrees, refer to\n**\n**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:\n**     \"Sorting And Searching\", pages 473-480. Addison-Wesley\n**     Publishing Company, Reading, Massachusetts.\n**\n** The basic idea is that each page of the file contains N database\n** entries and N+1 pointers to subpages.\n**\n**   ----------------------------------------------------------------\n**   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |\n**   ----------------------------------------------------------------\n**\n** All of the keys on the page that Ptr(0) points to have values less\n** than Key(0).  All of the keys on page Ptr(1) and its subpages have\n** values greater than Key(0) and less than Key(1).  All of the keys\n** on Ptr(N) and its subpages have values greater than Key(N-1).  And\n** so forth.\n**\n** Finding a particular key requires reading O(log(M)) pages from the \n** disk where M is the number of entries in the tree.\n**\n** In this implementation, a single file can hold one or more separate \n** BTrees.  Each BTree is identified by the index of its root page.  The\n** key and data for any entry are combined to form the \"payload\".  A\n** fixed amount of payload can be carried directly on the database\n** page.  If the payload is larger than the preset amount then surplus\n** bytes are stored on overflow pages.  The payload for an entry\n** and the preceding pointer are combined to form a \"Cell\".  Each \n** page has a small header which contains the Ptr(N) pointer and other\n** information such as the size of key and data.\n**\n** FORMAT DETAILS\n**\n** The file is divided into pages.  The first page is called page 1,\n** the second is page 2, and so forth.  A page number of zero indicates\n** \"no such page\".  The page size can be any power of 2 between 512 and 65536.\n** Each page can be either a btree page, a freelist page, an overflow\n** page, or a pointer-map page.\n**\n** The first page is always a btree page.  The first 100 bytes of the first\n** page contain a special header (the \"file header\") that describes the file.\n** The format of the file header is as follows:\n**\n**   OFFSET   SIZE    DESCRIPTION\n**      0      16     Header string: \"SQLite format 3\\000\"\n**     16       2     Page size in bytes.  (1 means 65536)\n**     18       1     File format write version\n**     19       1     File format read version\n**     20       1     Bytes of unused space at the end of each page\n**     21       1     Max embedded payload fraction (must be 64)\n**     22       1     Min embedded payload fraction (must be 32)\n**     23       1     Min leaf payload fraction (must be 32)\n**     24       4     File change counter\n**     28       4     Reserved for future use\n**     32       4     First freelist page\n**     36       4     Number of freelist pages in the file\n**     40      60     15 4-byte meta values passed to higher layers\n**\n**     40       4     Schema cookie\n**     44       4     File format of schema layer\n**     48       4     Size of page cache\n**     52       4     Largest root-page (auto/incr_vacuum)\n**     56       4     1=UTF-8 2=UTF16le 3=UTF16be\n**     60       4     User version\n**     64       4     Incremental vacuum mode\n**     68       4     Application-ID\n**     72      20     unused\n**     92       4     The version-valid-for number\n**     96       4     SQLITE_VERSION_NUMBER\n**\n** All of the integer values are big-endian (most significant byte first).\n**\n** The file change counter is incremented when the database is changed\n** This counter allows other processes to know when the file has changed\n** and thus when they need to flush their cache.\n**\n** The max embedded payload fraction is the amount of the total usable\n** space in a page that can be consumed by a single cell for standard\n** B-tree (non-LEAFDATA) tables.  A value of 255 means 100%.  The default\n** is to limit the maximum cell size so that at least 4 cells will fit\n** on one page.  Thus the default max embedded payload fraction is 64.\n**\n** If the payload for a cell is larger than the max payload, then extra\n** payload is spilled to overflow pages.  Once an overflow page is allocated,\n** as many bytes as possible are moved into the overflow pages without letting\n** the cell size drop below the min embedded payload fraction.\n**\n** The min leaf payload fraction is like the min embedded payload fraction\n** except that it applies to leaf nodes in a LEAFDATA tree.  The maximum\n** payload fraction for a LEAFDATA tree is always 100% (or 255) and it\n** not specified in the header.\n**\n** Each btree pages is divided into three sections:  The header, the\n** cell pointer array, and the cell content area.  Page 1 also has a 100-byte\n** file header that occurs before the page header.\n**\n**      |----------------|\n**      | file header    |   100 bytes.  Page 1 only.\n**      |----------------|\n**      | page header    |   8 bytes for leaves.  12 bytes for interior nodes\n**      |----------------|\n**      | cell pointer   |   |  2 bytes per cell.  Sorted order.\n**      | array          |   |  Grows downward\n**      |                |   v\n**      |----------------|\n**      | unallocated    |\n**      | space          |\n**      |----------------|   ^  Grows upwards\n**      | cell content   |   |  Arbitrary order interspersed with freeblocks.\n**      | area           |   |  and free space fragments.\n**      |----------------|\n**\n** The page headers looks like this:\n**\n**   OFFSET   SIZE     DESCRIPTION\n**      0       1      Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf\n**      1       2      byte offset to the first freeblock\n**      3       2      number of cells on this page\n**      5       2      first byte of the cell content area\n**      7       1      number of fragmented free bytes\n**      8       4      Right child (the Ptr(N) value).  Omitted on leaves.\n**\n** The flags define the format of this btree page.  The leaf flag means that\n** this page has no children.  The zerodata flag means that this page carries\n** only keys and no data.  The intkey flag means that the key is an integer\n** which is stored in the key size entry of the cell header rather than in\n** the payload area.\n**\n** The cell pointer array begins on the first byte after the page header.\n** The cell pointer array contains zero or more 2-byte numbers which are\n** offsets from the beginning of the page to the cell content in the cell\n** content area.  The cell pointers occur in sorted order.  The system strives\n** to keep free space after the last cell pointer so that new cells can\n** be easily added without having to defragment the page.\n**\n** Cell content is stored at the very end of the page and grows toward the\n** beginning of the page.\n**\n** Unused space within the cell content area is collected into a linked list of\n** freeblocks.  Each freeblock is at least 4 bytes in size.  The byte offset\n** to the first freeblock is given in the header.  Freeblocks occur in\n** increasing order.  Because a freeblock must be at least 4 bytes in size,\n** any group of 3 or fewer unused bytes in the cell content area cannot\n** exist on the freeblock chain.  A group of 3 or fewer free bytes is called\n** a fragment.  The total number of bytes in all fragments is recorded.\n** in the page header at offset 7.\n**\n**    SIZE    DESCRIPTION\n**      2     Byte offset of the next freeblock\n**      2     Bytes in this freeblock\n**\n** Cells are of variable length.  Cells are stored in the cell content area at\n** the end of the page.  Pointers to the cells are in the cell pointer array\n** that immediately follows the page header.  Cells is not necessarily\n** contiguous or in order, but cell pointers are contiguous and in order.\n**\n** Cell content makes use of variable length integers.  A variable\n** length integer is 1 to 9 bytes where the lower 7 bits of each \n** byte are used.  The integer consists of all bytes that have bit 8 set and\n** the first byte with bit 8 clear.  The most significant byte of the integer\n** appears first.  A variable-length integer may not be more than 9 bytes long.\n** As a special case, all 8 bytes of the 9th byte are used as data.  This\n** allows a 64-bit integer to be encoded in 9 bytes.\n**\n**    0x00                      becomes  0x00000000\n**    0x7f                      becomes  0x0000007f\n**    0x81 0x00                 becomes  0x00000080\n**    0x82 0x00                 becomes  0x00000100\n**    0x80 0x7f                 becomes  0x0000007f\n**    0x8a 0x91 0xd1 0xac 0x78  becomes  0x12345678\n**    0x81 0x81 0x81 0x81 0x01  becomes  0x10204081\n**\n** Variable length integers are used for rowids and to hold the number of\n** bytes of key and data in a btree cell.\n**\n** The content of a cell looks like this:\n**\n**    SIZE    DESCRIPTION\n**      4     Page number of the left child. Omitted if leaf flag is set.\n**     var    Number of bytes of data. Omitted if the zerodata flag is set.\n**     var    Number of bytes of key. Or the key itself if intkey flag is set.\n**      *     Payload\n**      4     First page of the overflow chain.  Omitted if no overflow\n**\n** Overflow pages form a linked list.  Each page except the last is completely\n** filled with data (pagesize - 4 bytes).  The last page can have as little\n** as 1 byte of data.\n**\n**    SIZE    DESCRIPTION\n**      4     Page number of next overflow page\n**      *     Data\n**\n** Freelist pages come in two subtypes: trunk pages and leaf pages.  The\n** file header points to the first in a linked list of trunk page.  Each trunk\n** page points to multiple leaf pages.  The content of a leaf page is\n** unspecified.  A trunk page looks like this:\n**\n**    SIZE    DESCRIPTION\n**      4     Page number of next trunk page\n**      4     Number of leaf pointers on this page\n**      *     zero or more pages numbers of leaves\n*/\n#include \"sqliteInt.h\"\n\n\n/* The following value is the maximum cell size assuming a maximum page\n** size give above.\n*/\n#define MX_CELL_SIZE(pBt)  ((int)(pBt->pageSize-8))\n\n/* The maximum number of cells on a single page of the database.  This\n** assumes a minimum cell size of 6 bytes  (4 bytes for the cell itself\n** plus 2 bytes for the index to the cell in the page header).  Such\n** small cells will be rare, but they are possible.\n*/\n#define MX_CELL(pBt) ((pBt->pageSize-8)/6)\n\n/* Forward declarations */\ntypedef struct MemPage MemPage;\ntypedef struct BtLock BtLock;\ntypedef struct CellInfo CellInfo;\n\n/*\n** This is a magic string that appears at the beginning of every\n** SQLite database in order to identify the file as a real database.\n**\n** You can change this value at compile-time by specifying a\n** -DSQLITE_FILE_HEADER=\"...\" on the compiler command-line.  The\n** header must be exactly 16 bytes including the zero-terminator so\n** the string itself should be 15 characters long.  If you change\n** the header, then your custom library will not be able to read \n** databases generated by the standard tools and the standard tools\n** will not be able to read databases created by your custom library.\n*/\n#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */\n#  define SQLITE_FILE_HEADER \"SQLite format 3\"\n#endif\n\n/*\n** Page type flags.  An ORed combination of these flags appear as the\n** first byte of on-disk image of every BTree page.\n*/\n#define PTF_INTKEY    0x01\n#define PTF_ZERODATA  0x02\n#define PTF_LEAFDATA  0x04\n#define PTF_LEAF      0x08\n\n/*\n** As each page of the file is loaded into memory, an instance of the following\n** structure is appended and initialized to zero.  This structure stores\n** information about the page that is decoded from the raw file page.\n**\n** The pParent field points back to the parent page.  This allows us to\n** walk up the BTree from any leaf to the root.  Care must be taken to\n** unref() the parent page pointer when this page is no longer referenced.\n** The pageDestructor() routine handles that chore.\n**\n** Access to all fields of this structure is controlled by the mutex\n** stored in MemPage.pBt->mutex.\n*/\nstruct MemPage {\n  u8 isInit;           /* True if previously initialized. MUST BE FIRST! */\n  u8 nOverflow;        /* Number of overflow cell bodies in aCell[] */\n  u8 intKey;           /* True if table b-trees.  False for index b-trees */\n  u8 intKeyLeaf;       /* True if the leaf of an intKey table */\n  u8 leaf;             /* True if a leaf page */\n  u8 hdrOffset;        /* 100 for page 1.  0 otherwise */\n  u8 childPtrSize;     /* 0 if leaf==1.  4 if leaf==0 */\n  u8 max1bytePayload;  /* min(maxLocal,127) */\n  u8 bBusy;            /* Prevent endless loops on corrupt database files */\n  u16 maxLocal;        /* Copy of BtShared.maxLocal or BtShared.maxLeaf */\n  u16 minLocal;        /* Copy of BtShared.minLocal or BtShared.minLeaf */\n  u16 cellOffset;      /* Index in aData of first cell pointer */\n  u16 nFree;           /* Number of free bytes on the page */\n  u16 nCell;           /* Number of cells on this page, local and ovfl */\n  u16 maskPage;        /* Mask for page offset */\n  u16 aiOvfl[5];       /* Insert the i-th overflow cell before the aiOvfl-th\n                       ** non-overflow cell */\n  u8 *apOvfl[5];       /* Pointers to the body of overflow cells */\n  BtShared *pBt;       /* Pointer to BtShared that this page is part of */\n  u8 *aData;           /* Pointer to disk image of the page data */\n  u8 *aDataEnd;        /* One byte past the end of usable data */\n  u8 *aCellIdx;        /* The cell index area */\n  u8 *aDataOfst;       /* Same as aData for leaves.  aData+4 for interior */\n  DbPage *pDbPage;     /* Pager page handle */\n  u16 (*xCellSize)(MemPage*,u8*);             /* cellSizePtr method */\n  void (*xParseCell)(MemPage*,u8*,CellInfo*); /* btreeParseCell method */\n  Pgno pgno;           /* Page number for this page */\n};\n\n/*\n** The in-memory image of a disk page has the auxiliary information appended\n** to the end.  EXTRA_SIZE is the number of bytes of space needed to hold\n** that extra information.\n*/\n#define EXTRA_SIZE sizeof(MemPage)\n\n/*\n** A linked list of the following structures is stored at BtShared.pLock.\n** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor \n** is opened on the table with root page BtShared.iTable. Locks are removed\n** from this list when a transaction is committed or rolled back, or when\n** a btree handle is closed.\n*/\nstruct BtLock {\n  Btree *pBtree;        /* Btree handle holding this lock */\n  Pgno iTable;          /* Root page of table */\n  u8 eLock;             /* READ_LOCK or WRITE_LOCK */\n  BtLock *pNext;        /* Next in BtShared.pLock list */\n};\n\n/* Candidate values for BtLock.eLock */\n#define READ_LOCK     1\n#define WRITE_LOCK    2\n\n/* A Btree handle\n**\n** A database connection contains a pointer to an instance of\n** this object for every database file that it has open.  This structure\n** is opaque to the database connection.  The database connection cannot\n** see the internals of this structure and only deals with pointers to\n** this structure.\n**\n** For some database files, the same underlying database cache might be \n** shared between multiple connections.  In that case, each connection\n** has it own instance of this object.  But each instance of this object\n** points to the same BtShared object.  The database cache and the\n** schema associated with the database file are all contained within\n** the BtShared object.\n**\n** All fields in this structure are accessed under sqlite3.mutex.\n** The pBt pointer itself may not be changed while there exists cursors \n** in the referenced BtShared that point back to this Btree since those\n** cursors have to go through this Btree to find their BtShared and\n** they often do so without holding sqlite3.mutex.\n*/\nstruct Btree {\n  sqlite3 *db;       /* The database connection holding this btree */\n  BtShared *pBt;     /* Sharable content of this btree */\n  u8 inTrans;        /* TRANS_NONE, TRANS_READ or TRANS_WRITE */\n  u8 sharable;       /* True if we can share pBt with another db */\n  u8 locked;         /* True if db currently has pBt locked */\n  u8 hasIncrblobCur; /* True if there are one or more Incrblob cursors */\n  int wantToLock;    /* Number of nested calls to sqlite3BtreeEnter() */\n  int nBackup;       /* Number of backup operations reading this btree */\n  u32 iDataVersion;  /* Combines with pBt->pPager->iDataVersion */\n  Btree *pNext;      /* List of other sharable Btrees from the same db */\n  Btree *pPrev;      /* Back pointer of the same list */\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  BtLock lock;       /* Object used to lock page 1 */\n#endif\n};\n\n/*\n** Btree.inTrans may take one of the following values.\n**\n** If the shared-data extension is enabled, there may be multiple users\n** of the Btree structure. At most one of these may open a write transaction,\n** but any number may have active read transactions.\n*/\n#define TRANS_NONE  0\n#define TRANS_READ  1\n#define TRANS_WRITE 2\n\n/*\n** An instance of this object represents a single database file.\n** \n** A single database file can be in use at the same time by two\n** or more database connections.  When two or more connections are\n** sharing the same database file, each connection has it own\n** private Btree object for the file and each of those Btrees points\n** to this one BtShared object.  BtShared.nRef is the number of\n** connections currently sharing this database file.\n**\n** Fields in this structure are accessed under the BtShared.mutex\n** mutex, except for nRef and pNext which are accessed under the\n** global SQLITE_MUTEX_STATIC_MASTER mutex.  The pPager field\n** may not be modified once it is initially set as long as nRef>0.\n** The pSchema field may be set once under BtShared.mutex and\n** thereafter is unchanged as long as nRef>0.\n**\n** isPending:\n**\n**   If a BtShared client fails to obtain a write-lock on a database\n**   table (because there exists one or more read-locks on the table),\n**   the shared-cache enters 'pending-lock' state and isPending is\n**   set to true.\n**\n**   The shared-cache leaves the 'pending lock' state when either of\n**   the following occur:\n**\n**     1) The current writer (BtShared.pWriter) concludes its transaction, OR\n**     2) The number of locks held by other connections drops to zero.\n**\n**   while in the 'pending-lock' state, no connection may start a new\n**   transaction.\n**\n**   This feature is included to help prevent writer-starvation.\n*/\nstruct BtShared {\n  Pager *pPager;        /* The page cache */\n  sqlite3 *db;          /* Database connection currently using this Btree */\n  BtCursor *pCursor;    /* A list of all open cursors */\n  MemPage *pPage1;      /* First page of the database */\n  u8 openFlags;         /* Flags to sqlite3BtreeOpen() */\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  u8 autoVacuum;        /* True if auto-vacuum is enabled */\n  u8 incrVacuum;        /* True if incr-vacuum is enabled */\n  u8 bDoTruncate;       /* True to truncate db on commit */\n#endif\n  u8 inTransaction;     /* Transaction state */\n  u8 max1bytePayload;   /* Maximum first byte of cell for a 1-byte payload */\n#ifdef SQLITE_HAS_CODEC\n  u8 optimalReserve;    /* Desired amount of reserved space per page */\n#endif\n  u16 btsFlags;         /* Boolean parameters.  See BTS_* macros below */\n  u16 maxLocal;         /* Maximum local payload in non-LEAFDATA tables */\n  u16 minLocal;         /* Minimum local payload in non-LEAFDATA tables */\n  u16 maxLeaf;          /* Maximum local payload in a LEAFDATA table */\n  u16 minLeaf;          /* Minimum local payload in a LEAFDATA table */\n  u32 pageSize;         /* Total number of bytes on a page */\n  u32 usableSize;       /* Number of usable bytes on each page */\n  int nTransaction;     /* Number of open transactions (read + write) */\n  u32 nPage;            /* Number of pages in the database */\n  void *pSchema;        /* Pointer to space allocated by sqlite3BtreeSchema() */\n  void (*xFreeSchema)(void*);  /* Destructor for BtShared.pSchema */\n  sqlite3_mutex *mutex; /* Non-recursive mutex required to access this object */\n  Bitvec *pHasContent;  /* Set of pages moved to free-list this transaction */\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  int nRef;             /* Number of references to this structure */\n  BtShared *pNext;      /* Next on a list of sharable BtShared structs */\n  BtLock *pLock;        /* List of locks held on this shared-btree struct */\n  Btree *pWriter;       /* Btree with currently open write transaction */\n#endif\n  u8 *pTmpSpace;        /* Temp space sufficient to hold a single cell */\n};\n\n/*\n** Allowed values for BtShared.btsFlags\n*/\n#define BTS_READ_ONLY        0x0001   /* Underlying file is readonly */\n#define BTS_PAGESIZE_FIXED   0x0002   /* Page size can no longer be changed */\n#define BTS_SECURE_DELETE    0x0004   /* PRAGMA secure_delete is enabled */\n#define BTS_INITIALLY_EMPTY  0x0008   /* Database was empty at trans start */\n#define BTS_NO_WAL           0x0010   /* Do not open write-ahead-log files */\n#define BTS_EXCLUSIVE        0x0020   /* pWriter has an exclusive lock */\n#define BTS_PENDING          0x0040   /* Waiting for read-locks to clear */\n\n/*\n** An instance of the following structure is used to hold information\n** about a cell.  The parseCellPtr() function fills in this structure\n** based on information extract from the raw disk page.\n*/\nstruct CellInfo {\n  i64 nKey;      /* The key for INTKEY tables, or nPayload otherwise */\n  u8 *pPayload;  /* Pointer to the start of payload */\n  u32 nPayload;  /* Bytes of payload */\n  u16 nLocal;    /* Amount of payload held locally, not on overflow */\n  u16 nSize;     /* Size of the cell content on the main b-tree page */\n};\n\n/*\n** Maximum depth of an SQLite B-Tree structure. Any B-Tree deeper than\n** this will be declared corrupt. This value is calculated based on a\n** maximum database size of 2^31 pages a minimum fanout of 2 for a\n** root-node and 3 for all other internal nodes.\n**\n** If a tree that appears to be taller than this is encountered, it is\n** assumed that the database is corrupt.\n*/\n#define BTCURSOR_MAX_DEPTH 20\n\n/*\n** A cursor is a pointer to a particular entry within a particular\n** b-tree within a database file.\n**\n** The entry is identified by its MemPage and the index in\n** MemPage.aCell[] of the entry.\n**\n** A single database file can be shared by two more database connections,\n** but cursors cannot be shared.  Each cursor is associated with a\n** particular database connection identified BtCursor.pBtree.db.\n**\n** Fields in this structure are accessed under the BtShared.mutex\n** found at self->pBt->mutex. \n**\n** skipNext meaning:\n**    eState==SKIPNEXT && skipNext>0:  Next sqlite3BtreeNext() is no-op.\n**    eState==SKIPNEXT && skipNext<0:  Next sqlite3BtreePrevious() is no-op.\n**    eState==FAULT:                   Cursor fault with skipNext as error code.\n*/\nstruct BtCursor {\n  Btree *pBtree;            /* The Btree to which this cursor belongs */\n  BtShared *pBt;            /* The BtShared this cursor points to */\n  BtCursor *pNext;          /* Forms a linked list of all cursors */\n  Pgno *aOverflow;          /* Cache of overflow page locations */\n  CellInfo info;            /* A parse of the cell we are pointing at */\n  i64 nKey;                 /* Size of pKey, or last integer key */\n  void *pKey;               /* Saved key that was cursor last known position */\n  Pgno pgnoRoot;            /* The root page of this tree */\n  int nOvflAlloc;           /* Allocated size of aOverflow[] array */\n  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive.\n                   ** Error code if eState==CURSOR_FAULT */\n  u8 curFlags;              /* zero or more BTCF_* flags defined below */\n  u8 curPagerFlags;         /* Flags to send to sqlite3PagerGet() */\n  u8 eState;                /* One of the CURSOR_XXX constants (see below) */\n  u8 hints;                 /* As configured by CursorSetHints() */\n  /* All fields above are zeroed when the cursor is allocated.  See\n  ** sqlite3BtreeCursorZero().  Fields that follow must be manually\n  ** initialized. */\n  i8 iPage;                 /* Index of current page in apPage */\n  u8 curIntKey;             /* Value of apPage[0]->intKey */\n  struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */\n  void *padding1;           /* Make object size a multiple of 16 */\n  u16 aiIdx[BTCURSOR_MAX_DEPTH];        /* Current index in apPage[i] */\n  MemPage *apPage[BTCURSOR_MAX_DEPTH];  /* Pages from root to current page */\n};\n\n/*\n** Legal values for BtCursor.curFlags\n*/\n#define BTCF_WriteFlag    0x01   /* True if a write cursor */\n#define BTCF_ValidNKey    0x02   /* True if info.nKey is valid */\n#define BTCF_ValidOvfl    0x04   /* True if aOverflow is valid */\n#define BTCF_AtLast       0x08   /* Cursor is pointing ot the last entry */\n#define BTCF_Incrblob     0x10   /* True if an incremental I/O handle */\n#define BTCF_Multiple     0x20   /* Maybe another cursor on the same btree */\n\n/*\n** Potential values for BtCursor.eState.\n**\n** CURSOR_INVALID:\n**   Cursor does not point to a valid entry. This can happen (for example) \n**   because the table is empty or because BtreeCursorFirst() has not been\n**   called.\n**\n** CURSOR_VALID:\n**   Cursor points to a valid entry. getPayload() etc. may be called.\n**\n** CURSOR_SKIPNEXT:\n**   Cursor is valid except that the Cursor.skipNext field is non-zero\n**   indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious()\n**   operation should be a no-op.\n**\n** CURSOR_REQUIRESEEK:\n**   The table that this cursor was opened on still exists, but has been \n**   modified since the cursor was last used. The cursor position is saved\n**   in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in \n**   this state, restoreCursorPosition() can be called to attempt to\n**   seek the cursor to the saved position.\n**\n** CURSOR_FAULT:\n**   An unrecoverable error (an I/O error or a malloc failure) has occurred\n**   on a different connection that shares the BtShared cache with this\n**   cursor.  The error has left the cache in an inconsistent state.\n**   Do nothing else with this cursor.  Any attempt to use the cursor\n**   should return the error code stored in BtCursor.skipNext\n*/\n#define CURSOR_INVALID           0\n#define CURSOR_VALID             1\n#define CURSOR_SKIPNEXT          2\n#define CURSOR_REQUIRESEEK       3\n#define CURSOR_FAULT             4\n\n/* \n** The database page the PENDING_BYTE occupies. This page is never used.\n*/\n# define PENDING_BYTE_PAGE(pBt) PAGER_MJ_PGNO(pBt)\n\n/*\n** These macros define the location of the pointer-map entry for a \n** database page. The first argument to each is the number of usable\n** bytes on each page of the database (often 1024). The second is the\n** page number to look up in the pointer map.\n**\n** PTRMAP_PAGENO returns the database page number of the pointer-map\n** page that stores the required pointer. PTRMAP_PTROFFSET returns\n** the offset of the requested map entry.\n**\n** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,\n** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be\n** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements\n** this test.\n*/\n#define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)\n#define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))\n#define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))\n\n/*\n** The pointer map is a lookup table that identifies the parent page for\n** each child page in the database file.  The parent page is the page that\n** contains a pointer to the child.  Every page in the database contains\n** 0 or 1 parent pages.  (In this context 'database page' refers\n** to any page that is not part of the pointer map itself.)  Each pointer map\n** entry consists of a single byte 'type' and a 4 byte parent page number.\n** The PTRMAP_XXX identifiers below are the valid types.\n**\n** The purpose of the pointer map is to facility moving pages from one\n** position in the file to another as part of autovacuum.  When a page\n** is moved, the pointer in its parent must be updated to point to the\n** new location.  The pointer map is used to locate the parent page quickly.\n**\n** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not\n**                  used in this case.\n**\n** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number \n**                  is not used in this case.\n**\n** PTRMAP_OVERFLOW1: The database page is the first page in a list of \n**                   overflow pages. The page number identifies the page that\n**                   contains the cell with a pointer to this overflow page.\n**\n** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of\n**                   overflow pages. The page-number identifies the previous\n**                   page in the overflow page list.\n**\n** PTRMAP_BTREE: The database page is a non-root btree page. The page number\n**               identifies the parent page in the btree.\n*/\n#define PTRMAP_ROOTPAGE 1\n#define PTRMAP_FREEPAGE 2\n#define PTRMAP_OVERFLOW1 3\n#define PTRMAP_OVERFLOW2 4\n#define PTRMAP_BTREE 5\n\n/* A bunch of assert() statements to check the transaction state variables\n** of handle p (type Btree*) are internally consistent.\n*/\n#define btreeIntegrity(p) \\\n  assert( p->pBt->inTransaction!=TRANS_NONE || p->pBt->nTransaction==0 ); \\\n  assert( p->pBt->inTransaction>=p->inTrans ); \n\n\n/*\n** The ISAUTOVACUUM macro is used within balance_nonroot() to determine\n** if the database supports auto-vacuum or not. Because it is used\n** within an expression that is an argument to another macro \n** (sqliteMallocRaw), it is not possible to use conditional compilation.\n** So, this macro is defined instead.\n*/\n#ifndef SQLITE_OMIT_AUTOVACUUM\n#define ISAUTOVACUUM (pBt->autoVacuum)\n#else\n#define ISAUTOVACUUM 0\n#endif\n\n\n/*\n** This structure is passed around through all the sanity checking routines\n** in order to keep track of some global state information.\n**\n** The aRef[] array is allocated so that there is 1 bit for each page in\n** the database. As the integrity-check proceeds, for each page used in\n** the database the corresponding bit is set. This allows integrity-check to \n** detect pages that are used twice and orphaned pages (both of which \n** indicate corruption).\n*/\ntypedef struct IntegrityCk IntegrityCk;\nstruct IntegrityCk {\n  BtShared *pBt;    /* The tree being checked out */\n  Pager *pPager;    /* The associated pager.  Also accessible by pBt->pPager */\n  u8 *aPgRef;       /* 1 bit per page in the db (see above) */\n  Pgno nPage;       /* Number of pages in the database */\n  int mxErr;        /* Stop accumulating errors when this reaches zero */\n  int nErr;         /* Number of messages written to zErrMsg so far */\n  int mallocFailed; /* A memory allocation error has occurred */\n  const char *zPfx; /* Error message prefix */\n  int v1, v2;       /* Values for up to two %d fields in zPfx */\n  StrAccum errMsg;  /* Accumulate the error message text here */\n  u32 *heap;        /* Min-heap used for analyzing cell coverage */\n};\n\n/*\n** Routines to read or write a two- and four-byte big-endian integer values.\n*/\n#define get2byte(x)   ((x)[0]<<8 | (x)[1])\n#define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v))\n#define get4byte sqlite3Get4byte\n#define put4byte sqlite3Put4byte\n\n/*\n** get2byteAligned(), unlike get2byte(), requires that its argument point to a\n** two-byte aligned address.  get2bytea() is only used for accessing the\n** cell addresses in a btree header.\n*/\n#if SQLITE_BYTEORDER==4321\n# define get2byteAligned(x)  (*(u16*)(x))\n#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \\\n    && GCC_VERSION>=4008000\n# define get2byteAligned(x)  __builtin_bswap16(*(u16*)(x))\n#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \\\n    && defined(_MSC_VER) && _MSC_VER>=1300\n# define get2byteAligned(x)  _byteswap_ushort(*(u16*)(x))\n#else\n# define get2byteAligned(x)  ((x)[0]<<8 | (x)[1])\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/build.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains C code routines that are called by the SQLite parser\n** when syntax rules are reduced.  The routines in this file handle the\n** following kinds of SQL syntax:\n**\n**     CREATE TABLE\n**     DROP TABLE\n**     CREATE INDEX\n**     DROP INDEX\n**     creating ID lists\n**     BEGIN TRANSACTION\n**     COMMIT\n**     ROLLBACK\n*/\n#include \"sqliteInt.h\"\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n/*\n** The TableLock structure is only used by the sqlite3TableLock() and\n** codeTableLocks() functions.\n*/\nstruct TableLock {\n  int iDb;             /* The database containing the table to be locked */\n  int iTab;            /* The root page of the table to be locked */\n  u8 isWriteLock;      /* True for write lock.  False for a read lock */\n  const char *zName;   /* Name of the table */\n};\n\n/*\n** Record the fact that we want to lock a table at run-time.  \n**\n** The table to be locked has root page iTab and is found in database iDb.\n** A read or a write lock can be taken depending on isWritelock.\n**\n** This routine just records the fact that the lock is desired.  The\n** code to make the lock occur is generated by a later call to\n** codeTableLocks() which occurs during sqlite3FinishCoding().\n*/\nvoid sqlite3TableLock(\n  Parse *pParse,     /* Parsing context */\n  int iDb,           /* Index of the database containing the table to lock */\n  int iTab,          /* Root page number of the table to be locked */\n  u8 isWriteLock,    /* True for a write lock */\n  const char *zName  /* Name of the table to be locked */\n){\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\n  int i;\n  int nBytes;\n  TableLock *p;\n  assert( iDb>=0 );\n\n  for(i=0; i<pToplevel->nTableLock; i++){\n    p = &pToplevel->aTableLock[i];\n    if( p->iDb==iDb && p->iTab==iTab ){\n      p->isWriteLock = (p->isWriteLock || isWriteLock);\n      return;\n    }\n  }\n\n  nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1);\n  pToplevel->aTableLock =\n      sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes);\n  if( pToplevel->aTableLock ){\n    p = &pToplevel->aTableLock[pToplevel->nTableLock++];\n    p->iDb = iDb;\n    p->iTab = iTab;\n    p->isWriteLock = isWriteLock;\n    p->zName = zName;\n  }else{\n    pToplevel->nTableLock = 0;\n    sqlite3OomFault(pToplevel->db);\n  }\n}\n\n/*\n** Code an OP_TableLock instruction for each table locked by the\n** statement (configured by calls to sqlite3TableLock()).\n*/\nstatic void codeTableLocks(Parse *pParse){\n  int i;\n  Vdbe *pVdbe; \n\n  pVdbe = sqlite3GetVdbe(pParse);\n  assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */\n\n  for(i=0; i<pParse->nTableLock; i++){\n    TableLock *p = &pParse->aTableLock[i];\n    int p1 = p->iDb;\n    sqlite3VdbeAddOp4(pVdbe, OP_TableLock, p1, p->iTab, p->isWriteLock,\n                      p->zName, P4_STATIC);\n  }\n}\n#else\n  #define codeTableLocks(x)\n#endif\n\n/*\n** Return TRUE if the given yDbMask object is empty - if it contains no\n** 1 bits.  This routine is used by the DbMaskAllZero() and DbMaskNotZero()\n** macros when SQLITE_MAX_ATTACHED is greater than 30.\n*/\n#if SQLITE_MAX_ATTACHED>30\nint sqlite3DbMaskAllZero(yDbMask m){\n  int i;\n  for(i=0; i<sizeof(yDbMask); i++) if( m[i] ) return 0;\n  return 1;\n}\n#endif\n\n/*\n** This routine is called after a single SQL statement has been\n** parsed and a VDBE program to execute that statement has been\n** prepared.  This routine puts the finishing touches on the\n** VDBE program and resets the pParse structure for the next\n** parse.\n**\n** Note that if an error occurred, it might be the case that\n** no VDBE code was generated.\n*/\nvoid sqlite3FinishCoding(Parse *pParse){\n  sqlite3 *db;\n  Vdbe *v;\n\n  assert( pParse->pToplevel==0 );\n  db = pParse->db;\n  if( pParse->nested ) return;\n  if( db->mallocFailed || pParse->nErr ){\n    if( pParse->rc==SQLITE_OK ) pParse->rc = SQLITE_ERROR;\n    return;\n  }\n\n  /* Begin by generating some termination code at the end of the\n  ** vdbe program\n  */\n  v = sqlite3GetVdbe(pParse);\n  assert( !pParse->isMultiWrite \n       || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));\n  if( v ){\n    sqlite3VdbeAddOp0(v, OP_Halt);\n\n#if SQLITE_USER_AUTHENTICATION\n    if( pParse->nTableLock>0 && db->init.busy==0 ){\n      sqlite3UserAuthInit(db);\n      if( db->auth.authLevel<UAUTH_User ){\n        sqlite3ErrorMsg(pParse, \"user not authenticated\");\n        pParse->rc = SQLITE_AUTH_USER;\n        return;\n      }\n    }\n#endif\n\n    /* The cookie mask contains one bit for each database file open.\n    ** (Bit 0 is for main, bit 1 is for temp, and so forth.)  Bits are\n    ** set for each database that is used.  Generate code to start a\n    ** transaction on each used database and to verify the schema cookie\n    ** on each used database.\n    */\n    if( db->mallocFailed==0 \n     && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)\n    ){\n      int iDb, i;\n      assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );\n      sqlite3VdbeJumpHere(v, 0);\n      for(iDb=0; iDb<db->nDb; iDb++){\n        Schema *pSchema;\n        if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;\n        sqlite3VdbeUsesBtree(v, iDb);\n        pSchema = db->aDb[iDb].pSchema;\n        sqlite3VdbeAddOp4Int(v,\n          OP_Transaction,                    /* Opcode */\n          iDb,                               /* P1 */\n          DbMaskTest(pParse->writeMask,iDb), /* P2 */\n          pSchema->schema_cookie,            /* P3 */\n          pSchema->iGeneration               /* P4 */\n        );\n        if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);\n        VdbeComment((v,\n              \"usesStmtJournal=%d\", pParse->mayAbort && pParse->isMultiWrite));\n      }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n      for(i=0; i<pParse->nVtabLock; i++){\n        char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);\n        sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);\n      }\n      pParse->nVtabLock = 0;\n#endif\n\n      /* Once all the cookies have been verified and transactions opened, \n      ** obtain the required table-locks. This is a no-op unless the \n      ** shared-cache feature is enabled.\n      */\n      codeTableLocks(pParse);\n\n      /* Initialize any AUTOINCREMENT data structures required.\n      */\n      sqlite3AutoincrementBegin(pParse);\n\n      /* Code constant expressions that where factored out of inner loops */\n      if( pParse->pConstExpr ){\n        ExprList *pEL = pParse->pConstExpr;\n        pParse->okConstFactor = 0;\n        for(i=0; i<pEL->nExpr; i++){\n          sqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg);\n        }\n      }\n\n      /* Finally, jump back to the beginning of the executable code. */\n      sqlite3VdbeGoto(v, 1);\n    }\n  }\n\n\n  /* Get the VDBE program ready for execution\n  */\n  if( v && pParse->nErr==0 && !db->mallocFailed ){\n    assert( pParse->iCacheLevel==0 );  /* Disables and re-enables match */\n    /* A minimum of one cursor is required if autoincrement is used\n    *  See ticket [a696379c1f08866] */\n    if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;\n    sqlite3VdbeMakeReady(v, pParse);\n    pParse->rc = SQLITE_DONE;\n  }else{\n    pParse->rc = SQLITE_ERROR;\n  }\n}\n\n/*\n** Run the parser and code generator recursively in order to generate\n** code for the SQL statement given onto the end of the pParse context\n** currently under construction.  When the parser is run recursively\n** this way, the final OP_Halt is not appended and other initialization\n** and finalization steps are omitted because those are handling by the\n** outermost parser.\n**\n** Not everything is nestable.  This facility is designed to permit\n** INSERT, UPDATE, and DELETE operations against SQLITE_MASTER.  Use\n** care if you decide to try to use this routine for some other purposes.\n*/\nvoid sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){\n  va_list ap;\n  char *zSql;\n  char *zErrMsg = 0;\n  sqlite3 *db = pParse->db;\n  char saveBuf[PARSE_TAIL_SZ];\n\n  if( pParse->nErr ) return;\n  assert( pParse->nested<10 );  /* Nesting should only be of limited depth */\n  va_start(ap, zFormat);\n  zSql = sqlite3VMPrintf(db, zFormat, ap);\n  va_end(ap);\n  if( zSql==0 ){\n    return;   /* A malloc must have failed */\n  }\n  pParse->nested++;\n  memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ);\n  memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ);\n  sqlite3RunParser(pParse, zSql, &zErrMsg);\n  sqlite3DbFree(db, zErrMsg);\n  sqlite3DbFree(db, zSql);\n  memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ);\n  pParse->nested--;\n}\n\n#if SQLITE_USER_AUTHENTICATION\n/*\n** Return TRUE if zTable is the name of the system table that stores the\n** list of users and their access credentials.\n*/\nint sqlite3UserAuthTable(const char *zTable){\n  return sqlite3_stricmp(zTable, \"sqlite_user\")==0;\n}\n#endif\n\n/*\n** Locate the in-memory structure that describes a particular database\n** table given the name of that table and (optionally) the name of the\n** database containing the table.  Return NULL if not found.\n**\n** If zDatabase is 0, all databases are searched for the table and the\n** first matching table is returned.  (No checking for duplicate table\n** names is done.)  The search order is TEMP first, then MAIN, then any\n** auxiliary databases added using the ATTACH command.\n**\n** See also sqlite3LocateTable().\n*/\nTable *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){\n  Table *p = 0;\n  int i;\n\n  /* All mutexes are required for schema access.  Make sure we hold them. */\n  assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );\n#if SQLITE_USER_AUTHENTICATION\n  /* Only the admin user is allowed to know that the sqlite_user table\n  ** exists */\n  if( db->auth.authLevel<UAUTH_Admin && sqlite3UserAuthTable(zName)!=0 ){\n    return 0;\n  }\n#endif\n  for(i=OMIT_TEMPDB; i<db->nDb; i++){\n    int j = (i<2) ? i^1 : i;   /* Search TEMP before MAIN */\n    if( zDatabase==0 || sqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){\n      assert( sqlite3SchemaMutexHeld(db, j, 0) );\n      p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName);\n      if( p ) break;\n    }\n  }\n  return p;\n}\n\n/*\n** Locate the in-memory structure that describes a particular database\n** table given the name of that table and (optionally) the name of the\n** database containing the table.  Return NULL if not found.  Also leave an\n** error message in pParse->zErrMsg.\n**\n** The difference between this routine and sqlite3FindTable() is that this\n** routine leaves an error message in pParse->zErrMsg where\n** sqlite3FindTable() does not.\n*/\nTable *sqlite3LocateTable(\n  Parse *pParse,         /* context in which to report errors */\n  u32 flags,             /* LOCATE_VIEW or LOCATE_NOERR */\n  const char *zName,     /* Name of the table we are looking for */\n  const char *zDbase     /* Name of the database.  Might be NULL */\n){\n  Table *p;\n\n  /* Read the database schema. If an error occurs, leave an error message\n  ** and code in pParse and return NULL. */\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\n    return 0;\n  }\n\n  p = sqlite3FindTable(pParse->db, zName, zDbase);\n  if( p==0 ){\n    const char *zMsg = flags & LOCATE_VIEW ? \"no such view\" : \"no such table\";\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    if( sqlite3FindDbName(pParse->db, zDbase)<1 ){\n      /* If zName is the not the name of a table in the schema created using\n      ** CREATE, then check to see if it is the name of an virtual table that\n      ** can be an eponymous virtual table. */\n      Module *pMod = (Module*)sqlite3HashFind(&pParse->db->aModule, zName);\n      if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){\n        return pMod->pEpoTab;\n      }\n    }\n#endif\n    if( (flags & LOCATE_NOERR)==0 ){\n      if( zDbase ){\n        sqlite3ErrorMsg(pParse, \"%s: %s.%s\", zMsg, zDbase, zName);\n      }else{\n        sqlite3ErrorMsg(pParse, \"%s: %s\", zMsg, zName);\n      }\n      pParse->checkSchema = 1;\n    }\n  }\n\n  return p;\n}\n\n/*\n** Locate the table identified by *p.\n**\n** This is a wrapper around sqlite3LocateTable(). The difference between\n** sqlite3LocateTable() and this function is that this function restricts\n** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be\n** non-NULL if it is part of a view or trigger program definition. See\n** sqlite3FixSrcList() for details.\n*/\nTable *sqlite3LocateTableItem(\n  Parse *pParse, \n  u32 flags,\n  struct SrcList_item *p\n){\n  const char *zDb;\n  assert( p->pSchema==0 || p->zDatabase==0 );\n  if( p->pSchema ){\n    int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);\n    zDb = pParse->db->aDb[iDb].zDbSName;\n  }else{\n    zDb = p->zDatabase;\n  }\n  return sqlite3LocateTable(pParse, flags, p->zName, zDb);\n}\n\n/*\n** Locate the in-memory structure that describes \n** a particular index given the name of that index\n** and the name of the database that contains the index.\n** Return NULL if not found.\n**\n** If zDatabase is 0, all databases are searched for the\n** table and the first matching index is returned.  (No checking\n** for duplicate index names is done.)  The search order is\n** TEMP first, then MAIN, then any auxiliary databases added\n** using the ATTACH command.\n*/\nIndex *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){\n  Index *p = 0;\n  int i;\n  /* All mutexes are required for schema access.  Make sure we hold them. */\n  assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) );\n  for(i=OMIT_TEMPDB; i<db->nDb; i++){\n    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */\n    Schema *pSchema = db->aDb[j].pSchema;\n    assert( pSchema );\n    if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zDbSName) ) continue;\n    assert( sqlite3SchemaMutexHeld(db, j, 0) );\n    p = sqlite3HashFind(&pSchema->idxHash, zName);\n    if( p ) break;\n  }\n  return p;\n}\n\n/*\n** Reclaim the memory used by an index\n*/\nstatic void freeIndex(sqlite3 *db, Index *p){\n#ifndef SQLITE_OMIT_ANALYZE\n  sqlite3DeleteIndexSamples(db, p);\n#endif\n  sqlite3ExprDelete(db, p->pPartIdxWhere);\n  sqlite3ExprListDelete(db, p->aColExpr);\n  sqlite3DbFree(db, p->zColAff);\n  if( p->isResized ) sqlite3DbFree(db, (void *)p->azColl);\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  sqlite3_free(p->aiRowEst);\n#endif\n  sqlite3DbFree(db, p);\n}\n\n/*\n** For the index called zIdxName which is found in the database iDb,\n** unlike that index from its Table then remove the index from\n** the index hash table and free all memory structures associated\n** with the index.\n*/\nvoid sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){\n  Index *pIndex;\n  Hash *pHash;\n\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  pHash = &db->aDb[iDb].pSchema->idxHash;\n  pIndex = sqlite3HashInsert(pHash, zIdxName, 0);\n  if( ALWAYS(pIndex) ){\n    if( pIndex->pTable->pIndex==pIndex ){\n      pIndex->pTable->pIndex = pIndex->pNext;\n    }else{\n      Index *p;\n      /* Justification of ALWAYS();  The index must be on the list of\n      ** indices. */\n      p = pIndex->pTable->pIndex;\n      while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }\n      if( ALWAYS(p && p->pNext==pIndex) ){\n        p->pNext = pIndex->pNext;\n      }\n    }\n    freeIndex(db, pIndex);\n  }\n  db->flags |= SQLITE_InternChanges;\n}\n\n/*\n** Look through the list of open database files in db->aDb[] and if\n** any have been closed, remove them from the list.  Reallocate the\n** db->aDb[] structure to a smaller size, if possible.\n**\n** Entry 0 (the \"main\" database) and entry 1 (the \"temp\" database)\n** are never candidates for being collapsed.\n*/\nvoid sqlite3CollapseDatabaseArray(sqlite3 *db){\n  int i, j;\n  for(i=j=2; i<db->nDb; i++){\n    struct Db *pDb = &db->aDb[i];\n    if( pDb->pBt==0 ){\n      sqlite3DbFree(db, pDb->zDbSName);\n      pDb->zDbSName = 0;\n      continue;\n    }\n    if( j<i ){\n      db->aDb[j] = db->aDb[i];\n    }\n    j++;\n  }\n  db->nDb = j;\n  if( db->nDb<=2 && db->aDb!=db->aDbStatic ){\n    memcpy(db->aDbStatic, db->aDb, 2*sizeof(db->aDb[0]));\n    sqlite3DbFree(db, db->aDb);\n    db->aDb = db->aDbStatic;\n  }\n}\n\n/*\n** Reset the schema for the database at index iDb.  Also reset the\n** TEMP schema.\n*/\nvoid sqlite3ResetOneSchema(sqlite3 *db, int iDb){\n  Db *pDb;\n  assert( iDb<db->nDb );\n\n  /* Case 1:  Reset the single schema identified by iDb */\n  pDb = &db->aDb[iDb];\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  assert( pDb->pSchema!=0 );\n  sqlite3SchemaClear(pDb->pSchema);\n\n  /* If any database other than TEMP is reset, then also reset TEMP\n  ** since TEMP might be holding triggers that reference tables in the\n  ** other database.\n  */\n  if( iDb!=1 ){\n    pDb = &db->aDb[1];\n    assert( pDb->pSchema!=0 );\n    sqlite3SchemaClear(pDb->pSchema);\n  }\n  return;\n}\n\n/*\n** Erase all schema information from all attached databases (including\n** \"main\" and \"temp\") for a single database connection.\n*/\nvoid sqlite3ResetAllSchemasOfConnection(sqlite3 *db){\n  int i;\n  sqlite3BtreeEnterAll(db);\n  for(i=0; i<db->nDb; i++){\n    Db *pDb = &db->aDb[i];\n    if( pDb->pSchema ){\n      sqlite3SchemaClear(pDb->pSchema);\n    }\n  }\n  db->flags &= ~SQLITE_InternChanges;\n  sqlite3VtabUnlockList(db);\n  sqlite3BtreeLeaveAll(db);\n  sqlite3CollapseDatabaseArray(db);\n}\n\n/*\n** This routine is called when a commit occurs.\n*/\nvoid sqlite3CommitInternalChanges(sqlite3 *db){\n  db->flags &= ~SQLITE_InternChanges;\n}\n\n/*\n** Delete memory allocated for the column names of a table or view (the\n** Table.aCol[] array).\n*/\nvoid sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){\n  int i;\n  Column *pCol;\n  assert( pTable!=0 );\n  if( (pCol = pTable->aCol)!=0 ){\n    for(i=0; i<pTable->nCol; i++, pCol++){\n      sqlite3DbFree(db, pCol->zName);\n      sqlite3ExprDelete(db, pCol->pDflt);\n      sqlite3DbFree(db, pCol->zColl);\n    }\n    sqlite3DbFree(db, pTable->aCol);\n  }\n}\n\n/*\n** Remove the memory data structures associated with the given\n** Table.  No changes are made to disk by this routine.\n**\n** This routine just deletes the data structure.  It does not unlink\n** the table data structure from the hash table.  But it does destroy\n** memory structures of the indices and foreign keys associated with \n** the table.\n**\n** The db parameter is optional.  It is needed if the Table object \n** contains lookaside memory.  (Table objects in the schema do not use\n** lookaside memory, but some ephemeral Table objects do.)  Or the\n** db parameter can be used with db->pnBytesFreed to measure the memory\n** used by the Table object.\n*/\nstatic void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){\n  Index *pIndex, *pNext;\n  TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */\n\n  /* Record the number of outstanding lookaside allocations in schema Tables\n  ** prior to doing any free() operations.  Since schema Tables do not use\n  ** lookaside, this number should not change. */\n  TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?\n                         db->lookaside.nOut : 0 );\n\n  /* Delete all indices associated with this table. */\n  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){\n    pNext = pIndex->pNext;\n    assert( pIndex->pSchema==pTable->pSchema\n         || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) );\n    if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){\n      char *zName = pIndex->zName; \n      TESTONLY ( Index *pOld = ) sqlite3HashInsert(\n         &pIndex->pSchema->idxHash, zName, 0\n      );\n      assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );\n      assert( pOld==pIndex || pOld==0 );\n    }\n    freeIndex(db, pIndex);\n  }\n\n  /* Delete any foreign keys attached to this table. */\n  sqlite3FkDelete(db, pTable);\n\n  /* Delete the Table structure itself.\n  */\n  sqlite3DeleteColumnNames(db, pTable);\n  sqlite3DbFree(db, pTable->zName);\n  sqlite3DbFree(db, pTable->zColAff);\n  sqlite3SelectDelete(db, pTable->pSelect);\n  sqlite3ExprListDelete(db, pTable->pCheck);\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  sqlite3VtabClear(db, pTable);\n#endif\n  sqlite3DbFree(db, pTable);\n\n  /* Verify that no lookaside memory was used by schema tables */\n  assert( nLookaside==0 || nLookaside==db->lookaside.nOut );\n}\nvoid sqlite3DeleteTable(sqlite3 *db, Table *pTable){\n  /* Do not delete the table until the reference count reaches zero. */\n  if( !pTable ) return;\n  if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return;\n  deleteTable(db, pTable);\n}\n\n\n/*\n** Unlink the given table from the hash tables and the delete the\n** table structure with all its indices and foreign keys.\n*/\nvoid sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){\n  Table *p;\n  Db *pDb;\n\n  assert( db!=0 );\n  assert( iDb>=0 && iDb<db->nDb );\n  assert( zTabName );\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  testcase( zTabName[0]==0 );  /* Zero-length table names are allowed */\n  pDb = &db->aDb[iDb];\n  p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0);\n  sqlite3DeleteTable(db, p);\n  db->flags |= SQLITE_InternChanges;\n}\n\n/*\n** Given a token, return a string that consists of the text of that\n** token.  Space to hold the returned string\n** is obtained from sqliteMalloc() and must be freed by the calling\n** function.\n**\n** Any quotation marks (ex:  \"name\", 'name', [name], or `name`) that\n** surround the body of the token are removed.\n**\n** Tokens are often just pointers into the original SQL text and so\n** are not \\000 terminated and are not persistent.  The returned string\n** is \\000 terminated and is persistent.\n*/\nchar *sqlite3NameFromToken(sqlite3 *db, Token *pName){\n  char *zName;\n  if( pName ){\n    zName = sqlite3DbStrNDup(db, (char*)pName->z, pName->n);\n    sqlite3Dequote(zName);\n  }else{\n    zName = 0;\n  }\n  return zName;\n}\n\n/*\n** Open the sqlite_master table stored in database number iDb for\n** writing. The table is opened using cursor 0.\n*/\nvoid sqlite3OpenMasterTable(Parse *p, int iDb){\n  Vdbe *v = sqlite3GetVdbe(p);\n  sqlite3TableLock(p, iDb, MASTER_ROOT, 1, SCHEMA_TABLE(iDb));\n  sqlite3VdbeAddOp4Int(v, OP_OpenWrite, 0, MASTER_ROOT, iDb, 5);\n  if( p->nTab==0 ){\n    p->nTab = 1;\n  }\n}\n\n/*\n** Parameter zName points to a nul-terminated buffer containing the name\n** of a database (\"main\", \"temp\" or the name of an attached db). This\n** function returns the index of the named database in db->aDb[], or\n** -1 if the named db cannot be found.\n*/\nint sqlite3FindDbName(sqlite3 *db, const char *zName){\n  int i = -1;         /* Database number */\n  if( zName ){\n    Db *pDb;\n    for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){\n      if( 0==sqlite3StrICmp(pDb->zDbSName, zName) ) break;\n    }\n  }\n  return i;\n}\n\n/*\n** The token *pName contains the name of a database (either \"main\" or\n** \"temp\" or the name of an attached db). This routine returns the\n** index of the named database in db->aDb[], or -1 if the named db \n** does not exist.\n*/\nint sqlite3FindDb(sqlite3 *db, Token *pName){\n  int i;                               /* Database number */\n  char *zName;                         /* Name we are searching for */\n  zName = sqlite3NameFromToken(db, pName);\n  i = sqlite3FindDbName(db, zName);\n  sqlite3DbFree(db, zName);\n  return i;\n}\n\n/* The table or view or trigger name is passed to this routine via tokens\n** pName1 and pName2. If the table name was fully qualified, for example:\n**\n** CREATE TABLE xxx.yyy (...);\n** \n** Then pName1 is set to \"xxx\" and pName2 \"yyy\". On the other hand if\n** the table name is not fully qualified, i.e.:\n**\n** CREATE TABLE yyy(...);\n**\n** Then pName1 is set to \"yyy\" and pName2 is \"\".\n**\n** This routine sets the *ppUnqual pointer to point at the token (pName1 or\n** pName2) that stores the unqualified table name.  The index of the\n** database \"xxx\" is returned.\n*/\nint sqlite3TwoPartName(\n  Parse *pParse,      /* Parsing and code generating context */\n  Token *pName1,      /* The \"xxx\" in the name \"xxx.yyy\" or \"xxx\" */\n  Token *pName2,      /* The \"yyy\" in the name \"xxx.yyy\" */\n  Token **pUnqual     /* Write the unqualified object name here */\n){\n  int iDb;                    /* Database holding the object */\n  sqlite3 *db = pParse->db;\n\n  assert( pName2!=0 );\n  if( pName2->n>0 ){\n    if( db->init.busy ) {\n      sqlite3ErrorMsg(pParse, \"corrupt database\");\n      return -1;\n    }\n    *pUnqual = pName2;\n    iDb = sqlite3FindDb(db, pName1);\n    if( iDb<0 ){\n      sqlite3ErrorMsg(pParse, \"unknown database %T\", pName1);\n      return -1;\n    }\n  }else{\n    assert( db->init.iDb==0 || db->init.busy || (db->flags & SQLITE_Vacuum)!=0);\n    iDb = db->init.iDb;\n    *pUnqual = pName1;\n  }\n  return iDb;\n}\n\n/*\n** This routine is used to check if the UTF-8 string zName is a legal\n** unqualified name for a new schema object (table, index, view or\n** trigger). All names are legal except those that begin with the string\n** \"sqlite_\" (in upper, lower or mixed case). This portion of the namespace\n** is reserved for internal use.\n*/\nint sqlite3CheckObjectName(Parse *pParse, const char *zName){\n  if( !pParse->db->init.busy && pParse->nested==0 \n          && (pParse->db->flags & SQLITE_WriteSchema)==0\n          && 0==sqlite3StrNICmp(zName, \"sqlite_\", 7) ){\n    sqlite3ErrorMsg(pParse, \"object name reserved for internal use: %s\", zName);\n    return SQLITE_ERROR;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Return the PRIMARY KEY index of a table\n*/\nIndex *sqlite3PrimaryKeyIndex(Table *pTab){\n  Index *p;\n  for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}\n  return p;\n}\n\n/*\n** Return the column of index pIdx that corresponds to table\n** column iCol.  Return -1 if not found.\n*/\ni16 sqlite3ColumnOfIndex(Index *pIdx, i16 iCol){\n  int i;\n  for(i=0; i<pIdx->nColumn; i++){\n    if( iCol==pIdx->aiColumn[i] ) return i;\n  }\n  return -1;\n}\n\n/*\n** Begin constructing a new table representation in memory.  This is\n** the first of several action routines that get called in response\n** to a CREATE TABLE statement.  In particular, this routine is called\n** after seeing tokens \"CREATE\" and \"TABLE\" and the table name. The isTemp\n** flag is true if the table should be stored in the auxiliary database\n** file instead of in the main database file.  This is normally the case\n** when the \"TEMP\" or \"TEMPORARY\" keyword occurs in between\n** CREATE and TABLE.\n**\n** The new table record is initialized and put in pParse->pNewTable.\n** As more of the CREATE TABLE statement is parsed, additional action\n** routines will be called to add more information to this record.\n** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine\n** is called to complete the construction of the new table record.\n*/\nvoid sqlite3StartTable(\n  Parse *pParse,   /* Parser context */\n  Token *pName1,   /* First part of the name of the table or view */\n  Token *pName2,   /* Second part of the name of the table or view */\n  int isTemp,      /* True if this is a TEMP table */\n  int isView,      /* True if this is a VIEW */\n  int isVirtual,   /* True if this is a VIRTUAL table */\n  int noErr        /* Do nothing if table already exists */\n){\n  Table *pTable;\n  char *zName = 0; /* The name of the new table */\n  sqlite3 *db = pParse->db;\n  Vdbe *v;\n  int iDb;         /* Database number to create the table in */\n  Token *pName;    /* Unqualified name of the table to create */\n\n  if( db->init.busy && db->init.newTnum==1 ){\n    /* Special case:  Parsing the sqlite_master or sqlite_temp_master schema */\n    iDb = db->init.iDb;\n    zName = sqlite3DbStrDup(db, SCHEMA_TABLE(iDb));\n    pName = pName1;\n  }else{\n    /* The common case */\n    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);\n    if( iDb<0 ) return;\n    if( !OMIT_TEMPDB && isTemp && pName2->n>0 && iDb!=1 ){\n      /* If creating a temp table, the name may not be qualified. Unless \n      ** the database name is \"temp\" anyway.  */\n      sqlite3ErrorMsg(pParse, \"temporary table name must be unqualified\");\n      return;\n    }\n    if( !OMIT_TEMPDB && isTemp ) iDb = 1;\n    zName = sqlite3NameFromToken(db, pName);\n  }\n  pParse->sNameToken = *pName;\n  if( zName==0 ) return;\n  if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){\n    goto begin_table_error;\n  }\n  if( db->init.iDb==1 ) isTemp = 1;\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  assert( isTemp==0 || isTemp==1 );\n  assert( isView==0 || isView==1 );\n  {\n    static const u8 aCode[] = {\n       SQLITE_CREATE_TABLE,\n       SQLITE_CREATE_TEMP_TABLE,\n       SQLITE_CREATE_VIEW,\n       SQLITE_CREATE_TEMP_VIEW\n    };\n    char *zDb = db->aDb[iDb].zDbSName;\n    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){\n      goto begin_table_error;\n    }\n    if( !isVirtual && sqlite3AuthCheck(pParse, (int)aCode[isTemp+2*isView],\n                                       zName, 0, zDb) ){\n      goto begin_table_error;\n    }\n  }\n#endif\n\n  /* Make sure the new table name does not collide with an existing\n  ** index or table name in the same database.  Issue an error message if\n  ** it does. The exception is if the statement being parsed was passed\n  ** to an sqlite3_declare_vtab() call. In that case only the column names\n  ** and types will be used, so there is no need to test for namespace\n  ** collisions.\n  */\n  if( !IN_DECLARE_VTAB ){\n    char *zDb = db->aDb[iDb].zDbSName;\n    if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\n      goto begin_table_error;\n    }\n    pTable = sqlite3FindTable(db, zName, zDb);\n    if( pTable ){\n      if( !noErr ){\n        sqlite3ErrorMsg(pParse, \"table %T already exists\", pName);\n      }else{\n        assert( !db->init.busy || CORRUPT_DB );\n        sqlite3CodeVerifySchema(pParse, iDb);\n      }\n      goto begin_table_error;\n    }\n    if( sqlite3FindIndex(db, zName, zDb)!=0 ){\n      sqlite3ErrorMsg(pParse, \"there is already an index named %s\", zName);\n      goto begin_table_error;\n    }\n  }\n\n  pTable = sqlite3DbMallocZero(db, sizeof(Table));\n  if( pTable==0 ){\n    assert( db->mallocFailed );\n    pParse->rc = SQLITE_NOMEM_BKPT;\n    pParse->nErr++;\n    goto begin_table_error;\n  }\n  pTable->zName = zName;\n  pTable->iPKey = -1;\n  pTable->pSchema = db->aDb[iDb].pSchema;\n  pTable->nRef = 1;\n  pTable->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );\n  assert( pParse->pNewTable==0 );\n  pParse->pNewTable = pTable;\n\n  /* If this is the magic sqlite_sequence table used by autoincrement,\n  ** then record a pointer to this table in the main database structure\n  ** so that INSERT can find the table easily.\n  */\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n  if( !pParse->nested && strcmp(zName, \"sqlite_sequence\")==0 ){\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    pTable->pSchema->pSeqTab = pTable;\n  }\n#endif\n\n  /* Begin generating the code that will insert the table record into\n  ** the SQLITE_MASTER table.  Note in particular that we must go ahead\n  ** and allocate the record number for the table entry now.  Before any\n  ** PRIMARY KEY or UNIQUE keywords are parsed.  Those keywords will cause\n  ** indices to be created and the table record must come before the \n  ** indices.  Hence, the record number for the table must be allocated\n  ** now.\n  */\n  if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){\n    int addr1;\n    int fileFormat;\n    int reg1, reg2, reg3;\n    /* nullRow[] is an OP_Record encoding of a row containing 5 NULLs */\n    static const char nullRow[] = { 6, 0, 0, 0, 0, 0 };\n    sqlite3BeginWriteOperation(pParse, 1, iDb);\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    if( isVirtual ){\n      sqlite3VdbeAddOp0(v, OP_VBegin);\n    }\n#endif\n\n    /* If the file format and encoding in the database have not been set, \n    ** set them now.\n    */\n    reg1 = pParse->regRowid = ++pParse->nMem;\n    reg2 = pParse->regRoot = ++pParse->nMem;\n    reg3 = ++pParse->nMem;\n    sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT);\n    sqlite3VdbeUsesBtree(v, iDb);\n    addr1 = sqlite3VdbeAddOp1(v, OP_If, reg3); VdbeCoverage(v);\n    fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ?\n                  1 : SQLITE_MAX_FILE_FORMAT;\n    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, fileFormat);\n    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, ENC(db));\n    sqlite3VdbeJumpHere(v, addr1);\n\n    /* This just creates a place-holder record in the sqlite_master table.\n    ** The record created does not contain anything yet.  It will be replaced\n    ** by the real entry in code generated at sqlite3EndTable().\n    **\n    ** The rowid for the new entry is left in register pParse->regRowid.\n    ** The root page number of the new table is left in reg pParse->regRoot.\n    ** The rowid and root page number values are needed by the code that\n    ** sqlite3EndTable will generate.\n    */\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)\n    if( isView || isVirtual ){\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, reg2);\n    }else\n#endif\n    {\n      pParse->addrCrTab = sqlite3VdbeAddOp2(v, OP_CreateTable, iDb, reg2);\n    }\n    sqlite3OpenMasterTable(pParse, iDb);\n    sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1);\n    sqlite3VdbeAddOp4(v, OP_Blob, 6, reg3, 0, nullRow, P4_STATIC);\n    sqlite3VdbeAddOp3(v, OP_Insert, 0, reg3, reg1);\n    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\n    sqlite3VdbeAddOp0(v, OP_Close);\n  }\n\n  /* Normal (non-error) return. */\n  return;\n\n  /* If an error occurs, we jump here */\nbegin_table_error:\n  sqlite3DbFree(db, zName);\n  return;\n}\n\n/* Set properties of a table column based on the (magical)\n** name of the column.\n*/\n#if SQLITE_ENABLE_HIDDEN_COLUMNS\nvoid sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){\n  if( sqlite3_strnicmp(pCol->zName, \"__hidden__\", 10)==0 ){\n    pCol->colFlags |= COLFLAG_HIDDEN;\n  }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){\n    pTab->tabFlags |= TF_OOOHidden;\n  }\n}\n#endif\n\n\n/*\n** Add a new column to the table currently being constructed.\n**\n** The parser calls this routine once for each column declaration\n** in a CREATE TABLE statement.  sqlite3StartTable() gets called\n** first to get things going.  Then this routine is called for each\n** column.\n*/\nvoid sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){\n  Table *p;\n  int i;\n  char *z;\n  char *zType;\n  Column *pCol;\n  sqlite3 *db = pParse->db;\n  if( (p = pParse->pNewTable)==0 ) return;\n#if SQLITE_MAX_COLUMN\n  if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){\n    sqlite3ErrorMsg(pParse, \"too many columns on %s\", p->zName);\n    return;\n  }\n#endif\n  z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2);\n  if( z==0 ) return;\n  memcpy(z, pName->z, pName->n);\n  z[pName->n] = 0;\n  sqlite3Dequote(z);\n  for(i=0; i<p->nCol; i++){\n    if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){\n      sqlite3ErrorMsg(pParse, \"duplicate column name: %s\", z);\n      sqlite3DbFree(db, z);\n      return;\n    }\n  }\n  if( (p->nCol & 0x7)==0 ){\n    Column *aNew;\n    aNew = sqlite3DbRealloc(db,p->aCol,(p->nCol+8)*sizeof(p->aCol[0]));\n    if( aNew==0 ){\n      sqlite3DbFree(db, z);\n      return;\n    }\n    p->aCol = aNew;\n  }\n  pCol = &p->aCol[p->nCol];\n  memset(pCol, 0, sizeof(p->aCol[0]));\n  pCol->zName = z;\n  sqlite3ColumnPropertiesFromName(p, pCol);\n \n  if( pType->n==0 ){\n    /* If there is no type specified, columns have the default affinity\n    ** 'BLOB'. */\n    pCol->affinity = SQLITE_AFF_BLOB;\n    pCol->szEst = 1;\n  }else{\n    zType = z + sqlite3Strlen30(z) + 1;\n    memcpy(zType, pType->z, pType->n);\n    zType[pType->n] = 0;\n    sqlite3Dequote(zType);\n    pCol->affinity = sqlite3AffinityType(zType, &pCol->szEst);\n    pCol->colFlags |= COLFLAG_HASTYPE;\n  }\n  p->nCol++;\n  pParse->constraintName.n = 0;\n}\n\n/*\n** This routine is called by the parser while in the middle of\n** parsing a CREATE TABLE statement.  A \"NOT NULL\" constraint has\n** been seen on a column.  This routine sets the notNull flag on\n** the column currently under construction.\n*/\nvoid sqlite3AddNotNull(Parse *pParse, int onError){\n  Table *p;\n  p = pParse->pNewTable;\n  if( p==0 || NEVER(p->nCol<1) ) return;\n  p->aCol[p->nCol-1].notNull = (u8)onError;\n}\n\n/*\n** Scan the column type name zType (length nType) and return the\n** associated affinity type.\n**\n** This routine does a case-independent search of zType for the \n** substrings in the following table. If one of the substrings is\n** found, the corresponding affinity is returned. If zType contains\n** more than one of the substrings, entries toward the top of \n** the table take priority. For example, if zType is 'BLOBINT', \n** SQLITE_AFF_INTEGER is returned.\n**\n** Substring     | Affinity\n** --------------------------------\n** 'INT'         | SQLITE_AFF_INTEGER\n** 'CHAR'        | SQLITE_AFF_TEXT\n** 'CLOB'        | SQLITE_AFF_TEXT\n** 'TEXT'        | SQLITE_AFF_TEXT\n** 'BLOB'        | SQLITE_AFF_BLOB\n** 'REAL'        | SQLITE_AFF_REAL\n** 'FLOA'        | SQLITE_AFF_REAL\n** 'DOUB'        | SQLITE_AFF_REAL\n**\n** If none of the substrings in the above table are found,\n** SQLITE_AFF_NUMERIC is returned.\n*/\nchar sqlite3AffinityType(const char *zIn, u8 *pszEst){\n  u32 h = 0;\n  char aff = SQLITE_AFF_NUMERIC;\n  const char *zChar = 0;\n\n  assert( zIn!=0 );\n  while( zIn[0] ){\n    h = (h<<8) + sqlite3UpperToLower[(*zIn)&0xff];\n    zIn++;\n    if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){             /* CHAR */\n      aff = SQLITE_AFF_TEXT;\n      zChar = zIn;\n    }else if( h==(('c'<<24)+('l'<<16)+('o'<<8)+'b') ){       /* CLOB */\n      aff = SQLITE_AFF_TEXT;\n    }else if( h==(('t'<<24)+('e'<<16)+('x'<<8)+'t') ){       /* TEXT */\n      aff = SQLITE_AFF_TEXT;\n    }else if( h==(('b'<<24)+('l'<<16)+('o'<<8)+'b')          /* BLOB */\n        && (aff==SQLITE_AFF_NUMERIC || aff==SQLITE_AFF_REAL) ){\n      aff = SQLITE_AFF_BLOB;\n      if( zIn[0]=='(' ) zChar = zIn;\n#ifndef SQLITE_OMIT_FLOATING_POINT\n    }else if( h==(('r'<<24)+('e'<<16)+('a'<<8)+'l')          /* REAL */\n        && aff==SQLITE_AFF_NUMERIC ){\n      aff = SQLITE_AFF_REAL;\n    }else if( h==(('f'<<24)+('l'<<16)+('o'<<8)+'a')          /* FLOA */\n        && aff==SQLITE_AFF_NUMERIC ){\n      aff = SQLITE_AFF_REAL;\n    }else if( h==(('d'<<24)+('o'<<16)+('u'<<8)+'b')          /* DOUB */\n        && aff==SQLITE_AFF_NUMERIC ){\n      aff = SQLITE_AFF_REAL;\n#endif\n    }else if( (h&0x00FFFFFF)==(('i'<<16)+('n'<<8)+'t') ){    /* INT */\n      aff = SQLITE_AFF_INTEGER;\n      break;\n    }\n  }\n\n  /* If pszEst is not NULL, store an estimate of the field size.  The\n  ** estimate is scaled so that the size of an integer is 1.  */\n  if( pszEst ){\n    *pszEst = 1;   /* default size is approx 4 bytes */\n    if( aff<SQLITE_AFF_NUMERIC ){\n      if( zChar ){\n        while( zChar[0] ){\n          if( sqlite3Isdigit(zChar[0]) ){\n            int v = 0;\n            sqlite3GetInt32(zChar, &v);\n            v = v/4 + 1;\n            if( v>255 ) v = 255;\n            *pszEst = v; /* BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) */\n            break;\n          }\n          zChar++;\n        }\n      }else{\n        *pszEst = 5;   /* BLOB, TEXT, CLOB -> r=5  (approx 20 bytes)*/\n      }\n    }\n  }\n  return aff;\n}\n\n/*\n** The expression is the default value for the most recently added column\n** of the table currently under construction.\n**\n** Default value expressions must be constant.  Raise an exception if this\n** is not the case.\n**\n** This routine is called by the parser while in the middle of\n** parsing a CREATE TABLE statement.\n*/\nvoid sqlite3AddDefaultValue(Parse *pParse, ExprSpan *pSpan){\n  Table *p;\n  Column *pCol;\n  sqlite3 *db = pParse->db;\n  p = pParse->pNewTable;\n  if( p!=0 ){\n    pCol = &(p->aCol[p->nCol-1]);\n    if( !sqlite3ExprIsConstantOrFunction(pSpan->pExpr, db->init.busy) ){\n      sqlite3ErrorMsg(pParse, \"default value of column [%s] is not constant\",\n          pCol->zName);\n    }else{\n      /* A copy of pExpr is used instead of the original, as pExpr contains\n      ** tokens that point to volatile memory. The 'span' of the expression\n      ** is required by pragma table_info.\n      */\n      Expr x;\n      sqlite3ExprDelete(db, pCol->pDflt);\n      memset(&x, 0, sizeof(x));\n      x.op = TK_SPAN;\n      x.u.zToken = sqlite3DbStrNDup(db, (char*)pSpan->zStart,\n                                    (int)(pSpan->zEnd - pSpan->zStart));\n      x.pLeft = pSpan->pExpr;\n      x.flags = EP_Skip;\n      pCol->pDflt = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE);\n      sqlite3DbFree(db, x.u.zToken);\n    }\n  }\n  sqlite3ExprDelete(db, pSpan->pExpr);\n}\n\n/*\n** Backwards Compatibility Hack:\n** \n** Historical versions of SQLite accepted strings as column names in\n** indexes and PRIMARY KEY constraints and in UNIQUE constraints.  Example:\n**\n**     CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim)\n**     CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC);\n**\n** This is goofy.  But to preserve backwards compatibility we continue to\n** accept it.  This routine does the necessary conversion.  It converts\n** the expression given in its argument from a TK_STRING into a TK_ID\n** if the expression is just a TK_STRING with an optional COLLATE clause.\n** If the epxression is anything other than TK_STRING, the expression is\n** unchanged.\n*/\nstatic void sqlite3StringToId(Expr *p){\n  if( p->op==TK_STRING ){\n    p->op = TK_ID;\n  }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){\n    p->pLeft->op = TK_ID;\n  }\n}\n\n/*\n** Designate the PRIMARY KEY for the table.  pList is a list of names \n** of columns that form the primary key.  If pList is NULL, then the\n** most recently added column of the table is the primary key.\n**\n** A table can have at most one primary key.  If the table already has\n** a primary key (and this is the second primary key) then create an\n** error.\n**\n** If the PRIMARY KEY is on a single column whose datatype is INTEGER,\n** then we will try to use that column as the rowid.  Set the Table.iPKey\n** field of the table under construction to be the index of the\n** INTEGER PRIMARY KEY column.  Table.iPKey is set to -1 if there is\n** no INTEGER PRIMARY KEY.\n**\n** If the key is not an INTEGER PRIMARY KEY, then create a unique\n** index for the key.  No index is created for INTEGER PRIMARY KEYs.\n*/\nvoid sqlite3AddPrimaryKey(\n  Parse *pParse,    /* Parsing context */\n  ExprList *pList,  /* List of field names to be indexed */\n  int onError,      /* What to do with a uniqueness conflict */\n  int autoInc,      /* True if the AUTOINCREMENT keyword is present */\n  int sortOrder     /* SQLITE_SO_ASC or SQLITE_SO_DESC */\n){\n  Table *pTab = pParse->pNewTable;\n  Column *pCol = 0;\n  int iCol = -1, i;\n  int nTerm;\n  if( pTab==0 ) goto primary_key_exit;\n  if( pTab->tabFlags & TF_HasPrimaryKey ){\n    sqlite3ErrorMsg(pParse, \n      \"table \\\"%s\\\" has more than one primary key\", pTab->zName);\n    goto primary_key_exit;\n  }\n  pTab->tabFlags |= TF_HasPrimaryKey;\n  if( pList==0 ){\n    iCol = pTab->nCol - 1;\n    pCol = &pTab->aCol[iCol];\n    pCol->colFlags |= COLFLAG_PRIMKEY;\n    nTerm = 1;\n  }else{\n    nTerm = pList->nExpr;\n    for(i=0; i<nTerm; i++){\n      Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr);\n      assert( pCExpr!=0 );\n      sqlite3StringToId(pCExpr);\n      if( pCExpr->op==TK_ID ){\n        const char *zCName = pCExpr->u.zToken;\n        for(iCol=0; iCol<pTab->nCol; iCol++){\n          if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){\n            pCol = &pTab->aCol[iCol];\n            pCol->colFlags |= COLFLAG_PRIMKEY;\n            break;\n          }\n        }\n      }\n    }\n  }\n  if( nTerm==1\n   && pCol\n   && sqlite3StrICmp(sqlite3ColumnType(pCol,\"\"), \"INTEGER\")==0\n   && sortOrder!=SQLITE_SO_DESC\n  ){\n    pTab->iPKey = iCol;\n    pTab->keyConf = (u8)onError;\n    assert( autoInc==0 || autoInc==1 );\n    pTab->tabFlags |= autoInc*TF_Autoincrement;\n    if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder;\n  }else if( autoInc ){\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n    sqlite3ErrorMsg(pParse, \"AUTOINCREMENT is only allowed on an \"\n       \"INTEGER PRIMARY KEY\");\n#endif\n  }else{\n    sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0,\n                           0, sortOrder, 0, SQLITE_IDXTYPE_PRIMARYKEY);\n    pList = 0;\n  }\n\nprimary_key_exit:\n  sqlite3ExprListDelete(pParse->db, pList);\n  return;\n}\n\n/*\n** Add a new CHECK constraint to the table currently under construction.\n*/\nvoid sqlite3AddCheckConstraint(\n  Parse *pParse,    /* Parsing context */\n  Expr *pCheckExpr  /* The check expression */\n){\n#ifndef SQLITE_OMIT_CHECK\n  Table *pTab = pParse->pNewTable;\n  sqlite3 *db = pParse->db;\n  if( pTab && !IN_DECLARE_VTAB\n   && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)\n  ){\n    pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);\n    if( pParse->constraintName.n ){\n      sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);\n    }\n  }else\n#endif\n  {\n    sqlite3ExprDelete(pParse->db, pCheckExpr);\n  }\n}\n\n/*\n** Set the collation function of the most recently parsed table column\n** to the CollSeq given.\n*/\nvoid sqlite3AddCollateType(Parse *pParse, Token *pToken){\n  Table *p;\n  int i;\n  char *zColl;              /* Dequoted name of collation sequence */\n  sqlite3 *db;\n\n  if( (p = pParse->pNewTable)==0 ) return;\n  i = p->nCol-1;\n  db = pParse->db;\n  zColl = sqlite3NameFromToken(db, pToken);\n  if( !zColl ) return;\n\n  if( sqlite3LocateCollSeq(pParse, zColl) ){\n    Index *pIdx;\n    sqlite3DbFree(db, p->aCol[i].zColl);\n    p->aCol[i].zColl = zColl;\n  \n    /* If the column is declared as \"<name> PRIMARY KEY COLLATE <type>\",\n    ** then an index may have been created on this column before the\n    ** collation type was added. Correct this if it is the case.\n    */\n    for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){\n      assert( pIdx->nKeyCol==1 );\n      if( pIdx->aiColumn[0]==i ){\n        pIdx->azColl[0] = p->aCol[i].zColl;\n      }\n    }\n  }else{\n    sqlite3DbFree(db, zColl);\n  }\n}\n\n/*\n** This function returns the collation sequence for database native text\n** encoding identified by the string zName, length nName.\n**\n** If the requested collation sequence is not available, or not available\n** in the database native encoding, the collation factory is invoked to\n** request it. If the collation factory does not supply such a sequence,\n** and the sequence is available in another text encoding, then that is\n** returned instead.\n**\n** If no versions of the requested collations sequence are available, or\n** another error occurs, NULL is returned and an error message written into\n** pParse.\n**\n** This routine is a wrapper around sqlite3FindCollSeq().  This routine\n** invokes the collation factory if the named collation cannot be found\n** and generates an error message.\n**\n** See also: sqlite3FindCollSeq(), sqlite3GetCollSeq()\n*/\nCollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName){\n  sqlite3 *db = pParse->db;\n  u8 enc = ENC(db);\n  u8 initbusy = db->init.busy;\n  CollSeq *pColl;\n\n  pColl = sqlite3FindCollSeq(db, enc, zName, initbusy);\n  if( !initbusy && (!pColl || !pColl->xCmp) ){\n    pColl = sqlite3GetCollSeq(pParse, enc, pColl, zName);\n  }\n\n  return pColl;\n}\n\n\n/*\n** Generate code that will increment the schema cookie.\n**\n** The schema cookie is used to determine when the schema for the\n** database changes.  After each schema change, the cookie value\n** changes.  When a process first reads the schema it records the\n** cookie.  Thereafter, whenever it goes to access the database,\n** it checks the cookie to make sure the schema has not changed\n** since it was last read.\n**\n** This plan is not completely bullet-proof.  It is possible for\n** the schema to change multiple times and for the cookie to be\n** set back to prior value.  But schema changes are infrequent\n** and the probability of hitting the same cookie value is only\n** 1 chance in 2^32.  So we're safe enough.\n**\n** IMPLEMENTATION-OF: R-34230-56049 SQLite automatically increments\n** the schema-version whenever the schema changes.\n*/\nvoid sqlite3ChangeCookie(Parse *pParse, int iDb){\n  sqlite3 *db = pParse->db;\n  Vdbe *v = pParse->pVdbe;\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_SCHEMA_VERSION, \n                    db->aDb[iDb].pSchema->schema_cookie+1);\n}\n\n/*\n** Measure the number of characters needed to output the given\n** identifier.  The number returned includes any quotes used\n** but does not include the null terminator.\n**\n** The estimate is conservative.  It might be larger that what is\n** really needed.\n*/\nstatic int identLength(const char *z){\n  int n;\n  for(n=0; *z; n++, z++){\n    if( *z=='\"' ){ n++; }\n  }\n  return n + 2;\n}\n\n/*\n** The first parameter is a pointer to an output buffer. The second \n** parameter is a pointer to an integer that contains the offset at\n** which to write into the output buffer. This function copies the\n** nul-terminated string pointed to by the third parameter, zSignedIdent,\n** to the specified offset in the buffer and updates *pIdx to refer\n** to the first byte after the last byte written before returning.\n** \n** If the string zSignedIdent consists entirely of alpha-numeric\n** characters, does not begin with a digit and is not an SQL keyword,\n** then it is copied to the output buffer exactly as it is. Otherwise,\n** it is quoted using double-quotes.\n*/\nstatic void identPut(char *z, int *pIdx, char *zSignedIdent){\n  unsigned char *zIdent = (unsigned char*)zSignedIdent;\n  int i, j, needQuote;\n  i = *pIdx;\n\n  for(j=0; zIdent[j]; j++){\n    if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break;\n  }\n  needQuote = sqlite3Isdigit(zIdent[0])\n            || sqlite3KeywordCode(zIdent, j)!=TK_ID\n            || zIdent[j]!=0\n            || j==0;\n\n  if( needQuote ) z[i++] = '\"';\n  for(j=0; zIdent[j]; j++){\n    z[i++] = zIdent[j];\n    if( zIdent[j]=='\"' ) z[i++] = '\"';\n  }\n  if( needQuote ) z[i++] = '\"';\n  z[i] = 0;\n  *pIdx = i;\n}\n\n/*\n** Generate a CREATE TABLE statement appropriate for the given\n** table.  Memory to hold the text of the statement is obtained\n** from sqliteMalloc() and must be freed by the calling function.\n*/\nstatic char *createTableStmt(sqlite3 *db, Table *p){\n  int i, k, n;\n  char *zStmt;\n  char *zSep, *zSep2, *zEnd;\n  Column *pCol;\n  n = 0;\n  for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){\n    n += identLength(pCol->zName) + 5;\n  }\n  n += identLength(p->zName);\n  if( n<50 ){ \n    zSep = \"\";\n    zSep2 = \",\";\n    zEnd = \")\";\n  }else{\n    zSep = \"\\n  \";\n    zSep2 = \",\\n  \";\n    zEnd = \"\\n)\";\n  }\n  n += 35 + 6*p->nCol;\n  zStmt = sqlite3DbMallocRaw(0, n);\n  if( zStmt==0 ){\n    sqlite3OomFault(db);\n    return 0;\n  }\n  sqlite3_snprintf(n, zStmt, \"CREATE TABLE \");\n  k = sqlite3Strlen30(zStmt);\n  identPut(zStmt, &k, p->zName);\n  zStmt[k++] = '(';\n  for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){\n    static const char * const azType[] = {\n        /* SQLITE_AFF_BLOB    */ \"\",\n        /* SQLITE_AFF_TEXT    */ \" TEXT\",\n        /* SQLITE_AFF_NUMERIC */ \" NUM\",\n        /* SQLITE_AFF_INTEGER */ \" INT\",\n        /* SQLITE_AFF_REAL    */ \" REAL\"\n    };\n    int len;\n    const char *zType;\n\n    sqlite3_snprintf(n-k, &zStmt[k], zSep);\n    k += sqlite3Strlen30(&zStmt[k]);\n    zSep = zSep2;\n    identPut(zStmt, &k, pCol->zName);\n    assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 );\n    assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) );\n    testcase( pCol->affinity==SQLITE_AFF_BLOB );\n    testcase( pCol->affinity==SQLITE_AFF_TEXT );\n    testcase( pCol->affinity==SQLITE_AFF_NUMERIC );\n    testcase( pCol->affinity==SQLITE_AFF_INTEGER );\n    testcase( pCol->affinity==SQLITE_AFF_REAL );\n    \n    zType = azType[pCol->affinity - SQLITE_AFF_BLOB];\n    len = sqlite3Strlen30(zType);\n    assert( pCol->affinity==SQLITE_AFF_BLOB \n            || pCol->affinity==sqlite3AffinityType(zType, 0) );\n    memcpy(&zStmt[k], zType, len);\n    k += len;\n    assert( k<=n );\n  }\n  sqlite3_snprintf(n-k, &zStmt[k], \"%s\", zEnd);\n  return zStmt;\n}\n\n/*\n** Resize an Index object to hold N columns total.  Return SQLITE_OK\n** on success and SQLITE_NOMEM on an OOM error.\n*/\nstatic int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){\n  char *zExtra;\n  int nByte;\n  if( pIdx->nColumn>=N ) return SQLITE_OK;\n  assert( pIdx->isResized==0 );\n  nByte = (sizeof(char*) + sizeof(i16) + 1)*N;\n  zExtra = sqlite3DbMallocZero(db, nByte);\n  if( zExtra==0 ) return SQLITE_NOMEM_BKPT;\n  memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn);\n  pIdx->azColl = (const char**)zExtra;\n  zExtra += sizeof(char*)*N;\n  memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn);\n  pIdx->aiColumn = (i16*)zExtra;\n  zExtra += sizeof(i16)*N;\n  memcpy(zExtra, pIdx->aSortOrder, pIdx->nColumn);\n  pIdx->aSortOrder = (u8*)zExtra;\n  pIdx->nColumn = N;\n  pIdx->isResized = 1;\n  return SQLITE_OK;\n}\n\n/*\n** Estimate the total row width for a table.\n*/\nstatic void estimateTableWidth(Table *pTab){\n  unsigned wTable = 0;\n  const Column *pTabCol;\n  int i;\n  for(i=pTab->nCol, pTabCol=pTab->aCol; i>0; i--, pTabCol++){\n    wTable += pTabCol->szEst;\n  }\n  if( pTab->iPKey<0 ) wTable++;\n  pTab->szTabRow = sqlite3LogEst(wTable*4);\n}\n\n/*\n** Estimate the average size of a row for an index.\n*/\nstatic void estimateIndexWidth(Index *pIdx){\n  unsigned wIndex = 0;\n  int i;\n  const Column *aCol = pIdx->pTable->aCol;\n  for(i=0; i<pIdx->nColumn; i++){\n    i16 x = pIdx->aiColumn[i];\n    assert( x<pIdx->pTable->nCol );\n    wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst;\n  }\n  pIdx->szIdxRow = sqlite3LogEst(wIndex*4);\n}\n\n/* Return true if value x is found any of the first nCol entries of aiCol[]\n*/\nstatic int hasColumn(const i16 *aiCol, int nCol, int x){\n  while( nCol-- > 0 ) if( x==*(aiCol++) ) return 1;\n  return 0;\n}\n\n/*\n** This routine runs at the end of parsing a CREATE TABLE statement that\n** has a WITHOUT ROWID clause.  The job of this routine is to convert both\n** internal schema data structures and the generated VDBE code so that they\n** are appropriate for a WITHOUT ROWID table instead of a rowid table.\n** Changes include:\n**\n**     (1)  Set all columns of the PRIMARY KEY schema object to be NOT NULL.\n**     (2)  Convert the OP_CreateTable into an OP_CreateIndex.  There is\n**          no rowid btree for a WITHOUT ROWID.  Instead, the canonical\n**          data storage is a covering index btree.\n**     (3)  Bypass the creation of the sqlite_master table entry\n**          for the PRIMARY KEY as the primary key index is now\n**          identified by the sqlite_master table entry of the table itself.\n**     (4)  Set the Index.tnum of the PRIMARY KEY Index object in the\n**          schema to the rootpage from the main table.\n**     (5)  Add all table columns to the PRIMARY KEY Index object\n**          so that the PRIMARY KEY is a covering index.  The surplus\n**          columns are part of KeyInfo.nXField and are not used for\n**          sorting or lookup or uniqueness checks.\n**     (6)  Replace the rowid tail on all automatically generated UNIQUE\n**          indices with the PRIMARY KEY columns.\n**\n** For virtual tables, only (1) is performed.\n*/\nstatic void convertToWithoutRowidTable(Parse *pParse, Table *pTab){\n  Index *pIdx;\n  Index *pPk;\n  int nPk;\n  int i, j;\n  sqlite3 *db = pParse->db;\n  Vdbe *v = pParse->pVdbe;\n\n  /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables)\n  */\n  if( !db->init.imposterTable ){\n    for(i=0; i<pTab->nCol; i++){\n      if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){\n        pTab->aCol[i].notNull = OE_Abort;\n      }\n    }\n  }\n\n  /* The remaining transformations only apply to b-tree tables, not to\n  ** virtual tables */\n  if( IN_DECLARE_VTAB ) return;\n\n  /* Convert the OP_CreateTable opcode that would normally create the\n  ** root-page for the table into an OP_CreateIndex opcode.  The index\n  ** created will become the PRIMARY KEY index.\n  */\n  if( pParse->addrCrTab ){\n    assert( v );\n    sqlite3VdbeChangeOpcode(v, pParse->addrCrTab, OP_CreateIndex);\n  }\n\n  /* Locate the PRIMARY KEY index.  Or, if this table was originally\n  ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. \n  */\n  if( pTab->iPKey>=0 ){\n    ExprList *pList;\n    Token ipkToken;\n    sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName);\n    pList = sqlite3ExprListAppend(pParse, 0, \n                  sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0));\n    if( pList==0 ) return;\n    pList->a[0].sortOrder = pParse->iPkSortOrder;\n    assert( pParse->pNewTable==pTab );\n    sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,\n                       SQLITE_IDXTYPE_PRIMARYKEY);\n    if( db->mallocFailed ) return;\n    pPk = sqlite3PrimaryKeyIndex(pTab);\n    pTab->iPKey = -1;\n  }else{\n    pPk = sqlite3PrimaryKeyIndex(pTab);\n\n    /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master\n    ** table entry. This is only required if currently generating VDBE\n    ** code for a CREATE TABLE (not when parsing one as part of reading\n    ** a database schema).  */\n    if( v ){\n      assert( db->init.busy==0 );\n      sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);\n    }\n\n    /*\n    ** Remove all redundant columns from the PRIMARY KEY.  For example, change\n    ** \"PRIMARY KEY(a,b,a,b,c,b,c,d)\" into just \"PRIMARY KEY(a,b,c,d)\".  Later\n    ** code assumes the PRIMARY KEY contains no repeated columns.\n    */\n    for(i=j=1; i<pPk->nKeyCol; i++){\n      if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){\n        pPk->nColumn--;\n      }else{\n        pPk->aiColumn[j++] = pPk->aiColumn[i];\n      }\n    }\n    pPk->nKeyCol = j;\n  }\n  assert( pPk!=0 );\n  pPk->isCovering = 1;\n  if( !db->init.imposterTable ) pPk->uniqNotNull = 1;\n  nPk = pPk->nKeyCol;\n\n  /* The root page of the PRIMARY KEY is the table root page */\n  pPk->tnum = pTab->tnum;\n\n  /* Update the in-memory representation of all UNIQUE indices by converting\n  ** the final rowid column into one or more columns of the PRIMARY KEY.\n  */\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n    int n;\n    if( IsPrimaryKeyIndex(pIdx) ) continue;\n    for(i=n=0; i<nPk; i++){\n      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++;\n    }\n    if( n==0 ){\n      /* This index is a superset of the primary key */\n      pIdx->nColumn = pIdx->nKeyCol;\n      continue;\n    }\n    if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;\n    for(i=0, j=pIdx->nKeyCol; i<nPk; i++){\n      if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){\n        pIdx->aiColumn[j] = pPk->aiColumn[i];\n        pIdx->azColl[j] = pPk->azColl[i];\n        j++;\n      }\n    }\n    assert( pIdx->nColumn>=pIdx->nKeyCol+n );\n    assert( pIdx->nColumn>=j );\n  }\n\n  /* Add all table columns to the PRIMARY KEY index\n  */\n  if( nPk<pTab->nCol ){\n    if( resizeIndexObject(db, pPk, pTab->nCol) ) return;\n    for(i=0, j=nPk; i<pTab->nCol; i++){\n      if( !hasColumn(pPk->aiColumn, j, i) ){\n        assert( j<pPk->nColumn );\n        pPk->aiColumn[j] = i;\n        pPk->azColl[j] = sqlite3StrBINARY;\n        j++;\n      }\n    }\n    assert( pPk->nColumn==j );\n    assert( pTab->nCol==j );\n  }else{\n    pPk->nColumn = pTab->nCol;\n  }\n}\n\n/*\n** This routine is called to report the final \")\" that terminates\n** a CREATE TABLE statement.\n**\n** The table structure that other action routines have been building\n** is added to the internal hash tables, assuming no errors have\n** occurred.\n**\n** An entry for the table is made in the master table on disk, unless\n** this is a temporary table or db->init.busy==1.  When db->init.busy==1\n** it means we are reading the sqlite_master table because we just\n** connected to the database or because the sqlite_master table has\n** recently changed, so the entry for this table already exists in\n** the sqlite_master table.  We do not want to create it again.\n**\n** If the pSelect argument is not NULL, it means that this routine\n** was called to create a table generated from a \n** \"CREATE TABLE ... AS SELECT ...\" statement.  The column names of\n** the new table will match the result set of the SELECT.\n*/\nvoid sqlite3EndTable(\n  Parse *pParse,          /* Parse context */\n  Token *pCons,           /* The ',' token after the last column defn. */\n  Token *pEnd,            /* The ')' before options in the CREATE TABLE */\n  u8 tabOpts,             /* Extra table options. Usually 0. */\n  Select *pSelect         /* Select from a \"CREATE ... AS SELECT\" */\n){\n  Table *p;                 /* The new table */\n  sqlite3 *db = pParse->db; /* The database connection */\n  int iDb;                  /* Database in which the table lives */\n  Index *pIdx;              /* An implied index of the table */\n\n  if( pEnd==0 && pSelect==0 ){\n    return;\n  }\n  assert( !db->mallocFailed );\n  p = pParse->pNewTable;\n  if( p==0 ) return;\n\n  assert( !db->init.busy || !pSelect );\n\n  /* If the db->init.busy is 1 it means we are reading the SQL off the\n  ** \"sqlite_master\" or \"sqlite_temp_master\" table on the disk.\n  ** So do not write to the disk again.  Extract the root page number\n  ** for the table from the db->init.newTnum field.  (The page number\n  ** should have been put there by the sqliteOpenCb routine.)\n  **\n  ** If the root page number is 1, that means this is the sqlite_master\n  ** table itself.  So mark it read-only.\n  */\n  if( db->init.busy ){\n    p->tnum = db->init.newTnum;\n    if( p->tnum==1 ) p->tabFlags |= TF_Readonly;\n  }\n\n  /* Special processing for WITHOUT ROWID Tables */\n  if( tabOpts & TF_WithoutRowid ){\n    if( (p->tabFlags & TF_Autoincrement) ){\n      sqlite3ErrorMsg(pParse,\n          \"AUTOINCREMENT not allowed on WITHOUT ROWID tables\");\n      return;\n    }\n    if( (p->tabFlags & TF_HasPrimaryKey)==0 ){\n      sqlite3ErrorMsg(pParse, \"PRIMARY KEY missing on table %s\", p->zName);\n    }else{\n      p->tabFlags |= TF_WithoutRowid | TF_NoVisibleRowid;\n      convertToWithoutRowidTable(pParse, p);\n    }\n  }\n\n  iDb = sqlite3SchemaToIndex(db, p->pSchema);\n\n#ifndef SQLITE_OMIT_CHECK\n  /* Resolve names in all CHECK constraint expressions.\n  */\n  if( p->pCheck ){\n    sqlite3ResolveSelfReference(pParse, p, NC_IsCheck, 0, p->pCheck);\n  }\n#endif /* !defined(SQLITE_OMIT_CHECK) */\n\n  /* Estimate the average row size for the table and for all implied indices */\n  estimateTableWidth(p);\n  for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){\n    estimateIndexWidth(pIdx);\n  }\n\n  /* If not initializing, then create a record for the new table\n  ** in the SQLITE_MASTER table of the database.\n  **\n  ** If this is a TEMPORARY table, write the entry into the auxiliary\n  ** file instead of into the main database file.\n  */\n  if( !db->init.busy ){\n    int n;\n    Vdbe *v;\n    char *zType;    /* \"view\" or \"table\" */\n    char *zType2;   /* \"VIEW\" or \"TABLE\" */\n    char *zStmt;    /* Text of the CREATE TABLE or CREATE VIEW statement */\n\n    v = sqlite3GetVdbe(pParse);\n    if( NEVER(v==0) ) return;\n\n    sqlite3VdbeAddOp1(v, OP_Close, 0);\n\n    /* \n    ** Initialize zType for the new view or table.\n    */\n    if( p->pSelect==0 ){\n      /* A regular table */\n      zType = \"table\";\n      zType2 = \"TABLE\";\n#ifndef SQLITE_OMIT_VIEW\n    }else{\n      /* A view */\n      zType = \"view\";\n      zType2 = \"VIEW\";\n#endif\n    }\n\n    /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT\n    ** statement to populate the new table. The root-page number for the\n    ** new table is in register pParse->regRoot.\n    **\n    ** Once the SELECT has been coded by sqlite3Select(), it is in a\n    ** suitable state to query for the column names and types to be used\n    ** by the new table.\n    **\n    ** A shared-cache write-lock is not required to write to the new table,\n    ** as a schema-lock must have already been obtained to create it. Since\n    ** a schema-lock excludes all other database users, the write-lock would\n    ** be redundant.\n    */\n    if( pSelect ){\n      SelectDest dest;    /* Where the SELECT should store results */\n      int regYield;       /* Register holding co-routine entry-point */\n      int addrTop;        /* Top of the co-routine */\n      int regRec;         /* A record to be insert into the new table */\n      int regRowid;       /* Rowid of the next row to insert */\n      int addrInsLoop;    /* Top of the loop for inserting rows */\n      Table *pSelTab;     /* A table that describes the SELECT results */\n\n      regYield = ++pParse->nMem;\n      regRec = ++pParse->nMem;\n      regRowid = ++pParse->nMem;\n      assert(pParse->nTab==1);\n      sqlite3MayAbort(pParse);\n      sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb);\n      sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG);\n      pParse->nTab = 2;\n      addrTop = sqlite3VdbeCurrentAddr(v) + 1;\n      sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);\n      sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield);\n      sqlite3Select(pParse, pSelect, &dest);\n      sqlite3VdbeEndCoroutine(v, regYield);\n      sqlite3VdbeJumpHere(v, addrTop - 1);\n      if( pParse->nErr ) return;\n      pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect);\n      if( pSelTab==0 ) return;\n      assert( p->aCol==0 );\n      p->nCol = pSelTab->nCol;\n      p->aCol = pSelTab->aCol;\n      pSelTab->nCol = 0;\n      pSelTab->aCol = 0;\n      sqlite3DeleteTable(db, pSelTab);\n      addrInsLoop = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm);\n      VdbeCoverage(v);\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec);\n      sqlite3TableAffinity(v, p, 0);\n      sqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid);\n      sqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid);\n      sqlite3VdbeGoto(v, addrInsLoop);\n      sqlite3VdbeJumpHere(v, addrInsLoop);\n      sqlite3VdbeAddOp1(v, OP_Close, 1);\n    }\n\n    /* Compute the complete text of the CREATE statement */\n    if( pSelect ){\n      zStmt = createTableStmt(db, p);\n    }else{\n      Token *pEnd2 = tabOpts ? &pParse->sLastToken : pEnd;\n      n = (int)(pEnd2->z - pParse->sNameToken.z);\n      if( pEnd2->z[0]!=';' ) n += pEnd2->n;\n      zStmt = sqlite3MPrintf(db, \n          \"CREATE %s %.*s\", zType2, n, pParse->sNameToken.z\n      );\n    }\n\n    /* A slot for the record has already been allocated in the \n    ** SQLITE_MASTER table.  We just need to update that slot with all\n    ** the information we've collected.\n    */\n    sqlite3NestedParse(pParse,\n      \"UPDATE %Q.%s \"\n         \"SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q \"\n       \"WHERE rowid=#%d\",\n      db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb),\n      zType,\n      p->zName,\n      p->zName,\n      pParse->regRoot,\n      zStmt,\n      pParse->regRowid\n    );\n    sqlite3DbFree(db, zStmt);\n    sqlite3ChangeCookie(pParse, iDb);\n\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n    /* Check to see if we need to create an sqlite_sequence table for\n    ** keeping track of autoincrement keys.\n    */\n    if( (p->tabFlags & TF_Autoincrement)!=0 ){\n      Db *pDb = &db->aDb[iDb];\n      assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n      if( pDb->pSchema->pSeqTab==0 ){\n        sqlite3NestedParse(pParse,\n          \"CREATE TABLE %Q.sqlite_sequence(name,seq)\",\n          pDb->zDbSName\n        );\n      }\n    }\n#endif\n\n    /* Reparse everything to update our internal data structures */\n    sqlite3VdbeAddParseSchemaOp(v, iDb,\n           sqlite3MPrintf(db, \"tbl_name='%q' AND type!='trigger'\", p->zName));\n  }\n\n\n  /* Add the table to the in-memory representation of the database.\n  */\n  if( db->init.busy ){\n    Table *pOld;\n    Schema *pSchema = p->pSchema;\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);\n    if( pOld ){\n      assert( p==pOld );  /* Malloc must have failed inside HashInsert() */\n      sqlite3OomFault(db);\n      return;\n    }\n    pParse->pNewTable = 0;\n    db->flags |= SQLITE_InternChanges;\n\n#ifndef SQLITE_OMIT_ALTERTABLE\n    if( !p->pSelect ){\n      const char *zName = (const char *)pParse->sNameToken.z;\n      int nName;\n      assert( !pSelect && pCons && pEnd );\n      if( pCons->z==0 ){\n        pCons = pEnd;\n      }\n      nName = (int)((const char *)pCons->z - zName);\n      p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);\n    }\n#endif\n  }\n}\n\n#ifndef SQLITE_OMIT_VIEW\n/*\n** The parser calls this routine in order to create a new VIEW\n*/\nvoid sqlite3CreateView(\n  Parse *pParse,     /* The parsing context */\n  Token *pBegin,     /* The CREATE token that begins the statement */\n  Token *pName1,     /* The token that holds the name of the view */\n  Token *pName2,     /* The token that holds the name of the view */\n  ExprList *pCNames, /* Optional list of view column names */\n  Select *pSelect,   /* A SELECT statement that will become the new view */\n  int isTemp,        /* TRUE for a TEMPORARY view */\n  int noErr          /* Suppress error messages if VIEW already exists */\n){\n  Table *p;\n  int n;\n  const char *z;\n  Token sEnd;\n  DbFixer sFix;\n  Token *pName = 0;\n  int iDb;\n  sqlite3 *db = pParse->db;\n\n  if( pParse->nVar>0 ){\n    sqlite3ErrorMsg(pParse, \"parameters are not allowed in views\");\n    goto create_view_fail;\n  }\n  sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr);\n  p = pParse->pNewTable;\n  if( p==0 || pParse->nErr ) goto create_view_fail;\n  sqlite3TwoPartName(pParse, pName1, pName2, &pName);\n  iDb = sqlite3SchemaToIndex(db, p->pSchema);\n  sqlite3FixInit(&sFix, pParse, iDb, \"view\", pName);\n  if( sqlite3FixSelect(&sFix, pSelect) ) goto create_view_fail;\n\n  /* Make a copy of the entire SELECT statement that defines the view.\n  ** This will force all the Expr.token.z values to be dynamically\n  ** allocated rather than point to the input string - which means that\n  ** they will persist after the current sqlite3_exec() call returns.\n  */\n  p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);\n  p->pCheck = sqlite3ExprListDup(db, pCNames, EXPRDUP_REDUCE);\n  if( db->mallocFailed ) goto create_view_fail;\n\n  /* Locate the end of the CREATE VIEW statement.  Make sEnd point to\n  ** the end.\n  */\n  sEnd = pParse->sLastToken;\n  assert( sEnd.z[0]!=0 );\n  if( sEnd.z[0]!=';' ){\n    sEnd.z += sEnd.n;\n  }\n  sEnd.n = 0;\n  n = (int)(sEnd.z - pBegin->z);\n  assert( n>0 );\n  z = pBegin->z;\n  while( sqlite3Isspace(z[n-1]) ){ n--; }\n  sEnd.z = &z[n-1];\n  sEnd.n = 1;\n\n  /* Use sqlite3EndTable() to add the view to the SQLITE_MASTER table */\n  sqlite3EndTable(pParse, 0, &sEnd, 0, 0);\n\ncreate_view_fail:\n  sqlite3SelectDelete(db, pSelect);\n  sqlite3ExprListDelete(db, pCNames);\n  return;\n}\n#endif /* SQLITE_OMIT_VIEW */\n\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)\n/*\n** The Table structure pTable is really a VIEW.  Fill in the names of\n** the columns of the view in the pTable structure.  Return the number\n** of errors.  If an error is seen leave an error message in pParse->zErrMsg.\n*/\nint sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){\n  Table *pSelTab;   /* A fake table from which we get the result set */\n  Select *pSel;     /* Copy of the SELECT that implements the view */\n  int nErr = 0;     /* Number of errors encountered */\n  int n;            /* Temporarily holds the number of cursors assigned */\n  sqlite3 *db = pParse->db;  /* Database connection for malloc errors */\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  sqlite3_xauth xAuth;       /* Saved xAuth pointer */\n#endif\n\n  assert( pTable );\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( sqlite3VtabCallConnect(pParse, pTable) ){\n    return SQLITE_ERROR;\n  }\n  if( IsVirtual(pTable) ) return 0;\n#endif\n\n#ifndef SQLITE_OMIT_VIEW\n  /* A positive nCol means the columns names for this view are\n  ** already known.\n  */\n  if( pTable->nCol>0 ) return 0;\n\n  /* A negative nCol is a special marker meaning that we are currently\n  ** trying to compute the column names.  If we enter this routine with\n  ** a negative nCol, it means two or more views form a loop, like this:\n  **\n  **     CREATE VIEW one AS SELECT * FROM two;\n  **     CREATE VIEW two AS SELECT * FROM one;\n  **\n  ** Actually, the error above is now caught prior to reaching this point.\n  ** But the following test is still important as it does come up\n  ** in the following:\n  ** \n  **     CREATE TABLE main.ex1(a);\n  **     CREATE TEMP VIEW ex1 AS SELECT a FROM ex1;\n  **     SELECT * FROM temp.ex1;\n  */\n  if( pTable->nCol<0 ){\n    sqlite3ErrorMsg(pParse, \"view %s is circularly defined\", pTable->zName);\n    return 1;\n  }\n  assert( pTable->nCol>=0 );\n\n  /* If we get this far, it means we need to compute the table names.\n  ** Note that the call to sqlite3ResultSetOfSelect() will expand any\n  ** \"*\" elements in the results set of the view and will assign cursors\n  ** to the elements of the FROM clause.  But we do not want these changes\n  ** to be permanent.  So the computation is done on a copy of the SELECT\n  ** statement that defines the view.\n  */\n  assert( pTable->pSelect );\n  pSel = sqlite3SelectDup(db, pTable->pSelect, 0);\n  if( pSel ){\n    n = pParse->nTab;\n    sqlite3SrcListAssignCursors(pParse, pSel->pSrc);\n    pTable->nCol = -1;\n    db->lookaside.bDisable++;\n#ifndef SQLITE_OMIT_AUTHORIZATION\n    xAuth = db->xAuth;\n    db->xAuth = 0;\n    pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);\n    db->xAuth = xAuth;\n#else\n    pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);\n#endif\n    pParse->nTab = n;\n    if( pTable->pCheck ){\n      /* CREATE VIEW name(arglist) AS ...\n      ** The names of the columns in the table are taken from\n      ** arglist which is stored in pTable->pCheck.  The pCheck field\n      ** normally holds CHECK constraints on an ordinary table, but for\n      ** a VIEW it holds the list of column names.\n      */\n      sqlite3ColumnsFromExprList(pParse, pTable->pCheck, \n                                 &pTable->nCol, &pTable->aCol);\n      if( db->mallocFailed==0 \n       && pParse->nErr==0\n       && pTable->nCol==pSel->pEList->nExpr\n      ){\n        sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel);\n      }\n    }else if( pSelTab ){\n      /* CREATE VIEW name AS...  without an argument list.  Construct\n      ** the column names from the SELECT statement that defines the view.\n      */\n      assert( pTable->aCol==0 );\n      pTable->nCol = pSelTab->nCol;\n      pTable->aCol = pSelTab->aCol;\n      pSelTab->nCol = 0;\n      pSelTab->aCol = 0;\n      assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );\n    }else{\n      pTable->nCol = 0;\n      nErr++;\n    }\n    sqlite3DeleteTable(db, pSelTab);\n    sqlite3SelectDelete(db, pSel);\n    db->lookaside.bDisable--;\n  } else {\n    nErr++;\n  }\n  pTable->pSchema->schemaFlags |= DB_UnresetViews;\n#endif /* SQLITE_OMIT_VIEW */\n  return nErr;  \n}\n#endif /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */\n\n#ifndef SQLITE_OMIT_VIEW\n/*\n** Clear the column names from every VIEW in database idx.\n*/\nstatic void sqliteViewResetAll(sqlite3 *db, int idx){\n  HashElem *i;\n  assert( sqlite3SchemaMutexHeld(db, idx, 0) );\n  if( !DbHasProperty(db, idx, DB_UnresetViews) ) return;\n  for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){\n    Table *pTab = sqliteHashData(i);\n    if( pTab->pSelect ){\n      sqlite3DeleteColumnNames(db, pTab);\n      pTab->aCol = 0;\n      pTab->nCol = 0;\n    }\n  }\n  DbClearProperty(db, idx, DB_UnresetViews);\n}\n#else\n# define sqliteViewResetAll(A,B)\n#endif /* SQLITE_OMIT_VIEW */\n\n/*\n** This function is called by the VDBE to adjust the internal schema\n** used by SQLite when the btree layer moves a table root page. The\n** root-page of a table or index in database iDb has changed from iFrom\n** to iTo.\n**\n** Ticket #1728:  The symbol table might still contain information\n** on tables and/or indices that are the process of being deleted.\n** If you are unlucky, one of those deleted indices or tables might\n** have the same rootpage number as the real table or index that is\n** being moved.  So we cannot stop searching after the first match \n** because the first match might be for one of the deleted indices\n** or tables and not the table/index that is actually being moved.\n** We must continue looping until all tables and indices with\n** rootpage==iFrom have been converted to have a rootpage of iTo\n** in order to be certain that we got the right one.\n*/\n#ifndef SQLITE_OMIT_AUTOVACUUM\nvoid sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iTo){\n  HashElem *pElem;\n  Hash *pHash;\n  Db *pDb;\n\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  pDb = &db->aDb[iDb];\n  pHash = &pDb->pSchema->tblHash;\n  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){\n    Table *pTab = sqliteHashData(pElem);\n    if( pTab->tnum==iFrom ){\n      pTab->tnum = iTo;\n    }\n  }\n  pHash = &pDb->pSchema->idxHash;\n  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){\n    Index *pIdx = sqliteHashData(pElem);\n    if( pIdx->tnum==iFrom ){\n      pIdx->tnum = iTo;\n    }\n  }\n}\n#endif\n\n/*\n** Write code to erase the table with root-page iTable from database iDb.\n** Also write code to modify the sqlite_master table and internal schema\n** if a root-page of another table is moved by the btree-layer whilst\n** erasing iTable (this can happen with an auto-vacuum database).\n*/ \nstatic void destroyRootPage(Parse *pParse, int iTable, int iDb){\n  Vdbe *v = sqlite3GetVdbe(pParse);\n  int r1 = sqlite3GetTempReg(pParse);\n  assert( iTable>1 );\n  sqlite3VdbeAddOp3(v, OP_Destroy, iTable, r1, iDb);\n  sqlite3MayAbort(pParse);\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  /* OP_Destroy stores an in integer r1. If this integer\n  ** is non-zero, then it is the root page number of a table moved to\n  ** location iTable. The following code modifies the sqlite_master table to\n  ** reflect this.\n  **\n  ** The \"#NNN\" in the SQL is a special constant that means whatever value\n  ** is in register NNN.  See grammar rules associated with the TK_REGISTER\n  ** token for additional information.\n  */\n  sqlite3NestedParse(pParse, \n     \"UPDATE %Q.%s SET rootpage=%d WHERE #%d AND rootpage=#%d\",\n     pParse->db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), iTable, r1, r1);\n#endif\n  sqlite3ReleaseTempReg(pParse, r1);\n}\n\n/*\n** Write VDBE code to erase table pTab and all associated indices on disk.\n** Code to update the sqlite_master tables and internal schema definitions\n** in case a root-page belonging to another table is moved by the btree layer\n** is also added (this can happen with an auto-vacuum database).\n*/\nstatic void destroyTable(Parse *pParse, Table *pTab){\n#ifdef SQLITE_OMIT_AUTOVACUUM\n  Index *pIdx;\n  int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n  destroyRootPage(pParse, pTab->tnum, iDb);\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n    destroyRootPage(pParse, pIdx->tnum, iDb);\n  }\n#else\n  /* If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM\n  ** is not defined), then it is important to call OP_Destroy on the\n  ** table and index root-pages in order, starting with the numerically \n  ** largest root-page number. This guarantees that none of the root-pages\n  ** to be destroyed is relocated by an earlier OP_Destroy. i.e. if the\n  ** following were coded:\n  **\n  ** OP_Destroy 4 0\n  ** ...\n  ** OP_Destroy 5 0\n  **\n  ** and root page 5 happened to be the largest root-page number in the\n  ** database, then root page 5 would be moved to page 4 by the \n  ** \"OP_Destroy 4 0\" opcode. The subsequent \"OP_Destroy 5 0\" would hit\n  ** a free-list page.\n  */\n  int iTab = pTab->tnum;\n  int iDestroyed = 0;\n\n  while( 1 ){\n    Index *pIdx;\n    int iLargest = 0;\n\n    if( iDestroyed==0 || iTab<iDestroyed ){\n      iLargest = iTab;\n    }\n    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n      int iIdx = pIdx->tnum;\n      assert( pIdx->pSchema==pTab->pSchema );\n      if( (iDestroyed==0 || (iIdx<iDestroyed)) && iIdx>iLargest ){\n        iLargest = iIdx;\n      }\n    }\n    if( iLargest==0 ){\n      return;\n    }else{\n      int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n      assert( iDb>=0 && iDb<pParse->db->nDb );\n      destroyRootPage(pParse, iLargest, iDb);\n      iDestroyed = iLargest;\n    }\n  }\n#endif\n}\n\n/*\n** Remove entries from the sqlite_statN tables (for N in (1,2,3))\n** after a DROP INDEX or DROP TABLE command.\n*/\nstatic void sqlite3ClearStatTables(\n  Parse *pParse,         /* The parsing context */\n  int iDb,               /* The database number */\n  const char *zType,     /* \"idx\" or \"tbl\" */\n  const char *zName      /* Name of index or table */\n){\n  int i;\n  const char *zDbName = pParse->db->aDb[iDb].zDbSName;\n  for(i=1; i<=4; i++){\n    char zTab[24];\n    sqlite3_snprintf(sizeof(zTab),zTab,\"sqlite_stat%d\",i);\n    if( sqlite3FindTable(pParse->db, zTab, zDbName) ){\n      sqlite3NestedParse(pParse,\n        \"DELETE FROM %Q.%s WHERE %s=%Q\",\n        zDbName, zTab, zType, zName\n      );\n    }\n  }\n}\n\n/*\n** Generate code to drop a table.\n*/\nvoid sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){\n  Vdbe *v;\n  sqlite3 *db = pParse->db;\n  Trigger *pTrigger;\n  Db *pDb = &db->aDb[iDb];\n\n  v = sqlite3GetVdbe(pParse);\n  assert( v!=0 );\n  sqlite3BeginWriteOperation(pParse, 1, iDb);\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( IsVirtual(pTab) ){\n    sqlite3VdbeAddOp0(v, OP_VBegin);\n  }\n#endif\n\n  /* Drop all triggers associated with the table being dropped. Code\n  ** is generated to remove entries from sqlite_master and/or\n  ** sqlite_temp_master if required.\n  */\n  pTrigger = sqlite3TriggerList(pParse, pTab);\n  while( pTrigger ){\n    assert( pTrigger->pSchema==pTab->pSchema || \n        pTrigger->pSchema==db->aDb[1].pSchema );\n    sqlite3DropTriggerPtr(pParse, pTrigger);\n    pTrigger = pTrigger->pNext;\n  }\n\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n  /* Remove any entries of the sqlite_sequence table associated with\n  ** the table being dropped. This is done before the table is dropped\n  ** at the btree level, in case the sqlite_sequence table needs to\n  ** move as a result of the drop (can happen in auto-vacuum mode).\n  */\n  if( pTab->tabFlags & TF_Autoincrement ){\n    sqlite3NestedParse(pParse,\n      \"DELETE FROM %Q.sqlite_sequence WHERE name=%Q\",\n      pDb->zDbSName, pTab->zName\n    );\n  }\n#endif\n\n  /* Drop all SQLITE_MASTER table and index entries that refer to the\n  ** table. The program name loops through the master table and deletes\n  ** every row that refers to a table of the same name as the one being\n  ** dropped. Triggers are handled separately because a trigger can be\n  ** created in the temp database that refers to a table in another\n  ** database.\n  */\n  sqlite3NestedParse(pParse, \n      \"DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'\",\n      pDb->zDbSName, SCHEMA_TABLE(iDb), pTab->zName);\n  if( !isView && !IsVirtual(pTab) ){\n    destroyTable(pParse, pTab);\n  }\n\n  /* Remove the table entry from SQLite's internal schema and modify\n  ** the schema cookie.\n  */\n  if( IsVirtual(pTab) ){\n    sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0);\n  }\n  sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);\n  sqlite3ChangeCookie(pParse, iDb);\n  sqliteViewResetAll(db, iDb);\n}\n\n/*\n** This routine is called to do the work of a DROP TABLE statement.\n** pName is the name of the table to be dropped.\n*/\nvoid sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){\n  Table *pTab;\n  Vdbe *v;\n  sqlite3 *db = pParse->db;\n  int iDb;\n\n  if( db->mallocFailed ){\n    goto exit_drop_table;\n  }\n  assert( pParse->nErr==0 );\n  assert( pName->nSrc==1 );\n  if( sqlite3ReadSchema(pParse) ) goto exit_drop_table;\n  if( noErr ) db->suppressErr++;\n  assert( isView==0 || isView==LOCATE_VIEW );\n  pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]);\n  if( noErr ) db->suppressErr--;\n\n  if( pTab==0 ){\n    if( noErr ) sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase);\n    goto exit_drop_table;\n  }\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n  assert( iDb>=0 && iDb<db->nDb );\n\n  /* If pTab is a virtual table, call ViewGetColumnNames() to ensure\n  ** it is initialized.\n  */\n  if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){\n    goto exit_drop_table;\n  }\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  {\n    int code;\n    const char *zTab = SCHEMA_TABLE(iDb);\n    const char *zDb = db->aDb[iDb].zDbSName;\n    const char *zArg2 = 0;\n    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){\n      goto exit_drop_table;\n    }\n    if( isView ){\n      if( !OMIT_TEMPDB && iDb==1 ){\n        code = SQLITE_DROP_TEMP_VIEW;\n      }else{\n        code = SQLITE_DROP_VIEW;\n      }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    }else if( IsVirtual(pTab) ){\n      code = SQLITE_DROP_VTABLE;\n      zArg2 = sqlite3GetVTable(db, pTab)->pMod->zName;\n#endif\n    }else{\n      if( !OMIT_TEMPDB && iDb==1 ){\n        code = SQLITE_DROP_TEMP_TABLE;\n      }else{\n        code = SQLITE_DROP_TABLE;\n      }\n    }\n    if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){\n      goto exit_drop_table;\n    }\n    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){\n      goto exit_drop_table;\n    }\n  }\n#endif\n  if( sqlite3StrNICmp(pTab->zName, \"sqlite_\", 7)==0 \n    && sqlite3StrNICmp(pTab->zName, \"sqlite_stat\", 11)!=0 ){\n    sqlite3ErrorMsg(pParse, \"table %s may not be dropped\", pTab->zName);\n    goto exit_drop_table;\n  }\n\n#ifndef SQLITE_OMIT_VIEW\n  /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used\n  ** on a table.\n  */\n  if( isView && pTab->pSelect==0 ){\n    sqlite3ErrorMsg(pParse, \"use DROP TABLE to delete table %s\", pTab->zName);\n    goto exit_drop_table;\n  }\n  if( !isView && pTab->pSelect ){\n    sqlite3ErrorMsg(pParse, \"use DROP VIEW to delete view %s\", pTab->zName);\n    goto exit_drop_table;\n  }\n#endif\n\n  /* Generate code to remove the table from the master table\n  ** on disk.\n  */\n  v = sqlite3GetVdbe(pParse);\n  if( v ){\n    sqlite3BeginWriteOperation(pParse, 1, iDb);\n    sqlite3ClearStatTables(pParse, iDb, \"tbl\", pTab->zName);\n    sqlite3FkDropTable(pParse, pName, pTab);\n    sqlite3CodeDropTable(pParse, pTab, iDb, isView);\n  }\n\nexit_drop_table:\n  sqlite3SrcListDelete(db, pName);\n}\n\n/*\n** This routine is called to create a new foreign key on the table\n** currently under construction.  pFromCol determines which columns\n** in the current table point to the foreign key.  If pFromCol==0 then\n** connect the key to the last column inserted.  pTo is the name of\n** the table referred to (a.k.a the \"parent\" table).  pToCol is a list\n** of tables in the parent pTo table.  flags contains all\n** information about the conflict resolution algorithms specified\n** in the ON DELETE, ON UPDATE and ON INSERT clauses.\n**\n** An FKey structure is created and added to the table currently\n** under construction in the pParse->pNewTable field.\n**\n** The foreign key is set for IMMEDIATE processing.  A subsequent call\n** to sqlite3DeferForeignKey() might change this to DEFERRED.\n*/\nvoid sqlite3CreateForeignKey(\n  Parse *pParse,       /* Parsing context */\n  ExprList *pFromCol,  /* Columns in this table that point to other table */\n  Token *pTo,          /* Name of the other table */\n  ExprList *pToCol,    /* Columns in the other table */\n  int flags            /* Conflict resolution algorithms. */\n){\n  sqlite3 *db = pParse->db;\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n  FKey *pFKey = 0;\n  FKey *pNextTo;\n  Table *p = pParse->pNewTable;\n  int nByte;\n  int i;\n  int nCol;\n  char *z;\n\n  assert( pTo!=0 );\n  if( p==0 || IN_DECLARE_VTAB ) goto fk_end;\n  if( pFromCol==0 ){\n    int iCol = p->nCol-1;\n    if( NEVER(iCol<0) ) goto fk_end;\n    if( pToCol && pToCol->nExpr!=1 ){\n      sqlite3ErrorMsg(pParse, \"foreign key on %s\"\n         \" should reference only one column of table %T\",\n         p->aCol[iCol].zName, pTo);\n      goto fk_end;\n    }\n    nCol = 1;\n  }else if( pToCol && pToCol->nExpr!=pFromCol->nExpr ){\n    sqlite3ErrorMsg(pParse,\n        \"number of columns in foreign key does not match the number of \"\n        \"columns in the referenced table\");\n    goto fk_end;\n  }else{\n    nCol = pFromCol->nExpr;\n  }\n  nByte = sizeof(*pFKey) + (nCol-1)*sizeof(pFKey->aCol[0]) + pTo->n + 1;\n  if( pToCol ){\n    for(i=0; i<pToCol->nExpr; i++){\n      nByte += sqlite3Strlen30(pToCol->a[i].zName) + 1;\n    }\n  }\n  pFKey = sqlite3DbMallocZero(db, nByte );\n  if( pFKey==0 ){\n    goto fk_end;\n  }\n  pFKey->pFrom = p;\n  pFKey->pNextFrom = p->pFKey;\n  z = (char*)&pFKey->aCol[nCol];\n  pFKey->zTo = z;\n  memcpy(z, pTo->z, pTo->n);\n  z[pTo->n] = 0;\n  sqlite3Dequote(z);\n  z += pTo->n+1;\n  pFKey->nCol = nCol;\n  if( pFromCol==0 ){\n    pFKey->aCol[0].iFrom = p->nCol-1;\n  }else{\n    for(i=0; i<nCol; i++){\n      int j;\n      for(j=0; j<p->nCol; j++){\n        if( sqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zName)==0 ){\n          pFKey->aCol[i].iFrom = j;\n          break;\n        }\n      }\n      if( j>=p->nCol ){\n        sqlite3ErrorMsg(pParse, \n          \"unknown column \\\"%s\\\" in foreign key definition\", \n          pFromCol->a[i].zName);\n        goto fk_end;\n      }\n    }\n  }\n  if( pToCol ){\n    for(i=0; i<nCol; i++){\n      int n = sqlite3Strlen30(pToCol->a[i].zName);\n      pFKey->aCol[i].zCol = z;\n      memcpy(z, pToCol->a[i].zName, n);\n      z[n] = 0;\n      z += n+1;\n    }\n  }\n  pFKey->isDeferred = 0;\n  pFKey->aAction[0] = (u8)(flags & 0xff);            /* ON DELETE action */\n  pFKey->aAction[1] = (u8)((flags >> 8 ) & 0xff);    /* ON UPDATE action */\n\n  assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) );\n  pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash, \n      pFKey->zTo, (void *)pFKey\n  );\n  if( pNextTo==pFKey ){\n    sqlite3OomFault(db);\n    goto fk_end;\n  }\n  if( pNextTo ){\n    assert( pNextTo->pPrevTo==0 );\n    pFKey->pNextTo = pNextTo;\n    pNextTo->pPrevTo = pFKey;\n  }\n\n  /* Link the foreign key to the table as the last step.\n  */\n  p->pFKey = pFKey;\n  pFKey = 0;\n\nfk_end:\n  sqlite3DbFree(db, pFKey);\n#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */\n  sqlite3ExprListDelete(db, pFromCol);\n  sqlite3ExprListDelete(db, pToCol);\n}\n\n/*\n** This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED\n** clause is seen as part of a foreign key definition.  The isDeferred\n** parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE.\n** The behavior of the most recently created foreign key is adjusted\n** accordingly.\n*/\nvoid sqlite3DeferForeignKey(Parse *pParse, int isDeferred){\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n  Table *pTab;\n  FKey *pFKey;\n  if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;\n  assert( isDeferred==0 || isDeferred==1 ); /* EV: R-30323-21917 */\n  pFKey->isDeferred = (u8)isDeferred;\n#endif\n}\n\n/*\n** Generate code that will erase and refill index *pIdx.  This is\n** used to initialize a newly created index or to recompute the\n** content of an index in response to a REINDEX command.\n**\n** if memRootPage is not negative, it means that the index is newly\n** created.  The register specified by memRootPage contains the\n** root page number of the index.  If memRootPage is negative, then\n** the index already exists and must be cleared before being refilled and\n** the root page number of the index is taken from pIndex->tnum.\n*/\nstatic void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){\n  Table *pTab = pIndex->pTable;  /* The table that is indexed */\n  int iTab = pParse->nTab++;     /* Btree cursor used for pTab */\n  int iIdx = pParse->nTab++;     /* Btree cursor used for pIndex */\n  int iSorter;                   /* Cursor opened by OpenSorter (if in use) */\n  int addr1;                     /* Address of top of loop */\n  int addr2;                     /* Address to jump to for next iteration */\n  int tnum;                      /* Root page of index */\n  int iPartIdxLabel;             /* Jump to this label to skip a row */\n  Vdbe *v;                       /* Generate code into this virtual machine */\n  KeyInfo *pKey;                 /* KeyInfo for index */\n  int regRecord;                 /* Register holding assembled index record */\n  sqlite3 *db = pParse->db;      /* The database connection */\n  int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,\n      db->aDb[iDb].zDbSName ) ){\n    return;\n  }\n#endif\n\n  /* Require a write-lock on the table to perform this operation */\n  sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);\n\n  v = sqlite3GetVdbe(pParse);\n  if( v==0 ) return;\n  if( memRootPage>=0 ){\n    tnum = memRootPage;\n  }else{\n    tnum = pIndex->tnum;\n  }\n  pKey = sqlite3KeyInfoOfIndex(pParse, pIndex);\n  assert( pKey!=0 || db->mallocFailed || pParse->nErr );\n\n  /* Open the sorter cursor if we are to use one. */\n  iSorter = pParse->nTab++;\n  sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, pIndex->nKeyCol, (char*)\n                    sqlite3KeyInfoRef(pKey), P4_KEYINFO);\n\n  /* Open the table. Loop through all rows of the table, inserting index\n  ** records into the sorter. */\n  sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);\n  addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0); VdbeCoverage(v);\n  regRecord = sqlite3GetTempReg(pParse);\n\n  sqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0);\n  sqlite3VdbeAddOp2(v, OP_SorterInsert, iSorter, regRecord);\n  sqlite3ResolvePartIdxLabel(pParse, iPartIdxLabel);\n  sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); VdbeCoverage(v);\n  sqlite3VdbeJumpHere(v, addr1);\n  if( memRootPage<0 ) sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb);\n  sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb, \n                    (char *)pKey, P4_KEYINFO);\n  sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0));\n\n  addr1 = sqlite3VdbeAddOp2(v, OP_SorterSort, iSorter, 0); VdbeCoverage(v);\n  if( IsUniqueIndex(pIndex) ){\n    int j2 = sqlite3VdbeCurrentAddr(v) + 3;\n    sqlite3VdbeGoto(v, j2);\n    addr2 = sqlite3VdbeCurrentAddr(v);\n    sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord,\n                         pIndex->nKeyCol); VdbeCoverage(v);\n    sqlite3UniqueConstraint(pParse, OE_Abort, pIndex);\n  }else{\n    addr2 = sqlite3VdbeCurrentAddr(v);\n  }\n  sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx);\n  sqlite3VdbeAddOp3(v, OP_Last, iIdx, 0, -1);\n  sqlite3VdbeAddOp3(v, OP_IdxInsert, iIdx, regRecord, 0);\n  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\n  sqlite3ReleaseTempReg(pParse, regRecord);\n  sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); VdbeCoverage(v);\n  sqlite3VdbeJumpHere(v, addr1);\n\n  sqlite3VdbeAddOp1(v, OP_Close, iTab);\n  sqlite3VdbeAddOp1(v, OP_Close, iIdx);\n  sqlite3VdbeAddOp1(v, OP_Close, iSorter);\n}\n\n/*\n** Allocate heap space to hold an Index object with nCol columns.\n**\n** Increase the allocation size to provide an extra nExtra bytes\n** of 8-byte aligned space after the Index object and return a\n** pointer to this extra space in *ppExtra.\n*/\nIndex *sqlite3AllocateIndexObject(\n  sqlite3 *db,         /* Database connection */\n  i16 nCol,            /* Total number of columns in the index */\n  int nExtra,          /* Number of bytes of extra space to alloc */\n  char **ppExtra       /* Pointer to the \"extra\" space */\n){\n  Index *p;            /* Allocated index object */\n  int nByte;           /* Bytes of space for Index object + arrays */\n\n  nByte = ROUND8(sizeof(Index)) +              /* Index structure  */\n          ROUND8(sizeof(char*)*nCol) +         /* Index.azColl     */\n          ROUND8(sizeof(LogEst)*(nCol+1) +     /* Index.aiRowLogEst   */\n                 sizeof(i16)*nCol +            /* Index.aiColumn   */\n                 sizeof(u8)*nCol);             /* Index.aSortOrder */\n  p = sqlite3DbMallocZero(db, nByte + nExtra);\n  if( p ){\n    char *pExtra = ((char*)p)+ROUND8(sizeof(Index));\n    p->azColl = (const char**)pExtra; pExtra += ROUND8(sizeof(char*)*nCol);\n    p->aiRowLogEst = (LogEst*)pExtra; pExtra += sizeof(LogEst)*(nCol+1);\n    p->aiColumn = (i16*)pExtra;       pExtra += sizeof(i16)*nCol;\n    p->aSortOrder = (u8*)pExtra;\n    p->nColumn = nCol;\n    p->nKeyCol = nCol - 1;\n    *ppExtra = ((char*)p) + nByte;\n  }\n  return p;\n}\n\n/*\n** Create a new index for an SQL table.  pName1.pName2 is the name of the index \n** and pTblList is the name of the table that is to be indexed.  Both will \n** be NULL for a primary key or an index that is created to satisfy a\n** UNIQUE constraint.  If pTable and pIndex are NULL, use pParse->pNewTable\n** as the table to be indexed.  pParse->pNewTable is a table that is\n** currently being constructed by a CREATE TABLE statement.\n**\n** pList is a list of columns to be indexed.  pList will be NULL if this\n** is a primary key or unique-constraint on the most recent column added\n** to the table currently under construction.  \n*/\nvoid sqlite3CreateIndex(\n  Parse *pParse,     /* All information about this parse */\n  Token *pName1,     /* First part of index name. May be NULL */\n  Token *pName2,     /* Second part of index name. May be NULL */\n  SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */\n  ExprList *pList,   /* A list of columns to be indexed */\n  int onError,       /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */\n  Token *pStart,     /* The CREATE token that begins this statement */\n  Expr *pPIWhere,    /* WHERE clause for partial indices */\n  int sortOrder,     /* Sort order of primary key when pList==NULL */\n  int ifNotExist,    /* Omit error if index already exists */\n  u8 idxType         /* The index type */\n){\n  Table *pTab = 0;     /* Table to be indexed */\n  Index *pIndex = 0;   /* The index to be created */\n  char *zName = 0;     /* Name of the index */\n  int nName;           /* Number of characters in zName */\n  int i, j;\n  DbFixer sFix;        /* For assigning database names to pTable */\n  int sortOrderMask;   /* 1 to honor DESC in index.  0 to ignore. */\n  sqlite3 *db = pParse->db;\n  Db *pDb;             /* The specific table containing the indexed database */\n  int iDb;             /* Index of the database that is being written */\n  Token *pName = 0;    /* Unqualified name of the index to create */\n  struct ExprList_item *pListItem; /* For looping over pList */\n  int nExtra = 0;                  /* Space allocated for zExtra[] */\n  int nExtraCol;                   /* Number of extra columns needed */\n  char *zExtra = 0;                /* Extra space after the Index object */\n  Index *pPk = 0;      /* PRIMARY KEY index for WITHOUT ROWID tables */\n\n  if( db->mallocFailed || pParse->nErr>0 ){\n    goto exit_create_index;\n  }\n  if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){\n    goto exit_create_index;\n  }\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\n    goto exit_create_index;\n  }\n\n  /*\n  ** Find the table that is to be indexed.  Return early if not found.\n  */\n  if( pTblName!=0 ){\n\n    /* Use the two-part index name to determine the database \n    ** to search for the table. 'Fix' the table name to this db\n    ** before looking up the table.\n    */\n    assert( pName1 && pName2 );\n    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);\n    if( iDb<0 ) goto exit_create_index;\n    assert( pName && pName->z );\n\n#ifndef SQLITE_OMIT_TEMPDB\n    /* If the index name was unqualified, check if the table\n    ** is a temp table. If so, set the database to 1. Do not do this\n    ** if initialising a database schema.\n    */\n    if( !db->init.busy ){\n      pTab = sqlite3SrcListLookup(pParse, pTblName);\n      if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){\n        iDb = 1;\n      }\n    }\n#endif\n\n    sqlite3FixInit(&sFix, pParse, iDb, \"index\", pName);\n    if( sqlite3FixSrcList(&sFix, pTblName) ){\n      /* Because the parser constructs pTblName from a single identifier,\n      ** sqlite3FixSrcList can never fail. */\n      assert(0);\n    }\n    pTab = sqlite3LocateTableItem(pParse, 0, &pTblName->a[0]);\n    assert( db->mallocFailed==0 || pTab==0 );\n    if( pTab==0 ) goto exit_create_index;\n    if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){\n      sqlite3ErrorMsg(pParse, \n           \"cannot create a TEMP index on non-TEMP table \\\"%s\\\"\",\n           pTab->zName);\n      goto exit_create_index;\n    }\n    if( !HasRowid(pTab) ) pPk = sqlite3PrimaryKeyIndex(pTab);\n  }else{\n    assert( pName==0 );\n    assert( pStart==0 );\n    pTab = pParse->pNewTable;\n    if( !pTab ) goto exit_create_index;\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n  }\n  pDb = &db->aDb[iDb];\n\n  assert( pTab!=0 );\n  assert( pParse->nErr==0 );\n  if( sqlite3StrNICmp(pTab->zName, \"sqlite_\", 7)==0 \n       && db->init.busy==0\n#if SQLITE_USER_AUTHENTICATION\n       && sqlite3UserAuthTable(pTab->zName)==0\n#endif\n       && sqlite3StrNICmp(&pTab->zName[7],\"altertab_\",9)!=0 ){\n    sqlite3ErrorMsg(pParse, \"table %s may not be indexed\", pTab->zName);\n    goto exit_create_index;\n  }\n#ifndef SQLITE_OMIT_VIEW\n  if( pTab->pSelect ){\n    sqlite3ErrorMsg(pParse, \"views may not be indexed\");\n    goto exit_create_index;\n  }\n#endif\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( IsVirtual(pTab) ){\n    sqlite3ErrorMsg(pParse, \"virtual tables may not be indexed\");\n    goto exit_create_index;\n  }\n#endif\n\n  /*\n  ** Find the name of the index.  Make sure there is not already another\n  ** index or table with the same name.  \n  **\n  ** Exception:  If we are reading the names of permanent indices from the\n  ** sqlite_master table (because some other process changed the schema) and\n  ** one of the index names collides with the name of a temporary table or\n  ** index, then we will continue to process this index.\n  **\n  ** If pName==0 it means that we are\n  ** dealing with a primary key or UNIQUE constraint.  We have to invent our\n  ** own name.\n  */\n  if( pName ){\n    zName = sqlite3NameFromToken(db, pName);\n    if( zName==0 ) goto exit_create_index;\n    assert( pName->z!=0 );\n    if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){\n      goto exit_create_index;\n    }\n    if( !db->init.busy ){\n      if( sqlite3FindTable(db, zName, 0)!=0 ){\n        sqlite3ErrorMsg(pParse, \"there is already a table named %s\", zName);\n        goto exit_create_index;\n      }\n    }\n    if( sqlite3FindIndex(db, zName, pDb->zDbSName)!=0 ){\n      if( !ifNotExist ){\n        sqlite3ErrorMsg(pParse, \"index %s already exists\", zName);\n      }else{\n        assert( !db->init.busy );\n        sqlite3CodeVerifySchema(pParse, iDb);\n      }\n      goto exit_create_index;\n    }\n  }else{\n    int n;\n    Index *pLoop;\n    for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}\n    zName = sqlite3MPrintf(db, \"sqlite_autoindex_%s_%d\", pTab->zName, n);\n    if( zName==0 ){\n      goto exit_create_index;\n    }\n\n    /* Automatic index names generated from within sqlite3_declare_vtab()\n    ** must have names that are distinct from normal automatic index names.\n    ** The following statement converts \"sqlite3_autoindex...\" into\n    ** \"sqlite3_butoindex...\" in order to make the names distinct.\n    ** The \"vtab_err.test\" test demonstrates the need of this statement. */\n    if( IN_DECLARE_VTAB ) zName[7]++;\n  }\n\n  /* Check for authorization to create an index.\n  */\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  {\n    const char *zDb = pDb->zDbSName;\n    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){\n      goto exit_create_index;\n    }\n    i = SQLITE_CREATE_INDEX;\n    if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX;\n    if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){\n      goto exit_create_index;\n    }\n  }\n#endif\n\n  /* If pList==0, it means this routine was called to make a primary\n  ** key out of the last column added to the table under construction.\n  ** So create a fake list to simulate this.\n  */\n  if( pList==0 ){\n    Token prevCol;\n    sqlite3TokenInit(&prevCol, pTab->aCol[pTab->nCol-1].zName);\n    pList = sqlite3ExprListAppend(pParse, 0,\n              sqlite3ExprAlloc(db, TK_ID, &prevCol, 0));\n    if( pList==0 ) goto exit_create_index;\n    assert( pList->nExpr==1 );\n    sqlite3ExprListSetSortOrder(pList, sortOrder);\n  }else{\n    sqlite3ExprListCheckLength(pParse, pList, \"index\");\n  }\n\n  /* Figure out how many bytes of space are required to store explicitly\n  ** specified collation sequence names.\n  */\n  for(i=0; i<pList->nExpr; i++){\n    Expr *pExpr = pList->a[i].pExpr;\n    assert( pExpr!=0 );\n    if( pExpr->op==TK_COLLATE ){\n      nExtra += (1 + sqlite3Strlen30(pExpr->u.zToken));\n    }\n  }\n\n  /* \n  ** Allocate the index structure. \n  */\n  nName = sqlite3Strlen30(zName);\n  nExtraCol = pPk ? pPk->nKeyCol : 1;\n  pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol,\n                                      nName + nExtra + 1, &zExtra);\n  if( db->mallocFailed ){\n    goto exit_create_index;\n  }\n  assert( EIGHT_BYTE_ALIGNMENT(pIndex->aiRowLogEst) );\n  assert( EIGHT_BYTE_ALIGNMENT(pIndex->azColl) );\n  pIndex->zName = zExtra;\n  zExtra += nName + 1;\n  memcpy(pIndex->zName, zName, nName+1);\n  pIndex->pTable = pTab;\n  pIndex->onError = (u8)onError;\n  pIndex->uniqNotNull = onError!=OE_None;\n  pIndex->idxType = idxType;\n  pIndex->pSchema = db->aDb[iDb].pSchema;\n  pIndex->nKeyCol = pList->nExpr;\n  if( pPIWhere ){\n    sqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0);\n    pIndex->pPartIdxWhere = pPIWhere;\n    pPIWhere = 0;\n  }\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n\n  /* Check to see if we should honor DESC requests on index columns\n  */\n  if( pDb->pSchema->file_format>=4 ){\n    sortOrderMask = -1;   /* Honor DESC */\n  }else{\n    sortOrderMask = 0;    /* Ignore DESC */\n  }\n\n  /* Analyze the list of expressions that form the terms of the index and\n  ** report any errors.  In the common case where the expression is exactly\n  ** a table column, store that column in aiColumn[].  For general expressions,\n  ** populate pIndex->aColExpr and store XN_EXPR (-2) in aiColumn[].\n  **\n  ** TODO: Issue a warning if two or more columns of the index are identical.\n  ** TODO: Issue a warning if the table primary key is used as part of the\n  ** index key.\n  */\n  for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){\n    Expr *pCExpr;                  /* The i-th index expression */\n    int requestedSortOrder;        /* ASC or DESC on the i-th expression */\n    const char *zColl;             /* Collation sequence name */\n\n    sqlite3StringToId(pListItem->pExpr);\n    sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0);\n    if( pParse->nErr ) goto exit_create_index;\n    pCExpr = sqlite3ExprSkipCollate(pListItem->pExpr);\n    if( pCExpr->op!=TK_COLUMN ){\n      if( pTab==pParse->pNewTable ){\n        sqlite3ErrorMsg(pParse, \"expressions prohibited in PRIMARY KEY and \"\n                                \"UNIQUE constraints\");\n        goto exit_create_index;\n      }\n      if( pIndex->aColExpr==0 ){\n        ExprList *pCopy = sqlite3ExprListDup(db, pList, 0);\n        pIndex->aColExpr = pCopy;\n        if( !db->mallocFailed ){\n          assert( pCopy!=0 );\n          pListItem = &pCopy->a[i];\n        }\n      }\n      j = XN_EXPR;\n      pIndex->aiColumn[i] = XN_EXPR;\n      pIndex->uniqNotNull = 0;\n    }else{\n      j = pCExpr->iColumn;\n      assert( j<=0x7fff );\n      if( j<0 ){\n        j = pTab->iPKey;\n      }else if( pTab->aCol[j].notNull==0 ){\n        pIndex->uniqNotNull = 0;\n      }\n      pIndex->aiColumn[i] = (i16)j;\n    }\n    zColl = 0;\n    if( pListItem->pExpr->op==TK_COLLATE ){\n      int nColl;\n      zColl = pListItem->pExpr->u.zToken;\n      nColl = sqlite3Strlen30(zColl) + 1;\n      assert( nExtra>=nColl );\n      memcpy(zExtra, zColl, nColl);\n      zColl = zExtra;\n      zExtra += nColl;\n      nExtra -= nColl;\n    }else if( j>=0 ){\n      zColl = pTab->aCol[j].zColl;\n    }\n    if( !zColl ) zColl = sqlite3StrBINARY;\n    if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){\n      goto exit_create_index;\n    }\n    pIndex->azColl[i] = zColl;\n    requestedSortOrder = pListItem->sortOrder & sortOrderMask;\n    pIndex->aSortOrder[i] = (u8)requestedSortOrder;\n  }\n\n  /* Append the table key to the end of the index.  For WITHOUT ROWID\n  ** tables (when pPk!=0) this will be the declared PRIMARY KEY.  For\n  ** normal tables (when pPk==0) this will be the rowid.\n  */\n  if( pPk ){\n    for(j=0; j<pPk->nKeyCol; j++){\n      int x = pPk->aiColumn[j];\n      assert( x>=0 );\n      if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){\n        pIndex->nColumn--; \n      }else{\n        pIndex->aiColumn[i] = x;\n        pIndex->azColl[i] = pPk->azColl[j];\n        pIndex->aSortOrder[i] = pPk->aSortOrder[j];\n        i++;\n      }\n    }\n    assert( i==pIndex->nColumn );\n  }else{\n    pIndex->aiColumn[i] = XN_ROWID;\n    pIndex->azColl[i] = sqlite3StrBINARY;\n  }\n  sqlite3DefaultRowEst(pIndex);\n  if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);\n\n  /* If this index contains every column of its table, then mark\n  ** it as a covering index */\n  assert( HasRowid(pTab) \n      || pTab->iPKey<0 || sqlite3ColumnOfIndex(pIndex, pTab->iPKey)>=0 );\n  if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){\n    pIndex->isCovering = 1;\n    for(j=0; j<pTab->nCol; j++){\n      if( j==pTab->iPKey ) continue;\n      if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;\n      pIndex->isCovering = 0;\n      break;\n    }\n  }\n\n  if( pTab==pParse->pNewTable ){\n    /* This routine has been called to create an automatic index as a\n    ** result of a PRIMARY KEY or UNIQUE clause on a column definition, or\n    ** a PRIMARY KEY or UNIQUE clause following the column definitions.\n    ** i.e. one of:\n    **\n    ** CREATE TABLE t(x PRIMARY KEY, y);\n    ** CREATE TABLE t(x, y, UNIQUE(x, y));\n    **\n    ** Either way, check to see if the table already has such an index. If\n    ** so, don't bother creating this one. This only applies to\n    ** automatically created indices. Users can do as they wish with\n    ** explicit indices.\n    **\n    ** Two UNIQUE or PRIMARY KEY constraints are considered equivalent\n    ** (and thus suppressing the second one) even if they have different\n    ** sort orders.\n    **\n    ** If there are different collating sequences or if the columns of\n    ** the constraint occur in different orders, then the constraints are\n    ** considered distinct and both result in separate indices.\n    */\n    Index *pIdx;\n    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n      int k;\n      assert( IsUniqueIndex(pIdx) );\n      assert( pIdx->idxType!=SQLITE_IDXTYPE_APPDEF );\n      assert( IsUniqueIndex(pIndex) );\n\n      if( pIdx->nKeyCol!=pIndex->nKeyCol ) continue;\n      for(k=0; k<pIdx->nKeyCol; k++){\n        const char *z1;\n        const char *z2;\n        assert( pIdx->aiColumn[k]>=0 );\n        if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;\n        z1 = pIdx->azColl[k];\n        z2 = pIndex->azColl[k];\n        if( sqlite3StrICmp(z1, z2) ) break;\n      }\n      if( k==pIdx->nKeyCol ){\n        if( pIdx->onError!=pIndex->onError ){\n          /* This constraint creates the same index as a previous\n          ** constraint specified somewhere in the CREATE TABLE statement.\n          ** However the ON CONFLICT clauses are different. If both this \n          ** constraint and the previous equivalent constraint have explicit\n          ** ON CONFLICT clauses this is an error. Otherwise, use the\n          ** explicitly specified behavior for the index.\n          */\n          if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){\n            sqlite3ErrorMsg(pParse, \n                \"conflicting ON CONFLICT clauses specified\", 0);\n          }\n          if( pIdx->onError==OE_Default ){\n            pIdx->onError = pIndex->onError;\n          }\n        }\n        if( idxType==SQLITE_IDXTYPE_PRIMARYKEY ) pIdx->idxType = idxType;\n        goto exit_create_index;\n      }\n    }\n  }\n\n  /* Link the new Index structure to its table and to the other\n  ** in-memory database structures. \n  */\n  assert( pParse->nErr==0 );\n  if( db->init.busy ){\n    Index *p;\n    assert( !IN_DECLARE_VTAB );\n    assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );\n    p = sqlite3HashInsert(&pIndex->pSchema->idxHash, \n                          pIndex->zName, pIndex);\n    if( p ){\n      assert( p==pIndex );  /* Malloc must have failed */\n      sqlite3OomFault(db);\n      goto exit_create_index;\n    }\n    db->flags |= SQLITE_InternChanges;\n    if( pTblName!=0 ){\n      pIndex->tnum = db->init.newTnum;\n    }\n  }\n\n  /* If this is the initial CREATE INDEX statement (or CREATE TABLE if the\n  ** index is an implied index for a UNIQUE or PRIMARY KEY constraint) then\n  ** emit code to allocate the index rootpage on disk and make an entry for\n  ** the index in the sqlite_master table and populate the index with\n  ** content.  But, do not do this if we are simply reading the sqlite_master\n  ** table to parse the schema, or if this index is the PRIMARY KEY index\n  ** of a WITHOUT ROWID table.\n  **\n  ** If pTblName==0 it means this index is generated as an implied PRIMARY KEY\n  ** or UNIQUE index in a CREATE TABLE statement.  Since the table\n  ** has just been created, it contains no data and the index initialization\n  ** step can be skipped.\n  */\n  else if( HasRowid(pTab) || pTblName!=0 ){\n    Vdbe *v;\n    char *zStmt;\n    int iMem = ++pParse->nMem;\n\n    v = sqlite3GetVdbe(pParse);\n    if( v==0 ) goto exit_create_index;\n\n    sqlite3BeginWriteOperation(pParse, 1, iDb);\n\n    /* Create the rootpage for the index using CreateIndex. But before\n    ** doing so, code a Noop instruction and store its address in \n    ** Index.tnum. This is required in case this index is actually a \n    ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In \n    ** that case the convertToWithoutRowidTable() routine will replace\n    ** the Noop with a Goto to jump over the VDBE code generated below. */\n    pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop);\n    sqlite3VdbeAddOp2(v, OP_CreateIndex, iDb, iMem);\n\n    /* Gather the complete text of the CREATE INDEX statement into\n    ** the zStmt variable\n    */\n    if( pStart ){\n      int n = (int)(pParse->sLastToken.z - pName->z) + pParse->sLastToken.n;\n      if( pName->z[n-1]==';' ) n--;\n      /* A named index with an explicit CREATE INDEX statement */\n      zStmt = sqlite3MPrintf(db, \"CREATE%s INDEX %.*s\",\n        onError==OE_None ? \"\" : \" UNIQUE\", n, pName->z);\n    }else{\n      /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */\n      /* zStmt = sqlite3MPrintf(\"\"); */\n      zStmt = 0;\n    }\n\n    /* Add an entry in sqlite_master for this index\n    */\n    sqlite3NestedParse(pParse, \n        \"INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);\",\n        db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb),\n        pIndex->zName,\n        pTab->zName,\n        iMem,\n        zStmt\n    );\n    sqlite3DbFree(db, zStmt);\n\n    /* Fill the index with data and reparse the schema. Code an OP_Expire\n    ** to invalidate all pre-compiled statements.\n    */\n    if( pTblName ){\n      sqlite3RefillIndex(pParse, pIndex, iMem);\n      sqlite3ChangeCookie(pParse, iDb);\n      sqlite3VdbeAddParseSchemaOp(v, iDb,\n         sqlite3MPrintf(db, \"name='%q' AND type='index'\", pIndex->zName));\n      sqlite3VdbeAddOp0(v, OP_Expire);\n    }\n\n    sqlite3VdbeJumpHere(v, pIndex->tnum);\n  }\n\n  /* When adding an index to the list of indices for a table, make\n  ** sure all indices labeled OE_Replace come after all those labeled\n  ** OE_Ignore.  This is necessary for the correct constraint check\n  ** processing (in sqlite3GenerateConstraintChecks()) as part of\n  ** UPDATE and INSERT statements.  \n  */\n  if( db->init.busy || pTblName==0 ){\n    if( onError!=OE_Replace || pTab->pIndex==0\n         || pTab->pIndex->onError==OE_Replace){\n      pIndex->pNext = pTab->pIndex;\n      pTab->pIndex = pIndex;\n    }else{\n      Index *pOther = pTab->pIndex;\n      while( pOther->pNext && pOther->pNext->onError!=OE_Replace ){\n        pOther = pOther->pNext;\n      }\n      pIndex->pNext = pOther->pNext;\n      pOther->pNext = pIndex;\n    }\n    pIndex = 0;\n  }\n\n  /* Clean up before exiting */\nexit_create_index:\n  if( pIndex ) freeIndex(db, pIndex);\n  sqlite3ExprDelete(db, pPIWhere);\n  sqlite3ExprListDelete(db, pList);\n  sqlite3SrcListDelete(db, pTblName);\n  sqlite3DbFree(db, zName);\n}\n\n/*\n** Fill the Index.aiRowEst[] array with default information - information\n** to be used when we have not run the ANALYZE command.\n**\n** aiRowEst[0] is supposed to contain the number of elements in the index.\n** Since we do not know, guess 1 million.  aiRowEst[1] is an estimate of the\n** number of rows in the table that match any particular value of the\n** first column of the index.  aiRowEst[2] is an estimate of the number\n** of rows that match any particular combination of the first 2 columns\n** of the index.  And so forth.  It must always be the case that\n*\n**           aiRowEst[N]<=aiRowEst[N-1]\n**           aiRowEst[N]>=1\n**\n** Apart from that, we have little to go on besides intuition as to\n** how aiRowEst[] should be initialized.  The numbers generated here\n** are based on typical values found in actual indices.\n*/\nvoid sqlite3DefaultRowEst(Index *pIdx){\n  /*                10,  9,  8,  7,  6 */\n  LogEst aVal[] = { 33, 32, 30, 28, 26 };\n  LogEst *a = pIdx->aiRowLogEst;\n  int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol);\n  int i;\n\n  /* Set the first entry (number of rows in the index) to the estimated \n  ** number of rows in the table, or half the number of rows in the table\n  ** for a partial index.   But do not let the estimate drop below 10. */\n  a[0] = pIdx->pTable->nRowLogEst;\n  if( pIdx->pPartIdxWhere!=0 ) a[0] -= 10;  assert( 10==sqlite3LogEst(2) );\n  if( a[0]<33 ) a[0] = 33;                  assert( 33==sqlite3LogEst(10) );\n\n  /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is\n  ** 6 and each subsequent value (if any) is 5.  */\n  memcpy(&a[1], aVal, nCopy*sizeof(LogEst));\n  for(i=nCopy+1; i<=pIdx->nKeyCol; i++){\n    a[i] = 23;                    assert( 23==sqlite3LogEst(5) );\n  }\n\n  assert( 0==sqlite3LogEst(1) );\n  if( IsUniqueIndex(pIdx) ) a[pIdx->nKeyCol] = 0;\n}\n\n/*\n** This routine will drop an existing named index.  This routine\n** implements the DROP INDEX statement.\n*/\nvoid sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){\n  Index *pIndex;\n  Vdbe *v;\n  sqlite3 *db = pParse->db;\n  int iDb;\n\n  assert( pParse->nErr==0 );   /* Never called with prior errors */\n  if( db->mallocFailed ){\n    goto exit_drop_index;\n  }\n  assert( pName->nSrc==1 );\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\n    goto exit_drop_index;\n  }\n  pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);\n  if( pIndex==0 ){\n    if( !ifExists ){\n      sqlite3ErrorMsg(pParse, \"no such index: %S\", pName, 0);\n    }else{\n      sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase);\n    }\n    pParse->checkSchema = 1;\n    goto exit_drop_index;\n  }\n  if( pIndex->idxType!=SQLITE_IDXTYPE_APPDEF ){\n    sqlite3ErrorMsg(pParse, \"index associated with UNIQUE \"\n      \"or PRIMARY KEY constraint cannot be dropped\", 0);\n    goto exit_drop_index;\n  }\n  iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  {\n    int code = SQLITE_DROP_INDEX;\n    Table *pTab = pIndex->pTable;\n    const char *zDb = db->aDb[iDb].zDbSName;\n    const char *zTab = SCHEMA_TABLE(iDb);\n    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){\n      goto exit_drop_index;\n    }\n    if( !OMIT_TEMPDB && iDb ) code = SQLITE_DROP_TEMP_INDEX;\n    if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){\n      goto exit_drop_index;\n    }\n  }\n#endif\n\n  /* Generate code to remove the index and from the master table */\n  v = sqlite3GetVdbe(pParse);\n  if( v ){\n    sqlite3BeginWriteOperation(pParse, 1, iDb);\n    sqlite3NestedParse(pParse,\n       \"DELETE FROM %Q.%s WHERE name=%Q AND type='index'\",\n       db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), pIndex->zName\n    );\n    sqlite3ClearStatTables(pParse, iDb, \"idx\", pIndex->zName);\n    sqlite3ChangeCookie(pParse, iDb);\n    destroyRootPage(pParse, pIndex->tnum, iDb);\n    sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);\n  }\n\nexit_drop_index:\n  sqlite3SrcListDelete(db, pName);\n}\n\n/*\n** pArray is a pointer to an array of objects. Each object in the\n** array is szEntry bytes in size. This routine uses sqlite3DbRealloc()\n** to extend the array so that there is space for a new object at the end.\n**\n** When this function is called, *pnEntry contains the current size of\n** the array (in entries - so the allocation is ((*pnEntry) * szEntry) bytes\n** in total).\n**\n** If the realloc() is successful (i.e. if no OOM condition occurs), the\n** space allocated for the new object is zeroed, *pnEntry updated to\n** reflect the new size of the array and a pointer to the new allocation\n** returned. *pIdx is set to the index of the new array entry in this case.\n**\n** Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains\n** unchanged and a copy of pArray returned.\n*/\nvoid *sqlite3ArrayAllocate(\n  sqlite3 *db,      /* Connection to notify of malloc failures */\n  void *pArray,     /* Array of objects.  Might be reallocated */\n  int szEntry,      /* Size of each object in the array */\n  int *pnEntry,     /* Number of objects currently in use */\n  int *pIdx         /* Write the index of a new slot here */\n){\n  char *z;\n  int n = *pnEntry;\n  if( (n & (n-1))==0 ){\n    int sz = (n==0) ? 1 : 2*n;\n    void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry);\n    if( pNew==0 ){\n      *pIdx = -1;\n      return pArray;\n    }\n    pArray = pNew;\n  }\n  z = (char*)pArray;\n  memset(&z[n * szEntry], 0, szEntry);\n  *pIdx = n;\n  ++*pnEntry;\n  return pArray;\n}\n\n/*\n** Append a new element to the given IdList.  Create a new IdList if\n** need be.\n**\n** A new IdList is returned, or NULL if malloc() fails.\n*/\nIdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){\n  int i;\n  if( pList==0 ){\n    pList = sqlite3DbMallocZero(db, sizeof(IdList) );\n    if( pList==0 ) return 0;\n  }\n  pList->a = sqlite3ArrayAllocate(\n      db,\n      pList->a,\n      sizeof(pList->a[0]),\n      &pList->nId,\n      &i\n  );\n  if( i<0 ){\n    sqlite3IdListDelete(db, pList);\n    return 0;\n  }\n  pList->a[i].zName = sqlite3NameFromToken(db, pToken);\n  return pList;\n}\n\n/*\n** Delete an IdList.\n*/\nvoid sqlite3IdListDelete(sqlite3 *db, IdList *pList){\n  int i;\n  if( pList==0 ) return;\n  for(i=0; i<pList->nId; i++){\n    sqlite3DbFree(db, pList->a[i].zName);\n  }\n  sqlite3DbFree(db, pList->a);\n  sqlite3DbFree(db, pList);\n}\n\n/*\n** Return the index in pList of the identifier named zId.  Return -1\n** if not found.\n*/\nint sqlite3IdListIndex(IdList *pList, const char *zName){\n  int i;\n  if( pList==0 ) return -1;\n  for(i=0; i<pList->nId; i++){\n    if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i;\n  }\n  return -1;\n}\n\n/*\n** Expand the space allocated for the given SrcList object by\n** creating nExtra new slots beginning at iStart.  iStart is zero based.\n** New slots are zeroed.\n**\n** For example, suppose a SrcList initially contains two entries: A,B.\n** To append 3 new entries onto the end, do this:\n**\n**    sqlite3SrcListEnlarge(db, pSrclist, 3, 2);\n**\n** After the call above it would contain:  A, B, nil, nil, nil.\n** If the iStart argument had been 1 instead of 2, then the result\n** would have been:  A, nil, nil, nil, B.  To prepend the new slots,\n** the iStart value would be 0.  The result then would\n** be: nil, nil, nil, A, B.\n**\n** If a memory allocation fails the SrcList is unchanged.  The\n** db->mallocFailed flag will be set to true.\n*/\nSrcList *sqlite3SrcListEnlarge(\n  sqlite3 *db,       /* Database connection to notify of OOM errors */\n  SrcList *pSrc,     /* The SrcList to be enlarged */\n  int nExtra,        /* Number of new slots to add to pSrc->a[] */\n  int iStart         /* Index in pSrc->a[] of first new slot */\n){\n  int i;\n\n  /* Sanity checking on calling parameters */\n  assert( iStart>=0 );\n  assert( nExtra>=1 );\n  assert( pSrc!=0 );\n  assert( iStart<=pSrc->nSrc );\n\n  /* Allocate additional space if needed */\n  if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){\n    SrcList *pNew;\n    int nAlloc = pSrc->nSrc+nExtra;\n    int nGot;\n    pNew = sqlite3DbRealloc(db, pSrc,\n               sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) );\n    if( pNew==0 ){\n      assert( db->mallocFailed );\n      return pSrc;\n    }\n    pSrc = pNew;\n    nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1;\n    pSrc->nAlloc = nGot;\n  }\n\n  /* Move existing slots that come after the newly inserted slots\n  ** out of the way */\n  for(i=pSrc->nSrc-1; i>=iStart; i--){\n    pSrc->a[i+nExtra] = pSrc->a[i];\n  }\n  pSrc->nSrc += nExtra;\n\n  /* Zero the newly allocated slots */\n  memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra);\n  for(i=iStart; i<iStart+nExtra; i++){\n    pSrc->a[i].iCursor = -1;\n  }\n\n  /* Return a pointer to the enlarged SrcList */\n  return pSrc;\n}\n\n\n/*\n** Append a new table name to the given SrcList.  Create a new SrcList if\n** need be.  A new entry is created in the SrcList even if pTable is NULL.\n**\n** A SrcList is returned, or NULL if there is an OOM error.  The returned\n** SrcList might be the same as the SrcList that was input or it might be\n** a new one.  If an OOM error does occurs, then the prior value of pList\n** that is input to this routine is automatically freed.\n**\n** If pDatabase is not null, it means that the table has an optional\n** database name prefix.  Like this:  \"database.table\".  The pDatabase\n** points to the table name and the pTable points to the database name.\n** The SrcList.a[].zName field is filled with the table name which might\n** come from pTable (if pDatabase is NULL) or from pDatabase.  \n** SrcList.a[].zDatabase is filled with the database name from pTable,\n** or with NULL if no database is specified.\n**\n** In other words, if call like this:\n**\n**         sqlite3SrcListAppend(D,A,B,0);\n**\n** Then B is a table name and the database name is unspecified.  If called\n** like this:\n**\n**         sqlite3SrcListAppend(D,A,B,C);\n**\n** Then C is the table name and B is the database name.  If C is defined\n** then so is B.  In other words, we never have a case where:\n**\n**         sqlite3SrcListAppend(D,A,0,C);\n**\n** Both pTable and pDatabase are assumed to be quoted.  They are dequoted\n** before being added to the SrcList.\n*/\nSrcList *sqlite3SrcListAppend(\n  sqlite3 *db,        /* Connection to notify of malloc failures */\n  SrcList *pList,     /* Append to this SrcList. NULL creates a new SrcList */\n  Token *pTable,      /* Table to append */\n  Token *pDatabase    /* Database of the table */\n){\n  struct SrcList_item *pItem;\n  assert( pDatabase==0 || pTable!=0 );  /* Cannot have C without B */\n  assert( db!=0 );\n  if( pList==0 ){\n    pList = sqlite3DbMallocRawNN(db, sizeof(SrcList) );\n    if( pList==0 ) return 0;\n    pList->nAlloc = 1;\n    pList->nSrc = 0;\n  }\n  pList = sqlite3SrcListEnlarge(db, pList, 1, pList->nSrc);\n  if( db->mallocFailed ){\n    sqlite3SrcListDelete(db, pList);\n    return 0;\n  }\n  pItem = &pList->a[pList->nSrc-1];\n  if( pDatabase && pDatabase->z==0 ){\n    pDatabase = 0;\n  }\n  if( pDatabase ){\n    Token *pTemp = pDatabase;\n    pDatabase = pTable;\n    pTable = pTemp;\n  }\n  pItem->zName = sqlite3NameFromToken(db, pTable);\n  pItem->zDatabase = sqlite3NameFromToken(db, pDatabase);\n  return pList;\n}\n\n/*\n** Assign VdbeCursor index numbers to all tables in a SrcList\n*/\nvoid sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){\n  int i;\n  struct SrcList_item *pItem;\n  assert(pList || pParse->db->mallocFailed );\n  if( pList ){\n    for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){\n      if( pItem->iCursor>=0 ) break;\n      pItem->iCursor = pParse->nTab++;\n      if( pItem->pSelect ){\n        sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc);\n      }\n    }\n  }\n}\n\n/*\n** Delete an entire SrcList including all its substructure.\n*/\nvoid sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){\n  int i;\n  struct SrcList_item *pItem;\n  if( pList==0 ) return;\n  for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){\n    sqlite3DbFree(db, pItem->zDatabase);\n    sqlite3DbFree(db, pItem->zName);\n    sqlite3DbFree(db, pItem->zAlias);\n    if( pItem->fg.isIndexedBy ) sqlite3DbFree(db, pItem->u1.zIndexedBy);\n    if( pItem->fg.isTabFunc ) sqlite3ExprListDelete(db, pItem->u1.pFuncArg);\n    sqlite3DeleteTable(db, pItem->pTab);\n    sqlite3SelectDelete(db, pItem->pSelect);\n    sqlite3ExprDelete(db, pItem->pOn);\n    sqlite3IdListDelete(db, pItem->pUsing);\n  }\n  sqlite3DbFree(db, pList);\n}\n\n/*\n** This routine is called by the parser to add a new term to the\n** end of a growing FROM clause.  The \"p\" parameter is the part of\n** the FROM clause that has already been constructed.  \"p\" is NULL\n** if this is the first term of the FROM clause.  pTable and pDatabase\n** are the name of the table and database named in the FROM clause term.\n** pDatabase is NULL if the database name qualifier is missing - the\n** usual case.  If the term has an alias, then pAlias points to the\n** alias token.  If the term is a subquery, then pSubquery is the\n** SELECT statement that the subquery encodes.  The pTable and\n** pDatabase parameters are NULL for subqueries.  The pOn and pUsing\n** parameters are the content of the ON and USING clauses.\n**\n** Return a new SrcList which encodes is the FROM with the new\n** term added.\n*/\nSrcList *sqlite3SrcListAppendFromTerm(\n  Parse *pParse,          /* Parsing context */\n  SrcList *p,             /* The left part of the FROM clause already seen */\n  Token *pTable,          /* Name of the table to add to the FROM clause */\n  Token *pDatabase,       /* Name of the database containing pTable */\n  Token *pAlias,          /* The right-hand side of the AS subexpression */\n  Select *pSubquery,      /* A subquery used in place of a table name */\n  Expr *pOn,              /* The ON clause of a join */\n  IdList *pUsing          /* The USING clause of a join */\n){\n  struct SrcList_item *pItem;\n  sqlite3 *db = pParse->db;\n  if( !p && (pOn || pUsing) ){\n    sqlite3ErrorMsg(pParse, \"a JOIN clause is required before %s\", \n      (pOn ? \"ON\" : \"USING\")\n    );\n    goto append_from_error;\n  }\n  p = sqlite3SrcListAppend(db, p, pTable, pDatabase);\n  if( p==0 || NEVER(p->nSrc==0) ){\n    goto append_from_error;\n  }\n  pItem = &p->a[p->nSrc-1];\n  assert( pAlias!=0 );\n  if( pAlias->n ){\n    pItem->zAlias = sqlite3NameFromToken(db, pAlias);\n  }\n  pItem->pSelect = pSubquery;\n  pItem->pOn = pOn;\n  pItem->pUsing = pUsing;\n  return p;\n\n append_from_error:\n  assert( p==0 );\n  sqlite3ExprDelete(db, pOn);\n  sqlite3IdListDelete(db, pUsing);\n  sqlite3SelectDelete(db, pSubquery);\n  return 0;\n}\n\n/*\n** Add an INDEXED BY or NOT INDEXED clause to the most recently added \n** element of the source-list passed as the second argument.\n*/\nvoid sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){\n  assert( pIndexedBy!=0 );\n  if( p && ALWAYS(p->nSrc>0) ){\n    struct SrcList_item *pItem = &p->a[p->nSrc-1];\n    assert( pItem->fg.notIndexed==0 );\n    assert( pItem->fg.isIndexedBy==0 );\n    assert( pItem->fg.isTabFunc==0 );\n    if( pIndexedBy->n==1 && !pIndexedBy->z ){\n      /* A \"NOT INDEXED\" clause was supplied. See parse.y \n      ** construct \"indexed_opt\" for details. */\n      pItem->fg.notIndexed = 1;\n    }else{\n      pItem->u1.zIndexedBy = sqlite3NameFromToken(pParse->db, pIndexedBy);\n      pItem->fg.isIndexedBy = (pItem->u1.zIndexedBy!=0);\n    }\n  }\n}\n\n/*\n** Add the list of function arguments to the SrcList entry for a\n** table-valued-function.\n*/\nvoid sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){\n  if( p ){\n    struct SrcList_item *pItem = &p->a[p->nSrc-1];\n    assert( pItem->fg.notIndexed==0 );\n    assert( pItem->fg.isIndexedBy==0 );\n    assert( pItem->fg.isTabFunc==0 );\n    pItem->u1.pFuncArg = pList;\n    pItem->fg.isTabFunc = 1;\n  }else{\n    sqlite3ExprListDelete(pParse->db, pList);\n  }\n}\n\n/*\n** When building up a FROM clause in the parser, the join operator\n** is initially attached to the left operand.  But the code generator\n** expects the join operator to be on the right operand.  This routine\n** Shifts all join operators from left to right for an entire FROM\n** clause.\n**\n** Example: Suppose the join is like this:\n**\n**           A natural cross join B\n**\n** The operator is \"natural cross join\".  The A and B operands are stored\n** in p->a[0] and p->a[1], respectively.  The parser initially stores the\n** operator with A.  This routine shifts that operator over to B.\n*/\nvoid sqlite3SrcListShiftJoinType(SrcList *p){\n  if( p ){\n    int i;\n    for(i=p->nSrc-1; i>0; i--){\n      p->a[i].fg.jointype = p->a[i-1].fg.jointype;\n    }\n    p->a[0].fg.jointype = 0;\n  }\n}\n\n/*\n** Generate VDBE code for a BEGIN statement.\n*/\nvoid sqlite3BeginTransaction(Parse *pParse, int type){\n  sqlite3 *db;\n  Vdbe *v;\n  int i;\n\n  assert( pParse!=0 );\n  db = pParse->db;\n  assert( db!=0 );\n  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, \"BEGIN\", 0, 0) ){\n    return;\n  }\n  v = sqlite3GetVdbe(pParse);\n  if( !v ) return;\n  if( type!=TK_DEFERRED ){\n    for(i=0; i<db->nDb; i++){\n      sqlite3VdbeAddOp2(v, OP_Transaction, i, (type==TK_EXCLUSIVE)+1);\n      sqlite3VdbeUsesBtree(v, i);\n    }\n  }\n  sqlite3VdbeAddOp0(v, OP_AutoCommit);\n}\n\n/*\n** Generate VDBE code for a COMMIT statement.\n*/\nvoid sqlite3CommitTransaction(Parse *pParse){\n  Vdbe *v;\n\n  assert( pParse!=0 );\n  assert( pParse->db!=0 );\n  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, \"COMMIT\", 0, 0) ){\n    return;\n  }\n  v = sqlite3GetVdbe(pParse);\n  if( v ){\n    sqlite3VdbeAddOp1(v, OP_AutoCommit, 1);\n  }\n}\n\n/*\n** Generate VDBE code for a ROLLBACK statement.\n*/\nvoid sqlite3RollbackTransaction(Parse *pParse){\n  Vdbe *v;\n\n  assert( pParse!=0 );\n  assert( pParse->db!=0 );\n  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, \"ROLLBACK\", 0, 0) ){\n    return;\n  }\n  v = sqlite3GetVdbe(pParse);\n  if( v ){\n    sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 1);\n  }\n}\n\n/*\n** This function is called by the parser when it parses a command to create,\n** release or rollback an SQL savepoint. \n*/\nvoid sqlite3Savepoint(Parse *pParse, int op, Token *pName){\n  char *zName = sqlite3NameFromToken(pParse->db, pName);\n  if( zName ){\n    Vdbe *v = sqlite3GetVdbe(pParse);\n#ifndef SQLITE_OMIT_AUTHORIZATION\n    static const char * const az[] = { \"BEGIN\", \"RELEASE\", \"ROLLBACK\" };\n    assert( !SAVEPOINT_BEGIN && SAVEPOINT_RELEASE==1 && SAVEPOINT_ROLLBACK==2 );\n#endif\n    if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){\n      sqlite3DbFree(pParse->db, zName);\n      return;\n    }\n    sqlite3VdbeAddOp4(v, OP_Savepoint, op, 0, 0, zName, P4_DYNAMIC);\n  }\n}\n\n/*\n** Make sure the TEMP database is open and available for use.  Return\n** the number of errors.  Leave any error messages in the pParse structure.\n*/\nint sqlite3OpenTempDatabase(Parse *pParse){\n  sqlite3 *db = pParse->db;\n  if( db->aDb[1].pBt==0 && !pParse->explain ){\n    int rc;\n    Btree *pBt;\n    static const int flags = \n          SQLITE_OPEN_READWRITE |\n          SQLITE_OPEN_CREATE |\n          SQLITE_OPEN_EXCLUSIVE |\n          SQLITE_OPEN_DELETEONCLOSE |\n          SQLITE_OPEN_TEMP_DB;\n\n    rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pBt, 0, flags);\n    if( rc!=SQLITE_OK ){\n      sqlite3ErrorMsg(pParse, \"unable to open a temporary database \"\n        \"file for storing temporary tables\");\n      pParse->rc = rc;\n      return 1;\n    }\n    db->aDb[1].pBt = pBt;\n    assert( db->aDb[1].pSchema );\n    if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){\n      sqlite3OomFault(db);\n      return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** Record the fact that the schema cookie will need to be verified\n** for database iDb.  The code to actually verify the schema cookie\n** will occur at the end of the top-level VDBE and will be generated\n** later, by sqlite3FinishCoding().\n*/\nvoid sqlite3CodeVerifySchema(Parse *pParse, int iDb){\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\n\n  assert( iDb>=0 && iDb<pParse->db->nDb );\n  assert( pParse->db->aDb[iDb].pBt!=0 || iDb==1 );\n  assert( iDb<SQLITE_MAX_ATTACHED+2 );\n  assert( sqlite3SchemaMutexHeld(pParse->db, iDb, 0) );\n  if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){\n    DbMaskSet(pToplevel->cookieMask, iDb);\n    if( !OMIT_TEMPDB && iDb==1 ){\n      sqlite3OpenTempDatabase(pToplevel);\n    }\n  }\n}\n\n/*\n** If argument zDb is NULL, then call sqlite3CodeVerifySchema() for each \n** attached database. Otherwise, invoke it for the database named zDb only.\n*/\nvoid sqlite3CodeVerifyNamedSchema(Parse *pParse, const char *zDb){\n  sqlite3 *db = pParse->db;\n  int i;\n  for(i=0; i<db->nDb; i++){\n    Db *pDb = &db->aDb[i];\n    if( pDb->pBt && (!zDb || 0==sqlite3StrICmp(zDb, pDb->zDbSName)) ){\n      sqlite3CodeVerifySchema(pParse, i);\n    }\n  }\n}\n\n/*\n** Generate VDBE code that prepares for doing an operation that\n** might change the database.\n**\n** This routine starts a new transaction if we are not already within\n** a transaction.  If we are already within a transaction, then a checkpoint\n** is set if the setStatement parameter is true.  A checkpoint should\n** be set for operations that might fail (due to a constraint) part of\n** the way through and which will need to undo some writes without having to\n** rollback the whole transaction.  For operations where all constraints\n** can be checked before any changes are made to the database, it is never\n** necessary to undo a write and the checkpoint should not be set.\n*/\nvoid sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\n  sqlite3CodeVerifySchema(pParse, iDb);\n  DbMaskSet(pToplevel->writeMask, iDb);\n  pToplevel->isMultiWrite |= setStatement;\n}\n\n/*\n** Indicate that the statement currently under construction might write\n** more than one entry (example: deleting one row then inserting another,\n** inserting multiple rows in a table, or inserting a row and index entries.)\n** If an abort occurs after some of these writes have completed, then it will\n** be necessary to undo the completed writes.\n*/\nvoid sqlite3MultiWrite(Parse *pParse){\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\n  pToplevel->isMultiWrite = 1;\n}\n\n/* \n** The code generator calls this routine if is discovers that it is\n** possible to abort a statement prior to completion.  In order to \n** perform this abort without corrupting the database, we need to make\n** sure that the statement is protected by a statement transaction.\n**\n** Technically, we only need to set the mayAbort flag if the\n** isMultiWrite flag was previously set.  There is a time dependency\n** such that the abort must occur after the multiwrite.  This makes\n** some statements involving the REPLACE conflict resolution algorithm\n** go a little faster.  But taking advantage of this time dependency\n** makes it more difficult to prove that the code is correct (in \n** particular, it prevents us from writing an effective\n** implementation of sqlite3AssertMayAbort()) and so we have chosen\n** to take the safe route and skip the optimization.\n*/\nvoid sqlite3MayAbort(Parse *pParse){\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\n  pToplevel->mayAbort = 1;\n}\n\n/*\n** Code an OP_Halt that causes the vdbe to return an SQLITE_CONSTRAINT\n** error. The onError parameter determines which (if any) of the statement\n** and/or current transaction is rolled back.\n*/\nvoid sqlite3HaltConstraint(\n  Parse *pParse,    /* Parsing context */\n  int errCode,      /* extended error code */\n  int onError,      /* Constraint type */\n  char *p4,         /* Error message */\n  i8 p4type,        /* P4_STATIC or P4_TRANSIENT */\n  u8 p5Errmsg       /* P5_ErrMsg type */\n){\n  Vdbe *v = sqlite3GetVdbe(pParse);\n  assert( (errCode&0xff)==SQLITE_CONSTRAINT );\n  if( onError==OE_Abort ){\n    sqlite3MayAbort(pParse);\n  }\n  sqlite3VdbeAddOp4(v, OP_Halt, errCode, onError, 0, p4, p4type);\n  sqlite3VdbeChangeP5(v, p5Errmsg);\n}\n\n/*\n** Code an OP_Halt due to UNIQUE or PRIMARY KEY constraint violation.\n*/\nvoid sqlite3UniqueConstraint(\n  Parse *pParse,    /* Parsing context */\n  int onError,      /* Constraint type */\n  Index *pIdx       /* The index that triggers the constraint */\n){\n  char *zErr;\n  int j;\n  StrAccum errMsg;\n  Table *pTab = pIdx->pTable;\n\n  sqlite3StrAccumInit(&errMsg, pParse->db, 0, 0, 200);\n  if( pIdx->aColExpr ){\n    sqlite3XPrintf(&errMsg, \"index '%q'\", pIdx->zName);\n  }else{\n    for(j=0; j<pIdx->nKeyCol; j++){\n      char *zCol;\n      assert( pIdx->aiColumn[j]>=0 );\n      zCol = pTab->aCol[pIdx->aiColumn[j]].zName;\n      if( j ) sqlite3StrAccumAppend(&errMsg, \", \", 2);\n      sqlite3XPrintf(&errMsg, \"%s.%s\", pTab->zName, zCol);\n    }\n  }\n  zErr = sqlite3StrAccumFinish(&errMsg);\n  sqlite3HaltConstraint(pParse, \n    IsPrimaryKeyIndex(pIdx) ? SQLITE_CONSTRAINT_PRIMARYKEY \n                            : SQLITE_CONSTRAINT_UNIQUE,\n    onError, zErr, P4_DYNAMIC, P5_ConstraintUnique);\n}\n\n\n/*\n** Code an OP_Halt due to non-unique rowid.\n*/\nvoid sqlite3RowidConstraint(\n  Parse *pParse,    /* Parsing context */\n  int onError,      /* Conflict resolution algorithm */\n  Table *pTab       /* The table with the non-unique rowid */ \n){\n  char *zMsg;\n  int rc;\n  if( pTab->iPKey>=0 ){\n    zMsg = sqlite3MPrintf(pParse->db, \"%s.%s\", pTab->zName,\n                          pTab->aCol[pTab->iPKey].zName);\n    rc = SQLITE_CONSTRAINT_PRIMARYKEY;\n  }else{\n    zMsg = sqlite3MPrintf(pParse->db, \"%s.rowid\", pTab->zName);\n    rc = SQLITE_CONSTRAINT_ROWID;\n  }\n  sqlite3HaltConstraint(pParse, rc, onError, zMsg, P4_DYNAMIC,\n                        P5_ConstraintUnique);\n}\n\n/*\n** Check to see if pIndex uses the collating sequence pColl.  Return\n** true if it does and false if it does not.\n*/\n#ifndef SQLITE_OMIT_REINDEX\nstatic int collationMatch(const char *zColl, Index *pIndex){\n  int i;\n  assert( zColl!=0 );\n  for(i=0; i<pIndex->nColumn; i++){\n    const char *z = pIndex->azColl[i];\n    assert( z!=0 || pIndex->aiColumn[i]<0 );\n    if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){\n      return 1;\n    }\n  }\n  return 0;\n}\n#endif\n\n/*\n** Recompute all indices of pTab that use the collating sequence pColl.\n** If pColl==0 then recompute all indices of pTab.\n*/\n#ifndef SQLITE_OMIT_REINDEX\nstatic void reindexTable(Parse *pParse, Table *pTab, char const *zColl){\n  Index *pIndex;              /* An index associated with pTab */\n\n  for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){\n    if( zColl==0 || collationMatch(zColl, pIndex) ){\n      int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n      sqlite3BeginWriteOperation(pParse, 0, iDb);\n      sqlite3RefillIndex(pParse, pIndex, -1);\n    }\n  }\n}\n#endif\n\n/*\n** Recompute all indices of all tables in all databases where the\n** indices use the collating sequence pColl.  If pColl==0 then recompute\n** all indices everywhere.\n*/\n#ifndef SQLITE_OMIT_REINDEX\nstatic void reindexDatabases(Parse *pParse, char const *zColl){\n  Db *pDb;                    /* A single database */\n  int iDb;                    /* The database index number */\n  sqlite3 *db = pParse->db;   /* The database connection */\n  HashElem *k;                /* For looping over tables in pDb */\n  Table *pTab;                /* A table in the database */\n\n  assert( sqlite3BtreeHoldsAllMutexes(db) );  /* Needed for schema access */\n  for(iDb=0, pDb=db->aDb; iDb<db->nDb; iDb++, pDb++){\n    assert( pDb!=0 );\n    for(k=sqliteHashFirst(&pDb->pSchema->tblHash);  k; k=sqliteHashNext(k)){\n      pTab = (Table*)sqliteHashData(k);\n      reindexTable(pParse, pTab, zColl);\n    }\n  }\n}\n#endif\n\n/*\n** Generate code for the REINDEX command.\n**\n**        REINDEX                            -- 1\n**        REINDEX  <collation>               -- 2\n**        REINDEX  ?<database>.?<tablename>  -- 3\n**        REINDEX  ?<database>.?<indexname>  -- 4\n**\n** Form 1 causes all indices in all attached databases to be rebuilt.\n** Form 2 rebuilds all indices in all databases that use the named\n** collating function.  Forms 3 and 4 rebuild the named index or all\n** indices associated with the named table.\n*/\n#ifndef SQLITE_OMIT_REINDEX\nvoid sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){\n  CollSeq *pColl;             /* Collating sequence to be reindexed, or NULL */\n  char *z;                    /* Name of a table or index */\n  const char *zDb;            /* Name of the database */\n  Table *pTab;                /* A table in the database */\n  Index *pIndex;              /* An index associated with pTab */\n  int iDb;                    /* The database index number */\n  sqlite3 *db = pParse->db;   /* The database connection */\n  Token *pObjName;            /* Name of the table or index to be reindexed */\n\n  /* Read the database schema. If an error occurs, leave an error message\n  ** and code in pParse and return NULL. */\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\n    return;\n  }\n\n  if( pName1==0 ){\n    reindexDatabases(pParse, 0);\n    return;\n  }else if( NEVER(pName2==0) || pName2->z==0 ){\n    char *zColl;\n    assert( pName1->z );\n    zColl = sqlite3NameFromToken(pParse->db, pName1);\n    if( !zColl ) return;\n    pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);\n    if( pColl ){\n      reindexDatabases(pParse, zColl);\n      sqlite3DbFree(db, zColl);\n      return;\n    }\n    sqlite3DbFree(db, zColl);\n  }\n  iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pObjName);\n  if( iDb<0 ) return;\n  z = sqlite3NameFromToken(db, pObjName);\n  if( z==0 ) return;\n  zDb = db->aDb[iDb].zDbSName;\n  pTab = sqlite3FindTable(db, z, zDb);\n  if( pTab ){\n    reindexTable(pParse, pTab, 0);\n    sqlite3DbFree(db, z);\n    return;\n  }\n  pIndex = sqlite3FindIndex(db, z, zDb);\n  sqlite3DbFree(db, z);\n  if( pIndex ){\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\n    sqlite3RefillIndex(pParse, pIndex, -1);\n    return;\n  }\n  sqlite3ErrorMsg(pParse, \"unable to identify the object to be reindexed\");\n}\n#endif\n\n/*\n** Return a KeyInfo structure that is appropriate for the given Index.\n**\n** The caller should invoke sqlite3KeyInfoUnref() on the returned object\n** when it has finished using it.\n*/\nKeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){\n  int i;\n  int nCol = pIdx->nColumn;\n  int nKey = pIdx->nKeyCol;\n  KeyInfo *pKey;\n  if( pParse->nErr ) return 0;\n  if( pIdx->uniqNotNull ){\n    pKey = sqlite3KeyInfoAlloc(pParse->db, nKey, nCol-nKey);\n  }else{\n    pKey = sqlite3KeyInfoAlloc(pParse->db, nCol, 0);\n  }\n  if( pKey ){\n    assert( sqlite3KeyInfoIsWriteable(pKey) );\n    for(i=0; i<nCol; i++){\n      const char *zColl = pIdx->azColl[i];\n      pKey->aColl[i] = zColl==sqlite3StrBINARY ? 0 :\n                        sqlite3LocateCollSeq(pParse, zColl);\n      pKey->aSortOrder[i] = pIdx->aSortOrder[i];\n    }\n    if( pParse->nErr ){\n      sqlite3KeyInfoUnref(pKey);\n      pKey = 0;\n    }\n  }\n  return pKey;\n}\n\n#ifndef SQLITE_OMIT_CTE\n/* \n** This routine is invoked once per CTE by the parser while parsing a \n** WITH clause. \n*/\nWith *sqlite3WithAdd(\n  Parse *pParse,          /* Parsing context */\n  With *pWith,            /* Existing WITH clause, or NULL */\n  Token *pName,           /* Name of the common-table */\n  ExprList *pArglist,     /* Optional column name list for the table */\n  Select *pQuery          /* Query used to initialize the table */\n){\n  sqlite3 *db = pParse->db;\n  With *pNew;\n  char *zName;\n\n  /* Check that the CTE name is unique within this WITH clause. If\n  ** not, store an error in the Parse structure. */\n  zName = sqlite3NameFromToken(pParse->db, pName);\n  if( zName && pWith ){\n    int i;\n    for(i=0; i<pWith->nCte; i++){\n      if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){\n        sqlite3ErrorMsg(pParse, \"duplicate WITH table name: %s\", zName);\n      }\n    }\n  }\n\n  if( pWith ){\n    int nByte = sizeof(*pWith) + (sizeof(pWith->a[1]) * pWith->nCte);\n    pNew = sqlite3DbRealloc(db, pWith, nByte);\n  }else{\n    pNew = sqlite3DbMallocZero(db, sizeof(*pWith));\n  }\n  assert( (pNew!=0 && zName!=0) || db->mallocFailed );\n\n  if( db->mallocFailed ){\n    sqlite3ExprListDelete(db, pArglist);\n    sqlite3SelectDelete(db, pQuery);\n    sqlite3DbFree(db, zName);\n    pNew = pWith;\n  }else{\n    pNew->a[pNew->nCte].pSelect = pQuery;\n    pNew->a[pNew->nCte].pCols = pArglist;\n    pNew->a[pNew->nCte].zName = zName;\n    pNew->a[pNew->nCte].zCteErr = 0;\n    pNew->nCte++;\n  }\n\n  return pNew;\n}\n\n/*\n** Free the contents of the With object passed as the second argument.\n*/\nvoid sqlite3WithDelete(sqlite3 *db, With *pWith){\n  if( pWith ){\n    int i;\n    for(i=0; i<pWith->nCte; i++){\n      struct Cte *pCte = &pWith->a[i];\n      sqlite3ExprListDelete(db, pCte->pCols);\n      sqlite3SelectDelete(db, pCte->pSelect);\n      sqlite3DbFree(db, pCte->zName);\n    }\n    sqlite3DbFree(db, pWith);\n  }\n}\n#endif /* !defined(SQLITE_OMIT_CTE) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/callback.c",
    "content": "/*\n** 2005 May 23 \n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains functions used to access the internal hash tables\n** of user defined functions and collation sequences.\n*/\n\n#include \"sqliteInt.h\"\n\n/*\n** Invoke the 'collation needed' callback to request a collation sequence\n** in the encoding enc of name zName, length nName.\n*/\nstatic void callCollNeeded(sqlite3 *db, int enc, const char *zName){\n  assert( !db->xCollNeeded || !db->xCollNeeded16 );\n  if( db->xCollNeeded ){\n    char *zExternal = sqlite3DbStrDup(db, zName);\n    if( !zExternal ) return;\n    db->xCollNeeded(db->pCollNeededArg, db, enc, zExternal);\n    sqlite3DbFree(db, zExternal);\n  }\n#ifndef SQLITE_OMIT_UTF16\n  if( db->xCollNeeded16 ){\n    char const *zExternal;\n    sqlite3_value *pTmp = sqlite3ValueNew(db);\n    sqlite3ValueSetStr(pTmp, -1, zName, SQLITE_UTF8, SQLITE_STATIC);\n    zExternal = sqlite3ValueText(pTmp, SQLITE_UTF16NATIVE);\n    if( zExternal ){\n      db->xCollNeeded16(db->pCollNeededArg, db, (int)ENC(db), zExternal);\n    }\n    sqlite3ValueFree(pTmp);\n  }\n#endif\n}\n\n/*\n** This routine is called if the collation factory fails to deliver a\n** collation function in the best encoding but there may be other versions\n** of this collation function (for other text encodings) available. Use one\n** of these instead if they exist. Avoid a UTF-8 <-> UTF-16 conversion if\n** possible.\n*/\nstatic int synthCollSeq(sqlite3 *db, CollSeq *pColl){\n  CollSeq *pColl2;\n  char *z = pColl->zName;\n  int i;\n  static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 };\n  for(i=0; i<3; i++){\n    pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, 0);\n    if( pColl2->xCmp!=0 ){\n      memcpy(pColl, pColl2, sizeof(CollSeq));\n      pColl->xDel = 0;         /* Do not copy the destructor */\n      return SQLITE_OK;\n    }\n  }\n  return SQLITE_ERROR;\n}\n\n/*\n** This function is responsible for invoking the collation factory callback\n** or substituting a collation sequence of a different encoding when the\n** requested collation sequence is not available in the desired encoding.\n** \n** If it is not NULL, then pColl must point to the database native encoding \n** collation sequence with name zName, length nName.\n**\n** The return value is either the collation sequence to be used in database\n** db for collation type name zName, length nName, or NULL, if no collation\n** sequence can be found.  If no collation is found, leave an error message.\n**\n** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq()\n*/\nCollSeq *sqlite3GetCollSeq(\n  Parse *pParse,        /* Parsing context */\n  u8 enc,               /* The desired encoding for the collating sequence */\n  CollSeq *pColl,       /* Collating sequence with native encoding, or NULL */\n  const char *zName     /* Collating sequence name */\n){\n  CollSeq *p;\n  sqlite3 *db = pParse->db;\n\n  p = pColl;\n  if( !p ){\n    p = sqlite3FindCollSeq(db, enc, zName, 0);\n  }\n  if( !p || !p->xCmp ){\n    /* No collation sequence of this type for this encoding is registered.\n    ** Call the collation factory to see if it can supply us with one.\n    */\n    callCollNeeded(db, enc, zName);\n    p = sqlite3FindCollSeq(db, enc, zName, 0);\n  }\n  if( p && !p->xCmp && synthCollSeq(db, p) ){\n    p = 0;\n  }\n  assert( !p || p->xCmp );\n  if( p==0 ){\n    sqlite3ErrorMsg(pParse, \"no such collation sequence: %s\", zName);\n  }\n  return p;\n}\n\n/*\n** This routine is called on a collation sequence before it is used to\n** check that it is defined. An undefined collation sequence exists when\n** a database is loaded that contains references to collation sequences\n** that have not been defined by sqlite3_create_collation() etc.\n**\n** If required, this routine calls the 'collation needed' callback to\n** request a definition of the collating sequence. If this doesn't work, \n** an equivalent collating sequence that uses a text encoding different\n** from the main database is substituted, if one is available.\n*/\nint sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){\n  if( pColl ){\n    const char *zName = pColl->zName;\n    sqlite3 *db = pParse->db;\n    CollSeq *p = sqlite3GetCollSeq(pParse, ENC(db), pColl, zName);\n    if( !p ){\n      return SQLITE_ERROR;\n    }\n    assert( p==pColl );\n  }\n  return SQLITE_OK;\n}\n\n\n\n/*\n** Locate and return an entry from the db.aCollSeq hash table. If the entry\n** specified by zName and nName is not found and parameter 'create' is\n** true, then create a new entry. Otherwise return NULL.\n**\n** Each pointer stored in the sqlite3.aCollSeq hash table contains an\n** array of three CollSeq structures. The first is the collation sequence\n** preferred for UTF-8, the second UTF-16le, and the third UTF-16be.\n**\n** Stored immediately after the three collation sequences is a copy of\n** the collation sequence name. A pointer to this string is stored in\n** each collation sequence structure.\n*/\nstatic CollSeq *findCollSeqEntry(\n  sqlite3 *db,          /* Database connection */\n  const char *zName,    /* Name of the collating sequence */\n  int create            /* Create a new entry if true */\n){\n  CollSeq *pColl;\n  pColl = sqlite3HashFind(&db->aCollSeq, zName);\n\n  if( 0==pColl && create ){\n    int nName = sqlite3Strlen30(zName);\n    pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1);\n    if( pColl ){\n      CollSeq *pDel = 0;\n      pColl[0].zName = (char*)&pColl[3];\n      pColl[0].enc = SQLITE_UTF8;\n      pColl[1].zName = (char*)&pColl[3];\n      pColl[1].enc = SQLITE_UTF16LE;\n      pColl[2].zName = (char*)&pColl[3];\n      pColl[2].enc = SQLITE_UTF16BE;\n      memcpy(pColl[0].zName, zName, nName);\n      pColl[0].zName[nName] = 0;\n      pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl);\n\n      /* If a malloc() failure occurred in sqlite3HashInsert(), it will \n      ** return the pColl pointer to be deleted (because it wasn't added\n      ** to the hash table).\n      */\n      assert( pDel==0 || pDel==pColl );\n      if( pDel!=0 ){\n        sqlite3OomFault(db);\n        sqlite3DbFree(db, pDel);\n        pColl = 0;\n      }\n    }\n  }\n  return pColl;\n}\n\n/*\n** Parameter zName points to a UTF-8 encoded string nName bytes long.\n** Return the CollSeq* pointer for the collation sequence named zName\n** for the encoding 'enc' from the database 'db'.\n**\n** If the entry specified is not found and 'create' is true, then create a\n** new entry.  Otherwise return NULL.\n**\n** A separate function sqlite3LocateCollSeq() is a wrapper around\n** this routine.  sqlite3LocateCollSeq() invokes the collation factory\n** if necessary and generates an error message if the collating sequence\n** cannot be found.\n**\n** See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq()\n*/\nCollSeq *sqlite3FindCollSeq(\n  sqlite3 *db,\n  u8 enc,\n  const char *zName,\n  int create\n){\n  CollSeq *pColl;\n  if( zName ){\n    pColl = findCollSeqEntry(db, zName, create);\n  }else{\n    pColl = db->pDfltColl;\n  }\n  assert( SQLITE_UTF8==1 && SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );\n  assert( enc>=SQLITE_UTF8 && enc<=SQLITE_UTF16BE );\n  if( pColl ) pColl += enc-1;\n  return pColl;\n}\n\n/* During the search for the best function definition, this procedure\n** is called to test how well the function passed as the first argument\n** matches the request for a function with nArg arguments in a system\n** that uses encoding enc. The value returned indicates how well the\n** request is matched. A higher value indicates a better match.\n**\n** If nArg is -1 that means to only return a match (non-zero) if p->nArg\n** is also -1.  In other words, we are searching for a function that\n** takes a variable number of arguments.\n**\n** If nArg is -2 that means that we are searching for any function \n** regardless of the number of arguments it uses, so return a positive\n** match score for any\n**\n** The returned value is always between 0 and 6, as follows:\n**\n** 0: Not a match.\n** 1: UTF8/16 conversion required and function takes any number of arguments.\n** 2: UTF16 byte order change required and function takes any number of args.\n** 3: encoding matches and function takes any number of arguments\n** 4: UTF8/16 conversion required - argument count matches exactly\n** 5: UTF16 byte order conversion required - argument count matches exactly\n** 6: Perfect match:  encoding and argument count match exactly.\n**\n** If nArg==(-2) then any function with a non-null xSFunc is\n** a perfect match and any function with xSFunc NULL is\n** a non-match.\n*/\n#define FUNC_PERFECT_MATCH 6  /* The score for a perfect match */\nstatic int matchQuality(\n  FuncDef *p,     /* The function we are evaluating for match quality */\n  int nArg,       /* Desired number of arguments.  (-1)==any */\n  u8 enc          /* Desired text encoding */\n){\n  int match;\n\n  /* nArg of -2 is a special case */\n  if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH;\n\n  /* Wrong number of arguments means \"no match\" */\n  if( p->nArg!=nArg && p->nArg>=0 ) return 0;\n\n  /* Give a better score to a function with a specific number of arguments\n  ** than to function that accepts any number of arguments. */\n  if( p->nArg==nArg ){\n    match = 4;\n  }else{\n    match = 1;\n  }\n\n  /* Bonus points if the text encoding matches */\n  if( enc==(p->funcFlags & SQLITE_FUNC_ENCMASK) ){\n    match += 2;  /* Exact encoding match */\n  }else if( (enc & p->funcFlags & 2)!=0 ){\n    match += 1;  /* Both are UTF16, but with different byte orders */\n  }\n\n  return match;\n}\n\n/*\n** Search a FuncDefHash for a function with the given name.  Return\n** a pointer to the matching FuncDef if found, or 0 if there is no match.\n*/\nstatic FuncDef *functionSearch(\n  int h,               /* Hash of the name */\n  const char *zFunc    /* Name of function */\n){\n  FuncDef *p;\n  for(p=sqlite3BuiltinFunctions.a[h]; p; p=p->u.pHash){\n    if( sqlite3StrICmp(p->zName, zFunc)==0 ){\n      return p;\n    }\n  }\n  return 0;\n}\n\n/*\n** Insert a new FuncDef into a FuncDefHash hash table.\n*/\nvoid sqlite3InsertBuiltinFuncs(\n  FuncDef *aDef,      /* List of global functions to be inserted */\n  int nDef            /* Length of the apDef[] list */\n){\n  int i;\n  for(i=0; i<nDef; i++){\n    FuncDef *pOther;\n    const char *zName = aDef[i].zName;\n    int nName = sqlite3Strlen30(zName);\n    int h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;\n    pOther = functionSearch(h, zName);\n    if( pOther ){\n      assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );\n      aDef[i].pNext = pOther->pNext;\n      pOther->pNext = &aDef[i];\n    }else{\n      aDef[i].pNext = 0;\n      aDef[i].u.pHash = sqlite3BuiltinFunctions.a[h];\n      sqlite3BuiltinFunctions.a[h] = &aDef[i];\n    }\n  }\n}\n  \n  \n\n/*\n** Locate a user function given a name, a number of arguments and a flag\n** indicating whether the function prefers UTF-16 over UTF-8.  Return a\n** pointer to the FuncDef structure that defines that function, or return\n** NULL if the function does not exist.\n**\n** If the createFlag argument is true, then a new (blank) FuncDef\n** structure is created and liked into the \"db\" structure if a\n** no matching function previously existed.\n**\n** If nArg is -2, then the first valid function found is returned.  A\n** function is valid if xSFunc is non-zero.  The nArg==(-2)\n** case is used to see if zName is a valid function name for some number\n** of arguments.  If nArg is -2, then createFlag must be 0.\n**\n** If createFlag is false, then a function with the required name and\n** number of arguments may be returned even if the eTextRep flag does not\n** match that requested.\n*/\nFuncDef *sqlite3FindFunction(\n  sqlite3 *db,       /* An open database */\n  const char *zName, /* Name of the function.  zero-terminated */\n  int nArg,          /* Number of arguments.  -1 means any number */\n  u8 enc,            /* Preferred text encoding */\n  u8 createFlag      /* Create new entry if true and does not otherwise exist */\n){\n  FuncDef *p;         /* Iterator variable */\n  FuncDef *pBest = 0; /* Best match found so far */\n  int bestScore = 0;  /* Score of best match */\n  int h;              /* Hash value */\n  int nName;          /* Length of the name */\n\n  assert( nArg>=(-2) );\n  assert( nArg>=(-1) || createFlag==0 );\n  nName = sqlite3Strlen30(zName);\n\n  /* First search for a match amongst the application-defined functions.\n  */\n  p = (FuncDef*)sqlite3HashFind(&db->aFunc, zName);\n  while( p ){\n    int score = matchQuality(p, nArg, enc);\n    if( score>bestScore ){\n      pBest = p;\n      bestScore = score;\n    }\n    p = p->pNext;\n  }\n\n  /* If no match is found, search the built-in functions.\n  **\n  ** If the SQLITE_PreferBuiltin flag is set, then search the built-in\n  ** functions even if a prior app-defined function was found.  And give\n  ** priority to built-in functions.\n  **\n  ** Except, if createFlag is true, that means that we are trying to\n  ** install a new function.  Whatever FuncDef structure is returned it will\n  ** have fields overwritten with new information appropriate for the\n  ** new function.  But the FuncDefs for built-in functions are read-only.\n  ** So we must not search for built-ins when creating a new function.\n  */ \n  if( !createFlag && (pBest==0 || (db->flags & SQLITE_PreferBuiltin)!=0) ){\n    bestScore = 0;\n    h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;\n    p = functionSearch(h, zName);\n    while( p ){\n      int score = matchQuality(p, nArg, enc);\n      if( score>bestScore ){\n        pBest = p;\n        bestScore = score;\n      }\n      p = p->pNext;\n    }\n  }\n\n  /* If the createFlag parameter is true and the search did not reveal an\n  ** exact match for the name, number of arguments and encoding, then add a\n  ** new entry to the hash table and return it.\n  */\n  if( createFlag && bestScore<FUNC_PERFECT_MATCH && \n      (pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName+1))!=0 ){\n    FuncDef *pOther;\n    pBest->zName = (const char*)&pBest[1];\n    pBest->nArg = (u16)nArg;\n    pBest->funcFlags = enc;\n    memcpy((char*)&pBest[1], zName, nName+1);\n    pOther = (FuncDef*)sqlite3HashInsert(&db->aFunc, pBest->zName, pBest);\n    if( pOther==pBest ){\n      sqlite3DbFree(db, pBest);\n      sqlite3OomFault(db);\n      return 0;\n    }else{\n      pBest->pNext = pOther;\n    }\n  }\n\n  if( pBest && (pBest->xSFunc || createFlag) ){\n    return pBest;\n  }\n  return 0;\n}\n\n/*\n** Free all resources held by the schema structure. The void* argument points\n** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the \n** pointer itself, it just cleans up subsidiary resources (i.e. the contents\n** of the schema hash tables).\n**\n** The Schema.cache_size variable is not cleared.\n*/\nvoid sqlite3SchemaClear(void *p){\n  Hash temp1;\n  Hash temp2;\n  HashElem *pElem;\n  Schema *pSchema = (Schema *)p;\n\n  temp1 = pSchema->tblHash;\n  temp2 = pSchema->trigHash;\n  sqlite3HashInit(&pSchema->trigHash);\n  sqlite3HashClear(&pSchema->idxHash);\n  for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){\n    sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem));\n  }\n  sqlite3HashClear(&temp2);\n  sqlite3HashInit(&pSchema->tblHash);\n  for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){\n    Table *pTab = sqliteHashData(pElem);\n    sqlite3DeleteTable(0, pTab);\n  }\n  sqlite3HashClear(&temp1);\n  sqlite3HashClear(&pSchema->fkeyHash);\n  pSchema->pSeqTab = 0;\n  if( pSchema->schemaFlags & DB_SchemaLoaded ){\n    pSchema->iGeneration++;\n    pSchema->schemaFlags &= ~DB_SchemaLoaded;\n  }\n}\n\n/*\n** Find and return the schema associated with a BTree.  Create\n** a new one if necessary.\n*/\nSchema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){\n  Schema * p;\n  if( pBt ){\n    p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaClear);\n  }else{\n    p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema));\n  }\n  if( !p ){\n    sqlite3OomFault(db);\n  }else if ( 0==p->file_format ){\n    sqlite3HashInit(&p->tblHash);\n    sqlite3HashInit(&p->idxHash);\n    sqlite3HashInit(&p->trigHash);\n    sqlite3HashInit(&p->fkeyHash);\n    p->enc = SQLITE_UTF8;\n  }\n  return p;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/complete.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** An tokenizer for SQL\n**\n** This file contains C code that implements the sqlite3_complete() API.\n** This code used to be part of the tokenizer.c source file.  But by\n** separating it out, the code will be automatically omitted from\n** static links that do not use it.\n*/\n#include \"sqliteInt.h\"\n#ifndef SQLITE_OMIT_COMPLETE\n\n/*\n** This is defined in tokenize.c.  We just have to import the definition.\n*/\n#ifndef SQLITE_AMALGAMATION\n#ifdef SQLITE_ASCII\n#define IdChar(C)  ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0)\n#endif\n#ifdef SQLITE_EBCDIC\nextern const char sqlite3IsEbcdicIdChar[];\n#define IdChar(C)  (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))\n#endif\n#endif /* SQLITE_AMALGAMATION */\n\n\n/*\n** Token types used by the sqlite3_complete() routine.  See the header\n** comments on that procedure for additional information.\n*/\n#define tkSEMI    0\n#define tkWS      1\n#define tkOTHER   2\n#ifndef SQLITE_OMIT_TRIGGER\n#define tkEXPLAIN 3\n#define tkCREATE  4\n#define tkTEMP    5\n#define tkTRIGGER 6\n#define tkEND     7\n#endif\n\n/*\n** Return TRUE if the given SQL string ends in a semicolon.\n**\n** Special handling is require for CREATE TRIGGER statements.\n** Whenever the CREATE TRIGGER keywords are seen, the statement\n** must end with \";END;\".\n**\n** This implementation uses a state machine with 8 states:\n**\n**   (0) INVALID   We have not yet seen a non-whitespace character.\n**\n**   (1) START     At the beginning or end of an SQL statement.  This routine\n**                 returns 1 if it ends in the START state and 0 if it ends\n**                 in any other state.\n**\n**   (2) NORMAL    We are in the middle of statement which ends with a single\n**                 semicolon.\n**\n**   (3) EXPLAIN   The keyword EXPLAIN has been seen at the beginning of \n**                 a statement.\n**\n**   (4) CREATE    The keyword CREATE has been seen at the beginning of a\n**                 statement, possibly preceded by EXPLAIN and/or followed by\n**                 TEMP or TEMPORARY\n**\n**   (5) TRIGGER   We are in the middle of a trigger definition that must be\n**                 ended by a semicolon, the keyword END, and another semicolon.\n**\n**   (6) SEMI      We've seen the first semicolon in the \";END;\" that occurs at\n**                 the end of a trigger definition.\n**\n**   (7) END       We've seen the \";END\" of the \";END;\" that occurs at the end\n**                 of a trigger definition.\n**\n** Transitions between states above are determined by tokens extracted\n** from the input.  The following tokens are significant:\n**\n**   (0) tkSEMI      A semicolon.\n**   (1) tkWS        Whitespace.\n**   (2) tkOTHER     Any other SQL token.\n**   (3) tkEXPLAIN   The \"explain\" keyword.\n**   (4) tkCREATE    The \"create\" keyword.\n**   (5) tkTEMP      The \"temp\" or \"temporary\" keyword.\n**   (6) tkTRIGGER   The \"trigger\" keyword.\n**   (7) tkEND       The \"end\" keyword.\n**\n** Whitespace never causes a state transition and is always ignored.\n** This means that a SQL string of all whitespace is invalid.\n**\n** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed\n** to recognize the end of a trigger can be omitted.  All we have to do\n** is look for a semicolon that is not part of an string or comment.\n*/\nint sqlite3_complete(const char *zSql){\n  u8 state = 0;   /* Current state, using numbers defined in header comment */\n  u8 token;       /* Value of the next token */\n\n#ifndef SQLITE_OMIT_TRIGGER\n  /* A complex statement machine used to detect the end of a CREATE TRIGGER\n  ** statement.  This is the normal case.\n  */\n  static const u8 trans[8][8] = {\n                     /* Token:                                                */\n     /* State:       **  SEMI  WS  OTHER  EXPLAIN  CREATE  TEMP  TRIGGER  END */\n     /* 0 INVALID: */ {    1,  0,     2,       3,      4,    2,       2,   2, },\n     /* 1   START: */ {    1,  1,     2,       3,      4,    2,       2,   2, },\n     /* 2  NORMAL: */ {    1,  2,     2,       2,      2,    2,       2,   2, },\n     /* 3 EXPLAIN: */ {    1,  3,     3,       2,      4,    2,       2,   2, },\n     /* 4  CREATE: */ {    1,  4,     2,       2,      2,    4,       5,   2, },\n     /* 5 TRIGGER: */ {    6,  5,     5,       5,      5,    5,       5,   5, },\n     /* 6    SEMI: */ {    6,  6,     5,       5,      5,    5,       5,   7, },\n     /* 7     END: */ {    1,  7,     5,       5,      5,    5,       5,   5, },\n  };\n#else\n  /* If triggers are not supported by this compile then the statement machine\n  ** used to detect the end of a statement is much simpler\n  */\n  static const u8 trans[3][3] = {\n                     /* Token:           */\n     /* State:       **  SEMI  WS  OTHER */\n     /* 0 INVALID: */ {    1,  0,     2, },\n     /* 1   START: */ {    1,  1,     2, },\n     /* 2  NORMAL: */ {    1,  2,     2, },\n  };\n#endif /* SQLITE_OMIT_TRIGGER */\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( zSql==0 ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n\n  while( *zSql ){\n    switch( *zSql ){\n      case ';': {  /* A semicolon */\n        token = tkSEMI;\n        break;\n      }\n      case ' ':\n      case '\\r':\n      case '\\t':\n      case '\\n':\n      case '\\f': {  /* White space is ignored */\n        token = tkWS;\n        break;\n      }\n      case '/': {   /* C-style comments */\n        if( zSql[1]!='*' ){\n          token = tkOTHER;\n          break;\n        }\n        zSql += 2;\n        while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }\n        if( zSql[0]==0 ) return 0;\n        zSql++;\n        token = tkWS;\n        break;\n      }\n      case '-': {   /* SQL-style comments from \"--\" to end of line */\n        if( zSql[1]!='-' ){\n          token = tkOTHER;\n          break;\n        }\n        while( *zSql && *zSql!='\\n' ){ zSql++; }\n        if( *zSql==0 ) return state==1;\n        token = tkWS;\n        break;\n      }\n      case '[': {   /* Microsoft-style identifiers in [...] */\n        zSql++;\n        while( *zSql && *zSql!=']' ){ zSql++; }\n        if( *zSql==0 ) return 0;\n        token = tkOTHER;\n        break;\n      }\n      case '`':     /* Grave-accent quoted symbols used by MySQL */\n      case '\"':     /* single- and double-quoted strings */\n      case '\\'': {\n        int c = *zSql;\n        zSql++;\n        while( *zSql && *zSql!=c ){ zSql++; }\n        if( *zSql==0 ) return 0;\n        token = tkOTHER;\n        break;\n      }\n      default: {\n#ifdef SQLITE_EBCDIC\n        unsigned char c;\n#endif\n        if( IdChar((u8)*zSql) ){\n          /* Keywords and unquoted identifiers */\n          int nId;\n          for(nId=1; IdChar(zSql[nId]); nId++){}\n#ifdef SQLITE_OMIT_TRIGGER\n          token = tkOTHER;\n#else\n          switch( *zSql ){\n            case 'c': case 'C': {\n              if( nId==6 && sqlite3StrNICmp(zSql, \"create\", 6)==0 ){\n                token = tkCREATE;\n              }else{\n                token = tkOTHER;\n              }\n              break;\n            }\n            case 't': case 'T': {\n              if( nId==7 && sqlite3StrNICmp(zSql, \"trigger\", 7)==0 ){\n                token = tkTRIGGER;\n              }else if( nId==4 && sqlite3StrNICmp(zSql, \"temp\", 4)==0 ){\n                token = tkTEMP;\n              }else if( nId==9 && sqlite3StrNICmp(zSql, \"temporary\", 9)==0 ){\n                token = tkTEMP;\n              }else{\n                token = tkOTHER;\n              }\n              break;\n            }\n            case 'e':  case 'E': {\n              if( nId==3 && sqlite3StrNICmp(zSql, \"end\", 3)==0 ){\n                token = tkEND;\n              }else\n#ifndef SQLITE_OMIT_EXPLAIN\n              if( nId==7 && sqlite3StrNICmp(zSql, \"explain\", 7)==0 ){\n                token = tkEXPLAIN;\n              }else\n#endif\n              {\n                token = tkOTHER;\n              }\n              break;\n            }\n            default: {\n              token = tkOTHER;\n              break;\n            }\n          }\n#endif /* SQLITE_OMIT_TRIGGER */\n          zSql += nId-1;\n        }else{\n          /* Operators and special symbols */\n          token = tkOTHER;\n        }\n        break;\n      }\n    }\n    state = trans[state][token];\n    zSql++;\n  }\n  return state==1;\n}\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** This routine is the same as the sqlite3_complete() routine described\n** above, except that the parameter is required to be UTF-16 encoded, not\n** UTF-8.\n*/\nint sqlite3_complete16(const void *zSql){\n  sqlite3_value *pVal;\n  char const *zSql8;\n  int rc;\n\n#ifndef SQLITE_OMIT_AUTOINIT\n  rc = sqlite3_initialize();\n  if( rc ) return rc;\n#endif\n  pVal = sqlite3ValueNew(0);\n  sqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC);\n  zSql8 = sqlite3ValueText(pVal, SQLITE_UTF8);\n  if( zSql8 ){\n    rc = sqlite3_complete(zSql8);\n  }else{\n    rc = SQLITE_NOMEM_BKPT;\n  }\n  sqlite3ValueFree(pVal);\n  return rc & 0xff;\n}\n#endif /* SQLITE_OMIT_UTF16 */\n#endif /* SQLITE_OMIT_COMPLETE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/crypto.c",
    "content": "/* \n** SQLCipher\n** http://sqlcipher.net\n** \n** Copyright (c) 2008 - 2013, ZETETIC LLC\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without\n** modification, are permitted provided that the following conditions are met:\n**     * Redistributions of source code must retain the above copyright\n**       notice, this list of conditions and the following disclaimer.\n**     * Redistributions in binary form must reproduce the above copyright\n**       notice, this list of conditions and the following disclaimer in the\n**       documentation and/or other materials provided with the distribution.\n**     * Neither the name of the ZETETIC LLC nor the\n**       names of its contributors may be used to endorse or promote products\n**       derived from this software without specific prior written permission.\n** \n** THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\n** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n** DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\n** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n\n#include <assert.h>\n#include \"sqliteInt.h\"\n#include \"btreeInt.h\"\n#include \"crypto.h\"\n\nstatic const char* codec_get_cipher_version() {\n  return CIPHER_VERSION;\n}\n\n/* Generate code to return a string value */\nstatic void codec_vdbe_return_static_string(Parse *pParse, const char *zLabel, const char *value){\n  Vdbe *v = sqlite3GetVdbe(pParse);\n  sqlite3VdbeSetNumCols(v, 1);\n  sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC);\n  sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, value, 0);\n  sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\n}\n\nstatic int codec_set_btree_to_codec_pagesize(sqlite3 *db, Db *pDb, codec_ctx *ctx) {\n  int rc, page_sz, reserve_sz; \n\n  page_sz = sqlcipher_codec_ctx_get_pagesize(ctx);\n  reserve_sz = sqlcipher_codec_ctx_get_reservesize(ctx);\n\n  sqlite3_mutex_enter(db->mutex);\n  db->nextPagesize = page_sz; \n\n  /* before forcing the page size we need to unset the BTS_PAGESIZE_FIXED flag, else  \n     sqliteBtreeSetPageSize will block the change  */\n  pDb->pBt->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED;\n  CODEC_TRACE((\"codec_set_btree_to_codec_pagesize: sqlite3BtreeSetPageSize() size=%d reserve=%d\\n\", page_sz, reserve_sz));\n  rc = sqlite3BtreeSetPageSize(pDb->pBt, page_sz, reserve_sz, 0);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\nstatic int codec_set_pass_key(sqlite3* db, int nDb, const void *zKey, int nKey, int for_ctx) {\n  struct Db *pDb = &db->aDb[nDb];\n  CODEC_TRACE((\"codec_set_pass_key: entered db=%p nDb=%d zKey=%s nKey=%d for_ctx=%d\\n\", db, nDb, (char *)zKey, nKey, for_ctx));\n  if(pDb->pBt) {\n    codec_ctx *ctx;\n    sqlite3pager_get_codec(pDb->pBt->pBt->pPager, (void **) &ctx);\n    if(ctx) return sqlcipher_codec_ctx_set_pass(ctx, zKey, nKey, for_ctx);\n  }\n  return SQLITE_ERROR;\n} \n\nint sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const char *zRight) {\n  struct Db *pDb = &db->aDb[iDb];\n  codec_ctx *ctx = NULL;\n  int rc;\n\n  if(pDb->pBt) {\n    sqlite3pager_get_codec(pDb->pBt->pBt->pPager, (void **) &ctx);\n  }\n\n  CODEC_TRACE((\"sqlcipher_codec_pragma: entered db=%p iDb=%d pParse=%p zLeft=%s zRight=%s ctx=%p\\n\", db, iDb, pParse, zLeft, zRight, ctx));\n  \n  if( sqlite3StrICmp(zLeft, \"cipher_fips_status\")== 0 && !zRight ){\n    if(ctx) {\n      char *fips_mode_status = sqlite3_mprintf(\"%d\", sqlcipher_codec_fips_status(ctx));\n      codec_vdbe_return_static_string(pParse, \"cipher_fips_status\", fips_mode_status);\n      sqlite3_free(fips_mode_status);\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher_store_pass\")==0 && zRight ) {\n    if(ctx) {\n      sqlcipher_codec_set_store_pass(ctx, sqlite3GetBoolean(zRight, 1));\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher_store_pass\")==0 && !zRight ) {\n    if(ctx){\n      char *store_pass_value = sqlite3_mprintf(\"%d\", sqlcipher_codec_get_store_pass(ctx));\n      codec_vdbe_return_static_string(pParse, \"cipher_store_pass\", store_pass_value);\n      sqlite3_free(store_pass_value);\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher_add_random\")==0 && zRight ){\n    if(ctx) {\n      char *add_random_status = sqlite3_mprintf(\"%d\", sqlcipher_codec_add_random(ctx, zRight, sqlite3Strlen30(zRight)));\n      codec_vdbe_return_static_string(pParse, \"cipher_add_random\", add_random_status);\n      sqlite3_free(add_random_status);\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher_migrate\")==0 && !zRight ){\n    if(ctx){\n      char *migrate_status = sqlite3_mprintf(\"%d\", sqlcipher_codec_ctx_migrate(ctx));\n      codec_vdbe_return_static_string(pParse, \"cipher_migrate\", migrate_status);\n      sqlite3_free(migrate_status);\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher_provider\")==0 && !zRight ){\n    if(ctx) { codec_vdbe_return_static_string(pParse, \"cipher_provider\",\n                                              sqlcipher_codec_get_cipher_provider(ctx));\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher_provider_version\")==0 && !zRight){\n    if(ctx) { codec_vdbe_return_static_string(pParse, \"cipher_provider_version\",\n                                              sqlcipher_codec_get_provider_version(ctx));\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher_version\")==0 && !zRight ){\n    codec_vdbe_return_static_string(pParse, \"cipher_version\", codec_get_cipher_version());\n  } else\n  if( sqlite3StrICmp(zLeft, \"cipher\")==0 ){\n    if(ctx) {\n      if( zRight ) {\n        rc = sqlcipher_codec_ctx_set_cipher(ctx, zRight, 2); // change cipher for both\n        return rc;\n      }else {\n        codec_vdbe_return_static_string(pParse, \"cipher\",\n          sqlcipher_codec_ctx_get_cipher(ctx, 2));\n      }\n    }\n  } else\n  if( sqlite3StrICmp(zLeft, \"rekey_cipher\")==0 && zRight ){\n    if(ctx) sqlcipher_codec_ctx_set_cipher(ctx, zRight, 1); // change write cipher only \n  } else\n  if( sqlite3StrICmp(zLeft,\"cipher_default_kdf_iter\")==0 ){\n    if( zRight ) {\n      sqlcipher_set_default_kdf_iter(atoi(zRight)); // change default KDF iterations\n    } else {\n      char *kdf_iter = sqlite3_mprintf(\"%d\", sqlcipher_get_default_kdf_iter());\n      codec_vdbe_return_static_string(pParse, \"cipher_default_kdf_iter\", kdf_iter);\n      sqlite3_free(kdf_iter);\n    }\n  }else\n  if( sqlite3StrICmp(zLeft, \"kdf_iter\")==0 ){\n    if(ctx) {\n      if( zRight ) {\n        sqlcipher_codec_ctx_set_kdf_iter(ctx, atoi(zRight), 2); // change of RW PBKDF2 iteration \n      } else {\n        char *kdf_iter = sqlite3_mprintf(\"%d\", sqlcipher_codec_ctx_get_kdf_iter(ctx, 2));\n        codec_vdbe_return_static_string(pParse, \"kdf_iter\", kdf_iter);\n        sqlite3_free(kdf_iter);\n      }\n    }\n  }else\n  if( sqlite3StrICmp(zLeft, \"fast_kdf_iter\")==0){\n    if(ctx) {\n      if( zRight ) {\n        sqlcipher_codec_ctx_set_fast_kdf_iter(ctx, atoi(zRight), 2); // change of RW PBKDF2 iteration \n      } else {\n        char *fast_kdf_iter = sqlite3_mprintf(\"%d\", sqlcipher_codec_ctx_get_fast_kdf_iter(ctx, 2));\n        codec_vdbe_return_static_string(pParse, \"fast_kdf_iter\", fast_kdf_iter);\n        sqlite3_free(fast_kdf_iter);\n      }\n    }\n  }else\n  if( sqlite3StrICmp(zLeft, \"rekey_kdf_iter\")==0 && zRight ){\n    if(ctx) sqlcipher_codec_ctx_set_kdf_iter(ctx, atoi(zRight), 1); // write iterations only\n  }else\n  if( sqlite3StrICmp(zLeft,\"cipher_page_size\")==0 ){\n    if(ctx) {\n      if( zRight ) {\n        int size = atoi(zRight);\n        rc = sqlcipher_codec_ctx_set_pagesize(ctx, size);\n        if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);\n        rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx);\n        if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);\n      } else {\n        char * page_size = sqlite3_mprintf(\"%d\", sqlcipher_codec_ctx_get_pagesize(ctx));\n        codec_vdbe_return_static_string(pParse, \"cipher_page_size\", page_size);\n        sqlite3_free(page_size);\n      }\n    }\n  }else\n  if( sqlite3StrICmp(zLeft,\"cipher_default_page_size\")==0 ){\n    if( zRight ) {\n      sqlcipher_set_default_pagesize(atoi(zRight));\n    } else {\n      char *default_page_size = sqlite3_mprintf(\"%d\", sqlcipher_get_default_pagesize());\n      codec_vdbe_return_static_string(pParse, \"cipher_default_page_size\", default_page_size);\n      sqlite3_free(default_page_size);\n    }\n  }else\n  if( sqlite3StrICmp(zLeft,\"cipher_default_use_hmac\")==0 ){\n    if( zRight ) {\n      sqlcipher_set_default_use_hmac(sqlite3GetBoolean(zRight,1));\n    } else {\n      char *default_use_hmac = sqlite3_mprintf(\"%d\", sqlcipher_get_default_use_hmac());\n      codec_vdbe_return_static_string(pParse, \"cipher_default_use_hmac\", default_use_hmac);\n      sqlite3_free(default_use_hmac);\n    }\n  }else\n  if( sqlite3StrICmp(zLeft,\"cipher_use_hmac\")==0 ){\n    if(ctx) {\n      if( zRight ) {\n        rc = sqlcipher_codec_ctx_set_use_hmac(ctx, sqlite3GetBoolean(zRight,1));\n        if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);\n        /* since the use of hmac has changed, the page size may also change */\n        rc = codec_set_btree_to_codec_pagesize(db, pDb, ctx);\n        if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);\n      } else {\n        char *hmac_flag = sqlite3_mprintf(\"%d\", sqlcipher_codec_ctx_get_use_hmac(ctx, 2));\n        codec_vdbe_return_static_string(pParse, \"cipher_use_hmac\", hmac_flag);\n        sqlite3_free(hmac_flag);\n      }\n    }\n  }else\n  if( sqlite3StrICmp(zLeft,\"cipher_hmac_pgno\")==0 ){\n    if(ctx) {\n      if(zRight) {\n        // clear both pgno endian flags\n        if(sqlite3StrICmp(zRight, \"le\") == 0) {\n          sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_BE_PGNO);\n          sqlcipher_codec_ctx_set_flag(ctx, CIPHER_FLAG_LE_PGNO);\n        } else if(sqlite3StrICmp(zRight, \"be\") == 0) {\n          sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_LE_PGNO);\n          sqlcipher_codec_ctx_set_flag(ctx, CIPHER_FLAG_BE_PGNO);\n        } else if(sqlite3StrICmp(zRight, \"native\") == 0) {\n          sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_LE_PGNO);\n          sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_BE_PGNO);\n        }\n      } else {\n        if(sqlcipher_codec_ctx_get_flag(ctx, CIPHER_FLAG_LE_PGNO, 2)) {\n          codec_vdbe_return_static_string(pParse, \"cipher_hmac_pgno\", \"le\");\n        } else if(sqlcipher_codec_ctx_get_flag(ctx, CIPHER_FLAG_BE_PGNO, 2)) {\n          codec_vdbe_return_static_string(pParse, \"cipher_hmac_pgno\", \"be\");\n        } else {\n          codec_vdbe_return_static_string(pParse, \"cipher_hmac_pgno\", \"native\");\n        }\n      }\n    }\n  }else\n  if( sqlite3StrICmp(zLeft,\"cipher_hmac_salt_mask\")==0 ){\n    if(ctx) {\n      if(zRight) {\n        if (sqlite3StrNICmp(zRight ,\"x'\", 2) == 0 && sqlite3Strlen30(zRight) == 5) {\n          unsigned char mask = 0;\n          const unsigned char *hex = (const unsigned char *)zRight+2;\n          cipher_hex2bin(hex,2,&mask);\n          sqlcipher_set_hmac_salt_mask(mask);\n        }\n      } else {\n          char *hmac_salt_mask = sqlite3_mprintf(\"%02x\", sqlcipher_get_hmac_salt_mask());\n          codec_vdbe_return_static_string(pParse, \"cipher_hmac_salt_mask\", hmac_salt_mask);\n          sqlite3_free(hmac_salt_mask);\n      }\n    }\n  }else {\n    return 0;\n  }\n  return 1;\n}\n\n\n/*\n * sqlite3Codec can be called in multiple modes.\n * encrypt mode - expected to return a pointer to the \n *   encrypted data without altering pData.\n * decrypt mode - expected to return a pointer to pData, with\n *   the data decrypted in the input buffer\n */\nvoid* sqlite3Codec(void *iCtx, void *data, Pgno pgno, int mode) {\n  codec_ctx *ctx = (codec_ctx *) iCtx;\n  int offset = 0, rc = 0;\n  int page_sz = sqlcipher_codec_ctx_get_pagesize(ctx); \n  unsigned char *pData = (unsigned char *) data;\n  void *buffer = sqlcipher_codec_ctx_get_data(ctx);\n  void *kdf_salt = sqlcipher_codec_ctx_get_kdf_salt(ctx);\n  CODEC_TRACE((\"sqlite3Codec: entered pgno=%d, mode=%d, page_sz=%d\\n\", pgno, mode, page_sz));\n\n  /* call to derive keys if not present yet */\n  if((rc = sqlcipher_codec_key_derive(ctx)) != SQLITE_OK) {\n   sqlcipher_codec_ctx_set_error(ctx, rc); \n   return NULL;\n  }\n\n  if(pgno == 1) offset = FILE_HEADER_SZ; /* adjust starting pointers in data page for header offset on first page*/\n\n  CODEC_TRACE((\"sqlite3Codec: switch mode=%d offset=%d\\n\",  mode, offset));\n  switch(mode) {\n    case 0: /* decrypt */\n    case 2:\n    case 3:\n      if(pgno == 1) memcpy(buffer, SQLITE_FILE_HEADER, FILE_HEADER_SZ); /* copy file header to the first 16 bytes of the page */ \n      rc = sqlcipher_page_cipher(ctx, CIPHER_READ_CTX, pgno, CIPHER_DECRYPT, page_sz - offset, pData + offset, (unsigned char*)buffer + offset);\n      if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);\n      memcpy(pData, buffer, page_sz); /* copy buffer data back to pData and return */\n      return pData;\n      break;\n    case 6: /* encrypt */\n      if(pgno == 1) memcpy(buffer, kdf_salt, FILE_HEADER_SZ); /* copy salt to output buffer */ \n      rc = sqlcipher_page_cipher(ctx, CIPHER_WRITE_CTX, pgno, CIPHER_ENCRYPT, page_sz - offset, pData + offset, (unsigned char*)buffer + offset);\n      if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);\n      return buffer; /* return persistent buffer data, pData remains intact */\n      break;\n    case 7:\n      if(pgno == 1) memcpy(buffer, kdf_salt, FILE_HEADER_SZ); /* copy salt to output buffer */ \n      rc = sqlcipher_page_cipher(ctx, CIPHER_READ_CTX, pgno, CIPHER_ENCRYPT, page_sz - offset, pData + offset, (unsigned char*)buffer + offset);\n      if(rc != SQLITE_OK) sqlcipher_codec_ctx_set_error(ctx, rc);\n      return buffer; /* return persistent buffer data, pData remains intact */\n      break;\n    default:\n      return pData;\n      break;\n  }\n}\n\nvoid sqlite3FreeCodecArg(void *pCodecArg) {\n  codec_ctx *ctx = (codec_ctx *) pCodecArg;\n  if(pCodecArg == NULL) return;\n  sqlcipher_codec_ctx_free(&ctx); // wipe and free allocated memory for the context \n  sqlcipher_deactivate(); /* cleanup related structures, OpenSSL etc, when codec is detatched */\n}\n\nint sqlite3CodecAttach(sqlite3* db, int nDb, const void *zKey, int nKey) {\n  struct Db *pDb = &db->aDb[nDb];\n\n  CODEC_TRACE((\"sqlite3CodecAttach: entered nDb=%d zKey=%s, nKey=%d\\n\", nDb, (char *)zKey, nKey));\n\n\n  if(nKey && zKey && pDb->pBt) {\n    int rc;\n    Pager *pPager = pDb->pBt->pBt->pPager;\n    sqlite3_file *fd = sqlite3Pager_get_fd(pPager);\n    codec_ctx *ctx;\n\n    sqlcipher_activate(); /* perform internal initialization for sqlcipher */\n\n    sqlite3_mutex_enter(db->mutex);\n\n    /* point the internal codec argument against the contet to be prepared */\n    rc = sqlcipher_codec_ctx_init(&ctx, pDb, pDb->pBt->pBt->pPager, fd, zKey, nKey); \n\n    if(rc != SQLITE_OK) {\n      /* initialization failed, do not attach potentially corrupted context */\n      sqlite3_mutex_leave(db->mutex);\n      return rc;\n    }\n\n    sqlite3pager_sqlite3PagerSetCodec(sqlite3BtreePager(pDb->pBt), sqlite3Codec, NULL, sqlite3FreeCodecArg, (void *) ctx);\n\n    codec_set_btree_to_codec_pagesize(db, pDb, ctx);\n\n    /* force secure delete. This has the benefit of wiping internal data when deleted\n       and also ensures that all pages are written to disk (i.e. not skipped by\n       sqlite3PagerDontWrite optimizations) */ \n    sqlite3BtreeSecureDelete(pDb->pBt, 1); \n\n    /* if fd is null, then this is an in-memory database and\n       we dont' want to overwrite the AutoVacuum settings\n       if not null, then set to the default */\n    if(fd != NULL) { \n      sqlite3BtreeSetAutoVacuum(pDb->pBt, SQLITE_DEFAULT_AUTOVACUUM);\n    }\n    sqlite3_mutex_leave(db->mutex);\n  }\n  return SQLITE_OK;\n}\n\nvoid sqlite3_activate_see(const char* in) {\n  /* do nothing, security enhancements are always active */\n}\n\nstatic int sqlcipher_find_db_index(sqlite3 *db, const char *zDb) {\n  int db_index;\n  if(zDb == NULL){\n    return 0;\n  }\n  for(db_index = 0; db_index < db->nDb; db_index++) {\n    struct Db *pDb = &db->aDb[db_index];\n    if(strcmp(pDb->zDbSName, zDb) == 0) {\n      return db_index;\n    }\n  }\n  return 0;\n}\n\nint sqlite3_key(sqlite3 *db, const void *pKey, int nKey) {\n  CODEC_TRACE((\"sqlite3_key entered: db=%p pKey=%s nKey=%d\\n\", db, (char *)pKey, nKey));\n  return sqlite3_key_v2(db, \"main\", pKey, nKey);\n}\n\nint sqlite3_key_v2(sqlite3 *db, const char *zDb, const void *pKey, int nKey) {\n  CODEC_TRACE((\"sqlite3_key_v2: entered db=%p zDb=%s pKey=%s nKey=%d\\n\", db, zDb, (char *)pKey, nKey));\n  /* attach key if db and pKey are not null and nKey is > 0 */\n  if(db && pKey && nKey) {\n    int db_index = sqlcipher_find_db_index(db, zDb);\n    return sqlite3CodecAttach(db, db_index, pKey, nKey); \n  }\n  return SQLITE_ERROR;\n}\n\nint sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey) {\n  CODEC_TRACE((\"sqlite3_rekey entered: db=%p pKey=%s nKey=%d\\n\", db, (char *)pKey, nKey));\n  return sqlite3_rekey_v2(db, \"main\", pKey, nKey);\n}\n\n/* sqlite3_rekey_v2\n** Given a database, this will reencrypt the database using a new key.\n** There is only one possible modes of operation - to encrypt a database\n** that is already encrpyted. If the database is not already encrypted\n** this should do nothing\n** The proposed logic for this function follows:\n** 1. Determine if the database is already encryptped\n** 2. If there is NOT already a key present do nothing\n** 3. If there is a key present, re-encrypt the database with the new key\n*/\nint sqlite3_rekey_v2(sqlite3 *db, const char *zDb, const void *pKey, int nKey) {\n  CODEC_TRACE((\"sqlite3_rekey_v2: entered db=%p zDb=%s pKey=%s, nKey=%d\\n\", db, zDb, (char *)pKey, nKey));\n  if(db && pKey && nKey) {\n    int db_index = sqlcipher_find_db_index(db, zDb);\n    struct Db *pDb = &db->aDb[db_index];\n    CODEC_TRACE((\"sqlite3_rekey_v2: database pDb=%p db_index:%d\\n\", pDb, db_index));\n    if(pDb->pBt) {\n      codec_ctx *ctx;\n      int rc, page_count;\n      Pgno pgno;\n      PgHdr *page;\n      Pager *pPager = pDb->pBt->pBt->pPager;\n\n      sqlite3pager_get_codec(pDb->pBt->pBt->pPager, (void **) &ctx);\n     \n      if(ctx == NULL) { \n        /* there was no codec attached to this database, so this should do nothing! */ \n        CODEC_TRACE((\"sqlite3_rekey_v2: no codec attached to db, exiting\\n\"));\n        return SQLITE_OK;\n      }\n\n      sqlite3_mutex_enter(db->mutex);\n\n      codec_set_pass_key(db, db_index, pKey, nKey, CIPHER_WRITE_CTX);\n    \n      /* do stuff here to rewrite the database \n      ** 1. Create a transaction on the database\n      ** 2. Iterate through each page, reading it and then writing it.\n      ** 3. If that goes ok then commit and put ctx->rekey into ctx->key\n      **    note: don't deallocate rekey since it may be used in a subsequent iteration \n      */\n      rc = sqlite3BtreeBeginTrans(pDb->pBt, 1); /* begin write transaction */\n      sqlite3PagerPagecount(pPager, &page_count);\n      for(pgno = 1; rc == SQLITE_OK && pgno <= (unsigned int)page_count; pgno++) { /* pgno's start at 1 see pager.c:pagerAcquire */\n        if(!sqlite3pager_is_mj_pgno(pPager, pgno)) { /* skip this page (see pager.c:pagerAcquire for reasoning) */\n          rc = sqlite3PagerGet(pPager, pgno, &page, 0);\n          if(rc == SQLITE_OK) { /* write page see pager_incr_changecounter for example */\n            rc = sqlite3PagerWrite(page);\n            if(rc == SQLITE_OK) {\n              sqlite3PagerUnref(page);\n            } else {\n             CODEC_TRACE((\"sqlite3_rekey_v2: error %d occurred writing page %d\\n\", rc, pgno));  \n            }\n          } else {\n             CODEC_TRACE((\"sqlite3_rekey_v2: error %d occurred getting page %d\\n\", rc, pgno));  \n          }\n        } \n      }\n\n      /* if commit was successful commit and copy the rekey data to current key, else rollback to release locks */\n      if(rc == SQLITE_OK) { \n        CODEC_TRACE((\"sqlite3_rekey_v2: committing\\n\"));\n        rc = sqlite3BtreeCommit(pDb->pBt); \n        sqlcipher_codec_key_copy(ctx, CIPHER_WRITE_CTX);\n      } else {\n        CODEC_TRACE((\"sqlite3_rekey_v2: rollback\\n\"));\n        sqlite3BtreeRollback(pDb->pBt, SQLITE_ABORT_ROLLBACK, 0);\n      }\n\n      sqlite3_mutex_leave(db->mutex);\n    }\n    return SQLITE_OK;\n  }\n  return SQLITE_ERROR;\n}\n\nvoid sqlite3CodecGetKey(sqlite3* db, int nDb, void **zKey, int *nKey) {\n  struct Db *pDb = &db->aDb[nDb];\n  CODEC_TRACE((\"sqlite3CodecGetKey: entered db=%p, nDb=%d\\n\", db, nDb));\n  if( pDb->pBt ) {\n    codec_ctx *ctx;\n    sqlite3pager_get_codec(pDb->pBt->pBt->pPager, (void **) &ctx);\n    if(ctx) {\n      if(sqlcipher_codec_get_store_pass(ctx) == 1) {\n        sqlcipher_codec_get_pass(ctx, zKey, nKey);\n      } else {\n        sqlcipher_codec_get_keyspec(ctx, zKey, nKey);\n      }\n    } else {\n      *zKey = NULL;\n      *nKey = 0;\n    }\n  }\n}\n\n#if defined (SQLCIPHER_PREPROCESSED)\nvoid cipher_hex2bin(const unsigned char *hex, int sz, unsigned char *out){\n    int i;\n    for(i = 0; i < sz; i += 2){\n        out[i/2] = (cipher_hex2int(hex[i])<<4) | cipher_hex2int(hex[i+1]);\n    }\n}\n#endif /* SQLCIPHER_PREPROCESSED */\n\n#if defined (SQLCIPHER_PREPROCESSED)\nvoid cipher_bin2hex(const unsigned char* in, int sz, char *out) {\n    int i;\n    for(i=0; i < sz; i++) {\n        sqlite3_snprintf(3, out + (i*2), \"%02x \", in[i]);\n    }\n}\n#endif /* SQLCIPHER_PREPROCESSED */\n\n#if defined (SQLCIPHER_PREPROCESSED)\nint cipher_isHex(const unsigned char *hex, int sz){\n    int i;\n    for(i = 0; i < sz; i++) {\n        unsigned char c = hex[i];\n        if ((c < '0' || c > '9') &&\n            (c < 'A' || c > 'F') &&\n            (c < 'a' || c > 'f')) {\n            return 0;\n        }\n    }\n    return 1;\n}\n#endif /* SQLCIPHER_PREPROCESSED */\n\n\n#ifndef OMIT_EXPORT\n\n/*\n * Implementation of an \"export\" function that allows a caller\n * to duplicate the main database to an attached database. This is intended\n * as a conveneince for users who need to:\n * \n *   1. migrate from an non-encrypted database to an encrypted database\n *   2. move from an encrypted database to a non-encrypted database\n *   3. convert beween the various flavors of encrypted databases.  \n *\n * This implementation is based heavily on the procedure and code used\n * in vacuum.c, but is exposed as a function that allows export to any\n * named attached database.\n */\n\n/*\n** Finalize a prepared statement.  If there was an error, store the\n** text of the error message in *pzErrMsg.  Return the result code.\n** \n** Based on vacuumFinalize from vacuum.c\n*/\nstatic int sqlcipher_finalize(sqlite3 *db, sqlite3_stmt *pStmt, char **pzErrMsg){\n  int rc;\n  rc = sqlite3VdbeFinalize((Vdbe*)pStmt);\n  if( rc ){\n    sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));\n  }\n  return rc;\n}\n\n/*\n** Execute zSql on database db. Return an error code.\n** \n** Based on execSql from vacuum.c\n*/\nstatic int sqlcipher_execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){\n  sqlite3_stmt *pStmt;\n  VVA_ONLY( int rc; )\n  if( !zSql ){\n    return SQLITE_NOMEM;\n  }\n  if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){\n    sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));\n    return sqlite3_errcode(db);\n  }\n  VVA_ONLY( rc = ) sqlite3_step(pStmt);\n  assert( rc!=SQLITE_ROW );\n  return sqlcipher_finalize(db, pStmt, pzErrMsg);\n}\n\n/*\n** Execute zSql on database db. The statement returns exactly\n** one column. Execute this as SQL on the same database.\n** \n** Based on execExecSql from vacuum.c\n*/\nstatic int sqlcipher_execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){\n  sqlite3_stmt *pStmt;\n  int rc;\n\n  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);\n  if( rc!=SQLITE_OK ) return rc;\n\n  while( SQLITE_ROW==sqlite3_step(pStmt) ){\n    rc = sqlcipher_execSql(db, pzErrMsg, (char*)sqlite3_column_text(pStmt, 0));\n    if( rc!=SQLITE_OK ){\n      sqlcipher_finalize(db, pStmt, pzErrMsg);\n      return rc;\n    }\n  }\n\n  return sqlcipher_finalize(db, pStmt, pzErrMsg);\n}\n\n/*\n * copy database and schema from the main database to an attached database\n * \n * Based on sqlite3RunVacuum from vacuum.c\n*/\nvoid sqlcipher_exportFunc(sqlite3_context *context, int argc, sqlite3_value **argv) {\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  const char* toDb = (const char*) sqlite3_value_text(argv[0]);\n  const char* fromDb = (argc > 1) ? (const char *) sqlite3_value_text(argv[1]) : \"main\";\n  int saved_flags;        /* Saved value of the db->flags */\n  int saved_nChange;      /* Saved value of db->nChange */\n  int saved_nTotalChange; /* Saved value of db->nTotalChange */\n  int (*saved_xTrace)(u32,void*,void*,void*); /* Saved db->xTrace */\n  int rc = SQLITE_OK;     /* Return code from service routines */\n  char *zSql = NULL;         /* SQL statements */\n  char *pzErrMsg = NULL;\n  \n  saved_flags = db->flags;\n  saved_nChange = db->nChange;\n  saved_nTotalChange = db->nTotalChange;\n  saved_xTrace = db->xTrace;\n  db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks | SQLITE_PreferBuiltin;\n  db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder);\n  db->xTrace = 0;\n\n  /* Query the schema of the main database. Create a mirror schema\n  ** in the temporary database.\n  */\n  zSql = sqlite3_mprintf(\n    \"SELECT 'CREATE TABLE %s.' || substr(sql,14) \"\n    \"  FROM %s.sqlite_master WHERE type='table' AND name!='sqlite_sequence'\"\n    \"   AND rootpage>0\"\n  , toDb, fromDb);\n  rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); \n  if( rc!=SQLITE_OK ) goto end_of_export;\n  sqlite3_free(zSql);\n\n  zSql = sqlite3_mprintf(\n    \"SELECT 'CREATE INDEX %s.' || substr(sql,14)\"\n    \"  FROM %s.sqlite_master WHERE sql LIKE 'CREATE INDEX %%' \"\n  , toDb, fromDb);\n  rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); \n  if( rc!=SQLITE_OK ) goto end_of_export;\n  sqlite3_free(zSql);\n\n  zSql = sqlite3_mprintf(\n    \"SELECT 'CREATE UNIQUE INDEX %s.' || substr(sql,21) \"\n    \"  FROM %s.sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %%'\"\n  , toDb, fromDb);\n  rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); \n  if( rc!=SQLITE_OK ) goto end_of_export;\n  sqlite3_free(zSql);\n\n  /* Loop through the tables in the main database. For each, do\n  ** an \"INSERT INTO rekey_db.xxx SELECT * FROM main.xxx;\" to copy\n  ** the contents to the temporary database.\n  */\n  zSql = sqlite3_mprintf(\n    \"SELECT 'INSERT INTO %s.' || quote(name) \"\n    \"|| ' SELECT * FROM %s.' || quote(name) || ';'\"\n    \"FROM %s.sqlite_master \"\n    \"WHERE type = 'table' AND name!='sqlite_sequence' \"\n    \"  AND rootpage>0\"\n  , toDb, fromDb, fromDb);\n  rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); \n  if( rc!=SQLITE_OK ) goto end_of_export;\n  sqlite3_free(zSql);\n\n  /* Copy over the sequence table\n  */\n  zSql = sqlite3_mprintf(\n    \"SELECT 'DELETE FROM %s.' || quote(name) || ';' \"\n    \"FROM %s.sqlite_master WHERE name='sqlite_sequence' \"\n  , toDb, toDb);\n  rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); \n  if( rc!=SQLITE_OK ) goto end_of_export;\n  sqlite3_free(zSql);\n\n  zSql = sqlite3_mprintf(\n    \"SELECT 'INSERT INTO %s.' || quote(name) \"\n    \"|| ' SELECT * FROM %s.' || quote(name) || ';' \"\n    \"FROM %s.sqlite_master WHERE name=='sqlite_sequence';\"\n  , toDb, fromDb, toDb);\n  rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execExecSql(db, &pzErrMsg, zSql); \n  if( rc!=SQLITE_OK ) goto end_of_export;\n  sqlite3_free(zSql);\n\n  /* Copy the triggers, views, and virtual tables from the main database\n  ** over to the temporary database.  None of these objects has any\n  ** associated storage, so all we have to do is copy their entries\n  ** from the SQLITE_MASTER table.\n  */\n  zSql = sqlite3_mprintf(\n    \"INSERT INTO %s.sqlite_master \"\n    \"  SELECT type, name, tbl_name, rootpage, sql\"\n    \"    FROM %s.sqlite_master\"\n    \"   WHERE type='view' OR type='trigger'\"\n    \"      OR (type='table' AND rootpage=0)\"\n  , toDb, fromDb);\n  rc = (zSql == NULL) ? SQLITE_NOMEM : sqlcipher_execSql(db, &pzErrMsg, zSql); \n  if( rc!=SQLITE_OK ) goto end_of_export;\n  sqlite3_free(zSql);\n\n  zSql = NULL;\nend_of_export:\n  db->flags = saved_flags;\n  db->nChange = saved_nChange;\n  db->nTotalChange = saved_nTotalChange;\n  db->xTrace = saved_xTrace;\n\n  sqlite3_free(zSql);\n\n  if(rc) {\n    if(pzErrMsg != NULL) {\n      sqlite3_result_error(context, pzErrMsg, -1);\n      sqlite3DbFree(db, pzErrMsg);\n    } else {\n      sqlite3_result_error(context, sqlite3ErrStr(rc), -1);\n    }\n  }\n}\n\n#endif\n\n/* END SQLCIPHER */\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/crypto.h",
    "content": "/* \n** SQLCipher\n** crypto.h developed by Stephen Lombardo (Zetetic LLC) \n** sjlombardo at zetetic dot net\n** http://zetetic.net\n** \n** Copyright (c) 2008, ZETETIC LLC\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without\n** modification, are permitted provided that the following conditions are met:\n**     * Redistributions of source code must retain the above copyright\n**       notice, this list of conditions and the following disclaimer.\n**     * Redistributions in binary form must reproduce the above copyright\n**       notice, this list of conditions and the following disclaimer in the\n**       documentation and/or other materials provided with the distribution.\n**     * Neither the name of the ZETETIC LLC nor the\n**       names of its contributors may be used to endorse or promote products\n**       derived from this software without specific prior written permission.\n** \n** THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\n** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n** DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\n** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n#ifndef CRYPTO_H\n#define CRYPTO_H\n\n#if !defined (SQLCIPHER_CRYPTO_CC) \\\n   && !defined (SQLCIPHER_CRYPTO_LIBTOMCRYPT) \\\n   && !defined (SQLCIPHER_CRYPTO_OPENSSL)\n#define SQLCIPHER_CRYPTO_OPENSSL\n#endif\n\n#if defined (SQLCIPHER_PREPROCESSED)\n#include \"sqliteInt.h\"\n#endif /* SQLCIPHER_PREPROCESSED */\n\n#define FILE_HEADER_SZ 16\n\n#ifndef CIPHER_VERSION\n#ifdef SQLCIPHER_FIPS\n#define CIPHER_VERSION \"3.4.1 FIPS\"\n#else\n#define CIPHER_VERSION \"3.4.1\"\n#endif\n#endif\n\n#ifndef CIPHER\n#define CIPHER \"aes-256-cbc\"\n#endif\n\n#define CIPHER_DECRYPT 0\n#define CIPHER_ENCRYPT 1\n\n#define CIPHER_READ_CTX 0\n#define CIPHER_WRITE_CTX 1\n#define CIPHER_READWRITE_CTX 2\n\n#ifndef PBKDF2_ITER\n#define PBKDF2_ITER 64000\n#endif\n\n/* possible flags for cipher_ctx->flags */\n#define CIPHER_FLAG_HMAC          0x01\n#define CIPHER_FLAG_LE_PGNO       0x02\n#define CIPHER_FLAG_BE_PGNO       0x04\n\n#ifndef DEFAULT_CIPHER_FLAGS\n#define DEFAULT_CIPHER_FLAGS CIPHER_FLAG_HMAC | CIPHER_FLAG_LE_PGNO\n#endif\n\n\n/* by default, sqlcipher will use a reduced number of iterations to generate\n   the HMAC key / or transform a raw cipher key \n   */\n#ifndef FAST_PBKDF2_ITER\n#define FAST_PBKDF2_ITER 2\n#endif\n\n/* this if a fixed random array that will be xor'd with the database salt to ensure that the\n   salt passed to the HMAC key derivation function is not the same as that used to derive\n   the encryption key. This can be overridden at compile time but it will make the resulting\n   binary incompatible with the default builds when using HMAC. A future version of SQLcipher\n   will likely allow this to be defined at runtime via pragma */ \n#ifndef HMAC_SALT_MASK\n#define HMAC_SALT_MASK 0x3a\n#endif\n\n#ifndef CIPHER_MAX_IV_SZ\n#define CIPHER_MAX_IV_SZ 16\n#endif\n\n#ifndef CIPHER_MAX_KEY_SZ\n#define CIPHER_MAX_KEY_SZ 64\n#endif\n\n\n#ifdef CODEC_DEBUG\n#define CODEC_TRACE(X)  {printf X;fflush(stdout);}\n#else\n#define CODEC_TRACE(X)\n#endif\n\n#ifdef CODEC_DEBUG_PAGEDATA\n#define CODEC_HEXDUMP(DESC,BUFFER,LEN)  \\\n  { \\\n    int __pctr; \\\n    printf(DESC); \\\n    for(__pctr=0; __pctr < LEN; __pctr++) { \\\n      if(__pctr % 16 == 0) printf(\"\\n%05x: \",__pctr); \\\n      printf(\"%02x \",((unsigned char*) BUFFER)[__pctr]); \\\n    } \\\n    printf(\"\\n\"); \\\n    fflush(stdout); \\\n  }\n#else\n#define CODEC_HEXDUMP(DESC,BUFFER,LEN)\n#endif\n\n/* utility functions */\nvoid sqlcipher_free(void *ptr, int sz);\nvoid* sqlcipher_malloc(int sz);\nvoid* sqlcipher_memset(void *v, unsigned char value, int len);\nint sqlcipher_ismemset(const void *v, unsigned char value, int len);\nint sqlcipher_memcmp(const void *v0, const void *v1, int len);\nvoid sqlcipher_free(void *, int);\n\n/* extensions defined in pager.c */ \nvoid sqlite3pager_get_codec(Pager *pPager, void **ctx);\nint sqlite3pager_is_mj_pgno(Pager *pPager, Pgno pgno);\nsqlite3_file *sqlite3Pager_get_fd(Pager *pPager);\nvoid sqlite3pager_sqlite3PagerSetCodec(\n  Pager *pPager,\n  void *(*xCodec)(void*,void*,Pgno,int),\n  void (*xCodecSizeChng)(void*,int,int),\n  void (*xCodecFree)(void*),\n  void *pCodec\n);\nvoid sqlite3pager_sqlite3PagerSetError(Pager *pPager, int error);\n/* end extensions defined in pager.c */\n \n/*\n**  Simple shared routines for converting hex char strings to binary data\n */\nstatic int cipher_hex2int(char c) {\n  return (c>='0' && c<='9') ? (c)-'0' :\n         (c>='A' && c<='F') ? (c)-'A'+10 :\n         (c>='a' && c<='f') ? (c)-'a'+10 : 0;\n}\n\n#if defined (SQLCIPHER_PREPROCESSED)\nvoid cipher_hex2bin(const unsigned char *hex, int sz, unsigned char *out);\n#else /* SQLCIPHER_PREPROCESSED */\nstatic void cipher_hex2bin(const unsigned char *hex, int sz, unsigned char *out){\n  int i;\n  for(i = 0; i < sz; i += 2){\n    out[i/2] = (cipher_hex2int(hex[i])<<4) | cipher_hex2int(hex[i+1]);\n  }\n}\n#endif /* SQLCIPHER_PREPROCESSED */\n\n#if defined (SQLCIPHER_PREPROCESSED)\nvoid cipher_bin2hex(const unsigned char* in, int sz, char *out);\n#else /* SQLCIPHER_PREPROCESSED */\nstatic void cipher_bin2hex(const unsigned char* in, int sz, char *out) {\n    int i;\n    for(i=0; i < sz; i++) {\n      sqlite3_snprintf(3, out + (i*2), \"%02x \", in[i]);\n    } \n}\n#endif /* SQLCIPHER_PREPROCESSED */\n\n#if defined (SQLCIPHER_PREPROCESSED)\nint cipher_isHex(const unsigned char *hex, int sz);\n#else /* SQLCIPHER_PREPROCESSED */\nstatic int cipher_isHex(const unsigned char *hex, int sz){\n  int i;\n  for(i = 0; i < sz; i++) {\n    unsigned char c = hex[i];\n    if ((c < '0' || c > '9') &&\n        (c < 'A' || c > 'F') &&\n        (c < 'a' || c > 'f')) {\n      return 0;\n    }\n  }\n  return 1;\n}\n#endif /* SQLCIPHER_PREPROCESSED */\n\n/* extensions defined in crypto_impl.c */\ntypedef struct codec_ctx codec_ctx;\n\n/* activation and initialization */\nvoid sqlcipher_activate();\nvoid sqlcipher_deactivate();\nint sqlcipher_codec_ctx_init(codec_ctx **, Db *, Pager *, sqlite3_file *, const void *, int);\nvoid sqlcipher_codec_ctx_free(codec_ctx **);\nint sqlcipher_codec_key_derive(codec_ctx *);\nint sqlcipher_codec_key_copy(codec_ctx *, int);\n\n/* page cipher implementation */\nint sqlcipher_page_cipher(codec_ctx *, int, Pgno, int, int, unsigned char *, unsigned char *);\n\n/* context setters & getters */\nvoid sqlcipher_codec_ctx_set_error(codec_ctx *, int);\n\nint sqlcipher_codec_ctx_set_pass(codec_ctx *, const void *, int, int);\nvoid sqlcipher_codec_get_keyspec(codec_ctx *, void **zKey, int *nKey);\n\nint sqlcipher_codec_ctx_set_pagesize(codec_ctx *, int);\nint sqlcipher_codec_ctx_get_pagesize(codec_ctx *);\nint sqlcipher_codec_ctx_get_reservesize(codec_ctx *);\n\nvoid sqlcipher_set_default_pagesize(int page_size);\nint sqlcipher_get_default_pagesize();\n\nvoid sqlcipher_set_default_kdf_iter(int iter);\nint sqlcipher_get_default_kdf_iter();\n\nint sqlcipher_codec_ctx_set_kdf_iter(codec_ctx *, int, int);\nint sqlcipher_codec_ctx_get_kdf_iter(codec_ctx *ctx, int);\n\nvoid* sqlcipher_codec_ctx_get_kdf_salt(codec_ctx *ctx);\n\nint sqlcipher_codec_ctx_set_fast_kdf_iter(codec_ctx *, int, int);\nint sqlcipher_codec_ctx_get_fast_kdf_iter(codec_ctx *, int);\n\nint sqlcipher_codec_ctx_set_cipher(codec_ctx *, const char *, int);\nconst char* sqlcipher_codec_ctx_get_cipher(codec_ctx *ctx, int for_ctx);\n\nvoid* sqlcipher_codec_ctx_get_data(codec_ctx *);\n\nvoid sqlcipher_exportFunc(sqlite3_context *, int, sqlite3_value **);\n\nvoid sqlcipher_set_default_use_hmac(int use);\nint sqlcipher_get_default_use_hmac();\n\nvoid sqlcipher_set_hmac_salt_mask(unsigned char mask);\nunsigned char sqlcipher_get_hmac_salt_mask();\n\nint sqlcipher_codec_ctx_set_use_hmac(codec_ctx *ctx, int use);\nint sqlcipher_codec_ctx_get_use_hmac(codec_ctx *ctx, int for_ctx);\n\nint sqlcipher_codec_ctx_set_flag(codec_ctx *ctx, unsigned int flag);\nint sqlcipher_codec_ctx_unset_flag(codec_ctx *ctx, unsigned int flag);\nint sqlcipher_codec_ctx_get_flag(codec_ctx *ctx, unsigned int flag, int for_ctx);\n\nconst char* sqlcipher_codec_get_cipher_provider(codec_ctx *ctx);\nint sqlcipher_codec_ctx_migrate(codec_ctx *ctx);\nint sqlcipher_codec_add_random(codec_ctx *ctx, const char *data, int random_sz);\n#if defined (SQLCIPHER_PREPROCESSED)\nint sqlcipher_codec_get_store_pass(codec_ctx *ctx);\nvoid sqlcipher_codec_get_pass(codec_ctx *ctx, void **zKey, int *nKey);\nvoid sqlcipher_codec_set_store_pass(codec_ctx *ctx, int value);\n#else /* SQLCIPHER_PREPROCESSED */\nstatic int sqlcipher_codec_get_store_pass(codec_ctx *ctx);\nstatic void sqlcipher_codec_get_pass(codec_ctx *ctx, void **zKey, int *nKey);\nstatic void sqlcipher_codec_set_store_pass(codec_ctx *ctx, int value);\n#endif /* SQLCIPHER_PREPROCESSED */\nint sqlcipher_codec_fips_status(codec_ctx *ctx);\nconst char* sqlcipher_codec_get_provider_version(codec_ctx *ctx);\n#endif\n#endif\n/* END SQLCIPHER */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/crypto_cc.c",
    "content": "/*\n** SQLCipher\n** http://sqlcipher.net\n**\n** Copyright (c) 2008 - 2013, ZETETIC LLC\n** All rights reserved.\n**\n** Redistribution and use in source and binary forms, with or without\n** modification, are permitted provided that the following conditions are met:\n**     * Redistributions of source code must retain the above copyright\n**       notice, this list of conditions and the following disclaimer.\n**     * Redistributions in binary form must reproduce the above copyright\n**       notice, this list of conditions and the following disclaimer in the\n**       documentation and/or other materials provided with the distribution.\n**     * Neither the name of the ZETETIC LLC nor the\n**       names of its contributors may be used to endorse or promote products\n**       derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\n** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n** DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\n** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n**\n*/\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n#ifdef SQLCIPHER_CRYPTO_CC\n#include \"crypto.h\"\n#include \"sqlcipher.h\"\n#include <CommonCrypto/CommonCrypto.h>\n#include <Security/SecRandom.h>\n#include <CoreFoundation/CoreFoundation.h>\n\nstatic int sqlcipher_cc_add_random(void *ctx, void *buffer, int length) {\n  return SQLITE_OK;\n}\n\n/* generate a defined number of random bytes */\nstatic int sqlcipher_cc_random (void *ctx, void *buffer, int length) {\n  return (SecRandomCopyBytes(kSecRandomDefault, length, (uint8_t *)buffer) == 0) ? SQLITE_OK : SQLITE_ERROR;\n}\n\nstatic const char* sqlcipher_cc_get_provider_name(void *ctx) {\n  return \"commoncrypto\";\n}\n\nstatic const char* sqlcipher_cc_get_provider_version(void *ctx) {\n#if TARGET_OS_MAC\n  CFTypeRef version;\n  CFBundleRef bundle = CFBundleGetBundleWithIdentifier(CFSTR(\"com.apple.security\"));\n  if(bundle == NULL) {\n    return \"unknown\";\n  }\n  version = CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR(\"CFBundleShortVersionString\"));\n  return CFStringGetCStringPtr(version, kCFStringEncodingUTF8);\n#else\n  return \"unknown\";\n#endif\n}\n\nstatic int sqlcipher_cc_hmac(void *ctx, unsigned char *hmac_key, int key_sz, unsigned char *in, int in_sz, unsigned char *in2, int in2_sz, unsigned char *out) {\n  CCHmacContext hmac_context;\n  CCHmacInit(&hmac_context, kCCHmacAlgSHA1, hmac_key, key_sz);\n  CCHmacUpdate(&hmac_context, in, in_sz);\n  CCHmacUpdate(&hmac_context, in2, in2_sz);\n  CCHmacFinal(&hmac_context, out);\n  return SQLITE_OK; \n}\n\nstatic int sqlcipher_cc_kdf(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {\n  CCKeyDerivationPBKDF(kCCPBKDF2, (const char *)pass, pass_sz, salt, salt_sz, kCCPRFHmacAlgSHA1, workfactor, key, key_sz);\n  return SQLITE_OK; \n}\n\nstatic int sqlcipher_cc_cipher(void *ctx, int mode, unsigned char *key, int key_sz, unsigned char *iv, unsigned char *in, int in_sz, unsigned char *out) {\n  CCCryptorRef cryptor;\n  size_t tmp_csz, csz;\n  CCOperation op = mode == CIPHER_ENCRYPT ? kCCEncrypt : kCCDecrypt;\n\n  CCCryptorCreate(op, kCCAlgorithmAES128, 0, key, kCCKeySizeAES256, iv, &cryptor);\n  CCCryptorUpdate(cryptor, in, in_sz, out, in_sz, &tmp_csz);\n  csz = tmp_csz;\n  out += tmp_csz;\n  CCCryptorFinal(cryptor, out, in_sz - csz, &tmp_csz);\n  csz += tmp_csz;\n  CCCryptorRelease(cryptor);\n  assert(in_sz == csz);\n\n  return SQLITE_OK; \n}\n\nstatic int sqlcipher_cc_set_cipher(void *ctx, const char *cipher_name) {\n  return SQLITE_OK;\n}\n\nstatic const char* sqlcipher_cc_get_cipher(void *ctx) {\n  return \"aes-256-cbc\";\n}\n\nstatic int sqlcipher_cc_get_key_sz(void *ctx) {\n  return kCCKeySizeAES256;\n}\n\nstatic int sqlcipher_cc_get_iv_sz(void *ctx) {\n  return kCCBlockSizeAES128;\n}\n\nstatic int sqlcipher_cc_get_block_sz(void *ctx) {\n  return kCCBlockSizeAES128;\n}\n\nstatic int sqlcipher_cc_get_hmac_sz(void *ctx) {\n  return CC_SHA1_DIGEST_LENGTH;\n}\n\nstatic int sqlcipher_cc_ctx_copy(void *target_ctx, void *source_ctx) {\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_cc_ctx_cmp(void *c1, void *c2) {\n  return 1; /* always indicate contexts are the same */\n}\n\nstatic int sqlcipher_cc_ctx_init(void **ctx) {\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_cc_ctx_free(void **ctx) {\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_cc_fips_status(void *ctx) {\n  return 0;\n}\n\nint sqlcipher_cc_setup(sqlcipher_provider *p) {\n  p->random = sqlcipher_cc_random;\n  p->get_provider_name = sqlcipher_cc_get_provider_name;\n  p->hmac = sqlcipher_cc_hmac;\n  p->kdf = sqlcipher_cc_kdf;\n  p->cipher = sqlcipher_cc_cipher;\n  p->set_cipher = sqlcipher_cc_set_cipher;\n  p->get_cipher = sqlcipher_cc_get_cipher;\n  p->get_key_sz = sqlcipher_cc_get_key_sz;\n  p->get_iv_sz = sqlcipher_cc_get_iv_sz;\n  p->get_block_sz = sqlcipher_cc_get_block_sz;\n  p->get_hmac_sz = sqlcipher_cc_get_hmac_sz;\n  p->ctx_copy = sqlcipher_cc_ctx_copy;\n  p->ctx_cmp = sqlcipher_cc_ctx_cmp;\n  p->ctx_init = sqlcipher_cc_ctx_init;\n  p->ctx_free = sqlcipher_cc_ctx_free;\n  p->add_random = sqlcipher_cc_add_random;\n  p->fips_status = sqlcipher_cc_fips_status;\n  p->get_provider_version = sqlcipher_cc_get_provider_version;\n  return SQLITE_OK;\n}\n\n#endif\n#endif\n/* END SQLCIPHER */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/crypto_impl.c",
    "content": "/* \n** SQLCipher\n** http://sqlcipher.net\n** \n** Copyright (c) 2008 - 2013, ZETETIC LLC\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without\n** modification, are permitted provided that the following conditions are met:\n**     * Redistributions of source code must retain the above copyright\n**       notice, this list of conditions and the following disclaimer.\n**     * Redistributions in binary form must reproduce the above copyright\n**       notice, this list of conditions and the following disclaimer in the\n**       documentation and/or other materials provided with the distribution.\n**     * Neither the name of the ZETETIC LLC nor the\n**       names of its contributors may be used to endorse or promote products\n**       derived from this software without specific prior written permission.\n** \n** THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\n** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n** DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\n** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n\n#include \"sqliteInt.h\"\n#include \"btreeInt.h\"\n#include \"sqlcipher.h\"\n#include \"crypto.h\"\n#if defined(__unix__) || defined(__APPLE__) || defined(_AIX)\n#include <sys/mman.h>\n#elif defined(_WIN32)\n# include <windows.h>\n#endif\n\n/* the default implementation of SQLCipher uses a cipher_ctx\n   to keep track of read / write state separately. The following\n   struct and associated functions are defined here */\ntypedef struct {\n  int store_pass;\n  int derive_key;\n  int kdf_iter;\n  int fast_kdf_iter;\n  int key_sz;\n  int iv_sz;\n  int block_sz;\n  int pass_sz;\n  int reserve_sz;\n  int hmac_sz;\n  int keyspec_sz;\n  unsigned int flags;\n  unsigned char *key;\n  unsigned char *hmac_key;\n  unsigned char *pass;\n  char *keyspec;\n  sqlcipher_provider *provider;\n  void *provider_ctx;\n} cipher_ctx;\n\nstatic unsigned int default_flags = DEFAULT_CIPHER_FLAGS;\nstatic unsigned char hmac_salt_mask = HMAC_SALT_MASK;\nstatic int default_kdf_iter = PBKDF2_ITER;\nstatic int default_page_size = 1024;\nstatic unsigned int sqlcipher_activate_count = 0;\nstatic sqlite3_mutex* sqlcipher_provider_mutex = NULL;\nstatic sqlcipher_provider *default_provider = NULL;\n\nstruct codec_ctx {\n  int kdf_salt_sz;\n  int page_sz;\n  unsigned char *kdf_salt;\n  unsigned char *hmac_kdf_salt;\n  unsigned char *buffer;\n  Btree *pBt;\n  cipher_ctx *read_ctx;\n  cipher_ctx *write_ctx;\n  unsigned int skip_read_hmac;\n  unsigned int need_kdf_salt;\n};\n\nint sqlcipher_register_provider(sqlcipher_provider *p) {\n  sqlite3_mutex_enter(sqlcipher_provider_mutex);\n  if(default_provider != NULL && default_provider != p) {\n    /* only free the current registerd provider if it has been initialized\n       and it isn't a pointer to the same provider passed to the function\n       (i.e. protect against a caller calling register twice for the same provider) */\n    sqlcipher_free(default_provider, sizeof(sqlcipher_provider));\n  }\n  default_provider = p;   \n  sqlite3_mutex_leave(sqlcipher_provider_mutex);\n  return SQLITE_OK;\n}\n\n/* return a pointer to the currently registered provider. This will\n   allow an application to fetch the current registered provider and\n   make minor changes to it */\nsqlcipher_provider* sqlcipher_get_provider() {\n  return default_provider;\n}\n\nvoid sqlcipher_activate() {\n  sqlite3_mutex_enter(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER));\n\n  if(sqlcipher_provider_mutex == NULL) {\n    /* allocate a new mutex to guard access to the provider */\n    sqlcipher_provider_mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);\n  }\n\n  /* check to see if there is a provider registered at this point\n     if there no provider registered at this point, register the \n     default provider */\n  if(sqlcipher_get_provider() == NULL) {\n    sqlcipher_provider *p = sqlcipher_malloc(sizeof(sqlcipher_provider)); \n\n#if defined(SQLCIPHER_CRYPTO_CUSTOM)\n    extern int sqlcipher_custom_setup(sqlcipher_provider *p);\n    sqlcipher_custom_setup(p);\n#elif defined (SQLCIPHER_CRYPTO_CC)\n    extern int sqlcipher_cc_setup(sqlcipher_provider *p);\n    sqlcipher_cc_setup(p);\n#elif defined (SQLCIPHER_CRYPTO_LIBTOMCRYPT)\n    extern int sqlcipher_ltc_setup(sqlcipher_provider *p);\n    sqlcipher_ltc_setup(p);\n#elif defined (SQLCIPHER_CRYPTO_OPENSSL)\n    extern int sqlcipher_openssl_setup(sqlcipher_provider *p);\n    sqlcipher_openssl_setup(p);\n#else\n#error \"NO DEFAULT SQLCIPHER CRYPTO PROVIDER DEFINED\"\n#endif\n\n    sqlcipher_register_provider(p);\n  }\n\n  sqlcipher_activate_count++; /* increment activation count */\n\n  sqlite3_mutex_leave(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER));\n}\n\nvoid sqlcipher_deactivate() {\n  sqlite3_mutex_enter(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER));\n  sqlcipher_activate_count--;\n  /* if no connections are using sqlcipher, cleanup globals */\n  if(sqlcipher_activate_count < 1) {\n    sqlite3_mutex_enter(sqlcipher_provider_mutex);\n    if(default_provider != NULL) {\n      sqlcipher_free(default_provider, sizeof(sqlcipher_provider));\n      default_provider = NULL;\n    }\n    sqlite3_mutex_leave(sqlcipher_provider_mutex);\n    \n    /* last connection closed, free provider mutex*/\n    sqlite3_mutex_free(sqlcipher_provider_mutex); \n    sqlcipher_provider_mutex = NULL;\n\n    sqlcipher_activate_count = 0; /* reset activation count */\n  }\n  sqlite3_mutex_leave(sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER));\n}\n\n/* constant time memset using volitile to avoid having the memset\n   optimized out by the compiler. \n   Note: As suggested by Joachim Schipper (joachim.schipper@fox-it.com)\n*/\nvoid* sqlcipher_memset(void *v, unsigned char value, int len) {\n#ifndef OMIT_CONSTTIME_MEM\n  if (v == NULL) return v;\n\n  unsigned long val = 0;\n  int i;\n  for (i = 0; i < sizeof(unsigned long); i++) {\n    val = (val << 8) | (value & 0xff);\n  }\n  int len2 = len % sizeof(unsigned long);\n  len = len / sizeof(unsigned long);\n\n  volatile unsigned long *aa = (unsigned long *) v;\n  for (i = 0; i < len; i++) {\n    *aa++ = val;\n  }\n  volatile unsigned char *a = (unsigned char *) aa;\n  for (i = 0; i < len2; i++) {\n    *a++ = value;\n  }\n\n  return v;\n#else\n  return memset(v, value, len);\n#endif\n}\n\n/* constant time memory check tests every position of a memory segement\n   matches a single value (i.e. the memory is all zeros)\n   returns 0 if match, 1 of no match */\nint sqlcipher_ismemset(const void *v, unsigned char value, int len) {\n  unsigned long val = 0;\n  int i;\n  for (i = 0; i < sizeof(unsigned long); i++) {\n    val = (val << 8) | (value & 0xff);\n  }\n  int len2 = len % sizeof(unsigned long);\n  len = len / sizeof(unsigned long);\n\n#ifndef OMIT_CONSTTIME_MEM\n  int result = 0;\n  const unsigned long *aa = (const unsigned long *) v;\n  for (i = 0; i < len; i++) {\n    result |= *aa++ ^ val;\n  }\n  const unsigned char *a = (const unsigned char *) aa;\n  for (i = 0; i < len2; i++) {\n    result |= *a++ ^ value;\n  }\n\n  return (result != 0);\n#else\n  const unsigned long *aa = (const unsigned long *) v;\n  for (i = 0; i < len; i++) {\n    if (*aa++ != val) return 1;\n  }\n  const unsigned char *a = (const unsigned char *) aa;\n  for (i = 0; i < len2; i++) {\n    if (*a++ != value) return 1;\n  }\n\n  return 0;\n#endif\n}\n\n/* constant time memory comparison routine. \n   returns 0 if match, 1 if no match */\nint sqlcipher_memcmp(const void *v0, const void *v1, int len) {\n#ifndef OMIT_CONSTTIME_MEM\n  int len2 = len % sizeof(unsigned long);\n  len = len / sizeof(unsigned long);\n  int i, result = 0;\n\n  const unsigned long *aa0 = (const unsigned long *) v0;\n  const unsigned long *aa1 = (const unsigned long *) v1;\n  for (i = 0; i < len; i++) {\n    result |= *aa0++ ^ *aa1++;\n  }\n  const unsigned char *a0 = (const unsigned char *) aa0;\n  const unsigned char *a1 = (const unsigned char *) aa1;\n  for (i = 0; i < len2; i++) {\n    result |= *a0++ ^ *a1++;\n  }\n  \n  return (result != 0);\n#else\n  return memcmp(v0, v1, len);\n#endif\n}\n\n/**\n  * Free and wipe memory. Uses SQLites internal sqlite3_free so that memory\n  * can be countend and memory leak detection works in the test suite. \n  * If ptr is not null memory will be freed. \n  * If sz is greater than zero, the memory will be overwritten with zero before it is freed\n  * If sz is > 0, and not compiled with OMIT_MEMLOCK, system will attempt to unlock the\n  * memory segment so it can be paged\n  */\nvoid sqlcipher_free(void *ptr, int sz) {\n  if(ptr) {\n    if(sz > 0) {\n      sqlcipher_memset(ptr, 0, sz);\n#ifndef OMIT_MEMLOCK\n#if defined(__unix__) || defined(__APPLE__) \n      munlock(ptr, sz);\n#elif defined(_WIN32)\n#if !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP || WINAPI_FAMILY == WINAPI_FAMILY_APP))\nVirtualUnlock(ptr, sz);\n#endif\n#endif\n#endif\n    }\n    sqlite3_free(ptr);\n  }\n}\n\n/**\n  * allocate memory. Uses sqlite's internall malloc wrapper so memory can be \n  * reference counted and leak detection works. Unless compiled with OMIT_MEMLOCK\n  * attempts to lock the memory pages so sensitive information won't be swapped\n  */\nvoid* sqlcipher_malloc(int sz) {\n  void *ptr = sqlite3Malloc(sz);\n  sqlcipher_memset(ptr, 0, sz);\n#ifndef OMIT_MEMLOCK\n  if(ptr) {\n#if defined(__unix__) || defined(__APPLE__) \n    mlock(ptr, sz);\n#elif defined(_WIN32)\n#if !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP || WINAPI_FAMILY == WINAPI_FAMILY_APP))\n    VirtualLock(ptr, sz);\n#endif\n#endif\n  }\n#endif\n  return ptr;\n}\n\n\n/**\n  * Initialize new cipher_ctx struct. This function will allocate memory\n  * for the cipher context and for the key\n  * \n  * returns SQLITE_OK if initialization was successful\n  * returns SQLITE_NOMEM if an error occured allocating memory\n  */\nstatic int sqlcipher_cipher_ctx_init(cipher_ctx **iCtx) {\n  int rc;\n  cipher_ctx *ctx;\n  *iCtx = (cipher_ctx *) sqlcipher_malloc(sizeof(cipher_ctx));\n  ctx = *iCtx;\n  if(ctx == NULL) return SQLITE_NOMEM;\n\n  ctx->provider = (sqlcipher_provider *) sqlcipher_malloc(sizeof(sqlcipher_provider));\n  if(ctx->provider == NULL) return SQLITE_NOMEM;\n\n  /* make a copy of the provider to be used for the duration of the context */\n  sqlite3_mutex_enter(sqlcipher_provider_mutex);\n  memcpy(ctx->provider, default_provider, sizeof(sqlcipher_provider));\n  sqlite3_mutex_leave(sqlcipher_provider_mutex);\n\n  if((rc = ctx->provider->ctx_init(&ctx->provider_ctx)) != SQLITE_OK) return rc;\n  ctx->key = (unsigned char *) sqlcipher_malloc(CIPHER_MAX_KEY_SZ);\n  ctx->hmac_key = (unsigned char *) sqlcipher_malloc(CIPHER_MAX_KEY_SZ);\n  if(ctx->key == NULL) return SQLITE_NOMEM;\n  if(ctx->hmac_key == NULL) return SQLITE_NOMEM;\n\n  /* setup default flags */\n  ctx->flags = default_flags;\n\n  return SQLITE_OK;\n}\n\n/**\n  * Free and wipe memory associated with a cipher_ctx\n  */\nstatic void sqlcipher_cipher_ctx_free(cipher_ctx **iCtx) {\n  cipher_ctx *ctx = *iCtx;\n  CODEC_TRACE((\"cipher_ctx_free: entered iCtx=%p\\n\", iCtx));\n  ctx->provider->ctx_free(&ctx->provider_ctx);\n  sqlcipher_free(ctx->provider, sizeof(sqlcipher_provider)); \n  sqlcipher_free(ctx->key, ctx->key_sz);\n  sqlcipher_free(ctx->hmac_key, ctx->key_sz);\n  sqlcipher_free(ctx->pass, ctx->pass_sz);\n  sqlcipher_free(ctx->keyspec, ctx->keyspec_sz);\n  sqlcipher_free(ctx, sizeof(cipher_ctx)); \n}\n\n/**\n  * Compare one cipher_ctx to another.\n  *\n  * returns 0 if all the parameters (except the derived key data) are the same\n  * returns 1 otherwise\n  */\nstatic int sqlcipher_cipher_ctx_cmp(cipher_ctx *c1, cipher_ctx *c2) {\n  int are_equal = (\n    c1->iv_sz == c2->iv_sz\n    && c1->kdf_iter == c2->kdf_iter\n    && c1->fast_kdf_iter == c2->fast_kdf_iter\n    && c1->key_sz == c2->key_sz\n    && c1->pass_sz == c2->pass_sz\n    && c1->flags == c2->flags\n    && c1->hmac_sz == c2->hmac_sz\n    && c1->provider->ctx_cmp(c1->provider_ctx, c2->provider_ctx) \n    && (\n      c1->pass == c2->pass\n      || !sqlcipher_memcmp((const unsigned char*)c1->pass,\n                           (const unsigned char*)c2->pass,\n                           c1->pass_sz)\n    ));\n\n  CODEC_TRACE((\"sqlcipher_cipher_ctx_cmp: entered \\\n                  c1=%p c2=%p \\\n                  c1->iv_sz=%d c2->iv_sz=%d \\\n                  c1->kdf_iter=%d c2->kdf_iter=%d \\\n                  c1->fast_kdf_iter=%d c2->fast_kdf_iter=%d \\\n                  c1->key_sz=%d c2->key_sz=%d \\\n                  c1->pass_sz=%d c2->pass_sz=%d \\\n                  c1->flags=%d c2->flags=%d \\\n                  c1->hmac_sz=%d c2->hmac_sz=%d \\\n                  c1->provider_ctx=%p c2->provider_ctx=%p \\\n                  c1->pass=%p c2->pass=%p \\\n                  c1->pass=%s c2->pass=%s \\\n                  provider->ctx_cmp=%d \\\n                  sqlcipher_memcmp=%d \\\n                  are_equal=%d \\\n                   \\n\", \n                  c1, c2,\n                  c1->iv_sz, c2->iv_sz,\n                  c1->kdf_iter, c2->kdf_iter,\n                  c1->fast_kdf_iter, c2->fast_kdf_iter,\n                  c1->key_sz, c2->key_sz,\n                  c1->pass_sz, c2->pass_sz,\n                  c1->flags, c2->flags,\n                  c1->hmac_sz, c2->hmac_sz,\n                  c1->provider_ctx, c2->provider_ctx,\n                  c1->pass, c2->pass,\n                  c1->pass, c2->pass,\n                  c1->provider->ctx_cmp(c1->provider_ctx, c2->provider_ctx),\n                  sqlcipher_memcmp((const unsigned char*)c1->pass,\n                           (const unsigned char*)c2->pass,\n                           c1->pass_sz),\n                  are_equal\n                  ));\n\n  return !are_equal; /* return 0 if they are the same, 1 otherwise */\n}\n\n/**\n  * Copy one cipher_ctx to another. For instance, assuming that read_ctx is a \n  * fully initialized context, you could copy it to write_ctx and all yet data\n  * and pass information across\n  *\n  * returns SQLITE_OK if initialization was successful\n  * returns SQLITE_NOMEM if an error occured allocating memory\n  */\nstatic int sqlcipher_cipher_ctx_copy(cipher_ctx *target, cipher_ctx *source) {\n  void *key = target->key; \n  void *hmac_key = target->hmac_key; \n  void *provider = target->provider;\n  void *provider_ctx = target->provider_ctx;\n\n  CODEC_TRACE((\"sqlcipher_cipher_ctx_copy: entered target=%p, source=%p\\n\", target, source));\n  sqlcipher_free(target->pass, target->pass_sz); \n  sqlcipher_free(target->keyspec, target->keyspec_sz); \n  memcpy(target, source, sizeof(cipher_ctx));\n\n  target->key = key; //restore pointer to previously allocated key data\n  memcpy(target->key, source->key, CIPHER_MAX_KEY_SZ);\n\n  target->hmac_key = hmac_key; //restore pointer to previously allocated hmac key data\n  memcpy(target->hmac_key, source->hmac_key, CIPHER_MAX_KEY_SZ);\n\n  target->provider = provider; // restore pointer to previouly allocated provider;\n  memcpy(target->provider, source->provider, sizeof(sqlcipher_provider));\n\n  target->provider_ctx = provider_ctx; // restore pointer to previouly allocated provider context;\n  target->provider->ctx_copy(target->provider_ctx, source->provider_ctx);\n\n  if(source->pass && source->pass_sz) {\n    target->pass = sqlcipher_malloc(source->pass_sz);\n    if(target->pass == NULL) return SQLITE_NOMEM;\n    memcpy(target->pass, source->pass, source->pass_sz);\n  }\n  if(source->keyspec && source->keyspec_sz) {\n    target->keyspec = sqlcipher_malloc(source->keyspec_sz);\n    if(target->keyspec == NULL) return SQLITE_NOMEM;\n    memcpy(target->keyspec, source->keyspec, source->keyspec_sz);\n  }\n  return SQLITE_OK;\n}\n\n/**\n  * Set the keyspec for the cipher_ctx\n  * \n  * returns SQLITE_OK if assignment was successfull\n  * returns SQLITE_NOMEM if an error occured allocating memory\n  */\nstatic int sqlcipher_cipher_ctx_set_keyspec(cipher_ctx *ctx, const unsigned char *key, int key_sz, const unsigned char *salt, int salt_sz) {\n\n    /* free, zero existing pointers and size */\n  sqlcipher_free(ctx->keyspec, ctx->keyspec_sz);\n  ctx->keyspec = NULL;\n  ctx->keyspec_sz = 0;\n\n  /* establic a hex-formated key specification, containing the raw encryption key and\n     the salt used to generate it */\n  ctx->keyspec_sz = ((key_sz + salt_sz) * 2) + 3;\n  ctx->keyspec = sqlcipher_malloc(ctx->keyspec_sz);\n  if(ctx->keyspec == NULL) return SQLITE_NOMEM;\n\n  ctx->keyspec[0] = 'x';\n  ctx->keyspec[1] = '\\'';\n  cipher_bin2hex(key, key_sz, ctx->keyspec + 2);\n  cipher_bin2hex(salt, salt_sz, ctx->keyspec + (key_sz * 2) + 2);\n  ctx->keyspec[ctx->keyspec_sz - 1] = '\\'';\n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_get_store_pass(codec_ctx *ctx) {\n  return ctx->read_ctx->store_pass;\n}\n\nvoid sqlcipher_codec_set_store_pass(codec_ctx *ctx, int value) {\n  ctx->read_ctx->store_pass = value;\n}\n\nvoid sqlcipher_codec_get_pass(codec_ctx *ctx, void **zKey, int *nKey) {\n  *zKey = ctx->read_ctx->pass;\n  *nKey = ctx->read_ctx->pass_sz;\n}\n\n/**\n  * Set the passphrase for the cipher_ctx\n  * \n  * returns SQLITE_OK if assignment was successfull\n  * returns SQLITE_NOMEM if an error occured allocating memory\n  */\nstatic int sqlcipher_cipher_ctx_set_pass(cipher_ctx *ctx, const void *zKey, int nKey) {\n\n  /* free, zero existing pointers and size */\n  sqlcipher_free(ctx->pass, ctx->pass_sz);\n  ctx->pass = NULL;\n  ctx->pass_sz = 0;\n\n  if(zKey && nKey) { /* if new password is provided, copy it */\n    ctx->pass_sz = nKey;\n    ctx->pass = sqlcipher_malloc(nKey);\n    if(ctx->pass == NULL) return SQLITE_NOMEM;\n    memcpy(ctx->pass, zKey, nKey);\n  } \n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_ctx_set_pass(codec_ctx *ctx, const void *zKey, int nKey, int for_ctx) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  int rc;\n\n  if((rc = sqlcipher_cipher_ctx_set_pass(c_ctx, zKey, nKey)) != SQLITE_OK) return rc; \n  c_ctx->derive_key = 1;\n\n  if(for_ctx == 2)\n    if((rc = sqlcipher_cipher_ctx_copy( for_ctx ? ctx->read_ctx : ctx->write_ctx, c_ctx)) != SQLITE_OK) \n      return rc; \n\n  return SQLITE_OK;\n} \n\nint sqlcipher_codec_ctx_set_cipher(codec_ctx *ctx, const char *cipher_name, int for_ctx) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  int rc;\n\n  rc = c_ctx->provider->set_cipher(c_ctx->provider_ctx, cipher_name);\n  if(rc != SQLITE_OK){\n    sqlcipher_codec_ctx_set_error(ctx, rc);\n    return rc;\n  }\n  c_ctx->key_sz = c_ctx->provider->get_key_sz(c_ctx->provider_ctx);\n  c_ctx->iv_sz = c_ctx->provider->get_iv_sz(c_ctx->provider_ctx);\n  c_ctx->block_sz = c_ctx->provider->get_block_sz(c_ctx->provider_ctx);\n  c_ctx->hmac_sz = c_ctx->provider->get_hmac_sz(c_ctx->provider_ctx);\n  c_ctx->derive_key = 1;\n\n  if(for_ctx == 2)\n    if((rc = sqlcipher_cipher_ctx_copy( for_ctx ? ctx->read_ctx : ctx->write_ctx, c_ctx)) != SQLITE_OK)\n      return rc; \n\n  return SQLITE_OK;\n}\n\nconst char* sqlcipher_codec_ctx_get_cipher(codec_ctx *ctx, int for_ctx) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  return c_ctx->provider->get_cipher(c_ctx->provider_ctx);\n}\n\n/* set the global default KDF iteration */\nvoid sqlcipher_set_default_kdf_iter(int iter) {\n  default_kdf_iter = iter; \n}\n\nint sqlcipher_get_default_kdf_iter() {\n  return default_kdf_iter;\n}\n\nint sqlcipher_codec_ctx_set_kdf_iter(codec_ctx *ctx, int kdf_iter, int for_ctx) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  int rc;\n\n  c_ctx->kdf_iter = kdf_iter;\n  c_ctx->derive_key = 1;\n\n  if(for_ctx == 2)\n    if((rc = sqlcipher_cipher_ctx_copy( for_ctx ? ctx->read_ctx : ctx->write_ctx, c_ctx)) != SQLITE_OK)\n      return rc; \n\n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_ctx_get_kdf_iter(codec_ctx *ctx, int for_ctx) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  return c_ctx->kdf_iter;\n}\n\nint sqlcipher_codec_ctx_set_fast_kdf_iter(codec_ctx *ctx, int fast_kdf_iter, int for_ctx) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  int rc;\n\n  c_ctx->fast_kdf_iter = fast_kdf_iter;\n  c_ctx->derive_key = 1;\n\n  if(for_ctx == 2)\n    if((rc = sqlcipher_cipher_ctx_copy( for_ctx ? ctx->read_ctx : ctx->write_ctx, c_ctx)) != SQLITE_OK)\n      return rc; \n\n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_ctx_get_fast_kdf_iter(codec_ctx *ctx, int for_ctx) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  return c_ctx->fast_kdf_iter;\n}\n\n/* set the global default flag for HMAC */\nvoid sqlcipher_set_default_use_hmac(int use) {\n  if(use) default_flags |= CIPHER_FLAG_HMAC; \n  else default_flags &= ~CIPHER_FLAG_HMAC; \n}\n\nint sqlcipher_get_default_use_hmac() {\n  return (default_flags & CIPHER_FLAG_HMAC) != 0;\n}\n\nvoid sqlcipher_set_hmac_salt_mask(unsigned char mask) {\n  hmac_salt_mask = mask;\n}\n\nunsigned char sqlcipher_get_hmac_salt_mask() {\n  return hmac_salt_mask;\n}\n\n/* set the codec flag for whether this individual database should be using hmac */\nint sqlcipher_codec_ctx_set_use_hmac(codec_ctx *ctx, int use) {\n  int reserve = CIPHER_MAX_IV_SZ; /* base reserve size will be IV only */ \n\n  if(use) reserve += ctx->read_ctx->hmac_sz; /* if reserve will include hmac, update that size */\n\n  /* calculate the amount of reserve needed in even increments of the cipher block size */\n\n  reserve = ((reserve % ctx->read_ctx->block_sz) == 0) ? reserve :\n               ((reserve / ctx->read_ctx->block_sz) + 1) * ctx->read_ctx->block_sz;  \n\n  CODEC_TRACE((\"sqlcipher_codec_ctx_set_use_hmac: use=%d block_sz=%d md_size=%d reserve=%d\\n\", \n                use, ctx->read_ctx->block_sz, ctx->read_ctx->hmac_sz, reserve)); \n\n  \n  if(use) {\n    sqlcipher_codec_ctx_set_flag(ctx, CIPHER_FLAG_HMAC);\n  } else {\n    sqlcipher_codec_ctx_unset_flag(ctx, CIPHER_FLAG_HMAC);\n  } \n  \n  ctx->write_ctx->reserve_sz = ctx->read_ctx->reserve_sz = reserve;\n\n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_ctx_get_use_hmac(codec_ctx *ctx, int for_ctx) {\n  cipher_ctx * c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  return (c_ctx->flags & CIPHER_FLAG_HMAC) != 0;\n}\n\nint sqlcipher_codec_ctx_set_flag(codec_ctx *ctx, unsigned int flag) {\n  ctx->write_ctx->flags |= flag;\n  ctx->read_ctx->flags |= flag;\n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_ctx_unset_flag(codec_ctx *ctx, unsigned int flag) {\n  ctx->write_ctx->flags &= ~flag;\n  ctx->read_ctx->flags &= ~flag;\n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_ctx_get_flag(codec_ctx *ctx, unsigned int flag, int for_ctx) {\n  cipher_ctx * c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  return (c_ctx->flags & flag) != 0;\n}\n\nvoid sqlcipher_codec_ctx_set_error(codec_ctx *ctx, int error) {\n  CODEC_TRACE((\"sqlcipher_codec_ctx_set_error: ctx=%p, error=%d\\n\", ctx, error));\n  sqlite3pager_sqlite3PagerSetError(ctx->pBt->pBt->pPager, error);\n  ctx->pBt->pBt->db->errCode = error;\n}\n\nint sqlcipher_codec_ctx_get_reservesize(codec_ctx *ctx) {\n  return ctx->read_ctx->reserve_sz;\n}\n\nvoid* sqlcipher_codec_ctx_get_data(codec_ctx *ctx) {\n  return ctx->buffer;\n}\n\nvoid* sqlcipher_codec_ctx_get_kdf_salt(codec_ctx *ctx) {\n  return ctx->kdf_salt;\n}\n\nvoid sqlcipher_codec_get_keyspec(codec_ctx *ctx, void **zKey, int *nKey) {\n  *zKey = ctx->read_ctx->keyspec;\n  *nKey = ctx->read_ctx->keyspec_sz;\n}\n\nint sqlcipher_codec_ctx_set_pagesize(codec_ctx *ctx, int size) {\n  /* attempt to free the existing page buffer */\n  sqlcipher_free(ctx->buffer,ctx->page_sz);\n  ctx->page_sz = size;\n\n  /* pre-allocate a page buffer of PageSize bytes. This will\n     be used as a persistent buffer for encryption and decryption \n     operations to avoid overhead of multiple memory allocations*/\n  ctx->buffer = sqlcipher_malloc(size);\n  if(ctx->buffer == NULL) return SQLITE_NOMEM;\n\n  return SQLITE_OK;\n}\n\nint sqlcipher_codec_ctx_get_pagesize(codec_ctx *ctx) {\n  return ctx->page_sz;\n}\n\nvoid sqlcipher_set_default_pagesize(int page_size) {\n  default_page_size = page_size;\n}\n\nint sqlcipher_get_default_pagesize() {\n  return default_page_size;\n}\n\nint sqlcipher_codec_ctx_init(codec_ctx **iCtx, Db *pDb, Pager *pPager, sqlite3_file *fd, const void *zKey, int nKey) {\n  int rc;\n  codec_ctx *ctx;\n  *iCtx = sqlcipher_malloc(sizeof(codec_ctx));\n  ctx = *iCtx;\n\n  if(ctx == NULL) return SQLITE_NOMEM;\n\n  ctx->pBt = pDb->pBt; /* assign pointer to database btree structure */\n\n  /* allocate space for salt data. Then read the first 16 bytes \n       directly off the database file. This is the salt for the\n       key derivation function. If we get a short read allocate\n       a new random salt value */\n  ctx->kdf_salt_sz = FILE_HEADER_SZ;\n  ctx->kdf_salt = sqlcipher_malloc(ctx->kdf_salt_sz);\n  if(ctx->kdf_salt == NULL) return SQLITE_NOMEM;\n\n  /* allocate space for separate hmac salt data. We want the\n     HMAC derivation salt to be different than the encryption\n     key derivation salt */\n  ctx->hmac_kdf_salt = sqlcipher_malloc(ctx->kdf_salt_sz);\n  if(ctx->hmac_kdf_salt == NULL) return SQLITE_NOMEM;\n\n\n  /*\n     Always overwrite page size and set to the default because the first page of the database\n     in encrypted and thus sqlite can't effectively determine the pagesize. this causes an issue in \n     cases where bytes 16 & 17 of the page header are a power of 2 as reported by John Lehman\n  */\n  if((rc = sqlcipher_codec_ctx_set_pagesize(ctx, default_page_size)) != SQLITE_OK) return rc;\n\n  if((rc = sqlcipher_cipher_ctx_init(&ctx->read_ctx)) != SQLITE_OK) return rc; \n  if((rc = sqlcipher_cipher_ctx_init(&ctx->write_ctx)) != SQLITE_OK) return rc; \n\n  if(fd == NULL || sqlite3OsRead(fd, ctx->kdf_salt, FILE_HEADER_SZ, 0) != SQLITE_OK) {\n    ctx->need_kdf_salt = 1;\n  }\n\n  if((rc = sqlcipher_codec_ctx_set_cipher(ctx, CIPHER, 0)) != SQLITE_OK) return rc;\n  if((rc = sqlcipher_codec_ctx_set_kdf_iter(ctx, default_kdf_iter, 0)) != SQLITE_OK) return rc;\n  if((rc = sqlcipher_codec_ctx_set_fast_kdf_iter(ctx, FAST_PBKDF2_ITER, 0)) != SQLITE_OK) return rc;\n  if((rc = sqlcipher_codec_ctx_set_pass(ctx, zKey, nKey, 0)) != SQLITE_OK) return rc;\n\n  /* Note that use_hmac is a special case that requires recalculation of page size\n     so we call set_use_hmac to perform setup */\n  if((rc = sqlcipher_codec_ctx_set_use_hmac(ctx, default_flags & CIPHER_FLAG_HMAC)) != SQLITE_OK) return rc;\n\n  if((rc = sqlcipher_cipher_ctx_copy(ctx->write_ctx, ctx->read_ctx)) != SQLITE_OK) return rc;\n\n  return SQLITE_OK;\n}\n\n/**\n  * Free and wipe memory associated with a cipher_ctx, including the allocated\n  * read_ctx and write_ctx.\n  */\nvoid sqlcipher_codec_ctx_free(codec_ctx **iCtx) {\n  codec_ctx *ctx = *iCtx;\n  CODEC_TRACE((\"codec_ctx_free: entered iCtx=%p\\n\", iCtx));\n  sqlcipher_free(ctx->kdf_salt, ctx->kdf_salt_sz);\n  sqlcipher_free(ctx->hmac_kdf_salt, ctx->kdf_salt_sz);\n  sqlcipher_free(ctx->buffer, 0);\n  sqlcipher_cipher_ctx_free(&ctx->read_ctx);\n  sqlcipher_cipher_ctx_free(&ctx->write_ctx);\n  sqlcipher_free(ctx, sizeof(codec_ctx)); \n}\n\n/** convert a 32bit unsigned integer to little endian byte ordering */\nstatic void sqlcipher_put4byte_le(unsigned char *p, u32 v) { \n  p[0] = (u8)v;\n  p[1] = (u8)(v>>8);\n  p[2] = (u8)(v>>16);\n  p[3] = (u8)(v>>24);\n}\n\nstatic int sqlcipher_page_hmac(cipher_ctx *ctx, Pgno pgno, unsigned char *in, int in_sz, unsigned char *out) {\n  unsigned char pgno_raw[sizeof(pgno)];\n  /* we may convert page number to consistent representation before calculating MAC for\n     compatibility across big-endian and little-endian platforms. \n\n     Note: The public release of sqlcipher 2.0.0 to 2.0.6 had a bug where the bytes of pgno \n     were used directly in the MAC. SQLCipher convert's to little endian by default to preserve\n     backwards compatibility on the most popular platforms, but can optionally be configured\n     to use either big endian or native byte ordering via pragma. */\n\n  if(ctx->flags & CIPHER_FLAG_LE_PGNO) { /* compute hmac using little endian pgno*/\n    sqlcipher_put4byte_le(pgno_raw, pgno);\n  } else if(ctx->flags & CIPHER_FLAG_BE_PGNO) { /* compute hmac using big endian pgno */\n    sqlite3Put4byte(pgno_raw, pgno); /* sqlite3Put4byte converts 32bit uint to big endian  */\n  } else { /* use native byte ordering */\n    memcpy(pgno_raw, &pgno, sizeof(pgno));\n  }\n\n  /* include the encrypted page data,  initialization vector, and page number in HMAC. This will \n     prevent both tampering with the ciphertext, manipulation of the IV, or resequencing otherwise\n     valid pages out of order in a database */ \n  ctx->provider->hmac(\n    ctx->provider_ctx, ctx->hmac_key,\n    ctx->key_sz, in,\n    in_sz, (unsigned char*) &pgno_raw,\n    sizeof(pgno), out);\n  return SQLITE_OK; \n}\n\n/*\n * ctx - codec context\n * pgno - page number in database\n * size - size in bytes of input and output buffers\n * mode - 1 to encrypt, 0 to decrypt\n * in - pointer to input bytes\n * out - pouter to output bytes\n */\nint sqlcipher_page_cipher(codec_ctx *ctx, int for_ctx, Pgno pgno, int mode, int page_sz, unsigned char *in, unsigned char *out) {\n  cipher_ctx *c_ctx = for_ctx ? ctx->write_ctx : ctx->read_ctx;\n  unsigned char *iv_in, *iv_out, *hmac_in, *hmac_out, *out_start;\n  int size;\n\n  /* calculate some required positions into various buffers */\n  size = page_sz - c_ctx->reserve_sz; /* adjust size to useable size and memset reserve at end of page */\n  iv_out = out + size;\n  iv_in = in + size;\n\n  /* hmac will be written immediately after the initialization vector. the remainder of the page reserve will contain\n     random bytes. note, these pointers are only valid when using hmac */\n  hmac_in = in + size + c_ctx->iv_sz; \n  hmac_out = out + size + c_ctx->iv_sz;\n  out_start = out; /* note the original position of the output buffer pointer, as out will be rewritten during encryption */\n\n  CODEC_TRACE((\"codec_cipher:entered pgno=%d, mode=%d, size=%d\\n\", pgno, mode, size));\n  CODEC_HEXDUMP(\"codec_cipher: input page data\", in, page_sz);\n\n  /* the key size should never be zero. If it is, error out. */\n  if(c_ctx->key_sz == 0) {\n    CODEC_TRACE((\"codec_cipher: error possible context corruption, key_sz is zero for pgno=%d\\n\", pgno));\n    sqlcipher_memset(out, 0, page_sz); \n    return SQLITE_ERROR;\n  } \n\n  if(mode == CIPHER_ENCRYPT) {\n    /* start at front of the reserve block, write random data to the end */\n    if(c_ctx->provider->random(c_ctx->provider_ctx, iv_out, c_ctx->reserve_sz) != SQLITE_OK) return SQLITE_ERROR; \n  } else { /* CIPHER_DECRYPT */\n    memcpy(iv_out, iv_in, c_ctx->iv_sz); /* copy the iv from the input to output buffer */\n  } \n\n  if((c_ctx->flags & CIPHER_FLAG_HMAC) && (mode == CIPHER_DECRYPT) && !ctx->skip_read_hmac) {\n    if(sqlcipher_page_hmac(c_ctx, pgno, in, size + c_ctx->iv_sz, hmac_out) != SQLITE_OK) {\n      sqlcipher_memset(out, 0, page_sz); \n      CODEC_TRACE((\"codec_cipher: hmac operations failed for pgno=%d\\n\", pgno));\n      return SQLITE_ERROR;\n    }\n\n    CODEC_TRACE((\"codec_cipher: comparing hmac on in=%p out=%p hmac_sz=%d\\n\", hmac_in, hmac_out, c_ctx->hmac_sz));\n    if(sqlcipher_memcmp(hmac_in, hmac_out, c_ctx->hmac_sz) != 0) { /* the hmac check failed */ \n      if(sqlcipher_ismemset(in, 0, page_sz) == 0) {\n        /* first check if the entire contents of the page is zeros. If so, this page \n           resulted from a short read (i.e. sqlite attempted to pull a page after the end of the file. these \n           short read failures must be ignored for autovaccum mode to work so wipe the output buffer \n           and return SQLITE_OK to skip the decryption step. */\n        CODEC_TRACE((\"codec_cipher: zeroed page (short read) for pgno %d, encryption but returning SQLITE_OK\\n\", pgno));\n        sqlcipher_memset(out, 0, page_sz); \n  \treturn SQLITE_OK;\n      } else {\n\t/* if the page memory is not all zeros, it means the there was data and a hmac on the page. \n           since the check failed, the page was either tampered with or corrupted. wipe the output buffer,\n           and return SQLITE_ERROR to the caller */\n      \tCODEC_TRACE((\"codec_cipher: hmac check failed for pgno=%d returning SQLITE_ERROR\\n\", pgno));\n        sqlcipher_memset(out, 0, page_sz); \n      \treturn SQLITE_ERROR;\n      }\n    }\n  } \n  \n  c_ctx->provider->cipher(c_ctx->provider_ctx, mode, c_ctx->key, c_ctx->key_sz, iv_out, in, size, out);\n\n  if((c_ctx->flags & CIPHER_FLAG_HMAC) && (mode == CIPHER_ENCRYPT)) {\n    sqlcipher_page_hmac(c_ctx, pgno, out_start, size + c_ctx->iv_sz, hmac_out); \n  }\n\n  CODEC_HEXDUMP(\"codec_cipher: output page data\", out_start, page_sz);\n\n  return SQLITE_OK;\n}\n\n/**\n  * Derive an encryption key for a cipher contex key based on the raw password.\n  *\n  * If the raw key data is formated as x'hex' and there are exactly enough hex chars to fill\n  * the key (i.e 64 hex chars for a 256 bit key) then the key data will be used directly. \n\n  * Else, if the raw key data is formated as x'hex' and there are exactly enough hex chars to fill\n  * the key and the salt (i.e 92 hex chars for a 256 bit key and 16 byte salt) then it will be unpacked\n  * as the key followed by the salt.\n  * \n  * Otherwise, a key data will be derived using PBKDF2\n  * \n  * returns SQLITE_OK if initialization was successful\n  * returns SQLITE_ERROR if the key could't be derived (for instance if pass is NULL or pass_sz is 0)\n  */\nstatic int sqlcipher_cipher_ctx_key_derive(codec_ctx *ctx, cipher_ctx *c_ctx) {\n  int rc;\n  CODEC_TRACE((\"cipher_ctx_key_derive: entered c_ctx->pass=%s, c_ctx->pass_sz=%d \\\n                ctx->kdf_salt=%p ctx->kdf_salt_sz=%d c_ctx->kdf_iter=%d \\\n                ctx->hmac_kdf_salt=%p, c_ctx->fast_kdf_iter=%d c_ctx->key_sz=%d\\n\", \n                c_ctx->pass, c_ctx->pass_sz, ctx->kdf_salt, ctx->kdf_salt_sz, c_ctx->kdf_iter, \n                ctx->hmac_kdf_salt, c_ctx->fast_kdf_iter, c_ctx->key_sz)); \n                \n  \n  if(c_ctx->pass && c_ctx->pass_sz) { // if pass is not null\n\n    if (ctx->need_kdf_salt) {\n      /* Try reading KDF salt from file header again before generating new salt. \n         The salt may have been initialized by another connection already. */\n      sqlite3_file *fd = sqlite3PagerFile(ctx->pBt->pBt->pPager);\n\n      if (sqlite3OsRead(fd, ctx->kdf_salt, FILE_HEADER_SZ, 0) != SQLITE_OK &&\n        ctx->read_ctx->provider->random(ctx->read_ctx->provider_ctx, ctx->kdf_salt, FILE_HEADER_SZ) != SQLITE_OK) \n          return SQLITE_ERROR;\n      ctx->need_kdf_salt = 0;\n    }\n    if (c_ctx->pass_sz == ((c_ctx->key_sz * 2) + 3) && sqlite3StrNICmp((const char *)c_ctx->pass ,\"x'\", 2) == 0 && cipher_isHex(c_ctx->pass + 2, c_ctx->key_sz * 2)) { \n      int n = c_ctx->pass_sz - 3; /* adjust for leading x' and tailing ' */\n      const unsigned char *z = c_ctx->pass + 2; /* adjust lead offset of x' */\n      CODEC_TRACE((\"cipher_ctx_key_derive: using raw key from hex\\n\")); \n      cipher_hex2bin(z, n, c_ctx->key);\n    } else if (c_ctx->pass_sz == (((c_ctx->key_sz + ctx->kdf_salt_sz) * 2) + 3) && sqlite3StrNICmp((const char *)c_ctx->pass ,\"x'\", 2) == 0 && cipher_isHex(c_ctx->pass + 2, (c_ctx->key_sz + ctx->kdf_salt_sz) * 2)) { \n      const unsigned char *z = c_ctx->pass + 2; /* adjust lead offset of x' */\n      CODEC_TRACE((\"cipher_ctx_key_derive: using raw key from hex\\n\")); \n      cipher_hex2bin(z, (c_ctx->key_sz * 2), c_ctx->key);\n      cipher_hex2bin(z + (c_ctx->key_sz * 2), (ctx->kdf_salt_sz * 2), ctx->kdf_salt);\n    } else { \n      CODEC_TRACE((\"cipher_ctx_key_derive: deriving key using full PBKDF2 with %d iterations\\n\", c_ctx->kdf_iter)); \n      c_ctx->provider->kdf(c_ctx->provider_ctx, c_ctx->pass, c_ctx->pass_sz, \n                    ctx->kdf_salt, ctx->kdf_salt_sz, c_ctx->kdf_iter,\n                    c_ctx->key_sz, c_ctx->key);\n    }\n\n    /* set the context \"keyspec\" containing the hex-formatted key and salt to be used when attaching databases */\n    if((rc = sqlcipher_cipher_ctx_set_keyspec(c_ctx, c_ctx->key, c_ctx->key_sz, ctx->kdf_salt, ctx->kdf_salt_sz)) != SQLITE_OK) return rc;\n\n    /* if this context is setup to use hmac checks, generate a seperate and different \n       key for HMAC. In this case, we use the output of the previous KDF as the input to \n       this KDF run. This ensures a distinct but predictable HMAC key. */\n    if(c_ctx->flags & CIPHER_FLAG_HMAC) {\n      int i;\n\n      /* start by copying the kdf key into the hmac salt slot\n         then XOR it with the fixed hmac salt defined at compile time\n         this ensures that the salt passed in to derive the hmac key, while \n         easy to derive and publically known, is not the same as the salt used \n         to generate the encryption key */ \n      memcpy(ctx->hmac_kdf_salt, ctx->kdf_salt, ctx->kdf_salt_sz);\n      for(i = 0; i < ctx->kdf_salt_sz; i++) {\n        ctx->hmac_kdf_salt[i] ^= hmac_salt_mask;\n      } \n\n      CODEC_TRACE((\"cipher_ctx_key_derive: deriving hmac key from encryption key using PBKDF2 with %d iterations\\n\", \n        c_ctx->fast_kdf_iter)); \n\n      \n      c_ctx->provider->kdf(c_ctx->provider_ctx, c_ctx->key, c_ctx->key_sz, \n                    ctx->hmac_kdf_salt, ctx->kdf_salt_sz, c_ctx->fast_kdf_iter,\n                    c_ctx->key_sz, c_ctx->hmac_key); \n    }\n\n    c_ctx->derive_key = 0;\n    return SQLITE_OK;\n  };\n  return SQLITE_ERROR;\n}\n\nint sqlcipher_codec_key_derive(codec_ctx *ctx) {\n  /* derive key on first use if necessary */\n  if(ctx->read_ctx->derive_key) {\n    if(sqlcipher_cipher_ctx_key_derive(ctx, ctx->read_ctx) != SQLITE_OK) return SQLITE_ERROR;\n  }\n\n  if(ctx->write_ctx->derive_key) {\n    if(sqlcipher_cipher_ctx_cmp(ctx->write_ctx, ctx->read_ctx) == 0) {\n      /* the relevant parameters are the same, just copy read key */\n      if(sqlcipher_cipher_ctx_copy(ctx->write_ctx, ctx->read_ctx) != SQLITE_OK) return SQLITE_ERROR;\n    } else {\n      if(sqlcipher_cipher_ctx_key_derive(ctx, ctx->write_ctx) != SQLITE_OK) return SQLITE_ERROR;\n    }\n  }\n\n  /* TODO: wipe and free passphrase after key derivation */\n  if(ctx->read_ctx->store_pass  != 1) {\n    sqlcipher_cipher_ctx_set_pass(ctx->read_ctx, NULL, 0);\n    sqlcipher_cipher_ctx_set_pass(ctx->write_ctx, NULL, 0);\n  }\n\n  return SQLITE_OK; \n}\n\nint sqlcipher_codec_key_copy(codec_ctx *ctx, int source) {\n  if(source == CIPHER_READ_CTX) { \n      return sqlcipher_cipher_ctx_copy(ctx->write_ctx, ctx->read_ctx); \n  } else {\n      return sqlcipher_cipher_ctx_copy(ctx->read_ctx, ctx->write_ctx); \n  }\n}\n\nconst char* sqlcipher_codec_get_cipher_provider(codec_ctx *ctx) {\n  return ctx->read_ctx->provider->get_provider_name(ctx->read_ctx);\n}\n\n\nstatic int sqlcipher_check_connection(const char *filename, char *key, int key_sz, char *sql, int *user_version) {\n  int rc;\n  sqlite3 *db = NULL;\n  sqlite3_stmt *statement = NULL;\n  char *query_user_version = \"PRAGMA user_version;\";\n  \n  rc = sqlite3_open(filename, &db);\n  if(rc != SQLITE_OK){\n    goto cleanup;\n  }\n  rc = sqlite3_key(db, key, key_sz);\n  if(rc != SQLITE_OK){\n    goto cleanup;\n  }\n  rc = sqlite3_exec(db, sql, NULL, NULL, NULL);\n  if(rc != SQLITE_OK){\n    goto cleanup;\n  }\n  rc = sqlite3_prepare(db, query_user_version, -1, &statement, NULL);\n  if(rc != SQLITE_OK){\n    goto cleanup;\n  }\n  rc = sqlite3_step(statement);\n  if(rc == SQLITE_ROW){\n    *user_version = sqlite3_column_int(statement, 0);\n    rc = SQLITE_OK;\n  }\n  \ncleanup:\n  if(statement){\n    sqlite3_finalize(statement);\n  }\n  if(db){\n    sqlite3_close(db);\n  }\n  return rc;\n}\n\nint sqlcipher_codec_ctx_migrate(codec_ctx *ctx) {\n  u32 meta;\n  int rc = 0;\n  int command_idx = 0;\n  int password_sz;\n  int saved_flags;\n  int saved_nChange;\n  int saved_nTotalChange;\n  int (*saved_xTrace)(u32,void*,void*,void*); /* Saved db->xTrace */\n  Db *pDb = 0;\n  sqlite3 *db = ctx->pBt->db;\n  const char *db_filename = sqlite3_db_filename(db, \"main\");\n  char *migrated_db_filename = sqlite3_mprintf(\"%s-migrated\", db_filename);\n  char *pragma_hmac_off = \"PRAGMA cipher_use_hmac = OFF;\";\n  char *pragma_4k_kdf_iter = \"PRAGMA kdf_iter = 4000;\";\n  char *pragma_1x_and_4k;\n  char *set_user_version;\n  char *key;\n  int key_sz;\n  int user_version = 0;\n  int upgrade_1x_format = 0;\n  int upgrade_4k_format = 0;\n  static const unsigned char aCopy[] = {\n    BTREE_SCHEMA_VERSION,     1,  /* Add one to the old schema cookie */\n    BTREE_DEFAULT_CACHE_SIZE, 0,  /* Preserve the default page cache size */\n    BTREE_TEXT_ENCODING,      0,  /* Preserve the text encoding */\n    BTREE_USER_VERSION,       0,  /* Preserve the user version */\n    BTREE_APPLICATION_ID,     0,  /* Preserve the application id */\n  };\n\n\n  key_sz = ctx->read_ctx->pass_sz + 1;\n  key = sqlcipher_malloc(key_sz);\n  memset(key, 0, key_sz);\n  memcpy(key, ctx->read_ctx->pass, ctx->read_ctx->pass_sz);\n\n  if(db_filename){\n    const char* commands[5];\n    char *attach_command = sqlite3_mprintf(\"ATTACH DATABASE '%s-migrated' as migrate KEY '%q';\",\n                                            db_filename, key);\n\n    int rc = sqlcipher_check_connection(db_filename, key, ctx->read_ctx->pass_sz, \"\", &user_version);\n    if(rc == SQLITE_OK){\n      CODEC_TRACE((\"No upgrade required - exiting\\n\"));\n      goto exit;\n    }\n    \n    // Version 2 - check for 4k with hmac format \n    rc = sqlcipher_check_connection(db_filename, key, ctx->read_ctx->pass_sz, pragma_4k_kdf_iter, &user_version);\n    if(rc == SQLITE_OK) {\n      CODEC_TRACE((\"Version 2 format found\\n\"));\n      upgrade_4k_format = 1;\n    }\n\n    // Version 1 - check both no hmac and 4k together\n    pragma_1x_and_4k = sqlite3_mprintf(\"%s%s\", pragma_hmac_off,\n                                             pragma_4k_kdf_iter);\n    rc = sqlcipher_check_connection(db_filename, key, ctx->read_ctx->pass_sz, pragma_1x_and_4k, &user_version);\n    sqlite3_free(pragma_1x_and_4k);\n    if(rc == SQLITE_OK) {\n      CODEC_TRACE((\"Version 1 format found\\n\"));\n      upgrade_1x_format = 1;\n      upgrade_4k_format = 1;\n    }\n\n    if(upgrade_1x_format == 0 && upgrade_4k_format == 0) {\n      CODEC_TRACE((\"Upgrade format not determined\\n\"));\n      goto handle_error;\n    }\n\n    set_user_version = sqlite3_mprintf(\"PRAGMA migrate.user_version = %d;\", user_version);\n    commands[0] = upgrade_4k_format == 1 ? pragma_4k_kdf_iter : \"\";\n    commands[1] = upgrade_1x_format == 1 ? pragma_hmac_off : \"\";\n    commands[2] = attach_command;\n    commands[3] = \"SELECT sqlcipher_export('migrate');\";\n    commands[4] = set_user_version;\n      \n    for(command_idx = 0; command_idx < ArraySize(commands); command_idx++){\n      const char *command = commands[command_idx];\n      if(strcmp(command, \"\") == 0){\n        continue;\n      }\n      rc = sqlite3_exec(db, command, NULL, NULL, NULL);\n      if(rc != SQLITE_OK){\n        break;\n      }\n    }\n    sqlite3_free(attach_command);\n    sqlite3_free(set_user_version);\n    sqlcipher_free(key, key_sz);\n    \n    if(rc == SQLITE_OK){\n      Btree *pDest;\n      Btree *pSrc;\n      int i = 0;\n\n      if( !db->autoCommit ){\n        CODEC_TRACE((\"cannot migrate from within a transaction\"));\n        goto handle_error;\n      }\n      if( db->nVdbeActive>1 ){\n        CODEC_TRACE((\"cannot migrate - SQL statements in progress\"));\n        goto handle_error;\n      }\n\n      /* Save the current value of the database flags so that it can be\n      ** restored before returning. Then set the writable-schema flag, and\n      ** disable CHECK and foreign key constraints.  */\n      saved_flags = db->flags;\n      saved_nChange = db->nChange;\n      saved_nTotalChange = db->nTotalChange;\n      saved_xTrace = db->xTrace;\n      db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks | SQLITE_PreferBuiltin;\n      db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder);\n      db->xTrace = 0;\n      \n      pDest = db->aDb[0].pBt;\n      pDb = &(db->aDb[db->nDb-1]);\n      pSrc = pDb->pBt;\n      \n      rc = sqlite3_exec(db, \"BEGIN;\", NULL, NULL, NULL);\n      rc = sqlite3BtreeBeginTrans(pSrc, 2);\n      rc = sqlite3BtreeBeginTrans(pDest, 2);\n      \n      assert( 1==sqlite3BtreeIsInTrans(pDest) );\n      assert( 1==sqlite3BtreeIsInTrans(pSrc) );\n#if defined (SQLCIPHER_PREPROCESSED)\n        extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);\n        extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);\n#endif /* SQLCIPHER_PREPROCESSED */\n      sqlite3CodecGetKey(db, db->nDb - 1, (void**)&key, &password_sz);\n      sqlite3CodecAttach(db, 0, key, password_sz);\n      sqlite3pager_get_codec(pDest->pBt->pPager, (void**)&ctx);\n      \n      ctx->skip_read_hmac = 1;      \n      for(i=0; i<ArraySize(aCopy); i+=2){\n        sqlite3BtreeGetMeta(pSrc, aCopy[i], &meta);\n        rc = sqlite3BtreeUpdateMeta(pDest, aCopy[i], meta+aCopy[i+1]);\n        if( NEVER(rc!=SQLITE_OK) ) goto handle_error; \n      }\n      rc = sqlite3BtreeCopyFile(pDest, pSrc);\n      ctx->skip_read_hmac = 0;\n      if( rc!=SQLITE_OK ) goto handle_error;\n      rc = sqlite3BtreeCommit(pDest);\n\n      db->flags = saved_flags;\n      db->nChange = saved_nChange;\n      db->nTotalChange = saved_nTotalChange;\n      db->xTrace = saved_xTrace;\n      db->autoCommit = 1;\n      sqlite3BtreeClose(pDb->pBt);\n      pDb->pBt = 0;\n      pDb->pSchema = 0;\n      sqlite3ResetAllSchemasOfConnection(db);\n      remove(migrated_db_filename);\n      sqlite3_free(migrated_db_filename);\n    } else {\n      CODEC_TRACE((\"*** migration failure** \\n\\n\"));\n    }\n    \n  }\n  goto exit;\n\n handle_error:\n  CODEC_TRACE((\"An error occurred attempting to migrate the database\\n\"));\n  rc = SQLITE_ERROR;\n\n exit:\n  return rc;\n}\n\nint sqlcipher_codec_add_random(codec_ctx *ctx, const char *zRight, int random_sz){\n  const char *suffix = &zRight[random_sz-1];\n  int n = random_sz - 3; /* adjust for leading x' and tailing ' */\n  if (n > 0 &&\n      sqlite3StrNICmp((const char *)zRight ,\"x'\", 2) == 0 &&\n      sqlite3StrNICmp(suffix, \"'\", 1) == 0 &&\n      n % 2 == 0) {\n    int rc = 0;\n    int buffer_sz = n / 2;\n    unsigned char *random;\n    const unsigned char *z = (const unsigned char *)zRight + 2; /* adjust lead offset of x' */\n    CODEC_TRACE((\"sqlcipher_codec_add_random: using raw random blob from hex\\n\"));\n    random = sqlcipher_malloc(buffer_sz);\n    memset(random, 0, buffer_sz);\n    cipher_hex2bin(z, n, random);\n    rc = ctx->read_ctx->provider->add_random(ctx->read_ctx->provider_ctx, random, buffer_sz);\n    sqlcipher_free(random, buffer_sz);\n    return rc;\n  }\n  return SQLITE_ERROR;\n}\n\nint sqlcipher_codec_fips_status(codec_ctx *ctx) {\n  return ctx->read_ctx->provider->fips_status(ctx->read_ctx);\n}\n\nconst char* sqlcipher_codec_get_provider_version(codec_ctx *ctx) {\n  return ctx->read_ctx->provider->get_provider_version(ctx->read_ctx);\n}\n\n#endif\n/* END SQLCIPHER */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/crypto_libtomcrypt.c",
    "content": "/*\n** SQLCipher\n** http://sqlcipher.net\n**\n** Copyright (c) 2008 - 2013, ZETETIC LLC\n** All rights reserved.\n**\n** Redistribution and use in source and binary forms, with or without\n** modification, are permitted provided that the following conditions are met:\n**     * Redistributions of source code must retain the above copyright\n**       notice, this list of conditions and the following disclaimer.\n**     * Redistributions in binary form must reproduce the above copyright\n**       notice, this list of conditions and the following disclaimer in the\n**       documentation and/or other materials provided with the distribution.\n**     * Neither the name of the ZETETIC LLC nor the\n**       names of its contributors may be used to endorse or promote products\n**       derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\n** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n** DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\n** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n**\n*/\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n#ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPT\n#include \"sqliteInt.h\"\n#include \"sqlcipher.h\"\n#include <tomcrypt.h>\n\n#define FORTUNA_MAX_SZ 32\nstatic prng_state prng;\nstatic unsigned int ltc_init = 0;\nstatic unsigned int ltc_ref_count = 0;\nstatic sqlite3_mutex* ltc_rand_mutex = NULL;\n\nstatic int sqlcipher_ltc_add_random(void *ctx, void *buffer, int length) {\n  int rc = 0;\n  int data_to_read = length;\n  int block_sz = data_to_read < FORTUNA_MAX_SZ ? data_to_read : FORTUNA_MAX_SZ;\n  const unsigned char * data = (const unsigned char *)buffer;\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  sqlite3_mutex_enter(ltc_rand_mutex);\n#endif\n    while(data_to_read > 0){\n      rc = fortuna_add_entropy(data, block_sz, &prng);\n      rc = rc != CRYPT_OK ? SQLITE_ERROR : SQLITE_OK;\n      if(rc != SQLITE_OK){\n        break;\n      }\n      data_to_read -= block_sz;\n      data += block_sz;\n      block_sz = data_to_read < FORTUNA_MAX_SZ ? data_to_read : FORTUNA_MAX_SZ;\n    }\n    fortuna_ready(&prng);\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  sqlite3_mutex_leave(ltc_rand_mutex);\n#endif\n  return rc;\n}\n\nstatic int sqlcipher_ltc_activate(void *ctx) {\n  unsigned char random_buffer[FORTUNA_MAX_SZ];\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  if(ltc_rand_mutex == NULL){\n    ltc_rand_mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);\n  }\n  sqlite3_mutex_enter(ltc_rand_mutex);\n#endif\n  sqlcipher_memset(random_buffer, 0, FORTUNA_MAX_SZ);\n  if(ltc_init == 0) {\n    if(register_prng(&fortuna_desc) != CRYPT_OK) return SQLITE_ERROR;\n    if(register_cipher(&rijndael_desc) != CRYPT_OK) return SQLITE_ERROR;\n    if(register_hash(&sha1_desc) != CRYPT_OK) return SQLITE_ERROR;\n    if(fortuna_start(&prng) != CRYPT_OK) {\n      return SQLITE_ERROR;\n    }\n    ltc_init = 1;\n  }\n  ltc_ref_count++;\n#ifndef SQLCIPHER_TEST\n  sqlite3_randomness(FORTUNA_MAX_SZ, random_buffer);\n#endif\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  sqlite3_mutex_leave(ltc_rand_mutex);\n#endif\n  if(sqlcipher_ltc_add_random(ctx, random_buffer, FORTUNA_MAX_SZ) != SQLITE_OK) {\n    return SQLITE_ERROR;\n  }\n  sqlcipher_memset(random_buffer, 0, FORTUNA_MAX_SZ);\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_deactivate(void *ctx) {\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  sqlite3_mutex_enter(ltc_rand_mutex);\n#endif\n  ltc_ref_count--;\n  if(ltc_ref_count == 0){\n    fortuna_done(&prng);\n    sqlcipher_memset((void *)&prng, 0, sizeof(prng));\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n    sqlite3_mutex_leave(ltc_rand_mutex);\n    sqlite3_mutex_free(ltc_rand_mutex);\n    ltc_rand_mutex = NULL;\n#endif\n  }\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  else {\n    sqlite3_mutex_leave(ltc_rand_mutex);\n  }\n#endif    \n  return SQLITE_OK;\n}\n\nstatic const char* sqlcipher_ltc_get_provider_name(void *ctx) {\n  return \"libtomcrypt\";\n}\n\nstatic const char* sqlcipher_ltc_get_provider_version(void *ctx) {\n  return SCRYPT;\n}\n\nstatic int sqlcipher_ltc_random(void *ctx, void *buffer, int length) {\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  sqlite3_mutex_enter(ltc_rand_mutex);\n#endif\n  fortuna_read(buffer, length, &prng);\n#ifndef SQLCIPHER_LTC_NO_MUTEX_RAND\n  sqlite3_mutex_leave(ltc_rand_mutex);\n#endif\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_hmac(void *ctx, unsigned char *hmac_key, int key_sz, unsigned char *in, int in_sz, unsigned char *in2, int in2_sz, unsigned char *out) {\n  int rc, hash_idx;\n  hmac_state hmac;\n  unsigned long outlen = key_sz;\n\n  hash_idx = find_hash(\"sha1\");\n  if((rc = hmac_init(&hmac, hash_idx, hmac_key, key_sz)) != CRYPT_OK) return SQLITE_ERROR;\n  if((rc = hmac_process(&hmac, in, in_sz)) != CRYPT_OK) return SQLITE_ERROR;\n  if((rc = hmac_process(&hmac, in2, in2_sz)) != CRYPT_OK) return SQLITE_ERROR;\n  if((rc = hmac_done(&hmac, out, &outlen)) != CRYPT_OK) return SQLITE_ERROR;\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_kdf(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) {\n  int rc, hash_idx;\n  unsigned long outlen = key_sz;\n  unsigned long random_buffer_sz = sizeof(char) * 256;\n  unsigned char *random_buffer = sqlcipher_malloc(random_buffer_sz);\n  sqlcipher_memset(random_buffer, 0, random_buffer_sz);\n\n  hash_idx = find_hash(\"sha1\");\n  if((rc = pkcs_5_alg2(pass, pass_sz, salt, salt_sz,\n                       workfactor, hash_idx, key, &outlen)) != CRYPT_OK) {\n    return SQLITE_ERROR;\n  }\n  if((rc = pkcs_5_alg2(key, key_sz, salt, salt_sz,\n                       1, hash_idx, random_buffer, &random_buffer_sz)) != CRYPT_OK) {\n    return SQLITE_ERROR;\n  }\n  sqlcipher_ltc_add_random(ctx, random_buffer, random_buffer_sz);\n  sqlcipher_free(random_buffer, random_buffer_sz);\n  return SQLITE_OK;\n}\n\nstatic const char* sqlcipher_ltc_get_cipher(void *ctx) {\n  return \"rijndael\";\n}\n\nstatic int sqlcipher_ltc_cipher(void *ctx, int mode, unsigned char *key, int key_sz, unsigned char *iv, unsigned char *in, int in_sz, unsigned char *out) {\n  int rc, cipher_idx;\n  symmetric_CBC cbc;\n\n  if((cipher_idx = find_cipher(sqlcipher_ltc_get_cipher(ctx))) == -1) return SQLITE_ERROR;\n  if((rc = cbc_start(cipher_idx, iv, key, key_sz, 0, &cbc)) != CRYPT_OK) return SQLITE_ERROR;\n  rc = mode == 1 ? cbc_encrypt(in, out, in_sz, &cbc) : cbc_decrypt(in, out, in_sz, &cbc);\n  if(rc != CRYPT_OK) return SQLITE_ERROR;\n  cbc_done(&cbc);\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_set_cipher(void *ctx, const char *cipher_name) {\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_get_key_sz(void *ctx) {\n  int cipher_idx = find_cipher(sqlcipher_ltc_get_cipher(ctx));\n  return cipher_descriptor[cipher_idx].max_key_length;\n}\n\nstatic int sqlcipher_ltc_get_iv_sz(void *ctx) {\n  int cipher_idx = find_cipher(sqlcipher_ltc_get_cipher(ctx));\n  return cipher_descriptor[cipher_idx].block_length;\n}\n\nstatic int sqlcipher_ltc_get_block_sz(void *ctx) {\n  int cipher_idx = find_cipher(sqlcipher_ltc_get_cipher(ctx));\n  return cipher_descriptor[cipher_idx].block_length;\n}\n\nstatic int sqlcipher_ltc_get_hmac_sz(void *ctx) {\n  int hash_idx = find_hash(\"sha1\");\n  return hash_descriptor[hash_idx].hashsize;\n}\n\nstatic int sqlcipher_ltc_ctx_copy(void *target_ctx, void *source_ctx) {\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_ctx_cmp(void *c1, void *c2) {\n  return 1;\n}\n\nstatic int sqlcipher_ltc_ctx_init(void **ctx) {\n  sqlcipher_ltc_activate(NULL);\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_ctx_free(void **ctx) {\n  sqlcipher_ltc_deactivate(&ctx);\n  return SQLITE_OK;\n}\n\nstatic int sqlcipher_ltc_fips_status(void *ctx) {\n  return 0;\n}\n\nint sqlcipher_ltc_setup(sqlcipher_provider *p) {\n  p->activate = sqlcipher_ltc_activate;\n  p->deactivate = sqlcipher_ltc_deactivate;\n  p->get_provider_name = sqlcipher_ltc_get_provider_name;\n  p->random = sqlcipher_ltc_random;\n  p->hmac = sqlcipher_ltc_hmac;\n  p->kdf = sqlcipher_ltc_kdf;\n  p->cipher = sqlcipher_ltc_cipher;\n  p->set_cipher = sqlcipher_ltc_set_cipher;\n  p->get_cipher = sqlcipher_ltc_get_cipher;\n  p->get_key_sz = sqlcipher_ltc_get_key_sz;\n  p->get_iv_sz = sqlcipher_ltc_get_iv_sz;\n  p->get_block_sz = sqlcipher_ltc_get_block_sz;\n  p->get_hmac_sz = sqlcipher_ltc_get_hmac_sz;\n  p->ctx_copy = sqlcipher_ltc_ctx_copy;\n  p->ctx_cmp = sqlcipher_ltc_ctx_cmp;\n  p->ctx_init = sqlcipher_ltc_ctx_init;\n  p->ctx_free = sqlcipher_ltc_ctx_free;\n  p->add_random = sqlcipher_ltc_add_random;\n  p->fips_status = sqlcipher_ltc_fips_status;\n  p->get_provider_version = sqlcipher_ltc_get_provider_version;\n  return SQLITE_OK;\n}\n\n#endif\n#endif\n/* END SQLCIPHER */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/ctime.c",
    "content": "/*\n** 2010 February 23\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file implements routines used to report what compile-time options\n** SQLite was built with.\n*/\n\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\n\n#include \"sqliteInt.h\"\n\n/*\n** An array of names of all compile-time options.  This array should \n** be sorted A-Z.\n**\n** This array looks large, but in a typical installation actually uses\n** only a handful of compile-time options, so most times this array is usually\n** rather short and uses little memory space.\n*/\nstatic const char * const azCompileOpt[] = {\n\n/* These macros are provided to \"stringify\" the value of the define\n** for those options in which the value is meaningful. */\n#define CTIMEOPT_VAL_(opt) #opt\n#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)\n\n#if SQLITE_32BIT_ROWID\n  \"32BIT_ROWID\",\n#endif\n#if SQLITE_4_BYTE_ALIGNED_MALLOC\n  \"4_BYTE_ALIGNED_MALLOC\",\n#endif\n#if SQLITE_CASE_SENSITIVE_LIKE\n  \"CASE_SENSITIVE_LIKE\",\n#endif\n#if SQLITE_CHECK_PAGES\n  \"CHECK_PAGES\",\n#endif\n#if defined(__clang__) && defined(__clang_major__)\n  \"COMPILER=clang-\" CTIMEOPT_VAL(__clang_major__) \".\"\n                    CTIMEOPT_VAL(__clang_minor__) \".\"\n                    CTIMEOPT_VAL(__clang_patchlevel__),\n#elif defined(_MSC_VER)\n  \"COMPILER=msvc-\" CTIMEOPT_VAL(_MSC_VER),\n#elif defined(__GNUC__) && defined(__VERSION__)\n  \"COMPILER=gcc-\" __VERSION__,\n#endif\n#if SQLITE_COVERAGE_TEST\n  \"COVERAGE_TEST\",\n#endif\n#if SQLITE_DEBUG\n  \"DEBUG\",\n#endif\n#if SQLITE_DEFAULT_LOCKING_MODE\n  \"DEFAULT_LOCKING_MODE=\" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),\n#endif\n#if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc)\n  \"DEFAULT_MMAP_SIZE=\" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),\n#endif\n#if SQLITE_DISABLE_DIRSYNC\n  \"DISABLE_DIRSYNC\",\n#endif\n#if SQLITE_DISABLE_LFS\n  \"DISABLE_LFS\",\n#endif\n#if SQLITE_ENABLE_8_3_NAMES\n  \"ENABLE_8_3_NAMES=\" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES),\n#endif\n#if SQLITE_ENABLE_API_ARMOR\n  \"ENABLE_API_ARMOR\",\n#endif\n#if SQLITE_ENABLE_ATOMIC_WRITE\n  \"ENABLE_ATOMIC_WRITE\",\n#endif\n#if SQLITE_ENABLE_CEROD\n  \"ENABLE_CEROD\",\n#endif\n#if SQLITE_ENABLE_COLUMN_METADATA\n  \"ENABLE_COLUMN_METADATA\",\n#endif\n#if SQLITE_ENABLE_DBSTAT_VTAB\n  \"ENABLE_DBSTAT_VTAB\",\n#endif\n#if SQLITE_ENABLE_EXPENSIVE_ASSERT\n  \"ENABLE_EXPENSIVE_ASSERT\",\n#endif\n#if SQLITE_ENABLE_FTS1\n  \"ENABLE_FTS1\",\n#endif\n#if SQLITE_ENABLE_FTS2\n  \"ENABLE_FTS2\",\n#endif\n#if SQLITE_ENABLE_FTS3\n  \"ENABLE_FTS3\",\n#endif\n#if SQLITE_ENABLE_FTS3_PARENTHESIS\n  \"ENABLE_FTS3_PARENTHESIS\",\n#endif\n#if SQLITE_ENABLE_FTS4\n  \"ENABLE_FTS4\",\n#endif\n#if SQLITE_ENABLE_FTS5\n  \"ENABLE_FTS5\",\n#endif\n#if SQLITE_ENABLE_ICU\n  \"ENABLE_ICU\",\n#endif\n#if SQLITE_ENABLE_IOTRACE\n  \"ENABLE_IOTRACE\",\n#endif\n#if SQLITE_ENABLE_JSON1\n  \"ENABLE_JSON1\",\n#endif\n#if SQLITE_ENABLE_LOAD_EXTENSION\n  \"ENABLE_LOAD_EXTENSION\",\n#endif\n#if SQLITE_ENABLE_LOCKING_STYLE\n  \"ENABLE_LOCKING_STYLE=\" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),\n#endif\n#if SQLITE_ENABLE_MEMORY_MANAGEMENT\n  \"ENABLE_MEMORY_MANAGEMENT\",\n#endif\n#if SQLITE_ENABLE_MEMSYS3\n  \"ENABLE_MEMSYS3\",\n#endif\n#if SQLITE_ENABLE_MEMSYS5\n  \"ENABLE_MEMSYS5\",\n#endif\n#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK\n  \"ENABLE_OVERSIZE_CELL_CHECK\",\n#endif\n#if SQLITE_ENABLE_RTREE\n  \"ENABLE_RTREE\",\n#endif\n#if defined(SQLITE_ENABLE_STAT4)\n  \"ENABLE_STAT4\",\n#elif defined(SQLITE_ENABLE_STAT3)\n  \"ENABLE_STAT3\",\n#endif\n#if SQLITE_ENABLE_UNLOCK_NOTIFY\n  \"ENABLE_UNLOCK_NOTIFY\",\n#endif\n#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT\n  \"ENABLE_UPDATE_DELETE_LIMIT\",\n#endif\n#if SQLITE_HAS_CODEC\n  \"HAS_CODEC\",\n#endif\n#if HAVE_ISNAN || SQLITE_HAVE_ISNAN\n  \"HAVE_ISNAN\",\n#endif\n#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX\n  \"HOMEGROWN_RECURSIVE_MUTEX\",\n#endif\n#if SQLITE_IGNORE_AFP_LOCK_ERRORS\n  \"IGNORE_AFP_LOCK_ERRORS\",\n#endif\n#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS\n  \"IGNORE_FLOCK_LOCK_ERRORS\",\n#endif\n#ifdef SQLITE_INT64_TYPE\n  \"INT64_TYPE\",\n#endif\n#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n  \"LIKE_DOESNT_MATCH_BLOBS\",\n#endif\n#if SQLITE_LOCK_TRACE\n  \"LOCK_TRACE\",\n#endif\n#if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc)\n  \"MAX_MMAP_SIZE=\" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE),\n#endif\n#ifdef SQLITE_MAX_SCHEMA_RETRY\n  \"MAX_SCHEMA_RETRY=\" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),\n#endif\n#if SQLITE_MEMDEBUG\n  \"MEMDEBUG\",\n#endif\n#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT\n  \"MIXED_ENDIAN_64BIT_FLOAT\",\n#endif\n#if SQLITE_NO_SYNC\n  \"NO_SYNC\",\n#endif\n#if SQLITE_OMIT_ALTERTABLE\n  \"OMIT_ALTERTABLE\",\n#endif\n#if SQLITE_OMIT_ANALYZE\n  \"OMIT_ANALYZE\",\n#endif\n#if SQLITE_OMIT_ATTACH\n  \"OMIT_ATTACH\",\n#endif\n#if SQLITE_OMIT_AUTHORIZATION\n  \"OMIT_AUTHORIZATION\",\n#endif\n#if SQLITE_OMIT_AUTOINCREMENT\n  \"OMIT_AUTOINCREMENT\",\n#endif\n#if SQLITE_OMIT_AUTOINIT\n  \"OMIT_AUTOINIT\",\n#endif\n#if SQLITE_OMIT_AUTOMATIC_INDEX\n  \"OMIT_AUTOMATIC_INDEX\",\n#endif\n#if SQLITE_OMIT_AUTORESET\n  \"OMIT_AUTORESET\",\n#endif\n#if SQLITE_OMIT_AUTOVACUUM\n  \"OMIT_AUTOVACUUM\",\n#endif\n#if SQLITE_OMIT_BETWEEN_OPTIMIZATION\n  \"OMIT_BETWEEN_OPTIMIZATION\",\n#endif\n#if SQLITE_OMIT_BLOB_LITERAL\n  \"OMIT_BLOB_LITERAL\",\n#endif\n#if SQLITE_OMIT_BTREECOUNT\n  \"OMIT_BTREECOUNT\",\n#endif\n#if SQLITE_OMIT_BUILTIN_TEST\n  \"OMIT_BUILTIN_TEST\",\n#endif\n#if SQLITE_OMIT_CAST\n  \"OMIT_CAST\",\n#endif\n#if SQLITE_OMIT_CHECK\n  \"OMIT_CHECK\",\n#endif\n#if SQLITE_OMIT_COMPLETE\n  \"OMIT_COMPLETE\",\n#endif\n#if SQLITE_OMIT_COMPOUND_SELECT\n  \"OMIT_COMPOUND_SELECT\",\n#endif\n#if SQLITE_OMIT_CTE\n  \"OMIT_CTE\",\n#endif\n#if SQLITE_OMIT_DATETIME_FUNCS\n  \"OMIT_DATETIME_FUNCS\",\n#endif\n#if SQLITE_OMIT_DECLTYPE\n  \"OMIT_DECLTYPE\",\n#endif\n#if SQLITE_OMIT_DEPRECATED\n  \"OMIT_DEPRECATED\",\n#endif\n#if SQLITE_OMIT_DISKIO\n  \"OMIT_DISKIO\",\n#endif\n#if SQLITE_OMIT_EXPLAIN\n  \"OMIT_EXPLAIN\",\n#endif\n#if SQLITE_OMIT_FLAG_PRAGMAS\n  \"OMIT_FLAG_PRAGMAS\",\n#endif\n#if SQLITE_OMIT_FLOATING_POINT\n  \"OMIT_FLOATING_POINT\",\n#endif\n#if SQLITE_OMIT_FOREIGN_KEY\n  \"OMIT_FOREIGN_KEY\",\n#endif\n#if SQLITE_OMIT_GET_TABLE\n  \"OMIT_GET_TABLE\",\n#endif\n#if SQLITE_OMIT_INCRBLOB\n  \"OMIT_INCRBLOB\",\n#endif\n#if SQLITE_OMIT_INTEGRITY_CHECK\n  \"OMIT_INTEGRITY_CHECK\",\n#endif\n#if SQLITE_OMIT_LIKE_OPTIMIZATION\n  \"OMIT_LIKE_OPTIMIZATION\",\n#endif\n#if SQLITE_OMIT_LOAD_EXTENSION\n  \"OMIT_LOAD_EXTENSION\",\n#endif\n#if SQLITE_OMIT_LOCALTIME\n  \"OMIT_LOCALTIME\",\n#endif\n#if SQLITE_OMIT_LOOKASIDE\n  \"OMIT_LOOKASIDE\",\n#endif\n#if SQLITE_OMIT_MEMORYDB\n  \"OMIT_MEMORYDB\",\n#endif\n#if SQLITE_OMIT_OR_OPTIMIZATION\n  \"OMIT_OR_OPTIMIZATION\",\n#endif\n#if SQLITE_OMIT_PAGER_PRAGMAS\n  \"OMIT_PAGER_PRAGMAS\",\n#endif\n#if SQLITE_OMIT_PRAGMA\n  \"OMIT_PRAGMA\",\n#endif\n#if SQLITE_OMIT_PROGRESS_CALLBACK\n  \"OMIT_PROGRESS_CALLBACK\",\n#endif\n#if SQLITE_OMIT_QUICKBALANCE\n  \"OMIT_QUICKBALANCE\",\n#endif\n#if SQLITE_OMIT_REINDEX\n  \"OMIT_REINDEX\",\n#endif\n#if SQLITE_OMIT_SCHEMA_PRAGMAS\n  \"OMIT_SCHEMA_PRAGMAS\",\n#endif\n#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS\n  \"OMIT_SCHEMA_VERSION_PRAGMAS\",\n#endif\n#if SQLITE_OMIT_SHARED_CACHE\n  \"OMIT_SHARED_CACHE\",\n#endif\n#if SQLITE_OMIT_SUBQUERY\n  \"OMIT_SUBQUERY\",\n#endif\n#if SQLITE_OMIT_TCL_VARIABLE\n  \"OMIT_TCL_VARIABLE\",\n#endif\n#if SQLITE_OMIT_TEMPDB\n  \"OMIT_TEMPDB\",\n#endif\n#if SQLITE_OMIT_TRACE\n  \"OMIT_TRACE\",\n#endif\n#if SQLITE_OMIT_TRIGGER\n  \"OMIT_TRIGGER\",\n#endif\n#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION\n  \"OMIT_TRUNCATE_OPTIMIZATION\",\n#endif\n#if SQLITE_OMIT_UTF16\n  \"OMIT_UTF16\",\n#endif\n#if SQLITE_OMIT_VACUUM\n  \"OMIT_VACUUM\",\n#endif\n#if SQLITE_OMIT_VIEW\n  \"OMIT_VIEW\",\n#endif\n#if SQLITE_OMIT_VIRTUALTABLE\n  \"OMIT_VIRTUALTABLE\",\n#endif\n#if SQLITE_OMIT_WAL\n  \"OMIT_WAL\",\n#endif\n#if SQLITE_OMIT_WSD\n  \"OMIT_WSD\",\n#endif\n#if SQLITE_OMIT_XFER_OPT\n  \"OMIT_XFER_OPT\",\n#endif\n#if SQLITE_PERFORMANCE_TRACE\n  \"PERFORMANCE_TRACE\",\n#endif\n#if SQLITE_PROXY_DEBUG\n  \"PROXY_DEBUG\",\n#endif\n#if SQLITE_RTREE_INT_ONLY\n  \"RTREE_INT_ONLY\",\n#endif\n#if SQLITE_SECURE_DELETE\n  \"SECURE_DELETE\",\n#endif\n#if SQLITE_SMALL_STACK\n  \"SMALL_STACK\",\n#endif\n#if SQLITE_SOUNDEX\n  \"SOUNDEX\",\n#endif\n#if SQLITE_SYSTEM_MALLOC\n  \"SYSTEM_MALLOC\",\n#endif\n#if SQLITE_TCL\n  \"TCL\",\n#endif\n#if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc)\n  \"TEMP_STORE=\" CTIMEOPT_VAL(SQLITE_TEMP_STORE),\n#endif\n#if SQLITE_TEST\n  \"TEST\",\n#endif\n#if defined(SQLITE_THREADSAFE)\n  \"THREADSAFE=\" CTIMEOPT_VAL(SQLITE_THREADSAFE),\n#endif\n#if SQLITE_USE_ALLOCA\n  \"USE_ALLOCA\",\n#endif\n#if SQLITE_USER_AUTHENTICATION\n  \"USER_AUTHENTICATION\",\n#endif\n#if SQLITE_WIN32_MALLOC\n  \"WIN32_MALLOC\",\n#endif\n#if SQLITE_ZERO_MALLOC\n  \"ZERO_MALLOC\"\n#endif\n};\n\n/*\n** Given the name of a compile-time option, return true if that option\n** was used and false if not.\n**\n** The name can optionally begin with \"SQLITE_\" but the \"SQLITE_\" prefix\n** is not required for a match.\n*/\nint sqlite3_compileoption_used(const char *zOptName){\n  int i, n;\n\n#if SQLITE_ENABLE_API_ARMOR\n  if( zOptName==0 ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  if( sqlite3StrNICmp(zOptName, \"SQLITE_\", 7)==0 ) zOptName += 7;\n  n = sqlite3Strlen30(zOptName);\n\n  /* Since ArraySize(azCompileOpt) is normally in single digits, a\n  ** linear search is adequate.  No need for a binary search. */\n  for(i=0; i<ArraySize(azCompileOpt); i++){\n    if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0\n     && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0\n    ){\n      return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** Return the N-th compile-time option string.  If N is out of range,\n** return a NULL pointer.\n*/\nconst char *sqlite3_compileoption_get(int N){\n  if( N>=0 && N<ArraySize(azCompileOpt) ){\n    return azCompileOpt[N];\n  }\n  return 0;\n}\n\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/date.c",
    "content": "/*\n** 2003 October 31\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the C functions that implement date and time\n** functions for SQLite.  \n**\n** There is only one exported symbol in this file - the function\n** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.\n** All other code has file scope.\n**\n** SQLite processes all times and dates as julian day numbers.  The\n** dates and times are stored as the number of days since noon\n** in Greenwich on November 24, 4714 B.C. according to the Gregorian\n** calendar system. \n**\n** 1970-01-01 00:00:00 is JD 2440587.5\n** 2000-01-01 00:00:00 is JD 2451544.5\n**\n** This implementation requires years to be expressed as a 4-digit number\n** which means that only dates between 0000-01-01 and 9999-12-31 can\n** be represented, even though julian day numbers allow a much wider\n** range of dates.\n**\n** The Gregorian calendar system is used for all dates and times,\n** even those that predate the Gregorian calendar.  Historians usually\n** use the julian calendar for dates prior to 1582-10-15 and for some\n** dates afterwards, depending on locale.  Beware of this difference.\n**\n** The conversion algorithms are implemented based on descriptions\n** in the following text:\n**\n**      Jean Meeus\n**      Astronomical Algorithms, 2nd Edition, 1998\n**      ISBM 0-943396-61-1\n**      Willmann-Bell, Inc\n**      Richmond, Virginia (USA)\n*/\n#include \"sqliteInt.h\"\n#include <stdlib.h>\n#include <assert.h>\n#include <time.h>\n\n#ifndef SQLITE_OMIT_DATETIME_FUNCS\n\n/*\n** The MSVC CRT on Windows CE may not have a localtime() function.\n** So declare a substitute.  The substitute function itself is\n** defined in \"os_win.c\".\n*/\n#if !defined(SQLITE_OMIT_LOCALTIME) && defined(_WIN32_WCE) && \\\n    (!defined(SQLITE_MSVC_LOCALTIME_API) || !SQLITE_MSVC_LOCALTIME_API)\nstruct tm *__cdecl localtime(const time_t *);\n#endif\n\n/*\n** A structure for holding a single date and time.\n*/\ntypedef struct DateTime DateTime;\nstruct DateTime {\n  sqlite3_int64 iJD; /* The julian day number times 86400000 */\n  int Y, M, D;       /* Year, month, and day */\n  int h, m;          /* Hour and minutes */\n  int tz;            /* Timezone offset in minutes */\n  double s;          /* Seconds */\n  char validYMD;     /* True (1) if Y,M,D are valid */\n  char validHMS;     /* True (1) if h,m,s are valid */\n  char validJD;      /* True (1) if iJD is valid */\n  char validTZ;      /* True (1) if tz is valid */\n  char tzSet;        /* Timezone was set explicitly */\n};\n\n\n/*\n** Convert zDate into one or more integers according to the conversion\n** specifier zFormat.\n**\n** zFormat[] contains 4 characters for each integer converted, except for\n** the last integer which is specified by three characters.  The meaning\n** of a four-character format specifiers ABCD is:\n**\n**    A:   number of digits to convert.  Always \"2\" or \"4\".\n**    B:   minimum value.  Always \"0\" or \"1\".\n**    C:   maximum value, decoded as:\n**           a:  12\n**           b:  14\n**           c:  24\n**           d:  31\n**           e:  59\n**           f:  9999\n**    D:   the separator character, or \\000 to indicate this is the\n**         last number to convert.\n**\n** Example:  To translate an ISO-8601 date YYYY-MM-DD, the format would\n** be \"40f-21a-20c\".  The \"40f-\" indicates the 4-digit year followed by \"-\".\n** The \"21a-\" indicates the 2-digit month followed by \"-\".  The \"20c\" indicates\n** the 2-digit day which is the last integer in the set.\n**\n** The function returns the number of successful conversions.\n*/\nstatic int getDigits(const char *zDate, const char *zFormat, ...){\n  /* The aMx[] array translates the 3rd character of each format\n  ** spec into a max size:    a   b   c   d   e     f */\n  static const u16 aMx[] = { 12, 14, 24, 31, 59, 9999 };\n  va_list ap;\n  int cnt = 0;\n  char nextC;\n  va_start(ap, zFormat);\n  do{\n    char N = zFormat[0] - '0';\n    char min = zFormat[1] - '0';\n    int val = 0;\n    u16 max;\n\n    assert( zFormat[2]>='a' && zFormat[2]<='f' );\n    max = aMx[zFormat[2] - 'a'];\n    nextC = zFormat[3];\n    val = 0;\n    while( N-- ){\n      if( !sqlite3Isdigit(*zDate) ){\n        goto end_getDigits;\n      }\n      val = val*10 + *zDate - '0';\n      zDate++;\n    }\n    if( val<(int)min || val>(int)max || (nextC!=0 && nextC!=*zDate) ){\n      goto end_getDigits;\n    }\n    *va_arg(ap,int*) = val;\n    zDate++;\n    cnt++;\n    zFormat += 4;\n  }while( nextC );\nend_getDigits:\n  va_end(ap);\n  return cnt;\n}\n\n/*\n** Parse a timezone extension on the end of a date-time.\n** The extension is of the form:\n**\n**        (+/-)HH:MM\n**\n** Or the \"zulu\" notation:\n**\n**        Z\n**\n** If the parse is successful, write the number of minutes\n** of change in p->tz and return 0.  If a parser error occurs,\n** return non-zero.\n**\n** A missing specifier is not considered an error.\n*/\nstatic int parseTimezone(const char *zDate, DateTime *p){\n  int sgn = 0;\n  int nHr, nMn;\n  int c;\n  while( sqlite3Isspace(*zDate) ){ zDate++; }\n  p->tz = 0;\n  c = *zDate;\n  if( c=='-' ){\n    sgn = -1;\n  }else if( c=='+' ){\n    sgn = +1;\n  }else if( c=='Z' || c=='z' ){\n    zDate++;\n    goto zulu_time;\n  }else{\n    return c!=0;\n  }\n  zDate++;\n  if( getDigits(zDate, \"20b:20e\", &nHr, &nMn)!=2 ){\n    return 1;\n  }\n  zDate += 5;\n  p->tz = sgn*(nMn + nHr*60);\nzulu_time:\n  while( sqlite3Isspace(*zDate) ){ zDate++; }\n  p->tzSet = 1;\n  return *zDate!=0;\n}\n\n/*\n** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF.\n** The HH, MM, and SS must each be exactly 2 digits.  The\n** fractional seconds FFFF can be one or more digits.\n**\n** Return 1 if there is a parsing error and 0 on success.\n*/\nstatic int parseHhMmSs(const char *zDate, DateTime *p){\n  int h, m, s;\n  double ms = 0.0;\n  if( getDigits(zDate, \"20c:20e\", &h, &m)!=2 ){\n    return 1;\n  }\n  zDate += 5;\n  if( *zDate==':' ){\n    zDate++;\n    if( getDigits(zDate, \"20e\", &s)!=1 ){\n      return 1;\n    }\n    zDate += 2;\n    if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){\n      double rScale = 1.0;\n      zDate++;\n      while( sqlite3Isdigit(*zDate) ){\n        ms = ms*10.0 + *zDate - '0';\n        rScale *= 10.0;\n        zDate++;\n      }\n      ms /= rScale;\n    }\n  }else{\n    s = 0;\n  }\n  p->validJD = 0;\n  p->validHMS = 1;\n  p->h = h;\n  p->m = m;\n  p->s = s + ms;\n  if( parseTimezone(zDate, p) ) return 1;\n  p->validTZ = (p->tz!=0)?1:0;\n  return 0;\n}\n\n/*\n** Convert from YYYY-MM-DD HH:MM:SS to julian day.  We always assume\n** that the YYYY-MM-DD is according to the Gregorian calendar.\n**\n** Reference:  Meeus page 61\n*/\nstatic void computeJD(DateTime *p){\n  int Y, M, D, A, B, X1, X2;\n\n  if( p->validJD ) return;\n  if( p->validYMD ){\n    Y = p->Y;\n    M = p->M;\n    D = p->D;\n  }else{\n    Y = 2000;  /* If no YMD specified, assume 2000-Jan-01 */\n    M = 1;\n    D = 1;\n  }\n  if( M<=2 ){\n    Y--;\n    M += 12;\n  }\n  A = Y/100;\n  B = 2 - A + (A/4);\n  X1 = 36525*(Y+4716)/100;\n  X2 = 306001*(M+1)/10000;\n  p->iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000);\n  p->validJD = 1;\n  if( p->validHMS ){\n    p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000);\n    if( p->validTZ ){\n      p->iJD -= p->tz*60000;\n      p->validYMD = 0;\n      p->validHMS = 0;\n      p->validTZ = 0;\n    }\n  }\n}\n\n/*\n** Parse dates of the form\n**\n**     YYYY-MM-DD HH:MM:SS.FFF\n**     YYYY-MM-DD HH:MM:SS\n**     YYYY-MM-DD HH:MM\n**     YYYY-MM-DD\n**\n** Write the result into the DateTime structure and return 0\n** on success and 1 if the input string is not a well-formed\n** date.\n*/\nstatic int parseYyyyMmDd(const char *zDate, DateTime *p){\n  int Y, M, D, neg;\n\n  if( zDate[0]=='-' ){\n    zDate++;\n    neg = 1;\n  }else{\n    neg = 0;\n  }\n  if( getDigits(zDate, \"40f-21a-21d\", &Y, &M, &D)!=3 ){\n    return 1;\n  }\n  zDate += 10;\n  while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; }\n  if( parseHhMmSs(zDate, p)==0 ){\n    /* We got the time */\n  }else if( *zDate==0 ){\n    p->validHMS = 0;\n  }else{\n    return 1;\n  }\n  p->validJD = 0;\n  p->validYMD = 1;\n  p->Y = neg ? -Y : Y;\n  p->M = M;\n  p->D = D;\n  if( p->validTZ ){\n    computeJD(p);\n  }\n  return 0;\n}\n\n/*\n** Set the time to the current time reported by the VFS.\n**\n** Return the number of errors.\n*/\nstatic int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){\n  p->iJD = sqlite3StmtCurrentTime(context);\n  if( p->iJD>0 ){\n    p->validJD = 1;\n    return 0;\n  }else{\n    return 1;\n  }\n}\n\n/*\n** Attempt to parse the given string into a julian day number.  Return\n** the number of errors.\n**\n** The following are acceptable forms for the input string:\n**\n**      YYYY-MM-DD HH:MM:SS.FFF  +/-HH:MM\n**      DDDD.DD \n**      now\n**\n** In the first form, the +/-HH:MM is always optional.  The fractional\n** seconds extension (the \".FFF\") is optional.  The seconds portion\n** (\":SS.FFF\") is option.  The year and date can be omitted as long\n** as there is a time string.  The time string can be omitted as long\n** as there is a year and date.\n*/\nstatic int parseDateOrTime(\n  sqlite3_context *context, \n  const char *zDate, \n  DateTime *p\n){\n  double r;\n  if( parseYyyyMmDd(zDate,p)==0 ){\n    return 0;\n  }else if( parseHhMmSs(zDate, p)==0 ){\n    return 0;\n  }else if( sqlite3StrICmp(zDate,\"now\")==0){\n    return setDateTimeToCurrent(context, p);\n  }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){\n    p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);\n    p->validJD = 1;\n    return 0;\n  }\n  return 1;\n}\n\n/*\n** Compute the Year, Month, and Day from the julian day number.\n*/\nstatic void computeYMD(DateTime *p){\n  int Z, A, B, C, D, E, X1;\n  if( p->validYMD ) return;\n  if( !p->validJD ){\n    p->Y = 2000;\n    p->M = 1;\n    p->D = 1;\n  }else{\n    Z = (int)((p->iJD + 43200000)/86400000);\n    A = (int)((Z - 1867216.25)/36524.25);\n    A = Z + 1 + A - (A/4);\n    B = A + 1524;\n    C = (int)((B - 122.1)/365.25);\n    D = (36525*(C&32767))/100;\n    E = (int)((B-D)/30.6001);\n    X1 = (int)(30.6001*E);\n    p->D = B - D - X1;\n    p->M = E<14 ? E-1 : E-13;\n    p->Y = p->M>2 ? C - 4716 : C - 4715;\n  }\n  p->validYMD = 1;\n}\n\n/*\n** Compute the Hour, Minute, and Seconds from the julian day number.\n*/\nstatic void computeHMS(DateTime *p){\n  int s;\n  if( p->validHMS ) return;\n  computeJD(p);\n  s = (int)((p->iJD + 43200000) % 86400000);\n  p->s = s/1000.0;\n  s = (int)p->s;\n  p->s -= s;\n  p->h = s/3600;\n  s -= p->h*3600;\n  p->m = s/60;\n  p->s += s - p->m*60;\n  p->validHMS = 1;\n}\n\n/*\n** Compute both YMD and HMS\n*/\nstatic void computeYMD_HMS(DateTime *p){\n  computeYMD(p);\n  computeHMS(p);\n}\n\n/*\n** Clear the YMD and HMS and the TZ\n*/\nstatic void clearYMD_HMS_TZ(DateTime *p){\n  p->validYMD = 0;\n  p->validHMS = 0;\n  p->validTZ = 0;\n}\n\n#ifndef SQLITE_OMIT_LOCALTIME\n/*\n** On recent Windows platforms, the localtime_s() function is available\n** as part of the \"Secure CRT\". It is essentially equivalent to \n** localtime_r() available under most POSIX platforms, except that the \n** order of the parameters is reversed.\n**\n** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.\n**\n** If the user has not indicated to use localtime_r() or localtime_s()\n** already, check for an MSVC build environment that provides \n** localtime_s().\n*/\n#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S \\\n    && defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)\n#undef  HAVE_LOCALTIME_S\n#define HAVE_LOCALTIME_S 1\n#endif\n\n/*\n** The following routine implements the rough equivalent of localtime_r()\n** using whatever operating-system specific localtime facility that\n** is available.  This routine returns 0 on success and\n** non-zero on any kind of error.\n**\n** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this\n** routine will always fail.\n**\n** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C\n** library function localtime_r() is used to assist in the calculation of\n** local time.\n*/\nstatic int osLocaltime(time_t *t, struct tm *pTm){\n  int rc;\n#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S\n  struct tm *pX;\n#if SQLITE_THREADSAFE>0\n  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n#endif\n  sqlite3_mutex_enter(mutex);\n  pX = localtime(t);\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n  if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;\n#endif\n  if( pX ) *pTm = *pX;\n  sqlite3_mutex_leave(mutex);\n  rc = pX==0;\n#else\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n  if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;\n#endif\n#if HAVE_LOCALTIME_R\n  rc = localtime_r(t, pTm)==0;\n#else\n  rc = localtime_s(pTm, t);\n#endif /* HAVE_LOCALTIME_R */\n#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */\n  return rc;\n}\n#endif /* SQLITE_OMIT_LOCALTIME */\n\n\n#ifndef SQLITE_OMIT_LOCALTIME\n/*\n** Compute the difference (in milliseconds) between localtime and UTC\n** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs,\n** return this value and set *pRc to SQLITE_OK. \n**\n** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value\n** is undefined in this case.\n*/\nstatic sqlite3_int64 localtimeOffset(\n  DateTime *p,                    /* Date at which to calculate offset */\n  sqlite3_context *pCtx,          /* Write error here if one occurs */\n  int *pRc                        /* OUT: Error code. SQLITE_OK or ERROR */\n){\n  DateTime x, y;\n  time_t t;\n  struct tm sLocal;\n\n  /* Initialize the contents of sLocal to avoid a compiler warning. */\n  memset(&sLocal, 0, sizeof(sLocal));\n\n  x = *p;\n  computeYMD_HMS(&x);\n  if( x.Y<1971 || x.Y>=2038 ){\n    /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only\n    ** works for years between 1970 and 2037. For dates outside this range,\n    ** SQLite attempts to map the year into an equivalent year within this\n    ** range, do the calculation, then map the year back.\n    */\n    x.Y = 2000;\n    x.M = 1;\n    x.D = 1;\n    x.h = 0;\n    x.m = 0;\n    x.s = 0.0;\n  } else {\n    int s = (int)(x.s + 0.5);\n    x.s = s;\n  }\n  x.tz = 0;\n  x.validJD = 0;\n  computeJD(&x);\n  t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);\n  if( osLocaltime(&t, &sLocal) ){\n    sqlite3_result_error(pCtx, \"local time unavailable\", -1);\n    *pRc = SQLITE_ERROR;\n    return 0;\n  }\n  y.Y = sLocal.tm_year + 1900;\n  y.M = sLocal.tm_mon + 1;\n  y.D = sLocal.tm_mday;\n  y.h = sLocal.tm_hour;\n  y.m = sLocal.tm_min;\n  y.s = sLocal.tm_sec;\n  y.validYMD = 1;\n  y.validHMS = 1;\n  y.validJD = 0;\n  y.validTZ = 0;\n  computeJD(&y);\n  *pRc = SQLITE_OK;\n  return y.iJD - x.iJD;\n}\n#endif /* SQLITE_OMIT_LOCALTIME */\n\n/*\n** Process a modifier to a date-time stamp.  The modifiers are\n** as follows:\n**\n**     NNN days\n**     NNN hours\n**     NNN minutes\n**     NNN.NNNN seconds\n**     NNN months\n**     NNN years\n**     start of month\n**     start of year\n**     start of week\n**     start of day\n**     weekday N\n**     unixepoch\n**     localtime\n**     utc\n**\n** Return 0 on success and 1 if there is any kind of error. If the error\n** is in a system call (i.e. localtime()), then an error message is written\n** to context pCtx. If the error is an unrecognized modifier, no error is\n** written to pCtx.\n*/\nstatic int parseModifier(sqlite3_context *pCtx, const char *zMod, DateTime *p){\n  int rc = 1;\n  int n;\n  double r;\n  char *z, zBuf[30];\n  z = zBuf;\n  for(n=0; n<ArraySize(zBuf)-1 && zMod[n]; n++){\n    z[n] = (char)sqlite3UpperToLower[(u8)zMod[n]];\n  }\n  z[n] = 0;\n  switch( z[0] ){\n#ifndef SQLITE_OMIT_LOCALTIME\n    case 'l': {\n      /*    localtime\n      **\n      ** Assuming the current time value is UTC (a.k.a. GMT), shift it to\n      ** show local time.\n      */\n      if( strcmp(z, \"localtime\")==0 ){\n        computeJD(p);\n        p->iJD += localtimeOffset(p, pCtx, &rc);\n        clearYMD_HMS_TZ(p);\n      }\n      break;\n    }\n#endif\n    case 'u': {\n      /*\n      **    unixepoch\n      **\n      ** Treat the current value of p->iJD as the number of\n      ** seconds since 1970.  Convert to a real julian day number.\n      */\n      if( strcmp(z, \"unixepoch\")==0 && p->validJD ){\n        p->iJD = (p->iJD + 43200)/86400 + 21086676*(i64)10000000;\n        clearYMD_HMS_TZ(p);\n        rc = 0;\n      }\n#ifndef SQLITE_OMIT_LOCALTIME\n      else if( strcmp(z, \"utc\")==0 ){\n        if( p->tzSet==0 ){\n          sqlite3_int64 c1;\n          computeJD(p);\n          c1 = localtimeOffset(p, pCtx, &rc);\n          if( rc==SQLITE_OK ){\n            p->iJD -= c1;\n            clearYMD_HMS_TZ(p);\n            p->iJD += c1 - localtimeOffset(p, pCtx, &rc);\n          }\n          p->tzSet = 1;\n        }else{\n          rc = SQLITE_OK;\n        }\n      }\n#endif\n      break;\n    }\n    case 'w': {\n      /*\n      **    weekday N\n      **\n      ** Move the date to the same time on the next occurrence of\n      ** weekday N where 0==Sunday, 1==Monday, and so forth.  If the\n      ** date is already on the appropriate weekday, this is a no-op.\n      */\n      if( strncmp(z, \"weekday \", 8)==0\n               && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)\n               && (n=(int)r)==r && n>=0 && r<7 ){\n        sqlite3_int64 Z;\n        computeYMD_HMS(p);\n        p->validTZ = 0;\n        p->validJD = 0;\n        computeJD(p);\n        Z = ((p->iJD + 129600000)/86400000) % 7;\n        if( Z>n ) Z -= 7;\n        p->iJD += (n - Z)*86400000;\n        clearYMD_HMS_TZ(p);\n        rc = 0;\n      }\n      break;\n    }\n    case 's': {\n      /*\n      **    start of TTTTT\n      **\n      ** Move the date backwards to the beginning of the current day,\n      ** or month or year.\n      */\n      if( strncmp(z, \"start of \", 9)!=0 ) break;\n      z += 9;\n      computeYMD(p);\n      p->validHMS = 1;\n      p->h = p->m = 0;\n      p->s = 0.0;\n      p->validTZ = 0;\n      p->validJD = 0;\n      if( strcmp(z,\"month\")==0 ){\n        p->D = 1;\n        rc = 0;\n      }else if( strcmp(z,\"year\")==0 ){\n        computeYMD(p);\n        p->M = 1;\n        p->D = 1;\n        rc = 0;\n      }else if( strcmp(z,\"day\")==0 ){\n        rc = 0;\n      }\n      break;\n    }\n    case '+':\n    case '-':\n    case '0':\n    case '1':\n    case '2':\n    case '3':\n    case '4':\n    case '5':\n    case '6':\n    case '7':\n    case '8':\n    case '9': {\n      double rRounder;\n      for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){}\n      if( !sqlite3AtoF(z, &r, n, SQLITE_UTF8) ){\n        rc = 1;\n        break;\n      }\n      if( z[n]==':' ){\n        /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the\n        ** specified number of hours, minutes, seconds, and fractional seconds\n        ** to the time.  The \".FFF\" may be omitted.  The \":SS.FFF\" may be\n        ** omitted.\n        */\n        const char *z2 = z;\n        DateTime tx;\n        sqlite3_int64 day;\n        if( !sqlite3Isdigit(*z2) ) z2++;\n        memset(&tx, 0, sizeof(tx));\n        if( parseHhMmSs(z2, &tx) ) break;\n        computeJD(&tx);\n        tx.iJD -= 43200000;\n        day = tx.iJD/86400000;\n        tx.iJD -= day*86400000;\n        if( z[0]=='-' ) tx.iJD = -tx.iJD;\n        computeJD(p);\n        clearYMD_HMS_TZ(p);\n        p->iJD += tx.iJD;\n        rc = 0;\n        break;\n      }\n      z += n;\n      while( sqlite3Isspace(*z) ) z++;\n      n = sqlite3Strlen30(z);\n      if( n>10 || n<3 ) break;\n      if( z[n-1]=='s' ){ z[n-1] = 0; n--; }\n      computeJD(p);\n      rc = 0;\n      rRounder = r<0 ? -0.5 : +0.5;\n      if( n==3 && strcmp(z,\"day\")==0 ){\n        p->iJD += (sqlite3_int64)(r*86400000.0 + rRounder);\n      }else if( n==4 && strcmp(z,\"hour\")==0 ){\n        p->iJD += (sqlite3_int64)(r*(86400000.0/24.0) + rRounder);\n      }else if( n==6 && strcmp(z,\"minute\")==0 ){\n        p->iJD += (sqlite3_int64)(r*(86400000.0/(24.0*60.0)) + rRounder);\n      }else if( n==6 && strcmp(z,\"second\")==0 ){\n        p->iJD += (sqlite3_int64)(r*(86400000.0/(24.0*60.0*60.0)) + rRounder);\n      }else if( n==5 && strcmp(z,\"month\")==0 ){\n        int x, y;\n        computeYMD_HMS(p);\n        p->M += (int)r;\n        x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;\n        p->Y += x;\n        p->M -= x*12;\n        p->validJD = 0;\n        computeJD(p);\n        y = (int)r;\n        if( y!=r ){\n          p->iJD += (sqlite3_int64)((r - y)*30.0*86400000.0 + rRounder);\n        }\n      }else if( n==4 && strcmp(z,\"year\")==0 ){\n        int y = (int)r;\n        computeYMD_HMS(p);\n        p->Y += y;\n        p->validJD = 0;\n        computeJD(p);\n        if( y!=r ){\n          p->iJD += (sqlite3_int64)((r - y)*365.0*86400000.0 + rRounder);\n        }\n      }else{\n        rc = 1;\n      }\n      clearYMD_HMS_TZ(p);\n      break;\n    }\n    default: {\n      break;\n    }\n  }\n  return rc;\n}\n\n/*\n** Process time function arguments.  argv[0] is a date-time stamp.\n** argv[1] and following are modifiers.  Parse them all and write\n** the resulting time into the DateTime structure p.  Return 0\n** on success and 1 if there are any errors.\n**\n** If there are zero parameters (if even argv[0] is undefined)\n** then assume a default value of \"now\" for argv[0].\n*/\nstatic int isDate(\n  sqlite3_context *context, \n  int argc, \n  sqlite3_value **argv, \n  DateTime *p\n){\n  int i;\n  const unsigned char *z;\n  int eType;\n  memset(p, 0, sizeof(*p));\n  if( argc==0 ){\n    return setDateTimeToCurrent(context, p);\n  }\n  if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT\n                   || eType==SQLITE_INTEGER ){\n    p->iJD = (sqlite3_int64)(sqlite3_value_double(argv[0])*86400000.0 + 0.5);\n    p->validJD = 1;\n  }else{\n    z = sqlite3_value_text(argv[0]);\n    if( !z || parseDateOrTime(context, (char*)z, p) ){\n      return 1;\n    }\n  }\n  for(i=1; i<argc; i++){\n    z = sqlite3_value_text(argv[i]);\n    if( z==0 || parseModifier(context, (char*)z, p) ) return 1;\n  }\n  return 0;\n}\n\n\n/*\n** The following routines implement the various date and time functions\n** of SQLite.\n*/\n\n/*\n**    julianday( TIMESTRING, MOD, MOD, ...)\n**\n** Return the julian day number of the date specified in the arguments\n*/\nstatic void juliandayFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  DateTime x;\n  if( isDate(context, argc, argv, &x)==0 ){\n    computeJD(&x);\n    sqlite3_result_double(context, x.iJD/86400000.0);\n  }\n}\n\n/*\n**    datetime( TIMESTRING, MOD, MOD, ...)\n**\n** Return YYYY-MM-DD HH:MM:SS\n*/\nstatic void datetimeFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  DateTime x;\n  if( isDate(context, argc, argv, &x)==0 ){\n    char zBuf[100];\n    computeYMD_HMS(&x);\n    sqlite3_snprintf(sizeof(zBuf), zBuf, \"%04d-%02d-%02d %02d:%02d:%02d\",\n                     x.Y, x.M, x.D, x.h, x.m, (int)(x.s));\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\n  }\n}\n\n/*\n**    time( TIMESTRING, MOD, MOD, ...)\n**\n** Return HH:MM:SS\n*/\nstatic void timeFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  DateTime x;\n  if( isDate(context, argc, argv, &x)==0 ){\n    char zBuf[100];\n    computeHMS(&x);\n    sqlite3_snprintf(sizeof(zBuf), zBuf, \"%02d:%02d:%02d\", x.h, x.m, (int)x.s);\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\n  }\n}\n\n/*\n**    date( TIMESTRING, MOD, MOD, ...)\n**\n** Return YYYY-MM-DD\n*/\nstatic void dateFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  DateTime x;\n  if( isDate(context, argc, argv, &x)==0 ){\n    char zBuf[100];\n    computeYMD(&x);\n    sqlite3_snprintf(sizeof(zBuf), zBuf, \"%04d-%02d-%02d\", x.Y, x.M, x.D);\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\n  }\n}\n\n/*\n**    strftime( FORMAT, TIMESTRING, MOD, MOD, ...)\n**\n** Return a string described by FORMAT.  Conversions as follows:\n**\n**   %d  day of month\n**   %f  ** fractional seconds  SS.SSS\n**   %H  hour 00-24\n**   %j  day of year 000-366\n**   %J  ** julian day number\n**   %m  month 01-12\n**   %M  minute 00-59\n**   %s  seconds since 1970-01-01\n**   %S  seconds 00-59\n**   %w  day of week 0-6  sunday==0\n**   %W  week of year 00-53\n**   %Y  year 0000-9999\n**   %%  %\n*/\nstatic void strftimeFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  DateTime x;\n  u64 n;\n  size_t i,j;\n  char *z;\n  sqlite3 *db;\n  const char *zFmt;\n  char zBuf[100];\n  if( argc==0 ) return;\n  zFmt = (const char*)sqlite3_value_text(argv[0]);\n  if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;\n  db = sqlite3_context_db_handle(context);\n  for(i=0, n=1; zFmt[i]; i++, n++){\n    if( zFmt[i]=='%' ){\n      switch( zFmt[i+1] ){\n        case 'd':\n        case 'H':\n        case 'm':\n        case 'M':\n        case 'S':\n        case 'W':\n          n++;\n          /* fall thru */\n        case 'w':\n        case '%':\n          break;\n        case 'f':\n          n += 8;\n          break;\n        case 'j':\n          n += 3;\n          break;\n        case 'Y':\n          n += 8;\n          break;\n        case 's':\n        case 'J':\n          n += 50;\n          break;\n        default:\n          return;  /* ERROR.  return a NULL */\n      }\n      i++;\n    }\n  }\n  testcase( n==sizeof(zBuf)-1 );\n  testcase( n==sizeof(zBuf) );\n  testcase( n==(u64)db->aLimit[SQLITE_LIMIT_LENGTH]+1 );\n  testcase( n==(u64)db->aLimit[SQLITE_LIMIT_LENGTH] );\n  if( n<sizeof(zBuf) ){\n    z = zBuf;\n  }else if( n>(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    sqlite3_result_error_toobig(context);\n    return;\n  }else{\n    z = sqlite3DbMallocRawNN(db, (int)n);\n    if( z==0 ){\n      sqlite3_result_error_nomem(context);\n      return;\n    }\n  }\n  computeJD(&x);\n  computeYMD_HMS(&x);\n  for(i=j=0; zFmt[i]; i++){\n    if( zFmt[i]!='%' ){\n      z[j++] = zFmt[i];\n    }else{\n      i++;\n      switch( zFmt[i] ){\n        case 'd':  sqlite3_snprintf(3, &z[j],\"%02d\",x.D); j+=2; break;\n        case 'f': {\n          double s = x.s;\n          if( s>59.999 ) s = 59.999;\n          sqlite3_snprintf(7, &z[j],\"%06.3f\", s);\n          j += sqlite3Strlen30(&z[j]);\n          break;\n        }\n        case 'H':  sqlite3_snprintf(3, &z[j],\"%02d\",x.h); j+=2; break;\n        case 'W': /* Fall thru */\n        case 'j': {\n          int nDay;             /* Number of days since 1st day of year */\n          DateTime y = x;\n          y.validJD = 0;\n          y.M = 1;\n          y.D = 1;\n          computeJD(&y);\n          nDay = (int)((x.iJD-y.iJD+43200000)/86400000);\n          if( zFmt[i]=='W' ){\n            int wd;   /* 0=Monday, 1=Tuesday, ... 6=Sunday */\n            wd = (int)(((x.iJD+43200000)/86400000)%7);\n            sqlite3_snprintf(3, &z[j],\"%02d\",(nDay+7-wd)/7);\n            j += 2;\n          }else{\n            sqlite3_snprintf(4, &z[j],\"%03d\",nDay+1);\n            j += 3;\n          }\n          break;\n        }\n        case 'J': {\n          sqlite3_snprintf(20, &z[j],\"%.16g\",x.iJD/86400000.0);\n          j+=sqlite3Strlen30(&z[j]);\n          break;\n        }\n        case 'm':  sqlite3_snprintf(3, &z[j],\"%02d\",x.M); j+=2; break;\n        case 'M':  sqlite3_snprintf(3, &z[j],\"%02d\",x.m); j+=2; break;\n        case 's': {\n          sqlite3_snprintf(30,&z[j],\"%lld\",\n                           (i64)(x.iJD/1000 - 21086676*(i64)10000));\n          j += sqlite3Strlen30(&z[j]);\n          break;\n        }\n        case 'S':  sqlite3_snprintf(3,&z[j],\"%02d\",(int)x.s); j+=2; break;\n        case 'w': {\n          z[j++] = (char)(((x.iJD+129600000)/86400000) % 7) + '0';\n          break;\n        }\n        case 'Y': {\n          sqlite3_snprintf(5,&z[j],\"%04d\",x.Y); j+=sqlite3Strlen30(&z[j]);\n          break;\n        }\n        default:   z[j++] = '%'; break;\n      }\n    }\n  }\n  z[j] = 0;\n  sqlite3_result_text(context, z, -1,\n                      z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);\n}\n\n/*\n** current_time()\n**\n** This function returns the same value as time('now').\n*/\nstatic void ctimeFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  timeFunc(context, 0, 0);\n}\n\n/*\n** current_date()\n**\n** This function returns the same value as date('now').\n*/\nstatic void cdateFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  dateFunc(context, 0, 0);\n}\n\n/*\n** current_timestamp()\n**\n** This function returns the same value as datetime('now').\n*/\nstatic void ctimestampFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  datetimeFunc(context, 0, 0);\n}\n#endif /* !defined(SQLITE_OMIT_DATETIME_FUNCS) */\n\n#ifdef SQLITE_OMIT_DATETIME_FUNCS\n/*\n** If the library is compiled to omit the full-scale date and time\n** handling (to get a smaller binary), the following minimal version\n** of the functions current_time(), current_date() and current_timestamp()\n** are included instead. This is to support column declarations that\n** include \"DEFAULT CURRENT_TIME\" etc.\n**\n** This function uses the C-library functions time(), gmtime()\n** and strftime(). The format string to pass to strftime() is supplied\n** as the user-data for the function.\n*/\nstatic void currentTimeFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  time_t t;\n  char *zFormat = (char *)sqlite3_user_data(context);\n  sqlite3_int64 iT;\n  struct tm *pTm;\n  struct tm sNow;\n  char zBuf[20];\n\n  UNUSED_PARAMETER(argc);\n  UNUSED_PARAMETER(argv);\n\n  iT = sqlite3StmtCurrentTime(context);\n  if( iT<=0 ) return;\n  t = iT/1000 - 10000*(sqlite3_int64)21086676;\n#if HAVE_GMTIME_R\n  pTm = gmtime_r(&t, &sNow);\n#else\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\n  pTm = gmtime(&t);\n  if( pTm ) memcpy(&sNow, pTm, sizeof(sNow));\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\n#endif\n  if( pTm ){\n    strftime(zBuf, 20, zFormat, &sNow);\n    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\n  }\n}\n#endif\n\n/*\n** This function registered all of the above C functions as SQL\n** functions.  This should be the only routine in this file with\n** external linkage.\n*/\nvoid sqlite3RegisterDateTimeFunctions(void){\n  static FuncDef aDateTimeFuncs[] = {\n#ifndef SQLITE_OMIT_DATETIME_FUNCS\n    DFUNCTION(julianday,        -1, 0, 0, juliandayFunc ),\n    DFUNCTION(date,             -1, 0, 0, dateFunc      ),\n    DFUNCTION(time,             -1, 0, 0, timeFunc      ),\n    DFUNCTION(datetime,         -1, 0, 0, datetimeFunc  ),\n    DFUNCTION(strftime,         -1, 0, 0, strftimeFunc  ),\n    DFUNCTION(current_time,      0, 0, 0, ctimeFunc     ),\n    DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),\n    DFUNCTION(current_date,      0, 0, 0, cdateFunc     ),\n#else\n    STR_FUNCTION(current_time,      0, \"%H:%M:%S\",          0, currentTimeFunc),\n    STR_FUNCTION(current_date,      0, \"%Y-%m-%d\",          0, currentTimeFunc),\n    STR_FUNCTION(current_timestamp, 0, \"%Y-%m-%d %H:%M:%S\", 0, currentTimeFunc),\n#endif\n  };\n  sqlite3InsertBuiltinFuncs(aDateTimeFuncs, ArraySize(aDateTimeFuncs));\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/dbstat.c",
    "content": "/*\n** 2010 July 12\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains an implementation of the \"dbstat\" virtual table.\n**\n** The dbstat virtual table is used to extract low-level formatting\n** information from an SQLite database in order to implement the\n** \"sqlite3_analyzer\" utility.  See the ../tool/spaceanal.tcl script\n** for an example implementation.\n**\n** Additional information is available on the \"dbstat.html\" page of the\n** official SQLite documentation.\n*/\n\n#include \"sqliteInt.h\"   /* Requires access to internal data structures */\n#if (defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)) \\\n    && !defined(SQLITE_OMIT_VIRTUALTABLE)\n\n/*\n** Page paths:\n** \n**   The value of the 'path' column describes the path taken from the \n**   root-node of the b-tree structure to each page. The value of the \n**   root-node path is '/'.\n**\n**   The value of the path for the left-most child page of the root of\n**   a b-tree is '/000/'. (Btrees store content ordered from left to right\n**   so the pages to the left have smaller keys than the pages to the right.)\n**   The next to left-most child of the root page is\n**   '/001', and so on, each sibling page identified by a 3-digit hex \n**   value. The children of the 451st left-most sibling have paths such\n**   as '/1c2/000/, '/1c2/001/' etc.\n**\n**   Overflow pages are specified by appending a '+' character and a \n**   six-digit hexadecimal value to the path to the cell they are linked\n**   from. For example, the three overflow pages in a chain linked from \n**   the left-most cell of the 450th child of the root page are identified\n**   by the paths:\n**\n**      '/1c2/000+000000'         // First page in overflow chain\n**      '/1c2/000+000001'         // Second page in overflow chain\n**      '/1c2/000+000002'         // Third page in overflow chain\n**\n**   If the paths are sorted using the BINARY collation sequence, then\n**   the overflow pages associated with a cell will appear earlier in the\n**   sort-order than its child page:\n**\n**      '/1c2/000/'               // Left-most child of 451st child of root\n*/\n#define VTAB_SCHEMA                                                         \\\n  \"CREATE TABLE xx( \"                                                       \\\n  \"  name       TEXT,             /* Name of table or index */\"             \\\n  \"  path       TEXT,             /* Path to page from root */\"             \\\n  \"  pageno     INTEGER,          /* Page number */\"                        \\\n  \"  pagetype   TEXT,             /* 'internal', 'leaf' or 'overflow' */\"   \\\n  \"  ncell      INTEGER,          /* Cells on page (0 for overflow) */\"     \\\n  \"  payload    INTEGER,          /* Bytes of payload on this page */\"      \\\n  \"  unused     INTEGER,          /* Bytes of unused space on this page */\" \\\n  \"  mx_payload INTEGER,          /* Largest payload size of all cells */\"  \\\n  \"  pgoffset   INTEGER,          /* Offset of page in file */\"             \\\n  \"  pgsize     INTEGER,          /* Size of the page */\"                   \\\n  \"  schema     TEXT HIDDEN       /* Database schema being analyzed */\"     \\\n  \");\"\n\n\ntypedef struct StatTable StatTable;\ntypedef struct StatCursor StatCursor;\ntypedef struct StatPage StatPage;\ntypedef struct StatCell StatCell;\n\nstruct StatCell {\n  int nLocal;                     /* Bytes of local payload */\n  u32 iChildPg;                   /* Child node (or 0 if this is a leaf) */\n  int nOvfl;                      /* Entries in aOvfl[] */\n  u32 *aOvfl;                     /* Array of overflow page numbers */\n  int nLastOvfl;                  /* Bytes of payload on final overflow page */\n  int iOvfl;                      /* Iterates through aOvfl[] */\n};\n\nstruct StatPage {\n  u32 iPgno;\n  DbPage *pPg;\n  int iCell;\n\n  char *zPath;                    /* Path to this page */\n\n  /* Variables populated by statDecodePage(): */\n  u8 flags;                       /* Copy of flags byte */\n  int nCell;                      /* Number of cells on page */\n  int nUnused;                    /* Number of unused bytes on page */\n  StatCell *aCell;                /* Array of parsed cells */\n  u32 iRightChildPg;              /* Right-child page number (or 0) */\n  int nMxPayload;                 /* Largest payload of any cell on this page */\n};\n\nstruct StatCursor {\n  sqlite3_vtab_cursor base;\n  sqlite3_stmt *pStmt;            /* Iterates through set of root pages */\n  int isEof;                      /* After pStmt has returned SQLITE_DONE */\n  int iDb;                        /* Schema used for this query */\n\n  StatPage aPage[32];\n  int iPage;                      /* Current entry in aPage[] */\n\n  /* Values to return. */\n  char *zName;                    /* Value of 'name' column */\n  char *zPath;                    /* Value of 'path' column */\n  u32 iPageno;                    /* Value of 'pageno' column */\n  char *zPagetype;                /* Value of 'pagetype' column */\n  int nCell;                      /* Value of 'ncell' column */\n  int nPayload;                   /* Value of 'payload' column */\n  int nUnused;                    /* Value of 'unused' column */\n  int nMxPayload;                 /* Value of 'mx_payload' column */\n  i64 iOffset;                    /* Value of 'pgOffset' column */\n  int szPage;                     /* Value of 'pgSize' column */\n};\n\nstruct StatTable {\n  sqlite3_vtab base;\n  sqlite3 *db;\n  int iDb;                        /* Index of database to analyze */\n};\n\n#ifndef get2byte\n# define get2byte(x)   ((x)[0]<<8 | (x)[1])\n#endif\n\n/*\n** Connect to or create a statvfs virtual table.\n*/\nstatic int statConnect(\n  sqlite3 *db,\n  void *pAux,\n  int argc, const char *const*argv,\n  sqlite3_vtab **ppVtab,\n  char **pzErr\n){\n  StatTable *pTab = 0;\n  int rc = SQLITE_OK;\n  int iDb;\n\n  if( argc>=4 ){\n    Token nm;\n    sqlite3TokenInit(&nm, (char*)argv[3]);\n    iDb = sqlite3FindDb(db, &nm);\n    if( iDb<0 ){\n      *pzErr = sqlite3_mprintf(\"no such database: %s\", argv[3]);\n      return SQLITE_ERROR;\n    }\n  }else{\n    iDb = 0;\n  }\n  rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);\n  if( rc==SQLITE_OK ){\n    pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));\n    if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;\n  }\n\n  assert( rc==SQLITE_OK || pTab==0 );\n  if( rc==SQLITE_OK ){\n    memset(pTab, 0, sizeof(StatTable));\n    pTab->db = db;\n    pTab->iDb = iDb;\n  }\n\n  *ppVtab = (sqlite3_vtab*)pTab;\n  return rc;\n}\n\n/*\n** Disconnect from or destroy a statvfs virtual table.\n*/\nstatic int statDisconnect(sqlite3_vtab *pVtab){\n  sqlite3_free(pVtab);\n  return SQLITE_OK;\n}\n\n/*\n** There is no \"best-index\". This virtual table always does a linear\n** scan.  However, a schema=? constraint should cause this table to\n** operate on a different database schema, so check for it.\n**\n** idxNum is normally 0, but will be 1 if a schema=? constraint exists.\n*/\nstatic int statBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){\n  int i;\n\n  pIdxInfo->estimatedCost = 1.0e6;  /* Initial cost estimate */\n\n  /* Look for a valid schema=? constraint.  If found, change the idxNum to\n  ** 1 and request the value of that constraint be sent to xFilter.  And\n  ** lower the cost estimate to encourage the constrained version to be\n  ** used.\n  */\n  for(i=0; i<pIdxInfo->nConstraint; i++){\n    if( pIdxInfo->aConstraint[i].usable==0 ) continue;\n    if( pIdxInfo->aConstraint[i].op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;\n    if( pIdxInfo->aConstraint[i].iColumn!=10 ) continue;\n    pIdxInfo->idxNum = 1;\n    pIdxInfo->estimatedCost = 1.0;\n    pIdxInfo->aConstraintUsage[i].argvIndex = 1;\n    pIdxInfo->aConstraintUsage[i].omit = 1;\n    break;\n  }\n\n\n  /* Records are always returned in ascending order of (name, path). \n  ** If this will satisfy the client, set the orderByConsumed flag so that \n  ** SQLite does not do an external sort.\n  */\n  if( ( pIdxInfo->nOrderBy==1\n     && pIdxInfo->aOrderBy[0].iColumn==0\n     && pIdxInfo->aOrderBy[0].desc==0\n     ) ||\n      ( pIdxInfo->nOrderBy==2\n     && pIdxInfo->aOrderBy[0].iColumn==0\n     && pIdxInfo->aOrderBy[0].desc==0\n     && pIdxInfo->aOrderBy[1].iColumn==1\n     && pIdxInfo->aOrderBy[1].desc==0\n     )\n  ){\n    pIdxInfo->orderByConsumed = 1;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Open a new statvfs cursor.\n*/\nstatic int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){\n  StatTable *pTab = (StatTable *)pVTab;\n  StatCursor *pCsr;\n\n  pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor));\n  if( pCsr==0 ){\n    return SQLITE_NOMEM_BKPT;\n  }else{\n    memset(pCsr, 0, sizeof(StatCursor));\n    pCsr->base.pVtab = pVTab;\n    pCsr->iDb = pTab->iDb;\n  }\n\n  *ppCursor = (sqlite3_vtab_cursor *)pCsr;\n  return SQLITE_OK;\n}\n\nstatic void statClearPage(StatPage *p){\n  int i;\n  if( p->aCell ){\n    for(i=0; i<p->nCell; i++){\n      sqlite3_free(p->aCell[i].aOvfl);\n    }\n    sqlite3_free(p->aCell);\n  }\n  sqlite3PagerUnref(p->pPg);\n  sqlite3_free(p->zPath);\n  memset(p, 0, sizeof(StatPage));\n}\n\nstatic void statResetCsr(StatCursor *pCsr){\n  int i;\n  sqlite3_reset(pCsr->pStmt);\n  for(i=0; i<ArraySize(pCsr->aPage); i++){\n    statClearPage(&pCsr->aPage[i]);\n  }\n  pCsr->iPage = 0;\n  sqlite3_free(pCsr->zPath);\n  pCsr->zPath = 0;\n  pCsr->isEof = 0;\n}\n\n/*\n** Close a statvfs cursor.\n*/\nstatic int statClose(sqlite3_vtab_cursor *pCursor){\n  StatCursor *pCsr = (StatCursor *)pCursor;\n  statResetCsr(pCsr);\n  sqlite3_finalize(pCsr->pStmt);\n  sqlite3_free(pCsr);\n  return SQLITE_OK;\n}\n\nstatic void getLocalPayload(\n  int nUsable,                    /* Usable bytes per page */\n  u8 flags,                       /* Page flags */\n  int nTotal,                     /* Total record (payload) size */\n  int *pnLocal                    /* OUT: Bytes stored locally */\n){\n  int nLocal;\n  int nMinLocal;\n  int nMaxLocal;\n \n  if( flags==0x0D ){              /* Table leaf node */\n    nMinLocal = (nUsable - 12) * 32 / 255 - 23;\n    nMaxLocal = nUsable - 35;\n  }else{                          /* Index interior and leaf nodes */\n    nMinLocal = (nUsable - 12) * 32 / 255 - 23;\n    nMaxLocal = (nUsable - 12) * 64 / 255 - 23;\n  }\n\n  nLocal = nMinLocal + (nTotal - nMinLocal) % (nUsable - 4);\n  if( nLocal>nMaxLocal ) nLocal = nMinLocal;\n  *pnLocal = nLocal;\n}\n\nstatic int statDecodePage(Btree *pBt, StatPage *p){\n  int nUnused;\n  int iOff;\n  int nHdr;\n  int isLeaf;\n  int szPage;\n\n  u8 *aData = sqlite3PagerGetData(p->pPg);\n  u8 *aHdr = &aData[p->iPgno==1 ? 100 : 0];\n\n  p->flags = aHdr[0];\n  p->nCell = get2byte(&aHdr[3]);\n  p->nMxPayload = 0;\n\n  isLeaf = (p->flags==0x0A || p->flags==0x0D);\n  nHdr = 12 - isLeaf*4 + (p->iPgno==1)*100;\n\n  nUnused = get2byte(&aHdr[5]) - nHdr - 2*p->nCell;\n  nUnused += (int)aHdr[7];\n  iOff = get2byte(&aHdr[1]);\n  while( iOff ){\n    nUnused += get2byte(&aData[iOff+2]);\n    iOff = get2byte(&aData[iOff]);\n  }\n  p->nUnused = nUnused;\n  p->iRightChildPg = isLeaf ? 0 : sqlite3Get4byte(&aHdr[8]);\n  szPage = sqlite3BtreeGetPageSize(pBt);\n\n  if( p->nCell ){\n    int i;                        /* Used to iterate through cells */\n    int nUsable;                  /* Usable bytes per page */\n\n    sqlite3BtreeEnter(pBt);\n    nUsable = szPage - sqlite3BtreeGetReserveNoMutex(pBt);\n    sqlite3BtreeLeave(pBt);\n    p->aCell = sqlite3_malloc64((p->nCell+1) * sizeof(StatCell));\n    if( p->aCell==0 ) return SQLITE_NOMEM_BKPT;\n    memset(p->aCell, 0, (p->nCell+1) * sizeof(StatCell));\n\n    for(i=0; i<p->nCell; i++){\n      StatCell *pCell = &p->aCell[i];\n\n      iOff = get2byte(&aData[nHdr+i*2]);\n      if( !isLeaf ){\n        pCell->iChildPg = sqlite3Get4byte(&aData[iOff]);\n        iOff += 4;\n      }\n      if( p->flags==0x05 ){\n        /* A table interior node. nPayload==0. */\n      }else{\n        u32 nPayload;             /* Bytes of payload total (local+overflow) */\n        int nLocal;               /* Bytes of payload stored locally */\n        iOff += getVarint32(&aData[iOff], nPayload);\n        if( p->flags==0x0D ){\n          u64 dummy;\n          iOff += sqlite3GetVarint(&aData[iOff], &dummy);\n        }\n        if( nPayload>(u32)p->nMxPayload ) p->nMxPayload = nPayload;\n        getLocalPayload(nUsable, p->flags, nPayload, &nLocal);\n        pCell->nLocal = nLocal;\n        assert( nLocal>=0 );\n        assert( nPayload>=(u32)nLocal );\n        assert( nLocal<=(nUsable-35) );\n        if( nPayload>(u32)nLocal ){\n          int j;\n          int nOvfl = ((nPayload - nLocal) + nUsable-4 - 1) / (nUsable - 4);\n          pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4);\n          pCell->nOvfl = nOvfl;\n          pCell->aOvfl = sqlite3_malloc64(sizeof(u32)*nOvfl);\n          if( pCell->aOvfl==0 ) return SQLITE_NOMEM_BKPT;\n          pCell->aOvfl[0] = sqlite3Get4byte(&aData[iOff+nLocal]);\n          for(j=1; j<nOvfl; j++){\n            int rc;\n            u32 iPrev = pCell->aOvfl[j-1];\n            DbPage *pPg = 0;\n            rc = sqlite3PagerGet(sqlite3BtreePager(pBt), iPrev, &pPg, 0);\n            if( rc!=SQLITE_OK ){\n              assert( pPg==0 );\n              return rc;\n            } \n            pCell->aOvfl[j] = sqlite3Get4byte(sqlite3PagerGetData(pPg));\n            sqlite3PagerUnref(pPg);\n          }\n        }\n      }\n    }\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on\n** the current value of pCsr->iPageno.\n*/\nstatic void statSizeAndOffset(StatCursor *pCsr){\n  StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;\n  Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;\n  Pager *pPager = sqlite3BtreePager(pBt);\n  sqlite3_file *fd;\n  sqlite3_int64 x[2];\n\n  /* The default page size and offset */\n  pCsr->szPage = sqlite3BtreeGetPageSize(pBt);\n  pCsr->iOffset = (i64)pCsr->szPage * (pCsr->iPageno - 1);\n\n  /* If connected to a ZIPVFS backend, override the page size and\n  ** offset with actual values obtained from ZIPVFS.\n  */\n  fd = sqlite3PagerFile(pPager);\n  x[0] = pCsr->iPageno;\n  if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){\n    pCsr->iOffset = x[0];\n    pCsr->szPage = (int)x[1];\n  }\n}\n\n/*\n** Move a statvfs cursor to the next entry in the file.\n*/\nstatic int statNext(sqlite3_vtab_cursor *pCursor){\n  int rc;\n  int nPayload;\n  char *z;\n  StatCursor *pCsr = (StatCursor *)pCursor;\n  StatTable *pTab = (StatTable *)pCursor->pVtab;\n  Btree *pBt = pTab->db->aDb[pCsr->iDb].pBt;\n  Pager *pPager = sqlite3BtreePager(pBt);\n\n  sqlite3_free(pCsr->zPath);\n  pCsr->zPath = 0;\n\nstatNextRestart:\n  if( pCsr->aPage[0].pPg==0 ){\n    rc = sqlite3_step(pCsr->pStmt);\n    if( rc==SQLITE_ROW ){\n      int nPage;\n      u32 iRoot = (u32)sqlite3_column_int64(pCsr->pStmt, 1);\n      sqlite3PagerPagecount(pPager, &nPage);\n      if( nPage==0 ){\n        pCsr->isEof = 1;\n        return sqlite3_reset(pCsr->pStmt);\n      }\n      rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg, 0);\n      pCsr->aPage[0].iPgno = iRoot;\n      pCsr->aPage[0].iCell = 0;\n      pCsr->aPage[0].zPath = z = sqlite3_mprintf(\"/\");\n      pCsr->iPage = 0;\n      if( z==0 ) rc = SQLITE_NOMEM_BKPT;\n    }else{\n      pCsr->isEof = 1;\n      return sqlite3_reset(pCsr->pStmt);\n    }\n  }else{\n\n    /* Page p itself has already been visited. */\n    StatPage *p = &pCsr->aPage[pCsr->iPage];\n\n    while( p->iCell<p->nCell ){\n      StatCell *pCell = &p->aCell[p->iCell];\n      if( pCell->iOvfl<pCell->nOvfl ){\n        int nUsable;\n        sqlite3BtreeEnter(pBt);\n        nUsable = sqlite3BtreeGetPageSize(pBt) - \n                        sqlite3BtreeGetReserveNoMutex(pBt);\n        sqlite3BtreeLeave(pBt);\n        pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);\n        pCsr->iPageno = pCell->aOvfl[pCell->iOvfl];\n        pCsr->zPagetype = \"overflow\";\n        pCsr->nCell = 0;\n        pCsr->nMxPayload = 0;\n        pCsr->zPath = z = sqlite3_mprintf(\n            \"%s%.3x+%.6x\", p->zPath, p->iCell, pCell->iOvfl\n        );\n        if( pCell->iOvfl<pCell->nOvfl-1 ){\n          pCsr->nUnused = 0;\n          pCsr->nPayload = nUsable - 4;\n        }else{\n          pCsr->nPayload = pCell->nLastOvfl;\n          pCsr->nUnused = nUsable - 4 - pCsr->nPayload;\n        }\n        pCell->iOvfl++;\n        statSizeAndOffset(pCsr);\n        return z==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;\n      }\n      if( p->iRightChildPg ) break;\n      p->iCell++;\n    }\n\n    if( !p->iRightChildPg || p->iCell>p->nCell ){\n      statClearPage(p);\n      if( pCsr->iPage==0 ) return statNext(pCursor);\n      pCsr->iPage--;\n      goto statNextRestart; /* Tail recursion */\n    }\n    pCsr->iPage++;\n    assert( p==&pCsr->aPage[pCsr->iPage-1] );\n\n    if( p->iCell==p->nCell ){\n      p[1].iPgno = p->iRightChildPg;\n    }else{\n      p[1].iPgno = p->aCell[p->iCell].iChildPg;\n    }\n    rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg, 0);\n    p[1].iCell = 0;\n    p[1].zPath = z = sqlite3_mprintf(\"%s%.3x/\", p->zPath, p->iCell);\n    p->iCell++;\n    if( z==0 ) rc = SQLITE_NOMEM_BKPT;\n  }\n\n\n  /* Populate the StatCursor fields with the values to be returned\n  ** by the xColumn() and xRowid() methods.\n  */\n  if( rc==SQLITE_OK ){\n    int i;\n    StatPage *p = &pCsr->aPage[pCsr->iPage];\n    pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);\n    pCsr->iPageno = p->iPgno;\n\n    rc = statDecodePage(pBt, p);\n    if( rc==SQLITE_OK ){\n      statSizeAndOffset(pCsr);\n\n      switch( p->flags ){\n        case 0x05:             /* table internal */\n        case 0x02:             /* index internal */\n          pCsr->zPagetype = \"internal\";\n          break;\n        case 0x0D:             /* table leaf */\n        case 0x0A:             /* index leaf */\n          pCsr->zPagetype = \"leaf\";\n          break;\n        default:\n          pCsr->zPagetype = \"corrupted\";\n          break;\n      }\n      pCsr->nCell = p->nCell;\n      pCsr->nUnused = p->nUnused;\n      pCsr->nMxPayload = p->nMxPayload;\n      pCsr->zPath = z = sqlite3_mprintf(\"%s\", p->zPath);\n      if( z==0 ) rc = SQLITE_NOMEM_BKPT;\n      nPayload = 0;\n      for(i=0; i<p->nCell; i++){\n        nPayload += p->aCell[i].nLocal;\n      }\n      pCsr->nPayload = nPayload;\n    }\n  }\n\n  return rc;\n}\n\nstatic int statEof(sqlite3_vtab_cursor *pCursor){\n  StatCursor *pCsr = (StatCursor *)pCursor;\n  return pCsr->isEof;\n}\n\nstatic int statFilter(\n  sqlite3_vtab_cursor *pCursor, \n  int idxNum, const char *idxStr,\n  int argc, sqlite3_value **argv\n){\n  StatCursor *pCsr = (StatCursor *)pCursor;\n  StatTable *pTab = (StatTable*)(pCursor->pVtab);\n  char *zSql;\n  int rc = SQLITE_OK;\n  char *zMaster;\n\n  if( idxNum==1 ){\n    const char *zDbase = (const char*)sqlite3_value_text(argv[0]);\n    pCsr->iDb = sqlite3FindDbName(pTab->db, zDbase);\n    if( pCsr->iDb<0 ){\n      sqlite3_free(pCursor->pVtab->zErrMsg);\n      pCursor->pVtab->zErrMsg = sqlite3_mprintf(\"no such schema: %s\", zDbase);\n      return pCursor->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM_BKPT;\n    }\n  }else{\n    pCsr->iDb = pTab->iDb;\n  }\n  statResetCsr(pCsr);\n  sqlite3_finalize(pCsr->pStmt);\n  pCsr->pStmt = 0;\n  zMaster = pCsr->iDb==1 ? \"sqlite_temp_master\" : \"sqlite_master\";\n  zSql = sqlite3_mprintf(\n      \"SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type\"\n      \"  UNION ALL  \"\n      \"SELECT name, rootpage, type\"\n      \"  FROM \\\"%w\\\".%s WHERE rootpage!=0\"\n      \"  ORDER BY name\", pTab->db->aDb[pCsr->iDb].zDbSName, zMaster);\n  if( zSql==0 ){\n    return SQLITE_NOMEM_BKPT;\n  }else{\n    rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);\n    sqlite3_free(zSql);\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = statNext(pCursor);\n  }\n  return rc;\n}\n\nstatic int statColumn(\n  sqlite3_vtab_cursor *pCursor, \n  sqlite3_context *ctx, \n  int i\n){\n  StatCursor *pCsr = (StatCursor *)pCursor;\n  switch( i ){\n    case 0:            /* name */\n      sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT);\n      break;\n    case 1:            /* path */\n      sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);\n      break;\n    case 2:            /* pageno */\n      sqlite3_result_int64(ctx, pCsr->iPageno);\n      break;\n    case 3:            /* pagetype */\n      sqlite3_result_text(ctx, pCsr->zPagetype, -1, SQLITE_STATIC);\n      break;\n    case 4:            /* ncell */\n      sqlite3_result_int(ctx, pCsr->nCell);\n      break;\n    case 5:            /* payload */\n      sqlite3_result_int(ctx, pCsr->nPayload);\n      break;\n    case 6:            /* unused */\n      sqlite3_result_int(ctx, pCsr->nUnused);\n      break;\n    case 7:            /* mx_payload */\n      sqlite3_result_int(ctx, pCsr->nMxPayload);\n      break;\n    case 8:            /* pgoffset */\n      sqlite3_result_int64(ctx, pCsr->iOffset);\n      break;\n    case 9:            /* pgsize */\n      sqlite3_result_int(ctx, pCsr->szPage);\n      break;\n    default: {          /* schema */\n      sqlite3 *db = sqlite3_context_db_handle(ctx);\n      int iDb = pCsr->iDb;\n      sqlite3_result_text(ctx, db->aDb[iDb].zDbSName, -1, SQLITE_STATIC);\n      break;\n    }\n  }\n  return SQLITE_OK;\n}\n\nstatic int statRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){\n  StatCursor *pCsr = (StatCursor *)pCursor;\n  *pRowid = pCsr->iPageno;\n  return SQLITE_OK;\n}\n\n/*\n** Invoke this routine to register the \"dbstat\" virtual table module\n*/\nint sqlite3DbstatRegister(sqlite3 *db){\n  static sqlite3_module dbstat_module = {\n    0,                            /* iVersion */\n    statConnect,                  /* xCreate */\n    statConnect,                  /* xConnect */\n    statBestIndex,                /* xBestIndex */\n    statDisconnect,               /* xDisconnect */\n    statDisconnect,               /* xDestroy */\n    statOpen,                     /* xOpen - open a cursor */\n    statClose,                    /* xClose - close a cursor */\n    statFilter,                   /* xFilter - configure scan constraints */\n    statNext,                     /* xNext - advance a cursor */\n    statEof,                      /* xEof - check for end of scan */\n    statColumn,                   /* xColumn - read data */\n    statRowid,                    /* xRowid - read data */\n    0,                            /* xUpdate */\n    0,                            /* xBegin */\n    0,                            /* xSync */\n    0,                            /* xCommit */\n    0,                            /* xRollback */\n    0,                            /* xFindMethod */\n    0,                            /* xRename */\n  };\n  return sqlite3_create_module(db, \"dbstat\", &dbstat_module, 0);\n}\n#elif defined(SQLITE_ENABLE_DBSTAT_VTAB)\nint sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }\n#endif /* SQLITE_ENABLE_DBSTAT_VTAB */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/delete.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains C code routines that are called by the parser\n** in order to generate code for DELETE FROM statements.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** While a SrcList can in general represent multiple tables and subqueries\n** (as in the FROM clause of a SELECT statement) in this case it contains\n** the name of a single table, as one might find in an INSERT, DELETE,\n** or UPDATE statement.  Look up that table in the symbol table and\n** return a pointer.  Set an error message and return NULL if the table \n** name is not found or if any other error occurs.\n**\n** The following fields are initialized appropriate in pSrc:\n**\n**    pSrc->a[0].pTab       Pointer to the Table object\n**    pSrc->a[0].pIndex     Pointer to the INDEXED BY index, if there is one\n**\n*/\nTable *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){\n  struct SrcList_item *pItem = pSrc->a;\n  Table *pTab;\n  assert( pItem && pSrc->nSrc==1 );\n  pTab = sqlite3LocateTableItem(pParse, 0, pItem);\n  sqlite3DeleteTable(pParse->db, pItem->pTab);\n  pItem->pTab = pTab;\n  if( pTab ){\n    pTab->nRef++;\n  }\n  if( sqlite3IndexedByLookup(pParse, pItem) ){\n    pTab = 0;\n  }\n  return pTab;\n}\n\n/*\n** Check to make sure the given table is writable.  If it is not\n** writable, generate an error message and return 1.  If it is\n** writable return 0;\n*/\nint sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){\n  /* A table is not writable under the following circumstances:\n  **\n  **   1) It is a virtual table and no implementation of the xUpdate method\n  **      has been provided, or\n  **   2) It is a system table (i.e. sqlite_master), this call is not\n  **      part of a nested parse and writable_schema pragma has not \n  **      been specified.\n  **\n  ** In either case leave an error message in pParse and return non-zero.\n  */\n  if( ( IsVirtual(pTab) \n     && sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 )\n   || ( (pTab->tabFlags & TF_Readonly)!=0\n     && (pParse->db->flags & SQLITE_WriteSchema)==0\n     && pParse->nested==0 )\n  ){\n    sqlite3ErrorMsg(pParse, \"table %s may not be modified\", pTab->zName);\n    return 1;\n  }\n\n#ifndef SQLITE_OMIT_VIEW\n  if( !viewOk && pTab->pSelect ){\n    sqlite3ErrorMsg(pParse,\"cannot modify %s because it is a view\",pTab->zName);\n    return 1;\n  }\n#endif\n  return 0;\n}\n\n\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\n/*\n** Evaluate a view and store its result in an ephemeral table.  The\n** pWhere argument is an optional WHERE clause that restricts the\n** set of rows in the view that are to be added to the ephemeral table.\n*/\nvoid sqlite3MaterializeView(\n  Parse *pParse,       /* Parsing context */\n  Table *pView,        /* View definition */\n  Expr *pWhere,        /* Optional WHERE clause to be added */\n  int iCur             /* Cursor number for ephemeral table */\n){\n  SelectDest dest;\n  Select *pSel;\n  SrcList *pFrom;\n  sqlite3 *db = pParse->db;\n  int iDb = sqlite3SchemaToIndex(db, pView->pSchema);\n  pWhere = sqlite3ExprDup(db, pWhere, 0);\n  pFrom = sqlite3SrcListAppend(db, 0, 0, 0);\n  if( pFrom ){\n    assert( pFrom->nSrc==1 );\n    pFrom->a[0].zName = sqlite3DbStrDup(db, pView->zName);\n    pFrom->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zDbSName);\n    assert( pFrom->a[0].pOn==0 );\n    assert( pFrom->a[0].pUsing==0 );\n  }\n  pSel = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, \n                          SF_IncludeHidden, 0, 0);\n  sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);\n  sqlite3Select(pParse, pSel, &dest);\n  sqlite3SelectDelete(db, pSel);\n}\n#endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */\n\n#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)\n/*\n** Generate an expression tree to implement the WHERE, ORDER BY,\n** and LIMIT/OFFSET portion of DELETE and UPDATE statements.\n**\n**     DELETE FROM table_wxyz WHERE a<5 ORDER BY a LIMIT 1;\n**                            \\__________________________/\n**                               pLimitWhere (pInClause)\n*/\nExpr *sqlite3LimitWhere(\n  Parse *pParse,               /* The parser context */\n  SrcList *pSrc,               /* the FROM clause -- which tables to scan */\n  Expr *pWhere,                /* The WHERE clause.  May be null */\n  ExprList *pOrderBy,          /* The ORDER BY clause.  May be null */\n  Expr *pLimit,                /* The LIMIT clause.  May be null */\n  Expr *pOffset,               /* The OFFSET clause.  May be null */\n  char *zStmtType              /* Either DELETE or UPDATE.  For err msgs. */\n){\n  Expr *pWhereRowid = NULL;    /* WHERE rowid .. */\n  Expr *pInClause = NULL;      /* WHERE rowid IN ( select ) */\n  Expr *pSelectRowid = NULL;   /* SELECT rowid ... */\n  ExprList *pEList = NULL;     /* Expression list contaning only pSelectRowid */\n  SrcList *pSelectSrc = NULL;  /* SELECT rowid FROM x ... (dup of pSrc) */\n  Select *pSelect = NULL;      /* Complete SELECT tree */\n\n  /* Check that there isn't an ORDER BY without a LIMIT clause.\n  */\n  if( pOrderBy && (pLimit == 0) ) {\n    sqlite3ErrorMsg(pParse, \"ORDER BY without LIMIT on %s\", zStmtType);\n    goto limit_where_cleanup;\n  }\n\n  /* We only need to generate a select expression if there\n  ** is a limit/offset term to enforce.\n  */\n  if( pLimit == 0 ) {\n    /* if pLimit is null, pOffset will always be null as well. */\n    assert( pOffset == 0 );\n    return pWhere;\n  }\n\n  /* Generate a select expression tree to enforce the limit/offset \n  ** term for the DELETE or UPDATE statement.  For example:\n  **   DELETE FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1\n  ** becomes:\n  **   DELETE FROM table_a WHERE rowid IN ( \n  **     SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1\n  **   );\n  */\n\n  pSelectRowid = sqlite3PExpr(pParse, TK_ROW, 0, 0, 0);\n  if( pSelectRowid == 0 ) goto limit_where_cleanup;\n  pEList = sqlite3ExprListAppend(pParse, 0, pSelectRowid);\n  if( pEList == 0 ) goto limit_where_cleanup;\n\n  /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree\n  ** and the SELECT subtree. */\n  pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0);\n  if( pSelectSrc == 0 ) {\n    sqlite3ExprListDelete(pParse->db, pEList);\n    goto limit_where_cleanup;\n  }\n\n  /* generate the SELECT expression tree. */\n  pSelect = sqlite3SelectNew(pParse,pEList,pSelectSrc,pWhere,0,0,\n                             pOrderBy,0,pLimit,pOffset);\n  if( pSelect == 0 ) return 0;\n\n  /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */\n  pWhereRowid = sqlite3PExpr(pParse, TK_ROW, 0, 0, 0);\n  pInClause = pWhereRowid ? sqlite3PExpr(pParse, TK_IN, pWhereRowid, 0, 0) : 0;\n  sqlite3PExprAddSelect(pParse, pInClause, pSelect);\n  return pInClause;\n\nlimit_where_cleanup:\n  sqlite3ExprDelete(pParse->db, pWhere);\n  sqlite3ExprListDelete(pParse->db, pOrderBy);\n  sqlite3ExprDelete(pParse->db, pLimit);\n  sqlite3ExprDelete(pParse->db, pOffset);\n  return 0;\n}\n#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) */\n       /*      && !defined(SQLITE_OMIT_SUBQUERY) */\n\n/*\n** Generate code for a DELETE FROM statement.\n**\n**     DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;\n**                 \\________/       \\________________/\n**                  pTabList              pWhere\n*/\nvoid sqlite3DeleteFrom(\n  Parse *pParse,         /* The parser context */\n  SrcList *pTabList,     /* The table from which we should delete things */\n  Expr *pWhere           /* The WHERE clause.  May be null */\n){\n  Vdbe *v;               /* The virtual database engine */\n  Table *pTab;           /* The table from which records will be deleted */\n  int i;                 /* Loop counter */\n  WhereInfo *pWInfo;     /* Information about the WHERE clause */\n  Index *pIdx;           /* For looping over indices of the table */\n  int iTabCur;           /* Cursor number for the table */\n  int iDataCur = 0;      /* VDBE cursor for the canonical data source */\n  int iIdxCur = 0;       /* Cursor number of the first index */\n  int nIdx;              /* Number of indices */\n  sqlite3 *db;           /* Main database structure */\n  AuthContext sContext;  /* Authorization context */\n  NameContext sNC;       /* Name context to resolve expressions in */\n  int iDb;               /* Database number */\n  int memCnt = -1;       /* Memory cell used for change counting */\n  int rcauth;            /* Value returned by authorization callback */\n  int eOnePass;          /* ONEPASS_OFF or _SINGLE or _MULTI */\n  int aiCurOnePass[2];   /* The write cursors opened by WHERE_ONEPASS */\n  u8 *aToOpen = 0;       /* Open cursor iTabCur+j if aToOpen[j] is true */\n  Index *pPk;            /* The PRIMARY KEY index on the table */\n  int iPk = 0;           /* First of nPk registers holding PRIMARY KEY value */\n  i16 nPk = 1;           /* Number of columns in the PRIMARY KEY */\n  int iKey;              /* Memory cell holding key of row to be deleted */\n  i16 nKey;              /* Number of memory cells in the row key */\n  int iEphCur = 0;       /* Ephemeral table holding all primary key values */\n  int iRowSet = 0;       /* Register for rowset of rows to delete */\n  int addrBypass = 0;    /* Address of jump over the delete logic */\n  int addrLoop = 0;      /* Top of the delete loop */\n  int addrEphOpen = 0;   /* Instruction to open the Ephemeral table */\n  int bComplex;          /* True if there are triggers or FKs or\n                         ** subqueries in the WHERE clause */\n \n#ifndef SQLITE_OMIT_TRIGGER\n  int isView;                  /* True if attempting to delete from a view */\n  Trigger *pTrigger;           /* List of table triggers, if required */\n#endif\n\n  memset(&sContext, 0, sizeof(sContext));\n  db = pParse->db;\n  if( pParse->nErr || db->mallocFailed ){\n    goto delete_from_cleanup;\n  }\n  assert( pTabList->nSrc==1 );\n\n  /* Locate the table which we want to delete.  This table has to be\n  ** put in an SrcList structure because some of the subroutines we\n  ** will be calling are designed to work with multiple tables and expect\n  ** an SrcList* parameter instead of just a Table* parameter.\n  */\n  pTab = sqlite3SrcListLookup(pParse, pTabList);\n  if( pTab==0 )  goto delete_from_cleanup;\n\n  /* Figure out if we have any triggers and if the table being\n  ** deleted from is a view\n  */\n#ifndef SQLITE_OMIT_TRIGGER\n  pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);\n  isView = pTab->pSelect!=0;\n  bComplex = pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0);\n#else\n# define pTrigger 0\n# define isView 0\n#endif\n#ifdef SQLITE_OMIT_VIEW\n# undef isView\n# define isView 0\n#endif\n\n  /* If pTab is really a view, make sure it has been initialized.\n  */\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\n    goto delete_from_cleanup;\n  }\n\n  if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){\n    goto delete_from_cleanup;\n  }\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n  assert( iDb<db->nDb );\n  rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, \n                            db->aDb[iDb].zDbSName);\n  assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE );\n  if( rcauth==SQLITE_DENY ){\n    goto delete_from_cleanup;\n  }\n  assert(!isView || pTrigger);\n\n  /* Assign cursor numbers to the table and all its indices.\n  */\n  assert( pTabList->nSrc==1 );\n  iTabCur = pTabList->a[0].iCursor = pParse->nTab++;\n  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){\n    pParse->nTab++;\n  }\n\n  /* Start the view context\n  */\n  if( isView ){\n    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);\n  }\n\n  /* Begin generating code.\n  */\n  v = sqlite3GetVdbe(pParse);\n  if( v==0 ){\n    goto delete_from_cleanup;\n  }\n  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);\n  sqlite3BeginWriteOperation(pParse, 1, iDb);\n\n  /* If we are trying to delete from a view, realize that view into\n  ** an ephemeral table.\n  */\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\n  if( isView ){\n    sqlite3MaterializeView(pParse, pTab, pWhere, iTabCur);\n    iDataCur = iIdxCur = iTabCur;\n  }\n#endif\n\n  /* Resolve the column names in the WHERE clause.\n  */\n  memset(&sNC, 0, sizeof(sNC));\n  sNC.pParse = pParse;\n  sNC.pSrcList = pTabList;\n  if( sqlite3ResolveExprNames(&sNC, pWhere) ){\n    goto delete_from_cleanup;\n  }\n\n  /* Initialize the counter of the number of rows deleted, if\n  ** we are counting rows.\n  */\n  if( db->flags & SQLITE_CountRows ){\n    memCnt = ++pParse->nMem;\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);\n  }\n\n#ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION\n  /* Special case: A DELETE without a WHERE clause deletes everything.\n  ** It is easier just to erase the whole table. Prior to version 3.6.5,\n  ** this optimization caused the row change count (the value returned by \n  ** API function sqlite3_count_changes) to be set incorrectly.  */\n  if( rcauth==SQLITE_OK\n   && pWhere==0\n   && !bComplex\n   && !IsVirtual(pTab)\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n   && db->xPreUpdateCallback==0\n#endif\n  ){\n    assert( !isView );\n    sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);\n    if( HasRowid(pTab) ){\n      sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,\n                        pTab->zName, P4_STATIC);\n    }\n    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n      assert( pIdx->pSchema==pTab->pSchema );\n      sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);\n    }\n  }else\n#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */\n  {\n    u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK|WHERE_SEEK_TABLE;\n    if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;\n    wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);\n    if( HasRowid(pTab) ){\n      /* For a rowid table, initialize the RowSet to an empty set */\n      pPk = 0;\n      nPk = 1;\n      iRowSet = ++pParse->nMem;\n      sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet);\n    }else{\n      /* For a WITHOUT ROWID table, create an ephemeral table used to\n      ** hold all primary keys for rows to be deleted. */\n      pPk = sqlite3PrimaryKeyIndex(pTab);\n      assert( pPk!=0 );\n      nPk = pPk->nKeyCol;\n      iPk = pParse->nMem+1;\n      pParse->nMem += nPk;\n      iEphCur = pParse->nTab++;\n      addrEphOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEphCur, nPk);\n      sqlite3VdbeSetP4KeyInfo(pParse, pPk);\n    }\n  \n    /* Construct a query to find the rowid or primary key for every row\n    ** to be deleted, based on the WHERE clause. Set variable eOnePass\n    ** to indicate the strategy used to implement this delete:\n    **\n    **  ONEPASS_OFF:    Two-pass approach - use a FIFO for rowids/PK values.\n    **  ONEPASS_SINGLE: One-pass approach - at most one row deleted.\n    **  ONEPASS_MULTI:  One-pass approach - any number of rows may be deleted.\n    */\n    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1);\n    if( pWInfo==0 ) goto delete_from_cleanup;\n    eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);\n    assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI );\n    assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF );\n  \n    /* Keep track of the number of rows to be deleted */\n    if( db->flags & SQLITE_CountRows ){\n      sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);\n    }\n  \n    /* Extract the rowid or primary key for the current row */\n    if( pPk ){\n      for(i=0; i<nPk; i++){\n        assert( pPk->aiColumn[i]>=0 );\n        sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,\n                                        pPk->aiColumn[i], iPk+i);\n      }\n      iKey = iPk;\n    }else{\n      iKey = pParse->nMem + 1;\n      iKey = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iTabCur, iKey, 0);\n      if( iKey>pParse->nMem ) pParse->nMem = iKey;\n    }\n  \n    if( eOnePass!=ONEPASS_OFF ){\n      /* For ONEPASS, no need to store the rowid/primary-key. There is only\n      ** one, so just keep it in its register(s) and fall through to the\n      ** delete code.  */\n      nKey = nPk; /* OP_Found will use an unpacked key */\n      aToOpen = sqlite3DbMallocRawNN(db, nIdx+2);\n      if( aToOpen==0 ){\n        sqlite3WhereEnd(pWInfo);\n        goto delete_from_cleanup;\n      }\n      memset(aToOpen, 1, nIdx+1);\n      aToOpen[nIdx+1] = 0;\n      if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0;\n      if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0;\n      if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen);\n    }else{\n      if( pPk ){\n        /* Add the PK key for this row to the temporary table */\n        iKey = ++pParse->nMem;\n        nKey = 0;   /* Zero tells OP_Found to use a composite key */\n        sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, iKey,\n            sqlite3IndexAffinityStr(pParse->db, pPk), nPk);\n        sqlite3VdbeAddOp2(v, OP_IdxInsert, iEphCur, iKey);\n      }else{\n        /* Add the rowid of the row to be deleted to the RowSet */\n        nKey = 1;  /* OP_Seek always uses a single rowid */\n        sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey);\n      }\n    }\n  \n    /* If this DELETE cannot use the ONEPASS strategy, this is the \n    ** end of the WHERE loop */\n    if( eOnePass!=ONEPASS_OFF ){\n      addrBypass = sqlite3VdbeMakeLabel(v);\n    }else{\n      sqlite3WhereEnd(pWInfo);\n    }\n  \n    /* Unless this is a view, open cursors for the table we are \n    ** deleting from and all its indices. If this is a view, then the\n    ** only effect this statement has is to fire the INSTEAD OF \n    ** triggers.\n    */\n    if( !isView ){\n      int iAddrOnce = 0;\n      if( eOnePass==ONEPASS_MULTI ){\n        iAddrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);\n      }\n      testcase( IsVirtual(pTab) );\n      sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE,\n                                 iTabCur, aToOpen, &iDataCur, &iIdxCur);\n      assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );\n      assert( pPk || IsVirtual(pTab) || iIdxCur==iDataCur+1 );\n      if( eOnePass==ONEPASS_MULTI ) sqlite3VdbeJumpHere(v, iAddrOnce);\n    }\n  \n    /* Set up a loop over the rowids/primary-keys that were found in the\n    ** where-clause loop above.\n    */\n    if( eOnePass!=ONEPASS_OFF ){\n      assert( nKey==nPk );  /* OP_Found will use an unpacked key */\n      if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){\n        assert( pPk!=0 || pTab->pSelect!=0 );\n        sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey);\n        VdbeCoverage(v);\n      }\n    }else if( pPk ){\n      addrLoop = sqlite3VdbeAddOp1(v, OP_Rewind, iEphCur); VdbeCoverage(v);\n      sqlite3VdbeAddOp2(v, OP_RowKey, iEphCur, iKey);\n      assert( nKey==0 );  /* OP_Found will use a composite key */\n    }else{\n      addrLoop = sqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, 0, iKey);\n      VdbeCoverage(v);\n      assert( nKey==1 );\n    }  \n  \n    /* Delete the row */\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    if( IsVirtual(pTab) ){\n      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);\n      sqlite3VtabMakeWritable(pParse, pTab);\n      sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB);\n      sqlite3VdbeChangeP5(v, OE_Abort);\n      assert( eOnePass==ONEPASS_OFF || eOnePass==ONEPASS_SINGLE );\n      sqlite3MayAbort(pParse);\n      if( eOnePass==ONEPASS_SINGLE && sqlite3IsToplevel(pParse) ){\n        pParse->isMultiWrite = 0;\n      }\n    }else\n#endif\n    {\n      int count = (pParse->nested==0);    /* True to count changes */\n      int iIdxNoSeek = -1;\n      if( bComplex==0 && aiCurOnePass[1]!=iDataCur ){\n        iIdxNoSeek = aiCurOnePass[1];\n      }\n      sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,\n          iKey, nKey, count, OE_Default, eOnePass, iIdxNoSeek);\n    }\n  \n    /* End of the loop over all rowids/primary-keys. */\n    if( eOnePass!=ONEPASS_OFF ){\n      sqlite3VdbeResolveLabel(v, addrBypass);\n      sqlite3WhereEnd(pWInfo);\n    }else if( pPk ){\n      sqlite3VdbeAddOp2(v, OP_Next, iEphCur, addrLoop+1); VdbeCoverage(v);\n      sqlite3VdbeJumpHere(v, addrLoop);\n    }else{\n      sqlite3VdbeGoto(v, addrLoop);\n      sqlite3VdbeJumpHere(v, addrLoop);\n    }     \n  \n    /* Close the cursors open on the table and its indexes. */\n    if( !isView && !IsVirtual(pTab) ){\n      if( !pPk ) sqlite3VdbeAddOp1(v, OP_Close, iDataCur);\n      for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){\n        sqlite3VdbeAddOp1(v, OP_Close, iIdxCur + i);\n      }\n    }\n  } /* End non-truncate path */\n\n  /* Update the sqlite_sequence table by storing the content of the\n  ** maximum rowid counter values recorded while inserting into\n  ** autoincrement tables.\n  */\n  if( pParse->nested==0 && pParse->pTriggerTab==0 ){\n    sqlite3AutoincrementEnd(pParse);\n  }\n\n  /* Return the number of rows that were deleted. If this routine is \n  ** generating code because of a call to sqlite3NestedParse(), do not\n  ** invoke the callback function.\n  */\n  if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){\n    sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);\n    sqlite3VdbeSetNumCols(v, 1);\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"rows deleted\", SQLITE_STATIC);\n  }\n\ndelete_from_cleanup:\n  sqlite3AuthContextPop(&sContext);\n  sqlite3SrcListDelete(db, pTabList);\n  sqlite3ExprDelete(db, pWhere);\n  sqlite3DbFree(db, aToOpen);\n  return;\n}\n/* Make sure \"isView\" and other macros defined above are undefined. Otherwise\n** they may interfere with compilation of other functions in this file\n** (or in another file, if this file becomes part of the amalgamation).  */\n#ifdef isView\n #undef isView\n#endif\n#ifdef pTrigger\n #undef pTrigger\n#endif\n\n/*\n** This routine generates VDBE code that causes a single row of a\n** single table to be deleted.  Both the original table entry and\n** all indices are removed.\n**\n** Preconditions:\n**\n**   1.  iDataCur is an open cursor on the btree that is the canonical data\n**       store for the table.  (This will be either the table itself,\n**       in the case of a rowid table, or the PRIMARY KEY index in the case\n**       of a WITHOUT ROWID table.)\n**\n**   2.  Read/write cursors for all indices of pTab must be open as\n**       cursor number iIdxCur+i for the i-th index.\n**\n**   3.  The primary key for the row to be deleted must be stored in a\n**       sequence of nPk memory cells starting at iPk.  If nPk==0 that means\n**       that a search record formed from OP_MakeRecord is contained in the\n**       single memory location iPk.\n**\n** eMode:\n**   Parameter eMode may be passed either ONEPASS_OFF (0), ONEPASS_SINGLE, or\n**   ONEPASS_MULTI.  If eMode is not ONEPASS_OFF, then the cursor\n**   iDataCur already points to the row to delete. If eMode is ONEPASS_OFF\n**   then this function must seek iDataCur to the entry identified by iPk\n**   and nPk before reading from it.\n**\n**   If eMode is ONEPASS_MULTI, then this call is being made as part\n**   of a ONEPASS delete that affects multiple rows. In this case, if \n**   iIdxNoSeek is a valid cursor number (>=0), then its position should\n**   be preserved following the delete operation. Or, if iIdxNoSeek is not\n**   a valid cursor number, the position of iDataCur should be preserved\n**   instead.\n**\n** iIdxNoSeek:\n**   If iIdxNoSeek is a valid cursor number (>=0), then it identifies an\n**   index cursor (from within array of cursors starting at iIdxCur) that\n**   already points to the index entry to be deleted.\n*/\nvoid sqlite3GenerateRowDelete(\n  Parse *pParse,     /* Parsing context */\n  Table *pTab,       /* Table containing the row to be deleted */\n  Trigger *pTrigger, /* List of triggers to (potentially) fire */\n  int iDataCur,      /* Cursor from which column data is extracted */\n  int iIdxCur,       /* First index cursor */\n  int iPk,           /* First memory cell containing the PRIMARY KEY */\n  i16 nPk,           /* Number of PRIMARY KEY memory cells */\n  u8 count,          /* If non-zero, increment the row change counter */\n  u8 onconf,         /* Default ON CONFLICT policy for triggers */\n  u8 eMode,          /* ONEPASS_OFF, _SINGLE, or _MULTI.  See above */\n  int iIdxNoSeek     /* Cursor number of cursor that does not need seeking */\n){\n  Vdbe *v = pParse->pVdbe;        /* Vdbe */\n  int iOld = 0;                   /* First register in OLD.* array */\n  int iLabel;                     /* Label resolved to end of generated code */\n  u8 opSeek;                      /* Seek opcode */\n\n  /* Vdbe is guaranteed to have been allocated by this stage. */\n  assert( v );\n  VdbeModuleComment((v, \"BEGIN: GenRowDel(%d,%d,%d,%d)\",\n                         iDataCur, iIdxCur, iPk, (int)nPk));\n\n  /* Seek cursor iCur to the row to delete. If this row no longer exists \n  ** (this can happen if a trigger program has already deleted it), do\n  ** not attempt to delete it or fire any DELETE triggers.  */\n  iLabel = sqlite3VdbeMakeLabel(v);\n  opSeek = HasRowid(pTab) ? OP_NotExists : OP_NotFound;\n  if( eMode==ONEPASS_OFF ){\n    sqlite3VdbeAddOp4Int(v, opSeek, iDataCur, iLabel, iPk, nPk);\n    VdbeCoverageIf(v, opSeek==OP_NotExists);\n    VdbeCoverageIf(v, opSeek==OP_NotFound);\n  }\n \n  /* If there are any triggers to fire, allocate a range of registers to\n  ** use for the old.* references in the triggers.  */\n  if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){\n    u32 mask;                     /* Mask of OLD.* columns in use */\n    int iCol;                     /* Iterator used while populating OLD.* */\n    int addrStart;                /* Start of BEFORE trigger programs */\n\n    /* TODO: Could use temporary registers here. Also could attempt to\n    ** avoid copying the contents of the rowid register.  */\n    mask = sqlite3TriggerColmask(\n        pParse, pTrigger, 0, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onconf\n    );\n    mask |= sqlite3FkOldmask(pParse, pTab);\n    iOld = pParse->nMem+1;\n    pParse->nMem += (1 + pTab->nCol);\n\n    /* Populate the OLD.* pseudo-table register array. These values will be \n    ** used by any BEFORE and AFTER triggers that exist.  */\n    sqlite3VdbeAddOp2(v, OP_Copy, iPk, iOld);\n    for(iCol=0; iCol<pTab->nCol; iCol++){\n      testcase( mask!=0xffffffff && iCol==31 );\n      testcase( mask!=0xffffffff && iCol==32 );\n      if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){\n        sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+iCol+1);\n      }\n    }\n\n    /* Invoke BEFORE DELETE trigger programs. */\n    addrStart = sqlite3VdbeCurrentAddr(v);\n    sqlite3CodeRowTrigger(pParse, pTrigger, \n        TK_DELETE, 0, TRIGGER_BEFORE, pTab, iOld, onconf, iLabel\n    );\n\n    /* If any BEFORE triggers were coded, then seek the cursor to the \n    ** row to be deleted again. It may be that the BEFORE triggers moved\n    ** the cursor or of already deleted the row that the cursor was\n    ** pointing to.\n    */\n    if( addrStart<sqlite3VdbeCurrentAddr(v) ){\n      sqlite3VdbeAddOp4Int(v, opSeek, iDataCur, iLabel, iPk, nPk);\n      VdbeCoverageIf(v, opSeek==OP_NotExists);\n      VdbeCoverageIf(v, opSeek==OP_NotFound);\n    }\n\n    /* Do FK processing. This call checks that any FK constraints that\n    ** refer to this table (i.e. constraints attached to other tables) \n    ** are not violated by deleting this row.  */\n    sqlite3FkCheck(pParse, pTab, iOld, 0, 0, 0);\n  }\n\n  /* Delete the index and table entries. Skip this step if pTab is really\n  ** a view (in which case the only effect of the DELETE statement is to\n  ** fire the INSTEAD OF triggers).  \n  **\n  ** If variable 'count' is non-zero, then this OP_Delete instruction should\n  ** invoke the update-hook. The pre-update-hook, on the other hand should\n  ** be invoked unless table pTab is a system table. The difference is that\n  ** the update-hook is not invoked for rows removed by REPLACE, but the \n  ** pre-update-hook is.\n  */ \n  if( pTab->pSelect==0 ){\n    u8 p5 = 0;\n    sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,iIdxNoSeek);\n    sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, (count?OPFLAG_NCHANGE:0));\n    sqlite3VdbeChangeP4(v, -1, (char*)pTab, P4_TABLE);\n    if( eMode!=ONEPASS_OFF ){\n      sqlite3VdbeChangeP5(v, OPFLAG_AUXDELETE);\n    }\n    if( iIdxNoSeek>=0 ){\n      sqlite3VdbeAddOp1(v, OP_Delete, iIdxNoSeek);\n    }\n    if( eMode==ONEPASS_MULTI ) p5 |= OPFLAG_SAVEPOSITION;\n    sqlite3VdbeChangeP5(v, p5);\n  }\n\n  /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to\n  ** handle rows (possibly in other tables) that refer via a foreign key\n  ** to the row just deleted. */ \n  sqlite3FkActions(pParse, pTab, 0, iOld, 0, 0);\n\n  /* Invoke AFTER DELETE trigger programs. */\n  sqlite3CodeRowTrigger(pParse, pTrigger, \n      TK_DELETE, 0, TRIGGER_AFTER, pTab, iOld, onconf, iLabel\n  );\n\n  /* Jump here if the row had already been deleted before any BEFORE\n  ** trigger programs were invoked. Or if a trigger program throws a \n  ** RAISE(IGNORE) exception.  */\n  sqlite3VdbeResolveLabel(v, iLabel);\n  VdbeModuleComment((v, \"END: GenRowDel()\"));\n}\n\n/*\n** This routine generates VDBE code that causes the deletion of all\n** index entries associated with a single row of a single table, pTab\n**\n** Preconditions:\n**\n**   1.  A read/write cursor \"iDataCur\" must be open on the canonical storage\n**       btree for the table pTab.  (This will be either the table itself\n**       for rowid tables or to the primary key index for WITHOUT ROWID\n**       tables.)\n**\n**   2.  Read/write cursors for all indices of pTab must be open as\n**       cursor number iIdxCur+i for the i-th index.  (The pTab->pIndex\n**       index is the 0-th index.)\n**\n**   3.  The \"iDataCur\" cursor must be already be positioned on the row\n**       that is to be deleted.\n*/\nvoid sqlite3GenerateRowIndexDelete(\n  Parse *pParse,     /* Parsing and code generating context */\n  Table *pTab,       /* Table containing the row to be deleted */\n  int iDataCur,      /* Cursor of table holding data. */\n  int iIdxCur,       /* First index cursor */\n  int *aRegIdx,      /* Only delete if aRegIdx!=0 && aRegIdx[i]>0 */\n  int iIdxNoSeek     /* Do not delete from this cursor */\n){\n  int i;             /* Index loop counter */\n  int r1 = -1;       /* Register holding an index key */\n  int iPartIdxLabel; /* Jump destination for skipping partial index entries */\n  Index *pIdx;       /* Current index */\n  Index *pPrior = 0; /* Prior index */\n  Vdbe *v;           /* The prepared statement under construction */\n  Index *pPk;        /* PRIMARY KEY index, or NULL for rowid tables */\n\n  v = pParse->pVdbe;\n  pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);\n  for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){\n    assert( iIdxCur+i!=iDataCur || pPk==pIdx );\n    if( aRegIdx!=0 && aRegIdx[i]==0 ) continue;\n    if( pIdx==pPk ) continue;\n    if( iIdxCur+i==iIdxNoSeek ) continue;\n    VdbeModuleComment((v, \"GenRowIdxDel for %s\", pIdx->zName));\n    r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 1,\n        &iPartIdxLabel, pPrior, r1);\n    sqlite3VdbeAddOp3(v, OP_IdxDelete, iIdxCur+i, r1,\n        pIdx->uniqNotNull ? pIdx->nKeyCol : pIdx->nColumn);\n    sqlite3ResolvePartIdxLabel(pParse, iPartIdxLabel);\n    pPrior = pIdx;\n  }\n}\n\n/*\n** Generate code that will assemble an index key and stores it in register\n** regOut.  The key with be for index pIdx which is an index on pTab.\n** iCur is the index of a cursor open on the pTab table and pointing to\n** the entry that needs indexing.  If pTab is a WITHOUT ROWID table, then\n** iCur must be the cursor of the PRIMARY KEY index.\n**\n** Return a register number which is the first in a block of\n** registers that holds the elements of the index key.  The\n** block of registers has already been deallocated by the time\n** this routine returns.\n**\n** If *piPartIdxLabel is not NULL, fill it in with a label and jump\n** to that label if pIdx is a partial index that should be skipped.\n** The label should be resolved using sqlite3ResolvePartIdxLabel().\n** A partial index should be skipped if its WHERE clause evaluates\n** to false or null.  If pIdx is not a partial index, *piPartIdxLabel\n** will be set to zero which is an empty label that is ignored by\n** sqlite3ResolvePartIdxLabel().\n**\n** The pPrior and regPrior parameters are used to implement a cache to\n** avoid unnecessary register loads.  If pPrior is not NULL, then it is\n** a pointer to a different index for which an index key has just been\n** computed into register regPrior.  If the current pIdx index is generating\n** its key into the same sequence of registers and if pPrior and pIdx share\n** a column in common, then the register corresponding to that column already\n** holds the correct value and the loading of that register is skipped.\n** This optimization is helpful when doing a DELETE or an INTEGRITY_CHECK \n** on a table with multiple indices, and especially with the ROWID or\n** PRIMARY KEY columns of the index.\n*/\nint sqlite3GenerateIndexKey(\n  Parse *pParse,       /* Parsing context */\n  Index *pIdx,         /* The index for which to generate a key */\n  int iDataCur,        /* Cursor number from which to take column data */\n  int regOut,          /* Put the new key into this register if not 0 */\n  int prefixOnly,      /* Compute only a unique prefix of the key */\n  int *piPartIdxLabel, /* OUT: Jump to this label to skip partial index */\n  Index *pPrior,       /* Previously generated index key */\n  int regPrior         /* Register holding previous generated key */\n){\n  Vdbe *v = pParse->pVdbe;\n  int j;\n  int regBase;\n  int nCol;\n\n  if( piPartIdxLabel ){\n    if( pIdx->pPartIdxWhere ){\n      *piPartIdxLabel = sqlite3VdbeMakeLabel(v);\n      pParse->iSelfTab = iDataCur;\n      sqlite3ExprCachePush(pParse);\n      sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, \n                            SQLITE_JUMPIFNULL);\n    }else{\n      *piPartIdxLabel = 0;\n    }\n  }\n  nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;\n  regBase = sqlite3GetTempRange(pParse, nCol);\n  if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0;\n  for(j=0; j<nCol; j++){\n    if( pPrior\n     && pPrior->aiColumn[j]==pIdx->aiColumn[j]\n     && pPrior->aiColumn[j]!=XN_EXPR\n    ){\n      /* This column was already computed by the previous index */\n      continue;\n    }\n    sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iDataCur, j, regBase+j);\n    /* If the column affinity is REAL but the number is an integer, then it\n    ** might be stored in the table as an integer (using a compact\n    ** representation) then converted to REAL by an OP_RealAffinity opcode.\n    ** But we are getting ready to store this value back into an index, where\n    ** it should be converted by to INTEGER again.  So omit the OP_RealAffinity\n    ** opcode if it is present */\n    sqlite3VdbeDeletePriorOpcode(v, OP_RealAffinity);\n  }\n  if( regOut ){\n    sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regOut);\n  }\n  sqlite3ReleaseTempRange(pParse, regBase, nCol);\n  return regBase;\n}\n\n/*\n** If a prior call to sqlite3GenerateIndexKey() generated a jump-over label\n** because it was a partial index, then this routine should be called to\n** resolve that label.\n*/\nvoid sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){\n  if( iLabel ){\n    sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel);\n    sqlite3ExprCachePop(pParse);\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/expr.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains routines used for analyzing expressions and\n** for generating VDBE code that evaluates expressions in SQLite.\n*/\n#include \"sqliteInt.h\"\n\n/* Forward declarations */\nstatic void exprCodeBetween(Parse*,Expr*,int,void(*)(Parse*,Expr*,int,int),int);\nstatic int exprCodeVector(Parse *pParse, Expr *p, int *piToFree);\n\n/*\n** Return the affinity character for a single column of a table.\n*/\nchar sqlite3TableColumnAffinity(Table *pTab, int iCol){\n  assert( iCol<pTab->nCol );\n  return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER;\n}\n\n/*\n** Return the 'affinity' of the expression pExpr if any.\n**\n** If pExpr is a column, a reference to a column via an 'AS' alias,\n** or a sub-select with a column as the return value, then the \n** affinity of that column is returned. Otherwise, 0x00 is returned,\n** indicating no affinity for the expression.\n**\n** i.e. the WHERE clause expressions in the following statements all\n** have an affinity:\n**\n** CREATE TABLE t1(a);\n** SELECT * FROM t1 WHERE a;\n** SELECT a AS b FROM t1 WHERE b;\n** SELECT * FROM t1 WHERE (select a from t1);\n*/\nchar sqlite3ExprAffinity(Expr *pExpr){\n  int op;\n  pExpr = sqlite3ExprSkipCollate(pExpr);\n  if( pExpr->flags & EP_Generic ) return 0;\n  op = pExpr->op;\n  if( op==TK_SELECT ){\n    assert( pExpr->flags&EP_xIsSelect );\n    return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);\n  }\n  if( op==TK_REGISTER ) op = pExpr->op2;\n#ifndef SQLITE_OMIT_CAST\n  if( op==TK_CAST ){\n    assert( !ExprHasProperty(pExpr, EP_IntValue) );\n    return sqlite3AffinityType(pExpr->u.zToken, 0);\n  }\n#endif\n  if( op==TK_AGG_COLUMN || op==TK_COLUMN ){\n    return sqlite3TableColumnAffinity(pExpr->pTab, pExpr->iColumn);\n  }\n  if( op==TK_SELECT_COLUMN ){\n    assert( pExpr->pLeft->flags&EP_xIsSelect );\n    return sqlite3ExprAffinity(\n        pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr\n    );\n  }\n  return pExpr->affinity;\n}\n\n/*\n** Set the collating sequence for expression pExpr to be the collating\n** sequence named by pToken.   Return a pointer to a new Expr node that\n** implements the COLLATE operator.\n**\n** If a memory allocation error occurs, that fact is recorded in pParse->db\n** and the pExpr parameter is returned unchanged.\n*/\nExpr *sqlite3ExprAddCollateToken(\n  Parse *pParse,           /* Parsing context */\n  Expr *pExpr,             /* Add the \"COLLATE\" clause to this expression */\n  const Token *pCollName,  /* Name of collating sequence */\n  int dequote              /* True to dequote pCollName */\n){\n  if( pCollName->n>0 ){\n    Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);\n    if( pNew ){\n      pNew->pLeft = pExpr;\n      pNew->flags |= EP_Collate|EP_Skip;\n      pExpr = pNew;\n    }\n  }\n  return pExpr;\n}\nExpr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){\n  Token s;\n  assert( zC!=0 );\n  sqlite3TokenInit(&s, (char*)zC);\n  return sqlite3ExprAddCollateToken(pParse, pExpr, &s, 0);\n}\n\n/*\n** Skip over any TK_COLLATE operators and any unlikely()\n** or likelihood() function at the root of an expression.\n*/\nExpr *sqlite3ExprSkipCollate(Expr *pExpr){\n  while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){\n    if( ExprHasProperty(pExpr, EP_Unlikely) ){\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\n      assert( pExpr->x.pList->nExpr>0 );\n      assert( pExpr->op==TK_FUNCTION );\n      pExpr = pExpr->x.pList->a[0].pExpr;\n    }else{\n      assert( pExpr->op==TK_COLLATE );\n      pExpr = pExpr->pLeft;\n    }\n  }   \n  return pExpr;\n}\n\n/*\n** Return the collation sequence for the expression pExpr. If\n** there is no defined collating sequence, return NULL.\n**\n** The collating sequence might be determined by a COLLATE operator\n** or by the presence of a column with a defined collating sequence.\n** COLLATE operators take first precedence.  Left operands take\n** precedence over right operands.\n*/\nCollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){\n  sqlite3 *db = pParse->db;\n  CollSeq *pColl = 0;\n  Expr *p = pExpr;\n  while( p ){\n    int op = p->op;\n    if( p->flags & EP_Generic ) break;\n    if( op==TK_CAST || op==TK_UPLUS ){\n      p = p->pLeft;\n      continue;\n    }\n    if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){\n      pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);\n      break;\n    }\n    if( (op==TK_AGG_COLUMN || op==TK_COLUMN\n          || op==TK_REGISTER || op==TK_TRIGGER)\n     && p->pTab!=0\n    ){\n      /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally\n      ** a TK_COLUMN but was previously evaluated and cached in a register */\n      int j = p->iColumn;\n      if( j>=0 ){\n        const char *zColl = p->pTab->aCol[j].zColl;\n        pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);\n      }\n      break;\n    }\n    if( p->flags & EP_Collate ){\n      if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){\n        p = p->pLeft;\n      }else{\n        Expr *pNext  = p->pRight;\n        /* The Expr.x union is never used at the same time as Expr.pRight */\n        assert( p->x.pList==0 || p->pRight==0 );\n        /* p->flags holds EP_Collate and p->pLeft->flags does not.  And\n        ** p->x.pSelect cannot.  So if p->x.pLeft exists, it must hold at\n        ** least one EP_Collate. Thus the following two ALWAYS. */\n        if( p->x.pList!=0 && ALWAYS(!ExprHasProperty(p, EP_xIsSelect)) ){\n          int i;\n          for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){\n            if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){\n              pNext = p->x.pList->a[i].pExpr;\n              break;\n            }\n          }\n        }\n        p = pNext;\n      }\n    }else{\n      break;\n    }\n  }\n  if( sqlite3CheckCollSeq(pParse, pColl) ){ \n    pColl = 0;\n  }\n  return pColl;\n}\n\n/*\n** pExpr is an operand of a comparison operator.  aff2 is the\n** type affinity of the other operand.  This routine returns the\n** type affinity that should be used for the comparison operator.\n*/\nchar sqlite3CompareAffinity(Expr *pExpr, char aff2){\n  char aff1 = sqlite3ExprAffinity(pExpr);\n  if( aff1 && aff2 ){\n    /* Both sides of the comparison are columns. If one has numeric\n    ** affinity, use that. Otherwise use no affinity.\n    */\n    if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){\n      return SQLITE_AFF_NUMERIC;\n    }else{\n      return SQLITE_AFF_BLOB;\n    }\n  }else if( !aff1 && !aff2 ){\n    /* Neither side of the comparison is a column.  Compare the\n    ** results directly.\n    */\n    return SQLITE_AFF_BLOB;\n  }else{\n    /* One side is a column, the other is not. Use the columns affinity. */\n    assert( aff1==0 || aff2==0 );\n    return (aff1 + aff2);\n  }\n}\n\n/*\n** pExpr is a comparison operator.  Return the type affinity that should\n** be applied to both operands prior to doing the comparison.\n*/\nstatic char comparisonAffinity(Expr *pExpr){\n  char aff;\n  assert( pExpr->op==TK_EQ || pExpr->op==TK_IN || pExpr->op==TK_LT ||\n          pExpr->op==TK_GT || pExpr->op==TK_GE || pExpr->op==TK_LE ||\n          pExpr->op==TK_NE || pExpr->op==TK_IS || pExpr->op==TK_ISNOT );\n  assert( pExpr->pLeft );\n  aff = sqlite3ExprAffinity(pExpr->pLeft);\n  if( pExpr->pRight ){\n    aff = sqlite3CompareAffinity(pExpr->pRight, aff);\n  }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n    aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff);\n  }else if( NEVER(aff==0) ){\n    aff = SQLITE_AFF_BLOB;\n  }\n  return aff;\n}\n\n/*\n** pExpr is a comparison expression, eg. '=', '<', IN(...) etc.\n** idx_affinity is the affinity of an indexed column. Return true\n** if the index with affinity idx_affinity may be used to implement\n** the comparison in pExpr.\n*/\nint sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){\n  char aff = comparisonAffinity(pExpr);\n  switch( aff ){\n    case SQLITE_AFF_BLOB:\n      return 1;\n    case SQLITE_AFF_TEXT:\n      return idx_affinity==SQLITE_AFF_TEXT;\n    default:\n      return sqlite3IsNumericAffinity(idx_affinity);\n  }\n}\n\n/*\n** Return the P5 value that should be used for a binary comparison\n** opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2.\n*/\nstatic u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){\n  u8 aff = (char)sqlite3ExprAffinity(pExpr2);\n  aff = (u8)sqlite3CompareAffinity(pExpr1, aff) | (u8)jumpIfNull;\n  return aff;\n}\n\n/*\n** Return a pointer to the collation sequence that should be used by\n** a binary comparison operator comparing pLeft and pRight.\n**\n** If the left hand expression has a collating sequence type, then it is\n** used. Otherwise the collation sequence for the right hand expression\n** is used, or the default (BINARY) if neither expression has a collating\n** type.\n**\n** Argument pRight (but not pLeft) may be a null pointer. In this case,\n** it is not considered.\n*/\nCollSeq *sqlite3BinaryCompareCollSeq(\n  Parse *pParse, \n  Expr *pLeft, \n  Expr *pRight\n){\n  CollSeq *pColl;\n  assert( pLeft );\n  if( pLeft->flags & EP_Collate ){\n    pColl = sqlite3ExprCollSeq(pParse, pLeft);\n  }else if( pRight && (pRight->flags & EP_Collate)!=0 ){\n    pColl = sqlite3ExprCollSeq(pParse, pRight);\n  }else{\n    pColl = sqlite3ExprCollSeq(pParse, pLeft);\n    if( !pColl ){\n      pColl = sqlite3ExprCollSeq(pParse, pRight);\n    }\n  }\n  return pColl;\n}\n\n/*\n** Generate code for a comparison operator.\n*/\nstatic int codeCompare(\n  Parse *pParse,    /* The parsing (and code generating) context */\n  Expr *pLeft,      /* The left operand */\n  Expr *pRight,     /* The right operand */\n  int opcode,       /* The comparison opcode */\n  int in1, int in2, /* Register holding operands */\n  int dest,         /* Jump here if true.  */\n  int jumpIfNull    /* If true, jump if either operand is NULL */\n){\n  int p5;\n  int addr;\n  CollSeq *p4;\n\n  p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);\n  p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);\n  addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,\n                           (void*)p4, P4_COLLSEQ);\n  sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);\n  return addr;\n}\n\n/*\n** Return true if expression pExpr is a vector, or false otherwise.\n**\n** A vector is defined as any expression that results in two or more\n** columns of result.  Every TK_VECTOR node is an vector because the\n** parser will not generate a TK_VECTOR with fewer than two entries.\n** But a TK_SELECT might be either a vector or a scalar. It is only\n** considered a vector if it has two or more result columns.\n*/\nint sqlite3ExprIsVector(Expr *pExpr){\n  return sqlite3ExprVectorSize(pExpr)>1;\n}\n\n/*\n** If the expression passed as the only argument is of type TK_VECTOR \n** return the number of expressions in the vector. Or, if the expression\n** is a sub-select, return the number of columns in the sub-select. For\n** any other type of expression, return 1.\n*/\nint sqlite3ExprVectorSize(Expr *pExpr){\n  u8 op = pExpr->op;\n  if( op==TK_REGISTER ) op = pExpr->op2;\n  if( op==TK_VECTOR ){\n    return pExpr->x.pList->nExpr;\n  }else if( op==TK_SELECT ){\n    return pExpr->x.pSelect->pEList->nExpr;\n  }else{\n    return 1;\n  }\n}\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** Return a pointer to a subexpression of pVector that is the i-th\n** column of the vector (numbered starting with 0).  The caller must\n** ensure that i is within range.\n**\n** If pVector is really a scalar (and \"scalar\" here includes subqueries\n** that return a single column!) then return pVector unmodified.\n**\n** pVector retains ownership of the returned subexpression.\n**\n** If the vector is a (SELECT ...) then the expression returned is\n** just the expression for the i-th term of the result set, and may\n** not be ready for evaluation because the table cursor has not yet\n** been positioned.\n*/\nExpr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){\n  assert( i<sqlite3ExprVectorSize(pVector) );\n  if( sqlite3ExprIsVector(pVector) ){\n    assert( pVector->op2==0 || pVector->op==TK_REGISTER );\n    if( pVector->op==TK_SELECT || pVector->op2==TK_SELECT ){\n      return pVector->x.pSelect->pEList->a[i].pExpr;\n    }else{\n      return pVector->x.pList->a[i].pExpr;\n    }\n  }\n  return pVector;\n}\n#endif /* !defined(SQLITE_OMIT_SUBQUERY) */\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** Compute and return a new Expr object which when passed to\n** sqlite3ExprCode() will generate all necessary code to compute\n** the iField-th column of the vector expression pVector.\n**\n** It is ok for pVector to be a scalar (as long as iField==0).  \n** In that case, this routine works like sqlite3ExprDup().\n**\n** The caller owns the returned Expr object and is responsible for\n** ensuring that the returned value eventually gets freed.\n**\n** The caller retains ownership of pVector.  If pVector is a TK_SELECT,\n** then the returned object will reference pVector and so pVector must remain\n** valid for the life of the returned object.  If pVector is a TK_VECTOR\n** or a scalar expression, then it can be deleted as soon as this routine\n** returns.\n**\n** A trick to cause a TK_SELECT pVector to be deleted together with\n** the returned Expr object is to attach the pVector to the pRight field\n** of the returned TK_SELECT_COLUMN Expr object.\n*/\nExpr *sqlite3ExprForVectorField(\n  Parse *pParse,       /* Parsing context */\n  Expr *pVector,       /* The vector.  List of expressions or a sub-SELECT */\n  int iField           /* Which column of the vector to return */\n){\n  Expr *pRet;\n  if( pVector->op==TK_SELECT ){\n    assert( pVector->flags & EP_xIsSelect );\n    /* The TK_SELECT_COLUMN Expr node:\n    **\n    ** pLeft:           pVector containing TK_SELECT\n    ** pRight:          not used.  But recursively deleted.\n    ** iColumn:         Index of a column in pVector\n    ** pLeft->iTable:   First in an array of register holding result, or 0\n    **                  if the result is not yet computed.\n    **\n    ** sqlite3ExprDelete() specifically skips the recursive delete of\n    ** pLeft on TK_SELECT_COLUMN nodes.  But pRight is followed, so pVector\n    ** can be attached to pRight to cause this node to take ownership of\n    ** pVector.  Typically there will be multiple TK_SELECT_COLUMN nodes\n    ** with the same pLeft pointer to the pVector, but only one of them\n    ** will own the pVector.\n    */\n    pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0, 0);\n    if( pRet ){\n      pRet->iColumn = iField;\n      pRet->pLeft = pVector;\n    }\n    assert( pRet==0 || pRet->iTable==0 );\n  }else{\n    if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr;\n    pRet = sqlite3ExprDup(pParse->db, pVector, 0);\n  }\n  return pRet;\n}\n#endif /* !define(SQLITE_OMIT_SUBQUERY) */\n\n/*\n** If expression pExpr is of type TK_SELECT, generate code to evaluate\n** it. Return the register in which the result is stored (or, if the \n** sub-select returns more than one column, the first in an array\n** of registers in which the result is stored).\n**\n** If pExpr is not a TK_SELECT expression, return 0.\n*/\nstatic int exprCodeSubselect(Parse *pParse, Expr *pExpr){\n  int reg = 0;\n#ifndef SQLITE_OMIT_SUBQUERY\n  if( pExpr->op==TK_SELECT ){\n    reg = sqlite3CodeSubselect(pParse, pExpr, 0, 0);\n  }\n#endif\n  return reg;\n}\n\n/*\n** Argument pVector points to a vector expression - either a TK_VECTOR\n** or TK_SELECT that returns more than one column. This function returns\n** the register number of a register that contains the value of\n** element iField of the vector.\n**\n** If pVector is a TK_SELECT expression, then code for it must have \n** already been generated using the exprCodeSubselect() routine. In this\n** case parameter regSelect should be the first in an array of registers\n** containing the results of the sub-select. \n**\n** If pVector is of type TK_VECTOR, then code for the requested field\n** is generated. In this case (*pRegFree) may be set to the number of\n** a temporary register to be freed by the caller before returning.\n**\n** Before returning, output parameter (*ppExpr) is set to point to the\n** Expr object corresponding to element iElem of the vector.\n*/\nstatic int exprVectorRegister(\n  Parse *pParse,                  /* Parse context */\n  Expr *pVector,                  /* Vector to extract element from */\n  int iField,                     /* Field to extract from pVector */\n  int regSelect,                  /* First in array of registers */\n  Expr **ppExpr,                  /* OUT: Expression element */\n  int *pRegFree                   /* OUT: Temp register to free */\n){\n  u8 op = pVector->op;\n  assert( op==TK_VECTOR || op==TK_REGISTER || op==TK_SELECT );\n  if( op==TK_REGISTER ){\n    *ppExpr = sqlite3VectorFieldSubexpr(pVector, iField);\n    return pVector->iTable+iField;\n  }\n  if( op==TK_SELECT ){\n    *ppExpr = pVector->x.pSelect->pEList->a[iField].pExpr;\n     return regSelect+iField;\n  }\n  *ppExpr = pVector->x.pList->a[iField].pExpr;\n  return sqlite3ExprCodeTemp(pParse, *ppExpr, pRegFree);\n}\n\n/*\n** Expression pExpr is a comparison between two vector values. Compute\n** the result of the comparison (1, 0, or NULL) and write that\n** result into register dest.\n**\n** The caller must satisfy the following preconditions:\n**\n**    if pExpr->op==TK_IS:      op==TK_EQ and p5==SQLITE_NULLEQ\n**    if pExpr->op==TK_ISNOT:   op==TK_NE and p5==SQLITE_NULLEQ\n**    otherwise:                op==pExpr->op and p5==0\n*/\nstatic void codeVectorCompare(\n  Parse *pParse,        /* Code generator context */\n  Expr *pExpr,          /* The comparison operation */\n  int dest,             /* Write results into this register */\n  u8 op,                /* Comparison operator */\n  u8 p5                 /* SQLITE_NULLEQ or zero */\n){\n  Vdbe *v = pParse->pVdbe;\n  Expr *pLeft = pExpr->pLeft;\n  Expr *pRight = pExpr->pRight;\n  int nLeft = sqlite3ExprVectorSize(pLeft);\n  int i;\n  int regLeft = 0;\n  int regRight = 0;\n  u8 opx = op;\n  int addrDone = sqlite3VdbeMakeLabel(v);\n\n  assert( nLeft==sqlite3ExprVectorSize(pRight) );\n  assert( pExpr->op==TK_EQ || pExpr->op==TK_NE \n       || pExpr->op==TK_IS || pExpr->op==TK_ISNOT \n       || pExpr->op==TK_LT || pExpr->op==TK_GT \n       || pExpr->op==TK_LE || pExpr->op==TK_GE \n  );\n  assert( pExpr->op==op || (pExpr->op==TK_IS && op==TK_EQ)\n            || (pExpr->op==TK_ISNOT && op==TK_NE) );\n  assert( p5==0 || pExpr->op!=op );\n  assert( p5==SQLITE_NULLEQ || pExpr->op==op );\n\n  p5 |= SQLITE_STOREP2;\n  if( opx==TK_LE ) opx = TK_LT;\n  if( opx==TK_GE ) opx = TK_GT;\n\n  regLeft = exprCodeSubselect(pParse, pLeft);\n  regRight = exprCodeSubselect(pParse, pRight);\n\n  for(i=0; 1 /*Loop exits by \"break\"*/; i++){\n    int regFree1 = 0, regFree2 = 0;\n    Expr *pL, *pR; \n    int r1, r2;\n    assert( i>=0 && i<nLeft );\n    if( i>0 ) sqlite3ExprCachePush(pParse);\n    r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);\n    r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);\n    codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5);\n    testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);\n    testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);\n    testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);\n    testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);\n    testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq);\n    testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);\n    sqlite3ReleaseTempReg(pParse, regFree1);\n    sqlite3ReleaseTempReg(pParse, regFree2);\n    if( i>0 ) sqlite3ExprCachePop(pParse);\n    if( i==nLeft-1 ){\n      break;\n    }\n    if( opx==TK_EQ ){\n      sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v);\n      p5 |= SQLITE_KEEPNULL;\n    }else if( opx==TK_NE ){\n      sqlite3VdbeAddOp2(v, OP_If, dest, addrDone); VdbeCoverage(v);\n      p5 |= SQLITE_KEEPNULL;\n    }else{\n      assert( op==TK_LT || op==TK_GT || op==TK_LE || op==TK_GE );\n      sqlite3VdbeAddOp2(v, OP_ElseNotEq, 0, addrDone);\n      VdbeCoverageIf(v, op==TK_LT);\n      VdbeCoverageIf(v, op==TK_GT);\n      VdbeCoverageIf(v, op==TK_LE);\n      VdbeCoverageIf(v, op==TK_GE);\n      if( i==nLeft-2 ) opx = op;\n    }\n  }\n  sqlite3VdbeResolveLabel(v, addrDone);\n}\n\n#if SQLITE_MAX_EXPR_DEPTH>0\n/*\n** Check that argument nHeight is less than or equal to the maximum\n** expression depth allowed. If it is not, leave an error message in\n** pParse.\n*/\nint sqlite3ExprCheckHeight(Parse *pParse, int nHeight){\n  int rc = SQLITE_OK;\n  int mxHeight = pParse->db->aLimit[SQLITE_LIMIT_EXPR_DEPTH];\n  if( nHeight>mxHeight ){\n    sqlite3ErrorMsg(pParse, \n       \"Expression tree is too large (maximum depth %d)\", mxHeight\n    );\n    rc = SQLITE_ERROR;\n  }\n  return rc;\n}\n\n/* The following three functions, heightOfExpr(), heightOfExprList()\n** and heightOfSelect(), are used to determine the maximum height\n** of any expression tree referenced by the structure passed as the\n** first argument.\n**\n** If this maximum height is greater than the current value pointed\n** to by pnHeight, the second parameter, then set *pnHeight to that\n** value.\n*/\nstatic void heightOfExpr(Expr *p, int *pnHeight){\n  if( p ){\n    if( p->nHeight>*pnHeight ){\n      *pnHeight = p->nHeight;\n    }\n  }\n}\nstatic void heightOfExprList(ExprList *p, int *pnHeight){\n  if( p ){\n    int i;\n    for(i=0; i<p->nExpr; i++){\n      heightOfExpr(p->a[i].pExpr, pnHeight);\n    }\n  }\n}\nstatic void heightOfSelect(Select *p, int *pnHeight){\n  if( p ){\n    heightOfExpr(p->pWhere, pnHeight);\n    heightOfExpr(p->pHaving, pnHeight);\n    heightOfExpr(p->pLimit, pnHeight);\n    heightOfExpr(p->pOffset, pnHeight);\n    heightOfExprList(p->pEList, pnHeight);\n    heightOfExprList(p->pGroupBy, pnHeight);\n    heightOfExprList(p->pOrderBy, pnHeight);\n    heightOfSelect(p->pPrior, pnHeight);\n  }\n}\n\n/*\n** Set the Expr.nHeight variable in the structure passed as an \n** argument. An expression with no children, Expr.pList or \n** Expr.pSelect member has a height of 1. Any other expression\n** has a height equal to the maximum height of any other \n** referenced Expr plus one.\n**\n** Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags,\n** if appropriate.\n*/\nstatic void exprSetHeight(Expr *p){\n  int nHeight = 0;\n  heightOfExpr(p->pLeft, &nHeight);\n  heightOfExpr(p->pRight, &nHeight);\n  if( ExprHasProperty(p, EP_xIsSelect) ){\n    heightOfSelect(p->x.pSelect, &nHeight);\n  }else if( p->x.pList ){\n    heightOfExprList(p->x.pList, &nHeight);\n    p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList);\n  }\n  p->nHeight = nHeight + 1;\n}\n\n/*\n** Set the Expr.nHeight variable using the exprSetHeight() function. If\n** the height is greater than the maximum allowed expression depth,\n** leave an error in pParse.\n**\n** Also propagate all EP_Propagate flags from the Expr.x.pList into\n** Expr.flags. \n*/\nvoid sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){\n  if( pParse->nErr ) return;\n  exprSetHeight(p);\n  sqlite3ExprCheckHeight(pParse, p->nHeight);\n}\n\n/*\n** Return the maximum height of any expression tree referenced\n** by the select statement passed as an argument.\n*/\nint sqlite3SelectExprHeight(Select *p){\n  int nHeight = 0;\n  heightOfSelect(p, &nHeight);\n  return nHeight;\n}\n#else /* ABOVE:  Height enforcement enabled.  BELOW: Height enforcement off */\n/*\n** Propagate all EP_Propagate flags from the Expr.x.pList into\n** Expr.flags. \n*/\nvoid sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){\n  if( p && p->x.pList && !ExprHasProperty(p, EP_xIsSelect) ){\n    p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList);\n  }\n}\n#define exprSetHeight(y)\n#endif /* SQLITE_MAX_EXPR_DEPTH>0 */\n\n/*\n** This routine is the core allocator for Expr nodes.\n**\n** Construct a new expression node and return a pointer to it.  Memory\n** for this node and for the pToken argument is a single allocation\n** obtained from sqlite3DbMalloc().  The calling function\n** is responsible for making sure the node eventually gets freed.\n**\n** If dequote is true, then the token (if it exists) is dequoted.\n** If dequote is false, no dequoting is performed.  The deQuote\n** parameter is ignored if pToken is NULL or if the token does not\n** appear to be quoted.  If the quotes were of the form \"...\" (double-quotes)\n** then the EP_DblQuoted flag is set on the expression node.\n**\n** Special case:  If op==TK_INTEGER and pToken points to a string that\n** can be translated into a 32-bit integer, then the token is not\n** stored in u.zToken.  Instead, the integer values is written\n** into u.iValue and the EP_IntValue flag is set.  No extra storage\n** is allocated to hold the integer text and the dequote flag is ignored.\n*/\nExpr *sqlite3ExprAlloc(\n  sqlite3 *db,            /* Handle for sqlite3DbMallocRawNN() */\n  int op,                 /* Expression opcode */\n  const Token *pToken,    /* Token argument.  Might be NULL */\n  int dequote             /* True to dequote */\n){\n  Expr *pNew;\n  int nExtra = 0;\n  int iValue = 0;\n\n  assert( db!=0 );\n  if( pToken ){\n    if( op!=TK_INTEGER || pToken->z==0\n          || sqlite3GetInt32(pToken->z, &iValue)==0 ){\n      nExtra = pToken->n+1;\n      assert( iValue>=0 );\n    }\n  }\n  pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);\n  if( pNew ){\n    memset(pNew, 0, sizeof(Expr));\n    pNew->op = (u8)op;\n    pNew->iAgg = -1;\n    if( pToken ){\n      if( nExtra==0 ){\n        pNew->flags |= EP_IntValue;\n        pNew->u.iValue = iValue;\n      }else{\n        pNew->u.zToken = (char*)&pNew[1];\n        assert( pToken->z!=0 || pToken->n==0 );\n        if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);\n        pNew->u.zToken[pToken->n] = 0;\n        if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){\n          if( pNew->u.zToken[0]=='\"' ) pNew->flags |= EP_DblQuoted;\n          sqlite3Dequote(pNew->u.zToken);\n        }\n      }\n    }\n#if SQLITE_MAX_EXPR_DEPTH>0\n    pNew->nHeight = 1;\n#endif  \n  }\n  return pNew;\n}\n\n/*\n** Allocate a new expression node from a zero-terminated token that has\n** already been dequoted.\n*/\nExpr *sqlite3Expr(\n  sqlite3 *db,            /* Handle for sqlite3DbMallocZero() (may be null) */\n  int op,                 /* Expression opcode */\n  const char *zToken      /* Token argument.  Might be NULL */\n){\n  Token x;\n  x.z = zToken;\n  x.n = zToken ? sqlite3Strlen30(zToken) : 0;\n  return sqlite3ExprAlloc(db, op, &x, 0);\n}\n\n/*\n** Attach subtrees pLeft and pRight to the Expr node pRoot.\n**\n** If pRoot==NULL that means that a memory allocation error has occurred.\n** In that case, delete the subtrees pLeft and pRight.\n*/\nvoid sqlite3ExprAttachSubtrees(\n  sqlite3 *db,\n  Expr *pRoot,\n  Expr *pLeft,\n  Expr *pRight\n){\n  if( pRoot==0 ){\n    assert( db->mallocFailed );\n    sqlite3ExprDelete(db, pLeft);\n    sqlite3ExprDelete(db, pRight);\n  }else{\n    if( pRight ){\n      pRoot->pRight = pRight;\n      pRoot->flags |= EP_Propagate & pRight->flags;\n    }\n    if( pLeft ){\n      pRoot->pLeft = pLeft;\n      pRoot->flags |= EP_Propagate & pLeft->flags;\n    }\n    exprSetHeight(pRoot);\n  }\n}\n\n/*\n** Allocate an Expr node which joins as many as two subtrees.\n**\n** One or both of the subtrees can be NULL.  Return a pointer to the new\n** Expr node.  Or, if an OOM error occurs, set pParse->db->mallocFailed,\n** free the subtrees and return NULL.\n*/\nExpr *sqlite3PExpr(\n  Parse *pParse,          /* Parsing context */\n  int op,                 /* Expression opcode */\n  Expr *pLeft,            /* Left operand */\n  Expr *pRight,           /* Right operand */\n  const Token *pToken     /* Argument token */\n){\n  Expr *p;\n  if( op==TK_AND && pParse->nErr==0 ){\n    /* Take advantage of short-circuit false optimization for AND */\n    p = sqlite3ExprAnd(pParse->db, pLeft, pRight);\n  }else{\n    p = sqlite3ExprAlloc(pParse->db, op & TKFLG_MASK, pToken, 1);\n    sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);\n  }\n  if( p ) {\n    sqlite3ExprCheckHeight(pParse, p->nHeight);\n  }\n  return p;\n}\n\n/*\n** Add pSelect to the Expr.x.pSelect field.  Or, if pExpr is NULL (due\n** do a memory allocation failure) then delete the pSelect object.\n*/\nvoid sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pSelect){\n  if( pExpr ){\n    pExpr->x.pSelect = pSelect;\n    ExprSetProperty(pExpr, EP_xIsSelect|EP_Subquery);\n    sqlite3ExprSetHeightAndFlags(pParse, pExpr);\n  }else{\n    assert( pParse->db->mallocFailed );\n    sqlite3SelectDelete(pParse->db, pSelect);\n  }\n}\n\n\n/*\n** If the expression is always either TRUE or FALSE (respectively),\n** then return 1.  If one cannot determine the truth value of the\n** expression at compile-time return 0.\n**\n** This is an optimization.  If is OK to return 0 here even if\n** the expression really is always false or false (a false negative).\n** But it is a bug to return 1 if the expression might have different\n** boolean values in different circumstances (a false positive.)\n**\n** Note that if the expression is part of conditional for a\n** LEFT JOIN, then we cannot determine at compile-time whether or not\n** is it true or false, so always return 0.\n*/\nstatic int exprAlwaysTrue(Expr *p){\n  int v = 0;\n  if( ExprHasProperty(p, EP_FromJoin) ) return 0;\n  if( !sqlite3ExprIsInteger(p, &v) ) return 0;\n  return v!=0;\n}\nstatic int exprAlwaysFalse(Expr *p){\n  int v = 0;\n  if( ExprHasProperty(p, EP_FromJoin) ) return 0;\n  if( !sqlite3ExprIsInteger(p, &v) ) return 0;\n  return v==0;\n}\n\n/*\n** Join two expressions using an AND operator.  If either expression is\n** NULL, then just return the other expression.\n**\n** If one side or the other of the AND is known to be false, then instead\n** of returning an AND expression, just return a constant expression with\n** a value of false.\n*/\nExpr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){\n  if( pLeft==0 ){\n    return pRight;\n  }else if( pRight==0 ){\n    return pLeft;\n  }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){\n    sqlite3ExprDelete(db, pLeft);\n    sqlite3ExprDelete(db, pRight);\n    return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);\n  }else{\n    Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);\n    sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);\n    return pNew;\n  }\n}\n\n/*\n** Construct a new expression node for a function with multiple\n** arguments.\n*/\nExpr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){\n  Expr *pNew;\n  sqlite3 *db = pParse->db;\n  assert( pToken );\n  pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1);\n  if( pNew==0 ){\n    sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */\n    return 0;\n  }\n  pNew->x.pList = pList;\n  assert( !ExprHasProperty(pNew, EP_xIsSelect) );\n  sqlite3ExprSetHeightAndFlags(pParse, pNew);\n  return pNew;\n}\n\n/*\n** Assign a variable number to an expression that encodes a wildcard\n** in the original SQL statement.  \n**\n** Wildcards consisting of a single \"?\" are assigned the next sequential\n** variable number.\n**\n** Wildcards of the form \"?nnn\" are assigned the number \"nnn\".  We make\n** sure \"nnn\" is not too be to avoid a denial of service attack when\n** the SQL statement comes from an external source.\n**\n** Wildcards of the form \":aaa\", \"@aaa\", or \"$aaa\" are assigned the same number\n** as the previous instance of the same wildcard.  Or if this is the first\n** instance of the wildcard, the next sequential variable number is\n** assigned.\n*/\nvoid sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){\n  sqlite3 *db = pParse->db;\n  const char *z;\n\n  if( pExpr==0 ) return;\n  assert( !ExprHasProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );\n  z = pExpr->u.zToken;\n  assert( z!=0 );\n  assert( z[0]!=0 );\n  assert( n==sqlite3Strlen30(z) );\n  if( z[1]==0 ){\n    /* Wildcard of the form \"?\".  Assign the next variable number */\n    assert( z[0]=='?' );\n    pExpr->iColumn = (ynVar)(++pParse->nVar);\n  }else{\n    ynVar x;\n    if( z[0]=='?' ){\n      /* Wildcard of the form \"?nnn\".  Convert \"nnn\" to an integer and\n      ** use it as the variable number */\n      i64 i;\n      int bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);\n      x = (ynVar)i;\n      testcase( i==0 );\n      testcase( i==1 );\n      testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );\n      testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );\n      if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){\n        sqlite3ErrorMsg(pParse, \"variable number must be between ?1 and ?%d\",\n            db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);\n        return;\n      }\n      if( i>pParse->nVar ){\n        pParse->nVar = (int)i;\n      }\n    }else{\n      /* Wildcards like \":aaa\", \"$aaa\" or \"@aaa\".  Reuse the same variable\n      ** number as the prior appearance of the same name, or if the name\n      ** has never appeared before, reuse the same variable number\n      */\n      ynVar i;\n      for(i=x=0; i<pParse->nzVar; i++){\n        if( pParse->azVar[i] && strcmp(pParse->azVar[i],z)==0 ){\n          x = (ynVar)i+1;\n          break;\n        }\n      }\n      if( x==0 ) x = (ynVar)(++pParse->nVar);\n    }\n    pExpr->iColumn = x;\n    if( x>pParse->nzVar ){\n      char **a;\n      a = sqlite3DbRealloc(db, pParse->azVar, x*sizeof(a[0]));\n      if( a==0 ){\n        assert( db->mallocFailed ); /* Error reported through mallocFailed */\n        return;\n      }\n      pParse->azVar = a;\n      memset(&a[pParse->nzVar], 0, (x-pParse->nzVar)*sizeof(a[0]));\n      pParse->nzVar = x;\n    }\n    if( pParse->azVar[x-1]==0 ){\n      pParse->azVar[x-1] = sqlite3DbStrNDup(db, z, n);\n    }\n  } \n  if( pParse->nVar>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){\n    sqlite3ErrorMsg(pParse, \"too many SQL variables\");\n  }\n}\n\n/*\n** Recursively delete an expression tree.\n*/\nstatic SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){\n  assert( p!=0 );\n  /* Sanity check: Assert that the IntValue is non-negative if it exists */\n  assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 );\n#ifdef SQLITE_DEBUG\n  if( ExprHasProperty(p, EP_Leaf) && !ExprHasProperty(p, EP_TokenOnly) ){\n    assert( p->pLeft==0 );\n    assert( p->pRight==0 );\n    assert( p->x.pSelect==0 );\n  }\n#endif\n  if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){\n    /* The Expr.x union is never used at the same time as Expr.pRight */\n    assert( p->x.pList==0 || p->pRight==0 );\n    if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);\n    sqlite3ExprDelete(db, p->pRight);\n    if( ExprHasProperty(p, EP_xIsSelect) ){\n      sqlite3SelectDelete(db, p->x.pSelect);\n    }else{\n      sqlite3ExprListDelete(db, p->x.pList);\n    }\n  }\n  if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken);\n  if( !ExprHasProperty(p, EP_Static) ){\n    sqlite3DbFree(db, p);\n  }\n}\nvoid sqlite3ExprDelete(sqlite3 *db, Expr *p){\n  if( p ) sqlite3ExprDeleteNN(db, p);\n}\n\n/*\n** Return the number of bytes allocated for the expression structure \n** passed as the first argument. This is always one of EXPR_FULLSIZE,\n** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE.\n*/\nstatic int exprStructSize(Expr *p){\n  if( ExprHasProperty(p, EP_TokenOnly) ) return EXPR_TOKENONLYSIZE;\n  if( ExprHasProperty(p, EP_Reduced) ) return EXPR_REDUCEDSIZE;\n  return EXPR_FULLSIZE;\n}\n\n/*\n** The dupedExpr*Size() routines each return the number of bytes required\n** to store a copy of an expression or expression tree.  They differ in\n** how much of the tree is measured.\n**\n**     dupedExprStructSize()     Size of only the Expr structure \n**     dupedExprNodeSize()       Size of Expr + space for token\n**     dupedExprSize()           Expr + token + subtree components\n**\n***************************************************************************\n**\n** The dupedExprStructSize() function returns two values OR-ed together:  \n** (1) the space required for a copy of the Expr structure only and \n** (2) the EP_xxx flags that indicate what the structure size should be.\n** The return values is always one of:\n**\n**      EXPR_FULLSIZE\n**      EXPR_REDUCEDSIZE   | EP_Reduced\n**      EXPR_TOKENONLYSIZE | EP_TokenOnly\n**\n** The size of the structure can be found by masking the return value\n** of this routine with 0xfff.  The flags can be found by masking the\n** return value with EP_Reduced|EP_TokenOnly.\n**\n** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size\n** (unreduced) Expr objects as they or originally constructed by the parser.\n** During expression analysis, extra information is computed and moved into\n** later parts of teh Expr object and that extra information might get chopped\n** off if the expression is reduced.  Note also that it does not work to\n** make an EXPRDUP_REDUCE copy of a reduced expression.  It is only legal\n** to reduce a pristine expression tree from the parser.  The implementation\n** of dupedExprStructSize() contain multiple assert() statements that attempt\n** to enforce this constraint.\n*/\nstatic int dupedExprStructSize(Expr *p, int flags){\n  int nSize;\n  assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */\n  assert( EXPR_FULLSIZE<=0xfff );\n  assert( (0xfff & (EP_Reduced|EP_TokenOnly))==0 );\n  if( 0==flags ){\n    nSize = EXPR_FULLSIZE;\n  }else{\n    assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );\n    assert( !ExprHasProperty(p, EP_FromJoin) ); \n    assert( !ExprHasProperty(p, EP_MemToken) );\n    assert( !ExprHasProperty(p, EP_NoReduce) );\n    if( p->pLeft || p->x.pList ){\n      nSize = EXPR_REDUCEDSIZE | EP_Reduced;\n    }else{\n      assert( p->pRight==0 );\n      nSize = EXPR_TOKENONLYSIZE | EP_TokenOnly;\n    }\n  }\n  return nSize;\n}\n\n/*\n** This function returns the space in bytes required to store the copy \n** of the Expr structure and a copy of the Expr.u.zToken string (if that\n** string is defined.)\n*/\nstatic int dupedExprNodeSize(Expr *p, int flags){\n  int nByte = dupedExprStructSize(p, flags) & 0xfff;\n  if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){\n    nByte += sqlite3Strlen30(p->u.zToken)+1;\n  }\n  return ROUND8(nByte);\n}\n\n/*\n** Return the number of bytes required to create a duplicate of the \n** expression passed as the first argument. The second argument is a\n** mask containing EXPRDUP_XXX flags.\n**\n** The value returned includes space to create a copy of the Expr struct\n** itself and the buffer referred to by Expr.u.zToken, if any.\n**\n** If the EXPRDUP_REDUCE flag is set, then the return value includes \n** space to duplicate all Expr nodes in the tree formed by Expr.pLeft \n** and Expr.pRight variables (but not for any structures pointed to or \n** descended from the Expr.x.pList or Expr.x.pSelect variables).\n*/\nstatic int dupedExprSize(Expr *p, int flags){\n  int nByte = 0;\n  if( p ){\n    nByte = dupedExprNodeSize(p, flags);\n    if( flags&EXPRDUP_REDUCE ){\n      nByte += dupedExprSize(p->pLeft, flags) + dupedExprSize(p->pRight, flags);\n    }\n  }\n  return nByte;\n}\n\n/*\n** This function is similar to sqlite3ExprDup(), except that if pzBuffer \n** is not NULL then *pzBuffer is assumed to point to a buffer large enough \n** to store the copy of expression p, the copies of p->u.zToken\n** (if applicable), and the copies of the p->pLeft and p->pRight expressions,\n** if any. Before returning, *pzBuffer is set to the first byte past the\n** portion of the buffer copied into by this function.\n*/\nstatic Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){\n  Expr *pNew;           /* Value to return */\n  u8 *zAlloc;           /* Memory space from which to build Expr object */\n  u32 staticFlag;       /* EP_Static if space not obtained from malloc */\n\n  assert( db!=0 );\n  assert( p );\n  assert( dupFlags==0 || dupFlags==EXPRDUP_REDUCE );\n  assert( pzBuffer==0 || dupFlags==EXPRDUP_REDUCE );\n\n  /* Figure out where to write the new Expr structure. */\n  if( pzBuffer ){\n    zAlloc = *pzBuffer;\n    staticFlag = EP_Static;\n  }else{\n    zAlloc = sqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags));\n    staticFlag = 0;\n  }\n  pNew = (Expr *)zAlloc;\n\n  if( pNew ){\n    /* Set nNewSize to the size allocated for the structure pointed to\n    ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or\n    ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed\n    ** by the copy of the p->u.zToken string (if any).\n    */\n    const unsigned nStructSize = dupedExprStructSize(p, dupFlags);\n    const int nNewSize = nStructSize & 0xfff;\n    int nToken;\n    if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){\n      nToken = sqlite3Strlen30(p->u.zToken) + 1;\n    }else{\n      nToken = 0;\n    }\n    if( dupFlags ){\n      assert( ExprHasProperty(p, EP_Reduced)==0 );\n      memcpy(zAlloc, p, nNewSize);\n    }else{\n      u32 nSize = (u32)exprStructSize(p);\n      memcpy(zAlloc, p, nSize);\n      if( nSize<EXPR_FULLSIZE ){ \n        memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);\n      }\n    }\n\n    /* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */\n    pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static|EP_MemToken);\n    pNew->flags |= nStructSize & (EP_Reduced|EP_TokenOnly);\n    pNew->flags |= staticFlag;\n\n    /* Copy the p->u.zToken string, if any. */\n    if( nToken ){\n      char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize];\n      memcpy(zToken, p->u.zToken, nToken);\n    }\n\n    if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){\n      /* Fill in the pNew->x.pSelect or pNew->x.pList member. */\n      if( ExprHasProperty(p, EP_xIsSelect) ){\n        pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags);\n      }else{\n        pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, dupFlags);\n      }\n    }\n\n    /* Fill in pNew->pLeft and pNew->pRight. */\n    if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly) ){\n      zAlloc += dupedExprNodeSize(p, dupFlags);\n      if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){\n        pNew->pLeft = p->pLeft ?\n                      exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0;\n        pNew->pRight = p->pRight ?\n                       exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0;\n      }\n      if( pzBuffer ){\n        *pzBuffer = zAlloc;\n      }\n    }else{\n      if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){\n        if( pNew->op==TK_SELECT_COLUMN ){\n          pNew->pLeft = p->pLeft;\n        }else{\n          pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);\n        }\n        pNew->pRight = sqlite3ExprDup(db, p->pRight, 0);\n      }\n    }\n  }\n  return pNew;\n}\n\n/*\n** Create and return a deep copy of the object passed as the second \n** argument. If an OOM condition is encountered, NULL is returned\n** and the db->mallocFailed flag set.\n*/\n#ifndef SQLITE_OMIT_CTE\nstatic With *withDup(sqlite3 *db, With *p){\n  With *pRet = 0;\n  if( p ){\n    int nByte = sizeof(*p) + sizeof(p->a[0]) * (p->nCte-1);\n    pRet = sqlite3DbMallocZero(db, nByte);\n    if( pRet ){\n      int i;\n      pRet->nCte = p->nCte;\n      for(i=0; i<p->nCte; i++){\n        pRet->a[i].pSelect = sqlite3SelectDup(db, p->a[i].pSelect, 0);\n        pRet->a[i].pCols = sqlite3ExprListDup(db, p->a[i].pCols, 0);\n        pRet->a[i].zName = sqlite3DbStrDup(db, p->a[i].zName);\n      }\n    }\n  }\n  return pRet;\n}\n#else\n# define withDup(x,y) 0\n#endif\n\n/*\n** The following group of routines make deep copies of expressions,\n** expression lists, ID lists, and select statements.  The copies can\n** be deleted (by being passed to their respective ...Delete() routines)\n** without effecting the originals.\n**\n** The expression list, ID, and source lists return by sqlite3ExprListDup(),\n** sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded \n** by subsequent calls to sqlite*ListAppend() routines.\n**\n** Any tables that the SrcList might point to are not duplicated.\n**\n** The flags parameter contains a combination of the EXPRDUP_XXX flags.\n** If the EXPRDUP_REDUCE flag is set, then the structure returned is a\n** truncated version of the usual Expr structure that will be stored as\n** part of the in-memory representation of the database schema.\n*/\nExpr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){\n  assert( flags==0 || flags==EXPRDUP_REDUCE );\n  return p ? exprDup(db, p, flags, 0) : 0;\n}\nExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){\n  ExprList *pNew;\n  struct ExprList_item *pItem, *pOldItem;\n  int i;\n  assert( db!=0 );\n  if( p==0 ) return 0;\n  pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew) );\n  if( pNew==0 ) return 0;\n  pNew->nExpr = i = p->nExpr;\n  if( (flags & EXPRDUP_REDUCE)==0 ) for(i=1; i<p->nExpr; i+=i){}\n  pNew->a = pItem = sqlite3DbMallocRawNN(db,  i*sizeof(p->a[0]) );\n  if( pItem==0 ){\n    sqlite3DbFree(db, pNew);\n    return 0;\n  } \n  pOldItem = p->a;\n  for(i=0; i<p->nExpr; i++, pItem++, pOldItem++){\n    Expr *pOldExpr = pOldItem->pExpr;\n    pItem->pExpr = sqlite3ExprDup(db, pOldExpr, flags);\n    pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);\n    pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan);\n    pItem->sortOrder = pOldItem->sortOrder;\n    pItem->done = 0;\n    pItem->bSpanIsTab = pOldItem->bSpanIsTab;\n    pItem->u = pOldItem->u;\n  }\n  return pNew;\n}\n\n/*\n** If cursors, triggers, views and subqueries are all omitted from\n** the build, then none of the following routines, except for \n** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes\n** called with a NULL argument.\n*/\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \\\n || !defined(SQLITE_OMIT_SUBQUERY)\nSrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){\n  SrcList *pNew;\n  int i;\n  int nByte;\n  assert( db!=0 );\n  if( p==0 ) return 0;\n  nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);\n  pNew = sqlite3DbMallocRawNN(db, nByte );\n  if( pNew==0 ) return 0;\n  pNew->nSrc = pNew->nAlloc = p->nSrc;\n  for(i=0; i<p->nSrc; i++){\n    struct SrcList_item *pNewItem = &pNew->a[i];\n    struct SrcList_item *pOldItem = &p->a[i];\n    Table *pTab;\n    pNewItem->pSchema = pOldItem->pSchema;\n    pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);\n    pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);\n    pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);\n    pNewItem->fg = pOldItem->fg;\n    pNewItem->iCursor = pOldItem->iCursor;\n    pNewItem->addrFillSub = pOldItem->addrFillSub;\n    pNewItem->regReturn = pOldItem->regReturn;\n    if( pNewItem->fg.isIndexedBy ){\n      pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy);\n    }\n    pNewItem->pIBIndex = pOldItem->pIBIndex;\n    if( pNewItem->fg.isTabFunc ){\n      pNewItem->u1.pFuncArg = \n          sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags);\n    }\n    pTab = pNewItem->pTab = pOldItem->pTab;\n    if( pTab ){\n      pTab->nRef++;\n    }\n    pNewItem->pSelect = sqlite3SelectDup(db, pOldItem->pSelect, flags);\n    pNewItem->pOn = sqlite3ExprDup(db, pOldItem->pOn, flags);\n    pNewItem->pUsing = sqlite3IdListDup(db, pOldItem->pUsing);\n    pNewItem->colUsed = pOldItem->colUsed;\n  }\n  return pNew;\n}\nIdList *sqlite3IdListDup(sqlite3 *db, IdList *p){\n  IdList *pNew;\n  int i;\n  assert( db!=0 );\n  if( p==0 ) return 0;\n  pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew) );\n  if( pNew==0 ) return 0;\n  pNew->nId = p->nId;\n  pNew->a = sqlite3DbMallocRawNN(db, p->nId*sizeof(p->a[0]) );\n  if( pNew->a==0 ){\n    sqlite3DbFree(db, pNew);\n    return 0;\n  }\n  /* Note that because the size of the allocation for p->a[] is not\n  ** necessarily a power of two, sqlite3IdListAppend() may not be called\n  ** on the duplicate created by this function. */\n  for(i=0; i<p->nId; i++){\n    struct IdList_item *pNewItem = &pNew->a[i];\n    struct IdList_item *pOldItem = &p->a[i];\n    pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);\n    pNewItem->idx = pOldItem->idx;\n  }\n  return pNew;\n}\nSelect *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){\n  Select *pNew, *pPrior;\n  assert( db!=0 );\n  if( p==0 ) return 0;\n  pNew = sqlite3DbMallocRawNN(db, sizeof(*p) );\n  if( pNew==0 ) return 0;\n  pNew->pEList = sqlite3ExprListDup(db, p->pEList, flags);\n  pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);\n  pNew->pWhere = sqlite3ExprDup(db, p->pWhere, flags);\n  pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy, flags);\n  pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags);\n  pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags);\n  pNew->op = p->op;\n  pNew->pPrior = pPrior = sqlite3SelectDup(db, p->pPrior, flags);\n  if( pPrior ) pPrior->pNext = pNew;\n  pNew->pNext = 0;\n  pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags);\n  pNew->pOffset = sqlite3ExprDup(db, p->pOffset, flags);\n  pNew->iLimit = 0;\n  pNew->iOffset = 0;\n  pNew->selFlags = p->selFlags & ~SF_UsesEphemeral;\n  pNew->addrOpenEphm[0] = -1;\n  pNew->addrOpenEphm[1] = -1;\n  pNew->nSelectRow = p->nSelectRow;\n  pNew->pWith = withDup(db, p->pWith);\n  sqlite3SelectSetName(pNew, p->zSelName);\n  return pNew;\n}\n#else\nSelect *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){\n  assert( p==0 );\n  return 0;\n}\n#endif\n\n\n/*\n** Add a new element to the end of an expression list.  If pList is\n** initially NULL, then create a new expression list.\n**\n** If a memory allocation error occurs, the entire list is freed and\n** NULL is returned.  If non-NULL is returned, then it is guaranteed\n** that the new entry was successfully appended.\n*/\nExprList *sqlite3ExprListAppend(\n  Parse *pParse,          /* Parsing context */\n  ExprList *pList,        /* List to which to append. Might be NULL */\n  Expr *pExpr             /* Expression to be appended. Might be NULL */\n){\n  sqlite3 *db = pParse->db;\n  assert( db!=0 );\n  if( pList==0 ){\n    pList = sqlite3DbMallocRawNN(db, sizeof(ExprList) );\n    if( pList==0 ){\n      goto no_mem;\n    }\n    pList->nExpr = 0;\n    pList->a = sqlite3DbMallocRawNN(db, sizeof(pList->a[0]));\n    if( pList->a==0 ) goto no_mem;\n  }else if( (pList->nExpr & (pList->nExpr-1))==0 ){\n    struct ExprList_item *a;\n    assert( pList->nExpr>0 );\n    a = sqlite3DbRealloc(db, pList->a, pList->nExpr*2*sizeof(pList->a[0]));\n    if( a==0 ){\n      goto no_mem;\n    }\n    pList->a = a;\n  }\n  assert( pList->a!=0 );\n  if( 1 ){\n    struct ExprList_item *pItem = &pList->a[pList->nExpr++];\n    memset(pItem, 0, sizeof(*pItem));\n    pItem->pExpr = pExpr;\n  }\n  return pList;\n\nno_mem:     \n  /* Avoid leaking memory if malloc has failed. */\n  sqlite3ExprDelete(db, pExpr);\n  sqlite3ExprListDelete(db, pList);\n  return 0;\n}\n\n/*\n** pColumns and pExpr form a vector assignment which is part of the SET\n** clause of an UPDATE statement.  Like this:\n**\n**        (a,b,c) = (expr1,expr2,expr3)\n** Or:    (a,b,c) = (SELECT x,y,z FROM ....)\n**\n** For each term of the vector assignment, append new entries to the\n** expression list pList.  In the case of a subquery on the LHS, append\n** TK_SELECT_COLUMN expressions.\n*/\nExprList *sqlite3ExprListAppendVector(\n  Parse *pParse,         /* Parsing context */\n  ExprList *pList,       /* List to which to append. Might be NULL */\n  IdList *pColumns,      /* List of names of LHS of the assignment */\n  Expr *pExpr            /* Vector expression to be appended. Might be NULL */\n){\n  sqlite3 *db = pParse->db;\n  int n;\n  int i;\n  int iFirst = pList ? pList->nExpr : 0;\n  /* pColumns can only be NULL due to an OOM but an OOM will cause an\n  ** exit prior to this routine being invoked */\n  if( NEVER(pColumns==0) ) goto vector_append_error;\n  if( pExpr==0 ) goto vector_append_error;\n  n = sqlite3ExprVectorSize(pExpr);\n  if( pColumns->nId!=n ){\n    sqlite3ErrorMsg(pParse, \"%d columns assigned %d values\",\n                    pColumns->nId, n);\n    goto vector_append_error;\n  }\n  for(i=0; i<n; i++){\n    Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i);\n    pList = sqlite3ExprListAppend(pParse, pList, pSubExpr);\n    if( pList ){\n      assert( pList->nExpr==iFirst+i+1 );\n      pList->a[pList->nExpr-1].zName = pColumns->a[i].zName;\n      pColumns->a[i].zName = 0;\n    }\n  }\n  if( pExpr->op==TK_SELECT ){\n    if( pList && pList->a[iFirst].pExpr ){\n      assert( pList->a[iFirst].pExpr->op==TK_SELECT_COLUMN );\n      pList->a[iFirst].pExpr->pRight = pExpr;\n      pExpr = 0;\n    }\n  }\n\nvector_append_error:\n  sqlite3ExprDelete(db, pExpr);\n  sqlite3IdListDelete(db, pColumns);\n  return pList;\n}\n\n/*\n** Set the sort order for the last element on the given ExprList.\n*/\nvoid sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder){\n  if( p==0 ) return;\n  assert( SQLITE_SO_UNDEFINED<0 && SQLITE_SO_ASC>=0 && SQLITE_SO_DESC>0 );\n  assert( p->nExpr>0 );\n  if( iSortOrder<0 ){\n    assert( p->a[p->nExpr-1].sortOrder==SQLITE_SO_ASC );\n    return;\n  }\n  p->a[p->nExpr-1].sortOrder = (u8)iSortOrder;\n}\n\n/*\n** Set the ExprList.a[].zName element of the most recently added item\n** on the expression list.\n**\n** pList might be NULL following an OOM error.  But pName should never be\n** NULL.  If a memory allocation fails, the pParse->db->mallocFailed flag\n** is set.\n*/\nvoid sqlite3ExprListSetName(\n  Parse *pParse,          /* Parsing context */\n  ExprList *pList,        /* List to which to add the span. */\n  Token *pName,           /* Name to be added */\n  int dequote             /* True to cause the name to be dequoted */\n){\n  assert( pList!=0 || pParse->db->mallocFailed!=0 );\n  if( pList ){\n    struct ExprList_item *pItem;\n    assert( pList->nExpr>0 );\n    pItem = &pList->a[pList->nExpr-1];\n    assert( pItem->zName==0 );\n    pItem->zName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n);\n    if( dequote ) sqlite3Dequote(pItem->zName);\n  }\n}\n\n/*\n** Set the ExprList.a[].zSpan element of the most recently added item\n** on the expression list.\n**\n** pList might be NULL following an OOM error.  But pSpan should never be\n** NULL.  If a memory allocation fails, the pParse->db->mallocFailed flag\n** is set.\n*/\nvoid sqlite3ExprListSetSpan(\n  Parse *pParse,          /* Parsing context */\n  ExprList *pList,        /* List to which to add the span. */\n  ExprSpan *pSpan         /* The span to be added */\n){\n  sqlite3 *db = pParse->db;\n  assert( pList!=0 || db->mallocFailed!=0 );\n  if( pList ){\n    struct ExprList_item *pItem = &pList->a[pList->nExpr-1];\n    assert( pList->nExpr>0 );\n    assert( db->mallocFailed || pItem->pExpr==pSpan->pExpr );\n    sqlite3DbFree(db, pItem->zSpan);\n    pItem->zSpan = sqlite3DbStrNDup(db, (char*)pSpan->zStart,\n                                    (int)(pSpan->zEnd - pSpan->zStart));\n  }\n}\n\n/*\n** If the expression list pEList contains more than iLimit elements,\n** leave an error message in pParse.\n*/\nvoid sqlite3ExprListCheckLength(\n  Parse *pParse,\n  ExprList *pEList,\n  const char *zObject\n){\n  int mx = pParse->db->aLimit[SQLITE_LIMIT_COLUMN];\n  testcase( pEList && pEList->nExpr==mx );\n  testcase( pEList && pEList->nExpr==mx+1 );\n  if( pEList && pEList->nExpr>mx ){\n    sqlite3ErrorMsg(pParse, \"too many columns in %s\", zObject);\n  }\n}\n\n/*\n** Delete an entire expression list.\n*/\nstatic SQLITE_NOINLINE void exprListDeleteNN(sqlite3 *db, ExprList *pList){\n  int i;\n  struct ExprList_item *pItem;\n  assert( pList->a!=0 || pList->nExpr==0 );\n  for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){\n    sqlite3ExprDelete(db, pItem->pExpr);\n    sqlite3DbFree(db, pItem->zName);\n    sqlite3DbFree(db, pItem->zSpan);\n  }\n  sqlite3DbFree(db, pList->a);\n  sqlite3DbFree(db, pList);\n}\nvoid sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){\n  if( pList ) exprListDeleteNN(db, pList);\n}\n\n/*\n** Return the bitwise-OR of all Expr.flags fields in the given\n** ExprList.\n*/\nu32 sqlite3ExprListFlags(const ExprList *pList){\n  int i;\n  u32 m = 0;\n  if( pList ){\n    for(i=0; i<pList->nExpr; i++){\n       Expr *pExpr = pList->a[i].pExpr;\n       assert( pExpr!=0 );\n       m |= pExpr->flags;\n    }\n  }\n  return m;\n}\n\n/*\n** These routines are Walker callbacks used to check expressions to\n** see if they are \"constant\" for some definition of constant.  The\n** Walker.eCode value determines the type of \"constant\" we are looking\n** for.\n**\n** These callback routines are used to implement the following:\n**\n**     sqlite3ExprIsConstant()                  pWalker->eCode==1\n**     sqlite3ExprIsConstantNotJoin()           pWalker->eCode==2\n**     sqlite3ExprIsTableConstant()             pWalker->eCode==3\n**     sqlite3ExprIsConstantOrFunction()        pWalker->eCode==4 or 5\n**\n** In all cases, the callbacks set Walker.eCode=0 and abort if the expression\n** is found to not be a constant.\n**\n** The sqlite3ExprIsConstantOrFunction() is used for evaluating expressions\n** in a CREATE TABLE statement.  The Walker.eCode value is 5 when parsing\n** an existing schema and 4 when processing a new statement.  A bound\n** parameter raises an error for new statements, but is silently converted\n** to NULL for existing schemas.  This allows sqlite_master tables that \n** contain a bound parameter because they were generated by older versions\n** of SQLite to be parsed by newer versions of SQLite without raising a\n** malformed schema error.\n*/\nstatic int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){\n\n  /* If pWalker->eCode is 2 then any term of the expression that comes from\n  ** the ON or USING clauses of a left join disqualifies the expression\n  ** from being considered constant. */\n  if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_FromJoin) ){\n    pWalker->eCode = 0;\n    return WRC_Abort;\n  }\n\n  switch( pExpr->op ){\n    /* Consider functions to be constant if all their arguments are constant\n    ** and either pWalker->eCode==4 or 5 or the function has the\n    ** SQLITE_FUNC_CONST flag. */\n    case TK_FUNCTION:\n      if( pWalker->eCode>=4 || ExprHasProperty(pExpr,EP_ConstFunc) ){\n        return WRC_Continue;\n      }else{\n        pWalker->eCode = 0;\n        return WRC_Abort;\n      }\n    case TK_ID:\n    case TK_COLUMN:\n    case TK_AGG_FUNCTION:\n    case TK_AGG_COLUMN:\n      testcase( pExpr->op==TK_ID );\n      testcase( pExpr->op==TK_COLUMN );\n      testcase( pExpr->op==TK_AGG_FUNCTION );\n      testcase( pExpr->op==TK_AGG_COLUMN );\n      if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){\n        return WRC_Continue;\n      }else{\n        pWalker->eCode = 0;\n        return WRC_Abort;\n      }\n    case TK_VARIABLE:\n      if( pWalker->eCode==5 ){\n        /* Silently convert bound parameters that appear inside of CREATE\n        ** statements into a NULL when parsing the CREATE statement text out\n        ** of the sqlite_master table */\n        pExpr->op = TK_NULL;\n      }else if( pWalker->eCode==4 ){\n        /* A bound parameter in a CREATE statement that originates from\n        ** sqlite3_prepare() causes an error */\n        pWalker->eCode = 0;\n        return WRC_Abort;\n      }\n      /* Fall through */\n    default:\n      testcase( pExpr->op==TK_SELECT ); /* selectNodeIsConstant will disallow */\n      testcase( pExpr->op==TK_EXISTS ); /* selectNodeIsConstant will disallow */\n      return WRC_Continue;\n  }\n}\nstatic int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  pWalker->eCode = 0;\n  return WRC_Abort;\n}\nstatic int exprIsConst(Expr *p, int initFlag, int iCur){\n  Walker w;\n  memset(&w, 0, sizeof(w));\n  w.eCode = initFlag;\n  w.xExprCallback = exprNodeIsConstant;\n  w.xSelectCallback = selectNodeIsConstant;\n  w.u.iCur = iCur;\n  sqlite3WalkExpr(&w, p);\n  return w.eCode;\n}\n\n/*\n** Walk an expression tree.  Return non-zero if the expression is constant\n** and 0 if it involves variables or function calls.\n**\n** For the purposes of this function, a double-quoted string (ex: \"abc\")\n** is considered a variable but a single-quoted string (ex: 'abc') is\n** a constant.\n*/\nint sqlite3ExprIsConstant(Expr *p){\n  return exprIsConst(p, 1, 0);\n}\n\n/*\n** Walk an expression tree.  Return non-zero if the expression is constant\n** that does no originate from the ON or USING clauses of a join.\n** Return 0 if it involves variables or function calls or terms from\n** an ON or USING clause.\n*/\nint sqlite3ExprIsConstantNotJoin(Expr *p){\n  return exprIsConst(p, 2, 0);\n}\n\n/*\n** Walk an expression tree.  Return non-zero if the expression is constant\n** for any single row of the table with cursor iCur.  In other words, the\n** expression must not refer to any non-deterministic function nor any\n** table other than iCur.\n*/\nint sqlite3ExprIsTableConstant(Expr *p, int iCur){\n  return exprIsConst(p, 3, iCur);\n}\n\n/*\n** Walk an expression tree.  Return non-zero if the expression is constant\n** or a function call with constant arguments.  Return and 0 if there\n** are any variables.\n**\n** For the purposes of this function, a double-quoted string (ex: \"abc\")\n** is considered a variable but a single-quoted string (ex: 'abc') is\n** a constant.\n*/\nint sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){\n  assert( isInit==0 || isInit==1 );\n  return exprIsConst(p, 4+isInit, 0);\n}\n\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n/*\n** Walk an expression tree.  Return 1 if the expression contains a\n** subquery of some kind.  Return 0 if there are no subqueries.\n*/\nint sqlite3ExprContainsSubquery(Expr *p){\n  Walker w;\n  memset(&w, 0, sizeof(w));\n  w.eCode = 1;\n  w.xExprCallback = sqlite3ExprWalkNoop;\n  w.xSelectCallback = selectNodeIsConstant;\n  sqlite3WalkExpr(&w, p);\n  return w.eCode==0;\n}\n#endif\n\n/*\n** If the expression p codes a constant integer that is small enough\n** to fit in a 32-bit integer, return 1 and put the value of the integer\n** in *pValue.  If the expression is not an integer or if it is too big\n** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.\n*/\nint sqlite3ExprIsInteger(Expr *p, int *pValue){\n  int rc = 0;\n\n  /* If an expression is an integer literal that fits in a signed 32-bit\n  ** integer, then the EP_IntValue flag will have already been set */\n  assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0\n           || sqlite3GetInt32(p->u.zToken, &rc)==0 );\n\n  if( p->flags & EP_IntValue ){\n    *pValue = p->u.iValue;\n    return 1;\n  }\n  switch( p->op ){\n    case TK_UPLUS: {\n      rc = sqlite3ExprIsInteger(p->pLeft, pValue);\n      break;\n    }\n    case TK_UMINUS: {\n      int v;\n      if( sqlite3ExprIsInteger(p->pLeft, &v) ){\n        assert( v!=(-2147483647-1) );\n        *pValue = -v;\n        rc = 1;\n      }\n      break;\n    }\n    default: break;\n  }\n  return rc;\n}\n\n/*\n** Return FALSE if there is no chance that the expression can be NULL.\n**\n** If the expression might be NULL or if the expression is too complex\n** to tell return TRUE.  \n**\n** This routine is used as an optimization, to skip OP_IsNull opcodes\n** when we know that a value cannot be NULL.  Hence, a false positive\n** (returning TRUE when in fact the expression can never be NULL) might\n** be a small performance hit but is otherwise harmless.  On the other\n** hand, a false negative (returning FALSE when the result could be NULL)\n** will likely result in an incorrect answer.  So when in doubt, return\n** TRUE.\n*/\nint sqlite3ExprCanBeNull(const Expr *p){\n  u8 op;\n  while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }\n  op = p->op;\n  if( op==TK_REGISTER ) op = p->op2;\n  switch( op ){\n    case TK_INTEGER:\n    case TK_STRING:\n    case TK_FLOAT:\n    case TK_BLOB:\n      return 0;\n    case TK_COLUMN:\n      assert( p->pTab!=0 );\n      return ExprHasProperty(p, EP_CanBeNull) ||\n             (p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0);\n    default:\n      return 1;\n  }\n}\n\n/*\n** Return TRUE if the given expression is a constant which would be\n** unchanged by OP_Affinity with the affinity given in the second\n** argument.\n**\n** This routine is used to determine if the OP_Affinity operation\n** can be omitted.  When in doubt return FALSE.  A false negative\n** is harmless.  A false positive, however, can result in the wrong\n** answer.\n*/\nint sqlite3ExprNeedsNoAffinityChange(const Expr *p, char aff){\n  u8 op;\n  if( aff==SQLITE_AFF_BLOB ) return 1;\n  while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }\n  op = p->op;\n  if( op==TK_REGISTER ) op = p->op2;\n  switch( op ){\n    case TK_INTEGER: {\n      return aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC;\n    }\n    case TK_FLOAT: {\n      return aff==SQLITE_AFF_REAL || aff==SQLITE_AFF_NUMERIC;\n    }\n    case TK_STRING: {\n      return aff==SQLITE_AFF_TEXT;\n    }\n    case TK_BLOB: {\n      return 1;\n    }\n    case TK_COLUMN: {\n      assert( p->iTable>=0 );  /* p cannot be part of a CHECK constraint */\n      return p->iColumn<0\n          && (aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC);\n    }\n    default: {\n      return 0;\n    }\n  }\n}\n\n/*\n** Return TRUE if the given string is a row-id column name.\n*/\nint sqlite3IsRowid(const char *z){\n  if( sqlite3StrICmp(z, \"_ROWID_\")==0 ) return 1;\n  if( sqlite3StrICmp(z, \"ROWID\")==0 ) return 1;\n  if( sqlite3StrICmp(z, \"OID\")==0 ) return 1;\n  return 0;\n}\n\n/*\n** pX is the RHS of an IN operator.  If pX is a SELECT statement \n** that can be simplified to a direct table access, then return\n** a pointer to the SELECT statement.  If pX is not a SELECT statement,\n** or if the SELECT statement needs to be manifested into a transient\n** table, then return NULL.\n*/\n#ifndef SQLITE_OMIT_SUBQUERY\nstatic Select *isCandidateForInOpt(Expr *pX){\n  Select *p;\n  SrcList *pSrc;\n  ExprList *pEList;\n  Table *pTab;\n  int i;\n  if( !ExprHasProperty(pX, EP_xIsSelect) ) return 0;  /* Not a subquery */\n  if( ExprHasProperty(pX, EP_VarSelect)  ) return 0;  /* Correlated subq */\n  p = pX->x.pSelect;\n  if( p->pPrior ) return 0;              /* Not a compound SELECT */\n  if( p->selFlags & (SF_Distinct|SF_Aggregate) ){\n    testcase( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\n    testcase( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\n    return 0; /* No DISTINCT keyword and no aggregate functions */\n  }\n  assert( p->pGroupBy==0 );              /* Has no GROUP BY clause */\n  if( p->pLimit ) return 0;              /* Has no LIMIT clause */\n  assert( p->pOffset==0 );               /* No LIMIT means no OFFSET */\n  if( p->pWhere ) return 0;              /* Has no WHERE clause */\n  pSrc = p->pSrc;\n  assert( pSrc!=0 );\n  if( pSrc->nSrc!=1 ) return 0;          /* Single term in FROM clause */\n  if( pSrc->a[0].pSelect ) return 0;     /* FROM is not a subquery or view */\n  pTab = pSrc->a[0].pTab;\n  assert( pTab!=0 );\n  assert( pTab->pSelect==0 );            /* FROM clause is not a view */\n  if( IsVirtual(pTab) ) return 0;        /* FROM clause not a virtual table */\n  pEList = p->pEList;\n  assert( pEList!=0 );\n  /* All SELECT results must be columns. */\n  for(i=0; i<pEList->nExpr; i++){\n    Expr *pRes = pEList->a[i].pExpr;\n    if( pRes->op!=TK_COLUMN ) return 0;\n    assert( pRes->iTable==pSrc->a[0].iCursor );  /* Not a correlated subquery */\n  }\n  return p;\n}\n#endif /* SQLITE_OMIT_SUBQUERY */\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** Generate code that checks the left-most column of index table iCur to see if\n** it contains any NULL entries.  Cause the register at regHasNull to be set\n** to a non-NULL value if iCur contains no NULLs.  Cause register regHasNull\n** to be set to NULL if iCur contains one or more NULL values.\n*/\nstatic void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){\n  int addr1;\n  sqlite3VdbeAddOp2(v, OP_Integer, 0, regHasNull);\n  addr1 = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v);\n  sqlite3VdbeAddOp3(v, OP_Column, iCur, 0, regHasNull);\n  sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);\n  VdbeComment((v, \"first_entry_in(%d)\", iCur));\n  sqlite3VdbeJumpHere(v, addr1);\n}\n#endif\n\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** The argument is an IN operator with a list (not a subquery) on the \n** right-hand side.  Return TRUE if that list is constant.\n*/\nstatic int sqlite3InRhsIsConstant(Expr *pIn){\n  Expr *pLHS;\n  int res;\n  assert( !ExprHasProperty(pIn, EP_xIsSelect) );\n  pLHS = pIn->pLeft;\n  pIn->pLeft = 0;\n  res = sqlite3ExprIsConstant(pIn);\n  pIn->pLeft = pLHS;\n  return res;\n}\n#endif\n\n/*\n** This function is used by the implementation of the IN (...) operator.\n** The pX parameter is the expression on the RHS of the IN operator, which\n** might be either a list of expressions or a subquery.\n**\n** The job of this routine is to find or create a b-tree object that can\n** be used either to test for membership in the RHS set or to iterate through\n** all members of the RHS set, skipping duplicates.\n**\n** A cursor is opened on the b-tree object that is the RHS of the IN operator\n** and pX->iTable is set to the index of that cursor.\n**\n** The returned value of this function indicates the b-tree type, as follows:\n**\n**   IN_INDEX_ROWID      - The cursor was opened on a database table.\n**   IN_INDEX_INDEX_ASC  - The cursor was opened on an ascending index.\n**   IN_INDEX_INDEX_DESC - The cursor was opened on a descending index.\n**   IN_INDEX_EPH        - The cursor was opened on a specially created and\n**                         populated epheremal table.\n**   IN_INDEX_NOOP       - No cursor was allocated.  The IN operator must be\n**                         implemented as a sequence of comparisons.\n**\n** An existing b-tree might be used if the RHS expression pX is a simple\n** subquery such as:\n**\n**     SELECT <column1>, <column2>... FROM <table>\n**\n** If the RHS of the IN operator is a list or a more complex subquery, then\n** an ephemeral table might need to be generated from the RHS and then\n** pX->iTable made to point to the ephemeral table instead of an\n** existing table.\n**\n** The inFlags parameter must contain exactly one of the bits\n** IN_INDEX_MEMBERSHIP or IN_INDEX_LOOP.  If inFlags contains\n** IN_INDEX_MEMBERSHIP, then the generated table will be used for a\n** fast membership test.  When the IN_INDEX_LOOP bit is set, the\n** IN index will be used to loop over all values of the RHS of the\n** IN operator.\n**\n** When IN_INDEX_LOOP is used (and the b-tree will be used to iterate\n** through the set members) then the b-tree must not contain duplicates.\n** An epheremal table must be used unless the selected columns are guaranteed\n** to be unique - either because it is an INTEGER PRIMARY KEY or due to\n** a UNIQUE constraint or index.\n**\n** When IN_INDEX_MEMBERSHIP is used (and the b-tree will be used \n** for fast set membership tests) then an epheremal table must \n** be used unless <columns> is a single INTEGER PRIMARY KEY column or an \n** index can be found with the specified <columns> as its left-most.\n**\n** If the IN_INDEX_NOOP_OK and IN_INDEX_MEMBERSHIP are both set and\n** if the RHS of the IN operator is a list (not a subquery) then this\n** routine might decide that creating an ephemeral b-tree for membership\n** testing is too expensive and return IN_INDEX_NOOP.  In that case, the\n** calling routine should implement the IN operator using a sequence\n** of Eq or Ne comparison operations.\n**\n** When the b-tree is being used for membership tests, the calling function\n** might need to know whether or not the RHS side of the IN operator\n** contains a NULL.  If prRhsHasNull is not a NULL pointer and \n** if there is any chance that the (...) might contain a NULL value at\n** runtime, then a register is allocated and the register number written\n** to *prRhsHasNull. If there is no chance that the (...) contains a\n** NULL value, then *prRhsHasNull is left unchanged.\n**\n** If a register is allocated and its location stored in *prRhsHasNull, then\n** the value in that register will be NULL if the b-tree contains one or more\n** NULL values, and it will be some non-NULL value if the b-tree contains no\n** NULL values.\n**\n** If the aiMap parameter is not NULL, it must point to an array containing\n** one element for each column returned by the SELECT statement on the RHS\n** of the IN(...) operator. The i'th entry of the array is populated with the\n** offset of the index column that matches the i'th column returned by the\n** SELECT. For example, if the expression and selected index are:\n**\n**   (?,?,?) IN (SELECT a, b, c FROM t1)\n**   CREATE INDEX i1 ON t1(b, c, a);\n**\n** then aiMap[] is populated with {2, 0, 1}.\n*/\n#ifndef SQLITE_OMIT_SUBQUERY\nint sqlite3FindInIndex(\n  Parse *pParse,             /* Parsing context */\n  Expr *pX,                  /* The right-hand side (RHS) of the IN operator */\n  u32 inFlags,               /* IN_INDEX_LOOP, _MEMBERSHIP, and/or _NOOP_OK */\n  int *prRhsHasNull,         /* Register holding NULL status.  See notes */\n  int *aiMap                 /* Mapping from Index fields to RHS fields */\n){\n  Select *p;                            /* SELECT to the right of IN operator */\n  int eType = 0;                        /* Type of RHS table. IN_INDEX_* */\n  int iTab = pParse->nTab++;            /* Cursor of the RHS table */\n  int mustBeUnique;                     /* True if RHS must be unique */\n  Vdbe *v = sqlite3GetVdbe(pParse);     /* Virtual machine being coded */\n\n  assert( pX->op==TK_IN );\n  mustBeUnique = (inFlags & IN_INDEX_LOOP)!=0;\n\n  /* If the RHS of this IN(...) operator is a SELECT, and if it matters \n  ** whether or not the SELECT result contains NULL values, check whether\n  ** or not NULL is actually possible (it may not be, for example, due \n  ** to NOT NULL constraints in the schema). If no NULL values are possible,\n  ** set prRhsHasNull to 0 before continuing.  */\n  if( prRhsHasNull && (pX->flags & EP_xIsSelect) ){\n    int i;\n    ExprList *pEList = pX->x.pSelect->pEList;\n    for(i=0; i<pEList->nExpr; i++){\n      if( sqlite3ExprCanBeNull(pEList->a[i].pExpr) ) break;\n    }\n    if( i==pEList->nExpr ){\n      prRhsHasNull = 0;\n    }\n  }\n\n  /* Check to see if an existing table or index can be used to\n  ** satisfy the query.  This is preferable to generating a new \n  ** ephemeral table.  */\n  if( pParse->nErr==0 && (p = isCandidateForInOpt(pX))!=0 ){\n    sqlite3 *db = pParse->db;              /* Database connection */\n    Table *pTab;                           /* Table <table>. */\n    i16 iDb;                               /* Database idx for pTab */\n    ExprList *pEList = p->pEList;\n    int nExpr = pEList->nExpr;\n\n    assert( p->pEList!=0 );             /* Because of isCandidateForInOpt(p) */\n    assert( p->pEList->a[0].pExpr!=0 ); /* Because of isCandidateForInOpt(p) */\n    assert( p->pSrc!=0 );               /* Because of isCandidateForInOpt(p) */\n    pTab = p->pSrc->a[0].pTab;\n\n    /* Code an OP_Transaction and OP_TableLock for <table>. */\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n    sqlite3CodeVerifySchema(pParse, iDb);\n    sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\n\n    assert(v);  /* sqlite3GetVdbe() has always been previously called */\n    if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){\n      /* The \"x IN (SELECT rowid FROM table)\" case */\n      int iAddr = sqlite3VdbeAddOp0(v, OP_Once);\n      VdbeCoverage(v);\n\n      sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);\n      eType = IN_INDEX_ROWID;\n\n      sqlite3VdbeJumpHere(v, iAddr);\n    }else{\n      Index *pIdx;                         /* Iterator variable */\n      int affinity_ok = 1;\n      int i;\n\n      /* Check that the affinity that will be used to perform each \n      ** comparison is the same as the affinity of each column in table\n      ** on the RHS of the IN operator.  If it not, it is not possible to\n      ** use any index of the RHS table.  */\n      for(i=0; i<nExpr && affinity_ok; i++){\n        Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);\n        int iCol = pEList->a[i].pExpr->iColumn;\n        char idxaff = sqlite3TableColumnAffinity(pTab,iCol); /* RHS table */\n        char cmpaff = sqlite3CompareAffinity(pLhs, idxaff);\n        testcase( cmpaff==SQLITE_AFF_BLOB );\n        testcase( cmpaff==SQLITE_AFF_TEXT );\n        switch( cmpaff ){\n          case SQLITE_AFF_BLOB:\n            break;\n          case SQLITE_AFF_TEXT:\n            /* sqlite3CompareAffinity() only returns TEXT if one side or the\n            ** other has no affinity and the other side is TEXT.  Hence,\n            ** the only way for cmpaff to be TEXT is for idxaff to be TEXT\n            ** and for the term on the LHS of the IN to have no affinity. */\n            assert( idxaff==SQLITE_AFF_TEXT );\n            break;\n          default:\n            affinity_ok = sqlite3IsNumericAffinity(idxaff);\n        }\n      }\n\n      if( affinity_ok ){\n        /* Search for an existing index that will work for this IN operator */\n        for(pIdx=pTab->pIndex; pIdx && eType==0; pIdx=pIdx->pNext){\n          Bitmask colUsed;      /* Columns of the index used */\n          Bitmask mCol;         /* Mask for the current column */\n          if( pIdx->nColumn<nExpr ) continue;\n          /* Maximum nColumn is BMS-2, not BMS-1, so that we can compute\n          ** BITMASK(nExpr) without overflowing */\n          testcase( pIdx->nColumn==BMS-2 );\n          testcase( pIdx->nColumn==BMS-1 );\n          if( pIdx->nColumn>=BMS-1 ) continue;\n          if( mustBeUnique ){\n            if( pIdx->nKeyCol>nExpr\n             ||(pIdx->nColumn>nExpr && !IsUniqueIndex(pIdx))\n            ){\n              continue;  /* This index is not unique over the IN RHS columns */\n            }\n          }\n  \n          colUsed = 0;   /* Columns of index used so far */\n          for(i=0; i<nExpr; i++){\n            Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);\n            Expr *pRhs = pEList->a[i].pExpr;\n            CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);\n            int j;\n  \n            assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );\n            for(j=0; j<nExpr; j++){\n              if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;\n              assert( pIdx->azColl[j] );\n              if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){\n                continue;\n              }\n              break;\n            }\n            if( j==nExpr ) break;\n            mCol = MASKBIT(j);\n            if( mCol & colUsed ) break; /* Each column used only once */\n            colUsed |= mCol;\n            if( aiMap ) aiMap[i] = j;\n          }\n  \n          assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) );\n          if( colUsed==(MASKBIT(nExpr)-1) ){\n            /* If we reach this point, that means the index pIdx is usable */\n            int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);\n#ifndef SQLITE_OMIT_EXPLAIN\n            sqlite3VdbeAddOp4(v, OP_Explain, 0, 0, 0,\n              sqlite3MPrintf(db, \"USING INDEX %s FOR IN-OPERATOR\",pIdx->zName),\n              P4_DYNAMIC);\n#endif\n            sqlite3VdbeAddOp3(v, OP_OpenRead, iTab, pIdx->tnum, iDb);\n            sqlite3VdbeSetP4KeyInfo(pParse, pIdx);\n            VdbeComment((v, \"%s\", pIdx->zName));\n            assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 );\n            eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0];\n  \n            if( prRhsHasNull ){\n#ifdef SQLITE_ENABLE_COLUMN_USED_MASK\n              i64 mask = (1<<nExpr)-1;\n              sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, \n                  iTab, 0, 0, (u8*)&mask, P4_INT64);\n#endif\n              *prRhsHasNull = ++pParse->nMem;\n              if( nExpr==1 ){\n                sqlite3SetHasNullFlag(v, iTab, *prRhsHasNull);\n              }\n            }\n            sqlite3VdbeJumpHere(v, iAddr);\n          }\n        } /* End loop over indexes */\n      } /* End if( affinity_ok ) */\n    } /* End if not an rowid index */\n  } /* End attempt to optimize using an index */\n\n  /* If no preexisting index is available for the IN clause\n  ** and IN_INDEX_NOOP is an allowed reply\n  ** and the RHS of the IN operator is a list, not a subquery\n  ** and the RHS is not constant or has two or fewer terms,\n  ** then it is not worth creating an ephemeral table to evaluate\n  ** the IN operator so return IN_INDEX_NOOP.\n  */\n  if( eType==0\n   && (inFlags & IN_INDEX_NOOP_OK)\n   && !ExprHasProperty(pX, EP_xIsSelect)\n   && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2)\n  ){\n    eType = IN_INDEX_NOOP;\n  }\n\n  if( eType==0 ){\n    /* Could not find an existing table or index to use as the RHS b-tree.\n    ** We will have to generate an ephemeral table to do the job.\n    */\n    u32 savedNQueryLoop = pParse->nQueryLoop;\n    int rMayHaveNull = 0;\n    eType = IN_INDEX_EPH;\n    if( inFlags & IN_INDEX_LOOP ){\n      pParse->nQueryLoop = 0;\n      if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){\n        eType = IN_INDEX_ROWID;\n      }\n    }else if( prRhsHasNull ){\n      *prRhsHasNull = rMayHaveNull = ++pParse->nMem;\n    }\n    sqlite3CodeSubselect(pParse, pX, rMayHaveNull, eType==IN_INDEX_ROWID);\n    pParse->nQueryLoop = savedNQueryLoop;\n  }else{\n    pX->iTable = iTab;\n  }\n\n  if( aiMap && eType!=IN_INDEX_INDEX_ASC && eType!=IN_INDEX_INDEX_DESC ){\n    int i, n;\n    n = sqlite3ExprVectorSize(pX->pLeft);\n    for(i=0; i<n; i++) aiMap[i] = i;\n  }\n  return eType;\n}\n#endif\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** Argument pExpr is an (?, ?...) IN(...) expression. This \n** function allocates and returns a nul-terminated string containing \n** the affinities to be used for each column of the comparison.\n**\n** It is the responsibility of the caller to ensure that the returned\n** string is eventually freed using sqlite3DbFree().\n*/\nstatic char *exprINAffinity(Parse *pParse, Expr *pExpr){\n  Expr *pLeft = pExpr->pLeft;\n  int nVal = sqlite3ExprVectorSize(pLeft);\n  Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0;\n  char *zRet;\n\n  assert( pExpr->op==TK_IN );\n  zRet = sqlite3DbMallocZero(pParse->db, nVal+1);\n  if( zRet ){\n    int i;\n    for(i=0; i<nVal; i++){\n      Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i);\n      char a = sqlite3ExprAffinity(pA);\n      if( pSelect ){\n        zRet[i] = sqlite3CompareAffinity(pSelect->pEList->a[i].pExpr, a);\n      }else{\n        zRet[i] = a;\n      }\n    }\n    zRet[nVal] = '\\0';\n  }\n  return zRet;\n}\n#endif\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** Load the Parse object passed as the first argument with an error \n** message of the form:\n**\n**   \"sub-select returns N columns - expected M\"\n*/   \nvoid sqlite3SubselectError(Parse *pParse, int nActual, int nExpect){\n  const char *zFmt = \"sub-select returns %d columns - expected %d\";\n  sqlite3ErrorMsg(pParse, zFmt, nActual, nExpect);\n}\n#endif\n\n/*\n** Generate code for scalar subqueries used as a subquery expression, EXISTS,\n** or IN operators.  Examples:\n**\n**     (SELECT a FROM b)          -- subquery\n**     EXISTS (SELECT a FROM b)   -- EXISTS subquery\n**     x IN (4,5,11)              -- IN operator with list on right-hand side\n**     x IN (SELECT a FROM b)     -- IN operator with subquery on the right\n**\n** The pExpr parameter describes the expression that contains the IN\n** operator or subquery.\n**\n** If parameter isRowid is non-zero, then expression pExpr is guaranteed\n** to be of the form \"<rowid> IN (?, ?, ?)\", where <rowid> is a reference\n** to some integer key column of a table B-Tree. In this case, use an\n** intkey B-Tree to store the set of IN(...) values instead of the usual\n** (slower) variable length keys B-Tree.\n**\n** If rMayHaveNull is non-zero, that means that the operation is an IN\n** (not a SELECT or EXISTS) and that the RHS might contains NULLs.\n** All this routine does is initialize the register given by rMayHaveNull\n** to NULL.  Calling routines will take care of changing this register\n** value to non-NULL if the RHS is NULL-free.\n**\n** For a SELECT or EXISTS operator, return the register that holds the\n** result.  For a multi-column SELECT, the result is stored in a contiguous\n** array of registers and the return value is the register of the left-most\n** result column.  Return 0 for IN operators or if an error occurs.\n*/\n#ifndef SQLITE_OMIT_SUBQUERY\nint sqlite3CodeSubselect(\n  Parse *pParse,          /* Parsing context */\n  Expr *pExpr,            /* The IN, SELECT, or EXISTS operator */\n  int rHasNullFlag,       /* Register that records whether NULLs exist in RHS */\n  int isRowid             /* If true, LHS of IN operator is a rowid */\n){\n  int jmpIfDynamic = -1;                      /* One-time test address */\n  int rReg = 0;                           /* Register storing resulting */\n  Vdbe *v = sqlite3GetVdbe(pParse);\n  if( NEVER(v==0) ) return 0;\n  sqlite3ExprCachePush(pParse);\n\n  /* The evaluation of the IN/EXISTS/SELECT must be repeated every time it\n  ** is encountered if any of the following is true:\n  **\n  **    *  The right-hand side is a correlated subquery\n  **    *  The right-hand side is an expression list containing variables\n  **    *  We are inside a trigger\n  **\n  ** If all of the above are false, then we can run this code just once\n  ** save the results, and reuse the same result on subsequent invocations.\n  */\n  if( !ExprHasProperty(pExpr, EP_VarSelect) ){\n    jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);\n  }\n\n#ifndef SQLITE_OMIT_EXPLAIN\n  if( pParse->explain==2 ){\n    char *zMsg = sqlite3MPrintf(pParse->db, \"EXECUTE %s%s SUBQUERY %d\",\n        jmpIfDynamic>=0?\"\":\"CORRELATED \",\n        pExpr->op==TK_IN?\"LIST\":\"SCALAR\",\n        pParse->iNextSelectId\n    );\n    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);\n  }\n#endif\n\n  switch( pExpr->op ){\n    case TK_IN: {\n      int addr;                   /* Address of OP_OpenEphemeral instruction */\n      Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */\n      KeyInfo *pKeyInfo = 0;      /* Key information */\n      int nVal;                   /* Size of vector pLeft */\n      \n      nVal = sqlite3ExprVectorSize(pLeft);\n      assert( !isRowid || nVal==1 );\n\n      /* Whether this is an 'x IN(SELECT...)' or an 'x IN(<exprlist>)'\n      ** expression it is handled the same way.  An ephemeral table is \n      ** filled with index keys representing the results from the \n      ** SELECT or the <exprlist>.\n      **\n      ** If the 'x' expression is a column value, or the SELECT...\n      ** statement returns a column value, then the affinity of that\n      ** column is used to build the index keys. If both 'x' and the\n      ** SELECT... statement are columns, then numeric affinity is used\n      ** if either column has NUMERIC or INTEGER affinity. If neither\n      ** 'x' nor the SELECT... statement are columns, then numeric affinity\n      ** is used.\n      */\n      pExpr->iTable = pParse->nTab++;\n      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, \n          pExpr->iTable, (isRowid?0:nVal));\n      pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1);\n\n      if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n        /* Case 1:     expr IN (SELECT ...)\n        **\n        ** Generate code to write the results of the select into the temporary\n        ** table allocated and opened above.\n        */\n        Select *pSelect = pExpr->x.pSelect;\n        ExprList *pEList = pSelect->pEList;\n\n        assert( !isRowid );\n        /* If the LHS and RHS of the IN operator do not match, that\n        ** error will have been caught long before we reach this point. */\n        if( ALWAYS(pEList->nExpr==nVal) ){\n          SelectDest dest;\n          int i;\n          sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);\n          dest.zAffSdst = exprINAffinity(pParse, pExpr);\n          assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );\n          pSelect->iLimit = 0;\n          testcase( pSelect->selFlags & SF_Distinct );\n          testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */\n          if( sqlite3Select(pParse, pSelect, &dest) ){\n            sqlite3DbFree(pParse->db, dest.zAffSdst);\n            sqlite3KeyInfoUnref(pKeyInfo);\n            return 0;\n          }\n          sqlite3DbFree(pParse->db, dest.zAffSdst);\n          assert( pKeyInfo!=0 ); /* OOM will cause exit after sqlite3Select() */\n          assert( pEList!=0 );\n          assert( pEList->nExpr>0 );\n          assert( sqlite3KeyInfoIsWriteable(pKeyInfo) );\n          for(i=0; i<nVal; i++){\n            Expr *p = sqlite3VectorFieldSubexpr(pLeft, i);\n            pKeyInfo->aColl[i] = sqlite3BinaryCompareCollSeq(\n                pParse, p, pEList->a[i].pExpr\n            );\n          }\n        }\n      }else if( ALWAYS(pExpr->x.pList!=0) ){\n        /* Case 2:     expr IN (exprlist)\n        **\n        ** For each expression, build an index key from the evaluation and\n        ** store it in the temporary table. If <expr> is a column, then use\n        ** that columns affinity when building index keys. If <expr> is not\n        ** a column, use numeric affinity.\n        */\n        char affinity;            /* Affinity of the LHS of the IN */\n        int i;\n        ExprList *pList = pExpr->x.pList;\n        struct ExprList_item *pItem;\n        int r1, r2, r3;\n\n        affinity = sqlite3ExprAffinity(pLeft);\n        if( !affinity ){\n          affinity = SQLITE_AFF_BLOB;\n        }\n        if( pKeyInfo ){\n          assert( sqlite3KeyInfoIsWriteable(pKeyInfo) );\n          pKeyInfo->aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft);\n        }\n\n        /* Loop through each expression in <exprlist>. */\n        r1 = sqlite3GetTempReg(pParse);\n        r2 = sqlite3GetTempReg(pParse);\n        if( isRowid ) sqlite3VdbeAddOp2(v, OP_Null, 0, r2);\n        for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){\n          Expr *pE2 = pItem->pExpr;\n          int iValToIns;\n\n          /* If the expression is not constant then we will need to\n          ** disable the test that was generated above that makes sure\n          ** this code only executes once.  Because for a non-constant\n          ** expression we need to rerun this code each time.\n          */\n          if( jmpIfDynamic>=0 && !sqlite3ExprIsConstant(pE2) ){\n            sqlite3VdbeChangeToNoop(v, jmpIfDynamic);\n            jmpIfDynamic = -1;\n          }\n\n          /* Evaluate the expression and insert it into the temp table */\n          if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){\n            sqlite3VdbeAddOp3(v, OP_InsertInt, pExpr->iTable, r2, iValToIns);\n          }else{\n            r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);\n            if( isRowid ){\n              sqlite3VdbeAddOp2(v, OP_MustBeInt, r3,\n                                sqlite3VdbeCurrentAddr(v)+2);\n              VdbeCoverage(v);\n              sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);\n            }else{\n              sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);\n              sqlite3ExprCacheAffinityChange(pParse, r3, 1);\n              sqlite3VdbeAddOp2(v, OP_IdxInsert, pExpr->iTable, r2);\n            }\n          }\n        }\n        sqlite3ReleaseTempReg(pParse, r1);\n        sqlite3ReleaseTempReg(pParse, r2);\n      }\n      if( pKeyInfo ){\n        sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO);\n      }\n      break;\n    }\n\n    case TK_EXISTS:\n    case TK_SELECT:\n    default: {\n      /* Case 3:    (SELECT ... FROM ...)\n      **     or:    EXISTS(SELECT ... FROM ...)\n      **\n      ** For a SELECT, generate code to put the values for all columns of\n      ** the first row into an array of registers and return the index of\n      ** the first register.\n      **\n      ** If this is an EXISTS, write an integer 0 (not exists) or 1 (exists)\n      ** into a register and return that register number.\n      **\n      ** In both cases, the query is augmented with \"LIMIT 1\".  Any \n      ** preexisting limit is discarded in place of the new LIMIT 1.\n      */\n      Select *pSel;                         /* SELECT statement to encode */\n      SelectDest dest;                      /* How to deal with SELECT result */\n      int nReg;                             /* Registers to allocate */\n\n      testcase( pExpr->op==TK_EXISTS );\n      testcase( pExpr->op==TK_SELECT );\n      assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT );\n      assert( ExprHasProperty(pExpr, EP_xIsSelect) );\n\n      pSel = pExpr->x.pSelect;\n      nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;\n      sqlite3SelectDestInit(&dest, 0, pParse->nMem+1);\n      pParse->nMem += nReg;\n      if( pExpr->op==TK_SELECT ){\n        dest.eDest = SRT_Mem;\n        dest.iSdst = dest.iSDParm;\n        dest.nSdst = nReg;\n        sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1);\n        VdbeComment((v, \"Init subquery result\"));\n      }else{\n        dest.eDest = SRT_Exists;\n        sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm);\n        VdbeComment((v, \"Init EXISTS result\"));\n      }\n      sqlite3ExprDelete(pParse->db, pSel->pLimit);\n      pSel->pLimit = sqlite3ExprAlloc(pParse->db, TK_INTEGER,\n                                  &sqlite3IntTokens[1], 0);\n      pSel->iLimit = 0;\n      pSel->selFlags &= ~SF_MultiValue;\n      if( sqlite3Select(pParse, pSel, &dest) ){\n        return 0;\n      }\n      rReg = dest.iSDParm;\n      ExprSetVVAProperty(pExpr, EP_NoReduce);\n      break;\n    }\n  }\n\n  if( rHasNullFlag ){\n    sqlite3SetHasNullFlag(v, pExpr->iTable, rHasNullFlag);\n  }\n\n  if( jmpIfDynamic>=0 ){\n    sqlite3VdbeJumpHere(v, jmpIfDynamic);\n  }\n  sqlite3ExprCachePop(pParse);\n\n  return rReg;\n}\n#endif /* SQLITE_OMIT_SUBQUERY */\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** Expr pIn is an IN(...) expression. This function checks that the \n** sub-select on the RHS of the IN() operator has the same number of \n** columns as the vector on the LHS. Or, if the RHS of the IN() is not \n** a sub-query, that the LHS is a vector of size 1.\n*/\nint sqlite3ExprCheckIN(Parse *pParse, Expr *pIn){\n  int nVector = sqlite3ExprVectorSize(pIn->pLeft);\n  if( (pIn->flags & EP_xIsSelect) ){\n    if( nVector!=pIn->x.pSelect->pEList->nExpr ){\n      sqlite3SubselectError(pParse, pIn->x.pSelect->pEList->nExpr, nVector);\n      return 1;\n    }\n  }else if( nVector!=1 ){\n    if( (pIn->pLeft->flags & EP_xIsSelect) ){\n      sqlite3SubselectError(pParse, nVector, 1);\n    }else{\n      sqlite3ErrorMsg(pParse, \"row value misused\");\n    }\n    return 1;\n  }\n  return 0;\n}\n#endif\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** Generate code for an IN expression.\n**\n**      x IN (SELECT ...)\n**      x IN (value, value, ...)\n**\n** The left-hand side (LHS) is a scalar or vector expression.  The \n** right-hand side (RHS) is an array of zero or more scalar values, or a\n** subquery.  If the RHS is a subquery, the number of result columns must\n** match the number of columns in the vector on the LHS.  If the RHS is\n** a list of values, the LHS must be a scalar. \n**\n** The IN operator is true if the LHS value is contained within the RHS.\n** The result is false if the LHS is definitely not in the RHS.  The \n** result is NULL if the presence of the LHS in the RHS cannot be \n** determined due to NULLs.\n**\n** This routine generates code that jumps to destIfFalse if the LHS is not \n** contained within the RHS.  If due to NULLs we cannot determine if the LHS\n** is contained in the RHS then jump to destIfNull.  If the LHS is contained\n** within the RHS then fall through.\n**\n** See the separate in-operator.md documentation file in the canonical\n** SQLite source tree for additional information.\n*/\nstatic void sqlite3ExprCodeIN(\n  Parse *pParse,        /* Parsing and code generating context */\n  Expr *pExpr,          /* The IN expression */\n  int destIfFalse,      /* Jump here if LHS is not contained in the RHS */\n  int destIfNull        /* Jump here if the results are unknown due to NULLs */\n){\n  int rRhsHasNull = 0;  /* Register that is true if RHS contains NULL values */\n  int eType;            /* Type of the RHS */\n  int rLhs;             /* Register(s) holding the LHS values */\n  int rLhsOrig;         /* LHS values prior to reordering by aiMap[] */\n  Vdbe *v;              /* Statement under construction */\n  int *aiMap = 0;       /* Map from vector field to index column */\n  char *zAff = 0;       /* Affinity string for comparisons */\n  int nVector;          /* Size of vectors for this IN operator */\n  int iDummy;           /* Dummy parameter to exprCodeVector() */\n  Expr *pLeft;          /* The LHS of the IN operator */\n  int i;                /* loop counter */\n  int destStep2;        /* Where to jump when NULLs seen in step 2 */\n  int destStep6 = 0;    /* Start of code for Step 6 */\n  int addrTruthOp;      /* Address of opcode that determines the IN is true */\n  int destNotNull;      /* Jump here if a comparison is not true in step 6 */\n  int addrTop;          /* Top of the step-6 loop */ \n\n  pLeft = pExpr->pLeft;\n  if( sqlite3ExprCheckIN(pParse, pExpr) ) return;\n  zAff = exprINAffinity(pParse, pExpr);\n  nVector = sqlite3ExprVectorSize(pExpr->pLeft);\n  aiMap = (int*)sqlite3DbMallocZero(\n      pParse->db, nVector*(sizeof(int) + sizeof(char)) + 1\n  );\n  if( pParse->db->mallocFailed ) goto sqlite3ExprCodeIN_oom_error;\n\n  /* Attempt to compute the RHS. After this step, if anything other than\n  ** IN_INDEX_NOOP is returned, the table opened ith cursor pExpr->iTable \n  ** contains the values that make up the RHS. If IN_INDEX_NOOP is returned,\n  ** the RHS has not yet been coded.  */\n  v = pParse->pVdbe;\n  assert( v!=0 );       /* OOM detected prior to this routine */\n  VdbeNoopComment((v, \"begin IN expr\"));\n  eType = sqlite3FindInIndex(pParse, pExpr,\n                             IN_INDEX_MEMBERSHIP | IN_INDEX_NOOP_OK,\n                             destIfFalse==destIfNull ? 0 : &rRhsHasNull, aiMap);\n\n  assert( pParse->nErr || nVector==1 || eType==IN_INDEX_EPH\n       || eType==IN_INDEX_INDEX_ASC || eType==IN_INDEX_INDEX_DESC \n  );\n#ifdef SQLITE_DEBUG\n  /* Confirm that aiMap[] contains nVector integer values between 0 and\n  ** nVector-1. */\n  for(i=0; i<nVector; i++){\n    int j, cnt;\n    for(cnt=j=0; j<nVector; j++) if( aiMap[j]==i ) cnt++;\n    assert( cnt==1 );\n  }\n#endif\n\n  /* Code the LHS, the <expr> from \"<expr> IN (...)\". If the LHS is a \n  ** vector, then it is stored in an array of nVector registers starting \n  ** at r1.\n  **\n  ** sqlite3FindInIndex() might have reordered the fields of the LHS vector\n  ** so that the fields are in the same order as an existing index.   The\n  ** aiMap[] array contains a mapping from the original LHS field order to\n  ** the field order that matches the RHS index.\n  */\n  sqlite3ExprCachePush(pParse);\n  rLhsOrig = exprCodeVector(pParse, pLeft, &iDummy);\n  for(i=0; i<nVector && aiMap[i]==i; i++){} /* Are LHS fields reordered? */\n  if( i==nVector ){\n    /* LHS fields are not reordered */\n    rLhs = rLhsOrig;\n  }else{\n    /* Need to reorder the LHS fields according to aiMap */\n    rLhs = sqlite3GetTempRange(pParse, nVector);\n    for(i=0; i<nVector; i++){\n      sqlite3VdbeAddOp3(v, OP_Copy, rLhsOrig+i, rLhs+aiMap[i], 0);\n    }\n  }\n\n  /* If sqlite3FindInIndex() did not find or create an index that is\n  ** suitable for evaluating the IN operator, then evaluate using a\n  ** sequence of comparisons.\n  **\n  ** This is step (1) in the in-operator.md optimized algorithm.\n  */\n  if( eType==IN_INDEX_NOOP ){\n    ExprList *pList = pExpr->x.pList;\n    CollSeq *pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft);\n    int labelOk = sqlite3VdbeMakeLabel(v);\n    int r2, regToFree;\n    int regCkNull = 0;\n    int ii;\n    assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\n    if( destIfNull!=destIfFalse ){\n      regCkNull = sqlite3GetTempReg(pParse);\n      sqlite3VdbeAddOp3(v, OP_BitAnd, rLhs, rLhs, regCkNull);\n    }\n    for(ii=0; ii<pList->nExpr; ii++){\n      r2 = sqlite3ExprCodeTemp(pParse, pList->a[ii].pExpr, &regToFree);\n      if( regCkNull && sqlite3ExprCanBeNull(pList->a[ii].pExpr) ){\n        sqlite3VdbeAddOp3(v, OP_BitAnd, regCkNull, r2, regCkNull);\n      }\n      if( ii<pList->nExpr-1 || destIfNull!=destIfFalse ){\n        sqlite3VdbeAddOp4(v, OP_Eq, rLhs, labelOk, r2,\n                          (void*)pColl, P4_COLLSEQ);\n        VdbeCoverageIf(v, ii<pList->nExpr-1);\n        VdbeCoverageIf(v, ii==pList->nExpr-1);\n        sqlite3VdbeChangeP5(v, zAff[0]);\n      }else{\n        assert( destIfNull==destIfFalse );\n        sqlite3VdbeAddOp4(v, OP_Ne, rLhs, destIfFalse, r2,\n                          (void*)pColl, P4_COLLSEQ); VdbeCoverage(v);\n        sqlite3VdbeChangeP5(v, zAff[0] | SQLITE_JUMPIFNULL);\n      }\n      sqlite3ReleaseTempReg(pParse, regToFree);\n    }\n    if( regCkNull ){\n      sqlite3VdbeAddOp2(v, OP_IsNull, regCkNull, destIfNull); VdbeCoverage(v);\n      sqlite3VdbeGoto(v, destIfFalse);\n    }\n    sqlite3VdbeResolveLabel(v, labelOk);\n    sqlite3ReleaseTempReg(pParse, regCkNull);\n    goto sqlite3ExprCodeIN_finished;\n  }\n\n  /* Step 2: Check to see if the LHS contains any NULL columns.  If the\n  ** LHS does contain NULLs then the result must be either FALSE or NULL.\n  ** We will then skip the binary search of the RHS.\n  */\n  if( destIfNull==destIfFalse ){\n    destStep2 = destIfFalse;\n  }else{\n    destStep2 = destStep6 = sqlite3VdbeMakeLabel(v);\n  }\n  for(i=0; i<nVector; i++){\n    Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i);\n    if( sqlite3ExprCanBeNull(p) ){\n      sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2);\n      VdbeCoverage(v);\n    }\n  }\n\n  /* Step 3.  The LHS is now known to be non-NULL.  Do the binary search\n  ** of the RHS using the LHS as a probe.  If found, the result is\n  ** true.\n  */\n  if( eType==IN_INDEX_ROWID ){\n    /* In this case, the RHS is the ROWID of table b-tree and so we also\n    ** know that the RHS is non-NULL.  Hence, we combine steps 3 and 4\n    ** into a single opcode. */\n    sqlite3VdbeAddOp3(v, OP_SeekRowid, pExpr->iTable, destIfFalse, rLhs);\n    VdbeCoverage(v);\n    addrTruthOp = sqlite3VdbeAddOp0(v, OP_Goto);  /* Return True */\n  }else{\n    sqlite3VdbeAddOp4(v, OP_Affinity, rLhs, nVector, 0, zAff, nVector);\n    if( destIfFalse==destIfNull ){\n      /* Combine Step 3 and Step 5 into a single opcode */\n      sqlite3VdbeAddOp4Int(v, OP_NotFound, pExpr->iTable, destIfFalse,\n                           rLhs, nVector); VdbeCoverage(v);\n      goto sqlite3ExprCodeIN_finished;\n    }\n    /* Ordinary Step 3, for the case where FALSE and NULL are distinct */\n    addrTruthOp = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0,\n                                      rLhs, nVector); VdbeCoverage(v);\n  }\n\n  /* Step 4.  If the RHS is known to be non-NULL and we did not find\n  ** an match on the search above, then the result must be FALSE.\n  */\n  if( rRhsHasNull && nVector==1 ){\n    sqlite3VdbeAddOp2(v, OP_NotNull, rRhsHasNull, destIfFalse);\n    VdbeCoverage(v);\n  }\n\n  /* Step 5.  If we do not care about the difference between NULL and\n  ** FALSE, then just return false. \n  */\n  if( destIfFalse==destIfNull ) sqlite3VdbeGoto(v, destIfFalse);\n\n  /* Step 6: Loop through rows of the RHS.  Compare each row to the LHS.\n  ** If any comparison is NULL, then the result is NULL.  If all\n  ** comparisons are FALSE then the final result is FALSE.\n  **\n  ** For a scalar LHS, it is sufficient to check just the first row\n  ** of the RHS.\n  */\n  if( destStep6 ) sqlite3VdbeResolveLabel(v, destStep6);\n  addrTop = sqlite3VdbeAddOp2(v, OP_Rewind, pExpr->iTable, destIfFalse);\n  VdbeCoverage(v);\n  if( nVector>1 ){\n    destNotNull = sqlite3VdbeMakeLabel(v);\n  }else{\n    /* For nVector==1, combine steps 6 and 7 by immediately returning\n    ** FALSE if the first comparison is not NULL */\n    destNotNull = destIfFalse;\n  }\n  for(i=0; i<nVector; i++){\n    Expr *p;\n    CollSeq *pColl;\n    int r3 = sqlite3GetTempReg(pParse);\n    p = sqlite3VectorFieldSubexpr(pLeft, i);\n    pColl = sqlite3ExprCollSeq(pParse, p);\n    sqlite3VdbeAddOp3(v, OP_Column, pExpr->iTable, i, r3);\n    sqlite3VdbeAddOp4(v, OP_Ne, rLhs+i, destNotNull, r3,\n                      (void*)pColl, P4_COLLSEQ);\n    VdbeCoverage(v);\n    sqlite3ReleaseTempReg(pParse, r3);\n  }\n  sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull);\n  if( nVector>1 ){\n    sqlite3VdbeResolveLabel(v, destNotNull);\n    sqlite3VdbeAddOp2(v, OP_Next, pExpr->iTable, addrTop+1);\n    VdbeCoverage(v);\n\n    /* Step 7:  If we reach this point, we know that the result must\n    ** be false. */\n    sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfFalse);\n  }\n\n  /* Jumps here in order to return true. */\n  sqlite3VdbeJumpHere(v, addrTruthOp);\n\nsqlite3ExprCodeIN_finished:\n  if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs);\n  sqlite3ExprCachePop(pParse);\n  VdbeComment((v, \"end IN expr\"));\nsqlite3ExprCodeIN_oom_error:\n  sqlite3DbFree(pParse->db, aiMap);\n  sqlite3DbFree(pParse->db, zAff);\n}\n#endif /* SQLITE_OMIT_SUBQUERY */\n\n#ifndef SQLITE_OMIT_FLOATING_POINT\n/*\n** Generate an instruction that will put the floating point\n** value described by z[0..n-1] into register iMem.\n**\n** The z[] string will probably not be zero-terminated.  But the \n** z[n] character is guaranteed to be something that does not look\n** like the continuation of the number.\n*/\nstatic void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){\n  if( ALWAYS(z!=0) ){\n    double value;\n    sqlite3AtoF(z, &value, sqlite3Strlen30(z), SQLITE_UTF8);\n    assert( !sqlite3IsNaN(value) ); /* The new AtoF never returns NaN */\n    if( negateFlag ) value = -value;\n    sqlite3VdbeAddOp4Dup8(v, OP_Real, 0, iMem, 0, (u8*)&value, P4_REAL);\n  }\n}\n#endif\n\n\n/*\n** Generate an instruction that will put the integer describe by\n** text z[0..n-1] into register iMem.\n**\n** Expr.u.zToken is always UTF8 and zero-terminated.\n*/\nstatic void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){\n  Vdbe *v = pParse->pVdbe;\n  if( pExpr->flags & EP_IntValue ){\n    int i = pExpr->u.iValue;\n    assert( i>=0 );\n    if( negFlag ) i = -i;\n    sqlite3VdbeAddOp2(v, OP_Integer, i, iMem);\n  }else{\n    int c;\n    i64 value;\n    const char *z = pExpr->u.zToken;\n    assert( z!=0 );\n    c = sqlite3DecOrHexToI64(z, &value);\n    if( c==0 || (c==2 && negFlag) ){\n      if( negFlag ){ value = c==2 ? SMALLEST_INT64 : -value; }\n      sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64);\n    }else{\n#ifdef SQLITE_OMIT_FLOATING_POINT\n      sqlite3ErrorMsg(pParse, \"oversized integer: %s%s\", negFlag ? \"-\" : \"\", z);\n#else\n#ifndef SQLITE_OMIT_HEX_INTEGER\n      if( sqlite3_strnicmp(z,\"0x\",2)==0 ){\n        sqlite3ErrorMsg(pParse, \"hex literal too big: %s\", z);\n      }else\n#endif\n      {\n        codeReal(v, z, negFlag, iMem);\n      }\n#endif\n    }\n  }\n}\n\n/*\n** Erase column-cache entry number i\n*/\nstatic void cacheEntryClear(Parse *pParse, int i){\n  if( pParse->aColCache[i].tempReg ){\n    if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){\n      pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;\n    }\n  }\n  pParse->nColCache--;\n  if( i<pParse->nColCache ){\n    pParse->aColCache[i] = pParse->aColCache[pParse->nColCache];\n  }\n}\n\n\n/*\n** Record in the column cache that a particular column from a\n** particular table is stored in a particular register.\n*/\nvoid sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){\n  int i;\n  int minLru;\n  int idxLru;\n  struct yColCache *p;\n\n  /* Unless an error has occurred, register numbers are always positive. */\n  assert( iReg>0 || pParse->nErr || pParse->db->mallocFailed );\n  assert( iCol>=-1 && iCol<32768 );  /* Finite column numbers */\n\n  /* The SQLITE_ColumnCache flag disables the column cache.  This is used\n  ** for testing only - to verify that SQLite always gets the same answer\n  ** with and without the column cache.\n  */\n  if( OptimizationDisabled(pParse->db, SQLITE_ColumnCache) ) return;\n\n  /* First replace any existing entry.\n  **\n  ** Actually, the way the column cache is currently used, we are guaranteed\n  ** that the object will never already be in cache.  Verify this guarantee.\n  */\n#ifndef NDEBUG\n  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){\n    assert( p->iTable!=iTab || p->iColumn!=iCol );\n  }\n#endif\n\n  /* If the cache is already full, delete the least recently used entry */\n  if( pParse->nColCache>=SQLITE_N_COLCACHE ){\n    minLru = 0x7fffffff;\n    idxLru = -1;\n    for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){\n      if( p->lru<minLru ){\n        idxLru = i;\n        minLru = p->lru;\n      }\n    }\n    p = &pParse->aColCache[idxLru];\n  }else{\n    p = &pParse->aColCache[pParse->nColCache++];\n  }\n\n  /* Add the new entry to the end of the cache */\n  p->iLevel = pParse->iCacheLevel;\n  p->iTable = iTab;\n  p->iColumn = iCol;\n  p->iReg = iReg;\n  p->tempReg = 0;\n  p->lru = pParse->iCacheCnt++;\n}\n\n/*\n** Indicate that registers between iReg..iReg+nReg-1 are being overwritten.\n** Purge the range of registers from the column cache.\n*/\nvoid sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){\n  int i = 0;\n  while( i<pParse->nColCache ){\n    struct yColCache *p = &pParse->aColCache[i];\n    if( p->iReg >= iReg && p->iReg < iReg+nReg ){\n      cacheEntryClear(pParse, i);\n    }else{\n      i++;\n    }\n  }\n}\n\n/*\n** Remember the current column cache context.  Any new entries added\n** added to the column cache after this call are removed when the\n** corresponding pop occurs.\n*/\nvoid sqlite3ExprCachePush(Parse *pParse){\n  pParse->iCacheLevel++;\n#ifdef SQLITE_DEBUG\n  if( pParse->db->flags & SQLITE_VdbeAddopTrace ){\n    printf(\"PUSH to %d\\n\", pParse->iCacheLevel);\n  }\n#endif\n}\n\n/*\n** Remove from the column cache any entries that were added since the\n** the previous sqlite3ExprCachePush operation.  In other words, restore\n** the cache to the state it was in prior the most recent Push.\n*/\nvoid sqlite3ExprCachePop(Parse *pParse){\n  int i = 0;\n  assert( pParse->iCacheLevel>=1 );\n  pParse->iCacheLevel--;\n#ifdef SQLITE_DEBUG\n  if( pParse->db->flags & SQLITE_VdbeAddopTrace ){\n    printf(\"POP  to %d\\n\", pParse->iCacheLevel);\n  }\n#endif\n  while( i<pParse->nColCache ){\n    if( pParse->aColCache[i].iLevel>pParse->iCacheLevel ){\n      cacheEntryClear(pParse, i);\n    }else{\n      i++;\n    }\n  }\n}\n\n/*\n** When a cached column is reused, make sure that its register is\n** no longer available as a temp register.  ticket #3879:  that same\n** register might be in the cache in multiple places, so be sure to\n** get them all.\n*/\nstatic void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){\n  int i;\n  struct yColCache *p;\n  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){\n    if( p->iReg==iReg ){\n      p->tempReg = 0;\n    }\n  }\n}\n\n/* Generate code that will load into register regOut a value that is\n** appropriate for the iIdxCol-th column of index pIdx.\n*/\nvoid sqlite3ExprCodeLoadIndexColumn(\n  Parse *pParse,  /* The parsing context */\n  Index *pIdx,    /* The index whose column is to be loaded */\n  int iTabCur,    /* Cursor pointing to a table row */\n  int iIdxCol,    /* The column of the index to be loaded */\n  int regOut      /* Store the index column value in this register */\n){\n  i16 iTabCol = pIdx->aiColumn[iIdxCol];\n  if( iTabCol==XN_EXPR ){\n    assert( pIdx->aColExpr );\n    assert( pIdx->aColExpr->nExpr>iIdxCol );\n    pParse->iSelfTab = iTabCur;\n    sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut);\n  }else{\n    sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur,\n                                    iTabCol, regOut);\n  }\n}\n\n/*\n** Generate code to extract the value of the iCol-th column of a table.\n*/\nvoid sqlite3ExprCodeGetColumnOfTable(\n  Vdbe *v,        /* The VDBE under construction */\n  Table *pTab,    /* The table containing the value */\n  int iTabCur,    /* The table cursor.  Or the PK cursor for WITHOUT ROWID */\n  int iCol,       /* Index of the column to extract */\n  int regOut      /* Extract the value into this register */\n){\n  if( iCol<0 || iCol==pTab->iPKey ){\n    sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut);\n  }else{\n    int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;\n    int x = iCol;\n    if( !HasRowid(pTab) && !IsVirtual(pTab) ){\n      x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol);\n    }\n    sqlite3VdbeAddOp3(v, op, iTabCur, x, regOut);\n  }\n  if( iCol>=0 ){\n    sqlite3ColumnDefault(v, pTab, iCol, regOut);\n  }\n}\n\n/*\n** Generate code that will extract the iColumn-th column from\n** table pTab and store the column value in a register. \n**\n** An effort is made to store the column value in register iReg.  This\n** is not garanteeed for GetColumn() - the result can be stored in\n** any register.  But the result is guaranteed to land in register iReg\n** for GetColumnToReg().\n**\n** There must be an open cursor to pTab in iTable when this routine\n** is called.  If iColumn<0 then code is generated that extracts the rowid.\n*/\nint sqlite3ExprCodeGetColumn(\n  Parse *pParse,   /* Parsing and code generating context */\n  Table *pTab,     /* Description of the table we are reading from */\n  int iColumn,     /* Index of the table column */\n  int iTable,      /* The cursor pointing to the table */\n  int iReg,        /* Store results here */\n  u8 p5            /* P5 value for OP_Column + FLAGS */\n){\n  Vdbe *v = pParse->pVdbe;\n  int i;\n  struct yColCache *p;\n\n  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){\n    if( p->iTable==iTable && p->iColumn==iColumn ){\n      p->lru = pParse->iCacheCnt++;\n      sqlite3ExprCachePinRegister(pParse, p->iReg);\n      return p->iReg;\n    }\n  }  \n  assert( v!=0 );\n  sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);\n  if( p5 ){\n    sqlite3VdbeChangeP5(v, p5);\n  }else{   \n    sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg);\n  }\n  return iReg;\n}\nvoid sqlite3ExprCodeGetColumnToReg(\n  Parse *pParse,   /* Parsing and code generating context */\n  Table *pTab,     /* Description of the table we are reading from */\n  int iColumn,     /* Index of the table column */\n  int iTable,      /* The cursor pointing to the table */\n  int iReg         /* Store results here */\n){\n  int r1 = sqlite3ExprCodeGetColumn(pParse, pTab, iColumn, iTable, iReg, 0);\n  if( r1!=iReg ) sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, r1, iReg);\n}\n\n\n/*\n** Clear all column cache entries.\n*/\nvoid sqlite3ExprCacheClear(Parse *pParse){\n  int i;\n\n#if SQLITE_DEBUG\n  if( pParse->db->flags & SQLITE_VdbeAddopTrace ){\n    printf(\"CLEAR\\n\");\n  }\n#endif\n  for(i=0; i<pParse->nColCache; i++){\n    if( pParse->aColCache[i].tempReg\n     && pParse->nTempReg<ArraySize(pParse->aTempReg)\n    ){\n       pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg;\n    }\n  }\n  pParse->nColCache = 0;\n}\n\n/*\n** Record the fact that an affinity change has occurred on iCount\n** registers starting with iStart.\n*/\nvoid sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){\n  sqlite3ExprCacheRemove(pParse, iStart, iCount);\n}\n\n/*\n** Generate code to move content from registers iFrom...iFrom+nReg-1\n** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.\n*/\nvoid sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){\n  assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo );\n  sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);\n  sqlite3ExprCacheRemove(pParse, iFrom, nReg);\n}\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST)\n/*\n** Return true if any register in the range iFrom..iTo (inclusive)\n** is used as part of the column cache.\n**\n** This routine is used within assert() and testcase() macros only\n** and does not appear in a normal build.\n*/\nstatic int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){\n  int i;\n  struct yColCache *p;\n  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){\n    int r = p->iReg;\n    if( r>=iFrom && r<=iTo ) return 1;    /*NO_TEST*/\n  }\n  return 0;\n}\n#endif /* SQLITE_DEBUG || SQLITE_COVERAGE_TEST */\n\n\n/*\n** Convert a scalar expression node to a TK_REGISTER referencing\n** register iReg.  The caller must ensure that iReg already contains\n** the correct value for the expression.\n*/\nstatic void exprToRegister(Expr *p, int iReg){\n  p->op2 = p->op;\n  p->op = TK_REGISTER;\n  p->iTable = iReg;\n  ExprClearProperty(p, EP_Skip);\n}\n\n/*\n** Evaluate an expression (either a vector or a scalar expression) and store\n** the result in continguous temporary registers.  Return the index of\n** the first register used to store the result.\n**\n** If the returned result register is a temporary scalar, then also write\n** that register number into *piFreeable.  If the returned result register\n** is not a temporary or if the expression is a vector set *piFreeable\n** to 0.\n*/\nstatic int exprCodeVector(Parse *pParse, Expr *p, int *piFreeable){\n  int iResult;\n  int nResult = sqlite3ExprVectorSize(p);\n  if( nResult==1 ){\n    iResult = sqlite3ExprCodeTemp(pParse, p, piFreeable);\n  }else{\n    *piFreeable = 0;\n    if( p->op==TK_SELECT ){\n      iResult = sqlite3CodeSubselect(pParse, p, 0, 0);\n    }else{\n      int i;\n      iResult = pParse->nMem+1;\n      pParse->nMem += nResult;\n      for(i=0; i<nResult; i++){\n        sqlite3ExprCodeFactorable(pParse, p->x.pList->a[i].pExpr, i+iResult);\n      }\n    }\n  }\n  return iResult;\n}\n\n\n/*\n** Generate code into the current Vdbe to evaluate the given\n** expression.  Attempt to store the results in register \"target\".\n** Return the register where results are stored.\n**\n** With this routine, there is no guarantee that results will\n** be stored in target.  The result might be stored in some other\n** register if it is convenient to do so.  The calling function\n** must check the return code and move the results to the desired\n** register.\n*/\nint sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){\n  Vdbe *v = pParse->pVdbe;  /* The VM under construction */\n  int op;                   /* The opcode being coded */\n  int inReg = target;       /* Results stored in register inReg */\n  int regFree1 = 0;         /* If non-zero free this temporary register */\n  int regFree2 = 0;         /* If non-zero free this temporary register */\n  int r1, r2;               /* Various register numbers */\n  Expr tempX;               /* Temporary expression node */\n  int p5 = 0;\n\n  assert( target>0 && target<=pParse->nMem );\n  if( v==0 ){\n    assert( pParse->db->mallocFailed );\n    return 0;\n  }\n\n  if( pExpr==0 ){\n    op = TK_NULL;\n  }else{\n    op = pExpr->op;\n  }\n  switch( op ){\n    case TK_AGG_COLUMN: {\n      AggInfo *pAggInfo = pExpr->pAggInfo;\n      struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];\n      if( !pAggInfo->directMode ){\n        assert( pCol->iMem>0 );\n        return pCol->iMem;\n      }else if( pAggInfo->useSortingIdx ){\n        sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,\n                              pCol->iSorterColumn, target);\n        return target;\n      }\n      /* Otherwise, fall thru into the TK_COLUMN case */\n    }\n    case TK_COLUMN: {\n      int iTab = pExpr->iTable;\n      if( iTab<0 ){\n        if( pParse->ckBase>0 ){\n          /* Generating CHECK constraints or inserting into partial index */\n          return pExpr->iColumn + pParse->ckBase;\n        }else{\n          /* Coding an expression that is part of an index where column names\n          ** in the index refer to the table to which the index belongs */\n          iTab = pParse->iSelfTab;\n        }\n      }\n      return sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,\n                               pExpr->iColumn, iTab, target,\n                               pExpr->op2);\n    }\n    case TK_INTEGER: {\n      codeInteger(pParse, pExpr, 0, target);\n      return target;\n    }\n#ifndef SQLITE_OMIT_FLOATING_POINT\n    case TK_FLOAT: {\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\n      codeReal(v, pExpr->u.zToken, 0, target);\n      return target;\n    }\n#endif\n    case TK_STRING: {\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\n      sqlite3VdbeLoadString(v, target, pExpr->u.zToken);\n      return target;\n    }\n    case TK_NULL: {\n      sqlite3VdbeAddOp2(v, OP_Null, 0, target);\n      return target;\n    }\n#ifndef SQLITE_OMIT_BLOB_LITERAL\n    case TK_BLOB: {\n      int n;\n      const char *z;\n      char *zBlob;\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\n      assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );\n      assert( pExpr->u.zToken[1]=='\\'' );\n      z = &pExpr->u.zToken[2];\n      n = sqlite3Strlen30(z) - 1;\n      assert( z[n]=='\\'' );\n      zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n);\n      sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC);\n      return target;\n    }\n#endif\n    case TK_VARIABLE: {\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\n      assert( pExpr->u.zToken!=0 );\n      assert( pExpr->u.zToken[0]!=0 );\n      sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target);\n      if( pExpr->u.zToken[1]!=0 ){\n        assert( pExpr->u.zToken[0]=='?' \n             || strcmp(pExpr->u.zToken, pParse->azVar[pExpr->iColumn-1])==0 );\n        sqlite3VdbeChangeP4(v, -1, pParse->azVar[pExpr->iColumn-1], P4_STATIC);\n      }\n      return target;\n    }\n    case TK_REGISTER: {\n      return pExpr->iTable;\n    }\n#ifndef SQLITE_OMIT_CAST\n    case TK_CAST: {\n      /* Expressions of the form:   CAST(pLeft AS token) */\n      inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);\n      if( inReg!=target ){\n        sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);\n        inReg = target;\n      }\n      sqlite3VdbeAddOp2(v, OP_Cast, target,\n                        sqlite3AffinityType(pExpr->u.zToken, 0));\n      testcase( usedAsColumnCache(pParse, inReg, inReg) );\n      sqlite3ExprCacheAffinityChange(pParse, inReg, 1);\n      return inReg;\n    }\n#endif /* SQLITE_OMIT_CAST */\n    case TK_IS:\n    case TK_ISNOT:\n      op = (op==TK_IS) ? TK_EQ : TK_NE;\n      p5 = SQLITE_NULLEQ;\n      /* fall-through */\n    case TK_LT:\n    case TK_LE:\n    case TK_GT:\n    case TK_GE:\n    case TK_NE:\n    case TK_EQ: {\n      Expr *pLeft = pExpr->pLeft;\n      if( sqlite3ExprIsVector(pLeft) ){\n        codeVectorCompare(pParse, pExpr, target, op, p5);\n      }else{\n        r1 = sqlite3ExprCodeTemp(pParse, pLeft, &regFree1);\n        r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\n        codeCompare(pParse, pLeft, pExpr->pRight, op,\n            r1, r2, inReg, SQLITE_STOREP2 | p5);\n        assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);\n        assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);\n        assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);\n        assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);\n        assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq);\n        assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);\n        testcase( regFree1==0 );\n        testcase( regFree2==0 );\n      }\n      break;\n    }\n    case TK_AND:\n    case TK_OR:\n    case TK_PLUS:\n    case TK_STAR:\n    case TK_MINUS:\n    case TK_REM:\n    case TK_BITAND:\n    case TK_BITOR:\n    case TK_SLASH:\n    case TK_LSHIFT:\n    case TK_RSHIFT: \n    case TK_CONCAT: {\n      assert( TK_AND==OP_And );            testcase( op==TK_AND );\n      assert( TK_OR==OP_Or );              testcase( op==TK_OR );\n      assert( TK_PLUS==OP_Add );           testcase( op==TK_PLUS );\n      assert( TK_MINUS==OP_Subtract );     testcase( op==TK_MINUS );\n      assert( TK_REM==OP_Remainder );      testcase( op==TK_REM );\n      assert( TK_BITAND==OP_BitAnd );      testcase( op==TK_BITAND );\n      assert( TK_BITOR==OP_BitOr );        testcase( op==TK_BITOR );\n      assert( TK_SLASH==OP_Divide );       testcase( op==TK_SLASH );\n      assert( TK_LSHIFT==OP_ShiftLeft );   testcase( op==TK_LSHIFT );\n      assert( TK_RSHIFT==OP_ShiftRight );  testcase( op==TK_RSHIFT );\n      assert( TK_CONCAT==OP_Concat );      testcase( op==TK_CONCAT );\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\n      sqlite3VdbeAddOp3(v, op, r2, r1, target);\n      testcase( regFree1==0 );\n      testcase( regFree2==0 );\n      break;\n    }\n    case TK_UMINUS: {\n      Expr *pLeft = pExpr->pLeft;\n      assert( pLeft );\n      if( pLeft->op==TK_INTEGER ){\n        codeInteger(pParse, pLeft, 1, target);\n        return target;\n#ifndef SQLITE_OMIT_FLOATING_POINT\n      }else if( pLeft->op==TK_FLOAT ){\n        assert( !ExprHasProperty(pExpr, EP_IntValue) );\n        codeReal(v, pLeft->u.zToken, 1, target);\n        return target;\n#endif\n      }else{\n        tempX.op = TK_INTEGER;\n        tempX.flags = EP_IntValue|EP_TokenOnly;\n        tempX.u.iValue = 0;\n        r1 = sqlite3ExprCodeTemp(pParse, &tempX, &regFree1);\n        r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);\n        sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);\n        testcase( regFree2==0 );\n      }\n      break;\n    }\n    case TK_BITNOT:\n    case TK_NOT: {\n      assert( TK_BITNOT==OP_BitNot );   testcase( op==TK_BITNOT );\n      assert( TK_NOT==OP_Not );         testcase( op==TK_NOT );\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\n      testcase( regFree1==0 );\n      sqlite3VdbeAddOp2(v, op, r1, inReg);\n      break;\n    }\n    case TK_ISNULL:\n    case TK_NOTNULL: {\n      int addr;\n      assert( TK_ISNULL==OP_IsNull );   testcase( op==TK_ISNULL );\n      assert( TK_NOTNULL==OP_NotNull ); testcase( op==TK_NOTNULL );\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, target);\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\n      testcase( regFree1==0 );\n      addr = sqlite3VdbeAddOp1(v, op, r1);\n      VdbeCoverageIf(v, op==TK_ISNULL);\n      VdbeCoverageIf(v, op==TK_NOTNULL);\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, target);\n      sqlite3VdbeJumpHere(v, addr);\n      break;\n    }\n    case TK_AGG_FUNCTION: {\n      AggInfo *pInfo = pExpr->pAggInfo;\n      if( pInfo==0 ){\n        assert( !ExprHasProperty(pExpr, EP_IntValue) );\n        sqlite3ErrorMsg(pParse, \"misuse of aggregate: %s()\", pExpr->u.zToken);\n      }else{\n        return pInfo->aFunc[pExpr->iAgg].iMem;\n      }\n      break;\n    }\n    case TK_FUNCTION: {\n      ExprList *pFarg;       /* List of function arguments */\n      int nFarg;             /* Number of function arguments */\n      FuncDef *pDef;         /* The function definition object */\n      const char *zId;       /* The function name */\n      u32 constMask = 0;     /* Mask of function arguments that are constant */\n      int i;                 /* Loop counter */\n      sqlite3 *db = pParse->db;  /* The database connection */\n      u8 enc = ENC(db);      /* The text encoding used by this database */\n      CollSeq *pColl = 0;    /* A collating sequence */\n\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\n      if( ExprHasProperty(pExpr, EP_TokenOnly) ){\n        pFarg = 0;\n      }else{\n        pFarg = pExpr->x.pList;\n      }\n      nFarg = pFarg ? pFarg->nExpr : 0;\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\n      zId = pExpr->u.zToken;\n      pDef = sqlite3FindFunction(db, zId, nFarg, enc, 0);\n#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION\n      if( pDef==0 && pParse->explain ){\n        pDef = sqlite3FindFunction(db, \"unknown\", nFarg, enc, 0);\n      }\n#endif\n      if( pDef==0 || pDef->xFinalize!=0 ){\n        sqlite3ErrorMsg(pParse, \"unknown function: %s()\", zId);\n        break;\n      }\n\n      /* Attempt a direct implementation of the built-in COALESCE() and\n      ** IFNULL() functions.  This avoids unnecessary evaluation of\n      ** arguments past the first non-NULL argument.\n      */\n      if( pDef->funcFlags & SQLITE_FUNC_COALESCE ){\n        int endCoalesce = sqlite3VdbeMakeLabel(v);\n        assert( nFarg>=2 );\n        sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target);\n        for(i=1; i<nFarg; i++){\n          sqlite3VdbeAddOp2(v, OP_NotNull, target, endCoalesce);\n          VdbeCoverage(v);\n          sqlite3ExprCacheRemove(pParse, target, 1);\n          sqlite3ExprCachePush(pParse);\n          sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target);\n          sqlite3ExprCachePop(pParse);\n        }\n        sqlite3VdbeResolveLabel(v, endCoalesce);\n        break;\n      }\n\n      /* The UNLIKELY() function is a no-op.  The result is the value\n      ** of the first argument.\n      */\n      if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){\n        assert( nFarg>=1 );\n        return sqlite3ExprCodeTarget(pParse, pFarg->a[0].pExpr, target);\n      }\n\n      for(i=0; i<nFarg; i++){\n        if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){\n          testcase( i==31 );\n          constMask |= MASKBIT32(i);\n        }\n        if( (pDef->funcFlags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){\n          pColl = sqlite3ExprCollSeq(pParse, pFarg->a[i].pExpr);\n        }\n      }\n      if( pFarg ){\n        if( constMask ){\n          r1 = pParse->nMem+1;\n          pParse->nMem += nFarg;\n        }else{\n          r1 = sqlite3GetTempRange(pParse, nFarg);\n        }\n\n        /* For length() and typeof() functions with a column argument,\n        ** set the P5 parameter to the OP_Column opcode to OPFLAG_LENGTHARG\n        ** or OPFLAG_TYPEOFARG respectively, to avoid unnecessary data\n        ** loading.\n        */\n        if( (pDef->funcFlags & (SQLITE_FUNC_LENGTH|SQLITE_FUNC_TYPEOF))!=0 ){\n          u8 exprOp;\n          assert( nFarg==1 );\n          assert( pFarg->a[0].pExpr!=0 );\n          exprOp = pFarg->a[0].pExpr->op;\n          if( exprOp==TK_COLUMN || exprOp==TK_AGG_COLUMN ){\n            assert( SQLITE_FUNC_LENGTH==OPFLAG_LENGTHARG );\n            assert( SQLITE_FUNC_TYPEOF==OPFLAG_TYPEOFARG );\n            testcase( pDef->funcFlags & OPFLAG_LENGTHARG );\n            pFarg->a[0].pExpr->op2 = \n                  pDef->funcFlags & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG);\n          }\n        }\n\n        sqlite3ExprCachePush(pParse);     /* Ticket 2ea2425d34be */\n        sqlite3ExprCodeExprList(pParse, pFarg, r1, 0,\n                                SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR);\n        sqlite3ExprCachePop(pParse);      /* Ticket 2ea2425d34be */\n      }else{\n        r1 = 0;\n      }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n      /* Possibly overload the function if the first argument is\n      ** a virtual table column.\n      **\n      ** For infix functions (LIKE, GLOB, REGEXP, and MATCH) use the\n      ** second argument, not the first, as the argument to test to\n      ** see if it is a column in a virtual table.  This is done because\n      ** the left operand of infix functions (the operand we want to\n      ** control overloading) ends up as the second argument to the\n      ** function.  The expression \"A glob B\" is equivalent to \n      ** \"glob(B,A).  We want to use the A in \"A glob B\" to test\n      ** for function overloading.  But we use the B term in \"glob(B,A)\".\n      */\n      if( nFarg>=2 && (pExpr->flags & EP_InfixFunc) ){\n        pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[1].pExpr);\n      }else if( nFarg>0 ){\n        pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[0].pExpr);\n      }\n#endif\n      if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){\n        if( !pColl ) pColl = db->pDfltColl; \n        sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);\n      }\n      sqlite3VdbeAddOp4(v, OP_Function0, constMask, r1, target,\n                        (char*)pDef, P4_FUNCDEF);\n      sqlite3VdbeChangeP5(v, (u8)nFarg);\n      if( nFarg && constMask==0 ){\n        sqlite3ReleaseTempRange(pParse, r1, nFarg);\n      }\n      return target;\n    }\n#ifndef SQLITE_OMIT_SUBQUERY\n    case TK_EXISTS:\n    case TK_SELECT: {\n      int nCol;\n      testcase( op==TK_EXISTS );\n      testcase( op==TK_SELECT );\n      if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){\n        sqlite3SubselectError(pParse, nCol, 1);\n      }else{\n        return sqlite3CodeSubselect(pParse, pExpr, 0, 0);\n      }\n      break;\n    }\n    case TK_SELECT_COLUMN: {\n      if( pExpr->pLeft->iTable==0 ){\n        pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft, 0, 0);\n      }\n      return pExpr->pLeft->iTable + pExpr->iColumn;\n    }\n    case TK_IN: {\n      int destIfFalse = sqlite3VdbeMakeLabel(v);\n      int destIfNull = sqlite3VdbeMakeLabel(v);\n      sqlite3VdbeAddOp2(v, OP_Null, 0, target);\n      sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull);\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, target);\n      sqlite3VdbeResolveLabel(v, destIfFalse);\n      sqlite3VdbeAddOp2(v, OP_AddImm, target, 0);\n      sqlite3VdbeResolveLabel(v, destIfNull);\n      return target;\n    }\n#endif /* SQLITE_OMIT_SUBQUERY */\n\n\n    /*\n    **    x BETWEEN y AND z\n    **\n    ** This is equivalent to\n    **\n    **    x>=y AND x<=z\n    **\n    ** X is stored in pExpr->pLeft.\n    ** Y is stored in pExpr->pList->a[0].pExpr.\n    ** Z is stored in pExpr->pList->a[1].pExpr.\n    */\n    case TK_BETWEEN: {\n      exprCodeBetween(pParse, pExpr, target, 0, 0);\n      return target;\n    }\n    case TK_SPAN:\n    case TK_COLLATE: \n    case TK_UPLUS: {\n      return sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);\n    }\n\n    case TK_TRIGGER: {\n      /* If the opcode is TK_TRIGGER, then the expression is a reference\n      ** to a column in the new.* or old.* pseudo-tables available to\n      ** trigger programs. In this case Expr.iTable is set to 1 for the\n      ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn\n      ** is set to the column of the pseudo-table to read, or to -1 to\n      ** read the rowid field.\n      **\n      ** The expression is implemented using an OP_Param opcode. The p1\n      ** parameter is set to 0 for an old.rowid reference, or to (i+1)\n      ** to reference another column of the old.* pseudo-table, where \n      ** i is the index of the column. For a new.rowid reference, p1 is\n      ** set to (n+1), where n is the number of columns in each pseudo-table.\n      ** For a reference to any other column in the new.* pseudo-table, p1\n      ** is set to (n+2+i), where n and i are as defined previously. For\n      ** example, if the table on which triggers are being fired is\n      ** declared as:\n      **\n      **   CREATE TABLE t1(a, b);\n      **\n      ** Then p1 is interpreted as follows:\n      **\n      **   p1==0   ->    old.rowid     p1==3   ->    new.rowid\n      **   p1==1   ->    old.a         p1==4   ->    new.a\n      **   p1==2   ->    old.b         p1==5   ->    new.b       \n      */\n      Table *pTab = pExpr->pTab;\n      int p1 = pExpr->iTable * (pTab->nCol+1) + 1 + pExpr->iColumn;\n\n      assert( pExpr->iTable==0 || pExpr->iTable==1 );\n      assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol );\n      assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey );\n      assert( p1>=0 && p1<(pTab->nCol*2+2) );\n\n      sqlite3VdbeAddOp2(v, OP_Param, p1, target);\n      VdbeComment((v, \"%s.%s -> $%d\",\n        (pExpr->iTable ? \"new\" : \"old\"),\n        (pExpr->iColumn<0 ? \"rowid\" : pExpr->pTab->aCol[pExpr->iColumn].zName),\n        target\n      ));\n\n#ifndef SQLITE_OMIT_FLOATING_POINT\n      /* If the column has REAL affinity, it may currently be stored as an\n      ** integer. Use OP_RealAffinity to make sure it is really real.\n      **\n      ** EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to\n      ** floating point when extracting it from the record.  */\n      if( pExpr->iColumn>=0 \n       && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL\n      ){\n        sqlite3VdbeAddOp1(v, OP_RealAffinity, target);\n      }\n#endif\n      break;\n    }\n\n    case TK_VECTOR: {\n      sqlite3ErrorMsg(pParse, \"row value misused\");\n      break;\n    }\n\n    /*\n    ** Form A:\n    **   CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END\n    **\n    ** Form B:\n    **   CASE WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END\n    **\n    ** Form A is can be transformed into the equivalent form B as follows:\n    **   CASE WHEN x=e1 THEN r1 WHEN x=e2 THEN r2 ...\n    **        WHEN x=eN THEN rN ELSE y END\n    **\n    ** X (if it exists) is in pExpr->pLeft.\n    ** Y is in the last element of pExpr->x.pList if pExpr->x.pList->nExpr is\n    ** odd.  The Y is also optional.  If the number of elements in x.pList\n    ** is even, then Y is omitted and the \"otherwise\" result is NULL.\n    ** Ei is in pExpr->pList->a[i*2] and Ri is pExpr->pList->a[i*2+1].\n    **\n    ** The result of the expression is the Ri for the first matching Ei,\n    ** or if there is no matching Ei, the ELSE term Y, or if there is\n    ** no ELSE term, NULL.\n    */\n    default: assert( op==TK_CASE ); {\n      int endLabel;                     /* GOTO label for end of CASE stmt */\n      int nextCase;                     /* GOTO label for next WHEN clause */\n      int nExpr;                        /* 2x number of WHEN terms */\n      int i;                            /* Loop counter */\n      ExprList *pEList;                 /* List of WHEN terms */\n      struct ExprList_item *aListelem;  /* Array of WHEN terms */\n      Expr opCompare;                   /* The X==Ei expression */\n      Expr *pX;                         /* The X expression */\n      Expr *pTest = 0;                  /* X==Ei (form A) or just Ei (form B) */\n      VVA_ONLY( int iCacheLevel = pParse->iCacheLevel; )\n\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList );\n      assert(pExpr->x.pList->nExpr > 0);\n      pEList = pExpr->x.pList;\n      aListelem = pEList->a;\n      nExpr = pEList->nExpr;\n      endLabel = sqlite3VdbeMakeLabel(v);\n      if( (pX = pExpr->pLeft)!=0 ){\n        tempX = *pX;\n        testcase( pX->op==TK_COLUMN );\n        exprToRegister(&tempX, exprCodeVector(pParse, &tempX, &regFree1));\n        testcase( regFree1==0 );\n        memset(&opCompare, 0, sizeof(opCompare));\n        opCompare.op = TK_EQ;\n        opCompare.pLeft = &tempX;\n        pTest = &opCompare;\n        /* Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001:\n        ** The value in regFree1 might get SCopy-ed into the file result.\n        ** So make sure that the regFree1 register is not reused for other\n        ** purposes and possibly overwritten.  */\n        regFree1 = 0;\n      }\n      for(i=0; i<nExpr-1; i=i+2){\n        sqlite3ExprCachePush(pParse);\n        if( pX ){\n          assert( pTest!=0 );\n          opCompare.pRight = aListelem[i].pExpr;\n        }else{\n          pTest = aListelem[i].pExpr;\n        }\n        nextCase = sqlite3VdbeMakeLabel(v);\n        testcase( pTest->op==TK_COLUMN );\n        sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);\n        testcase( aListelem[i+1].pExpr->op==TK_COLUMN );\n        sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target);\n        sqlite3VdbeGoto(v, endLabel);\n        sqlite3ExprCachePop(pParse);\n        sqlite3VdbeResolveLabel(v, nextCase);\n      }\n      if( (nExpr&1)!=0 ){\n        sqlite3ExprCachePush(pParse);\n        sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target);\n        sqlite3ExprCachePop(pParse);\n      }else{\n        sqlite3VdbeAddOp2(v, OP_Null, 0, target);\n      }\n      assert( pParse->db->mallocFailed || pParse->nErr>0 \n           || pParse->iCacheLevel==iCacheLevel );\n      sqlite3VdbeResolveLabel(v, endLabel);\n      break;\n    }\n#ifndef SQLITE_OMIT_TRIGGER\n    case TK_RAISE: {\n      assert( pExpr->affinity==OE_Rollback \n           || pExpr->affinity==OE_Abort\n           || pExpr->affinity==OE_Fail\n           || pExpr->affinity==OE_Ignore\n      );\n      if( !pParse->pTriggerTab ){\n        sqlite3ErrorMsg(pParse,\n                       \"RAISE() may only be used within a trigger-program\");\n        return 0;\n      }\n      if( pExpr->affinity==OE_Abort ){\n        sqlite3MayAbort(pParse);\n      }\n      assert( !ExprHasProperty(pExpr, EP_IntValue) );\n      if( pExpr->affinity==OE_Ignore ){\n        sqlite3VdbeAddOp4(\n            v, OP_Halt, SQLITE_OK, OE_Ignore, 0, pExpr->u.zToken,0);\n        VdbeCoverage(v);\n      }else{\n        sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_TRIGGER,\n                              pExpr->affinity, pExpr->u.zToken, 0, 0);\n      }\n\n      break;\n    }\n#endif\n  }\n  sqlite3ReleaseTempReg(pParse, regFree1);\n  sqlite3ReleaseTempReg(pParse, regFree2);\n  return inReg;\n}\n\n/*\n** Factor out the code of the given expression to initialization time.\n*/\nvoid sqlite3ExprCodeAtInit(\n  Parse *pParse,    /* Parsing context */\n  Expr *pExpr,      /* The expression to code when the VDBE initializes */\n  int regDest,      /* Store the value in this register */\n  u8 reusable       /* True if this expression is reusable */\n){\n  ExprList *p;\n  assert( ConstFactorOk(pParse) );\n  p = pParse->pConstExpr;\n  pExpr = sqlite3ExprDup(pParse->db, pExpr, 0);\n  p = sqlite3ExprListAppend(pParse, p, pExpr);\n  if( p ){\n     struct ExprList_item *pItem = &p->a[p->nExpr-1];\n     pItem->u.iConstExprReg = regDest;\n     pItem->reusable = reusable;\n  }\n  pParse->pConstExpr = p;\n}\n\n/*\n** Generate code to evaluate an expression and store the results\n** into a register.  Return the register number where the results\n** are stored.\n**\n** If the register is a temporary register that can be deallocated,\n** then write its number into *pReg.  If the result register is not\n** a temporary, then set *pReg to zero.\n**\n** If pExpr is a constant, then this routine might generate this\n** code to fill the register in the initialization section of the\n** VDBE program, in order to factor it out of the evaluation loop.\n*/\nint sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){\n  int r2;\n  pExpr = sqlite3ExprSkipCollate(pExpr);\n  if( ConstFactorOk(pParse)\n   && pExpr->op!=TK_REGISTER\n   && sqlite3ExprIsConstantNotJoin(pExpr)\n  ){\n    ExprList *p = pParse->pConstExpr;\n    int i;\n    *pReg  = 0;\n    if( p ){\n      struct ExprList_item *pItem;\n      for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){\n        if( pItem->reusable && sqlite3ExprCompare(pItem->pExpr,pExpr,-1)==0 ){\n          return pItem->u.iConstExprReg;\n        }\n      }\n    }\n    r2 = ++pParse->nMem;\n    sqlite3ExprCodeAtInit(pParse, pExpr, r2, 1);\n  }else{\n    int r1 = sqlite3GetTempReg(pParse);\n    r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1);\n    if( r2==r1 ){\n      *pReg = r1;\n    }else{\n      sqlite3ReleaseTempReg(pParse, r1);\n      *pReg = 0;\n    }\n  }\n  return r2;\n}\n\n/*\n** Generate code that will evaluate expression pExpr and store the\n** results in register target.  The results are guaranteed to appear\n** in register target.\n*/\nvoid sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){\n  int inReg;\n\n  assert( target>0 && target<=pParse->nMem );\n  if( pExpr && pExpr->op==TK_REGISTER ){\n    sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target);\n  }else{\n    inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);\n    assert( pParse->pVdbe!=0 || pParse->db->mallocFailed );\n    if( inReg!=target && pParse->pVdbe ){\n      sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target);\n    }\n  }\n}\n\n/*\n** Make a transient copy of expression pExpr and then code it using\n** sqlite3ExprCode().  This routine works just like sqlite3ExprCode()\n** except that the input expression is guaranteed to be unchanged.\n*/\nvoid sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){\n  sqlite3 *db = pParse->db;\n  pExpr = sqlite3ExprDup(db, pExpr, 0);\n  if( !db->mallocFailed ) sqlite3ExprCode(pParse, pExpr, target);\n  sqlite3ExprDelete(db, pExpr);\n}\n\n/*\n** Generate code that will evaluate expression pExpr and store the\n** results in register target.  The results are guaranteed to appear\n** in register target.  If the expression is constant, then this routine\n** might choose to code the expression at initialization time.\n*/\nvoid sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){\n  if( pParse->okConstFactor && sqlite3ExprIsConstant(pExpr) ){\n    sqlite3ExprCodeAtInit(pParse, pExpr, target, 0);\n  }else{\n    sqlite3ExprCode(pParse, pExpr, target);\n  }\n}\n\n/*\n** Generate code that evaluates the given expression and puts the result\n** in register target.\n**\n** Also make a copy of the expression results into another \"cache\" register\n** and modify the expression so that the next time it is evaluated,\n** the result is a copy of the cache register.\n**\n** This routine is used for expressions that are used multiple \n** times.  They are evaluated once and the results of the expression\n** are reused.\n*/\nvoid sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){\n  Vdbe *v = pParse->pVdbe;\n  int iMem;\n\n  assert( target>0 );\n  assert( pExpr->op!=TK_REGISTER );\n  sqlite3ExprCode(pParse, pExpr, target);\n  iMem = ++pParse->nMem;\n  sqlite3VdbeAddOp2(v, OP_Copy, target, iMem);\n  exprToRegister(pExpr, iMem);\n}\n\n/*\n** Generate code that pushes the value of every element of the given\n** expression list into a sequence of registers beginning at target.\n**\n** Return the number of elements evaluated.\n**\n** The SQLITE_ECEL_DUP flag prevents the arguments from being\n** filled using OP_SCopy.  OP_Copy must be used instead.\n**\n** The SQLITE_ECEL_FACTOR argument allows constant arguments to be\n** factored out into initialization code.\n**\n** The SQLITE_ECEL_REF flag means that expressions in the list with\n** ExprList.a[].u.x.iOrderByCol>0 have already been evaluated and stored\n** in registers at srcReg, and so the value can be copied from there.\n*/\nint sqlite3ExprCodeExprList(\n  Parse *pParse,     /* Parsing context */\n  ExprList *pList,   /* The expression list to be coded */\n  int target,        /* Where to write results */\n  int srcReg,        /* Source registers if SQLITE_ECEL_REF */\n  u8 flags           /* SQLITE_ECEL_* flags */\n){\n  struct ExprList_item *pItem;\n  int i, j, n;\n  u8 copyOp = (flags & SQLITE_ECEL_DUP) ? OP_Copy : OP_SCopy;\n  Vdbe *v = pParse->pVdbe;\n  assert( pList!=0 );\n  assert( target>0 );\n  assert( pParse->pVdbe!=0 );  /* Never gets this far otherwise */\n  n = pList->nExpr;\n  if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR;\n  for(pItem=pList->a, i=0; i<n; i++, pItem++){\n    Expr *pExpr = pItem->pExpr;\n    if( (flags & SQLITE_ECEL_REF)!=0 && (j = pList->a[i].u.x.iOrderByCol)>0 ){\n      sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i);\n    }else if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){\n      sqlite3ExprCodeAtInit(pParse, pExpr, target+i, 0);\n    }else{\n      int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);\n      if( inReg!=target+i ){\n        VdbeOp *pOp;\n        if( copyOp==OP_Copy\n         && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy\n         && pOp->p1+pOp->p3+1==inReg\n         && pOp->p2+pOp->p3+1==target+i\n        ){\n          pOp->p3++;\n        }else{\n          sqlite3VdbeAddOp2(v, copyOp, inReg, target+i);\n        }\n      }\n    }\n  }\n  return n;\n}\n\n/*\n** Generate code for a BETWEEN operator.\n**\n**    x BETWEEN y AND z\n**\n** The above is equivalent to \n**\n**    x>=y AND x<=z\n**\n** Code it as such, taking care to do the common subexpression\n** elimination of x.\n**\n** The xJumpIf parameter determines details:\n**\n**    NULL:                   Store the boolean result in reg[dest]\n**    sqlite3ExprIfTrue:      Jump to dest if true\n**    sqlite3ExprIfFalse:     Jump to dest if false\n**\n** The jumpIfNull parameter is ignored if xJumpIf is NULL.\n*/\nstatic void exprCodeBetween(\n  Parse *pParse,    /* Parsing and code generating context */\n  Expr *pExpr,      /* The BETWEEN expression */\n  int dest,         /* Jump destination or storage location */\n  void (*xJump)(Parse*,Expr*,int,int), /* Action to take */\n  int jumpIfNull    /* Take the jump if the BETWEEN is NULL */\n){\n Expr exprAnd;     /* The AND operator in  x>=y AND x<=z  */\n  Expr compLeft;    /* The  x>=y  term */\n  Expr compRight;   /* The  x<=z  term */\n  Expr exprX;       /* The  x  subexpression */\n  int regFree1 = 0; /* Temporary use register */\n\n\n  memset(&compLeft, 0, sizeof(Expr));\n  memset(&compRight, 0, sizeof(Expr));\n  memset(&exprAnd, 0, sizeof(Expr));\n\n  assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\n  exprX = *pExpr->pLeft;\n  exprAnd.op = TK_AND;\n  exprAnd.pLeft = &compLeft;\n  exprAnd.pRight = &compRight;\n  compLeft.op = TK_GE;\n  compLeft.pLeft = &exprX;\n  compLeft.pRight = pExpr->x.pList->a[0].pExpr;\n  compRight.op = TK_LE;\n  compRight.pLeft = &exprX;\n  compRight.pRight = pExpr->x.pList->a[1].pExpr;\n  exprToRegister(&exprX, exprCodeVector(pParse, &exprX, &regFree1));\n  if( xJump ){\n    xJump(pParse, &exprAnd, dest, jumpIfNull);\n  }else{\n    exprX.flags |= EP_FromJoin;\n    sqlite3ExprCodeTarget(pParse, &exprAnd, dest);\n  }\n  sqlite3ReleaseTempReg(pParse, regFree1);\n\n  /* Ensure adequate test coverage */\n  testcase( xJump==sqlite3ExprIfTrue  && jumpIfNull==0 && regFree1==0 );\n  testcase( xJump==sqlite3ExprIfTrue  && jumpIfNull==0 && regFree1!=0 );\n  testcase( xJump==sqlite3ExprIfTrue  && jumpIfNull!=0 && regFree1==0 );\n  testcase( xJump==sqlite3ExprIfTrue  && jumpIfNull!=0 && regFree1!=0 );\n  testcase( xJump==sqlite3ExprIfFalse && jumpIfNull==0 && regFree1==0 );\n  testcase( xJump==sqlite3ExprIfFalse && jumpIfNull==0 && regFree1!=0 );\n  testcase( xJump==sqlite3ExprIfFalse && jumpIfNull!=0 && regFree1==0 );\n  testcase( xJump==sqlite3ExprIfFalse && jumpIfNull!=0 && regFree1!=0 );\n  testcase( xJump==0 );\n}\n\n/*\n** Generate code for a boolean expression such that a jump is made\n** to the label \"dest\" if the expression is true but execution\n** continues straight thru if the expression is false.\n**\n** If the expression evaluates to NULL (neither true nor false), then\n** take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL.\n**\n** This code depends on the fact that certain token values (ex: TK_EQ)\n** are the same as opcode values (ex: OP_Eq) that implement the corresponding\n** operation.  Special comments in vdbe.c and the mkopcodeh.awk script in\n** the make process cause these values to align.  Assert()s in the code\n** below verify that the numbers are aligned correctly.\n*/\nvoid sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){\n  Vdbe *v = pParse->pVdbe;\n  int op = 0;\n  int regFree1 = 0;\n  int regFree2 = 0;\n  int r1, r2;\n\n  assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );\n  if( NEVER(v==0) )     return;  /* Existence of VDBE checked by caller */\n  if( NEVER(pExpr==0) ) return;  /* No way this can happen */\n  op = pExpr->op;\n  switch( op ){\n    case TK_AND: {\n      int d2 = sqlite3VdbeMakeLabel(v);\n      testcase( jumpIfNull==0 );\n      sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);\n      sqlite3ExprCachePush(pParse);\n      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);\n      sqlite3VdbeResolveLabel(v, d2);\n      sqlite3ExprCachePop(pParse);\n      break;\n    }\n    case TK_OR: {\n      testcase( jumpIfNull==0 );\n      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);\n      sqlite3ExprCachePush(pParse);\n      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);\n      sqlite3ExprCachePop(pParse);\n      break;\n    }\n    case TK_NOT: {\n      testcase( jumpIfNull==0 );\n      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);\n      break;\n    }\n    case TK_IS:\n    case TK_ISNOT:\n      testcase( op==TK_IS );\n      testcase( op==TK_ISNOT );\n      op = (op==TK_IS) ? TK_EQ : TK_NE;\n      jumpIfNull = SQLITE_NULLEQ;\n      /* Fall thru */\n    case TK_LT:\n    case TK_LE:\n    case TK_GT:\n    case TK_GE:\n    case TK_NE:\n    case TK_EQ: {\n      if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;\n      testcase( jumpIfNull==0 );\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\n                  r1, r2, dest, jumpIfNull);\n      assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);\n      assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);\n      assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);\n      assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);\n      assert(TK_EQ==OP_Eq); testcase(op==OP_Eq);\n      VdbeCoverageIf(v, op==OP_Eq && jumpIfNull==SQLITE_NULLEQ);\n      VdbeCoverageIf(v, op==OP_Eq && jumpIfNull!=SQLITE_NULLEQ);\n      assert(TK_NE==OP_Ne); testcase(op==OP_Ne);\n      VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);\n      VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);\n      testcase( regFree1==0 );\n      testcase( regFree2==0 );\n      break;\n    }\n    case TK_ISNULL:\n    case TK_NOTNULL: {\n      assert( TK_ISNULL==OP_IsNull );   testcase( op==TK_ISNULL );\n      assert( TK_NOTNULL==OP_NotNull ); testcase( op==TK_NOTNULL );\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\n      sqlite3VdbeAddOp2(v, op, r1, dest);\n      VdbeCoverageIf(v, op==TK_ISNULL);\n      VdbeCoverageIf(v, op==TK_NOTNULL);\n      testcase( regFree1==0 );\n      break;\n    }\n    case TK_BETWEEN: {\n      testcase( jumpIfNull==0 );\n      exprCodeBetween(pParse, pExpr, dest, sqlite3ExprIfTrue, jumpIfNull);\n      break;\n    }\n#ifndef SQLITE_OMIT_SUBQUERY\n    case TK_IN: {\n      int destIfFalse = sqlite3VdbeMakeLabel(v);\n      int destIfNull = jumpIfNull ? dest : destIfFalse;\n      sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull);\n      sqlite3VdbeGoto(v, dest);\n      sqlite3VdbeResolveLabel(v, destIfFalse);\n      break;\n    }\n#endif\n    default: {\n    default_expr:\n      if( exprAlwaysTrue(pExpr) ){\n        sqlite3VdbeGoto(v, dest);\n      }else if( exprAlwaysFalse(pExpr) ){\n        /* No-op */\n      }else{\n        r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);\n        sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0);\n        VdbeCoverage(v);\n        testcase( regFree1==0 );\n        testcase( jumpIfNull==0 );\n      }\n      break;\n    }\n  }\n  sqlite3ReleaseTempReg(pParse, regFree1);\n  sqlite3ReleaseTempReg(pParse, regFree2);  \n}\n\n/*\n** Generate code for a boolean expression such that a jump is made\n** to the label \"dest\" if the expression is false but execution\n** continues straight thru if the expression is true.\n**\n** If the expression evaluates to NULL (neither true nor false) then\n** jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull\n** is 0.\n*/\nvoid sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){\n  Vdbe *v = pParse->pVdbe;\n  int op = 0;\n  int regFree1 = 0;\n  int regFree2 = 0;\n  int r1, r2;\n\n  assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );\n  if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */\n  if( pExpr==0 )    return;\n\n  /* The value of pExpr->op and op are related as follows:\n  **\n  **       pExpr->op            op\n  **       ---------          ----------\n  **       TK_ISNULL          OP_NotNull\n  **       TK_NOTNULL         OP_IsNull\n  **       TK_NE              OP_Eq\n  **       TK_EQ              OP_Ne\n  **       TK_GT              OP_Le\n  **       TK_LE              OP_Gt\n  **       TK_GE              OP_Lt\n  **       TK_LT              OP_Ge\n  **\n  ** For other values of pExpr->op, op is undefined and unused.\n  ** The value of TK_ and OP_ constants are arranged such that we\n  ** can compute the mapping above using the following expression.\n  ** Assert()s verify that the computation is correct.\n  */\n  op = ((pExpr->op+(TK_ISNULL&1))^1)-(TK_ISNULL&1);\n\n  /* Verify correct alignment of TK_ and OP_ constants\n  */\n  assert( pExpr->op!=TK_ISNULL || op==OP_NotNull );\n  assert( pExpr->op!=TK_NOTNULL || op==OP_IsNull );\n  assert( pExpr->op!=TK_NE || op==OP_Eq );\n  assert( pExpr->op!=TK_EQ || op==OP_Ne );\n  assert( pExpr->op!=TK_LT || op==OP_Ge );\n  assert( pExpr->op!=TK_LE || op==OP_Gt );\n  assert( pExpr->op!=TK_GT || op==OP_Le );\n  assert( pExpr->op!=TK_GE || op==OP_Lt );\n\n  switch( pExpr->op ){\n    case TK_AND: {\n      testcase( jumpIfNull==0 );\n      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);\n      sqlite3ExprCachePush(pParse);\n      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);\n      sqlite3ExprCachePop(pParse);\n      break;\n    }\n    case TK_OR: {\n      int d2 = sqlite3VdbeMakeLabel(v);\n      testcase( jumpIfNull==0 );\n      sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);\n      sqlite3ExprCachePush(pParse);\n      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);\n      sqlite3VdbeResolveLabel(v, d2);\n      sqlite3ExprCachePop(pParse);\n      break;\n    }\n    case TK_NOT: {\n      testcase( jumpIfNull==0 );\n      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);\n      break;\n    }\n    case TK_IS:\n    case TK_ISNOT:\n      testcase( pExpr->op==TK_IS );\n      testcase( pExpr->op==TK_ISNOT );\n      op = (pExpr->op==TK_IS) ? TK_NE : TK_EQ;\n      jumpIfNull = SQLITE_NULLEQ;\n      /* Fall thru */\n    case TK_LT:\n    case TK_LE:\n    case TK_GT:\n    case TK_GE:\n    case TK_NE:\n    case TK_EQ: {\n      if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;\n      testcase( jumpIfNull==0 );\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\n      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);\n      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,\n                  r1, r2, dest, jumpIfNull);\n      assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);\n      assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);\n      assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);\n      assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);\n      assert(TK_EQ==OP_Eq); testcase(op==OP_Eq);\n      VdbeCoverageIf(v, op==OP_Eq && jumpIfNull!=SQLITE_NULLEQ);\n      VdbeCoverageIf(v, op==OP_Eq && jumpIfNull==SQLITE_NULLEQ);\n      assert(TK_NE==OP_Ne); testcase(op==OP_Ne);\n      VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);\n      VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);\n      testcase( regFree1==0 );\n      testcase( regFree2==0 );\n      break;\n    }\n    case TK_ISNULL:\n    case TK_NOTNULL: {\n      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);\n      sqlite3VdbeAddOp2(v, op, r1, dest);\n      testcase( op==TK_ISNULL );   VdbeCoverageIf(v, op==TK_ISNULL);\n      testcase( op==TK_NOTNULL );  VdbeCoverageIf(v, op==TK_NOTNULL);\n      testcase( regFree1==0 );\n      break;\n    }\n    case TK_BETWEEN: {\n      testcase( jumpIfNull==0 );\n      exprCodeBetween(pParse, pExpr, dest, sqlite3ExprIfFalse, jumpIfNull);\n      break;\n    }\n#ifndef SQLITE_OMIT_SUBQUERY\n    case TK_IN: {\n      if( jumpIfNull ){\n        sqlite3ExprCodeIN(pParse, pExpr, dest, dest);\n      }else{\n        int destIfNull = sqlite3VdbeMakeLabel(v);\n        sqlite3ExprCodeIN(pParse, pExpr, dest, destIfNull);\n        sqlite3VdbeResolveLabel(v, destIfNull);\n      }\n      break;\n    }\n#endif\n    default: {\n    default_expr: \n      if( exprAlwaysFalse(pExpr) ){\n        sqlite3VdbeGoto(v, dest);\n      }else if( exprAlwaysTrue(pExpr) ){\n        /* no-op */\n      }else{\n        r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);\n        sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0);\n        VdbeCoverage(v);\n        testcase( regFree1==0 );\n        testcase( jumpIfNull==0 );\n      }\n      break;\n    }\n  }\n  sqlite3ReleaseTempReg(pParse, regFree1);\n  sqlite3ReleaseTempReg(pParse, regFree2);\n}\n\n/*\n** Like sqlite3ExprIfFalse() except that a copy is made of pExpr before\n** code generation, and that copy is deleted after code generation. This\n** ensures that the original pExpr is unchanged.\n*/\nvoid sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,int jumpIfNull){\n  sqlite3 *db = pParse->db;\n  Expr *pCopy = sqlite3ExprDup(db, pExpr, 0);\n  if( db->mallocFailed==0 ){\n    sqlite3ExprIfFalse(pParse, pCopy, dest, jumpIfNull);\n  }\n  sqlite3ExprDelete(db, pCopy);\n}\n\n\n/*\n** Do a deep comparison of two expression trees.  Return 0 if the two\n** expressions are completely identical.  Return 1 if they differ only\n** by a COLLATE operator at the top level.  Return 2 if there are differences\n** other than the top-level COLLATE operator.\n**\n** If any subelement of pB has Expr.iTable==(-1) then it is allowed\n** to compare equal to an equivalent element in pA with Expr.iTable==iTab.\n**\n** The pA side might be using TK_REGISTER.  If that is the case and pB is\n** not using TK_REGISTER but is otherwise equivalent, then still return 0.\n**\n** Sometimes this routine will return 2 even if the two expressions\n** really are equivalent.  If we cannot prove that the expressions are\n** identical, we return 2 just to be safe.  So if this routine\n** returns 2, then you do not really know for certain if the two\n** expressions are the same.  But if you get a 0 or 1 return, then you\n** can be sure the expressions are the same.  In the places where\n** this routine is used, it does not hurt to get an extra 2 - that\n** just might result in some slightly slower code.  But returning\n** an incorrect 0 or 1 could lead to a malfunction.\n*/\nint sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){\n  u32 combinedFlags;\n  if( pA==0 || pB==0 ){\n    return pB==pA ? 0 : 2;\n  }\n  combinedFlags = pA->flags | pB->flags;\n  if( combinedFlags & EP_IntValue ){\n    if( (pA->flags&pB->flags&EP_IntValue)!=0 && pA->u.iValue==pB->u.iValue ){\n      return 0;\n    }\n    return 2;\n  }\n  if( pA->op!=pB->op ){\n    if( pA->op==TK_COLLATE && sqlite3ExprCompare(pA->pLeft, pB, iTab)<2 ){\n      return 1;\n    }\n    if( pB->op==TK_COLLATE && sqlite3ExprCompare(pA, pB->pLeft, iTab)<2 ){\n      return 1;\n    }\n    return 2;\n  }\n  if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){\n    if( pA->op==TK_FUNCTION ){\n      if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;\n    }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){\n      return pA->op==TK_COLLATE ? 1 : 2;\n    }\n  }\n  if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;\n  if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){\n    if( combinedFlags & EP_xIsSelect ) return 2;\n    if( sqlite3ExprCompare(pA->pLeft, pB->pLeft, iTab) ) return 2;\n    if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2;\n    if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;\n    if( ALWAYS((combinedFlags & EP_Reduced)==0) && pA->op!=TK_STRING ){\n      if( pA->iColumn!=pB->iColumn ) return 2;\n      if( pA->iTable!=pB->iTable \n       && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;\n    }\n  }\n  return 0;\n}\n\n/*\n** Compare two ExprList objects.  Return 0 if they are identical and \n** non-zero if they differ in any way.\n**\n** If any subelement of pB has Expr.iTable==(-1) then it is allowed\n** to compare equal to an equivalent element in pA with Expr.iTable==iTab.\n**\n** This routine might return non-zero for equivalent ExprLists.  The\n** only consequence will be disabled optimizations.  But this routine\n** must never return 0 if the two ExprList objects are different, or\n** a malfunction will result.\n**\n** Two NULL pointers are considered to be the same.  But a NULL pointer\n** always differs from a non-NULL pointer.\n*/\nint sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){\n  int i;\n  if( pA==0 && pB==0 ) return 0;\n  if( pA==0 || pB==0 ) return 1;\n  if( pA->nExpr!=pB->nExpr ) return 1;\n  for(i=0; i<pA->nExpr; i++){\n    Expr *pExprA = pA->a[i].pExpr;\n    Expr *pExprB = pB->a[i].pExpr;\n    if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1;\n    if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1;\n  }\n  return 0;\n}\n\n/*\n** Return true if we can prove the pE2 will always be true if pE1 is\n** true.  Return false if we cannot complete the proof or if pE2 might\n** be false.  Examples:\n**\n**     pE1: x==5       pE2: x==5             Result: true\n**     pE1: x>0        pE2: x==5             Result: false\n**     pE1: x=21       pE2: x=21 OR y=43     Result: true\n**     pE1: x!=123     pE2: x IS NOT NULL    Result: true\n**     pE1: x!=?1      pE2: x IS NOT NULL    Result: true\n**     pE1: x IS NULL  pE2: x IS NOT NULL    Result: false\n**     pE1: x IS ?2    pE2: x IS NOT NULL    Reuslt: false\n**\n** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has\n** Expr.iTable<0 then assume a table number given by iTab.\n**\n** When in doubt, return false.  Returning true might give a performance\n** improvement.  Returning false might cause a performance reduction, but\n** it will always give the correct answer and is hence always safe.\n*/\nint sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){\n  if( sqlite3ExprCompare(pE1, pE2, iTab)==0 ){\n    return 1;\n  }\n  if( pE2->op==TK_OR\n   && (sqlite3ExprImpliesExpr(pE1, pE2->pLeft, iTab)\n             || sqlite3ExprImpliesExpr(pE1, pE2->pRight, iTab) )\n  ){\n    return 1;\n  }\n  if( pE2->op==TK_NOTNULL\n   && sqlite3ExprCompare(pE1->pLeft, pE2->pLeft, iTab)==0\n   && (pE1->op!=TK_ISNULL && pE1->op!=TK_IS)\n  ){\n    return 1;\n  }\n  return 0;\n}\n\n/*\n** An instance of the following structure is used by the tree walker\n** to determine if an expression can be evaluated by reference to the\n** index only, without having to do a search for the corresponding\n** table entry.  The IdxCover.pIdx field is the index.  IdxCover.iCur\n** is the cursor for the table.\n*/\nstruct IdxCover {\n  Index *pIdx;     /* The index to be tested for coverage */\n  int iCur;        /* Cursor number for the table corresponding to the index */\n};\n\n/*\n** Check to see if there are references to columns in table \n** pWalker->u.pIdxCover->iCur can be satisfied using the index\n** pWalker->u.pIdxCover->pIdx.\n*/\nstatic int exprIdxCover(Walker *pWalker, Expr *pExpr){\n  if( pExpr->op==TK_COLUMN\n   && pExpr->iTable==pWalker->u.pIdxCover->iCur\n   && sqlite3ColumnOfIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0\n  ){\n    pWalker->eCode = 1;\n    return WRC_Abort;\n  }\n  return WRC_Continue;\n}\n\n/*\n** Determine if an index pIdx on table with cursor iCur contains will\n** the expression pExpr.  Return true if the index does cover the\n** expression and false if the pExpr expression references table columns\n** that are not found in the index pIdx.\n**\n** An index covering an expression means that the expression can be\n** evaluated using only the index and without having to lookup the\n** corresponding table entry.\n*/\nint sqlite3ExprCoveredByIndex(\n  Expr *pExpr,        /* The index to be tested */\n  int iCur,           /* The cursor number for the corresponding table */\n  Index *pIdx         /* The index that might be used for coverage */\n){\n  Walker w;\n  struct IdxCover xcov;\n  memset(&w, 0, sizeof(w));\n  xcov.iCur = iCur;\n  xcov.pIdx = pIdx;\n  w.xExprCallback = exprIdxCover;\n  w.u.pIdxCover = &xcov;\n  sqlite3WalkExpr(&w, pExpr);\n  return !w.eCode;\n}\n\n\n/*\n** An instance of the following structure is used by the tree walker\n** to count references to table columns in the arguments of an \n** aggregate function, in order to implement the\n** sqlite3FunctionThisSrc() routine.\n*/\nstruct SrcCount {\n  SrcList *pSrc;   /* One particular FROM clause in a nested query */\n  int nThis;       /* Number of references to columns in pSrcList */\n  int nOther;      /* Number of references to columns in other FROM clauses */\n};\n\n/*\n** Count the number of references to columns.\n*/\nstatic int exprSrcCount(Walker *pWalker, Expr *pExpr){\n  /* The NEVER() on the second term is because sqlite3FunctionUsesThisSrc()\n  ** is always called before sqlite3ExprAnalyzeAggregates() and so the\n  ** TK_COLUMNs have not yet been converted into TK_AGG_COLUMN.  If\n  ** sqlite3FunctionUsesThisSrc() is used differently in the future, the\n  ** NEVER() will need to be removed. */\n  if( pExpr->op==TK_COLUMN || NEVER(pExpr->op==TK_AGG_COLUMN) ){\n    int i;\n    struct SrcCount *p = pWalker->u.pSrcCount;\n    SrcList *pSrc = p->pSrc;\n    int nSrc = pSrc ? pSrc->nSrc : 0;\n    for(i=0; i<nSrc; i++){\n      if( pExpr->iTable==pSrc->a[i].iCursor ) break;\n    }\n    if( i<nSrc ){\n      p->nThis++;\n    }else{\n      p->nOther++;\n    }\n  }\n  return WRC_Continue;\n}\n\n/*\n** Determine if any of the arguments to the pExpr Function reference\n** pSrcList.  Return true if they do.  Also return true if the function\n** has no arguments or has only constant arguments.  Return false if pExpr\n** references columns but not columns of tables found in pSrcList.\n*/\nint sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){\n  Walker w;\n  struct SrcCount cnt;\n  assert( pExpr->op==TK_AGG_FUNCTION );\n  memset(&w, 0, sizeof(w));\n  w.xExprCallback = exprSrcCount;\n  w.u.pSrcCount = &cnt;\n  cnt.pSrc = pSrcList;\n  cnt.nThis = 0;\n  cnt.nOther = 0;\n  sqlite3WalkExprList(&w, pExpr->x.pList);\n  return cnt.nThis>0 || cnt.nOther==0;\n}\n\n/*\n** Add a new element to the pAggInfo->aCol[] array.  Return the index of\n** the new element.  Return a negative number if malloc fails.\n*/\nstatic int addAggInfoColumn(sqlite3 *db, AggInfo *pInfo){\n  int i;\n  pInfo->aCol = sqlite3ArrayAllocate(\n       db,\n       pInfo->aCol,\n       sizeof(pInfo->aCol[0]),\n       &pInfo->nColumn,\n       &i\n  );\n  return i;\n}    \n\n/*\n** Add a new element to the pAggInfo->aFunc[] array.  Return the index of\n** the new element.  Return a negative number if malloc fails.\n*/\nstatic int addAggInfoFunc(sqlite3 *db, AggInfo *pInfo){\n  int i;\n  pInfo->aFunc = sqlite3ArrayAllocate(\n       db, \n       pInfo->aFunc,\n       sizeof(pInfo->aFunc[0]),\n       &pInfo->nFunc,\n       &i\n  );\n  return i;\n}    \n\n/*\n** This is the xExprCallback for a tree walker.  It is used to\n** implement sqlite3ExprAnalyzeAggregates().  See sqlite3ExprAnalyzeAggregates\n** for additional information.\n*/\nstatic int analyzeAggregate(Walker *pWalker, Expr *pExpr){\n  int i;\n  NameContext *pNC = pWalker->u.pNC;\n  Parse *pParse = pNC->pParse;\n  SrcList *pSrcList = pNC->pSrcList;\n  AggInfo *pAggInfo = pNC->pAggInfo;\n\n  switch( pExpr->op ){\n    case TK_AGG_COLUMN:\n    case TK_COLUMN: {\n      testcase( pExpr->op==TK_AGG_COLUMN );\n      testcase( pExpr->op==TK_COLUMN );\n      /* Check to see if the column is in one of the tables in the FROM\n      ** clause of the aggregate query */\n      if( ALWAYS(pSrcList!=0) ){\n        struct SrcList_item *pItem = pSrcList->a;\n        for(i=0; i<pSrcList->nSrc; i++, pItem++){\n          struct AggInfo_col *pCol;\n          assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );\n          if( pExpr->iTable==pItem->iCursor ){\n            /* If we reach this point, it means that pExpr refers to a table\n            ** that is in the FROM clause of the aggregate query.  \n            **\n            ** Make an entry for the column in pAggInfo->aCol[] if there\n            ** is not an entry there already.\n            */\n            int k;\n            pCol = pAggInfo->aCol;\n            for(k=0; k<pAggInfo->nColumn; k++, pCol++){\n              if( pCol->iTable==pExpr->iTable &&\n                  pCol->iColumn==pExpr->iColumn ){\n                break;\n              }\n            }\n            if( (k>=pAggInfo->nColumn)\n             && (k = addAggInfoColumn(pParse->db, pAggInfo))>=0 \n            ){\n              pCol = &pAggInfo->aCol[k];\n              pCol->pTab = pExpr->pTab;\n              pCol->iTable = pExpr->iTable;\n              pCol->iColumn = pExpr->iColumn;\n              pCol->iMem = ++pParse->nMem;\n              pCol->iSorterColumn = -1;\n              pCol->pExpr = pExpr;\n              if( pAggInfo->pGroupBy ){\n                int j, n;\n                ExprList *pGB = pAggInfo->pGroupBy;\n                struct ExprList_item *pTerm = pGB->a;\n                n = pGB->nExpr;\n                for(j=0; j<n; j++, pTerm++){\n                  Expr *pE = pTerm->pExpr;\n                  if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&\n                      pE->iColumn==pExpr->iColumn ){\n                    pCol->iSorterColumn = j;\n                    break;\n                  }\n                }\n              }\n              if( pCol->iSorterColumn<0 ){\n                pCol->iSorterColumn = pAggInfo->nSortingColumn++;\n              }\n            }\n            /* There is now an entry for pExpr in pAggInfo->aCol[] (either\n            ** because it was there before or because we just created it).\n            ** Convert the pExpr to be a TK_AGG_COLUMN referring to that\n            ** pAggInfo->aCol[] entry.\n            */\n            ExprSetVVAProperty(pExpr, EP_NoReduce);\n            pExpr->pAggInfo = pAggInfo;\n            pExpr->op = TK_AGG_COLUMN;\n            pExpr->iAgg = (i16)k;\n            break;\n          } /* endif pExpr->iTable==pItem->iCursor */\n        } /* end loop over pSrcList */\n      }\n      return WRC_Prune;\n    }\n    case TK_AGG_FUNCTION: {\n      if( (pNC->ncFlags & NC_InAggFunc)==0\n       && pWalker->walkerDepth==pExpr->op2\n      ){\n        /* Check to see if pExpr is a duplicate of another aggregate \n        ** function that is already in the pAggInfo structure\n        */\n        struct AggInfo_func *pItem = pAggInfo->aFunc;\n        for(i=0; i<pAggInfo->nFunc; i++, pItem++){\n          if( sqlite3ExprCompare(pItem->pExpr, pExpr, -1)==0 ){\n            break;\n          }\n        }\n        if( i>=pAggInfo->nFunc ){\n          /* pExpr is original.  Make a new entry in pAggInfo->aFunc[]\n          */\n          u8 enc = ENC(pParse->db);\n          i = addAggInfoFunc(pParse->db, pAggInfo);\n          if( i>=0 ){\n            assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\n            pItem = &pAggInfo->aFunc[i];\n            pItem->pExpr = pExpr;\n            pItem->iMem = ++pParse->nMem;\n            assert( !ExprHasProperty(pExpr, EP_IntValue) );\n            pItem->pFunc = sqlite3FindFunction(pParse->db,\n                   pExpr->u.zToken, \n                   pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0);\n            if( pExpr->flags & EP_Distinct ){\n              pItem->iDistinct = pParse->nTab++;\n            }else{\n              pItem->iDistinct = -1;\n            }\n          }\n        }\n        /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry\n        */\n        assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );\n        ExprSetVVAProperty(pExpr, EP_NoReduce);\n        pExpr->iAgg = (i16)i;\n        pExpr->pAggInfo = pAggInfo;\n        return WRC_Prune;\n      }else{\n        return WRC_Continue;\n      }\n    }\n  }\n  return WRC_Continue;\n}\nstatic int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){\n  UNUSED_PARAMETER(pWalker);\n  UNUSED_PARAMETER(pSelect);\n  return WRC_Continue;\n}\n\n/*\n** Analyze the pExpr expression looking for aggregate functions and\n** for variables that need to be added to AggInfo object that pNC->pAggInfo\n** points to.  Additional entries are made on the AggInfo object as\n** necessary.\n**\n** This routine should only be called after the expression has been\n** analyzed by sqlite3ResolveExprNames().\n*/\nvoid sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){\n  Walker w;\n  memset(&w, 0, sizeof(w));\n  w.xExprCallback = analyzeAggregate;\n  w.xSelectCallback = analyzeAggregatesInSelect;\n  w.u.pNC = pNC;\n  assert( pNC->pSrcList!=0 );\n  sqlite3WalkExpr(&w, pExpr);\n}\n\n/*\n** Call sqlite3ExprAnalyzeAggregates() for every expression in an\n** expression list.  Return the number of errors.\n**\n** If an error is found, the analysis is cut short.\n*/\nvoid sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){\n  struct ExprList_item *pItem;\n  int i;\n  if( pList ){\n    for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){\n      sqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr);\n    }\n  }\n}\n\n/*\n** Allocate a single new register for use to hold some intermediate result.\n*/\nint sqlite3GetTempReg(Parse *pParse){\n  if( pParse->nTempReg==0 ){\n    return ++pParse->nMem;\n  }\n  return pParse->aTempReg[--pParse->nTempReg];\n}\n\n/*\n** Deallocate a register, making available for reuse for some other\n** purpose.\n**\n** If a register is currently being used by the column cache, then\n** the deallocation is deferred until the column cache line that uses\n** the register becomes stale.\n*/\nvoid sqlite3ReleaseTempReg(Parse *pParse, int iReg){\n  if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){\n    int i;\n    struct yColCache *p;\n    for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){\n      if( p->iReg==iReg ){\n        p->tempReg = 1;\n        return;\n      }\n    }\n    pParse->aTempReg[pParse->nTempReg++] = iReg;\n  }\n}\n\n/*\n** Allocate or deallocate a block of nReg consecutive registers.\n*/\nint sqlite3GetTempRange(Parse *pParse, int nReg){\n  int i, n;\n  if( nReg==1 ) return sqlite3GetTempReg(pParse);\n  i = pParse->iRangeReg;\n  n = pParse->nRangeReg;\n  if( nReg<=n ){\n    assert( !usedAsColumnCache(pParse, i, i+n-1) );\n    pParse->iRangeReg += nReg;\n    pParse->nRangeReg -= nReg;\n  }else{\n    i = pParse->nMem+1;\n    pParse->nMem += nReg;\n  }\n  return i;\n}\nvoid sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){\n  if( nReg==1 ){\n    sqlite3ReleaseTempReg(pParse, iReg);\n    return;\n  }\n  sqlite3ExprCacheRemove(pParse, iReg, nReg);\n  if( nReg>pParse->nRangeReg ){\n    pParse->nRangeReg = nReg;\n    pParse->iRangeReg = iReg;\n  }\n}\n\n/*\n** Mark all temporary registers as being unavailable for reuse.\n*/\nvoid sqlite3ClearTempRegCache(Parse *pParse){\n  pParse->nTempReg = 0;\n  pParse->nRangeReg = 0;\n}\n\n/*\n** Validate that no temporary register falls within the range of\n** iFirst..iLast, inclusive.  This routine is only call from within assert()\n** statements.\n*/\n#ifdef SQLITE_DEBUG\nint sqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast){\n  int i;\n  if( pParse->nRangeReg>0\n   && pParse->iRangeReg+pParse->nRangeReg<iLast\n   && pParse->iRangeReg>=iFirst\n  ){\n     return 0;\n  }\n  for(i=0; i<pParse->nTempReg; i++){\n    if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){\n      return 0;\n    }\n  }\n  return 1;\n}\n#endif /* SQLITE_DEBUG */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/fault.c",
    "content": "/*\n** 2008 Jan 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains code to support the concept of \"benign\" \n** malloc failures (when the xMalloc() or xRealloc() method of the\n** sqlite3_mem_methods structure fails to allocate a block of memory\n** and returns 0). \n**\n** Most malloc failures are non-benign. After they occur, SQLite\n** abandons the current operation and returns an error code (usually\n** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily\n** fatal. For example, if a malloc fails while resizing a hash table, this \n** is completely recoverable simply by not carrying out the resize. The \n** hash table will continue to function normally.  So a malloc failure \n** during a hash table resize is a benign fault.\n*/\n\n#include \"sqliteInt.h\"\n\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n\n/*\n** Global variables.\n*/\ntypedef struct BenignMallocHooks BenignMallocHooks;\nstatic SQLITE_WSD struct BenignMallocHooks {\n  void (*xBenignBegin)(void);\n  void (*xBenignEnd)(void);\n} sqlite3Hooks = { 0, 0 };\n\n/* The \"wsdHooks\" macro will resolve to the appropriate BenignMallocHooks\n** structure.  If writable static data is unsupported on the target,\n** we have to locate the state vector at run-time.  In the more common\n** case where writable static data is supported, wsdHooks can refer directly\n** to the \"sqlite3Hooks\" state vector declared above.\n*/\n#ifdef SQLITE_OMIT_WSD\n# define wsdHooksInit \\\n  BenignMallocHooks *x = &GLOBAL(BenignMallocHooks,sqlite3Hooks)\n# define wsdHooks x[0]\n#else\n# define wsdHooksInit\n# define wsdHooks sqlite3Hooks\n#endif\n\n\n/*\n** Register hooks to call when sqlite3BeginBenignMalloc() and\n** sqlite3EndBenignMalloc() are called, respectively.\n*/\nvoid sqlite3BenignMallocHooks(\n  void (*xBenignBegin)(void),\n  void (*xBenignEnd)(void)\n){\n  wsdHooksInit;\n  wsdHooks.xBenignBegin = xBenignBegin;\n  wsdHooks.xBenignEnd = xBenignEnd;\n}\n\n/*\n** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that\n** subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc()\n** indicates that subsequent malloc failures are non-benign.\n*/\nvoid sqlite3BeginBenignMalloc(void){\n  wsdHooksInit;\n  if( wsdHooks.xBenignBegin ){\n    wsdHooks.xBenignBegin();\n  }\n}\nvoid sqlite3EndBenignMalloc(void){\n  wsdHooksInit;\n  if( wsdHooks.xBenignEnd ){\n    wsdHooks.xBenignEnd();\n  }\n}\n\n#endif   /* #ifndef SQLITE_OMIT_BUILTIN_TEST */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/fkey.c",
    "content": "/*\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used by the compiler to add foreign key\n** support to compiled SQL statements.\n*/\n#include \"sqliteInt.h\"\n\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n#ifndef SQLITE_OMIT_TRIGGER\n\n/*\n** Deferred and Immediate FKs\n** --------------------------\n**\n** Foreign keys in SQLite come in two flavours: deferred and immediate.\n** If an immediate foreign key constraint is violated,\n** SQLITE_CONSTRAINT_FOREIGNKEY is returned and the current\n** statement transaction rolled back. If a \n** deferred foreign key constraint is violated, no action is taken \n** immediately. However if the application attempts to commit the \n** transaction before fixing the constraint violation, the attempt fails.\n**\n** Deferred constraints are implemented using a simple counter associated\n** with the database handle. The counter is set to zero each time a \n** database transaction is opened. Each time a statement is executed \n** that causes a foreign key violation, the counter is incremented. Each\n** time a statement is executed that removes an existing violation from\n** the database, the counter is decremented. When the transaction is\n** committed, the commit fails if the current value of the counter is\n** greater than zero. This scheme has two big drawbacks:\n**\n**   * When a commit fails due to a deferred foreign key constraint, \n**     there is no way to tell which foreign constraint is not satisfied,\n**     or which row it is not satisfied for.\n**\n**   * If the database contains foreign key violations when the \n**     transaction is opened, this may cause the mechanism to malfunction.\n**\n** Despite these problems, this approach is adopted as it seems simpler\n** than the alternatives.\n**\n** INSERT operations:\n**\n**   I.1) For each FK for which the table is the child table, search\n**        the parent table for a match. If none is found increment the\n**        constraint counter.\n**\n**   I.2) For each FK for which the table is the parent table, \n**        search the child table for rows that correspond to the new\n**        row in the parent table. Decrement the counter for each row\n**        found (as the constraint is now satisfied).\n**\n** DELETE operations:\n**\n**   D.1) For each FK for which the table is the child table, \n**        search the parent table for a row that corresponds to the \n**        deleted row in the child table. If such a row is not found, \n**        decrement the counter.\n**\n**   D.2) For each FK for which the table is the parent table, search \n**        the child table for rows that correspond to the deleted row \n**        in the parent table. For each found increment the counter.\n**\n** UPDATE operations:\n**\n**   An UPDATE command requires that all 4 steps above are taken, but only\n**   for FK constraints for which the affected columns are actually \n**   modified (values must be compared at runtime).\n**\n** Note that I.1 and D.1 are very similar operations, as are I.2 and D.2.\n** This simplifies the implementation a bit.\n**\n** For the purposes of immediate FK constraints, the OR REPLACE conflict\n** resolution is considered to delete rows before the new row is inserted.\n** If a delete caused by OR REPLACE violates an FK constraint, an exception\n** is thrown, even if the FK constraint would be satisfied after the new \n** row is inserted.\n**\n** Immediate constraints are usually handled similarly. The only difference \n** is that the counter used is stored as part of each individual statement\n** object (struct Vdbe). If, after the statement has run, its immediate\n** constraint counter is greater than zero,\n** it returns SQLITE_CONSTRAINT_FOREIGNKEY\n** and the statement transaction is rolled back. An exception is an INSERT\n** statement that inserts a single row only (no triggers). In this case,\n** instead of using a counter, an exception is thrown immediately if the\n** INSERT violates a foreign key constraint. This is necessary as such\n** an INSERT does not open a statement transaction.\n**\n** TODO: How should dropping a table be handled? How should renaming a \n** table be handled?\n**\n**\n** Query API Notes\n** ---------------\n**\n** Before coding an UPDATE or DELETE row operation, the code-generator\n** for those two operations needs to know whether or not the operation\n** requires any FK processing and, if so, which columns of the original\n** row are required by the FK processing VDBE code (i.e. if FKs were\n** implemented using triggers, which of the old.* columns would be \n** accessed). No information is required by the code-generator before\n** coding an INSERT operation. The functions used by the UPDATE/DELETE\n** generation code to query for this information are:\n**\n**   sqlite3FkRequired() - Test to see if FK processing is required.\n**   sqlite3FkOldmask()  - Query for the set of required old.* columns.\n**\n**\n** Externally accessible module functions\n** --------------------------------------\n**\n**   sqlite3FkCheck()    - Check for foreign key violations.\n**   sqlite3FkActions()  - Code triggers for ON UPDATE/ON DELETE actions.\n**   sqlite3FkDelete()   - Delete an FKey structure.\n*/\n\n/*\n** VDBE Calling Convention\n** -----------------------\n**\n** Example:\n**\n**   For the following INSERT statement:\n**\n**     CREATE TABLE t1(a, b INTEGER PRIMARY KEY, c);\n**     INSERT INTO t1 VALUES(1, 2, 3.1);\n**\n**   Register (x):        2    (type integer)\n**   Register (x+1):      1    (type integer)\n**   Register (x+2):      NULL (type NULL)\n**   Register (x+3):      3.1  (type real)\n*/\n\n/*\n** A foreign key constraint requires that the key columns in the parent\n** table are collectively subject to a UNIQUE or PRIMARY KEY constraint.\n** Given that pParent is the parent table for foreign key constraint pFKey, \n** search the schema for a unique index on the parent key columns. \n**\n** If successful, zero is returned. If the parent key is an INTEGER PRIMARY \n** KEY column, then output variable *ppIdx is set to NULL. Otherwise, *ppIdx \n** is set to point to the unique index. \n** \n** If the parent key consists of a single column (the foreign key constraint\n** is not a composite foreign key), output variable *paiCol is set to NULL.\n** Otherwise, it is set to point to an allocated array of size N, where\n** N is the number of columns in the parent key. The first element of the\n** array is the index of the child table column that is mapped by the FK\n** constraint to the parent table column stored in the left-most column\n** of index *ppIdx. The second element of the array is the index of the\n** child table column that corresponds to the second left-most column of\n** *ppIdx, and so on.\n**\n** If the required index cannot be found, either because:\n**\n**   1) The named parent key columns do not exist, or\n**\n**   2) The named parent key columns do exist, but are not subject to a\n**      UNIQUE or PRIMARY KEY constraint, or\n**\n**   3) No parent key columns were provided explicitly as part of the\n**      foreign key definition, and the parent table does not have a\n**      PRIMARY KEY, or\n**\n**   4) No parent key columns were provided explicitly as part of the\n**      foreign key definition, and the PRIMARY KEY of the parent table \n**      consists of a different number of columns to the child key in \n**      the child table.\n**\n** then non-zero is returned, and a \"foreign key mismatch\" error loaded\n** into pParse. If an OOM error occurs, non-zero is returned and the\n** pParse->db->mallocFailed flag is set.\n*/\nint sqlite3FkLocateIndex(\n  Parse *pParse,                  /* Parse context to store any error in */\n  Table *pParent,                 /* Parent table of FK constraint pFKey */\n  FKey *pFKey,                    /* Foreign key to find index for */\n  Index **ppIdx,                  /* OUT: Unique index on parent table */\n  int **paiCol                    /* OUT: Map of index columns in pFKey */\n){\n  Index *pIdx = 0;                    /* Value to return via *ppIdx */\n  int *aiCol = 0;                     /* Value to return via *paiCol */\n  int nCol = pFKey->nCol;             /* Number of columns in parent key */\n  char *zKey = pFKey->aCol[0].zCol;   /* Name of left-most parent key column */\n\n  /* The caller is responsible for zeroing output parameters. */\n  assert( ppIdx && *ppIdx==0 );\n  assert( !paiCol || *paiCol==0 );\n  assert( pParse );\n\n  /* If this is a non-composite (single column) foreign key, check if it \n  ** maps to the INTEGER PRIMARY KEY of table pParent. If so, leave *ppIdx \n  ** and *paiCol set to zero and return early. \n  **\n  ** Otherwise, for a composite foreign key (more than one column), allocate\n  ** space for the aiCol array (returned via output parameter *paiCol).\n  ** Non-composite foreign keys do not require the aiCol array.\n  */\n  if( nCol==1 ){\n    /* The FK maps to the IPK if any of the following are true:\n    **\n    **   1) There is an INTEGER PRIMARY KEY column and the FK is implicitly \n    **      mapped to the primary key of table pParent, or\n    **   2) The FK is explicitly mapped to a column declared as INTEGER\n    **      PRIMARY KEY.\n    */\n    if( pParent->iPKey>=0 ){\n      if( !zKey ) return 0;\n      if( !sqlite3StrICmp(pParent->aCol[pParent->iPKey].zName, zKey) ) return 0;\n    }\n  }else if( paiCol ){\n    assert( nCol>1 );\n    aiCol = (int *)sqlite3DbMallocRawNN(pParse->db, nCol*sizeof(int));\n    if( !aiCol ) return 1;\n    *paiCol = aiCol;\n  }\n\n  for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){\n    if( pIdx->nKeyCol==nCol && IsUniqueIndex(pIdx) ){ \n      /* pIdx is a UNIQUE index (or a PRIMARY KEY) and has the right number\n      ** of columns. If each indexed column corresponds to a foreign key\n      ** column of pFKey, then this index is a winner.  */\n\n      if( zKey==0 ){\n        /* If zKey is NULL, then this foreign key is implicitly mapped to \n        ** the PRIMARY KEY of table pParent. The PRIMARY KEY index may be \n        ** identified by the test.  */\n        if( IsPrimaryKeyIndex(pIdx) ){\n          if( aiCol ){\n            int i;\n            for(i=0; i<nCol; i++) aiCol[i] = pFKey->aCol[i].iFrom;\n          }\n          break;\n        }\n      }else{\n        /* If zKey is non-NULL, then this foreign key was declared to\n        ** map to an explicit list of columns in table pParent. Check if this\n        ** index matches those columns. Also, check that the index uses\n        ** the default collation sequences for each column. */\n        int i, j;\n        for(i=0; i<nCol; i++){\n          i16 iCol = pIdx->aiColumn[i];     /* Index of column in parent tbl */\n          const char *zDfltColl;            /* Def. collation for column */\n          char *zIdxCol;                    /* Name of indexed column */\n\n          if( iCol<0 ) break; /* No foreign keys against expression indexes */\n\n          /* If the index uses a collation sequence that is different from\n          ** the default collation sequence for the column, this index is\n          ** unusable. Bail out early in this case.  */\n          zDfltColl = pParent->aCol[iCol].zColl;\n          if( !zDfltColl ) zDfltColl = sqlite3StrBINARY;\n          if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break;\n\n          zIdxCol = pParent->aCol[iCol].zName;\n          for(j=0; j<nCol; j++){\n            if( sqlite3StrICmp(pFKey->aCol[j].zCol, zIdxCol)==0 ){\n              if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom;\n              break;\n            }\n          }\n          if( j==nCol ) break;\n        }\n        if( i==nCol ) break;      /* pIdx is usable */\n      }\n    }\n  }\n\n  if( !pIdx ){\n    if( !pParse->disableTriggers ){\n      sqlite3ErrorMsg(pParse,\n           \"foreign key mismatch - \\\"%w\\\" referencing \\\"%w\\\"\",\n           pFKey->pFrom->zName, pFKey->zTo);\n    }\n    sqlite3DbFree(pParse->db, aiCol);\n    return 1;\n  }\n\n  *ppIdx = pIdx;\n  return 0;\n}\n\n/*\n** This function is called when a row is inserted into or deleted from the \n** child table of foreign key constraint pFKey. If an SQL UPDATE is executed \n** on the child table of pFKey, this function is invoked twice for each row\n** affected - once to \"delete\" the old row, and then again to \"insert\" the\n** new row.\n**\n** Each time it is called, this function generates VDBE code to locate the\n** row in the parent table that corresponds to the row being inserted into \n** or deleted from the child table. If the parent row can be found, no \n** special action is taken. Otherwise, if the parent row can *not* be\n** found in the parent table:\n**\n**   Operation | FK type   | Action taken\n**   --------------------------------------------------------------------------\n**   INSERT      immediate   Increment the \"immediate constraint counter\".\n**\n**   DELETE      immediate   Decrement the \"immediate constraint counter\".\n**\n**   INSERT      deferred    Increment the \"deferred constraint counter\".\n**\n**   DELETE      deferred    Decrement the \"deferred constraint counter\".\n**\n** These operations are identified in the comment at the top of this file \n** (fkey.c) as \"I.1\" and \"D.1\".\n*/\nstatic void fkLookupParent(\n  Parse *pParse,        /* Parse context */\n  int iDb,              /* Index of database housing pTab */\n  Table *pTab,          /* Parent table of FK pFKey */\n  Index *pIdx,          /* Unique index on parent key columns in pTab */\n  FKey *pFKey,          /* Foreign key constraint */\n  int *aiCol,           /* Map from parent key columns to child table columns */\n  int regData,          /* Address of array containing child table row */\n  int nIncr,            /* Increment constraint counter by this */\n  int isIgnore          /* If true, pretend pTab contains all NULL values */\n){\n  int i;                                    /* Iterator variable */\n  Vdbe *v = sqlite3GetVdbe(pParse);         /* Vdbe to add code to */\n  int iCur = pParse->nTab - 1;              /* Cursor number to use */\n  int iOk = sqlite3VdbeMakeLabel(v);        /* jump here if parent key found */\n\n  /* If nIncr is less than zero, then check at runtime if there are any\n  ** outstanding constraints to resolve. If there are not, there is no need\n  ** to check if deleting this row resolves any outstanding violations.\n  **\n  ** Check if any of the key columns in the child table row are NULL. If \n  ** any are, then the constraint is considered satisfied. No need to \n  ** search for a matching row in the parent table.  */\n  if( nIncr<0 ){\n    sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, iOk);\n    VdbeCoverage(v);\n  }\n  for(i=0; i<pFKey->nCol; i++){\n    int iReg = aiCol[i] + regData + 1;\n    sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iOk); VdbeCoverage(v);\n  }\n\n  if( isIgnore==0 ){\n    if( pIdx==0 ){\n      /* If pIdx is NULL, then the parent key is the INTEGER PRIMARY KEY\n      ** column of the parent table (table pTab).  */\n      int iMustBeInt;               /* Address of MustBeInt instruction */\n      int regTemp = sqlite3GetTempReg(pParse);\n  \n      /* Invoke MustBeInt to coerce the child key value to an integer (i.e. \n      ** apply the affinity of the parent key). If this fails, then there\n      ** is no matching parent key. Before using MustBeInt, make a copy of\n      ** the value. Otherwise, the value inserted into the child key column\n      ** will have INTEGER affinity applied to it, which may not be correct.  */\n      sqlite3VdbeAddOp2(v, OP_SCopy, aiCol[0]+1+regData, regTemp);\n      iMustBeInt = sqlite3VdbeAddOp2(v, OP_MustBeInt, regTemp, 0);\n      VdbeCoverage(v);\n  \n      /* If the parent table is the same as the child table, and we are about\n      ** to increment the constraint-counter (i.e. this is an INSERT operation),\n      ** then check if the row being inserted matches itself. If so, do not\n      ** increment the constraint-counter.  */\n      if( pTab==pFKey->pFrom && nIncr==1 ){\n        sqlite3VdbeAddOp3(v, OP_Eq, regData, iOk, regTemp); VdbeCoverage(v);\n        sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);\n      }\n  \n      sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);\n      sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, regTemp); VdbeCoverage(v);\n      sqlite3VdbeGoto(v, iOk);\n      sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);\n      sqlite3VdbeJumpHere(v, iMustBeInt);\n      sqlite3ReleaseTempReg(pParse, regTemp);\n    }else{\n      int nCol = pFKey->nCol;\n      int regTemp = sqlite3GetTempRange(pParse, nCol);\n      int regRec = sqlite3GetTempReg(pParse);\n  \n      sqlite3VdbeAddOp3(v, OP_OpenRead, iCur, pIdx->tnum, iDb);\n      sqlite3VdbeSetP4KeyInfo(pParse, pIdx);\n      for(i=0; i<nCol; i++){\n        sqlite3VdbeAddOp2(v, OP_Copy, aiCol[i]+1+regData, regTemp+i);\n      }\n  \n      /* If the parent table is the same as the child table, and we are about\n      ** to increment the constraint-counter (i.e. this is an INSERT operation),\n      ** then check if the row being inserted matches itself. If so, do not\n      ** increment the constraint-counter. \n      **\n      ** If any of the parent-key values are NULL, then the row cannot match \n      ** itself. So set JUMPIFNULL to make sure we do the OP_Found if any\n      ** of the parent-key values are NULL (at this point it is known that\n      ** none of the child key values are).\n      */\n      if( pTab==pFKey->pFrom && nIncr==1 ){\n        int iJump = sqlite3VdbeCurrentAddr(v) + nCol + 1;\n        for(i=0; i<nCol; i++){\n          int iChild = aiCol[i]+1+regData;\n          int iParent = pIdx->aiColumn[i]+1+regData;\n          assert( pIdx->aiColumn[i]>=0 );\n          assert( aiCol[i]!=pTab->iPKey );\n          if( pIdx->aiColumn[i]==pTab->iPKey ){\n            /* The parent key is a composite key that includes the IPK column */\n            iParent = regData;\n          }\n          sqlite3VdbeAddOp3(v, OP_Ne, iChild, iJump, iParent); VdbeCoverage(v);\n          sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL);\n        }\n        sqlite3VdbeGoto(v, iOk);\n      }\n  \n      sqlite3VdbeAddOp4(v, OP_MakeRecord, regTemp, nCol, regRec,\n                        sqlite3IndexAffinityStr(pParse->db,pIdx), nCol);\n      sqlite3VdbeAddOp4Int(v, OP_Found, iCur, iOk, regRec, 0); VdbeCoverage(v);\n  \n      sqlite3ReleaseTempReg(pParse, regRec);\n      sqlite3ReleaseTempRange(pParse, regTemp, nCol);\n    }\n  }\n\n  if( !pFKey->isDeferred && !(pParse->db->flags & SQLITE_DeferFKs)\n   && !pParse->pToplevel \n   && !pParse->isMultiWrite \n  ){\n    /* Special case: If this is an INSERT statement that will insert exactly\n    ** one row into the table, raise a constraint immediately instead of\n    ** incrementing a counter. This is necessary as the VM code is being\n    ** generated for will not open a statement transaction.  */\n    assert( nIncr==1 );\n    sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY,\n        OE_Abort, 0, P4_STATIC, P5_ConstraintFK);\n  }else{\n    if( nIncr>0 && pFKey->isDeferred==0 ){\n      sqlite3MayAbort(pParse);\n    }\n    sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);\n  }\n\n  sqlite3VdbeResolveLabel(v, iOk);\n  sqlite3VdbeAddOp1(v, OP_Close, iCur);\n}\n\n\n/*\n** Return an Expr object that refers to a memory register corresponding\n** to column iCol of table pTab.\n**\n** regBase is the first of an array of register that contains the data\n** for pTab.  regBase itself holds the rowid.  regBase+1 holds the first\n** column.  regBase+2 holds the second column, and so forth.\n*/\nstatic Expr *exprTableRegister(\n  Parse *pParse,     /* Parsing and code generating context */\n  Table *pTab,       /* The table whose content is at r[regBase]... */\n  int regBase,       /* Contents of table pTab */\n  i16 iCol           /* Which column of pTab is desired */\n){\n  Expr *pExpr;\n  Column *pCol;\n  const char *zColl;\n  sqlite3 *db = pParse->db;\n\n  pExpr = sqlite3Expr(db, TK_REGISTER, 0);\n  if( pExpr ){\n    if( iCol>=0 && iCol!=pTab->iPKey ){\n      pCol = &pTab->aCol[iCol];\n      pExpr->iTable = regBase + iCol + 1;\n      pExpr->affinity = pCol->affinity;\n      zColl = pCol->zColl;\n      if( zColl==0 ) zColl = db->pDfltColl->zName;\n      pExpr = sqlite3ExprAddCollateString(pParse, pExpr, zColl);\n    }else{\n      pExpr->iTable = regBase;\n      pExpr->affinity = SQLITE_AFF_INTEGER;\n    }\n  }\n  return pExpr;\n}\n\n/*\n** Return an Expr object that refers to column iCol of table pTab which\n** has cursor iCur.\n*/\nstatic Expr *exprTableColumn(\n  sqlite3 *db,      /* The database connection */\n  Table *pTab,      /* The table whose column is desired */\n  int iCursor,      /* The open cursor on the table */\n  i16 iCol          /* The column that is wanted */\n){\n  Expr *pExpr = sqlite3Expr(db, TK_COLUMN, 0);\n  if( pExpr ){\n    pExpr->pTab = pTab;\n    pExpr->iTable = iCursor;\n    pExpr->iColumn = iCol;\n  }\n  return pExpr;\n}\n\n/*\n** This function is called to generate code executed when a row is deleted\n** from the parent table of foreign key constraint pFKey and, if pFKey is \n** deferred, when a row is inserted into the same table. When generating\n** code for an SQL UPDATE operation, this function may be called twice -\n** once to \"delete\" the old row and once to \"insert\" the new row.\n**\n** Parameter nIncr is passed -1 when inserting a row (as this may decrease\n** the number of FK violations in the db) or +1 when deleting one (as this\n** may increase the number of FK constraint problems).\n**\n** The code generated by this function scans through the rows in the child\n** table that correspond to the parent table row being deleted or inserted.\n** For each child row found, one of the following actions is taken:\n**\n**   Operation | FK type   | Action taken\n**   --------------------------------------------------------------------------\n**   DELETE      immediate   Increment the \"immediate constraint counter\".\n**                           Or, if the ON (UPDATE|DELETE) action is RESTRICT,\n**                           throw a \"FOREIGN KEY constraint failed\" exception.\n**\n**   INSERT      immediate   Decrement the \"immediate constraint counter\".\n**\n**   DELETE      deferred    Increment the \"deferred constraint counter\".\n**                           Or, if the ON (UPDATE|DELETE) action is RESTRICT,\n**                           throw a \"FOREIGN KEY constraint failed\" exception.\n**\n**   INSERT      deferred    Decrement the \"deferred constraint counter\".\n**\n** These operations are identified in the comment at the top of this file \n** (fkey.c) as \"I.2\" and \"D.2\".\n*/\nstatic void fkScanChildren(\n  Parse *pParse,                  /* Parse context */\n  SrcList *pSrc,                  /* The child table to be scanned */\n  Table *pTab,                    /* The parent table */\n  Index *pIdx,                    /* Index on parent covering the foreign key */\n  FKey *pFKey,                    /* The foreign key linking pSrc to pTab */\n  int *aiCol,                     /* Map from pIdx cols to child table cols */\n  int regData,                    /* Parent row data starts here */\n  int nIncr                       /* Amount to increment deferred counter by */\n){\n  sqlite3 *db = pParse->db;       /* Database handle */\n  int i;                          /* Iterator variable */\n  Expr *pWhere = 0;               /* WHERE clause to scan with */\n  NameContext sNameContext;       /* Context used to resolve WHERE clause */\n  WhereInfo *pWInfo;              /* Context used by sqlite3WhereXXX() */\n  int iFkIfZero = 0;              /* Address of OP_FkIfZero */\n  Vdbe *v = sqlite3GetVdbe(pParse);\n\n  assert( pIdx==0 || pIdx->pTable==pTab );\n  assert( pIdx==0 || pIdx->nKeyCol==pFKey->nCol );\n  assert( pIdx!=0 || pFKey->nCol==1 );\n  assert( pIdx!=0 || HasRowid(pTab) );\n\n  if( nIncr<0 ){\n    iFkIfZero = sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, 0);\n    VdbeCoverage(v);\n  }\n\n  /* Create an Expr object representing an SQL expression like:\n  **\n  **   <parent-key1> = <child-key1> AND <parent-key2> = <child-key2> ...\n  **\n  ** The collation sequence used for the comparison should be that of\n  ** the parent key columns. The affinity of the parent key column should\n  ** be applied to each child key value before the comparison takes place.\n  */\n  for(i=0; i<pFKey->nCol; i++){\n    Expr *pLeft;                  /* Value from parent table row */\n    Expr *pRight;                 /* Column ref to child table */\n    Expr *pEq;                    /* Expression (pLeft = pRight) */\n    i16 iCol;                     /* Index of column in child table */ \n    const char *zCol;             /* Name of column in child table */\n\n    iCol = pIdx ? pIdx->aiColumn[i] : -1;\n    pLeft = exprTableRegister(pParse, pTab, regData, iCol);\n    iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;\n    assert( iCol>=0 );\n    zCol = pFKey->pFrom->aCol[iCol].zName;\n    pRight = sqlite3Expr(db, TK_ID, zCol);\n    pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight, 0);\n    pWhere = sqlite3ExprAnd(db, pWhere, pEq);\n  }\n\n  /* If the child table is the same as the parent table, then add terms\n  ** to the WHERE clause that prevent this entry from being scanned.\n  ** The added WHERE clause terms are like this:\n  **\n  **     $current_rowid!=rowid\n  **     NOT( $current_a==a AND $current_b==b AND ... )\n  **\n  ** The first form is used for rowid tables.  The second form is used\n  ** for WITHOUT ROWID tables.  In the second form, the primary key is\n  ** (a,b,...)\n  */\n  if( pTab==pFKey->pFrom && nIncr>0 ){\n    Expr *pNe;                    /* Expression (pLeft != pRight) */\n    Expr *pLeft;                  /* Value from parent table row */\n    Expr *pRight;                 /* Column ref to child table */\n    if( HasRowid(pTab) ){\n      pLeft = exprTableRegister(pParse, pTab, regData, -1);\n      pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1);\n      pNe = sqlite3PExpr(pParse, TK_NE, pLeft, pRight, 0);\n    }else{\n      Expr *pEq, *pAll = 0;\n      Index *pPk = sqlite3PrimaryKeyIndex(pTab);\n      assert( pIdx!=0 );\n      for(i=0; i<pPk->nKeyCol; i++){\n        i16 iCol = pIdx->aiColumn[i];\n        assert( iCol>=0 );\n        pLeft = exprTableRegister(pParse, pTab, regData, iCol);\n        pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, iCol);\n        pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight, 0);\n        pAll = sqlite3ExprAnd(db, pAll, pEq);\n      }\n      pNe = sqlite3PExpr(pParse, TK_NOT, pAll, 0, 0);\n    }\n    pWhere = sqlite3ExprAnd(db, pWhere, pNe);\n  }\n\n  /* Resolve the references in the WHERE clause. */\n  memset(&sNameContext, 0, sizeof(NameContext));\n  sNameContext.pSrcList = pSrc;\n  sNameContext.pParse = pParse;\n  sqlite3ResolveExprNames(&sNameContext, pWhere);\n\n  /* Create VDBE to loop through the entries in pSrc that match the WHERE\n  ** clause. For each row found, increment either the deferred or immediate\n  ** foreign key constraint counter. */\n  pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0);\n  sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);\n  if( pWInfo ){\n    sqlite3WhereEnd(pWInfo);\n  }\n\n  /* Clean up the WHERE clause constructed above. */\n  sqlite3ExprDelete(db, pWhere);\n  if( iFkIfZero ){\n    sqlite3VdbeJumpHere(v, iFkIfZero);\n  }\n}\n\n/*\n** This function returns a linked list of FKey objects (connected by\n** FKey.pNextTo) holding all children of table pTab.  For example,\n** given the following schema:\n**\n**   CREATE TABLE t1(a PRIMARY KEY);\n**   CREATE TABLE t2(b REFERENCES t1(a);\n**\n** Calling this function with table \"t1\" as an argument returns a pointer\n** to the FKey structure representing the foreign key constraint on table\n** \"t2\". Calling this function with \"t2\" as the argument would return a\n** NULL pointer (as there are no FK constraints for which t2 is the parent\n** table).\n*/\nFKey *sqlite3FkReferences(Table *pTab){\n  return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);\n}\n\n/*\n** The second argument is a Trigger structure allocated by the \n** fkActionTrigger() routine. This function deletes the Trigger structure\n** and all of its sub-components.\n**\n** The Trigger structure or any of its sub-components may be allocated from\n** the lookaside buffer belonging to database handle dbMem.\n*/\nstatic void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){\n  if( p ){\n    TriggerStep *pStep = p->step_list;\n    sqlite3ExprDelete(dbMem, pStep->pWhere);\n    sqlite3ExprListDelete(dbMem, pStep->pExprList);\n    sqlite3SelectDelete(dbMem, pStep->pSelect);\n    sqlite3ExprDelete(dbMem, p->pWhen);\n    sqlite3DbFree(dbMem, p);\n  }\n}\n\n/*\n** This function is called to generate code that runs when table pTab is\n** being dropped from the database. The SrcList passed as the second argument\n** to this function contains a single entry guaranteed to resolve to\n** table pTab.\n**\n** Normally, no code is required. However, if either\n**\n**   (a) The table is the parent table of a FK constraint, or\n**   (b) The table is the child table of a deferred FK constraint and it is\n**       determined at runtime that there are outstanding deferred FK \n**       constraint violations in the database,\n**\n** then the equivalent of \"DELETE FROM <tbl>\" is executed before dropping\n** the table from the database. Triggers are disabled while running this\n** DELETE, but foreign key actions are not.\n*/\nvoid sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){\n  sqlite3 *db = pParse->db;\n  if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) && !pTab->pSelect ){\n    int iSkip = 0;\n    Vdbe *v = sqlite3GetVdbe(pParse);\n\n    assert( v );                  /* VDBE has already been allocated */\n    if( sqlite3FkReferences(pTab)==0 ){\n      /* Search for a deferred foreign key constraint for which this table\n      ** is the child table. If one cannot be found, return without \n      ** generating any VDBE code. If one can be found, then jump over\n      ** the entire DELETE if there are no outstanding deferred constraints\n      ** when this statement is run.  */\n      FKey *p;\n      for(p=pTab->pFKey; p; p=p->pNextFrom){\n        if( p->isDeferred || (db->flags & SQLITE_DeferFKs) ) break;\n      }\n      if( !p ) return;\n      iSkip = sqlite3VdbeMakeLabel(v);\n      sqlite3VdbeAddOp2(v, OP_FkIfZero, 1, iSkip); VdbeCoverage(v);\n    }\n\n    pParse->disableTriggers = 1;\n    sqlite3DeleteFrom(pParse, sqlite3SrcListDup(db, pName, 0), 0);\n    pParse->disableTriggers = 0;\n\n    /* If the DELETE has generated immediate foreign key constraint \n    ** violations, halt the VDBE and return an error at this point, before\n    ** any modifications to the schema are made. This is because statement\n    ** transactions are not able to rollback schema changes.  \n    **\n    ** If the SQLITE_DeferFKs flag is set, then this is not required, as\n    ** the statement transaction will not be rolled back even if FK\n    ** constraints are violated.\n    */\n    if( (db->flags & SQLITE_DeferFKs)==0 ){\n      sqlite3VdbeAddOp2(v, OP_FkIfZero, 0, sqlite3VdbeCurrentAddr(v)+2);\n      VdbeCoverage(v);\n      sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY,\n          OE_Abort, 0, P4_STATIC, P5_ConstraintFK);\n    }\n\n    if( iSkip ){\n      sqlite3VdbeResolveLabel(v, iSkip);\n    }\n  }\n}\n\n\n/*\n** The second argument points to an FKey object representing a foreign key\n** for which pTab is the child table. An UPDATE statement against pTab\n** is currently being processed. For each column of the table that is \n** actually updated, the corresponding element in the aChange[] array\n** is zero or greater (if a column is unmodified the corresponding element\n** is set to -1). If the rowid column is modified by the UPDATE statement\n** the bChngRowid argument is non-zero.\n**\n** This function returns true if any of the columns that are part of the\n** child key for FK constraint *p are modified.\n*/\nstatic int fkChildIsModified(\n  Table *pTab,                    /* Table being updated */\n  FKey *p,                        /* Foreign key for which pTab is the child */\n  int *aChange,                   /* Array indicating modified columns */\n  int bChngRowid                  /* True if rowid is modified by this update */\n){\n  int i;\n  for(i=0; i<p->nCol; i++){\n    int iChildKey = p->aCol[i].iFrom;\n    if( aChange[iChildKey]>=0 ) return 1;\n    if( iChildKey==pTab->iPKey && bChngRowid ) return 1;\n  }\n  return 0;\n}\n\n/*\n** The second argument points to an FKey object representing a foreign key\n** for which pTab is the parent table. An UPDATE statement against pTab\n** is currently being processed. For each column of the table that is \n** actually updated, the corresponding element in the aChange[] array\n** is zero or greater (if a column is unmodified the corresponding element\n** is set to -1). If the rowid column is modified by the UPDATE statement\n** the bChngRowid argument is non-zero.\n**\n** This function returns true if any of the columns that are part of the\n** parent key for FK constraint *p are modified.\n*/\nstatic int fkParentIsModified(\n  Table *pTab, \n  FKey *p, \n  int *aChange, \n  int bChngRowid\n){\n  int i;\n  for(i=0; i<p->nCol; i++){\n    char *zKey = p->aCol[i].zCol;\n    int iKey;\n    for(iKey=0; iKey<pTab->nCol; iKey++){\n      if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){\n        Column *pCol = &pTab->aCol[iKey];\n        if( zKey ){\n          if( 0==sqlite3StrICmp(pCol->zName, zKey) ) return 1;\n        }else if( pCol->colFlags & COLFLAG_PRIMKEY ){\n          return 1;\n        }\n      }\n    }\n  }\n  return 0;\n}\n\n/*\n** Return true if the parser passed as the first argument is being\n** used to code a trigger that is really a \"SET NULL\" action belonging\n** to trigger pFKey.\n*/\nstatic int isSetNullAction(Parse *pParse, FKey *pFKey){\n  Parse *pTop = sqlite3ParseToplevel(pParse);\n  if( pTop->pTriggerPrg ){\n    Trigger *p = pTop->pTriggerPrg->pTrigger;\n    if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull)\n     || (p==pFKey->apTrigger[1] && pFKey->aAction[1]==OE_SetNull)\n    ){\n      return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** This function is called when inserting, deleting or updating a row of\n** table pTab to generate VDBE code to perform foreign key constraint \n** processing for the operation.\n**\n** For a DELETE operation, parameter regOld is passed the index of the\n** first register in an array of (pTab->nCol+1) registers containing the\n** rowid of the row being deleted, followed by each of the column values\n** of the row being deleted, from left to right. Parameter regNew is passed\n** zero in this case.\n**\n** For an INSERT operation, regOld is passed zero and regNew is passed the\n** first register of an array of (pTab->nCol+1) registers containing the new\n** row data.\n**\n** For an UPDATE operation, this function is called twice. Once before\n** the original record is deleted from the table using the calling convention\n** described for DELETE. Then again after the original record is deleted\n** but before the new record is inserted using the INSERT convention. \n*/\nvoid sqlite3FkCheck(\n  Parse *pParse,                  /* Parse context */\n  Table *pTab,                    /* Row is being deleted from this table */ \n  int regOld,                     /* Previous row data is stored here */\n  int regNew,                     /* New row data is stored here */\n  int *aChange,                   /* Array indicating UPDATEd columns (or 0) */\n  int bChngRowid                  /* True if rowid is UPDATEd */\n){\n  sqlite3 *db = pParse->db;       /* Database handle */\n  FKey *pFKey;                    /* Used to iterate through FKs */\n  int iDb;                        /* Index of database containing pTab */\n  const char *zDb;                /* Name of database containing pTab */\n  int isIgnoreErrors = pParse->disableTriggers;\n\n  /* Exactly one of regOld and regNew should be non-zero. */\n  assert( (regOld==0)!=(regNew==0) );\n\n  /* If foreign-keys are disabled, this function is a no-op. */\n  if( (db->flags&SQLITE_ForeignKeys)==0 ) return;\n\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n  zDb = db->aDb[iDb].zDbSName;\n\n  /* Loop through all the foreign key constraints for which pTab is the\n  ** child table (the table that the foreign key definition is part of).  */\n  for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){\n    Table *pTo;                   /* Parent table of foreign key pFKey */\n    Index *pIdx = 0;              /* Index on key columns in pTo */\n    int *aiFree = 0;\n    int *aiCol;\n    int iCol;\n    int i;\n    int bIgnore = 0;\n\n    if( aChange \n     && sqlite3_stricmp(pTab->zName, pFKey->zTo)!=0\n     && fkChildIsModified(pTab, pFKey, aChange, bChngRowid)==0 \n    ){\n      continue;\n    }\n\n    /* Find the parent table of this foreign key. Also find a unique index \n    ** on the parent key columns in the parent table. If either of these \n    ** schema items cannot be located, set an error in pParse and return \n    ** early.  */\n    if( pParse->disableTriggers ){\n      pTo = sqlite3FindTable(db, pFKey->zTo, zDb);\n    }else{\n      pTo = sqlite3LocateTable(pParse, 0, pFKey->zTo, zDb);\n    }\n    if( !pTo || sqlite3FkLocateIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){\n      assert( isIgnoreErrors==0 || (regOld!=0 && regNew==0) );\n      if( !isIgnoreErrors || db->mallocFailed ) return;\n      if( pTo==0 ){\n        /* If isIgnoreErrors is true, then a table is being dropped. In this\n        ** case SQLite runs a \"DELETE FROM xxx\" on the table being dropped\n        ** before actually dropping it in order to check FK constraints.\n        ** If the parent table of an FK constraint on the current table is\n        ** missing, behave as if it is empty. i.e. decrement the relevant\n        ** FK counter for each row of the current table with non-NULL keys.\n        */\n        Vdbe *v = sqlite3GetVdbe(pParse);\n        int iJump = sqlite3VdbeCurrentAddr(v) + pFKey->nCol + 1;\n        for(i=0; i<pFKey->nCol; i++){\n          int iReg = pFKey->aCol[i].iFrom + regOld + 1;\n          sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iJump); VdbeCoverage(v);\n        }\n        sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, -1);\n      }\n      continue;\n    }\n    assert( pFKey->nCol==1 || (aiFree && pIdx) );\n\n    if( aiFree ){\n      aiCol = aiFree;\n    }else{\n      iCol = pFKey->aCol[0].iFrom;\n      aiCol = &iCol;\n    }\n    for(i=0; i<pFKey->nCol; i++){\n      if( aiCol[i]==pTab->iPKey ){\n        aiCol[i] = -1;\n      }\n      assert( pIdx==0 || pIdx->aiColumn[i]>=0 );\n#ifndef SQLITE_OMIT_AUTHORIZATION\n      /* Request permission to read the parent key columns. If the \n      ** authorization callback returns SQLITE_IGNORE, behave as if any\n      ** values read from the parent table are NULL. */\n      if( db->xAuth ){\n        int rcauth;\n        char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zName;\n        rcauth = sqlite3AuthReadCol(pParse, pTo->zName, zCol, iDb);\n        bIgnore = (rcauth==SQLITE_IGNORE);\n      }\n#endif\n    }\n\n    /* Take a shared-cache advisory read-lock on the parent table. Allocate \n    ** a cursor to use to search the unique index on the parent key columns \n    ** in the parent table.  */\n    sqlite3TableLock(pParse, iDb, pTo->tnum, 0, pTo->zName);\n    pParse->nTab++;\n\n    if( regOld!=0 ){\n      /* A row is being removed from the child table. Search for the parent.\n      ** If the parent does not exist, removing the child row resolves an \n      ** outstanding foreign key constraint violation. */\n      fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regOld, -1, bIgnore);\n    }\n    if( regNew!=0 && !isSetNullAction(pParse, pFKey) ){\n      /* A row is being added to the child table. If a parent row cannot\n      ** be found, adding the child row has violated the FK constraint. \n      **\n      ** If this operation is being performed as part of a trigger program\n      ** that is actually a \"SET NULL\" action belonging to this very \n      ** foreign key, then omit this scan altogether. As all child key\n      ** values are guaranteed to be NULL, it is not possible for adding\n      ** this row to cause an FK violation.  */\n      fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1, bIgnore);\n    }\n\n    sqlite3DbFree(db, aiFree);\n  }\n\n  /* Loop through all the foreign key constraints that refer to this table.\n  ** (the \"child\" constraints) */\n  for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){\n    Index *pIdx = 0;              /* Foreign key index for pFKey */\n    SrcList *pSrc;\n    int *aiCol = 0;\n\n    if( aChange && fkParentIsModified(pTab, pFKey, aChange, bChngRowid)==0 ){\n      continue;\n    }\n\n    if( !pFKey->isDeferred && !(db->flags & SQLITE_DeferFKs) \n     && !pParse->pToplevel && !pParse->isMultiWrite \n    ){\n      assert( regOld==0 && regNew!=0 );\n      /* Inserting a single row into a parent table cannot cause (or fix)\n      ** an immediate foreign key violation. So do nothing in this case.  */\n      continue;\n    }\n\n    if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){\n      if( !isIgnoreErrors || db->mallocFailed ) return;\n      continue;\n    }\n    assert( aiCol || pFKey->nCol==1 );\n\n    /* Create a SrcList structure containing the child table.  We need the\n    ** child table as a SrcList for sqlite3WhereBegin() */\n    pSrc = sqlite3SrcListAppend(db, 0, 0, 0);\n    if( pSrc ){\n      struct SrcList_item *pItem = pSrc->a;\n      pItem->pTab = pFKey->pFrom;\n      pItem->zName = pFKey->pFrom->zName;\n      pItem->pTab->nRef++;\n      pItem->iCursor = pParse->nTab++;\n  \n      if( regNew!=0 ){\n        fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);\n      }\n      if( regOld!=0 ){\n        int eAction = pFKey->aAction[aChange!=0];\n        fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);\n        /* If this is a deferred FK constraint, or a CASCADE or SET NULL\n        ** action applies, then any foreign key violations caused by\n        ** removing the parent key will be rectified by the action trigger.\n        ** So do not set the \"may-abort\" flag in this case.\n        **\n        ** Note 1: If the FK is declared \"ON UPDATE CASCADE\", then the\n        ** may-abort flag will eventually be set on this statement anyway\n        ** (when this function is called as part of processing the UPDATE\n        ** within the action trigger).\n        **\n        ** Note 2: At first glance it may seem like SQLite could simply omit\n        ** all OP_FkCounter related scans when either CASCADE or SET NULL\n        ** applies. The trouble starts if the CASCADE or SET NULL action \n        ** trigger causes other triggers or action rules attached to the \n        ** child table to fire. In these cases the fk constraint counters\n        ** might be set incorrectly if any OP_FkCounter related scans are \n        ** omitted.  */\n        if( !pFKey->isDeferred && eAction!=OE_Cascade && eAction!=OE_SetNull ){\n          sqlite3MayAbort(pParse);\n        }\n      }\n      pItem->zName = 0;\n      sqlite3SrcListDelete(db, pSrc);\n    }\n    sqlite3DbFree(db, aiCol);\n  }\n}\n\n#define COLUMN_MASK(x) (((x)>31) ? 0xffffffff : ((u32)1<<(x)))\n\n/*\n** This function is called before generating code to update or delete a \n** row contained in table pTab.\n*/\nu32 sqlite3FkOldmask(\n  Parse *pParse,                  /* Parse context */\n  Table *pTab                     /* Table being modified */\n){\n  u32 mask = 0;\n  if( pParse->db->flags&SQLITE_ForeignKeys ){\n    FKey *p;\n    int i;\n    for(p=pTab->pFKey; p; p=p->pNextFrom){\n      for(i=0; i<p->nCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom);\n    }\n    for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\n      Index *pIdx = 0;\n      sqlite3FkLocateIndex(pParse, pTab, p, &pIdx, 0);\n      if( pIdx ){\n        for(i=0; i<pIdx->nKeyCol; i++){\n          assert( pIdx->aiColumn[i]>=0 );\n          mask |= COLUMN_MASK(pIdx->aiColumn[i]);\n        }\n      }\n    }\n  }\n  return mask;\n}\n\n\n/*\n** This function is called before generating code to update or delete a \n** row contained in table pTab. If the operation is a DELETE, then\n** parameter aChange is passed a NULL value. For an UPDATE, aChange points\n** to an array of size N, where N is the number of columns in table pTab.\n** If the i'th column is not modified by the UPDATE, then the corresponding \n** entry in the aChange[] array is set to -1. If the column is modified,\n** the value is 0 or greater. Parameter chngRowid is set to true if the\n** UPDATE statement modifies the rowid fields of the table.\n**\n** If any foreign key processing will be required, this function returns\n** true. If there is no foreign key related processing, this function \n** returns false.\n*/\nint sqlite3FkRequired(\n  Parse *pParse,                  /* Parse context */\n  Table *pTab,                    /* Table being modified */\n  int *aChange,                   /* Non-NULL for UPDATE operations */\n  int chngRowid                   /* True for UPDATE that affects rowid */\n){\n  if( pParse->db->flags&SQLITE_ForeignKeys ){\n    if( !aChange ){\n      /* A DELETE operation. Foreign key processing is required if the \n      ** table in question is either the child or parent table for any \n      ** foreign key constraint.  */\n      return (sqlite3FkReferences(pTab) || pTab->pFKey);\n    }else{\n      /* This is an UPDATE. Foreign key processing is only required if the\n      ** operation modifies one or more child or parent key columns. */\n      FKey *p;\n\n      /* Check if any child key columns are being modified. */\n      for(p=pTab->pFKey; p; p=p->pNextFrom){\n        if( fkChildIsModified(pTab, p, aChange, chngRowid) ) return 1;\n      }\n\n      /* Check if any parent key columns are being modified. */\n      for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){\n        if( fkParentIsModified(pTab, p, aChange, chngRowid) ) return 1;\n      }\n    }\n  }\n  return 0;\n}\n\n/*\n** This function is called when an UPDATE or DELETE operation is being \n** compiled on table pTab, which is the parent table of foreign-key pFKey.\n** If the current operation is an UPDATE, then the pChanges parameter is\n** passed a pointer to the list of columns being modified. If it is a\n** DELETE, pChanges is passed a NULL pointer.\n**\n** It returns a pointer to a Trigger structure containing a trigger\n** equivalent to the ON UPDATE or ON DELETE action specified by pFKey.\n** If the action is \"NO ACTION\" or \"RESTRICT\", then a NULL pointer is\n** returned (these actions require no special handling by the triggers\n** sub-system, code for them is created by fkScanChildren()).\n**\n** For example, if pFKey is the foreign key and pTab is table \"p\" in \n** the following schema:\n**\n**   CREATE TABLE p(pk PRIMARY KEY);\n**   CREATE TABLE c(ck REFERENCES p ON DELETE CASCADE);\n**\n** then the returned trigger structure is equivalent to:\n**\n**   CREATE TRIGGER ... DELETE ON p BEGIN\n**     DELETE FROM c WHERE ck = old.pk;\n**   END;\n**\n** The returned pointer is cached as part of the foreign key object. It\n** is eventually freed along with the rest of the foreign key object by \n** sqlite3FkDelete().\n*/\nstatic Trigger *fkActionTrigger(\n  Parse *pParse,                  /* Parse context */\n  Table *pTab,                    /* Table being updated or deleted from */\n  FKey *pFKey,                    /* Foreign key to get action for */\n  ExprList *pChanges              /* Change-list for UPDATE, NULL for DELETE */\n){\n  sqlite3 *db = pParse->db;       /* Database handle */\n  int action;                     /* One of OE_None, OE_Cascade etc. */\n  Trigger *pTrigger;              /* Trigger definition to return */\n  int iAction = (pChanges!=0);    /* 1 for UPDATE, 0 for DELETE */\n\n  action = pFKey->aAction[iAction];\n  if( action==OE_Restrict && (db->flags & SQLITE_DeferFKs) ){\n    return 0;\n  }\n  pTrigger = pFKey->apTrigger[iAction];\n\n  if( action!=OE_None && !pTrigger ){\n    char const *zFrom;            /* Name of child table */\n    int nFrom;                    /* Length in bytes of zFrom */\n    Index *pIdx = 0;              /* Parent key index for this FK */\n    int *aiCol = 0;               /* child table cols -> parent key cols */\n    TriggerStep *pStep = 0;        /* First (only) step of trigger program */\n    Expr *pWhere = 0;             /* WHERE clause of trigger step */\n    ExprList *pList = 0;          /* Changes list if ON UPDATE CASCADE */\n    Select *pSelect = 0;          /* If RESTRICT, \"SELECT RAISE(...)\" */\n    int i;                        /* Iterator variable */\n    Expr *pWhen = 0;              /* WHEN clause for the trigger */\n\n    if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;\n    assert( aiCol || pFKey->nCol==1 );\n\n    for(i=0; i<pFKey->nCol; i++){\n      Token tOld = { \"old\", 3 };  /* Literal \"old\" token */\n      Token tNew = { \"new\", 3 };  /* Literal \"new\" token */\n      Token tFromCol;             /* Name of column in child table */\n      Token tToCol;               /* Name of column in parent table */\n      int iFromCol;               /* Idx of column in child table */\n      Expr *pEq;                  /* tFromCol = OLD.tToCol */\n\n      iFromCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;\n      assert( iFromCol>=0 );\n      assert( pIdx!=0 || (pTab->iPKey>=0 && pTab->iPKey<pTab->nCol) );\n      assert( pIdx==0 || pIdx->aiColumn[i]>=0 );\n      sqlite3TokenInit(&tToCol,\n                   pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zName);\n      sqlite3TokenInit(&tFromCol, pFKey->pFrom->aCol[iFromCol].zName);\n\n      /* Create the expression \"OLD.zToCol = zFromCol\". It is important\n      ** that the \"OLD.zToCol\" term is on the LHS of the = operator, so\n      ** that the affinity and collation sequence associated with the\n      ** parent table are used for the comparison. */\n      pEq = sqlite3PExpr(pParse, TK_EQ,\n          sqlite3PExpr(pParse, TK_DOT, \n            sqlite3ExprAlloc(db, TK_ID, &tOld, 0),\n            sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)\n          , 0),\n          sqlite3ExprAlloc(db, TK_ID, &tFromCol, 0)\n      , 0);\n      pWhere = sqlite3ExprAnd(db, pWhere, pEq);\n\n      /* For ON UPDATE, construct the next term of the WHEN clause.\n      ** The final WHEN clause will be like this:\n      **\n      **    WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN)\n      */\n      if( pChanges ){\n        pEq = sqlite3PExpr(pParse, TK_IS,\n            sqlite3PExpr(pParse, TK_DOT, \n              sqlite3ExprAlloc(db, TK_ID, &tOld, 0),\n              sqlite3ExprAlloc(db, TK_ID, &tToCol, 0),\n              0),\n            sqlite3PExpr(pParse, TK_DOT, \n              sqlite3ExprAlloc(db, TK_ID, &tNew, 0),\n              sqlite3ExprAlloc(db, TK_ID, &tToCol, 0),\n              0),\n            0);\n        pWhen = sqlite3ExprAnd(db, pWhen, pEq);\n      }\n  \n      if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){\n        Expr *pNew;\n        if( action==OE_Cascade ){\n          pNew = sqlite3PExpr(pParse, TK_DOT, \n            sqlite3ExprAlloc(db, TK_ID, &tNew, 0),\n            sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)\n          , 0);\n        }else if( action==OE_SetDflt ){\n          Expr *pDflt = pFKey->pFrom->aCol[iFromCol].pDflt;\n          if( pDflt ){\n            pNew = sqlite3ExprDup(db, pDflt, 0);\n          }else{\n            pNew = sqlite3ExprAlloc(db, TK_NULL, 0, 0);\n          }\n        }else{\n          pNew = sqlite3ExprAlloc(db, TK_NULL, 0, 0);\n        }\n        pList = sqlite3ExprListAppend(pParse, pList, pNew);\n        sqlite3ExprListSetName(pParse, pList, &tFromCol, 0);\n      }\n    }\n    sqlite3DbFree(db, aiCol);\n\n    zFrom = pFKey->pFrom->zName;\n    nFrom = sqlite3Strlen30(zFrom);\n\n    if( action==OE_Restrict ){\n      Token tFrom;\n      Expr *pRaise; \n\n      tFrom.z = zFrom;\n      tFrom.n = nFrom;\n      pRaise = sqlite3Expr(db, TK_RAISE, \"FOREIGN KEY constraint failed\");\n      if( pRaise ){\n        pRaise->affinity = OE_Abort;\n      }\n      pSelect = sqlite3SelectNew(pParse, \n          sqlite3ExprListAppend(pParse, 0, pRaise),\n          sqlite3SrcListAppend(db, 0, &tFrom, 0),\n          pWhere,\n          0, 0, 0, 0, 0, 0\n      );\n      pWhere = 0;\n    }\n\n    /* Disable lookaside memory allocation */\n    db->lookaside.bDisable++;\n\n    pTrigger = (Trigger *)sqlite3DbMallocZero(db, \n        sizeof(Trigger) +         /* struct Trigger */\n        sizeof(TriggerStep) +     /* Single step in trigger program */\n        nFrom + 1                 /* Space for pStep->zTarget */\n    );\n    if( pTrigger ){\n      pStep = pTrigger->step_list = (TriggerStep *)&pTrigger[1];\n      pStep->zTarget = (char *)&pStep[1];\n      memcpy((char *)pStep->zTarget, zFrom, nFrom);\n  \n      pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);\n      pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE);\n      pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);\n      if( pWhen ){\n        pWhen = sqlite3PExpr(pParse, TK_NOT, pWhen, 0, 0);\n        pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE);\n      }\n    }\n\n    /* Re-enable the lookaside buffer, if it was disabled earlier. */\n    db->lookaside.bDisable--;\n\n    sqlite3ExprDelete(db, pWhere);\n    sqlite3ExprDelete(db, pWhen);\n    sqlite3ExprListDelete(db, pList);\n    sqlite3SelectDelete(db, pSelect);\n    if( db->mallocFailed==1 ){\n      fkTriggerDelete(db, pTrigger);\n      return 0;\n    }\n    assert( pStep!=0 );\n\n    switch( action ){\n      case OE_Restrict:\n        pStep->op = TK_SELECT; \n        break;\n      case OE_Cascade: \n        if( !pChanges ){ \n          pStep->op = TK_DELETE; \n          break; \n        }\n      default:\n        pStep->op = TK_UPDATE;\n    }\n    pStep->pTrig = pTrigger;\n    pTrigger->pSchema = pTab->pSchema;\n    pTrigger->pTabSchema = pTab->pSchema;\n    pFKey->apTrigger[iAction] = pTrigger;\n    pTrigger->op = (pChanges ? TK_UPDATE : TK_DELETE);\n  }\n\n  return pTrigger;\n}\n\n/*\n** This function is called when deleting or updating a row to implement\n** any required CASCADE, SET NULL or SET DEFAULT actions.\n*/\nvoid sqlite3FkActions(\n  Parse *pParse,                  /* Parse context */\n  Table *pTab,                    /* Table being updated or deleted from */\n  ExprList *pChanges,             /* Change-list for UPDATE, NULL for DELETE */\n  int regOld,                     /* Address of array containing old row */\n  int *aChange,                   /* Array indicating UPDATEd columns (or 0) */\n  int bChngRowid                  /* True if rowid is UPDATEd */\n){\n  /* If foreign-key support is enabled, iterate through all FKs that \n  ** refer to table pTab. If there is an action associated with the FK \n  ** for this operation (either update or delete), invoke the associated \n  ** trigger sub-program.  */\n  if( pParse->db->flags&SQLITE_ForeignKeys ){\n    FKey *pFKey;                  /* Iterator variable */\n    for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){\n      if( aChange==0 || fkParentIsModified(pTab, pFKey, aChange, bChngRowid) ){\n        Trigger *pAct = fkActionTrigger(pParse, pTab, pFKey, pChanges);\n        if( pAct ){\n          sqlite3CodeRowTriggerDirect(pParse, pAct, pTab, regOld, OE_Abort, 0);\n        }\n      }\n    }\n  }\n}\n\n#endif /* ifndef SQLITE_OMIT_TRIGGER */\n\n/*\n** Free all memory associated with foreign key definitions attached to\n** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash\n** hash table.\n*/\nvoid sqlite3FkDelete(sqlite3 *db, Table *pTab){\n  FKey *pFKey;                    /* Iterator variable */\n  FKey *pNext;                    /* Copy of pFKey->pNextFrom */\n\n  assert( db==0 || IsVirtual(pTab)\n         || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );\n  for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){\n\n    /* Remove the FK from the fkeyHash hash table. */\n    if( !db || db->pnBytesFreed==0 ){\n      if( pFKey->pPrevTo ){\n        pFKey->pPrevTo->pNextTo = pFKey->pNextTo;\n      }else{\n        void *p = (void *)pFKey->pNextTo;\n        const char *z = (p ? pFKey->pNextTo->zTo : pFKey->zTo);\n        sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p);\n      }\n      if( pFKey->pNextTo ){\n        pFKey->pNextTo->pPrevTo = pFKey->pPrevTo;\n      }\n    }\n\n    /* EV: R-30323-21917 Each foreign key constraint in SQLite is\n    ** classified as either immediate or deferred.\n    */\n    assert( pFKey->isDeferred==0 || pFKey->isDeferred==1 );\n\n    /* Delete any triggers created to implement actions for this FK. */\n#ifndef SQLITE_OMIT_TRIGGER\n    fkTriggerDelete(db, pFKey->apTrigger[0]);\n    fkTriggerDelete(db, pFKey->apTrigger[1]);\n#endif\n\n    pNext = pFKey->pNextFrom;\n    sqlite3DbFree(db, pFKey);\n  }\n}\n#endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/func.c",
    "content": "/*\n** 2002 February 23\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the C-language implementations for many of the SQL\n** functions of SQLite.  (Some function, and in particular the date and\n** time functions, are implemented separately.)\n*/\n#include \"sqliteInt.h\"\n#include <stdlib.h>\n#include <assert.h>\n#include \"vdbeInt.h\"\n\n/*\n** Return the collating function associated with a function.\n*/\nstatic CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){\n  VdbeOp *pOp;\n  assert( context->pVdbe!=0 );\n  pOp = &context->pVdbe->aOp[context->iOp-1];\n  assert( pOp->opcode==OP_CollSeq );\n  assert( pOp->p4type==P4_COLLSEQ );\n  return pOp->p4.pColl;\n}\n\n/*\n** Indicate that the accumulator load should be skipped on this\n** iteration of the aggregate loop.\n*/\nstatic void sqlite3SkipAccumulatorLoad(sqlite3_context *context){\n  context->skipFlag = 1;\n}\n\n/*\n** Implementation of the non-aggregate min() and max() functions\n*/\nstatic void minmaxFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  int i;\n  int mask;    /* 0 for min() or 0xffffffff for max() */\n  int iBest;\n  CollSeq *pColl;\n\n  assert( argc>1 );\n  mask = sqlite3_user_data(context)==0 ? 0 : -1;\n  pColl = sqlite3GetFuncCollSeq(context);\n  assert( pColl );\n  assert( mask==-1 || mask==0 );\n  iBest = 0;\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;\n  for(i=1; i<argc; i++){\n    if( sqlite3_value_type(argv[i])==SQLITE_NULL ) return;\n    if( (sqlite3MemCompare(argv[iBest], argv[i], pColl)^mask)>=0 ){\n      testcase( mask==0 );\n      iBest = i;\n    }\n  }\n  sqlite3_result_value(context, argv[iBest]);\n}\n\n/*\n** Return the type of the argument.\n*/\nstatic void typeofFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **argv\n){\n  const char *z = 0;\n  UNUSED_PARAMETER(NotUsed);\n  switch( sqlite3_value_type(argv[0]) ){\n    case SQLITE_INTEGER: z = \"integer\"; break;\n    case SQLITE_TEXT:    z = \"text\";    break;\n    case SQLITE_FLOAT:   z = \"real\";    break;\n    case SQLITE_BLOB:    z = \"blob\";    break;\n    default:             z = \"null\";    break;\n  }\n  sqlite3_result_text(context, z, -1, SQLITE_STATIC);\n}\n\n\n/*\n** Implementation of the length() function\n*/\nstatic void lengthFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  int len;\n\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  switch( sqlite3_value_type(argv[0]) ){\n    case SQLITE_BLOB:\n    case SQLITE_INTEGER:\n    case SQLITE_FLOAT: {\n      sqlite3_result_int(context, sqlite3_value_bytes(argv[0]));\n      break;\n    }\n    case SQLITE_TEXT: {\n      const unsigned char *z = sqlite3_value_text(argv[0]);\n      if( z==0 ) return;\n      len = 0;\n      while( *z ){\n        len++;\n        SQLITE_SKIP_UTF8(z);\n      }\n      sqlite3_result_int(context, len);\n      break;\n    }\n    default: {\n      sqlite3_result_null(context);\n      break;\n    }\n  }\n}\n\n/*\n** Implementation of the abs() function.\n**\n** IMP: R-23979-26855 The abs(X) function returns the absolute value of\n** the numeric argument X. \n*/\nstatic void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  switch( sqlite3_value_type(argv[0]) ){\n    case SQLITE_INTEGER: {\n      i64 iVal = sqlite3_value_int64(argv[0]);\n      if( iVal<0 ){\n        if( iVal==SMALLEST_INT64 ){\n          /* IMP: R-31676-45509 If X is the integer -9223372036854775808\n          ** then abs(X) throws an integer overflow error since there is no\n          ** equivalent positive 64-bit two complement value. */\n          sqlite3_result_error(context, \"integer overflow\", -1);\n          return;\n        }\n        iVal = -iVal;\n      } \n      sqlite3_result_int64(context, iVal);\n      break;\n    }\n    case SQLITE_NULL: {\n      /* IMP: R-37434-19929 Abs(X) returns NULL if X is NULL. */\n      sqlite3_result_null(context);\n      break;\n    }\n    default: {\n      /* Because sqlite3_value_double() returns 0.0 if the argument is not\n      ** something that can be converted into a number, we have:\n      ** IMP: R-01992-00519 Abs(X) returns 0.0 if X is a string or blob\n      ** that cannot be converted to a numeric value.\n      */\n      double rVal = sqlite3_value_double(argv[0]);\n      if( rVal<0 ) rVal = -rVal;\n      sqlite3_result_double(context, rVal);\n      break;\n    }\n  }\n}\n\n/*\n** Implementation of the instr() function.\n**\n** instr(haystack,needle) finds the first occurrence of needle\n** in haystack and returns the number of previous characters plus 1,\n** or 0 if needle does not occur within haystack.\n**\n** If both haystack and needle are BLOBs, then the result is one more than\n** the number of bytes in haystack prior to the first occurrence of needle,\n** or 0 if needle never occurs in haystack.\n*/\nstatic void instrFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const unsigned char *zHaystack;\n  const unsigned char *zNeedle;\n  int nHaystack;\n  int nNeedle;\n  int typeHaystack, typeNeedle;\n  int N = 1;\n  int isText;\n\n  UNUSED_PARAMETER(argc);\n  typeHaystack = sqlite3_value_type(argv[0]);\n  typeNeedle = sqlite3_value_type(argv[1]);\n  if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return;\n  nHaystack = sqlite3_value_bytes(argv[0]);\n  nNeedle = sqlite3_value_bytes(argv[1]);\n  if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){\n    zHaystack = sqlite3_value_blob(argv[0]);\n    zNeedle = sqlite3_value_blob(argv[1]);\n    isText = 0;\n  }else{\n    zHaystack = sqlite3_value_text(argv[0]);\n    zNeedle = sqlite3_value_text(argv[1]);\n    isText = 1;\n    if( zNeedle==0 ) return;\n    assert( zHaystack );\n  }\n  while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){\n    N++;\n    do{\n      nHaystack--;\n      zHaystack++;\n    }while( isText && (zHaystack[0]&0xc0)==0x80 );\n  }\n  if( nNeedle>nHaystack ) N = 0;\n  sqlite3_result_int(context, N);\n}\n\n/*\n** Implementation of the printf() function.\n*/\nstatic void printfFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  PrintfArguments x;\n  StrAccum str;\n  const char *zFormat;\n  int n;\n  sqlite3 *db = sqlite3_context_db_handle(context);\n\n  if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){\n    x.nArg = argc-1;\n    x.nUsed = 0;\n    x.apArg = argv+1;\n    sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);\n    str.printfFlags = SQLITE_PRINTF_SQLFUNC;\n    sqlite3XPrintf(&str, zFormat, &x);\n    n = str.nChar;\n    sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n,\n                        SQLITE_DYNAMIC);\n  }\n}\n\n/*\n** Implementation of the substr() function.\n**\n** substr(x,p1,p2)  returns p2 characters of x[] beginning with p1.\n** p1 is 1-indexed.  So substr(x,1,1) returns the first character\n** of x.  If x is text, then we actually count UTF-8 characters.\n** If x is a blob, then we count bytes.\n**\n** If p1 is negative, then we begin abs(p1) from the end of x[].\n**\n** If p2 is negative, return the p2 characters preceding p1.\n*/\nstatic void substrFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const unsigned char *z;\n  const unsigned char *z2;\n  int len;\n  int p0type;\n  i64 p1, p2;\n  int negP2 = 0;\n\n  assert( argc==3 || argc==2 );\n  if( sqlite3_value_type(argv[1])==SQLITE_NULL\n   || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL)\n  ){\n    return;\n  }\n  p0type = sqlite3_value_type(argv[0]);\n  p1 = sqlite3_value_int(argv[1]);\n  if( p0type==SQLITE_BLOB ){\n    len = sqlite3_value_bytes(argv[0]);\n    z = sqlite3_value_blob(argv[0]);\n    if( z==0 ) return;\n    assert( len==sqlite3_value_bytes(argv[0]) );\n  }else{\n    z = sqlite3_value_text(argv[0]);\n    if( z==0 ) return;\n    len = 0;\n    if( p1<0 ){\n      for(z2=z; *z2; len++){\n        SQLITE_SKIP_UTF8(z2);\n      }\n    }\n  }\n#ifdef SQLITE_SUBSTR_COMPATIBILITY\n  /* If SUBSTR_COMPATIBILITY is defined then substr(X,0,N) work the same as\n  ** as substr(X,1,N) - it returns the first N characters of X.  This\n  ** is essentially a back-out of the bug-fix in check-in [5fc125d362df4b8]\n  ** from 2009-02-02 for compatibility of applications that exploited the\n  ** old buggy behavior. */\n  if( p1==0 ) p1 = 1; /* <rdar://problem/6778339> */\n#endif\n  if( argc==3 ){\n    p2 = sqlite3_value_int(argv[2]);\n    if( p2<0 ){\n      p2 = -p2;\n      negP2 = 1;\n    }\n  }else{\n    p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH];\n  }\n  if( p1<0 ){\n    p1 += len;\n    if( p1<0 ){\n      p2 += p1;\n      if( p2<0 ) p2 = 0;\n      p1 = 0;\n    }\n  }else if( p1>0 ){\n    p1--;\n  }else if( p2>0 ){\n    p2--;\n  }\n  if( negP2 ){\n    p1 -= p2;\n    if( p1<0 ){\n      p2 += p1;\n      p1 = 0;\n    }\n  }\n  assert( p1>=0 && p2>=0 );\n  if( p0type!=SQLITE_BLOB ){\n    while( *z && p1 ){\n      SQLITE_SKIP_UTF8(z);\n      p1--;\n    }\n    for(z2=z; *z2 && p2; p2--){\n      SQLITE_SKIP_UTF8(z2);\n    }\n    sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT,\n                          SQLITE_UTF8);\n  }else{\n    if( p1+p2>len ){\n      p2 = len-p1;\n      if( p2<0 ) p2 = 0;\n    }\n    sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT);\n  }\n}\n\n/*\n** Implementation of the round() function\n*/\n#ifndef SQLITE_OMIT_FLOATING_POINT\nstatic void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\n  int n = 0;\n  double r;\n  char *zBuf;\n  assert( argc==1 || argc==2 );\n  if( argc==2 ){\n    if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;\n    n = sqlite3_value_int(argv[1]);\n    if( n>30 ) n = 30;\n    if( n<0 ) n = 0;\n  }\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;\n  r = sqlite3_value_double(argv[0]);\n  /* If Y==0 and X will fit in a 64-bit int,\n  ** handle the rounding directly,\n  ** otherwise use printf.\n  */\n  if( n==0 && r>=0 && r<LARGEST_INT64-1 ){\n    r = (double)((sqlite_int64)(r+0.5));\n  }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){\n    r = -(double)((sqlite_int64)((-r)+0.5));\n  }else{\n    zBuf = sqlite3_mprintf(\"%.*f\",n,r);\n    if( zBuf==0 ){\n      sqlite3_result_error_nomem(context);\n      return;\n    }\n    sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);\n    sqlite3_free(zBuf);\n  }\n  sqlite3_result_double(context, r);\n}\n#endif\n\n/*\n** Allocate nByte bytes of space using sqlite3Malloc(). If the\n** allocation fails, call sqlite3_result_error_nomem() to notify\n** the database handle that malloc() has failed and return NULL.\n** If nByte is larger than the maximum string or blob length, then\n** raise an SQLITE_TOOBIG exception and return NULL.\n*/\nstatic void *contextMalloc(sqlite3_context *context, i64 nByte){\n  char *z;\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  assert( nByte>0 );\n  testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH] );\n  testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH]+1 );\n  if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    sqlite3_result_error_toobig(context);\n    z = 0;\n  }else{\n    z = sqlite3Malloc(nByte);\n    if( !z ){\n      sqlite3_result_error_nomem(context);\n    }\n  }\n  return z;\n}\n\n/*\n** Implementation of the upper() and lower() SQL functions.\n*/\nstatic void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\n  char *z1;\n  const char *z2;\n  int i, n;\n  UNUSED_PARAMETER(argc);\n  z2 = (char*)sqlite3_value_text(argv[0]);\n  n = sqlite3_value_bytes(argv[0]);\n  /* Verify that the call to _bytes() does not invalidate the _text() pointer */\n  assert( z2==(char*)sqlite3_value_text(argv[0]) );\n  if( z2 ){\n    z1 = contextMalloc(context, ((i64)n)+1);\n    if( z1 ){\n      for(i=0; i<n; i++){\n        z1[i] = (char)sqlite3Toupper(z2[i]);\n      }\n      sqlite3_result_text(context, z1, n, sqlite3_free);\n    }\n  }\n}\nstatic void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\n  char *z1;\n  const char *z2;\n  int i, n;\n  UNUSED_PARAMETER(argc);\n  z2 = (char*)sqlite3_value_text(argv[0]);\n  n = sqlite3_value_bytes(argv[0]);\n  /* Verify that the call to _bytes() does not invalidate the _text() pointer */\n  assert( z2==(char*)sqlite3_value_text(argv[0]) );\n  if( z2 ){\n    z1 = contextMalloc(context, ((i64)n)+1);\n    if( z1 ){\n      for(i=0; i<n; i++){\n        z1[i] = sqlite3Tolower(z2[i]);\n      }\n      sqlite3_result_text(context, z1, n, sqlite3_free);\n    }\n  }\n}\n\n/*\n** Some functions like COALESCE() and IFNULL() and UNLIKELY() are implemented\n** as VDBE code so that unused argument values do not have to be computed.\n** However, we still need some kind of function implementation for this\n** routines in the function table.  The noopFunc macro provides this.\n** noopFunc will never be called so it doesn't matter what the implementation\n** is.  We might as well use the \"version()\" function as a substitute.\n*/\n#define noopFunc versionFunc   /* Substitute function - never called */\n\n/*\n** Implementation of random().  Return a random integer.  \n*/\nstatic void randomFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  sqlite_int64 r;\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  sqlite3_randomness(sizeof(r), &r);\n  if( r<0 ){\n    /* We need to prevent a random number of 0x8000000000000000 \n    ** (or -9223372036854775808) since when you do abs() of that\n    ** number of you get the same value back again.  To do this\n    ** in a way that is testable, mask the sign bit off of negative\n    ** values, resulting in a positive value.  Then take the \n    ** 2s complement of that positive value.  The end result can\n    ** therefore be no less than -9223372036854775807.\n    */\n    r = -(r & LARGEST_INT64);\n  }\n  sqlite3_result_int64(context, r);\n}\n\n/*\n** Implementation of randomblob(N).  Return a random blob\n** that is N bytes long.\n*/\nstatic void randomBlob(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  int n;\n  unsigned char *p;\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  n = sqlite3_value_int(argv[0]);\n  if( n<1 ){\n    n = 1;\n  }\n  p = contextMalloc(context, n);\n  if( p ){\n    sqlite3_randomness(n, p);\n    sqlite3_result_blob(context, (char*)p, n, sqlite3_free);\n  }\n}\n\n/*\n** Implementation of the last_insert_rowid() SQL function.  The return\n** value is the same as the sqlite3_last_insert_rowid() API function.\n*/\nstatic void last_insert_rowid(\n  sqlite3_context *context, \n  int NotUsed, \n  sqlite3_value **NotUsed2\n){\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  /* IMP: R-51513-12026 The last_insert_rowid() SQL function is a\n  ** wrapper around the sqlite3_last_insert_rowid() C/C++ interface\n  ** function. */\n  sqlite3_result_int64(context, sqlite3_last_insert_rowid(db));\n}\n\n/*\n** Implementation of the changes() SQL function.\n**\n** IMP: R-62073-11209 The changes() SQL function is a wrapper\n** around the sqlite3_changes() C/C++ function and hence follows the same\n** rules for counting changes.\n*/\nstatic void changes(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  sqlite3_result_int(context, sqlite3_changes(db));\n}\n\n/*\n** Implementation of the total_changes() SQL function.  The return value is\n** the same as the sqlite3_total_changes() API function.\n*/\nstatic void total_changes(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  /* IMP: R-52756-41993 This function is a wrapper around the\n  ** sqlite3_total_changes() C/C++ interface. */\n  sqlite3_result_int(context, sqlite3_total_changes(db));\n}\n\n/*\n** A structure defining how to do GLOB-style comparisons.\n*/\nstruct compareInfo {\n  u8 matchAll;          /* \"*\" or \"%\" */\n  u8 matchOne;          /* \"?\" or \"_\" */\n  u8 matchSet;          /* \"[\" or 0 */\n  u8 noCase;            /* true to ignore case differences */\n};\n\n/*\n** For LIKE and GLOB matching on EBCDIC machines, assume that every\n** character is exactly one byte in size.  Also, provde the Utf8Read()\n** macro for fast reading of the next character in the common case where\n** the next character is ASCII.\n*/\n#if defined(SQLITE_EBCDIC)\n# define sqlite3Utf8Read(A)        (*((*A)++))\n# define Utf8Read(A)               (*(A++))\n#else\n# define Utf8Read(A)               (A[0]<0x80?*(A++):sqlite3Utf8Read(&A))\n#endif\n\nstatic const struct compareInfo globInfo = { '*', '?', '[', 0 };\n/* The correct SQL-92 behavior is for the LIKE operator to ignore\n** case.  Thus  'a' LIKE 'A' would be true. */\nstatic const struct compareInfo likeInfoNorm = { '%', '_',   0, 1 };\n/* If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator\n** is case sensitive causing 'a' LIKE 'A' to be false */\nstatic const struct compareInfo likeInfoAlt = { '%', '_',   0, 0 };\n\n/*\n** Compare two UTF-8 strings for equality where the first string can\n** potentially be a \"glob\" or \"like\" expression.  Return true (1) if they\n** are the same and false (0) if they are different.\n**\n** Globbing rules:\n**\n**      '*'       Matches any sequence of zero or more characters.\n**\n**      '?'       Matches exactly one character.\n**\n**     [...]      Matches one character from the enclosed list of\n**                characters.\n**\n**     [^...]     Matches one character not in the enclosed list.\n**\n** With the [...] and [^...] matching, a ']' character can be included\n** in the list by making it the first character after '[' or '^'.  A\n** range of characters can be specified using '-'.  Example:\n** \"[a-z]\" matches any single lower-case letter.  To match a '-', make\n** it the last character in the list.\n**\n** Like matching rules:\n** \n**      '%'       Matches any sequence of zero or more characters\n**\n***     '_'       Matches any one character\n**\n**      Ec        Where E is the \"esc\" character and c is any other\n**                character, including '%', '_', and esc, match exactly c.\n**\n** The comments within this routine usually assume glob matching.\n**\n** This routine is usually quick, but can be N**2 in the worst case.\n*/\nstatic int patternCompare(\n  const u8 *zPattern,              /* The glob pattern */\n  const u8 *zString,               /* The string to compare against the glob */\n  const struct compareInfo *pInfo, /* Information about how to do the compare */\n  u32 matchOther                   /* The escape char (LIKE) or '[' (GLOB) */\n){\n  u32 c, c2;                       /* Next pattern and input string chars */\n  u32 matchOne = pInfo->matchOne;  /* \"?\" or \"_\" */\n  u32 matchAll = pInfo->matchAll;  /* \"*\" or \"%\" */\n  u8 noCase = pInfo->noCase;       /* True if uppercase==lowercase */\n  const u8 *zEscaped = 0;          /* One past the last escaped input char */\n  \n  while( (c = Utf8Read(zPattern))!=0 ){\n    if( c==matchAll ){  /* Match \"*\" */\n      /* Skip over multiple \"*\" characters in the pattern.  If there\n      ** are also \"?\" characters, skip those as well, but consume a\n      ** single character of the input string for each \"?\" skipped */\n      while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){\n        if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){\n          return 0;\n        }\n      }\n      if( c==0 ){\n        return 1;   /* \"*\" at the end of the pattern matches */\n      }else if( c==matchOther ){\n        if( pInfo->matchSet==0 ){\n          c = sqlite3Utf8Read(&zPattern);\n          if( c==0 ) return 0;\n        }else{\n          /* \"[...]\" immediately follows the \"*\".  We have to do a slow\n          ** recursive search in this case, but it is an unusual case. */\n          assert( matchOther<0x80 );  /* '[' is a single-byte character */\n          while( *zString\n                 && patternCompare(&zPattern[-1],zString,pInfo,matchOther)==0 ){\n            SQLITE_SKIP_UTF8(zString);\n          }\n          return *zString!=0;\n        }\n      }\n\n      /* At this point variable c contains the first character of the\n      ** pattern string past the \"*\".  Search in the input string for the\n      ** first matching character and recursively contine the match from\n      ** that point.\n      **\n      ** For a case-insensitive search, set variable cx to be the same as\n      ** c but in the other case and search the input string for either\n      ** c or cx.\n      */\n      if( c<=0x80 ){\n        u32 cx;\n        if( noCase ){\n          cx = sqlite3Toupper(c);\n          c = sqlite3Tolower(c);\n        }else{\n          cx = c;\n        }\n        while( (c2 = *(zString++))!=0 ){\n          if( c2!=c && c2!=cx ) continue;\n          if( patternCompare(zPattern,zString,pInfo,matchOther) ) return 1;\n        }\n      }else{\n        while( (c2 = Utf8Read(zString))!=0 ){\n          if( c2!=c ) continue;\n          if( patternCompare(zPattern,zString,pInfo,matchOther) ) return 1;\n        }\n      }\n      return 0;\n    }\n    if( c==matchOther ){\n      if( pInfo->matchSet==0 ){\n        c = sqlite3Utf8Read(&zPattern);\n        if( c==0 ) return 0;\n        zEscaped = zPattern;\n      }else{\n        u32 prior_c = 0;\n        int seen = 0;\n        int invert = 0;\n        c = sqlite3Utf8Read(&zString);\n        if( c==0 ) return 0;\n        c2 = sqlite3Utf8Read(&zPattern);\n        if( c2=='^' ){\n          invert = 1;\n          c2 = sqlite3Utf8Read(&zPattern);\n        }\n        if( c2==']' ){\n          if( c==']' ) seen = 1;\n          c2 = sqlite3Utf8Read(&zPattern);\n        }\n        while( c2 && c2!=']' ){\n          if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){\n            c2 = sqlite3Utf8Read(&zPattern);\n            if( c>=prior_c && c<=c2 ) seen = 1;\n            prior_c = 0;\n          }else{\n            if( c==c2 ){\n              seen = 1;\n            }\n            prior_c = c2;\n          }\n          c2 = sqlite3Utf8Read(&zPattern);\n        }\n        if( c2==0 || (seen ^ invert)==0 ){\n          return 0;\n        }\n        continue;\n      }\n    }\n    c2 = Utf8Read(zString);\n    if( c==c2 ) continue;\n    if( noCase  && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){\n      continue;\n    }\n    if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;\n    return 0;\n  }\n  return *zString==0;\n}\n\n/*\n** The sqlite3_strglob() interface.\n*/\nint sqlite3_strglob(const char *zGlobPattern, const char *zString){\n  return patternCompare((u8*)zGlobPattern, (u8*)zString, &globInfo, '[')==0;\n}\n\n/*\n** The sqlite3_strlike() interface.\n*/\nint sqlite3_strlike(const char *zPattern, const char *zStr, unsigned int esc){\n  return patternCompare((u8*)zPattern, (u8*)zStr, &likeInfoNorm, esc)==0;\n}\n\n/*\n** Count the number of times that the LIKE operator (or GLOB which is\n** just a variation of LIKE) gets called.  This is used for testing\n** only.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_like_count = 0;\n#endif\n\n\n/*\n** Implementation of the like() SQL function.  This function implements\n** the build-in LIKE operator.  The first argument to the function is the\n** pattern and the second argument is the string.  So, the SQL statements:\n**\n**       A LIKE B\n**\n** is implemented as like(B,A).\n**\n** This same function (with a different compareInfo structure) computes\n** the GLOB operator.\n*/\nstatic void likeFunc(\n  sqlite3_context *context, \n  int argc, \n  sqlite3_value **argv\n){\n  const unsigned char *zA, *zB;\n  u32 escape;\n  int nPat;\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  struct compareInfo *pInfo = sqlite3_user_data(context);\n\n#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n  if( sqlite3_value_type(argv[0])==SQLITE_BLOB\n   || sqlite3_value_type(argv[1])==SQLITE_BLOB\n  ){\n#ifdef SQLITE_TEST\n    sqlite3_like_count++;\n#endif\n    sqlite3_result_int(context, 0);\n    return;\n  }\n#endif\n  zB = sqlite3_value_text(argv[0]);\n  zA = sqlite3_value_text(argv[1]);\n\n  /* Limit the length of the LIKE or GLOB pattern to avoid problems\n  ** of deep recursion and N*N behavior in patternCompare().\n  */\n  nPat = sqlite3_value_bytes(argv[0]);\n  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] );\n  testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 );\n  if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){\n    sqlite3_result_error(context, \"LIKE or GLOB pattern too complex\", -1);\n    return;\n  }\n  assert( zB==sqlite3_value_text(argv[0]) );  /* Encoding did not change */\n\n  if( argc==3 ){\n    /* The escape character string must consist of a single UTF-8 character.\n    ** Otherwise, return an error.\n    */\n    const unsigned char *zEsc = sqlite3_value_text(argv[2]);\n    if( zEsc==0 ) return;\n    if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){\n      sqlite3_result_error(context, \n          \"ESCAPE expression must be a single character\", -1);\n      return;\n    }\n    escape = sqlite3Utf8Read(&zEsc);\n  }else{\n    escape = pInfo->matchSet;\n  }\n  if( zA && zB ){\n#ifdef SQLITE_TEST\n    sqlite3_like_count++;\n#endif\n    sqlite3_result_int(context, patternCompare(zB, zA, pInfo, escape));\n  }\n}\n\n/*\n** Implementation of the NULLIF(x,y) function.  The result is the first\n** argument if the arguments are different.  The result is NULL if the\n** arguments are equal to each other.\n*/\nstatic void nullifFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **argv\n){\n  CollSeq *pColl = sqlite3GetFuncCollSeq(context);\n  UNUSED_PARAMETER(NotUsed);\n  if( sqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){\n    sqlite3_result_value(context, argv[0]);\n  }\n}\n\n/*\n** Implementation of the sqlite_version() function.  The result is the version\n** of the SQLite library that is running.\n*/\nstatic void versionFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  /* IMP: R-48699-48617 This function is an SQL wrapper around the\n  ** sqlite3_libversion() C-interface. */\n  sqlite3_result_text(context, sqlite3_libversion(), -1, SQLITE_STATIC);\n}\n\n/*\n** Implementation of the sqlite_source_id() function. The result is a string\n** that identifies the particular version of the source code used to build\n** SQLite.\n*/\nstatic void sourceidFunc(\n  sqlite3_context *context,\n  int NotUsed,\n  sqlite3_value **NotUsed2\n){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  /* IMP: R-24470-31136 This function is an SQL wrapper around the\n  ** sqlite3_sourceid() C interface. */\n  sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC);\n}\n\n/*\n** Implementation of the sqlite_log() function.  This is a wrapper around\n** sqlite3_log().  The return value is NULL.  The function exists purely for\n** its side-effects.\n*/\nstatic void errlogFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  UNUSED_PARAMETER(argc);\n  UNUSED_PARAMETER(context);\n  sqlite3_log(sqlite3_value_int(argv[0]), \"%s\", sqlite3_value_text(argv[1]));\n}\n\n/*\n** Implementation of the sqlite_compileoption_used() function.\n** The result is an integer that identifies if the compiler option\n** was used to build SQLite.\n*/\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\nstatic void compileoptionusedFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const char *zOptName;\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL\n  ** function is a wrapper around the sqlite3_compileoption_used() C/C++\n  ** function.\n  */\n  if( (zOptName = (const char*)sqlite3_value_text(argv[0]))!=0 ){\n    sqlite3_result_int(context, sqlite3_compileoption_used(zOptName));\n  }\n}\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\n\n/*\n** Implementation of the sqlite_compileoption_get() function. \n** The result is a string that identifies the compiler options \n** used to build SQLite.\n*/\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\nstatic void compileoptiongetFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  int n;\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function\n  ** is a wrapper around the sqlite3_compileoption_get() C/C++ function.\n  */\n  n = sqlite3_value_int(argv[0]);\n  sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC);\n}\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\n\n/* Array for converting from half-bytes (nybbles) into ASCII hex\n** digits. */\nstatic const char hexdigits[] = {\n  '0', '1', '2', '3', '4', '5', '6', '7',\n  '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' \n};\n\n/*\n** Implementation of the QUOTE() function.  This function takes a single\n** argument.  If the argument is numeric, the return value is the same as\n** the argument.  If the argument is NULL, the return value is the string\n** \"NULL\".  Otherwise, the argument is enclosed in single quotes with\n** single-quote escapes.\n*/\nstatic void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  switch( sqlite3_value_type(argv[0]) ){\n    case SQLITE_FLOAT: {\n      double r1, r2;\n      char zBuf[50];\n      r1 = sqlite3_value_double(argv[0]);\n      sqlite3_snprintf(sizeof(zBuf), zBuf, \"%!.15g\", r1);\n      sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8);\n      if( r1!=r2 ){\n        sqlite3_snprintf(sizeof(zBuf), zBuf, \"%!.20e\", r1);\n      }\n      sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);\n      break;\n    }\n    case SQLITE_INTEGER: {\n      sqlite3_result_value(context, argv[0]);\n      break;\n    }\n    case SQLITE_BLOB: {\n      char *zText = 0;\n      char const *zBlob = sqlite3_value_blob(argv[0]);\n      int nBlob = sqlite3_value_bytes(argv[0]);\n      assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */\n      zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4); \n      if( zText ){\n        int i;\n        for(i=0; i<nBlob; i++){\n          zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F];\n          zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F];\n        }\n        zText[(nBlob*2)+2] = '\\'';\n        zText[(nBlob*2)+3] = '\\0';\n        zText[0] = 'X';\n        zText[1] = '\\'';\n        sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);\n        sqlite3_free(zText);\n      }\n      break;\n    }\n    case SQLITE_TEXT: {\n      int i,j;\n      u64 n;\n      const unsigned char *zArg = sqlite3_value_text(argv[0]);\n      char *z;\n\n      if( zArg==0 ) return;\n      for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\\'' ) n++; }\n      z = contextMalloc(context, ((i64)i)+((i64)n)+3);\n      if( z ){\n        z[0] = '\\'';\n        for(i=0, j=1; zArg[i]; i++){\n          z[j++] = zArg[i];\n          if( zArg[i]=='\\'' ){\n            z[j++] = '\\'';\n          }\n        }\n        z[j++] = '\\'';\n        z[j] = 0;\n        sqlite3_result_text(context, z, j, sqlite3_free);\n      }\n      break;\n    }\n    default: {\n      assert( sqlite3_value_type(argv[0])==SQLITE_NULL );\n      sqlite3_result_text(context, \"NULL\", 4, SQLITE_STATIC);\n      break;\n    }\n  }\n}\n\n/*\n** The unicode() function.  Return the integer unicode code-point value\n** for the first character of the input string. \n*/\nstatic void unicodeFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const unsigned char *z = sqlite3_value_text(argv[0]);\n  (void)argc;\n  if( z && z[0] ) sqlite3_result_int(context, sqlite3Utf8Read(&z));\n}\n\n/*\n** The char() function takes zero or more arguments, each of which is\n** an integer.  It constructs a string where each character of the string\n** is the unicode character for the corresponding integer argument.\n*/\nstatic void charFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  unsigned char *z, *zOut;\n  int i;\n  zOut = z = sqlite3_malloc64( argc*4+1 );\n  if( z==0 ){\n    sqlite3_result_error_nomem(context);\n    return;\n  }\n  for(i=0; i<argc; i++){\n    sqlite3_int64 x;\n    unsigned c;\n    x = sqlite3_value_int64(argv[i]);\n    if( x<0 || x>0x10ffff ) x = 0xfffd;\n    c = (unsigned)(x & 0x1fffff);\n    if( c<0x00080 ){\n      *zOut++ = (u8)(c&0xFF);\n    }else if( c<0x00800 ){\n      *zOut++ = 0xC0 + (u8)((c>>6)&0x1F);\n      *zOut++ = 0x80 + (u8)(c & 0x3F);\n    }else if( c<0x10000 ){\n      *zOut++ = 0xE0 + (u8)((c>>12)&0x0F);\n      *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);\n      *zOut++ = 0x80 + (u8)(c & 0x3F);\n    }else{\n      *zOut++ = 0xF0 + (u8)((c>>18) & 0x07);\n      *zOut++ = 0x80 + (u8)((c>>12) & 0x3F);\n      *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);\n      *zOut++ = 0x80 + (u8)(c & 0x3F);\n    }                                                    \\\n  }\n  sqlite3_result_text64(context, (char*)z, zOut-z, sqlite3_free, SQLITE_UTF8);\n}\n\n/*\n** The hex() function.  Interpret the argument as a blob.  Return\n** a hexadecimal rendering as text.\n*/\nstatic void hexFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  int i, n;\n  const unsigned char *pBlob;\n  char *zHex, *z;\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  pBlob = sqlite3_value_blob(argv[0]);\n  n = sqlite3_value_bytes(argv[0]);\n  assert( pBlob==sqlite3_value_blob(argv[0]) );  /* No encoding change */\n  z = zHex = contextMalloc(context, ((i64)n)*2 + 1);\n  if( zHex ){\n    for(i=0; i<n; i++, pBlob++){\n      unsigned char c = *pBlob;\n      *(z++) = hexdigits[(c>>4)&0xf];\n      *(z++) = hexdigits[c&0xf];\n    }\n    *z = 0;\n    sqlite3_result_text(context, zHex, n*2, sqlite3_free);\n  }\n}\n\n/*\n** The zeroblob(N) function returns a zero-filled blob of size N bytes.\n*/\nstatic void zeroblobFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  i64 n;\n  int rc;\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  n = sqlite3_value_int64(argv[0]);\n  if( n<0 ) n = 0;\n  rc = sqlite3_result_zeroblob64(context, n); /* IMP: R-00293-64994 */\n  if( rc ){\n    sqlite3_result_error_code(context, rc);\n  }\n}\n\n/*\n** The replace() function.  Three arguments are all strings: call\n** them A, B, and C. The result is also a string which is derived\n** from A by replacing every occurrence of B with C.  The match\n** must be exact.  Collating sequences are not used.\n*/\nstatic void replaceFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const unsigned char *zStr;        /* The input string A */\n  const unsigned char *zPattern;    /* The pattern string B */\n  const unsigned char *zRep;        /* The replacement string C */\n  unsigned char *zOut;              /* The output */\n  int nStr;                /* Size of zStr */\n  int nPattern;            /* Size of zPattern */\n  int nRep;                /* Size of zRep */\n  i64 nOut;                /* Maximum size of zOut */\n  int loopLimit;           /* Last zStr[] that might match zPattern[] */\n  int i, j;                /* Loop counters */\n\n  assert( argc==3 );\n  UNUSED_PARAMETER(argc);\n  zStr = sqlite3_value_text(argv[0]);\n  if( zStr==0 ) return;\n  nStr = sqlite3_value_bytes(argv[0]);\n  assert( zStr==sqlite3_value_text(argv[0]) );  /* No encoding change */\n  zPattern = sqlite3_value_text(argv[1]);\n  if( zPattern==0 ){\n    assert( sqlite3_value_type(argv[1])==SQLITE_NULL\n            || sqlite3_context_db_handle(context)->mallocFailed );\n    return;\n  }\n  if( zPattern[0]==0 ){\n    assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );\n    sqlite3_result_value(context, argv[0]);\n    return;\n  }\n  nPattern = sqlite3_value_bytes(argv[1]);\n  assert( zPattern==sqlite3_value_text(argv[1]) );  /* No encoding change */\n  zRep = sqlite3_value_text(argv[2]);\n  if( zRep==0 ) return;\n  nRep = sqlite3_value_bytes(argv[2]);\n  assert( zRep==sqlite3_value_text(argv[2]) );\n  nOut = nStr + 1;\n  assert( nOut<SQLITE_MAX_LENGTH );\n  zOut = contextMalloc(context, (i64)nOut);\n  if( zOut==0 ){\n    return;\n  }\n  loopLimit = nStr - nPattern;  \n  for(i=j=0; i<=loopLimit; i++){\n    if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){\n      zOut[j++] = zStr[i];\n    }else{\n      u8 *zOld;\n      sqlite3 *db = sqlite3_context_db_handle(context);\n      nOut += nRep - nPattern;\n      testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );\n      testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );\n      if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){\n        sqlite3_result_error_toobig(context);\n        sqlite3_free(zOut);\n        return;\n      }\n      zOld = zOut;\n      zOut = sqlite3_realloc64(zOut, (int)nOut);\n      if( zOut==0 ){\n        sqlite3_result_error_nomem(context);\n        sqlite3_free(zOld);\n        return;\n      }\n      memcpy(&zOut[j], zRep, nRep);\n      j += nRep;\n      i += nPattern-1;\n    }\n  }\n  assert( j+nStr-i+1==nOut );\n  memcpy(&zOut[j], &zStr[i], nStr-i);\n  j += nStr - i;\n  assert( j<=nOut );\n  zOut[j] = 0;\n  sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);\n}\n\n/*\n** Implementation of the TRIM(), LTRIM(), and RTRIM() functions.\n** The userdata is 0x1 for left trim, 0x2 for right trim, 0x3 for both.\n*/\nstatic void trimFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const unsigned char *zIn;         /* Input string */\n  const unsigned char *zCharSet;    /* Set of characters to trim */\n  int nIn;                          /* Number of bytes in input */\n  int flags;                        /* 1: trimleft  2: trimright  3: trim */\n  int i;                            /* Loop counter */\n  unsigned char *aLen = 0;          /* Length of each character in zCharSet */\n  unsigned char **azChar = 0;       /* Individual characters in zCharSet */\n  int nChar;                        /* Number of characters in zCharSet */\n\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ){\n    return;\n  }\n  zIn = sqlite3_value_text(argv[0]);\n  if( zIn==0 ) return;\n  nIn = sqlite3_value_bytes(argv[0]);\n  assert( zIn==sqlite3_value_text(argv[0]) );\n  if( argc==1 ){\n    static const unsigned char lenOne[] = { 1 };\n    static unsigned char * const azOne[] = { (u8*)\" \" };\n    nChar = 1;\n    aLen = (u8*)lenOne;\n    azChar = (unsigned char **)azOne;\n    zCharSet = 0;\n  }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){\n    return;\n  }else{\n    const unsigned char *z;\n    for(z=zCharSet, nChar=0; *z; nChar++){\n      SQLITE_SKIP_UTF8(z);\n    }\n    if( nChar>0 ){\n      azChar = contextMalloc(context, ((i64)nChar)*(sizeof(char*)+1));\n      if( azChar==0 ){\n        return;\n      }\n      aLen = (unsigned char*)&azChar[nChar];\n      for(z=zCharSet, nChar=0; *z; nChar++){\n        azChar[nChar] = (unsigned char *)z;\n        SQLITE_SKIP_UTF8(z);\n        aLen[nChar] = (u8)(z - azChar[nChar]);\n      }\n    }\n  }\n  if( nChar>0 ){\n    flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context));\n    if( flags & 1 ){\n      while( nIn>0 ){\n        int len = 0;\n        for(i=0; i<nChar; i++){\n          len = aLen[i];\n          if( len<=nIn && memcmp(zIn, azChar[i], len)==0 ) break;\n        }\n        if( i>=nChar ) break;\n        zIn += len;\n        nIn -= len;\n      }\n    }\n    if( flags & 2 ){\n      while( nIn>0 ){\n        int len = 0;\n        for(i=0; i<nChar; i++){\n          len = aLen[i];\n          if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break;\n        }\n        if( i>=nChar ) break;\n        nIn -= len;\n      }\n    }\n    if( zCharSet ){\n      sqlite3_free(azChar);\n    }\n  }\n  sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT);\n}\n\n\n#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION\n/*\n** The \"unknown\" function is automatically substituted in place of\n** any unrecognized function name when doing an EXPLAIN or EXPLAIN QUERY PLAN\n** when the SQLITE_ENABLE_UNKNOWN_FUNCTION compile-time option is used.\n** When the \"sqlite3\" command-line shell is built using this functionality,\n** that allows an EXPLAIN or EXPLAIN QUERY PLAN for complex queries\n** involving application-defined functions to be examined in a generic\n** sqlite3 shell.\n*/\nstatic void unknownFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  /* no-op */\n}\n#endif /*SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION*/\n\n\n/* IMP: R-25361-16150 This function is omitted from SQLite by default. It\n** is only available if the SQLITE_SOUNDEX compile-time option is used\n** when SQLite is built.\n*/\n#ifdef SQLITE_SOUNDEX\n/*\n** Compute the soundex encoding of a word.\n**\n** IMP: R-59782-00072 The soundex(X) function returns a string that is the\n** soundex encoding of the string X. \n*/\nstatic void soundexFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  char zResult[8];\n  const u8 *zIn;\n  int i, j;\n  static const unsigned char iCode[] = {\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,\n    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,\n    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,\n    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,\n  };\n  assert( argc==1 );\n  zIn = (u8*)sqlite3_value_text(argv[0]);\n  if( zIn==0 ) zIn = (u8*)\"\";\n  for(i=0; zIn[i] && !sqlite3Isalpha(zIn[i]); i++){}\n  if( zIn[i] ){\n    u8 prevcode = iCode[zIn[i]&0x7f];\n    zResult[0] = sqlite3Toupper(zIn[i]);\n    for(j=1; j<4 && zIn[i]; i++){\n      int code = iCode[zIn[i]&0x7f];\n      if( code>0 ){\n        if( code!=prevcode ){\n          prevcode = code;\n          zResult[j++] = code + '0';\n        }\n      }else{\n        prevcode = 0;\n      }\n    }\n    while( j<4 ){\n      zResult[j++] = '0';\n    }\n    zResult[j] = 0;\n    sqlite3_result_text(context, zResult, 4, SQLITE_TRANSIENT);\n  }else{\n    /* IMP: R-64894-50321 The string \"?000\" is returned if the argument\n    ** is NULL or contains no ASCII alphabetic characters. */\n    sqlite3_result_text(context, \"?000\", 4, SQLITE_STATIC);\n  }\n}\n#endif /* SQLITE_SOUNDEX */\n\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\n/*\n** A function that loads a shared-library extension then returns NULL.\n*/\nstatic void loadExt(sqlite3_context *context, int argc, sqlite3_value **argv){\n  const char *zFile = (const char *)sqlite3_value_text(argv[0]);\n  const char *zProc;\n  sqlite3 *db = sqlite3_context_db_handle(context);\n  char *zErrMsg = 0;\n\n  /* Disallow the load_extension() SQL function unless the SQLITE_LoadExtFunc\n  ** flag is set.  See the sqlite3_enable_load_extension() API.\n  */\n  if( (db->flags & SQLITE_LoadExtFunc)==0 ){\n    sqlite3_result_error(context, \"not authorized\", -1);\n    return;\n  }\n\n  if( argc==2 ){\n    zProc = (const char *)sqlite3_value_text(argv[1]);\n  }else{\n    zProc = 0;\n  }\n  if( zFile && sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){\n    sqlite3_result_error(context, zErrMsg, -1);\n    sqlite3_free(zErrMsg);\n  }\n}\n#endif\n\n\n/*\n** An instance of the following structure holds the context of a\n** sum() or avg() aggregate computation.\n*/\ntypedef struct SumCtx SumCtx;\nstruct SumCtx {\n  double rSum;      /* Floating point sum */\n  i64 iSum;         /* Integer sum */   \n  i64 cnt;          /* Number of elements summed */\n  u8 overflow;      /* True if integer overflow seen */\n  u8 approx;        /* True if non-integer value was input to the sum */\n};\n\n/*\n** Routines used to compute the sum, average, and total.\n**\n** The SUM() function follows the (broken) SQL standard which means\n** that it returns NULL if it sums over no inputs.  TOTAL returns\n** 0.0 in that case.  In addition, TOTAL always returns a float where\n** SUM might return an integer if it never encounters a floating point\n** value.  TOTAL never fails, but SUM might through an exception if\n** it overflows an integer.\n*/\nstatic void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){\n  SumCtx *p;\n  int type;\n  assert( argc==1 );\n  UNUSED_PARAMETER(argc);\n  p = sqlite3_aggregate_context(context, sizeof(*p));\n  type = sqlite3_value_numeric_type(argv[0]);\n  if( p && type!=SQLITE_NULL ){\n    p->cnt++;\n    if( type==SQLITE_INTEGER ){\n      i64 v = sqlite3_value_int64(argv[0]);\n      p->rSum += v;\n      if( (p->approx|p->overflow)==0 && sqlite3AddInt64(&p->iSum, v) ){\n        p->overflow = 1;\n      }\n    }else{\n      p->rSum += sqlite3_value_double(argv[0]);\n      p->approx = 1;\n    }\n  }\n}\nstatic void sumFinalize(sqlite3_context *context){\n  SumCtx *p;\n  p = sqlite3_aggregate_context(context, 0);\n  if( p && p->cnt>0 ){\n    if( p->overflow ){\n      sqlite3_result_error(context,\"integer overflow\",-1);\n    }else if( p->approx ){\n      sqlite3_result_double(context, p->rSum);\n    }else{\n      sqlite3_result_int64(context, p->iSum);\n    }\n  }\n}\nstatic void avgFinalize(sqlite3_context *context){\n  SumCtx *p;\n  p = sqlite3_aggregate_context(context, 0);\n  if( p && p->cnt>0 ){\n    sqlite3_result_double(context, p->rSum/(double)p->cnt);\n  }\n}\nstatic void totalFinalize(sqlite3_context *context){\n  SumCtx *p;\n  p = sqlite3_aggregate_context(context, 0);\n  /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\n  sqlite3_result_double(context, p ? p->rSum : (double)0);\n}\n\n/*\n** The following structure keeps track of state information for the\n** count() aggregate function.\n*/\ntypedef struct CountCtx CountCtx;\nstruct CountCtx {\n  i64 n;\n};\n\n/*\n** Routines to implement the count() aggregate function.\n*/\nstatic void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){\n  CountCtx *p;\n  p = sqlite3_aggregate_context(context, sizeof(*p));\n  if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){\n    p->n++;\n  }\n\n#ifndef SQLITE_OMIT_DEPRECATED\n  /* The sqlite3_aggregate_count() function is deprecated.  But just to make\n  ** sure it still operates correctly, verify that its count agrees with our \n  ** internal count when using count(*) and when the total count can be\n  ** expressed as a 32-bit integer. */\n  assert( argc==1 || p==0 || p->n>0x7fffffff\n          || p->n==sqlite3_aggregate_count(context) );\n#endif\n}   \nstatic void countFinalize(sqlite3_context *context){\n  CountCtx *p;\n  p = sqlite3_aggregate_context(context, 0);\n  sqlite3_result_int64(context, p ? p->n : 0);\n}\n\n/*\n** Routines to implement min() and max() aggregate functions.\n*/\nstatic void minmaxStep(\n  sqlite3_context *context, \n  int NotUsed, \n  sqlite3_value **argv\n){\n  Mem *pArg  = (Mem *)argv[0];\n  Mem *pBest;\n  UNUSED_PARAMETER(NotUsed);\n\n  pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));\n  if( !pBest ) return;\n\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ){\n    if( pBest->flags ) sqlite3SkipAccumulatorLoad(context);\n  }else if( pBest->flags ){\n    int max;\n    int cmp;\n    CollSeq *pColl = sqlite3GetFuncCollSeq(context);\n    /* This step function is used for both the min() and max() aggregates,\n    ** the only difference between the two being that the sense of the\n    ** comparison is inverted. For the max() aggregate, the\n    ** sqlite3_user_data() function returns (void *)-1. For min() it\n    ** returns (void *)db, where db is the sqlite3* database pointer.\n    ** Therefore the next statement sets variable 'max' to 1 for the max()\n    ** aggregate, or 0 for min().\n    */\n    max = sqlite3_user_data(context)!=0;\n    cmp = sqlite3MemCompare(pBest, pArg, pColl);\n    if( (max && cmp<0) || (!max && cmp>0) ){\n      sqlite3VdbeMemCopy(pBest, pArg);\n    }else{\n      sqlite3SkipAccumulatorLoad(context);\n    }\n  }else{\n    pBest->db = sqlite3_context_db_handle(context);\n    sqlite3VdbeMemCopy(pBest, pArg);\n  }\n}\nstatic void minMaxFinalize(sqlite3_context *context){\n  sqlite3_value *pRes;\n  pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0);\n  if( pRes ){\n    if( pRes->flags ){\n      sqlite3_result_value(context, pRes);\n    }\n    sqlite3VdbeMemRelease(pRes);\n  }\n}\n\n/*\n** group_concat(EXPR, ?SEPARATOR?)\n*/\nstatic void groupConcatStep(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const char *zVal;\n  StrAccum *pAccum;\n  const char *zSep;\n  int nVal, nSep;\n  assert( argc==1 || argc==2 );\n  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;\n  pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum));\n\n  if( pAccum ){\n    sqlite3 *db = sqlite3_context_db_handle(context);\n    int firstTerm = pAccum->mxAlloc==0;\n    pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH];\n    if( !firstTerm ){\n      if( argc==2 ){\n        zSep = (char*)sqlite3_value_text(argv[1]);\n        nSep = sqlite3_value_bytes(argv[1]);\n      }else{\n        zSep = \",\";\n        nSep = 1;\n      }\n      if( nSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep);\n    }\n    zVal = (char*)sqlite3_value_text(argv[0]);\n    nVal = sqlite3_value_bytes(argv[0]);\n    if( zVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal);\n  }\n}\nstatic void groupConcatFinalize(sqlite3_context *context){\n  StrAccum *pAccum;\n  pAccum = sqlite3_aggregate_context(context, 0);\n  if( pAccum ){\n    if( pAccum->accError==STRACCUM_TOOBIG ){\n      sqlite3_result_error_toobig(context);\n    }else if( pAccum->accError==STRACCUM_NOMEM ){\n      sqlite3_result_error_nomem(context);\n    }else{    \n      sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, \n                          sqlite3_free);\n    }\n  }\n}\n\n/*\n** This routine does per-connection function registration.  Most\n** of the built-in functions above are part of the global function set.\n** This routine only deals with those that are not global.\n*/\nvoid sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3 *db){\n  int rc = sqlite3_overload_function(db, \"MATCH\", 2);\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n#ifndef OMIT_EXPORT\n  extern void sqlcipher_exportFunc(sqlite3_context *, int, sqlite3_value **);\n#endif\n#endif\n/* END SQLCIPHER */\n  assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );\n  if( rc==SQLITE_NOMEM ){\n    sqlite3OomFault(db);\n  }\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n#ifndef OMIT_EXPORT\n  sqlite3CreateFunc(db, \"sqlcipher_export\", 1, SQLITE_TEXT, 0, sqlcipher_exportFunc, 0, 0, 0);\n  sqlite3CreateFunc(db, \"sqlcipher_export\", 2, SQLITE_TEXT, 0, sqlcipher_exportFunc, 0, 0, 0);\n#endif\n#endif\n/* END SQLCIPHER */\n}\n\n/*\n** Set the LIKEOPT flag on the 2-argument function with the given name.\n*/\nstatic void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){\n  FuncDef *pDef;\n  pDef = sqlite3FindFunction(db, zName, 2, SQLITE_UTF8, 0);\n  if( ALWAYS(pDef) ){\n    pDef->funcFlags |= flagVal;\n  }\n}\n\n/*\n** Register the built-in LIKE and GLOB functions.  The caseSensitive\n** parameter determines whether or not the LIKE operator is case\n** sensitive.  GLOB is always case sensitive.\n*/\nvoid sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){\n  struct compareInfo *pInfo;\n  if( caseSensitive ){\n    pInfo = (struct compareInfo*)&likeInfoAlt;\n  }else{\n    pInfo = (struct compareInfo*)&likeInfoNorm;\n  }\n  sqlite3CreateFunc(db, \"like\", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0);\n  sqlite3CreateFunc(db, \"like\", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0);\n  sqlite3CreateFunc(db, \"glob\", 2, SQLITE_UTF8, \n      (struct compareInfo*)&globInfo, likeFunc, 0, 0, 0);\n  setLikeOptFlag(db, \"glob\", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE);\n  setLikeOptFlag(db, \"like\", \n      caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);\n}\n\n/*\n** pExpr points to an expression which implements a function.  If\n** it is appropriate to apply the LIKE optimization to that function\n** then set aWc[0] through aWc[2] to the wildcard characters and\n** return TRUE.  If the function is not a LIKE-style function then\n** return FALSE.\n**\n** *pIsNocase is set to true if uppercase and lowercase are equivalent for\n** the function (default for LIKE).  If the function makes the distinction\n** between uppercase and lowercase (as does GLOB) then *pIsNocase is set to\n** false.\n*/\nint sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){\n  FuncDef *pDef;\n  if( pExpr->op!=TK_FUNCTION \n   || !pExpr->x.pList \n   || pExpr->x.pList->nExpr!=2\n  ){\n    return 0;\n  }\n  assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\n  pDef = sqlite3FindFunction(db, pExpr->u.zToken, 2, SQLITE_UTF8, 0);\n  if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){\n    return 0;\n  }\n\n  /* The memcpy() statement assumes that the wildcard characters are\n  ** the first three statements in the compareInfo structure.  The\n  ** asserts() that follow verify that assumption\n  */\n  memcpy(aWc, pDef->pUserData, 3);\n  assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll );\n  assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne );\n  assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet );\n  *pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;\n  return 1;\n}\n\n/*\n** All of the FuncDef structures in the aBuiltinFunc[] array above\n** to the global function hash table.  This occurs at start-time (as\n** a consequence of calling sqlite3_initialize()).\n**\n** After this routine runs\n*/\nvoid sqlite3RegisterBuiltinFunctions(void){\n  /*\n  ** The following array holds FuncDef structures for all of the functions\n  ** defined in this file.\n  **\n  ** The array cannot be constant since changes are made to the\n  ** FuncDef.pHash elements at start-time.  The elements of this array\n  ** are read-only after initialization is complete.\n  **\n  ** For peak efficiency, put the most frequently used function last.\n  */\n  static FuncDef aBuiltinFunc[] = {\n#ifdef SQLITE_SOUNDEX\n    FUNCTION(soundex,            1, 0, 0, soundexFunc      ),\n#endif\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\n    VFUNCTION(load_extension,    1, 0, 0, loadExt          ),\n    VFUNCTION(load_extension,    2, 0, 0, loadExt          ),\n#endif\n#if SQLITE_USER_AUTHENTICATION\n    FUNCTION(sqlite_crypt,       2, 0, 0, sqlite3CryptFunc ),\n#endif\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\n    DFUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc  ),\n    DFUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc  ),\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\n    FUNCTION2(unlikely,          1, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),\n    FUNCTION2(likelihood,        2, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),\n    FUNCTION2(likely,            1, 0, 0, noopFunc,  SQLITE_FUNC_UNLIKELY),\n    FUNCTION(ltrim,              1, 1, 0, trimFunc         ),\n    FUNCTION(ltrim,              2, 1, 0, trimFunc         ),\n    FUNCTION(rtrim,              1, 2, 0, trimFunc         ),\n    FUNCTION(rtrim,              2, 2, 0, trimFunc         ),\n    FUNCTION(trim,               1, 3, 0, trimFunc         ),\n    FUNCTION(trim,               2, 3, 0, trimFunc         ),\n    FUNCTION(min,               -1, 0, 1, minmaxFunc       ),\n    FUNCTION(min,                0, 0, 1, 0                ),\n    AGGREGATE2(min,              1, 0, 1, minmaxStep,      minMaxFinalize,\n                                          SQLITE_FUNC_MINMAX ),\n    FUNCTION(max,               -1, 1, 1, minmaxFunc       ),\n    FUNCTION(max,                0, 1, 1, 0                ),\n    AGGREGATE2(max,              1, 1, 1, minmaxStep,      minMaxFinalize,\n                                          SQLITE_FUNC_MINMAX ),\n    FUNCTION2(typeof,            1, 0, 0, typeofFunc,  SQLITE_FUNC_TYPEOF),\n    FUNCTION2(length,            1, 0, 0, lengthFunc,  SQLITE_FUNC_LENGTH),\n    FUNCTION(instr,              2, 0, 0, instrFunc        ),\n    FUNCTION(printf,            -1, 0, 0, printfFunc       ),\n    FUNCTION(unicode,            1, 0, 0, unicodeFunc      ),\n    FUNCTION(char,              -1, 0, 0, charFunc         ),\n    FUNCTION(abs,                1, 0, 0, absFunc          ),\n#ifndef SQLITE_OMIT_FLOATING_POINT\n    FUNCTION(round,              1, 0, 0, roundFunc        ),\n    FUNCTION(round,              2, 0, 0, roundFunc        ),\n#endif\n    FUNCTION(upper,              1, 0, 0, upperFunc        ),\n    FUNCTION(lower,              1, 0, 0, lowerFunc        ),\n    FUNCTION(hex,                1, 0, 0, hexFunc          ),\n    FUNCTION2(ifnull,            2, 0, 0, noopFunc,  SQLITE_FUNC_COALESCE),\n    VFUNCTION(random,            0, 0, 0, randomFunc       ),\n    VFUNCTION(randomblob,        1, 0, 0, randomBlob       ),\n    FUNCTION(nullif,             2, 0, 1, nullifFunc       ),\n    DFUNCTION(sqlite_version,    0, 0, 0, versionFunc      ),\n    DFUNCTION(sqlite_source_id,  0, 0, 0, sourceidFunc     ),\n    FUNCTION(sqlite_log,         2, 0, 0, errlogFunc       ),\n    FUNCTION(quote,              1, 0, 0, quoteFunc        ),\n    VFUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),\n    VFUNCTION(changes,           0, 0, 0, changes          ),\n    VFUNCTION(total_changes,     0, 0, 0, total_changes    ),\n    FUNCTION(replace,            3, 0, 0, replaceFunc      ),\n    FUNCTION(zeroblob,           1, 0, 0, zeroblobFunc     ),\n    FUNCTION(substr,             2, 0, 0, substrFunc       ),\n    FUNCTION(substr,             3, 0, 0, substrFunc       ),\n    AGGREGATE(sum,               1, 0, 0, sumStep,         sumFinalize    ),\n    AGGREGATE(total,             1, 0, 0, sumStep,         totalFinalize    ),\n    AGGREGATE(avg,               1, 0, 0, sumStep,         avgFinalize    ),\n    AGGREGATE2(count,            0, 0, 0, countStep,       countFinalize,\n               SQLITE_FUNC_COUNT  ),\n    AGGREGATE(count,             1, 0, 0, countStep,       countFinalize  ),\n    AGGREGATE(group_concat,      1, 0, 0, groupConcatStep, groupConcatFinalize),\n    AGGREGATE(group_concat,      2, 0, 0, groupConcatStep, groupConcatFinalize),\n  \n    LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE),\n#ifdef SQLITE_CASE_SENSITIVE_LIKE\n    LIKEFUNC(like, 2, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE),\n    LIKEFUNC(like, 3, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE),\n#else\n    LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE),\n    LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),\n#endif\n#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION\n    FUNCTION(unknown,           -1, 0, 0, unknownFunc      ),\n#endif\n    FUNCTION(coalesce,           1, 0, 0, 0                ),\n    FUNCTION(coalesce,           0, 0, 0, 0                ),\n    FUNCTION2(coalesce,         -1, 0, 0, noopFunc,  SQLITE_FUNC_COALESCE),\n  };\n#ifndef SQLITE_OMIT_ALTERTABLE\n  sqlite3AlterFunctions();\n#endif\n#if defined(SQLITE_ENABLE_STAT3) || defined(SQLITE_ENABLE_STAT4)\n  sqlite3AnalyzeFunctions();\n#endif\n  sqlite3RegisterDateTimeFunctions();\n  sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc));\n\n#if 0  /* Enable to print out how the built-in functions are hashed */\n  {\n    int i;\n    FuncDef *p;\n    for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){\n      printf(\"FUNC-HASH %02d:\", i);\n      for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash){\n        int n = sqlite3Strlen30(p->zName);\n        int h = p->zName[0] + n;\n        printf(\" %s(%d)\", p->zName, h);\n      }\n      printf(\"\\n\");\n    }\n  }\n#endif\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/global.c",
    "content": "/*\n** 2008 June 13\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains definitions of global variables and constants.\n*/\n#include \"sqliteInt.h\"\n\n/* An array to map all upper-case characters into their corresponding\n** lower-case character. \n**\n** SQLite only considers US-ASCII (or EBCDIC) characters.  We do not\n** handle case conversions for the UTF character set since the tables\n** involved are nearly as big or bigger than SQLite itself.\n*/\nconst unsigned char sqlite3UpperToLower[] = {\n#ifdef SQLITE_ASCII\n      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,\n     18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,\n     36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,\n     54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99,100,101,102,103,\n    104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,\n    122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,\n    108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,\n    126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,\n    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,\n    162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,\n    180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,\n    198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,\n    216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,\n    234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,\n    252,253,254,255\n#endif\n#ifdef SQLITE_EBCDIC\n      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, /* 0x */\n     16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 1x */\n     32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 2x */\n     48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 3x */\n     64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 4x */\n     80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 5x */\n     96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111, /* 6x */\n    112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, /* 7x */\n    128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, /* 8x */\n    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, /* 9x */\n    160,161,162,163,164,165,166,167,168,169,170,171,140,141,142,175, /* Ax */\n    176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, /* Bx */\n    192,129,130,131,132,133,134,135,136,137,202,203,204,205,206,207, /* Cx */\n    208,145,146,147,148,149,150,151,152,153,218,219,220,221,222,223, /* Dx */\n    224,225,162,163,164,165,166,167,168,169,234,235,236,237,238,239, /* Ex */\n    240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, /* Fx */\n#endif\n};\n\n/*\n** The following 256 byte lookup table is used to support SQLites built-in\n** equivalents to the following standard library functions:\n**\n**   isspace()                        0x01\n**   isalpha()                        0x02\n**   isdigit()                        0x04\n**   isalnum()                        0x06\n**   isxdigit()                       0x08\n**   toupper()                        0x20\n**   SQLite identifier character      0x40\n**   Quote character                  0x80\n**\n** Bit 0x20 is set if the mapped character requires translation to upper\n** case. i.e. if the character is a lower-case ASCII character.\n** If x is a lower-case ASCII character, then its upper-case equivalent\n** is (x - 0x20). Therefore toupper() can be implemented as:\n**\n**   (x & ~(map[x]&0x20))\n**\n** The equivalent of tolower() is implemented using the sqlite3UpperToLower[]\n** array. tolower() is used more often than toupper() by SQLite.\n**\n** Bit 0x40 is set if the character is non-alphanumeric and can be used in an \n** SQLite identifier.  Identifiers are alphanumerics, \"_\", \"$\", and any\n** non-ASCII UTF character. Hence the test for whether or not a character is\n** part of an identifier is 0x46.\n*/\n#ifdef SQLITE_ASCII\nconst unsigned char sqlite3CtypeMap[256] = {\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 00..07    ........ */\n  0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,  /* 08..0f    ........ */\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 10..17    ........ */\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 18..1f    ........ */\n  0x01, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x80,  /* 20..27     !\"#$%&' */\n  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 28..2f    ()*+,-./ */\n  0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,  /* 30..37    01234567 */\n  0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 38..3f    89:;<=>? */\n\n  0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02,  /* 40..47    @ABCDEFG */\n  0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  /* 48..4f    HIJKLMNO */\n  0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,  /* 50..57    PQRSTUVW */\n  0x02, 0x02, 0x02, 0x80, 0x00, 0x00, 0x00, 0x40,  /* 58..5f    XYZ[\\]^_ */\n  0x80, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22,  /* 60..67    `abcdefg */\n  0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,  /* 68..6f    hijklmno */\n  0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,  /* 70..77    pqrstuvw */\n  0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 78..7f    xyz{|}~. */\n\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 80..87    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 88..8f    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 90..97    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* 98..9f    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* a0..a7    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* a8..af    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* b0..b7    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* b8..bf    ........ */\n\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* c0..c7    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* c8..cf    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* d0..d7    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* d8..df    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* e0..e7    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* e8..ef    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,  /* f0..f7    ........ */\n  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40   /* f8..ff    ........ */\n};\n#endif\n\n/* EVIDENCE-OF: R-02982-34736 In order to maintain full backwards\n** compatibility for legacy applications, the URI filename capability is\n** disabled by default.\n**\n** EVIDENCE-OF: R-38799-08373 URI filenames can be enabled or disabled\n** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.\n**\n** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally\n** disabled. The default value may be changed by compiling with the\n** SQLITE_USE_URI symbol defined.\n*/\n#ifndef SQLITE_USE_URI\n# define  SQLITE_USE_URI 0\n#endif\n\n/* EVIDENCE-OF: R-38720-18127 The default setting is determined by the\n** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is \"on\" if\n** that compile-time option is omitted.\n*/\n#ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN\n# define SQLITE_ALLOW_COVERING_INDEX_SCAN 1\n#endif\n\n/* The minimum PMA size is set to this value multiplied by the database\n** page size in bytes.\n*/\n#ifndef SQLITE_SORTER_PMASZ\n# define SQLITE_SORTER_PMASZ 250\n#endif\n\n/* Statement journals spill to disk when their size exceeds the following\n** threshold (in bytes). 0 means that statement journals are created and\n** written to disk immediately (the default behavior for SQLite versions\n** before 3.12.0).  -1 means always keep the entire statement journal in\n** memory.  (The statement journal is also always held entirely in memory\n** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this\n** setting.)\n*/\n#ifndef SQLITE_STMTJRNL_SPILL \n# define SQLITE_STMTJRNL_SPILL (64*1024)\n#endif\n\n/*\n** The following singleton contains the global configuration for\n** the SQLite library.\n*/\nSQLITE_WSD struct Sqlite3Config sqlite3Config = {\n   SQLITE_DEFAULT_MEMSTATUS,  /* bMemstat */\n   1,                         /* bCoreMutex */\n   SQLITE_THREADSAFE==1,      /* bFullMutex */\n   SQLITE_USE_URI,            /* bOpenUri */\n   SQLITE_ALLOW_COVERING_INDEX_SCAN,   /* bUseCis */\n   0x7ffffffe,                /* mxStrlen */\n   0,                         /* neverCorrupt */\n   128,                       /* szLookaside */\n   500,                       /* nLookaside */\n   SQLITE_STMTJRNL_SPILL,     /* nStmtSpill */\n   {0,0,0,0,0,0,0,0},         /* m */\n   {0,0,0,0,0,0,0,0,0},       /* mutex */\n   {0,0,0,0,0,0,0,0,0,0,0,0,0},/* pcache2 */\n   (void*)0,                  /* pHeap */\n   0,                         /* nHeap */\n   0, 0,                      /* mnHeap, mxHeap */\n   SQLITE_DEFAULT_MMAP_SIZE,  /* szMmap */\n   SQLITE_MAX_MMAP_SIZE,      /* mxMmap */\n   (void*)0,                  /* pScratch */\n   0,                         /* szScratch */\n   0,                         /* nScratch */\n   (void*)0,                  /* pPage */\n   0,                         /* szPage */\n   SQLITE_DEFAULT_PCACHE_INITSZ, /* nPage */\n   0,                         /* mxParserStack */\n   0,                         /* sharedCacheEnabled */\n   SQLITE_SORTER_PMASZ,       /* szPma */\n   /* All the rest should always be initialized to zero */\n   0,                         /* isInit */\n   0,                         /* inProgress */\n   0,                         /* isMutexInit */\n   0,                         /* isMallocInit */\n   0,                         /* isPCacheInit */\n   0,                         /* nRefInitMutex */\n   0,                         /* pInitMutex */\n   0,                         /* xLog */\n   0,                         /* pLogArg */\n#ifdef SQLITE_ENABLE_SQLLOG\n   0,                         /* xSqllog */\n   0,                         /* pSqllogArg */\n#endif\n#ifdef SQLITE_VDBE_COVERAGE\n   0,                         /* xVdbeBranch */\n   0,                         /* pVbeBranchArg */\n#endif\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n   0,                         /* xTestCallback */\n#endif\n   0,                         /* bLocaltimeFault */\n   0x7ffffffe                 /* iOnceResetThreshold */\n};\n\n/*\n** Hash table for global functions - functions common to all\n** database connections.  After initialization, this table is\n** read-only.\n*/\nFuncDefHash sqlite3BuiltinFunctions;\n\n/*\n** Constant tokens for values 0 and 1.\n*/\nconst Token sqlite3IntTokens[] = {\n   { \"0\", 1 },\n   { \"1\", 1 }\n};\n\n\n/*\n** The value of the \"pending\" byte must be 0x40000000 (1 byte past the\n** 1-gibabyte boundary) in a compatible database.  SQLite never uses\n** the database page that contains the pending byte.  It never attempts\n** to read or write that page.  The pending byte page is set aside\n** for use by the VFS layers as space for managing file locks.\n**\n** During testing, it is often desirable to move the pending byte to\n** a different position in the file.  This allows code that has to\n** deal with the pending byte to run on files that are much smaller\n** than 1 GiB.  The sqlite3_test_control() interface can be used to\n** move the pending byte.\n**\n** IMPORTANT:  Changing the pending byte to any value other than\n** 0x40000000 results in an incompatible database file format!\n** Changing the pending byte during operation will result in undefined\n** and incorrect behavior.\n*/\n#ifndef SQLITE_OMIT_WSD\nint sqlite3PendingByte = 0x40000000;\n#endif\n\n#include \"opcodes.h\"\n/*\n** Properties of opcodes.  The OPFLG_INITIALIZER macro is\n** created by mkopcodeh.awk during compilation.  Data is obtained\n** from the comments following the \"case OP_xxxx:\" statements in\n** the vdbe.c file.  \n*/\nconst unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;\n\n/*\n** Name of the default collating sequence\n*/\nconst char sqlite3StrBINARY[] = \"BINARY\";\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/hash.c",
    "content": "/*\n** 2001 September 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This is the implementation of generic hash-tables\n** used in SQLite.\n*/\n#include \"sqliteInt.h\"\n#include <assert.h>\n\n/* Turn bulk memory into a hash table object by initializing the\n** fields of the Hash structure.\n**\n** \"pNew\" is a pointer to the hash table that is to be initialized.\n*/\nvoid sqlite3HashInit(Hash *pNew){\n  assert( pNew!=0 );\n  pNew->first = 0;\n  pNew->count = 0;\n  pNew->htsize = 0;\n  pNew->ht = 0;\n}\n\n/* Remove all entries from a hash table.  Reclaim all memory.\n** Call this routine to delete a hash table or to reset a hash table\n** to the empty state.\n*/\nvoid sqlite3HashClear(Hash *pH){\n  HashElem *elem;         /* For looping over all elements of the table */\n\n  assert( pH!=0 );\n  elem = pH->first;\n  pH->first = 0;\n  sqlite3_free(pH->ht);\n  pH->ht = 0;\n  pH->htsize = 0;\n  while( elem ){\n    HashElem *next_elem = elem->next;\n    sqlite3_free(elem);\n    elem = next_elem;\n  }\n  pH->count = 0;\n}\n\n/*\n** The hashing function.\n*/\nstatic unsigned int strHash(const char *z){\n  unsigned int h = 0;\n  unsigned char c;\n  while( (c = (unsigned char)*z++)!=0 ){     /*OPTIMIZATION-IF-TRUE*/\n    /* Knuth multiplicative hashing.  (Sorting & Searching, p. 510).\n    ** 0x9e3779b1 is 2654435761 which is the closest prime number to\n    ** (2**32)*golden_ratio, where golden_ratio = (sqrt(5) - 1)/2. */\n    h += sqlite3UpperToLower[c];\n    h *= 0x9e3779b1;\n  }\n  return h;\n}\n\n\n/* Link pNew element into the hash table pH.  If pEntry!=0 then also\n** insert pNew into the pEntry hash bucket.\n*/\nstatic void insertElement(\n  Hash *pH,              /* The complete hash table */\n  struct _ht *pEntry,    /* The entry into which pNew is inserted */\n  HashElem *pNew         /* The element to be inserted */\n){\n  HashElem *pHead;       /* First element already in pEntry */\n  if( pEntry ){\n    pHead = pEntry->count ? pEntry->chain : 0;\n    pEntry->count++;\n    pEntry->chain = pNew;\n  }else{\n    pHead = 0;\n  }\n  if( pHead ){\n    pNew->next = pHead;\n    pNew->prev = pHead->prev;\n    if( pHead->prev ){ pHead->prev->next = pNew; }\n    else             { pH->first = pNew; }\n    pHead->prev = pNew;\n  }else{\n    pNew->next = pH->first;\n    if( pH->first ){ pH->first->prev = pNew; }\n    pNew->prev = 0;\n    pH->first = pNew;\n  }\n}\n\n\n/* Resize the hash table so that it cantains \"new_size\" buckets.\n**\n** The hash table might fail to resize if sqlite3_malloc() fails or\n** if the new size is the same as the prior size.\n** Return TRUE if the resize occurs and false if not.\n*/\nstatic int rehash(Hash *pH, unsigned int new_size){\n  struct _ht *new_ht;            /* The new hash table */\n  HashElem *elem, *next_elem;    /* For looping over existing elements */\n\n#if SQLITE_MALLOC_SOFT_LIMIT>0\n  if( new_size*sizeof(struct _ht)>SQLITE_MALLOC_SOFT_LIMIT ){\n    new_size = SQLITE_MALLOC_SOFT_LIMIT/sizeof(struct _ht);\n  }\n  if( new_size==pH->htsize ) return 0;\n#endif\n\n  /* The inability to allocates space for a larger hash table is\n  ** a performance hit but it is not a fatal error.  So mark the\n  ** allocation as a benign. Use sqlite3Malloc()/memset(0) instead of \n  ** sqlite3MallocZero() to make the allocation, as sqlite3MallocZero()\n  ** only zeroes the requested number of bytes whereas this module will\n  ** use the actual amount of space allocated for the hash table (which\n  ** may be larger than the requested amount).\n  */\n  sqlite3BeginBenignMalloc();\n  new_ht = (struct _ht *)sqlite3Malloc( new_size*sizeof(struct _ht) );\n  sqlite3EndBenignMalloc();\n\n  if( new_ht==0 ) return 0;\n  sqlite3_free(pH->ht);\n  pH->ht = new_ht;\n  pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);\n  memset(new_ht, 0, new_size*sizeof(struct _ht));\n  for(elem=pH->first, pH->first=0; elem; elem = next_elem){\n    unsigned int h = strHash(elem->pKey) % new_size;\n    next_elem = elem->next;\n    insertElement(pH, &new_ht[h], elem);\n  }\n  return 1;\n}\n\n/* This function (for internal use only) locates an element in an\n** hash table that matches the given key.  The hash for this key is\n** also computed and returned in the *pH parameter.\n*/\nstatic HashElem *findElementWithHash(\n  const Hash *pH,     /* The pH to be searched */\n  const char *pKey,   /* The key we are searching for */\n  unsigned int *pHash /* Write the hash value here */\n){\n  HashElem *elem;                /* Used to loop thru the element list */\n  int count;                     /* Number of elements left to test */\n  unsigned int h;                /* The computed hash */\n\n  if( pH->ht ){   /*OPTIMIZATION-IF-TRUE*/\n    struct _ht *pEntry;\n    h = strHash(pKey) % pH->htsize;\n    pEntry = &pH->ht[h];\n    elem = pEntry->chain;\n    count = pEntry->count;\n  }else{\n    h = 0;\n    elem = pH->first;\n    count = pH->count;\n  }\n  *pHash = h;\n  while( count-- ){\n    assert( elem!=0 );\n    if( sqlite3StrICmp(elem->pKey,pKey)==0 ){ \n      return elem;\n    }\n    elem = elem->next;\n  }\n  return 0;\n}\n\n/* Remove a single entry from the hash table given a pointer to that\n** element and a hash on the element's key.\n*/\nstatic void removeElementGivenHash(\n  Hash *pH,         /* The pH containing \"elem\" */\n  HashElem* elem,   /* The element to be removed from the pH */\n  unsigned int h    /* Hash value for the element */\n){\n  struct _ht *pEntry;\n  if( elem->prev ){\n    elem->prev->next = elem->next; \n  }else{\n    pH->first = elem->next;\n  }\n  if( elem->next ){\n    elem->next->prev = elem->prev;\n  }\n  if( pH->ht ){\n    pEntry = &pH->ht[h];\n    if( pEntry->chain==elem ){\n      pEntry->chain = elem->next;\n    }\n    pEntry->count--;\n    assert( pEntry->count>=0 );\n  }\n  sqlite3_free( elem );\n  pH->count--;\n  if( pH->count==0 ){\n    assert( pH->first==0 );\n    assert( pH->count==0 );\n    sqlite3HashClear(pH);\n  }\n}\n\n/* Attempt to locate an element of the hash table pH with a key\n** that matches pKey.  Return the data for this element if it is\n** found, or NULL if there is no match.\n*/\nvoid *sqlite3HashFind(const Hash *pH, const char *pKey){\n  HashElem *elem;    /* The element that matches key */\n  unsigned int h;    /* A hash on key */\n\n  assert( pH!=0 );\n  assert( pKey!=0 );\n  elem = findElementWithHash(pH, pKey, &h);\n  return elem ? elem->data : 0;\n}\n\n/* Insert an element into the hash table pH.  The key is pKey\n** and the data is \"data\".\n**\n** If no element exists with a matching key, then a new\n** element is created and NULL is returned.\n**\n** If another element already exists with the same key, then the\n** new data replaces the old data and the old data is returned.\n** The key is not copied in this instance.  If a malloc fails, then\n** the new data is returned and the hash table is unchanged.\n**\n** If the \"data\" parameter to this function is NULL, then the\n** element corresponding to \"key\" is removed from the hash table.\n*/\nvoid *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){\n  unsigned int h;       /* the hash of the key modulo hash table size */\n  HashElem *elem;       /* Used to loop thru the element list */\n  HashElem *new_elem;   /* New element added to the pH */\n\n  assert( pH!=0 );\n  assert( pKey!=0 );\n  elem = findElementWithHash(pH,pKey,&h);\n  if( elem ){\n    void *old_data = elem->data;\n    if( data==0 ){\n      removeElementGivenHash(pH,elem,h);\n    }else{\n      elem->data = data;\n      elem->pKey = pKey;\n    }\n    return old_data;\n  }\n  if( data==0 ) return 0;\n  new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) );\n  if( new_elem==0 ) return data;\n  new_elem->pKey = pKey;\n  new_elem->data = data;\n  pH->count++;\n  if( pH->count>=10 && pH->count > 2*pH->htsize ){\n    if( rehash(pH, pH->count*2) ){\n      assert( pH->htsize>0 );\n      h = strHash(pKey) % pH->htsize;\n    }\n  }\n  insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem);\n  return 0;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/hash.h",
    "content": "/*\n** 2001 September 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This is the header file for the generic hash-table implementation\n** used in SQLite.\n*/\n#ifndef SQLITE_HASH_H\n#define SQLITE_HASH_H\n\n/* Forward declarations of structures. */\ntypedef struct Hash Hash;\ntypedef struct HashElem HashElem;\n\n/* A complete hash table is an instance of the following structure.\n** The internals of this structure are intended to be opaque -- client\n** code should not attempt to access or modify the fields of this structure\n** directly.  Change this structure only by using the routines below.\n** However, some of the \"procedures\" and \"functions\" for modifying and\n** accessing this structure are really macros, so we can't really make\n** this structure opaque.\n**\n** All elements of the hash table are on a single doubly-linked list.\n** Hash.first points to the head of this list.\n**\n** There are Hash.htsize buckets.  Each bucket points to a spot in\n** the global doubly-linked list.  The contents of the bucket are the\n** element pointed to plus the next _ht.count-1 elements in the list.\n**\n** Hash.htsize and Hash.ht may be zero.  In that case lookup is done\n** by a linear search of the global list.  For small tables, the \n** Hash.ht table is never allocated because if there are few elements\n** in the table, it is faster to do a linear search than to manage\n** the hash table.\n*/\nstruct Hash {\n  unsigned int htsize;      /* Number of buckets in the hash table */\n  unsigned int count;       /* Number of entries in this table */\n  HashElem *first;          /* The first element of the array */\n  struct _ht {              /* the hash table */\n    int count;                 /* Number of entries with this hash */\n    HashElem *chain;           /* Pointer to first entry with this hash */\n  } *ht;\n};\n\n/* Each element in the hash table is an instance of the following \n** structure.  All elements are stored on a single doubly-linked list.\n**\n** Again, this structure is intended to be opaque, but it can't really\n** be opaque because it is used by macros.\n*/\nstruct HashElem {\n  HashElem *next, *prev;       /* Next and previous elements in the table */\n  void *data;                  /* Data associated with this element */\n  const char *pKey;            /* Key associated with this element */\n};\n\n/*\n** Access routines.  To delete, insert a NULL pointer.\n*/\nvoid sqlite3HashInit(Hash*);\nvoid *sqlite3HashInsert(Hash*, const char *pKey, void *pData);\nvoid *sqlite3HashFind(const Hash*, const char *pKey);\nvoid sqlite3HashClear(Hash*);\n\n/*\n** Macros for looping over all elements of a hash table.  The idiom is\n** like this:\n**\n**   Hash h;\n**   HashElem *p;\n**   ...\n**   for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){\n**     SomeStructure *pData = sqliteHashData(p);\n**     // do something with pData\n**   }\n*/\n#define sqliteHashFirst(H)  ((H)->first)\n#define sqliteHashNext(E)   ((E)->next)\n#define sqliteHashData(E)   ((E)->data)\n/* #define sqliteHashKey(E)    ((E)->pKey) // NOT USED */\n/* #define sqliteHashKeysize(E) ((E)->nKey)  // NOT USED */\n\n/*\n** Number of entries in a hash table\n*/\n/* #define sqliteHashCount(H)  ((H)->count) // NOT USED */\n\n#endif /* SQLITE_HASH_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/hwtime.h",
    "content": "/*\n** 2008 May 27\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains inline asm code for retrieving \"high-performance\"\n** counters for x86 class CPUs.\n*/\n#ifndef SQLITE_HWTIME_H\n#define SQLITE_HWTIME_H\n\n/*\n** The following routine only works on pentium-class (or newer) processors.\n** It uses the RDTSC opcode to read the cycle count value out of the\n** processor and returns that value.  This can be used for high-res\n** profiling.\n*/\n#if (defined(__GNUC__) || defined(_MSC_VER)) && \\\n      (defined(i386) || defined(__i386__) || defined(_M_IX86))\n\n  #if defined(__GNUC__)\n\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\n     unsigned int lo, hi;\n     __asm__ __volatile__ (\"rdtsc\" : \"=a\" (lo), \"=d\" (hi));\n     return (sqlite_uint64)hi << 32 | lo;\n  }\n\n  #elif defined(_MSC_VER)\n\n  __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){\n     __asm {\n        rdtsc\n        ret       ; return value at EDX:EAX\n     }\n  }\n\n  #endif\n\n#elif (defined(__GNUC__) && defined(__x86_64__))\n\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\n      unsigned long val;\n      __asm__ __volatile__ (\"rdtsc\" : \"=A\" (val));\n      return val;\n  }\n \n#elif (defined(__GNUC__) && defined(__ppc__))\n\n  __inline__ sqlite_uint64 sqlite3Hwtime(void){\n      unsigned long long retval;\n      unsigned long junk;\n      __asm__ __volatile__ (\"\\n\\\n          1:      mftbu   %1\\n\\\n                  mftb    %L0\\n\\\n                  mftbu   %0\\n\\\n                  cmpw    %0,%1\\n\\\n                  bne     1b\"\n                  : \"=r\" (retval), \"=r\" (junk));\n      return retval;\n  }\n\n#else\n\n  #error Need implementation of sqlite3Hwtime() for your platform.\n\n  /*\n  ** To compile without implementing sqlite3Hwtime() for your platform,\n  ** you can remove the above #error and use the following\n  ** stub function.  You will lose timing support for many\n  ** of the debugging and testing utilities, but it should at\n  ** least compile and run.\n  */\n  sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }\n\n#endif\n\n#endif /* !defined(SQLITE_HWTIME_H) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/insert.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains C code routines that are called by the parser\n** to handle INSERT statements in SQLite.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** Generate code that will \n**\n**   (1) acquire a lock for table pTab then\n**   (2) open pTab as cursor iCur.\n**\n** If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index\n** for that table that is actually opened.\n*/\nvoid sqlite3OpenTable(\n  Parse *pParse,  /* Generate code into this VDBE */\n  int iCur,       /* The cursor number of the table */\n  int iDb,        /* The database index in sqlite3.aDb[] */\n  Table *pTab,    /* The table to be opened */\n  int opcode      /* OP_OpenRead or OP_OpenWrite */\n){\n  Vdbe *v;\n  assert( !IsVirtual(pTab) );\n  v = sqlite3GetVdbe(pParse);\n  assert( opcode==OP_OpenWrite || opcode==OP_OpenRead );\n  sqlite3TableLock(pParse, iDb, pTab->tnum, \n                   (opcode==OP_OpenWrite)?1:0, pTab->zName);\n  if( HasRowid(pTab) ){\n    sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nCol);\n    VdbeComment((v, \"%s\", pTab->zName));\n  }else{\n    Index *pPk = sqlite3PrimaryKeyIndex(pTab);\n    assert( pPk!=0 );\n    assert( pPk->tnum==pTab->tnum );\n    sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb);\n    sqlite3VdbeSetP4KeyInfo(pParse, pPk);\n    VdbeComment((v, \"%s\", pTab->zName));\n  }\n}\n\n/*\n** Return a pointer to the column affinity string associated with index\n** pIdx. A column affinity string has one character for each column in \n** the table, according to the affinity of the column:\n**\n**  Character      Column affinity\n**  ------------------------------\n**  'A'            BLOB\n**  'B'            TEXT\n**  'C'            NUMERIC\n**  'D'            INTEGER\n**  'F'            REAL\n**\n** An extra 'D' is appended to the end of the string to cover the\n** rowid that appears as the last column in every index.\n**\n** Memory for the buffer containing the column index affinity string\n** is managed along with the rest of the Index structure. It will be\n** released when sqlite3DeleteIndex() is called.\n*/\nconst char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){\n  if( !pIdx->zColAff ){\n    /* The first time a column affinity string for a particular index is\n    ** required, it is allocated and populated here. It is then stored as\n    ** a member of the Index structure for subsequent use.\n    **\n    ** The column affinity string will eventually be deleted by\n    ** sqliteDeleteIndex() when the Index structure itself is cleaned\n    ** up.\n    */\n    int n;\n    Table *pTab = pIdx->pTable;\n    pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);\n    if( !pIdx->zColAff ){\n      sqlite3OomFault(db);\n      return 0;\n    }\n    for(n=0; n<pIdx->nColumn; n++){\n      i16 x = pIdx->aiColumn[n];\n      if( x>=0 ){\n        pIdx->zColAff[n] = pTab->aCol[x].affinity;\n      }else if( x==XN_ROWID ){\n        pIdx->zColAff[n] = SQLITE_AFF_INTEGER;\n      }else{\n        char aff;\n        assert( x==XN_EXPR );\n        assert( pIdx->aColExpr!=0 );\n        aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);\n        if( aff==0 ) aff = SQLITE_AFF_BLOB;\n        pIdx->zColAff[n] = aff;\n      }\n    }\n    pIdx->zColAff[n] = 0;\n  }\n \n  return pIdx->zColAff;\n}\n\n/*\n** Compute the affinity string for table pTab, if it has not already been\n** computed.  As an optimization, omit trailing SQLITE_AFF_BLOB affinities.\n**\n** If the affinity exists (if it is no entirely SQLITE_AFF_BLOB values) and\n** if iReg>0 then code an OP_Affinity opcode that will set the affinities\n** for register iReg and following.  Or if affinities exists and iReg==0,\n** then just set the P4 operand of the previous opcode (which should  be\n** an OP_MakeRecord) to the affinity string.\n**\n** A column affinity string has one character per column:\n**\n**  Character      Column affinity\n**  ------------------------------\n**  'A'            BLOB\n**  'B'            TEXT\n**  'C'            NUMERIC\n**  'D'            INTEGER\n**  'E'            REAL\n*/\nvoid sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){\n  int i;\n  char *zColAff = pTab->zColAff;\n  if( zColAff==0 ){\n    sqlite3 *db = sqlite3VdbeDb(v);\n    zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1);\n    if( !zColAff ){\n      sqlite3OomFault(db);\n      return;\n    }\n\n    for(i=0; i<pTab->nCol; i++){\n      zColAff[i] = pTab->aCol[i].affinity;\n    }\n    do{\n      zColAff[i--] = 0;\n    }while( i>=0 && zColAff[i]==SQLITE_AFF_BLOB );\n    pTab->zColAff = zColAff;\n  }\n  i = sqlite3Strlen30(zColAff);\n  if( i ){\n    if( iReg ){\n      sqlite3VdbeAddOp4(v, OP_Affinity, iReg, i, 0, zColAff, i);\n    }else{\n      sqlite3VdbeChangeP4(v, -1, zColAff, i);\n    }\n  }\n}\n\n/*\n** Return non-zero if the table pTab in database iDb or any of its indices\n** have been opened at any point in the VDBE program. This is used to see if \n** a statement of the form  \"INSERT INTO <iDb, pTab> SELECT ...\" can \n** run without using a temporary table for the results of the SELECT. \n*/\nstatic int readsTable(Parse *p, int iDb, Table *pTab){\n  Vdbe *v = sqlite3GetVdbe(p);\n  int i;\n  int iEnd = sqlite3VdbeCurrentAddr(v);\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  VTable *pVTab = IsVirtual(pTab) ? sqlite3GetVTable(p->db, pTab) : 0;\n#endif\n\n  for(i=1; i<iEnd; i++){\n    VdbeOp *pOp = sqlite3VdbeGetOp(v, i);\n    assert( pOp!=0 );\n    if( pOp->opcode==OP_OpenRead && pOp->p3==iDb ){\n      Index *pIndex;\n      int tnum = pOp->p2;\n      if( tnum==pTab->tnum ){\n        return 1;\n      }\n      for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){\n        if( tnum==pIndex->tnum ){\n          return 1;\n        }\n      }\n    }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    if( pOp->opcode==OP_VOpen && pOp->p4.pVtab==pVTab ){\n      assert( pOp->p4.pVtab!=0 );\n      assert( pOp->p4type==P4_VTAB );\n      return 1;\n    }\n#endif\n  }\n  return 0;\n}\n\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n/*\n** Locate or create an AutoincInfo structure associated with table pTab\n** which is in database iDb.  Return the register number for the register\n** that holds the maximum rowid.  Return zero if pTab is not an AUTOINCREMENT\n** table.  (Also return zero when doing a VACUUM since we do not want to\n** update the AUTOINCREMENT counters during a VACUUM.)\n**\n** There is at most one AutoincInfo structure per table even if the\n** same table is autoincremented multiple times due to inserts within\n** triggers.  A new AutoincInfo structure is created if this is the\n** first use of table pTab.  On 2nd and subsequent uses, the original\n** AutoincInfo structure is used.\n**\n** Three memory locations are allocated:\n**\n**   (1)  Register to hold the name of the pTab table.\n**   (2)  Register to hold the maximum ROWID of pTab.\n**   (3)  Register to hold the rowid in sqlite_sequence of pTab\n**\n** The 2nd register is the one that is returned.  That is all the\n** insert routine needs to know about.\n*/\nstatic int autoIncBegin(\n  Parse *pParse,      /* Parsing context */\n  int iDb,            /* Index of the database holding pTab */\n  Table *pTab         /* The table we are writing to */\n){\n  int memId = 0;      /* Register holding maximum rowid */\n  if( (pTab->tabFlags & TF_Autoincrement)!=0\n   && (pParse->db->flags & SQLITE_Vacuum)==0\n  ){\n    Parse *pToplevel = sqlite3ParseToplevel(pParse);\n    AutoincInfo *pInfo;\n\n    pInfo = pToplevel->pAinc;\n    while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }\n    if( pInfo==0 ){\n      pInfo = sqlite3DbMallocRawNN(pParse->db, sizeof(*pInfo));\n      if( pInfo==0 ) return 0;\n      pInfo->pNext = pToplevel->pAinc;\n      pToplevel->pAinc = pInfo;\n      pInfo->pTab = pTab;\n      pInfo->iDb = iDb;\n      pToplevel->nMem++;                  /* Register to hold name of table */\n      pInfo->regCtr = ++pToplevel->nMem;  /* Max rowid register */\n      pToplevel->nMem++;                  /* Rowid in sqlite_sequence */\n    }\n    memId = pInfo->regCtr;\n  }\n  return memId;\n}\n\n/*\n** This routine generates code that will initialize all of the\n** register used by the autoincrement tracker.  \n*/\nvoid sqlite3AutoincrementBegin(Parse *pParse){\n  AutoincInfo *p;            /* Information about an AUTOINCREMENT */\n  sqlite3 *db = pParse->db;  /* The database connection */\n  Db *pDb;                   /* Database only autoinc table */\n  int memId;                 /* Register holding max rowid */\n  Vdbe *v = pParse->pVdbe;   /* VDBE under construction */\n\n  /* This routine is never called during trigger-generation.  It is\n  ** only called from the top-level */\n  assert( pParse->pTriggerTab==0 );\n  assert( sqlite3IsToplevel(pParse) );\n\n  assert( v );   /* We failed long ago if this is not so */\n  for(p = pParse->pAinc; p; p = p->pNext){\n    static const int iLn = VDBE_OFFSET_LINENO(2);\n    static const VdbeOpList autoInc[] = {\n      /* 0  */ {OP_Null,    0,  0, 0},\n      /* 1  */ {OP_Rewind,  0,  9, 0},\n      /* 2  */ {OP_Column,  0,  0, 0},\n      /* 3  */ {OP_Ne,      0,  7, 0},\n      /* 4  */ {OP_Rowid,   0,  0, 0},\n      /* 5  */ {OP_Column,  0,  1, 0},\n      /* 6  */ {OP_Goto,    0,  9, 0},\n      /* 7  */ {OP_Next,    0,  2, 0},\n      /* 8  */ {OP_Integer, 0,  0, 0},\n      /* 9  */ {OP_Close,   0,  0, 0} \n    };\n    VdbeOp *aOp;\n    pDb = &db->aDb[p->iDb];\n    memId = p->regCtr;\n    assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );\n    sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);\n    sqlite3VdbeLoadString(v, memId-1, p->pTab->zName);\n    aOp = sqlite3VdbeAddOpList(v, ArraySize(autoInc), autoInc, iLn);\n    if( aOp==0 ) break;\n    aOp[0].p2 = memId;\n    aOp[0].p3 = memId+1;\n    aOp[2].p3 = memId;\n    aOp[3].p1 = memId-1;\n    aOp[3].p3 = memId;\n    aOp[3].p5 = SQLITE_JUMPIFNULL;\n    aOp[4].p2 = memId+1;\n    aOp[5].p3 = memId;\n    aOp[8].p2 = memId;\n  }\n}\n\n/*\n** Update the maximum rowid for an autoincrement calculation.\n**\n** This routine should be called when the regRowid register holds a\n** new rowid that is about to be inserted.  If that new rowid is\n** larger than the maximum rowid in the memId memory cell, then the\n** memory cell is updated.\n*/\nstatic void autoIncStep(Parse *pParse, int memId, int regRowid){\n  if( memId>0 ){\n    sqlite3VdbeAddOp2(pParse->pVdbe, OP_MemMax, memId, regRowid);\n  }\n}\n\n/*\n** This routine generates the code needed to write autoincrement\n** maximum rowid values back into the sqlite_sequence register.\n** Every statement that might do an INSERT into an autoincrement\n** table (either directly or through triggers) needs to call this\n** routine just before the \"exit\" code.\n*/\nstatic SQLITE_NOINLINE void autoIncrementEnd(Parse *pParse){\n  AutoincInfo *p;\n  Vdbe *v = pParse->pVdbe;\n  sqlite3 *db = pParse->db;\n\n  assert( v );\n  for(p = pParse->pAinc; p; p = p->pNext){\n    static const int iLn = VDBE_OFFSET_LINENO(2);\n    static const VdbeOpList autoIncEnd[] = {\n      /* 0 */ {OP_NotNull,     0, 2, 0},\n      /* 1 */ {OP_NewRowid,    0, 0, 0},\n      /* 2 */ {OP_MakeRecord,  0, 2, 0},\n      /* 3 */ {OP_Insert,      0, 0, 0},\n      /* 4 */ {OP_Close,       0, 0, 0}\n    };\n    VdbeOp *aOp;\n    Db *pDb = &db->aDb[p->iDb];\n    int iRec;\n    int memId = p->regCtr;\n\n    iRec = sqlite3GetTempReg(pParse);\n    assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );\n    sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);\n    aOp = sqlite3VdbeAddOpList(v, ArraySize(autoIncEnd), autoIncEnd, iLn);\n    if( aOp==0 ) break;\n    aOp[0].p1 = memId+1;\n    aOp[1].p2 = memId+1;\n    aOp[2].p1 = memId-1;\n    aOp[2].p3 = iRec;\n    aOp[3].p2 = iRec;\n    aOp[3].p3 = memId+1;\n    aOp[3].p5 = OPFLAG_APPEND;\n    sqlite3ReleaseTempReg(pParse, iRec);\n  }\n}\nvoid sqlite3AutoincrementEnd(Parse *pParse){\n  if( pParse->pAinc ) autoIncrementEnd(pParse);\n}\n#else\n/*\n** If SQLITE_OMIT_AUTOINCREMENT is defined, then the three routines\n** above are all no-ops\n*/\n# define autoIncBegin(A,B,C) (0)\n# define autoIncStep(A,B,C)\n#endif /* SQLITE_OMIT_AUTOINCREMENT */\n\n\n/* Forward declaration */\nstatic int xferOptimization(\n  Parse *pParse,        /* Parser context */\n  Table *pDest,         /* The table we are inserting into */\n  Select *pSelect,      /* A SELECT statement to use as the data source */\n  int onError,          /* How to handle constraint errors */\n  int iDbDest           /* The database of pDest */\n);\n\n/*\n** This routine is called to handle SQL of the following forms:\n**\n**    insert into TABLE (IDLIST) values(EXPRLIST),(EXPRLIST),...\n**    insert into TABLE (IDLIST) select\n**    insert into TABLE (IDLIST) default values\n**\n** The IDLIST following the table name is always optional.  If omitted,\n** then a list of all (non-hidden) columns for the table is substituted.\n** The IDLIST appears in the pColumn parameter.  pColumn is NULL if IDLIST\n** is omitted.\n**\n** For the pSelect parameter holds the values to be inserted for the\n** first two forms shown above.  A VALUES clause is really just short-hand\n** for a SELECT statement that omits the FROM clause and everything else\n** that follows.  If the pSelect parameter is NULL, that means that the\n** DEFAULT VALUES form of the INSERT statement is intended.\n**\n** The code generated follows one of four templates.  For a simple\n** insert with data coming from a single-row VALUES clause, the code executes\n** once straight down through.  Pseudo-code follows (we call this\n** the \"1st template\"):\n**\n**         open write cursor to <table> and its indices\n**         put VALUES clause expressions into registers\n**         write the resulting record into <table>\n**         cleanup\n**\n** The three remaining templates assume the statement is of the form\n**\n**   INSERT INTO <table> SELECT ...\n**\n** If the SELECT clause is of the restricted form \"SELECT * FROM <table2>\" -\n** in other words if the SELECT pulls all columns from a single table\n** and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and\n** if <table2> and <table1> are distinct tables but have identical\n** schemas, including all the same indices, then a special optimization\n** is invoked that copies raw records from <table2> over to <table1>.\n** See the xferOptimization() function for the implementation of this\n** template.  This is the 2nd template.\n**\n**         open a write cursor to <table>\n**         open read cursor on <table2>\n**         transfer all records in <table2> over to <table>\n**         close cursors\n**         foreach index on <table>\n**           open a write cursor on the <table> index\n**           open a read cursor on the corresponding <table2> index\n**           transfer all records from the read to the write cursors\n**           close cursors\n**         end foreach\n**\n** The 3rd template is for when the second template does not apply\n** and the SELECT clause does not read from <table> at any time.\n** The generated code follows this template:\n**\n**         X <- A\n**         goto B\n**      A: setup for the SELECT\n**         loop over the rows in the SELECT\n**           load values into registers R..R+n\n**           yield X\n**         end loop\n**         cleanup after the SELECT\n**         end-coroutine X\n**      B: open write cursor to <table> and its indices\n**      C: yield X, at EOF goto D\n**         insert the select result into <table> from R..R+n\n**         goto C\n**      D: cleanup\n**\n** The 4th template is used if the insert statement takes its\n** values from a SELECT but the data is being inserted into a table\n** that is also read as part of the SELECT.  In the third form,\n** we have to use an intermediate table to store the results of\n** the select.  The template is like this:\n**\n**         X <- A\n**         goto B\n**      A: setup for the SELECT\n**         loop over the tables in the SELECT\n**           load value into register R..R+n\n**           yield X\n**         end loop\n**         cleanup after the SELECT\n**         end co-routine R\n**      B: open temp table\n**      L: yield X, at EOF goto M\n**         insert row from R..R+n into temp table\n**         goto L\n**      M: open write cursor to <table> and its indices\n**         rewind temp table\n**      C: loop over rows of intermediate table\n**           transfer values form intermediate table into <table>\n**         end loop\n**      D: cleanup\n*/\nvoid sqlite3Insert(\n  Parse *pParse,        /* Parser context */\n  SrcList *pTabList,    /* Name of table into which we are inserting */\n  Select *pSelect,      /* A SELECT statement to use as the data source */\n  IdList *pColumn,      /* Column names corresponding to IDLIST. */\n  int onError           /* How to handle constraint errors */\n){\n  sqlite3 *db;          /* The main database structure */\n  Table *pTab;          /* The table to insert into.  aka TABLE */\n  char *zTab;           /* Name of the table into which we are inserting */\n  int i, j, idx;        /* Loop counters */\n  Vdbe *v;              /* Generate code into this virtual machine */\n  Index *pIdx;          /* For looping over indices of the table */\n  int nColumn;          /* Number of columns in the data */\n  int nHidden = 0;      /* Number of hidden columns if TABLE is virtual */\n  int iDataCur = 0;     /* VDBE cursor that is the main data repository */\n  int iIdxCur = 0;      /* First index cursor */\n  int ipkColumn = -1;   /* Column that is the INTEGER PRIMARY KEY */\n  int endOfLoop;        /* Label for the end of the insertion loop */\n  int srcTab = 0;       /* Data comes from this temporary cursor if >=0 */\n  int addrInsTop = 0;   /* Jump to label \"D\" */\n  int addrCont = 0;     /* Top of insert loop. Label \"C\" in templates 3 and 4 */\n  SelectDest dest;      /* Destination for SELECT on rhs of INSERT */\n  int iDb;              /* Index of database holding TABLE */\n  u8 useTempTable = 0;  /* Store SELECT results in intermediate table */\n  u8 appendFlag = 0;    /* True if the insert is likely to be an append */\n  u8 withoutRowid;      /* 0 for normal table.  1 for WITHOUT ROWID table */\n  u8 bIdListInOrder;    /* True if IDLIST is in table order */\n  ExprList *pList = 0;  /* List of VALUES() to be inserted  */\n\n  /* Register allocations */\n  int regFromSelect = 0;/* Base register for data coming from SELECT */\n  int regAutoinc = 0;   /* Register holding the AUTOINCREMENT counter */\n  int regRowCount = 0;  /* Memory cell used for the row counter */\n  int regIns;           /* Block of regs holding rowid+data being inserted */\n  int regRowid;         /* registers holding insert rowid */\n  int regData;          /* register holding first column to insert */\n  int *aRegIdx = 0;     /* One register allocated to each index */\n\n#ifndef SQLITE_OMIT_TRIGGER\n  int isView;                 /* True if attempting to insert into a view */\n  Trigger *pTrigger;          /* List of triggers on pTab, if required */\n  int tmask;                  /* Mask of trigger times */\n#endif\n\n  db = pParse->db;\n  memset(&dest, 0, sizeof(dest));\n  if( pParse->nErr || db->mallocFailed ){\n    goto insert_cleanup;\n  }\n\n  /* If the Select object is really just a simple VALUES() list with a\n  ** single row (the common case) then keep that one row of values\n  ** and discard the other (unused) parts of the pSelect object\n  */\n  if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){\n    pList = pSelect->pEList;\n    pSelect->pEList = 0;\n    sqlite3SelectDelete(db, pSelect);\n    pSelect = 0;\n  }\n\n  /* Locate the table into which we will be inserting new information.\n  */\n  assert( pTabList->nSrc==1 );\n  zTab = pTabList->a[0].zName;\n  if( NEVER(zTab==0) ) goto insert_cleanup;\n  pTab = sqlite3SrcListLookup(pParse, pTabList);\n  if( pTab==0 ){\n    goto insert_cleanup;\n  }\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n  assert( iDb<db->nDb );\n  if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0,\n                       db->aDb[iDb].zDbSName) ){\n    goto insert_cleanup;\n  }\n  withoutRowid = !HasRowid(pTab);\n\n  /* Figure out if we have any triggers and if the table being\n  ** inserted into is a view\n  */\n#ifndef SQLITE_OMIT_TRIGGER\n  pTrigger = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask);\n  isView = pTab->pSelect!=0;\n#else\n# define pTrigger 0\n# define tmask 0\n# define isView 0\n#endif\n#ifdef SQLITE_OMIT_VIEW\n# undef isView\n# define isView 0\n#endif\n  assert( (pTrigger && tmask) || (pTrigger==0 && tmask==0) );\n\n  /* If pTab is really a view, make sure it has been initialized.\n  ** ViewGetColumnNames() is a no-op if pTab is not a view.\n  */\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\n    goto insert_cleanup;\n  }\n\n  /* Cannot insert into a read-only table.\n  */\n  if( sqlite3IsReadOnly(pParse, pTab, tmask) ){\n    goto insert_cleanup;\n  }\n\n  /* Allocate a VDBE\n  */\n  v = sqlite3GetVdbe(pParse);\n  if( v==0 ) goto insert_cleanup;\n  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);\n  sqlite3BeginWriteOperation(pParse, pSelect || pTrigger, iDb);\n\n#ifndef SQLITE_OMIT_XFER_OPT\n  /* If the statement is of the form\n  **\n  **       INSERT INTO <table1> SELECT * FROM <table2>;\n  **\n  ** Then special optimizations can be applied that make the transfer\n  ** very fast and which reduce fragmentation of indices.\n  **\n  ** This is the 2nd template.\n  */\n  if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){\n    assert( !pTrigger );\n    assert( pList==0 );\n    goto insert_end;\n  }\n#endif /* SQLITE_OMIT_XFER_OPT */\n\n  /* If this is an AUTOINCREMENT table, look up the sequence number in the\n  ** sqlite_sequence table and store it in memory cell regAutoinc.\n  */\n  regAutoinc = autoIncBegin(pParse, iDb, pTab);\n\n  /* Allocate registers for holding the rowid of the new row,\n  ** the content of the new row, and the assembled row record.\n  */\n  regRowid = regIns = pParse->nMem+1;\n  pParse->nMem += pTab->nCol + 1;\n  if( IsVirtual(pTab) ){\n    regRowid++;\n    pParse->nMem++;\n  }\n  regData = regRowid+1;\n\n  /* If the INSERT statement included an IDLIST term, then make sure\n  ** all elements of the IDLIST really are columns of the table and \n  ** remember the column indices.\n  **\n  ** If the table has an INTEGER PRIMARY KEY column and that column\n  ** is named in the IDLIST, then record in the ipkColumn variable\n  ** the index into IDLIST of the primary key column.  ipkColumn is\n  ** the index of the primary key as it appears in IDLIST, not as\n  ** is appears in the original table.  (The index of the INTEGER\n  ** PRIMARY KEY in the original table is pTab->iPKey.)\n  */\n  bIdListInOrder = (pTab->tabFlags & TF_OOOHidden)==0;\n  if( pColumn ){\n    for(i=0; i<pColumn->nId; i++){\n      pColumn->a[i].idx = -1;\n    }\n    for(i=0; i<pColumn->nId; i++){\n      for(j=0; j<pTab->nCol; j++){\n        if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){\n          pColumn->a[i].idx = j;\n          if( i!=j ) bIdListInOrder = 0;\n          if( j==pTab->iPKey ){\n            ipkColumn = i;  assert( !withoutRowid );\n          }\n          break;\n        }\n      }\n      if( j>=pTab->nCol ){\n        if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){\n          ipkColumn = i;\n          bIdListInOrder = 0;\n        }else{\n          sqlite3ErrorMsg(pParse, \"table %S has no column named %s\",\n              pTabList, 0, pColumn->a[i].zName);\n          pParse->checkSchema = 1;\n          goto insert_cleanup;\n        }\n      }\n    }\n  }\n\n  /* Figure out how many columns of data are supplied.  If the data\n  ** is coming from a SELECT statement, then generate a co-routine that\n  ** produces a single row of the SELECT on each invocation.  The\n  ** co-routine is the common header to the 3rd and 4th templates.\n  */\n  if( pSelect ){\n    /* Data is coming from a SELECT or from a multi-row VALUES clause.\n    ** Generate a co-routine to run the SELECT. */\n    int regYield;       /* Register holding co-routine entry-point */\n    int addrTop;        /* Top of the co-routine */\n    int rc;             /* Result code */\n\n    regYield = ++pParse->nMem;\n    addrTop = sqlite3VdbeCurrentAddr(v) + 1;\n    sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);\n    sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield);\n    dest.iSdst = bIdListInOrder ? regData : 0;\n    dest.nSdst = pTab->nCol;\n    rc = sqlite3Select(pParse, pSelect, &dest);\n    regFromSelect = dest.iSdst;\n    if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup;\n    sqlite3VdbeEndCoroutine(v, regYield);\n    sqlite3VdbeJumpHere(v, addrTop - 1);                       /* label B: */\n    assert( pSelect->pEList );\n    nColumn = pSelect->pEList->nExpr;\n\n    /* Set useTempTable to TRUE if the result of the SELECT statement\n    ** should be written into a temporary table (template 4).  Set to\n    ** FALSE if each output row of the SELECT can be written directly into\n    ** the destination table (template 3).\n    **\n    ** A temp table must be used if the table being updated is also one\n    ** of the tables being read by the SELECT statement.  Also use a \n    ** temp table in the case of row triggers.\n    */\n    if( pTrigger || readsTable(pParse, iDb, pTab) ){\n      useTempTable = 1;\n    }\n\n    if( useTempTable ){\n      /* Invoke the coroutine to extract information from the SELECT\n      ** and add it to a transient table srcTab.  The code generated\n      ** here is from the 4th template:\n      **\n      **      B: open temp table\n      **      L: yield X, goto M at EOF\n      **         insert row from R..R+n into temp table\n      **         goto L\n      **      M: ...\n      */\n      int regRec;          /* Register to hold packed record */\n      int regTempRowid;    /* Register to hold temp table ROWID */\n      int addrL;           /* Label \"L\" */\n\n      srcTab = pParse->nTab++;\n      regRec = sqlite3GetTempReg(pParse);\n      regTempRowid = sqlite3GetTempReg(pParse);\n      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, nColumn);\n      addrL = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); VdbeCoverage(v);\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regFromSelect, nColumn, regRec);\n      sqlite3VdbeAddOp2(v, OP_NewRowid, srcTab, regTempRowid);\n      sqlite3VdbeAddOp3(v, OP_Insert, srcTab, regRec, regTempRowid);\n      sqlite3VdbeGoto(v, addrL);\n      sqlite3VdbeJumpHere(v, addrL);\n      sqlite3ReleaseTempReg(pParse, regRec);\n      sqlite3ReleaseTempReg(pParse, regTempRowid);\n    }\n  }else{\n    /* This is the case if the data for the INSERT is coming from a \n    ** single-row VALUES clause\n    */\n    NameContext sNC;\n    memset(&sNC, 0, sizeof(sNC));\n    sNC.pParse = pParse;\n    srcTab = -1;\n    assert( useTempTable==0 );\n    if( pList ){\n      nColumn = pList->nExpr;\n      if( sqlite3ResolveExprListNames(&sNC, pList) ){\n        goto insert_cleanup;\n      }\n    }else{\n      nColumn = 0;\n    }\n  }\n\n  /* If there is no IDLIST term but the table has an integer primary\n  ** key, the set the ipkColumn variable to the integer primary key \n  ** column index in the original table definition.\n  */\n  if( pColumn==0 && nColumn>0 ){\n    ipkColumn = pTab->iPKey;\n  }\n\n  /* Make sure the number of columns in the source data matches the number\n  ** of columns to be inserted into the table.\n  */\n  for(i=0; i<pTab->nCol; i++){\n    nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0);\n  }\n  if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){\n    sqlite3ErrorMsg(pParse, \n       \"table %S has %d columns but %d values were supplied\",\n       pTabList, 0, pTab->nCol-nHidden, nColumn);\n    goto insert_cleanup;\n  }\n  if( pColumn!=0 && nColumn!=pColumn->nId ){\n    sqlite3ErrorMsg(pParse, \"%d values for %d columns\", nColumn, pColumn->nId);\n    goto insert_cleanup;\n  }\n    \n  /* Initialize the count of rows to be inserted\n  */\n  if( db->flags & SQLITE_CountRows ){\n    regRowCount = ++pParse->nMem;\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);\n  }\n\n  /* If this is not a view, open the table and and all indices */\n  if( !isView ){\n    int nIdx;\n    nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0,\n                                      &iDataCur, &iIdxCur);\n    aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+1));\n    if( aRegIdx==0 ){\n      goto insert_cleanup;\n    }\n    for(i=0; i<nIdx; i++){\n      aRegIdx[i] = ++pParse->nMem;\n    }\n  }\n\n  /* This is the top of the main insertion loop */\n  if( useTempTable ){\n    /* This block codes the top of loop only.  The complete loop is the\n    ** following pseudocode (template 4):\n    **\n    **         rewind temp table, if empty goto D\n    **      C: loop over rows of intermediate table\n    **           transfer values form intermediate table into <table>\n    **         end loop\n    **      D: ...\n    */\n    addrInsTop = sqlite3VdbeAddOp1(v, OP_Rewind, srcTab); VdbeCoverage(v);\n    addrCont = sqlite3VdbeCurrentAddr(v);\n  }else if( pSelect ){\n    /* This block codes the top of loop only.  The complete loop is the\n    ** following pseudocode (template 3):\n    **\n    **      C: yield X, at EOF goto D\n    **         insert the select result into <table> from R..R+n\n    **         goto C\n    **      D: ...\n    */\n    addrInsTop = addrCont = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm);\n    VdbeCoverage(v);\n  }\n\n  /* Run the BEFORE and INSTEAD OF triggers, if there are any\n  */\n  endOfLoop = sqlite3VdbeMakeLabel(v);\n  if( tmask & TRIGGER_BEFORE ){\n    int regCols = sqlite3GetTempRange(pParse, pTab->nCol+1);\n\n    /* build the NEW.* reference row.  Note that if there is an INTEGER\n    ** PRIMARY KEY into which a NULL is being inserted, that NULL will be\n    ** translated into a unique ID for the row.  But on a BEFORE trigger,\n    ** we do not know what the unique ID will be (because the insert has\n    ** not happened yet) so we substitute a rowid of -1\n    */\n    if( ipkColumn<0 ){\n      sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols);\n    }else{\n      int addr1;\n      assert( !withoutRowid );\n      if( useTempTable ){\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regCols);\n      }else{\n        assert( pSelect==0 );  /* Otherwise useTempTable is true */\n        sqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regCols);\n      }\n      addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, regCols); VdbeCoverage(v);\n      sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols);\n      sqlite3VdbeJumpHere(v, addr1);\n      sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);\n    }\n\n    /* Cannot have triggers on a virtual table. If it were possible,\n    ** this block would have to account for hidden column.\n    */\n    assert( !IsVirtual(pTab) );\n\n    /* Create the new column data\n    */\n    for(i=j=0; i<pTab->nCol; i++){\n      if( pColumn ){\n        for(j=0; j<pColumn->nId; j++){\n          if( pColumn->a[j].idx==i ) break;\n        }\n      }\n      if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId)\n            || (pColumn==0 && IsOrdinaryHiddenColumn(&pTab->aCol[i])) ){\n        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i+1);\n      }else if( useTempTable ){\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, regCols+i+1); \n      }else{\n        assert( pSelect==0 ); /* Otherwise useTempTable is true */\n        sqlite3ExprCodeAndCache(pParse, pList->a[j].pExpr, regCols+i+1);\n      }\n      if( pColumn==0 && !IsOrdinaryHiddenColumn(&pTab->aCol[i]) ) j++;\n    }\n\n    /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger,\n    ** do not attempt any conversions before assembling the record.\n    ** If this is a real table, attempt conversions as required by the\n    ** table column affinities.\n    */\n    if( !isView ){\n      sqlite3TableAffinity(v, pTab, regCols+1);\n    }\n\n    /* Fire BEFORE or INSTEAD OF triggers */\n    sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_BEFORE, \n        pTab, regCols-pTab->nCol-1, onError, endOfLoop);\n\n    sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1);\n  }\n\n  /* Compute the content of the next row to insert into a range of\n  ** registers beginning at regIns.\n  */\n  if( !isView ){\n    if( IsVirtual(pTab) ){\n      /* The row that the VUpdate opcode will delete: none */\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regIns);\n    }\n    if( ipkColumn>=0 ){\n      if( useTempTable ){\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regRowid);\n      }else if( pSelect ){\n        sqlite3VdbeAddOp2(v, OP_Copy, regFromSelect+ipkColumn, regRowid);\n      }else{\n        VdbeOp *pOp;\n        sqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regRowid);\n        pOp = sqlite3VdbeGetOp(v, -1);\n        if( ALWAYS(pOp) && pOp->opcode==OP_Null && !IsVirtual(pTab) ){\n          appendFlag = 1;\n          pOp->opcode = OP_NewRowid;\n          pOp->p1 = iDataCur;\n          pOp->p2 = regRowid;\n          pOp->p3 = regAutoinc;\n        }\n      }\n      /* If the PRIMARY KEY expression is NULL, then use OP_NewRowid\n      ** to generate a unique primary key value.\n      */\n      if( !appendFlag ){\n        int addr1;\n        if( !IsVirtual(pTab) ){\n          addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid); VdbeCoverage(v);\n          sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc);\n          sqlite3VdbeJumpHere(v, addr1);\n        }else{\n          addr1 = sqlite3VdbeCurrentAddr(v);\n          sqlite3VdbeAddOp2(v, OP_IsNull, regRowid, addr1+2); VdbeCoverage(v);\n        }\n        sqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid); VdbeCoverage(v);\n      }\n    }else if( IsVirtual(pTab) || withoutRowid ){\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regRowid);\n    }else{\n      sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc);\n      appendFlag = 1;\n    }\n    autoIncStep(pParse, regAutoinc, regRowid);\n\n    /* Compute data for all columns of the new entry, beginning\n    ** with the first column.\n    */\n    nHidden = 0;\n    for(i=0; i<pTab->nCol; i++){\n      int iRegStore = regRowid+1+i;\n      if( i==pTab->iPKey ){\n        /* The value of the INTEGER PRIMARY KEY column is always a NULL.\n        ** Whenever this column is read, the rowid will be substituted\n        ** in its place.  Hence, fill this column with a NULL to avoid\n        ** taking up data space with information that will never be used.\n        ** As there may be shallow copies of this value, make it a soft-NULL */\n        sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore);\n        continue;\n      }\n      if( pColumn==0 ){\n        if( IsHiddenColumn(&pTab->aCol[i]) ){\n          j = -1;\n          nHidden++;\n        }else{\n          j = i - nHidden;\n        }\n      }else{\n        for(j=0; j<pColumn->nId; j++){\n          if( pColumn->a[j].idx==i ) break;\n        }\n      }\n      if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){\n        sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore);\n      }else if( useTempTable ){\n        sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, iRegStore); \n      }else if( pSelect ){\n        if( regFromSelect!=regData ){\n          sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+j, iRegStore);\n        }\n      }else{\n        sqlite3ExprCode(pParse, pList->a[j].pExpr, iRegStore);\n      }\n    }\n\n    /* Generate code to check constraints and generate index keys and\n    ** do the insertion.\n    */\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    if( IsVirtual(pTab) ){\n      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);\n      sqlite3VtabMakeWritable(pParse, pTab);\n      sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB);\n      sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError);\n      sqlite3MayAbort(pParse);\n    }else\n#endif\n    {\n      int isReplace;    /* Set to true if constraints may cause a replace */\n      sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,\n          regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace, 0\n      );\n      sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0);\n      sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur,\n                               regIns, aRegIdx, 0, appendFlag, isReplace==0);\n    }\n  }\n\n  /* Update the count of rows that are inserted\n  */\n  if( (db->flags & SQLITE_CountRows)!=0 ){\n    sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);\n  }\n\n  if( pTrigger ){\n    /* Code AFTER triggers */\n    sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_AFTER, \n        pTab, regData-2-pTab->nCol, onError, endOfLoop);\n  }\n\n  /* The bottom of the main insertion loop, if the data source\n  ** is a SELECT statement.\n  */\n  sqlite3VdbeResolveLabel(v, endOfLoop);\n  if( useTempTable ){\n    sqlite3VdbeAddOp2(v, OP_Next, srcTab, addrCont); VdbeCoverage(v);\n    sqlite3VdbeJumpHere(v, addrInsTop);\n    sqlite3VdbeAddOp1(v, OP_Close, srcTab);\n  }else if( pSelect ){\n    sqlite3VdbeGoto(v, addrCont);\n    sqlite3VdbeJumpHere(v, addrInsTop);\n  }\n\n  if( !IsVirtual(pTab) && !isView ){\n    /* Close all tables opened */\n    if( iDataCur<iIdxCur ) sqlite3VdbeAddOp1(v, OP_Close, iDataCur);\n    for(idx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){\n      sqlite3VdbeAddOp1(v, OP_Close, idx+iIdxCur);\n    }\n  }\n\ninsert_end:\n  /* Update the sqlite_sequence table by storing the content of the\n  ** maximum rowid counter values recorded while inserting into\n  ** autoincrement tables.\n  */\n  if( pParse->nested==0 && pParse->pTriggerTab==0 ){\n    sqlite3AutoincrementEnd(pParse);\n  }\n\n  /*\n  ** Return the number of rows inserted. If this routine is \n  ** generating code because of a call to sqlite3NestedParse(), do not\n  ** invoke the callback function.\n  */\n  if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){\n    sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);\n    sqlite3VdbeSetNumCols(v, 1);\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"rows inserted\", SQLITE_STATIC);\n  }\n\ninsert_cleanup:\n  sqlite3SrcListDelete(db, pTabList);\n  sqlite3ExprListDelete(db, pList);\n  sqlite3SelectDelete(db, pSelect);\n  sqlite3IdListDelete(db, pColumn);\n  sqlite3DbFree(db, aRegIdx);\n}\n\n/* Make sure \"isView\" and other macros defined above are undefined. Otherwise\n** they may interfere with compilation of other functions in this file\n** (or in another file, if this file becomes part of the amalgamation).  */\n#ifdef isView\n #undef isView\n#endif\n#ifdef pTrigger\n #undef pTrigger\n#endif\n#ifdef tmask\n #undef tmask\n#endif\n\n/*\n** Meanings of bits in of pWalker->eCode for checkConstraintUnchanged()\n*/\n#define CKCNSTRNT_COLUMN   0x01    /* CHECK constraint uses a changing column */\n#define CKCNSTRNT_ROWID    0x02    /* CHECK constraint references the ROWID */\n\n/* This is the Walker callback from checkConstraintUnchanged().  Set\n** bit 0x01 of pWalker->eCode if\n** pWalker->eCode to 0 if this expression node references any of the\n** columns that are being modifed by an UPDATE statement.\n*/\nstatic int checkConstraintExprNode(Walker *pWalker, Expr *pExpr){\n  if( pExpr->op==TK_COLUMN ){\n    assert( pExpr->iColumn>=0 || pExpr->iColumn==-1 );\n    if( pExpr->iColumn>=0 ){\n      if( pWalker->u.aiCol[pExpr->iColumn]>=0 ){\n        pWalker->eCode |= CKCNSTRNT_COLUMN;\n      }\n    }else{\n      pWalker->eCode |= CKCNSTRNT_ROWID;\n    }\n  }\n  return WRC_Continue;\n}\n\n/*\n** pExpr is a CHECK constraint on a row that is being UPDATE-ed.  The\n** only columns that are modified by the UPDATE are those for which\n** aiChng[i]>=0, and also the ROWID is modified if chngRowid is true.\n**\n** Return true if CHECK constraint pExpr does not use any of the\n** changing columns (or the rowid if it is changing).  In other words,\n** return true if this CHECK constraint can be skipped when validating\n** the new row in the UPDATE statement.\n*/\nstatic int checkConstraintUnchanged(Expr *pExpr, int *aiChng, int chngRowid){\n  Walker w;\n  memset(&w, 0, sizeof(w));\n  w.eCode = 0;\n  w.xExprCallback = checkConstraintExprNode;\n  w.u.aiCol = aiChng;\n  sqlite3WalkExpr(&w, pExpr);\n  if( !chngRowid ){\n    testcase( (w.eCode & CKCNSTRNT_ROWID)!=0 );\n    w.eCode &= ~CKCNSTRNT_ROWID;\n  }\n  testcase( w.eCode==0 );\n  testcase( w.eCode==CKCNSTRNT_COLUMN );\n  testcase( w.eCode==CKCNSTRNT_ROWID );\n  testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );\n  return !w.eCode;\n}\n\n/*\n** Generate code to do constraint checks prior to an INSERT or an UPDATE\n** on table pTab.\n**\n** The regNewData parameter is the first register in a range that contains\n** the data to be inserted or the data after the update.  There will be\n** pTab->nCol+1 registers in this range.  The first register (the one\n** that regNewData points to) will contain the new rowid, or NULL in the\n** case of a WITHOUT ROWID table.  The second register in the range will\n** contain the content of the first table column.  The third register will\n** contain the content of the second table column.  And so forth.\n**\n** The regOldData parameter is similar to regNewData except that it contains\n** the data prior to an UPDATE rather than afterwards.  regOldData is zero\n** for an INSERT.  This routine can distinguish between UPDATE and INSERT by\n** checking regOldData for zero.\n**\n** For an UPDATE, the pkChng boolean is true if the true primary key (the\n** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table)\n** might be modified by the UPDATE.  If pkChng is false, then the key of\n** the iDataCur content table is guaranteed to be unchanged by the UPDATE.\n**\n** For an INSERT, the pkChng boolean indicates whether or not the rowid\n** was explicitly specified as part of the INSERT statement.  If pkChng\n** is zero, it means that the either rowid is computed automatically or\n** that the table is a WITHOUT ROWID table and has no rowid.  On an INSERT,\n** pkChng will only be true if the INSERT statement provides an integer\n** value for either the rowid column or its INTEGER PRIMARY KEY alias.\n**\n** The code generated by this routine will store new index entries into\n** registers identified by aRegIdx[].  No index entry is created for\n** indices where aRegIdx[i]==0.  The order of indices in aRegIdx[] is\n** the same as the order of indices on the linked list of indices\n** at pTab->pIndex.\n**\n** The caller must have already opened writeable cursors on the main\n** table and all applicable indices (that is to say, all indices for which\n** aRegIdx[] is not zero).  iDataCur is the cursor for the main table when\n** inserting or updating a rowid table, or the cursor for the PRIMARY KEY\n** index when operating on a WITHOUT ROWID table.  iIdxCur is the cursor\n** for the first index in the pTab->pIndex list.  Cursors for other indices\n** are at iIdxCur+N for the N-th element of the pTab->pIndex list.\n**\n** This routine also generates code to check constraints.  NOT NULL,\n** CHECK, and UNIQUE constraints are all checked.  If a constraint fails,\n** then the appropriate action is performed.  There are five possible\n** actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE.\n**\n**  Constraint type  Action       What Happens\n**  ---------------  ----------   ----------------------------------------\n**  any              ROLLBACK     The current transaction is rolled back and\n**                                sqlite3_step() returns immediately with a\n**                                return code of SQLITE_CONSTRAINT.\n**\n**  any              ABORT        Back out changes from the current command\n**                                only (do not do a complete rollback) then\n**                                cause sqlite3_step() to return immediately\n**                                with SQLITE_CONSTRAINT.\n**\n**  any              FAIL         Sqlite3_step() returns immediately with a\n**                                return code of SQLITE_CONSTRAINT.  The\n**                                transaction is not rolled back and any\n**                                changes to prior rows are retained.\n**\n**  any              IGNORE       The attempt in insert or update the current\n**                                row is skipped, without throwing an error.\n**                                Processing continues with the next row.\n**                                (There is an immediate jump to ignoreDest.)\n**\n**  NOT NULL         REPLACE      The NULL value is replace by the default\n**                                value for that column.  If the default value\n**                                is NULL, the action is the same as ABORT.\n**\n**  UNIQUE           REPLACE      The other row that conflicts with the row\n**                                being inserted is removed.\n**\n**  CHECK            REPLACE      Illegal.  The results in an exception.\n**\n** Which action to take is determined by the overrideError parameter.\n** Or if overrideError==OE_Default, then the pParse->onError parameter\n** is used.  Or if pParse->onError==OE_Default then the onError value\n** for the constraint is used.\n*/\nvoid sqlite3GenerateConstraintChecks(\n  Parse *pParse,       /* The parser context */\n  Table *pTab,         /* The table being inserted or updated */\n  int *aRegIdx,        /* Use register aRegIdx[i] for index i.  0 for unused */\n  int iDataCur,        /* Canonical data cursor (main table or PK index) */\n  int iIdxCur,         /* First index cursor */\n  int regNewData,      /* First register in a range holding values to insert */\n  int regOldData,      /* Previous content.  0 for INSERTs */\n  u8 pkChng,           /* Non-zero if the rowid or PRIMARY KEY changed */\n  u8 overrideError,    /* Override onError to this if not OE_Default */\n  int ignoreDest,      /* Jump to this label on an OE_Ignore resolution */\n  int *pbMayReplace,   /* OUT: Set to true if constraint may cause a replace */\n  int *aiChng          /* column i is unchanged if aiChng[i]<0 */\n){\n  Vdbe *v;             /* VDBE under constrution */\n  Index *pIdx;         /* Pointer to one of the indices */\n  Index *pPk = 0;      /* The PRIMARY KEY index */\n  sqlite3 *db;         /* Database connection */\n  int i;               /* loop counter */\n  int ix;              /* Index loop counter */\n  int nCol;            /* Number of columns */\n  int onError;         /* Conflict resolution strategy */\n  int addr1;           /* Address of jump instruction */\n  int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */\n  int nPkField;        /* Number of fields in PRIMARY KEY. 1 for ROWID tables */\n  int ipkTop = 0;      /* Top of the rowid change constraint check */\n  int ipkBottom = 0;   /* Bottom of the rowid change constraint check */\n  u8 isUpdate;         /* True if this is an UPDATE operation */\n  u8 bAffinityDone = 0;  /* True if the OP_Affinity operation has been run */\n  int regRowid = -1;   /* Register holding ROWID value */\n\n  isUpdate = regOldData!=0;\n  db = pParse->db;\n  v = sqlite3GetVdbe(pParse);\n  assert( v!=0 );\n  assert( pTab->pSelect==0 );  /* This table is not a VIEW */\n  nCol = pTab->nCol;\n  \n  /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for\n  ** normal rowid tables.  nPkField is the number of key fields in the \n  ** pPk index or 1 for a rowid table.  In other words, nPkField is the\n  ** number of fields in the true primary key of the table. */\n  if( HasRowid(pTab) ){\n    pPk = 0;\n    nPkField = 1;\n  }else{\n    pPk = sqlite3PrimaryKeyIndex(pTab);\n    nPkField = pPk->nKeyCol;\n  }\n\n  /* Record that this module has started */\n  VdbeModuleComment((v, \"BEGIN: GenCnstCks(%d,%d,%d,%d,%d)\",\n                     iDataCur, iIdxCur, regNewData, regOldData, pkChng));\n\n  /* Test all NOT NULL constraints.\n  */\n  for(i=0; i<nCol; i++){\n    if( i==pTab->iPKey ){\n      continue;        /* ROWID is never NULL */\n    }\n    if( aiChng && aiChng[i]<0 ){\n      /* Don't bother checking for NOT NULL on columns that do not change */\n      continue;\n    }\n    onError = pTab->aCol[i].notNull;\n    if( onError==OE_None ) continue;  /* This column is allowed to be NULL */\n    if( overrideError!=OE_Default ){\n      onError = overrideError;\n    }else if( onError==OE_Default ){\n      onError = OE_Abort;\n    }\n    if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){\n      onError = OE_Abort;\n    }\n    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail\n        || onError==OE_Ignore || onError==OE_Replace );\n    switch( onError ){\n      case OE_Abort:\n        sqlite3MayAbort(pParse);\n        /* Fall through */\n      case OE_Rollback:\n      case OE_Fail: {\n        char *zMsg = sqlite3MPrintf(db, \"%s.%s\", pTab->zName,\n                                    pTab->aCol[i].zName);\n        sqlite3VdbeAddOp4(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, onError,\n                          regNewData+1+i, zMsg, P4_DYNAMIC);\n        sqlite3VdbeChangeP5(v, P5_ConstraintNotNull);\n        VdbeCoverage(v);\n        break;\n      }\n      case OE_Ignore: {\n        sqlite3VdbeAddOp2(v, OP_IsNull, regNewData+1+i, ignoreDest);\n        VdbeCoverage(v);\n        break;\n      }\n      default: {\n        assert( onError==OE_Replace );\n        addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, regNewData+1+i);\n           VdbeCoverage(v);\n        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i);\n        sqlite3VdbeJumpHere(v, addr1);\n        break;\n      }\n    }\n  }\n\n  /* Test all CHECK constraints\n  */\n#ifndef SQLITE_OMIT_CHECK\n  if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){\n    ExprList *pCheck = pTab->pCheck;\n    pParse->ckBase = regNewData+1;\n    onError = overrideError!=OE_Default ? overrideError : OE_Abort;\n    for(i=0; i<pCheck->nExpr; i++){\n      int allOk;\n      Expr *pExpr = pCheck->a[i].pExpr;\n      if( aiChng && checkConstraintUnchanged(pExpr, aiChng, pkChng) ) continue;\n      allOk = sqlite3VdbeMakeLabel(v);\n      sqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL);\n      if( onError==OE_Ignore ){\n        sqlite3VdbeGoto(v, ignoreDest);\n      }else{\n        char *zName = pCheck->a[i].zName;\n        if( zName==0 ) zName = pTab->zName;\n        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */\n        sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK,\n                              onError, zName, P4_TRANSIENT,\n                              P5_ConstraintCheck);\n      }\n      sqlite3VdbeResolveLabel(v, allOk);\n    }\n  }\n#endif /* !defined(SQLITE_OMIT_CHECK) */\n\n  /* If rowid is changing, make sure the new rowid does not previously\n  ** exist in the table.\n  */\n  if( pkChng && pPk==0 ){\n    int addrRowidOk = sqlite3VdbeMakeLabel(v);\n\n    /* Figure out what action to take in case of a rowid collision */\n    onError = pTab->keyConf;\n    if( overrideError!=OE_Default ){\n      onError = overrideError;\n    }else if( onError==OE_Default ){\n      onError = OE_Abort;\n    }\n\n    if( isUpdate ){\n      /* pkChng!=0 does not mean that the rowid has change, only that\n      ** it might have changed.  Skip the conflict logic below if the rowid\n      ** is unchanged. */\n      sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData);\n      sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);\n      VdbeCoverage(v);\n    }\n\n    /* If the response to a rowid conflict is REPLACE but the response\n    ** to some other UNIQUE constraint is FAIL or IGNORE, then we need\n    ** to defer the running of the rowid conflict checking until after\n    ** the UNIQUE constraints have run.\n    */\n    if( onError==OE_Replace && overrideError!=OE_Replace ){\n      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n        if( pIdx->onError==OE_Ignore || pIdx->onError==OE_Fail ){\n          ipkTop = sqlite3VdbeAddOp0(v, OP_Goto);\n          break;\n        }\n      }\n    }\n\n    /* Check to see if the new rowid already exists in the table.  Skip\n    ** the following conflict logic if it does not. */\n    sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData);\n    VdbeCoverage(v);\n\n    /* Generate code that deals with a rowid collision */\n    switch( onError ){\n      default: {\n        onError = OE_Abort;\n        /* Fall thru into the next case */\n      }\n      case OE_Rollback:\n      case OE_Abort:\n      case OE_Fail: {\n        sqlite3RowidConstraint(pParse, onError, pTab);\n        break;\n      }\n      case OE_Replace: {\n        /* If there are DELETE triggers on this table and the\n        ** recursive-triggers flag is set, call GenerateRowDelete() to\n        ** remove the conflicting row from the table. This will fire\n        ** the triggers and remove both the table and index b-tree entries.\n        **\n        ** Otherwise, if there are no triggers or the recursive-triggers\n        ** flag is not set, but the table has one or more indexes, call \n        ** GenerateRowIndexDelete(). This removes the index b-tree entries \n        ** only. The table b-tree entry will be replaced by the new entry \n        ** when it is inserted.  \n        **\n        ** If either GenerateRowDelete() or GenerateRowIndexDelete() is called,\n        ** also invoke MultiWrite() to indicate that this VDBE may require\n        ** statement rollback (if the statement is aborted after the delete\n        ** takes place). Earlier versions called sqlite3MultiWrite() regardless,\n        ** but being more selective here allows statements like:\n        **\n        **   REPLACE INTO t(rowid) VALUES($newrowid)\n        **\n        ** to run without a statement journal if there are no indexes on the\n        ** table.\n        */\n        Trigger *pTrigger = 0;\n        if( db->flags&SQLITE_RecTriggers ){\n          pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);\n        }\n        if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){\n          sqlite3MultiWrite(pParse);\n          sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,\n                                   regNewData, 1, 0, OE_Replace, 1, -1);\n        }else{\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n          if( HasRowid(pTab) ){\n            /* This OP_Delete opcode fires the pre-update-hook only. It does\n            ** not modify the b-tree. It is more efficient to let the coming\n            ** OP_Insert replace the existing entry than it is to delete the\n            ** existing entry and then insert a new one. */\n            sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP);\n            sqlite3VdbeChangeP4(v, -1, (char *)pTab, P4_TABLE);\n          }\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n          if( pTab->pIndex ){\n            sqlite3MultiWrite(pParse);\n            sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1);\n          }\n        }\n        seenReplace = 1;\n        break;\n      }\n      case OE_Ignore: {\n        /*assert( seenReplace==0 );*/\n        sqlite3VdbeGoto(v, ignoreDest);\n        break;\n      }\n    }\n    sqlite3VdbeResolveLabel(v, addrRowidOk);\n    if( ipkTop ){\n      ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);\n      sqlite3VdbeJumpHere(v, ipkTop);\n    }\n  }\n\n  /* Test all UNIQUE constraints by creating entries for each UNIQUE\n  ** index and making sure that duplicate entries do not already exist.\n  ** Compute the revised record entries for indices as we go.\n  **\n  ** This loop also handles the case of the PRIMARY KEY index for a\n  ** WITHOUT ROWID table.\n  */\n  for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){\n    int regIdx;          /* Range of registers hold conent for pIdx */\n    int regR;            /* Range of registers holding conflicting PK */\n    int iThisCur;        /* Cursor for this UNIQUE index */\n    int addrUniqueOk;    /* Jump here if the UNIQUE constraint is satisfied */\n\n    if( aRegIdx[ix]==0 ) continue;  /* Skip indices that do not change */\n    if( bAffinityDone==0 ){\n      sqlite3TableAffinity(v, pTab, regNewData+1);\n      bAffinityDone = 1;\n    }\n    iThisCur = iIdxCur+ix;\n    addrUniqueOk = sqlite3VdbeMakeLabel(v);\n\n    /* Skip partial indices for which the WHERE clause is not true */\n    if( pIdx->pPartIdxWhere ){\n      sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]);\n      pParse->ckBase = regNewData+1;\n      sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, addrUniqueOk,\n                            SQLITE_JUMPIFNULL);\n      pParse->ckBase = 0;\n    }\n\n    /* Create a record for this index entry as it should appear after\n    ** the insert or update.  Store that record in the aRegIdx[ix] register\n    */\n    regIdx = sqlite3GetTempRange(pParse, pIdx->nColumn);\n    for(i=0; i<pIdx->nColumn; i++){\n      int iField = pIdx->aiColumn[i];\n      int x;\n      if( iField==XN_EXPR ){\n        pParse->ckBase = regNewData+1;\n        sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i);\n        pParse->ckBase = 0;\n        VdbeComment((v, \"%s column %d\", pIdx->zName, i));\n      }else{\n        if( iField==XN_ROWID || iField==pTab->iPKey ){\n          if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */\n          x = regNewData;\n          regRowid =  pIdx->pPartIdxWhere ? -1 : regIdx+i;\n        }else{\n          x = iField + regNewData + 1;\n        }\n        sqlite3VdbeAddOp2(v, iField<0 ? OP_IntCopy : OP_SCopy, x, regIdx+i);\n        VdbeComment((v, \"%s\", iField<0 ? \"rowid\" : pTab->aCol[iField].zName));\n      }\n    }\n    sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);\n    VdbeComment((v, \"for %s\", pIdx->zName));\n    sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn);\n\n    /* In an UPDATE operation, if this index is the PRIMARY KEY index \n    ** of a WITHOUT ROWID table and there has been no change the\n    ** primary key, then no collision is possible.  The collision detection\n    ** logic below can all be skipped. */\n    if( isUpdate && pPk==pIdx && pkChng==0 ){\n      sqlite3VdbeResolveLabel(v, addrUniqueOk);\n      continue;\n    }\n\n    /* Find out what action to take in case there is a uniqueness conflict */\n    onError = pIdx->onError;\n    if( onError==OE_None ){ \n      sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn);\n      sqlite3VdbeResolveLabel(v, addrUniqueOk);\n      continue;  /* pIdx is not a UNIQUE index */\n    }\n    if( overrideError!=OE_Default ){\n      onError = overrideError;\n    }else if( onError==OE_Default ){\n      onError = OE_Abort;\n    }\n    \n    /* Check to see if the new index entry will be unique */\n    sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,\n                         regIdx, pIdx->nKeyCol); VdbeCoverage(v);\n\n    /* Generate code to handle collisions */\n    regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);\n    if( isUpdate || onError==OE_Replace ){\n      if( HasRowid(pTab) ){\n        sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);\n        /* Conflict only if the rowid of the existing index entry\n        ** is different from old-rowid */\n        if( isUpdate ){\n          sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);\n          sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);\n          VdbeCoverage(v);\n        }\n      }else{\n        int x;\n        /* Extract the PRIMARY KEY from the end of the index entry and\n        ** store it in registers regR..regR+nPk-1 */\n        if( pIdx!=pPk ){\n          for(i=0; i<pPk->nKeyCol; i++){\n            assert( pPk->aiColumn[i]>=0 );\n            x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);\n            sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);\n            VdbeComment((v, \"%s.%s\", pTab->zName,\n                         pTab->aCol[pPk->aiColumn[i]].zName));\n          }\n        }\n        if( isUpdate ){\n          /* If currently processing the PRIMARY KEY of a WITHOUT ROWID \n          ** table, only conflict if the new PRIMARY KEY values are actually\n          ** different from the old.\n          **\n          ** For a UNIQUE index, only conflict if the PRIMARY KEY values\n          ** of the matched index row are different from the original PRIMARY\n          ** KEY values of this row before the update.  */\n          int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;\n          int op = OP_Ne;\n          int regCmp = (IsPrimaryKeyIndex(pIdx) ? regIdx : regR);\n  \n          for(i=0; i<pPk->nKeyCol; i++){\n            char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);\n            x = pPk->aiColumn[i];\n            assert( x>=0 );\n            if( i==(pPk->nKeyCol-1) ){\n              addrJump = addrUniqueOk;\n              op = OP_Eq;\n            }\n            sqlite3VdbeAddOp4(v, op, \n                regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ\n            );\n            sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);\n            VdbeCoverageIf(v, op==OP_Eq);\n            VdbeCoverageIf(v, op==OP_Ne);\n          }\n        }\n      }\n    }\n\n    /* Generate code that executes if the new index entry is not unique */\n    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail\n        || onError==OE_Ignore || onError==OE_Replace );\n    switch( onError ){\n      case OE_Rollback:\n      case OE_Abort:\n      case OE_Fail: {\n        sqlite3UniqueConstraint(pParse, onError, pIdx);\n        break;\n      }\n      case OE_Ignore: {\n        sqlite3VdbeGoto(v, ignoreDest);\n        break;\n      }\n      default: {\n        Trigger *pTrigger = 0;\n        assert( onError==OE_Replace );\n        sqlite3MultiWrite(pParse);\n        if( db->flags&SQLITE_RecTriggers ){\n          pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);\n        }\n        sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,\n            regR, nPkField, 0, OE_Replace,\n            (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), -1);\n        seenReplace = 1;\n        break;\n      }\n    }\n    sqlite3VdbeResolveLabel(v, addrUniqueOk);\n    sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn);\n    if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);\n  }\n  if( ipkTop ){\n    sqlite3VdbeGoto(v, ipkTop+1);\n    sqlite3VdbeJumpHere(v, ipkBottom);\n  }\n  \n  *pbMayReplace = seenReplace;\n  VdbeModuleComment((v, \"END: GenCnstCks(%d)\", seenReplace));\n}\n\n/*\n** This routine generates code to finish the INSERT or UPDATE operation\n** that was started by a prior call to sqlite3GenerateConstraintChecks.\n** A consecutive range of registers starting at regNewData contains the\n** rowid and the content to be inserted.\n**\n** The arguments to this routine should be the same as the first six\n** arguments to sqlite3GenerateConstraintChecks.\n*/\nvoid sqlite3CompleteInsertion(\n  Parse *pParse,      /* The parser context */\n  Table *pTab,        /* the table into which we are inserting */\n  int iDataCur,       /* Cursor of the canonical data source */\n  int iIdxCur,        /* First index cursor */\n  int regNewData,     /* Range of content */\n  int *aRegIdx,       /* Register used by each index.  0 for unused indices */\n  int isUpdate,       /* True for UPDATE, False for INSERT */\n  int appendBias,     /* True if this is likely to be an append */\n  int useSeekResult   /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */\n){\n  Vdbe *v;            /* Prepared statements under construction */\n  Index *pIdx;        /* An index being inserted or updated */\n  u8 pik_flags;       /* flag values passed to the btree insert */\n  int regData;        /* Content registers (after the rowid) */\n  int regRec;         /* Register holding assembled record for the table */\n  int i;              /* Loop counter */\n  u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */\n\n  v = sqlite3GetVdbe(pParse);\n  assert( v!=0 );\n  assert( pTab->pSelect==0 );  /* This table is not a VIEW */\n  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){\n    if( aRegIdx[i]==0 ) continue;\n    bAffinityDone = 1;\n    if( pIdx->pPartIdxWhere ){\n      sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);\n      VdbeCoverage(v);\n    }\n    sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i]);\n    pik_flags = 0;\n    if( useSeekResult ) pik_flags = OPFLAG_USESEEKRESULT;\n    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){\n      assert( pParse->nested==0 );\n      pik_flags |= OPFLAG_NCHANGE;\n    }\n    sqlite3VdbeChangeP5(v, pik_flags);\n  }\n  if( !HasRowid(pTab) ) return;\n  regData = regNewData + 1;\n  regRec = sqlite3GetTempReg(pParse);\n  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);\n  if( !bAffinityDone ) sqlite3TableAffinity(v, pTab, 0);\n  sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);\n  if( pParse->nested ){\n    pik_flags = 0;\n  }else{\n    pik_flags = OPFLAG_NCHANGE;\n    pik_flags |= (isUpdate?OPFLAG_ISUPDATE:OPFLAG_LASTROWID);\n  }\n  if( appendBias ){\n    pik_flags |= OPFLAG_APPEND;\n  }\n  if( useSeekResult ){\n    pik_flags |= OPFLAG_USESEEKRESULT;\n  }\n  sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, regRec, regNewData);\n  if( !pParse->nested ){\n    sqlite3VdbeChangeP4(v, -1, (char *)pTab, P4_TABLE);\n  }\n  sqlite3VdbeChangeP5(v, pik_flags);\n}\n\n/*\n** Allocate cursors for the pTab table and all its indices and generate\n** code to open and initialized those cursors.\n**\n** The cursor for the object that contains the complete data (normally\n** the table itself, but the PRIMARY KEY index in the case of a WITHOUT\n** ROWID table) is returned in *piDataCur.  The first index cursor is\n** returned in *piIdxCur.  The number of indices is returned.\n**\n** Use iBase as the first cursor (either the *piDataCur for rowid tables\n** or the first index for WITHOUT ROWID tables) if it is non-negative.\n** If iBase is negative, then allocate the next available cursor.\n**\n** For a rowid table, *piDataCur will be exactly one less than *piIdxCur.\n** For a WITHOUT ROWID table, *piDataCur will be somewhere in the range\n** of *piIdxCurs, depending on where the PRIMARY KEY index appears on the\n** pTab->pIndex list.\n**\n** If pTab is a virtual table, then this routine is a no-op and the\n** *piDataCur and *piIdxCur values are left uninitialized.\n*/\nint sqlite3OpenTableAndIndices(\n  Parse *pParse,   /* Parsing context */\n  Table *pTab,     /* Table to be opened */\n  int op,          /* OP_OpenRead or OP_OpenWrite */\n  u8 p5,           /* P5 value for OP_Open* opcodes (except on WITHOUT ROWID) */\n  int iBase,       /* Use this for the table cursor, if there is one */\n  u8 *aToOpen,     /* If not NULL: boolean for each table and index */\n  int *piDataCur,  /* Write the database source cursor number here */\n  int *piIdxCur    /* Write the first index cursor number here */\n){\n  int i;\n  int iDb;\n  int iDataCur;\n  Index *pIdx;\n  Vdbe *v;\n\n  assert( op==OP_OpenRead || op==OP_OpenWrite );\n  assert( op==OP_OpenWrite || p5==0 );\n  if( IsVirtual(pTab) ){\n    /* This routine is a no-op for virtual tables. Leave the output\n    ** variables *piDataCur and *piIdxCur uninitialized so that valgrind\n    ** can detect if they are used by mistake in the caller. */\n    return 0;\n  }\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n  v = sqlite3GetVdbe(pParse);\n  assert( v!=0 );\n  if( iBase<0 ) iBase = pParse->nTab;\n  iDataCur = iBase++;\n  if( piDataCur ) *piDataCur = iDataCur;\n  if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){\n    sqlite3OpenTable(pParse, iDataCur, iDb, pTab, op);\n  }else{\n    sqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName);\n  }\n  if( piIdxCur ) *piIdxCur = iBase;\n  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){\n    int iIdxCur = iBase++;\n    assert( pIdx->pSchema==pTab->pSchema );\n    if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){\n      if( piDataCur ) *piDataCur = iIdxCur;\n      p5 = 0;\n    }\n    if( aToOpen==0 || aToOpen[i+1] ){\n      sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb);\n      sqlite3VdbeSetP4KeyInfo(pParse, pIdx);\n      sqlite3VdbeChangeP5(v, p5);\n      VdbeComment((v, \"%s\", pIdx->zName));\n    }\n  }\n  if( iBase>pParse->nTab ) pParse->nTab = iBase;\n  return i;\n}\n\n\n#ifdef SQLITE_TEST\n/*\n** The following global variable is incremented whenever the\n** transfer optimization is used.  This is used for testing\n** purposes only - to make sure the transfer optimization really\n** is happening when it is supposed to.\n*/\nint sqlite3_xferopt_count;\n#endif /* SQLITE_TEST */\n\n\n#ifndef SQLITE_OMIT_XFER_OPT\n/*\n** Check to see if index pSrc is compatible as a source of data\n** for index pDest in an insert transfer optimization.  The rules\n** for a compatible index:\n**\n**    *   The index is over the same set of columns\n**    *   The same DESC and ASC markings occurs on all columns\n**    *   The same onError processing (OE_Abort, OE_Ignore, etc)\n**    *   The same collating sequence on each column\n**    *   The index has the exact same WHERE clause\n*/\nstatic int xferCompatibleIndex(Index *pDest, Index *pSrc){\n  int i;\n  assert( pDest && pSrc );\n  assert( pDest->pTable!=pSrc->pTable );\n  if( pDest->nKeyCol!=pSrc->nKeyCol ){\n    return 0;   /* Different number of columns */\n  }\n  if( pDest->onError!=pSrc->onError ){\n    return 0;   /* Different conflict resolution strategies */\n  }\n  for(i=0; i<pSrc->nKeyCol; i++){\n    if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){\n      return 0;   /* Different columns indexed */\n    }\n    if( pSrc->aiColumn[i]==XN_EXPR ){\n      assert( pSrc->aColExpr!=0 && pDest->aColExpr!=0 );\n      if( sqlite3ExprCompare(pSrc->aColExpr->a[i].pExpr,\n                             pDest->aColExpr->a[i].pExpr, -1)!=0 ){\n        return 0;   /* Different expressions in the index */\n      }\n    }\n    if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){\n      return 0;   /* Different sort orders */\n    }\n    if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){\n      return 0;   /* Different collating sequences */\n    }\n  }\n  if( sqlite3ExprCompare(pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){\n    return 0;     /* Different WHERE clauses */\n  }\n\n  /* If no test above fails then the indices must be compatible */\n  return 1;\n}\n\n/*\n** Attempt the transfer optimization on INSERTs of the form\n**\n**     INSERT INTO tab1 SELECT * FROM tab2;\n**\n** The xfer optimization transfers raw records from tab2 over to tab1.  \n** Columns are not decoded and reassembled, which greatly improves\n** performance.  Raw index records are transferred in the same way.\n**\n** The xfer optimization is only attempted if tab1 and tab2 are compatible.\n** There are lots of rules for determining compatibility - see comments\n** embedded in the code for details.\n**\n** This routine returns TRUE if the optimization is guaranteed to be used.\n** Sometimes the xfer optimization will only work if the destination table\n** is empty - a factor that can only be determined at run-time.  In that\n** case, this routine generates code for the xfer optimization but also\n** does a test to see if the destination table is empty and jumps over the\n** xfer optimization code if the test fails.  In that case, this routine\n** returns FALSE so that the caller will know to go ahead and generate\n** an unoptimized transfer.  This routine also returns FALSE if there\n** is no chance that the xfer optimization can be applied.\n**\n** This optimization is particularly useful at making VACUUM run faster.\n*/\nstatic int xferOptimization(\n  Parse *pParse,        /* Parser context */\n  Table *pDest,         /* The table we are inserting into */\n  Select *pSelect,      /* A SELECT statement to use as the data source */\n  int onError,          /* How to handle constraint errors */\n  int iDbDest           /* The database of pDest */\n){\n  sqlite3 *db = pParse->db;\n  ExprList *pEList;                /* The result set of the SELECT */\n  Table *pSrc;                     /* The table in the FROM clause of SELECT */\n  Index *pSrcIdx, *pDestIdx;       /* Source and destination indices */\n  struct SrcList_item *pItem;      /* An element of pSelect->pSrc */\n  int i;                           /* Loop counter */\n  int iDbSrc;                      /* The database of pSrc */\n  int iSrc, iDest;                 /* Cursors from source and destination */\n  int addr1, addr2;                /* Loop addresses */\n  int emptyDestTest = 0;           /* Address of test for empty pDest */\n  int emptySrcTest = 0;            /* Address of test for empty pSrc */\n  Vdbe *v;                         /* The VDBE we are building */\n  int regAutoinc;                  /* Memory register used by AUTOINC */\n  int destHasUniqueIdx = 0;        /* True if pDest has a UNIQUE index */\n  int regData, regRowid;           /* Registers holding data and rowid */\n\n  if( pSelect==0 ){\n    return 0;   /* Must be of the form  INSERT INTO ... SELECT ... */\n  }\n  if( pParse->pWith || pSelect->pWith ){\n    /* Do not attempt to process this query if there are an WITH clauses\n    ** attached to it. Proceeding may generate a false \"no such table: xxx\"\n    ** error if pSelect reads from a CTE named \"xxx\".  */\n    return 0;\n  }\n  if( sqlite3TriggerList(pParse, pDest) ){\n    return 0;   /* tab1 must not have triggers */\n  }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( pDest->tabFlags & TF_Virtual ){\n    return 0;   /* tab1 must not be a virtual table */\n  }\n#endif\n  if( onError==OE_Default ){\n    if( pDest->iPKey>=0 ) onError = pDest->keyConf;\n    if( onError==OE_Default ) onError = OE_Abort;\n  }\n  assert(pSelect->pSrc);   /* allocated even if there is no FROM clause */\n  if( pSelect->pSrc->nSrc!=1 ){\n    return 0;   /* FROM clause must have exactly one term */\n  }\n  if( pSelect->pSrc->a[0].pSelect ){\n    return 0;   /* FROM clause cannot contain a subquery */\n  }\n  if( pSelect->pWhere ){\n    return 0;   /* SELECT may not have a WHERE clause */\n  }\n  if( pSelect->pOrderBy ){\n    return 0;   /* SELECT may not have an ORDER BY clause */\n  }\n  /* Do not need to test for a HAVING clause.  If HAVING is present but\n  ** there is no ORDER BY, we will get an error. */\n  if( pSelect->pGroupBy ){\n    return 0;   /* SELECT may not have a GROUP BY clause */\n  }\n  if( pSelect->pLimit ){\n    return 0;   /* SELECT may not have a LIMIT clause */\n  }\n  assert( pSelect->pOffset==0 );  /* Must be so if pLimit==0 */\n  if( pSelect->pPrior ){\n    return 0;   /* SELECT may not be a compound query */\n  }\n  if( pSelect->selFlags & SF_Distinct ){\n    return 0;   /* SELECT may not be DISTINCT */\n  }\n  pEList = pSelect->pEList;\n  assert( pEList!=0 );\n  if( pEList->nExpr!=1 ){\n    return 0;   /* The result set must have exactly one column */\n  }\n  assert( pEList->a[0].pExpr );\n  if( pEList->a[0].pExpr->op!=TK_ASTERISK ){\n    return 0;   /* The result set must be the special operator \"*\" */\n  }\n\n  /* At this point we have established that the statement is of the\n  ** correct syntactic form to participate in this optimization.  Now\n  ** we have to check the semantics.\n  */\n  pItem = pSelect->pSrc->a;\n  pSrc = sqlite3LocateTableItem(pParse, 0, pItem);\n  if( pSrc==0 ){\n    return 0;   /* FROM clause does not contain a real table */\n  }\n  if( pSrc==pDest ){\n    return 0;   /* tab1 and tab2 may not be the same table */\n  }\n  if( HasRowid(pDest)!=HasRowid(pSrc) ){\n    return 0;   /* source and destination must both be WITHOUT ROWID or not */\n  }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if( pSrc->tabFlags & TF_Virtual ){\n    return 0;   /* tab2 must not be a virtual table */\n  }\n#endif\n  if( pSrc->pSelect ){\n    return 0;   /* tab2 may not be a view */\n  }\n  if( pDest->nCol!=pSrc->nCol ){\n    return 0;   /* Number of columns must be the same in tab1 and tab2 */\n  }\n  if( pDest->iPKey!=pSrc->iPKey ){\n    return 0;   /* Both tables must have the same INTEGER PRIMARY KEY */\n  }\n  for(i=0; i<pDest->nCol; i++){\n    Column *pDestCol = &pDest->aCol[i];\n    Column *pSrcCol = &pSrc->aCol[i];\n#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS\n    if( (db->flags & SQLITE_Vacuum)==0 \n     && (pDestCol->colFlags | pSrcCol->colFlags) & COLFLAG_HIDDEN \n    ){\n      return 0;    /* Neither table may have __hidden__ columns */\n    }\n#endif\n    if( pDestCol->affinity!=pSrcCol->affinity ){\n      return 0;    /* Affinity must be the same on all columns */\n    }\n    if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){\n      return 0;    /* Collating sequence must be the same on all columns */\n    }\n    if( pDestCol->notNull && !pSrcCol->notNull ){\n      return 0;    /* tab2 must be NOT NULL if tab1 is */\n    }\n    /* Default values for second and subsequent columns need to match. */\n    if( i>0 ){\n      assert( pDestCol->pDflt==0 || pDestCol->pDflt->op==TK_SPAN );\n      assert( pSrcCol->pDflt==0 || pSrcCol->pDflt->op==TK_SPAN );\n      if( (pDestCol->pDflt==0)!=(pSrcCol->pDflt==0) \n       || (pDestCol->pDflt && strcmp(pDestCol->pDflt->u.zToken,\n                                       pSrcCol->pDflt->u.zToken)!=0)\n      ){\n        return 0;    /* Default values must be the same for all columns */\n      }\n    }\n  }\n  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){\n    if( IsUniqueIndex(pDestIdx) ){\n      destHasUniqueIdx = 1;\n    }\n    for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){\n      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;\n    }\n    if( pSrcIdx==0 ){\n      return 0;    /* pDestIdx has no corresponding index in pSrc */\n    }\n  }\n#ifndef SQLITE_OMIT_CHECK\n  if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){\n    return 0;   /* Tables have different CHECK constraints.  Ticket #2252 */\n  }\n#endif\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n  /* Disallow the transfer optimization if the destination table constains\n  ** any foreign key constraints.  This is more restrictive than necessary.\n  ** But the main beneficiary of the transfer optimization is the VACUUM \n  ** command, and the VACUUM command disables foreign key constraints.  So\n  ** the extra complication to make this rule less restrictive is probably\n  ** not worth the effort.  Ticket [6284df89debdfa61db8073e062908af0c9b6118e]\n  */\n  if( (db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){\n    return 0;\n  }\n#endif\n  if( (db->flags & SQLITE_CountRows)!=0 ){\n    return 0;  /* xfer opt does not play well with PRAGMA count_changes */\n  }\n\n  /* If we get this far, it means that the xfer optimization is at\n  ** least a possibility, though it might only work if the destination\n  ** table (tab1) is initially empty.\n  */\n#ifdef SQLITE_TEST\n  sqlite3_xferopt_count++;\n#endif\n  iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);\n  v = sqlite3GetVdbe(pParse);\n  sqlite3CodeVerifySchema(pParse, iDbSrc);\n  iSrc = pParse->nTab++;\n  iDest = pParse->nTab++;\n  regAutoinc = autoIncBegin(pParse, iDbDest, pDest);\n  regData = sqlite3GetTempReg(pParse);\n  regRowid = sqlite3GetTempReg(pParse);\n  sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);\n  assert( HasRowid(pDest) || destHasUniqueIdx );\n  if( (db->flags & SQLITE_Vacuum)==0 && (\n      (pDest->iPKey<0 && pDest->pIndex!=0)          /* (1) */\n   || destHasUniqueIdx                              /* (2) */\n   || (onError!=OE_Abort && onError!=OE_Rollback)   /* (3) */\n  )){\n    /* In some circumstances, we are able to run the xfer optimization\n    ** only if the destination table is initially empty. Unless the\n    ** SQLITE_Vacuum flag is set, this block generates code to make\n    ** that determination. If SQLITE_Vacuum is set, then the destination\n    ** table is always empty.\n    **\n    ** Conditions under which the destination must be empty:\n    **\n    ** (1) There is no INTEGER PRIMARY KEY but there are indices.\n    **     (If the destination is not initially empty, the rowid fields\n    **     of index entries might need to change.)\n    **\n    ** (2) The destination has a unique index.  (The xfer optimization \n    **     is unable to test uniqueness.)\n    **\n    ** (3) onError is something other than OE_Abort and OE_Rollback.\n    */\n    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0); VdbeCoverage(v);\n    emptyDestTest = sqlite3VdbeAddOp0(v, OP_Goto);\n    sqlite3VdbeJumpHere(v, addr1);\n  }\n  if( HasRowid(pSrc) ){\n    sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);\n    emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);\n    if( pDest->iPKey>=0 ){\n      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);\n      addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);\n      VdbeCoverage(v);\n      sqlite3RowidConstraint(pParse, onError, pDest);\n      sqlite3VdbeJumpHere(v, addr2);\n      autoIncStep(pParse, regAutoinc, regRowid);\n    }else if( pDest->pIndex==0 ){\n      addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);\n    }else{\n      addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);\n      assert( (pDest->tabFlags & TF_Autoincrement)==0 );\n    }\n    sqlite3VdbeAddOp2(v, OP_RowData, iSrc, regData);\n    sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,\n                      (char*)pDest, P4_TABLE);\n    sqlite3VdbeChangeP5(v, OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND);\n    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);\n    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);\n    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);\n  }else{\n    sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);\n    sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);\n  }\n  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){\n    u8 idxInsFlags = 0;\n    for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){\n      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;\n    }\n    assert( pSrcIdx );\n    sqlite3VdbeAddOp3(v, OP_OpenRead, iSrc, pSrcIdx->tnum, iDbSrc);\n    sqlite3VdbeSetP4KeyInfo(pParse, pSrcIdx);\n    VdbeComment((v, \"%s\", pSrcIdx->zName));\n    sqlite3VdbeAddOp3(v, OP_OpenWrite, iDest, pDestIdx->tnum, iDbDest);\n    sqlite3VdbeSetP4KeyInfo(pParse, pDestIdx);\n    sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR);\n    VdbeComment((v, \"%s\", pDestIdx->zName));\n    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);\n    sqlite3VdbeAddOp2(v, OP_RowKey, iSrc, regData);\n    if( db->flags & SQLITE_Vacuum ){\n      /* This INSERT command is part of a VACUUM operation, which guarantees\n      ** that the destination table is empty. If all indexed columns use\n      ** collation sequence BINARY, then it can also be assumed that the\n      ** index will be populated by inserting keys in strictly sorted \n      ** order. In this case, instead of seeking within the b-tree as part\n      ** of every OP_IdxInsert opcode, an OP_Last is added before the\n      ** OP_IdxInsert to seek to the point within the b-tree where each key \n      ** should be inserted. This is faster.\n      **\n      ** If any of the indexed columns use a collation sequence other than\n      ** BINARY, this optimization is disabled. This is because the user \n      ** might change the definition of a collation sequence and then run\n      ** a VACUUM command. In that case keys may not be written in strictly\n      ** sorted order.  */\n      for(i=0; i<pSrcIdx->nColumn; i++){\n        const char *zColl = pSrcIdx->azColl[i];\n        assert( sqlite3_stricmp(sqlite3StrBINARY, zColl)!=0\n                    || sqlite3StrBINARY==zColl );\n        if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;\n      }\n      if( i==pSrcIdx->nColumn ){\n        idxInsFlags = OPFLAG_USESEEKRESULT;\n        sqlite3VdbeAddOp3(v, OP_Last, iDest, 0, -1);\n      }\n    }\n    if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){\n      idxInsFlags |= OPFLAG_NCHANGE;\n    }\n    sqlite3VdbeAddOp3(v, OP_IdxInsert, iDest, regData, 1);\n    sqlite3VdbeChangeP5(v, idxInsFlags);\n    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);\n    sqlite3VdbeJumpHere(v, addr1);\n    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);\n    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);\n  }\n  if( emptySrcTest ) sqlite3VdbeJumpHere(v, emptySrcTest);\n  sqlite3ReleaseTempReg(pParse, regRowid);\n  sqlite3ReleaseTempReg(pParse, regData);\n  if( emptyDestTest ){\n    sqlite3AutoincrementEnd(pParse);\n    sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0);\n    sqlite3VdbeJumpHere(v, emptyDestTest);\n    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);\n    return 0;\n  }else{\n    return 1;\n  }\n}\n#endif /* SQLITE_OMIT_XFER_OPT */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/legacy.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Main file for the SQLite library.  The routines in this file\n** implement the programmer interface to the library.  Routines in\n** other files are for internal use by SQLite and should not be\n** accessed by users of the library.\n*/\n\n#include \"sqliteInt.h\"\n\n/*\n** Execute SQL code.  Return one of the SQLITE_ success/failure\n** codes.  Also write an error message into memory obtained from\n** malloc() and make *pzErrMsg point to that message.\n**\n** If the SQL is a query, then for each row in the query result\n** the xCallback() function is called.  pArg becomes the first\n** argument to xCallback().  If xCallback=NULL then no callback\n** is invoked, even for queries.\n*/\nint sqlite3_exec(\n  sqlite3 *db,                /* The database on which the SQL executes */\n  const char *zSql,           /* The SQL to be executed */\n  sqlite3_callback xCallback, /* Invoke this callback routine */\n  void *pArg,                 /* First argument to xCallback() */\n  char **pzErrMsg             /* Write error messages here */\n){\n  int rc = SQLITE_OK;         /* Return code */\n  const char *zLeftover;      /* Tail of unprocessed SQL */\n  sqlite3_stmt *pStmt = 0;    /* The current SQL statement */\n  char **azCols = 0;          /* Names of result columns */\n  int callbackIsInit;         /* True if callback data is initialized */\n\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n  if( zSql==0 ) zSql = \"\";\n\n  sqlite3_mutex_enter(db->mutex);\n  sqlite3Error(db, SQLITE_OK);\n  while( rc==SQLITE_OK && zSql[0] ){\n    int nCol;\n    char **azVals = 0;\n\n    pStmt = 0;\n    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);\n    assert( rc==SQLITE_OK || pStmt==0 );\n    if( rc!=SQLITE_OK ){\n      continue;\n    }\n    if( !pStmt ){\n      /* this happens for a comment or white-space */\n      zSql = zLeftover;\n      continue;\n    }\n\n    callbackIsInit = 0;\n    nCol = sqlite3_column_count(pStmt);\n\n    while( 1 ){\n      int i;\n      rc = sqlite3_step(pStmt);\n\n      /* Invoke the callback function if required */\n      if( xCallback && (SQLITE_ROW==rc || \n          (SQLITE_DONE==rc && !callbackIsInit\n                           && db->flags&SQLITE_NullCallback)) ){\n        if( !callbackIsInit ){\n          azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1);\n          if( azCols==0 ){\n            goto exec_out;\n          }\n          for(i=0; i<nCol; i++){\n            azCols[i] = (char *)sqlite3_column_name(pStmt, i);\n            /* sqlite3VdbeSetColName() installs column names as UTF8\n            ** strings so there is no way for sqlite3_column_name() to fail. */\n            assert( azCols[i]!=0 );\n          }\n          callbackIsInit = 1;\n        }\n        if( rc==SQLITE_ROW ){\n          azVals = &azCols[nCol];\n          for(i=0; i<nCol; i++){\n            azVals[i] = (char *)sqlite3_column_text(pStmt, i);\n            if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){\n              sqlite3OomFault(db);\n              goto exec_out;\n            }\n          }\n        }\n        if( xCallback(pArg, nCol, azVals, azCols) ){\n          /* EVIDENCE-OF: R-38229-40159 If the callback function to\n          ** sqlite3_exec() returns non-zero, then sqlite3_exec() will\n          ** return SQLITE_ABORT. */\n          rc = SQLITE_ABORT;\n          sqlite3VdbeFinalize((Vdbe *)pStmt);\n          pStmt = 0;\n          sqlite3Error(db, SQLITE_ABORT);\n          goto exec_out;\n        }\n      }\n\n      if( rc!=SQLITE_ROW ){\n        rc = sqlite3VdbeFinalize((Vdbe *)pStmt);\n        pStmt = 0;\n        zSql = zLeftover;\n        while( sqlite3Isspace(zSql[0]) ) zSql++;\n        break;\n      }\n    }\n\n    sqlite3DbFree(db, azCols);\n    azCols = 0;\n  }\n\nexec_out:\n  if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt);\n  sqlite3DbFree(db, azCols);\n\n  rc = sqlite3ApiExit(db, rc);\n  if( rc!=SQLITE_OK && pzErrMsg ){\n    int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db));\n    *pzErrMsg = sqlite3Malloc(nErrMsg);\n    if( *pzErrMsg ){\n      memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);\n    }else{\n      rc = SQLITE_NOMEM_BKPT;\n      sqlite3Error(db, SQLITE_NOMEM);\n    }\n  }else if( pzErrMsg ){\n    *pzErrMsg = 0;\n  }\n\n  assert( (rc&db->errMask)==rc );\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/loadext.c",
    "content": "/*\n** 2006 June 7\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used to dynamically load extensions into\n** the SQLite library.\n*/\n\n#ifndef SQLITE_CORE\n  #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */\n#endif\n#include \"sqlite3ext.h\"\n#include \"sqliteInt.h\"\n#include <string.h>\n\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\n/*\n** Some API routines are omitted when various features are\n** excluded from a build of SQLite.  Substitute a NULL pointer\n** for any missing APIs.\n*/\n#ifndef SQLITE_ENABLE_COLUMN_METADATA\n# define sqlite3_column_database_name   0\n# define sqlite3_column_database_name16 0\n# define sqlite3_column_table_name      0\n# define sqlite3_column_table_name16    0\n# define sqlite3_column_origin_name     0\n# define sqlite3_column_origin_name16   0\n#endif\n\n#ifdef SQLITE_OMIT_AUTHORIZATION\n# define sqlite3_set_authorizer         0\n#endif\n\n#ifdef SQLITE_OMIT_UTF16\n# define sqlite3_bind_text16            0\n# define sqlite3_collation_needed16     0\n# define sqlite3_column_decltype16      0\n# define sqlite3_column_name16          0\n# define sqlite3_column_text16          0\n# define sqlite3_complete16             0\n# define sqlite3_create_collation16     0\n# define sqlite3_create_function16      0\n# define sqlite3_errmsg16               0\n# define sqlite3_open16                 0\n# define sqlite3_prepare16              0\n# define sqlite3_prepare16_v2           0\n# define sqlite3_result_error16         0\n# define sqlite3_result_text16          0\n# define sqlite3_result_text16be        0\n# define sqlite3_result_text16le        0\n# define sqlite3_value_text16           0\n# define sqlite3_value_text16be         0\n# define sqlite3_value_text16le         0\n# define sqlite3_column_database_name16 0\n# define sqlite3_column_table_name16    0\n# define sqlite3_column_origin_name16   0\n#endif\n\n#ifdef SQLITE_OMIT_COMPLETE\n# define sqlite3_complete 0\n# define sqlite3_complete16 0\n#endif\n\n#ifdef SQLITE_OMIT_DECLTYPE\n# define sqlite3_column_decltype16      0\n# define sqlite3_column_decltype        0\n#endif\n\n#ifdef SQLITE_OMIT_PROGRESS_CALLBACK\n# define sqlite3_progress_handler 0\n#endif\n\n#ifdef SQLITE_OMIT_VIRTUALTABLE\n# define sqlite3_create_module 0\n# define sqlite3_create_module_v2 0\n# define sqlite3_declare_vtab 0\n# define sqlite3_vtab_config 0\n# define sqlite3_vtab_on_conflict 0\n#endif\n\n#ifdef SQLITE_OMIT_SHARED_CACHE\n# define sqlite3_enable_shared_cache 0\n#endif\n\n#if defined(SQLITE_OMIT_TRACE) || defined(SQLITE_OMIT_DEPRECATED)\n# define sqlite3_profile       0\n# define sqlite3_trace         0\n#endif\n\n#ifdef SQLITE_OMIT_GET_TABLE\n# define sqlite3_free_table    0\n# define sqlite3_get_table     0\n#endif\n\n#ifdef SQLITE_OMIT_INCRBLOB\n#define sqlite3_bind_zeroblob  0\n#define sqlite3_blob_bytes     0\n#define sqlite3_blob_close     0\n#define sqlite3_blob_open      0\n#define sqlite3_blob_read      0\n#define sqlite3_blob_write     0\n#define sqlite3_blob_reopen    0\n#endif\n\n#if defined(SQLITE_OMIT_TRACE)\n# define sqlite3_trace_v2      0\n#endif\n\n/*\n** The following structure contains pointers to all SQLite API routines.\n** A pointer to this structure is passed into extensions when they are\n** loaded so that the extension can make calls back into the SQLite\n** library.\n**\n** When adding new APIs, add them to the bottom of this structure\n** in order to preserve backwards compatibility.\n**\n** Extensions that use newer APIs should first call the\n** sqlite3_libversion_number() to make sure that the API they\n** intend to use is supported by the library.  Extensions should\n** also check to make sure that the pointer to the function is\n** not NULL before calling it.\n*/\n#ifdef SQLITE_HAS_CODEC\nstatic const sqlcipher_api_routines sqlcipherApis = {\n  sqlcipher_register_provider,\n  sqlcipher_get_provider,\n  sqlite3_key,\n  sqlite3_key_v2,\n  sqlite3_rekey,\n  sqlite3_rekey_v2,\n\n#ifdef SQLCIPHER_CRYPTO_CUSTOM\n  sqlcipher_register_custom_provider,\n  sqlcipher_unregister_custom_provider,\n  sqlcipher_get_fallback_provider,\n#else\n  0,\n  0,\n  0,\n#endif\n};\n#endif\n\nstatic const sqlite3_api_routines sqlite3Apis = {\n  sqlite3_aggregate_context,\n#ifndef SQLITE_OMIT_DEPRECATED\n  sqlite3_aggregate_count,\n#else\n  0,\n#endif\n  sqlite3_bind_blob,\n  sqlite3_bind_double,\n  sqlite3_bind_int,\n  sqlite3_bind_int64,\n  sqlite3_bind_null,\n  sqlite3_bind_parameter_count,\n  sqlite3_bind_parameter_index,\n  sqlite3_bind_parameter_name,\n  sqlite3_bind_text,\n  sqlite3_bind_text16,\n  sqlite3_bind_value,\n  sqlite3_busy_handler,\n  sqlite3_busy_timeout,\n  sqlite3_changes,\n  sqlite3_close,\n  sqlite3_collation_needed,\n  sqlite3_collation_needed16,\n  sqlite3_column_blob,\n  sqlite3_column_bytes,\n  sqlite3_column_bytes16,\n  sqlite3_column_count,\n  sqlite3_column_database_name,\n  sqlite3_column_database_name16,\n  sqlite3_column_decltype,\n  sqlite3_column_decltype16,\n  sqlite3_column_double,\n  sqlite3_column_int,\n  sqlite3_column_int64,\n  sqlite3_column_name,\n  sqlite3_column_name16,\n  sqlite3_column_origin_name,\n  sqlite3_column_origin_name16,\n  sqlite3_column_table_name,\n  sqlite3_column_table_name16,\n  sqlite3_column_text,\n  sqlite3_column_text16,\n  sqlite3_column_type,\n  sqlite3_column_value,\n  sqlite3_commit_hook,\n  sqlite3_complete,\n  sqlite3_complete16,\n  sqlite3_create_collation,\n  sqlite3_create_collation16,\n  sqlite3_create_function,\n  sqlite3_create_function16,\n  sqlite3_create_module,\n  sqlite3_data_count,\n  sqlite3_db_handle,\n  sqlite3_declare_vtab,\n  sqlite3_enable_shared_cache,\n  sqlite3_errcode,\n  sqlite3_errmsg,\n  sqlite3_errmsg16,\n  sqlite3_exec,\n#ifndef SQLITE_OMIT_DEPRECATED\n  sqlite3_expired,\n#else\n  0,\n#endif\n  sqlite3_finalize,\n  sqlite3_free,\n  sqlite3_free_table,\n  sqlite3_get_autocommit,\n  sqlite3_get_auxdata,\n  sqlite3_get_table,\n\n#ifdef SQLITE_HAS_CODEC  \n  /* Was sqlite3_global_recover(), but that function is deprecated.\n     We 'steal' this slot to place pointers to SQLCipher APIs. */\n  &sqlcipherApis,\n#else\n  0,\n#endif\n  \n  sqlite3_interrupt,\n  sqlite3_last_insert_rowid,\n  sqlite3_libversion,\n  sqlite3_libversion_number,\n  sqlite3_malloc,\n  sqlite3_mprintf,\n  sqlite3_open,\n  sqlite3_open16,\n  sqlite3_prepare,\n  sqlite3_prepare16,\n  sqlite3_profile,\n  sqlite3_progress_handler,\n  sqlite3_realloc,\n  sqlite3_reset,\n  sqlite3_result_blob,\n  sqlite3_result_double,\n  sqlite3_result_error,\n  sqlite3_result_error16,\n  sqlite3_result_int,\n  sqlite3_result_int64,\n  sqlite3_result_null,\n  sqlite3_result_text,\n  sqlite3_result_text16,\n  sqlite3_result_text16be,\n  sqlite3_result_text16le,\n  sqlite3_result_value,\n  sqlite3_rollback_hook,\n  sqlite3_set_authorizer,\n  sqlite3_set_auxdata,\n  sqlite3_snprintf,\n  sqlite3_step,\n  sqlite3_table_column_metadata,\n#ifndef SQLITE_OMIT_DEPRECATED\n  sqlite3_thread_cleanup,\n#else\n  0,\n#endif\n  sqlite3_total_changes,\n  sqlite3_trace,\n#ifndef SQLITE_OMIT_DEPRECATED\n  sqlite3_transfer_bindings,\n#else\n  0,\n#endif\n  sqlite3_update_hook,\n  sqlite3_user_data,\n  sqlite3_value_blob,\n  sqlite3_value_bytes,\n  sqlite3_value_bytes16,\n  sqlite3_value_double,\n  sqlite3_value_int,\n  sqlite3_value_int64,\n  sqlite3_value_numeric_type,\n  sqlite3_value_text,\n  sqlite3_value_text16,\n  sqlite3_value_text16be,\n  sqlite3_value_text16le,\n  sqlite3_value_type,\n  sqlite3_vmprintf,\n  /*\n  ** The original API set ends here.  All extensions can call any\n  ** of the APIs above provided that the pointer is not NULL.  But\n  ** before calling APIs that follow, extension should check the\n  ** sqlite3_libversion_number() to make sure they are dealing with\n  ** a library that is new enough to support that API.\n  *************************************************************************\n  */\n  sqlite3_overload_function,\n\n  /*\n  ** Added after 3.3.13\n  */\n  sqlite3_prepare_v2,\n  sqlite3_prepare16_v2,\n  sqlite3_clear_bindings,\n\n  /*\n  ** Added for 3.4.1\n  */\n  sqlite3_create_module_v2,\n\n  /*\n  ** Added for 3.5.0\n  */\n  sqlite3_bind_zeroblob,\n  sqlite3_blob_bytes,\n  sqlite3_blob_close,\n  sqlite3_blob_open,\n  sqlite3_blob_read,\n  sqlite3_blob_write,\n  sqlite3_create_collation_v2,\n  sqlite3_file_control,\n  sqlite3_memory_highwater,\n  sqlite3_memory_used,\n#ifdef SQLITE_MUTEX_OMIT\n  0, \n  0, \n  0,\n  0,\n  0,\n#else\n  sqlite3_mutex_alloc,\n  sqlite3_mutex_enter,\n  sqlite3_mutex_free,\n  sqlite3_mutex_leave,\n  sqlite3_mutex_try,\n#endif\n  sqlite3_open_v2,\n  sqlite3_release_memory,\n  sqlite3_result_error_nomem,\n  sqlite3_result_error_toobig,\n  sqlite3_sleep,\n  sqlite3_soft_heap_limit,\n  sqlite3_vfs_find,\n  sqlite3_vfs_register,\n  sqlite3_vfs_unregister,\n\n  /*\n  ** Added for 3.5.8\n  */\n  sqlite3_threadsafe,\n  sqlite3_result_zeroblob,\n  sqlite3_result_error_code,\n  sqlite3_test_control,\n  sqlite3_randomness,\n  sqlite3_context_db_handle,\n\n  /*\n  ** Added for 3.6.0\n  */\n  sqlite3_extended_result_codes,\n  sqlite3_limit,\n  sqlite3_next_stmt,\n  sqlite3_sql,\n  sqlite3_status,\n\n  /*\n  ** Added for 3.7.4\n  */\n  sqlite3_backup_finish,\n  sqlite3_backup_init,\n  sqlite3_backup_pagecount,\n  sqlite3_backup_remaining,\n  sqlite3_backup_step,\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\n  sqlite3_compileoption_get,\n  sqlite3_compileoption_used,\n#else\n  0,\n  0,\n#endif\n  sqlite3_create_function_v2,\n  sqlite3_db_config,\n  sqlite3_db_mutex,\n  sqlite3_db_status,\n  sqlite3_extended_errcode,\n  sqlite3_log,\n  sqlite3_soft_heap_limit64,\n  sqlite3_sourceid,\n  sqlite3_stmt_status,\n  sqlite3_strnicmp,\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\n  sqlite3_unlock_notify,\n#else\n  0,\n#endif\n#ifndef SQLITE_OMIT_WAL\n  sqlite3_wal_autocheckpoint,\n  sqlite3_wal_checkpoint,\n  sqlite3_wal_hook,\n#else\n  0,\n  0,\n  0,\n#endif\n  sqlite3_blob_reopen,\n  sqlite3_vtab_config,\n  sqlite3_vtab_on_conflict,\n  sqlite3_close_v2,\n  sqlite3_db_filename,\n  sqlite3_db_readonly,\n  sqlite3_db_release_memory,\n  sqlite3_errstr,\n  sqlite3_stmt_busy,\n  sqlite3_stmt_readonly,\n  sqlite3_stricmp,\n  sqlite3_uri_boolean,\n  sqlite3_uri_int64,\n  sqlite3_uri_parameter,\n  sqlite3_vsnprintf,\n  sqlite3_wal_checkpoint_v2,\n  /* Version 3.8.7 and later */\n  sqlite3_auto_extension,\n  sqlite3_bind_blob64,\n  sqlite3_bind_text64,\n  sqlite3_cancel_auto_extension,\n  sqlite3_load_extension,\n  sqlite3_malloc64,\n  sqlite3_msize,\n  sqlite3_realloc64,\n  sqlite3_reset_auto_extension,\n  sqlite3_result_blob64,\n  sqlite3_result_text64,\n  sqlite3_strglob,\n  /* Version 3.8.11 and later */\n  (sqlite3_value*(*)(const sqlite3_value*))sqlite3_value_dup,\n  sqlite3_value_free,\n  sqlite3_result_zeroblob64,\n  sqlite3_bind_zeroblob64,\n  /* Version 3.9.0 and later */\n  sqlite3_value_subtype,\n  sqlite3_result_subtype,\n  /* Version 3.10.0 and later */\n  sqlite3_status64,\n  sqlite3_strlike,\n  sqlite3_db_cacheflush,\n  /* Version 3.12.0 and later */\n  sqlite3_system_errno,\n  /* Version 3.14.0 and later */\n  sqlite3_trace_v2,\n  sqlite3_expanded_sql\n};\n\n/*\n** Attempt to load an SQLite extension library contained in the file\n** zFile.  The entry point is zProc.  zProc may be 0 in which case a\n** default entry point name (sqlite3_extension_init) is used.  Use\n** of the default name is recommended.\n**\n** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong.\n**\n** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with \n** error message text.  The calling function should free this memory\n** by calling sqlite3DbFree(db, ).\n*/\nstatic int sqlite3LoadExtension(\n  sqlite3 *db,          /* Load the extension into this database connection */\n  const char *zFile,    /* Name of the shared library containing extension */\n  const char *zProc,    /* Entry point.  Use \"sqlite3_extension_init\" if 0 */\n  char **pzErrMsg       /* Put error message here if not 0 */\n){\n  sqlite3_vfs *pVfs = db->pVfs;\n  void *handle;\n  sqlite3_loadext_entry xInit;\n  char *zErrmsg = 0;\n  const char *zEntry;\n  char *zAltEntry = 0;\n  void **aHandle;\n  u64 nMsg = 300 + sqlite3Strlen30(zFile);\n  int ii;\n  int rc;\n\n  /* Shared library endings to try if zFile cannot be loaded as written */\n  static const char *azEndings[] = {\n#if SQLITE_OS_WIN\n     \"dll\"   \n#elif defined(__APPLE__)\n     \"dylib\"\n#else\n     \"so\"\n#endif\n  };\n\n\n  if( pzErrMsg ) *pzErrMsg = 0;\n\n  /* Ticket #1863.  To avoid a creating security problems for older\n  ** applications that relink against newer versions of SQLite, the\n  ** ability to run load_extension is turned off by default.  One\n  ** must call either sqlite3_enable_load_extension(db) or\n  ** sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, 0)\n  ** to turn on extension loading.\n  */\n  if( (db->flags & SQLITE_LoadExtension)==0 ){\n    if( pzErrMsg ){\n      *pzErrMsg = sqlite3_mprintf(\"not authorized\");\n    }\n    return SQLITE_ERROR;\n  }\n\n  zEntry = zProc ? zProc : \"sqlite3_extension_init\";\n\n  handle = sqlite3OsDlOpen(pVfs, zFile);\n#if SQLITE_OS_UNIX || SQLITE_OS_WIN\n  for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){\n    char *zAltFile = sqlite3_mprintf(\"%s.%s\", zFile, azEndings[ii]);\n    if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;\n    handle = sqlite3OsDlOpen(pVfs, zAltFile);\n    sqlite3_free(zAltFile);\n  }\n#endif\n  if( handle==0 ){\n    if( pzErrMsg ){\n      *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg);\n      if( zErrmsg ){\n        sqlite3_snprintf(nMsg, zErrmsg, \n            \"unable to open shared library [%s]\", zFile);\n        sqlite3OsDlError(pVfs, nMsg-1, zErrmsg);\n      }\n    }\n    return SQLITE_ERROR;\n  }\n  xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);\n\n  /* If no entry point was specified and the default legacy\n  ** entry point name \"sqlite3_extension_init\" was not found, then\n  ** construct an entry point name \"sqlite3_X_init\" where the X is\n  ** replaced by the lowercase value of every ASCII alphabetic \n  ** character in the filename after the last \"/\" upto the first \".\",\n  ** and eliding the first three characters if they are \"lib\".  \n  ** Examples:\n  **\n  **    /usr/local/lib/libExample5.4.3.so ==>  sqlite3_example_init\n  **    C:/lib/mathfuncs.dll              ==>  sqlite3_mathfuncs_init\n  */\n  if( xInit==0 && zProc==0 ){\n    int iFile, iEntry, c;\n    int ncFile = sqlite3Strlen30(zFile);\n    zAltEntry = sqlite3_malloc64(ncFile+30);\n    if( zAltEntry==0 ){\n      sqlite3OsDlClose(pVfs, handle);\n      return SQLITE_NOMEM_BKPT;\n    }\n    memcpy(zAltEntry, \"sqlite3_\", 8);\n    for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){}\n    iFile++;\n    if( sqlite3_strnicmp(zFile+iFile, \"lib\", 3)==0 ) iFile += 3;\n    for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){\n      if( sqlite3Isalpha(c) ){\n        zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];\n      }\n    }\n    memcpy(zAltEntry+iEntry, \"_init\", 6);\n    zEntry = zAltEntry;\n    xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);\n  }\n  if( xInit==0 ){\n    if( pzErrMsg ){\n      nMsg += sqlite3Strlen30(zEntry);\n      *pzErrMsg = zErrmsg = sqlite3_malloc64(nMsg);\n      if( zErrmsg ){\n        sqlite3_snprintf(nMsg, zErrmsg,\n            \"no entry point [%s] in shared library [%s]\", zEntry, zFile);\n        sqlite3OsDlError(pVfs, nMsg-1, zErrmsg);\n      }\n    }\n    sqlite3OsDlClose(pVfs, handle);\n    sqlite3_free(zAltEntry);\n    return SQLITE_ERROR;\n  }\n  sqlite3_free(zAltEntry);\n  rc = xInit(db, &zErrmsg, &sqlite3Apis);\n  if( rc ){\n    if( rc==SQLITE_OK_LOAD_PERMANENTLY ) return SQLITE_OK;\n    if( pzErrMsg ){\n      *pzErrMsg = sqlite3_mprintf(\"error during initialization: %s\", zErrmsg);\n    }\n    sqlite3_free(zErrmsg);\n    sqlite3OsDlClose(pVfs, handle);\n    return SQLITE_ERROR;\n  }\n\n  /* Append the new shared library handle to the db->aExtension array. */\n  aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1));\n  if( aHandle==0 ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  if( db->nExtension>0 ){\n    memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension);\n  }\n  sqlite3DbFree(db, db->aExtension);\n  db->aExtension = aHandle;\n\n  db->aExtension[db->nExtension++] = handle;\n  return SQLITE_OK;\n}\nint sqlite3_load_extension(\n  sqlite3 *db,          /* Load the extension into this database connection */\n  const char *zFile,    /* Name of the shared library containing extension */\n  const char *zProc,    /* Entry point.  Use \"sqlite3_extension_init\" if 0 */\n  char **pzErrMsg       /* Put error message here if not 0 */\n){\n  int rc;\n  sqlite3_mutex_enter(db->mutex);\n  rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg);\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** Call this routine when the database connection is closing in order\n** to clean up loaded extensions\n*/\nvoid sqlite3CloseExtensions(sqlite3 *db){\n  int i;\n  assert( sqlite3_mutex_held(db->mutex) );\n  for(i=0; i<db->nExtension; i++){\n    sqlite3OsDlClose(db->pVfs, db->aExtension[i]);\n  }\n  sqlite3DbFree(db, db->aExtension);\n}\n\n/*\n** Enable or disable extension loading.  Extension loading is disabled by\n** default so as not to open security holes in older applications.\n*/\nint sqlite3_enable_load_extension(sqlite3 *db, int onoff){\n  sqlite3_mutex_enter(db->mutex);\n  if( onoff ){\n    db->flags |= SQLITE_LoadExtension|SQLITE_LoadExtFunc;\n  }else{\n    db->flags &= ~(SQLITE_LoadExtension|SQLITE_LoadExtFunc);\n  }\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n\n#endif /* !defined(SQLITE_OMIT_LOAD_EXTENSION) */\n\n/*\n** The following object holds the list of automatically loaded\n** extensions.\n**\n** This list is shared across threads.  The SQLITE_MUTEX_STATIC_MASTER\n** mutex must be held while accessing this list.\n*/\ntypedef struct sqlite3AutoExtList sqlite3AutoExtList;\nstatic SQLITE_WSD struct sqlite3AutoExtList {\n  u32 nExt;              /* Number of entries in aExt[] */          \n  void (**aExt)(void);   /* Pointers to the extension init functions */\n} sqlite3Autoext = { 0, 0 };\n\n/* The \"wsdAutoext\" macro will resolve to the autoextension\n** state vector.  If writable static data is unsupported on the target,\n** we have to locate the state vector at run-time.  In the more common\n** case where writable static data is supported, wsdStat can refer directly\n** to the \"sqlite3Autoext\" state vector declared above.\n*/\n#ifdef SQLITE_OMIT_WSD\n# define wsdAutoextInit \\\n  sqlite3AutoExtList *x = &GLOBAL(sqlite3AutoExtList,sqlite3Autoext)\n# define wsdAutoext x[0]\n#else\n# define wsdAutoextInit\n# define wsdAutoext sqlite3Autoext\n#endif\n\n\n/*\n** Register a statically linked extension that is automatically\n** loaded by every new database connection.\n*/\nint sqlite3_auto_extension(\n  void (*xInit)(void)\n){\n  int rc = SQLITE_OK;\n#ifndef SQLITE_OMIT_AUTOINIT\n  rc = sqlite3_initialize();\n  if( rc ){\n    return rc;\n  }else\n#endif\n  {\n    u32 i;\n#if SQLITE_THREADSAFE\n    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n#endif\n    wsdAutoextInit;\n    sqlite3_mutex_enter(mutex);\n    for(i=0; i<wsdAutoext.nExt; i++){\n      if( wsdAutoext.aExt[i]==xInit ) break;\n    }\n    if( i==wsdAutoext.nExt ){\n      u64 nByte = (wsdAutoext.nExt+1)*sizeof(wsdAutoext.aExt[0]);\n      void (**aNew)(void);\n      aNew = sqlite3_realloc64(wsdAutoext.aExt, nByte);\n      if( aNew==0 ){\n        rc = SQLITE_NOMEM_BKPT;\n      }else{\n        wsdAutoext.aExt = aNew;\n        wsdAutoext.aExt[wsdAutoext.nExt] = xInit;\n        wsdAutoext.nExt++;\n      }\n    }\n    sqlite3_mutex_leave(mutex);\n    assert( (rc&0xff)==rc );\n    return rc;\n  }\n}\n\n/*\n** Cancel a prior call to sqlite3_auto_extension.  Remove xInit from the\n** set of routines that is invoked for each new database connection, if it\n** is currently on the list.  If xInit is not on the list, then this\n** routine is a no-op.\n**\n** Return 1 if xInit was found on the list and removed.  Return 0 if xInit\n** was not on the list.\n*/\nint sqlite3_cancel_auto_extension(\n  void (*xInit)(void)\n){\n#if SQLITE_THREADSAFE\n  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n#endif\n  int i;\n  int n = 0;\n  wsdAutoextInit;\n  sqlite3_mutex_enter(mutex);\n  for(i=(int)wsdAutoext.nExt-1; i>=0; i--){\n    if( wsdAutoext.aExt[i]==xInit ){\n      wsdAutoext.nExt--;\n      wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt];\n      n++;\n      break;\n    }\n  }\n  sqlite3_mutex_leave(mutex);\n  return n;\n}\n\n/*\n** Reset the automatic extension loading mechanism.\n*/\nvoid sqlite3_reset_auto_extension(void){\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize()==SQLITE_OK )\n#endif\n  {\n#if SQLITE_THREADSAFE\n    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n#endif\n    wsdAutoextInit;\n    sqlite3_mutex_enter(mutex);\n    sqlite3_free(wsdAutoext.aExt);\n    wsdAutoext.aExt = 0;\n    wsdAutoext.nExt = 0;\n    sqlite3_mutex_leave(mutex);\n  }\n}\n\n/*\n** Load all automatic extensions.\n**\n** If anything goes wrong, set an error in the database connection.\n*/\nvoid sqlite3AutoLoadExtensions(sqlite3 *db){\n  u32 i;\n  int go = 1;\n  int rc;\n  sqlite3_loadext_entry xInit;\n\n  wsdAutoextInit;\n  if( wsdAutoext.nExt==0 ){\n    /* Common case: early out without every having to acquire a mutex */\n    return;\n  }\n  for(i=0; go; i++){\n    char *zErrmsg;\n#if SQLITE_THREADSAFE\n    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n#endif\n#ifdef SQLITE_OMIT_LOAD_EXTENSION\n    const sqlite3_api_routines *pThunk = 0;\n#else\n    const sqlite3_api_routines *pThunk = &sqlite3Apis;\n#endif\n    sqlite3_mutex_enter(mutex);\n    if( i>=wsdAutoext.nExt ){\n      xInit = 0;\n      go = 0;\n    }else{\n      xInit = (sqlite3_loadext_entry)wsdAutoext.aExt[i];\n    }\n    sqlite3_mutex_leave(mutex);\n    zErrmsg = 0;\n    if( xInit && (rc = xInit(db, &zErrmsg, pThunk))!=0 ){\n      sqlite3ErrorWithMsg(db, rc,\n            \"automatic extension loading failed: %s\", zErrmsg);\n      go = 0;\n    }\n    sqlite3_free(zErrmsg);\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/main.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Main file for the SQLite library.  The routines in this file\n** implement the programmer interface to the library.  Routines in\n** other files are for internal use by SQLite and should not be\n** accessed by users of the library.\n*/\n#include \"sqliteInt.h\"\n\n#ifdef SQLITE_ENABLE_FTS3\n# include \"fts3.h\"\n#endif\n#ifdef SQLITE_ENABLE_RTREE\n# include \"rtree.h\"\n#endif\n#ifdef SQLITE_ENABLE_ICU\n# include \"sqliteicu.h\"\n#endif\n#ifdef SQLITE_ENABLE_JSON1\nint sqlite3Json1Init(sqlite3*);\n#endif\n#ifdef SQLITE_ENABLE_FTS5\nint sqlite3Fts5Init(sqlite3*);\n#endif\n\n#ifndef SQLITE_AMALGAMATION\n/* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant\n** contains the text of SQLITE_VERSION macro. \n*/\nconst char sqlite3_version[] = SQLITE_VERSION;\n#endif\n\n/* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns\n** a pointer to the to the sqlite3_version[] string constant. \n*/\nconst char *sqlite3_libversion(void){ return sqlite3_version; }\n\n/* IMPLEMENTATION-OF: R-63124-39300 The sqlite3_sourceid() function returns a\n** pointer to a string constant whose value is the same as the\n** SQLITE_SOURCE_ID C preprocessor macro. \n*/\nconst char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }\n\n/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function\n** returns an integer equal to SQLITE_VERSION_NUMBER.\n*/\nint sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }\n\n/* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns\n** zero if and only if SQLite was compiled with mutexing code omitted due to\n** the SQLITE_THREADSAFE compile-time option being set to 0.\n*/\nint sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }\n\n/*\n** When compiling the test fixture or with debugging enabled (on Win32),\n** this variable being set to non-zero will cause OSTRACE macros to emit\n** extra diagnostic information.\n*/\n#ifdef SQLITE_HAVE_OS_TRACE\n# ifndef SQLITE_DEBUG_OS_TRACE\n#   define SQLITE_DEBUG_OS_TRACE 0\n# endif\n  int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;\n#endif\n\n#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)\n/*\n** If the following function pointer is not NULL and if\n** SQLITE_ENABLE_IOTRACE is enabled, then messages describing\n** I/O active are written using this function.  These messages\n** are intended for debugging activity only.\n*/\nSQLITE_API void (SQLITE_CDECL *sqlite3IoTrace)(const char*, ...) = 0;\n#endif\n\n/*\n** If the following global variable points to a string which is the\n** name of a directory, then that directory will be used to store\n** temporary files.\n**\n** See also the \"PRAGMA temp_store_directory\" SQL command.\n*/\nchar *sqlite3_temp_directory = 0;\n\n/*\n** If the following global variable points to a string which is the\n** name of a directory, then that directory will be used to store\n** all database files specified with a relative pathname.\n**\n** See also the \"PRAGMA data_store_directory\" SQL command.\n*/\nchar *sqlite3_data_directory = 0;\n\n/*\n** Initialize SQLite.  \n**\n** This routine must be called to initialize the memory allocation,\n** VFS, and mutex subsystems prior to doing any serious work with\n** SQLite.  But as long as you do not compile with SQLITE_OMIT_AUTOINIT\n** this routine will be called automatically by key routines such as\n** sqlite3_open().  \n**\n** This routine is a no-op except on its very first call for the process,\n** or for the first call after a call to sqlite3_shutdown.\n**\n** The first thread to call this routine runs the initialization to\n** completion.  If subsequent threads call this routine before the first\n** thread has finished the initialization process, then the subsequent\n** threads must block until the first thread finishes with the initialization.\n**\n** The first thread might call this routine recursively.  Recursive\n** calls to this routine should not block, of course.  Otherwise the\n** initialization process would never complete.\n**\n** Let X be the first thread to enter this routine.  Let Y be some other\n** thread.  Then while the initial invocation of this routine by X is\n** incomplete, it is required that:\n**\n**    *  Calls to this routine from Y must block until the outer-most\n**       call by X completes.\n**\n**    *  Recursive calls to this routine from thread X return immediately\n**       without blocking.\n*/\nint sqlite3_initialize(void){\n  MUTEX_LOGIC( sqlite3_mutex *pMaster; )       /* The main static mutex */\n  int rc;                                      /* Result code */\n#ifdef SQLITE_EXTRA_INIT\n  int bRunExtraInit = 0;                       /* Extra initialization needed */\n#endif\n\n#ifdef SQLITE_OMIT_WSD\n  rc = sqlite3_wsd_init(4096, 24);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n#endif\n\n  /* If the following assert() fails on some obscure processor/compiler\n  ** combination, the work-around is to set the correct pointer\n  ** size at compile-time using -DSQLITE_PTRSIZE=n compile-time option */\n  assert( SQLITE_PTRSIZE==sizeof(char*) );\n\n  /* If SQLite is already completely initialized, then this call\n  ** to sqlite3_initialize() should be a no-op.  But the initialization\n  ** must be complete.  So isInit must not be set until the very end\n  ** of this routine.\n  */\n  if( sqlite3GlobalConfig.isInit ) return SQLITE_OK;\n\n  /* Make sure the mutex subsystem is initialized.  If unable to \n  ** initialize the mutex subsystem, return early with the error.\n  ** If the system is so sick that we are unable to allocate a mutex,\n  ** there is not much SQLite is going to be able to do.\n  **\n  ** The mutex subsystem must take care of serializing its own\n  ** initialization.\n  */\n  rc = sqlite3MutexInit();\n  if( rc ) return rc;\n\n  /* Initialize the malloc() system and the recursive pInitMutex mutex.\n  ** This operation is protected by the STATIC_MASTER mutex.  Note that\n  ** MutexAlloc() is called for a static mutex prior to initializing the\n  ** malloc subsystem - this implies that the allocation of a static\n  ** mutex must not require support from the malloc subsystem.\n  */\n  MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )\n  sqlite3_mutex_enter(pMaster);\n  sqlite3GlobalConfig.isMutexInit = 1;\n  if( !sqlite3GlobalConfig.isMallocInit ){\n    rc = sqlite3MallocInit();\n  }\n  if( rc==SQLITE_OK ){\n    sqlite3GlobalConfig.isMallocInit = 1;\n    if( !sqlite3GlobalConfig.pInitMutex ){\n      sqlite3GlobalConfig.pInitMutex =\n           sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);\n      if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){\n        rc = SQLITE_NOMEM_BKPT;\n      }\n    }\n  }\n  if( rc==SQLITE_OK ){\n    sqlite3GlobalConfig.nRefInitMutex++;\n  }\n  sqlite3_mutex_leave(pMaster);\n\n  /* If rc is not SQLITE_OK at this point, then either the malloc\n  ** subsystem could not be initialized or the system failed to allocate\n  ** the pInitMutex mutex. Return an error in either case.  */\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  /* Do the rest of the initialization under the recursive mutex so\n  ** that we will be able to handle recursive calls into\n  ** sqlite3_initialize().  The recursive calls normally come through\n  ** sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other\n  ** recursive calls might also be possible.\n  **\n  ** IMPLEMENTATION-OF: R-00140-37445 SQLite automatically serializes calls\n  ** to the xInit method, so the xInit method need not be threadsafe.\n  **\n  ** The following mutex is what serializes access to the appdef pcache xInit\n  ** methods.  The sqlite3_pcache_methods.xInit() all is embedded in the\n  ** call to sqlite3PcacheInitialize().\n  */\n  sqlite3_mutex_enter(sqlite3GlobalConfig.pInitMutex);\n  if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){\n    sqlite3GlobalConfig.inProgress = 1;\n#ifdef SQLITE_ENABLE_SQLLOG\n    {\n      extern void sqlite3_init_sqllog(void);\n      sqlite3_init_sqllog();\n    }\n#endif\n    memset(&sqlite3BuiltinFunctions, 0, sizeof(sqlite3BuiltinFunctions));\n    sqlite3RegisterBuiltinFunctions();\n    if( sqlite3GlobalConfig.isPCacheInit==0 ){\n      rc = sqlite3PcacheInitialize();\n    }\n    if( rc==SQLITE_OK ){\n      sqlite3GlobalConfig.isPCacheInit = 1;\n      rc = sqlite3OsInit();\n    }\n    if( rc==SQLITE_OK ){\n      sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, \n          sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage);\n      sqlite3GlobalConfig.isInit = 1;\n#ifdef SQLITE_EXTRA_INIT\n      bRunExtraInit = 1;\n#endif\n    }\n    sqlite3GlobalConfig.inProgress = 0;\n  }\n  sqlite3_mutex_leave(sqlite3GlobalConfig.pInitMutex);\n\n  /* Go back under the static mutex and clean up the recursive\n  ** mutex to prevent a resource leak.\n  */\n  sqlite3_mutex_enter(pMaster);\n  sqlite3GlobalConfig.nRefInitMutex--;\n  if( sqlite3GlobalConfig.nRefInitMutex<=0 ){\n    assert( sqlite3GlobalConfig.nRefInitMutex==0 );\n    sqlite3_mutex_free(sqlite3GlobalConfig.pInitMutex);\n    sqlite3GlobalConfig.pInitMutex = 0;\n  }\n  sqlite3_mutex_leave(pMaster);\n\n  /* The following is just a sanity check to make sure SQLite has\n  ** been compiled correctly.  It is important to run this code, but\n  ** we don't want to run it too often and soak up CPU cycles for no\n  ** reason.  So we run it once during initialization.\n  */\n#ifndef NDEBUG\n#ifndef SQLITE_OMIT_FLOATING_POINT\n  /* This section of code's only \"output\" is via assert() statements. */\n  if ( rc==SQLITE_OK ){\n    u64 x = (((u64)1)<<63)-1;\n    double y;\n    assert(sizeof(x)==8);\n    assert(sizeof(x)==sizeof(y));\n    memcpy(&y, &x, 8);\n    assert( sqlite3IsNaN(y) );\n  }\n#endif\n#endif\n\n  /* Do extra initialization steps requested by the SQLITE_EXTRA_INIT\n  ** compile-time option.\n  */\n#ifdef SQLITE_EXTRA_INIT\n  if( bRunExtraInit ){\n    int SQLITE_EXTRA_INIT(const char*);\n    rc = SQLITE_EXTRA_INIT(0);\n  }\n#endif\n\n  return rc;\n}\n\n/*\n** Undo the effects of sqlite3_initialize().  Must not be called while\n** there are outstanding database connections or memory allocations or\n** while any part of SQLite is otherwise in use in any thread.  This\n** routine is not threadsafe.  But it is safe to invoke this routine\n** on when SQLite is already shut down.  If SQLite is already shut down\n** when this routine is invoked, then this routine is a harmless no-op.\n*/\nint sqlite3_shutdown(void){\n#ifdef SQLITE_OMIT_WSD\n  int rc = sqlite3_wsd_init(4096, 24);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n#endif\n\n  if( sqlite3GlobalConfig.isInit ){\n#ifdef SQLITE_EXTRA_SHUTDOWN\n    void SQLITE_EXTRA_SHUTDOWN(void);\n    SQLITE_EXTRA_SHUTDOWN();\n#endif\n    sqlite3_os_end();\n    sqlite3_reset_auto_extension();\n    sqlite3GlobalConfig.isInit = 0;\n  }\n  if( sqlite3GlobalConfig.isPCacheInit ){\n    sqlite3PcacheShutdown();\n    sqlite3GlobalConfig.isPCacheInit = 0;\n  }\n  if( sqlite3GlobalConfig.isMallocInit ){\n    sqlite3MallocEnd();\n    sqlite3GlobalConfig.isMallocInit = 0;\n\n#ifndef SQLITE_OMIT_SHUTDOWN_DIRECTORIES\n    /* The heap subsystem has now been shutdown and these values are supposed\n    ** to be NULL or point to memory that was obtained from sqlite3_malloc(),\n    ** which would rely on that heap subsystem; therefore, make sure these\n    ** values cannot refer to heap memory that was just invalidated when the\n    ** heap subsystem was shutdown.  This is only done if the current call to\n    ** this function resulted in the heap subsystem actually being shutdown.\n    */\n    sqlite3_data_directory = 0;\n    sqlite3_temp_directory = 0;\n#endif\n  }\n  if( sqlite3GlobalConfig.isMutexInit ){\n    sqlite3MutexEnd();\n    sqlite3GlobalConfig.isMutexInit = 0;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** This API allows applications to modify the global configuration of\n** the SQLite library at run-time.\n**\n** This routine should only be called when there are no outstanding\n** database connections or memory allocations.  This routine is not\n** threadsafe.  Failure to heed these warnings can lead to unpredictable\n** behavior.\n*/\nint sqlite3_config(int op, ...){\n  va_list ap;\n  int rc = SQLITE_OK;\n\n  /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while\n  ** the SQLite library is in use. */\n  if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;\n\n  va_start(ap, op);\n  switch( op ){\n\n    /* Mutex configuration options are only available in a threadsafe\n    ** compile.\n    */\n#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0  /* IMP: R-54466-46756 */\n    case SQLITE_CONFIG_SINGLETHREAD: {\n      /* EVIDENCE-OF: R-02748-19096 This option sets the threading mode to\n      ** Single-thread. */\n      sqlite3GlobalConfig.bCoreMutex = 0;  /* Disable mutex on core */\n      sqlite3GlobalConfig.bFullMutex = 0;  /* Disable mutex on connections */\n      break;\n    }\n#endif\n#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-20520-54086 */\n    case SQLITE_CONFIG_MULTITHREAD: {\n      /* EVIDENCE-OF: R-14374-42468 This option sets the threading mode to\n      ** Multi-thread. */\n      sqlite3GlobalConfig.bCoreMutex = 1;  /* Enable mutex on core */\n      sqlite3GlobalConfig.bFullMutex = 0;  /* Disable mutex on connections */\n      break;\n    }\n#endif\n#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-59593-21810 */\n    case SQLITE_CONFIG_SERIALIZED: {\n      /* EVIDENCE-OF: R-41220-51800 This option sets the threading mode to\n      ** Serialized. */\n      sqlite3GlobalConfig.bCoreMutex = 1;  /* Enable mutex on core */\n      sqlite3GlobalConfig.bFullMutex = 1;  /* Enable mutex on connections */\n      break;\n    }\n#endif\n#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-63666-48755 */\n    case SQLITE_CONFIG_MUTEX: {\n      /* Specify an alternative mutex implementation */\n      sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);\n      break;\n    }\n#endif\n#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 /* IMP: R-14450-37597 */\n    case SQLITE_CONFIG_GETMUTEX: {\n      /* Retrieve the current mutex implementation */\n      *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;\n      break;\n    }\n#endif\n\n    case SQLITE_CONFIG_MALLOC: {\n      /* EVIDENCE-OF: R-55594-21030 The SQLITE_CONFIG_MALLOC option takes a\n      ** single argument which is a pointer to an instance of the\n      ** sqlite3_mem_methods structure. The argument specifies alternative\n      ** low-level memory allocation routines to be used in place of the memory\n      ** allocation routines built into SQLite. */\n      sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);\n      break;\n    }\n    case SQLITE_CONFIG_GETMALLOC: {\n      /* EVIDENCE-OF: R-51213-46414 The SQLITE_CONFIG_GETMALLOC option takes a\n      ** single argument which is a pointer to an instance of the\n      ** sqlite3_mem_methods structure. The sqlite3_mem_methods structure is\n      ** filled with the currently defined memory allocation routines. */\n      if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();\n      *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;\n      break;\n    }\n    case SQLITE_CONFIG_MEMSTATUS: {\n      /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes\n      ** single argument of type int, interpreted as a boolean, which enables\n      ** or disables the collection of memory allocation statistics. */\n      sqlite3GlobalConfig.bMemstat = va_arg(ap, int);\n      break;\n    }\n    case SQLITE_CONFIG_SCRATCH: {\n      /* EVIDENCE-OF: R-08404-60887 There are three arguments to\n      ** SQLITE_CONFIG_SCRATCH: A pointer an 8-byte aligned memory buffer from\n      ** which the scratch allocations will be drawn, the size of each scratch\n      ** allocation (sz), and the maximum number of scratch allocations (N). */\n      sqlite3GlobalConfig.pScratch = va_arg(ap, void*);\n      sqlite3GlobalConfig.szScratch = va_arg(ap, int);\n      sqlite3GlobalConfig.nScratch = va_arg(ap, int);\n      break;\n    }\n    case SQLITE_CONFIG_PAGECACHE: {\n      /* EVIDENCE-OF: R-18761-36601 There are three arguments to\n      ** SQLITE_CONFIG_PAGECACHE: A pointer to 8-byte aligned memory (pMem),\n      ** the size of each page cache line (sz), and the number of cache lines\n      ** (N). */\n      sqlite3GlobalConfig.pPage = va_arg(ap, void*);\n      sqlite3GlobalConfig.szPage = va_arg(ap, int);\n      sqlite3GlobalConfig.nPage = va_arg(ap, int);\n      break;\n    }\n    case SQLITE_CONFIG_PCACHE_HDRSZ: {\n      /* EVIDENCE-OF: R-39100-27317 The SQLITE_CONFIG_PCACHE_HDRSZ option takes\n      ** a single parameter which is a pointer to an integer and writes into\n      ** that integer the number of extra bytes per page required for each page\n      ** in SQLITE_CONFIG_PAGECACHE. */\n      *va_arg(ap, int*) = \n          sqlite3HeaderSizeBtree() +\n          sqlite3HeaderSizePcache() +\n          sqlite3HeaderSizePcache1();\n      break;\n    }\n\n    case SQLITE_CONFIG_PCACHE: {\n      /* no-op */\n      break;\n    }\n    case SQLITE_CONFIG_GETPCACHE: {\n      /* now an error */\n      rc = SQLITE_ERROR;\n      break;\n    }\n\n    case SQLITE_CONFIG_PCACHE2: {\n      /* EVIDENCE-OF: R-63325-48378 The SQLITE_CONFIG_PCACHE2 option takes a\n      ** single argument which is a pointer to an sqlite3_pcache_methods2\n      ** object. This object specifies the interface to a custom page cache\n      ** implementation. */\n      sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);\n      break;\n    }\n    case SQLITE_CONFIG_GETPCACHE2: {\n      /* EVIDENCE-OF: R-22035-46182 The SQLITE_CONFIG_GETPCACHE2 option takes a\n      ** single argument which is a pointer to an sqlite3_pcache_methods2\n      ** object. SQLite copies of the current page cache implementation into\n      ** that object. */\n      if( sqlite3GlobalConfig.pcache2.xInit==0 ){\n        sqlite3PCacheSetDefault();\n      }\n      *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;\n      break;\n    }\n\n/* EVIDENCE-OF: R-06626-12911 The SQLITE_CONFIG_HEAP option is only\n** available if SQLite is compiled with either SQLITE_ENABLE_MEMSYS3 or\n** SQLITE_ENABLE_MEMSYS5 and returns SQLITE_ERROR if invoked otherwise. */\n#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)\n    case SQLITE_CONFIG_HEAP: {\n      /* EVIDENCE-OF: R-19854-42126 There are three arguments to\n      ** SQLITE_CONFIG_HEAP: An 8-byte aligned pointer to the memory, the\n      ** number of bytes in the memory buffer, and the minimum allocation size.\n      */\n      sqlite3GlobalConfig.pHeap = va_arg(ap, void*);\n      sqlite3GlobalConfig.nHeap = va_arg(ap, int);\n      sqlite3GlobalConfig.mnReq = va_arg(ap, int);\n\n      if( sqlite3GlobalConfig.mnReq<1 ){\n        sqlite3GlobalConfig.mnReq = 1;\n      }else if( sqlite3GlobalConfig.mnReq>(1<<12) ){\n        /* cap min request size at 2^12 */\n        sqlite3GlobalConfig.mnReq = (1<<12);\n      }\n\n      if( sqlite3GlobalConfig.pHeap==0 ){\n        /* EVIDENCE-OF: R-49920-60189 If the first pointer (the memory pointer)\n        ** is NULL, then SQLite reverts to using its default memory allocator\n        ** (the system malloc() implementation), undoing any prior invocation of\n        ** SQLITE_CONFIG_MALLOC.\n        **\n        ** Setting sqlite3GlobalConfig.m to all zeros will cause malloc to\n        ** revert to its default implementation when sqlite3_initialize() is run\n        */\n        memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m));\n      }else{\n        /* EVIDENCE-OF: R-61006-08918 If the memory pointer is not NULL then the\n        ** alternative memory allocator is engaged to handle all of SQLites\n        ** memory allocation needs. */\n#ifdef SQLITE_ENABLE_MEMSYS3\n        sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3();\n#endif\n#ifdef SQLITE_ENABLE_MEMSYS5\n        sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5();\n#endif\n      }\n      break;\n    }\n#endif\n\n    case SQLITE_CONFIG_LOOKASIDE: {\n      sqlite3GlobalConfig.szLookaside = va_arg(ap, int);\n      sqlite3GlobalConfig.nLookaside = va_arg(ap, int);\n      break;\n    }\n    \n    /* Record a pointer to the logger function and its first argument.\n    ** The default is NULL.  Logging is disabled if the function pointer is\n    ** NULL.\n    */\n    case SQLITE_CONFIG_LOG: {\n      /* MSVC is picky about pulling func ptrs from va lists.\n      ** http://support.microsoft.com/kb/47961\n      ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));\n      */\n      typedef void(*LOGFUNC_t)(void*,int,const char*);\n      sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);\n      sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);\n      break;\n    }\n\n    /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames\n    ** can be changed at start-time using the\n    ** sqlite3_config(SQLITE_CONFIG_URI,1) or\n    ** sqlite3_config(SQLITE_CONFIG_URI,0) configuration calls.\n    */\n    case SQLITE_CONFIG_URI: {\n      /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single\n      ** argument of type int. If non-zero, then URI handling is globally\n      ** enabled. If the parameter is zero, then URI handling is globally\n      ** disabled. */\n      sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);\n      break;\n    }\n\n    case SQLITE_CONFIG_COVERING_INDEX_SCAN: {\n      /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN\n      ** option takes a single integer argument which is interpreted as a\n      ** boolean in order to enable or disable the use of covering indices for\n      ** full table scans in the query optimizer. */\n      sqlite3GlobalConfig.bUseCis = va_arg(ap, int);\n      break;\n    }\n\n#ifdef SQLITE_ENABLE_SQLLOG\n    case SQLITE_CONFIG_SQLLOG: {\n      typedef void(*SQLLOGFUNC_t)(void*, sqlite3*, const char*, int);\n      sqlite3GlobalConfig.xSqllog = va_arg(ap, SQLLOGFUNC_t);\n      sqlite3GlobalConfig.pSqllogArg = va_arg(ap, void *);\n      break;\n    }\n#endif\n\n    case SQLITE_CONFIG_MMAP_SIZE: {\n      /* EVIDENCE-OF: R-58063-38258 SQLITE_CONFIG_MMAP_SIZE takes two 64-bit\n      ** integer (sqlite3_int64) values that are the default mmap size limit\n      ** (the default setting for PRAGMA mmap_size) and the maximum allowed\n      ** mmap size limit. */\n      sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64);\n      sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);\n      /* EVIDENCE-OF: R-53367-43190 If either argument to this option is\n      ** negative, then that argument is changed to its compile-time default.\n      **\n      ** EVIDENCE-OF: R-34993-45031 The maximum allowed mmap size will be\n      ** silently truncated if necessary so that it does not exceed the\n      ** compile-time maximum mmap size set by the SQLITE_MAX_MMAP_SIZE\n      ** compile-time option.\n      */\n      if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){\n        mxMmap = SQLITE_MAX_MMAP_SIZE;\n      }\n      if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;\n      if( szMmap>mxMmap) szMmap = mxMmap;\n      sqlite3GlobalConfig.mxMmap = mxMmap;\n      sqlite3GlobalConfig.szMmap = szMmap;\n      break;\n    }\n\n#if SQLITE_OS_WIN && defined(SQLITE_WIN32_MALLOC) /* IMP: R-04780-55815 */\n    case SQLITE_CONFIG_WIN32_HEAPSIZE: {\n      /* EVIDENCE-OF: R-34926-03360 SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit\n      ** unsigned integer value that specifies the maximum size of the created\n      ** heap. */\n      sqlite3GlobalConfig.nHeap = va_arg(ap, int);\n      break;\n    }\n#endif\n\n    case SQLITE_CONFIG_PMASZ: {\n      sqlite3GlobalConfig.szPma = va_arg(ap, unsigned int);\n      break;\n    }\n\n    case SQLITE_CONFIG_STMTJRNL_SPILL: {\n      sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int);\n      break;\n    }\n\n    default: {\n      rc = SQLITE_ERROR;\n      break;\n    }\n  }\n  va_end(ap);\n  return rc;\n}\n\n/*\n** Set up the lookaside buffers for a database connection.\n** Return SQLITE_OK on success.  \n** If lookaside is already active, return SQLITE_BUSY.\n**\n** The sz parameter is the number of bytes in each lookaside slot.\n** The cnt parameter is the number of slots.  If pStart is NULL the\n** space for the lookaside memory is obtained from sqlite3_malloc().\n** If pStart is not NULL then it is sz*cnt bytes of memory to use for\n** the lookaside memory.\n*/\nstatic int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){\n#ifndef SQLITE_OMIT_LOOKASIDE\n  void *pStart;\n  if( db->lookaside.nOut ){\n    return SQLITE_BUSY;\n  }\n  /* Free any existing lookaside buffer for this handle before\n  ** allocating a new one so we don't have to have space for \n  ** both at the same time.\n  */\n  if( db->lookaside.bMalloced ){\n    sqlite3_free(db->lookaside.pStart);\n  }\n  /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger\n  ** than a pointer to be useful.\n  */\n  sz = ROUNDDOWN8(sz);  /* IMP: R-33038-09382 */\n  if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0;\n  if( cnt<0 ) cnt = 0;\n  if( sz==0 || cnt==0 ){\n    sz = 0;\n    pStart = 0;\n  }else if( pBuf==0 ){\n    sqlite3BeginBenignMalloc();\n    pStart = sqlite3Malloc( sz*cnt );  /* IMP: R-61949-35727 */\n    sqlite3EndBenignMalloc();\n    if( pStart ) cnt = sqlite3MallocSize(pStart)/sz;\n  }else{\n    pStart = pBuf;\n  }\n  db->lookaside.pStart = pStart;\n  db->lookaside.pFree = 0;\n  db->lookaside.sz = (u16)sz;\n  if( pStart ){\n    int i;\n    LookasideSlot *p;\n    assert( sz > (int)sizeof(LookasideSlot*) );\n    p = (LookasideSlot*)pStart;\n    for(i=cnt-1; i>=0; i--){\n      p->pNext = db->lookaside.pFree;\n      db->lookaside.pFree = p;\n      p = (LookasideSlot*)&((u8*)p)[sz];\n    }\n    db->lookaside.pEnd = p;\n    db->lookaside.bDisable = 0;\n    db->lookaside.bMalloced = pBuf==0 ?1:0;\n  }else{\n    db->lookaside.pStart = db;\n    db->lookaside.pEnd = db;\n    db->lookaside.bDisable = 1;\n    db->lookaside.bMalloced = 0;\n  }\n#endif /* SQLITE_OMIT_LOOKASIDE */\n  return SQLITE_OK;\n}\n\n/*\n** Return the mutex associated with a database connection.\n*/\nsqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  return db->mutex;\n}\n\n/*\n** Free up as much memory as we can from the given database\n** connection.\n*/\nint sqlite3_db_release_memory(sqlite3 *db){\n  int i;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  sqlite3BtreeEnterAll(db);\n  for(i=0; i<db->nDb; i++){\n    Btree *pBt = db->aDb[i].pBt;\n    if( pBt ){\n      Pager *pPager = sqlite3BtreePager(pBt);\n      sqlite3PagerShrink(pPager);\n    }\n  }\n  sqlite3BtreeLeaveAll(db);\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n\n/*\n** Flush any dirty pages in the pager-cache for any attached database\n** to disk.\n*/\nint sqlite3_db_cacheflush(sqlite3 *db){\n  int i;\n  int rc = SQLITE_OK;\n  int bSeenBusy = 0;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  sqlite3BtreeEnterAll(db);\n  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){\n    Btree *pBt = db->aDb[i].pBt;\n    if( pBt && sqlite3BtreeIsInTrans(pBt) ){\n      Pager *pPager = sqlite3BtreePager(pBt);\n      rc = sqlite3PagerFlush(pPager);\n      if( rc==SQLITE_BUSY ){\n        bSeenBusy = 1;\n        rc = SQLITE_OK;\n      }\n    }\n  }\n  sqlite3BtreeLeaveAll(db);\n  sqlite3_mutex_leave(db->mutex);\n  return ((rc==SQLITE_OK && bSeenBusy) ? SQLITE_BUSY : rc);\n}\n\n/*\n** Configuration settings for an individual database connection\n*/\nint sqlite3_db_config(sqlite3 *db, int op, ...){\n  va_list ap;\n  int rc;\n  va_start(ap, op);\n  switch( op ){\n    case SQLITE_DBCONFIG_MAINDBNAME: {\n      db->aDb[0].zDbSName = va_arg(ap,char*);\n      rc = SQLITE_OK;\n      break;\n    }\n    case SQLITE_DBCONFIG_LOOKASIDE: {\n      void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */\n      int sz = va_arg(ap, int);       /* IMP: R-47871-25994 */\n      int cnt = va_arg(ap, int);      /* IMP: R-04460-53386 */\n      rc = setupLookaside(db, pBuf, sz, cnt);\n      break;\n    }\n    default: {\n      static const struct {\n        int op;      /* The opcode */\n        u32 mask;    /* Mask of the bit in sqlite3.flags to set/clear */\n      } aFlagOp[] = {\n        { SQLITE_DBCONFIG_ENABLE_FKEY,           SQLITE_ForeignKeys    },\n        { SQLITE_DBCONFIG_ENABLE_TRIGGER,        SQLITE_EnableTrigger  },\n        { SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_Fts3Tokenizer  },\n        { SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, SQLITE_LoadExtension  },\n      };\n      unsigned int i;\n      rc = SQLITE_ERROR; /* IMP: R-42790-23372 */\n      for(i=0; i<ArraySize(aFlagOp); i++){\n        if( aFlagOp[i].op==op ){\n          int onoff = va_arg(ap, int);\n          int *pRes = va_arg(ap, int*);\n          int oldFlags = db->flags;\n          if( onoff>0 ){\n            db->flags |= aFlagOp[i].mask;\n          }else if( onoff==0 ){\n            db->flags &= ~aFlagOp[i].mask;\n          }\n          if( oldFlags!=db->flags ){\n            sqlite3ExpirePreparedStatements(db);\n          }\n          if( pRes ){\n            *pRes = (db->flags & aFlagOp[i].mask)!=0;\n          }\n          rc = SQLITE_OK;\n          break;\n        }\n      }\n      break;\n    }\n  }\n  va_end(ap);\n  return rc;\n}\n\n\n/*\n** Return true if the buffer z[0..n-1] contains all spaces.\n*/\nstatic int allSpaces(const char *z, int n){\n  while( n>0 && z[n-1]==' ' ){ n--; }\n  return n==0;\n}\n\n/*\n** This is the default collating function named \"BINARY\" which is always\n** available.\n**\n** If the padFlag argument is not NULL then space padding at the end\n** of strings is ignored.  This implements the RTRIM collation.\n*/\nstatic int binCollFunc(\n  void *padFlag,\n  int nKey1, const void *pKey1,\n  int nKey2, const void *pKey2\n){\n  int rc, n;\n  n = nKey1<nKey2 ? nKey1 : nKey2;\n  /* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares\n  ** strings byte by byte using the memcmp() function from the standard C\n  ** library. */\n  rc = memcmp(pKey1, pKey2, n);\n  if( rc==0 ){\n    if( padFlag\n     && allSpaces(((char*)pKey1)+n, nKey1-n)\n     && allSpaces(((char*)pKey2)+n, nKey2-n)\n    ){\n      /* EVIDENCE-OF: R-31624-24737 RTRIM is like BINARY except that extra\n      ** spaces at the end of either string do not change the result. In other\n      ** words, strings will compare equal to one another as long as they\n      ** differ only in the number of spaces at the end.\n      */\n    }else{\n      rc = nKey1 - nKey2;\n    }\n  }\n  return rc;\n}\n\n/*\n** Another built-in collating sequence: NOCASE. \n**\n** This collating sequence is intended to be used for \"case independent\n** comparison\". SQLite's knowledge of upper and lower case equivalents\n** extends only to the 26 characters used in the English language.\n**\n** At the moment there is only a UTF-8 implementation.\n*/\nstatic int nocaseCollatingFunc(\n  void *NotUsed,\n  int nKey1, const void *pKey1,\n  int nKey2, const void *pKey2\n){\n  int r = sqlite3StrNICmp(\n      (const char *)pKey1, (const char *)pKey2, (nKey1<nKey2)?nKey1:nKey2);\n  UNUSED_PARAMETER(NotUsed);\n  if( 0==r ){\n    r = nKey1-nKey2;\n  }\n  return r;\n}\n\n/*\n** Return the ROWID of the most recent insert\n*/\nsqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  return db->lastRowid;\n}\n\n/*\n** Return the number of changes in the most recent call to sqlite3_exec().\n*/\nint sqlite3_changes(sqlite3 *db){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  return db->nChange;\n}\n\n/*\n** Return the number of changes since the database handle was opened.\n*/\nint sqlite3_total_changes(sqlite3 *db){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  return db->nTotalChange;\n}\n\n/*\n** Close all open savepoints. This function only manipulates fields of the\n** database handle object, it does not close any savepoints that may be open\n** at the b-tree/pager level.\n*/\nvoid sqlite3CloseSavepoints(sqlite3 *db){\n  while( db->pSavepoint ){\n    Savepoint *pTmp = db->pSavepoint;\n    db->pSavepoint = pTmp->pNext;\n    sqlite3DbFree(db, pTmp);\n  }\n  db->nSavepoint = 0;\n  db->nStatement = 0;\n  db->isTransactionSavepoint = 0;\n}\n\n/*\n** Invoke the destructor function associated with FuncDef p, if any. Except,\n** if this is not the last copy of the function, do not invoke it. Multiple\n** copies of a single function are created when create_function() is called\n** with SQLITE_ANY as the encoding.\n*/\nstatic void functionDestroy(sqlite3 *db, FuncDef *p){\n  FuncDestructor *pDestructor = p->u.pDestructor;\n  if( pDestructor ){\n    pDestructor->nRef--;\n    if( pDestructor->nRef==0 ){\n      pDestructor->xDestroy(pDestructor->pUserData);\n      sqlite3DbFree(db, pDestructor);\n    }\n  }\n}\n\n/*\n** Disconnect all sqlite3_vtab objects that belong to database connection\n** db. This is called when db is being closed.\n*/\nstatic void disconnectAllVtab(sqlite3 *db){\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  int i;\n  HashElem *p;\n  sqlite3BtreeEnterAll(db);\n  for(i=0; i<db->nDb; i++){\n    Schema *pSchema = db->aDb[i].pSchema;\n    if( db->aDb[i].pSchema ){\n      for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){\n        Table *pTab = (Table *)sqliteHashData(p);\n        if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab);\n      }\n    }\n  }\n  for(p=sqliteHashFirst(&db->aModule); p; p=sqliteHashNext(p)){\n    Module *pMod = (Module *)sqliteHashData(p);\n    if( pMod->pEpoTab ){\n      sqlite3VtabDisconnect(db, pMod->pEpoTab);\n    }\n  }\n  sqlite3VtabUnlockList(db);\n  sqlite3BtreeLeaveAll(db);\n#else\n  UNUSED_PARAMETER(db);\n#endif\n}\n\n/*\n** Return TRUE if database connection db has unfinalized prepared\n** statements or unfinished sqlite3_backup objects.  \n*/\nstatic int connectionIsBusy(sqlite3 *db){\n  int j;\n  assert( sqlite3_mutex_held(db->mutex) );\n  if( db->pVdbe ) return 1;\n  for(j=0; j<db->nDb; j++){\n    Btree *pBt = db->aDb[j].pBt;\n    if( pBt && sqlite3BtreeIsInBackup(pBt) ) return 1;\n  }\n  return 0;\n}\n\n/*\n** Close an existing SQLite database\n*/\nstatic int sqlite3Close(sqlite3 *db, int forceZombie){\n  if( !db ){\n    /* EVIDENCE-OF: R-63257-11740 Calling sqlite3_close() or\n    ** sqlite3_close_v2() with a NULL pointer argument is a harmless no-op. */\n    return SQLITE_OK;\n  }\n  if( !sqlite3SafetyCheckSickOrOk(db) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n  sqlite3_mutex_enter(db->mutex);\n  if( db->mTrace & SQLITE_TRACE_CLOSE ){\n    db->xTrace(SQLITE_TRACE_CLOSE, db->pTraceArg, db, 0);\n  }\n\n  /* Force xDisconnect calls on all virtual tables */\n  disconnectAllVtab(db);\n\n  /* If a transaction is open, the disconnectAllVtab() call above\n  ** will not have called the xDisconnect() method on any virtual\n  ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback()\n  ** call will do so. We need to do this before the check for active\n  ** SQL statements below, as the v-table implementation may be storing\n  ** some prepared statements internally.\n  */\n  sqlite3VtabRollback(db);\n\n  /* Legacy behavior (sqlite3_close() behavior) is to return\n  ** SQLITE_BUSY if the connection can not be closed immediately.\n  */\n  if( !forceZombie && connectionIsBusy(db) ){\n    sqlite3ErrorWithMsg(db, SQLITE_BUSY, \"unable to close due to unfinalized \"\n       \"statements or unfinished backups\");\n    sqlite3_mutex_leave(db->mutex);\n    return SQLITE_BUSY;\n  }\n\n#ifdef SQLITE_ENABLE_SQLLOG\n  if( sqlite3GlobalConfig.xSqllog ){\n    /* Closing the handle. Fourth parameter is passed the value 2. */\n    sqlite3GlobalConfig.xSqllog(sqlite3GlobalConfig.pSqllogArg, db, 0, 2);\n  }\n#endif\n\n  /* Convert the connection into a zombie and then close it.\n  */\n  db->magic = SQLITE_MAGIC_ZOMBIE;\n  sqlite3LeaveMutexAndCloseZombie(db);\n  return SQLITE_OK;\n}\n\n/*\n** Two variations on the public interface for closing a database\n** connection. The sqlite3_close() version returns SQLITE_BUSY and\n** leaves the connection option if there are unfinalized prepared\n** statements or unfinished sqlite3_backups.  The sqlite3_close_v2()\n** version forces the connection to become a zombie if there are\n** unclosed resources, and arranges for deallocation when the last\n** prepare statement or sqlite3_backup closes.\n*/\nint sqlite3_close(sqlite3 *db){ return sqlite3Close(db,0); }\nint sqlite3_close_v2(sqlite3 *db){ return sqlite3Close(db,1); }\n\n\n/*\n** Close the mutex on database connection db.\n**\n** Furthermore, if database connection db is a zombie (meaning that there\n** has been a prior call to sqlite3_close(db) or sqlite3_close_v2(db)) and\n** every sqlite3_stmt has now been finalized and every sqlite3_backup has\n** finished, then free all resources.\n*/\nvoid sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){\n  HashElem *i;                    /* Hash table iterator */\n  int j;\n\n  /* If there are outstanding sqlite3_stmt or sqlite3_backup objects\n  ** or if the connection has not yet been closed by sqlite3_close_v2(),\n  ** then just leave the mutex and return.\n  */\n  if( db->magic!=SQLITE_MAGIC_ZOMBIE || connectionIsBusy(db) ){\n    sqlite3_mutex_leave(db->mutex);\n    return;\n  }\n\n  /* If we reach this point, it means that the database connection has\n  ** closed all sqlite3_stmt and sqlite3_backup objects and has been\n  ** passed to sqlite3_close (meaning that it is a zombie).  Therefore,\n  ** go ahead and free all resources.\n  */\n\n  /* If a transaction is open, roll it back. This also ensures that if\n  ** any database schemas have been modified by an uncommitted transaction\n  ** they are reset. And that the required b-tree mutex is held to make\n  ** the pager rollback and schema reset an atomic operation. */\n  sqlite3RollbackAll(db, SQLITE_OK);\n\n  /* Free any outstanding Savepoint structures. */\n  sqlite3CloseSavepoints(db);\n\n  /* Close all database connections */\n  for(j=0; j<db->nDb; j++){\n    struct Db *pDb = &db->aDb[j];\n    if( pDb->pBt ){\n      sqlite3BtreeClose(pDb->pBt);\n      pDb->pBt = 0;\n      if( j!=1 ){\n        pDb->pSchema = 0;\n      }\n    }\n  }\n  /* Clear the TEMP schema separately and last */\n  if( db->aDb[1].pSchema ){\n    sqlite3SchemaClear(db->aDb[1].pSchema);\n  }\n  sqlite3VtabUnlockList(db);\n\n  /* Free up the array of auxiliary databases */\n  sqlite3CollapseDatabaseArray(db);\n  assert( db->nDb<=2 );\n  assert( db->aDb==db->aDbStatic );\n\n  /* Tell the code in notify.c that the connection no longer holds any\n  ** locks and does not require any further unlock-notify callbacks.\n  */\n  sqlite3ConnectionClosed(db);\n\n  for(i=sqliteHashFirst(&db->aFunc); i; i=sqliteHashNext(i)){\n    FuncDef *pNext, *p;\n    p = sqliteHashData(i);\n    do{\n      functionDestroy(db, p);\n      pNext = p->pNext;\n      sqlite3DbFree(db, p);\n      p = pNext;\n    }while( p );\n  }\n  sqlite3HashClear(&db->aFunc);\n  for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){\n    CollSeq *pColl = (CollSeq *)sqliteHashData(i);\n    /* Invoke any destructors registered for collation sequence user data. */\n    for(j=0; j<3; j++){\n      if( pColl[j].xDel ){\n        pColl[j].xDel(pColl[j].pUser);\n      }\n    }\n    sqlite3DbFree(db, pColl);\n  }\n  sqlite3HashClear(&db->aCollSeq);\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  for(i=sqliteHashFirst(&db->aModule); i; i=sqliteHashNext(i)){\n    Module *pMod = (Module *)sqliteHashData(i);\n    if( pMod->xDestroy ){\n      pMod->xDestroy(pMod->pAux);\n    }\n    sqlite3VtabEponymousTableClear(db, pMod);\n    sqlite3DbFree(db, pMod);\n  }\n  sqlite3HashClear(&db->aModule);\n#endif\n\n  sqlite3Error(db, SQLITE_OK); /* Deallocates any cached error strings. */\n  sqlite3ValueFree(db->pErr);\n  sqlite3CloseExtensions(db);\n#if SQLITE_USER_AUTHENTICATION\n  sqlite3_free(db->auth.zAuthUser);\n  sqlite3_free(db->auth.zAuthPW);\n#endif\n\n  db->magic = SQLITE_MAGIC_ERROR;\n\n  /* The temp-database schema is allocated differently from the other schema\n  ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()).\n  ** So it needs to be freed here. Todo: Why not roll the temp schema into\n  ** the same sqliteMalloc() as the one that allocates the database \n  ** structure?\n  */\n  sqlite3DbFree(db, db->aDb[1].pSchema);\n  sqlite3_mutex_leave(db->mutex);\n  db->magic = SQLITE_MAGIC_CLOSED;\n  sqlite3_mutex_free(db->mutex);\n  assert( db->lookaside.nOut==0 );  /* Fails on a lookaside memory leak */\n  if( db->lookaside.bMalloced ){\n    sqlite3_free(db->lookaside.pStart);\n  }\n  sqlite3_free(db);\n}\n\n/*\n** Rollback all database files.  If tripCode is not SQLITE_OK, then\n** any write cursors are invalidated (\"tripped\" - as in \"tripping a circuit\n** breaker\") and made to return tripCode if there are any further\n** attempts to use that cursor.  Read cursors remain open and valid\n** but are \"saved\" in case the table pages are moved around.\n*/\nvoid sqlite3RollbackAll(sqlite3 *db, int tripCode){\n  int i;\n  int inTrans = 0;\n  int schemaChange;\n  assert( sqlite3_mutex_held(db->mutex) );\n  sqlite3BeginBenignMalloc();\n\n  /* Obtain all b-tree mutexes before making any calls to BtreeRollback(). \n  ** This is important in case the transaction being rolled back has\n  ** modified the database schema. If the b-tree mutexes are not taken\n  ** here, then another shared-cache connection might sneak in between\n  ** the database rollback and schema reset, which can cause false\n  ** corruption reports in some cases.  */\n  sqlite3BtreeEnterAll(db);\n  schemaChange = (db->flags & SQLITE_InternChanges)!=0 && db->init.busy==0;\n\n  for(i=0; i<db->nDb; i++){\n    Btree *p = db->aDb[i].pBt;\n    if( p ){\n      if( sqlite3BtreeIsInTrans(p) ){\n        inTrans = 1;\n      }\n      sqlite3BtreeRollback(p, tripCode, !schemaChange);\n    }\n  }\n  sqlite3VtabRollback(db);\n  sqlite3EndBenignMalloc();\n\n  if( (db->flags&SQLITE_InternChanges)!=0 && db->init.busy==0 ){\n    sqlite3ExpirePreparedStatements(db);\n    sqlite3ResetAllSchemasOfConnection(db);\n  }\n  sqlite3BtreeLeaveAll(db);\n\n  /* Any deferred constraint violations have now been resolved. */\n  db->nDeferredCons = 0;\n  db->nDeferredImmCons = 0;\n  db->flags &= ~SQLITE_DeferFKs;\n\n  /* If one has been configured, invoke the rollback-hook callback */\n  if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){\n    db->xRollbackCallback(db->pRollbackArg);\n  }\n}\n\n/*\n** Return a static string containing the name corresponding to the error code\n** specified in the argument.\n*/\n#if defined(SQLITE_NEED_ERR_NAME)\nconst char *sqlite3ErrName(int rc){\n  const char *zName = 0;\n  int i, origRc = rc;\n  for(i=0; i<2 && zName==0; i++, rc &= 0xff){\n    switch( rc ){\n      case SQLITE_OK:                 zName = \"SQLITE_OK\";                break;\n      case SQLITE_ERROR:              zName = \"SQLITE_ERROR\";             break;\n      case SQLITE_INTERNAL:           zName = \"SQLITE_INTERNAL\";          break;\n      case SQLITE_PERM:               zName = \"SQLITE_PERM\";              break;\n      case SQLITE_ABORT:              zName = \"SQLITE_ABORT\";             break;\n      case SQLITE_ABORT_ROLLBACK:     zName = \"SQLITE_ABORT_ROLLBACK\";    break;\n      case SQLITE_BUSY:               zName = \"SQLITE_BUSY\";              break;\n      case SQLITE_BUSY_RECOVERY:      zName = \"SQLITE_BUSY_RECOVERY\";     break;\n      case SQLITE_BUSY_SNAPSHOT:      zName = \"SQLITE_BUSY_SNAPSHOT\";     break;\n      case SQLITE_LOCKED:             zName = \"SQLITE_LOCKED\";            break;\n      case SQLITE_LOCKED_SHAREDCACHE: zName = \"SQLITE_LOCKED_SHAREDCACHE\";break;\n      case SQLITE_NOMEM:              zName = \"SQLITE_NOMEM\";             break;\n      case SQLITE_READONLY:           zName = \"SQLITE_READONLY\";          break;\n      case SQLITE_READONLY_RECOVERY:  zName = \"SQLITE_READONLY_RECOVERY\"; break;\n      case SQLITE_READONLY_CANTLOCK:  zName = \"SQLITE_READONLY_CANTLOCK\"; break;\n      case SQLITE_READONLY_ROLLBACK:  zName = \"SQLITE_READONLY_ROLLBACK\"; break;\n      case SQLITE_READONLY_DBMOVED:   zName = \"SQLITE_READONLY_DBMOVED\";  break;\n      case SQLITE_INTERRUPT:          zName = \"SQLITE_INTERRUPT\";         break;\n      case SQLITE_IOERR:              zName = \"SQLITE_IOERR\";             break;\n      case SQLITE_IOERR_READ:         zName = \"SQLITE_IOERR_READ\";        break;\n      case SQLITE_IOERR_SHORT_READ:   zName = \"SQLITE_IOERR_SHORT_READ\";  break;\n      case SQLITE_IOERR_WRITE:        zName = \"SQLITE_IOERR_WRITE\";       break;\n      case SQLITE_IOERR_FSYNC:        zName = \"SQLITE_IOERR_FSYNC\";       break;\n      case SQLITE_IOERR_DIR_FSYNC:    zName = \"SQLITE_IOERR_DIR_FSYNC\";   break;\n      case SQLITE_IOERR_TRUNCATE:     zName = \"SQLITE_IOERR_TRUNCATE\";    break;\n      case SQLITE_IOERR_FSTAT:        zName = \"SQLITE_IOERR_FSTAT\";       break;\n      case SQLITE_IOERR_UNLOCK:       zName = \"SQLITE_IOERR_UNLOCK\";      break;\n      case SQLITE_IOERR_RDLOCK:       zName = \"SQLITE_IOERR_RDLOCK\";      break;\n      case SQLITE_IOERR_DELETE:       zName = \"SQLITE_IOERR_DELETE\";      break;\n      case SQLITE_IOERR_NOMEM:        zName = \"SQLITE_IOERR_NOMEM\";       break;\n      case SQLITE_IOERR_ACCESS:       zName = \"SQLITE_IOERR_ACCESS\";      break;\n      case SQLITE_IOERR_CHECKRESERVEDLOCK:\n                                zName = \"SQLITE_IOERR_CHECKRESERVEDLOCK\"; break;\n      case SQLITE_IOERR_LOCK:         zName = \"SQLITE_IOERR_LOCK\";        break;\n      case SQLITE_IOERR_CLOSE:        zName = \"SQLITE_IOERR_CLOSE\";       break;\n      case SQLITE_IOERR_DIR_CLOSE:    zName = \"SQLITE_IOERR_DIR_CLOSE\";   break;\n      case SQLITE_IOERR_SHMOPEN:      zName = \"SQLITE_IOERR_SHMOPEN\";     break;\n      case SQLITE_IOERR_SHMSIZE:      zName = \"SQLITE_IOERR_SHMSIZE\";     break;\n      case SQLITE_IOERR_SHMLOCK:      zName = \"SQLITE_IOERR_SHMLOCK\";     break;\n      case SQLITE_IOERR_SHMMAP:       zName = \"SQLITE_IOERR_SHMMAP\";      break;\n      case SQLITE_IOERR_SEEK:         zName = \"SQLITE_IOERR_SEEK\";        break;\n      case SQLITE_IOERR_DELETE_NOENT: zName = \"SQLITE_IOERR_DELETE_NOENT\";break;\n      case SQLITE_IOERR_MMAP:         zName = \"SQLITE_IOERR_MMAP\";        break;\n      case SQLITE_IOERR_GETTEMPPATH:  zName = \"SQLITE_IOERR_GETTEMPPATH\"; break;\n      case SQLITE_IOERR_CONVPATH:     zName = \"SQLITE_IOERR_CONVPATH\";    break;\n      case SQLITE_CORRUPT:            zName = \"SQLITE_CORRUPT\";           break;\n      case SQLITE_CORRUPT_VTAB:       zName = \"SQLITE_CORRUPT_VTAB\";      break;\n      case SQLITE_NOTFOUND:           zName = \"SQLITE_NOTFOUND\";          break;\n      case SQLITE_FULL:               zName = \"SQLITE_FULL\";              break;\n      case SQLITE_CANTOPEN:           zName = \"SQLITE_CANTOPEN\";          break;\n      case SQLITE_CANTOPEN_NOTEMPDIR: zName = \"SQLITE_CANTOPEN_NOTEMPDIR\";break;\n      case SQLITE_CANTOPEN_ISDIR:     zName = \"SQLITE_CANTOPEN_ISDIR\";    break;\n      case SQLITE_CANTOPEN_FULLPATH:  zName = \"SQLITE_CANTOPEN_FULLPATH\"; break;\n      case SQLITE_CANTOPEN_CONVPATH:  zName = \"SQLITE_CANTOPEN_CONVPATH\"; break;\n      case SQLITE_PROTOCOL:           zName = \"SQLITE_PROTOCOL\";          break;\n      case SQLITE_EMPTY:              zName = \"SQLITE_EMPTY\";             break;\n      case SQLITE_SCHEMA:             zName = \"SQLITE_SCHEMA\";            break;\n      case SQLITE_TOOBIG:             zName = \"SQLITE_TOOBIG\";            break;\n      case SQLITE_CONSTRAINT:         zName = \"SQLITE_CONSTRAINT\";        break;\n      case SQLITE_CONSTRAINT_UNIQUE:  zName = \"SQLITE_CONSTRAINT_UNIQUE\"; break;\n      case SQLITE_CONSTRAINT_TRIGGER: zName = \"SQLITE_CONSTRAINT_TRIGGER\";break;\n      case SQLITE_CONSTRAINT_FOREIGNKEY:\n                                zName = \"SQLITE_CONSTRAINT_FOREIGNKEY\";   break;\n      case SQLITE_CONSTRAINT_CHECK:   zName = \"SQLITE_CONSTRAINT_CHECK\";  break;\n      case SQLITE_CONSTRAINT_PRIMARYKEY:\n                                zName = \"SQLITE_CONSTRAINT_PRIMARYKEY\";   break;\n      case SQLITE_CONSTRAINT_NOTNULL: zName = \"SQLITE_CONSTRAINT_NOTNULL\";break;\n      case SQLITE_CONSTRAINT_COMMITHOOK:\n                                zName = \"SQLITE_CONSTRAINT_COMMITHOOK\";   break;\n      case SQLITE_CONSTRAINT_VTAB:    zName = \"SQLITE_CONSTRAINT_VTAB\";   break;\n      case SQLITE_CONSTRAINT_FUNCTION:\n                                zName = \"SQLITE_CONSTRAINT_FUNCTION\";     break;\n      case SQLITE_CONSTRAINT_ROWID:   zName = \"SQLITE_CONSTRAINT_ROWID\";  break;\n      case SQLITE_MISMATCH:           zName = \"SQLITE_MISMATCH\";          break;\n      case SQLITE_MISUSE:             zName = \"SQLITE_MISUSE\";            break;\n      case SQLITE_NOLFS:              zName = \"SQLITE_NOLFS\";             break;\n      case SQLITE_AUTH:               zName = \"SQLITE_AUTH\";              break;\n      case SQLITE_FORMAT:             zName = \"SQLITE_FORMAT\";            break;\n      case SQLITE_RANGE:              zName = \"SQLITE_RANGE\";             break;\n      case SQLITE_NOTADB:             zName = \"SQLITE_NOTADB\";            break;\n      case SQLITE_ROW:                zName = \"SQLITE_ROW\";               break;\n      case SQLITE_NOTICE:             zName = \"SQLITE_NOTICE\";            break;\n      case SQLITE_NOTICE_RECOVER_WAL: zName = \"SQLITE_NOTICE_RECOVER_WAL\";break;\n      case SQLITE_NOTICE_RECOVER_ROLLBACK:\n                                zName = \"SQLITE_NOTICE_RECOVER_ROLLBACK\"; break;\n      case SQLITE_WARNING:            zName = \"SQLITE_WARNING\";           break;\n      case SQLITE_WARNING_AUTOINDEX:  zName = \"SQLITE_WARNING_AUTOINDEX\"; break;\n      case SQLITE_DONE:               zName = \"SQLITE_DONE\";              break;\n    }\n  }\n  if( zName==0 ){\n    static char zBuf[50];\n    sqlite3_snprintf(sizeof(zBuf), zBuf, \"SQLITE_UNKNOWN(%d)\", origRc);\n    zName = zBuf;\n  }\n  return zName;\n}\n#endif\n\n/*\n** Return a static string that describes the kind of error specified in the\n** argument.\n*/\nconst char *sqlite3ErrStr(int rc){\n  static const char* const aMsg[] = {\n    /* SQLITE_OK          */ \"not an error\",\n    /* SQLITE_ERROR       */ \"SQL logic error or missing database\",\n    /* SQLITE_INTERNAL    */ 0,\n    /* SQLITE_PERM        */ \"access permission denied\",\n    /* SQLITE_ABORT       */ \"callback requested query abort\",\n    /* SQLITE_BUSY        */ \"database is locked\",\n    /* SQLITE_LOCKED      */ \"database table is locked\",\n    /* SQLITE_NOMEM       */ \"out of memory\",\n    /* SQLITE_READONLY    */ \"attempt to write a readonly database\",\n    /* SQLITE_INTERRUPT   */ \"interrupted\",\n    /* SQLITE_IOERR       */ \"disk I/O error\",\n    /* SQLITE_CORRUPT     */ \"database disk image is malformed\",\n    /* SQLITE_NOTFOUND    */ \"unknown operation\",\n    /* SQLITE_FULL        */ \"database or disk is full\",\n    /* SQLITE_CANTOPEN    */ \"unable to open database file\",\n    /* SQLITE_PROTOCOL    */ \"locking protocol\",\n    /* SQLITE_EMPTY       */ \"table contains no data\",\n    /* SQLITE_SCHEMA      */ \"database schema has changed\",\n    /* SQLITE_TOOBIG      */ \"string or blob too big\",\n    /* SQLITE_CONSTRAINT  */ \"constraint failed\",\n    /* SQLITE_MISMATCH    */ \"datatype mismatch\",\n    /* SQLITE_MISUSE      */ \"library routine called out of sequence\",\n    /* SQLITE_NOLFS       */ \"large file support is disabled\",\n    /* SQLITE_AUTH        */ \"authorization denied\",\n    /* SQLITE_FORMAT      */ \"auxiliary database format error\",\n    /* SQLITE_RANGE       */ \"bind or column index out of range\",\n    /* SQLITE_NOTADB      */ \"file is encrypted or is not a database\",\n  };\n  const char *zErr = \"unknown error\";\n  switch( rc ){\n    case SQLITE_ABORT_ROLLBACK: {\n      zErr = \"abort due to ROLLBACK\";\n      break;\n    }\n    default: {\n      rc &= 0xff;\n      if( ALWAYS(rc>=0) && rc<ArraySize(aMsg) && aMsg[rc]!=0 ){\n        zErr = aMsg[rc];\n      }\n      break;\n    }\n  }\n  return zErr;\n}\n\n/*\n** This routine implements a busy callback that sleeps and tries\n** again until a timeout value is reached.  The timeout value is\n** an integer number of milliseconds passed in as the first\n** argument.\n*/\nstatic int sqliteDefaultBusyCallback(\n void *ptr,               /* Database connection */\n int count                /* Number of times table has been busy */\n){\n#if SQLITE_OS_WIN || HAVE_USLEEP\n  static const u8 delays[] =\n     { 1, 2, 5, 10, 15, 20, 25, 25,  25,  50,  50, 100 };\n  static const u8 totals[] =\n     { 0, 1, 3,  8, 18, 33, 53, 78, 103, 128, 178, 228 };\n# define NDELAY ArraySize(delays)\n  sqlite3 *db = (sqlite3 *)ptr;\n  int timeout = db->busyTimeout;\n  int delay, prior;\n\n  assert( count>=0 );\n  if( count < NDELAY ){\n    delay = delays[count];\n    prior = totals[count];\n  }else{\n    delay = delays[NDELAY-1];\n    prior = totals[NDELAY-1] + delay*(count-(NDELAY-1));\n  }\n  if( prior + delay > timeout ){\n    delay = timeout - prior;\n    if( delay<=0 ) return 0;\n  }\n  sqlite3OsSleep(db->pVfs, delay*1000);\n  return 1;\n#else\n  sqlite3 *db = (sqlite3 *)ptr;\n  int timeout = ((sqlite3 *)ptr)->busyTimeout;\n  if( (count+1)*1000 > timeout ){\n    return 0;\n  }\n  sqlite3OsSleep(db->pVfs, 1000000);\n  return 1;\n#endif\n}\n\n/*\n** Invoke the given busy handler.\n**\n** This routine is called when an operation failed with a lock.\n** If this routine returns non-zero, the lock is retried.  If it\n** returns 0, the operation aborts with an SQLITE_BUSY error.\n*/\nint sqlite3InvokeBusyHandler(BusyHandler *p){\n#if SQLITE_WCDB_SIGNAL_RETRY\n  return 1;\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n  int rc;\n  if( NEVER(p==0) || p->xFunc==0 || p->nBusy<0 ) return 0;\n  rc = p->xFunc(p->pArg, p->nBusy);\n  if( rc==0 ){\n    p->nBusy = -1;\n  }else{\n    p->nBusy++;\n  }\n  return rc; \n}\n\n/*\n** This routine sets the busy callback for an Sqlite database to the\n** given callback function with the given argument.\n*/\nint sqlite3_busy_handler(\n  sqlite3 *db,\n  int (*xBusy)(void*,int),\n  void *pArg\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  db->busyHandler.xFunc = xBusy;\n  db->busyHandler.pArg = pArg;\n  db->busyHandler.nBusy = 0;\n  db->busyTimeout = 0;\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\n/*\n** This routine sets the progress callback for an Sqlite database to the\n** given callback function with the given argument. The progress callback will\n** be invoked every nOps opcodes.\n*/\nvoid sqlite3_progress_handler(\n  sqlite3 *db, \n  int nOps,\n  int (*xProgress)(void*), \n  void *pArg\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  if( nOps>0 ){\n    db->xProgress = xProgress;\n    db->nProgressOps = (unsigned)nOps;\n    db->pProgressArg = pArg;\n  }else{\n    db->xProgress = 0;\n    db->nProgressOps = 0;\n    db->pProgressArg = 0;\n  }\n  sqlite3_mutex_leave(db->mutex);\n}\n#endif\n\n\n/*\n** This routine installs a default busy handler that waits for the\n** specified number of milliseconds before returning 0.\n*/\nint sqlite3_busy_timeout(sqlite3 *db, int ms){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  if( ms>0 ){\n    sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);\n    db->busyTimeout = ms;\n  }else{\n    sqlite3_busy_handler(db, 0, 0);\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Cause any pending operation to stop at its earliest opportunity.\n*/\nvoid sqlite3_interrupt(sqlite3 *db){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return;\n  }\n#endif\n  db->u1.isInterrupted = 1;\n}\n\n\n/*\n** This function is exactly the same as sqlite3_create_function(), except\n** that it is designed to be called by internal code. The difference is\n** that if a malloc() fails in sqlite3_create_function(), an error code\n** is returned and the mallocFailed flag cleared. \n*/\nint sqlite3CreateFunc(\n  sqlite3 *db,\n  const char *zFunctionName,\n  int nArg,\n  int enc,\n  void *pUserData,\n  void (*xSFunc)(sqlite3_context*,int,sqlite3_value **),\n  void (*xStep)(sqlite3_context*,int,sqlite3_value **),\n  void (*xFinal)(sqlite3_context*),\n  FuncDestructor *pDestructor\n){\n  FuncDef *p;\n  int nName;\n  int extraFlags;\n\n  assert( sqlite3_mutex_held(db->mutex) );\n  if( zFunctionName==0 ||\n      (xSFunc && (xFinal || xStep)) || \n      (!xSFunc && (xFinal && !xStep)) ||\n      (!xSFunc && (!xFinal && xStep)) ||\n      (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) ||\n      (255<(nName = sqlite3Strlen30( zFunctionName))) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n\n  assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC );\n  extraFlags = enc &  SQLITE_DETERMINISTIC;\n  enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY);\n  \n#ifndef SQLITE_OMIT_UTF16\n  /* If SQLITE_UTF16 is specified as the encoding type, transform this\n  ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the\n  ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.\n  **\n  ** If SQLITE_ANY is specified, add three versions of the function\n  ** to the hash table.\n  */\n  if( enc==SQLITE_UTF16 ){\n    enc = SQLITE_UTF16NATIVE;\n  }else if( enc==SQLITE_ANY ){\n    int rc;\n    rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8|extraFlags,\n         pUserData, xSFunc, xStep, xFinal, pDestructor);\n    if( rc==SQLITE_OK ){\n      rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE|extraFlags,\n          pUserData, xSFunc, xStep, xFinal, pDestructor);\n    }\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    enc = SQLITE_UTF16BE;\n  }\n#else\n  enc = SQLITE_UTF8;\n#endif\n  \n  /* Check if an existing function is being overridden or deleted. If so,\n  ** and there are active VMs, then return SQLITE_BUSY. If a function\n  ** is being overridden/deleted but there are no active VMs, allow the\n  ** operation to continue but invalidate all precompiled statements.\n  */\n  p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 0);\n  if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==enc && p->nArg==nArg ){\n    if( db->nVdbeActive ){\n      sqlite3ErrorWithMsg(db, SQLITE_BUSY, \n        \"unable to delete/modify user-function due to active statements\");\n      assert( !db->mallocFailed );\n      return SQLITE_BUSY;\n    }else{\n      sqlite3ExpirePreparedStatements(db);\n    }\n  }\n\n  p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 1);\n  assert(p || db->mallocFailed);\n  if( !p ){\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  /* If an older version of the function with a configured destructor is\n  ** being replaced invoke the destructor function here. */\n  functionDestroy(db, p);\n\n  if( pDestructor ){\n    pDestructor->nRef++;\n  }\n  p->u.pDestructor = pDestructor;\n  p->funcFlags = (p->funcFlags & SQLITE_FUNC_ENCMASK) | extraFlags;\n  testcase( p->funcFlags & SQLITE_DETERMINISTIC );\n  p->xSFunc = xSFunc ? xSFunc : xStep;\n  p->xFinalize = xFinal;\n  p->pUserData = pUserData;\n  p->nArg = (u16)nArg;\n  return SQLITE_OK;\n}\n\n/*\n** Create new user functions.\n*/\nint sqlite3_create_function(\n  sqlite3 *db,\n  const char *zFunc,\n  int nArg,\n  int enc,\n  void *p,\n  void (*xSFunc)(sqlite3_context*,int,sqlite3_value **),\n  void (*xStep)(sqlite3_context*,int,sqlite3_value **),\n  void (*xFinal)(sqlite3_context*)\n){\n  return sqlite3_create_function_v2(db, zFunc, nArg, enc, p, xSFunc, xStep,\n                                    xFinal, 0);\n}\n\nint sqlite3_create_function_v2(\n  sqlite3 *db,\n  const char *zFunc,\n  int nArg,\n  int enc,\n  void *p,\n  void (*xSFunc)(sqlite3_context*,int,sqlite3_value **),\n  void (*xStep)(sqlite3_context*,int,sqlite3_value **),\n  void (*xFinal)(sqlite3_context*),\n  void (*xDestroy)(void *)\n){\n  int rc = SQLITE_ERROR;\n  FuncDestructor *pArg = 0;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  if( xDestroy ){\n    pArg = (FuncDestructor *)sqlite3DbMallocZero(db, sizeof(FuncDestructor));\n    if( !pArg ){\n      xDestroy(p);\n      goto out;\n    }\n    pArg->xDestroy = xDestroy;\n    pArg->pUserData = p;\n  }\n  rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p, xSFunc, xStep, xFinal, pArg);\n  if( pArg && pArg->nRef==0 ){\n    assert( rc!=SQLITE_OK );\n    xDestroy(p);\n    sqlite3DbFree(db, pArg);\n  }\n\n out:\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n#ifndef SQLITE_OMIT_UTF16\nint sqlite3_create_function16(\n  sqlite3 *db,\n  const void *zFunctionName,\n  int nArg,\n  int eTextRep,\n  void *p,\n  void (*xSFunc)(sqlite3_context*,int,sqlite3_value**),\n  void (*xStep)(sqlite3_context*,int,sqlite3_value**),\n  void (*xFinal)(sqlite3_context*)\n){\n  int rc;\n  char *zFunc8;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zFunctionName==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  assert( !db->mallocFailed );\n  zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE);\n  rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xSFunc,xStep,xFinal,0);\n  sqlite3DbFree(db, zFunc8);\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n#endif\n\n\n/*\n** Declare that a function has been overloaded by a virtual table.\n**\n** If the function already exists as a regular global function, then\n** this routine is a no-op.  If the function does not exist, then create\n** a new one that always throws a run-time error.  \n**\n** When virtual tables intend to provide an overloaded function, they\n** should call this routine to make sure the global function exists.\n** A global function must exist in order for name resolution to work\n** properly.\n*/\nint sqlite3_overload_function(\n  sqlite3 *db,\n  const char *zName,\n  int nArg\n){\n  int rc = SQLITE_OK;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zName==0 || nArg<-2 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  if( sqlite3FindFunction(db, zName, nArg, SQLITE_UTF8, 0)==0 ){\n    rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,\n                           0, sqlite3InvalidFunction, 0, 0, 0);\n  }\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n#ifndef SQLITE_OMIT_TRACE\n/*\n** Register a trace function.  The pArg from the previously registered trace\n** is returned.  \n**\n** A NULL trace function means that no tracing is executes.  A non-NULL\n** trace is a pointer to a function that is invoked at the start of each\n** SQL statement.\n*/\n#ifndef SQLITE_OMIT_DEPRECATED\nvoid *sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){\n  void *pOld;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pOld = db->pTraceArg;\n  db->mTrace = xTrace ? SQLITE_TRACE_LEGACY : 0;\n  db->xTrace = (int(*)(u32,void*,void*,void*))xTrace;\n  db->pTraceArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return pOld;\n}\n#endif /* SQLITE_OMIT_DEPRECATED */\n\n/* Register a trace callback using the version-2 interface.\n*/\nint sqlite3_trace_v2(\n  sqlite3 *db,                               /* Trace this connection */\n  unsigned mTrace,                           /* Mask of events to be traced */\n  int(*xTrace)(unsigned,void*,void*,void*),  /* Callback to invoke */\n  void *pArg                                 /* Context */\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  if( mTrace==0 ) xTrace = 0;\n  if( xTrace==0 ) mTrace = 0;\n  db->mTrace = mTrace;\n  db->xTrace = xTrace;\n  db->pTraceArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** Register a profile function.  The pArg from the previously registered \n** profile function is returned.  \n**\n** A NULL profile function means that no profiling is executes.  A non-NULL\n** profile is a pointer to a function that is invoked at the conclusion of\n** each SQL statement that is run.\n*/\nvoid *sqlite3_profile(\n  sqlite3 *db,\n  void (*xProfile)(void*,const char*,sqlite_uint64),\n  void *pArg\n){\n  void *pOld;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pOld = db->pProfileArg;\n  db->xProfile = xProfile;\n  db->pProfileArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return pOld;\n}\n#endif /* SQLITE_OMIT_DEPRECATED */\n#endif /* SQLITE_OMIT_TRACE */\n\n/*\n** Register a function to be invoked when a transaction commits.\n** If the invoked function returns non-zero, then the commit becomes a\n** rollback.\n*/\nvoid *sqlite3_commit_hook(\n  sqlite3 *db,              /* Attach the hook to this database */\n  int (*xCallback)(void*),  /* Function to invoke on each commit */\n  void *pArg                /* Argument to the function */\n){\n  void *pOld;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pOld = db->pCommitArg;\n  db->xCommitCallback = xCallback;\n  db->pCommitArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return pOld;\n}\n\n/*\n** Register a callback to be invoked each time a row is updated,\n** inserted or deleted using this database connection.\n*/\nvoid *sqlite3_update_hook(\n  sqlite3 *db,              /* Attach the hook to this database */\n  void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),\n  void *pArg                /* Argument to the function */\n){\n  void *pRet;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pRet = db->pUpdateArg;\n  db->xUpdateCallback = xCallback;\n  db->pUpdateArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return pRet;\n}\n\n/*\n** Register a callback to be invoked each time a transaction is rolled\n** back by this database connection.\n*/\nvoid *sqlite3_rollback_hook(\n  sqlite3 *db,              /* Attach the hook to this database */\n  void (*xCallback)(void*), /* Callback function */\n  void *pArg                /* Argument to the function */\n){\n  void *pRet;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pRet = db->pRollbackArg;\n  db->xRollbackCallback = xCallback;\n  db->pRollbackArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return pRet;\n}\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n/*\n** Register a callback to be invoked each time a row is updated,\n** inserted or deleted using this database connection.\n*/\nvoid *sqlite3_preupdate_hook(\n  sqlite3 *db,              /* Attach the hook to this database */\n  void(*xCallback)(         /* Callback function */\n    void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64),\n  void *pArg                /* First callback argument */\n){\n  void *pRet;\n  sqlite3_mutex_enter(db->mutex);\n  pRet = db->pPreUpdateArg;\n  db->xPreUpdateCallback = xCallback;\n  db->pPreUpdateArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return pRet;\n}\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n\n#ifndef SQLITE_OMIT_WAL\n/*\n** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint().\n** Invoke sqlite3_wal_checkpoint if the number of frames in the log file\n** is greater than sqlite3.pWalArg cast to an integer (the value configured by\n** wal_autocheckpoint()).\n*/ \nint sqlite3WalDefaultHook(\n  void *pClientData,     /* Argument */\n  sqlite3 *db,           /* Connection */\n  const char *zDb,       /* Database */\n  int nFrame             /* Size of WAL */\n){\n  if( nFrame>=SQLITE_PTR_TO_INT(pClientData) ){\n    sqlite3BeginBenignMalloc();\n    sqlite3_wal_checkpoint(db, zDb);\n    sqlite3EndBenignMalloc();\n  }\n  return SQLITE_OK;\n}\n#endif /* SQLITE_OMIT_WAL */\n\n/*\n** Configure an sqlite3_wal_hook() callback to automatically checkpoint\n** a database after committing a transaction if there are nFrame or\n** more frames in the log file. Passing zero or a negative value as the\n** nFrame parameter disables automatic checkpoints entirely.\n**\n** The callback registered by this function replaces any existing callback\n** registered using sqlite3_wal_hook(). Likewise, registering a callback\n** using sqlite3_wal_hook() disables the automatic checkpoint mechanism\n** configured by this function.\n*/\nint sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){\n#ifdef SQLITE_OMIT_WAL\n  UNUSED_PARAMETER(db);\n  UNUSED_PARAMETER(nFrame);\n#else\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  if( nFrame>0 ){\n    sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame));\n  }else{\n    sqlite3_wal_hook(db, 0, 0);\n  }\n#endif\n  return SQLITE_OK;\n}\n\n/*\n** Register a callback to be invoked each time a transaction is written\n** into the write-ahead-log by this database connection.\n*/\nvoid *sqlite3_wal_hook(\n  sqlite3 *db,                    /* Attach the hook to this db handle */\n  int(*xCallback)(void *, sqlite3*, const char*, int),\n  void *pArg                      /* First argument passed to xCallback() */\n){\n#ifndef SQLITE_OMIT_WAL\n  void *pRet;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pRet = db->pWalArg;\n  db->xWalCallback = xCallback;\n  db->pWalArg = pArg;\n  sqlite3_mutex_leave(db->mutex);\n  return pRet;\n#else\n  return 0;\n#endif\n}\n\n/*\n** Checkpoint database zDb.\n*/\nint sqlite3_wal_checkpoint_v2(\n  sqlite3 *db,                    /* Database handle */\n  const char *zDb,                /* Name of attached database (or NULL) */\n  int eMode,                      /* SQLITE_CHECKPOINT_* value */\n  int *pnLog,                     /* OUT: Size of WAL log in frames */\n  int *pnCkpt                     /* OUT: Total number of frames checkpointed */\n){\n#ifdef SQLITE_OMIT_WAL\n  return SQLITE_OK;\n#else\n  int rc;                         /* Return code */\n  int iDb = SQLITE_MAX_ATTACHED;  /* sqlite3.aDb[] index of db to checkpoint */\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n\n  /* Initialize the output variables to -1 in case an error occurs. */\n  if( pnLog ) *pnLog = -1;\n  if( pnCkpt ) *pnCkpt = -1;\n\n  assert( SQLITE_CHECKPOINT_PASSIVE==0 );\n  assert( SQLITE_CHECKPOINT_FULL==1 );\n  assert( SQLITE_CHECKPOINT_RESTART==2 );\n  assert( SQLITE_CHECKPOINT_TRUNCATE==3 );\n  if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_TRUNCATE ){\n    /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint\n    ** mode: */\n    return SQLITE_MISUSE;\n  }\n\n  sqlite3_mutex_enter(db->mutex);\n  if( zDb && zDb[0] ){\n    iDb = sqlite3FindDbName(db, zDb);\n  }\n  if( iDb<0 ){\n    rc = SQLITE_ERROR;\n    sqlite3ErrorWithMsg(db, SQLITE_ERROR, \"unknown database: %s\", zDb);\n  }else{\n    db->busyHandler.nBusy = 0;\n    rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt);\n    sqlite3Error(db, rc);\n  }\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n#endif\n}\n\n\n/*\n** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points\n** to contains a zero-length string, all attached databases are \n** checkpointed.\n*/\nint sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){\n  /* EVIDENCE-OF: R-41613-20553 The sqlite3_wal_checkpoint(D,X) is equivalent to\n  ** sqlite3_wal_checkpoint_v2(D,X,SQLITE_CHECKPOINT_PASSIVE,0,0). */\n  return sqlite3_wal_checkpoint_v2(db,zDb,SQLITE_CHECKPOINT_PASSIVE,0,0);\n}\n\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\nint sqlite3_wal_checkpoint_handler(sqlite3 *db,\n                                   int (*xCheckpoint)(void*,int),\n                                   void* pArg){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  int rc = sqlite3BtreeCheckpointHandler(db->aDb[0].pBt, xCheckpoint, pArg);\n  sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n#ifndef SQLITE_OMIT_WAL\n/*\n** Run a checkpoint on database iDb. This is a no-op if database iDb is\n** not currently open in WAL mode.\n**\n** If a transaction is open on the database being checkpointed, this \n** function returns SQLITE_LOCKED and a checkpoint is not attempted. If \n** an error occurs while running the checkpoint, an SQLite error code is \n** returned (i.e. SQLITE_IOERR). Otherwise, SQLITE_OK.\n**\n** The mutex on database handle db should be held by the caller. The mutex\n** associated with the specific b-tree being checkpointed is taken by\n** this function while the checkpoint is running.\n**\n** If iDb is passed SQLITE_MAX_ATTACHED, then all attached databases are\n** checkpointed. If an error is encountered it is returned immediately -\n** no attempt is made to checkpoint any remaining databases.\n**\n** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.\n*/\nint sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){\n  int rc = SQLITE_OK;             /* Return code */\n  int i;                          /* Used to iterate through attached dbs */\n  int bBusy = 0;                  /* True if SQLITE_BUSY has been encountered */\n\n  assert( sqlite3_mutex_held(db->mutex) );\n  assert( !pnLog || *pnLog==-1 );\n  assert( !pnCkpt || *pnCkpt==-1 );\n\n  for(i=0; i<db->nDb && rc==SQLITE_OK; i++){\n    if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){\n      rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt);\n      pnLog = 0;\n      pnCkpt = 0;\n      if( rc==SQLITE_BUSY ){\n        bBusy = 1;\n        rc = SQLITE_OK;\n      }\n    }\n  }\n\n  return (rc==SQLITE_OK && bBusy) ? SQLITE_BUSY : rc;\n}\n#endif /* SQLITE_OMIT_WAL */\n\n/*\n** This function returns true if main-memory should be used instead of\n** a temporary file for transient pager files and statement journals.\n** The value returned depends on the value of db->temp_store (runtime\n** parameter) and the compile time value of SQLITE_TEMP_STORE. The\n** following table describes the relationship between these two values\n** and this functions return value.\n**\n**   SQLITE_TEMP_STORE     db->temp_store     Location of temporary database\n**   -----------------     --------------     ------------------------------\n**   0                     any                file      (return 0)\n**   1                     1                  file      (return 0)\n**   1                     2                  memory    (return 1)\n**   1                     0                  file      (return 0)\n**   2                     1                  file      (return 0)\n**   2                     2                  memory    (return 1)\n**   2                     0                  memory    (return 1)\n**   3                     any                memory    (return 1)\n*/\nint sqlite3TempInMemory(const sqlite3 *db){\n#if SQLITE_TEMP_STORE==1\n  return ( db->temp_store==2 );\n#endif\n#if SQLITE_TEMP_STORE==2\n  return ( db->temp_store!=1 );\n#endif\n#if SQLITE_TEMP_STORE==3\n  UNUSED_PARAMETER(db);\n  return 1;\n#endif\n#if SQLITE_TEMP_STORE<1 || SQLITE_TEMP_STORE>3\n  UNUSED_PARAMETER(db);\n  return 0;\n#endif\n}\n\n/*\n** Return UTF-8 encoded English language explanation of the most recent\n** error.\n*/\nconst char *sqlite3_errmsg(sqlite3 *db){\n  const char *z;\n  if( !db ){\n    return sqlite3ErrStr(SQLITE_NOMEM_BKPT);\n  }\n  if( !sqlite3SafetyCheckSickOrOk(db) ){\n    return sqlite3ErrStr(SQLITE_MISUSE_BKPT);\n  }\n  sqlite3_mutex_enter(db->mutex);\n  if( db->mallocFailed ){\n    z = sqlite3ErrStr(SQLITE_NOMEM_BKPT);\n  }else{\n    testcase( db->pErr==0 );\n    z = (char*)sqlite3_value_text(db->pErr);\n    assert( !db->mallocFailed );\n    if( z==0 ){\n      z = sqlite3ErrStr(db->errCode);\n    }\n  }\n  sqlite3_mutex_leave(db->mutex);\n  return z;\n}\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** Return UTF-16 encoded English language explanation of the most recent\n** error.\n*/\nconst void *sqlite3_errmsg16(sqlite3 *db){\n  static const u16 outOfMem[] = {\n    'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0\n  };\n  static const u16 misuse[] = {\n    'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ', \n    'r', 'o', 'u', 't', 'i', 'n', 'e', ' ', \n    'c', 'a', 'l', 'l', 'e', 'd', ' ', \n    'o', 'u', 't', ' ', \n    'o', 'f', ' ', \n    's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0\n  };\n\n  const void *z;\n  if( !db ){\n    return (void *)outOfMem;\n  }\n  if( !sqlite3SafetyCheckSickOrOk(db) ){\n    return (void *)misuse;\n  }\n  sqlite3_mutex_enter(db->mutex);\n  if( db->mallocFailed ){\n    z = (void *)outOfMem;\n  }else{\n    z = sqlite3_value_text16(db->pErr);\n    if( z==0 ){\n      sqlite3ErrorWithMsg(db, db->errCode, sqlite3ErrStr(db->errCode));\n      z = sqlite3_value_text16(db->pErr);\n    }\n    /* A malloc() may have failed within the call to sqlite3_value_text16()\n    ** above. If this is the case, then the db->mallocFailed flag needs to\n    ** be cleared before returning. Do this directly, instead of via\n    ** sqlite3ApiExit(), to avoid setting the database handle error message.\n    */\n    sqlite3OomClear(db);\n  }\n  sqlite3_mutex_leave(db->mutex);\n  return z;\n}\n#endif /* SQLITE_OMIT_UTF16 */\n\n/*\n** Return the most recent error code generated by an SQLite routine. If NULL is\n** passed to this function, we assume a malloc() failed during sqlite3_open().\n*/\nint sqlite3_errcode(sqlite3 *db){\n  if( db && !sqlite3SafetyCheckSickOrOk(db) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n  if( !db || db->mallocFailed ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  return db->errCode & db->errMask;\n}\nint sqlite3_extended_errcode(sqlite3 *db){\n  if( db && !sqlite3SafetyCheckSickOrOk(db) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n  if( !db || db->mallocFailed ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  return db->errCode;\n}\nint sqlite3_system_errno(sqlite3 *db){\n  return db ? db->iSysErrno : 0;\n}  \n\n/*\n** Return a string that describes the kind of error specified in the\n** argument.  For now, this simply calls the internal sqlite3ErrStr()\n** function.\n*/\nconst char *sqlite3_errstr(int rc){\n  return sqlite3ErrStr(rc);\n}\n\n/*\n** Create a new collating function for database \"db\".  The name is zName\n** and the encoding is enc.\n*/\nstatic int createCollation(\n  sqlite3* db,\n  const char *zName, \n  u8 enc,\n  void* pCtx,\n  int(*xCompare)(void*,int,const void*,int,const void*),\n  void(*xDel)(void*)\n){\n  CollSeq *pColl;\n  int enc2;\n  \n  assert( sqlite3_mutex_held(db->mutex) );\n\n  /* If SQLITE_UTF16 is specified as the encoding type, transform this\n  ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the\n  ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.\n  */\n  enc2 = enc;\n  testcase( enc2==SQLITE_UTF16 );\n  testcase( enc2==SQLITE_UTF16_ALIGNED );\n  if( enc2==SQLITE_UTF16 || enc2==SQLITE_UTF16_ALIGNED ){\n    enc2 = SQLITE_UTF16NATIVE;\n  }\n  if( enc2<SQLITE_UTF8 || enc2>SQLITE_UTF16BE ){\n    return SQLITE_MISUSE_BKPT;\n  }\n\n  /* Check if this call is removing or replacing an existing collation \n  ** sequence. If so, and there are active VMs, return busy. If there\n  ** are no active VMs, invalidate any pre-compiled statements.\n  */\n  pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 0);\n  if( pColl && pColl->xCmp ){\n    if( db->nVdbeActive ){\n      sqlite3ErrorWithMsg(db, SQLITE_BUSY, \n        \"unable to delete/modify collation sequence due to active statements\");\n      return SQLITE_BUSY;\n    }\n    sqlite3ExpirePreparedStatements(db);\n\n    /* If collation sequence pColl was created directly by a call to\n    ** sqlite3_create_collation, and not generated by synthCollSeq(),\n    ** then any copies made by synthCollSeq() need to be invalidated.\n    ** Also, collation destructor - CollSeq.xDel() - function may need\n    ** to be called.\n    */ \n    if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){\n      CollSeq *aColl = sqlite3HashFind(&db->aCollSeq, zName);\n      int j;\n      for(j=0; j<3; j++){\n        CollSeq *p = &aColl[j];\n        if( p->enc==pColl->enc ){\n          if( p->xDel ){\n            p->xDel(p->pUser);\n          }\n          p->xCmp = 0;\n        }\n      }\n    }\n  }\n\n  pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1);\n  if( pColl==0 ) return SQLITE_NOMEM_BKPT;\n  pColl->xCmp = xCompare;\n  pColl->pUser = pCtx;\n  pColl->xDel = xDel;\n  pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED));\n  sqlite3Error(db, SQLITE_OK);\n  return SQLITE_OK;\n}\n\n\n/*\n** This array defines hard upper bounds on limit values.  The\n** initializer must be kept in sync with the SQLITE_LIMIT_*\n** #defines in sqlite3.h.\n*/\nstatic const int aHardLimit[] = {\n  SQLITE_MAX_LENGTH,\n  SQLITE_MAX_SQL_LENGTH,\n  SQLITE_MAX_COLUMN,\n  SQLITE_MAX_EXPR_DEPTH,\n  SQLITE_MAX_COMPOUND_SELECT,\n  SQLITE_MAX_VDBE_OP,\n  SQLITE_MAX_FUNCTION_ARG,\n  SQLITE_MAX_ATTACHED,\n  SQLITE_MAX_LIKE_PATTERN_LENGTH,\n  SQLITE_MAX_VARIABLE_NUMBER,      /* IMP: R-38091-32352 */\n  SQLITE_MAX_TRIGGER_DEPTH,\n  SQLITE_MAX_WORKER_THREADS,\n};\n\n/*\n** Make sure the hard limits are set to reasonable values\n*/\n#if SQLITE_MAX_LENGTH<100\n# error SQLITE_MAX_LENGTH must be at least 100\n#endif\n#if SQLITE_MAX_SQL_LENGTH<100\n# error SQLITE_MAX_SQL_LENGTH must be at least 100\n#endif\n#if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH\n# error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH\n#endif\n#if SQLITE_MAX_COMPOUND_SELECT<2\n# error SQLITE_MAX_COMPOUND_SELECT must be at least 2\n#endif\n#if SQLITE_MAX_VDBE_OP<40\n# error SQLITE_MAX_VDBE_OP must be at least 40\n#endif\n#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>127\n# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 127\n#endif\n#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>125\n# error SQLITE_MAX_ATTACHED must be between 0 and 125\n#endif\n#if SQLITE_MAX_LIKE_PATTERN_LENGTH<1\n# error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1\n#endif\n#if SQLITE_MAX_COLUMN>32767\n# error SQLITE_MAX_COLUMN must not exceed 32767\n#endif\n#if SQLITE_MAX_TRIGGER_DEPTH<1\n# error SQLITE_MAX_TRIGGER_DEPTH must be at least 1\n#endif\n#if SQLITE_MAX_WORKER_THREADS<0 || SQLITE_MAX_WORKER_THREADS>50\n# error SQLITE_MAX_WORKER_THREADS must be between 0 and 50\n#endif\n\n\n/*\n** Change the value of a limit.  Report the old value.\n** If an invalid limit index is supplied, report -1.\n** Make no changes but still report the old value if the\n** new limit is negative.\n**\n** A new lower limit does not shrink existing constructs.\n** It merely prevents new constructs that exceed the limit\n** from forming.\n*/\nint sqlite3_limit(sqlite3 *db, int limitId, int newLimit){\n  int oldLimit;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return -1;\n  }\n#endif\n\n  /* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME\n  ** there is a hard upper bound set at compile-time by a C preprocessor\n  ** macro called SQLITE_MAX_NAME. (The \"_LIMIT_\" in the name is changed to\n  ** \"_MAX_\".)\n  */\n  assert( aHardLimit[SQLITE_LIMIT_LENGTH]==SQLITE_MAX_LENGTH );\n  assert( aHardLimit[SQLITE_LIMIT_SQL_LENGTH]==SQLITE_MAX_SQL_LENGTH );\n  assert( aHardLimit[SQLITE_LIMIT_COLUMN]==SQLITE_MAX_COLUMN );\n  assert( aHardLimit[SQLITE_LIMIT_EXPR_DEPTH]==SQLITE_MAX_EXPR_DEPTH );\n  assert( aHardLimit[SQLITE_LIMIT_COMPOUND_SELECT]==SQLITE_MAX_COMPOUND_SELECT);\n  assert( aHardLimit[SQLITE_LIMIT_VDBE_OP]==SQLITE_MAX_VDBE_OP );\n  assert( aHardLimit[SQLITE_LIMIT_FUNCTION_ARG]==SQLITE_MAX_FUNCTION_ARG );\n  assert( aHardLimit[SQLITE_LIMIT_ATTACHED]==SQLITE_MAX_ATTACHED );\n  assert( aHardLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]==\n                                               SQLITE_MAX_LIKE_PATTERN_LENGTH );\n  assert( aHardLimit[SQLITE_LIMIT_VARIABLE_NUMBER]==SQLITE_MAX_VARIABLE_NUMBER);\n  assert( aHardLimit[SQLITE_LIMIT_TRIGGER_DEPTH]==SQLITE_MAX_TRIGGER_DEPTH );\n  assert( aHardLimit[SQLITE_LIMIT_WORKER_THREADS]==SQLITE_MAX_WORKER_THREADS );\n  assert( SQLITE_LIMIT_WORKER_THREADS==(SQLITE_N_LIMIT-1) );\n\n\n  if( limitId<0 || limitId>=SQLITE_N_LIMIT ){\n    return -1;\n  }\n  oldLimit = db->aLimit[limitId];\n  if( newLimit>=0 ){                   /* IMP: R-52476-28732 */\n    if( newLimit>aHardLimit[limitId] ){\n      newLimit = aHardLimit[limitId];  /* IMP: R-51463-25634 */\n    }\n    db->aLimit[limitId] = newLimit;\n  }\n  return oldLimit;                     /* IMP: R-53341-35419 */\n}\n\n/*\n** This function is used to parse both URIs and non-URI filenames passed by the\n** user to API functions sqlite3_open() or sqlite3_open_v2(), and for database\n** URIs specified as part of ATTACH statements.\n**\n** The first argument to this function is the name of the VFS to use (or\n** a NULL to signify the default VFS) if the URI does not contain a \"vfs=xxx\"\n** query parameter. The second argument contains the URI (or non-URI filename)\n** itself. When this function is called the *pFlags variable should contain\n** the default flags to open the database handle with. The value stored in\n** *pFlags may be updated before returning if the URI filename contains \n** \"cache=xxx\" or \"mode=xxx\" query parameters.\n**\n** If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to\n** the VFS that should be used to open the database file. *pzFile is set to\n** point to a buffer containing the name of the file to open. It is the \n** responsibility of the caller to eventually call sqlite3_free() to release\n** this buffer.\n**\n** If an error occurs, then an SQLite error code is returned and *pzErrMsg\n** may be set to point to a buffer containing an English language error \n** message. It is the responsibility of the caller to eventually release\n** this buffer by calling sqlite3_free().\n*/\nint sqlite3ParseUri(\n  const char *zDefaultVfs,        /* VFS to use if no \"vfs=xxx\" query option */\n  const char *zUri,               /* Nul-terminated URI to parse */\n  unsigned int *pFlags,           /* IN/OUT: SQLITE_OPEN_XXX flags */\n  sqlite3_vfs **ppVfs,            /* OUT: VFS to use */ \n  char **pzFile,                  /* OUT: Filename component of URI */\n  char **pzErrMsg                 /* OUT: Error message (if rc!=SQLITE_OK) */\n){\n  int rc = SQLITE_OK;\n  unsigned int flags = *pFlags;\n  const char *zVfs = zDefaultVfs;\n  char *zFile;\n  char c;\n  int nUri = sqlite3Strlen30(zUri);\n\n  assert( *pzErrMsg==0 );\n\n  if( ((flags & SQLITE_OPEN_URI)             /* IMP: R-48725-32206 */\n            || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */\n   && nUri>=5 && memcmp(zUri, \"file:\", 5)==0 /* IMP: R-57884-37496 */\n  ){\n    char *zOpt;\n    int eState;                   /* Parser state when parsing URI */\n    int iIn;                      /* Input character index */\n    int iOut = 0;                 /* Output character index */\n    u64 nByte = nUri+2;           /* Bytes of space to allocate */\n\n    /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen \n    ** method that there may be extra parameters following the file-name.  */\n    flags |= SQLITE_OPEN_URI;\n\n    for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&');\n    zFile = sqlite3_malloc64(nByte);\n    if( !zFile ) return SQLITE_NOMEM_BKPT;\n\n    iIn = 5;\n#ifdef SQLITE_ALLOW_URI_AUTHORITY\n    if( strncmp(zUri+5, \"///\", 3)==0 ){\n      iIn = 7;\n      /* The following condition causes URIs with five leading / characters\n      ** like file://///host/path to be converted into UNCs like //host/path.\n      ** The correct URI for that UNC has only two or four leading / characters\n      ** file://host/path or file:////host/path.  But 5 leading slashes is a \n      ** common error, we are told, so we handle it as a special case. */\n      if( strncmp(zUri+7, \"///\", 3)==0 ){ iIn++; }\n    }else if( strncmp(zUri+5, \"//localhost/\", 12)==0 ){\n      iIn = 16;\n    }\n#else\n    /* Discard the scheme and authority segments of the URI. */\n    if( zUri[5]=='/' && zUri[6]=='/' ){\n      iIn = 7;\n      while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;\n      if( iIn!=7 && (iIn!=16 || memcmp(\"localhost\", &zUri[7], 9)) ){\n        *pzErrMsg = sqlite3_mprintf(\"invalid uri authority: %.*s\", \n            iIn-7, &zUri[7]);\n        rc = SQLITE_ERROR;\n        goto parse_uri_out;\n      }\n    }\n#endif\n\n    /* Copy the filename and any query parameters into the zFile buffer. \n    ** Decode %HH escape codes along the way. \n    **\n    ** Within this loop, variable eState may be set to 0, 1 or 2, depending\n    ** on the parsing context. As follows:\n    **\n    **   0: Parsing file-name.\n    **   1: Parsing name section of a name=value query parameter.\n    **   2: Parsing value section of a name=value query parameter.\n    */\n    eState = 0;\n    while( (c = zUri[iIn])!=0 && c!='#' ){\n      iIn++;\n      if( c=='%' \n       && sqlite3Isxdigit(zUri[iIn]) \n       && sqlite3Isxdigit(zUri[iIn+1]) \n      ){\n        int octet = (sqlite3HexToInt(zUri[iIn++]) << 4);\n        octet += sqlite3HexToInt(zUri[iIn++]);\n\n        assert( octet>=0 && octet<256 );\n        if( octet==0 ){\n          /* This branch is taken when \"%00\" appears within the URI. In this\n          ** case we ignore all text in the remainder of the path, name or\n          ** value currently being parsed. So ignore the current character\n          ** and skip to the next \"?\", \"=\" or \"&\", as appropriate. */\n          while( (c = zUri[iIn])!=0 && c!='#' \n              && (eState!=0 || c!='?')\n              && (eState!=1 || (c!='=' && c!='&'))\n              && (eState!=2 || c!='&')\n          ){\n            iIn++;\n          }\n          continue;\n        }\n        c = octet;\n      }else if( eState==1 && (c=='&' || c=='=') ){\n        if( zFile[iOut-1]==0 ){\n          /* An empty option name. Ignore this option altogether. */\n          while( zUri[iIn] && zUri[iIn]!='#' && zUri[iIn-1]!='&' ) iIn++;\n          continue;\n        }\n        if( c=='&' ){\n          zFile[iOut++] = '\\0';\n        }else{\n          eState = 2;\n        }\n        c = 0;\n      }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){\n        c = 0;\n        eState = 1;\n      }\n      zFile[iOut++] = c;\n    }\n    if( eState==1 ) zFile[iOut++] = '\\0';\n    zFile[iOut++] = '\\0';\n    zFile[iOut++] = '\\0';\n\n    /* Check if there were any options specified that should be interpreted \n    ** here. Options that are interpreted here include \"vfs\" and those that\n    ** correspond to flags that may be passed to the sqlite3_open_v2()\n    ** method. */\n    zOpt = &zFile[sqlite3Strlen30(zFile)+1];\n    while( zOpt[0] ){\n      int nOpt = sqlite3Strlen30(zOpt);\n      char *zVal = &zOpt[nOpt+1];\n      int nVal = sqlite3Strlen30(zVal);\n\n      if( nOpt==3 && memcmp(\"vfs\", zOpt, 3)==0 ){\n        zVfs = zVal;\n      }else{\n        struct OpenMode {\n          const char *z;\n          int mode;\n        } *aMode = 0;\n        char *zModeType = 0;\n        int mask = 0;\n        int limit = 0;\n\n        if( nOpt==5 && memcmp(\"cache\", zOpt, 5)==0 ){\n          static struct OpenMode aCacheMode[] = {\n            { \"shared\",  SQLITE_OPEN_SHAREDCACHE },\n            { \"private\", SQLITE_OPEN_PRIVATECACHE },\n            { 0, 0 }\n          };\n\n          mask = SQLITE_OPEN_SHAREDCACHE|SQLITE_OPEN_PRIVATECACHE;\n          aMode = aCacheMode;\n          limit = mask;\n          zModeType = \"cache\";\n        }\n        if( nOpt==4 && memcmp(\"mode\", zOpt, 4)==0 ){\n          static struct OpenMode aOpenMode[] = {\n            { \"ro\",  SQLITE_OPEN_READONLY },\n            { \"rw\",  SQLITE_OPEN_READWRITE }, \n            { \"rwc\", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE },\n            { \"memory\", SQLITE_OPEN_MEMORY },\n            { 0, 0 }\n          };\n\n          mask = SQLITE_OPEN_READONLY | SQLITE_OPEN_READWRITE\n                   | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY;\n          aMode = aOpenMode;\n          limit = mask & flags;\n          zModeType = \"access\";\n        }\n\n        if( aMode ){\n          int i;\n          int mode = 0;\n          for(i=0; aMode[i].z; i++){\n            const char *z = aMode[i].z;\n            if( nVal==sqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){\n              mode = aMode[i].mode;\n              break;\n            }\n          }\n          if( mode==0 ){\n            *pzErrMsg = sqlite3_mprintf(\"no such %s mode: %s\", zModeType, zVal);\n            rc = SQLITE_ERROR;\n            goto parse_uri_out;\n          }\n          if( (mode & ~SQLITE_OPEN_MEMORY)>limit ){\n            *pzErrMsg = sqlite3_mprintf(\"%s mode not allowed: %s\",\n                                        zModeType, zVal);\n            rc = SQLITE_PERM;\n            goto parse_uri_out;\n          }\n          flags = (flags & ~mask) | mode;\n        }\n      }\n\n      zOpt = &zVal[nVal+1];\n    }\n\n  }else{\n    zFile = sqlite3_malloc64(nUri+2);\n    if( !zFile ) return SQLITE_NOMEM_BKPT;\n    memcpy(zFile, zUri, nUri);\n    zFile[nUri] = '\\0';\n    zFile[nUri+1] = '\\0';\n    flags &= ~SQLITE_OPEN_URI;\n  }\n\n  *ppVfs = sqlite3_vfs_find(zVfs);\n  if( *ppVfs==0 ){\n    *pzErrMsg = sqlite3_mprintf(\"no such vfs: %s\", zVfs);\n    rc = SQLITE_ERROR;\n  }\n parse_uri_out:\n  if( rc!=SQLITE_OK ){\n    sqlite3_free(zFile);\n    zFile = 0;\n  }\n  *pFlags = flags;\n  *pzFile = zFile;\n  return rc;\n}\n\n\n/*\n** This routine does the work of opening a database on behalf of\n** sqlite3_open() and sqlite3_open16(). The database filename \"zFilename\"  \n** is UTF-8 encoded.\n*/\nstatic int openDatabase(\n  const char *zFilename, /* Database filename UTF-8 encoded */\n  sqlite3 **ppDb,        /* OUT: Returned database handle */\n  unsigned int flags,    /* Operational flags */\n  const char *zVfs       /* Name of the VFS to use */\n){\n  sqlite3 *db;                    /* Store allocated handle here */\n  int rc;                         /* Return code */\n  int isThreadsafe;               /* True for threadsafe connections */\n  char *zOpen = 0;                /* Filename argument to pass to BtreeOpen() */\n  char *zErrMsg = 0;              /* Error message from sqlite3ParseUri() */\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( ppDb==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  *ppDb = 0;\n#ifndef SQLITE_OMIT_AUTOINIT\n  rc = sqlite3_initialize();\n  if( rc ) return rc;\n#endif\n\n  /* Only allow sensible combinations of bits in the flags argument.  \n  ** Throw an error if any non-sense combination is used.  If we\n  ** do not block illegal combinations here, it could trigger\n  ** assert() statements in deeper layers.  Sensible combinations\n  ** are:\n  **\n  **  1:  SQLITE_OPEN_READONLY\n  **  2:  SQLITE_OPEN_READWRITE\n  **  6:  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE\n  */\n  assert( SQLITE_OPEN_READONLY  == 0x01 );\n  assert( SQLITE_OPEN_READWRITE == 0x02 );\n  assert( SQLITE_OPEN_CREATE    == 0x04 );\n  testcase( (1<<(flags&7))==0x02 ); /* READONLY */\n  testcase( (1<<(flags&7))==0x04 ); /* READWRITE */\n  testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */\n  if( ((1<<(flags&7)) & 0x46)==0 ){\n    return SQLITE_MISUSE_BKPT;  /* IMP: R-65497-44594 */\n  }\n\n  if( sqlite3GlobalConfig.bCoreMutex==0 ){\n    isThreadsafe = 0;\n  }else if( flags & SQLITE_OPEN_NOMUTEX ){\n    isThreadsafe = 0;\n  }else if( flags & SQLITE_OPEN_FULLMUTEX ){\n    isThreadsafe = 1;\n  }else{\n    isThreadsafe = sqlite3GlobalConfig.bFullMutex;\n  }\n  if( flags & SQLITE_OPEN_PRIVATECACHE ){\n    flags &= ~SQLITE_OPEN_SHAREDCACHE;\n  }else if( sqlite3GlobalConfig.sharedCacheEnabled ){\n    flags |= SQLITE_OPEN_SHAREDCACHE;\n  }\n\n  /* Remove harmful bits from the flags parameter\n  **\n  ** The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were\n  ** dealt with in the previous code block.  Besides these, the only\n  ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY,\n  ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE,\n  ** SQLITE_OPEN_PRIVATECACHE, and some reserved bits.  Silently mask\n  ** off all other flags.\n  */\n  flags &=  ~( SQLITE_OPEN_DELETEONCLOSE |\n               SQLITE_OPEN_EXCLUSIVE |\n               SQLITE_OPEN_MAIN_DB |\n               SQLITE_OPEN_TEMP_DB | \n               SQLITE_OPEN_TRANSIENT_DB | \n               SQLITE_OPEN_MAIN_JOURNAL | \n               SQLITE_OPEN_TEMP_JOURNAL | \n               SQLITE_OPEN_SUBJOURNAL | \n               SQLITE_OPEN_MASTER_JOURNAL |\n               SQLITE_OPEN_NOMUTEX |\n               SQLITE_OPEN_FULLMUTEX |\n               SQLITE_OPEN_WAL\n             );\n\n  /* Allocate the sqlite data structure */\n  db = sqlite3MallocZero( sizeof(sqlite3) );\n  if( db==0 ) goto opendb_out;\n  if( isThreadsafe ){\n    db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);\n    if( db->mutex==0 ){\n      sqlite3_free(db);\n      db = 0;\n      goto opendb_out;\n    }\n  }\n  sqlite3_mutex_enter(db->mutex);\n  db->errMask = 0xff;\n  db->nDb = 2;\n  db->magic = SQLITE_MAGIC_BUSY;\n  db->aDb = db->aDbStatic;\n\n  assert( sizeof(db->aLimit)==sizeof(aHardLimit) );\n  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));\n  db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;\n  db->autoCommit = 1;\n  db->nextAutovac = -1;\n  db->szMmap = sqlite3GlobalConfig.szMmap;\n  db->nextPagesize = 0;\n  db->nMaxSorterMmap = 0x7FFFFFFF;\n  db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger | SQLITE_CacheSpill\n#if !defined(SQLITE_DEFAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX\n                 | SQLITE_AutoIndex\n#endif\n#if SQLITE_DEFAULT_CKPTFULLFSYNC\n                 | SQLITE_CkptFullFSync\n#endif\n#if SQLITE_DEFAULT_FILE_FORMAT<4\n                 | SQLITE_LegacyFileFmt\n#endif\n#ifdef SQLITE_ENABLE_LOAD_EXTENSION\n                 | SQLITE_LoadExtension\n#endif\n#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS\n                 | SQLITE_RecTriggers\n#endif\n#if defined(SQLITE_DEFAULT_FOREIGN_KEYS) && SQLITE_DEFAULT_FOREIGN_KEYS\n                 | SQLITE_ForeignKeys\n#endif\n#if defined(SQLITE_REVERSE_UNORDERED_SELECTS)\n                 | SQLITE_ReverseOrder\n#endif\n#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)\n                 | SQLITE_CellSizeCk\n#endif\n#if defined(SQLITE_ENABLE_FTS3_TOKENIZER)\n                 | SQLITE_Fts3Tokenizer\n#endif\n      ;\n  sqlite3HashInit(&db->aCollSeq);\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  sqlite3HashInit(&db->aModule);\n#endif\n\n  /* Add the default collation sequence BINARY. BINARY works for both UTF-8\n  ** and UTF-16, so add a version for each to avoid any unnecessary\n  ** conversions. The only error that can occur here is a malloc() failure.\n  **\n  ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating\n  ** functions:\n  */\n  createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0);\n  createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0);\n  createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0);\n  createCollation(db, \"NOCASE\", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);\n  createCollation(db, \"RTRIM\", SQLITE_UTF8, (void*)1, binCollFunc, 0);\n  if( db->mallocFailed ){\n    goto opendb_out;\n  }\n  /* EVIDENCE-OF: R-08308-17224 The default collating function for all\n  ** strings is BINARY. \n  */\n  db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);\n  assert( db->pDfltColl!=0 );\n\n  /* Parse the filename/URI argument. */\n  db->openFlags = flags;\n  rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);\n  if( rc!=SQLITE_OK ){\n    if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);\n    sqlite3ErrorWithMsg(db, rc, zErrMsg ? \"%s\" : 0, zErrMsg);\n    sqlite3_free(zErrMsg);\n    goto opendb_out;\n  }\n\n  /* Open the backend database driver */\n  rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0,\n                        flags | SQLITE_OPEN_MAIN_DB);\n  if( rc!=SQLITE_OK ){\n    if( rc==SQLITE_IOERR_NOMEM ){\n      rc = SQLITE_NOMEM_BKPT;\n    }\n    sqlite3Error(db, rc);\n    goto opendb_out;\n  }\n  sqlite3BtreeEnter(db->aDb[0].pBt);\n  db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);\n  if( !db->mallocFailed ) ENC(db) = SCHEMA_ENC(db);\n  sqlite3BtreeLeave(db->aDb[0].pBt);\n  db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);\n\n  /* The default safety_level for the main database is FULL; for the temp\n  ** database it is OFF. This matches the pager layer defaults.  \n  */\n  db->aDb[0].zDbSName = \"main\";\n  db->aDb[0].safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;\n  db->aDb[1].zDbSName = \"temp\";\n  db->aDb[1].safety_level = PAGER_SYNCHRONOUS_OFF;\n\n  db->magic = SQLITE_MAGIC_OPEN;\n  if( db->mallocFailed ){\n    goto opendb_out;\n  }\n\n  /* Register all built-in functions, but do not attempt to read the\n  ** database schema yet. This is delayed until the first time the database\n  ** is accessed.\n  */\n  sqlite3Error(db, SQLITE_OK);\n  sqlite3RegisterPerConnectionBuiltinFunctions(db);\n  rc = sqlite3_errcode(db);\n\n#ifdef SQLITE_ENABLE_FTS5\n  /* Register any built-in FTS5 module before loading the automatic\n  ** extensions. This allows automatic extensions to register FTS5 \n  ** tokenizers and auxiliary functions.  */\n  if( !db->mallocFailed && rc==SQLITE_OK ){\n    rc = sqlite3Fts5Init(db);\n  }\n#endif\n\n  /* Load automatic extensions - extensions that have been registered\n  ** using the sqlite3_automatic_extension() API.\n  */\n  if( rc==SQLITE_OK ){\n    sqlite3AutoLoadExtensions(db);\n    rc = sqlite3_errcode(db);\n    if( rc!=SQLITE_OK ){\n      goto opendb_out;\n    }\n  }\n\n#ifdef SQLITE_ENABLE_FTS1\n  if( !db->mallocFailed ){\n    extern int sqlite3Fts1Init(sqlite3*);\n    rc = sqlite3Fts1Init(db);\n  }\n#endif\n\n#ifdef SQLITE_ENABLE_FTS2\n  if( !db->mallocFailed && rc==SQLITE_OK ){\n    extern int sqlite3Fts2Init(sqlite3*);\n    rc = sqlite3Fts2Init(db);\n  }\n#endif\n\n#ifdef SQLITE_ENABLE_FTS3 /* automatically defined by SQLITE_ENABLE_FTS4 */\n  if( !db->mallocFailed && rc==SQLITE_OK ){\n    rc = sqlite3Fts3Init(db);\n  }\n#endif\n\n#ifdef SQLITE_ENABLE_ICU\n  if( !db->mallocFailed && rc==SQLITE_OK ){\n    rc = sqlite3IcuInit(db);\n  }\n#endif\n\n#ifdef SQLITE_ENABLE_RTREE\n  if( !db->mallocFailed && rc==SQLITE_OK){\n    rc = sqlite3RtreeInit(db);\n  }\n#endif\n\n#ifdef SQLITE_ENABLE_DBSTAT_VTAB\n  if( !db->mallocFailed && rc==SQLITE_OK){\n    rc = sqlite3DbstatRegister(db);\n  }\n#endif\n\n#ifdef SQLITE_ENABLE_JSON1\n  if( !db->mallocFailed && rc==SQLITE_OK){\n    rc = sqlite3Json1Init(db);\n  }\n#endif\n\n  /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking\n  ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking\n  ** mode.  Doing nothing at all also makes NORMAL the default.\n  */\n#ifdef SQLITE_DEFAULT_LOCKING_MODE\n  db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;\n  sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),\n                          SQLITE_DEFAULT_LOCKING_MODE);\n#endif\n\n  if( rc ) sqlite3Error(db, rc);\n\n  /* Enable the lookaside-malloc subsystem */\n  setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,\n                        sqlite3GlobalConfig.nLookaside);\n\n  sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);\n\nopendb_out:\n  if( db ){\n    assert( db->mutex!=0 || isThreadsafe==0\n           || sqlite3GlobalConfig.bFullMutex==0 );\n    sqlite3_mutex_leave(db->mutex);\n  }\n  rc = sqlite3_errcode(db);\n  assert( db!=0 || rc==SQLITE_NOMEM );\n  if( rc==SQLITE_NOMEM ){\n    sqlite3_close(db);\n    db = 0;\n  }else if( rc!=SQLITE_OK ){\n    db->magic = SQLITE_MAGIC_SICK;\n  }\n  *ppDb = db;\n#ifdef SQLITE_ENABLE_SQLLOG\n  if( sqlite3GlobalConfig.xSqllog ){\n    /* Opening a db handle. Fourth parameter is passed 0. */\n    void *pArg = sqlite3GlobalConfig.pSqllogArg;\n    sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);\n  }\n#endif\n#if defined(SQLITE_HAS_CODEC)\n  if( rc==SQLITE_OK ){\n    const char *zHexKey = sqlite3_uri_parameter(zOpen, \"hexkey\");\n    if( zHexKey && zHexKey[0] ){\n      u8 iByte;\n      int i;\n      char zKey[40];\n      for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zHexKey[i]); i++){\n        iByte = (iByte<<4) + sqlite3HexToInt(zHexKey[i]);\n        if( (i&1)!=0 ) zKey[i/2] = iByte;\n      }\n      sqlite3_key_v2(db, 0, zKey, i/2);\n    }\n  }\n#endif\n  sqlite3_free(zOpen);\n  return rc & 0xff;\n}\n\n/*\n** Open a new database handle.\n*/\nint sqlite3_open(\n  const char *zFilename, \n  sqlite3 **ppDb \n){\n  return openDatabase(zFilename, ppDb,\n                      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);\n}\nint sqlite3_open_v2(\n  const char *filename,   /* Database filename (UTF-8) */\n  sqlite3 **ppDb,         /* OUT: SQLite db handle */\n  int flags,              /* Flags */\n  const char *zVfs        /* Name of VFS module to use */\n){\n  return openDatabase(filename, ppDb, (unsigned int)flags, zVfs);\n}\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** Open a new database handle.\n*/\nint sqlite3_open16(\n  const void *zFilename, \n  sqlite3 **ppDb\n){\n  char const *zFilename8;   /* zFilename encoded in UTF-8 instead of UTF-16 */\n  sqlite3_value *pVal;\n  int rc;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( ppDb==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  *ppDb = 0;\n#ifndef SQLITE_OMIT_AUTOINIT\n  rc = sqlite3_initialize();\n  if( rc ) return rc;\n#endif\n  if( zFilename==0 ) zFilename = \"\\000\\000\";\n  pVal = sqlite3ValueNew(0);\n  sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC);\n  zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8);\n  if( zFilename8 ){\n    rc = openDatabase(zFilename8, ppDb,\n                      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);\n    assert( *ppDb || rc==SQLITE_NOMEM );\n    if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){\n      SCHEMA_ENC(*ppDb) = ENC(*ppDb) = SQLITE_UTF16NATIVE;\n    }\n  }else{\n    rc = SQLITE_NOMEM_BKPT;\n  }\n  sqlite3ValueFree(pVal);\n\n  return rc & 0xff;\n}\n#endif /* SQLITE_OMIT_UTF16 */\n\n/*\n** Register a new collation sequence with the database handle db.\n*/\nint sqlite3_create_collation(\n  sqlite3* db, \n  const char *zName, \n  int enc, \n  void* pCtx,\n  int(*xCompare)(void*,int,const void*,int,const void*)\n){\n  return sqlite3_create_collation_v2(db, zName, enc, pCtx, xCompare, 0);\n}\n\n/*\n** Register a new collation sequence with the database handle db.\n*/\nint sqlite3_create_collation_v2(\n  sqlite3* db, \n  const char *zName, \n  int enc, \n  void* pCtx,\n  int(*xCompare)(void*,int,const void*,int,const void*),\n  void(*xDel)(void*)\n){\n  int rc;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  assert( !db->mallocFailed );\n  rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel);\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** Register a new collation sequence with the database handle db.\n*/\nint sqlite3_create_collation16(\n  sqlite3* db, \n  const void *zName,\n  int enc, \n  void* pCtx,\n  int(*xCompare)(void*,int,const void*,int,const void*)\n){\n  int rc = SQLITE_OK;\n  char *zName8;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  assert( !db->mallocFailed );\n  zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);\n  if( zName8 ){\n    rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0);\n    sqlite3DbFree(db, zName8);\n  }\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n#endif /* SQLITE_OMIT_UTF16 */\n\n/*\n** Register a collation sequence factory callback with the database handle\n** db. Replace any previously installed collation sequence factory.\n*/\nint sqlite3_collation_needed(\n  sqlite3 *db, \n  void *pCollNeededArg, \n  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  db->xCollNeeded = xCollNeeded;\n  db->xCollNeeded16 = 0;\n  db->pCollNeededArg = pCollNeededArg;\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** Register a collation sequence factory callback with the database handle\n** db. Replace any previously installed collation sequence factory.\n*/\nint sqlite3_collation_needed16(\n  sqlite3 *db, \n  void *pCollNeededArg, \n  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  db->xCollNeeded = 0;\n  db->xCollNeeded16 = xCollNeeded16;\n  db->pCollNeededArg = pCollNeededArg;\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n#endif /* SQLITE_OMIT_UTF16 */\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** This function is now an anachronism. It used to be used to recover from a\n** malloc() failure, but SQLite now does this automatically.\n*/\nint sqlite3_global_recover(void){\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** Test to see whether or not the database connection is in autocommit\n** mode.  Return TRUE if it is and FALSE if not.  Autocommit mode is on\n** by default.  Autocommit is disabled by a BEGIN statement and reenabled\n** by the next COMMIT or ROLLBACK.\n*/\nint sqlite3_get_autocommit(sqlite3 *db){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  return db->autoCommit;\n}\n\n/*\n** The following routines are substitutes for constants SQLITE_CORRUPT,\n** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_NOMEM and possibly other error\n** constants.  They serve two purposes:\n**\n**   1.  Serve as a convenient place to set a breakpoint in a debugger\n**       to detect when version error conditions occurs.\n**\n**   2.  Invoke sqlite3_log() to provide the source code location where\n**       a low-level error is first detected.\n*/\nstatic int reportError(int iErr, int lineno, const char *zType){\n  sqlite3_log(iErr, \"%s at line %d of [%.10s]\",\n              zType, lineno, 20+sqlite3_sourceid());\n  return iErr;\n}\nint sqlite3CorruptError(int lineno){\n  testcase( sqlite3GlobalConfig.xLog!=0 );\n  return reportError(SQLITE_CORRUPT, lineno, \"database corruption\");\n}\nint sqlite3MisuseError(int lineno){\n  testcase( sqlite3GlobalConfig.xLog!=0 );\n  return reportError(SQLITE_MISUSE, lineno, \"misuse\");\n}\nint sqlite3CantopenError(int lineno){\n  testcase( sqlite3GlobalConfig.xLog!=0 );\n  return reportError(SQLITE_CANTOPEN, lineno, \"cannot open file\");\n}\n#ifdef SQLITE_DEBUG\nint sqlite3NomemError(int lineno){\n  testcase( sqlite3GlobalConfig.xLog!=0 );\n  return reportError(SQLITE_NOMEM, lineno, \"OOM\");\n}\nint sqlite3IoerrnomemError(int lineno){\n  testcase( sqlite3GlobalConfig.xLog!=0 );\n  return reportError(SQLITE_IOERR_NOMEM, lineno, \"I/O OOM error\");\n}\n#endif\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** This is a convenience routine that makes sure that all thread-specific\n** data for this thread has been deallocated.\n**\n** SQLite no longer uses thread-specific data so this routine is now a\n** no-op.  It is retained for historical compatibility.\n*/\nvoid sqlite3_thread_cleanup(void){\n}\n#endif\n\n/*\n** Return meta information about a specific column of a database table.\n** See comment in sqlite3.h (sqlite.h.in) for details.\n*/\nint sqlite3_table_column_metadata(\n  sqlite3 *db,                /* Connection handle */\n  const char *zDbName,        /* Database name or NULL */\n  const char *zTableName,     /* Table name */\n  const char *zColumnName,    /* Column name */\n  char const **pzDataType,    /* OUTPUT: Declared data type */\n  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */\n  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */\n  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */\n  int *pAutoinc               /* OUTPUT: True if column is auto-increment */\n){\n  int rc;\n  char *zErrMsg = 0;\n  Table *pTab = 0;\n  Column *pCol = 0;\n  int iCol = 0;\n  char const *zDataType = 0;\n  char const *zCollSeq = 0;\n  int notnull = 0;\n  int primarykey = 0;\n  int autoinc = 0;\n\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zTableName==0 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n\n  /* Ensure the database schema has been loaded */\n  sqlite3_mutex_enter(db->mutex);\n  sqlite3BtreeEnterAll(db);\n  rc = sqlite3Init(db, &zErrMsg);\n  if( SQLITE_OK!=rc ){\n    goto error_out;\n  }\n\n  /* Locate the table in question */\n  pTab = sqlite3FindTable(db, zTableName, zDbName);\n  if( !pTab || pTab->pSelect ){\n    pTab = 0;\n    goto error_out;\n  }\n\n  /* Find the column for which info is requested */\n  if( zColumnName==0 ){\n    /* Query for existance of table only */\n  }else{\n    for(iCol=0; iCol<pTab->nCol; iCol++){\n      pCol = &pTab->aCol[iCol];\n      if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){\n        break;\n      }\n    }\n    if( iCol==pTab->nCol ){\n      if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){\n        iCol = pTab->iPKey;\n        pCol = iCol>=0 ? &pTab->aCol[iCol] : 0;\n      }else{\n        pTab = 0;\n        goto error_out;\n      }\n    }\n  }\n\n  /* The following block stores the meta information that will be returned\n  ** to the caller in local variables zDataType, zCollSeq, notnull, primarykey\n  ** and autoinc. At this point there are two possibilities:\n  ** \n  **     1. The specified column name was rowid\", \"oid\" or \"_rowid_\" \n  **        and there is no explicitly declared IPK column. \n  **\n  **     2. The table is not a view and the column name identified an \n  **        explicitly declared column. Copy meta information from *pCol.\n  */ \n  if( pCol ){\n    zDataType = sqlite3ColumnType(pCol,0);\n    zCollSeq = pCol->zColl;\n    notnull = pCol->notNull!=0;\n    primarykey  = (pCol->colFlags & COLFLAG_PRIMKEY)!=0;\n    autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;\n  }else{\n    zDataType = \"INTEGER\";\n    primarykey = 1;\n  }\n  if( !zCollSeq ){\n    zCollSeq = sqlite3StrBINARY;\n  }\n\nerror_out:\n  sqlite3BtreeLeaveAll(db);\n\n  /* Whether the function call succeeded or failed, set the output parameters\n  ** to whatever their local counterparts contain. If an error did occur,\n  ** this has the effect of zeroing all output parameters.\n  */\n  if( pzDataType ) *pzDataType = zDataType;\n  if( pzCollSeq ) *pzCollSeq = zCollSeq;\n  if( pNotNull ) *pNotNull = notnull;\n  if( pPrimaryKey ) *pPrimaryKey = primarykey;\n  if( pAutoinc ) *pAutoinc = autoinc;\n\n  if( SQLITE_OK==rc && !pTab ){\n    sqlite3DbFree(db, zErrMsg);\n    zErrMsg = sqlite3MPrintf(db, \"no such table column: %s.%s\", zTableName,\n        zColumnName);\n    rc = SQLITE_ERROR;\n  }\n  sqlite3ErrorWithMsg(db, rc, (zErrMsg?\"%s\":0), zErrMsg);\n  sqlite3DbFree(db, zErrMsg);\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** Sleep for a little while.  Return the amount of time slept.\n*/\nint sqlite3_sleep(int ms){\n  sqlite3_vfs *pVfs;\n  int rc;\n  pVfs = sqlite3_vfs_find(0);\n  if( pVfs==0 ) return 0;\n\n  /* This function works in milliseconds, but the underlying OsSleep() \n  ** API uses microseconds. Hence the 1000's.\n  */\n  rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000);\n  return rc;\n}\n\n/*\n** Enable or disable the extended result codes.\n*/\nint sqlite3_extended_result_codes(sqlite3 *db, int onoff){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  db->errMask = onoff ? 0xffffffff : 0xff;\n  sqlite3_mutex_leave(db->mutex);\n  return SQLITE_OK;\n}\n\n/*\n** Invoke the xFileControl method on a particular database.\n*/\nint sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){\n  int rc = SQLITE_ERROR;\n  Btree *pBtree;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pBtree = sqlite3DbNameToBtree(db, zDbName);\n  if( pBtree ){\n    Pager *pPager;\n    sqlite3_file *fd;\n    sqlite3BtreeEnter(pBtree);\n    pPager = sqlite3BtreePager(pBtree);\n    assert( pPager!=0 );\n    fd = sqlite3PagerFile(pPager);\n    assert( fd!=0 );\n    if( op==SQLITE_FCNTL_FILE_POINTER ){\n      *(sqlite3_file**)pArg = fd;\n      rc = SQLITE_OK;\n    }else if( op==SQLITE_FCNTL_VFS_POINTER ){\n      *(sqlite3_vfs**)pArg = sqlite3PagerVfs(pPager);\n      rc = SQLITE_OK;\n    }else if( op==SQLITE_FCNTL_JOURNAL_POINTER ){\n      *(sqlite3_file**)pArg = sqlite3PagerJrnlFile(pPager);\n      rc = SQLITE_OK;\n    }else if( fd->pMethods ){\n      rc = sqlite3OsFileControl(fd, op, pArg);\n    }else{\n      rc = SQLITE_NOTFOUND;\n    }\n    sqlite3BtreeLeave(pBtree);\n  }\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** Interface to the testing logic.\n*/\nint sqlite3_test_control(int op, ...){\n  int rc = 0;\n#ifdef SQLITE_OMIT_BUILTIN_TEST\n  UNUSED_PARAMETER(op);\n#else\n  va_list ap;\n  va_start(ap, op);\n  switch( op ){\n\n    /*\n    ** Save the current state of the PRNG.\n    */\n    case SQLITE_TESTCTRL_PRNG_SAVE: {\n      sqlite3PrngSaveState();\n      break;\n    }\n\n    /*\n    ** Restore the state of the PRNG to the last state saved using\n    ** PRNG_SAVE.  If PRNG_SAVE has never before been called, then\n    ** this verb acts like PRNG_RESET.\n    */\n    case SQLITE_TESTCTRL_PRNG_RESTORE: {\n      sqlite3PrngRestoreState();\n      break;\n    }\n\n    /*\n    ** Reset the PRNG back to its uninitialized state.  The next call\n    ** to sqlite3_randomness() will reseed the PRNG using a single call\n    ** to the xRandomness method of the default VFS.\n    */\n    case SQLITE_TESTCTRL_PRNG_RESET: {\n      sqlite3_randomness(0,0);\n      break;\n    }\n\n    /*\n    **  sqlite3_test_control(BITVEC_TEST, size, program)\n    **\n    ** Run a test against a Bitvec object of size.  The program argument\n    ** is an array of integers that defines the test.  Return -1 on a\n    ** memory allocation error, 0 on success, or non-zero for an error.\n    ** See the sqlite3BitvecBuiltinTest() for additional information.\n    */\n    case SQLITE_TESTCTRL_BITVEC_TEST: {\n      int sz = va_arg(ap, int);\n      int *aProg = va_arg(ap, int*);\n      rc = sqlite3BitvecBuiltinTest(sz, aProg);\n      break;\n    }\n\n    /*\n    **  sqlite3_test_control(FAULT_INSTALL, xCallback)\n    **\n    ** Arrange to invoke xCallback() whenever sqlite3FaultSim() is called,\n    ** if xCallback is not NULL.\n    **\n    ** As a test of the fault simulator mechanism itself, sqlite3FaultSim(0)\n    ** is called immediately after installing the new callback and the return\n    ** value from sqlite3FaultSim(0) becomes the return from\n    ** sqlite3_test_control().\n    */\n    case SQLITE_TESTCTRL_FAULT_INSTALL: {\n      /* MSVC is picky about pulling func ptrs from va lists.\n      ** http://support.microsoft.com/kb/47961\n      ** sqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int));\n      */\n      typedef int(*TESTCALLBACKFUNC_t)(int);\n      sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t);\n      rc = sqlite3FaultSim(0);\n      break;\n    }\n\n    /*\n    **  sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd)\n    **\n    ** Register hooks to call to indicate which malloc() failures \n    ** are benign.\n    */\n    case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: {\n      typedef void (*void_function)(void);\n      void_function xBenignBegin;\n      void_function xBenignEnd;\n      xBenignBegin = va_arg(ap, void_function);\n      xBenignEnd = va_arg(ap, void_function);\n      sqlite3BenignMallocHooks(xBenignBegin, xBenignEnd);\n      break;\n    }\n\n    /*\n    **  sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X)\n    **\n    ** Set the PENDING byte to the value in the argument, if X>0.\n    ** Make no changes if X==0.  Return the value of the pending byte\n    ** as it existing before this routine was called.\n    **\n    ** IMPORTANT:  Changing the PENDING byte from 0x40000000 results in\n    ** an incompatible database file format.  Changing the PENDING byte\n    ** while any database connection is open results in undefined and\n    ** deleterious behavior.\n    */\n    case SQLITE_TESTCTRL_PENDING_BYTE: {\n      rc = PENDING_BYTE;\n#ifndef SQLITE_OMIT_WSD\n      {\n        unsigned int newVal = va_arg(ap, unsigned int);\n        if( newVal ) sqlite3PendingByte = newVal;\n      }\n#endif\n      break;\n    }\n\n    /*\n    **  sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X)\n    **\n    ** This action provides a run-time test to see whether or not\n    ** assert() was enabled at compile-time.  If X is true and assert()\n    ** is enabled, then the return value is true.  If X is true and\n    ** assert() is disabled, then the return value is zero.  If X is\n    ** false and assert() is enabled, then the assertion fires and the\n    ** process aborts.  If X is false and assert() is disabled, then the\n    ** return value is zero.\n    */\n    case SQLITE_TESTCTRL_ASSERT: {\n      volatile int x = 0;\n      assert( /*side-effects-ok*/ (x = va_arg(ap,int))!=0 );\n      rc = x;\n      break;\n    }\n\n\n    /*\n    **  sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X)\n    **\n    ** This action provides a run-time test to see how the ALWAYS and\n    ** NEVER macros were defined at compile-time.\n    **\n    ** The return value is ALWAYS(X).  \n    **\n    ** The recommended test is X==2.  If the return value is 2, that means\n    ** ALWAYS() and NEVER() are both no-op pass-through macros, which is the\n    ** default setting.  If the return value is 1, then ALWAYS() is either\n    ** hard-coded to true or else it asserts if its argument is false.\n    ** The first behavior (hard-coded to true) is the case if\n    ** SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second\n    ** behavior (assert if the argument to ALWAYS() is false) is the case if\n    ** SQLITE_TESTCTRL_ASSERT shows that assert() is enabled.\n    **\n    ** The run-time test procedure might look something like this:\n    **\n    **    if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){\n    **      // ALWAYS() and NEVER() are no-op pass-through macros\n    **    }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){\n    **      // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false.\n    **    }else{\n    **      // ALWAYS(x) is a constant 1.  NEVER(x) is a constant 0.\n    **    }\n    */\n    case SQLITE_TESTCTRL_ALWAYS: {\n      int x = va_arg(ap,int);\n      rc = ALWAYS(x);\n      break;\n    }\n\n    /*\n    **   sqlite3_test_control(SQLITE_TESTCTRL_BYTEORDER);\n    **\n    ** The integer returned reveals the byte-order of the computer on which\n    ** SQLite is running:\n    **\n    **       1     big-endian,    determined at run-time\n    **      10     little-endian, determined at run-time\n    **  432101     big-endian,    determined at compile-time\n    **  123410     little-endian, determined at compile-time\n    */ \n    case SQLITE_TESTCTRL_BYTEORDER: {\n      rc = SQLITE_BYTEORDER*100 + SQLITE_LITTLEENDIAN*10 + SQLITE_BIGENDIAN;\n      break;\n    }\n\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_RESERVE, sqlite3 *db, int N)\n    **\n    ** Set the nReserve size to N for the main database on the database\n    ** connection db.\n    */\n    case SQLITE_TESTCTRL_RESERVE: {\n      sqlite3 *db = va_arg(ap, sqlite3*);\n      int x = va_arg(ap,int);\n      sqlite3_mutex_enter(db->mutex);\n      sqlite3BtreeSetPageSize(db->aDb[0].pBt, 0, x, 0);\n      sqlite3_mutex_leave(db->mutex);\n      break;\n    }\n\n    /*  sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N)\n    **\n    ** Enable or disable various optimizations for testing purposes.  The \n    ** argument N is a bitmask of optimizations to be disabled.  For normal\n    ** operation N should be 0.  The idea is that a test program (like the\n    ** SQL Logic Test or SLT test module) can run the same SQL multiple times\n    ** with various optimizations disabled to verify that the same answer\n    ** is obtained in every case.\n    */\n    case SQLITE_TESTCTRL_OPTIMIZATIONS: {\n      sqlite3 *db = va_arg(ap, sqlite3*);\n      db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);\n      break;\n    }\n\n#ifdef SQLITE_N_KEYWORD\n    /* sqlite3_test_control(SQLITE_TESTCTRL_ISKEYWORD, const char *zWord)\n    **\n    ** If zWord is a keyword recognized by the parser, then return the\n    ** number of keywords.  Or if zWord is not a keyword, return 0.\n    ** \n    ** This test feature is only available in the amalgamation since\n    ** the SQLITE_N_KEYWORD macro is not defined in this file if SQLite\n    ** is built using separate source files.\n    */\n    case SQLITE_TESTCTRL_ISKEYWORD: {\n      const char *zWord = va_arg(ap, const char*);\n      int n = sqlite3Strlen30(zWord);\n      rc = (sqlite3KeywordCode((u8*)zWord, n)!=TK_ID) ? SQLITE_N_KEYWORD : 0;\n      break;\n    }\n#endif \n\n    /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree);\n    **\n    ** Pass pFree into sqlite3ScratchFree(). \n    ** If sz>0 then allocate a scratch buffer into pNew.  \n    */\n    case SQLITE_TESTCTRL_SCRATCHMALLOC: {\n      void *pFree, **ppNew;\n      int sz;\n      sz = va_arg(ap, int);\n      ppNew = va_arg(ap, void**);\n      pFree = va_arg(ap, void*);\n      if( sz ) *ppNew = sqlite3ScratchMalloc(sz);\n      sqlite3ScratchFree(pFree);\n      break;\n    }\n\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);\n    **\n    ** If parameter onoff is non-zero, configure the wrappers so that all\n    ** subsequent calls to localtime() and variants fail. If onoff is zero,\n    ** undo this setting.\n    */\n    case SQLITE_TESTCTRL_LOCALTIME_FAULT: {\n      sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int);\n      break;\n    }\n\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int);\n    **\n    ** Set or clear a flag that indicates that the database file is always well-\n    ** formed and never corrupt.  This flag is clear by default, indicating that\n    ** database files might have arbitrary corruption.  Setting the flag during\n    ** testing causes certain assert() statements in the code to be activated\n    ** that demonstrat invariants on well-formed database files.\n    */\n    case SQLITE_TESTCTRL_NEVER_CORRUPT: {\n      sqlite3GlobalConfig.neverCorrupt = va_arg(ap, int);\n      break;\n    }\n\n    /* Set the threshold at which OP_Once counters reset back to zero.\n    ** By default this is 0x7ffffffe (over 2 billion), but that value is\n    ** too big to test in a reasonable amount of time, so this control is\n    ** provided to set a small and easily reachable reset value.\n    */\n    case SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD: {\n      sqlite3GlobalConfig.iOnceResetThreshold = va_arg(ap, int);\n      break;\n    }\n\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr);\n    **\n    ** Set the VDBE coverage callback function to xCallback with context \n    ** pointer ptr.\n    */\n    case SQLITE_TESTCTRL_VDBE_COVERAGE: {\n#ifdef SQLITE_VDBE_COVERAGE\n      typedef void (*branch_callback)(void*,int,u8,u8);\n      sqlite3GlobalConfig.xVdbeBranch = va_arg(ap,branch_callback);\n      sqlite3GlobalConfig.pVdbeBranchArg = va_arg(ap,void*);\n#endif\n      break;\n    }\n\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_SORTER_MMAP, db, nMax); */\n    case SQLITE_TESTCTRL_SORTER_MMAP: {\n      sqlite3 *db = va_arg(ap, sqlite3*);\n      db->nMaxSorterMmap = va_arg(ap, int);\n      break;\n    }\n\n    /*   sqlite3_test_control(SQLITE_TESTCTRL_ISINIT);\n    **\n    ** Return SQLITE_OK if SQLite has been initialized and SQLITE_ERROR if\n    ** not.\n    */\n    case SQLITE_TESTCTRL_ISINIT: {\n      if( sqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR;\n      break;\n    }\n\n    /*  sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, db, dbName, onOff, tnum);\n    **\n    ** This test control is used to create imposter tables.  \"db\" is a pointer\n    ** to the database connection.  dbName is the database name (ex: \"main\" or\n    ** \"temp\") which will receive the imposter.  \"onOff\" turns imposter mode on\n    ** or off.  \"tnum\" is the root page of the b-tree to which the imposter\n    ** table should connect.\n    **\n    ** Enable imposter mode only when the schema has already been parsed.  Then\n    ** run a single CREATE TABLE statement to construct the imposter table in\n    ** the parsed schema.  Then turn imposter mode back off again.\n    **\n    ** If onOff==0 and tnum>0 then reset the schema for all databases, causing\n    ** the schema to be reparsed the next time it is needed.  This has the\n    ** effect of erasing all imposter tables.\n    */\n    case SQLITE_TESTCTRL_IMPOSTER: {\n      sqlite3 *db = va_arg(ap, sqlite3*);\n      sqlite3_mutex_enter(db->mutex);\n      db->init.iDb = sqlite3FindDbName(db, va_arg(ap,const char*));\n      db->init.busy = db->init.imposterTable = va_arg(ap,int);\n      db->init.newTnum = va_arg(ap,int);\n      if( db->init.busy==0 && db->init.newTnum>0 ){\n        sqlite3ResetAllSchemasOfConnection(db);\n      }\n      sqlite3_mutex_leave(db->mutex);\n      break;\n    }\n  }\n  va_end(ap);\n#endif /* SQLITE_OMIT_BUILTIN_TEST */\n  return rc;\n}\n\n/*\n** This is a utility routine, useful to VFS implementations, that checks\n** to see if a database file was a URI that contained a specific query \n** parameter, and if so obtains the value of the query parameter.\n**\n** The zFilename argument is the filename pointer passed into the xOpen()\n** method of a VFS implementation.  The zParam argument is the name of the\n** query parameter we seek.  This routine returns the value of the zParam\n** parameter if it exists.  If the parameter does not exist, this routine\n** returns a NULL pointer.\n*/\nconst char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){\n  if( zFilename==0 || zParam==0 ) return 0;\n  zFilename += sqlite3Strlen30(zFilename) + 1;\n  while( zFilename[0] ){\n    int x = strcmp(zFilename, zParam);\n    zFilename += sqlite3Strlen30(zFilename) + 1;\n    if( x==0 ) return zFilename;\n    zFilename += sqlite3Strlen30(zFilename) + 1;\n  }\n  return 0;\n}\n\n/*\n** Return a boolean value for a query parameter.\n*/\nint sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){\n  const char *z = sqlite3_uri_parameter(zFilename, zParam);\n  bDflt = bDflt!=0;\n  return z ? sqlite3GetBoolean(z, bDflt) : bDflt;\n}\n\n/*\n** Return a 64-bit integer value for a query parameter.\n*/\nsqlite3_int64 sqlite3_uri_int64(\n  const char *zFilename,    /* Filename as passed to xOpen */\n  const char *zParam,       /* URI parameter sought */\n  sqlite3_int64 bDflt       /* return if parameter is missing */\n){\n  const char *z = sqlite3_uri_parameter(zFilename, zParam);\n  sqlite3_int64 v;\n  if( z && sqlite3DecOrHexToI64(z, &v)==SQLITE_OK ){\n    bDflt = v;\n  }\n  return bDflt;\n}\n\n/*\n** Return the Btree pointer identified by zDbName.  Return NULL if not found.\n*/\nBtree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){\n  int i;\n  for(i=0; i<db->nDb; i++){\n    if( db->aDb[i].pBt\n     && (zDbName==0 || sqlite3StrICmp(zDbName, db->aDb[i].zDbSName)==0)\n    ){\n      return db->aDb[i].pBt;\n    }\n  }\n  return 0;\n}\n\n/*\n** Return the filename of the database associated with a database\n** connection.\n*/\nconst char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){\n  Btree *pBt;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  pBt = sqlite3DbNameToBtree(db, zDbName);\n  return pBt ? sqlite3BtreeGetFilename(pBt) : 0;\n}\n\n/*\n** Return 1 if database is read-only or 0 if read/write.  Return -1 if\n** no such database exists.\n*/\nint sqlite3_db_readonly(sqlite3 *db, const char *zDbName){\n  Btree *pBt;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return -1;\n  }\n#endif\n  pBt = sqlite3DbNameToBtree(db, zDbName);\n  return pBt ? sqlite3BtreeIsReadonly(pBt) : -1;\n}\n\n#ifdef SQLITE_ENABLE_SNAPSHOT\n/*\n** Obtain a snapshot handle for the snapshot of database zDb currently \n** being read by handle db.\n*/\nint sqlite3_snapshot_get(\n  sqlite3 *db, \n  const char *zDb,\n  sqlite3_snapshot **ppSnapshot\n){\n  int rc = SQLITE_ERROR;\n#ifndef SQLITE_OMIT_WAL\n  int iDb;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n\n  iDb = sqlite3FindDbName(db, zDb);\n  if( iDb==0 || iDb>1 ){\n    Btree *pBt = db->aDb[iDb].pBt;\n    if( 0==sqlite3BtreeIsInTrans(pBt) ){\n      rc = sqlite3BtreeBeginTrans(pBt, 0);\n      if( rc==SQLITE_OK ){\n        rc = sqlite3PagerSnapshotGet(sqlite3BtreePager(pBt), ppSnapshot);\n      }\n    }\n  }\n\n  sqlite3_mutex_leave(db->mutex);\n#endif   /* SQLITE_OMIT_WAL */\n  return rc;\n}\n\n/*\n** Open a read-transaction on the snapshot idendified by pSnapshot.\n*/\nint sqlite3_snapshot_open(\n  sqlite3 *db, \n  const char *zDb, \n  sqlite3_snapshot *pSnapshot\n){\n  int rc = SQLITE_ERROR;\n#ifndef SQLITE_OMIT_WAL\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  if( db->autoCommit==0 ){\n    int iDb;\n    iDb = sqlite3FindDbName(db, zDb);\n    if( iDb==0 || iDb>1 ){\n      Btree *pBt = db->aDb[iDb].pBt;\n      if( 0==sqlite3BtreeIsInReadTrans(pBt) ){\n        rc = sqlite3PagerSnapshotOpen(sqlite3BtreePager(pBt), pSnapshot);\n        if( rc==SQLITE_OK ){\n          rc = sqlite3BtreeBeginTrans(pBt, 0);\n          sqlite3PagerSnapshotOpen(sqlite3BtreePager(pBt), 0);\n        }\n      }\n    }\n  }\n\n  sqlite3_mutex_leave(db->mutex);\n#endif   /* SQLITE_OMIT_WAL */\n  return rc;\n}\n\n/*\n** Free a snapshot handle obtained from sqlite3_snapshot_get().\n*/\nvoid sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){\n  sqlite3_free(pSnapshot);\n}\n#endif /* SQLITE_ENABLE_SNAPSHOT */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/malloc.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** Memory allocation functions used throughout sqlite.\n*/\n#include \"sqliteInt.h\"\n#include <stdarg.h>\n\n/*\n** Attempt to release up to n bytes of non-essential memory currently\n** held by SQLite. An example of non-essential memory is memory used to\n** cache database pages that are not currently in use.\n*/\nint sqlite3_release_memory(int n){\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\n  return sqlite3PcacheReleaseMemory(n);\n#else\n  /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine\n  ** is a no-op returning zero if SQLite is not compiled with\n  ** SQLITE_ENABLE_MEMORY_MANAGEMENT. */\n  UNUSED_PARAMETER(n);\n  return 0;\n#endif\n}\n\n/*\n** An instance of the following object records the location of\n** each unused scratch buffer.\n*/\ntypedef struct ScratchFreeslot {\n  struct ScratchFreeslot *pNext;   /* Next unused scratch buffer */\n} ScratchFreeslot;\n\n/*\n** State information local to the memory allocation subsystem.\n*/\nstatic SQLITE_WSD struct Mem0Global {\n  sqlite3_mutex *mutex;         /* Mutex to serialize access */\n  sqlite3_int64 alarmThreshold; /* The soft heap limit */\n\n  /*\n  ** Pointers to the end of sqlite3GlobalConfig.pScratch memory\n  ** (so that a range test can be used to determine if an allocation\n  ** being freed came from pScratch) and a pointer to the list of\n  ** unused scratch allocations.\n  */\n  void *pScratchEnd;\n  ScratchFreeslot *pScratchFree;\n  u32 nScratchFree;\n\n  /*\n  ** True if heap is nearly \"full\" where \"full\" is defined by the\n  ** sqlite3_soft_heap_limit() setting.\n  */\n  int nearlyFull;\n} mem0 = { 0, 0, 0, 0, 0, 0 };\n\n#define mem0 GLOBAL(struct Mem0Global, mem0)\n\n/*\n** Return the memory allocator mutex. sqlite3_status() needs it.\n*/\nsqlite3_mutex *sqlite3MallocMutex(void){\n  return mem0.mutex;\n}\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** Deprecated external interface.  It used to set an alarm callback\n** that was invoked when memory usage grew too large.  Now it is a\n** no-op.\n*/\nint sqlite3_memory_alarm(\n  void(*xCallback)(void *pArg, sqlite3_int64 used,int N),\n  void *pArg,\n  sqlite3_int64 iThreshold\n){\n  (void)xCallback;\n  (void)pArg;\n  (void)iThreshold;\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** Set the soft heap-size limit for the library. Passing a zero or \n** negative value indicates no limit.\n*/\nsqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){\n  sqlite3_int64 priorLimit;\n  sqlite3_int64 excess;\n  sqlite3_int64 nUsed;\n#ifndef SQLITE_OMIT_AUTOINIT\n  int rc = sqlite3_initialize();\n  if( rc ) return -1;\n#endif\n  sqlite3_mutex_enter(mem0.mutex);\n  priorLimit = mem0.alarmThreshold;\n  if( n<0 ){\n    sqlite3_mutex_leave(mem0.mutex);\n    return priorLimit;\n  }\n  mem0.alarmThreshold = n;\n  nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);\n  mem0.nearlyFull = (n>0 && n<=nUsed);\n  sqlite3_mutex_leave(mem0.mutex);\n  excess = sqlite3_memory_used() - n;\n  if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff));\n  return priorLimit;\n}\nvoid sqlite3_soft_heap_limit(int n){\n  if( n<0 ) n = 0;\n  sqlite3_soft_heap_limit64(n);\n}\n\n/*\n** Initialize the memory allocation subsystem.\n*/\nint sqlite3MallocInit(void){\n  int rc;\n  if( sqlite3GlobalConfig.m.xMalloc==0 ){\n    sqlite3MemSetDefault();\n  }\n  memset(&mem0, 0, sizeof(mem0));\n  mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\n  if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100\n      && sqlite3GlobalConfig.nScratch>0 ){\n    int i, n, sz;\n    ScratchFreeslot *pSlot;\n    sz = ROUNDDOWN8(sqlite3GlobalConfig.szScratch);\n    sqlite3GlobalConfig.szScratch = sz;\n    pSlot = (ScratchFreeslot*)sqlite3GlobalConfig.pScratch;\n    n = sqlite3GlobalConfig.nScratch;\n    mem0.pScratchFree = pSlot;\n    mem0.nScratchFree = n;\n    for(i=0; i<n-1; i++){\n      pSlot->pNext = (ScratchFreeslot*)(sz+(char*)pSlot);\n      pSlot = pSlot->pNext;\n    }\n    pSlot->pNext = 0;\n    mem0.pScratchEnd = (void*)&pSlot[1];\n  }else{\n    mem0.pScratchEnd = 0;\n    sqlite3GlobalConfig.pScratch = 0;\n    sqlite3GlobalConfig.szScratch = 0;\n    sqlite3GlobalConfig.nScratch = 0;\n  }\n  if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512\n      || sqlite3GlobalConfig.nPage<=0 ){\n    sqlite3GlobalConfig.pPage = 0;\n    sqlite3GlobalConfig.szPage = 0;\n  }\n  rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);\n  if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));\n  return rc;\n}\n\n/*\n** Return true if the heap is currently under memory pressure - in other\n** words if the amount of heap used is close to the limit set by\n** sqlite3_soft_heap_limit().\n*/\nint sqlite3HeapNearlyFull(void){\n  return mem0.nearlyFull;\n}\n\n/*\n** Deinitialize the memory allocation subsystem.\n*/\nvoid sqlite3MallocEnd(void){\n  if( sqlite3GlobalConfig.m.xShutdown ){\n    sqlite3GlobalConfig.m.xShutdown(sqlite3GlobalConfig.m.pAppData);\n  }\n  memset(&mem0, 0, sizeof(mem0));\n}\n\n/*\n** Return the amount of memory currently checked out.\n*/\nsqlite3_int64 sqlite3_memory_used(void){\n  sqlite3_int64 res, mx;\n  sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0);\n  return res;\n}\n\n/*\n** Return the maximum amount of memory that has ever been\n** checked out since either the beginning of this process\n** or since the most recent reset.\n*/\nsqlite3_int64 sqlite3_memory_highwater(int resetFlag){\n  sqlite3_int64 res, mx;\n  sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag);\n  return mx;\n}\n\n/*\n** Trigger the alarm \n*/\nstatic void sqlite3MallocAlarm(int nByte){\n  if( mem0.alarmThreshold<=0 ) return;\n  sqlite3_mutex_leave(mem0.mutex);\n  sqlite3_release_memory(nByte);\n  sqlite3_mutex_enter(mem0.mutex);\n}\n\n/*\n** Do a memory allocation with statistics and alarms.  Assume the\n** lock is already held.\n*/\nstatic int mallocWithAlarm(int n, void **pp){\n  int nFull;\n  void *p;\n  assert( sqlite3_mutex_held(mem0.mutex) );\n  nFull = sqlite3GlobalConfig.m.xRoundup(n);\n  sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n);\n  if( mem0.alarmThreshold>0 ){\n    sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);\n    if( nUsed >= mem0.alarmThreshold - nFull ){\n      mem0.nearlyFull = 1;\n      sqlite3MallocAlarm(nFull);\n    }else{\n      mem0.nearlyFull = 0;\n    }\n  }\n  p = sqlite3GlobalConfig.m.xMalloc(nFull);\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\n  if( p==0 && mem0.alarmThreshold>0 ){\n    sqlite3MallocAlarm(nFull);\n    p = sqlite3GlobalConfig.m.xMalloc(nFull);\n  }\n#endif\n  if( p ){\n    nFull = sqlite3MallocSize(p);\n    sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull);\n    sqlite3StatusUp(SQLITE_STATUS_MALLOC_COUNT, 1);\n  }\n  *pp = p;\n  return nFull;\n}\n\n/*\n** Allocate memory.  This routine is like sqlite3_malloc() except that it\n** assumes the memory subsystem has already been initialized.\n*/\nvoid *sqlite3Malloc(u64 n){\n  void *p;\n  if( n==0 || n>=0x7fffff00 ){\n    /* A memory allocation of a number of bytes which is near the maximum\n    ** signed integer value might cause an integer overflow inside of the\n    ** xMalloc().  Hence we limit the maximum size to 0x7fffff00, giving\n    ** 255 bytes of overhead.  SQLite itself will never use anything near\n    ** this amount.  The only way to reach the limit is with sqlite3_malloc() */\n    p = 0;\n  }else if( sqlite3GlobalConfig.bMemstat ){\n    sqlite3_mutex_enter(mem0.mutex);\n    mallocWithAlarm((int)n, &p);\n    sqlite3_mutex_leave(mem0.mutex);\n  }else{\n    p = sqlite3GlobalConfig.m.xMalloc((int)n);\n  }\n  assert( EIGHT_BYTE_ALIGNMENT(p) );  /* IMP: R-11148-40995 */\n  return p;\n}\n\n/*\n** This version of the memory allocation is for use by the application.\n** First make sure the memory subsystem is initialized, then do the\n** allocation.\n*/\nvoid *sqlite3_malloc(int n){\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize() ) return 0;\n#endif\n  return n<=0 ? 0 : sqlite3Malloc(n);\n}\nvoid *sqlite3_malloc64(sqlite3_uint64 n){\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize() ) return 0;\n#endif\n  return sqlite3Malloc(n);\n}\n\n/*\n** Each thread may only have a single outstanding allocation from\n** xScratchMalloc().  We verify this constraint in the single-threaded\n** case by setting scratchAllocOut to 1 when an allocation\n** is outstanding clearing it when the allocation is freed.\n*/\n#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)\nstatic int scratchAllocOut = 0;\n#endif\n\n\n/*\n** Allocate memory that is to be used and released right away.\n** This routine is similar to alloca() in that it is not intended\n** for situations where the memory might be held long-term.  This\n** routine is intended to get memory to old large transient data\n** structures that would not normally fit on the stack of an\n** embedded processor.\n*/\nvoid *sqlite3ScratchMalloc(int n){\n  void *p;\n  assert( n>0 );\n\n  sqlite3_mutex_enter(mem0.mutex);\n  sqlite3StatusHighwater(SQLITE_STATUS_SCRATCH_SIZE, n);\n  if( mem0.nScratchFree && sqlite3GlobalConfig.szScratch>=n ){\n    p = mem0.pScratchFree;\n    mem0.pScratchFree = mem0.pScratchFree->pNext;\n    mem0.nScratchFree--;\n    sqlite3StatusUp(SQLITE_STATUS_SCRATCH_USED, 1);\n    sqlite3_mutex_leave(mem0.mutex);\n  }else{\n    sqlite3_mutex_leave(mem0.mutex);\n    p = sqlite3Malloc(n);\n    if( sqlite3GlobalConfig.bMemstat && p ){\n      sqlite3_mutex_enter(mem0.mutex);\n      sqlite3StatusUp(SQLITE_STATUS_SCRATCH_OVERFLOW, sqlite3MallocSize(p));\n      sqlite3_mutex_leave(mem0.mutex);\n    }\n    sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);\n  }\n  assert( sqlite3_mutex_notheld(mem0.mutex) );\n\n\n#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)\n  /* EVIDENCE-OF: R-12970-05880 SQLite will not use more than one scratch\n  ** buffers per thread.\n  **\n  ** This can only be checked in single-threaded mode.\n  */\n  assert( scratchAllocOut==0 );\n  if( p ) scratchAllocOut++;\n#endif\n\n  return p;\n}\nvoid sqlite3ScratchFree(void *p){\n  if( p ){\n\n#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)\n    /* Verify that no more than two scratch allocation per thread\n    ** is outstanding at one time.  (This is only checked in the\n    ** single-threaded case since checking in the multi-threaded case\n    ** would be much more complicated.) */\n    assert( scratchAllocOut>=1 && scratchAllocOut<=2 );\n    scratchAllocOut--;\n#endif\n\n    if( SQLITE_WITHIN(p, sqlite3GlobalConfig.pScratch, mem0.pScratchEnd) ){\n      /* Release memory from the SQLITE_CONFIG_SCRATCH allocation */\n      ScratchFreeslot *pSlot;\n      pSlot = (ScratchFreeslot*)p;\n      sqlite3_mutex_enter(mem0.mutex);\n      pSlot->pNext = mem0.pScratchFree;\n      mem0.pScratchFree = pSlot;\n      mem0.nScratchFree++;\n      assert( mem0.nScratchFree <= (u32)sqlite3GlobalConfig.nScratch );\n      sqlite3StatusDown(SQLITE_STATUS_SCRATCH_USED, 1);\n      sqlite3_mutex_leave(mem0.mutex);\n    }else{\n      /* Release memory back to the heap */\n      assert( sqlite3MemdebugHasType(p, MEMTYPE_SCRATCH) );\n      assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_SCRATCH) );\n      sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\n      if( sqlite3GlobalConfig.bMemstat ){\n        int iSize = sqlite3MallocSize(p);\n        sqlite3_mutex_enter(mem0.mutex);\n        sqlite3StatusDown(SQLITE_STATUS_SCRATCH_OVERFLOW, iSize);\n        sqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, iSize);\n        sqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1);\n        sqlite3GlobalConfig.m.xFree(p);\n        sqlite3_mutex_leave(mem0.mutex);\n      }else{\n        sqlite3GlobalConfig.m.xFree(p);\n      }\n    }\n  }\n}\n\n/*\n** TRUE if p is a lookaside memory allocation from db\n*/\n#ifndef SQLITE_OMIT_LOOKASIDE\nstatic int isLookaside(sqlite3 *db, void *p){\n  return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pEnd);\n}\n#else\n#define isLookaside(A,B) 0\n#endif\n\n/*\n** Return the size of a memory allocation previously obtained from\n** sqlite3Malloc() or sqlite3_malloc().\n*/\nint sqlite3MallocSize(void *p){\n  assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );\n  return sqlite3GlobalConfig.m.xSize(p);\n}\nint sqlite3DbMallocSize(sqlite3 *db, void *p){\n  assert( p!=0 );\n  if( db==0 || !isLookaside(db,p) ){\n#if SQLITE_DEBUG\n    if( db==0 ){\n      assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );\n      assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );\n    }else{\n      assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );\n      assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );\n    }\n#endif\n    return sqlite3GlobalConfig.m.xSize(p);\n  }else{\n    assert( sqlite3_mutex_held(db->mutex) );\n    return db->lookaside.sz;\n  }\n}\nsqlite3_uint64 sqlite3_msize(void *p){\n  assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );\n  assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );\n  return p ? sqlite3GlobalConfig.m.xSize(p) : 0;\n}\n\n/*\n** Free memory previously obtained from sqlite3Malloc().\n*/\nvoid sqlite3_free(void *p){\n  if( p==0 ) return;  /* IMP: R-49053-54554 */\n  assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );\n  assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) );\n  if( sqlite3GlobalConfig.bMemstat ){\n    sqlite3_mutex_enter(mem0.mutex);\n    sqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, sqlite3MallocSize(p));\n    sqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1);\n    sqlite3GlobalConfig.m.xFree(p);\n    sqlite3_mutex_leave(mem0.mutex);\n  }else{\n    sqlite3GlobalConfig.m.xFree(p);\n  }\n}\n\n/*\n** Add the size of memory allocation \"p\" to the count in\n** *db->pnBytesFreed.\n*/\nstatic SQLITE_NOINLINE void measureAllocationSize(sqlite3 *db, void *p){\n  *db->pnBytesFreed += sqlite3DbMallocSize(db,p);\n}\n\n/*\n** Free memory that might be associated with a particular database\n** connection.\n*/\nvoid sqlite3DbFree(sqlite3 *db, void *p){\n  assert( db==0 || sqlite3_mutex_held(db->mutex) );\n  if( p==0 ) return;\n  if( db ){\n    if( db->pnBytesFreed ){\n      measureAllocationSize(db, p);\n      return;\n    }\n    if( isLookaside(db, p) ){\n      LookasideSlot *pBuf = (LookasideSlot*)p;\n#if SQLITE_DEBUG\n      /* Trash all content in the buffer being freed */\n      memset(p, 0xaa, db->lookaside.sz);\n#endif\n      pBuf->pNext = db->lookaside.pFree;\n      db->lookaside.pFree = pBuf;\n      db->lookaside.nOut--;\n      return;\n    }\n  }\n  assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );\n  assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );\n  assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );\n  sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\n  sqlite3_free(p);\n}\n\n/*\n** Change the size of an existing memory allocation\n*/\nvoid *sqlite3Realloc(void *pOld, u64 nBytes){\n  int nOld, nNew, nDiff;\n  void *pNew;\n  assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) );\n  assert( sqlite3MemdebugNoType(pOld, (u8)~MEMTYPE_HEAP) );\n  if( pOld==0 ){\n    return sqlite3Malloc(nBytes); /* IMP: R-04300-56712 */\n  }\n  if( nBytes==0 ){\n    sqlite3_free(pOld); /* IMP: R-26507-47431 */\n    return 0;\n  }\n  if( nBytes>=0x7fffff00 ){\n    /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */\n    return 0;\n  }\n  nOld = sqlite3MallocSize(pOld);\n  /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second\n  ** argument to xRealloc is always a value returned by a prior call to\n  ** xRoundup. */\n  nNew = sqlite3GlobalConfig.m.xRoundup((int)nBytes);\n  if( nOld==nNew ){\n    pNew = pOld;\n  }else if( sqlite3GlobalConfig.bMemstat ){\n    sqlite3_mutex_enter(mem0.mutex);\n    sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, (int)nBytes);\n    nDiff = nNew - nOld;\n    if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >= \n          mem0.alarmThreshold-nDiff ){\n      sqlite3MallocAlarm(nDiff);\n    }\n    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);\n    if( pNew==0 && mem0.alarmThreshold>0 ){\n      sqlite3MallocAlarm((int)nBytes);\n      pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);\n    }\n    if( pNew ){\n      nNew = sqlite3MallocSize(pNew);\n      sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nNew-nOld);\n    }\n    sqlite3_mutex_leave(mem0.mutex);\n  }else{\n    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);\n  }\n  assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-11148-40995 */\n  return pNew;\n}\n\n/*\n** The public interface to sqlite3Realloc.  Make sure that the memory\n** subsystem is initialized prior to invoking sqliteRealloc.\n*/\nvoid *sqlite3_realloc(void *pOld, int n){\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize() ) return 0;\n#endif\n  if( n<0 ) n = 0;  /* IMP: R-26507-47431 */\n  return sqlite3Realloc(pOld, n);\n}\nvoid *sqlite3_realloc64(void *pOld, sqlite3_uint64 n){\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize() ) return 0;\n#endif\n  return sqlite3Realloc(pOld, n);\n}\n\n\n/*\n** Allocate and zero memory.\n*/ \nvoid *sqlite3MallocZero(u64 n){\n  void *p = sqlite3Malloc(n);\n  if( p ){\n    memset(p, 0, (size_t)n);\n  }\n  return p;\n}\n\n/*\n** Allocate and zero memory.  If the allocation fails, make\n** the mallocFailed flag in the connection pointer.\n*/\nvoid *sqlite3DbMallocZero(sqlite3 *db, u64 n){\n  void *p;\n  testcase( db==0 );\n  p = sqlite3DbMallocRaw(db, n);\n  if( p ) memset(p, 0, (size_t)n);\n  return p;\n}\n\n\n/* Finish the work of sqlite3DbMallocRawNN for the unusual and\n** slower case when the allocation cannot be fulfilled using lookaside.\n*/\nstatic SQLITE_NOINLINE void *dbMallocRawFinish(sqlite3 *db, u64 n){\n  void *p;\n  assert( db!=0 );\n  p = sqlite3Malloc(n);\n  if( !p ) sqlite3OomFault(db);\n  sqlite3MemdebugSetType(p, \n         (db->lookaside.bDisable==0) ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP);\n  return p;\n}\n\n/*\n** Allocate memory, either lookaside (if possible) or heap.  \n** If the allocation fails, set the mallocFailed flag in\n** the connection pointer.\n**\n** If db!=0 and db->mallocFailed is true (indicating a prior malloc\n** failure on the same database connection) then always return 0.\n** Hence for a particular database connection, once malloc starts\n** failing, it fails consistently until mallocFailed is reset.\n** This is an important assumption.  There are many places in the\n** code that do things like this:\n**\n**         int *a = (int*)sqlite3DbMallocRaw(db, 100);\n**         int *b = (int*)sqlite3DbMallocRaw(db, 200);\n**         if( b ) a[10] = 9;\n**\n** In other words, if a subsequent malloc (ex: \"b\") worked, it is assumed\n** that all prior mallocs (ex: \"a\") worked too.\n**\n** The sqlite3MallocRawNN() variant guarantees that the \"db\" parameter is\n** not a NULL pointer.\n*/\nvoid *sqlite3DbMallocRaw(sqlite3 *db, u64 n){\n  void *p;\n  if( db ) return sqlite3DbMallocRawNN(db, n);\n  p = sqlite3Malloc(n);\n  sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\n  return p;\n}\nvoid *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){\n#ifndef SQLITE_OMIT_LOOKASIDE\n  LookasideSlot *pBuf;\n  assert( db!=0 );\n  assert( sqlite3_mutex_held(db->mutex) );\n  assert( db->pnBytesFreed==0 );\n  if( db->lookaside.bDisable==0 ){\n    assert( db->mallocFailed==0 );\n    if( n>db->lookaside.sz ){\n      db->lookaside.anStat[1]++;\n    }else if( (pBuf = db->lookaside.pFree)==0 ){\n      db->lookaside.anStat[2]++;\n    }else{\n      db->lookaside.pFree = pBuf->pNext;\n      db->lookaside.nOut++;\n      db->lookaside.anStat[0]++;\n      if( db->lookaside.nOut>db->lookaside.mxOut ){\n        db->lookaside.mxOut = db->lookaside.nOut;\n      }\n      return (void*)pBuf;\n    }\n  }else if( db->mallocFailed ){\n    return 0;\n  }\n#else\n  assert( db!=0 );\n  assert( sqlite3_mutex_held(db->mutex) );\n  assert( db->pnBytesFreed==0 );\n  if( db->mallocFailed ){\n    return 0;\n  }\n#endif\n  return dbMallocRawFinish(db, n);\n}\n\n/* Forward declaration */\nstatic SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n);\n\n/*\n** Resize the block of memory pointed to by p to n bytes. If the\n** resize fails, set the mallocFailed flag in the connection object.\n*/\nvoid *sqlite3DbRealloc(sqlite3 *db, void *p, u64 n){\n  assert( db!=0 );\n  if( p==0 ) return sqlite3DbMallocRawNN(db, n);\n  assert( sqlite3_mutex_held(db->mutex) );\n  if( isLookaside(db,p) && n<=db->lookaside.sz ) return p;\n  return dbReallocFinish(db, p, n);\n}\nstatic SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n){\n  void *pNew = 0;\n  assert( db!=0 );\n  assert( p!=0 );\n  if( db->mallocFailed==0 ){\n    if( isLookaside(db, p) ){\n      pNew = sqlite3DbMallocRawNN(db, n);\n      if( pNew ){\n        memcpy(pNew, p, db->lookaside.sz);\n        sqlite3DbFree(db, p);\n      }\n    }else{\n      assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );\n      assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) );\n      sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\n      pNew = sqlite3_realloc64(p, n);\n      if( !pNew ){\n        sqlite3OomFault(db);\n      }\n      sqlite3MemdebugSetType(pNew,\n            (db->lookaside.bDisable==0 ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP));\n    }\n  }\n  return pNew;\n}\n\n/*\n** Attempt to reallocate p.  If the reallocation fails, then free p\n** and set the mallocFailed flag in the database connection.\n*/\nvoid *sqlite3DbReallocOrFree(sqlite3 *db, void *p, u64 n){\n  void *pNew;\n  pNew = sqlite3DbRealloc(db, p, n);\n  if( !pNew ){\n    sqlite3DbFree(db, p);\n  }\n  return pNew;\n}\n\n/*\n** Make a copy of a string in memory obtained from sqliteMalloc(). These \n** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This\n** is because when memory debugging is turned on, these two functions are \n** called via macros that record the current file and line number in the\n** ThreadData structure.\n*/\nchar *sqlite3DbStrDup(sqlite3 *db, const char *z){\n  char *zNew;\n  size_t n;\n  if( z==0 ){\n    return 0;\n  }\n  n = sqlite3Strlen30(z) + 1;\n  assert( (n&0x7fffffff)==n );\n  zNew = sqlite3DbMallocRaw(db, (int)n);\n  if( zNew ){\n    memcpy(zNew, z, n);\n  }\n  return zNew;\n}\nchar *sqlite3DbStrNDup(sqlite3 *db, const char *z, u64 n){\n  char *zNew;\n  assert( db!=0 );\n  if( z==0 ){\n    return 0;\n  }\n  assert( (n&0x7fffffff)==n );\n  zNew = sqlite3DbMallocRawNN(db, n+1);\n  if( zNew ){\n    memcpy(zNew, z, (size_t)n);\n    zNew[n] = 0;\n  }\n  return zNew;\n}\n\n/*\n** Free any prior content in *pz and replace it with a copy of zNew.\n*/\nvoid sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){\n  sqlite3DbFree(db, *pz);\n  *pz = sqlite3DbStrDup(db, zNew);\n}\n\n/*\n** Call this routine to record the fact that an OOM (out-of-memory) error\n** has happened.  This routine will set db->mallocFailed, and also\n** temporarily disable the lookaside memory allocator and interrupt\n** any running VDBEs.\n*/\nvoid sqlite3OomFault(sqlite3 *db){\n  if( db->mallocFailed==0 && db->bBenignMalloc==0 ){\n    db->mallocFailed = 1;\n    if( db->nVdbeExec>0 ){\n      db->u1.isInterrupted = 1;\n    }\n    db->lookaside.bDisable++;\n  }\n}\n\n/*\n** This routine reactivates the memory allocator and clears the\n** db->mallocFailed flag as necessary.\n**\n** The memory allocator is not restarted if there are running\n** VDBEs.\n*/\nvoid sqlite3OomClear(sqlite3 *db){\n  if( db->mallocFailed && db->nVdbeExec==0 ){\n    db->mallocFailed = 0;\n    db->u1.isInterrupted = 0;\n    assert( db->lookaside.bDisable>0 );\n    db->lookaside.bDisable--;\n  }\n}\n\n/*\n** Take actions at the end of an API call to indicate an OOM error\n*/\nstatic SQLITE_NOINLINE int apiOomError(sqlite3 *db){\n  sqlite3OomClear(db);\n  sqlite3Error(db, SQLITE_NOMEM);\n  return SQLITE_NOMEM_BKPT;\n}\n\n/*\n** This function must be called before exiting any API function (i.e. \n** returning control to the user) that has called sqlite3_malloc or\n** sqlite3_realloc.\n**\n** The returned value is normally a copy of the second argument to this\n** function. However, if a malloc() failure has occurred since the previous\n** invocation SQLITE_NOMEM is returned instead. \n**\n** If an OOM as occurred, then the connection error-code (the value\n** returned by sqlite3_errcode()) is set to SQLITE_NOMEM.\n*/\nint sqlite3ApiExit(sqlite3* db, int rc){\n  /* If the db handle must hold the connection handle mutex here.\n  ** Otherwise the read (and possible write) of db->mallocFailed \n  ** is unsafe, as is the call to sqlite3Error().\n  */\n  assert( db!=0 );\n  assert( sqlite3_mutex_held(db->mutex) );\n  if( db->mallocFailed || rc==SQLITE_IOERR_NOMEM ){\n    return apiOomError(db);\n  }\n  return rc & db->errMask;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mem0.c",
    "content": "/*\n** 2008 October 28\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains a no-op memory allocation drivers for use when\n** SQLITE_ZERO_MALLOC is defined.  The allocation drivers implemented\n** here always fail.  SQLite will not operate with these drivers.  These\n** are merely placeholders.  Real drivers must be substituted using\n** sqlite3_config() before SQLite will operate.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** This version of the memory allocator is the default.  It is\n** used when no other memory allocator is specified using compile-time\n** macros.\n*/\n#ifdef SQLITE_ZERO_MALLOC\n\n/*\n** No-op versions of all memory allocation routines\n*/\nstatic void *sqlite3MemMalloc(int nByte){ return 0; }\nstatic void sqlite3MemFree(void *pPrior){ return; }\nstatic void *sqlite3MemRealloc(void *pPrior, int nByte){ return 0; }\nstatic int sqlite3MemSize(void *pPrior){ return 0; }\nstatic int sqlite3MemRoundup(int n){ return n; }\nstatic int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; }\nstatic void sqlite3MemShutdown(void *NotUsed){ return; }\n\n/*\n** This routine is the only routine in this file with external linkage.\n**\n** Populate the low-level memory allocation function pointers in\n** sqlite3GlobalConfig.m with pointers to the routines in this file.\n*/\nvoid sqlite3MemSetDefault(void){\n  static const sqlite3_mem_methods defaultMethods = {\n     sqlite3MemMalloc,\n     sqlite3MemFree,\n     sqlite3MemRealloc,\n     sqlite3MemSize,\n     sqlite3MemRoundup,\n     sqlite3MemInit,\n     sqlite3MemShutdown,\n     0\n  };\n  sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);\n}\n\n#endif /* SQLITE_ZERO_MALLOC */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mem1.c",
    "content": "/*\n** 2007 August 14\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains low-level memory allocation drivers for when\n** SQLite will use the standard C-library malloc/realloc/free interface\n** to obtain the memory it needs.\n**\n** This file contains implementations of the low-level memory allocation\n** routines specified in the sqlite3_mem_methods object.  The content of\n** this file is only used if SQLITE_SYSTEM_MALLOC is defined.  The\n** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the\n** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined.  The\n** default configuration is to use memory allocation routines in this\n** file.\n**\n** C-preprocessor macro summary:\n**\n**    HAVE_MALLOC_USABLE_SIZE     The configure script sets this symbol if\n**                                the malloc_usable_size() interface exists\n**                                on the target platform.  Or, this symbol\n**                                can be set manually, if desired.\n**                                If an equivalent interface exists by\n**                                a different name, using a separate -D\n**                                option to rename it.\n**\n**    SQLITE_WITHOUT_ZONEMALLOC   Some older macs lack support for the zone\n**                                memory allocator.  Set this symbol to enable\n**                                building on older macs.\n**\n**    SQLITE_WITHOUT_MSIZE        Set this symbol to disable the use of\n**                                _msize() on windows systems.  This might\n**                                be necessary when compiling for Delphi,\n**                                for example.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** This version of the memory allocator is the default.  It is\n** used when no other memory allocator is specified using compile-time\n** macros.\n*/\n#ifdef SQLITE_SYSTEM_MALLOC\n#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)\n\n/*\n** Use the zone allocator available on apple products unless the\n** SQLITE_WITHOUT_ZONEMALLOC symbol is defined.\n*/\n#include <sys/sysctl.h>\n#include <malloc/malloc.h>\n#include <libkern/OSAtomic.h>\nstatic malloc_zone_t* _sqliteZone_;\n#define SQLITE_MALLOC(x) malloc_zone_malloc(_sqliteZone_, (x))\n#define SQLITE_FREE(x) malloc_zone_free(_sqliteZone_, (x));\n#define SQLITE_REALLOC(x,y) malloc_zone_realloc(_sqliteZone_, (x), (y))\n#define SQLITE_MALLOCSIZE(x) \\\n        (_sqliteZone_ ? _sqliteZone_->size(_sqliteZone_,x) : malloc_size(x))\n\n#else /* if not __APPLE__ */\n\n/*\n** Use standard C library malloc and free on non-Apple systems.  \n** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.\n*/\n#define SQLITE_MALLOC(x)             malloc(x)\n#define SQLITE_FREE(x)               free(x)\n#define SQLITE_REALLOC(x,y)          realloc((x),(y))\n\n/*\n** The malloc.h header file is needed for malloc_usable_size() function\n** on some systems (e.g. Linux).\n*/\n#if HAVE_MALLOC_H && HAVE_MALLOC_USABLE_SIZE\n#  define SQLITE_USE_MALLOC_H 1\n#  define SQLITE_USE_MALLOC_USABLE_SIZE 1\n/*\n** The MSVCRT has malloc_usable_size(), but it is called _msize().  The\n** use of _msize() is automatic, but can be disabled by compiling with\n** -DSQLITE_WITHOUT_MSIZE.  Using the _msize() function also requires\n** the malloc.h header file.\n*/\n#elif defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)\n#  define SQLITE_USE_MALLOC_H\n#  define SQLITE_USE_MSIZE\n#endif\n\n/*\n** Include the malloc.h header file, if necessary.  Also set define macro\n** SQLITE_MALLOCSIZE to the appropriate function name, which is _msize()\n** for MSVC and malloc_usable_size() for most other systems (e.g. Linux).\n** The memory size function can always be overridden manually by defining\n** the macro SQLITE_MALLOCSIZE to the desired function name.\n*/\n#if defined(SQLITE_USE_MALLOC_H)\n#  include <malloc.h>\n#  if defined(SQLITE_USE_MALLOC_USABLE_SIZE)\n#    if !defined(SQLITE_MALLOCSIZE)\n#      define SQLITE_MALLOCSIZE(x)   malloc_usable_size(x)\n#    endif\n#  elif defined(SQLITE_USE_MSIZE)\n#    if !defined(SQLITE_MALLOCSIZE)\n#      define SQLITE_MALLOCSIZE      _msize\n#    endif\n#  endif\n#endif /* defined(SQLITE_USE_MALLOC_H) */\n\n#endif /* __APPLE__ or not __APPLE__ */\n\n/*\n** Like malloc(), but remember the size of the allocation\n** so that we can find it later using sqlite3MemSize().\n**\n** For this low-level routine, we are guaranteed that nByte>0 because\n** cases of nByte<=0 will be intercepted and dealt with by higher level\n** routines.\n*/\nstatic void *sqlite3MemMalloc(int nByte){\n#ifdef SQLITE_MALLOCSIZE\n  void *p = SQLITE_MALLOC( nByte );\n  if( p==0 ){\n    testcase( sqlite3GlobalConfig.xLog!=0 );\n    sqlite3_log(SQLITE_NOMEM, \"failed to allocate %u bytes of memory\", nByte);\n  }\n  return p;\n#else\n  sqlite3_int64 *p;\n  assert( nByte>0 );\n  nByte = ROUND8(nByte);\n  p = SQLITE_MALLOC( nByte+8 );\n  if( p ){\n    p[0] = nByte;\n    p++;\n  }else{\n    testcase( sqlite3GlobalConfig.xLog!=0 );\n    sqlite3_log(SQLITE_NOMEM, \"failed to allocate %u bytes of memory\", nByte);\n  }\n  return (void *)p;\n#endif\n}\n\n/*\n** Like free() but works for allocations obtained from sqlite3MemMalloc()\n** or sqlite3MemRealloc().\n**\n** For this low-level routine, we already know that pPrior!=0 since\n** cases where pPrior==0 will have been intecepted and dealt with\n** by higher-level routines.\n*/\nstatic void sqlite3MemFree(void *pPrior){\n#ifdef SQLITE_MALLOCSIZE\n  SQLITE_FREE(pPrior);\n#else\n  sqlite3_int64 *p = (sqlite3_int64*)pPrior;\n  assert( pPrior!=0 );\n  p--;\n  SQLITE_FREE(p);\n#endif\n}\n\n/*\n** Report the allocated size of a prior return from xMalloc()\n** or xRealloc().\n*/\nstatic int sqlite3MemSize(void *pPrior){\n#ifdef SQLITE_MALLOCSIZE\n  assert( pPrior!=0 );\n  return (int)SQLITE_MALLOCSIZE(pPrior);\n#else\n  sqlite3_int64 *p;\n  assert( pPrior!=0 );\n  p = (sqlite3_int64*)pPrior;\n  p--;\n  return (int)p[0];\n#endif\n}\n\n/*\n** Like realloc().  Resize an allocation previously obtained from\n** sqlite3MemMalloc().\n**\n** For this low-level interface, we know that pPrior!=0.  Cases where\n** pPrior==0 while have been intercepted by higher-level routine and\n** redirected to xMalloc.  Similarly, we know that nByte>0 because\n** cases where nByte<=0 will have been intercepted by higher-level\n** routines and redirected to xFree.\n*/\nstatic void *sqlite3MemRealloc(void *pPrior, int nByte){\n#ifdef SQLITE_MALLOCSIZE\n  void *p = SQLITE_REALLOC(pPrior, nByte);\n  if( p==0 ){\n    testcase( sqlite3GlobalConfig.xLog!=0 );\n    sqlite3_log(SQLITE_NOMEM,\n      \"failed memory resize %u to %u bytes\",\n      SQLITE_MALLOCSIZE(pPrior), nByte);\n  }\n  return p;\n#else\n  sqlite3_int64 *p = (sqlite3_int64*)pPrior;\n  assert( pPrior!=0 && nByte>0 );\n  assert( nByte==ROUND8(nByte) ); /* EV: R-46199-30249 */\n  p--;\n  p = SQLITE_REALLOC(p, nByte+8 );\n  if( p ){\n    p[0] = nByte;\n    p++;\n  }else{\n    testcase( sqlite3GlobalConfig.xLog!=0 );\n    sqlite3_log(SQLITE_NOMEM,\n      \"failed memory resize %u to %u bytes\",\n      sqlite3MemSize(pPrior), nByte);\n  }\n  return (void*)p;\n#endif\n}\n\n/*\n** Round up a request size to the next valid allocation size.\n*/\nstatic int sqlite3MemRoundup(int n){\n  return ROUND8(n);\n}\n\n/*\n** Initialize this module.\n*/\nstatic int sqlite3MemInit(void *NotUsed){\n#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)\n  int cpuCount;\n  size_t len;\n  if( _sqliteZone_ ){\n    return SQLITE_OK;\n  }\n  len = sizeof(cpuCount);\n  /* One usually wants to use hw.acctivecpu for MT decisions, but not here */\n  sysctlbyname(\"hw.ncpu\", &cpuCount, &len, NULL, 0);\n  if( cpuCount>1 ){\n    /* defer MT decisions to system malloc */\n    _sqliteZone_ = malloc_default_zone();\n  }else{\n    /* only 1 core, use our own zone to contention over global locks, \n    ** e.g. we have our own dedicated locks */\n    bool success;\n    malloc_zone_t* newzone = malloc_create_zone(4096, 0);\n    malloc_set_zone_name(newzone, \"Sqlite_Heap\");\n    do{\n      success = OSAtomicCompareAndSwapPtrBarrier(NULL, newzone, \n                                 (void * volatile *)&_sqliteZone_);\n    }while(!_sqliteZone_);\n    if( !success ){\n      /* somebody registered a zone first */\n      malloc_destroy_zone(newzone);\n    }\n  }\n#endif\n  UNUSED_PARAMETER(NotUsed);\n  return SQLITE_OK;\n}\n\n/*\n** Deinitialize this module.\n*/\nstatic void sqlite3MemShutdown(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  return;\n}\n\n/*\n** This routine is the only routine in this file with external linkage.\n**\n** Populate the low-level memory allocation function pointers in\n** sqlite3GlobalConfig.m with pointers to the routines in this file.\n*/\nvoid sqlite3MemSetDefault(void){\n  static const sqlite3_mem_methods defaultMethods = {\n     sqlite3MemMalloc,\n     sqlite3MemFree,\n     sqlite3MemRealloc,\n     sqlite3MemSize,\n     sqlite3MemRoundup,\n     sqlite3MemInit,\n     sqlite3MemShutdown,\n     0\n  };\n  sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);\n}\n\n#endif /* SQLITE_SYSTEM_MALLOC */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mem2.c",
    "content": "/*\n** 2007 August 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains low-level memory allocation drivers for when\n** SQLite will use the standard C-library malloc/realloc/free interface\n** to obtain the memory it needs while adding lots of additional debugging\n** information to each allocation in order to help detect and fix memory\n** leaks and memory usage errors.\n**\n** This file contains implementations of the low-level memory allocation\n** routines specified in the sqlite3_mem_methods object.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** This version of the memory allocator is used only if the\n** SQLITE_MEMDEBUG macro is defined\n*/\n#ifdef SQLITE_MEMDEBUG\n\n/*\n** The backtrace functionality is only available with GLIBC\n*/\n#ifdef __GLIBC__\n  extern int backtrace(void**,int);\n  extern void backtrace_symbols_fd(void*const*,int,int);\n#else\n# define backtrace(A,B) 1\n# define backtrace_symbols_fd(A,B,C)\n#endif\n#include <stdio.h>\n\n/*\n** Each memory allocation looks like this:\n**\n**  ------------------------------------------------------------------------\n**  | Title |  backtrace pointers |  MemBlockHdr |  allocation |  EndGuard |\n**  ------------------------------------------------------------------------\n**\n** The application code sees only a pointer to the allocation.  We have\n** to back up from the allocation pointer to find the MemBlockHdr.  The\n** MemBlockHdr tells us the size of the allocation and the number of\n** backtrace pointers.  There is also a guard word at the end of the\n** MemBlockHdr.\n*/\nstruct MemBlockHdr {\n  i64 iSize;                          /* Size of this allocation */\n  struct MemBlockHdr *pNext, *pPrev;  /* Linked list of all unfreed memory */\n  char nBacktrace;                    /* Number of backtraces on this alloc */\n  char nBacktraceSlots;               /* Available backtrace slots */\n  u8 nTitle;                          /* Bytes of title; includes '\\0' */\n  u8 eType;                           /* Allocation type code */\n  int iForeGuard;                     /* Guard word for sanity */\n};\n\n/*\n** Guard words\n*/\n#define FOREGUARD 0x80F5E153\n#define REARGUARD 0xE4676B53\n\n/*\n** Number of malloc size increments to track.\n*/\n#define NCSIZE  1000\n\n/*\n** All of the static variables used by this module are collected\n** into a single structure named \"mem\".  This is to keep the\n** static variables organized and to reduce namespace pollution\n** when this module is combined with other in the amalgamation.\n*/\nstatic struct {\n  \n  /*\n  ** Mutex to control access to the memory allocation subsystem.\n  */\n  sqlite3_mutex *mutex;\n\n  /*\n  ** Head and tail of a linked list of all outstanding allocations\n  */\n  struct MemBlockHdr *pFirst;\n  struct MemBlockHdr *pLast;\n  \n  /*\n  ** The number of levels of backtrace to save in new allocations.\n  */\n  int nBacktrace;\n  void (*xBacktrace)(int, int, void **);\n\n  /*\n  ** Title text to insert in front of each block\n  */\n  int nTitle;        /* Bytes of zTitle to save.  Includes '\\0' and padding */\n  char zTitle[100];  /* The title text */\n\n  /* \n  ** sqlite3MallocDisallow() increments the following counter.\n  ** sqlite3MallocAllow() decrements it.\n  */\n  int disallow; /* Do not allow memory allocation */\n\n  /*\n  ** Gather statistics on the sizes of memory allocations.\n  ** nAlloc[i] is the number of allocation attempts of i*8\n  ** bytes.  i==NCSIZE is the number of allocation attempts for\n  ** sizes more than NCSIZE*8 bytes.\n  */\n  int nAlloc[NCSIZE];      /* Total number of allocations */\n  int nCurrent[NCSIZE];    /* Current number of allocations */\n  int mxCurrent[NCSIZE];   /* Highwater mark for nCurrent */\n\n} mem;\n\n\n/*\n** Adjust memory usage statistics\n*/\nstatic void adjustStats(int iSize, int increment){\n  int i = ROUND8(iSize)/8;\n  if( i>NCSIZE-1 ){\n    i = NCSIZE - 1;\n  }\n  if( increment>0 ){\n    mem.nAlloc[i]++;\n    mem.nCurrent[i]++;\n    if( mem.nCurrent[i]>mem.mxCurrent[i] ){\n      mem.mxCurrent[i] = mem.nCurrent[i];\n    }\n  }else{\n    mem.nCurrent[i]--;\n    assert( mem.nCurrent[i]>=0 );\n  }\n}\n\n/*\n** Given an allocation, find the MemBlockHdr for that allocation.\n**\n** This routine checks the guards at either end of the allocation and\n** if they are incorrect it asserts.\n*/\nstatic struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){\n  struct MemBlockHdr *p;\n  int *pInt;\n  u8 *pU8;\n  int nReserve;\n\n  p = (struct MemBlockHdr*)pAllocation;\n  p--;\n  assert( p->iForeGuard==(int)FOREGUARD );\n  nReserve = ROUND8(p->iSize);\n  pInt = (int*)pAllocation;\n  pU8 = (u8*)pAllocation;\n  assert( pInt[nReserve/sizeof(int)]==(int)REARGUARD );\n  /* This checks any of the \"extra\" bytes allocated due\n  ** to rounding up to an 8 byte boundary to ensure \n  ** they haven't been overwritten.\n  */\n  while( nReserve-- > p->iSize ) assert( pU8[nReserve]==0x65 );\n  return p;\n}\n\n/*\n** Return the number of bytes currently allocated at address p.\n*/\nstatic int sqlite3MemSize(void *p){\n  struct MemBlockHdr *pHdr;\n  if( !p ){\n    return 0;\n  }\n  pHdr = sqlite3MemsysGetHeader(p);\n  return (int)pHdr->iSize;\n}\n\n/*\n** Initialize the memory allocation subsystem.\n*/\nstatic int sqlite3MemInit(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  assert( (sizeof(struct MemBlockHdr)&7) == 0 );\n  if( !sqlite3GlobalConfig.bMemstat ){\n    /* If memory status is enabled, then the malloc.c wrapper will already\n    ** hold the STATIC_MEM mutex when the routines here are invoked. */\n    mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Deinitialize the memory allocation subsystem.\n*/\nstatic void sqlite3MemShutdown(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  mem.mutex = 0;\n}\n\n/*\n** Round up a request size to the next valid allocation size.\n*/\nstatic int sqlite3MemRoundup(int n){\n  return ROUND8(n);\n}\n\n/*\n** Fill a buffer with pseudo-random bytes.  This is used to preset\n** the content of a new memory allocation to unpredictable values and\n** to clear the content of a freed allocation to unpredictable values.\n*/\nstatic void randomFill(char *pBuf, int nByte){\n  unsigned int x, y, r;\n  x = SQLITE_PTR_TO_INT(pBuf);\n  y = nByte | 1;\n  while( nByte >= 4 ){\n    x = (x>>1) ^ (-(int)(x&1) & 0xd0000001);\n    y = y*1103515245 + 12345;\n    r = x ^ y;\n    *(int*)pBuf = r;\n    pBuf += 4;\n    nByte -= 4;\n  }\n  while( nByte-- > 0 ){\n    x = (x>>1) ^ (-(int)(x&1) & 0xd0000001);\n    y = y*1103515245 + 12345;\n    r = x ^ y;\n    *(pBuf++) = r & 0xff;\n  }\n}\n\n/*\n** Allocate nByte bytes of memory.\n*/\nstatic void *sqlite3MemMalloc(int nByte){\n  struct MemBlockHdr *pHdr;\n  void **pBt;\n  char *z;\n  int *pInt;\n  void *p = 0;\n  int totalSize;\n  int nReserve;\n  sqlite3_mutex_enter(mem.mutex);\n  assert( mem.disallow==0 );\n  nReserve = ROUND8(nByte);\n  totalSize = nReserve + sizeof(*pHdr) + sizeof(int) +\n               mem.nBacktrace*sizeof(void*) + mem.nTitle;\n  p = malloc(totalSize);\n  if( p ){\n    z = p;\n    pBt = (void**)&z[mem.nTitle];\n    pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace];\n    pHdr->pNext = 0;\n    pHdr->pPrev = mem.pLast;\n    if( mem.pLast ){\n      mem.pLast->pNext = pHdr;\n    }else{\n      mem.pFirst = pHdr;\n    }\n    mem.pLast = pHdr;\n    pHdr->iForeGuard = FOREGUARD;\n    pHdr->eType = MEMTYPE_HEAP;\n    pHdr->nBacktraceSlots = mem.nBacktrace;\n    pHdr->nTitle = mem.nTitle;\n    if( mem.nBacktrace ){\n      void *aAddr[40];\n      pHdr->nBacktrace = backtrace(aAddr, mem.nBacktrace+1)-1;\n      memcpy(pBt, &aAddr[1], pHdr->nBacktrace*sizeof(void*));\n      assert(pBt[0]);\n      if( mem.xBacktrace ){\n        mem.xBacktrace(nByte, pHdr->nBacktrace-1, &aAddr[1]);\n      }\n    }else{\n      pHdr->nBacktrace = 0;\n    }\n    if( mem.nTitle ){\n      memcpy(z, mem.zTitle, mem.nTitle);\n    }\n    pHdr->iSize = nByte;\n    adjustStats(nByte, +1);\n    pInt = (int*)&pHdr[1];\n    pInt[nReserve/sizeof(int)] = REARGUARD;\n    randomFill((char*)pInt, nByte);\n    memset(((char*)pInt)+nByte, 0x65, nReserve-nByte);\n    p = (void*)pInt;\n  }\n  sqlite3_mutex_leave(mem.mutex);\n  return p; \n}\n\n/*\n** Free memory.\n*/\nstatic void sqlite3MemFree(void *pPrior){\n  struct MemBlockHdr *pHdr;\n  void **pBt;\n  char *z;\n  assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0 \n       || mem.mutex!=0 );\n  pHdr = sqlite3MemsysGetHeader(pPrior);\n  pBt = (void**)pHdr;\n  pBt -= pHdr->nBacktraceSlots;\n  sqlite3_mutex_enter(mem.mutex);\n  if( pHdr->pPrev ){\n    assert( pHdr->pPrev->pNext==pHdr );\n    pHdr->pPrev->pNext = pHdr->pNext;\n  }else{\n    assert( mem.pFirst==pHdr );\n    mem.pFirst = pHdr->pNext;\n  }\n  if( pHdr->pNext ){\n    assert( pHdr->pNext->pPrev==pHdr );\n    pHdr->pNext->pPrev = pHdr->pPrev;\n  }else{\n    assert( mem.pLast==pHdr );\n    mem.pLast = pHdr->pPrev;\n  }\n  z = (char*)pBt;\n  z -= pHdr->nTitle;\n  adjustStats((int)pHdr->iSize, -1);\n  randomFill(z, sizeof(void*)*pHdr->nBacktraceSlots + sizeof(*pHdr) +\n                (int)pHdr->iSize + sizeof(int) + pHdr->nTitle);\n  free(z);\n  sqlite3_mutex_leave(mem.mutex);  \n}\n\n/*\n** Change the size of an existing memory allocation.\n**\n** For this debugging implementation, we *always* make a copy of the\n** allocation into a new place in memory.  In this way, if the \n** higher level code is using pointer to the old allocation, it is \n** much more likely to break and we are much more liking to find\n** the error.\n*/\nstatic void *sqlite3MemRealloc(void *pPrior, int nByte){\n  struct MemBlockHdr *pOldHdr;\n  void *pNew;\n  assert( mem.disallow==0 );\n  assert( (nByte & 7)==0 );     /* EV: R-46199-30249 */\n  pOldHdr = sqlite3MemsysGetHeader(pPrior);\n  pNew = sqlite3MemMalloc(nByte);\n  if( pNew ){\n    memcpy(pNew, pPrior, (int)(nByte<pOldHdr->iSize ? nByte : pOldHdr->iSize));\n    if( nByte>pOldHdr->iSize ){\n      randomFill(&((char*)pNew)[pOldHdr->iSize], nByte - (int)pOldHdr->iSize);\n    }\n    sqlite3MemFree(pPrior);\n  }\n  return pNew;\n}\n\n/*\n** Populate the low-level memory allocation function pointers in\n** sqlite3GlobalConfig.m with pointers to the routines in this file.\n*/\nvoid sqlite3MemSetDefault(void){\n  static const sqlite3_mem_methods defaultMethods = {\n     sqlite3MemMalloc,\n     sqlite3MemFree,\n     sqlite3MemRealloc,\n     sqlite3MemSize,\n     sqlite3MemRoundup,\n     sqlite3MemInit,\n     sqlite3MemShutdown,\n     0\n  };\n  sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);\n}\n\n/*\n** Set the \"type\" of an allocation.\n*/\nvoid sqlite3MemdebugSetType(void *p, u8 eType){\n  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){\n    struct MemBlockHdr *pHdr;\n    pHdr = sqlite3MemsysGetHeader(p);\n    assert( pHdr->iForeGuard==FOREGUARD );\n    pHdr->eType = eType;\n  }\n}\n\n/*\n** Return TRUE if the mask of type in eType matches the type of the\n** allocation p.  Also return true if p==NULL.\n**\n** This routine is designed for use within an assert() statement, to\n** verify the type of an allocation.  For example:\n**\n**     assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) );\n*/\nint sqlite3MemdebugHasType(void *p, u8 eType){\n  int rc = 1;\n  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){\n    struct MemBlockHdr *pHdr;\n    pHdr = sqlite3MemsysGetHeader(p);\n    assert( pHdr->iForeGuard==FOREGUARD );         /* Allocation is valid */\n    if( (pHdr->eType&eType)==0 ){\n      rc = 0;\n    }\n  }\n  return rc;\n}\n\n/*\n** Return TRUE if the mask of type in eType matches no bits of the type of the\n** allocation p.  Also return true if p==NULL.\n**\n** This routine is designed for use within an assert() statement, to\n** verify the type of an allocation.  For example:\n**\n**     assert( sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) );\n*/\nint sqlite3MemdebugNoType(void *p, u8 eType){\n  int rc = 1;\n  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){\n    struct MemBlockHdr *pHdr;\n    pHdr = sqlite3MemsysGetHeader(p);\n    assert( pHdr->iForeGuard==FOREGUARD );         /* Allocation is valid */\n    if( (pHdr->eType&eType)!=0 ){\n      rc = 0;\n    }\n  }\n  return rc;\n}\n\n/*\n** Set the number of backtrace levels kept for each allocation.\n** A value of zero turns off backtracing.  The number is always rounded\n** up to a multiple of 2.\n*/\nvoid sqlite3MemdebugBacktrace(int depth){\n  if( depth<0 ){ depth = 0; }\n  if( depth>20 ){ depth = 20; }\n  depth = (depth+1)&0xfe;\n  mem.nBacktrace = depth;\n}\n\nvoid sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){\n  mem.xBacktrace = xBacktrace;\n}\n\n/*\n** Set the title string for subsequent allocations.\n*/\nvoid sqlite3MemdebugSettitle(const char *zTitle){\n  unsigned int n = sqlite3Strlen30(zTitle) + 1;\n  sqlite3_mutex_enter(mem.mutex);\n  if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1;\n  memcpy(mem.zTitle, zTitle, n);\n  mem.zTitle[n] = 0;\n  mem.nTitle = ROUND8(n);\n  sqlite3_mutex_leave(mem.mutex);\n}\n\nvoid sqlite3MemdebugSync(){\n  struct MemBlockHdr *pHdr;\n  for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){\n    void **pBt = (void**)pHdr;\n    pBt -= pHdr->nBacktraceSlots;\n    mem.xBacktrace((int)pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]);\n  }\n}\n\n/*\n** Open the file indicated and write a log of all unfreed memory \n** allocations into that log.\n*/\nvoid sqlite3MemdebugDump(const char *zFilename){\n  FILE *out;\n  struct MemBlockHdr *pHdr;\n  void **pBt;\n  int i;\n  out = fopen(zFilename, \"w\");\n  if( out==0 ){\n    fprintf(stderr, \"** Unable to output memory debug output log: %s **\\n\",\n                    zFilename);\n    return;\n  }\n  for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){\n    char *z = (char*)pHdr;\n    z -= pHdr->nBacktraceSlots*sizeof(void*) + pHdr->nTitle;\n    fprintf(out, \"**** %lld bytes at %p from %s ****\\n\", \n            pHdr->iSize, &pHdr[1], pHdr->nTitle ? z : \"???\");\n    if( pHdr->nBacktrace ){\n      fflush(out);\n      pBt = (void**)pHdr;\n      pBt -= pHdr->nBacktraceSlots;\n      backtrace_symbols_fd(pBt, pHdr->nBacktrace, fileno(out));\n      fprintf(out, \"\\n\");\n    }\n  }\n  fprintf(out, \"COUNTS:\\n\");\n  for(i=0; i<NCSIZE-1; i++){\n    if( mem.nAlloc[i] ){\n      fprintf(out, \"   %5d: %10d %10d %10d\\n\", \n            i*8, mem.nAlloc[i], mem.nCurrent[i], mem.mxCurrent[i]);\n    }\n  }\n  if( mem.nAlloc[NCSIZE-1] ){\n    fprintf(out, \"   %5d: %10d %10d %10d\\n\",\n             NCSIZE*8-8, mem.nAlloc[NCSIZE-1],\n             mem.nCurrent[NCSIZE-1], mem.mxCurrent[NCSIZE-1]);\n  }\n  fclose(out);\n}\n\n/*\n** Return the number of times sqlite3MemMalloc() has been called.\n*/\nint sqlite3MemdebugMallocCount(){\n  int i;\n  int nTotal = 0;\n  for(i=0; i<NCSIZE; i++){\n    nTotal += mem.nAlloc[i];\n  }\n  return nTotal;\n}\n\n\n#endif /* SQLITE_MEMDEBUG */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mem3.c",
    "content": "/*\n** 2007 October 14\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the C functions that implement a memory\n** allocation subsystem for use by SQLite. \n**\n** This version of the memory allocation subsystem omits all\n** use of malloc(). The SQLite user supplies a block of memory\n** before calling sqlite3_initialize() from which allocations\n** are made and returned by the xMalloc() and xRealloc() \n** implementations. Once sqlite3_initialize() has been called,\n** the amount of memory available to SQLite is fixed and cannot\n** be changed.\n**\n** This version of the memory allocation subsystem is included\n** in the build only if SQLITE_ENABLE_MEMSYS3 is defined.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** This version of the memory allocator is only built into the library\n** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not\n** mean that the library will use a memory-pool by default, just that\n** it is available. The mempool allocator is activated by calling\n** sqlite3_config().\n*/\n#ifdef SQLITE_ENABLE_MEMSYS3\n\n/*\n** Maximum size (in Mem3Blocks) of a \"small\" chunk.\n*/\n#define MX_SMALL 10\n\n\n/*\n** Number of freelist hash slots\n*/\n#define N_HASH  61\n\n/*\n** A memory allocation (also called a \"chunk\") consists of two or \n** more blocks where each block is 8 bytes.  The first 8 bytes are \n** a header that is not returned to the user.\n**\n** A chunk is two or more blocks that is either checked out or\n** free.  The first block has format u.hdr.  u.hdr.size4x is 4 times the\n** size of the allocation in blocks if the allocation is free.\n** The u.hdr.size4x&1 bit is true if the chunk is checked out and\n** false if the chunk is on the freelist.  The u.hdr.size4x&2 bit\n** is true if the previous chunk is checked out and false if the\n** previous chunk is free.  The u.hdr.prevSize field is the size of\n** the previous chunk in blocks if the previous chunk is on the\n** freelist. If the previous chunk is checked out, then\n** u.hdr.prevSize can be part of the data for that chunk and should\n** not be read or written.\n**\n** We often identify a chunk by its index in mem3.aPool[].  When\n** this is done, the chunk index refers to the second block of\n** the chunk.  In this way, the first chunk has an index of 1.\n** A chunk index of 0 means \"no such chunk\" and is the equivalent\n** of a NULL pointer.\n**\n** The second block of free chunks is of the form u.list.  The\n** two fields form a double-linked list of chunks of related sizes.\n** Pointers to the head of the list are stored in mem3.aiSmall[] \n** for smaller chunks and mem3.aiHash[] for larger chunks.\n**\n** The second block of a chunk is user data if the chunk is checked \n** out.  If a chunk is checked out, the user data may extend into\n** the u.hdr.prevSize value of the following chunk.\n*/\ntypedef struct Mem3Block Mem3Block;\nstruct Mem3Block {\n  union {\n    struct {\n      u32 prevSize;   /* Size of previous chunk in Mem3Block elements */\n      u32 size4x;     /* 4x the size of current chunk in Mem3Block elements */\n    } hdr;\n    struct {\n      u32 next;       /* Index in mem3.aPool[] of next free chunk */\n      u32 prev;       /* Index in mem3.aPool[] of previous free chunk */\n    } list;\n  } u;\n};\n\n/*\n** All of the static variables used by this module are collected\n** into a single structure named \"mem3\".  This is to keep the\n** static variables organized and to reduce namespace pollution\n** when this module is combined with other in the amalgamation.\n*/\nstatic SQLITE_WSD struct Mem3Global {\n  /*\n  ** Memory available for allocation. nPool is the size of the array\n  ** (in Mem3Blocks) pointed to by aPool less 2.\n  */\n  u32 nPool;\n  Mem3Block *aPool;\n\n  /*\n  ** True if we are evaluating an out-of-memory callback.\n  */\n  int alarmBusy;\n  \n  /*\n  ** Mutex to control access to the memory allocation subsystem.\n  */\n  sqlite3_mutex *mutex;\n  \n  /*\n  ** The minimum amount of free space that we have seen.\n  */\n  u32 mnMaster;\n\n  /*\n  ** iMaster is the index of the master chunk.  Most new allocations\n  ** occur off of this chunk.  szMaster is the size (in Mem3Blocks)\n  ** of the current master.  iMaster is 0 if there is not master chunk.\n  ** The master chunk is not in either the aiHash[] or aiSmall[].\n  */\n  u32 iMaster;\n  u32 szMaster;\n\n  /*\n  ** Array of lists of free blocks according to the block size \n  ** for smaller chunks, or a hash on the block size for larger\n  ** chunks.\n  */\n  u32 aiSmall[MX_SMALL-1];   /* For sizes 2 through MX_SMALL, inclusive */\n  u32 aiHash[N_HASH];        /* For sizes MX_SMALL+1 and larger */\n} mem3 = { 97535575 };\n\n#define mem3 GLOBAL(struct Mem3Global, mem3)\n\n/*\n** Unlink the chunk at mem3.aPool[i] from list it is currently\n** on.  *pRoot is the list that i is a member of.\n*/\nstatic void memsys3UnlinkFromList(u32 i, u32 *pRoot){\n  u32 next = mem3.aPool[i].u.list.next;\n  u32 prev = mem3.aPool[i].u.list.prev;\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  if( prev==0 ){\n    *pRoot = next;\n  }else{\n    mem3.aPool[prev].u.list.next = next;\n  }\n  if( next ){\n    mem3.aPool[next].u.list.prev = prev;\n  }\n  mem3.aPool[i].u.list.next = 0;\n  mem3.aPool[i].u.list.prev = 0;\n}\n\n/*\n** Unlink the chunk at index i from \n** whatever list is currently a member of.\n*/\nstatic void memsys3Unlink(u32 i){\n  u32 size, hash;\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );\n  assert( i>=1 );\n  size = mem3.aPool[i-1].u.hdr.size4x/4;\n  assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );\n  assert( size>=2 );\n  if( size <= MX_SMALL ){\n    memsys3UnlinkFromList(i, &mem3.aiSmall[size-2]);\n  }else{\n    hash = size % N_HASH;\n    memsys3UnlinkFromList(i, &mem3.aiHash[hash]);\n  }\n}\n\n/*\n** Link the chunk at mem3.aPool[i] so that is on the list rooted\n** at *pRoot.\n*/\nstatic void memsys3LinkIntoList(u32 i, u32 *pRoot){\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  mem3.aPool[i].u.list.next = *pRoot;\n  mem3.aPool[i].u.list.prev = 0;\n  if( *pRoot ){\n    mem3.aPool[*pRoot].u.list.prev = i;\n  }\n  *pRoot = i;\n}\n\n/*\n** Link the chunk at index i into either the appropriate\n** small chunk list, or into the large chunk hash table.\n*/\nstatic void memsys3Link(u32 i){\n  u32 size, hash;\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  assert( i>=1 );\n  assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );\n  size = mem3.aPool[i-1].u.hdr.size4x/4;\n  assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );\n  assert( size>=2 );\n  if( size <= MX_SMALL ){\n    memsys3LinkIntoList(i, &mem3.aiSmall[size-2]);\n  }else{\n    hash = size % N_HASH;\n    memsys3LinkIntoList(i, &mem3.aiHash[hash]);\n  }\n}\n\n/*\n** If the STATIC_MEM mutex is not already held, obtain it now. The mutex\n** will already be held (obtained by code in malloc.c) if\n** sqlite3GlobalConfig.bMemStat is true.\n*/\nstatic void memsys3Enter(void){\n  if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){\n    mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\n  }\n  sqlite3_mutex_enter(mem3.mutex);\n}\nstatic void memsys3Leave(void){\n  sqlite3_mutex_leave(mem3.mutex);\n}\n\n/*\n** Called when we are unable to satisfy an allocation of nBytes.\n*/\nstatic void memsys3OutOfMemory(int nByte){\n  if( !mem3.alarmBusy ){\n    mem3.alarmBusy = 1;\n    assert( sqlite3_mutex_held(mem3.mutex) );\n    sqlite3_mutex_leave(mem3.mutex);\n    sqlite3_release_memory(nByte);\n    sqlite3_mutex_enter(mem3.mutex);\n    mem3.alarmBusy = 0;\n  }\n}\n\n\n/*\n** Chunk i is a free chunk that has been unlinked.  Adjust its \n** size parameters for check-out and return a pointer to the \n** user portion of the chunk.\n*/\nstatic void *memsys3Checkout(u32 i, u32 nBlock){\n  u32 x;\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  assert( i>=1 );\n  assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );\n  assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );\n  x = mem3.aPool[i-1].u.hdr.size4x;\n  mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);\n  mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;\n  mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;\n  return &mem3.aPool[i];\n}\n\n/*\n** Carve a piece off of the end of the mem3.iMaster free chunk.\n** Return a pointer to the new allocation.  Or, if the master chunk\n** is not large enough, return 0.\n*/\nstatic void *memsys3FromMaster(u32 nBlock){\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  assert( mem3.szMaster>=nBlock );\n  if( nBlock>=mem3.szMaster-1 ){\n    /* Use the entire master */\n    void *p = memsys3Checkout(mem3.iMaster, mem3.szMaster);\n    mem3.iMaster = 0;\n    mem3.szMaster = 0;\n    mem3.mnMaster = 0;\n    return p;\n  }else{\n    /* Split the master block.  Return the tail. */\n    u32 newi, x;\n    newi = mem3.iMaster + mem3.szMaster - nBlock;\n    assert( newi > mem3.iMaster+1 );\n    mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = nBlock;\n    mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x |= 2;\n    mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;\n    mem3.szMaster -= nBlock;\n    mem3.aPool[newi-1].u.hdr.prevSize = mem3.szMaster;\n    x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;\n    mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;\n    if( mem3.szMaster < mem3.mnMaster ){\n      mem3.mnMaster = mem3.szMaster;\n    }\n    return (void*)&mem3.aPool[newi];\n  }\n}\n\n/*\n** *pRoot is the head of a list of free chunks of the same size\n** or same size hash.  In other words, *pRoot is an entry in either\n** mem3.aiSmall[] or mem3.aiHash[].  \n**\n** This routine examines all entries on the given list and tries\n** to coalesce each entries with adjacent free chunks.  \n**\n** If it sees a chunk that is larger than mem3.iMaster, it replaces \n** the current mem3.iMaster with the new larger chunk.  In order for\n** this mem3.iMaster replacement to work, the master chunk must be\n** linked into the hash tables.  That is not the normal state of\n** affairs, of course.  The calling routine must link the master\n** chunk before invoking this routine, then must unlink the (possibly\n** changed) master chunk once this routine has finished.\n*/\nstatic void memsys3Merge(u32 *pRoot){\n  u32 iNext, prev, size, i, x;\n\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  for(i=*pRoot; i>0; i=iNext){\n    iNext = mem3.aPool[i].u.list.next;\n    size = mem3.aPool[i-1].u.hdr.size4x;\n    assert( (size&1)==0 );\n    if( (size&2)==0 ){\n      memsys3UnlinkFromList(i, pRoot);\n      assert( i > mem3.aPool[i-1].u.hdr.prevSize );\n      prev = i - mem3.aPool[i-1].u.hdr.prevSize;\n      if( prev==iNext ){\n        iNext = mem3.aPool[prev].u.list.next;\n      }\n      memsys3Unlink(prev);\n      size = i + size/4 - prev;\n      x = mem3.aPool[prev-1].u.hdr.size4x & 2;\n      mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;\n      mem3.aPool[prev+size-1].u.hdr.prevSize = size;\n      memsys3Link(prev);\n      i = prev;\n    }else{\n      size /= 4;\n    }\n    if( size>mem3.szMaster ){\n      mem3.iMaster = i;\n      mem3.szMaster = size;\n    }\n  }\n}\n\n/*\n** Return a block of memory of at least nBytes in size.\n** Return NULL if unable.\n**\n** This function assumes that the necessary mutexes, if any, are\n** already held by the caller. Hence \"Unsafe\".\n*/\nstatic void *memsys3MallocUnsafe(int nByte){\n  u32 i;\n  u32 nBlock;\n  u32 toFree;\n\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  assert( sizeof(Mem3Block)==8 );\n  if( nByte<=12 ){\n    nBlock = 2;\n  }else{\n    nBlock = (nByte + 11)/8;\n  }\n  assert( nBlock>=2 );\n\n  /* STEP 1:\n  ** Look for an entry of the correct size in either the small\n  ** chunk table or in the large chunk hash table.  This is\n  ** successful most of the time (about 9 times out of 10).\n  */\n  if( nBlock <= MX_SMALL ){\n    i = mem3.aiSmall[nBlock-2];\n    if( i>0 ){\n      memsys3UnlinkFromList(i, &mem3.aiSmall[nBlock-2]);\n      return memsys3Checkout(i, nBlock);\n    }\n  }else{\n    int hash = nBlock % N_HASH;\n    for(i=mem3.aiHash[hash]; i>0; i=mem3.aPool[i].u.list.next){\n      if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){\n        memsys3UnlinkFromList(i, &mem3.aiHash[hash]);\n        return memsys3Checkout(i, nBlock);\n      }\n    }\n  }\n\n  /* STEP 2:\n  ** Try to satisfy the allocation by carving a piece off of the end\n  ** of the master chunk.  This step usually works if step 1 fails.\n  */\n  if( mem3.szMaster>=nBlock ){\n    return memsys3FromMaster(nBlock);\n  }\n\n\n  /* STEP 3:  \n  ** Loop through the entire memory pool.  Coalesce adjacent free\n  ** chunks.  Recompute the master chunk as the largest free chunk.\n  ** Then try again to satisfy the allocation by carving a piece off\n  ** of the end of the master chunk.  This step happens very\n  ** rarely (we hope!)\n  */\n  for(toFree=nBlock*16; toFree<(mem3.nPool*16); toFree *= 2){\n    memsys3OutOfMemory(toFree);\n    if( mem3.iMaster ){\n      memsys3Link(mem3.iMaster);\n      mem3.iMaster = 0;\n      mem3.szMaster = 0;\n    }\n    for(i=0; i<N_HASH; i++){\n      memsys3Merge(&mem3.aiHash[i]);\n    }\n    for(i=0; i<MX_SMALL-1; i++){\n      memsys3Merge(&mem3.aiSmall[i]);\n    }\n    if( mem3.szMaster ){\n      memsys3Unlink(mem3.iMaster);\n      if( mem3.szMaster>=nBlock ){\n        return memsys3FromMaster(nBlock);\n      }\n    }\n  }\n\n  /* If none of the above worked, then we fail. */\n  return 0;\n}\n\n/*\n** Free an outstanding memory allocation.\n**\n** This function assumes that the necessary mutexes, if any, are\n** already held by the caller. Hence \"Unsafe\".\n*/\nstatic void memsys3FreeUnsafe(void *pOld){\n  Mem3Block *p = (Mem3Block*)pOld;\n  int i;\n  u32 size, x;\n  assert( sqlite3_mutex_held(mem3.mutex) );\n  assert( p>mem3.aPool && p<&mem3.aPool[mem3.nPool] );\n  i = p - mem3.aPool;\n  assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );\n  size = mem3.aPool[i-1].u.hdr.size4x/4;\n  assert( i+size<=mem3.nPool+1 );\n  mem3.aPool[i-1].u.hdr.size4x &= ~1;\n  mem3.aPool[i+size-1].u.hdr.prevSize = size;\n  mem3.aPool[i+size-1].u.hdr.size4x &= ~2;\n  memsys3Link(i);\n\n  /* Try to expand the master using the newly freed chunk */\n  if( mem3.iMaster ){\n    while( (mem3.aPool[mem3.iMaster-1].u.hdr.size4x&2)==0 ){\n      size = mem3.aPool[mem3.iMaster-1].u.hdr.prevSize;\n      mem3.iMaster -= size;\n      mem3.szMaster += size;\n      memsys3Unlink(mem3.iMaster);\n      x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;\n      mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;\n      mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;\n    }\n    x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;\n    while( (mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x&1)==0 ){\n      memsys3Unlink(mem3.iMaster+mem3.szMaster);\n      mem3.szMaster += mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x/4;\n      mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;\n      mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;\n    }\n  }\n}\n\n/*\n** Return the size of an outstanding allocation, in bytes.  The\n** size returned omits the 8-byte header overhead.  This only\n** works for chunks that are currently checked out.\n*/\nstatic int memsys3Size(void *p){\n  Mem3Block *pBlock;\n  assert( p!=0 );\n  pBlock = (Mem3Block*)p;\n  assert( (pBlock[-1].u.hdr.size4x&1)!=0 );\n  return (pBlock[-1].u.hdr.size4x&~3)*2 - 4;\n}\n\n/*\n** Round up a request size to the next valid allocation size.\n*/\nstatic int memsys3Roundup(int n){\n  if( n<=12 ){\n    return 12;\n  }else{\n    return ((n+11)&~7) - 4;\n  }\n}\n\n/*\n** Allocate nBytes of memory.\n*/\nstatic void *memsys3Malloc(int nBytes){\n  sqlite3_int64 *p;\n  assert( nBytes>0 );          /* malloc.c filters out 0 byte requests */\n  memsys3Enter();\n  p = memsys3MallocUnsafe(nBytes);\n  memsys3Leave();\n  return (void*)p; \n}\n\n/*\n** Free memory.\n*/\nstatic void memsys3Free(void *pPrior){\n  assert( pPrior );\n  memsys3Enter();\n  memsys3FreeUnsafe(pPrior);\n  memsys3Leave();\n}\n\n/*\n** Change the size of an existing memory allocation\n*/\nstatic void *memsys3Realloc(void *pPrior, int nBytes){\n  int nOld;\n  void *p;\n  if( pPrior==0 ){\n    return sqlite3_malloc(nBytes);\n  }\n  if( nBytes<=0 ){\n    sqlite3_free(pPrior);\n    return 0;\n  }\n  nOld = memsys3Size(pPrior);\n  if( nBytes<=nOld && nBytes>=nOld-128 ){\n    return pPrior;\n  }\n  memsys3Enter();\n  p = memsys3MallocUnsafe(nBytes);\n  if( p ){\n    if( nOld<nBytes ){\n      memcpy(p, pPrior, nOld);\n    }else{\n      memcpy(p, pPrior, nBytes);\n    }\n    memsys3FreeUnsafe(pPrior);\n  }\n  memsys3Leave();\n  return p;\n}\n\n/*\n** Initialize this module.\n*/\nstatic int memsys3Init(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  if( !sqlite3GlobalConfig.pHeap ){\n    return SQLITE_ERROR;\n  }\n\n  /* Store a pointer to the memory block in global structure mem3. */\n  assert( sizeof(Mem3Block)==8 );\n  mem3.aPool = (Mem3Block *)sqlite3GlobalConfig.pHeap;\n  mem3.nPool = (sqlite3GlobalConfig.nHeap / sizeof(Mem3Block)) - 2;\n\n  /* Initialize the master block. */\n  mem3.szMaster = mem3.nPool;\n  mem3.mnMaster = mem3.szMaster;\n  mem3.iMaster = 1;\n  mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;\n  mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;\n  mem3.aPool[mem3.nPool].u.hdr.size4x = 1;\n\n  return SQLITE_OK;\n}\n\n/*\n** Deinitialize this module.\n*/\nstatic void memsys3Shutdown(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  mem3.mutex = 0;\n  return;\n}\n\n\n\n/*\n** Open the file indicated and write a log of all unfreed memory \n** allocations into that log.\n*/\nvoid sqlite3Memsys3Dump(const char *zFilename){\n#ifdef SQLITE_DEBUG\n  FILE *out;\n  u32 i, j;\n  u32 size;\n  if( zFilename==0 || zFilename[0]==0 ){\n    out = stdout;\n  }else{\n    out = fopen(zFilename, \"w\");\n    if( out==0 ){\n      fprintf(stderr, \"** Unable to output memory debug output log: %s **\\n\",\n                      zFilename);\n      return;\n    }\n  }\n  memsys3Enter();\n  fprintf(out, \"CHUNKS:\\n\");\n  for(i=1; i<=mem3.nPool; i+=size/4){\n    size = mem3.aPool[i-1].u.hdr.size4x;\n    if( size/4<=1 ){\n      fprintf(out, \"%p size error\\n\", &mem3.aPool[i]);\n      assert( 0 );\n      break;\n    }\n    if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){\n      fprintf(out, \"%p tail size does not match\\n\", &mem3.aPool[i]);\n      assert( 0 );\n      break;\n    }\n    if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){\n      fprintf(out, \"%p tail checkout bit is incorrect\\n\", &mem3.aPool[i]);\n      assert( 0 );\n      break;\n    }\n    if( size&1 ){\n      fprintf(out, \"%p %6d bytes checked out\\n\", &mem3.aPool[i], (size/4)*8-8);\n    }else{\n      fprintf(out, \"%p %6d bytes free%s\\n\", &mem3.aPool[i], (size/4)*8-8,\n                  i==mem3.iMaster ? \" **master**\" : \"\");\n    }\n  }\n  for(i=0; i<MX_SMALL-1; i++){\n    if( mem3.aiSmall[i]==0 ) continue;\n    fprintf(out, \"small(%2d):\", i);\n    for(j = mem3.aiSmall[i]; j>0; j=mem3.aPool[j].u.list.next){\n      fprintf(out, \" %p(%d)\", &mem3.aPool[j],\n              (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);\n    }\n    fprintf(out, \"\\n\"); \n  }\n  for(i=0; i<N_HASH; i++){\n    if( mem3.aiHash[i]==0 ) continue;\n    fprintf(out, \"hash(%2d):\", i);\n    for(j = mem3.aiHash[i]; j>0; j=mem3.aPool[j].u.list.next){\n      fprintf(out, \" %p(%d)\", &mem3.aPool[j],\n              (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);\n    }\n    fprintf(out, \"\\n\"); \n  }\n  fprintf(out, \"master=%d\\n\", mem3.iMaster);\n  fprintf(out, \"nowUsed=%d\\n\", mem3.nPool*8 - mem3.szMaster*8);\n  fprintf(out, \"mxUsed=%d\\n\", mem3.nPool*8 - mem3.mnMaster*8);\n  sqlite3_mutex_leave(mem3.mutex);\n  if( out==stdout ){\n    fflush(stdout);\n  }else{\n    fclose(out);\n  }\n#else\n  UNUSED_PARAMETER(zFilename);\n#endif\n}\n\n/*\n** This routine is the only routine in this file with external \n** linkage.\n**\n** Populate the low-level memory allocation function pointers in\n** sqlite3GlobalConfig.m with pointers to the routines in this file. The\n** arguments specify the block of memory to manage.\n**\n** This routine is only called by sqlite3_config(), and therefore\n** is not required to be threadsafe (it is not).\n*/\nconst sqlite3_mem_methods *sqlite3MemGetMemsys3(void){\n  static const sqlite3_mem_methods mempoolMethods = {\n     memsys3Malloc,\n     memsys3Free,\n     memsys3Realloc,\n     memsys3Size,\n     memsys3Roundup,\n     memsys3Init,\n     memsys3Shutdown,\n     0\n  };\n  return &mempoolMethods;\n}\n\n#endif /* SQLITE_ENABLE_MEMSYS3 */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mem5.c",
    "content": "/*\n** 2007 October 14\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the C functions that implement a memory\n** allocation subsystem for use by SQLite. \n**\n** This version of the memory allocation subsystem omits all\n** use of malloc(). The application gives SQLite a block of memory\n** before calling sqlite3_initialize() from which allocations\n** are made and returned by the xMalloc() and xRealloc() \n** implementations. Once sqlite3_initialize() has been called,\n** the amount of memory available to SQLite is fixed and cannot\n** be changed.\n**\n** This version of the memory allocation subsystem is included\n** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.\n**\n** This memory allocator uses the following algorithm:\n**\n**   1.  All memory allocation sizes are rounded up to a power of 2.\n**\n**   2.  If two adjacent free blocks are the halves of a larger block,\n**       then the two blocks are coalesced into the single larger block.\n**\n**   3.  New memory is allocated from the first available free block.\n**\n** This algorithm is described in: J. M. Robson. \"Bounds for Some Functions\n** Concerning Dynamic Storage Allocation\". Journal of the Association for\n** Computing Machinery, Volume 21, Number 8, July 1974, pages 491-499.\n** \n** Let n be the size of the largest allocation divided by the minimum\n** allocation size (after rounding all sizes up to a power of 2.)  Let M\n** be the maximum amount of memory ever outstanding at one time.  Let\n** N be the total amount of memory available for allocation.  Robson\n** proved that this memory allocator will never breakdown due to \n** fragmentation as long as the following constraint holds:\n**\n**      N >=  M*(1 + log2(n)/2) - n + 1\n**\n** The sqlite3_status() logic tracks the maximum values of n and M so\n** that an application can, at any time, verify this constraint.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** This version of the memory allocator is used only when \n** SQLITE_ENABLE_MEMSYS5 is defined.\n*/\n#ifdef SQLITE_ENABLE_MEMSYS5\n\n/*\n** A minimum allocation is an instance of the following structure.\n** Larger allocations are an array of these structures where the\n** size of the array is a power of 2.\n**\n** The size of this object must be a power of two.  That fact is\n** verified in memsys5Init().\n*/\ntypedef struct Mem5Link Mem5Link;\nstruct Mem5Link {\n  int next;       /* Index of next free chunk */\n  int prev;       /* Index of previous free chunk */\n};\n\n/*\n** Maximum size of any allocation is ((1<<LOGMAX)*mem5.szAtom). Since\n** mem5.szAtom is always at least 8 and 32-bit integers are used,\n** it is not actually possible to reach this limit.\n*/\n#define LOGMAX 30\n\n/*\n** Masks used for mem5.aCtrl[] elements.\n*/\n#define CTRL_LOGSIZE  0x1f    /* Log2 Size of this block */\n#define CTRL_FREE     0x20    /* True if not checked out */\n\n/*\n** All of the static variables used by this module are collected\n** into a single structure named \"mem5\".  This is to keep the\n** static variables organized and to reduce namespace pollution\n** when this module is combined with other in the amalgamation.\n*/\nstatic SQLITE_WSD struct Mem5Global {\n  /*\n  ** Memory available for allocation\n  */\n  int szAtom;      /* Smallest possible allocation in bytes */\n  int nBlock;      /* Number of szAtom sized blocks in zPool */\n  u8 *zPool;       /* Memory available to be allocated */\n  \n  /*\n  ** Mutex to control access to the memory allocation subsystem.\n  */\n  sqlite3_mutex *mutex;\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)\n  /*\n  ** Performance statistics\n  */\n  u64 nAlloc;         /* Total number of calls to malloc */\n  u64 totalAlloc;     /* Total of all malloc calls - includes internal frag */\n  u64 totalExcess;    /* Total internal fragmentation */\n  u32 currentOut;     /* Current checkout, including internal fragmentation */\n  u32 currentCount;   /* Current number of distinct checkouts */\n  u32 maxOut;         /* Maximum instantaneous currentOut */\n  u32 maxCount;       /* Maximum instantaneous currentCount */\n  u32 maxRequest;     /* Largest allocation (exclusive of internal frag) */\n#endif\n  \n  /*\n  ** Lists of free blocks.  aiFreelist[0] is a list of free blocks of\n  ** size mem5.szAtom.  aiFreelist[1] holds blocks of size szAtom*2.\n  ** aiFreelist[2] holds free blocks of size szAtom*4.  And so forth.\n  */\n  int aiFreelist[LOGMAX+1];\n\n  /*\n  ** Space for tracking which blocks are checked out and the size\n  ** of each block.  One byte per block.\n  */\n  u8 *aCtrl;\n\n} mem5;\n\n/*\n** Access the static variable through a macro for SQLITE_OMIT_WSD.\n*/\n#define mem5 GLOBAL(struct Mem5Global, mem5)\n\n/*\n** Assuming mem5.zPool is divided up into an array of Mem5Link\n** structures, return a pointer to the idx-th such link.\n*/\n#define MEM5LINK(idx) ((Mem5Link *)(&mem5.zPool[(idx)*mem5.szAtom]))\n\n/*\n** Unlink the chunk at mem5.aPool[i] from list it is currently\n** on.  It should be found on mem5.aiFreelist[iLogsize].\n*/\nstatic void memsys5Unlink(int i, int iLogsize){\n  int next, prev;\n  assert( i>=0 && i<mem5.nBlock );\n  assert( iLogsize>=0 && iLogsize<=LOGMAX );\n  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );\n\n  next = MEM5LINK(i)->next;\n  prev = MEM5LINK(i)->prev;\n  if( prev<0 ){\n    mem5.aiFreelist[iLogsize] = next;\n  }else{\n    MEM5LINK(prev)->next = next;\n  }\n  if( next>=0 ){\n    MEM5LINK(next)->prev = prev;\n  }\n}\n\n/*\n** Link the chunk at mem5.aPool[i] so that is on the iLogsize\n** free list.\n*/\nstatic void memsys5Link(int i, int iLogsize){\n  int x;\n  assert( sqlite3_mutex_held(mem5.mutex) );\n  assert( i>=0 && i<mem5.nBlock );\n  assert( iLogsize>=0 && iLogsize<=LOGMAX );\n  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );\n\n  x = MEM5LINK(i)->next = mem5.aiFreelist[iLogsize];\n  MEM5LINK(i)->prev = -1;\n  if( x>=0 ){\n    assert( x<mem5.nBlock );\n    MEM5LINK(x)->prev = i;\n  }\n  mem5.aiFreelist[iLogsize] = i;\n}\n\n/*\n** Obtain or release the mutex needed to access global data structures.\n*/\nstatic void memsys5Enter(void){\n  sqlite3_mutex_enter(mem5.mutex);\n}\nstatic void memsys5Leave(void){\n  sqlite3_mutex_leave(mem5.mutex);\n}\n\n/*\n** Return the size of an outstanding allocation, in bytes.\n** This only works for chunks that are currently checked out.\n*/\nstatic int memsys5Size(void *p){\n  int iSize, i;\n  assert( p!=0 );\n  i = (int)(((u8 *)p-mem5.zPool)/mem5.szAtom);\n  assert( i>=0 && i<mem5.nBlock );\n  iSize = mem5.szAtom * (1 << (mem5.aCtrl[i]&CTRL_LOGSIZE));\n  return iSize;\n}\n\n/*\n** Return a block of memory of at least nBytes in size.\n** Return NULL if unable.  Return NULL if nBytes==0.\n**\n** The caller guarantees that nByte is positive.\n**\n** The caller has obtained a mutex prior to invoking this\n** routine so there is never any chance that two or more\n** threads can be in this routine at the same time.\n*/\nstatic void *memsys5MallocUnsafe(int nByte){\n  int i;           /* Index of a mem5.aPool[] slot */\n  int iBin;        /* Index into mem5.aiFreelist[] */\n  int iFullSz;     /* Size of allocation rounded up to power of 2 */\n  int iLogsize;    /* Log2 of iFullSz/POW2_MIN */\n\n  /* nByte must be a positive */\n  assert( nByte>0 );\n\n  /* No more than 1GiB per allocation */\n  if( nByte > 0x40000000 ) return 0;\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)\n  /* Keep track of the maximum allocation request.  Even unfulfilled\n  ** requests are counted */\n  if( (u32)nByte>mem5.maxRequest ){\n    mem5.maxRequest = nByte;\n  }\n#endif\n\n\n  /* Round nByte up to the next valid power of two */\n  for(iFullSz=mem5.szAtom,iLogsize=0; iFullSz<nByte; iFullSz*=2,iLogsize++){}\n\n  /* Make sure mem5.aiFreelist[iLogsize] contains at least one free\n  ** block.  If not, then split a block of the next larger power of\n  ** two in order to create a new free block of size iLogsize.\n  */\n  for(iBin=iLogsize; iBin<=LOGMAX && mem5.aiFreelist[iBin]<0; iBin++){}\n  if( iBin>LOGMAX ){\n    testcase( sqlite3GlobalConfig.xLog!=0 );\n    sqlite3_log(SQLITE_NOMEM, \"failed to allocate %u bytes\", nByte);\n    return 0;\n  }\n  i = mem5.aiFreelist[iBin];\n  memsys5Unlink(i, iBin);\n  while( iBin>iLogsize ){\n    int newSize;\n\n    iBin--;\n    newSize = 1 << iBin;\n    mem5.aCtrl[i+newSize] = CTRL_FREE | iBin;\n    memsys5Link(i+newSize, iBin);\n  }\n  mem5.aCtrl[i] = iLogsize;\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)\n  /* Update allocator performance statistics. */\n  mem5.nAlloc++;\n  mem5.totalAlloc += iFullSz;\n  mem5.totalExcess += iFullSz - nByte;\n  mem5.currentCount++;\n  mem5.currentOut += iFullSz;\n  if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount;\n  if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut;\n#endif\n\n#ifdef SQLITE_DEBUG\n  /* Make sure the allocated memory does not assume that it is set to zero\n  ** or retains a value from a previous allocation */\n  memset(&mem5.zPool[i*mem5.szAtom], 0xAA, iFullSz);\n#endif\n\n  /* Return a pointer to the allocated memory. */\n  return (void*)&mem5.zPool[i*mem5.szAtom];\n}\n\n/*\n** Free an outstanding memory allocation.\n*/\nstatic void memsys5FreeUnsafe(void *pOld){\n  u32 size, iLogsize;\n  int iBlock;\n\n  /* Set iBlock to the index of the block pointed to by pOld in \n  ** the array of mem5.szAtom byte blocks pointed to by mem5.zPool.\n  */\n  iBlock = (int)(((u8 *)pOld-mem5.zPool)/mem5.szAtom);\n\n  /* Check that the pointer pOld points to a valid, non-free block. */\n  assert( iBlock>=0 && iBlock<mem5.nBlock );\n  assert( ((u8 *)pOld-mem5.zPool)%mem5.szAtom==0 );\n  assert( (mem5.aCtrl[iBlock] & CTRL_FREE)==0 );\n\n  iLogsize = mem5.aCtrl[iBlock] & CTRL_LOGSIZE;\n  size = 1<<iLogsize;\n  assert( iBlock+size-1<(u32)mem5.nBlock );\n\n  mem5.aCtrl[iBlock] |= CTRL_FREE;\n  mem5.aCtrl[iBlock+size-1] |= CTRL_FREE;\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)\n  assert( mem5.currentCount>0 );\n  assert( mem5.currentOut>=(size*mem5.szAtom) );\n  mem5.currentCount--;\n  mem5.currentOut -= size*mem5.szAtom;\n  assert( mem5.currentOut>0 || mem5.currentCount==0 );\n  assert( mem5.currentCount>0 || mem5.currentOut==0 );\n#endif\n\n  mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;\n  while( ALWAYS(iLogsize<LOGMAX) ){\n    int iBuddy;\n    if( (iBlock>>iLogsize) & 1 ){\n      iBuddy = iBlock - size;\n      assert( iBuddy>=0 );\n    }else{\n      iBuddy = iBlock + size;\n      if( iBuddy>=mem5.nBlock ) break;\n    }\n    if( mem5.aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break;\n    memsys5Unlink(iBuddy, iLogsize);\n    iLogsize++;\n    if( iBuddy<iBlock ){\n      mem5.aCtrl[iBuddy] = CTRL_FREE | iLogsize;\n      mem5.aCtrl[iBlock] = 0;\n      iBlock = iBuddy;\n    }else{\n      mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;\n      mem5.aCtrl[iBuddy] = 0;\n    }\n    size *= 2;\n  }\n\n#ifdef SQLITE_DEBUG\n  /* Overwrite freed memory with the 0x55 bit pattern to verify that it is\n  ** not used after being freed */\n  memset(&mem5.zPool[iBlock*mem5.szAtom], 0x55, size);\n#endif\n\n  memsys5Link(iBlock, iLogsize);\n}\n\n/*\n** Allocate nBytes of memory.\n*/\nstatic void *memsys5Malloc(int nBytes){\n  sqlite3_int64 *p = 0;\n  if( nBytes>0 ){\n    memsys5Enter();\n    p = memsys5MallocUnsafe(nBytes);\n    memsys5Leave();\n  }\n  return (void*)p; \n}\n\n/*\n** Free memory.\n**\n** The outer layer memory allocator prevents this routine from\n** being called with pPrior==0.\n*/\nstatic void memsys5Free(void *pPrior){\n  assert( pPrior!=0 );\n  memsys5Enter();\n  memsys5FreeUnsafe(pPrior);\n  memsys5Leave();  \n}\n\n/*\n** Change the size of an existing memory allocation.\n**\n** The outer layer memory allocator prevents this routine from\n** being called with pPrior==0.  \n**\n** nBytes is always a value obtained from a prior call to\n** memsys5Round().  Hence nBytes is always a non-negative power\n** of two.  If nBytes==0 that means that an oversize allocation\n** (an allocation larger than 0x40000000) was requested and this\n** routine should return 0 without freeing pPrior.\n*/\nstatic void *memsys5Realloc(void *pPrior, int nBytes){\n  int nOld;\n  void *p;\n  assert( pPrior!=0 );\n  assert( (nBytes&(nBytes-1))==0 );  /* EV: R-46199-30249 */\n  assert( nBytes>=0 );\n  if( nBytes==0 ){\n    return 0;\n  }\n  nOld = memsys5Size(pPrior);\n  if( nBytes<=nOld ){\n    return pPrior;\n  }\n  p = memsys5Malloc(nBytes);\n  if( p ){\n    memcpy(p, pPrior, nOld);\n    memsys5Free(pPrior);\n  }\n  return p;\n}\n\n/*\n** Round up a request size to the next valid allocation size.  If\n** the allocation is too large to be handled by this allocation system,\n** return 0.\n**\n** All allocations must be a power of two and must be expressed by a\n** 32-bit signed integer.  Hence the largest allocation is 0x40000000\n** or 1073741824 bytes.\n*/\nstatic int memsys5Roundup(int n){\n  int iFullSz;\n  if( n > 0x40000000 ) return 0;\n  for(iFullSz=mem5.szAtom; iFullSz<n; iFullSz *= 2);\n  return iFullSz;\n}\n\n/*\n** Return the ceiling of the logarithm base 2 of iValue.\n**\n** Examples:   memsys5Log(1) -> 0\n**             memsys5Log(2) -> 1\n**             memsys5Log(4) -> 2\n**             memsys5Log(5) -> 3\n**             memsys5Log(8) -> 3\n**             memsys5Log(9) -> 4\n*/\nstatic int memsys5Log(int iValue){\n  int iLog;\n  for(iLog=0; (iLog<(int)((sizeof(int)*8)-1)) && (1<<iLog)<iValue; iLog++);\n  return iLog;\n}\n\n/*\n** Initialize the memory allocator.\n**\n** This routine is not threadsafe.  The caller must be holding a mutex\n** to prevent multiple threads from entering at the same time.\n*/\nstatic int memsys5Init(void *NotUsed){\n  int ii;            /* Loop counter */\n  int nByte;         /* Number of bytes of memory available to this allocator */\n  u8 *zByte;         /* Memory usable by this allocator */\n  int nMinLog;       /* Log base 2 of minimum allocation size in bytes */\n  int iOffset;       /* An offset into mem5.aCtrl[] */\n\n  UNUSED_PARAMETER(NotUsed);\n\n  /* For the purposes of this routine, disable the mutex */\n  mem5.mutex = 0;\n\n  /* The size of a Mem5Link object must be a power of two.  Verify that\n  ** this is case.\n  */\n  assert( (sizeof(Mem5Link)&(sizeof(Mem5Link)-1))==0 );\n\n  nByte = sqlite3GlobalConfig.nHeap;\n  zByte = (u8*)sqlite3GlobalConfig.pHeap;\n  assert( zByte!=0 );  /* sqlite3_config() does not allow otherwise */\n\n  /* boundaries on sqlite3GlobalConfig.mnReq are enforced in sqlite3_config() */\n  nMinLog = memsys5Log(sqlite3GlobalConfig.mnReq);\n  mem5.szAtom = (1<<nMinLog);\n  while( (int)sizeof(Mem5Link)>mem5.szAtom ){\n    mem5.szAtom = mem5.szAtom << 1;\n  }\n\n  mem5.nBlock = (nByte / (mem5.szAtom+sizeof(u8)));\n  mem5.zPool = zByte;\n  mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.szAtom];\n\n  for(ii=0; ii<=LOGMAX; ii++){\n    mem5.aiFreelist[ii] = -1;\n  }\n\n  iOffset = 0;\n  for(ii=LOGMAX; ii>=0; ii--){\n    int nAlloc = (1<<ii);\n    if( (iOffset+nAlloc)<=mem5.nBlock ){\n      mem5.aCtrl[iOffset] = ii | CTRL_FREE;\n      memsys5Link(iOffset, ii);\n      iOffset += nAlloc;\n    }\n    assert((iOffset+nAlloc)>mem5.nBlock);\n  }\n\n  /* If a mutex is required for normal operation, allocate one */\n  if( sqlite3GlobalConfig.bMemstat==0 ){\n    mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Deinitialize this module.\n*/\nstatic void memsys5Shutdown(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  mem5.mutex = 0;\n  return;\n}\n\n#ifdef SQLITE_TEST\n/*\n** Open the file indicated and write a log of all unfreed memory \n** allocations into that log.\n*/\nvoid sqlite3Memsys5Dump(const char *zFilename){\n  FILE *out;\n  int i, j, n;\n  int nMinLog;\n\n  if( zFilename==0 || zFilename[0]==0 ){\n    out = stdout;\n  }else{\n    out = fopen(zFilename, \"w\");\n    if( out==0 ){\n      fprintf(stderr, \"** Unable to output memory debug output log: %s **\\n\",\n                      zFilename);\n      return;\n    }\n  }\n  memsys5Enter();\n  nMinLog = memsys5Log(mem5.szAtom);\n  for(i=0; i<=LOGMAX && i+nMinLog<32; i++){\n    for(n=0, j=mem5.aiFreelist[i]; j>=0; j = MEM5LINK(j)->next, n++){}\n    fprintf(out, \"freelist items of size %d: %d\\n\", mem5.szAtom << i, n);\n  }\n  fprintf(out, \"mem5.nAlloc       = %llu\\n\", mem5.nAlloc);\n  fprintf(out, \"mem5.totalAlloc   = %llu\\n\", mem5.totalAlloc);\n  fprintf(out, \"mem5.totalExcess  = %llu\\n\", mem5.totalExcess);\n  fprintf(out, \"mem5.currentOut   = %u\\n\", mem5.currentOut);\n  fprintf(out, \"mem5.currentCount = %u\\n\", mem5.currentCount);\n  fprintf(out, \"mem5.maxOut       = %u\\n\", mem5.maxOut);\n  fprintf(out, \"mem5.maxCount     = %u\\n\", mem5.maxCount);\n  fprintf(out, \"mem5.maxRequest   = %u\\n\", mem5.maxRequest);\n  memsys5Leave();\n  if( out==stdout ){\n    fflush(stdout);\n  }else{\n    fclose(out);\n  }\n}\n#endif\n\n/*\n** This routine is the only routine in this file with external \n** linkage. It returns a pointer to a static sqlite3_mem_methods\n** struct populated with the memsys5 methods.\n*/\nconst sqlite3_mem_methods *sqlite3MemGetMemsys5(void){\n  static const sqlite3_mem_methods memsys5Methods = {\n     memsys5Malloc,\n     memsys5Free,\n     memsys5Realloc,\n     memsys5Size,\n     memsys5Roundup,\n     memsys5Init,\n     memsys5Shutdown,\n     0\n  };\n  return &memsys5Methods;\n}\n\n#endif /* SQLITE_ENABLE_MEMSYS5 */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/memjournal.c",
    "content": "/*\n** 2008 October 7\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains code use to implement an in-memory rollback journal.\n** The in-memory rollback journal is used to journal transactions for\n** \":memory:\" databases and when the journal_mode=MEMORY pragma is used.\n**\n** Update:  The in-memory journal is also used to temporarily cache\n** smaller journals that are not critical for power-loss recovery.\n** For example, statement journals that are not too big will be held\n** entirely in memory, thus reducing the number of file I/O calls, and\n** more importantly, reducing temporary file creation events.  If these\n** journals become too large for memory, they are spilled to disk.  But\n** in the common case, they are usually small and no file I/O needs to\n** occur.\n*/\n#include \"sqliteInt.h\"\n\n/* Forward references to internal structures */\ntypedef struct MemJournal MemJournal;\ntypedef struct FilePoint FilePoint;\ntypedef struct FileChunk FileChunk;\n\n/*\n** The rollback journal is composed of a linked list of these structures.\n**\n** The zChunk array is always at least 8 bytes in size - usually much more.\n** Its actual size is stored in the MemJournal.nChunkSize variable.\n*/\nstruct FileChunk {\n  FileChunk *pNext;               /* Next chunk in the journal */\n  u8 zChunk[8];                   /* Content of this chunk */\n};\n\n/*\n** By default, allocate this many bytes of memory for each FileChunk object.\n*/\n#define MEMJOURNAL_DFLT_FILECHUNKSIZE 1024\n\n/*\n** For chunk size nChunkSize, return the number of bytes that should\n** be allocated for each FileChunk structure.\n*/\n#define fileChunkSize(nChunkSize) (sizeof(FileChunk) + ((nChunkSize)-8))\n\n/*\n** An instance of this object serves as a cursor into the rollback journal.\n** The cursor can be either for reading or writing.\n*/\nstruct FilePoint {\n  sqlite3_int64 iOffset;          /* Offset from the beginning of the file */\n  FileChunk *pChunk;              /* Specific chunk into which cursor points */\n};\n\n/*\n** This structure is a subclass of sqlite3_file. Each open memory-journal\n** is an instance of this class.\n*/\nstruct MemJournal {\n  const sqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */\n  int nChunkSize;                 /* In-memory chunk-size */\n\n  int nSpill;                     /* Bytes of data before flushing */\n  int nSize;                      /* Bytes of data currently in memory */\n  FileChunk *pFirst;              /* Head of in-memory chunk-list */\n  FilePoint endpoint;             /* Pointer to the end of the file */\n  FilePoint readpoint;            /* Pointer to the end of the last xRead() */\n\n  int flags;                      /* xOpen flags */\n  sqlite3_vfs *pVfs;              /* The \"real\" underlying VFS */\n  const char *zJournal;           /* Name of the journal file */\n};\n\n/*\n** Read data from the in-memory journal file.  This is the implementation\n** of the sqlite3_vfs.xRead method.\n*/\nstatic int memjrnlRead(\n  sqlite3_file *pJfd,    /* The journal file from which to read */\n  void *zBuf,            /* Put the results here */\n  int iAmt,              /* Number of bytes to read */\n  sqlite_int64 iOfst     /* Begin reading at this offset */\n){\n  MemJournal *p = (MemJournal *)pJfd;\n  u8 *zOut = zBuf;\n  int nRead = iAmt;\n  int iChunkOffset;\n  FileChunk *pChunk;\n\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\n  if( (iAmt+iOfst)>p->endpoint.iOffset ){\n    return SQLITE_IOERR_SHORT_READ;\n  }\n#endif\n\n  assert( (iAmt+iOfst)<=p->endpoint.iOffset );\n  assert( p->readpoint.iOffset==0 || p->readpoint.pChunk!=0 );\n  if( p->readpoint.iOffset!=iOfst || iOfst==0 ){\n    sqlite3_int64 iOff = 0;\n    for(pChunk=p->pFirst; \n        ALWAYS(pChunk) && (iOff+p->nChunkSize)<=iOfst;\n        pChunk=pChunk->pNext\n    ){\n      iOff += p->nChunkSize;\n    }\n  }else{\n    pChunk = p->readpoint.pChunk;\n    assert( pChunk!=0 );\n  }\n\n  iChunkOffset = (int)(iOfst%p->nChunkSize);\n  do {\n    int iSpace = p->nChunkSize - iChunkOffset;\n    int nCopy = MIN(nRead, (p->nChunkSize - iChunkOffset));\n    memcpy(zOut, (u8*)pChunk->zChunk + iChunkOffset, nCopy);\n    zOut += nCopy;\n    nRead -= iSpace;\n    iChunkOffset = 0;\n  } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );\n  p->readpoint.iOffset = pChunk ? iOfst+iAmt : 0;\n  p->readpoint.pChunk = pChunk;\n\n  return SQLITE_OK;\n}\n\n/*\n** Free the list of FileChunk structures headed at MemJournal.pFirst.\n*/\nstatic void memjrnlFreeChunks(MemJournal *p){\n  FileChunk *pIter;\n  FileChunk *pNext;\n  for(pIter=p->pFirst; pIter; pIter=pNext){\n    pNext = pIter->pNext;\n    sqlite3_free(pIter);\n  } \n  p->pFirst = 0;\n}\n\n/*\n** Flush the contents of memory to a real file on disk.\n*/\nstatic int memjrnlCreateFile(MemJournal *p){\n  int rc;\n  sqlite3_file *pReal = (sqlite3_file*)p;\n  MemJournal copy = *p;\n\n  memset(p, 0, sizeof(MemJournal));\n  rc = sqlite3OsOpen(copy.pVfs, copy.zJournal, pReal, copy.flags, 0);\n  if( rc==SQLITE_OK ){\n    int nChunk = copy.nChunkSize;\n    i64 iOff = 0;\n    FileChunk *pIter;\n    for(pIter=copy.pFirst; pIter; pIter=pIter->pNext){\n      if( iOff + nChunk > copy.endpoint.iOffset ){\n        nChunk = copy.endpoint.iOffset - iOff;\n      }\n      rc = sqlite3OsWrite(pReal, (u8*)pIter->zChunk, nChunk, iOff);\n      if( rc ) break;\n      iOff += nChunk;\n    }\n    if( rc==SQLITE_OK ){\n      /* No error has occurred. Free the in-memory buffers. */\n      memjrnlFreeChunks(&copy);\n    }\n  }\n  if( rc!=SQLITE_OK ){\n    /* If an error occurred while creating or writing to the file, restore\n    ** the original before returning. This way, SQLite uses the in-memory\n    ** journal data to roll back changes made to the internal page-cache\n    ** before this function was called.  */\n    sqlite3OsClose(pReal);\n    *p = copy;\n  }\n  return rc;\n}\n\n\n/*\n** Write data to the file.\n*/\nstatic int memjrnlWrite(\n  sqlite3_file *pJfd,    /* The journal file into which to write */\n  const void *zBuf,      /* Take data to be written from here */\n  int iAmt,              /* Number of bytes to write */\n  sqlite_int64 iOfst     /* Begin writing at this offset into the file */\n){\n  MemJournal *p = (MemJournal *)pJfd;\n  int nWrite = iAmt;\n  u8 *zWrite = (u8 *)zBuf;\n\n  /* If the file should be created now, create it and write the new data\n  ** into the file on disk. */\n  if( p->nSpill>0 && (iAmt+iOfst)>p->nSpill ){\n    int rc = memjrnlCreateFile(p);\n    if( rc==SQLITE_OK ){\n      rc = sqlite3OsWrite(pJfd, zBuf, iAmt, iOfst);\n    }\n    return rc;\n  }\n\n  /* If the contents of this write should be stored in memory */\n  else{\n    /* An in-memory journal file should only ever be appended to. Random\n    ** access writes are not required. The only exception to this is when\n    ** the in-memory journal is being used by a connection using the\n    ** atomic-write optimization. In this case the first 28 bytes of the\n    ** journal file may be written as part of committing the transaction. */ \n    assert( iOfst==p->endpoint.iOffset || iOfst==0 );\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\n    if( iOfst==0 && p->pFirst ){\n      assert( p->nChunkSize>iAmt );\n      memcpy((u8*)p->pFirst->zChunk, zBuf, iAmt);\n    }else\n#else\n    assert( iOfst>0 || p->pFirst==0 );\n#endif\n    {\n      while( nWrite>0 ){\n        FileChunk *pChunk = p->endpoint.pChunk;\n        int iChunkOffset = (int)(p->endpoint.iOffset%p->nChunkSize);\n        int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset);\n\n        if( iChunkOffset==0 ){\n          /* New chunk is required to extend the file. */\n          FileChunk *pNew = sqlite3_malloc(fileChunkSize(p->nChunkSize));\n          if( !pNew ){\n            return SQLITE_IOERR_NOMEM_BKPT;\n          }\n          pNew->pNext = 0;\n          if( pChunk ){\n            assert( p->pFirst );\n            pChunk->pNext = pNew;\n          }else{\n            assert( !p->pFirst );\n            p->pFirst = pNew;\n          }\n          p->endpoint.pChunk = pNew;\n        }\n\n        memcpy((u8*)p->endpoint.pChunk->zChunk + iChunkOffset, zWrite, iSpace);\n        zWrite += iSpace;\n        nWrite -= iSpace;\n        p->endpoint.iOffset += iSpace;\n      }\n      p->nSize = iAmt + iOfst;\n    }\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Truncate the file.\n**\n** If the journal file is already on disk, truncate it there. Or, if it\n** is still in main memory but is being truncated to zero bytes in size,\n** ignore \n*/\nstatic int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){\n  MemJournal *p = (MemJournal *)pJfd;\n  if( ALWAYS(size==0) ){\n    memjrnlFreeChunks(p);\n    p->nSize = 0;\n    p->endpoint.pChunk = 0;\n    p->endpoint.iOffset = 0;\n    p->readpoint.pChunk = 0;\n    p->readpoint.iOffset = 0;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Close the file.\n*/\nstatic int memjrnlClose(sqlite3_file *pJfd){\n  MemJournal *p = (MemJournal *)pJfd;\n  memjrnlFreeChunks(p);\n  return SQLITE_OK;\n}\n\n/*\n** Sync the file.\n**\n** If the real file has been created, call its xSync method. Otherwise, \n** syncing an in-memory journal is a no-op. \n*/\nstatic int memjrnlSync(sqlite3_file *pJfd, int flags){\n  UNUSED_PARAMETER2(pJfd, flags);\n  return SQLITE_OK;\n}\n\n/*\n** Query the size of the file in bytes.\n*/\nstatic int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){\n  MemJournal *p = (MemJournal *)pJfd;\n  *pSize = (sqlite_int64) p->endpoint.iOffset;\n  return SQLITE_OK;\n}\n\n/*\n** Table of methods for MemJournal sqlite3_file object.\n*/\nstatic const struct sqlite3_io_methods MemJournalMethods = {\n  1,                /* iVersion */\n  memjrnlClose,     /* xClose */\n  memjrnlRead,      /* xRead */\n  memjrnlWrite,     /* xWrite */\n  memjrnlTruncate,  /* xTruncate */\n  memjrnlSync,      /* xSync */\n  memjrnlFileSize,  /* xFileSize */\n  0,                /* xLock */\n  0,                /* xUnlock */\n  0,                /* xCheckReservedLock */\n  0,                /* xFileControl */\n  0,                /* xSectorSize */\n  0,                /* xDeviceCharacteristics */\n  0,                /* xShmMap */\n  0,                /* xShmLock */\n  0,                /* xShmBarrier */\n  0,                /* xShmUnmap */\n  0,                /* xFetch */\n  0                 /* xUnfetch */\n};\n\n/* \n** Open a journal file. \n**\n** The behaviour of the journal file depends on the value of parameter \n** nSpill. If nSpill is 0, then the journal file is always create and \n** accessed using the underlying VFS. If nSpill is less than zero, then\n** all content is always stored in main-memory. Finally, if nSpill is a\n** positive value, then the journal file is initially created in-memory\n** but may be flushed to disk later on. In this case the journal file is\n** flushed to disk either when it grows larger than nSpill bytes in size,\n** or when sqlite3JournalCreate() is called.\n*/\nint sqlite3JournalOpen(\n  sqlite3_vfs *pVfs,         /* The VFS to use for actual file I/O */\n  const char *zName,         /* Name of the journal file */\n  sqlite3_file *pJfd,        /* Preallocated, blank file handle */\n  int flags,                 /* Opening flags */\n  int nSpill                 /* Bytes buffered before opening the file */\n){\n  MemJournal *p = (MemJournal*)pJfd;\n\n  /* Zero the file-handle object. If nSpill was passed zero, initialize\n  ** it using the sqlite3OsOpen() function of the underlying VFS. In this\n  ** case none of the code in this module is executed as a result of calls\n  ** made on the journal file-handle.  */\n  memset(p, 0, sizeof(MemJournal));\n  if( nSpill==0 ){\n    return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0);\n  }\n\n  if( nSpill>0 ){\n    p->nChunkSize = nSpill;\n  }else{\n    p->nChunkSize = 8 + MEMJOURNAL_DFLT_FILECHUNKSIZE - sizeof(FileChunk);\n    assert( MEMJOURNAL_DFLT_FILECHUNKSIZE==fileChunkSize(p->nChunkSize) );\n  }\n\n  p->pMethod = (const sqlite3_io_methods*)&MemJournalMethods;\n  p->nSpill = nSpill;\n  p->flags = flags;\n  p->zJournal = zName;\n  p->pVfs = pVfs;\n  return SQLITE_OK;\n}\n\n/*\n** Open an in-memory journal file.\n*/\nvoid sqlite3MemJournalOpen(sqlite3_file *pJfd){\n  sqlite3JournalOpen(0, 0, pJfd, 0, -1);\n}\n\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\n/*\n** If the argument p points to a MemJournal structure that is not an \n** in-memory-only journal file (i.e. is one that was opened with a +ve\n** nSpill parameter), and the underlying file has not yet been created, \n** create it now.\n*/\nint sqlite3JournalCreate(sqlite3_file *p){\n  int rc = SQLITE_OK;\n  if( p->pMethods==&MemJournalMethods && ((MemJournal*)p)->nSpill>0 ){\n    rc = memjrnlCreateFile((MemJournal*)p);\n  }\n  return rc;\n}\n#endif\n\n/*\n** The file-handle passed as the only argument is open on a journal file.\n** Return true if this \"journal file\" is currently stored in heap memory,\n** or false otherwise.\n*/\nint sqlite3JournalIsInMemory(sqlite3_file *p){\n  return p->pMethods==&MemJournalMethods;\n}\n\n/* \n** Return the number of bytes required to store a JournalFile that uses vfs\n** pVfs to create the underlying on-disk files.\n*/\nint sqlite3JournalSize(sqlite3_vfs *pVfs){\n  return MAX(pVfs->szOsFile, (int)sizeof(MemJournal));\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/msvc.h",
    "content": "/*\n** 2015 January 12\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains code that is specific to MSVC.\n*/\n#ifndef SQLITE_MSVC_H\n#define SQLITE_MSVC_H\n\n#if defined(_MSC_VER)\n#pragma warning(disable : 4054)\n#pragma warning(disable : 4055)\n#pragma warning(disable : 4100)\n#pragma warning(disable : 4127)\n#pragma warning(disable : 4130)\n#pragma warning(disable : 4152)\n#pragma warning(disable : 4189)\n#pragma warning(disable : 4206)\n#pragma warning(disable : 4210)\n#pragma warning(disable : 4232)\n#pragma warning(disable : 4244)\n#pragma warning(disable : 4305)\n#pragma warning(disable : 4306)\n#pragma warning(disable : 4702)\n#pragma warning(disable : 4706)\n#endif /* defined(_MSC_VER) */\n\n#endif /* SQLITE_MSVC_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mutex.c",
    "content": "/*\n** 2007 August 14\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the C functions that implement mutexes.\n**\n** This file contains code that is common across all mutex implementations.\n*/\n#include \"sqliteInt.h\"\n\n#if defined(SQLITE_DEBUG) && !defined(SQLITE_MUTEX_OMIT)\n/*\n** For debugging purposes, record when the mutex subsystem is initialized\n** and uninitialized so that we can assert() if there is an attempt to\n** allocate a mutex while the system is uninitialized.\n*/\nstatic SQLITE_WSD int mutexIsInit = 0;\n#endif /* SQLITE_DEBUG && !defined(SQLITE_MUTEX_OMIT) */\n\n\n#ifndef SQLITE_MUTEX_OMIT\n/*\n** Initialize the mutex system.\n*/\nint sqlite3MutexInit(void){ \n  int rc = SQLITE_OK;\n  if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){\n    /* If the xMutexAlloc method has not been set, then the user did not\n    ** install a mutex implementation via sqlite3_config() prior to \n    ** sqlite3_initialize() being called. This block copies pointers to\n    ** the default implementation into the sqlite3GlobalConfig structure.\n    */\n    sqlite3_mutex_methods const *pFrom;\n    sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;\n\n    if( sqlite3GlobalConfig.bCoreMutex ){\n      pFrom = sqlite3DefaultMutex();\n    }else{\n      pFrom = sqlite3NoopMutex();\n    }\n    pTo->xMutexInit = pFrom->xMutexInit;\n    pTo->xMutexEnd = pFrom->xMutexEnd;\n    pTo->xMutexFree = pFrom->xMutexFree;\n    pTo->xMutexEnter = pFrom->xMutexEnter;\n    pTo->xMutexTry = pFrom->xMutexTry;\n    pTo->xMutexLeave = pFrom->xMutexLeave;\n    pTo->xMutexHeld = pFrom->xMutexHeld;\n    pTo->xMutexNotheld = pFrom->xMutexNotheld;\n    sqlite3MemoryBarrier();\n    pTo->xMutexAlloc = pFrom->xMutexAlloc;\n  }\n  assert( sqlite3GlobalConfig.mutex.xMutexInit );\n  rc = sqlite3GlobalConfig.mutex.xMutexInit();\n\n#ifdef SQLITE_DEBUG\n  GLOBAL(int, mutexIsInit) = 1;\n#endif\n\n  return rc;\n}\n\n/*\n** Shutdown the mutex system. This call frees resources allocated by\n** sqlite3MutexInit().\n*/\nint sqlite3MutexEnd(void){\n  int rc = SQLITE_OK;\n  if( sqlite3GlobalConfig.mutex.xMutexEnd ){\n    rc = sqlite3GlobalConfig.mutex.xMutexEnd();\n  }\n\n#ifdef SQLITE_DEBUG\n  GLOBAL(int, mutexIsInit) = 0;\n#endif\n\n  return rc;\n}\n\n/*\n** Retrieve a pointer to a static mutex or allocate a new dynamic one.\n*/\nsqlite3_mutex *sqlite3_mutex_alloc(int id){\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;\n  if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;\n#endif\n  assert( sqlite3GlobalConfig.mutex.xMutexAlloc );\n  return sqlite3GlobalConfig.mutex.xMutexAlloc(id);\n}\n\nsqlite3_mutex *sqlite3MutexAlloc(int id){\n  if( !sqlite3GlobalConfig.bCoreMutex ){\n    return 0;\n  }\n  assert( GLOBAL(int, mutexIsInit) );\n  assert( sqlite3GlobalConfig.mutex.xMutexAlloc );\n  return sqlite3GlobalConfig.mutex.xMutexAlloc(id);\n}\n\n/*\n** Free a dynamic mutex.\n*/\nvoid sqlite3_mutex_free(sqlite3_mutex *p){\n  if( p ){\n    assert( sqlite3GlobalConfig.mutex.xMutexFree );\n    sqlite3GlobalConfig.mutex.xMutexFree(p);\n  }\n}\n\n/*\n** Obtain the mutex p. If some other thread already has the mutex, block\n** until it can be obtained.\n*/\nvoid sqlite3_mutex_enter(sqlite3_mutex *p){\n  if( p ){\n    assert( sqlite3GlobalConfig.mutex.xMutexEnter );\n    sqlite3GlobalConfig.mutex.xMutexEnter(p);\n  }\n}\n\n/*\n** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another\n** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.\n*/\nint sqlite3_mutex_try(sqlite3_mutex *p){\n  int rc = SQLITE_OK;\n  if( p ){\n    assert( sqlite3GlobalConfig.mutex.xMutexTry );\n    return sqlite3GlobalConfig.mutex.xMutexTry(p);\n  }\n  return rc;\n}\n\n/*\n** The sqlite3_mutex_leave() routine exits a mutex that was previously\n** entered by the same thread.  The behavior is undefined if the mutex \n** is not currently entered. If a NULL pointer is passed as an argument\n** this function is a no-op.\n*/\nvoid sqlite3_mutex_leave(sqlite3_mutex *p){\n  if( p ){\n    assert( sqlite3GlobalConfig.mutex.xMutexLeave );\n    sqlite3GlobalConfig.mutex.xMutexLeave(p);\n  }\n}\n\n#ifndef NDEBUG\n/*\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\n** intended for use inside assert() statements.\n*/\nint sqlite3_mutex_held(sqlite3_mutex *p){\n  assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld );\n  return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);\n}\nint sqlite3_mutex_notheld(sqlite3_mutex *p){\n  assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld );\n  return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);\n}\n#endif\n\n#endif /* !defined(SQLITE_MUTEX_OMIT) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mutex.h",
    "content": "/*\n** 2007 August 28\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains the common header for all mutex implementations.\n** The sqliteInt.h header #includes this file so that it is available\n** to all source files.  We break it out in an effort to keep the code\n** better organized.\n**\n** NOTE:  source files should *not* #include this header file directly.\n** Source files should #include the sqliteInt.h file and let that file\n** include this one indirectly.\n*/\n\n\n/*\n** Figure out what version of the code to use.  The choices are\n**\n**   SQLITE_MUTEX_OMIT         No mutex logic.  Not even stubs.  The\n**                             mutexes implementation cannot be overridden\n**                             at start-time.\n**\n**   SQLITE_MUTEX_NOOP         For single-threaded applications.  No\n**                             mutual exclusion is provided.  But this\n**                             implementation can be overridden at\n**                             start-time.\n**\n**   SQLITE_MUTEX_PTHREADS     For multi-threaded applications on Unix.\n**\n**   SQLITE_MUTEX_W32          For multi-threaded applications on Win32.\n*/\n#if !SQLITE_THREADSAFE\n# define SQLITE_MUTEX_OMIT\n#endif\n#if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP)\n#  if SQLITE_OS_UNIX\n#    define SQLITE_MUTEX_PTHREADS\n#  elif SQLITE_OS_WIN\n#    define SQLITE_MUTEX_W32\n#  else\n#    define SQLITE_MUTEX_NOOP\n#  endif\n#endif\n\n#ifdef SQLITE_MUTEX_OMIT\n/*\n** If this is a no-op implementation, implement everything as macros.\n*/\n#define sqlite3_mutex_alloc(X)    ((sqlite3_mutex*)8)\n#define sqlite3_mutex_free(X)\n#define sqlite3_mutex_enter(X)    \n#define sqlite3_mutex_try(X)      SQLITE_OK\n#define sqlite3_mutex_leave(X)    \n#define sqlite3_mutex_held(X)     ((void)(X),1)\n#define sqlite3_mutex_notheld(X)  ((void)(X),1)\n#define sqlite3MutexAlloc(X)      ((sqlite3_mutex*)8)\n#define sqlite3MutexInit()        SQLITE_OK\n#define sqlite3MutexEnd()\n#define MUTEX_LOGIC(X)\n#else\n#define MUTEX_LOGIC(X)            X\n#endif /* defined(SQLITE_MUTEX_OMIT) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mutex_noop.c",
    "content": "/*\n** 2008 October 07\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the C functions that implement mutexes.\n**\n** This implementation in this file does not provide any mutual\n** exclusion and is thus suitable for use only in applications\n** that use SQLite in a single thread.  The routines defined\n** here are place-holders.  Applications can substitute working\n** mutex routines at start-time using the\n**\n**     sqlite3_config(SQLITE_CONFIG_MUTEX,...)\n**\n** interface.\n**\n** If compiled with SQLITE_DEBUG, then additional logic is inserted\n** that does error checking on mutexes to make sure they are being\n** called correctly.\n*/\n#include \"sqliteInt.h\"\n\n#ifndef SQLITE_MUTEX_OMIT\n\n#ifndef SQLITE_DEBUG\n/*\n** Stub routines for all mutex methods.\n**\n** This routines provide no mutual exclusion or error checking.\n*/\nstatic int noopMutexInit(void){ return SQLITE_OK; }\nstatic int noopMutexEnd(void){ return SQLITE_OK; }\nstatic sqlite3_mutex *noopMutexAlloc(int id){ \n  UNUSED_PARAMETER(id);\n  return (sqlite3_mutex*)8; \n}\nstatic void noopMutexFree(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }\nstatic void noopMutexEnter(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }\nstatic int noopMutexTry(sqlite3_mutex *p){\n  UNUSED_PARAMETER(p);\n  return SQLITE_OK;\n}\nstatic void noopMutexLeave(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }\n\nsqlite3_mutex_methods const *sqlite3NoopMutex(void){\n  static const sqlite3_mutex_methods sMutex = {\n    noopMutexInit,\n    noopMutexEnd,\n    noopMutexAlloc,\n    noopMutexFree,\n    noopMutexEnter,\n    noopMutexTry,\n    noopMutexLeave,\n\n    0,\n    0,\n  };\n\n  return &sMutex;\n}\n#endif /* !SQLITE_DEBUG */\n\n#ifdef SQLITE_DEBUG\n/*\n** In this implementation, error checking is provided for testing\n** and debugging purposes.  The mutexes still do not provide any\n** mutual exclusion.\n*/\n\n/*\n** The mutex object\n*/\ntypedef struct sqlite3_debug_mutex {\n  int id;     /* The mutex type */\n  int cnt;    /* Number of entries without a matching leave */\n} sqlite3_debug_mutex;\n\n/*\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\n** intended for use inside assert() statements.\n*/\nstatic int debugMutexHeld(sqlite3_mutex *pX){\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\n  return p==0 || p->cnt>0;\n}\nstatic int debugMutexNotheld(sqlite3_mutex *pX){\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\n  return p==0 || p->cnt==0;\n}\n\n/*\n** Initialize and deinitialize the mutex subsystem.\n*/\nstatic int debugMutexInit(void){ return SQLITE_OK; }\nstatic int debugMutexEnd(void){ return SQLITE_OK; }\n\n/*\n** The sqlite3_mutex_alloc() routine allocates a new\n** mutex and returns a pointer to it.  If it returns NULL\n** that means that a mutex could not be allocated. \n*/\nstatic sqlite3_mutex *debugMutexAlloc(int id){\n  static sqlite3_debug_mutex aStatic[SQLITE_MUTEX_STATIC_VFS3 - 1];\n  sqlite3_debug_mutex *pNew = 0;\n  switch( id ){\n    case SQLITE_MUTEX_FAST:\n    case SQLITE_MUTEX_RECURSIVE: {\n      pNew = sqlite3Malloc(sizeof(*pNew));\n      if( pNew ){\n        pNew->id = id;\n        pNew->cnt = 0;\n      }\n      break;\n    }\n    default: {\n#ifdef SQLITE_ENABLE_API_ARMOR\n      if( id-2<0 || id-2>=ArraySize(aStatic) ){\n        (void)SQLITE_MISUSE_BKPT;\n        return 0;\n      }\n#endif\n      pNew = &aStatic[id-2];\n      pNew->id = id;\n      break;\n    }\n  }\n  return (sqlite3_mutex*)pNew;\n}\n\n/*\n** This routine deallocates a previously allocated mutex.\n*/\nstatic void debugMutexFree(sqlite3_mutex *pX){\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\n  assert( p->cnt==0 );\n  if( p->id==SQLITE_MUTEX_RECURSIVE || p->id==SQLITE_MUTEX_FAST ){\n    sqlite3_free(p);\n  }else{\n#ifdef SQLITE_ENABLE_API_ARMOR\n    (void)SQLITE_MISUSE_BKPT;\n#endif\n  }\n}\n\n/*\n** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\n** to enter a mutex.  If another thread is already within the mutex,\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\n** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK\n** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can\n** be entered multiple times by the same thread.  In such cases the,\n** mutex must be exited an equal number of times before another thread\n** can enter.  If the same thread tries to enter any other kind of mutex\n** more than once, the behavior is undefined.\n*/\nstatic void debugMutexEnter(sqlite3_mutex *pX){\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );\n  p->cnt++;\n}\nstatic int debugMutexTry(sqlite3_mutex *pX){\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );\n  p->cnt++;\n  return SQLITE_OK;\n}\n\n/*\n** The sqlite3_mutex_leave() routine exits a mutex that was\n** previously entered by the same thread.  The behavior\n** is undefined if the mutex is not currently entered or\n** is not currently allocated.  SQLite will never do either.\n*/\nstatic void debugMutexLeave(sqlite3_mutex *pX){\n  sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX;\n  assert( debugMutexHeld(pX) );\n  p->cnt--;\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) );\n}\n\nsqlite3_mutex_methods const *sqlite3NoopMutex(void){\n  static const sqlite3_mutex_methods sMutex = {\n    debugMutexInit,\n    debugMutexEnd,\n    debugMutexAlloc,\n    debugMutexFree,\n    debugMutexEnter,\n    debugMutexTry,\n    debugMutexLeave,\n\n    debugMutexHeld,\n    debugMutexNotheld\n  };\n\n  return &sMutex;\n}\n#endif /* SQLITE_DEBUG */\n\n/*\n** If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation\n** is used regardless of the run-time threadsafety setting.\n*/\n#ifdef SQLITE_MUTEX_NOOP\nsqlite3_mutex_methods const *sqlite3DefaultMutex(void){\n  return sqlite3NoopMutex();\n}\n#endif /* defined(SQLITE_MUTEX_NOOP) */\n#endif /* !defined(SQLITE_MUTEX_OMIT) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mutex_unix.c",
    "content": "/*\n** 2007 August 28\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the C functions that implement mutexes for pthreads\n*/\n#include \"sqliteInt.h\"\n\n/*\n** The code in this file is only used if we are compiling threadsafe\n** under unix with pthreads.\n**\n** Note that this implementation requires a version of pthreads that\n** supports recursive mutexes.\n*/\n#ifdef SQLITE_MUTEX_PTHREADS\n\n#include <pthread.h>\n\n/*\n** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields\n** are necessary under two condidtions:  (1) Debug builds and (2) using\n** home-grown mutexes.  Encapsulate these conditions into a single #define.\n*/\n#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)\n# define SQLITE_MUTEX_NREF 1\n#else\n# define SQLITE_MUTEX_NREF 0\n#endif\n\n/*\n** Each recursive mutex is an instance of the following structure.\n*/\nstruct sqlite3_mutex {\n  pthread_mutex_t mutex;     /* Mutex controlling the lock */\n#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)\n  int id;                    /* Mutex type */\n#endif\n#if SQLITE_MUTEX_NREF\n  volatile int nRef;         /* Number of entrances */\n  volatile pthread_t owner;  /* Thread that is within this mutex */\n  int trace;                 /* True to trace changes */\n#endif\n};\n#if SQLITE_MUTEX_NREF\n#define SQLITE3_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER,0,0,(pthread_t)0,0}\n#elif defined(SQLITE_ENABLE_API_ARMOR)\n#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0 }\n#else\n#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }\n#endif\n\n/*\n** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are\n** intended for use only inside assert() statements.  On some platforms,\n** there might be race conditions that can cause these routines to\n** deliver incorrect results.  In particular, if pthread_equal() is\n** not an atomic operation, then these routines might delivery\n** incorrect results.  On most platforms, pthread_equal() is a \n** comparison of two integers and is therefore atomic.  But we are\n** told that HPUX is not such a platform.  If so, then these routines\n** will not always work correctly on HPUX.\n**\n** On those platforms where pthread_equal() is not atomic, SQLite\n** should be compiled without -DSQLITE_DEBUG and with -DNDEBUG to\n** make sure no assert() statements are evaluated and hence these\n** routines are never called.\n*/\n#if !defined(NDEBUG) || defined(SQLITE_DEBUG)\nstatic int pthreadMutexHeld(sqlite3_mutex *p){\n  return (p->nRef!=0 && pthread_equal(p->owner, pthread_self()));\n}\nstatic int pthreadMutexNotheld(sqlite3_mutex *p){\n  return p->nRef==0 || pthread_equal(p->owner, pthread_self())==0;\n}\n#endif\n\n/*\n** Try to provide a memory barrier operation, needed for initialization\n** and also for the implementation of xShmBarrier in the VFS in cases\n** where SQLite is compiled without mutexes.\n*/\nvoid sqlite3MemoryBarrier(void){\n#if defined(SQLITE_MEMORY_BARRIER)\n  SQLITE_MEMORY_BARRIER;\n#elif defined(__GNUC__) && GCC_VERSION>=4001000\n  __sync_synchronize();\n#endif\n}\n\n/*\n** Initialize and deinitialize the mutex subsystem.\n*/\nstatic int pthreadMutexInit(void){ return SQLITE_OK; }\nstatic int pthreadMutexEnd(void){ return SQLITE_OK; }\n\n/*\n** The sqlite3_mutex_alloc() routine allocates a new\n** mutex and returns a pointer to it.  If it returns NULL\n** that means that a mutex could not be allocated.  SQLite\n** will unwind its stack and return an error.  The argument\n** to sqlite3_mutex_alloc() is one of these integer constants:\n**\n** <ul>\n** <li>  SQLITE_MUTEX_FAST\n** <li>  SQLITE_MUTEX_RECURSIVE\n** <li>  SQLITE_MUTEX_STATIC_MASTER\n** <li>  SQLITE_MUTEX_STATIC_MEM\n** <li>  SQLITE_MUTEX_STATIC_OPEN\n** <li>  SQLITE_MUTEX_STATIC_PRNG\n** <li>  SQLITE_MUTEX_STATIC_LRU\n** <li>  SQLITE_MUTEX_STATIC_PMEM\n** <li>  SQLITE_MUTEX_STATIC_APP1\n** <li>  SQLITE_MUTEX_STATIC_APP2\n** <li>  SQLITE_MUTEX_STATIC_APP3\n** <li>  SQLITE_MUTEX_STATIC_VFS1\n** <li>  SQLITE_MUTEX_STATIC_VFS2\n** <li>  SQLITE_MUTEX_STATIC_VFS3\n** </ul>\n**\n** The first two constants cause sqlite3_mutex_alloc() to create\n** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE\n** is used but not necessarily so when SQLITE_MUTEX_FAST is used.\n** The mutex implementation does not need to make a distinction\n** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does\n** not want to.  But SQLite will only request a recursive mutex in\n** cases where it really needs one.  If a faster non-recursive mutex\n** implementation is available on the host platform, the mutex subsystem\n** might return such a mutex in response to SQLITE_MUTEX_FAST.\n**\n** The other allowed parameters to sqlite3_mutex_alloc() each return\n** a pointer to a static preexisting mutex.  Six static mutexes are\n** used by the current version of SQLite.  Future versions of SQLite\n** may add additional static mutexes.  Static mutexes are for internal\n** use by SQLite only.  Applications that use SQLite mutexes should\n** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or\n** SQLITE_MUTEX_RECURSIVE.\n**\n** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST\n** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()\n** returns a different mutex on every call.  But for the static \n** mutex types, the same mutex is returned on every call that has\n** the same type number.\n*/\nstatic sqlite3_mutex *pthreadMutexAlloc(int iType){\n  static sqlite3_mutex staticMutexes[] = {\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER,\n    SQLITE3_MUTEX_INITIALIZER\n  };\n  sqlite3_mutex *p;\n  switch( iType ){\n    case SQLITE_MUTEX_RECURSIVE: {\n      p = sqlite3MallocZero( sizeof(*p) );\n      if( p ){\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\n        /* If recursive mutexes are not available, we will have to\n        ** build our own.  See below. */\n        pthread_mutex_init(&p->mutex, 0);\n#else\n        /* Use a recursive mutex if it is available */\n        pthread_mutexattr_t recursiveAttr;\n        pthread_mutexattr_init(&recursiveAttr);\n        pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE);\n        pthread_mutex_init(&p->mutex, &recursiveAttr);\n        pthread_mutexattr_destroy(&recursiveAttr);\n#endif\n      }\n      break;\n    }\n    case SQLITE_MUTEX_FAST: {\n      p = sqlite3MallocZero( sizeof(*p) );\n      if( p ){\n        pthread_mutex_init(&p->mutex, 0);\n      }\n      break;\n    }\n    default: {\n#ifdef SQLITE_ENABLE_API_ARMOR\n      if( iType-2<0 || iType-2>=ArraySize(staticMutexes) ){\n        (void)SQLITE_MISUSE_BKPT;\n        return 0;\n      }\n#endif\n      p = &staticMutexes[iType-2];\n      break;\n    }\n  }\n#if SQLITE_MUTEX_NREF || defined(SQLITE_ENABLE_API_ARMOR)\n  if( p ) p->id = iType;\n#endif\n  return p;\n}\n\n\n/*\n** This routine deallocates a previously\n** allocated mutex.  SQLite is careful to deallocate every\n** mutex that it allocates.\n*/\nstatic void pthreadMutexFree(sqlite3_mutex *p){\n  assert( p->nRef==0 );\n#if SQLITE_ENABLE_API_ARMOR\n  if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE )\n#endif\n  {\n    pthread_mutex_destroy(&p->mutex);\n    sqlite3_free(p);\n  }\n#ifdef SQLITE_ENABLE_API_ARMOR\n  else{\n    (void)SQLITE_MISUSE_BKPT;\n  }\n#endif\n}\n\n/*\n** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt\n** to enter a mutex.  If another thread is already within the mutex,\n** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return\n** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK\n** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can\n** be entered multiple times by the same thread.  In such cases the,\n** mutex must be exited an equal number of times before another thread\n** can enter.  If the same thread tries to enter any other kind of mutex\n** more than once, the behavior is undefined.\n*/\nstatic void pthreadMutexEnter(sqlite3_mutex *p){\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );\n\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\n  /* If recursive mutexes are not available, then we have to grow\n  ** our own.  This implementation assumes that pthread_equal()\n  ** is atomic - that it cannot be deceived into thinking self\n  ** and p->owner are equal if p->owner changes between two values\n  ** that are not equal to self while the comparison is taking place.\n  ** This implementation also assumes a coherent cache - that \n  ** separate processes cannot read different values from the same\n  ** address at the same time.  If either of these two conditions\n  ** are not met, then the mutexes will fail and problems will result.\n  */\n  {\n    pthread_t self = pthread_self();\n    if( p->nRef>0 && pthread_equal(p->owner, self) ){\n      p->nRef++;\n    }else{\n      pthread_mutex_lock(&p->mutex);\n      assert( p->nRef==0 );\n      p->owner = self;\n      p->nRef = 1;\n    }\n  }\n#else\n  /* Use the built-in recursive mutexes if they are available.\n  */\n  pthread_mutex_lock(&p->mutex);\n#if SQLITE_MUTEX_NREF\n  assert( p->nRef>0 || p->owner==0 );\n  p->owner = pthread_self();\n  p->nRef++;\n#endif\n#endif\n\n#ifdef SQLITE_DEBUG\n  if( p->trace ){\n    printf(\"enter mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\n  }\n#endif\n}\nstatic int pthreadMutexTry(sqlite3_mutex *p){\n  int rc;\n  assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );\n\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\n  /* If recursive mutexes are not available, then we have to grow\n  ** our own.  This implementation assumes that pthread_equal()\n  ** is atomic - that it cannot be deceived into thinking self\n  ** and p->owner are equal if p->owner changes between two values\n  ** that are not equal to self while the comparison is taking place.\n  ** This implementation also assumes a coherent cache - that \n  ** separate processes cannot read different values from the same\n  ** address at the same time.  If either of these two conditions\n  ** are not met, then the mutexes will fail and problems will result.\n  */\n  {\n    pthread_t self = pthread_self();\n    if( p->nRef>0 && pthread_equal(p->owner, self) ){\n      p->nRef++;\n      rc = SQLITE_OK;\n    }else if( pthread_mutex_trylock(&p->mutex)==0 ){\n      assert( p->nRef==0 );\n      p->owner = self;\n      p->nRef = 1;\n      rc = SQLITE_OK;\n    }else{\n      rc = SQLITE_BUSY;\n    }\n  }\n#else\n  /* Use the built-in recursive mutexes if they are available.\n  */\n  if( pthread_mutex_trylock(&p->mutex)==0 ){\n#if SQLITE_MUTEX_NREF\n    p->owner = pthread_self();\n    p->nRef++;\n#endif\n    rc = SQLITE_OK;\n  }else{\n    rc = SQLITE_BUSY;\n  }\n#endif\n\n#ifdef SQLITE_DEBUG\n  if( rc==SQLITE_OK && p->trace ){\n    printf(\"enter mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\n  }\n#endif\n  return rc;\n}\n\n/*\n** The sqlite3_mutex_leave() routine exits a mutex that was\n** previously entered by the same thread.  The behavior\n** is undefined if the mutex is not currently entered or\n** is not currently allocated.  SQLite will never do either.\n*/\nstatic void pthreadMutexLeave(sqlite3_mutex *p){\n  assert( pthreadMutexHeld(p) );\n#if SQLITE_MUTEX_NREF\n  p->nRef--;\n  if( p->nRef==0 ) p->owner = 0;\n#endif\n  assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );\n\n#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX\n  if( p->nRef==0 ){\n    pthread_mutex_unlock(&p->mutex);\n  }\n#else\n  pthread_mutex_unlock(&p->mutex);\n#endif\n\n#ifdef SQLITE_DEBUG\n  if( p->trace ){\n    printf(\"leave mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\n  }\n#endif\n}\n\nsqlite3_mutex_methods const *sqlite3DefaultMutex(void){\n  static const sqlite3_mutex_methods sMutex = {\n    pthreadMutexInit,\n    pthreadMutexEnd,\n    pthreadMutexAlloc,\n    pthreadMutexFree,\n    pthreadMutexEnter,\n    pthreadMutexTry,\n    pthreadMutexLeave,\n#ifdef SQLITE_DEBUG\n    pthreadMutexHeld,\n    pthreadMutexNotheld\n#else\n    0,\n    0\n#endif\n  };\n\n  return &sMutex;\n}\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n\n#if SQLITE_MUTEX_NREF\nvoid sqlite3PthreadMutexRefIncrease(sqlite3_mutex* p)\n{\n  assert( p->nRef>0 || p->owner==0 );\n#ifdef SQLITE_DEBUG\n  if( p->trace ){\n    printf(\"enter mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\n  }\n#endif\n  p->owner = pthread_self();\n  ++p->nRef;\n}\n\nvoid sqlite3PthreadMutexRefDecrease(sqlite3_mutex* p)\n{\n  --p->nRef;\n  if( p->nRef==0 ) p->owner = 0;\n  assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );\n#ifdef SQLITE_DEBUG\n  if( p->trace ){\n    printf(\"leave mutex %p (%d) with nRef=%d\\n\", p, p->trace, p->nRef);\n  }\n#endif\n}\n\n#endif //SQLITE_MUTEX_NREF\n\npthread_mutex_t* sqlite3GetPthreadMutex(sqlite3_mutex* p)\n{\n    return &p->mutex;\n}\n#endif //SQLITE_WCDB_SIGNAL_RETRY\n\n#endif /* SQLITE_MUTEX_PTHREADS */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mutex_wcdb.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n\n#include \"mutex_wcdb.h\"\n#include <pthread.h>\n#include \"sqliteInt.h\"\n#include \"sqlite3.h\"\n\nextern pthread_mutex_t* sqlite3GetPthreadMutex(sqlite3_mutex* p);\n#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)\nextern void sqlite3PthreadMutexRefIncrease(sqlite3_mutex* p);\nextern void sqlite3PthreadMutexRefDecrease(sqlite3_mutex* p);\n#endif\n\nstruct sqlite3_thread {\n  pthread_t thread;\n};\n\nstruct sqlite3_condition {\n  pthread_cond_t cond;\n};\n\nsqlite3_condition* pthreadCondAlloc()\n{\n  sqlite3_condition* c = sqlite3MallocZero(sizeof(sqlite3_condition));\n  if (c) {\n    pthread_cond_init(&c->cond, NULL);\n  }\n  return c;\n}\n\nvoid pthreadCondFree(sqlite3_condition* c)\n{\n  pthread_cond_destroy(&c->cond);\n  sqlite3_free(c);\n}\n\nint pthreadCondWait(sqlite3_condition* c, sqlite3_mutex* p, int timeout)\n{\n  int rc;\n#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)\n  sqlite3PthreadMutexRefDecrease(p);\n#endif\n  if (timeout>0) {\n    struct timespec relative;\n    relative.tv_nsec = 0;\n    relative.tv_sec = timeout;\n    rc = pthread_cond_timedwait_relative_np(&c->cond, sqlite3GetPthreadMutex(p), &relative);\n  }else {\n    rc = pthread_cond_wait(&c->cond, sqlite3GetPthreadMutex(p));\n  }\n#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)\n  sqlite3PthreadMutexRefIncrease(p);\n#endif\n  return rc;\n}\n\nvoid pthreadCondSignal(sqlite3_condition* c, sqlite3_thread* t)\n{\n  if (t&&t->thread) {\n    pthread_cond_signal_thread_np(&c->cond, t->thread);\n  }else {\n    pthread_cond_signal(&c->cond);\n  }\n}\n\nvoid pthreadCondBroadcast(sqlite3_condition* c)\n{\n  pthread_cond_broadcast(&c->cond);\n}\n\nsqlite3_thread* pthreadAlloc()\n{\n  return (sqlite3_thread*)sqlite3MallocZero(sizeof(sqlite3_thread));\n}\n\nvoid pthreadFree(sqlite3_thread* t)\n{\n  sqlite3_free(t);\n}\n\nvoid pthreadSelf(sqlite3_thread* t)\n{\n  t->thread = pthread_self();\n}\n\nint pthreadIsMain()\n{\n  return pthread_main_np();\n}\n\nsqlite3_mutex* unixVFSMutex(void)\n{\n  return sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);\n}\n\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/mutex_wcdb.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef mutex_wcdb_h\n#define mutex_wcdb_h\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n\n#include \"sqlite3.h\"\n\ntypedef struct sqlite3_thread sqlite3_thread;\ntypedef struct sqlite3_condition sqlite3_condition;\n\nsqlite3_condition* pthreadCondAlloc();\n\nvoid pthreadCondFree(sqlite3_condition* c);\n\nint pthreadCondWait(sqlite3_condition* c, sqlite3_mutex* p, int timeout);\n\nvoid pthreadCondSignal(sqlite3_condition* c, sqlite3_thread* t);\n\nvoid pthreadCondBroadcast(sqlite3_condition* c);\n\nsqlite3_thread* pthreadAlloc();\n\nvoid pthreadFree(sqlite3_thread* t);\n\nvoid pthreadSelf(sqlite3_thread* t);\n\nint pthreadIsMain();\n\nsqlite3_mutex* unixVFSMutex(void);\n\n#endif //SQLITE_WCDB_SIGNAL_RETRY\n\n#endif /* mutex_wcdb_h */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/notify.c",
    "content": "/*\n** 2009 March 3\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains the implementation of the sqlite3_unlock_notify()\n** API method and its associated functionality.\n*/\n#include \"sqliteInt.h\"\n#include \"btreeInt.h\"\n\n/* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\n\n/*\n** Public interfaces:\n**\n**   sqlite3ConnectionBlocked()\n**   sqlite3ConnectionUnlocked()\n**   sqlite3ConnectionClosed()\n**   sqlite3_unlock_notify()\n*/\n\n#define assertMutexHeld() \\\n  assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) )\n\n/*\n** Head of a linked list of all sqlite3 objects created by this process\n** for which either sqlite3.pBlockingConnection or sqlite3.pUnlockConnection\n** is not NULL. This variable may only accessed while the STATIC_MASTER\n** mutex is held.\n*/\nstatic sqlite3 *SQLITE_WSD sqlite3BlockedList = 0;\n\n#ifndef NDEBUG\n/*\n** This function is a complex assert() that verifies the following \n** properties of the blocked connections list:\n**\n**   1) Each entry in the list has a non-NULL value for either \n**      pUnlockConnection or pBlockingConnection, or both.\n**\n**   2) All entries in the list that share a common value for \n**      xUnlockNotify are grouped together.\n**\n**   3) If the argument db is not NULL, then none of the entries in the\n**      blocked connections list have pUnlockConnection or pBlockingConnection\n**      set to db. This is used when closing connection db.\n*/\nstatic void checkListProperties(sqlite3 *db){\n  sqlite3 *p;\n  for(p=sqlite3BlockedList; p; p=p->pNextBlocked){\n    int seen = 0;\n    sqlite3 *p2;\n\n    /* Verify property (1) */\n    assert( p->pUnlockConnection || p->pBlockingConnection );\n\n    /* Verify property (2) */\n    for(p2=sqlite3BlockedList; p2!=p; p2=p2->pNextBlocked){\n      if( p2->xUnlockNotify==p->xUnlockNotify ) seen = 1;\n      assert( p2->xUnlockNotify==p->xUnlockNotify || !seen );\n      assert( db==0 || p->pUnlockConnection!=db );\n      assert( db==0 || p->pBlockingConnection!=db );\n    }\n  }\n}\n#else\n# define checkListProperties(x)\n#endif\n\n/*\n** Remove connection db from the blocked connections list. If connection\n** db is not currently a part of the list, this function is a no-op.\n*/\nstatic void removeFromBlockedList(sqlite3 *db){\n  sqlite3 **pp;\n  assertMutexHeld();\n  for(pp=&sqlite3BlockedList; *pp; pp = &(*pp)->pNextBlocked){\n    if( *pp==db ){\n      *pp = (*pp)->pNextBlocked;\n      break;\n    }\n  }\n}\n\n/*\n** Add connection db to the blocked connections list. It is assumed\n** that it is not already a part of the list.\n*/\nstatic void addToBlockedList(sqlite3 *db){\n  sqlite3 **pp;\n  assertMutexHeld();\n  for(\n    pp=&sqlite3BlockedList; \n    *pp && (*pp)->xUnlockNotify!=db->xUnlockNotify; \n    pp=&(*pp)->pNextBlocked\n  );\n  db->pNextBlocked = *pp;\n  *pp = db;\n}\n\n/*\n** Obtain the STATIC_MASTER mutex.\n*/\nstatic void enterMutex(void){\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\n  checkListProperties(0);\n}\n\n/*\n** Release the STATIC_MASTER mutex.\n*/\nstatic void leaveMutex(void){\n  assertMutexHeld();\n  checkListProperties(0);\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));\n}\n\n/*\n** Register an unlock-notify callback.\n**\n** This is called after connection \"db\" has attempted some operation\n** but has received an SQLITE_LOCKED error because another connection\n** (call it pOther) in the same process was busy using the same shared\n** cache.  pOther is found by looking at db->pBlockingConnection.\n**\n** If there is no blocking connection, the callback is invoked immediately,\n** before this routine returns.\n**\n** If pOther is already blocked on db, then report SQLITE_LOCKED, to indicate\n** a deadlock.\n**\n** Otherwise, make arrangements to invoke xNotify when pOther drops\n** its locks.\n**\n** Each call to this routine overrides any prior callbacks registered\n** on the same \"db\".  If xNotify==0 then any prior callbacks are immediately\n** cancelled.\n*/\nint sqlite3_unlock_notify(\n  sqlite3 *db,\n  void (*xNotify)(void **, int),\n  void *pArg\n){\n  int rc = SQLITE_OK;\n\n  sqlite3_mutex_enter(db->mutex);\n  enterMutex();\n\n  if( xNotify==0 ){\n    removeFromBlockedList(db);\n    db->pBlockingConnection = 0;\n    db->pUnlockConnection = 0;\n    db->xUnlockNotify = 0;\n    db->pUnlockArg = 0;\n  }else if( 0==db->pBlockingConnection ){\n    /* The blocking transaction has been concluded. Or there never was a \n    ** blocking transaction. In either case, invoke the notify callback\n    ** immediately. \n    */\n    xNotify(&pArg, 1);\n  }else{\n    sqlite3 *p;\n\n    for(p=db->pBlockingConnection; p && p!=db; p=p->pUnlockConnection){}\n    if( p ){\n      rc = SQLITE_LOCKED;              /* Deadlock detected. */\n    }else{\n      db->pUnlockConnection = db->pBlockingConnection;\n      db->xUnlockNotify = xNotify;\n      db->pUnlockArg = pArg;\n      removeFromBlockedList(db);\n      addToBlockedList(db);\n    }\n  }\n\n  leaveMutex();\n  assert( !db->mallocFailed );\n  sqlite3ErrorWithMsg(db, rc, (rc?\"database is deadlocked\":0));\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** This function is called while stepping or preparing a statement \n** associated with connection db. The operation will return SQLITE_LOCKED\n** to the user because it requires a lock that will not be available\n** until connection pBlocker concludes its current transaction.\n*/\nvoid sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){\n  enterMutex();\n  if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){\n    addToBlockedList(db);\n  }\n  db->pBlockingConnection = pBlocker;\n  leaveMutex();\n}\n\n/*\n** This function is called when\n** the transaction opened by database db has just finished. Locks held \n** by database connection db have been released.\n**\n** This function loops through each entry in the blocked connections\n** list and does the following:\n**\n**   1) If the sqlite3.pBlockingConnection member of a list entry is\n**      set to db, then set pBlockingConnection=0.\n**\n**   2) If the sqlite3.pUnlockConnection member of a list entry is\n**      set to db, then invoke the configured unlock-notify callback and\n**      set pUnlockConnection=0.\n**\n**   3) If the two steps above mean that pBlockingConnection==0 and\n**      pUnlockConnection==0, remove the entry from the blocked connections\n**      list.\n*/\nvoid sqlite3ConnectionUnlocked(sqlite3 *db){\n  void (*xUnlockNotify)(void **, int) = 0; /* Unlock-notify cb to invoke */\n  int nArg = 0;                            /* Number of entries in aArg[] */\n  sqlite3 **pp;                            /* Iterator variable */\n  void **aArg;               /* Arguments to the unlock callback */\n  void **aDyn = 0;           /* Dynamically allocated space for aArg[] */\n  void *aStatic[16];         /* Starter space for aArg[].  No malloc required */\n\n  aArg = aStatic;\n  enterMutex();         /* Enter STATIC_MASTER mutex */\n\n  /* This loop runs once for each entry in the blocked-connections list. */\n  for(pp=&sqlite3BlockedList; *pp; /* no-op */ ){\n    sqlite3 *p = *pp;\n\n    /* Step 1. */\n    if( p->pBlockingConnection==db ){\n      p->pBlockingConnection = 0;\n    }\n\n    /* Step 2. */\n    if( p->pUnlockConnection==db ){\n      assert( p->xUnlockNotify );\n      if( p->xUnlockNotify!=xUnlockNotify && nArg!=0 ){\n        xUnlockNotify(aArg, nArg);\n        nArg = 0;\n      }\n\n      sqlite3BeginBenignMalloc();\n      assert( aArg==aDyn || (aDyn==0 && aArg==aStatic) );\n      assert( nArg<=(int)ArraySize(aStatic) || aArg==aDyn );\n      if( (!aDyn && nArg==(int)ArraySize(aStatic))\n       || (aDyn && nArg==(int)(sqlite3MallocSize(aDyn)/sizeof(void*)))\n      ){\n        /* The aArg[] array needs to grow. */\n        void **pNew = (void **)sqlite3Malloc(nArg*sizeof(void *)*2);\n        if( pNew ){\n          memcpy(pNew, aArg, nArg*sizeof(void *));\n          sqlite3_free(aDyn);\n          aDyn = aArg = pNew;\n        }else{\n          /* This occurs when the array of context pointers that need to\n          ** be passed to the unlock-notify callback is larger than the\n          ** aStatic[] array allocated on the stack and the attempt to \n          ** allocate a larger array from the heap has failed.\n          **\n          ** This is a difficult situation to handle. Returning an error\n          ** code to the caller is insufficient, as even if an error code\n          ** is returned the transaction on connection db will still be\n          ** closed and the unlock-notify callbacks on blocked connections\n          ** will go unissued. This might cause the application to wait\n          ** indefinitely for an unlock-notify callback that will never \n          ** arrive.\n          **\n          ** Instead, invoke the unlock-notify callback with the context\n          ** array already accumulated. We can then clear the array and\n          ** begin accumulating any further context pointers without \n          ** requiring any dynamic allocation. This is sub-optimal because\n          ** it means that instead of one callback with a large array of\n          ** context pointers the application will receive two or more\n          ** callbacks with smaller arrays of context pointers, which will\n          ** reduce the applications ability to prioritize multiple \n          ** connections. But it is the best that can be done under the\n          ** circumstances.\n          */\n          xUnlockNotify(aArg, nArg);\n          nArg = 0;\n        }\n      }\n      sqlite3EndBenignMalloc();\n\n      aArg[nArg++] = p->pUnlockArg;\n      xUnlockNotify = p->xUnlockNotify;\n      p->pUnlockConnection = 0;\n      p->xUnlockNotify = 0;\n      p->pUnlockArg = 0;\n    }\n\n    /* Step 3. */\n    if( p->pBlockingConnection==0 && p->pUnlockConnection==0 ){\n      /* Remove connection p from the blocked connections list. */\n      *pp = p->pNextBlocked;\n      p->pNextBlocked = 0;\n    }else{\n      pp = &p->pNextBlocked;\n    }\n  }\n\n  if( nArg!=0 ){\n    xUnlockNotify(aArg, nArg);\n  }\n  sqlite3_free(aDyn);\n  leaveMutex();         /* Leave STATIC_MASTER mutex */\n}\n\n/*\n** This is called when the database connection passed as an argument is \n** being closed. The connection is removed from the blocked list.\n*/\nvoid sqlite3ConnectionClosed(sqlite3 *db){\n  sqlite3ConnectionUnlocked(db);\n  enterMutex();\n  removeFromBlockedList(db);\n  checkListProperties(db);\n  leaveMutex();\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/os.c",
    "content": "/*\n** 2005 November 29\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains OS interface code that is common to all\n** architectures.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** If we compile with the SQLITE_TEST macro set, then the following block\n** of code will give us the ability to simulate a disk I/O error.  This\n** is used for testing the I/O recovery logic.\n*/\n#if defined(SQLITE_TEST)\nint sqlite3_io_error_hit = 0;            /* Total number of I/O Errors */\nint sqlite3_io_error_hardhit = 0;        /* Number of non-benign errors */\nint sqlite3_io_error_pending = 0;        /* Count down to first I/O error */\nint sqlite3_io_error_persist = 0;        /* True if I/O errors persist */\nint sqlite3_io_error_benign = 0;         /* True if errors are benign */\nint sqlite3_diskfull_pending = 0;\nint sqlite3_diskfull = 0;\n#endif /* defined(SQLITE_TEST) */\n\n/*\n** When testing, also keep a count of the number of open files.\n*/\n#if defined(SQLITE_TEST)\nint sqlite3_open_file_count = 0;\n#endif /* defined(SQLITE_TEST) */\n\n/*\n** The default SQLite sqlite3_vfs implementations do not allocate\n** memory (actually, os_unix.c allocates a small amount of memory\n** from within OsOpen()), but some third-party implementations may.\n** So we test the effects of a malloc() failing and the sqlite3OsXXX()\n** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro.\n**\n** The following functions are instrumented for malloc() failure\n** testing:\n**\n**     sqlite3OsRead()\n**     sqlite3OsWrite()\n**     sqlite3OsSync()\n**     sqlite3OsFileSize()\n**     sqlite3OsLock()\n**     sqlite3OsCheckReservedLock()\n**     sqlite3OsFileControl()\n**     sqlite3OsShmMap()\n**     sqlite3OsOpen()\n**     sqlite3OsDelete()\n**     sqlite3OsAccess()\n**     sqlite3OsFullPathname()\n**\n*/\n#if defined(SQLITE_TEST)\nint sqlite3_memdebug_vfs_oom_test = 1;\n  #define DO_OS_MALLOC_TEST(x)                                       \\\n  if (sqlite3_memdebug_vfs_oom_test && (!x || !sqlite3JournalIsInMemory(x))) { \\\n    void *pTstAlloc = sqlite3Malloc(10);                             \\\n    if (!pTstAlloc) return SQLITE_IOERR_NOMEM_BKPT;                  \\\n    sqlite3_free(pTstAlloc);                                         \\\n  }\n#else\n  #define DO_OS_MALLOC_TEST(x)\n#endif\n\n/*\n** The following routines are convenience wrappers around methods\n** of the sqlite3_file object.  This is mostly just syntactic sugar. All\n** of this would be completely automatic if SQLite were coded using\n** C++ instead of plain old C.\n*/\nvoid sqlite3OsClose(sqlite3_file *pId){\n  if( pId->pMethods ){\n    pId->pMethods->xClose(pId);\n    pId->pMethods = 0;\n  }\n}\nint sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, i64 offset){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xRead(id, pBuf, amt, offset);\n}\nint sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int amt, i64 offset){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xWrite(id, pBuf, amt, offset);\n}\nint sqlite3OsTruncate(sqlite3_file *id, i64 size){\n  return id->pMethods->xTruncate(id, size);\n}\nint sqlite3OsSync(sqlite3_file *id, int flags){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xSync(id, flags);\n}\nint sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xFileSize(id, pSize);\n}\nint sqlite3OsLock(sqlite3_file *id, int lockType){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xLock(id, lockType);\n}\nint sqlite3OsUnlock(sqlite3_file *id, int lockType){\n  return id->pMethods->xUnlock(id, lockType);\n}\nint sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xCheckReservedLock(id, pResOut);\n}\n\n/*\n** Use sqlite3OsFileControl() when we are doing something that might fail\n** and we need to know about the failures.  Use sqlite3OsFileControlHint()\n** when simply tossing information over the wall to the VFS and we do not\n** really care if the VFS receives and understands the information since it\n** is only a hint and can be safely ignored.  The sqlite3OsFileControlHint()\n** routine has no return value since the return value would be meaningless.\n*/\nint sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){\n#ifdef SQLITE_TEST\n  if( op!=SQLITE_FCNTL_COMMIT_PHASETWO ){\n    /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite\n    ** is using a regular VFS, it is called after the corresponding\n    ** transaction has been committed. Injecting a fault at this point\n    ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM\n    ** but the transaction is committed anyway.\n    **\n    ** The core must call OsFileControl() though, not OsFileControlHint(),\n    ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably\n    ** means the commit really has failed and an error should be returned\n    ** to the user.  */\n    DO_OS_MALLOC_TEST(id);\n  }\n#endif\n  return id->pMethods->xFileControl(id, op, pArg);\n}\nvoid sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){\n  (void)id->pMethods->xFileControl(id, op, pArg);\n}\n\nint sqlite3OsSectorSize(sqlite3_file *id){\n  int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;\n  return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);\n}\nint sqlite3OsDeviceCharacteristics(sqlite3_file *id){\n  return id->pMethods->xDeviceCharacteristics(id);\n}\nint sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){\n  return id->pMethods->xShmLock(id, offset, n, flags);\n}\nvoid sqlite3OsShmBarrier(sqlite3_file *id){\n  id->pMethods->xShmBarrier(id);\n}\nint sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){\n  return id->pMethods->xShmUnmap(id, deleteFlag);\n}\nint sqlite3OsShmMap(\n  sqlite3_file *id,               /* Database file handle */\n  int iPage,\n  int pgsz,\n  int bExtend,                    /* True to extend file if necessary */\n  void volatile **pp              /* OUT: Pointer to mapping */\n){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);\n}\n\n#if SQLITE_MAX_MMAP_SIZE>0\n/* The real implementation of xFetch and xUnfetch */\nint sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){\n  DO_OS_MALLOC_TEST(id);\n  return id->pMethods->xFetch(id, iOff, iAmt, pp);\n}\nint sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){\n  return id->pMethods->xUnfetch(id, iOff, p);\n}\n#else\n/* No-op stubs to use when memory-mapped I/O is disabled */\nint sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){\n  *pp = 0;\n  return SQLITE_OK;\n}\nint sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** The next group of routines are convenience wrappers around the\n** VFS methods.\n*/\nint sqlite3OsOpen(\n  sqlite3_vfs *pVfs,\n  const char *zPath,\n  sqlite3_file *pFile,\n  int flags,\n  int *pFlagsOut\n){\n  int rc;\n  DO_OS_MALLOC_TEST(0);\n  /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed\n  ** down into the VFS layer.  Some SQLITE_OPEN_ flags (for example,\n  ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before\n  ** reaching the VFS. */\n  rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f7f, pFlagsOut);\n  assert( rc==SQLITE_OK || pFile->pMethods==0 );\n  return rc;\n}\nint sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){\n  DO_OS_MALLOC_TEST(0);\n  assert( dirSync==0 || dirSync==1 );\n  return pVfs->xDelete(pVfs, zPath, dirSync);\n}\nint sqlite3OsAccess(\n  sqlite3_vfs *pVfs,\n  const char *zPath,\n  int flags,\n  int *pResOut\n){\n  DO_OS_MALLOC_TEST(0);\n  return pVfs->xAccess(pVfs, zPath, flags, pResOut);\n}\nint sqlite3OsFullPathname(\n  sqlite3_vfs *pVfs,\n  const char *zPath,\n  int nPathOut,\n  char *zPathOut\n){\n  DO_OS_MALLOC_TEST(0);\n  zPathOut[0] = 0;\n  return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);\n}\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\nvoid *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){\n  return pVfs->xDlOpen(pVfs, zPath);\n}\nvoid sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){\n  pVfs->xDlError(pVfs, nByte, zBufOut);\n}\nvoid (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){\n  return pVfs->xDlSym(pVfs, pHdle, zSym);\n}\nvoid sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){\n  pVfs->xDlClose(pVfs, pHandle);\n}\n#endif /* SQLITE_OMIT_LOAD_EXTENSION */\nint sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){\n  return pVfs->xRandomness(pVfs, nByte, zBufOut);\n}\nint sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){\n  return pVfs->xSleep(pVfs, nMicro);\n}\nint sqlite3OsGetLastError(sqlite3_vfs *pVfs){\n  return pVfs->xGetLastError ? pVfs->xGetLastError(pVfs, 0, 0) : 0;\n}\nint sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){\n  int rc;\n  /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64()\n  ** method to get the current date and time if that method is available\n  ** (if iVersion is 2 or greater and the function pointer is not NULL) and\n  ** will fall back to xCurrentTime() if xCurrentTimeInt64() is\n  ** unavailable.\n  */\n  if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){\n    rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut);\n  }else{\n    double r;\n    rc = pVfs->xCurrentTime(pVfs, &r);\n    *pTimeOut = (sqlite3_int64)(r*86400000.0);\n  }\n  return rc;\n}\n\nint sqlite3OsOpenMalloc(\n  sqlite3_vfs *pVfs,\n  const char *zFile,\n  sqlite3_file **ppFile,\n  int flags,\n  int *pOutFlags\n){\n  int rc;\n  sqlite3_file *pFile;\n  pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);\n  if( pFile ){\n    rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags);\n    if( rc!=SQLITE_OK ){\n      sqlite3_free(pFile);\n    }else{\n      *ppFile = pFile;\n    }\n  }else{\n    rc = SQLITE_NOMEM_BKPT;\n  }\n  return rc;\n}\nvoid sqlite3OsCloseFree(sqlite3_file *pFile){\n  assert( pFile );\n  sqlite3OsClose(pFile);\n  sqlite3_free(pFile);\n}\n\n/*\n** This function is a wrapper around the OS specific implementation of\n** sqlite3_os_init(). The purpose of the wrapper is to provide the\n** ability to simulate a malloc failure, so that the handling of an\n** error in sqlite3_os_init() by the upper layers can be tested.\n*/\nint sqlite3OsInit(void){\n  void *p = sqlite3_malloc(10);\n  if( p==0 ) return SQLITE_NOMEM_BKPT;\n  sqlite3_free(p);\n  return sqlite3_os_init();\n}\n\n/*\n** The list of all registered VFS implementations.\n*/\nstatic sqlite3_vfs * SQLITE_WSD vfsList = 0;\n#define vfsList GLOBAL(sqlite3_vfs *, vfsList)\n\n/*\n** Locate a VFS by name.  If no name is given, simply return the\n** first VFS on the list.\n*/\nsqlite3_vfs *sqlite3_vfs_find(const char *zVfs){\n  sqlite3_vfs *pVfs = 0;\n#if SQLITE_THREADSAFE\n  sqlite3_mutex *mutex;\n#endif\n#ifndef SQLITE_OMIT_AUTOINIT\n  int rc = sqlite3_initialize();\n  if( rc ) return 0;\n#endif\n#if SQLITE_THREADSAFE\n  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n#endif\n  sqlite3_mutex_enter(mutex);\n  for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){\n    if( zVfs==0 ) break;\n    if( strcmp(zVfs, pVfs->zName)==0 ) break;\n  }\n  sqlite3_mutex_leave(mutex);\n  return pVfs;\n}\n\n/*\n** Unlink a VFS from the linked list\n*/\nstatic void vfsUnlink(sqlite3_vfs *pVfs){\n  assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) );\n  if( pVfs==0 ){\n    /* No-op */\n  }else if( vfsList==pVfs ){\n    vfsList = pVfs->pNext;\n  }else if( vfsList ){\n    sqlite3_vfs *p = vfsList;\n    while( p->pNext && p->pNext!=pVfs ){\n      p = p->pNext;\n    }\n    if( p->pNext==pVfs ){\n      p->pNext = pVfs->pNext;\n    }\n  }\n}\n\n/*\n** Register a VFS with the system.  It is harmless to register the same\n** VFS multiple times.  The new VFS becomes the default if makeDflt is\n** true.\n*/\nint sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){\n  MUTEX_LOGIC(sqlite3_mutex *mutex;)\n#ifndef SQLITE_OMIT_AUTOINIT\n  int rc = sqlite3_initialize();\n  if( rc ) return rc;\n#endif\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( pVfs==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n\n  MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); )\n  sqlite3_mutex_enter(mutex);\n  vfsUnlink(pVfs);\n  if( makeDflt || vfsList==0 ){\n    pVfs->pNext = vfsList;\n    vfsList = pVfs;\n  }else{\n    pVfs->pNext = vfsList->pNext;\n    vfsList->pNext = pVfs;\n  }\n  assert(vfsList);\n  sqlite3_mutex_leave(mutex);\n  return SQLITE_OK;\n}\n\n/*\n** Unregister a VFS so that it is no longer accessible.\n*/\nint sqlite3_vfs_unregister(sqlite3_vfs *pVfs){\n#if SQLITE_THREADSAFE\n  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);\n#endif\n  sqlite3_mutex_enter(mutex);\n  vfsUnlink(pVfs);\n  sqlite3_mutex_leave(mutex);\n  return SQLITE_OK;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/os.h",
    "content": "/*\n** 2001 September 16\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This header file (together with is companion C source-code file\n** \"os.c\") attempt to abstract the underlying operating system so that\n** the SQLite library will work on both POSIX and windows systems.\n**\n** This header file is #include-ed by sqliteInt.h and thus ends up\n** being included by every source file.\n*/\n#ifndef _SQLITE_OS_H_\n#define _SQLITE_OS_H_\n\n/*\n** Attempt to automatically detect the operating system and setup the\n** necessary pre-processor macros for it.\n*/\n#include \"os_setup.h\"\n\n/* If the SET_FULLSYNC macro is not defined above, then make it\n** a no-op\n*/\n#ifndef SET_FULLSYNC\n# define SET_FULLSYNC(x,y)\n#endif\n\n/*\n** The default size of a disk sector\n*/\n#ifndef SQLITE_DEFAULT_SECTOR_SIZE\n# define SQLITE_DEFAULT_SECTOR_SIZE 4096\n#endif\n\n/*\n** Temporary files are named starting with this prefix followed by 16 random\n** alphanumeric characters, and no file extension. They are stored in the\n** OS's standard temporary file directory, and are deleted prior to exit.\n** If sqlite is being embedded in another program, you may wish to change the\n** prefix to reflect your program's name, so that if your program exits\n** prematurely, old temporary files can be easily identified. This can be done\n** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line.\n**\n** 2006-10-31:  The default prefix used to be \"sqlite_\".  But then\n** Mcafee started using SQLite in their anti-virus product and it\n** started putting files with the \"sqlite\" name in the c:/temp folder.\n** This annoyed many windows users.  Those users would then do a \n** Google search for \"sqlite\", find the telephone numbers of the\n** developers and call to wake them up at night and complain.\n** For this reason, the default name prefix is changed to be \"sqlite\" \n** spelled backwards.  So the temp files are still identified, but\n** anybody smart enough to figure out the code is also likely smart\n** enough to know that calling the developer will not help get rid\n** of the file.\n*/\n#ifndef SQLITE_TEMP_FILE_PREFIX\n# define SQLITE_TEMP_FILE_PREFIX \"etilqs_\"\n#endif\n\n/*\n** The following values may be passed as the second argument to\n** sqlite3OsLock(). The various locks exhibit the following semantics:\n**\n** SHARED:    Any number of processes may hold a SHARED lock simultaneously.\n** RESERVED:  A single process may hold a RESERVED lock on a file at\n**            any time. Other processes may hold and obtain new SHARED locks.\n** PENDING:   A single process may hold a PENDING lock on a file at\n**            any one time. Existing SHARED locks may persist, but no new\n**            SHARED locks may be obtained by other processes.\n** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks.\n**\n** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a\n** process that requests an EXCLUSIVE lock may actually obtain a PENDING\n** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to\n** sqlite3OsLock().\n*/\n#define NO_LOCK         0\n#define SHARED_LOCK     1\n#define RESERVED_LOCK   2\n#define PENDING_LOCK    3\n#define EXCLUSIVE_LOCK  4\n\n/*\n** File Locking Notes:  (Mostly about windows but also some info for Unix)\n**\n** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because\n** those functions are not available.  So we use only LockFile() and\n** UnlockFile().\n**\n** LockFile() prevents not just writing but also reading by other processes.\n** A SHARED_LOCK is obtained by locking a single randomly-chosen \n** byte out of a specific range of bytes. The lock byte is obtained at \n** random so two separate readers can probably access the file at the \n** same time, unless they are unlucky and choose the same lock byte.\n** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range.\n** There can only be one writer.  A RESERVED_LOCK is obtained by locking\n** a single byte of the file that is designated as the reserved lock byte.\n** A PENDING_LOCK is obtained by locking a designated byte different from\n** the RESERVED_LOCK byte.\n**\n** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available,\n** which means we can use reader/writer locks.  When reader/writer locks\n** are used, the lock is placed on the same range of bytes that is used\n** for probabilistic locking in Win95/98/ME.  Hence, the locking scheme\n** will support two or more Win95 readers or two or more WinNT readers.\n** But a single Win95 reader will lock out all WinNT readers and a single\n** WinNT reader will lock out all other Win95 readers.\n**\n** The following #defines specify the range of bytes used for locking.\n** SHARED_SIZE is the number of bytes available in the pool from which\n** a random byte is selected for a shared lock.  The pool of bytes for\n** shared locks begins at SHARED_FIRST. \n**\n** The same locking strategy and\n** byte ranges are used for Unix.  This leaves open the possibility of having\n** clients on win95, winNT, and unix all talking to the same shared file\n** and all locking correctly.  To do so would require that samba (or whatever\n** tool is being used for file sharing) implements locks correctly between\n** windows and unix.  I'm guessing that isn't likely to happen, but by\n** using the same locking range we are at least open to the possibility.\n**\n** Locking in windows is manditory.  For this reason, we cannot store\n** actual data in the bytes used for locking.  The pager never allocates\n** the pages involved in locking therefore.  SHARED_SIZE is selected so\n** that all locks will fit on a single page even at the minimum page size.\n** PENDING_BYTE defines the beginning of the locks.  By default PENDING_BYTE\n** is set high so that we don't have to allocate an unused page except\n** for very large databases.  But one should test the page skipping logic \n** by setting PENDING_BYTE low and running the entire regression suite.\n**\n** Changing the value of PENDING_BYTE results in a subtly incompatible\n** file format.  Depending on how it is changed, you might not notice\n** the incompatibility right away, even running a full regression test.\n** The default location of PENDING_BYTE is the first byte past the\n** 1GB boundary.\n**\n*/\n#ifdef SQLITE_OMIT_WSD\n# define PENDING_BYTE     (0x40000000)\n#else\n# define PENDING_BYTE      sqlite3PendingByte\n#endif\n#define RESERVED_BYTE     (PENDING_BYTE+1)\n#define SHARED_FIRST      (PENDING_BYTE+2)\n#define SHARED_SIZE       510\n\n/*\n** Wrapper around OS specific sqlite3_os_init() function.\n*/\nint sqlite3OsInit(void);\n\n/* \n** Functions for accessing sqlite3_file methods \n*/\nvoid sqlite3OsClose(sqlite3_file*);\nint sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset);\nint sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset);\nint sqlite3OsTruncate(sqlite3_file*, i64 size);\nint sqlite3OsSync(sqlite3_file*, int);\nint sqlite3OsFileSize(sqlite3_file*, i64 *pSize);\nint sqlite3OsLock(sqlite3_file*, int);\nint sqlite3OsUnlock(sqlite3_file*, int);\nint sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut);\nint sqlite3OsFileControl(sqlite3_file*,int,void*);\nvoid sqlite3OsFileControlHint(sqlite3_file*,int,void*);\n#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0\nint sqlite3OsSectorSize(sqlite3_file *id);\nint sqlite3OsDeviceCharacteristics(sqlite3_file *id);\nint sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **);\nint sqlite3OsShmLock(sqlite3_file *id, int, int, int);\nvoid sqlite3OsShmBarrier(sqlite3_file *id);\nint sqlite3OsShmUnmap(sqlite3_file *id, int);\nint sqlite3OsFetch(sqlite3_file *id, i64, int, void **);\nint sqlite3OsUnfetch(sqlite3_file *, i64, void *);\n\n\n/* \n** Functions for accessing sqlite3_vfs methods \n*/\nint sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *);\nint sqlite3OsDelete(sqlite3_vfs *, const char *, int);\nint sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut);\nint sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *);\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\nvoid *sqlite3OsDlOpen(sqlite3_vfs *, const char *);\nvoid sqlite3OsDlError(sqlite3_vfs *, int, char *);\nvoid (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void);\nvoid sqlite3OsDlClose(sqlite3_vfs *, void *);\n#endif /* SQLITE_OMIT_LOAD_EXTENSION */\nint sqlite3OsRandomness(sqlite3_vfs *, int, char *);\nint sqlite3OsSleep(sqlite3_vfs *, int);\nint sqlite3OsGetLastError(sqlite3_vfs*);\nint sqlite3OsCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64*);\n\n/*\n** Convenience functions for opening and closing files using \n** sqlite3_malloc() to obtain space for the file-handle structure.\n*/\nint sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*);\nvoid sqlite3OsCloseFree(sqlite3_file *);\n\n#if SQLITE_WCDB_SIGNAL_RETRY\nvoid sqlite3OsSetWait(sqlite3_file *, int);\nint sqlite3OsGetWait(sqlite3_file *);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n#endif /* _SQLITE_OS_H_ */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/os_common.h",
    "content": "/*\n** 2004 May 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains macros and a little bit of code that is common to\n** all of the platform-specific files (os_*.c) and is #included into those\n** files.\n**\n** This file should be #included by the os_*.c files only.  It is not a\n** general purpose header file.\n*/\n#ifndef _OS_COMMON_H_\n#define _OS_COMMON_H_\n\n/*\n** At least two bugs have slipped in because we changed the MEMORY_DEBUG\n** macro to SQLITE_DEBUG and some older makefiles have not yet made the\n** switch.  The following code should catch this problem at compile-time.\n*/\n#ifdef MEMORY_DEBUG\n# error \"The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead.\"\n#endif\n\n/*\n** Macros for performance tracing.  Normally turned off.  Only works\n** on i486 hardware.\n*/\n#ifdef SQLITE_PERFORMANCE_TRACE\n\n/*\n** hwtime.h contains inline assembler code for implementing\n** high-performance timing routines.\n*/\n#include \"hwtime.h\"\n\nstatic sqlite_uint64 g_start;\nstatic sqlite_uint64 g_elapsed;\n#define TIMER_START       g_start=sqlite3Hwtime()\n#define TIMER_END         g_elapsed=sqlite3Hwtime()-g_start\n#define TIMER_ELAPSED     g_elapsed\n#else\n#define TIMER_START\n#define TIMER_END\n#define TIMER_ELAPSED     ((sqlite_uint64)0)\n#endif\n\n/*\n** If we compile with the SQLITE_TEST macro set, then the following block\n** of code will give us the ability to simulate a disk I/O error.  This\n** is used for testing the I/O recovery logic.\n*/\n#if defined(SQLITE_TEST)\nextern int sqlite3_io_error_hit;\nextern int sqlite3_io_error_hardhit;\nextern int sqlite3_io_error_pending;\nextern int sqlite3_io_error_persist;\nextern int sqlite3_io_error_benign;\nextern int sqlite3_diskfull_pending;\nextern int sqlite3_diskfull;\n#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X)\n#define SimulateIOError(CODE)  \\\n  if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \\\n       || sqlite3_io_error_pending-- == 1 )  \\\n              { local_ioerr(); CODE; }\nstatic void local_ioerr(){\n  IOTRACE((\"IOERR\\n\"));\n  sqlite3_io_error_hit++;\n  if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++;\n}\n#define SimulateDiskfullError(CODE) \\\n   if( sqlite3_diskfull_pending ){ \\\n     if( sqlite3_diskfull_pending == 1 ){ \\\n       local_ioerr(); \\\n       sqlite3_diskfull = 1; \\\n       sqlite3_io_error_hit = 1; \\\n       CODE; \\\n     }else{ \\\n       sqlite3_diskfull_pending--; \\\n     } \\\n   }\n#else\n#define SimulateIOErrorBenign(X)\n#define SimulateIOError(A)\n#define SimulateDiskfullError(A)\n#endif /* defined(SQLITE_TEST) */\n\n/*\n** When testing, keep a count of the number of open files.\n*/\n#if defined(SQLITE_TEST)\nextern int sqlite3_open_file_count;\n#define OpenCounter(X)  sqlite3_open_file_count+=(X)\n#else\n#define OpenCounter(X)\n#endif /* defined(SQLITE_TEST) */\n\n#endif /* !defined(_OS_COMMON_H_) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/os_setup.h",
    "content": "/*\n** 2013 November 25\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains pre-processor directives related to operating system\n** detection and/or setup.\n*/\n#ifndef SQLITE_OS_SETUP_H\n#define SQLITE_OS_SETUP_H\n\n/*\n** Figure out if we are dealing with Unix, Windows, or some other operating\n** system.\n**\n** After the following block of preprocess macros, all of SQLITE_OS_UNIX,\n** SQLITE_OS_WIN, and SQLITE_OS_OTHER will defined to either 1 or 0.  One of\n** the three will be 1.  The other two will be 0.\n*/\n#if defined(SQLITE_OS_OTHER)\n#  if SQLITE_OS_OTHER==1\n#    undef SQLITE_OS_UNIX\n#    define SQLITE_OS_UNIX 0\n#    undef SQLITE_OS_WIN\n#    define SQLITE_OS_WIN 0\n#  else\n#    undef SQLITE_OS_OTHER\n#  endif\n#endif\n#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)\n#  define SQLITE_OS_OTHER 0\n#  ifndef SQLITE_OS_WIN\n#    if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \\\n        defined(__MINGW32__) || defined(__BORLANDC__)\n#      define SQLITE_OS_WIN 1\n#      define SQLITE_OS_UNIX 0\n#    else\n#      define SQLITE_OS_WIN 0\n#      define SQLITE_OS_UNIX 1\n#    endif\n#  else\n#    define SQLITE_OS_UNIX 0\n#  endif\n#else\n#  ifndef SQLITE_OS_WIN\n#    define SQLITE_OS_WIN 0\n#  endif\n#endif\n\n#endif /* SQLITE_OS_SETUP_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/os_unix.c",
    "content": "/*\n** 2004 May 22\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains the VFS implementation for unix-like operating systems\n** include Linux, MacOSX, *BSD, QNX, VxWorks, AIX, HPUX, and others.\n**\n** There are actually several different VFS implementations in this file.\n** The differences are in the way that file locking is done.  The default\n** implementation uses Posix Advisory Locks.  Alternative implementations\n** use flock(), dot-files, various proprietary locking schemas, or simply\n** skip locking all together.\n**\n** This source file is organized into divisions where the logic for various\n** subfunctions is contained within the appropriate division.  PLEASE\n** KEEP THE STRUCTURE OF THIS FILE INTACT.  New code should be placed\n** in the correct division and should be clearly labeled.\n**\n** The layout of divisions is as follows:\n**\n**   *  General-purpose declarations and utility functions.\n**   *  Unique file ID logic used by VxWorks.\n**   *  Various locking primitive implementations (all except proxy locking):\n**      + for Posix Advisory Locks\n**      + for no-op locks\n**      + for dot-file locks\n**      + for flock() locking\n**      + for named semaphore locks (VxWorks only)\n**      + for AFP filesystem locks (MacOSX only)\n**   *  sqlite3_file methods not associated with locking.\n**   *  Definitions of sqlite3_io_methods objects for all locking\n**      methods plus \"finder\" functions for each locking method.\n**   *  sqlite3_vfs method implementations.\n**   *  Locking primitives for the proxy uber-locking-method. (MacOSX only)\n**   *  Definitions of sqlite3_vfs objects for all locking methods\n**      plus implementations of sqlite3_os_init() and sqlite3_os_end().\n*/\n#include \"sqliteInt.h\"\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n#include \"os_wcdb.h\"\n#include \"queue.h\"\n#include \"mutex_wcdb.h\"\n#endif//SQLITE_WCDB_SIGNAL_RETRY\n\n#if SQLITE_OS_UNIX              /* This file is used on unix only */\n\n/*\n** There are various methods for file locking used for concurrency\n** control:\n**\n**   1. POSIX locking (the default),\n**   2. No locking,\n**   3. Dot-file locking,\n**   4. flock() locking,\n**   5. AFP locking (OSX only),\n**   6. Named POSIX semaphores (VXWorks only),\n**   7. proxy locking. (OSX only)\n**\n** Styles 4, 5, and 7 are only available of SQLITE_ENABLE_LOCKING_STYLE\n** is defined to 1.  The SQLITE_ENABLE_LOCKING_STYLE also enables automatic\n** selection of the appropriate locking style based on the filesystem\n** where the database is located.  \n*/\n#if !defined(SQLITE_ENABLE_LOCKING_STYLE)\n#  if defined(__APPLE__)\n#    define SQLITE_ENABLE_LOCKING_STYLE 1\n#  else\n#    define SQLITE_ENABLE_LOCKING_STYLE 0\n#  endif\n#endif\n\n/* Use pread() and pwrite() if they are available */\n#if defined(__APPLE__)\n# define HAVE_PREAD 1\n# define HAVE_PWRITE 1\n#endif\n#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64)\n# undef USE_PREAD\n# define USE_PREAD64 1\n#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE)\n# undef USE_PREAD64\n# define USE_PREAD 1\n#endif\n\n/*\n** standard include files.\n*/\n#include <sys/types.h>\n#include <sys/stat.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <time.h>\n#include <sys/time.h>\n#include <errno.h>\n#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0\n# include <sys/mman.h>\n#endif\n\n#if SQLITE_ENABLE_LOCKING_STYLE\n# include <sys/ioctl.h>\n# include <sys/file.h>\n# include <sys/param.h>\n#endif /* SQLITE_ENABLE_LOCKING_STYLE */\n\n#if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \\\n                           (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000))\n#  if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \\\n       && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0))\n#    define HAVE_GETHOSTUUID 1\n#  else\n//#    warning \"gethostuuid() is disabled.\"\n#  endif\n#endif\n\n\n#if OS_VXWORKS\n# include <sys/ioctl.h>\n# include <semaphore.h>\n# include <limits.h>\n#endif /* OS_VXWORKS */\n\n#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE\n# include <sys/mount.h>\n#endif\n\n#ifdef HAVE_UTIME\n# include <utime.h>\n#endif\n\n/*\n** Allowed values of unixFile.fsFlags\n*/\n#define SQLITE_FSFLAGS_IS_MSDOS     0x1\n\n/*\n** If we are to be thread-safe, include the pthreads header and define\n** the SQLITE_UNIX_THREADS macro.\n*/\n#if SQLITE_THREADSAFE\n# include <pthread.h>\n# define SQLITE_UNIX_THREADS 1\n#endif\n\n/*\n** Default permissions when creating a new file\n*/\n#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS\n# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644\n#endif\n\n/*\n** Default permissions when creating auto proxy dir\n*/\n#ifndef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS\n# define SQLITE_DEFAULT_PROXYDIR_PERMISSIONS 0755\n#endif\n\n/*\n** Maximum supported path-length.\n*/\n#define MAX_PATHNAME 512\n\n/*\n** Maximum supported symbolic links\n*/\n#define SQLITE_MAX_SYMLINKS 100\n\n/* Always cast the getpid() return type for compatibility with\n** kernel modules in VxWorks. */\n#define osGetpid(X) (pid_t)getpid()\n\n/*\n** Only set the lastErrno if the error code is a real error and not \n** a normal expected return code of SQLITE_BUSY or SQLITE_OK\n*/\n#define IS_LOCK_ERROR(x)  ((x != SQLITE_OK) && (x != SQLITE_BUSY))\n\n/* Forward references */\ntypedef struct unixShm unixShm;               /* Connection shared memory */\ntypedef struct unixShmNode unixShmNode;       /* Shared memory instance */\ntypedef struct unixInodeInfo unixInodeInfo;   /* An i-node */\ntypedef struct UnixUnusedFd UnixUnusedFd;     /* An unused file descriptor */\n\n/*\n** Sometimes, after a file handle is closed by SQLite, the file descriptor\n** cannot be closed immediately. In these cases, instances of the following\n** structure are used to store the file descriptor while waiting for an\n** opportunity to either close or reuse it.\n*/\nstruct UnixUnusedFd {\n  int fd;                   /* File descriptor to close */\n  int flags;                /* Flags this file descriptor was opened with */\n  UnixUnusedFd *pNext;      /* Next unused file descriptor on same file */\n};\n\n/*\n** The unixFile structure is subclass of sqlite3_file specific to the unix\n** VFS implementations.\n*/\ntypedef struct unixFile unixFile;\nstruct unixFile {\n  sqlite3_io_methods const *pMethod;  /* Always the first entry */\n  sqlite3_vfs *pVfs;                  /* The VFS that created this unixFile */\n  unixInodeInfo *pInode;              /* Info about locks on this inode */\n  int h;                              /* The file descriptor */\n  unsigned char eFileLock;            /* The type of lock held on this fd */\n  unsigned short int ctrlFlags;       /* Behavioral bits.  UNIXFILE_* flags */\n  int lastErrno;                      /* The unix errno from last I/O error */\n  void *lockingContext;               /* Locking style specific state */\n  UnixUnusedFd *pUnused;              /* Pre-allocated UnixUnusedFd */\n  const char *zPath;                  /* Name of the file */\n  unixShm *pShm;                      /* Shared memory segment information */\n  int szChunk;                        /* Configured by FCNTL_CHUNK_SIZE */\n#if SQLITE_MAX_MMAP_SIZE>0\n  int nFetchOut;                      /* Number of outstanding xFetch refs */\n  sqlite3_int64 mmapSize;             /* Usable size of mapping at pMapRegion */\n  sqlite3_int64 mmapSizeActual;       /* Actual size of mapping at pMapRegion */\n  sqlite3_int64 mmapSizeMax;          /* Configured FCNTL_MMAP_SIZE value */\n  void *pMapRegion;                   /* Memory mapped region */\n#endif\n#ifdef __QNXNTO__\n  int sectorSize;                     /* Device sector size */\n  int deviceCharacteristics;          /* Precomputed device characteristics */\n#endif\n#if SQLITE_ENABLE_LOCKING_STYLE\n  int openFlags;                      /* The flags specified at open() */\n#endif\n#if SQLITE_ENABLE_LOCKING_STYLE || defined(__APPLE__)\n  unsigned fsFlags;                   /* cached details from statfs() */\n#endif\n#if OS_VXWORKS\n  struct vxworksFileId *pId;          /* Unique file ID */\n#endif\n#ifdef SQLITE_DEBUG\n  /* The next group of variables are used to track whether or not the\n  ** transaction counter in bytes 24-27 of database files are updated\n  ** whenever any part of the database changes.  An assertion fault will\n  ** occur if a file is updated without also updating the transaction\n  ** counter.  This test is made to avoid new problems similar to the\n  ** one described by ticket #3584. \n  */\n  unsigned char transCntrChng;   /* True if the transaction counter changed */\n  unsigned char dbUpdate;        /* True if any part of database file changed */\n  unsigned char inNormalWrite;   /* True if in a normal write operation */\n\n#endif\n\n#ifdef SQLITE_TEST\n  /* In test mode, increase the size of this structure a bit so that \n  ** it is larger than the struct CrashFile defined in test6.c.\n  */\n  char aPadding[32];\n#endif\n#if SQLITE_WCDB_SIGNAL_RETRY\n  int bWait;\n#endif //SQLITE_WCDB_SIGNAL_RETRY\n};\n\n/* This variable holds the process id (pid) from when the xRandomness()\n** method was called.  If xOpen() is called from a different process id,\n** indicating that a fork() has occurred, the PRNG will be reset.\n*/\nstatic pid_t randomnessPid = 0;\n\n/*\n** Allowed values for the unixFile.ctrlFlags bitmask:\n*/\n#define UNIXFILE_EXCL        0x01     /* Connections from one process only */\n#define UNIXFILE_RDONLY      0x02     /* Connection is read only */\n#define UNIXFILE_PERSIST_WAL 0x04     /* Persistent WAL mode */\n#ifndef SQLITE_DISABLE_DIRSYNC\n# define UNIXFILE_DIRSYNC    0x08     /* Directory sync needed */\n#else\n# define UNIXFILE_DIRSYNC    0x00\n#endif\n#define UNIXFILE_PSOW        0x10     /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */\n#define UNIXFILE_DELETE      0x20     /* Delete on close */\n#define UNIXFILE_URI         0x40     /* Filename might have query parameters */\n#define UNIXFILE_NOLOCK      0x80     /* Do no file locking */\n\n/*\n** Include code that is common to all os_*.c files\n*/\n#include \"os_common.h\"\n\n/*\n** Define various macros that are missing from some systems.\n*/\n#ifndef O_LARGEFILE\n# define O_LARGEFILE 0\n#endif\n#ifdef SQLITE_DISABLE_LFS\n# undef O_LARGEFILE\n# define O_LARGEFILE 0\n#endif\n#ifndef O_NOFOLLOW\n# define O_NOFOLLOW 0\n#endif\n#ifndef O_BINARY\n# define O_BINARY 0\n#endif\n\n/*\n** The threadid macro resolves to the thread-id or to 0.  Used for\n** testing and debugging only.\n*/\n#if SQLITE_THREADSAFE\n#define threadid pthread_self()\n#else\n#define threadid 0\n#endif\n\n/*\n** HAVE_MREMAP defaults to true on Linux and false everywhere else.\n*/\n#if !defined(HAVE_MREMAP)\n# if defined(__linux__) && defined(_GNU_SOURCE)\n#  define HAVE_MREMAP 1\n# else\n#  define HAVE_MREMAP 0\n# endif\n#endif\n\n/*\n** Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek()\n** is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined.\n*/\n#ifdef __ANDROID__\n\n# include <android/api-level.h>\n# if __ANDROID_API__ < 12\n/* Android API < 12 lacks ftruncate64 implementation. */\n# include <sys/syscall.h>\nstatic int ftruncate64(int fd, off64_t size) {\n  return syscall(__NR_ftruncate64, fd, 0, size & 0xFFFFFFFF, size >> 32);\n}\n# endif\n\n# define lseek lseek64\n#endif\n\n/*\n** Different Unix systems declare open() in different ways.  Same use\n** open(const char*,int,mode_t).  Others use open(const char*,int,...).\n** The difference is important when using a pointer to the function.\n**\n** The safest way to deal with the problem is to always use this wrapper\n** which always has the same well-defined interface.\n*/\nstatic int posixOpen(const char *zFile, int flags, int mode){\n  return open(zFile, flags, mode);\n}\n\n/* Forward reference */\nstatic int openDirectory(const char*, int*);\nstatic int unixGetpagesize(void);\n\n/*\n** Many system calls are accessed through pointer-to-functions so that\n** they may be overridden at runtime to facilitate fault injection during\n** testing and sandboxing.  The following array holds the names and pointers\n** to all overrideable system calls.\n*/\nstatic struct unix_syscall {\n  const char *zName;            /* Name of the system call */\n  sqlite3_syscall_ptr pCurrent; /* Current value of the system call */\n  sqlite3_syscall_ptr pDefault; /* Default value */\n} aSyscall[] = {\n  { \"open\",         (sqlite3_syscall_ptr)posixOpen,  0  },\n#define osOpen      ((int(*)(const char*,int,int))aSyscall[0].pCurrent)\n\n  { \"close\",        (sqlite3_syscall_ptr)close,      0  },\n#define osClose     ((int(*)(int))aSyscall[1].pCurrent)\n\n  { \"access\",       (sqlite3_syscall_ptr)access,     0  },\n#define osAccess    ((int(*)(const char*,int))aSyscall[2].pCurrent)\n\n  { \"getcwd\",       (sqlite3_syscall_ptr)getcwd,     0  },\n#define osGetcwd    ((char*(*)(char*,size_t))aSyscall[3].pCurrent)\n\n  { \"stat\",         (sqlite3_syscall_ptr)stat,       0  },\n#define osStat      ((int(*)(const char*,struct stat*))aSyscall[4].pCurrent)\n\n/*\n** The DJGPP compiler environment looks mostly like Unix, but it\n** lacks the fcntl() system call.  So redefine fcntl() to be something\n** that always succeeds.  This means that locking does not occur under\n** DJGPP.  But it is DOS - what did you expect?\n*/\n#ifdef __DJGPP__\n  { \"fstat\",        0,                 0  },\n#define osFstat(a,b,c)    0\n#else     \n  { \"fstat\",        (sqlite3_syscall_ptr)fstat,      0  },\n#define osFstat     ((int(*)(int,struct stat*))aSyscall[5].pCurrent)\n#endif\n\n#if defined(__ANDROID__)\n  { \"ftruncate\",    (sqlite3_syscall_ptr)ftruncate64, 0 },\n# define osFtruncate ((int(*)(int,off64_t))aSyscall[6].pCurrent)\n#else\n  { \"ftruncate\",    (sqlite3_syscall_ptr)ftruncate,  0  },\n# define osFtruncate ((int(*)(int,off_t))aSyscall[6].pCurrent)\n#endif\n\n  { \"fcntl\",        (sqlite3_syscall_ptr)fcntl,      0  },\n#define osFcntl     ((int(*)(int,int,...))aSyscall[7].pCurrent)\n\n  { \"read\",         (sqlite3_syscall_ptr)read,       0  },\n#define osRead      ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent)\n\n#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE\n  { \"pread\",        (sqlite3_syscall_ptr)pread,      0  },\n#else\n  { \"pread\",        (sqlite3_syscall_ptr)0,          0  },\n#endif\n#define osPread     ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent)\n\n#if defined(USE_PREAD64)\n  { \"pread64\",      (sqlite3_syscall_ptr)pread64,    0  },\n#else\n  { \"pread64\",      (sqlite3_syscall_ptr)0,          0  },\n#endif\n#define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)\n\n  { \"write\",        (sqlite3_syscall_ptr)write,      0  },\n#define osWrite     ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)\n\n#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE\n  { \"pwrite\",       (sqlite3_syscall_ptr)pwrite,     0  },\n#else\n  { \"pwrite\",       (sqlite3_syscall_ptr)0,          0  },\n#endif\n#define osPwrite    ((ssize_t(*)(int,const void*,size_t,off_t))\\\n                    aSyscall[12].pCurrent)\n\n#if defined(USE_PREAD64)\n  { \"pwrite64\",     (sqlite3_syscall_ptr)pwrite64,   0  },\n#else\n  { \"pwrite64\",     (sqlite3_syscall_ptr)0,          0  },\n#endif\n#define osPwrite64  ((ssize_t(*)(int,const void*,size_t,off64_t))\\\n                    aSyscall[13].pCurrent)\n\n  { \"fchmod\",       (sqlite3_syscall_ptr)fchmod,          0  },\n#define osFchmod    ((int(*)(int,mode_t))aSyscall[14].pCurrent)\n\n#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE\n  { \"fallocate\",    (sqlite3_syscall_ptr)posix_fallocate,  0 },\n#else\n  { \"fallocate\",    (sqlite3_syscall_ptr)0,                0 },\n#endif\n#define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent)\n\n  { \"unlink\",       (sqlite3_syscall_ptr)unlink,           0 },\n#define osUnlink    ((int(*)(const char*))aSyscall[16].pCurrent)\n\n  { \"openDirectory\",    (sqlite3_syscall_ptr)openDirectory,      0 },\n#define osOpenDirectory ((int(*)(const char*,int*))aSyscall[17].pCurrent)\n\n  { \"mkdir\",        (sqlite3_syscall_ptr)mkdir,           0 },\n#define osMkdir     ((int(*)(const char*,mode_t))aSyscall[18].pCurrent)\n\n  { \"rmdir\",        (sqlite3_syscall_ptr)rmdir,           0 },\n#define osRmdir     ((int(*)(const char*))aSyscall[19].pCurrent)\n\n#if defined(HAVE_FCHOWN)\n  { \"fchown\",       (sqlite3_syscall_ptr)fchown,          0 },\n#else\n  { \"fchown\",       (sqlite3_syscall_ptr)0,               0 },\n#endif\n#define osFchown    ((int(*)(int,uid_t,gid_t))aSyscall[20].pCurrent)\n\n  { \"geteuid\",      (sqlite3_syscall_ptr)geteuid,         0 },\n#define osGeteuid   ((uid_t(*)(void))aSyscall[21].pCurrent)\n\n#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0\n  { \"mmap\",         (sqlite3_syscall_ptr)mmap,            0 },\n#else\n  { \"mmap\",         (sqlite3_syscall_ptr)0,               0 },\n#endif\n#define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[22].pCurrent)\n\n#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0\n  { \"munmap\",       (sqlite3_syscall_ptr)munmap,          0 },\n#else\n  { \"munmap\",       (sqlite3_syscall_ptr)0,               0 },\n#endif\n#define osMunmap ((void*(*)(void*,size_t))aSyscall[23].pCurrent)\n\n#if HAVE_MREMAP && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)\n  { \"mremap\",       (sqlite3_syscall_ptr)mremap,          0 },\n#else\n  { \"mremap\",       (sqlite3_syscall_ptr)0,               0 },\n#endif\n#define osMremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[24].pCurrent)\n\n#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0\n  { \"getpagesize\",  (sqlite3_syscall_ptr)unixGetpagesize, 0 },\n#else\n  { \"getpagesize\",  (sqlite3_syscall_ptr)0,               0 },\n#endif\n#define osGetpagesize ((int(*)(void))aSyscall[25].pCurrent)\n\n#if defined(HAVE_READLINK)\n  { \"readlink\",     (sqlite3_syscall_ptr)readlink,        0 },\n#else\n  { \"readlink\",     (sqlite3_syscall_ptr)0,               0 },\n#endif\n#define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[26].pCurrent)\n\n#if defined(HAVE_LSTAT)\n  { \"lstat\",         (sqlite3_syscall_ptr)lstat,          0 },\n#else\n  { \"lstat\",         (sqlite3_syscall_ptr)0,              0 },\n#endif\n#define osLstat      ((int(*)(const char*,struct stat*))aSyscall[27].pCurrent)\n\n}; /* End of the overrideable system calls */\n\n\n/*\n** On some systems, calls to fchown() will trigger a message in a security\n** log if they come from non-root processes.  So avoid calling fchown() if\n** we are not running as root.\n*/\nstatic int robustFchown(int fd, uid_t uid, gid_t gid){\n#if defined(HAVE_FCHOWN)\n  return osGeteuid() ? 0 : osFchown(fd,uid,gid);\n#else\n  return 0;\n#endif\n}\n\n/*\n** This is the xSetSystemCall() method of sqlite3_vfs for all of the\n** \"unix\" VFSes.  Return SQLITE_OK opon successfully updating the\n** system call pointer, or SQLITE_NOTFOUND if there is no configurable\n** system call named zName.\n*/\nstatic int unixSetSystemCall(\n  sqlite3_vfs *pNotUsed,        /* The VFS pointer.  Not used */\n  const char *zName,            /* Name of system call to override */\n  sqlite3_syscall_ptr pNewFunc  /* Pointer to new system call value */\n){\n  unsigned int i;\n  int rc = SQLITE_NOTFOUND;\n\n  UNUSED_PARAMETER(pNotUsed);\n  if( zName==0 ){\n    /* If no zName is given, restore all system calls to their default\n    ** settings and return NULL\n    */\n    rc = SQLITE_OK;\n    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\n      if( aSyscall[i].pDefault ){\n        aSyscall[i].pCurrent = aSyscall[i].pDefault;\n      }\n    }\n  }else{\n    /* If zName is specified, operate on only the one system call\n    ** specified.\n    */\n    for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\n      if( strcmp(zName, aSyscall[i].zName)==0 ){\n        if( aSyscall[i].pDefault==0 ){\n          aSyscall[i].pDefault = aSyscall[i].pCurrent;\n        }\n        rc = SQLITE_OK;\n        if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;\n        aSyscall[i].pCurrent = pNewFunc;\n        break;\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** Return the value of a system call.  Return NULL if zName is not a\n** recognized system call name.  NULL is also returned if the system call\n** is currently undefined.\n*/\nstatic sqlite3_syscall_ptr unixGetSystemCall(\n  sqlite3_vfs *pNotUsed,\n  const char *zName\n){\n  unsigned int i;\n\n  UNUSED_PARAMETER(pNotUsed);\n  for(i=0; i<sizeof(aSyscall)/sizeof(aSyscall[0]); i++){\n    if( strcmp(zName, aSyscall[i].zName)==0 ) return aSyscall[i].pCurrent;\n  }\n  return 0;\n}\n\n/*\n** Return the name of the first system call after zName.  If zName==NULL\n** then return the name of the first system call.  Return NULL if zName\n** is the last system call or if zName is not the name of a valid\n** system call.\n*/\nstatic const char *unixNextSystemCall(sqlite3_vfs *p, const char *zName){\n  int i = -1;\n\n  UNUSED_PARAMETER(p);\n  if( zName ){\n    for(i=0; i<ArraySize(aSyscall)-1; i++){\n      if( strcmp(zName, aSyscall[i].zName)==0 ) break;\n    }\n  }\n  for(i++; i<ArraySize(aSyscall); i++){\n    if( aSyscall[i].pCurrent!=0 ) return aSyscall[i].zName;\n  }\n  return 0;\n}\n\n/*\n** Do not accept any file descriptor less than this value, in order to avoid\n** opening database file using file descriptors that are commonly used for \n** standard input, output, and error.\n*/\n#ifndef SQLITE_MINIMUM_FILE_DESCRIPTOR\n# define SQLITE_MINIMUM_FILE_DESCRIPTOR 3\n#endif\n\n/*\n** Invoke open().  Do so multiple times, until it either succeeds or\n** fails for some reason other than EINTR.\n**\n** If the file creation mode \"m\" is 0 then set it to the default for\n** SQLite.  The default is SQLITE_DEFAULT_FILE_PERMISSIONS (normally\n** 0644) as modified by the system umask.  If m is not 0, then\n** make the file creation mode be exactly m ignoring the umask.\n**\n** The m parameter will be non-zero only when creating -wal, -journal,\n** and -shm files.  We want those files to have *exactly* the same\n** permissions as their original database, unadulterated by the umask.\n** In that way, if a database file is -rw-rw-rw or -rw-rw-r-, and a\n** transaction crashes and leaves behind hot journals, then any\n** process that is able to write to the database will also be able to\n** recover the hot journals.\n*/\nstatic int robust_open(const char *z, int f, mode_t m){\n  int fd;\n  mode_t m2 = m ? m : SQLITE_DEFAULT_FILE_PERMISSIONS;\n  while(1){\n#if defined(O_CLOEXEC)\n    fd = osOpen(z,f|O_CLOEXEC,m2);\n#else\n    fd = osOpen(z,f,m2);\n#endif\n    if( fd<0 ){\n      if( errno==EINTR ) continue;\n      break;\n    }\n    if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break;\n    osClose(fd);\n    sqlite3_log(SQLITE_WARNING, \n                \"attempt to open \\\"%s\\\" as file descriptor %d\", z, fd);\n    fd = -1;\n    if( osOpen(\"/dev/null\", f, m)<0 ) break;\n  }\n  if( fd>=0 ){\n    if( m!=0 ){\n      struct stat statbuf;\n      if( osFstat(fd, &statbuf)==0 \n       && statbuf.st_size==0\n       && (statbuf.st_mode&0777)!=m \n      ){\n        osFchmod(fd, m);\n      }\n    }\n#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)\n    osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);\n#endif\n  }\n  return fd;\n}\n\n/*\n** Helper functions to obtain and relinquish the global mutex. The\n** global mutex is used to protect the unixInodeInfo and\n** vxworksFileId objects used by this file, all of which may be \n** shared by multiple threads.\n**\n** Function unixMutexHeld() is used to assert() that the global mutex \n** is held when required. This function is only used as part of assert() \n** statements. e.g.\n**\n**   unixEnterMutex()\n**     assert( unixMutexHeld() );\n**   unixEnterLeave()\n*/\nstatic void unixEnterMutex(void){\n  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1));\n}\nstatic void unixLeaveMutex(void){\n  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1));\n}\n#ifdef SQLITE_DEBUG\nstatic int unixMutexHeld(void) {\n  return sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1));\n}\n#endif\n\n\n#ifdef SQLITE_HAVE_OS_TRACE\n/*\n** Helper function for printing out trace information from debugging\n** binaries. This returns the string representation of the supplied\n** integer lock-type.\n*/\nstatic const char *azFileLock(int eFileLock){\n  switch( eFileLock ){\n    case NO_LOCK: return \"NONE\";\n    case SHARED_LOCK: return \"SHARED\";\n    case RESERVED_LOCK: return \"RESERVED\";\n    case PENDING_LOCK: return \"PENDING\";\n    case EXCLUSIVE_LOCK: return \"EXCLUSIVE\";\n  }\n  return \"ERROR\";\n}\n#endif\n\n#ifdef SQLITE_LOCK_TRACE\n/*\n** Print out information about all locking operations.\n**\n** This routine is used for troubleshooting locks on multithreaded\n** platforms.  Enable by compiling with the -DSQLITE_LOCK_TRACE\n** command-line option on the compiler.  This code is normally\n** turned off.\n*/\nstatic int lockTrace(int fd, int op, struct flock *p){\n  char *zOpName, *zType;\n  int s;\n  int savedErrno;\n  if( op==F_GETLK ){\n    zOpName = \"GETLK\";\n  }else if( op==F_SETLK ){\n    zOpName = \"SETLK\";\n  }else{\n    s = osFcntl(fd, op, p);\n    sqlite3DebugPrintf(\"fcntl unknown %d %d %d\\n\", fd, op, s);\n    return s;\n  }\n  if( p->l_type==F_RDLCK ){\n    zType = \"RDLCK\";\n  }else if( p->l_type==F_WRLCK ){\n    zType = \"WRLCK\";\n  }else if( p->l_type==F_UNLCK ){\n    zType = \"UNLCK\";\n  }else{\n    assert( 0 );\n  }\n  assert( p->l_whence==SEEK_SET );\n  s = osFcntl(fd, op, p);\n  savedErrno = errno;\n  sqlite3DebugPrintf(\"fcntl %d %d %s %s %d %d %d %d\\n\",\n     threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len,\n     (int)p->l_pid, s);\n  if( s==(-1) && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){\n    struct flock l2;\n    l2 = *p;\n    osFcntl(fd, F_GETLK, &l2);\n    if( l2.l_type==F_RDLCK ){\n      zType = \"RDLCK\";\n    }else if( l2.l_type==F_WRLCK ){\n      zType = \"WRLCK\";\n    }else if( l2.l_type==F_UNLCK ){\n      zType = \"UNLCK\";\n    }else{\n      assert( 0 );\n    }\n    sqlite3DebugPrintf(\"fcntl-failure-reason: %s %d %d %d\\n\",\n       zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid);\n  }\n  errno = savedErrno;\n  return s;\n}\n#undef osFcntl\n#define osFcntl lockTrace\n#endif /* SQLITE_LOCK_TRACE */\n\n/*\n** Retry ftruncate() calls that fail due to EINTR\n**\n** All calls to ftruncate() within this file should be made through\n** this wrapper.  On the Android platform, bypassing the logic below\n** could lead to a corrupt database.\n*/\nstatic int robust_ftruncate(int h, sqlite3_int64 sz){\n  int rc;\n  do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR );\n  return rc;\n}\n\n/*\n** This routine translates a standard POSIX errno code into something\n** useful to the clients of the sqlite3 functions.  Specifically, it is\n** intended to translate a variety of \"try again\" errors into SQLITE_BUSY\n** and a variety of \"please close the file descriptor NOW\" errors into \n** SQLITE_IOERR\n** \n** Errors during initialization of locks, or file system support for locks,\n** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately.\n*/\nstatic int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {\n  assert( (sqliteIOErr == SQLITE_IOERR_LOCK) || \n          (sqliteIOErr == SQLITE_IOERR_UNLOCK) || \n          (sqliteIOErr == SQLITE_IOERR_RDLOCK) ||\n          (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK) );\n  switch (posixError) {\n  case EACCES: \n  case EAGAIN:\n  case ETIMEDOUT:\n  case EBUSY:\n  case EINTR:\n  case ENOLCK:  \n    /* random NFS retry error, unless during file system support \n     * introspection, in which it actually means what it says */\n    return SQLITE_BUSY;\n    \n  case EPERM: \n    return SQLITE_PERM;\n    \n  default: \n    return sqliteIOErr;\n  }\n}\n\n\n/******************************************************************************\n****************** Begin Unique File ID Utility Used By VxWorks ***************\n**\n** On most versions of unix, we can get a unique ID for a file by concatenating\n** the device number and the inode number.  But this does not work on VxWorks.\n** On VxWorks, a unique file id must be based on the canonical filename.\n**\n** A pointer to an instance of the following structure can be used as a\n** unique file ID in VxWorks.  Each instance of this structure contains\n** a copy of the canonical filename.  There is also a reference count.  \n** The structure is reclaimed when the number of pointers to it drops to\n** zero.\n**\n** There are never very many files open at one time and lookups are not\n** a performance-critical path, so it is sufficient to put these\n** structures on a linked list.\n*/\nstruct vxworksFileId {\n  struct vxworksFileId *pNext;  /* Next in a list of them all */\n  int nRef;                     /* Number of references to this one */\n  int nName;                    /* Length of the zCanonicalName[] string */\n  char *zCanonicalName;         /* Canonical filename */\n};\n\n#if OS_VXWORKS\n/* \n** All unique filenames are held on a linked list headed by this\n** variable:\n*/\nstatic struct vxworksFileId *vxworksFileList = 0;\n\n/*\n** Simplify a filename into its canonical form\n** by making the following changes:\n**\n**  * removing any trailing and duplicate /\n**  * convert /./ into just /\n**  * convert /A/../ where A is any simple name into just /\n**\n** Changes are made in-place.  Return the new name length.\n**\n** The original filename is in z[0..n-1].  Return the number of\n** characters in the simplified name.\n*/\nstatic int vxworksSimplifyName(char *z, int n){\n  int i, j;\n  while( n>1 && z[n-1]=='/' ){ n--; }\n  for(i=j=0; i<n; i++){\n    if( z[i]=='/' ){\n      if( z[i+1]=='/' ) continue;\n      if( z[i+1]=='.' && i+2<n && z[i+2]=='/' ){\n        i += 1;\n        continue;\n      }\n      if( z[i+1]=='.' && i+3<n && z[i+2]=='.' && z[i+3]=='/' ){\n        while( j>0 && z[j-1]!='/' ){ j--; }\n        if( j>0 ){ j--; }\n        i += 2;\n        continue;\n      }\n    }\n    z[j++] = z[i];\n  }\n  z[j] = 0;\n  return j;\n}\n\n/*\n** Find a unique file ID for the given absolute pathname.  Return\n** a pointer to the vxworksFileId object.  This pointer is the unique\n** file ID.\n**\n** The nRef field of the vxworksFileId object is incremented before\n** the object is returned.  A new vxworksFileId object is created\n** and added to the global list if necessary.\n**\n** If a memory allocation error occurs, return NULL.\n*/\nstatic struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){\n  struct vxworksFileId *pNew;         /* search key and new file ID */\n  struct vxworksFileId *pCandidate;   /* For looping over existing file IDs */\n  int n;                              /* Length of zAbsoluteName string */\n\n  assert( zAbsoluteName[0]=='/' );\n  n = (int)strlen(zAbsoluteName);\n  pNew = sqlite3_malloc64( sizeof(*pNew) + (n+1) );\n  if( pNew==0 ) return 0;\n  pNew->zCanonicalName = (char*)&pNew[1];\n  memcpy(pNew->zCanonicalName, zAbsoluteName, n+1);\n  n = vxworksSimplifyName(pNew->zCanonicalName, n);\n\n  /* Search for an existing entry that matching the canonical name.\n  ** If found, increment the reference count and return a pointer to\n  ** the existing file ID.\n  */\n  unixEnterMutex();\n  for(pCandidate=vxworksFileList; pCandidate; pCandidate=pCandidate->pNext){\n    if( pCandidate->nName==n \n     && memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0\n    ){\n       sqlite3_free(pNew);\n       pCandidate->nRef++;\n       unixLeaveMutex();\n       return pCandidate;\n    }\n  }\n\n  /* No match was found.  We will make a new file ID */\n  pNew->nRef = 1;\n  pNew->nName = n;\n  pNew->pNext = vxworksFileList;\n  vxworksFileList = pNew;\n  unixLeaveMutex();\n  return pNew;\n}\n\n/*\n** Decrement the reference count on a vxworksFileId object.  Free\n** the object when the reference count reaches zero.\n*/\nstatic void vxworksReleaseFileId(struct vxworksFileId *pId){\n  unixEnterMutex();\n  assert( pId->nRef>0 );\n  pId->nRef--;\n  if( pId->nRef==0 ){\n    struct vxworksFileId **pp;\n    for(pp=&vxworksFileList; *pp && *pp!=pId; pp = &((*pp)->pNext)){}\n    assert( *pp==pId );\n    *pp = pId->pNext;\n    sqlite3_free(pId);\n  }\n  unixLeaveMutex();\n}\n#endif /* OS_VXWORKS */\n/*************** End of Unique File ID Utility Used By VxWorks ****************\n******************************************************************************/\n\n\n/******************************************************************************\n*************************** Posix Advisory Locking ****************************\n**\n** POSIX advisory locks are broken by design.  ANSI STD 1003.1 (1996)\n** section 6.5.2.2 lines 483 through 490 specify that when a process\n** sets or clears a lock, that operation overrides any prior locks set\n** by the same process.  It does not explicitly say so, but this implies\n** that it overrides locks set by the same process using a different\n** file descriptor.  Consider this test case:\n**\n**       int fd1 = open(\"./file1\", O_RDWR|O_CREAT, 0644);\n**       int fd2 = open(\"./file2\", O_RDWR|O_CREAT, 0644);\n**\n** Suppose ./file1 and ./file2 are really the same file (because\n** one is a hard or symbolic link to the other) then if you set\n** an exclusive lock on fd1, then try to get an exclusive lock\n** on fd2, it works.  I would have expected the second lock to\n** fail since there was already a lock on the file due to fd1.\n** But not so.  Since both locks came from the same process, the\n** second overrides the first, even though they were on different\n** file descriptors opened on different file names.\n**\n** This means that we cannot use POSIX locks to synchronize file access\n** among competing threads of the same process.  POSIX locks will work fine\n** to synchronize access for threads in separate processes, but not\n** threads within the same process.\n**\n** To work around the problem, SQLite has to manage file locks internally\n** on its own.  Whenever a new database is opened, we have to find the\n** specific inode of the database file (the inode is determined by the\n** st_dev and st_ino fields of the stat structure that fstat() fills in)\n** and check for locks already existing on that inode.  When locks are\n** created or removed, we have to look at our own internal record of the\n** locks to see if another thread has previously set a lock on that same\n** inode.\n**\n** (Aside: The use of inode numbers as unique IDs does not work on VxWorks.\n** For VxWorks, we have to use the alternative unique ID system based on\n** canonical filename and implemented in the previous division.)\n**\n** The sqlite3_file structure for POSIX is no longer just an integer file\n** descriptor.  It is now a structure that holds the integer file\n** descriptor and a pointer to a structure that describes the internal\n** locks on the corresponding inode.  There is one locking structure\n** per inode, so if the same inode is opened twice, both unixFile structures\n** point to the same locking structure.  The locking structure keeps\n** a reference count (so we will know when to delete it) and a \"cnt\"\n** field that tells us its internal lock status.  cnt==0 means the\n** file is unlocked.  cnt==-1 means the file has an exclusive lock.\n** cnt>0 means there are cnt shared locks on the file.\n**\n** Any attempt to lock or unlock a file first checks the locking\n** structure.  The fcntl() system call is only invoked to set a \n** POSIX lock if the internal lock structure transitions between\n** a locked and an unlocked state.\n**\n** But wait:  there are yet more problems with POSIX advisory locks.\n**\n** If you close a file descriptor that points to a file that has locks,\n** all locks on that file that are owned by the current process are\n** released.  To work around this problem, each unixInodeInfo object\n** maintains a count of the number of pending locks on tha inode.\n** When an attempt is made to close an unixFile, if there are\n** other unixFile open on the same inode that are holding locks, the call\n** to close() the file descriptor is deferred until all of the locks clear.\n** The unixInodeInfo structure keeps a list of file descriptors that need to\n** be closed and that list is walked (and cleared) when the last lock\n** clears.\n**\n** Yet another problem:  LinuxThreads do not play well with posix locks.\n**\n** Many older versions of linux use the LinuxThreads library which is\n** not posix compliant.  Under LinuxThreads, a lock created by thread\n** A cannot be modified or overridden by a different thread B.\n** Only thread A can modify the lock.  Locking behavior is correct\n** if the appliation uses the newer Native Posix Thread Library (NPTL)\n** on linux - with NPTL a lock created by thread A can override locks\n** in thread B.  But there is no way to know at compile-time which\n** threading library is being used.  So there is no way to know at\n** compile-time whether or not thread A can override locks on thread B.\n** One has to do a run-time check to discover the behavior of the\n** current process.\n**\n** SQLite used to support LinuxThreads.  But support for LinuxThreads\n** was dropped beginning with version 3.7.0.  SQLite will still work with\n** LinuxThreads provided that (1) there is no more than one connection \n** per database file in the same process and (2) database connections\n** do not move across threads.\n*/\n\n/*\n** An instance of the following structure serves as the key used\n** to locate a particular unixInodeInfo object.\n*/\nstruct unixFileId {\n  dev_t dev;                  /* Device number */\n#if OS_VXWORKS\n  struct vxworksFileId *pId;  /* Unique file ID for vxworks. */\n#else\n  ino_t ino;                  /* Inode number */\n#endif\n};\n\n/*\n** An instance of the following structure is allocated for each open\n** inode.  Or, on LinuxThreads, there is one of these structures for\n** each inode opened by each thread.\n**\n** A single inode can have multiple file descriptors, so each unixFile\n** structure contains a pointer to an instance of this object and this\n** object keeps a count of the number of unixFile pointing to it.\n*/\nstruct unixInodeInfo {\n  struct unixFileId fileId;       /* The lookup key */\n  int nShared;                    /* Number of SHARED locks held */\n  unsigned char eFileLock;        /* One of SHARED_LOCK, RESERVED_LOCK etc. */\n  unsigned char bProcessLock;     /* An exclusive process lock is held */\n  int nRef;                       /* Number of pointers to this structure */\n  unixShmNode *pShmNode;          /* Shared memory associated with this inode */\n  int nLock;                      /* Number of outstanding file locks */\n  UnixUnusedFd *pUnused;          /* Unused file descriptors to close */\n  unixInodeInfo *pNext;           /* List of all unixInodeInfo objects */\n  unixInodeInfo *pPrev;           /*    .... doubly linked */\n#if SQLITE_ENABLE_LOCKING_STYLE\n  unsigned long long sharedByte;  /* for AFP simulated shared lock */\n#endif\n#if OS_VXWORKS\n  sem_t *pSem;                    /* Named POSIX semaphore */\n  char aSemName[MAX_PATHNAME+2];  /* Name of that semaphore */\n#endif\n#if SQLITE_WCDB_SIGNAL_RETRY\n  Queue qWaitQueue;\n  sqlite3_condition* pCond;\n#endif //SQLITE_WCDB_SIGNAL_RETRY\n};\n\n/*\n** A lists of all unixInodeInfo objects.\n*/\nstatic unixInodeInfo *inodeList = 0;\n\n/*\n**\n** This function - unixLogErrorAtLine(), is only ever called via the macro\n** unixLogError().\n**\n** It is invoked after an error occurs in an OS function and errno has been\n** set. It logs a message using sqlite3_log() containing the current value of\n** errno and, if possible, the human-readable equivalent from strerror() or\n** strerror_r().\n**\n** The first argument passed to the macro should be the error code that\n** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN). \n** The two subsequent arguments should be the name of the OS function that\n** failed (e.g. \"unlink\", \"open\") and the associated file-system path,\n** if any.\n*/\n#define unixLogError(a,b,c)     unixLogErrorAtLine(a,b,c,__LINE__)\nstatic int unixLogErrorAtLine(\n  int errcode,                    /* SQLite error code */\n  const char *zFunc,              /* Name of OS function that failed */\n  const char *zPath,              /* File path associated with error */\n  int iLine                       /* Source line number where error occurred */\n){\n  char *zErr;                     /* Message from strerror() or equivalent */\n  int iErrno = errno;             /* Saved syscall error number */\n\n  /* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use\n  ** the strerror() function to obtain the human-readable error message\n  ** equivalent to errno. Otherwise, use strerror_r().\n  */ \n#if SQLITE_THREADSAFE && defined(HAVE_STRERROR_R)\n  char aErr[80];\n  memset(aErr, 0, sizeof(aErr));\n  zErr = aErr;\n\n  /* If STRERROR_R_CHAR_P (set by autoconf scripts) or __USE_GNU is defined,\n  ** assume that the system provides the GNU version of strerror_r() that\n  ** returns a pointer to a buffer containing the error message. That pointer \n  ** may point to aErr[], or it may point to some static storage somewhere. \n  ** Otherwise, assume that the system provides the POSIX version of \n  ** strerror_r(), which always writes an error message into aErr[].\n  **\n  ** If the code incorrectly assumes that it is the POSIX version that is\n  ** available, the error message will often be an empty string. Not a\n  ** huge problem. Incorrectly concluding that the GNU version is available \n  ** could lead to a segfault though.\n  */\n#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)\n  zErr = \n# endif\n  strerror_r(iErrno, aErr, sizeof(aErr)-1);\n\n#elif SQLITE_THREADSAFE\n  /* This is a threadsafe build, but strerror_r() is not available. */\n  zErr = \"\";\n#else\n  /* Non-threadsafe build, use strerror(). */\n  zErr = strerror(iErrno);\n#endif\n\n  if( zPath==0 ) zPath = \"\";\n  sqlite3_log(errcode,\n      \"os_unix.c:%d: (%d) %s(%s) - %s\",\n      iLine, iErrno, zFunc, zPath, zErr\n  );\n\n  return errcode;\n}\n\n/*\n** Close a file descriptor.\n**\n** We assume that close() almost always works, since it is only in a\n** very sick application or on a very sick platform that it might fail.\n** If it does fail, simply leak the file descriptor, but do log the\n** error.\n**\n** Note that it is not safe to retry close() after EINTR since the\n** file descriptor might have already been reused by another thread.\n** So we don't even try to recover from an EINTR.  Just log the error\n** and move on.\n*/\nstatic void robust_close(unixFile *pFile, int h, int lineno){\n  if( osClose(h) ){\n    unixLogErrorAtLine(SQLITE_IOERR_CLOSE, \"close\",\n                       pFile ? pFile->zPath : 0, lineno);\n  }\n}\n\n/*\n** Set the pFile->lastErrno.  Do this in a subroutine as that provides\n** a convenient place to set a breakpoint.\n*/\nstatic void storeLastErrno(unixFile *pFile, int error){\n  pFile->lastErrno = error;\n}\n\n/*\n** Close all file descriptors accumuated in the unixInodeInfo->pUnused list.\n*/ \nstatic void closePendingFds(unixFile *pFile){\n  unixInodeInfo *pInode = pFile->pInode;\n  UnixUnusedFd *p;\n  UnixUnusedFd *pNext;\n  for(p=pInode->pUnused; p; p=pNext){\n    pNext = p->pNext;\n    robust_close(pFile, p->fd, __LINE__);\n    sqlite3_free(p);\n  }\n  pInode->pUnused = 0;\n}\n\n/*\n** Release a unixInodeInfo structure previously allocated by findInodeInfo().\n**\n** The mutex entered using the unixEnterMutex() function must be held\n** when this function is called.\n*/\nstatic void releaseInodeInfo(unixFile *pFile){\n  unixInodeInfo *pInode = pFile->pInode;\n  assert( unixMutexHeld() );\n  if( ALWAYS(pInode) ){\n    pInode->nRef--;\n    if( pInode->nRef==0 ){\n      assert( pInode->pShmNode==0 );\n      closePendingFds(pFile);\n      if( pInode->pPrev ){\n        assert( pInode->pPrev->pNext==pInode );\n        pInode->pPrev->pNext = pInode->pNext;\n      }else{\n        assert( inodeList==pInode );\n        inodeList = pInode->pNext;\n      }\n      if( pInode->pNext ){\n        assert( pInode->pNext->pPrev==pInode );\n        pInode->pNext->pPrev = pInode->pPrev;\n      }\n#if SQLITE_WCDB_SIGNAL_RETRY\n      pthreadCondFree(pInode->pCond);\n      while (!sqlite3QueueEmpty(&pInode->qWaitQueue)) {\n        WCDBWaitInfo* pInfo = sqlite3QueuePop(&pInode->qWaitQueue);\n        if (pInfo) {\n          pthreadFree(pInfo->pThread);\n          sqlite3_free(pInfo);\n        }\n      }\n#endif//SQLITE_WCDB_SIGNAL_RETRY\n      sqlite3_free(pInode);\n    }\n  }\n}\n\n/*\n** Given a file descriptor, locate the unixInodeInfo object that\n** describes that file descriptor.  Create a new one if necessary.  The\n** return value might be uninitialized if an error occurs.\n**\n** The mutex entered using the unixEnterMutex() function must be held\n** when this function is called.\n**\n** Return an appropriate error code.\n*/\nstatic int findInodeInfo(\n  unixFile *pFile,               /* Unix file with file desc used in the key */\n  unixInodeInfo **ppInode        /* Return the unixInodeInfo object here */\n){\n  int rc;                        /* System call return code */\n  int fd;                        /* The file descriptor for pFile */\n  struct unixFileId fileId;      /* Lookup key for the unixInodeInfo */\n  struct stat statbuf;           /* Low-level file information */\n  unixInodeInfo *pInode = 0;     /* Candidate unixInodeInfo object */\n\n  assert( unixMutexHeld() );\n\n  /* Get low-level information about the file that we can used to\n  ** create a unique name for the file.\n  */\n  fd = pFile->h;\n  rc = osFstat(fd, &statbuf);\n  if( rc!=0 ){\n    storeLastErrno(pFile, errno);\n#if defined(EOVERFLOW) && defined(SQLITE_DISABLE_LFS)\n    if( pFile->lastErrno==EOVERFLOW ) return SQLITE_NOLFS;\n#endif\n    return SQLITE_IOERR;\n  }\n\n#ifdef __APPLE__\n  /* On OS X on an msdos filesystem, the inode number is reported\n  ** incorrectly for zero-size files.  See ticket #3260.  To work\n  ** around this problem (we consider it a bug in OS X, not SQLite)\n  ** we always increase the file size to 1 by writing a single byte\n  ** prior to accessing the inode number.  The one byte written is\n  ** an ASCII 'S' character which also happens to be the first byte\n  ** in the header of every SQLite database.  In this way, if there\n  ** is a race condition such that another thread has already populated\n  ** the first page of the database, no damage is done.\n  */\n  if( statbuf.st_size==0 && (pFile->fsFlags & SQLITE_FSFLAGS_IS_MSDOS)!=0 ){\n    do{ rc = osWrite(fd, \"S\", 1); }while( rc<0 && errno==EINTR );\n    if( rc!=1 ){\n      storeLastErrno(pFile, errno);\n      return SQLITE_IOERR;\n    }\n    rc = osFstat(fd, &statbuf);\n    if( rc!=0 ){\n      storeLastErrno(pFile, errno);\n      return SQLITE_IOERR;\n    }\n  }\n#endif\n\n  memset(&fileId, 0, sizeof(fileId));\n  fileId.dev = statbuf.st_dev;\n#if OS_VXWORKS\n  fileId.pId = pFile->pId;\n#else\n  fileId.ino = statbuf.st_ino;\n#endif\n  pInode = inodeList;\n  while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){\n    pInode = pInode->pNext;\n  }\n  if( pInode==0 ){\n    pInode = sqlite3_malloc64( sizeof(*pInode) );\n    if( pInode==0 ){\n      return SQLITE_NOMEM_BKPT;\n    }\n    memset(pInode, 0, sizeof(*pInode));\n    memcpy(&pInode->fileId, &fileId, sizeof(fileId));\n    pInode->nRef = 1;\n    pInode->pNext = inodeList;\n    pInode->pPrev = 0;\n#if SQLITE_WCDB_SIGNAL_RETRY\n    sqlite3QueueInit(&pInode->qWaitQueue);\n    pInode->pCond = pthreadCondAlloc();\n    if (pInode->pCond==0){\n      return SQLITE_NOMEM_BKPT;\n    }\n#endif //SQLITE_WCDB_SIGNAL_RETRY\n    if( inodeList ) inodeList->pPrev = pInode;\n    inodeList = pInode;\n  }else{\n    pInode->nRef++;\n  }\n  *ppInode = pInode;\n  return SQLITE_OK;\n}\n\n/*\n** Return TRUE if pFile has been renamed or unlinked since it was first opened.\n*/\nstatic int fileHasMoved(unixFile *pFile){\n#if OS_VXWORKS\n  return pFile->pInode!=0 && pFile->pId!=pFile->pInode->fileId.pId;\n#else\n  struct stat buf;\n  return pFile->pInode!=0 &&\n      (osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino);\n#endif\n}\n\n\n/*\n** Check a unixFile that is a database.  Verify the following:\n**\n** (1) There is exactly one hard link on the file\n** (2) The file is not a symbolic link\n** (3) The file has not been renamed or unlinked\n**\n** Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right.\n*/\nstatic void verifyDbFile(unixFile *pFile){\n  struct stat buf;\n  int rc;\n\n  /* These verifications occurs for the main database only */\n  if( pFile->ctrlFlags & UNIXFILE_NOLOCK ) return;\n\n  rc = osFstat(pFile->h, &buf);\n  if( rc!=0 ){\n    sqlite3_log(SQLITE_WARNING, \"cannot fstat db file %s\", pFile->zPath);\n    return;\n  }\n  if( buf.st_nlink==0 ){\n    sqlite3_log(SQLITE_WARNING, \"file unlinked while open: %s\", pFile->zPath);\n    return;\n  }\n  if( buf.st_nlink>1 ){\n    sqlite3_log(SQLITE_WARNING, \"multiple links to file: %s\", pFile->zPath);\n    return;\n  }\n  if( fileHasMoved(pFile) ){\n    sqlite3_log(SQLITE_WARNING, \"file renamed while open: %s\", pFile->zPath);\n    return;\n  }\n}\n\n\n/*\n** This routine checks if there is a RESERVED lock held on the specified\n** file by this or any other process. If such a lock is held, set *pResOut\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\n*/\nstatic int unixCheckReservedLock(sqlite3_file *id, int *pResOut){\n  int rc = SQLITE_OK;\n  int reserved = 0;\n  unixFile *pFile = (unixFile*)id;\n\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\n\n  assert( pFile );\n  assert( pFile->eFileLock<=SHARED_LOCK );\n  unixEnterMutex(); /* Because pFile->pInode is shared across threads */\n\n  /* Check if a thread in this process holds such a lock */\n  if( pFile->pInode->eFileLock>SHARED_LOCK ){\n    reserved = 1;\n  }\n\n  /* Otherwise see if some other process holds it.\n  */\n#ifndef __DJGPP__\n  if( !reserved && !pFile->pInode->bProcessLock ){\n    struct flock lock;\n    lock.l_whence = SEEK_SET;\n    lock.l_start = RESERVED_BYTE;\n    lock.l_len = 1;\n    lock.l_type = F_WRLCK;\n    if( osFcntl(pFile->h, F_GETLK, &lock) ){\n      rc = SQLITE_IOERR_CHECKRESERVEDLOCK;\n      storeLastErrno(pFile, errno);\n    } else if( lock.l_type!=F_UNLCK ){\n      reserved = 1;\n    }\n  }\n#endif\n  \n  unixLeaveMutex();\n  OSTRACE((\"TEST WR-LOCK %d %d %d (unix)\\n\", pFile->h, rc, reserved));\n\n  *pResOut = reserved;\n  return rc;\n}\n\n/*\n** Attempt to set a system-lock on the file pFile.  The lock is \n** described by pLock.\n**\n** If the pFile was opened read/write from unix-excl, then the only lock\n** ever obtained is an exclusive lock, and it is obtained exactly once\n** the first time any lock is attempted.  All subsequent system locking\n** operations become no-ops.  Locking operations still happen internally,\n** in order to coordinate access between separate database connections\n** within this process, but all of that is handled in memory and the\n** operating system does not participate.\n**\n** This function is a pass-through to fcntl(F_SETLK) if pFile is using\n** any VFS other than \"unix-excl\" or if pFile is opened on \"unix-excl\"\n** and is read-only.\n**\n** Zero is returned if the call completes successfully, or -1 if a call\n** to fcntl() fails. In this case, errno is set appropriately (by fcntl()).\n*/\nstatic int unixFileLock(unixFile *pFile, struct flock *pLock){\n  int rc;\n  unixInodeInfo *pInode = pFile->pInode;\n  assert( unixMutexHeld() );\n  assert( pInode!=0 );\n  if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){\n    if( pInode->bProcessLock==0 ){\n      struct flock lock;\n      assert( pInode->nLock==0 );\n      lock.l_whence = SEEK_SET;\n      lock.l_start = SHARED_FIRST;\n      lock.l_len = SHARED_SIZE;\n      lock.l_type = F_WRLCK;\n      rc = osFcntl(pFile->h, F_SETLK, &lock);\n      if( rc<0 ) return rc;\n      pInode->bProcessLock = 1;\n      pInode->nLock++;\n    }else{\n      rc = 0;\n    }\n  }else{\n    rc = osFcntl(pFile->h, F_SETLK, pLock);\n  }\n  return rc;\n}\n\n/*\n** Lock the file with the lock specified by parameter eFileLock - one\n** of the following:\n**\n**     (1) SHARED_LOCK\n**     (2) RESERVED_LOCK\n**     (3) PENDING_LOCK\n**     (4) EXCLUSIVE_LOCK\n**\n** Sometimes when requesting one lock state, additional lock states\n** are inserted in between.  The locking might fail on one of the later\n** transitions leaving the lock state different from what it started but\n** still short of its goal.  The following chart shows the allowed\n** transitions and the inserted intermediate states:\n**\n**    UNLOCKED -> SHARED\n**    SHARED -> RESERVED\n**    SHARED -> (PENDING) -> EXCLUSIVE\n**    RESERVED -> (PENDING) -> EXCLUSIVE\n**    PENDING -> EXCLUSIVE\n**\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\n** routine to lower a locking level.\n*/\nstatic int unixLock(sqlite3_file *id, int eFileLock){\n  /* The following describes the implementation of the various locks and\n  ** lock transitions in terms of the POSIX advisory shared and exclusive\n  ** lock primitives (called read-locks and write-locks below, to avoid\n  ** confusion with SQLite lock names). The algorithms are complicated\n  ** slightly in order to be compatible with Windows95 systems simultaneously\n  ** accessing the same database file, in case that is ever required.\n  **\n  ** Symbols defined in os.h indentify the 'pending byte' and the 'reserved\n  ** byte', each single bytes at well known offsets, and the 'shared byte\n  ** range', a range of 510 bytes at a well known offset.\n  **\n  ** To obtain a SHARED lock, a read-lock is obtained on the 'pending\n  ** byte'.  If this is successful, 'shared byte range' is read-locked\n  ** and the lock on the 'pending byte' released.  (Legacy note:  When\n  ** SQLite was first developed, Windows95 systems were still very common,\n  ** and Widnows95 lacks a shared-lock capability.  So on Windows95, a\n  ** single randomly selected by from the 'shared byte range' is locked.\n  ** Windows95 is now pretty much extinct, but this work-around for the\n  ** lack of shared-locks on Windows95 lives on, for backwards\n  ** compatibility.)\n  **\n  ** A process may only obtain a RESERVED lock after it has a SHARED lock.\n  ** A RESERVED lock is implemented by grabbing a write-lock on the\n  ** 'reserved byte'. \n  **\n  ** A process may only obtain a PENDING lock after it has obtained a\n  ** SHARED lock. A PENDING lock is implemented by obtaining a write-lock\n  ** on the 'pending byte'. This ensures that no new SHARED locks can be\n  ** obtained, but existing SHARED locks are allowed to persist. A process\n  ** does not have to obtain a RESERVED lock on the way to a PENDING lock.\n  ** This property is used by the algorithm for rolling back a journal file\n  ** after a crash.\n  **\n  ** An EXCLUSIVE lock, obtained after a PENDING lock is held, is\n  ** implemented by obtaining a write-lock on the entire 'shared byte\n  ** range'. Since all other locks require a read-lock on one of the bytes\n  ** within this range, this ensures that no other locks are held on the\n  ** database. \n  */\n  int rc = SQLITE_OK;\n#if SQLITE_WCDB_SIGNAL_RETRY\n  int eBusyWait = SQLITE_WAIT_NONE;\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n  unixFile *pFile = (unixFile*)id;\n  unixInodeInfo *pInode;\n  struct flock lock;\n  int tErrno = 0;\n\n  assert( pFile );\n  OSTRACE((\"LOCK    %d %s was %s(%s,%d) pid=%d (unix)\\n\", pFile->h,\n      azFileLock(eFileLock), azFileLock(pFile->eFileLock),\n      azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared,\n      osGetpid(0)));\n\n  /* If there is already a lock of this type or more restrictive on the\n  ** unixFile, do nothing. Don't use the end_lock: exit path, as\n  ** unixEnterMutex() hasn't been called yet.\n  */\n  if( pFile->eFileLock>=eFileLock ){\n    OSTRACE((\"LOCK    %d %s ok (already held) (unix)\\n\", pFile->h,\n            azFileLock(eFileLock)));\n    return SQLITE_OK;\n  }\n\n  /* Make sure the locking sequence is correct.\n  **  (1) We never move from unlocked to anything higher than shared lock.\n  **  (2) SQLite never explicitly requests a pendig lock.\n  **  (3) A shared lock is always held when a reserve lock is requested.\n  */\n  assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );\n  assert( eFileLock!=PENDING_LOCK );\n  assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );\n\n  /* This mutex is needed because pFile->pInode is shared across threads\n  */\n  unixEnterMutex();\n  pInode = pFile->pInode;\n\n  /* If some thread using this PID has a lock via a different unixFile*\n  ** handle that precludes the requested lock, return BUSY.\n  */\n  if( (pFile->eFileLock!=pInode->eFileLock && \n          (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK))\n  ){\n    rc = SQLITE_BUSY;\n#if SQLITE_WCDB_SIGNAL_RETRY\n    eBusyWait = SQLITE_WAIT_SHARED;\n#endif //SQLITE_WCDB_SIGNAL_RETRY\n    goto end_lock;\n  }\n\n  /* If a SHARED lock is requested, and some thread using this PID already\n  ** has a SHARED or RESERVED lock, then increment reference counts and\n  ** return SQLITE_OK.\n  */\n  if( eFileLock==SHARED_LOCK && \n      (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){\n    assert( eFileLock==SHARED_LOCK );\n    assert( pFile->eFileLock==0 );\n    assert( pInode->nShared>0 );\n    pFile->eFileLock = SHARED_LOCK;\n    pInode->nShared++;\n    pInode->nLock++;\n    goto end_lock;\n  }\n\n\n  /* A PENDING lock is needed before acquiring a SHARED lock and before\n  ** acquiring an EXCLUSIVE lock.  For the SHARED lock, the PENDING will\n  ** be released.\n  */\n  lock.l_len = 1L;\n  lock.l_whence = SEEK_SET;\n  if( eFileLock==SHARED_LOCK \n      || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock<PENDING_LOCK)\n  ){\n    lock.l_type = (eFileLock==SHARED_LOCK?F_RDLCK:F_WRLCK);\n    lock.l_start = PENDING_BYTE;\n    if( unixFileLock(pFile, &lock) ){\n      tErrno = errno;\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\n      if( rc!=SQLITE_BUSY ){\n        storeLastErrno(pFile, tErrno);\n      }\n      goto end_lock;\n    }\n  }\n\n\n  /* If control gets to this point, then actually go ahead and make\n  ** operating system calls for the specified lock.\n  */\n  if( eFileLock==SHARED_LOCK ){\n    assert( pInode->nShared==0 );\n    assert( pInode->eFileLock==0 );\n    assert( rc==SQLITE_OK );\n\n    /* Now get the read-lock */\n    lock.l_start = SHARED_FIRST;\n    lock.l_len = SHARED_SIZE;\n    if( unixFileLock(pFile, &lock) ){\n      tErrno = errno;\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\n    }\n\n    /* Drop the temporary PENDING lock */\n    lock.l_start = PENDING_BYTE;\n    lock.l_len = 1L;\n    lock.l_type = F_UNLCK;\n    if( unixFileLock(pFile, &lock) && rc==SQLITE_OK ){\n      /* This could happen with a network mount */\n      tErrno = errno;\n      rc = SQLITE_IOERR_UNLOCK; \n    }\n\n    if( rc ){\n      if( rc!=SQLITE_BUSY ){\n        storeLastErrno(pFile, tErrno);\n      }\n      goto end_lock;\n    }else{\n      pFile->eFileLock = SHARED_LOCK;\n      pInode->nLock++;\n      pInode->nShared = 1;\n    }\n  }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){\n    /* We are trying for an exclusive lock but another thread in this\n    ** same process is still holding a shared lock. */\n    rc = SQLITE_BUSY;\n#if SQLITE_WCDB_SIGNAL_RETRY\n    eBusyWait = SQLITE_WAIT_EXCLUSIVE;\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n  }else{\n    /* The request was for a RESERVED or EXCLUSIVE lock.  It is\n    ** assumed that there is a SHARED or greater lock on the file\n    ** already.\n    */\n    assert( 0!=pFile->eFileLock );\n    lock.l_type = F_WRLCK;\n\n    assert( eFileLock==RESERVED_LOCK || eFileLock==EXCLUSIVE_LOCK );\n    if( eFileLock==RESERVED_LOCK ){\n      lock.l_start = RESERVED_BYTE;\n      lock.l_len = 1L;\n    }else{\n      lock.l_start = SHARED_FIRST;\n      lock.l_len = SHARED_SIZE;\n    }\n\n    if( unixFileLock(pFile, &lock) ){\n      tErrno = errno;\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\n      if( rc!=SQLITE_BUSY ){\n        storeLastErrno(pFile, tErrno);\n      }\n    }\n  }\n  \n\n#ifdef SQLITE_DEBUG\n  /* Set up the transaction-counter change checking flags when\n  ** transitioning from a SHARED to a RESERVED lock.  The change\n  ** from SHARED to RESERVED marks the beginning of a normal\n  ** write operation (not a hot journal rollback).\n  */\n  if( rc==SQLITE_OK\n   && pFile->eFileLock<=SHARED_LOCK\n   && eFileLock==RESERVED_LOCK\n  ){\n    pFile->transCntrChng = 0;\n    pFile->dbUpdate = 0;\n    pFile->inNormalWrite = 1;\n  }\n#endif\n\n\n  if( rc==SQLITE_OK ){\n    pFile->eFileLock = eFileLock;\n    pInode->eFileLock = eFileLock;\n  }else if( eFileLock==EXCLUSIVE_LOCK ){\n    pFile->eFileLock = PENDING_LOCK;\n    pInode->eFileLock = PENDING_LOCK;\n  }\n\nend_lock:\n#if SQLITE_WCDB_SIGNAL_RETRY\n  if (eBusyWait!=SQLITE_WAIT_NONE) {\n    WCDBOsWait(pInode, pFile, eFileLock, eBusyWait);\n  }\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n  unixLeaveMutex();\n  OSTRACE((\"LOCK    %d %s %s (unix)\\n\", pFile->h, azFileLock(eFileLock), \n      rc==SQLITE_OK ? \"ok\" : \"failed\"));\n  return rc;\n}\n\n/*\n** Add the file descriptor used by file handle pFile to the corresponding\n** pUnused list.\n*/\nstatic void setPendingFd(unixFile *pFile){\n  unixInodeInfo *pInode = pFile->pInode;\n  UnixUnusedFd *p = pFile->pUnused;\n  p->pNext = pInode->pUnused;\n  pInode->pUnused = p;\n  pFile->h = -1;\n  pFile->pUnused = 0;\n}\n\n/*\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n** must be either NO_LOCK or SHARED_LOCK.\n**\n** If the locking level of the file descriptor is already at or below\n** the requested locking level, this routine is a no-op.\n** \n** If handleNFSUnlock is true, then on downgrading an EXCLUSIVE_LOCK to SHARED\n** the byte range is divided into 2 parts and the first part is unlocked then\n** set to a read lock, then the other part is simply unlocked.  This works \n** around a bug in BSD NFS lockd (also seen on MacOSX 10.3+) that fails to \n** remove the write lock on a region when a read lock is set.\n*/\nstatic int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){\n  unixFile *pFile = (unixFile*)id;\n  unixInodeInfo *pInode;\n  struct flock lock;\n  int rc = SQLITE_OK;\n\n  assert( pFile );\n  OSTRACE((\"UNLOCK  %d %d was %d(%d,%d) pid=%d (unix)\\n\", pFile->h, eFileLock,\n      pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,\n      osGetpid(0)));\n\n  assert( eFileLock<=SHARED_LOCK );\n  if( pFile->eFileLock<=eFileLock ){\n    return SQLITE_OK;\n  }\n  unixEnterMutex();\n  pInode = pFile->pInode;\n  assert( pInode->nShared!=0 );\n  if( pFile->eFileLock>SHARED_LOCK ){\n    assert( pInode->eFileLock==pFile->eFileLock );\n\n#ifdef SQLITE_DEBUG\n    /* When reducing a lock such that other processes can start\n    ** reading the database file again, make sure that the\n    ** transaction counter was updated if any part of the database\n    ** file changed.  If the transaction counter is not updated,\n    ** other connections to the same file might not realize that\n    ** the file has changed and hence might not know to flush their\n    ** cache.  The use of a stale cache can lead to database corruption.\n    */\n    pFile->inNormalWrite = 0;\n#endif\n\n    /* downgrading to a shared lock on NFS involves clearing the write lock\n    ** before establishing the readlock - to avoid a race condition we downgrade\n    ** the lock in 2 blocks, so that part of the range will be covered by a \n    ** write lock until the rest is covered by a read lock:\n    **  1:   [WWWWW]\n    **  2:   [....W]\n    **  3:   [RRRRW]\n    **  4:   [RRRR.]\n    */\n    if( eFileLock==SHARED_LOCK ){\n#if !defined(__APPLE__) || !SQLITE_ENABLE_LOCKING_STYLE\n      (void)handleNFSUnlock;\n      assert( handleNFSUnlock==0 );\n#endif\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\n      if( handleNFSUnlock ){\n        int tErrno;               /* Error code from system call errors */\n        off_t divSize = SHARED_SIZE - 1;\n        \n        lock.l_type = F_UNLCK;\n        lock.l_whence = SEEK_SET;\n        lock.l_start = SHARED_FIRST;\n        lock.l_len = divSize;\n        if( unixFileLock(pFile, &lock)==(-1) ){\n          tErrno = errno;\n          rc = SQLITE_IOERR_UNLOCK;\n          storeLastErrno(pFile, tErrno);\n          goto end_unlock;\n        }\n        lock.l_type = F_RDLCK;\n        lock.l_whence = SEEK_SET;\n        lock.l_start = SHARED_FIRST;\n        lock.l_len = divSize;\n        if( unixFileLock(pFile, &lock)==(-1) ){\n          tErrno = errno;\n          rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK);\n          if( IS_LOCK_ERROR(rc) ){\n            storeLastErrno(pFile, tErrno);\n          }\n          goto end_unlock;\n        }\n        lock.l_type = F_UNLCK;\n        lock.l_whence = SEEK_SET;\n        lock.l_start = SHARED_FIRST+divSize;\n        lock.l_len = SHARED_SIZE-divSize;\n        if( unixFileLock(pFile, &lock)==(-1) ){\n          tErrno = errno;\n          rc = SQLITE_IOERR_UNLOCK;\n          storeLastErrno(pFile, tErrno);\n          goto end_unlock;\n        }\n      }else\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\n      {\n        lock.l_type = F_RDLCK;\n        lock.l_whence = SEEK_SET;\n        lock.l_start = SHARED_FIRST;\n        lock.l_len = SHARED_SIZE;\n        if( unixFileLock(pFile, &lock) ){\n          /* In theory, the call to unixFileLock() cannot fail because another\n          ** process is holding an incompatible lock. If it does, this \n          ** indicates that the other process is not following the locking\n          ** protocol. If this happens, return SQLITE_IOERR_RDLOCK. Returning\n          ** SQLITE_BUSY would confuse the upper layer (in practice it causes \n          ** an assert to fail). */ \n          rc = SQLITE_IOERR_RDLOCK;\n          storeLastErrno(pFile, errno);\n          goto end_unlock;\n        }\n      }\n    }\n    lock.l_type = F_UNLCK;\n    lock.l_whence = SEEK_SET;\n    lock.l_start = PENDING_BYTE;\n    lock.l_len = 2L;  assert( PENDING_BYTE+1==RESERVED_BYTE );\n    if( unixFileLock(pFile, &lock)==0 ){\n      pInode->eFileLock = SHARED_LOCK;\n    }else{\n      rc = SQLITE_IOERR_UNLOCK;\n      storeLastErrno(pFile, errno);\n      goto end_unlock;\n    }\n  }\n  if( eFileLock==NO_LOCK ){\n    /* Decrement the shared lock counter.  Release the lock using an\n    ** OS call only when all threads in this same process have released\n    ** the lock.\n    */\n    pInode->nShared--;\n    if( pInode->nShared==0 ){\n      lock.l_type = F_UNLCK;\n      lock.l_whence = SEEK_SET;\n      lock.l_start = lock.l_len = 0L;\n      if( unixFileLock(pFile, &lock)==0 ){\n        pInode->eFileLock = NO_LOCK;\n      }else{\n        rc = SQLITE_IOERR_UNLOCK;\n        storeLastErrno(pFile, errno);\n        pInode->eFileLock = NO_LOCK;\n        pFile->eFileLock = NO_LOCK;\n      }\n    }\n\n    /* Decrement the count of locks against this same file.  When the\n    ** count reaches zero, close any other file descriptors whose close\n    ** was deferred because of outstanding locks.\n    */\n    pInode->nLock--;\n    assert( pInode->nLock>=0 );\n    if( pInode->nLock==0 ){\n      closePendingFds(pFile);\n    }\n  }\n  \n#if SQLITE_WCDB_SIGNAL_RETRY\n  WCDBOsTrySignal(pInode);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\nend_unlock:\n  unixLeaveMutex();\n  if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;\n  return rc;\n}\n\n/*\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n** must be either NO_LOCK or SHARED_LOCK.\n**\n** If the locking level of the file descriptor is already at or below\n** the requested locking level, this routine is a no-op.\n*/\nstatic int unixUnlock(sqlite3_file *id, int eFileLock){\n#if SQLITE_MAX_MMAP_SIZE>0\n  assert( eFileLock==SHARED_LOCK || ((unixFile *)id)->nFetchOut==0 );\n#endif\n  return posixUnlock(id, eFileLock, 0);\n}\n\n#if SQLITE_MAX_MMAP_SIZE>0\nstatic int unixMapfile(unixFile *pFd, i64 nByte);\nstatic void unixUnmapfile(unixFile *pFd);\n#endif\n\n/*\n** This function performs the parts of the \"close file\" operation \n** common to all locking schemes. It closes the directory and file\n** handles, if they are valid, and sets all fields of the unixFile\n** structure to 0.\n**\n** It is *not* necessary to hold the mutex when this routine is called,\n** even on VxWorks.  A mutex will be acquired on VxWorks by the\n** vxworksReleaseFileId() routine.\n*/\nstatic int closeUnixFile(sqlite3_file *id){\n  unixFile *pFile = (unixFile*)id;\n#if SQLITE_MAX_MMAP_SIZE>0\n  unixUnmapfile(pFile);\n#endif\n  if( pFile->h>=0 ){\n    robust_close(pFile, pFile->h, __LINE__);\n    pFile->h = -1;\n  }\n#if OS_VXWORKS\n  if( pFile->pId ){\n    if( pFile->ctrlFlags & UNIXFILE_DELETE ){\n      osUnlink(pFile->pId->zCanonicalName);\n    }\n    vxworksReleaseFileId(pFile->pId);\n    pFile->pId = 0;\n  }\n#endif\n#ifdef SQLITE_UNLINK_AFTER_CLOSE\n  if( pFile->ctrlFlags & UNIXFILE_DELETE ){\n    osUnlink(pFile->zPath);\n    sqlite3_free(*(char**)&pFile->zPath);\n    pFile->zPath = 0;\n  }\n#endif\n  OSTRACE((\"CLOSE   %-3d\\n\", pFile->h));\n  OpenCounter(-1);\n  sqlite3_free(pFile->pUnused);\n  memset(pFile, 0, sizeof(unixFile));\n  return SQLITE_OK;\n}\n\n/*\n** Close a file.\n*/\nstatic int unixClose(sqlite3_file *id){\n  int rc = SQLITE_OK;\n  unixFile *pFile = (unixFile *)id;\n  verifyDbFile(pFile);\n  unixUnlock(id, NO_LOCK);\n  unixEnterMutex();\n\n  /* unixFile.pInode is always valid here. Otherwise, a different close\n  ** routine (e.g. nolockClose()) would be called instead.\n  */\n  assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 );\n  if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){\n    /* If there are outstanding locks, do not actually close the file just\n    ** yet because that would clear those locks.  Instead, add the file\n    ** descriptor to pInode->pUnused list.  It will be automatically closed \n    ** when the last lock is cleared.\n    */\n    setPendingFd(pFile);\n  }\n  releaseInodeInfo(pFile);\n  rc = closeUnixFile(id);\n  unixLeaveMutex();\n  return rc;\n}\n\n/************** End of the posix advisory lock implementation *****************\n******************************************************************************/\n\n/******************************************************************************\n****************************** No-op Locking **********************************\n**\n** Of the various locking implementations available, this is by far the\n** simplest:  locking is ignored.  No attempt is made to lock the database\n** file for reading or writing.\n**\n** This locking mode is appropriate for use on read-only databases\n** (ex: databases that are burned into CD-ROM, for example.)  It can\n** also be used if the application employs some external mechanism to\n** prevent simultaneous access of the same database by two or more\n** database connections.  But there is a serious risk of database\n** corruption if this locking mode is used in situations where multiple\n** database connections are accessing the same database file at the same\n** time and one or more of those connections are writing.\n*/\n\nstatic int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){\n  UNUSED_PARAMETER(NotUsed);\n  *pResOut = 0;\n  return SQLITE_OK;\n}\nstatic int nolockLock(sqlite3_file *NotUsed, int NotUsed2){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  return SQLITE_OK;\n}\nstatic int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  return SQLITE_OK;\n}\n\n/*\n** Close the file.\n*/\nstatic int nolockClose(sqlite3_file *id) {\n  return closeUnixFile(id);\n}\n\n/******************* End of the no-op lock implementation *********************\n******************************************************************************/\n\n/******************************************************************************\n************************* Begin dot-file Locking ******************************\n**\n** The dotfile locking implementation uses the existence of separate lock\n** files (really a directory) to control access to the database.  This works\n** on just about every filesystem imaginable.  But there are serious downsides:\n**\n**    (1)  There is zero concurrency.  A single reader blocks all other\n**         connections from reading or writing the database.\n**\n**    (2)  An application crash or power loss can leave stale lock files\n**         sitting around that need to be cleared manually.\n**\n** Nevertheless, a dotlock is an appropriate locking mode for use if no\n** other locking strategy is available.\n**\n** Dotfile locking works by creating a subdirectory in the same directory as\n** the database and with the same name but with a \".lock\" extension added.\n** The existence of a lock directory implies an EXCLUSIVE lock.  All other\n** lock types (SHARED, RESERVED, PENDING) are mapped into EXCLUSIVE.\n*/\n\n/*\n** The file suffix added to the data base filename in order to create the\n** lock directory.\n*/\n#define DOTLOCK_SUFFIX \".lock\"\n\n/*\n** This routine checks if there is a RESERVED lock held on the specified\n** file by this or any other process. If such a lock is held, set *pResOut\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\n**\n** In dotfile locking, either a lock exists or it does not.  So in this\n** variation of CheckReservedLock(), *pResOut is set to true if any lock\n** is held on the file and false if the file is unlocked.\n*/\nstatic int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) {\n  int rc = SQLITE_OK;\n  int reserved = 0;\n  unixFile *pFile = (unixFile*)id;\n\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\n  \n  assert( pFile );\n  reserved = osAccess((const char*)pFile->lockingContext, 0)==0;\n  OSTRACE((\"TEST WR-LOCK %d %d %d (dotlock)\\n\", pFile->h, rc, reserved));\n  *pResOut = reserved;\n  return rc;\n}\n\n/*\n** Lock the file with the lock specified by parameter eFileLock - one\n** of the following:\n**\n**     (1) SHARED_LOCK\n**     (2) RESERVED_LOCK\n**     (3) PENDING_LOCK\n**     (4) EXCLUSIVE_LOCK\n**\n** Sometimes when requesting one lock state, additional lock states\n** are inserted in between.  The locking might fail on one of the later\n** transitions leaving the lock state different from what it started but\n** still short of its goal.  The following chart shows the allowed\n** transitions and the inserted intermediate states:\n**\n**    UNLOCKED -> SHARED\n**    SHARED -> RESERVED\n**    SHARED -> (PENDING) -> EXCLUSIVE\n**    RESERVED -> (PENDING) -> EXCLUSIVE\n**    PENDING -> EXCLUSIVE\n**\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\n** routine to lower a locking level.\n**\n** With dotfile locking, we really only support state (4): EXCLUSIVE.\n** But we track the other locking levels internally.\n*/\nstatic int dotlockLock(sqlite3_file *id, int eFileLock) {\n  unixFile *pFile = (unixFile*)id;\n  char *zLockFile = (char *)pFile->lockingContext;\n  int rc = SQLITE_OK;\n\n\n  /* If we have any lock, then the lock file already exists.  All we have\n  ** to do is adjust our internal record of the lock level.\n  */\n  if( pFile->eFileLock > NO_LOCK ){\n    pFile->eFileLock = eFileLock;\n    /* Always update the timestamp on the old file */\n#ifdef HAVE_UTIME\n    utime(zLockFile, NULL);\n#else\n    utimes(zLockFile, NULL);\n#endif\n    return SQLITE_OK;\n  }\n  \n  /* grab an exclusive lock */\n  rc = osMkdir(zLockFile, 0777);\n  if( rc<0 ){\n    /* failed to open/create the lock directory */\n    int tErrno = errno;\n    if( EEXIST == tErrno ){\n      rc = SQLITE_BUSY;\n    } else {\n      rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\n      if( rc!=SQLITE_BUSY ){\n        storeLastErrno(pFile, tErrno);\n      }\n    }\n    return rc;\n  } \n  \n  /* got it, set the type and return ok */\n  pFile->eFileLock = eFileLock;\n  return rc;\n}\n\n/*\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n** must be either NO_LOCK or SHARED_LOCK.\n**\n** If the locking level of the file descriptor is already at or below\n** the requested locking level, this routine is a no-op.\n**\n** When the locking level reaches NO_LOCK, delete the lock file.\n*/\nstatic int dotlockUnlock(sqlite3_file *id, int eFileLock) {\n  unixFile *pFile = (unixFile*)id;\n  char *zLockFile = (char *)pFile->lockingContext;\n  int rc;\n\n  assert( pFile );\n  OSTRACE((\"UNLOCK  %d %d was %d pid=%d (dotlock)\\n\", pFile->h, eFileLock,\n           pFile->eFileLock, osGetpid(0)));\n  assert( eFileLock<=SHARED_LOCK );\n  \n  /* no-op if possible */\n  if( pFile->eFileLock==eFileLock ){\n    return SQLITE_OK;\n  }\n\n  /* To downgrade to shared, simply update our internal notion of the\n  ** lock state.  No need to mess with the file on disk.\n  */\n  if( eFileLock==SHARED_LOCK ){\n    pFile->eFileLock = SHARED_LOCK;\n    return SQLITE_OK;\n  }\n  \n  /* To fully unlock the database, delete the lock file */\n  assert( eFileLock==NO_LOCK );\n  rc = osRmdir(zLockFile);\n  if( rc<0 ){\n    int tErrno = errno;\n    if( tErrno==ENOENT ){\n      rc = SQLITE_OK;\n    }else{\n      rc = SQLITE_IOERR_UNLOCK;\n      storeLastErrno(pFile, tErrno);\n    }\n    return rc; \n  }\n  pFile->eFileLock = NO_LOCK;\n  return SQLITE_OK;\n}\n\n/*\n** Close a file.  Make sure the lock has been released before closing.\n*/\nstatic int dotlockClose(sqlite3_file *id) {\n  unixFile *pFile = (unixFile*)id;\n  assert( id!=0 );\n  dotlockUnlock(id, NO_LOCK);\n  sqlite3_free(pFile->lockingContext);\n  return closeUnixFile(id);\n}\n/****************** End of the dot-file lock implementation *******************\n******************************************************************************/\n\n/******************************************************************************\n************************** Begin flock Locking ********************************\n**\n** Use the flock() system call to do file locking.\n**\n** flock() locking is like dot-file locking in that the various\n** fine-grain locking levels supported by SQLite are collapsed into\n** a single exclusive lock.  In other words, SHARED, RESERVED, and\n** PENDING locks are the same thing as an EXCLUSIVE lock.  SQLite\n** still works when you do this, but concurrency is reduced since\n** only a single process can be reading the database at a time.\n**\n** Omit this section if SQLITE_ENABLE_LOCKING_STYLE is turned off\n*/\n#if SQLITE_ENABLE_LOCKING_STYLE\n\n/*\n** Retry flock() calls that fail with EINTR\n*/\n#ifdef EINTR\nstatic int robust_flock(int fd, int op){\n  int rc;\n  do{ rc = flock(fd,op); }while( rc<0 && errno==EINTR );\n  return rc;\n}\n#else\n# define robust_flock(a,b) flock(a,b)\n#endif\n     \n\n/*\n** This routine checks if there is a RESERVED lock held on the specified\n** file by this or any other process. If such a lock is held, set *pResOut\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\n*/\nstatic int flockCheckReservedLock(sqlite3_file *id, int *pResOut){\n  int rc = SQLITE_OK;\n  int reserved = 0;\n  unixFile *pFile = (unixFile*)id;\n  \n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\n  \n  assert( pFile );\n  \n  /* Check if a thread in this process holds such a lock */\n  if( pFile->eFileLock>SHARED_LOCK ){\n    reserved = 1;\n  }\n  \n  /* Otherwise see if some other process holds it. */\n  if( !reserved ){\n    /* attempt to get the lock */\n    int lrc = robust_flock(pFile->h, LOCK_EX | LOCK_NB);\n    if( !lrc ){\n      /* got the lock, unlock it */\n      lrc = robust_flock(pFile->h, LOCK_UN);\n      if ( lrc ) {\n        int tErrno = errno;\n        /* unlock failed with an error */\n        lrc = SQLITE_IOERR_UNLOCK; \n        storeLastErrno(pFile, tErrno);\n        rc = lrc;\n      }\n    } else {\n      int tErrno = errno;\n      reserved = 1;\n      /* someone else might have it reserved */\n      lrc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); \n      if( IS_LOCK_ERROR(lrc) ){\n        storeLastErrno(pFile, tErrno);\n        rc = lrc;\n      }\n    }\n  }\n  OSTRACE((\"TEST WR-LOCK %d %d %d (flock)\\n\", pFile->h, rc, reserved));\n\n#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS\n  if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){\n    rc = SQLITE_OK;\n    reserved=1;\n  }\n#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */\n  *pResOut = reserved;\n  return rc;\n}\n\n/*\n** Lock the file with the lock specified by parameter eFileLock - one\n** of the following:\n**\n**     (1) SHARED_LOCK\n**     (2) RESERVED_LOCK\n**     (3) PENDING_LOCK\n**     (4) EXCLUSIVE_LOCK\n**\n** Sometimes when requesting one lock state, additional lock states\n** are inserted in between.  The locking might fail on one of the later\n** transitions leaving the lock state different from what it started but\n** still short of its goal.  The following chart shows the allowed\n** transitions and the inserted intermediate states:\n**\n**    UNLOCKED -> SHARED\n**    SHARED -> RESERVED\n**    SHARED -> (PENDING) -> EXCLUSIVE\n**    RESERVED -> (PENDING) -> EXCLUSIVE\n**    PENDING -> EXCLUSIVE\n**\n** flock() only really support EXCLUSIVE locks.  We track intermediate\n** lock states in the sqlite3_file structure, but all locks SHARED or\n** above are really EXCLUSIVE locks and exclude all other processes from\n** access the file.\n**\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\n** routine to lower a locking level.\n*/\nstatic int flockLock(sqlite3_file *id, int eFileLock) {\n  int rc = SQLITE_OK;\n  unixFile *pFile = (unixFile*)id;\n\n  assert( pFile );\n\n  /* if we already have a lock, it is exclusive.  \n  ** Just adjust level and punt on outta here. */\n  if (pFile->eFileLock > NO_LOCK) {\n    pFile->eFileLock = eFileLock;\n    return SQLITE_OK;\n  }\n  \n  /* grab an exclusive lock */\n  \n  if (robust_flock(pFile->h, LOCK_EX | LOCK_NB)) {\n    int tErrno = errno;\n    /* didn't get, must be busy */\n    rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);\n    if( IS_LOCK_ERROR(rc) ){\n      storeLastErrno(pFile, tErrno);\n    }\n  } else {\n    /* got it, set the type and return ok */\n    pFile->eFileLock = eFileLock;\n  }\n  OSTRACE((\"LOCK    %d %s %s (flock)\\n\", pFile->h, azFileLock(eFileLock), \n           rc==SQLITE_OK ? \"ok\" : \"failed\"));\n#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS\n  if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){\n    rc = SQLITE_BUSY;\n  }\n#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */\n  return rc;\n}\n\n\n/*\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n** must be either NO_LOCK or SHARED_LOCK.\n**\n** If the locking level of the file descriptor is already at or below\n** the requested locking level, this routine is a no-op.\n*/\nstatic int flockUnlock(sqlite3_file *id, int eFileLock) {\n  unixFile *pFile = (unixFile*)id;\n  \n  assert( pFile );\n  OSTRACE((\"UNLOCK  %d %d was %d pid=%d (flock)\\n\", pFile->h, eFileLock,\n           pFile->eFileLock, osGetpid(0)));\n  assert( eFileLock<=SHARED_LOCK );\n  \n  /* no-op if possible */\n  if( pFile->eFileLock==eFileLock ){\n    return SQLITE_OK;\n  }\n  \n  /* shared can just be set because we always have an exclusive */\n  if (eFileLock==SHARED_LOCK) {\n    pFile->eFileLock = eFileLock;\n    return SQLITE_OK;\n  }\n  \n  /* no, really, unlock. */\n  if( robust_flock(pFile->h, LOCK_UN) ){\n#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS\n    return SQLITE_OK;\n#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */\n    return SQLITE_IOERR_UNLOCK;\n  }else{\n    pFile->eFileLock = NO_LOCK;\n    return SQLITE_OK;\n  }\n}\n\n/*\n** Close a file.\n*/\nstatic int flockClose(sqlite3_file *id) {\n  assert( id!=0 );\n  flockUnlock(id, NO_LOCK);\n  return closeUnixFile(id);\n}\n\n#endif /* SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORK */\n\n/******************* End of the flock lock implementation *********************\n******************************************************************************/\n\n/******************************************************************************\n************************ Begin Named Semaphore Locking ************************\n**\n** Named semaphore locking is only supported on VxWorks.\n**\n** Semaphore locking is like dot-lock and flock in that it really only\n** supports EXCLUSIVE locking.  Only a single process can read or write\n** the database file at a time.  This reduces potential concurrency, but\n** makes the lock implementation much easier.\n*/\n#if OS_VXWORKS\n\n/*\n** This routine checks if there is a RESERVED lock held on the specified\n** file by this or any other process. If such a lock is held, set *pResOut\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\n*/\nstatic int semXCheckReservedLock(sqlite3_file *id, int *pResOut) {\n  int rc = SQLITE_OK;\n  int reserved = 0;\n  unixFile *pFile = (unixFile*)id;\n\n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\n  \n  assert( pFile );\n\n  /* Check if a thread in this process holds such a lock */\n  if( pFile->eFileLock>SHARED_LOCK ){\n    reserved = 1;\n  }\n  \n  /* Otherwise see if some other process holds it. */\n  if( !reserved ){\n    sem_t *pSem = pFile->pInode->pSem;\n\n    if( sem_trywait(pSem)==-1 ){\n      int tErrno = errno;\n      if( EAGAIN != tErrno ){\n        rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_CHECKRESERVEDLOCK);\n        storeLastErrno(pFile, tErrno);\n      } else {\n        /* someone else has the lock when we are in NO_LOCK */\n        reserved = (pFile->eFileLock < SHARED_LOCK);\n      }\n    }else{\n      /* we could have it if we want it */\n      sem_post(pSem);\n    }\n  }\n  OSTRACE((\"TEST WR-LOCK %d %d %d (sem)\\n\", pFile->h, rc, reserved));\n\n  *pResOut = reserved;\n  return rc;\n}\n\n/*\n** Lock the file with the lock specified by parameter eFileLock - one\n** of the following:\n**\n**     (1) SHARED_LOCK\n**     (2) RESERVED_LOCK\n**     (3) PENDING_LOCK\n**     (4) EXCLUSIVE_LOCK\n**\n** Sometimes when requesting one lock state, additional lock states\n** are inserted in between.  The locking might fail on one of the later\n** transitions leaving the lock state different from what it started but\n** still short of its goal.  The following chart shows the allowed\n** transitions and the inserted intermediate states:\n**\n**    UNLOCKED -> SHARED\n**    SHARED -> RESERVED\n**    SHARED -> (PENDING) -> EXCLUSIVE\n**    RESERVED -> (PENDING) -> EXCLUSIVE\n**    PENDING -> EXCLUSIVE\n**\n** Semaphore locks only really support EXCLUSIVE locks.  We track intermediate\n** lock states in the sqlite3_file structure, but all locks SHARED or\n** above are really EXCLUSIVE locks and exclude all other processes from\n** access the file.\n**\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\n** routine to lower a locking level.\n*/\nstatic int semXLock(sqlite3_file *id, int eFileLock) {\n  unixFile *pFile = (unixFile*)id;\n  sem_t *pSem = pFile->pInode->pSem;\n  int rc = SQLITE_OK;\n\n  /* if we already have a lock, it is exclusive.  \n  ** Just adjust level and punt on outta here. */\n  if (pFile->eFileLock > NO_LOCK) {\n    pFile->eFileLock = eFileLock;\n    rc = SQLITE_OK;\n    goto sem_end_lock;\n  }\n  \n  /* lock semaphore now but bail out when already locked. */\n  if( sem_trywait(pSem)==-1 ){\n    rc = SQLITE_BUSY;\n    goto sem_end_lock;\n  }\n\n  /* got it, set the type and return ok */\n  pFile->eFileLock = eFileLock;\n\n sem_end_lock:\n  return rc;\n}\n\n/*\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n** must be either NO_LOCK or SHARED_LOCK.\n**\n** If the locking level of the file descriptor is already at or below\n** the requested locking level, this routine is a no-op.\n*/\nstatic int semXUnlock(sqlite3_file *id, int eFileLock) {\n  unixFile *pFile = (unixFile*)id;\n  sem_t *pSem = pFile->pInode->pSem;\n\n  assert( pFile );\n  assert( pSem );\n  OSTRACE((\"UNLOCK  %d %d was %d pid=%d (sem)\\n\", pFile->h, eFileLock,\n           pFile->eFileLock, osGetpid(0)));\n  assert( eFileLock<=SHARED_LOCK );\n  \n  /* no-op if possible */\n  if( pFile->eFileLock==eFileLock ){\n    return SQLITE_OK;\n  }\n  \n  /* shared can just be set because we always have an exclusive */\n  if (eFileLock==SHARED_LOCK) {\n    pFile->eFileLock = eFileLock;\n    return SQLITE_OK;\n  }\n  \n  /* no, really unlock. */\n  if ( sem_post(pSem)==-1 ) {\n    int rc, tErrno = errno;\n    rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);\n    if( IS_LOCK_ERROR(rc) ){\n      storeLastErrno(pFile, tErrno);\n    }\n    return rc; \n  }\n  pFile->eFileLock = NO_LOCK;\n  return SQLITE_OK;\n}\n\n/*\n ** Close a file.\n */\nstatic int semXClose(sqlite3_file *id) {\n  if( id ){\n    unixFile *pFile = (unixFile*)id;\n    semXUnlock(id, NO_LOCK);\n    assert( pFile );\n    unixEnterMutex();\n    releaseInodeInfo(pFile);\n    unixLeaveMutex();\n    closeUnixFile(id);\n  }\n  return SQLITE_OK;\n}\n\n#endif /* OS_VXWORKS */\n/*\n** Named semaphore locking is only available on VxWorks.\n**\n*************** End of the named semaphore lock implementation ****************\n******************************************************************************/\n\n\n/******************************************************************************\n*************************** Begin AFP Locking *********************************\n**\n** AFP is the Apple Filing Protocol.  AFP is a network filesystem found\n** on Apple Macintosh computers - both OS9 and OSX.\n**\n** Third-party implementations of AFP are available.  But this code here\n** only works on OSX.\n*/\n\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\n/*\n** The afpLockingContext structure contains all afp lock specific state\n*/\ntypedef struct afpLockingContext afpLockingContext;\nstruct afpLockingContext {\n  int reserved;\n  const char *dbPath;             /* Name of the open file */\n};\n\nstruct ByteRangeLockPB2\n{\n  unsigned long long offset;        /* offset to first byte to lock */\n  unsigned long long length;        /* nbr of bytes to lock */\n  unsigned long long retRangeStart; /* nbr of 1st byte locked if successful */\n  unsigned char unLockFlag;         /* 1 = unlock, 0 = lock */\n  unsigned char startEndFlag;       /* 1=rel to end of fork, 0=rel to start */\n  int fd;                           /* file desc to assoc this lock with */\n};\n\n#define afpfsByteRangeLock2FSCTL        _IOWR('z', 23, struct ByteRangeLockPB2)\n\n/*\n** This is a utility for setting or clearing a bit-range lock on an\n** AFP filesystem.\n** \n** Return SQLITE_OK on success, SQLITE_BUSY on failure.\n*/\nstatic int afpSetLock(\n  const char *path,              /* Name of the file to be locked or unlocked */\n  unixFile *pFile,               /* Open file descriptor on path */\n  unsigned long long offset,     /* First byte to be locked */\n  unsigned long long length,     /* Number of bytes to lock */\n  int setLockFlag                /* True to set lock.  False to clear lock */\n){\n  struct ByteRangeLockPB2 pb;\n  int err;\n  \n  pb.unLockFlag = setLockFlag ? 0 : 1;\n  pb.startEndFlag = 0;\n  pb.offset = offset;\n  pb.length = length; \n  pb.fd = pFile->h;\n  \n  OSTRACE((\"AFPSETLOCK [%s] for %d%s in range %llx:%llx\\n\", \n    (setLockFlag?\"ON\":\"OFF\"), pFile->h, (pb.fd==-1?\"[testval-1]\":\"\"),\n    offset, length));\n  err = fsctl(path, afpfsByteRangeLock2FSCTL, &pb, 0);\n  if ( err==-1 ) {\n    int rc;\n    int tErrno = errno;\n    OSTRACE((\"AFPSETLOCK failed to fsctl() '%s' %d %s\\n\",\n             path, tErrno, strerror(tErrno)));\n#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS\n    rc = SQLITE_BUSY;\n#else\n    rc = sqliteErrorFromPosixError(tErrno,\n                    setLockFlag ? SQLITE_IOERR_LOCK : SQLITE_IOERR_UNLOCK);\n#endif /* SQLITE_IGNORE_AFP_LOCK_ERRORS */\n    if( IS_LOCK_ERROR(rc) ){\n      storeLastErrno(pFile, tErrno);\n    }\n    return rc;\n  } else {\n    return SQLITE_OK;\n  }\n}\n\n/*\n** This routine checks if there is a RESERVED lock held on the specified\n** file by this or any other process. If such a lock is held, set *pResOut\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\n*/\nstatic int afpCheckReservedLock(sqlite3_file *id, int *pResOut){\n  int rc = SQLITE_OK;\n  int reserved = 0;\n  unixFile *pFile = (unixFile*)id;\n  afpLockingContext *context;\n  \n  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );\n  \n  assert( pFile );\n  context = (afpLockingContext *) pFile->lockingContext;\n  if( context->reserved ){\n    *pResOut = 1;\n    return SQLITE_OK;\n  }\n  unixEnterMutex(); /* Because pFile->pInode is shared across threads */\n  \n  /* Check if a thread in this process holds such a lock */\n  if( pFile->pInode->eFileLock>SHARED_LOCK ){\n    reserved = 1;\n  }\n  \n  /* Otherwise see if some other process holds it.\n   */\n  if( !reserved ){\n    /* lock the RESERVED byte */\n    int lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);  \n    if( SQLITE_OK==lrc ){\n      /* if we succeeded in taking the reserved lock, unlock it to restore\n      ** the original state */\n      lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);\n    } else {\n      /* if we failed to get the lock then someone else must have it */\n      reserved = 1;\n    }\n    if( IS_LOCK_ERROR(lrc) ){\n      rc=lrc;\n    }\n  }\n  \n  unixLeaveMutex();\n  OSTRACE((\"TEST WR-LOCK %d %d %d (afp)\\n\", pFile->h, rc, reserved));\n  \n  *pResOut = reserved;\n  return rc;\n}\n\n/*\n** Lock the file with the lock specified by parameter eFileLock - one\n** of the following:\n**\n**     (1) SHARED_LOCK\n**     (2) RESERVED_LOCK\n**     (3) PENDING_LOCK\n**     (4) EXCLUSIVE_LOCK\n**\n** Sometimes when requesting one lock state, additional lock states\n** are inserted in between.  The locking might fail on one of the later\n** transitions leaving the lock state different from what it started but\n** still short of its goal.  The following chart shows the allowed\n** transitions and the inserted intermediate states:\n**\n**    UNLOCKED -> SHARED\n**    SHARED -> RESERVED\n**    SHARED -> (PENDING) -> EXCLUSIVE\n**    RESERVED -> (PENDING) -> EXCLUSIVE\n**    PENDING -> EXCLUSIVE\n**\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\n** routine to lower a locking level.\n*/\nstatic int afpLock(sqlite3_file *id, int eFileLock){\n  int rc = SQLITE_OK;\n  unixFile *pFile = (unixFile*)id;\n  unixInodeInfo *pInode = pFile->pInode;\n  afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;\n  \n  assert( pFile );\n  OSTRACE((\"LOCK    %d %s was %s(%s,%d) pid=%d (afp)\\n\", pFile->h,\n           azFileLock(eFileLock), azFileLock(pFile->eFileLock),\n           azFileLock(pInode->eFileLock), pInode->nShared , osGetpid(0)));\n\n  /* If there is already a lock of this type or more restrictive on the\n  ** unixFile, do nothing. Don't use the afp_end_lock: exit path, as\n  ** unixEnterMutex() hasn't been called yet.\n  */\n  if( pFile->eFileLock>=eFileLock ){\n    OSTRACE((\"LOCK    %d %s ok (already held) (afp)\\n\", pFile->h,\n           azFileLock(eFileLock)));\n    return SQLITE_OK;\n  }\n\n  /* Make sure the locking sequence is correct\n  **  (1) We never move from unlocked to anything higher than shared lock.\n  **  (2) SQLite never explicitly requests a pendig lock.\n  **  (3) A shared lock is always held when a reserve lock is requested.\n  */\n  assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK );\n  assert( eFileLock!=PENDING_LOCK );\n  assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK );\n  \n  /* This mutex is needed because pFile->pInode is shared across threads\n  */\n  unixEnterMutex();\n  pInode = pFile->pInode;\n\n  /* If some thread using this PID has a lock via a different unixFile*\n  ** handle that precludes the requested lock, return BUSY.\n  */\n  if( (pFile->eFileLock!=pInode->eFileLock && \n       (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK))\n     ){\n    rc = SQLITE_BUSY;\n    goto afp_end_lock;\n  }\n  \n  /* If a SHARED lock is requested, and some thread using this PID already\n  ** has a SHARED or RESERVED lock, then increment reference counts and\n  ** return SQLITE_OK.\n  */\n  if( eFileLock==SHARED_LOCK && \n     (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){\n    assert( eFileLock==SHARED_LOCK );\n    assert( pFile->eFileLock==0 );\n    assert( pInode->nShared>0 );\n    pFile->eFileLock = SHARED_LOCK;\n    pInode->nShared++;\n    pInode->nLock++;\n    goto afp_end_lock;\n  }\n    \n  /* A PENDING lock is needed before acquiring a SHARED lock and before\n  ** acquiring an EXCLUSIVE lock.  For the SHARED lock, the PENDING will\n  ** be released.\n  */\n  if( eFileLock==SHARED_LOCK \n      || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock<PENDING_LOCK)\n  ){\n    int failed;\n    failed = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 1);\n    if (failed) {\n      rc = failed;\n      goto afp_end_lock;\n    }\n  }\n  \n  /* If control gets to this point, then actually go ahead and make\n  ** operating system calls for the specified lock.\n  */\n  if( eFileLock==SHARED_LOCK ){\n    int lrc1, lrc2, lrc1Errno = 0;\n    long lk, mask;\n    \n    assert( pInode->nShared==0 );\n    assert( pInode->eFileLock==0 );\n        \n    mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff;\n    /* Now get the read-lock SHARED_LOCK */\n    /* note that the quality of the randomness doesn't matter that much */\n    lk = random(); \n    pInode->sharedByte = (lk & mask)%(SHARED_SIZE - 1);\n    lrc1 = afpSetLock(context->dbPath, pFile, \n          SHARED_FIRST+pInode->sharedByte, 1, 1);\n    if( IS_LOCK_ERROR(lrc1) ){\n      lrc1Errno = pFile->lastErrno;\n    }\n    /* Drop the temporary PENDING lock */\n    lrc2 = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);\n    \n    if( IS_LOCK_ERROR(lrc1) ) {\n      storeLastErrno(pFile, lrc1Errno);\n      rc = lrc1;\n      goto afp_end_lock;\n    } else if( IS_LOCK_ERROR(lrc2) ){\n      rc = lrc2;\n      goto afp_end_lock;\n    } else if( lrc1 != SQLITE_OK ) {\n      rc = lrc1;\n    } else {\n      pFile->eFileLock = SHARED_LOCK;\n      pInode->nLock++;\n      pInode->nShared = 1;\n    }\n  }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){\n    /* We are trying for an exclusive lock but another thread in this\n     ** same process is still holding a shared lock. */\n    rc = SQLITE_BUSY;\n  }else{\n    /* The request was for a RESERVED or EXCLUSIVE lock.  It is\n    ** assumed that there is a SHARED or greater lock on the file\n    ** already.\n    */\n    int failed = 0;\n    assert( 0!=pFile->eFileLock );\n    if (eFileLock >= RESERVED_LOCK && pFile->eFileLock < RESERVED_LOCK) {\n        /* Acquire a RESERVED lock */\n        failed = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1);\n      if( !failed ){\n        context->reserved = 1;\n      }\n    }\n    if (!failed && eFileLock == EXCLUSIVE_LOCK) {\n      /* Acquire an EXCLUSIVE lock */\n        \n      /* Remove the shared lock before trying the range.  we'll need to \n      ** reestablish the shared lock if we can't get the  afpUnlock\n      */\n      if( !(failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST +\n                         pInode->sharedByte, 1, 0)) ){\n        int failed2 = SQLITE_OK;\n        /* now attemmpt to get the exclusive lock range */\n        failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST, \n                               SHARED_SIZE, 1);\n        if( failed && (failed2 = afpSetLock(context->dbPath, pFile, \n                       SHARED_FIRST + pInode->sharedByte, 1, 1)) ){\n          /* Can't reestablish the shared lock.  Sqlite can't deal, this is\n          ** a critical I/O error\n          */\n          rc = ((failed & SQLITE_IOERR) == SQLITE_IOERR) ? failed2 : \n               SQLITE_IOERR_LOCK;\n          goto afp_end_lock;\n        } \n      }else{\n        rc = failed; \n      }\n    }\n    if( failed ){\n      rc = failed;\n    }\n  }\n  \n  if( rc==SQLITE_OK ){\n    pFile->eFileLock = eFileLock;\n    pInode->eFileLock = eFileLock;\n  }else if( eFileLock==EXCLUSIVE_LOCK ){\n    pFile->eFileLock = PENDING_LOCK;\n    pInode->eFileLock = PENDING_LOCK;\n  }\n  \nafp_end_lock:\n  unixLeaveMutex();\n  OSTRACE((\"LOCK    %d %s %s (afp)\\n\", pFile->h, azFileLock(eFileLock), \n         rc==SQLITE_OK ? \"ok\" : \"failed\"));\n  return rc;\n}\n\n/*\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n** must be either NO_LOCK or SHARED_LOCK.\n**\n** If the locking level of the file descriptor is already at or below\n** the requested locking level, this routine is a no-op.\n*/\nstatic int afpUnlock(sqlite3_file *id, int eFileLock) {\n  int rc = SQLITE_OK;\n  unixFile *pFile = (unixFile*)id;\n  unixInodeInfo *pInode;\n  afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;\n  int skipShared = 0;\n#ifdef SQLITE_TEST\n  int h = pFile->h;\n#endif\n\n  assert( pFile );\n  OSTRACE((\"UNLOCK  %d %d was %d(%d,%d) pid=%d (afp)\\n\", pFile->h, eFileLock,\n           pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,\n           osGetpid(0)));\n\n  assert( eFileLock<=SHARED_LOCK );\n  if( pFile->eFileLock<=eFileLock ){\n    return SQLITE_OK;\n  }\n  unixEnterMutex();\n  pInode = pFile->pInode;\n  assert( pInode->nShared!=0 );\n  if( pFile->eFileLock>SHARED_LOCK ){\n    assert( pInode->eFileLock==pFile->eFileLock );\n    SimulateIOErrorBenign(1);\n    SimulateIOError( h=(-1) )\n    SimulateIOErrorBenign(0);\n    \n#ifdef SQLITE_DEBUG\n    /* When reducing a lock such that other processes can start\n    ** reading the database file again, make sure that the\n    ** transaction counter was updated if any part of the database\n    ** file changed.  If the transaction counter is not updated,\n    ** other connections to the same file might not realize that\n    ** the file has changed and hence might not know to flush their\n    ** cache.  The use of a stale cache can lead to database corruption.\n    */\n    assert( pFile->inNormalWrite==0\n           || pFile->dbUpdate==0\n           || pFile->transCntrChng==1 );\n    pFile->inNormalWrite = 0;\n#endif\n    \n    if( pFile->eFileLock==EXCLUSIVE_LOCK ){\n      rc = afpSetLock(context->dbPath, pFile, SHARED_FIRST, SHARED_SIZE, 0);\n      if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1) ){\n        /* only re-establish the shared lock if necessary */\n        int sharedLockByte = SHARED_FIRST+pInode->sharedByte;\n        rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 1);\n      } else {\n        skipShared = 1;\n      }\n    }\n    if( rc==SQLITE_OK && pFile->eFileLock>=PENDING_LOCK ){\n      rc = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0);\n    } \n    if( rc==SQLITE_OK && pFile->eFileLock>=RESERVED_LOCK && context->reserved ){\n      rc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0);\n      if( !rc ){ \n        context->reserved = 0; \n      }\n    }\n    if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1)){\n      pInode->eFileLock = SHARED_LOCK;\n    }\n  }\n  if( rc==SQLITE_OK && eFileLock==NO_LOCK ){\n\n    /* Decrement the shared lock counter.  Release the lock using an\n    ** OS call only when all threads in this same process have released\n    ** the lock.\n    */\n    unsigned long long sharedLockByte = SHARED_FIRST+pInode->sharedByte;\n    pInode->nShared--;\n    if( pInode->nShared==0 ){\n      SimulateIOErrorBenign(1);\n      SimulateIOError( h=(-1) )\n      SimulateIOErrorBenign(0);\n      if( !skipShared ){\n        rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 0);\n      }\n      if( !rc ){\n        pInode->eFileLock = NO_LOCK;\n        pFile->eFileLock = NO_LOCK;\n      }\n    }\n    if( rc==SQLITE_OK ){\n      pInode->nLock--;\n      assert( pInode->nLock>=0 );\n      if( pInode->nLock==0 ){\n        closePendingFds(pFile);\n      }\n    }\n  }\n  \n  unixLeaveMutex();\n  if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock;\n  return rc;\n}\n\n/*\n** Close a file & cleanup AFP specific locking context \n*/\nstatic int afpClose(sqlite3_file *id) {\n  int rc = SQLITE_OK;\n  unixFile *pFile = (unixFile*)id;\n  assert( id!=0 );\n  afpUnlock(id, NO_LOCK);\n  unixEnterMutex();\n  if( pFile->pInode && pFile->pInode->nLock ){\n    /* If there are outstanding locks, do not actually close the file just\n    ** yet because that would clear those locks.  Instead, add the file\n    ** descriptor to pInode->aPending.  It will be automatically closed when\n    ** the last lock is cleared.\n    */\n    setPendingFd(pFile);\n  }\n  releaseInodeInfo(pFile);\n  sqlite3_free(pFile->lockingContext);\n  rc = closeUnixFile(id);\n  unixLeaveMutex();\n  return rc;\n}\n\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\n/*\n** The code above is the AFP lock implementation.  The code is specific\n** to MacOSX and does not work on other unix platforms.  No alternative\n** is available.  If you don't compile for a mac, then the \"unix-afp\"\n** VFS is not available.\n**\n********************* End of the AFP lock implementation **********************\n******************************************************************************/\n\n/******************************************************************************\n*************************** Begin NFS Locking ********************************/\n\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\n/*\n ** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n ** must be either NO_LOCK or SHARED_LOCK.\n **\n ** If the locking level of the file descriptor is already at or below\n ** the requested locking level, this routine is a no-op.\n */\nstatic int nfsUnlock(sqlite3_file *id, int eFileLock){\n  return posixUnlock(id, eFileLock, 1);\n}\n\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\n/*\n** The code above is the NFS lock implementation.  The code is specific\n** to MacOSX and does not work on other unix platforms.  No alternative\n** is available.  \n**\n********************* End of the NFS lock implementation **********************\n******************************************************************************/\n\n/******************************************************************************\n**************** Non-locking sqlite3_file methods *****************************\n**\n** The next division contains implementations for all methods of the \n** sqlite3_file object other than the locking methods.  The locking\n** methods were defined in divisions above (one locking method per\n** division).  Those methods that are common to all locking modes\n** are gather together into this division.\n*/\n\n/*\n** Seek to the offset passed as the second argument, then read cnt \n** bytes into pBuf. Return the number of bytes actually read.\n**\n** NB:  If you define USE_PREAD or USE_PREAD64, then it might also\n** be necessary to define _XOPEN_SOURCE to be 500.  This varies from\n** one system to another.  Since SQLite does not define USE_PREAD\n** in any form by default, we will not attempt to define _XOPEN_SOURCE.\n** See tickets #2741 and #2681.\n**\n** To avoid stomping the errno value on a failed read the lastErrno value\n** is set before returning.\n*/\nstatic int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){\n  int got;\n  int prior = 0;\n#if (!defined(USE_PREAD) && !defined(USE_PREAD64))\n  i64 newOffset;\n#endif\n  TIMER_START;\n  assert( cnt==(cnt&0x1ffff) );\n  assert( id->h>2 );\n  do{\n#if defined(USE_PREAD)\n    got = osPread(id->h, pBuf, cnt, offset);\n    SimulateIOError( got = -1 );\n#elif defined(USE_PREAD64)\n    got = osPread64(id->h, pBuf, cnt, offset);\n    SimulateIOError( got = -1 );\n#else\n    newOffset = lseek(id->h, offset, SEEK_SET);\n    SimulateIOError( newOffset = -1 );\n    if( newOffset<0 ){\n      storeLastErrno((unixFile*)id, errno);\n      return -1;\n    }\n    got = osRead(id->h, pBuf, cnt);\n#endif\n    if( got==cnt ) break;\n    if( got<0 ){\n      if( errno==EINTR ){ got = 1; continue; }\n      prior = 0;\n      storeLastErrno((unixFile*)id,  errno);\n      break;\n    }else if( got>0 ){\n      cnt -= got;\n      offset += got;\n      prior += got;\n      pBuf = (void*)(got + (char*)pBuf);\n    }\n  }while( got>0 );\n  TIMER_END;\n  OSTRACE((\"READ    %-3d %5d %7lld %llu\\n\",\n            id->h, got+prior, offset-prior, TIMER_ELAPSED));\n  return got+prior;\n}\n\n/*\n** Read data from a file into a buffer.  Return SQLITE_OK if all\n** bytes were read successfully and SQLITE_IOERR if anything goes\n** wrong.\n*/\nstatic int unixRead(\n  sqlite3_file *id, \n  void *pBuf, \n  int amt,\n  sqlite3_int64 offset\n){\n  unixFile *pFile = (unixFile *)id;\n  int got;\n  assert( id );\n  assert( offset>=0 );\n  assert( amt>0 );\n\n  /* If this is a database file (not a journal, master-journal or temp\n  ** file), the bytes in the locking range should never be read or written. */\n#if 0\n  assert( pFile->pUnused==0\n       || offset>=PENDING_BYTE+512\n       || offset+amt<=PENDING_BYTE \n  );\n#endif\n\n#if SQLITE_MAX_MMAP_SIZE>0\n  /* Deal with as much of this read request as possible by transfering\n  ** data from the memory mapping using memcpy().  */\n  if( offset<pFile->mmapSize ){\n    if( offset+amt <= pFile->mmapSize ){\n      memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt);\n      return SQLITE_OK;\n    }else{\n      int nCopy = pFile->mmapSize - offset;\n      memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy);\n      pBuf = &((u8 *)pBuf)[nCopy];\n      amt -= nCopy;\n      offset += nCopy;\n    }\n  }\n#endif\n\n  got = seekAndRead(pFile, offset, pBuf, amt);\n  if( got==amt ){\n    return SQLITE_OK;\n  }else if( got<0 ){\n    /* lastErrno set by seekAndRead */\n    return SQLITE_IOERR_READ;\n  }else{\n    storeLastErrno(pFile, 0);   /* not a system error */\n    /* Unread parts of the buffer must be zero-filled */\n    memset(&((char*)pBuf)[got], 0, amt-got);\n    return SQLITE_IOERR_SHORT_READ;\n  }\n}\n\n/*\n** Attempt to seek the file-descriptor passed as the first argument to\n** absolute offset iOff, then attempt to write nBuf bytes of data from\n** pBuf to it. If an error occurs, return -1 and set *piErrno. Otherwise, \n** return the actual number of bytes written (which may be less than\n** nBuf).\n*/\nstatic int seekAndWriteFd(\n  int fd,                         /* File descriptor to write to */\n  i64 iOff,                       /* File offset to begin writing at */\n  const void *pBuf,               /* Copy data from this buffer to the file */\n  int nBuf,                       /* Size of buffer pBuf in bytes */\n  int *piErrno                    /* OUT: Error number if error occurs */\n){\n  int rc = 0;                     /* Value returned by system call */\n\n  assert( nBuf==(nBuf&0x1ffff) );\n  assert( fd>2 );\n  assert( piErrno!=0 );\n  nBuf &= 0x1ffff;\n  TIMER_START;\n\n#if defined(USE_PREAD)\n  do{ rc = (int)osPwrite(fd, pBuf, nBuf, iOff); }while( rc<0 && errno==EINTR );\n#elif defined(USE_PREAD64)\n  do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);\n#else\n  do{\n    i64 iSeek = lseek(fd, iOff, SEEK_SET);\n    SimulateIOError( iSeek = -1 );\n    if( iSeek<0 ){\n      rc = -1;\n      break;\n    }\n    rc = osWrite(fd, pBuf, nBuf);\n  }while( rc<0 && errno==EINTR );\n#endif\n\n  TIMER_END;\n  OSTRACE((\"WRITE   %-3d %5d %7lld %llu\\n\", fd, rc, iOff, TIMER_ELAPSED));\n\n  if( rc<0 ) *piErrno = errno;\n  return rc;\n}\n\n\n/*\n** Seek to the offset in id->offset then read cnt bytes into pBuf.\n** Return the number of bytes actually read.  Update the offset.\n**\n** To avoid stomping the errno value on a failed write the lastErrno value\n** is set before returning.\n*/\nstatic int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){\n  return seekAndWriteFd(id->h, offset, pBuf, cnt, &id->lastErrno);\n}\n\n\n/*\n** Write data from a buffer into a file.  Return SQLITE_OK on success\n** or some other error code on failure.\n*/\nstatic int unixWrite(\n  sqlite3_file *id, \n  const void *pBuf, \n  int amt,\n  sqlite3_int64 offset \n){\n  unixFile *pFile = (unixFile*)id;\n  int wrote = 0;\n  assert( id );\n  assert( amt>0 );\n\n  /* If this is a database file (not a journal, master-journal or temp\n  ** file), the bytes in the locking range should never be read or written. */\n#if 0\n  assert( pFile->pUnused==0\n       || offset>=PENDING_BYTE+512\n       || offset+amt<=PENDING_BYTE \n  );\n#endif\n\n#ifdef SQLITE_DEBUG\n  /* If we are doing a normal write to a database file (as opposed to\n  ** doing a hot-journal rollback or a write to some file other than a\n  ** normal database file) then record the fact that the database\n  ** has changed.  If the transaction counter is modified, record that\n  ** fact too.\n  */\n  if( pFile->inNormalWrite ){\n    pFile->dbUpdate = 1;  /* The database has been modified */\n    if( offset<=24 && offset+amt>=27 ){\n      int rc;\n      char oldCntr[4];\n      SimulateIOErrorBenign(1);\n      rc = seekAndRead(pFile, 24, oldCntr, 4);\n      SimulateIOErrorBenign(0);\n      if( rc!=4 || memcmp(oldCntr, &((char*)pBuf)[24-offset], 4)!=0 ){\n        pFile->transCntrChng = 1;  /* The transaction counter has changed */\n      }\n    }\n  }\n#endif\n\n#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0\n  /* Deal with as much of this write request as possible by transfering\n  ** data from the memory mapping using memcpy().  */\n  if( offset<pFile->mmapSize ){\n    if( offset+amt <= pFile->mmapSize ){\n      memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt);\n      return SQLITE_OK;\n    }else{\n      int nCopy = pFile->mmapSize - offset;\n      memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy);\n      pBuf = &((u8 *)pBuf)[nCopy];\n      amt -= nCopy;\n      offset += nCopy;\n    }\n  }\n#endif\n \n  while( (wrote = seekAndWrite(pFile, offset, pBuf, amt))<amt && wrote>0 ){\n    amt -= wrote;\n    offset += wrote;\n    pBuf = &((char*)pBuf)[wrote];\n  }\n  SimulateIOError(( wrote=(-1), amt=1 ));\n  SimulateDiskfullError(( wrote=0, amt=1 ));\n\n  if( amt>wrote ){\n    if( wrote<0 && pFile->lastErrno!=ENOSPC ){\n      /* lastErrno set by seekAndWrite */\n      return SQLITE_IOERR_WRITE;\n    }else{\n      storeLastErrno(pFile, 0); /* not a system error */\n      return SQLITE_FULL;\n    }\n  }\n\n  return SQLITE_OK;\n}\n\n#ifdef SQLITE_TEST\n/*\n** Count the number of fullsyncs and normal syncs.  This is used to test\n** that syncs and fullsyncs are occurring at the right times.\n*/\nint sqlite3_sync_count = 0;\nint sqlite3_fullsync_count = 0;\n#endif\n\n/*\n** We do not trust systems to provide a working fdatasync().  Some do.\n** Others do no.  To be safe, we will stick with the (slightly slower)\n** fsync(). If you know that your system does support fdatasync() correctly,\n** then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC\n*/\n#if !defined(fdatasync) && !HAVE_FDATASYNC\n# define fdatasync fsync\n#endif\n\n/*\n** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not\n** the F_FULLFSYNC macro is defined.  F_FULLFSYNC is currently\n** only available on Mac OS X.  But that could change.\n*/\n#ifdef F_FULLFSYNC\n# define HAVE_FULLFSYNC 1\n#else\n# define HAVE_FULLFSYNC 0\n#endif\n\n\n/*\n** The fsync() system call does not work as advertised on many\n** unix systems.  The following procedure is an attempt to make\n** it work better.\n**\n** The SQLITE_NO_SYNC macro disables all fsync()s.  This is useful\n** for testing when we want to run through the test suite quickly.\n** You are strongly advised *not* to deploy with SQLITE_NO_SYNC\n** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash\n** or power failure will likely corrupt the database file.\n**\n** SQLite sets the dataOnly flag if the size of the file is unchanged.\n** The idea behind dataOnly is that it should only write the file content\n** to disk, not the inode.  We only set dataOnly if the file size is \n** unchanged since the file size is part of the inode.  However, \n** Ted Ts'o tells us that fdatasync() will also write the inode if the\n** file size has changed.  The only real difference between fdatasync()\n** and fsync(), Ted tells us, is that fdatasync() will not flush the\n** inode if the mtime or owner or other inode attributes have changed.\n** We only care about the file size, not the other file attributes, so\n** as far as SQLite is concerned, an fdatasync() is always adequate.\n** So, we always use fdatasync() if it is available, regardless of\n** the value of the dataOnly flag.\n*/\nstatic int full_fsync(int fd, int fullSync, int dataOnly){\n  int rc;\n\n  /* The following \"ifdef/elif/else/\" block has the same structure as\n  ** the one below. It is replicated here solely to avoid cluttering \n  ** up the real code with the UNUSED_PARAMETER() macros.\n  */\n#ifdef SQLITE_NO_SYNC\n  UNUSED_PARAMETER(fd);\n  UNUSED_PARAMETER(fullSync);\n  UNUSED_PARAMETER(dataOnly);\n#elif HAVE_FULLFSYNC\n  UNUSED_PARAMETER(dataOnly);\n#else\n  UNUSED_PARAMETER(fullSync);\n  UNUSED_PARAMETER(dataOnly);\n#endif\n\n  /* Record the number of times that we do a normal fsync() and \n  ** FULLSYNC.  This is used during testing to verify that this procedure\n  ** gets called with the correct arguments.\n  */\n#ifdef SQLITE_TEST\n  if( fullSync ) sqlite3_fullsync_count++;\n  sqlite3_sync_count++;\n#endif\n\n  /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a\n  ** no-op.  But go ahead and call fstat() to validate the file\n  ** descriptor as we need a method to provoke a failure during\n  ** coverate testing.\n  */\n#ifdef SQLITE_NO_SYNC\n  {\n    struct stat buf;\n    rc = osFstat(fd, &buf);\n  }\n#elif HAVE_FULLFSYNC\n  if( fullSync ){\n    rc = osFcntl(fd, F_FULLFSYNC, 0);\n  }else{\n    rc = 1;\n  }\n  /* If the FULLFSYNC failed, fall back to attempting an fsync().\n  ** It shouldn't be possible for fullfsync to fail on the local \n  ** file system (on OSX), so failure indicates that FULLFSYNC\n  ** isn't supported for this file system. So, attempt an fsync \n  ** and (for now) ignore the overhead of a superfluous fcntl call.  \n  ** It'd be better to detect fullfsync support once and avoid \n  ** the fcntl call every time sync is called.\n  */\n  if( rc ) rc = fsync(fd);\n\n#elif defined(__APPLE__)\n  /* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly\n  ** so currently we default to the macro that redefines fdatasync to fsync\n  */\n  rc = fsync(fd);\n#else \n  rc = fdatasync(fd);\n#if OS_VXWORKS\n  if( rc==-1 && errno==ENOTSUP ){\n    rc = fsync(fd);\n  }\n#endif /* OS_VXWORKS */\n#endif /* ifdef SQLITE_NO_SYNC elif HAVE_FULLFSYNC */\n\n  if( OS_VXWORKS && rc!= -1 ){\n    rc = 0;\n  }\n  return rc;\n}\n\n/*\n** Open a file descriptor to the directory containing file zFilename.\n** If successful, *pFd is set to the opened file descriptor and\n** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM\n** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined\n** value.\n**\n** The directory file descriptor is used for only one thing - to\n** fsync() a directory to make sure file creation and deletion events\n** are flushed to disk.  Such fsyncs are not needed on newer\n** journaling filesystems, but are required on older filesystems.\n**\n** This routine can be overridden using the xSetSysCall interface.\n** The ability to override this routine was added in support of the\n** chromium sandbox.  Opening a directory is a security risk (we are\n** told) so making it overrideable allows the chromium sandbox to\n** replace this routine with a harmless no-op.  To make this routine\n** a no-op, replace it with a stub that returns SQLITE_OK but leaves\n** *pFd set to a negative number.\n**\n** If SQLITE_OK is returned, the caller is responsible for closing\n** the file descriptor *pFd using close().\n*/\nstatic int openDirectory(const char *zFilename, int *pFd){\n  int ii;\n  int fd = -1;\n  char zDirname[MAX_PATHNAME+1];\n\n  sqlite3_snprintf(MAX_PATHNAME, zDirname, \"%s\", zFilename);\n  for(ii=(int)strlen(zDirname); ii>0 && zDirname[ii]!='/'; ii--);\n  if( ii>0 ){\n    zDirname[ii] = '\\0';\n  }else{\n    if( zDirname[0]!='/' ) zDirname[0] = '.';\n    zDirname[1] = 0;\n  }\n  fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0);\n  if( fd>=0 ){\n    OSTRACE((\"OPENDIR %-3d %s\\n\", fd, zDirname));\n  }\n  *pFd = fd;\n  if( fd>=0 ) return SQLITE_OK;\n  return unixLogError(SQLITE_CANTOPEN_BKPT, \"openDirectory\", zDirname);\n}\n\n/*\n** Make sure all writes to a particular file are committed to disk.\n**\n** If dataOnly==0 then both the file itself and its metadata (file\n** size, access time, etc) are synced.  If dataOnly!=0 then only the\n** file data is synced.\n**\n** Under Unix, also make sure that the directory entry for the file\n** has been created by fsync-ing the directory that contains the file.\n** If we do not do this and we encounter a power failure, the directory\n** entry for the journal might not exist after we reboot.  The next\n** SQLite to access the file will not know that the journal exists (because\n** the directory entry for the journal was never created) and the transaction\n** will not roll back - possibly leading to database corruption.\n*/\nstatic int unixSync(sqlite3_file *id, int flags){\n  int rc;\n  unixFile *pFile = (unixFile*)id;\n\n  int isDataOnly = (flags&SQLITE_SYNC_DATAONLY);\n  int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL;\n\n  /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */\n  assert((flags&0x0F)==SQLITE_SYNC_NORMAL\n      || (flags&0x0F)==SQLITE_SYNC_FULL\n  );\n\n  /* Unix cannot, but some systems may return SQLITE_FULL from here. This\n  ** line is to test that doing so does not cause any problems.\n  */\n  SimulateDiskfullError( return SQLITE_FULL );\n\n  assert( pFile );\n  OSTRACE((\"SYNC    %-3d\\n\", pFile->h));\n  rc = full_fsync(pFile->h, isFullsync, isDataOnly);\n  SimulateIOError( rc=1 );\n  if( rc ){\n    storeLastErrno(pFile, errno);\n    return unixLogError(SQLITE_IOERR_FSYNC, \"full_fsync\", pFile->zPath);\n  }\n\n  /* Also fsync the directory containing the file if the DIRSYNC flag\n  ** is set.  This is a one-time occurrence.  Many systems (examples: AIX)\n  ** are unable to fsync a directory, so ignore errors on the fsync.\n  */\n  if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){\n    int dirfd;\n    OSTRACE((\"DIRSYNC %s (have_fullfsync=%d fullsync=%d)\\n\", pFile->zPath,\n            HAVE_FULLFSYNC, isFullsync));\n    rc = osOpenDirectory(pFile->zPath, &dirfd);\n    if( rc==SQLITE_OK ){\n      full_fsync(dirfd, 0, 0);\n      robust_close(pFile, dirfd, __LINE__);\n    }else{\n      assert( rc==SQLITE_CANTOPEN );\n      rc = SQLITE_OK;\n    }\n    pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC;\n  }\n  return rc;\n}\n\n/*\n** Truncate an open file to a specified size\n*/\nstatic int unixTruncate(sqlite3_file *id, i64 nByte){\n  unixFile *pFile = (unixFile *)id;\n  int rc;\n  assert( pFile );\n  SimulateIOError( return SQLITE_IOERR_TRUNCATE );\n\n  /* If the user has configured a chunk-size for this file, truncate the\n  ** file so that it consists of an integer number of chunks (i.e. the\n  ** actual file size after the operation may be larger than the requested\n  ** size).\n  */\n  if( pFile->szChunk>0 ){\n    nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;\n  }\n\n  rc = robust_ftruncate(pFile->h, nByte);\n  if( rc ){\n    storeLastErrno(pFile, errno);\n    return unixLogError(SQLITE_IOERR_TRUNCATE, \"ftruncate\", pFile->zPath);\n  }else{\n#ifdef SQLITE_DEBUG\n    /* If we are doing a normal write to a database file (as opposed to\n    ** doing a hot-journal rollback or a write to some file other than a\n    ** normal database file) and we truncate the file to zero length,\n    ** that effectively updates the change counter.  This might happen\n    ** when restoring a database using the backup API from a zero-length\n    ** source.\n    */\n    if( pFile->inNormalWrite && nByte==0 ){\n      pFile->transCntrChng = 1;\n    }\n#endif\n\n#if SQLITE_MAX_MMAP_SIZE>0\n    /* If the file was just truncated to a size smaller than the currently\n    ** mapped region, reduce the effective mapping size as well. SQLite will\n    ** use read() and write() to access data beyond this point from now on.  \n    */\n    if( nByte<pFile->mmapSize ){\n      pFile->mmapSize = nByte;\n    }\n#endif\n\n    return SQLITE_OK;\n  }\n}\n\n/*\n** Determine the current size of a file in bytes\n*/\nstatic int unixFileSize(sqlite3_file *id, i64 *pSize){\n  int rc;\n  struct stat buf;\n  assert( id );\n  rc = osFstat(((unixFile*)id)->h, &buf);\n  SimulateIOError( rc=1 );\n  if( rc!=0 ){\n    storeLastErrno((unixFile*)id, errno);\n    return SQLITE_IOERR_FSTAT;\n  }\n  *pSize = buf.st_size;\n\n  /* When opening a zero-size database, the findInodeInfo() procedure\n  ** writes a single byte into that file in order to work around a bug\n  ** in the OS-X msdos filesystem.  In order to avoid problems with upper\n  ** layers, we need to report this file size as zero even though it is\n  ** really 1.   Ticket #3260.\n  */\n  if( *pSize==1 ) *pSize = 0;\n\n\n  return SQLITE_OK;\n}\n\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\n/*\n** Handler for proxy-locking file-control verbs.  Defined below in the\n** proxying locking division.\n*/\nstatic int proxyFileControl(sqlite3_file*,int,void*);\n#endif\n\n/* \n** This function is called to handle the SQLITE_FCNTL_SIZE_HINT \n** file-control operation.  Enlarge the database to nBytes in size\n** (rounded up to the next chunk-size).  If the database is already\n** nBytes or larger, this routine is a no-op.\n*/\nstatic int fcntlSizeHint(unixFile *pFile, i64 nByte){\n  if( pFile->szChunk>0 ){\n    i64 nSize;                    /* Required file size */\n    struct stat buf;              /* Used to hold return values of fstat() */\n   \n    if( osFstat(pFile->h, &buf) ){\n      return SQLITE_IOERR_FSTAT;\n    }\n\n    nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;\n    if( nSize>(i64)buf.st_size ){\n\n#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE\n      /* The code below is handling the return value of osFallocate() \n      ** correctly. posix_fallocate() is defined to \"returns zero on success, \n      ** or an error number on  failure\". See the manpage for details. */\n      int err;\n      do{\n        err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size);\n      }while( err==EINTR );\n      if( err ) return SQLITE_IOERR_WRITE;\n#else\n      /* If the OS does not have posix_fallocate(), fake it. Write a \n      ** single byte to the last byte in each block that falls entirely\n      ** within the extended region. Then, if required, a single byte\n      ** at offset (nSize-1), to set the size of the file correctly.\n      ** This is a similar technique to that used by glibc on systems\n      ** that do not have a real fallocate() call.\n      */\n      int nBlk = buf.st_blksize;  /* File-system block size */\n      int nWrite = 0;             /* Number of bytes written by seekAndWrite */\n      i64 iWrite;                 /* Next offset to write to */\n\n      iWrite = (buf.st_size/nBlk)*nBlk + nBlk - 1;\n      assert( iWrite>=buf.st_size );\n      assert( ((iWrite+1)%nBlk)==0 );\n      for(/*no-op*/; iWrite<nSize+nBlk-1; iWrite+=nBlk ){\n        if( iWrite>=nSize ) iWrite = nSize - 1;\n        nWrite = seekAndWrite(pFile, iWrite, \"\", 1);\n        if( nWrite!=1 ) return SQLITE_IOERR_WRITE;\n      }\n#endif\n    }\n  }\n\n#if SQLITE_MAX_MMAP_SIZE>0\n  if( pFile->mmapSizeMax>0 && nByte>pFile->mmapSize ){\n    int rc;\n    if( pFile->szChunk<=0 ){\n      if( robust_ftruncate(pFile->h, nByte) ){\n        storeLastErrno(pFile, errno);\n        return unixLogError(SQLITE_IOERR_TRUNCATE, \"ftruncate\", pFile->zPath);\n      }\n    }\n\n    rc = unixMapfile(pFile, nByte);\n    return rc;\n  }\n#endif\n\n  return SQLITE_OK;\n}\n\n/*\n** If *pArg is initially negative then this is a query.  Set *pArg to\n** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.\n**\n** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.\n*/\nstatic void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){\n  if( *pArg<0 ){\n    *pArg = (pFile->ctrlFlags & mask)!=0;\n  }else if( (*pArg)==0 ){\n    pFile->ctrlFlags &= ~mask;\n  }else{\n    pFile->ctrlFlags |= mask;\n  }\n}\n\n/* Forward declaration */\nstatic int unixGetTempname(int nBuf, char *zBuf);\n\n/*\n** Information and control of an open file handle.\n*/\nstatic int unixFileControl(sqlite3_file *id, int op, void *pArg){\n  unixFile *pFile = (unixFile*)id;\n  switch( op ){\n    case SQLITE_FCNTL_LOCKSTATE: {\n      *(int*)pArg = pFile->eFileLock;\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_LAST_ERRNO: {\n      *(int*)pArg = pFile->lastErrno;\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_CHUNK_SIZE: {\n      pFile->szChunk = *(int *)pArg;\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_SIZE_HINT: {\n      int rc;\n      SimulateIOErrorBenign(1);\n      rc = fcntlSizeHint(pFile, *(i64 *)pArg);\n      SimulateIOErrorBenign(0);\n      return rc;\n    }\n    case SQLITE_FCNTL_PERSIST_WAL: {\n      unixModeBit(pFile, UNIXFILE_PERSIST_WAL, (int*)pArg);\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_POWERSAFE_OVERWRITE: {\n      unixModeBit(pFile, UNIXFILE_PSOW, (int*)pArg);\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_VFSNAME: {\n      *(char**)pArg = sqlite3_mprintf(\"%s\", pFile->pVfs->zName);\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_TEMPFILENAME: {\n      char *zTFile = sqlite3_malloc64( pFile->pVfs->mxPathname );\n      if( zTFile ){\n        unixGetTempname(pFile->pVfs->mxPathname, zTFile);\n        *(char**)pArg = zTFile;\n      }\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_HAS_MOVED: {\n      *(int*)pArg = fileHasMoved(pFile);\n      return SQLITE_OK;\n    }\n#if SQLITE_MAX_MMAP_SIZE>0\n    case SQLITE_FCNTL_MMAP_SIZE: {\n      i64 newLimit = *(i64*)pArg;\n      int rc = SQLITE_OK;\n      if( newLimit>sqlite3GlobalConfig.mxMmap ){\n        newLimit = sqlite3GlobalConfig.mxMmap;\n      }\n      *(i64*)pArg = pFile->mmapSizeMax;\n      if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){\n        pFile->mmapSizeMax = newLimit;\n        if( pFile->mmapSize>0 ){\n          unixUnmapfile(pFile);\n          rc = unixMapfile(pFile, -1);\n        }\n      }\n      return rc;\n    }\n#endif\n#ifdef SQLITE_DEBUG\n    /* The pager calls this method to signal that it has done\n    ** a rollback and that the database is therefore unchanged and\n    ** it hence it is OK for the transaction change counter to be\n    ** unchanged.\n    */\n    case SQLITE_FCNTL_DB_UNCHANGED: {\n      ((unixFile*)id)->dbUpdate = 0;\n      return SQLITE_OK;\n    }\n#endif\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\n    case SQLITE_FCNTL_SET_LOCKPROXYFILE:\n    case SQLITE_FCNTL_GET_LOCKPROXYFILE: {\n      return proxyFileControl(id,op,pArg);\n    }\n#endif /* SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) */\n  }\n  return SQLITE_NOTFOUND;\n}\n\n/*\n** Return the sector size in bytes of the underlying block device for\n** the specified file. This is almost always 512 bytes, but may be\n** larger for some devices.\n**\n** SQLite code assumes this function cannot fail. It also assumes that\n** if two files are created in the same file-system directory (i.e.\n** a database and its journal file) that the sector size will be the\n** same for both.\n*/\n#ifndef __QNXNTO__ \nstatic int unixSectorSize(sqlite3_file *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  return SQLITE_DEFAULT_SECTOR_SIZE;\n}\n#endif\n\n/*\n** The following version of unixSectorSize() is optimized for QNX.\n*/\n#ifdef __QNXNTO__\n#include <sys/dcmd_blk.h>\n#include <sys/statvfs.h>\nstatic int unixSectorSize(sqlite3_file *id){\n  unixFile *pFile = (unixFile*)id;\n  if( pFile->sectorSize == 0 ){\n    struct statvfs fsInfo;\n       \n    /* Set defaults for non-supported filesystems */\n    pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;\n    pFile->deviceCharacteristics = 0;\n    if( fstatvfs(pFile->h, &fsInfo) == -1 ) {\n      return pFile->sectorSize;\n    }\n\n    if( !strcmp(fsInfo.f_basetype, \"tmp\") ) {\n      pFile->sectorSize = fsInfo.f_bsize;\n      pFile->deviceCharacteristics =\n        SQLITE_IOCAP_ATOMIC4K |       /* All ram filesystem writes are atomic */\n        SQLITE_IOCAP_SAFE_APPEND |    /* growing the file does not occur until\n                                      ** the write succeeds */\n        SQLITE_IOCAP_SEQUENTIAL |     /* The ram filesystem has no write behind\n                                      ** so it is ordered */\n        0;\n    }else if( strstr(fsInfo.f_basetype, \"etfs\") ){\n      pFile->sectorSize = fsInfo.f_bsize;\n      pFile->deviceCharacteristics =\n        /* etfs cluster size writes are atomic */\n        (pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) |\n        SQLITE_IOCAP_SAFE_APPEND |    /* growing the file does not occur until\n                                      ** the write succeeds */\n        SQLITE_IOCAP_SEQUENTIAL |     /* The ram filesystem has no write behind\n                                      ** so it is ordered */\n        0;\n    }else if( !strcmp(fsInfo.f_basetype, \"qnx6\") ){\n      pFile->sectorSize = fsInfo.f_bsize;\n      pFile->deviceCharacteristics =\n        SQLITE_IOCAP_ATOMIC |         /* All filesystem writes are atomic */\n        SQLITE_IOCAP_SAFE_APPEND |    /* growing the file does not occur until\n                                      ** the write succeeds */\n        SQLITE_IOCAP_SEQUENTIAL |     /* The ram filesystem has no write behind\n                                      ** so it is ordered */\n        0;\n    }else if( !strcmp(fsInfo.f_basetype, \"qnx4\") ){\n      pFile->sectorSize = fsInfo.f_bsize;\n      pFile->deviceCharacteristics =\n        /* full bitset of atomics from max sector size and smaller */\n        ((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |\n        SQLITE_IOCAP_SEQUENTIAL |     /* The ram filesystem has no write behind\n                                      ** so it is ordered */\n        0;\n    }else if( strstr(fsInfo.f_basetype, \"dos\") ){\n      pFile->sectorSize = fsInfo.f_bsize;\n      pFile->deviceCharacteristics =\n        /* full bitset of atomics from max sector size and smaller */\n        ((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |\n        SQLITE_IOCAP_SEQUENTIAL |     /* The ram filesystem has no write behind\n                                      ** so it is ordered */\n        0;\n    }else{\n      pFile->deviceCharacteristics =\n        SQLITE_IOCAP_ATOMIC512 |      /* blocks are atomic */\n        SQLITE_IOCAP_SAFE_APPEND |    /* growing the file does not occur until\n                                      ** the write succeeds */\n        0;\n    }\n  }\n  /* Last chance verification.  If the sector size isn't a multiple of 512\n  ** then it isn't valid.*/\n  if( pFile->sectorSize % 512 != 0 ){\n    pFile->deviceCharacteristics = 0;\n    pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;\n  }\n  return pFile->sectorSize;\n}\n#endif /* __QNXNTO__ */\n\n/*\n** Return the device characteristics for the file.\n**\n** This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default.\n** However, that choice is controversial since technically the underlying\n** file system does not always provide powersafe overwrites.  (In other\n** words, after a power-loss event, parts of the file that were never\n** written might end up being altered.)  However, non-PSOW behavior is very,\n** very rare.  And asserting PSOW makes a large reduction in the amount\n** of required I/O for journaling, since a lot of padding is eliminated.\n**  Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control\n** available to turn it off and URI query parameter available to turn it off.\n*/\nstatic int unixDeviceCharacteristics(sqlite3_file *id){\n  unixFile *p = (unixFile*)id;\n  int rc = 0;\n#ifdef __QNXNTO__\n  if( p->sectorSize==0 ) unixSectorSize(id);\n  rc = p->deviceCharacteristics;\n#endif\n  if( p->ctrlFlags & UNIXFILE_PSOW ){\n    rc |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;\n  }\n  return rc;\n}\n\n#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0\n\n/*\n** Return the system page size.\n**\n** This function should not be called directly by other code in this file. \n** Instead, it should be called via macro osGetpagesize().\n*/\nstatic int unixGetpagesize(void){\n#if OS_VXWORKS\n  return 1024;\n#elif defined(_BSD_SOURCE)\n  return getpagesize();\n#else\n  return (int)sysconf(_SC_PAGESIZE);\n#endif\n}\n\n#endif /* !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 */\n\n#ifndef SQLITE_OMIT_WAL\n\n/*\n** Object used to represent an shared memory buffer.  \n**\n** When multiple threads all reference the same wal-index, each thread\n** has its own unixShm object, but they all point to a single instance\n** of this unixShmNode object.  In other words, each wal-index is opened\n** only once per process.\n**\n** Each unixShmNode object is connected to a single unixInodeInfo object.\n** We could coalesce this object into unixInodeInfo, but that would mean\n** every open file that does not use shared memory (in other words, most\n** open files) would have to carry around this extra information.  So\n** the unixInodeInfo object contains a pointer to this unixShmNode object\n** and the unixShmNode object is created only when needed.\n**\n** unixMutexHeld() must be true when creating or destroying\n** this object or while reading or writing the following fields:\n**\n**      nRef\n**\n** The following fields are read-only after the object is created:\n** \n**      fid\n**      zFilename\n**\n** Either unixShmNode.mutex must be held or unixShmNode.nRef==0 and\n** unixMutexHeld() is true when reading or writing any other field\n** in this structure.\n*/\nstruct unixShmNode {\n  unixInodeInfo *pInode;     /* unixInodeInfo that owns this SHM node */\n  sqlite3_mutex *mutex;      /* Mutex to access this object */\n  char *zFilename;           /* Name of the mmapped file */\n  int h;                     /* Open file descriptor */\n  int szRegion;              /* Size of shared-memory regions */\n  u16 nRegion;               /* Size of array apRegion */\n  u8 isReadonly;             /* True if read-only */\n  char **apRegion;           /* Array of mapped shared-memory regions */\n  int nRef;                  /* Number of unixShm objects pointing to this */\n  unixShm *pFirst;           /* All unixShm objects pointing to this */\n#ifdef SQLITE_DEBUG\n  u8 exclMask;               /* Mask of exclusive locks held */\n  u8 sharedMask;             /* Mask of shared locks held */\n  u8 nextShmId;              /* Next available unixShm.id value */\n#endif\n#if SQLITE_WCDB_SIGNAL_RETRY\n  Queue qWaitQueue;\n  sqlite3_condition* pCond;\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n};\n\n/*\n** Structure used internally by this VFS to record the state of an\n** open shared memory connection.\n**\n** The following fields are initialized when this object is created and\n** are read-only thereafter:\n**\n**    unixShm.pFile\n**    unixShm.id\n**\n** All other fields are read/write.  The unixShm.pFile->mutex must be held\n** while accessing any read/write fields.\n*/\nstruct unixShm {\n  unixShmNode *pShmNode;     /* The underlying unixShmNode object */\n  unixShm *pNext;            /* Next unixShm with the same unixShmNode */\n  u8 hasMutex;               /* True if holding the unixShmNode mutex */\n  u8 id;                     /* Id of this connection within its unixShmNode */\n  u16 sharedMask;            /* Mask of shared locks held */\n  u16 exclMask;              /* Mask of exclusive locks held */\n};\n\n/*\n** Constants used for locking\n*/\n#define UNIX_SHM_BASE   ((22+SQLITE_SHM_NLOCK)*4)         /* first lock byte */\n#define UNIX_SHM_DMS    (UNIX_SHM_BASE+SQLITE_SHM_NLOCK)  /* deadman switch */\n\n/*\n** Apply posix advisory locks for all bytes from ofst through ofst+n-1.\n**\n** Locks block if the mask is exactly UNIX_SHM_C and are non-blocking\n** otherwise.\n*/\nstatic int unixShmSystemLock(\n  unixFile *pFile,       /* Open connection to the WAL file */\n  int lockType,          /* F_UNLCK, F_RDLCK, or F_WRLCK */\n  int ofst,              /* First byte of the locking range */\n  int n                  /* Number of bytes to lock */\n){\n  unixShmNode *pShmNode; /* Apply locks to this open shared-memory segment */\n  struct flock f;        /* The posix advisory locking structure */\n  int rc = SQLITE_OK;    /* Result code form fcntl() */\n\n  /* Access to the unixShmNode object is serialized by the caller */\n  pShmNode = pFile->pInode->pShmNode;\n  assert( sqlite3_mutex_held(pShmNode->mutex) || pShmNode->nRef==0 );\n\n  /* Shared locks never span more than one byte */\n  assert( n==1 || lockType!=F_RDLCK );\n\n  /* Locks are within range */\n  assert( n>=1 && n<=SQLITE_SHM_NLOCK );\n\n  if( pShmNode->h>=0 ){\n    /* Initialize the locking parameters */\n    memset(&f, 0, sizeof(f));\n    f.l_type = lockType;\n    f.l_whence = SEEK_SET;\n    f.l_start = ofst;\n    f.l_len = n;\n\n    rc = osFcntl(pShmNode->h, F_SETLK, &f);\n    rc = (rc!=(-1)) ? SQLITE_OK : SQLITE_BUSY;\n  }\n\n  /* Update the global lock state and do debug tracing */\n#ifdef SQLITE_DEBUG\n  { u16 mask;\n  OSTRACE((\"SHM-LOCK \"));\n  mask = ofst>31 ? 0xffff : (1<<(ofst+n)) - (1<<ofst);\n  if( rc==SQLITE_OK ){\n    if( lockType==F_UNLCK ){\n      OSTRACE((\"unlock %d ok\", ofst));\n      pShmNode->exclMask &= ~mask;\n      pShmNode->sharedMask &= ~mask;\n    }else if( lockType==F_RDLCK ){\n      OSTRACE((\"read-lock %d ok\", ofst));\n      pShmNode->exclMask &= ~mask;\n      pShmNode->sharedMask |= mask;\n    }else{\n      assert( lockType==F_WRLCK );\n      OSTRACE((\"write-lock %d ok\", ofst));\n      pShmNode->exclMask |= mask;\n      pShmNode->sharedMask &= ~mask;\n    }\n  }else{\n    if( lockType==F_UNLCK ){\n      OSTRACE((\"unlock %d failed\", ofst));\n    }else if( lockType==F_RDLCK ){\n      OSTRACE((\"read-lock failed\"));\n    }else{\n      assert( lockType==F_WRLCK );\n      OSTRACE((\"write-lock %d failed\", ofst));\n    }\n  }\n  OSTRACE((\" - afterwards %03x,%03x\\n\",\n           pShmNode->sharedMask, pShmNode->exclMask));\n  }\n#endif\n\n  return rc;        \n}\n\n/*\n** Return the minimum number of 32KB shm regions that should be mapped at\n** a time, assuming that each mapping must be an integer multiple of the\n** current system page-size.\n**\n** Usually, this is 1. The exception seems to be systems that are configured\n** to use 64KB pages - in this case each mapping must cover at least two\n** shm regions.\n*/\nstatic int unixShmRegionPerMap(void){\n  int shmsz = 32*1024;            /* SHM region size */\n  int pgsz = osGetpagesize();   /* System page size */\n  assert( ((pgsz-1)&pgsz)==0 );   /* Page size must be a power of 2 */\n  if( pgsz<shmsz ) return 1;\n  return pgsz/shmsz;\n}\n\n/*\n** Purge the unixShmNodeList list of all entries with unixShmNode.nRef==0.\n**\n** This is not a VFS shared-memory method; it is a utility function called\n** by VFS shared-memory methods.\n*/\nstatic void unixShmPurge(unixFile *pFd){\n  unixShmNode *p = pFd->pInode->pShmNode;\n  assert( unixMutexHeld() );\n  if( p && ALWAYS(p->nRef==0) ){\n    int nShmPerMap = unixShmRegionPerMap();\n    int i;\n    assert( p->pInode==pFd->pInode );\n    sqlite3_mutex_free(p->mutex);\n#if SQLITE_WCDB_SIGNAL_RETRY\n    pthreadCondFree(p->pCond);\n    while (!sqlite3QueueEmpty(&p->qWaitQueue)) {\n      WCDBShmWaitInfo* pInfo = NULL;\n      if (pInfo) {\n        pthreadFree(pInfo->pThread);\n        sqlite3_free(pInfo);\n      }\n    }\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n    for(i=0; i<p->nRegion; i+=nShmPerMap){\n      if( p->h>=0 ){\n        osMunmap(p->apRegion[i], p->szRegion);\n      }else{\n        sqlite3_free(p->apRegion[i]);\n      }\n    }\n    sqlite3_free(p->apRegion);\n    if( p->h>=0 ){\n      robust_close(pFd, p->h, __LINE__);\n      p->h = -1;\n    }\n    p->pInode->pShmNode = 0;\n    sqlite3_free(p);\n  }\n}\n\n/*\n** Open a shared-memory area associated with open database file pDbFd.  \n** This particular implementation uses mmapped files.\n**\n** The file used to implement shared-memory is in the same directory\n** as the open database file and has the same name as the open database\n** file with the \"-shm\" suffix added.  For example, if the database file\n** is \"/home/user1/config.db\" then the file that is created and mmapped\n** for shared memory will be called \"/home/user1/config.db-shm\".  \n**\n** Another approach to is to use files in /dev/shm or /dev/tmp or an\n** some other tmpfs mount. But if a file in a different directory\n** from the database file is used, then differing access permissions\n** or a chroot() might cause two different processes on the same\n** database to end up using different files for shared memory - \n** meaning that their memory would not really be shared - resulting\n** in database corruption.  Nevertheless, this tmpfs file usage\n** can be enabled at compile-time using -DSQLITE_SHM_DIRECTORY=\"/dev/shm\"\n** or the equivalent.  The use of the SQLITE_SHM_DIRECTORY compile-time\n** option results in an incompatible build of SQLite;  builds of SQLite\n** that with differing SQLITE_SHM_DIRECTORY settings attempt to use the\n** same database file at the same time, database corruption will likely\n** result. The SQLITE_SHM_DIRECTORY compile-time option is considered\n** \"unsupported\" and may go away in a future SQLite release.\n**\n** When opening a new shared-memory file, if no other instances of that\n** file are currently open, in this process or in other processes, then\n** the file must be truncated to zero length or have its header cleared.\n**\n** If the original database file (pDbFd) is using the \"unix-excl\" VFS\n** that means that an exclusive lock is held on the database file and\n** that no other processes are able to read or write the database.  In\n** that case, we do not really need shared memory.  No shared memory\n** file is created.  The shared memory will be simulated with heap memory.\n*/\nstatic int unixOpenSharedMemory(unixFile *pDbFd){\n  struct unixShm *p = 0;          /* The connection to be opened */\n  struct unixShmNode *pShmNode;   /* The underlying mmapped file */\n  int rc;                         /* Result code */\n  unixInodeInfo *pInode;          /* The inode of fd */\n  char *zShmFilename;             /* Name of the file used for SHM */\n  int nShmFilename;               /* Size of the SHM filename in bytes */\n\n  /* Allocate space for the new unixShm object. */\n  p = sqlite3_malloc64( sizeof(*p) );\n  if( p==0 ) return SQLITE_NOMEM_BKPT;\n  memset(p, 0, sizeof(*p));\n  assert( pDbFd->pShm==0 );\n\n  /* Check to see if a unixShmNode object already exists. Reuse an existing\n  ** one if present. Create a new one if necessary.\n  */\n  unixEnterMutex();\n  pInode = pDbFd->pInode;\n  pShmNode = pInode->pShmNode;\n  if( pShmNode==0 ){\n    struct stat sStat;                 /* fstat() info for database file */\n#ifndef SQLITE_SHM_DIRECTORY\n    const char *zBasePath = pDbFd->zPath;\n#endif\n\n    /* Call fstat() to figure out the permissions on the database file. If\n    ** a new *-shm file is created, an attempt will be made to create it\n    ** with the same permissions.\n    */\n    if( osFstat(pDbFd->h, &sStat) ){\n      rc = SQLITE_IOERR_FSTAT;\n      goto shm_open_err;\n    }\n\n#ifdef SQLITE_SHM_DIRECTORY\n    nShmFilename = sizeof(SQLITE_SHM_DIRECTORY) + 31;\n#else\n    nShmFilename = 6 + (int)strlen(zBasePath);\n#endif\n    pShmNode = sqlite3_malloc64( sizeof(*pShmNode) + nShmFilename );\n    if( pShmNode==0 ){\n      rc = SQLITE_NOMEM_BKPT;\n      goto shm_open_err;\n    }\n    memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename);\n    zShmFilename = pShmNode->zFilename = (char*)&pShmNode[1];\n#ifdef SQLITE_SHM_DIRECTORY\n    sqlite3_snprintf(nShmFilename, zShmFilename, \n                     SQLITE_SHM_DIRECTORY \"/sqlite-shm-%x-%x\",\n                     (u32)sStat.st_ino, (u32)sStat.st_dev);\n#else\n    sqlite3_snprintf(nShmFilename, zShmFilename, \"%s-shm\", zBasePath);\n    sqlite3FileSuffix3(pDbFd->zPath, zShmFilename);\n#endif\n    pShmNode->h = -1;\n    pDbFd->pInode->pShmNode = pShmNode;\n    pShmNode->pInode = pDbFd->pInode;\n    if( sqlite3GlobalConfig.bCoreMutex ){\n    pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);\n    if( pShmNode->mutex==0 ){\n        rc = SQLITE_NOMEM_BKPT;\n      goto shm_open_err;\n    }\n    }\n#if SQLITE_WCDB_SIGNAL_RETRY\n    pShmNode->pCond = pthreadCondAlloc();\n    if (pShmNode->pCond==0) {\n      rc = SQLITE_NOMEM_BKPT;\n      goto shm_open_err;\n    }\n    sqlite3QueueInit(&pShmNode->qWaitQueue);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n    if( pInode->bProcessLock==0 ){\n      int openFlags = O_RDWR | O_CREAT;\n      if( sqlite3_uri_boolean(pDbFd->zPath, \"readonly_shm\", 0) ){\n        openFlags = O_RDONLY;\n        pShmNode->isReadonly = 1;\n      }\n      pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777));\n      if( pShmNode->h<0 ){\n        rc = unixLogError(SQLITE_CANTOPEN_BKPT, \"open\", zShmFilename);\n        goto shm_open_err;\n      }\n\n      /* If this process is running as root, make sure that the SHM file\n      ** is owned by the same user that owns the original database.  Otherwise,\n      ** the original owner will not be able to connect.\n      */\n      robustFchown(pShmNode->h, sStat.st_uid, sStat.st_gid);\n  \n      /* Check to see if another process is holding the dead-man switch.\n      ** If not, truncate the file to zero length. \n      */\n      rc = SQLITE_OK;\n      if( unixShmSystemLock(pDbFd, F_WRLCK, UNIX_SHM_DMS, 1)==SQLITE_OK ){\n        if( robust_ftruncate(pShmNode->h, 0) ){\n          rc = unixLogError(SQLITE_IOERR_SHMOPEN, \"ftruncate\", zShmFilename);\n        }\n      }\n      if( rc==SQLITE_OK ){\n        rc = unixShmSystemLock(pDbFd, F_RDLCK, UNIX_SHM_DMS, 1);\n      }\n      if( rc ) goto shm_open_err;\n    }\n  }\n\n  /* Make the new connection a child of the unixShmNode */\n  p->pShmNode = pShmNode;\n#ifdef SQLITE_DEBUG\n  p->id = pShmNode->nextShmId++;\n#endif\n  pShmNode->nRef++;\n  pDbFd->pShm = p;\n  unixLeaveMutex();\n\n  /* The reference count on pShmNode has already been incremented under\n  ** the cover of the unixEnterMutex() mutex and the pointer from the\n  ** new (struct unixShm) object to the pShmNode has been set. All that is\n  ** left to do is to link the new object into the linked list starting\n  ** at pShmNode->pFirst. This must be done while holding the pShmNode->mutex \n  ** mutex.\n  */\n  sqlite3_mutex_enter(pShmNode->mutex);\n  p->pNext = pShmNode->pFirst;\n  pShmNode->pFirst = p;\n  sqlite3_mutex_leave(pShmNode->mutex);\n  return SQLITE_OK;\n\n  /* Jump here on any error */\nshm_open_err:\n  unixShmPurge(pDbFd);       /* This call frees pShmNode if required */\n  sqlite3_free(p);\n  unixLeaveMutex();\n  return rc;\n}\n\n/*\n** This function is called to obtain a pointer to region iRegion of the \n** shared-memory associated with the database file fd. Shared-memory regions \n** are numbered starting from zero. Each shared-memory region is szRegion \n** bytes in size.\n**\n** If an error occurs, an error code is returned and *pp is set to NULL.\n**\n** Otherwise, if the bExtend parameter is 0 and the requested shared-memory\n** region has not been allocated (by any client, including one running in a\n** separate process), then *pp is set to NULL and SQLITE_OK returned. If \n** bExtend is non-zero and the requested shared-memory region has not yet \n** been allocated, it is allocated by this function.\n**\n** If the shared-memory region has already been allocated or is allocated by\n** this call as described above, then it is mapped into this processes \n** address space (if it is not already), *pp is set to point to the mapped \n** memory and SQLITE_OK returned.\n*/\nstatic int unixShmMap(\n  sqlite3_file *fd,               /* Handle open on database file */\n  int iRegion,                    /* Region to retrieve */\n  int szRegion,                   /* Size of regions */\n  int bExtend,                    /* True to extend file if necessary */\n  void volatile **pp              /* OUT: Mapped memory */\n){\n  unixFile *pDbFd = (unixFile*)fd;\n  unixShm *p;\n  unixShmNode *pShmNode;\n  int rc = SQLITE_OK;\n  int nShmPerMap = unixShmRegionPerMap();\n  int nReqRegion;\n\n  /* If the shared-memory file has not yet been opened, open it now. */\n  if( pDbFd->pShm==0 ){\n    rc = unixOpenSharedMemory(pDbFd);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n\n  p = pDbFd->pShm;\n  pShmNode = p->pShmNode;\n  sqlite3_mutex_enter(pShmNode->mutex);\n  assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 );\n  assert( pShmNode->pInode==pDbFd->pInode );\n  assert( pShmNode->h>=0 || pDbFd->pInode->bProcessLock==1 );\n  assert( pShmNode->h<0 || pDbFd->pInode->bProcessLock==0 );\n\n  /* Minimum number of regions required to be mapped. */\n  nReqRegion = ((iRegion+nShmPerMap) / nShmPerMap) * nShmPerMap;\n\n  if( pShmNode->nRegion<nReqRegion ){\n    char **apNew;                      /* New apRegion[] array */\n    int nByte = nReqRegion*szRegion;   /* Minimum required file size */\n    struct stat sStat;                 /* Used by fstat() */\n\n    pShmNode->szRegion = szRegion;\n\n    if( pShmNode->h>=0 ){\n      /* The requested region is not mapped into this processes address space.\n      ** Check to see if it has been allocated (i.e. if the wal-index file is\n      ** large enough to contain the requested region).\n      */\n      if( osFstat(pShmNode->h, &sStat) ){\n        rc = SQLITE_IOERR_SHMSIZE;\n        goto shmpage_out;\n      }\n  \n      if( sStat.st_size<nByte ){\n        /* The requested memory region does not exist. If bExtend is set to\n        ** false, exit early. *pp will be set to NULL and SQLITE_OK returned.\n        */\n        if( !bExtend ){\n          goto shmpage_out;\n        }\n\n        /* Alternatively, if bExtend is true, extend the file. Do this by\n        ** writing a single byte to the end of each (OS) page being\n        ** allocated or extended. Technically, we need only write to the\n        ** last page in order to extend the file. But writing to all new\n        ** pages forces the OS to allocate them immediately, which reduces\n        ** the chances of SIGBUS while accessing the mapped region later on.\n        */\n        else{\n          static const int pgsz = 4096;\n          int iPg;\n\n          /* Write to the last byte of each newly allocated or extended page */\n          assert( (nByte % pgsz)==0 );\n          for(iPg=(sStat.st_size/pgsz); iPg<(nByte/pgsz); iPg++){\n            int x = 0;\n            if( seekAndWriteFd(pShmNode->h, iPg*pgsz + pgsz-1, \"\", 1, &x)!=1 ){\n              const char *zFile = pShmNode->zFilename;\n              rc = unixLogError(SQLITE_IOERR_SHMSIZE, \"write\", zFile);\n              goto shmpage_out;\n            }\n          }\n        }\n      }\n    }\n\n    /* Map the requested memory region into this processes address space. */\n    apNew = (char **)sqlite3_realloc(\n        pShmNode->apRegion, nReqRegion*sizeof(char *)\n    );\n    if( !apNew ){\n      rc = SQLITE_IOERR_NOMEM_BKPT;\n      goto shmpage_out;\n    }\n    pShmNode->apRegion = apNew;\n    while( pShmNode->nRegion<nReqRegion ){\n      int nMap = szRegion*nShmPerMap;\n      int i;\n      void *pMem;\n      if( pShmNode->h>=0 ){\n        pMem = osMmap(0, nMap,\n            pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE, \n            MAP_SHARED, pShmNode->h, szRegion*(i64)pShmNode->nRegion\n        );\n        if( pMem==MAP_FAILED ){\n          rc = unixLogError(SQLITE_IOERR_SHMMAP, \"mmap\", pShmNode->zFilename);\n          goto shmpage_out;\n        }\n      }else{\n        pMem = sqlite3_malloc64(szRegion);\n        if( pMem==0 ){\n          rc = SQLITE_NOMEM_BKPT;\n          goto shmpage_out;\n        }\n        memset(pMem, 0, szRegion);\n      }\n\n      for(i=0; i<nShmPerMap; i++){\n        pShmNode->apRegion[pShmNode->nRegion+i] = &((char*)pMem)[szRegion*i];\n      }\n      pShmNode->nRegion += nShmPerMap;\n    }\n  }\n\nshmpage_out:\n  if( pShmNode->nRegion>iRegion ){\n    *pp = pShmNode->apRegion[iRegion];\n  }else{\n    *pp = 0;\n  }\n  if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;\n  sqlite3_mutex_leave(pShmNode->mutex);\n  return rc;\n}\n\n/*\n** Change the lock state for a shared-memory segment.\n**\n** Note that the relationship between SHAREd and EXCLUSIVE locks is a little\n** different here than in posix.  In xShmLock(), one can go from unlocked\n** to shared and back or from unlocked to exclusive and back.  But one may\n** not go from shared to exclusive or from exclusive to shared.\n*/\nstatic int unixShmLock(\n  sqlite3_file *fd,          /* Database file holding the shared memory */\n  int ofst,                  /* First lock to acquire or release */\n  int n,                     /* Number of locks to acquire or release */\n  int flags                  /* What to do with the lock */\n){\n  unixFile *pDbFd = (unixFile*)fd;      /* Connection holding shared memory */\n  unixShm *p = pDbFd->pShm;             /* The shared memory being locked */\n  unixShm *pX;                          /* For looping over all siblings */\n  unixShmNode *pShmNode = p->pShmNode;  /* The underlying file iNode */\n  int rc = SQLITE_OK;                   /* Result code */\n  u16 mask;                             /* Mask of locks to take or release */\n\n  assert( pShmNode==pDbFd->pInode->pShmNode );\n  assert( pShmNode->pInode==pDbFd->pInode );\n  assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK );\n  assert( n>=1 );\n  assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED)\n       || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE)\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED)\n       || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) );\n  assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 );\n  assert( pShmNode->h>=0 || pDbFd->pInode->bProcessLock==1 );\n  assert( pShmNode->h<0 || pDbFd->pInode->bProcessLock==0 );\n\n  mask = (1<<(ofst+n)) - (1<<ofst);\n  assert( n>1 || mask==(1<<ofst) );\n  sqlite3_mutex_enter(pShmNode->mutex);\n  if( flags & SQLITE_SHM_UNLOCK ){\n    u16 allMask = 0; /* Mask of locks held by siblings */\n\n    /* See if any siblings hold this same lock */\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\n      if( pX==p ) continue;\n      assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 );\n      allMask |= pX->sharedMask;\n    }\n\n    /* Unlock the system-level locks */\n    if( (mask & allMask)==0 ){\n      rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n);\n    }else{\n      rc = SQLITE_OK;\n    }\n\n    /* Undo the local locks */\n    if( rc==SQLITE_OK ){\n      p->exclMask &= ~mask;\n      p->sharedMask &= ~mask;\n#if SQLITE_WCDB_SIGNAL_RETRY\n      WCDBOsShmTrySignal(pShmNode);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n    } \n  }else if( flags & SQLITE_SHM_SHARED ){\n    u16 allShared = 0;  /* Union of locks held by connections other than \"p\" */\n\n    /* Find out which shared locks are already held by sibling connections.\n    ** If any sibling already holds an exclusive lock, go ahead and return\n    ** SQLITE_BUSY.\n    */\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\n      if( (pX->exclMask & mask)!=0 ){\n        rc = SQLITE_BUSY;\n#if SQLITE_WCDB_SIGNAL_RETRY\n        WCDBOsShmWait(pShmNode, pDbFd, mask, SQLITE_SHM_SHARED);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n        break;\n      }\n      allShared |= pX->sharedMask;\n    }\n\n    /* Get shared locks at the system level, if necessary */\n    if( rc==SQLITE_OK ){\n      if( (allShared & mask)==0 ){\n        rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n);\n      }else{\n        rc = SQLITE_OK;\n      }\n    }\n\n    /* Get the local shared locks */\n    if( rc==SQLITE_OK ){\n      p->sharedMask |= mask;\n    }\n  }else{\n    /* Make sure no sibling connections hold locks that will block this\n    ** lock.  If any do, return SQLITE_BUSY right away.\n    */\n    for(pX=pShmNode->pFirst; pX; pX=pX->pNext){\n      if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){\n        rc = SQLITE_BUSY;\n#if SQLITE_WCDB_SIGNAL_RETRY\n        WCDBOsShmWait(pShmNode, pDbFd, mask, SQLITE_SHM_EXCLUSIVE);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n        break;\n      }\n    }\n  \n    /* Get the exclusive locks at the system level.  Then if successful\n    ** also mark the local connection as being locked.\n    */\n    if( rc==SQLITE_OK ){\n      rc = unixShmSystemLock(pDbFd, F_WRLCK, ofst+UNIX_SHM_BASE, n);\n      if( rc==SQLITE_OK ){\n        assert( (p->sharedMask & mask)==0 );\n        p->exclMask |= mask;\n      }\n    }\n  }\n  sqlite3_mutex_leave(pShmNode->mutex);\n  OSTRACE((\"SHM-LOCK shmid-%d, pid-%d got %03x,%03x\\n\",\n           p->id, osGetpid(0), p->sharedMask, p->exclMask));\n  return rc;\n}\n\n/*\n** Implement a memory barrier or memory fence on shared memory.  \n**\n** All loads and stores begun before the barrier must complete before\n** any load or store begun after the barrier.\n*/\nstatic void unixShmBarrier(\n  sqlite3_file *fd                /* Database file holding the shared memory */\n){\n  UNUSED_PARAMETER(fd);\n  sqlite3MemoryBarrier();         /* compiler-defined memory barrier */\n  unixEnterMutex();               /* Also mutex, for redundancy */\n  unixLeaveMutex();\n}\n\n/*\n** Close a connection to shared-memory.  Delete the underlying \n** storage if deleteFlag is true.\n**\n** If there is no shared memory associated with the connection then this\n** routine is a harmless no-op.\n*/\nstatic int unixShmUnmap(\n  sqlite3_file *fd,               /* The underlying database file */\n  int deleteFlag                  /* Delete shared-memory if true */\n){\n  unixShm *p;                     /* The connection to be closed */\n  unixShmNode *pShmNode;          /* The underlying shared-memory file */\n  unixShm **pp;                   /* For looping over sibling connections */\n  unixFile *pDbFd;                /* The underlying database file */\n\n  pDbFd = (unixFile*)fd;\n  p = pDbFd->pShm;\n  if( p==0 ) return SQLITE_OK;\n  pShmNode = p->pShmNode;\n\n  assert( pShmNode==pDbFd->pInode->pShmNode );\n  assert( pShmNode->pInode==pDbFd->pInode );\n\n  /* Remove connection p from the set of connections associated\n  ** with pShmNode */\n  sqlite3_mutex_enter(pShmNode->mutex);\n  for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}\n  *pp = p->pNext;\n\n  /* Free the connection p */\n  sqlite3_free(p);\n  pDbFd->pShm = 0;\n  sqlite3_mutex_leave(pShmNode->mutex);\n\n  /* If pShmNode->nRef has reached 0, then close the underlying\n  ** shared-memory file, too */\n  unixEnterMutex();\n  assert( pShmNode->nRef>0 );\n  pShmNode->nRef--;\n  if( pShmNode->nRef==0 ){\n    if( deleteFlag && pShmNode->h>=0 ){\n      osUnlink(pShmNode->zFilename);\n    }\n    unixShmPurge(pDbFd);\n  }\n  unixLeaveMutex();\n\n  return SQLITE_OK;\n}\n\n\n#else\n# define unixShmMap     0\n# define unixShmLock    0\n# define unixShmBarrier 0\n# define unixShmUnmap   0\n#endif /* #ifndef SQLITE_OMIT_WAL */\n\n#if SQLITE_MAX_MMAP_SIZE>0\n/*\n** If it is currently memory mapped, unmap file pFd.\n*/\nstatic void unixUnmapfile(unixFile *pFd){\n  assert( pFd->nFetchOut==0 );\n  if( pFd->pMapRegion ){\n    osMunmap(pFd->pMapRegion, pFd->mmapSizeActual);\n    pFd->pMapRegion = 0;\n    pFd->mmapSize = 0;\n    pFd->mmapSizeActual = 0;\n  }\n}\n\n/*\n** Attempt to set the size of the memory mapping maintained by file \n** descriptor pFd to nNew bytes. Any existing mapping is discarded.\n**\n** If successful, this function sets the following variables:\n**\n**       unixFile.pMapRegion\n**       unixFile.mmapSize\n**       unixFile.mmapSizeActual\n**\n** If unsuccessful, an error message is logged via sqlite3_log() and\n** the three variables above are zeroed. In this case SQLite should\n** continue accessing the database using the xRead() and xWrite()\n** methods.\n*/\nstatic void unixRemapfile(\n  unixFile *pFd,                  /* File descriptor object */\n  i64 nNew                        /* Required mapping size */\n){\n  const char *zErr = \"mmap\";\n  int h = pFd->h;                      /* File descriptor open on db file */\n  u8 *pOrig = (u8 *)pFd->pMapRegion;   /* Pointer to current file mapping */\n  i64 nOrig = pFd->mmapSizeActual;     /* Size of pOrig region in bytes */\n  u8 *pNew = 0;                        /* Location of new mapping */\n  int flags = PROT_READ;               /* Flags to pass to mmap() */\n\n  assert( pFd->nFetchOut==0 );\n  assert( nNew>pFd->mmapSize );\n  assert( nNew<=pFd->mmapSizeMax );\n  assert( nNew>0 );\n  assert( pFd->mmapSizeActual>=pFd->mmapSize );\n  assert( MAP_FAILED!=0 );\n\n#ifdef SQLITE_MMAP_READWRITE\n  if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE;\n#endif\n\n  if( pOrig ){\n#if HAVE_MREMAP\n    i64 nReuse = pFd->mmapSize;\n#else\n    const int szSyspage = osGetpagesize();\n    i64 nReuse = (pFd->mmapSize & ~(szSyspage-1));\n#endif\n    u8 *pReq = &pOrig[nReuse];\n\n    /* Unmap any pages of the existing mapping that cannot be reused. */\n    if( nReuse!=nOrig ){\n      osMunmap(pReq, nOrig-nReuse);\n    }\n\n#if HAVE_MREMAP\n    pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE);\n    zErr = \"mremap\";\n#else\n    pNew = osMmap(pReq, nNew-nReuse, flags, MAP_SHARED, h, nReuse);\n    if( pNew!=MAP_FAILED ){\n      if( pNew!=pReq ){\n        osMunmap(pNew, nNew - nReuse);\n        pNew = 0;\n      }else{\n        pNew = pOrig;\n      }\n    }\n#endif\n\n    /* The attempt to extend the existing mapping failed. Free it. */\n    if( pNew==MAP_FAILED || pNew==0 ){\n      osMunmap(pOrig, nReuse);\n    }\n  }\n\n  /* If pNew is still NULL, try to create an entirely new mapping. */\n  if( pNew==0 ){\n    pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0);\n  }\n\n  if( pNew==MAP_FAILED ){\n    pNew = 0;\n    nNew = 0;\n    unixLogError(SQLITE_OK, zErr, pFd->zPath);\n\n    /* If the mmap() above failed, assume that all subsequent mmap() calls\n    ** will probably fail too. Fall back to using xRead/xWrite exclusively\n    ** in this case.  */\n    pFd->mmapSizeMax = 0;\n  }\n  pFd->pMapRegion = (void *)pNew;\n  pFd->mmapSize = pFd->mmapSizeActual = nNew;\n}\n\n/*\n** Memory map or remap the file opened by file-descriptor pFd (if the file\n** is already mapped, the existing mapping is replaced by the new). Or, if \n** there already exists a mapping for this file, and there are still \n** outstanding xFetch() references to it, this function is a no-op.\n**\n** If parameter nByte is non-negative, then it is the requested size of \n** the mapping to create. Otherwise, if nByte is less than zero, then the \n** requested size is the size of the file on disk. The actual size of the\n** created mapping is either the requested size or the value configured \n** using SQLITE_FCNTL_MMAP_LIMIT, whichever is smaller.\n**\n** SQLITE_OK is returned if no error occurs (even if the mapping is not\n** recreated as a result of outstanding references) or an SQLite error\n** code otherwise.\n*/\nstatic int unixMapfile(unixFile *pFd, i64 nMap){\n  assert( nMap>=0 || pFd->nFetchOut==0 );\n  assert( nMap>0 || (pFd->mmapSize==0 && pFd->pMapRegion==0) );\n  if( pFd->nFetchOut>0 ) return SQLITE_OK;\n\n  if( nMap<0 ){\n    struct stat statbuf;          /* Low-level file information */\n    if( osFstat(pFd->h, &statbuf) ){\n      return SQLITE_IOERR_FSTAT;\n    }\n    nMap = statbuf.st_size;\n  }\n  if( nMap>pFd->mmapSizeMax ){\n    nMap = pFd->mmapSizeMax;\n  }\n\n  assert( nMap>0 || (pFd->mmapSize==0 && pFd->pMapRegion==0) );\n  if( nMap!=pFd->mmapSize ){\n    unixRemapfile(pFd, nMap);\n  }\n\n  return SQLITE_OK;\n}\n#endif /* SQLITE_MAX_MMAP_SIZE>0 */\n\n/*\n** If possible, return a pointer to a mapping of file fd starting at offset\n** iOff. The mapping must be valid for at least nAmt bytes.\n**\n** If such a pointer can be obtained, store it in *pp and return SQLITE_OK.\n** Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK.\n** Finally, if an error does occur, return an SQLite error code. The final\n** value of *pp is undefined in this case.\n**\n** If this function does return a pointer, the caller must eventually \n** release the reference by calling unixUnfetch().\n*/\nstatic int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){\n#if SQLITE_MAX_MMAP_SIZE>0\n  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */\n#endif\n  *pp = 0;\n\n#if SQLITE_MAX_MMAP_SIZE>0\n  if( pFd->mmapSizeMax>0 ){\n    if( pFd->pMapRegion==0 ){\n      int rc = unixMapfile(pFd, -1);\n      if( rc!=SQLITE_OK ) return rc;\n    }\n    if( pFd->mmapSize >= iOff+nAmt ){\n      *pp = &((u8 *)pFd->pMapRegion)[iOff];\n      pFd->nFetchOut++;\n    }\n  }\n#endif\n  return SQLITE_OK;\n}\n\n/*\n** If the third argument is non-NULL, then this function releases a \n** reference obtained by an earlier call to unixFetch(). The second\n** argument passed to this function must be the same as the corresponding\n** argument that was passed to the unixFetch() invocation. \n**\n** Or, if the third argument is NULL, then this function is being called \n** to inform the VFS layer that, according to POSIX, any existing mapping \n** may now be invalid and should be unmapped.\n*/\nstatic int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){\n#if SQLITE_MAX_MMAP_SIZE>0\n  unixFile *pFd = (unixFile *)fd;   /* The underlying database file */\n  UNUSED_PARAMETER(iOff);\n\n  /* If p==0 (unmap the entire file) then there must be no outstanding \n  ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference),\n  ** then there must be at least one outstanding.  */\n  assert( (p==0)==(pFd->nFetchOut==0) );\n\n  /* If p!=0, it must match the iOff value. */\n  assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );\n\n  if( p ){\n    pFd->nFetchOut--;\n  }else{\n    unixUnmapfile(pFd);\n  }\n\n  assert( pFd->nFetchOut>=0 );\n#else\n  UNUSED_PARAMETER(fd);\n  UNUSED_PARAMETER(p);\n  UNUSED_PARAMETER(iOff);\n#endif\n  return SQLITE_OK;\n}\n\n/*\n** Here ends the implementation of all sqlite3_file methods.\n**\n********************** End sqlite3_file Methods *******************************\n******************************************************************************/\n\n/*\n** This division contains definitions of sqlite3_io_methods objects that\n** implement various file locking strategies.  It also contains definitions\n** of \"finder\" functions.  A finder-function is used to locate the appropriate\n** sqlite3_io_methods object for a particular database file.  The pAppData\n** field of the sqlite3_vfs VFS objects are initialized to be pointers to\n** the correct finder-function for that VFS.\n**\n** Most finder functions return a pointer to a fixed sqlite3_io_methods\n** object.  The only interesting finder-function is autolockIoFinder, which\n** looks at the filesystem type and tries to guess the best locking\n** strategy from that.\n**\n** For finder-function F, two objects are created:\n**\n**    (1) The real finder-function named \"FImpt()\".\n**\n**    (2) A constant pointer to this function named just \"F\".\n**\n**\n** A pointer to the F pointer is used as the pAppData value for VFS\n** objects.  We have to do this instead of letting pAppData point\n** directly at the finder-function since C90 rules prevent a void*\n** from be cast into a function pointer.\n**\n**\n** Each instance of this macro generates two objects:\n**\n**   *  A constant sqlite3_io_methods object call METHOD that has locking\n**      methods CLOSE, LOCK, UNLOCK, CKRESLOCK.\n**\n**   *  An I/O method finder function called FINDER that returns a pointer\n**      to the METHOD object in the previous bullet.\n*/\n#define IOMETHODS(FINDER,METHOD,VERSION,CLOSE,LOCK,UNLOCK,CKLOCK,SHMMAP)     \\\nstatic const sqlite3_io_methods METHOD = {                                   \\\n   VERSION,                    /* iVersion */                                \\\n   CLOSE,                      /* xClose */                                  \\\n   unixRead,                   /* xRead */                                   \\\n   unixWrite,                  /* xWrite */                                  \\\n   unixTruncate,               /* xTruncate */                               \\\n   unixSync,                   /* xSync */                                   \\\n   unixFileSize,               /* xFileSize */                               \\\n   LOCK,                       /* xLock */                                   \\\n   UNLOCK,                     /* xUnlock */                                 \\\n   CKLOCK,                     /* xCheckReservedLock */                      \\\n   unixFileControl,            /* xFileControl */                            \\\n   unixSectorSize,             /* xSectorSize */                             \\\n   unixDeviceCharacteristics,  /* xDeviceCapabilities */                     \\\n   SHMMAP,                     /* xShmMap */                                 \\\n   unixShmLock,                /* xShmLock */                                \\\n   unixShmBarrier,             /* xShmBarrier */                             \\\n   unixShmUnmap,               /* xShmUnmap */                               \\\n   unixFetch,                  /* xFetch */                                  \\\n   unixUnfetch,                /* xUnfetch */                                \\\n};                                                                           \\\nstatic const sqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){   \\\n  UNUSED_PARAMETER(z); UNUSED_PARAMETER(p);                                  \\\n  return &METHOD;                                                            \\\n}                                                                            \\\nstatic const sqlite3_io_methods *(*const FINDER)(const char*,unixFile *p)    \\\n    = FINDER##Impl;\n\n/*\n** Here are all of the sqlite3_io_methods objects for each of the\n** locking strategies.  Functions that return pointers to these methods\n** are also created.\n*/\nIOMETHODS(\n  posixIoFinder,            /* Finder function name */\n  posixIoMethods,           /* sqlite3_io_methods object name */\n  3,                        /* shared memory and mmap are enabled */\n  unixClose,                /* xClose method */\n  unixLock,                 /* xLock method */\n  unixUnlock,               /* xUnlock method */\n  unixCheckReservedLock,    /* xCheckReservedLock method */\n  unixShmMap                /* xShmMap method */\n)\nIOMETHODS(\n  nolockIoFinder,           /* Finder function name */\n  nolockIoMethods,          /* sqlite3_io_methods object name */\n  3,                        /* shared memory is disabled */\n  nolockClose,              /* xClose method */\n  nolockLock,               /* xLock method */\n  nolockUnlock,             /* xUnlock method */\n  nolockCheckReservedLock,  /* xCheckReservedLock method */\n  0                         /* xShmMap method */\n)\nIOMETHODS(\n  dotlockIoFinder,          /* Finder function name */\n  dotlockIoMethods,         /* sqlite3_io_methods object name */\n  1,                        /* shared memory is disabled */\n  dotlockClose,             /* xClose method */\n  dotlockLock,              /* xLock method */\n  dotlockUnlock,            /* xUnlock method */\n  dotlockCheckReservedLock, /* xCheckReservedLock method */\n  0                         /* xShmMap method */\n)\n\n#if SQLITE_ENABLE_LOCKING_STYLE\nIOMETHODS(\n  flockIoFinder,            /* Finder function name */\n  flockIoMethods,           /* sqlite3_io_methods object name */\n  1,                        /* shared memory is disabled */\n  flockClose,               /* xClose method */\n  flockLock,                /* xLock method */\n  flockUnlock,              /* xUnlock method */\n  flockCheckReservedLock,   /* xCheckReservedLock method */\n  0                         /* xShmMap method */\n)\n#endif\n\n#if OS_VXWORKS\nIOMETHODS(\n  semIoFinder,              /* Finder function name */\n  semIoMethods,             /* sqlite3_io_methods object name */\n  1,                        /* shared memory is disabled */\n  semXClose,                /* xClose method */\n  semXLock,                 /* xLock method */\n  semXUnlock,               /* xUnlock method */\n  semXCheckReservedLock,    /* xCheckReservedLock method */\n  0                         /* xShmMap method */\n)\n#endif\n\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\nIOMETHODS(\n  afpIoFinder,              /* Finder function name */\n  afpIoMethods,             /* sqlite3_io_methods object name */\n  1,                        /* shared memory is disabled */\n  afpClose,                 /* xClose method */\n  afpLock,                  /* xLock method */\n  afpUnlock,                /* xUnlock method */\n  afpCheckReservedLock,     /* xCheckReservedLock method */\n  0                         /* xShmMap method */\n)\n#endif\n\n/*\n** The proxy locking method is a \"super-method\" in the sense that it\n** opens secondary file descriptors for the conch and lock files and\n** it uses proxy, dot-file, AFP, and flock() locking methods on those\n** secondary files.  For this reason, the division that implements\n** proxy locking is located much further down in the file.  But we need\n** to go ahead and define the sqlite3_io_methods and finder function\n** for proxy locking here.  So we forward declare the I/O methods.\n*/\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\nstatic int proxyClose(sqlite3_file*);\nstatic int proxyLock(sqlite3_file*, int);\nstatic int proxyUnlock(sqlite3_file*, int);\nstatic int proxyCheckReservedLock(sqlite3_file*, int*);\nIOMETHODS(\n  proxyIoFinder,            /* Finder function name */\n  proxyIoMethods,           /* sqlite3_io_methods object name */\n  1,                        /* shared memory is disabled */\n  proxyClose,               /* xClose method */\n  proxyLock,                /* xLock method */\n  proxyUnlock,              /* xUnlock method */\n  proxyCheckReservedLock,   /* xCheckReservedLock method */\n  0                         /* xShmMap method */\n)\n#endif\n\n/* nfs lockd on OSX 10.3+ doesn't clear write locks when a read lock is set */\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\nIOMETHODS(\n  nfsIoFinder,               /* Finder function name */\n  nfsIoMethods,              /* sqlite3_io_methods object name */\n  1,                         /* shared memory is disabled */\n  unixClose,                 /* xClose method */\n  unixLock,                  /* xLock method */\n  nfsUnlock,                 /* xUnlock method */\n  unixCheckReservedLock,     /* xCheckReservedLock method */\n  0                          /* xShmMap method */\n)\n#endif\n\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\n/* \n** This \"finder\" function attempts to determine the best locking strategy \n** for the database file \"filePath\".  It then returns the sqlite3_io_methods\n** object that implements that strategy.\n**\n** This is for MacOSX only.\n*/\nstatic const sqlite3_io_methods *autolockIoFinderImpl(\n  const char *filePath,    /* name of the database file */\n  unixFile *pNew           /* open file object for the database file */\n){\n  static const struct Mapping {\n    const char *zFilesystem;              /* Filesystem type name */\n    const sqlite3_io_methods *pMethods;   /* Appropriate locking method */\n  } aMap[] = {\n    { \"hfs\",    &posixIoMethods },\n    { \"ufs\",    &posixIoMethods },\n    { \"afpfs\",  &afpIoMethods },\n    { \"smbfs\",  &afpIoMethods },\n    { \"webdav\", &nolockIoMethods },\n    { 0, 0 }\n  };\n  int i;\n  struct statfs fsInfo;\n  struct flock lockInfo;\n\n  if( !filePath ){\n    /* If filePath==NULL that means we are dealing with a transient file\n    ** that does not need to be locked. */\n    return &nolockIoMethods;\n  }\n  if( statfs(filePath, &fsInfo) != -1 ){\n    if( fsInfo.f_flags & MNT_RDONLY ){\n      return &nolockIoMethods;\n    }\n    for(i=0; aMap[i].zFilesystem; i++){\n      if( strcmp(fsInfo.f_fstypename, aMap[i].zFilesystem)==0 ){\n        return aMap[i].pMethods;\n      }\n    }\n  }\n\n  /* Default case. Handles, amongst others, \"nfs\".\n  ** Test byte-range lock using fcntl(). If the call succeeds, \n  ** assume that the file-system supports POSIX style locks. \n  */\n  lockInfo.l_len = 1;\n  lockInfo.l_start = 0;\n  lockInfo.l_whence = SEEK_SET;\n  lockInfo.l_type = F_RDLCK;\n  if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {\n    if( strcmp(fsInfo.f_fstypename, \"nfs\")==0 ){\n      return &nfsIoMethods;\n    } else {\n      return &posixIoMethods;\n    }\n  }else{\n    return &dotlockIoMethods;\n  }\n}\nstatic const sqlite3_io_methods \n  *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl;\n\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\n\n#if OS_VXWORKS\n/*\n** This \"finder\" function for VxWorks checks to see if posix advisory\n** locking works.  If it does, then that is what is used.  If it does not\n** work, then fallback to named semaphore locking.\n*/\nstatic const sqlite3_io_methods *vxworksIoFinderImpl(\n  const char *filePath,    /* name of the database file */\n  unixFile *pNew           /* the open file object */\n){\n  struct flock lockInfo;\n\n  if( !filePath ){\n    /* If filePath==NULL that means we are dealing with a transient file\n    ** that does not need to be locked. */\n    return &nolockIoMethods;\n  }\n\n  /* Test if fcntl() is supported and use POSIX style locks.\n  ** Otherwise fall back to the named semaphore method.\n  */\n  lockInfo.l_len = 1;\n  lockInfo.l_start = 0;\n  lockInfo.l_whence = SEEK_SET;\n  lockInfo.l_type = F_RDLCK;\n  if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) {\n    return &posixIoMethods;\n  }else{\n    return &semIoMethods;\n  }\n}\nstatic const sqlite3_io_methods \n  *(*const vxworksIoFinder)(const char*,unixFile*) = vxworksIoFinderImpl;\n\n#endif /* OS_VXWORKS */\n\n/*\n** An abstract type for a pointer to an IO method finder function:\n*/\ntypedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*);\n\n\n/****************************************************************************\n**************************** sqlite3_vfs methods ****************************\n**\n** This division contains the implementation of methods on the\n** sqlite3_vfs object.\n*/\n\n/*\n** Initialize the contents of the unixFile structure pointed to by pId.\n*/\nstatic int fillInUnixFile(\n  sqlite3_vfs *pVfs,      /* Pointer to vfs object */\n  int h,                  /* Open file descriptor of file being opened */\n  sqlite3_file *pId,      /* Write to the unixFile structure here */\n  const char *zFilename,  /* Name of the file being opened */\n  int ctrlFlags           /* Zero or more UNIXFILE_* values */\n){\n  const sqlite3_io_methods *pLockingStyle;\n  unixFile *pNew = (unixFile *)pId;\n  int rc = SQLITE_OK;\n\n  assert( pNew->pInode==NULL );\n\n  /* Usually the path zFilename should not be a relative pathname. The\n  ** exception is when opening the proxy \"conch\" file in builds that\n  ** include the special Apple locking styles.\n  */\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\n  assert( zFilename==0 || zFilename[0]=='/' \n    || pVfs->pAppData==(void*)&autolockIoFinder );\n#else\n  assert( zFilename==0 || zFilename[0]=='/' );\n#endif\n\n  /* No locking occurs in temporary files */\n  assert( zFilename!=0 || (ctrlFlags & UNIXFILE_NOLOCK)!=0 );\n\n  OSTRACE((\"OPEN    %-3d %s\\n\", h, zFilename));\n  pNew->h = h;\n  pNew->pVfs = pVfs;\n  pNew->zPath = zFilename;\n  pNew->ctrlFlags = (u8)ctrlFlags;\n#if SQLITE_WCDB_SIGNAL_RETRY\n  pNew->bWait = 0;\n#endif //SQLITE_WCDB_SIGNAL_RETRY\n#if SQLITE_MAX_MMAP_SIZE>0\n  pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap;\n#endif\n  if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),\n                           \"psow\", SQLITE_POWERSAFE_OVERWRITE) ){\n    pNew->ctrlFlags |= UNIXFILE_PSOW;\n  }\n  if( strcmp(pVfs->zName,\"unix-excl\")==0 ){\n    pNew->ctrlFlags |= UNIXFILE_EXCL;\n  }\n\n#if OS_VXWORKS\n  pNew->pId = vxworksFindFileId(zFilename);\n  if( pNew->pId==0 ){\n    ctrlFlags |= UNIXFILE_NOLOCK;\n    rc = SQLITE_NOMEM_BKPT;\n  }\n#endif\n\n  if( ctrlFlags & UNIXFILE_NOLOCK ){\n    pLockingStyle = &nolockIoMethods;\n  }else{\n    pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, pNew);\n#if SQLITE_ENABLE_LOCKING_STYLE\n    /* Cache zFilename in the locking context (AFP and dotlock override) for\n    ** proxyLock activation is possible (remote proxy is based on db name)\n    ** zFilename remains valid until file is closed, to support */\n    pNew->lockingContext = (void*)zFilename;\n#endif\n  }\n\n  if( pLockingStyle == &posixIoMethods\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\n    || pLockingStyle == &nfsIoMethods\n#endif\n  ){\n    unixEnterMutex();\n    rc = findInodeInfo(pNew, &pNew->pInode);\n    if( rc!=SQLITE_OK ){\n      /* If an error occurred in findInodeInfo(), close the file descriptor\n      ** immediately, before releasing the mutex. findInodeInfo() may fail\n      ** in two scenarios:\n      **\n      **   (a) A call to fstat() failed.\n      **   (b) A malloc failed.\n      **\n      ** Scenario (b) may only occur if the process is holding no other\n      ** file descriptors open on the same file. If there were other file\n      ** descriptors on this file, then no malloc would be required by\n      ** findInodeInfo(). If this is the case, it is quite safe to close\n      ** handle h - as it is guaranteed that no posix locks will be released\n      ** by doing so.\n      **\n      ** If scenario (a) caused the error then things are not so safe. The\n      ** implicit assumption here is that if fstat() fails, things are in\n      ** such bad shape that dropping a lock or two doesn't matter much.\n      */\n      robust_close(pNew, h, __LINE__);\n      h = -1;\n    }\n    unixLeaveMutex();\n  }\n\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\n  else if( pLockingStyle == &afpIoMethods ){\n    /* AFP locking uses the file path so it needs to be included in\n    ** the afpLockingContext.\n    */\n    afpLockingContext *pCtx;\n    pNew->lockingContext = pCtx = sqlite3_malloc64( sizeof(*pCtx) );\n    if( pCtx==0 ){\n      rc = SQLITE_NOMEM_BKPT;\n    }else{\n      /* NB: zFilename exists and remains valid until the file is closed\n      ** according to requirement F11141.  So we do not need to make a\n      ** copy of the filename. */\n      pCtx->dbPath = zFilename;\n      pCtx->reserved = 0;\n      srandomdev();\n      unixEnterMutex();\n      rc = findInodeInfo(pNew, &pNew->pInode);\n      if( rc!=SQLITE_OK ){\n        sqlite3_free(pNew->lockingContext);\n        robust_close(pNew, h, __LINE__);\n        h = -1;\n      }\n      unixLeaveMutex();        \n    }\n  }\n#endif\n\n  else if( pLockingStyle == &dotlockIoMethods ){\n    /* Dotfile locking uses the file path so it needs to be included in\n    ** the dotlockLockingContext \n    */\n    char *zLockFile;\n    int nFilename;\n    assert( zFilename!=0 );\n    nFilename = (int)strlen(zFilename) + 6;\n    zLockFile = (char *)sqlite3_malloc64(nFilename);\n    if( zLockFile==0 ){\n      rc = SQLITE_NOMEM_BKPT;\n    }else{\n      sqlite3_snprintf(nFilename, zLockFile, \"%s\" DOTLOCK_SUFFIX, zFilename);\n    }\n    pNew->lockingContext = zLockFile;\n  }\n\n#if OS_VXWORKS\n  else if( pLockingStyle == &semIoMethods ){\n    /* Named semaphore locking uses the file path so it needs to be\n    ** included in the semLockingContext\n    */\n    unixEnterMutex();\n    rc = findInodeInfo(pNew, &pNew->pInode);\n    if( (rc==SQLITE_OK) && (pNew->pInode->pSem==NULL) ){\n      char *zSemName = pNew->pInode->aSemName;\n      int n;\n      sqlite3_snprintf(MAX_PATHNAME, zSemName, \"/%s.sem\",\n                       pNew->pId->zCanonicalName);\n      for( n=1; zSemName[n]; n++ )\n        if( zSemName[n]=='/' ) zSemName[n] = '_';\n      pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1);\n      if( pNew->pInode->pSem == SEM_FAILED ){\n        rc = SQLITE_NOMEM_BKPT;\n        pNew->pInode->aSemName[0] = '\\0';\n      }\n    }\n    unixLeaveMutex();\n  }\n#endif\n  \n  storeLastErrno(pNew, 0);\n#if OS_VXWORKS\n  if( rc!=SQLITE_OK ){\n    if( h>=0 ) robust_close(pNew, h, __LINE__);\n    h = -1;\n    osUnlink(zFilename);\n    pNew->ctrlFlags |= UNIXFILE_DELETE;\n  }\n#endif\n  if( rc!=SQLITE_OK ){\n    if( h>=0 ) robust_close(pNew, h, __LINE__);\n  }else{\n    pNew->pMethod = pLockingStyle;\n    OpenCounter(+1);\n    verifyDbFile(pNew);\n  }\n  return rc;\n}\n\n/*\n** Return the name of a directory in which to put temporary files.\n** If no suitable temporary file directory can be found, return NULL.\n*/\nstatic const char *unixTempFileDir(void){\n  static const char *azDirs[] = {\n     0,\n     0,\n     \"/var/tmp\",\n     \"/usr/tmp\",\n     \"/tmp\",\n     \".\"\n  };\n  unsigned int i = 0;\n  struct stat buf;\n  const char *zDir = sqlite3_temp_directory;\n\n  if( !azDirs[0] ) azDirs[0] = getenv(\"SQLITE_TMPDIR\");\n  if( !azDirs[1] ) azDirs[1] = getenv(\"TMPDIR\");\n  while(1){\n    if( zDir!=0\n     && osStat(zDir, &buf)==0\n     && S_ISDIR(buf.st_mode)\n     && osAccess(zDir, 03)==0\n    ){\n  return zDir;\n}\n    if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) break;\n    zDir = azDirs[i++];\n  }\n  return 0;\n}\n\n/*\n** Create a temporary file name in zBuf.  zBuf must be allocated\n** by the calling process and must be big enough to hold at least\n** pVfs->mxPathname bytes.\n*/\nstatic int unixGetTempname(int nBuf, char *zBuf){\n  const char *zDir;\n  int iLimit = 0;\n\n  /* It's odd to simulate an io-error here, but really this is just\n  ** using the io-error infrastructure to test that SQLite handles this\n  ** function failing. \n  */\n  zBuf[0] = 0;\n  SimulateIOError( return SQLITE_IOERR );\n\n  zDir = unixTempFileDir();\n  if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH;\n  do{\n    u64 r;\n    sqlite3_randomness(sizeof(r), &r);\n    assert( nBuf>2 );\n    zBuf[nBuf-2] = 0;\n    sqlite3_snprintf(nBuf, zBuf, \"%s/\"SQLITE_TEMP_FILE_PREFIX\"%llx%c\",\n                     zDir, r, 0);\n    if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR;\n  }while( osAccess(zBuf,0)==0 );\n  return SQLITE_OK;\n}\n\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\n/*\n** Routine to transform a unixFile into a proxy-locking unixFile.\n** Implementation in the proxy-lock division, but used by unixOpen()\n** if SQLITE_PREFER_PROXY_LOCKING is defined.\n*/\nstatic int proxyTransformUnixFile(unixFile*, const char*);\n#endif\n\n/*\n** Search for an unused file descriptor that was opened on the database \n** file (not a journal or master-journal file) identified by pathname\n** zPath with SQLITE_OPEN_XXX flags matching those passed as the second\n** argument to this function.\n**\n** Such a file descriptor may exist if a database connection was closed\n** but the associated file descriptor could not be closed because some\n** other file descriptor open on the same file is holding a file-lock.\n** Refer to comments in the unixClose() function and the lengthy comment\n** describing \"Posix Advisory Locking\" at the start of this file for \n** further details. Also, ticket #4018.\n**\n** If a suitable file descriptor is found, then it is returned. If no\n** such file descriptor is located, -1 is returned.\n*/\nstatic UnixUnusedFd *findReusableFd(const char *zPath, int flags){\n  UnixUnusedFd *pUnused = 0;\n\n  /* Do not search for an unused file descriptor on vxworks. Not because\n  ** vxworks would not benefit from the change (it might, we're not sure),\n  ** but because no way to test it is currently available. It is better \n  ** not to risk breaking vxworks support for the sake of such an obscure \n  ** feature.  */\n#if !OS_VXWORKS\n  struct stat sStat;                   /* Results of stat() call */\n\n  /* A stat() call may fail for various reasons. If this happens, it is\n  ** almost certain that an open() call on the same path will also fail.\n  ** For this reason, if an error occurs in the stat() call here, it is\n  ** ignored and -1 is returned. The caller will try to open a new file\n  ** descriptor on the same path, fail, and return an error to SQLite.\n  **\n  ** Even if a subsequent open() call does succeed, the consequences of\n  ** not searching for a reusable file descriptor are not dire.  */\n  if( 0==osStat(zPath, &sStat) ){\n    unixInodeInfo *pInode;\n\n    unixEnterMutex();\n    pInode = inodeList;\n    while( pInode && (pInode->fileId.dev!=sStat.st_dev\n                     || pInode->fileId.ino!=sStat.st_ino) ){\n       pInode = pInode->pNext;\n    }\n    if( pInode ){\n      UnixUnusedFd **pp;\n      for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));\n      pUnused = *pp;\n      if( pUnused ){\n        *pp = pUnused->pNext;\n      }\n    }\n    unixLeaveMutex();\n  }\n#endif    /* if !OS_VXWORKS */\n  return pUnused;\n}\n\n/*\n** Find the mode, uid and gid of file zFile. \n*/\nstatic int getFileMode(\n  const char *zFile,              /* File name */\n  mode_t *pMode,                  /* OUT: Permissions of zFile */\n  uid_t *pUid,                    /* OUT: uid of zFile. */\n  gid_t *pGid                     /* OUT: gid of zFile. */\n){\n  struct stat sStat;              /* Output of stat() on database file */\n  int rc = SQLITE_OK;\n  if( 0==osStat(zFile, &sStat) ){\n    *pMode = sStat.st_mode & 0777;\n    *pUid = sStat.st_uid;\n    *pGid = sStat.st_gid;\n  }else{\n    rc = SQLITE_IOERR_FSTAT;\n  }\n  return rc;\n}\n\n/*\n** This function is called by unixOpen() to determine the unix permissions\n** to create new files with. If no error occurs, then SQLITE_OK is returned\n** and a value suitable for passing as the third argument to open(2) is\n** written to *pMode. If an IO error occurs, an SQLite error code is \n** returned and the value of *pMode is not modified.\n**\n** In most cases, this routine sets *pMode to 0, which will become\n** an indication to robust_open() to create the file using\n** SQLITE_DEFAULT_FILE_PERMISSIONS adjusted by the umask.\n** But if the file being opened is a WAL or regular journal file, then \n** this function queries the file-system for the permissions on the \n** corresponding database file and sets *pMode to this value. Whenever \n** possible, WAL and journal files are created using the same permissions \n** as the associated database file.\n**\n** If the SQLITE_ENABLE_8_3_NAMES option is enabled, then the\n** original filename is unavailable.  But 8_3_NAMES is only used for\n** FAT filesystems and permissions do not matter there, so just use\n** the default permissions.\n*/\nstatic int findCreateFileMode(\n  const char *zPath,              /* Path of file (possibly) being created */\n  int flags,                      /* Flags passed as 4th argument to xOpen() */\n  mode_t *pMode,                  /* OUT: Permissions to open file with */\n  uid_t *pUid,                    /* OUT: uid to set on the file */\n  gid_t *pGid                     /* OUT: gid to set on the file */\n){\n  int rc = SQLITE_OK;             /* Return Code */\n  *pMode = 0;\n  *pUid = 0;\n  *pGid = 0;\n  if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){\n    char zDb[MAX_PATHNAME+1];     /* Database file path */\n    int nDb;                      /* Number of valid bytes in zDb */\n\n    /* zPath is a path to a WAL or journal file. The following block derives\n    ** the path to the associated database file from zPath. This block handles\n    ** the following naming conventions:\n    **\n    **   \"<path to db>-journal\"\n    **   \"<path to db>-wal\"\n    **   \"<path to db>-journalNN\"\n    **   \"<path to db>-walNN\"\n    **\n    ** where NN is a decimal number. The NN naming schemes are \n    ** used by the test_multiplex.c module.\n    */\n    nDb = sqlite3Strlen30(zPath) - 1; \n    while( zPath[nDb]!='-' ){\n#ifndef SQLITE_ENABLE_8_3_NAMES\n      /* In the normal case (8+3 filenames disabled) the journal filename\n      ** is guaranteed to contain a '-' character. */\n      assert( nDb>0 );\n      assert( sqlite3Isalnum(zPath[nDb]) );\n#else\n      /* If 8+3 names are possible, then the journal file might not contain\n      ** a '-' character.  So check for that case and return early. */\n      if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;\n#endif\n      nDb--;\n    }\n    memcpy(zDb, zPath, nDb);\n    zDb[nDb] = '\\0';\n\n    rc = getFileMode(zDb, pMode, pUid, pGid);\n  }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){\n    *pMode = 0600;\n  }else if( flags & SQLITE_OPEN_URI ){\n    /* If this is a main database file and the file was opened using a URI\n    ** filename, check for the \"modeof\" parameter. If present, interpret\n    ** its value as a filename and try to copy the mode, uid and gid from\n    ** that file.  */\n    const char *z = sqlite3_uri_parameter(zPath, \"modeof\");\n    if( z ){\n      rc = getFileMode(z, pMode, pUid, pGid);\n  }\n  }\n  return rc;\n}\n\n/*\n** Open the file zPath.\n** \n** Previously, the SQLite OS layer used three functions in place of this\n** one:\n**\n**     sqlite3OsOpenReadWrite();\n**     sqlite3OsOpenReadOnly();\n**     sqlite3OsOpenExclusive();\n**\n** These calls correspond to the following combinations of flags:\n**\n**     ReadWrite() ->     (READWRITE | CREATE)\n**     ReadOnly()  ->     (READONLY) \n**     OpenExclusive() -> (READWRITE | CREATE | EXCLUSIVE)\n**\n** The old OpenExclusive() accepted a boolean argument - \"delFlag\". If\n** true, the file was configured to be automatically deleted when the\n** file handle closed. To achieve the same effect using this new \n** interface, add the DELETEONCLOSE flag to those specified above for \n** OpenExclusive().\n*/\nstatic int unixOpen(\n  sqlite3_vfs *pVfs,           /* The VFS for which this is the xOpen method */\n  const char *zPath,           /* Pathname of file to be opened */\n  sqlite3_file *pFile,         /* The file descriptor to be filled in */\n  int flags,                   /* Input flags to control the opening */\n  int *pOutFlags               /* Output flags returned to SQLite core */\n){\n  unixFile *p = (unixFile *)pFile;\n  int fd = -1;                   /* File descriptor returned by open() */\n  int openFlags = 0;             /* Flags to pass to open() */\n  int eType = flags&0xFFFFFF00;  /* Type of file to open */\n  int noLock;                    /* True to omit locking primitives */\n  int rc = SQLITE_OK;            /* Function Return Code */\n  int ctrlFlags = 0;             /* UNIXFILE_* flags */\n\n  int isExclusive  = (flags & SQLITE_OPEN_EXCLUSIVE);\n  int isDelete     = (flags & SQLITE_OPEN_DELETEONCLOSE);\n  int isCreate     = (flags & SQLITE_OPEN_CREATE);\n  int isReadonly   = (flags & SQLITE_OPEN_READONLY);\n  int isReadWrite  = (flags & SQLITE_OPEN_READWRITE);\n#if SQLITE_ENABLE_LOCKING_STYLE\n  int isAutoProxy  = (flags & SQLITE_OPEN_AUTOPROXY);\n#endif\n#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE\n  struct statfs fsInfo;\n#endif\n\n  /* If creating a master or main-file journal, this function will open\n  ** a file-descriptor on the directory too. The first time unixSync()\n  ** is called the directory file descriptor will be fsync()ed and close()d.\n  */\n  int syncDir = (isCreate && (\n        eType==SQLITE_OPEN_MASTER_JOURNAL \n     || eType==SQLITE_OPEN_MAIN_JOURNAL \n     || eType==SQLITE_OPEN_WAL\n  ));\n\n  /* If argument zPath is a NULL pointer, this function is required to open\n  ** a temporary file. Use this buffer to store the file name in.\n  */\n  char zTmpname[MAX_PATHNAME+2];\n  const char *zName = zPath;\n\n  /* Check the following statements are true: \n  **\n  **   (a) Exactly one of the READWRITE and READONLY flags must be set, and \n  **   (b) if CREATE is set, then READWRITE must also be set, and\n  **   (c) if EXCLUSIVE is set, then CREATE must also be set.\n  **   (d) if DELETEONCLOSE is set, then CREATE must also be set.\n  */\n  assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly));\n  assert(isCreate==0 || isReadWrite);\n  assert(isExclusive==0 || isCreate);\n  assert(isDelete==0 || isCreate);\n\n  /* The main DB, main journal, WAL file and master journal are never \n  ** automatically deleted. Nor are they ever temporary files.  */\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB );\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL );\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MASTER_JOURNAL );\n  assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL );\n\n  /* Assert that the upper layer has set one of the \"file-type\" flags. */\n  assert( eType==SQLITE_OPEN_MAIN_DB      || eType==SQLITE_OPEN_TEMP_DB \n       || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL \n       || eType==SQLITE_OPEN_SUBJOURNAL   || eType==SQLITE_OPEN_MASTER_JOURNAL \n       || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL\n  );\n\n  /* Detect a pid change and reset the PRNG.  There is a race condition\n  ** here such that two or more threads all trying to open databases at\n  ** the same instant might all reset the PRNG.  But multiple resets\n  ** are harmless.\n  */\n  if( randomnessPid!=osGetpid(0) ){\n    randomnessPid = osGetpid(0);\n    sqlite3_randomness(0,0);\n  }\n\n  memset(p, 0, sizeof(unixFile));\n\n  if( eType==SQLITE_OPEN_MAIN_DB ){\n    UnixUnusedFd *pUnused;\n    pUnused = findReusableFd(zName, flags);\n    if( pUnused ){\n      fd = pUnused->fd;\n    }else{\n      pUnused = sqlite3_malloc64(sizeof(*pUnused));\n      if( !pUnused ){\n        return SQLITE_NOMEM_BKPT;\n      }\n    }\n    p->pUnused = pUnused;\n\n    /* Database filenames are double-zero terminated if they are not\n    ** URIs with parameters.  Hence, they can always be passed into\n    ** sqlite3_uri_parameter(). */\n    assert( (flags & SQLITE_OPEN_URI) || zName[strlen(zName)+1]==0 );\n\n  }else if( !zName ){\n    /* If zName is NULL, the upper layer is requesting a temp file. */\n    assert(isDelete && !syncDir);\n    rc = unixGetTempname(pVfs->mxPathname, zTmpname);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    zName = zTmpname;\n\n    /* Generated temporary filenames are always double-zero terminated\n    ** for use by sqlite3_uri_parameter(). */\n    assert( zName[strlen(zName)+1]==0 );\n  }\n\n  /* Determine the value of the flags parameter passed to POSIX function\n  ** open(). These must be calculated even if open() is not called, as\n  ** they may be stored as part of the file handle and used by the \n  ** 'conch file' locking functions later on.  */\n  if( isReadonly )  openFlags |= O_RDONLY;\n  if( isReadWrite ) openFlags |= O_RDWR;\n  if( isCreate )    openFlags |= O_CREAT;\n  if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW);\n  openFlags |= (O_LARGEFILE|O_BINARY);\n\n  if( fd<0 ){\n    mode_t openMode;              /* Permissions to create file with */\n    uid_t uid;                    /* Userid for the file */\n    gid_t gid;                    /* Groupid for the file */\n    rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);\n    if( rc!=SQLITE_OK ){\n      assert( !p->pUnused );\n      assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );\n      return rc;\n    }\n    fd = robust_open(zName, openFlags, openMode);\n    OSTRACE((\"OPENX   %-3d %s 0%o\\n\", fd, zName, openFlags));\n    assert( !isExclusive || (openFlags & O_CREAT)!=0 );\n    if( fd<0 && errno!=EISDIR && isReadWrite ){\n      /* Failed to open the file for read/write access. Try read-only. */\n      flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);\n      openFlags &= ~(O_RDWR|O_CREAT);\n      flags |= SQLITE_OPEN_READONLY;\n      openFlags |= O_RDONLY;\n      isReadonly = 1;\n      fd = robust_open(zName, openFlags, openMode);\n    }\n    if( fd<0 ){\n      rc = unixLogError(SQLITE_CANTOPEN_BKPT, \"open\", zName);\n      goto open_finished;\n    }\n\n    /* If this process is running as root and if creating a new rollback\n    ** journal or WAL file, set the ownership of the journal or WAL to be\n    ** the same as the original database.\n    */\n    if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){\n      robustFchown(fd, uid, gid);\n    }\n  }\n  assert( fd>=0 );\n  if( pOutFlags ){\n    *pOutFlags = flags;\n  }\n\n  if( p->pUnused ){\n    p->pUnused->fd = fd;\n    p->pUnused->flags = flags;\n  }\n\n  if( isDelete ){\n#if OS_VXWORKS\n    zPath = zName;\n#elif defined(SQLITE_UNLINK_AFTER_CLOSE)\n    zPath = sqlite3_mprintf(\"%s\", zName);\n    if( zPath==0 ){\n      robust_close(p, fd, __LINE__);\n      return SQLITE_NOMEM_BKPT;\n    }\n#else\n    osUnlink(zName);\n#endif\n  }\n#if SQLITE_ENABLE_LOCKING_STYLE\n  else{\n    p->openFlags = openFlags;\n  }\n#endif\n\n#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE\n  if( fstatfs(fd, &fsInfo) == -1 ){\n    storeLastErrno(p, errno);\n    robust_close(p, fd, __LINE__);\n    return SQLITE_IOERR_ACCESS;\n  }\n  if (0 == strncmp(\"msdos\", fsInfo.f_fstypename, 5)) {\n    ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;\n  }\n  if (0 == strncmp(\"exfat\", fsInfo.f_fstypename, 5)) {\n    ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;\n  }\n#endif\n\n  /* Set up appropriate ctrlFlags */\n  if( isDelete )                ctrlFlags |= UNIXFILE_DELETE;\n  if( isReadonly )              ctrlFlags |= UNIXFILE_RDONLY;\n  noLock = eType!=SQLITE_OPEN_MAIN_DB;\n  if( noLock )                  ctrlFlags |= UNIXFILE_NOLOCK;\n  if( syncDir )                 ctrlFlags |= UNIXFILE_DIRSYNC;\n  if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;\n\n#if SQLITE_ENABLE_LOCKING_STYLE\n#if SQLITE_PREFER_PROXY_LOCKING\n  isAutoProxy = 1;\n#endif\n  if( isAutoProxy && (zPath!=NULL) && (!noLock) && pVfs->xOpen ){\n    char *envforce = getenv(\"SQLITE_FORCE_PROXY_LOCKING\");\n    int useProxy = 0;\n\n    /* SQLITE_FORCE_PROXY_LOCKING==1 means force always use proxy, 0 means \n    ** never use proxy, NULL means use proxy for non-local files only.  */\n    if( envforce!=NULL ){\n      useProxy = atoi(envforce)>0;\n    }else{\n      useProxy = !(fsInfo.f_flags&MNT_LOCAL);\n    }\n    if( useProxy ){\n      rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);\n      if( rc==SQLITE_OK ){\n        rc = proxyTransformUnixFile((unixFile*)pFile, \":auto:\");\n        if( rc!=SQLITE_OK ){\n          /* Use unixClose to clean up the resources added in fillInUnixFile \n          ** and clear all the structure's references.  Specifically, \n          ** pFile->pMethods will be NULL so sqlite3OsClose will be a no-op \n          */\n          unixClose(pFile);\n          return rc;\n        }\n      }\n      goto open_finished;\n    }\n  }\n#endif\n  \n  rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);\n\nopen_finished:\n  if( rc!=SQLITE_OK ){\n    sqlite3_free(p->pUnused);\n  }\n  return rc;\n}\n\n\n/*\n** Delete the file at zPath. If the dirSync argument is true, fsync()\n** the directory after deleting the file.\n*/\nstatic int unixDelete(\n  sqlite3_vfs *NotUsed,     /* VFS containing this as the xDelete method */\n  const char *zPath,        /* Name of file to be deleted */\n  int dirSync               /* If true, fsync() directory after deleting file */\n){\n  int rc = SQLITE_OK;\n  UNUSED_PARAMETER(NotUsed);\n  SimulateIOError(return SQLITE_IOERR_DELETE);\n  if( osUnlink(zPath)==(-1) ){\n    if( errno==ENOENT\n#if OS_VXWORKS\n        || osAccess(zPath,0)!=0\n#endif\n    ){\n      rc = SQLITE_IOERR_DELETE_NOENT;\n    }else{\n      rc = unixLogError(SQLITE_IOERR_DELETE, \"unlink\", zPath);\n    }\n    return rc;\n  }\n#ifndef SQLITE_DISABLE_DIRSYNC\n  if( (dirSync & 1)!=0 ){\n    int fd;\n    rc = osOpenDirectory(zPath, &fd);\n    if( rc==SQLITE_OK ){\n      if( full_fsync(fd,0,0) ){\n        rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, \"fsync\", zPath);\n      }\n      robust_close(0, fd, __LINE__);\n    }else{\n      assert( rc==SQLITE_CANTOPEN );\n      rc = SQLITE_OK;\n    }\n  }\n#endif\n  return rc;\n}\n\n/*\n** Test the existence of or access permissions of file zPath. The\n** test performed depends on the value of flags:\n**\n**     SQLITE_ACCESS_EXISTS: Return 1 if the file exists\n**     SQLITE_ACCESS_READWRITE: Return 1 if the file is read and writable.\n**     SQLITE_ACCESS_READONLY: Return 1 if the file is readable.\n**\n** Otherwise return 0.\n*/\nstatic int unixAccess(\n  sqlite3_vfs *NotUsed,   /* The VFS containing this xAccess method */\n  const char *zPath,      /* Path of the file to examine */\n  int flags,              /* What do we want to learn about the zPath file? */\n  int *pResOut            /* Write result boolean here */\n){\n  UNUSED_PARAMETER(NotUsed);\n  SimulateIOError( return SQLITE_IOERR_ACCESS; );\n  assert( pResOut!=0 );\n\n  /* The spec says there are three possible values for flags.  But only\n  ** two of them are actually used */\n  assert( flags==SQLITE_ACCESS_EXISTS || flags==SQLITE_ACCESS_READWRITE );\n\n  if( flags==SQLITE_ACCESS_EXISTS ){\n    struct stat buf;\n    *pResOut = (0==osStat(zPath, &buf) && buf.st_size>0);\n  }else{\n    *pResOut = osAccess(zPath, W_OK|R_OK)==0;\n  }\n  return SQLITE_OK;\n}\n\n/*\n**\n*/\nstatic int mkFullPathname(\n  const char *zPath,              /* Input path */\n  char *zOut,                     /* Output buffer */\n  int nOut                        /* Allocated size of buffer zOut */\n){\n  int nPath = sqlite3Strlen30(zPath);\n  int iOff = 0;\n  if( zPath[0]!='/' ){\n    if( osGetcwd(zOut, nOut-2)==0 ){\n      return unixLogError(SQLITE_CANTOPEN_BKPT, \"getcwd\", zPath);\n    }\n    iOff = sqlite3Strlen30(zOut);\n    zOut[iOff++] = '/';\n  }\n  if( (iOff+nPath+1)>nOut ){\n    /* SQLite assumes that xFullPathname() nul-terminates the output buffer\n    ** even if it returns an error.  */\n    zOut[iOff] = '\\0';\n    return SQLITE_CANTOPEN_BKPT;\n  }\n  sqlite3_snprintf(nOut-iOff, &zOut[iOff], \"%s\", zPath);\n  return SQLITE_OK;\n}\n\n/*\n** Turn a relative pathname into a full pathname. The relative path\n** is stored as a nul-terminated string in the buffer pointed to by\n** zPath. \n**\n** zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes \n** (in this case, MAX_PATHNAME bytes). The full-path is written to\n** this buffer before returning.\n*/\nstatic int unixFullPathname(\n  sqlite3_vfs *pVfs,            /* Pointer to vfs object */\n  const char *zPath,            /* Possibly relative input path */\n  int nOut,                     /* Size of output buffer in bytes */\n  char *zOut                    /* Output buffer */\n){\n#if !defined(HAVE_READLINK) || !defined(HAVE_LSTAT)\n  return mkFullPathname(zPath, zOut, nOut);\n#else\n  int rc = SQLITE_OK;\n  int nByte;\n  int nLink = 1;                /* Number of symbolic links followed so far */\n  const char *zIn = zPath;      /* Input path for each iteration of loop */\n  char *zDel = 0;\n\n  assert( pVfs->mxPathname==MAX_PATHNAME );\n  UNUSED_PARAMETER(pVfs);\n\n  /* It's odd to simulate an io-error here, but really this is just\n  ** using the io-error infrastructure to test that SQLite handles this\n  ** function failing. This function could fail if, for example, the\n  ** current working directory has been unlinked.\n  */\n  SimulateIOError( return SQLITE_ERROR );\n\n  do {\n\n    /* Call stat() on path zIn. Set bLink to true if the path is a symbolic\n    ** link, or false otherwise.  */\n    int bLink = 0;\n    struct stat buf;\n    if( osLstat(zIn, &buf)!=0 ){\n      if( errno!=ENOENT ){\n        rc = unixLogError(SQLITE_CANTOPEN_BKPT, \"lstat\", zIn);\n      }\n    }else{\n      bLink = S_ISLNK(buf.st_mode);\n    }\n\n    if( bLink ){\n      if( zDel==0 ){\n        zDel = sqlite3_malloc(nOut);\n        if( zDel==0 ) rc = SQLITE_NOMEM_BKPT;\n      }else if( ++nLink>SQLITE_MAX_SYMLINKS ){\n        rc = SQLITE_CANTOPEN_BKPT;\n      }\n\n      if( rc==SQLITE_OK ){\n        nByte = osReadlink(zIn, zDel, nOut-1);\n        if( nByte<0 ){\n          rc = unixLogError(SQLITE_CANTOPEN_BKPT, \"readlink\", zIn);\n        }else{\n          if( zDel[0]!='/' ){\n            int n;\n            for(n = sqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--);\n            if( nByte+n+1>nOut ){\n              rc = SQLITE_CANTOPEN_BKPT;\n            }else{\n              memmove(&zDel[n], zDel, nByte+1);\n              memcpy(zDel, zIn, n);\n              nByte += n;\n            }\n          }\n          zDel[nByte] = '\\0';\n        }\n      }\n\n      zIn = zDel;\n    }\n\n    assert( rc!=SQLITE_OK || zIn!=zOut || zIn[0]=='/' );\n    if( rc==SQLITE_OK && zIn!=zOut ){\n      rc = mkFullPathname(zIn, zOut, nOut);\n    }\n    if( bLink==0 ) break;\n    zIn = zOut;\n  }while( rc==SQLITE_OK );\n\n  sqlite3_free(zDel);\n  return rc;\n#endif   /* HAVE_READLINK && HAVE_LSTAT */\n}\n\n\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\n/*\n** Interfaces for opening a shared library, finding entry points\n** within the shared library, and closing the shared library.\n*/\n#include <dlfcn.h>\nstatic void *unixDlOpen(sqlite3_vfs *NotUsed, const char *zFilename){\n  UNUSED_PARAMETER(NotUsed);\n  return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);\n}\n\n/*\n** SQLite calls this function immediately after a call to unixDlSym() or\n** unixDlOpen() fails (returns a null pointer). If a more detailed error\n** message is available, it is written to zBufOut. If no error message\n** is available, zBufOut is left unmodified and SQLite uses a default\n** error message.\n*/\nstatic void unixDlError(sqlite3_vfs *NotUsed, int nBuf, char *zBufOut){\n  const char *zErr;\n  UNUSED_PARAMETER(NotUsed);\n  unixEnterMutex();\n  zErr = dlerror();\n  if( zErr ){\n    sqlite3_snprintf(nBuf, zBufOut, \"%s\", zErr);\n  }\n  unixLeaveMutex();\n}\nstatic void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){\n  /* \n  ** GCC with -pedantic-errors says that C90 does not allow a void* to be\n  ** cast into a pointer to a function.  And yet the library dlsym() routine\n  ** returns a void* which is really a pointer to a function.  So how do we\n  ** use dlsym() with -pedantic-errors?\n  **\n  ** Variable x below is defined to be a pointer to a function taking\n  ** parameters void* and const char* and returning a pointer to a function.\n  ** We initialize x by assigning it a pointer to the dlsym() function.\n  ** (That assignment requires a cast.)  Then we call the function that\n  ** x points to.  \n  **\n  ** This work-around is unlikely to work correctly on any system where\n  ** you really cannot cast a function pointer into void*.  But then, on the\n  ** other hand, dlsym() will not work on such a system either, so we have\n  ** not really lost anything.\n  */\n  void (*(*x)(void*,const char*))(void);\n  UNUSED_PARAMETER(NotUsed);\n  x = (void(*(*)(void*,const char*))(void))dlsym;\n  return (*x)(p, zSym);\n}\nstatic void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){\n  UNUSED_PARAMETER(NotUsed);\n  dlclose(pHandle);\n}\n#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */\n  #define unixDlOpen  0\n  #define unixDlError 0\n  #define unixDlSym   0\n  #define unixDlClose 0\n#endif\n\n/*\n** Write nBuf bytes of random data to the supplied buffer zBuf.\n*/\nstatic int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){\n  UNUSED_PARAMETER(NotUsed);\n  assert((size_t)nBuf>=(sizeof(time_t)+sizeof(int)));\n\n  /* We have to initialize zBuf to prevent valgrind from reporting\n  ** errors.  The reports issued by valgrind are incorrect - we would\n  ** prefer that the randomness be increased by making use of the\n  ** uninitialized space in zBuf - but valgrind errors tend to worry\n  ** some users.  Rather than argue, it seems easier just to initialize\n  ** the whole array and silence valgrind, even if that means less randomness\n  ** in the random seed.\n  **\n  ** When testing, initializing zBuf[] to zero is all we do.  That means\n  ** that we always use the same random number sequence.  This makes the\n  ** tests repeatable.\n  */\n  memset(zBuf, 0, nBuf);\n  randomnessPid = osGetpid(0);  \n#if !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS)\n  {\n    int fd, got;\n    fd = robust_open(\"/dev/urandom\", O_RDONLY, 0);\n    if( fd<0 ){\n      time_t t;\n      time(&t);\n      memcpy(zBuf, &t, sizeof(t));\n      memcpy(&zBuf[sizeof(t)], &randomnessPid, sizeof(randomnessPid));\n      assert( sizeof(t)+sizeof(randomnessPid)<=(size_t)nBuf );\n      nBuf = sizeof(t) + sizeof(randomnessPid);\n    }else{\n      do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );\n      robust_close(0, fd, __LINE__);\n    }\n  }\n#endif\n  return nBuf;\n}\n\n\n/*\n** Sleep for a little while.  Return the amount of time slept.\n** The argument is the number of microseconds we want to sleep.\n** The return value is the number of microseconds of sleep actually\n** requested from the underlying operating system, a number which\n** might be greater than or equal to the argument, but not less\n** than the argument.\n*/\nstatic int unixSleep(sqlite3_vfs *NotUsed, int microseconds){\n#if OS_VXWORKS\n  struct timespec sp;\n\n  sp.tv_sec = microseconds / 1000000;\n  sp.tv_nsec = (microseconds % 1000000) * 1000;\n  nanosleep(&sp, NULL);\n  UNUSED_PARAMETER(NotUsed);\n  return microseconds;\n#elif defined(HAVE_USLEEP) && HAVE_USLEEP\n  usleep(microseconds);\n  UNUSED_PARAMETER(NotUsed);\n  return microseconds;\n#else\n  int seconds = (microseconds+999999)/1000000;\n  sleep(seconds);\n  UNUSED_PARAMETER(NotUsed);\n  return seconds*1000000;\n#endif\n}\n\n/*\n** The following variable, if set to a non-zero value, is interpreted as\n** the number of seconds since 1970 and is used to set the result of\n** sqlite3OsCurrentTime() during testing.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_current_time = 0;  /* Fake system time in seconds since 1970. */\n#endif\n\n/*\n** Find the current time (in Universal Coordinated Time).  Write into *piNow\n** the current time and date as a Julian Day number times 86_400_000.  In\n** other words, write into *piNow the number of milliseconds since the Julian\n** epoch of noon in Greenwich on November 24, 4714 B.C according to the\n** proleptic Gregorian calendar.\n**\n** On success, return SQLITE_OK.  Return SQLITE_ERROR if the time and date \n** cannot be found.\n*/\nstatic int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){\n  static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000;\n  int rc = SQLITE_OK;\n#if defined(NO_GETTOD)\n  time_t t;\n  time(&t);\n  *piNow = ((sqlite3_int64)t)*1000 + unixEpoch;\n#elif OS_VXWORKS\n  struct timespec sNow;\n  clock_gettime(CLOCK_REALTIME, &sNow);\n  *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_nsec/1000000;\n#else\n  struct timeval sNow;\n  (void)gettimeofday(&sNow, 0);  /* Cannot fail given valid arguments */\n  *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000;\n#endif\n\n#ifdef SQLITE_TEST\n  if( sqlite3_current_time ){\n    *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch;\n  }\n#endif\n  UNUSED_PARAMETER(NotUsed);\n  return rc;\n}\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** Find the current time (in Universal Coordinated Time).  Write the\n** current time and date as a Julian Day number into *prNow and\n** return 0.  Return 1 if the time and date cannot be found.\n*/\nstatic int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){\n  sqlite3_int64 i = 0;\n  int rc;\n  UNUSED_PARAMETER(NotUsed);\n  rc = unixCurrentTimeInt64(0, &i);\n  *prNow = i/86400000.0;\n  return rc;\n}\n#else\n# define unixCurrentTime 0\n#endif\n\n/*\n** The xGetLastError() method is designed to return a better\n** low-level error message when operating-system problems come up\n** during SQLite operation.  Only the integer return code is currently\n** used.\n*/\nstatic int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){\n  UNUSED_PARAMETER(NotUsed);\n  UNUSED_PARAMETER(NotUsed2);\n  UNUSED_PARAMETER(NotUsed3);\n  return errno;\n}\n\n\n/*\n************************ End of sqlite3_vfs methods ***************************\n******************************************************************************/\n\n/******************************************************************************\n************************** Begin Proxy Locking ********************************\n**\n** Proxy locking is a \"uber-locking-method\" in this sense:  It uses the\n** other locking methods on secondary lock files.  Proxy locking is a\n** meta-layer over top of the primitive locking implemented above.  For\n** this reason, the division that implements of proxy locking is deferred\n** until late in the file (here) after all of the other I/O methods have\n** been defined - so that the primitive locking methods are available\n** as services to help with the implementation of proxy locking.\n**\n****\n**\n** The default locking schemes in SQLite use byte-range locks on the\n** database file to coordinate safe, concurrent access by multiple readers\n** and writers [http://sqlite.org/lockingv3.html].  The five file locking\n** states (UNLOCKED, PENDING, SHARED, RESERVED, EXCLUSIVE) are implemented\n** as POSIX read & write locks over fixed set of locations (via fsctl),\n** on AFP and SMB only exclusive byte-range locks are available via fsctl\n** with _IOWR('z', 23, struct ByteRangeLockPB2) to track the same 5 states.\n** To simulate a F_RDLCK on the shared range, on AFP a randomly selected\n** address in the shared range is taken for a SHARED lock, the entire\n** shared range is taken for an EXCLUSIVE lock):\n**\n**      PENDING_BYTE        0x40000000\n**      RESERVED_BYTE       0x40000001\n**      SHARED_RANGE        0x40000002 -> 0x40000200\n**\n** This works well on the local file system, but shows a nearly 100x\n** slowdown in read performance on AFP because the AFP client disables\n** the read cache when byte-range locks are present.  Enabling the read\n** cache exposes a cache coherency problem that is present on all OS X\n** supported network file systems.  NFS and AFP both observe the\n** close-to-open semantics for ensuring cache coherency\n** [http://nfs.sourceforge.net/#faq_a8], which does not effectively\n** address the requirements for concurrent database access by multiple\n** readers and writers\n** [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html].\n**\n** To address the performance and cache coherency issues, proxy file locking\n** changes the way database access is controlled by limiting access to a\n** single host at a time and moving file locks off of the database file\n** and onto a proxy file on the local file system.  \n**\n**\n** Using proxy locks\n** -----------------\n**\n** C APIs\n**\n**  sqlite3_file_control(db, dbname, SQLITE_FCNTL_SET_LOCKPROXYFILE,\n**                       <proxy_path> | \":auto:\");\n**  sqlite3_file_control(db, dbname, SQLITE_FCNTL_GET_LOCKPROXYFILE,\n**                       &<proxy_path>);\n**\n**\n** SQL pragmas\n**\n**  PRAGMA [database.]lock_proxy_file=<proxy_path> | :auto:\n**  PRAGMA [database.]lock_proxy_file\n**\n** Specifying \":auto:\" means that if there is a conch file with a matching\n** host ID in it, the proxy path in the conch file will be used, otherwise\n** a proxy path based on the user's temp dir\n** (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the\n** actual proxy file name is generated from the name and path of the\n** database file.  For example:\n**\n**       For database path \"/Users/me/foo.db\" \n**       The lock path will be \"<tmpdir>/sqliteplocks/_Users_me_foo.db:auto:\")\n**\n** Once a lock proxy is configured for a database connection, it can not\n** be removed, however it may be switched to a different proxy path via\n** the above APIs (assuming the conch file is not being held by another\n** connection or process). \n**\n**\n** How proxy locking works\n** -----------------------\n**\n** Proxy file locking relies primarily on two new supporting files: \n**\n**   *  conch file to limit access to the database file to a single host\n**      at a time\n**\n**   *  proxy file to act as a proxy for the advisory locks normally\n**      taken on the database\n**\n** The conch file - to use a proxy file, sqlite must first \"hold the conch\"\n** by taking an sqlite-style shared lock on the conch file, reading the\n** contents and comparing the host's unique host ID (see below) and lock\n** proxy path against the values stored in the conch.  The conch file is\n** stored in the same directory as the database file and the file name\n** is patterned after the database file name as \".<databasename>-conch\".\n** If the conch file does not exist, or its contents do not match the\n** host ID and/or proxy path, then the lock is escalated to an exclusive\n** lock and the conch file contents is updated with the host ID and proxy\n** path and the lock is downgraded to a shared lock again.  If the conch\n** is held by another process (with a shared lock), the exclusive lock\n** will fail and SQLITE_BUSY is returned.\n**\n** The proxy file - a single-byte file used for all advisory file locks\n** normally taken on the database file.   This allows for safe sharing\n** of the database file for multiple readers and writers on the same\n** host (the conch ensures that they all use the same local lock file).\n**\n** Requesting the lock proxy does not immediately take the conch, it is\n** only taken when the first request to lock database file is made.  \n** This matches the semantics of the traditional locking behavior, where\n** opening a connection to a database file does not take a lock on it.\n** The shared lock and an open file descriptor are maintained until \n** the connection to the database is closed. \n**\n** The proxy file and the lock file are never deleted so they only need\n** to be created the first time they are used.\n**\n** Configuration options\n** ---------------------\n**\n**  SQLITE_PREFER_PROXY_LOCKING\n**\n**       Database files accessed on non-local file systems are\n**       automatically configured for proxy locking, lock files are\n**       named automatically using the same logic as\n**       PRAGMA lock_proxy_file=\":auto:\"\n**    \n**  SQLITE_PROXY_DEBUG\n**\n**       Enables the logging of error messages during host id file\n**       retrieval and creation\n**\n**  LOCKPROXYDIR\n**\n**       Overrides the default directory used for lock proxy files that\n**       are named automatically via the \":auto:\" setting\n**\n**  SQLITE_DEFAULT_PROXYDIR_PERMISSIONS\n**\n**       Permissions to use when creating a directory for storing the\n**       lock proxy files, only used when LOCKPROXYDIR is not set.\n**    \n**    \n** As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING,\n** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will\n** force proxy locking to be used for every database file opened, and 0\n** will force automatic proxy locking to be disabled for all database\n** files (explicitly calling the SQLITE_FCNTL_SET_LOCKPROXYFILE pragma or\n** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).\n*/\n\n/*\n** Proxy locking is only available on MacOSX \n*/\n#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE\n\n/*\n** The proxyLockingContext has the path and file structures for the remote \n** and local proxy files in it\n*/\ntypedef struct proxyLockingContext proxyLockingContext;\nstruct proxyLockingContext {\n  unixFile *conchFile;         /* Open conch file */\n  char *conchFilePath;         /* Name of the conch file */\n  unixFile *lockProxy;         /* Open proxy lock file */\n  char *lockProxyPath;         /* Name of the proxy lock file */\n  char *dbPath;                /* Name of the open file */\n  int conchHeld;               /* 1 if the conch is held, -1 if lockless */\n  int nFails;                  /* Number of conch taking failures */\n  void *oldLockingContext;     /* Original lockingcontext to restore on close */\n  sqlite3_io_methods const *pOldMethod;     /* Original I/O methods for close */\n};\n\n/* \n** The proxy lock file path for the database at dbPath is written into lPath, \n** which must point to valid, writable memory large enough for a maxLen length\n** file path. \n*/\nstatic int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxLen){\n  int len;\n  int dbLen;\n  int i;\n\n#ifdef LOCKPROXYDIR\n  len = strlcpy(lPath, LOCKPROXYDIR, maxLen);\n#else\n# ifdef _CS_DARWIN_USER_TEMP_DIR\n  {\n    if( !confstr(_CS_DARWIN_USER_TEMP_DIR, lPath, maxLen) ){\n      OSTRACE((\"GETLOCKPATH  failed %s errno=%d pid=%d\\n\",\n               lPath, errno, osGetpid(0)));\n      return SQLITE_IOERR_LOCK;\n    }\n    len = strlcat(lPath, \"sqliteplocks\", maxLen);    \n  }\n# else\n  len = strlcpy(lPath, \"/tmp/\", maxLen);\n# endif\n#endif\n\n  if( lPath[len-1]!='/' ){\n    len = strlcat(lPath, \"/\", maxLen);\n  }\n  \n  /* transform the db path to a unique cache name */\n  dbLen = (int)strlen(dbPath);\n  for( i=0; i<dbLen && (i+len+7)<(int)maxLen; i++){\n    char c = dbPath[i];\n    lPath[i+len] = (c=='/')?'_':c;\n  }\n  lPath[i+len]='\\0';\n  strlcat(lPath, \":auto:\", maxLen);\n  OSTRACE((\"GETLOCKPATH  proxy lock path=%s pid=%d\\n\", lPath, osGetpid(0)));\n  return SQLITE_OK;\n}\n\n/* \n ** Creates the lock file and any missing directories in lockPath\n */\nstatic int proxyCreateLockPath(const char *lockPath){\n  int i, len;\n  char buf[MAXPATHLEN];\n  int start = 0;\n  \n  assert(lockPath!=NULL);\n  /* try to create all the intermediate directories */\n  len = (int)strlen(lockPath);\n  buf[0] = lockPath[0];\n  for( i=1; i<len; i++ ){\n    if( lockPath[i] == '/' && (i - start > 0) ){\n      /* only mkdir if leaf dir != \".\" or \"/\" or \"..\" */\n      if( i-start>2 || (i-start==1 && buf[start] != '.' && buf[start] != '/') \n         || (i-start==2 && buf[start] != '.' && buf[start+1] != '.') ){\n        buf[i]='\\0';\n        if( osMkdir(buf, SQLITE_DEFAULT_PROXYDIR_PERMISSIONS) ){\n          int err=errno;\n          if( err!=EEXIST ) {\n            OSTRACE((\"CREATELOCKPATH  FAILED creating %s, \"\n                     \"'%s' proxy lock path=%s pid=%d\\n\",\n                     buf, strerror(err), lockPath, osGetpid(0)));\n            return err;\n          }\n        }\n      }\n      start=i+1;\n    }\n    buf[i] = lockPath[i];\n  }\n  OSTRACE((\"CREATELOCKPATH  proxy lock path=%s pid=%d\\n\",lockPath,osGetpid(0)));\n  return 0;\n}\n\n/*\n** Create a new VFS file descriptor (stored in memory obtained from\n** sqlite3_malloc) and open the file named \"path\" in the file descriptor.\n**\n** The caller is responsible not only for closing the file descriptor\n** but also for freeing the memory associated with the file descriptor.\n*/\nstatic int proxyCreateUnixFile(\n    const char *path,        /* path for the new unixFile */\n    unixFile **ppFile,       /* unixFile created and returned by ref */\n    int islockfile           /* if non zero missing dirs will be created */\n) {\n  int fd = -1;\n  unixFile *pNew;\n  int rc = SQLITE_OK;\n  int openFlags = O_RDWR | O_CREAT;\n  sqlite3_vfs dummyVfs;\n  int terrno = 0;\n  UnixUnusedFd *pUnused = NULL;\n\n  /* 1. first try to open/create the file\n  ** 2. if that fails, and this is a lock file (not-conch), try creating\n  ** the parent directories and then try again.\n  ** 3. if that fails, try to open the file read-only\n  ** otherwise return BUSY (if lock file) or CANTOPEN for the conch file\n  */\n  pUnused = findReusableFd(path, openFlags);\n  if( pUnused ){\n    fd = pUnused->fd;\n  }else{\n    pUnused = sqlite3_malloc64(sizeof(*pUnused));\n    if( !pUnused ){\n      return SQLITE_NOMEM_BKPT;\n    }\n  }\n  if( fd<0 ){\n    fd = robust_open(path, openFlags, 0);\n    terrno = errno;\n    if( fd<0 && errno==ENOENT && islockfile ){\n      if( proxyCreateLockPath(path) == SQLITE_OK ){\n        fd = robust_open(path, openFlags, 0);\n      }\n    }\n  }\n  if( fd<0 ){\n    openFlags = O_RDONLY;\n    fd = robust_open(path, openFlags, 0);\n    terrno = errno;\n  }\n  if( fd<0 ){\n    if( islockfile ){\n      return SQLITE_BUSY;\n    }\n    switch (terrno) {\n      case EACCES:\n        return SQLITE_PERM;\n      case EIO: \n        return SQLITE_IOERR_LOCK; /* even though it is the conch */\n      default:\n        return SQLITE_CANTOPEN_BKPT;\n    }\n  }\n  \n  pNew = (unixFile *)sqlite3_malloc64(sizeof(*pNew));\n  if( pNew==NULL ){\n    rc = SQLITE_NOMEM_BKPT;\n    goto end_create_proxy;\n  }\n  memset(pNew, 0, sizeof(unixFile));\n  pNew->openFlags = openFlags;\n  memset(&dummyVfs, 0, sizeof(dummyVfs));\n  dummyVfs.pAppData = (void*)&autolockIoFinder;\n  dummyVfs.zName = \"dummy\";\n  pUnused->fd = fd;\n  pUnused->flags = openFlags;\n  pNew->pUnused = pUnused;\n  \n  rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0);\n  if( rc==SQLITE_OK ){\n    *ppFile = pNew;\n    return SQLITE_OK;\n  }\nend_create_proxy:    \n  robust_close(pNew, fd, __LINE__);\n  sqlite3_free(pNew);\n  sqlite3_free(pUnused);\n  return rc;\n}\n\n#ifdef SQLITE_TEST\n/* simulate multiple hosts by creating unique hostid file paths */\nint sqlite3_hostid_num = 0;\n#endif\n\n#define PROXY_HOSTIDLEN    16  /* conch file host id length */\n\n#ifdef HAVE_GETHOSTUUID\n/* Not always defined in the headers as it ought to be */\nextern int gethostuuid(uuid_t id, const struct timespec *wait);\n#endif\n\n/* get the host ID via gethostuuid(), pHostID must point to PROXY_HOSTIDLEN \n** bytes of writable memory.\n*/\nstatic int proxyGetHostID(unsigned char *pHostID, int *pError){\n  assert(PROXY_HOSTIDLEN == sizeof(uuid_t));\n  memset(pHostID, 0, PROXY_HOSTIDLEN);\n#ifdef HAVE_GETHOSTUUID\n  {\n    struct timespec timeout = {1, 0}; /* 1 sec timeout */\n    if( gethostuuid(pHostID, &timeout) ){\n      int err = errno;\n      if( pError ){\n        *pError = err;\n      }\n      return SQLITE_IOERR;\n    }\n  }\n#else\n  UNUSED_PARAMETER(pError);\n#endif\n#ifdef SQLITE_TEST\n  /* simulate multiple hosts by creating unique hostid file paths */\n  if( sqlite3_hostid_num != 0){\n    pHostID[0] = (char)(pHostID[0] + (char)(sqlite3_hostid_num & 0xFF));\n  }\n#endif\n  \n  return SQLITE_OK;\n}\n\n/* The conch file contains the header, host id and lock file path\n */\n#define PROXY_CONCHVERSION 2   /* 1-byte header, 16-byte host id, path */\n#define PROXY_HEADERLEN    1   /* conch file header length */\n#define PROXY_PATHINDEX    (PROXY_HEADERLEN+PROXY_HOSTIDLEN)\n#define PROXY_MAXCONCHLEN  (PROXY_HEADERLEN+PROXY_HOSTIDLEN+MAXPATHLEN)\n\n/* \n** Takes an open conch file, copies the contents to a new path and then moves \n** it back.  The newly created file's file descriptor is assigned to the\n** conch file structure and finally the original conch file descriptor is \n** closed.  Returns zero if successful.\n*/\nstatic int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){\n  proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; \n  unixFile *conchFile = pCtx->conchFile;\n  char tPath[MAXPATHLEN];\n  char buf[PROXY_MAXCONCHLEN];\n  char *cPath = pCtx->conchFilePath;\n  size_t readLen = 0;\n  size_t pathLen = 0;\n  char errmsg[64] = \"\";\n  int fd = -1;\n  int rc = -1;\n  UNUSED_PARAMETER(myHostID);\n\n  /* create a new path by replace the trailing '-conch' with '-break' */\n  pathLen = strlcpy(tPath, cPath, MAXPATHLEN);\n  if( pathLen>MAXPATHLEN || pathLen<6 || \n     (strlcpy(&tPath[pathLen-5], \"break\", 6) != 5) ){\n    sqlite3_snprintf(sizeof(errmsg),errmsg,\"path error (len %d)\",(int)pathLen);\n    goto end_breaklock;\n  }\n  /* read the conch content */\n  readLen = osPread(conchFile->h, buf, PROXY_MAXCONCHLEN, 0);\n  if( readLen<PROXY_PATHINDEX ){\n    sqlite3_snprintf(sizeof(errmsg),errmsg,\"read error (len %d)\",(int)readLen);\n    goto end_breaklock;\n  }\n  /* write it out to the temporary break file */\n  fd = robust_open(tPath, (O_RDWR|O_CREAT|O_EXCL), 0);\n  if( fd<0 ){\n    sqlite3_snprintf(sizeof(errmsg), errmsg, \"create failed (%d)\", errno);\n    goto end_breaklock;\n  }\n  if( osPwrite(fd, buf, readLen, 0) != (ssize_t)readLen ){\n    sqlite3_snprintf(sizeof(errmsg), errmsg, \"write failed (%d)\", errno);\n    goto end_breaklock;\n  }\n  if( rename(tPath, cPath) ){\n    sqlite3_snprintf(sizeof(errmsg), errmsg, \"rename failed (%d)\", errno);\n    goto end_breaklock;\n  }\n  rc = 0;\n  fprintf(stderr, \"broke stale lock on %s\\n\", cPath);\n  robust_close(pFile, conchFile->h, __LINE__);\n  conchFile->h = fd;\n  conchFile->openFlags = O_RDWR | O_CREAT;\n\nend_breaklock:\n  if( rc ){\n    if( fd>=0 ){\n      osUnlink(tPath);\n      robust_close(pFile, fd, __LINE__);\n    }\n    fprintf(stderr, \"failed to break stale lock on %s, %s\\n\", cPath, errmsg);\n  }\n  return rc;\n}\n\n/* Take the requested lock on the conch file and break a stale lock if the \n** host id matches.\n*/\nstatic int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){\n  proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; \n  unixFile *conchFile = pCtx->conchFile;\n  int rc = SQLITE_OK;\n  int nTries = 0;\n  struct timespec conchModTime;\n  \n  memset(&conchModTime, 0, sizeof(conchModTime));\n  do {\n    rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType);\n    nTries ++;\n    if( rc==SQLITE_BUSY ){\n      /* If the lock failed (busy):\n       * 1st try: get the mod time of the conch, wait 0.5s and try again. \n       * 2nd try: fail if the mod time changed or host id is different, wait \n       *           10 sec and try again\n       * 3rd try: break the lock unless the mod time has changed.\n       */\n      struct stat buf;\n      if( osFstat(conchFile->h, &buf) ){\n        storeLastErrno(pFile, errno);\n        return SQLITE_IOERR_LOCK;\n      }\n      \n      if( nTries==1 ){\n        conchModTime = buf.st_mtimespec;\n        usleep(500000); /* wait 0.5 sec and try the lock again*/\n        continue;  \n      }\n\n      assert( nTries>1 );\n      if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec || \n         conchModTime.tv_nsec != buf.st_mtimespec.tv_nsec ){\n        return SQLITE_BUSY;\n      }\n      \n      if( nTries==2 ){  \n        char tBuf[PROXY_MAXCONCHLEN];\n        int len = osPread(conchFile->h, tBuf, PROXY_MAXCONCHLEN, 0);\n        if( len<0 ){\n          storeLastErrno(pFile, errno);\n          return SQLITE_IOERR_LOCK;\n        }\n        if( len>PROXY_PATHINDEX && tBuf[0]==(char)PROXY_CONCHVERSION){\n          /* don't break the lock if the host id doesn't match */\n          if( 0!=memcmp(&tBuf[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN) ){\n            return SQLITE_BUSY;\n          }\n        }else{\n          /* don't break the lock on short read or a version mismatch */\n          return SQLITE_BUSY;\n        }\n        usleep(10000000); /* wait 10 sec and try the lock again */\n        continue; \n      }\n      \n      assert( nTries==3 );\n      if( 0==proxyBreakConchLock(pFile, myHostID) ){\n        rc = SQLITE_OK;\n        if( lockType==EXCLUSIVE_LOCK ){\n          rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, SHARED_LOCK);\n        }\n        if( !rc ){\n          rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType);\n        }\n      }\n    }\n  } while( rc==SQLITE_BUSY && nTries<3 );\n  \n  return rc;\n}\n\n/* Takes the conch by taking a shared lock and read the contents conch, if \n** lockPath is non-NULL, the host ID and lock file path must match.  A NULL \n** lockPath means that the lockPath in the conch file will be used if the \n** host IDs match, or a new lock path will be generated automatically \n** and written to the conch file.\n*/\nstatic int proxyTakeConch(unixFile *pFile){\n  proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; \n  \n  if( pCtx->conchHeld!=0 ){\n    return SQLITE_OK;\n  }else{\n    unixFile *conchFile = pCtx->conchFile;\n    uuid_t myHostID;\n    int pError = 0;\n    char readBuf[PROXY_MAXCONCHLEN];\n    char lockPath[MAXPATHLEN];\n    char *tempLockPath = NULL;\n    int rc = SQLITE_OK;\n    int createConch = 0;\n    int hostIdMatch = 0;\n    int readLen = 0;\n    int tryOldLockPath = 0;\n    int forceNewLockPath = 0;\n    \n    OSTRACE((\"TAKECONCH  %d for %s pid=%d\\n\", conchFile->h,\n             (pCtx->lockProxyPath ? pCtx->lockProxyPath : \":auto:\"),\n             osGetpid(0)));\n\n    rc = proxyGetHostID(myHostID, &pError);\n    if( (rc&0xff)==SQLITE_IOERR ){\n      storeLastErrno(pFile, pError);\n      goto end_takeconch;\n    }\n    rc = proxyConchLock(pFile, myHostID, SHARED_LOCK);\n    if( rc!=SQLITE_OK ){\n      goto end_takeconch;\n    }\n    /* read the existing conch file */\n    readLen = seekAndRead((unixFile*)conchFile, 0, readBuf, PROXY_MAXCONCHLEN);\n    if( readLen<0 ){\n      /* I/O error: lastErrno set by seekAndRead */\n      storeLastErrno(pFile, conchFile->lastErrno);\n      rc = SQLITE_IOERR_READ;\n      goto end_takeconch;\n    }else if( readLen<=(PROXY_HEADERLEN+PROXY_HOSTIDLEN) || \n             readBuf[0]!=(char)PROXY_CONCHVERSION ){\n      /* a short read or version format mismatch means we need to create a new \n      ** conch file. \n      */\n      createConch = 1;\n    }\n    /* if the host id matches and the lock path already exists in the conch\n    ** we'll try to use the path there, if we can't open that path, we'll \n    ** retry with a new auto-generated path \n    */\n    do { /* in case we need to try again for an :auto: named lock file */\n\n      if( !createConch && !forceNewLockPath ){\n        hostIdMatch = !memcmp(&readBuf[PROXY_HEADERLEN], myHostID, \n                                  PROXY_HOSTIDLEN);\n        /* if the conch has data compare the contents */\n        if( !pCtx->lockProxyPath ){\n          /* for auto-named local lock file, just check the host ID and we'll\n           ** use the local lock file path that's already in there\n           */\n          if( hostIdMatch ){\n            size_t pathLen = (readLen - PROXY_PATHINDEX);\n            \n            if( pathLen>=MAXPATHLEN ){\n              pathLen=MAXPATHLEN-1;\n            }\n            memcpy(lockPath, &readBuf[PROXY_PATHINDEX], pathLen);\n            lockPath[pathLen] = 0;\n            tempLockPath = lockPath;\n            tryOldLockPath = 1;\n            /* create a copy of the lock path if the conch is taken */\n            goto end_takeconch;\n          }\n        }else if( hostIdMatch\n               && !strncmp(pCtx->lockProxyPath, &readBuf[PROXY_PATHINDEX],\n                           readLen-PROXY_PATHINDEX)\n        ){\n          /* conch host and lock path match */\n          goto end_takeconch; \n        }\n      }\n      \n      /* if the conch isn't writable and doesn't match, we can't take it */\n      if( (conchFile->openFlags&O_RDWR) == 0 ){\n        rc = SQLITE_BUSY;\n        goto end_takeconch;\n      }\n      \n      /* either the conch didn't match or we need to create a new one */\n      if( !pCtx->lockProxyPath ){\n        proxyGetLockPath(pCtx->dbPath, lockPath, MAXPATHLEN);\n        tempLockPath = lockPath;\n        /* create a copy of the lock path _only_ if the conch is taken */\n      }\n      \n      /* update conch with host and path (this will fail if other process\n      ** has a shared lock already), if the host id matches, use the big\n      ** stick.\n      */\n      futimes(conchFile->h, NULL);\n      if( hostIdMatch && !createConch ){\n        if( conchFile->pInode && conchFile->pInode->nShared>1 ){\n          /* We are trying for an exclusive lock but another thread in this\n           ** same process is still holding a shared lock. */\n          rc = SQLITE_BUSY;\n        } else {          \n          rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK);\n        }\n      }else{\n        rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK);\n      }\n      if( rc==SQLITE_OK ){\n        char writeBuffer[PROXY_MAXCONCHLEN];\n        int writeSize = 0;\n        \n        writeBuffer[0] = (char)PROXY_CONCHVERSION;\n        memcpy(&writeBuffer[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN);\n        if( pCtx->lockProxyPath!=NULL ){\n          strlcpy(&writeBuffer[PROXY_PATHINDEX], pCtx->lockProxyPath,\n                  MAXPATHLEN);\n        }else{\n          strlcpy(&writeBuffer[PROXY_PATHINDEX], tempLockPath, MAXPATHLEN);\n        }\n        writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]);\n        robust_ftruncate(conchFile->h, writeSize);\n        rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0);\n        full_fsync(conchFile->h,0,0);\n        /* If we created a new conch file (not just updated the contents of a \n         ** valid conch file), try to match the permissions of the database \n         */\n        if( rc==SQLITE_OK && createConch ){\n          struct stat buf;\n          int err = osFstat(pFile->h, &buf);\n          if( err==0 ){\n            mode_t cmode = buf.st_mode&(S_IRUSR|S_IWUSR | S_IRGRP|S_IWGRP |\n                                        S_IROTH|S_IWOTH);\n            /* try to match the database file R/W permissions, ignore failure */\n#ifndef SQLITE_PROXY_DEBUG\n            osFchmod(conchFile->h, cmode);\n#else\n            do{\n              rc = osFchmod(conchFile->h, cmode);\n            }while( rc==(-1) && errno==EINTR );\n            if( rc!=0 ){\n              int code = errno;\n              fprintf(stderr, \"fchmod %o FAILED with %d %s\\n\",\n                      cmode, code, strerror(code));\n            } else {\n              fprintf(stderr, \"fchmod %o SUCCEDED\\n\",cmode);\n            }\n          }else{\n            int code = errno;\n            fprintf(stderr, \"STAT FAILED[%d] with %d %s\\n\", \n                    err, code, strerror(code));\n#endif\n          }\n        }\n      }\n      conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, SHARED_LOCK);\n      \n    end_takeconch:\n      OSTRACE((\"TRANSPROXY: CLOSE  %d\\n\", pFile->h));\n      if( rc==SQLITE_OK && pFile->openFlags ){\n        int fd;\n        if( pFile->h>=0 ){\n          robust_close(pFile, pFile->h, __LINE__);\n        }\n        pFile->h = -1;\n        fd = robust_open(pCtx->dbPath, pFile->openFlags, 0);\n        OSTRACE((\"TRANSPROXY: OPEN  %d\\n\", fd));\n        if( fd>=0 ){\n          pFile->h = fd;\n        }else{\n          rc=SQLITE_CANTOPEN_BKPT; /* SQLITE_BUSY? proxyTakeConch called\n           during locking */\n        }\n      }\n      if( rc==SQLITE_OK && !pCtx->lockProxy ){\n        char *path = tempLockPath ? tempLockPath : pCtx->lockProxyPath;\n        rc = proxyCreateUnixFile(path, &pCtx->lockProxy, 1);\n        if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM && tryOldLockPath ){\n          /* we couldn't create the proxy lock file with the old lock file path\n           ** so try again via auto-naming \n           */\n          forceNewLockPath = 1;\n          tryOldLockPath = 0;\n          continue; /* go back to the do {} while start point, try again */\n        }\n      }\n      if( rc==SQLITE_OK ){\n        /* Need to make a copy of path if we extracted the value\n         ** from the conch file or the path was allocated on the stack\n         */\n        if( tempLockPath ){\n          pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath);\n          if( !pCtx->lockProxyPath ){\n            rc = SQLITE_NOMEM_BKPT;\n          }\n        }\n      }\n      if( rc==SQLITE_OK ){\n        pCtx->conchHeld = 1;\n        \n        if( pCtx->lockProxy->pMethod == &afpIoMethods ){\n          afpLockingContext *afpCtx;\n          afpCtx = (afpLockingContext *)pCtx->lockProxy->lockingContext;\n          afpCtx->dbPath = pCtx->lockProxyPath;\n        }\n      } else {\n        conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);\n      }\n      OSTRACE((\"TAKECONCH  %d %s\\n\", conchFile->h,\n               rc==SQLITE_OK?\"ok\":\"failed\"));\n      return rc;\n    } while (1); /* in case we need to retry the :auto: lock file - \n                 ** we should never get here except via the 'continue' call. */\n  }\n}\n\n/*\n** If pFile holds a lock on a conch file, then release that lock.\n*/\nstatic int proxyReleaseConch(unixFile *pFile){\n  int rc = SQLITE_OK;         /* Subroutine return code */\n  proxyLockingContext *pCtx;  /* The locking context for the proxy lock */\n  unixFile *conchFile;        /* Name of the conch file */\n\n  pCtx = (proxyLockingContext *)pFile->lockingContext;\n  conchFile = pCtx->conchFile;\n  OSTRACE((\"RELEASECONCH  %d for %s pid=%d\\n\", conchFile->h,\n           (pCtx->lockProxyPath ? pCtx->lockProxyPath : \":auto:\"), \n           osGetpid(0)));\n  if( pCtx->conchHeld>0 ){\n    rc = conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);\n  }\n  pCtx->conchHeld = 0;\n  OSTRACE((\"RELEASECONCH  %d %s\\n\", conchFile->h,\n           (rc==SQLITE_OK ? \"ok\" : \"failed\")));\n  return rc;\n}\n\n/*\n** Given the name of a database file, compute the name of its conch file.\n** Store the conch filename in memory obtained from sqlite3_malloc64().\n** Make *pConchPath point to the new name.  Return SQLITE_OK on success\n** or SQLITE_NOMEM if unable to obtain memory.\n**\n** The caller is responsible for ensuring that the allocated memory\n** space is eventually freed.\n**\n** *pConchPath is set to NULL if a memory allocation error occurs.\n*/\nstatic int proxyCreateConchPathname(char *dbPath, char **pConchPath){\n  int i;                        /* Loop counter */\n  int len = (int)strlen(dbPath); /* Length of database filename - dbPath */\n  char *conchPath;              /* buffer in which to construct conch name */\n\n  /* Allocate space for the conch filename and initialize the name to\n  ** the name of the original database file. */  \n  *pConchPath = conchPath = (char *)sqlite3_malloc64(len + 8);\n  if( conchPath==0 ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  memcpy(conchPath, dbPath, len+1);\n  \n  /* now insert a \".\" before the last / character */\n  for( i=(len-1); i>=0; i-- ){\n    if( conchPath[i]=='/' ){\n      i++;\n      break;\n    }\n  }\n  conchPath[i]='.';\n  while ( i<len ){\n    conchPath[i+1]=dbPath[i];\n    i++;\n  }\n\n  /* append the \"-conch\" suffix to the file */\n  memcpy(&conchPath[i+1], \"-conch\", 7);\n  assert( (int)strlen(conchPath) == len+7 );\n\n  return SQLITE_OK;\n}\n\n\n/* Takes a fully configured proxy locking-style unix file and switches\n** the local lock file path \n*/\nstatic int switchLockProxyPath(unixFile *pFile, const char *path) {\n  proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;\n  char *oldPath = pCtx->lockProxyPath;\n  int rc = SQLITE_OK;\n\n  if( pFile->eFileLock!=NO_LOCK ){\n    return SQLITE_BUSY;\n  }  \n\n  /* nothing to do if the path is NULL, :auto: or matches the existing path */\n  if( !path || path[0]=='\\0' || !strcmp(path, \":auto:\") ||\n    (oldPath && !strncmp(oldPath, path, MAXPATHLEN)) ){\n    return SQLITE_OK;\n  }else{\n    unixFile *lockProxy = pCtx->lockProxy;\n    pCtx->lockProxy=NULL;\n    pCtx->conchHeld = 0;\n    if( lockProxy!=NULL ){\n      rc=lockProxy->pMethod->xClose((sqlite3_file *)lockProxy);\n      if( rc ) return rc;\n      sqlite3_free(lockProxy);\n    }\n    sqlite3_free(oldPath);\n    pCtx->lockProxyPath = sqlite3DbStrDup(0, path);\n  }\n  \n  return rc;\n}\n\n/*\n** pFile is a file that has been opened by a prior xOpen call.  dbPath\n** is a string buffer at least MAXPATHLEN+1 characters in size.\n**\n** This routine find the filename associated with pFile and writes it\n** int dbPath.\n*/\nstatic int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath){\n#if defined(__APPLE__)\n  if( pFile->pMethod == &afpIoMethods ){\n    /* afp style keeps a reference to the db path in the filePath field \n    ** of the struct */\n    assert( (int)strlen((char*)pFile->lockingContext)<=MAXPATHLEN );\n    strlcpy(dbPath, ((afpLockingContext *)pFile->lockingContext)->dbPath,\n            MAXPATHLEN);\n  } else\n#endif\n  if( pFile->pMethod == &dotlockIoMethods ){\n    /* dot lock style uses the locking context to store the dot lock\n    ** file path */\n    int len = strlen((char *)pFile->lockingContext) - strlen(DOTLOCK_SUFFIX);\n    memcpy(dbPath, (char *)pFile->lockingContext, len + 1);\n  }else{\n    /* all other styles use the locking context to store the db file path */\n    assert( strlen((char*)pFile->lockingContext)<=MAXPATHLEN );\n    strlcpy(dbPath, (char *)pFile->lockingContext, MAXPATHLEN);\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Takes an already filled in unix file and alters it so all file locking \n** will be performed on the local proxy lock file.  The following fields\n** are preserved in the locking context so that they can be restored and \n** the unix structure properly cleaned up at close time:\n**  ->lockingContext\n**  ->pMethod\n*/\nstatic int proxyTransformUnixFile(unixFile *pFile, const char *path) {\n  proxyLockingContext *pCtx;\n  char dbPath[MAXPATHLEN+1];       /* Name of the database file */\n  char *lockPath=NULL;\n  int rc = SQLITE_OK;\n  \n  if( pFile->eFileLock!=NO_LOCK ){\n    return SQLITE_BUSY;\n  }\n  proxyGetDbPathForUnixFile(pFile, dbPath);\n  if( !path || path[0]=='\\0' || !strcmp(path, \":auto:\") ){\n    lockPath=NULL;\n  }else{\n    lockPath=(char *)path;\n  }\n  \n  OSTRACE((\"TRANSPROXY  %d for %s pid=%d\\n\", pFile->h,\n           (lockPath ? lockPath : \":auto:\"), osGetpid(0)));\n\n  pCtx = sqlite3_malloc64( sizeof(*pCtx) );\n  if( pCtx==0 ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  memset(pCtx, 0, sizeof(*pCtx));\n\n  rc = proxyCreateConchPathname(dbPath, &pCtx->conchFilePath);\n  if( rc==SQLITE_OK ){\n    rc = proxyCreateUnixFile(pCtx->conchFilePath, &pCtx->conchFile, 0);\n    if( rc==SQLITE_CANTOPEN && ((pFile->openFlags&O_RDWR) == 0) ){\n      /* if (a) the open flags are not O_RDWR, (b) the conch isn't there, and\n      ** (c) the file system is read-only, then enable no-locking access.\n      ** Ugh, since O_RDONLY==0x0000 we test for !O_RDWR since unixOpen asserts\n      ** that openFlags will have only one of O_RDONLY or O_RDWR.\n      */\n      struct statfs fsInfo;\n      struct stat conchInfo;\n      int goLockless = 0;\n\n      if( osStat(pCtx->conchFilePath, &conchInfo) == -1 ) {\n        int err = errno;\n        if( (err==ENOENT) && (statfs(dbPath, &fsInfo) != -1) ){\n          goLockless = (fsInfo.f_flags&MNT_RDONLY) == MNT_RDONLY;\n        }\n      }\n      if( goLockless ){\n        pCtx->conchHeld = -1; /* read only FS/ lockless */\n        rc = SQLITE_OK;\n      }\n    }\n  }  \n  if( rc==SQLITE_OK && lockPath ){\n    pCtx->lockProxyPath = sqlite3DbStrDup(0, lockPath);\n  }\n\n  if( rc==SQLITE_OK ){\n    pCtx->dbPath = sqlite3DbStrDup(0, dbPath);\n    if( pCtx->dbPath==NULL ){\n      rc = SQLITE_NOMEM_BKPT;\n    }\n  }\n  if( rc==SQLITE_OK ){\n    /* all memory is allocated, proxys are created and assigned, \n    ** switch the locking context and pMethod then return.\n    */\n    pCtx->oldLockingContext = pFile->lockingContext;\n    pFile->lockingContext = pCtx;\n    pCtx->pOldMethod = pFile->pMethod;\n    pFile->pMethod = &proxyIoMethods;\n  }else{\n    if( pCtx->conchFile ){ \n      pCtx->conchFile->pMethod->xClose((sqlite3_file *)pCtx->conchFile);\n      sqlite3_free(pCtx->conchFile);\n    }\n    sqlite3DbFree(0, pCtx->lockProxyPath);\n    sqlite3_free(pCtx->conchFilePath); \n    sqlite3_free(pCtx);\n  }\n  OSTRACE((\"TRANSPROXY  %d %s\\n\", pFile->h,\n           (rc==SQLITE_OK ? \"ok\" : \"failed\")));\n  return rc;\n}\n\n\n/*\n** This routine handles sqlite3_file_control() calls that are specific\n** to proxy locking.\n*/\nstatic int proxyFileControl(sqlite3_file *id, int op, void *pArg){\n  switch( op ){\n    case SQLITE_FCNTL_GET_LOCKPROXYFILE: {\n      unixFile *pFile = (unixFile*)id;\n      if( pFile->pMethod == &proxyIoMethods ){\n        proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;\n        proxyTakeConch(pFile);\n        if( pCtx->lockProxyPath ){\n          *(const char **)pArg = pCtx->lockProxyPath;\n        }else{\n          *(const char **)pArg = \":auto: (not held)\";\n        }\n      } else {\n        *(const char **)pArg = NULL;\n      }\n      return SQLITE_OK;\n    }\n    case SQLITE_FCNTL_SET_LOCKPROXYFILE: {\n      unixFile *pFile = (unixFile*)id;\n      int rc = SQLITE_OK;\n      int isProxyStyle = (pFile->pMethod == &proxyIoMethods);\n      if( pArg==NULL || (const char *)pArg==0 ){\n        if( isProxyStyle ){\n          /* turn off proxy locking - not supported.  If support is added for\n          ** switching proxy locking mode off then it will need to fail if\n          ** the journal mode is WAL mode. \n          */\n          rc = SQLITE_ERROR /*SQLITE_PROTOCOL? SQLITE_MISUSE?*/;\n        }else{\n          /* turn off proxy locking - already off - NOOP */\n          rc = SQLITE_OK;\n        }\n      }else{\n        const char *proxyPath = (const char *)pArg;\n        if( isProxyStyle ){\n          proxyLockingContext *pCtx = \n            (proxyLockingContext*)pFile->lockingContext;\n          if( !strcmp(pArg, \":auto:\") \n           || (pCtx->lockProxyPath &&\n               !strncmp(pCtx->lockProxyPath, proxyPath, MAXPATHLEN))\n          ){\n            rc = SQLITE_OK;\n          }else{\n            rc = switchLockProxyPath(pFile, proxyPath);\n          }\n        }else{\n          /* turn on proxy file locking */\n          rc = proxyTransformUnixFile(pFile, proxyPath);\n        }\n      }\n      return rc;\n    }\n    default: {\n      assert( 0 );  /* The call assures that only valid opcodes are sent */\n    }\n  }\n  /*NOTREACHED*/\n  return SQLITE_ERROR;\n}\n\n/*\n** Within this division (the proxying locking implementation) the procedures\n** above this point are all utilities.  The lock-related methods of the\n** proxy-locking sqlite3_io_method object follow.\n*/\n\n\n/*\n** This routine checks if there is a RESERVED lock held on the specified\n** file by this or any other process. If such a lock is held, set *pResOut\n** to a non-zero value otherwise *pResOut is set to zero.  The return value\n** is set to SQLITE_OK unless an I/O error occurs during lock checking.\n*/\nstatic int proxyCheckReservedLock(sqlite3_file *id, int *pResOut) {\n  unixFile *pFile = (unixFile*)id;\n  int rc = proxyTakeConch(pFile);\n  if( rc==SQLITE_OK ){\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\n    if( pCtx->conchHeld>0 ){\n      unixFile *proxy = pCtx->lockProxy;\n      return proxy->pMethod->xCheckReservedLock((sqlite3_file*)proxy, pResOut);\n    }else{ /* conchHeld < 0 is lockless */\n      pResOut=0;\n    }\n  }\n  return rc;\n}\n\n/*\n** Lock the file with the lock specified by parameter eFileLock - one\n** of the following:\n**\n**     (1) SHARED_LOCK\n**     (2) RESERVED_LOCK\n**     (3) PENDING_LOCK\n**     (4) EXCLUSIVE_LOCK\n**\n** Sometimes when requesting one lock state, additional lock states\n** are inserted in between.  The locking might fail on one of the later\n** transitions leaving the lock state different from what it started but\n** still short of its goal.  The following chart shows the allowed\n** transitions and the inserted intermediate states:\n**\n**    UNLOCKED -> SHARED\n**    SHARED -> RESERVED\n**    SHARED -> (PENDING) -> EXCLUSIVE\n**    RESERVED -> (PENDING) -> EXCLUSIVE\n**    PENDING -> EXCLUSIVE\n**\n** This routine will only increase a lock.  Use the sqlite3OsUnlock()\n** routine to lower a locking level.\n*/\nstatic int proxyLock(sqlite3_file *id, int eFileLock) {\n  unixFile *pFile = (unixFile*)id;\n  int rc = proxyTakeConch(pFile);\n  if( rc==SQLITE_OK ){\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\n    if( pCtx->conchHeld>0 ){\n      unixFile *proxy = pCtx->lockProxy;\n      rc = proxy->pMethod->xLock((sqlite3_file*)proxy, eFileLock);\n      pFile->eFileLock = proxy->eFileLock;\n    }else{\n      /* conchHeld < 0 is lockless */\n    }\n  }\n  return rc;\n}\n\n\n/*\n** Lower the locking level on file descriptor pFile to eFileLock.  eFileLock\n** must be either NO_LOCK or SHARED_LOCK.\n**\n** If the locking level of the file descriptor is already at or below\n** the requested locking level, this routine is a no-op.\n*/\nstatic int proxyUnlock(sqlite3_file *id, int eFileLock) {\n  unixFile *pFile = (unixFile*)id;\n  int rc = proxyTakeConch(pFile);\n  if( rc==SQLITE_OK ){\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\n    if( pCtx->conchHeld>0 ){\n      unixFile *proxy = pCtx->lockProxy;\n      rc = proxy->pMethod->xUnlock((sqlite3_file*)proxy, eFileLock);\n      pFile->eFileLock = proxy->eFileLock;\n    }else{\n      /* conchHeld < 0 is lockless */\n    }\n  }\n  return rc;\n}\n\n/*\n** Close a file that uses proxy locks.\n*/\nstatic int proxyClose(sqlite3_file *id) {\n  if( ALWAYS(id) ){\n    unixFile *pFile = (unixFile*)id;\n    proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext;\n    unixFile *lockProxy = pCtx->lockProxy;\n    unixFile *conchFile = pCtx->conchFile;\n    int rc = SQLITE_OK;\n    \n    if( lockProxy ){\n      rc = lockProxy->pMethod->xUnlock((sqlite3_file*)lockProxy, NO_LOCK);\n      if( rc ) return rc;\n      rc = lockProxy->pMethod->xClose((sqlite3_file*)lockProxy);\n      if( rc ) return rc;\n      sqlite3_free(lockProxy);\n      pCtx->lockProxy = 0;\n    }\n    if( conchFile ){\n      if( pCtx->conchHeld ){\n        rc = proxyReleaseConch(pFile);\n        if( rc ) return rc;\n      }\n      rc = conchFile->pMethod->xClose((sqlite3_file*)conchFile);\n      if( rc ) return rc;\n      sqlite3_free(conchFile);\n    }\n    sqlite3DbFree(0, pCtx->lockProxyPath);\n    sqlite3_free(pCtx->conchFilePath);\n    sqlite3DbFree(0, pCtx->dbPath);\n    /* restore the original locking context and pMethod then close it */\n    pFile->lockingContext = pCtx->oldLockingContext;\n    pFile->pMethod = pCtx->pOldMethod;\n    sqlite3_free(pCtx);\n    return pFile->pMethod->xClose(id);\n  }\n  return SQLITE_OK;\n}\n\n\n\n#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */\n/*\n** The proxy locking style is intended for use with AFP filesystems.\n** And since AFP is only supported on MacOSX, the proxy locking is also\n** restricted to MacOSX.\n** \n**\n******************* End of the proxy lock implementation **********************\n******************************************************************************/\n\n/*\n** Initialize the operating system interface.\n**\n** This routine registers all VFS implementations for unix-like operating\n** systems.  This routine, and the sqlite3_os_end() routine that follows,\n** should be the only routines in this file that are visible from other\n** files.\n**\n** This routine is called once during SQLite initialization and by a\n** single thread.  The memory allocation and mutex subsystems have not\n** necessarily been initialized when this routine is called, and so they\n** should not be used.\n*/\nint sqlite3_os_init(void){ \n  /* \n  ** The following macro defines an initializer for an sqlite3_vfs object.\n  ** The name of the VFS is NAME.  The pAppData is a pointer to a pointer\n  ** to the \"finder\" function.  (pAppData is a pointer to a pointer because\n  ** silly C90 rules prohibit a void* from being cast to a function pointer\n  ** and so we have to go through the intermediate pointer to avoid problems\n  ** when compiling with -pedantic-errors on GCC.)\n  **\n  ** The FINDER parameter to this macro is the name of the pointer to the\n  ** finder-function.  The finder-function returns a pointer to the\n  ** sqlite_io_methods object that implements the desired locking\n  ** behaviors.  See the division above that contains the IOMETHODS\n  ** macro for addition information on finder-functions.\n  **\n  ** Most finders simply return a pointer to a fixed sqlite3_io_methods\n  ** object.  But the \"autolockIoFinder\" available on MacOSX does a little\n  ** more than that; it looks at the filesystem type that hosts the \n  ** database file and tries to choose an locking method appropriate for\n  ** that filesystem time.\n  */\n  #define UNIXVFS(VFSNAME, FINDER) {                        \\\n    3,                    /* iVersion */                    \\\n    sizeof(unixFile),     /* szOsFile */                    \\\n    MAX_PATHNAME,         /* mxPathname */                  \\\n    0,                    /* pNext */                       \\\n    VFSNAME,              /* zName */                       \\\n    (void*)&FINDER,       /* pAppData */                    \\\n    unixOpen,             /* xOpen */                       \\\n    unixDelete,           /* xDelete */                     \\\n    unixAccess,           /* xAccess */                     \\\n    unixFullPathname,     /* xFullPathname */               \\\n    unixDlOpen,           /* xDlOpen */                     \\\n    unixDlError,          /* xDlError */                    \\\n    unixDlSym,            /* xDlSym */                      \\\n    unixDlClose,          /* xDlClose */                    \\\n    unixRandomness,       /* xRandomness */                 \\\n    unixSleep,            /* xSleep */                      \\\n    unixCurrentTime,      /* xCurrentTime */                \\\n    unixGetLastError,     /* xGetLastError */               \\\n    unixCurrentTimeInt64, /* xCurrentTimeInt64 */           \\\n    unixSetSystemCall,    /* xSetSystemCall */              \\\n    unixGetSystemCall,    /* xGetSystemCall */              \\\n    unixNextSystemCall,   /* xNextSystemCall */             \\\n  }\n\n  /*\n  ** All default VFSes for unix are contained in the following array.\n  **\n  ** Note that the sqlite3_vfs.pNext field of the VFS object is modified\n  ** by the SQLite core when the VFS is registered.  So the following\n  ** array cannot be const.\n  */\n  static sqlite3_vfs aVfs[] = {\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\n    UNIXVFS(\"unix\",          autolockIoFinder ),\n#elif OS_VXWORKS\n    UNIXVFS(\"unix\",          vxworksIoFinder ),\n#else\n    UNIXVFS(\"unix\",          posixIoFinder ),\n#endif\n    UNIXVFS(\"unix-none\",     nolockIoFinder ),\n    UNIXVFS(\"unix-dotfile\",  dotlockIoFinder ),\n    UNIXVFS(\"unix-excl\",     posixIoFinder ),\n#if OS_VXWORKS\n    UNIXVFS(\"unix-namedsem\", semIoFinder ),\n#endif\n#if SQLITE_ENABLE_LOCKING_STYLE || OS_VXWORKS\n    UNIXVFS(\"unix-posix\",    posixIoFinder ),\n#endif\n#if SQLITE_ENABLE_LOCKING_STYLE\n    UNIXVFS(\"unix-flock\",    flockIoFinder ),\n#endif\n#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__)\n    UNIXVFS(\"unix-afp\",      afpIoFinder ),\n    UNIXVFS(\"unix-nfs\",      nfsIoFinder ),\n    UNIXVFS(\"unix-proxy\",    proxyIoFinder ),\n#endif\n  };\n  unsigned int i;          /* Loop counter */\n\n  /* Double-check that the aSyscall[] array has been constructed\n  ** correctly.  See ticket [bb3a86e890c8e96ab] */\n  assert( ArraySize(aSyscall)==28 );\n\n  /* Register all VFSes defined in the aVfs[] array */\n  for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){\n    sqlite3_vfs_register(&aVfs[i], i==0);\n  }\n  return SQLITE_OK; \n}\n\n/*\n** Shutdown the operating system interface.\n**\n** Some operating systems might need to do some cleanup in this routine,\n** to release dynamically allocated objects.  But not on unix.\n** This routine is a no-op for unix.\n*/\nint sqlite3_os_end(void){ \n  return SQLITE_OK; \n}\n\n#if SQLITE_WCDB_SIGNAL_RETRY\nQueue* WCDBInodeGetWaitQueue(unixInodeInfo* pInode)\n{\n  return &pInode->qWaitQueue;\n}\n\nsqlite3_condition* WCDBInodeGetCond(unixInodeInfo* pInode)\n{\n  return pInode->pCond;\n}\n\nint WCDBInodeGetShared(unixInodeInfo* pInode)\n{\n  return pInode->nShared;\n}\n\nunsigned char WCDBInodeGetFileLock(unixInodeInfo* pInode)\n{\n  return pInode->eFileLock;\n}\n\nQueue* WCDBShmNodeGetWaitQueue(unixShmNode* pShmNode)\n{\n  return &pShmNode->qWaitQueue;\n}\n\nsqlite3_condition* WCDBShmNodeGetCond(unixShmNode* pShmNode)\n{\n  return pShmNode->pCond;\n}\n\nunixShm* WCDBShmNodeGetShm(unixShmNode* pShmNode)\n{\n  return pShmNode->pFirst;\n}\n\nsqlite3_mutex* WCDBShmNodeGetMutex(unixShmNode* pShmNode)\n{\n  return pShmNode->mutex;\n}\n\nunixShm* WCDBShmGetNext(unixShm* pShm)\n{\n  return pShm->pNext;\n}\n\nu16 WCDBShmGetExclMask(unixShm* pShm)\n{\n  return pShm->exclMask;\n}\n\nu16 WCDBShmGetSharedMask(unixShm* pShm)\n{\n  return pShm->sharedMask;\n}\n\nunsigned char WCDBFileGetFileLock(unixFile* pFile)\n{\n  return pFile->eFileLock;\n}\n\nunixShm* WCDBFileGetShm(unixFile* pFile)\n{\n  return pFile->pShm;\n}\n\nint WCDBFileGetWait(unixFile* pFile)\n{\n  return pFile->bWait;\n}\n\nvoid WCDBFileSetWait(unixFile* pFile, int bFlag)\n{\n  pFile->bWait = bFlag;\n}\n\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n \n#endif /* SQLITE_OS_UNIX */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/os_wcdb.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n\n#include \"os_wcdb.h\"\n#include \"queue.h\"\n#include \"sqlite3.h\"\n#include \"sqliteInt.h\"\n#include \"os.h\"\n#include <sys/errno.h>\n\nQueue* WCDBInodeGetWaitQueue(unixInodeInfo* pInode);\nsqlite3_condition* WCDBInodeGetCond(unixInodeInfo* pInode);\nunsigned char WCDBInodeGetShared(unixInodeInfo* pInode);\nint WCDBInodeGetFileLock(unixInodeInfo* pInode);\n\nQueue* WCDBShmNodeGetWaitQueue(unixShmNode* pShmNode);\nsqlite3_condition* WCDBShmNodeGetCond(unixShmNode* pShmNode);\nunixShm* WCDBShmNodeGetShm(unixShmNode* pShmNode);\nsqlite3_mutex* WCDBShmNodeGetMutex(unixShmNode* pShmNode);\n\nunixShm* WCDBShmGetNext(unixShm* pShm);\nu16 WCDBShmGetExclMask(unixShm* pShm);\nu16 WCDBShmGetSharedMask(unixShm* pShm);\n\nunsigned char WCDBFileGetFileLock(unixFile* pFile);\nunixShm* WCDBFileGetShm(unixFile* pFile);\nint WCDBFileGetWait(unixFile* pFile);\nvoid WCDBFileSetWait(unixFile* pFile, int bFlag);\n\nvoid WCDBOsSignal(unixInodeInfo* pInode)\n{\n  WCDBWaitInfo* pWaitInfo = (WCDBWaitInfo*)sqlite3QueuePop(WCDBInodeGetWaitQueue(pInode));\n  if (pWaitInfo) {\n    pthreadCondSignal(WCDBInodeGetCond(pInode), pWaitInfo->pThread);\n    pthreadFree(pWaitInfo->pThread);\n    sqlite3_free(pWaitInfo);\n  }\n}\n\nvoid WCDBOsTrySignal(unixInodeInfo* pInode)\n{\n  int rc;\n  do {\n    rc = SQLITE_BUSY;\n    WCDBWaitInfo* pWaitInfo = (WCDBWaitInfo*)sqlite3QueueFront(WCDBInodeGetWaitQueue(pInode));\n    if (!pWaitInfo) {\n      break;\n    }\n    int eFlag = pWaitInfo->eFlag;\n    int eFileLock = pWaitInfo->eFileLock;\n    unixFile* pFile = pWaitInfo->pFile;\n    switch (eFlag) {\n      case SQLITE_WAIT_SHARED: {\n        rc = SQLITE_OK;\n        if( (WCDBFileGetFileLock(pFile)!=WCDBInodeGetFileLock(pInode) &&\n             (WCDBInodeGetFileLock(pInode)>=PENDING_LOCK || eFileLock>SHARED_LOCK)) ) {\n          rc = SQLITE_BUSY;\n        }\n        break;\n      }\n      case SQLITE_WAIT_EXCLUSIVE: {\n        rc = SQLITE_OK;\n        if( eFileLock==EXCLUSIVE_LOCK && WCDBInodeGetShared(pInode)>1 ) {\n          rc = SQLITE_BUSY;\n        }\n        break;\n      }\n      default:\n        break;\n    }\n    if (rc==SQLITE_OK) {\n      WCDBOsSignal(pInode);\n    }\n  } while (rc==SQLITE_OK);\n}\n\nvoid WCDBOsWait(unixInodeInfo* pInode, unixFile* pFile, int eFileLock, int eFlag)\n{\n  if (!WCDBFileGetWait(pFile)) {\n    return;\n  }\n  WCDBWaitInfo* lastInfo = (WCDBWaitInfo*)sqlite3QueueFront(WCDBInodeGetWaitQueue(pInode));\n  if (lastInfo) {\n    if ( (eFileLock==EXCLUSIVE_LOCK&&lastInfo->eFileLock>SHARED_LOCK)\n        || (lastInfo->eFileLock==EXCLUSIVE_LOCK&&eFileLock>SHARED_LOCK)) {\n      WCDBOsSignal(pInode);\n      return;\n    }\n  }\n  WCDBWaitInfo* info = (WCDBWaitInfo*)sqlite3_malloc(sizeof(WCDBWaitInfo));\n  info->eFlag = eFlag;\n  info->eFileLock = eFileLock;\n  info->pFile = pFile;\n  info->pThread = pthreadAlloc();\n  pthreadSelf(info->pThread);\n  if (pthreadIsMain()) {\n    sqlite3QueuePushFront(WCDBInodeGetWaitQueue(pInode), info);\n  }else {\n    sqlite3QueuePush(WCDBInodeGetWaitQueue(pInode), info);\n  }\n  if (pthreadCondWait(WCDBInodeGetCond(pInode), unixVFSMutex(), 10)==ETIMEDOUT) {\n    sqlite3_log(SQLITE_WARNING, \"Wait Failed With Timeout\");\n  }\n}\n\nvoid WCDBOsShmSignal(unixShmNode* pShmNode)\n{\n  WCDBShmWaitInfo* pInfo = (WCDBShmWaitInfo*)sqlite3QueuePop(WCDBShmNodeGetWaitQueue(pShmNode));\n  if (pInfo) {\n    pthreadCondSignal(WCDBShmNodeGetCond(pShmNode), pInfo->pThread);\n    pthreadFree(pInfo->pThread);\n    sqlite3_free(pInfo);\n  }\n}\n\nvoid WCDBOsShmTrySignal(unixShmNode* pShmNode){\n  int rc;\n  do {\n    rc = SQLITE_BUSY;\n    WCDBShmWaitInfo* pInfo = (WCDBShmWaitInfo*)sqlite3QueueFront(WCDBShmNodeGetWaitQueue(pShmNode));\n    if (!pInfo) {\n      break;\n    }\n    int eFlag = pInfo->eFlag;\n    int oMask = pInfo->oMask;\n    switch (eFlag) {\n      case SQLITE_SHM_SHARED: {\n        unixShm* pX;\n        rc = SQLITE_OK;\n        for(pX=WCDBShmNodeGetShm(pShmNode); pX; pX=WCDBShmGetNext(pX)){\n          if( (WCDBShmGetExclMask(pX) & oMask)!=0 ){\n            rc = SQLITE_BUSY;\n            break;\n          }\n        }\n        break;\n      }\n      case SQLITE_SHM_EXCLUSIVE: {\n        unixShm* pX;\n        rc = SQLITE_OK;\n        for(pX=WCDBShmNodeGetShm(pShmNode); pX; pX=WCDBShmGetNext(pX)){\n          if( (WCDBShmGetExclMask(pX) & oMask)!=0 || (WCDBShmGetSharedMask(pX) & oMask)!=0 ){\n            rc = SQLITE_BUSY;\n            break;\n          }\n        }\n        break;\n      }\n      default:\n        break;\n    }\n    if (rc==SQLITE_OK) {\n      WCDBOsShmSignal(pShmNode);\n    }\n  } while (rc==SQLITE_OK);\n}\n\nvoid WCDBOsShmWait(unixShmNode* pShmNode, unixFile* pFile, int oMask, int eFlag)\n{\n  if (!WCDBFileGetWait(pFile)) {\n    return;\n  }\n  WCDBShmWaitInfo* lastInfo = (WCDBShmWaitInfo*)sqlite3QueueFront(WCDBShmNodeGetWaitQueue(pShmNode));\n  if (lastInfo) {\n    if (lastInfo->eFlag==SQLITE_SHM_EXCLUSIVE\n        &&((WCDBShmGetExclMask(WCDBFileGetShm(pFile))&lastInfo->oMask)!=0\n           ||(WCDBShmGetSharedMask(WCDBFileGetShm(pFile))&lastInfo->oMask)!=0)) {\n          WCDBOsShmSignal(pShmNode);\n          return;\n        }\n    if (eFlag==SQLITE_SHM_EXCLUSIVE\n        &&((WCDBShmGetExclMask(WCDBFileGetShm(lastInfo->pFile))&oMask)!=0\n           ||(WCDBShmGetSharedMask(WCDBFileGetShm(lastInfo->pFile))&oMask)!=0)) {\n          WCDBOsShmSignal(pShmNode);\n          return;\n        }\n  }\n  \n  WCDBShmWaitInfo* info = (WCDBShmWaitInfo*)sqlite3_malloc(sizeof(WCDBShmWaitInfo));\n  info->eFlag = eFlag;\n  info->oMask = oMask;\n  info->pFile = pFile;\n  info->pThread = pthreadAlloc();\n  pthreadSelf(info->pThread);\n  if (pthreadIsMain()) {\n    sqlite3QueuePushFront(WCDBShmNodeGetWaitQueue(pShmNode), info);\n  }else {\n    sqlite3QueuePush(WCDBShmNodeGetWaitQueue(pShmNode), info);\n  }\n  if (pthreadCondWait(WCDBShmNodeGetCond(pShmNode), WCDBShmNodeGetMutex(pShmNode), 10)==ETIMEDOUT) {\n    sqlite3_log(SQLITE_WARNING, \"Wait Failed With Timeout\");\n  }\n}\n\nvoid WCDBOsFileSetWait(sqlite3_file* id, int bFlag)\n{\n  WCDBFileSetWait((unixFile*)id, bFlag);\n}\n\nint WCDBOsFileGetWait(sqlite3_file* id)\n{\n  return WCDBFileGetWait((unixFile*)id);\n}\n\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/os_wcdb.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef os_wcdb_h\n#define os_wcdb_h\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n\n#include \"mutex_wcdb.h\"\n\n#define SQLITE_WAIT_NONE 0\n#define SQLITE_WAIT_EXCLUSIVE 1\n#define SQLITE_WAIT_SHARED 2\n\ntypedef struct unixInodeInfo unixInodeInfo;\ntypedef struct unixFile unixFile;\n\ntypedef struct unixShmNode unixShmNode;\ntypedef struct unixShm unixShm;\n\ntypedef struct WCDBWaitInfo WCDBWaitInfo;\nstruct WCDBWaitInfo {\n  sqlite3_thread* pThread;\n  int eFileLock;\n  int eFlag;\n  unixFile* pFile;\n};\n\ntypedef struct WCDBShmWaitInfo WCDBShmWaitInfo;\nstruct WCDBShmWaitInfo {\n  sqlite3_thread* pThread;\n  int oMask;\n  int eFlag;\n  unixFile* pFile;\n};\n\nvoid WCDBOsSignal(unixInodeInfo* pInode);\nvoid WCDBOsTrySignal(unixInodeInfo* pInode);\nvoid WCDBOsWait(unixInodeInfo* pInode, unixFile* pFile, int eFileLock, int eFlag);\n\nvoid WCDBOsShmSignal(unixShmNode* pShmNode);\nvoid WCDBOsShmTrySignal(unixShmNode* pShmNode);\nvoid WCDBOsShmWait(unixShmNode* pShmNode, unixFile* pFile, int oMask, int eFlag);\n\nvoid WCDBOsFileSetWait(sqlite3_file* fd, int bFlag);\nint WCDBOsFileGetWait(sqlite3_file* fd);\n\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n#endif /* os_wcdb_h */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/pager.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This is the implementation of the page cache subsystem or \"pager\".\n** \n** The pager is used to access a database disk file.  It implements\n** atomic commit and rollback through the use of a journal file that\n** is separate from the database file.  The pager also implements file\n** locking to prevent two processes from writing the same database\n** file simultaneously, or one process from reading the database while\n** another is writing.\n*/\n#ifndef SQLITE_OMIT_DISKIO\n#include \"sqliteInt.h\"\n#include \"wal.h\"\n#if SQLITE_WCDB_SIGNAL_RETRY\n#include \"os_wcdb.h\"\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n\n/******************* NOTES ON THE DESIGN OF THE PAGER ************************\n**\n** This comment block describes invariants that hold when using a rollback\n** journal.  These invariants do not apply for journal_mode=WAL,\n** journal_mode=MEMORY, or journal_mode=OFF.\n**\n** Within this comment block, a page is deemed to have been synced\n** automatically as soon as it is written when PRAGMA synchronous=OFF.\n** Otherwise, the page is not synced until the xSync method of the VFS\n** is called successfully on the file containing the page.\n**\n** Definition:  A page of the database file is said to be \"overwriteable\" if\n** one or more of the following are true about the page:\n** \n**     (a)  The original content of the page as it was at the beginning of\n**          the transaction has been written into the rollback journal and\n**          synced.\n** \n**     (b)  The page was a freelist leaf page at the start of the transaction.\n** \n**     (c)  The page number is greater than the largest page that existed in\n**          the database file at the start of the transaction.\n** \n** (1) A page of the database file is never overwritten unless one of the\n**     following are true:\n** \n**     (a) The page and all other pages on the same sector are overwriteable.\n** \n**     (b) The atomic page write optimization is enabled, and the entire\n**         transaction other than the update of the transaction sequence\n**         number consists of a single page change.\n** \n** (2) The content of a page written into the rollback journal exactly matches\n**     both the content in the database when the rollback journal was written\n**     and the content in the database at the beginning of the current\n**     transaction.\n** \n** (3) Writes to the database file are an integer multiple of the page size\n**     in length and are aligned on a page boundary.\n** \n** (4) Reads from the database file are either aligned on a page boundary and\n**     an integer multiple of the page size in length or are taken from the\n**     first 100 bytes of the database file.\n** \n** (5) All writes to the database file are synced prior to the rollback journal\n**     being deleted, truncated, or zeroed.\n** \n** (6) If a master journal file is used, then all writes to the database file\n**     are synced prior to the master journal being deleted.\n** \n** Definition: Two databases (or the same database at two points it time)\n** are said to be \"logically equivalent\" if they give the same answer to\n** all queries.  Note in particular the content of freelist leaf\n** pages can be changed arbitrarily without affecting the logical equivalence\n** of the database.\n** \n** (7) At any time, if any subset, including the empty set and the total set,\n**     of the unsynced changes to a rollback journal are removed and the \n**     journal is rolled back, the resulting database file will be logically\n**     equivalent to the database file at the beginning of the transaction.\n** \n** (8) When a transaction is rolled back, the xTruncate method of the VFS\n**     is called to restore the database file to the same size it was at\n**     the beginning of the transaction.  (In some VFSes, the xTruncate\n**     method is a no-op, but that does not change the fact the SQLite will\n**     invoke it.)\n** \n** (9) Whenever the database file is modified, at least one bit in the range\n**     of bytes from 24 through 39 inclusive will be changed prior to releasing\n**     the EXCLUSIVE lock, thus signaling other connections on the same\n**     database to flush their caches.\n**\n** (10) The pattern of bits in bytes 24 through 39 shall not repeat in less\n**      than one billion transactions.\n**\n** (11) A database file is well-formed at the beginning and at the conclusion\n**      of every transaction.\n**\n** (12) An EXCLUSIVE lock is held on the database file when writing to\n**      the database file.\n**\n** (13) A SHARED lock is held on the database file while reading any\n**      content out of the database file.\n**\n******************************************************************************/\n\n/*\n** Macros for troubleshooting.  Normally turned off\n*/\n#if 0\nint sqlite3PagerTrace=1;  /* True to enable tracing */\n#define sqlite3DebugPrintf printf\n#define PAGERTRACE(X)     if( sqlite3PagerTrace ){ sqlite3DebugPrintf X; }\n#else\n#define PAGERTRACE(X)\n#endif\n\n/*\n** The following two macros are used within the PAGERTRACE() macros above\n** to print out file-descriptors. \n**\n** PAGERID() takes a pointer to a Pager struct as its argument. The\n** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file\n** struct as its argument.\n*/\n#define PAGERID(p) ((int)(p->fd))\n#define FILEHANDLEID(fd) ((int)fd)\n\n/*\n** The Pager.eState variable stores the current 'state' of a pager. A\n** pager may be in any one of the seven states shown in the following\n** state diagram.\n**\n**                            OPEN <------+------+\n**                              |         |      |\n**                              V         |      |\n**               +---------> READER-------+      |\n**               |              |                |\n**               |              V                |\n**               |<-------WRITER_LOCKED------> ERROR\n**               |              |                ^  \n**               |              V                |\n**               |<------WRITER_CACHEMOD-------->|\n**               |              |                |\n**               |              V                |\n**               |<-------WRITER_DBMOD---------->|\n**               |              |                |\n**               |              V                |\n**               +<------WRITER_FINISHED-------->+\n**\n**\n** List of state transitions and the C [function] that performs each:\n** \n**   OPEN              -> READER              [sqlite3PagerSharedLock]\n**   READER            -> OPEN                [pager_unlock]\n**\n**   READER            -> WRITER_LOCKED       [sqlite3PagerBegin]\n**   WRITER_LOCKED     -> WRITER_CACHEMOD     [pager_open_journal]\n**   WRITER_CACHEMOD   -> WRITER_DBMOD        [syncJournal]\n**   WRITER_DBMOD      -> WRITER_FINISHED     [sqlite3PagerCommitPhaseOne]\n**   WRITER_***        -> READER              [pager_end_transaction]\n**\n**   WRITER_***        -> ERROR               [pager_error]\n**   ERROR             -> OPEN                [pager_unlock]\n** \n**\n**  OPEN:\n**\n**    The pager starts up in this state. Nothing is guaranteed in this\n**    state - the file may or may not be locked and the database size is\n**    unknown. The database may not be read or written.\n**\n**    * No read or write transaction is active.\n**    * Any lock, or no lock at all, may be held on the database file.\n**    * The dbSize, dbOrigSize and dbFileSize variables may not be trusted.\n**\n**  READER:\n**\n**    In this state all the requirements for reading the database in \n**    rollback (non-WAL) mode are met. Unless the pager is (or recently\n**    was) in exclusive-locking mode, a user-level read transaction is \n**    open. The database size is known in this state.\n**\n**    A connection running with locking_mode=normal enters this state when\n**    it opens a read-transaction on the database and returns to state\n**    OPEN after the read-transaction is completed. However a connection\n**    running in locking_mode=exclusive (including temp databases) remains in\n**    this state even after the read-transaction is closed. The only way\n**    a locking_mode=exclusive connection can transition from READER to OPEN\n**    is via the ERROR state (see below).\n** \n**    * A read transaction may be active (but a write-transaction cannot).\n**    * A SHARED or greater lock is held on the database file.\n**    * The dbSize variable may be trusted (even if a user-level read \n**      transaction is not active). The dbOrigSize and dbFileSize variables\n**      may not be trusted at this point.\n**    * If the database is a WAL database, then the WAL connection is open.\n**    * Even if a read-transaction is not open, it is guaranteed that \n**      there is no hot-journal in the file-system.\n**\n**  WRITER_LOCKED:\n**\n**    The pager moves to this state from READER when a write-transaction\n**    is first opened on the database. In WRITER_LOCKED state, all locks \n**    required to start a write-transaction are held, but no actual \n**    modifications to the cache or database have taken place.\n**\n**    In rollback mode, a RESERVED or (if the transaction was opened with \n**    BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when\n**    moving to this state, but the journal file is not written to or opened \n**    to in this state. If the transaction is committed or rolled back while \n**    in WRITER_LOCKED state, all that is required is to unlock the database \n**    file.\n**\n**    IN WAL mode, WalBeginWriteTransaction() is called to lock the log file.\n**    If the connection is running with locking_mode=exclusive, an attempt\n**    is made to obtain an EXCLUSIVE lock on the database file.\n**\n**    * A write transaction is active.\n**    * If the connection is open in rollback-mode, a RESERVED or greater \n**      lock is held on the database file.\n**    * If the connection is open in WAL-mode, a WAL write transaction\n**      is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully\n**      called).\n**    * The dbSize, dbOrigSize and dbFileSize variables are all valid.\n**    * The contents of the pager cache have not been modified.\n**    * The journal file may or may not be open.\n**    * Nothing (not even the first header) has been written to the journal.\n**\n**  WRITER_CACHEMOD:\n**\n**    A pager moves from WRITER_LOCKED state to this state when a page is\n**    first modified by the upper layer. In rollback mode the journal file\n**    is opened (if it is not already open) and a header written to the\n**    start of it. The database file on disk has not been modified.\n**\n**    * A write transaction is active.\n**    * A RESERVED or greater lock is held on the database file.\n**    * The journal file is open and the first header has been written \n**      to it, but the header has not been synced to disk.\n**    * The contents of the page cache have been modified.\n**\n**  WRITER_DBMOD:\n**\n**    The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state\n**    when it modifies the contents of the database file. WAL connections\n**    never enter this state (since they do not modify the database file,\n**    just the log file).\n**\n**    * A write transaction is active.\n**    * An EXCLUSIVE or greater lock is held on the database file.\n**    * The journal file is open and the first header has been written \n**      and synced to disk.\n**    * The contents of the page cache have been modified (and possibly\n**      written to disk).\n**\n**  WRITER_FINISHED:\n**\n**    It is not possible for a WAL connection to enter this state.\n**\n**    A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD\n**    state after the entire transaction has been successfully written into the\n**    database file. In this state the transaction may be committed simply\n**    by finalizing the journal file. Once in WRITER_FINISHED state, it is \n**    not possible to modify the database further. At this point, the upper \n**    layer must either commit or rollback the transaction.\n**\n**    * A write transaction is active.\n**    * An EXCLUSIVE or greater lock is held on the database file.\n**    * All writing and syncing of journal and database data has finished.\n**      If no error occurred, all that remains is to finalize the journal to\n**      commit the transaction. If an error did occur, the caller will need\n**      to rollback the transaction. \n**\n**  ERROR:\n**\n**    The ERROR state is entered when an IO or disk-full error (including\n**    SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it \n**    difficult to be sure that the in-memory pager state (cache contents, \n**    db size etc.) are consistent with the contents of the file-system.\n**\n**    Temporary pager files may enter the ERROR state, but in-memory pagers\n**    cannot.\n**\n**    For example, if an IO error occurs while performing a rollback, \n**    the contents of the page-cache may be left in an inconsistent state.\n**    At this point it would be dangerous to change back to READER state\n**    (as usually happens after a rollback). Any subsequent readers might\n**    report database corruption (due to the inconsistent cache), and if\n**    they upgrade to writers, they may inadvertently corrupt the database\n**    file. To avoid this hazard, the pager switches into the ERROR state\n**    instead of READER following such an error.\n**\n**    Once it has entered the ERROR state, any attempt to use the pager\n**    to read or write data returns an error. Eventually, once all \n**    outstanding transactions have been abandoned, the pager is able to\n**    transition back to OPEN state, discarding the contents of the \n**    page-cache and any other in-memory state at the same time. Everything\n**    is reloaded from disk (and, if necessary, hot-journal rollback peformed)\n**    when a read-transaction is next opened on the pager (transitioning\n**    the pager into READER state). At that point the system has recovered \n**    from the error.\n**\n**    Specifically, the pager jumps into the ERROR state if:\n**\n**      1. An error occurs while attempting a rollback. This happens in\n**         function sqlite3PagerRollback().\n**\n**      2. An error occurs while attempting to finalize a journal file\n**         following a commit in function sqlite3PagerCommitPhaseTwo().\n**\n**      3. An error occurs while attempting to write to the journal or\n**         database file in function pagerStress() in order to free up\n**         memory.\n**\n**    In other cases, the error is returned to the b-tree layer. The b-tree\n**    layer then attempts a rollback operation. If the error condition \n**    persists, the pager enters the ERROR state via condition (1) above.\n**\n**    Condition (3) is necessary because it can be triggered by a read-only\n**    statement executed within a transaction. In this case, if the error\n**    code were simply returned to the user, the b-tree layer would not\n**    automatically attempt a rollback, as it assumes that an error in a\n**    read-only statement cannot leave the pager in an internally inconsistent \n**    state.\n**\n**    * The Pager.errCode variable is set to something other than SQLITE_OK.\n**    * There are one or more outstanding references to pages (after the\n**      last reference is dropped the pager should move back to OPEN state).\n**    * The pager is not an in-memory pager.\n**    \n**\n** Notes:\n**\n**   * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the\n**     connection is open in WAL mode. A WAL connection is always in one\n**     of the first four states.\n**\n**   * Normally, a connection open in exclusive mode is never in PAGER_OPEN\n**     state. There are two exceptions: immediately after exclusive-mode has\n**     been turned on (and before any read or write transactions are \n**     executed), and when the pager is leaving the \"error state\".\n**\n**   * See also: assert_pager_state().\n*/\n#define PAGER_OPEN                  0\n#define PAGER_READER                1\n#define PAGER_WRITER_LOCKED         2\n#define PAGER_WRITER_CACHEMOD       3\n#define PAGER_WRITER_DBMOD          4\n#define PAGER_WRITER_FINISHED       5\n#define PAGER_ERROR                 6\n\n/*\n** The Pager.eLock variable is almost always set to one of the \n** following locking-states, according to the lock currently held on\n** the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK.\n** This variable is kept up to date as locks are taken and released by\n** the pagerLockDb() and pagerUnlockDb() wrappers.\n**\n** If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY\n** (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not\n** the operation was successful. In these circumstances pagerLockDb() and\n** pagerUnlockDb() take a conservative approach - eLock is always updated\n** when unlocking the file, and only updated when locking the file if the\n** VFS call is successful. This way, the Pager.eLock variable may be set\n** to a less exclusive (lower) value than the lock that is actually held\n** at the system level, but it is never set to a more exclusive value.\n**\n** This is usually safe. If an xUnlock fails or appears to fail, there may \n** be a few redundant xLock() calls or a lock may be held for longer than\n** required, but nothing really goes wrong.\n**\n** The exception is when the database file is unlocked as the pager moves\n** from ERROR to OPEN state. At this point there may be a hot-journal file \n** in the file-system that needs to be rolled back (as part of an OPEN->SHARED\n** transition, by the same pager or any other). If the call to xUnlock()\n** fails at this point and the pager is left holding an EXCLUSIVE lock, this\n** can confuse the call to xCheckReservedLock() call made later as part\n** of hot-journal detection.\n**\n** xCheckReservedLock() is defined as returning true \"if there is a RESERVED \n** lock held by this process or any others\". So xCheckReservedLock may \n** return true because the caller itself is holding an EXCLUSIVE lock (but\n** doesn't know it because of a previous error in xUnlock). If this happens\n** a hot-journal may be mistaken for a journal being created by an active\n** transaction in another process, causing SQLite to read from the database\n** without rolling it back.\n**\n** To work around this, if a call to xUnlock() fails when unlocking the\n** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It\n** is only changed back to a real locking state after a successful call\n** to xLock(EXCLUSIVE). Also, the code to do the OPEN->SHARED state transition\n** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK \n** lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE\n** lock on the database file before attempting to roll it back. See function\n** PagerSharedLock() for more detail.\n**\n** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in \n** PAGER_OPEN state.\n*/\n#define UNKNOWN_LOCK                (EXCLUSIVE_LOCK+1)\n\n/*\n** A macro used for invoking the codec if there is one\n*/\n#ifdef SQLITE_HAS_CODEC\n# define CODEC1(P,D,N,X,E) \\\n    if( P->xCodec && P->xCodec(P->pCodec,D,N,X)==0 ){ E; }\n# define CODEC2(P,D,N,X,E,O) \\\n    if( P->xCodec==0 ){ O=(char*)D; }else \\\n    if( (O=(char*)(P->xCodec(P->pCodec,D,N,X)))==0 ){ E; }\n#else\n# define CODEC1(P,D,N,X,E)   /* NO-OP */\n# define CODEC2(P,D,N,X,E,O) O=(char*)D\n#endif\n\n/*\n** The maximum allowed sector size. 64KiB. If the xSectorsize() method \n** returns a value larger than this, then MAX_SECTOR_SIZE is used instead.\n** This could conceivably cause corruption following a power failure on\n** such a system. This is currently an undocumented limit.\n*/\n#define MAX_SECTOR_SIZE 0x10000\n\n\n/*\n** An instance of the following structure is allocated for each active\n** savepoint and statement transaction in the system. All such structures\n** are stored in the Pager.aSavepoint[] array, which is allocated and\n** resized using sqlite3Realloc().\n**\n** When a savepoint is created, the PagerSavepoint.iHdrOffset field is\n** set to 0. If a journal-header is written into the main journal while\n** the savepoint is active, then iHdrOffset is set to the byte offset \n** immediately following the last journal record written into the main\n** journal before the journal-header. This is required during savepoint\n** rollback (see pagerPlaybackSavepoint()).\n*/\ntypedef struct PagerSavepoint PagerSavepoint;\nstruct PagerSavepoint {\n  i64 iOffset;                 /* Starting offset in main journal */\n  i64 iHdrOffset;              /* See above */\n  Bitvec *pInSavepoint;        /* Set of pages in this savepoint */\n  Pgno nOrig;                  /* Original number of pages in file */\n  Pgno iSubRec;                /* Index of first record in sub-journal */\n#ifndef SQLITE_OMIT_WAL\n  u32 aWalData[WAL_SAVEPOINT_NDATA];        /* WAL savepoint context */\n#endif\n};\n\n/*\n** Bits of the Pager.doNotSpill flag.  See further description below.\n*/\n#define SPILLFLAG_OFF         0x01 /* Never spill cache.  Set via pragma */\n#define SPILLFLAG_ROLLBACK    0x02 /* Current rolling back, so do not spill */\n#define SPILLFLAG_NOSYNC      0x04 /* Spill is ok, but do not sync */\n\n/*\n** An open page cache is an instance of struct Pager. A description of\n** some of the more important member variables follows:\n**\n** eState\n**\n**   The current 'state' of the pager object. See the comment and state\n**   diagram above for a description of the pager state.\n**\n** eLock\n**\n**   For a real on-disk database, the current lock held on the database file -\n**   NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK.\n**\n**   For a temporary or in-memory database (neither of which require any\n**   locks), this variable is always set to EXCLUSIVE_LOCK. Since such\n**   databases always have Pager.exclusiveMode==1, this tricks the pager\n**   logic into thinking that it already has all the locks it will ever\n**   need (and no reason to release them).\n**\n**   In some (obscure) circumstances, this variable may also be set to\n**   UNKNOWN_LOCK. See the comment above the #define of UNKNOWN_LOCK for\n**   details.\n**\n** changeCountDone\n**\n**   This boolean variable is used to make sure that the change-counter \n**   (the 4-byte header field at byte offset 24 of the database file) is \n**   not updated more often than necessary. \n**\n**   It is set to true when the change-counter field is updated, which \n**   can only happen if an exclusive lock is held on the database file.\n**   It is cleared (set to false) whenever an exclusive lock is \n**   relinquished on the database file. Each time a transaction is committed,\n**   The changeCountDone flag is inspected. If it is true, the work of\n**   updating the change-counter is omitted for the current transaction.\n**\n**   This mechanism means that when running in exclusive mode, a connection \n**   need only update the change-counter once, for the first transaction\n**   committed.\n**\n** setMaster\n**\n**   When PagerCommitPhaseOne() is called to commit a transaction, it may\n**   (or may not) specify a master-journal name to be written into the \n**   journal file before it is synced to disk.\n**\n**   Whether or not a journal file contains a master-journal pointer affects \n**   the way in which the journal file is finalized after the transaction is \n**   committed or rolled back when running in \"journal_mode=PERSIST\" mode.\n**   If a journal file does not contain a master-journal pointer, it is\n**   finalized by overwriting the first journal header with zeroes. If\n**   it does contain a master-journal pointer the journal file is finalized \n**   by truncating it to zero bytes, just as if the connection were \n**   running in \"journal_mode=truncate\" mode.\n**\n**   Journal files that contain master journal pointers cannot be finalized\n**   simply by overwriting the first journal-header with zeroes, as the\n**   master journal pointer could interfere with hot-journal rollback of any\n**   subsequently interrupted transaction that reuses the journal file.\n**\n**   The flag is cleared as soon as the journal file is finalized (either\n**   by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the\n**   journal file from being successfully finalized, the setMaster flag\n**   is cleared anyway (and the pager will move to ERROR state).\n**\n** doNotSpill\n**\n**   This variables control the behavior of cache-spills  (calls made by\n**   the pcache module to the pagerStress() routine to write cached data\n**   to the file-system in order to free up memory).\n**\n**   When bits SPILLFLAG_OFF or SPILLFLAG_ROLLBACK of doNotSpill are set,\n**   writing to the database from pagerStress() is disabled altogether.\n**   The SPILLFLAG_ROLLBACK case is done in a very obscure case that\n**   comes up during savepoint rollback that requires the pcache module\n**   to allocate a new page to prevent the journal file from being written\n**   while it is being traversed by code in pager_playback().  The SPILLFLAG_OFF\n**   case is a user preference.\n** \n**   If the SPILLFLAG_NOSYNC bit is set, writing to the database from\n**   pagerStress() is permitted, but syncing the journal file is not.\n**   This flag is set by sqlite3PagerWrite() when the file-system sector-size\n**   is larger than the database page-size in order to prevent a journal sync\n**   from happening in between the journalling of two pages on the same sector. \n**\n** subjInMemory\n**\n**   This is a boolean variable. If true, then any required sub-journal\n**   is opened as an in-memory journal file. If false, then in-memory\n**   sub-journals are only used for in-memory pager files.\n**\n**   This variable is updated by the upper layer each time a new \n**   write-transaction is opened.\n**\n** dbSize, dbOrigSize, dbFileSize\n**\n**   Variable dbSize is set to the number of pages in the database file.\n**   It is valid in PAGER_READER and higher states (all states except for\n**   OPEN and ERROR). \n**\n**   dbSize is set based on the size of the database file, which may be \n**   larger than the size of the database (the value stored at offset\n**   28 of the database header by the btree). If the size of the file\n**   is not an integer multiple of the page-size, the value stored in\n**   dbSize is rounded down (i.e. a 5KB file with 2K page-size has dbSize==2).\n**   Except, any file that is greater than 0 bytes in size is considered\n**   to have at least one page. (i.e. a 1KB file with 2K page-size leads\n**   to dbSize==1).\n**\n**   During a write-transaction, if pages with page-numbers greater than\n**   dbSize are modified in the cache, dbSize is updated accordingly.\n**   Similarly, if the database is truncated using PagerTruncateImage(), \n**   dbSize is updated.\n**\n**   Variables dbOrigSize and dbFileSize are valid in states \n**   PAGER_WRITER_LOCKED and higher. dbOrigSize is a copy of the dbSize\n**   variable at the start of the transaction. It is used during rollback,\n**   and to determine whether or not pages need to be journalled before\n**   being modified.\n**\n**   Throughout a write-transaction, dbFileSize contains the size of\n**   the file on disk in pages. It is set to a copy of dbSize when the\n**   write-transaction is first opened, and updated when VFS calls are made\n**   to write or truncate the database file on disk. \n**\n**   The only reason the dbFileSize variable is required is to suppress \n**   unnecessary calls to xTruncate() after committing a transaction. If, \n**   when a transaction is committed, the dbFileSize variable indicates \n**   that the database file is larger than the database image (Pager.dbSize), \n**   pager_truncate() is called. The pager_truncate() call uses xFilesize()\n**   to measure the database file on disk, and then truncates it if required.\n**   dbFileSize is not used when rolling back a transaction. In this case\n**   pager_truncate() is called unconditionally (which means there may be\n**   a call to xFilesize() that is not strictly required). In either case,\n**   pager_truncate() may cause the file to become smaller or larger.\n**\n** dbHintSize\n**\n**   The dbHintSize variable is used to limit the number of calls made to\n**   the VFS xFileControl(FCNTL_SIZE_HINT) method. \n**\n**   dbHintSize is set to a copy of the dbSize variable when a\n**   write-transaction is opened (at the same time as dbFileSize and\n**   dbOrigSize). If the xFileControl(FCNTL_SIZE_HINT) method is called,\n**   dbHintSize is increased to the number of pages that correspond to the\n**   size-hint passed to the method call. See pager_write_pagelist() for \n**   details.\n**\n** errCode\n**\n**   The Pager.errCode variable is only ever used in PAGER_ERROR state. It\n**   is set to zero in all other states. In PAGER_ERROR state, Pager.errCode \n**   is always set to SQLITE_FULL, SQLITE_IOERR or one of the SQLITE_IOERR_XXX \n**   sub-codes.\n*/\nstruct Pager {\n  sqlite3_vfs *pVfs;          /* OS functions to use for IO */\n  u8 exclusiveMode;           /* Boolean. True if locking_mode==EXCLUSIVE */\n  u8 journalMode;             /* One of the PAGER_JOURNALMODE_* values */\n  u8 useJournal;              /* Use a rollback journal on this file */\n  u8 noSync;                  /* Do not sync the journal if true */\n  u8 fullSync;                /* Do extra syncs of the journal for robustness */\n  u8 extraSync;               /* sync directory after journal delete */\n  u8 ckptSyncFlags;           /* SYNC_NORMAL or SYNC_FULL for checkpoint */\n  u8 walSyncFlags;            /* SYNC_NORMAL or SYNC_FULL for wal writes */\n  u8 syncFlags;               /* SYNC_NORMAL or SYNC_FULL otherwise */\n  u8 tempFile;                /* zFilename is a temporary or immutable file */\n  u8 noLock;                  /* Do not lock (except in WAL mode) */\n  u8 readOnly;                /* True for a read-only database */\n  u8 memDb;                   /* True to inhibit all file I/O */\n\n  /**************************************************************************\n  ** The following block contains those class members that change during\n  ** routine operation.  Class members not in this block are either fixed\n  ** when the pager is first created or else only change when there is a\n  ** significant mode change (such as changing the page_size, locking_mode,\n  ** or the journal_mode).  From another view, these class members describe\n  ** the \"state\" of the pager, while other class members describe the\n  ** \"configuration\" of the pager.\n  */\n  u8 eState;                  /* Pager state (OPEN, READER, WRITER_LOCKED..) */\n  u8 eLock;                   /* Current lock held on database file */\n  u8 changeCountDone;         /* Set after incrementing the change-counter */\n  u8 setMaster;               /* True if a m-j name has been written to jrnl */\n  u8 doNotSpill;              /* Do not spill the cache when non-zero */\n  u8 subjInMemory;            /* True to use in-memory sub-journals */\n  u8 bUseFetch;               /* True to use xFetch() */\n  u8 hasHeldSharedLock;       /* True if a shared lock has ever been held */\n  Pgno dbSize;                /* Number of pages in the database */\n  Pgno dbOrigSize;            /* dbSize before the current transaction */\n  Pgno dbFileSize;            /* Number of pages in the database file */\n  Pgno dbHintSize;            /* Value passed to FCNTL_SIZE_HINT call */\n  int errCode;                /* One of several kinds of errors */\n  int nRec;                   /* Pages journalled since last j-header written */\n  u32 cksumInit;              /* Quasi-random value added to every checksum */\n  u32 nSubRec;                /* Number of records written to sub-journal */\n  Bitvec *pInJournal;         /* One bit for each page in the database file */\n  sqlite3_file *fd;           /* File descriptor for database */\n  sqlite3_file *jfd;          /* File descriptor for main journal */\n  sqlite3_file *sjfd;         /* File descriptor for sub-journal */\n  i64 journalOff;             /* Current write offset in the journal file */\n  i64 journalHdr;             /* Byte offset to previous journal header */\n  sqlite3_backup *pBackup;    /* Pointer to list of ongoing backup processes */\n  PagerSavepoint *aSavepoint; /* Array of active savepoints */\n  int nSavepoint;             /* Number of elements in aSavepoint[] */\n  u32 iDataVersion;           /* Changes whenever database content changes */\n  char dbFileVers[16];        /* Changes whenever database file changes */\n\n  int nMmapOut;               /* Number of mmap pages currently outstanding */\n  sqlite3_int64 szMmap;       /* Desired maximum mmap size */\n  PgHdr *pMmapFreelist;       /* List of free mmap page headers (pDirty) */\n  /*\n  ** End of the routinely-changing class members\n  ***************************************************************************/\n\n  u16 nExtra;                 /* Add this many bytes to each in-memory page */\n  i16 nReserve;               /* Number of unused bytes at end of each page */\n  u32 vfsFlags;               /* Flags for sqlite3_vfs.xOpen() */\n  u32 sectorSize;             /* Assumed sector size during rollback */\n  int pageSize;               /* Number of bytes in a page */\n  Pgno mxPgno;                /* Maximum allowed size of the database */\n  i64 journalSizeLimit;       /* Size limit for persistent journal files */\n  char *zFilename;            /* Name of the database file */\n  char *zJournal;             /* Name of the journal file */\n  int (*xBusyHandler)(void*); /* Function to call when busy */\n  void *pBusyHandlerArg;      /* Context argument for xBusyHandler */\n  int aStat[3];               /* Total cache hits, misses and writes */\n#ifdef SQLITE_TEST\n  int nRead;                  /* Database pages read */\n#endif\n  void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */\n#ifdef SQLITE_HAS_CODEC\n  void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */\n  void (*xCodecSizeChng)(void*,int,int); /* Notify of page size changes */\n  void (*xCodecFree)(void*);             /* Destructor for the codec */\n  void *pCodec;               /* First argument to xCodec... methods */\n#endif\n  char *pTmpSpace;            /* Pager.pageSize bytes of space for tmp use */\n  PCache *pPCache;            /* Pointer to page cache object */\n#ifndef SQLITE_OMIT_WAL\n  Wal *pWal;                  /* Write-ahead log used by \"journal_mode=wal\" */\n  char *zWal;                 /* File name for write-ahead log */\n#endif\n};\n\n/*\n** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains\n** the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS \n** or CACHE_WRITE to sqlite3_db_status().\n*/\n#define PAGER_STAT_HIT   0\n#define PAGER_STAT_MISS  1\n#define PAGER_STAT_WRITE 2\n\n/*\n** The following global variables hold counters used for\n** testing purposes only.  These variables do not exist in\n** a non-testing build.  These variables are not thread-safe.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_pager_readdb_count = 0;    /* Number of full pages read from DB */\nint sqlite3_pager_writedb_count = 0;   /* Number of full pages written to DB */\nint sqlite3_pager_writej_count = 0;    /* Number of pages written to journal */\n# define PAGER_INCR(v)  v++\n#else\n# define PAGER_INCR(v)\n#endif\n\n\n\n/*\n** Journal files begin with the following magic string.  The data\n** was obtained from /dev/random.  It is used only as a sanity check.\n**\n** Since version 2.8.0, the journal format contains additional sanity\n** checking information.  If the power fails while the journal is being\n** written, semi-random garbage data might appear in the journal\n** file after power is restored.  If an attempt is then made\n** to roll the journal back, the database could be corrupted.  The additional\n** sanity checking data is an attempt to discover the garbage in the\n** journal and ignore it.\n**\n** The sanity checking information for the new journal format consists\n** of a 32-bit checksum on each page of data.  The checksum covers both\n** the page number and the pPager->pageSize bytes of data for the page.\n** This cksum is initialized to a 32-bit random value that appears in the\n** journal file right after the header.  The random initializer is important,\n** because garbage data that appears at the end of a journal is likely\n** data that was once in other files that have now been deleted.  If the\n** garbage data came from an obsolete journal file, the checksums might\n** be correct.  But by initializing the checksum to random value which\n** is different for every journal, we minimize that risk.\n*/\nstatic const unsigned char aJournalMagic[] = {\n  0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd7,\n};\n\n/*\n** The size of the of each page record in the journal is given by\n** the following macro.\n*/\n#define JOURNAL_PG_SZ(pPager)  ((pPager->pageSize) + 8)\n\n/*\n** The journal header size for this pager. This is usually the same \n** size as a single disk sector. See also setSectorSize().\n*/\n#define JOURNAL_HDR_SZ(pPager) (pPager->sectorSize)\n\n/*\n** The macro MEMDB is true if we are dealing with an in-memory database.\n** We do this as a macro so that if the SQLITE_OMIT_MEMORYDB macro is set,\n** the value of MEMDB will be a constant and the compiler will optimize\n** out code that would never execute.\n*/\n#ifdef SQLITE_OMIT_MEMORYDB\n# define MEMDB 0\n#else\n# define MEMDB pPager->memDb\n#endif\n\n/*\n** The macro USEFETCH is true if we are allowed to use the xFetch and xUnfetch\n** interfaces to access the database using memory-mapped I/O.\n*/\n#if SQLITE_MAX_MMAP_SIZE>0\n# define USEFETCH(x) ((x)->bUseFetch)\n#else\n# define USEFETCH(x) 0\n#endif\n\n/*\n** The maximum legal page number is (2^31 - 1).\n*/\n#define PAGER_MAX_PGNO 2147483647\n\n/*\n** The argument to this macro is a file descriptor (type sqlite3_file*).\n** Return 0 if it is not open, or non-zero (but not 1) if it is.\n**\n** This is so that expressions can be written as:\n**\n**   if( isOpen(pPager->jfd) ){ ...\n**\n** instead of\n**\n**   if( pPager->jfd->pMethods ){ ...\n*/\n#define isOpen(pFd) ((pFd)->pMethods!=0)\n\n/*\n** Return true if this pager uses a write-ahead log instead of the usual\n** rollback journal. Otherwise false.\n*/\n#ifndef SQLITE_OMIT_WAL\nint sqlite3PagerUseWal(Pager *pPager){\n  return (pPager->pWal!=0);\n}\n# define pagerUseWal(x) sqlite3PagerUseWal(x)\n#else\n# define pagerUseWal(x) 0\n# define pagerRollbackWal(x) 0\n# define pagerWalFrames(v,w,x,y) 0\n# define pagerOpenWalIfPresent(z) SQLITE_OK\n# define pagerBeginReadTransaction(z) SQLITE_OK\n#endif\n\n#ifndef NDEBUG \n/*\n** Usage:\n**\n**   assert( assert_pager_state(pPager) );\n**\n** This function runs many asserts to try to find inconsistencies in\n** the internal state of the Pager object.\n*/\nstatic int assert_pager_state(Pager *p){\n  Pager *pPager = p;\n\n  /* State must be valid. */\n  assert( p->eState==PAGER_OPEN\n       || p->eState==PAGER_READER\n       || p->eState==PAGER_WRITER_LOCKED\n       || p->eState==PAGER_WRITER_CACHEMOD\n       || p->eState==PAGER_WRITER_DBMOD\n       || p->eState==PAGER_WRITER_FINISHED\n       || p->eState==PAGER_ERROR\n  );\n\n  /* Regardless of the current state, a temp-file connection always behaves\n  ** as if it has an exclusive lock on the database file. It never updates\n  ** the change-counter field, so the changeCountDone flag is always set.\n  */\n  assert( p->tempFile==0 || p->eLock==EXCLUSIVE_LOCK );\n  assert( p->tempFile==0 || pPager->changeCountDone );\n\n  /* If the useJournal flag is clear, the journal-mode must be \"OFF\". \n  ** And if the journal-mode is \"OFF\", the journal file must not be open.\n  */\n  assert( p->journalMode==PAGER_JOURNALMODE_OFF || p->useJournal );\n  assert( p->journalMode!=PAGER_JOURNALMODE_OFF || !isOpen(p->jfd) );\n\n  /* Check that MEMDB implies noSync. And an in-memory journal. Since \n  ** this means an in-memory pager performs no IO at all, it cannot encounter \n  ** either SQLITE_IOERR or SQLITE_FULL during rollback or while finalizing \n  ** a journal file. (although the in-memory journal implementation may \n  ** return SQLITE_IOERR_NOMEM while the journal file is being written). It \n  ** is therefore not possible for an in-memory pager to enter the ERROR \n  ** state.\n  */\n  if( MEMDB ){\n    assert( !isOpen(p->fd) );\n    assert( p->noSync );\n    assert( p->journalMode==PAGER_JOURNALMODE_OFF \n         || p->journalMode==PAGER_JOURNALMODE_MEMORY \n    );\n    assert( p->eState!=PAGER_ERROR && p->eState!=PAGER_OPEN );\n    assert( pagerUseWal(p)==0 );\n  }\n\n  /* If changeCountDone is set, a RESERVED lock or greater must be held\n  ** on the file.\n  */\n  assert( pPager->changeCountDone==0 || pPager->eLock>=RESERVED_LOCK );\n  assert( p->eLock!=PENDING_LOCK );\n\n  switch( p->eState ){\n    case PAGER_OPEN:\n      assert( !MEMDB );\n      assert( pPager->errCode==SQLITE_OK );\n      assert( sqlite3PcacheRefCount(pPager->pPCache)==0 || pPager->tempFile );\n      break;\n\n    case PAGER_READER:\n      assert( pPager->errCode==SQLITE_OK );\n      assert( p->eLock!=UNKNOWN_LOCK );\n      assert( p->eLock>=SHARED_LOCK );\n      break;\n\n    case PAGER_WRITER_LOCKED:\n      assert( p->eLock!=UNKNOWN_LOCK );\n      assert( pPager->errCode==SQLITE_OK );\n      if( !pagerUseWal(pPager) ){\n        assert( p->eLock>=RESERVED_LOCK );\n      }\n      assert( pPager->dbSize==pPager->dbOrigSize );\n      assert( pPager->dbOrigSize==pPager->dbFileSize );\n      assert( pPager->dbOrigSize==pPager->dbHintSize );\n      assert( pPager->setMaster==0 );\n      break;\n\n    case PAGER_WRITER_CACHEMOD:\n      assert( p->eLock!=UNKNOWN_LOCK );\n      assert( pPager->errCode==SQLITE_OK );\n      if( !pagerUseWal(pPager) ){\n        /* It is possible that if journal_mode=wal here that neither the\n        ** journal file nor the WAL file are open. This happens during\n        ** a rollback transaction that switches from journal_mode=off\n        ** to journal_mode=wal.\n        */\n        assert( p->eLock>=RESERVED_LOCK );\n        assert( isOpen(p->jfd) \n             || p->journalMode==PAGER_JOURNALMODE_OFF \n             || p->journalMode==PAGER_JOURNALMODE_WAL \n        );\n      }\n      assert( pPager->dbOrigSize==pPager->dbFileSize );\n      assert( pPager->dbOrigSize==pPager->dbHintSize );\n      break;\n\n    case PAGER_WRITER_DBMOD:\n      assert( p->eLock==EXCLUSIVE_LOCK );\n      assert( pPager->errCode==SQLITE_OK );\n      assert( !pagerUseWal(pPager) );\n      assert( p->eLock>=EXCLUSIVE_LOCK );\n      assert( isOpen(p->jfd) \n           || p->journalMode==PAGER_JOURNALMODE_OFF \n           || p->journalMode==PAGER_JOURNALMODE_WAL \n      );\n      assert( pPager->dbOrigSize<=pPager->dbHintSize );\n      break;\n\n    case PAGER_WRITER_FINISHED:\n      assert( p->eLock==EXCLUSIVE_LOCK );\n      assert( pPager->errCode==SQLITE_OK );\n      assert( !pagerUseWal(pPager) );\n      assert( isOpen(p->jfd) \n           || p->journalMode==PAGER_JOURNALMODE_OFF \n           || p->journalMode==PAGER_JOURNALMODE_WAL \n      );\n      break;\n\n    case PAGER_ERROR:\n      /* There must be at least one outstanding reference to the pager if\n      ** in ERROR state. Otherwise the pager should have already dropped\n      ** back to OPEN state.\n      */\n      assert( pPager->errCode!=SQLITE_OK );\n      assert( sqlite3PcacheRefCount(pPager->pPCache)>0 || pPager->tempFile );\n      break;\n  }\n\n  return 1;\n}\n#endif /* ifndef NDEBUG */\n\n#ifdef SQLITE_DEBUG \n/*\n** Return a pointer to a human readable string in a static buffer\n** containing the state of the Pager object passed as an argument. This\n** is intended to be used within debuggers. For example, as an alternative\n** to \"print *pPager\" in gdb:\n**\n** (gdb) printf \"%s\", print_pager_state(pPager)\n*/\nstatic char *print_pager_state(Pager *p){\n  static char zRet[1024];\n\n  sqlite3_snprintf(1024, zRet,\n      \"Filename:      %s\\n\"\n      \"State:         %s errCode=%d\\n\"\n      \"Lock:          %s\\n\"\n      \"Locking mode:  locking_mode=%s\\n\"\n      \"Journal mode:  journal_mode=%s\\n\"\n      \"Backing store: tempFile=%d memDb=%d useJournal=%d\\n\"\n      \"Journal:       journalOff=%lld journalHdr=%lld\\n\"\n      \"Size:          dbsize=%d dbOrigSize=%d dbFileSize=%d\\n\"\n      , p->zFilename\n      , p->eState==PAGER_OPEN            ? \"OPEN\" :\n        p->eState==PAGER_READER          ? \"READER\" :\n        p->eState==PAGER_WRITER_LOCKED   ? \"WRITER_LOCKED\" :\n        p->eState==PAGER_WRITER_CACHEMOD ? \"WRITER_CACHEMOD\" :\n        p->eState==PAGER_WRITER_DBMOD    ? \"WRITER_DBMOD\" :\n        p->eState==PAGER_WRITER_FINISHED ? \"WRITER_FINISHED\" :\n        p->eState==PAGER_ERROR           ? \"ERROR\" : \"?error?\"\n      , (int)p->errCode\n      , p->eLock==NO_LOCK         ? \"NO_LOCK\" :\n        p->eLock==RESERVED_LOCK   ? \"RESERVED\" :\n        p->eLock==EXCLUSIVE_LOCK  ? \"EXCLUSIVE\" :\n        p->eLock==SHARED_LOCK     ? \"SHARED\" :\n        p->eLock==UNKNOWN_LOCK    ? \"UNKNOWN\" : \"?error?\"\n      , p->exclusiveMode ? \"exclusive\" : \"normal\"\n      , p->journalMode==PAGER_JOURNALMODE_MEMORY   ? \"memory\" :\n        p->journalMode==PAGER_JOURNALMODE_OFF      ? \"off\" :\n        p->journalMode==PAGER_JOURNALMODE_DELETE   ? \"delete\" :\n        p->journalMode==PAGER_JOURNALMODE_PERSIST  ? \"persist\" :\n        p->journalMode==PAGER_JOURNALMODE_TRUNCATE ? \"truncate\" :\n        p->journalMode==PAGER_JOURNALMODE_WAL      ? \"wal\" : \"?error?\"\n      , (int)p->tempFile, (int)p->memDb, (int)p->useJournal\n      , p->journalOff, p->journalHdr\n      , (int)p->dbSize, (int)p->dbOrigSize, (int)p->dbFileSize\n  );\n\n  return zRet;\n}\n#endif\n\n/*\n** Return true if it is necessary to write page *pPg into the sub-journal.\n** A page needs to be written into the sub-journal if there exists one\n** or more open savepoints for which:\n**\n**   * The page-number is less than or equal to PagerSavepoint.nOrig, and\n**   * The bit corresponding to the page-number is not set in\n**     PagerSavepoint.pInSavepoint.\n*/\nstatic int subjRequiresPage(PgHdr *pPg){\n  Pager *pPager = pPg->pPager;\n  PagerSavepoint *p;\n  Pgno pgno = pPg->pgno;\n  int i;\n  for(i=0; i<pPager->nSavepoint; i++){\n    p = &pPager->aSavepoint[i];\n    if( p->nOrig>=pgno && 0==sqlite3BitvecTestNotNull(p->pInSavepoint, pgno) ){\n      return 1;\n    }\n  }\n  return 0;\n}\n\n#ifdef SQLITE_DEBUG\n/*\n** Return true if the page is already in the journal file.\n*/\nstatic int pageInJournal(Pager *pPager, PgHdr *pPg){\n  return sqlite3BitvecTest(pPager->pInJournal, pPg->pgno);\n}\n#endif\n\n/*\n** Read a 32-bit integer from the given file descriptor.  Store the integer\n** that is read in *pRes.  Return SQLITE_OK if everything worked, or an\n** error code is something goes wrong.\n**\n** All values are stored on disk as big-endian.\n*/\nstatic int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){\n  unsigned char ac[4];\n  int rc = sqlite3OsRead(fd, ac, sizeof(ac), offset);\n  if( rc==SQLITE_OK ){\n    *pRes = sqlite3Get4byte(ac);\n  }\n  return rc;\n}\n\n/*\n** Write a 32-bit integer into a string buffer in big-endian byte order.\n*/\n#define put32bits(A,B)  sqlite3Put4byte((u8*)A,B)\n\n\n/*\n** Write a 32-bit integer into the given file descriptor.  Return SQLITE_OK\n** on success or an error code is something goes wrong.\n*/\nstatic int write32bits(sqlite3_file *fd, i64 offset, u32 val){\n  char ac[4];\n  put32bits(ac, val);\n  return sqlite3OsWrite(fd, ac, 4, offset);\n}\n\n/*\n** Unlock the database file to level eLock, which must be either NO_LOCK\n** or SHARED_LOCK. Regardless of whether or not the call to xUnlock()\n** succeeds, set the Pager.eLock variable to match the (attempted) new lock.\n**\n** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is\n** called, do not modify it. See the comment above the #define of \n** UNKNOWN_LOCK for an explanation of this.\n*/\nstatic int pagerUnlockDb(Pager *pPager, int eLock){\n  int rc = SQLITE_OK;\n\n  assert( !pPager->exclusiveMode || pPager->eLock==eLock );\n  assert( eLock==NO_LOCK || eLock==SHARED_LOCK );\n  assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 );\n  if( isOpen(pPager->fd) ){\n    assert( pPager->eLock>=eLock );\n    rc = pPager->noLock ? SQLITE_OK : sqlite3OsUnlock(pPager->fd, eLock);\n    if( pPager->eLock!=UNKNOWN_LOCK ){\n      pPager->eLock = (u8)eLock;\n    }\n    IOTRACE((\"UNLOCK %p %d\\n\", pPager, eLock))\n  }\n  return rc;\n}\n\n/*\n** Lock the database file to level eLock, which must be either SHARED_LOCK,\n** RESERVED_LOCK or EXCLUSIVE_LOCK. If the caller is successful, set the\n** Pager.eLock variable to the new locking state. \n**\n** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is \n** called, do not modify it unless the new locking state is EXCLUSIVE_LOCK. \n** See the comment above the #define of UNKNOWN_LOCK for an explanation \n** of this.\n*/\nstatic int pagerLockDb(Pager *pPager, int eLock){\n  int rc = SQLITE_OK;\n\n  assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK );\n  if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){\n    rc = pPager->noLock ? SQLITE_OK : sqlite3OsLock(pPager->fd, eLock);\n    if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){\n      pPager->eLock = (u8)eLock;\n      IOTRACE((\"LOCK %p %d\\n\", pPager, eLock))\n    }\n  }\n  return rc;\n}\n\n/*\n** This function determines whether or not the atomic-write optimization\n** can be used with this pager. The optimization can be used if:\n**\n**  (a) the value returned by OsDeviceCharacteristics() indicates that\n**      a database page may be written atomically, and\n**  (b) the value returned by OsSectorSize() is less than or equal\n**      to the page size.\n**\n** The optimization is also always enabled for temporary files. It is\n** an error to call this function if pPager is opened on an in-memory\n** database.\n**\n** If the optimization cannot be used, 0 is returned. If it can be used,\n** then the value returned is the size of the journal file when it\n** contains rollback data for exactly one page.\n*/\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\nstatic int jrnlBufferSize(Pager *pPager){\n  assert( !MEMDB );\n  if( !pPager->tempFile ){\n    int dc;                           /* Device characteristics */\n    int nSector;                      /* Sector size */\n    int szPage;                       /* Page size */\n\n    assert( isOpen(pPager->fd) );\n    dc = sqlite3OsDeviceCharacteristics(pPager->fd);\n    nSector = pPager->sectorSize;\n    szPage = pPager->pageSize;\n\n    assert(SQLITE_IOCAP_ATOMIC512==(512>>8));\n    assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));\n    if( 0==(dc&(SQLITE_IOCAP_ATOMIC|(szPage>>8)) || nSector>szPage) ){\n      return 0;\n    }\n  }\n\n  return JOURNAL_HDR_SZ(pPager) + JOURNAL_PG_SZ(pPager);\n}\n#else\n# define jrnlBufferSize(x) 0\n#endif\n\n/*\n** If SQLITE_CHECK_PAGES is defined then we do some sanity checking\n** on the cache using a hash function.  This is used for testing\n** and debugging only.\n*/\n#ifdef SQLITE_CHECK_PAGES\n/*\n** Return a 32-bit hash of the page data for pPage.\n*/\nstatic u32 pager_datahash(int nByte, unsigned char *pData){\n  u32 hash = 0;\n  int i;\n  for(i=0; i<nByte; i++){\n    hash = (hash*1039) + pData[i];\n  }\n  return hash;\n}\nstatic u32 pager_pagehash(PgHdr *pPage){\n  return pager_datahash(pPage->pPager->pageSize, (unsigned char *)pPage->pData);\n}\nstatic void pager_set_pagehash(PgHdr *pPage){\n  pPage->pageHash = pager_pagehash(pPage);\n}\n\n/*\n** The CHECK_PAGE macro takes a PgHdr* as an argument. If SQLITE_CHECK_PAGES\n** is defined, and NDEBUG is not defined, an assert() statement checks\n** that the page is either dirty or still matches the calculated page-hash.\n*/\n#define CHECK_PAGE(x) checkPage(x)\nstatic void checkPage(PgHdr *pPg){\n  Pager *pPager = pPg->pPager;\n  assert( pPager->eState!=PAGER_ERROR );\n  assert( (pPg->flags&PGHDR_DIRTY) || pPg->pageHash==pager_pagehash(pPg) );\n}\n\n#else\n#define pager_datahash(X,Y)  0\n#define pager_pagehash(X)  0\n#define pager_set_pagehash(X)\n#define CHECK_PAGE(x)\n#endif  /* SQLITE_CHECK_PAGES */\n\n/*\n** When this is called the journal file for pager pPager must be open.\n** This function attempts to read a master journal file name from the \n** end of the file and, if successful, copies it into memory supplied \n** by the caller. See comments above writeMasterJournal() for the format\n** used to store a master journal file name at the end of a journal file.\n**\n** zMaster must point to a buffer of at least nMaster bytes allocated by\n** the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is\n** enough space to write the master journal name). If the master journal\n** name in the journal is longer than nMaster bytes (including a\n** nul-terminator), then this is handled as if no master journal name\n** were present in the journal.\n**\n** If a master journal file name is present at the end of the journal\n** file, then it is copied into the buffer pointed to by zMaster. A\n** nul-terminator byte is appended to the buffer following the master\n** journal file name.\n**\n** If it is determined that no master journal file name is present \n** zMaster[0] is set to 0 and SQLITE_OK returned.\n**\n** If an error occurs while reading from the journal file, an SQLite\n** error code is returned.\n*/\nstatic int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMaster){\n  int rc;                    /* Return code */\n  u32 len;                   /* Length in bytes of master journal name */\n  i64 szJ;                   /* Total size in bytes of journal file pJrnl */\n  u32 cksum;                 /* MJ checksum value read from journal */\n  u32 u;                     /* Unsigned loop counter */\n  unsigned char aMagic[8];   /* A buffer to hold the magic header */\n  zMaster[0] = '\\0';\n\n  if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ))\n   || szJ<16\n   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))\n   || len>=nMaster \n   || len==0 \n   || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum))\n   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8))\n   || memcmp(aMagic, aJournalMagic, 8)\n   || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len))\n  ){\n    return rc;\n  }\n\n  /* See if the checksum matches the master journal name */\n  for(u=0; u<len; u++){\n    cksum -= zMaster[u];\n  }\n  if( cksum ){\n    /* If the checksum doesn't add up, then one or more of the disk sectors\n    ** containing the master journal filename is corrupted. This means\n    ** definitely roll back, so just return SQLITE_OK and report a (nul)\n    ** master-journal filename.\n    */\n    len = 0;\n  }\n  zMaster[len] = '\\0';\n   \n  return SQLITE_OK;\n}\n\n/*\n** Return the offset of the sector boundary at or immediately \n** following the value in pPager->journalOff, assuming a sector \n** size of pPager->sectorSize bytes.\n**\n** i.e for a sector size of 512:\n**\n**   Pager.journalOff          Return value\n**   ---------------------------------------\n**   0                         0\n**   512                       512\n**   100                       512\n**   2000                      2048\n** \n*/\nstatic i64 journalHdrOffset(Pager *pPager){\n  i64 offset = 0;\n  i64 c = pPager->journalOff;\n  if( c ){\n    offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager);\n  }\n  assert( offset%JOURNAL_HDR_SZ(pPager)==0 );\n  assert( offset>=c );\n  assert( (offset-c)<JOURNAL_HDR_SZ(pPager) );\n  return offset;\n}\n\n/*\n** The journal file must be open when this function is called.\n**\n** This function is a no-op if the journal file has not been written to\n** within the current transaction (i.e. if Pager.journalOff==0).\n**\n** If doTruncate is non-zero or the Pager.journalSizeLimit variable is\n** set to 0, then truncate the journal file to zero bytes in size. Otherwise,\n** zero the 28-byte header at the start of the journal file. In either case, \n** if the pager is not in no-sync mode, sync the journal file immediately \n** after writing or truncating it.\n**\n** If Pager.journalSizeLimit is set to a positive, non-zero value, and\n** following the truncation or zeroing described above the size of the \n** journal file in bytes is larger than this value, then truncate the\n** journal file to Pager.journalSizeLimit bytes. The journal file does\n** not need to be synced following this operation.\n**\n** If an IO error occurs, abandon processing and return the IO error code.\n** Otherwise, return SQLITE_OK.\n*/\nstatic int zeroJournalHdr(Pager *pPager, int doTruncate){\n  int rc = SQLITE_OK;                               /* Return code */\n  assert( isOpen(pPager->jfd) );\n  assert( !sqlite3JournalIsInMemory(pPager->jfd) );\n  if( pPager->journalOff ){\n    const i64 iLimit = pPager->journalSizeLimit;    /* Local cache of jsl */\n\n    IOTRACE((\"JZEROHDR %p\\n\", pPager))\n    if( doTruncate || iLimit==0 ){\n      rc = sqlite3OsTruncate(pPager->jfd, 0);\n    }else{\n      static const char zeroHdr[28] = {0};\n      rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0);\n    }\n    if( rc==SQLITE_OK && !pPager->noSync ){\n      rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags);\n    }\n\n    /* At this point the transaction is committed but the write lock \n    ** is still held on the file. If there is a size limit configured for \n    ** the persistent journal and the journal file currently consumes more\n    ** space than that limit allows for, truncate it now. There is no need\n    ** to sync the file following this operation.\n    */\n    if( rc==SQLITE_OK && iLimit>0 ){\n      i64 sz;\n      rc = sqlite3OsFileSize(pPager->jfd, &sz);\n      if( rc==SQLITE_OK && sz>iLimit ){\n        rc = sqlite3OsTruncate(pPager->jfd, iLimit);\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** The journal file must be open when this routine is called. A journal\n** header (JOURNAL_HDR_SZ bytes) is written into the journal file at the\n** current location.\n**\n** The format for the journal header is as follows:\n** - 8 bytes: Magic identifying journal format.\n** - 4 bytes: Number of records in journal, or -1 no-sync mode is on.\n** - 4 bytes: Random number used for page hash.\n** - 4 bytes: Initial database page count.\n** - 4 bytes: Sector size used by the process that wrote this journal.\n** - 4 bytes: Database page size.\n** \n** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space.\n*/\nstatic int writeJournalHdr(Pager *pPager){\n  int rc = SQLITE_OK;                 /* Return code */\n  char *zHeader = pPager->pTmpSpace;  /* Temporary space used to build header */\n  u32 nHeader = (u32)pPager->pageSize;/* Size of buffer pointed to by zHeader */\n  u32 nWrite;                         /* Bytes of header sector written */\n  int ii;                             /* Loop counter */\n\n  assert( isOpen(pPager->jfd) );      /* Journal file must be open. */\n\n  if( nHeader>JOURNAL_HDR_SZ(pPager) ){\n    nHeader = JOURNAL_HDR_SZ(pPager);\n  }\n\n  /* If there are active savepoints and any of them were created \n  ** since the most recent journal header was written, update the \n  ** PagerSavepoint.iHdrOffset fields now.\n  */\n  for(ii=0; ii<pPager->nSavepoint; ii++){\n    if( pPager->aSavepoint[ii].iHdrOffset==0 ){\n      pPager->aSavepoint[ii].iHdrOffset = pPager->journalOff;\n    }\n  }\n\n  pPager->journalHdr = pPager->journalOff = journalHdrOffset(pPager);\n\n  /* \n  ** Write the nRec Field - the number of page records that follow this\n  ** journal header. Normally, zero is written to this value at this time.\n  ** After the records are added to the journal (and the journal synced, \n  ** if in full-sync mode), the zero is overwritten with the true number\n  ** of records (see syncJournal()).\n  **\n  ** A faster alternative is to write 0xFFFFFFFF to the nRec field. When\n  ** reading the journal this value tells SQLite to assume that the\n  ** rest of the journal file contains valid page records. This assumption\n  ** is dangerous, as if a failure occurred whilst writing to the journal\n  ** file it may contain some garbage data. There are two scenarios\n  ** where this risk can be ignored:\n  **\n  **   * When the pager is in no-sync mode. Corruption can follow a\n  **     power failure in this case anyway.\n  **\n  **   * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees\n  **     that garbage data is never appended to the journal file.\n  */\n  assert( isOpen(pPager->fd) || pPager->noSync );\n  if( pPager->noSync || (pPager->journalMode==PAGER_JOURNALMODE_MEMORY)\n   || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) \n  ){\n    memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic));\n    put32bits(&zHeader[sizeof(aJournalMagic)], 0xffffffff);\n  }else{\n    memset(zHeader, 0, sizeof(aJournalMagic)+4);\n  }\n\n  /* The random check-hash initializer */ \n  sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);\n  put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);\n  /* The initial database size */\n  put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbOrigSize);\n  /* The assumed sector size for this process */\n  put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize);\n\n  /* The page size */\n  put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize);\n\n  /* Initializing the tail of the buffer is not necessary.  Everything\n  ** works find if the following memset() is omitted.  But initializing\n  ** the memory prevents valgrind from complaining, so we are willing to\n  ** take the performance hit.\n  */\n  memset(&zHeader[sizeof(aJournalMagic)+20], 0,\n         nHeader-(sizeof(aJournalMagic)+20));\n\n  /* In theory, it is only necessary to write the 28 bytes that the \n  ** journal header consumes to the journal file here. Then increment the \n  ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next \n  ** record is written to the following sector (leaving a gap in the file\n  ** that will be implicitly filled in by the OS).\n  **\n  ** However it has been discovered that on some systems this pattern can \n  ** be significantly slower than contiguously writing data to the file,\n  ** even if that means explicitly writing data to the block of \n  ** (JOURNAL_HDR_SZ - 28) bytes that will not be used. So that is what\n  ** is done. \n  **\n  ** The loop is required here in case the sector-size is larger than the \n  ** database page size. Since the zHeader buffer is only Pager.pageSize\n  ** bytes in size, more than one call to sqlite3OsWrite() may be required\n  ** to populate the entire journal header sector.\n  */ \n  for(nWrite=0; rc==SQLITE_OK&&nWrite<JOURNAL_HDR_SZ(pPager); nWrite+=nHeader){\n    IOTRACE((\"JHDR %p %lld %d\\n\", pPager, pPager->journalHdr, nHeader))\n    rc = sqlite3OsWrite(pPager->jfd, zHeader, nHeader, pPager->journalOff);\n    assert( pPager->journalHdr <= pPager->journalOff );\n    pPager->journalOff += nHeader;\n  }\n\n  return rc;\n}\n\n/*\n** The journal file must be open when this is called. A journal header file\n** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal\n** file. The current location in the journal file is given by\n** pPager->journalOff. See comments above function writeJournalHdr() for\n** a description of the journal header format.\n**\n** If the header is read successfully, *pNRec is set to the number of\n** page records following this header and *pDbSize is set to the size of the\n** database before the transaction began, in pages. Also, pPager->cksumInit\n** is set to the value read from the journal header. SQLITE_OK is returned\n** in this case.\n**\n** If the journal header file appears to be corrupted, SQLITE_DONE is\n** returned and *pNRec and *PDbSize are undefined.  If JOURNAL_HDR_SZ bytes\n** cannot be read from the journal file an error code is returned.\n*/\nstatic int readJournalHdr(\n  Pager *pPager,               /* Pager object */\n  int isHot,\n  i64 journalSize,             /* Size of the open journal file in bytes */\n  u32 *pNRec,                  /* OUT: Value read from the nRec field */\n  u32 *pDbSize                 /* OUT: Value of original database size field */\n){\n  int rc;                      /* Return code */\n  unsigned char aMagic[8];     /* A buffer to hold the magic header */\n  i64 iHdrOff;                 /* Offset of journal header being read */\n\n  assert( isOpen(pPager->jfd) );      /* Journal file must be open. */\n\n  /* Advance Pager.journalOff to the start of the next sector. If the\n  ** journal file is too small for there to be a header stored at this\n  ** point, return SQLITE_DONE.\n  */\n  pPager->journalOff = journalHdrOffset(pPager);\n  if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){\n    return SQLITE_DONE;\n  }\n  iHdrOff = pPager->journalOff;\n\n  /* Read in the first 8 bytes of the journal header. If they do not match\n  ** the  magic string found at the start of each journal header, return\n  ** SQLITE_DONE. If an IO error occurs, return an error code. Otherwise,\n  ** proceed.\n  */\n  if( isHot || iHdrOff!=pPager->journalHdr ){\n    rc = sqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), iHdrOff);\n    if( rc ){\n      return rc;\n    }\n    if( memcmp(aMagic, aJournalMagic, sizeof(aMagic))!=0 ){\n      return SQLITE_DONE;\n    }\n  }\n\n  /* Read the first three 32-bit fields of the journal header: The nRec\n  ** field, the checksum-initializer and the database size at the start\n  ** of the transaction. Return an error code if anything goes wrong.\n  */\n  if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+8, pNRec))\n   || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+12, &pPager->cksumInit))\n   || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+16, pDbSize))\n  ){\n    return rc;\n  }\n\n  if( pPager->journalOff==0 ){\n    u32 iPageSize;               /* Page-size field of journal header */\n    u32 iSectorSize;             /* Sector-size field of journal header */\n\n    /* Read the page-size and sector-size journal header fields. */\n    if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))\n     || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize))\n    ){\n      return rc;\n    }\n\n    /* Versions of SQLite prior to 3.5.8 set the page-size field of the\n    ** journal header to zero. In this case, assume that the Pager.pageSize\n    ** variable is already set to the correct page size.\n    */\n    if( iPageSize==0 ){\n      iPageSize = pPager->pageSize;\n    }\n\n    /* Check that the values read from the page-size and sector-size fields\n    ** are within range. To be 'in range', both values need to be a power\n    ** of two greater than or equal to 512 or 32, and not greater than their \n    ** respective compile time maximum limits.\n    */\n    if( iPageSize<512                  || iSectorSize<32\n     || iPageSize>SQLITE_MAX_PAGE_SIZE || iSectorSize>MAX_SECTOR_SIZE\n     || ((iPageSize-1)&iPageSize)!=0   || ((iSectorSize-1)&iSectorSize)!=0 \n    ){\n      /* If the either the page-size or sector-size in the journal-header is \n      ** invalid, then the process that wrote the journal-header must have \n      ** crashed before the header was synced. In this case stop reading \n      ** the journal file here.\n      */\n      return SQLITE_DONE;\n    }\n\n    /* Update the page-size to match the value read from the journal. \n    ** Use a testcase() macro to make sure that malloc failure within \n    ** PagerSetPagesize() is tested.\n    */\n    rc = sqlite3PagerSetPagesize(pPager, &iPageSize, -1);\n    testcase( rc!=SQLITE_OK );\n\n    /* Update the assumed sector-size to match the value used by \n    ** the process that created this journal. If this journal was\n    ** created by a process other than this one, then this routine\n    ** is being called from within pager_playback(). The local value\n    ** of Pager.sectorSize is restored at the end of that routine.\n    */\n    pPager->sectorSize = iSectorSize;\n  }\n\n  pPager->journalOff += JOURNAL_HDR_SZ(pPager);\n  return rc;\n}\n\n\n/*\n** Write the supplied master journal name into the journal file for pager\n** pPager at the current location. The master journal name must be the last\n** thing written to a journal file. If the pager is in full-sync mode, the\n** journal file descriptor is advanced to the next sector boundary before\n** anything is written. The format is:\n**\n**   + 4 bytes: PAGER_MJ_PGNO.\n**   + N bytes: Master journal filename in utf-8.\n**   + 4 bytes: N (length of master journal name in bytes, no nul-terminator).\n**   + 4 bytes: Master journal name checksum.\n**   + 8 bytes: aJournalMagic[].\n**\n** The master journal page checksum is the sum of the bytes in the master\n** journal name, where each byte is interpreted as a signed 8-bit integer.\n**\n** If zMaster is a NULL pointer (occurs for a single database transaction), \n** this call is a no-op.\n*/\nstatic int writeMasterJournal(Pager *pPager, const char *zMaster){\n  int rc;                          /* Return code */\n  int nMaster;                     /* Length of string zMaster */\n  i64 iHdrOff;                     /* Offset of header in journal file */\n  i64 jrnlSize;                    /* Size of journal file on disk */\n  u32 cksum = 0;                   /* Checksum of string zMaster */\n\n  assert( pPager->setMaster==0 );\n  assert( !pagerUseWal(pPager) );\n\n  if( !zMaster \n   || pPager->journalMode==PAGER_JOURNALMODE_MEMORY \n   || !isOpen(pPager->jfd)\n  ){\n    return SQLITE_OK;\n  }\n  pPager->setMaster = 1;\n  assert( pPager->journalHdr <= pPager->journalOff );\n\n  /* Calculate the length in bytes and the checksum of zMaster */\n  for(nMaster=0; zMaster[nMaster]; nMaster++){\n    cksum += zMaster[nMaster];\n  }\n\n  /* If in full-sync mode, advance to the next disk sector before writing\n  ** the master journal name. This is in case the previous page written to\n  ** the journal has already been synced.\n  */\n  if( pPager->fullSync ){\n    pPager->journalOff = journalHdrOffset(pPager);\n  }\n  iHdrOff = pPager->journalOff;\n\n  /* Write the master journal data to the end of the journal file. If\n  ** an error occurs, return the error code to the caller.\n  */\n  if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_MJ_PGNO(pPager))))\n   || (0 != (rc = sqlite3OsWrite(pPager->jfd, zMaster, nMaster, iHdrOff+4)))\n   || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster, nMaster)))\n   || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster+4, cksum)))\n   || (0 != (rc = sqlite3OsWrite(pPager->jfd, aJournalMagic, 8,\n                                 iHdrOff+4+nMaster+8)))\n  ){\n    return rc;\n  }\n  pPager->journalOff += (nMaster+20);\n\n  /* If the pager is in peristent-journal mode, then the physical \n  ** journal-file may extend past the end of the master-journal name\n  ** and 8 bytes of magic data just written to the file. This is \n  ** dangerous because the code to rollback a hot-journal file\n  ** will not be able to find the master-journal name to determine \n  ** whether or not the journal is hot. \n  **\n  ** Easiest thing to do in this scenario is to truncate the journal \n  ** file to the required size.\n  */ \n  if( SQLITE_OK==(rc = sqlite3OsFileSize(pPager->jfd, &jrnlSize))\n   && jrnlSize>pPager->journalOff\n  ){\n    rc = sqlite3OsTruncate(pPager->jfd, pPager->journalOff);\n  }\n  return rc;\n}\n\n/*\n** Discard the entire contents of the in-memory page-cache.\n*/\nstatic void pager_reset(Pager *pPager){\n  pPager->iDataVersion++;\n  sqlite3BackupRestart(pPager->pBackup);\n  sqlite3PcacheClear(pPager->pPCache);\n}\n\n/*\n** Return the pPager->iDataVersion value\n*/\nu32 sqlite3PagerDataVersion(Pager *pPager){\n  assert( pPager->eState>PAGER_OPEN );\n  return pPager->iDataVersion;\n}\n\n/*\n** Free all structures in the Pager.aSavepoint[] array and set both\n** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal\n** if it is open and the pager is not in exclusive mode.\n*/\nstatic void releaseAllSavepoints(Pager *pPager){\n  int ii;               /* Iterator for looping through Pager.aSavepoint */\n  for(ii=0; ii<pPager->nSavepoint; ii++){\n    sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);\n  }\n  if( !pPager->exclusiveMode || sqlite3JournalIsInMemory(pPager->sjfd) ){\n    sqlite3OsClose(pPager->sjfd);\n  }\n  sqlite3_free(pPager->aSavepoint);\n  pPager->aSavepoint = 0;\n  pPager->nSavepoint = 0;\n  pPager->nSubRec = 0;\n}\n\n/*\n** Set the bit number pgno in the PagerSavepoint.pInSavepoint \n** bitvecs of all open savepoints. Return SQLITE_OK if successful\n** or SQLITE_NOMEM if a malloc failure occurs.\n*/\nstatic int addToSavepointBitvecs(Pager *pPager, Pgno pgno){\n  int ii;                   /* Loop counter */\n  int rc = SQLITE_OK;       /* Result code */\n\n  for(ii=0; ii<pPager->nSavepoint; ii++){\n    PagerSavepoint *p = &pPager->aSavepoint[ii];\n    if( pgno<=p->nOrig ){\n      rc |= sqlite3BitvecSet(p->pInSavepoint, pgno);\n      testcase( rc==SQLITE_NOMEM );\n      assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );\n    }\n  }\n  return rc;\n}\n\n/*\n** This function is a no-op if the pager is in exclusive mode and not\n** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN\n** state.\n**\n** If the pager is not in exclusive-access mode, the database file is\n** completely unlocked. If the file is unlocked and the file-system does\n** not exhibit the UNDELETABLE_WHEN_OPEN property, the journal file is\n** closed (if it is open).\n**\n** If the pager is in ERROR state when this function is called, the \n** contents of the pager cache are discarded before switching back to \n** the OPEN state. Regardless of whether the pager is in exclusive-mode\n** or not, any journal file left in the file-system will be treated\n** as a hot-journal and rolled back the next time a read-transaction\n** is opened (by this or by any other connection).\n*/\nstatic void pager_unlock(Pager *pPager){\n\n  assert( pPager->eState==PAGER_READER \n       || pPager->eState==PAGER_OPEN \n       || pPager->eState==PAGER_ERROR \n  );\n\n  sqlite3BitvecDestroy(pPager->pInJournal);\n  pPager->pInJournal = 0;\n  releaseAllSavepoints(pPager);\n\n  if( pagerUseWal(pPager) ){\n    assert( !isOpen(pPager->jfd) );\n    sqlite3WalEndReadTransaction(pPager->pWal);\n    pPager->eState = PAGER_OPEN;\n  }else if( !pPager->exclusiveMode ){\n    int rc;                       /* Error code returned by pagerUnlockDb() */\n    int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0;\n\n    /* If the operating system support deletion of open files, then\n    ** close the journal file when dropping the database lock.  Otherwise\n    ** another connection with journal_mode=delete might delete the file\n    ** out from under us.\n    */\n    assert( (PAGER_JOURNALMODE_MEMORY   & 5)!=1 );\n    assert( (PAGER_JOURNALMODE_OFF      & 5)!=1 );\n    assert( (PAGER_JOURNALMODE_WAL      & 5)!=1 );\n    assert( (PAGER_JOURNALMODE_DELETE   & 5)!=1 );\n    assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 );\n    assert( (PAGER_JOURNALMODE_PERSIST  & 5)==1 );\n    if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN)\n     || 1!=(pPager->journalMode & 5)\n    ){\n      sqlite3OsClose(pPager->jfd);\n    }\n\n    /* If the pager is in the ERROR state and the call to unlock the database\n    ** file fails, set the current lock to UNKNOWN_LOCK. See the comment\n    ** above the #define for UNKNOWN_LOCK for an explanation of why this\n    ** is necessary.\n    */\n    rc = pagerUnlockDb(pPager, NO_LOCK);\n    if( rc!=SQLITE_OK && pPager->eState==PAGER_ERROR ){\n      pPager->eLock = UNKNOWN_LOCK;\n    }\n\n    /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here\n    ** without clearing the error code. This is intentional - the error\n    ** code is cleared and the cache reset in the block below.\n    */\n    assert( pPager->errCode || pPager->eState!=PAGER_ERROR );\n    pPager->changeCountDone = 0;\n    pPager->eState = PAGER_OPEN;\n  }\n\n  /* If Pager.errCode is set, the contents of the pager cache cannot be\n  ** trusted. Now that there are no outstanding references to the pager,\n  ** it can safely move back to PAGER_OPEN state. This happens in both\n  ** normal and exclusive-locking mode.\n  */\n  assert( pPager->errCode==SQLITE_OK || !MEMDB );\n  if( pPager->errCode ){\n    if( pPager->tempFile==0 ){\n      pager_reset(pPager);\n      pPager->changeCountDone = 0;\n      pPager->eState = PAGER_OPEN;\n    }else{\n      pPager->eState = (isOpen(pPager->jfd) ? PAGER_OPEN : PAGER_READER);\n    }\n    if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);\n    pPager->errCode = SQLITE_OK;\n  }\n\n  pPager->journalOff = 0;\n  pPager->journalHdr = 0;\n  pPager->setMaster = 0;\n}\n\n/*\n** This function is called whenever an IOERR or FULL error that requires\n** the pager to transition into the ERROR state may ahve occurred.\n** The first argument is a pointer to the pager structure, the second \n** the error-code about to be returned by a pager API function. The \n** value returned is a copy of the second argument to this function. \n**\n** If the second argument is SQLITE_FULL, SQLITE_IOERR or one of the\n** IOERR sub-codes, the pager enters the ERROR state and the error code\n** is stored in Pager.errCode. While the pager remains in the ERROR state,\n** all major API calls on the Pager will immediately return Pager.errCode.\n**\n** The ERROR state indicates that the contents of the pager-cache \n** cannot be trusted. This state can be cleared by completely discarding \n** the contents of the pager-cache. If a transaction was active when\n** the persistent error occurred, then the rollback journal may need\n** to be replayed to restore the contents of the database file (as if\n** it were a hot-journal).\n*/\nstatic int pager_error(Pager *pPager, int rc){\n  int rc2 = rc & 0xff;\n  assert( rc==SQLITE_OK || !MEMDB );\n  assert(\n       pPager->errCode==SQLITE_FULL ||\n       pPager->errCode==SQLITE_OK ||\n       (pPager->errCode & 0xff)==SQLITE_IOERR\n  );\n  if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){\n    pPager->errCode = rc;\n    pPager->eState = PAGER_ERROR;\n  }\n  return rc;\n}\n\nstatic int pager_truncate(Pager *pPager, Pgno nPage);\n\n/*\n** The write transaction open on pPager is being committed (bCommit==1)\n** or rolled back (bCommit==0).\n**\n** Return TRUE if and only if all dirty pages should be flushed to disk.\n**\n** Rules:\n**\n**   *  For non-TEMP databases, always sync to disk.  This is necessary\n**      for transactions to be durable.\n**\n**   *  Sync TEMP database only on a COMMIT (not a ROLLBACK) when the backing\n**      file has been created already (via a spill on pagerStress()) and\n**      when the number of dirty pages in memory exceeds 25% of the total\n**      cache size.\n*/\nstatic int pagerFlushOnCommit(Pager *pPager, int bCommit){\n  if( pPager->tempFile==0 ) return 1;\n  if( !bCommit ) return 0;\n  if( !isOpen(pPager->fd) ) return 0;\n  return (sqlite3PCachePercentDirty(pPager->pPCache)>=25);\n}\n\n/*\n** This routine ends a transaction. A transaction is usually ended by \n** either a COMMIT or a ROLLBACK operation. This routine may be called \n** after rollback of a hot-journal, or if an error occurs while opening\n** the journal file or writing the very first journal-header of a\n** database transaction.\n** \n** This routine is never called in PAGER_ERROR state. If it is called\n** in PAGER_NONE or PAGER_SHARED state and the lock held is less\n** exclusive than a RESERVED lock, it is a no-op.\n**\n** Otherwise, any active savepoints are released.\n**\n** If the journal file is open, then it is \"finalized\". Once a journal \n** file has been finalized it is not possible to use it to roll back a \n** transaction. Nor will it be considered to be a hot-journal by this\n** or any other database connection. Exactly how a journal is finalized\n** depends on whether or not the pager is running in exclusive mode and\n** the current journal-mode (Pager.journalMode value), as follows:\n**\n**   journalMode==MEMORY\n**     Journal file descriptor is simply closed. This destroys an \n**     in-memory journal.\n**\n**   journalMode==TRUNCATE\n**     Journal file is truncated to zero bytes in size.\n**\n**   journalMode==PERSIST\n**     The first 28 bytes of the journal file are zeroed. This invalidates\n**     the first journal header in the file, and hence the entire journal\n**     file. An invalid journal file cannot be rolled back.\n**\n**   journalMode==DELETE\n**     The journal file is closed and deleted using sqlite3OsDelete().\n**\n**     If the pager is running in exclusive mode, this method of finalizing\n**     the journal file is never used. Instead, if the journalMode is\n**     DELETE and the pager is in exclusive mode, the method described under\n**     journalMode==PERSIST is used instead.\n**\n** After the journal is finalized, the pager moves to PAGER_READER state.\n** If running in non-exclusive rollback mode, the lock on the file is \n** downgraded to a SHARED_LOCK.\n**\n** SQLITE_OK is returned if no error occurs. If an error occurs during\n** any of the IO operations to finalize the journal file or unlock the\n** database then the IO error code is returned to the user. If the \n** operation to finalize the journal file fails, then the code still\n** tries to unlock the database file if not in exclusive mode. If the\n** unlock operation fails as well, then the first error code related\n** to the first error encountered (the journal finalization one) is\n** returned.\n*/\nstatic int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){\n  int rc = SQLITE_OK;      /* Error code from journal finalization operation */\n  int rc2 = SQLITE_OK;     /* Error code from db file unlock operation */\n\n  /* Do nothing if the pager does not have an open write transaction\n  ** or at least a RESERVED lock. This function may be called when there\n  ** is no write-transaction active but a RESERVED or greater lock is\n  ** held under two circumstances:\n  **\n  **   1. After a successful hot-journal rollback, it is called with\n  **      eState==PAGER_NONE and eLock==EXCLUSIVE_LOCK.\n  **\n  **   2. If a connection with locking_mode=exclusive holding an EXCLUSIVE \n  **      lock switches back to locking_mode=normal and then executes a\n  **      read-transaction, this function is called with eState==PAGER_READER \n  **      and eLock==EXCLUSIVE_LOCK when the read-transaction is closed.\n  */\n  assert( assert_pager_state(pPager) );\n  assert( pPager->eState!=PAGER_ERROR );\n  if( pPager->eState<PAGER_WRITER_LOCKED && pPager->eLock<RESERVED_LOCK ){\n    return SQLITE_OK;\n  }\n\n  releaseAllSavepoints(pPager);\n  assert( isOpen(pPager->jfd) || pPager->pInJournal==0 );\n  if( isOpen(pPager->jfd) ){\n    assert( !pagerUseWal(pPager) );\n\n    /* Finalize the journal file. */\n    if( sqlite3JournalIsInMemory(pPager->jfd) ){\n      /* assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); */\n      sqlite3OsClose(pPager->jfd);\n    }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){\n      if( pPager->journalOff==0 ){\n        rc = SQLITE_OK;\n      }else{\n        rc = sqlite3OsTruncate(pPager->jfd, 0);\n        if( rc==SQLITE_OK && pPager->fullSync ){\n          /* Make sure the new file size is written into the inode right away.\n          ** Otherwise the journal might resurrect following a power loss and\n          ** cause the last transaction to roll back.  See\n          ** https://bugzilla.mozilla.org/show_bug.cgi?id=1072773\n          */\n          rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);\n        }\n      }\n      pPager->journalOff = 0;\n    }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST\n      || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL)\n    ){\n      rc = zeroJournalHdr(pPager, hasMaster||pPager->tempFile);\n      pPager->journalOff = 0;\n    }else{\n      /* This branch may be executed with Pager.journalMode==MEMORY if\n      ** a hot-journal was just rolled back. In this case the journal\n      ** file should be closed and deleted. If this connection writes to\n      ** the database file, it will do so using an in-memory journal.\n      */\n      int bDelete = !pPager->tempFile;\n      assert( sqlite3JournalIsInMemory(pPager->jfd)==0 );\n      assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE \n           || pPager->journalMode==PAGER_JOURNALMODE_MEMORY \n           || pPager->journalMode==PAGER_JOURNALMODE_WAL \n      );\n      sqlite3OsClose(pPager->jfd);\n      if( bDelete ){\n        rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, pPager->extraSync);\n      }\n    }\n  }\n\n#ifdef SQLITE_CHECK_PAGES\n  sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash);\n  if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){\n    PgHdr *p = sqlite3PagerLookup(pPager, 1);\n    if( p ){\n      p->pageHash = 0;\n      sqlite3PagerUnrefNotNull(p);\n    }\n  }\n#endif\n\n  sqlite3BitvecDestroy(pPager->pInJournal);\n  pPager->pInJournal = 0;\n  pPager->nRec = 0;\n  if( rc==SQLITE_OK ){\n    if( pagerFlushOnCommit(pPager, bCommit) ){\n      sqlite3PcacheCleanAll(pPager->pPCache);\n    }else{\n      sqlite3PcacheClearWritable(pPager->pPCache);\n    }\n    sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize);\n  }\n\n  if( pagerUseWal(pPager) ){\n    /* Drop the WAL write-lock, if any. Also, if the connection was in \n    ** locking_mode=exclusive mode but is no longer, drop the EXCLUSIVE \n    ** lock held on the database file.\n    */\n    rc2 = sqlite3WalEndWriteTransaction(pPager->pWal);\n    assert( rc2==SQLITE_OK );\n  }else if( rc==SQLITE_OK && bCommit && pPager->dbFileSize>pPager->dbSize ){\n    /* This branch is taken when committing a transaction in rollback-journal\n    ** mode if the database file on disk is larger than the database image.\n    ** At this point the journal has been finalized and the transaction \n    ** successfully committed, but the EXCLUSIVE lock is still held on the\n    ** file. So it is safe to truncate the database file to its minimum\n    ** required size.  */\n    assert( pPager->eLock==EXCLUSIVE_LOCK );\n    rc = pager_truncate(pPager, pPager->dbSize);\n  }\n\n  if( rc==SQLITE_OK && bCommit && isOpen(pPager->fd) ){\n    rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_COMMIT_PHASETWO, 0);\n    if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;\n  }\n\n  if( !pPager->exclusiveMode \n   && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0))\n  ){\n    rc2 = pagerUnlockDb(pPager, SHARED_LOCK);\n    pPager->changeCountDone = 0;\n  }\n  pPager->eState = PAGER_READER;\n  pPager->setMaster = 0;\n\n  return (rc==SQLITE_OK?rc2:rc);\n}\n\n/*\n** Execute a rollback if a transaction is active and unlock the \n** database file. \n**\n** If the pager has already entered the ERROR state, do not attempt \n** the rollback at this time. Instead, pager_unlock() is called. The\n** call to pager_unlock() will discard all in-memory pages, unlock\n** the database file and move the pager back to OPEN state. If this \n** means that there is a hot-journal left in the file-system, the next \n** connection to obtain a shared lock on the pager (which may be this one) \n** will roll it back.\n**\n** If the pager has not already entered the ERROR state, but an IO or\n** malloc error occurs during a rollback, then this will itself cause \n** the pager to enter the ERROR state. Which will be cleared by the\n** call to pager_unlock(), as described above.\n*/\nstatic void pagerUnlockAndRollback(Pager *pPager){\n  if( pPager->eState!=PAGER_ERROR && pPager->eState!=PAGER_OPEN ){\n    assert( assert_pager_state(pPager) );\n    if( pPager->eState>=PAGER_WRITER_LOCKED ){\n      sqlite3BeginBenignMalloc();\n      sqlite3PagerRollback(pPager);\n      sqlite3EndBenignMalloc();\n    }else if( !pPager->exclusiveMode ){\n      assert( pPager->eState==PAGER_READER );\n      pager_end_transaction(pPager, 0, 0);\n    }\n  }\n  pager_unlock(pPager);\n}\n\n/*\n** Parameter aData must point to a buffer of pPager->pageSize bytes\n** of data. Compute and return a checksum based ont the contents of the \n** page of data and the current value of pPager->cksumInit.\n**\n** This is not a real checksum. It is really just the sum of the \n** random initial value (pPager->cksumInit) and every 200th byte\n** of the page data, starting with byte offset (pPager->pageSize%200).\n** Each byte is interpreted as an 8-bit unsigned integer.\n**\n** Changing the formula used to compute this checksum results in an\n** incompatible journal file format.\n**\n** If journal corruption occurs due to a power failure, the most likely \n** scenario is that one end or the other of the record will be changed. \n** It is much less likely that the two ends of the journal record will be\n** correct and the middle be corrupt.  Thus, this \"checksum\" scheme,\n** though fast and simple, catches the mostly likely kind of corruption.\n*/\nstatic u32 pager_cksum(Pager *pPager, const u8 *aData){\n  u32 cksum = pPager->cksumInit;         /* Checksum value to return */\n  int i = pPager->pageSize-200;          /* Loop counter */\n  while( i>0 ){\n    cksum += aData[i];\n    i -= 200;\n  }\n  return cksum;\n}\n\n/*\n** Report the current page size and number of reserved bytes back\n** to the codec.\n*/\n#ifdef SQLITE_HAS_CODEC\nstatic void pagerReportSize(Pager *pPager){\n  if( pPager->xCodecSizeChng ){\n    pPager->xCodecSizeChng(pPager->pCodec, pPager->pageSize,\n                           (int)pPager->nReserve);\n  }\n}\n#else\n# define pagerReportSize(X)     /* No-op if we do not support a codec */\n#endif\n\n#ifdef SQLITE_HAS_CODEC\n/*\n** Make sure the number of reserved bits is the same in the destination\n** pager as it is in the source.  This comes up when a VACUUM changes the\n** number of reserved bits to the \"optimal\" amount.\n*/\nvoid sqlite3PagerAlignReserve(Pager *pDest, Pager *pSrc){\n  if( pDest->nReserve!=pSrc->nReserve ){\n    pDest->nReserve = pSrc->nReserve;\n    pagerReportSize(pDest);\n  }\n}\n#endif\n\n/*\n** Read a single page from either the journal file (if isMainJrnl==1) or\n** from the sub-journal (if isMainJrnl==0) and playback that page.\n** The page begins at offset *pOffset into the file. The *pOffset\n** value is increased to the start of the next page in the journal.\n**\n** The main rollback journal uses checksums - the statement journal does \n** not.\n**\n** If the page number of the page record read from the (sub-)journal file\n** is greater than the current value of Pager.dbSize, then playback is\n** skipped and SQLITE_OK is returned.\n**\n** If pDone is not NULL, then it is a record of pages that have already\n** been played back.  If the page at *pOffset has already been played back\n** (if the corresponding pDone bit is set) then skip the playback.\n** Make sure the pDone bit corresponding to the *pOffset page is set\n** prior to returning.\n**\n** If the page record is successfully read from the (sub-)journal file\n** and played back, then SQLITE_OK is returned. If an IO error occurs\n** while reading the record from the (sub-)journal file or while writing\n** to the database file, then the IO error code is returned. If data\n** is successfully read from the (sub-)journal file but appears to be\n** corrupted, SQLITE_DONE is returned. Data is considered corrupted in\n** two circumstances:\n** \n**   * If the record page-number is illegal (0 or PAGER_MJ_PGNO), or\n**   * If the record is being rolled back from the main journal file\n**     and the checksum field does not match the record content.\n**\n** Neither of these two scenarios are possible during a savepoint rollback.\n**\n** If this is a savepoint rollback, then memory may have to be dynamically\n** allocated by this function. If this is the case and an allocation fails,\n** SQLITE_NOMEM is returned.\n*/\nstatic int pager_playback_one_page(\n  Pager *pPager,                /* The pager being played back */\n  i64 *pOffset,                 /* Offset of record to playback */\n  Bitvec *pDone,                /* Bitvec of pages already played back */\n  int isMainJrnl,               /* 1 -> main journal. 0 -> sub-journal. */\n  int isSavepnt                 /* True for a savepoint rollback */\n){\n  int rc;\n  PgHdr *pPg;                   /* An existing page in the cache */\n  Pgno pgno;                    /* The page number of a page in journal */\n  u32 cksum;                    /* Checksum used for sanity checking */\n  char *aData;                  /* Temporary storage for the page */\n  sqlite3_file *jfd;            /* The file descriptor for the journal file */\n  int isSynced;                 /* True if journal page is synced */\n\n  assert( (isMainJrnl&~1)==0 );      /* isMainJrnl is 0 or 1 */\n  assert( (isSavepnt&~1)==0 );       /* isSavepnt is 0 or 1 */\n  assert( isMainJrnl || pDone );     /* pDone always used on sub-journals */\n  assert( isSavepnt || pDone==0 );   /* pDone never used on non-savepoint */\n\n  aData = pPager->pTmpSpace;\n  assert( aData );         /* Temp storage must have already been allocated */\n  assert( pagerUseWal(pPager)==0 || (!isMainJrnl && isSavepnt) );\n\n  /* Either the state is greater than PAGER_WRITER_CACHEMOD (a transaction \n  ** or savepoint rollback done at the request of the caller) or this is\n  ** a hot-journal rollback. If it is a hot-journal rollback, the pager\n  ** is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback\n  ** only reads from the main journal, not the sub-journal.\n  */\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD\n       || (pPager->eState==PAGER_OPEN && pPager->eLock==EXCLUSIVE_LOCK)\n  );\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD || isMainJrnl );\n\n  /* Read the page number and page data from the journal or sub-journal\n  ** file. Return an error code to the caller if an IO error occurs.\n  */\n  jfd = isMainJrnl ? pPager->jfd : pPager->sjfd;\n  rc = read32bits(jfd, *pOffset, &pgno);\n  if( rc!=SQLITE_OK ) return rc;\n  rc = sqlite3OsRead(jfd, (u8*)aData, pPager->pageSize, (*pOffset)+4);\n  if( rc!=SQLITE_OK ) return rc;\n  *pOffset += pPager->pageSize + 4 + isMainJrnl*4;\n\n  /* Sanity checking on the page.  This is more important that I originally\n  ** thought.  If a power failure occurs while the journal is being written,\n  ** it could cause invalid data to be written into the journal.  We need to\n  ** detect this invalid data (with high probability) and ignore it.\n  */\n  if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){\n    assert( !isSavepnt );\n    return SQLITE_DONE;\n  }\n  if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){\n    return SQLITE_OK;\n  }\n  if( isMainJrnl ){\n    rc = read32bits(jfd, (*pOffset)-4, &cksum);\n    if( rc ) return rc;\n    if( !isSavepnt && pager_cksum(pPager, (u8*)aData)!=cksum ){\n      return SQLITE_DONE;\n    }\n  }\n\n  /* If this page has already been played back before during the current\n  ** rollback, then don't bother to play it back again.\n  */\n  if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){\n    return rc;\n  }\n\n  /* When playing back page 1, restore the nReserve setting\n  */\n  if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){\n    pPager->nReserve = ((u8*)aData)[20];\n    pagerReportSize(pPager);\n  }\n\n  /* If the pager is in CACHEMOD state, then there must be a copy of this\n  ** page in the pager cache. In this case just update the pager cache,\n  ** not the database file. The page is left marked dirty in this case.\n  **\n  ** An exception to the above rule: If the database is in no-sync mode\n  ** and a page is moved during an incremental vacuum then the page may\n  ** not be in the pager cache. Later: if a malloc() or IO error occurs\n  ** during a Movepage() call, then the page may not be in the cache\n  ** either. So the condition described in the above paragraph is not\n  ** assert()able.\n  **\n  ** If in WRITER_DBMOD, WRITER_FINISHED or OPEN state, then we update the\n  ** pager cache if it exists and the main file. The page is then marked \n  ** not dirty. Since this code is only executed in PAGER_OPEN state for\n  ** a hot-journal rollback, it is guaranteed that the page-cache is empty\n  ** if the pager is in OPEN state.\n  **\n  ** Ticket #1171:  The statement journal might contain page content that is\n  ** different from the page content at the start of the transaction.\n  ** This occurs when a page is changed prior to the start of a statement\n  ** then changed again within the statement.  When rolling back such a\n  ** statement we must not write to the original database unless we know\n  ** for certain that original page contents are synced into the main rollback\n  ** journal.  Otherwise, a power loss might leave modified data in the\n  ** database file without an entry in the rollback journal that can\n  ** restore the database to its original form.  Two conditions must be\n  ** met before writing to the database files. (1) the database must be\n  ** locked.  (2) we know that the original page content is fully synced\n  ** in the main journal either because the page is not in cache or else\n  ** the page is marked as needSync==0.\n  **\n  ** 2008-04-14:  When attempting to vacuum a corrupt database file, it\n  ** is possible to fail a statement on a database that does not yet exist.\n  ** Do not attempt to write if database file has never been opened.\n  */\n  if( pagerUseWal(pPager) ){\n    pPg = 0;\n  }else{\n    pPg = sqlite3PagerLookup(pPager, pgno);\n  }\n  assert( pPg || !MEMDB );\n  assert( pPager->eState!=PAGER_OPEN || pPg==0 || pPager->tempFile );\n  PAGERTRACE((\"PLAYBACK %d page %d hash(%08x) %s\\n\",\n           PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, (u8*)aData),\n           (isMainJrnl?\"main-journal\":\"sub-journal\")\n  ));\n  if( isMainJrnl ){\n    isSynced = pPager->noSync || (*pOffset <= pPager->journalHdr);\n  }else{\n    isSynced = (pPg==0 || 0==(pPg->flags & PGHDR_NEED_SYNC));\n  }\n  if( isOpen(pPager->fd)\n   && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)\n   && isSynced\n  ){\n    i64 ofst = (pgno-1)*(i64)pPager->pageSize;\n    testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 );\n    assert( !pagerUseWal(pPager) );\n    rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst);\n    if( pgno>pPager->dbFileSize ){\n      pPager->dbFileSize = pgno;\n    }\n    if( pPager->pBackup ){\n      CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);\n      sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);\n      CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData);\n    }\n  }else if( !isMainJrnl && pPg==0 ){\n    /* If this is a rollback of a savepoint and data was not written to\n    ** the database and the page is not in-memory, there is a potential\n    ** problem. When the page is next fetched by the b-tree layer, it \n    ** will be read from the database file, which may or may not be \n    ** current. \n    **\n    ** There are a couple of different ways this can happen. All are quite\n    ** obscure. When running in synchronous mode, this can only happen \n    ** if the page is on the free-list at the start of the transaction, then\n    ** populated, then moved using sqlite3PagerMovepage().\n    **\n    ** The solution is to add an in-memory page to the cache containing\n    ** the data just read from the sub-journal. Mark the page as dirty \n    ** and if the pager requires a journal-sync, then mark the page as \n    ** requiring a journal-sync before it is written.\n    */\n    assert( isSavepnt );\n    assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)==0 );\n    pPager->doNotSpill |= SPILLFLAG_ROLLBACK;\n    rc = sqlite3PagerGet(pPager, pgno, &pPg, 1);\n    assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)!=0 );\n    pPager->doNotSpill &= ~SPILLFLAG_ROLLBACK;\n    if( rc!=SQLITE_OK ) return rc;\n    sqlite3PcacheMakeDirty(pPg);\n  }\n  if( pPg ){\n    /* No page should ever be explicitly rolled back that is in use, except\n    ** for page 1 which is held in use in order to keep the lock on the\n    ** database active. However such a page may be rolled back as a result\n    ** of an internal error resulting in an automatic call to\n    ** sqlite3PagerRollback().\n    */\n    void *pData;\n    pData = pPg->pData;\n    memcpy(pData, (u8*)aData, pPager->pageSize);\n    pPager->xReiniter(pPg);\n    /* It used to be that sqlite3PcacheMakeClean(pPg) was called here.  But\n    ** that call was dangerous and had no detectable benefit since the cache\n    ** is normally cleaned by sqlite3PcacheCleanAll() after rollback and so\n    ** has been removed. */\n    pager_set_pagehash(pPg);\n\n    /* If this was page 1, then restore the value of Pager.dbFileVers.\n    ** Do this before any decoding. */\n    if( pgno==1 ){\n      memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers));\n    }\n\n    /* Decode the page just read from disk */\n    CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT);\n    sqlite3PcacheRelease(pPg);\n  }\n  return rc;\n}\n\n/*\n** Parameter zMaster is the name of a master journal file. A single journal\n** file that referred to the master journal file has just been rolled back.\n** This routine checks if it is possible to delete the master journal file,\n** and does so if it is.\n**\n** Argument zMaster may point to Pager.pTmpSpace. So that buffer is not \n** available for use within this function.\n**\n** When a master journal file is created, it is populated with the names \n** of all of its child journals, one after another, formatted as utf-8 \n** encoded text. The end of each child journal file is marked with a \n** nul-terminator byte (0x00). i.e. the entire contents of a master journal\n** file for a transaction involving two databases might be:\n**\n**   \"/home/bill/a.db-journal\\x00/home/bill/b.db-journal\\x00\"\n**\n** A master journal file may only be deleted once all of its child \n** journals have been rolled back.\n**\n** This function reads the contents of the master-journal file into \n** memory and loops through each of the child journal names. For\n** each child journal, it checks if:\n**\n**   * if the child journal exists, and if so\n**   * if the child journal contains a reference to master journal \n**     file zMaster\n**\n** If a child journal can be found that matches both of the criteria\n** above, this function returns without doing anything. Otherwise, if\n** no such child journal can be found, file zMaster is deleted from\n** the file-system using sqlite3OsDelete().\n**\n** If an IO error within this function, an error code is returned. This\n** function allocates memory by calling sqlite3Malloc(). If an allocation\n** fails, SQLITE_NOMEM is returned. Otherwise, if no IO or malloc errors \n** occur, SQLITE_OK is returned.\n**\n** TODO: This function allocates a single block of memory to load\n** the entire contents of the master journal file. This could be\n** a couple of kilobytes or so - potentially larger than the page \n** size.\n*/\nstatic int pager_delmaster(Pager *pPager, const char *zMaster){\n  sqlite3_vfs *pVfs = pPager->pVfs;\n  int rc;                   /* Return code */\n  sqlite3_file *pMaster;    /* Malloc'd master-journal file descriptor */\n  sqlite3_file *pJournal;   /* Malloc'd child-journal file descriptor */\n  char *zMasterJournal = 0; /* Contents of master journal file */\n  i64 nMasterJournal;       /* Size of master journal file */\n  char *zJournal;           /* Pointer to one journal within MJ file */\n  char *zMasterPtr;         /* Space to hold MJ filename from a journal file */\n  int nMasterPtr;           /* Amount of space allocated to zMasterPtr[] */\n\n  /* Allocate space for both the pJournal and pMaster file descriptors.\n  ** If successful, open the master journal file for reading.\n  */\n  pMaster = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2);\n  pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile);\n  if( !pMaster ){\n    rc = SQLITE_NOMEM_BKPT;\n  }else{\n    const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL);\n    rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0);\n  }\n  if( rc!=SQLITE_OK ) goto delmaster_out;\n\n  /* Load the entire master journal file into space obtained from\n  ** sqlite3_malloc() and pointed to by zMasterJournal.   Also obtain\n  ** sufficient space (in zMasterPtr) to hold the names of master\n  ** journal files extracted from regular rollback-journals.\n  */\n  rc = sqlite3OsFileSize(pMaster, &nMasterJournal);\n  if( rc!=SQLITE_OK ) goto delmaster_out;\n  nMasterPtr = pVfs->mxPathname+1;\n  zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 1);\n  if( !zMasterJournal ){\n    rc = SQLITE_NOMEM_BKPT;\n    goto delmaster_out;\n  }\n  zMasterPtr = &zMasterJournal[nMasterJournal+1];\n  rc = sqlite3OsRead(pMaster, zMasterJournal, (int)nMasterJournal, 0);\n  if( rc!=SQLITE_OK ) goto delmaster_out;\n  zMasterJournal[nMasterJournal] = 0;\n\n  zJournal = zMasterJournal;\n  while( (zJournal-zMasterJournal)<nMasterJournal ){\n    int exists;\n    rc = sqlite3OsAccess(pVfs, zJournal, SQLITE_ACCESS_EXISTS, &exists);\n    if( rc!=SQLITE_OK ){\n      goto delmaster_out;\n    }\n    if( exists ){\n      /* One of the journals pointed to by the master journal exists.\n      ** Open it and check if it points at the master journal. If\n      ** so, return without deleting the master journal file.\n      */\n      int c;\n      int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL);\n      rc = sqlite3OsOpen(pVfs, zJournal, pJournal, flags, 0);\n      if( rc!=SQLITE_OK ){\n        goto delmaster_out;\n      }\n\n      rc = readMasterJournal(pJournal, zMasterPtr, nMasterPtr);\n      sqlite3OsClose(pJournal);\n      if( rc!=SQLITE_OK ){\n        goto delmaster_out;\n      }\n\n      c = zMasterPtr[0]!=0 && strcmp(zMasterPtr, zMaster)==0;\n      if( c ){\n        /* We have a match. Do not delete the master journal file. */\n        goto delmaster_out;\n      }\n    }\n    zJournal += (sqlite3Strlen30(zJournal)+1);\n  }\n \n  sqlite3OsClose(pMaster);\n  rc = sqlite3OsDelete(pVfs, zMaster, 0);\n\ndelmaster_out:\n  sqlite3_free(zMasterJournal);\n  if( pMaster ){\n    sqlite3OsClose(pMaster);\n    assert( !isOpen(pJournal) );\n    sqlite3_free(pMaster);\n  }\n  return rc;\n}\n\n\n/*\n** This function is used to change the actual size of the database \n** file in the file-system. This only happens when committing a transaction,\n** or rolling back a transaction (including rolling back a hot-journal).\n**\n** If the main database file is not open, or the pager is not in either\n** DBMOD or OPEN state, this function is a no-op. Otherwise, the size \n** of the file is changed to nPage pages (nPage*pPager->pageSize bytes). \n** If the file on disk is currently larger than nPage pages, then use the VFS\n** xTruncate() method to truncate it.\n**\n** Or, it might be the case that the file on disk is smaller than \n** nPage pages. Some operating system implementations can get confused if \n** you try to truncate a file to some size that is larger than it \n** currently is, so detect this case and write a single zero byte to \n** the end of the new file instead.\n**\n** If successful, return SQLITE_OK. If an IO error occurs while modifying\n** the database file, return the error code to the caller.\n*/\nstatic int pager_truncate(Pager *pPager, Pgno nPage){\n  int rc = SQLITE_OK;\n  assert( pPager->eState!=PAGER_ERROR );\n  assert( pPager->eState!=PAGER_READER );\n  \n  if( isOpen(pPager->fd) \n   && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) \n  ){\n    i64 currentSize, newSize;\n    int szPage = pPager->pageSize;\n    assert( pPager->eLock==EXCLUSIVE_LOCK );\n    /* TODO: Is it safe to use Pager.dbFileSize here? */\n    rc = sqlite3OsFileSize(pPager->fd, &currentSize);\n    newSize = szPage*(i64)nPage;\n    if( rc==SQLITE_OK && currentSize!=newSize ){\n      if( currentSize>newSize ){\n        rc = sqlite3OsTruncate(pPager->fd, newSize);\n      }else if( (currentSize+szPage)<=newSize ){\n        char *pTmp = pPager->pTmpSpace;\n        memset(pTmp, 0, szPage);\n        testcase( (newSize-szPage) == currentSize );\n        testcase( (newSize-szPage) >  currentSize );\n        rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage);\n      }\n      if( rc==SQLITE_OK ){\n        pPager->dbFileSize = nPage;\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** Return a sanitized version of the sector-size of OS file pFile. The\n** return value is guaranteed to lie between 32 and MAX_SECTOR_SIZE.\n*/\nint sqlite3SectorSize(sqlite3_file *pFile){\n  int iRet = sqlite3OsSectorSize(pFile);\n  if( iRet<32 ){\n    iRet = 512;\n  }else if( iRet>MAX_SECTOR_SIZE ){\n    assert( MAX_SECTOR_SIZE>=512 );\n    iRet = MAX_SECTOR_SIZE;\n  }\n  return iRet;\n}\n\n/*\n** Set the value of the Pager.sectorSize variable for the given\n** pager based on the value returned by the xSectorSize method\n** of the open database file. The sector size will be used \n** to determine the size and alignment of journal header and \n** master journal pointers within created journal files.\n**\n** For temporary files the effective sector size is always 512 bytes.\n**\n** Otherwise, for non-temporary files, the effective sector size is\n** the value returned by the xSectorSize() method rounded up to 32 if\n** it is less than 32, or rounded down to MAX_SECTOR_SIZE if it\n** is greater than MAX_SECTOR_SIZE.\n**\n** If the file has the SQLITE_IOCAP_POWERSAFE_OVERWRITE property, then set\n** the effective sector size to its minimum value (512).  The purpose of\n** pPager->sectorSize is to define the \"blast radius\" of bytes that\n** might change if a crash occurs while writing to a single byte in\n** that range.  But with POWERSAFE_OVERWRITE, the blast radius is zero\n** (that is what POWERSAFE_OVERWRITE means), so we minimize the sector\n** size.  For backwards compatibility of the rollback journal file format,\n** we cannot reduce the effective sector size below 512.\n*/\nstatic void setSectorSize(Pager *pPager){\n  assert( isOpen(pPager->fd) || pPager->tempFile );\n\n  if( pPager->tempFile\n   || (sqlite3OsDeviceCharacteristics(pPager->fd) & \n              SQLITE_IOCAP_POWERSAFE_OVERWRITE)!=0\n  ){\n    /* Sector size doesn't matter for temporary files. Also, the file\n    ** may not have been opened yet, in which case the OsSectorSize()\n    ** call will segfault. */\n    pPager->sectorSize = 512;\n  }else{\n    pPager->sectorSize = sqlite3SectorSize(pPager->fd);\n  }\n}\n\n/*\n** Playback the journal and thus restore the database file to\n** the state it was in before we started making changes.  \n**\n** The journal file format is as follows: \n**\n**  (1)  8 byte prefix.  A copy of aJournalMagic[].\n**  (2)  4 byte big-endian integer which is the number of valid page records\n**       in the journal.  If this value is 0xffffffff, then compute the\n**       number of page records from the journal size.\n**  (3)  4 byte big-endian integer which is the initial value for the \n**       sanity checksum.\n**  (4)  4 byte integer which is the number of pages to truncate the\n**       database to during a rollback.\n**  (5)  4 byte big-endian integer which is the sector size.  The header\n**       is this many bytes in size.\n**  (6)  4 byte big-endian integer which is the page size.\n**  (7)  zero padding out to the next sector size.\n**  (8)  Zero or more pages instances, each as follows:\n**        +  4 byte page number.\n**        +  pPager->pageSize bytes of data.\n**        +  4 byte checksum\n**\n** When we speak of the journal header, we mean the first 7 items above.\n** Each entry in the journal is an instance of the 8th item.\n**\n** Call the value from the second bullet \"nRec\".  nRec is the number of\n** valid page entries in the journal.  In most cases, you can compute the\n** value of nRec from the size of the journal file.  But if a power\n** failure occurred while the journal was being written, it could be the\n** case that the size of the journal file had already been increased but\n** the extra entries had not yet made it safely to disk.  In such a case,\n** the value of nRec computed from the file size would be too large.  For\n** that reason, we always use the nRec value in the header.\n**\n** If the nRec value is 0xffffffff it means that nRec should be computed\n** from the file size.  This value is used when the user selects the\n** no-sync option for the journal.  A power failure could lead to corruption\n** in this case.  But for things like temporary table (which will be\n** deleted when the power is restored) we don't care.  \n**\n** If the file opened as the journal file is not a well-formed\n** journal file then all pages up to the first corrupted page are rolled\n** back (or no pages if the journal header is corrupted). The journal file\n** is then deleted and SQLITE_OK returned, just as if no corruption had\n** been encountered.\n**\n** If an I/O or malloc() error occurs, the journal-file is not deleted\n** and an error code is returned.\n**\n** The isHot parameter indicates that we are trying to rollback a journal\n** that might be a hot journal.  Or, it could be that the journal is \n** preserved because of JOURNALMODE_PERSIST or JOURNALMODE_TRUNCATE.\n** If the journal really is hot, reset the pager cache prior rolling\n** back any content.  If the journal is merely persistent, no reset is\n** needed.\n*/\nstatic int pager_playback(Pager *pPager, int isHot){\n  sqlite3_vfs *pVfs = pPager->pVfs;\n  i64 szJ;                 /* Size of the journal file in bytes */\n  u32 nRec;                /* Number of Records in the journal */\n  u32 u;                   /* Unsigned loop counter */\n  Pgno mxPg = 0;           /* Size of the original file in pages */\n  int rc;                  /* Result code of a subroutine */\n  int res = 1;             /* Value returned by sqlite3OsAccess() */\n  char *zMaster = 0;       /* Name of master journal file if any */\n  int needPagerReset;      /* True to reset page prior to first page rollback */\n  int nPlayback = 0;       /* Total number of pages restored from journal */\n\n  /* Figure out how many records are in the journal.  Abort early if\n  ** the journal is empty.\n  */\n  assert( isOpen(pPager->jfd) );\n  rc = sqlite3OsFileSize(pPager->jfd, &szJ);\n  if( rc!=SQLITE_OK ){\n    goto end_playback;\n  }\n\n  /* Read the master journal name from the journal, if it is present.\n  ** If a master journal file name is specified, but the file is not\n  ** present on disk, then the journal is not hot and does not need to be\n  ** played back.\n  **\n  ** TODO: Technically the following is an error because it assumes that\n  ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that\n  ** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c,\n  ** mxPathname is 512, which is the same as the minimum allowable value\n  ** for pageSize.\n  */\n  zMaster = pPager->pTmpSpace;\n  rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);\n  if( rc==SQLITE_OK && zMaster[0] ){\n    rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res);\n  }\n  zMaster = 0;\n  if( rc!=SQLITE_OK || !res ){\n    goto end_playback;\n  }\n  pPager->journalOff = 0;\n  needPagerReset = isHot;\n\n  /* This loop terminates either when a readJournalHdr() or \n  ** pager_playback_one_page() call returns SQLITE_DONE or an IO error \n  ** occurs. \n  */\n  while( 1 ){\n    /* Read the next journal header from the journal file.  If there are\n    ** not enough bytes left in the journal file for a complete header, or\n    ** it is corrupted, then a process must have failed while writing it.\n    ** This indicates nothing more needs to be rolled back.\n    */\n    rc = readJournalHdr(pPager, isHot, szJ, &nRec, &mxPg);\n    if( rc!=SQLITE_OK ){ \n      if( rc==SQLITE_DONE ){\n        rc = SQLITE_OK;\n      }\n      goto end_playback;\n    }\n\n    /* If nRec is 0xffffffff, then this journal was created by a process\n    ** working in no-sync mode. This means that the rest of the journal\n    ** file consists of pages, there are no more journal headers. Compute\n    ** the value of nRec based on this assumption.\n    */\n    if( nRec==0xffffffff ){\n      assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) );\n      nRec = (int)((szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager));\n    }\n\n    /* If nRec is 0 and this rollback is of a transaction created by this\n    ** process and if this is the final header in the journal, then it means\n    ** that this part of the journal was being filled but has not yet been\n    ** synced to disk.  Compute the number of pages based on the remaining\n    ** size of the file.\n    **\n    ** The third term of the test was added to fix ticket #2565.\n    ** When rolling back a hot journal, nRec==0 always means that the next\n    ** chunk of the journal contains zero pages to be rolled back.  But\n    ** when doing a ROLLBACK and the nRec==0 chunk is the last chunk in\n    ** the journal, it means that the journal might contain additional\n    ** pages that need to be rolled back and that the number of pages \n    ** should be computed based on the journal file size.\n    */\n    if( nRec==0 && !isHot &&\n        pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){\n      nRec = (int)((szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager));\n    }\n\n    /* If this is the first header read from the journal, truncate the\n    ** database file back to its original size.\n    */\n    if( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ){\n      rc = pager_truncate(pPager, mxPg);\n      if( rc!=SQLITE_OK ){\n        goto end_playback;\n      }\n      pPager->dbSize = mxPg;\n    }\n\n    /* Copy original pages out of the journal and back into the \n    ** database file and/or page cache.\n    */\n    for(u=0; u<nRec; u++){\n      if( needPagerReset ){\n        pager_reset(pPager);\n        needPagerReset = 0;\n      }\n      rc = pager_playback_one_page(pPager,&pPager->journalOff,0,1,0);\n      if( rc==SQLITE_OK ){\n        nPlayback++;\n      }else{\n        if( rc==SQLITE_DONE ){\n          pPager->journalOff = szJ;\n          break;\n        }else if( rc==SQLITE_IOERR_SHORT_READ ){\n          /* If the journal has been truncated, simply stop reading and\n          ** processing the journal. This might happen if the journal was\n          ** not completely written and synced prior to a crash.  In that\n          ** case, the database should have never been written in the\n          ** first place so it is OK to simply abandon the rollback. */\n          rc = SQLITE_OK;\n          goto end_playback;\n        }else{\n          /* If we are unable to rollback, quit and return the error\n          ** code.  This will cause the pager to enter the error state\n          ** so that no further harm will be done.  Perhaps the next\n          ** process to come along will be able to rollback the database.\n          */\n          goto end_playback;\n        }\n      }\n    }\n  }\n  /*NOTREACHED*/\n  assert( 0 );\n\nend_playback:\n  /* Following a rollback, the database file should be back in its original\n  ** state prior to the start of the transaction, so invoke the\n  ** SQLITE_FCNTL_DB_UNCHANGED file-control method to disable the\n  ** assertion that the transaction counter was modified.\n  */\n#ifdef SQLITE_DEBUG\n  if( pPager->fd->pMethods ){\n    sqlite3OsFileControlHint(pPager->fd,SQLITE_FCNTL_DB_UNCHANGED,0);\n  }\n#endif\n\n  /* If this playback is happening automatically as a result of an IO or \n  ** malloc error that occurred after the change-counter was updated but \n  ** before the transaction was committed, then the change-counter \n  ** modification may just have been reverted. If this happens in exclusive \n  ** mode, then subsequent transactions performed by the connection will not\n  ** update the change-counter at all. This may lead to cache inconsistency\n  ** problems for other processes at some point in the future. So, just\n  ** in case this has happened, clear the changeCountDone flag now.\n  */\n  pPager->changeCountDone = pPager->tempFile;\n\n  if( rc==SQLITE_OK ){\n    zMaster = pPager->pTmpSpace;\n    rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);\n    testcase( rc!=SQLITE_OK );\n  }\n  if( rc==SQLITE_OK\n   && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)\n  ){\n    rc = sqlite3PagerSync(pPager, 0);\n  }\n  if( rc==SQLITE_OK ){\n    rc = pager_end_transaction(pPager, zMaster[0]!='\\0', 0);\n    testcase( rc!=SQLITE_OK );\n  }\n  if( rc==SQLITE_OK && zMaster[0] && res ){\n    /* If there was a master journal and this routine will return success,\n    ** see if it is possible to delete the master journal.\n    */\n    rc = pager_delmaster(pPager, zMaster);\n    testcase( rc!=SQLITE_OK );\n  }\n  if( isHot && nPlayback ){\n    sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, \"recovered %d pages from %s\",\n                nPlayback, pPager->zJournal);\n  }\n\n  /* The Pager.sectorSize variable may have been updated while rolling\n  ** back a journal created by a process with a different sector size\n  ** value. Reset it to the correct value for this process.\n  */\n  setSectorSize(pPager);\n  return rc;\n}\n\n\n/*\n** Read the content for page pPg out of the database file and into \n** pPg->pData. A shared lock or greater must be held on the database\n** file before this function is called.\n**\n** If page 1 is read, then the value of Pager.dbFileVers[] is set to\n** the value read from the database file.\n**\n** If an IO error occurs, then the IO error is returned to the caller.\n** Otherwise, SQLITE_OK is returned.\n*/\nstatic int readDbPage(PgHdr *pPg, u32 iFrame){\n  Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */\n  Pgno pgno = pPg->pgno;       /* Page number to read */\n  int rc = SQLITE_OK;          /* Return code */\n  int pgsz = pPager->pageSize; /* Number of bytes to read */\n\n  assert( pPager->eState>=PAGER_READER && !MEMDB );\n  assert( isOpen(pPager->fd) );\n\n#ifndef SQLITE_OMIT_WAL\n  if( iFrame ){\n    /* Try to pull the page from the write-ahead log. */\n    rc = sqlite3WalReadFrame(pPager->pWal, iFrame, pgsz, pPg->pData);\n  }else\n#endif\n  {\n    i64 iOffset = (pgno-1)*(i64)pPager->pageSize;\n    rc = sqlite3OsRead(pPager->fd, pPg->pData, pgsz, iOffset);\n    if( rc==SQLITE_IOERR_SHORT_READ ){\n      rc = SQLITE_OK;\n    }\n  }\n\n  if( pgno==1 ){\n    if( rc ){\n      /* If the read is unsuccessful, set the dbFileVers[] to something\n      ** that will never be a valid file version.  dbFileVers[] is a copy\n      ** of bytes 24..39 of the database.  Bytes 28..31 should always be\n      ** zero or the size of the database in page. Bytes 32..35 and 35..39\n      ** should be page numbers which are never 0xffffffff.  So filling\n      ** pPager->dbFileVers[] with all 0xff bytes should suffice.\n      **\n      ** For an encrypted database, the situation is more complex:  bytes\n      ** 24..39 of the database are white noise.  But the probability of\n      ** white noise equaling 16 bytes of 0xff is vanishingly small so\n      ** we should still be ok.\n      */\n      memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers));\n    }else{\n      u8 *dbFileVers = &((u8*)pPg->pData)[24];\n      memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));\n    }\n  }\n  CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM_BKPT);\n\n  PAGER_INCR(sqlite3_pager_readdb_count);\n  PAGER_INCR(pPager->nRead);\n  IOTRACE((\"PGIN %p %d\\n\", pPager, pgno));\n  PAGERTRACE((\"FETCH %d page %d hash(%08x)\\n\",\n               PAGERID(pPager), pgno, pager_pagehash(pPg)));\n\n  return rc;\n}\n\n/*\n** Update the value of the change-counter at offsets 24 and 92 in\n** the header and the sqlite version number at offset 96.\n**\n** This is an unconditional update.  See also the pager_incr_changecounter()\n** routine which only updates the change-counter if the update is actually\n** needed, as determined by the pPager->changeCountDone state variable.\n*/\nstatic void pager_write_changecounter(PgHdr *pPg){\n  u32 change_counter;\n\n  /* Increment the value just read and write it back to byte 24. */\n  change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1;\n  put32bits(((char*)pPg->pData)+24, change_counter);\n\n  /* Also store the SQLite version number in bytes 96..99 and in\n  ** bytes 92..95 store the change counter for which the version number\n  ** is valid. */\n  put32bits(((char*)pPg->pData)+92, change_counter);\n  put32bits(((char*)pPg->pData)+96, SQLITE_VERSION_NUMBER);\n}\n\n#ifndef SQLITE_OMIT_WAL\n/*\n** This function is invoked once for each page that has already been \n** written into the log file when a WAL transaction is rolled back.\n** Parameter iPg is the page number of said page. The pCtx argument \n** is actually a pointer to the Pager structure.\n**\n** If page iPg is present in the cache, and has no outstanding references,\n** it is discarded. Otherwise, if there are one or more outstanding\n** references, the page content is reloaded from the database. If the\n** attempt to reload content from the database is required and fails, \n** return an SQLite error code. Otherwise, SQLITE_OK.\n*/\nstatic int pagerUndoCallback(void *pCtx, Pgno iPg){\n  int rc = SQLITE_OK;\n  Pager *pPager = (Pager *)pCtx;\n  PgHdr *pPg;\n\n  assert( pagerUseWal(pPager) );\n  pPg = sqlite3PagerLookup(pPager, iPg);\n  if( pPg ){\n    if( sqlite3PcachePageRefcount(pPg)==1 ){\n      sqlite3PcacheDrop(pPg);\n    }else{\n      u32 iFrame = 0;\n      rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);\n      if( rc==SQLITE_OK ){\n        rc = readDbPage(pPg, iFrame);\n      }\n      if( rc==SQLITE_OK ){\n        pPager->xReiniter(pPg);\n      }\n      sqlite3PagerUnrefNotNull(pPg);\n    }\n  }\n\n  /* Normally, if a transaction is rolled back, any backup processes are\n  ** updated as data is copied out of the rollback journal and into the\n  ** database. This is not generally possible with a WAL database, as\n  ** rollback involves simply truncating the log file. Therefore, if one\n  ** or more frames have already been written to the log (and therefore \n  ** also copied into the backup databases) as part of this transaction,\n  ** the backups must be restarted.\n  */\n  sqlite3BackupRestart(pPager->pBackup);\n\n  return rc;\n}\n\n/*\n** This function is called to rollback a transaction on a WAL database.\n*/\nstatic int pagerRollbackWal(Pager *pPager){\n  int rc;                         /* Return Code */\n  PgHdr *pList;                   /* List of dirty pages to revert */\n\n  /* For all pages in the cache that are currently dirty or have already\n  ** been written (but not committed) to the log file, do one of the \n  ** following:\n  **\n  **   + Discard the cached page (if refcount==0), or\n  **   + Reload page content from the database (if refcount>0).\n  */\n  pPager->dbSize = pPager->dbOrigSize;\n  rc = sqlite3WalUndo(pPager->pWal, pagerUndoCallback, (void *)pPager);\n  pList = sqlite3PcacheDirtyList(pPager->pPCache);\n  while( pList && rc==SQLITE_OK ){\n    PgHdr *pNext = pList->pDirty;\n    rc = pagerUndoCallback((void *)pPager, pList->pgno);\n    pList = pNext;\n  }\n\n  return rc;\n}\n\n/*\n** This function is a wrapper around sqlite3WalFrames(). As well as logging\n** the contents of the list of pages headed by pList (connected by pDirty),\n** this function notifies any active backup processes that the pages have\n** changed. \n**\n** The list of pages passed into this routine is always sorted by page number.\n** Hence, if page 1 appears anywhere on the list, it will be the first page.\n*/ \nstatic int pagerWalFrames(\n  Pager *pPager,                  /* Pager object */\n  PgHdr *pList,                   /* List of frames to log */\n  Pgno nTruncate,                 /* Database size after this commit */\n  int isCommit                    /* True if this is a commit */\n){\n  int rc;                         /* Return code */\n  int nList;                      /* Number of pages in pList */\n  PgHdr *p;                       /* For looping over pages */\n\n  assert( pPager->pWal );\n  assert( pList );\n#ifdef SQLITE_DEBUG\n  /* Verify that the page list is in accending order */\n  for(p=pList; p && p->pDirty; p=p->pDirty){\n    assert( p->pgno < p->pDirty->pgno );\n  }\n#endif\n\n  assert( pList->pDirty==0 || isCommit );\n  if( isCommit ){\n    /* If a WAL transaction is being committed, there is no point in writing\n    ** any pages with page numbers greater than nTruncate into the WAL file.\n    ** They will never be read by any client. So remove them from the pDirty\n    ** list here. */\n    PgHdr **ppNext = &pList;\n    nList = 0;\n    for(p=pList; (*ppNext = p)!=0; p=p->pDirty){\n      if( p->pgno<=nTruncate ){\n        ppNext = &p->pDirty;\n        nList++;\n      }\n    }\n    assert( pList );\n  }else{\n    nList = 1;\n  }\n  pPager->aStat[PAGER_STAT_WRITE] += nList;\n\n  if( pList->pgno==1 ) pager_write_changecounter(pList);\n  rc = sqlite3WalFrames(pPager->pWal, \n      pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags\n  );\n  if( rc==SQLITE_OK && pPager->pBackup ){\n    for(p=pList; p; p=p->pDirty){\n      sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData);\n    }\n  }\n\n#ifdef SQLITE_CHECK_PAGES\n  pList = sqlite3PcacheDirtyList(pPager->pPCache);\n  for(p=pList; p; p=p->pDirty){\n    pager_set_pagehash(p);\n  }\n#endif\n\n  return rc;\n}\n\n/*\n** Begin a read transaction on the WAL.\n**\n** This routine used to be called \"pagerOpenSnapshot()\" because it essentially\n** makes a snapshot of the database at the current point in time and preserves\n** that snapshot for use by the reader in spite of concurrently changes by\n** other writers or checkpointers.\n*/\nstatic int pagerBeginReadTransaction(Pager *pPager){\n  int rc;                         /* Return code */\n  int changed = 0;                /* True if cache must be reset */\n\n  assert( pagerUseWal(pPager) );\n  assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER );\n\n  /* sqlite3WalEndReadTransaction() was not called for the previous\n  ** transaction in locking_mode=EXCLUSIVE.  So call it now.  If we\n  ** are in locking_mode=NORMAL and EndRead() was previously called,\n  ** the duplicate call is harmless.\n  */\n  sqlite3WalEndReadTransaction(pPager->pWal);\n\n  rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed);\n  if( rc!=SQLITE_OK || changed ){\n    pager_reset(pPager);\n    if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);\n  }\n\n  return rc;\n}\n#endif\n\n/*\n** This function is called as part of the transition from PAGER_OPEN\n** to PAGER_READER state to determine the size of the database file\n** in pages (assuming the page size currently stored in Pager.pageSize).\n**\n** If no error occurs, SQLITE_OK is returned and the size of the database\n** in pages is stored in *pnPage. Otherwise, an error code (perhaps\n** SQLITE_IOERR_FSTAT) is returned and *pnPage is left unmodified.\n*/\nstatic int pagerPagecount(Pager *pPager, Pgno *pnPage){\n  Pgno nPage;                     /* Value to return via *pnPage */\n\n  /* Query the WAL sub-system for the database size. The WalDbsize()\n  ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or\n  ** if the database size is not available. The database size is not\n  ** available from the WAL sub-system if the log file is empty or\n  ** contains no valid committed transactions.\n  */\n  assert( pPager->eState==PAGER_OPEN );\n  assert( pPager->eLock>=SHARED_LOCK );\n  assert( isOpen(pPager->fd) );\n  assert( pPager->tempFile==0 );\n  nPage = sqlite3WalDbsize(pPager->pWal);\n\n  /* If the number of pages in the database is not available from the\n  ** WAL sub-system, determine the page counte based on the size of\n  ** the database file.  If the size of the database file is not an\n  ** integer multiple of the page-size, round up the result.\n  */\n  if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){\n    i64 n = 0;                    /* Size of db file in bytes */\n    int rc = sqlite3OsFileSize(pPager->fd, &n);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    nPage = (Pgno)((n+pPager->pageSize-1) / pPager->pageSize);\n  }\n\n  /* If the current number of pages in the file is greater than the\n  ** configured maximum pager number, increase the allowed limit so\n  ** that the file can be read.\n  */\n  if( nPage>pPager->mxPgno ){\n    pPager->mxPgno = (Pgno)nPage;\n  }\n\n  *pnPage = nPage;\n  return SQLITE_OK;\n}\n\n#ifndef SQLITE_OMIT_WAL\n/*\n** Check if the *-wal file that corresponds to the database opened by pPager\n** exists if the database is not empy, or verify that the *-wal file does\n** not exist (by deleting it) if the database file is empty.\n**\n** If the database is not empty and the *-wal file exists, open the pager\n** in WAL mode.  If the database is empty or if no *-wal file exists and\n** if no error occurs, make sure Pager.journalMode is not set to\n** PAGER_JOURNALMODE_WAL.\n**\n** Return SQLITE_OK or an error code.\n**\n** The caller must hold a SHARED lock on the database file to call this\n** function. Because an EXCLUSIVE lock on the db file is required to delete \n** a WAL on a none-empty database, this ensures there is no race condition \n** between the xAccess() below and an xDelete() being executed by some \n** other connection.\n*/\nstatic int pagerOpenWalIfPresent(Pager *pPager){\n  int rc = SQLITE_OK;\n  assert( pPager->eState==PAGER_OPEN );\n  assert( pPager->eLock>=SHARED_LOCK );\n\n  if( !pPager->tempFile ){\n    int isWal;                    /* True if WAL file exists */\n    Pgno nPage;                   /* Size of the database file */\n\n    rc = pagerPagecount(pPager, &nPage);\n    if( rc ) return rc;\n    if( nPage==0 ){\n      rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);\n      if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK;\n      isWal = 0;\n    }else{\n      rc = sqlite3OsAccess(\n          pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal\n      );\n    }\n    if( rc==SQLITE_OK ){\n      if( isWal ){\n        testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );\n        rc = sqlite3PagerOpenWal(pPager, 0);\n      }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){\n        pPager->journalMode = PAGER_JOURNALMODE_DELETE;\n      }\n    }\n  }\n  return rc;\n}\n#endif\n\n/*\n** Playback savepoint pSavepoint. Or, if pSavepoint==NULL, then playback\n** the entire master journal file. The case pSavepoint==NULL occurs when \n** a ROLLBACK TO command is invoked on a SAVEPOINT that is a transaction \n** savepoint.\n**\n** When pSavepoint is not NULL (meaning a non-transaction savepoint is \n** being rolled back), then the rollback consists of up to three stages,\n** performed in the order specified:\n**\n**   * Pages are played back from the main journal starting at byte\n**     offset PagerSavepoint.iOffset and continuing to \n**     PagerSavepoint.iHdrOffset, or to the end of the main journal\n**     file if PagerSavepoint.iHdrOffset is zero.\n**\n**   * If PagerSavepoint.iHdrOffset is not zero, then pages are played\n**     back starting from the journal header immediately following \n**     PagerSavepoint.iHdrOffset to the end of the main journal file.\n**\n**   * Pages are then played back from the sub-journal file, starting\n**     with the PagerSavepoint.iSubRec and continuing to the end of\n**     the journal file.\n**\n** Throughout the rollback process, each time a page is rolled back, the\n** corresponding bit is set in a bitvec structure (variable pDone in the\n** implementation below). This is used to ensure that a page is only\n** rolled back the first time it is encountered in either journal.\n**\n** If pSavepoint is NULL, then pages are only played back from the main\n** journal file. There is no need for a bitvec in this case.\n**\n** In either case, before playback commences the Pager.dbSize variable\n** is reset to the value that it held at the start of the savepoint \n** (or transaction). No page with a page-number greater than this value\n** is played back. If one is encountered it is simply skipped.\n*/\nstatic int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){\n  i64 szJ;                 /* Effective size of the main journal */\n  i64 iHdrOff;             /* End of first segment of main-journal records */\n  int rc = SQLITE_OK;      /* Return code */\n  Bitvec *pDone = 0;       /* Bitvec to ensure pages played back only once */\n\n  assert( pPager->eState!=PAGER_ERROR );\n  assert( pPager->eState>=PAGER_WRITER_LOCKED );\n\n  /* Allocate a bitvec to use to store the set of pages rolled back */\n  if( pSavepoint ){\n    pDone = sqlite3BitvecCreate(pSavepoint->nOrig);\n    if( !pDone ){\n      return SQLITE_NOMEM_BKPT;\n    }\n  }\n\n  /* Set the database size back to the value it was before the savepoint \n  ** being reverted was opened.\n  */\n  pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize;\n  pPager->changeCountDone = pPager->tempFile;\n\n  if( !pSavepoint && pagerUseWal(pPager) ){\n    return pagerRollbackWal(pPager);\n  }\n\n  /* Use pPager->journalOff as the effective size of the main rollback\n  ** journal.  The actual file might be larger than this in\n  ** PAGER_JOURNALMODE_TRUNCATE or PAGER_JOURNALMODE_PERSIST.  But anything\n  ** past pPager->journalOff is off-limits to us.\n  */\n  szJ = pPager->journalOff;\n  assert( pagerUseWal(pPager)==0 || szJ==0 );\n\n  /* Begin by rolling back records from the main journal starting at\n  ** PagerSavepoint.iOffset and continuing to the next journal header.\n  ** There might be records in the main journal that have a page number\n  ** greater than the current database size (pPager->dbSize) but those\n  ** will be skipped automatically.  Pages are added to pDone as they\n  ** are played back.\n  */\n  if( pSavepoint && !pagerUseWal(pPager) ){\n    iHdrOff = pSavepoint->iHdrOffset ? pSavepoint->iHdrOffset : szJ;\n    pPager->journalOff = pSavepoint->iOffset;\n    while( rc==SQLITE_OK && pPager->journalOff<iHdrOff ){\n      rc = pager_playback_one_page(pPager, &pPager->journalOff, pDone, 1, 1);\n    }\n    assert( rc!=SQLITE_DONE );\n  }else{\n    pPager->journalOff = 0;\n  }\n\n  /* Continue rolling back records out of the main journal starting at\n  ** the first journal header seen and continuing until the effective end\n  ** of the main journal file.  Continue to skip out-of-range pages and\n  ** continue adding pages rolled back to pDone.\n  */\n  while( rc==SQLITE_OK && pPager->journalOff<szJ ){\n    u32 ii;            /* Loop counter */\n    u32 nJRec = 0;     /* Number of Journal Records */\n    u32 dummy;\n    rc = readJournalHdr(pPager, 0, szJ, &nJRec, &dummy);\n    assert( rc!=SQLITE_DONE );\n\n    /*\n    ** The \"pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff\"\n    ** test is related to ticket #2565.  See the discussion in the\n    ** pager_playback() function for additional information.\n    */\n    if( nJRec==0 \n     && pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff\n    ){\n      nJRec = (u32)((szJ - pPager->journalOff)/JOURNAL_PG_SZ(pPager));\n    }\n    for(ii=0; rc==SQLITE_OK && ii<nJRec && pPager->journalOff<szJ; ii++){\n      rc = pager_playback_one_page(pPager, &pPager->journalOff, pDone, 1, 1);\n    }\n    assert( rc!=SQLITE_DONE );\n  }\n  assert( rc!=SQLITE_OK || pPager->journalOff>=szJ );\n\n  /* Finally,  rollback pages from the sub-journal.  Page that were\n  ** previously rolled back out of the main journal (and are hence in pDone)\n  ** will be skipped.  Out-of-range pages are also skipped.\n  */\n  if( pSavepoint ){\n    u32 ii;            /* Loop counter */\n    i64 offset = (i64)pSavepoint->iSubRec*(4+pPager->pageSize);\n\n    if( pagerUseWal(pPager) ){\n      rc = sqlite3WalSavepointUndo(pPager->pWal, pSavepoint->aWalData);\n    }\n    for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && ii<pPager->nSubRec; ii++){\n      assert( offset==(i64)ii*(4+pPager->pageSize) );\n      rc = pager_playback_one_page(pPager, &offset, pDone, 0, 1);\n    }\n    assert( rc!=SQLITE_DONE );\n  }\n\n  sqlite3BitvecDestroy(pDone);\n  if( rc==SQLITE_OK ){\n    pPager->journalOff = szJ;\n  }\n\n  return rc;\n}\n\n/*\n** Change the maximum number of in-memory pages that are allowed\n** before attempting to recycle clean and unused pages.\n*/\nvoid sqlite3PagerSetCachesize(Pager *pPager, int mxPage){\n  sqlite3PcacheSetCachesize(pPager->pPCache, mxPage);\n}\n\n/*\n** Change the maximum number of in-memory pages that are allowed\n** before attempting to spill pages to journal.\n*/\nint sqlite3PagerSetSpillsize(Pager *pPager, int mxPage){\n  return sqlite3PcacheSetSpillsize(pPager->pPCache, mxPage);\n}\n\n/*\n** Invoke SQLITE_FCNTL_MMAP_SIZE based on the current value of szMmap.\n*/\nstatic void pagerFixMaplimit(Pager *pPager){\n#if SQLITE_MAX_MMAP_SIZE>0\n  sqlite3_file *fd = pPager->fd;\n  if( isOpen(fd) && fd->pMethods->iVersion>=3 ){\n    sqlite3_int64 sz;\n    sz = pPager->szMmap;\n    pPager->bUseFetch = (sz>0);\n    sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_SIZE, &sz);\n  }\n#endif\n}\n\n/*\n** Change the maximum size of any memory mapping made of the database file.\n*/\nvoid sqlite3PagerSetMmapLimit(Pager *pPager, sqlite3_int64 szMmap){\n  pPager->szMmap = szMmap;\n  pagerFixMaplimit(pPager);\n}\n\n/*\n** Free as much memory as possible from the pager.\n*/\nvoid sqlite3PagerShrink(Pager *pPager){\n  sqlite3PcacheShrink(pPager->pPCache);\n}\n\n/*\n** Adjust settings of the pager to those specified in the pgFlags parameter.\n**\n** The \"level\" in pgFlags & PAGER_SYNCHRONOUS_MASK sets the robustness\n** of the database to damage due to OS crashes or power failures by\n** changing the number of syncs()s when writing the journals.\n** There are four levels:\n**\n**    OFF       sqlite3OsSync() is never called.  This is the default\n**              for temporary and transient files.\n**\n**    NORMAL    The journal is synced once before writes begin on the\n**              database.  This is normally adequate protection, but\n**              it is theoretically possible, though very unlikely,\n**              that an inopertune power failure could leave the journal\n**              in a state which would cause damage to the database\n**              when it is rolled back.\n**\n**    FULL      The journal is synced twice before writes begin on the\n**              database (with some additional information - the nRec field\n**              of the journal header - being written in between the two\n**              syncs).  If we assume that writing a\n**              single disk sector is atomic, then this mode provides\n**              assurance that the journal will not be corrupted to the\n**              point of causing damage to the database during rollback.\n**\n**    EXTRA     This is like FULL except that is also syncs the directory\n**              that contains the rollback journal after the rollback\n**              journal is unlinked.\n**\n** The above is for a rollback-journal mode.  For WAL mode, OFF continues\n** to mean that no syncs ever occur.  NORMAL means that the WAL is synced\n** prior to the start of checkpoint and that the database file is synced\n** at the conclusion of the checkpoint if the entire content of the WAL\n** was written back into the database.  But no sync operations occur for\n** an ordinary commit in NORMAL mode with WAL.  FULL means that the WAL\n** file is synced following each commit operation, in addition to the\n** syncs associated with NORMAL.  There is no difference between FULL\n** and EXTRA for WAL mode.\n**\n** Do not confuse synchronous=FULL with SQLITE_SYNC_FULL.  The\n** SQLITE_SYNC_FULL macro means to use the MacOSX-style full-fsync\n** using fcntl(F_FULLFSYNC).  SQLITE_SYNC_NORMAL means to do an\n** ordinary fsync() call.  There is no difference between SQLITE_SYNC_FULL\n** and SQLITE_SYNC_NORMAL on platforms other than MacOSX.  But the\n** synchronous=FULL versus synchronous=NORMAL setting determines when\n** the xSync primitive is called and is relevant to all platforms.\n**\n** Numeric values associated with these states are OFF==1, NORMAL=2,\n** and FULL=3.\n*/\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\nvoid sqlite3PagerSetFlags(\n  Pager *pPager,        /* The pager to set safety level for */\n  unsigned pgFlags      /* Various flags */\n){\n  unsigned level = pgFlags & PAGER_SYNCHRONOUS_MASK;\n  if( pPager->tempFile ){\n    pPager->noSync = 1;\n    pPager->fullSync = 0;\n    pPager->extraSync = 0;\n  }else{\n    pPager->noSync =  level==PAGER_SYNCHRONOUS_OFF ?1:0;\n    pPager->fullSync = level>=PAGER_SYNCHRONOUS_FULL ?1:0;\n    pPager->extraSync = level==PAGER_SYNCHRONOUS_EXTRA ?1:0;\n  }\n  if( pPager->noSync ){\n    pPager->syncFlags = 0;\n    pPager->ckptSyncFlags = 0;\n  }else if( pgFlags & PAGER_FULLFSYNC ){\n    pPager->syncFlags = SQLITE_SYNC_FULL;\n    pPager->ckptSyncFlags = SQLITE_SYNC_FULL;\n  }else if( pgFlags & PAGER_CKPT_FULLFSYNC ){\n    pPager->syncFlags = SQLITE_SYNC_NORMAL;\n    pPager->ckptSyncFlags = SQLITE_SYNC_FULL;\n  }else{\n    pPager->syncFlags = SQLITE_SYNC_NORMAL;\n    pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;\n  }\n  pPager->walSyncFlags = pPager->syncFlags;\n  if( pPager->fullSync ){\n    pPager->walSyncFlags |= WAL_SYNC_TRANSACTIONS;\n  }\n  if( pgFlags & PAGER_CACHESPILL ){\n    pPager->doNotSpill &= ~SPILLFLAG_OFF;\n  }else{\n    pPager->doNotSpill |= SPILLFLAG_OFF;\n  }\n}\n#endif\n\n/*\n** The following global variable is incremented whenever the library\n** attempts to open a temporary file.  This information is used for\n** testing and analysis only.  \n*/\n#ifdef SQLITE_TEST\nint sqlite3_opentemp_count = 0;\n#endif\n\n/*\n** Open a temporary file.\n**\n** Write the file descriptor into *pFile. Return SQLITE_OK on success \n** or some other error code if we fail. The OS will automatically \n** delete the temporary file when it is closed.\n**\n** The flags passed to the VFS layer xOpen() call are those specified\n** by parameter vfsFlags ORed with the following:\n**\n**     SQLITE_OPEN_READWRITE\n**     SQLITE_OPEN_CREATE\n**     SQLITE_OPEN_EXCLUSIVE\n**     SQLITE_OPEN_DELETEONCLOSE\n*/\nstatic int pagerOpentemp(\n  Pager *pPager,        /* The pager object */\n  sqlite3_file *pFile,  /* Write the file descriptor here */\n  int vfsFlags          /* Flags passed through to the VFS */\n){\n  int rc;               /* Return code */\n\n#ifdef SQLITE_TEST\n  sqlite3_opentemp_count++;  /* Used for testing and analysis only */\n#endif\n\n  vfsFlags |=  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |\n            SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE;\n  rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0);\n  assert( rc!=SQLITE_OK || isOpen(pFile) );\n  return rc;\n}\n\n/*\n** Set the busy handler function.\n**\n** The pager invokes the busy-handler if sqlite3OsLock() returns \n** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock,\n** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE \n** lock. It does *not* invoke the busy handler when upgrading from\n** SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE\n** (which occurs during hot-journal rollback). Summary:\n**\n**   Transition                        | Invokes xBusyHandler\n**   --------------------------------------------------------\n**   NO_LOCK       -> SHARED_LOCK      | Yes\n**   SHARED_LOCK   -> RESERVED_LOCK    | No\n**   SHARED_LOCK   -> EXCLUSIVE_LOCK   | No\n**   RESERVED_LOCK -> EXCLUSIVE_LOCK   | Yes\n**\n** If the busy-handler callback returns non-zero, the lock is \n** retried. If it returns zero, then the SQLITE_BUSY error is\n** returned to the caller of the pager API function.\n*/\nvoid sqlite3PagerSetBusyhandler(\n  Pager *pPager,                       /* Pager object */\n  int (*xBusyHandler)(void *),         /* Pointer to busy-handler function */\n  void *pBusyHandlerArg                /* Argument to pass to xBusyHandler */\n){\n  pPager->xBusyHandler = xBusyHandler;\n  pPager->pBusyHandlerArg = pBusyHandlerArg;\n\n  if( isOpen(pPager->fd) ){\n    void **ap = (void **)&pPager->xBusyHandler;\n    assert( ((int(*)(void *))(ap[0]))==xBusyHandler );\n    assert( ap[1]==pBusyHandlerArg );\n    sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_BUSYHANDLER, (void *)ap);\n  }\n}\n\n/*\n** Change the page size used by the Pager object. The new page size \n** is passed in *pPageSize.\n**\n** If the pager is in the error state when this function is called, it\n** is a no-op. The value returned is the error state error code (i.e. \n** one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL).\n**\n** Otherwise, if all of the following are true:\n**\n**   * the new page size (value of *pPageSize) is valid (a power \n**     of two between 512 and SQLITE_MAX_PAGE_SIZE, inclusive), and\n**\n**   * there are no outstanding page references, and\n**\n**   * the database is either not an in-memory database or it is\n**     an in-memory database that currently consists of zero pages.\n**\n** then the pager object page size is set to *pPageSize.\n**\n** If the page size is changed, then this function uses sqlite3PagerMalloc() \n** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt \n** fails, SQLITE_NOMEM is returned and the page size remains unchanged. \n** In all other cases, SQLITE_OK is returned.\n**\n** If the page size is not changed, either because one of the enumerated\n** conditions above is not true, the pager was in error state when this\n** function was called, or because the memory allocation attempt failed, \n** then *pPageSize is set to the old, retained page size before returning.\n*/\nint sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){\n  int rc = SQLITE_OK;\n\n  /* It is not possible to do a full assert_pager_state() here, as this\n  ** function may be called from within PagerOpen(), before the state\n  ** of the Pager object is internally consistent.\n  **\n  ** At one point this function returned an error if the pager was in \n  ** PAGER_ERROR state. But since PAGER_ERROR state guarantees that\n  ** there is at least one outstanding page reference, this function\n  ** is a no-op for that case anyhow.\n  */\n\n  u32 pageSize = *pPageSize;\n  assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );\n  if( (pPager->memDb==0 || pPager->dbSize==0)\n   && sqlite3PcacheRefCount(pPager->pPCache)==0 \n   && pageSize && pageSize!=(u32)pPager->pageSize \n  ){\n    char *pNew = NULL;             /* New temp space */\n    i64 nByte = 0;\n\n    if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){\n      rc = sqlite3OsFileSize(pPager->fd, &nByte);\n    }\n    if( rc==SQLITE_OK ){\n      pNew = (char *)sqlite3PageMalloc(pageSize);\n      if( !pNew ) rc = SQLITE_NOMEM_BKPT;\n    }\n\n    if( rc==SQLITE_OK ){\n      pager_reset(pPager);\n      rc = sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);\n    }\n    if( rc==SQLITE_OK ){\n      sqlite3PageFree(pPager->pTmpSpace);\n      pPager->pTmpSpace = pNew;\n      pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize);\n      pPager->pageSize = pageSize;\n    }else{\n      sqlite3PageFree(pNew);\n    }\n  }\n\n  *pPageSize = pPager->pageSize;\n  if( rc==SQLITE_OK ){\n    if( nReserve<0 ) nReserve = pPager->nReserve;\n    assert( nReserve>=0 && nReserve<1000 );\n    pPager->nReserve = (i16)nReserve;\n    pagerReportSize(pPager);\n    pagerFixMaplimit(pPager);\n  }\n  return rc;\n}\n\n/*\n** Return a pointer to the \"temporary page\" buffer held internally\n** by the pager.  This is a buffer that is big enough to hold the\n** entire content of a database page.  This buffer is used internally\n** during rollback and will be overwritten whenever a rollback\n** occurs.  But other modules are free to use it too, as long as\n** no rollbacks are happening.\n*/\nvoid *sqlite3PagerTempSpace(Pager *pPager){\n  return pPager->pTmpSpace;\n}\n\n/*\n** Attempt to set the maximum database page count if mxPage is positive. \n** Make no changes if mxPage is zero or negative.  And never reduce the\n** maximum page count below the current size of the database.\n**\n** Regardless of mxPage, return the current maximum page count.\n*/\nint sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){\n  if( mxPage>0 ){\n    pPager->mxPgno = mxPage;\n  }\n  assert( pPager->eState!=PAGER_OPEN );      /* Called only by OP_MaxPgcnt */\n  assert( pPager->mxPgno>=pPager->dbSize );  /* OP_MaxPgcnt enforces this */\n  return pPager->mxPgno;\n}\n\n/*\n** The following set of routines are used to disable the simulated\n** I/O error mechanism.  These routines are used to avoid simulated\n** errors in places where we do not care about errors.\n**\n** Unless -DSQLITE_TEST=1 is used, these routines are all no-ops\n** and generate no code.\n*/\n#ifdef SQLITE_TEST\nextern int sqlite3_io_error_pending;\nextern int sqlite3_io_error_hit;\nstatic int saved_cnt;\nvoid disable_simulated_io_errors(void){\n  saved_cnt = sqlite3_io_error_pending;\n  sqlite3_io_error_pending = -1;\n}\nvoid enable_simulated_io_errors(void){\n  sqlite3_io_error_pending = saved_cnt;\n}\n#else\n# define disable_simulated_io_errors()\n# define enable_simulated_io_errors()\n#endif\n\n/*\n** Read the first N bytes from the beginning of the file into memory\n** that pDest points to. \n**\n** If the pager was opened on a transient file (zFilename==\"\"), or\n** opened on a file less than N bytes in size, the output buffer is\n** zeroed and SQLITE_OK returned. The rationale for this is that this \n** function is used to read database headers, and a new transient or\n** zero sized database has a header than consists entirely of zeroes.\n**\n** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered,\n** the error code is returned to the caller and the contents of the\n** output buffer undefined.\n*/\nint sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){\n  int rc = SQLITE_OK;\n  memset(pDest, 0, N);\n  assert( isOpen(pPager->fd) || pPager->tempFile );\n\n  /* This routine is only called by btree immediately after creating\n  ** the Pager object.  There has not been an opportunity to transition\n  ** to WAL mode yet.\n  */\n  assert( !pagerUseWal(pPager) );\n\n  if( isOpen(pPager->fd) ){\n    IOTRACE((\"DBHDR %p 0 %d\\n\", pPager, N))\n    rc = sqlite3OsRead(pPager->fd, pDest, N, 0);\n    if( rc==SQLITE_IOERR_SHORT_READ ){\n      rc = SQLITE_OK;\n    }\n  }\n  return rc;\n}\n\n/*\n** This function may only be called when a read-transaction is open on\n** the pager. It returns the total number of pages in the database.\n**\n** However, if the file is between 1 and <page-size> bytes in size, then \n** this is considered a 1 page file.\n*/\nvoid sqlite3PagerPagecount(Pager *pPager, int *pnPage){\n  assert( pPager->eState>=PAGER_READER );\n  assert( pPager->eState!=PAGER_WRITER_FINISHED );\n  *pnPage = (int)pPager->dbSize;\n}\n\n\n/*\n** Try to obtain a lock of type locktype on the database file. If\n** a similar or greater lock is already held, this function is a no-op\n** (returning SQLITE_OK immediately).\n**\n** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke \n** the busy callback if the lock is currently not available. Repeat \n** until the busy callback returns false or until the attempt to \n** obtain the lock succeeds.\n**\n** Return SQLITE_OK on success and an error code if we cannot obtain\n** the lock. If the lock is obtained successfully, set the Pager.state \n** variable to locktype before returning.\n*/\nstatic int pager_wait_on_lock(Pager *pPager, int locktype){\n  int rc;                              /* Return code */\n\n  /* Check that this is either a no-op (because the requested lock is \n  ** already held), or one of the transitions that the busy-handler\n  ** may be invoked during, according to the comment above\n  ** sqlite3PagerSetBusyhandler().\n  */\n  assert( (pPager->eLock>=locktype)\n       || (pPager->eLock==NO_LOCK && locktype==SHARED_LOCK)\n       || (pPager->eLock==RESERVED_LOCK && locktype==EXCLUSIVE_LOCK)\n  );\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n  WCDBPagerSetWait(pPager, 1);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n  do {\n    rc = pagerLockDb(pPager, locktype);\n  }while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) );\n#if SQLITE_WCDB_SIGNAL_RETRY\n  WCDBPagerSetWait(pPager, 0);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n  return rc;\n}\n\n/*\n** Function assertTruncateConstraint(pPager) checks that one of the \n** following is true for all dirty pages currently in the page-cache:\n**\n**   a) The page number is less than or equal to the size of the \n**      current database image, in pages, OR\n**\n**   b) if the page content were written at this time, it would not\n**      be necessary to write the current content out to the sub-journal\n**      (as determined by function subjRequiresPage()).\n**\n** If the condition asserted by this function were not true, and the\n** dirty page were to be discarded from the cache via the pagerStress()\n** routine, pagerStress() would not write the current page content to\n** the database file. If a savepoint transaction were rolled back after\n** this happened, the correct behavior would be to restore the current\n** content of the page. However, since this content is not present in either\n** the database file or the portion of the rollback journal and \n** sub-journal rolled back the content could not be restored and the\n** database image would become corrupt. It is therefore fortunate that \n** this circumstance cannot arise.\n*/\n#if defined(SQLITE_DEBUG)\nstatic void assertTruncateConstraintCb(PgHdr *pPg){\n  assert( pPg->flags&PGHDR_DIRTY );\n  assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );\n}\nstatic void assertTruncateConstraint(Pager *pPager){\n  sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);\n}\n#else\n# define assertTruncateConstraint(pPager)\n#endif\n\n/*\n** Truncate the in-memory database file image to nPage pages. This \n** function does not actually modify the database file on disk. It \n** just sets the internal state of the pager object so that the \n** truncation will be done when the current transaction is committed.\n**\n** This function is only called right before committing a transaction.\n** Once this function has been called, the transaction must either be\n** rolled back or committed. It is not safe to call this function and\n** then continue writing to the database.\n*/\nvoid sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){\n  assert( pPager->dbSize>=nPage );\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD );\n  pPager->dbSize = nPage;\n\n  /* At one point the code here called assertTruncateConstraint() to\n  ** ensure that all pages being truncated away by this operation are,\n  ** if one or more savepoints are open, present in the savepoint \n  ** journal so that they can be restored if the savepoint is rolled\n  ** back. This is no longer necessary as this function is now only\n  ** called right before committing a transaction. So although the \n  ** Pager object may still have open savepoints (Pager.nSavepoint!=0), \n  ** they cannot be rolled back. So the assertTruncateConstraint() call\n  ** is no longer correct. */\n}\n\n\n/*\n** This function is called before attempting a hot-journal rollback. It\n** syncs the journal file to disk, then sets pPager->journalHdr to the\n** size of the journal file so that the pager_playback() routine knows\n** that the entire journal file has been synced.\n**\n** Syncing a hot-journal to disk before attempting to roll it back ensures \n** that if a power-failure occurs during the rollback, the process that\n** attempts rollback following system recovery sees the same journal\n** content as this process.\n**\n** If everything goes as planned, SQLITE_OK is returned. Otherwise, \n** an SQLite error code.\n*/\nstatic int pagerSyncHotJournal(Pager *pPager){\n  int rc = SQLITE_OK;\n  if( !pPager->noSync ){\n    rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_NORMAL);\n  }\n  if( rc==SQLITE_OK ){\n    rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr);\n  }\n  return rc;\n}\n\n/*\n** Obtain a reference to a memory mapped page object for page number pgno. \n** The new object will use the pointer pData, obtained from xFetch().\n** If successful, set *ppPage to point to the new page reference\n** and return SQLITE_OK. Otherwise, return an SQLite error code and set\n** *ppPage to zero.\n**\n** Page references obtained by calling this function should be released\n** by calling pagerReleaseMapPage().\n*/\nstatic int pagerAcquireMapPage(\n  Pager *pPager,                  /* Pager object */\n  Pgno pgno,                      /* Page number */\n  void *pData,                    /* xFetch()'d data for this page */\n  PgHdr **ppPage                  /* OUT: Acquired page object */\n){\n  PgHdr *p;                       /* Memory mapped page to return */\n  \n  if( pPager->pMmapFreelist ){\n    *ppPage = p = pPager->pMmapFreelist;\n    pPager->pMmapFreelist = p->pDirty;\n    p->pDirty = 0;\n    memset(p->pExtra, 0, pPager->nExtra);\n  }else{\n    *ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra);\n    if( p==0 ){\n      sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData);\n      return SQLITE_NOMEM_BKPT;\n    }\n    p->pExtra = (void *)&p[1];\n    p->flags = PGHDR_MMAP;\n    p->nRef = 1;\n    p->pPager = pPager;\n  }\n\n  assert( p->pExtra==(void *)&p[1] );\n  assert( p->pPage==0 );\n  assert( p->flags==PGHDR_MMAP );\n  assert( p->pPager==pPager );\n  assert( p->nRef==1 );\n\n  p->pgno = pgno;\n  p->pData = pData;\n  pPager->nMmapOut++;\n\n  return SQLITE_OK;\n}\n\n/*\n** Release a reference to page pPg. pPg must have been returned by an \n** earlier call to pagerAcquireMapPage().\n*/\nstatic void pagerReleaseMapPage(PgHdr *pPg){\n  Pager *pPager = pPg->pPager;\n  pPager->nMmapOut--;\n  pPg->pDirty = pPager->pMmapFreelist;\n  pPager->pMmapFreelist = pPg;\n\n  assert( pPager->fd->pMethods->iVersion>=3 );\n  sqlite3OsUnfetch(pPager->fd, (i64)(pPg->pgno-1)*pPager->pageSize, pPg->pData);\n}\n\n/*\n** Free all PgHdr objects stored in the Pager.pMmapFreelist list.\n*/\nstatic void pagerFreeMapHdrs(Pager *pPager){\n  PgHdr *p;\n  PgHdr *pNext;\n  for(p=pPager->pMmapFreelist; p; p=pNext){\n    pNext = p->pDirty;\n    sqlite3_free(p);\n  }\n}\n\n\n/*\n** Shutdown the page cache.  Free all memory and close all files.\n**\n** If a transaction was in progress when this routine is called, that\n** transaction is rolled back.  All outstanding pages are invalidated\n** and their memory is freed.  Any attempt to use a page associated\n** with this page cache after this function returns will likely\n** result in a coredump.\n**\n** This function always succeeds. If a transaction is active an attempt\n** is made to roll it back. If an error occurs during the rollback \n** a hot journal may be left in the filesystem but no error is returned\n** to the caller.\n*/\nint sqlite3PagerClose(Pager *pPager){\n  u8 *pTmp = (u8 *)pPager->pTmpSpace;\n\n  assert( assert_pager_state(pPager) );\n  disable_simulated_io_errors();\n  sqlite3BeginBenignMalloc();\n  pagerFreeMapHdrs(pPager);\n  /* pPager->errCode = 0; */\n  pPager->exclusiveMode = 0;\n#ifndef SQLITE_OMIT_WAL\n  sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp);\n  pPager->pWal = 0;\n#endif\n  pager_reset(pPager);\n  if( MEMDB ){\n    pager_unlock(pPager);\n  }else{\n    /* If it is open, sync the journal file before calling UnlockAndRollback.\n    ** If this is not done, then an unsynced portion of the open journal \n    ** file may be played back into the database. If a power failure occurs \n    ** while this is happening, the database could become corrupt.\n    **\n    ** If an error occurs while trying to sync the journal, shift the pager\n    ** into the ERROR state. This causes UnlockAndRollback to unlock the\n    ** database and close the journal file without attempting to roll it\n    ** back or finalize it. The next database user will have to do hot-journal\n    ** rollback before accessing the database file.\n    */\n    if( isOpen(pPager->jfd) ){\n      pager_error(pPager, pagerSyncHotJournal(pPager));\n    }\n    pagerUnlockAndRollback(pPager);\n  }\n  sqlite3EndBenignMalloc();\n  enable_simulated_io_errors();\n  PAGERTRACE((\"CLOSE %d\\n\", PAGERID(pPager)));\n  IOTRACE((\"CLOSE %p\\n\", pPager))\n  sqlite3OsClose(pPager->jfd);\n  sqlite3OsClose(pPager->fd);\n  sqlite3PageFree(pTmp);\n  sqlite3PcacheClose(pPager->pPCache);\n\n#ifdef SQLITE_HAS_CODEC\n  if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec);\n#endif\n\n  assert( !pPager->aSavepoint && !pPager->pInJournal );\n  assert( !isOpen(pPager->jfd) && !isOpen(pPager->sjfd) );\n\n  sqlite3_free(pPager);\n  return SQLITE_OK;\n}\n\n#if !defined(NDEBUG) || defined(SQLITE_TEST)\n/*\n** Return the page number for page pPg.\n*/\nPgno sqlite3PagerPagenumber(DbPage *pPg){\n  return pPg->pgno;\n}\n#endif\n\n/*\n** Increment the reference count for page pPg.\n*/\nvoid sqlite3PagerRef(DbPage *pPg){\n  sqlite3PcacheRef(pPg);\n}\n\n/*\n** Sync the journal. In other words, make sure all the pages that have\n** been written to the journal have actually reached the surface of the\n** disk and can be restored in the event of a hot-journal rollback.\n**\n** If the Pager.noSync flag is set, then this function is a no-op.\n** Otherwise, the actions required depend on the journal-mode and the \n** device characteristics of the file-system, as follows:\n**\n**   * If the journal file is an in-memory journal file, no action need\n**     be taken.\n**\n**   * Otherwise, if the device does not support the SAFE_APPEND property,\n**     then the nRec field of the most recently written journal header\n**     is updated to contain the number of journal records that have\n**     been written following it. If the pager is operating in full-sync\n**     mode, then the journal file is synced before this field is updated.\n**\n**   * If the device does not support the SEQUENTIAL property, then \n**     journal file is synced.\n**\n** Or, in pseudo-code:\n**\n**   if( NOT <in-memory journal> ){\n**     if( NOT SAFE_APPEND ){\n**       if( <full-sync mode> ) xSync(<journal file>);\n**       <update nRec field>\n**     } \n**     if( NOT SEQUENTIAL ) xSync(<journal file>);\n**   }\n**\n** If successful, this routine clears the PGHDR_NEED_SYNC flag of every \n** page currently held in memory before returning SQLITE_OK. If an IO\n** error is encountered, then the IO error code is returned to the caller.\n*/\nstatic int syncJournal(Pager *pPager, int newHdr){\n  int rc;                         /* Return code */\n\n  assert( pPager->eState==PAGER_WRITER_CACHEMOD\n       || pPager->eState==PAGER_WRITER_DBMOD\n  );\n  assert( assert_pager_state(pPager) );\n  assert( !pagerUseWal(pPager) );\n\n  rc = sqlite3PagerExclusiveLock(pPager);\n  if( rc!=SQLITE_OK ) return rc;\n\n  if( !pPager->noSync ){\n    assert( !pPager->tempFile );\n    if( isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){\n      const int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);\n      assert( isOpen(pPager->jfd) );\n\n      if( 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){\n        /* This block deals with an obscure problem. If the last connection\n        ** that wrote to this database was operating in persistent-journal\n        ** mode, then the journal file may at this point actually be larger\n        ** than Pager.journalOff bytes. If the next thing in the journal\n        ** file happens to be a journal-header (written as part of the\n        ** previous connection's transaction), and a crash or power-failure \n        ** occurs after nRec is updated but before this connection writes \n        ** anything else to the journal file (or commits/rolls back its \n        ** transaction), then SQLite may become confused when doing the \n        ** hot-journal rollback following recovery. It may roll back all\n        ** of this connections data, then proceed to rolling back the old,\n        ** out-of-date data that follows it. Database corruption.\n        **\n        ** To work around this, if the journal file does appear to contain\n        ** a valid header following Pager.journalOff, then write a 0x00\n        ** byte to the start of it to prevent it from being recognized.\n        **\n        ** Variable iNextHdrOffset is set to the offset at which this\n        ** problematic header will occur, if it exists. aMagic is used \n        ** as a temporary buffer to inspect the first couple of bytes of\n        ** the potential journal header.\n        */\n        i64 iNextHdrOffset;\n        u8 aMagic[8];\n        u8 zHeader[sizeof(aJournalMagic)+4];\n\n        memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic));\n        put32bits(&zHeader[sizeof(aJournalMagic)], pPager->nRec);\n\n        iNextHdrOffset = journalHdrOffset(pPager);\n        rc = sqlite3OsRead(pPager->jfd, aMagic, 8, iNextHdrOffset);\n        if( rc==SQLITE_OK && 0==memcmp(aMagic, aJournalMagic, 8) ){\n          static const u8 zerobyte = 0;\n          rc = sqlite3OsWrite(pPager->jfd, &zerobyte, 1, iNextHdrOffset);\n        }\n        if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){\n          return rc;\n        }\n\n        /* Write the nRec value into the journal file header. If in\n        ** full-synchronous mode, sync the journal first. This ensures that\n        ** all data has really hit the disk before nRec is updated to mark\n        ** it as a candidate for rollback.\n        **\n        ** This is not required if the persistent media supports the\n        ** SAFE_APPEND property. Because in this case it is not possible \n        ** for garbage data to be appended to the file, the nRec field\n        ** is populated with 0xFFFFFFFF when the journal header is written\n        ** and never needs to be updated.\n        */\n        if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){\n          PAGERTRACE((\"SYNC journal of %d\\n\", PAGERID(pPager)));\n          IOTRACE((\"JSYNC %p\\n\", pPager))\n          rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);\n          if( rc!=SQLITE_OK ) return rc;\n        }\n        IOTRACE((\"JHDR %p %lld\\n\", pPager, pPager->journalHdr));\n        rc = sqlite3OsWrite(\n            pPager->jfd, zHeader, sizeof(zHeader), pPager->journalHdr\n        );\n        if( rc!=SQLITE_OK ) return rc;\n      }\n      if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){\n        PAGERTRACE((\"SYNC journal of %d\\n\", PAGERID(pPager)));\n        IOTRACE((\"JSYNC %p\\n\", pPager))\n        rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags| \n          (pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)\n        );\n        if( rc!=SQLITE_OK ) return rc;\n      }\n\n      pPager->journalHdr = pPager->journalOff;\n      if( newHdr && 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){\n        pPager->nRec = 0;\n        rc = writeJournalHdr(pPager);\n        if( rc!=SQLITE_OK ) return rc;\n      }\n    }else{\n      pPager->journalHdr = pPager->journalOff;\n    }\n  }\n\n  /* Unless the pager is in noSync mode, the journal file was just \n  ** successfully synced. Either way, clear the PGHDR_NEED_SYNC flag on \n  ** all pages.\n  */\n  sqlite3PcacheClearSyncFlags(pPager->pPCache);\n  pPager->eState = PAGER_WRITER_DBMOD;\n  assert( assert_pager_state(pPager) );\n  return SQLITE_OK;\n}\n\n/*\n** The argument is the first in a linked list of dirty pages connected\n** by the PgHdr.pDirty pointer. This function writes each one of the\n** in-memory pages in the list to the database file. The argument may\n** be NULL, representing an empty list. In this case this function is\n** a no-op.\n**\n** The pager must hold at least a RESERVED lock when this function\n** is called. Before writing anything to the database file, this lock\n** is upgraded to an EXCLUSIVE lock. If the lock cannot be obtained,\n** SQLITE_BUSY is returned and no data is written to the database file.\n** \n** If the pager is a temp-file pager and the actual file-system file\n** is not yet open, it is created and opened before any data is \n** written out.\n**\n** Once the lock has been upgraded and, if necessary, the file opened,\n** the pages are written out to the database file in list order. Writing\n** a page is skipped if it meets either of the following criteria:\n**\n**   * The page number is greater than Pager.dbSize, or\n**   * The PGHDR_DONT_WRITE flag is set on the page.\n**\n** If writing out a page causes the database file to grow, Pager.dbFileSize\n** is updated accordingly. If page 1 is written out, then the value cached\n** in Pager.dbFileVers[] is updated to match the new value stored in\n** the database file.\n**\n** If everything is successful, SQLITE_OK is returned. If an IO error \n** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot\n** be obtained, SQLITE_BUSY is returned.\n*/\nstatic int pager_write_pagelist(Pager *pPager, PgHdr *pList){\n  int rc = SQLITE_OK;                  /* Return code */\n\n  /* This function is only called for rollback pagers in WRITER_DBMOD state. */\n  assert( !pagerUseWal(pPager) );\n  assert( pPager->tempFile || pPager->eState==PAGER_WRITER_DBMOD );\n  assert( pPager->eLock==EXCLUSIVE_LOCK );\n  assert( isOpen(pPager->fd) || pList->pDirty==0 );\n\n  /* If the file is a temp-file has not yet been opened, open it now. It\n  ** is not possible for rc to be other than SQLITE_OK if this branch\n  ** is taken, as pager_wait_on_lock() is a no-op for temp-files.\n  */\n  if( !isOpen(pPager->fd) ){\n    assert( pPager->tempFile && rc==SQLITE_OK );\n    rc = pagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);\n  }\n\n  /* Before the first write, give the VFS a hint of what the final\n  ** file size will be.\n  */\n  assert( rc!=SQLITE_OK || isOpen(pPager->fd) );\n  if( rc==SQLITE_OK \n   && pPager->dbHintSize<pPager->dbSize\n   && (pList->pDirty || pList->pgno>pPager->dbHintSize)\n  ){\n    sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize;\n    sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile);\n    pPager->dbHintSize = pPager->dbSize;\n  }\n\n  while( rc==SQLITE_OK && pList ){\n    Pgno pgno = pList->pgno;\n\n    /* If there are dirty pages in the page cache with page numbers greater\n    ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to\n    ** make the file smaller (presumably by auto-vacuum code). Do not write\n    ** any such pages to the file.\n    **\n    ** Also, do not write out any page that has the PGHDR_DONT_WRITE flag\n    ** set (set by sqlite3PagerDontWrite()).\n    */\n    if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){\n      i64 offset = (pgno-1)*(i64)pPager->pageSize;   /* Offset to write */\n      char *pData;                                   /* Data to write */    \n\n      assert( (pList->flags&PGHDR_NEED_SYNC)==0 );\n      if( pList->pgno==1 ) pager_write_changecounter(pList);\n\n      /* Encode the database */\n      CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM_BKPT, pData);\n\n      /* Write out the page data. */\n      rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);\n\n      /* If page 1 was just written, update Pager.dbFileVers to match\n      ** the value now stored in the database file. If writing this \n      ** page caused the database file to grow, update dbFileSize. \n      */\n      if( pgno==1 ){\n        memcpy(&pPager->dbFileVers, &pData[24], sizeof(pPager->dbFileVers));\n      }\n      if( pgno>pPager->dbFileSize ){\n        pPager->dbFileSize = pgno;\n      }\n      pPager->aStat[PAGER_STAT_WRITE]++;\n\n      /* Update any backup objects copying the contents of this pager. */\n      sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData);\n\n      PAGERTRACE((\"STORE %d page %d hash(%08x)\\n\",\n                   PAGERID(pPager), pgno, pager_pagehash(pList)));\n      IOTRACE((\"PGOUT %p %d\\n\", pPager, pgno));\n      PAGER_INCR(sqlite3_pager_writedb_count);\n    }else{\n      PAGERTRACE((\"NOSTORE %d page %d\\n\", PAGERID(pPager), pgno));\n    }\n    pager_set_pagehash(pList);\n    pList = pList->pDirty;\n  }\n\n  return rc;\n}\n\n/*\n** Ensure that the sub-journal file is open. If it is already open, this \n** function is a no-op.\n**\n** SQLITE_OK is returned if everything goes according to plan. An \n** SQLITE_IOERR_XXX error code is returned if a call to sqlite3OsOpen() \n** fails.\n*/\nstatic int openSubJournal(Pager *pPager){\n  int rc = SQLITE_OK;\n  if( !isOpen(pPager->sjfd) ){\n    const int flags =  SQLITE_OPEN_SUBJOURNAL | SQLITE_OPEN_READWRITE \n      | SQLITE_OPEN_CREATE | SQLITE_OPEN_EXCLUSIVE \n      | SQLITE_OPEN_DELETEONCLOSE;\n    int nStmtSpill = sqlite3Config.nStmtSpill;\n    if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){\n      nStmtSpill = -1;\n    }\n    rc = sqlite3JournalOpen(pPager->pVfs, 0, pPager->sjfd, flags, nStmtSpill);\n  }\n  return rc;\n}\n\n/*\n** Append a record of the current state of page pPg to the sub-journal. \n**\n** If successful, set the bit corresponding to pPg->pgno in the bitvecs\n** for all open savepoints before returning.\n**\n** This function returns SQLITE_OK if everything is successful, an IO\n** error code if the attempt to write to the sub-journal fails, or \n** SQLITE_NOMEM if a malloc fails while setting a bit in a savepoint\n** bitvec.\n*/\nstatic int subjournalPage(PgHdr *pPg){\n  int rc = SQLITE_OK;\n  Pager *pPager = pPg->pPager;\n  if( pPager->journalMode!=PAGER_JOURNALMODE_OFF ){\n\n    /* Open the sub-journal, if it has not already been opened */\n    assert( pPager->useJournal );\n    assert( isOpen(pPager->jfd) || pagerUseWal(pPager) );\n    assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 );\n    assert( pagerUseWal(pPager) \n         || pageInJournal(pPager, pPg) \n         || pPg->pgno>pPager->dbOrigSize \n    );\n    rc = openSubJournal(pPager);\n\n    /* If the sub-journal was opened successfully (or was already open),\n    ** write the journal record into the file.  */\n    if( rc==SQLITE_OK ){\n      void *pData = pPg->pData;\n      i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);\n      char *pData2;\n  \n      CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);\n      PAGERTRACE((\"STMT-JOURNAL %d page %d\\n\", PAGERID(pPager), pPg->pgno));\n      rc = write32bits(pPager->sjfd, offset, pPg->pgno);\n      if( rc==SQLITE_OK ){\n        rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);\n      }\n    }\n  }\n  if( rc==SQLITE_OK ){\n    pPager->nSubRec++;\n    assert( pPager->nSavepoint>0 );\n    rc = addToSavepointBitvecs(pPager, pPg->pgno);\n  }\n  return rc;\n}\nstatic int subjournalPageIfRequired(PgHdr *pPg){\n  if( subjRequiresPage(pPg) ){\n    return subjournalPage(pPg);\n  }else{\n    return SQLITE_OK;\n  }\n}\n\n/*\n** This function is called by the pcache layer when it has reached some\n** soft memory limit. The first argument is a pointer to a Pager object\n** (cast as a void*). The pager is always 'purgeable' (not an in-memory\n** database). The second argument is a reference to a page that is \n** currently dirty but has no outstanding references. The page\n** is always associated with the Pager object passed as the first \n** argument.\n**\n** The job of this function is to make pPg clean by writing its contents\n** out to the database file, if possible. This may involve syncing the\n** journal file. \n**\n** If successful, sqlite3PcacheMakeClean() is called on the page and\n** SQLITE_OK returned. If an IO error occurs while trying to make the\n** page clean, the IO error code is returned. If the page cannot be\n** made clean for some other reason, but no error occurs, then SQLITE_OK\n** is returned by sqlite3PcacheMakeClean() is not called.\n*/\nstatic int pagerStress(void *p, PgHdr *pPg){\n  Pager *pPager = (Pager *)p;\n  int rc = SQLITE_OK;\n\n  assert( pPg->pPager==pPager );\n  assert( pPg->flags&PGHDR_DIRTY );\n\n  /* The doNotSpill NOSYNC bit is set during times when doing a sync of\n  ** journal (and adding a new header) is not allowed.  This occurs\n  ** during calls to sqlite3PagerWrite() while trying to journal multiple\n  ** pages belonging to the same sector.\n  **\n  ** The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling\n  ** regardless of whether or not a sync is required.  This is set during\n  ** a rollback or by user request, respectively.\n  **\n  ** Spilling is also prohibited when in an error state since that could\n  ** lead to database corruption.   In the current implementation it \n  ** is impossible for sqlite3PcacheFetch() to be called with createFlag==3\n  ** while in the error state, hence it is impossible for this routine to\n  ** be called in the error state.  Nevertheless, we include a NEVER()\n  ** test for the error state as a safeguard against future changes.\n  */\n  if( NEVER(pPager->errCode) ) return SQLITE_OK;\n  testcase( pPager->doNotSpill & SPILLFLAG_ROLLBACK );\n  testcase( pPager->doNotSpill & SPILLFLAG_OFF );\n  testcase( pPager->doNotSpill & SPILLFLAG_NOSYNC );\n  if( pPager->doNotSpill\n   && ((pPager->doNotSpill & (SPILLFLAG_ROLLBACK|SPILLFLAG_OFF))!=0\n      || (pPg->flags & PGHDR_NEED_SYNC)!=0)\n  ){\n    return SQLITE_OK;\n  }\n\n  pPg->pDirty = 0;\n  if( pagerUseWal(pPager) ){\n    /* Write a single frame for this page to the log. */\n    rc = subjournalPageIfRequired(pPg); \n    if( rc==SQLITE_OK ){\n      rc = pagerWalFrames(pPager, pPg, 0, 0);\n    }\n  }else{\n  \n    /* Sync the journal file if required. */\n    if( pPg->flags&PGHDR_NEED_SYNC \n     || pPager->eState==PAGER_WRITER_CACHEMOD\n    ){\n      rc = syncJournal(pPager, 1);\n    }\n  \n    /* Write the contents of the page out to the database file. */\n    if( rc==SQLITE_OK ){\n      assert( (pPg->flags&PGHDR_NEED_SYNC)==0 );\n      rc = pager_write_pagelist(pPager, pPg);\n    }\n  }\n\n  /* Mark the page as clean. */\n  if( rc==SQLITE_OK ){\n    PAGERTRACE((\"STRESS %d page %d\\n\", PAGERID(pPager), pPg->pgno));\n    sqlite3PcacheMakeClean(pPg);\n  }\n\n  return pager_error(pPager, rc); \n}\n\n/*\n** Flush all unreferenced dirty pages to disk.\n*/\nint sqlite3PagerFlush(Pager *pPager){\n  int rc = pPager->errCode;\n  if( !MEMDB ){\n    PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);\n    assert( assert_pager_state(pPager) );\n    while( rc==SQLITE_OK && pList ){\n      PgHdr *pNext = pList->pDirty;\n      if( pList->nRef==0 ){\n        rc = pagerStress((void*)pPager, pList);\n      }\n      pList = pNext;\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Allocate and initialize a new Pager object and put a pointer to it\n** in *ppPager. The pager should eventually be freed by passing it\n** to sqlite3PagerClose().\n**\n** The zFilename argument is the path to the database file to open.\n** If zFilename is NULL then a randomly-named temporary file is created\n** and used as the file to be cached. Temporary files are be deleted\n** automatically when they are closed. If zFilename is \":memory:\" then \n** all information is held in cache. It is never written to disk. \n** This can be used to implement an in-memory database.\n**\n** The nExtra parameter specifies the number of bytes of space allocated\n** along with each page reference. This space is available to the user\n** via the sqlite3PagerGetExtra() API.\n**\n** The flags argument is used to specify properties that affect the\n** operation of the pager. It should be passed some bitwise combination\n** of the PAGER_* flags.\n**\n** The vfsFlags parameter is a bitmask to pass to the flags parameter\n** of the xOpen() method of the supplied VFS when opening files. \n**\n** If the pager object is allocated and the specified file opened \n** successfully, SQLITE_OK is returned and *ppPager set to point to\n** the new pager object. If an error occurs, *ppPager is set to NULL\n** and error code returned. This function may return SQLITE_NOMEM\n** (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or \n** various SQLITE_IO_XXX errors.\n*/\nint sqlite3PagerOpen(\n  sqlite3_vfs *pVfs,       /* The virtual file system to use */\n  Pager **ppPager,         /* OUT: Return the Pager structure here */\n  const char *zFilename,   /* Name of the database file to open */\n  int nExtra,              /* Extra bytes append to each in-memory page */\n  int flags,               /* flags controlling this file */\n  int vfsFlags,            /* flags passed through to sqlite3_vfs.xOpen() */\n  void (*xReinit)(DbPage*) /* Function to reinitialize pages */\n){\n  u8 *pPtr;\n  Pager *pPager = 0;       /* Pager object to allocate and return */\n  int rc = SQLITE_OK;      /* Return code */\n  int tempFile = 0;        /* True for temp files (incl. in-memory files) */\n  int memDb = 0;           /* True if this is an in-memory file */\n  int readOnly = 0;        /* True if this is a read-only file */\n  int journalFileSize;     /* Bytes to allocate for each journal fd */\n  char *zPathname = 0;     /* Full path to database file */\n  int nPathname = 0;       /* Number of bytes in zPathname */\n  int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */\n  int pcacheSize = sqlite3PcacheSize();       /* Bytes to allocate for PCache */\n  u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE;  /* Default page size */\n  const char *zUri = 0;    /* URI args to copy */\n  int nUri = 0;            /* Number of bytes of URI args at *zUri */\n\n  /* Figure out how much space is required for each journal file-handle\n  ** (there are two of them, the main journal and the sub-journal).  */\n  journalFileSize = ROUND8(sqlite3JournalSize(pVfs));\n\n  /* Set the output variable to NULL in case an error occurs. */\n  *ppPager = 0;\n\n#ifndef SQLITE_OMIT_MEMORYDB\n  if( flags & PAGER_MEMORY ){\n    memDb = 1;\n    if( zFilename && zFilename[0] ){\n      zPathname = sqlite3DbStrDup(0, zFilename);\n      if( zPathname==0  ) return SQLITE_NOMEM_BKPT;\n      nPathname = sqlite3Strlen30(zPathname);\n      zFilename = 0;\n    }\n  }\n#endif\n\n  /* Compute and store the full pathname in an allocated buffer pointed\n  ** to by zPathname, length nPathname. Or, if this is a temporary file,\n  ** leave both nPathname and zPathname set to 0.\n  */\n  if( zFilename && zFilename[0] ){\n    const char *z;\n    nPathname = pVfs->mxPathname+1;\n    zPathname = sqlite3DbMallocRaw(0, nPathname*2);\n    if( zPathname==0 ){\n      return SQLITE_NOMEM_BKPT;\n    }\n    zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */\n    rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);\n    nPathname = sqlite3Strlen30(zPathname);\n    z = zUri = &zFilename[sqlite3Strlen30(zFilename)+1];\n    while( *z ){\n      z += sqlite3Strlen30(z)+1;\n      z += sqlite3Strlen30(z)+1;\n    }\n    nUri = (int)(&z[1] - zUri);\n    assert( nUri>=0 );\n    if( rc==SQLITE_OK && nPathname+8>pVfs->mxPathname ){\n      /* This branch is taken when the journal path required by\n      ** the database being opened will be more than pVfs->mxPathname\n      ** bytes in length. This means the database cannot be opened,\n      ** as it will not be possible to open the journal file or even\n      ** check for a hot-journal before reading.\n      */\n      rc = SQLITE_CANTOPEN_BKPT;\n    }\n    if( rc!=SQLITE_OK ){\n      sqlite3DbFree(0, zPathname);\n      return rc;\n    }\n  }\n\n  /* Allocate memory for the Pager structure, PCache object, the\n  ** three file descriptors, the database file name and the journal \n  ** file name. The layout in memory is as follows:\n  **\n  **     Pager object                    (sizeof(Pager) bytes)\n  **     PCache object                   (sqlite3PcacheSize() bytes)\n  **     Database file handle            (pVfs->szOsFile bytes)\n  **     Sub-journal file handle         (journalFileSize bytes)\n  **     Main journal file handle        (journalFileSize bytes)\n  **     Database file name              (nPathname+1 bytes)\n  **     Journal file name               (nPathname+8+1 bytes)\n  */\n  pPtr = (u8 *)sqlite3MallocZero(\n    ROUND8(sizeof(*pPager)) +      /* Pager structure */\n    ROUND8(pcacheSize) +           /* PCache object */\n    ROUND8(pVfs->szOsFile) +       /* The main db file */\n    journalFileSize * 2 +          /* The two journal files */ \n    nPathname + 1 + nUri +         /* zFilename */\n    nPathname + 8 + 2              /* zJournal */\n#ifndef SQLITE_OMIT_WAL\n    + nPathname + 4 + 2            /* zWal */\n#endif\n  );\n  assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );\n  if( !pPtr ){\n    sqlite3DbFree(0, zPathname);\n    return SQLITE_NOMEM_BKPT;\n  }\n  pPager =              (Pager*)(pPtr);\n  pPager->pPCache =    (PCache*)(pPtr += ROUND8(sizeof(*pPager)));\n  pPager->fd =   (sqlite3_file*)(pPtr += ROUND8(pcacheSize));\n  pPager->sjfd = (sqlite3_file*)(pPtr += ROUND8(pVfs->szOsFile));\n  pPager->jfd =  (sqlite3_file*)(pPtr += journalFileSize);\n  pPager->zFilename =    (char*)(pPtr += journalFileSize);\n  assert( EIGHT_BYTE_ALIGNMENT(pPager->jfd) );\n\n  /* Fill in the Pager.zFilename and Pager.zJournal buffers, if required. */\n  if( zPathname ){\n    assert( nPathname>0 );\n    pPager->zJournal =   (char*)(pPtr += nPathname + 1 + nUri);\n    memcpy(pPager->zFilename, zPathname, nPathname);\n    if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUri);\n    memcpy(pPager->zJournal, zPathname, nPathname);\n    memcpy(&pPager->zJournal[nPathname], \"-journal\\000\", 8+2);\n    sqlite3FileSuffix3(pPager->zFilename, pPager->zJournal);\n#ifndef SQLITE_OMIT_WAL\n    pPager->zWal = &pPager->zJournal[nPathname+8+1];\n    memcpy(pPager->zWal, zPathname, nPathname);\n    memcpy(&pPager->zWal[nPathname], \"-wal\\000\", 4+1);\n    sqlite3FileSuffix3(pPager->zFilename, pPager->zWal);\n#endif\n    sqlite3DbFree(0, zPathname);\n  }\n  pPager->pVfs = pVfs;\n  pPager->vfsFlags = vfsFlags;\n\n  /* Open the pager file.\n  */\n  if( zFilename && zFilename[0] ){\n    int fout = 0;                    /* VFS flags returned by xOpen() */\n    rc = sqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd, vfsFlags, &fout);\n    assert( !memDb );\n    readOnly = (fout&SQLITE_OPEN_READONLY);\n\n    /* If the file was successfully opened for read/write access,\n    ** choose a default page size in case we have to create the\n    ** database file. The default page size is the maximum of:\n    **\n    **    + SQLITE_DEFAULT_PAGE_SIZE,\n    **    + The value returned by sqlite3OsSectorSize()\n    **    + The largest page size that can be written atomically.\n    */\n    if( rc==SQLITE_OK ){\n      int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);\n      if( !readOnly ){\n        setSectorSize(pPager);\n        assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE);\n        if( szPageDflt<pPager->sectorSize ){\n          if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){\n            szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE;\n          }else{\n            szPageDflt = (u32)pPager->sectorSize;\n          }\n        }\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\n        {\n          int ii;\n          assert(SQLITE_IOCAP_ATOMIC512==(512>>8));\n          assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));\n          assert(SQLITE_MAX_DEFAULT_PAGE_SIZE<=65536);\n          for(ii=szPageDflt; ii<=SQLITE_MAX_DEFAULT_PAGE_SIZE; ii=ii*2){\n            if( iDc&(SQLITE_IOCAP_ATOMIC|(ii>>8)) ){\n              szPageDflt = ii;\n            }\n          }\n        }\n#endif\n      }\n      pPager->noLock = sqlite3_uri_boolean(zFilename, \"nolock\", 0);\n      if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0\n       || sqlite3_uri_boolean(zFilename, \"immutable\", 0) ){\n          vfsFlags |= SQLITE_OPEN_READONLY;\n          goto act_like_temp_file;\n      }\n    }\n  }else{\n    /* If a temporary file is requested, it is not opened immediately.\n    ** In this case we accept the default page size and delay actually\n    ** opening the file until the first call to OsWrite().\n    **\n    ** This branch is also run for an in-memory database. An in-memory\n    ** database is the same as a temp-file that is never written out to\n    ** disk and uses an in-memory rollback journal.\n    **\n    ** This branch also runs for files marked as immutable.\n    */ \nact_like_temp_file:\n    tempFile = 1;\n    pPager->eState = PAGER_READER;     /* Pretend we already have a lock */\n    pPager->eLock = EXCLUSIVE_LOCK;    /* Pretend we are in EXCLUSIVE mode */\n    pPager->noLock = 1;                /* Do no locking */\n    readOnly = (vfsFlags&SQLITE_OPEN_READONLY);\n  }\n\n  /* The following call to PagerSetPagesize() serves to set the value of \n  ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer.\n  */\n  if( rc==SQLITE_OK ){\n    assert( pPager->memDb==0 );\n    rc = sqlite3PagerSetPagesize(pPager, &szPageDflt, -1);\n    testcase( rc!=SQLITE_OK );\n  }\n\n  /* Initialize the PCache object. */\n  if( rc==SQLITE_OK ){\n    assert( nExtra<1000 );\n    nExtra = ROUND8(nExtra);\n    rc = sqlite3PcacheOpen(szPageDflt, nExtra, !memDb,\n                       !memDb?pagerStress:0, (void *)pPager, pPager->pPCache);\n  }\n\n  /* If an error occurred above, free the  Pager structure and close the file.\n  */\n  if( rc!=SQLITE_OK ){\n    sqlite3OsClose(pPager->fd);\n    sqlite3PageFree(pPager->pTmpSpace);\n    sqlite3_free(pPager);\n    return rc;\n  }\n\n  PAGERTRACE((\"OPEN %d %s\\n\", FILEHANDLEID(pPager->fd), pPager->zFilename));\n  IOTRACE((\"OPEN %p %s\\n\", pPager, pPager->zFilename))\n\n  pPager->useJournal = (u8)useJournal;\n  /* pPager->stmtOpen = 0; */\n  /* pPager->stmtInUse = 0; */\n  /* pPager->nRef = 0; */\n  /* pPager->stmtSize = 0; */\n  /* pPager->stmtJSize = 0; */\n  /* pPager->nPage = 0; */\n  pPager->mxPgno = SQLITE_MAX_PAGE_COUNT;\n  /* pPager->state = PAGER_UNLOCK; */\n  /* pPager->errMask = 0; */\n  pPager->tempFile = (u8)tempFile;\n  assert( tempFile==PAGER_LOCKINGMODE_NORMAL \n          || tempFile==PAGER_LOCKINGMODE_EXCLUSIVE );\n  assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 );\n  pPager->exclusiveMode = (u8)tempFile; \n  pPager->changeCountDone = pPager->tempFile;\n  pPager->memDb = (u8)memDb;\n  pPager->readOnly = (u8)readOnly;\n  assert( useJournal || pPager->tempFile );\n  pPager->noSync = pPager->tempFile;\n  if( pPager->noSync ){\n    assert( pPager->fullSync==0 );\n    assert( pPager->extraSync==0 );\n    assert( pPager->syncFlags==0 );\n    assert( pPager->walSyncFlags==0 );\n    assert( pPager->ckptSyncFlags==0 );\n  }else{\n    pPager->fullSync = 1;\n    pPager->extraSync = 0;\n    pPager->syncFlags = SQLITE_SYNC_NORMAL;\n    pPager->walSyncFlags = SQLITE_SYNC_NORMAL | WAL_SYNC_TRANSACTIONS;\n    pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;\n  }\n  /* pPager->pFirst = 0; */\n  /* pPager->pFirstSynced = 0; */\n  /* pPager->pLast = 0; */\n  pPager->nExtra = (u16)nExtra;\n  pPager->journalSizeLimit = SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT;\n  assert( isOpen(pPager->fd) || tempFile );\n  setSectorSize(pPager);\n  if( !useJournal ){\n    pPager->journalMode = PAGER_JOURNALMODE_OFF;\n  }else if( memDb ){\n    pPager->journalMode = PAGER_JOURNALMODE_MEMORY;\n  }\n  /* pPager->xBusyHandler = 0; */\n  /* pPager->pBusyHandlerArg = 0; */\n  pPager->xReiniter = xReinit;\n  /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */\n  /* pPager->szMmap = SQLITE_DEFAULT_MMAP_SIZE // will be set by btree.c */\n\n  *ppPager = pPager;\n  return SQLITE_OK;\n}\n\n\n/* Verify that the database file has not be deleted or renamed out from\n** under the pager.  Return SQLITE_OK if the database is still were it ought\n** to be on disk.  Return non-zero (SQLITE_READONLY_DBMOVED or some other error\n** code from sqlite3OsAccess()) if the database has gone missing.\n*/\nstatic int databaseIsUnmoved(Pager *pPager){\n  int bHasMoved = 0;\n  int rc;\n\n  if( pPager->tempFile ) return SQLITE_OK;\n  if( pPager->dbSize==0 ) return SQLITE_OK;\n  assert( pPager->zFilename && pPager->zFilename[0] );\n  rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_HAS_MOVED, &bHasMoved);\n  if( rc==SQLITE_NOTFOUND ){\n    /* If the HAS_MOVED file-control is unimplemented, assume that the file\n    ** has not been moved.  That is the historical behavior of SQLite: prior to\n    ** version 3.8.3, it never checked */\n    rc = SQLITE_OK;\n  }else if( rc==SQLITE_OK && bHasMoved ){\n    rc = SQLITE_READONLY_DBMOVED;\n  }\n  return rc;\n}\n\n\n/*\n** This function is called after transitioning from PAGER_UNLOCK to\n** PAGER_SHARED state. It tests if there is a hot journal present in\n** the file-system for the given pager. A hot journal is one that \n** needs to be played back. According to this function, a hot-journal\n** file exists if the following criteria are met:\n**\n**   * The journal file exists in the file system, and\n**   * No process holds a RESERVED or greater lock on the database file, and\n**   * The database file itself is greater than 0 bytes in size, and\n**   * The first byte of the journal file exists and is not 0x00.\n**\n** If the current size of the database file is 0 but a journal file\n** exists, that is probably an old journal left over from a prior\n** database with the same name. In this case the journal file is\n** just deleted using OsDelete, *pExists is set to 0 and SQLITE_OK\n** is returned.\n**\n** This routine does not check if there is a master journal filename\n** at the end of the file. If there is, and that master journal file\n** does not exist, then the journal file is not really hot. In this\n** case this routine will return a false-positive. The pager_playback()\n** routine will discover that the journal file is not really hot and \n** will not roll it back. \n**\n** If a hot-journal file is found to exist, *pExists is set to 1 and \n** SQLITE_OK returned. If no hot-journal file is present, *pExists is\n** set to 0 and SQLITE_OK returned. If an IO error occurs while trying\n** to determine whether or not a hot-journal file exists, the IO error\n** code is returned and the value of *pExists is undefined.\n*/\nstatic int hasHotJournal(Pager *pPager, int *pExists){\n  sqlite3_vfs * const pVfs = pPager->pVfs;\n  int rc = SQLITE_OK;           /* Return code */\n  int exists = 1;               /* True if a journal file is present */\n  int jrnlOpen = !!isOpen(pPager->jfd);\n\n  assert( pPager->useJournal );\n  assert( isOpen(pPager->fd) );\n  assert( pPager->eState==PAGER_OPEN );\n\n  assert( jrnlOpen==0 || ( sqlite3OsDeviceCharacteristics(pPager->jfd) &\n    SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN\n  ));\n\n  *pExists = 0;\n  if( !jrnlOpen ){\n    rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);\n  }\n  if( rc==SQLITE_OK && exists ){\n    int locked = 0;             /* True if some process holds a RESERVED lock */\n\n    /* Race condition here:  Another process might have been holding the\n    ** the RESERVED lock and have a journal open at the sqlite3OsAccess() \n    ** call above, but then delete the journal and drop the lock before\n    ** we get to the following sqlite3OsCheckReservedLock() call.  If that\n    ** is the case, this routine might think there is a hot journal when\n    ** in fact there is none.  This results in a false-positive which will\n    ** be dealt with by the playback routine.  Ticket #3883.\n    */\n    rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);\n    if( rc==SQLITE_OK && !locked ){\n      Pgno nPage;                 /* Number of pages in database file */\n\n      assert( pPager->tempFile==0 );\n      rc = pagerPagecount(pPager, &nPage);\n      if( rc==SQLITE_OK ){\n        /* If the database is zero pages in size, that means that either (1) the\n        ** journal is a remnant from a prior database with the same name where\n        ** the database file but not the journal was deleted, or (2) the initial\n        ** transaction that populates a new database is being rolled back.\n        ** In either case, the journal file can be deleted.  However, take care\n        ** not to delete the journal file if it is already open due to\n        ** journal_mode=PERSIST.\n        */\n        if( nPage==0 && !jrnlOpen ){\n          sqlite3BeginBenignMalloc();\n          if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){\n            sqlite3OsDelete(pVfs, pPager->zJournal, 0);\n            if( !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);\n          }\n          sqlite3EndBenignMalloc();\n        }else{\n          /* The journal file exists and no other connection has a reserved\n          ** or greater lock on the database file. Now check that there is\n          ** at least one non-zero bytes at the start of the journal file.\n          ** If there is, then we consider this journal to be hot. If not, \n          ** it can be ignored.\n          */\n          if( !jrnlOpen ){\n            int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL;\n            rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f);\n          }\n          if( rc==SQLITE_OK ){\n            u8 first = 0;\n            rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0);\n            if( rc==SQLITE_IOERR_SHORT_READ ){\n              rc = SQLITE_OK;\n            }\n            if( !jrnlOpen ){\n              sqlite3OsClose(pPager->jfd);\n            }\n            *pExists = (first!=0);\n          }else if( rc==SQLITE_CANTOPEN ){\n            /* If we cannot open the rollback journal file in order to see if\n            ** it has a zero header, that might be due to an I/O error, or\n            ** it might be due to the race condition described above and in\n            ** ticket #3883.  Either way, assume that the journal is hot.\n            ** This might be a false positive.  But if it is, then the\n            ** automatic journal playback and recovery mechanism will deal\n            ** with it under an EXCLUSIVE lock where we do not need to\n            ** worry so much with race conditions.\n            */\n            *pExists = 1;\n            rc = SQLITE_OK;\n          }\n        }\n      }\n    }\n  }\n\n  return rc;\n}\n\n/*\n** This function is called to obtain a shared lock on the database file.\n** It is illegal to call sqlite3PagerGet() until after this function\n** has been successfully called. If a shared-lock is already held when\n** this function is called, it is a no-op.\n**\n** The following operations are also performed by this function.\n**\n**   1) If the pager is currently in PAGER_OPEN state (no lock held\n**      on the database file), then an attempt is made to obtain a\n**      SHARED lock on the database file. Immediately after obtaining\n**      the SHARED lock, the file-system is checked for a hot-journal,\n**      which is played back if present. Following any hot-journal \n**      rollback, the contents of the cache are validated by checking\n**      the 'change-counter' field of the database file header and\n**      discarded if they are found to be invalid.\n**\n**   2) If the pager is running in exclusive-mode, and there are currently\n**      no outstanding references to any pages, and is in the error state,\n**      then an attempt is made to clear the error state by discarding\n**      the contents of the page cache and rolling back any open journal\n**      file.\n**\n** If everything is successful, SQLITE_OK is returned. If an IO error \n** occurs while locking the database, checking for a hot-journal file or \n** rolling back a journal file, the IO error code is returned.\n*/\nint sqlite3PagerSharedLock(Pager *pPager){\n  int rc = SQLITE_OK;                /* Return code */\n\n  /* This routine is only called from b-tree and only when there are no\n  ** outstanding pages. This implies that the pager state should either\n  ** be OPEN or READER. READER is only possible if the pager is or was in \n  ** exclusive access mode.  */\n  assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );\n  assert( assert_pager_state(pPager) );\n  assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER );\n  assert( pPager->errCode==SQLITE_OK );\n\n  if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){\n    int bHotJournal = 1;          /* True if there exists a hot journal-file */\n\n    assert( !MEMDB );\n    assert( pPager->tempFile==0 || pPager->eLock==EXCLUSIVE_LOCK );\n\n    rc = pager_wait_on_lock(pPager, SHARED_LOCK);\n    if( rc!=SQLITE_OK ){\n      assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK );\n      goto failed;\n    }\n\n    /* If a journal file exists, and there is no RESERVED lock on the\n    ** database file, then it either needs to be played back or deleted.\n    */\n    if( pPager->eLock<=SHARED_LOCK ){\n      rc = hasHotJournal(pPager, &bHotJournal);\n    }\n    if( rc!=SQLITE_OK ){\n      goto failed;\n    }\n    if( bHotJournal ){\n      if( pPager->readOnly ){\n        rc = SQLITE_READONLY_ROLLBACK;\n        goto failed;\n      }\n\n      /* Get an EXCLUSIVE lock on the database file. At this point it is\n      ** important that a RESERVED lock is not obtained on the way to the\n      ** EXCLUSIVE lock. If it were, another process might open the\n      ** database file, detect the RESERVED lock, and conclude that the\n      ** database is safe to read while this process is still rolling the \n      ** hot-journal back.\n      ** \n      ** Because the intermediate RESERVED lock is not requested, any\n      ** other process attempting to access the database file will get to \n      ** this point in the code and fail to obtain its own EXCLUSIVE lock \n      ** on the database file.\n      **\n      ** Unless the pager is in locking_mode=exclusive mode, the lock is\n      ** downgraded to SHARED_LOCK before this function returns.\n      */\n      rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);\n      if( rc!=SQLITE_OK ){\n        goto failed;\n      }\n \n      /* If it is not already open and the file exists on disk, open the \n      ** journal for read/write access. Write access is required because \n      ** in exclusive-access mode the file descriptor will be kept open \n      ** and possibly used for a transaction later on. Also, write-access \n      ** is usually required to finalize the journal in journal_mode=persist \n      ** mode (and also for journal_mode=truncate on some systems).\n      **\n      ** If the journal does not exist, it usually means that some \n      ** other connection managed to get in and roll it back before \n      ** this connection obtained the exclusive lock above. Or, it \n      ** may mean that the pager was in the error-state when this\n      ** function was called and the journal file does not exist.\n      */\n      if( !isOpen(pPager->jfd) ){\n        sqlite3_vfs * const pVfs = pPager->pVfs;\n        int bExists;              /* True if journal file exists */\n        rc = sqlite3OsAccess(\n            pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists);\n        if( rc==SQLITE_OK && bExists ){\n          int fout = 0;\n          int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL;\n          assert( !pPager->tempFile );\n          rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout);\n          assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );\n          if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){\n            rc = SQLITE_CANTOPEN_BKPT;\n            sqlite3OsClose(pPager->jfd);\n          }\n        }\n      }\n \n      /* Playback and delete the journal.  Drop the database write\n      ** lock and reacquire the read lock. Purge the cache before\n      ** playing back the hot-journal so that we don't end up with\n      ** an inconsistent cache.  Sync the hot journal before playing\n      ** it back since the process that crashed and left the hot journal\n      ** probably did not sync it and we are required to always sync\n      ** the journal before playing it back.\n      */\n      if( isOpen(pPager->jfd) ){\n        assert( rc==SQLITE_OK );\n        rc = pagerSyncHotJournal(pPager);\n        if( rc==SQLITE_OK ){\n          rc = pager_playback(pPager, !pPager->tempFile);\n          pPager->eState = PAGER_OPEN;\n        }\n      }else if( !pPager->exclusiveMode ){\n        pagerUnlockDb(pPager, SHARED_LOCK);\n      }\n\n      if( rc!=SQLITE_OK ){\n        /* This branch is taken if an error occurs while trying to open\n        ** or roll back a hot-journal while holding an EXCLUSIVE lock. The\n        ** pager_unlock() routine will be called before returning to unlock\n        ** the file. If the unlock attempt fails, then Pager.eLock must be\n        ** set to UNKNOWN_LOCK (see the comment above the #define for \n        ** UNKNOWN_LOCK above for an explanation). \n        **\n        ** In order to get pager_unlock() to do this, set Pager.eState to\n        ** PAGER_ERROR now. This is not actually counted as a transition\n        ** to ERROR state in the state diagram at the top of this file,\n        ** since we know that the same call to pager_unlock() will very\n        ** shortly transition the pager object to the OPEN state. Calling\n        ** assert_pager_state() would fail now, as it should not be possible\n        ** to be in ERROR state when there are zero outstanding page \n        ** references.\n        */\n        pager_error(pPager, rc);\n        goto failed;\n      }\n\n      assert( pPager->eState==PAGER_OPEN );\n      assert( (pPager->eLock==SHARED_LOCK)\n           || (pPager->exclusiveMode && pPager->eLock>SHARED_LOCK)\n      );\n    }\n\n    if( !pPager->tempFile && pPager->hasHeldSharedLock ){\n      /* The shared-lock has just been acquired then check to\n      ** see if the database has been modified.  If the database has changed,\n      ** flush the cache.  The hasHeldSharedLock flag prevents this from\n      ** occurring on the very first access to a file, in order to save a\n      ** single unnecessary sqlite3OsRead() call at the start-up.\n      **\n      ** Database changes are detected by looking at 15 bytes beginning\n      ** at offset 24 into the file.  The first 4 of these 16 bytes are\n      ** a 32-bit counter that is incremented with each change.  The\n      ** other bytes change randomly with each file change when\n      ** a codec is in use.\n      ** \n      ** There is a vanishingly small chance that a change will not be \n      ** detected.  The chance of an undetected change is so small that\n      ** it can be neglected.\n      */\n      Pgno nPage = 0;\n      char dbFileVers[sizeof(pPager->dbFileVers)];\n\n      rc = pagerPagecount(pPager, &nPage);\n      if( rc ) goto failed;\n\n      if( nPage>0 ){\n        IOTRACE((\"CKVERS %p %d\\n\", pPager, sizeof(dbFileVers)));\n        rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);\n        if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){\n          goto failed;\n        }\n      }else{\n        memset(dbFileVers, 0, sizeof(dbFileVers));\n      }\n\n      if( memcmp(pPager->dbFileVers, dbFileVers, sizeof(dbFileVers))!=0 ){\n        pager_reset(pPager);\n\n        /* Unmap the database file. It is possible that external processes\n        ** may have truncated the database file and then extended it back\n        ** to its original size while this process was not holding a lock.\n        ** In this case there may exist a Pager.pMap mapping that appears\n        ** to be the right size but is not actually valid. Avoid this\n        ** possibility by unmapping the db here. */\n        if( USEFETCH(pPager) ){\n          sqlite3OsUnfetch(pPager->fd, 0, 0);\n        }\n      }\n    }\n\n    /* If there is a WAL file in the file-system, open this database in WAL\n    ** mode. Otherwise, the following function call is a no-op.\n    */\n    rc = pagerOpenWalIfPresent(pPager);\n#ifndef SQLITE_OMIT_WAL\n    assert( pPager->pWal==0 || rc==SQLITE_OK );\n#endif\n  }\n\n  if( pagerUseWal(pPager) ){\n    assert( rc==SQLITE_OK );\n    rc = pagerBeginReadTransaction(pPager);\n  }\n\n  if( pPager->tempFile==0 && pPager->eState==PAGER_OPEN && rc==SQLITE_OK ){\n    rc = pagerPagecount(pPager, &pPager->dbSize);\n  }\n\n failed:\n  if( rc!=SQLITE_OK ){\n    assert( !MEMDB );\n    pager_unlock(pPager);\n    assert( pPager->eState==PAGER_OPEN );\n  }else{\n    pPager->eState = PAGER_READER;\n    pPager->hasHeldSharedLock = 1;\n  }\n  return rc;\n}\n\n/*\n** If the reference count has reached zero, rollback any active\n** transaction and unlock the pager.\n**\n** Except, in locking_mode=EXCLUSIVE when there is nothing to in\n** the rollback journal, the unlock is not performed and there is\n** nothing to rollback, so this routine is a no-op.\n*/ \nstatic void pagerUnlockIfUnused(Pager *pPager){\n  if( pPager->nMmapOut==0 && (sqlite3PcacheRefCount(pPager->pPCache)==0) ){\n    pagerUnlockAndRollback(pPager);\n  }\n}\n\n/*\n** Acquire a reference to page number pgno in pager pPager (a page\n** reference has type DbPage*). If the requested reference is \n** successfully obtained, it is copied to *ppPage and SQLITE_OK returned.\n**\n** If the requested page is already in the cache, it is returned. \n** Otherwise, a new page object is allocated and populated with data\n** read from the database file. In some cases, the pcache module may\n** choose not to allocate a new page object and may reuse an existing\n** object with no outstanding references.\n**\n** The extra data appended to a page is always initialized to zeros the \n** first time a page is loaded into memory. If the page requested is \n** already in the cache when this function is called, then the extra\n** data is left as it was when the page object was last used.\n**\n** If the database image is smaller than the requested page or if a \n** non-zero value is passed as the noContent parameter and the \n** requested page is not already stored in the cache, then no \n** actual disk read occurs. In this case the memory image of the \n** page is initialized to all zeros. \n**\n** If noContent is true, it means that we do not care about the contents\n** of the page. This occurs in two scenarios:\n**\n**   a) When reading a free-list leaf page from the database, and\n**\n**   b) When a savepoint is being rolled back and we need to load\n**      a new page into the cache to be filled with the data read\n**      from the savepoint journal.\n**\n** If noContent is true, then the data returned is zeroed instead of\n** being read from the database. Additionally, the bits corresponding\n** to pgno in Pager.pInJournal (bitvec of pages already written to the\n** journal file) and the PagerSavepoint.pInSavepoint bitvecs of any open\n** savepoints are set. This means if the page is made writable at any\n** point in the future, using a call to sqlite3PagerWrite(), its contents\n** will not be journaled. This saves IO.\n**\n** The acquisition might fail for several reasons.  In all cases,\n** an appropriate error code is returned and *ppPage is set to NULL.\n**\n** See also sqlite3PagerLookup().  Both this routine and Lookup() attempt\n** to find a page in the in-memory cache first.  If the page is not already\n** in memory, this routine goes to disk to read it in whereas Lookup()\n** just returns 0.  This routine acquires a read-lock the first time it\n** has to go to disk, and could also playback an old journal if necessary.\n** Since Lookup() never goes to disk, it never has to deal with locks\n** or journal files.\n*/\nint sqlite3PagerGet(\n  Pager *pPager,      /* The pager open on the database file */\n  Pgno pgno,          /* Page number to fetch */\n  DbPage **ppPage,    /* Write a pointer to the page here */\n  int flags           /* PAGER_GET_XXX flags */\n){\n  int rc = SQLITE_OK;\n  PgHdr *pPg = 0;\n  u32 iFrame = 0;                 /* Frame to read from WAL file */\n  const int noContent = (flags & PAGER_GET_NOCONTENT);\n\n  /* It is acceptable to use a read-only (mmap) page for any page except\n  ** page 1 if there is no write-transaction open or the ACQUIRE_READONLY\n  ** flag was specified by the caller. And so long as the db is not a \n  ** temporary or in-memory database.  */\n  const int bMmapOk = (pgno>1 && USEFETCH(pPager)\n   && (pPager->eState==PAGER_READER || (flags & PAGER_GET_READONLY))\n#ifdef SQLITE_HAS_CODEC\n   && pPager->xCodec==0\n#endif\n  );\n\n  /* Optimization note:  Adding the \"pgno<=1\" term before \"pgno==0\" here\n  ** allows the compiler optimizer to reuse the results of the \"pgno>1\"\n  ** test in the previous statement, and avoid testing pgno==0 in the\n  ** common case where pgno is large. */\n  if( pgno<=1 && pgno==0 ){\n    return SQLITE_CORRUPT_BKPT;\n  }\n  assert( pPager->eState>=PAGER_READER );\n  assert( assert_pager_state(pPager) );\n  assert( noContent==0 || bMmapOk==0 );\n\n  assert( pPager->hasHeldSharedLock==1 );\n\n  /* If the pager is in the error state, return an error immediately. \n  ** Otherwise, request the page from the PCache layer. */\n  if( pPager->errCode!=SQLITE_OK ){\n    rc = pPager->errCode;\n  }else{\n    if( bMmapOk && pagerUseWal(pPager) ){\n      rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);\n      if( rc!=SQLITE_OK ) goto pager_acquire_err;\n    }\n\n    if( bMmapOk && iFrame==0 ){\n      void *pData = 0;\n\n      rc = sqlite3OsFetch(pPager->fd, \n          (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData\n      );\n\n      if( rc==SQLITE_OK && pData ){\n        if( pPager->eState>PAGER_READER || pPager->tempFile ){\n          pPg = sqlite3PagerLookup(pPager, pgno);\n        }\n        if( pPg==0 ){\n          rc = pagerAcquireMapPage(pPager, pgno, pData, &pPg);\n        }else{\n          sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1)*pPager->pageSize, pData);\n        }\n        if( pPg ){\n          assert( rc==SQLITE_OK );\n          *ppPage = pPg;\n          return SQLITE_OK;\n        }\n      }\n      if( rc!=SQLITE_OK ){\n        goto pager_acquire_err;\n      }\n    }\n\n    {\n      sqlite3_pcache_page *pBase;\n      pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3);\n      if( pBase==0 ){\n        rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase);\n        if( rc!=SQLITE_OK ) goto pager_acquire_err;\n        if( pBase==0 ){\n          pPg = *ppPage = 0;\n          rc = SQLITE_NOMEM_BKPT;\n          goto pager_acquire_err;\n        }\n      }\n      pPg = *ppPage = sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pBase);\n      assert( pPg!=0 );\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    /* Either the call to sqlite3PcacheFetch() returned an error or the\n    ** pager was already in the error-state when this function was called.\n    ** Set pPg to 0 and jump to the exception handler.  */\n    pPg = 0;\n    goto pager_acquire_err;\n  }\n  assert( pPg==(*ppPage) );\n  assert( pPg->pgno==pgno );\n  assert( pPg->pPager==pPager || pPg->pPager==0 );\n\n  if( pPg->pPager && !noContent ){\n    /* In this case the pcache already contains an initialized copy of\n    ** the page. Return without further ado.  */\n    assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) );\n    pPager->aStat[PAGER_STAT_HIT]++;\n    return SQLITE_OK;\n\n  }else{\n    /* The pager cache has created a new page. Its content needs to \n    ** be initialized.  */\n\n    pPg->pPager = pPager;\n\n    /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page\n    ** number greater than this, or the unused locking-page, is requested. */\n    if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){\n      rc = SQLITE_CORRUPT_BKPT;\n      goto pager_acquire_err;\n    }\n\n    assert( !isOpen(pPager->fd) || !MEMDB );\n    if( !isOpen(pPager->fd) || pPager->dbSize<pgno || noContent ){\n      if( pgno>pPager->mxPgno ){\n        rc = SQLITE_FULL;\n        goto pager_acquire_err;\n      }\n      if( noContent ){\n        /* Failure to set the bits in the InJournal bit-vectors is benign.\n        ** It merely means that we might do some extra work to journal a \n        ** page that does not need to be journaled.  Nevertheless, be sure \n        ** to test the case where a malloc error occurs while trying to set \n        ** a bit in a bit vector.\n        */\n        sqlite3BeginBenignMalloc();\n        if( pgno<=pPager->dbOrigSize ){\n          TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno);\n          testcase( rc==SQLITE_NOMEM );\n        }\n        TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno);\n        testcase( rc==SQLITE_NOMEM );\n        sqlite3EndBenignMalloc();\n      }\n      memset(pPg->pData, 0, pPager->pageSize);\n      IOTRACE((\"ZERO %p %d\\n\", pPager, pgno));\n    }else{\n      if( pagerUseWal(pPager) && bMmapOk==0 ){\n        rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);\n        if( rc!=SQLITE_OK ) goto pager_acquire_err;\n      }\n      assert( pPg->pPager==pPager );\n      pPager->aStat[PAGER_STAT_MISS]++;\n      rc = readDbPage(pPg, iFrame);\n      if( rc!=SQLITE_OK ){\n        goto pager_acquire_err;\n      }\n    }\n    pager_set_pagehash(pPg);\n  }\n\n  return SQLITE_OK;\n\npager_acquire_err:\n  assert( rc!=SQLITE_OK );\n  if( pPg ){\n    sqlite3PcacheDrop(pPg);\n  }\n  pagerUnlockIfUnused(pPager);\n\n  *ppPage = 0;\n  return rc;\n}\n\n/*\n** Acquire a page if it is already in the in-memory cache.  Do\n** not read the page from disk.  Return a pointer to the page,\n** or 0 if the page is not in cache. \n**\n** See also sqlite3PagerGet().  The difference between this routine\n** and sqlite3PagerGet() is that _get() will go to the disk and read\n** in the page if the page is not already in cache.  This routine\n** returns NULL if the page is not in cache or if a disk I/O error \n** has ever happened.\n*/\nDbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){\n  sqlite3_pcache_page *pPage;\n  assert( pPager!=0 );\n  assert( pgno!=0 );\n  assert( pPager->pPCache!=0 );\n  pPage = sqlite3PcacheFetch(pPager->pPCache, pgno, 0);\n  assert( pPage==0 || pPager->hasHeldSharedLock );\n  if( pPage==0 ) return 0;\n  return sqlite3PcacheFetchFinish(pPager->pPCache, pgno, pPage);\n}\n\n/*\n** Release a page reference.\n**\n** If the number of references to the page drop to zero, then the\n** page is added to the LRU list.  When all references to all pages\n** are released, a rollback occurs and the lock on the database is\n** removed.\n*/\nvoid sqlite3PagerUnrefNotNull(DbPage *pPg){\n  Pager *pPager;\n  assert( pPg!=0 );\n  pPager = pPg->pPager;\n  if( pPg->flags & PGHDR_MMAP ){\n    pagerReleaseMapPage(pPg);\n  }else{\n    sqlite3PcacheRelease(pPg);\n  }\n  pagerUnlockIfUnused(pPager);\n}\nvoid sqlite3PagerUnref(DbPage *pPg){\n  if( pPg ) sqlite3PagerUnrefNotNull(pPg);\n}\n\n/*\n** This function is called at the start of every write transaction.\n** There must already be a RESERVED or EXCLUSIVE lock on the database \n** file when this routine is called.\n**\n** Open the journal file for pager pPager and write a journal header\n** to the start of it. If there are active savepoints, open the sub-journal\n** as well. This function is only used when the journal file is being \n** opened to write a rollback log for a transaction. It is not used \n** when opening a hot journal file to roll it back.\n**\n** If the journal file is already open (as it may be in exclusive mode),\n** then this function just writes a journal header to the start of the\n** already open file. \n**\n** Whether or not the journal file is opened by this function, the\n** Pager.pInJournal bitvec structure is allocated.\n**\n** Return SQLITE_OK if everything is successful. Otherwise, return \n** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or \n** an IO error code if opening or writing the journal file fails.\n*/\nstatic int pager_open_journal(Pager *pPager){\n  int rc = SQLITE_OK;                        /* Return code */\n  sqlite3_vfs * const pVfs = pPager->pVfs;   /* Local cache of vfs pointer */\n\n  assert( pPager->eState==PAGER_WRITER_LOCKED );\n  assert( assert_pager_state(pPager) );\n  assert( pPager->pInJournal==0 );\n  \n  /* If already in the error state, this function is a no-op.  But on\n  ** the other hand, this routine is never called if we are already in\n  ** an error state. */\n  if( NEVER(pPager->errCode) ) return pPager->errCode;\n\n  if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){\n    pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize);\n    if( pPager->pInJournal==0 ){\n      return SQLITE_NOMEM_BKPT;\n    }\n  \n    /* Open the journal file if it is not already open. */\n    if( !isOpen(pPager->jfd) ){\n      if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){\n        sqlite3MemJournalOpen(pPager->jfd);\n      }else{\n        int flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;\n        int nSpill;\n\n        if( pPager->tempFile ){\n          flags |= (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL);\n          nSpill = sqlite3Config.nStmtSpill;\n        }else{\n          flags |= SQLITE_OPEN_MAIN_JOURNAL;\n          nSpill = jrnlBufferSize(pPager);\n        }\n          \n        /* Verify that the database still has the same name as it did when\n        ** it was originally opened. */\n        rc = databaseIsUnmoved(pPager);\n        if( rc==SQLITE_OK ){\n          rc = sqlite3JournalOpen (\n              pVfs, pPager->zJournal, pPager->jfd, flags, nSpill\n          );\n        }\n      }\n      assert( rc!=SQLITE_OK || isOpen(pPager->jfd) );\n    }\n  \n  \n    /* Write the first journal header to the journal file and open \n    ** the sub-journal if necessary.\n    */\n    if( rc==SQLITE_OK ){\n      /* TODO: Check if all of these are really required. */\n      pPager->nRec = 0;\n      pPager->journalOff = 0;\n      pPager->setMaster = 0;\n      pPager->journalHdr = 0;\n      rc = writeJournalHdr(pPager);\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    sqlite3BitvecDestroy(pPager->pInJournal);\n    pPager->pInJournal = 0;\n  }else{\n    assert( pPager->eState==PAGER_WRITER_LOCKED );\n    pPager->eState = PAGER_WRITER_CACHEMOD;\n  }\n\n  return rc;\n}\n\n/*\n** Begin a write-transaction on the specified pager object. If a \n** write-transaction has already been opened, this function is a no-op.\n**\n** If the exFlag argument is false, then acquire at least a RESERVED\n** lock on the database file. If exFlag is true, then acquire at least\n** an EXCLUSIVE lock. If such a lock is already held, no locking \n** functions need be called.\n**\n** If the subjInMemory argument is non-zero, then any sub-journal opened\n** within this transaction will be opened as an in-memory file. This\n** has no effect if the sub-journal is already opened (as it may be when\n** running in exclusive mode) or if the transaction does not require a\n** sub-journal. If the subjInMemory argument is zero, then any required\n** sub-journal is implemented in-memory if pPager is an in-memory database, \n** or using a temporary file otherwise.\n*/\nint sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){\n  int rc = SQLITE_OK;\n\n  if( pPager->errCode ) return pPager->errCode;\n  assert( pPager->eState>=PAGER_READER && pPager->eState<PAGER_ERROR );\n  pPager->subjInMemory = (u8)subjInMemory;\n\n  if( ALWAYS(pPager->eState==PAGER_READER) ){\n    assert( pPager->pInJournal==0 );\n\n    if( pagerUseWal(pPager) ){\n      /* If the pager is configured to use locking_mode=exclusive, and an\n      ** exclusive lock on the database is not already held, obtain it now.\n      */\n      if( pPager->exclusiveMode && sqlite3WalExclusiveMode(pPager->pWal, -1) ){\n        rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);\n        if( rc!=SQLITE_OK ){\n          return rc;\n        }\n        (void)sqlite3WalExclusiveMode(pPager->pWal, 1);\n      }\n\n      /* Grab the write lock on the log file. If successful, upgrade to\n      ** PAGER_RESERVED state. Otherwise, return an error code to the caller.\n      ** The busy-handler is not invoked if another connection already\n      ** holds the write-lock. If possible, the upper layer will call it.\n      */\n      rc = sqlite3WalBeginWriteTransaction(pPager->pWal);\n    }else{\n      /* Obtain a RESERVED lock on the database file. If the exFlag parameter\n      ** is true, then immediately upgrade this to an EXCLUSIVE lock. The\n      ** busy-handler callback can be used when upgrading to the EXCLUSIVE\n      ** lock, but not when obtaining the RESERVED lock.\n      */\n      rc = pagerLockDb(pPager, RESERVED_LOCK);\n      if( rc==SQLITE_OK && exFlag ){\n        rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);\n      }\n    }\n\n    if( rc==SQLITE_OK ){\n      /* Change to WRITER_LOCKED state.\n      **\n      ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD\n      ** when it has an open transaction, but never to DBMOD or FINISHED.\n      ** This is because in those states the code to roll back savepoint \n      ** transactions may copy data from the sub-journal into the database \n      ** file as well as into the page cache. Which would be incorrect in \n      ** WAL mode.\n      */\n      pPager->eState = PAGER_WRITER_LOCKED;\n      pPager->dbHintSize = pPager->dbSize;\n      pPager->dbFileSize = pPager->dbSize;\n      pPager->dbOrigSize = pPager->dbSize;\n      pPager->journalOff = 0;\n    }\n\n    assert( rc==SQLITE_OK || pPager->eState==PAGER_READER );\n    assert( rc!=SQLITE_OK || pPager->eState==PAGER_WRITER_LOCKED );\n    assert( assert_pager_state(pPager) );\n  }\n\n  PAGERTRACE((\"TRANSACTION %d\\n\", PAGERID(pPager)));\n  return rc;\n}\n\n/*\n** Write page pPg onto the end of the rollback journal.\n*/\nstatic SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){\n  Pager *pPager = pPg->pPager;\n  int rc;\n  u32 cksum;\n  char *pData2;\n  i64 iOff = pPager->journalOff;\n\n  /* We should never write to the journal file the page that\n  ** contains the database locks.  The following assert verifies\n  ** that we do not. */\n  assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );\n\n  assert( pPager->journalHdr<=pPager->journalOff );\n  CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);\n  cksum = pager_cksum(pPager, (u8*)pData2);\n\n  /* Even if an IO or diskfull error occurs while journalling the\n  ** page in the block above, set the need-sync flag for the page.\n  ** Otherwise, when the transaction is rolled back, the logic in\n  ** playback_one_page() will think that the page needs to be restored\n  ** in the database file. And if an IO error occurs while doing so,\n  ** then corruption may follow.\n  */\n  pPg->flags |= PGHDR_NEED_SYNC;\n\n  rc = write32bits(pPager->jfd, iOff, pPg->pgno);\n  if( rc!=SQLITE_OK ) return rc;\n  rc = sqlite3OsWrite(pPager->jfd, pData2, pPager->pageSize, iOff+4);\n  if( rc!=SQLITE_OK ) return rc;\n  rc = write32bits(pPager->jfd, iOff+pPager->pageSize+4, cksum);\n  if( rc!=SQLITE_OK ) return rc;\n\n  IOTRACE((\"JOUT %p %d %lld %d\\n\", pPager, pPg->pgno, \n           pPager->journalOff, pPager->pageSize));\n  PAGER_INCR(sqlite3_pager_writej_count);\n  PAGERTRACE((\"JOURNAL %d page %d needSync=%d hash(%08x)\\n\",\n       PAGERID(pPager), pPg->pgno, \n       ((pPg->flags&PGHDR_NEED_SYNC)?1:0), pager_pagehash(pPg)));\n\n  pPager->journalOff += 8 + pPager->pageSize;\n  pPager->nRec++;\n  assert( pPager->pInJournal!=0 );\n  rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);\n  testcase( rc==SQLITE_NOMEM );\n  assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );\n  rc |= addToSavepointBitvecs(pPager, pPg->pgno);\n  assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );\n  return rc;\n}\n\n/*\n** Mark a single data page as writeable. The page is written into the \n** main journal or sub-journal as required. If the page is written into\n** one of the journals, the corresponding bit is set in the \n** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs\n** of any open savepoints as appropriate.\n*/\nstatic int pager_write(PgHdr *pPg){\n  Pager *pPager = pPg->pPager;\n  int rc = SQLITE_OK;\n\n  /* This routine is not called unless a write-transaction has already \n  ** been started. The journal file may or may not be open at this point.\n  ** It is never called in the ERROR state.\n  */\n  assert( pPager->eState==PAGER_WRITER_LOCKED\n       || pPager->eState==PAGER_WRITER_CACHEMOD\n       || pPager->eState==PAGER_WRITER_DBMOD\n  );\n  assert( assert_pager_state(pPager) );\n  assert( pPager->errCode==0 );\n  assert( pPager->readOnly==0 );\n  CHECK_PAGE(pPg);\n\n  /* The journal file needs to be opened. Higher level routines have already\n  ** obtained the necessary locks to begin the write-transaction, but the\n  ** rollback journal might not yet be open. Open it now if this is the case.\n  **\n  ** This is done before calling sqlite3PcacheMakeDirty() on the page. \n  ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then\n  ** an error might occur and the pager would end up in WRITER_LOCKED state\n  ** with pages marked as dirty in the cache.\n  */\n  if( pPager->eState==PAGER_WRITER_LOCKED ){\n    rc = pager_open_journal(pPager);\n    if( rc!=SQLITE_OK ) return rc;\n  }\n  assert( pPager->eState>=PAGER_WRITER_CACHEMOD );\n  assert( assert_pager_state(pPager) );\n\n  /* Mark the page that is about to be modified as dirty. */\n  sqlite3PcacheMakeDirty(pPg);\n\n  /* If a rollback journal is in use, them make sure the page that is about\n  ** to change is in the rollback journal, or if the page is a new page off\n  ** then end of the file, make sure it is marked as PGHDR_NEED_SYNC.\n  */\n  assert( (pPager->pInJournal!=0) == isOpen(pPager->jfd) );\n  if( pPager->pInJournal!=0\n   && sqlite3BitvecTestNotNull(pPager->pInJournal, pPg->pgno)==0\n  ){\n    assert( pagerUseWal(pPager)==0 );\n    if( pPg->pgno<=pPager->dbOrigSize ){\n      rc = pagerAddPageToRollbackJournal(pPg);\n      if( rc!=SQLITE_OK ){\n        return rc;\n      }\n    }else{\n      if( pPager->eState!=PAGER_WRITER_DBMOD ){\n        pPg->flags |= PGHDR_NEED_SYNC;\n      }\n      PAGERTRACE((\"APPEND %d page %d needSync=%d\\n\",\n              PAGERID(pPager), pPg->pgno,\n             ((pPg->flags&PGHDR_NEED_SYNC)?1:0)));\n    }\n  }\n\n  /* The PGHDR_DIRTY bit is set above when the page was added to the dirty-list\n  ** and before writing the page into the rollback journal.  Wait until now,\n  ** after the page has been successfully journalled, before setting the\n  ** PGHDR_WRITEABLE bit that indicates that the page can be safely modified.\n  */\n  pPg->flags |= PGHDR_WRITEABLE;\n  \n  /* If the statement journal is open and the page is not in it,\n  ** then write the page into the statement journal.\n  */\n  if( pPager->nSavepoint>0 ){\n    rc = subjournalPageIfRequired(pPg);\n  }\n\n  /* Update the database size and return. */\n  if( pPager->dbSize<pPg->pgno ){\n    pPager->dbSize = pPg->pgno;\n  }\n  return rc;\n}\n\n/*\n** This is a variant of sqlite3PagerWrite() that runs when the sector size\n** is larger than the page size.  SQLite makes the (reasonable) assumption that\n** all bytes of a sector are written together by hardware.  Hence, all bytes of\n** a sector need to be journalled in case of a power loss in the middle of\n** a write.\n**\n** Usually, the sector size is less than or equal to the page size, in which\n** case pages can be individually written.  This routine only runs in the\n** exceptional case where the page size is smaller than the sector size.\n*/\nstatic SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){\n  int rc = SQLITE_OK;          /* Return code */\n  Pgno nPageCount;             /* Total number of pages in database file */\n  Pgno pg1;                    /* First page of the sector pPg is located on. */\n  int nPage = 0;               /* Number of pages starting at pg1 to journal */\n  int ii;                      /* Loop counter */\n  int needSync = 0;            /* True if any page has PGHDR_NEED_SYNC */\n  Pager *pPager = pPg->pPager; /* The pager that owns pPg */\n  Pgno nPagePerSector = (pPager->sectorSize/pPager->pageSize);\n\n  /* Set the doNotSpill NOSYNC bit to 1. This is because we cannot allow\n  ** a journal header to be written between the pages journaled by\n  ** this function.\n  */\n  assert( !MEMDB );\n  assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)==0 );\n  pPager->doNotSpill |= SPILLFLAG_NOSYNC;\n\n  /* This trick assumes that both the page-size and sector-size are\n  ** an integer power of 2. It sets variable pg1 to the identifier\n  ** of the first page of the sector pPg is located on.\n  */\n  pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1;\n\n  nPageCount = pPager->dbSize;\n  if( pPg->pgno>nPageCount ){\n    nPage = (pPg->pgno - pg1)+1;\n  }else if( (pg1+nPagePerSector-1)>nPageCount ){\n    nPage = nPageCount+1-pg1;\n  }else{\n    nPage = nPagePerSector;\n  }\n  assert(nPage>0);\n  assert(pg1<=pPg->pgno);\n  assert((pg1+nPage)>pPg->pgno);\n\n  for(ii=0; ii<nPage && rc==SQLITE_OK; ii++){\n    Pgno pg = pg1+ii;\n    PgHdr *pPage;\n    if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){\n      if( pg!=PAGER_MJ_PGNO(pPager) ){\n        rc = sqlite3PagerGet(pPager, pg, &pPage, 0);\n        if( rc==SQLITE_OK ){\n          rc = pager_write(pPage);\n          if( pPage->flags&PGHDR_NEED_SYNC ){\n            needSync = 1;\n          }\n          sqlite3PagerUnrefNotNull(pPage);\n        }\n      }\n    }else if( (pPage = sqlite3PagerLookup(pPager, pg))!=0 ){\n      if( pPage->flags&PGHDR_NEED_SYNC ){\n        needSync = 1;\n      }\n      sqlite3PagerUnrefNotNull(pPage);\n    }\n  }\n\n  /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages \n  ** starting at pg1, then it needs to be set for all of them. Because\n  ** writing to any of these nPage pages may damage the others, the\n  ** journal file must contain sync()ed copies of all of them\n  ** before any of them can be written out to the database file.\n  */\n  if( rc==SQLITE_OK && needSync ){\n    assert( !MEMDB );\n    for(ii=0; ii<nPage; ii++){\n      PgHdr *pPage = sqlite3PagerLookup(pPager, pg1+ii);\n      if( pPage ){\n        pPage->flags |= PGHDR_NEED_SYNC;\n        sqlite3PagerUnrefNotNull(pPage);\n      }\n    }\n  }\n\n  assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)!=0 );\n  pPager->doNotSpill &= ~SPILLFLAG_NOSYNC;\n  return rc;\n}\n\n/*\n** Mark a data page as writeable. This routine must be called before \n** making changes to a page. The caller must check the return value \n** of this function and be careful not to change any page data unless \n** this routine returns SQLITE_OK.\n**\n** The difference between this function and pager_write() is that this\n** function also deals with the special case where 2 or more pages\n** fit on a single disk sector. In this case all co-resident pages\n** must have been written to the journal file before returning.\n**\n** If an error occurs, SQLITE_NOMEM or an IO error code is returned\n** as appropriate. Otherwise, SQLITE_OK.\n*/\nint sqlite3PagerWrite(PgHdr *pPg){\n  Pager *pPager = pPg->pPager;\n  assert( (pPg->flags & PGHDR_MMAP)==0 );\n  assert( pPager->eState>=PAGER_WRITER_LOCKED );\n  assert( assert_pager_state(pPager) );\n  if( pPager->errCode ){\n    return pPager->errCode;\n  }else if( (pPg->flags & PGHDR_WRITEABLE)!=0 && pPager->dbSize>=pPg->pgno ){\n    if( pPager->nSavepoint ) return subjournalPageIfRequired(pPg);\n    return SQLITE_OK;\n  }else if( pPager->sectorSize > (u32)pPager->pageSize ){\n    assert( pPager->tempFile==0 );\n    return pagerWriteLargeSector(pPg);\n  }else{\n    return pager_write(pPg);\n  }\n}\n\n/*\n** Return TRUE if the page given in the argument was previously passed\n** to sqlite3PagerWrite().  In other words, return TRUE if it is ok\n** to change the content of the page.\n*/\n#ifndef NDEBUG\nint sqlite3PagerIswriteable(DbPage *pPg){\n  return pPg->flags & PGHDR_WRITEABLE;\n}\n#endif\n\n/*\n** A call to this routine tells the pager that it is not necessary to\n** write the information on page pPg back to the disk, even though\n** that page might be marked as dirty.  This happens, for example, when\n** the page has been added as a leaf of the freelist and so its\n** content no longer matters.\n**\n** The overlying software layer calls this routine when all of the data\n** on the given page is unused. The pager marks the page as clean so\n** that it does not get written to disk.\n**\n** Tests show that this optimization can quadruple the speed of large \n** DELETE operations.\n**\n** This optimization cannot be used with a temp-file, as the page may\n** have been dirty at the start of the transaction. In that case, if\n** memory pressure forces page pPg out of the cache, the data does need \n** to be written out to disk so that it may be read back in if the \n** current transaction is rolled back.\n*/\nvoid sqlite3PagerDontWrite(PgHdr *pPg){\n  Pager *pPager = pPg->pPager;\n  if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){\n    PAGERTRACE((\"DONT_WRITE page %d of %d\\n\", pPg->pgno, PAGERID(pPager)));\n    IOTRACE((\"CLEAN %p %d\\n\", pPager, pPg->pgno))\n    pPg->flags |= PGHDR_DONT_WRITE;\n    pPg->flags &= ~PGHDR_WRITEABLE;\n    testcase( pPg->flags & PGHDR_NEED_SYNC );\n    pager_set_pagehash(pPg);\n  }\n}\n\n/*\n** This routine is called to increment the value of the database file \n** change-counter, stored as a 4-byte big-endian integer starting at \n** byte offset 24 of the pager file.  The secondary change counter at\n** 92 is also updated, as is the SQLite version number at offset 96.\n**\n** But this only happens if the pPager->changeCountDone flag is false.\n** To avoid excess churning of page 1, the update only happens once.\n** See also the pager_write_changecounter() routine that does an \n** unconditional update of the change counters.\n**\n** If the isDirectMode flag is zero, then this is done by calling \n** sqlite3PagerWrite() on page 1, then modifying the contents of the\n** page data. In this case the file will be updated when the current\n** transaction is committed.\n**\n** The isDirectMode flag may only be non-zero if the library was compiled\n** with the SQLITE_ENABLE_ATOMIC_WRITE macro defined. In this case,\n** if isDirect is non-zero, then the database file is updated directly\n** by writing an updated version of page 1 using a call to the \n** sqlite3OsWrite() function.\n*/\nstatic int pager_incr_changecounter(Pager *pPager, int isDirectMode){\n  int rc = SQLITE_OK;\n\n  assert( pPager->eState==PAGER_WRITER_CACHEMOD\n       || pPager->eState==PAGER_WRITER_DBMOD\n  );\n  assert( assert_pager_state(pPager) );\n\n  /* Declare and initialize constant integer 'isDirect'. If the\n  ** atomic-write optimization is enabled in this build, then isDirect\n  ** is initialized to the value passed as the isDirectMode parameter\n  ** to this function. Otherwise, it is always set to zero.\n  **\n  ** The idea is that if the atomic-write optimization is not\n  ** enabled at compile time, the compiler can omit the tests of\n  ** 'isDirect' below, as well as the block enclosed in the\n  ** \"if( isDirect )\" condition.\n  */\n#ifndef SQLITE_ENABLE_ATOMIC_WRITE\n# define DIRECT_MODE 0\n  assert( isDirectMode==0 );\n  UNUSED_PARAMETER(isDirectMode);\n#else\n# define DIRECT_MODE isDirectMode\n#endif\n\n  if( !pPager->changeCountDone && ALWAYS(pPager->dbSize>0) ){\n    PgHdr *pPgHdr;                /* Reference to page 1 */\n\n    assert( !pPager->tempFile && isOpen(pPager->fd) );\n\n    /* Open page 1 of the file for writing. */\n    rc = sqlite3PagerGet(pPager, 1, &pPgHdr, 0);\n    assert( pPgHdr==0 || rc==SQLITE_OK );\n\n    /* If page one was fetched successfully, and this function is not\n    ** operating in direct-mode, make page 1 writable.  When not in \n    ** direct mode, page 1 is always held in cache and hence the PagerGet()\n    ** above is always successful - hence the ALWAYS on rc==SQLITE_OK.\n    */\n    if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){\n      rc = sqlite3PagerWrite(pPgHdr);\n    }\n\n    if( rc==SQLITE_OK ){\n      /* Actually do the update of the change counter */\n      pager_write_changecounter(pPgHdr);\n\n      /* If running in direct mode, write the contents of page 1 to the file. */\n      if( DIRECT_MODE ){\n        const void *zBuf;\n        assert( pPager->dbFileSize>0 );\n        CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM_BKPT, zBuf);\n        if( rc==SQLITE_OK ){\n          rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0);\n          pPager->aStat[PAGER_STAT_WRITE]++;\n        }\n        if( rc==SQLITE_OK ){\n          /* Update the pager's copy of the change-counter. Otherwise, the\n          ** next time a read transaction is opened the cache will be\n          ** flushed (as the change-counter values will not match).  */\n          const void *pCopy = (const void *)&((const char *)zBuf)[24];\n          memcpy(&pPager->dbFileVers, pCopy, sizeof(pPager->dbFileVers));\n          pPager->changeCountDone = 1;\n        }\n      }else{\n        pPager->changeCountDone = 1;\n      }\n    }\n\n    /* Release the page reference. */\n    sqlite3PagerUnref(pPgHdr);\n  }\n  return rc;\n}\n\n/*\n** Sync the database file to disk. This is a no-op for in-memory databases\n** or pages with the Pager.noSync flag set.\n**\n** If successful, or if called on a pager for which it is a no-op, this\n** function returns SQLITE_OK. Otherwise, an IO error code is returned.\n*/\nint sqlite3PagerSync(Pager *pPager, const char *zMaster){\n  int rc = SQLITE_OK;\n\n  if( isOpen(pPager->fd) ){\n    void *pArg = (void*)zMaster;\n    rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, pArg);\n    if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;\n  }\n  if( rc==SQLITE_OK && !pPager->noSync ){\n    assert( !MEMDB );\n    rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);\n  }\n  return rc;\n}\n\n/*\n** This function may only be called while a write-transaction is active in\n** rollback. If the connection is in WAL mode, this call is a no-op. \n** Otherwise, if the connection does not already have an EXCLUSIVE lock on \n** the database file, an attempt is made to obtain one.\n**\n** If the EXCLUSIVE lock is already held or the attempt to obtain it is\n** successful, or the connection is in WAL mode, SQLITE_OK is returned.\n** Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is \n** returned.\n*/\nint sqlite3PagerExclusiveLock(Pager *pPager){\n  int rc = pPager->errCode;\n  assert( assert_pager_state(pPager) );\n  if( rc==SQLITE_OK ){\n    assert( pPager->eState==PAGER_WRITER_CACHEMOD \n         || pPager->eState==PAGER_WRITER_DBMOD \n         || pPager->eState==PAGER_WRITER_LOCKED \n    );\n    assert( assert_pager_state(pPager) );\n    if( 0==pagerUseWal(pPager) ){\n      rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);\n    }\n  }\n  return rc;\n}\n\n/*\n** Sync the database file for the pager pPager. zMaster points to the name\n** of a master journal file that should be written into the individual\n** journal file. zMaster may be NULL, which is interpreted as no master\n** journal (a single database transaction).\n**\n** This routine ensures that:\n**\n**   * The database file change-counter is updated,\n**   * the journal is synced (unless the atomic-write optimization is used),\n**   * all dirty pages are written to the database file, \n**   * the database file is truncated (if required), and\n**   * the database file synced. \n**\n** The only thing that remains to commit the transaction is to finalize \n** (delete, truncate or zero the first part of) the journal file (or \n** delete the master journal file if specified).\n**\n** Note that if zMaster==NULL, this does not overwrite a previous value\n** passed to an sqlite3PagerCommitPhaseOne() call.\n**\n** If the final parameter - noSync - is true, then the database file itself\n** is not synced. The caller must call sqlite3PagerSync() directly to\n** sync the database file before calling CommitPhaseTwo() to delete the\n** journal file in this case.\n*/\nint sqlite3PagerCommitPhaseOne(\n  Pager *pPager,                  /* Pager object */\n  const char *zMaster,            /* If not NULL, the master journal name */\n  int noSync                      /* True to omit the xSync on the db file */\n){\n  int rc = SQLITE_OK;             /* Return code */\n\n  assert( pPager->eState==PAGER_WRITER_LOCKED\n       || pPager->eState==PAGER_WRITER_CACHEMOD\n       || pPager->eState==PAGER_WRITER_DBMOD\n       || pPager->eState==PAGER_ERROR\n  );\n  assert( assert_pager_state(pPager) );\n\n  /* If a prior error occurred, report that error again. */\n  if( NEVER(pPager->errCode) ) return pPager->errCode;\n\n  /* Provide the ability to easily simulate an I/O error during testing */\n  if( sqlite3FaultSim(400) ) return SQLITE_IOERR;\n\n  PAGERTRACE((\"DATABASE SYNC: File=%s zMaster=%s nSize=%d\\n\", \n      pPager->zFilename, zMaster, pPager->dbSize));\n\n  /* If no database changes have been made, return early. */\n  if( pPager->eState<PAGER_WRITER_CACHEMOD ) return SQLITE_OK;\n\n  assert( MEMDB==0 || pPager->tempFile );\n  assert( isOpen(pPager->fd) || pPager->tempFile );\n  if( 0==pagerFlushOnCommit(pPager, 1) ){\n    /* If this is an in-memory db, or no pages have been written to, or this\n    ** function has already been called, it is mostly a no-op.  However, any\n    ** backup in progress needs to be restarted.  */\n    sqlite3BackupRestart(pPager->pBackup);\n  }else{\n    if( pagerUseWal(pPager) ){\n      PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache);\n      PgHdr *pPageOne = 0;\n      if( pList==0 ){\n        /* Must have at least one page for the WAL commit flag.\n        ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */\n        rc = sqlite3PagerGet(pPager, 1, &pPageOne, 0);\n        pList = pPageOne;\n        pList->pDirty = 0;\n      }\n      assert( rc==SQLITE_OK );\n      if( ALWAYS(pList) ){\n        rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1);\n      }\n      sqlite3PagerUnref(pPageOne);\n      if( rc==SQLITE_OK ){\n        sqlite3PcacheCleanAll(pPager->pPCache);\n      }\n    }else{\n      /* The following block updates the change-counter. Exactly how it\n      ** does this depends on whether or not the atomic-update optimization\n      ** was enabled at compile time, and if this transaction meets the \n      ** runtime criteria to use the operation: \n      **\n      **    * The file-system supports the atomic-write property for\n      **      blocks of size page-size, and \n      **    * This commit is not part of a multi-file transaction, and\n      **    * Exactly one page has been modified and store in the journal file.\n      **\n      ** If the optimization was not enabled at compile time, then the\n      ** pager_incr_changecounter() function is called to update the change\n      ** counter in 'indirect-mode'. If the optimization is compiled in but\n      ** is not applicable to this transaction, call sqlite3JournalCreate()\n      ** to make sure the journal file has actually been created, then call\n      ** pager_incr_changecounter() to update the change-counter in indirect\n      ** mode. \n      **\n      ** Otherwise, if the optimization is both enabled and applicable,\n      ** then call pager_incr_changecounter() to update the change-counter\n      ** in 'direct' mode. In this case the journal file will never be\n      ** created for this transaction.\n      */\n  #ifdef SQLITE_ENABLE_ATOMIC_WRITE\n      PgHdr *pPg;\n      assert( isOpen(pPager->jfd) \n           || pPager->journalMode==PAGER_JOURNALMODE_OFF \n           || pPager->journalMode==PAGER_JOURNALMODE_WAL \n      );\n      if( !zMaster && isOpen(pPager->jfd) \n       && pPager->journalOff==jrnlBufferSize(pPager) \n       && pPager->dbSize>=pPager->dbOrigSize\n       && (0==(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty)\n      ){\n        /* Update the db file change counter via the direct-write method. The \n        ** following call will modify the in-memory representation of page 1 \n        ** to include the updated change counter and then write page 1 \n        ** directly to the database file. Because of the atomic-write \n        ** property of the host file-system, this is safe.\n        */\n        rc = pager_incr_changecounter(pPager, 1);\n      }else{\n        rc = sqlite3JournalCreate(pPager->jfd);\n        if( rc==SQLITE_OK ){\n          rc = pager_incr_changecounter(pPager, 0);\n        }\n      }\n  #else\n      rc = pager_incr_changecounter(pPager, 0);\n  #endif\n      if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\n  \n      /* Write the master journal name into the journal file. If a master \n      ** journal file name has already been written to the journal file, \n      ** or if zMaster is NULL (no master journal), then this call is a no-op.\n      */\n      rc = writeMasterJournal(pPager, zMaster);\n      if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\n  \n      /* Sync the journal file and write all dirty pages to the database.\n      ** If the atomic-update optimization is being used, this sync will not \n      ** create the journal file or perform any real IO.\n      **\n      ** Because the change-counter page was just modified, unless the\n      ** atomic-update optimization is used it is almost certain that the\n      ** journal requires a sync here. However, in locking_mode=exclusive\n      ** on a system under memory pressure it is just possible that this is \n      ** not the case. In this case it is likely enough that the redundant\n      ** xSync() call will be changed to a no-op by the OS anyhow. \n      */\n      rc = syncJournal(pPager, 0);\n      if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\n  \n      rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache));\n      if( rc!=SQLITE_OK ){\n        assert( rc!=SQLITE_IOERR_BLOCKED );\n        goto commit_phase_one_exit;\n      }\n      sqlite3PcacheCleanAll(pPager->pPCache);\n\n      /* If the file on disk is smaller than the database image, use \n      ** pager_truncate to grow the file here. This can happen if the database\n      ** image was extended as part of the current transaction and then the\n      ** last page in the db image moved to the free-list. In this case the\n      ** last page is never written out to disk, leaving the database file\n      ** undersized. Fix this now if it is the case.  */\n      if( pPager->dbSize>pPager->dbFileSize ){\n        Pgno nNew = pPager->dbSize - (pPager->dbSize==PAGER_MJ_PGNO(pPager));\n        assert( pPager->eState==PAGER_WRITER_DBMOD );\n        rc = pager_truncate(pPager, nNew);\n        if( rc!=SQLITE_OK ) goto commit_phase_one_exit;\n      }\n  \n      /* Finally, sync the database file. */\n      if( !noSync ){\n        rc = sqlite3PagerSync(pPager, zMaster);\n      }\n      IOTRACE((\"DBSYNC %p\\n\", pPager))\n    }\n  }\n\ncommit_phase_one_exit:\n  if( rc==SQLITE_OK && !pagerUseWal(pPager) ){\n    pPager->eState = PAGER_WRITER_FINISHED;\n  }\n  return rc;\n}\n\n\n/*\n** When this function is called, the database file has been completely\n** updated to reflect the changes made by the current transaction and\n** synced to disk. The journal file still exists in the file-system \n** though, and if a failure occurs at this point it will eventually\n** be used as a hot-journal and the current transaction rolled back.\n**\n** This function finalizes the journal file, either by deleting, \n** truncating or partially zeroing it, so that it cannot be used \n** for hot-journal rollback. Once this is done the transaction is\n** irrevocably committed.\n**\n** If an error occurs, an IO error code is returned and the pager\n** moves into the error state. Otherwise, SQLITE_OK is returned.\n*/\nint sqlite3PagerCommitPhaseTwo(Pager *pPager){\n  int rc = SQLITE_OK;                  /* Return code */\n\n  /* This routine should not be called if a prior error has occurred.\n  ** But if (due to a coding error elsewhere in the system) it does get\n  ** called, just return the same error code without doing anything. */\n  if( NEVER(pPager->errCode) ) return pPager->errCode;\n\n  assert( pPager->eState==PAGER_WRITER_LOCKED\n       || pPager->eState==PAGER_WRITER_FINISHED\n       || (pagerUseWal(pPager) && pPager->eState==PAGER_WRITER_CACHEMOD)\n  );\n  assert( assert_pager_state(pPager) );\n\n  /* An optimization. If the database was not actually modified during\n  ** this transaction, the pager is running in exclusive-mode and is\n  ** using persistent journals, then this function is a no-op.\n  **\n  ** The start of the journal file currently contains a single journal \n  ** header with the nRec field set to 0. If such a journal is used as\n  ** a hot-journal during hot-journal rollback, 0 changes will be made\n  ** to the database file. So there is no need to zero the journal \n  ** header. Since the pager is in exclusive mode, there is no need\n  ** to drop any locks either.\n  */\n  if( pPager->eState==PAGER_WRITER_LOCKED \n   && pPager->exclusiveMode \n   && pPager->journalMode==PAGER_JOURNALMODE_PERSIST\n  ){\n    assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) || !pPager->journalOff );\n    pPager->eState = PAGER_READER;\n    return SQLITE_OK;\n  }\n\n  PAGERTRACE((\"COMMIT %d\\n\", PAGERID(pPager)));\n  pPager->iDataVersion++;\n  rc = pager_end_transaction(pPager, pPager->setMaster, 1);\n  return pager_error(pPager, rc);\n}\n\n/*\n** If a write transaction is open, then all changes made within the \n** transaction are reverted and the current write-transaction is closed.\n** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR\n** state if an error occurs.\n**\n** If the pager is already in PAGER_ERROR state when this function is called,\n** it returns Pager.errCode immediately. No work is performed in this case.\n**\n** Otherwise, in rollback mode, this function performs two functions:\n**\n**   1) It rolls back the journal file, restoring all database file and \n**      in-memory cache pages to the state they were in when the transaction\n**      was opened, and\n**\n**   2) It finalizes the journal file, so that it is not used for hot\n**      rollback at any point in the future.\n**\n** Finalization of the journal file (task 2) is only performed if the \n** rollback is successful.\n**\n** In WAL mode, all cache-entries containing data modified within the\n** current transaction are either expelled from the cache or reverted to\n** their pre-transaction state by re-reading data from the database or\n** WAL files. The WAL transaction is then closed.\n*/\nint sqlite3PagerRollback(Pager *pPager){\n  int rc = SQLITE_OK;                  /* Return code */\n  PAGERTRACE((\"ROLLBACK %d\\n\", PAGERID(pPager)));\n\n  /* PagerRollback() is a no-op if called in READER or OPEN state. If\n  ** the pager is already in the ERROR state, the rollback is not \n  ** attempted here. Instead, the error code is returned to the caller.\n  */\n  assert( assert_pager_state(pPager) );\n  if( pPager->eState==PAGER_ERROR ) return pPager->errCode;\n  if( pPager->eState<=PAGER_READER ) return SQLITE_OK;\n\n  if( pagerUseWal(pPager) ){\n    int rc2;\n    rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, -1);\n    rc2 = pager_end_transaction(pPager, pPager->setMaster, 0);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){\n    int eState = pPager->eState;\n    rc = pager_end_transaction(pPager, 0, 0);\n    if( !MEMDB && eState>PAGER_WRITER_LOCKED ){\n      /* This can happen using journal_mode=off. Move the pager to the error \n      ** state to indicate that the contents of the cache may not be trusted.\n      ** Any active readers will get SQLITE_ABORT.\n      */\n      pPager->errCode = SQLITE_ABORT;\n      pPager->eState = PAGER_ERROR;\n      return rc;\n    }\n  }else{\n    rc = pager_playback(pPager, 0);\n  }\n\n  assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK );\n  assert( rc==SQLITE_OK || rc==SQLITE_FULL || rc==SQLITE_CORRUPT\n          || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR \n          || rc==SQLITE_CANTOPEN\n  );\n\n  /* If an error occurs during a ROLLBACK, we can no longer trust the pager\n  ** cache. So call pager_error() on the way out to make any error persistent.\n  */\n  return pager_error(pPager, rc);\n}\n\n/*\n** Return TRUE if the database file is opened read-only.  Return FALSE\n** if the database is (in theory) writable.\n*/\nu8 sqlite3PagerIsreadonly(Pager *pPager){\n  return pPager->readOnly;\n}\n\n#ifdef SQLITE_DEBUG\n/*\n** Return the sum of the reference counts for all pages held by pPager.\n*/\nint sqlite3PagerRefcount(Pager *pPager){\n  return sqlite3PcacheRefCount(pPager->pPCache);\n}\n#endif\n\n/*\n** Return the approximate number of bytes of memory currently\n** used by the pager and its associated cache.\n*/\nint sqlite3PagerMemUsed(Pager *pPager){\n  int perPageSize = pPager->pageSize + pPager->nExtra + sizeof(PgHdr)\n                                     + 5*sizeof(void*);\n  return perPageSize*sqlite3PcachePagecount(pPager->pPCache)\n           + sqlite3MallocSize(pPager)\n           + pPager->pageSize;\n}\n\n/*\n** Return the number of references to the specified page.\n*/\nint sqlite3PagerPageRefcount(DbPage *pPage){\n  return sqlite3PcachePageRefcount(pPage);\n}\n\n#ifdef SQLITE_TEST\n/*\n** This routine is used for testing and analysis only.\n*/\nint *sqlite3PagerStats(Pager *pPager){\n  static int a[11];\n  a[0] = sqlite3PcacheRefCount(pPager->pPCache);\n  a[1] = sqlite3PcachePagecount(pPager->pPCache);\n  a[2] = sqlite3PcacheGetCachesize(pPager->pPCache);\n  a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize;\n  a[4] = pPager->eState;\n  a[5] = pPager->errCode;\n  a[6] = pPager->aStat[PAGER_STAT_HIT];\n  a[7] = pPager->aStat[PAGER_STAT_MISS];\n  a[8] = 0;  /* Used to be pPager->nOvfl */\n  a[9] = pPager->nRead;\n  a[10] = pPager->aStat[PAGER_STAT_WRITE];\n  return a;\n}\n#endif\n\n/*\n** Parameter eStat must be either SQLITE_DBSTATUS_CACHE_HIT or\n** SQLITE_DBSTATUS_CACHE_MISS. Before returning, *pnVal is incremented by the\n** current cache hit or miss count, according to the value of eStat. If the \n** reset parameter is non-zero, the cache hit or miss count is zeroed before \n** returning.\n*/\nvoid sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){\n\n  assert( eStat==SQLITE_DBSTATUS_CACHE_HIT\n       || eStat==SQLITE_DBSTATUS_CACHE_MISS\n       || eStat==SQLITE_DBSTATUS_CACHE_WRITE\n  );\n\n  assert( SQLITE_DBSTATUS_CACHE_HIT+1==SQLITE_DBSTATUS_CACHE_MISS );\n  assert( SQLITE_DBSTATUS_CACHE_HIT+2==SQLITE_DBSTATUS_CACHE_WRITE );\n  assert( PAGER_STAT_HIT==0 && PAGER_STAT_MISS==1 && PAGER_STAT_WRITE==2 );\n\n  *pnVal += pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT];\n  if( reset ){\n    pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT] = 0;\n  }\n}\n\n/*\n** Return true if this is an in-memory or temp-file backed pager.\n*/\nint sqlite3PagerIsMemdb(Pager *pPager){\n  return pPager->tempFile;\n}\n\n/*\n** Check that there are at least nSavepoint savepoints open. If there are\n** currently less than nSavepoints open, then open one or more savepoints\n** to make up the difference. If the number of savepoints is already\n** equal to nSavepoint, then this function is a no-op.\n**\n** If a memory allocation fails, SQLITE_NOMEM is returned. If an error \n** occurs while opening the sub-journal file, then an IO error code is\n** returned. Otherwise, SQLITE_OK.\n*/\nstatic SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepoint){\n  int rc = SQLITE_OK;                       /* Return code */\n  int nCurrent = pPager->nSavepoint;        /* Current number of savepoints */\n  int ii;                                   /* Iterator variable */\n  PagerSavepoint *aNew;                     /* New Pager.aSavepoint array */\n\n  assert( pPager->eState>=PAGER_WRITER_LOCKED );\n  assert( assert_pager_state(pPager) );\n  assert( nSavepoint>nCurrent && pPager->useJournal );\n\n  /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM\n  ** if the allocation fails. Otherwise, zero the new portion in case a \n  ** malloc failure occurs while populating it in the for(...) loop below.\n  */\n  aNew = (PagerSavepoint *)sqlite3Realloc(\n      pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint\n  );\n  if( !aNew ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint));\n  pPager->aSavepoint = aNew;\n\n  /* Populate the PagerSavepoint structures just allocated. */\n  for(ii=nCurrent; ii<nSavepoint; ii++){\n    aNew[ii].nOrig = pPager->dbSize;\n    if( isOpen(pPager->jfd) && pPager->journalOff>0 ){\n      aNew[ii].iOffset = pPager->journalOff;\n    }else{\n      aNew[ii].iOffset = JOURNAL_HDR_SZ(pPager);\n    }\n    aNew[ii].iSubRec = pPager->nSubRec;\n    aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize);\n    if( !aNew[ii].pInSavepoint ){\n      return SQLITE_NOMEM_BKPT;\n    }\n    if( pagerUseWal(pPager) ){\n      sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData);\n    }\n    pPager->nSavepoint = ii+1;\n  }\n  assert( pPager->nSavepoint==nSavepoint );\n  assertTruncateConstraint(pPager);\n  return rc;\n}\nint sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){\n  assert( pPager->eState>=PAGER_WRITER_LOCKED );\n  assert( assert_pager_state(pPager) );\n\n  if( nSavepoint>pPager->nSavepoint && pPager->useJournal ){\n    return pagerOpenSavepoint(pPager, nSavepoint);\n  }else{\n    return SQLITE_OK;\n  }\n}\n\n\n/*\n** This function is called to rollback or release (commit) a savepoint.\n** The savepoint to release or rollback need not be the most recently \n** created savepoint.\n**\n** Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE.\n** If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with\n** index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes\n** that have occurred since the specified savepoint was created.\n**\n** The savepoint to rollback or release is identified by parameter \n** iSavepoint. A value of 0 means to operate on the outermost savepoint\n** (the first created). A value of (Pager.nSavepoint-1) means operate\n** on the most recently created savepoint. If iSavepoint is greater than\n** (Pager.nSavepoint-1), then this function is a no-op.\n**\n** If a negative value is passed to this function, then the current\n** transaction is rolled back. This is different to calling \n** sqlite3PagerRollback() because this function does not terminate\n** the transaction or unlock the database, it just restores the \n** contents of the database to its original state. \n**\n** In any case, all savepoints with an index greater than iSavepoint \n** are destroyed. If this is a release operation (op==SAVEPOINT_RELEASE),\n** then savepoint iSavepoint is also destroyed.\n**\n** This function may return SQLITE_NOMEM if a memory allocation fails,\n** or an IO error code if an IO error occurs while rolling back a \n** savepoint. If no errors occur, SQLITE_OK is returned.\n*/ \nint sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){\n  int rc = pPager->errCode;\n  \n#ifdef SQLITE_ENABLE_ZIPVFS\n  if( op==SAVEPOINT_RELEASE ) rc = SQLITE_OK;\n#endif\n\n  assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK );\n  assert( iSavepoint>=0 || op==SAVEPOINT_ROLLBACK );\n\n  if( rc==SQLITE_OK && iSavepoint<pPager->nSavepoint ){\n    int ii;            /* Iterator variable */\n    int nNew;          /* Number of remaining savepoints after this op. */\n\n    /* Figure out how many savepoints will still be active after this\n    ** operation. Store this value in nNew. Then free resources associated \n    ** with any savepoints that are destroyed by this operation.\n    */\n    nNew = iSavepoint + (( op==SAVEPOINT_RELEASE ) ? 0 : 1);\n    for(ii=nNew; ii<pPager->nSavepoint; ii++){\n      sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint);\n    }\n    pPager->nSavepoint = nNew;\n\n    /* If this is a release of the outermost savepoint, truncate \n    ** the sub-journal to zero bytes in size. */\n    if( op==SAVEPOINT_RELEASE ){\n      if( nNew==0 && isOpen(pPager->sjfd) ){\n        /* Only truncate if it is an in-memory sub-journal. */\n        if( sqlite3JournalIsInMemory(pPager->sjfd) ){\n          rc = sqlite3OsTruncate(pPager->sjfd, 0);\n          assert( rc==SQLITE_OK );\n        }\n        pPager->nSubRec = 0;\n      }\n    }\n    /* Else this is a rollback operation, playback the specified savepoint.\n    ** If this is a temp-file, it is possible that the journal file has\n    ** not yet been opened. In this case there have been no changes to\n    ** the database file, so the playback operation can be skipped.\n    */\n    else if( pagerUseWal(pPager) || isOpen(pPager->jfd) ){\n      PagerSavepoint *pSavepoint = (nNew==0)?0:&pPager->aSavepoint[nNew-1];\n      rc = pagerPlaybackSavepoint(pPager, pSavepoint);\n      assert(rc!=SQLITE_DONE);\n    }\n    \n#ifdef SQLITE_ENABLE_ZIPVFS\n    /* If the cache has been modified but the savepoint cannot be rolled \n    ** back journal_mode=off, put the pager in the error state. This way,\n    ** if the VFS used by this pager includes ZipVFS, the entire transaction\n    ** can be rolled back at the ZipVFS level.  */\n    else if( \n        pPager->journalMode==PAGER_JOURNALMODE_OFF \n     && pPager->eState>=PAGER_WRITER_CACHEMOD\n    ){\n      pPager->errCode = SQLITE_ABORT;\n      pPager->eState = PAGER_ERROR;\n    }\n#endif\n  }\n\n  return rc;\n}\n\n/*\n** Return the full pathname of the database file.\n**\n** Except, if the pager is in-memory only, then return an empty string if\n** nullIfMemDb is true.  This routine is called with nullIfMemDb==1 when\n** used to report the filename to the user, for compatibility with legacy\n** behavior.  But when the Btree needs to know the filename for matching to\n** shared cache, it uses nullIfMemDb==0 so that in-memory databases can\n** participate in shared-cache.\n*/\nconst char *sqlite3PagerFilename(Pager *pPager, int nullIfMemDb){\n  return (nullIfMemDb && pPager->memDb) ? \"\" : pPager->zFilename;\n}\n\n/*\n** Return the VFS structure for the pager.\n*/\nsqlite3_vfs *sqlite3PagerVfs(Pager *pPager){\n  return pPager->pVfs;\n}\n\n/*\n** Return the file handle for the database file associated\n** with the pager.  This might return NULL if the file has\n** not yet been opened.\n*/\nsqlite3_file *sqlite3PagerFile(Pager *pPager){\n  return pPager->fd;\n}\n\n/*\n** Return the file handle for the journal file (if it exists).\n** This will be either the rollback journal or the WAL file.\n*/\nsqlite3_file *sqlite3PagerJrnlFile(Pager *pPager){\n#if SQLITE_OMIT_WAL\n  return pPager->jfd;\n#else\n  return pPager->pWal ? sqlite3WalFile(pPager->pWal) : pPager->jfd;\n#endif\n}\n\n/*\n** Return the full pathname of the journal file.\n*/\nconst char *sqlite3PagerJournalname(Pager *pPager){\n  return pPager->zJournal;\n}\n\n#ifdef SQLITE_HAS_CODEC\n/*\n** Set or retrieve the codec for this pager\n*/\nvoid sqlite3PagerSetCodec(\n  Pager *pPager,\n  void *(*xCodec)(void*,void*,Pgno,int),\n  void (*xCodecSizeChng)(void*,int,int),\n  void (*xCodecFree)(void*),\n  void *pCodec\n){\n  if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec);\n  pPager->xCodec = pPager->memDb ? 0 : xCodec;\n  pPager->xCodecSizeChng = xCodecSizeChng;\n  pPager->xCodecFree = xCodecFree;\n  pPager->pCodec = pCodec;\n  pagerReportSize(pPager);\n}\nvoid *sqlite3PagerGetCodec(Pager *pPager){\n  return pPager->pCodec;\n}\n\n/*\n** This function is called by the wal module when writing page content\n** into the log file.\n**\n** This function returns a pointer to a buffer containing the encrypted\n** page content. If a malloc fails, this function may return NULL.\n*/\nvoid *sqlite3PagerCodec(PgHdr *pPg){\n  void *aData = 0;\n  CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData);\n  return aData;\n}\n\n/*\n** Return the current pager state\n*/\nint sqlite3PagerState(Pager *pPager){\n  return pPager->eState;\n}\n#endif /* SQLITE_HAS_CODEC */\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n/*\n** Move the page pPg to location pgno in the file.\n**\n** There must be no references to the page previously located at\n** pgno (which we call pPgOld) though that page is allowed to be\n** in cache.  If the page previously located at pgno is not already\n** in the rollback journal, it is not put there by by this routine.\n**\n** References to the page pPg remain valid. Updating any\n** meta-data associated with pPg (i.e. data stored in the nExtra bytes\n** allocated along with the page) is the responsibility of the caller.\n**\n** A transaction must be active when this routine is called. It used to be\n** required that a statement transaction was not active, but this restriction\n** has been removed (CREATE INDEX needs to move a page when a statement\n** transaction is active).\n**\n** If the fourth argument, isCommit, is non-zero, then this page is being\n** moved as part of a database reorganization just before the transaction \n** is being committed. In this case, it is guaranteed that the database page \n** pPg refers to will not be written to again within this transaction.\n**\n** This function may return SQLITE_NOMEM or an IO error code if an error\n** occurs. Otherwise, it returns SQLITE_OK.\n*/\nint sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){\n  PgHdr *pPgOld;               /* The page being overwritten. */\n  Pgno needSyncPgno = 0;       /* Old value of pPg->pgno, if sync is required */\n  int rc;                      /* Return code */\n  Pgno origPgno;               /* The original page number */\n\n  assert( pPg->nRef>0 );\n  assert( pPager->eState==PAGER_WRITER_CACHEMOD\n       || pPager->eState==PAGER_WRITER_DBMOD\n  );\n  assert( assert_pager_state(pPager) );\n\n  /* In order to be able to rollback, an in-memory database must journal\n  ** the page we are moving from.\n  */\n  assert( pPager->tempFile || !MEMDB );\n  if( pPager->tempFile ){\n    rc = sqlite3PagerWrite(pPg);\n    if( rc ) return rc;\n  }\n\n  /* If the page being moved is dirty and has not been saved by the latest\n  ** savepoint, then save the current contents of the page into the \n  ** sub-journal now. This is required to handle the following scenario:\n  **\n  **   BEGIN;\n  **     <journal page X, then modify it in memory>\n  **     SAVEPOINT one;\n  **       <Move page X to location Y>\n  **     ROLLBACK TO one;\n  **\n  ** If page X were not written to the sub-journal here, it would not\n  ** be possible to restore its contents when the \"ROLLBACK TO one\"\n  ** statement were is processed.\n  **\n  ** subjournalPage() may need to allocate space to store pPg->pgno into\n  ** one or more savepoint bitvecs. This is the reason this function\n  ** may return SQLITE_NOMEM.\n  */\n  if( (pPg->flags & PGHDR_DIRTY)!=0\n   && SQLITE_OK!=(rc = subjournalPageIfRequired(pPg))\n  ){\n    return rc;\n  }\n\n  PAGERTRACE((\"MOVE %d page %d (needSync=%d) moves to %d\\n\", \n      PAGERID(pPager), pPg->pgno, (pPg->flags&PGHDR_NEED_SYNC)?1:0, pgno));\n  IOTRACE((\"MOVE %p %d %d\\n\", pPager, pPg->pgno, pgno))\n\n  /* If the journal needs to be sync()ed before page pPg->pgno can\n  ** be written to, store pPg->pgno in local variable needSyncPgno.\n  **\n  ** If the isCommit flag is set, there is no need to remember that\n  ** the journal needs to be sync()ed before database page pPg->pgno \n  ** can be written to. The caller has already promised not to write to it.\n  */\n  if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){\n    needSyncPgno = pPg->pgno;\n    assert( pPager->journalMode==PAGER_JOURNALMODE_OFF ||\n            pageInJournal(pPager, pPg) || pPg->pgno>pPager->dbOrigSize );\n    assert( pPg->flags&PGHDR_DIRTY );\n  }\n\n  /* If the cache contains a page with page-number pgno, remove it\n  ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for \n  ** page pgno before the 'move' operation, it needs to be retained \n  ** for the page moved there.\n  */\n  pPg->flags &= ~PGHDR_NEED_SYNC;\n  pPgOld = sqlite3PagerLookup(pPager, pgno);\n  assert( !pPgOld || pPgOld->nRef==1 );\n  if( pPgOld ){\n    pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC);\n    if( pPager->tempFile ){\n      /* Do not discard pages from an in-memory database since we might\n      ** need to rollback later.  Just move the page out of the way. */\n      sqlite3PcacheMove(pPgOld, pPager->dbSize+1);\n    }else{\n      sqlite3PcacheDrop(pPgOld);\n    }\n  }\n\n  origPgno = pPg->pgno;\n  sqlite3PcacheMove(pPg, pgno);\n  sqlite3PcacheMakeDirty(pPg);\n\n  /* For an in-memory database, make sure the original page continues\n  ** to exist, in case the transaction needs to roll back.  Use pPgOld\n  ** as the original page since it has already been allocated.\n  */\n  if( pPager->tempFile && pPgOld ){\n    sqlite3PcacheMove(pPgOld, origPgno);\n    sqlite3PagerUnrefNotNull(pPgOld);\n  }\n\n  if( needSyncPgno ){\n    /* If needSyncPgno is non-zero, then the journal file needs to be \n    ** sync()ed before any data is written to database file page needSyncPgno.\n    ** Currently, no such page exists in the page-cache and the \n    ** \"is journaled\" bitvec flag has been set. This needs to be remedied by\n    ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC\n    ** flag.\n    **\n    ** If the attempt to load the page into the page-cache fails, (due\n    ** to a malloc() or IO failure), clear the bit in the pInJournal[]\n    ** array. Otherwise, if the page is loaded and written again in\n    ** this transaction, it may be written to the database file before\n    ** it is synced into the journal file. This way, it may end up in\n    ** the journal file twice, but that is not a problem.\n    */\n    PgHdr *pPgHdr;\n    rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr, 0);\n    if( rc!=SQLITE_OK ){\n      if( needSyncPgno<=pPager->dbOrigSize ){\n        assert( pPager->pTmpSpace!=0 );\n        sqlite3BitvecClear(pPager->pInJournal, needSyncPgno, pPager->pTmpSpace);\n      }\n      return rc;\n    }\n    pPgHdr->flags |= PGHDR_NEED_SYNC;\n    sqlite3PcacheMakeDirty(pPgHdr);\n    sqlite3PagerUnrefNotNull(pPgHdr);\n  }\n\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** The page handle passed as the first argument refers to a dirty page \n** with a page number other than iNew. This function changes the page's \n** page number to iNew and sets the value of the PgHdr.flags field to \n** the value passed as the third parameter.\n*/\nvoid sqlite3PagerRekey(DbPage *pPg, Pgno iNew, u16 flags){\n  assert( pPg->pgno!=iNew );\n  pPg->flags = flags;\n  sqlite3PcacheMove(pPg, iNew);\n}\n\n/*\n** Return a pointer to the data for the specified page.\n*/\nvoid *sqlite3PagerGetData(DbPage *pPg){\n  assert( pPg->nRef>0 || pPg->pPager->memDb );\n  return pPg->pData;\n}\n\n/*\n** Return a pointer to the Pager.nExtra bytes of \"extra\" space \n** allocated along with the specified page.\n*/\nvoid *sqlite3PagerGetExtra(DbPage *pPg){\n  return pPg->pExtra;\n}\n\n/*\n** Get/set the locking-mode for this pager. Parameter eMode must be one\n** of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or \n** PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then\n** the locking-mode is set to the value specified.\n**\n** The returned value is either PAGER_LOCKINGMODE_NORMAL or\n** PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated)\n** locking-mode.\n*/\nint sqlite3PagerLockingMode(Pager *pPager, int eMode){\n  assert( eMode==PAGER_LOCKINGMODE_QUERY\n            || eMode==PAGER_LOCKINGMODE_NORMAL\n            || eMode==PAGER_LOCKINGMODE_EXCLUSIVE );\n  assert( PAGER_LOCKINGMODE_QUERY<0 );\n  assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 );\n  assert( pPager->exclusiveMode || 0==sqlite3WalHeapMemory(pPager->pWal) );\n  if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){\n    pPager->exclusiveMode = (u8)eMode;\n  }\n  return (int)pPager->exclusiveMode;\n}\n\n/*\n** Set the journal-mode for this pager. Parameter eMode must be one of:\n**\n**    PAGER_JOURNALMODE_DELETE\n**    PAGER_JOURNALMODE_TRUNCATE\n**    PAGER_JOURNALMODE_PERSIST\n**    PAGER_JOURNALMODE_OFF\n**    PAGER_JOURNALMODE_MEMORY\n**    PAGER_JOURNALMODE_WAL\n**\n** The journalmode is set to the value specified if the change is allowed.\n** The change may be disallowed for the following reasons:\n**\n**   *  An in-memory database can only have its journal_mode set to _OFF\n**      or _MEMORY.\n**\n**   *  Temporary databases cannot have _WAL journalmode.\n**\n** The returned indicate the current (possibly updated) journal-mode.\n*/\nint sqlite3PagerSetJournalMode(Pager *pPager, int eMode){\n  u8 eOld = pPager->journalMode;    /* Prior journalmode */\n\n#ifdef SQLITE_DEBUG\n  /* The print_pager_state() routine is intended to be used by the debugger\n  ** only.  We invoke it once here to suppress a compiler warning. */\n  print_pager_state(pPager);\n#endif\n\n\n  /* The eMode parameter is always valid */\n  assert(      eMode==PAGER_JOURNALMODE_DELETE\n            || eMode==PAGER_JOURNALMODE_TRUNCATE\n            || eMode==PAGER_JOURNALMODE_PERSIST\n            || eMode==PAGER_JOURNALMODE_OFF \n            || eMode==PAGER_JOURNALMODE_WAL \n            || eMode==PAGER_JOURNALMODE_MEMORY );\n\n  /* This routine is only called from the OP_JournalMode opcode, and\n  ** the logic there will never allow a temporary file to be changed\n  ** to WAL mode.\n  */\n  assert( pPager->tempFile==0 || eMode!=PAGER_JOURNALMODE_WAL );\n\n  /* Do allow the journalmode of an in-memory database to be set to\n  ** anything other than MEMORY or OFF\n  */\n  if( MEMDB ){\n    assert( eOld==PAGER_JOURNALMODE_MEMORY || eOld==PAGER_JOURNALMODE_OFF );\n    if( eMode!=PAGER_JOURNALMODE_MEMORY && eMode!=PAGER_JOURNALMODE_OFF ){\n      eMode = eOld;\n    }\n  }\n\n  if( eMode!=eOld ){\n\n    /* Change the journal mode. */\n    assert( pPager->eState!=PAGER_ERROR );\n    pPager->journalMode = (u8)eMode;\n\n    /* When transistioning from TRUNCATE or PERSIST to any other journal\n    ** mode except WAL, unless the pager is in locking_mode=exclusive mode,\n    ** delete the journal file.\n    */\n    assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 );\n    assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 );\n    assert( (PAGER_JOURNALMODE_DELETE & 5)==0 );\n    assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 );\n    assert( (PAGER_JOURNALMODE_OFF & 5)==0 );\n    assert( (PAGER_JOURNALMODE_WAL & 5)==5 );\n\n    assert( isOpen(pPager->fd) || pPager->exclusiveMode );\n    if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){\n\n      /* In this case we would like to delete the journal file. If it is\n      ** not possible, then that is not a problem. Deleting the journal file\n      ** here is an optimization only.\n      **\n      ** Before deleting the journal file, obtain a RESERVED lock on the\n      ** database file. This ensures that the journal file is not deleted\n      ** while it is in use by some other client.\n      */\n      sqlite3OsClose(pPager->jfd);\n      if( pPager->eLock>=RESERVED_LOCK ){\n        sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);\n      }else{\n        int rc = SQLITE_OK;\n        int state = pPager->eState;\n        assert( state==PAGER_OPEN || state==PAGER_READER );\n        if( state==PAGER_OPEN ){\n          rc = sqlite3PagerSharedLock(pPager);\n        }\n        if( pPager->eState==PAGER_READER ){\n          assert( rc==SQLITE_OK );\n          rc = pagerLockDb(pPager, RESERVED_LOCK);\n        }\n        if( rc==SQLITE_OK ){\n          sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);\n        }\n        if( rc==SQLITE_OK && state==PAGER_READER ){\n          pagerUnlockDb(pPager, SHARED_LOCK);\n        }else if( state==PAGER_OPEN ){\n          pager_unlock(pPager);\n        }\n        assert( state==pPager->eState );\n      }\n    }else if( eMode==PAGER_JOURNALMODE_OFF ){\n      sqlite3OsClose(pPager->jfd);\n    }\n  }\n\n  /* Return the new journal mode */\n  return (int)pPager->journalMode;\n}\n\n/*\n** Return the current journal mode.\n*/\nint sqlite3PagerGetJournalMode(Pager *pPager){\n  return (int)pPager->journalMode;\n}\n\n/*\n** Return TRUE if the pager is in a state where it is OK to change the\n** journalmode.  Journalmode changes can only happen when the database\n** is unmodified.\n*/\nint sqlite3PagerOkToChangeJournalMode(Pager *pPager){\n  assert( assert_pager_state(pPager) );\n  if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0;\n  if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0;\n  return 1;\n}\n\n/*\n** Get/set the size-limit used for persistent journal files.\n**\n** Setting the size limit to -1 means no limit is enforced.\n** An attempt to set a limit smaller than -1 is a no-op.\n*/\ni64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){\n  if( iLimit>=-1 ){\n    pPager->journalSizeLimit = iLimit;\n    sqlite3WalLimit(pPager->pWal, iLimit);\n  }\n  return pPager->journalSizeLimit;\n}\n\n/*\n** Return a pointer to the pPager->pBackup variable. The backup module\n** in backup.c maintains the content of this variable. This module\n** uses it opaquely as an argument to sqlite3BackupRestart() and\n** sqlite3BackupUpdate() only.\n*/\nsqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){\n  return &pPager->pBackup;\n}\n\n#ifndef SQLITE_OMIT_VACUUM\n/*\n** Unless this is an in-memory or temporary database, clear the pager cache.\n*/\nvoid sqlite3PagerClearCache(Pager *pPager){\n  assert( MEMDB==0 || pPager->tempFile );\n  if( pPager->tempFile==0 ) pager_reset(pPager);\n}\n#endif\n\n\n#ifndef SQLITE_OMIT_WAL\n/*\n** This function is called when the user invokes \"PRAGMA wal_checkpoint\",\n** \"PRAGMA wal_blocking_checkpoint\" or calls the sqlite3_wal_checkpoint()\n** or wal_blocking_checkpoint() API functions.\n**\n** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.\n*/\nint sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){\n  int rc = SQLITE_OK;\n  if( pPager->pWal ){\n    rc = sqlite3WalCheckpoint(pPager->pWal, eMode,\n        (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),\n        pPager->pBusyHandlerArg,\n        pPager->ckptSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,\n        pnLog, pnCkpt\n    );\n  }\n  return rc;\n}\n\nint sqlite3PagerWalCallback(Pager *pPager){\n  return sqlite3WalCallback(pPager->pWal);\n}\n\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\nint sqlite3PagerWalCheckpointHandler(Pager *pPager, \n                                     int (*xCheckpoint)(void*,int), \n                                     void* pArg){\n  int rc = SQLITE_MISUSE;\n  if (pPager->pWal) {\n    rc = sqlite3WalCheckpointHandler(pPager->pWal, xCheckpoint, pArg);\n  }\n  return rc;\n}\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n/*\n** Return true if the underlying VFS for the given pager supports the\n** primitives necessary for write-ahead logging.\n*/\nint sqlite3PagerWalSupported(Pager *pPager){\n  const sqlite3_io_methods *pMethods = pPager->fd->pMethods;\n  if( pPager->noLock ) return 0;\n  return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);\n}\n\n/*\n** Attempt to take an exclusive lock on the database file. If a PENDING lock\n** is obtained instead, immediately release it.\n*/\nstatic int pagerExclusiveLock(Pager *pPager){\n  int rc;                         /* Return code */\n\n  assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );\n  rc = pagerLockDb(pPager, EXCLUSIVE_LOCK);\n  if( rc!=SQLITE_OK ){\n    /* If the attempt to grab the exclusive lock failed, release the \n    ** pending lock that may have been obtained instead.  */\n    pagerUnlockDb(pPager, SHARED_LOCK);\n  }\n\n  return rc;\n}\n\n/*\n** Call sqlite3WalOpen() to open the WAL handle. If the pager is in \n** exclusive-locking mode when this function is called, take an EXCLUSIVE\n** lock on the database file and use heap-memory to store the wal-index\n** in. Otherwise, use the normal shared-memory.\n*/\nstatic int pagerOpenWal(Pager *pPager){\n  int rc = SQLITE_OK;\n\n  assert( pPager->pWal==0 && pPager->tempFile==0 );\n  assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK );\n\n  /* If the pager is already in exclusive-mode, the WAL module will use \n  ** heap-memory for the wal-index instead of the VFS shared-memory \n  ** implementation. Take the exclusive lock now, before opening the WAL\n  ** file, to make sure this is safe.\n  */\n  if( pPager->exclusiveMode ){\n    rc = pagerExclusiveLock(pPager);\n  }\n\n  /* Open the connection to the log file. If this operation fails, \n  ** (e.g. due to malloc() failure), return an error code.\n  */\n  if( rc==SQLITE_OK ){\n    rc = sqlite3WalOpen(pPager->pVfs,\n        pPager->fd, pPager->zWal, pPager->exclusiveMode,\n        pPager->journalSizeLimit, &pPager->pWal\n    );\n  }\n  pagerFixMaplimit(pPager);\n\n  return rc;\n}\n\n\n/*\n** The caller must be holding a SHARED lock on the database file to call\n** this function.\n**\n** If the pager passed as the first argument is open on a real database\n** file (not a temp file or an in-memory database), and the WAL file\n** is not already open, make an attempt to open it now. If successful,\n** return SQLITE_OK. If an error occurs or the VFS used by the pager does \n** not support the xShmXXX() methods, return an error code. *pbOpen is\n** not modified in either case.\n**\n** If the pager is open on a temp-file (or in-memory database), or if\n** the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK\n** without doing anything.\n*/\nint sqlite3PagerOpenWal(\n  Pager *pPager,                  /* Pager object */\n  int *pbOpen                     /* OUT: Set to true if call is a no-op */\n){\n  int rc = SQLITE_OK;             /* Return code */\n\n  assert( assert_pager_state(pPager) );\n  assert( pPager->eState==PAGER_OPEN   || pbOpen );\n  assert( pPager->eState==PAGER_READER || !pbOpen );\n  assert( pbOpen==0 || *pbOpen==0 );\n  assert( pbOpen!=0 || (!pPager->tempFile && !pPager->pWal) );\n\n  if( !pPager->tempFile && !pPager->pWal ){\n    if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN;\n\n    /* Close any rollback journal previously open */\n    sqlite3OsClose(pPager->jfd);\n\n    rc = pagerOpenWal(pPager);\n    if( rc==SQLITE_OK ){\n      pPager->journalMode = PAGER_JOURNALMODE_WAL;\n      pPager->eState = PAGER_OPEN;\n    }\n  }else{\n    *pbOpen = 1;\n  }\n\n  return rc;\n}\n\n/*\n** This function is called to close the connection to the log file prior\n** to switching from WAL to rollback mode.\n**\n** Before closing the log file, this function attempts to take an \n** EXCLUSIVE lock on the database file. If this cannot be obtained, an\n** error (SQLITE_BUSY) is returned and the log connection is not closed.\n** If successful, the EXCLUSIVE lock is not released before returning.\n*/\nint sqlite3PagerCloseWal(Pager *pPager){\n  int rc = SQLITE_OK;\n\n  assert( pPager->journalMode==PAGER_JOURNALMODE_WAL );\n\n  /* If the log file is not already open, but does exist in the file-system,\n  ** it may need to be checkpointed before the connection can switch to\n  ** rollback mode. Open it now so this can happen.\n  */\n  if( !pPager->pWal ){\n    int logexists = 0;\n    rc = pagerLockDb(pPager, SHARED_LOCK);\n    if( rc==SQLITE_OK ){\n      rc = sqlite3OsAccess(\n          pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &logexists\n      );\n    }\n    if( rc==SQLITE_OK && logexists ){\n      rc = pagerOpenWal(pPager);\n    }\n  }\n    \n  /* Checkpoint and close the log. Because an EXCLUSIVE lock is held on\n  ** the database file, the log and log-summary files will be deleted.\n  */\n  if( rc==SQLITE_OK && pPager->pWal ){\n    rc = pagerExclusiveLock(pPager);\n    if( rc==SQLITE_OK ){\n      rc = sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags,\n                           pPager->pageSize, (u8*)pPager->pTmpSpace);\n      pPager->pWal = 0;\n      pagerFixMaplimit(pPager);\n      if( rc && !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);\n    }\n  }\n  return rc;\n}\n\n#ifdef SQLITE_ENABLE_SNAPSHOT\n/*\n** If this is a WAL database, obtain a snapshot handle for the snapshot\n** currently open. Otherwise, return an error.\n*/\nint sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot){\n  int rc = SQLITE_ERROR;\n  if( pPager->pWal ){\n    rc = sqlite3WalSnapshotGet(pPager->pWal, ppSnapshot);\n  }\n  return rc;\n}\n\n/*\n** If this is a WAL database, store a pointer to pSnapshot. Next time a\n** read transaction is opened, attempt to read from the snapshot it \n** identifies. If this is not a WAL database, return an error.\n*/\nint sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot){\n  int rc = SQLITE_OK;\n  if( pPager->pWal ){\n    sqlite3WalSnapshotOpen(pPager->pWal, pSnapshot);\n  }else{\n    rc = SQLITE_ERROR;\n  }\n  return rc;\n}\n#endif /* SQLITE_ENABLE_SNAPSHOT */\n#endif /* !SQLITE_OMIT_WAL */\n\n#ifdef SQLITE_ENABLE_ZIPVFS\n/*\n** A read-lock must be held on the pager when this function is called. If\n** the pager is in WAL mode and the WAL file currently contains one or more\n** frames, return the size in bytes of the page images stored within the\n** WAL frames. Otherwise, if this is not a WAL database or the WAL file\n** is empty, return 0.\n*/\nint sqlite3PagerWalFramesize(Pager *pPager){\n  assert( pPager->eState>=PAGER_READER );\n  return sqlite3WalFramesize(pPager->pWal);\n}\n#endif\n\n#if SQLITE_WCDB_SIGNAL_RETRY\nvoid WCDBPagerSetWait(Pager* pPager, int bFlag)\n{\n  WCDBOsFileSetWait(pPager->fd, bFlag);\n}\nint WCDBPagerGetWait(Pager* pPager)\n{\n  return WCDBOsFileGetWait(pPager->fd);\n}\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n#endif /* SQLITE_OMIT_DISKIO */\n\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\nvoid sqlite3pager_get_codec(Pager *pPager, void **ctx) {\n  *ctx = pPager->pCodec;\n}\n\nint sqlite3pager_is_mj_pgno(Pager *pPager, Pgno pgno) {\n  return (PAGER_MJ_PGNO(pPager) == pgno) ? 1 : 0;\n}\n\nsqlite3_file *sqlite3Pager_get_fd(Pager *pPager) {\n  return (isOpen(pPager->fd)) ? pPager->fd : NULL;\n}\n\nvoid sqlite3pager_sqlite3PagerSetCodec(\n  Pager *pPager,\n  void *(*xCodec)(void*,void*,Pgno,int),\n  void (*xCodecSizeChng)(void*,int,int),\n  void (*xCodecFree)(void*),\n  void *pCodec\n){\n  sqlite3PagerSetCodec(pPager, xCodec, xCodecSizeChng, xCodecFree, pCodec); \n}\n\nvoid sqlite3pager_sqlite3PagerSetError( Pager *pPager, int error) {\n  pPager->errCode = error;\n}\n\n#endif\n/* END SQLCIPHER */\n\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/pager.h",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This header file defines the interface that the sqlite page cache\n** subsystem.  The page cache subsystem reads and writes a file a page\n** at a time and provides a journal for rollback.\n*/\n\n#ifndef SQLITE_PAGER_H\n#define SQLITE_PAGER_H\n\n/*\n** Default maximum size for persistent journal files. A negative \n** value means no limit. This value may be overridden using the \n** sqlite3PagerJournalSizeLimit() API. See also \"PRAGMA journal_size_limit\".\n*/\n#ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT\n  #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1\n#endif\n\n/*\n** The type used to represent a page number.  The first page in a file\n** is called page 1.  0 is used to represent \"not a page\".\n*/\ntypedef u32 Pgno;\n\n/*\n** Each open file is managed by a separate instance of the \"Pager\" structure.\n*/\ntypedef struct Pager Pager;\n\n/*\n** Handle type for pages.\n*/\ntypedef struct PgHdr DbPage;\n\n/*\n** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is\n** reserved for working around a windows/posix incompatibility). It is\n** used in the journal to signify that the remainder of the journal file \n** is devoted to storing a master journal name - there are no more pages to\n** roll back. See comments for function writeMasterJournal() in pager.c \n** for details.\n*/\n#define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))\n\n/*\n** Allowed values for the flags parameter to sqlite3PagerOpen().\n**\n** NOTE: These values must match the corresponding BTREE_ values in btree.h.\n*/\n#define PAGER_OMIT_JOURNAL  0x0001    /* Do not use a rollback journal */\n#define PAGER_MEMORY        0x0002    /* In-memory database */\n\n/*\n** Valid values for the second argument to sqlite3PagerLockingMode().\n*/\n#define PAGER_LOCKINGMODE_QUERY      -1\n#define PAGER_LOCKINGMODE_NORMAL      0\n#define PAGER_LOCKINGMODE_EXCLUSIVE   1\n\n/*\n** Numeric constants that encode the journalmode.\n**\n** The numeric values encoded here (other than PAGER_JOURNALMODE_QUERY)\n** are exposed in the API via the \"PRAGMA journal_mode\" command and\n** therefore cannot be changed without a compatibility break.\n*/\n#define PAGER_JOURNALMODE_QUERY     (-1)  /* Query the value of journalmode */\n#define PAGER_JOURNALMODE_DELETE      0   /* Commit by deleting journal file */\n#define PAGER_JOURNALMODE_PERSIST     1   /* Commit by zeroing journal header */\n#define PAGER_JOURNALMODE_OFF         2   /* Journal omitted.  */\n#define PAGER_JOURNALMODE_TRUNCATE    3   /* Commit by truncating journal */\n#define PAGER_JOURNALMODE_MEMORY      4   /* In-memory journal file */\n#define PAGER_JOURNALMODE_WAL         5   /* Use write-ahead logging */\n\n/*\n** Flags that make up the mask passed to sqlite3PagerGet().\n*/\n#define PAGER_GET_NOCONTENT     0x01  /* Do not load data from disk */\n#define PAGER_GET_READONLY      0x02  /* Read-only page is acceptable */\n\n/*\n** Flags for sqlite3PagerSetFlags()\n**\n** Value constraints (enforced via assert()):\n**    PAGER_FULLFSYNC      == SQLITE_FullFSync\n**    PAGER_CKPT_FULLFSYNC == SQLITE_CkptFullFSync\n**    PAGER_CACHE_SPILL    == SQLITE_CacheSpill\n*/\n#define PAGER_SYNCHRONOUS_OFF       0x01  /* PRAGMA synchronous=OFF */\n#define PAGER_SYNCHRONOUS_NORMAL    0x02  /* PRAGMA synchronous=NORMAL */\n#define PAGER_SYNCHRONOUS_FULL      0x03  /* PRAGMA synchronous=FULL */\n#define PAGER_SYNCHRONOUS_EXTRA     0x04  /* PRAGMA synchronous=EXTRA */\n#define PAGER_SYNCHRONOUS_MASK      0x07  /* Mask for four values above */\n#define PAGER_FULLFSYNC             0x08  /* PRAGMA fullfsync=ON */\n#define PAGER_CKPT_FULLFSYNC        0x10  /* PRAGMA checkpoint_fullfsync=ON */\n#define PAGER_CACHESPILL            0x20  /* PRAGMA cache_spill=ON */\n#define PAGER_FLAGS_MASK            0x38  /* All above except SYNCHRONOUS */\n\n/*\n** The remainder of this file contains the declarations of the functions\n** that make up the Pager sub-system API. See source code comments for \n** a detailed description of each routine.\n*/\n\n/* Open and close a Pager connection. */ \nint sqlite3PagerOpen(\n  sqlite3_vfs*,\n  Pager **ppPager,\n  const char*,\n  int,\n  int,\n  int,\n  void(*)(DbPage*)\n);\nint sqlite3PagerClose(Pager *pPager);\nint sqlite3PagerReadFileheader(Pager*, int, unsigned char*);\n\n/* Functions used to configure a Pager object. */\nvoid sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *);\nint sqlite3PagerSetPagesize(Pager*, u32*, int);\n#ifdef SQLITE_HAS_CODEC\nvoid sqlite3PagerAlignReserve(Pager*,Pager*);\n#endif\nint sqlite3PagerMaxPageCount(Pager*, int);\nvoid sqlite3PagerSetCachesize(Pager*, int);\nint sqlite3PagerSetSpillsize(Pager*, int);\nvoid sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64);\nvoid sqlite3PagerShrink(Pager*);\nvoid sqlite3PagerSetFlags(Pager*,unsigned);\nint sqlite3PagerLockingMode(Pager *, int);\nint sqlite3PagerSetJournalMode(Pager *, int);\nint sqlite3PagerGetJournalMode(Pager*);\nint sqlite3PagerOkToChangeJournalMode(Pager*);\ni64 sqlite3PagerJournalSizeLimit(Pager *, i64);\nsqlite3_backup **sqlite3PagerBackupPtr(Pager*);\nint sqlite3PagerFlush(Pager*);\n\n/* Functions used to obtain and release page references. */ \nint sqlite3PagerGet(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);\nDbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);\nvoid sqlite3PagerRef(DbPage*);\nvoid sqlite3PagerUnref(DbPage*);\nvoid sqlite3PagerUnrefNotNull(DbPage*);\n\n/* Operations on page references. */\nint sqlite3PagerWrite(DbPage*);\nvoid sqlite3PagerDontWrite(DbPage*);\nint sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);\nint sqlite3PagerPageRefcount(DbPage*);\nvoid *sqlite3PagerGetData(DbPage *); \nvoid *sqlite3PagerGetExtra(DbPage *); \n\n/* Functions used to manage pager transactions and savepoints. */\nvoid sqlite3PagerPagecount(Pager*, int*);\nint sqlite3PagerBegin(Pager*, int exFlag, int);\nint sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int);\nint sqlite3PagerExclusiveLock(Pager*);\nint sqlite3PagerSync(Pager *pPager, const char *zMaster);\nint sqlite3PagerCommitPhaseTwo(Pager*);\nint sqlite3PagerRollback(Pager*);\nint sqlite3PagerOpenSavepoint(Pager *pPager, int n);\nint sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint);\nint sqlite3PagerSharedLock(Pager *pPager);\n\n#ifndef SQLITE_OMIT_WAL\n  int sqlite3PagerCheckpoint(Pager *pPager, int, int*, int*);\n  int sqlite3PagerWalSupported(Pager *pPager);\n  int sqlite3PagerWalCallback(Pager *pPager);\n  int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen);\n  int sqlite3PagerCloseWal(Pager *pPager);\n  int sqlite3PagerUseWal(Pager *pPager);\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\nint sqlite3PagerWalCheckpointHandler(Pager *,int (*)(void*,int),void*);\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n# ifdef SQLITE_ENABLE_SNAPSHOT\n  int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot);\n  int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot);\n# endif\n#else\n# define sqlite3PagerUseWal(x) 0\n#endif\n\n#ifdef SQLITE_ENABLE_ZIPVFS\n  int sqlite3PagerWalFramesize(Pager *pPager);\n#endif\n\n/* Functions used to query pager state and configuration. */\nu8 sqlite3PagerIsreadonly(Pager*);\nu32 sqlite3PagerDataVersion(Pager*);\n#ifdef SQLITE_DEBUG\n  int sqlite3PagerRefcount(Pager*);\n#endif\nint sqlite3PagerMemUsed(Pager*);\nconst char *sqlite3PagerFilename(Pager*, int);\nsqlite3_vfs *sqlite3PagerVfs(Pager*);\nsqlite3_file *sqlite3PagerFile(Pager*);\nsqlite3_file *sqlite3PagerJrnlFile(Pager*);\nconst char *sqlite3PagerJournalname(Pager*);\nvoid *sqlite3PagerTempSpace(Pager*);\nint sqlite3PagerIsMemdb(Pager*);\nvoid sqlite3PagerCacheStat(Pager *, int, int, int *);\nvoid sqlite3PagerClearCache(Pager*);\nint sqlite3SectorSize(sqlite3_file *);\n\n/* Functions used to truncate the database file. */\nvoid sqlite3PagerTruncateImage(Pager*,Pgno);\n\nvoid sqlite3PagerRekey(DbPage*, Pgno, u16);\n\n#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL)\nvoid *sqlite3PagerCodec(DbPage *);\n#endif\n\n/* Functions to support testing and debugging. */\n#if !defined(NDEBUG) || defined(SQLITE_TEST)\n  Pgno sqlite3PagerPagenumber(DbPage*);\n  int sqlite3PagerIswriteable(DbPage*);\n#endif\n#ifdef SQLITE_TEST\n  int *sqlite3PagerStats(Pager*);\n  void sqlite3PagerRefdump(Pager*);\n  void disable_simulated_io_errors(void);\n  void enable_simulated_io_errors(void);\n#else\n# define disable_simulated_io_errors()\n# define enable_simulated_io_errors()\n#endif\n\n#if SQLITE_WCDB_SIGNAL_RETRY\nvoid WCDBPagerSetWait(Pager* pPager, int bFlag);\nint WCDBPagerGetWait(Pager* pPager);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n#endif /* SQLITE_PAGER_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/pcache.c",
    "content": "/*\n** 2008 August 05\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file implements that page cache.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** A complete page cache is an instance of this structure.  Every\n** entry in the cache holds a single page of the database file.  The\n** btree layer only operates on the cached copy of the database pages.\n**\n** A page cache entry is \"clean\" if it exactly matches what is currently\n** on disk.  A page is \"dirty\" if it has been modified and needs to be\n** persisted to disk.\n**\n** pDirty, pDirtyTail, pSynced:\n**   All dirty pages are linked into the doubly linked list using\n**   PgHdr.pDirtyNext and pDirtyPrev. The list is maintained in LRU order\n**   such that p was added to the list more recently than p->pDirtyNext.\n**   PCache.pDirty points to the first (newest) element in the list and\n**   pDirtyTail to the last (oldest).\n**\n**   The PCache.pSynced variable is used to optimize searching for a dirty\n**   page to eject from the cache mid-transaction. It is better to eject\n**   a page that does not require a journal sync than one that does. \n**   Therefore, pSynced is maintained to that it *almost* always points\n**   to either the oldest page in the pDirty/pDirtyTail list that has a\n**   clear PGHDR_NEED_SYNC flag or to a page that is older than this one\n**   (so that the right page to eject can be found by following pDirtyPrev\n**   pointers).\n*/\nstruct PCache {\n  PgHdr *pDirty, *pDirtyTail;         /* List of dirty pages in LRU order */\n  PgHdr *pSynced;                     /* Last synced page in dirty page list */\n  int nRefSum;                        /* Sum of ref counts over all pages */\n  int szCache;                        /* Configured cache size */\n  int szSpill;                        /* Size before spilling occurs */\n  int szPage;                         /* Size of every page in this cache */\n  int szExtra;                        /* Size of extra space for each page */\n  u8 bPurgeable;                      /* True if pages are on backing store */\n  u8 eCreate;                         /* eCreate value for for xFetch() */\n  int (*xStress)(void*,PgHdr*);       /* Call to try make a page clean */\n  void *pStress;                      /* Argument to xStress */\n  sqlite3_pcache *pCache;             /* Pluggable cache module */\n};\n\n/********************************** Test and Debug Logic **********************/\n/*\n** Debug tracing macros.  Enable by by changing the \"0\" to \"1\" and\n** recompiling.\n**\n** When sqlite3PcacheTrace is 1, single line trace messages are issued.\n** When sqlite3PcacheTrace is 2, a dump of the pcache showing all cache entries\n** is displayed for many operations, resulting in a lot of output.\n*/\n#if defined(SQLITE_DEBUG) && 0\n  int sqlite3PcacheTrace = 2;       /* 0: off  1: simple  2: cache dumps */\n  int sqlite3PcacheMxDump = 9999;   /* Max cache entries for pcacheDump() */\n# define pcacheTrace(X) if(sqlite3PcacheTrace){sqlite3DebugPrintf X;}\n  void pcacheDump(PCache *pCache){\n    int N;\n    int i, j;\n    sqlite3_pcache_page *pLower;\n    PgHdr *pPg;\n    unsigned char *a;\n  \n    if( sqlite3PcacheTrace<2 ) return;\n    if( pCache->pCache==0 ) return;\n    N = sqlite3PcachePagecount(pCache);\n    if( N>sqlite3PcacheMxDump ) N = sqlite3PcacheMxDump;\n    for(i=1; i<=N; i++){\n       pLower = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, i, 0);\n       if( pLower==0 ) continue;\n       pPg = (PgHdr*)pLower->pExtra;\n       printf(\"%3d: nRef %2d flgs %02x data \", i, pPg->nRef, pPg->flags);\n       a = (unsigned char *)pLower->pBuf;\n       for(j=0; j<12; j++) printf(\"%02x\", a[j]);\n       printf(\"\\n\");\n       if( pPg->pPage==0 ){\n         sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, pLower, 0);\n       }\n    }\n  }\n  #else\n# define pcacheTrace(X)\n# define pcacheDump(X)\n#endif\n\n/*\n** Check invariants on a PgHdr entry.  Return true if everything is OK.\n** Return false if any invariant is violated.\n**\n** This routine is for use inside of assert() statements only.  For\n** example:\n**\n**          assert( sqlite3PcachePageSanity(pPg) );\n*/\n#if SQLITE_DEBUG\nint sqlite3PcachePageSanity(PgHdr *pPg){\n  PCache *pCache;\n  assert( pPg!=0 );\n  assert( pPg->pgno>0 );    /* Page number is 1 or more */\n  pCache = pPg->pCache;\n  assert( pCache!=0 );      /* Every page has an associated PCache */\n  if( pPg->flags & PGHDR_CLEAN ){\n    assert( (pPg->flags & PGHDR_DIRTY)==0 );/* Cannot be both CLEAN and DIRTY */\n    assert( pCache->pDirty!=pPg );          /* CLEAN pages not on dirty list */\n    assert( pCache->pDirtyTail!=pPg );\n  }\n  /* WRITEABLE pages must also be DIRTY */\n  if( pPg->flags & PGHDR_WRITEABLE ){\n    assert( pPg->flags & PGHDR_DIRTY );     /* WRITEABLE implies DIRTY */\n  }\n  /* NEED_SYNC can be set independently of WRITEABLE.  This can happen,\n  ** for example, when using the sqlite3PagerDontWrite() optimization:\n  **    (1)  Page X is journalled, and gets WRITEABLE and NEED_SEEK.\n  **    (2)  Page X moved to freelist, WRITEABLE is cleared\n  **    (3)  Page X reused, WRITEABLE is set again\n  ** If NEED_SYNC had been cleared in step 2, then it would not be reset\n  ** in step 3, and page might be written into the database without first\n  ** syncing the rollback journal, which might cause corruption on a power\n  ** loss.\n  **\n  ** Another example is when the database page size is smaller than the\n  ** disk sector size.  When any page of a sector is journalled, all pages\n  ** in that sector are marked NEED_SYNC even if they are still CLEAN, just\n  ** in case they are later modified, since all pages in the same sector\n  ** must be journalled and synced before any of those pages can be safely\n  ** written.\n  */\n  return 1;\n}\n#endif /* SQLITE_DEBUG */\n\n\n/********************************** Linked List Management ********************/\n\n/* Allowed values for second argument to pcacheManageDirtyList() */\n#define PCACHE_DIRTYLIST_REMOVE   1    /* Remove pPage from dirty list */\n#define PCACHE_DIRTYLIST_ADD      2    /* Add pPage to the dirty list */\n#define PCACHE_DIRTYLIST_FRONT    3    /* Move pPage to the front of the list */\n\n/*\n** Manage pPage's participation on the dirty list.  Bits of the addRemove\n** argument determines what operation to do.  The 0x01 bit means first\n** remove pPage from the dirty list.  The 0x02 means add pPage back to\n** the dirty list.  Doing both moves pPage to the front of the dirty list.\n*/\nstatic void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){\n  PCache *p = pPage->pCache;\n\n  pcacheTrace((\"%p.DIRTYLIST.%s %d\\n\", p,\n                addRemove==1 ? \"REMOVE\" : addRemove==2 ? \"ADD\" : \"FRONT\",\n                pPage->pgno));\n  if( addRemove & PCACHE_DIRTYLIST_REMOVE ){\n    assert( pPage->pDirtyNext || pPage==p->pDirtyTail );\n    assert( pPage->pDirtyPrev || pPage==p->pDirty );\n  \n    /* Update the PCache1.pSynced variable if necessary. */\n    if( p->pSynced==pPage ){\n      p->pSynced = pPage->pDirtyPrev;\n    }\n  \n    if( pPage->pDirtyNext ){\n      pPage->pDirtyNext->pDirtyPrev = pPage->pDirtyPrev;\n    }else{\n      assert( pPage==p->pDirtyTail );\n      p->pDirtyTail = pPage->pDirtyPrev;\n    }\n    if( pPage->pDirtyPrev ){\n      pPage->pDirtyPrev->pDirtyNext = pPage->pDirtyNext;\n    }else{\n      /* If there are now no dirty pages in the cache, set eCreate to 2. \n      ** This is an optimization that allows sqlite3PcacheFetch() to skip\n      ** searching for a dirty page to eject from the cache when it might\n      ** otherwise have to.  */\n      assert( pPage==p->pDirty );\n      p->pDirty = pPage->pDirtyNext;\n      assert( p->bPurgeable || p->eCreate==2 );\n      if( p->pDirty==0 ){         /*OPTIMIZATION-IF-TRUE*/\n        assert( p->bPurgeable==0 || p->eCreate==1 );\n        p->eCreate = 2;\n      }\n    }\n    pPage->pDirtyNext = 0;\n    pPage->pDirtyPrev = 0;\n  }\n  if( addRemove & PCACHE_DIRTYLIST_ADD ){\n    assert( pPage->pDirtyNext==0 && pPage->pDirtyPrev==0 && p->pDirty!=pPage );\n  \n    pPage->pDirtyNext = p->pDirty;\n    if( pPage->pDirtyNext ){\n      assert( pPage->pDirtyNext->pDirtyPrev==0 );\n      pPage->pDirtyNext->pDirtyPrev = pPage;\n    }else{\n      p->pDirtyTail = pPage;\n      if( p->bPurgeable ){\n        assert( p->eCreate==2 );\n        p->eCreate = 1;\n      }\n    }\n    p->pDirty = pPage;\n\n    /* If pSynced is NULL and this page has a clear NEED_SYNC flag, set\n    ** pSynced to point to it. Checking the NEED_SYNC flag is an \n    ** optimization, as if pSynced points to a page with the NEED_SYNC\n    ** flag set sqlite3PcacheFetchStress() searches through all newer \n    ** entries of the dirty-list for a page with NEED_SYNC clear anyway.  */\n    if( !p->pSynced \n     && 0==(pPage->flags&PGHDR_NEED_SYNC)   /*OPTIMIZATION-IF-FALSE*/\n    ){\n      p->pSynced = pPage;\n    }\n  }\n  pcacheDump(p);\n}\n\n/*\n** Wrapper around the pluggable caches xUnpin method. If the cache is\n** being used for an in-memory database, this function is a no-op.\n*/\nstatic void pcacheUnpin(PgHdr *p){\n  if( p->pCache->bPurgeable ){\n    pcacheTrace((\"%p.UNPIN %d\\n\", p->pCache, p->pgno));\n    sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 0);\n    pcacheDump(p->pCache);\n  }\n}\n\n/*\n** Compute the number of pages of cache requested.   p->szCache is the\n** cache size requested by the \"PRAGMA cache_size\" statement.\n*/\nstatic int numberOfCachePages(PCache *p){\n  if( p->szCache>=0 ){\n    /* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the\n    ** suggested cache size is set to N. */\n    return p->szCache;\n  }else{\n    /* IMPLEMENTATION-OF: R-61436-13639 If the argument N is negative, then\n    ** the number of cache pages is adjusted to use approximately abs(N*1024)\n    ** bytes of memory. */\n    return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra));\n  }\n}\n\n/*************************************************** General Interfaces ******\n**\n** Initialize and shutdown the page cache subsystem. Neither of these \n** functions are threadsafe.\n*/\nint sqlite3PcacheInitialize(void){\n  if( sqlite3GlobalConfig.pcache2.xInit==0 ){\n    /* IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the\n    ** built-in default page cache is used instead of the application defined\n    ** page cache. */\n    sqlite3PCacheSetDefault();\n  }\n  return sqlite3GlobalConfig.pcache2.xInit(sqlite3GlobalConfig.pcache2.pArg);\n}\nvoid sqlite3PcacheShutdown(void){\n  if( sqlite3GlobalConfig.pcache2.xShutdown ){\n    /* IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. */\n    sqlite3GlobalConfig.pcache2.xShutdown(sqlite3GlobalConfig.pcache2.pArg);\n  }\n}\n\n/*\n** Return the size in bytes of a PCache object.\n*/\nint sqlite3PcacheSize(void){ return sizeof(PCache); }\n\n/*\n** Create a new PCache object. Storage space to hold the object\n** has already been allocated and is passed in as the p pointer. \n** The caller discovers how much space needs to be allocated by \n** calling sqlite3PcacheSize().\n*/\nint sqlite3PcacheOpen(\n  int szPage,                  /* Size of every page */\n  int szExtra,                 /* Extra space associated with each page */\n  int bPurgeable,              /* True if pages are on backing store */\n  int (*xStress)(void*,PgHdr*),/* Call to try to make pages clean */\n  void *pStress,               /* Argument to xStress */\n  PCache *p                    /* Preallocated space for the PCache */\n){\n  memset(p, 0, sizeof(PCache));\n  p->szPage = 1;\n  p->szExtra = szExtra;\n  p->bPurgeable = bPurgeable;\n  p->eCreate = 2;\n  p->xStress = xStress;\n  p->pStress = pStress;\n  p->szCache = 100;\n  p->szSpill = 1;\n  pcacheTrace((\"%p.OPEN szPage %d bPurgeable %d\\n\",p,szPage,bPurgeable));\n  return sqlite3PcacheSetPageSize(p, szPage);\n}\n\n/*\n** Change the page size for PCache object. The caller must ensure that there\n** are no outstanding page references when this function is called.\n*/\nint sqlite3PcacheSetPageSize(PCache *pCache, int szPage){\n  assert( pCache->nRefSum==0 && pCache->pDirty==0 );\n  if( pCache->szPage ){\n    sqlite3_pcache *pNew;\n    pNew = sqlite3GlobalConfig.pcache2.xCreate(\n                szPage, pCache->szExtra + ROUND8(sizeof(PgHdr)),\n                pCache->bPurgeable\n    );\n    if( pNew==0 ) return SQLITE_NOMEM_BKPT;\n    sqlite3GlobalConfig.pcache2.xCachesize(pNew, numberOfCachePages(pCache));\n    if( pCache->pCache ){\n      sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);\n    }\n    pCache->pCache = pNew;\n    pCache->szPage = szPage;\n    pcacheTrace((\"%p.PAGESIZE %d\\n\",pCache,szPage));\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Try to obtain a page from the cache.\n**\n** This routine returns a pointer to an sqlite3_pcache_page object if\n** such an object is already in cache, or if a new one is created.\n** This routine returns a NULL pointer if the object was not in cache\n** and could not be created.\n**\n** The createFlags should be 0 to check for existing pages and should\n** be 3 (not 1, but 3) to try to create a new page.\n**\n** If the createFlag is 0, then NULL is always returned if the page\n** is not already in the cache.  If createFlag is 1, then a new page\n** is created only if that can be done without spilling dirty pages\n** and without exceeding the cache size limit.\n**\n** The caller needs to invoke sqlite3PcacheFetchFinish() to properly\n** initialize the sqlite3_pcache_page object and convert it into a\n** PgHdr object.  The sqlite3PcacheFetch() and sqlite3PcacheFetchFinish()\n** routines are split this way for performance reasons. When separated\n** they can both (usually) operate without having to push values to\n** the stack on entry and pop them back off on exit, which saves a\n** lot of pushing and popping.\n*/\nsqlite3_pcache_page *sqlite3PcacheFetch(\n  PCache *pCache,       /* Obtain the page from this cache */\n  Pgno pgno,            /* Page number to obtain */\n  int createFlag        /* If true, create page if it does not exist already */\n){\n  int eCreate;\n  sqlite3_pcache_page *pRes;\n\n  assert( pCache!=0 );\n  assert( pCache->pCache!=0 );\n  assert( createFlag==3 || createFlag==0 );\n  assert( pgno>0 );\n  assert( pCache->eCreate==((pCache->bPurgeable && pCache->pDirty) ? 1 : 2) );\n\n  /* eCreate defines what to do if the page does not exist.\n  **    0     Do not allocate a new page.  (createFlag==0)\n  **    1     Allocate a new page if doing so is inexpensive.\n  **          (createFlag==1 AND bPurgeable AND pDirty)\n  **    2     Allocate a new page even it doing so is difficult.\n  **          (createFlag==1 AND !(bPurgeable AND pDirty)\n  */\n  eCreate = createFlag & pCache->eCreate;\n  assert( eCreate==0 || eCreate==1 || eCreate==2 );\n  assert( createFlag==0 || pCache->eCreate==eCreate );\n  assert( createFlag==0 || eCreate==1+(!pCache->bPurgeable||!pCache->pDirty) );\n  pRes = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate);\n  pcacheTrace((\"%p.FETCH %d%s (result: %p)\\n\",pCache,pgno,\n               createFlag?\" create\":\"\",pRes));\n  return pRes;\n}\n\n/*\n** If the sqlite3PcacheFetch() routine is unable to allocate a new\n** page because no clean pages are available for reuse and the cache\n** size limit has been reached, then this routine can be invoked to \n** try harder to allocate a page.  This routine might invoke the stress\n** callback to spill dirty pages to the journal.  It will then try to\n** allocate the new page and will only fail to allocate a new page on\n** an OOM error.\n**\n** This routine should be invoked only after sqlite3PcacheFetch() fails.\n*/\nint sqlite3PcacheFetchStress(\n  PCache *pCache,                 /* Obtain the page from this cache */\n  Pgno pgno,                      /* Page number to obtain */\n  sqlite3_pcache_page **ppPage    /* Write result here */\n){\n  PgHdr *pPg;\n  if( pCache->eCreate==2 ) return 0;\n\n  if( sqlite3PcachePagecount(pCache)>pCache->szSpill ){\n    /* Find a dirty page to write-out and recycle. First try to find a \n    ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC\n    ** cleared), but if that is not possible settle for any other \n    ** unreferenced dirty page.\n    **\n    ** If the LRU page in the dirty list that has a clear PGHDR_NEED_SYNC\n    ** flag is currently referenced, then the following may leave pSynced\n    ** set incorrectly (pointing to other than the LRU page with NEED_SYNC\n    ** cleared). This is Ok, as pSynced is just an optimization.  */\n    for(pPg=pCache->pSynced; \n        pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC)); \n        pPg=pPg->pDirtyPrev\n    );\n    pCache->pSynced = pPg;\n    if( !pPg ){\n      for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev);\n    }\n    if( pPg ){\n      int rc;\n#ifdef SQLITE_LOG_CACHE_SPILL\n      sqlite3_log(SQLITE_FULL, \n                  \"spill page %d making room for %d - cache used: %d/%d\",\n                  pPg->pgno, pgno,\n                  sqlite3GlobalConfig.pcache.xPagecount(pCache->pCache),\n                numberOfCachePages(pCache));\n#endif\n      pcacheTrace((\"%p.SPILL %d\\n\",pCache,pPg->pgno));\n      rc = pCache->xStress(pCache->pStress, pPg);\n      pcacheDump(pCache);\n      if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){\n        return rc;\n      }\n    }\n  }\n  *ppPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2);\n  return *ppPage==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;\n}\n\n/*\n** This is a helper routine for sqlite3PcacheFetchFinish()\n**\n** In the uncommon case where the page being fetched has not been\n** initialized, this routine is invoked to do the initialization.\n** This routine is broken out into a separate function since it\n** requires extra stack manipulation that can be avoided in the common\n** case.\n*/\nstatic SQLITE_NOINLINE PgHdr *pcacheFetchFinishWithInit(\n  PCache *pCache,             /* Obtain the page from this cache */\n  Pgno pgno,                  /* Page number obtained */\n  sqlite3_pcache_page *pPage  /* Page obtained by prior PcacheFetch() call */\n){\n  PgHdr *pPgHdr;\n  assert( pPage!=0 );\n  pPgHdr = (PgHdr*)pPage->pExtra;\n  assert( pPgHdr->pPage==0 );\n  memset(&pPgHdr->pDirty, 0, sizeof(PgHdr) - offsetof(PgHdr,pDirty));\n  pPgHdr->pPage = pPage;\n  pPgHdr->pData = pPage->pBuf;\n  pPgHdr->pExtra = (void *)&pPgHdr[1];\n  memset(pPgHdr->pExtra, 0, pCache->szExtra);\n  pPgHdr->pCache = pCache;\n  pPgHdr->pgno = pgno;\n  pPgHdr->flags = PGHDR_CLEAN;\n  return sqlite3PcacheFetchFinish(pCache,pgno,pPage);\n}\n\n/*\n** This routine converts the sqlite3_pcache_page object returned by\n** sqlite3PcacheFetch() into an initialized PgHdr object.  This routine\n** must be called after sqlite3PcacheFetch() in order to get a usable\n** result.\n*/\nPgHdr *sqlite3PcacheFetchFinish(\n  PCache *pCache,             /* Obtain the page from this cache */\n  Pgno pgno,                  /* Page number obtained */\n  sqlite3_pcache_page *pPage  /* Page obtained by prior PcacheFetch() call */\n){\n  PgHdr *pPgHdr;\n\n  assert( pPage!=0 );\n  pPgHdr = (PgHdr *)pPage->pExtra;\n\n  if( !pPgHdr->pPage ){\n    return pcacheFetchFinishWithInit(pCache, pgno, pPage);\n  }\n  pCache->nRefSum++;\n  pPgHdr->nRef++;\n  assert( sqlite3PcachePageSanity(pPgHdr) );\n  return pPgHdr;\n}\n\n/*\n** Decrement the reference count on a page. If the page is clean and the\n** reference count drops to 0, then it is made eligible for recycling.\n*/\nvoid SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){\n  assert( p->nRef>0 );\n  p->pCache->nRefSum--;\n  if( (--p->nRef)==0 ){\n    if( p->flags&PGHDR_CLEAN ){\n      pcacheUnpin(p);\n    }else if( p->pDirtyPrev!=0 ){ /*OPTIMIZATION-IF-FALSE*/\n      /* Move the page to the head of the dirty list. If p->pDirtyPrev==0,\n      ** then page p is already at the head of the dirty list and the\n      ** following call would be a no-op. Hence the OPTIMIZATION-IF-FALSE\n      ** tag above.  */\n      pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);\n    }\n  }\n}\n\n/*\n** Increase the reference count of a supplied page by 1.\n*/\nvoid sqlite3PcacheRef(PgHdr *p){\n  assert(p->nRef>0);\n  assert( sqlite3PcachePageSanity(p) );\n  p->nRef++;\n  p->pCache->nRefSum++;\n}\n\n/*\n** Drop a page from the cache. There must be exactly one reference to the\n** page. This function deletes that reference, so after it returns the\n** page pointed to by p is invalid.\n*/\nvoid sqlite3PcacheDrop(PgHdr *p){\n  assert( p->nRef==1 );\n  assert( sqlite3PcachePageSanity(p) );\n  if( p->flags&PGHDR_DIRTY ){\n    pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);\n  }\n  p->pCache->nRefSum--;\n  sqlite3GlobalConfig.pcache2.xUnpin(p->pCache->pCache, p->pPage, 1);\n}\n\n/*\n** Make sure the page is marked as dirty. If it isn't dirty already,\n** make it so.\n*/\nvoid sqlite3PcacheMakeDirty(PgHdr *p){\n  assert( p->nRef>0 );\n  assert( sqlite3PcachePageSanity(p) );\n  if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){    /*OPTIMIZATION-IF-FALSE*/\n    p->flags &= ~PGHDR_DONT_WRITE;\n    if( p->flags & PGHDR_CLEAN ){\n      p->flags ^= (PGHDR_DIRTY|PGHDR_CLEAN);\n      pcacheTrace((\"%p.DIRTY %d\\n\",p->pCache,p->pgno));\n      assert( (p->flags & (PGHDR_DIRTY|PGHDR_CLEAN))==PGHDR_DIRTY );\n      pcacheManageDirtyList(p, PCACHE_DIRTYLIST_ADD);\n    }\n    assert( sqlite3PcachePageSanity(p) );\n  }\n}\n\n/*\n** Make sure the page is marked as clean. If it isn't clean already,\n** make it so.\n*/\nvoid sqlite3PcacheMakeClean(PgHdr *p){\n  assert( sqlite3PcachePageSanity(p) );\n  if( ALWAYS((p->flags & PGHDR_DIRTY)!=0) ){\n    assert( (p->flags & PGHDR_CLEAN)==0 );\n    pcacheManageDirtyList(p, PCACHE_DIRTYLIST_REMOVE);\n    p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC|PGHDR_WRITEABLE);\n    p->flags |= PGHDR_CLEAN;\n    pcacheTrace((\"%p.CLEAN %d\\n\",p->pCache,p->pgno));\n    assert( sqlite3PcachePageSanity(p) );\n    if( p->nRef==0 ){\n      pcacheUnpin(p);\n    }\n  }\n}\n\n/*\n** Make every page in the cache clean.\n*/\nvoid sqlite3PcacheCleanAll(PCache *pCache){\n  PgHdr *p;\n  pcacheTrace((\"%p.CLEAN-ALL\\n\",pCache));\n  while( (p = pCache->pDirty)!=0 ){\n    sqlite3PcacheMakeClean(p);\n  }\n}\n\n/*\n** Clear the PGHDR_NEED_SYNC and PGHDR_WRITEABLE flag from all dirty pages.\n*/\nvoid sqlite3PcacheClearWritable(PCache *pCache){\n  PgHdr *p;\n  pcacheTrace((\"%p.CLEAR-WRITEABLE\\n\",pCache));\n  for(p=pCache->pDirty; p; p=p->pDirtyNext){\n    p->flags &= ~(PGHDR_NEED_SYNC|PGHDR_WRITEABLE);\n  }\n  pCache->pSynced = pCache->pDirtyTail;\n}\n\n/*\n** Clear the PGHDR_NEED_SYNC flag from all dirty pages.\n*/\nvoid sqlite3PcacheClearSyncFlags(PCache *pCache){\n  PgHdr *p;\n  for(p=pCache->pDirty; p; p=p->pDirtyNext){\n    p->flags &= ~PGHDR_NEED_SYNC;\n  }\n  pCache->pSynced = pCache->pDirtyTail;\n}\n\n/*\n** Change the page number of page p to newPgno. \n*/\nvoid sqlite3PcacheMove(PgHdr *p, Pgno newPgno){\n  PCache *pCache = p->pCache;\n  assert( p->nRef>0 );\n  assert( newPgno>0 );\n  assert( sqlite3PcachePageSanity(p) );\n  pcacheTrace((\"%p.MOVE %d -> %d\\n\",pCache,p->pgno,newPgno));\n  sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);\n  p->pgno = newPgno;\n  if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){\n    pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);\n  }\n}\n\n/*\n** Drop every cache entry whose page number is greater than \"pgno\". The\n** caller must ensure that there are no outstanding references to any pages\n** other than page 1 with a page number greater than pgno.\n**\n** If there is a reference to page 1 and the pgno parameter passed to this\n** function is 0, then the data area associated with page 1 is zeroed, but\n** the page object is not dropped.\n*/\nvoid sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){\n  if( pCache->pCache ){\n    PgHdr *p;\n    PgHdr *pNext;\n    pcacheTrace((\"%p.TRUNCATE %d\\n\",pCache,pgno));\n    for(p=pCache->pDirty; p; p=pNext){\n      pNext = p->pDirtyNext;\n      /* This routine never gets call with a positive pgno except right\n      ** after sqlite3PcacheCleanAll().  So if there are dirty pages,\n      ** it must be that pgno==0.\n      */\n      assert( p->pgno>0 );\n      if( p->pgno>pgno ){\n        assert( p->flags&PGHDR_DIRTY );\n        sqlite3PcacheMakeClean(p);\n      }\n    }\n    if( pgno==0 && pCache->nRefSum ){\n      sqlite3_pcache_page *pPage1;\n      pPage1 = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache,1,0);\n      if( ALWAYS(pPage1) ){  /* Page 1 is always available in cache, because\n                             ** pCache->nRefSum>0 */\n        memset(pPage1->pBuf, 0, pCache->szPage);\n        pgno = 1;\n      }\n    }\n    sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1);\n  }\n}\n\n/*\n** Close a cache.\n*/\nvoid sqlite3PcacheClose(PCache *pCache){\n  assert( pCache->pCache!=0 );\n  pcacheTrace((\"%p.CLOSE\\n\",pCache));\n  sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache);\n}\n\n/* \n** Discard the contents of the cache.\n*/\nvoid sqlite3PcacheClear(PCache *pCache){\n  sqlite3PcacheTruncate(pCache, 0);\n}\n\n/*\n** Merge two lists of pages connected by pDirty and in pgno order.\n** Do not bother fixing the pDirtyPrev pointers.\n*/\nstatic PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){\n  PgHdr result, *pTail;\n  pTail = &result;\n  assert( pA!=0 && pB!=0 );\n  for(;;){\n    if( pA->pgno<pB->pgno ){\n      pTail->pDirty = pA;\n      pTail = pA;\n      pA = pA->pDirty;\n      if( pA==0 ){\n        pTail->pDirty = pB;\n        break;\n      }\n    }else{\n      pTail->pDirty = pB;\n      pTail = pB;\n      pB = pB->pDirty;\n      if( pB==0 ){\n        pTail->pDirty = pA;\n        break;\n      }\n    }\n  }\n  return result.pDirty;\n}\n\n/*\n** Sort the list of pages in accending order by pgno.  Pages are\n** connected by pDirty pointers.  The pDirtyPrev pointers are\n** corrupted by this sort.\n**\n** Since there cannot be more than 2^31 distinct pages in a database,\n** there cannot be more than 31 buckets required by the merge sorter.\n** One extra bucket is added to catch overflow in case something\n** ever changes to make the previous sentence incorrect.\n*/\n#define N_SORT_BUCKET  32\nstatic PgHdr *pcacheSortDirtyList(PgHdr *pIn){\n  PgHdr *a[N_SORT_BUCKET], *p;\n  int i;\n  memset(a, 0, sizeof(a));\n  while( pIn ){\n    p = pIn;\n    pIn = p->pDirty;\n    p->pDirty = 0;\n    for(i=0; ALWAYS(i<N_SORT_BUCKET-1); i++){\n      if( a[i]==0 ){\n        a[i] = p;\n        break;\n      }else{\n        p = pcacheMergeDirtyList(a[i], p);\n        a[i] = 0;\n      }\n    }\n    if( NEVER(i==N_SORT_BUCKET-1) ){\n      /* To get here, there need to be 2^(N_SORT_BUCKET) elements in\n      ** the input list.  But that is impossible.\n      */\n      a[i] = pcacheMergeDirtyList(a[i], p);\n    }\n  }\n  p = a[0];\n  for(i=1; i<N_SORT_BUCKET; i++){\n    if( a[i]==0 ) continue;\n    p = p ? pcacheMergeDirtyList(p, a[i]) : a[i];\n  }\n  return p;\n}\n\n/*\n** Return a list of all dirty pages in the cache, sorted by page number.\n*/\nPgHdr *sqlite3PcacheDirtyList(PCache *pCache){\n  PgHdr *p;\n  for(p=pCache->pDirty; p; p=p->pDirtyNext){\n    p->pDirty = p->pDirtyNext;\n  }\n  return pcacheSortDirtyList(pCache->pDirty);\n}\n\n/* \n** Return the total number of references to all pages held by the cache.\n**\n** This is not the total number of pages referenced, but the sum of the\n** reference count for all pages.\n*/\nint sqlite3PcacheRefCount(PCache *pCache){\n  return pCache->nRefSum;\n}\n\n/*\n** Return the number of references to the page supplied as an argument.\n*/\nint sqlite3PcachePageRefcount(PgHdr *p){\n  return p->nRef;\n}\n\n/* \n** Return the total number of pages in the cache.\n*/\nint sqlite3PcachePagecount(PCache *pCache){\n  assert( pCache->pCache!=0 );\n  return sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache);\n}\n\n#ifdef SQLITE_TEST\n/*\n** Get the suggested cache-size value.\n*/\nint sqlite3PcacheGetCachesize(PCache *pCache){\n  return numberOfCachePages(pCache);\n}\n#endif\n\n/*\n** Set the suggested cache-size value.\n*/\nvoid sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){\n  assert( pCache->pCache!=0 );\n  pCache->szCache = mxPage;\n  sqlite3GlobalConfig.pcache2.xCachesize(pCache->pCache,\n                                         numberOfCachePages(pCache));\n}\n\n/*\n** Set the suggested cache-spill value.  Make no changes if if the\n** argument is zero.  Return the effective cache-spill size, which will\n** be the larger of the szSpill and szCache.\n*/\nint sqlite3PcacheSetSpillsize(PCache *p, int mxPage){\n  int res;\n  assert( p->pCache!=0 );\n  if( mxPage ){\n    if( mxPage<0 ){\n      mxPage = (int)((-1024*(i64)mxPage)/(p->szPage+p->szExtra));\n    }\n    p->szSpill = mxPage;\n  }\n  res = numberOfCachePages(p);\n  if( res<p->szSpill ) res = p->szSpill; \n  return res;\n}\n\n/*\n** Free up as much memory as possible from the page cache.\n*/\nvoid sqlite3PcacheShrink(PCache *pCache){\n  assert( pCache->pCache!=0 );\n  sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache);\n}\n\n/*\n** Return the size of the header added by this middleware layer\n** in the page-cache hierarchy.\n*/\nint sqlite3HeaderSizePcache(void){ return ROUND8(sizeof(PgHdr)); }\n\n/*\n** Return the number of dirty pages currently in the cache, as a percentage\n** of the configured cache size.\n*/\nint sqlite3PCachePercentDirty(PCache *pCache){\n  PgHdr *pDirty;\n  int nDirty = 0;\n  int nCache = numberOfCachePages(pCache);\n  for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext) nDirty++;\n  return nCache ? (int)(((i64)nDirty * 100) / nCache) : 0;\n}\n\n#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)\n/*\n** For all dirty pages currently in the cache, invoke the specified\n** callback. This is only used if the SQLITE_CHECK_PAGES macro is\n** defined.\n*/\nvoid sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)){\n  PgHdr *pDirty;\n  for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext){\n    xIter(pDirty);\n  }\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/pcache.h",
    "content": "/*\n** 2008 August 05\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This header file defines the interface that the sqlite page cache\n** subsystem. \n*/\n\n#ifndef _PCACHE_H_\n\ntypedef struct PgHdr PgHdr;\ntypedef struct PCache PCache;\n\n/*\n** Every page in the cache is controlled by an instance of the following\n** structure.\n*/\nstruct PgHdr {\n  sqlite3_pcache_page *pPage;    /* Pcache object page handle */\n  void *pData;                   /* Page data */\n  void *pExtra;                  /* Extra content */\n  PgHdr *pDirty;                 /* Transient list of dirty sorted by pgno */\n  Pager *pPager;                 /* The pager this page is part of */\n  Pgno pgno;                     /* Page number for this page */\n#ifdef SQLITE_CHECK_PAGES\n  u32 pageHash;                  /* Hash of page content */\n#endif\n  u16 flags;                     /* PGHDR flags defined below */\n\n  /**********************************************************************\n  ** Elements above are public.  All that follows is private to pcache.c\n  ** and should not be accessed by other modules.\n  */\n  i16 nRef;                      /* Number of users of this page */\n  PCache *pCache;                /* Cache that owns this page */\n\n  PgHdr *pDirtyNext;             /* Next element in list of dirty pages */\n  PgHdr *pDirtyPrev;             /* Previous element in list of dirty pages */\n};\n\n/* Bit values for PgHdr.flags */\n#define PGHDR_CLEAN           0x001  /* Page not on the PCache.pDirty list */\n#define PGHDR_DIRTY           0x002  /* Page is on the PCache.pDirty list */\n#define PGHDR_WRITEABLE       0x004  /* Journaled and ready to modify */\n#define PGHDR_NEED_SYNC       0x008  /* Fsync the rollback journal before\n                                     ** writing this page to the database */\n#define PGHDR_DONT_WRITE      0x010  /* Do not write content to disk */\n#define PGHDR_MMAP            0x020  /* This is an mmap page object */\n\n#define PGHDR_WAL_APPEND      0x040  /* Appended to wal file */\n\n/* Initialize and shutdown the page cache subsystem */\nint sqlite3PcacheInitialize(void);\nvoid sqlite3PcacheShutdown(void);\n\n/* Page cache buffer management:\n** These routines implement SQLITE_CONFIG_PAGECACHE.\n*/\nvoid sqlite3PCacheBufferSetup(void *, int sz, int n);\n\n/* Create a new pager cache.\n** Under memory stress, invoke xStress to try to make pages clean.\n** Only clean and unpinned pages can be reclaimed.\n*/\nint sqlite3PcacheOpen(\n  int szPage,                    /* Size of every page */\n  int szExtra,                   /* Extra space associated with each page */\n  int bPurgeable,                /* True if pages are on backing store */\n  int (*xStress)(void*, PgHdr*), /* Call to try to make pages clean */\n  void *pStress,                 /* Argument to xStress */\n  PCache *pToInit                /* Preallocated space for the PCache */\n);\n\n/* Modify the page-size after the cache has been created. */\nint sqlite3PcacheSetPageSize(PCache *, int);\n\n/* Return the size in bytes of a PCache object.  Used to preallocate\n** storage space.\n*/\nint sqlite3PcacheSize(void);\n\n/* One release per successful fetch.  Page is pinned until released.\n** Reference counted. \n*/\nsqlite3_pcache_page *sqlite3PcacheFetch(PCache*, Pgno, int createFlag);\nint sqlite3PcacheFetchStress(PCache*, Pgno, sqlite3_pcache_page**);\nPgHdr *sqlite3PcacheFetchFinish(PCache*, Pgno, sqlite3_pcache_page *pPage);\nvoid sqlite3PcacheRelease(PgHdr*);\n\nvoid sqlite3PcacheDrop(PgHdr*);         /* Remove page from cache */\nvoid sqlite3PcacheMakeDirty(PgHdr*);    /* Make sure page is marked dirty */\nvoid sqlite3PcacheMakeClean(PgHdr*);    /* Mark a single page as clean */\nvoid sqlite3PcacheCleanAll(PCache*);    /* Mark all dirty list pages as clean */\nvoid sqlite3PcacheClearWritable(PCache*);\n\n/* Change a page number.  Used by incr-vacuum. */\nvoid sqlite3PcacheMove(PgHdr*, Pgno);\n\n/* Remove all pages with pgno>x.  Reset the cache if x==0 */\nvoid sqlite3PcacheTruncate(PCache*, Pgno x);\n\n/* Get a list of all dirty pages in the cache, sorted by page number */\nPgHdr *sqlite3PcacheDirtyList(PCache*);\n\n/* Reset and close the cache object */\nvoid sqlite3PcacheClose(PCache*);\n\n/* Clear flags from pages of the page cache */\nvoid sqlite3PcacheClearSyncFlags(PCache *);\n\n/* Discard the contents of the cache */\nvoid sqlite3PcacheClear(PCache*);\n\n/* Return the total number of outstanding page references */\nint sqlite3PcacheRefCount(PCache*);\n\n/* Increment the reference count of an existing page */\nvoid sqlite3PcacheRef(PgHdr*);\n\nint sqlite3PcachePageRefcount(PgHdr*);\n\n/* Return the total number of pages stored in the cache */\nint sqlite3PcachePagecount(PCache*);\n\n#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)\n/* Iterate through all dirty pages currently stored in the cache. This\n** interface is only available if SQLITE_CHECK_PAGES is defined when the \n** library is built.\n*/\nvoid sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *));\n#endif\n\n#if defined(SQLITE_DEBUG)\n/* Check invariants on a PgHdr object */\nint sqlite3PcachePageSanity(PgHdr*);\n#endif\n\n/* Set and get the suggested cache-size for the specified pager-cache.\n**\n** If no global maximum is configured, then the system attempts to limit\n** the total number of pages cached by purgeable pager-caches to the sum\n** of the suggested cache-sizes.\n*/\nvoid sqlite3PcacheSetCachesize(PCache *, int);\n#ifdef SQLITE_TEST\nint sqlite3PcacheGetCachesize(PCache *);\n#endif\n\n/* Set or get the suggested spill-size for the specified pager-cache.\n**\n** The spill-size is the minimum number of pages in cache before the cache\n** will attempt to spill dirty pages by calling xStress.\n*/\nint sqlite3PcacheSetSpillsize(PCache *, int);\n\n/* Free up as much memory as possible from the page cache */\nvoid sqlite3PcacheShrink(PCache*);\n\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\n/* Try to return memory used by the pcache module to the main memory heap */\nint sqlite3PcacheReleaseMemory(int);\n#endif\n\n#ifdef SQLITE_TEST\nvoid sqlite3PcacheStats(int*,int*,int*,int*);\n#endif\n\nvoid sqlite3PCacheSetDefault(void);\n\n/* Return the header size */\nint sqlite3HeaderSizePcache(void);\nint sqlite3HeaderSizePcache1(void);\n\n/* Number of dirty pages as a percentage of the configured cache size */\nint sqlite3PCachePercentDirty(PCache*);\n\n#endif /* _PCACHE_H_ */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/pcache1.c",
    "content": "/*\n** 2008 November 05\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file implements the default page cache implementation (the\n** sqlite3_pcache interface). It also contains part of the implementation\n** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features.\n** If the default page cache implementation is overridden, then neither of\n** these two features are available.\n**\n** A Page cache line looks like this:\n**\n**  -------------------------------------------------------------\n**  |  database page content   |  PgHdr1  |  MemPage  |  PgHdr  |\n**  -------------------------------------------------------------\n**\n** The database page content is up front (so that buffer overreads tend to\n** flow harmlessly into the PgHdr1, MemPage, and PgHdr extensions).   MemPage\n** is the extension added by the btree.c module containing information such\n** as the database page number and how that database page is used.  PgHdr\n** is added by the pcache.c layer and contains information used to keep track\n** of which pages are \"dirty\".  PgHdr1 is an extension added by this\n** module (pcache1.c).  The PgHdr1 header is a subclass of sqlite3_pcache_page.\n** PgHdr1 contains information needed to look up a page by its page number.\n** The superclass sqlite3_pcache_page.pBuf points to the start of the\n** database page content and sqlite3_pcache_page.pExtra points to PgHdr.\n**\n** The size of the extension (MemPage+PgHdr+PgHdr1) can be determined at\n** runtime using sqlite3_config(SQLITE_CONFIG_PCACHE_HDRSZ, &size).  The\n** sizes of the extensions sum to 272 bytes on x64 for 3.8.10, but this\n** size can vary according to architecture, compile-time options, and\n** SQLite library version number.\n**\n** If SQLITE_PCACHE_SEPARATE_HEADER is defined, then the extension is obtained\n** using a separate memory allocation from the database page content.  This\n** seeks to overcome the \"clownshoe\" problem (also called \"internal\n** fragmentation\" in academic literature) of allocating a few bytes more\n** than a power of two with the memory allocator rounding up to the next\n** power of two, and leaving the rounded-up space unused.\n**\n** This module tracks pointers to PgHdr1 objects.  Only pcache.c communicates\n** with this module.  Information is passed back and forth as PgHdr1 pointers.\n**\n** The pcache.c and pager.c modules deal pointers to PgHdr objects.\n** The btree.c module deals with pointers to MemPage objects.\n**\n** SOURCE OF PAGE CACHE MEMORY:\n**\n** Memory for a page might come from any of three sources:\n**\n**    (1)  The general-purpose memory allocator - sqlite3Malloc()\n**    (2)  Global page-cache memory provided using sqlite3_config() with\n**         SQLITE_CONFIG_PAGECACHE.\n**    (3)  PCache-local bulk allocation.\n**\n** The third case is a chunk of heap memory (defaulting to 100 pages worth)\n** that is allocated when the page cache is created.  The size of the local\n** bulk allocation can be adjusted using \n**\n**     sqlite3_config(SQLITE_CONFIG_PAGECACHE, (void*)0, 0, N).\n**\n** If N is positive, then N pages worth of memory are allocated using a single\n** sqlite3Malloc() call and that memory is used for the first N pages allocated.\n** Or if N is negative, then -1024*N bytes of memory are allocated and used\n** for as many pages as can be accomodated.\n**\n** Only one of (2) or (3) can be used.  Once the memory available to (2) or\n** (3) is exhausted, subsequent allocations fail over to the general-purpose\n** memory allocator (1).\n**\n** Earlier versions of SQLite used only methods (1) and (2).  But experiments\n** show that method (3) with N==100 provides about a 5% performance boost for\n** common workloads.\n*/\n#include \"sqliteInt.h\"\n\ntypedef struct PCache1 PCache1;\ntypedef struct PgHdr1 PgHdr1;\ntypedef struct PgFreeslot PgFreeslot;\ntypedef struct PGroup PGroup;\n\n/*\n** Each cache entry is represented by an instance of the following \n** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of\n** PgHdr1.pCache->szPage bytes is allocated directly before this structure \n** in memory.\n*/\nstruct PgHdr1 {\n  sqlite3_pcache_page page;      /* Base class. Must be first. pBuf & pExtra */\n  unsigned int iKey;             /* Key value (page number) */\n  u8 isPinned;                   /* Page in use, not on the LRU list */\n  u8 isBulkLocal;                /* This page from bulk local storage */\n  u8 isAnchor;                   /* This is the PGroup.lru element */\n  PgHdr1 *pNext;                 /* Next in hash table chain */\n  PCache1 *pCache;               /* Cache that currently owns this page */\n  PgHdr1 *pLruNext;              /* Next in LRU list of unpinned pages */\n  PgHdr1 *pLruPrev;              /* Previous in LRU list of unpinned pages */\n};\n\n/* Each page cache (or PCache) belongs to a PGroup.  A PGroup is a set \n** of one or more PCaches that are able to recycle each other's unpinned\n** pages when they are under memory pressure.  A PGroup is an instance of\n** the following object.\n**\n** This page cache implementation works in one of two modes:\n**\n**   (1)  Every PCache is the sole member of its own PGroup.  There is\n**        one PGroup per PCache.\n**\n**   (2)  There is a single global PGroup that all PCaches are a member\n**        of.\n**\n** Mode 1 uses more memory (since PCache instances are not able to rob\n** unused pages from other PCaches) but it also operates without a mutex,\n** and is therefore often faster.  Mode 2 requires a mutex in order to be\n** threadsafe, but recycles pages more efficiently.\n**\n** For mode (1), PGroup.mutex is NULL.  For mode (2) there is only a single\n** PGroup which is the pcache1.grp global variable and its mutex is\n** SQLITE_MUTEX_STATIC_LRU.\n*/\nstruct PGroup {\n  sqlite3_mutex *mutex;          /* MUTEX_STATIC_LRU or NULL */\n  unsigned int nMaxPage;         /* Sum of nMax for purgeable caches */\n  unsigned int nMinPage;         /* Sum of nMin for purgeable caches */\n  unsigned int mxPinned;         /* nMaxpage + 10 - nMinPage */\n  unsigned int nCurrentPage;     /* Number of purgeable pages allocated */\n  PgHdr1 lru;                    /* The beginning and end of the LRU list */\n};\n\n/* Each page cache is an instance of the following object.  Every\n** open database file (including each in-memory database and each\n** temporary or transient database) has a single page cache which\n** is an instance of this object.\n**\n** Pointers to structures of this type are cast and returned as \n** opaque sqlite3_pcache* handles.\n*/\nstruct PCache1 {\n  /* Cache configuration parameters. Page size (szPage) and the purgeable\n  ** flag (bPurgeable) are set when the cache is created. nMax may be \n  ** modified at any time by a call to the pcache1Cachesize() method.\n  ** The PGroup mutex must be held when accessing nMax.\n  */\n  PGroup *pGroup;                     /* PGroup this cache belongs to */\n  int szPage;                         /* Size of database content section */\n  int szExtra;                        /* sizeof(MemPage)+sizeof(PgHdr) */\n  int szAlloc;                        /* Total size of one pcache line */\n  int bPurgeable;                     /* True if cache is purgeable */\n  unsigned int nMin;                  /* Minimum number of pages reserved */\n  unsigned int nMax;                  /* Configured \"cache_size\" value */\n  unsigned int n90pct;                /* nMax*9/10 */\n  unsigned int iMaxKey;               /* Largest key seen since xTruncate() */\n\n  /* Hash table of all pages. The following variables may only be accessed\n  ** when the accessor is holding the PGroup mutex.\n  */\n  unsigned int nRecyclable;           /* Number of pages in the LRU list */\n  unsigned int nPage;                 /* Total number of pages in apHash */\n  unsigned int nHash;                 /* Number of slots in apHash[] */\n  PgHdr1 **apHash;                    /* Hash table for fast lookup by key */\n  PgHdr1 *pFree;                      /* List of unused pcache-local pages */\n  void *pBulk;                        /* Bulk memory used by pcache-local */\n};\n\n/*\n** Free slots in the allocator used to divide up the global page cache\n** buffer provided using the SQLITE_CONFIG_PAGECACHE mechanism.\n*/\nstruct PgFreeslot {\n  PgFreeslot *pNext;  /* Next free slot */\n};\n\n/*\n** Global data used by this cache.\n*/\nstatic SQLITE_WSD struct PCacheGlobal {\n  PGroup grp;                    /* The global PGroup for mode (2) */\n\n  /* Variables related to SQLITE_CONFIG_PAGECACHE settings.  The\n  ** szSlot, nSlot, pStart, pEnd, nReserve, and isInit values are all\n  ** fixed at sqlite3_initialize() time and do not require mutex protection.\n  ** The nFreeSlot and pFree values do require mutex protection.\n  */\n  int isInit;                    /* True if initialized */\n  int separateCache;             /* Use a new PGroup for each PCache */\n  int nInitPage;                 /* Initial bulk allocation size */   \n  int szSlot;                    /* Size of each free slot */\n  int nSlot;                     /* The number of pcache slots */\n  int nReserve;                  /* Try to keep nFreeSlot above this */\n  void *pStart, *pEnd;           /* Bounds of global page cache memory */\n  /* Above requires no mutex.  Use mutex below for variable that follow. */\n  sqlite3_mutex *mutex;          /* Mutex for accessing the following: */\n  PgFreeslot *pFree;             /* Free page blocks */\n  int nFreeSlot;                 /* Number of unused pcache slots */\n  /* The following value requires a mutex to change.  We skip the mutex on\n  ** reading because (1) most platforms read a 32-bit integer atomically and\n  ** (2) even if an incorrect value is read, no great harm is done since this\n  ** is really just an optimization. */\n  int bUnderPressure;            /* True if low on PAGECACHE memory */\n} pcache1_g;\n\n/*\n** All code in this file should access the global structure above via the\n** alias \"pcache1\". This ensures that the WSD emulation is used when\n** compiling for systems that do not support real WSD.\n*/\n#define pcache1 (GLOBAL(struct PCacheGlobal, pcache1_g))\n\n/*\n** Macros to enter and leave the PCache LRU mutex.\n*/\n#if !defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0\n# define pcache1EnterMutex(X)  assert((X)->mutex==0)\n# define pcache1LeaveMutex(X)  assert((X)->mutex==0)\n# define PCACHE1_MIGHT_USE_GROUP_MUTEX 0\n#else\n# define pcache1EnterMutex(X) sqlite3_mutex_enter((X)->mutex)\n# define pcache1LeaveMutex(X) sqlite3_mutex_leave((X)->mutex)\n# define PCACHE1_MIGHT_USE_GROUP_MUTEX 1\n#endif\n\n/******************************************************************************/\n/******** Page Allocation/SQLITE_CONFIG_PCACHE Related Functions **************/\n\n\n/*\n** This function is called during initialization if a static buffer is \n** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE\n** verb to sqlite3_config(). Parameter pBuf points to an allocation large\n** enough to contain 'n' buffers of 'sz' bytes each.\n**\n** This routine is called from sqlite3_initialize() and so it is guaranteed\n** to be serialized already.  There is no need for further mutexing.\n*/\nvoid sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){\n  if( pcache1.isInit ){\n    PgFreeslot *p;\n    if( pBuf==0 ) sz = n = 0;\n    sz = ROUNDDOWN8(sz);\n    pcache1.szSlot = sz;\n    pcache1.nSlot = pcache1.nFreeSlot = n;\n    pcache1.nReserve = n>90 ? 10 : (n/10 + 1);\n    pcache1.pStart = pBuf;\n    pcache1.pFree = 0;\n    pcache1.bUnderPressure = 0;\n    while( n-- ){\n      p = (PgFreeslot*)pBuf;\n      p->pNext = pcache1.pFree;\n      pcache1.pFree = p;\n      pBuf = (void*)&((char*)pBuf)[sz];\n    }\n    pcache1.pEnd = pBuf;\n  }\n}\n\n/*\n** Try to initialize the pCache->pFree and pCache->pBulk fields.  Return\n** true if pCache->pFree ends up containing one or more free pages.\n*/\nstatic int pcache1InitBulk(PCache1 *pCache){\n  i64 szBulk;\n  char *zBulk;\n  if( pcache1.nInitPage==0 ) return 0;\n  /* Do not bother with a bulk allocation if the cache size very small */\n  if( pCache->nMax<3 ) return 0;\n  sqlite3BeginBenignMalloc();\n  if( pcache1.nInitPage>0 ){\n    szBulk = pCache->szAlloc * (i64)pcache1.nInitPage;\n  }else{\n    szBulk = -1024 * (i64)pcache1.nInitPage;\n  }\n  if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){\n    szBulk = pCache->szAlloc*(i64)pCache->nMax;\n  }\n  zBulk = pCache->pBulk = sqlite3Malloc( szBulk );\n  sqlite3EndBenignMalloc();\n  if( zBulk ){\n    int nBulk = sqlite3MallocSize(zBulk)/pCache->szAlloc;\n    int i;\n    for(i=0; i<nBulk; i++){\n      PgHdr1 *pX = (PgHdr1*)&zBulk[pCache->szPage];\n      pX->page.pBuf = zBulk;\n      pX->page.pExtra = &pX[1];\n      pX->isBulkLocal = 1;\n      pX->isAnchor = 0;\n      pX->pNext = pCache->pFree;\n      pCache->pFree = pX;\n      zBulk += pCache->szAlloc;\n    }\n  }\n  return pCache->pFree!=0;\n}\n\n/*\n** Malloc function used within this file to allocate space from the buffer\n** configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no \n** such buffer exists or there is no space left in it, this function falls \n** back to sqlite3Malloc().\n**\n** Multiple threads can run this routine at the same time.  Global variables\n** in pcache1 need to be protected via mutex.\n*/\nstatic void *pcache1Alloc(int nByte){\n  void *p = 0;\n  assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );\n  if( nByte<=pcache1.szSlot ){\n    sqlite3_mutex_enter(pcache1.mutex);\n    p = (PgHdr1 *)pcache1.pFree;\n    if( p ){\n      pcache1.pFree = pcache1.pFree->pNext;\n      pcache1.nFreeSlot--;\n      pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;\n      assert( pcache1.nFreeSlot>=0 );\n      sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte);\n      sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_USED, 1);\n    }\n    sqlite3_mutex_leave(pcache1.mutex);\n  }\n  if( p==0 ){\n    /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool.  Get\n    ** it from sqlite3Malloc instead.\n    */\n    p = sqlite3Malloc(nByte);\n#ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS\n    if( p ){\n      int sz = sqlite3MallocSize(p);\n      sqlite3_mutex_enter(pcache1.mutex);\n      sqlite3StatusHighwater(SQLITE_STATUS_PAGECACHE_SIZE, nByte);\n      sqlite3StatusUp(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz);\n      sqlite3_mutex_leave(pcache1.mutex);\n    }\n#endif\n    sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);\n  }\n  return p;\n}\n\n/*\n** Free an allocated buffer obtained from pcache1Alloc().\n*/\nstatic void pcache1Free(void *p){\n  if( p==0 ) return;\n  if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){\n    PgFreeslot *pSlot;\n    sqlite3_mutex_enter(pcache1.mutex);\n    sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_USED, 1);\n    pSlot = (PgFreeslot*)p;\n    pSlot->pNext = pcache1.pFree;\n    pcache1.pFree = pSlot;\n    pcache1.nFreeSlot++;\n    pcache1.bUnderPressure = pcache1.nFreeSlot<pcache1.nReserve;\n    assert( pcache1.nFreeSlot<=pcache1.nSlot );\n    sqlite3_mutex_leave(pcache1.mutex);\n  }else{\n    assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );\n    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\n#ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS\n    {\n      int nFreed = 0;\n      nFreed = sqlite3MallocSize(p);\n      sqlite3_mutex_enter(pcache1.mutex);\n      sqlite3StatusDown(SQLITE_STATUS_PAGECACHE_OVERFLOW, nFreed);\n      sqlite3_mutex_leave(pcache1.mutex);\n    }\n#endif\n    sqlite3_free(p);\n  }\n}\n\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\n/*\n** Return the size of a pcache allocation\n*/\nstatic int pcache1MemSize(void *p){\n  if( p>=pcache1.pStart && p<pcache1.pEnd ){\n    return pcache1.szSlot;\n  }else{\n    int iSize;\n    assert( sqlite3MemdebugHasType(p, MEMTYPE_PCACHE) );\n    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);\n    iSize = sqlite3MallocSize(p);\n    sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);\n    return iSize;\n  }\n}\n#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */\n\n/*\n** Allocate a new page object initially associated with cache pCache.\n*/\nstatic PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){\n  PgHdr1 *p = 0;\n  void *pPg;\n\n  assert( sqlite3_mutex_held(pCache->pGroup->mutex) );\n  if( pCache->pFree || (pCache->nPage==0 && pcache1InitBulk(pCache)) ){\n    p = pCache->pFree;\n    pCache->pFree = p->pNext;\n    p->pNext = 0;\n  }else{\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\n    /* The group mutex must be released before pcache1Alloc() is called. This\n    ** is because it might call sqlite3_release_memory(), which assumes that \n    ** this mutex is not held. */\n    assert( pcache1.separateCache==0 );\n    assert( pCache->pGroup==&pcache1.grp );\n    pcache1LeaveMutex(pCache->pGroup);\n#endif\n    if( benignMalloc ){ sqlite3BeginBenignMalloc(); }\n#ifdef SQLITE_PCACHE_SEPARATE_HEADER\n    pPg = pcache1Alloc(pCache->szPage);\n    p = sqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra);\n    if( !pPg || !p ){\n      pcache1Free(pPg);\n      sqlite3_free(p);\n      pPg = 0;\n    }\n#else\n    pPg = pcache1Alloc(pCache->szAlloc);\n    p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage];\n#endif\n    if( benignMalloc ){ sqlite3EndBenignMalloc(); }\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\n    pcache1EnterMutex(pCache->pGroup);\n#endif\n    if( pPg==0 ) return 0;\n    p->page.pBuf = pPg;\n    p->page.pExtra = &p[1];\n    p->isBulkLocal = 0;\n    p->isAnchor = 0;\n  }\n  if( pCache->bPurgeable ){\n    pCache->pGroup->nCurrentPage++;\n  }\n  return p;\n}\n\n/*\n** Free a page object allocated by pcache1AllocPage().\n*/\nstatic void pcache1FreePage(PgHdr1 *p){\n  PCache1 *pCache;\n  assert( p!=0 );\n  pCache = p->pCache;\n  assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) );\n  if( p->isBulkLocal ){\n    p->pNext = pCache->pFree;\n    pCache->pFree = p;\n  }else{\n    pcache1Free(p->page.pBuf);\n#ifdef SQLITE_PCACHE_SEPARATE_HEADER\n    sqlite3_free(p);\n#endif\n  }\n  if( pCache->bPurgeable ){\n    pCache->pGroup->nCurrentPage--;\n  }\n}\n\n/*\n** Malloc function used by SQLite to obtain space from the buffer configured\n** using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer\n** exists, this function falls back to sqlite3Malloc().\n*/\nvoid *sqlite3PageMalloc(int sz){\n  return pcache1Alloc(sz);\n}\n\n/*\n** Free an allocated buffer obtained from sqlite3PageMalloc().\n*/\nvoid sqlite3PageFree(void *p){\n  pcache1Free(p);\n}\n\n\n/*\n** Return true if it desirable to avoid allocating a new page cache\n** entry.\n**\n** If memory was allocated specifically to the page cache using\n** SQLITE_CONFIG_PAGECACHE but that memory has all been used, then\n** it is desirable to avoid allocating a new page cache entry because\n** presumably SQLITE_CONFIG_PAGECACHE was suppose to be sufficient\n** for all page cache needs and we should not need to spill the\n** allocation onto the heap.\n**\n** Or, the heap is used for all page cache memory but the heap is\n** under memory pressure, then again it is desirable to avoid\n** allocating a new page cache entry in order to avoid stressing\n** the heap even further.\n*/\nstatic int pcache1UnderMemoryPressure(PCache1 *pCache){\n  if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){\n    return pcache1.bUnderPressure;\n  }else{\n    return sqlite3HeapNearlyFull();\n  }\n}\n\n/******************************************************************************/\n/******** General Implementation Functions ************************************/\n\n/*\n** This function is used to resize the hash table used by the cache passed\n** as the first argument.\n**\n** The PCache mutex must be held when this function is called.\n*/\nstatic void pcache1ResizeHash(PCache1 *p){\n  PgHdr1 **apNew;\n  unsigned int nNew;\n  unsigned int i;\n\n  assert( sqlite3_mutex_held(p->pGroup->mutex) );\n\n  nNew = p->nHash*2;\n  if( nNew<256 ){\n    nNew = 256;\n  }\n\n  pcache1LeaveMutex(p->pGroup);\n  if( p->nHash ){ sqlite3BeginBenignMalloc(); }\n  apNew = (PgHdr1 **)sqlite3MallocZero(sizeof(PgHdr1 *)*nNew);\n  if( p->nHash ){ sqlite3EndBenignMalloc(); }\n  pcache1EnterMutex(p->pGroup);\n  if( apNew ){\n    for(i=0; i<p->nHash; i++){\n      PgHdr1 *pPage;\n      PgHdr1 *pNext = p->apHash[i];\n      while( (pPage = pNext)!=0 ){\n        unsigned int h = pPage->iKey % nNew;\n        pNext = pPage->pNext;\n        pPage->pNext = apNew[h];\n        apNew[h] = pPage;\n      }\n    }\n    sqlite3_free(p->apHash);\n    p->apHash = apNew;\n    p->nHash = nNew;\n  }\n}\n\n/*\n** This function is used internally to remove the page pPage from the \n** PGroup LRU list, if is part of it. If pPage is not part of the PGroup\n** LRU list, then this function is a no-op.\n**\n** The PGroup mutex must be held when this function is called.\n*/\nstatic PgHdr1 *pcache1PinPage(PgHdr1 *pPage){\n  PCache1 *pCache;\n\n  assert( pPage!=0 );\n  assert( pPage->isPinned==0 );\n  pCache = pPage->pCache;\n  assert( pPage->pLruNext );\n  assert( pPage->pLruPrev );\n  assert( sqlite3_mutex_held(pCache->pGroup->mutex) );\n  pPage->pLruPrev->pLruNext = pPage->pLruNext;\n  pPage->pLruNext->pLruPrev = pPage->pLruPrev;\n  pPage->pLruNext = 0;\n  pPage->pLruPrev = 0;\n  pPage->isPinned = 1;\n  assert( pPage->isAnchor==0 );\n  assert( pCache->pGroup->lru.isAnchor==1 );\n  pCache->nRecyclable--;\n  return pPage;\n}\n\n\n/*\n** Remove the page supplied as an argument from the hash table \n** (PCache1.apHash structure) that it is currently stored in.\n** Also free the page if freePage is true.\n**\n** The PGroup mutex must be held when this function is called.\n*/\nstatic void pcache1RemoveFromHash(PgHdr1 *pPage, int freeFlag){\n  unsigned int h;\n  PCache1 *pCache = pPage->pCache;\n  PgHdr1 **pp;\n\n  assert( sqlite3_mutex_held(pCache->pGroup->mutex) );\n  h = pPage->iKey % pCache->nHash;\n  for(pp=&pCache->apHash[h]; (*pp)!=pPage; pp=&(*pp)->pNext);\n  *pp = (*pp)->pNext;\n\n  pCache->nPage--;\n  if( freeFlag ) pcache1FreePage(pPage);\n}\n\n/*\n** If there are currently more than nMaxPage pages allocated, try\n** to recycle pages to reduce the number allocated to nMaxPage.\n*/\nstatic void pcache1EnforceMaxPage(PCache1 *pCache){\n  PGroup *pGroup = pCache->pGroup;\n  PgHdr1 *p;\n  assert( sqlite3_mutex_held(pGroup->mutex) );\n  while( pGroup->nCurrentPage>pGroup->nMaxPage\n      && (p=pGroup->lru.pLruPrev)->isAnchor==0\n  ){\n    assert( p->pCache->pGroup==pGroup );\n    assert( p->isPinned==0 );\n    pcache1PinPage(p);\n    pcache1RemoveFromHash(p, 1);\n  }\n  if( pCache->nPage==0 && pCache->pBulk ){\n    sqlite3_free(pCache->pBulk);\n    pCache->pBulk = pCache->pFree = 0;\n  }\n}\n\n/*\n** Discard all pages from cache pCache with a page number (key value) \n** greater than or equal to iLimit. Any pinned pages that meet this \n** criteria are unpinned before they are discarded.\n**\n** The PCache mutex must be held when this function is called.\n*/\nstatic void pcache1TruncateUnsafe(\n  PCache1 *pCache,             /* The cache to truncate */\n  unsigned int iLimit          /* Drop pages with this pgno or larger */\n){\n  TESTONLY( int nPage = 0; )  /* To assert pCache->nPage is correct */\n  unsigned int h, iStop;\n  assert( sqlite3_mutex_held(pCache->pGroup->mutex) );\n  assert( pCache->iMaxKey >= iLimit );\n  assert( pCache->nHash > 0 );\n  if( pCache->iMaxKey - iLimit < pCache->nHash ){\n    /* If we are just shaving the last few pages off the end of the\n    ** cache, then there is no point in scanning the entire hash table.\n    ** Only scan those hash slots that might contain pages that need to\n    ** be removed. */\n    h = iLimit % pCache->nHash;\n    iStop = pCache->iMaxKey % pCache->nHash;\n    TESTONLY( nPage = -10; )  /* Disable the pCache->nPage validity check */\n  }else{\n    /* This is the general case where many pages are being removed.\n    ** It is necessary to scan the entire hash table */\n    h = pCache->nHash/2;\n    iStop = h - 1;\n  }\n  for(;;){\n    PgHdr1 **pp;\n    PgHdr1 *pPage;\n    assert( h<pCache->nHash );\n    pp = &pCache->apHash[h]; \n    while( (pPage = *pp)!=0 ){\n      if( pPage->iKey>=iLimit ){\n        pCache->nPage--;\n        *pp = pPage->pNext;\n        if( !pPage->isPinned ) pcache1PinPage(pPage);\n        pcache1FreePage(pPage);\n      }else{\n        pp = &pPage->pNext;\n        TESTONLY( if( nPage>=0 ) nPage++; )\n      }\n    }\n    if( h==iStop ) break;\n    h = (h+1) % pCache->nHash;\n  }\n  assert( nPage<0 || pCache->nPage==(unsigned)nPage );\n}\n\n/******************************************************************************/\n/******** sqlite3_pcache Methods **********************************************/\n\n/*\n** Implementation of the sqlite3_pcache.xInit method.\n*/\nstatic int pcache1Init(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  assert( pcache1.isInit==0 );\n  memset(&pcache1, 0, sizeof(pcache1));\n\n\n  /*\n  ** The pcache1.separateCache variable is true if each PCache has its own\n  ** private PGroup (mode-1).  pcache1.separateCache is false if the single\n  ** PGroup in pcache1.grp is used for all page caches (mode-2).\n  **\n  **   *  Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT\n  **\n  **   *  Use a unified cache in single-threaded applications that have\n  **      configured a start-time buffer for use as page-cache memory using\n  **      sqlite3_config(SQLITE_CONFIG_PAGECACHE, pBuf, sz, N) with non-NULL \n  **      pBuf argument.\n  **\n  **   *  Otherwise use separate caches (mode-1)\n  */\n#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT)\n  pcache1.separateCache = 0;\n#elif SQLITE_THREADSAFE\n  pcache1.separateCache = sqlite3GlobalConfig.pPage==0\n                          || sqlite3GlobalConfig.bCoreMutex>0;\n#else\n  pcache1.separateCache = sqlite3GlobalConfig.pPage==0;\n#endif\n\n#if SQLITE_THREADSAFE\n  if( sqlite3GlobalConfig.bCoreMutex ){\n    pcache1.grp.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU);\n    pcache1.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PMEM);\n  }\n#endif\n  if( pcache1.separateCache\n   && sqlite3GlobalConfig.nPage!=0\n   && sqlite3GlobalConfig.pPage==0\n  ){\n    pcache1.nInitPage = sqlite3GlobalConfig.nPage;\n  }else{\n    pcache1.nInitPage = 0;\n  }\n  pcache1.grp.mxPinned = 10;\n  pcache1.isInit = 1;\n  return SQLITE_OK;\n}\n\n/*\n** Implementation of the sqlite3_pcache.xShutdown method.\n** Note that the static mutex allocated in xInit does \n** not need to be freed.\n*/\nstatic void pcache1Shutdown(void *NotUsed){\n  UNUSED_PARAMETER(NotUsed);\n  assert( pcache1.isInit!=0 );\n  memset(&pcache1, 0, sizeof(pcache1));\n}\n\n/* forward declaration */\nstatic void pcache1Destroy(sqlite3_pcache *p);\n\n/*\n** Implementation of the sqlite3_pcache.xCreate method.\n**\n** Allocate a new cache.\n*/\nstatic sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){\n  PCache1 *pCache;      /* The newly created page cache */\n  PGroup *pGroup;       /* The group the new page cache will belong to */\n  int sz;               /* Bytes of memory required to allocate the new cache */\n\n  assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 );\n  assert( szExtra < 300 );\n\n  sz = sizeof(PCache1) + sizeof(PGroup)*pcache1.separateCache;\n  pCache = (PCache1 *)sqlite3MallocZero(sz);\n  if( pCache ){\n    if( pcache1.separateCache ){\n      pGroup = (PGroup*)&pCache[1];\n      pGroup->mxPinned = 10;\n    }else{\n      pGroup = &pcache1.grp;\n    }\n    if( pGroup->lru.isAnchor==0 ){\n      pGroup->lru.isAnchor = 1;\n      pGroup->lru.pLruPrev = pGroup->lru.pLruNext = &pGroup->lru;\n    }\n    pCache->pGroup = pGroup;\n    pCache->szPage = szPage;\n    pCache->szExtra = szExtra;\n    pCache->szAlloc = szPage + szExtra + ROUND8(sizeof(PgHdr1));\n    pCache->bPurgeable = (bPurgeable ? 1 : 0);\n    pcache1EnterMutex(pGroup);\n    pcache1ResizeHash(pCache);\n    if( bPurgeable ){\n      pCache->nMin = 10;\n      pGroup->nMinPage += pCache->nMin;\n      pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;\n    }\n    pcache1LeaveMutex(pGroup);\n    if( pCache->nHash==0 ){\n      pcache1Destroy((sqlite3_pcache*)pCache);\n      pCache = 0;\n    }\n  }\n  return (sqlite3_pcache *)pCache;\n}\n\n/*\n** Implementation of the sqlite3_pcache.xCachesize method. \n**\n** Configure the cache_size limit for a cache.\n*/\nstatic void pcache1Cachesize(sqlite3_pcache *p, int nMax){\n  PCache1 *pCache = (PCache1 *)p;\n  if( pCache->bPurgeable ){\n    PGroup *pGroup = pCache->pGroup;\n    pcache1EnterMutex(pGroup);\n    pGroup->nMaxPage += (nMax - pCache->nMax);\n    pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;\n    pCache->nMax = nMax;\n    pCache->n90pct = pCache->nMax*9/10;\n    pcache1EnforceMaxPage(pCache);\n    pcache1LeaveMutex(pGroup);\n  }\n}\n\n/*\n** Implementation of the sqlite3_pcache.xShrink method. \n**\n** Free up as much memory as possible.\n*/\nstatic void pcache1Shrink(sqlite3_pcache *p){\n  PCache1 *pCache = (PCache1*)p;\n  if( pCache->bPurgeable ){\n    PGroup *pGroup = pCache->pGroup;\n    int savedMaxPage;\n    pcache1EnterMutex(pGroup);\n    savedMaxPage = pGroup->nMaxPage;\n    pGroup->nMaxPage = 0;\n    pcache1EnforceMaxPage(pCache);\n    pGroup->nMaxPage = savedMaxPage;\n    pcache1LeaveMutex(pGroup);\n  }\n}\n\n/*\n** Implementation of the sqlite3_pcache.xPagecount method. \n*/\nstatic int pcache1Pagecount(sqlite3_pcache *p){\n  int n;\n  PCache1 *pCache = (PCache1*)p;\n  pcache1EnterMutex(pCache->pGroup);\n  n = pCache->nPage;\n  pcache1LeaveMutex(pCache->pGroup);\n  return n;\n}\n\n\n/*\n** Implement steps 3, 4, and 5 of the pcache1Fetch() algorithm described\n** in the header of the pcache1Fetch() procedure.\n**\n** This steps are broken out into a separate procedure because they are\n** usually not needed, and by avoiding the stack initialization required\n** for these steps, the main pcache1Fetch() procedure can run faster.\n*/\nstatic SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2(\n  PCache1 *pCache, \n  unsigned int iKey, \n  int createFlag\n){\n  unsigned int nPinned;\n  PGroup *pGroup = pCache->pGroup;\n  PgHdr1 *pPage = 0;\n\n  /* Step 3: Abort if createFlag is 1 but the cache is nearly full */\n  assert( pCache->nPage >= pCache->nRecyclable );\n  nPinned = pCache->nPage - pCache->nRecyclable;\n  assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage );\n  assert( pCache->n90pct == pCache->nMax*9/10 );\n  if( createFlag==1 && (\n        nPinned>=pGroup->mxPinned\n     || nPinned>=pCache->n90pct\n     || (pcache1UnderMemoryPressure(pCache) && pCache->nRecyclable<nPinned)\n  )){\n    return 0;\n  }\n\n  if( pCache->nPage>=pCache->nHash ) pcache1ResizeHash(pCache);\n  assert( pCache->nHash>0 && pCache->apHash );\n\n  /* Step 4. Try to recycle a page. */\n  if( pCache->bPurgeable\n   && !pGroup->lru.pLruPrev->isAnchor\n   && ((pCache->nPage+1>=pCache->nMax) || pcache1UnderMemoryPressure(pCache))\n  ){\n    PCache1 *pOther;\n    pPage = pGroup->lru.pLruPrev;\n    assert( pPage->isPinned==0 );\n    pcache1RemoveFromHash(pPage, 0);\n    pcache1PinPage(pPage);\n    pOther = pPage->pCache;\n    if( pOther->szAlloc != pCache->szAlloc ){\n      pcache1FreePage(pPage);\n      pPage = 0;\n    }else{\n      pGroup->nCurrentPage -= (pOther->bPurgeable - pCache->bPurgeable);\n    }\n  }\n\n  /* Step 5. If a usable page buffer has still not been found, \n  ** attempt to allocate a new one. \n  */\n  if( !pPage ){\n    pPage = pcache1AllocPage(pCache, createFlag==1);\n  }\n\n  if( pPage ){\n    unsigned int h = iKey % pCache->nHash;\n    pCache->nPage++;\n    pPage->iKey = iKey;\n    pPage->pNext = pCache->apHash[h];\n    pPage->pCache = pCache;\n    pPage->pLruPrev = 0;\n    pPage->pLruNext = 0;\n    pPage->isPinned = 1;\n    *(void **)pPage->page.pExtra = 0;\n    pCache->apHash[h] = pPage;\n    if( iKey>pCache->iMaxKey ){\n      pCache->iMaxKey = iKey;\n    }\n  }\n  return pPage;\n}\n\n/*\n** Implementation of the sqlite3_pcache.xFetch method. \n**\n** Fetch a page by key value.\n**\n** Whether or not a new page may be allocated by this function depends on\n** the value of the createFlag argument.  0 means do not allocate a new\n** page.  1 means allocate a new page if space is easily available.  2 \n** means to try really hard to allocate a new page.\n**\n** For a non-purgeable cache (a cache used as the storage for an in-memory\n** database) there is really no difference between createFlag 1 and 2.  So\n** the calling function (pcache.c) will never have a createFlag of 1 on\n** a non-purgeable cache.\n**\n** There are three different approaches to obtaining space for a page,\n** depending on the value of parameter createFlag (which may be 0, 1 or 2).\n**\n**   1. Regardless of the value of createFlag, the cache is searched for a \n**      copy of the requested page. If one is found, it is returned.\n**\n**   2. If createFlag==0 and the page is not already in the cache, NULL is\n**      returned.\n**\n**   3. If createFlag is 1, and the page is not already in the cache, then\n**      return NULL (do not allocate a new page) if any of the following\n**      conditions are true:\n**\n**       (a) the number of pages pinned by the cache is greater than\n**           PCache1.nMax, or\n**\n**       (b) the number of pages pinned by the cache is greater than\n**           the sum of nMax for all purgeable caches, less the sum of \n**           nMin for all other purgeable caches, or\n**\n**   4. If none of the first three conditions apply and the cache is marked\n**      as purgeable, and if one of the following is true:\n**\n**       (a) The number of pages allocated for the cache is already \n**           PCache1.nMax, or\n**\n**       (b) The number of pages allocated for all purgeable caches is\n**           already equal to or greater than the sum of nMax for all\n**           purgeable caches,\n**\n**       (c) The system is under memory pressure and wants to avoid\n**           unnecessary pages cache entry allocations\n**\n**      then attempt to recycle a page from the LRU list. If it is the right\n**      size, return the recycled buffer. Otherwise, free the buffer and\n**      proceed to step 5. \n**\n**   5. Otherwise, allocate and return a new page buffer.\n**\n** There are two versions of this routine.  pcache1FetchWithMutex() is\n** the general case.  pcache1FetchNoMutex() is a faster implementation for\n** the common case where pGroup->mutex is NULL.  The pcache1Fetch() wrapper\n** invokes the appropriate routine.\n*/\nstatic PgHdr1 *pcache1FetchNoMutex(\n  sqlite3_pcache *p, \n  unsigned int iKey, \n  int createFlag\n){\n  PCache1 *pCache = (PCache1 *)p;\n  PgHdr1 *pPage = 0;\n\n  /* Step 1: Search the hash table for an existing entry. */\n  pPage = pCache->apHash[iKey % pCache->nHash];\n  while( pPage && pPage->iKey!=iKey ){ pPage = pPage->pNext; }\n\n  /* Step 2: If the page was found in the hash table, then return it.\n  ** If the page was not in the hash table and createFlag is 0, abort.\n  ** Otherwise (page not in hash and createFlag!=0) continue with\n  ** subsequent steps to try to create the page. */\n  if( pPage ){\n    if( !pPage->isPinned ){\n      return pcache1PinPage(pPage);\n    }else{\n      return pPage;\n    }\n  }else if( createFlag ){\n    /* Steps 3, 4, and 5 implemented by this subroutine */\n    return pcache1FetchStage2(pCache, iKey, createFlag);\n  }else{\n    return 0;\n  }\n}\n#if PCACHE1_MIGHT_USE_GROUP_MUTEX\nstatic PgHdr1 *pcache1FetchWithMutex(\n  sqlite3_pcache *p, \n  unsigned int iKey, \n  int createFlag\n){\n  PCache1 *pCache = (PCache1 *)p;\n  PgHdr1 *pPage;\n\n  pcache1EnterMutex(pCache->pGroup);\n  pPage = pcache1FetchNoMutex(p, iKey, createFlag);\n  assert( pPage==0 || pCache->iMaxKey>=iKey );\n  pcache1LeaveMutex(pCache->pGroup);\n  return pPage;\n}\n#endif\nstatic sqlite3_pcache_page *pcache1Fetch(\n  sqlite3_pcache *p, \n  unsigned int iKey, \n  int createFlag\n){\n#if PCACHE1_MIGHT_USE_GROUP_MUTEX || defined(SQLITE_DEBUG)\n  PCache1 *pCache = (PCache1 *)p;\n#endif\n\n  assert( offsetof(PgHdr1,page)==0 );\n  assert( pCache->bPurgeable || createFlag!=1 );\n  assert( pCache->bPurgeable || pCache->nMin==0 );\n  assert( pCache->bPurgeable==0 || pCache->nMin==10 );\n  assert( pCache->nMin==0 || pCache->bPurgeable );\n  assert( pCache->nHash>0 );\n#if PCACHE1_MIGHT_USE_GROUP_MUTEX\n  if( pCache->pGroup->mutex ){\n    return (sqlite3_pcache_page*)pcache1FetchWithMutex(p, iKey, createFlag);\n  }else\n#endif\n  {\n    return (sqlite3_pcache_page*)pcache1FetchNoMutex(p, iKey, createFlag);\n  }\n}\n\n\n/*\n** Implementation of the sqlite3_pcache.xUnpin method.\n**\n** Mark a page as unpinned (eligible for asynchronous recycling).\n*/\nstatic void pcache1Unpin(\n  sqlite3_pcache *p, \n  sqlite3_pcache_page *pPg, \n  int reuseUnlikely\n){\n  PCache1 *pCache = (PCache1 *)p;\n  PgHdr1 *pPage = (PgHdr1 *)pPg;\n  PGroup *pGroup = pCache->pGroup;\n \n  assert( pPage->pCache==pCache );\n  pcache1EnterMutex(pGroup);\n\n  /* It is an error to call this function if the page is already \n  ** part of the PGroup LRU list.\n  */\n  assert( pPage->pLruPrev==0 && pPage->pLruNext==0 );\n  assert( pPage->isPinned==1 );\n\n  if( reuseUnlikely || pGroup->nCurrentPage>pGroup->nMaxPage ){\n    pcache1RemoveFromHash(pPage, 1);\n  }else{\n    /* Add the page to the PGroup LRU list. */\n    PgHdr1 **ppFirst = &pGroup->lru.pLruNext;\n    pPage->pLruPrev = &pGroup->lru;\n    (pPage->pLruNext = *ppFirst)->pLruPrev = pPage;\n    *ppFirst = pPage;\n    pCache->nRecyclable++;\n    pPage->isPinned = 0;\n  }\n\n  pcache1LeaveMutex(pCache->pGroup);\n}\n\n/*\n** Implementation of the sqlite3_pcache.xRekey method. \n*/\nstatic void pcache1Rekey(\n  sqlite3_pcache *p,\n  sqlite3_pcache_page *pPg,\n  unsigned int iOld,\n  unsigned int iNew\n){\n  PCache1 *pCache = (PCache1 *)p;\n  PgHdr1 *pPage = (PgHdr1 *)pPg;\n  PgHdr1 **pp;\n  unsigned int h; \n  assert( pPage->iKey==iOld );\n  assert( pPage->pCache==pCache );\n\n  pcache1EnterMutex(pCache->pGroup);\n\n  h = iOld%pCache->nHash;\n  pp = &pCache->apHash[h];\n  while( (*pp)!=pPage ){\n    pp = &(*pp)->pNext;\n  }\n  *pp = pPage->pNext;\n\n  h = iNew%pCache->nHash;\n  pPage->iKey = iNew;\n  pPage->pNext = pCache->apHash[h];\n  pCache->apHash[h] = pPage;\n  if( iNew>pCache->iMaxKey ){\n    pCache->iMaxKey = iNew;\n  }\n\n  pcache1LeaveMutex(pCache->pGroup);\n}\n\n/*\n** Implementation of the sqlite3_pcache.xTruncate method. \n**\n** Discard all unpinned pages in the cache with a page number equal to\n** or greater than parameter iLimit. Any pinned pages with a page number\n** equal to or greater than iLimit are implicitly unpinned.\n*/\nstatic void pcache1Truncate(sqlite3_pcache *p, unsigned int iLimit){\n  PCache1 *pCache = (PCache1 *)p;\n  pcache1EnterMutex(pCache->pGroup);\n  if( iLimit<=pCache->iMaxKey ){\n    pcache1TruncateUnsafe(pCache, iLimit);\n    pCache->iMaxKey = iLimit-1;\n  }\n  pcache1LeaveMutex(pCache->pGroup);\n}\n\n/*\n** Implementation of the sqlite3_pcache.xDestroy method. \n**\n** Destroy a cache allocated using pcache1Create().\n*/\nstatic void pcache1Destroy(sqlite3_pcache *p){\n  PCache1 *pCache = (PCache1 *)p;\n  PGroup *pGroup = pCache->pGroup;\n  assert( pCache->bPurgeable || (pCache->nMax==0 && pCache->nMin==0) );\n  pcache1EnterMutex(pGroup);\n  if( pCache->nPage ) pcache1TruncateUnsafe(pCache, 0);\n  assert( pGroup->nMaxPage >= pCache->nMax );\n  pGroup->nMaxPage -= pCache->nMax;\n  assert( pGroup->nMinPage >= pCache->nMin );\n  pGroup->nMinPage -= pCache->nMin;\n  pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;\n  pcache1EnforceMaxPage(pCache);\n  pcache1LeaveMutex(pGroup);\n  sqlite3_free(pCache->pBulk);\n  sqlite3_free(pCache->apHash);\n  sqlite3_free(pCache);\n}\n\n/*\n** This function is called during initialization (sqlite3_initialize()) to\n** install the default pluggable cache module, assuming the user has not\n** already provided an alternative.\n*/\nvoid sqlite3PCacheSetDefault(void){\n  static const sqlite3_pcache_methods2 defaultMethods = {\n    1,                       /* iVersion */\n    0,                       /* pArg */\n    pcache1Init,             /* xInit */\n    pcache1Shutdown,         /* xShutdown */\n    pcache1Create,           /* xCreate */\n    pcache1Cachesize,        /* xCachesize */\n    pcache1Pagecount,        /* xPagecount */\n    pcache1Fetch,            /* xFetch */\n    pcache1Unpin,            /* xUnpin */\n    pcache1Rekey,            /* xRekey */\n    pcache1Truncate,         /* xTruncate */\n    pcache1Destroy,          /* xDestroy */\n    pcache1Shrink            /* xShrink */\n  };\n  sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods);\n}\n\n/*\n** Return the size of the header on each page of this PCACHE implementation.\n*/\nint sqlite3HeaderSizePcache1(void){ return ROUND8(sizeof(PgHdr1)); }\n\n/*\n** Return the global mutex used by this PCACHE implementation.  The\n** sqlite3_status() routine needs access to this mutex.\n*/\nsqlite3_mutex *sqlite3Pcache1Mutex(void){\n  return pcache1.mutex;\n}\n\n#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT\n/*\n** This function is called to free superfluous dynamically allocated memory\n** held by the pager system. Memory in use by any SQLite pager allocated\n** by the current thread may be sqlite3_free()ed.\n**\n** nReq is the number of bytes of memory required. Once this much has\n** been released, the function returns. The return value is the total number \n** of bytes of memory released.\n*/\nint sqlite3PcacheReleaseMemory(int nReq){\n  int nFree = 0;\n  assert( sqlite3_mutex_notheld(pcache1.grp.mutex) );\n  assert( sqlite3_mutex_notheld(pcache1.mutex) );\n  if( sqlite3GlobalConfig.nPage==0 ){\n    PgHdr1 *p;\n    pcache1EnterMutex(&pcache1.grp);\n    while( (nReq<0 || nFree<nReq)\n       &&  (p=pcache1.grp.lru.pLruPrev)!=0\n       &&  p->isAnchor==0\n    ){\n      nFree += pcache1MemSize(p->page.pBuf);\n#ifdef SQLITE_PCACHE_SEPARATE_HEADER\n      nFree += sqlite3MemSize(p);\n#endif\n      assert( p->isPinned==0 );\n      pcache1PinPage(p);\n      pcache1RemoveFromHash(p, 1);\n    }\n    pcache1LeaveMutex(&pcache1.grp);\n  }\n  return nFree;\n}\n#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */\n\n#ifdef SQLITE_TEST\n/*\n** This function is used by test procedures to inspect the internal state\n** of the global cache.\n*/\nvoid sqlite3PcacheStats(\n  int *pnCurrent,      /* OUT: Total number of pages cached */\n  int *pnMax,          /* OUT: Global maximum cache size */\n  int *pnMin,          /* OUT: Sum of PCache1.nMin for purgeable caches */\n  int *pnRecyclable    /* OUT: Total number of pages available for recycling */\n){\n  PgHdr1 *p;\n  int nRecyclable = 0;\n  for(p=pcache1.grp.lru.pLruNext; p && !p->isAnchor; p=p->pLruNext){\n    assert( p->isPinned==0 );\n    nRecyclable++;\n  }\n  *pnCurrent = pcache1.grp.nCurrentPage;\n  *pnMax = (int)pcache1.grp.nMaxPage;\n  *pnMin = (int)pcache1.grp.nMinPage;\n  *pnRecyclable = nRecyclable;\n}\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/pragma.c",
    "content": "/*\n** 2003 April 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used to implement the PRAGMA command.\n*/\n#include \"sqliteInt.h\"\n\n#if !defined(SQLITE_ENABLE_LOCKING_STYLE)\n#  if defined(__APPLE__)\n#    define SQLITE_ENABLE_LOCKING_STYLE 1\n#  else\n#    define SQLITE_ENABLE_LOCKING_STYLE 0\n#  endif\n#endif\n\n/***************************************************************************\n** The \"pragma.h\" include file is an automatically generated file that\n** that includes the PragType_XXXX macro definitions and the aPragmaName[]\n** object.  This ensures that the aPragmaName[] table is arranged in\n** lexicographical order to facility a binary search of the pragma name.\n** Do not edit pragma.h directly.  Edit and rerun the script in at \n** ../tool/mkpragmatab.tcl. */\n#include \"pragma.h\"\n\n/*\n** Interpret the given string as a safety level.  Return 0 for OFF,\n** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA.  Return 1 for an empty or \n** unrecognized string argument.  The FULL and EXTRA option is disallowed\n** if the omitFull parameter it 1.\n**\n** Note that the values returned are one less that the values that\n** should be passed into sqlite3BtreeSetSafetyLevel().  The is done\n** to support legacy SQL code.  The safety level used to be boolean\n** and older scripts may have used numbers 0 for OFF and 1 for ON.\n*/\nstatic u8 getSafetyLevel(const char *z, int omitFull, u8 dflt){\n                             /* 123456789 123456789 123 */\n  static const char zText[] = \"onoffalseyestruextrafull\";\n  static const u8 iOffset[] = {0, 1, 2,  4,    9,  12,  15,   20};\n  static const u8 iLength[] = {2, 2, 3,  5,    3,   4,   5,    4};\n  static const u8 iValue[] =  {1, 0, 0,  0,    1,   1,   3,    2};\n                            /* on no off false yes true extra full */\n  int i, n;\n  if( sqlite3Isdigit(*z) ){\n    return (u8)sqlite3Atoi(z);\n  }\n  n = sqlite3Strlen30(z);\n  for(i=0; i<ArraySize(iLength); i++){\n    if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0\n     && (!omitFull || iValue[i]<=1)\n    ){\n      return iValue[i];\n    }\n  }\n  return dflt;\n}\n\n/*\n** Interpret the given string as a boolean value.\n*/\nu8 sqlite3GetBoolean(const char *z, u8 dflt){\n  return getSafetyLevel(z,1,dflt)!=0;\n}\n\n/* The sqlite3GetBoolean() function is used by other modules but the\n** remainder of this file is specific to PRAGMA processing.  So omit\n** the rest of the file if PRAGMAs are omitted from the build.\n*/\n#if !defined(SQLITE_OMIT_PRAGMA)\n\n/*\n** Interpret the given string as a locking mode value.\n*/\nstatic int getLockingMode(const char *z){\n  if( z ){\n    if( 0==sqlite3StrICmp(z, \"exclusive\") ) return PAGER_LOCKINGMODE_EXCLUSIVE;\n    if( 0==sqlite3StrICmp(z, \"normal\") ) return PAGER_LOCKINGMODE_NORMAL;\n  }\n  return PAGER_LOCKINGMODE_QUERY;\n}\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n/*\n** Interpret the given string as an auto-vacuum mode value.\n**\n** The following strings, \"none\", \"full\" and \"incremental\" are \n** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively.\n*/\nstatic int getAutoVacuum(const char *z){\n  int i;\n  if( 0==sqlite3StrICmp(z, \"none\") ) return BTREE_AUTOVACUUM_NONE;\n  if( 0==sqlite3StrICmp(z, \"full\") ) return BTREE_AUTOVACUUM_FULL;\n  if( 0==sqlite3StrICmp(z, \"incremental\") ) return BTREE_AUTOVACUUM_INCR;\n  i = sqlite3Atoi(z);\n  return (u8)((i>=0&&i<=2)?i:0);\n}\n#endif /* ifndef SQLITE_OMIT_AUTOVACUUM */\n\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\n/*\n** Interpret the given string as a temp db location. Return 1 for file\n** backed temporary databases, 2 for the Red-Black tree in memory database\n** and 0 to use the compile-time default.\n*/\nstatic int getTempStore(const char *z){\n  if( z[0]>='0' && z[0]<='2' ){\n    return z[0] - '0';\n  }else if( sqlite3StrICmp(z, \"file\")==0 ){\n    return 1;\n  }else if( sqlite3StrICmp(z, \"memory\")==0 ){\n    return 2;\n  }else{\n    return 0;\n  }\n}\n#endif /* SQLITE_PAGER_PRAGMAS */\n\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\n/*\n** Invalidate temp storage, either when the temp storage is changed\n** from default, or when 'file' and the temp_store_directory has changed\n*/\nstatic int invalidateTempStorage(Parse *pParse){\n  sqlite3 *db = pParse->db;\n  if( db->aDb[1].pBt!=0 ){\n    if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){\n      sqlite3ErrorMsg(pParse, \"temporary storage cannot be changed \"\n        \"from within a transaction\");\n      return SQLITE_ERROR;\n    }\n    sqlite3BtreeClose(db->aDb[1].pBt);\n    db->aDb[1].pBt = 0;\n    sqlite3ResetAllSchemasOfConnection(db);\n  }\n  return SQLITE_OK;\n}\n#endif /* SQLITE_PAGER_PRAGMAS */\n\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\n/*\n** If the TEMP database is open, close it and mark the database schema\n** as needing reloading.  This must be done when using the SQLITE_TEMP_STORE\n** or DEFAULT_TEMP_STORE pragmas.\n*/\nstatic int changeTempStorage(Parse *pParse, const char *zStorageType){\n  int ts = getTempStore(zStorageType);\n  sqlite3 *db = pParse->db;\n  if( db->temp_store==ts ) return SQLITE_OK;\n  if( invalidateTempStorage( pParse ) != SQLITE_OK ){\n    return SQLITE_ERROR;\n  }\n  db->temp_store = (u8)ts;\n  return SQLITE_OK;\n}\n#endif /* SQLITE_PAGER_PRAGMAS */\n\n/*\n** Set the names of the first N columns to the values in azCol[]\n*/\nstatic void setAllColumnNames(\n  Vdbe *v,               /* The query under construction */\n  int N,                 /* Number of columns */\n  const char **azCol     /* Names of columns */\n){\n  int i;\n  sqlite3VdbeSetNumCols(v, N);\n  for(i=0; i<N; i++){\n    sqlite3VdbeSetColName(v, i, COLNAME_NAME, azCol[i], SQLITE_STATIC);\n  }\n}\nstatic void setOneColumnName(Vdbe *v, const char *z){\n  setAllColumnNames(v, 1, &z);\n}\n\n/*\n** Generate code to return a single integer value.\n*/\nstatic void returnSingleInt(Vdbe *v, const char *zLabel, i64 value){\n  sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, 1, 0, (const u8*)&value, P4_INT64);\n  setOneColumnName(v, zLabel);\n  sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\n}\n\n/*\n** Generate code to return a single text value.\n*/\nstatic void returnSingleText(\n  Vdbe *v,                /* Prepared statement under construction */\n  const char *zLabel,     /* Name of the result column */\n  const char *zValue      /* Value to be returned */\n){\n  if( zValue ){\n    sqlite3VdbeLoadString(v, 1, (const char*)zValue);\n    setOneColumnName(v, zLabel);\n    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\n  }\n}\n\n\n/*\n** Set the safety_level and pager flags for pager iDb.  Or if iDb<0\n** set these values for all pagers.\n*/\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\nstatic void setAllPagerFlags(sqlite3 *db){\n  if( db->autoCommit ){\n    Db *pDb = db->aDb;\n    int n = db->nDb;\n    assert( SQLITE_FullFSync==PAGER_FULLFSYNC );\n    assert( SQLITE_CkptFullFSync==PAGER_CKPT_FULLFSYNC );\n    assert( SQLITE_CacheSpill==PAGER_CACHESPILL );\n    assert( (PAGER_FULLFSYNC | PAGER_CKPT_FULLFSYNC | PAGER_CACHESPILL)\n             ==  PAGER_FLAGS_MASK );\n    assert( (pDb->safety_level & PAGER_SYNCHRONOUS_MASK)==pDb->safety_level );\n    while( (n--) > 0 ){\n      if( pDb->pBt ){\n        sqlite3BtreeSetPagerFlags(pDb->pBt,\n                 pDb->safety_level | (db->flags & PAGER_FLAGS_MASK) );\n      }\n      pDb++;\n    }\n  }\n}\n#else\n# define setAllPagerFlags(X)  /* no-op */\n#endif\n\n\n/*\n** Return a human-readable name for a constraint resolution action.\n*/\n#ifndef SQLITE_OMIT_FOREIGN_KEY\nstatic const char *actionName(u8 action){\n  const char *zName;\n  switch( action ){\n    case OE_SetNull:  zName = \"SET NULL\";        break;\n    case OE_SetDflt:  zName = \"SET DEFAULT\";     break;\n    case OE_Cascade:  zName = \"CASCADE\";         break;\n    case OE_Restrict: zName = \"RESTRICT\";        break;\n    default:          zName = \"NO ACTION\";  \n                      assert( action==OE_None ); break;\n  }\n  return zName;\n}\n#endif\n\n\n/*\n** Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants\n** defined in pager.h. This function returns the associated lowercase\n** journal-mode name.\n*/\nconst char *sqlite3JournalModename(int eMode){\n  static char * const azModeName[] = {\n    \"delete\", \"persist\", \"off\", \"truncate\", \"memory\"\n#ifndef SQLITE_OMIT_WAL\n     , \"wal\"\n#endif\n  };\n  assert( PAGER_JOURNALMODE_DELETE==0 );\n  assert( PAGER_JOURNALMODE_PERSIST==1 );\n  assert( PAGER_JOURNALMODE_OFF==2 );\n  assert( PAGER_JOURNALMODE_TRUNCATE==3 );\n  assert( PAGER_JOURNALMODE_MEMORY==4 );\n  assert( PAGER_JOURNALMODE_WAL==5 );\n  assert( eMode>=0 && eMode<=ArraySize(azModeName) );\n\n  if( eMode==ArraySize(azModeName) ) return 0;\n  return azModeName[eMode];\n}\n\n/*\n** Process a pragma statement.  \n**\n** Pragmas are of this form:\n**\n**      PRAGMA [schema.]id [= value]\n**\n** The identifier might also be a string.  The value is a string, and\n** identifier, or a number.  If minusFlag is true, then the value is\n** a number that was preceded by a minus sign.\n**\n** If the left side is \"database.id\" then pId1 is the database name\n** and pId2 is the id.  If the left side is just \"id\" then pId1 is the\n** id and pId2 is any empty string.\n*/\nvoid sqlite3Pragma(\n  Parse *pParse, \n  Token *pId1,        /* First part of [schema.]id field */\n  Token *pId2,        /* Second part of [schema.]id field, or NULL */\n  Token *pValue,      /* Token for <value>, or NULL */\n  int minusFlag       /* True if a '-' sign preceded <value> */\n){\n  char *zLeft = 0;       /* Nul-terminated UTF-8 string <id> */\n  char *zRight = 0;      /* Nul-terminated UTF-8 string <value>, or NULL */\n  const char *zDb = 0;   /* The database name */\n  Token *pId;            /* Pointer to <id> token */\n  char *aFcntl[4];       /* Argument to SQLITE_FCNTL_PRAGMA */\n  int iDb;               /* Database index for <database> */\n  int lwr, upr, mid = 0;       /* Binary search bounds */\n  int rc;                      /* return value form SQLITE_FCNTL_PRAGMA */\n  sqlite3 *db = pParse->db;    /* The database connection */\n  Db *pDb;                     /* The specific database being pragmaed */\n  Vdbe *v = sqlite3GetVdbe(pParse);  /* Prepared statement */\n  const struct sPragmaNames *pPragma;\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n  extern int sqlcipher_codec_pragma(sqlite3*, int, Parse *, const char *, const char *);\n#endif\n/* END SQLCIPHER */\n\n  if( v==0 ) return;\n  sqlite3VdbeRunOnlyOnce(v);\n  pParse->nMem = 2;\n\n  /* Interpret the [schema.] part of the pragma statement. iDb is the\n  ** index of the database this pragma is being applied to in db.aDb[]. */\n  iDb = sqlite3TwoPartName(pParse, pId1, pId2, &pId);\n  if( iDb<0 ) return;\n  pDb = &db->aDb[iDb];\n\n  /* If the temp database has been explicitly named as part of the \n  ** pragma, make sure it is open. \n  */\n  if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){\n    return;\n  }\n\n  zLeft = sqlite3NameFromToken(db, pId);\n  if( !zLeft ) return;\n  if( minusFlag ){\n    zRight = sqlite3MPrintf(db, \"-%T\", pValue);\n  }else{\n    zRight = sqlite3NameFromToken(db, pValue);\n  }\n\n  assert( pId2 );\n  zDb = pId2->n>0 ? pDb->zDbSName : 0;\n  if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){\n    goto pragma_out;\n  }\n\n  /* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS\n  ** connection.  If it returns SQLITE_OK, then assume that the VFS\n  ** handled the pragma and generate a no-op prepared statement.\n  **\n  ** IMPLEMENTATION-OF: R-12238-55120 Whenever a PRAGMA statement is parsed,\n  ** an SQLITE_FCNTL_PRAGMA file control is sent to the open sqlite3_file\n  ** object corresponding to the database file to which the pragma\n  ** statement refers.\n  **\n  ** IMPLEMENTATION-OF: R-29875-31678 The argument to the SQLITE_FCNTL_PRAGMA\n  ** file control is an array of pointers to strings (char**) in which the\n  ** second element of the array is the name of the pragma and the third\n  ** element is the argument to the pragma or NULL if the pragma has no\n  ** argument.\n  */\n  aFcntl[0] = 0;\n  aFcntl[1] = zLeft;\n  aFcntl[2] = zRight;\n  aFcntl[3] = 0;\n  db->busyHandler.nBusy = 0;\n  rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl);\n  if( rc==SQLITE_OK ){\n    returnSingleText(v, \"result\", aFcntl[0]);\n    sqlite3_free(aFcntl[0]);\n    goto pragma_out;\n  }\n  if( rc!=SQLITE_NOTFOUND ){\n    if( aFcntl[0] ){\n      sqlite3ErrorMsg(pParse, \"%s\", aFcntl[0]);\n      sqlite3_free(aFcntl[0]);\n    }\n    pParse->nErr++;\n    pParse->rc = rc;\n\n    goto pragma_out;\n  }\n\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n  if(sqlcipher_codec_pragma(db, iDb, pParse, zLeft, zRight)) { \n    /* sqlcipher_codec_pragma executes internal */\n    goto pragma_out;\n  }\n#endif\n/* END SQLCIPHER */  \n\n  /* Locate the pragma in the lookup table */\n  lwr = 0;\n  upr = ArraySize(aPragmaNames)-1;\n  while( lwr<=upr ){\n    mid = (lwr+upr)/2;\n    rc = sqlite3_stricmp(zLeft, aPragmaNames[mid].zName);\n    if( rc==0 ) break;\n    if( rc<0 ){\n      upr = mid - 1;\n    }else{\n      lwr = mid + 1;\n    }\n  }\n  if( lwr>upr ) goto pragma_out;\n  pPragma = &aPragmaNames[mid];\n\n  /* Make sure the database schema is loaded if the pragma requires that */\n  if( (pPragma->mPragFlag & PragFlag_NeedSchema)!=0 ){\n    if( sqlite3ReadSchema(pParse) ) goto pragma_out;\n  }\n\n  /* Jump to the appropriate pragma handler */\n  switch( pPragma->ePragTyp ){\n  \n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)\n  /*\n  **  PRAGMA [schema.]default_cache_size\n  **  PRAGMA [schema.]default_cache_size=N\n  **\n  ** The first form reports the current persistent setting for the\n  ** page cache size.  The value returned is the maximum number of\n  ** pages in the page cache.  The second form sets both the current\n  ** page cache size value and the persistent page cache size value\n  ** stored in the database file.\n  **\n  ** Older versions of SQLite would set the default cache size to a\n  ** negative number to indicate synchronous=OFF.  These days, synchronous\n  ** is always on by default regardless of the sign of the default cache\n  ** size.  But continue to take the absolute value of the default cache\n  ** size of historical compatibility.\n  */\n  case PragTyp_DEFAULT_CACHE_SIZE: {\n    static const int iLn = VDBE_OFFSET_LINENO(2);\n    static const VdbeOpList getCacheSize[] = {\n      { OP_Transaction, 0, 0,        0},                         /* 0 */\n      { OP_ReadCookie,  0, 1,        BTREE_DEFAULT_CACHE_SIZE},  /* 1 */\n      { OP_IfPos,       1, 8,        0},\n      { OP_Integer,     0, 2,        0},\n      { OP_Subtract,    1, 2,        1},\n      { OP_IfPos,       1, 8,        0},\n      { OP_Integer,     0, 1,        0},                         /* 6 */\n      { OP_Noop,        0, 0,        0},\n      { OP_ResultRow,   1, 1,        0},\n    };\n    VdbeOp *aOp;\n    sqlite3VdbeUsesBtree(v, iDb);\n    if( !zRight ){\n      setOneColumnName(v, \"cache_size\");\n      pParse->nMem += 2;\n      sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(getCacheSize));\n      aOp = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize, iLn);\n      if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break;\n      aOp[0].p1 = iDb;\n      aOp[1].p1 = iDb;\n      aOp[6].p1 = SQLITE_DEFAULT_CACHE_SIZE;\n    }else{\n      int size = sqlite3AbsInt32(sqlite3Atoi(zRight));\n      sqlite3BeginWriteOperation(pParse, 0, iDb);\n      sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, size);\n      assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n      pDb->pSchema->cache_size = size;\n      sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);\n    }\n    break;\n  }\n#endif /* !SQLITE_OMIT_PAGER_PRAGMAS && !SQLITE_OMIT_DEPRECATED */\n\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\n  /*\n  **  PRAGMA [schema.]page_size\n  **  PRAGMA [schema.]page_size=N\n  **\n  ** The first form reports the current setting for the\n  ** database page size in bytes.  The second form sets the\n  ** database page size value.  The value can only be set if\n  ** the database has not yet been created.\n  */\n  case PragTyp_PAGE_SIZE: {\n    Btree *pBt = pDb->pBt;\n    assert( pBt!=0 );\n    if( !zRight ){\n      int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;\n      returnSingleInt(v, \"page_size\", size);\n    }else{\n      /* Malloc may fail when setting the page-size, as there is an internal\n      ** buffer that the pager module resizes using sqlite3_realloc().\n      */\n      db->nextPagesize = sqlite3Atoi(zRight);\n      if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){\n        sqlite3OomFault(db);\n      }\n    }\n    break;\n  }\n\n  /*\n  **  PRAGMA [schema.]secure_delete\n  **  PRAGMA [schema.]secure_delete=ON/OFF\n  **\n  ** The first form reports the current setting for the\n  ** secure_delete flag.  The second form changes the secure_delete\n  ** flag setting and reports thenew value.\n  */\n  case PragTyp_SECURE_DELETE: {\n    Btree *pBt = pDb->pBt;\n    int b = -1;\n    assert( pBt!=0 );\n    if( zRight ){\n      b = sqlite3GetBoolean(zRight, 0);\n    }\n    if( pId2->n==0 && b>=0 ){\n      int ii;\n      for(ii=0; ii<db->nDb; ii++){\n        sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);\n      }\n    }\n    b = sqlite3BtreeSecureDelete(pBt, b);\n    returnSingleInt(v, \"secure_delete\", b);\n    break;\n  }\n\n  /*\n  **  PRAGMA [schema.]max_page_count\n  **  PRAGMA [schema.]max_page_count=N\n  **\n  ** The first form reports the current setting for the\n  ** maximum number of pages in the database file.  The \n  ** second form attempts to change this setting.  Both\n  ** forms return the current setting.\n  **\n  ** The absolute value of N is used.  This is undocumented and might\n  ** change.  The only purpose is to provide an easy way to test\n  ** the sqlite3AbsInt32() function.\n  **\n  **  PRAGMA [schema.]page_count\n  **\n  ** Return the number of pages in the specified database.\n  */\n  case PragTyp_PAGE_COUNT: {\n    int iReg;\n    sqlite3CodeVerifySchema(pParse, iDb);\n    iReg = ++pParse->nMem;\n    if( sqlite3Tolower(zLeft[0])=='p' ){\n      sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);\n    }else{\n      sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, \n                        sqlite3AbsInt32(sqlite3Atoi(zRight)));\n    }\n    sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);\n    sqlite3VdbeSetNumCols(v, 1);\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);\n    break;\n  }\n\n  /*\n  **  PRAGMA [schema.]locking_mode\n  **  PRAGMA [schema.]locking_mode = (normal|exclusive)\n  */\n  case PragTyp_LOCKING_MODE: {\n    const char *zRet = \"normal\";\n    int eMode = getLockingMode(zRight);\n\n    if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){\n      /* Simple \"PRAGMA locking_mode;\" statement. This is a query for\n      ** the current default locking mode (which may be different to\n      ** the locking-mode of the main database).\n      */\n      eMode = db->dfltLockMode;\n    }else{\n      Pager *pPager;\n      if( pId2->n==0 ){\n        /* This indicates that no database name was specified as part\n        ** of the PRAGMA command. In this case the locking-mode must be\n        ** set on all attached databases, as well as the main db file.\n        **\n        ** Also, the sqlite3.dfltLockMode variable is set so that\n        ** any subsequently attached databases also use the specified\n        ** locking mode.\n        */\n        int ii;\n        assert(pDb==&db->aDb[0]);\n        for(ii=2; ii<db->nDb; ii++){\n          pPager = sqlite3BtreePager(db->aDb[ii].pBt);\n          sqlite3PagerLockingMode(pPager, eMode);\n        }\n        db->dfltLockMode = (u8)eMode;\n      }\n      pPager = sqlite3BtreePager(pDb->pBt);\n      eMode = sqlite3PagerLockingMode(pPager, eMode);\n    }\n\n    assert( eMode==PAGER_LOCKINGMODE_NORMAL\n            || eMode==PAGER_LOCKINGMODE_EXCLUSIVE );\n    if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){\n      zRet = \"exclusive\";\n    }\n    returnSingleText(v, \"locking_mode\", zRet);\n    break;\n  }\n\n  /*\n  **  PRAGMA [schema.]journal_mode\n  **  PRAGMA [schema.]journal_mode =\n  **                      (delete|persist|off|truncate|memory|wal|off)\n  */\n  case PragTyp_JOURNAL_MODE: {\n    int eMode;        /* One of the PAGER_JOURNALMODE_XXX symbols */\n    int ii;           /* Loop counter */\n\n    setOneColumnName(v, \"journal_mode\");\n    if( zRight==0 ){\n      /* If there is no \"=MODE\" part of the pragma, do a query for the\n      ** current mode */\n      eMode = PAGER_JOURNALMODE_QUERY;\n    }else{\n      const char *zMode;\n      int n = sqlite3Strlen30(zRight);\n      for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){\n        if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;\n      }\n      if( !zMode ){\n        /* If the \"=MODE\" part does not match any known journal mode,\n        ** then do a query */\n        eMode = PAGER_JOURNALMODE_QUERY;\n      }\n    }\n    if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){\n      /* Convert \"PRAGMA journal_mode\" into \"PRAGMA main.journal_mode\" */\n      iDb = 0;\n      pId2->n = 1;\n    }\n    for(ii=db->nDb-1; ii>=0; ii--){\n      if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){\n        sqlite3VdbeUsesBtree(v, ii);\n        sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode);\n      }\n    }\n    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\n    break;\n  }\n\n  /*\n  **  PRAGMA [schema.]journal_size_limit\n  **  PRAGMA [schema.]journal_size_limit=N\n  **\n  ** Get or set the size limit on rollback journal files.\n  */\n  case PragTyp_JOURNAL_SIZE_LIMIT: {\n    Pager *pPager = sqlite3BtreePager(pDb->pBt);\n    i64 iLimit = -2;\n    if( zRight ){\n      sqlite3DecOrHexToI64(zRight, &iLimit);\n      if( iLimit<-1 ) iLimit = -1;\n    }\n    iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit);\n    returnSingleInt(v, \"journal_size_limit\", iLimit);\n    break;\n  }\n\n#endif /* SQLITE_OMIT_PAGER_PRAGMAS */\n\n  /*\n  **  PRAGMA [schema.]auto_vacuum\n  **  PRAGMA [schema.]auto_vacuum=N\n  **\n  ** Get or set the value of the database 'auto-vacuum' parameter.\n  ** The value is one of:  0 NONE 1 FULL 2 INCREMENTAL\n  */\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  case PragTyp_AUTO_VACUUM: {\n    Btree *pBt = pDb->pBt;\n    assert( pBt!=0 );\n    if( !zRight ){\n      returnSingleInt(v, \"auto_vacuum\", sqlite3BtreeGetAutoVacuum(pBt));\n    }else{\n      int eAuto = getAutoVacuum(zRight);\n      assert( eAuto>=0 && eAuto<=2 );\n      db->nextAutovac = (u8)eAuto;\n      /* Call SetAutoVacuum() to set initialize the internal auto and\n      ** incr-vacuum flags. This is required in case this connection\n      ** creates the database file. It is important that it is created\n      ** as an auto-vacuum capable db.\n      */\n      rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto);\n      if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){\n        /* When setting the auto_vacuum mode to either \"full\" or \n        ** \"incremental\", write the value of meta[6] in the database\n        ** file. Before writing to meta[6], check that meta[3] indicates\n        ** that this really is an auto-vacuum capable database.\n        */\n        static const int iLn = VDBE_OFFSET_LINENO(2);\n        static const VdbeOpList setMeta6[] = {\n          { OP_Transaction,    0,         1,                 0},    /* 0 */\n          { OP_ReadCookie,     0,         1,         BTREE_LARGEST_ROOT_PAGE},\n          { OP_If,             1,         0,                 0},    /* 2 */\n          { OP_Halt,           SQLITE_OK, OE_Abort,          0},    /* 3 */\n          { OP_SetCookie,      0,         BTREE_INCR_VACUUM, 0},    /* 4 */\n        };\n        VdbeOp *aOp;\n        int iAddr = sqlite3VdbeCurrentAddr(v);\n        sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(setMeta6));\n        aOp = sqlite3VdbeAddOpList(v, ArraySize(setMeta6), setMeta6, iLn);\n        if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break;\n        aOp[0].p1 = iDb;\n        aOp[1].p1 = iDb;\n        aOp[2].p2 = iAddr+4;\n        aOp[4].p1 = iDb;\n        aOp[4].p3 = eAuto - 1;\n        sqlite3VdbeUsesBtree(v, iDb);\n      }\n    }\n    break;\n  }\n#endif\n\n  /*\n  **  PRAGMA [schema.]incremental_vacuum(N)\n  **\n  ** Do N steps of incremental vacuuming on a database.\n  */\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  case PragTyp_INCREMENTAL_VACUUM: {\n    int iLimit, addr;\n    if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){\n      iLimit = 0x7fffffff;\n    }\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\n    sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1);\n    addr = sqlite3VdbeAddOp1(v, OP_IncrVacuum, iDb); VdbeCoverage(v);\n    sqlite3VdbeAddOp1(v, OP_ResultRow, 1);\n    sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1);\n    sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr); VdbeCoverage(v);\n    sqlite3VdbeJumpHere(v, addr);\n    break;\n  }\n#endif\n\n#ifndef SQLITE_OMIT_PAGER_PRAGMAS\n  /*\n  **  PRAGMA [schema.]cache_size\n  **  PRAGMA [schema.]cache_size=N\n  **\n  ** The first form reports the current local setting for the\n  ** page cache size. The second form sets the local\n  ** page cache size value.  If N is positive then that is the\n  ** number of pages in the cache.  If N is negative, then the\n  ** number of pages is adjusted so that the cache uses -N kibibytes\n  ** of memory.\n  */\n  case PragTyp_CACHE_SIZE: {\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    if( !zRight ){\n      returnSingleInt(v, \"cache_size\", pDb->pSchema->cache_size);\n    }else{\n      int size = sqlite3Atoi(zRight);\n      pDb->pSchema->cache_size = size;\n      sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);\n    }\n    break;\n  }\n\n  /*\n  **  PRAGMA [schema.]cache_spill\n  **  PRAGMA cache_spill=BOOLEAN\n  **  PRAGMA [schema.]cache_spill=N\n  **\n  ** The first form reports the current local setting for the\n  ** page cache spill size. The second form turns cache spill on\n  ** or off.  When turnning cache spill on, the size is set to the\n  ** current cache_size.  The third form sets a spill size that\n  ** may be different form the cache size.\n  ** If N is positive then that is the\n  ** number of pages in the cache.  If N is negative, then the\n  ** number of pages is adjusted so that the cache uses -N kibibytes\n  ** of memory.\n  **\n  ** If the number of cache_spill pages is less then the number of\n  ** cache_size pages, no spilling occurs until the page count exceeds\n  ** the number of cache_size pages.\n  **\n  ** The cache_spill=BOOLEAN setting applies to all attached schemas,\n  ** not just the schema specified.\n  */\n  case PragTyp_CACHE_SPILL: {\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    if( !zRight ){\n      returnSingleInt(v, \"cache_spill\", \n         (db->flags & SQLITE_CacheSpill)==0 ? 0 : \n            sqlite3BtreeSetSpillSize(pDb->pBt,0));\n    }else{\n      int size = 1;\n      if( sqlite3GetInt32(zRight, &size) ){\n        sqlite3BtreeSetSpillSize(pDb->pBt, size);\n      }\n      if( sqlite3GetBoolean(zRight, size!=0) ){\n        db->flags |= SQLITE_CacheSpill;\n      }else{\n        db->flags &= ~SQLITE_CacheSpill;\n      }\n      setAllPagerFlags(db);\n    }\n    break;\n  }\n\n  /*\n  **  PRAGMA [schema.]mmap_size(N)\n  **\n  ** Used to set mapping size limit. The mapping size limit is\n  ** used to limit the aggregate size of all memory mapped regions of the\n  ** database file. If this parameter is set to zero, then memory mapping\n  ** is not used at all.  If N is negative, then the default memory map\n  ** limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set.\n  ** The parameter N is measured in bytes.\n  **\n  ** This value is advisory.  The underlying VFS is free to memory map\n  ** as little or as much as it wants.  Except, if N is set to 0 then the\n  ** upper layers will never invoke the xFetch interfaces to the VFS.\n  */\n  case PragTyp_MMAP_SIZE: {\n    sqlite3_int64 sz;\n#if SQLITE_MAX_MMAP_SIZE>0\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    if( zRight ){\n      int ii;\n      sqlite3DecOrHexToI64(zRight, &sz);\n      if( sz<0 ) sz = sqlite3GlobalConfig.szMmap;\n      if( pId2->n==0 ) db->szMmap = sz;\n      for(ii=db->nDb-1; ii>=0; ii--){\n        if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){\n          sqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, sz);\n        }\n      }\n    }\n    sz = -1;\n    rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_MMAP_SIZE, &sz);\n#else\n    sz = 0;\n    rc = SQLITE_OK;\n#endif\n    if( rc==SQLITE_OK ){\n      returnSingleInt(v, \"mmap_size\", sz);\n    }else if( rc!=SQLITE_NOTFOUND ){\n      pParse->nErr++;\n      pParse->rc = rc;\n    }\n    break;\n  }\n\n  /*\n  **   PRAGMA temp_store\n  **   PRAGMA temp_store = \"default\"|\"memory\"|\"file\"\n  **\n  ** Return or set the local value of the temp_store flag.  Changing\n  ** the local value does not make changes to the disk file and the default\n  ** value will be restored the next time the database is opened.\n  **\n  ** Note that it is possible for the library compile-time options to\n  ** override this setting\n  */\n  case PragTyp_TEMP_STORE: {\n    if( !zRight ){\n      returnSingleInt(v, \"temp_store\", db->temp_store);\n    }else{\n      changeTempStorage(pParse, zRight);\n    }\n    break;\n  }\n\n  /*\n  **   PRAGMA temp_store_directory\n  **   PRAGMA temp_store_directory = \"\"|\"directory_name\"\n  **\n  ** Return or set the local value of the temp_store_directory flag.  Changing\n  ** the value sets a specific directory to be used for temporary files.\n  ** Setting to a null string reverts to the default temporary directory search.\n  ** If temporary directory is changed, then invalidateTempStorage.\n  **\n  */\n  case PragTyp_TEMP_STORE_DIRECTORY: {\n    if( !zRight ){\n      returnSingleText(v, \"temp_store_directory\", sqlite3_temp_directory);\n    }else{\n#ifndef SQLITE_OMIT_WSD\n      if( zRight[0] ){\n        int res;\n        rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);\n        if( rc!=SQLITE_OK || res==0 ){\n          sqlite3ErrorMsg(pParse, \"not a writable directory\");\n          goto pragma_out;\n        }\n      }\n      if( SQLITE_TEMP_STORE==0\n       || (SQLITE_TEMP_STORE==1 && db->temp_store<=1)\n       || (SQLITE_TEMP_STORE==2 && db->temp_store==1)\n      ){\n        invalidateTempStorage(pParse);\n      }\n      sqlite3_free(sqlite3_temp_directory);\n      if( zRight[0] ){\n        sqlite3_temp_directory = sqlite3_mprintf(\"%s\", zRight);\n      }else{\n        sqlite3_temp_directory = 0;\n      }\n#endif /* SQLITE_OMIT_WSD */\n    }\n    break;\n  }\n\n#if SQLITE_OS_WIN\n  /*\n  **   PRAGMA data_store_directory\n  **   PRAGMA data_store_directory = \"\"|\"directory_name\"\n  **\n  ** Return or set the local value of the data_store_directory flag.  Changing\n  ** the value sets a specific directory to be used for database files that\n  ** were specified with a relative pathname.  Setting to a null string reverts\n  ** to the default database directory, which for database files specified with\n  ** a relative path will probably be based on the current directory for the\n  ** process.  Database file specified with an absolute path are not impacted\n  ** by this setting, regardless of its value.\n  **\n  */\n  case PragTyp_DATA_STORE_DIRECTORY: {\n    if( !zRight ){\n      returnSingleText(v, \"data_store_directory\", sqlite3_data_directory);\n    }else{\n#ifndef SQLITE_OMIT_WSD\n      if( zRight[0] ){\n        int res;\n        rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);\n        if( rc!=SQLITE_OK || res==0 ){\n          sqlite3ErrorMsg(pParse, \"not a writable directory\");\n          goto pragma_out;\n        }\n      }\n      sqlite3_free(sqlite3_data_directory);\n      if( zRight[0] ){\n        sqlite3_data_directory = sqlite3_mprintf(\"%s\", zRight);\n      }else{\n        sqlite3_data_directory = 0;\n      }\n#endif /* SQLITE_OMIT_WSD */\n    }\n    break;\n  }\n#endif\n\n#if SQLITE_ENABLE_LOCKING_STYLE\n  /*\n  **   PRAGMA [schema.]lock_proxy_file\n  **   PRAGMA [schema.]lock_proxy_file = \":auto:\"|\"lock_file_path\"\n  **\n  ** Return or set the value of the lock_proxy_file flag.  Changing\n  ** the value sets a specific file to be used for database access locks.\n  **\n  */\n  case PragTyp_LOCK_PROXY_FILE: {\n    if( !zRight ){\n      Pager *pPager = sqlite3BtreePager(pDb->pBt);\n      char *proxy_file_path = NULL;\n      sqlite3_file *pFile = sqlite3PagerFile(pPager);\n      sqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE, \n                           &proxy_file_path);\n      returnSingleText(v, \"lock_proxy_file\", proxy_file_path);\n    }else{\n      Pager *pPager = sqlite3BtreePager(pDb->pBt);\n      sqlite3_file *pFile = sqlite3PagerFile(pPager);\n      int res;\n      if( zRight[0] ){\n        res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, \n                                     zRight);\n      } else {\n        res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, \n                                     NULL);\n      }\n      if( res!=SQLITE_OK ){\n        sqlite3ErrorMsg(pParse, \"failed to set lock proxy file\");\n        goto pragma_out;\n      }\n    }\n    break;\n  }\n#endif /* SQLITE_ENABLE_LOCKING_STYLE */      \n    \n  /*\n  **   PRAGMA [schema.]synchronous\n  **   PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL|EXTRA\n  **\n  ** Return or set the local value of the synchronous flag.  Changing\n  ** the local value does not make changes to the disk file and the\n  ** default value will be restored the next time the database is\n  ** opened.\n  */\n  case PragTyp_SYNCHRONOUS: {\n    if( !zRight ){\n      returnSingleInt(v, \"synchronous\", pDb->safety_level-1);\n    }else{\n      if( !db->autoCommit ){\n        sqlite3ErrorMsg(pParse, \n            \"Safety level may not be changed inside a transaction\");\n      }else{\n        int iLevel = (getSafetyLevel(zRight,0,1)+1) & PAGER_SYNCHRONOUS_MASK;\n        if( iLevel==0 ) iLevel = 1;\n        pDb->safety_level = iLevel;\n        pDb->bSyncSet = 1;\n        setAllPagerFlags(db);\n      }\n    }\n    break;\n  }\n#endif /* SQLITE_OMIT_PAGER_PRAGMAS */\n\n#ifndef SQLITE_OMIT_FLAG_PRAGMAS\n  case PragTyp_FLAG: {\n    if( zRight==0 ){\n      returnSingleInt(v, pPragma->zName, (db->flags & pPragma->iArg)!=0 );\n    }else{\n      int mask = pPragma->iArg;    /* Mask of bits to set or clear. */\n      if( db->autoCommit==0 ){\n        /* Foreign key support may not be enabled or disabled while not\n        ** in auto-commit mode.  */\n        mask &= ~(SQLITE_ForeignKeys);\n      }\n#if SQLITE_USER_AUTHENTICATION\n      if( db->auth.authLevel==UAUTH_User ){\n        /* Do not allow non-admin users to modify the schema arbitrarily */\n        mask &= ~(SQLITE_WriteSchema);\n      }\n#endif\n\n      if( sqlite3GetBoolean(zRight, 0) ){\n        db->flags |= mask;\n      }else{\n        db->flags &= ~mask;\n        if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0;\n      }\n\n      /* Many of the flag-pragmas modify the code generated by the SQL \n      ** compiler (eg. count_changes). So add an opcode to expire all\n      ** compiled SQL statements after modifying a pragma value.\n      */\n      sqlite3VdbeAddOp0(v, OP_Expire);\n      setAllPagerFlags(db);\n    }\n    break;\n  }\n#endif /* SQLITE_OMIT_FLAG_PRAGMAS */\n\n#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS\n  /*\n  **   PRAGMA table_info(<table>)\n  **\n  ** Return a single row for each column of the named table. The columns of\n  ** the returned data set are:\n  **\n  ** cid:        Column id (numbered from left to right, starting at 0)\n  ** name:       Column name\n  ** type:       Column declaration type.\n  ** notnull:    True if 'NOT NULL' is part of column declaration\n  ** dflt_value: The default value for the column, if any.\n  */\n  case PragTyp_TABLE_INFO: if( zRight ){\n    Table *pTab;\n    pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb);\n    if( pTab ){\n      static const char *azCol[] = {\n         \"cid\", \"name\", \"type\", \"notnull\", \"dflt_value\", \"pk\"\n      };\n      int i, k;\n      int nHidden = 0;\n      Column *pCol;\n      Index *pPk = sqlite3PrimaryKeyIndex(pTab);\n      pParse->nMem = 6;\n      sqlite3CodeVerifySchema(pParse, iDb);\n      setAllColumnNames(v, 6, azCol); assert( 6==ArraySize(azCol) );\n      sqlite3ViewGetColumnNames(pParse, pTab);\n      for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){\n        if( IsHiddenColumn(pCol) ){\n          nHidden++;\n          continue;\n        }\n        if( (pCol->colFlags & COLFLAG_PRIMKEY)==0 ){\n          k = 0;\n        }else if( pPk==0 ){\n          k = 1;\n        }else{\n          for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){}\n        }\n        assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN );\n        sqlite3VdbeMultiLoad(v, 1, \"issisi\",\n               i-nHidden,\n               pCol->zName,\n               sqlite3ColumnType(pCol,\"\"),\n               pCol->notNull ? 1 : 0,\n               pCol->pDflt ? pCol->pDflt->u.zToken : 0,\n               k);\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6);\n      }\n    }\n  }\n  break;\n\n  case PragTyp_STATS: {\n    static const char *azCol[] = { \"table\", \"index\", \"width\", \"height\" };\n    Index *pIdx;\n    HashElem *i;\n    v = sqlite3GetVdbe(pParse);\n    pParse->nMem = 4;\n    sqlite3CodeVerifySchema(pParse, iDb);\n    setAllColumnNames(v, 4, azCol);  assert( 4==ArraySize(azCol) );\n    for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){\n      Table *pTab = sqliteHashData(i);\n      sqlite3VdbeMultiLoad(v, 1, \"ssii\",\n           pTab->zName,\n           0,\n           pTab->szTabRow,\n           pTab->nRowLogEst);\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);\n      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n        sqlite3VdbeMultiLoad(v, 2, \"sii\",\n           pIdx->zName,\n           pIdx->szIdxRow,\n           pIdx->aiRowLogEst[0]);\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4);\n      }\n    }\n  }\n  break;\n\n  case PragTyp_INDEX_INFO: if( zRight ){\n    Index *pIdx;\n    Table *pTab;\n    pIdx = sqlite3FindIndex(db, zRight, zDb);\n    if( pIdx ){\n      static const char *azCol[] = {\n         \"seqno\", \"cid\", \"name\", \"desc\", \"coll\", \"key\"\n      };\n      int i;\n      int mx;\n      if( pPragma->iArg ){\n        /* PRAGMA index_xinfo (newer version with more rows and columns) */\n        mx = pIdx->nColumn;\n        pParse->nMem = 6;\n      }else{\n        /* PRAGMA index_info (legacy version) */\n        mx = pIdx->nKeyCol;\n        pParse->nMem = 3;\n      }\n      pTab = pIdx->pTable;\n      sqlite3CodeVerifySchema(pParse, iDb);\n      assert( pParse->nMem<=ArraySize(azCol) );\n      setAllColumnNames(v, pParse->nMem, azCol);\n      for(i=0; i<mx; i++){\n        i16 cnum = pIdx->aiColumn[i];\n        sqlite3VdbeMultiLoad(v, 1, \"iis\", i, cnum,\n                             cnum<0 ? 0 : pTab->aCol[cnum].zName);\n        if( pPragma->iArg ){\n          sqlite3VdbeMultiLoad(v, 4, \"isi\",\n            pIdx->aSortOrder[i],\n            pIdx->azColl[i],\n            i<pIdx->nKeyCol);\n        }\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem);\n      }\n    }\n  }\n  break;\n\n  case PragTyp_INDEX_LIST: if( zRight ){\n    Index *pIdx;\n    Table *pTab;\n    int i;\n    pTab = sqlite3FindTable(db, zRight, zDb);\n    if( pTab ){\n      static const char *azCol[] = {\n        \"seq\", \"name\", \"unique\", \"origin\", \"partial\"\n      };\n      v = sqlite3GetVdbe(pParse);\n      pParse->nMem = 5;\n      sqlite3CodeVerifySchema(pParse, iDb);\n      setAllColumnNames(v, 5, azCol);  assert( 5==ArraySize(azCol) );\n      for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){\n        const char *azOrigin[] = { \"c\", \"u\", \"pk\" };\n        sqlite3VdbeMultiLoad(v, 1, \"isisi\",\n           i,\n           pIdx->zName,\n           IsUniqueIndex(pIdx),\n           azOrigin[pIdx->idxType],\n           pIdx->pPartIdxWhere!=0);\n        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);\n      }\n    }\n  }\n  break;\n\n  case PragTyp_DATABASE_LIST: {\n    static const char *azCol[] = { \"seq\", \"name\", \"file\" };\n    int i;\n    pParse->nMem = 3;\n    setAllColumnNames(v, 3, azCol); assert( 3==ArraySize(azCol) );\n    for(i=0; i<db->nDb; i++){\n      if( db->aDb[i].pBt==0 ) continue;\n      assert( db->aDb[i].zDbSName!=0 );\n      sqlite3VdbeMultiLoad(v, 1, \"iss\",\n         i,\n         db->aDb[i].zDbSName,\n         sqlite3BtreeGetFilename(db->aDb[i].pBt));\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);\n    }\n  }\n  break;\n\n  case PragTyp_COLLATION_LIST: {\n    static const char *azCol[] = { \"seq\", \"name\" };\n    int i = 0;\n    HashElem *p;\n    pParse->nMem = 2;\n    setAllColumnNames(v, 2, azCol); assert( 2==ArraySize(azCol) );\n    for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){\n      CollSeq *pColl = (CollSeq *)sqliteHashData(p);\n      sqlite3VdbeMultiLoad(v, 1, \"is\", i++, pColl->zName);\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);\n    }\n  }\n  break;\n#endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */\n\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n  case PragTyp_FOREIGN_KEY_LIST: if( zRight ){\n    FKey *pFK;\n    Table *pTab;\n    pTab = sqlite3FindTable(db, zRight, zDb);\n    if( pTab ){\n      v = sqlite3GetVdbe(pParse);\n      pFK = pTab->pFKey;\n      if( pFK ){\n        static const char *azCol[] = {\n           \"id\", \"seq\", \"table\", \"from\", \"to\", \"on_update\", \"on_delete\",\n           \"match\"\n        };\n        int i = 0; \n        pParse->nMem = 8;\n        sqlite3CodeVerifySchema(pParse, iDb);\n        setAllColumnNames(v, 8, azCol); assert( 8==ArraySize(azCol) );\n        while(pFK){\n          int j;\n          for(j=0; j<pFK->nCol; j++){\n            sqlite3VdbeMultiLoad(v, 1, \"iissssss\",\n                   i,\n                   j,\n                   pFK->zTo,\n                   pTab->aCol[pFK->aCol[j].iFrom].zName,\n                   pFK->aCol[j].zCol,\n                   actionName(pFK->aAction[1]),  /* ON UPDATE */\n                   actionName(pFK->aAction[0]),  /* ON DELETE */\n                   \"NONE\");\n            sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8);\n          }\n          ++i;\n          pFK = pFK->pNextFrom;\n        }\n      }\n    }\n  }\n  break;\n#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */\n\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n#ifndef SQLITE_OMIT_TRIGGER\n  case PragTyp_FOREIGN_KEY_CHECK: {\n    FKey *pFK;             /* A foreign key constraint */\n    Table *pTab;           /* Child table contain \"REFERENCES\" keyword */\n    Table *pParent;        /* Parent table that child points to */\n    Index *pIdx;           /* Index in the parent table */\n    int i;                 /* Loop counter:  Foreign key number for pTab */\n    int j;                 /* Loop counter:  Field of the foreign key */\n    HashElem *k;           /* Loop counter:  Next table in schema */\n    int x;                 /* result variable */\n    int regResult;         /* 3 registers to hold a result row */\n    int regKey;            /* Register to hold key for checking the FK */\n    int regRow;            /* Registers to hold a row from pTab */\n    int addrTop;           /* Top of a loop checking foreign keys */\n    int addrOk;            /* Jump here if the key is OK */\n    int *aiCols;           /* child to parent column mapping */\n    static const char *azCol[] = { \"table\", \"rowid\", \"parent\", \"fkid\" };\n\n    regResult = pParse->nMem+1;\n    pParse->nMem += 4;\n    regKey = ++pParse->nMem;\n    regRow = ++pParse->nMem;\n    v = sqlite3GetVdbe(pParse);\n    setAllColumnNames(v, 4, azCol); assert( 4==ArraySize(azCol) );\n    sqlite3CodeVerifySchema(pParse, iDb);\n    k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);\n    while( k ){\n      if( zRight ){\n        pTab = sqlite3LocateTable(pParse, 0, zRight, zDb);\n        k = 0;\n      }else{\n        pTab = (Table*)sqliteHashData(k);\n        k = sqliteHashNext(k);\n      }\n      if( pTab==0 || pTab->pFKey==0 ) continue;\n      sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\n      if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;\n      sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);\n      sqlite3VdbeLoadString(v, regResult, pTab->zName);\n      for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){\n        pParent = sqlite3FindTable(db, pFK->zTo, zDb);\n        if( pParent==0 ) continue;\n        pIdx = 0;\n        sqlite3TableLock(pParse, iDb, pParent->tnum, 0, pParent->zName);\n        x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0);\n        if( x==0 ){\n          if( pIdx==0 ){\n            sqlite3OpenTable(pParse, i, iDb, pParent, OP_OpenRead);\n          }else{\n            sqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iDb);\n            sqlite3VdbeSetP4KeyInfo(pParse, pIdx);\n          }\n        }else{\n          k = 0;\n          break;\n        }\n      }\n      assert( pParse->nErr>0 || pFK==0 );\n      if( pFK ) break;\n      if( pParse->nTab<i ) pParse->nTab = i;\n      addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, 0); VdbeCoverage(v);\n      for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){\n        pParent = sqlite3FindTable(db, pFK->zTo, zDb);\n        pIdx = 0;\n        aiCols = 0;\n        if( pParent ){\n          x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols);\n          assert( x==0 );\n        }\n        addrOk = sqlite3VdbeMakeLabel(v);\n        if( pParent && pIdx==0 ){\n          int iKey = pFK->aCol[0].iFrom;\n          assert( iKey>=0 && iKey<pTab->nCol );\n          if( iKey!=pTab->iPKey ){\n            sqlite3VdbeAddOp3(v, OP_Column, 0, iKey, regRow);\n            sqlite3ColumnDefault(v, pTab, iKey, regRow);\n            sqlite3VdbeAddOp2(v, OP_IsNull, regRow, addrOk); VdbeCoverage(v);\n          }else{\n            sqlite3VdbeAddOp2(v, OP_Rowid, 0, regRow);\n          }\n          sqlite3VdbeAddOp3(v, OP_SeekRowid, i, 0, regRow); VdbeCoverage(v);\n          sqlite3VdbeGoto(v, addrOk);\n          sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2);\n        }else{\n          for(j=0; j<pFK->nCol; j++){\n            sqlite3ExprCodeGetColumnOfTable(v, pTab, 0,\n                            aiCols ? aiCols[j] : pFK->aCol[j].iFrom, regRow+j);\n            sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);\n          }\n          if( pParent ){\n            sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, pFK->nCol, regKey,\n                              sqlite3IndexAffinityStr(db,pIdx), pFK->nCol);\n            sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0);\n            VdbeCoverage(v);\n          }\n        }\n        sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1);\n        sqlite3VdbeMultiLoad(v, regResult+2, \"si\", pFK->zTo, i-1);\n        sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4);\n        sqlite3VdbeResolveLabel(v, addrOk);\n        sqlite3DbFree(db, aiCols);\n      }\n      sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); VdbeCoverage(v);\n      sqlite3VdbeJumpHere(v, addrTop);\n    }\n  }\n  break;\n#endif /* !defined(SQLITE_OMIT_TRIGGER) */\n#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */\n\n#ifndef NDEBUG\n  case PragTyp_PARSER_TRACE: {\n    if( zRight ){\n      if( sqlite3GetBoolean(zRight, 0) ){\n        sqlite3ParserTrace(stdout, \"parser: \");\n      }else{\n        sqlite3ParserTrace(0, 0);\n      }\n    }\n  }\n  break;\n#endif\n\n  /* Reinstall the LIKE and GLOB functions.  The variant of LIKE\n  ** used will be case sensitive or not depending on the RHS.\n  */\n  case PragTyp_CASE_SENSITIVE_LIKE: {\n    if( zRight ){\n      sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));\n    }\n  }\n  break;\n\n#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX\n# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100\n#endif\n\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\n  /* Pragma \"quick_check\" is reduced version of \n  ** integrity_check designed to detect most database corruption\n  ** without most of the overhead of a full integrity-check.\n  */\n  case PragTyp_INTEGRITY_CHECK: {\n    int i, j, addr, mxErr;\n\n    int isQuick = (sqlite3Tolower(zLeft[0])=='q');\n\n    /* If the PRAGMA command was of the form \"PRAGMA <db>.integrity_check\",\n    ** then iDb is set to the index of the database identified by <db>.\n    ** In this case, the integrity of database iDb only is verified by\n    ** the VDBE created below.\n    **\n    ** Otherwise, if the command was simply \"PRAGMA integrity_check\" (or\n    ** \"PRAGMA quick_check\"), then iDb is set to 0. In this case, set iDb\n    ** to -1 here, to indicate that the VDBE should verify the integrity\n    ** of all attached databases.  */\n    assert( iDb>=0 );\n    assert( iDb==0 || pId2->z );\n    if( pId2->z==0 ) iDb = -1;\n\n    /* Initialize the VDBE program */\n    pParse->nMem = 6;\n    setOneColumnName(v, \"integrity_check\");\n\n    /* Set the maximum error count */\n    mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;\n    if( zRight ){\n      sqlite3GetInt32(zRight, &mxErr);\n      if( mxErr<=0 ){\n        mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;\n      }\n    }\n    sqlite3VdbeAddOp2(v, OP_Integer, mxErr, 1);  /* reg[1] holds errors left */\n\n    /* Do an integrity check on each database file */\n    for(i=0; i<db->nDb; i++){\n      HashElem *x;\n      Hash *pTbls;\n      int *aRoot;\n      int cnt = 0;\n      int mxIdx = 0;\n      int nIdx;\n\n      if( OMIT_TEMPDB && i==1 ) continue;\n      if( iDb>=0 && i!=iDb ) continue;\n\n      sqlite3CodeVerifySchema(pParse, i);\n      addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Halt if out of errors */\n      VdbeCoverage(v);\n      sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);\n      sqlite3VdbeJumpHere(v, addr);\n\n      /* Do an integrity check of the B-Tree\n      **\n      ** Begin by finding the root pages numbers\n      ** for all tables and indices in the database.\n      */\n      assert( sqlite3SchemaMutexHeld(db, i, 0) );\n      pTbls = &db->aDb[i].pSchema->tblHash;\n      for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){\n        Table *pTab = sqliteHashData(x);\n        Index *pIdx;\n        if( HasRowid(pTab) ) cnt++;\n        for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }\n        if( nIdx>mxIdx ) mxIdx = nIdx;\n      }\n      aRoot = sqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1));\n      if( aRoot==0 ) break;\n      for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){\n        Table *pTab = sqliteHashData(x);\n        Index *pIdx;\n        if( HasRowid(pTab) ) aRoot[cnt++] = pTab->tnum;\n        for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n          aRoot[cnt++] = pIdx->tnum;\n        }\n      }\n      aRoot[cnt] = 0;\n\n      /* Make sure sufficient number of registers have been allocated */\n      pParse->nMem = MAX( pParse->nMem, 8+mxIdx );\n\n      /* Do the b-tree integrity checks */\n      sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);\n      sqlite3VdbeChangeP5(v, (u8)i);\n      addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v);\n      sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,\n         sqlite3MPrintf(db, \"*** in database %s ***\\n\", db->aDb[i].zDbSName),\n         P4_DYNAMIC);\n      sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);\n      sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 2, 1);\n      sqlite3VdbeJumpHere(v, addr);\n\n      /* Make sure all the indices are constructed correctly.\n      */\n      for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){\n        Table *pTab = sqliteHashData(x);\n        Index *pIdx, *pPk;\n        Index *pPrior = 0;\n        int loopTop;\n        int iDataCur, iIdxCur;\n        int r1 = -1;\n\n        if( pTab->pIndex==0 ) continue;\n        pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);\n        addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1);  /* Stop if out of errors */\n        VdbeCoverage(v);\n        sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);\n        sqlite3VdbeJumpHere(v, addr);\n        sqlite3ExprCacheClear(pParse);\n        sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,\n                                   1, 0, &iDataCur, &iIdxCur);\n        sqlite3VdbeAddOp2(v, OP_Integer, 0, 7);\n        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){\n          sqlite3VdbeAddOp2(v, OP_Integer, 0, 8+j); /* index entries counter */\n        }\n        assert( pParse->nMem>=8+j );\n        assert( sqlite3NoTempsInRange(pParse,1,7+j) );\n        sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v);\n        loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1);\n        /* Verify that all NOT NULL columns really are NOT NULL */\n        for(j=0; j<pTab->nCol; j++){\n          char *zErr;\n          int jmp2, jmp3;\n          if( j==pTab->iPKey ) continue;\n          if( pTab->aCol[j].notNull==0 ) continue;\n          sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);\n          sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);\n          jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);\n          sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */\n          zErr = sqlite3MPrintf(db, \"NULL value in %s.%s\", pTab->zName,\n                              pTab->aCol[j].zName);\n          sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);\n          sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);\n          jmp3 = sqlite3VdbeAddOp1(v, OP_IfPos, 1); VdbeCoverage(v);\n          sqlite3VdbeAddOp0(v, OP_Halt);\n          sqlite3VdbeJumpHere(v, jmp2);\n          sqlite3VdbeJumpHere(v, jmp3);\n        }\n        /* Validate index entries for the current row */\n        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){\n          int jmp2, jmp3, jmp4, jmp5;\n          int ckUniq = sqlite3VdbeMakeLabel(v);\n          if( pPk==pIdx ) continue;\n          r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,\n                                       pPrior, r1);\n          pPrior = pIdx;\n          sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1);  /* increment entry count */\n          /* Verify that an index entry exists for the current table row */\n          jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,\n                                      pIdx->nColumn); VdbeCoverage(v);\n          sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */\n          sqlite3VdbeLoadString(v, 3, \"row \");\n          sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);\n          sqlite3VdbeLoadString(v, 4, \" missing from index \");\n          sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);\n          jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);\n          sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);\n          sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);\n          jmp4 = sqlite3VdbeAddOp1(v, OP_IfPos, 1); VdbeCoverage(v);\n          sqlite3VdbeAddOp0(v, OP_Halt);\n          sqlite3VdbeJumpHere(v, jmp2);\n          /* For UNIQUE indexes, verify that only one entry exists with the\n          ** current key.  The entry is unique if (1) any column is NULL\n          ** or (2) the next entry has a different key */\n          if( IsUniqueIndex(pIdx) ){\n            int uniqOk = sqlite3VdbeMakeLabel(v);\n            int jmp6;\n            int kk;\n            for(kk=0; kk<pIdx->nKeyCol; kk++){\n              int iCol = pIdx->aiColumn[kk];\n              assert( iCol!=XN_ROWID && iCol<pTab->nCol );\n              if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;\n              sqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk);\n              VdbeCoverage(v);\n            }\n            jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);\n            sqlite3VdbeGoto(v, uniqOk);\n            sqlite3VdbeJumpHere(v, jmp6);\n            sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,\n                                 pIdx->nKeyCol); VdbeCoverage(v);\n            sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */\n            sqlite3VdbeLoadString(v, 3, \"non-unique entry in index \");\n            sqlite3VdbeGoto(v, jmp5);\n            sqlite3VdbeResolveLabel(v, uniqOk);\n          }\n          sqlite3VdbeJumpHere(v, jmp4);\n          sqlite3ResolvePartIdxLabel(pParse, jmp3);\n        }\n        sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);\n        sqlite3VdbeJumpHere(v, loopTop-1);\n#ifndef SQLITE_OMIT_BTREECOUNT\n        sqlite3VdbeLoadString(v, 2, \"wrong # of entries in index \");\n        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){\n          if( pPk==pIdx ) continue;\n          addr = sqlite3VdbeCurrentAddr(v);\n          sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr+2); VdbeCoverage(v);\n          sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);\n          sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);\n          sqlite3VdbeAddOp3(v, OP_Eq, 8+j, addr+8, 3); VdbeCoverage(v);\n          sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);\n          sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1);\n          sqlite3VdbeLoadString(v, 3, pIdx->zName);\n          sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7);\n          sqlite3VdbeAddOp2(v, OP_ResultRow, 7, 1);\n        }\n#endif /* SQLITE_OMIT_BTREECOUNT */\n      } \n    }\n    {\n      static const int iLn = VDBE_OFFSET_LINENO(2);\n      static const VdbeOpList endCode[] = {\n        { OP_AddImm,      1, 0,        0},    /* 0 */\n        { OP_If,          1, 4,        0},    /* 1 */\n        { OP_String8,     0, 3,        0},    /* 2 */\n        { OP_ResultRow,   3, 1,        0},    /* 3 */\n      };\n      VdbeOp *aOp;\n\n      aOp = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn);\n      if( aOp ){\n        aOp[0].p2 = -mxErr;\n        aOp[2].p4type = P4_STATIC;\n        aOp[2].p4.z = \"ok\";\n      }\n    }\n  }\n  break;\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\n\n#ifndef SQLITE_OMIT_UTF16\n  /*\n  **   PRAGMA encoding\n  **   PRAGMA encoding = \"utf-8\"|\"utf-16\"|\"utf-16le\"|\"utf-16be\"\n  **\n  ** In its first form, this pragma returns the encoding of the main\n  ** database. If the database is not initialized, it is initialized now.\n  **\n  ** The second form of this pragma is a no-op if the main database file\n  ** has not already been initialized. In this case it sets the default\n  ** encoding that will be used for the main database file if a new file\n  ** is created. If an existing main database file is opened, then the\n  ** default text encoding for the existing database is used.\n  ** \n  ** In all cases new databases created using the ATTACH command are\n  ** created to use the same default text encoding as the main database. If\n  ** the main database has not been initialized and/or created when ATTACH\n  ** is executed, this is done before the ATTACH operation.\n  **\n  ** In the second form this pragma sets the text encoding to be used in\n  ** new database files created using this database handle. It is only\n  ** useful if invoked immediately after the main database i\n  */\n  case PragTyp_ENCODING: {\n    static const struct EncName {\n      char *zName;\n      u8 enc;\n    } encnames[] = {\n      { \"UTF8\",     SQLITE_UTF8        },\n      { \"UTF-8\",    SQLITE_UTF8        },  /* Must be element [1] */\n      { \"UTF-16le\", SQLITE_UTF16LE     },  /* Must be element [2] */\n      { \"UTF-16be\", SQLITE_UTF16BE     },  /* Must be element [3] */\n      { \"UTF16le\",  SQLITE_UTF16LE     },\n      { \"UTF16be\",  SQLITE_UTF16BE     },\n      { \"UTF-16\",   0                  }, /* SQLITE_UTF16NATIVE */\n      { \"UTF16\",    0                  }, /* SQLITE_UTF16NATIVE */\n      { 0, 0 }\n    };\n    const struct EncName *pEnc;\n    if( !zRight ){    /* \"PRAGMA encoding\" */\n      if( sqlite3ReadSchema(pParse) ) goto pragma_out;\n      assert( encnames[SQLITE_UTF8].enc==SQLITE_UTF8 );\n      assert( encnames[SQLITE_UTF16LE].enc==SQLITE_UTF16LE );\n      assert( encnames[SQLITE_UTF16BE].enc==SQLITE_UTF16BE );\n      returnSingleText(v, \"encoding\", encnames[ENC(pParse->db)].zName);\n    }else{                        /* \"PRAGMA encoding = XXX\" */\n      /* Only change the value of sqlite.enc if the database handle is not\n      ** initialized. If the main database exists, the new sqlite.enc value\n      ** will be overwritten when the schema is next loaded. If it does not\n      ** already exists, it will be created to use the new encoding value.\n      */\n      if( \n        !(DbHasProperty(db, 0, DB_SchemaLoaded)) || \n        DbHasProperty(db, 0, DB_Empty) \n      ){\n        for(pEnc=&encnames[0]; pEnc->zName; pEnc++){\n          if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){\n            SCHEMA_ENC(db) = ENC(db) =\n                pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE;\n            break;\n          }\n        }\n        if( !pEnc->zName ){\n          sqlite3ErrorMsg(pParse, \"unsupported encoding: %s\", zRight);\n        }\n      }\n    }\n  }\n  break;\n#endif /* SQLITE_OMIT_UTF16 */\n\n#ifndef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS\n  /*\n  **   PRAGMA [schema.]schema_version\n  **   PRAGMA [schema.]schema_version = <integer>\n  **\n  **   PRAGMA [schema.]user_version\n  **   PRAGMA [schema.]user_version = <integer>\n  **\n  **   PRAGMA [schema.]freelist_count\n  **\n  **   PRAGMA [schema.]data_version\n  **\n  **   PRAGMA [schema.]application_id\n  **   PRAGMA [schema.]application_id = <integer>\n  **\n  ** The pragma's schema_version and user_version are used to set or get\n  ** the value of the schema-version and user-version, respectively. Both\n  ** the schema-version and the user-version are 32-bit signed integers\n  ** stored in the database header.\n  **\n  ** The schema-cookie is usually only manipulated internally by SQLite. It\n  ** is incremented by SQLite whenever the database schema is modified (by\n  ** creating or dropping a table or index). The schema version is used by\n  ** SQLite each time a query is executed to ensure that the internal cache\n  ** of the schema used when compiling the SQL query matches the schema of\n  ** the database against which the compiled query is actually executed.\n  ** Subverting this mechanism by using \"PRAGMA schema_version\" to modify\n  ** the schema-version is potentially dangerous and may lead to program\n  ** crashes or database corruption. Use with caution!\n  **\n  ** The user-version is not used internally by SQLite. It may be used by\n  ** applications for any purpose.\n  */\n  case PragTyp_HEADER_VALUE: {\n    int iCookie = pPragma->iArg;  /* Which cookie to read or write */\n    sqlite3VdbeUsesBtree(v, iDb);\n    if( zRight && (pPragma->mPragFlag & PragFlag_ReadOnly)==0 ){\n      /* Write the specified cookie value */\n      static const VdbeOpList setCookie[] = {\n        { OP_Transaction,    0,  1,  0},    /* 0 */\n        { OP_SetCookie,      0,  0,  0},    /* 1 */\n      };\n      VdbeOp *aOp;\n      sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(setCookie));\n      aOp = sqlite3VdbeAddOpList(v, ArraySize(setCookie), setCookie, 0);\n      if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break;\n      aOp[0].p1 = iDb;\n      aOp[1].p1 = iDb;\n      aOp[1].p2 = iCookie;\n      aOp[1].p3 = sqlite3Atoi(zRight);\n    }else{\n      /* Read the specified cookie value */\n      static const VdbeOpList readCookie[] = {\n        { OP_Transaction,     0,  0,  0},    /* 0 */\n        { OP_ReadCookie,      0,  1,  0},    /* 1 */\n        { OP_ResultRow,       1,  1,  0}\n      };\n      VdbeOp *aOp;\n      sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(readCookie));\n      aOp = sqlite3VdbeAddOpList(v, ArraySize(readCookie),readCookie,0);\n      if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break;\n      aOp[0].p1 = iDb;\n      aOp[1].p1 = iDb;\n      aOp[1].p3 = iCookie;\n      sqlite3VdbeSetNumCols(v, 1);\n      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);\n      sqlite3VdbeReusable(v);\n    }\n  }\n  break;\n#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */\n\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\n  /*\n  **   PRAGMA compile_options\n  **\n  ** Return the names of all compile-time options used in this build,\n  ** one option per row.\n  */\n  case PragTyp_COMPILE_OPTIONS: {\n    int i = 0;\n    const char *zOpt;\n    pParse->nMem = 1;\n    setOneColumnName(v, \"compile_option\");\n    while( (zOpt = sqlite3_compileoption_get(i++))!=0 ){\n      sqlite3VdbeLoadString(v, 1, zOpt);\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);\n    }\n    sqlite3VdbeReusable(v);\n  }\n  break;\n#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */\n\n#ifndef SQLITE_OMIT_WAL\n  /*\n  **   PRAGMA [schema.]wal_checkpoint = passive|full|restart|truncate\n  **\n  ** Checkpoint the database.\n  */\n  case PragTyp_WAL_CHECKPOINT: {\n    static const char *azCol[] = { \"busy\", \"log\", \"checkpointed\" };\n    int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);\n    int eMode = SQLITE_CHECKPOINT_PASSIVE;\n    if( zRight ){\n      if( sqlite3StrICmp(zRight, \"full\")==0 ){\n        eMode = SQLITE_CHECKPOINT_FULL;\n      }else if( sqlite3StrICmp(zRight, \"restart\")==0 ){\n        eMode = SQLITE_CHECKPOINT_RESTART;\n      }else if( sqlite3StrICmp(zRight, \"truncate\")==0 ){\n        eMode = SQLITE_CHECKPOINT_TRUNCATE;\n      }\n    }\n    setAllColumnNames(v, 3, azCol);  assert( 3==ArraySize(azCol) );\n    pParse->nMem = 3;\n    sqlite3VdbeAddOp3(v, OP_Checkpoint, iBt, eMode, 1);\n    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);\n  }\n  break;\n\n  /*\n  **   PRAGMA wal_autocheckpoint\n  **   PRAGMA wal_autocheckpoint = N\n  **\n  ** Configure a database connection to automatically checkpoint a database\n  ** after accumulating N frames in the log. Or query for the current value\n  ** of N.\n  */\n  case PragTyp_WAL_AUTOCHECKPOINT: {\n    if( zRight ){\n      sqlite3_wal_autocheckpoint(db, sqlite3Atoi(zRight));\n    }\n    returnSingleInt(v, \"wal_autocheckpoint\", \n       db->xWalCallback==sqlite3WalDefaultHook ? \n           SQLITE_PTR_TO_INT(db->pWalArg) : 0);\n  }\n  break;\n#endif\n\n  /*\n  **  PRAGMA shrink_memory\n  **\n  ** IMPLEMENTATION-OF: R-23445-46109 This pragma causes the database\n  ** connection on which it is invoked to free up as much memory as it\n  ** can, by calling sqlite3_db_release_memory().\n  */\n  case PragTyp_SHRINK_MEMORY: {\n    sqlite3_db_release_memory(db);\n    break;\n  }\n\n  /*\n  **   PRAGMA busy_timeout\n  **   PRAGMA busy_timeout = N\n  **\n  ** Call sqlite3_busy_timeout(db, N).  Return the current timeout value\n  ** if one is set.  If no busy handler or a different busy handler is set\n  ** then 0 is returned.  Setting the busy_timeout to 0 or negative\n  ** disables the timeout.\n  */\n  /*case PragTyp_BUSY_TIMEOUT*/ default: {\n    assert( pPragma->ePragTyp==PragTyp_BUSY_TIMEOUT );\n    if( zRight ){\n      sqlite3_busy_timeout(db, sqlite3Atoi(zRight));\n    }\n    returnSingleInt(v, \"timeout\",  db->busyTimeout);\n    break;\n  }\n\n  /*\n  **   PRAGMA soft_heap_limit\n  **   PRAGMA soft_heap_limit = N\n  **\n  ** IMPLEMENTATION-OF: R-26343-45930 This pragma invokes the\n  ** sqlite3_soft_heap_limit64() interface with the argument N, if N is\n  ** specified and is a non-negative integer.\n  ** IMPLEMENTATION-OF: R-64451-07163 The soft_heap_limit pragma always\n  ** returns the same integer that would be returned by the\n  ** sqlite3_soft_heap_limit64(-1) C-language function.\n  */\n  case PragTyp_SOFT_HEAP_LIMIT: {\n    sqlite3_int64 N;\n    if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){\n      sqlite3_soft_heap_limit64(N);\n    }\n    returnSingleInt(v, \"soft_heap_limit\",  sqlite3_soft_heap_limit64(-1));\n    break;\n  }\n\n  /*\n  **   PRAGMA threads\n  **   PRAGMA threads = N\n  **\n  ** Configure the maximum number of worker threads.  Return the new\n  ** maximum, which might be less than requested.\n  */\n  case PragTyp_THREADS: {\n    sqlite3_int64 N;\n    if( zRight\n     && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK\n     && N>=0\n    ){\n      sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, (int)(N&0x7fffffff));\n    }\n    returnSingleInt(v, \"threads\",\n                    sqlite3_limit(db, SQLITE_LIMIT_WORKER_THREADS, -1));\n    break;\n  }\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)\n  /*\n  ** Report the current state of file logs for all databases\n  */\n  case PragTyp_LOCK_STATUS: {\n    static const char *const azLockName[] = {\n      \"unlocked\", \"shared\", \"reserved\", \"pending\", \"exclusive\"\n    };\n    static const char *azCol[] = { \"database\", \"status\" };\n    int i;\n    setAllColumnNames(v, 2, azCol); assert( 2==ArraySize(azCol) );\n    pParse->nMem = 2;\n    for(i=0; i<db->nDb; i++){\n      Btree *pBt;\n      const char *zState = \"unknown\";\n      int j;\n      if( db->aDb[i].zDbSName==0 ) continue;\n      pBt = db->aDb[i].pBt;\n      if( pBt==0 || sqlite3BtreePager(pBt)==0 ){\n        zState = \"closed\";\n      }else if( sqlite3_file_control(db, i ? db->aDb[i].zDbSName : 0, \n                                     SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){\n         zState = azLockName[j];\n      }\n      sqlite3VdbeMultiLoad(v, 1, \"ss\", db->aDb[i].zDbSName, zState);\n      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);\n    }\n    break;\n  }\n#endif\n\n#ifdef SQLITE_HAS_CODEC\n  case PragTyp_KEY: {\n    if( zRight ) sqlite3_key_v2(db, zDb, zRight, sqlite3Strlen30(zRight));\n    break;\n  }\n  case PragTyp_REKEY: {\n    if( zRight ) sqlite3_rekey_v2(db, zDb, zRight, sqlite3Strlen30(zRight));\n    break;\n  }\n  case PragTyp_HEXKEY: {\n    if( zRight ){\n      u8 iByte;\n      int i;\n      char zKey[40];\n      for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zRight[i]); i++){\n        iByte = (iByte<<4) + sqlite3HexToInt(zRight[i]);\n        if( (i&1)!=0 ) zKey[i/2] = iByte;\n      }\n      if( (zLeft[3] & 0xf)==0xb ){\n        sqlite3_key_v2(db, zDb, zKey, i/2);\n      }else{\n        sqlite3_rekey_v2(db, zDb, zKey, i/2);\n      }\n    }\n    break;\n  }\n#endif\n#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)\n  case PragTyp_ACTIVATE_EXTENSIONS: if( zRight ){\n#ifdef SQLITE_HAS_CODEC\n    if( sqlite3StrNICmp(zRight, \"see-\", 4)==0 ){\n      sqlite3_activate_see(&zRight[4]);\n    }\n#endif\n#ifdef SQLITE_ENABLE_CEROD\n    if( sqlite3StrNICmp(zRight, \"cerod-\", 6)==0 ){\n      sqlite3_activate_cerod(&zRight[6]);\n    }\n#endif\n  }\n  break;\n#endif\n\n  } /* End of the PRAGMA switch */\n\npragma_out:\n  sqlite3DbFree(db, zLeft);\n  sqlite3DbFree(db, zRight);\n}\n\n#endif /* SQLITE_OMIT_PRAGMA */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/pragma.h",
    "content": "/* DO NOT EDIT!\n** This file is automatically generated by the script at\n** ../tool/mkpragmatab.tcl.  To update the set of pragmas, edit\n** that script and rerun it.\n*/\n#define PragTyp_HEADER_VALUE                   0\n#define PragTyp_AUTO_VACUUM                    1\n#define PragTyp_FLAG                           2\n#define PragTyp_BUSY_TIMEOUT                   3\n#define PragTyp_CACHE_SIZE                     4\n#define PragTyp_CACHE_SPILL                    5\n#define PragTyp_CASE_SENSITIVE_LIKE            6\n#define PragTyp_COLLATION_LIST                 7\n#define PragTyp_COMPILE_OPTIONS                8\n#define PragTyp_DATA_STORE_DIRECTORY           9\n#define PragTyp_DATABASE_LIST                 10\n#define PragTyp_DEFAULT_CACHE_SIZE            11\n#define PragTyp_ENCODING                      12\n#define PragTyp_FOREIGN_KEY_CHECK             13\n#define PragTyp_FOREIGN_KEY_LIST              14\n#define PragTyp_INCREMENTAL_VACUUM            15\n#define PragTyp_INDEX_INFO                    16\n#define PragTyp_INDEX_LIST                    17\n#define PragTyp_INTEGRITY_CHECK               18\n#define PragTyp_JOURNAL_MODE                  19\n#define PragTyp_JOURNAL_SIZE_LIMIT            20\n#define PragTyp_LOCK_PROXY_FILE               21\n#define PragTyp_LOCKING_MODE                  22\n#define PragTyp_PAGE_COUNT                    23\n#define PragTyp_MMAP_SIZE                     24\n#define PragTyp_PAGE_SIZE                     25\n#define PragTyp_SECURE_DELETE                 26\n#define PragTyp_SHRINK_MEMORY                 27\n#define PragTyp_SOFT_HEAP_LIMIT               28\n#define PragTyp_STATS                         29\n#define PragTyp_SYNCHRONOUS                   30\n#define PragTyp_TABLE_INFO                    31\n#define PragTyp_TEMP_STORE                    32\n#define PragTyp_TEMP_STORE_DIRECTORY          33\n#define PragTyp_THREADS                       34\n#define PragTyp_WAL_AUTOCHECKPOINT            35\n#define PragTyp_WAL_CHECKPOINT                36\n#define PragTyp_ACTIVATE_EXTENSIONS           37\n#define PragTyp_HEXKEY                        38\n#define PragTyp_KEY                           39\n#define PragTyp_REKEY                         40\n#define PragTyp_LOCK_STATUS                   41\n#define PragTyp_PARSER_TRACE                  42\n#define PragFlag_NeedSchema           0x01\n#define PragFlag_ReadOnly             0x02\nstatic const struct sPragmaNames {\n  const char *const zName;  /* Name of pragma */\n  u8 ePragTyp;              /* PragTyp_XXX value */\n  u8 mPragFlag;             /* Zero or more PragFlag_XXX values */\n  u32 iArg;                 /* Extra argument */\n} aPragmaNames[] = {\n#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD)\n  { /* zName:     */ \"activate_extensions\",\n    /* ePragTyp:  */ PragTyp_ACTIVATE_EXTENSIONS,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)\n  { /* zName:     */ \"application_id\",\n    /* ePragTyp:  */ PragTyp_HEADER_VALUE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ BTREE_APPLICATION_ID },\n#endif\n#if !defined(SQLITE_OMIT_AUTOVACUUM)\n  { /* zName:     */ \"auto_vacuum\",\n    /* ePragTyp:  */ PragTyp_AUTO_VACUUM,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n#if !defined(SQLITE_OMIT_AUTOMATIC_INDEX)\n  { /* zName:     */ \"automatic_index\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_AutoIndex },\n#endif\n#endif\n  { /* zName:     */ \"busy_timeout\",\n    /* ePragTyp:  */ PragTyp_BUSY_TIMEOUT,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\n  { /* zName:     */ \"cache_size\",\n    /* ePragTyp:  */ PragTyp_CACHE_SIZE,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"cache_spill\",\n    /* ePragTyp:  */ PragTyp_CACHE_SPILL,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n  { /* zName:     */ \"case_sensitive_like\",\n    /* ePragTyp:  */ PragTyp_CASE_SENSITIVE_LIKE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"cell_size_check\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_CellSizeCk },\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"checkpoint_fullfsync\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_CkptFullFSync },\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)\n  { /* zName:     */ \"collation_list\",\n    /* ePragTyp:  */ PragTyp_COLLATION_LIST,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)\n  { /* zName:     */ \"compile_options\",\n    /* ePragTyp:  */ PragTyp_COMPILE_OPTIONS,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"count_changes\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_CountRows },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN\n  { /* zName:     */ \"data_store_directory\",\n    /* ePragTyp:  */ PragTyp_DATA_STORE_DIRECTORY,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)\n  { /* zName:     */ \"data_version\",\n    /* ePragTyp:  */ PragTyp_HEADER_VALUE,\n    /* ePragFlag: */ PragFlag_ReadOnly,\n    /* iArg:      */ BTREE_DATA_VERSION },\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)\n  { /* zName:     */ \"database_list\",\n    /* ePragTyp:  */ PragTyp_DATABASE_LIST,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)\n  { /* zName:     */ \"default_cache_size\",\n    /* ePragTyp:  */ PragTyp_DEFAULT_CACHE_SIZE,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\n  { /* zName:     */ \"defer_foreign_keys\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_DeferFKs },\n#endif\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"empty_result_callbacks\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_NullCallback },\n#endif\n#if !defined(SQLITE_OMIT_UTF16)\n  { /* zName:     */ \"encoding\",\n    /* ePragTyp:  */ PragTyp_ENCODING,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\n  { /* zName:     */ \"foreign_key_check\",\n    /* ePragTyp:  */ PragTyp_FOREIGN_KEY_CHECK,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FOREIGN_KEY)\n  { /* zName:     */ \"foreign_key_list\",\n    /* ePragTyp:  */ PragTyp_FOREIGN_KEY_LIST,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\n  { /* zName:     */ \"foreign_keys\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_ForeignKeys },\n#endif\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)\n  { /* zName:     */ \"freelist_count\",\n    /* ePragTyp:  */ PragTyp_HEADER_VALUE,\n    /* ePragFlag: */ PragFlag_ReadOnly,\n    /* iArg:      */ BTREE_FREE_PAGE_COUNT },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"full_column_names\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_FullColNames },\n  { /* zName:     */ \"fullfsync\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_FullFSync },\n#endif\n#if defined(SQLITE_HAS_CODEC)\n  { /* zName:     */ \"hexkey\",\n    /* ePragTyp:  */ PragTyp_HEXKEY,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"hexrekey\",\n    /* ePragTyp:  */ PragTyp_HEXKEY,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n#if !defined(SQLITE_OMIT_CHECK)\n  { /* zName:     */ \"ignore_check_constraints\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_IgnoreChecks },\n#endif\n#endif\n#if !defined(SQLITE_OMIT_AUTOVACUUM)\n  { /* zName:     */ \"incremental_vacuum\",\n    /* ePragTyp:  */ PragTyp_INCREMENTAL_VACUUM,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)\n  { /* zName:     */ \"index_info\",\n    /* ePragTyp:  */ PragTyp_INDEX_INFO,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"index_list\",\n    /* ePragTyp:  */ PragTyp_INDEX_LIST,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"index_xinfo\",\n    /* ePragTyp:  */ PragTyp_INDEX_INFO,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 1 },\n#endif\n#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)\n  { /* zName:     */ \"integrity_check\",\n    /* ePragTyp:  */ PragTyp_INTEGRITY_CHECK,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\n  { /* zName:     */ \"journal_mode\",\n    /* ePragTyp:  */ PragTyp_JOURNAL_MODE,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"journal_size_limit\",\n    /* ePragTyp:  */ PragTyp_JOURNAL_SIZE_LIMIT,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if defined(SQLITE_HAS_CODEC)\n  { /* zName:     */ \"key\",\n    /* ePragTyp:  */ PragTyp_KEY,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"legacy_file_format\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_LegacyFileFmt },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE\n  { /* zName:     */ \"lock_proxy_file\",\n    /* ePragTyp:  */ PragTyp_LOCK_PROXY_FILE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)\n  { /* zName:     */ \"lock_status\",\n    /* ePragTyp:  */ PragTyp_LOCK_STATUS,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\n  { /* zName:     */ \"locking_mode\",\n    /* ePragTyp:  */ PragTyp_LOCKING_MODE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"max_page_count\",\n    /* ePragTyp:  */ PragTyp_PAGE_COUNT,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"mmap_size\",\n    /* ePragTyp:  */ PragTyp_MMAP_SIZE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"page_count\",\n    /* ePragTyp:  */ PragTyp_PAGE_COUNT,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"page_size\",\n    /* ePragTyp:  */ PragTyp_PAGE_SIZE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)\n  { /* zName:     */ \"parser_trace\",\n    /* ePragTyp:  */ PragTyp_PARSER_TRACE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"query_only\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_QueryOnly },\n#endif\n#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)\n  { /* zName:     */ \"quick_check\",\n    /* ePragTyp:  */ PragTyp_INTEGRITY_CHECK,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"read_uncommitted\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_ReadUncommitted },\n  { /* zName:     */ \"recursive_triggers\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_RecTriggers },\n#endif\n#if defined(SQLITE_HAS_CODEC)\n  { /* zName:     */ \"rekey\",\n    /* ePragTyp:  */ PragTyp_REKEY,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"reverse_unordered_selects\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_ReverseOrder },\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)\n  { /* zName:     */ \"schema_version\",\n    /* ePragTyp:  */ PragTyp_HEADER_VALUE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ BTREE_SCHEMA_VERSION },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\n  { /* zName:     */ \"secure_delete\",\n    /* ePragTyp:  */ PragTyp_SECURE_DELETE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"short_column_names\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_ShortColNames },\n#endif\n  { /* zName:     */ \"shrink_memory\",\n    /* ePragTyp:  */ PragTyp_SHRINK_MEMORY,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"soft_heap_limit\",\n    /* ePragTyp:  */ PragTyp_SOFT_HEAP_LIMIT,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n#if defined(SQLITE_DEBUG)\n  { /* zName:     */ \"sql_trace\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_SqlTrace },\n#endif\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)\n  { /* zName:     */ \"stats\",\n    /* ePragTyp:  */ PragTyp_STATS,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\n  { /* zName:     */ \"synchronous\",\n    /* ePragTyp:  */ PragTyp_SYNCHRONOUS,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)\n  { /* zName:     */ \"table_info\",\n    /* ePragTyp:  */ PragTyp_TABLE_INFO,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)\n  { /* zName:     */ \"temp_store\",\n    /* ePragTyp:  */ PragTyp_TEMP_STORE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"temp_store_directory\",\n    /* ePragTyp:  */ PragTyp_TEMP_STORE_DIRECTORY,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#endif\n  { /* zName:     */ \"threads\",\n    /* ePragTyp:  */ PragTyp_THREADS,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)\n  { /* zName:     */ \"user_version\",\n    /* ePragTyp:  */ PragTyp_HEADER_VALUE,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ BTREE_USER_VERSION },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n#if defined(SQLITE_DEBUG)\n  { /* zName:     */ \"vdbe_addoptrace\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_VdbeAddopTrace },\n  { /* zName:     */ \"vdbe_debug\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace },\n  { /* zName:     */ \"vdbe_eqp\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_VdbeEQP },\n  { /* zName:     */ \"vdbe_listing\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_VdbeListing },\n  { /* zName:     */ \"vdbe_trace\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_VdbeTrace },\n#endif\n#endif\n#if !defined(SQLITE_OMIT_WAL)\n  { /* zName:     */ \"wal_autocheckpoint\",\n    /* ePragTyp:  */ PragTyp_WAL_AUTOCHECKPOINT,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ 0 },\n  { /* zName:     */ \"wal_checkpoint\",\n    /* ePragTyp:  */ PragTyp_WAL_CHECKPOINT,\n    /* ePragFlag: */ PragFlag_NeedSchema,\n    /* iArg:      */ 0 },\n#endif\n#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)\n  { /* zName:     */ \"writable_schema\",\n    /* ePragTyp:  */ PragTyp_FLAG,\n    /* ePragFlag: */ 0,\n    /* iArg:      */ SQLITE_WriteSchema|SQLITE_RecoveryMode },\n#endif\n};\n/* Number of pragmas: 60 on by default, 73 total. */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/prepare.c",
    "content": "/*\n** 2005 May 25\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the implementation of the sqlite3_prepare()\n** interface, and routines that contribute to loading the database schema\n** from disk.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** Fill the InitData structure with an error message that indicates\n** that the database is corrupt.\n*/\nstatic void corruptSchema(\n  InitData *pData,     /* Initialization context */\n  const char *zObj,    /* Object being parsed at the point of error */\n  const char *zExtra   /* Error information */\n){\n  sqlite3 *db = pData->db;\n  if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){\n    char *z;\n    if( zObj==0 ) zObj = \"?\";\n    z = sqlite3MPrintf(db, \"malformed database schema (%s)\", zObj);\n    if( zExtra ) z = sqlite3MPrintf(db, \"%z - %s\", z, zExtra);\n    sqlite3DbFree(db, *pData->pzErrMsg);\n    *pData->pzErrMsg = z;\n  }\n  pData->rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_CORRUPT_BKPT;\n}\n\n/*\n** This is the callback routine for the code that initializes the\n** database.  See sqlite3Init() below for additional information.\n** This routine is also called from the OP_ParseSchema opcode of the VDBE.\n**\n** Each callback contains the following information:\n**\n**     argv[0] = name of thing being created\n**     argv[1] = root page number for table or index. 0 for trigger or view.\n**     argv[2] = SQL text for the CREATE statement.\n**\n*/\nint sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){\n  InitData *pData = (InitData*)pInit;\n  sqlite3 *db = pData->db;\n  int iDb = pData->iDb;\n\n  assert( argc==3 );\n  UNUSED_PARAMETER2(NotUsed, argc);\n  assert( sqlite3_mutex_held(db->mutex) );\n  DbClearProperty(db, iDb, DB_Empty);\n  if( db->mallocFailed ){\n    corruptSchema(pData, argv[0], 0);\n    return 1;\n  }\n\n  assert( iDb>=0 && iDb<db->nDb );\n  if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */\n  if( argv[1]==0 ){\n    corruptSchema(pData, argv[0], 0);\n  }else if( sqlite3_strnicmp(argv[2],\"create \",7)==0 ){\n    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.\n    ** But because db->init.busy is set to 1, no VDBE code is generated\n    ** or executed.  All the parser does is build the internal data\n    ** structures that describe the table, index, or view.\n    */\n    int rc;\n    u8 saved_iDb = db->init.iDb;\n    sqlite3_stmt *pStmt;\n    TESTONLY(int rcp);            /* Return code from sqlite3_prepare() */\n\n    assert( db->init.busy );\n    db->init.iDb = iDb;\n    db->init.newTnum = sqlite3Atoi(argv[1]);\n    db->init.orphanTrigger = 0;\n    TESTONLY(rcp = ) sqlite3_prepare(db, argv[2], -1, &pStmt, 0);\n    rc = db->errCode;\n    assert( (rc&0xFF)==(rcp&0xFF) );\n    db->init.iDb = saved_iDb;\n    assert( saved_iDb==0 || (db->flags & SQLITE_Vacuum)!=0 );\n    if( SQLITE_OK!=rc ){\n      if( db->init.orphanTrigger ){\n        assert( iDb==1 );\n      }else{\n        pData->rc = rc;\n        if( rc==SQLITE_NOMEM ){\n          sqlite3OomFault(db);\n        }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){\n          corruptSchema(pData, argv[0], sqlite3_errmsg(db));\n        }\n      }\n    }\n    sqlite3_finalize(pStmt);\n  }else if( argv[0]==0 || (argv[2]!=0 && argv[2][0]!=0) ){\n    corruptSchema(pData, argv[0], 0);\n  }else{\n    /* If the SQL column is blank it means this is an index that\n    ** was created to be the PRIMARY KEY or to fulfill a UNIQUE\n    ** constraint for a CREATE TABLE.  The index should have already\n    ** been created when we processed the CREATE TABLE.  All we have\n    ** to do here is record the root page number for that index.\n    */\n    Index *pIndex;\n    pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zDbSName);\n    if( pIndex==0 ){\n      /* This can occur if there exists an index on a TEMP table which\n      ** has the same name as another index on a permanent index.  Since\n      ** the permanent table is hidden by the TEMP table, we can also\n      ** safely ignore the index on the permanent table.\n      */\n      /* Do Nothing */;\n    }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){\n      corruptSchema(pData, argv[0], \"invalid rootpage\");\n    }\n  }\n  return 0;\n}\n\n/*\n** Attempt to read the database schema and initialize internal\n** data structures for a single database file.  The index of the\n** database file is given by iDb.  iDb==0 is used for the main\n** database.  iDb==1 should never be used.  iDb>=2 is used for\n** auxiliary databases.  Return one of the SQLITE_ error codes to\n** indicate success or failure.\n*/\nstatic int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){\n  int rc;\n  int i;\n#ifndef SQLITE_OMIT_DEPRECATED\n  int size;\n#endif\n  Db *pDb;\n  char const *azArg[4];\n  int meta[5];\n  InitData initData;\n  const char *zMasterName;\n  int openedTransaction = 0;\n\n  assert( iDb>=0 && iDb<db->nDb );\n  assert( db->aDb[iDb].pSchema );\n  assert( sqlite3_mutex_held(db->mutex) );\n  assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );\n\n  /* Construct the in-memory representation schema tables (sqlite_master or\n  ** sqlite_temp_master) by invoking the parser directly.  The appropriate\n  ** table name will be inserted automatically by the parser so we can just\n  ** use the abbreviation \"x\" here.  The parser will also automatically tag\n  ** the schema table as read-only. */\n  azArg[0] = zMasterName = SCHEMA_TABLE(iDb);\n  azArg[1] = \"1\";\n  azArg[2] = \"CREATE TABLE x(type text,name text,tbl_name text,\"\n                            \"rootpage integer,sql text)\";\n  azArg[3] = 0;\n  initData.db = db;\n  initData.iDb = iDb;\n  initData.rc = SQLITE_OK;\n  initData.pzErrMsg = pzErrMsg;\n  sqlite3InitCallback(&initData, 3, (char **)azArg, 0);\n  if( initData.rc ){\n    rc = initData.rc;\n    goto error_out;\n  }\n\n  /* Create a cursor to hold the database open\n  */\n  pDb = &db->aDb[iDb];\n  if( pDb->pBt==0 ){\n    if( !OMIT_TEMPDB && ALWAYS(iDb==1) ){\n      DbSetProperty(db, 1, DB_SchemaLoaded);\n    }\n    return SQLITE_OK;\n  }\n\n  /* If there is not already a read-only (or read-write) transaction opened\n  ** on the b-tree database, open one now. If a transaction is opened, it \n  ** will be closed before this function returns.  */\n  sqlite3BtreeEnter(pDb->pBt);\n  if( !sqlite3BtreeIsInReadTrans(pDb->pBt) ){\n    rc = sqlite3BtreeBeginTrans(pDb->pBt, 0);\n    if( rc!=SQLITE_OK ){\n      sqlite3SetString(pzErrMsg, db, sqlite3ErrStr(rc));\n      goto initone_error_out;\n    }\n    openedTransaction = 1;\n  }\n\n  /* Get the database meta information.\n  **\n  ** Meta values are as follows:\n  **    meta[0]   Schema cookie.  Changes with each schema change.\n  **    meta[1]   File format of schema layer.\n  **    meta[2]   Size of the page cache.\n  **    meta[3]   Largest rootpage (auto/incr_vacuum mode)\n  **    meta[4]   Db text encoding. 1:UTF-8 2:UTF-16LE 3:UTF-16BE\n  **    meta[5]   User version\n  **    meta[6]   Incremental vacuum mode\n  **    meta[7]   unused\n  **    meta[8]   unused\n  **    meta[9]   unused\n  **\n  ** Note: The #defined SQLITE_UTF* symbols in sqliteInt.h correspond to\n  ** the possible values of meta[4].\n  */\n  for(i=0; i<ArraySize(meta); i++){\n    sqlite3BtreeGetMeta(pDb->pBt, i+1, (u32 *)&meta[i]);\n  }\n  pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];\n\n  /* If opening a non-empty database, check the text encoding. For the\n  ** main database, set sqlite3.enc to the encoding of the main database.\n  ** For an attached db, it is an error if the encoding is not the same\n  ** as sqlite3.enc.\n  */\n  if( meta[BTREE_TEXT_ENCODING-1] ){  /* text encoding */\n    if( iDb==0 ){\n#ifndef SQLITE_OMIT_UTF16\n      u8 encoding;\n      /* If opening the main database, set ENC(db). */\n      encoding = (u8)meta[BTREE_TEXT_ENCODING-1] & 3;\n      if( encoding==0 ) encoding = SQLITE_UTF8;\n      ENC(db) = encoding;\n#else\n      ENC(db) = SQLITE_UTF8;\n#endif\n    }else{\n      /* If opening an attached database, the encoding much match ENC(db) */\n      if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){\n        sqlite3SetString(pzErrMsg, db, \"attached databases must use the same\"\n            \" text encoding as main database\");\n        rc = SQLITE_ERROR;\n        goto initone_error_out;\n      }\n    }\n  }else{\n    DbSetProperty(db, iDb, DB_Empty);\n  }\n  pDb->pSchema->enc = ENC(db);\n\n  if( pDb->pSchema->cache_size==0 ){\n#ifndef SQLITE_OMIT_DEPRECATED\n    size = sqlite3AbsInt32(meta[BTREE_DEFAULT_CACHE_SIZE-1]);\n    if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }\n    pDb->pSchema->cache_size = size;\n#else\n    pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;\n#endif\n    sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);\n  }\n\n  /*\n  ** file_format==1    Version 3.0.0.\n  ** file_format==2    Version 3.1.3.  // ALTER TABLE ADD COLUMN\n  ** file_format==3    Version 3.1.4.  // ditto but with non-NULL defaults\n  ** file_format==4    Version 3.3.0.  // DESC indices.  Boolean constants\n  */\n  pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1];\n  if( pDb->pSchema->file_format==0 ){\n    pDb->pSchema->file_format = 1;\n  }\n  if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){\n    sqlite3SetString(pzErrMsg, db, \"unsupported file format\");\n    rc = SQLITE_ERROR;\n    goto initone_error_out;\n  }\n\n  /* Ticket #2804:  When we open a database in the newer file format,\n  ** clear the legacy_file_format pragma flag so that a VACUUM will\n  ** not downgrade the database and thus invalidate any descending\n  ** indices that the user might have created.\n  */\n  if( iDb==0 && meta[BTREE_FILE_FORMAT-1]>=4 ){\n    db->flags &= ~SQLITE_LegacyFileFmt;\n  }\n\n  /* Read the schema information out of the schema tables\n  */\n  assert( db->init.busy );\n  {\n    char *zSql;\n    zSql = sqlite3MPrintf(db, \n        \"SELECT name, rootpage, sql FROM \\\"%w\\\".%s ORDER BY rowid\",\n        db->aDb[iDb].zDbSName, zMasterName);\n#ifndef SQLITE_OMIT_AUTHORIZATION\n    {\n      sqlite3_xauth xAuth;\n      xAuth = db->xAuth;\n      db->xAuth = 0;\n#endif\n      rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);\n#ifndef SQLITE_OMIT_AUTHORIZATION\n      db->xAuth = xAuth;\n    }\n#endif\n    if( rc==SQLITE_OK ) rc = initData.rc;\n    sqlite3DbFree(db, zSql);\n#ifndef SQLITE_OMIT_ANALYZE\n    if( rc==SQLITE_OK ){\n      sqlite3AnalysisLoad(db, iDb);\n    }\n#endif\n  }\n  if( db->mallocFailed ){\n    rc = SQLITE_NOMEM_BKPT;\n    sqlite3ResetAllSchemasOfConnection(db);\n  }\n  if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){\n    /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider\n    ** the schema loaded, even if errors occurred. In this situation the \n    ** current sqlite3_prepare() operation will fail, but the following one\n    ** will attempt to compile the supplied statement against whatever subset\n    ** of the schema was loaded before the error occurred. The primary\n    ** purpose of this is to allow access to the sqlite_master table\n    ** even when its contents have been corrupted.\n    */\n    DbSetProperty(db, iDb, DB_SchemaLoaded);\n    rc = SQLITE_OK;\n  }\n\n  /* Jump here for an error that occurs after successfully allocating\n  ** curMain and calling sqlite3BtreeEnter(). For an error that occurs\n  ** before that point, jump to error_out.\n  */\ninitone_error_out:\n  if( openedTransaction ){\n    sqlite3BtreeCommit(pDb->pBt);\n  }\n  sqlite3BtreeLeave(pDb->pBt);\n\nerror_out:\n  if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){\n    sqlite3OomFault(db);\n  }\n  return rc;\n}\n\n/*\n** Initialize all database files - the main database file, the file\n** used to store temporary tables, and any additional database files\n** created using ATTACH statements.  Return a success code.  If an\n** error occurs, write an error message into *pzErrMsg.\n**\n** After a database is initialized, the DB_SchemaLoaded bit is set\n** bit is set in the flags field of the Db structure. If the database\n** file was of zero-length, then the DB_Empty flag is also set.\n*/\nint sqlite3Init(sqlite3 *db, char **pzErrMsg){\n  int i, rc;\n  int commit_internal = !(db->flags&SQLITE_InternChanges);\n  \n  assert( sqlite3_mutex_held(db->mutex) );\n  assert( sqlite3BtreeHoldsMutex(db->aDb[0].pBt) );\n  assert( db->init.busy==0 );\n  rc = SQLITE_OK;\n  db->init.busy = 1;\n  ENC(db) = SCHEMA_ENC(db);\n  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){\n    if( DbHasProperty(db, i, DB_SchemaLoaded) || i==1 ) continue;\n    rc = sqlite3InitOne(db, i, pzErrMsg);\n    if( rc ){\n      sqlite3ResetOneSchema(db, i);\n    }\n  }\n\n  /* Once all the other databases have been initialized, load the schema\n  ** for the TEMP database. This is loaded last, as the TEMP database\n  ** schema may contain references to objects in other databases.\n  */\n#ifndef SQLITE_OMIT_TEMPDB\n  assert( db->nDb>1 );\n  if( rc==SQLITE_OK && !DbHasProperty(db, 1, DB_SchemaLoaded) ){\n    rc = sqlite3InitOne(db, 1, pzErrMsg);\n    if( rc ){\n      sqlite3ResetOneSchema(db, 1);\n    }\n  }\n#endif\n\n  db->init.busy = 0;\n  if( rc==SQLITE_OK && commit_internal ){\n    sqlite3CommitInternalChanges(db);\n  }\n\n  return rc; \n}\n\n/*\n** This routine is a no-op if the database schema is already initialized.\n** Otherwise, the schema is loaded. An error code is returned.\n*/\nint sqlite3ReadSchema(Parse *pParse){\n  int rc = SQLITE_OK;\n  sqlite3 *db = pParse->db;\n  assert( sqlite3_mutex_held(db->mutex) );\n  if( !db->init.busy ){\n    rc = sqlite3Init(db, &pParse->zErrMsg);\n  }\n  if( rc!=SQLITE_OK ){\n    pParse->rc = rc;\n    pParse->nErr++;\n  }\n  return rc;\n}\n\n\n/*\n** Check schema cookies in all databases.  If any cookie is out\n** of date set pParse->rc to SQLITE_SCHEMA.  If all schema cookies\n** make no changes to pParse->rc.\n*/\nstatic void schemaIsValid(Parse *pParse){\n  sqlite3 *db = pParse->db;\n  int iDb;\n  int rc;\n  int cookie;\n\n  assert( pParse->checkSchema );\n  assert( sqlite3_mutex_held(db->mutex) );\n  for(iDb=0; iDb<db->nDb; iDb++){\n    int openedTransaction = 0;         /* True if a transaction is opened */\n    Btree *pBt = db->aDb[iDb].pBt;     /* Btree database to read cookie from */\n    if( pBt==0 ) continue;\n\n    /* If there is not already a read-only (or read-write) transaction opened\n    ** on the b-tree database, open one now. If a transaction is opened, it \n    ** will be closed immediately after reading the meta-value. */\n    if( !sqlite3BtreeIsInReadTrans(pBt) ){\n      rc = sqlite3BtreeBeginTrans(pBt, 0);\n      if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){\n        sqlite3OomFault(db);\n      }\n      if( rc!=SQLITE_OK ) return;\n      openedTransaction = 1;\n    }\n\n    /* Read the schema cookie from the database. If it does not match the \n    ** value stored as part of the in-memory schema representation,\n    ** set Parse.rc to SQLITE_SCHEMA. */\n    sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie);\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){\n      sqlite3ResetOneSchema(db, iDb);\n      pParse->rc = SQLITE_SCHEMA;\n    }\n\n    /* Close the transaction, if one was opened. */\n    if( openedTransaction ){\n      sqlite3BtreeCommit(pBt);\n    }\n  }\n}\n\n/*\n** Convert a schema pointer into the iDb index that indicates\n** which database file in db->aDb[] the schema refers to.\n**\n** If the same database is attached more than once, the first\n** attached database is returned.\n*/\nint sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){\n  int i = -1000000;\n\n  /* If pSchema is NULL, then return -1000000. This happens when code in \n  ** expr.c is trying to resolve a reference to a transient table (i.e. one\n  ** created by a sub-select). In this case the return value of this \n  ** function should never be used.\n  **\n  ** We return -1000000 instead of the more usual -1 simply because using\n  ** -1000000 as the incorrect index into db->aDb[] is much \n  ** more likely to cause a segfault than -1 (of course there are assert()\n  ** statements too, but it never hurts to play the odds).\n  */\n  assert( sqlite3_mutex_held(db->mutex) );\n  if( pSchema ){\n    for(i=0; ALWAYS(i<db->nDb); i++){\n      if( db->aDb[i].pSchema==pSchema ){\n        break;\n      }\n    }\n    assert( i>=0 && i<db->nDb );\n  }\n  return i;\n}\n\n/*\n** Free all memory allocations in the pParse object\n*/\nvoid sqlite3ParserReset(Parse *pParse){\n  if( pParse ){\n    sqlite3 *db = pParse->db;\n    sqlite3DbFree(db, pParse->aLabel);\n    sqlite3ExprListDelete(db, pParse->pConstExpr);\n    if( db ){\n      assert( db->lookaside.bDisable >= pParse->disableLookaside );\n      db->lookaside.bDisable -= pParse->disableLookaside;\n    }\n    pParse->disableLookaside = 0;\n  }\n}\n\n/*\n** Compile the UTF-8 encoded SQL statement zSql into a statement handle.\n*/\nstatic int sqlite3Prepare(\n  sqlite3 *db,              /* Database handle. */\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\n  int nBytes,               /* Length of zSql in bytes. */\n  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */\n  Vdbe *pReprepare,         /* VM being reprepared */\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\n  const char **pzTail       /* OUT: End of parsed string */\n){\n  char *zErrMsg = 0;        /* Error message */\n  int rc = SQLITE_OK;       /* Result code */\n  int i;                    /* Loop counter */\n  Parse sParse;             /* Parsing context */\n\n  memset(&sParse, 0, PARSE_HDR_SZ);\n  memset(PARSE_TAIL(&sParse), 0, PARSE_TAIL_SZ);\n  sParse.pReprepare = pReprepare;\n  assert( ppStmt && *ppStmt==0 );\n  /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */\n  assert( sqlite3_mutex_held(db->mutex) );\n\n  /* Check to verify that it is possible to get a read lock on all\n  ** database schemas.  The inability to get a read lock indicates that\n  ** some other database connection is holding a write-lock, which in\n  ** turn means that the other connection has made uncommitted changes\n  ** to the schema.\n  **\n  ** Were we to proceed and prepare the statement against the uncommitted\n  ** schema changes and if those schema changes are subsequently rolled\n  ** back and different changes are made in their place, then when this\n  ** prepared statement goes to run the schema cookie would fail to detect\n  ** the schema change.  Disaster would follow.\n  **\n  ** This thread is currently holding mutexes on all Btrees (because\n  ** of the sqlite3BtreeEnterAll() in sqlite3LockAndPrepare()) so it\n  ** is not possible for another thread to start a new schema change\n  ** while this routine is running.  Hence, we do not need to hold \n  ** locks on the schema, we just need to make sure nobody else is \n  ** holding them.\n  **\n  ** Note that setting READ_UNCOMMITTED overrides most lock detection,\n  ** but it does *not* override schema lock detection, so this all still\n  ** works even if READ_UNCOMMITTED is set.\n  */\n  for(i=0; i<db->nDb; i++) {\n    Btree *pBt = db->aDb[i].pBt;\n    if( pBt ){\n      assert( sqlite3BtreeHoldsMutex(pBt) );\n      rc = sqlite3BtreeSchemaLocked(pBt);\n      if( rc ){\n        const char *zDb = db->aDb[i].zDbSName;\n        sqlite3ErrorWithMsg(db, rc, \"database schema is locked: %s\", zDb);\n        testcase( db->flags & SQLITE_ReadUncommitted );\n        goto end_prepare;\n      }\n    }\n  }\n\n  sqlite3VtabUnlockList(db);\n\n  sParse.db = db;\n  if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){\n    char *zSqlCopy;\n    int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];\n    testcase( nBytes==mxLen );\n    testcase( nBytes==mxLen+1 );\n    if( nBytes>mxLen ){\n      sqlite3ErrorWithMsg(db, SQLITE_TOOBIG, \"statement too long\");\n      rc = sqlite3ApiExit(db, SQLITE_TOOBIG);\n      goto end_prepare;\n    }\n    zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);\n    if( zSqlCopy ){\n      sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);\n      sParse.zTail = &zSql[sParse.zTail-zSqlCopy];\n      sqlite3DbFree(db, zSqlCopy);\n    }else{\n      sParse.zTail = &zSql[nBytes];\n    }\n  }else{\n    sqlite3RunParser(&sParse, zSql, &zErrMsg);\n  }\n  assert( 0==sParse.nQueryLoop );\n\n  if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK;\n  if( sParse.checkSchema ){\n    schemaIsValid(&sParse);\n  }\n  if( db->mallocFailed ){\n    sParse.rc = SQLITE_NOMEM_BKPT;\n  }\n  if( pzTail ){\n    *pzTail = sParse.zTail;\n  }\n  rc = sParse.rc;\n\n#ifndef SQLITE_OMIT_EXPLAIN\n  if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){\n    static const char * const azColName[] = {\n       \"addr\", \"opcode\", \"p1\", \"p2\", \"p3\", \"p4\", \"p5\", \"comment\",\n       \"selectid\", \"order\", \"from\", \"detail\"\n    };\n    int iFirst, mx;\n    if( sParse.explain==2 ){\n      sqlite3VdbeSetNumCols(sParse.pVdbe, 4);\n      iFirst = 8;\n      mx = 12;\n    }else{\n      sqlite3VdbeSetNumCols(sParse.pVdbe, 8);\n      iFirst = 0;\n      mx = 8;\n    }\n    for(i=iFirst; i<mx; i++){\n      sqlite3VdbeSetColName(sParse.pVdbe, i-iFirst, COLNAME_NAME,\n                            azColName[i], SQLITE_STATIC);\n    }\n  }\n#endif\n\n  if( db->init.busy==0 ){\n    Vdbe *pVdbe = sParse.pVdbe;\n    sqlite3VdbeSetSql(pVdbe, zSql, (int)(sParse.zTail-zSql), saveSqlFlag);\n  }\n  if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){\n    sqlite3VdbeFinalize(sParse.pVdbe);\n    assert(!(*ppStmt));\n  }else{\n    *ppStmt = (sqlite3_stmt*)sParse.pVdbe;\n  }\n\n  if( zErrMsg ){\n    sqlite3ErrorWithMsg(db, rc, \"%s\", zErrMsg);\n    sqlite3DbFree(db, zErrMsg);\n  }else{\n    sqlite3Error(db, rc);\n  }\n\n  /* Delete any TriggerPrg structures allocated while parsing this statement. */\n  while( sParse.pTriggerPrg ){\n    TriggerPrg *pT = sParse.pTriggerPrg;\n    sParse.pTriggerPrg = pT->pNext;\n    sqlite3DbFree(db, pT);\n  }\n\nend_prepare:\n\n  sqlite3ParserReset(&sParse);\n  rc = sqlite3ApiExit(db, rc);\n  assert( (rc&db->errMask)==rc );\n  return rc;\n}\nstatic int sqlite3LockAndPrepare(\n  sqlite3 *db,              /* Database handle. */\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\n  int nBytes,               /* Length of zSql in bytes. */\n  int saveSqlFlag,          /* True to copy SQL text into the sqlite3_stmt */\n  Vdbe *pOld,               /* VM being reprepared */\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\n  const char **pzTail       /* OUT: End of parsed string */\n){\n  int rc;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  *ppStmt = 0;\n  if( !sqlite3SafetyCheckOk(db)||zSql==0 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n  sqlite3_mutex_enter(db->mutex);\n  sqlite3BtreeEnterAll(db);\n  rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);\n  if( rc==SQLITE_SCHEMA ){\n    sqlite3_finalize(*ppStmt);\n    rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);\n  }\n  sqlite3BtreeLeaveAll(db);\n  sqlite3_mutex_leave(db->mutex);\n  assert( rc==SQLITE_OK || *ppStmt==0 );\n  return rc;\n}\n\n/*\n** Rerun the compilation of a statement after a schema change.\n**\n** If the statement is successfully recompiled, return SQLITE_OK. Otherwise,\n** if the statement cannot be recompiled because another connection has\n** locked the sqlite3_master table, return SQLITE_LOCKED. If any other error\n** occurs, return SQLITE_SCHEMA.\n*/\nint sqlite3Reprepare(Vdbe *p){\n  int rc;\n  sqlite3_stmt *pNew;\n  const char *zSql;\n  sqlite3 *db;\n\n  assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );\n  zSql = sqlite3_sql((sqlite3_stmt *)p);\n  assert( zSql!=0 );  /* Reprepare only called for prepare_v2() statements */\n  db = sqlite3VdbeDb(p);\n  assert( sqlite3_mutex_held(db->mutex) );\n  rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0);\n  if( rc ){\n    if( rc==SQLITE_NOMEM ){\n      sqlite3OomFault(db);\n    }\n    assert( pNew==0 );\n    return rc;\n  }else{\n    assert( pNew!=0 );\n  }\n  sqlite3VdbeSwap((Vdbe*)pNew, p);\n  sqlite3TransferBindings(pNew, (sqlite3_stmt*)p);\n  sqlite3VdbeResetStepResult((Vdbe*)pNew);\n  sqlite3VdbeFinalize((Vdbe*)pNew);\n  return SQLITE_OK;\n}\n\n\n/*\n** Two versions of the official API.  Legacy and new use.  In the legacy\n** version, the original SQL text is not saved in the prepared statement\n** and so if a schema change occurs, SQLITE_SCHEMA is returned by\n** sqlite3_step().  In the new version, the original SQL text is retained\n** and the statement is automatically recompiled if an schema change\n** occurs.\n*/\nint sqlite3_prepare(\n  sqlite3 *db,              /* Database handle. */\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\n  int nBytes,               /* Length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\n  const char **pzTail       /* OUT: End of parsed string */\n){\n  int rc;\n  rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail);\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\n  return rc;\n}\nint sqlite3_prepare_v2(\n  sqlite3 *db,              /* Database handle. */\n  const char *zSql,         /* UTF-8 encoded SQL statement. */\n  int nBytes,               /* Length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\n  const char **pzTail       /* OUT: End of parsed string */\n){\n  int rc;\n  rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail);\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\n  return rc;\n}\n\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** Compile the UTF-16 encoded SQL statement zSql into a statement handle.\n*/\nstatic int sqlite3Prepare16(\n  sqlite3 *db,              /* Database handle. */ \n  const void *zSql,         /* UTF-16 encoded SQL statement. */\n  int nBytes,               /* Length of zSql in bytes. */\n  int saveSqlFlag,          /* True to save SQL text into the sqlite3_stmt */\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\n  const void **pzTail       /* OUT: End of parsed string */\n){\n  /* This function currently works by first transforming the UTF-16\n  ** encoded string to UTF-8, then invoking sqlite3_prepare(). The\n  ** tricky bit is figuring out the pointer to return in *pzTail.\n  */\n  char *zSql8;\n  const char *zTail8 = 0;\n  int rc = SQLITE_OK;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  *ppStmt = 0;\n  if( !sqlite3SafetyCheckOk(db)||zSql==0 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n  if( nBytes>=0 ){\n    int sz;\n    const char *z = (const char*)zSql;\n    for(sz=0; sz<nBytes && (z[sz]!=0 || z[sz+1]!=0); sz += 2){}\n    nBytes = sz;\n  }\n  sqlite3_mutex_enter(db->mutex);\n  zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);\n  if( zSql8 ){\n    rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);\n  }\n\n  if( zTail8 && pzTail ){\n    /* If sqlite3_prepare returns a tail pointer, we calculate the\n    ** equivalent pointer into the UTF-16 string by counting the unicode\n    ** characters between zSql8 and zTail8, and then returning a pointer\n    ** the same number of characters into the UTF-16 string.\n    */\n    int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8));\n    *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);\n  }\n  sqlite3DbFree(db, zSql8); \n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** Two versions of the official API.  Legacy and new use.  In the legacy\n** version, the original SQL text is not saved in the prepared statement\n** and so if a schema change occurs, SQLITE_SCHEMA is returned by\n** sqlite3_step().  In the new version, the original SQL text is retained\n** and the statement is automatically recompiled if an schema change\n** occurs.\n*/\nint sqlite3_prepare16(\n  sqlite3 *db,              /* Database handle. */ \n  const void *zSql,         /* UTF-16 encoded SQL statement. */\n  int nBytes,               /* Length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\n  const void **pzTail       /* OUT: End of parsed string */\n){\n  int rc;\n  rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail);\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\n  return rc;\n}\nint sqlite3_prepare16_v2(\n  sqlite3 *db,              /* Database handle. */ \n  const void *zSql,         /* UTF-16 encoded SQL statement. */\n  int nBytes,               /* Length of zSql in bytes. */\n  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */\n  const void **pzTail       /* OUT: End of parsed string */\n){\n  int rc;\n  rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail);\n  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */\n  return rc;\n}\n\n#endif /* SQLITE_OMIT_UTF16 */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/printf.c",
    "content": "/*\n** The \"printf\" code that follows dates from the 1980's.  It is in\n** the public domain. \n**\n**************************************************************************\n**\n** This file contains code for a set of \"printf\"-like routines.  These\n** routines format strings much like the printf() from the standard C\n** library, though the implementation here has enhancements to support\n** SQLite.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** Conversion types fall into various categories as defined by the\n** following enumeration.\n*/\n#define etRADIX       0 /* Integer types.  %d, %x, %o, and so forth */\n#define etFLOAT       1 /* Floating point.  %f */\n#define etEXP         2 /* Exponentional notation. %e and %E */\n#define etGENERIC     3 /* Floating or exponential, depending on exponent. %g */\n#define etSIZE        4 /* Return number of characters processed so far. %n */\n#define etSTRING      5 /* Strings. %s */\n#define etDYNSTRING   6 /* Dynamically allocated strings. %z */\n#define etPERCENT     7 /* Percent symbol. %% */\n#define etCHARX       8 /* Characters. %c */\n/* The rest are extensions, not normally found in printf() */\n#define etSQLESCAPE   9 /* Strings with '\\'' doubled.  %q */\n#define etSQLESCAPE2 10 /* Strings with '\\'' doubled and enclosed in '',\n                          NULL pointers replaced by SQL NULL.  %Q */\n#define etTOKEN      11 /* a pointer to a Token structure */\n#define etSRCLIST    12 /* a pointer to a SrcList */\n#define etPOINTER    13 /* The %p conversion */\n#define etSQLESCAPE3 14 /* %w -> Strings with '\\\"' doubled */\n#define etORDINAL    15 /* %r -> 1st, 2nd, 3rd, 4th, etc.  English only */\n\n#define etINVALID    16 /* Any unrecognized conversion type */\n\n\n/*\n** An \"etByte\" is an 8-bit unsigned value.\n*/\ntypedef unsigned char etByte;\n\n/*\n** Each builtin conversion character (ex: the 'd' in \"%d\") is described\n** by an instance of the following structure\n*/\ntypedef struct et_info {   /* Information about each format field */\n  char fmttype;            /* The format field code letter */\n  etByte base;             /* The base for radix conversion */\n  etByte flags;            /* One or more of FLAG_ constants below */\n  etByte type;             /* Conversion paradigm */\n  etByte charset;          /* Offset into aDigits[] of the digits string */\n  etByte prefix;           /* Offset into aPrefix[] of the prefix string */\n} et_info;\n\n/*\n** Allowed values for et_info.flags\n*/\n#define FLAG_SIGNED  1     /* True if the value to convert is signed */\n#define FLAG_INTERN  2     /* True if for internal use only */\n#define FLAG_STRING  4     /* Allow infinity precision */\n\n\n/*\n** The following table is searched linearly, so it is good to put the\n** most frequently used conversion types first.\n*/\nstatic const char aDigits[] = \"0123456789ABCDEF0123456789abcdef\";\nstatic const char aPrefix[] = \"-x0\\000X0\";\nstatic const et_info fmtinfo[] = {\n  {  'd', 10, 1, etRADIX,      0,  0 },\n  {  's',  0, 4, etSTRING,     0,  0 },\n  {  'g',  0, 1, etGENERIC,    30, 0 },\n  {  'z',  0, 4, etDYNSTRING,  0,  0 },\n  {  'q',  0, 4, etSQLESCAPE,  0,  0 },\n  {  'Q',  0, 4, etSQLESCAPE2, 0,  0 },\n  {  'w',  0, 4, etSQLESCAPE3, 0,  0 },\n  {  'c',  0, 0, etCHARX,      0,  0 },\n  {  'o',  8, 0, etRADIX,      0,  2 },\n  {  'u', 10, 0, etRADIX,      0,  0 },\n  {  'x', 16, 0, etRADIX,      16, 1 },\n  {  'X', 16, 0, etRADIX,      0,  4 },\n#ifndef SQLITE_OMIT_FLOATING_POINT\n  {  'f',  0, 1, etFLOAT,      0,  0 },\n  {  'e',  0, 1, etEXP,        30, 0 },\n  {  'E',  0, 1, etEXP,        14, 0 },\n  {  'G',  0, 1, etGENERIC,    14, 0 },\n#endif\n  {  'i', 10, 1, etRADIX,      0,  0 },\n  {  'n',  0, 0, etSIZE,       0,  0 },\n  {  '%',  0, 0, etPERCENT,    0,  0 },\n  {  'p', 16, 0, etPOINTER,    0,  1 },\n\n/* All the rest have the FLAG_INTERN bit set and are thus for internal\n** use only */\n  {  'T',  0, 2, etTOKEN,      0,  0 },\n  {  'S',  0, 2, etSRCLIST,    0,  0 },\n  {  'r', 10, 3, etORDINAL,    0,  0 },\n};\n\n/*\n** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point\n** conversions will work.\n*/\n#ifndef SQLITE_OMIT_FLOATING_POINT\n/*\n** \"*val\" is a double such that 0.1 <= *val < 10.0\n** Return the ascii code for the leading digit of *val, then\n** multiply \"*val\" by 10.0 to renormalize.\n**\n** Example:\n**     input:     *val = 3.14159\n**     output:    *val = 1.4159    function return = '3'\n**\n** The counter *cnt is incremented each time.  After counter exceeds\n** 16 (the number of significant digits in a 64-bit float) '0' is\n** always returned.\n*/\nstatic char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){\n  int digit;\n  LONGDOUBLE_TYPE d;\n  if( (*cnt)<=0 ) return '0';\n  (*cnt)--;\n  digit = (int)*val;\n  d = digit;\n  digit += '0';\n  *val = (*val - d)*10.0;\n  return (char)digit;\n}\n#endif /* SQLITE_OMIT_FLOATING_POINT */\n\n/*\n** Set the StrAccum object to an error mode.\n*/\nstatic void setStrAccumError(StrAccum *p, u8 eError){\n  assert( eError==STRACCUM_NOMEM || eError==STRACCUM_TOOBIG );\n  p->accError = eError;\n  p->nAlloc = 0;\n}\n\n/*\n** Extra argument values from a PrintfArguments object\n*/\nstatic sqlite3_int64 getIntArg(PrintfArguments *p){\n  if( p->nArg<=p->nUsed ) return 0;\n  return sqlite3_value_int64(p->apArg[p->nUsed++]);\n}\nstatic double getDoubleArg(PrintfArguments *p){\n  if( p->nArg<=p->nUsed ) return 0.0;\n  return sqlite3_value_double(p->apArg[p->nUsed++]);\n}\nstatic char *getTextArg(PrintfArguments *p){\n  if( p->nArg<=p->nUsed ) return 0;\n  return (char*)sqlite3_value_text(p->apArg[p->nUsed++]);\n}\n\n\n/*\n** On machines with a small stack size, you can redefine the\n** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired.\n*/\n#ifndef SQLITE_PRINT_BUF_SIZE\n# define SQLITE_PRINT_BUF_SIZE 70\n#endif\n#define etBUFSIZE SQLITE_PRINT_BUF_SIZE  /* Size of the output buffer */\n\n/*\n** Render a string given by \"fmt\" into the StrAccum object.\n*/\nvoid sqlite3VXPrintf(\n  StrAccum *pAccum,          /* Accumulate results here */\n  const char *fmt,           /* Format string */\n  va_list ap                 /* arguments */\n){\n  int c;                     /* Next character in the format string */\n  char *bufpt;               /* Pointer to the conversion buffer */\n  int precision;             /* Precision of the current field */\n  int length;                /* Length of the field */\n  int idx;                   /* A general purpose loop counter */\n  int width;                 /* Width of the current field */\n  etByte flag_leftjustify;   /* True if \"-\" flag is present */\n  etByte flag_plussign;      /* True if \"+\" flag is present */\n  etByte flag_blanksign;     /* True if \" \" flag is present */\n  etByte flag_alternateform; /* True if \"#\" flag is present */\n  etByte flag_altform2;      /* True if \"!\" flag is present */\n  etByte flag_zeropad;       /* True if field width constant starts with zero */\n  etByte flag_long;          /* True if \"l\" flag is present */\n  etByte flag_longlong;      /* True if the \"ll\" flag is present */\n  etByte done;               /* Loop termination flag */\n  etByte xtype = etINVALID;  /* Conversion paradigm */\n  u8 bArgList;               /* True for SQLITE_PRINTF_SQLFUNC */\n  u8 useIntern;              /* Ok to use internal conversions (ex: %T) */\n  char prefix;               /* Prefix character.  \"+\" or \"-\" or \" \" or '\\0'. */\n  sqlite_uint64 longvalue;   /* Value for integer types */\n  LONGDOUBLE_TYPE realvalue; /* Value for real types */\n  const et_info *infop;      /* Pointer to the appropriate info structure */\n  char *zOut;                /* Rendering buffer */\n  int nOut;                  /* Size of the rendering buffer */\n  char *zExtra = 0;          /* Malloced memory used by some conversion */\n#ifndef SQLITE_OMIT_FLOATING_POINT\n  int  exp, e2;              /* exponent of real numbers */\n  int nsd;                   /* Number of significant digits returned */\n  double rounder;            /* Used for rounding floating point values */\n  etByte flag_dp;            /* True if decimal point should be shown */\n  etByte flag_rtz;           /* True if trailing zeros should be removed */\n#endif\n  PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */\n  char buf[etBUFSIZE];       /* Conversion buffer */\n\n  bufpt = 0;\n  if( pAccum->printfFlags ){\n    if( (bArgList = (pAccum->printfFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){\n      pArgList = va_arg(ap, PrintfArguments*);\n    }\n    useIntern = pAccum->printfFlags & SQLITE_PRINTF_INTERNAL;\n  }else{\n    bArgList = useIntern = 0;\n  }\n  for(; (c=(*fmt))!=0; ++fmt){\n    if( c!='%' ){\n      bufpt = (char *)fmt;\n#if HAVE_STRCHRNUL\n      fmt = strchrnul(fmt, '%');\n#else\n      do{ fmt++; }while( *fmt && *fmt != '%' );\n#endif\n      sqlite3StrAccumAppend(pAccum, bufpt, (int)(fmt - bufpt));\n      if( *fmt==0 ) break;\n    }\n    if( (c=(*++fmt))==0 ){\n      sqlite3StrAccumAppend(pAccum, \"%\", 1);\n      break;\n    }\n    /* Find out what flags are present */\n    flag_leftjustify = flag_plussign = flag_blanksign = \n     flag_alternateform = flag_altform2 = flag_zeropad = 0;\n    done = 0;\n    do{\n      switch( c ){\n        case '-':   flag_leftjustify = 1;     break;\n        case '+':   flag_plussign = 1;        break;\n        case ' ':   flag_blanksign = 1;       break;\n        case '#':   flag_alternateform = 1;   break;\n        case '!':   flag_altform2 = 1;        break;\n        case '0':   flag_zeropad = 1;         break;\n        default:    done = 1;                 break;\n      }\n    }while( !done && (c=(*++fmt))!=0 );\n    /* Get the field width */\n    if( c=='*' ){\n      if( bArgList ){\n        width = (int)getIntArg(pArgList);\n      }else{\n        width = va_arg(ap,int);\n      }\n      if( width<0 ){\n        flag_leftjustify = 1;\n        width = width >= -2147483647 ? -width : 0;\n      }\n      c = *++fmt;\n    }else{\n      unsigned wx = 0;\n      while( c>='0' && c<='9' ){\n        wx = wx*10 + c - '0';\n        c = *++fmt;\n      }\n      testcase( wx>0x7fffffff );\n      width = wx & 0x7fffffff;\n    }\n    assert( width>=0 );\n#ifdef SQLITE_PRINTF_PRECISION_LIMIT\n    if( width>SQLITE_PRINTF_PRECISION_LIMIT ){\n      width = SQLITE_PRINTF_PRECISION_LIMIT;\n    }\n#endif\n\n    /* Get the precision */\n    if( c=='.' ){\n      c = *++fmt;\n      if( c=='*' ){\n        if( bArgList ){\n          precision = (int)getIntArg(pArgList);\n        }else{\n          precision = va_arg(ap,int);\n        }\n        c = *++fmt;\n        if( precision<0 ){\n          precision = precision >= -2147483647 ? -precision : -1;\n        }\n      }else{\n        unsigned px = 0;\n        while( c>='0' && c<='9' ){\n          px = px*10 + c - '0';\n          c = *++fmt;\n        }\n        testcase( px>0x7fffffff );\n        precision = px & 0x7fffffff;\n      }\n    }else{\n      precision = -1;\n    }\n    assert( precision>=(-1) );\n#ifdef SQLITE_PRINTF_PRECISION_LIMIT\n    if( precision>SQLITE_PRINTF_PRECISION_LIMIT ){\n      precision = SQLITE_PRINTF_PRECISION_LIMIT;\n    }\n#endif\n\n\n    /* Get the conversion type modifier */\n    if( c=='l' ){\n      flag_long = 1;\n      c = *++fmt;\n      if( c=='l' ){\n        flag_longlong = 1;\n        c = *++fmt;\n      }else{\n        flag_longlong = 0;\n      }\n    }else{\n      flag_long = flag_longlong = 0;\n    }\n    /* Fetch the info entry for the field */\n    infop = &fmtinfo[0];\n    xtype = etINVALID;\n    for(idx=0; idx<ArraySize(fmtinfo); idx++){\n      if( c==fmtinfo[idx].fmttype ){\n        infop = &fmtinfo[idx];\n        if( useIntern || (infop->flags & FLAG_INTERN)==0 ){\n          xtype = infop->type;\n        }else{\n          return;\n        }\n        break;\n      }\n    }\n\n    /*\n    ** At this point, variables are initialized as follows:\n    **\n    **   flag_alternateform          TRUE if a '#' is present.\n    **   flag_altform2               TRUE if a '!' is present.\n    **   flag_plussign               TRUE if a '+' is present.\n    **   flag_leftjustify            TRUE if a '-' is present or if the\n    **                               field width was negative.\n    **   flag_zeropad                TRUE if the width began with 0.\n    **   flag_long                   TRUE if the letter 'l' (ell) prefixed\n    **                               the conversion character.\n    **   flag_longlong               TRUE if the letter 'll' (ell ell) prefixed\n    **                               the conversion character.\n    **   flag_blanksign              TRUE if a ' ' is present.\n    **   width                       The specified field width.  This is\n    **                               always non-negative.  Zero is the default.\n    **   precision                   The specified precision.  The default\n    **                               is -1.\n    **   xtype                       The class of the conversion.\n    **   infop                       Pointer to the appropriate info struct.\n    */\n    switch( xtype ){\n      case etPOINTER:\n        flag_longlong = sizeof(char*)==sizeof(i64);\n        flag_long = sizeof(char*)==sizeof(long int);\n        /* Fall through into the next case */\n      case etORDINAL:\n      case etRADIX:\n        if( infop->flags & FLAG_SIGNED ){\n          i64 v;\n          if( bArgList ){\n            v = getIntArg(pArgList);\n          }else if( flag_longlong ){\n            v = va_arg(ap,i64);\n          }else if( flag_long ){\n            v = va_arg(ap,long int);\n          }else{\n            v = va_arg(ap,int);\n          }\n          if( v<0 ){\n            if( v==SMALLEST_INT64 ){\n              longvalue = ((u64)1)<<63;\n            }else{\n              longvalue = -v;\n            }\n            prefix = '-';\n          }else{\n            longvalue = v;\n            if( flag_plussign )        prefix = '+';\n            else if( flag_blanksign )  prefix = ' ';\n            else                       prefix = 0;\n          }\n        }else{\n          if( bArgList ){\n            longvalue = (u64)getIntArg(pArgList);\n          }else if( flag_longlong ){\n            longvalue = va_arg(ap,u64);\n          }else if( flag_long ){\n            longvalue = va_arg(ap,unsigned long int);\n          }else{\n            longvalue = va_arg(ap,unsigned int);\n          }\n          prefix = 0;\n        }\n        if( longvalue==0 ) flag_alternateform = 0;\n        if( flag_zeropad && precision<width-(prefix!=0) ){\n          precision = width-(prefix!=0);\n        }\n        if( precision<etBUFSIZE-10 ){\n          nOut = etBUFSIZE;\n          zOut = buf;\n        }else{\n          nOut = precision + 10;\n          zOut = zExtra = sqlite3Malloc( nOut );\n          if( zOut==0 ){\n            setStrAccumError(pAccum, STRACCUM_NOMEM);\n            return;\n          }\n        }\n        bufpt = &zOut[nOut-1];\n        if( xtype==etORDINAL ){\n          static const char zOrd[] = \"thstndrd\";\n          int x = (int)(longvalue % 10);\n          if( x>=4 || (longvalue/10)%10==1 ){\n            x = 0;\n          }\n          *(--bufpt) = zOrd[x*2+1];\n          *(--bufpt) = zOrd[x*2];\n        }\n        {\n          const char *cset = &aDigits[infop->charset];\n          u8 base = infop->base;\n          do{                                           /* Convert to ascii */\n            *(--bufpt) = cset[longvalue%base];\n            longvalue = longvalue/base;\n          }while( longvalue>0 );\n        }\n        length = (int)(&zOut[nOut-1]-bufpt);\n        for(idx=precision-length; idx>0; idx--){\n          *(--bufpt) = '0';                             /* Zero pad */\n        }\n        if( prefix ) *(--bufpt) = prefix;               /* Add sign */\n        if( flag_alternateform && infop->prefix ){      /* Add \"0\" or \"0x\" */\n          const char *pre;\n          char x;\n          pre = &aPrefix[infop->prefix];\n          for(; (x=(*pre))!=0; pre++) *(--bufpt) = x;\n        }\n        length = (int)(&zOut[nOut-1]-bufpt);\n        break;\n      case etFLOAT:\n      case etEXP:\n      case etGENERIC:\n        if( bArgList ){\n          realvalue = getDoubleArg(pArgList);\n        }else{\n          realvalue = va_arg(ap,double);\n        }\n#ifdef SQLITE_OMIT_FLOATING_POINT\n        length = 0;\n#else\n        if( precision<0 ) precision = 6;         /* Set default precision */\n        if( realvalue<0.0 ){\n          realvalue = -realvalue;\n          prefix = '-';\n        }else{\n          if( flag_plussign )          prefix = '+';\n          else if( flag_blanksign )    prefix = ' ';\n          else                         prefix = 0;\n        }\n        if( xtype==etGENERIC && precision>0 ) precision--;\n        testcase( precision>0xfff );\n        for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){}\n        if( xtype==etFLOAT ) realvalue += rounder;\n        /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */\n        exp = 0;\n        if( sqlite3IsNaN((double)realvalue) ){\n          bufpt = \"NaN\";\n          length = 3;\n          break;\n        }\n        if( realvalue>0.0 ){\n          LONGDOUBLE_TYPE scale = 1.0;\n          while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}\n          while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }\n          while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }\n          realvalue /= scale;\n          while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }\n          while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }\n          if( exp>350 ){\n            bufpt = buf;\n            buf[0] = prefix;\n            memcpy(buf+(prefix!=0),\"Inf\",4);\n            length = 3+(prefix!=0);\n            break;\n          }\n        }\n        bufpt = buf;\n        /*\n        ** If the field type is etGENERIC, then convert to either etEXP\n        ** or etFLOAT, as appropriate.\n        */\n        if( xtype!=etFLOAT ){\n          realvalue += rounder;\n          if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }\n        }\n        if( xtype==etGENERIC ){\n          flag_rtz = !flag_alternateform;\n          if( exp<-4 || exp>precision ){\n            xtype = etEXP;\n          }else{\n            precision = precision - exp;\n            xtype = etFLOAT;\n          }\n        }else{\n          flag_rtz = flag_altform2;\n        }\n        if( xtype==etEXP ){\n          e2 = 0;\n        }else{\n          e2 = exp;\n        }\n        if( MAX(e2,0)+(i64)precision+(i64)width > etBUFSIZE - 15 ){\n          bufpt = zExtra \n              = sqlite3Malloc( MAX(e2,0)+(i64)precision+(i64)width+15 );\n          if( bufpt==0 ){\n            setStrAccumError(pAccum, STRACCUM_NOMEM);\n            return;\n          }\n        }\n        zOut = bufpt;\n        nsd = 16 + flag_altform2*10;\n        flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;\n        /* The sign in front of the number */\n        if( prefix ){\n          *(bufpt++) = prefix;\n        }\n        /* Digits prior to the decimal point */\n        if( e2<0 ){\n          *(bufpt++) = '0';\n        }else{\n          for(; e2>=0; e2--){\n            *(bufpt++) = et_getdigit(&realvalue,&nsd);\n          }\n        }\n        /* The decimal point */\n        if( flag_dp ){\n          *(bufpt++) = '.';\n        }\n        /* \"0\" digits after the decimal point but before the first\n        ** significant digit of the number */\n        for(e2++; e2<0; precision--, e2++){\n          assert( precision>0 );\n          *(bufpt++) = '0';\n        }\n        /* Significant digits after the decimal point */\n        while( (precision--)>0 ){\n          *(bufpt++) = et_getdigit(&realvalue,&nsd);\n        }\n        /* Remove trailing zeros and the \".\" if no digits follow the \".\" */\n        if( flag_rtz && flag_dp ){\n          while( bufpt[-1]=='0' ) *(--bufpt) = 0;\n          assert( bufpt>zOut );\n          if( bufpt[-1]=='.' ){\n            if( flag_altform2 ){\n              *(bufpt++) = '0';\n            }else{\n              *(--bufpt) = 0;\n            }\n          }\n        }\n        /* Add the \"eNNN\" suffix */\n        if( xtype==etEXP ){\n          *(bufpt++) = aDigits[infop->charset];\n          if( exp<0 ){\n            *(bufpt++) = '-'; exp = -exp;\n          }else{\n            *(bufpt++) = '+';\n          }\n          if( exp>=100 ){\n            *(bufpt++) = (char)((exp/100)+'0');        /* 100's digit */\n            exp %= 100;\n          }\n          *(bufpt++) = (char)(exp/10+'0');             /* 10's digit */\n          *(bufpt++) = (char)(exp%10+'0');             /* 1's digit */\n        }\n        *bufpt = 0;\n\n        /* The converted number is in buf[] and zero terminated. Output it.\n        ** Note that the number is in the usual order, not reversed as with\n        ** integer conversions. */\n        length = (int)(bufpt-zOut);\n        bufpt = zOut;\n\n        /* Special case:  Add leading zeros if the flag_zeropad flag is\n        ** set and we are not left justified */\n        if( flag_zeropad && !flag_leftjustify && length < width){\n          int i;\n          int nPad = width - length;\n          for(i=width; i>=nPad; i--){\n            bufpt[i] = bufpt[i-nPad];\n          }\n          i = prefix!=0;\n          while( nPad-- ) bufpt[i++] = '0';\n          length = width;\n        }\n#endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */\n        break;\n      case etSIZE:\n        if( !bArgList ){\n          *(va_arg(ap,int*)) = pAccum->nChar;\n        }\n        length = width = 0;\n        break;\n      case etPERCENT:\n        buf[0] = '%';\n        bufpt = buf;\n        length = 1;\n        break;\n      case etCHARX:\n        if( bArgList ){\n          bufpt = getTextArg(pArgList);\n          c = bufpt ? bufpt[0] : 0;\n        }else{\n          c = va_arg(ap,int);\n        }\n        if( precision>1 ){\n          width -= precision-1;\n          if( width>1 && !flag_leftjustify ){\n            sqlite3AppendChar(pAccum, width-1, ' ');\n            width = 0;\n          }\n          sqlite3AppendChar(pAccum, precision-1, c);\n        }\n        length = 1;\n        buf[0] = c;\n        bufpt = buf;\n        break;\n      case etSTRING:\n      case etDYNSTRING:\n        if( bArgList ){\n          bufpt = getTextArg(pArgList);\n          xtype = etSTRING;\n        }else{\n          bufpt = va_arg(ap,char*);\n        }\n        if( bufpt==0 ){\n          bufpt = \"\";\n        }else if( xtype==etDYNSTRING ){\n          zExtra = bufpt;\n        }\n        if( precision>=0 ){\n          for(length=0; length<precision && bufpt[length]; length++){}\n        }else{\n          length = sqlite3Strlen30(bufpt);\n        }\n        break;\n      case etSQLESCAPE:           /* Escape ' characters */\n      case etSQLESCAPE2:          /* Escape ' and enclose in '...' */\n      case etSQLESCAPE3: {        /* Escape \" characters */\n        int i, j, k, n, isnull;\n        int needQuote;\n        char ch;\n        char q = ((xtype==etSQLESCAPE3)?'\"':'\\'');   /* Quote character */\n        char *escarg;\n\n        if( bArgList ){\n          escarg = getTextArg(pArgList);\n        }else{\n          escarg = va_arg(ap,char*);\n        }\n        isnull = escarg==0;\n        if( isnull ) escarg = (xtype==etSQLESCAPE2 ? \"NULL\" : \"(NULL)\");\n        k = precision;\n        for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){\n          if( ch==q )  n++;\n        }\n        needQuote = !isnull && xtype==etSQLESCAPE2;\n        n += i + 3;\n        if( n>etBUFSIZE ){\n          bufpt = zExtra = sqlite3Malloc( n );\n          if( bufpt==0 ){\n            setStrAccumError(pAccum, STRACCUM_NOMEM);\n            return;\n          }\n        }else{\n          bufpt = buf;\n        }\n        j = 0;\n        if( needQuote ) bufpt[j++] = q;\n        k = i;\n        for(i=0; i<k; i++){\n          bufpt[j++] = ch = escarg[i];\n          if( ch==q ) bufpt[j++] = ch;\n        }\n        if( needQuote ) bufpt[j++] = q;\n        bufpt[j] = 0;\n        length = j;\n        /* The precision in %q and %Q means how many input characters to\n        ** consume, not the length of the output...\n        ** if( precision>=0 && precision<length ) length = precision; */\n        break;\n      }\n      case etTOKEN: {\n        Token *pToken = va_arg(ap, Token*);\n        assert( bArgList==0 );\n        if( pToken && pToken->n ){\n          sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n);\n        }\n        length = width = 0;\n        break;\n      }\n      case etSRCLIST: {\n        SrcList *pSrc = va_arg(ap, SrcList*);\n        int k = va_arg(ap, int);\n        struct SrcList_item *pItem = &pSrc->a[k];\n        assert( bArgList==0 );\n        assert( k>=0 && k<pSrc->nSrc );\n        if( pItem->zDatabase ){\n          sqlite3StrAccumAppendAll(pAccum, pItem->zDatabase);\n          sqlite3StrAccumAppend(pAccum, \".\", 1);\n        }\n        sqlite3StrAccumAppendAll(pAccum, pItem->zName);\n        length = width = 0;\n        break;\n      }\n      default: {\n        assert( xtype==etINVALID );\n        return;\n      }\n    }/* End switch over the format type */\n    /*\n    ** The text of the conversion is pointed to by \"bufpt\" and is\n    ** \"length\" characters long.  The field width is \"width\".  Do\n    ** the output.\n    */\n    width -= length;\n    if( width>0 && !flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');\n    sqlite3StrAccumAppend(pAccum, bufpt, length);\n    if( width>0 && flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');\n\n    if( zExtra ){\n      sqlite3DbFree(pAccum->db, zExtra);\n      zExtra = 0;\n    }\n  }/* End for loop over the format string */\n} /* End of function */\n\n/*\n** Enlarge the memory allocation on a StrAccum object so that it is\n** able to accept at least N more bytes of text.\n**\n** Return the number of bytes of text that StrAccum is able to accept\n** after the attempted enlargement.  The value returned might be zero.\n*/\nstatic int sqlite3StrAccumEnlarge(StrAccum *p, int N){\n  char *zNew;\n  assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */\n  if( p->accError ){\n    testcase(p->accError==STRACCUM_TOOBIG);\n    testcase(p->accError==STRACCUM_NOMEM);\n    return 0;\n  }\n  if( p->mxAlloc==0 ){\n    N = p->nAlloc - p->nChar - 1;\n    setStrAccumError(p, STRACCUM_TOOBIG);\n    return N;\n  }else{\n    char *zOld = isMalloced(p) ? p->zText : 0;\n    i64 szNew = p->nChar;\n    assert( (p->zText==0 || p->zText==p->zBase)==!isMalloced(p) );\n    szNew += N + 1;\n    if( szNew+p->nChar<=p->mxAlloc ){\n      /* Force exponential buffer size growth as long as it does not overflow,\n      ** to avoid having to call this routine too often */\n      szNew += p->nChar;\n    }\n    if( szNew > p->mxAlloc ){\n      sqlite3StrAccumReset(p);\n      setStrAccumError(p, STRACCUM_TOOBIG);\n      return 0;\n    }else{\n      p->nAlloc = (int)szNew;\n    }\n    if( p->db ){\n      zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc);\n    }else{\n      zNew = sqlite3_realloc64(zOld, p->nAlloc);\n    }\n    if( zNew ){\n      assert( p->zText!=0 || p->nChar==0 );\n      if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);\n      p->zText = zNew;\n      p->nAlloc = sqlite3DbMallocSize(p->db, zNew);\n      p->printfFlags |= SQLITE_PRINTF_MALLOCED;\n    }else{\n      sqlite3StrAccumReset(p);\n      setStrAccumError(p, STRACCUM_NOMEM);\n      return 0;\n    }\n  }\n  return N;\n}\n\n/*\n** Append N copies of character c to the given string buffer.\n*/\nvoid sqlite3AppendChar(StrAccum *p, int N, char c){\n  testcase( p->nChar + (i64)N > 0x7fffffff );\n  if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){\n    return;\n  }\n  assert( (p->zText==p->zBase)==!isMalloced(p) );\n  while( (N--)>0 ) p->zText[p->nChar++] = c;\n}\n\n/*\n** The StrAccum \"p\" is not large enough to accept N new bytes of z[].\n** So enlarge if first, then do the append.\n**\n** This is a helper routine to sqlite3StrAccumAppend() that does special-case\n** work (enlarging the buffer) using tail recursion, so that the\n** sqlite3StrAccumAppend() routine can use fast calling semantics.\n*/\nstatic void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){\n  N = sqlite3StrAccumEnlarge(p, N);\n  if( N>0 ){\n    memcpy(&p->zText[p->nChar], z, N);\n    p->nChar += N;\n  }\n  assert( (p->zText==0 || p->zText==p->zBase)==!isMalloced(p) );\n}\n\n/*\n** Append N bytes of text from z to the StrAccum object.  Increase the\n** size of the memory allocation for StrAccum if necessary.\n*/\nvoid sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){\n  assert( z!=0 || N==0 );\n  assert( p->zText!=0 || p->nChar==0 || p->accError );\n  assert( N>=0 );\n  assert( p->accError==0 || p->nAlloc==0 );\n  if( p->nChar+N >= p->nAlloc ){\n    enlargeAndAppend(p,z,N);\n  }else{\n    assert( p->zText );\n    p->nChar += N;\n    memcpy(&p->zText[p->nChar-N], z, N);\n  }\n}\n\n/*\n** Append the complete text of zero-terminated string z[] to the p string.\n*/\nvoid sqlite3StrAccumAppendAll(StrAccum *p, const char *z){\n  sqlite3StrAccumAppend(p, z, sqlite3Strlen30(z));\n}\n\n\n/*\n** Finish off a string by making sure it is zero-terminated.\n** Return a pointer to the resulting string.  Return a NULL\n** pointer if any kind of error was encountered.\n*/\nchar *sqlite3StrAccumFinish(StrAccum *p){\n  if( p->zText ){\n    assert( (p->zText==p->zBase)==!isMalloced(p) );\n    p->zText[p->nChar] = 0;\n    if( p->mxAlloc>0 && !isMalloced(p) ){\n      p->zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );\n      if( p->zText ){\n        memcpy(p->zText, p->zBase, p->nChar+1);\n        p->printfFlags |= SQLITE_PRINTF_MALLOCED;\n      }else{\n        setStrAccumError(p, STRACCUM_NOMEM);\n      }\n    }\n  }\n  return p->zText;\n}\n\n/*\n** Reset an StrAccum string.  Reclaim all malloced memory.\n*/\nvoid sqlite3StrAccumReset(StrAccum *p){\n  assert( (p->zText==0 || p->zText==p->zBase)==!isMalloced(p) );\n  if( isMalloced(p) ){\n    sqlite3DbFree(p->db, p->zText);\n    p->printfFlags &= ~SQLITE_PRINTF_MALLOCED;\n  }\n  p->zText = 0;\n}\n\n/*\n** Initialize a string accumulator.\n**\n** p:     The accumulator to be initialized.\n** db:    Pointer to a database connection.  May be NULL.  Lookaside\n**        memory is used if not NULL. db->mallocFailed is set appropriately\n**        when not NULL.\n** zBase: An initial buffer.  May be NULL in which case the initial buffer\n**        is malloced.\n** n:     Size of zBase in bytes.  If total space requirements never exceed\n**        n then no memory allocations ever occur.\n** mx:    Maximum number of bytes to accumulate.  If mx==0 then no memory\n**        allocations will ever occur.\n*/\nvoid sqlite3StrAccumInit(StrAccum *p, sqlite3 *db, char *zBase, int n, int mx){\n  p->zText = p->zBase = zBase;\n  p->db = db;\n  p->nChar = 0;\n  p->nAlloc = n;\n  p->mxAlloc = mx;\n  p->accError = 0;\n  p->printfFlags = 0;\n}\n\n/*\n** Print into memory obtained from sqliteMalloc().  Use the internal\n** %-conversion extensions.\n*/\nchar *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list ap){\n  char *z;\n  char zBase[SQLITE_PRINT_BUF_SIZE];\n  StrAccum acc;\n  assert( db!=0 );\n  sqlite3StrAccumInit(&acc, db, zBase, sizeof(zBase),\n                      db->aLimit[SQLITE_LIMIT_LENGTH]);\n  acc.printfFlags = SQLITE_PRINTF_INTERNAL;\n  sqlite3VXPrintf(&acc, zFormat, ap);\n  z = sqlite3StrAccumFinish(&acc);\n  if( acc.accError==STRACCUM_NOMEM ){\n    sqlite3OomFault(db);\n  }\n  return z;\n}\n\n/*\n** Print into memory obtained from sqliteMalloc().  Use the internal\n** %-conversion extensions.\n*/\nchar *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){\n  va_list ap;\n  char *z;\n  va_start(ap, zFormat);\n  z = sqlite3VMPrintf(db, zFormat, ap);\n  va_end(ap);\n  return z;\n}\n\n/*\n** Print into memory obtained from sqlite3_malloc().  Omit the internal\n** %-conversion extensions.\n*/\nchar *sqlite3_vmprintf(const char *zFormat, va_list ap){\n  char *z;\n  char zBase[SQLITE_PRINT_BUF_SIZE];\n  StrAccum acc;\n\n#ifdef SQLITE_ENABLE_API_ARMOR  \n  if( zFormat==0 ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize() ) return 0;\n#endif\n  sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);\n  sqlite3VXPrintf(&acc, zFormat, ap);\n  z = sqlite3StrAccumFinish(&acc);\n  return z;\n}\n\n/*\n** Print into memory obtained from sqlite3_malloc()().  Omit the internal\n** %-conversion extensions.\n*/\nchar *sqlite3_mprintf(const char *zFormat, ...){\n  va_list ap;\n  char *z;\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize() ) return 0;\n#endif\n  va_start(ap, zFormat);\n  z = sqlite3_vmprintf(zFormat, ap);\n  va_end(ap);\n  return z;\n}\n\n/*\n** sqlite3_snprintf() works like snprintf() except that it ignores the\n** current locale settings.  This is important for SQLite because we\n** are not able to use a \",\" as the decimal point in place of \".\" as\n** specified by some locales.\n**\n** Oops:  The first two arguments of sqlite3_snprintf() are backwards\n** from the snprintf() standard.  Unfortunately, it is too late to change\n** this without breaking compatibility, so we just have to live with the\n** mistake.\n**\n** sqlite3_vsnprintf() is the varargs version.\n*/\nchar *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){\n  StrAccum acc;\n  if( n<=0 ) return zBuf;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( zBuf==0 || zFormat==0 ) {\n    (void)SQLITE_MISUSE_BKPT;\n    if( zBuf ) zBuf[0] = 0;\n    return zBuf;\n  }\n#endif\n  sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);\n  sqlite3VXPrintf(&acc, zFormat, ap);\n  return sqlite3StrAccumFinish(&acc);\n}\nchar *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){\n  char *z;\n  va_list ap;\n  va_start(ap,zFormat);\n  z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);\n  va_end(ap);\n  return z;\n}\n\n/*\n** This is the routine that actually formats the sqlite3_log() message.\n** We house it in a separate routine from sqlite3_log() to avoid using\n** stack space on small-stack systems when logging is disabled.\n**\n** sqlite3_log() must render into a static buffer.  It cannot dynamically\n** allocate memory because it might be called while the memory allocator\n** mutex is held.\n**\n** sqlite3VXPrintf() might ask for *temporary* memory allocations for\n** certain format characters (%q) or for very large precisions or widths.\n** Care must be taken that any sqlite3_log() calls that occur while the\n** memory mutex is held do not use these mechanisms.\n*/\nstatic void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){\n  StrAccum acc;                          /* String accumulator */\n  char zMsg[SQLITE_PRINT_BUF_SIZE*3];    /* Complete log message */\n\n  sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);\n  sqlite3VXPrintf(&acc, zFormat, ap);\n  sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode,\n                           sqlite3StrAccumFinish(&acc));\n}\n\n/*\n** Format and write a message to the log if logging is enabled.\n*/\nvoid sqlite3_log(int iErrCode, const char *zFormat, ...){\n  va_list ap;                             /* Vararg list */\n  if( sqlite3GlobalConfig.xLog ){\n    va_start(ap, zFormat);\n    renderLogMsg(iErrCode, zFormat, ap);\n    va_end(ap);\n  }\n}\n\n#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)\n/*\n** A version of printf() that understands %lld.  Used for debugging.\n** The printf() built into some versions of windows does not understand %lld\n** and segfaults if you give it a long long int.\n*/\nvoid sqlite3DebugPrintf(const char *zFormat, ...){\n  va_list ap;\n  StrAccum acc;\n  char zBuf[500];\n  sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);\n  va_start(ap,zFormat);\n  sqlite3VXPrintf(&acc, zFormat, ap);\n  va_end(ap);\n  sqlite3StrAccumFinish(&acc);\n  fprintf(stdout,\"%s\", zBuf);\n  fflush(stdout);\n}\n#endif\n\n\n/*\n** variable-argument wrapper around sqlite3VXPrintf().  The bFlags argument\n** can contain the bit SQLITE_PRINTF_INTERNAL enable internal formats.\n*/\nvoid sqlite3XPrintf(StrAccum *p, const char *zFormat, ...){\n  va_list ap;\n  va_start(ap,zFormat);\n  sqlite3VXPrintf(p, zFormat, ap);\n  va_end(ap);\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/queue.c",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n\n#include \"queue.h\"\n#include <assert.h>\n#include \"sqliteInt.h\"\n\nstruct QueueElem {\n  QueueElem* pPrev;\n  QueueElem* pNext;\n  void* pData;\n};\n\nvoid sqlite3QueueInit(Queue* pQueue)\n{\n  assert(pQueue!=NULL);\n  pQueue->pHead = NULL;\n  pQueue->pTail = NULL;\n}\n\nQueueElem* sqlite3QueuePush(Queue* pQueue, void* pData)\n{\n  assert(pQueue!=NULL);\n  QueueElem* elem = (QueueElem*)sqlite3_malloc(sizeof(QueueElem));\n  elem->pData = pData;\n  elem->pPrev = pQueue->pTail;\n  elem->pNext = NULL;\n  if (pQueue->pTail) {\n    pQueue->pTail->pNext = elem;\n  }else {\n    pQueue->pHead = elem;\n  }\n  pQueue->pTail = elem;\n  return elem;\n}\n\nQueueElem* sqlite3QueuePushFront(Queue* pQueue, void* pData)\n{\n  assert(pQueue!=NULL);\n  QueueElem* elem = (QueueElem*)sqlite3_malloc(sizeof(QueueElem));\n  elem->pData = pData;\n  elem->pPrev = NULL;\n  elem->pNext = pQueue->pHead;\n  if (pQueue->pHead) {\n    pQueue->pHead->pPrev = elem;\n  }else {\n    pQueue->pTail = elem;\n  }\n  pQueue->pHead = elem;\n  return elem;\n}\n\nvoid* sqlite3QueuePop(Queue* pQueue)\n{\n  assert(pQueue!=NULL);\n  void* pData = NULL;\n  QueueElem* elem = NULL;\n  if (pQueue->pHead) {\n    elem = pQueue->pHead;\n    if (pQueue->pHead==pQueue->pTail) {\n      pQueue->pHead = NULL;\n      pQueue->pTail = NULL;\n    }else {\n      pQueue->pHead = pQueue->pHead->pNext;\n      pQueue->pHead->pPrev = NULL;\n    }\n  }\n  if (elem) {\n    pData = elem->pData;\n    sqlite3_free(elem);\n  }\n  return pData;\n}\n\nvoid* sqlite3QueueFront(Queue* pQueue)\n{\n  assert(pQueue!=NULL);\n  if (pQueue->pHead) {\n    return pQueue->pHead->pData;\n  }\n  return NULL;\n}\n\nint sqlite3QueueEmpty(Queue* pQueue)\n{\n  return pQueue->pHead!=NULL?0:1;\n}\n\nvoid sqlite3QueueFree(Queue* pQueue)\n{\n  assert(pQueue!=NULL);\n  sqlite3_free(pQueue);\n}\n\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/queue.h",
    "content": "/*\n * Tencent is pleased to support the open source community by making\n * WCDB available.\n *\n * Copyright (C) 2017 THL A29 Limited, a Tencent company.\n * All rights reserved.\n *\n * Licensed under the BSD 3-Clause License (the \"License\"); you may not use\n * this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n *       https://opensource.org/licenses/BSD-3-Clause\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef _SQLITE_QUEUE_H_\n#define _SQLITE_QUEUE_H_\n\n#if SQLITE_WCDB_SIGNAL_RETRY\n\ntypedef struct Queue Queue;\ntypedef struct QueueElem QueueElem;\n\nstruct Queue {\n  QueueElem* pHead;\n  QueueElem* pTail;\n};\n\nvoid sqlite3QueueInit(Queue*);\n\nQueueElem* sqlite3QueuePush(Queue*, void*);\n\nQueueElem* sqlite3QueuePushFront(Queue*, void*);\n\nvoid* sqlite3QueuePop(Queue*);\n\nvoid* sqlite3QueueFront(Queue*);\n\nint sqlite3QueueEmpty(Queue*);\n\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n#endif /* _SQLITE_QUEUE_H_ */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/random.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code to implement a pseudo-random number\n** generator (PRNG) for SQLite.\n**\n** Random numbers are used by some of the database backends in order\n** to generate random integer keys for tables or random filenames.\n*/\n#include \"sqliteInt.h\"\n\n\n/* All threads share a single random number generator.\n** This structure is the current state of the generator.\n*/\nstatic SQLITE_WSD struct sqlite3PrngType {\n  unsigned char isInit;          /* True if initialized */\n  unsigned char i, j;            /* State variables */\n  unsigned char s[256];          /* State variables */\n} sqlite3Prng;\n\n/*\n** Return N random bytes.\n*/\nvoid sqlite3_randomness(int N, void *pBuf){\n  unsigned char t;\n  unsigned char *zBuf = pBuf;\n\n  /* The \"wsdPrng\" macro will resolve to the pseudo-random number generator\n  ** state vector.  If writable static data is unsupported on the target,\n  ** we have to locate the state vector at run-time.  In the more common\n  ** case where writable static data is supported, wsdPrng can refer directly\n  ** to the \"sqlite3Prng\" state vector declared above.\n  */\n#ifdef SQLITE_OMIT_WSD\n  struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng);\n# define wsdPrng p[0]\n#else\n# define wsdPrng sqlite3Prng\n#endif\n\n#if SQLITE_THREADSAFE\n  sqlite3_mutex *mutex;\n#endif\n\n#ifndef SQLITE_OMIT_AUTOINIT\n  if( sqlite3_initialize() ) return;\n#endif\n\n#if SQLITE_THREADSAFE\n  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);\n#endif\n\n  sqlite3_mutex_enter(mutex);\n  if( N<=0 || pBuf==0 ){\n    wsdPrng.isInit = 0;\n    sqlite3_mutex_leave(mutex);\n    return;\n  }\n\n  /* Initialize the state of the random number generator once,\n  ** the first time this routine is called.  The seed value does\n  ** not need to contain a lot of randomness since we are not\n  ** trying to do secure encryption or anything like that...\n  **\n  ** Nothing in this file or anywhere else in SQLite does any kind of\n  ** encryption.  The RC4 algorithm is being used as a PRNG (pseudo-random\n  ** number generator) not as an encryption device.\n  */\n  if( !wsdPrng.isInit ){\n    int i;\n    char k[256];\n    wsdPrng.j = 0;\n    wsdPrng.i = 0;\n    sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k);\n    for(i=0; i<256; i++){\n      wsdPrng.s[i] = (u8)i;\n    }\n    for(i=0; i<256; i++){\n      wsdPrng.j += wsdPrng.s[i] + k[i];\n      t = wsdPrng.s[wsdPrng.j];\n      wsdPrng.s[wsdPrng.j] = wsdPrng.s[i];\n      wsdPrng.s[i] = t;\n    }\n    wsdPrng.isInit = 1;\n  }\n\n  assert( N>0 );\n  do{\n    wsdPrng.i++;\n    t = wsdPrng.s[wsdPrng.i];\n    wsdPrng.j += t;\n    wsdPrng.s[wsdPrng.i] = wsdPrng.s[wsdPrng.j];\n    wsdPrng.s[wsdPrng.j] = t;\n    t += wsdPrng.s[wsdPrng.i];\n    *(zBuf++) = wsdPrng.s[t];\n  }while( --N );\n  sqlite3_mutex_leave(mutex);\n}\n\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n/*\n** For testing purposes, we sometimes want to preserve the state of\n** PRNG and restore the PRNG to its saved state at a later time, or\n** to reset the PRNG to its initial state.  These routines accomplish\n** those tasks.\n**\n** The sqlite3_test_control() interface calls these routines to\n** control the PRNG.\n*/\nstatic SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng;\nvoid sqlite3PrngSaveState(void){\n  memcpy(\n    &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng),\n    &GLOBAL(struct sqlite3PrngType, sqlite3Prng),\n    sizeof(sqlite3Prng)\n  );\n}\nvoid sqlite3PrngRestoreState(void){\n  memcpy(\n    &GLOBAL(struct sqlite3PrngType, sqlite3Prng),\n    &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng),\n    sizeof(sqlite3Prng)\n  );\n}\n#endif /* SQLITE_OMIT_BUILTIN_TEST */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/resolve.c",
    "content": "/*\n** 2008 August 18\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains routines used for walking the parser tree and\n** resolve all identifiers by associating them with a particular\n** table and column.\n*/\n#include \"sqliteInt.h\"\n#include <stdlib.h>\n#include <string.h>\n\n/*\n** Walk the expression tree pExpr and increase the aggregate function\n** depth (the Expr.op2 field) by N on every TK_AGG_FUNCTION node.\n** This needs to occur when copying a TK_AGG_FUNCTION node from an\n** outer query into an inner subquery.\n**\n** incrAggFunctionDepth(pExpr,n) is the main routine.  incrAggDepth(..)\n** is a helper function - a callback for the tree walker.\n*/\nstatic int incrAggDepth(Walker *pWalker, Expr *pExpr){\n  if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;\n  return WRC_Continue;\n}\nstatic void incrAggFunctionDepth(Expr *pExpr, int N){\n  if( N>0 ){\n    Walker w;\n    memset(&w, 0, sizeof(w));\n    w.xExprCallback = incrAggDepth;\n    w.u.n = N;\n    sqlite3WalkExpr(&w, pExpr);\n  }\n}\n\n/*\n** Turn the pExpr expression into an alias for the iCol-th column of the\n** result set in pEList.\n**\n** If the reference is followed by a COLLATE operator, then make sure\n** the COLLATE operator is preserved.  For example:\n**\n**     SELECT a+b, c+d FROM t1 ORDER BY 1 COLLATE nocase;\n**\n** Should be transformed into:\n**\n**     SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase;\n**\n** The nSubquery parameter specifies how many levels of subquery the\n** alias is removed from the original expression.  The usual value is\n** zero but it might be more if the alias is contained within a subquery\n** of the original expression.  The Expr.op2 field of TK_AGG_FUNCTION\n** structures must be increased by the nSubquery amount.\n*/\nstatic void resolveAlias(\n  Parse *pParse,         /* Parsing context */\n  ExprList *pEList,      /* A result set */\n  int iCol,              /* A column in the result set.  0..pEList->nExpr-1 */\n  Expr *pExpr,           /* Transform this into an alias to the result set */\n  const char *zType,     /* \"GROUP\" or \"ORDER\" or \"\" */\n  int nSubquery          /* Number of subqueries that the label is moving */\n){\n  Expr *pOrig;           /* The iCol-th column of the result set */\n  Expr *pDup;            /* Copy of pOrig */\n  sqlite3 *db;           /* The database connection */\n\n  assert( iCol>=0 && iCol<pEList->nExpr );\n  pOrig = pEList->a[iCol].pExpr;\n  assert( pOrig!=0 );\n  db = pParse->db;\n  pDup = sqlite3ExprDup(db, pOrig, 0);\n  if( pDup==0 ) return;\n  if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery);\n  if( pExpr->op==TK_COLLATE ){\n    pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);\n  }\n  ExprSetProperty(pDup, EP_Alias);\n\n  /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This \n  ** prevents ExprDelete() from deleting the Expr structure itself,\n  ** allowing it to be repopulated by the memcpy() on the following line.\n  ** The pExpr->u.zToken might point into memory that will be freed by the\n  ** sqlite3DbFree(db, pDup) on the last line of this block, so be sure to\n  ** make a copy of the token before doing the sqlite3DbFree().\n  */\n  ExprSetProperty(pExpr, EP_Static);\n  sqlite3ExprDelete(db, pExpr);\n  memcpy(pExpr, pDup, sizeof(*pExpr));\n  if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){\n    assert( (pExpr->flags & (EP_Reduced|EP_TokenOnly))==0 );\n    pExpr->u.zToken = sqlite3DbStrDup(db, pExpr->u.zToken);\n    pExpr->flags |= EP_MemToken;\n  }\n  sqlite3DbFree(db, pDup);\n}\n\n\n/*\n** Return TRUE if the name zCol occurs anywhere in the USING clause.\n**\n** Return FALSE if the USING clause is NULL or if it does not contain\n** zCol.\n*/\nstatic int nameInUsingClause(IdList *pUsing, const char *zCol){\n  if( pUsing ){\n    int k;\n    for(k=0; k<pUsing->nId; k++){\n      if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** Subqueries stores the original database, table and column names for their\n** result sets in ExprList.a[].zSpan, in the form \"DATABASE.TABLE.COLUMN\".\n** Check to see if the zSpan given to this routine matches the zDb, zTab,\n** and zCol.  If any of zDb, zTab, and zCol are NULL then those fields will\n** match anything.\n*/\nint sqlite3MatchSpanName(\n  const char *zSpan,\n  const char *zCol,\n  const char *zTab,\n  const char *zDb\n){\n  int n;\n  for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}\n  if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){\n    return 0;\n  }\n  zSpan += n+1;\n  for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}\n  if( zTab && (sqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){\n    return 0;\n  }\n  zSpan += n+1;\n  if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){\n    return 0;\n  }\n  return 1;\n}\n\n/*\n** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up\n** that name in the set of source tables in pSrcList and make the pExpr \n** expression node refer back to that source column.  The following changes\n** are made to pExpr:\n**\n**    pExpr->iDb           Set the index in db->aDb[] of the database X\n**                         (even if X is implied).\n**    pExpr->iTable        Set to the cursor number for the table obtained\n**                         from pSrcList.\n**    pExpr->pTab          Points to the Table structure of X.Y (even if\n**                         X and/or Y are implied.)\n**    pExpr->iColumn       Set to the column number within the table.\n**    pExpr->op            Set to TK_COLUMN.\n**    pExpr->pLeft         Any expression this points to is deleted\n**    pExpr->pRight        Any expression this points to is deleted.\n**\n** The zDb variable is the name of the database (the \"X\").  This value may be\n** NULL meaning that name is of the form Y.Z or Z.  Any available database\n** can be used.  The zTable variable is the name of the table (the \"Y\").  This\n** value can be NULL if zDb is also NULL.  If zTable is NULL it\n** means that the form of the name is Z and that columns from any table\n** can be used.\n**\n** If the name cannot be resolved unambiguously, leave an error message\n** in pParse and return WRC_Abort.  Return WRC_Prune on success.\n*/\nstatic int lookupName(\n  Parse *pParse,       /* The parsing context */\n  const char *zDb,     /* Name of the database containing table, or NULL */\n  const char *zTab,    /* Name of table containing column, or NULL */\n  const char *zCol,    /* Name of the column. */\n  NameContext *pNC,    /* The name context used to resolve the name */\n  Expr *pExpr          /* Make this EXPR node point to the selected column */\n){\n  int i, j;                         /* Loop counters */\n  int cnt = 0;                      /* Number of matching column names */\n  int cntTab = 0;                   /* Number of matching table names */\n  int nSubquery = 0;                /* How many levels of subquery */\n  sqlite3 *db = pParse->db;         /* The database connection */\n  struct SrcList_item *pItem;       /* Use for looping over pSrcList items */\n  struct SrcList_item *pMatch = 0;  /* The matching pSrcList item */\n  NameContext *pTopNC = pNC;        /* First namecontext in the list */\n  Schema *pSchema = 0;              /* Schema of the expression */\n  int isTrigger = 0;                /* True if resolved to a trigger column */\n  Table *pTab = 0;                  /* Table hold the row */\n  Column *pCol;                     /* A column of pTab */\n\n  assert( pNC );     /* the name context cannot be NULL. */\n  assert( zCol );    /* The Z in X.Y.Z cannot be NULL */\n  assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );\n\n  /* Initialize the node to no-match */\n  pExpr->iTable = -1;\n  pExpr->pTab = 0;\n  ExprSetVVAProperty(pExpr, EP_NoReduce);\n\n  /* Translate the schema name in zDb into a pointer to the corresponding\n  ** schema.  If not found, pSchema will remain NULL and nothing will match\n  ** resulting in an appropriate error message toward the end of this routine\n  */\n  if( zDb ){\n    testcase( pNC->ncFlags & NC_PartIdx );\n    testcase( pNC->ncFlags & NC_IsCheck );\n    if( (pNC->ncFlags & (NC_PartIdx|NC_IsCheck))!=0 ){\n      /* Silently ignore database qualifiers inside CHECK constraints and\n      ** partial indices.  Do not raise errors because that might break\n      ** legacy and because it does not hurt anything to just ignore the\n      ** database name. */\n      zDb = 0;\n    }else{\n      for(i=0; i<db->nDb; i++){\n        assert( db->aDb[i].zDbSName );\n        if( sqlite3StrICmp(db->aDb[i].zDbSName,zDb)==0 ){\n          pSchema = db->aDb[i].pSchema;\n          break;\n        }\n      }\n    }\n  }\n\n  /* Start at the inner-most context and move outward until a match is found */\n  while( pNC && cnt==0 ){\n    ExprList *pEList;\n    SrcList *pSrcList = pNC->pSrcList;\n\n    if( pSrcList ){\n      for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){\n        pTab = pItem->pTab;\n        assert( pTab!=0 && pTab->zName!=0 );\n        assert( pTab->nCol>0 );\n        if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){\n          int hit = 0;\n          pEList = pItem->pSelect->pEList;\n          for(j=0; j<pEList->nExpr; j++){\n            if( sqlite3MatchSpanName(pEList->a[j].zSpan, zCol, zTab, zDb) ){\n              cnt++;\n              cntTab = 2;\n              pMatch = pItem;\n              pExpr->iColumn = j;\n              hit = 1;\n            }\n          }\n          if( hit || zTab==0 ) continue;\n        }\n        if( zDb && pTab->pSchema!=pSchema ){\n          continue;\n        }\n        if( zTab ){\n          const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;\n          assert( zTabName!=0 );\n          if( sqlite3StrICmp(zTabName, zTab)!=0 ){\n            continue;\n          }\n        }\n        if( 0==(cntTab++) ){\n          pMatch = pItem;\n        }\n        for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){\n          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){\n            /* If there has been exactly one prior match and this match\n            ** is for the right-hand table of a NATURAL JOIN or is in a \n            ** USING clause, then skip this match.\n            */\n            if( cnt==1 ){\n              if( pItem->fg.jointype & JT_NATURAL ) continue;\n              if( nameInUsingClause(pItem->pUsing, zCol) ) continue;\n            }\n            cnt++;\n            pMatch = pItem;\n            /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */\n            pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;\n            break;\n          }\n        }\n      }\n      if( pMatch ){\n        pExpr->iTable = pMatch->iCursor;\n        pExpr->pTab = pMatch->pTab;\n        /* RIGHT JOIN not (yet) supported */\n        assert( (pMatch->fg.jointype & JT_RIGHT)==0 );\n        if( (pMatch->fg.jointype & JT_LEFT)!=0 ){\n          ExprSetProperty(pExpr, EP_CanBeNull);\n        }\n        pSchema = pExpr->pTab->pSchema;\n      }\n    } /* if( pSrcList ) */\n\n#ifndef SQLITE_OMIT_TRIGGER\n    /* If we have not already resolved the name, then maybe \n    ** it is a new.* or old.* trigger argument reference\n    */\n    if( zDb==0 && zTab!=0 && cntTab==0 && pParse->pTriggerTab!=0 ){\n      int op = pParse->eTriggerOp;\n      assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );\n      if( op!=TK_DELETE && sqlite3StrICmp(\"new\",zTab) == 0 ){\n        pExpr->iTable = 1;\n        pTab = pParse->pTriggerTab;\n      }else if( op!=TK_INSERT && sqlite3StrICmp(\"old\",zTab)==0 ){\n        pExpr->iTable = 0;\n        pTab = pParse->pTriggerTab;\n      }else{\n        pTab = 0;\n      }\n\n      if( pTab ){ \n        int iCol;\n        pSchema = pTab->pSchema;\n        cntTab++;\n        for(iCol=0, pCol=pTab->aCol; iCol<pTab->nCol; iCol++, pCol++){\n          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){\n            if( iCol==pTab->iPKey ){\n              iCol = -1;\n            }\n            break;\n          }\n        }\n        if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){\n          /* IMP: R-51414-32910 */\n          iCol = -1;\n        }\n        if( iCol<pTab->nCol ){\n          cnt++;\n          if( iCol<0 ){\n            pExpr->affinity = SQLITE_AFF_INTEGER;\n          }else if( pExpr->iTable==0 ){\n            testcase( iCol==31 );\n            testcase( iCol==32 );\n            pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));\n          }else{\n            testcase( iCol==31 );\n            testcase( iCol==32 );\n            pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol));\n          }\n          pExpr->iColumn = (i16)iCol;\n          pExpr->pTab = pTab;\n          isTrigger = 1;\n        }\n      }\n    }\n#endif /* !defined(SQLITE_OMIT_TRIGGER) */\n\n    /*\n    ** Perhaps the name is a reference to the ROWID\n    */\n    if( cnt==0\n     && cntTab==1\n     && pMatch\n     && (pNC->ncFlags & NC_IdxExpr)==0\n     && sqlite3IsRowid(zCol)\n     && VisibleRowid(pMatch->pTab)\n    ){\n      cnt = 1;\n      pExpr->iColumn = -1;\n      pExpr->affinity = SQLITE_AFF_INTEGER;\n    }\n\n    /*\n    ** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z\n    ** might refer to an result-set alias.  This happens, for example, when\n    ** we are resolving names in the WHERE clause of the following command:\n    **\n    **     SELECT a+b AS x FROM table WHERE x<10;\n    **\n    ** In cases like this, replace pExpr with a copy of the expression that\n    ** forms the result set entry (\"a+b\" in the example) and return immediately.\n    ** Note that the expression in the result set should have already been\n    ** resolved by the time the WHERE clause is resolved.\n    **\n    ** The ability to use an output result-set column in the WHERE, GROUP BY,\n    ** or HAVING clauses, or as part of a larger expression in the ORDER BY\n    ** clause is not standard SQL.  This is a (goofy) SQLite extension, that\n    ** is supported for backwards compatibility only. Hence, we issue a warning\n    ** on sqlite3_log() whenever the capability is used.\n    */\n    if( (pEList = pNC->pEList)!=0\n     && zTab==0\n     && cnt==0\n    ){\n      for(j=0; j<pEList->nExpr; j++){\n        char *zAs = pEList->a[j].zName;\n        if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){\n          Expr *pOrig;\n          assert( pExpr->pLeft==0 && pExpr->pRight==0 );\n          assert( pExpr->x.pList==0 );\n          assert( pExpr->x.pSelect==0 );\n          pOrig = pEList->a[j].pExpr;\n          if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){\n            sqlite3ErrorMsg(pParse, \"misuse of aliased aggregate %s\", zAs);\n            return WRC_Abort;\n          }\n          if( sqlite3ExprVectorSize(pOrig)!=1 ){\n            sqlite3ErrorMsg(pParse, \"row value misused\");\n            return WRC_Abort;\n          }\n          resolveAlias(pParse, pEList, j, pExpr, \"\", nSubquery);\n          cnt = 1;\n          pMatch = 0;\n          assert( zTab==0 && zDb==0 );\n          goto lookupname_end;\n        }\n      } \n    }\n\n    /* Advance to the next name context.  The loop will exit when either\n    ** we have a match (cnt>0) or when we run out of name contexts.\n    */\n    if( cnt==0 ){\n      pNC = pNC->pNext;\n      nSubquery++;\n    }\n  }\n\n  /*\n  ** If X and Y are NULL (in other words if only the column name Z is\n  ** supplied) and the value of Z is enclosed in double-quotes, then\n  ** Z is a string literal if it doesn't match any column names.  In that\n  ** case, we need to return right away and not make any changes to\n  ** pExpr.\n  **\n  ** Because no reference was made to outer contexts, the pNC->nRef\n  ** fields are not changed in any context.\n  */\n  if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){\n    pExpr->op = TK_STRING;\n    pExpr->pTab = 0;\n    return WRC_Prune;\n  }\n\n  /*\n  ** cnt==0 means there was not match.  cnt>1 means there were two or\n  ** more matches.  Either way, we have an error.\n  */\n  if( cnt!=1 ){\n    const char *zErr;\n    zErr = cnt==0 ? \"no such column\" : \"ambiguous column name\";\n    if( zDb ){\n      sqlite3ErrorMsg(pParse, \"%s: %s.%s.%s\", zErr, zDb, zTab, zCol);\n    }else if( zTab ){\n      sqlite3ErrorMsg(pParse, \"%s: %s.%s\", zErr, zTab, zCol);\n    }else{\n      sqlite3ErrorMsg(pParse, \"%s: %s\", zErr, zCol);\n    }\n    pParse->checkSchema = 1;\n    pTopNC->nErr++;\n  }\n\n  /* If a column from a table in pSrcList is referenced, then record\n  ** this fact in the pSrcList.a[].colUsed bitmask.  Column 0 causes\n  ** bit 0 to be set.  Column 1 sets bit 1.  And so forth.  If the\n  ** column number is greater than the number of bits in the bitmask\n  ** then set the high-order bit of the bitmask.\n  */\n  if( pExpr->iColumn>=0 && pMatch!=0 ){\n    int n = pExpr->iColumn;\n    testcase( n==BMS-1 );\n    if( n>=BMS ){\n      n = BMS-1;\n    }\n    assert( pMatch->iCursor==pExpr->iTable );\n    pMatch->colUsed |= ((Bitmask)1)<<n;\n  }\n\n  /* Clean up and return\n  */\n  sqlite3ExprDelete(db, pExpr->pLeft);\n  pExpr->pLeft = 0;\n  sqlite3ExprDelete(db, pExpr->pRight);\n  pExpr->pRight = 0;\n  pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);\nlookupname_end:\n  if( cnt==1 ){\n    assert( pNC!=0 );\n    if( !ExprHasProperty(pExpr, EP_Alias) ){\n      sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);\n    }\n    /* Increment the nRef value on all name contexts from TopNC up to\n    ** the point where the name matched. */\n    for(;;){\n      assert( pTopNC!=0 );\n      pTopNC->nRef++;\n      if( pTopNC==pNC ) break;\n      pTopNC = pTopNC->pNext;\n    }\n    return WRC_Prune;\n  } else {\n    return WRC_Abort;\n  }\n}\n\n/*\n** Allocate and return a pointer to an expression to load the column iCol\n** from datasource iSrc in SrcList pSrc.\n*/\nExpr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){\n  Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);\n  if( p ){\n    struct SrcList_item *pItem = &pSrc->a[iSrc];\n    p->pTab = pItem->pTab;\n    p->iTable = pItem->iCursor;\n    if( p->pTab->iPKey==iCol ){\n      p->iColumn = -1;\n    }else{\n      p->iColumn = (ynVar)iCol;\n      testcase( iCol==BMS );\n      testcase( iCol==BMS-1 );\n      pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);\n    }\n    ExprSetProperty(p, EP_Resolved);\n  }\n  return p;\n}\n\n/*\n** Report an error that an expression is not valid for some set of\n** pNC->ncFlags values determined by validMask.\n*/\nstatic void notValid(\n  Parse *pParse,       /* Leave error message here */\n  NameContext *pNC,    /* The name context */\n  const char *zMsg,    /* Type of error */\n  int validMask        /* Set of contexts for which prohibited */\n){\n  assert( (validMask&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr))==0 );\n  if( (pNC->ncFlags & validMask)!=0 ){\n    const char *zIn = \"partial index WHERE clauses\";\n    if( pNC->ncFlags & NC_IdxExpr )      zIn = \"index expressions\";\n#ifndef SQLITE_OMIT_CHECK\n    else if( pNC->ncFlags & NC_IsCheck ) zIn = \"CHECK constraints\";\n#endif\n    sqlite3ErrorMsg(pParse, \"%s prohibited in %s\", zMsg, zIn);\n  }\n}\n\n/*\n** Expression p should encode a floating point value between 1.0 and 0.0.\n** Return 1024 times this value.  Or return -1 if p is not a floating point\n** value between 1.0 and 0.0.\n*/\nstatic int exprProbability(Expr *p){\n  double r = -1.0;\n  if( p->op!=TK_FLOAT ) return -1;\n  sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8);\n  assert( r>=0.0 );\n  if( r>1.0 ) return -1;\n  return (int)(r*134217728.0);\n}\n\n/*\n** This routine is callback for sqlite3WalkExpr().\n**\n** Resolve symbolic names into TK_COLUMN operators for the current\n** node in the expression tree.  Return 0 to continue the search down\n** the tree or 2 to abort the tree walk.\n**\n** This routine also does error checking and name resolution for\n** function names.  The operator for aggregate functions is changed\n** to TK_AGG_FUNCTION.\n*/\nstatic int resolveExprStep(Walker *pWalker, Expr *pExpr){\n  NameContext *pNC;\n  Parse *pParse;\n\n  pNC = pWalker->u.pNC;\n  assert( pNC!=0 );\n  pParse = pNC->pParse;\n  assert( pParse==pWalker->pParse );\n\n  if( ExprHasProperty(pExpr, EP_Resolved) ) return WRC_Prune;\n  ExprSetProperty(pExpr, EP_Resolved);\n#ifndef NDEBUG\n  if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){\n    SrcList *pSrcList = pNC->pSrcList;\n    int i;\n    for(i=0; i<pNC->pSrcList->nSrc; i++){\n      assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab);\n    }\n  }\n#endif\n  switch( pExpr->op ){\n\n#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)\n    /* The special operator TK_ROW means use the rowid for the first\n    ** column in the FROM clause.  This is used by the LIMIT and ORDER BY\n    ** clause processing on UPDATE and DELETE statements.\n    */\n    case TK_ROW: {\n      SrcList *pSrcList = pNC->pSrcList;\n      struct SrcList_item *pItem;\n      assert( pSrcList && pSrcList->nSrc==1 );\n      pItem = pSrcList->a; \n      pExpr->op = TK_COLUMN;\n      pExpr->pTab = pItem->pTab;\n      pExpr->iTable = pItem->iCursor;\n      pExpr->iColumn = -1;\n      pExpr->affinity = SQLITE_AFF_INTEGER;\n      break;\n    }\n#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT)\n          && !defined(SQLITE_OMIT_SUBQUERY) */\n\n    /* A lone identifier is the name of a column.\n    */\n    case TK_ID: {\n      return lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr);\n    }\n  \n    /* A table name and column name:     ID.ID\n    ** Or a database, table and column:  ID.ID.ID\n    */\n    case TK_DOT: {\n      const char *zColumn;\n      const char *zTable;\n      const char *zDb;\n      Expr *pRight;\n\n      /* if( pSrcList==0 ) break; */\n      notValid(pParse, pNC, \"the \\\".\\\" operator\", NC_IdxExpr);\n      pRight = pExpr->pRight;\n      if( pRight->op==TK_ID ){\n        zDb = 0;\n        zTable = pExpr->pLeft->u.zToken;\n        zColumn = pRight->u.zToken;\n      }else{\n        assert( pRight->op==TK_DOT );\n        zDb = pExpr->pLeft->u.zToken;\n        zTable = pRight->pLeft->u.zToken;\n        zColumn = pRight->pRight->u.zToken;\n      }\n      return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr);\n    }\n\n    /* Resolve function names\n    */\n    case TK_FUNCTION: {\n      ExprList *pList = pExpr->x.pList;    /* The argument list */\n      int n = pList ? pList->nExpr : 0;    /* Number of arguments */\n      int no_such_func = 0;       /* True if no such function exists */\n      int wrong_num_args = 0;     /* True if wrong number of arguments */\n      int is_agg = 0;             /* True if is an aggregate function */\n      int nId;                    /* Number of characters in function name */\n      const char *zId;            /* The function name. */\n      FuncDef *pDef;              /* Information about the function */\n      u8 enc = ENC(pParse->db);   /* The database encoding */\n\n      assert( !ExprHasProperty(pExpr, EP_xIsSelect) );\n      zId = pExpr->u.zToken;\n      nId = sqlite3Strlen30(zId);\n      pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);\n      if( pDef==0 ){\n        pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);\n        if( pDef==0 ){\n          no_such_func = 1;\n        }else{\n          wrong_num_args = 1;\n        }\n      }else{\n        is_agg = pDef->xFinalize!=0;\n        if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){\n          ExprSetProperty(pExpr, EP_Unlikely|EP_Skip);\n          if( n==2 ){\n            pExpr->iTable = exprProbability(pList->a[1].pExpr);\n            if( pExpr->iTable<0 ){\n              sqlite3ErrorMsg(pParse,\n                \"second argument to likelihood() must be a \"\n                \"constant between 0.0 and 1.0\");\n              pNC->nErr++;\n            }\n          }else{\n            /* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is\n            ** equivalent to likelihood(X, 0.0625).\n            ** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is\n            ** short-hand for likelihood(X,0.0625).\n            ** EVIDENCE-OF: R-36850-34127 The likely(X) function is short-hand\n            ** for likelihood(X,0.9375).\n            ** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent\n            ** to likelihood(X,0.9375). */\n            /* TUNING: unlikely() probability is 0.0625.  likely() is 0.9375 */\n            pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;\n          }             \n        }\n#ifndef SQLITE_OMIT_AUTHORIZATION\n        {\n          int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0);\n          if( auth!=SQLITE_OK ){\n            if( auth==SQLITE_DENY ){\n              sqlite3ErrorMsg(pParse, \"not authorized to use function: %s\",\n                                      pDef->zName);\n              pNC->nErr++;\n            }\n            pExpr->op = TK_NULL;\n            return WRC_Prune;\n          }\n        }\n#endif\n        if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){\n          /* For the purposes of the EP_ConstFunc flag, date and time\n          ** functions and other functions that change slowly are considered\n          ** constant because they are constant for the duration of one query */\n          ExprSetProperty(pExpr,EP_ConstFunc);\n        }\n        if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){\n          /* Date/time functions that use 'now', and other functions like\n          ** sqlite_version() that might change over time cannot be used\n          ** in an index. */\n          notValid(pParse, pNC, \"non-deterministic functions\",\n                   NC_IdxExpr|NC_PartIdx);\n        }\n      }\n      if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){\n        sqlite3ErrorMsg(pParse, \"misuse of aggregate function %.*s()\", nId,zId);\n        pNC->nErr++;\n        is_agg = 0;\n      }else if( no_such_func && pParse->db->init.busy==0\n#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION\n                && pParse->explain==0\n#endif\n      ){\n        sqlite3ErrorMsg(pParse, \"no such function: %.*s\", nId, zId);\n        pNC->nErr++;\n      }else if( wrong_num_args ){\n        sqlite3ErrorMsg(pParse,\"wrong number of arguments to function %.*s()\",\n             nId, zId);\n        pNC->nErr++;\n      }\n      if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg;\n      sqlite3WalkExprList(pWalker, pList);\n      if( is_agg ){\n        NameContext *pNC2 = pNC;\n        pExpr->op = TK_AGG_FUNCTION;\n        pExpr->op2 = 0;\n        while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){\n          pExpr->op2++;\n          pNC2 = pNC2->pNext;\n        }\n        assert( pDef!=0 );\n        if( pNC2 ){\n          assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg );\n          testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 );\n          pNC2->ncFlags |= NC_HasAgg | (pDef->funcFlags & SQLITE_FUNC_MINMAX);\n\n        }\n        pNC->ncFlags |= NC_AllowAgg;\n      }\n      /* FIX ME:  Compute pExpr->affinity based on the expected return\n      ** type of the function \n      */\n      return WRC_Prune;\n    }\n#ifndef SQLITE_OMIT_SUBQUERY\n    case TK_SELECT:\n    case TK_EXISTS:  testcase( pExpr->op==TK_EXISTS );\n#endif\n    case TK_IN: {\n      testcase( pExpr->op==TK_IN );\n      if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n        int nRef = pNC->nRef;\n        notValid(pParse, pNC, \"subqueries\", NC_IsCheck|NC_PartIdx|NC_IdxExpr);\n        sqlite3WalkSelect(pWalker, pExpr->x.pSelect);\n        assert( pNC->nRef>=nRef );\n        if( nRef!=pNC->nRef ){\n          ExprSetProperty(pExpr, EP_VarSelect);\n          pNC->ncFlags |= NC_VarSelect;\n        }\n      }\n      break;\n    }\n    case TK_VARIABLE: {\n      notValid(pParse, pNC, \"parameters\", NC_IsCheck|NC_PartIdx|NC_IdxExpr);\n      break;\n    }\n    case TK_BETWEEN:\n    case TK_EQ:\n    case TK_NE:\n    case TK_LT:\n    case TK_LE:\n    case TK_GT:\n    case TK_GE:\n    case TK_IS:\n    case TK_ISNOT: {\n      int nLeft, nRight;\n      if( pParse->db->mallocFailed ) break;\n      assert( pExpr->pLeft!=0 );\n      nLeft = sqlite3ExprVectorSize(pExpr->pLeft);\n      if( pExpr->op==TK_BETWEEN ){\n        nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[0].pExpr);\n        if( nRight==nLeft ){\n          nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[1].pExpr);\n        }\n      }else{\n        assert( pExpr->pRight!=0 );\n        nRight = sqlite3ExprVectorSize(pExpr->pRight);\n      }\n      if( nLeft!=nRight ){\n        testcase( pExpr->op==TK_EQ );\n        testcase( pExpr->op==TK_NE );\n        testcase( pExpr->op==TK_LT );\n        testcase( pExpr->op==TK_LE );\n        testcase( pExpr->op==TK_GT );\n        testcase( pExpr->op==TK_GE );\n        testcase( pExpr->op==TK_IS );\n        testcase( pExpr->op==TK_ISNOT );\n        testcase( pExpr->op==TK_BETWEEN );\n        sqlite3ErrorMsg(pParse, \"row value misused\");\n      }\n      break; \n    }\n  }\n  return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;\n}\n\n/*\n** pEList is a list of expressions which are really the result set of the\n** a SELECT statement.  pE is a term in an ORDER BY or GROUP BY clause.\n** This routine checks to see if pE is a simple identifier which corresponds\n** to the AS-name of one of the terms of the expression list.  If it is,\n** this routine return an integer between 1 and N where N is the number of\n** elements in pEList, corresponding to the matching entry.  If there is\n** no match, or if pE is not a simple identifier, then this routine\n** return 0.\n**\n** pEList has been resolved.  pE has not.\n*/\nstatic int resolveAsName(\n  Parse *pParse,     /* Parsing context for error messages */\n  ExprList *pEList,  /* List of expressions to scan */\n  Expr *pE           /* Expression we are trying to match */\n){\n  int i;             /* Loop counter */\n\n  UNUSED_PARAMETER(pParse);\n\n  if( pE->op==TK_ID ){\n    char *zCol = pE->u.zToken;\n    for(i=0; i<pEList->nExpr; i++){\n      char *zAs = pEList->a[i].zName;\n      if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){\n        return i+1;\n      }\n    }\n  }\n  return 0;\n}\n\n/*\n** pE is a pointer to an expression which is a single term in the\n** ORDER BY of a compound SELECT.  The expression has not been\n** name resolved.\n**\n** At the point this routine is called, we already know that the\n** ORDER BY term is not an integer index into the result set.  That\n** case is handled by the calling routine.\n**\n** Attempt to match pE against result set columns in the left-most\n** SELECT statement.  Return the index i of the matching column,\n** as an indication to the caller that it should sort by the i-th column.\n** The left-most column is 1.  In other words, the value returned is the\n** same integer value that would be used in the SQL statement to indicate\n** the column.\n**\n** If there is no match, return 0.  Return -1 if an error occurs.\n*/\nstatic int resolveOrderByTermToExprList(\n  Parse *pParse,     /* Parsing context for error messages */\n  Select *pSelect,   /* The SELECT statement with the ORDER BY clause */\n  Expr *pE           /* The specific ORDER BY term */\n){\n  int i;             /* Loop counter */\n  ExprList *pEList;  /* The columns of the result set */\n  NameContext nc;    /* Name context for resolving pE */\n  sqlite3 *db;       /* Database connection */\n  int rc;            /* Return code from subprocedures */\n  u8 savedSuppErr;   /* Saved value of db->suppressErr */\n\n  assert( sqlite3ExprIsInteger(pE, &i)==0 );\n  pEList = pSelect->pEList;\n\n  /* Resolve all names in the ORDER BY term expression\n  */\n  memset(&nc, 0, sizeof(nc));\n  nc.pParse = pParse;\n  nc.pSrcList = pSelect->pSrc;\n  nc.pEList = pEList;\n  nc.ncFlags = NC_AllowAgg;\n  nc.nErr = 0;\n  db = pParse->db;\n  savedSuppErr = db->suppressErr;\n  db->suppressErr = 1;\n  rc = sqlite3ResolveExprNames(&nc, pE);\n  db->suppressErr = savedSuppErr;\n  if( rc ) return 0;\n\n  /* Try to match the ORDER BY expression against an expression\n  ** in the result set.  Return an 1-based index of the matching\n  ** result-set entry.\n  */\n  for(i=0; i<pEList->nExpr; i++){\n    if( sqlite3ExprCompare(pEList->a[i].pExpr, pE, -1)<2 ){\n      return i+1;\n    }\n  }\n\n  /* If no match, return 0. */\n  return 0;\n}\n\n/*\n** Generate an ORDER BY or GROUP BY term out-of-range error.\n*/\nstatic void resolveOutOfRangeError(\n  Parse *pParse,         /* The error context into which to write the error */\n  const char *zType,     /* \"ORDER\" or \"GROUP\" */\n  int i,                 /* The index (1-based) of the term out of range */\n  int mx                 /* Largest permissible value of i */\n){\n  sqlite3ErrorMsg(pParse, \n    \"%r %s BY term out of range - should be \"\n    \"between 1 and %d\", i, zType, mx);\n}\n\n/*\n** Analyze the ORDER BY clause in a compound SELECT statement.   Modify\n** each term of the ORDER BY clause is a constant integer between 1\n** and N where N is the number of columns in the compound SELECT.\n**\n** ORDER BY terms that are already an integer between 1 and N are\n** unmodified.  ORDER BY terms that are integers outside the range of\n** 1 through N generate an error.  ORDER BY terms that are expressions\n** are matched against result set expressions of compound SELECT\n** beginning with the left-most SELECT and working toward the right.\n** At the first match, the ORDER BY expression is transformed into\n** the integer column number.\n**\n** Return the number of errors seen.\n*/\nstatic int resolveCompoundOrderBy(\n  Parse *pParse,        /* Parsing context.  Leave error messages here */\n  Select *pSelect       /* The SELECT statement containing the ORDER BY */\n){\n  int i;\n  ExprList *pOrderBy;\n  ExprList *pEList;\n  sqlite3 *db;\n  int moreToDo = 1;\n\n  pOrderBy = pSelect->pOrderBy;\n  if( pOrderBy==0 ) return 0;\n  db = pParse->db;\n#if SQLITE_MAX_COLUMN\n  if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){\n    sqlite3ErrorMsg(pParse, \"too many terms in ORDER BY clause\");\n    return 1;\n  }\n#endif\n  for(i=0; i<pOrderBy->nExpr; i++){\n    pOrderBy->a[i].done = 0;\n  }\n  pSelect->pNext = 0;\n  while( pSelect->pPrior ){\n    pSelect->pPrior->pNext = pSelect;\n    pSelect = pSelect->pPrior;\n  }\n  while( pSelect && moreToDo ){\n    struct ExprList_item *pItem;\n    moreToDo = 0;\n    pEList = pSelect->pEList;\n    assert( pEList!=0 );\n    for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){\n      int iCol = -1;\n      Expr *pE, *pDup;\n      if( pItem->done ) continue;\n      pE = sqlite3ExprSkipCollate(pItem->pExpr);\n      if( sqlite3ExprIsInteger(pE, &iCol) ){\n        if( iCol<=0 || iCol>pEList->nExpr ){\n          resolveOutOfRangeError(pParse, \"ORDER\", i+1, pEList->nExpr);\n          return 1;\n        }\n      }else{\n        iCol = resolveAsName(pParse, pEList, pE);\n        if( iCol==0 ){\n          pDup = sqlite3ExprDup(db, pE, 0);\n          if( !db->mallocFailed ){\n            assert(pDup);\n            iCol = resolveOrderByTermToExprList(pParse, pSelect, pDup);\n          }\n          sqlite3ExprDelete(db, pDup);\n        }\n      }\n      if( iCol>0 ){\n        /* Convert the ORDER BY term into an integer column number iCol,\n        ** taking care to preserve the COLLATE clause if it exists */\n        Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);\n        if( pNew==0 ) return 1;\n        pNew->flags |= EP_IntValue;\n        pNew->u.iValue = iCol;\n        if( pItem->pExpr==pE ){\n          pItem->pExpr = pNew;\n        }else{\n          Expr *pParent = pItem->pExpr;\n          assert( pParent->op==TK_COLLATE );\n          while( pParent->pLeft->op==TK_COLLATE ) pParent = pParent->pLeft;\n          assert( pParent->pLeft==pE );\n          pParent->pLeft = pNew;\n        }\n        sqlite3ExprDelete(db, pE);\n        pItem->u.x.iOrderByCol = (u16)iCol;\n        pItem->done = 1;\n      }else{\n        moreToDo = 1;\n      }\n    }\n    pSelect = pSelect->pNext;\n  }\n  for(i=0; i<pOrderBy->nExpr; i++){\n    if( pOrderBy->a[i].done==0 ){\n      sqlite3ErrorMsg(pParse, \"%r ORDER BY term does not match any \"\n            \"column in the result set\", i+1);\n      return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** Check every term in the ORDER BY or GROUP BY clause pOrderBy of\n** the SELECT statement pSelect.  If any term is reference to a\n** result set expression (as determined by the ExprList.a.u.x.iOrderByCol\n** field) then convert that term into a copy of the corresponding result set\n** column.\n**\n** If any errors are detected, add an error message to pParse and\n** return non-zero.  Return zero if no errors are seen.\n*/\nint sqlite3ResolveOrderGroupBy(\n  Parse *pParse,        /* Parsing context.  Leave error messages here */\n  Select *pSelect,      /* The SELECT statement containing the clause */\n  ExprList *pOrderBy,   /* The ORDER BY or GROUP BY clause to be processed */\n  const char *zType     /* \"ORDER\" or \"GROUP\" */\n){\n  int i;\n  sqlite3 *db = pParse->db;\n  ExprList *pEList;\n  struct ExprList_item *pItem;\n\n  if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;\n#if SQLITE_MAX_COLUMN\n  if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){\n    sqlite3ErrorMsg(pParse, \"too many terms in %s BY clause\", zType);\n    return 1;\n  }\n#endif\n  pEList = pSelect->pEList;\n  assert( pEList!=0 );  /* sqlite3SelectNew() guarantees this */\n  for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){\n    if( pItem->u.x.iOrderByCol ){\n      if( pItem->u.x.iOrderByCol>pEList->nExpr ){\n        resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);\n        return 1;\n      }\n      resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,\n                   zType,0);\n    }\n  }\n  return 0;\n}\n\n/*\n** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect.\n** The Name context of the SELECT statement is pNC.  zType is either\n** \"ORDER\" or \"GROUP\" depending on which type of clause pOrderBy is.\n**\n** This routine resolves each term of the clause into an expression.\n** If the order-by term is an integer I between 1 and N (where N is the\n** number of columns in the result set of the SELECT) then the expression\n** in the resolution is a copy of the I-th result-set expression.  If\n** the order-by term is an identifier that corresponds to the AS-name of\n** a result-set expression, then the term resolves to a copy of the\n** result-set expression.  Otherwise, the expression is resolved in\n** the usual way - using sqlite3ResolveExprNames().\n**\n** This routine returns the number of errors.  If errors occur, then\n** an appropriate error message might be left in pParse.  (OOM errors\n** excepted.)\n*/\nstatic int resolveOrderGroupBy(\n  NameContext *pNC,     /* The name context of the SELECT statement */\n  Select *pSelect,      /* The SELECT statement holding pOrderBy */\n  ExprList *pOrderBy,   /* An ORDER BY or GROUP BY clause to resolve */\n  const char *zType     /* Either \"ORDER\" or \"GROUP\", as appropriate */\n){\n  int i, j;                      /* Loop counters */\n  int iCol;                      /* Column number */\n  struct ExprList_item *pItem;   /* A term of the ORDER BY clause */\n  Parse *pParse;                 /* Parsing context */\n  int nResult;                   /* Number of terms in the result set */\n\n  if( pOrderBy==0 ) return 0;\n  nResult = pSelect->pEList->nExpr;\n  pParse = pNC->pParse;\n  for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){\n    Expr *pE = pItem->pExpr;\n    Expr *pE2 = sqlite3ExprSkipCollate(pE);\n    if( zType[0]!='G' ){\n      iCol = resolveAsName(pParse, pSelect->pEList, pE2);\n      if( iCol>0 ){\n        /* If an AS-name match is found, mark this ORDER BY column as being\n        ** a copy of the iCol-th result-set column.  The subsequent call to\n        ** sqlite3ResolveOrderGroupBy() will convert the expression to a\n        ** copy of the iCol-th result-set expression. */\n        pItem->u.x.iOrderByCol = (u16)iCol;\n        continue;\n      }\n    }\n    if( sqlite3ExprIsInteger(pE2, &iCol) ){\n      /* The ORDER BY term is an integer constant.  Again, set the column\n      ** number so that sqlite3ResolveOrderGroupBy() will convert the\n      ** order-by term to a copy of the result-set expression */\n      if( iCol<1 || iCol>0xffff ){\n        resolveOutOfRangeError(pParse, zType, i+1, nResult);\n        return 1;\n      }\n      pItem->u.x.iOrderByCol = (u16)iCol;\n      continue;\n    }\n\n    /* Otherwise, treat the ORDER BY term as an ordinary expression */\n    pItem->u.x.iOrderByCol = 0;\n    if( sqlite3ResolveExprNames(pNC, pE) ){\n      return 1;\n    }\n    for(j=0; j<pSelect->pEList->nExpr; j++){\n      if( sqlite3ExprCompare(pE, pSelect->pEList->a[j].pExpr, -1)==0 ){\n        pItem->u.x.iOrderByCol = j+1;\n      }\n    }\n  }\n  return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType);\n}\n\n/*\n** Resolve names in the SELECT statement p and all of its descendants.\n*/\nstatic int resolveSelectStep(Walker *pWalker, Select *p){\n  NameContext *pOuterNC;  /* Context that contains this SELECT */\n  NameContext sNC;        /* Name context of this SELECT */\n  int isCompound;         /* True if p is a compound select */\n  int nCompound;          /* Number of compound terms processed so far */\n  Parse *pParse;          /* Parsing context */\n  int i;                  /* Loop counter */\n  ExprList *pGroupBy;     /* The GROUP BY clause */\n  Select *pLeftmost;      /* Left-most of SELECT of a compound */\n  sqlite3 *db;            /* Database connection */\n  \n\n  assert( p!=0 );\n  if( p->selFlags & SF_Resolved ){\n    return WRC_Prune;\n  }\n  pOuterNC = pWalker->u.pNC;\n  pParse = pWalker->pParse;\n  db = pParse->db;\n\n  /* Normally sqlite3SelectExpand() will be called first and will have\n  ** already expanded this SELECT.  However, if this is a subquery within\n  ** an expression, sqlite3ResolveExprNames() will be called without a\n  ** prior call to sqlite3SelectExpand().  When that happens, let\n  ** sqlite3SelectPrep() do all of the processing for this SELECT.\n  ** sqlite3SelectPrep() will invoke both sqlite3SelectExpand() and\n  ** this routine in the correct order.\n  */\n  if( (p->selFlags & SF_Expanded)==0 ){\n    sqlite3SelectPrep(pParse, p, pOuterNC);\n    return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune;\n  }\n\n  isCompound = p->pPrior!=0;\n  nCompound = 0;\n  pLeftmost = p;\n  while( p ){\n    assert( (p->selFlags & SF_Expanded)!=0 );\n    assert( (p->selFlags & SF_Resolved)==0 );\n    p->selFlags |= SF_Resolved;\n\n    /* Resolve the expressions in the LIMIT and OFFSET clauses. These\n    ** are not allowed to refer to any names, so pass an empty NameContext.\n    */\n    memset(&sNC, 0, sizeof(sNC));\n    sNC.pParse = pParse;\n    if( sqlite3ResolveExprNames(&sNC, p->pLimit) ||\n        sqlite3ResolveExprNames(&sNC, p->pOffset) ){\n      return WRC_Abort;\n    }\n\n    /* If the SF_Converted flags is set, then this Select object was\n    ** was created by the convertCompoundSelectToSubquery() function.\n    ** In this case the ORDER BY clause (p->pOrderBy) should be resolved\n    ** as if it were part of the sub-query, not the parent. This block\n    ** moves the pOrderBy down to the sub-query. It will be moved back\n    ** after the names have been resolved.  */\n    if( p->selFlags & SF_Converted ){\n      Select *pSub = p->pSrc->a[0].pSelect;\n      assert( p->pSrc->nSrc==1 && p->pOrderBy );\n      assert( pSub->pPrior && pSub->pOrderBy==0 );\n      pSub->pOrderBy = p->pOrderBy;\n      p->pOrderBy = 0;\n    }\n  \n    /* Recursively resolve names in all subqueries\n    */\n    for(i=0; i<p->pSrc->nSrc; i++){\n      struct SrcList_item *pItem = &p->pSrc->a[i];\n      if( pItem->pSelect ){\n        NameContext *pNC;         /* Used to iterate name contexts */\n        int nRef = 0;             /* Refcount for pOuterNC and outer contexts */\n        const char *zSavedContext = pParse->zAuthContext;\n\n        /* Count the total number of references to pOuterNC and all of its\n        ** parent contexts. After resolving references to expressions in\n        ** pItem->pSelect, check if this value has changed. If so, then\n        ** SELECT statement pItem->pSelect must be correlated. Set the\n        ** pItem->fg.isCorrelated flag if this is the case. */\n        for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef += pNC->nRef;\n\n        if( pItem->zName ) pParse->zAuthContext = pItem->zName;\n        sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC);\n        pParse->zAuthContext = zSavedContext;\n        if( pParse->nErr || db->mallocFailed ) return WRC_Abort;\n\n        for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef -= pNC->nRef;\n        assert( pItem->fg.isCorrelated==0 && nRef<=0 );\n        pItem->fg.isCorrelated = (nRef!=0);\n      }\n    }\n  \n    /* Set up the local name-context to pass to sqlite3ResolveExprNames() to\n    ** resolve the result-set expression list.\n    */\n    sNC.ncFlags = NC_AllowAgg;\n    sNC.pSrcList = p->pSrc;\n    sNC.pNext = pOuterNC;\n  \n    /* Resolve names in the result set. */\n    if( sqlite3ResolveExprListNames(&sNC, p->pEList) ) return WRC_Abort;\n  \n    /* If there are no aggregate functions in the result-set, and no GROUP BY \n    ** expression, do not allow aggregates in any of the other expressions.\n    */\n    assert( (p->selFlags & SF_Aggregate)==0 );\n    pGroupBy = p->pGroupBy;\n    if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){\n      assert( NC_MinMaxAgg==SF_MinMaxAgg );\n      p->selFlags |= SF_Aggregate | (sNC.ncFlags&NC_MinMaxAgg);\n    }else{\n      sNC.ncFlags &= ~NC_AllowAgg;\n    }\n  \n    /* If a HAVING clause is present, then there must be a GROUP BY clause.\n    */\n    if( p->pHaving && !pGroupBy ){\n      sqlite3ErrorMsg(pParse, \"a GROUP BY clause is required before HAVING\");\n      return WRC_Abort;\n    }\n  \n    /* Add the output column list to the name-context before parsing the\n    ** other expressions in the SELECT statement. This is so that\n    ** expressions in the WHERE clause (etc.) can refer to expressions by\n    ** aliases in the result set.\n    **\n    ** Minor point: If this is the case, then the expression will be\n    ** re-evaluated for each reference to it.\n    */\n    sNC.pEList = p->pEList;\n    if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;\n    if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;\n\n    /* Resolve names in table-valued-function arguments */\n    for(i=0; i<p->pSrc->nSrc; i++){\n      struct SrcList_item *pItem = &p->pSrc->a[i];\n      if( pItem->fg.isTabFunc\n       && sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg) \n      ){\n        return WRC_Abort;\n      }\n    }\n\n    /* The ORDER BY and GROUP BY clauses may not refer to terms in\n    ** outer queries \n    */\n    sNC.pNext = 0;\n    sNC.ncFlags |= NC_AllowAgg;\n\n    /* If this is a converted compound query, move the ORDER BY clause from \n    ** the sub-query back to the parent query. At this point each term\n    ** within the ORDER BY clause has been transformed to an integer value.\n    ** These integers will be replaced by copies of the corresponding result\n    ** set expressions by the call to resolveOrderGroupBy() below.  */\n    if( p->selFlags & SF_Converted ){\n      Select *pSub = p->pSrc->a[0].pSelect;\n      p->pOrderBy = pSub->pOrderBy;\n      pSub->pOrderBy = 0;\n    }\n\n    /* Process the ORDER BY clause for singleton SELECT statements.\n    ** The ORDER BY clause for compounds SELECT statements is handled\n    ** below, after all of the result-sets for all of the elements of\n    ** the compound have been resolved.\n    **\n    ** If there is an ORDER BY clause on a term of a compound-select other\n    ** than the right-most term, then that is a syntax error.  But the error\n    ** is not detected until much later, and so we need to go ahead and\n    ** resolve those symbols on the incorrect ORDER BY for consistency.\n    */\n    if( isCompound<=nCompound  /* Defer right-most ORDER BY of a compound */\n     && resolveOrderGroupBy(&sNC, p, p->pOrderBy, \"ORDER\")\n    ){\n      return WRC_Abort;\n    }\n    if( db->mallocFailed ){\n      return WRC_Abort;\n    }\n  \n    /* Resolve the GROUP BY clause.  At the same time, make sure \n    ** the GROUP BY clause does not contain aggregate functions.\n    */\n    if( pGroupBy ){\n      struct ExprList_item *pItem;\n    \n      if( resolveOrderGroupBy(&sNC, p, pGroupBy, \"GROUP\") || db->mallocFailed ){\n        return WRC_Abort;\n      }\n      for(i=0, pItem=pGroupBy->a; i<pGroupBy->nExpr; i++, pItem++){\n        if( ExprHasProperty(pItem->pExpr, EP_Agg) ){\n          sqlite3ErrorMsg(pParse, \"aggregate functions are not allowed in \"\n              \"the GROUP BY clause\");\n          return WRC_Abort;\n        }\n      }\n    }\n\n    /* If this is part of a compound SELECT, check that it has the right\n    ** number of expressions in the select list. */\n    if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){\n      sqlite3SelectWrongNumTermsError(pParse, p->pNext);\n      return WRC_Abort;\n    }\n\n    /* Advance to the next term of the compound\n    */\n    p = p->pPrior;\n    nCompound++;\n  }\n\n  /* Resolve the ORDER BY on a compound SELECT after all terms of\n  ** the compound have been resolved.\n  */\n  if( isCompound && resolveCompoundOrderBy(pParse, pLeftmost) ){\n    return WRC_Abort;\n  }\n\n  return WRC_Prune;\n}\n\n/*\n** This routine walks an expression tree and resolves references to\n** table columns and result-set columns.  At the same time, do error\n** checking on function usage and set a flag if any aggregate functions\n** are seen.\n**\n** To resolve table columns references we look for nodes (or subtrees) of the \n** form X.Y.Z or Y.Z or just Z where\n**\n**      X:   The name of a database.  Ex:  \"main\" or \"temp\" or\n**           the symbolic name assigned to an ATTACH-ed database.\n**\n**      Y:   The name of a table in a FROM clause.  Or in a trigger\n**           one of the special names \"old\" or \"new\".\n**\n**      Z:   The name of a column in table Y.\n**\n** The node at the root of the subtree is modified as follows:\n**\n**    Expr.op        Changed to TK_COLUMN\n**    Expr.pTab      Points to the Table object for X.Y\n**    Expr.iColumn   The column index in X.Y.  -1 for the rowid.\n**    Expr.iTable    The VDBE cursor number for X.Y\n**\n**\n** To resolve result-set references, look for expression nodes of the\n** form Z (with no X and Y prefix) where the Z matches the right-hand\n** size of an AS clause in the result-set of a SELECT.  The Z expression\n** is replaced by a copy of the left-hand side of the result-set expression.\n** Table-name and function resolution occurs on the substituted expression\n** tree.  For example, in:\n**\n**      SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x;\n**\n** The \"x\" term of the order by is replaced by \"a+b\" to render:\n**\n**      SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b;\n**\n** Function calls are checked to make sure that the function is \n** defined and that the correct number of arguments are specified.\n** If the function is an aggregate function, then the NC_HasAgg flag is\n** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION.\n** If an expression contains aggregate functions then the EP_Agg\n** property on the expression is set.\n**\n** An error message is left in pParse if anything is amiss.  The number\n** if errors is returned.\n*/\nint sqlite3ResolveExprNames( \n  NameContext *pNC,       /* Namespace to resolve expressions in. */\n  Expr *pExpr             /* The expression to be analyzed. */\n){\n  u16 savedHasAgg;\n  Walker w;\n\n  if( pExpr==0 ) return 0;\n#if SQLITE_MAX_EXPR_DEPTH>0\n  {\n    Parse *pParse = pNC->pParse;\n    if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){\n      return 1;\n    }\n    pParse->nHeight += pExpr->nHeight;\n  }\n#endif\n  savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg);\n  pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg);\n  w.pParse = pNC->pParse;\n  w.xExprCallback = resolveExprStep;\n  w.xSelectCallback = resolveSelectStep;\n  w.xSelectCallback2 = 0;\n  w.walkerDepth = 0;\n  w.eCode = 0;\n  w.u.pNC = pNC;\n  sqlite3WalkExpr(&w, pExpr);\n#if SQLITE_MAX_EXPR_DEPTH>0\n  pNC->pParse->nHeight -= pExpr->nHeight;\n#endif\n  if( pNC->nErr>0 || w.pParse->nErr>0 ){\n    ExprSetProperty(pExpr, EP_Error);\n  }\n  if( pNC->ncFlags & NC_HasAgg ){\n    ExprSetProperty(pExpr, EP_Agg);\n  }\n  pNC->ncFlags |= savedHasAgg;\n  return ExprHasProperty(pExpr, EP_Error);\n}\n\n/*\n** Resolve all names for all expression in an expression list.  This is\n** just like sqlite3ResolveExprNames() except that it works for an expression\n** list rather than a single expression.\n*/\nint sqlite3ResolveExprListNames( \n  NameContext *pNC,       /* Namespace to resolve expressions in. */\n  ExprList *pList         /* The expression list to be analyzed. */\n){\n  int i;\n  if( pList ){\n    for(i=0; i<pList->nExpr; i++){\n      if( sqlite3ResolveExprNames(pNC, pList->a[i].pExpr) ) return WRC_Abort;\n    }\n  }\n  return WRC_Continue;\n}\n\n/*\n** Resolve all names in all expressions of a SELECT and in all\n** decendents of the SELECT, including compounds off of p->pPrior,\n** subqueries in expressions, and subqueries used as FROM clause\n** terms.\n**\n** See sqlite3ResolveExprNames() for a description of the kinds of\n** transformations that occur.\n**\n** All SELECT statements should have been expanded using\n** sqlite3SelectExpand() prior to invoking this routine.\n*/\nvoid sqlite3ResolveSelectNames(\n  Parse *pParse,         /* The parser context */\n  Select *p,             /* The SELECT statement being coded. */\n  NameContext *pOuterNC  /* Name context for parent SELECT statement */\n){\n  Walker w;\n\n  assert( p!=0 );\n  memset(&w, 0, sizeof(w));\n  w.xExprCallback = resolveExprStep;\n  w.xSelectCallback = resolveSelectStep;\n  w.pParse = pParse;\n  w.u.pNC = pOuterNC;\n  sqlite3WalkSelect(&w, p);\n}\n\n/*\n** Resolve names in expressions that can only reference a single table:\n**\n**    *   CHECK constraints\n**    *   WHERE clauses on partial indices\n**\n** The Expr.iTable value for Expr.op==TK_COLUMN nodes of the expression\n** is set to -1 and the Expr.iColumn value is set to the column number.\n**\n** Any errors cause an error message to be set in pParse.\n*/\nvoid sqlite3ResolveSelfReference(\n  Parse *pParse,      /* Parsing context */\n  Table *pTab,        /* The table being referenced */\n  int type,           /* NC_IsCheck or NC_PartIdx or NC_IdxExpr */\n  Expr *pExpr,        /* Expression to resolve.  May be NULL. */\n  ExprList *pList     /* Expression list to resolve.  May be NUL. */\n){\n  SrcList sSrc;                   /* Fake SrcList for pParse->pNewTable */\n  NameContext sNC;                /* Name context for pParse->pNewTable */\n\n  assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr );\n  memset(&sNC, 0, sizeof(sNC));\n  memset(&sSrc, 0, sizeof(sSrc));\n  sSrc.nSrc = 1;\n  sSrc.a[0].zName = pTab->zName;\n  sSrc.a[0].pTab = pTab;\n  sSrc.a[0].iCursor = -1;\n  sNC.pParse = pParse;\n  sNC.pSrcList = &sSrc;\n  sNC.ncFlags = type;\n  if( sqlite3ResolveExprNames(&sNC, pExpr) ) return;\n  if( pList ) sqlite3ResolveExprListNames(&sNC, pList);\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/rowset.c",
    "content": "/*\n** 2008 December 3\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This module implements an object we call a \"RowSet\".\n**\n** The RowSet object is a collection of rowids.  Rowids\n** are inserted into the RowSet in an arbitrary order.  Inserts\n** can be intermixed with tests to see if a given rowid has been\n** previously inserted into the RowSet.\n**\n** After all inserts are finished, it is possible to extract the\n** elements of the RowSet in sorted order.  Once this extraction\n** process has started, no new elements may be inserted.\n**\n** Hence, the primitive operations for a RowSet are:\n**\n**    CREATE\n**    INSERT\n**    TEST\n**    SMALLEST\n**    DESTROY\n**\n** The CREATE and DESTROY primitives are the constructor and destructor,\n** obviously.  The INSERT primitive adds a new element to the RowSet.\n** TEST checks to see if an element is already in the RowSet.  SMALLEST\n** extracts the least value from the RowSet.\n**\n** The INSERT primitive might allocate additional memory.  Memory is\n** allocated in chunks so most INSERTs do no allocation.  There is an \n** upper bound on the size of allocated memory.  No memory is freed\n** until DESTROY.\n**\n** The TEST primitive includes a \"batch\" number.  The TEST primitive\n** will only see elements that were inserted before the last change\n** in the batch number.  In other words, if an INSERT occurs between\n** two TESTs where the TESTs have the same batch nubmer, then the\n** value added by the INSERT will not be visible to the second TEST.\n** The initial batch number is zero, so if the very first TEST contains\n** a non-zero batch number, it will see all prior INSERTs.\n**\n** No INSERTs may occurs after a SMALLEST.  An assertion will fail if\n** that is attempted.\n**\n** The cost of an INSERT is roughly constant.  (Sometimes new memory\n** has to be allocated on an INSERT.)  The cost of a TEST with a new\n** batch number is O(NlogN) where N is the number of elements in the RowSet.\n** The cost of a TEST using the same batch number is O(logN).  The cost\n** of the first SMALLEST is O(NlogN).  Second and subsequent SMALLEST\n** primitives are constant time.  The cost of DESTROY is O(N).\n**\n** TEST and SMALLEST may not be used by the same RowSet.  This used to\n** be possible, but the feature was not used, so it was removed in order\n** to simplify the code.\n*/\n#include \"sqliteInt.h\"\n\n\n/*\n** Target size for allocation chunks.\n*/\n#define ROWSET_ALLOCATION_SIZE 1024\n\n/*\n** The number of rowset entries per allocation chunk.\n*/\n#define ROWSET_ENTRY_PER_CHUNK  \\\n                       ((ROWSET_ALLOCATION_SIZE-8)/sizeof(struct RowSetEntry))\n\n/*\n** Each entry in a RowSet is an instance of the following object.\n**\n** This same object is reused to store a linked list of trees of RowSetEntry\n** objects.  In that alternative use, pRight points to the next entry\n** in the list, pLeft points to the tree, and v is unused.  The\n** RowSet.pForest value points to the head of this forest list.\n*/\nstruct RowSetEntry {            \n  i64 v;                        /* ROWID value for this entry */\n  struct RowSetEntry *pRight;   /* Right subtree (larger entries) or list */\n  struct RowSetEntry *pLeft;    /* Left subtree (smaller entries) */\n};\n\n/*\n** RowSetEntry objects are allocated in large chunks (instances of the\n** following structure) to reduce memory allocation overhead.  The\n** chunks are kept on a linked list so that they can be deallocated\n** when the RowSet is destroyed.\n*/\nstruct RowSetChunk {\n  struct RowSetChunk *pNextChunk;        /* Next chunk on list of them all */\n  struct RowSetEntry aEntry[ROWSET_ENTRY_PER_CHUNK]; /* Allocated entries */\n};\n\n/*\n** A RowSet in an instance of the following structure.\n**\n** A typedef of this structure if found in sqliteInt.h.\n*/\nstruct RowSet {\n  struct RowSetChunk *pChunk;    /* List of all chunk allocations */\n  sqlite3 *db;                   /* The database connection */\n  struct RowSetEntry *pEntry;    /* List of entries using pRight */\n  struct RowSetEntry *pLast;     /* Last entry on the pEntry list */\n  struct RowSetEntry *pFresh;    /* Source of new entry objects */\n  struct RowSetEntry *pForest;   /* List of binary trees of entries */\n  u16 nFresh;                    /* Number of objects on pFresh */\n  u16 rsFlags;                   /* Various flags */\n  int iBatch;                    /* Current insert batch */\n};\n\n/*\n** Allowed values for RowSet.rsFlags\n*/\n#define ROWSET_SORTED  0x01   /* True if RowSet.pEntry is sorted */\n#define ROWSET_NEXT    0x02   /* True if sqlite3RowSetNext() has been called */\n\n/*\n** Turn bulk memory into a RowSet object.  N bytes of memory\n** are available at pSpace.  The db pointer is used as a memory context\n** for any subsequent allocations that need to occur.\n** Return a pointer to the new RowSet object.\n**\n** It must be the case that N is sufficient to make a Rowset.  If not\n** an assertion fault occurs.\n** \n** If N is larger than the minimum, use the surplus as an initial\n** allocation of entries available to be filled.\n*/\nRowSet *sqlite3RowSetInit(sqlite3 *db, void *pSpace, unsigned int N){\n  RowSet *p;\n  assert( N >= ROUND8(sizeof(*p)) );\n  p = pSpace;\n  p->pChunk = 0;\n  p->db = db;\n  p->pEntry = 0;\n  p->pLast = 0;\n  p->pForest = 0;\n  p->pFresh = (struct RowSetEntry*)(ROUND8(sizeof(*p)) + (char*)p);\n  p->nFresh = (u16)((N - ROUND8(sizeof(*p)))/sizeof(struct RowSetEntry));\n  p->rsFlags = ROWSET_SORTED;\n  p->iBatch = 0;\n  return p;\n}\n\n/*\n** Deallocate all chunks from a RowSet.  This frees all memory that\n** the RowSet has allocated over its lifetime.  This routine is\n** the destructor for the RowSet.\n*/\nvoid sqlite3RowSetClear(RowSet *p){\n  struct RowSetChunk *pChunk, *pNextChunk;\n  for(pChunk=p->pChunk; pChunk; pChunk = pNextChunk){\n    pNextChunk = pChunk->pNextChunk;\n    sqlite3DbFree(p->db, pChunk);\n  }\n  p->pChunk = 0;\n  p->nFresh = 0;\n  p->pEntry = 0;\n  p->pLast = 0;\n  p->pForest = 0;\n  p->rsFlags = ROWSET_SORTED;\n}\n\n/*\n** Allocate a new RowSetEntry object that is associated with the\n** given RowSet.  Return a pointer to the new and completely uninitialized\n** objected.\n**\n** In an OOM situation, the RowSet.db->mallocFailed flag is set and this\n** routine returns NULL.\n*/\nstatic struct RowSetEntry *rowSetEntryAlloc(RowSet *p){\n  assert( p!=0 );\n  if( p->nFresh==0 ){  /*OPTIMIZATION-IF-FALSE*/\n    /* We could allocate a fresh RowSetEntry each time one is needed, but it\n    ** is more efficient to pull a preallocated entry from the pool */\n    struct RowSetChunk *pNew;\n    pNew = sqlite3DbMallocRawNN(p->db, sizeof(*pNew));\n    if( pNew==0 ){\n      return 0;\n    }\n    pNew->pNextChunk = p->pChunk;\n    p->pChunk = pNew;\n    p->pFresh = pNew->aEntry;\n    p->nFresh = ROWSET_ENTRY_PER_CHUNK;\n  }\n  p->nFresh--;\n  return p->pFresh++;\n}\n\n/*\n** Insert a new value into a RowSet.\n**\n** The mallocFailed flag of the database connection is set if a\n** memory allocation fails.\n*/\nvoid sqlite3RowSetInsert(RowSet *p, i64 rowid){\n  struct RowSetEntry *pEntry;  /* The new entry */\n  struct RowSetEntry *pLast;   /* The last prior entry */\n\n  /* This routine is never called after sqlite3RowSetNext() */\n  assert( p!=0 && (p->rsFlags & ROWSET_NEXT)==0 );\n\n  pEntry = rowSetEntryAlloc(p);\n  if( pEntry==0 ) return;\n  pEntry->v = rowid;\n  pEntry->pRight = 0;\n  pLast = p->pLast;\n  if( pLast ){\n    if( rowid<=pLast->v ){  /*OPTIMIZATION-IF-FALSE*/\n      /* Avoid unnecessary sorts by preserving the ROWSET_SORTED flags\n      ** where possible */\n      p->rsFlags &= ~ROWSET_SORTED;\n    }\n    pLast->pRight = pEntry;\n  }else{\n    p->pEntry = pEntry;\n  }\n  p->pLast = pEntry;\n}\n\n/*\n** Merge two lists of RowSetEntry objects.  Remove duplicates.\n**\n** The input lists are connected via pRight pointers and are \n** assumed to each already be in sorted order.\n*/\nstatic struct RowSetEntry *rowSetEntryMerge(\n  struct RowSetEntry *pA,    /* First sorted list to be merged */\n  struct RowSetEntry *pB     /* Second sorted list to be merged */\n){\n  struct RowSetEntry head;\n  struct RowSetEntry *pTail;\n\n  pTail = &head;\n  assert( pA!=0 && pB!=0 );\n  for(;;){\n    assert( pA->pRight==0 || pA->v<=pA->pRight->v );\n    assert( pB->pRight==0 || pB->v<=pB->pRight->v );\n    if( pA->v<=pB->v ){\n      if( pA->v<pB->v ) pTail = pTail->pRight = pA;\n      pA = pA->pRight;\n      if( pA==0 ){\n        pTail->pRight = pB;\n        break;\n      }\n    }else{\n      pTail = pTail->pRight = pB;\n      pB = pB->pRight;\n      if( pB==0 ){\n        pTail->pRight = pA;\n        break;\n      }\n    }\n  }\n  return head.pRight;\n}\n\n/*\n** Sort all elements on the list of RowSetEntry objects into order of\n** increasing v.\n*/ \nstatic struct RowSetEntry *rowSetEntrySort(struct RowSetEntry *pIn){\n  unsigned int i;\n  struct RowSetEntry *pNext, *aBucket[40];\n\n  memset(aBucket, 0, sizeof(aBucket));\n  while( pIn ){\n    pNext = pIn->pRight;\n    pIn->pRight = 0;\n    for(i=0; aBucket[i]; i++){\n      pIn = rowSetEntryMerge(aBucket[i], pIn);\n      aBucket[i] = 0;\n    }\n    aBucket[i] = pIn;\n    pIn = pNext;\n  }\n  pIn = aBucket[0];\n  for(i=1; i<sizeof(aBucket)/sizeof(aBucket[0]); i++){\n    if( aBucket[i]==0 ) continue;\n    pIn = pIn ? rowSetEntryMerge(pIn, aBucket[i]) : aBucket[i];\n  }\n  return pIn;\n}\n\n\n/*\n** The input, pIn, is a binary tree (or subtree) of RowSetEntry objects.\n** Convert this tree into a linked list connected by the pRight pointers\n** and return pointers to the first and last elements of the new list.\n*/\nstatic void rowSetTreeToList(\n  struct RowSetEntry *pIn,         /* Root of the input tree */\n  struct RowSetEntry **ppFirst,    /* Write head of the output list here */\n  struct RowSetEntry **ppLast      /* Write tail of the output list here */\n){\n  assert( pIn!=0 );\n  if( pIn->pLeft ){\n    struct RowSetEntry *p;\n    rowSetTreeToList(pIn->pLeft, ppFirst, &p);\n    p->pRight = pIn;\n  }else{\n    *ppFirst = pIn;\n  }\n  if( pIn->pRight ){\n    rowSetTreeToList(pIn->pRight, &pIn->pRight, ppLast);\n  }else{\n    *ppLast = pIn;\n  }\n  assert( (*ppLast)->pRight==0 );\n}\n\n\n/*\n** Convert a sorted list of elements (connected by pRight) into a binary\n** tree with depth of iDepth.  A depth of 1 means the tree contains a single\n** node taken from the head of *ppList.  A depth of 2 means a tree with\n** three nodes.  And so forth.\n**\n** Use as many entries from the input list as required and update the\n** *ppList to point to the unused elements of the list.  If the input\n** list contains too few elements, then construct an incomplete tree\n** and leave *ppList set to NULL.\n**\n** Return a pointer to the root of the constructed binary tree.\n*/\nstatic struct RowSetEntry *rowSetNDeepTree(\n  struct RowSetEntry **ppList,\n  int iDepth\n){\n  struct RowSetEntry *p;         /* Root of the new tree */\n  struct RowSetEntry *pLeft;     /* Left subtree */\n  if( *ppList==0 ){ /*OPTIMIZATION-IF-TRUE*/\n    /* Prevent unnecessary deep recursion when we run out of entries */\n    return 0; \n  }\n  if( iDepth>1 ){   /*OPTIMIZATION-IF-TRUE*/\n    /* This branch causes a *balanced* tree to be generated.  A valid tree\n    ** is still generated without this branch, but the tree is wildly\n    ** unbalanced and inefficient. */\n    pLeft = rowSetNDeepTree(ppList, iDepth-1);\n    p = *ppList;\n    if( p==0 ){     /*OPTIMIZATION-IF-FALSE*/\n      /* It is safe to always return here, but the resulting tree\n      ** would be unbalanced */\n      return pLeft;\n    }\n    p->pLeft = pLeft;\n    *ppList = p->pRight;\n    p->pRight = rowSetNDeepTree(ppList, iDepth-1);\n  }else{\n    p = *ppList;\n    *ppList = p->pRight;\n    p->pLeft = p->pRight = 0;\n  }\n  return p;\n}\n\n/*\n** Convert a sorted list of elements into a binary tree. Make the tree\n** as deep as it needs to be in order to contain the entire list.\n*/\nstatic struct RowSetEntry *rowSetListToTree(struct RowSetEntry *pList){\n  int iDepth;           /* Depth of the tree so far */\n  struct RowSetEntry *p;       /* Current tree root */\n  struct RowSetEntry *pLeft;   /* Left subtree */\n\n  assert( pList!=0 );\n  p = pList;\n  pList = p->pRight;\n  p->pLeft = p->pRight = 0;\n  for(iDepth=1; pList; iDepth++){\n    pLeft = p;\n    p = pList;\n    pList = p->pRight;\n    p->pLeft = pLeft;\n    p->pRight = rowSetNDeepTree(&pList, iDepth);\n  }\n  return p;\n}\n\n/*\n** Extract the smallest element from the RowSet.\n** Write the element into *pRowid.  Return 1 on success.  Return\n** 0 if the RowSet is already empty.\n**\n** After this routine has been called, the sqlite3RowSetInsert()\n** routine may not be called again.\n**\n** This routine may not be called after sqlite3RowSetTest() has\n** been used.  Older versions of RowSet allowed that, but as the\n** capability was not used by the code generator, it was removed\n** for code economy.\n*/\nint sqlite3RowSetNext(RowSet *p, i64 *pRowid){\n  assert( p!=0 );\n  assert( p->pForest==0 );  /* Cannot be used with sqlite3RowSetText() */\n\n  /* Merge the forest into a single sorted list on first call */\n  if( (p->rsFlags & ROWSET_NEXT)==0 ){  /*OPTIMIZATION-IF-FALSE*/\n    if( (p->rsFlags & ROWSET_SORTED)==0 ){  /*OPTIMIZATION-IF-FALSE*/\n      p->pEntry = rowSetEntrySort(p->pEntry);\n    }\n    p->rsFlags |= ROWSET_SORTED|ROWSET_NEXT;\n  }\n\n  /* Return the next entry on the list */\n  if( p->pEntry ){\n    *pRowid = p->pEntry->v;\n    p->pEntry = p->pEntry->pRight;\n    if( p->pEntry==0 ){ /*OPTIMIZATION-IF-TRUE*/\n      /* Free memory immediately, rather than waiting on sqlite3_finalize() */\n      sqlite3RowSetClear(p);\n    }\n    return 1;\n  }else{\n    return 0;\n  }\n}\n\n/*\n** Check to see if element iRowid was inserted into the rowset as\n** part of any insert batch prior to iBatch.  Return 1 or 0.\n**\n** If this is the first test of a new batch and if there exist entries\n** on pRowSet->pEntry, then sort those entries into the forest at\n** pRowSet->pForest so that they can be tested.\n*/\nint sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 iRowid){\n  struct RowSetEntry *p, *pTree;\n\n  /* This routine is never called after sqlite3RowSetNext() */\n  assert( pRowSet!=0 && (pRowSet->rsFlags & ROWSET_NEXT)==0 );\n\n  /* Sort entries into the forest on the first test of a new batch.\n  ** To save unnecessary work, only do this when the batch number changes.\n  */\n  if( iBatch!=pRowSet->iBatch ){  /*OPTIMIZATION-IF-FALSE*/\n    p = pRowSet->pEntry;\n    if( p ){\n      struct RowSetEntry **ppPrevTree = &pRowSet->pForest;\n      if( (pRowSet->rsFlags & ROWSET_SORTED)==0 ){ /*OPTIMIZATION-IF-FALSE*/\n        /* Only sort the current set of entiries if they need it */\n        p = rowSetEntrySort(p);\n      }\n      for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){\n        ppPrevTree = &pTree->pRight;\n        if( pTree->pLeft==0 ){\n          pTree->pLeft = rowSetListToTree(p);\n          break;\n        }else{\n          struct RowSetEntry *pAux, *pTail;\n          rowSetTreeToList(pTree->pLeft, &pAux, &pTail);\n          pTree->pLeft = 0;\n          p = rowSetEntryMerge(pAux, p);\n        }\n      }\n      if( pTree==0 ){\n        *ppPrevTree = pTree = rowSetEntryAlloc(pRowSet);\n        if( pTree ){\n          pTree->v = 0;\n          pTree->pRight = 0;\n          pTree->pLeft = rowSetListToTree(p);\n        }\n      }\n      pRowSet->pEntry = 0;\n      pRowSet->pLast = 0;\n      pRowSet->rsFlags |= ROWSET_SORTED;\n    }\n    pRowSet->iBatch = iBatch;\n  }\n\n  /* Test to see if the iRowid value appears anywhere in the forest.\n  ** Return 1 if it does and 0 if not.\n  */\n  for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){\n    p = pTree->pLeft;\n    while( p ){\n      if( p->v<iRowid ){\n        p = p->pRight;\n      }else if( p->v>iRowid ){\n        p = p->pLeft;\n      }else{\n        return 1;\n      }\n    }\n  }\n  return 0;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/select.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains C code routines that are called by the parser\n** to handle SELECT statements in SQLite.\n*/\n#include \"sqliteInt.h\"\n\n/*\n** Trace output macros\n*/\n#if SELECTTRACE_ENABLED\n/***/ int sqlite3SelectTrace = 0;\n# define SELECTTRACE(K,P,S,X)  \\\n  if(sqlite3SelectTrace&(K))   \\\n    sqlite3DebugPrintf(\"%*s%s.%p: \",(P)->nSelectIndent*2-2,\"\",\\\n        (S)->zSelName,(S)),\\\n    sqlite3DebugPrintf X\n#else\n# define SELECTTRACE(K,P,S,X)\n#endif\n\n\n/*\n** An instance of the following object is used to record information about\n** how to process the DISTINCT keyword, to simplify passing that information\n** into the selectInnerLoop() routine.\n*/\ntypedef struct DistinctCtx DistinctCtx;\nstruct DistinctCtx {\n  u8 isTnct;      /* True if the DISTINCT keyword is present */\n  u8 eTnctType;   /* One of the WHERE_DISTINCT_* operators */\n  int tabTnct;    /* Ephemeral table used for DISTINCT processing */\n  int addrTnct;   /* Address of OP_OpenEphemeral opcode for tabTnct */\n};\n\n/*\n** An instance of the following object is used to record information about\n** the ORDER BY (or GROUP BY) clause of query is being coded.\n*/\ntypedef struct SortCtx SortCtx;\nstruct SortCtx {\n  ExprList *pOrderBy;   /* The ORDER BY (or GROUP BY clause) */\n  int nOBSat;           /* Number of ORDER BY terms satisfied by indices */\n  int iECursor;         /* Cursor number for the sorter */\n  int regReturn;        /* Register holding block-output return address */\n  int labelBkOut;       /* Start label for the block-output subroutine */\n  int addrSortIndex;    /* Address of the OP_SorterOpen or OP_OpenEphemeral */\n  int labelDone;        /* Jump here when done, ex: LIMIT reached */\n  u8 sortFlags;         /* Zero or more SORTFLAG_* bits */\n  u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */\n};\n#define SORTFLAG_UseSorter  0x01   /* Use SorterOpen instead of OpenEphemeral */\n\n/*\n** Delete all the content of a Select structure.  Deallocate the structure\n** itself only if bFree is true.\n*/\nstatic void clearSelect(sqlite3 *db, Select *p, int bFree){\n  while( p ){\n    Select *pPrior = p->pPrior;\n    sqlite3ExprListDelete(db, p->pEList);\n    sqlite3SrcListDelete(db, p->pSrc);\n    sqlite3ExprDelete(db, p->pWhere);\n    sqlite3ExprListDelete(db, p->pGroupBy);\n    sqlite3ExprDelete(db, p->pHaving);\n    sqlite3ExprListDelete(db, p->pOrderBy);\n    sqlite3ExprDelete(db, p->pLimit);\n    sqlite3ExprDelete(db, p->pOffset);\n    if( p->pWith ) sqlite3WithDelete(db, p->pWith);\n    if( bFree ) sqlite3DbFree(db, p);\n    p = pPrior;\n    bFree = 1;\n  }\n}\n\n/*\n** Initialize a SelectDest structure.\n*/\nvoid sqlite3SelectDestInit(SelectDest *pDest, int eDest, int iParm){\n  pDest->eDest = (u8)eDest;\n  pDest->iSDParm = iParm;\n  pDest->zAffSdst = 0;\n  pDest->iSdst = 0;\n  pDest->nSdst = 0;\n}\n\n\n/*\n** Allocate a new Select structure and return a pointer to that\n** structure.\n*/\nSelect *sqlite3SelectNew(\n  Parse *pParse,        /* Parsing context */\n  ExprList *pEList,     /* which columns to include in the result */\n  SrcList *pSrc,        /* the FROM clause -- which tables to scan */\n  Expr *pWhere,         /* the WHERE clause */\n  ExprList *pGroupBy,   /* the GROUP BY clause */\n  Expr *pHaving,        /* the HAVING clause */\n  ExprList *pOrderBy,   /* the ORDER BY clause */\n  u32 selFlags,         /* Flag parameters, such as SF_Distinct */\n  Expr *pLimit,         /* LIMIT value.  NULL means not used */\n  Expr *pOffset         /* OFFSET value.  NULL means no offset */\n){\n  Select *pNew;\n  Select standin;\n  sqlite3 *db = pParse->db;\n  pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew) );\n  if( pNew==0 ){\n    assert( db->mallocFailed );\n    pNew = &standin;\n  }\n  if( pEList==0 ){\n    pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ASTERISK,0));\n  }\n  pNew->pEList = pEList;\n  pNew->op = TK_SELECT;\n  pNew->selFlags = selFlags;\n  pNew->iLimit = 0;\n  pNew->iOffset = 0;\n#if SELECTTRACE_ENABLED\n  pNew->zSelName[0] = 0;\n#endif\n  pNew->addrOpenEphm[0] = -1;\n  pNew->addrOpenEphm[1] = -1;\n  pNew->nSelectRow = 0;\n  if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc));\n  pNew->pSrc = pSrc;\n  pNew->pWhere = pWhere;\n  pNew->pGroupBy = pGroupBy;\n  pNew->pHaving = pHaving;\n  pNew->pOrderBy = pOrderBy;\n  pNew->pPrior = 0;\n  pNew->pNext = 0;\n  pNew->pLimit = pLimit;\n  pNew->pOffset = pOffset;\n  pNew->pWith = 0;\n  assert( pOffset==0 || pLimit!=0 || pParse->nErr>0 || db->mallocFailed!=0 );\n  if( db->mallocFailed ) {\n    clearSelect(db, pNew, pNew!=&standin);\n    pNew = 0;\n  }else{\n    assert( pNew->pSrc!=0 || pParse->nErr>0 );\n  }\n  assert( pNew!=&standin );\n  return pNew;\n}\n\n#if SELECTTRACE_ENABLED\n/*\n** Set the name of a Select object\n*/\nvoid sqlite3SelectSetName(Select *p, const char *zName){\n  if( p && zName ){\n    sqlite3_snprintf(sizeof(p->zSelName), p->zSelName, \"%s\", zName);\n  }\n}\n#endif\n\n\n/*\n** Delete the given Select structure and all of its substructures.\n*/\nvoid sqlite3SelectDelete(sqlite3 *db, Select *p){\n  if( p ) clearSelect(db, p, 1);\n}\n\n/*\n** Return a pointer to the right-most SELECT statement in a compound.\n*/\nstatic Select *findRightmost(Select *p){\n  while( p->pNext ) p = p->pNext;\n  return p;\n}\n\n/*\n** Given 1 to 3 identifiers preceding the JOIN keyword, determine the\n** type of join.  Return an integer constant that expresses that type\n** in terms of the following bit values:\n**\n**     JT_INNER\n**     JT_CROSS\n**     JT_OUTER\n**     JT_NATURAL\n**     JT_LEFT\n**     JT_RIGHT\n**\n** A full outer join is the combination of JT_LEFT and JT_RIGHT.\n**\n** If an illegal or unsupported join type is seen, then still return\n** a join type, but put an error in the pParse structure.\n*/\nint sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){\n  int jointype = 0;\n  Token *apAll[3];\n  Token *p;\n                             /*   0123456789 123456789 123456789 123 */\n  static const char zKeyText[] = \"naturaleftouterightfullinnercross\";\n  static const struct {\n    u8 i;        /* Beginning of keyword text in zKeyText[] */\n    u8 nChar;    /* Length of the keyword in characters */\n    u8 code;     /* Join type mask */\n  } aKeyword[] = {\n    /* natural */ { 0,  7, JT_NATURAL                },\n    /* left    */ { 6,  4, JT_LEFT|JT_OUTER          },\n    /* outer   */ { 10, 5, JT_OUTER                  },\n    /* right   */ { 14, 5, JT_RIGHT|JT_OUTER         },\n    /* full    */ { 19, 4, JT_LEFT|JT_RIGHT|JT_OUTER },\n    /* inner   */ { 23, 5, JT_INNER                  },\n    /* cross   */ { 28, 5, JT_INNER|JT_CROSS         },\n  };\n  int i, j;\n  apAll[0] = pA;\n  apAll[1] = pB;\n  apAll[2] = pC;\n  for(i=0; i<3 && apAll[i]; i++){\n    p = apAll[i];\n    for(j=0; j<ArraySize(aKeyword); j++){\n      if( p->n==aKeyword[j].nChar \n          && sqlite3StrNICmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){\n        jointype |= aKeyword[j].code;\n        break;\n      }\n    }\n    testcase( j==0 || j==1 || j==2 || j==3 || j==4 || j==5 || j==6 );\n    if( j>=ArraySize(aKeyword) ){\n      jointype |= JT_ERROR;\n      break;\n    }\n  }\n  if(\n     (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) ||\n     (jointype & JT_ERROR)!=0\n  ){\n    const char *zSp = \" \";\n    assert( pB!=0 );\n    if( pC==0 ){ zSp++; }\n    sqlite3ErrorMsg(pParse, \"unknown or unsupported join type: \"\n       \"%T %T%s%T\", pA, pB, zSp, pC);\n    jointype = JT_INNER;\n  }else if( (jointype & JT_OUTER)!=0 \n         && (jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ){\n    sqlite3ErrorMsg(pParse, \n      \"RIGHT and FULL OUTER JOINs are not currently supported\");\n    jointype = JT_INNER;\n  }\n  return jointype;\n}\n\n/*\n** Return the index of a column in a table.  Return -1 if the column\n** is not contained in the table.\n*/\nstatic int columnIndex(Table *pTab, const char *zCol){\n  int i;\n  for(i=0; i<pTab->nCol; i++){\n    if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;\n  }\n  return -1;\n}\n\n/*\n** Search the first N tables in pSrc, from left to right, looking for a\n** table that has a column named zCol.  \n**\n** When found, set *piTab and *piCol to the table index and column index\n** of the matching column and return TRUE.\n**\n** If not found, return FALSE.\n*/\nstatic int tableAndColumnIndex(\n  SrcList *pSrc,       /* Array of tables to search */\n  int N,               /* Number of tables in pSrc->a[] to search */\n  const char *zCol,    /* Name of the column we are looking for */\n  int *piTab,          /* Write index of pSrc->a[] here */\n  int *piCol           /* Write index of pSrc->a[*piTab].pTab->aCol[] here */\n){\n  int i;               /* For looping over tables in pSrc */\n  int iCol;            /* Index of column matching zCol */\n\n  assert( (piTab==0)==(piCol==0) );  /* Both or neither are NULL */\n  for(i=0; i<N; i++){\n    iCol = columnIndex(pSrc->a[i].pTab, zCol);\n    if( iCol>=0 ){\n      if( piTab ){\n        *piTab = i;\n        *piCol = iCol;\n      }\n      return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** This function is used to add terms implied by JOIN syntax to the\n** WHERE clause expression of a SELECT statement. The new term, which\n** is ANDed with the existing WHERE clause, is of the form:\n**\n**    (tab1.col1 = tab2.col2)\n**\n** where tab1 is the iSrc'th table in SrcList pSrc and tab2 is the \n** (iSrc+1)'th. Column col1 is column iColLeft of tab1, and col2 is\n** column iColRight of tab2.\n*/\nstatic void addWhereTerm(\n  Parse *pParse,                  /* Parsing context */\n  SrcList *pSrc,                  /* List of tables in FROM clause */\n  int iLeft,                      /* Index of first table to join in pSrc */\n  int iColLeft,                   /* Index of column in first table */\n  int iRight,                     /* Index of second table in pSrc */\n  int iColRight,                  /* Index of column in second table */\n  int isOuterJoin,                /* True if this is an OUTER join */\n  Expr **ppWhere                  /* IN/OUT: The WHERE clause to add to */\n){\n  sqlite3 *db = pParse->db;\n  Expr *pE1;\n  Expr *pE2;\n  Expr *pEq;\n\n  assert( iLeft<iRight );\n  assert( pSrc->nSrc>iRight );\n  assert( pSrc->a[iLeft].pTab );\n  assert( pSrc->a[iRight].pTab );\n\n  pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft);\n  pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight);\n\n  pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2, 0);\n  if( pEq && isOuterJoin ){\n    ExprSetProperty(pEq, EP_FromJoin);\n    assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );\n    ExprSetVVAProperty(pEq, EP_NoReduce);\n    pEq->iRightJoinTable = (i16)pE2->iTable;\n  }\n  *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);\n}\n\n/*\n** Set the EP_FromJoin property on all terms of the given expression.\n** And set the Expr.iRightJoinTable to iTable for every term in the\n** expression.\n**\n** The EP_FromJoin property is used on terms of an expression to tell\n** the LEFT OUTER JOIN processing logic that this term is part of the\n** join restriction specified in the ON or USING clause and not a part\n** of the more general WHERE clause.  These terms are moved over to the\n** WHERE clause during join processing but we need to remember that they\n** originated in the ON or USING clause.\n**\n** The Expr.iRightJoinTable tells the WHERE clause processing that the\n** expression depends on table iRightJoinTable even if that table is not\n** explicitly mentioned in the expression.  That information is needed\n** for cases like this:\n**\n**    SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5\n**\n** The where clause needs to defer the handling of the t1.x=5\n** term until after the t2 loop of the join.  In that way, a\n** NULL t2 row will be inserted whenever t1.x!=5.  If we do not\n** defer the handling of t1.x=5, it will be processed immediately\n** after the t1 loop and rows with t1.x!=5 will never appear in\n** the output, which is incorrect.\n*/\nstatic void setJoinExpr(Expr *p, int iTable){\n  while( p ){\n    ExprSetProperty(p, EP_FromJoin);\n    assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );\n    ExprSetVVAProperty(p, EP_NoReduce);\n    p->iRightJoinTable = (i16)iTable;\n    if( p->op==TK_FUNCTION && p->x.pList ){\n      int i;\n      for(i=0; i<p->x.pList->nExpr; i++){\n        setJoinExpr(p->x.pList->a[i].pExpr, iTable);\n      }\n    }\n    setJoinExpr(p->pLeft, iTable);\n    p = p->pRight;\n  } \n}\n\n/*\n** This routine processes the join information for a SELECT statement.\n** ON and USING clauses are converted into extra terms of the WHERE clause.\n** NATURAL joins also create extra WHERE clause terms.\n**\n** The terms of a FROM clause are contained in the Select.pSrc structure.\n** The left most table is the first entry in Select.pSrc.  The right-most\n** table is the last entry.  The join operator is held in the entry to\n** the left.  Thus entry 0 contains the join operator for the join between\n** entries 0 and 1.  Any ON or USING clauses associated with the join are\n** also attached to the left entry.\n**\n** This routine returns the number of errors encountered.\n*/\nstatic int sqliteProcessJoin(Parse *pParse, Select *p){\n  SrcList *pSrc;                  /* All tables in the FROM clause */\n  int i, j;                       /* Loop counters */\n  struct SrcList_item *pLeft;     /* Left table being joined */\n  struct SrcList_item *pRight;    /* Right table being joined */\n\n  pSrc = p->pSrc;\n  pLeft = &pSrc->a[0];\n  pRight = &pLeft[1];\n  for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){\n    Table *pLeftTab = pLeft->pTab;\n    Table *pRightTab = pRight->pTab;\n    int isOuter;\n\n    if( NEVER(pLeftTab==0 || pRightTab==0) ) continue;\n    isOuter = (pRight->fg.jointype & JT_OUTER)!=0;\n\n    /* When the NATURAL keyword is present, add WHERE clause terms for\n    ** every column that the two tables have in common.\n    */\n    if( pRight->fg.jointype & JT_NATURAL ){\n      if( pRight->pOn || pRight->pUsing ){\n        sqlite3ErrorMsg(pParse, \"a NATURAL join may not have \"\n           \"an ON or USING clause\", 0);\n        return 1;\n      }\n      for(j=0; j<pRightTab->nCol; j++){\n        char *zName;   /* Name of column in the right table */\n        int iLeft;     /* Matching left table */\n        int iLeftCol;  /* Matching column in the left table */\n\n        zName = pRightTab->aCol[j].zName;\n        if( tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol) ){\n          addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, j,\n                       isOuter, &p->pWhere);\n        }\n      }\n    }\n\n    /* Disallow both ON and USING clauses in the same join\n    */\n    if( pRight->pOn && pRight->pUsing ){\n      sqlite3ErrorMsg(pParse, \"cannot have both ON and USING \"\n        \"clauses in the same join\");\n      return 1;\n    }\n\n    /* Add the ON clause to the end of the WHERE clause, connected by\n    ** an AND operator.\n    */\n    if( pRight->pOn ){\n      if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);\n      p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn);\n      pRight->pOn = 0;\n    }\n\n    /* Create extra terms on the WHERE clause for each column named\n    ** in the USING clause.  Example: If the two tables to be joined are \n    ** A and B and the USING clause names X, Y, and Z, then add this\n    ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z\n    ** Report an error if any column mentioned in the USING clause is\n    ** not contained in both tables to be joined.\n    */\n    if( pRight->pUsing ){\n      IdList *pList = pRight->pUsing;\n      for(j=0; j<pList->nId; j++){\n        char *zName;     /* Name of the term in the USING clause */\n        int iLeft;       /* Table on the left with matching column name */\n        int iLeftCol;    /* Column number of matching column on the left */\n        int iRightCol;   /* Column number of matching column on the right */\n\n        zName = pList->a[j].zName;\n        iRightCol = columnIndex(pRightTab, zName);\n        if( iRightCol<0\n         || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol)\n        ){\n          sqlite3ErrorMsg(pParse, \"cannot join using column %s - column \"\n            \"not present in both tables\", zName);\n          return 1;\n        }\n        addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, iRightCol,\n                     isOuter, &p->pWhere);\n      }\n    }\n  }\n  return 0;\n}\n\n/* Forward reference */\nstatic KeyInfo *keyInfoFromExprList(\n  Parse *pParse,       /* Parsing context */\n  ExprList *pList,     /* Form the KeyInfo object from this ExprList */\n  int iStart,          /* Begin with this column of pList */\n  int nExtra           /* Add this many extra columns to the end */\n);\n\n/*\n** Generate code that will push the record in registers regData\n** through regData+nData-1 onto the sorter.\n*/\nstatic void pushOntoSorter(\n  Parse *pParse,         /* Parser context */\n  SortCtx *pSort,        /* Information about the ORDER BY clause */\n  Select *pSelect,       /* The whole SELECT statement */\n  int regData,           /* First register holding data to be sorted */\n  int regOrigData,       /* First register holding data before packing */\n  int nData,             /* Number of elements in the data array */\n  int nPrefixReg         /* No. of reg prior to regData available for use */\n){\n  Vdbe *v = pParse->pVdbe;                         /* Stmt under construction */\n  int bSeq = ((pSort->sortFlags & SORTFLAG_UseSorter)==0);\n  int nExpr = pSort->pOrderBy->nExpr;              /* No. of ORDER BY terms */\n  int nBase = nExpr + bSeq + nData;                /* Fields in sorter record */\n  int regBase;                                     /* Regs for sorter record */\n  int regRecord = ++pParse->nMem;                  /* Assembled sorter record */\n  int nOBSat = pSort->nOBSat;                      /* ORDER BY terms to skip */\n  int op;                            /* Opcode to add sorter record to sorter */\n  int iLimit;                        /* LIMIT counter */\n\n  assert( bSeq==0 || bSeq==1 );\n  assert( nData==1 || regData==regOrigData );\n  if( nPrefixReg ){\n    assert( nPrefixReg==nExpr+bSeq );\n    regBase = regData - nExpr - bSeq;\n  }else{\n    regBase = pParse->nMem + 1;\n    pParse->nMem += nBase;\n  }\n  assert( pSelect->iOffset==0 || pSelect->iLimit!=0 );\n  iLimit = pSelect->iOffset ? pSelect->iOffset+1 : pSelect->iLimit;\n  pSort->labelDone = sqlite3VdbeMakeLabel(v);\n  sqlite3ExprCodeExprList(pParse, pSort->pOrderBy, regBase, regOrigData,\n                          SQLITE_ECEL_DUP|SQLITE_ECEL_REF);\n  if( bSeq ){\n    sqlite3VdbeAddOp2(v, OP_Sequence, pSort->iECursor, regBase+nExpr);\n  }\n  if( nPrefixReg==0 ){\n    sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+bSeq, nData);\n  }\n  sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase+nOBSat, nBase-nOBSat, regRecord);\n  if( nOBSat>0 ){\n    int regPrevKey;   /* The first nOBSat columns of the previous row */\n    int addrFirst;    /* Address of the OP_IfNot opcode */\n    int addrJmp;      /* Address of the OP_Jump opcode */\n    VdbeOp *pOp;      /* Opcode that opens the sorter */\n    int nKey;         /* Number of sorting key columns, including OP_Sequence */\n    KeyInfo *pKI;     /* Original KeyInfo on the sorter table */\n\n    regPrevKey = pParse->nMem+1;\n    pParse->nMem += pSort->nOBSat;\n    nKey = nExpr - pSort->nOBSat + bSeq;\n    if( bSeq ){\n      addrFirst = sqlite3VdbeAddOp1(v, OP_IfNot, regBase+nExpr); \n    }else{\n      addrFirst = sqlite3VdbeAddOp1(v, OP_SequenceTest, pSort->iECursor);\n    }\n    VdbeCoverage(v);\n    sqlite3VdbeAddOp3(v, OP_Compare, regPrevKey, regBase, pSort->nOBSat);\n    pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex);\n    if( pParse->db->mallocFailed ) return;\n    pOp->p2 = nKey + nData;\n    pKI = pOp->p4.pKeyInfo;\n    memset(pKI->aSortOrder, 0, pKI->nField); /* Makes OP_Jump below testable */\n    sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO);\n    testcase( pKI->nXField>2 );\n    pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat,\n                                           pKI->nXField-1);\n    addrJmp = sqlite3VdbeCurrentAddr(v);\n    sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v);\n    pSort->labelBkOut = sqlite3VdbeMakeLabel(v);\n    pSort->regReturn = ++pParse->nMem;\n    sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);\n    sqlite3VdbeAddOp1(v, OP_ResetSorter, pSort->iECursor);\n    if( iLimit ){\n      sqlite3VdbeAddOp2(v, OP_IfNot, iLimit, pSort->labelDone);\n      VdbeCoverage(v);\n    }\n    sqlite3VdbeJumpHere(v, addrFirst);\n    sqlite3ExprCodeMove(pParse, regBase, regPrevKey, pSort->nOBSat);\n    sqlite3VdbeJumpHere(v, addrJmp);\n  }\n  if( pSort->sortFlags & SORTFLAG_UseSorter ){\n    op = OP_SorterInsert;\n  }else{\n    op = OP_IdxInsert;\n  }\n  sqlite3VdbeAddOp2(v, op, pSort->iECursor, regRecord);\n  if( iLimit ){\n    int addr;\n    int r1 = 0;\n    /* Fill the sorter until it contains LIMIT+OFFSET entries.  (The iLimit\n    ** register is initialized with value of LIMIT+OFFSET.)  After the sorter\n    ** fills up, delete the least entry in the sorter after each insert.\n    ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */\n    addr = sqlite3VdbeAddOp3(v, OP_IfNotZero, iLimit, 0, 1); VdbeCoverage(v);\n    sqlite3VdbeAddOp1(v, OP_Last, pSort->iECursor);\n    if( pSort->bOrderedInnerLoop ){\n      r1 = ++pParse->nMem;\n      sqlite3VdbeAddOp3(v, OP_Column, pSort->iECursor, nExpr, r1);\n      VdbeComment((v, \"seq\"));\n    }\n    sqlite3VdbeAddOp1(v, OP_Delete, pSort->iECursor);\n    if( pSort->bOrderedInnerLoop ){\n      /* If the inner loop is driven by an index such that values from\n      ** the same iteration of the inner loop are in sorted order, then\n      ** immediately jump to the next iteration of an inner loop if the\n      ** entry from the current iteration does not fit into the top\n      ** LIMIT+OFFSET entries of the sorter. */\n      int iBrk = sqlite3VdbeCurrentAddr(v) + 2;\n      sqlite3VdbeAddOp3(v, OP_Eq, regBase+nExpr, iBrk, r1);\n      sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);\n      VdbeCoverage(v);\n    }\n    sqlite3VdbeJumpHere(v, addr);\n  }\n}\n\n/*\n** Add code to implement the OFFSET\n*/\nstatic void codeOffset(\n  Vdbe *v,          /* Generate code into this VM */\n  int iOffset,      /* Register holding the offset counter */\n  int iContinue     /* Jump here to skip the current record */\n){\n  if( iOffset>0 ){\n    sqlite3VdbeAddOp3(v, OP_IfPos, iOffset, iContinue, 1); VdbeCoverage(v);\n    VdbeComment((v, \"OFFSET\"));\n  }\n}\n\n/*\n** Add code that will check to make sure the N registers starting at iMem\n** form a distinct entry.  iTab is a sorting index that holds previously\n** seen combinations of the N values.  A new entry is made in iTab\n** if the current N values are new.\n**\n** A jump to addrRepeat is made and the N+1 values are popped from the\n** stack if the top N elements are not distinct.\n*/\nstatic void codeDistinct(\n  Parse *pParse,     /* Parsing and code generating context */\n  int iTab,          /* A sorting index used to test for distinctness */\n  int addrRepeat,    /* Jump to here if not distinct */\n  int N,             /* Number of elements */\n  int iMem           /* First element */\n){\n  Vdbe *v;\n  int r1;\n\n  v = pParse->pVdbe;\n  r1 = sqlite3GetTempReg(pParse);\n  sqlite3VdbeAddOp4Int(v, OP_Found, iTab, addrRepeat, iMem, N); VdbeCoverage(v);\n  sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1);\n  sqlite3VdbeAddOp2(v, OP_IdxInsert, iTab, r1);\n  sqlite3ReleaseTempReg(pParse, r1);\n}\n\n/*\n** This routine generates the code for the inside of the inner loop\n** of a SELECT.\n**\n** If srcTab is negative, then the pEList expressions\n** are evaluated in order to get the data for this row.  If srcTab is\n** zero or more, then data is pulled from srcTab and pEList is used only \n** to get number columns and the datatype for each column.\n*/\nstatic void selectInnerLoop(\n  Parse *pParse,          /* The parser context */\n  Select *p,              /* The complete select statement being coded */\n  ExprList *pEList,       /* List of values being extracted */\n  int srcTab,             /* Pull data from this table */\n  SortCtx *pSort,         /* If not NULL, info on how to process ORDER BY */\n  DistinctCtx *pDistinct, /* If not NULL, info on how to process DISTINCT */\n  SelectDest *pDest,      /* How to dispose of the results */\n  int iContinue,          /* Jump here to continue with next row */\n  int iBreak              /* Jump here to break out of the inner loop */\n){\n  Vdbe *v = pParse->pVdbe;\n  int i;\n  int hasDistinct;        /* True if the DISTINCT keyword is present */\n  int regResult;              /* Start of memory holding result set */\n  int eDest = pDest->eDest;   /* How to dispose of results */\n  int iParm = pDest->iSDParm; /* First argument to disposal method */\n  int nResultCol;             /* Number of result columns */\n  int nPrefixReg = 0;         /* Number of extra registers before regResult */\n\n  assert( v );\n  assert( pEList!=0 );\n  hasDistinct = pDistinct ? pDistinct->eTnctType : WHERE_DISTINCT_NOOP;\n  if( pSort && pSort->pOrderBy==0 ) pSort = 0;\n  if( pSort==0 && !hasDistinct ){\n    assert( iContinue!=0 );\n    codeOffset(v, p->iOffset, iContinue);\n  }\n\n  /* Pull the requested columns.\n  */\n  nResultCol = pEList->nExpr;\n\n  if( pDest->iSdst==0 ){\n    if( pSort ){\n      nPrefixReg = pSort->pOrderBy->nExpr;\n      if( !(pSort->sortFlags & SORTFLAG_UseSorter) ) nPrefixReg++;\n      pParse->nMem += nPrefixReg;\n    }\n    pDest->iSdst = pParse->nMem+1;\n    pParse->nMem += nResultCol;\n  }else if( pDest->iSdst+nResultCol > pParse->nMem ){\n    /* This is an error condition that can result, for example, when a SELECT\n    ** on the right-hand side of an INSERT contains more result columns than\n    ** there are columns in the table on the left.  The error will be caught\n    ** and reported later.  But we need to make sure enough memory is allocated\n    ** to avoid other spurious errors in the meantime. */\n    pParse->nMem += nResultCol;\n  }\n  pDest->nSdst = nResultCol;\n  regResult = pDest->iSdst;\n  if( srcTab>=0 ){\n    for(i=0; i<nResultCol; i++){\n      sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);\n      VdbeComment((v, \"%s\", pEList->a[i].zName));\n    }\n  }else if( eDest!=SRT_Exists ){\n    /* If the destination is an EXISTS(...) expression, the actual\n    ** values returned by the SELECT are not required.\n    */\n    u8 ecelFlags;\n    if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){\n      ecelFlags = SQLITE_ECEL_DUP;\n    }else{\n      ecelFlags = 0;\n    }\n    sqlite3ExprCodeExprList(pParse, pEList, regResult, 0, ecelFlags);\n  }\n\n  /* If the DISTINCT keyword was present on the SELECT statement\n  ** and this row has been seen before, then do not make this row\n  ** part of the result.\n  */\n  if( hasDistinct ){\n    switch( pDistinct->eTnctType ){\n      case WHERE_DISTINCT_ORDERED: {\n        VdbeOp *pOp;            /* No longer required OpenEphemeral instr. */\n        int iJump;              /* Jump destination */\n        int regPrev;            /* Previous row content */\n\n        /* Allocate space for the previous row */\n        regPrev = pParse->nMem+1;\n        pParse->nMem += nResultCol;\n\n        /* Change the OP_OpenEphemeral coded earlier to an OP_Null\n        ** sets the MEM_Cleared bit on the first register of the\n        ** previous value.  This will cause the OP_Ne below to always\n        ** fail on the first iteration of the loop even if the first\n        ** row is all NULLs.\n        */\n        sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct);\n        pOp = sqlite3VdbeGetOp(v, pDistinct->addrTnct);\n        pOp->opcode = OP_Null;\n        pOp->p1 = 1;\n        pOp->p2 = regPrev;\n\n        iJump = sqlite3VdbeCurrentAddr(v) + nResultCol;\n        for(i=0; i<nResultCol; i++){\n          CollSeq *pColl = sqlite3ExprCollSeq(pParse, pEList->a[i].pExpr);\n          if( i<nResultCol-1 ){\n            sqlite3VdbeAddOp3(v, OP_Ne, regResult+i, iJump, regPrev+i);\n            VdbeCoverage(v);\n          }else{\n            sqlite3VdbeAddOp3(v, OP_Eq, regResult+i, iContinue, regPrev+i);\n            VdbeCoverage(v);\n           }\n          sqlite3VdbeChangeP4(v, -1, (const char *)pColl, P4_COLLSEQ);\n          sqlite3VdbeChangeP5(v, SQLITE_NULLEQ);\n        }\n        assert( sqlite3VdbeCurrentAddr(v)==iJump || pParse->db->mallocFailed );\n        sqlite3VdbeAddOp3(v, OP_Copy, regResult, regPrev, nResultCol-1);\n        break;\n      }\n\n      case WHERE_DISTINCT_UNIQUE: {\n        sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct);\n        break;\n      }\n\n      default: {\n        assert( pDistinct->eTnctType==WHERE_DISTINCT_UNORDERED );\n        codeDistinct(pParse, pDistinct->tabTnct, iContinue, nResultCol,\n                     regResult);\n        break;\n      }\n    }\n    if( pSort==0 ){\n      codeOffset(v, p->iOffset, iContinue);\n    }\n  }\n\n  switch( eDest ){\n    /* In this mode, write each query result to the key of the temporary\n    ** table iParm.\n    */\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\n    case SRT_Union: {\n      int r1;\n      r1 = sqlite3GetTempReg(pParse);\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1);\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1);\n      sqlite3ReleaseTempReg(pParse, r1);\n      break;\n    }\n\n    /* Construct a record from the query result, but instead of\n    ** saving that record, use it as a key to delete elements from\n    ** the temporary table iParm.\n    */\n    case SRT_Except: {\n      sqlite3VdbeAddOp3(v, OP_IdxDelete, iParm, regResult, nResultCol);\n      break;\n    }\n#endif /* SQLITE_OMIT_COMPOUND_SELECT */\n\n    /* Store the result as data using a unique key.\n    */\n    case SRT_Fifo:\n    case SRT_DistFifo:\n    case SRT_Table:\n    case SRT_EphemTab: {\n      int r1 = sqlite3GetTempRange(pParse, nPrefixReg+1);\n      testcase( eDest==SRT_Table );\n      testcase( eDest==SRT_EphemTab );\n      testcase( eDest==SRT_Fifo );\n      testcase( eDest==SRT_DistFifo );\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1+nPrefixReg);\n#ifndef SQLITE_OMIT_CTE\n      if( eDest==SRT_DistFifo ){\n        /* If the destination is DistFifo, then cursor (iParm+1) is open\n        ** on an ephemeral index. If the current row is already present\n        ** in the index, do not write it to the output. If not, add the\n        ** current row to the index and proceed with writing it to the\n        ** output table as well.  */\n        int addr = sqlite3VdbeCurrentAddr(v) + 4;\n        sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, addr, r1, 0);\n        VdbeCoverage(v);\n        sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r1);\n        assert( pSort==0 );\n      }\n#endif\n      if( pSort ){\n        pushOntoSorter(pParse, pSort, p, r1+nPrefixReg,regResult,1,nPrefixReg);\n      }else{\n        int r2 = sqlite3GetTempReg(pParse);\n        sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2);\n        sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2);\n        sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\n        sqlite3ReleaseTempReg(pParse, r2);\n      }\n      sqlite3ReleaseTempRange(pParse, r1, nPrefixReg+1);\n      break;\n    }\n\n#ifndef SQLITE_OMIT_SUBQUERY\n    /* If we are creating a set for an \"expr IN (SELECT ...)\" construct,\n    ** then there should be a single item on the stack.  Write this\n    ** item into the set table with bogus data.\n    */\n    case SRT_Set: {\n      if( pSort ){\n        /* At first glance you would think we could optimize out the\n        ** ORDER BY in this case since the order of entries in the set\n        ** does not matter.  But there might be a LIMIT clause, in which\n        ** case the order does matter */\n        pushOntoSorter(\n            pParse, pSort, p, regResult, regResult, nResultCol, nPrefixReg);\n      }else{\n        int r1 = sqlite3GetTempReg(pParse);\n        assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol );\n        sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol, \n            r1, pDest->zAffSdst, nResultCol);\n        sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol);\n        sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1);\n        sqlite3ReleaseTempReg(pParse, r1);\n      }\n      break;\n    }\n\n    /* If any row exist in the result set, record that fact and abort.\n    */\n    case SRT_Exists: {\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, iParm);\n      /* The LIMIT clause will terminate the loop for us */\n      break;\n    }\n\n    /* If this is a scalar select that is part of an expression, then\n    ** store the results in the appropriate memory cell or array of \n    ** memory cells and break out of the scan loop.\n    */\n    case SRT_Mem: {\n      assert( nResultCol==pDest->nSdst );\n      if( pSort ){\n        pushOntoSorter(\n            pParse, pSort, p, regResult, regResult, nResultCol, nPrefixReg);\n      }else{\n        assert( regResult==iParm );\n        /* The LIMIT clause will jump out of the loop for us */\n      }\n      break;\n    }\n#endif /* #ifndef SQLITE_OMIT_SUBQUERY */\n\n    case SRT_Coroutine:       /* Send data to a co-routine */\n    case SRT_Output: {        /* Return the results */\n      testcase( eDest==SRT_Coroutine );\n      testcase( eDest==SRT_Output );\n      if( pSort ){\n        pushOntoSorter(pParse, pSort, p, regResult, regResult, nResultCol,\n                       nPrefixReg);\n      }else if( eDest==SRT_Coroutine ){\n        sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);\n      }else{\n        sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol);\n        sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol);\n      }\n      break;\n    }\n\n#ifndef SQLITE_OMIT_CTE\n    /* Write the results into a priority queue that is order according to\n    ** pDest->pOrderBy (in pSO).  pDest->iSDParm (in iParm) is the cursor for an\n    ** index with pSO->nExpr+2 columns.  Build a key using pSO for the first\n    ** pSO->nExpr columns, then make sure all keys are unique by adding a\n    ** final OP_Sequence column.  The last column is the record as a blob.\n    */\n    case SRT_DistQueue:\n    case SRT_Queue: {\n      int nKey;\n      int r1, r2, r3;\n      int addrTest = 0;\n      ExprList *pSO;\n      pSO = pDest->pOrderBy;\n      assert( pSO );\n      nKey = pSO->nExpr;\n      r1 = sqlite3GetTempReg(pParse);\n      r2 = sqlite3GetTempRange(pParse, nKey+2);\n      r3 = r2+nKey+1;\n      if( eDest==SRT_DistQueue ){\n        /* If the destination is DistQueue, then cursor (iParm+1) is open\n        ** on a second ephemeral index that holds all values every previously\n        ** added to the queue. */\n        addrTest = sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, 0, \n                                        regResult, nResultCol);\n        VdbeCoverage(v);\n      }\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r3);\n      if( eDest==SRT_DistQueue ){\n        sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r3);\n        sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\n      }\n      for(i=0; i<nKey; i++){\n        sqlite3VdbeAddOp2(v, OP_SCopy,\n                          regResult + pSO->a[i].u.x.iOrderByCol - 1,\n                          r2+i);\n      }\n      sqlite3VdbeAddOp2(v, OP_Sequence, iParm, r2+nKey);\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, r2, nKey+2, r1);\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1);\n      if( addrTest ) sqlite3VdbeJumpHere(v, addrTest);\n      sqlite3ReleaseTempReg(pParse, r1);\n      sqlite3ReleaseTempRange(pParse, r2, nKey+2);\n      break;\n    }\n#endif /* SQLITE_OMIT_CTE */\n\n\n\n#if !defined(SQLITE_OMIT_TRIGGER)\n    /* Discard the results.  This is used for SELECT statements inside\n    ** the body of a TRIGGER.  The purpose of such selects is to call\n    ** user-defined functions that have side effects.  We do not care\n    ** about the actual results of the select.\n    */\n    default: {\n      assert( eDest==SRT_Discard );\n      break;\n    }\n#endif\n  }\n\n  /* Jump to the end of the loop if the LIMIT is reached.  Except, if\n  ** there is a sorter, in which case the sorter has already limited\n  ** the output for us.\n  */\n  if( pSort==0 && p->iLimit ){\n    sqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v);\n  }\n}\n\n/*\n** Allocate a KeyInfo object sufficient for an index of N key columns and\n** X extra columns.\n*/\nKeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){\n  int nExtra = (N+X)*(sizeof(CollSeq*)+1);\n  KeyInfo *p = sqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra);\n  if( p ){\n    p->aSortOrder = (u8*)&p->aColl[N+X];\n    p->nField = (u16)N;\n    p->nXField = (u16)X;\n    p->enc = ENC(db);\n    p->db = db;\n    p->nRef = 1;\n    memset(&p[1], 0, nExtra);\n  }else{\n    sqlite3OomFault(db);\n  }\n  return p;\n}\n\n/*\n** Deallocate a KeyInfo object\n*/\nvoid sqlite3KeyInfoUnref(KeyInfo *p){\n  if( p ){\n    assert( p->nRef>0 );\n    p->nRef--;\n    if( p->nRef==0 ) sqlite3DbFree(p->db, p);\n  }\n}\n\n/*\n** Make a new pointer to a KeyInfo object\n*/\nKeyInfo *sqlite3KeyInfoRef(KeyInfo *p){\n  if( p ){\n    assert( p->nRef>0 );\n    p->nRef++;\n  }\n  return p;\n}\n\n#ifdef SQLITE_DEBUG\n/*\n** Return TRUE if a KeyInfo object can be change.  The KeyInfo object\n** can only be changed if this is just a single reference to the object.\n**\n** This routine is used only inside of assert() statements.\n*/\nint sqlite3KeyInfoIsWriteable(KeyInfo *p){ return p->nRef==1; }\n#endif /* SQLITE_DEBUG */\n\n/*\n** Given an expression list, generate a KeyInfo structure that records\n** the collating sequence for each expression in that expression list.\n**\n** If the ExprList is an ORDER BY or GROUP BY clause then the resulting\n** KeyInfo structure is appropriate for initializing a virtual index to\n** implement that clause.  If the ExprList is the result set of a SELECT\n** then the KeyInfo structure is appropriate for initializing a virtual\n** index to implement a DISTINCT test.\n**\n** Space to hold the KeyInfo structure is obtained from malloc.  The calling\n** function is responsible for seeing that this structure is eventually\n** freed.\n*/\nstatic KeyInfo *keyInfoFromExprList(\n  Parse *pParse,       /* Parsing context */\n  ExprList *pList,     /* Form the KeyInfo object from this ExprList */\n  int iStart,          /* Begin with this column of pList */\n  int nExtra           /* Add this many extra columns to the end */\n){\n  int nExpr;\n  KeyInfo *pInfo;\n  struct ExprList_item *pItem;\n  sqlite3 *db = pParse->db;\n  int i;\n\n  nExpr = pList->nExpr;\n  pInfo = sqlite3KeyInfoAlloc(db, nExpr-iStart, nExtra+1);\n  if( pInfo ){\n    assert( sqlite3KeyInfoIsWriteable(pInfo) );\n    for(i=iStart, pItem=pList->a+iStart; i<nExpr; i++, pItem++){\n      CollSeq *pColl;\n      pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);\n      if( !pColl ) pColl = db->pDfltColl;\n      pInfo->aColl[i-iStart] = pColl;\n      pInfo->aSortOrder[i-iStart] = pItem->sortOrder;\n    }\n  }\n  return pInfo;\n}\n\n/*\n** Name of the connection operator, used for error messages.\n*/\nstatic const char *selectOpName(int id){\n  char *z;\n  switch( id ){\n    case TK_ALL:       z = \"UNION ALL\";   break;\n    case TK_INTERSECT: z = \"INTERSECT\";   break;\n    case TK_EXCEPT:    z = \"EXCEPT\";      break;\n    default:           z = \"UNION\";       break;\n  }\n  return z;\n}\n\n#ifndef SQLITE_OMIT_EXPLAIN\n/*\n** Unless an \"EXPLAIN QUERY PLAN\" command is being processed, this function\n** is a no-op. Otherwise, it adds a single row of output to the EQP result,\n** where the caption is of the form:\n**\n**   \"USE TEMP B-TREE FOR xxx\"\n**\n** where xxx is one of \"DISTINCT\", \"ORDER BY\" or \"GROUP BY\". Exactly which\n** is determined by the zUsage argument.\n*/\nstatic void explainTempTable(Parse *pParse, const char *zUsage){\n  if( pParse->explain==2 ){\n    Vdbe *v = pParse->pVdbe;\n    char *zMsg = sqlite3MPrintf(pParse->db, \"USE TEMP B-TREE FOR %s\", zUsage);\n    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);\n  }\n}\n\n/*\n** Assign expression b to lvalue a. A second, no-op, version of this macro\n** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code\n** in sqlite3Select() to assign values to structure member variables that\n** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the\n** code with #ifndef directives.\n*/\n# define explainSetInteger(a, b) a = b\n\n#else\n/* No-op versions of the explainXXX() functions and macros. */\n# define explainTempTable(y,z)\n# define explainSetInteger(y,z)\n#endif\n\n#if !defined(SQLITE_OMIT_EXPLAIN) && !defined(SQLITE_OMIT_COMPOUND_SELECT)\n/*\n** Unless an \"EXPLAIN QUERY PLAN\" command is being processed, this function\n** is a no-op. Otherwise, it adds a single row of output to the EQP result,\n** where the caption is of one of the two forms:\n**\n**   \"COMPOSITE SUBQUERIES iSub1 and iSub2 (op)\"\n**   \"COMPOSITE SUBQUERIES iSub1 and iSub2 USING TEMP B-TREE (op)\"\n**\n** where iSub1 and iSub2 are the integers passed as the corresponding\n** function parameters, and op is the text representation of the parameter\n** of the same name. The parameter \"op\" must be one of TK_UNION, TK_EXCEPT,\n** TK_INTERSECT or TK_ALL. The first form is used if argument bUseTmp is \n** false, or the second form if it is true.\n*/\nstatic void explainComposite(\n  Parse *pParse,                  /* Parse context */\n  int op,                         /* One of TK_UNION, TK_EXCEPT etc. */\n  int iSub1,                      /* Subquery id 1 */\n  int iSub2,                      /* Subquery id 2 */\n  int bUseTmp                     /* True if a temp table was used */\n){\n  assert( op==TK_UNION || op==TK_EXCEPT || op==TK_INTERSECT || op==TK_ALL );\n  if( pParse->explain==2 ){\n    Vdbe *v = pParse->pVdbe;\n    char *zMsg = sqlite3MPrintf(\n        pParse->db, \"COMPOUND SUBQUERIES %d AND %d %s(%s)\", iSub1, iSub2,\n        bUseTmp?\"USING TEMP B-TREE \":\"\", selectOpName(op)\n    );\n    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);\n  }\n}\n#else\n/* No-op versions of the explainXXX() functions and macros. */\n# define explainComposite(v,w,x,y,z)\n#endif\n\n/*\n** If the inner loop was generated using a non-null pOrderBy argument,\n** then the results were placed in a sorter.  After the loop is terminated\n** we need to run the sorter and output the results.  The following\n** routine generates the code needed to do that.\n*/\nstatic void generateSortTail(\n  Parse *pParse,    /* Parsing context */\n  Select *p,        /* The SELECT statement */\n  SortCtx *pSort,   /* Information on the ORDER BY clause */\n  int nColumn,      /* Number of columns of data */\n  SelectDest *pDest /* Write the sorted results here */\n){\n  Vdbe *v = pParse->pVdbe;                     /* The prepared statement */\n  int addrBreak = pSort->labelDone;            /* Jump here to exit loop */\n  int addrContinue = sqlite3VdbeMakeLabel(v);  /* Jump here for next cycle */\n  int addr;\n  int addrOnce = 0;\n  int iTab;\n  ExprList *pOrderBy = pSort->pOrderBy;\n  int eDest = pDest->eDest;\n  int iParm = pDest->iSDParm;\n  int regRow;\n  int regRowid;\n  int nKey;\n  int iSortTab;                   /* Sorter cursor to read from */\n  int nSortData;                  /* Trailing values to read from sorter */\n  int i;\n  int bSeq;                       /* True if sorter record includes seq. no. */\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n  struct ExprList_item *aOutEx = p->pEList->a;\n#endif\n\n  assert( addrBreak<0 );\n  if( pSort->labelBkOut ){\n    sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut);\n    sqlite3VdbeGoto(v, addrBreak);\n    sqlite3VdbeResolveLabel(v, pSort->labelBkOut);\n  }\n  iTab = pSort->iECursor;\n  if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){\n    regRowid = 0;\n    regRow = pDest->iSdst;\n    nSortData = nColumn;\n  }else{\n    regRowid = sqlite3GetTempReg(pParse);\n    regRow = sqlite3GetTempRange(pParse, nColumn);\n    nSortData = nColumn;\n  }\n  nKey = pOrderBy->nExpr - pSort->nOBSat;\n  if( pSort->sortFlags & SORTFLAG_UseSorter ){\n    int regSortOut = ++pParse->nMem;\n    iSortTab = pParse->nTab++;\n    if( pSort->labelBkOut ){\n      addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);\n    }\n    sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nSortData);\n    if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);\n    addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak);\n    VdbeCoverage(v);\n    codeOffset(v, p->iOffset, addrContinue);\n    sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab);\n    bSeq = 0;\n  }else{\n    addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); VdbeCoverage(v);\n    codeOffset(v, p->iOffset, addrContinue);\n    iSortTab = iTab;\n    bSeq = 1;\n  }\n  for(i=0; i<nSortData; i++){\n    sqlite3VdbeAddOp3(v, OP_Column, iSortTab, nKey+bSeq+i, regRow+i);\n    VdbeComment((v, \"%s\", aOutEx[i].zName ? aOutEx[i].zName : aOutEx[i].zSpan));\n  }\n  switch( eDest ){\n    case SRT_EphemTab: {\n      sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);\n      sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid);\n      sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\n      break;\n    }\n#ifndef SQLITE_OMIT_SUBQUERY\n    case SRT_Set: {\n      assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) );\n      sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid,\n                        pDest->zAffSdst, nColumn);\n      sqlite3ExprCacheAffinityChange(pParse, regRow, nColumn);\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, regRowid);\n      break;\n    }\n    case SRT_Mem: {\n      /* The LIMIT clause will terminate the loop for us */\n      break;\n    }\n#endif\n    default: {\n      assert( eDest==SRT_Output || eDest==SRT_Coroutine ); \n      testcase( eDest==SRT_Output );\n      testcase( eDest==SRT_Coroutine );\n      if( eDest==SRT_Output ){\n        sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn);\n        sqlite3ExprCacheAffinityChange(pParse, pDest->iSdst, nColumn);\n      }else{\n        sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);\n      }\n      break;\n    }\n  }\n  if( regRowid ){\n    if( eDest==SRT_Set ){\n      sqlite3ReleaseTempRange(pParse, regRow, nColumn);\n    }else{\n      sqlite3ReleaseTempReg(pParse, regRow);\n    }\n    sqlite3ReleaseTempReg(pParse, regRowid);\n  }\n  /* The bottom of the loop\n  */\n  sqlite3VdbeResolveLabel(v, addrContinue);\n  if( pSort->sortFlags & SORTFLAG_UseSorter ){\n    sqlite3VdbeAddOp2(v, OP_SorterNext, iTab, addr); VdbeCoverage(v);\n  }else{\n    sqlite3VdbeAddOp2(v, OP_Next, iTab, addr); VdbeCoverage(v);\n  }\n  if( pSort->regReturn ) sqlite3VdbeAddOp1(v, OP_Return, pSort->regReturn);\n  sqlite3VdbeResolveLabel(v, addrBreak);\n}\n\n/*\n** Return a pointer to a string containing the 'declaration type' of the\n** expression pExpr. The string may be treated as static by the caller.\n**\n** Also try to estimate the size of the returned value and return that\n** result in *pEstWidth.\n**\n** The declaration type is the exact datatype definition extracted from the\n** original CREATE TABLE statement if the expression is a column. The\n** declaration type for a ROWID field is INTEGER. Exactly when an expression\n** is considered a column can be complex in the presence of subqueries. The\n** result-set expression in all of the following SELECT statements is \n** considered a column by this function.\n**\n**   SELECT col FROM tbl;\n**   SELECT (SELECT col FROM tbl;\n**   SELECT (SELECT col FROM tbl);\n**   SELECT abc FROM (SELECT col AS abc FROM tbl);\n** \n** The declaration type for any expression other than a column is NULL.\n**\n** This routine has either 3 or 6 parameters depending on whether or not\n** the SQLITE_ENABLE_COLUMN_METADATA compile-time option is used.\n*/\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\n# define columnType(A,B,C,D,E,F) columnTypeImpl(A,B,C,D,E,F)\n#else /* if !defined(SQLITE_ENABLE_COLUMN_METADATA) */\n# define columnType(A,B,C,D,E,F) columnTypeImpl(A,B,F)\n#endif\nstatic const char *columnTypeImpl(\n  NameContext *pNC, \n  Expr *pExpr,\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\n  const char **pzOrigDb,\n  const char **pzOrigTab,\n  const char **pzOrigCol,\n#endif\n  u8 *pEstWidth\n){\n  char const *zType = 0;\n  int j;\n  u8 estWidth = 1;\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\n  char const *zOrigDb = 0;\n  char const *zOrigTab = 0;\n  char const *zOrigCol = 0;\n#endif\n\n  assert( pExpr!=0 );\n  assert( pNC->pSrcList!=0 );\n  switch( pExpr->op ){\n    case TK_AGG_COLUMN:\n    case TK_COLUMN: {\n      /* The expression is a column. Locate the table the column is being\n      ** extracted from in NameContext.pSrcList. This table may be real\n      ** database table or a subquery.\n      */\n      Table *pTab = 0;            /* Table structure column is extracted from */\n      Select *pS = 0;             /* Select the column is extracted from */\n      int iCol = pExpr->iColumn;  /* Index of column in pTab */\n      testcase( pExpr->op==TK_AGG_COLUMN );\n      testcase( pExpr->op==TK_COLUMN );\n      while( pNC && !pTab ){\n        SrcList *pTabList = pNC->pSrcList;\n        for(j=0;j<pTabList->nSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++);\n        if( j<pTabList->nSrc ){\n          pTab = pTabList->a[j].pTab;\n          pS = pTabList->a[j].pSelect;\n        }else{\n          pNC = pNC->pNext;\n        }\n      }\n\n      if( pTab==0 ){\n        /* At one time, code such as \"SELECT new.x\" within a trigger would\n        ** cause this condition to run.  Since then, we have restructured how\n        ** trigger code is generated and so this condition is no longer \n        ** possible. However, it can still be true for statements like\n        ** the following:\n        **\n        **   CREATE TABLE t1(col INTEGER);\n        **   SELECT (SELECT t1.col) FROM FROM t1;\n        **\n        ** when columnType() is called on the expression \"t1.col\" in the \n        ** sub-select. In this case, set the column type to NULL, even\n        ** though it should really be \"INTEGER\".\n        **\n        ** This is not a problem, as the column type of \"t1.col\" is never\n        ** used. When columnType() is called on the expression \n        ** \"(SELECT t1.col)\", the correct type is returned (see the TK_SELECT\n        ** branch below.  */\n        break;\n      }\n\n      assert( pTab && pExpr->pTab==pTab );\n      if( pS ){\n        /* The \"table\" is actually a sub-select or a view in the FROM clause\n        ** of the SELECT statement. Return the declaration type and origin\n        ** data for the result-set column of the sub-select.\n        */\n        if( iCol>=0 && ALWAYS(iCol<pS->pEList->nExpr) ){\n          /* If iCol is less than zero, then the expression requests the\n          ** rowid of the sub-select or view. This expression is legal (see \n          ** test case misc2.2.2) - it always evaluates to NULL.\n          **\n          ** The ALWAYS() is because iCol>=pS->pEList->nExpr will have been\n          ** caught already by name resolution.\n          */\n          NameContext sNC;\n          Expr *p = pS->pEList->a[iCol].pExpr;\n          sNC.pSrcList = pS->pSrc;\n          sNC.pNext = pNC;\n          sNC.pParse = pNC->pParse;\n          zType = columnType(&sNC, p,&zOrigDb,&zOrigTab,&zOrigCol, &estWidth); \n        }\n      }else if( pTab->pSchema ){\n        /* A real table */\n        assert( !pS );\n        if( iCol<0 ) iCol = pTab->iPKey;\n        assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\n        if( iCol<0 ){\n          zType = \"INTEGER\";\n          zOrigCol = \"rowid\";\n        }else{\n          zOrigCol = pTab->aCol[iCol].zName;\n          zType = sqlite3ColumnType(&pTab->aCol[iCol],0);\n          estWidth = pTab->aCol[iCol].szEst;\n        }\n        zOrigTab = pTab->zName;\n        if( pNC->pParse ){\n          int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);\n          zOrigDb = pNC->pParse->db->aDb[iDb].zDbSName;\n        }\n#else\n        if( iCol<0 ){\n          zType = \"INTEGER\";\n        }else{\n          zType = sqlite3ColumnType(&pTab->aCol[iCol],0);\n          estWidth = pTab->aCol[iCol].szEst;\n        }\n#endif\n      }\n      break;\n    }\n#ifndef SQLITE_OMIT_SUBQUERY\n    case TK_SELECT: {\n      /* The expression is a sub-select. Return the declaration type and\n      ** origin info for the single column in the result set of the SELECT\n      ** statement.\n      */\n      NameContext sNC;\n      Select *pS = pExpr->x.pSelect;\n      Expr *p = pS->pEList->a[0].pExpr;\n      assert( ExprHasProperty(pExpr, EP_xIsSelect) );\n      sNC.pSrcList = pS->pSrc;\n      sNC.pNext = pNC;\n      sNC.pParse = pNC->pParse;\n      zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol, &estWidth); \n      break;\n    }\n#endif\n  }\n\n#ifdef SQLITE_ENABLE_COLUMN_METADATA  \n  if( pzOrigDb ){\n    assert( pzOrigTab && pzOrigCol );\n    *pzOrigDb = zOrigDb;\n    *pzOrigTab = zOrigTab;\n    *pzOrigCol = zOrigCol;\n  }\n#endif\n  if( pEstWidth ) *pEstWidth = estWidth;\n  return zType;\n}\n\n/*\n** Generate code that will tell the VDBE the declaration types of columns\n** in the result set.\n*/\nstatic void generateColumnTypes(\n  Parse *pParse,      /* Parser context */\n  SrcList *pTabList,  /* List of tables */\n  ExprList *pEList    /* Expressions defining the result set */\n){\n#ifndef SQLITE_OMIT_DECLTYPE\n  Vdbe *v = pParse->pVdbe;\n  int i;\n  NameContext sNC;\n  sNC.pSrcList = pTabList;\n  sNC.pParse = pParse;\n  for(i=0; i<pEList->nExpr; i++){\n    Expr *p = pEList->a[i].pExpr;\n    const char *zType;\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\n    const char *zOrigDb = 0;\n    const char *zOrigTab = 0;\n    const char *zOrigCol = 0;\n    zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol, 0);\n\n    /* The vdbe must make its own copy of the column-type and other \n    ** column specific strings, in case the schema is reset before this\n    ** virtual machine is deleted.\n    */\n    sqlite3VdbeSetColName(v, i, COLNAME_DATABASE, zOrigDb, SQLITE_TRANSIENT);\n    sqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, SQLITE_TRANSIENT);\n    sqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, SQLITE_TRANSIENT);\n#else\n    zType = columnType(&sNC, p, 0, 0, 0, 0);\n#endif\n    sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT);\n  }\n#endif /* !defined(SQLITE_OMIT_DECLTYPE) */\n}\n\n/*\n** Generate code that will tell the VDBE the names of columns\n** in the result set.  This information is used to provide the\n** azCol[] values in the callback.\n*/\nstatic void generateColumnNames(\n  Parse *pParse,      /* Parser context */\n  SrcList *pTabList,  /* List of tables */\n  ExprList *pEList    /* Expressions defining the result set */\n){\n  Vdbe *v = pParse->pVdbe;\n  int i, j;\n  sqlite3 *db = pParse->db;\n  int fullNames, shortNames;\n\n#ifndef SQLITE_OMIT_EXPLAIN\n  /* If this is an EXPLAIN, skip this step */\n  if( pParse->explain ){\n    return;\n  }\n#endif\n\n  if( pParse->colNamesSet || db->mallocFailed ) return;\n  assert( v!=0 );\n  assert( pTabList!=0 );\n  pParse->colNamesSet = 1;\n  fullNames = (db->flags & SQLITE_FullColNames)!=0;\n  shortNames = (db->flags & SQLITE_ShortColNames)!=0;\n  sqlite3VdbeSetNumCols(v, pEList->nExpr);\n  for(i=0; i<pEList->nExpr; i++){\n    Expr *p;\n    p = pEList->a[i].pExpr;\n    if( NEVER(p==0) ) continue;\n    if( pEList->a[i].zName ){\n      char *zName = pEList->a[i].zName;\n      sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);\n    }else if( p->op==TK_COLUMN || p->op==TK_AGG_COLUMN ){\n      Table *pTab;\n      char *zCol;\n      int iCol = p->iColumn;\n      for(j=0; ALWAYS(j<pTabList->nSrc); j++){\n        if( pTabList->a[j].iCursor==p->iTable ) break;\n      }\n      assert( j<pTabList->nSrc );\n      pTab = pTabList->a[j].pTab;\n      if( iCol<0 ) iCol = pTab->iPKey;\n      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );\n      if( iCol<0 ){\n        zCol = \"rowid\";\n      }else{\n        zCol = pTab->aCol[iCol].zName;\n      }\n      if( !shortNames && !fullNames ){\n        sqlite3VdbeSetColName(v, i, COLNAME_NAME, \n            sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC);\n      }else if( fullNames ){\n        char *zName = 0;\n        zName = sqlite3MPrintf(db, \"%s.%s\", pTab->zName, zCol);\n        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);\n      }else{\n        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);\n      }\n    }else{\n      const char *z = pEList->a[i].zSpan;\n      z = z==0 ? sqlite3MPrintf(db, \"column%d\", i+1) : sqlite3DbStrDup(db, z);\n      sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC);\n    }\n  }\n  generateColumnTypes(pParse, pTabList, pEList);\n}\n\n/*\n** Given an expression list (which is really the list of expressions\n** that form the result set of a SELECT statement) compute appropriate\n** column names for a table that would hold the expression list.\n**\n** All column names will be unique.\n**\n** Only the column names are computed.  Column.zType, Column.zColl,\n** and other fields of Column are zeroed.\n**\n** Return SQLITE_OK on success.  If a memory allocation error occurs,\n** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM.\n*/\nint sqlite3ColumnsFromExprList(\n  Parse *pParse,          /* Parsing context */\n  ExprList *pEList,       /* Expr list from which to derive column names */\n  i16 *pnCol,             /* Write the number of columns here */\n  Column **paCol          /* Write the new column list here */\n){\n  sqlite3 *db = pParse->db;   /* Database connection */\n  int i, j;                   /* Loop counters */\n  u32 cnt;                    /* Index added to make the name unique */\n  Column *aCol, *pCol;        /* For looping over result columns */\n  int nCol;                   /* Number of columns in the result set */\n  Expr *p;                    /* Expression for a single result column */\n  char *zName;                /* Column name */\n  int nName;                  /* Size of name in zName[] */\n  Hash ht;                    /* Hash table of column names */\n\n  sqlite3HashInit(&ht);\n  if( pEList ){\n    nCol = pEList->nExpr;\n    aCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol);\n    testcase( aCol==0 );\n  }else{\n    nCol = 0;\n    aCol = 0;\n  }\n  assert( nCol==(i16)nCol );\n  *pnCol = nCol;\n  *paCol = aCol;\n\n  for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){\n    /* Get an appropriate name for the column\n    */\n    p = sqlite3ExprSkipCollate(pEList->a[i].pExpr);\n    if( (zName = pEList->a[i].zName)!=0 ){\n      /* If the column contains an \"AS <name>\" phrase, use <name> as the name */\n    }else{\n      Expr *pColExpr = p;  /* The expression that is the result column name */\n      Table *pTab;         /* Table associated with this expression */\n      while( pColExpr->op==TK_DOT ){\n        pColExpr = pColExpr->pRight;\n        assert( pColExpr!=0 );\n      }\n      if( pColExpr->op==TK_COLUMN && ALWAYS(pColExpr->pTab!=0) ){\n        /* For columns use the column name name */\n        int iCol = pColExpr->iColumn;\n        pTab = pColExpr->pTab;\n        if( iCol<0 ) iCol = pTab->iPKey;\n        zName = iCol>=0 ? pTab->aCol[iCol].zName : \"rowid\";\n      }else if( pColExpr->op==TK_ID ){\n        assert( !ExprHasProperty(pColExpr, EP_IntValue) );\n        zName = pColExpr->u.zToken;\n      }else{\n        /* Use the original text of the column expression as its name */\n        zName = pEList->a[i].zSpan;\n      }\n    }\n    zName = sqlite3MPrintf(db, \"%s\", zName);\n\n    /* Make sure the column name is unique.  If the name is not unique,\n    ** append an integer to the name so that it becomes unique.\n    */\n    cnt = 0;\n    while( zName && sqlite3HashFind(&ht, zName)!=0 ){\n      nName = sqlite3Strlen30(zName);\n      if( nName>0 ){\n        for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){}\n        if( zName[j]==':' ) nName = j;\n      }\n      zName = sqlite3MPrintf(db, \"%.*z:%u\", nName, zName, ++cnt);\n      if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt);\n    }\n    pCol->zName = zName;\n    sqlite3ColumnPropertiesFromName(0, pCol);\n    if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){\n      sqlite3OomFault(db);\n    }\n  }\n  sqlite3HashClear(&ht);\n  if( db->mallocFailed ){\n    for(j=0; j<i; j++){\n      sqlite3DbFree(db, aCol[j].zName);\n    }\n    sqlite3DbFree(db, aCol);\n    *paCol = 0;\n    *pnCol = 0;\n    return SQLITE_NOMEM_BKPT;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Add type and collation information to a column list based on\n** a SELECT statement.\n** \n** The column list presumably came from selectColumnNamesFromExprList().\n** The column list has only names, not types or collations.  This\n** routine goes through and adds the types and collations.\n**\n** This routine requires that all identifiers in the SELECT\n** statement be resolved.\n*/\nvoid sqlite3SelectAddColumnTypeAndCollation(\n  Parse *pParse,        /* Parsing contexts */\n  Table *pTab,          /* Add column type information to this table */\n  Select *pSelect       /* SELECT used to determine types and collations */\n){\n  sqlite3 *db = pParse->db;\n  NameContext sNC;\n  Column *pCol;\n  CollSeq *pColl;\n  int i;\n  Expr *p;\n  struct ExprList_item *a;\n  u64 szAll = 0;\n\n  assert( pSelect!=0 );\n  assert( (pSelect->selFlags & SF_Resolved)!=0 );\n  assert( pTab->nCol==pSelect->pEList->nExpr || db->mallocFailed );\n  if( db->mallocFailed ) return;\n  memset(&sNC, 0, sizeof(sNC));\n  sNC.pSrcList = pSelect->pSrc;\n  a = pSelect->pEList->a;\n  for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){\n    const char *zType;\n    int n, m;\n    p = a[i].pExpr;\n    zType = columnType(&sNC, p, 0, 0, 0, &pCol->szEst);\n    szAll += pCol->szEst;\n    pCol->affinity = sqlite3ExprAffinity(p);\n    if( zType && (m = sqlite3Strlen30(zType))>0 ){\n      n = sqlite3Strlen30(pCol->zName);\n      pCol->zName = sqlite3DbReallocOrFree(db, pCol->zName, n+m+2);\n      if( pCol->zName ){\n        memcpy(&pCol->zName[n+1], zType, m+1);\n        pCol->colFlags |= COLFLAG_HASTYPE;\n      }\n    }\n    if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB;\n    pColl = sqlite3ExprCollSeq(pParse, p);\n    if( pColl && pCol->zColl==0 ){\n      pCol->zColl = sqlite3DbStrDup(db, pColl->zName);\n    }\n  }\n  pTab->szTabRow = sqlite3LogEst(szAll*4);\n}\n\n/*\n** Given a SELECT statement, generate a Table structure that describes\n** the result set of that SELECT.\n*/\nTable *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){\n  Table *pTab;\n  sqlite3 *db = pParse->db;\n  int savedFlags;\n\n  savedFlags = db->flags;\n  db->flags &= ~SQLITE_FullColNames;\n  db->flags |= SQLITE_ShortColNames;\n  sqlite3SelectPrep(pParse, pSelect, 0);\n  if( pParse->nErr ) return 0;\n  while( pSelect->pPrior ) pSelect = pSelect->pPrior;\n  db->flags = savedFlags;\n  pTab = sqlite3DbMallocZero(db, sizeof(Table) );\n  if( pTab==0 ){\n    return 0;\n  }\n  /* The sqlite3ResultSetOfSelect() is only used n contexts where lookaside\n  ** is disabled */\n  assert( db->lookaside.bDisable );\n  pTab->nRef = 1;\n  pTab->zName = 0;\n  pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );\n  sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);\n  sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect);\n  pTab->iPKey = -1;\n  if( db->mallocFailed ){\n    sqlite3DeleteTable(db, pTab);\n    return 0;\n  }\n  return pTab;\n}\n\n/*\n** Get a VDBE for the given parser context.  Create a new one if necessary.\n** If an error occurs, return NULL and leave a message in pParse.\n*/\nstatic SQLITE_NOINLINE Vdbe *allocVdbe(Parse *pParse){\n  Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(pParse);\n  if( v ) sqlite3VdbeAddOp2(v, OP_Init, 0, 1);\n  if( pParse->pToplevel==0\n   && OptimizationEnabled(pParse->db,SQLITE_FactorOutConst)\n  ){\n    pParse->okConstFactor = 1;\n  }\n  return v;\n}\nVdbe *sqlite3GetVdbe(Parse *pParse){\n  Vdbe *v = pParse->pVdbe;\n  return v ? v : allocVdbe(pParse);\n}\n\n\n/*\n** Compute the iLimit and iOffset fields of the SELECT based on the\n** pLimit and pOffset expressions.  pLimit and pOffset hold the expressions\n** that appear in the original SQL statement after the LIMIT and OFFSET\n** keywords.  Or NULL if those keywords are omitted. iLimit and iOffset \n** are the integer memory register numbers for counters used to compute \n** the limit and offset.  If there is no limit and/or offset, then \n** iLimit and iOffset are negative.\n**\n** This routine changes the values of iLimit and iOffset only if\n** a limit or offset is defined by pLimit and pOffset.  iLimit and\n** iOffset should have been preset to appropriate default values (zero)\n** prior to calling this routine.\n**\n** The iOffset register (if it exists) is initialized to the value\n** of the OFFSET.  The iLimit register is initialized to LIMIT.  Register\n** iOffset+1 is initialized to LIMIT+OFFSET.\n**\n** Only if pLimit!=0 or pOffset!=0 do the limit registers get\n** redefined.  The UNION ALL operator uses this property to force\n** the reuse of the same limit and offset registers across multiple\n** SELECT statements.\n*/\nstatic void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){\n  Vdbe *v = 0;\n  int iLimit = 0;\n  int iOffset;\n  int n;\n  if( p->iLimit ) return;\n\n  /* \n  ** \"LIMIT -1\" always shows all rows.  There is some\n  ** controversy about what the correct behavior should be.\n  ** The current implementation interprets \"LIMIT 0\" to mean\n  ** no rows.\n  */\n  sqlite3ExprCacheClear(pParse);\n  assert( p->pOffset==0 || p->pLimit!=0 );\n  if( p->pLimit ){\n    p->iLimit = iLimit = ++pParse->nMem;\n    v = sqlite3GetVdbe(pParse);\n    assert( v!=0 );\n    if( sqlite3ExprIsInteger(p->pLimit, &n) ){\n      sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);\n      VdbeComment((v, \"LIMIT counter\"));\n      if( n==0 ){\n        sqlite3VdbeGoto(v, iBreak);\n      }else if( n>=0 && p->nSelectRow>sqlite3LogEst((u64)n) ){\n        p->nSelectRow = sqlite3LogEst((u64)n);\n        p->selFlags |= SF_FixedLimit;\n      }\n    }else{\n      sqlite3ExprCode(pParse, p->pLimit, iLimit);\n      sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); VdbeCoverage(v);\n      VdbeComment((v, \"LIMIT counter\"));\n      sqlite3VdbeAddOp2(v, OP_IfNot, iLimit, iBreak); VdbeCoverage(v);\n    }\n    if( p->pOffset ){\n      p->iOffset = iOffset = ++pParse->nMem;\n      pParse->nMem++;   /* Allocate an extra register for limit+offset */\n      sqlite3ExprCode(pParse, p->pOffset, iOffset);\n      sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset); VdbeCoverage(v);\n      VdbeComment((v, \"OFFSET counter\"));\n      sqlite3VdbeAddOp3(v, OP_OffsetLimit, iLimit, iOffset+1, iOffset);\n      VdbeComment((v, \"LIMIT+OFFSET\"));\n    }\n  }\n}\n\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\n/*\n** Return the appropriate collating sequence for the iCol-th column of\n** the result set for the compound-select statement \"p\".  Return NULL if\n** the column has no default collating sequence.\n**\n** The collating sequence for the compound select is taken from the\n** left-most term of the select that has a collating sequence.\n*/\nstatic CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){\n  CollSeq *pRet;\n  if( p->pPrior ){\n    pRet = multiSelectCollSeq(pParse, p->pPrior, iCol);\n  }else{\n    pRet = 0;\n  }\n  assert( iCol>=0 );\n  /* iCol must be less than p->pEList->nExpr.  Otherwise an error would\n  ** have been thrown during name resolution and we would not have gotten\n  ** this far */\n  if( pRet==0 && ALWAYS(iCol<p->pEList->nExpr) ){\n    pRet = sqlite3ExprCollSeq(pParse, p->pEList->a[iCol].pExpr);\n  }\n  return pRet;\n}\n\n/*\n** The select statement passed as the second parameter is a compound SELECT\n** with an ORDER BY clause. This function allocates and returns a KeyInfo\n** structure suitable for implementing the ORDER BY.\n**\n** Space to hold the KeyInfo structure is obtained from malloc. The calling\n** function is responsible for ensuring that this structure is eventually\n** freed.\n*/\nstatic KeyInfo *multiSelectOrderByKeyInfo(Parse *pParse, Select *p, int nExtra){\n  ExprList *pOrderBy = p->pOrderBy;\n  int nOrderBy = p->pOrderBy->nExpr;\n  sqlite3 *db = pParse->db;\n  KeyInfo *pRet = sqlite3KeyInfoAlloc(db, nOrderBy+nExtra, 1);\n  if( pRet ){\n    int i;\n    for(i=0; i<nOrderBy; i++){\n      struct ExprList_item *pItem = &pOrderBy->a[i];\n      Expr *pTerm = pItem->pExpr;\n      CollSeq *pColl;\n\n      if( pTerm->flags & EP_Collate ){\n        pColl = sqlite3ExprCollSeq(pParse, pTerm);\n      }else{\n        pColl = multiSelectCollSeq(pParse, p, pItem->u.x.iOrderByCol-1);\n        if( pColl==0 ) pColl = db->pDfltColl;\n        pOrderBy->a[i].pExpr =\n          sqlite3ExprAddCollateString(pParse, pTerm, pColl->zName);\n      }\n      assert( sqlite3KeyInfoIsWriteable(pRet) );\n      pRet->aColl[i] = pColl;\n      pRet->aSortOrder[i] = pOrderBy->a[i].sortOrder;\n    }\n  }\n\n  return pRet;\n}\n\n#ifndef SQLITE_OMIT_CTE\n/*\n** This routine generates VDBE code to compute the content of a WITH RECURSIVE\n** query of the form:\n**\n**   <recursive-table> AS (<setup-query> UNION [ALL] <recursive-query>)\n**                         \\___________/             \\_______________/\n**                           p->pPrior                      p\n**\n**\n** There is exactly one reference to the recursive-table in the FROM clause\n** of recursive-query, marked with the SrcList->a[].fg.isRecursive flag.\n**\n** The setup-query runs once to generate an initial set of rows that go\n** into a Queue table.  Rows are extracted from the Queue table one by\n** one.  Each row extracted from Queue is output to pDest.  Then the single\n** extracted row (now in the iCurrent table) becomes the content of the\n** recursive-table for a recursive-query run.  The output of the recursive-query\n** is added back into the Queue table.  Then another row is extracted from Queue\n** and the iteration continues until the Queue table is empty.\n**\n** If the compound query operator is UNION then no duplicate rows are ever\n** inserted into the Queue table.  The iDistinct table keeps a copy of all rows\n** that have ever been inserted into Queue and causes duplicates to be\n** discarded.  If the operator is UNION ALL, then duplicates are allowed.\n** \n** If the query has an ORDER BY, then entries in the Queue table are kept in\n** ORDER BY order and the first entry is extracted for each cycle.  Without\n** an ORDER BY, the Queue table is just a FIFO.\n**\n** If a LIMIT clause is provided, then the iteration stops after LIMIT rows\n** have been output to pDest.  A LIMIT of zero means to output no rows and a\n** negative LIMIT means to output all rows.  If there is also an OFFSET clause\n** with a positive value, then the first OFFSET outputs are discarded rather\n** than being sent to pDest.  The LIMIT count does not begin until after OFFSET\n** rows have been skipped.\n*/\nstatic void generateWithRecursiveQuery(\n  Parse *pParse,        /* Parsing context */\n  Select *p,            /* The recursive SELECT to be coded */\n  SelectDest *pDest     /* What to do with query results */\n){\n  SrcList *pSrc = p->pSrc;      /* The FROM clause of the recursive query */\n  int nCol = p->pEList->nExpr;  /* Number of columns in the recursive table */\n  Vdbe *v = pParse->pVdbe;      /* The prepared statement under construction */\n  Select *pSetup = p->pPrior;   /* The setup query */\n  int addrTop;                  /* Top of the loop */\n  int addrCont, addrBreak;      /* CONTINUE and BREAK addresses */\n  int iCurrent = 0;             /* The Current table */\n  int regCurrent;               /* Register holding Current table */\n  int iQueue;                   /* The Queue table */\n  int iDistinct = 0;            /* To ensure unique results if UNION */\n  int eDest = SRT_Fifo;         /* How to write to Queue */\n  SelectDest destQueue;         /* SelectDest targetting the Queue table */\n  int i;                        /* Loop counter */\n  int rc;                       /* Result code */\n  ExprList *pOrderBy;           /* The ORDER BY clause */\n  Expr *pLimit, *pOffset;       /* Saved LIMIT and OFFSET */\n  int regLimit, regOffset;      /* Registers used by LIMIT and OFFSET */\n\n  /* Obtain authorization to do a recursive query */\n  if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return;\n\n  /* Process the LIMIT and OFFSET clauses, if they exist */\n  addrBreak = sqlite3VdbeMakeLabel(v);\n  computeLimitRegisters(pParse, p, addrBreak);\n  pLimit = p->pLimit;\n  pOffset = p->pOffset;\n  regLimit = p->iLimit;\n  regOffset = p->iOffset;\n  p->pLimit = p->pOffset = 0;\n  p->iLimit = p->iOffset = 0;\n  pOrderBy = p->pOrderBy;\n\n  /* Locate the cursor number of the Current table */\n  for(i=0; ALWAYS(i<pSrc->nSrc); i++){\n    if( pSrc->a[i].fg.isRecursive ){\n      iCurrent = pSrc->a[i].iCursor;\n      break;\n    }\n  }\n\n  /* Allocate cursors numbers for Queue and Distinct.  The cursor number for\n  ** the Distinct table must be exactly one greater than Queue in order\n  ** for the SRT_DistFifo and SRT_DistQueue destinations to work. */\n  iQueue = pParse->nTab++;\n  if( p->op==TK_UNION ){\n    eDest = pOrderBy ? SRT_DistQueue : SRT_DistFifo;\n    iDistinct = pParse->nTab++;\n  }else{\n    eDest = pOrderBy ? SRT_Queue : SRT_Fifo;\n  }\n  sqlite3SelectDestInit(&destQueue, eDest, iQueue);\n\n  /* Allocate cursors for Current, Queue, and Distinct. */\n  regCurrent = ++pParse->nMem;\n  sqlite3VdbeAddOp3(v, OP_OpenPseudo, iCurrent, regCurrent, nCol);\n  if( pOrderBy ){\n    KeyInfo *pKeyInfo = multiSelectOrderByKeyInfo(pParse, p, 1);\n    sqlite3VdbeAddOp4(v, OP_OpenEphemeral, iQueue, pOrderBy->nExpr+2, 0,\n                      (char*)pKeyInfo, P4_KEYINFO);\n    destQueue.pOrderBy = pOrderBy;\n  }else{\n    sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iQueue, nCol);\n  }\n  VdbeComment((v, \"Queue table\"));\n  if( iDistinct ){\n    p->addrOpenEphm[0] = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iDistinct, 0);\n    p->selFlags |= SF_UsesEphemeral;\n  }\n\n  /* Detach the ORDER BY clause from the compound SELECT */\n  p->pOrderBy = 0;\n\n  /* Store the results of the setup-query in Queue. */\n  pSetup->pNext = 0;\n  rc = sqlite3Select(pParse, pSetup, &destQueue);\n  pSetup->pNext = p;\n  if( rc ) goto end_of_recursive_query;\n\n  /* Find the next row in the Queue and output that row */\n  addrTop = sqlite3VdbeAddOp2(v, OP_Rewind, iQueue, addrBreak); VdbeCoverage(v);\n\n  /* Transfer the next row in Queue over to Current */\n  sqlite3VdbeAddOp1(v, OP_NullRow, iCurrent); /* To reset column cache */\n  if( pOrderBy ){\n    sqlite3VdbeAddOp3(v, OP_Column, iQueue, pOrderBy->nExpr+1, regCurrent);\n  }else{\n    sqlite3VdbeAddOp2(v, OP_RowData, iQueue, regCurrent);\n  }\n  sqlite3VdbeAddOp1(v, OP_Delete, iQueue);\n\n  /* Output the single row in Current */\n  addrCont = sqlite3VdbeMakeLabel(v);\n  codeOffset(v, regOffset, addrCont);\n  selectInnerLoop(pParse, p, p->pEList, iCurrent,\n      0, 0, pDest, addrCont, addrBreak);\n  if( regLimit ){\n    sqlite3VdbeAddOp2(v, OP_DecrJumpZero, regLimit, addrBreak);\n    VdbeCoverage(v);\n  }\n  sqlite3VdbeResolveLabel(v, addrCont);\n\n  /* Execute the recursive SELECT taking the single row in Current as\n  ** the value for the recursive-table. Store the results in the Queue.\n  */\n  if( p->selFlags & SF_Aggregate ){\n    sqlite3ErrorMsg(pParse, \"recursive aggregate queries not supported\");\n  }else{\n    p->pPrior = 0;\n    sqlite3Select(pParse, p, &destQueue);\n    assert( p->pPrior==0 );\n    p->pPrior = pSetup;\n  }\n\n  /* Keep running the loop until the Queue is empty */\n  sqlite3VdbeGoto(v, addrTop);\n  sqlite3VdbeResolveLabel(v, addrBreak);\n\nend_of_recursive_query:\n  sqlite3ExprListDelete(pParse->db, p->pOrderBy);\n  p->pOrderBy = pOrderBy;\n  p->pLimit = pLimit;\n  p->pOffset = pOffset;\n  return;\n}\n#endif /* SQLITE_OMIT_CTE */\n\n/* Forward references */\nstatic int multiSelectOrderBy(\n  Parse *pParse,        /* Parsing context */\n  Select *p,            /* The right-most of SELECTs to be coded */\n  SelectDest *pDest     /* What to do with query results */\n);\n\n/*\n** Handle the special case of a compound-select that originates from a\n** VALUES clause.  By handling this as a special case, we avoid deep\n** recursion, and thus do not need to enforce the SQLITE_LIMIT_COMPOUND_SELECT\n** on a VALUES clause.\n**\n** Because the Select object originates from a VALUES clause:\n**   (1) It has no LIMIT or OFFSET\n**   (2) All terms are UNION ALL\n**   (3) There is no ORDER BY clause\n*/\nstatic int multiSelectValues(\n  Parse *pParse,        /* Parsing context */\n  Select *p,            /* The right-most of SELECTs to be coded */\n  SelectDest *pDest     /* What to do with query results */\n){\n  Select *pPrior;\n  int nRow = 1;\n  int rc = 0;\n  assert( p->selFlags & SF_MultiValue );\n  do{\n    assert( p->selFlags & SF_Values );\n    assert( p->op==TK_ALL || (p->op==TK_SELECT && p->pPrior==0) );\n    assert( p->pLimit==0 );\n    assert( p->pOffset==0 );\n    assert( p->pNext==0 || p->pEList->nExpr==p->pNext->pEList->nExpr );\n    if( p->pPrior==0 ) break;\n    assert( p->pPrior->pNext==p );\n    p = p->pPrior;\n    nRow++;\n  }while(1);\n  while( p ){\n    pPrior = p->pPrior;\n    p->pPrior = 0;\n    rc = sqlite3Select(pParse, p, pDest);\n    p->pPrior = pPrior;\n    if( rc ) break;\n    p->nSelectRow = nRow;\n    p = p->pNext;\n  }\n  return rc;\n}\n\n/*\n** This routine is called to process a compound query form from\n** two or more separate queries using UNION, UNION ALL, EXCEPT, or\n** INTERSECT\n**\n** \"p\" points to the right-most of the two queries.  the query on the\n** left is p->pPrior.  The left query could also be a compound query\n** in which case this routine will be called recursively. \n**\n** The results of the total query are to be written into a destination\n** of type eDest with parameter iParm.\n**\n** Example 1:  Consider a three-way compound SQL statement.\n**\n**     SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3\n**\n** This statement is parsed up as follows:\n**\n**     SELECT c FROM t3\n**      |\n**      `----->  SELECT b FROM t2\n**                |\n**                `------>  SELECT a FROM t1\n**\n** The arrows in the diagram above represent the Select.pPrior pointer.\n** So if this routine is called with p equal to the t3 query, then\n** pPrior will be the t2 query.  p->op will be TK_UNION in this case.\n**\n** Notice that because of the way SQLite parses compound SELECTs, the\n** individual selects always group from left to right.\n*/\nstatic int multiSelect(\n  Parse *pParse,        /* Parsing context */\n  Select *p,            /* The right-most of SELECTs to be coded */\n  SelectDest *pDest     /* What to do with query results */\n){\n  int rc = SQLITE_OK;   /* Success code from a subroutine */\n  Select *pPrior;       /* Another SELECT immediately to our left */\n  Vdbe *v;              /* Generate code to this VDBE */\n  SelectDest dest;      /* Alternative data destination */\n  Select *pDelete = 0;  /* Chain of simple selects to delete */\n  sqlite3 *db;          /* Database connection */\n#ifndef SQLITE_OMIT_EXPLAIN\n  int iSub1 = 0;        /* EQP id of left-hand query */\n  int iSub2 = 0;        /* EQP id of right-hand query */\n#endif\n\n  /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs.  Only\n  ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.\n  */\n  assert( p && p->pPrior );  /* Calling function guarantees this much */\n  assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION );\n  db = pParse->db;\n  pPrior = p->pPrior;\n  dest = *pDest;\n  if( pPrior->pOrderBy ){\n    sqlite3ErrorMsg(pParse,\"ORDER BY clause should come after %s not before\",\n      selectOpName(p->op));\n    rc = 1;\n    goto multi_select_end;\n  }\n  if( pPrior->pLimit ){\n    sqlite3ErrorMsg(pParse,\"LIMIT clause should come after %s not before\",\n      selectOpName(p->op));\n    rc = 1;\n    goto multi_select_end;\n  }\n\n  v = sqlite3GetVdbe(pParse);\n  assert( v!=0 );  /* The VDBE already created by calling function */\n\n  /* Create the destination temporary table if necessary\n  */\n  if( dest.eDest==SRT_EphemTab ){\n    assert( p->pEList );\n    sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr);\n    dest.eDest = SRT_Table;\n  }\n\n  /* Special handling for a compound-select that originates as a VALUES clause.\n  */\n  if( p->selFlags & SF_MultiValue ){\n    rc = multiSelectValues(pParse, p, &dest);\n    goto multi_select_end;\n  }\n\n  /* Make sure all SELECTs in the statement have the same number of elements\n  ** in their result sets.\n  */\n  assert( p->pEList && pPrior->pEList );\n  assert( p->pEList->nExpr==pPrior->pEList->nExpr );\n\n#ifndef SQLITE_OMIT_CTE\n  if( p->selFlags & SF_Recursive ){\n    generateWithRecursiveQuery(pParse, p, &dest);\n  }else\n#endif\n\n  /* Compound SELECTs that have an ORDER BY clause are handled separately.\n  */\n  if( p->pOrderBy ){\n    return multiSelectOrderBy(pParse, p, pDest);\n  }else\n\n  /* Generate code for the left and right SELECT statements.\n  */\n  switch( p->op ){\n    case TK_ALL: {\n      int addr = 0;\n      int nLimit;\n      assert( !pPrior->pLimit );\n      pPrior->iLimit = p->iLimit;\n      pPrior->iOffset = p->iOffset;\n      pPrior->pLimit = p->pLimit;\n      pPrior->pOffset = p->pOffset;\n      explainSetInteger(iSub1, pParse->iNextSelectId);\n      rc = sqlite3Select(pParse, pPrior, &dest);\n      p->pLimit = 0;\n      p->pOffset = 0;\n      if( rc ){\n        goto multi_select_end;\n      }\n      p->pPrior = 0;\n      p->iLimit = pPrior->iLimit;\n      p->iOffset = pPrior->iOffset;\n      if( p->iLimit ){\n        addr = sqlite3VdbeAddOp1(v, OP_IfNot, p->iLimit); VdbeCoverage(v);\n        VdbeComment((v, \"Jump ahead if LIMIT reached\"));\n        if( p->iOffset ){\n          sqlite3VdbeAddOp3(v, OP_OffsetLimit,\n                            p->iLimit, p->iOffset+1, p->iOffset);\n        }\n      }\n      explainSetInteger(iSub2, pParse->iNextSelectId);\n      rc = sqlite3Select(pParse, p, &dest);\n      testcase( rc!=SQLITE_OK );\n      pDelete = p->pPrior;\n      p->pPrior = pPrior;\n      p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n      if( pPrior->pLimit\n       && sqlite3ExprIsInteger(pPrior->pLimit, &nLimit)\n       && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit) \n      ){\n        p->nSelectRow = sqlite3LogEst((u64)nLimit);\n      }\n      if( addr ){\n        sqlite3VdbeJumpHere(v, addr);\n      }\n      break;\n    }\n    case TK_EXCEPT:\n    case TK_UNION: {\n      int unionTab;    /* Cursor number of the temporary table holding result */\n      u8 op = 0;       /* One of the SRT_ operations to apply to self */\n      int priorOp;     /* The SRT_ operation to apply to prior selects */\n      Expr *pLimit, *pOffset; /* Saved values of p->nLimit and p->nOffset */\n      int addr;\n      SelectDest uniondest;\n\n      testcase( p->op==TK_EXCEPT );\n      testcase( p->op==TK_UNION );\n      priorOp = SRT_Union;\n      if( dest.eDest==priorOp ){\n        /* We can reuse a temporary table generated by a SELECT to our\n        ** right.\n        */\n        assert( p->pLimit==0 );      /* Not allowed on leftward elements */\n        assert( p->pOffset==0 );     /* Not allowed on leftward elements */\n        unionTab = dest.iSDParm;\n      }else{\n        /* We will need to create our own temporary table to hold the\n        ** intermediate results.\n        */\n        unionTab = pParse->nTab++;\n        assert( p->pOrderBy==0 );\n        addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0);\n        assert( p->addrOpenEphm[0] == -1 );\n        p->addrOpenEphm[0] = addr;\n        findRightmost(p)->selFlags |= SF_UsesEphemeral;\n        assert( p->pEList );\n      }\n\n      /* Code the SELECT statements to our left\n      */\n      assert( !pPrior->pOrderBy );\n      sqlite3SelectDestInit(&uniondest, priorOp, unionTab);\n      explainSetInteger(iSub1, pParse->iNextSelectId);\n      rc = sqlite3Select(pParse, pPrior, &uniondest);\n      if( rc ){\n        goto multi_select_end;\n      }\n\n      /* Code the current SELECT statement\n      */\n      if( p->op==TK_EXCEPT ){\n        op = SRT_Except;\n      }else{\n        assert( p->op==TK_UNION );\n        op = SRT_Union;\n      }\n      p->pPrior = 0;\n      pLimit = p->pLimit;\n      p->pLimit = 0;\n      pOffset = p->pOffset;\n      p->pOffset = 0;\n      uniondest.eDest = op;\n      explainSetInteger(iSub2, pParse->iNextSelectId);\n      rc = sqlite3Select(pParse, p, &uniondest);\n      testcase( rc!=SQLITE_OK );\n      /* Query flattening in sqlite3Select() might refill p->pOrderBy.\n      ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */\n      sqlite3ExprListDelete(db, p->pOrderBy);\n      pDelete = p->pPrior;\n      p->pPrior = pPrior;\n      p->pOrderBy = 0;\n      if( p->op==TK_UNION ){\n        p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n      }\n      sqlite3ExprDelete(db, p->pLimit);\n      p->pLimit = pLimit;\n      p->pOffset = pOffset;\n      p->iLimit = 0;\n      p->iOffset = 0;\n\n      /* Convert the data in the temporary table into whatever form\n      ** it is that we currently need.\n      */\n      assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );\n      if( dest.eDest!=priorOp ){\n        int iCont, iBreak, iStart;\n        assert( p->pEList );\n        if( dest.eDest==SRT_Output ){\n          Select *pFirst = p;\n          while( pFirst->pPrior ) pFirst = pFirst->pPrior;\n          generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);\n        }\n        iBreak = sqlite3VdbeMakeLabel(v);\n        iCont = sqlite3VdbeMakeLabel(v);\n        computeLimitRegisters(pParse, p, iBreak);\n        sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);\n        iStart = sqlite3VdbeCurrentAddr(v);\n        selectInnerLoop(pParse, p, p->pEList, unionTab,\n                        0, 0, &dest, iCont, iBreak);\n        sqlite3VdbeResolveLabel(v, iCont);\n        sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v);\n        sqlite3VdbeResolveLabel(v, iBreak);\n        sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0);\n      }\n      break;\n    }\n    default: assert( p->op==TK_INTERSECT ); {\n      int tab1, tab2;\n      int iCont, iBreak, iStart;\n      Expr *pLimit, *pOffset;\n      int addr;\n      SelectDest intersectdest;\n      int r1;\n\n      /* INTERSECT is different from the others since it requires\n      ** two temporary tables.  Hence it has its own case.  Begin\n      ** by allocating the tables we will need.\n      */\n      tab1 = pParse->nTab++;\n      tab2 = pParse->nTab++;\n      assert( p->pOrderBy==0 );\n\n      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0);\n      assert( p->addrOpenEphm[0] == -1 );\n      p->addrOpenEphm[0] = addr;\n      findRightmost(p)->selFlags |= SF_UsesEphemeral;\n      assert( p->pEList );\n\n      /* Code the SELECTs to our left into temporary table \"tab1\".\n      */\n      sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);\n      explainSetInteger(iSub1, pParse->iNextSelectId);\n      rc = sqlite3Select(pParse, pPrior, &intersectdest);\n      if( rc ){\n        goto multi_select_end;\n      }\n\n      /* Code the current SELECT into temporary table \"tab2\"\n      */\n      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0);\n      assert( p->addrOpenEphm[1] == -1 );\n      p->addrOpenEphm[1] = addr;\n      p->pPrior = 0;\n      pLimit = p->pLimit;\n      p->pLimit = 0;\n      pOffset = p->pOffset;\n      p->pOffset = 0;\n      intersectdest.iSDParm = tab2;\n      explainSetInteger(iSub2, pParse->iNextSelectId);\n      rc = sqlite3Select(pParse, p, &intersectdest);\n      testcase( rc!=SQLITE_OK );\n      pDelete = p->pPrior;\n      p->pPrior = pPrior;\n      if( p->nSelectRow>pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow;\n      sqlite3ExprDelete(db, p->pLimit);\n      p->pLimit = pLimit;\n      p->pOffset = pOffset;\n\n      /* Generate code to take the intersection of the two temporary\n      ** tables.\n      */\n      assert( p->pEList );\n      if( dest.eDest==SRT_Output ){\n        Select *pFirst = p;\n        while( pFirst->pPrior ) pFirst = pFirst->pPrior;\n        generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);\n      }\n      iBreak = sqlite3VdbeMakeLabel(v);\n      iCont = sqlite3VdbeMakeLabel(v);\n      computeLimitRegisters(pParse, p, iBreak);\n      sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);\n      r1 = sqlite3GetTempReg(pParse);\n      iStart = sqlite3VdbeAddOp2(v, OP_RowKey, tab1, r1);\n      sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0); VdbeCoverage(v);\n      sqlite3ReleaseTempReg(pParse, r1);\n      selectInnerLoop(pParse, p, p->pEList, tab1,\n                      0, 0, &dest, iCont, iBreak);\n      sqlite3VdbeResolveLabel(v, iCont);\n      sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v);\n      sqlite3VdbeResolveLabel(v, iBreak);\n      sqlite3VdbeAddOp2(v, OP_Close, tab2, 0);\n      sqlite3VdbeAddOp2(v, OP_Close, tab1, 0);\n      break;\n    }\n  }\n\n  explainComposite(pParse, p->op, iSub1, iSub2, p->op!=TK_ALL);\n\n  /* Compute collating sequences used by \n  ** temporary tables needed to implement the compound select.\n  ** Attach the KeyInfo structure to all temporary tables.\n  **\n  ** This section is run by the right-most SELECT statement only.\n  ** SELECT statements to the left always skip this part.  The right-most\n  ** SELECT might also skip this part if it has no ORDER BY clause and\n  ** no temp tables are required.\n  */\n  if( p->selFlags & SF_UsesEphemeral ){\n    int i;                        /* Loop counter */\n    KeyInfo *pKeyInfo;            /* Collating sequence for the result set */\n    Select *pLoop;                /* For looping through SELECT statements */\n    CollSeq **apColl;             /* For looping through pKeyInfo->aColl[] */\n    int nCol;                     /* Number of columns in result set */\n\n    assert( p->pNext==0 );\n    nCol = p->pEList->nExpr;\n    pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1);\n    if( !pKeyInfo ){\n      rc = SQLITE_NOMEM_BKPT;\n      goto multi_select_end;\n    }\n    for(i=0, apColl=pKeyInfo->aColl; i<nCol; i++, apColl++){\n      *apColl = multiSelectCollSeq(pParse, p, i);\n      if( 0==*apColl ){\n        *apColl = db->pDfltColl;\n      }\n    }\n\n    for(pLoop=p; pLoop; pLoop=pLoop->pPrior){\n      for(i=0; i<2; i++){\n        int addr = pLoop->addrOpenEphm[i];\n        if( addr<0 ){\n          /* If [0] is unused then [1] is also unused.  So we can\n          ** always safely abort as soon as the first unused slot is found */\n          assert( pLoop->addrOpenEphm[1]<0 );\n          break;\n        }\n        sqlite3VdbeChangeP2(v, addr, nCol);\n        sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo),\n                            P4_KEYINFO);\n        pLoop->addrOpenEphm[i] = -1;\n      }\n    }\n    sqlite3KeyInfoUnref(pKeyInfo);\n  }\n\nmulti_select_end:\n  pDest->iSdst = dest.iSdst;\n  pDest->nSdst = dest.nSdst;\n  sqlite3SelectDelete(db, pDelete);\n  return rc;\n}\n#endif /* SQLITE_OMIT_COMPOUND_SELECT */\n\n/*\n** Error message for when two or more terms of a compound select have different\n** size result sets.\n*/\nvoid sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p){\n  if( p->selFlags & SF_Values ){\n    sqlite3ErrorMsg(pParse, \"all VALUES must have the same number of terms\");\n  }else{\n    sqlite3ErrorMsg(pParse, \"SELECTs to the left and right of %s\"\n      \" do not have the same number of result columns\", selectOpName(p->op));\n  }\n}\n\n/*\n** Code an output subroutine for a coroutine implementation of a\n** SELECT statment.\n**\n** The data to be output is contained in pIn->iSdst.  There are\n** pIn->nSdst columns to be output.  pDest is where the output should\n** be sent.\n**\n** regReturn is the number of the register holding the subroutine\n** return address.\n**\n** If regPrev>0 then it is the first register in a vector that\n** records the previous output.  mem[regPrev] is a flag that is false\n** if there has been no previous output.  If regPrev>0 then code is\n** generated to suppress duplicates.  pKeyInfo is used for comparing\n** keys.\n**\n** If the LIMIT found in p->iLimit is reached, jump immediately to\n** iBreak.\n*/\nstatic int generateOutputSubroutine(\n  Parse *pParse,          /* Parsing context */\n  Select *p,              /* The SELECT statement */\n  SelectDest *pIn,        /* Coroutine supplying data */\n  SelectDest *pDest,      /* Where to send the data */\n  int regReturn,          /* The return address register */\n  int regPrev,            /* Previous result register.  No uniqueness if 0 */\n  KeyInfo *pKeyInfo,      /* For comparing with previous entry */\n  int iBreak              /* Jump here if we hit the LIMIT */\n){\n  Vdbe *v = pParse->pVdbe;\n  int iContinue;\n  int addr;\n\n  addr = sqlite3VdbeCurrentAddr(v);\n  iContinue = sqlite3VdbeMakeLabel(v);\n\n  /* Suppress duplicates for UNION, EXCEPT, and INTERSECT \n  */\n  if( regPrev ){\n    int addr1, addr2;\n    addr1 = sqlite3VdbeAddOp1(v, OP_IfNot, regPrev); VdbeCoverage(v);\n    addr2 = sqlite3VdbeAddOp4(v, OP_Compare, pIn->iSdst, regPrev+1, pIn->nSdst,\n                              (char*)sqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO);\n    sqlite3VdbeAddOp3(v, OP_Jump, addr2+2, iContinue, addr2+2); VdbeCoverage(v);\n    sqlite3VdbeJumpHere(v, addr1);\n    sqlite3VdbeAddOp3(v, OP_Copy, pIn->iSdst, regPrev+1, pIn->nSdst-1);\n    sqlite3VdbeAddOp2(v, OP_Integer, 1, regPrev);\n  }\n  if( pParse->db->mallocFailed ) return 0;\n\n  /* Suppress the first OFFSET entries if there is an OFFSET clause\n  */\n  codeOffset(v, p->iOffset, iContinue);\n\n  assert( pDest->eDest!=SRT_Exists );\n  assert( pDest->eDest!=SRT_Table );\n  switch( pDest->eDest ){\n    /* Store the result as data using a unique key.\n    */\n    case SRT_EphemTab: {\n      int r1 = sqlite3GetTempReg(pParse);\n      int r2 = sqlite3GetTempReg(pParse);\n      sqlite3VdbeAddOp3(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r1);\n      sqlite3VdbeAddOp2(v, OP_NewRowid, pDest->iSDParm, r2);\n      sqlite3VdbeAddOp3(v, OP_Insert, pDest->iSDParm, r1, r2);\n      sqlite3VdbeChangeP5(v, OPFLAG_APPEND);\n      sqlite3ReleaseTempReg(pParse, r2);\n      sqlite3ReleaseTempReg(pParse, r1);\n      break;\n    }\n\n#ifndef SQLITE_OMIT_SUBQUERY\n    /* If we are creating a set for an \"expr IN (SELECT ...)\".\n    */\n    case SRT_Set: {\n      int r1;\n      testcase( pIn->nSdst>1 );\n      r1 = sqlite3GetTempReg(pParse);\n      sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, \n          r1, pDest->zAffSdst, pIn->nSdst);\n      sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst);\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, pDest->iSDParm, r1);\n      sqlite3ReleaseTempReg(pParse, r1);\n      break;\n    }\n\n    /* If this is a scalar select that is part of an expression, then\n    ** store the results in the appropriate memory cell and break out\n    ** of the scan loop.\n    */\n    case SRT_Mem: {\n      assert( pIn->nSdst==1 || pParse->nErr>0 );  testcase( pIn->nSdst!=1 );\n      sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSDParm, 1);\n      /* The LIMIT clause will jump out of the loop for us */\n      break;\n    }\n#endif /* #ifndef SQLITE_OMIT_SUBQUERY */\n\n    /* The results are stored in a sequence of registers\n    ** starting at pDest->iSdst.  Then the co-routine yields.\n    */\n    case SRT_Coroutine: {\n      if( pDest->iSdst==0 ){\n        pDest->iSdst = sqlite3GetTempRange(pParse, pIn->nSdst);\n        pDest->nSdst = pIn->nSdst;\n      }\n      sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSdst, pIn->nSdst);\n      sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm);\n      break;\n    }\n\n    /* If none of the above, then the result destination must be\n    ** SRT_Output.  This routine is never called with any other\n    ** destination other than the ones handled above or SRT_Output.\n    **\n    ** For SRT_Output, results are stored in a sequence of registers.  \n    ** Then the OP_ResultRow opcode is used to cause sqlite3_step() to\n    ** return the next row of result.\n    */\n    default: {\n      assert( pDest->eDest==SRT_Output );\n      sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst);\n      sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst);\n      break;\n    }\n  }\n\n  /* Jump to the end of the loop if the LIMIT is reached.\n  */\n  if( p->iLimit ){\n    sqlite3VdbeAddOp2(v, OP_DecrJumpZero, p->iLimit, iBreak); VdbeCoverage(v);\n  }\n\n  /* Generate the subroutine return\n  */\n  sqlite3VdbeResolveLabel(v, iContinue);\n  sqlite3VdbeAddOp1(v, OP_Return, regReturn);\n\n  return addr;\n}\n\n/*\n** Alternative compound select code generator for cases when there\n** is an ORDER BY clause.\n**\n** We assume a query of the following form:\n**\n**      <selectA>  <operator>  <selectB>  ORDER BY <orderbylist>\n**\n** <operator> is one of UNION ALL, UNION, EXCEPT, or INTERSECT.  The idea\n** is to code both <selectA> and <selectB> with the ORDER BY clause as\n** co-routines.  Then run the co-routines in parallel and merge the results\n** into the output.  In addition to the two coroutines (called selectA and\n** selectB) there are 7 subroutines:\n**\n**    outA:    Move the output of the selectA coroutine into the output\n**             of the compound query.\n**\n**    outB:    Move the output of the selectB coroutine into the output\n**             of the compound query.  (Only generated for UNION and\n**             UNION ALL.  EXCEPT and INSERTSECT never output a row that\n**             appears only in B.)\n**\n**    AltB:    Called when there is data from both coroutines and A<B.\n**\n**    AeqB:    Called when there is data from both coroutines and A==B.\n**\n**    AgtB:    Called when there is data from both coroutines and A>B.\n**\n**    EofA:    Called when data is exhausted from selectA.\n**\n**    EofB:    Called when data is exhausted from selectB.\n**\n** The implementation of the latter five subroutines depend on which \n** <operator> is used:\n**\n**\n**             UNION ALL         UNION            EXCEPT          INTERSECT\n**          -------------  -----------------  --------------  -----------------\n**   AltB:   outA, nextA      outA, nextA       outA, nextA         nextA\n**\n**   AeqB:   outA, nextA         nextA             nextA         outA, nextA\n**\n**   AgtB:   outB, nextB      outB, nextB          nextB            nextB\n**\n**   EofA:   outB, nextB      outB, nextB          halt             halt\n**\n**   EofB:   outA, nextA      outA, nextA       outA, nextA         halt\n**\n** In the AltB, AeqB, and AgtB subroutines, an EOF on A following nextA\n** causes an immediate jump to EofA and an EOF on B following nextB causes\n** an immediate jump to EofB.  Within EofA and EofB, and EOF on entry or\n** following nextX causes a jump to the end of the select processing.\n**\n** Duplicate removal in the UNION, EXCEPT, and INTERSECT cases is handled\n** within the output subroutine.  The regPrev register set holds the previously\n** output value.  A comparison is made against this value and the output\n** is skipped if the next results would be the same as the previous.\n**\n** The implementation plan is to implement the two coroutines and seven\n** subroutines first, then put the control logic at the bottom.  Like this:\n**\n**          goto Init\n**     coA: coroutine for left query (A)\n**     coB: coroutine for right query (B)\n**    outA: output one row of A\n**    outB: output one row of B (UNION and UNION ALL only)\n**    EofA: ...\n**    EofB: ...\n**    AltB: ...\n**    AeqB: ...\n**    AgtB: ...\n**    Init: initialize coroutine registers\n**          yield coA\n**          if eof(A) goto EofA\n**          yield coB\n**          if eof(B) goto EofB\n**    Cmpr: Compare A, B\n**          Jump AltB, AeqB, AgtB\n**     End: ...\n**\n** We call AltB, AeqB, AgtB, EofA, and EofB \"subroutines\" but they are not\n** actually called using Gosub and they do not Return.  EofA and EofB loop\n** until all data is exhausted then jump to the \"end\" labe.  AltB, AeqB,\n** and AgtB jump to either L2 or to one of EofA or EofB.\n*/\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\nstatic int multiSelectOrderBy(\n  Parse *pParse,        /* Parsing context */\n  Select *p,            /* The right-most of SELECTs to be coded */\n  SelectDest *pDest     /* What to do with query results */\n){\n  int i, j;             /* Loop counters */\n  Select *pPrior;       /* Another SELECT immediately to our left */\n  Vdbe *v;              /* Generate code to this VDBE */\n  SelectDest destA;     /* Destination for coroutine A */\n  SelectDest destB;     /* Destination for coroutine B */\n  int regAddrA;         /* Address register for select-A coroutine */\n  int regAddrB;         /* Address register for select-B coroutine */\n  int addrSelectA;      /* Address of the select-A coroutine */\n  int addrSelectB;      /* Address of the select-B coroutine */\n  int regOutA;          /* Address register for the output-A subroutine */\n  int regOutB;          /* Address register for the output-B subroutine */\n  int addrOutA;         /* Address of the output-A subroutine */\n  int addrOutB = 0;     /* Address of the output-B subroutine */\n  int addrEofA;         /* Address of the select-A-exhausted subroutine */\n  int addrEofA_noB;     /* Alternate addrEofA if B is uninitialized */\n  int addrEofB;         /* Address of the select-B-exhausted subroutine */\n  int addrAltB;         /* Address of the A<B subroutine */\n  int addrAeqB;         /* Address of the A==B subroutine */\n  int addrAgtB;         /* Address of the A>B subroutine */\n  int regLimitA;        /* Limit register for select-A */\n  int regLimitB;        /* Limit register for select-A */\n  int regPrev;          /* A range of registers to hold previous output */\n  int savedLimit;       /* Saved value of p->iLimit */\n  int savedOffset;      /* Saved value of p->iOffset */\n  int labelCmpr;        /* Label for the start of the merge algorithm */\n  int labelEnd;         /* Label for the end of the overall SELECT stmt */\n  int addr1;            /* Jump instructions that get retargetted */\n  int op;               /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */\n  KeyInfo *pKeyDup = 0; /* Comparison information for duplicate removal */\n  KeyInfo *pKeyMerge;   /* Comparison information for merging rows */\n  sqlite3 *db;          /* Database connection */\n  ExprList *pOrderBy;   /* The ORDER BY clause */\n  int nOrderBy;         /* Number of terms in the ORDER BY clause */\n  int *aPermute;        /* Mapping from ORDER BY terms to result set columns */\n#ifndef SQLITE_OMIT_EXPLAIN\n  int iSub1;            /* EQP id of left-hand query */\n  int iSub2;            /* EQP id of right-hand query */\n#endif\n\n  assert( p->pOrderBy!=0 );\n  assert( pKeyDup==0 ); /* \"Managed\" code needs this.  Ticket #3382. */\n  db = pParse->db;\n  v = pParse->pVdbe;\n  assert( v!=0 );       /* Already thrown the error if VDBE alloc failed */\n  labelEnd = sqlite3VdbeMakeLabel(v);\n  labelCmpr = sqlite3VdbeMakeLabel(v);\n\n\n  /* Patch up the ORDER BY clause\n  */\n  op = p->op;  \n  pPrior = p->pPrior;\n  assert( pPrior->pOrderBy==0 );\n  pOrderBy = p->pOrderBy;\n  assert( pOrderBy );\n  nOrderBy = pOrderBy->nExpr;\n\n  /* For operators other than UNION ALL we have to make sure that\n  ** the ORDER BY clause covers every term of the result set.  Add\n  ** terms to the ORDER BY clause as necessary.\n  */\n  if( op!=TK_ALL ){\n    for(i=1; db->mallocFailed==0 && i<=p->pEList->nExpr; i++){\n      struct ExprList_item *pItem;\n      for(j=0, pItem=pOrderBy->a; j<nOrderBy; j++, pItem++){\n        assert( pItem->u.x.iOrderByCol>0 );\n        if( pItem->u.x.iOrderByCol==i ) break;\n      }\n      if( j==nOrderBy ){\n        Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);\n        if( pNew==0 ) return SQLITE_NOMEM_BKPT;\n        pNew->flags |= EP_IntValue;\n        pNew->u.iValue = i;\n        pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);\n        if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i;\n      }\n    }\n  }\n\n  /* Compute the comparison permutation and keyinfo that is used with\n  ** the permutation used to determine if the next\n  ** row of results comes from selectA or selectB.  Also add explicit\n  ** collations to the ORDER BY clause terms so that when the subqueries\n  ** to the right and the left are evaluated, they use the correct\n  ** collation.\n  */\n  aPermute = sqlite3DbMallocRawNN(db, sizeof(int)*(nOrderBy + 1));\n  if( aPermute ){\n    struct ExprList_item *pItem;\n    aPermute[0] = nOrderBy;\n    for(i=1, pItem=pOrderBy->a; i<=nOrderBy; i++, pItem++){\n      assert( pItem->u.x.iOrderByCol>0 );\n      assert( pItem->u.x.iOrderByCol<=p->pEList->nExpr );\n      aPermute[i] = pItem->u.x.iOrderByCol - 1;\n    }\n    pKeyMerge = multiSelectOrderByKeyInfo(pParse, p, 1);\n  }else{\n    pKeyMerge = 0;\n  }\n\n  /* Reattach the ORDER BY clause to the query.\n  */\n  p->pOrderBy = pOrderBy;\n  pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);\n\n  /* Allocate a range of temporary registers and the KeyInfo needed\n  ** for the logic that removes duplicate result rows when the\n  ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL).\n  */\n  if( op==TK_ALL ){\n    regPrev = 0;\n  }else{\n    int nExpr = p->pEList->nExpr;\n    assert( nOrderBy>=nExpr || db->mallocFailed );\n    regPrev = pParse->nMem+1;\n    pParse->nMem += nExpr+1;\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regPrev);\n    pKeyDup = sqlite3KeyInfoAlloc(db, nExpr, 1);\n    if( pKeyDup ){\n      assert( sqlite3KeyInfoIsWriteable(pKeyDup) );\n      for(i=0; i<nExpr; i++){\n        pKeyDup->aColl[i] = multiSelectCollSeq(pParse, p, i);\n        pKeyDup->aSortOrder[i] = 0;\n      }\n    }\n  }\n \n  /* Separate the left and the right query from one another\n  */\n  p->pPrior = 0;\n  pPrior->pNext = 0;\n  sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, \"ORDER\");\n  if( pPrior->pPrior==0 ){\n    sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, \"ORDER\");\n  }\n\n  /* Compute the limit registers */\n  computeLimitRegisters(pParse, p, labelEnd);\n  if( p->iLimit && op==TK_ALL ){\n    regLimitA = ++pParse->nMem;\n    regLimitB = ++pParse->nMem;\n    sqlite3VdbeAddOp2(v, OP_Copy, p->iOffset ? p->iOffset+1 : p->iLimit,\n                                  regLimitA);\n    sqlite3VdbeAddOp2(v, OP_Copy, regLimitA, regLimitB);\n  }else{\n    regLimitA = regLimitB = 0;\n  }\n  sqlite3ExprDelete(db, p->pLimit);\n  p->pLimit = 0;\n  sqlite3ExprDelete(db, p->pOffset);\n  p->pOffset = 0;\n\n  regAddrA = ++pParse->nMem;\n  regAddrB = ++pParse->nMem;\n  regOutA = ++pParse->nMem;\n  regOutB = ++pParse->nMem;\n  sqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA);\n  sqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB);\n\n  /* Generate a coroutine to evaluate the SELECT statement to the\n  ** left of the compound operator - the \"A\" select.\n  */\n  addrSelectA = sqlite3VdbeCurrentAddr(v) + 1;\n  addr1 = sqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrA, 0, addrSelectA);\n  VdbeComment((v, \"left SELECT\"));\n  pPrior->iLimit = regLimitA;\n  explainSetInteger(iSub1, pParse->iNextSelectId);\n  sqlite3Select(pParse, pPrior, &destA);\n  sqlite3VdbeEndCoroutine(v, regAddrA);\n  sqlite3VdbeJumpHere(v, addr1);\n\n  /* Generate a coroutine to evaluate the SELECT statement on \n  ** the right - the \"B\" select\n  */\n  addrSelectB = sqlite3VdbeCurrentAddr(v) + 1;\n  addr1 = sqlite3VdbeAddOp3(v, OP_InitCoroutine, regAddrB, 0, addrSelectB);\n  VdbeComment((v, \"right SELECT\"));\n  savedLimit = p->iLimit;\n  savedOffset = p->iOffset;\n  p->iLimit = regLimitB;\n  p->iOffset = 0;  \n  explainSetInteger(iSub2, pParse->iNextSelectId);\n  sqlite3Select(pParse, p, &destB);\n  p->iLimit = savedLimit;\n  p->iOffset = savedOffset;\n  sqlite3VdbeEndCoroutine(v, regAddrB);\n\n  /* Generate a subroutine that outputs the current row of the A\n  ** select as the next output row of the compound select.\n  */\n  VdbeNoopComment((v, \"Output routine for A\"));\n  addrOutA = generateOutputSubroutine(pParse,\n                 p, &destA, pDest, regOutA,\n                 regPrev, pKeyDup, labelEnd);\n  \n  /* Generate a subroutine that outputs the current row of the B\n  ** select as the next output row of the compound select.\n  */\n  if( op==TK_ALL || op==TK_UNION ){\n    VdbeNoopComment((v, \"Output routine for B\"));\n    addrOutB = generateOutputSubroutine(pParse,\n                 p, &destB, pDest, regOutB,\n                 regPrev, pKeyDup, labelEnd);\n  }\n  sqlite3KeyInfoUnref(pKeyDup);\n\n  /* Generate a subroutine to run when the results from select A\n  ** are exhausted and only data in select B remains.\n  */\n  if( op==TK_EXCEPT || op==TK_INTERSECT ){\n    addrEofA_noB = addrEofA = labelEnd;\n  }else{  \n    VdbeNoopComment((v, \"eof-A subroutine\"));\n    addrEofA = sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB);\n    addrEofA_noB = sqlite3VdbeAddOp2(v, OP_Yield, regAddrB, labelEnd);\n                                     VdbeCoverage(v);\n    sqlite3VdbeGoto(v, addrEofA);\n    p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);\n  }\n\n  /* Generate a subroutine to run when the results from select B\n  ** are exhausted and only data in select A remains.\n  */\n  if( op==TK_INTERSECT ){\n    addrEofB = addrEofA;\n    if( p->nSelectRow > pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow;\n  }else{  \n    VdbeNoopComment((v, \"eof-B subroutine\"));\n    addrEofB = sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA);\n    sqlite3VdbeAddOp2(v, OP_Yield, regAddrA, labelEnd); VdbeCoverage(v);\n    sqlite3VdbeGoto(v, addrEofB);\n  }\n\n  /* Generate code to handle the case of A<B\n  */\n  VdbeNoopComment((v, \"A-lt-B subroutine\"));\n  addrAltB = sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA);\n  sqlite3VdbeAddOp2(v, OP_Yield, regAddrA, addrEofA); VdbeCoverage(v);\n  sqlite3VdbeGoto(v, labelCmpr);\n\n  /* Generate code to handle the case of A==B\n  */\n  if( op==TK_ALL ){\n    addrAeqB = addrAltB;\n  }else if( op==TK_INTERSECT ){\n    addrAeqB = addrAltB;\n    addrAltB++;\n  }else{\n    VdbeNoopComment((v, \"A-eq-B subroutine\"));\n    addrAeqB =\n    sqlite3VdbeAddOp2(v, OP_Yield, regAddrA, addrEofA); VdbeCoverage(v);\n    sqlite3VdbeGoto(v, labelCmpr);\n  }\n\n  /* Generate code to handle the case of A>B\n  */\n  VdbeNoopComment((v, \"A-gt-B subroutine\"));\n  addrAgtB = sqlite3VdbeCurrentAddr(v);\n  if( op==TK_ALL || op==TK_UNION ){\n    sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB);\n  }\n  sqlite3VdbeAddOp2(v, OP_Yield, regAddrB, addrEofB); VdbeCoverage(v);\n  sqlite3VdbeGoto(v, labelCmpr);\n\n  /* This code runs once to initialize everything.\n  */\n  sqlite3VdbeJumpHere(v, addr1);\n  sqlite3VdbeAddOp2(v, OP_Yield, regAddrA, addrEofA_noB); VdbeCoverage(v);\n  sqlite3VdbeAddOp2(v, OP_Yield, regAddrB, addrEofB); VdbeCoverage(v);\n\n  /* Implement the main merge loop\n  */\n  sqlite3VdbeResolveLabel(v, labelCmpr);\n  sqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY);\n  sqlite3VdbeAddOp4(v, OP_Compare, destA.iSdst, destB.iSdst, nOrderBy,\n                         (char*)pKeyMerge, P4_KEYINFO);\n  sqlite3VdbeChangeP5(v, OPFLAG_PERMUTE);\n  sqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB); VdbeCoverage(v);\n\n  /* Jump to the this point in order to terminate the query.\n  */\n  sqlite3VdbeResolveLabel(v, labelEnd);\n\n  /* Set the number of output columns\n  */\n  if( pDest->eDest==SRT_Output ){\n    Select *pFirst = pPrior;\n    while( pFirst->pPrior ) pFirst = pFirst->pPrior;\n    generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);\n  }\n\n  /* Reassembly the compound query so that it will be freed correctly\n  ** by the calling function */\n  if( p->pPrior ){\n    sqlite3SelectDelete(db, p->pPrior);\n  }\n  p->pPrior = pPrior;\n  pPrior->pNext = p;\n\n  /*** TBD:  Insert subroutine calls to close cursors on incomplete\n  **** subqueries ****/\n  explainComposite(pParse, p->op, iSub1, iSub2, 0);\n  return pParse->nErr!=0;\n}\n#endif\n\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\n/* Forward Declarations */\nstatic void substExprList(sqlite3*, ExprList*, int, ExprList*);\nstatic void substSelect(sqlite3*, Select *, int, ExprList*, int);\n\n/*\n** Scan through the expression pExpr.  Replace every reference to\n** a column in table number iTable with a copy of the iColumn-th\n** entry in pEList.  (But leave references to the ROWID column \n** unchanged.)\n**\n** This routine is part of the flattening procedure.  A subquery\n** whose result set is defined by pEList appears as entry in the\n** FROM clause of a SELECT such that the VDBE cursor assigned to that\n** FORM clause entry is iTable.  This routine make the necessary \n** changes to pExpr so that it refers directly to the source table\n** of the subquery rather the result set of the subquery.\n*/\nstatic Expr *substExpr(\n  sqlite3 *db,        /* Report malloc errors to this connection */\n  Expr *pExpr,        /* Expr in which substitution occurs */\n  int iTable,         /* Table to be substituted */\n  ExprList *pEList    /* Substitute expressions */\n){\n  if( pExpr==0 ) return 0;\n  if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){\n    if( pExpr->iColumn<0 ){\n      pExpr->op = TK_NULL;\n    }else{\n      Expr *pNew;\n      assert( pEList!=0 && pExpr->iColumn<pEList->nExpr );\n      assert( pExpr->pLeft==0 && pExpr->pRight==0 );\n      pNew = sqlite3ExprDup(db, pEList->a[pExpr->iColumn].pExpr, 0);\n      sqlite3ExprDelete(db, pExpr);\n      pExpr = pNew;\n    }\n  }else{\n    pExpr->pLeft = substExpr(db, pExpr->pLeft, iTable, pEList);\n    pExpr->pRight = substExpr(db, pExpr->pRight, iTable, pEList);\n    if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n      substSelect(db, pExpr->x.pSelect, iTable, pEList, 1);\n    }else{\n      substExprList(db, pExpr->x.pList, iTable, pEList);\n    }\n  }\n  return pExpr;\n}\nstatic void substExprList(\n  sqlite3 *db,         /* Report malloc errors here */\n  ExprList *pList,     /* List to scan and in which to make substitutes */\n  int iTable,          /* Table to be substituted */\n  ExprList *pEList     /* Substitute values */\n){\n  int i;\n  if( pList==0 ) return;\n  for(i=0; i<pList->nExpr; i++){\n    pList->a[i].pExpr = substExpr(db, pList->a[i].pExpr, iTable, pEList);\n  }\n}\nstatic void substSelect(\n  sqlite3 *db,         /* Report malloc errors here */\n  Select *p,           /* SELECT statement in which to make substitutions */\n  int iTable,          /* Table to be replaced */\n  ExprList *pEList,    /* Substitute values */\n  int doPrior          /* Do substitutes on p->pPrior too */\n){\n  SrcList *pSrc;\n  struct SrcList_item *pItem;\n  int i;\n  if( !p ) return;\n  do{\n    substExprList(db, p->pEList, iTable, pEList);\n    substExprList(db, p->pGroupBy, iTable, pEList);\n    substExprList(db, p->pOrderBy, iTable, pEList);\n    p->pHaving = substExpr(db, p->pHaving, iTable, pEList);\n    p->pWhere = substExpr(db, p->pWhere, iTable, pEList);\n    pSrc = p->pSrc;\n    assert( pSrc!=0 );\n    for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){\n      substSelect(db, pItem->pSelect, iTable, pEList, 1);\n      if( pItem->fg.isTabFunc ){\n        substExprList(db, pItem->u1.pFuncArg, iTable, pEList);\n      }\n    }\n  }while( doPrior && (p = p->pPrior)!=0 );\n}\n#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */\n\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\n/*\n** This routine attempts to flatten subqueries as a performance optimization.\n** This routine returns 1 if it makes changes and 0 if no flattening occurs.\n**\n** To understand the concept of flattening, consider the following\n** query:\n**\n**     SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5\n**\n** The default way of implementing this query is to execute the\n** subquery first and store the results in a temporary table, then\n** run the outer query on that temporary table.  This requires two\n** passes over the data.  Furthermore, because the temporary table\n** has no indices, the WHERE clause on the outer query cannot be\n** optimized.\n**\n** This routine attempts to rewrite queries such as the above into\n** a single flat select, like this:\n**\n**     SELECT x+y AS a FROM t1 WHERE z<100 AND a>5\n**\n** The code generated for this simplification gives the same result\n** but only has to scan the data once.  And because indices might \n** exist on the table t1, a complete scan of the data might be\n** avoided.\n**\n** Flattening is only attempted if all of the following are true:\n**\n**   (1)  The subquery and the outer query do not both use aggregates.\n**\n**   (2)  The subquery is not an aggregate or (2a) the outer query is not a join\n**        and (2b) the outer query does not use subqueries other than the one\n**        FROM-clause subquery that is a candidate for flattening.  (2b is\n**        due to ticket [2f7170d73bf9abf80] from 2015-02-09.)\n**\n**   (3)  The subquery is not the right operand of a left outer join\n**        (Originally ticket #306.  Strengthened by ticket #3300)\n**\n**   (4)  The subquery is not DISTINCT.\n**\n**  (**)  At one point restrictions (4) and (5) defined a subset of DISTINCT\n**        sub-queries that were excluded from this optimization. Restriction \n**        (4) has since been expanded to exclude all DISTINCT subqueries.\n**\n**   (6)  The subquery does not use aggregates or the outer query is not\n**        DISTINCT.\n**\n**   (7)  The subquery has a FROM clause.  TODO:  For subqueries without\n**        A FROM clause, consider adding a FROM close with the special\n**        table sqlite_once that consists of a single row containing a\n**        single NULL.\n**\n**   (8)  The subquery does not use LIMIT or the outer query is not a join.\n**\n**   (9)  The subquery does not use LIMIT or the outer query does not use\n**        aggregates.\n**\n**  (**)  Restriction (10) was removed from the code on 2005-02-05 but we\n**        accidently carried the comment forward until 2014-09-15.  Original\n**        text: \"The subquery does not use aggregates or the outer query \n**        does not use LIMIT.\"\n**\n**  (11)  The subquery and the outer query do not both have ORDER BY clauses.\n**\n**  (**)  Not implemented.  Subsumed into restriction (3).  Was previously\n**        a separate restriction deriving from ticket #350.\n**\n**  (13)  The subquery and outer query do not both use LIMIT.\n**\n**  (14)  The subquery does not use OFFSET.\n**\n**  (15)  The outer query is not part of a compound select or the\n**        subquery does not have a LIMIT clause.\n**        (See ticket #2339 and ticket [02a8e81d44]).\n**\n**  (16)  The outer query is not an aggregate or the subquery does\n**        not contain ORDER BY.  (Ticket #2942)  This used to not matter\n**        until we introduced the group_concat() function.  \n**\n**  (17)  The sub-query is not a compound select, or it is a UNION ALL \n**        compound clause made up entirely of non-aggregate queries, and \n**        the parent query:\n**\n**          * is not itself part of a compound select,\n**          * is not an aggregate or DISTINCT query, and\n**          * is not a join\n**\n**        The parent and sub-query may contain WHERE clauses. Subject to\n**        rules (11), (13) and (14), they may also contain ORDER BY,\n**        LIMIT and OFFSET clauses.  The subquery cannot use any compound\n**        operator other than UNION ALL because all the other compound\n**        operators have an implied DISTINCT which is disallowed by\n**        restriction (4).\n**\n**        Also, each component of the sub-query must return the same number\n**        of result columns. This is actually a requirement for any compound\n**        SELECT statement, but all the code here does is make sure that no\n**        such (illegal) sub-query is flattened. The caller will detect the\n**        syntax error and return a detailed message.\n**\n**  (18)  If the sub-query is a compound select, then all terms of the\n**        ORDER by clause of the parent must be simple references to \n**        columns of the sub-query.\n**\n**  (19)  The subquery does not use LIMIT or the outer query does not\n**        have a WHERE clause.\n**\n**  (20)  If the sub-query is a compound select, then it must not use\n**        an ORDER BY clause.  Ticket #3773.  We could relax this constraint\n**        somewhat by saying that the terms of the ORDER BY clause must\n**        appear as unmodified result columns in the outer query.  But we\n**        have other optimizations in mind to deal with that case.\n**\n**  (21)  The subquery does not use LIMIT or the outer query is not\n**        DISTINCT.  (See ticket [752e1646fc]).\n**\n**  (22)  The subquery is not a recursive CTE.\n**\n**  (23)  The parent is not a recursive CTE, or the sub-query is not a\n**        compound query. This restriction is because transforming the\n**        parent to a compound query confuses the code that handles\n**        recursive queries in multiSelect().\n**\n**  (24)  The subquery is not an aggregate that uses the built-in min() or \n**        or max() functions.  (Without this restriction, a query like:\n**        \"SELECT x FROM (SELECT max(y), x FROM t1)\" would not necessarily\n**        return the value X for which Y was maximal.)\n**\n**\n** In this routine, the \"p\" parameter is a pointer to the outer query.\n** The subquery is p->pSrc->a[iFrom].  isAgg is true if the outer query\n** uses aggregates and subqueryIsAgg is true if the subquery uses aggregates.\n**\n** If flattening is not attempted, this routine is a no-op and returns 0.\n** If flattening is attempted this routine returns 1.\n**\n** All of the expression analysis must occur on both the outer query and\n** the subquery before this routine runs.\n*/\nstatic int flattenSubquery(\n  Parse *pParse,       /* Parsing context */\n  Select *p,           /* The parent or outer SELECT statement */\n  int iFrom,           /* Index in p->pSrc->a[] of the inner subquery */\n  int isAgg,           /* True if outer SELECT uses aggregate functions */\n  int subqueryIsAgg    /* True if the subquery uses aggregate functions */\n){\n  const char *zSavedAuthContext = pParse->zAuthContext;\n  Select *pParent;    /* Current UNION ALL term of the other query */\n  Select *pSub;       /* The inner query or \"subquery\" */\n  Select *pSub1;      /* Pointer to the rightmost select in sub-query */\n  SrcList *pSrc;      /* The FROM clause of the outer query */\n  SrcList *pSubSrc;   /* The FROM clause of the subquery */\n  ExprList *pList;    /* The result set of the outer query */\n  int iParent;        /* VDBE cursor number of the pSub result set temp table */\n  int i;              /* Loop counter */\n  Expr *pWhere;                    /* The WHERE clause */\n  struct SrcList_item *pSubitem;   /* The subquery */\n  sqlite3 *db = pParse->db;\n\n  /* Check to see if flattening is permitted.  Return 0 if not.\n  */\n  assert( p!=0 );\n  assert( p->pPrior==0 );  /* Unable to flatten compound queries */\n  if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;\n  pSrc = p->pSrc;\n  assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );\n  pSubitem = &pSrc->a[iFrom];\n  iParent = pSubitem->iCursor;\n  pSub = pSubitem->pSelect;\n  assert( pSub!=0 );\n  if( subqueryIsAgg ){\n    if( isAgg ) return 0;                                /* Restriction (1)   */\n    if( pSrc->nSrc>1 ) return 0;                         /* Restriction (2a)  */\n    if( (p->pWhere && ExprHasProperty(p->pWhere,EP_Subquery))\n     || (sqlite3ExprListFlags(p->pEList) & EP_Subquery)!=0\n     || (sqlite3ExprListFlags(p->pOrderBy) & EP_Subquery)!=0\n    ){\n      return 0;                                          /* Restriction (2b)  */\n    }\n  }\n    \n  pSubSrc = pSub->pSrc;\n  assert( pSubSrc );\n  /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,\n  ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET\n  ** because they could be computed at compile-time.  But when LIMIT and OFFSET\n  ** became arbitrary expressions, we were forced to add restrictions (13)\n  ** and (14). */\n  if( pSub->pLimit && p->pLimit ) return 0;              /* Restriction (13) */\n  if( pSub->pOffset ) return 0;                          /* Restriction (14) */\n  if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){\n    return 0;                                            /* Restriction (15) */\n  }\n  if( pSubSrc->nSrc==0 ) return 0;                       /* Restriction (7)  */\n  if( pSub->selFlags & SF_Distinct ) return 0;           /* Restriction (5)  */\n  if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){\n     return 0;         /* Restrictions (8)(9) */\n  }\n  if( (p->selFlags & SF_Distinct)!=0 && subqueryIsAgg ){\n     return 0;         /* Restriction (6)  */\n  }\n  if( p->pOrderBy && pSub->pOrderBy ){\n     return 0;                                           /* Restriction (11) */\n  }\n  if( isAgg && pSub->pOrderBy ) return 0;                /* Restriction (16) */\n  if( pSub->pLimit && p->pWhere ) return 0;              /* Restriction (19) */\n  if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){\n     return 0;         /* Restriction (21) */\n  }\n  testcase( pSub->selFlags & SF_Recursive );\n  testcase( pSub->selFlags & SF_MinMaxAgg );\n  if( pSub->selFlags & (SF_Recursive|SF_MinMaxAgg) ){\n    return 0; /* Restrictions (22) and (24) */\n  }\n  if( (p->selFlags & SF_Recursive) && pSub->pPrior ){\n    return 0; /* Restriction (23) */\n  }\n\n  /* OBSOLETE COMMENT 1:\n  ** Restriction 3:  If the subquery is a join, make sure the subquery is \n  ** not used as the right operand of an outer join.  Examples of why this\n  ** is not allowed:\n  **\n  **         t1 LEFT OUTER JOIN (t2 JOIN t3)\n  **\n  ** If we flatten the above, we would get\n  **\n  **         (t1 LEFT OUTER JOIN t2) JOIN t3\n  **\n  ** which is not at all the same thing.\n  **\n  ** OBSOLETE COMMENT 2:\n  ** Restriction 12:  If the subquery is the right operand of a left outer\n  ** join, make sure the subquery has no WHERE clause.\n  ** An examples of why this is not allowed:\n  **\n  **         t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0)\n  **\n  ** If we flatten the above, we would get\n  **\n  **         (t1 LEFT OUTER JOIN t2) WHERE t2.x>0\n  **\n  ** But the t2.x>0 test will always fail on a NULL row of t2, which\n  ** effectively converts the OUTER JOIN into an INNER JOIN.\n  **\n  ** THIS OVERRIDES OBSOLETE COMMENTS 1 AND 2 ABOVE:\n  ** Ticket #3300 shows that flattening the right term of a LEFT JOIN\n  ** is fraught with danger.  Best to avoid the whole thing.  If the\n  ** subquery is the right term of a LEFT JOIN, then do not flatten.\n  */\n  if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){\n    return 0;\n  }\n\n  /* Restriction 17: If the sub-query is a compound SELECT, then it must\n  ** use only the UNION ALL operator. And none of the simple select queries\n  ** that make up the compound SELECT are allowed to be aggregate or distinct\n  ** queries.\n  */\n  if( pSub->pPrior ){\n    if( pSub->pOrderBy ){\n      return 0;  /* Restriction 20 */\n    }\n    if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){\n      return 0;\n    }\n    for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){\n      testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );\n      testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );\n      assert( pSub->pSrc!=0 );\n      assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );\n      if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0\n       || (pSub1->pPrior && pSub1->op!=TK_ALL) \n       || pSub1->pSrc->nSrc<1\n      ){\n        return 0;\n      }\n      testcase( pSub1->pSrc->nSrc>1 );\n    }\n\n    /* Restriction 18. */\n    if( p->pOrderBy ){\n      int ii;\n      for(ii=0; ii<p->pOrderBy->nExpr; ii++){\n        if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;\n      }\n    }\n  }\n\n  /***** If we reach this point, flattening is permitted. *****/\n  SELECTTRACE(1,pParse,p,(\"flatten %s.%p from term %d\\n\",\n                   pSub->zSelName, pSub, iFrom));\n\n  /* Authorize the subquery */\n  pParse->zAuthContext = pSubitem->zName;\n  TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);\n  testcase( i==SQLITE_DENY );\n  pParse->zAuthContext = zSavedAuthContext;\n\n  /* If the sub-query is a compound SELECT statement, then (by restrictions\n  ** 17 and 18 above) it must be a UNION ALL and the parent query must \n  ** be of the form:\n  **\n  **     SELECT <expr-list> FROM (<sub-query>) <where-clause> \n  **\n  ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block\n  ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or \n  ** OFFSET clauses and joins them to the left-hand-side of the original\n  ** using UNION ALL operators. In this case N is the number of simple\n  ** select statements in the compound sub-query.\n  **\n  ** Example:\n  **\n  **     SELECT a+1 FROM (\n  **        SELECT x FROM tab\n  **        UNION ALL\n  **        SELECT y FROM tab\n  **        UNION ALL\n  **        SELECT abs(z*2) FROM tab2\n  **     ) WHERE a!=5 ORDER BY 1\n  **\n  ** Transformed into:\n  **\n  **     SELECT x+1 FROM tab WHERE x+1!=5\n  **     UNION ALL\n  **     SELECT y+1 FROM tab WHERE y+1!=5\n  **     UNION ALL\n  **     SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5\n  **     ORDER BY 1\n  **\n  ** We call this the \"compound-subquery flattening\".\n  */\n  for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){\n    Select *pNew;\n    ExprList *pOrderBy = p->pOrderBy;\n    Expr *pLimit = p->pLimit;\n    Expr *pOffset = p->pOffset;\n    Select *pPrior = p->pPrior;\n    p->pOrderBy = 0;\n    p->pSrc = 0;\n    p->pPrior = 0;\n    p->pLimit = 0;\n    p->pOffset = 0;\n    pNew = sqlite3SelectDup(db, p, 0);\n    sqlite3SelectSetName(pNew, pSub->zSelName);\n    p->pOffset = pOffset;\n    p->pLimit = pLimit;\n    p->pOrderBy = pOrderBy;\n    p->pSrc = pSrc;\n    p->op = TK_ALL;\n    if( pNew==0 ){\n      p->pPrior = pPrior;\n    }else{\n      pNew->pPrior = pPrior;\n      if( pPrior ) pPrior->pNext = pNew;\n      pNew->pNext = p;\n      p->pPrior = pNew;\n      SELECTTRACE(2,pParse,p,\n         (\"compound-subquery flattener creates %s.%p as peer\\n\",\n         pNew->zSelName, pNew));\n    }\n    if( db->mallocFailed ) return 1;\n  }\n\n  /* Begin flattening the iFrom-th entry of the FROM clause \n  ** in the outer query.\n  */\n  pSub = pSub1 = pSubitem->pSelect;\n\n  /* Delete the transient table structure associated with the\n  ** subquery\n  */\n  sqlite3DbFree(db, pSubitem->zDatabase);\n  sqlite3DbFree(db, pSubitem->zName);\n  sqlite3DbFree(db, pSubitem->zAlias);\n  pSubitem->zDatabase = 0;\n  pSubitem->zName = 0;\n  pSubitem->zAlias = 0;\n  pSubitem->pSelect = 0;\n\n  /* Defer deleting the Table object associated with the\n  ** subquery until code generation is\n  ** complete, since there may still exist Expr.pTab entries that\n  ** refer to the subquery even after flattening.  Ticket #3346.\n  **\n  ** pSubitem->pTab is always non-NULL by test restrictions and tests above.\n  */\n  if( ALWAYS(pSubitem->pTab!=0) ){\n    Table *pTabToDel = pSubitem->pTab;\n    if( pTabToDel->nRef==1 ){\n      Parse *pToplevel = sqlite3ParseToplevel(pParse);\n      pTabToDel->pNextZombie = pToplevel->pZombieTab;\n      pToplevel->pZombieTab = pTabToDel;\n    }else{\n      pTabToDel->nRef--;\n    }\n    pSubitem->pTab = 0;\n  }\n\n  /* The following loop runs once for each term in a compound-subquery\n  ** flattening (as described above).  If we are doing a different kind\n  ** of flattening - a flattening other than a compound-subquery flattening -\n  ** then this loop only runs once.\n  **\n  ** This loop moves all of the FROM elements of the subquery into the\n  ** the FROM clause of the outer query.  Before doing this, remember\n  ** the cursor number for the original outer query FROM element in\n  ** iParent.  The iParent cursor will never be used.  Subsequent code\n  ** will scan expressions looking for iParent references and replace\n  ** those references with expressions that resolve to the subquery FROM\n  ** elements we are now copying in.\n  */\n  for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){\n    int nSubSrc;\n    u8 jointype = 0;\n    pSubSrc = pSub->pSrc;     /* FROM clause of subquery */\n    nSubSrc = pSubSrc->nSrc;  /* Number of terms in subquery FROM clause */\n    pSrc = pParent->pSrc;     /* FROM clause of the outer query */\n\n    if( pSrc ){\n      assert( pParent==p );  /* First time through the loop */\n      jointype = pSubitem->fg.jointype;\n    }else{\n      assert( pParent!=p );  /* 2nd and subsequent times through the loop */\n      pSrc = pParent->pSrc = sqlite3SrcListAppend(db, 0, 0, 0);\n      if( pSrc==0 ){\n        assert( db->mallocFailed );\n        break;\n      }\n    }\n\n    /* The subquery uses a single slot of the FROM clause of the outer\n    ** query.  If the subquery has more than one element in its FROM clause,\n    ** then expand the outer query to make space for it to hold all elements\n    ** of the subquery.\n    **\n    ** Example:\n    **\n    **    SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB;\n    **\n    ** The outer query has 3 slots in its FROM clause.  One slot of the\n    ** outer query (the middle slot) is used by the subquery.  The next\n    ** block of code will expand the outer query FROM clause to 4 slots.\n    ** The middle slot is expanded to two slots in order to make space\n    ** for the two elements in the FROM clause of the subquery.\n    */\n    if( nSubSrc>1 ){\n      pParent->pSrc = pSrc = sqlite3SrcListEnlarge(db, pSrc, nSubSrc-1,iFrom+1);\n      if( db->mallocFailed ){\n        break;\n      }\n    }\n\n    /* Transfer the FROM clause terms from the subquery into the\n    ** outer query.\n    */\n    for(i=0; i<nSubSrc; i++){\n      sqlite3IdListDelete(db, pSrc->a[i+iFrom].pUsing);\n      assert( pSrc->a[i+iFrom].fg.isTabFunc==0 );\n      pSrc->a[i+iFrom] = pSubSrc->a[i];\n      memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));\n    }\n    pSrc->a[iFrom].fg.jointype = jointype;\n  \n    /* Now begin substituting subquery result set expressions for \n    ** references to the iParent in the outer query.\n    ** \n    ** Example:\n    **\n    **   SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;\n    **   \\                     \\_____________ subquery __________/          /\n    **    \\_____________________ outer query ______________________________/\n    **\n    ** We look at every expression in the outer query and every place we see\n    ** \"a\" we substitute \"x*3\" and every place we see \"b\" we substitute \"y+10\".\n    */\n    pList = pParent->pEList;\n    for(i=0; i<pList->nExpr; i++){\n      if( pList->a[i].zName==0 ){\n        char *zName = sqlite3DbStrDup(db, pList->a[i].zSpan);\n        sqlite3Dequote(zName);\n        pList->a[i].zName = zName;\n      }\n    }\n    if( pSub->pOrderBy ){\n      /* At this point, any non-zero iOrderByCol values indicate that the\n      ** ORDER BY column expression is identical to the iOrderByCol'th\n      ** expression returned by SELECT statement pSub. Since these values\n      ** do not necessarily correspond to columns in SELECT statement pParent,\n      ** zero them before transfering the ORDER BY clause.\n      **\n      ** Not doing this may cause an error if a subsequent call to this\n      ** function attempts to flatten a compound sub-query into pParent\n      ** (the only way this can happen is if the compound sub-query is\n      ** currently part of pSub->pSrc). See ticket [d11a6e908f].  */\n      ExprList *pOrderBy = pSub->pOrderBy;\n      for(i=0; i<pOrderBy->nExpr; i++){\n        pOrderBy->a[i].u.x.iOrderByCol = 0;\n      }\n      assert( pParent->pOrderBy==0 );\n      assert( pSub->pPrior==0 );\n      pParent->pOrderBy = pOrderBy;\n      pSub->pOrderBy = 0;\n    }\n    pWhere = sqlite3ExprDup(db, pSub->pWhere, 0);\n    if( subqueryIsAgg ){\n      assert( pParent->pHaving==0 );\n      pParent->pHaving = pParent->pWhere;\n      pParent->pWhere = pWhere;\n      pParent->pHaving = sqlite3ExprAnd(db, \n          sqlite3ExprDup(db, pSub->pHaving, 0), pParent->pHaving\n      );\n      assert( pParent->pGroupBy==0 );\n      pParent->pGroupBy = sqlite3ExprListDup(db, pSub->pGroupBy, 0);\n    }else{\n      pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);\n    }\n    substSelect(db, pParent, iParent, pSub->pEList, 0);\n  \n    /* The flattened query is distinct if either the inner or the\n    ** outer query is distinct. \n    */\n    pParent->selFlags |= pSub->selFlags & SF_Distinct;\n  \n    /*\n    ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;\n    **\n    ** One is tempted to try to add a and b to combine the limits.  But this\n    ** does not work if either limit is negative.\n    */\n    if( pSub->pLimit ){\n      pParent->pLimit = pSub->pLimit;\n      pSub->pLimit = 0;\n    }\n  }\n\n  /* Finially, delete what is left of the subquery and return\n  ** success.\n  */\n  sqlite3SelectDelete(db, pSub1);\n\n#if SELECTTRACE_ENABLED\n  if( sqlite3SelectTrace & 0x100 ){\n    SELECTTRACE(0x100,pParse,p,(\"After flattening:\\n\"));\n    sqlite3TreeViewSelect(0, p, 0);\n  }\n#endif\n\n  return 1;\n}\n#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */\n\n\n\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\n/*\n** Make copies of relevant WHERE clause terms of the outer query into\n** the WHERE clause of subquery.  Example:\n**\n**    SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10;\n**\n** Transformed into:\n**\n**    SELECT * FROM (SELECT a AS x, c-d AS y FROM t1 WHERE a=5 AND c-d=10)\n**     WHERE x=5 AND y=10;\n**\n** The hope is that the terms added to the inner query will make it more\n** efficient.\n**\n** Do not attempt this optimization if:\n**\n**   (1) The inner query is an aggregate.  (In that case, we'd really want\n**       to copy the outer WHERE-clause terms onto the HAVING clause of the\n**       inner query.  But they probably won't help there so do not bother.)\n**\n**   (2) The inner query is the recursive part of a common table expression.\n**\n**   (3) The inner query has a LIMIT clause (since the changes to the WHERE\n**       close would change the meaning of the LIMIT).\n**\n**   (4) The inner query is the right operand of a LEFT JOIN.  (The caller\n**       enforces this restriction since this routine does not have enough\n**       information to know.)\n**\n**   (5) The WHERE clause expression originates in the ON or USING clause\n**       of a LEFT JOIN.\n**\n** Return 0 if no changes are made and non-zero if one or more WHERE clause\n** terms are duplicated into the subquery.\n*/\nstatic int pushDownWhereTerms(\n  sqlite3 *db,          /* The database connection (for malloc()) */\n  Select *pSubq,        /* The subquery whose WHERE clause is to be augmented */\n  Expr *pWhere,         /* The WHERE clause of the outer query */\n  int iCursor           /* Cursor number of the subquery */\n){\n  Expr *pNew;\n  int nChng = 0;\n  Select *pX;           /* For looping over compound SELECTs in pSubq */\n  if( pWhere==0 ) return 0;\n  for(pX=pSubq; pX; pX=pX->pPrior){\n    if( (pX->selFlags & (SF_Aggregate|SF_Recursive))!=0 ){\n      testcase( pX->selFlags & SF_Aggregate );\n      testcase( pX->selFlags & SF_Recursive );\n      testcase( pX!=pSubq );\n      return 0; /* restrictions (1) and (2) */\n    }\n  }\n  if( pSubq->pLimit!=0 ){\n    return 0; /* restriction (3) */\n  }\n  while( pWhere->op==TK_AND ){\n    nChng += pushDownWhereTerms(db, pSubq, pWhere->pRight, iCursor);\n    pWhere = pWhere->pLeft;\n  }\n  if( ExprHasProperty(pWhere,EP_FromJoin) ) return 0; /* restriction 5 */\n  if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){\n    nChng++;\n    while( pSubq ){\n      pNew = sqlite3ExprDup(db, pWhere, 0);\n      pNew = substExpr(db, pNew, iCursor, pSubq->pEList);\n      pSubq->pWhere = sqlite3ExprAnd(db, pSubq->pWhere, pNew);\n      pSubq = pSubq->pPrior;\n    }\n  }\n  return nChng;\n}\n#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */\n\n/*\n** Based on the contents of the AggInfo structure indicated by the first\n** argument, this function checks if the following are true:\n**\n**    * the query contains just a single aggregate function,\n**    * the aggregate function is either min() or max(), and\n**    * the argument to the aggregate function is a column value.\n**\n** If all of the above are true, then WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX\n** is returned as appropriate. Also, *ppMinMax is set to point to the \n** list of arguments passed to the aggregate before returning.\n**\n** Or, if the conditions above are not met, *ppMinMax is set to 0 and\n** WHERE_ORDERBY_NORMAL is returned.\n*/\nstatic u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){\n  int eRet = WHERE_ORDERBY_NORMAL;          /* Return value */\n\n  *ppMinMax = 0;\n  if( pAggInfo->nFunc==1 ){\n    Expr *pExpr = pAggInfo->aFunc[0].pExpr; /* Aggregate function */\n    ExprList *pEList = pExpr->x.pList;      /* Arguments to agg function */\n\n    assert( pExpr->op==TK_AGG_FUNCTION );\n    if( pEList && pEList->nExpr==1 && pEList->a[0].pExpr->op==TK_AGG_COLUMN ){\n      const char *zFunc = pExpr->u.zToken;\n      if( sqlite3StrICmp(zFunc, \"min\")==0 ){\n        eRet = WHERE_ORDERBY_MIN;\n        *ppMinMax = pEList;\n      }else if( sqlite3StrICmp(zFunc, \"max\")==0 ){\n        eRet = WHERE_ORDERBY_MAX;\n        *ppMinMax = pEList;\n      }\n    }\n  }\n\n  assert( *ppMinMax==0 || (*ppMinMax)->nExpr==1 );\n  return eRet;\n}\n\n/*\n** The select statement passed as the first argument is an aggregate query.\n** The second argument is the associated aggregate-info object. This \n** function tests if the SELECT is of the form:\n**\n**   SELECT count(*) FROM <tbl>\n**\n** where table is a database table, not a sub-select or view. If the query\n** does match this pattern, then a pointer to the Table object representing\n** <tbl> is returned. Otherwise, 0 is returned.\n*/\nstatic Table *isSimpleCount(Select *p, AggInfo *pAggInfo){\n  Table *pTab;\n  Expr *pExpr;\n\n  assert( !p->pGroupBy );\n\n  if( p->pWhere || p->pEList->nExpr!=1 \n   || p->pSrc->nSrc!=1 || p->pSrc->a[0].pSelect\n  ){\n    return 0;\n  }\n  pTab = p->pSrc->a[0].pTab;\n  pExpr = p->pEList->a[0].pExpr;\n  assert( pTab && !pTab->pSelect && pExpr );\n\n  if( IsVirtual(pTab) ) return 0;\n  if( pExpr->op!=TK_AGG_FUNCTION ) return 0;\n  if( NEVER(pAggInfo->nFunc==0) ) return 0;\n  if( (pAggInfo->aFunc[0].pFunc->funcFlags&SQLITE_FUNC_COUNT)==0 ) return 0;\n  if( pExpr->flags&EP_Distinct ) return 0;\n\n  return pTab;\n}\n\n/*\n** If the source-list item passed as an argument was augmented with an\n** INDEXED BY clause, then try to locate the specified index. If there\n** was such a clause and the named index cannot be found, return \n** SQLITE_ERROR and leave an error in pParse. Otherwise, populate \n** pFrom->pIndex and return SQLITE_OK.\n*/\nint sqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){\n  if( pFrom->pTab && pFrom->fg.isIndexedBy ){\n    Table *pTab = pFrom->pTab;\n    char *zIndexedBy = pFrom->u1.zIndexedBy;\n    Index *pIdx;\n    for(pIdx=pTab->pIndex; \n        pIdx && sqlite3StrICmp(pIdx->zName, zIndexedBy); \n        pIdx=pIdx->pNext\n    );\n    if( !pIdx ){\n      sqlite3ErrorMsg(pParse, \"no such index: %s\", zIndexedBy, 0);\n      pParse->checkSchema = 1;\n      return SQLITE_ERROR;\n    }\n    pFrom->pIBIndex = pIdx;\n  }\n  return SQLITE_OK;\n}\n/*\n** Detect compound SELECT statements that use an ORDER BY clause with \n** an alternative collating sequence.\n**\n**    SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...\n**\n** These are rewritten as a subquery:\n**\n**    SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2)\n**     ORDER BY ... COLLATE ...\n**\n** This transformation is necessary because the multiSelectOrderBy() routine\n** above that generates the code for a compound SELECT with an ORDER BY clause\n** uses a merge algorithm that requires the same collating sequence on the\n** result columns as on the ORDER BY clause.  See ticket\n** http://www.sqlite.org/src/info/6709574d2a\n**\n** This transformation is only needed for EXCEPT, INTERSECT, and UNION.\n** The UNION ALL operator works fine with multiSelectOrderBy() even when\n** there are COLLATE terms in the ORDER BY.\n*/\nstatic int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){\n  int i;\n  Select *pNew;\n  Select *pX;\n  sqlite3 *db;\n  struct ExprList_item *a;\n  SrcList *pNewSrc;\n  Parse *pParse;\n  Token dummy;\n\n  if( p->pPrior==0 ) return WRC_Continue;\n  if( p->pOrderBy==0 ) return WRC_Continue;\n  for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){}\n  if( pX==0 ) return WRC_Continue;\n  a = p->pOrderBy->a;\n  for(i=p->pOrderBy->nExpr-1; i>=0; i--){\n    if( a[i].pExpr->flags & EP_Collate ) break;\n  }\n  if( i<0 ) return WRC_Continue;\n\n  /* If we reach this point, that means the transformation is required. */\n\n  pParse = pWalker->pParse;\n  db = pParse->db;\n  pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );\n  if( pNew==0 ) return WRC_Abort;\n  memset(&dummy, 0, sizeof(dummy));\n  pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0);\n  if( pNewSrc==0 ) return WRC_Abort;\n  *pNew = *p;\n  p->pSrc = pNewSrc;\n  p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ASTERISK, 0));\n  p->op = TK_SELECT;\n  p->pWhere = 0;\n  pNew->pGroupBy = 0;\n  pNew->pHaving = 0;\n  pNew->pOrderBy = 0;\n  p->pPrior = 0;\n  p->pNext = 0;\n  p->pWith = 0;\n  p->selFlags &= ~SF_Compound;\n  assert( (p->selFlags & SF_Converted)==0 );\n  p->selFlags |= SF_Converted;\n  assert( pNew->pPrior!=0 );\n  pNew->pPrior->pNext = pNew;\n  pNew->pLimit = 0;\n  pNew->pOffset = 0;\n  return WRC_Continue;\n}\n\n/*\n** Check to see if the FROM clause term pFrom has table-valued function\n** arguments.  If it does, leave an error message in pParse and return\n** non-zero, since pFrom is not allowed to be a table-valued function.\n*/\nstatic int cannotBeFunction(Parse *pParse, struct SrcList_item *pFrom){\n  if( pFrom->fg.isTabFunc ){\n    sqlite3ErrorMsg(pParse, \"'%s' is not a function\", pFrom->zName);\n    return 1;\n  }\n  return 0;\n}\n\n#ifndef SQLITE_OMIT_CTE\n/*\n** Argument pWith (which may be NULL) points to a linked list of nested \n** WITH contexts, from inner to outermost. If the table identified by \n** FROM clause element pItem is really a common-table-expression (CTE) \n** then return a pointer to the CTE definition for that table. Otherwise\n** return NULL.\n**\n** If a non-NULL value is returned, set *ppContext to point to the With\n** object that the returned CTE belongs to.\n*/\nstatic struct Cte *searchWith(\n  With *pWith,                    /* Current innermost WITH clause */\n  struct SrcList_item *pItem,     /* FROM clause element to resolve */\n  With **ppContext                /* OUT: WITH clause return value belongs to */\n){\n  const char *zName;\n  if( pItem->zDatabase==0 && (zName = pItem->zName)!=0 ){\n    With *p;\n    for(p=pWith; p; p=p->pOuter){\n      int i;\n      for(i=0; i<p->nCte; i++){\n        if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){\n          *ppContext = p;\n          return &p->a[i];\n        }\n      }\n    }\n  }\n  return 0;\n}\n\n/* The code generator maintains a stack of active WITH clauses\n** with the inner-most WITH clause being at the top of the stack.\n**\n** This routine pushes the WITH clause passed as the second argument\n** onto the top of the stack. If argument bFree is true, then this\n** WITH clause will never be popped from the stack. In this case it\n** should be freed along with the Parse object. In other cases, when\n** bFree==0, the With object will be freed along with the SELECT \n** statement with which it is associated.\n*/\nvoid sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){\n  assert( bFree==0 || (pParse->pWith==0 && pParse->pWithToFree==0) );\n  if( pWith ){\n    assert( pParse->pWith!=pWith );\n    pWith->pOuter = pParse->pWith;\n    pParse->pWith = pWith;\n    if( bFree ) pParse->pWithToFree = pWith;\n  }\n}\n\n/*\n** This function checks if argument pFrom refers to a CTE declared by \n** a WITH clause on the stack currently maintained by the parser. And,\n** if currently processing a CTE expression, if it is a recursive\n** reference to the current CTE.\n**\n** If pFrom falls into either of the two categories above, pFrom->pTab\n** and other fields are populated accordingly. The caller should check\n** (pFrom->pTab!=0) to determine whether or not a successful match\n** was found.\n**\n** Whether or not a match is found, SQLITE_OK is returned if no error\n** occurs. If an error does occur, an error message is stored in the\n** parser and some error code other than SQLITE_OK returned.\n*/\nstatic int withExpand(\n  Walker *pWalker, \n  struct SrcList_item *pFrom\n){\n  Parse *pParse = pWalker->pParse;\n  sqlite3 *db = pParse->db;\n  struct Cte *pCte;               /* Matched CTE (or NULL if no match) */\n  With *pWith;                    /* WITH clause that pCte belongs to */\n\n  assert( pFrom->pTab==0 );\n\n  pCte = searchWith(pParse->pWith, pFrom, &pWith);\n  if( pCte ){\n    Table *pTab;\n    ExprList *pEList;\n    Select *pSel;\n    Select *pLeft;                /* Left-most SELECT statement */\n    int bMayRecursive;            /* True if compound joined by UNION [ALL] */\n    With *pSavedWith;             /* Initial value of pParse->pWith */\n\n    /* If pCte->zCteErr is non-NULL at this point, then this is an illegal\n    ** recursive reference to CTE pCte. Leave an error in pParse and return\n    ** early. If pCte->zCteErr is NULL, then this is not a recursive reference.\n    ** In this case, proceed.  */\n    if( pCte->zCteErr ){\n      sqlite3ErrorMsg(pParse, pCte->zCteErr, pCte->zName);\n      return SQLITE_ERROR;\n    }\n    if( cannotBeFunction(pParse, pFrom) ) return SQLITE_ERROR;\n\n    assert( pFrom->pTab==0 );\n    pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));\n    if( pTab==0 ) return WRC_Abort;\n    pTab->nRef = 1;\n    pTab->zName = sqlite3DbStrDup(db, pCte->zName);\n    pTab->iPKey = -1;\n    pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );\n    pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;\n    pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0);\n    if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;\n    assert( pFrom->pSelect );\n\n    /* Check if this is a recursive CTE. */\n    pSel = pFrom->pSelect;\n    bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION );\n    if( bMayRecursive ){\n      int i;\n      SrcList *pSrc = pFrom->pSelect->pSrc;\n      for(i=0; i<pSrc->nSrc; i++){\n        struct SrcList_item *pItem = &pSrc->a[i];\n        if( pItem->zDatabase==0 \n         && pItem->zName!=0 \n         && 0==sqlite3StrICmp(pItem->zName, pCte->zName)\n          ){\n          pItem->pTab = pTab;\n          pItem->fg.isRecursive = 1;\n          pTab->nRef++;\n          pSel->selFlags |= SF_Recursive;\n        }\n      }\n    }\n\n    /* Only one recursive reference is permitted. */ \n    if( pTab->nRef>2 ){\n      sqlite3ErrorMsg(\n          pParse, \"multiple references to recursive table: %s\", pCte->zName\n      );\n      return SQLITE_ERROR;\n    }\n    assert( pTab->nRef==1 || ((pSel->selFlags&SF_Recursive) && pTab->nRef==2 ));\n\n    pCte->zCteErr = \"circular reference: %s\";\n    pSavedWith = pParse->pWith;\n    pParse->pWith = pWith;\n    sqlite3WalkSelect(pWalker, bMayRecursive ? pSel->pPrior : pSel);\n    pParse->pWith = pWith;\n\n    for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);\n    pEList = pLeft->pEList;\n    if( pCte->pCols ){\n      if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){\n        sqlite3ErrorMsg(pParse, \"table %s has %d values for %d columns\",\n            pCte->zName, pEList->nExpr, pCte->pCols->nExpr\n        );\n        pParse->pWith = pSavedWith;\n        return SQLITE_ERROR;\n      }\n      pEList = pCte->pCols;\n    }\n\n    sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol);\n    if( bMayRecursive ){\n      if( pSel->selFlags & SF_Recursive ){\n        pCte->zCteErr = \"multiple recursive references: %s\";\n      }else{\n        pCte->zCteErr = \"recursive reference in a subquery: %s\";\n      }\n      sqlite3WalkSelect(pWalker, pSel);\n    }\n    pCte->zCteErr = 0;\n    pParse->pWith = pSavedWith;\n  }\n\n  return SQLITE_OK;\n}\n#endif\n\n#ifndef SQLITE_OMIT_CTE\n/*\n** If the SELECT passed as the second argument has an associated WITH \n** clause, pop it from the stack stored as part of the Parse object.\n**\n** This function is used as the xSelectCallback2() callback by\n** sqlite3SelectExpand() when walking a SELECT tree to resolve table\n** names and other FROM clause elements. \n*/\nstatic void selectPopWith(Walker *pWalker, Select *p){\n  Parse *pParse = pWalker->pParse;\n  With *pWith = findRightmost(p)->pWith;\n  if( pWith!=0 ){\n    assert( pParse->pWith==pWith );\n    pParse->pWith = pWith->pOuter;\n  }\n}\n#else\n#define selectPopWith 0\n#endif\n\n/*\n** This routine is a Walker callback for \"expanding\" a SELECT statement.\n** \"Expanding\" means to do the following:\n**\n**    (1)  Make sure VDBE cursor numbers have been assigned to every\n**         element of the FROM clause.\n**\n**    (2)  Fill in the pTabList->a[].pTab fields in the SrcList that \n**         defines FROM clause.  When views appear in the FROM clause,\n**         fill pTabList->a[].pSelect with a copy of the SELECT statement\n**         that implements the view.  A copy is made of the view's SELECT\n**         statement so that we can freely modify or delete that statement\n**         without worrying about messing up the persistent representation\n**         of the view.\n**\n**    (3)  Add terms to the WHERE clause to accommodate the NATURAL keyword\n**         on joins and the ON and USING clause of joins.\n**\n**    (4)  Scan the list of columns in the result set (pEList) looking\n**         for instances of the \"*\" operator or the TABLE.* operator.\n**         If found, expand each \"*\" to be every column in every table\n**         and TABLE.* to be every column in TABLE.\n**\n*/\nstatic int selectExpander(Walker *pWalker, Select *p){\n  Parse *pParse = pWalker->pParse;\n  int i, j, k;\n  SrcList *pTabList;\n  ExprList *pEList;\n  struct SrcList_item *pFrom;\n  sqlite3 *db = pParse->db;\n  Expr *pE, *pRight, *pExpr;\n  u16 selFlags = p->selFlags;\n\n  p->selFlags |= SF_Expanded;\n  if( db->mallocFailed  ){\n    return WRC_Abort;\n  }\n  if( NEVER(p->pSrc==0) || (selFlags & SF_Expanded)!=0 ){\n    return WRC_Prune;\n  }\n  pTabList = p->pSrc;\n  pEList = p->pEList;\n  if( pWalker->xSelectCallback2==selectPopWith ){\n    sqlite3WithPush(pParse, findRightmost(p)->pWith, 0);\n  }\n\n  /* Make sure cursor numbers have been assigned to all entries in\n  ** the FROM clause of the SELECT statement.\n  */\n  sqlite3SrcListAssignCursors(pParse, pTabList);\n\n  /* Look up every table named in the FROM clause of the select.  If\n  ** an entry of the FROM clause is a subquery instead of a table or view,\n  ** then create a transient table structure to describe the subquery.\n  */\n  for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){\n    Table *pTab;\n    assert( pFrom->fg.isRecursive==0 || pFrom->pTab!=0 );\n    if( pFrom->fg.isRecursive ) continue;\n    assert( pFrom->pTab==0 );\n#ifndef SQLITE_OMIT_CTE\n    if( withExpand(pWalker, pFrom) ) return WRC_Abort;\n    if( pFrom->pTab ) {} else\n#endif\n    if( pFrom->zName==0 ){\n#ifndef SQLITE_OMIT_SUBQUERY\n      Select *pSel = pFrom->pSelect;\n      /* A sub-query in the FROM clause of a SELECT */\n      assert( pSel!=0 );\n      assert( pFrom->pTab==0 );\n      if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort;\n      pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));\n      if( pTab==0 ) return WRC_Abort;\n      pTab->nRef = 1;\n      pTab->zName = sqlite3MPrintf(db, \"sqlite_sq_%p\", (void*)pTab);\n      while( pSel->pPrior ){ pSel = pSel->pPrior; }\n      sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);\n      pTab->iPKey = -1;\n      pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );\n      pTab->tabFlags |= TF_Ephemeral;\n#endif\n    }else{\n      /* An ordinary table or view name in the FROM clause */\n      assert( pFrom->pTab==0 );\n      pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);\n      if( pTab==0 ) return WRC_Abort;\n      if( pTab->nRef==0xffff ){\n        sqlite3ErrorMsg(pParse, \"too many references to \\\"%s\\\": max 65535\",\n           pTab->zName);\n        pFrom->pTab = 0;\n        return WRC_Abort;\n      }\n      pTab->nRef++;\n      if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){\n        return WRC_Abort;\n      }\n#if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)\n      if( IsVirtual(pTab) || pTab->pSelect ){\n        i16 nCol;\n        if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;\n        assert( pFrom->pSelect==0 );\n        pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);\n        sqlite3SelectSetName(pFrom->pSelect, pTab->zName);\n        nCol = pTab->nCol;\n        pTab->nCol = -1;\n        sqlite3WalkSelect(pWalker, pFrom->pSelect);\n        pTab->nCol = nCol;\n      }\n#endif\n    }\n\n    /* Locate the index named by the INDEXED BY clause, if any. */\n    if( sqlite3IndexedByLookup(pParse, pFrom) ){\n      return WRC_Abort;\n    }\n  }\n\n  /* Process NATURAL keywords, and ON and USING clauses of joins.\n  */\n  if( db->mallocFailed || sqliteProcessJoin(pParse, p) ){\n    return WRC_Abort;\n  }\n\n  /* For every \"*\" that occurs in the column list, insert the names of\n  ** all columns in all tables.  And for every TABLE.* insert the names\n  ** of all columns in TABLE.  The parser inserted a special expression\n  ** with the TK_ASTERISK operator for each \"*\" that it found in the column\n  ** list.  The following code just has to locate the TK_ASTERISK\n  ** expressions and expand each one to the list of all columns in\n  ** all tables.\n  **\n  ** The first loop just checks to see if there are any \"*\" operators\n  ** that need expanding.\n  */\n  for(k=0; k<pEList->nExpr; k++){\n    pE = pEList->a[k].pExpr;\n    if( pE->op==TK_ASTERISK ) break;\n    assert( pE->op!=TK_DOT || pE->pRight!=0 );\n    assert( pE->op!=TK_DOT || (pE->pLeft!=0 && pE->pLeft->op==TK_ID) );\n    if( pE->op==TK_DOT && pE->pRight->op==TK_ASTERISK ) break;\n  }\n  if( k<pEList->nExpr ){\n    /*\n    ** If we get here it means the result set contains one or more \"*\"\n    ** operators that need to be expanded.  Loop through each expression\n    ** in the result set and expand them one by one.\n    */\n    struct ExprList_item *a = pEList->a;\n    ExprList *pNew = 0;\n    int flags = pParse->db->flags;\n    int longNames = (flags & SQLITE_FullColNames)!=0\n                      && (flags & SQLITE_ShortColNames)==0;\n\n    for(k=0; k<pEList->nExpr; k++){\n      pE = a[k].pExpr;\n      pRight = pE->pRight;\n      assert( pE->op!=TK_DOT || pRight!=0 );\n      if( pE->op!=TK_ASTERISK\n       && (pE->op!=TK_DOT || pRight->op!=TK_ASTERISK)\n      ){\n        /* This particular expression does not need to be expanded.\n        */\n        pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr);\n        if( pNew ){\n          pNew->a[pNew->nExpr-1].zName = a[k].zName;\n          pNew->a[pNew->nExpr-1].zSpan = a[k].zSpan;\n          a[k].zName = 0;\n          a[k].zSpan = 0;\n        }\n        a[k].pExpr = 0;\n      }else{\n        /* This expression is a \"*\" or a \"TABLE.*\" and needs to be\n        ** expanded. */\n        int tableSeen = 0;      /* Set to 1 when TABLE matches */\n        char *zTName = 0;       /* text of name of TABLE */\n        if( pE->op==TK_DOT ){\n          assert( pE->pLeft!=0 );\n          assert( !ExprHasProperty(pE->pLeft, EP_IntValue) );\n          zTName = pE->pLeft->u.zToken;\n        }\n        for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){\n          Table *pTab = pFrom->pTab;\n          Select *pSub = pFrom->pSelect;\n          char *zTabName = pFrom->zAlias;\n          const char *zSchemaName = 0;\n          int iDb;\n          if( zTabName==0 ){\n            zTabName = pTab->zName;\n          }\n          if( db->mallocFailed ) break;\n          if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){\n            pSub = 0;\n            if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){\n              continue;\n            }\n            iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n            zSchemaName = iDb>=0 ? db->aDb[iDb].zDbSName : \"*\";\n          }\n          for(j=0; j<pTab->nCol; j++){\n            char *zName = pTab->aCol[j].zName;\n            char *zColname;  /* The computed column name */\n            char *zToFree;   /* Malloced string that needs to be freed */\n            Token sColname;  /* Computed column name as a token */\n\n            assert( zName );\n            if( zTName && pSub\n             && sqlite3MatchSpanName(pSub->pEList->a[j].zSpan, 0, zTName, 0)==0\n            ){\n              continue;\n            }\n\n            /* If a column is marked as 'hidden', omit it from the expanded\n            ** result-set list unless the SELECT has the SF_IncludeHidden\n            ** bit set.\n            */\n            if( (p->selFlags & SF_IncludeHidden)==0\n             && IsHiddenColumn(&pTab->aCol[j]) \n            ){\n              continue;\n            }\n            tableSeen = 1;\n\n            if( i>0 && zTName==0 ){\n              if( (pFrom->fg.jointype & JT_NATURAL)!=0\n                && tableAndColumnIndex(pTabList, i, zName, 0, 0)\n              ){\n                /* In a NATURAL join, omit the join columns from the \n                ** table to the right of the join */\n                continue;\n              }\n              if( sqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){\n                /* In a join with a USING clause, omit columns in the\n                ** using clause from the table on the right. */\n                continue;\n              }\n            }\n            pRight = sqlite3Expr(db, TK_ID, zName);\n            zColname = zName;\n            zToFree = 0;\n            if( longNames || pTabList->nSrc>1 ){\n              Expr *pLeft;\n              pLeft = sqlite3Expr(db, TK_ID, zTabName);\n              pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);\n              if( zSchemaName ){\n                pLeft = sqlite3Expr(db, TK_ID, zSchemaName);\n                pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pExpr, 0);\n              }\n              if( longNames ){\n                zColname = sqlite3MPrintf(db, \"%s.%s\", zTabName, zName);\n                zToFree = zColname;\n              }\n            }else{\n              pExpr = pRight;\n            }\n            pNew = sqlite3ExprListAppend(pParse, pNew, pExpr);\n            sqlite3TokenInit(&sColname, zColname);\n            sqlite3ExprListSetName(pParse, pNew, &sColname, 0);\n            if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){\n              struct ExprList_item *pX = &pNew->a[pNew->nExpr-1];\n              if( pSub ){\n                pX->zSpan = sqlite3DbStrDup(db, pSub->pEList->a[j].zSpan);\n                testcase( pX->zSpan==0 );\n              }else{\n                pX->zSpan = sqlite3MPrintf(db, \"%s.%s.%s\",\n                                           zSchemaName, zTabName, zColname);\n                testcase( pX->zSpan==0 );\n              }\n              pX->bSpanIsTab = 1;\n            }\n            sqlite3DbFree(db, zToFree);\n          }\n        }\n        if( !tableSeen ){\n          if( zTName ){\n            sqlite3ErrorMsg(pParse, \"no such table: %s\", zTName);\n          }else{\n            sqlite3ErrorMsg(pParse, \"no tables specified\");\n          }\n        }\n      }\n    }\n    sqlite3ExprListDelete(db, pEList);\n    p->pEList = pNew;\n  }\n#if SQLITE_MAX_COLUMN\n  if( p->pEList && p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){\n    sqlite3ErrorMsg(pParse, \"too many columns in result set\");\n    return WRC_Abort;\n  }\n#endif\n  return WRC_Continue;\n}\n\n/*\n** No-op routine for the parse-tree walker.\n**\n** When this routine is the Walker.xExprCallback then expression trees\n** are walked without any actions being taken at each node.  Presumably,\n** when this routine is used for Walker.xExprCallback then \n** Walker.xSelectCallback is set to do something useful for every \n** subquery in the parser tree.\n*/\nint sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  return WRC_Continue;\n}\n\n/*\n** This routine \"expands\" a SELECT statement and all of its subqueries.\n** For additional information on what it means to \"expand\" a SELECT\n** statement, see the comment on the selectExpand worker callback above.\n**\n** Expanding a SELECT statement is the first step in processing a\n** SELECT statement.  The SELECT statement must be expanded before\n** name resolution is performed.\n**\n** If anything goes wrong, an error message is written into pParse.\n** The calling function can detect the problem by looking at pParse->nErr\n** and/or pParse->db->mallocFailed.\n*/\nstatic void sqlite3SelectExpand(Parse *pParse, Select *pSelect){\n  Walker w;\n  memset(&w, 0, sizeof(w));\n  w.xExprCallback = sqlite3ExprWalkNoop;\n  w.pParse = pParse;\n  if( pParse->hasCompound ){\n    w.xSelectCallback = convertCompoundSelectToSubquery;\n    sqlite3WalkSelect(&w, pSelect);\n  }\n  w.xSelectCallback = selectExpander;\n  if( (pSelect->selFlags & SF_MultiValue)==0 ){\n    w.xSelectCallback2 = selectPopWith;\n  }\n  sqlite3WalkSelect(&w, pSelect);\n}\n\n\n#ifndef SQLITE_OMIT_SUBQUERY\n/*\n** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo()\n** interface.\n**\n** For each FROM-clause subquery, add Column.zType and Column.zColl\n** information to the Table structure that represents the result set\n** of that subquery.\n**\n** The Table structure that represents the result set was constructed\n** by selectExpander() but the type and collation information was omitted\n** at that point because identifiers had not yet been resolved.  This\n** routine is called after identifier resolution.\n*/\nstatic void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){\n  Parse *pParse;\n  int i;\n  SrcList *pTabList;\n  struct SrcList_item *pFrom;\n\n  assert( p->selFlags & SF_Resolved );\n  assert( (p->selFlags & SF_HasTypeInfo)==0 );\n  p->selFlags |= SF_HasTypeInfo;\n  pParse = pWalker->pParse;\n  pTabList = p->pSrc;\n  for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){\n    Table *pTab = pFrom->pTab;\n    assert( pTab!=0 );\n    if( (pTab->tabFlags & TF_Ephemeral)!=0 ){\n      /* A sub-query in the FROM clause of a SELECT */\n      Select *pSel = pFrom->pSelect;\n      if( pSel ){\n        while( pSel->pPrior ) pSel = pSel->pPrior;\n        sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSel);\n      }\n    }\n  }\n}\n#endif\n\n\n/*\n** This routine adds datatype and collating sequence information to\n** the Table structures of all FROM-clause subqueries in a\n** SELECT statement.\n**\n** Use this routine after name resolution.\n*/\nstatic void sqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){\n#ifndef SQLITE_OMIT_SUBQUERY\n  Walker w;\n  memset(&w, 0, sizeof(w));\n  w.xSelectCallback2 = selectAddSubqueryTypeInfo;\n  w.xExprCallback = sqlite3ExprWalkNoop;\n  w.pParse = pParse;\n  sqlite3WalkSelect(&w, pSelect);\n#endif\n}\n\n\n/*\n** This routine sets up a SELECT statement for processing.  The\n** following is accomplished:\n**\n**     *  VDBE Cursor numbers are assigned to all FROM-clause terms.\n**     *  Ephemeral Table objects are created for all FROM-clause subqueries.\n**     *  ON and USING clauses are shifted into WHERE statements\n**     *  Wildcards \"*\" and \"TABLE.*\" in result sets are expanded.\n**     *  Identifiers in expression are matched to tables.\n**\n** This routine acts recursively on all subqueries within the SELECT.\n*/\nvoid sqlite3SelectPrep(\n  Parse *pParse,         /* The parser context */\n  Select *p,             /* The SELECT statement being coded. */\n  NameContext *pOuterNC  /* Name context for container */\n){\n  sqlite3 *db;\n  if( NEVER(p==0) ) return;\n  db = pParse->db;\n  if( db->mallocFailed ) return;\n  if( p->selFlags & SF_HasTypeInfo ) return;\n  sqlite3SelectExpand(pParse, p);\n  if( pParse->nErr || db->mallocFailed ) return;\n  sqlite3ResolveSelectNames(pParse, p, pOuterNC);\n  if( pParse->nErr || db->mallocFailed ) return;\n  sqlite3SelectAddTypeInfo(pParse, p);\n}\n\n/*\n** Reset the aggregate accumulator.\n**\n** The aggregate accumulator is a set of memory cells that hold\n** intermediate results while calculating an aggregate.  This\n** routine generates code that stores NULLs in all of those memory\n** cells.\n*/\nstatic void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){\n  Vdbe *v = pParse->pVdbe;\n  int i;\n  struct AggInfo_func *pFunc;\n  int nReg = pAggInfo->nFunc + pAggInfo->nColumn;\n  if( nReg==0 ) return;\n#ifdef SQLITE_DEBUG\n  /* Verify that all AggInfo registers are within the range specified by\n  ** AggInfo.mnReg..AggInfo.mxReg */\n  assert( nReg==pAggInfo->mxReg-pAggInfo->mnReg+1 );\n  for(i=0; i<pAggInfo->nColumn; i++){\n    assert( pAggInfo->aCol[i].iMem>=pAggInfo->mnReg\n         && pAggInfo->aCol[i].iMem<=pAggInfo->mxReg );\n  }\n  for(i=0; i<pAggInfo->nFunc; i++){\n    assert( pAggInfo->aFunc[i].iMem>=pAggInfo->mnReg\n         && pAggInfo->aFunc[i].iMem<=pAggInfo->mxReg );\n  }\n#endif\n  sqlite3VdbeAddOp3(v, OP_Null, 0, pAggInfo->mnReg, pAggInfo->mxReg);\n  for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){\n    if( pFunc->iDistinct>=0 ){\n      Expr *pE = pFunc->pExpr;\n      assert( !ExprHasProperty(pE, EP_xIsSelect) );\n      if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){\n        sqlite3ErrorMsg(pParse, \"DISTINCT aggregates must have exactly one \"\n           \"argument\");\n        pFunc->iDistinct = -1;\n      }else{\n        KeyInfo *pKeyInfo = keyInfoFromExprList(pParse, pE->x.pList, 0, 0);\n        sqlite3VdbeAddOp4(v, OP_OpenEphemeral, pFunc->iDistinct, 0, 0,\n                          (char*)pKeyInfo, P4_KEYINFO);\n      }\n    }\n  }\n}\n\n/*\n** Invoke the OP_AggFinalize opcode for every aggregate function\n** in the AggInfo structure.\n*/\nstatic void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){\n  Vdbe *v = pParse->pVdbe;\n  int i;\n  struct AggInfo_func *pF;\n  for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){\n    ExprList *pList = pF->pExpr->x.pList;\n    assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) );\n    sqlite3VdbeAddOp4(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0, 0,\n                      (void*)pF->pFunc, P4_FUNCDEF);\n  }\n}\n\n/*\n** Update the accumulator memory cells for an aggregate based on\n** the current cursor position.\n*/\nstatic void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){\n  Vdbe *v = pParse->pVdbe;\n  int i;\n  int regHit = 0;\n  int addrHitTest = 0;\n  struct AggInfo_func *pF;\n  struct AggInfo_col *pC;\n\n  pAggInfo->directMode = 1;\n  for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){\n    int nArg;\n    int addrNext = 0;\n    int regAgg;\n    ExprList *pList = pF->pExpr->x.pList;\n    assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) );\n    if( pList ){\n      nArg = pList->nExpr;\n      regAgg = sqlite3GetTempRange(pParse, nArg);\n      sqlite3ExprCodeExprList(pParse, pList, regAgg, 0, SQLITE_ECEL_DUP);\n    }else{\n      nArg = 0;\n      regAgg = 0;\n    }\n    if( pF->iDistinct>=0 ){\n      addrNext = sqlite3VdbeMakeLabel(v);\n      testcase( nArg==0 );  /* Error condition */\n      testcase( nArg>1 );   /* Also an error */\n      codeDistinct(pParse, pF->iDistinct, addrNext, 1, regAgg);\n    }\n    if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){\n      CollSeq *pColl = 0;\n      struct ExprList_item *pItem;\n      int j;\n      assert( pList!=0 );  /* pList!=0 if pF->pFunc has NEEDCOLL */\n      for(j=0, pItem=pList->a; !pColl && j<nArg; j++, pItem++){\n        pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);\n      }\n      if( !pColl ){\n        pColl = pParse->db->pDfltColl;\n      }\n      if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem;\n      sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ);\n    }\n    sqlite3VdbeAddOp4(v, OP_AggStep0, 0, regAgg, pF->iMem,\n                      (void*)pF->pFunc, P4_FUNCDEF);\n    sqlite3VdbeChangeP5(v, (u8)nArg);\n    sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);\n    sqlite3ReleaseTempRange(pParse, regAgg, nArg);\n    if( addrNext ){\n      sqlite3VdbeResolveLabel(v, addrNext);\n      sqlite3ExprCacheClear(pParse);\n    }\n  }\n\n  /* Before populating the accumulator registers, clear the column cache.\n  ** Otherwise, if any of the required column values are already present \n  ** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value\n  ** to pC->iMem. But by the time the value is used, the original register\n  ** may have been used, invalidating the underlying buffer holding the\n  ** text or blob value. See ticket [883034dcb5].\n  **\n  ** Another solution would be to change the OP_SCopy used to copy cached\n  ** values to an OP_Copy.\n  */\n  if( regHit ){\n    addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v);\n  }\n  sqlite3ExprCacheClear(pParse);\n  for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){\n    sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);\n  }\n  pAggInfo->directMode = 0;\n  sqlite3ExprCacheClear(pParse);\n  if( addrHitTest ){\n    sqlite3VdbeJumpHere(v, addrHitTest);\n  }\n}\n\n/*\n** Add a single OP_Explain instruction to the VDBE to explain a simple\n** count(*) query (\"SELECT count(*) FROM pTab\").\n*/\n#ifndef SQLITE_OMIT_EXPLAIN\nstatic void explainSimpleCount(\n  Parse *pParse,                  /* Parse context */\n  Table *pTab,                    /* Table being queried */\n  Index *pIdx                     /* Index used to optimize scan, or NULL */\n){\n  if( pParse->explain==2 ){\n    int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx)));\n    char *zEqp = sqlite3MPrintf(pParse->db, \"SCAN TABLE %s%s%s\",\n        pTab->zName,\n        bCover ? \" USING COVERING INDEX \" : \"\",\n        bCover ? pIdx->zName : \"\"\n    );\n    sqlite3VdbeAddOp4(\n        pParse->pVdbe, OP_Explain, pParse->iSelectId, 0, 0, zEqp, P4_DYNAMIC\n    );\n  }\n}\n#else\n# define explainSimpleCount(a,b,c)\n#endif\n\n/*\n** Generate code for the SELECT statement given in the p argument.  \n**\n** The results are returned according to the SelectDest structure.\n** See comments in sqliteInt.h for further information.\n**\n** This routine returns the number of errors.  If any errors are\n** encountered, then an appropriate error message is left in\n** pParse->zErrMsg.\n**\n** This routine does NOT free the Select structure passed in.  The\n** calling function needs to do that.\n*/\nint sqlite3Select(\n  Parse *pParse,         /* The parser context */\n  Select *p,             /* The SELECT statement being coded. */\n  SelectDest *pDest      /* What to do with the query results */\n){\n  int i, j;              /* Loop counters */\n  WhereInfo *pWInfo;     /* Return from sqlite3WhereBegin() */\n  Vdbe *v;               /* The virtual machine under construction */\n  int isAgg;             /* True for select lists like \"count(*)\" */\n  ExprList *pEList = 0;  /* List of columns to extract. */\n  SrcList *pTabList;     /* List of tables to select from */\n  Expr *pWhere;          /* The WHERE clause.  May be NULL */\n  ExprList *pGroupBy;    /* The GROUP BY clause.  May be NULL */\n  Expr *pHaving;         /* The HAVING clause.  May be NULL */\n  int rc = 1;            /* Value to return from this function */\n  DistinctCtx sDistinct; /* Info on how to code the DISTINCT keyword */\n  SortCtx sSort;         /* Info on how to code the ORDER BY clause */\n  AggInfo sAggInfo;      /* Information used by aggregate queries */\n  int iEnd;              /* Address of the end of the query */\n  sqlite3 *db;           /* The database connection */\n\n#ifndef SQLITE_OMIT_EXPLAIN\n  int iRestoreSelectId = pParse->iSelectId;\n  pParse->iSelectId = pParse->iNextSelectId++;\n#endif\n\n  db = pParse->db;\n  if( p==0 || db->mallocFailed || pParse->nErr ){\n    return 1;\n  }\n  if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;\n  memset(&sAggInfo, 0, sizeof(sAggInfo));\n#if SELECTTRACE_ENABLED\n  pParse->nSelectIndent++;\n  SELECTTRACE(1,pParse,p, (\"begin processing:\\n\"));\n  if( sqlite3SelectTrace & 0x100 ){\n    sqlite3TreeViewSelect(0, p, 0);\n  }\n#endif\n\n  assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );\n  assert( p->pOrderBy==0 || pDest->eDest!=SRT_Fifo );\n  assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistQueue );\n  assert( p->pOrderBy==0 || pDest->eDest!=SRT_Queue );\n  if( IgnorableOrderby(pDest) ){\n    assert(pDest->eDest==SRT_Exists || pDest->eDest==SRT_Union || \n           pDest->eDest==SRT_Except || pDest->eDest==SRT_Discard ||\n           pDest->eDest==SRT_Queue  || pDest->eDest==SRT_DistFifo ||\n           pDest->eDest==SRT_DistQueue || pDest->eDest==SRT_Fifo);\n    /* If ORDER BY makes no difference in the output then neither does\n    ** DISTINCT so it can be removed too. */\n    sqlite3ExprListDelete(db, p->pOrderBy);\n    p->pOrderBy = 0;\n    p->selFlags &= ~SF_Distinct;\n  }\n  sqlite3SelectPrep(pParse, p, 0);\n  memset(&sSort, 0, sizeof(sSort));\n  sSort.pOrderBy = p->pOrderBy;\n  pTabList = p->pSrc;\n  if( pParse->nErr || db->mallocFailed ){\n    goto select_end;\n  }\n  assert( p->pEList!=0 );\n  isAgg = (p->selFlags & SF_Aggregate)!=0;\n#if SELECTTRACE_ENABLED\n  if( sqlite3SelectTrace & 0x100 ){\n    SELECTTRACE(0x100,pParse,p, (\"after name resolution:\\n\"));\n    sqlite3TreeViewSelect(0, p, 0);\n  }\n#endif\n\n  /* Try to flatten subqueries in the FROM clause up into the main query\n  */\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\n  for(i=0; !p->pPrior && i<pTabList->nSrc; i++){\n    struct SrcList_item *pItem = &pTabList->a[i];\n    Select *pSub = pItem->pSelect;\n    int isAggSub;\n    Table *pTab = pItem->pTab;\n    if( pSub==0 ) continue;\n\n    /* Catch mismatch in the declared columns of a view and the number of\n    ** columns in the SELECT on the RHS */\n    if( pTab->nCol!=pSub->pEList->nExpr ){\n      sqlite3ErrorMsg(pParse, \"expected %d columns for '%s' but got %d\",\n                      pTab->nCol, pTab->zName, pSub->pEList->nExpr);\n      goto select_end;\n    }\n\n    isAggSub = (pSub->selFlags & SF_Aggregate)!=0;\n    if( flattenSubquery(pParse, p, i, isAgg, isAggSub) ){\n      /* This subquery can be absorbed into its parent. */\n      if( isAggSub ){\n        isAgg = 1;\n        p->selFlags |= SF_Aggregate;\n      }\n      i = -1;\n    }\n    pTabList = p->pSrc;\n    if( db->mallocFailed ) goto select_end;\n    if( !IgnorableOrderby(pDest) ){\n      sSort.pOrderBy = p->pOrderBy;\n    }\n  }\n#endif\n\n  /* Get a pointer the VDBE under construction, allocating a new VDBE if one\n  ** does not already exist */\n  v = sqlite3GetVdbe(pParse);\n  if( v==0 ) goto select_end;\n\n#ifndef SQLITE_OMIT_COMPOUND_SELECT\n  /* Handle compound SELECT statements using the separate multiSelect()\n  ** procedure.\n  */\n  if( p->pPrior ){\n    rc = multiSelect(pParse, p, pDest);\n    explainSetInteger(pParse->iSelectId, iRestoreSelectId);\n#if SELECTTRACE_ENABLED\n    SELECTTRACE(1,pParse,p,(\"end compound-select processing\\n\"));\n    pParse->nSelectIndent--;\n#endif\n    return rc;\n  }\n#endif\n\n  /* Generate code for all sub-queries in the FROM clause\n  */\n#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)\n  for(i=0; i<pTabList->nSrc; i++){\n    struct SrcList_item *pItem = &pTabList->a[i];\n    SelectDest dest;\n    Select *pSub = pItem->pSelect;\n    if( pSub==0 ) continue;\n\n    /* Sometimes the code for a subquery will be generated more than\n    ** once, if the subquery is part of the WHERE clause in a LEFT JOIN,\n    ** for example.  In that case, do not regenerate the code to manifest\n    ** a view or the co-routine to implement a view.  The first instance\n    ** is sufficient, though the subroutine to manifest the view does need\n    ** to be invoked again. */\n    if( pItem->addrFillSub ){\n      if( pItem->fg.viaCoroutine==0 ){\n        sqlite3VdbeAddOp2(v, OP_Gosub, pItem->regReturn, pItem->addrFillSub);\n      }\n      continue;\n    }\n\n    /* Increment Parse.nHeight by the height of the largest expression\n    ** tree referred to by this, the parent select. The child select\n    ** may contain expression trees of at most\n    ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit\n    ** more conservative than necessary, but much easier than enforcing\n    ** an exact limit.\n    */\n    pParse->nHeight += sqlite3SelectExprHeight(p);\n\n    /* Make copies of constant WHERE-clause terms in the outer query down\n    ** inside the subquery.  This can help the subquery to run more efficiently.\n    */\n    if( (pItem->fg.jointype & JT_OUTER)==0\n     && pushDownWhereTerms(db, pSub, p->pWhere, pItem->iCursor)\n    ){\n#if SELECTTRACE_ENABLED\n      if( sqlite3SelectTrace & 0x100 ){\n        SELECTTRACE(0x100,pParse,p,(\"After WHERE-clause push-down:\\n\"));\n        sqlite3TreeViewSelect(0, p, 0);\n      }\n#endif\n    }\n\n    /* Generate code to implement the subquery\n    **\n    ** The subquery is implemented as a co-routine if all of these are true:\n    **   (1)  The subquery is guaranteed to be the outer loop (so that it\n    **        does not need to be computed more than once)\n    **   (2)  The ALL keyword after SELECT is omitted.  (Applications are\n    **        allowed to say \"SELECT ALL\" instead of just \"SELECT\" to disable\n    **        the use of co-routines.)\n    **   (3)  Co-routines are not disabled using sqlite3_test_control()\n    **        with SQLITE_TESTCTRL_OPTIMIZATIONS.\n    **\n    ** TODO: Are there other reasons beside (1) to use a co-routine\n    ** implementation?\n    */\n    if( i==0\n     && (pTabList->nSrc==1\n            || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0)  /* (1) */\n     && (p->selFlags & SF_All)==0                                   /* (2) */\n     && OptimizationEnabled(db, SQLITE_SubqCoroutine)               /* (3) */\n    ){\n      /* Implement a co-routine that will return a single row of the result\n      ** set on each invocation.\n      */\n      int addrTop = sqlite3VdbeCurrentAddr(v)+1;\n      pItem->regReturn = ++pParse->nMem;\n      sqlite3VdbeAddOp3(v, OP_InitCoroutine, pItem->regReturn, 0, addrTop);\n      VdbeComment((v, \"%s\", pItem->pTab->zName));\n      pItem->addrFillSub = addrTop;\n      sqlite3SelectDestInit(&dest, SRT_Coroutine, pItem->regReturn);\n      explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);\n      sqlite3Select(pParse, pSub, &dest);\n      pItem->pTab->nRowLogEst = pSub->nSelectRow;\n      pItem->fg.viaCoroutine = 1;\n      pItem->regResult = dest.iSdst;\n      sqlite3VdbeEndCoroutine(v, pItem->regReturn);\n      sqlite3VdbeJumpHere(v, addrTop-1);\n      sqlite3ClearTempRegCache(pParse);\n    }else{\n      /* Generate a subroutine that will fill an ephemeral table with\n      ** the content of this subquery.  pItem->addrFillSub will point\n      ** to the address of the generated subroutine.  pItem->regReturn\n      ** is a register allocated to hold the subroutine return address\n      */\n      int topAddr;\n      int onceAddr = 0;\n      int retAddr;\n      assert( pItem->addrFillSub==0 );\n      pItem->regReturn = ++pParse->nMem;\n      topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn);\n      pItem->addrFillSub = topAddr+1;\n      if( pItem->fg.isCorrelated==0 ){\n        /* If the subquery is not correlated and if we are not inside of\n        ** a trigger, then we only need to compute the value of the subquery\n        ** once. */\n        onceAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);\n        VdbeComment((v, \"materialize \\\"%s\\\"\", pItem->pTab->zName));\n      }else{\n        VdbeNoopComment((v, \"materialize \\\"%s\\\"\", pItem->pTab->zName));\n      }\n      sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);\n      explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);\n      sqlite3Select(pParse, pSub, &dest);\n      pItem->pTab->nRowLogEst = pSub->nSelectRow;\n      if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);\n      retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn);\n      VdbeComment((v, \"end %s\", pItem->pTab->zName));\n      sqlite3VdbeChangeP1(v, topAddr, retAddr);\n      sqlite3ClearTempRegCache(pParse);\n    }\n    if( db->mallocFailed ) goto select_end;\n    pParse->nHeight -= sqlite3SelectExprHeight(p);\n  }\n#endif\n\n  /* Various elements of the SELECT copied into local variables for\n  ** convenience */\n  pEList = p->pEList;\n  pWhere = p->pWhere;\n  pGroupBy = p->pGroupBy;\n  pHaving = p->pHaving;\n  sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;\n\n#if SELECTTRACE_ENABLED\n  if( sqlite3SelectTrace & 0x400 ){\n    SELECTTRACE(0x400,pParse,p,(\"After all FROM-clause analysis:\\n\"));\n    sqlite3TreeViewSelect(0, p, 0);\n  }\n#endif\n\n  /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and \n  ** if the select-list is the same as the ORDER BY list, then this query\n  ** can be rewritten as a GROUP BY. In other words, this:\n  **\n  **     SELECT DISTINCT xyz FROM ... ORDER BY xyz\n  **\n  ** is transformed to:\n  **\n  **     SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz\n  **\n  ** The second form is preferred as a single index (or temp-table) may be \n  ** used for both the ORDER BY and DISTINCT processing. As originally \n  ** written the query must use a temp-table for at least one of the ORDER \n  ** BY and DISTINCT, and an index or separate temp-table for the other.\n  */\n  if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct \n   && sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0\n  ){\n    p->selFlags &= ~SF_Distinct;\n    pGroupBy = p->pGroupBy = sqlite3ExprListDup(db, pEList, 0);\n    /* Notice that even thought SF_Distinct has been cleared from p->selFlags,\n    ** the sDistinct.isTnct is still set.  Hence, isTnct represents the\n    ** original setting of the SF_Distinct flag, not the current setting */\n    assert( sDistinct.isTnct );\n\n#if SELECTTRACE_ENABLED\n    if( sqlite3SelectTrace & 0x400 ){\n      SELECTTRACE(0x400,pParse,p,(\"Transform DISTINCT into GROUP BY:\\n\"));\n      sqlite3TreeViewSelect(0, p, 0);\n    }\n#endif\n  }\n\n  /* If there is an ORDER BY clause, then create an ephemeral index to\n  ** do the sorting.  But this sorting ephemeral index might end up\n  ** being unused if the data can be extracted in pre-sorted order.\n  ** If that is the case, then the OP_OpenEphemeral instruction will be\n  ** changed to an OP_Noop once we figure out that the sorting index is\n  ** not needed.  The sSort.addrSortIndex variable is used to facilitate\n  ** that change.\n  */\n  if( sSort.pOrderBy ){\n    KeyInfo *pKeyInfo;\n    pKeyInfo = keyInfoFromExprList(pParse, sSort.pOrderBy, 0, pEList->nExpr);\n    sSort.iECursor = pParse->nTab++;\n    sSort.addrSortIndex =\n      sqlite3VdbeAddOp4(v, OP_OpenEphemeral,\n          sSort.iECursor, sSort.pOrderBy->nExpr+1+pEList->nExpr, 0,\n          (char*)pKeyInfo, P4_KEYINFO\n      );\n  }else{\n    sSort.addrSortIndex = -1;\n  }\n\n  /* If the output is destined for a temporary table, open that table.\n  */\n  if( pDest->eDest==SRT_EphemTab ){\n    sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iSDParm, pEList->nExpr);\n  }\n\n  /* Set the limiter.\n  */\n  iEnd = sqlite3VdbeMakeLabel(v);\n  p->nSelectRow = 320;  /* 4 billion rows */\n  computeLimitRegisters(pParse, p, iEnd);\n  if( p->iLimit==0 && sSort.addrSortIndex>=0 ){\n    sqlite3VdbeChangeOpcode(v, sSort.addrSortIndex, OP_SorterOpen);\n    sSort.sortFlags |= SORTFLAG_UseSorter;\n  }\n\n  /* Open an ephemeral index to use for the distinct set.\n  */\n  if( p->selFlags & SF_Distinct ){\n    sDistinct.tabTnct = pParse->nTab++;\n    sDistinct.addrTnct = sqlite3VdbeAddOp4(v, OP_OpenEphemeral,\n                             sDistinct.tabTnct, 0, 0,\n                             (char*)keyInfoFromExprList(pParse, p->pEList,0,0),\n                             P4_KEYINFO);\n    sqlite3VdbeChangeP5(v, BTREE_UNORDERED);\n    sDistinct.eTnctType = WHERE_DISTINCT_UNORDERED;\n  }else{\n    sDistinct.eTnctType = WHERE_DISTINCT_NOOP;\n  }\n\n  if( !isAgg && pGroupBy==0 ){\n    /* No aggregate functions and no GROUP BY clause */\n    u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0);\n    assert( WHERE_USE_LIMIT==SF_FixedLimit );\n    wctrlFlags |= p->selFlags & SF_FixedLimit;\n\n    /* Begin the database scan. */\n    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy,\n                               p->pEList, wctrlFlags, p->nSelectRow);\n    if( pWInfo==0 ) goto select_end;\n    if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){\n      p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo);\n    }\n    if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){\n      sDistinct.eTnctType = sqlite3WhereIsDistinct(pWInfo);\n    }\n    if( sSort.pOrderBy ){\n      sSort.nOBSat = sqlite3WhereIsOrdered(pWInfo);\n      sSort.bOrderedInnerLoop = sqlite3WhereOrderedInnerLoop(pWInfo);\n      if( sSort.nOBSat==sSort.pOrderBy->nExpr ){\n        sSort.pOrderBy = 0;\n      }\n    }\n\n    /* If sorting index that was created by a prior OP_OpenEphemeral \n    ** instruction ended up not being needed, then change the OP_OpenEphemeral\n    ** into an OP_Noop.\n    */\n    if( sSort.addrSortIndex>=0 && sSort.pOrderBy==0 ){\n      sqlite3VdbeChangeToNoop(v, sSort.addrSortIndex);\n    }\n\n    /* Use the standard inner loop. */\n    selectInnerLoop(pParse, p, pEList, -1, &sSort, &sDistinct, pDest,\n                    sqlite3WhereContinueLabel(pWInfo),\n                    sqlite3WhereBreakLabel(pWInfo));\n\n    /* End the database scan loop.\n    */\n    sqlite3WhereEnd(pWInfo);\n  }else{\n    /* This case when there exist aggregate functions or a GROUP BY clause\n    ** or both */\n    NameContext sNC;    /* Name context for processing aggregate information */\n    int iAMem;          /* First Mem address for storing current GROUP BY */\n    int iBMem;          /* First Mem address for previous GROUP BY */\n    int iUseFlag;       /* Mem address holding flag indicating that at least\n                        ** one row of the input to the aggregator has been\n                        ** processed */\n    int iAbortFlag;     /* Mem address which causes query abort if positive */\n    int groupBySort;    /* Rows come from source in GROUP BY order */\n    int addrEnd;        /* End of processing for this SELECT */\n    int sortPTab = 0;   /* Pseudotable used to decode sorting results */\n    int sortOut = 0;    /* Output register from the sorter */\n    int orderByGrp = 0; /* True if the GROUP BY and ORDER BY are the same */\n\n    /* Remove any and all aliases between the result set and the\n    ** GROUP BY clause.\n    */\n    if( pGroupBy ){\n      int k;                        /* Loop counter */\n      struct ExprList_item *pItem;  /* For looping over expression in a list */\n\n      for(k=p->pEList->nExpr, pItem=p->pEList->a; k>0; k--, pItem++){\n        pItem->u.x.iAlias = 0;\n      }\n      for(k=pGroupBy->nExpr, pItem=pGroupBy->a; k>0; k--, pItem++){\n        pItem->u.x.iAlias = 0;\n      }\n      assert( 66==sqlite3LogEst(100) );\n      if( p->nSelectRow>66 ) p->nSelectRow = 66;\n    }else{\n      assert( 0==sqlite3LogEst(1) );\n      p->nSelectRow = 0;\n    }\n\n    /* If there is both a GROUP BY and an ORDER BY clause and they are\n    ** identical, then it may be possible to disable the ORDER BY clause \n    ** on the grounds that the GROUP BY will cause elements to come out \n    ** in the correct order. It also may not - the GROUP BY might use a\n    ** database index that causes rows to be grouped together as required\n    ** but not actually sorted. Either way, record the fact that the\n    ** ORDER BY and GROUP BY clauses are the same by setting the orderByGrp\n    ** variable.  */\n    if( sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){\n      orderByGrp = 1;\n    }\n \n    /* Create a label to jump to when we want to abort the query */\n    addrEnd = sqlite3VdbeMakeLabel(v);\n\n    /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in\n    ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the\n    ** SELECT statement.\n    */\n    memset(&sNC, 0, sizeof(sNC));\n    sNC.pParse = pParse;\n    sNC.pSrcList = pTabList;\n    sNC.pAggInfo = &sAggInfo;\n    sAggInfo.mnReg = pParse->nMem+1;\n    sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0;\n    sAggInfo.pGroupBy = pGroupBy;\n    sqlite3ExprAnalyzeAggList(&sNC, pEList);\n    sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy);\n    if( pHaving ){\n      sqlite3ExprAnalyzeAggregates(&sNC, pHaving);\n    }\n    sAggInfo.nAccumulator = sAggInfo.nColumn;\n    for(i=0; i<sAggInfo.nFunc; i++){\n      assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );\n      sNC.ncFlags |= NC_InAggFunc;\n      sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);\n      sNC.ncFlags &= ~NC_InAggFunc;\n    }\n    sAggInfo.mxReg = pParse->nMem;\n    if( db->mallocFailed ) goto select_end;\n\n    /* Processing for aggregates with GROUP BY is very different and\n    ** much more complex than aggregates without a GROUP BY.\n    */\n    if( pGroupBy ){\n      KeyInfo *pKeyInfo;  /* Keying information for the group by clause */\n      int addr1;          /* A-vs-B comparision jump */\n      int addrOutputRow;  /* Start of subroutine that outputs a result row */\n      int regOutputRow;   /* Return address register for output subroutine */\n      int addrSetAbort;   /* Set the abort flag and return */\n      int addrTopOfLoop;  /* Top of the input loop */\n      int addrSortingIdx; /* The OP_OpenEphemeral for the sorting index */\n      int addrReset;      /* Subroutine for resetting the accumulator */\n      int regReset;       /* Return address register for reset subroutine */\n\n      /* If there is a GROUP BY clause we might need a sorting index to\n      ** implement it.  Allocate that sorting index now.  If it turns out\n      ** that we do not need it after all, the OP_SorterOpen instruction\n      ** will be converted into a Noop.  \n      */\n      sAggInfo.sortingIdx = pParse->nTab++;\n      pKeyInfo = keyInfoFromExprList(pParse, pGroupBy, 0, sAggInfo.nColumn);\n      addrSortingIdx = sqlite3VdbeAddOp4(v, OP_SorterOpen, \n          sAggInfo.sortingIdx, sAggInfo.nSortingColumn, \n          0, (char*)pKeyInfo, P4_KEYINFO);\n\n      /* Initialize memory locations used by GROUP BY aggregate processing\n      */\n      iUseFlag = ++pParse->nMem;\n      iAbortFlag = ++pParse->nMem;\n      regOutputRow = ++pParse->nMem;\n      addrOutputRow = sqlite3VdbeMakeLabel(v);\n      regReset = ++pParse->nMem;\n      addrReset = sqlite3VdbeMakeLabel(v);\n      iAMem = pParse->nMem + 1;\n      pParse->nMem += pGroupBy->nExpr;\n      iBMem = pParse->nMem + 1;\n      pParse->nMem += pGroupBy->nExpr;\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag);\n      VdbeComment((v, \"clear abort flag\"));\n      sqlite3VdbeAddOp2(v, OP_Integer, 0, iUseFlag);\n      VdbeComment((v, \"indicate accumulator empty\"));\n      sqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1);\n\n      /* Begin a loop that will extract all source rows in GROUP BY order.\n      ** This might involve two separate loops with an OP_Sort in between, or\n      ** it might be a single loop that uses an index to extract information\n      ** in the right order to begin with.\n      */\n      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);\n      pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,\n          WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0), 0\n      );\n      if( pWInfo==0 ) goto select_end;\n      if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){\n        /* The optimizer is able to deliver rows in group by order so\n        ** we do not have to sort.  The OP_OpenEphemeral table will be\n        ** cancelled later because we still need to use the pKeyInfo\n        */\n        groupBySort = 0;\n      }else{\n        /* Rows are coming out in undetermined order.  We have to push\n        ** each row into a sorting index, terminate the first loop,\n        ** then loop over the sorting index in order to get the output\n        ** in sorted order\n        */\n        int regBase;\n        int regRecord;\n        int nCol;\n        int nGroupBy;\n\n        explainTempTable(pParse, \n            (sDistinct.isTnct && (p->selFlags&SF_Distinct)==0) ?\n                    \"DISTINCT\" : \"GROUP BY\");\n\n        groupBySort = 1;\n        nGroupBy = pGroupBy->nExpr;\n        nCol = nGroupBy;\n        j = nGroupBy;\n        for(i=0; i<sAggInfo.nColumn; i++){\n          if( sAggInfo.aCol[i].iSorterColumn>=j ){\n            nCol++;\n            j++;\n          }\n        }\n        regBase = sqlite3GetTempRange(pParse, nCol);\n        sqlite3ExprCacheClear(pParse);\n        sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0, 0);\n        j = nGroupBy;\n        for(i=0; i<sAggInfo.nColumn; i++){\n          struct AggInfo_col *pCol = &sAggInfo.aCol[i];\n          if( pCol->iSorterColumn>=j ){\n            int r1 = j + regBase;\n            sqlite3ExprCodeGetColumnToReg(pParse, \n                               pCol->pTab, pCol->iColumn, pCol->iTable, r1);\n            j++;\n          }\n        }\n        regRecord = sqlite3GetTempReg(pParse);\n        sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);\n        sqlite3VdbeAddOp2(v, OP_SorterInsert, sAggInfo.sortingIdx, regRecord);\n        sqlite3ReleaseTempReg(pParse, regRecord);\n        sqlite3ReleaseTempRange(pParse, regBase, nCol);\n        sqlite3WhereEnd(pWInfo);\n        sAggInfo.sortingIdxPTab = sortPTab = pParse->nTab++;\n        sortOut = sqlite3GetTempReg(pParse);\n        sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol);\n        sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd);\n        VdbeComment((v, \"GROUP BY sort\")); VdbeCoverage(v);\n        sAggInfo.useSortingIdx = 1;\n        sqlite3ExprCacheClear(pParse);\n\n      }\n\n      /* If the index or temporary table used by the GROUP BY sort\n      ** will naturally deliver rows in the order required by the ORDER BY\n      ** clause, cancel the ephemeral table open coded earlier.\n      **\n      ** This is an optimization - the correct answer should result regardless.\n      ** Use the SQLITE_GroupByOrder flag with SQLITE_TESTCTRL_OPTIMIZER to \n      ** disable this optimization for testing purposes.  */\n      if( orderByGrp && OptimizationEnabled(db, SQLITE_GroupByOrder) \n       && (groupBySort || sqlite3WhereIsSorted(pWInfo))\n      ){\n        sSort.pOrderBy = 0;\n        sqlite3VdbeChangeToNoop(v, sSort.addrSortIndex);\n      }\n\n      /* Evaluate the current GROUP BY terms and store in b0, b1, b2...\n      ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth)\n      ** Then compare the current GROUP BY terms against the GROUP BY terms\n      ** from the previous row currently stored in a0, a1, a2...\n      */\n      addrTopOfLoop = sqlite3VdbeCurrentAddr(v);\n      sqlite3ExprCacheClear(pParse);\n      if( groupBySort ){\n        sqlite3VdbeAddOp3(v, OP_SorterData, sAggInfo.sortingIdx,\n                          sortOut, sortPTab);\n      }\n      for(j=0; j<pGroupBy->nExpr; j++){\n        if( groupBySort ){\n          sqlite3VdbeAddOp3(v, OP_Column, sortPTab, j, iBMem+j);\n        }else{\n          sAggInfo.directMode = 1;\n          sqlite3ExprCode(pParse, pGroupBy->a[j].pExpr, iBMem+j);\n        }\n      }\n      sqlite3VdbeAddOp4(v, OP_Compare, iAMem, iBMem, pGroupBy->nExpr,\n                          (char*)sqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO);\n      addr1 = sqlite3VdbeCurrentAddr(v);\n      sqlite3VdbeAddOp3(v, OP_Jump, addr1+1, 0, addr1+1); VdbeCoverage(v);\n\n      /* Generate code that runs whenever the GROUP BY changes.\n      ** Changes in the GROUP BY are detected by the previous code\n      ** block.  If there were no changes, this block is skipped.\n      **\n      ** This code copies current group by terms in b0,b1,b2,...\n      ** over to a0,a1,a2.  It then calls the output subroutine\n      ** and resets the aggregate accumulator registers in preparation\n      ** for the next GROUP BY batch.\n      */\n      sqlite3ExprCodeMove(pParse, iBMem, iAMem, pGroupBy->nExpr);\n      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);\n      VdbeComment((v, \"output one row\"));\n      sqlite3VdbeAddOp2(v, OP_IfPos, iAbortFlag, addrEnd); VdbeCoverage(v);\n      VdbeComment((v, \"check abort flag\"));\n      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);\n      VdbeComment((v, \"reset accumulator\"));\n\n      /* Update the aggregate accumulators based on the content of\n      ** the current row\n      */\n      sqlite3VdbeJumpHere(v, addr1);\n      updateAccumulator(pParse, &sAggInfo);\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, iUseFlag);\n      VdbeComment((v, \"indicate data in accumulator\"));\n\n      /* End of the loop\n      */\n      if( groupBySort ){\n        sqlite3VdbeAddOp2(v, OP_SorterNext, sAggInfo.sortingIdx, addrTopOfLoop);\n        VdbeCoverage(v);\n      }else{\n        sqlite3WhereEnd(pWInfo);\n        sqlite3VdbeChangeToNoop(v, addrSortingIdx);\n      }\n\n      /* Output the final row of result\n      */\n      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);\n      VdbeComment((v, \"output final row\"));\n\n      /* Jump over the subroutines\n      */\n      sqlite3VdbeGoto(v, addrEnd);\n\n      /* Generate a subroutine that outputs a single row of the result\n      ** set.  This subroutine first looks at the iUseFlag.  If iUseFlag\n      ** is less than or equal to zero, the subroutine is a no-op.  If\n      ** the processing calls for the query to abort, this subroutine\n      ** increments the iAbortFlag memory location before returning in\n      ** order to signal the caller to abort.\n      */\n      addrSetAbort = sqlite3VdbeCurrentAddr(v);\n      sqlite3VdbeAddOp2(v, OP_Integer, 1, iAbortFlag);\n      VdbeComment((v, \"set abort flag\"));\n      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);\n      sqlite3VdbeResolveLabel(v, addrOutputRow);\n      addrOutputRow = sqlite3VdbeCurrentAddr(v);\n      sqlite3VdbeAddOp2(v, OP_IfPos, iUseFlag, addrOutputRow+2);\n      VdbeCoverage(v);\n      VdbeComment((v, \"Groupby result generator entry point\"));\n      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);\n      finalizeAggFunctions(pParse, &sAggInfo);\n      sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);\n      selectInnerLoop(pParse, p, p->pEList, -1, &sSort,\n                      &sDistinct, pDest,\n                      addrOutputRow+1, addrSetAbort);\n      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);\n      VdbeComment((v, \"end groupby result generator\"));\n\n      /* Generate a subroutine that will reset the group-by accumulator\n      */\n      sqlite3VdbeResolveLabel(v, addrReset);\n      resetAccumulator(pParse, &sAggInfo);\n      sqlite3VdbeAddOp1(v, OP_Return, regReset);\n     \n    } /* endif pGroupBy.  Begin aggregate queries without GROUP BY: */\n    else {\n      ExprList *pDel = 0;\n#ifndef SQLITE_OMIT_BTREECOUNT\n      Table *pTab;\n      if( (pTab = isSimpleCount(p, &sAggInfo))!=0 ){\n        /* If isSimpleCount() returns a pointer to a Table structure, then\n        ** the SQL statement is of the form:\n        **\n        **   SELECT count(*) FROM <tbl>\n        **\n        ** where the Table structure returned represents table <tbl>.\n        **\n        ** This statement is so common that it is optimized specially. The\n        ** OP_Count instruction is executed either on the intkey table that\n        ** contains the data for table <tbl> or on one of its indexes. It\n        ** is better to execute the op on an index, as indexes are almost\n        ** always spread across less pages than their corresponding tables.\n        */\n        const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n        const int iCsr = pParse->nTab++;     /* Cursor to scan b-tree */\n        Index *pIdx;                         /* Iterator variable */\n        KeyInfo *pKeyInfo = 0;               /* Keyinfo for scanned index */\n        Index *pBest = 0;                    /* Best index found so far */\n        int iRoot = pTab->tnum;              /* Root page of scanned b-tree */\n\n        sqlite3CodeVerifySchema(pParse, iDb);\n        sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\n\n        /* Search for the index that has the lowest scan cost.\n        **\n        ** (2011-04-15) Do not do a full scan of an unordered index.\n        **\n        ** (2013-10-03) Do not count the entries in a partial index.\n        **\n        ** In practice the KeyInfo structure will not be used. It is only \n        ** passed to keep OP_OpenRead happy.\n        */\n        if( !HasRowid(pTab) ) pBest = sqlite3PrimaryKeyIndex(pTab);\n        for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n          if( pIdx->bUnordered==0\n           && pIdx->szIdxRow<pTab->szTabRow\n           && pIdx->pPartIdxWhere==0\n           && (!pBest || pIdx->szIdxRow<pBest->szIdxRow)\n          ){\n            pBest = pIdx;\n          }\n        }\n        if( pBest ){\n          iRoot = pBest->tnum;\n          pKeyInfo = sqlite3KeyInfoOfIndex(pParse, pBest);\n        }\n\n        /* Open a read-only cursor, execute the OP_Count, close the cursor. */\n        sqlite3VdbeAddOp4Int(v, OP_OpenRead, iCsr, iRoot, iDb, 1);\n        if( pKeyInfo ){\n          sqlite3VdbeChangeP4(v, -1, (char *)pKeyInfo, P4_KEYINFO);\n        }\n        sqlite3VdbeAddOp2(v, OP_Count, iCsr, sAggInfo.aFunc[0].iMem);\n        sqlite3VdbeAddOp1(v, OP_Close, iCsr);\n        explainSimpleCount(pParse, pTab, pBest);\n      }else\n#endif /* SQLITE_OMIT_BTREECOUNT */\n      {\n        /* Check if the query is of one of the following forms:\n        **\n        **   SELECT min(x) FROM ...\n        **   SELECT max(x) FROM ...\n        **\n        ** If it is, then ask the code in where.c to attempt to sort results\n        ** as if there was an \"ORDER ON x\" or \"ORDER ON x DESC\" clause. \n        ** If where.c is able to produce results sorted in this order, then\n        ** add vdbe code to break out of the processing loop after the \n        ** first iteration (since the first iteration of the loop is \n        ** guaranteed to operate on the row with the minimum or maximum \n        ** value of x, the only row required).\n        **\n        ** A special flag must be passed to sqlite3WhereBegin() to slightly\n        ** modify behavior as follows:\n        **\n        **   + If the query is a \"SELECT min(x)\", then the loop coded by\n        **     where.c should not iterate over any values with a NULL value\n        **     for x.\n        **\n        **   + The optimizer code in where.c (the thing that decides which\n        **     index or indices to use) should place a different priority on \n        **     satisfying the 'ORDER BY' clause than it does in other cases.\n        **     Refer to code and comments in where.c for details.\n        */\n        ExprList *pMinMax = 0;\n        u8 flag = WHERE_ORDERBY_NORMAL;\n        \n        assert( p->pGroupBy==0 );\n        assert( flag==0 );\n        if( p->pHaving==0 ){\n          flag = minMaxQuery(&sAggInfo, &pMinMax);\n        }\n        assert( flag==0 || (pMinMax!=0 && pMinMax->nExpr==1) );\n\n        if( flag ){\n          pMinMax = sqlite3ExprListDup(db, pMinMax, 0);\n          pDel = pMinMax;\n          assert( db->mallocFailed || pMinMax!=0 );\n          if( !db->mallocFailed ){\n            pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN ?1:0;\n            pMinMax->a[0].pExpr->op = TK_COLUMN;\n          }\n        }\n  \n        /* This case runs if the aggregate has no GROUP BY clause.  The\n        ** processing is much simpler since there is only a single row\n        ** of output.\n        */\n        resetAccumulator(pParse, &sAggInfo);\n        pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMax,0,flag,0);\n        if( pWInfo==0 ){\n          sqlite3ExprListDelete(db, pDel);\n          goto select_end;\n        }\n        updateAccumulator(pParse, &sAggInfo);\n        assert( pMinMax==0 || pMinMax->nExpr==1 );\n        if( sqlite3WhereIsOrdered(pWInfo)>0 ){\n          sqlite3VdbeGoto(v, sqlite3WhereBreakLabel(pWInfo));\n          VdbeComment((v, \"%s() by index\",\n                (flag==WHERE_ORDERBY_MIN?\"min\":\"max\")));\n        }\n        sqlite3WhereEnd(pWInfo);\n        finalizeAggFunctions(pParse, &sAggInfo);\n      }\n\n      sSort.pOrderBy = 0;\n      sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);\n      selectInnerLoop(pParse, p, p->pEList, -1, 0, 0, \n                      pDest, addrEnd, addrEnd);\n      sqlite3ExprListDelete(db, pDel);\n    }\n    sqlite3VdbeResolveLabel(v, addrEnd);\n    \n  } /* endif aggregate query */\n\n  if( sDistinct.eTnctType==WHERE_DISTINCT_UNORDERED ){\n    explainTempTable(pParse, \"DISTINCT\");\n  }\n\n  /* If there is an ORDER BY clause, then we need to sort the results\n  ** and send them to the callback one by one.\n  */\n  if( sSort.pOrderBy ){\n    explainTempTable(pParse,\n                     sSort.nOBSat>0 ? \"RIGHT PART OF ORDER BY\":\"ORDER BY\");\n    generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest);\n  }\n\n  /* Jump here to skip this query\n  */\n  sqlite3VdbeResolveLabel(v, iEnd);\n\n  /* The SELECT has been coded. If there is an error in the Parse structure,\n  ** set the return code to 1. Otherwise 0. */\n  rc = (pParse->nErr>0);\n\n  /* Control jumps to here if an error is encountered above, or upon\n  ** successful coding of the SELECT.\n  */\nselect_end:\n  explainSetInteger(pParse->iSelectId, iRestoreSelectId);\n\n  /* Identify column names if results of the SELECT are to be output.\n  */\n  if( rc==SQLITE_OK && pDest->eDest==SRT_Output ){\n    generateColumnNames(pParse, pTabList, pEList);\n  }\n\n  sqlite3DbFree(db, sAggInfo.aCol);\n  sqlite3DbFree(db, sAggInfo.aFunc);\n#if SELECTTRACE_ENABLED\n  SELECTTRACE(1,pParse,p,(\"end processing\\n\"));\n  pParse->nSelectIndent--;\n#endif\n  return rc;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/sqlcipher.h",
    "content": "/* \n** SQLCipher\n** sqlcipher.h developed by Stephen Lombardo (Zetetic LLC) \n** sjlombardo at zetetic dot net\n** http://zetetic.net\n** \n** Copyright (c) 2008, ZETETIC LLC\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without\n** modification, are permitted provided that the following conditions are met:\n**     * Redistributions of source code must retain the above copyright\n**       notice, this list of conditions and the following disclaimer.\n**     * Redistributions in binary form must reproduce the above copyright\n**       notice, this list of conditions and the following disclaimer in the\n**       documentation and/or other materials provided with the distribution.\n**     * Neither the name of the ZETETIC LLC nor the\n**       names of its contributors may be used to endorse or promote products\n**       derived from this software without specific prior written permission.\n** \n** THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY\n** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n** DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY\n** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n**  \n*/\n/* BEGIN SQLCIPHER */\n#ifdef SQLITE_HAS_CODEC\n#ifndef SQLCIPHER_H\n#define SQLCIPHER_H\n\n\ntypedef struct {\n  int (*activate)(void *ctx);\n  int (*deactivate)(void *ctx);\n  const char* (*get_provider_name)(void *ctx);\n  int (*add_random)(void *ctx, void *buffer, int length);\n  int (*random)(void *ctx, void *buffer, int length);\n  int (*hmac)(void *ctx, unsigned char *hmac_key, int key_sz, unsigned char *in, int in_sz, unsigned char *in2, int in2_sz, unsigned char *out);\n  int (*kdf)(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key);\n  int (*cipher)(void *ctx, int mode, unsigned char *key, int key_sz, unsigned char *iv, unsigned char *in, int in_sz, unsigned char *out);\n  int (*set_cipher)(void *ctx, const char *cipher_name);\n  const char* (*get_cipher)(void *ctx);\n  int (*get_key_sz)(void *ctx);\n  int (*get_iv_sz)(void *ctx);\n  int (*get_block_sz)(void *ctx);\n  int (*get_hmac_sz)(void *ctx);\n  int (*ctx_copy)(void *target_ctx, void *source_ctx);\n  int (*ctx_cmp)(void *c1, void *c2);\n  int (*ctx_init)(void **ctx);\n  int (*ctx_free)(void **ctx);\n  int (*fips_status)(void *ctx);\n  const char* (*get_provider_version)(void *ctx);\n} sqlcipher_provider;\n\n/* provider interfaces */\nSQLITE_API int SQLITE_STDCALL sqlcipher_register_provider(sqlcipher_provider *p);\nSQLITE_API sqlcipher_provider* SQLITE_STDCALL sqlcipher_get_provider();\nSQLITE_API int SQLITE_STDCALL sqlcipher_register_custom_provider(const char *name, const sqlcipher_provider *p);\nSQLITE_API int SQLITE_STDCALL sqlcipher_unregister_custom_provider(const char *name);\nSQLITE_API const sqlcipher_provider* SQLITE_STDCALL sqlcipher_get_fallback_provider();\n\n#endif\n#endif\n/* END SQLCIPHER */\n\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/sqlite3ext.h",
    "content": "/*\n** 2006 June 7\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This header file defines the SQLite interface for use by\n** shared libraries that want to be imported as extensions into\n** an SQLite instance.  Shared libraries that intend to be loaded\n** as extensions by SQLite should #include this file instead of \n** sqlite3.h.\n*/\n#ifndef SQLITE3EXT_H\n#define SQLITE3EXT_H\n#include \"sqlite3.h\"\n#include \"sqlcipher.h\"\n\ntypedef struct sqlcipher_api_routines sqlcipher_api_routines;\ntypedef struct sqlite3_api_routines sqlite3_api_routines;\n\n/*\n** The following structure holds pointers to all of the SQLite API\n** routines.\n**\n** WARNING:  In order to maintain backwards compatibility, add new\n** interfaces to the end of this structure only.  If you insert new\n** interfaces in the middle of this structure, then older different\n** versions of SQLite will not be able to load each other's shared\n** libraries!\n*/\n#ifdef SQLITE_HAS_CODEC\nstruct sqlcipher_api_routines {\n  int (*register_provider)(sqlcipher_provider *p);\n  sqlcipher_provider* (*get_provider)();\n  int (*key)(sqlite3 *db, const void *pKey, int nKey);\n  int (*key_v2)(sqlite3 *db, const char *zDb, const void *pKey, int nKey);\n  int (*rekey)(sqlite3 *db, const void *pKey, int nKey);\n  int (*rekey_v2)(sqlite3 *db, const char *zDb, const void *pKey, int nKey);\n\n  int (*register_custom_provider)(const char *name, const sqlcipher_provider *p);\n  int (*unregister_custom_provider)(const char *name);\n  const sqlcipher_provider* (*get_fallback_provider)();\n};\n#endif\n\nstruct sqlite3_api_routines {\n  void * (*aggregate_context)(sqlite3_context*,int nBytes);\n  int  (*aggregate_count)(sqlite3_context*);\n  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));\n  int  (*bind_double)(sqlite3_stmt*,int,double);\n  int  (*bind_int)(sqlite3_stmt*,int,int);\n  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);\n  int  (*bind_null)(sqlite3_stmt*,int);\n  int  (*bind_parameter_count)(sqlite3_stmt*);\n  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);\n  const char * (*bind_parameter_name)(sqlite3_stmt*,int);\n  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));\n  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));\n  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);\n  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);\n  int  (*busy_timeout)(sqlite3*,int ms);\n  int  (*changes)(sqlite3*);\n  int  (*close)(sqlite3*);\n  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,\n                           int eTextRep,const char*));\n  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,\n                             int eTextRep,const void*));\n  const void * (*column_blob)(sqlite3_stmt*,int iCol);\n  int  (*column_bytes)(sqlite3_stmt*,int iCol);\n  int  (*column_bytes16)(sqlite3_stmt*,int iCol);\n  int  (*column_count)(sqlite3_stmt*pStmt);\n  const char * (*column_database_name)(sqlite3_stmt*,int);\n  const void * (*column_database_name16)(sqlite3_stmt*,int);\n  const char * (*column_decltype)(sqlite3_stmt*,int i);\n  const void * (*column_decltype16)(sqlite3_stmt*,int);\n  double  (*column_double)(sqlite3_stmt*,int iCol);\n  int  (*column_int)(sqlite3_stmt*,int iCol);\n  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);\n  const char * (*column_name)(sqlite3_stmt*,int);\n  const void * (*column_name16)(sqlite3_stmt*,int);\n  const char * (*column_origin_name)(sqlite3_stmt*,int);\n  const void * (*column_origin_name16)(sqlite3_stmt*,int);\n  const char * (*column_table_name)(sqlite3_stmt*,int);\n  const void * (*column_table_name16)(sqlite3_stmt*,int);\n  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);\n  const void * (*column_text16)(sqlite3_stmt*,int iCol);\n  int  (*column_type)(sqlite3_stmt*,int iCol);\n  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);\n  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);\n  int  (*complete)(const char*sql);\n  int  (*complete16)(const void*sql);\n  int  (*create_collation)(sqlite3*,const char*,int,void*,\n                           int(*)(void*,int,const void*,int,const void*));\n  int  (*create_collation16)(sqlite3*,const void*,int,void*,\n                             int(*)(void*,int,const void*,int,const void*));\n  int  (*create_function)(sqlite3*,const char*,int,int,void*,\n                          void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\n                          void (*xStep)(sqlite3_context*,int,sqlite3_value**),\n                          void (*xFinal)(sqlite3_context*));\n  int  (*create_function16)(sqlite3*,const void*,int,int,void*,\n                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\n                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),\n                            void (*xFinal)(sqlite3_context*));\n  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);\n  int  (*data_count)(sqlite3_stmt*pStmt);\n  sqlite3 * (*db_handle)(sqlite3_stmt*);\n  int (*declare_vtab)(sqlite3*,const char*);\n  int  (*enable_shared_cache)(int);\n  int  (*errcode)(sqlite3*db);\n  const char * (*errmsg)(sqlite3*);\n  const void * (*errmsg16)(sqlite3*);\n  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);\n  int  (*expired)(sqlite3_stmt*);\n  int  (*finalize)(sqlite3_stmt*pStmt);\n  void  (*free)(void*);\n  void  (*free_table)(char**result);\n  int  (*get_autocommit)(sqlite3*);\n  void * (*get_auxdata)(sqlite3_context*,int);\n  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);\n\n#ifdef SQLITE_HAS_CODEC\n  /* Was `int  (*global_recover)(void);`, but no longer used.\n     Replaced with sqlcipher api pointers. */\n  const struct sqlcipher_api_routines *sqlcipher;\n#else\n  int  (*global_recover)(void);\n#endif\n\n  void  (*interruptx)(sqlite3*);\n  sqlite_int64  (*last_insert_rowid)(sqlite3*);\n  const char * (*libversion)(void);\n  int  (*libversion_number)(void);\n  void *(*malloc)(int);\n  char * (*mprintf)(const char*,...);\n  int  (*open)(const char*,sqlite3**);\n  int  (*open16)(const void*,sqlite3**);\n  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);\n  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);\n  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);\n  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);\n  void *(*realloc)(void*,int);\n  int  (*reset)(sqlite3_stmt*pStmt);\n  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));\n  void  (*result_double)(sqlite3_context*,double);\n  void  (*result_error)(sqlite3_context*,const char*,int);\n  void  (*result_error16)(sqlite3_context*,const void*,int);\n  void  (*result_int)(sqlite3_context*,int);\n  void  (*result_int64)(sqlite3_context*,sqlite_int64);\n  void  (*result_null)(sqlite3_context*);\n  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));\n  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));\n  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));\n  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));\n  void  (*result_value)(sqlite3_context*,sqlite3_value*);\n  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);\n  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,\n                         const char*,const char*),void*);\n  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));\n  char * (*snprintf)(int,char*,const char*,...);\n  int  (*step)(sqlite3_stmt*);\n  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,\n                                char const**,char const**,int*,int*,int*);\n  void  (*thread_cleanup)(void);\n  int  (*total_changes)(sqlite3*);\n  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);\n  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);\n  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,\n                                         sqlite_int64),void*);\n  void * (*user_data)(sqlite3_context*);\n  const void * (*value_blob)(sqlite3_value*);\n  int  (*value_bytes)(sqlite3_value*);\n  int  (*value_bytes16)(sqlite3_value*);\n  double  (*value_double)(sqlite3_value*);\n  int  (*value_int)(sqlite3_value*);\n  sqlite_int64  (*value_int64)(sqlite3_value*);\n  int  (*value_numeric_type)(sqlite3_value*);\n  const unsigned char * (*value_text)(sqlite3_value*);\n  const void * (*value_text16)(sqlite3_value*);\n  const void * (*value_text16be)(sqlite3_value*);\n  const void * (*value_text16le)(sqlite3_value*);\n  int  (*value_type)(sqlite3_value*);\n  char *(*vmprintf)(const char*,va_list);\n  /* Added ??? */\n  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);\n  /* Added by 3.3.13 */\n  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);\n  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);\n  int (*clear_bindings)(sqlite3_stmt*);\n  /* Added by 3.4.1 */\n  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,\n                          void (*xDestroy)(void *));\n  /* Added by 3.5.0 */\n  int (*bind_zeroblob)(sqlite3_stmt*,int,int);\n  int (*blob_bytes)(sqlite3_blob*);\n  int (*blob_close)(sqlite3_blob*);\n  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,\n                   int,sqlite3_blob**);\n  int (*blob_read)(sqlite3_blob*,void*,int,int);\n  int (*blob_write)(sqlite3_blob*,const void*,int,int);\n  int (*create_collation_v2)(sqlite3*,const char*,int,void*,\n                             int(*)(void*,int,const void*,int,const void*),\n                             void(*)(void*));\n  int (*file_control)(sqlite3*,const char*,int,void*);\n  sqlite3_int64 (*memory_highwater)(int);\n  sqlite3_int64 (*memory_used)(void);\n  sqlite3_mutex *(*mutex_alloc)(int);\n  void (*mutex_enter)(sqlite3_mutex*);\n  void (*mutex_free)(sqlite3_mutex*);\n  void (*mutex_leave)(sqlite3_mutex*);\n  int (*mutex_try)(sqlite3_mutex*);\n  int (*open_v2)(const char*,sqlite3**,int,const char*);\n  int (*release_memory)(int);\n  void (*result_error_nomem)(sqlite3_context*);\n  void (*result_error_toobig)(sqlite3_context*);\n  int (*sleep)(int);\n  void (*soft_heap_limit)(int);\n  sqlite3_vfs *(*vfs_find)(const char*);\n  int (*vfs_register)(sqlite3_vfs*,int);\n  int (*vfs_unregister)(sqlite3_vfs*);\n  int (*xthreadsafe)(void);\n  void (*result_zeroblob)(sqlite3_context*,int);\n  void (*result_error_code)(sqlite3_context*,int);\n  int (*test_control)(int, ...);\n  void (*randomness)(int,void*);\n  sqlite3 *(*context_db_handle)(sqlite3_context*);\n  int (*extended_result_codes)(sqlite3*,int);\n  int (*limit)(sqlite3*,int,int);\n  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);\n  const char *(*sql)(sqlite3_stmt*);\n  int (*status)(int,int*,int*,int);\n  int (*backup_finish)(sqlite3_backup*);\n  sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);\n  int (*backup_pagecount)(sqlite3_backup*);\n  int (*backup_remaining)(sqlite3_backup*);\n  int (*backup_step)(sqlite3_backup*,int);\n  const char *(*compileoption_get)(int);\n  int (*compileoption_used)(const char*);\n  int (*create_function_v2)(sqlite3*,const char*,int,int,void*,\n                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),\n                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),\n                            void (*xFinal)(sqlite3_context*),\n                            void(*xDestroy)(void*));\n  int (*db_config)(sqlite3*,int,...);\n  sqlite3_mutex *(*db_mutex)(sqlite3*);\n  int (*db_status)(sqlite3*,int,int*,int*,int);\n  int (*extended_errcode)(sqlite3*);\n  void (*log)(int,const char*,...);\n  sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);\n  const char *(*sourceid)(void);\n  int (*stmt_status)(sqlite3_stmt*,int,int);\n  int (*strnicmp)(const char*,const char*,int);\n  int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);\n  int (*wal_autocheckpoint)(sqlite3*,int);\n  int (*wal_checkpoint)(sqlite3*,const char*);\n  void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);\n  int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);\n  int (*vtab_config)(sqlite3*,int op,...);\n  int (*vtab_on_conflict)(sqlite3*);\n  /* Version 3.7.16 and later */\n  int (*close_v2)(sqlite3*);\n  const char *(*db_filename)(sqlite3*,const char*);\n  int (*db_readonly)(sqlite3*,const char*);\n  int (*db_release_memory)(sqlite3*);\n  const char *(*errstr)(int);\n  int (*stmt_busy)(sqlite3_stmt*);\n  int (*stmt_readonly)(sqlite3_stmt*);\n  int (*stricmp)(const char*,const char*);\n  int (*uri_boolean)(const char*,const char*,int);\n  sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);\n  const char *(*uri_parameter)(const char*,const char*);\n  char *(*vsnprintf)(int,char*,const char*,va_list);\n  int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);\n  /* Version 3.8.7 and later */\n  int (*auto_extension)(void(*)(void));\n  int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,\n                     void(*)(void*));\n  int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,\n                      void(*)(void*),unsigned char);\n  int (*cancel_auto_extension)(void(*)(void));\n  int (*load_extension)(sqlite3*,const char*,const char*,char**);\n  void *(*malloc64)(sqlite3_uint64);\n  sqlite3_uint64 (*msize)(void*);\n  void *(*realloc64)(void*,sqlite3_uint64);\n  void (*reset_auto_extension)(void);\n  void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,\n                        void(*)(void*));\n  void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,\n                         void(*)(void*), unsigned char);\n  int (*strglob)(const char*,const char*);\n  /* Version 3.8.11 and later */\n  sqlite3_value *(*value_dup)(const sqlite3_value*);\n  void (*value_free)(sqlite3_value*);\n  int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);\n  int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);\n  /* Version 3.9.0 and later */\n  unsigned int (*value_subtype)(sqlite3_value*);\n  void (*result_subtype)(sqlite3_context*,unsigned int);\n  /* Version 3.10.0 and later */\n  int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);\n  int (*strlike)(const char*,const char*,unsigned int);\n  int (*db_cacheflush)(sqlite3*);\n  /* Version 3.12.0 and later */\n  int (*system_errno)(sqlite3*);\n  /* Version 3.14.0 and later */\n  int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);\n  char *(*expanded_sql)(sqlite3_stmt*);\n};\n\n/*\n** This is the function signature used for all extension entry points.  It\n** is also defined in the file \"loadext.c\".\n*/\ntypedef int (*sqlite3_loadext_entry)(\n  sqlite3 *db,                       /* Handle to the database. */\n  char **pzErrMsg,                   /* Used to set error string on failure. */\n  const sqlite3_api_routines *pThunk /* Extension API function pointers. */\n);\n\n/*\n** The following macros redefine the API routines so that they are\n** redirected through the global sqlite3_api structure.\n**\n** This header file is also used by the loadext.c source file\n** (part of the main SQLite library - not an extension) so that\n** it can get access to the sqlite3_api_routines structure\n** definition.  But the main library does not want to redefine\n** the API.  So the redefinition macros are only valid if the\n** SQLITE_CORE macros is undefined.\n*/\n#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)\n#define sqlite3_aggregate_context      sqlite3_api->aggregate_context\n#ifndef SQLITE_OMIT_DEPRECATED\n#define sqlite3_aggregate_count        sqlite3_api->aggregate_count\n#endif\n#define sqlite3_bind_blob              sqlite3_api->bind_blob\n#define sqlite3_bind_double            sqlite3_api->bind_double\n#define sqlite3_bind_int               sqlite3_api->bind_int\n#define sqlite3_bind_int64             sqlite3_api->bind_int64\n#define sqlite3_bind_null              sqlite3_api->bind_null\n#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count\n#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index\n#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name\n#define sqlite3_bind_text              sqlite3_api->bind_text\n#define sqlite3_bind_text16            sqlite3_api->bind_text16\n#define sqlite3_bind_value             sqlite3_api->bind_value\n#define sqlite3_busy_handler           sqlite3_api->busy_handler\n#define sqlite3_busy_timeout           sqlite3_api->busy_timeout\n#define sqlite3_changes                sqlite3_api->changes\n#define sqlite3_close                  sqlite3_api->close\n#define sqlite3_collation_needed       sqlite3_api->collation_needed\n#define sqlite3_collation_needed16     sqlite3_api->collation_needed16\n#define sqlite3_column_blob            sqlite3_api->column_blob\n#define sqlite3_column_bytes           sqlite3_api->column_bytes\n#define sqlite3_column_bytes16         sqlite3_api->column_bytes16\n#define sqlite3_column_count           sqlite3_api->column_count\n#define sqlite3_column_database_name   sqlite3_api->column_database_name\n#define sqlite3_column_database_name16 sqlite3_api->column_database_name16\n#define sqlite3_column_decltype        sqlite3_api->column_decltype\n#define sqlite3_column_decltype16      sqlite3_api->column_decltype16\n#define sqlite3_column_double          sqlite3_api->column_double\n#define sqlite3_column_int             sqlite3_api->column_int\n#define sqlite3_column_int64           sqlite3_api->column_int64\n#define sqlite3_column_name            sqlite3_api->column_name\n#define sqlite3_column_name16          sqlite3_api->column_name16\n#define sqlite3_column_origin_name     sqlite3_api->column_origin_name\n#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16\n#define sqlite3_column_table_name      sqlite3_api->column_table_name\n#define sqlite3_column_table_name16    sqlite3_api->column_table_name16\n#define sqlite3_column_text            sqlite3_api->column_text\n#define sqlite3_column_text16          sqlite3_api->column_text16\n#define sqlite3_column_type            sqlite3_api->column_type\n#define sqlite3_column_value           sqlite3_api->column_value\n#define sqlite3_commit_hook            sqlite3_api->commit_hook\n#define sqlite3_complete               sqlite3_api->complete\n#define sqlite3_complete16             sqlite3_api->complete16\n#define sqlite3_create_collation       sqlite3_api->create_collation\n#define sqlite3_create_collation16     sqlite3_api->create_collation16\n#define sqlite3_create_function        sqlite3_api->create_function\n#define sqlite3_create_function16      sqlite3_api->create_function16\n#define sqlite3_create_module          sqlite3_api->create_module\n#define sqlite3_create_module_v2       sqlite3_api->create_module_v2\n#define sqlite3_data_count             sqlite3_api->data_count\n#define sqlite3_db_handle              sqlite3_api->db_handle\n#define sqlite3_declare_vtab           sqlite3_api->declare_vtab\n#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache\n#define sqlite3_errcode                sqlite3_api->errcode\n#define sqlite3_errmsg                 sqlite3_api->errmsg\n#define sqlite3_errmsg16               sqlite3_api->errmsg16\n#define sqlite3_exec                   sqlite3_api->exec\n#ifndef SQLITE_OMIT_DEPRECATED\n#define sqlite3_expired                sqlite3_api->expired\n#endif\n#define sqlite3_finalize               sqlite3_api->finalize\n#define sqlite3_free                   sqlite3_api->free\n#define sqlite3_free_table             sqlite3_api->free_table\n#define sqlite3_get_autocommit         sqlite3_api->get_autocommit\n#define sqlite3_get_auxdata            sqlite3_api->get_auxdata\n#define sqlite3_get_table              sqlite3_api->get_table\n#ifndef SQLITE_OMIT_DEPRECATED\n#define sqlite3_global_recover         sqlite3_api->global_recover\n#endif\n#define sqlite3_interrupt              sqlite3_api->interruptx\n#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid\n#define sqlite3_libversion             sqlite3_api->libversion\n#define sqlite3_libversion_number      sqlite3_api->libversion_number\n#define sqlite3_malloc                 sqlite3_api->malloc\n#define sqlite3_mprintf                sqlite3_api->mprintf\n#define sqlite3_open                   sqlite3_api->open\n#define sqlite3_open16                 sqlite3_api->open16\n#define sqlite3_prepare                sqlite3_api->prepare\n#define sqlite3_prepare16              sqlite3_api->prepare16\n#define sqlite3_prepare_v2             sqlite3_api->prepare_v2\n#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2\n#define sqlite3_profile                sqlite3_api->profile\n#define sqlite3_progress_handler       sqlite3_api->progress_handler\n#define sqlite3_realloc                sqlite3_api->realloc\n#define sqlite3_reset                  sqlite3_api->reset\n#define sqlite3_result_blob            sqlite3_api->result_blob\n#define sqlite3_result_double          sqlite3_api->result_double\n#define sqlite3_result_error           sqlite3_api->result_error\n#define sqlite3_result_error16         sqlite3_api->result_error16\n#define sqlite3_result_int             sqlite3_api->result_int\n#define sqlite3_result_int64           sqlite3_api->result_int64\n#define sqlite3_result_null            sqlite3_api->result_null\n#define sqlite3_result_text            sqlite3_api->result_text\n#define sqlite3_result_text16          sqlite3_api->result_text16\n#define sqlite3_result_text16be        sqlite3_api->result_text16be\n#define sqlite3_result_text16le        sqlite3_api->result_text16le\n#define sqlite3_result_value           sqlite3_api->result_value\n#define sqlite3_rollback_hook          sqlite3_api->rollback_hook\n#define sqlite3_set_authorizer         sqlite3_api->set_authorizer\n#define sqlite3_set_auxdata            sqlite3_api->set_auxdata\n#define sqlite3_snprintf               sqlite3_api->snprintf\n#define sqlite3_step                   sqlite3_api->step\n#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata\n#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup\n#define sqlite3_total_changes          sqlite3_api->total_changes\n#define sqlite3_trace                  sqlite3_api->trace\n#ifndef SQLITE_OMIT_DEPRECATED\n#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings\n#endif\n#define sqlite3_update_hook            sqlite3_api->update_hook\n#define sqlite3_user_data              sqlite3_api->user_data\n#define sqlite3_value_blob             sqlite3_api->value_blob\n#define sqlite3_value_bytes            sqlite3_api->value_bytes\n#define sqlite3_value_bytes16          sqlite3_api->value_bytes16\n#define sqlite3_value_double           sqlite3_api->value_double\n#define sqlite3_value_int              sqlite3_api->value_int\n#define sqlite3_value_int64            sqlite3_api->value_int64\n#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type\n#define sqlite3_value_text             sqlite3_api->value_text\n#define sqlite3_value_text16           sqlite3_api->value_text16\n#define sqlite3_value_text16be         sqlite3_api->value_text16be\n#define sqlite3_value_text16le         sqlite3_api->value_text16le\n#define sqlite3_value_type             sqlite3_api->value_type\n#define sqlite3_vmprintf               sqlite3_api->vmprintf\n#define sqlite3_vsnprintf              sqlite3_api->vsnprintf\n#define sqlite3_overload_function      sqlite3_api->overload_function\n#define sqlite3_prepare_v2             sqlite3_api->prepare_v2\n#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2\n#define sqlite3_clear_bindings         sqlite3_api->clear_bindings\n#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob\n#define sqlite3_blob_bytes             sqlite3_api->blob_bytes\n#define sqlite3_blob_close             sqlite3_api->blob_close\n#define sqlite3_blob_open              sqlite3_api->blob_open\n#define sqlite3_blob_read              sqlite3_api->blob_read\n#define sqlite3_blob_write             sqlite3_api->blob_write\n#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2\n#define sqlite3_file_control           sqlite3_api->file_control\n#define sqlite3_memory_highwater       sqlite3_api->memory_highwater\n#define sqlite3_memory_used            sqlite3_api->memory_used\n#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc\n#define sqlite3_mutex_enter            sqlite3_api->mutex_enter\n#define sqlite3_mutex_free             sqlite3_api->mutex_free\n#define sqlite3_mutex_leave            sqlite3_api->mutex_leave\n#define sqlite3_mutex_try              sqlite3_api->mutex_try\n#define sqlite3_open_v2                sqlite3_api->open_v2\n#define sqlite3_release_memory         sqlite3_api->release_memory\n#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem\n#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig\n#define sqlite3_sleep                  sqlite3_api->sleep\n#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit\n#define sqlite3_vfs_find               sqlite3_api->vfs_find\n#define sqlite3_vfs_register           sqlite3_api->vfs_register\n#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister\n#define sqlite3_threadsafe             sqlite3_api->xthreadsafe\n#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob\n#define sqlite3_result_error_code      sqlite3_api->result_error_code\n#define sqlite3_test_control           sqlite3_api->test_control\n#define sqlite3_randomness             sqlite3_api->randomness\n#define sqlite3_context_db_handle      sqlite3_api->context_db_handle\n#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes\n#define sqlite3_limit                  sqlite3_api->limit\n#define sqlite3_next_stmt              sqlite3_api->next_stmt\n#define sqlite3_sql                    sqlite3_api->sql\n#define sqlite3_status                 sqlite3_api->status\n#define sqlite3_backup_finish          sqlite3_api->backup_finish\n#define sqlite3_backup_init            sqlite3_api->backup_init\n#define sqlite3_backup_pagecount       sqlite3_api->backup_pagecount\n#define sqlite3_backup_remaining       sqlite3_api->backup_remaining\n#define sqlite3_backup_step            sqlite3_api->backup_step\n#define sqlite3_compileoption_get      sqlite3_api->compileoption_get\n#define sqlite3_compileoption_used     sqlite3_api->compileoption_used\n#define sqlite3_create_function_v2     sqlite3_api->create_function_v2\n#define sqlite3_db_config              sqlite3_api->db_config\n#define sqlite3_db_mutex               sqlite3_api->db_mutex\n#define sqlite3_db_status              sqlite3_api->db_status\n#define sqlite3_extended_errcode       sqlite3_api->extended_errcode\n#define sqlite3_log                    sqlite3_api->log\n#define sqlite3_soft_heap_limit64      sqlite3_api->soft_heap_limit64\n#define sqlite3_sourceid               sqlite3_api->sourceid\n#define sqlite3_stmt_status            sqlite3_api->stmt_status\n#define sqlite3_strnicmp               sqlite3_api->strnicmp\n#define sqlite3_unlock_notify          sqlite3_api->unlock_notify\n#define sqlite3_wal_autocheckpoint     sqlite3_api->wal_autocheckpoint\n#define sqlite3_wal_checkpoint         sqlite3_api->wal_checkpoint\n#define sqlite3_wal_hook               sqlite3_api->wal_hook\n#define sqlite3_blob_reopen            sqlite3_api->blob_reopen\n#define sqlite3_vtab_config            sqlite3_api->vtab_config\n#define sqlite3_vtab_on_conflict       sqlite3_api->vtab_on_conflict\n/* Version 3.7.16 and later */\n#define sqlite3_close_v2               sqlite3_api->close_v2\n#define sqlite3_db_filename            sqlite3_api->db_filename\n#define sqlite3_db_readonly            sqlite3_api->db_readonly\n#define sqlite3_db_release_memory      sqlite3_api->db_release_memory\n#define sqlite3_errstr                 sqlite3_api->errstr\n#define sqlite3_stmt_busy              sqlite3_api->stmt_busy\n#define sqlite3_stmt_readonly          sqlite3_api->stmt_readonly\n#define sqlite3_stricmp                sqlite3_api->stricmp\n#define sqlite3_uri_boolean            sqlite3_api->uri_boolean\n#define sqlite3_uri_int64              sqlite3_api->uri_int64\n#define sqlite3_uri_parameter          sqlite3_api->uri_parameter\n#define sqlite3_uri_vsnprintf          sqlite3_api->vsnprintf\n#define sqlite3_wal_checkpoint_v2      sqlite3_api->wal_checkpoint_v2\n/* Version 3.8.7 and later */\n#define sqlite3_auto_extension         sqlite3_api->auto_extension\n#define sqlite3_bind_blob64            sqlite3_api->bind_blob64\n#define sqlite3_bind_text64            sqlite3_api->bind_text64\n#define sqlite3_cancel_auto_extension  sqlite3_api->cancel_auto_extension\n#define sqlite3_load_extension         sqlite3_api->load_extension\n#define sqlite3_malloc64               sqlite3_api->malloc64\n#define sqlite3_msize                  sqlite3_api->msize\n#define sqlite3_realloc64              sqlite3_api->realloc64\n#define sqlite3_reset_auto_extension   sqlite3_api->reset_auto_extension\n#define sqlite3_result_blob64          sqlite3_api->result_blob64\n#define sqlite3_result_text64          sqlite3_api->result_text64\n#define sqlite3_strglob                sqlite3_api->strglob\n/* Version 3.8.11 and later */\n#define sqlite3_value_dup              sqlite3_api->value_dup\n#define sqlite3_value_free             sqlite3_api->value_free\n#define sqlite3_result_zeroblob64      sqlite3_api->result_zeroblob64\n#define sqlite3_bind_zeroblob64        sqlite3_api->bind_zeroblob64\n/* Version 3.9.0 and later */\n#define sqlite3_value_subtype          sqlite3_api->value_subtype\n#define sqlite3_result_subtype         sqlite3_api->result_subtype\n/* Version 3.10.0 and later */\n#define sqlite3_status64               sqlite3_api->status64\n#define sqlite3_strlike                sqlite3_api->strlike\n#define sqlite3_db_cacheflush          sqlite3_api->db_cacheflush\n/* Version 3.12.0 and later */\n#define sqlite3_system_errno           sqlite3_api->system_errno\n/* Version 3.14.0 and later */\n#define sqlite3_trace_v2               sqlite3_api->trace_v2\n#define sqlite3_expanded_sql           sqlite3_api->expanded_sql\n\n/* SQLCipher APIs */\n#ifdef SQLITE_HAS_CODEC\n#define sqlite3_key                    sqlite3_api->sqlcipher->key\n#define sqlite3_key_v2                 sqlite3_api->sqlcipher->key_v2\n#define sqlite3_rekey                  sqlite3_api->sqlcipher->rekey\n#define sqlite3_rekey_v2               sqlite3_api->sqlcipher->rekey_v2\n#define sqlcipher_register_provider    sqlite3_api->sqlcipher->register_provider\n#define sqlcipher_get_provider         sqlite3_api->sqlcipher->get_provider\n#define sqlcipher_register_custom_provider    sqlite3_api->sqlcipher->register_custom_provider\n#define sqlcipher_unregister_custom_provider  sqlite3_api->sqlcipher->unregister_custom_provider\n#define sqlcipher_get_fallback_provider       sqlite3_api->sqlcipher->get_fallback_provider\n#endif\n\n#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */\n\n#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)\n  /* This case when the file really is being compiled as a loadable \n  ** extension */\n# define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;\n# define SQLITE_EXTENSION_INIT2(v)  sqlite3_api=v;\n# define SQLITE_EXTENSION_INIT3     \\\n    extern const sqlite3_api_routines *sqlite3_api;\n#else\n  /* This case when the file is being statically linked into the \n  ** application */\n# define SQLITE_EXTENSION_INIT1     /*no-op*/\n# define SQLITE_EXTENSION_INIT2(v)  (void)v; /* unused parameter */\n# define SQLITE_EXTENSION_INIT3     /*no-op*/\n#endif\n\n#endif /* SQLITE3EXT_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/sqliteInt.h",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Internal interface definitions for SQLite.\n**\n*/\n#ifndef SQLITEINT_H\n#define SQLITEINT_H\n\n/* Special Comments:\n**\n** Some comments have special meaning to the tools that measure test\n** coverage:\n**\n**    NO_TEST                     - The branches on this line are not\n**                                  measured by branch coverage.  This is\n**                                  used on lines of code that actually\n**                                  implement parts of coverage testing.\n**\n**    OPTIMIZATION-IF-TRUE        - This branch is allowed to alway be false\n**                                  and the correct answer is still obtained,\n**                                  though perhaps more slowly.\n**\n**    OPTIMIZATION-IF-FALSE       - This branch is allowed to alway be true\n**                                  and the correct answer is still obtained,\n**                                  though perhaps more slowly.\n**\n**    PREVENTS-HARMLESS-OVERREAD  - This branch prevents a buffer overread\n**                                  that would be harmless and undetectable\n**                                  if it did occur.  \n**\n** In all cases, the special comment must be enclosed in the usual\n** slash-asterisk...asterisk-slash comment marks, with no spaces between the \n** asterisks and the comment text.\n*/\n\n/*\n** Make sure the Tcl calling convention macro is defined.  This macro is\n** only used by test code and Tcl integration code.\n*/\n#ifndef SQLITE_TCLAPI\n#  define SQLITE_TCLAPI\n#endif\n\n/*\n** Make sure that rand_s() is available on Windows systems with MSVC 2005\n** or higher.\n*/\n#if defined(_MSC_VER) && _MSC_VER>=1400\n#  define _CRT_RAND_S\n#endif\n\n/*\n** Include the header file used to customize the compiler options for MSVC.\n** This should be done first so that it can successfully prevent spurious\n** compiler warnings due to subsequent content in this file and other files\n** that are included by this file.\n*/\n#include \"msvc.h\"\n\n/*\n** Special setup for VxWorks\n*/\n#include \"vxworks.h\"\n\n/*\n** These #defines should enable >2GB file support on POSIX if the\n** underlying operating system supports it.  If the OS lacks\n** large file support, or if the OS is windows, these should be no-ops.\n**\n** Ticket #2739:  The _LARGEFILE_SOURCE macro must appear before any\n** system #includes.  Hence, this block of code must be the very first\n** code in all source files.\n**\n** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch\n** on the compiler command line.  This is necessary if you are compiling\n** on a recent machine (ex: Red Hat 7.2) but you want your code to work\n** on an older machine (ex: Red Hat 6.0).  If you compile on Red Hat 7.2\n** without this option, LFS is enable.  But LFS does not exist in the kernel\n** in Red Hat 6.0, so the code won't work.  Hence, for maximum binary\n** portability you should omit LFS.\n**\n** The previous paragraph was written in 2005.  (This paragraph is written\n** on 2008-11-28.) These days, all Linux kernels support large files, so\n** you should probably leave LFS enabled.  But some embedded platforms might\n** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful.\n**\n** Similar is true for Mac OS X.  LFS is only supported on Mac OS X 9 and later.\n*/\n#ifndef SQLITE_DISABLE_LFS\n# define _LARGE_FILE       1\n# ifndef _FILE_OFFSET_BITS\n#   define _FILE_OFFSET_BITS 64\n# endif\n# define _LARGEFILE_SOURCE 1\n#endif\n\n/* What version of GCC is being used.  0 means GCC is not being used */\n#ifdef __GNUC__\n# define GCC_VERSION (__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)\n#else\n# define GCC_VERSION 0\n#endif\n\n/* Needed for various definitions... */\n#if defined(__GNUC__) && !defined(_GNU_SOURCE)\n# define _GNU_SOURCE\n#endif\n\n#if defined(__OpenBSD__) && !defined(_BSD_SOURCE)\n# define _BSD_SOURCE\n#endif\n\n/*\n** For MinGW, check to see if we can include the header file containing its\n** version information, among other things.  Normally, this internal MinGW\n** header file would [only] be included automatically by other MinGW header\n** files; however, the contained version information is now required by this\n** header file to work around binary compatibility issues (see below) and\n** this is the only known way to reliably obtain it.  This entire #if block\n** would be completely unnecessary if there was any other way of detecting\n** MinGW via their preprocessor (e.g. if they customized their GCC to define\n** some MinGW-specific macros).  When compiling for MinGW, either the\n** _HAVE_MINGW_H or _HAVE__MINGW_H (note the extra underscore) macro must be\n** defined; otherwise, detection of conditions specific to MinGW will be\n** disabled.\n*/\n#if defined(_HAVE_MINGW_H)\n# include \"mingw.h\"\n#elif defined(_HAVE__MINGW_H)\n# include \"_mingw.h\"\n#endif\n\n/*\n** For MinGW version 4.x (and higher), check to see if the _USE_32BIT_TIME_T\n** define is required to maintain binary compatibility with the MSVC runtime\n** library in use (e.g. for Windows XP).\n*/\n#if !defined(_USE_32BIT_TIME_T) && !defined(_USE_64BIT_TIME_T) && \\\n    defined(_WIN32) && !defined(_WIN64) && \\\n    defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION >= 4 && \\\n    defined(__MSVCRT__)\n# define _USE_32BIT_TIME_T\n#endif\n\n/* The public SQLite interface.  The _FILE_OFFSET_BITS macro must appear\n** first in QNX.  Also, the _USE_32BIT_TIME_T macro must appear first for\n** MinGW.\n*/\n#include \"sqlite3.h\"\n\n/*\n** Include the configuration header output by 'configure' if we're using the\n** autoconf-based build\n*/\n#ifdef _HAVE_SQLITE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include \"sqliteLimit.h\"\n\n/* Disable nuisance warnings on Borland compilers */\n#if defined(__BORLANDC__)\n#pragma warn -rch /* unreachable code */\n#pragma warn -ccc /* Condition is always true or false */\n#pragma warn -aus /* Assigned value is never used */\n#pragma warn -csu /* Comparing signed and unsigned */\n#pragma warn -spa /* Suspicious pointer arithmetic */\n#endif\n\n/*\n** Include standard header files as necessary\n*/\n#ifdef HAVE_STDINT_H\n#include <stdint.h>\n#endif\n#ifdef HAVE_INTTYPES_H\n#include <inttypes.h>\n#endif\n\n/*\n** The following macros are used to cast pointers to integers and\n** integers to pointers.  The way you do this varies from one compiler\n** to the next, so we have developed the following set of #if statements\n** to generate appropriate macros for a wide range of compilers.\n**\n** The correct \"ANSI\" way to do this is to use the intptr_t type.\n** Unfortunately, that typedef is not available on all compilers, or\n** if it is available, it requires an #include of specific headers\n** that vary from one machine to the next.\n**\n** Ticket #3860:  The llvm-gcc-4.2 compiler from Apple chokes on\n** the ((void*)&((char*)0)[X]) construct.  But MSVC chokes on ((void*)(X)).\n** So we have to define the macros in different ways depending on the\n** compiler.\n*/\n#if defined(__PTRDIFF_TYPE__)  /* This case should work for GCC */\n# define SQLITE_INT_TO_PTR(X)  ((void*)(__PTRDIFF_TYPE__)(X))\n# define SQLITE_PTR_TO_INT(X)  ((int)(__PTRDIFF_TYPE__)(X))\n#elif !defined(__GNUC__)       /* Works for compilers other than LLVM */\n# define SQLITE_INT_TO_PTR(X)  ((void*)&((char*)0)[X])\n# define SQLITE_PTR_TO_INT(X)  ((int)(((char*)X)-(char*)0))\n#elif defined(HAVE_STDINT_H)   /* Use this case if we have ANSI headers */\n# define SQLITE_INT_TO_PTR(X)  ((void*)(intptr_t)(X))\n# define SQLITE_PTR_TO_INT(X)  ((int)(intptr_t)(X))\n#else                          /* Generates a warning - but it always works */\n# define SQLITE_INT_TO_PTR(X)  ((void*)(X))\n# define SQLITE_PTR_TO_INT(X)  ((int)(X))\n#endif\n\n/*\n** A macro to hint to the compiler that a function should not be\n** inlined.\n*/\n#if defined(__GNUC__)\n#  define SQLITE_NOINLINE  __attribute__((noinline))\n#elif defined(_MSC_VER) && _MSC_VER>=1310\n#  define SQLITE_NOINLINE  __declspec(noinline)\n#else\n#  define SQLITE_NOINLINE\n#endif\n\n/*\n** Make sure that the compiler intrinsics we desire are enabled when\n** compiling with an appropriate version of MSVC unless prevented by\n** the SQLITE_DISABLE_INTRINSIC define.\n*/\n#if !defined(SQLITE_DISABLE_INTRINSIC)\n#  if defined(_MSC_VER) && _MSC_VER>=1400\n#    if !defined(_WIN32_WCE)\n#      include <intrin.h>\n#      pragma intrinsic(_byteswap_ushort)\n#      pragma intrinsic(_byteswap_ulong)\n#      pragma intrinsic(_ReadWriteBarrier)\n#    else\n#      include <cmnintrin.h>\n#    endif\n#  endif\n#endif\n\n/*\n** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2.\n** 0 means mutexes are permanently disable and the library is never\n** threadsafe.  1 means the library is serialized which is the highest\n** level of threadsafety.  2 means the library is multithreaded - multiple\n** threads can use SQLite as long as no two threads try to use the same\n** database connection at the same time.\n**\n** Older versions of SQLite used an optional THREADSAFE macro.\n** We support that for legacy.\n*/\n#if !defined(SQLITE_THREADSAFE)\n# if defined(THREADSAFE)\n#   define SQLITE_THREADSAFE THREADSAFE\n# else\n#   define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */\n# endif\n#endif\n\n/*\n** Powersafe overwrite is on by default.  But can be turned off using\n** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option.\n*/\n#ifndef SQLITE_POWERSAFE_OVERWRITE\n# define SQLITE_POWERSAFE_OVERWRITE 1\n#endif\n\n/*\n** EVIDENCE-OF: R-25715-37072 Memory allocation statistics are enabled by\n** default unless SQLite is compiled with SQLITE_DEFAULT_MEMSTATUS=0 in\n** which case memory allocation statistics are disabled by default.\n*/\n#if !defined(SQLITE_DEFAULT_MEMSTATUS)\n# define SQLITE_DEFAULT_MEMSTATUS 1\n#endif\n\n/*\n** Exactly one of the following macros must be defined in order to\n** specify which memory allocation subsystem to use.\n**\n**     SQLITE_SYSTEM_MALLOC          // Use normal system malloc()\n**     SQLITE_WIN32_MALLOC           // Use Win32 native heap API\n**     SQLITE_ZERO_MALLOC            // Use a stub allocator that always fails\n**     SQLITE_MEMDEBUG               // Debugging version of system malloc()\n**\n** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the\n** assert() macro is enabled, each call into the Win32 native heap subsystem\n** will cause HeapValidate to be called.  If heap validation should fail, an\n** assertion will be triggered.\n**\n** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as\n** the default.\n*/\n#if defined(SQLITE_SYSTEM_MALLOC) \\\n  + defined(SQLITE_WIN32_MALLOC) \\\n  + defined(SQLITE_ZERO_MALLOC) \\\n  + defined(SQLITE_MEMDEBUG)>1\n# error \"Two or more of the following compile-time configuration options\\\n are defined but at most one is allowed:\\\n SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG,\\\n SQLITE_ZERO_MALLOC\"\n#endif\n#if defined(SQLITE_SYSTEM_MALLOC) \\\n  + defined(SQLITE_WIN32_MALLOC) \\\n  + defined(SQLITE_ZERO_MALLOC) \\\n  + defined(SQLITE_MEMDEBUG)==0\n# define SQLITE_SYSTEM_MALLOC 1\n#endif\n\n/*\n** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the\n** sizes of memory allocations below this value where possible.\n*/\n#if !defined(SQLITE_MALLOC_SOFT_LIMIT)\n# define SQLITE_MALLOC_SOFT_LIMIT 1024\n#endif\n\n/*\n** We need to define _XOPEN_SOURCE as follows in order to enable\n** recursive mutexes on most Unix systems and fchmod() on OpenBSD.\n** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit\n** it.\n*/\n#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)\n#  define _XOPEN_SOURCE 600\n#endif\n\n/*\n** NDEBUG and SQLITE_DEBUG are opposites.  It should always be true that\n** defined(NDEBUG)==!defined(SQLITE_DEBUG).  If this is not currently true,\n** make it true by defining or undefining NDEBUG.\n**\n** Setting NDEBUG makes the code smaller and faster by disabling the\n** assert() statements in the code.  So we want the default action\n** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG\n** is set.  Thus NDEBUG becomes an opt-in rather than an opt-out\n** feature.\n*/\n#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)\n# define NDEBUG 1\n#endif\n#if defined(NDEBUG) && defined(SQLITE_DEBUG)\n# undef NDEBUG\n#endif\n\n/*\n** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on.\n*/\n#if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG)\n# define SQLITE_ENABLE_EXPLAIN_COMMENTS 1\n#endif\n\n/*\n** The testcase() macro is used to aid in coverage testing.  When\n** doing coverage testing, the condition inside the argument to\n** testcase() must be evaluated both true and false in order to\n** get full branch coverage.  The testcase() macro is inserted\n** to help ensure adequate test coverage in places where simple\n** condition/decision coverage is inadequate.  For example, testcase()\n** can be used to make sure boundary values are tested.  For\n** bitmask tests, testcase() can be used to make sure each bit\n** is significant and used at least once.  On switch statements\n** where multiple cases go to the same block of code, testcase()\n** can insure that all cases are evaluated.\n**\n*/\n#ifdef SQLITE_COVERAGE_TEST\n  void sqlite3Coverage(int);\n# define testcase(X)  if( X ){ sqlite3Coverage(__LINE__); }\n#else\n# define testcase(X)\n#endif\n\n/*\n** The TESTONLY macro is used to enclose variable declarations or\n** other bits of code that are needed to support the arguments\n** within testcase() and assert() macros.\n*/\n#if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST)\n# define TESTONLY(X)  X\n#else\n# define TESTONLY(X)\n#endif\n\n/*\n** Sometimes we need a small amount of code such as a variable initialization\n** to setup for a later assert() statement.  We do not want this code to\n** appear when assert() is disabled.  The following macro is therefore\n** used to contain that setup code.  The \"VVA\" acronym stands for\n** \"Verification, Validation, and Accreditation\".  In other words, the\n** code within VVA_ONLY() will only run during verification processes.\n*/\n#ifndef NDEBUG\n# define VVA_ONLY(X)  X\n#else\n# define VVA_ONLY(X)\n#endif\n\n/*\n** The ALWAYS and NEVER macros surround boolean expressions which\n** are intended to always be true or false, respectively.  Such\n** expressions could be omitted from the code completely.  But they\n** are included in a few cases in order to enhance the resilience\n** of SQLite to unexpected behavior - to make the code \"self-healing\"\n** or \"ductile\" rather than being \"brittle\" and crashing at the first\n** hint of unplanned behavior.\n**\n** In other words, ALWAYS and NEVER are added for defensive code.\n**\n** When doing coverage testing ALWAYS and NEVER are hard-coded to\n** be true and false so that the unreachable code they specify will\n** not be counted as untested code.\n*/\n#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST)\n# define ALWAYS(X)      (1)\n# define NEVER(X)       (0)\n#elif !defined(NDEBUG)\n# define ALWAYS(X)      ((X)?1:(assert(0),0))\n# define NEVER(X)       ((X)?(assert(0),1):0)\n#else\n# define ALWAYS(X)      (X)\n# define NEVER(X)       (X)\n#endif\n\n/*\n** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is\n** defined.  We need to defend against those failures when testing with\n** SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches\n** during a normal build.  The following macro can be used to disable tests\n** that are always false except when SQLITE_TEST_REALLOC_STRESS is set.\n*/\n#if defined(SQLITE_TEST_REALLOC_STRESS)\n# define ONLY_IF_REALLOC_STRESS(X)  (X)\n#elif !defined(NDEBUG)\n# define ONLY_IF_REALLOC_STRESS(X)  ((X)?(assert(0),1):0)\n#else\n# define ONLY_IF_REALLOC_STRESS(X)  (0)\n#endif\n\n/*\n** Declarations used for tracing the operating system interfaces.\n*/\n#if defined(SQLITE_FORCE_OS_TRACE) || defined(SQLITE_TEST) || \\\n    (defined(SQLITE_DEBUG) && SQLITE_OS_WIN)\n  extern int sqlite3OSTrace;\n# define OSTRACE(X)          if( sqlite3OSTrace ) sqlite3DebugPrintf X\n# define SQLITE_HAVE_OS_TRACE\n#else\n# define OSTRACE(X)\n# undef  SQLITE_HAVE_OS_TRACE\n#endif\n\n/*\n** Is the sqlite3ErrName() function needed in the build?  Currently,\n** it is needed by \"mutex_w32.c\" (when debugging), \"os_win.c\" (when\n** OSTRACE is enabled), and by several \"test*.c\" files (which are\n** compiled using SQLITE_TEST).\n*/\n#if defined(SQLITE_HAVE_OS_TRACE) || defined(SQLITE_TEST) || \\\n    (defined(SQLITE_DEBUG) && SQLITE_OS_WIN)\n# define SQLITE_NEED_ERR_NAME\n#else\n# undef  SQLITE_NEED_ERR_NAME\n#endif\n\n/*\n** SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN\n*/\n#ifdef SQLITE_OMIT_EXPLAIN\n# undef SQLITE_ENABLE_EXPLAIN_COMMENTS\n#endif\n\n/*\n** Return true (non-zero) if the input is an integer that is too large\n** to fit in 32-bits.  This macro is used inside of various testcase()\n** macros to verify that we have tested SQLite for large-file support.\n*/\n#define IS_BIG_INT(X)  (((X)&~(i64)0xffffffff)!=0)\n\n/*\n** The macro unlikely() is a hint that surrounds a boolean\n** expression that is usually false.  Macro likely() surrounds\n** a boolean expression that is usually true.  These hints could,\n** in theory, be used by the compiler to generate better code, but\n** currently they are just comments for human readers.\n*/\n#define likely(X)    (X)\n#define unlikely(X)  (X)\n\n#include \"hash.h\"\n#include \"parse.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <assert.h>\n#include <stddef.h>\n\n/*\n** If compiling for a processor that lacks floating point support,\n** substitute integer for floating-point\n*/\n#ifdef SQLITE_OMIT_FLOATING_POINT\n# define double sqlite_int64\n# define float sqlite_int64\n# define LONGDOUBLE_TYPE sqlite_int64\n# ifndef SQLITE_BIG_DBL\n#   define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50)\n# endif\n# define SQLITE_OMIT_DATETIME_FUNCS 1\n# define SQLITE_OMIT_TRACE 1\n# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT\n# undef SQLITE_HAVE_ISNAN\n#endif\n#ifndef SQLITE_BIG_DBL\n# define SQLITE_BIG_DBL (1e99)\n#endif\n\n/*\n** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0\n** afterward. Having this macro allows us to cause the C compiler\n** to omit code used by TEMP tables without messy #ifndef statements.\n*/\n#ifdef SQLITE_OMIT_TEMPDB\n#define OMIT_TEMPDB 1\n#else\n#define OMIT_TEMPDB 0\n#endif\n\n/*\n** The \"file format\" number is an integer that is incremented whenever\n** the VDBE-level file format changes.  The following macros define the\n** the default file format for new databases and the maximum file format\n** that the library can read.\n*/\n#define SQLITE_MAX_FILE_FORMAT 4\n#ifndef SQLITE_DEFAULT_FILE_FORMAT\n# define SQLITE_DEFAULT_FILE_FORMAT 4\n#endif\n\n/*\n** Determine whether triggers are recursive by default.  This can be\n** changed at run-time using a pragma.\n*/\n#ifndef SQLITE_DEFAULT_RECURSIVE_TRIGGERS\n# define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0\n#endif\n\n/*\n** Provide a default value for SQLITE_TEMP_STORE in case it is not specified\n** on the command-line\n*/\n#ifndef SQLITE_TEMP_STORE\n# define SQLITE_TEMP_STORE 1\n# define SQLITE_TEMP_STORE_xc 1  /* Exclude from ctime.c */\n#endif\n\n/*\n** If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if\n** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it\n** to zero.\n*/\n#if SQLITE_TEMP_STORE==3 || SQLITE_THREADSAFE==0\n# undef SQLITE_MAX_WORKER_THREADS\n# define SQLITE_MAX_WORKER_THREADS 0\n#endif\n#ifndef SQLITE_MAX_WORKER_THREADS\n# define SQLITE_MAX_WORKER_THREADS 8\n#endif\n#ifndef SQLITE_DEFAULT_WORKER_THREADS\n# define SQLITE_DEFAULT_WORKER_THREADS 0\n#endif\n#if SQLITE_DEFAULT_WORKER_THREADS>SQLITE_MAX_WORKER_THREADS\n# undef SQLITE_MAX_WORKER_THREADS\n# define SQLITE_MAX_WORKER_THREADS SQLITE_DEFAULT_WORKER_THREADS\n#endif\n\n/*\n** The default initial allocation for the pagecache when using separate\n** pagecaches for each database connection.  A positive number is the\n** number of pages.  A negative number N translations means that a buffer\n** of -1024*N bytes is allocated and used for as many pages as it will hold.\n*/\n#ifndef SQLITE_DEFAULT_PCACHE_INITSZ\n# define SQLITE_DEFAULT_PCACHE_INITSZ 100\n#endif\n\n/*\n** GCC does not define the offsetof() macro so we'll have to do it\n** ourselves.\n*/\n#ifndef offsetof\n#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))\n#endif\n\n/*\n** Macros to compute minimum and maximum of two numbers.\n*/\n#ifndef MIN\n# define MIN(A,B) ((A)<(B)?(A):(B))\n#endif\n#ifndef MAX\n# define MAX(A,B) ((A)>(B)?(A):(B))\n#endif\n\n/*\n** Swap two objects of type TYPE.\n*/\n#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}\n\n/*\n** Check to see if this machine uses EBCDIC.  (Yes, believe it or\n** not, there are still machines out there that use EBCDIC.)\n*/\n#if 'A' == '\\301'\n# define SQLITE_EBCDIC 1\n#else\n# define SQLITE_ASCII 1\n#endif\n\n/*\n** Integers of known sizes.  These typedefs might change for architectures\n** where the sizes very.  Preprocessor macros are available so that the\n** types can be conveniently redefined at compile-type.  Like this:\n**\n**         cc '-DUINTPTR_TYPE=long long int' ...\n*/\n#ifndef UINT32_TYPE\n# ifdef HAVE_UINT32_T\n#  define UINT32_TYPE uint32_t\n# else\n#  define UINT32_TYPE unsigned int\n# endif\n#endif\n#ifndef UINT16_TYPE\n# ifdef HAVE_UINT16_T\n#  define UINT16_TYPE uint16_t\n# else\n#  define UINT16_TYPE unsigned short int\n# endif\n#endif\n#ifndef INT16_TYPE\n# ifdef HAVE_INT16_T\n#  define INT16_TYPE int16_t\n# else\n#  define INT16_TYPE short int\n# endif\n#endif\n#ifndef UINT8_TYPE\n# ifdef HAVE_UINT8_T\n#  define UINT8_TYPE uint8_t\n# else\n#  define UINT8_TYPE unsigned char\n# endif\n#endif\n#ifndef INT8_TYPE\n# ifdef HAVE_INT8_T\n#  define INT8_TYPE int8_t\n# else\n#  define INT8_TYPE signed char\n# endif\n#endif\n#ifndef LONGDOUBLE_TYPE\n# define LONGDOUBLE_TYPE long double\n#endif\ntypedef sqlite_int64 i64;          /* 8-byte signed integer */\ntypedef sqlite_uint64 u64;         /* 8-byte unsigned integer */\ntypedef UINT32_TYPE u32;           /* 4-byte unsigned integer */\ntypedef UINT16_TYPE u16;           /* 2-byte unsigned integer */\ntypedef INT16_TYPE i16;            /* 2-byte signed integer */\ntypedef UINT8_TYPE u8;             /* 1-byte unsigned integer */\ntypedef INT8_TYPE i8;              /* 1-byte signed integer */\n\n/*\n** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value\n** that can be stored in a u32 without loss of data.  The value\n** is 0x00000000ffffffff.  But because of quirks of some compilers, we\n** have to specify the value in the less intuitive manner shown:\n*/\n#define SQLITE_MAX_U32  ((((u64)1)<<32)-1)\n\n/*\n** The datatype used to store estimates of the number of rows in a\n** table or index.  This is an unsigned integer type.  For 99.9% of\n** the world, a 32-bit integer is sufficient.  But a 64-bit integer\n** can be used at compile-time if desired.\n*/\n#ifdef SQLITE_64BIT_STATS\n typedef u64 tRowcnt;    /* 64-bit only if requested at compile-time */\n#else\n typedef u32 tRowcnt;    /* 32-bit is the default */\n#endif\n\n/*\n** Estimated quantities used for query planning are stored as 16-bit\n** logarithms.  For quantity X, the value stored is 10*log2(X).  This\n** gives a possible range of values of approximately 1.0e986 to 1e-986.\n** But the allowed values are \"grainy\".  Not every value is representable.\n** For example, quantities 16 and 17 are both represented by a LogEst\n** of 40.  However, since LogEst quantities are suppose to be estimates,\n** not exact values, this imprecision is not a problem.\n**\n** \"LogEst\" is short for \"Logarithmic Estimate\".\n**\n** Examples:\n**      1 -> 0              20 -> 43          10000 -> 132\n**      2 -> 10             25 -> 46          25000 -> 146\n**      3 -> 16            100 -> 66        1000000 -> 199\n**      4 -> 20           1000 -> 99        1048576 -> 200\n**     10 -> 33           1024 -> 100    4294967296 -> 320\n**\n** The LogEst can be negative to indicate fractional values.\n** Examples:\n**\n**    0.5 -> -10           0.1 -> -33        0.0625 -> -40\n*/\ntypedef INT16_TYPE LogEst;\n\n/*\n** Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer\n*/\n#ifndef SQLITE_PTRSIZE\n# if defined(__SIZEOF_POINTER__)\n#   define SQLITE_PTRSIZE __SIZEOF_POINTER__\n# elif defined(i386)     || defined(__i386__)   || defined(_M_IX86) ||    \\\n       defined(_M_ARM)   || defined(__arm__)    || defined(__x86)\n#   define SQLITE_PTRSIZE 4\n# else\n#   define SQLITE_PTRSIZE 8\n# endif\n#endif\n\n/* The uptr type is an unsigned integer large enough to hold a pointer\n*/\n#if defined(HAVE_STDINT_H)\n  typedef uintptr_t uptr;\n#elif SQLITE_PTRSIZE==4\n  typedef u32 uptr;\n#else\n  typedef u64 uptr;\n#endif\n\n/*\n** The SQLITE_WITHIN(P,S,E) macro checks to see if pointer P points to\n** something between S (inclusive) and E (exclusive).\n**\n** In other words, S is a buffer and E is a pointer to the first byte after\n** the end of buffer S.  This macro returns true if P points to something\n** contained within the buffer S.\n*/\n#define SQLITE_WITHIN(P,S,E) (((uptr)(P)>=(uptr)(S))&&((uptr)(P)<(uptr)(E)))\n\n\n/*\n** Macros to determine whether the machine is big or little endian,\n** and whether or not that determination is run-time or compile-time.\n**\n** For best performance, an attempt is made to guess at the byte-order\n** using C-preprocessor macros.  If that is unsuccessful, or if\n** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined\n** at run-time.\n*/\n#if (defined(i386)     || defined(__i386__)   || defined(_M_IX86) ||    \\\n     defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)  ||    \\\n     defined(_M_AMD64) || defined(_M_ARM)     || defined(__x86)   ||    \\\n     defined(__arm__)) && !defined(SQLITE_RUNTIME_BYTEORDER)\n# define SQLITE_BYTEORDER    1234\n# define SQLITE_BIGENDIAN    0\n# define SQLITE_LITTLEENDIAN 1\n# define SQLITE_UTF16NATIVE  SQLITE_UTF16LE\n#endif\n#if (defined(sparc)    || defined(__ppc__))  \\\n    && !defined(SQLITE_RUNTIME_BYTEORDER)\n# define SQLITE_BYTEORDER    4321\n# define SQLITE_BIGENDIAN    1\n# define SQLITE_LITTLEENDIAN 0\n# define SQLITE_UTF16NATIVE  SQLITE_UTF16BE\n#endif\n#if !defined(SQLITE_BYTEORDER)\n# ifdef SQLITE_AMALGAMATION\n  const int sqlite3one = 1;\n# else\n  extern const int sqlite3one;\n# endif\n# define SQLITE_BYTEORDER    0     /* 0 means \"unknown at compile-time\" */\n# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)\n# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)\n# define SQLITE_UTF16NATIVE  (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)\n#endif\n\n/*\n** Constants for the largest and smallest possible 64-bit signed integers.\n** These macros are designed to work correctly on both 32-bit and 64-bit\n** compilers.\n*/\n#define LARGEST_INT64  (0xffffffff|(((i64)0x7fffffff)<<32))\n#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)\n\n/*\n** Round up a number to the next larger multiple of 8.  This is used\n** to force 8-byte alignment on 64-bit architectures.\n*/\n#define ROUND8(x)     (((x)+7)&~7)\n\n/*\n** Round down to the nearest multiple of 8\n*/\n#define ROUNDDOWN8(x) ((x)&~7)\n\n/*\n** Assert that the pointer X is aligned to an 8-byte boundary.  This\n** macro is used only within assert() to verify that the code gets\n** all alignment restrictions correct.\n**\n** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the\n** underlying malloc() implementation might return us 4-byte aligned\n** pointers.  In that case, only verify 4-byte alignment.\n*/\n#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC\n# define EIGHT_BYTE_ALIGNMENT(X)   ((((char*)(X) - (char*)0)&3)==0)\n#else\n# define EIGHT_BYTE_ALIGNMENT(X)   ((((char*)(X) - (char*)0)&7)==0)\n#endif\n\n/*\n** Disable MMAP on platforms where it is known to not work\n*/\n#if defined(__OpenBSD__) || defined(__QNXNTO__)\n# undef SQLITE_MAX_MMAP_SIZE\n# define SQLITE_MAX_MMAP_SIZE 0\n#endif\n\n/*\n** Default maximum size of memory used by memory-mapped I/O in the VFS\n*/\n#ifdef __APPLE__\n# include <TargetConditionals.h>\n#endif\n#ifndef SQLITE_MAX_MMAP_SIZE\n# if defined(__linux__) \\\n  || defined(_WIN32) \\\n  || (defined(__APPLE__) && defined(__MACH__)) \\\n  || defined(__sun) \\\n  || defined(__FreeBSD__) \\\n  || defined(__DragonFly__)\n#   define SQLITE_MAX_MMAP_SIZE 0x7fff0000  /* 2147418112 */\n# else\n#   define SQLITE_MAX_MMAP_SIZE 0\n# endif\n# define SQLITE_MAX_MMAP_SIZE_xc 1 /* exclude from ctime.c */\n#endif\n\n/*\n** The default MMAP_SIZE is zero on all platforms.  Or, even if a larger\n** default MMAP_SIZE is specified at compile-time, make sure that it does\n** not exceed the maximum mmap size.\n*/\n#ifndef SQLITE_DEFAULT_MMAP_SIZE\n# define SQLITE_DEFAULT_MMAP_SIZE 0\n# define SQLITE_DEFAULT_MMAP_SIZE_xc 1  /* Exclude from ctime.c */\n#endif\n#if SQLITE_DEFAULT_MMAP_SIZE>SQLITE_MAX_MMAP_SIZE\n# undef SQLITE_DEFAULT_MMAP_SIZE\n# define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE\n#endif\n\n/*\n** Only one of SQLITE_ENABLE_STAT3 or SQLITE_ENABLE_STAT4 can be defined.\n** Priority is given to SQLITE_ENABLE_STAT4.  If either are defined, also\n** define SQLITE_ENABLE_STAT3_OR_STAT4\n*/\n#ifdef SQLITE_ENABLE_STAT4\n# undef SQLITE_ENABLE_STAT3\n# define SQLITE_ENABLE_STAT3_OR_STAT4 1\n#elif SQLITE_ENABLE_STAT3\n# define SQLITE_ENABLE_STAT3_OR_STAT4 1\n#elif SQLITE_ENABLE_STAT3_OR_STAT4\n# undef SQLITE_ENABLE_STAT3_OR_STAT4\n#endif\n\n/*\n** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not\n** the Select query generator tracing logic is turned on.\n*/\n#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_SELECTTRACE)\n# define SELECTTRACE_ENABLED 1\n#else\n# define SELECTTRACE_ENABLED 0\n#endif\n\n/*\n** An instance of the following structure is used to store the busy-handler\n** callback for a given sqlite handle.\n**\n** The sqlite.busyHandler member of the sqlite struct contains the busy\n** callback for the database handle. Each pager opened via the sqlite\n** handle is passed a pointer to sqlite.busyHandler. The busy-handler\n** callback is currently invoked only from within pager.c.\n*/\ntypedef struct BusyHandler BusyHandler;\nstruct BusyHandler {\n  int (*xFunc)(void *,int);  /* The busy callback */\n  void *pArg;                /* First arg to busy callback */\n  int nBusy;                 /* Incremented with each busy call */\n};\n\n/*\n** Name of the master database table.  The master database table\n** is a special table that holds the names and attributes of all\n** user tables and indices.\n*/\n#define MASTER_NAME       \"sqlite_master\"\n#define TEMP_MASTER_NAME  \"sqlite_temp_master\"\n\n/*\n** The root-page of the master database table.\n*/\n#define MASTER_ROOT       1\n\n/*\n** The name of the schema table.\n*/\n#define SCHEMA_TABLE(x)  ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME)\n\n/*\n** A convenience macro that returns the number of elements in\n** an array.\n*/\n#define ArraySize(X)    ((int)(sizeof(X)/sizeof(X[0])))\n\n/*\n** Determine if the argument is a power of two\n*/\n#define IsPowerOfTwo(X) (((X)&((X)-1))==0)\n\n/*\n** The following value as a destructor means to use sqlite3DbFree().\n** The sqlite3DbFree() routine requires two parameters instead of the\n** one parameter that destructors normally want.  So we have to introduce\n** this magic value that the code knows to handle differently.  Any\n** pointer will work here as long as it is distinct from SQLITE_STATIC\n** and SQLITE_TRANSIENT.\n*/\n#define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3MallocSize)\n\n/*\n** When SQLITE_OMIT_WSD is defined, it means that the target platform does\n** not support Writable Static Data (WSD) such as global and static variables.\n** All variables must either be on the stack or dynamically allocated from\n** the heap.  When WSD is unsupported, the variable declarations scattered\n** throughout the SQLite code must become constants instead.  The SQLITE_WSD\n** macro is used for this purpose.  And instead of referencing the variable\n** directly, we use its constant as a key to lookup the run-time allocated\n** buffer that holds real variable.  The constant is also the initializer\n** for the run-time allocated buffer.\n**\n** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL\n** macros become no-ops and have zero performance impact.\n*/\n#ifdef SQLITE_OMIT_WSD\n  #define SQLITE_WSD const\n  #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))\n  #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)\n  int sqlite3_wsd_init(int N, int J);\n  void *sqlite3_wsd_find(void *K, int L);\n#else\n  #define SQLITE_WSD\n  #define GLOBAL(t,v) v\n  #define sqlite3GlobalConfig sqlite3Config\n#endif\n\n/*\n** The following macros are used to suppress compiler warnings and to\n** make it clear to human readers when a function parameter is deliberately\n** left unused within the body of a function. This usually happens when\n** a function is called via a function pointer. For example the\n** implementation of an SQL aggregate step callback may not use the\n** parameter indicating the number of arguments passed to the aggregate,\n** if it knows that this is enforced elsewhere.\n**\n** When a function parameter is not used at all within the body of a function,\n** it is generally named \"NotUsed\" or \"NotUsed2\" to make things even clearer.\n** However, these macros may also be used to suppress warnings related to\n** parameters that may or may not be used depending on compilation options.\n** For example those parameters only used in assert() statements. In these\n** cases the parameters are named as per the usual conventions.\n*/\n#define UNUSED_PARAMETER(x) (void)(x)\n#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y)\n\n/*\n** Forward references to structures\n*/\ntypedef struct AggInfo AggInfo;\ntypedef struct AuthContext AuthContext;\ntypedef struct AutoincInfo AutoincInfo;\ntypedef struct Bitvec Bitvec;\ntypedef struct CollSeq CollSeq;\ntypedef struct Column Column;\ntypedef struct Db Db;\ntypedef struct Schema Schema;\ntypedef struct Expr Expr;\ntypedef struct ExprList ExprList;\ntypedef struct ExprSpan ExprSpan;\ntypedef struct FKey FKey;\ntypedef struct FuncDestructor FuncDestructor;\ntypedef struct FuncDef FuncDef;\ntypedef struct FuncDefHash FuncDefHash;\ntypedef struct IdList IdList;\ntypedef struct Index Index;\ntypedef struct IndexSample IndexSample;\ntypedef struct KeyClass KeyClass;\ntypedef struct KeyInfo KeyInfo;\ntypedef struct Lookaside Lookaside;\ntypedef struct LookasideSlot LookasideSlot;\ntypedef struct Module Module;\ntypedef struct NameContext NameContext;\ntypedef struct Parse Parse;\ntypedef struct PreUpdate PreUpdate;\ntypedef struct PrintfArguments PrintfArguments;\ntypedef struct RowSet RowSet;\ntypedef struct Savepoint Savepoint;\ntypedef struct Select Select;\ntypedef struct SQLiteThread SQLiteThread;\ntypedef struct SelectDest SelectDest;\ntypedef struct SrcList SrcList;\ntypedef struct StrAccum StrAccum;\ntypedef struct Table Table;\ntypedef struct TableLock TableLock;\ntypedef struct Token Token;\ntypedef struct TreeView TreeView;\ntypedef struct Trigger Trigger;\ntypedef struct TriggerPrg TriggerPrg;\ntypedef struct TriggerStep TriggerStep;\ntypedef struct UnpackedRecord UnpackedRecord;\ntypedef struct VTable VTable;\ntypedef struct VtabCtx VtabCtx;\ntypedef struct Walker Walker;\ntypedef struct WhereInfo WhereInfo;\ntypedef struct With With;\n\n/*\n** Defer sourcing vdbe.h and btree.h until after the \"u8\" and\n** \"BusyHandler\" typedefs. vdbe.h also requires a few of the opaque\n** pointer types (i.e. FuncDef) defined above.\n*/\n#include \"btree.h\"\n#include \"vdbe.h\"\n#include \"pager.h\"\n#include \"pcache.h\"\n#include \"os.h\"\n#include \"mutex.h\"\n\n/* The SQLITE_EXTRA_DURABLE compile-time option used to set the default\n** synchronous setting to EXTRA.  It is no longer supported.\n*/\n#ifdef SQLITE_EXTRA_DURABLE\n# warning Use SQLITE_DEFAULT_SYNCHRONOUS=3 instead of SQLITE_EXTRA_DURABLE\n# define SQLITE_DEFAULT_SYNCHRONOUS 3\n#endif\n\n/*\n** Default synchronous levels.\n**\n** Note that (for historcal reasons) the PAGER_SYNCHRONOUS_* macros differ\n** from the SQLITE_DEFAULT_SYNCHRONOUS value by 1.\n**\n**           PAGER_SYNCHRONOUS       DEFAULT_SYNCHRONOUS\n**   OFF           1                         0\n**   NORMAL        2                         1\n**   FULL          3                         2\n**   EXTRA         4                         3\n**\n** The \"PRAGMA synchronous\" statement also uses the zero-based numbers.\n** In other words, the zero-based numbers are used for all external interfaces\n** and the one-based values are used internally.\n*/\n#ifndef SQLITE_DEFAULT_SYNCHRONOUS\n# define SQLITE_DEFAULT_SYNCHRONOUS (PAGER_SYNCHRONOUS_FULL-1)\n#endif\n#ifndef SQLITE_DEFAULT_WAL_SYNCHRONOUS\n# define SQLITE_DEFAULT_WAL_SYNCHRONOUS SQLITE_DEFAULT_SYNCHRONOUS\n#endif\n\n/*\n** Each database file to be accessed by the system is an instance\n** of the following structure.  There are normally two of these structures\n** in the sqlite.aDb[] array.  aDb[0] is the main database file and\n** aDb[1] is the database file used to hold temporary tables.  Additional\n** databases may be attached.\n*/\nstruct Db {\n  char *zDbSName;      /* Name of this database. (schema name, not filename) */\n  Btree *pBt;          /* The B*Tree structure for this database file */\n  u8 safety_level;     /* How aggressive at syncing data to disk */\n  u8 bSyncSet;         /* True if \"PRAGMA synchronous=N\" has been run */\n  Schema *pSchema;     /* Pointer to database schema (possibly shared) */\n};\n\n/*\n** An instance of the following structure stores a database schema.\n**\n** Most Schema objects are associated with a Btree.  The exception is\n** the Schema for the TEMP databaes (sqlite3.aDb[1]) which is free-standing.\n** In shared cache mode, a single Schema object can be shared by multiple\n** Btrees that refer to the same underlying BtShared object.\n**\n** Schema objects are automatically deallocated when the last Btree that\n** references them is destroyed.   The TEMP Schema is manually freed by\n** sqlite3_close().\n*\n** A thread must be holding a mutex on the corresponding Btree in order\n** to access Schema content.  This implies that the thread must also be\n** holding a mutex on the sqlite3 connection pointer that owns the Btree.\n** For a TEMP Schema, only the connection mutex is required.\n*/\nstruct Schema {\n  int schema_cookie;   /* Database schema version number for this file */\n  int iGeneration;     /* Generation counter.  Incremented with each change */\n  Hash tblHash;        /* All tables indexed by name */\n  Hash idxHash;        /* All (named) indices indexed by name */\n  Hash trigHash;       /* All triggers indexed by name */\n  Hash fkeyHash;       /* All foreign keys by referenced table name */\n  Table *pSeqTab;      /* The sqlite_sequence table used by AUTOINCREMENT */\n  u8 file_format;      /* Schema format version for this file */\n  u8 enc;              /* Text encoding used by this database */\n  u16 schemaFlags;     /* Flags associated with this schema */\n  int cache_size;      /* Number of pages to use in the cache */\n};\n\n/*\n** These macros can be used to test, set, or clear bits in the\n** Db.pSchema->flags field.\n*/\n#define DbHasProperty(D,I,P)     (((D)->aDb[I].pSchema->schemaFlags&(P))==(P))\n#define DbHasAnyProperty(D,I,P)  (((D)->aDb[I].pSchema->schemaFlags&(P))!=0)\n#define DbSetProperty(D,I,P)     (D)->aDb[I].pSchema->schemaFlags|=(P)\n#define DbClearProperty(D,I,P)   (D)->aDb[I].pSchema->schemaFlags&=~(P)\n\n/*\n** Allowed values for the DB.pSchema->flags field.\n**\n** The DB_SchemaLoaded flag is set after the database schema has been\n** read into internal hash tables.\n**\n** DB_UnresetViews means that one or more views have column names that\n** have been filled out.  If the schema changes, these column names might\n** changes and so the view will need to be reset.\n*/\n#define DB_SchemaLoaded    0x0001  /* The schema has been loaded */\n#define DB_UnresetViews    0x0002  /* Some views have defined column names */\n#define DB_Empty           0x0004  /* The file is empty (length 0 bytes) */\n\n/*\n** The number of different kinds of things that can be limited\n** using the sqlite3_limit() interface.\n*/\n#define SQLITE_N_LIMIT (SQLITE_LIMIT_WORKER_THREADS+1)\n\n/*\n** Lookaside malloc is a set of fixed-size buffers that can be used\n** to satisfy small transient memory allocation requests for objects\n** associated with a particular database connection.  The use of\n** lookaside malloc provides a significant performance enhancement\n** (approx 10%) by avoiding numerous malloc/free requests while parsing\n** SQL statements.\n**\n** The Lookaside structure holds configuration information about the\n** lookaside malloc subsystem.  Each available memory allocation in\n** the lookaside subsystem is stored on a linked list of LookasideSlot\n** objects.\n**\n** Lookaside allocations are only allowed for objects that are associated\n** with a particular database connection.  Hence, schema information cannot\n** be stored in lookaside because in shared cache mode the schema information\n** is shared by multiple database connections.  Therefore, while parsing\n** schema information, the Lookaside.bEnabled flag is cleared so that\n** lookaside allocations are not used to construct the schema objects.\n*/\nstruct Lookaside {\n  u32 bDisable;           /* Only operate the lookaside when zero */\n  u16 sz;                 /* Size of each buffer in bytes */\n  u8 bMalloced;           /* True if pStart obtained from sqlite3_malloc() */\n  int nOut;               /* Number of buffers currently checked out */\n  int mxOut;              /* Highwater mark for nOut */\n  int anStat[3];          /* 0: hits.  1: size misses.  2: full misses */\n  LookasideSlot *pFree;   /* List of available buffers */\n  void *pStart;           /* First byte of available memory space */\n  void *pEnd;             /* First byte past end of available space */\n};\nstruct LookasideSlot {\n  LookasideSlot *pNext;    /* Next buffer in the list of free buffers */\n};\n\n/*\n** A hash table for built-in function definitions.  (Application-defined\n** functions use a regular table table from hash.h.)\n**\n** Hash each FuncDef structure into one of the FuncDefHash.a[] slots.\n** Collisions are on the FuncDef.u.pHash chain.\n*/\n#define SQLITE_FUNC_HASH_SZ 23\nstruct FuncDefHash {\n  FuncDef *a[SQLITE_FUNC_HASH_SZ];       /* Hash table for functions */\n};\n\n#ifdef SQLITE_USER_AUTHENTICATION\n/*\n** Information held in the \"sqlite3\" database connection object and used\n** to manage user authentication.\n*/\ntypedef struct sqlite3_userauth sqlite3_userauth;\nstruct sqlite3_userauth {\n  u8 authLevel;                 /* Current authentication level */\n  int nAuthPW;                  /* Size of the zAuthPW in bytes */\n  char *zAuthPW;                /* Password used to authenticate */\n  char *zAuthUser;              /* User name used to authenticate */\n};\n\n/* Allowed values for sqlite3_userauth.authLevel */\n#define UAUTH_Unknown     0     /* Authentication not yet checked */\n#define UAUTH_Fail        1     /* User authentication failed */\n#define UAUTH_User        2     /* Authenticated as a normal user */\n#define UAUTH_Admin       3     /* Authenticated as an administrator */\n\n/* Functions used only by user authorization logic */\nint sqlite3UserAuthTable(const char*);\nint sqlite3UserAuthCheckLogin(sqlite3*,const char*,u8*);\nvoid sqlite3UserAuthInit(sqlite3*);\nvoid sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**);\n\n#endif /* SQLITE_USER_AUTHENTICATION */\n\n/*\n** typedef for the authorization callback function.\n*/\n#ifdef SQLITE_USER_AUTHENTICATION\n  typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,\n                               const char*, const char*);\n#else\n  typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,\n                               const char*);\n#endif\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/* This is an extra SQLITE_TRACE macro that indicates \"legacy\" tracing\n** in the style of sqlite3_trace()\n*/\n#define SQLITE_TRACE_LEGACY  0x80\n#else\n#define SQLITE_TRACE_LEGACY  0\n#endif /* SQLITE_OMIT_DEPRECATED */\n\n\n/*\n** Each database connection is an instance of the following structure.\n*/\nstruct sqlite3 {\n  sqlite3_vfs *pVfs;            /* OS Interface */\n  struct Vdbe *pVdbe;           /* List of active virtual machines */\n  CollSeq *pDfltColl;           /* The default collating sequence (BINARY) */\n  sqlite3_mutex *mutex;         /* Connection mutex */\n  Db *aDb;                      /* All backends */\n  int nDb;                      /* Number of backends currently in use */\n  int flags;                    /* Miscellaneous flags. See below */\n  i64 lastRowid;                /* ROWID of most recent insert (see above) */\n  i64 szMmap;                   /* Default mmap_size setting */\n  unsigned int openFlags;       /* Flags passed to sqlite3_vfs.xOpen() */\n  int errCode;                  /* Most recent error code (SQLITE_*) */\n  int errMask;                  /* & result codes with this before returning */\n  int iSysErrno;                /* Errno value from last system error */\n  u16 dbOptFlags;               /* Flags to enable/disable optimizations */\n  u8 enc;                       /* Text encoding */\n  u8 autoCommit;                /* The auto-commit flag. */\n  u8 temp_store;                /* 1: file 2: memory 0: default */\n  u8 mallocFailed;              /* True if we have seen a malloc failure */\n  u8 bBenignMalloc;             /* Do not require OOMs if true */\n  u8 dfltLockMode;              /* Default locking-mode for attached dbs */\n  signed char nextAutovac;      /* Autovac setting after VACUUM if >=0 */\n  u8 suppressErr;               /* Do not issue error messages if true */\n  u8 vtabOnConflict;            /* Value to return for s3_vtab_on_conflict() */\n  u8 isTransactionSavepoint;    /* True if the outermost savepoint is a TS */\n  u8 mTrace;                    /* zero or more SQLITE_TRACE flags */\n  int nextPagesize;             /* Pagesize after VACUUM if >0 */\n  u32 magic;                    /* Magic number for detect library misuse */\n  int nChange;                  /* Value returned by sqlite3_changes() */\n  int nTotalChange;             /* Value returned by sqlite3_total_changes() */\n  int aLimit[SQLITE_N_LIMIT];   /* Limits */\n  int nMaxSorterMmap;           /* Maximum size of regions mapped by sorter */\n  struct sqlite3InitInfo {      /* Information used during initialization */\n    int newTnum;                /* Rootpage of table being initialized */\n    u8 iDb;                     /* Which db file is being initialized */\n    u8 busy;                    /* TRUE if currently initializing */\n    u8 orphanTrigger;           /* Last statement is orphaned TEMP trigger */\n    u8 imposterTable;           /* Building an imposter table */\n  } init;\n  int nVdbeActive;              /* Number of VDBEs currently running */\n  int nVdbeRead;                /* Number of active VDBEs that read or write */\n  int nVdbeWrite;               /* Number of active VDBEs that read and write */\n  int nVdbeExec;                /* Number of nested calls to VdbeExec() */\n  int nVDestroy;                /* Number of active OP_VDestroy operations */\n  int nExtension;               /* Number of loaded extensions */\n  void **aExtension;            /* Array of shared library handles */\n  int (*xTrace)(u32,void*,void*,void*);     /* Trace function */\n  void *pTraceArg;                          /* Argument to the trace function */\n  void (*xProfile)(void*,const char*,u64);  /* Profiling function */\n  void *pProfileArg;                        /* Argument to profile function */\n  void *pCommitArg;                 /* Argument to xCommitCallback() */\n  int (*xCommitCallback)(void*);    /* Invoked at every commit. */\n  void *pRollbackArg;               /* Argument to xRollbackCallback() */\n  void (*xRollbackCallback)(void*); /* Invoked at every commit. */\n  void *pUpdateArg;\n  void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n  void *pPreUpdateArg;          /* First argument to xPreUpdateCallback */\n  void (*xPreUpdateCallback)(   /* Registered using sqlite3_preupdate_hook() */\n    void*,sqlite3*,int,char const*,char const*,sqlite3_int64,sqlite3_int64\n  );\n  PreUpdate *pPreUpdate;        /* Context for active pre-update callback */\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n#ifndef SQLITE_OMIT_WAL\n  int (*xWalCallback)(void *, sqlite3 *, const char *, int);\n  void *pWalArg;\n#endif\n  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);\n  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);\n  void *pCollNeededArg;\n  sqlite3_value *pErr;          /* Most recent error message */\n  union {\n    volatile int isInterrupted; /* True if sqlite3_interrupt has been called */\n    double notUsed1;            /* Spacer */\n  } u1;\n  Lookaside lookaside;          /* Lookaside malloc configuration */\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  sqlite3_xauth xAuth;          /* Access authorization function */\n  void *pAuthArg;               /* 1st argument to the access auth function */\n#endif\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\n  int (*xProgress)(void *);     /* The progress callback */\n  void *pProgressArg;           /* Argument to the progress callback */\n  unsigned nProgressOps;        /* Number of opcodes for progress callback */\n#endif\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  int nVTrans;                  /* Allocated size of aVTrans */\n  Hash aModule;                 /* populated by sqlite3_create_module() */\n  VtabCtx *pVtabCtx;            /* Context for active vtab connect/create */\n  VTable **aVTrans;             /* Virtual tables with open transactions */\n  VTable *pDisconnect;    /* Disconnect these in next sqlite3_prepare() */\n#endif\n  Hash aFunc;                   /* Hash table of connection functions */\n  Hash aCollSeq;                /* All collating sequences */\n  BusyHandler busyHandler;      /* Busy callback */\n  Db aDbStatic[2];              /* Static space for the 2 default backends */\n  Savepoint *pSavepoint;        /* List of active savepoints */\n  int busyTimeout;              /* Busy handler timeout, in msec */\n  int nSavepoint;               /* Number of non-transaction savepoints */\n  int nStatement;               /* Number of nested statement-transactions  */\n  i64 nDeferredCons;            /* Net deferred constraints this transaction. */\n  i64 nDeferredImmCons;         /* Net deferred immediate constraints */\n  int *pnBytesFreed;            /* If not NULL, increment this in DbFree() */\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\n  /* The following variables are all protected by the STATIC_MASTER\n  ** mutex, not by sqlite3.mutex. They are used by code in notify.c.\n  **\n  ** When X.pUnlockConnection==Y, that means that X is waiting for Y to\n  ** unlock so that it can proceed.\n  **\n  ** When X.pBlockingConnection==Y, that means that something that X tried\n  ** tried to do recently failed with an SQLITE_LOCKED error due to locks\n  ** held by Y.\n  */\n  sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */\n  sqlite3 *pUnlockConnection;           /* Connection to watch for unlock */\n  void *pUnlockArg;                     /* Argument to xUnlockNotify */\n  void (*xUnlockNotify)(void **, int);  /* Unlock notify callback */\n  sqlite3 *pNextBlocked;        /* Next in list of all blocked connections */\n#endif\n#ifdef SQLITE_USER_AUTHENTICATION\n  sqlite3_userauth auth;        /* User authentication information */\n#endif\n};\n\n/*\n** A macro to discover the encoding of a database.\n*/\n#define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc)\n#define ENC(db)        ((db)->enc)\n\n/*\n** Possible values for the sqlite3.flags.\n**\n** Value constraints (enforced via assert()):\n**      SQLITE_FullFSync     == PAGER_FULLFSYNC\n**      SQLITE_CkptFullFSync == PAGER_CKPT_FULLFSYNC\n**      SQLITE_CacheSpill    == PAGER_CACHE_SPILL\n*/\n#define SQLITE_VdbeTrace      0x00000001  /* True to trace VDBE execution */\n#define SQLITE_InternChanges  0x00000002  /* Uncommitted Hash table changes */\n#define SQLITE_FullColNames   0x00000004  /* Show full column names on SELECT */\n#define SQLITE_FullFSync      0x00000008  /* Use full fsync on the backend */\n#define SQLITE_CkptFullFSync  0x00000010  /* Use full fsync for checkpoint */\n#define SQLITE_CacheSpill     0x00000020  /* OK to spill pager cache */\n#define SQLITE_ShortColNames  0x00000040  /* Show short columns names */\n#define SQLITE_CountRows      0x00000080  /* Count rows changed by INSERT, */\n                                          /*   DELETE, or UPDATE and return */\n                                          /*   the count using a callback. */\n#define SQLITE_NullCallback   0x00000100  /* Invoke the callback once if the */\n                                          /*   result set is empty */\n#define SQLITE_SqlTrace       0x00000200  /* Debug print SQL as it executes */\n#define SQLITE_VdbeListing    0x00000400  /* Debug listings of VDBE programs */\n#define SQLITE_WriteSchema    0x00000800  /* OK to update SQLITE_MASTER */\n#define SQLITE_VdbeAddopTrace 0x00001000  /* Trace sqlite3VdbeAddOp() calls */\n#define SQLITE_IgnoreChecks   0x00002000  /* Do not enforce check constraints */\n#define SQLITE_ReadUncommitted 0x0004000  /* For shared-cache mode */\n#define SQLITE_LegacyFileFmt  0x00008000  /* Create new databases in format 1 */\n#define SQLITE_RecoveryMode   0x00010000  /* Ignore schema errors */\n#define SQLITE_ReverseOrder   0x00020000  /* Reverse unordered SELECTs */\n#define SQLITE_RecTriggers    0x00040000  /* Enable recursive triggers */\n#define SQLITE_ForeignKeys    0x00080000  /* Enforce foreign key constraints  */\n#define SQLITE_AutoIndex      0x00100000  /* Enable automatic indexes */\n#define SQLITE_PreferBuiltin  0x00200000  /* Preference to built-in funcs */\n#define SQLITE_LoadExtension  0x00400000  /* Enable load_extension */\n#define SQLITE_LoadExtFunc    0x00800000  /* Enable load_extension() SQL func */\n#define SQLITE_EnableTrigger  0x01000000  /* True to enable triggers */\n#define SQLITE_DeferFKs       0x02000000  /* Defer all FK constraints */\n#define SQLITE_QueryOnly      0x04000000  /* Disable database changes */\n#define SQLITE_VdbeEQP        0x08000000  /* Debug EXPLAIN QUERY PLAN */\n#define SQLITE_Vacuum         0x10000000  /* Currently in a VACUUM */\n#define SQLITE_CellSizeCk     0x20000000  /* Check btree cell sizes on load */\n#define SQLITE_Fts3Tokenizer  0x40000000  /* Enable fts3_tokenizer(2) */\n\n\n/*\n** Bits of the sqlite3.dbOptFlags field that are used by the\n** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to\n** selectively disable various optimizations.\n*/\n#define SQLITE_QueryFlattener 0x0001   /* Query flattening */\n#define SQLITE_ColumnCache    0x0002   /* Column cache */\n#define SQLITE_GroupByOrder   0x0004   /* GROUPBY cover of ORDERBY */\n#define SQLITE_FactorOutConst 0x0008   /* Constant factoring */\n/*                not used    0x0010   // Was: SQLITE_IdxRealAsInt */\n#define SQLITE_DistinctOpt    0x0020   /* DISTINCT using indexes */\n#define SQLITE_CoverIdxScan   0x0040   /* Covering index scans */\n#define SQLITE_OrderByIdxJoin 0x0080   /* ORDER BY of joins via index */\n#define SQLITE_SubqCoroutine  0x0100   /* Evaluate subqueries as coroutines */\n#define SQLITE_Transitive     0x0200   /* Transitive constraints */\n#define SQLITE_OmitNoopJoin   0x0400   /* Omit unused tables in joins */\n#define SQLITE_Stat34         0x0800   /* Use STAT3 or STAT4 data */\n#define SQLITE_CursorHints    0x2000   /* Add OP_CursorHint opcodes */\n#define SQLITE_AllOpts        0xffff   /* All optimizations */\n\n/*\n** Macros for testing whether or not optimizations are enabled or disabled.\n*/\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n#define OptimizationDisabled(db, mask)  (((db)->dbOptFlags&(mask))!=0)\n#define OptimizationEnabled(db, mask)   (((db)->dbOptFlags&(mask))==0)\n#else\n#define OptimizationDisabled(db, mask)  0\n#define OptimizationEnabled(db, mask)   1\n#endif\n\n/*\n** Return true if it OK to factor constant expressions into the initialization\n** code. The argument is a Parse object for the code generator.\n*/\n#define ConstFactorOk(P) ((P)->okConstFactor)\n\n/*\n** Possible values for the sqlite.magic field.\n** The numbers are obtained at random and have no special meaning, other\n** than being distinct from one another.\n*/\n#define SQLITE_MAGIC_OPEN     0xa029a697  /* Database is open */\n#define SQLITE_MAGIC_CLOSED   0x9f3c2d33  /* Database is closed */\n#define SQLITE_MAGIC_SICK     0x4b771290  /* Error and awaiting close */\n#define SQLITE_MAGIC_BUSY     0xf03b7906  /* Database currently in use */\n#define SQLITE_MAGIC_ERROR    0xb5357930  /* An SQLITE_MISUSE error occurred */\n#define SQLITE_MAGIC_ZOMBIE   0x64cffc7f  /* Close with last statement close */\n\n/*\n** Each SQL function is defined by an instance of the following\n** structure.  For global built-in functions (ex: substr(), max(), count())\n** a pointer to this structure is held in the sqlite3BuiltinFunctions object.\n** For per-connection application-defined functions, a pointer to this\n** structure is held in the db->aHash hash table.\n**\n** The u.pHash field is used by the global built-ins.  The u.pDestructor\n** field is used by per-connection app-def functions.\n*/\nstruct FuncDef {\n  i8 nArg;             /* Number of arguments.  -1 means unlimited */\n  u16 funcFlags;       /* Some combination of SQLITE_FUNC_* */\n  void *pUserData;     /* User data parameter */\n  FuncDef *pNext;      /* Next function with same name */\n  void (*xSFunc)(sqlite3_context*,int,sqlite3_value**); /* func or agg-step */\n  void (*xFinalize)(sqlite3_context*);                  /* Agg finalizer */\n  const char *zName;   /* SQL name of the function. */\n  union {\n    FuncDef *pHash;      /* Next with a different name but the same hash */\n    FuncDestructor *pDestructor;   /* Reference counted destructor function */\n  } u;\n};\n\n/*\n** This structure encapsulates a user-function destructor callback (as\n** configured using create_function_v2()) and a reference counter. When\n** create_function_v2() is called to create a function with a destructor,\n** a single object of this type is allocated. FuncDestructor.nRef is set to\n** the number of FuncDef objects created (either 1 or 3, depending on whether\n** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor\n** member of each of the new FuncDef objects is set to point to the allocated\n** FuncDestructor.\n**\n** Thereafter, when one of the FuncDef objects is deleted, the reference\n** count on this object is decremented. When it reaches 0, the destructor\n** is invoked and the FuncDestructor structure freed.\n*/\nstruct FuncDestructor {\n  int nRef;\n  void (*xDestroy)(void *);\n  void *pUserData;\n};\n\n/*\n** Possible values for FuncDef.flags.  Note that the _LENGTH and _TYPEOF\n** values must correspond to OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG.  And\n** SQLITE_FUNC_CONSTANT must be the same as SQLITE_DETERMINISTIC.  There\n** are assert() statements in the code to verify this.\n**\n** Value constraints (enforced via assert()):\n**     SQLITE_FUNC_MINMAX    ==  NC_MinMaxAgg      == SF_MinMaxAgg\n**     SQLITE_FUNC_LENGTH    ==  OPFLAG_LENGTHARG\n**     SQLITE_FUNC_TYPEOF    ==  OPFLAG_TYPEOFARG\n**     SQLITE_FUNC_CONSTANT  ==  SQLITE_DETERMINISTIC from the API\n**     SQLITE_FUNC_ENCMASK   depends on SQLITE_UTF* macros in the API\n*/\n#define SQLITE_FUNC_ENCMASK  0x0003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */\n#define SQLITE_FUNC_LIKE     0x0004 /* Candidate for the LIKE optimization */\n#define SQLITE_FUNC_CASE     0x0008 /* Case-sensitive LIKE-type function */\n#define SQLITE_FUNC_EPHEM    0x0010 /* Ephemeral.  Delete with VDBE */\n#define SQLITE_FUNC_NEEDCOLL 0x0020 /* sqlite3GetFuncCollSeq() might be called*/\n#define SQLITE_FUNC_LENGTH   0x0040 /* Built-in length() function */\n#define SQLITE_FUNC_TYPEOF   0x0080 /* Built-in typeof() function */\n#define SQLITE_FUNC_COUNT    0x0100 /* Built-in count(*) aggregate */\n#define SQLITE_FUNC_COALESCE 0x0200 /* Built-in coalesce() or ifnull() */\n#define SQLITE_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */\n#define SQLITE_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */\n#define SQLITE_FUNC_MINMAX   0x1000 /* True for min() and max() aggregates */\n#define SQLITE_FUNC_SLOCHNG  0x2000 /* \"Slow Change\". Value constant during a\n                                    ** single query - might change over time */\n\n/*\n** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are\n** used to create the initializers for the FuncDef structures.\n**\n**   FUNCTION(zName, nArg, iArg, bNC, xFunc)\n**     Used to create a scalar function definition of a function zName\n**     implemented by C function xFunc that accepts nArg arguments. The\n**     value passed as iArg is cast to a (void*) and made available\n**     as the user-data (sqlite3_user_data()) for the function. If\n**     argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set.\n**\n**   VFUNCTION(zName, nArg, iArg, bNC, xFunc)\n**     Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag.\n**\n**   DFUNCTION(zName, nArg, iArg, bNC, xFunc)\n**     Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and\n**     adds the SQLITE_FUNC_SLOCHNG flag.  Used for date & time functions\n**     and functions like sqlite_version() that can change, but not during\n**     a single query.\n**\n**   AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)\n**     Used to create an aggregate function definition implemented by\n**     the C functions xStep and xFinal. The first four parameters\n**     are interpreted in the same way as the first 4 parameters to\n**     FUNCTION().\n**\n**   LIKEFUNC(zName, nArg, pArg, flags)\n**     Used to create a scalar function definition of a function zName\n**     that accepts nArg arguments and is implemented by a call to C\n**     function likeFunc. Argument pArg is cast to a (void *) and made\n**     available as the function user-data (sqlite3_user_data()). The\n**     FuncDef.flags variable is set to the value passed as the flags\n**     parameter.\n*/\n#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \\\n  {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \\\n   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }\n#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \\\n  {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \\\n   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }\n#define DFUNCTION(zName, nArg, iArg, bNC, xFunc) \\\n  {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \\\n   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }\n#define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \\\n  {nArg,SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\\\n   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }\n#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \\\n  {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \\\n   pArg, 0, xFunc, 0, #zName, }\n#define LIKEFUNC(zName, nArg, arg, flags) \\\n  {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|flags, \\\n   (void *)arg, 0, likeFunc, 0, #zName, {0} }\n#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \\\n  {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL), \\\n   SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,#zName, {0}}\n#define AGGREGATE2(zName, nArg, arg, nc, xStep, xFinal, extraFlags) \\\n  {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|extraFlags, \\\n   SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,#zName, {0}}\n\n/*\n** All current savepoints are stored in a linked list starting at\n** sqlite3.pSavepoint. The first element in the list is the most recently\n** opened savepoint. Savepoints are added to the list by the vdbe\n** OP_Savepoint instruction.\n*/\nstruct Savepoint {\n  char *zName;                        /* Savepoint name (nul-terminated) */\n  i64 nDeferredCons;                  /* Number of deferred fk violations */\n  i64 nDeferredImmCons;               /* Number of deferred imm fk. */\n  Savepoint *pNext;                   /* Parent savepoint (if any) */\n};\n\n/*\n** The following are used as the second parameter to sqlite3Savepoint(),\n** and as the P1 argument to the OP_Savepoint instruction.\n*/\n#define SAVEPOINT_BEGIN      0\n#define SAVEPOINT_RELEASE    1\n#define SAVEPOINT_ROLLBACK   2\n\n\n/*\n** Each SQLite module (virtual table definition) is defined by an\n** instance of the following structure, stored in the sqlite3.aModule\n** hash table.\n*/\nstruct Module {\n  const sqlite3_module *pModule;       /* Callback pointers */\n  const char *zName;                   /* Name passed to create_module() */\n  void *pAux;                          /* pAux passed to create_module() */\n  void (*xDestroy)(void *);            /* Module destructor function */\n  Table *pEpoTab;                      /* Eponymous table for this module */\n};\n\n/*\n** information about each column of an SQL table is held in an instance\n** of this structure.\n*/\nstruct Column {\n  char *zName;     /* Name of this column, \\000, then the type */\n  Expr *pDflt;     /* Default value of this column */\n  char *zColl;     /* Collating sequence.  If NULL, use the default */\n  u8 notNull;      /* An OE_ code for handling a NOT NULL constraint */\n  char affinity;   /* One of the SQLITE_AFF_... values */\n  u8 szEst;        /* Estimated size of value in this column. sizeof(INT)==1 */\n  u8 colFlags;     /* Boolean properties.  See COLFLAG_ defines below */\n};\n\n/* Allowed values for Column.colFlags:\n*/\n#define COLFLAG_PRIMKEY  0x0001    /* Column is part of the primary key */\n#define COLFLAG_HIDDEN   0x0002    /* A hidden column in a virtual table */\n#define COLFLAG_HASTYPE  0x0004    /* Type name follows column name */\n\n/*\n** A \"Collating Sequence\" is defined by an instance of the following\n** structure. Conceptually, a collating sequence consists of a name and\n** a comparison routine that defines the order of that sequence.\n**\n** If CollSeq.xCmp is NULL, it means that the\n** collating sequence is undefined.  Indices built on an undefined\n** collating sequence may not be read or written.\n*/\nstruct CollSeq {\n  char *zName;          /* Name of the collating sequence, UTF-8 encoded */\n  u8 enc;               /* Text encoding handled by xCmp() */\n  void *pUser;          /* First argument to xCmp() */\n  int (*xCmp)(void*,int, const void*, int, const void*);\n  void (*xDel)(void*);  /* Destructor for pUser */\n};\n\n/*\n** A sort order can be either ASC or DESC.\n*/\n#define SQLITE_SO_ASC       0  /* Sort in ascending order */\n#define SQLITE_SO_DESC      1  /* Sort in ascending order */\n#define SQLITE_SO_UNDEFINED -1 /* No sort order specified */\n\n/*\n** Column affinity types.\n**\n** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and\n** 't' for SQLITE_AFF_TEXT.  But we can save a little space and improve\n** the speed a little by numbering the values consecutively.\n**\n** But rather than start with 0 or 1, we begin with 'A'.  That way,\n** when multiple affinity types are concatenated into a string and\n** used as the P4 operand, they will be more readable.\n**\n** Note also that the numeric types are grouped together so that testing\n** for a numeric type is a single comparison.  And the BLOB type is first.\n*/\n#define SQLITE_AFF_BLOB     'A'\n#define SQLITE_AFF_TEXT     'B'\n#define SQLITE_AFF_NUMERIC  'C'\n#define SQLITE_AFF_INTEGER  'D'\n#define SQLITE_AFF_REAL     'E'\n\n#define sqlite3IsNumericAffinity(X)  ((X)>=SQLITE_AFF_NUMERIC)\n\n/*\n** The SQLITE_AFF_MASK values masks off the significant bits of an\n** affinity value.\n*/\n#define SQLITE_AFF_MASK     0x47\n\n/*\n** Additional bit values that can be ORed with an affinity without\n** changing the affinity.\n**\n** The SQLITE_NOTNULL flag is a combination of NULLEQ and JUMPIFNULL.\n** It causes an assert() to fire if either operand to a comparison\n** operator is NULL.  It is added to certain comparison operators to\n** prove that the operands are always NOT NULL.\n*/\n#define SQLITE_KEEPNULL     0x08  /* Used by vector == or <> */\n#define SQLITE_JUMPIFNULL   0x10  /* jumps if either operand is NULL */\n#define SQLITE_STOREP2      0x20  /* Store result in reg[P2] rather than jump */\n#define SQLITE_NULLEQ       0x80  /* NULL=NULL */\n#define SQLITE_NOTNULL      0x90  /* Assert that operands are never NULL */\n\n/*\n** An object of this type is created for each virtual table present in\n** the database schema.\n**\n** If the database schema is shared, then there is one instance of this\n** structure for each database connection (sqlite3*) that uses the shared\n** schema. This is because each database connection requires its own unique\n** instance of the sqlite3_vtab* handle used to access the virtual table\n** implementation. sqlite3_vtab* handles can not be shared between\n** database connections, even when the rest of the in-memory database\n** schema is shared, as the implementation often stores the database\n** connection handle passed to it via the xConnect() or xCreate() method\n** during initialization internally. This database connection handle may\n** then be used by the virtual table implementation to access real tables\n** within the database. So that they appear as part of the callers\n** transaction, these accesses need to be made via the same database\n** connection as that used to execute SQL operations on the virtual table.\n**\n** All VTable objects that correspond to a single table in a shared\n** database schema are initially stored in a linked-list pointed to by\n** the Table.pVTable member variable of the corresponding Table object.\n** When an sqlite3_prepare() operation is required to access the virtual\n** table, it searches the list for the VTable that corresponds to the\n** database connection doing the preparing so as to use the correct\n** sqlite3_vtab* handle in the compiled query.\n**\n** When an in-memory Table object is deleted (for example when the\n** schema is being reloaded for some reason), the VTable objects are not\n** deleted and the sqlite3_vtab* handles are not xDisconnect()ed\n** immediately. Instead, they are moved from the Table.pVTable list to\n** another linked list headed by the sqlite3.pDisconnect member of the\n** corresponding sqlite3 structure. They are then deleted/xDisconnected\n** next time a statement is prepared using said sqlite3*. This is done\n** to avoid deadlock issues involving multiple sqlite3.mutex mutexes.\n** Refer to comments above function sqlite3VtabUnlockList() for an\n** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect\n** list without holding the corresponding sqlite3.mutex mutex.\n**\n** The memory for objects of this type is always allocated by\n** sqlite3DbMalloc(), using the connection handle stored in VTable.db as\n** the first argument.\n*/\nstruct VTable {\n  sqlite3 *db;              /* Database connection associated with this table */\n  Module *pMod;             /* Pointer to module implementation */\n  sqlite3_vtab *pVtab;      /* Pointer to vtab instance */\n  int nRef;                 /* Number of pointers to this structure */\n  u8 bConstraint;           /* True if constraints are supported */\n  int iSavepoint;           /* Depth of the SAVEPOINT stack */\n  VTable *pNext;            /* Next in linked list (see above) */\n};\n\n/*\n** The schema for each SQL table and view is represented in memory\n** by an instance of the following structure.\n*/\nstruct Table {\n  char *zName;         /* Name of the table or view */\n  Column *aCol;        /* Information about each column */\n  Index *pIndex;       /* List of SQL indexes on this table. */\n  Select *pSelect;     /* NULL for tables.  Points to definition if a view. */\n  FKey *pFKey;         /* Linked list of all foreign keys in this table */\n  char *zColAff;       /* String defining the affinity of each column */\n  ExprList *pCheck;    /* All CHECK constraints */\n                       /*   ... also used as column name list in a VIEW */\n  int tnum;            /* Root BTree page for this table */\n  i16 iPKey;           /* If not negative, use aCol[iPKey] as the rowid */\n  i16 nCol;            /* Number of columns in this table */\n  u16 nRef;            /* Number of pointers to this Table */\n  LogEst nRowLogEst;   /* Estimated rows in table - from sqlite_stat1 table */\n  LogEst szTabRow;     /* Estimated size of each table row in bytes */\n#ifdef SQLITE_ENABLE_COSTMULT\n  LogEst costMult;     /* Cost multiplier for using this table */\n#endif\n  u8 tabFlags;         /* Mask of TF_* values */\n  u8 keyConf;          /* What to do in case of uniqueness conflict on iPKey */\n#ifndef SQLITE_OMIT_ALTERTABLE\n  int addColOffset;    /* Offset in CREATE TABLE stmt to add a new column */\n#endif\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  int nModuleArg;      /* Number of arguments to the module */\n  char **azModuleArg;  /* 0: module 1: schema 2: vtab name 3...: args */\n  VTable *pVTable;     /* List of VTable objects. */\n#endif\n  Trigger *pTrigger;   /* List of triggers stored in pSchema */\n  Schema *pSchema;     /* Schema that contains this table */\n  Table *pNextZombie;  /* Next on the Parse.pZombieTab list */\n};\n\n/*\n** Allowed values for Table.tabFlags.\n**\n** TF_OOOHidden applies to tables or view that have hidden columns that are\n** followed by non-hidden columns.  Example:  \"CREATE VIRTUAL TABLE x USING\n** vtab1(a HIDDEN, b);\".  Since \"b\" is a non-hidden column but \"a\" is hidden,\n** the TF_OOOHidden attribute would apply in this case.  Such tables require\n** special handling during INSERT processing.\n*/\n#define TF_Readonly        0x01    /* Read-only system table */\n#define TF_Ephemeral       0x02    /* An ephemeral table */\n#define TF_HasPrimaryKey   0x04    /* Table has a primary key */\n#define TF_Autoincrement   0x08    /* Integer primary key is autoincrement */\n#define TF_Virtual         0x10    /* Is a virtual table */\n#define TF_WithoutRowid    0x20    /* No rowid.  PRIMARY KEY is the key */\n#define TF_NoVisibleRowid  0x40    /* No user-visible \"rowid\" column */\n#define TF_OOOHidden       0x80    /* Out-of-Order hidden columns */\n\n\n/*\n** Test to see whether or not a table is a virtual table.  This is\n** done as a macro so that it will be optimized out when virtual\n** table support is omitted from the build.\n*/\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n#  define IsVirtual(X)      (((X)->tabFlags & TF_Virtual)!=0)\n#else\n#  define IsVirtual(X)      0\n#endif\n\n/*\n** Macros to determine if a column is hidden.  IsOrdinaryHiddenColumn()\n** only works for non-virtual tables (ordinary tables and views) and is\n** always false unless SQLITE_ENABLE_HIDDEN_COLUMNS is defined.  The\n** IsHiddenColumn() macro is general purpose.\n*/\n#if defined(SQLITE_ENABLE_HIDDEN_COLUMNS)\n#  define IsHiddenColumn(X)         (((X)->colFlags & COLFLAG_HIDDEN)!=0)\n#  define IsOrdinaryHiddenColumn(X) (((X)->colFlags & COLFLAG_HIDDEN)!=0)\n#elif !defined(SQLITE_OMIT_VIRTUALTABLE)\n#  define IsHiddenColumn(X)         (((X)->colFlags & COLFLAG_HIDDEN)!=0)\n#  define IsOrdinaryHiddenColumn(X) 0\n#else\n#  define IsHiddenColumn(X)         0\n#  define IsOrdinaryHiddenColumn(X) 0\n#endif\n\n\n/* Does the table have a rowid */\n#define HasRowid(X)     (((X)->tabFlags & TF_WithoutRowid)==0)\n#define VisibleRowid(X) (((X)->tabFlags & TF_NoVisibleRowid)==0)\n\n/*\n** Each foreign key constraint is an instance of the following structure.\n**\n** A foreign key is associated with two tables.  The \"from\" table is\n** the table that contains the REFERENCES clause that creates the foreign\n** key.  The \"to\" table is the table that is named in the REFERENCES clause.\n** Consider this example:\n**\n**     CREATE TABLE ex1(\n**       a INTEGER PRIMARY KEY,\n**       b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)\n**     );\n**\n** For foreign key \"fk1\", the from-table is \"ex1\" and the to-table is \"ex2\".\n** Equivalent names:\n**\n**     from-table == child-table\n**       to-table == parent-table\n**\n** Each REFERENCES clause generates an instance of the following structure\n** which is attached to the from-table.  The to-table need not exist when\n** the from-table is created.  The existence of the to-table is not checked.\n**\n** The list of all parents for child Table X is held at X.pFKey.\n**\n** A list of all children for a table named Z (which might not even exist)\n** is held in Schema.fkeyHash with a hash key of Z.\n*/\nstruct FKey {\n  Table *pFrom;     /* Table containing the REFERENCES clause (aka: Child) */\n  FKey *pNextFrom;  /* Next FKey with the same in pFrom. Next parent of pFrom */\n  char *zTo;        /* Name of table that the key points to (aka: Parent) */\n  FKey *pNextTo;    /* Next with the same zTo. Next child of zTo. */\n  FKey *pPrevTo;    /* Previous with the same zTo */\n  int nCol;         /* Number of columns in this key */\n  /* EV: R-30323-21917 */\n  u8 isDeferred;       /* True if constraint checking is deferred till COMMIT */\n  u8 aAction[2];        /* ON DELETE and ON UPDATE actions, respectively */\n  Trigger *apTrigger[2];/* Triggers for aAction[] actions */\n  struct sColMap {      /* Mapping of columns in pFrom to columns in zTo */\n    int iFrom;            /* Index of column in pFrom */\n    char *zCol;           /* Name of column in zTo.  If NULL use PRIMARY KEY */\n  } aCol[1];            /* One entry for each of nCol columns */\n};\n\n/*\n** SQLite supports many different ways to resolve a constraint\n** error.  ROLLBACK processing means that a constraint violation\n** causes the operation in process to fail and for the current transaction\n** to be rolled back.  ABORT processing means the operation in process\n** fails and any prior changes from that one operation are backed out,\n** but the transaction is not rolled back.  FAIL processing means that\n** the operation in progress stops and returns an error code.  But prior\n** changes due to the same operation are not backed out and no rollback\n** occurs.  IGNORE means that the particular row that caused the constraint\n** error is not inserted or updated.  Processing continues and no error\n** is returned.  REPLACE means that preexisting database rows that caused\n** a UNIQUE constraint violation are removed so that the new insert or\n** update can proceed.  Processing continues and no error is reported.\n**\n** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.\n** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the\n** same as ROLLBACK for DEFERRED keys.  SETNULL means that the foreign\n** key is set to NULL.  CASCADE means that a DELETE or UPDATE of the\n** referenced table row is propagated into the row that holds the\n** foreign key.\n**\n** The following symbolic values are used to record which type\n** of action to take.\n*/\n#define OE_None     0   /* There is no constraint to check */\n#define OE_Rollback 1   /* Fail the operation and rollback the transaction */\n#define OE_Abort    2   /* Back out changes but do no rollback transaction */\n#define OE_Fail     3   /* Stop the operation but leave all prior changes */\n#define OE_Ignore   4   /* Ignore the error. Do not do the INSERT or UPDATE */\n#define OE_Replace  5   /* Delete existing record, then do INSERT or UPDATE */\n\n#define OE_Restrict 6   /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */\n#define OE_SetNull  7   /* Set the foreign key value to NULL */\n#define OE_SetDflt  8   /* Set the foreign key value to its default */\n#define OE_Cascade  9   /* Cascade the changes */\n\n#define OE_Default  10  /* Do whatever the default action is */\n\n\n/*\n** An instance of the following structure is passed as the first\n** argument to sqlite3VdbeKeyCompare and is used to control the\n** comparison of the two index keys.\n**\n** Note that aSortOrder[] and aColl[] have nField+1 slots.  There\n** are nField slots for the columns of an index then one extra slot\n** for the rowid at the end.\n*/\nstruct KeyInfo {\n  u32 nRef;           /* Number of references to this KeyInfo object */\n  u8 enc;             /* Text encoding - one of the SQLITE_UTF* values */\n  u16 nField;         /* Number of key columns in the index */\n  u16 nXField;        /* Number of columns beyond the key columns */\n  sqlite3 *db;        /* The database connection */\n  u8 *aSortOrder;     /* Sort order for each column. */\n  CollSeq *aColl[1];  /* Collating sequence for each term of the key */\n};\n\n/*\n** This object holds a record which has been parsed out into individual\n** fields, for the purposes of doing a comparison.\n**\n** A record is an object that contains one or more fields of data.\n** Records are used to store the content of a table row and to store\n** the key of an index.  A blob encoding of a record is created by\n** the OP_MakeRecord opcode of the VDBE and is disassembled by the\n** OP_Column opcode.\n**\n** An instance of this object serves as a \"key\" for doing a search on\n** an index b+tree. The goal of the search is to find the entry that\n** is closed to the key described by this object.  This object might hold\n** just a prefix of the key.  The number of fields is given by\n** pKeyInfo->nField.\n**\n** The r1 and r2 fields are the values to return if this key is less than\n** or greater than a key in the btree, respectively.  These are normally\n** -1 and +1 respectively, but might be inverted to +1 and -1 if the b-tree\n** is in DESC order.\n**\n** The key comparison functions actually return default_rc when they find\n** an equals comparison.  default_rc can be -1, 0, or +1.  If there are\n** multiple entries in the b-tree with the same key (when only looking\n** at the first pKeyInfo->nFields,) then default_rc can be set to -1 to\n** cause the search to find the last match, or +1 to cause the search to\n** find the first match.\n**\n** The key comparison functions will set eqSeen to true if they ever\n** get and equal results when comparing this structure to a b-tree record.\n** When default_rc!=0, the search might end up on the record immediately\n** before the first match or immediately after the last match.  The\n** eqSeen field will indicate whether or not an exact match exists in the\n** b-tree.\n*/\nstruct UnpackedRecord {\n  KeyInfo *pKeyInfo;  /* Collation and sort-order information */\n  Mem *aMem;          /* Values */\n  u16 nField;         /* Number of entries in apMem[] */\n  i8 default_rc;      /* Comparison result if keys are equal */\n  u8 errCode;         /* Error detected by xRecordCompare (CORRUPT or NOMEM) */\n  i8 r1;              /* Value to return if (lhs > rhs) */\n  i8 r2;              /* Value to return if (rhs < lhs) */\n  u8 eqSeen;          /* True if an equality comparison has been seen */\n};\n\n\n/*\n** Each SQL index is represented in memory by an\n** instance of the following structure.\n**\n** The columns of the table that are to be indexed are described\n** by the aiColumn[] field of this structure.  For example, suppose\n** we have the following table and index:\n**\n**     CREATE TABLE Ex1(c1 int, c2 int, c3 text);\n**     CREATE INDEX Ex2 ON Ex1(c3,c1);\n**\n** In the Table structure describing Ex1, nCol==3 because there are\n** three columns in the table.  In the Index structure describing\n** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed.\n** The value of aiColumn is {2, 0}.  aiColumn[0]==2 because the\n** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].\n** The second column to be indexed (c1) has an index of 0 in\n** Ex1.aCol[], hence Ex2.aiColumn[1]==0.\n**\n** The Index.onError field determines whether or not the indexed columns\n** must be unique and what to do if they are not.  When Index.onError=OE_None,\n** it means this is not a unique index.  Otherwise it is a unique index\n** and the value of Index.onError indicate the which conflict resolution\n** algorithm to employ whenever an attempt is made to insert a non-unique\n** element.\n**\n** While parsing a CREATE TABLE or CREATE INDEX statement in order to\n** generate VDBE code (as opposed to parsing one read from an sqlite_master\n** table as part of parsing an existing database schema), transient instances\n** of this structure may be created. In this case the Index.tnum variable is\n** used to store the address of a VDBE instruction, not a database page\n** number (it cannot - the database page is not allocated until the VDBE\n** program is executed). See convertToWithoutRowidTable() for details.\n*/\nstruct Index {\n  char *zName;             /* Name of this index */\n  i16 *aiColumn;           /* Which columns are used by this index.  1st is 0 */\n  LogEst *aiRowLogEst;     /* From ANALYZE: Est. rows selected by each column */\n  Table *pTable;           /* The SQL table being indexed */\n  char *zColAff;           /* String defining the affinity of each column */\n  Index *pNext;            /* The next index associated with the same table */\n  Schema *pSchema;         /* Schema containing this index */\n  u8 *aSortOrder;          /* for each column: True==DESC, False==ASC */\n  const char **azColl;     /* Array of collation sequence names for index */\n  Expr *pPartIdxWhere;     /* WHERE clause for partial indices */\n  ExprList *aColExpr;      /* Column expressions */\n  int tnum;                /* DB Page containing root of this index */\n  LogEst szIdxRow;         /* Estimated average row size in bytes */\n  u16 nKeyCol;             /* Number of columns forming the key */\n  u16 nColumn;             /* Number of columns stored in the index */\n  u8 onError;              /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */\n  unsigned idxType:2;      /* 1==UNIQUE, 2==PRIMARY KEY, 0==CREATE INDEX */\n  unsigned bUnordered:1;   /* Use this index for == or IN queries only */\n  unsigned uniqNotNull:1;  /* True if UNIQUE and NOT NULL for all columns */\n  unsigned isResized:1;    /* True if resizeIndexObject() has been called */\n  unsigned isCovering:1;   /* True if this is a covering index */\n  unsigned noSkipScan:1;   /* Do not try to use skip-scan if true */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  int nSample;             /* Number of elements in aSample[] */\n  int nSampleCol;          /* Size of IndexSample.anEq[] and so on */\n  tRowcnt *aAvgEq;         /* Average nEq values for keys not in aSample */\n  IndexSample *aSample;    /* Samples of the left-most key */\n  tRowcnt *aiRowEst;       /* Non-logarithmic stat1 data for this index */\n  tRowcnt nRowEst0;        /* Non-logarithmic number of rows in the index */\n#endif\n};\n\n/*\n** Allowed values for Index.idxType\n*/\n#define SQLITE_IDXTYPE_APPDEF      0   /* Created using CREATE INDEX */\n#define SQLITE_IDXTYPE_UNIQUE      1   /* Implements a UNIQUE constraint */\n#define SQLITE_IDXTYPE_PRIMARYKEY  2   /* Is the PRIMARY KEY for the table */\n\n/* Return true if index X is a PRIMARY KEY index */\n#define IsPrimaryKeyIndex(X)  ((X)->idxType==SQLITE_IDXTYPE_PRIMARYKEY)\n\n/* Return true if index X is a UNIQUE index */\n#define IsUniqueIndex(X)      ((X)->onError!=OE_None)\n\n/* The Index.aiColumn[] values are normally positive integer.  But\n** there are some negative values that have special meaning:\n*/\n#define XN_ROWID     (-1)     /* Indexed column is the rowid */\n#define XN_EXPR      (-2)     /* Indexed column is an expression */\n\n/*\n** Each sample stored in the sqlite_stat3 table is represented in memory\n** using a structure of this type.  See documentation at the top of the\n** analyze.c source file for additional information.\n*/\nstruct IndexSample {\n  void *p;          /* Pointer to sampled record */\n  int n;            /* Size of record in bytes */\n  tRowcnt *anEq;    /* Est. number of rows where the key equals this sample */\n  tRowcnt *anLt;    /* Est. number of rows where key is less than this sample */\n  tRowcnt *anDLt;   /* Est. number of distinct keys less than this sample */\n};\n\n/*\n** Each token coming out of the lexer is an instance of\n** this structure.  Tokens are also used as part of an expression.\n**\n** Note if Token.z==0 then Token.dyn and Token.n are undefined and\n** may contain random values.  Do not make any assumptions about Token.dyn\n** and Token.n when Token.z==0.\n*/\nstruct Token {\n  const char *z;     /* Text of the token.  Not NULL-terminated! */\n  unsigned int n;    /* Number of characters in this token */\n};\n\n/*\n** An instance of this structure contains information needed to generate\n** code for a SELECT that contains aggregate functions.\n**\n** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a\n** pointer to this structure.  The Expr.iColumn field is the index in\n** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate\n** code for that node.\n**\n** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the\n** original Select structure that describes the SELECT statement.  These\n** fields do not need to be freed when deallocating the AggInfo structure.\n*/\nstruct AggInfo {\n  u8 directMode;          /* Direct rendering mode means take data directly\n                          ** from source tables rather than from accumulators */\n  u8 useSortingIdx;       /* In direct mode, reference the sorting index rather\n                          ** than the source table */\n  int sortingIdx;         /* Cursor number of the sorting index */\n  int sortingIdxPTab;     /* Cursor number of pseudo-table */\n  int nSortingColumn;     /* Number of columns in the sorting index */\n  int mnReg, mxReg;       /* Range of registers allocated for aCol and aFunc */\n  ExprList *pGroupBy;     /* The group by clause */\n  struct AggInfo_col {    /* For each column used in source tables */\n    Table *pTab;             /* Source table */\n    int iTable;              /* Cursor number of the source table */\n    int iColumn;             /* Column number within the source table */\n    int iSorterColumn;       /* Column number in the sorting index */\n    int iMem;                /* Memory location that acts as accumulator */\n    Expr *pExpr;             /* The original expression */\n  } *aCol;\n  int nColumn;            /* Number of used entries in aCol[] */\n  int nAccumulator;       /* Number of columns that show through to the output.\n                          ** Additional columns are used only as parameters to\n                          ** aggregate functions */\n  struct AggInfo_func {   /* For each aggregate function */\n    Expr *pExpr;             /* Expression encoding the function */\n    FuncDef *pFunc;          /* The aggregate function implementation */\n    int iMem;                /* Memory location that acts as accumulator */\n    int iDistinct;           /* Ephemeral table used to enforce DISTINCT */\n  } *aFunc;\n  int nFunc;              /* Number of entries in aFunc[] */\n};\n\n/*\n** The datatype ynVar is a signed integer, either 16-bit or 32-bit.\n** Usually it is 16-bits.  But if SQLITE_MAX_VARIABLE_NUMBER is greater\n** than 32767 we have to make it 32-bit.  16-bit is preferred because\n** it uses less memory in the Expr object, which is a big memory user\n** in systems with lots of prepared statements.  And few applications\n** need more than about 10 or 20 variables.  But some extreme users want\n** to have prepared statements with over 32767 variables, and for them\n** the option is available (at compile-time).\n*/\n#if SQLITE_MAX_VARIABLE_NUMBER<=32767\ntypedef i16 ynVar;\n#else\ntypedef int ynVar;\n#endif\n\n/*\n** Each node of an expression in the parse tree is an instance\n** of this structure.\n**\n** Expr.op is the opcode. The integer parser token codes are reused\n** as opcodes here. For example, the parser defines TK_GE to be an integer\n** code representing the \">=\" operator. This same integer code is reused\n** to represent the greater-than-or-equal-to operator in the expression\n** tree.\n**\n** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB,\n** or TK_STRING), then Expr.token contains the text of the SQL literal. If\n** the expression is a variable (TK_VARIABLE), then Expr.token contains the\n** variable name. Finally, if the expression is an SQL function (TK_FUNCTION),\n** then Expr.token contains the name of the function.\n**\n** Expr.pRight and Expr.pLeft are the left and right subexpressions of a\n** binary operator. Either or both may be NULL.\n**\n** Expr.x.pList is a list of arguments if the expression is an SQL function,\n** a CASE expression or an IN expression of the form \"<lhs> IN (<y>, <z>...)\".\n** Expr.x.pSelect is used if the expression is a sub-select or an expression of\n** the form \"<lhs> IN (SELECT ...)\". If the EP_xIsSelect bit is set in the\n** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is\n** valid.\n**\n** An expression of the form ID or ID.ID refers to a column in a table.\n** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is\n** the integer cursor number of a VDBE cursor pointing to that table and\n** Expr.iColumn is the column number for the specific column.  If the\n** expression is used as a result in an aggregate SELECT, then the\n** value is also stored in the Expr.iAgg column in the aggregate so that\n** it can be accessed after all aggregates are computed.\n**\n** If the expression is an unbound variable marker (a question mark\n** character '?' in the original SQL) then the Expr.iTable holds the index\n** number for that variable.\n**\n** If the expression is a subquery then Expr.iColumn holds an integer\n** register number containing the result of the subquery.  If the\n** subquery gives a constant result, then iTable is -1.  If the subquery\n** gives a different answer at different times during statement processing\n** then iTable is the address of a subroutine that computes the subquery.\n**\n** If the Expr is of type OP_Column, and the table it is selecting from\n** is a disk table or the \"old.*\" pseudo-table, then pTab points to the\n** corresponding table definition.\n**\n** ALLOCATION NOTES:\n**\n** Expr objects can use a lot of memory space in database schema.  To\n** help reduce memory requirements, sometimes an Expr object will be\n** truncated.  And to reduce the number of memory allocations, sometimes\n** two or more Expr objects will be stored in a single memory allocation,\n** together with Expr.zToken strings.\n**\n** If the EP_Reduced and EP_TokenOnly flags are set when\n** an Expr object is truncated.  When EP_Reduced is set, then all\n** the child Expr objects in the Expr.pLeft and Expr.pRight subtrees\n** are contained within the same memory allocation.  Note, however, that\n** the subtrees in Expr.x.pList or Expr.x.pSelect are always separately\n** allocated, regardless of whether or not EP_Reduced is set.\n*/\nstruct Expr {\n  u8 op;                 /* Operation performed by this node */\n  char affinity;         /* The affinity of the column or 0 if not a column */\n  u32 flags;             /* Various flags.  EP_* See below */\n  union {\n    char *zToken;          /* Token value. Zero terminated and dequoted */\n    int iValue;            /* Non-negative integer value if EP_IntValue */\n  } u;\n\n  /* If the EP_TokenOnly flag is set in the Expr.flags mask, then no\n  ** space is allocated for the fields below this point. An attempt to\n  ** access them will result in a segfault or malfunction.\n  *********************************************************************/\n\n  Expr *pLeft;           /* Left subnode */\n  Expr *pRight;          /* Right subnode */\n  union {\n    ExprList *pList;     /* op = IN, EXISTS, SELECT, CASE, FUNCTION, BETWEEN */\n    Select *pSelect;     /* EP_xIsSelect and op = IN, EXISTS, SELECT */\n  } x;\n\n  /* If the EP_Reduced flag is set in the Expr.flags mask, then no\n  ** space is allocated for the fields below this point. An attempt to\n  ** access them will result in a segfault or malfunction.\n  *********************************************************************/\n\n#if SQLITE_MAX_EXPR_DEPTH>0\n  int nHeight;           /* Height of the tree headed by this node */\n#endif\n  int iTable;            /* TK_COLUMN: cursor number of table holding column\n                         ** TK_REGISTER: register number\n                         ** TK_TRIGGER: 1 -> new, 0 -> old\n                         ** EP_Unlikely:  134217728 times likelihood\n                         ** TK_SELECT: 1st register of result vector */\n  ynVar iColumn;         /* TK_COLUMN: column index.  -1 for rowid.\n                         ** TK_VARIABLE: variable number (always >= 1).\n                         ** TK_SELECT_COLUMN: column of the result vector */\n  i16 iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */\n  i16 iRightJoinTable;   /* If EP_FromJoin, the right table of the join */\n  u8 op2;                /* TK_REGISTER: original value of Expr.op\n                         ** TK_COLUMN: the value of p5 for OP_Column\n                         ** TK_AGG_FUNCTION: nesting depth */\n  AggInfo *pAggInfo;     /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */\n  Table *pTab;           /* Table for TK_COLUMN expressions. */\n};\n\n/*\n** The following are the meanings of bits in the Expr.flags field.\n*/\n#define EP_FromJoin  0x000001 /* Originates in ON/USING clause of outer join */\n#define EP_Agg       0x000002 /* Contains one or more aggregate functions */\n#define EP_Resolved  0x000004 /* IDs have been resolved to COLUMNs */\n#define EP_Error     0x000008 /* Expression contains one or more errors */\n#define EP_Distinct  0x000010 /* Aggregate function with DISTINCT keyword */\n#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */\n#define EP_DblQuoted 0x000040 /* token.z was originally in \"...\" */\n#define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */\n#define EP_Collate   0x000100 /* Tree contains a TK_COLLATE operator */\n#define EP_Generic   0x000200 /* Ignore COLLATE or affinity on this tree */\n#define EP_IntValue  0x000400 /* Integer value contained in u.iValue */\n#define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */\n#define EP_Skip      0x001000 /* COLLATE, AS, or UNLIKELY */\n#define EP_Reduced   0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */\n#define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */\n#define EP_Static    0x008000 /* Held in memory not obtained from malloc() */\n#define EP_MemToken  0x010000 /* Need to sqlite3DbFree() Expr.zToken */\n#define EP_NoReduce  0x020000 /* Cannot EXPRDUP_REDUCE this Expr */\n#define EP_Unlikely  0x040000 /* unlikely() or likelihood() function */\n#define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */\n#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */\n#define EP_Subquery  0x200000 /* Tree contains a TK_SELECT operator */\n#define EP_Alias     0x400000 /* Is an alias for a result set column */\n#define EP_Leaf      0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */\n\n/*\n** Combinations of two or more EP_* flags\n*/\n#define EP_Propagate (EP_Collate|EP_Subquery) /* Propagate these bits up tree */\n\n/*\n** These macros can be used to test, set, or clear bits in the\n** Expr.flags field.\n*/\n#define ExprHasProperty(E,P)     (((E)->flags&(P))!=0)\n#define ExprHasAllProperty(E,P)  (((E)->flags&(P))==(P))\n#define ExprSetProperty(E,P)     (E)->flags|=(P)\n#define ExprClearProperty(E,P)   (E)->flags&=~(P)\n\n/* The ExprSetVVAProperty() macro is used for Verification, Validation,\n** and Accreditation only.  It works like ExprSetProperty() during VVA\n** processes but is a no-op for delivery.\n*/\n#ifdef SQLITE_DEBUG\n# define ExprSetVVAProperty(E,P)  (E)->flags|=(P)\n#else\n# define ExprSetVVAProperty(E,P)\n#endif\n\n/*\n** Macros to determine the number of bytes required by a normal Expr\n** struct, an Expr struct with the EP_Reduced flag set in Expr.flags\n** and an Expr struct with the EP_TokenOnly flag set.\n*/\n#define EXPR_FULLSIZE           sizeof(Expr)           /* Full size */\n#define EXPR_REDUCEDSIZE        offsetof(Expr,iTable)  /* Common features */\n#define EXPR_TOKENONLYSIZE      offsetof(Expr,pLeft)   /* Fewer features */\n\n/*\n** Flags passed to the sqlite3ExprDup() function. See the header comment\n** above sqlite3ExprDup() for details.\n*/\n#define EXPRDUP_REDUCE         0x0001  /* Used reduced-size Expr nodes */\n\n/*\n** A list of expressions.  Each expression may optionally have a\n** name.  An expr/name combination can be used in several ways, such\n** as the list of \"expr AS ID\" fields following a \"SELECT\" or in the\n** list of \"ID = expr\" items in an UPDATE.  A list of expressions can\n** also be used as the argument to a function, in which case the a.zName\n** field is not used.\n**\n** By default the Expr.zSpan field holds a human-readable description of\n** the expression that is used in the generation of error messages and\n** column labels.  In this case, Expr.zSpan is typically the text of a\n** column expression as it exists in a SELECT statement.  However, if\n** the bSpanIsTab flag is set, then zSpan is overloaded to mean the name\n** of the result column in the form: DATABASE.TABLE.COLUMN.  This later\n** form is used for name resolution with nested FROM clauses.\n*/\nstruct ExprList {\n  int nExpr;             /* Number of expressions on the list */\n  struct ExprList_item { /* For each expression in the list */\n    Expr *pExpr;            /* The list of expressions */\n    char *zName;            /* Token associated with this expression */\n    char *zSpan;            /* Original text of the expression */\n    u8 sortOrder;           /* 1 for DESC or 0 for ASC */\n    unsigned done :1;       /* A flag to indicate when processing is finished */\n    unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */\n    unsigned reusable :1;   /* Constant expression is reusable */\n    union {\n      struct {\n        u16 iOrderByCol;      /* For ORDER BY, column number in result set */\n        u16 iAlias;           /* Index into Parse.aAlias[] for zName */\n      } x;\n      int iConstExprReg;      /* Register in which Expr value is cached */\n    } u;\n  } *a;                  /* Alloc a power of two greater or equal to nExpr */\n};\n\n/*\n** An instance of this structure is used by the parser to record both\n** the parse tree for an expression and the span of input text for an\n** expression.\n*/\nstruct ExprSpan {\n  Expr *pExpr;          /* The expression parse tree */\n  const char *zStart;   /* First character of input text */\n  const char *zEnd;     /* One character past the end of input text */\n};\n\n/*\n** An instance of this structure can hold a simple list of identifiers,\n** such as the list \"a,b,c\" in the following statements:\n**\n**      INSERT INTO t(a,b,c) VALUES ...;\n**      CREATE INDEX idx ON t(a,b,c);\n**      CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;\n**\n** The IdList.a.idx field is used when the IdList represents the list of\n** column names after a table name in an INSERT statement.  In the statement\n**\n**     INSERT INTO t(a,b,c) ...\n**\n** If \"a\" is the k-th column of table \"t\", then IdList.a[0].idx==k.\n*/\nstruct IdList {\n  struct IdList_item {\n    char *zName;      /* Name of the identifier */\n    int idx;          /* Index in some Table.aCol[] of a column named zName */\n  } *a;\n  int nId;         /* Number of identifiers on the list */\n};\n\n/*\n** The bitmask datatype defined below is used for various optimizations.\n**\n** Changing this from a 64-bit to a 32-bit type limits the number of\n** tables in a join to 32 instead of 64.  But it also reduces the size\n** of the library by 738 bytes on ix86.\n*/\n#ifdef SQLITE_BITMASK_TYPE\n  typedef SQLITE_BITMASK_TYPE Bitmask;\n#else\n  typedef u64 Bitmask;\n#endif\n\n/*\n** The number of bits in a Bitmask.  \"BMS\" means \"BitMask Size\".\n*/\n#define BMS  ((int)(sizeof(Bitmask)*8))\n\n/*\n** A bit in a Bitmask\n*/\n#define MASKBIT(n)   (((Bitmask)1)<<(n))\n#define MASKBIT32(n) (((unsigned int)1)<<(n))\n#define ALLBITS      ((Bitmask)-1)\n\n/*\n** The following structure describes the FROM clause of a SELECT statement.\n** Each table or subquery in the FROM clause is a separate element of\n** the SrcList.a[] array.\n**\n** With the addition of multiple database support, the following structure\n** can also be used to describe a particular table such as the table that\n** is modified by an INSERT, DELETE, or UPDATE statement.  In standard SQL,\n** such a table must be a simple name: ID.  But in SQLite, the table can\n** now be identified by a database name, a dot, then the table name: ID.ID.\n**\n** The jointype starts out showing the join type between the current table\n** and the next table on the list.  The parser builds the list this way.\n** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each\n** jointype expresses the join between the table and the previous table.\n**\n** In the colUsed field, the high-order bit (bit 63) is set if the table\n** contains more than 63 columns and the 64-th or later column is used.\n*/\nstruct SrcList {\n  int nSrc;        /* Number of tables or subqueries in the FROM clause */\n  u32 nAlloc;      /* Number of entries allocated in a[] below */\n  struct SrcList_item {\n    Schema *pSchema;  /* Schema to which this item is fixed */\n    char *zDatabase;  /* Name of database holding this table */\n    char *zName;      /* Name of the table */\n    char *zAlias;     /* The \"B\" part of a \"A AS B\" phrase.  zName is the \"A\" */\n    Table *pTab;      /* An SQL table corresponding to zName */\n    Select *pSelect;  /* A SELECT statement used in place of a table name */\n    int addrFillSub;  /* Address of subroutine to manifest a subquery */\n    int regReturn;    /* Register holding return address of addrFillSub */\n    int regResult;    /* Registers holding results of a co-routine */\n    struct {\n      u8 jointype;      /* Type of join between this table and the previous */\n      unsigned notIndexed :1;    /* True if there is a NOT INDEXED clause */\n      unsigned isIndexedBy :1;   /* True if there is an INDEXED BY clause */\n      unsigned isTabFunc :1;     /* True if table-valued-function syntax */\n      unsigned isCorrelated :1;  /* True if sub-query is correlated */\n      unsigned viaCoroutine :1;  /* Implemented as a co-routine */\n      unsigned isRecursive :1;   /* True for recursive reference in WITH */\n    } fg;\n#ifndef SQLITE_OMIT_EXPLAIN\n    u8 iSelectId;     /* If pSelect!=0, the id of the sub-select in EQP */\n#endif\n    int iCursor;      /* The VDBE cursor number used to access this table */\n    Expr *pOn;        /* The ON clause of a join */\n    IdList *pUsing;   /* The USING clause of a join */\n    Bitmask colUsed;  /* Bit N (1<<N) set if column N of pTab is used */\n    union {\n      char *zIndexedBy;    /* Identifier from \"INDEXED BY <zIndex>\" clause */\n      ExprList *pFuncArg;  /* Arguments to table-valued-function */\n    } u1;\n    Index *pIBIndex;  /* Index structure corresponding to u1.zIndexedBy */\n  } a[1];             /* One entry for each identifier on the list */\n};\n\n/*\n** Permitted values of the SrcList.a.jointype field\n*/\n#define JT_INNER     0x0001    /* Any kind of inner or cross join */\n#define JT_CROSS     0x0002    /* Explicit use of the CROSS keyword */\n#define JT_NATURAL   0x0004    /* True for a \"natural\" join */\n#define JT_LEFT      0x0008    /* Left outer join */\n#define JT_RIGHT     0x0010    /* Right outer join */\n#define JT_OUTER     0x0020    /* The \"OUTER\" keyword is present */\n#define JT_ERROR     0x0040    /* unknown or unsupported join type */\n\n\n/*\n** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin()\n** and the WhereInfo.wctrlFlags member.\n**\n** Value constraints (enforced via assert()):\n**     WHERE_USE_LIMIT  == SF_FixedLimit\n*/\n#define WHERE_ORDERBY_NORMAL   0x0000 /* No-op */\n#define WHERE_ORDERBY_MIN      0x0001 /* ORDER BY processing for min() func */\n#define WHERE_ORDERBY_MAX      0x0002 /* ORDER BY processing for max() func */\n#define WHERE_ONEPASS_DESIRED  0x0004 /* Want to do one-pass UPDATE/DELETE */\n#define WHERE_ONEPASS_MULTIROW 0x0008 /* ONEPASS is ok with multiple rows */\n#define WHERE_DUPLICATES_OK    0x0010 /* Ok to return a row more than once */\n#define WHERE_OR_SUBCLAUSE     0x0020 /* Processing a sub-WHERE as part of\n                                      ** the OR optimization  */\n#define WHERE_GROUPBY          0x0040 /* pOrderBy is really a GROUP BY */\n#define WHERE_DISTINCTBY       0x0080 /* pOrderby is really a DISTINCT clause */\n#define WHERE_WANT_DISTINCT    0x0100 /* All output needs to be distinct */\n#define WHERE_SORTBYGROUP      0x0200 /* Support sqlite3WhereIsSorted() */\n#define WHERE_SEEK_TABLE       0x0400 /* Do not defer seeks on main table */\n#define WHERE_ORDERBY_LIMIT    0x0800 /* ORDERBY+LIMIT on the inner loop */\n                        /*     0x1000    not currently used */\n                        /*     0x2000    not currently used */\n#define WHERE_USE_LIMIT        0x4000 /* Use the LIMIT in cost estimates */\n                        /*     0x8000    not currently used */\n\n/* Allowed return values from sqlite3WhereIsDistinct()\n*/\n#define WHERE_DISTINCT_NOOP      0  /* DISTINCT keyword not used */\n#define WHERE_DISTINCT_UNIQUE    1  /* No duplicates */\n#define WHERE_DISTINCT_ORDERED   2  /* All duplicates are adjacent */\n#define WHERE_DISTINCT_UNORDERED 3  /* Duplicates are scattered */\n\n/*\n** A NameContext defines a context in which to resolve table and column\n** names.  The context consists of a list of tables (the pSrcList) field and\n** a list of named expression (pEList).  The named expression list may\n** be NULL.  The pSrc corresponds to the FROM clause of a SELECT or\n** to the table being operated on by INSERT, UPDATE, or DELETE.  The\n** pEList corresponds to the result set of a SELECT and is NULL for\n** other statements.\n**\n** NameContexts can be nested.  When resolving names, the inner-most\n** context is searched first.  If no match is found, the next outer\n** context is checked.  If there is still no match, the next context\n** is checked.  This process continues until either a match is found\n** or all contexts are check.  When a match is found, the nRef member of\n** the context containing the match is incremented.\n**\n** Each subquery gets a new NameContext.  The pNext field points to the\n** NameContext in the parent query.  Thus the process of scanning the\n** NameContext list corresponds to searching through successively outer\n** subqueries looking for a match.\n*/\nstruct NameContext {\n  Parse *pParse;       /* The parser */\n  SrcList *pSrcList;   /* One or more tables used to resolve names */\n  ExprList *pEList;    /* Optional list of result-set columns */\n  AggInfo *pAggInfo;   /* Information about aggregates at this level */\n  NameContext *pNext;  /* Next outer name context.  NULL for outermost */\n  int nRef;            /* Number of names resolved by this context */\n  int nErr;            /* Number of errors encountered while resolving names */\n  u16 ncFlags;         /* Zero or more NC_* flags defined below */\n};\n\n/*\n** Allowed values for the NameContext, ncFlags field.\n**\n** Value constraints (all checked via assert()):\n**    NC_HasAgg    == SF_HasAgg\n**    NC_MinMaxAgg == SF_MinMaxAgg == SQLITE_FUNC_MINMAX\n**\n*/\n#define NC_AllowAgg  0x0001  /* Aggregate functions are allowed here */\n#define NC_PartIdx   0x0002  /* True if resolving a partial index WHERE */\n#define NC_IsCheck   0x0004  /* True if resolving names in a CHECK constraint */\n#define NC_InAggFunc 0x0008  /* True if analyzing arguments to an agg func */\n#define NC_HasAgg    0x0010  /* One or more aggregate functions seen */\n#define NC_IdxExpr   0x0020  /* True if resolving columns of CREATE INDEX */\n#define NC_VarSelect 0x0040  /* A correlated subquery has been seen */\n#define NC_MinMaxAgg 0x1000  /* min/max aggregates seen.  See note above */\n\n/*\n** An instance of the following structure contains all information\n** needed to generate code for a single SELECT statement.\n**\n** nLimit is set to -1 if there is no LIMIT clause.  nOffset is set to 0.\n** If there is a LIMIT clause, the parser sets nLimit to the value of the\n** limit and nOffset to the value of the offset (or 0 if there is not\n** offset).  But later on, nLimit and nOffset become the memory locations\n** in the VDBE that record the limit and offset counters.\n**\n** addrOpenEphm[] entries contain the address of OP_OpenEphemeral opcodes.\n** These addresses must be stored so that we can go back and fill in\n** the P4_KEYINFO and P2 parameters later.  Neither the KeyInfo nor\n** the number of columns in P2 can be computed at the same time\n** as the OP_OpenEphm instruction is coded because not\n** enough information about the compound query is known at that point.\n** The KeyInfo for addrOpenTran[0] and [1] contains collating sequences\n** for the result set.  The KeyInfo for addrOpenEphm[2] contains collating\n** sequences for the ORDER BY clause.\n*/\nstruct Select {\n  ExprList *pEList;      /* The fields of the result */\n  u8 op;                 /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */\n  LogEst nSelectRow;     /* Estimated number of result rows */\n  u32 selFlags;          /* Various SF_* values */\n  int iLimit, iOffset;   /* Memory registers holding LIMIT & OFFSET counters */\n#if SELECTTRACE_ENABLED\n  char zSelName[12];     /* Symbolic name of this SELECT use for debugging */\n#endif\n  int addrOpenEphm[2];   /* OP_OpenEphem opcodes related to this select */\n  SrcList *pSrc;         /* The FROM clause */\n  Expr *pWhere;          /* The WHERE clause */\n  ExprList *pGroupBy;    /* The GROUP BY clause */\n  Expr *pHaving;         /* The HAVING clause */\n  ExprList *pOrderBy;    /* The ORDER BY clause */\n  Select *pPrior;        /* Prior select in a compound select statement */\n  Select *pNext;         /* Next select to the left in a compound */\n  Expr *pLimit;          /* LIMIT expression. NULL means not used. */\n  Expr *pOffset;         /* OFFSET expression. NULL means not used. */\n  With *pWith;           /* WITH clause attached to this select. Or NULL. */\n};\n\n/*\n** Allowed values for Select.selFlags.  The \"SF\" prefix stands for\n** \"Select Flag\".\n**\n** Value constraints (all checked via assert())\n**     SF_HasAgg     == NC_HasAgg\n**     SF_MinMaxAgg  == NC_MinMaxAgg     == SQLITE_FUNC_MINMAX\n**     SF_FixedLimit == WHERE_USE_LIMIT\n*/\n#define SF_Distinct       0x00001  /* Output should be DISTINCT */\n#define SF_All            0x00002  /* Includes the ALL keyword */\n#define SF_Resolved       0x00004  /* Identifiers have been resolved */\n#define SF_Aggregate      0x00008  /* Contains agg functions or a GROUP BY */\n#define SF_HasAgg         0x00010  /* Contains aggregate functions */\n#define SF_UsesEphemeral  0x00020  /* Uses the OpenEphemeral opcode */\n#define SF_Expanded       0x00040  /* sqlite3SelectExpand() called on this */\n#define SF_HasTypeInfo    0x00080  /* FROM subqueries have Table metadata */\n#define SF_Compound       0x00100  /* Part of a compound query */\n#define SF_Values         0x00200  /* Synthesized from VALUES clause */\n#define SF_MultiValue     0x00400  /* Single VALUES term with multiple rows */\n#define SF_NestedFrom     0x00800  /* Part of a parenthesized FROM clause */\n#define SF_MinMaxAgg      0x01000  /* Aggregate containing min() or max() */\n#define SF_Recursive      0x02000  /* The recursive part of a recursive CTE */\n#define SF_FixedLimit     0x04000  /* nSelectRow set by a constant LIMIT */\n#define SF_MaybeConvert   0x08000  /* Need convertCompoundSelectToSubquery() */\n#define SF_Converted      0x10000  /* By convertCompoundSelectToSubquery() */\n#define SF_IncludeHidden  0x20000  /* Include hidden columns in output */\n\n\n/*\n** The results of a SELECT can be distributed in several ways, as defined\n** by one of the following macros.  The \"SRT\" prefix means \"SELECT Result\n** Type\".\n**\n**     SRT_Union       Store results as a key in a temporary index\n**                     identified by pDest->iSDParm.\n**\n**     SRT_Except      Remove results from the temporary index pDest->iSDParm.\n**\n**     SRT_Exists      Store a 1 in memory cell pDest->iSDParm if the result\n**                     set is not empty.\n**\n**     SRT_Discard     Throw the results away.  This is used by SELECT\n**                     statements within triggers whose only purpose is\n**                     the side-effects of functions.\n**\n** All of the above are free to ignore their ORDER BY clause. Those that\n** follow must honor the ORDER BY clause.\n**\n**     SRT_Output      Generate a row of output (using the OP_ResultRow\n**                     opcode) for each row in the result set.\n**\n**     SRT_Mem         Only valid if the result is a single column.\n**                     Store the first column of the first result row\n**                     in register pDest->iSDParm then abandon the rest\n**                     of the query.  This destination implies \"LIMIT 1\".\n**\n**     SRT_Set         The result must be a single column.  Store each\n**                     row of result as the key in table pDest->iSDParm.\n**                     Apply the affinity pDest->affSdst before storing\n**                     results.  Used to implement \"IN (SELECT ...)\".\n**\n**     SRT_EphemTab    Create an temporary table pDest->iSDParm and store\n**                     the result there. The cursor is left open after\n**                     returning.  This is like SRT_Table except that\n**                     this destination uses OP_OpenEphemeral to create\n**                     the table first.\n**\n**     SRT_Coroutine   Generate a co-routine that returns a new row of\n**                     results each time it is invoked.  The entry point\n**                     of the co-routine is stored in register pDest->iSDParm\n**                     and the result row is stored in pDest->nDest registers\n**                     starting with pDest->iSdst.\n**\n**     SRT_Table       Store results in temporary table pDest->iSDParm.\n**     SRT_Fifo        This is like SRT_EphemTab except that the table\n**                     is assumed to already be open.  SRT_Fifo has\n**                     the additional property of being able to ignore\n**                     the ORDER BY clause.\n**\n**     SRT_DistFifo    Store results in a temporary table pDest->iSDParm.\n**                     But also use temporary table pDest->iSDParm+1 as\n**                     a record of all prior results and ignore any duplicate\n**                     rows.  Name means:  \"Distinct Fifo\".\n**\n**     SRT_Queue       Store results in priority queue pDest->iSDParm (really\n**                     an index).  Append a sequence number so that all entries\n**                     are distinct.\n**\n**     SRT_DistQueue   Store results in priority queue pDest->iSDParm only if\n**                     the same record has never been stored before.  The\n**                     index at pDest->iSDParm+1 hold all prior stores.\n*/\n#define SRT_Union        1  /* Store result as keys in an index */\n#define SRT_Except       2  /* Remove result from a UNION index */\n#define SRT_Exists       3  /* Store 1 if the result is not empty */\n#define SRT_Discard      4  /* Do not save the results anywhere */\n#define SRT_Fifo         5  /* Store result as data with an automatic rowid */\n#define SRT_DistFifo     6  /* Like SRT_Fifo, but unique results only */\n#define SRT_Queue        7  /* Store result in an queue */\n#define SRT_DistQueue    8  /* Like SRT_Queue, but unique results only */\n\n/* The ORDER BY clause is ignored for all of the above */\n#define IgnorableOrderby(X) ((X->eDest)<=SRT_DistQueue)\n\n#define SRT_Output       9  /* Output each row of result */\n#define SRT_Mem         10  /* Store result in a memory cell */\n#define SRT_Set         11  /* Store results as keys in an index */\n#define SRT_EphemTab    12  /* Create transient tab and store like SRT_Table */\n#define SRT_Coroutine   13  /* Generate a single row of result */\n#define SRT_Table       14  /* Store result as data with an automatic rowid */\n\n/*\n** An instance of this object describes where to put of the results of\n** a SELECT statement.\n*/\nstruct SelectDest {\n  u8 eDest;            /* How to dispose of the results.  On of SRT_* above. */\n  char *zAffSdst;      /* Affinity used when eDest==SRT_Set */\n  int iSDParm;         /* A parameter used by the eDest disposal method */\n  int iSdst;           /* Base register where results are written */\n  int nSdst;           /* Number of registers allocated */\n  ExprList *pOrderBy;  /* Key columns for SRT_Queue and SRT_DistQueue */\n};\n\n/*\n** During code generation of statements that do inserts into AUTOINCREMENT\n** tables, the following information is attached to the Table.u.autoInc.p\n** pointer of each autoincrement table to record some side information that\n** the code generator needs.  We have to keep per-table autoincrement\n** information in case inserts are done within triggers.  Triggers do not\n** normally coordinate their activities, but we do need to coordinate the\n** loading and saving of autoincrement information.\n*/\nstruct AutoincInfo {\n  AutoincInfo *pNext;   /* Next info block in a list of them all */\n  Table *pTab;          /* Table this info block refers to */\n  int iDb;              /* Index in sqlite3.aDb[] of database holding pTab */\n  int regCtr;           /* Memory register holding the rowid counter */\n};\n\n/*\n** Size of the column cache\n*/\n#ifndef SQLITE_N_COLCACHE\n# define SQLITE_N_COLCACHE 10\n#endif\n\n/*\n** At least one instance of the following structure is created for each\n** trigger that may be fired while parsing an INSERT, UPDATE or DELETE\n** statement. All such objects are stored in the linked list headed at\n** Parse.pTriggerPrg and deleted once statement compilation has been\n** completed.\n**\n** A Vdbe sub-program that implements the body and WHEN clause of trigger\n** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of\n** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable.\n** The Parse.pTriggerPrg list never contains two entries with the same\n** values for both pTrigger and orconf.\n**\n** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns\n** accessed (or set to 0 for triggers fired as a result of INSERT\n** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to\n** a mask of new.* columns used by the program.\n*/\nstruct TriggerPrg {\n  Trigger *pTrigger;      /* Trigger this program was coded from */\n  TriggerPrg *pNext;      /* Next entry in Parse.pTriggerPrg list */\n  SubProgram *pProgram;   /* Program implementing pTrigger/orconf */\n  int orconf;             /* Default ON CONFLICT policy */\n  u32 aColmask[2];        /* Masks of old.*, new.* columns accessed */\n};\n\n/*\n** The yDbMask datatype for the bitmask of all attached databases.\n*/\n#if SQLITE_MAX_ATTACHED>30\n  typedef unsigned char yDbMask[(SQLITE_MAX_ATTACHED+9)/8];\n# define DbMaskTest(M,I)    (((M)[(I)/8]&(1<<((I)&7)))!=0)\n# define DbMaskZero(M)      memset((M),0,sizeof(M))\n# define DbMaskSet(M,I)     (M)[(I)/8]|=(1<<((I)&7))\n# define DbMaskAllZero(M)   sqlite3DbMaskAllZero(M)\n# define DbMaskNonZero(M)   (sqlite3DbMaskAllZero(M)==0)\n#else\n  typedef unsigned int yDbMask;\n# define DbMaskTest(M,I)    (((M)&(((yDbMask)1)<<(I)))!=0)\n# define DbMaskZero(M)      (M)=0\n# define DbMaskSet(M,I)     (M)|=(((yDbMask)1)<<(I))\n# define DbMaskAllZero(M)   (M)==0\n# define DbMaskNonZero(M)   (M)!=0\n#endif\n\n/*\n** An SQL parser context.  A copy of this structure is passed through\n** the parser and down into all the parser action routine in order to\n** carry around information that is global to the entire parse.\n**\n** The structure is divided into two parts.  When the parser and code\n** generate call themselves recursively, the first part of the structure\n** is constant but the second part is reset at the beginning and end of\n** each recursion.\n**\n** The nTableLock and aTableLock variables are only used if the shared-cache\n** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are\n** used to store the set of table-locks required by the statement being\n** compiled. Function sqlite3TableLock() is used to add entries to the\n** list.\n*/\nstruct Parse {\n  sqlite3 *db;         /* The main database structure */\n  char *zErrMsg;       /* An error message */\n  Vdbe *pVdbe;         /* An engine for executing database bytecode */\n  int rc;              /* Return code from execution */\n  u8 colNamesSet;      /* TRUE after OP_ColumnName has been issued to pVdbe */\n  u8 checkSchema;      /* Causes schema cookie check after an error */\n  u8 nested;           /* Number of nested calls to the parser/code generator */\n  u8 nTempReg;         /* Number of temporary registers in aTempReg[] */\n  u8 isMultiWrite;     /* True if statement may modify/insert multiple rows */\n  u8 mayAbort;         /* True if statement may throw an ABORT exception */\n  u8 hasCompound;      /* Need to invoke convertCompoundSelectToSubquery() */\n  u8 okConstFactor;    /* OK to factor out constants */\n  u8 disableLookaside; /* Number of times lookaside has been disabled */\n  u8 nColCache;        /* Number of entries in aColCache[] */\n  int nRangeReg;       /* Size of the temporary register block */\n  int iRangeReg;       /* First register in temporary register block */\n  int nErr;            /* Number of errors seen */\n  int nTab;            /* Number of previously allocated VDBE cursors */\n  int nMem;            /* Number of memory cells used so far */\n  int nOpAlloc;        /* Number of slots allocated for Vdbe.aOp[] */\n  int szOpAlloc;       /* Bytes of memory space allocated for Vdbe.aOp[] */\n  int ckBase;          /* Base register of data during check constraints */\n  int iSelfTab;        /* Table of an index whose exprs are being coded */\n  int iCacheLevel;     /* ColCache valid when aColCache[].iLevel<=iCacheLevel */\n  int iCacheCnt;       /* Counter used to generate aColCache[].lru values */\n  int nLabel;          /* Number of labels used */\n  int *aLabel;         /* Space to hold the labels */\n  ExprList *pConstExpr;/* Constant expressions */\n  Token constraintName;/* Name of the constraint currently being parsed */\n  yDbMask writeMask;   /* Start a write transaction on these databases */\n  yDbMask cookieMask;  /* Bitmask of schema verified databases */\n  int regRowid;        /* Register holding rowid of CREATE TABLE entry */\n  int regRoot;         /* Register holding root page number for new objects */\n  int nMaxArg;         /* Max args passed to user function by sub-program */\n#if SELECTTRACE_ENABLED\n  int nSelect;         /* Number of SELECT statements seen */\n  int nSelectIndent;   /* How far to indent SELECTTRACE() output */\n#endif\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  int nTableLock;        /* Number of locks in aTableLock */\n  TableLock *aTableLock; /* Required table locks for shared-cache mode */\n#endif\n  AutoincInfo *pAinc;  /* Information about AUTOINCREMENT counters */\n  Parse *pToplevel;    /* Parse structure for main program (or NULL) */\n  Table *pTriggerTab;  /* Table triggers are being coded for */\n  int addrCrTab;       /* Address of OP_CreateTable opcode on CREATE TABLE */\n  u32 nQueryLoop;      /* Est number of iterations of a query (10*log2(N)) */\n  u32 oldmask;         /* Mask of old.* columns referenced */\n  u32 newmask;         /* Mask of new.* columns referenced */\n  u8 eTriggerOp;       /* TK_UPDATE, TK_INSERT or TK_DELETE */\n  u8 eOrconf;          /* Default ON CONFLICT policy for trigger steps */\n  u8 disableTriggers;  /* True to disable triggers */\n\n  /**************************************************************************\n  ** Fields above must be initialized to zero.  The fields that follow,\n  ** down to the beginning of the recursive section, do not need to be\n  ** initialized as they will be set before being used.  The boundary is\n  ** determined by offsetof(Parse,aColCache).\n  **************************************************************************/\n\n  struct yColCache {\n    int iTable;           /* Table cursor number */\n    i16 iColumn;          /* Table column number */\n    u8 tempReg;           /* iReg is a temp register that needs to be freed */\n    int iLevel;           /* Nesting level */\n    int iReg;             /* Reg with value of this column. 0 means none. */\n    int lru;              /* Least recently used entry has the smallest value */\n  } aColCache[SQLITE_N_COLCACHE];  /* One for each column cache entry */\n  int aTempReg[8];        /* Holding area for temporary registers */\n  Token sNameToken;       /* Token with unqualified schema object name */\n\n  /************************************************************************\n  ** Above is constant between recursions.  Below is reset before and after\n  ** each recursion.  The boundary between these two regions is determined\n  ** using offsetof(Parse,sLastToken) so the sLastToken field must be the\n  ** first field in the recursive region.\n  ************************************************************************/\n\n  Token sLastToken;       /* The last token parsed */\n  ynVar nVar;               /* Number of '?' variables seen in the SQL so far */\n  int nzVar;                /* Number of available slots in azVar[] */\n  u8 iPkSortOrder;          /* ASC or DESC for INTEGER PRIMARY KEY */\n  u8 explain;               /* True if the EXPLAIN flag is found on the query */\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  u8 declareVtab;           /* True if inside sqlite3_declare_vtab() */\n  int nVtabLock;            /* Number of virtual tables to lock */\n#endif\n  int nHeight;              /* Expression tree height of current sub-select */\n#ifndef SQLITE_OMIT_EXPLAIN\n  int iSelectId;            /* ID of current select for EXPLAIN output */\n  int iNextSelectId;        /* Next available select ID for EXPLAIN output */\n#endif\n  char **azVar;             /* Pointers to names of parameters */\n  Vdbe *pReprepare;         /* VM being reprepared (sqlite3Reprepare()) */\n  const char *zTail;        /* All SQL text past the last semicolon parsed */\n  Table *pNewTable;         /* A table being constructed by CREATE TABLE */\n  Trigger *pNewTrigger;     /* Trigger under construct by a CREATE TRIGGER */\n  const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  Token sArg;               /* Complete text of a module argument */\n  Table **apVtabLock;       /* Pointer to virtual tables needing locking */\n#endif\n  Table *pZombieTab;        /* List of Table objects to delete after code gen */\n  TriggerPrg *pTriggerPrg;  /* Linked list of coded triggers */\n  With *pWith;              /* Current WITH clause, or NULL */\n  With *pWithToFree;        /* Free this WITH object at the end of the parse */\n};\n\n/*\n** Sizes and pointers of various parts of the Parse object.\n*/\n#define PARSE_HDR_SZ offsetof(Parse,aColCache) /* Recursive part w/o aColCache*/\n#define PARSE_RECURSE_SZ offsetof(Parse,sLastToken)    /* Recursive part */\n#define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */\n#define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ)  /* Pointer to tail */\n\n/*\n** Return true if currently inside an sqlite3_declare_vtab() call.\n*/\n#ifdef SQLITE_OMIT_VIRTUALTABLE\n  #define IN_DECLARE_VTAB 0\n#else\n  #define IN_DECLARE_VTAB (pParse->declareVtab)\n#endif\n\n/*\n** An instance of the following structure can be declared on a stack and used\n** to save the Parse.zAuthContext value so that it can be restored later.\n*/\nstruct AuthContext {\n  const char *zAuthContext;   /* Put saved Parse.zAuthContext here */\n  Parse *pParse;              /* The Parse structure */\n};\n\n/*\n** Bitfield flags for P5 value in various opcodes.\n**\n** Value constraints (enforced via assert()):\n**    OPFLAG_LENGTHARG    == SQLITE_FUNC_LENGTH\n**    OPFLAG_TYPEOFARG    == SQLITE_FUNC_TYPEOF\n**    OPFLAG_BULKCSR      == BTREE_BULKLOAD\n**    OPFLAG_SEEKEQ       == BTREE_SEEK_EQ\n**    OPFLAG_FORDELETE    == BTREE_FORDELETE\n**    OPFLAG_SAVEPOSITION == BTREE_SAVEPOSITION\n**    OPFLAG_AUXDELETE    == BTREE_AUXDELETE\n*/\n#define OPFLAG_NCHANGE       0x01    /* OP_Insert: Set to update db->nChange */\n                                     /* Also used in P2 (not P5) of OP_Delete */\n#define OPFLAG_EPHEM         0x01    /* OP_Column: Ephemeral output is ok */\n#define OPFLAG_LASTROWID     0x02    /* Set to update db->lastRowid */\n#define OPFLAG_ISUPDATE      0x04    /* This OP_Insert is an sql UPDATE */\n#define OPFLAG_APPEND        0x08    /* This is likely to be an append */\n#define OPFLAG_USESEEKRESULT 0x10    /* Try to avoid a seek in BtreeInsert() */\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n#define OPFLAG_ISNOOP        0x40    /* OP_Delete does pre-update-hook only */\n#endif\n#define OPFLAG_LENGTHARG     0x40    /* OP_Column only used for length() */\n#define OPFLAG_TYPEOFARG     0x80    /* OP_Column only used for typeof() */\n#define OPFLAG_BULKCSR       0x01    /* OP_Open** used to open bulk cursor */\n#define OPFLAG_SEEKEQ        0x02    /* OP_Open** cursor uses EQ seek only */\n#define OPFLAG_FORDELETE     0x08    /* OP_Open should use BTREE_FORDELETE */\n#define OPFLAG_P2ISREG       0x10    /* P2 to OP_Open** is a register number */\n#define OPFLAG_PERMUTE       0x01    /* OP_Compare: use the permutation */\n#define OPFLAG_SAVEPOSITION  0x02    /* OP_Delete: keep cursor position */\n#define OPFLAG_AUXDELETE     0x04    /* OP_Delete: index in a DELETE op */\n\n/*\n * Each trigger present in the database schema is stored as an instance of\n * struct Trigger.\n *\n * Pointers to instances of struct Trigger are stored in two ways.\n * 1. In the \"trigHash\" hash table (part of the sqlite3* that represents the\n *    database). This allows Trigger structures to be retrieved by name.\n * 2. All triggers associated with a single table form a linked list, using the\n *    pNext member of struct Trigger. A pointer to the first element of the\n *    linked list is stored as the \"pTrigger\" member of the associated\n *    struct Table.\n *\n * The \"step_list\" member points to the first element of a linked list\n * containing the SQL statements specified as the trigger program.\n */\nstruct Trigger {\n  char *zName;            /* The name of the trigger                        */\n  char *table;            /* The table or view to which the trigger applies */\n  u8 op;                  /* One of TK_DELETE, TK_UPDATE, TK_INSERT         */\n  u8 tr_tm;               /* One of TRIGGER_BEFORE, TRIGGER_AFTER */\n  Expr *pWhen;            /* The WHEN clause of the expression (may be NULL) */\n  IdList *pColumns;       /* If this is an UPDATE OF <column-list> trigger,\n                             the <column-list> is stored here */\n  Schema *pSchema;        /* Schema containing the trigger */\n  Schema *pTabSchema;     /* Schema containing the table */\n  TriggerStep *step_list; /* Link list of trigger program steps             */\n  Trigger *pNext;         /* Next trigger associated with the table */\n};\n\n/*\n** A trigger is either a BEFORE or an AFTER trigger.  The following constants\n** determine which.\n**\n** If there are multiple triggers, you might of some BEFORE and some AFTER.\n** In that cases, the constants below can be ORed together.\n*/\n#define TRIGGER_BEFORE  1\n#define TRIGGER_AFTER   2\n\n/*\n * An instance of struct TriggerStep is used to store a single SQL statement\n * that is a part of a trigger-program.\n *\n * Instances of struct TriggerStep are stored in a singly linked list (linked\n * using the \"pNext\" member) referenced by the \"step_list\" member of the\n * associated struct Trigger instance. The first element of the linked list is\n * the first step of the trigger-program.\n *\n * The \"op\" member indicates whether this is a \"DELETE\", \"INSERT\", \"UPDATE\" or\n * \"SELECT\" statement. The meanings of the other members is determined by the\n * value of \"op\" as follows:\n *\n * (op == TK_INSERT)\n * orconf    -> stores the ON CONFLICT algorithm\n * pSelect   -> If this is an INSERT INTO ... SELECT ... statement, then\n *              this stores a pointer to the SELECT statement. Otherwise NULL.\n * zTarget   -> Dequoted name of the table to insert into.\n * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then\n *              this stores values to be inserted. Otherwise NULL.\n * pIdList   -> If this is an INSERT INTO ... (<column-names>) VALUES ...\n *              statement, then this stores the column-names to be\n *              inserted into.\n *\n * (op == TK_DELETE)\n * zTarget   -> Dequoted name of the table to delete from.\n * pWhere    -> The WHERE clause of the DELETE statement if one is specified.\n *              Otherwise NULL.\n *\n * (op == TK_UPDATE)\n * zTarget   -> Dequoted name of the table to update.\n * pWhere    -> The WHERE clause of the UPDATE statement if one is specified.\n *              Otherwise NULL.\n * pExprList -> A list of the columns to update and the expressions to update\n *              them to. See sqlite3Update() documentation of \"pChanges\"\n *              argument.\n *\n */\nstruct TriggerStep {\n  u8 op;               /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */\n  u8 orconf;           /* OE_Rollback etc. */\n  Trigger *pTrig;      /* The trigger that this step is a part of */\n  Select *pSelect;     /* SELECT statement or RHS of INSERT INTO SELECT ... */\n  char *zTarget;       /* Target table for DELETE, UPDATE, INSERT */\n  Expr *pWhere;        /* The WHERE clause for DELETE or UPDATE steps */\n  ExprList *pExprList; /* SET clause for UPDATE. */\n  IdList *pIdList;     /* Column names for INSERT */\n  TriggerStep *pNext;  /* Next in the link-list */\n  TriggerStep *pLast;  /* Last element in link-list. Valid for 1st elem only */\n};\n\n/*\n** The following structure contains information used by the sqliteFix...\n** routines as they walk the parse tree to make database references\n** explicit.\n*/\ntypedef struct DbFixer DbFixer;\nstruct DbFixer {\n  Parse *pParse;      /* The parsing context.  Error messages written here */\n  Schema *pSchema;    /* Fix items to this schema */\n  int bVarOnly;       /* Check for variable references only */\n  const char *zDb;    /* Make sure all objects are contained in this database */\n  const char *zType;  /* Type of the container - used for error messages */\n  const Token *pName; /* Name of the container - used for error messages */\n};\n\n/*\n** An objected used to accumulate the text of a string where we\n** do not necessarily know how big the string will be in the end.\n*/\nstruct StrAccum {\n  sqlite3 *db;         /* Optional database for lookaside.  Can be NULL */\n  char *zBase;         /* A base allocation.  Not from malloc. */\n  char *zText;         /* The string collected so far */\n  u32  nChar;          /* Length of the string so far */\n  u32  nAlloc;         /* Amount of space allocated in zText */\n  u32  mxAlloc;        /* Maximum allowed allocation.  0 for no malloc usage */\n  u8   accError;       /* STRACCUM_NOMEM or STRACCUM_TOOBIG */\n  u8   printfFlags;    /* SQLITE_PRINTF flags below */\n};\n#define STRACCUM_NOMEM   1\n#define STRACCUM_TOOBIG  2\n#define SQLITE_PRINTF_INTERNAL 0x01  /* Internal-use-only converters allowed */\n#define SQLITE_PRINTF_SQLFUNC  0x02  /* SQL function arguments to VXPrintf */\n#define SQLITE_PRINTF_MALLOCED 0x04  /* True if xText is allocated space */\n\n#define isMalloced(X)  (((X)->printfFlags & SQLITE_PRINTF_MALLOCED)!=0)\n\n\n/*\n** A pointer to this structure is used to communicate information\n** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.\n*/\ntypedef struct {\n  sqlite3 *db;        /* The database being initialized */\n  char **pzErrMsg;    /* Error message stored here */\n  int iDb;            /* 0 for main database.  1 for TEMP, 2.. for ATTACHed */\n  int rc;             /* Result code stored here */\n} InitData;\n\n/*\n** Structure containing global configuration data for the SQLite library.\n**\n** This structure also contains some state information.\n*/\nstruct Sqlite3Config {\n  int bMemstat;                     /* True to enable memory status */\n  int bCoreMutex;                   /* True to enable core mutexing */\n  int bFullMutex;                   /* True to enable full mutexing */\n  int bOpenUri;                     /* True to interpret filenames as URIs */\n  int bUseCis;                      /* Use covering indices for full-scans */\n  int mxStrlen;                     /* Maximum string length */\n  int neverCorrupt;                 /* Database is always well-formed */\n  int szLookaside;                  /* Default lookaside buffer size */\n  int nLookaside;                   /* Default lookaside buffer count */\n  int nStmtSpill;                   /* Stmt-journal spill-to-disk threshold */\n  sqlite3_mem_methods m;            /* Low-level memory allocation interface */\n  sqlite3_mutex_methods mutex;      /* Low-level mutex interface */\n  sqlite3_pcache_methods2 pcache2;  /* Low-level page-cache interface */\n  void *pHeap;                      /* Heap storage space */\n  int nHeap;                        /* Size of pHeap[] */\n  int mnReq, mxReq;                 /* Min and max heap requests sizes */\n  sqlite3_int64 szMmap;             /* mmap() space per open file */\n  sqlite3_int64 mxMmap;             /* Maximum value for szMmap */\n  void *pScratch;                   /* Scratch memory */\n  int szScratch;                    /* Size of each scratch buffer */\n  int nScratch;                     /* Number of scratch buffers */\n  void *pPage;                      /* Page cache memory */\n  int szPage;                       /* Size of each page in pPage[] */\n  int nPage;                        /* Number of pages in pPage[] */\n  int mxParserStack;                /* maximum depth of the parser stack */\n  int sharedCacheEnabled;           /* true if shared-cache mode enabled */\n  u32 szPma;                        /* Maximum Sorter PMA size */\n  /* The above might be initialized to non-zero.  The following need to always\n  ** initially be zero, however. */\n  int isInit;                       /* True after initialization has finished */\n  int inProgress;                   /* True while initialization in progress */\n  int isMutexInit;                  /* True after mutexes are initialized */\n  int isMallocInit;                 /* True after malloc is initialized */\n  int isPCacheInit;                 /* True after malloc is initialized */\n  int nRefInitMutex;                /* Number of users of pInitMutex */\n  sqlite3_mutex *pInitMutex;        /* Mutex used by sqlite3_initialize() */\n  void (*xLog)(void*,int,const char*); /* Function for logging */\n  void *pLogArg;                       /* First argument to xLog() */\n#ifdef SQLITE_ENABLE_SQLLOG\n  void(*xSqllog)(void*,sqlite3*,const char*, int);\n  void *pSqllogArg;\n#endif\n#ifdef SQLITE_VDBE_COVERAGE\n  /* The following callback (if not NULL) is invoked on every VDBE branch\n  ** operation.  Set the callback using SQLITE_TESTCTRL_VDBE_COVERAGE.\n  */\n  void (*xVdbeBranch)(void*,int iSrcLine,u8 eThis,u8 eMx);  /* Callback */\n  void *pVdbeBranchArg;                                     /* 1st argument */\n#endif\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n  int (*xTestCallback)(int);        /* Invoked by sqlite3FaultSim() */\n#endif\n  int bLocaltimeFault;              /* True to fail localtime() calls */\n  int iOnceResetThreshold;          /* When to reset OP_Once counters */\n};\n\n/*\n** This macro is used inside of assert() statements to indicate that\n** the assert is only valid on a well-formed database.  Instead of:\n**\n**     assert( X );\n**\n** One writes:\n**\n**     assert( X || CORRUPT_DB );\n**\n** CORRUPT_DB is true during normal operation.  CORRUPT_DB does not indicate\n** that the database is definitely corrupt, only that it might be corrupt.\n** For most test cases, CORRUPT_DB is set to false using a special\n** sqlite3_test_control().  This enables assert() statements to prove\n** things that are always true for well-formed databases.\n*/\n#define CORRUPT_DB  (sqlite3Config.neverCorrupt==0)\n\n/*\n** Context pointer passed down through the tree-walk.\n*/\nstruct Walker {\n  Parse *pParse;                            /* Parser context.  */\n  int (*xExprCallback)(Walker*, Expr*);     /* Callback for expressions */\n  int (*xSelectCallback)(Walker*,Select*);  /* Callback for SELECTs */\n  void (*xSelectCallback2)(Walker*,Select*);/* Second callback for SELECTs */\n  int walkerDepth;                          /* Number of subqueries */\n  u8 eCode;                                 /* A small processing code */\n  union {                                   /* Extra data for callback */\n    NameContext *pNC;                          /* Naming context */\n    int n;                                     /* A counter */\n    int iCur;                                  /* A cursor number */\n    SrcList *pSrcList;                         /* FROM clause */\n    struct SrcCount *pSrcCount;                /* Counting column references */\n    struct CCurHint *pCCurHint;                /* Used by codeCursorHint() */\n    int *aiCol;                                /* array of column indexes */\n    struct IdxCover *pIdxCover;                /* Check for index coverage */\n  } u;\n};\n\n/* Forward declarations */\nint sqlite3WalkExpr(Walker*, Expr*);\nint sqlite3WalkExprList(Walker*, ExprList*);\nint sqlite3WalkSelect(Walker*, Select*);\nint sqlite3WalkSelectExpr(Walker*, Select*);\nint sqlite3WalkSelectFrom(Walker*, Select*);\nint sqlite3ExprWalkNoop(Walker*, Expr*);\n\n/*\n** Return code from the parse-tree walking primitives and their\n** callbacks.\n*/\n#define WRC_Continue    0   /* Continue down into children */\n#define WRC_Prune       1   /* Omit children but continue walking siblings */\n#define WRC_Abort       2   /* Abandon the tree walk */\n\n/*\n** An instance of this structure represents a set of one or more CTEs\n** (common table expressions) created by a single WITH clause.\n*/\nstruct With {\n  int nCte;                       /* Number of CTEs in the WITH clause */\n  With *pOuter;                   /* Containing WITH clause, or NULL */\n  struct Cte {                    /* For each CTE in the WITH clause.... */\n    char *zName;                    /* Name of this CTE */\n    ExprList *pCols;                /* List of explicit column names, or NULL */\n    Select *pSelect;                /* The definition of this CTE */\n    const char *zCteErr;            /* Error message for circular references */\n  } a[1];\n};\n\n#ifdef SQLITE_DEBUG\n/*\n** An instance of the TreeView object is used for printing the content of\n** data structures on sqlite3DebugPrintf() using a tree-like view.\n*/\nstruct TreeView {\n  int iLevel;             /* Which level of the tree we are on */\n  u8  bLine[100];         /* Draw vertical in column i if bLine[i] is true */\n};\n#endif /* SQLITE_DEBUG */\n\n/*\n** Assuming zIn points to the first byte of a UTF-8 character,\n** advance zIn to point to the first byte of the next UTF-8 character.\n*/\n#define SQLITE_SKIP_UTF8(zIn) {                        \\\n  if( (*(zIn++))>=0xc0 ){                              \\\n    while( (*zIn & 0xc0)==0x80 ){ zIn++; }             \\\n  }                                                    \\\n}\n\n/*\n** The SQLITE_*_BKPT macros are substitutes for the error codes with\n** the same name but without the _BKPT suffix.  These macros invoke\n** routines that report the line-number on which the error originated\n** using sqlite3_log().  The routines also provide a convenient place\n** to set a debugger breakpoint.\n*/\nint sqlite3CorruptError(int);\nint sqlite3MisuseError(int);\nint sqlite3CantopenError(int);\n#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__)\n#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__)\n#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__)\n#ifdef SQLITE_DEBUG\n  int sqlite3NomemError(int);\n  int sqlite3IoerrnomemError(int);\n# define SQLITE_NOMEM_BKPT sqlite3NomemError(__LINE__)\n# define SQLITE_IOERR_NOMEM_BKPT sqlite3IoerrnomemError(__LINE__)\n#else\n# define SQLITE_NOMEM_BKPT SQLITE_NOMEM\n# define SQLITE_IOERR_NOMEM_BKPT SQLITE_IOERR_NOMEM\n#endif\n\n/*\n** FTS3 and FTS4 both require virtual table support\n*/\n#if defined(SQLITE_OMIT_VIRTUALTABLE)\n# undef SQLITE_ENABLE_FTS3\n# undef SQLITE_ENABLE_FTS4\n#endif\n\n/*\n** FTS4 is really an extension for FTS3.  It is enabled using the\n** SQLITE_ENABLE_FTS3 macro.  But to avoid confusion we also call\n** the SQLITE_ENABLE_FTS4 macro to serve as an alias for SQLITE_ENABLE_FTS3.\n*/\n#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)\n# define SQLITE_ENABLE_FTS3 1\n#endif\n\n/*\n** The ctype.h header is needed for non-ASCII systems.  It is also\n** needed by FTS3 when FTS3 is included in the amalgamation.\n*/\n#if !defined(SQLITE_ASCII) || \\\n    (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION))\n# include <ctype.h>\n#endif\n\n/*\n** The following macros mimic the standard library functions toupper(),\n** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The\n** sqlite versions only work for ASCII characters, regardless of locale.\n*/\n#ifdef SQLITE_ASCII\n# define sqlite3Toupper(x)  ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20))\n# define sqlite3Isspace(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x01)\n# define sqlite3Isalnum(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x06)\n# define sqlite3Isalpha(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x02)\n# define sqlite3Isdigit(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x04)\n# define sqlite3Isxdigit(x)  (sqlite3CtypeMap[(unsigned char)(x)]&0x08)\n# define sqlite3Tolower(x)   (sqlite3UpperToLower[(unsigned char)(x)])\n# define sqlite3Isquote(x)   (sqlite3CtypeMap[(unsigned char)(x)]&0x80)\n#else\n# define sqlite3Toupper(x)   toupper((unsigned char)(x))\n# define sqlite3Isspace(x)   isspace((unsigned char)(x))\n# define sqlite3Isalnum(x)   isalnum((unsigned char)(x))\n# define sqlite3Isalpha(x)   isalpha((unsigned char)(x))\n# define sqlite3Isdigit(x)   isdigit((unsigned char)(x))\n# define sqlite3Isxdigit(x)  isxdigit((unsigned char)(x))\n# define sqlite3Tolower(x)   tolower((unsigned char)(x))\n# define sqlite3Isquote(x)   ((x)=='\"'||(x)=='\\''||(x)=='['||(x)=='`')\n#endif\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\nint sqlite3IsIdChar(u8);\n#endif\n\n/*\n** Internal function prototypes\n*/\nint sqlite3StrICmp(const char*,const char*);\nint sqlite3Strlen30(const char*);\nchar *sqlite3ColumnType(Column*,char*);\n#define sqlite3StrNICmp sqlite3_strnicmp\n\nint sqlite3MallocInit(void);\nvoid sqlite3MallocEnd(void);\nvoid *sqlite3Malloc(u64);\nvoid *sqlite3MallocZero(u64);\nvoid *sqlite3DbMallocZero(sqlite3*, u64);\nvoid *sqlite3DbMallocRaw(sqlite3*, u64);\nvoid *sqlite3DbMallocRawNN(sqlite3*, u64);\nchar *sqlite3DbStrDup(sqlite3*,const char*);\nchar *sqlite3DbStrNDup(sqlite3*,const char*, u64);\nvoid *sqlite3Realloc(void*, u64);\nvoid *sqlite3DbReallocOrFree(sqlite3 *, void *, u64);\nvoid *sqlite3DbRealloc(sqlite3 *, void *, u64);\nvoid sqlite3DbFree(sqlite3*, void*);\nint sqlite3MallocSize(void*);\nint sqlite3DbMallocSize(sqlite3*, void*);\nvoid *sqlite3ScratchMalloc(int);\nvoid sqlite3ScratchFree(void*);\nvoid *sqlite3PageMalloc(int);\nvoid sqlite3PageFree(void*);\nvoid sqlite3MemSetDefault(void);\n#ifndef SQLITE_OMIT_BUILTIN_TEST\nvoid sqlite3BenignMallocHooks(void (*)(void), void (*)(void));\n#endif\nint sqlite3HeapNearlyFull(void);\n\n/*\n** On systems with ample stack space and that support alloca(), make\n** use of alloca() to obtain space for large automatic objects.  By default,\n** obtain space from malloc().\n**\n** The alloca() routine never returns NULL.  This will cause code paths\n** that deal with sqlite3StackAlloc() failures to be unreachable.\n*/\n#ifdef SQLITE_USE_ALLOCA\n# define sqlite3StackAllocRaw(D,N)   alloca(N)\n# define sqlite3StackAllocZero(D,N)  memset(alloca(N), 0, N)\n# define sqlite3StackFree(D,P)\n#else\n# define sqlite3StackAllocRaw(D,N)   sqlite3DbMallocRaw(D,N)\n# define sqlite3StackAllocZero(D,N)  sqlite3DbMallocZero(D,N)\n# define sqlite3StackFree(D,P)       sqlite3DbFree(D,P)\n#endif\n\n/* Do not allow both MEMSYS5 and MEMSYS3 to be defined together.  If they\n** are, disable MEMSYS3\n*/\n#ifdef SQLITE_ENABLE_MEMSYS5\nconst sqlite3_mem_methods *sqlite3MemGetMemsys5(void);\n#undef SQLITE_ENABLE_MEMSYS3\n#endif\n#ifdef SQLITE_ENABLE_MEMSYS3\nconst sqlite3_mem_methods *sqlite3MemGetMemsys3(void);\n#endif\n\n\n#ifndef SQLITE_MUTEX_OMIT\n  sqlite3_mutex_methods const *sqlite3DefaultMutex(void);\n  sqlite3_mutex_methods const *sqlite3NoopMutex(void);\n  sqlite3_mutex *sqlite3MutexAlloc(int);\n  int sqlite3MutexInit(void);\n  int sqlite3MutexEnd(void);\n#endif\n#if !defined(SQLITE_MUTEX_OMIT) && !defined(SQLITE_MUTEX_NOOP)\n  void sqlite3MemoryBarrier(void);\n#else\n# define sqlite3MemoryBarrier()\n#endif\n\nsqlite3_int64 sqlite3StatusValue(int);\nvoid sqlite3StatusUp(int, int);\nvoid sqlite3StatusDown(int, int);\nvoid sqlite3StatusHighwater(int, int);\n\n/* Access to mutexes used by sqlite3_status() */\nsqlite3_mutex *sqlite3Pcache1Mutex(void);\nsqlite3_mutex *sqlite3MallocMutex(void);\n\n#ifndef SQLITE_OMIT_FLOATING_POINT\n  int sqlite3IsNaN(double);\n#else\n# define sqlite3IsNaN(X)  0\n#endif\n\n/*\n** An instance of the following structure holds information about SQL\n** functions arguments that are the parameters to the printf() function.\n*/\nstruct PrintfArguments {\n  int nArg;                /* Total number of arguments */\n  int nUsed;               /* Number of arguments used so far */\n  sqlite3_value **apArg;   /* The argument values */\n};\n\nvoid sqlite3VXPrintf(StrAccum*, const char*, va_list);\nvoid sqlite3XPrintf(StrAccum*, const char*, ...);\nchar *sqlite3MPrintf(sqlite3*,const char*, ...);\nchar *sqlite3VMPrintf(sqlite3*,const char*, va_list);\n#if defined(SQLITE_DEBUG) || defined(SQLITE_HAVE_OS_TRACE)\n  void sqlite3DebugPrintf(const char*, ...);\n#endif\n#if defined(SQLITE_TEST)\n  void *sqlite3TestTextToPtr(const char*);\n#endif\n\n#if defined(SQLITE_DEBUG)\n  void sqlite3TreeViewExpr(TreeView*, const Expr*, u8);\n  void sqlite3TreeViewBareExprList(TreeView*, const ExprList*, const char*);\n  void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*);\n  void sqlite3TreeViewSelect(TreeView*, const Select*, u8);\n  void sqlite3TreeViewWith(TreeView*, const With*, u8);\n#endif\n\n\nvoid sqlite3SetString(char **, sqlite3*, const char*);\nvoid sqlite3ErrorMsg(Parse*, const char*, ...);\nvoid sqlite3Dequote(char*);\nvoid sqlite3TokenInit(Token*,char*);\nint sqlite3KeywordCode(const unsigned char*, int);\nint sqlite3RunParser(Parse*, const char*, char **);\nvoid sqlite3FinishCoding(Parse*);\nint sqlite3GetTempReg(Parse*);\nvoid sqlite3ReleaseTempReg(Parse*,int);\nint sqlite3GetTempRange(Parse*,int);\nvoid sqlite3ReleaseTempRange(Parse*,int,int);\nvoid sqlite3ClearTempRegCache(Parse*);\n#ifdef SQLITE_DEBUG\nint sqlite3NoTempsInRange(Parse*,int,int);\n#endif\nExpr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);\nExpr *sqlite3Expr(sqlite3*,int,const char*);\nvoid sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);\nExpr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*);\nvoid sqlite3PExprAddSelect(Parse*, Expr*, Select*);\nExpr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);\nExpr *sqlite3ExprFunction(Parse*,ExprList*, Token*);\nvoid sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);\nvoid sqlite3ExprDelete(sqlite3*, Expr*);\nExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);\nExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);\nvoid sqlite3ExprListSetSortOrder(ExprList*,int);\nvoid sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);\nvoid sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*);\nvoid sqlite3ExprListDelete(sqlite3*, ExprList*);\nu32 sqlite3ExprListFlags(const ExprList*);\nint sqlite3Init(sqlite3*, char**);\nint sqlite3InitCallback(void*, int, char**, char**);\nvoid sqlite3Pragma(Parse*,Token*,Token*,Token*,int);\nvoid sqlite3ResetAllSchemasOfConnection(sqlite3*);\nvoid sqlite3ResetOneSchema(sqlite3*,int);\nvoid sqlite3CollapseDatabaseArray(sqlite3*);\nvoid sqlite3CommitInternalChanges(sqlite3*);\nvoid sqlite3DeleteColumnNames(sqlite3*,Table*);\nint sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**);\nvoid sqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*);\nTable *sqlite3ResultSetOfSelect(Parse*,Select*);\nvoid sqlite3OpenMasterTable(Parse *, int);\nIndex *sqlite3PrimaryKeyIndex(Table*);\ni16 sqlite3ColumnOfIndex(Index*, i16);\nvoid sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);\n#if SQLITE_ENABLE_HIDDEN_COLUMNS\n  void sqlite3ColumnPropertiesFromName(Table*, Column*);\n#else\n# define sqlite3ColumnPropertiesFromName(T,C) /* no-op */\n#endif\nvoid sqlite3AddColumn(Parse*,Token*,Token*);\nvoid sqlite3AddNotNull(Parse*, int);\nvoid sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);\nvoid sqlite3AddCheckConstraint(Parse*, Expr*);\nvoid sqlite3AddDefaultValue(Parse*,ExprSpan*);\nvoid sqlite3AddCollateType(Parse*, Token*);\nvoid sqlite3EndTable(Parse*,Token*,Token*,u8,Select*);\nint sqlite3ParseUri(const char*,const char*,unsigned int*,\n                    sqlite3_vfs**,char**,char **);\nBtree *sqlite3DbNameToBtree(sqlite3*,const char*);\n\n#ifdef SQLITE_OMIT_BUILTIN_TEST\n# define sqlite3FaultSim(X) SQLITE_OK\n#else\n  int sqlite3FaultSim(int);\n#endif\n\nBitvec *sqlite3BitvecCreate(u32);\nint sqlite3BitvecTest(Bitvec*, u32);\nint sqlite3BitvecTestNotNull(Bitvec*, u32);\nint sqlite3BitvecSet(Bitvec*, u32);\nvoid sqlite3BitvecClear(Bitvec*, u32, void*);\nvoid sqlite3BitvecDestroy(Bitvec*);\nu32 sqlite3BitvecSize(Bitvec*);\n#ifndef SQLITE_OMIT_BUILTIN_TEST\nint sqlite3BitvecBuiltinTest(int,int*);\n#endif\n\nRowSet *sqlite3RowSetInit(sqlite3*, void*, unsigned int);\nvoid sqlite3RowSetClear(RowSet*);\nvoid sqlite3RowSetInsert(RowSet*, i64);\nint sqlite3RowSetTest(RowSet*, int iBatch, i64);\nint sqlite3RowSetNext(RowSet*, i64*);\n\nvoid sqlite3CreateView(Parse*,Token*,Token*,Token*,ExprList*,Select*,int,int);\n\n#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)\n  int sqlite3ViewGetColumnNames(Parse*,Table*);\n#else\n# define sqlite3ViewGetColumnNames(A,B) 0\n#endif\n\n#if SQLITE_MAX_ATTACHED>30\n  int sqlite3DbMaskAllZero(yDbMask);\n#endif\nvoid sqlite3DropTable(Parse*, SrcList*, int, int);\nvoid sqlite3CodeDropTable(Parse*, Table*, int, int);\nvoid sqlite3DeleteTable(sqlite3*, Table*);\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n  void sqlite3AutoincrementBegin(Parse *pParse);\n  void sqlite3AutoincrementEnd(Parse *pParse);\n#else\n# define sqlite3AutoincrementBegin(X)\n# define sqlite3AutoincrementEnd(X)\n#endif\nvoid sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int);\nvoid *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);\nIdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);\nint sqlite3IdListIndex(IdList*,const char*);\nSrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);\nSrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);\nSrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,\n                                      Token*, Select*, Expr*, IdList*);\nvoid sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);\nvoid sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*);\nint sqlite3IndexedByLookup(Parse *, struct SrcList_item *);\nvoid sqlite3SrcListShiftJoinType(SrcList*);\nvoid sqlite3SrcListAssignCursors(Parse*, SrcList*);\nvoid sqlite3IdListDelete(sqlite3*, IdList*);\nvoid sqlite3SrcListDelete(sqlite3*, SrcList*);\nIndex *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**);\nvoid sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,\n                          Expr*, int, int, u8);\nvoid sqlite3DropIndex(Parse*, SrcList*, int);\nint sqlite3Select(Parse*, Select*, SelectDest*);\nSelect *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,\n                         Expr*,ExprList*,u32,Expr*,Expr*);\nvoid sqlite3SelectDelete(sqlite3*, Select*);\nTable *sqlite3SrcListLookup(Parse*, SrcList*);\nint sqlite3IsReadOnly(Parse*, Table*, int);\nvoid sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);\n#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)\nExpr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,Expr*,char*);\n#endif\nvoid sqlite3DeleteFrom(Parse*, SrcList*, Expr*);\nvoid sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);\nWhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);\nvoid sqlite3WhereEnd(WhereInfo*);\nLogEst sqlite3WhereOutputRowCount(WhereInfo*);\nint sqlite3WhereIsDistinct(WhereInfo*);\nint sqlite3WhereIsOrdered(WhereInfo*);\nint sqlite3WhereOrderedInnerLoop(WhereInfo*);\nint sqlite3WhereIsSorted(WhereInfo*);\nint sqlite3WhereContinueLabel(WhereInfo*);\nint sqlite3WhereBreakLabel(WhereInfo*);\nint sqlite3WhereOkOnePass(WhereInfo*, int*);\n#define ONEPASS_OFF      0        /* Use of ONEPASS not allowed */\n#define ONEPASS_SINGLE   1        /* ONEPASS valid for a single row update */\n#define ONEPASS_MULTI    2        /* ONEPASS is valid for multiple rows */\nvoid sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int);\nint sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8);\nvoid sqlite3ExprCodeGetColumnToReg(Parse*, Table*, int, int, int);\nvoid sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);\nvoid sqlite3ExprCodeMove(Parse*, int, int, int);\nvoid sqlite3ExprCacheStore(Parse*, int, int, int);\nvoid sqlite3ExprCachePush(Parse*);\nvoid sqlite3ExprCachePop(Parse*);\nvoid sqlite3ExprCacheRemove(Parse*, int, int);\nvoid sqlite3ExprCacheClear(Parse*);\nvoid sqlite3ExprCacheAffinityChange(Parse*, int, int);\nvoid sqlite3ExprCode(Parse*, Expr*, int);\nvoid sqlite3ExprCodeCopy(Parse*, Expr*, int);\nvoid sqlite3ExprCodeFactorable(Parse*, Expr*, int);\nvoid sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8);\nint sqlite3ExprCodeTemp(Parse*, Expr*, int*);\nint sqlite3ExprCodeTarget(Parse*, Expr*, int);\nvoid sqlite3ExprCodeAndCache(Parse*, Expr*, int);\nint sqlite3ExprCodeExprList(Parse*, ExprList*, int, int, u8);\n#define SQLITE_ECEL_DUP      0x01  /* Deep, not shallow copies */\n#define SQLITE_ECEL_FACTOR   0x02  /* Factor out constant terms */\n#define SQLITE_ECEL_REF      0x04  /* Use ExprList.u.x.iOrderByCol */\nvoid sqlite3ExprIfTrue(Parse*, Expr*, int, int);\nvoid sqlite3ExprIfFalse(Parse*, Expr*, int, int);\nvoid sqlite3ExprIfFalseDup(Parse*, Expr*, int, int);\nTable *sqlite3FindTable(sqlite3*,const char*, const char*);\n#define LOCATE_VIEW    0x01\n#define LOCATE_NOERR   0x02\nTable *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*);\nTable *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *);\nIndex *sqlite3FindIndex(sqlite3*,const char*, const char*);\nvoid sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);\nvoid sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);\nvoid sqlite3Vacuum(Parse*,Token*);\nint sqlite3RunVacuum(char**, sqlite3*, int);\nchar *sqlite3NameFromToken(sqlite3*, Token*);\nint sqlite3ExprCompare(Expr*, Expr*, int);\nint sqlite3ExprListCompare(ExprList*, ExprList*, int);\nint sqlite3ExprImpliesExpr(Expr*, Expr*, int);\nvoid sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);\nvoid sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);\nint sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);\nint sqlite3FunctionUsesThisSrc(Expr*, SrcList*);\nVdbe *sqlite3GetVdbe(Parse*);\n#ifndef SQLITE_OMIT_BUILTIN_TEST\nvoid sqlite3PrngSaveState(void);\nvoid sqlite3PrngRestoreState(void);\n#endif\nvoid sqlite3RollbackAll(sqlite3*,int);\nvoid sqlite3CodeVerifySchema(Parse*, int);\nvoid sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);\nvoid sqlite3BeginTransaction(Parse*, int);\nvoid sqlite3CommitTransaction(Parse*);\nvoid sqlite3RollbackTransaction(Parse*);\nvoid sqlite3Savepoint(Parse*, int, Token*);\nvoid sqlite3CloseSavepoints(sqlite3 *);\nvoid sqlite3LeaveMutexAndCloseZombie(sqlite3*);\nint sqlite3ExprIsConstant(Expr*);\nint sqlite3ExprIsConstantNotJoin(Expr*);\nint sqlite3ExprIsConstantOrFunction(Expr*, u8);\nint sqlite3ExprIsTableConstant(Expr*,int);\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\nint sqlite3ExprContainsSubquery(Expr*);\n#endif\nint sqlite3ExprIsInteger(Expr*, int*);\nint sqlite3ExprCanBeNull(const Expr*);\nint sqlite3ExprNeedsNoAffinityChange(const Expr*, char);\nint sqlite3IsRowid(const char*);\nvoid sqlite3GenerateRowDelete(\n    Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int);\nvoid sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int);\nint sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int);\nvoid sqlite3ResolvePartIdxLabel(Parse*,int);\nvoid sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int,\n                                     u8,u8,int,int*,int*);\nvoid sqlite3CompleteInsertion(Parse*,Table*,int,int,int,int*,int,int,int);\nint sqlite3OpenTableAndIndices(Parse*, Table*, int, u8, int, u8*, int*, int*);\nvoid sqlite3BeginWriteOperation(Parse*, int, int);\nvoid sqlite3MultiWrite(Parse*);\nvoid sqlite3MayAbort(Parse*);\nvoid sqlite3HaltConstraint(Parse*, int, int, char*, i8, u8);\nvoid sqlite3UniqueConstraint(Parse*, int, Index*);\nvoid sqlite3RowidConstraint(Parse*, int, Table*);\nExpr *sqlite3ExprDup(sqlite3*,Expr*,int);\nExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int);\nSrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int);\nIdList *sqlite3IdListDup(sqlite3*,IdList*);\nSelect *sqlite3SelectDup(sqlite3*,Select*,int);\n#if SELECTTRACE_ENABLED\nvoid sqlite3SelectSetName(Select*,const char*);\n#else\n# define sqlite3SelectSetName(A,B)\n#endif\nvoid sqlite3InsertBuiltinFuncs(FuncDef*,int);\nFuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8);\nvoid sqlite3RegisterBuiltinFunctions(void);\nvoid sqlite3RegisterDateTimeFunctions(void);\nvoid sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*);\nint sqlite3SafetyCheckOk(sqlite3*);\nint sqlite3SafetyCheckSickOrOk(sqlite3*);\nvoid sqlite3ChangeCookie(Parse*, int);\n\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\nvoid sqlite3MaterializeView(Parse*, Table*, Expr*, int);\n#endif\n\n#ifndef SQLITE_OMIT_TRIGGER\n  void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,\n                           Expr*,int, int);\n  void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);\n  void sqlite3DropTrigger(Parse*, SrcList*, int);\n  void sqlite3DropTriggerPtr(Parse*, Trigger*);\n  Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask);\n  Trigger *sqlite3TriggerList(Parse *, Table *);\n  void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *,\n                            int, int, int);\n  void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int);\n  void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);\n  void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);\n  TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*);\n  TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,\n                                        Select*,u8);\n  TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8);\n  TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*);\n  void sqlite3DeleteTrigger(sqlite3*, Trigger*);\n  void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);\n  u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);\n# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))\n# define sqlite3IsToplevel(p) ((p)->pToplevel==0)\n#else\n# define sqlite3TriggersExist(B,C,D,E,F) 0\n# define sqlite3DeleteTrigger(A,B)\n# define sqlite3DropTriggerPtr(A,B)\n# define sqlite3UnlinkAndDeleteTrigger(A,B,C)\n# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I)\n# define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)\n# define sqlite3TriggerList(X, Y) 0\n# define sqlite3ParseToplevel(p) p\n# define sqlite3IsToplevel(p) 1\n# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0\n#endif\n\nint sqlite3JoinType(Parse*, Token*, Token*, Token*);\nvoid sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);\nvoid sqlite3DeferForeignKey(Parse*, int);\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);\n  int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);\n  void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);\n  void sqlite3AuthContextPop(AuthContext*);\n  int sqlite3AuthReadCol(Parse*, const char *, const char *, int);\n#else\n# define sqlite3AuthRead(a,b,c,d)\n# define sqlite3AuthCheck(a,b,c,d,e)    SQLITE_OK\n# define sqlite3AuthContextPush(a,b,c)\n# define sqlite3AuthContextPop(a)  ((void)(a))\n#endif\nvoid sqlite3Attach(Parse*, Expr*, Expr*, Expr*);\nvoid sqlite3Detach(Parse*, Expr*);\nvoid sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);\nint sqlite3FixSrcList(DbFixer*, SrcList*);\nint sqlite3FixSelect(DbFixer*, Select*);\nint sqlite3FixExpr(DbFixer*, Expr*);\nint sqlite3FixExprList(DbFixer*, ExprList*);\nint sqlite3FixTriggerStep(DbFixer*, TriggerStep*);\nint sqlite3AtoF(const char *z, double*, int, u8);\nint sqlite3GetInt32(const char *, int*);\nint sqlite3Atoi(const char*);\nint sqlite3Utf16ByteLen(const void *pData, int nChar);\nint sqlite3Utf8CharLen(const char *pData, int nByte);\nu32 sqlite3Utf8Read(const u8**);\nLogEst sqlite3LogEst(u64);\nLogEst sqlite3LogEstAdd(LogEst,LogEst);\n#ifndef SQLITE_OMIT_VIRTUALTABLE\nLogEst sqlite3LogEstFromDouble(double);\n#endif\n#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \\\n    defined(SQLITE_ENABLE_STAT3_OR_STAT4) || \\\n    defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)\nu64 sqlite3LogEstToInt(LogEst);\n#endif\n\n/*\n** Routines to read and write variable-length integers.  These used to\n** be defined locally, but now we use the varint routines in the util.c\n** file.\n*/\nint sqlite3PutVarint(unsigned char*, u64);\nu8 sqlite3GetVarint(const unsigned char *, u64 *);\nu8 sqlite3GetVarint32(const unsigned char *, u32 *);\nint sqlite3VarintLen(u64 v);\n\n/*\n** The common case is for a varint to be a single byte.  They following\n** macros handle the common case without a procedure call, but then call\n** the procedure for larger varints.\n*/\n#define getVarint32(A,B)  \\\n  (u8)((*(A)<(u8)0x80)?((B)=(u32)*(A)),1:sqlite3GetVarint32((A),(u32 *)&(B)))\n#define putVarint32(A,B)  \\\n  (u8)(((u32)(B)<(u32)0x80)?(*(A)=(unsigned char)(B)),1:\\\n  sqlite3PutVarint((A),(B)))\n#define getVarint    sqlite3GetVarint\n#define putVarint    sqlite3PutVarint\n\n\nconst char *sqlite3IndexAffinityStr(sqlite3*, Index*);\nvoid sqlite3TableAffinity(Vdbe*, Table*, int);\nchar sqlite3CompareAffinity(Expr *pExpr, char aff2);\nint sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);\nchar sqlite3TableColumnAffinity(Table*,int);\nchar sqlite3ExprAffinity(Expr *pExpr);\nint sqlite3Atoi64(const char*, i64*, int, u8);\nint sqlite3DecOrHexToI64(const char*, i64*);\nvoid sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);\nvoid sqlite3Error(sqlite3*,int);\nvoid sqlite3SystemError(sqlite3*,int);\nvoid *sqlite3HexToBlob(sqlite3*, const char *z, int n);\nu8 sqlite3HexToInt(int h);\nint sqlite3TwoPartName(Parse *, Token *, Token *, Token **);\n\n#if defined(SQLITE_NEED_ERR_NAME)\nconst char *sqlite3ErrName(int);\n#endif\n\nconst char *sqlite3ErrStr(int);\nint sqlite3ReadSchema(Parse *pParse);\nCollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);\nCollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);\nCollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);\nExpr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);\nExpr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*);\nExpr *sqlite3ExprSkipCollate(Expr*);\nint sqlite3CheckCollSeq(Parse *, CollSeq *);\nint sqlite3CheckObjectName(Parse *, const char *);\nvoid sqlite3VdbeSetChanges(sqlite3 *, int);\nint sqlite3AddInt64(i64*,i64);\nint sqlite3SubInt64(i64*,i64);\nint sqlite3MulInt64(i64*,i64);\nint sqlite3AbsInt32(int);\n#ifdef SQLITE_ENABLE_8_3_NAMES\nvoid sqlite3FileSuffix3(const char*, char*);\n#else\n# define sqlite3FileSuffix3(X,Y)\n#endif\nu8 sqlite3GetBoolean(const char *z,u8);\n\nconst void *sqlite3ValueText(sqlite3_value*, u8);\nint sqlite3ValueBytes(sqlite3_value*, u8);\nvoid sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,\n                        void(*)(void*));\nvoid sqlite3ValueSetNull(sqlite3_value*);\nvoid sqlite3ValueFree(sqlite3_value*);\nsqlite3_value *sqlite3ValueNew(sqlite3 *);\nchar *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);\nint sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);\nvoid sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);\n#ifndef SQLITE_AMALGAMATION\nextern const unsigned char sqlite3OpcodeProperty[];\nextern const char sqlite3StrBINARY[];\nextern const unsigned char sqlite3UpperToLower[];\nextern const unsigned char sqlite3CtypeMap[];\nextern const Token sqlite3IntTokens[];\nextern SQLITE_WSD struct Sqlite3Config sqlite3Config;\nextern FuncDefHash sqlite3BuiltinFunctions;\n#ifndef SQLITE_OMIT_WSD\nextern int sqlite3PendingByte;\n#endif\n#endif\nvoid sqlite3RootPageMoved(sqlite3*, int, int, int);\nvoid sqlite3Reindex(Parse*, Token*, Token*);\nvoid sqlite3AlterFunctions(void);\nvoid sqlite3AlterRenameTable(Parse*, SrcList*, Token*);\nint sqlite3GetToken(const unsigned char *, int *);\nvoid sqlite3NestedParse(Parse*, const char*, ...);\nvoid sqlite3ExpirePreparedStatements(sqlite3*);\nint sqlite3CodeSubselect(Parse*, Expr *, int, int);\nvoid sqlite3SelectPrep(Parse*, Select*, NameContext*);\nvoid sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p);\nint sqlite3MatchSpanName(const char*, const char*, const char*, const char*);\nint sqlite3ResolveExprNames(NameContext*, Expr*);\nint sqlite3ResolveExprListNames(NameContext*, ExprList*);\nvoid sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);\nvoid sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*);\nint sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);\nvoid sqlite3ColumnDefault(Vdbe *, Table *, int, int);\nvoid sqlite3AlterFinishAddColumn(Parse *, Token *);\nvoid sqlite3AlterBeginAddColumn(Parse *, SrcList *);\nCollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*);\nchar sqlite3AffinityType(const char*, u8*);\nvoid sqlite3Analyze(Parse*, Token*, Token*);\nint sqlite3InvokeBusyHandler(BusyHandler*);\nint sqlite3FindDb(sqlite3*, Token*);\nint sqlite3FindDbName(sqlite3 *, const char *);\nint sqlite3AnalysisLoad(sqlite3*,int iDB);\nvoid sqlite3DeleteIndexSamples(sqlite3*,Index*);\nvoid sqlite3DefaultRowEst(Index*);\nvoid sqlite3RegisterLikeFunctions(sqlite3*, int);\nint sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);\nvoid sqlite3SchemaClear(void *);\nSchema *sqlite3SchemaGet(sqlite3 *, Btree *);\nint sqlite3SchemaToIndex(sqlite3 *db, Schema *);\nKeyInfo *sqlite3KeyInfoAlloc(sqlite3*,int,int);\nvoid sqlite3KeyInfoUnref(KeyInfo*);\nKeyInfo *sqlite3KeyInfoRef(KeyInfo*);\nKeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*);\n#ifdef SQLITE_DEBUG\nint sqlite3KeyInfoIsWriteable(KeyInfo*);\n#endif\nint sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *,\n  void (*)(sqlite3_context*,int,sqlite3_value **),\n  void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*),\n  FuncDestructor *pDestructor\n);\nvoid sqlite3OomFault(sqlite3*);\nvoid sqlite3OomClear(sqlite3*);\nint sqlite3ApiExit(sqlite3 *db, int);\nint sqlite3OpenTempDatabase(Parse *);\n\nvoid sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int);\nvoid sqlite3StrAccumAppend(StrAccum*,const char*,int);\nvoid sqlite3StrAccumAppendAll(StrAccum*,const char*);\nvoid sqlite3AppendChar(StrAccum*,int,char);\nchar *sqlite3StrAccumFinish(StrAccum*);\nvoid sqlite3StrAccumReset(StrAccum*);\nvoid sqlite3SelectDestInit(SelectDest*,int,int);\nExpr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);\n\nvoid sqlite3BackupRestart(sqlite3_backup *);\nvoid sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);\n\n#ifndef SQLITE_OMIT_SUBQUERY\nint sqlite3ExprCheckIN(Parse*, Expr*);\n#else\n# define sqlite3ExprCheckIN(x,y) SQLITE_OK\n#endif\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\nvoid sqlite3AnalyzeFunctions(void);\nint sqlite3Stat4ProbeSetValue(\n    Parse*,Index*,UnpackedRecord**,Expr*,int,int,int*);\nint sqlite3Stat4ValueFromExpr(Parse*, Expr*, u8, sqlite3_value**);\nvoid sqlite3Stat4ProbeFree(UnpackedRecord*);\nint sqlite3Stat4Column(sqlite3*, const void*, int, int, sqlite3_value**);\nchar sqlite3IndexColumnAffinity(sqlite3*, Index*, int);\n#endif\n\n/*\n** The interface to the LEMON-generated parser\n*/\nvoid *sqlite3ParserAlloc(void*(*)(u64));\nvoid sqlite3ParserFree(void*, void(*)(void*));\nvoid sqlite3Parser(void*, int, Token, Parse*);\n#ifdef YYTRACKMAXSTACKDEPTH\n  int sqlite3ParserStackPeak(void*);\n#endif\n\nvoid sqlite3AutoLoadExtensions(sqlite3*);\n#ifndef SQLITE_OMIT_LOAD_EXTENSION\n  void sqlite3CloseExtensions(sqlite3*);\n#else\n# define sqlite3CloseExtensions(X)\n#endif\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  void sqlite3TableLock(Parse *, int, int, u8, const char *);\n#else\n  #define sqlite3TableLock(v,w,x,y,z)\n#endif\n\n#ifdef SQLITE_TEST\n  int sqlite3Utf8To8(unsigned char*);\n#endif\n\n#ifdef SQLITE_OMIT_VIRTUALTABLE\n#  define sqlite3VtabClear(Y)\n#  define sqlite3VtabSync(X,Y) SQLITE_OK\n#  define sqlite3VtabRollback(X)\n#  define sqlite3VtabCommit(X)\n#  define sqlite3VtabInSync(db) 0\n#  define sqlite3VtabLock(X)\n#  define sqlite3VtabUnlock(X)\n#  define sqlite3VtabUnlockList(X)\n#  define sqlite3VtabSavepoint(X, Y, Z) SQLITE_OK\n#  define sqlite3GetVTable(X,Y)  ((VTable*)0)\n#else\n   void sqlite3VtabClear(sqlite3 *db, Table*);\n   void sqlite3VtabDisconnect(sqlite3 *db, Table *p);\n   int sqlite3VtabSync(sqlite3 *db, Vdbe*);\n   int sqlite3VtabRollback(sqlite3 *db);\n   int sqlite3VtabCommit(sqlite3 *db);\n   void sqlite3VtabLock(VTable *);\n   void sqlite3VtabUnlock(VTable *);\n   void sqlite3VtabUnlockList(sqlite3*);\n   int sqlite3VtabSavepoint(sqlite3 *, int, int);\n   void sqlite3VtabImportErrmsg(Vdbe*, sqlite3_vtab*);\n   VTable *sqlite3GetVTable(sqlite3*, Table*);\n#  define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)\n#endif\nint sqlite3VtabEponymousTableInit(Parse*,Module*);\nvoid sqlite3VtabEponymousTableClear(sqlite3*,Module*);\nvoid sqlite3VtabMakeWritable(Parse*,Table*);\nvoid sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int);\nvoid sqlite3VtabFinishParse(Parse*, Token*);\nvoid sqlite3VtabArgInit(Parse*);\nvoid sqlite3VtabArgExtend(Parse*, Token*);\nint sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);\nint sqlite3VtabCallConnect(Parse*, Table*);\nint sqlite3VtabCallDestroy(sqlite3*, int, const char *);\nint sqlite3VtabBegin(sqlite3 *, VTable *);\nFuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);\nvoid sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**);\nsqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*);\nint sqlite3VdbeParameterIndex(Vdbe*, const char*, int);\nint sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);\nvoid sqlite3ParserReset(Parse*);\nint sqlite3Reprepare(Vdbe*);\nvoid sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);\nCollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *);\nint sqlite3TempInMemory(const sqlite3*);\nconst char *sqlite3JournalModename(int);\n#ifndef SQLITE_OMIT_WAL\n  int sqlite3Checkpoint(sqlite3*, int, int, int*, int*);\n  int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int);\n#endif\n#ifndef SQLITE_OMIT_CTE\n  With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*);\n  void sqlite3WithDelete(sqlite3*,With*);\n  void sqlite3WithPush(Parse*, With*, u8);\n#else\n#define sqlite3WithPush(x,y,z)\n#define sqlite3WithDelete(x,y)\n#endif\n\n/* Declarations for functions in fkey.c. All of these are replaced by\n** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign\n** key functionality is available. If OMIT_TRIGGER is defined but\n** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In\n** this case foreign keys are parsed, but no other functionality is\n** provided (enforcement of FK constraints requires the triggers sub-system).\n*/\n#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)\n  void sqlite3FkCheck(Parse*, Table*, int, int, int*, int);\n  void sqlite3FkDropTable(Parse*, SrcList *, Table*);\n  void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int);\n  int sqlite3FkRequired(Parse*, Table*, int*, int);\n  u32 sqlite3FkOldmask(Parse*, Table*);\n  FKey *sqlite3FkReferences(Table *);\n#else\n  #define sqlite3FkActions(a,b,c,d,e,f)\n  #define sqlite3FkCheck(a,b,c,d,e,f)\n  #define sqlite3FkDropTable(a,b,c)\n  #define sqlite3FkOldmask(a,b)         0\n  #define sqlite3FkRequired(a,b,c,d)    0\n#endif\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n  void sqlite3FkDelete(sqlite3 *, Table*);\n  int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**);\n#else\n  #define sqlite3FkDelete(a,b)\n  #define sqlite3FkLocateIndex(a,b,c,d,e)\n#endif\n\n\n/*\n** Available fault injectors.  Should be numbered beginning with 0.\n*/\n#define SQLITE_FAULTINJECTOR_MALLOC     0\n#define SQLITE_FAULTINJECTOR_COUNT      1\n\n/*\n** The interface to the code in fault.c used for identifying \"benign\"\n** malloc failures. This is only present if SQLITE_OMIT_BUILTIN_TEST\n** is not defined.\n*/\n#ifndef SQLITE_OMIT_BUILTIN_TEST\n  void sqlite3BeginBenignMalloc(void);\n  void sqlite3EndBenignMalloc(void);\n#else\n  #define sqlite3BeginBenignMalloc()\n  #define sqlite3EndBenignMalloc()\n#endif\n\n/*\n** Allowed return values from sqlite3FindInIndex()\n*/\n#define IN_INDEX_ROWID        1   /* Search the rowid of the table */\n#define IN_INDEX_EPH          2   /* Search an ephemeral b-tree */\n#define IN_INDEX_INDEX_ASC    3   /* Existing index ASCENDING */\n#define IN_INDEX_INDEX_DESC   4   /* Existing index DESCENDING */\n#define IN_INDEX_NOOP         5   /* No table available. Use comparisons */\n/*\n** Allowed flags for the 3rd parameter to sqlite3FindInIndex().\n*/\n#define IN_INDEX_NOOP_OK     0x0001  /* OK to return IN_INDEX_NOOP */\n#define IN_INDEX_MEMBERSHIP  0x0002  /* IN operator used for membership test */\n#define IN_INDEX_LOOP        0x0004  /* IN operator used as a loop */\nint sqlite3FindInIndex(Parse *, Expr *, u32, int*, int*);\n\nint sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int);\nint sqlite3JournalSize(sqlite3_vfs *);\n#ifdef SQLITE_ENABLE_ATOMIC_WRITE\n  int sqlite3JournalCreate(sqlite3_file *);\n#endif\n\nint sqlite3JournalIsInMemory(sqlite3_file *p);\nvoid sqlite3MemJournalOpen(sqlite3_file *);\n\nvoid sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p);\n#if SQLITE_MAX_EXPR_DEPTH>0\n  int sqlite3SelectExprHeight(Select *);\n  int sqlite3ExprCheckHeight(Parse*, int);\n#else\n  #define sqlite3SelectExprHeight(x) 0\n  #define sqlite3ExprCheckHeight(x,y)\n#endif\n\nu32 sqlite3Get4byte(const u8*);\nvoid sqlite3Put4byte(u8*, u32);\n\n#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY\n  void sqlite3ConnectionBlocked(sqlite3 *, sqlite3 *);\n  void sqlite3ConnectionUnlocked(sqlite3 *db);\n  void sqlite3ConnectionClosed(sqlite3 *db);\n#else\n  #define sqlite3ConnectionBlocked(x,y)\n  #define sqlite3ConnectionUnlocked(x)\n  #define sqlite3ConnectionClosed(x)\n#endif\n\n#ifdef SQLITE_DEBUG\n  void sqlite3ParserTrace(FILE*, char *);\n#endif\n\n/*\n** If the SQLITE_ENABLE IOTRACE exists then the global variable\n** sqlite3IoTrace is a pointer to a printf-like routine used to\n** print I/O tracing messages.\n*/\n#ifdef SQLITE_ENABLE_IOTRACE\n# define IOTRACE(A)  if( sqlite3IoTrace ){ sqlite3IoTrace A; }\n  void sqlite3VdbeIOTraceSql(Vdbe*);\nSQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *sqlite3IoTrace)(const char*,...);\n#else\n# define IOTRACE(A)\n# define sqlite3VdbeIOTraceSql(X)\n#endif\n\n/*\n** These routines are available for the mem2.c debugging memory allocator\n** only.  They are used to verify that different \"types\" of memory\n** allocations are properly tracked by the system.\n**\n** sqlite3MemdebugSetType() sets the \"type\" of an allocation to one of\n** the MEMTYPE_* macros defined below.  The type must be a bitmask with\n** a single bit set.\n**\n** sqlite3MemdebugHasType() returns true if any of the bits in its second\n** argument match the type set by the previous sqlite3MemdebugSetType().\n** sqlite3MemdebugHasType() is intended for use inside assert() statements.\n**\n** sqlite3MemdebugNoType() returns true if none of the bits in its second\n** argument match the type set by the previous sqlite3MemdebugSetType().\n**\n** Perhaps the most important point is the difference between MEMTYPE_HEAP\n** and MEMTYPE_LOOKASIDE.  If an allocation is MEMTYPE_LOOKASIDE, that means\n** it might have been allocated by lookaside, except the allocation was\n** too large or lookaside was already full.  It is important to verify\n** that allocations that might have been satisfied by lookaside are not\n** passed back to non-lookaside free() routines.  Asserts such as the\n** example above are placed on the non-lookaside free() routines to verify\n** this constraint.\n**\n** All of this is no-op for a production build.  It only comes into\n** play when the SQLITE_MEMDEBUG compile-time option is used.\n*/\n#ifdef SQLITE_MEMDEBUG\n  void sqlite3MemdebugSetType(void*,u8);\n  int sqlite3MemdebugHasType(void*,u8);\n  int sqlite3MemdebugNoType(void*,u8);\n#else\n# define sqlite3MemdebugSetType(X,Y)  /* no-op */\n# define sqlite3MemdebugHasType(X,Y)  1\n# define sqlite3MemdebugNoType(X,Y)   1\n#endif\n#define MEMTYPE_HEAP       0x01  /* General heap allocations */\n#define MEMTYPE_LOOKASIDE  0x02  /* Heap that might have been lookaside */\n#define MEMTYPE_SCRATCH    0x04  /* Scratch allocations */\n#define MEMTYPE_PCACHE     0x08  /* Page cache allocations */\n\n/*\n** Threading interface\n*/\n#if SQLITE_MAX_WORKER_THREADS>0\nint sqlite3ThreadCreate(SQLiteThread**,void*(*)(void*),void*);\nint sqlite3ThreadJoin(SQLiteThread*, void**);\n#endif\n\n#if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)\nint sqlite3DbstatRegister(sqlite3*);\n#endif\n\nint sqlite3ExprVectorSize(Expr *pExpr);\nint sqlite3ExprIsVector(Expr *pExpr);\nExpr *sqlite3VectorFieldSubexpr(Expr*, int);\nExpr *sqlite3ExprForVectorField(Parse*,Expr*,int);\n\n#endif /* SQLITEINT_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/sqliteLimit.h",
    "content": "/*\n** 2007 May 7\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** \n** This file defines various limits of what SQLite can process.\n*/\n\n/*\n** The maximum length of a TEXT or BLOB in bytes.   This also\n** limits the size of a row in a table or index.\n**\n** The hard limit is the ability of a 32-bit signed integer\n** to count the size: 2^31-1 or 2147483647.\n*/\n#ifndef SQLITE_MAX_LENGTH\n# define SQLITE_MAX_LENGTH 1000000000\n#endif\n\n/*\n** This is the maximum number of\n**\n**    * Columns in a table\n**    * Columns in an index\n**    * Columns in a view\n**    * Terms in the SET clause of an UPDATE statement\n**    * Terms in the result set of a SELECT statement\n**    * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.\n**    * Terms in the VALUES clause of an INSERT statement\n**\n** The hard upper limit here is 32676.  Most database people will\n** tell you that in a well-normalized database, you usually should\n** not have more than a dozen or so columns in any table.  And if\n** that is the case, there is no point in having more than a few\n** dozen values in any of the other situations described above.\n*/\n#ifndef SQLITE_MAX_COLUMN\n# define SQLITE_MAX_COLUMN 2000\n#endif\n\n/*\n** The maximum length of a single SQL statement in bytes.\n**\n** It used to be the case that setting this value to zero would\n** turn the limit off.  That is no longer true.  It is not possible\n** to turn this limit off.\n*/\n#ifndef SQLITE_MAX_SQL_LENGTH\n# define SQLITE_MAX_SQL_LENGTH 1000000000\n#endif\n\n/*\n** The maximum depth of an expression tree. This is limited to \n** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might \n** want to place more severe limits on the complexity of an \n** expression.\n**\n** A value of 0 used to mean that the limit was not enforced.\n** But that is no longer true.  The limit is now strictly enforced\n** at all times.\n*/\n#ifndef SQLITE_MAX_EXPR_DEPTH\n# define SQLITE_MAX_EXPR_DEPTH 1000\n#endif\n\n/*\n** The maximum number of terms in a compound SELECT statement.\n** The code generator for compound SELECT statements does one\n** level of recursion for each term.  A stack overflow can result\n** if the number of terms is too large.  In practice, most SQL\n** never has more than 3 or 4 terms.  Use a value of 0 to disable\n** any limit on the number of terms in a compount SELECT.\n*/\n#ifndef SQLITE_MAX_COMPOUND_SELECT\n# define SQLITE_MAX_COMPOUND_SELECT 500\n#endif\n\n/*\n** The maximum number of opcodes in a VDBE program.\n** Not currently enforced.\n*/\n#ifndef SQLITE_MAX_VDBE_OP\n# define SQLITE_MAX_VDBE_OP 25000\n#endif\n\n/*\n** The maximum number of arguments to an SQL function.\n*/\n#ifndef SQLITE_MAX_FUNCTION_ARG\n# define SQLITE_MAX_FUNCTION_ARG 127\n#endif\n\n/*\n** The suggested maximum number of in-memory pages to use for\n** the main database table and for temporary tables.\n**\n** IMPLEMENTATION-OF: R-30185-15359 The default suggested cache size is -2000,\n** which means the cache size is limited to 2048000 bytes of memory.\n** IMPLEMENTATION-OF: R-48205-43578 The default suggested cache size can be\n** altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options.\n*/\n#ifndef SQLITE_DEFAULT_CACHE_SIZE\n# define SQLITE_DEFAULT_CACHE_SIZE  -2000\n#endif\n\n/*\n** The default number of frames to accumulate in the log file before\n** checkpointing the database in WAL mode.\n*/\n#ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT\n# define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT  1000\n#endif\n\n/*\n** The maximum number of attached databases.  This must be between 0\n** and 125.  The upper bound of 125 is because the attached databases are\n** counted using a signed 8-bit integer which has a maximum value of 127\n** and we have to allow 2 extra counts for the \"main\" and \"temp\" databases.\n*/\n#ifndef SQLITE_MAX_ATTACHED\n# define SQLITE_MAX_ATTACHED 10\n#endif\n\n\n/*\n** The maximum value of a ?nnn wildcard that the parser will accept.\n*/\n#ifndef SQLITE_MAX_VARIABLE_NUMBER\n# define SQLITE_MAX_VARIABLE_NUMBER 999\n#endif\n\n/* Maximum page size.  The upper bound on this value is 65536.  This a limit\n** imposed by the use of 16-bit offsets within each page.\n**\n** Earlier versions of SQLite allowed the user to change this value at\n** compile time. This is no longer permitted, on the grounds that it creates\n** a library that is technically incompatible with an SQLite library \n** compiled with a different limit. If a process operating on a database \n** with a page-size of 65536 bytes crashes, then an instance of SQLite \n** compiled with the default page-size limit will not be able to rollback \n** the aborted transaction. This could lead to database corruption.\n*/\n#ifdef SQLITE_MAX_PAGE_SIZE\n# undef SQLITE_MAX_PAGE_SIZE\n#endif\n#define SQLITE_MAX_PAGE_SIZE 65536\n\n\n/*\n** The default size of a database page.\n*/\n#ifndef SQLITE_DEFAULT_PAGE_SIZE\n# define SQLITE_DEFAULT_PAGE_SIZE 4096\n#endif\n#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE\n# undef SQLITE_DEFAULT_PAGE_SIZE\n# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE\n#endif\n\n/*\n** Ordinarily, if no value is explicitly provided, SQLite creates databases\n** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain\n** device characteristics (sector-size and atomic write() support),\n** SQLite may choose a larger value. This constant is the maximum value\n** SQLite will choose on its own.\n*/\n#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE\n# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192\n#endif\n#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE\n# undef SQLITE_MAX_DEFAULT_PAGE_SIZE\n# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE\n#endif\n\n\n/*\n** Maximum number of pages in one database file.\n**\n** This is really just the default value for the max_page_count pragma.\n** This value can be lowered (or raised) at run-time using that the\n** max_page_count macro.\n*/\n#ifndef SQLITE_MAX_PAGE_COUNT\n# define SQLITE_MAX_PAGE_COUNT 1073741823\n#endif\n\n/*\n** Maximum length (in bytes) of the pattern in a LIKE or GLOB\n** operator.\n*/\n#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH\n# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000\n#endif\n\n/*\n** Maximum depth of recursion for triggers.\n**\n** A value of 1 means that a trigger program will not be able to itself\n** fire any triggers. A value of 0 means that no trigger programs at all \n** may be executed.\n*/\n#ifndef SQLITE_MAX_TRIGGER_DEPTH\n# define SQLITE_MAX_TRIGGER_DEPTH 1000\n#endif\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/status.c",
    "content": "/*\n** 2008 June 18\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This module implements the sqlite3_status() interface and related\n** functionality.\n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n/*\n** Variables in which to record status information.\n*/\n#if SQLITE_PTRSIZE>4\ntypedef sqlite3_int64 sqlite3StatValueType;\n#else\ntypedef u32 sqlite3StatValueType;\n#endif\ntypedef struct sqlite3StatType sqlite3StatType;\nstatic SQLITE_WSD struct sqlite3StatType {\n  sqlite3StatValueType nowValue[10];  /* Current value */\n  sqlite3StatValueType mxValue[10];   /* Maximum value */\n} sqlite3Stat = { {0,}, {0,} };\n\n/*\n** Elements of sqlite3Stat[] are protected by either the memory allocator\n** mutex, or by the pcache1 mutex.  The following array determines which.\n*/\nstatic const char statMutex[] = {\n  0,  /* SQLITE_STATUS_MEMORY_USED */\n  1,  /* SQLITE_STATUS_PAGECACHE_USED */\n  1,  /* SQLITE_STATUS_PAGECACHE_OVERFLOW */\n  0,  /* SQLITE_STATUS_SCRATCH_USED */\n  0,  /* SQLITE_STATUS_SCRATCH_OVERFLOW */\n  0,  /* SQLITE_STATUS_MALLOC_SIZE */\n  0,  /* SQLITE_STATUS_PARSER_STACK */\n  1,  /* SQLITE_STATUS_PAGECACHE_SIZE */\n  0,  /* SQLITE_STATUS_SCRATCH_SIZE */\n  0,  /* SQLITE_STATUS_MALLOC_COUNT */\n};\n\n\n/* The \"wsdStat\" macro will resolve to the status information\n** state vector.  If writable static data is unsupported on the target,\n** we have to locate the state vector at run-time.  In the more common\n** case where writable static data is supported, wsdStat can refer directly\n** to the \"sqlite3Stat\" state vector declared above.\n*/\n#ifdef SQLITE_OMIT_WSD\n# define wsdStatInit  sqlite3StatType *x = &GLOBAL(sqlite3StatType,sqlite3Stat)\n# define wsdStat x[0]\n#else\n# define wsdStatInit\n# define wsdStat sqlite3Stat\n#endif\n\n/*\n** Return the current value of a status parameter.  The caller must\n** be holding the appropriate mutex.\n*/\nsqlite3_int64 sqlite3StatusValue(int op){\n  wsdStatInit;\n  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );\n  assert( op>=0 && op<ArraySize(statMutex) );\n  assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()\n                                           : sqlite3MallocMutex()) );\n  return wsdStat.nowValue[op];\n}\n\n/*\n** Add N to the value of a status record.  The caller must hold the\n** appropriate mutex.  (Locking is checked by assert()).\n**\n** The StatusUp() routine can accept positive or negative values for N.\n** The value of N is added to the current status value and the high-water\n** mark is adjusted if necessary.\n**\n** The StatusDown() routine lowers the current value by N.  The highwater\n** mark is unchanged.  N must be non-negative for StatusDown().\n*/\nvoid sqlite3StatusUp(int op, int N){\n  wsdStatInit;\n  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );\n  assert( op>=0 && op<ArraySize(statMutex) );\n  assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()\n                                           : sqlite3MallocMutex()) );\n  wsdStat.nowValue[op] += N;\n  if( wsdStat.nowValue[op]>wsdStat.mxValue[op] ){\n    wsdStat.mxValue[op] = wsdStat.nowValue[op];\n  }\n}\nvoid sqlite3StatusDown(int op, int N){\n  wsdStatInit;\n  assert( N>=0 );\n  assert( op>=0 && op<ArraySize(statMutex) );\n  assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()\n                                           : sqlite3MallocMutex()) );\n  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );\n  wsdStat.nowValue[op] -= N;\n}\n\n/*\n** Adjust the highwater mark if necessary.\n** The caller must hold the appropriate mutex.\n*/\nvoid sqlite3StatusHighwater(int op, int X){\n  sqlite3StatValueType newValue;\n  wsdStatInit;\n  assert( X>=0 );\n  newValue = (sqlite3StatValueType)X;\n  assert( op>=0 && op<ArraySize(wsdStat.nowValue) );\n  assert( op>=0 && op<ArraySize(statMutex) );\n  assert( sqlite3_mutex_held(statMutex[op] ? sqlite3Pcache1Mutex()\n                                           : sqlite3MallocMutex()) );\n  assert( op==SQLITE_STATUS_MALLOC_SIZE\n          || op==SQLITE_STATUS_PAGECACHE_SIZE\n          || op==SQLITE_STATUS_SCRATCH_SIZE\n          || op==SQLITE_STATUS_PARSER_STACK );\n  if( newValue>wsdStat.mxValue[op] ){\n    wsdStat.mxValue[op] = newValue;\n  }\n}\n\n/*\n** Query status information.\n*/\nint sqlite3_status64(\n  int op,\n  sqlite3_int64 *pCurrent,\n  sqlite3_int64 *pHighwater,\n  int resetFlag\n){\n  sqlite3_mutex *pMutex;\n  wsdStatInit;\n  if( op<0 || op>=ArraySize(wsdStat.nowValue) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  pMutex = statMutex[op] ? sqlite3Pcache1Mutex() : sqlite3MallocMutex();\n  sqlite3_mutex_enter(pMutex);\n  *pCurrent = wsdStat.nowValue[op];\n  *pHighwater = wsdStat.mxValue[op];\n  if( resetFlag ){\n    wsdStat.mxValue[op] = wsdStat.nowValue[op];\n  }\n  sqlite3_mutex_leave(pMutex);\n  (void)pMutex;  /* Prevent warning when SQLITE_THREADSAFE=0 */\n  return SQLITE_OK;\n}\nint sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){\n  sqlite3_int64 iCur = 0, iHwtr = 0;\n  int rc;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( pCurrent==0 || pHighwater==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  rc = sqlite3_status64(op, &iCur, &iHwtr, resetFlag);\n  if( rc==0 ){\n    *pCurrent = (int)iCur;\n    *pHighwater = (int)iHwtr;\n  }\n  return rc;\n}\n\n/*\n** Query status information for a single database connection\n*/\nint sqlite3_db_status(\n  sqlite3 *db,          /* The database connection whose status is desired */\n  int op,               /* Status verb */\n  int *pCurrent,        /* Write current value here */\n  int *pHighwater,      /* Write high-water mark here */\n  int resetFlag         /* Reset high-water mark if true */\n){\n  int rc = SQLITE_OK;   /* Return code */\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || pCurrent==0|| pHighwater==0 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  switch( op ){\n    case SQLITE_DBSTATUS_LOOKASIDE_USED: {\n      *pCurrent = db->lookaside.nOut;\n      *pHighwater = db->lookaside.mxOut;\n      if( resetFlag ){\n        db->lookaside.mxOut = db->lookaside.nOut;\n      }\n      break;\n    }\n\n    case SQLITE_DBSTATUS_LOOKASIDE_HIT:\n    case SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE:\n    case SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: {\n      testcase( op==SQLITE_DBSTATUS_LOOKASIDE_HIT );\n      testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE );\n      testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL );\n      assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)>=0 );\n      assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)<3 );\n      *pCurrent = 0;\n      *pHighwater = db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT];\n      if( resetFlag ){\n        db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0;\n      }\n      break;\n    }\n\n    /* \n    ** Return an approximation for the amount of memory currently used\n    ** by all pagers associated with the given database connection.  The\n    ** highwater mark is meaningless and is returned as zero.\n    */\n    case SQLITE_DBSTATUS_CACHE_USED_SHARED:\n    case SQLITE_DBSTATUS_CACHE_USED: {\n      int totalUsed = 0;\n      int i;\n      sqlite3BtreeEnterAll(db);\n      for(i=0; i<db->nDb; i++){\n        Btree *pBt = db->aDb[i].pBt;\n        if( pBt ){\n          Pager *pPager = sqlite3BtreePager(pBt);\n          int nByte = sqlite3PagerMemUsed(pPager);\n          if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){\n            nByte = nByte / sqlite3BtreeConnectionCount(pBt);\n          }\n          totalUsed += nByte;\n        }\n      }\n      sqlite3BtreeLeaveAll(db);\n      *pCurrent = totalUsed;\n      *pHighwater = 0;\n      break;\n    }\n\n    /*\n    ** *pCurrent gets an accurate estimate of the amount of memory used\n    ** to store the schema for all databases (main, temp, and any ATTACHed\n    ** databases.  *pHighwater is set to zero.\n    */\n    case SQLITE_DBSTATUS_SCHEMA_USED: {\n      int i;                      /* Used to iterate through schemas */\n      int nByte = 0;              /* Used to accumulate return value */\n\n      sqlite3BtreeEnterAll(db);\n      db->pnBytesFreed = &nByte;\n      for(i=0; i<db->nDb; i++){\n        Schema *pSchema = db->aDb[i].pSchema;\n        if( ALWAYS(pSchema!=0) ){\n          HashElem *p;\n\n          nByte += sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * (\n              pSchema->tblHash.count \n            + pSchema->trigHash.count\n            + pSchema->idxHash.count\n            + pSchema->fkeyHash.count\n          );\n          nByte += sqlite3_msize(pSchema->tblHash.ht);\n          nByte += sqlite3_msize(pSchema->trigHash.ht);\n          nByte += sqlite3_msize(pSchema->idxHash.ht);\n          nByte += sqlite3_msize(pSchema->fkeyHash.ht);\n\n          for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){\n            sqlite3DeleteTrigger(db, (Trigger*)sqliteHashData(p));\n          }\n          for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){\n            sqlite3DeleteTable(db, (Table *)sqliteHashData(p));\n          }\n        }\n      }\n      db->pnBytesFreed = 0;\n      sqlite3BtreeLeaveAll(db);\n\n      *pHighwater = 0;\n      *pCurrent = nByte;\n      break;\n    }\n\n    /*\n    ** *pCurrent gets an accurate estimate of the amount of memory used\n    ** to store all prepared statements.\n    ** *pHighwater is set to zero.\n    */\n    case SQLITE_DBSTATUS_STMT_USED: {\n      struct Vdbe *pVdbe;         /* Used to iterate through VMs */\n      int nByte = 0;              /* Used to accumulate return value */\n\n      db->pnBytesFreed = &nByte;\n      for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){\n        sqlite3VdbeClearObject(db, pVdbe);\n        sqlite3DbFree(db, pVdbe);\n      }\n      db->pnBytesFreed = 0;\n\n      *pHighwater = 0;  /* IMP: R-64479-57858 */\n      *pCurrent = nByte;\n\n      break;\n    }\n\n    /*\n    ** Set *pCurrent to the total cache hits or misses encountered by all\n    ** pagers the database handle is connected to. *pHighwater is always set \n    ** to zero.\n    */\n    case SQLITE_DBSTATUS_CACHE_HIT:\n    case SQLITE_DBSTATUS_CACHE_MISS:\n    case SQLITE_DBSTATUS_CACHE_WRITE:{\n      int i;\n      int nRet = 0;\n      assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 );\n      assert( SQLITE_DBSTATUS_CACHE_WRITE==SQLITE_DBSTATUS_CACHE_HIT+2 );\n\n      for(i=0; i<db->nDb; i++){\n        if( db->aDb[i].pBt ){\n          Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt);\n          sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet);\n        }\n      }\n      *pHighwater = 0; /* IMP: R-42420-56072 */\n                       /* IMP: R-54100-20147 */\n                       /* IMP: R-29431-39229 */\n      *pCurrent = nRet;\n      break;\n    }\n\n    /* Set *pCurrent to non-zero if there are unresolved deferred foreign\n    ** key constraints.  Set *pCurrent to zero if all foreign key constraints\n    ** have been satisfied.  The *pHighwater is always set to zero.\n    */\n    case SQLITE_DBSTATUS_DEFERRED_FKS: {\n      *pHighwater = 0;  /* IMP: R-11967-56545 */\n      *pCurrent = db->nDeferredImmCons>0 || db->nDeferredCons>0;\n      break;\n    }\n\n    default: {\n      rc = SQLITE_ERROR;\n    }\n  }\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/table.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the sqlite3_get_table() and sqlite3_free_table()\n** interface routines.  These are just wrappers around the main\n** interface routine of sqlite3_exec().\n**\n** These routines are in a separate files so that they will not be linked\n** if they are not used.\n*/\n#include \"sqliteInt.h\"\n#include <stdlib.h>\n#include <string.h>\n\n#ifndef SQLITE_OMIT_GET_TABLE\n\n/*\n** This structure is used to pass data from sqlite3_get_table() through\n** to the callback function is uses to build the result.\n*/\ntypedef struct TabResult {\n  char **azResult;   /* Accumulated output */\n  char *zErrMsg;     /* Error message text, if an error occurs */\n  u32 nAlloc;        /* Slots allocated for azResult[] */\n  u32 nRow;          /* Number of rows in the result */\n  u32 nColumn;       /* Number of columns in the result */\n  u32 nData;         /* Slots used in azResult[].  (nRow+1)*nColumn */\n  int rc;            /* Return code from sqlite3_exec() */\n} TabResult;\n\n/*\n** This routine is called once for each row in the result table.  Its job\n** is to fill in the TabResult structure appropriately, allocating new\n** memory as necessary.\n*/\nstatic int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){\n  TabResult *p = (TabResult*)pArg;  /* Result accumulator */\n  int need;                         /* Slots needed in p->azResult[] */\n  int i;                            /* Loop counter */\n  char *z;                          /* A single column of result */\n\n  /* Make sure there is enough space in p->azResult to hold everything\n  ** we need to remember from this invocation of the callback.\n  */\n  if( p->nRow==0 && argv!=0 ){\n    need = nCol*2;\n  }else{\n    need = nCol;\n  }\n  if( p->nData + need > p->nAlloc ){\n    char **azNew;\n    p->nAlloc = p->nAlloc*2 + need;\n    azNew = sqlite3_realloc64( p->azResult, sizeof(char*)*p->nAlloc );\n    if( azNew==0 ) goto malloc_failed;\n    p->azResult = azNew;\n  }\n\n  /* If this is the first row, then generate an extra row containing\n  ** the names of all columns.\n  */\n  if( p->nRow==0 ){\n    p->nColumn = nCol;\n    for(i=0; i<nCol; i++){\n      z = sqlite3_mprintf(\"%s\", colv[i]);\n      if( z==0 ) goto malloc_failed;\n      p->azResult[p->nData++] = z;\n    }\n  }else if( (int)p->nColumn!=nCol ){\n    sqlite3_free(p->zErrMsg);\n    p->zErrMsg = sqlite3_mprintf(\n       \"sqlite3_get_table() called with two or more incompatible queries\"\n    );\n    p->rc = SQLITE_ERROR;\n    return 1;\n  }\n\n  /* Copy over the row data\n  */\n  if( argv!=0 ){\n    for(i=0; i<nCol; i++){\n      if( argv[i]==0 ){\n        z = 0;\n      }else{\n        int n = sqlite3Strlen30(argv[i])+1;\n        z = sqlite3_malloc64( n );\n        if( z==0 ) goto malloc_failed;\n        memcpy(z, argv[i], n);\n      }\n      p->azResult[p->nData++] = z;\n    }\n    p->nRow++;\n  }\n  return 0;\n\nmalloc_failed:\n  p->rc = SQLITE_NOMEM_BKPT;\n  return 1;\n}\n\n/*\n** Query the database.  But instead of invoking a callback for each row,\n** malloc() for space to hold the result and return the entire results\n** at the conclusion of the call.\n**\n** The result that is written to ***pazResult is held in memory obtained\n** from malloc().  But the caller cannot free this memory directly.  \n** Instead, the entire table should be passed to sqlite3_free_table() when\n** the calling procedure is finished using it.\n*/\nint sqlite3_get_table(\n  sqlite3 *db,                /* The database on which the SQL executes */\n  const char *zSql,           /* The SQL to be executed */\n  char ***pazResult,          /* Write the result table here */\n  int *pnRow,                 /* Write the number of rows in the result here */\n  int *pnColumn,              /* Write the number of columns of result here */\n  char **pzErrMsg             /* Write error messages here */\n){\n  int rc;\n  TabResult res;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || pazResult==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  *pazResult = 0;\n  if( pnColumn ) *pnColumn = 0;\n  if( pnRow ) *pnRow = 0;\n  if( pzErrMsg ) *pzErrMsg = 0;\n  res.zErrMsg = 0;\n  res.nRow = 0;\n  res.nColumn = 0;\n  res.nData = 1;\n  res.nAlloc = 20;\n  res.rc = SQLITE_OK;\n  res.azResult = sqlite3_malloc64(sizeof(char*)*res.nAlloc );\n  if( res.azResult==0 ){\n     db->errCode = SQLITE_NOMEM;\n     return SQLITE_NOMEM_BKPT;\n  }\n  res.azResult[0] = 0;\n  rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);\n  assert( sizeof(res.azResult[0])>= sizeof(res.nData) );\n  res.azResult[0] = SQLITE_INT_TO_PTR(res.nData);\n  if( (rc&0xff)==SQLITE_ABORT ){\n    sqlite3_free_table(&res.azResult[1]);\n    if( res.zErrMsg ){\n      if( pzErrMsg ){\n        sqlite3_free(*pzErrMsg);\n        *pzErrMsg = sqlite3_mprintf(\"%s\",res.zErrMsg);\n      }\n      sqlite3_free(res.zErrMsg);\n    }\n    db->errCode = res.rc;  /* Assume 32-bit assignment is atomic */\n    return res.rc;\n  }\n  sqlite3_free(res.zErrMsg);\n  if( rc!=SQLITE_OK ){\n    sqlite3_free_table(&res.azResult[1]);\n    return rc;\n  }\n  if( res.nAlloc>res.nData ){\n    char **azNew;\n    azNew = sqlite3_realloc64( res.azResult, sizeof(char*)*res.nData );\n    if( azNew==0 ){\n      sqlite3_free_table(&res.azResult[1]);\n      db->errCode = SQLITE_NOMEM;\n      return SQLITE_NOMEM_BKPT;\n    }\n    res.azResult = azNew;\n  }\n  *pazResult = &res.azResult[1];\n  if( pnColumn ) *pnColumn = res.nColumn;\n  if( pnRow ) *pnRow = res.nRow;\n  return rc;\n}\n\n/*\n** This routine frees the space the sqlite3_get_table() malloced.\n*/\nvoid sqlite3_free_table(\n  char **azResult            /* Result returned from sqlite3_get_table() */\n){\n  if( azResult ){\n    int i, n;\n    azResult--;\n    assert( azResult!=0 );\n    n = SQLITE_PTR_TO_INT(azResult[0]);\n    for(i=1; i<n; i++){ if( azResult[i] ) sqlite3_free(azResult[i]); }\n    sqlite3_free(azResult);\n  }\n}\n\n#endif /* SQLITE_OMIT_GET_TABLE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/threads.c",
    "content": "/*\n** 2012 July 21\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file presents a simple cross-platform threading interface for\n** use internally by SQLite.\n**\n** A \"thread\" can be created using sqlite3ThreadCreate().  This thread\n** runs independently of its creator until it is joined using\n** sqlite3ThreadJoin(), at which point it terminates.\n**\n** Threads do not have to be real.  It could be that the work of the\n** \"thread\" is done by the main thread at either the sqlite3ThreadCreate()\n** or sqlite3ThreadJoin() call.  This is, in fact, what happens in\n** single threaded systems.  Nothing in SQLite requires multiple threads.\n** This interface exists so that applications that want to take advantage\n** of multiple cores can do so, while also allowing applications to stay\n** single-threaded if desired.\n*/\n#include \"sqliteInt.h\"\n#if SQLITE_OS_WIN\n#  include \"os_win.h\"\n#endif\n\n#if SQLITE_MAX_WORKER_THREADS>0\n\n/********************************* Unix Pthreads ****************************/\n#if SQLITE_OS_UNIX && defined(SQLITE_MUTEX_PTHREADS) && SQLITE_THREADSAFE>0\n\n#define SQLITE_THREADS_IMPLEMENTED 1  /* Prevent the single-thread code below */\n#include <pthread.h>\n\n/* A running thread */\nstruct SQLiteThread {\n  pthread_t tid;                 /* Thread ID */\n  int done;                      /* Set to true when thread finishes */\n  void *pOut;                    /* Result returned by the thread */\n  void *(*xTask)(void*);         /* The thread routine */\n  void *pIn;                     /* Argument to the thread */\n};\n\n/* Create a new thread */\nint sqlite3ThreadCreate(\n  SQLiteThread **ppThread,  /* OUT: Write the thread object here */\n  void *(*xTask)(void*),    /* Routine to run in a separate thread */\n  void *pIn                 /* Argument passed into xTask() */\n){\n  SQLiteThread *p;\n  int rc;\n\n  assert( ppThread!=0 );\n  assert( xTask!=0 );\n  /* This routine is never used in single-threaded mode */\n  assert( sqlite3GlobalConfig.bCoreMutex!=0 );\n\n  *ppThread = 0;\n  p = sqlite3Malloc(sizeof(*p));\n  if( p==0 ) return SQLITE_NOMEM_BKPT;\n  memset(p, 0, sizeof(*p));\n  p->xTask = xTask;\n  p->pIn = pIn;\n  /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a \n  ** function that returns SQLITE_ERROR when passed the argument 200, that\n  ** forces worker threads to run sequentially and deterministically \n  ** for testing purposes. */\n  if( sqlite3FaultSim(200) ){\n    rc = 1;\n  }else{    \n    rc = pthread_create(&p->tid, 0, xTask, pIn);\n  }\n  if( rc ){\n    p->done = 1;\n    p->pOut = xTask(pIn);\n  }\n  *ppThread = p;\n  return SQLITE_OK;\n}\n\n/* Get the results of the thread */\nint sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){\n  int rc;\n\n  assert( ppOut!=0 );\n  if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;\n  if( p->done ){\n    *ppOut = p->pOut;\n    rc = SQLITE_OK;\n  }else{\n    rc = pthread_join(p->tid, ppOut) ? SQLITE_ERROR : SQLITE_OK;\n  }\n  sqlite3_free(p);\n  return rc;\n}\n\n#endif /* SQLITE_OS_UNIX && defined(SQLITE_MUTEX_PTHREADS) */\n/******************************** End Unix Pthreads *************************/\n\n\n/********************************* Win32 Threads ****************************/\n#if SQLITE_OS_WIN_THREADS\n\n#define SQLITE_THREADS_IMPLEMENTED 1  /* Prevent the single-thread code below */\n#include <process.h>\n\n/* A running thread */\nstruct SQLiteThread {\n  void *tid;               /* The thread handle */\n  unsigned id;             /* The thread identifier */\n  void *(*xTask)(void*);   /* The routine to run as a thread */\n  void *pIn;               /* Argument to xTask */\n  void *pResult;           /* Result of xTask */\n};\n\n/* Thread procedure Win32 compatibility shim */\nstatic unsigned __stdcall sqlite3ThreadProc(\n  void *pArg  /* IN: Pointer to the SQLiteThread structure */\n){\n  SQLiteThread *p = (SQLiteThread *)pArg;\n\n  assert( p!=0 );\n#if 0\n  /*\n  ** This assert appears to trigger spuriously on certain\n  ** versions of Windows, possibly due to _beginthreadex()\n  ** and/or CreateThread() not fully setting their thread\n  ** ID parameter before starting the thread.\n  */\n  assert( p->id==GetCurrentThreadId() );\n#endif\n  assert( p->xTask!=0 );\n  p->pResult = p->xTask(p->pIn);\n\n  _endthreadex(0);\n  return 0; /* NOT REACHED */\n}\n\n/* Create a new thread */\nint sqlite3ThreadCreate(\n  SQLiteThread **ppThread,  /* OUT: Write the thread object here */\n  void *(*xTask)(void*),    /* Routine to run in a separate thread */\n  void *pIn                 /* Argument passed into xTask() */\n){\n  SQLiteThread *p;\n\n  assert( ppThread!=0 );\n  assert( xTask!=0 );\n  *ppThread = 0;\n  p = sqlite3Malloc(sizeof(*p));\n  if( p==0 ) return SQLITE_NOMEM_BKPT;\n  /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a \n  ** function that returns SQLITE_ERROR when passed the argument 200, that\n  ** forces worker threads to run sequentially and deterministically \n  ** (via the sqlite3FaultSim() term of the conditional) for testing\n  ** purposes. */\n  if( sqlite3GlobalConfig.bCoreMutex==0 || sqlite3FaultSim(200) ){\n    memset(p, 0, sizeof(*p));\n  }else{\n    p->xTask = xTask;\n    p->pIn = pIn;\n    p->tid = (void*)_beginthreadex(0, 0, sqlite3ThreadProc, p, 0, &p->id);\n    if( p->tid==0 ){\n      memset(p, 0, sizeof(*p));\n    }\n  }\n  if( p->xTask==0 ){\n    p->id = GetCurrentThreadId();\n    p->pResult = xTask(pIn);\n  }\n  *ppThread = p;\n  return SQLITE_OK;\n}\n\nDWORD sqlite3Win32Wait(HANDLE hObject); /* os_win.c */\n\n/* Get the results of the thread */\nint sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){\n  DWORD rc;\n  BOOL bRc;\n\n  assert( ppOut!=0 );\n  if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;\n  if( p->xTask==0 ){\n    /* assert( p->id==GetCurrentThreadId() ); */\n    rc = WAIT_OBJECT_0;\n    assert( p->tid==0 );\n  }else{\n    assert( p->id!=0 && p->id!=GetCurrentThreadId() );\n    rc = sqlite3Win32Wait((HANDLE)p->tid);\n    assert( rc!=WAIT_IO_COMPLETION );\n    bRc = CloseHandle((HANDLE)p->tid);\n    assert( bRc );\n  }\n  if( rc==WAIT_OBJECT_0 ) *ppOut = p->pResult;\n  sqlite3_free(p);\n  return (rc==WAIT_OBJECT_0) ? SQLITE_OK : SQLITE_ERROR;\n}\n\n#endif /* SQLITE_OS_WIN_THREADS */\n/******************************** End Win32 Threads *************************/\n\n\n/********************************* Single-Threaded **************************/\n#ifndef SQLITE_THREADS_IMPLEMENTED\n/*\n** This implementation does not actually create a new thread.  It does the\n** work of the thread in the main thread, when either the thread is created\n** or when it is joined\n*/\n\n/* A running thread */\nstruct SQLiteThread {\n  void *(*xTask)(void*);   /* The routine to run as a thread */\n  void *pIn;               /* Argument to xTask */\n  void *pResult;           /* Result of xTask */\n};\n\n/* Create a new thread */\nint sqlite3ThreadCreate(\n  SQLiteThread **ppThread,  /* OUT: Write the thread object here */\n  void *(*xTask)(void*),    /* Routine to run in a separate thread */\n  void *pIn                 /* Argument passed into xTask() */\n){\n  SQLiteThread *p;\n\n  assert( ppThread!=0 );\n  assert( xTask!=0 );\n  *ppThread = 0;\n  p = sqlite3Malloc(sizeof(*p));\n  if( p==0 ) return SQLITE_NOMEM_BKPT;\n  if( (SQLITE_PTR_TO_INT(p)/17)&1 ){\n    p->xTask = xTask;\n    p->pIn = pIn;\n  }else{\n    p->xTask = 0;\n    p->pResult = xTask(pIn);\n  }\n  *ppThread = p;\n  return SQLITE_OK;\n}\n\n/* Get the results of the thread */\nint sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){\n\n  assert( ppOut!=0 );\n  if( NEVER(p==0) ) return SQLITE_NOMEM_BKPT;\n  if( p->xTask ){\n    *ppOut = p->xTask(p->pIn);\n  }else{\n    *ppOut = p->pResult;\n  }\n  sqlite3_free(p);\n\n#if defined(SQLITE_TEST)\n  {\n    void *pTstAlloc = sqlite3Malloc(10);\n    if (!pTstAlloc) return SQLITE_NOMEM_BKPT;\n    sqlite3_free(pTstAlloc);\n  }\n#endif\n\n  return SQLITE_OK;\n}\n\n#endif /* !defined(SQLITE_THREADS_IMPLEMENTED) */\n/****************************** End Single-Threaded *************************/\n#endif /* SQLITE_MAX_WORKER_THREADS>0 */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/tokenize.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** An tokenizer for SQL\n**\n** This file contains C code that splits an SQL input string up into\n** individual tokens and sends those tokens one-by-one over to the\n** parser for analysis.\n*/\n#include \"sqliteInt.h\"\n#include <stdlib.h>\n\n/* Character classes for tokenizing\n**\n** In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented\n** using a lookup table, whereas a switch() directly on c uses a binary search.\n** The lookup table is much faster.  To maximize speed, and to ensure that\n** a lookup table is used, all of the classes need to be small integers and\n** all of them need to be used within the switch.\n*/\n#define CC_X          0    /* The letter 'x', or start of BLOB literal */\n#define CC_KYWD       1    /* Alphabetics or '_'.  Usable in a keyword */\n#define CC_ID         2    /* unicode characters usable in IDs */\n#define CC_DIGIT      3    /* Digits */\n#define CC_DOLLAR     4    /* '$' */\n#define CC_VARALPHA   5    /* '@', '#', ':'.  Alphabetic SQL variables */\n#define CC_VARNUM     6    /* '?'.  Numeric SQL variables */\n#define CC_SPACE      7    /* Space characters */\n#define CC_QUOTE      8    /* '\"', '\\'', or '`'.  String literals, quoted ids */\n#define CC_QUOTE2     9    /* '['.   [...] style quoted ids */\n#define CC_PIPE      10    /* '|'.   Bitwise OR or concatenate */\n#define CC_MINUS     11    /* '-'.  Minus or SQL-style comment */\n#define CC_LT        12    /* '<'.  Part of < or <= or <> */\n#define CC_GT        13    /* '>'.  Part of > or >= */\n#define CC_EQ        14    /* '='.  Part of = or == */\n#define CC_BANG      15    /* '!'.  Part of != */\n#define CC_SLASH     16    /* '/'.  / or c-style comment */\n#define CC_LP        17    /* '(' */\n#define CC_RP        18    /* ')' */\n#define CC_SEMI      19    /* ';' */\n#define CC_PLUS      20    /* '+' */\n#define CC_STAR      21    /* '*' */\n#define CC_PERCENT   22    /* '%' */\n#define CC_COMMA     23    /* ',' */\n#define CC_AND       24    /* '&' */\n#define CC_TILDA     25    /* '~' */\n#define CC_DOT       26    /* '.' */\n#define CC_ILLEGAL   27    /* Illegal character */\n\nstatic const unsigned char aiClass[] = {\n#ifdef SQLITE_ASCII\n/*         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf */\n/* 0x */   27, 27, 27, 27, 27, 27, 27, 27, 27,  7,  7, 27,  7,  7, 27, 27,\n/* 1x */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,\n/* 2x */    7, 15,  8,  5,  4, 22, 24,  8, 17, 18, 21, 20, 23, 11, 26, 16,\n/* 3x */    3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  5, 19, 12, 14, 13,  6,\n/* 4x */    5,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,\n/* 5x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1,  9, 27, 27, 27,  1,\n/* 6x */    8,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,\n/* 7x */    1,  1,  1,  1,  1,  1,  1,  1,  0,  1,  1, 27, 10, 27, 25, 27,\n/* 8x */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,\n/* 9x */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,\n/* Ax */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,\n/* Bx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,\n/* Cx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,\n/* Dx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,\n/* Ex */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,\n/* Fx */    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2\n#endif\n#ifdef SQLITE_EBCDIC\n/*         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf */\n/* 0x */   27, 27, 27, 27, 27,  7, 27, 27, 27, 27, 27, 27,  7,  7, 27, 27,\n/* 1x */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,\n/* 2x */   27, 27, 27, 27, 27,  7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,\n/* 3x */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,\n/* 4x */    7, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 12, 17, 20, 10,\n/* 5x */   24, 27, 27, 27, 27, 27, 27, 27, 27, 27, 15,  4, 21, 18, 19, 27,\n/* 6x */   11, 16, 27, 27, 27, 27, 27, 27, 27, 27, 27, 23, 22,  1, 13,  7,\n/* 7x */   27, 27, 27, 27, 27, 27, 27, 27, 27,  8,  5,  5,  5,  8, 14,  8,\n/* 8x */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,\n/* 9x */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,\n/* 9x */   25,  1,  1,  1,  1,  1,  1,  0,  1,  1, 27, 27, 27, 27, 27, 27,\n/* Bx */   27, 27, 27, 27, 27, 27, 27, 27, 27, 27,  9, 27, 27, 27, 27, 27,\n/* Cx */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,\n/* Dx */   27,  1,  1,  1,  1,  1,  1,  1,  1,  1, 27, 27, 27, 27, 27, 27,\n/* Ex */   27, 27,  1,  1,  1,  1,  1,  0,  1,  1, 27, 27, 27, 27, 27, 27,\n/* Fx */    3,  3,  3,  3,  3,  3,  3,  3,  3,  3, 27, 27, 27, 27, 27, 27,\n#endif\n};\n\n/*\n** The charMap() macro maps alphabetic characters (only) into their\n** lower-case ASCII equivalent.  On ASCII machines, this is just\n** an upper-to-lower case map.  On EBCDIC machines we also need\n** to adjust the encoding.  The mapping is only valid for alphabetics\n** which are the only characters for which this feature is used. \n**\n** Used by keywordhash.h\n*/\n#ifdef SQLITE_ASCII\n# define charMap(X) sqlite3UpperToLower[(unsigned char)X]\n#endif\n#ifdef SQLITE_EBCDIC\n# define charMap(X) ebcdicToAscii[(unsigned char)X]\nconst unsigned char ebcdicToAscii[] = {\n/* 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 0x */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 1x */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 2x */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 3x */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 4x */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 5x */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 95,  0,  0,  /* 6x */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 7x */\n   0, 97, 98, 99,100,101,102,103,104,105,  0,  0,  0,  0,  0,  0,  /* 8x */\n   0,106,107,108,109,110,111,112,113,114,  0,  0,  0,  0,  0,  0,  /* 9x */\n   0,  0,115,116,117,118,119,120,121,122,  0,  0,  0,  0,  0,  0,  /* Ax */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* Bx */\n   0, 97, 98, 99,100,101,102,103,104,105,  0,  0,  0,  0,  0,  0,  /* Cx */\n   0,106,107,108,109,110,111,112,113,114,  0,  0,  0,  0,  0,  0,  /* Dx */\n   0,  0,115,116,117,118,119,120,121,122,  0,  0,  0,  0,  0,  0,  /* Ex */\n   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* Fx */\n};\n#endif\n\n/*\n** The sqlite3KeywordCode function looks up an identifier to determine if\n** it is a keyword.  If it is a keyword, the token code of that keyword is \n** returned.  If the input is not a keyword, TK_ID is returned.\n**\n** The implementation of this routine was generated by a program,\n** mkkeywordhash.c, located in the tool subdirectory of the distribution.\n** The output of the mkkeywordhash.c program is written into a file\n** named keywordhash.h and then included into this source file by\n** the #include below.\n*/\n#include \"keywordhash.h\"\n\n\n/*\n** If X is a character that can be used in an identifier then\n** IdChar(X) will be true.  Otherwise it is false.\n**\n** For ASCII, any character with the high-order bit set is\n** allowed in an identifier.  For 7-bit characters, \n** sqlite3IsIdChar[X] must be 1.\n**\n** For EBCDIC, the rules are more complex but have the same\n** end result.\n**\n** Ticket #1066.  the SQL standard does not allow '$' in the\n** middle of identifiers.  But many SQL implementations do. \n** SQLite will allow '$' in identifiers for compatibility.\n** But the feature is undocumented.\n*/\n#ifdef SQLITE_ASCII\n#define IdChar(C)  ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0)\n#endif\n#ifdef SQLITE_EBCDIC\nconst char sqlite3IsEbcdicIdChar[] = {\n/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */\n    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 4x */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,  /* 5x */\n    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0,  /* 6x */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,  /* 7x */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0,  /* 8x */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0,  /* 9x */\n    1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,  /* Ax */\n    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* Bx */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Cx */\n    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Dx */\n    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Ex */\n    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0,  /* Fx */\n};\n#define IdChar(C)  (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))\n#endif\n\n/* Make the IdChar function accessible from ctime.c */\n#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS\nint sqlite3IsIdChar(u8 c){ return IdChar(c); }\n#endif\n\n\n/*\n** Return the length (in bytes) of the token that begins at z[0]. \n** Store the token type in *tokenType before returning.\n*/\nint sqlite3GetToken(const unsigned char *z, int *tokenType){\n  int i, c;\n  switch( aiClass[*z] ){  /* Switch on the character-class of the first byte\n                          ** of the token. See the comment on the CC_ defines\n                          ** above. */\n    case CC_SPACE: {\n      testcase( z[0]==' ' );\n      testcase( z[0]=='\\t' );\n      testcase( z[0]=='\\n' );\n      testcase( z[0]=='\\f' );\n      testcase( z[0]=='\\r' );\n      for(i=1; sqlite3Isspace(z[i]); i++){}\n      *tokenType = TK_SPACE;\n      return i;\n    }\n    case CC_MINUS: {\n      if( z[1]=='-' ){\n        for(i=2; (c=z[i])!=0 && c!='\\n'; i++){}\n        *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */\n        return i;\n      }\n      *tokenType = TK_MINUS;\n      return 1;\n    }\n    case CC_LP: {\n      *tokenType = TK_LP;\n      return 1;\n    }\n    case CC_RP: {\n      *tokenType = TK_RP;\n      return 1;\n    }\n    case CC_SEMI: {\n      *tokenType = TK_SEMI;\n      return 1;\n    }\n    case CC_PLUS: {\n      *tokenType = TK_PLUS;\n      return 1;\n    }\n    case CC_STAR: {\n      *tokenType = TK_STAR;\n      return 1;\n    }\n    case CC_SLASH: {\n      if( z[1]!='*' || z[2]==0 ){\n        *tokenType = TK_SLASH;\n        return 1;\n      }\n      for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}\n      if( c ) i++;\n      *tokenType = TK_SPACE;   /* IMP: R-22934-25134 */\n      return i;\n    }\n    case CC_PERCENT: {\n      *tokenType = TK_REM;\n      return 1;\n    }\n    case CC_EQ: {\n      *tokenType = TK_EQ;\n      return 1 + (z[1]=='=');\n    }\n    case CC_LT: {\n      if( (c=z[1])=='=' ){\n        *tokenType = TK_LE;\n        return 2;\n      }else if( c=='>' ){\n        *tokenType = TK_NE;\n        return 2;\n      }else if( c=='<' ){\n        *tokenType = TK_LSHIFT;\n        return 2;\n      }else{\n        *tokenType = TK_LT;\n        return 1;\n      }\n    }\n    case CC_GT: {\n      if( (c=z[1])=='=' ){\n        *tokenType = TK_GE;\n        return 2;\n      }else if( c=='>' ){\n        *tokenType = TK_RSHIFT;\n        return 2;\n      }else{\n        *tokenType = TK_GT;\n        return 1;\n      }\n    }\n    case CC_BANG: {\n      if( z[1]!='=' ){\n        *tokenType = TK_ILLEGAL;\n        return 1;\n      }else{\n        *tokenType = TK_NE;\n        return 2;\n      }\n    }\n    case CC_PIPE: {\n      if( z[1]!='|' ){\n        *tokenType = TK_BITOR;\n        return 1;\n      }else{\n        *tokenType = TK_CONCAT;\n        return 2;\n      }\n    }\n    case CC_COMMA: {\n      *tokenType = TK_COMMA;\n      return 1;\n    }\n    case CC_AND: {\n      *tokenType = TK_BITAND;\n      return 1;\n    }\n    case CC_TILDA: {\n      *tokenType = TK_BITNOT;\n      return 1;\n    }\n    case CC_QUOTE: {\n      int delim = z[0];\n      testcase( delim=='`' );\n      testcase( delim=='\\'' );\n      testcase( delim=='\"' );\n      for(i=1; (c=z[i])!=0; i++){\n        if( c==delim ){\n          if( z[i+1]==delim ){\n            i++;\n          }else{\n            break;\n          }\n        }\n      }\n      if( c=='\\'' ){\n        *tokenType = TK_STRING;\n        return i+1;\n      }else if( c!=0 ){\n        *tokenType = TK_ID;\n        return i+1;\n      }else{\n        *tokenType = TK_ILLEGAL;\n        return i;\n      }\n    }\n    case CC_DOT: {\n#ifndef SQLITE_OMIT_FLOATING_POINT\n      if( !sqlite3Isdigit(z[1]) )\n#endif\n      {\n        *tokenType = TK_DOT;\n        return 1;\n      }\n      /* If the next character is a digit, this is a floating point\n      ** number that begins with \".\".  Fall thru into the next case */\n    }\n    case CC_DIGIT: {\n      testcase( z[0]=='0' );  testcase( z[0]=='1' );  testcase( z[0]=='2' );\n      testcase( z[0]=='3' );  testcase( z[0]=='4' );  testcase( z[0]=='5' );\n      testcase( z[0]=='6' );  testcase( z[0]=='7' );  testcase( z[0]=='8' );\n      testcase( z[0]=='9' );\n      *tokenType = TK_INTEGER;\n#ifndef SQLITE_OMIT_HEX_INTEGER\n      if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){\n        for(i=3; sqlite3Isxdigit(z[i]); i++){}\n        return i;\n      }\n#endif\n      for(i=0; sqlite3Isdigit(z[i]); i++){}\n#ifndef SQLITE_OMIT_FLOATING_POINT\n      if( z[i]=='.' ){\n        i++;\n        while( sqlite3Isdigit(z[i]) ){ i++; }\n        *tokenType = TK_FLOAT;\n      }\n      if( (z[i]=='e' || z[i]=='E') &&\n           ( sqlite3Isdigit(z[i+1]) \n            || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))\n           )\n      ){\n        i += 2;\n        while( sqlite3Isdigit(z[i]) ){ i++; }\n        *tokenType = TK_FLOAT;\n      }\n#endif\n      while( IdChar(z[i]) ){\n        *tokenType = TK_ILLEGAL;\n        i++;\n      }\n      return i;\n    }\n    case CC_QUOTE2: {\n      for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}\n      *tokenType = c==']' ? TK_ID : TK_ILLEGAL;\n      return i;\n    }\n    case CC_VARNUM: {\n      *tokenType = TK_VARIABLE;\n      for(i=1; sqlite3Isdigit(z[i]); i++){}\n      return i;\n    }\n    case CC_DOLLAR:\n    case CC_VARALPHA: {\n      int n = 0;\n      testcase( z[0]=='$' );  testcase( z[0]=='@' );\n      testcase( z[0]==':' );  testcase( z[0]=='#' );\n      *tokenType = TK_VARIABLE;\n      for(i=1; (c=z[i])!=0; i++){\n        if( IdChar(c) ){\n          n++;\n#ifndef SQLITE_OMIT_TCL_VARIABLE\n        }else if( c=='(' && n>0 ){\n          do{\n            i++;\n          }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' );\n          if( c==')' ){\n            i++;\n          }else{\n            *tokenType = TK_ILLEGAL;\n          }\n          break;\n        }else if( c==':' && z[i+1]==':' ){\n          i++;\n#endif\n        }else{\n          break;\n        }\n      }\n      if( n==0 ) *tokenType = TK_ILLEGAL;\n      return i;\n    }\n    case CC_KYWD: {\n      for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}\n      if( IdChar(z[i]) ){\n        /* This token started out using characters that can appear in keywords,\n        ** but z[i] is a character not allowed within keywords, so this must\n        ** be an identifier instead */\n        i++;\n        break;\n      }\n      *tokenType = TK_ID;\n      return keywordCode((char*)z, i, tokenType);\n    }\n    case CC_X: {\n#ifndef SQLITE_OMIT_BLOB_LITERAL\n      testcase( z[0]=='x' ); testcase( z[0]=='X' );\n      if( z[1]=='\\'' ){\n        *tokenType = TK_BLOB;\n        for(i=2; sqlite3Isxdigit(z[i]); i++){}\n        if( z[i]!='\\'' || i%2 ){\n          *tokenType = TK_ILLEGAL;\n          while( z[i] && z[i]!='\\'' ){ i++; }\n        }\n        if( z[i] ) i++;\n        return i;\n      }\n#endif\n      /* If it is not a BLOB literal, then it must be an ID, since no\n      ** SQL keywords start with the letter 'x'.  Fall through */\n    }\n    case CC_ID: {\n      i = 1;\n      break;\n    }\n    default: {\n      *tokenType = TK_ILLEGAL;\n      return 1;\n    }\n  }\n  while( IdChar(z[i]) ){ i++; }\n  *tokenType = TK_ID;\n  return i;\n}\n\n/*\n** Run the parser on the given SQL string.  The parser structure is\n** passed in.  An SQLITE_ status code is returned.  If an error occurs\n** then an and attempt is made to write an error message into \n** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that\n** error message.\n*/\nint sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){\n  int nErr = 0;                   /* Number of errors encountered */\n  int i;                          /* Loop counter */\n  void *pEngine;                  /* The LEMON-generated LALR(1) parser */\n  int tokenType;                  /* type of the next token */\n  int lastTokenParsed = -1;       /* type of the previous token */\n  sqlite3 *db = pParse->db;       /* The database connection */\n  int mxSqlLen;                   /* Max length of an SQL string */\n\n  assert( zSql!=0 );\n  mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];\n  if( db->nVdbeActive==0 ){\n    db->u1.isInterrupted = 0;\n  }\n  pParse->rc = SQLITE_OK;\n  pParse->zTail = zSql;\n  i = 0;\n  assert( pzErrMsg!=0 );\n  /* sqlite3ParserTrace(stdout, \"parser: \"); */\n  pEngine = sqlite3ParserAlloc(sqlite3Malloc);\n  if( pEngine==0 ){\n    sqlite3OomFault(db);\n    return SQLITE_NOMEM_BKPT;\n  }\n  assert( pParse->pNewTable==0 );\n  assert( pParse->pNewTrigger==0 );\n  assert( pParse->nVar==0 );\n  assert( pParse->nzVar==0 );\n  assert( pParse->azVar==0 );\n  while( 1 ){\n    assert( i>=0 );\n    if( zSql[i]!=0 ){\n      pParse->sLastToken.z = &zSql[i];\n      pParse->sLastToken.n = sqlite3GetToken((u8*)&zSql[i],&tokenType);\n      i += pParse->sLastToken.n;\n      if( i>mxSqlLen ){\n        pParse->rc = SQLITE_TOOBIG;\n        break;\n      }\n    }else{\n      /* Upon reaching the end of input, call the parser two more times\n      ** with tokens TK_SEMI and 0, in that order. */\n      if( lastTokenParsed==TK_SEMI ){\n        tokenType = 0;\n      }else if( lastTokenParsed==0 ){\n        break;\n      }else{\n        tokenType = TK_SEMI;\n      }\n    }\n    if( tokenType>=TK_SPACE ){\n      assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL );\n      if( db->u1.isInterrupted ){\n        pParse->rc = SQLITE_INTERRUPT;\n        break;\n      }\n      if( tokenType==TK_ILLEGAL ){\n        sqlite3ErrorMsg(pParse, \"unrecognized token: \\\"%T\\\"\",\n                        &pParse->sLastToken);\n        break;\n      }\n    }else{\n      sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse);\n      lastTokenParsed = tokenType;\n      if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;\n    }\n  }\n  assert( nErr==0 );\n  pParse->zTail = &zSql[i];\n#ifdef YYTRACKMAXSTACKDEPTH\n  sqlite3_mutex_enter(sqlite3MallocMutex());\n  sqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK,\n      sqlite3ParserStackPeak(pEngine)\n  );\n  sqlite3_mutex_leave(sqlite3MallocMutex());\n#endif /* YYDEBUG */\n  sqlite3ParserFree(pEngine, sqlite3_free);\n  if( db->mallocFailed ){\n    pParse->rc = SQLITE_NOMEM_BKPT;\n  }\n  if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){\n    pParse->zErrMsg = sqlite3MPrintf(db, \"%s\", sqlite3ErrStr(pParse->rc));\n  }\n  assert( pzErrMsg!=0 );\n  if( pParse->zErrMsg ){\n    *pzErrMsg = pParse->zErrMsg;\n    sqlite3_log(pParse->rc, \"%s\", *pzErrMsg);\n    pParse->zErrMsg = 0;\n    nErr++;\n  }\n  if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){\n    sqlite3VdbeDelete(pParse->pVdbe);\n    pParse->pVdbe = 0;\n  }\n#ifndef SQLITE_OMIT_SHARED_CACHE\n  if( pParse->nested==0 ){\n    sqlite3DbFree(db, pParse->aTableLock);\n    pParse->aTableLock = 0;\n    pParse->nTableLock = 0;\n  }\n#endif\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  sqlite3_free(pParse->apVtabLock);\n#endif\n\n  if( !IN_DECLARE_VTAB ){\n    /* If the pParse->declareVtab flag is set, do not delete any table \n    ** structure built up in pParse->pNewTable. The calling code (see vtab.c)\n    ** will take responsibility for freeing the Table structure.\n    */\n    sqlite3DeleteTable(db, pParse->pNewTable);\n  }\n\n  if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree);\n  sqlite3DeleteTrigger(db, pParse->pNewTrigger);\n  for(i=pParse->nzVar-1; i>=0; i--) sqlite3DbFree(db, pParse->azVar[i]);\n  sqlite3DbFree(db, pParse->azVar);\n  while( pParse->pAinc ){\n    AutoincInfo *p = pParse->pAinc;\n    pParse->pAinc = p->pNext;\n    sqlite3DbFree(db, p);\n  }\n  while( pParse->pZombieTab ){\n    Table *p = pParse->pZombieTab;\n    pParse->pZombieTab = p->pNextZombie;\n    sqlite3DeleteTable(db, p);\n  }\n  assert( nErr==0 || pParse->rc!=SQLITE_OK );\n  return nErr;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/treeview.c",
    "content": "/*\n** 2015-06-08\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains C code to implement the TreeView debugging routines.\n** These routines print a parse tree to standard output for debugging and\n** analysis. \n**\n** The interfaces in this file is only available when compiling\n** with SQLITE_DEBUG.\n*/\n#include \"sqliteInt.h\"\n#ifdef SQLITE_DEBUG\n\n/*\n** Add a new subitem to the tree.  The moreToFollow flag indicates that this\n** is not the last item in the tree.\n*/\nstatic TreeView *sqlite3TreeViewPush(TreeView *p, u8 moreToFollow){\n  if( p==0 ){\n    p = sqlite3_malloc64( sizeof(*p) );\n    if( p==0 ) return 0;\n    memset(p, 0, sizeof(*p));\n  }else{\n    p->iLevel++;\n  }\n  assert( moreToFollow==0 || moreToFollow==1 );\n  if( p->iLevel<sizeof(p->bLine) ) p->bLine[p->iLevel] = moreToFollow;\n  return p;\n}\n\n/*\n** Finished with one layer of the tree\n*/\nstatic void sqlite3TreeViewPop(TreeView *p){\n  if( p==0 ) return;\n  p->iLevel--;\n  if( p->iLevel<0 ) sqlite3_free(p);\n}\n\n/*\n** Generate a single line of output for the tree, with a prefix that contains\n** all the appropriate tree lines\n*/\nstatic void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){\n  va_list ap;\n  int i;\n  StrAccum acc;\n  char zBuf[500];\n  sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);\n  if( p ){\n    for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){\n      sqlite3StrAccumAppend(&acc, p->bLine[i] ? \"|   \" : \"    \", 4);\n    }\n    sqlite3StrAccumAppend(&acc, p->bLine[i] ? \"|-- \" : \"'-- \", 4);\n  }\n  va_start(ap, zFormat);\n  sqlite3VXPrintf(&acc, zFormat, ap);\n  va_end(ap);\n  if( zBuf[acc.nChar-1]!='\\n' ) sqlite3StrAccumAppend(&acc, \"\\n\", 1);\n  sqlite3StrAccumFinish(&acc);\n  fprintf(stdout,\"%s\", zBuf);\n  fflush(stdout);\n}\n\n/*\n** Shorthand for starting a new tree item that consists of a single label\n*/\nstatic void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){\n  p = sqlite3TreeViewPush(p, moreFollows);\n  sqlite3TreeViewLine(p, \"%s\", zLabel);\n}\n\n/*\n** Generate a human-readable description of a WITH clause.\n*/\nvoid sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){\n  int i;\n  if( pWith==0 ) return;\n  if( pWith->nCte==0 ) return;\n  if( pWith->pOuter ){\n    sqlite3TreeViewLine(pView, \"WITH (0x%p, pOuter=0x%p)\",pWith,pWith->pOuter);\n  }else{\n    sqlite3TreeViewLine(pView, \"WITH (0x%p)\", pWith);\n  }\n  if( pWith->nCte>0 ){\n    pView = sqlite3TreeViewPush(pView, 1);\n    for(i=0; i<pWith->nCte; i++){\n      StrAccum x;\n      char zLine[1000];\n      const struct Cte *pCte = &pWith->a[i];\n      sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);\n      sqlite3XPrintf(&x, \"%s\", pCte->zName);\n      if( pCte->pCols && pCte->pCols->nExpr>0 ){\n        char cSep = '(';\n        int j;\n        for(j=0; j<pCte->pCols->nExpr; j++){\n          sqlite3XPrintf(&x, \"%c%s\", cSep, pCte->pCols->a[j].zName);\n          cSep = ',';\n        }\n        sqlite3XPrintf(&x, \")\");\n      }\n      sqlite3XPrintf(&x, \" AS\");\n      sqlite3StrAccumFinish(&x);\n      sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);\n      sqlite3TreeViewSelect(pView, pCte->pSelect, 0);\n      sqlite3TreeViewPop(pView);\n    }\n    sqlite3TreeViewPop(pView);\n  }\n}\n\n\n/*\n** Generate a human-readable description of a Select object.\n*/\nvoid sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){\n  int n = 0;\n  int cnt = 0;\n  pView = sqlite3TreeViewPush(pView, moreToFollow);\n  if( p->pWith ){\n    sqlite3TreeViewWith(pView, p->pWith, 1);\n    cnt = 1;\n    sqlite3TreeViewPush(pView, 1);\n  }\n  do{\n    sqlite3TreeViewLine(pView, \"SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d\",\n      ((p->selFlags & SF_Distinct) ? \" DISTINCT\" : \"\"),\n      ((p->selFlags & SF_Aggregate) ? \" agg_flag\" : \"\"), p, p->selFlags,\n      (int)p->nSelectRow\n    );\n    if( cnt++ ) sqlite3TreeViewPop(pView);\n    if( p->pPrior ){\n      n = 1000;\n    }else{\n      n = 0;\n      if( p->pSrc && p->pSrc->nSrc ) n++;\n      if( p->pWhere ) n++;\n      if( p->pGroupBy ) n++;\n      if( p->pHaving ) n++;\n      if( p->pOrderBy ) n++;\n      if( p->pLimit ) n++;\n      if( p->pOffset ) n++;\n    }\n    sqlite3TreeViewExprList(pView, p->pEList, (n--)>0, \"result-set\");\n    if( p->pSrc && p->pSrc->nSrc ){\n      int i;\n      pView = sqlite3TreeViewPush(pView, (n--)>0);\n      sqlite3TreeViewLine(pView, \"FROM\");\n      for(i=0; i<p->pSrc->nSrc; i++){\n        struct SrcList_item *pItem = &p->pSrc->a[i];\n        StrAccum x;\n        char zLine[100];\n        sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);\n        sqlite3XPrintf(&x, \"{%d,*}\", pItem->iCursor);\n        if( pItem->zDatabase ){\n          sqlite3XPrintf(&x, \" %s.%s\", pItem->zDatabase, pItem->zName);\n        }else if( pItem->zName ){\n          sqlite3XPrintf(&x, \" %s\", pItem->zName);\n        }\n        if( pItem->pTab ){\n          sqlite3XPrintf(&x, \" tabname=%Q\", pItem->pTab->zName);\n        }\n        if( pItem->zAlias ){\n          sqlite3XPrintf(&x, \" (AS %s)\", pItem->zAlias);\n        }\n        if( pItem->fg.jointype & JT_LEFT ){\n          sqlite3XPrintf(&x, \" LEFT-JOIN\");\n        }\n        sqlite3StrAccumFinish(&x);\n        sqlite3TreeViewItem(pView, zLine, i<p->pSrc->nSrc-1); \n        if( pItem->pSelect ){\n          sqlite3TreeViewSelect(pView, pItem->pSelect, 0);\n        }\n        if( pItem->fg.isTabFunc ){\n          sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, \"func-args:\");\n        }\n        sqlite3TreeViewPop(pView);\n      }\n      sqlite3TreeViewPop(pView);\n    }\n    if( p->pWhere ){\n      sqlite3TreeViewItem(pView, \"WHERE\", (n--)>0);\n      sqlite3TreeViewExpr(pView, p->pWhere, 0);\n      sqlite3TreeViewPop(pView);\n    }\n    if( p->pGroupBy ){\n      sqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, \"GROUPBY\");\n    }\n    if( p->pHaving ){\n      sqlite3TreeViewItem(pView, \"HAVING\", (n--)>0);\n      sqlite3TreeViewExpr(pView, p->pHaving, 0);\n      sqlite3TreeViewPop(pView);\n    }\n    if( p->pOrderBy ){\n      sqlite3TreeViewExprList(pView, p->pOrderBy, (n--)>0, \"ORDERBY\");\n    }\n    if( p->pLimit ){\n      sqlite3TreeViewItem(pView, \"LIMIT\", (n--)>0);\n      sqlite3TreeViewExpr(pView, p->pLimit, 0);\n      sqlite3TreeViewPop(pView);\n    }\n    if( p->pOffset ){\n      sqlite3TreeViewItem(pView, \"OFFSET\", (n--)>0);\n      sqlite3TreeViewExpr(pView, p->pOffset, 0);\n      sqlite3TreeViewPop(pView);\n    }\n    if( p->pPrior ){\n      const char *zOp = \"UNION\";\n      switch( p->op ){\n        case TK_ALL:         zOp = \"UNION ALL\";  break;\n        case TK_INTERSECT:   zOp = \"INTERSECT\";  break;\n        case TK_EXCEPT:      zOp = \"EXCEPT\";     break;\n      }\n      sqlite3TreeViewItem(pView, zOp, 1);\n    }\n    p = p->pPrior;\n  }while( p!=0 );\n  sqlite3TreeViewPop(pView);\n}\n\n/*\n** Generate a human-readable explanation of an expression tree.\n*/\nvoid sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){\n  const char *zBinOp = 0;   /* Binary operator */\n  const char *zUniOp = 0;   /* Unary operator */\n  char zFlgs[30];\n  pView = sqlite3TreeViewPush(pView, moreToFollow);\n  if( pExpr==0 ){\n    sqlite3TreeViewLine(pView, \"nil\");\n    sqlite3TreeViewPop(pView);\n    return;\n  }\n  if( pExpr->flags ){\n    sqlite3_snprintf(sizeof(zFlgs),zFlgs,\"  flags=0x%x\",pExpr->flags);\n  }else{\n    zFlgs[0] = 0;\n  }\n  switch( pExpr->op ){\n    case TK_AGG_COLUMN: {\n      sqlite3TreeViewLine(pView, \"AGG{%d:%d}%s\",\n            pExpr->iTable, pExpr->iColumn, zFlgs);\n      break;\n    }\n    case TK_COLUMN: {\n      if( pExpr->iTable<0 ){\n        /* This only happens when coding check constraints */\n        sqlite3TreeViewLine(pView, \"COLUMN(%d)%s\", pExpr->iColumn, zFlgs);\n      }else{\n        sqlite3TreeViewLine(pView, \"{%d:%d}%s\",\n                             pExpr->iTable, pExpr->iColumn, zFlgs);\n      }\n      break;\n    }\n    case TK_INTEGER: {\n      if( pExpr->flags & EP_IntValue ){\n        sqlite3TreeViewLine(pView, \"%d\", pExpr->u.iValue);\n      }else{\n        sqlite3TreeViewLine(pView, \"%s\", pExpr->u.zToken);\n      }\n      break;\n    }\n#ifndef SQLITE_OMIT_FLOATING_POINT\n    case TK_FLOAT: {\n      sqlite3TreeViewLine(pView,\"%s\", pExpr->u.zToken);\n      break;\n    }\n#endif\n    case TK_STRING: {\n      sqlite3TreeViewLine(pView,\"%Q\", pExpr->u.zToken);\n      break;\n    }\n    case TK_NULL: {\n      sqlite3TreeViewLine(pView,\"NULL\");\n      break;\n    }\n#ifndef SQLITE_OMIT_BLOB_LITERAL\n    case TK_BLOB: {\n      sqlite3TreeViewLine(pView,\"%s\", pExpr->u.zToken);\n      break;\n    }\n#endif\n    case TK_VARIABLE: {\n      sqlite3TreeViewLine(pView,\"VARIABLE(%s,%d)\",\n                          pExpr->u.zToken, pExpr->iColumn);\n      break;\n    }\n    case TK_REGISTER: {\n      sqlite3TreeViewLine(pView,\"REGISTER(%d)\", pExpr->iTable);\n      break;\n    }\n    case TK_ID: {\n      sqlite3TreeViewLine(pView,\"ID \\\"%w\\\"\", pExpr->u.zToken);\n      break;\n    }\n#ifndef SQLITE_OMIT_CAST\n    case TK_CAST: {\n      /* Expressions of the form:   CAST(pLeft AS token) */\n      sqlite3TreeViewLine(pView,\"CAST %Q\", pExpr->u.zToken);\n      sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);\n      break;\n    }\n#endif /* SQLITE_OMIT_CAST */\n    case TK_LT:      zBinOp = \"LT\";     break;\n    case TK_LE:      zBinOp = \"LE\";     break;\n    case TK_GT:      zBinOp = \"GT\";     break;\n    case TK_GE:      zBinOp = \"GE\";     break;\n    case TK_NE:      zBinOp = \"NE\";     break;\n    case TK_EQ:      zBinOp = \"EQ\";     break;\n    case TK_IS:      zBinOp = \"IS\";     break;\n    case TK_ISNOT:   zBinOp = \"ISNOT\";  break;\n    case TK_AND:     zBinOp = \"AND\";    break;\n    case TK_OR:      zBinOp = \"OR\";     break;\n    case TK_PLUS:    zBinOp = \"ADD\";    break;\n    case TK_STAR:    zBinOp = \"MUL\";    break;\n    case TK_MINUS:   zBinOp = \"SUB\";    break;\n    case TK_REM:     zBinOp = \"REM\";    break;\n    case TK_BITAND:  zBinOp = \"BITAND\"; break;\n    case TK_BITOR:   zBinOp = \"BITOR\";  break;\n    case TK_SLASH:   zBinOp = \"DIV\";    break;\n    case TK_LSHIFT:  zBinOp = \"LSHIFT\"; break;\n    case TK_RSHIFT:  zBinOp = \"RSHIFT\"; break;\n    case TK_CONCAT:  zBinOp = \"CONCAT\"; break;\n    case TK_DOT:     zBinOp = \"DOT\";    break;\n\n    case TK_UMINUS:  zUniOp = \"UMINUS\"; break;\n    case TK_UPLUS:   zUniOp = \"UPLUS\";  break;\n    case TK_BITNOT:  zUniOp = \"BITNOT\"; break;\n    case TK_NOT:     zUniOp = \"NOT\";    break;\n    case TK_ISNULL:  zUniOp = \"ISNULL\"; break;\n    case TK_NOTNULL: zUniOp = \"NOTNULL\"; break;\n\n    case TK_SPAN: {\n      sqlite3TreeViewLine(pView, \"SPAN %Q\", pExpr->u.zToken);\n      sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);\n      break;\n    }\n\n    case TK_COLLATE: {\n      sqlite3TreeViewLine(pView, \"COLLATE %Q\", pExpr->u.zToken);\n      sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);\n      break;\n    }\n\n    case TK_AGG_FUNCTION:\n    case TK_FUNCTION: {\n      ExprList *pFarg;       /* List of function arguments */\n      if( ExprHasProperty(pExpr, EP_TokenOnly) ){\n        pFarg = 0;\n      }else{\n        pFarg = pExpr->x.pList;\n      }\n      if( pExpr->op==TK_AGG_FUNCTION ){\n        sqlite3TreeViewLine(pView, \"AGG_FUNCTION%d %Q\",\n                             pExpr->op2, pExpr->u.zToken);\n      }else{\n        sqlite3TreeViewLine(pView, \"FUNCTION %Q\", pExpr->u.zToken);\n      }\n      if( pFarg ){\n        sqlite3TreeViewExprList(pView, pFarg, 0, 0);\n      }\n      break;\n    }\n#ifndef SQLITE_OMIT_SUBQUERY\n    case TK_EXISTS: {\n      sqlite3TreeViewLine(pView, \"EXISTS-expr\");\n      sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);\n      break;\n    }\n    case TK_SELECT: {\n      sqlite3TreeViewLine(pView, \"SELECT-expr\");\n      sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);\n      break;\n    }\n    case TK_IN: {\n      sqlite3TreeViewLine(pView, \"IN\");\n      sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);\n      if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n        sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);\n      }else{\n        sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);\n      }\n      break;\n    }\n#endif /* SQLITE_OMIT_SUBQUERY */\n\n    /*\n    **    x BETWEEN y AND z\n    **\n    ** This is equivalent to\n    **\n    **    x>=y AND x<=z\n    **\n    ** X is stored in pExpr->pLeft.\n    ** Y is stored in pExpr->pList->a[0].pExpr.\n    ** Z is stored in pExpr->pList->a[1].pExpr.\n    */\n    case TK_BETWEEN: {\n      Expr *pX = pExpr->pLeft;\n      Expr *pY = pExpr->x.pList->a[0].pExpr;\n      Expr *pZ = pExpr->x.pList->a[1].pExpr;\n      sqlite3TreeViewLine(pView, \"BETWEEN\");\n      sqlite3TreeViewExpr(pView, pX, 1);\n      sqlite3TreeViewExpr(pView, pY, 1);\n      sqlite3TreeViewExpr(pView, pZ, 0);\n      break;\n    }\n    case TK_TRIGGER: {\n      /* If the opcode is TK_TRIGGER, then the expression is a reference\n      ** to a column in the new.* or old.* pseudo-tables available to\n      ** trigger programs. In this case Expr.iTable is set to 1 for the\n      ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn\n      ** is set to the column of the pseudo-table to read, or to -1 to\n      ** read the rowid field.\n      */\n      sqlite3TreeViewLine(pView, \"%s(%d)\", \n          pExpr->iTable ? \"NEW\" : \"OLD\", pExpr->iColumn);\n      break;\n    }\n    case TK_CASE: {\n      sqlite3TreeViewLine(pView, \"CASE\");\n      sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);\n      sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);\n      break;\n    }\n#ifndef SQLITE_OMIT_TRIGGER\n    case TK_RAISE: {\n      const char *zType = \"unk\";\n      switch( pExpr->affinity ){\n        case OE_Rollback:   zType = \"rollback\";  break;\n        case OE_Abort:      zType = \"abort\";     break;\n        case OE_Fail:       zType = \"fail\";      break;\n        case OE_Ignore:     zType = \"ignore\";    break;\n      }\n      sqlite3TreeViewLine(pView, \"RAISE %s(%Q)\", zType, pExpr->u.zToken);\n      break;\n    }\n#endif\n    case TK_MATCH: {\n      sqlite3TreeViewLine(pView, \"MATCH {%d:%d}%s\",\n                          pExpr->iTable, pExpr->iColumn, zFlgs);\n      sqlite3TreeViewExpr(pView, pExpr->pRight, 0);\n      break;\n    }\n    case TK_VECTOR: {\n      sqlite3TreeViewBareExprList(pView, pExpr->x.pList, \"VECTOR\");\n      break;\n    }\n    case TK_SELECT_COLUMN: {\n      sqlite3TreeViewLine(pView, \"SELECT-COLUMN %d\", pExpr->iColumn);\n      sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0);\n      break;\n    }\n    default: {\n      sqlite3TreeViewLine(pView, \"op=%d\", pExpr->op);\n      break;\n    }\n  }\n  if( zBinOp ){\n    sqlite3TreeViewLine(pView, \"%s%s\", zBinOp, zFlgs);\n    sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);\n    sqlite3TreeViewExpr(pView, pExpr->pRight, 0);\n  }else if( zUniOp ){\n    sqlite3TreeViewLine(pView, \"%s%s\", zUniOp, zFlgs);\n    sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);\n  }\n  sqlite3TreeViewPop(pView);\n}\n\n\n/*\n** Generate a human-readable explanation of an expression list.\n*/\nvoid sqlite3TreeViewBareExprList(\n  TreeView *pView,\n  const ExprList *pList,\n  const char *zLabel\n){\n  if( zLabel==0 || zLabel[0]==0 ) zLabel = \"LIST\";\n  if( pList==0 ){\n    sqlite3TreeViewLine(pView, \"%s (empty)\", zLabel);\n  }else{\n    int i;\n    sqlite3TreeViewLine(pView, \"%s\", zLabel);\n    for(i=0; i<pList->nExpr; i++){\n      int j = pList->a[i].u.x.iOrderByCol;\n      if( j ){\n        sqlite3TreeViewPush(pView, 0);\n        sqlite3TreeViewLine(pView, \"iOrderByCol=%d\", j);\n      }\n      sqlite3TreeViewExpr(pView, pList->a[i].pExpr, i<pList->nExpr-1);\n      if( j ) sqlite3TreeViewPop(pView);\n    }\n  }\n}\nvoid sqlite3TreeViewExprList(\n  TreeView *pView,\n  const ExprList *pList,\n  u8 moreToFollow,\n  const char *zLabel\n){\n  pView = sqlite3TreeViewPush(pView, moreToFollow);\n  sqlite3TreeViewBareExprList(pView, pList, zLabel);\n  sqlite3TreeViewPop(pView);\n}\n\n#endif /* SQLITE_DEBUG */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/trigger.c",
    "content": "/*\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains the implementation for TRIGGERs\n*/\n#include \"sqliteInt.h\"\n\n#ifndef SQLITE_OMIT_TRIGGER\n/*\n** Delete a linked list of TriggerStep structures.\n*/\nvoid sqlite3DeleteTriggerStep(sqlite3 *db, TriggerStep *pTriggerStep){\n  while( pTriggerStep ){\n    TriggerStep * pTmp = pTriggerStep;\n    pTriggerStep = pTriggerStep->pNext;\n\n    sqlite3ExprDelete(db, pTmp->pWhere);\n    sqlite3ExprListDelete(db, pTmp->pExprList);\n    sqlite3SelectDelete(db, pTmp->pSelect);\n    sqlite3IdListDelete(db, pTmp->pIdList);\n\n    sqlite3DbFree(db, pTmp);\n  }\n}\n\n/*\n** Given table pTab, return a list of all the triggers attached to \n** the table. The list is connected by Trigger.pNext pointers.\n**\n** All of the triggers on pTab that are in the same database as pTab\n** are already attached to pTab->pTrigger.  But there might be additional\n** triggers on pTab in the TEMP schema.  This routine prepends all\n** TEMP triggers on pTab to the beginning of the pTab->pTrigger list\n** and returns the combined list.\n**\n** To state it another way:  This routine returns a list of all triggers\n** that fire off of pTab.  The list will include any TEMP triggers on\n** pTab as well as the triggers lised in pTab->pTrigger.\n*/\nTrigger *sqlite3TriggerList(Parse *pParse, Table *pTab){\n  Schema * const pTmpSchema = pParse->db->aDb[1].pSchema;\n  Trigger *pList = 0;                  /* List of triggers to return */\n\n  if( pParse->disableTriggers ){\n    return 0;\n  }\n\n  if( pTmpSchema!=pTab->pSchema ){\n    HashElem *p;\n    assert( sqlite3SchemaMutexHeld(pParse->db, 0, pTmpSchema) );\n    for(p=sqliteHashFirst(&pTmpSchema->trigHash); p; p=sqliteHashNext(p)){\n      Trigger *pTrig = (Trigger *)sqliteHashData(p);\n      if( pTrig->pTabSchema==pTab->pSchema\n       && 0==sqlite3StrICmp(pTrig->table, pTab->zName) \n      ){\n        pTrig->pNext = (pList ? pList : pTab->pTrigger);\n        pList = pTrig;\n      }\n    }\n  }\n\n  return (pList ? pList : pTab->pTrigger);\n}\n\n/*\n** This is called by the parser when it sees a CREATE TRIGGER statement\n** up to the point of the BEGIN before the trigger actions.  A Trigger\n** structure is generated based on the information available and stored\n** in pParse->pNewTrigger.  After the trigger actions have been parsed, the\n** sqlite3FinishTrigger() function is called to complete the trigger\n** construction process.\n*/\nvoid sqlite3BeginTrigger(\n  Parse *pParse,      /* The parse context of the CREATE TRIGGER statement */\n  Token *pName1,      /* The name of the trigger */\n  Token *pName2,      /* The name of the trigger */\n  int tr_tm,          /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */\n  int op,             /* One of TK_INSERT, TK_UPDATE, TK_DELETE */\n  IdList *pColumns,   /* column list if this is an UPDATE OF trigger */\n  SrcList *pTableName,/* The name of the table/view the trigger applies to */\n  Expr *pWhen,        /* WHEN clause */\n  int isTemp,         /* True if the TEMPORARY keyword is present */\n  int noErr           /* Suppress errors if the trigger already exists */\n){\n  Trigger *pTrigger = 0;  /* The new trigger */\n  Table *pTab;            /* Table that the trigger fires off of */\n  char *zName = 0;        /* Name of the trigger */\n  sqlite3 *db = pParse->db;  /* The database connection */\n  int iDb;                /* The database to store the trigger in */\n  Token *pName;           /* The unqualified db name */\n  DbFixer sFix;           /* State vector for the DB fixer */\n\n  assert( pName1!=0 );   /* pName1->z might be NULL, but not pName1 itself */\n  assert( pName2!=0 );\n  assert( op==TK_INSERT || op==TK_UPDATE || op==TK_DELETE );\n  assert( op>0 && op<0xff );\n  if( isTemp ){\n    /* If TEMP was specified, then the trigger name may not be qualified. */\n    if( pName2->n>0 ){\n      sqlite3ErrorMsg(pParse, \"temporary trigger may not have qualified name\");\n      goto trigger_cleanup;\n    }\n    iDb = 1;\n    pName = pName1;\n  }else{\n    /* Figure out the db that the trigger will be created in */\n    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);\n    if( iDb<0 ){\n      goto trigger_cleanup;\n    }\n  }\n  if( !pTableName || db->mallocFailed ){\n    goto trigger_cleanup;\n  }\n\n  /* A long-standing parser bug is that this syntax was allowed:\n  **\n  **    CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab ....\n  **                                                 ^^^^^^^^\n  **\n  ** To maintain backwards compatibility, ignore the database\n  ** name on pTableName if we are reparsing out of SQLITE_MASTER.\n  */\n  if( db->init.busy && iDb!=1 ){\n    sqlite3DbFree(db, pTableName->a[0].zDatabase);\n    pTableName->a[0].zDatabase = 0;\n  }\n\n  /* If the trigger name was unqualified, and the table is a temp table,\n  ** then set iDb to 1 to create the trigger in the temporary database.\n  ** If sqlite3SrcListLookup() returns 0, indicating the table does not\n  ** exist, the error is caught by the block below.\n  */\n  pTab = sqlite3SrcListLookup(pParse, pTableName);\n  if( db->init.busy==0 && pName2->n==0 && pTab\n        && pTab->pSchema==db->aDb[1].pSchema ){\n    iDb = 1;\n  }\n\n  /* Ensure the table name matches database name and that the table exists */\n  if( db->mallocFailed ) goto trigger_cleanup;\n  assert( pTableName->nSrc==1 );\n  sqlite3FixInit(&sFix, pParse, iDb, \"trigger\", pName);\n  if( sqlite3FixSrcList(&sFix, pTableName) ){\n    goto trigger_cleanup;\n  }\n  pTab = sqlite3SrcListLookup(pParse, pTableName);\n  if( !pTab ){\n    /* The table does not exist. */\n    if( db->init.iDb==1 ){\n      /* Ticket #3810.\n      ** Normally, whenever a table is dropped, all associated triggers are\n      ** dropped too.  But if a TEMP trigger is created on a non-TEMP table\n      ** and the table is dropped by a different database connection, the\n      ** trigger is not visible to the database connection that does the\n      ** drop so the trigger cannot be dropped.  This results in an\n      ** \"orphaned trigger\" - a trigger whose associated table is missing.\n      */\n      db->init.orphanTrigger = 1;\n    }\n    goto trigger_cleanup;\n  }\n  if( IsVirtual(pTab) ){\n    sqlite3ErrorMsg(pParse, \"cannot create triggers on virtual tables\");\n    goto trigger_cleanup;\n  }\n\n  /* Check that the trigger name is not reserved and that no trigger of the\n  ** specified name exists */\n  zName = sqlite3NameFromToken(db, pName);\n  if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){\n    goto trigger_cleanup;\n  }\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){\n    if( !noErr ){\n      sqlite3ErrorMsg(pParse, \"trigger %T already exists\", pName);\n    }else{\n      assert( !db->init.busy );\n      sqlite3CodeVerifySchema(pParse, iDb);\n    }\n    goto trigger_cleanup;\n  }\n\n  /* Do not create a trigger on a system table */\n  if( sqlite3StrNICmp(pTab->zName, \"sqlite_\", 7)==0 ){\n    sqlite3ErrorMsg(pParse, \"cannot create trigger on system table\");\n    goto trigger_cleanup;\n  }\n\n  /* INSTEAD of triggers are only for views and views only support INSTEAD\n  ** of triggers.\n  */\n  if( pTab->pSelect && tr_tm!=TK_INSTEAD ){\n    sqlite3ErrorMsg(pParse, \"cannot create %s trigger on view: %S\", \n        (tr_tm == TK_BEFORE)?\"BEFORE\":\"AFTER\", pTableName, 0);\n    goto trigger_cleanup;\n  }\n  if( !pTab->pSelect && tr_tm==TK_INSTEAD ){\n    sqlite3ErrorMsg(pParse, \"cannot create INSTEAD OF\"\n        \" trigger on table: %S\", pTableName, 0);\n    goto trigger_cleanup;\n  }\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  {\n    int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n    int code = SQLITE_CREATE_TRIGGER;\n    const char *zDb = db->aDb[iTabDb].zDbSName;\n    const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb;\n    if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;\n    if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){\n      goto trigger_cleanup;\n    }\n    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){\n      goto trigger_cleanup;\n    }\n  }\n#endif\n\n  /* INSTEAD OF triggers can only appear on views and BEFORE triggers\n  ** cannot appear on views.  So we might as well translate every\n  ** INSTEAD OF trigger into a BEFORE trigger.  It simplifies code\n  ** elsewhere.\n  */\n  if (tr_tm == TK_INSTEAD){\n    tr_tm = TK_BEFORE;\n  }\n\n  /* Build the Trigger object */\n  pTrigger = (Trigger*)sqlite3DbMallocZero(db, sizeof(Trigger));\n  if( pTrigger==0 ) goto trigger_cleanup;\n  pTrigger->zName = zName;\n  zName = 0;\n  pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName);\n  pTrigger->pSchema = db->aDb[iDb].pSchema;\n  pTrigger->pTabSchema = pTab->pSchema;\n  pTrigger->op = (u8)op;\n  pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER;\n  pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE);\n  pTrigger->pColumns = sqlite3IdListDup(db, pColumns);\n  assert( pParse->pNewTrigger==0 );\n  pParse->pNewTrigger = pTrigger;\n\ntrigger_cleanup:\n  sqlite3DbFree(db, zName);\n  sqlite3SrcListDelete(db, pTableName);\n  sqlite3IdListDelete(db, pColumns);\n  sqlite3ExprDelete(db, pWhen);\n  if( !pParse->pNewTrigger ){\n    sqlite3DeleteTrigger(db, pTrigger);\n  }else{\n    assert( pParse->pNewTrigger==pTrigger );\n  }\n}\n\n/*\n** This routine is called after all of the trigger actions have been parsed\n** in order to complete the process of building the trigger.\n*/\nvoid sqlite3FinishTrigger(\n  Parse *pParse,          /* Parser context */\n  TriggerStep *pStepList, /* The triggered program */\n  Token *pAll             /* Token that describes the complete CREATE TRIGGER */\n){\n  Trigger *pTrig = pParse->pNewTrigger;   /* Trigger being finished */\n  char *zName;                            /* Name of trigger */\n  sqlite3 *db = pParse->db;               /* The database */\n  DbFixer sFix;                           /* Fixer object */\n  int iDb;                                /* Database containing the trigger */\n  Token nameToken;                        /* Trigger name for error reporting */\n\n  pParse->pNewTrigger = 0;\n  if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup;\n  zName = pTrig->zName;\n  iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);\n  pTrig->step_list = pStepList;\n  while( pStepList ){\n    pStepList->pTrig = pTrig;\n    pStepList = pStepList->pNext;\n  }\n  sqlite3TokenInit(&nameToken, pTrig->zName);\n  sqlite3FixInit(&sFix, pParse, iDb, \"trigger\", &nameToken);\n  if( sqlite3FixTriggerStep(&sFix, pTrig->step_list) \n   || sqlite3FixExpr(&sFix, pTrig->pWhen) \n  ){\n    goto triggerfinish_cleanup;\n  }\n\n  /* if we are not initializing,\n  ** build the sqlite_master entry\n  */\n  if( !db->init.busy ){\n    Vdbe *v;\n    char *z;\n\n    /* Make an entry in the sqlite_master table */\n    v = sqlite3GetVdbe(pParse);\n    if( v==0 ) goto triggerfinish_cleanup;\n    sqlite3BeginWriteOperation(pParse, 0, iDb);\n    z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n);\n    sqlite3NestedParse(pParse,\n       \"INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')\",\n       db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), zName,\n       pTrig->table, z);\n    sqlite3DbFree(db, z);\n    sqlite3ChangeCookie(pParse, iDb);\n    sqlite3VdbeAddParseSchemaOp(v, iDb,\n        sqlite3MPrintf(db, \"type='trigger' AND name='%q'\", zName));\n  }\n\n  if( db->init.busy ){\n    Trigger *pLink = pTrig;\n    Hash *pHash = &db->aDb[iDb].pSchema->trigHash;\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    pTrig = sqlite3HashInsert(pHash, zName, pTrig);\n    if( pTrig ){\n      sqlite3OomFault(db);\n    }else if( pLink->pSchema==pLink->pTabSchema ){\n      Table *pTab;\n      pTab = sqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table);\n      assert( pTab!=0 );\n      pLink->pNext = pTab->pTrigger;\n      pTab->pTrigger = pLink;\n    }\n  }\n\ntriggerfinish_cleanup:\n  sqlite3DeleteTrigger(db, pTrig);\n  assert( !pParse->pNewTrigger );\n  sqlite3DeleteTriggerStep(db, pStepList);\n}\n\n/*\n** Turn a SELECT statement (that the pSelect parameter points to) into\n** a trigger step.  Return a pointer to a TriggerStep structure.\n**\n** The parser calls this routine when it finds a SELECT statement in\n** body of a TRIGGER.  \n*/\nTriggerStep *sqlite3TriggerSelectStep(sqlite3 *db, Select *pSelect){\n  TriggerStep *pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));\n  if( pTriggerStep==0 ) {\n    sqlite3SelectDelete(db, pSelect);\n    return 0;\n  }\n  pTriggerStep->op = TK_SELECT;\n  pTriggerStep->pSelect = pSelect;\n  pTriggerStep->orconf = OE_Default;\n  return pTriggerStep;\n}\n\n/*\n** Allocate space to hold a new trigger step.  The allocated space\n** holds both the TriggerStep object and the TriggerStep.target.z string.\n**\n** If an OOM error occurs, NULL is returned and db->mallocFailed is set.\n*/\nstatic TriggerStep *triggerStepAllocate(\n  sqlite3 *db,                /* Database connection */\n  u8 op,                      /* Trigger opcode */\n  Token *pName                /* The target name */\n){\n  TriggerStep *pTriggerStep;\n\n  pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1);\n  if( pTriggerStep ){\n    char *z = (char*)&pTriggerStep[1];\n    memcpy(z, pName->z, pName->n);\n    sqlite3Dequote(z);\n    pTriggerStep->zTarget = z;\n    pTriggerStep->op = op;\n  }\n  return pTriggerStep;\n}\n\n/*\n** Build a trigger step out of an INSERT statement.  Return a pointer\n** to the new trigger step.\n**\n** The parser calls this routine when it sees an INSERT inside the\n** body of a trigger.\n*/\nTriggerStep *sqlite3TriggerInsertStep(\n  sqlite3 *db,        /* The database connection */\n  Token *pTableName,  /* Name of the table into which we insert */\n  IdList *pColumn,    /* List of columns in pTableName to insert into */\n  Select *pSelect,    /* A SELECT statement that supplies values */\n  u8 orconf           /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */\n){\n  TriggerStep *pTriggerStep;\n\n  assert(pSelect != 0 || db->mallocFailed);\n\n  pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName);\n  if( pTriggerStep ){\n    pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);\n    pTriggerStep->pIdList = pColumn;\n    pTriggerStep->orconf = orconf;\n  }else{\n    sqlite3IdListDelete(db, pColumn);\n  }\n  sqlite3SelectDelete(db, pSelect);\n\n  return pTriggerStep;\n}\n\n/*\n** Construct a trigger step that implements an UPDATE statement and return\n** a pointer to that trigger step.  The parser calls this routine when it\n** sees an UPDATE statement inside the body of a CREATE TRIGGER.\n*/\nTriggerStep *sqlite3TriggerUpdateStep(\n  sqlite3 *db,         /* The database connection */\n  Token *pTableName,   /* Name of the table to be updated */\n  ExprList *pEList,    /* The SET clause: list of column and new values */\n  Expr *pWhere,        /* The WHERE clause */\n  u8 orconf            /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */\n){\n  TriggerStep *pTriggerStep;\n\n  pTriggerStep = triggerStepAllocate(db, TK_UPDATE, pTableName);\n  if( pTriggerStep ){\n    pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE);\n    pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);\n    pTriggerStep->orconf = orconf;\n  }\n  sqlite3ExprListDelete(db, pEList);\n  sqlite3ExprDelete(db, pWhere);\n  return pTriggerStep;\n}\n\n/*\n** Construct a trigger step that implements a DELETE statement and return\n** a pointer to that trigger step.  The parser calls this routine when it\n** sees a DELETE statement inside the body of a CREATE TRIGGER.\n*/\nTriggerStep *sqlite3TriggerDeleteStep(\n  sqlite3 *db,            /* Database connection */\n  Token *pTableName,      /* The table from which rows are deleted */\n  Expr *pWhere            /* The WHERE clause */\n){\n  TriggerStep *pTriggerStep;\n\n  pTriggerStep = triggerStepAllocate(db, TK_DELETE, pTableName);\n  if( pTriggerStep ){\n    pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);\n    pTriggerStep->orconf = OE_Default;\n  }\n  sqlite3ExprDelete(db, pWhere);\n  return pTriggerStep;\n}\n\n/* \n** Recursively delete a Trigger structure\n*/\nvoid sqlite3DeleteTrigger(sqlite3 *db, Trigger *pTrigger){\n  if( pTrigger==0 ) return;\n  sqlite3DeleteTriggerStep(db, pTrigger->step_list);\n  sqlite3DbFree(db, pTrigger->zName);\n  sqlite3DbFree(db, pTrigger->table);\n  sqlite3ExprDelete(db, pTrigger->pWhen);\n  sqlite3IdListDelete(db, pTrigger->pColumns);\n  sqlite3DbFree(db, pTrigger);\n}\n\n/*\n** This function is called to drop a trigger from the database schema. \n**\n** This may be called directly from the parser and therefore identifies\n** the trigger by name.  The sqlite3DropTriggerPtr() routine does the\n** same job as this routine except it takes a pointer to the trigger\n** instead of the trigger name.\n**/\nvoid sqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){\n  Trigger *pTrigger = 0;\n  int i;\n  const char *zDb;\n  const char *zName;\n  sqlite3 *db = pParse->db;\n\n  if( db->mallocFailed ) goto drop_trigger_cleanup;\n  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){\n    goto drop_trigger_cleanup;\n  }\n\n  assert( pName->nSrc==1 );\n  zDb = pName->a[0].zDatabase;\n  zName = pName->a[0].zName;\n  assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) );\n  for(i=OMIT_TEMPDB; i<db->nDb; i++){\n    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */\n    if( zDb && sqlite3StrICmp(db->aDb[j].zDbSName, zDb) ) continue;\n    assert( sqlite3SchemaMutexHeld(db, j, 0) );\n    pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName);\n    if( pTrigger ) break;\n  }\n  if( !pTrigger ){\n    if( !noErr ){\n      sqlite3ErrorMsg(pParse, \"no such trigger: %S\", pName, 0);\n    }else{\n      sqlite3CodeVerifyNamedSchema(pParse, zDb);\n    }\n    pParse->checkSchema = 1;\n    goto drop_trigger_cleanup;\n  }\n  sqlite3DropTriggerPtr(pParse, pTrigger);\n\ndrop_trigger_cleanup:\n  sqlite3SrcListDelete(db, pName);\n}\n\n/*\n** Return a pointer to the Table structure for the table that a trigger\n** is set on.\n*/\nstatic Table *tableOfTrigger(Trigger *pTrigger){\n  return sqlite3HashFind(&pTrigger->pTabSchema->tblHash, pTrigger->table);\n}\n\n\n/*\n** Drop a trigger given a pointer to that trigger. \n*/\nvoid sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){\n  Table   *pTable;\n  Vdbe *v;\n  sqlite3 *db = pParse->db;\n  int iDb;\n\n  iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);\n  assert( iDb>=0 && iDb<db->nDb );\n  pTable = tableOfTrigger(pTrigger);\n  assert( pTable );\n  assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  {\n    int code = SQLITE_DROP_TRIGGER;\n    const char *zDb = db->aDb[iDb].zDbSName;\n    const char *zTab = SCHEMA_TABLE(iDb);\n    if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER;\n    if( sqlite3AuthCheck(pParse, code, pTrigger->zName, pTable->zName, zDb) ||\n      sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){\n      return;\n    }\n  }\n#endif\n\n  /* Generate code to destroy the database record of the trigger.\n  */\n  assert( pTable!=0 );\n  if( (v = sqlite3GetVdbe(pParse))!=0 ){\n    sqlite3NestedParse(pParse,\n       \"DELETE FROM %Q.%s WHERE name=%Q AND type='trigger'\",\n       db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb), pTrigger->zName\n    );\n    sqlite3ChangeCookie(pParse, iDb);\n    sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0);\n  }\n}\n\n/*\n** Remove a trigger from the hash tables of the sqlite* pointer.\n*/\nvoid sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){\n  Trigger *pTrigger;\n  Hash *pHash;\n\n  assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n  pHash = &(db->aDb[iDb].pSchema->trigHash);\n  pTrigger = sqlite3HashInsert(pHash, zName, 0);\n  if( ALWAYS(pTrigger) ){\n    if( pTrigger->pSchema==pTrigger->pTabSchema ){\n      Table *pTab = tableOfTrigger(pTrigger);\n      Trigger **pp;\n      for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));\n      *pp = (*pp)->pNext;\n    }\n    sqlite3DeleteTrigger(db, pTrigger);\n    db->flags |= SQLITE_InternChanges;\n  }\n}\n\n/*\n** pEList is the SET clause of an UPDATE statement.  Each entry\n** in pEList is of the format <id>=<expr>.  If any of the entries\n** in pEList have an <id> which matches an identifier in pIdList,\n** then return TRUE.  If pIdList==NULL, then it is considered a\n** wildcard that matches anything.  Likewise if pEList==NULL then\n** it matches anything so always return true.  Return false only\n** if there is no match.\n*/\nstatic int checkColumnOverlap(IdList *pIdList, ExprList *pEList){\n  int e;\n  if( pIdList==0 || NEVER(pEList==0) ) return 1;\n  for(e=0; e<pEList->nExpr; e++){\n    if( sqlite3IdListIndex(pIdList, pEList->a[e].zName)>=0 ) return 1;\n  }\n  return 0; \n}\n\n/*\n** Return a list of all triggers on table pTab if there exists at least\n** one trigger that must be fired when an operation of type 'op' is \n** performed on the table, and, if that operation is an UPDATE, if at\n** least one of the columns in pChanges is being modified.\n*/\nTrigger *sqlite3TriggersExist(\n  Parse *pParse,          /* Parse context */\n  Table *pTab,            /* The table the contains the triggers */\n  int op,                 /* one of TK_DELETE, TK_INSERT, TK_UPDATE */\n  ExprList *pChanges,     /* Columns that change in an UPDATE statement */\n  int *pMask              /* OUT: Mask of TRIGGER_BEFORE|TRIGGER_AFTER */\n){\n  int mask = 0;\n  Trigger *pList = 0;\n  Trigger *p;\n\n  if( (pParse->db->flags & SQLITE_EnableTrigger)!=0 ){\n    pList = sqlite3TriggerList(pParse, pTab);\n  }\n  assert( pList==0 || IsVirtual(pTab)==0 );\n  for(p=pList; p; p=p->pNext){\n    if( p->op==op && checkColumnOverlap(p->pColumns, pChanges) ){\n      mask |= p->tr_tm;\n    }\n  }\n  if( pMask ){\n    *pMask = mask;\n  }\n  return (mask ? pList : 0);\n}\n\n/*\n** Convert the pStep->zTarget string into a SrcList and return a pointer\n** to that SrcList.\n**\n** This routine adds a specific database name, if needed, to the target when\n** forming the SrcList.  This prevents a trigger in one database from\n** referring to a target in another database.  An exception is when the\n** trigger is in TEMP in which case it can refer to any other database it\n** wants.\n*/\nstatic SrcList *targetSrcList(\n  Parse *pParse,       /* The parsing context */\n  TriggerStep *pStep   /* The trigger containing the target token */\n){\n  sqlite3 *db = pParse->db;\n  int iDb;             /* Index of the database to use */\n  SrcList *pSrc;       /* SrcList to be returned */\n\n  pSrc = sqlite3SrcListAppend(db, 0, 0, 0);\n  if( pSrc ){\n    assert( pSrc->nSrc>0 );\n    pSrc->a[pSrc->nSrc-1].zName = sqlite3DbStrDup(db, pStep->zTarget);\n    iDb = sqlite3SchemaToIndex(db, pStep->pTrig->pSchema);\n    if( iDb==0 || iDb>=2 ){\n      const char *zDb;\n      assert( iDb<db->nDb );\n      zDb = db->aDb[iDb].zDbSName;\n      pSrc->a[pSrc->nSrc-1].zDatabase =  sqlite3DbStrDup(db, zDb);\n    }\n  }\n  return pSrc;\n}\n\n/*\n** Generate VDBE code for the statements inside the body of a single \n** trigger.\n*/\nstatic int codeTriggerProgram(\n  Parse *pParse,            /* The parser context */\n  TriggerStep *pStepList,   /* List of statements inside the trigger body */\n  int orconf                /* Conflict algorithm. (OE_Abort, etc) */  \n){\n  TriggerStep *pStep;\n  Vdbe *v = pParse->pVdbe;\n  sqlite3 *db = pParse->db;\n\n  assert( pParse->pTriggerTab && pParse->pToplevel );\n  assert( pStepList );\n  assert( v!=0 );\n  for(pStep=pStepList; pStep; pStep=pStep->pNext){\n    /* Figure out the ON CONFLICT policy that will be used for this step\n    ** of the trigger program. If the statement that caused this trigger\n    ** to fire had an explicit ON CONFLICT, then use it. Otherwise, use\n    ** the ON CONFLICT policy that was specified as part of the trigger\n    ** step statement. Example:\n    **\n    **   CREATE TRIGGER AFTER INSERT ON t1 BEGIN;\n    **     INSERT OR REPLACE INTO t2 VALUES(new.a, new.b);\n    **   END;\n    **\n    **   INSERT INTO t1 ... ;            -- insert into t2 uses REPLACE policy\n    **   INSERT OR IGNORE INTO t1 ... ;  -- insert into t2 uses IGNORE policy\n    */\n    pParse->eOrconf = (orconf==OE_Default)?pStep->orconf:(u8)orconf;\n    assert( pParse->okConstFactor==0 );\n\n    switch( pStep->op ){\n      case TK_UPDATE: {\n        sqlite3Update(pParse, \n          targetSrcList(pParse, pStep),\n          sqlite3ExprListDup(db, pStep->pExprList, 0), \n          sqlite3ExprDup(db, pStep->pWhere, 0), \n          pParse->eOrconf\n        );\n        break;\n      }\n      case TK_INSERT: {\n        sqlite3Insert(pParse, \n          targetSrcList(pParse, pStep),\n          sqlite3SelectDup(db, pStep->pSelect, 0), \n          sqlite3IdListDup(db, pStep->pIdList), \n          pParse->eOrconf\n        );\n        break;\n      }\n      case TK_DELETE: {\n        sqlite3DeleteFrom(pParse, \n          targetSrcList(pParse, pStep),\n          sqlite3ExprDup(db, pStep->pWhere, 0)\n        );\n        break;\n      }\n      default: assert( pStep->op==TK_SELECT ); {\n        SelectDest sDest;\n        Select *pSelect = sqlite3SelectDup(db, pStep->pSelect, 0);\n        sqlite3SelectDestInit(&sDest, SRT_Discard, 0);\n        sqlite3Select(pParse, pSelect, &sDest);\n        sqlite3SelectDelete(db, pSelect);\n        break;\n      }\n    } \n    if( pStep->op!=TK_SELECT ){\n      sqlite3VdbeAddOp0(v, OP_ResetCount);\n    }\n  }\n\n  return 0;\n}\n\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n/*\n** This function is used to add VdbeComment() annotations to a VDBE\n** program. It is not used in production code, only for debugging.\n*/\nstatic const char *onErrorText(int onError){\n  switch( onError ){\n    case OE_Abort:    return \"abort\";\n    case OE_Rollback: return \"rollback\";\n    case OE_Fail:     return \"fail\";\n    case OE_Replace:  return \"replace\";\n    case OE_Ignore:   return \"ignore\";\n    case OE_Default:  return \"default\";\n  }\n  return \"n/a\";\n}\n#endif\n\n/*\n** Parse context structure pFrom has just been used to create a sub-vdbe\n** (trigger program). If an error has occurred, transfer error information\n** from pFrom to pTo.\n*/\nstatic void transferParseError(Parse *pTo, Parse *pFrom){\n  assert( pFrom->zErrMsg==0 || pFrom->nErr );\n  assert( pTo->zErrMsg==0 || pTo->nErr );\n  if( pTo->nErr==0 ){\n    pTo->zErrMsg = pFrom->zErrMsg;\n    pTo->nErr = pFrom->nErr;\n    pTo->rc = pFrom->rc;\n  }else{\n    sqlite3DbFree(pFrom->db, pFrom->zErrMsg);\n  }\n}\n\n/*\n** Create and populate a new TriggerPrg object with a sub-program \n** implementing trigger pTrigger with ON CONFLICT policy orconf.\n*/\nstatic TriggerPrg *codeRowTrigger(\n  Parse *pParse,       /* Current parse context */\n  Trigger *pTrigger,   /* Trigger to code */\n  Table *pTab,         /* The table pTrigger is attached to */\n  int orconf           /* ON CONFLICT policy to code trigger program with */\n){\n  Parse *pTop = sqlite3ParseToplevel(pParse);\n  sqlite3 *db = pParse->db;   /* Database handle */\n  TriggerPrg *pPrg;           /* Value to return */\n  Expr *pWhen = 0;            /* Duplicate of trigger WHEN expression */\n  Vdbe *v;                    /* Temporary VM */\n  NameContext sNC;            /* Name context for sub-vdbe */\n  SubProgram *pProgram = 0;   /* Sub-vdbe for trigger program */\n  Parse *pSubParse;           /* Parse context for sub-vdbe */\n  int iEndTrigger = 0;        /* Label to jump to if WHEN is false */\n\n  assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );\n  assert( pTop->pVdbe );\n\n  /* Allocate the TriggerPrg and SubProgram objects. To ensure that they\n  ** are freed if an error occurs, link them into the Parse.pTriggerPrg \n  ** list of the top-level Parse object sooner rather than later.  */\n  pPrg = sqlite3DbMallocZero(db, sizeof(TriggerPrg));\n  if( !pPrg ) return 0;\n  pPrg->pNext = pTop->pTriggerPrg;\n  pTop->pTriggerPrg = pPrg;\n  pPrg->pProgram = pProgram = sqlite3DbMallocZero(db, sizeof(SubProgram));\n  if( !pProgram ) return 0;\n  sqlite3VdbeLinkSubProgram(pTop->pVdbe, pProgram);\n  pPrg->pTrigger = pTrigger;\n  pPrg->orconf = orconf;\n  pPrg->aColmask[0] = 0xffffffff;\n  pPrg->aColmask[1] = 0xffffffff;\n\n  /* Allocate and populate a new Parse context to use for coding the \n  ** trigger sub-program.  */\n  pSubParse = sqlite3StackAllocZero(db, sizeof(Parse));\n  if( !pSubParse ) return 0;\n  memset(&sNC, 0, sizeof(sNC));\n  sNC.pParse = pSubParse;\n  pSubParse->db = db;\n  pSubParse->pTriggerTab = pTab;\n  pSubParse->pToplevel = pTop;\n  pSubParse->zAuthContext = pTrigger->zName;\n  pSubParse->eTriggerOp = pTrigger->op;\n  pSubParse->nQueryLoop = pParse->nQueryLoop;\n\n  v = sqlite3GetVdbe(pSubParse);\n  if( v ){\n    VdbeComment((v, \"Start: %s.%s (%s %s%s%s ON %s)\", \n      pTrigger->zName, onErrorText(orconf),\n      (pTrigger->tr_tm==TRIGGER_BEFORE ? \"BEFORE\" : \"AFTER\"),\n        (pTrigger->op==TK_UPDATE ? \"UPDATE\" : \"\"),\n        (pTrigger->op==TK_INSERT ? \"INSERT\" : \"\"),\n        (pTrigger->op==TK_DELETE ? \"DELETE\" : \"\"),\n      pTab->zName\n    ));\n#ifndef SQLITE_OMIT_TRACE\n    sqlite3VdbeChangeP4(v, -1, \n      sqlite3MPrintf(db, \"-- TRIGGER %s\", pTrigger->zName), P4_DYNAMIC\n    );\n#endif\n\n    /* If one was specified, code the WHEN clause. If it evaluates to false\n    ** (or NULL) the sub-vdbe is immediately halted by jumping to the \n    ** OP_Halt inserted at the end of the program.  */\n    if( pTrigger->pWhen ){\n      pWhen = sqlite3ExprDup(db, pTrigger->pWhen, 0);\n      if( SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen) \n       && db->mallocFailed==0 \n      ){\n        iEndTrigger = sqlite3VdbeMakeLabel(v);\n        sqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL);\n      }\n      sqlite3ExprDelete(db, pWhen);\n    }\n\n    /* Code the trigger program into the sub-vdbe. */\n    codeTriggerProgram(pSubParse, pTrigger->step_list, orconf);\n\n    /* Insert an OP_Halt at the end of the sub-program. */\n    if( iEndTrigger ){\n      sqlite3VdbeResolveLabel(v, iEndTrigger);\n    }\n    sqlite3VdbeAddOp0(v, OP_Halt);\n    VdbeComment((v, \"End: %s.%s\", pTrigger->zName, onErrorText(orconf)));\n\n    transferParseError(pParse, pSubParse);\n    if( db->mallocFailed==0 ){\n      pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg);\n    }\n    pProgram->nMem = pSubParse->nMem;\n    pProgram->nCsr = pSubParse->nTab;\n    pProgram->token = (void *)pTrigger;\n    pPrg->aColmask[0] = pSubParse->oldmask;\n    pPrg->aColmask[1] = pSubParse->newmask;\n    sqlite3VdbeDelete(v);\n  }\n\n  assert( !pSubParse->pAinc       && !pSubParse->pZombieTab );\n  assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg );\n  sqlite3ParserReset(pSubParse);\n  sqlite3StackFree(db, pSubParse);\n\n  return pPrg;\n}\n    \n/*\n** Return a pointer to a TriggerPrg object containing the sub-program for\n** trigger pTrigger with default ON CONFLICT algorithm orconf. If no such\n** TriggerPrg object exists, a new object is allocated and populated before\n** being returned.\n*/\nstatic TriggerPrg *getRowTrigger(\n  Parse *pParse,       /* Current parse context */\n  Trigger *pTrigger,   /* Trigger to code */\n  Table *pTab,         /* The table trigger pTrigger is attached to */\n  int orconf           /* ON CONFLICT algorithm. */\n){\n  Parse *pRoot = sqlite3ParseToplevel(pParse);\n  TriggerPrg *pPrg;\n\n  assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );\n\n  /* It may be that this trigger has already been coded (or is in the\n  ** process of being coded). If this is the case, then an entry with\n  ** a matching TriggerPrg.pTrigger field will be present somewhere\n  ** in the Parse.pTriggerPrg list. Search for such an entry.  */\n  for(pPrg=pRoot->pTriggerPrg; \n      pPrg && (pPrg->pTrigger!=pTrigger || pPrg->orconf!=orconf); \n      pPrg=pPrg->pNext\n  );\n\n  /* If an existing TriggerPrg could not be located, create a new one. */\n  if( !pPrg ){\n    pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf);\n  }\n\n  return pPrg;\n}\n\n/*\n** Generate code for the trigger program associated with trigger p on \n** table pTab. The reg, orconf and ignoreJump parameters passed to this\n** function are the same as those described in the header function for\n** sqlite3CodeRowTrigger()\n*/\nvoid sqlite3CodeRowTriggerDirect(\n  Parse *pParse,       /* Parse context */\n  Trigger *p,          /* Trigger to code */\n  Table *pTab,         /* The table to code triggers from */\n  int reg,             /* Reg array containing OLD.* and NEW.* values */\n  int orconf,          /* ON CONFLICT policy */\n  int ignoreJump       /* Instruction to jump to for RAISE(IGNORE) */\n){\n  Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */\n  TriggerPrg *pPrg;\n  pPrg = getRowTrigger(pParse, p, pTab, orconf);\n  assert( pPrg || pParse->nErr || pParse->db->mallocFailed );\n\n  /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program \n  ** is a pointer to the sub-vdbe containing the trigger program.  */\n  if( pPrg ){\n    int bRecursive = (p->zName && 0==(pParse->db->flags&SQLITE_RecTriggers));\n\n    sqlite3VdbeAddOp4(v, OP_Program, reg, ignoreJump, ++pParse->nMem,\n                      (const char *)pPrg->pProgram, P4_SUBPROGRAM);\n    VdbeComment(\n        (v, \"Call: %s.%s\", (p->zName?p->zName:\"fkey\"), onErrorText(orconf)));\n\n    /* Set the P5 operand of the OP_Program instruction to non-zero if\n    ** recursive invocation of this trigger program is disallowed. Recursive\n    ** invocation is disallowed if (a) the sub-program is really a trigger,\n    ** not a foreign key action, and (b) the flag to enable recursive triggers\n    ** is clear.  */\n    sqlite3VdbeChangeP5(v, (u8)bRecursive);\n  }\n}\n\n/*\n** This is called to code the required FOR EACH ROW triggers for an operation\n** on table pTab. The operation to code triggers for (INSERT, UPDATE or DELETE)\n** is given by the op parameter. The tr_tm parameter determines whether the\n** BEFORE or AFTER triggers are coded. If the operation is an UPDATE, then\n** parameter pChanges is passed the list of columns being modified.\n**\n** If there are no triggers that fire at the specified time for the specified\n** operation on pTab, this function is a no-op.\n**\n** The reg argument is the address of the first in an array of registers \n** that contain the values substituted for the new.* and old.* references\n** in the trigger program. If N is the number of columns in table pTab\n** (a copy of pTab->nCol), then registers are populated as follows:\n**\n**   Register       Contains\n**   ------------------------------------------------------\n**   reg+0          OLD.rowid\n**   reg+1          OLD.* value of left-most column of pTab\n**   ...            ...\n**   reg+N          OLD.* value of right-most column of pTab\n**   reg+N+1        NEW.rowid\n**   reg+N+2        OLD.* value of left-most column of pTab\n**   ...            ...\n**   reg+N+N+1      NEW.* value of right-most column of pTab\n**\n** For ON DELETE triggers, the registers containing the NEW.* values will\n** never be accessed by the trigger program, so they are not allocated or \n** populated by the caller (there is no data to populate them with anyway). \n** Similarly, for ON INSERT triggers the values stored in the OLD.* registers\n** are never accessed, and so are not allocated by the caller. So, for an\n** ON INSERT trigger, the value passed to this function as parameter reg\n** is not a readable register, although registers (reg+N) through \n** (reg+N+N+1) are.\n**\n** Parameter orconf is the default conflict resolution algorithm for the\n** trigger program to use (REPLACE, IGNORE etc.). Parameter ignoreJump\n** is the instruction that control should jump to if a trigger program\n** raises an IGNORE exception.\n*/\nvoid sqlite3CodeRowTrigger(\n  Parse *pParse,       /* Parse context */\n  Trigger *pTrigger,   /* List of triggers on table pTab */\n  int op,              /* One of TK_UPDATE, TK_INSERT, TK_DELETE */\n  ExprList *pChanges,  /* Changes list for any UPDATE OF triggers */\n  int tr_tm,           /* One of TRIGGER_BEFORE, TRIGGER_AFTER */\n  Table *pTab,         /* The table to code triggers from */\n  int reg,             /* The first in an array of registers (see above) */\n  int orconf,          /* ON CONFLICT policy */\n  int ignoreJump       /* Instruction to jump to for RAISE(IGNORE) */\n){\n  Trigger *p;          /* Used to iterate through pTrigger list */\n\n  assert( op==TK_UPDATE || op==TK_INSERT || op==TK_DELETE );\n  assert( tr_tm==TRIGGER_BEFORE || tr_tm==TRIGGER_AFTER );\n  assert( (op==TK_UPDATE)==(pChanges!=0) );\n\n  for(p=pTrigger; p; p=p->pNext){\n\n    /* Sanity checking:  The schema for the trigger and for the table are\n    ** always defined.  The trigger must be in the same schema as the table\n    ** or else it must be a TEMP trigger. */\n    assert( p->pSchema!=0 );\n    assert( p->pTabSchema!=0 );\n    assert( p->pSchema==p->pTabSchema \n         || p->pSchema==pParse->db->aDb[1].pSchema );\n\n    /* Determine whether we should code this trigger */\n    if( p->op==op \n     && p->tr_tm==tr_tm \n     && checkColumnOverlap(p->pColumns, pChanges)\n    ){\n      sqlite3CodeRowTriggerDirect(pParse, p, pTab, reg, orconf, ignoreJump);\n    }\n  }\n}\n\n/*\n** Triggers may access values stored in the old.* or new.* pseudo-table. \n** This function returns a 32-bit bitmask indicating which columns of the \n** old.* or new.* tables actually are used by triggers. This information \n** may be used by the caller, for example, to avoid having to load the entire\n** old.* record into memory when executing an UPDATE or DELETE command.\n**\n** Bit 0 of the returned mask is set if the left-most column of the\n** table may be accessed using an [old|new].<col> reference. Bit 1 is set if\n** the second leftmost column value is required, and so on. If there\n** are more than 32 columns in the table, and at least one of the columns\n** with an index greater than 32 may be accessed, 0xffffffff is returned.\n**\n** It is not possible to determine if the old.rowid or new.rowid column is \n** accessed by triggers. The caller must always assume that it is.\n**\n** Parameter isNew must be either 1 or 0. If it is 0, then the mask returned\n** applies to the old.* table. If 1, the new.* table.\n**\n** Parameter tr_tm must be a mask with one or both of the TRIGGER_BEFORE\n** and TRIGGER_AFTER bits set. Values accessed by BEFORE triggers are only\n** included in the returned mask if the TRIGGER_BEFORE bit is set in the\n** tr_tm parameter. Similarly, values accessed by AFTER triggers are only\n** included in the returned mask if the TRIGGER_AFTER bit is set in tr_tm.\n*/\nu32 sqlite3TriggerColmask(\n  Parse *pParse,       /* Parse context */\n  Trigger *pTrigger,   /* List of triggers on table pTab */\n  ExprList *pChanges,  /* Changes list for any UPDATE OF triggers */\n  int isNew,           /* 1 for new.* ref mask, 0 for old.* ref mask */\n  int tr_tm,           /* Mask of TRIGGER_BEFORE|TRIGGER_AFTER */\n  Table *pTab,         /* The table to code triggers from */\n  int orconf           /* Default ON CONFLICT policy for trigger steps */\n){\n  const int op = pChanges ? TK_UPDATE : TK_DELETE;\n  u32 mask = 0;\n  Trigger *p;\n\n  assert( isNew==1 || isNew==0 );\n  for(p=pTrigger; p; p=p->pNext){\n    if( p->op==op && (tr_tm&p->tr_tm)\n     && checkColumnOverlap(p->pColumns,pChanges)\n    ){\n      TriggerPrg *pPrg;\n      pPrg = getRowTrigger(pParse, p, pTab, orconf);\n      if( pPrg ){\n        mask |= pPrg->aColmask[isNew];\n      }\n    }\n  }\n\n  return mask;\n}\n\n#endif /* !defined(SQLITE_OMIT_TRIGGER) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/update.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains C code routines that are called by the parser\n** to handle UPDATE statements.\n*/\n#include \"sqliteInt.h\"\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Forward declaration */\nstatic void updateVirtualTable(\n  Parse *pParse,       /* The parsing context */\n  SrcList *pSrc,       /* The virtual table to be modified */\n  Table *pTab,         /* The virtual table */\n  ExprList *pChanges,  /* The columns to change in the UPDATE statement */\n  Expr *pRowidExpr,    /* Expression used to recompute the rowid */\n  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */\n  Expr *pWhere,        /* WHERE clause of the UPDATE statement */\n  int onError          /* ON CONFLICT strategy */\n);\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n/*\n** The most recently coded instruction was an OP_Column to retrieve the\n** i-th column of table pTab. This routine sets the P4 parameter of the \n** OP_Column to the default value, if any.\n**\n** The default value of a column is specified by a DEFAULT clause in the \n** column definition. This was either supplied by the user when the table\n** was created, or added later to the table definition by an ALTER TABLE\n** command. If the latter, then the row-records in the table btree on disk\n** may not contain a value for the column and the default value, taken\n** from the P4 parameter of the OP_Column instruction, is returned instead.\n** If the former, then all row-records are guaranteed to include a value\n** for the column and the P4 value is not required.\n**\n** Column definitions created by an ALTER TABLE command may only have \n** literal default values specified: a number, null or a string. (If a more\n** complicated default expression value was provided, it is evaluated \n** when the ALTER TABLE is executed and one of the literal values written\n** into the sqlite_master table.)\n**\n** Therefore, the P4 parameter is only required if the default value for\n** the column is a literal number, string or null. The sqlite3ValueFromExpr()\n** function is capable of transforming these types of expressions into\n** sqlite3_value objects.\n**\n** If parameter iReg is not negative, code an OP_RealAffinity instruction\n** on register iReg. This is used when an equivalent integer value is \n** stored in place of an 8-byte floating point value in order to save \n** space.\n*/\nvoid sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){\n  assert( pTab!=0 );\n  if( !pTab->pSelect ){\n    sqlite3_value *pValue = 0;\n    u8 enc = ENC(sqlite3VdbeDb(v));\n    Column *pCol = &pTab->aCol[i];\n    VdbeComment((v, \"%s.%s\", pTab->zName, pCol->zName));\n    assert( i<pTab->nCol );\n    sqlite3ValueFromExpr(sqlite3VdbeDb(v), pCol->pDflt, enc, \n                         pCol->affinity, &pValue);\n    if( pValue ){\n      sqlite3VdbeChangeP4(v, -1, (const char *)pValue, P4_MEM);\n    }\n#ifndef SQLITE_OMIT_FLOATING_POINT\n    if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){\n      sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg);\n    }\n#endif\n  }\n}\n\n/*\n** Process an UPDATE statement.\n**\n**   UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL;\n**          \\_______/ \\________/     \\______/       \\________________/\n*            onError   pTabList      pChanges             pWhere\n*/\nvoid sqlite3Update(\n  Parse *pParse,         /* The parser context */\n  SrcList *pTabList,     /* The table in which we should change things */\n  ExprList *pChanges,    /* Things to be changed */\n  Expr *pWhere,          /* The WHERE clause.  May be null */\n  int onError            /* How to handle constraint errors */\n){\n  int i, j;              /* Loop counters */\n  Table *pTab;           /* The table to be updated */\n  int addrTop = 0;       /* VDBE instruction address of the start of the loop */\n  WhereInfo *pWInfo;     /* Information about the WHERE clause */\n  Vdbe *v;               /* The virtual database engine */\n  Index *pIdx;           /* For looping over indices */\n  Index *pPk;            /* The PRIMARY KEY index for WITHOUT ROWID tables */\n  int nIdx;              /* Number of indices that need updating */\n  int iBaseCur;          /* Base cursor number */\n  int iDataCur;          /* Cursor for the canonical data btree */\n  int iIdxCur;           /* Cursor for the first index */\n  sqlite3 *db;           /* The database structure */\n  int *aRegIdx = 0;      /* One register assigned to each index to be updated */\n  int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the\n                         ** an expression for the i-th column of the table.\n                         ** aXRef[i]==-1 if the i-th column is not changed. */\n  u8 *aToOpen;           /* 1 for tables and indices to be opened */\n  u8 chngPk;             /* PRIMARY KEY changed in a WITHOUT ROWID table */\n  u8 chngRowid;          /* Rowid changed in a normal table */\n  u8 chngKey;            /* Either chngPk or chngRowid */\n  Expr *pRowidExpr = 0;  /* Expression defining the new record number */\n  AuthContext sContext;  /* The authorization context */\n  NameContext sNC;       /* The name-context to resolve expressions in */\n  int iDb;               /* Database containing the table being updated */\n  int okOnePass;         /* True for one-pass algorithm without the FIFO */\n  int hasFK;             /* True if foreign key processing is required */\n  int labelBreak;        /* Jump here to break out of UPDATE loop */\n  int labelContinue;     /* Jump here to continue next step of UPDATE loop */\n\n#ifndef SQLITE_OMIT_TRIGGER\n  int isView;            /* True when updating a view (INSTEAD OF trigger) */\n  Trigger *pTrigger;     /* List of triggers on pTab, if required */\n  int tmask;             /* Mask of TRIGGER_BEFORE|TRIGGER_AFTER */\n#endif\n  int newmask;           /* Mask of NEW.* columns accessed by BEFORE triggers */\n  int iEph = 0;          /* Ephemeral table holding all primary key values */\n  int nKey = 0;          /* Number of elements in regKey for WITHOUT ROWID */\n  int aiCurOnePass[2];   /* The write cursors opened by WHERE_ONEPASS */\n\n  /* Register Allocations */\n  int regRowCount = 0;   /* A count of rows changed */\n  int regOldRowid = 0;   /* The old rowid */\n  int regNewRowid = 0;   /* The new rowid */\n  int regNew = 0;        /* Content of the NEW.* table in triggers */\n  int regOld = 0;        /* Content of OLD.* table in triggers */\n  int regRowSet = 0;     /* Rowset of rows to be updated */\n  int regKey = 0;        /* composite PRIMARY KEY value */\n\n  memset(&sContext, 0, sizeof(sContext));\n  db = pParse->db;\n  if( pParse->nErr || db->mallocFailed ){\n    goto update_cleanup;\n  }\n  assert( pTabList->nSrc==1 );\n\n  /* Locate the table which we want to update. \n  */\n  pTab = sqlite3SrcListLookup(pParse, pTabList);\n  if( pTab==0 ) goto update_cleanup;\n  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);\n\n  /* Figure out if we have any triggers and if the table being\n  ** updated is a view.\n  */\n#ifndef SQLITE_OMIT_TRIGGER\n  pTrigger = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask);\n  isView = pTab->pSelect!=0;\n  assert( pTrigger || tmask==0 );\n#else\n# define pTrigger 0\n# define isView 0\n# define tmask 0\n#endif\n#ifdef SQLITE_OMIT_VIEW\n# undef isView\n# define isView 0\n#endif\n\n  if( sqlite3ViewGetColumnNames(pParse, pTab) ){\n    goto update_cleanup;\n  }\n  if( sqlite3IsReadOnly(pParse, pTab, tmask) ){\n    goto update_cleanup;\n  }\n\n  /* Allocate a cursors for the main database table and for all indices.\n  ** The index cursors might not be used, but if they are used they\n  ** need to occur right after the database cursor.  So go ahead and\n  ** allocate enough space, just in case.\n  */\n  pTabList->a[0].iCursor = iBaseCur = iDataCur = pParse->nTab++;\n  iIdxCur = iDataCur+1;\n  pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);\n  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){\n    if( IsPrimaryKeyIndex(pIdx) && pPk!=0 ){\n      iDataCur = pParse->nTab;\n      pTabList->a[0].iCursor = iDataCur;\n    }\n    pParse->nTab++;\n  }\n\n  /* Allocate space for aXRef[], aRegIdx[], and aToOpen[].  \n  ** Initialize aXRef[] and aToOpen[] to their default values.\n  */\n  aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );\n  if( aXRef==0 ) goto update_cleanup;\n  aRegIdx = aXRef+pTab->nCol;\n  aToOpen = (u8*)(aRegIdx+nIdx);\n  memset(aToOpen, 1, nIdx+1);\n  aToOpen[nIdx+1] = 0;\n  for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;\n\n  /* Initialize the name-context */\n  memset(&sNC, 0, sizeof(sNC));\n  sNC.pParse = pParse;\n  sNC.pSrcList = pTabList;\n\n  /* Resolve the column names in all the expressions of the\n  ** of the UPDATE statement.  Also find the column index\n  ** for each column to be updated in the pChanges array.  For each\n  ** column to be updated, make sure we have authorization to change\n  ** that column.\n  */\n  chngRowid = chngPk = 0;\n  for(i=0; i<pChanges->nExpr; i++){\n    if( sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){\n      goto update_cleanup;\n    }\n    for(j=0; j<pTab->nCol; j++){\n      if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){\n        if( j==pTab->iPKey ){\n          chngRowid = 1;\n          pRowidExpr = pChanges->a[i].pExpr;\n        }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){\n          chngPk = 1;\n        }\n        aXRef[j] = i;\n        break;\n      }\n    }\n    if( j>=pTab->nCol ){\n      if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zName) ){\n        j = -1;\n        chngRowid = 1;\n        pRowidExpr = pChanges->a[i].pExpr;\n      }else{\n        sqlite3ErrorMsg(pParse, \"no such column: %s\", pChanges->a[i].zName);\n        pParse->checkSchema = 1;\n        goto update_cleanup;\n      }\n    }\n#ifndef SQLITE_OMIT_AUTHORIZATION\n    {\n      int rc;\n      rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,\n                            j<0 ? \"ROWID\" : pTab->aCol[j].zName,\n                            db->aDb[iDb].zDbSName);\n      if( rc==SQLITE_DENY ){\n        goto update_cleanup;\n      }else if( rc==SQLITE_IGNORE ){\n        aXRef[j] = -1;\n      }\n    }\n#endif\n  }\n  assert( (chngRowid & chngPk)==0 );\n  assert( chngRowid==0 || chngRowid==1 );\n  assert( chngPk==0 || chngPk==1 );\n  chngKey = chngRowid + chngPk;\n\n  /* The SET expressions are not actually used inside the WHERE loop.  \n  ** So reset the colUsed mask. Unless this is a virtual table. In that\n  ** case, set all bits of the colUsed mask (to ensure that the virtual\n  ** table implementation makes all columns available).\n  */\n  pTabList->a[0].colUsed = IsVirtual(pTab) ? ALLBITS : 0;\n\n  hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey);\n\n  /* There is one entry in the aRegIdx[] array for each index on the table\n  ** being updated.  Fill in aRegIdx[] with a register number that will hold\n  ** the key for accessing each index.\n  **\n  ** FIXME:  Be smarter about omitting indexes that use expressions.\n  */\n  for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){\n    int reg;\n    if( chngKey || hasFK || pIdx->pPartIdxWhere || pIdx==pPk ){\n      reg = ++pParse->nMem;\n    }else{\n      reg = 0;\n      for(i=0; i<pIdx->nKeyCol; i++){\n        i16 iIdxCol = pIdx->aiColumn[i];\n        if( iIdxCol<0 || aXRef[iIdxCol]>=0 ){\n          reg = ++pParse->nMem;\n          break;\n        }\n      }\n    }\n    if( reg==0 ) aToOpen[j+1] = 0;\n    aRegIdx[j] = reg;\n  }\n\n  /* Begin generating code. */\n  v = sqlite3GetVdbe(pParse);\n  if( v==0 ) goto update_cleanup;\n  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);\n  sqlite3BeginWriteOperation(pParse, 1, iDb);\n\n  /* Allocate required registers. */\n  if( !IsVirtual(pTab) ){\n    regRowSet = ++pParse->nMem;\n    regOldRowid = regNewRowid = ++pParse->nMem;\n    if( chngPk || pTrigger || hasFK ){\n      regOld = pParse->nMem + 1;\n      pParse->nMem += pTab->nCol;\n    }\n    if( chngKey || pTrigger || hasFK ){\n      regNewRowid = ++pParse->nMem;\n    }\n    regNew = pParse->nMem + 1;\n    pParse->nMem += pTab->nCol;\n  }\n\n  /* Start the view context. */\n  if( isView ){\n    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);\n  }\n\n  /* If we are trying to update a view, realize that view into\n  ** an ephemeral table.\n  */\n#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)\n  if( isView ){\n    sqlite3MaterializeView(pParse, pTab, pWhere, iDataCur);\n  }\n#endif\n\n  /* Resolve the column names in all the expressions in the\n  ** WHERE clause.\n  */\n  if( sqlite3ResolveExprNames(&sNC, pWhere) ){\n    goto update_cleanup;\n  }\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  /* Virtual tables must be handled separately */\n  if( IsVirtual(pTab) ){\n    updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef,\n                       pWhere, onError);\n    goto update_cleanup;\n  }\n#endif\n\n  /* Begin the database scan\n  */\n  if( HasRowid(pTab) ){\n    sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid);\n    pWInfo = sqlite3WhereBegin(\n        pParse, pTabList, pWhere, 0, 0,\n            WHERE_ONEPASS_DESIRED | WHERE_SEEK_TABLE, iIdxCur\n    );\n    if( pWInfo==0 ) goto update_cleanup;\n    okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);\n  \n    /* Remember the rowid of every item to be updated.\n    */\n    sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid);\n    if( !okOnePass ){\n      sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid);\n    }\n  \n    /* End the database scan loop.\n    */\n    sqlite3WhereEnd(pWInfo);\n  }else{\n    int iPk;         /* First of nPk memory cells holding PRIMARY KEY value */\n    i16 nPk;         /* Number of components of the PRIMARY KEY */\n    int addrOpen;    /* Address of the OpenEphemeral instruction */\n\n    assert( pPk!=0 );\n    nPk = pPk->nKeyCol;\n    iPk = pParse->nMem+1;\n    pParse->nMem += nPk;\n    regKey = ++pParse->nMem;\n    iEph = pParse->nTab++;\n    sqlite3VdbeAddOp2(v, OP_Null, 0, iPk);\n    addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk);\n    sqlite3VdbeSetP4KeyInfo(pParse, pPk);\n    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, \n                               WHERE_ONEPASS_DESIRED, iIdxCur);\n    if( pWInfo==0 ) goto update_cleanup;\n    okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);\n    for(i=0; i<nPk; i++){\n      assert( pPk->aiColumn[i]>=0 );\n      sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pPk->aiColumn[i],\n                                      iPk+i);\n    }\n    if( okOnePass ){\n      sqlite3VdbeChangeToNoop(v, addrOpen);\n      nKey = nPk;\n      regKey = iPk;\n    }else{\n      sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey,\n                        sqlite3IndexAffinityStr(db, pPk), nPk);\n      sqlite3VdbeAddOp2(v, OP_IdxInsert, iEph, regKey);\n    }\n    sqlite3WhereEnd(pWInfo);\n  }\n\n  /* Initialize the count of updated rows\n  */\n  if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab ){\n    regRowCount = ++pParse->nMem;\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);\n  }\n\n  labelBreak = sqlite3VdbeMakeLabel(v);\n  if( !isView ){\n    /* \n    ** Open every index that needs updating.  Note that if any\n    ** index could potentially invoke a REPLACE conflict resolution \n    ** action, then we need to open all indices because we might need\n    ** to be deleting some records.\n    */\n    if( onError==OE_Replace ){\n      memset(aToOpen, 1, nIdx+1);\n    }else{\n      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n        if( pIdx->onError==OE_Replace ){\n          memset(aToOpen, 1, nIdx+1);\n          break;\n        }\n      }\n    }\n    if( okOnePass ){\n      if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0;\n      if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0;\n    }\n    sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur, aToOpen,\n                               0, 0);\n  }\n\n  /* Top of the update loop */\n  if( okOnePass ){\n    if( aToOpen[iDataCur-iBaseCur] && !isView ){\n      assert( pPk );\n      sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey, nKey);\n      VdbeCoverageNeverTaken(v);\n    }\n    labelContinue = labelBreak;\n    sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak);\n    VdbeCoverageIf(v, pPk==0);\n    VdbeCoverageIf(v, pPk!=0);\n  }else if( pPk ){\n    labelContinue = sqlite3VdbeMakeLabel(v);\n    sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v);\n    addrTop = sqlite3VdbeAddOp2(v, OP_RowKey, iEph, regKey);\n    sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0);\n    VdbeCoverage(v);\n  }else{\n    labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet, labelBreak,\n                             regOldRowid);\n    VdbeCoverage(v);\n    sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);\n    VdbeCoverage(v);\n  }\n\n  /* If the record number will change, set register regNewRowid to\n  ** contain the new value. If the record number is not being modified,\n  ** then regNewRowid is the same register as regOldRowid, which is\n  ** already populated.  */\n  assert( chngKey || pTrigger || hasFK || regOldRowid==regNewRowid );\n  if( chngRowid ){\n    sqlite3ExprCode(pParse, pRowidExpr, regNewRowid);\n    sqlite3VdbeAddOp1(v, OP_MustBeInt, regNewRowid); VdbeCoverage(v);\n  }\n\n  /* Compute the old pre-UPDATE content of the row being changed, if that\n  ** information is needed */\n  if( chngPk || hasFK || pTrigger ){\n    u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0);\n    oldmask |= sqlite3TriggerColmask(pParse, \n        pTrigger, pChanges, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onError\n    );\n    for(i=0; i<pTab->nCol; i++){\n      if( oldmask==0xffffffff\n       || (i<32 && (oldmask & MASKBIT32(i))!=0)\n       || (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0\n      ){\n        testcase(  oldmask!=0xffffffff && i==31 );\n        sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regOld+i);\n      }else{\n        sqlite3VdbeAddOp2(v, OP_Null, 0, regOld+i);\n      }\n    }\n    if( chngRowid==0 && pPk==0 ){\n      sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid);\n    }\n  }\n\n  /* Populate the array of registers beginning at regNew with the new\n  ** row data. This array is used to check constants, create the new\n  ** table and index records, and as the values for any new.* references\n  ** made by triggers.\n  **\n  ** If there are one or more BEFORE triggers, then do not populate the\n  ** registers associated with columns that are (a) not modified by\n  ** this UPDATE statement and (b) not accessed by new.* references. The\n  ** values for registers not modified by the UPDATE must be reloaded from \n  ** the database after the BEFORE triggers are fired anyway (as the trigger \n  ** may have modified them). So not loading those that are not going to\n  ** be used eliminates some redundant opcodes.\n  */\n  newmask = sqlite3TriggerColmask(\n      pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError\n  );\n  for(i=0; i<pTab->nCol; i++){\n    if( i==pTab->iPKey ){\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);\n    }else{\n      j = aXRef[i];\n      if( j>=0 ){\n        sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i);\n      }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){\n        /* This branch loads the value of a column that will not be changed \n        ** into a register. This is done if there are no BEFORE triggers, or\n        ** if there are one or more BEFORE triggers that use this value via\n        ** a new.* reference in a trigger program.\n        */\n        testcase( i==31 );\n        testcase( i==32 );\n        sqlite3ExprCodeGetColumnToReg(pParse, pTab, i, iDataCur, regNew+i);\n      }else{\n        sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);\n      }\n    }\n  }\n\n  /* Fire any BEFORE UPDATE triggers. This happens before constraints are\n  ** verified. One could argue that this is wrong.\n  */\n  if( tmask&TRIGGER_BEFORE ){\n    sqlite3TableAffinity(v, pTab, regNew);\n    sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, \n        TRIGGER_BEFORE, pTab, regOldRowid, onError, labelContinue);\n\n    /* The row-trigger may have deleted the row being updated. In this\n    ** case, jump to the next row. No updates or AFTER triggers are \n    ** required. This behavior - what happens when the row being updated\n    ** is deleted or renamed by a BEFORE trigger - is left undefined in the\n    ** documentation.\n    */\n    if( pPk ){\n      sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue,regKey,nKey);\n      VdbeCoverage(v);\n    }else{\n      sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid);\n      VdbeCoverage(v);\n    }\n\n    /* If it did not delete it, the row-trigger may still have modified \n    ** some of the columns of the row being updated. Load the values for \n    ** all columns not modified by the update statement into their \n    ** registers in case this has happened.\n    */\n    for(i=0; i<pTab->nCol; i++){\n      if( aXRef[i]<0 && i!=pTab->iPKey ){\n        sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);\n      }\n    }\n  }\n\n  if( !isView ){\n    int addr1 = 0;        /* Address of jump instruction */\n    int bReplace = 0;     /* True if REPLACE conflict resolution might happen */\n\n    /* Do constraint checks. */\n    assert( regOldRowid>0 );\n    sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,\n        regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace,\n        aXRef);\n\n    /* Do FK constraint checks. */\n    if( hasFK ){\n      sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey);\n    }\n\n    /* Delete the index entries associated with the current record.  */\n    if( bReplace || chngKey ){\n      if( pPk ){\n        addr1 = sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, 0, regKey, nKey);\n      }else{\n        addr1 = sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, 0, regOldRowid);\n      }\n      VdbeCoverageNeverTaken(v);\n    }\n    sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, aRegIdx, -1);\n\n    /* If changing the rowid value, or if there are foreign key constraints\n    ** to process, delete the old record. Otherwise, add a noop OP_Delete\n    ** to invoke the pre-update hook.\n    **\n    ** That (regNew==regnewRowid+1) is true is also important for the \n    ** pre-update hook. If the caller invokes preupdate_new(), the returned\n    ** value is copied from memory cell (regNewRowid+1+iCol), where iCol\n    ** is the column index supplied by the user.\n    */\n    assert( regNew==regNewRowid+1 );\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n    sqlite3VdbeAddOp3(v, OP_Delete, iDataCur,\n        OPFLAG_ISUPDATE | ((hasFK || chngKey || pPk!=0) ? 0 : OPFLAG_ISNOOP),\n        regNewRowid\n    );\n    if( !pParse->nested ){\n      sqlite3VdbeChangeP4(v, -1, (char*)pTab, P4_TABLE);\n    }\n#else\n    if( hasFK || chngKey || pPk!=0 ){\n      sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, 0);\n    }\n#endif\n    if( bReplace || chngKey ){\n      sqlite3VdbeJumpHere(v, addr1);\n    }\n\n    if( hasFK ){\n      sqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey);\n    }\n  \n    /* Insert the new index entries and the new record. */\n    sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur,\n                             regNewRowid, aRegIdx, 1, 0, 0);\n\n    /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to\n    ** handle rows (possibly in other tables) that refer via a foreign key\n    ** to the row just updated. */ \n    if( hasFK ){\n      sqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey);\n    }\n  }\n\n  /* Increment the row counter \n  */\n  if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab){\n    sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);\n  }\n\n  sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, \n      TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue);\n\n  /* Repeat the above with the next record to be updated, until\n  ** all record selected by the WHERE clause have been updated.\n  */\n  if( okOnePass ){\n    /* Nothing to do at end-of-loop for a single-pass */\n  }else if( pPk ){\n    sqlite3VdbeResolveLabel(v, labelContinue);\n    sqlite3VdbeAddOp2(v, OP_Next, iEph, addrTop); VdbeCoverage(v);\n  }else{\n    sqlite3VdbeGoto(v, labelContinue);\n  }\n  sqlite3VdbeResolveLabel(v, labelBreak);\n\n  /* Close all tables */\n  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){\n    assert( aRegIdx );\n    if( aToOpen[i+1] ){\n      sqlite3VdbeAddOp2(v, OP_Close, iIdxCur+i, 0);\n    }\n  }\n  if( iDataCur<iIdxCur ) sqlite3VdbeAddOp2(v, OP_Close, iDataCur, 0);\n\n  /* Update the sqlite_sequence table by storing the content of the\n  ** maximum rowid counter values recorded while inserting into\n  ** autoincrement tables.\n  */\n  if( pParse->nested==0 && pParse->pTriggerTab==0 ){\n    sqlite3AutoincrementEnd(pParse);\n  }\n\n  /*\n  ** Return the number of rows that were changed. If this routine is \n  ** generating code because of a call to sqlite3NestedParse(), do not\n  ** invoke the callback function.\n  */\n  if( (db->flags&SQLITE_CountRows) && !pParse->pTriggerTab && !pParse->nested ){\n    sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);\n    sqlite3VdbeSetNumCols(v, 1);\n    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, \"rows updated\", SQLITE_STATIC);\n  }\n\nupdate_cleanup:\n  sqlite3AuthContextPop(&sContext);\n  sqlite3DbFree(db, aXRef); /* Also frees aRegIdx[] and aToOpen[] */\n  sqlite3SrcListDelete(db, pTabList);\n  sqlite3ExprListDelete(db, pChanges);\n  sqlite3ExprDelete(db, pWhere);\n  return;\n}\n/* Make sure \"isView\" and other macros defined above are undefined. Otherwise\n** they may interfere with compilation of other functions in this file\n** (or in another file, if this file becomes part of the amalgamation).  */\n#ifdef isView\n #undef isView\n#endif\n#ifdef pTrigger\n #undef pTrigger\n#endif\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/*\n** Generate code for an UPDATE of a virtual table.\n**\n** There are two possible strategies - the default and the special \n** \"onepass\" strategy. Onepass is only used if the virtual table \n** implementation indicates that pWhere may match at most one row.\n**\n** The default strategy is to create an ephemeral table that contains\n** for each row to be changed:\n**\n**   (A)  The original rowid of that row.\n**   (B)  The revised rowid for the row.\n**   (C)  The content of every column in the row.\n**\n** Then loop through the contents of this ephemeral table executing a\n** VUpdate for each row. When finished, drop the ephemeral table.\n**\n** The \"onepass\" strategy does not use an ephemeral table. Instead, it\n** stores the same values (A, B and C above) in a register array and\n** makes a single invocation of VUpdate.\n*/\nstatic void updateVirtualTable(\n  Parse *pParse,       /* The parsing context */\n  SrcList *pSrc,       /* The virtual table to be modified */\n  Table *pTab,         /* The virtual table */\n  ExprList *pChanges,  /* The columns to change in the UPDATE statement */\n  Expr *pRowid,        /* Expression used to recompute the rowid */\n  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */\n  Expr *pWhere,        /* WHERE clause of the UPDATE statement */\n  int onError          /* ON CONFLICT strategy */\n){\n  Vdbe *v = pParse->pVdbe;  /* Virtual machine under construction */\n  int ephemTab;             /* Table holding the result of the SELECT */\n  int i;                    /* Loop counter */\n  sqlite3 *db = pParse->db; /* Database connection */\n  const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);\n  WhereInfo *pWInfo;\n  int nArg = 2 + pTab->nCol;      /* Number of arguments to VUpdate */\n  int regArg;                     /* First register in VUpdate arg array */\n  int regRec;                     /* Register in which to assemble record */\n  int regRowid;                   /* Register for ephem table rowid */\n  int iCsr = pSrc->a[0].iCursor;  /* Cursor used for virtual table scan */\n  int aDummy[2];                  /* Unused arg for sqlite3WhereOkOnePass() */\n  int bOnePass;                   /* True to use onepass strategy */\n  int addr;                       /* Address of OP_OpenEphemeral */\n\n  /* Allocate nArg registers to martial the arguments to VUpdate. Then\n  ** create and open the ephemeral table in which the records created from\n  ** these arguments will be temporarily stored. */\n  assert( v );\n  ephemTab = pParse->nTab++;\n  addr= sqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, nArg);\n  regArg = pParse->nMem + 1;\n  pParse->nMem += nArg;\n  regRec = ++pParse->nMem;\n  regRowid = ++pParse->nMem;\n\n  /* Start scanning the virtual table */\n  pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0,0,WHERE_ONEPASS_DESIRED,0);\n  if( pWInfo==0 ) return;\n\n  /* Populate the argument registers. */\n  sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg);\n  if( pRowid ){\n    sqlite3ExprCode(pParse, pRowid, regArg+1);\n  }else{\n    sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg+1);\n  }\n  for(i=0; i<pTab->nCol; i++){\n    if( aXRef[i]>=0 ){\n      sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i);\n    }else{\n      sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i);\n    }\n  }\n\n  bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy);\n\n  if( bOnePass ){\n    /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded\n    ** above. Also, if this is a top-level parse (not a trigger), clear the\n    ** multi-write flag so that the VM does not open a statement journal */\n    sqlite3VdbeChangeToNoop(v, addr);\n    if( sqlite3IsToplevel(pParse) ){\n      pParse->isMultiWrite = 0;\n    }\n  }else{\n    /* Create a record from the argument register contents and insert it into\n    ** the ephemeral table. */\n    sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec);\n    sqlite3VdbeAddOp2(v, OP_NewRowid, ephemTab, regRowid);\n    sqlite3VdbeAddOp3(v, OP_Insert, ephemTab, regRec, regRowid);\n  }\n\n\n  if( bOnePass==0 ){\n    /* End the virtual table scan */\n    sqlite3WhereEnd(pWInfo);\n\n    /* Begin scannning through the ephemeral table. */\n    addr = sqlite3VdbeAddOp1(v, OP_Rewind, ephemTab); VdbeCoverage(v);\n\n    /* Extract arguments from the current row of the ephemeral table and \n    ** invoke the VUpdate method.  */\n    for(i=0; i<nArg; i++){\n      sqlite3VdbeAddOp3(v, OP_Column, ephemTab, i, regArg+i);\n    }\n  }\n  sqlite3VtabMakeWritable(pParse, pTab);\n  sqlite3VdbeAddOp4(v, OP_VUpdate, 0, nArg, regArg, pVTab, P4_VTAB);\n  sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError);\n  sqlite3MayAbort(pParse);\n\n  /* End of the ephemeral table scan. Or, if using the onepass strategy,\n  ** jump to here if the scan visited zero rows. */\n  if( bOnePass==0 ){\n    sqlite3VdbeAddOp2(v, OP_Next, ephemTab, addr+1); VdbeCoverage(v);\n    sqlite3VdbeJumpHere(v, addr);\n    sqlite3VdbeAddOp2(v, OP_Close, ephemTab, 0);\n  }else{\n    sqlite3WhereEnd(pWInfo);\n  }\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/utf.c",
    "content": "/*\n** 2004 April 13\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains routines used to translate between UTF-8, \n** UTF-16, UTF-16BE, and UTF-16LE.\n**\n** Notes on UTF-8:\n**\n**   Byte-0    Byte-1    Byte-2    Byte-3    Value\n**  0xxxxxxx                                 00000000 00000000 0xxxxxxx\n**  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx\n**  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx\n**  11110uuu  10uuzzzz  10yyyyyy  10xxxxxx   000uuuuu zzzzyyyy yyxxxxxx\n**\n**\n** Notes on UTF-16:  (with wwww+1==uuuuu)\n**\n**      Word-0               Word-1          Value\n**  110110ww wwzzzzyy   110111yy yyxxxxxx    000uuuuu zzzzyyyy yyxxxxxx\n**  zzzzyyyy yyxxxxxx                        00000000 zzzzyyyy yyxxxxxx\n**\n**\n** BOM or Byte Order Mark:\n**     0xff 0xfe   little-endian utf-16 follows\n**     0xfe 0xff   big-endian utf-16 follows\n**\n*/\n#include \"sqliteInt.h\"\n#include <assert.h>\n#include \"vdbeInt.h\"\n\n#if !defined(SQLITE_AMALGAMATION) && SQLITE_BYTEORDER==0\n/*\n** The following constant value is used by the SQLITE_BIGENDIAN and\n** SQLITE_LITTLEENDIAN macros.\n*/\nconst int sqlite3one = 1;\n#endif /* SQLITE_AMALGAMATION && SQLITE_BYTEORDER==0 */\n\n/*\n** This lookup table is used to help decode the first byte of\n** a multi-byte UTF8 character.\n*/\nstatic const unsigned char sqlite3Utf8Trans1[] = {\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,\n  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,\n  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\n  0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,\n};\n\n\n#define WRITE_UTF8(zOut, c) {                          \\\n  if( c<0x00080 ){                                     \\\n    *zOut++ = (u8)(c&0xFF);                            \\\n  }                                                    \\\n  else if( c<0x00800 ){                                \\\n    *zOut++ = 0xC0 + (u8)((c>>6)&0x1F);                \\\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\n  }                                                    \\\n  else if( c<0x10000 ){                                \\\n    *zOut++ = 0xE0 + (u8)((c>>12)&0x0F);               \\\n    *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);              \\\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\n  }else{                                               \\\n    *zOut++ = 0xF0 + (u8)((c>>18) & 0x07);             \\\n    *zOut++ = 0x80 + (u8)((c>>12) & 0x3F);             \\\n    *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);              \\\n    *zOut++ = 0x80 + (u8)(c & 0x3F);                   \\\n  }                                                    \\\n}\n\n#define WRITE_UTF16LE(zOut, c) {                                    \\\n  if( c<=0xFFFF ){                                                  \\\n    *zOut++ = (u8)(c&0x00FF);                                       \\\n    *zOut++ = (u8)((c>>8)&0x00FF);                                  \\\n  }else{                                                            \\\n    *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \\\n    *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));              \\\n    *zOut++ = (u8)(c&0x00FF);                                       \\\n    *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));                         \\\n  }                                                                 \\\n}\n\n#define WRITE_UTF16BE(zOut, c) {                                    \\\n  if( c<=0xFFFF ){                                                  \\\n    *zOut++ = (u8)((c>>8)&0x00FF);                                  \\\n    *zOut++ = (u8)(c&0x00FF);                                       \\\n  }else{                                                            \\\n    *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03));              \\\n    *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \\\n    *zOut++ = (u8)(0x00DC + ((c>>8)&0x03));                         \\\n    *zOut++ = (u8)(c&0x00FF);                                       \\\n  }                                                                 \\\n}\n\n#define READ_UTF16LE(zIn, TERM, c){                                   \\\n  c = (*zIn++);                                                       \\\n  c += ((*zIn++)<<8);                                                 \\\n  if( c>=0xD800 && c<0xE000 && TERM ){                                \\\n    int c2 = (*zIn++);                                                \\\n    c2 += ((*zIn++)<<8);                                              \\\n    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \\\n  }                                                                   \\\n}\n\n#define READ_UTF16BE(zIn, TERM, c){                                   \\\n  c = ((*zIn++)<<8);                                                  \\\n  c += (*zIn++);                                                      \\\n  if( c>=0xD800 && c<0xE000 && TERM ){                                \\\n    int c2 = ((*zIn++)<<8);                                           \\\n    c2 += (*zIn++);                                                   \\\n    c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10);   \\\n  }                                                                   \\\n}\n\n/*\n** Translate a single UTF-8 character.  Return the unicode value.\n**\n** During translation, assume that the byte that zTerm points\n** is a 0x00.\n**\n** Write a pointer to the next unread byte back into *pzNext.\n**\n** Notes On Invalid UTF-8:\n**\n**  *  This routine never allows a 7-bit character (0x00 through 0x7f) to\n**     be encoded as a multi-byte character.  Any multi-byte character that\n**     attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd.\n**\n**  *  This routine never allows a UTF16 surrogate value to be encoded.\n**     If a multi-byte character attempts to encode a value between\n**     0xd800 and 0xe000 then it is rendered as 0xfffd.\n**\n**  *  Bytes in the range of 0x80 through 0xbf which occur as the first\n**     byte of a character are interpreted as single-byte characters\n**     and rendered as themselves even though they are technically\n**     invalid characters.\n**\n**  *  This routine accepts over-length UTF8 encodings\n**     for unicode values 0x80 and greater.  It does not change over-length\n**     encodings to 0xfffd as some systems recommend.\n*/\n#define READ_UTF8(zIn, zTerm, c)                           \\\n  c = *(zIn++);                                            \\\n  if( c>=0xc0 ){                                           \\\n    c = sqlite3Utf8Trans1[c-0xc0];                         \\\n    while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){            \\\n      c = (c<<6) + (0x3f & *(zIn++));                      \\\n    }                                                      \\\n    if( c<0x80                                             \\\n        || (c&0xFFFFF800)==0xD800                          \\\n        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }        \\\n  }\nu32 sqlite3Utf8Read(\n  const unsigned char **pz    /* Pointer to string from which to read char */\n){\n  unsigned int c;\n\n  /* Same as READ_UTF8() above but without the zTerm parameter.\n  ** For this routine, we assume the UTF8 string is always zero-terminated.\n  */\n  c = *((*pz)++);\n  if( c>=0xc0 ){\n    c = sqlite3Utf8Trans1[c-0xc0];\n    while( (*(*pz) & 0xc0)==0x80 ){\n      c = (c<<6) + (0x3f & *((*pz)++));\n    }\n    if( c<0x80\n        || (c&0xFFFFF800)==0xD800\n        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }\n  }\n  return c;\n}\n\n\n\n\n/*\n** If the TRANSLATE_TRACE macro is defined, the value of each Mem is\n** printed on stderr on the way into and out of sqlite3VdbeMemTranslate().\n*/ \n/* #define TRANSLATE_TRACE 1 */\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** This routine transforms the internal text encoding used by pMem to\n** desiredEnc. It is an error if the string is already of the desired\n** encoding, or if *pMem does not contain a string value.\n*/\nSQLITE_NOINLINE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){\n  int len;                    /* Maximum length of output string in bytes */\n  unsigned char *zOut;                  /* Output buffer */\n  unsigned char *zIn;                   /* Input iterator */\n  unsigned char *zTerm;                 /* End of input */\n  unsigned char *z;                     /* Output iterator */\n  unsigned int c;\n\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( pMem->flags&MEM_Str );\n  assert( pMem->enc!=desiredEnc );\n  assert( pMem->enc!=0 );\n  assert( pMem->n>=0 );\n\n#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)\n  {\n    char zBuf[100];\n    sqlite3VdbeMemPrettyPrint(pMem, zBuf);\n    fprintf(stderr, \"INPUT:  %s\\n\", zBuf);\n  }\n#endif\n\n  /* If the translation is between UTF-16 little and big endian, then \n  ** all that is required is to swap the byte order. This case is handled\n  ** differently from the others.\n  */\n  if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){\n    u8 temp;\n    int rc;\n    rc = sqlite3VdbeMemMakeWriteable(pMem);\n    if( rc!=SQLITE_OK ){\n      assert( rc==SQLITE_NOMEM );\n      return SQLITE_NOMEM_BKPT;\n    }\n    zIn = (u8*)pMem->z;\n    zTerm = &zIn[pMem->n&~1];\n    while( zIn<zTerm ){\n      temp = *zIn;\n      *zIn = *(zIn+1);\n      zIn++;\n      *zIn++ = temp;\n    }\n    pMem->enc = desiredEnc;\n    goto translate_out;\n  }\n\n  /* Set len to the maximum number of bytes required in the output buffer. */\n  if( desiredEnc==SQLITE_UTF8 ){\n    /* When converting from UTF-16, the maximum growth results from\n    ** translating a 2-byte character to a 4-byte UTF-8 character.\n    ** A single byte is required for the output string\n    ** nul-terminator.\n    */\n    pMem->n &= ~1;\n    len = pMem->n * 2 + 1;\n  }else{\n    /* When converting from UTF-8 to UTF-16 the maximum growth is caused\n    ** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16\n    ** character. Two bytes are required in the output buffer for the\n    ** nul-terminator.\n    */\n    len = pMem->n * 2 + 2;\n  }\n\n  /* Set zIn to point at the start of the input buffer and zTerm to point 1\n  ** byte past the end.\n  **\n  ** Variable zOut is set to point at the output buffer, space obtained\n  ** from sqlite3_malloc().\n  */\n  zIn = (u8*)pMem->z;\n  zTerm = &zIn[pMem->n];\n  zOut = sqlite3DbMallocRaw(pMem->db, len);\n  if( !zOut ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  z = zOut;\n\n  if( pMem->enc==SQLITE_UTF8 ){\n    if( desiredEnc==SQLITE_UTF16LE ){\n      /* UTF-8 -> UTF-16 Little-endian */\n      while( zIn<zTerm ){\n        READ_UTF8(zIn, zTerm, c);\n        WRITE_UTF16LE(z, c);\n      }\n    }else{\n      assert( desiredEnc==SQLITE_UTF16BE );\n      /* UTF-8 -> UTF-16 Big-endian */\n      while( zIn<zTerm ){\n        READ_UTF8(zIn, zTerm, c);\n        WRITE_UTF16BE(z, c);\n      }\n    }\n    pMem->n = (int)(z - zOut);\n    *z++ = 0;\n  }else{\n    assert( desiredEnc==SQLITE_UTF8 );\n    if( pMem->enc==SQLITE_UTF16LE ){\n      /* UTF-16 Little-endian -> UTF-8 */\n      while( zIn<zTerm ){\n        READ_UTF16LE(zIn, zIn<zTerm, c); \n        WRITE_UTF8(z, c);\n      }\n    }else{\n      /* UTF-16 Big-endian -> UTF-8 */\n      while( zIn<zTerm ){\n        READ_UTF16BE(zIn, zIn<zTerm, c); \n        WRITE_UTF8(z, c);\n      }\n    }\n    pMem->n = (int)(z - zOut);\n  }\n  *z = 0;\n  assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );\n\n  c = pMem->flags;\n  sqlite3VdbeMemRelease(pMem);\n  pMem->flags = MEM_Str|MEM_Term|(c&(MEM_AffMask|MEM_Subtype));\n  pMem->enc = desiredEnc;\n  pMem->z = (char*)zOut;\n  pMem->zMalloc = pMem->z;\n  pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->z);\n\ntranslate_out:\n#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)\n  {\n    char zBuf[100];\n    sqlite3VdbeMemPrettyPrint(pMem, zBuf);\n    fprintf(stderr, \"OUTPUT: %s\\n\", zBuf);\n  }\n#endif\n  return SQLITE_OK;\n}\n\n/*\n** This routine checks for a byte-order mark at the beginning of the \n** UTF-16 string stored in *pMem. If one is present, it is removed and\n** the encoding of the Mem adjusted. This routine does not do any\n** byte-swapping, it just sets Mem.enc appropriately.\n**\n** The allocation (static, dynamic etc.) and encoding of the Mem may be\n** changed by this function.\n*/\nint sqlite3VdbeMemHandleBom(Mem *pMem){\n  int rc = SQLITE_OK;\n  u8 bom = 0;\n\n  assert( pMem->n>=0 );\n  if( pMem->n>1 ){\n    u8 b1 = *(u8 *)pMem->z;\n    u8 b2 = *(((u8 *)pMem->z) + 1);\n    if( b1==0xFE && b2==0xFF ){\n      bom = SQLITE_UTF16BE;\n    }\n    if( b1==0xFF && b2==0xFE ){\n      bom = SQLITE_UTF16LE;\n    }\n  }\n  \n  if( bom ){\n    rc = sqlite3VdbeMemMakeWriteable(pMem);\n    if( rc==SQLITE_OK ){\n      pMem->n -= 2;\n      memmove(pMem->z, &pMem->z[2], pMem->n);\n      pMem->z[pMem->n] = '\\0';\n      pMem->z[pMem->n+1] = '\\0';\n      pMem->flags |= MEM_Term;\n      pMem->enc = bom;\n    }\n  }\n  return rc;\n}\n#endif /* SQLITE_OMIT_UTF16 */\n\n/*\n** pZ is a UTF-8 encoded unicode string. If nByte is less than zero,\n** return the number of unicode characters in pZ up to (but not including)\n** the first 0x00 byte. If nByte is not less than zero, return the\n** number of unicode characters in the first nByte of pZ (or up to \n** the first 0x00, whichever comes first).\n*/\nint sqlite3Utf8CharLen(const char *zIn, int nByte){\n  int r = 0;\n  const u8 *z = (const u8*)zIn;\n  const u8 *zTerm;\n  if( nByte>=0 ){\n    zTerm = &z[nByte];\n  }else{\n    zTerm = (const u8*)(-1);\n  }\n  assert( z<=zTerm );\n  while( *z!=0 && z<zTerm ){\n    SQLITE_SKIP_UTF8(z);\n    r++;\n  }\n  return r;\n}\n\n/* This test function is not currently used by the automated test-suite. \n** Hence it is only available in debug builds.\n*/\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\n/*\n** Translate UTF-8 to UTF-8.\n**\n** This has the effect of making sure that the string is well-formed\n** UTF-8.  Miscoded characters are removed.\n**\n** The translation is done in-place and aborted if the output\n** overruns the input.\n*/\nint sqlite3Utf8To8(unsigned char *zIn){\n  unsigned char *zOut = zIn;\n  unsigned char *zStart = zIn;\n  u32 c;\n\n  while( zIn[0] && zOut<=zIn ){\n    c = sqlite3Utf8Read((const u8**)&zIn);\n    if( c!=0xfffd ){\n      WRITE_UTF8(zOut, c);\n    }\n  }\n  *zOut = 0;\n  return (int)(zOut - zStart);\n}\n#endif\n\n#ifndef SQLITE_OMIT_UTF16\n/*\n** Convert a UTF-16 string in the native encoding into a UTF-8 string.\n** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must\n** be freed by the calling function.\n**\n** NULL is returned if there is an allocation error.\n*/\nchar *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){\n  Mem m;\n  memset(&m, 0, sizeof(m));\n  m.db = db;\n  sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);\n  sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);\n  if( db->mallocFailed ){\n    sqlite3VdbeMemRelease(&m);\n    m.z = 0;\n  }\n  assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );\n  assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );\n  assert( m.z || db->mallocFailed );\n  return m.z;\n}\n\n/*\n** zIn is a UTF-16 encoded unicode string at least nChar characters long.\n** Return the number of bytes in the first nChar unicode characters\n** in pZ.  nChar must be non-negative.\n*/\nint sqlite3Utf16ByteLen(const void *zIn, int nChar){\n  int c;\n  unsigned char const *z = zIn;\n  int n = 0;\n  \n  if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){\n    while( n<nChar ){\n      READ_UTF16BE(z, 1, c);\n      n++;\n    }\n  }else{\n    while( n<nChar ){\n      READ_UTF16LE(z, 1, c);\n      n++;\n    }\n  }\n  return (int)(z-(unsigned char const *)zIn);\n}\n\n#if defined(SQLITE_TEST)\n/*\n** This routine is called from the TCL test function \"translate_selftest\".\n** It checks that the primitives for serializing and deserializing\n** characters in each encoding are inverses of each other.\n*/\nvoid sqlite3UtfSelfTest(void){\n  unsigned int i, t;\n  unsigned char zBuf[20];\n  unsigned char *z;\n  int n;\n  unsigned int c;\n\n  for(i=0; i<0x00110000; i++){\n    z = zBuf;\n    WRITE_UTF8(z, i);\n    n = (int)(z-zBuf);\n    assert( n>0 && n<=4 );\n    z[0] = 0;\n    z = zBuf;\n    c = sqlite3Utf8Read((const u8**)&z);\n    t = i;\n    if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD;\n    if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD;\n    assert( c==t );\n    assert( (z-zBuf)==n );\n  }\n  for(i=0; i<0x00110000; i++){\n    if( i>=0xD800 && i<0xE000 ) continue;\n    z = zBuf;\n    WRITE_UTF16LE(z, i);\n    n = (int)(z-zBuf);\n    assert( n>0 && n<=4 );\n    z[0] = 0;\n    z = zBuf;\n    READ_UTF16LE(z, 1, c);\n    assert( c==i );\n    assert( (z-zBuf)==n );\n  }\n  for(i=0; i<0x00110000; i++){\n    if( i>=0xD800 && i<0xE000 ) continue;\n    z = zBuf;\n    WRITE_UTF16BE(z, i);\n    n = (int)(z-zBuf);\n    assert( n>0 && n<=4 );\n    z[0] = 0;\n    z = zBuf;\n    READ_UTF16BE(z, 1, c);\n    assert( c==i );\n    assert( (z-zBuf)==n );\n  }\n}\n#endif /* SQLITE_TEST */\n#endif /* SQLITE_OMIT_UTF16 */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/util.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Utility functions used throughout sqlite.\n**\n** This file contains functions for allocating memory, comparing\n** strings, and stuff like that.\n**\n*/\n#include \"sqliteInt.h\"\n#include <stdarg.h>\n#if HAVE_ISNAN || SQLITE_HAVE_ISNAN\n# include <math.h>\n#endif\n\n/*\n** Routine needed to support the testcase() macro.\n*/\n#ifdef SQLITE_COVERAGE_TEST\nvoid sqlite3Coverage(int x){\n  static unsigned dummy = 0;\n  dummy += (unsigned)x;\n}\n#endif\n\n/*\n** Give a callback to the test harness that can be used to simulate faults\n** in places where it is difficult or expensive to do so purely by means\n** of inputs.\n**\n** The intent of the integer argument is to let the fault simulator know\n** which of multiple sqlite3FaultSim() calls has been hit.\n**\n** Return whatever integer value the test callback returns, or return\n** SQLITE_OK if no test callback is installed.\n*/\n#ifndef SQLITE_OMIT_BUILTIN_TEST\nint sqlite3FaultSim(int iTest){\n  int (*xCallback)(int) = sqlite3GlobalConfig.xTestCallback;\n  return xCallback ? xCallback(iTest) : SQLITE_OK;\n}\n#endif\n\n#ifndef SQLITE_OMIT_FLOATING_POINT\n/*\n** Return true if the floating point value is Not a Number (NaN).\n**\n** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN.\n** Otherwise, we have our own implementation that works on most systems.\n*/\nint sqlite3IsNaN(double x){\n  int rc;   /* The value return */\n#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN\n  /*\n  ** Systems that support the isnan() library function should probably\n  ** make use of it by compiling with -DSQLITE_HAVE_ISNAN.  But we have\n  ** found that many systems do not have a working isnan() function so\n  ** this implementation is provided as an alternative.\n  **\n  ** This NaN test sometimes fails if compiled on GCC with -ffast-math.\n  ** On the other hand, the use of -ffast-math comes with the following\n  ** warning:\n  **\n  **      This option [-ffast-math] should never be turned on by any\n  **      -O option since it can result in incorrect output for programs\n  **      which depend on an exact implementation of IEEE or ISO \n  **      rules/specifications for math functions.\n  **\n  ** Under MSVC, this NaN test may fail if compiled with a floating-\n  ** point precision mode other than /fp:precise.  From the MSDN \n  ** documentation:\n  **\n  **      The compiler [with /fp:precise] will properly handle comparisons \n  **      involving NaN. For example, x != x evaluates to true if x is NaN \n  **      ...\n  */\n#ifdef __FAST_MATH__\n# error SQLite will not work correctly with the -ffast-math option of GCC.\n#endif\n  volatile double y = x;\n  volatile double z = y;\n  rc = (y!=z);\n#else  /* if HAVE_ISNAN */\n  rc = isnan(x);\n#endif /* HAVE_ISNAN */\n  testcase( rc );\n  return rc;\n}\n#endif /* SQLITE_OMIT_FLOATING_POINT */\n\n/*\n** Compute a string length that is limited to what can be stored in\n** lower 30 bits of a 32-bit signed integer.\n**\n** The value returned will never be negative.  Nor will it ever be greater\n** than the actual length of the string.  For very long strings (greater\n** than 1GiB) the value returned might be less than the true string length.\n*/\nint sqlite3Strlen30(const char *z){\n  if( z==0 ) return 0;\n  return 0x3fffffff & (int)strlen(z);\n}\n\n/*\n** Return the declared type of a column.  Or return zDflt if the column \n** has no declared type.\n**\n** The column type is an extra string stored after the zero-terminator on\n** the column name if and only if the COLFLAG_HASTYPE flag is set.\n*/\nchar *sqlite3ColumnType(Column *pCol, char *zDflt){\n  if( (pCol->colFlags & COLFLAG_HASTYPE)==0 ) return zDflt;\n  return pCol->zName + strlen(pCol->zName) + 1;\n}\n\n/*\n** Helper function for sqlite3Error() - called rarely.  Broken out into\n** a separate routine to avoid unnecessary register saves on entry to\n** sqlite3Error().\n*/\nstatic SQLITE_NOINLINE void  sqlite3ErrorFinish(sqlite3 *db, int err_code){\n  if( db->pErr ) sqlite3ValueSetNull(db->pErr);\n  sqlite3SystemError(db, err_code);\n}\n\n/*\n** Set the current error code to err_code and clear any prior error message.\n** Also set iSysErrno (by calling sqlite3System) if the err_code indicates\n** that would be appropriate.\n*/\nvoid sqlite3Error(sqlite3 *db, int err_code){\n  assert( db!=0 );\n  db->errCode = err_code;\n  if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);\n}\n\n/*\n** Load the sqlite3.iSysErrno field if that is an appropriate thing\n** to do based on the SQLite error code in rc.\n*/\nvoid sqlite3SystemError(sqlite3 *db, int rc){\n  if( rc==SQLITE_IOERR_NOMEM ) return;\n  rc &= 0xff;\n  if( rc==SQLITE_CANTOPEN || rc==SQLITE_IOERR ){\n    db->iSysErrno = sqlite3OsGetLastError(db->pVfs);\n  }\n}\n\n/*\n** Set the most recent error code and error string for the sqlite\n** handle \"db\". The error code is set to \"err_code\".\n**\n** If it is not NULL, string zFormat specifies the format of the\n** error string in the style of the printf functions: The following\n** format characters are allowed:\n**\n**      %s      Insert a string\n**      %z      A string that should be freed after use\n**      %d      Insert an integer\n**      %T      Insert a token\n**      %S      Insert the first element of a SrcList\n**\n** zFormat and any string tokens that follow it are assumed to be\n** encoded in UTF-8.\n**\n** To clear the most recent error for sqlite handle \"db\", sqlite3Error\n** should be called with err_code set to SQLITE_OK and zFormat set\n** to NULL.\n*/\nvoid sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *zFormat, ...){\n  assert( db!=0 );\n  db->errCode = err_code;\n  sqlite3SystemError(db, err_code);\n  if( zFormat==0 ){\n    sqlite3Error(db, err_code);\n  }else if( db->pErr || (db->pErr = sqlite3ValueNew(db))!=0 ){\n    char *z;\n    va_list ap;\n    va_start(ap, zFormat);\n    z = sqlite3VMPrintf(db, zFormat, ap);\n    va_end(ap);\n    sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC);\n  }\n}\n\n/*\n** Add an error message to pParse->zErrMsg and increment pParse->nErr.\n** The following formatting characters are allowed:\n**\n**      %s      Insert a string\n**      %z      A string that should be freed after use\n**      %d      Insert an integer\n**      %T      Insert a token\n**      %S      Insert the first element of a SrcList\n**\n** This function should be used to report any error that occurs while\n** compiling an SQL statement (i.e. within sqlite3_prepare()). The\n** last thing the sqlite3_prepare() function does is copy the error\n** stored by this function into the database handle using sqlite3Error().\n** Functions sqlite3Error() or sqlite3ErrorWithMsg() should be used\n** during statement execution (sqlite3_step() etc.).\n*/\nvoid sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){\n  char *zMsg;\n  va_list ap;\n  sqlite3 *db = pParse->db;\n  va_start(ap, zFormat);\n  zMsg = sqlite3VMPrintf(db, zFormat, ap);\n  va_end(ap);\n  if( db->suppressErr ){\n    sqlite3DbFree(db, zMsg);\n  }else{\n    pParse->nErr++;\n    sqlite3DbFree(db, pParse->zErrMsg);\n    pParse->zErrMsg = zMsg;\n    pParse->rc = SQLITE_ERROR;\n  }\n}\n\n/*\n** Convert an SQL-style quoted string into a normal string by removing\n** the quote characters.  The conversion is done in-place.  If the\n** input does not begin with a quote character, then this routine\n** is a no-op.\n**\n** The input string must be zero-terminated.  A new zero-terminator\n** is added to the dequoted string.\n**\n** The return value is -1 if no dequoting occurs or the length of the\n** dequoted string, exclusive of the zero terminator, if dequoting does\n** occur.\n**\n** 2002-Feb-14: This routine is extended to remove MS-Access style\n** brackets from around identifiers.  For example:  \"[a-b-c]\" becomes\n** \"a-b-c\".\n*/\nvoid sqlite3Dequote(char *z){\n  char quote;\n  int i, j;\n  if( z==0 ) return;\n  quote = z[0];\n  if( !sqlite3Isquote(quote) ) return;\n  if( quote=='[' ) quote = ']';\n  for(i=1, j=0;; i++){\n    assert( z[i] );\n    if( z[i]==quote ){\n      if( z[i+1]==quote ){\n        z[j++] = quote;\n        i++;\n      }else{\n        break;\n      }\n    }else{\n      z[j++] = z[i];\n    }\n  }\n  z[j] = 0;\n}\n\n/*\n** Generate a Token object from a string\n*/\nvoid sqlite3TokenInit(Token *p, char *z){\n  p->z = z;\n  p->n = sqlite3Strlen30(z);\n}\n\n/* Convenient short-hand */\n#define UpperToLower sqlite3UpperToLower\n\n/*\n** Some systems have stricmp().  Others have strcasecmp().  Because\n** there is no consistency, we will define our own.\n**\n** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and\n** sqlite3_strnicmp() APIs allow applications and extensions to compare\n** the contents of two buffers containing UTF-8 strings in a\n** case-independent fashion, using the same definition of \"case\n** independence\" that SQLite uses internally when comparing identifiers.\n*/\nint sqlite3_stricmp(const char *zLeft, const char *zRight){\n  if( zLeft==0 ){\n    return zRight ? -1 : 0;\n  }else if( zRight==0 ){\n    return 1;\n  }\n  return sqlite3StrICmp(zLeft, zRight);\n}\nint sqlite3StrICmp(const char *zLeft, const char *zRight){\n  unsigned char *a, *b;\n  int c;\n  a = (unsigned char *)zLeft;\n  b = (unsigned char *)zRight;\n  for(;;){\n    c = (int)UpperToLower[*a] - (int)UpperToLower[*b];\n    if( c || *a==0 ) break;\n    a++;\n    b++;\n  }\n  return c;\n}\nint sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){\n  register unsigned char *a, *b;\n  if( zLeft==0 ){\n    return zRight ? -1 : 0;\n  }else if( zRight==0 ){\n    return 1;\n  }\n  a = (unsigned char *)zLeft;\n  b = (unsigned char *)zRight;\n  while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }\n  return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];\n}\n\n/*\n** The string z[] is an text representation of a real number.\n** Convert this string to a double and write it into *pResult.\n**\n** The string z[] is length bytes in length (bytes, not characters) and\n** uses the encoding enc.  The string is not necessarily zero-terminated.\n**\n** Return TRUE if the result is a valid real number (or integer) and FALSE\n** if the string is empty or contains extraneous text.  Valid numbers\n** are in one of these formats:\n**\n**    [+-]digits[E[+-]digits]\n**    [+-]digits.[digits][E[+-]digits]\n**    [+-].digits[E[+-]digits]\n**\n** Leading and trailing whitespace is ignored for the purpose of determining\n** validity.\n**\n** If some prefix of the input string is a valid number, this routine\n** returns FALSE but it still converts the prefix and writes the result\n** into *pResult.\n*/\nint sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){\n#ifndef SQLITE_OMIT_FLOATING_POINT\n  int incr;\n  const char *zEnd = z + length;\n  /* sign * significand * (10 ^ (esign * exponent)) */\n  int sign = 1;    /* sign of significand */\n  i64 s = 0;       /* significand */\n  int d = 0;       /* adjust exponent for shifting decimal point */\n  int esign = 1;   /* sign of exponent */\n  int e = 0;       /* exponent */\n  int eValid = 1;  /* True exponent is either not used or is well-formed */\n  double result;\n  int nDigits = 0;\n  int nonNum = 0;  /* True if input contains UTF16 with high byte non-zero */\n\n  assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );\n  *pResult = 0.0;   /* Default return value, in case of an error */\n\n  if( enc==SQLITE_UTF8 ){\n    incr = 1;\n  }else{\n    int i;\n    incr = 2;\n    assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );\n    for(i=3-enc; i<length && z[i]==0; i+=2){}\n    nonNum = i<length;\n    zEnd = &z[i^1];\n    z += (enc&1);\n  }\n\n  /* skip leading spaces */\n  while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;\n  if( z>=zEnd ) return 0;\n\n  /* get sign of significand */\n  if( *z=='-' ){\n    sign = -1;\n    z+=incr;\n  }else if( *z=='+' ){\n    z+=incr;\n  }\n\n  /* copy max significant digits to significand */\n  while( z<zEnd && sqlite3Isdigit(*z) && s<((LARGEST_INT64-9)/10) ){\n    s = s*10 + (*z - '0');\n    z+=incr, nDigits++;\n  }\n\n  /* skip non-significant significand digits\n  ** (increase exponent by d to shift decimal left) */\n  while( z<zEnd && sqlite3Isdigit(*z) ) z+=incr, nDigits++, d++;\n  if( z>=zEnd ) goto do_atof_calc;\n\n  /* if decimal point is present */\n  if( *z=='.' ){\n    z+=incr;\n    /* copy digits from after decimal to significand\n    ** (decrease exponent by d to shift decimal right) */\n    while( z<zEnd && sqlite3Isdigit(*z) ){\n      if( s<((LARGEST_INT64-9)/10) ){\n        s = s*10 + (*z - '0');\n        d--;\n      }\n      z+=incr, nDigits++;\n    }\n  }\n  if( z>=zEnd ) goto do_atof_calc;\n\n  /* if exponent is present */\n  if( *z=='e' || *z=='E' ){\n    z+=incr;\n    eValid = 0;\n\n    /* This branch is needed to avoid a (harmless) buffer overread.  The \n    ** special comment alerts the mutation tester that the correct answer\n    ** is obtained even if the branch is omitted */\n    if( z>=zEnd ) goto do_atof_calc;              /*PREVENTS-HARMLESS-OVERREAD*/\n\n    /* get sign of exponent */\n    if( *z=='-' ){\n      esign = -1;\n      z+=incr;\n    }else if( *z=='+' ){\n      z+=incr;\n    }\n    /* copy digits to exponent */\n    while( z<zEnd && sqlite3Isdigit(*z) ){\n      e = e<10000 ? (e*10 + (*z - '0')) : 10000;\n      z+=incr;\n      eValid = 1;\n    }\n  }\n\n  /* skip trailing spaces */\n  while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;\n\ndo_atof_calc:\n  /* adjust exponent by d, and update sign */\n  e = (e*esign) + d;\n  if( e<0 ) {\n    esign = -1;\n    e *= -1;\n  } else {\n    esign = 1;\n  }\n\n  if( s==0 ) {\n    /* In the IEEE 754 standard, zero is signed. */\n    result = sign<0 ? -(double)0 : (double)0;\n  } else {\n    /* Attempt to reduce exponent.\n    **\n    ** Branches that are not required for the correct answer but which only\n    ** help to obtain the correct answer faster are marked with special\n    ** comments, as a hint to the mutation tester.\n    */\n    while( e>0 ){                                       /*OPTIMIZATION-IF-TRUE*/\n      if( esign>0 ){\n        if( s>=(LARGEST_INT64/10) ) break;             /*OPTIMIZATION-IF-FALSE*/\n        s *= 10;\n      }else{\n        if( s%10!=0 ) break;                           /*OPTIMIZATION-IF-FALSE*/\n        s /= 10;\n      }\n      e--;\n    }\n\n    /* adjust the sign of significand */\n    s = sign<0 ? -s : s;\n\n    if( e==0 ){                                         /*OPTIMIZATION-IF-TRUE*/\n      result = (double)s;\n    }else{\n      LONGDOUBLE_TYPE scale = 1.0;\n      /* attempt to handle extremely small/large numbers better */\n      if( e>307 ){                                      /*OPTIMIZATION-IF-TRUE*/\n        if( e<342 ){                                    /*OPTIMIZATION-IF-TRUE*/\n          while( e%308 ) { scale *= 1.0e+1; e -= 1; }\n          if( esign<0 ){\n            result = s / scale;\n            result /= 1.0e+308;\n          }else{\n            result = s * scale;\n            result *= 1.0e+308;\n          }\n        }else{ assert( e>=342 );\n          if( esign<0 ){\n            result = 0.0*s;\n          }else{\n            result = 1e308*1e308*s;  /* Infinity */\n          }\n        }\n      }else{\n        /* 1.0e+22 is the largest power of 10 than can be \n        ** represented exactly. */\n        while( e%22 ) { scale *= 1.0e+1; e -= 1; }\n        while( e>0 ) { scale *= 1.0e+22; e -= 22; }\n        if( esign<0 ){\n          result = s / scale;\n        }else{\n          result = s * scale;\n        }\n      }\n    }\n  }\n\n  /* store the result */\n  *pResult = result;\n\n  /* return true if number and no extra non-whitespace chracters after */\n  return z==zEnd && nDigits>0 && eValid && nonNum==0;\n#else\n  return !sqlite3Atoi64(z, pResult, length, enc);\n#endif /* SQLITE_OMIT_FLOATING_POINT */\n}\n\n/*\n** Compare the 19-character string zNum against the text representation\n** value 2^63:  9223372036854775808.  Return negative, zero, or positive\n** if zNum is less than, equal to, or greater than the string.\n** Note that zNum must contain exactly 19 characters.\n**\n** Unlike memcmp() this routine is guaranteed to return the difference\n** in the values of the last digit if the only difference is in the\n** last digit.  So, for example,\n**\n**      compare2pow63(\"9223372036854775800\", 1)\n**\n** will return -8.\n*/\nstatic int compare2pow63(const char *zNum, int incr){\n  int c = 0;\n  int i;\n                    /* 012345678901234567 */\n  const char *pow63 = \"922337203685477580\";\n  for(i=0; c==0 && i<18; i++){\n    c = (zNum[i*incr]-pow63[i])*10;\n  }\n  if( c==0 ){\n    c = zNum[18*incr] - '8';\n    testcase( c==(-1) );\n    testcase( c==0 );\n    testcase( c==(+1) );\n  }\n  return c;\n}\n\n/*\n** Convert zNum to a 64-bit signed integer.  zNum must be decimal. This\n** routine does *not* accept hexadecimal notation.\n**\n** If the zNum value is representable as a 64-bit twos-complement \n** integer, then write that value into *pNum and return 0.\n**\n** If zNum is exactly 9223372036854775808, return 2.  This special\n** case is broken out because while 9223372036854775808 cannot be a \n** signed 64-bit integer, its negative -9223372036854775808 can be.\n**\n** If zNum is too big for a 64-bit integer and is not\n** 9223372036854775808  or if zNum contains any non-numeric text,\n** then return 1.\n**\n** length is the number of bytes in the string (bytes, not characters).\n** The string is not necessarily zero-terminated.  The encoding is\n** given by enc.\n*/\nint sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){\n  int incr;\n  u64 u = 0;\n  int neg = 0; /* assume positive */\n  int i;\n  int c = 0;\n  int nonNum = 0;  /* True if input contains UTF16 with high byte non-zero */\n  const char *zStart;\n  const char *zEnd = zNum + length;\n  assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );\n  if( enc==SQLITE_UTF8 ){\n    incr = 1;\n  }else{\n    incr = 2;\n    assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );\n    for(i=3-enc; i<length && zNum[i]==0; i+=2){}\n    nonNum = i<length;\n    zEnd = &zNum[i^1];\n    zNum += (enc&1);\n  }\n  while( zNum<zEnd && sqlite3Isspace(*zNum) ) zNum+=incr;\n  if( zNum<zEnd ){\n    if( *zNum=='-' ){\n      neg = 1;\n      zNum+=incr;\n    }else if( *zNum=='+' ){\n      zNum+=incr;\n    }\n  }\n  zStart = zNum;\n  while( zNum<zEnd && zNum[0]=='0' ){ zNum+=incr; } /* Skip leading zeros. */\n  for(i=0; &zNum[i]<zEnd && (c=zNum[i])>='0' && c<='9'; i+=incr){\n    u = u*10 + c - '0';\n  }\n  if( u>LARGEST_INT64 ){\n    *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;\n  }else if( neg ){\n    *pNum = -(i64)u;\n  }else{\n    *pNum = (i64)u;\n  }\n  testcase( i==18 );\n  testcase( i==19 );\n  testcase( i==20 );\n  if( &zNum[i]<zEnd              /* Extra bytes at the end */\n   || (i==0 && zStart==zNum)     /* No digits */\n   || i>19*incr                  /* Too many digits */\n   || nonNum                     /* UTF16 with high-order bytes non-zero */\n  ){\n    /* zNum is empty or contains non-numeric text or is longer\n    ** than 19 digits (thus guaranteeing that it is too large) */\n    return 1;\n  }else if( i<19*incr ){\n    /* Less than 19 digits, so we know that it fits in 64 bits */\n    assert( u<=LARGEST_INT64 );\n    return 0;\n  }else{\n    /* zNum is a 19-digit numbers.  Compare it against 9223372036854775808. */\n    c = compare2pow63(zNum, incr);\n    if( c<0 ){\n      /* zNum is less than 9223372036854775808 so it fits */\n      assert( u<=LARGEST_INT64 );\n      return 0;\n    }else if( c>0 ){\n      /* zNum is greater than 9223372036854775808 so it overflows */\n      return 1;\n    }else{\n      /* zNum is exactly 9223372036854775808.  Fits if negative.  The\n      ** special case 2 overflow if positive */\n      assert( u-1==LARGEST_INT64 );\n      return neg ? 0 : 2;\n    }\n  }\n}\n\n/*\n** Transform a UTF-8 integer literal, in either decimal or hexadecimal,\n** into a 64-bit signed integer.  This routine accepts hexadecimal literals,\n** whereas sqlite3Atoi64() does not.\n**\n** Returns:\n**\n**     0    Successful transformation.  Fits in a 64-bit signed integer.\n**     1    Integer too large for a 64-bit signed integer or is malformed\n**     2    Special case of 9223372036854775808\n*/\nint sqlite3DecOrHexToI64(const char *z, i64 *pOut){\n#ifndef SQLITE_OMIT_HEX_INTEGER\n  if( z[0]=='0'\n   && (z[1]=='x' || z[1]=='X')\n  ){\n    u64 u = 0;\n    int i, k;\n    for(i=2; z[i]=='0'; i++){}\n    for(k=i; sqlite3Isxdigit(z[k]); k++){\n      u = u*16 + sqlite3HexToInt(z[k]);\n    }\n    memcpy(pOut, &u, 8);\n    return (z[k]==0 && k-i<=16) ? 0 : 1;\n  }else\n#endif /* SQLITE_OMIT_HEX_INTEGER */\n  {\n    return sqlite3Atoi64(z, pOut, sqlite3Strlen30(z), SQLITE_UTF8);\n  }\n}\n\n/*\n** If zNum represents an integer that will fit in 32-bits, then set\n** *pValue to that integer and return true.  Otherwise return false.\n**\n** This routine accepts both decimal and hexadecimal notation for integers.\n**\n** Any non-numeric characters that following zNum are ignored.\n** This is different from sqlite3Atoi64() which requires the\n** input number to be zero-terminated.\n*/\nint sqlite3GetInt32(const char *zNum, int *pValue){\n  sqlite_int64 v = 0;\n  int i, c;\n  int neg = 0;\n  if( zNum[0]=='-' ){\n    neg = 1;\n    zNum++;\n  }else if( zNum[0]=='+' ){\n    zNum++;\n  }\n#ifndef SQLITE_OMIT_HEX_INTEGER\n  else if( zNum[0]=='0'\n        && (zNum[1]=='x' || zNum[1]=='X')\n        && sqlite3Isxdigit(zNum[2])\n  ){\n    u32 u = 0;\n    zNum += 2;\n    while( zNum[0]=='0' ) zNum++;\n    for(i=0; sqlite3Isxdigit(zNum[i]) && i<8; i++){\n      u = u*16 + sqlite3HexToInt(zNum[i]);\n    }\n    if( (u&0x80000000)==0 && sqlite3Isxdigit(zNum[i])==0 ){\n      memcpy(pValue, &u, 4);\n      return 1;\n    }else{\n      return 0;\n    }\n  }\n#endif\n  while( zNum[0]=='0' ) zNum++;\n  for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){\n    v = v*10 + c;\n  }\n\n  /* The longest decimal representation of a 32 bit integer is 10 digits:\n  **\n  **             1234567890\n  **     2^31 -> 2147483648\n  */\n  testcase( i==10 );\n  if( i>10 ){\n    return 0;\n  }\n  testcase( v-neg==2147483647 );\n  if( v-neg>2147483647 ){\n    return 0;\n  }\n  if( neg ){\n    v = -v;\n  }\n  *pValue = (int)v;\n  return 1;\n}\n\n/*\n** Return a 32-bit integer value extracted from a string.  If the\n** string is not an integer, just return 0.\n*/\nint sqlite3Atoi(const char *z){\n  int x = 0;\n  if( z ) sqlite3GetInt32(z, &x);\n  return x;\n}\n\n/*\n** The variable-length integer encoding is as follows:\n**\n** KEY:\n**         A = 0xxxxxxx    7 bits of data and one flag bit\n**         B = 1xxxxxxx    7 bits of data and one flag bit\n**         C = xxxxxxxx    8 bits of data\n**\n**  7 bits - A\n** 14 bits - BA\n** 21 bits - BBA\n** 28 bits - BBBA\n** 35 bits - BBBBA\n** 42 bits - BBBBBA\n** 49 bits - BBBBBBA\n** 56 bits - BBBBBBBA\n** 64 bits - BBBBBBBBC\n*/\n\n/*\n** Write a 64-bit variable-length integer to memory starting at p[0].\n** The length of data write will be between 1 and 9 bytes.  The number\n** of bytes written is returned.\n**\n** A variable-length integer consists of the lower 7 bits of each byte\n** for all bytes that have the 8th bit set and one byte with the 8th\n** bit clear.  Except, if we get to the 9th byte, it stores the full\n** 8 bits and is the last byte.\n*/\nstatic int SQLITE_NOINLINE putVarint64(unsigned char *p, u64 v){\n  int i, j, n;\n  u8 buf[10];\n  if( v & (((u64)0xff000000)<<32) ){\n    p[8] = (u8)v;\n    v >>= 8;\n    for(i=7; i>=0; i--){\n      p[i] = (u8)((v & 0x7f) | 0x80);\n      v >>= 7;\n    }\n    return 9;\n  }    \n  n = 0;\n  do{\n    buf[n++] = (u8)((v & 0x7f) | 0x80);\n    v >>= 7;\n  }while( v!=0 );\n  buf[0] &= 0x7f;\n  assert( n<=9 );\n  for(i=0, j=n-1; j>=0; j--, i++){\n    p[i] = buf[j];\n  }\n  return n;\n}\nint sqlite3PutVarint(unsigned char *p, u64 v){\n  if( v<=0x7f ){\n    p[0] = v&0x7f;\n    return 1;\n  }\n  if( v<=0x3fff ){\n    p[0] = ((v>>7)&0x7f)|0x80;\n    p[1] = v&0x7f;\n    return 2;\n  }\n  return putVarint64(p,v);\n}\n\n/*\n** Bitmasks used by sqlite3GetVarint().  These precomputed constants\n** are defined here rather than simply putting the constant expressions\n** inline in order to work around bugs in the RVT compiler.\n**\n** SLOT_2_0     A mask for  (0x7f<<14) | 0x7f\n**\n** SLOT_4_2_0   A mask for  (0x7f<<28) | SLOT_2_0\n*/\n#define SLOT_2_0     0x001fc07f\n#define SLOT_4_2_0   0xf01fc07f\n\n\n/*\n** Read a 64-bit variable-length integer from memory starting at p[0].\n** Return the number of bytes read.  The value is stored in *v.\n*/\nu8 sqlite3GetVarint(const unsigned char *p, u64 *v){\n  u32 a,b,s;\n\n  a = *p;\n  /* a: p0 (unmasked) */\n  if (!(a&0x80))\n  {\n    *v = a;\n    return 1;\n  }\n\n  p++;\n  b = *p;\n  /* b: p1 (unmasked) */\n  if (!(b&0x80))\n  {\n    a &= 0x7f;\n    a = a<<7;\n    a |= b;\n    *v = a;\n    return 2;\n  }\n\n  /* Verify that constants are precomputed correctly */\n  assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );\n  assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );\n\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p0<<14 | p2 (unmasked) */\n  if (!(a&0x80))\n  {\n    a &= SLOT_2_0;\n    b &= 0x7f;\n    b = b<<7;\n    a |= b;\n    *v = a;\n    return 3;\n  }\n\n  /* CSE1 from below */\n  a &= SLOT_2_0;\n  p++;\n  b = b<<14;\n  b |= *p;\n  /* b: p1<<14 | p3 (unmasked) */\n  if (!(b&0x80))\n  {\n    b &= SLOT_2_0;\n    /* moved CSE1 up */\n    /* a &= (0x7f<<14)|(0x7f); */\n    a = a<<7;\n    a |= b;\n    *v = a;\n    return 4;\n  }\n\n  /* a: p0<<14 | p2 (masked) */\n  /* b: p1<<14 | p3 (unmasked) */\n  /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\n  /* moved CSE1 up */\n  /* a &= (0x7f<<14)|(0x7f); */\n  b &= SLOT_2_0;\n  s = a;\n  /* s: p0<<14 | p2 (masked) */\n\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p0<<28 | p2<<14 | p4 (unmasked) */\n  if (!(a&0x80))\n  {\n    /* we can skip these cause they were (effectively) done above\n    ** while calculating s */\n    /* a &= (0x7f<<28)|(0x7f<<14)|(0x7f); */\n    /* b &= (0x7f<<14)|(0x7f); */\n    b = b<<7;\n    a |= b;\n    s = s>>18;\n    *v = ((u64)s)<<32 | a;\n    return 5;\n  }\n\n  /* 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\n  s = s<<7;\n  s |= b;\n  /* s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) */\n\n  p++;\n  b = b<<14;\n  b |= *p;\n  /* b: p1<<28 | p3<<14 | p5 (unmasked) */\n  if (!(b&0x80))\n  {\n    /* we can skip this cause it was (effectively) done above in calc'ing s */\n    /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */\n    a &= SLOT_2_0;\n    a = a<<7;\n    a |= b;\n    s = s>>18;\n    *v = ((u64)s)<<32 | a;\n    return 6;\n  }\n\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p2<<28 | p4<<14 | p6 (unmasked) */\n  if (!(a&0x80))\n  {\n    a &= SLOT_4_2_0;\n    b &= SLOT_2_0;\n    b = b<<7;\n    a |= b;\n    s = s>>11;\n    *v = ((u64)s)<<32 | a;\n    return 7;\n  }\n\n  /* CSE2 from below */\n  a &= SLOT_2_0;\n  p++;\n  b = b<<14;\n  b |= *p;\n  /* b: p3<<28 | p5<<14 | p7 (unmasked) */\n  if (!(b&0x80))\n  {\n    b &= SLOT_4_2_0;\n    /* moved CSE2 up */\n    /* a &= (0x7f<<14)|(0x7f); */\n    a = a<<7;\n    a |= b;\n    s = s>>4;\n    *v = ((u64)s)<<32 | a;\n    return 8;\n  }\n\n  p++;\n  a = a<<15;\n  a |= *p;\n  /* a: p4<<29 | p6<<15 | p8 (unmasked) */\n\n  /* moved CSE2 up */\n  /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */\n  b &= SLOT_2_0;\n  b = b<<8;\n  a |= b;\n\n  s = s<<4;\n  b = p[-4];\n  b &= 0x7f;\n  b = b>>3;\n  s |= b;\n\n  *v = ((u64)s)<<32 | a;\n\n  return 9;\n}\n\n/*\n** Read a 32-bit variable-length integer from memory starting at p[0].\n** Return the number of bytes read.  The value is stored in *v.\n**\n** If the varint stored in p[0] is larger than can fit in a 32-bit unsigned\n** integer, then set *v to 0xffffffff.\n**\n** A MACRO version, getVarint32, is provided which inlines the \n** single-byte case.  All code should use the MACRO version as \n** this function assumes the single-byte case has already been handled.\n*/\nu8 sqlite3GetVarint32(const unsigned char *p, u32 *v){\n  u32 a,b;\n\n  /* The 1-byte case.  Overwhelmingly the most common.  Handled inline\n  ** by the getVarin32() macro */\n  a = *p;\n  /* a: p0 (unmasked) */\n#ifndef getVarint32\n  if (!(a&0x80))\n  {\n    /* Values between 0 and 127 */\n    *v = a;\n    return 1;\n  }\n#endif\n\n  /* The 2-byte case */\n  p++;\n  b = *p;\n  /* b: p1 (unmasked) */\n  if (!(b&0x80))\n  {\n    /* Values between 128 and 16383 */\n    a &= 0x7f;\n    a = a<<7;\n    *v = a | b;\n    return 2;\n  }\n\n  /* The 3-byte case */\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p0<<14 | p2 (unmasked) */\n  if (!(a&0x80))\n  {\n    /* Values between 16384 and 2097151 */\n    a &= (0x7f<<14)|(0x7f);\n    b &= 0x7f;\n    b = b<<7;\n    *v = a | b;\n    return 3;\n  }\n\n  /* A 32-bit varint is used to store size information in btrees.\n  ** Objects are rarely larger than 2MiB limit of a 3-byte varint.\n  ** A 3-byte varint is sufficient, for example, to record the size\n  ** of a 1048569-byte BLOB or string.\n  **\n  ** We only unroll the first 1-, 2-, and 3- byte cases.  The very\n  ** rare larger cases can be handled by the slower 64-bit varint\n  ** routine.\n  */\n#if 1\n  {\n    u64 v64;\n    u8 n;\n\n    p -= 2;\n    n = sqlite3GetVarint(p, &v64);\n    assert( n>3 && n<=9 );\n    if( (v64 & SQLITE_MAX_U32)!=v64 ){\n      *v = 0xffffffff;\n    }else{\n      *v = (u32)v64;\n    }\n    return n;\n  }\n\n#else\n  /* For following code (kept for historical record only) shows an\n  ** unrolling for the 3- and 4-byte varint cases.  This code is\n  ** slightly faster, but it is also larger and much harder to test.\n  */\n  p++;\n  b = b<<14;\n  b |= *p;\n  /* b: p1<<14 | p3 (unmasked) */\n  if (!(b&0x80))\n  {\n    /* Values between 2097152 and 268435455 */\n    b &= (0x7f<<14)|(0x7f);\n    a &= (0x7f<<14)|(0x7f);\n    a = a<<7;\n    *v = a | b;\n    return 4;\n  }\n\n  p++;\n  a = a<<14;\n  a |= *p;\n  /* a: p0<<28 | p2<<14 | p4 (unmasked) */\n  if (!(a&0x80))\n  {\n    /* Values  between 268435456 and 34359738367 */\n    a &= SLOT_4_2_0;\n    b &= SLOT_4_2_0;\n    b = b<<7;\n    *v = a | b;\n    return 5;\n  }\n\n  /* We can only reach this point when reading a corrupt database\n  ** file.  In that case we are not in any hurry.  Use the (relatively\n  ** slow) general-purpose sqlite3GetVarint() routine to extract the\n  ** value. */\n  {\n    u64 v64;\n    u8 n;\n\n    p -= 4;\n    n = sqlite3GetVarint(p, &v64);\n    assert( n>5 && n<=9 );\n    *v = (u32)v64;\n    return n;\n  }\n#endif\n}\n\n/*\n** Return the number of bytes that will be needed to store the given\n** 64-bit integer.\n*/\nint sqlite3VarintLen(u64 v){\n  int i;\n  for(i=1; (v >>= 7)!=0; i++){ assert( i<10 ); }\n  return i;\n}\n\n\n/*\n** Read or write a four-byte big-endian integer value.\n*/\nu32 sqlite3Get4byte(const u8 *p){\n#if SQLITE_BYTEORDER==4321\n  u32 x;\n  memcpy(&x,p,4);\n  return x;\n#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \\\n    && defined(__GNUC__) && GCC_VERSION>=4003000\n  u32 x;\n  memcpy(&x,p,4);\n  return __builtin_bswap32(x);\n#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \\\n    && defined(_MSC_VER) && _MSC_VER>=1300\n  u32 x;\n  memcpy(&x,p,4);\n  return _byteswap_ulong(x);\n#else\n  testcase( p[0]&0x80 );\n  return ((unsigned)p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];\n#endif\n}\nvoid sqlite3Put4byte(unsigned char *p, u32 v){\n#if SQLITE_BYTEORDER==4321\n  memcpy(p,&v,4);\n#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \\\n    && defined(__GNUC__) && GCC_VERSION>=4003000\n  u32 x = __builtin_bswap32(v);\n  memcpy(p,&x,4);\n#elif SQLITE_BYTEORDER==1234 && !defined(SQLITE_DISABLE_INTRINSIC) \\\n    && defined(_MSC_VER) && _MSC_VER>=1300\n  u32 x = _byteswap_ulong(v);\n  memcpy(p,&x,4);\n#else\n  p[0] = (u8)(v>>24);\n  p[1] = (u8)(v>>16);\n  p[2] = (u8)(v>>8);\n  p[3] = (u8)v;\n#endif\n}\n\n\n\n/*\n** Translate a single byte of Hex into an integer.\n** This routine only works if h really is a valid hexadecimal\n** character:  0..9a..fA..F\n*/\nu8 sqlite3HexToInt(int h){\n  assert( (h>='0' && h<='9') ||  (h>='a' && h<='f') ||  (h>='A' && h<='F') );\n#ifdef SQLITE_ASCII\n  h += 9*(1&(h>>6));\n#endif\n#ifdef SQLITE_EBCDIC\n  h += 9*(1&~(h>>4));\n#endif\n  return (u8)(h & 0xf);\n}\n\n#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)\n/*\n** Convert a BLOB literal of the form \"x'hhhhhh'\" into its binary\n** value.  Return a pointer to its binary value.  Space to hold the\n** binary value has been obtained from malloc and must be freed by\n** the calling routine.\n*/\nvoid *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){\n  char *zBlob;\n  int i;\n\n  zBlob = (char *)sqlite3DbMallocRawNN(db, n/2 + 1);\n  n--;\n  if( zBlob ){\n    for(i=0; i<n; i+=2){\n      zBlob[i/2] = (sqlite3HexToInt(z[i])<<4) | sqlite3HexToInt(z[i+1]);\n    }\n    zBlob[i/2] = 0;\n  }\n  return zBlob;\n}\n#endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC */\n\n/*\n** Log an error that is an API call on a connection pointer that should\n** not have been used.  The \"type\" of connection pointer is given as the\n** argument.  The zType is a word like \"NULL\" or \"closed\" or \"invalid\".\n*/\nstatic void logBadConnection(const char *zType){\n  sqlite3_log(SQLITE_MISUSE, \n     \"API call with %s database connection pointer\",\n     zType\n  );\n}\n\n/*\n** Check to make sure we have a valid db pointer.  This test is not\n** foolproof but it does provide some measure of protection against\n** misuse of the interface such as passing in db pointers that are\n** NULL or which have been previously closed.  If this routine returns\n** 1 it means that the db pointer is valid and 0 if it should not be\n** dereferenced for any reason.  The calling function should invoke\n** SQLITE_MISUSE immediately.\n**\n** sqlite3SafetyCheckOk() requires that the db pointer be valid for\n** use.  sqlite3SafetyCheckSickOrOk() allows a db pointer that failed to\n** open properly and is not fit for general use but which can be\n** used as an argument to sqlite3_errmsg() or sqlite3_close().\n*/\nint sqlite3SafetyCheckOk(sqlite3 *db){\n  u32 magic;\n  if( db==0 ){\n    logBadConnection(\"NULL\");\n    return 0;\n  }\n  magic = db->magic;\n  if( magic!=SQLITE_MAGIC_OPEN ){\n    if( sqlite3SafetyCheckSickOrOk(db) ){\n      testcase( sqlite3GlobalConfig.xLog!=0 );\n      logBadConnection(\"unopened\");\n    }\n    return 0;\n  }else{\n    return 1;\n  }\n}\nint sqlite3SafetyCheckSickOrOk(sqlite3 *db){\n  u32 magic;\n  magic = db->magic;\n  if( magic!=SQLITE_MAGIC_SICK &&\n      magic!=SQLITE_MAGIC_OPEN &&\n      magic!=SQLITE_MAGIC_BUSY ){\n    testcase( sqlite3GlobalConfig.xLog!=0 );\n    logBadConnection(\"invalid\");\n    return 0;\n  }else{\n    return 1;\n  }\n}\n\n/*\n** Attempt to add, substract, or multiply the 64-bit signed value iB against\n** the other 64-bit signed integer at *pA and store the result in *pA.\n** Return 0 on success.  Or if the operation would have resulted in an\n** overflow, leave *pA unchanged and return 1.\n*/\nint sqlite3AddInt64(i64 *pA, i64 iB){\n  i64 iA = *pA;\n  testcase( iA==0 ); testcase( iA==1 );\n  testcase( iB==-1 ); testcase( iB==0 );\n  if( iB>=0 ){\n    testcase( iA>0 && LARGEST_INT64 - iA == iB );\n    testcase( iA>0 && LARGEST_INT64 - iA == iB - 1 );\n    if( iA>0 && LARGEST_INT64 - iA < iB ) return 1;\n  }else{\n    testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 );\n    testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 );\n    if( iA<0 && -(iA + LARGEST_INT64) > iB + 1 ) return 1;\n  }\n  *pA += iB;\n  return 0; \n}\nint sqlite3SubInt64(i64 *pA, i64 iB){\n  testcase( iB==SMALLEST_INT64+1 );\n  if( iB==SMALLEST_INT64 ){\n    testcase( (*pA)==(-1) ); testcase( (*pA)==0 );\n    if( (*pA)>=0 ) return 1;\n    *pA -= iB;\n    return 0;\n  }else{\n    return sqlite3AddInt64(pA, -iB);\n  }\n}\nint sqlite3MulInt64(i64 *pA, i64 iB){\n  i64 iA = *pA;\n  if( iB>0 ){\n    if( iA>LARGEST_INT64/iB ) return 1;\n    if( iA<SMALLEST_INT64/iB ) return 1;\n  }else if( iB<0 ){\n    if( iA>0 ){\n      if( iB<SMALLEST_INT64/iA ) return 1;\n    }else if( iA<0 ){\n      if( iB==SMALLEST_INT64 ) return 1;\n      if( iA==SMALLEST_INT64 ) return 1;\n      if( -iA>LARGEST_INT64/-iB ) return 1;\n    }\n  }\n  *pA = iA*iB;\n  return 0;\n}\n\n/*\n** Compute the absolute value of a 32-bit signed integer, of possible.  Or \n** if the integer has a value of -2147483648, return +2147483647\n*/\nint sqlite3AbsInt32(int x){\n  if( x>=0 ) return x;\n  if( x==(int)0x80000000 ) return 0x7fffffff;\n  return -x;\n}\n\n#ifdef SQLITE_ENABLE_8_3_NAMES\n/*\n** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database\n** filename in zBaseFilename is a URI with the \"8_3_names=1\" parameter and\n** if filename in z[] has a suffix (a.k.a. \"extension\") that is longer than\n** three characters, then shorten the suffix on z[] to be the last three\n** characters of the original suffix.\n**\n** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always\n** do the suffix shortening regardless of URI parameter.\n**\n** Examples:\n**\n**     test.db-journal    =>   test.nal\n**     test.db-wal        =>   test.wal\n**     test.db-shm        =>   test.shm\n**     test.db-mj7f3319fa =>   test.9fa\n*/\nvoid sqlite3FileSuffix3(const char *zBaseFilename, char *z){\n#if SQLITE_ENABLE_8_3_NAMES<2\n  if( sqlite3_uri_boolean(zBaseFilename, \"8_3_names\", 0) )\n#endif\n  {\n    int i, sz;\n    sz = sqlite3Strlen30(z);\n    for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){}\n    if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4);\n  }\n}\n#endif\n\n/* \n** Find (an approximate) sum of two LogEst values.  This computation is\n** not a simple \"+\" operator because LogEst is stored as a logarithmic\n** value.\n** \n*/\nLogEst sqlite3LogEstAdd(LogEst a, LogEst b){\n  static const unsigned char x[] = {\n     10, 10,                         /* 0,1 */\n      9, 9,                          /* 2,3 */\n      8, 8,                          /* 4,5 */\n      7, 7, 7,                       /* 6,7,8 */\n      6, 6, 6,                       /* 9,10,11 */\n      5, 5, 5,                       /* 12-14 */\n      4, 4, 4, 4,                    /* 15-18 */\n      3, 3, 3, 3, 3, 3,              /* 19-24 */\n      2, 2, 2, 2, 2, 2, 2,           /* 25-31 */\n  };\n  if( a>=b ){\n    if( a>b+49 ) return a;\n    if( a>b+31 ) return a+1;\n    return a+x[a-b];\n  }else{\n    if( b>a+49 ) return b;\n    if( b>a+31 ) return b+1;\n    return b+x[b-a];\n  }\n}\n\n/*\n** Convert an integer into a LogEst.  In other words, compute an\n** approximation for 10*log2(x).\n*/\nLogEst sqlite3LogEst(u64 x){\n  static LogEst a[] = { 0, 2, 3, 5, 6, 7, 8, 9 };\n  LogEst y = 40;\n  if( x<8 ){\n    if( x<2 ) return 0;\n    while( x<8 ){  y -= 10; x <<= 1; }\n  }else{\n    while( x>255 ){ y += 40; x >>= 4; }  /*OPTIMIZATION-IF-TRUE*/\n    while( x>15 ){  y += 10; x >>= 1; }\n  }\n  return a[x&7] + y - 10;\n}\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/*\n** Convert a double into a LogEst\n** In other words, compute an approximation for 10*log2(x).\n*/\nLogEst sqlite3LogEstFromDouble(double x){\n  u64 a;\n  LogEst e;\n  assert( sizeof(x)==8 && sizeof(a)==8 );\n  if( x<=1 ) return 0;\n  if( x<=2000000000 ) return sqlite3LogEst((u64)x);\n  memcpy(&a, &x, 8);\n  e = (a>>52) - 1022;\n  return e*10;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \\\n    defined(SQLITE_ENABLE_STAT3_OR_STAT4) || \\\n    defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)\n/*\n** Convert a LogEst into an integer.\n**\n** Note that this routine is only used when one or more of various\n** non-standard compile-time options is enabled.\n*/\nu64 sqlite3LogEstToInt(LogEst x){\n  u64 n;\n  n = x%10;\n  x /= 10;\n  if( n>=5 ) n -= 2;\n  else if( n>=1 ) n -= 1;\n#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \\\n    defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)\n  if( x>60 ) return (u64)LARGEST_INT64;\n#else\n  /* If only SQLITE_ENABLE_STAT3_OR_STAT4 is on, then the largest input\n  ** possible to this routine is 310, resulting in a maximum x of 31 */\n  assert( x<=60 );\n#endif\n  return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x);\n}\n#endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vacuum.c",
    "content": "/*\n** 2003 April 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used to implement the VACUUM command.\n**\n** Most of the code in this file may be omitted by defining the\n** SQLITE_OMIT_VACUUM macro.\n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)\n\n/*\n** Execute zSql on database db.\n**\n** If zSql returns rows, then each row will have exactly one\n** column.  (This will only happen if zSql begins with \"SELECT\".)\n** Take each row of result and call execSql() again recursively.\n**\n** The execSqlF() routine does the same thing, except it accepts\n** a format string as its third argument\n*/\nstatic int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){\n  sqlite3_stmt *pStmt;\n  int rc;\n\n  /* printf(\"SQL: [%s]\\n\", zSql); fflush(stdout); */\n  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);\n  if( rc!=SQLITE_OK ) return rc;\n  while( SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){\n    const char *zSubSql = (const char*)sqlite3_column_text(pStmt,0);\n    assert( sqlite3_strnicmp(zSql,\"SELECT\",6)==0 );\n    if( zSubSql ){\n      assert( zSubSql[0]!='S' );\n      rc = execSql(db, pzErrMsg, zSubSql);\n      if( rc!=SQLITE_OK ) break;\n    }\n  }\n  assert( rc!=SQLITE_ROW );\n  if( rc==SQLITE_DONE ) rc = SQLITE_OK;\n  if( rc ){\n    sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db));\n  }\n  (void)sqlite3_finalize(pStmt);\n  return rc;\n}\nstatic int execSqlF(sqlite3 *db, char **pzErrMsg, const char *zSql, ...){\n  char *z;\n  va_list ap;\n  int rc;\n  va_start(ap, zSql);\n  z = sqlite3VMPrintf(db, zSql, ap);\n  va_end(ap);\n  if( z==0 ) return SQLITE_NOMEM;\n  rc = execSql(db, pzErrMsg, z);\n  sqlite3DbFree(db, z);\n  return rc;\n}\n\n/*\n** The VACUUM command is used to clean up the database,\n** collapse free space, etc.  It is modelled after the VACUUM command\n** in PostgreSQL.  The VACUUM command works as follows:\n**\n**   (1)  Create a new transient database file\n**   (2)  Copy all content from the database being vacuumed into\n**        the new transient database file\n**   (3)  Copy content from the transient database back into the\n**        original database.\n**\n** The transient database requires temporary disk space approximately\n** equal to the size of the original database.  The copy operation of\n** step (3) requires additional temporary disk space approximately equal\n** to the size of the original database for the rollback journal.\n** Hence, temporary disk space that is approximately 2x the size of the\n** original database is required.  Every page of the database is written\n** approximately 3 times:  Once for step (2) and twice for step (3).\n** Two writes per page are required in step (3) because the original\n** database content must be written into the rollback journal prior to\n** overwriting the database with the vacuumed content.\n**\n** Only 1x temporary space and only 1x writes would be required if\n** the copy of step (3) were replaced by deleting the original database\n** and renaming the transient database as the original.  But that will\n** not work if other processes are attached to the original database.\n** And a power loss in between deleting the original and renaming the\n** transient would cause the database file to appear to be deleted\n** following reboot.\n*/\nvoid sqlite3Vacuum(Parse *pParse, Token *pNm){\n  Vdbe *v = sqlite3GetVdbe(pParse);\n  int iDb = pNm ? sqlite3TwoPartName(pParse, pNm, pNm, &pNm) : 0;\n  if( v && (iDb>=2 || iDb==0) ){\n    sqlite3VdbeAddOp1(v, OP_Vacuum, iDb);\n    sqlite3VdbeUsesBtree(v, iDb);\n  }\n  return;\n}\n\n/*\n** This routine implements the OP_Vacuum opcode of the VDBE.\n*/\nint sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db, int iDb){\n  int rc = SQLITE_OK;     /* Return code from service routines */\n  Btree *pMain;           /* The database being vacuumed */\n  Btree *pTemp;           /* The temporary database we vacuum into */\n  int saved_flags;        /* Saved value of the db->flags */\n  int saved_nChange;      /* Saved value of db->nChange */\n  int saved_nTotalChange; /* Saved value of db->nTotalChange */\n  u8 saved_mTrace;        /* Saved trace settings */\n  Db *pDb = 0;            /* Database to detach at end of vacuum */\n  int isMemDb;            /* True if vacuuming a :memory: database */\n  int nRes;               /* Bytes of reserved space at the end of each page */\n  int nDb;                /* Number of attached databases */\n  const char *zDbMain;    /* Schema name of database to vacuum */\n\n  if( !db->autoCommit ){\n    sqlite3SetString(pzErrMsg, db, \"cannot VACUUM from within a transaction\");\n    return SQLITE_ERROR;\n  }\n  if( db->nVdbeActive>1 ){\n    sqlite3SetString(pzErrMsg, db,\"cannot VACUUM - SQL statements in progress\");\n    return SQLITE_ERROR;\n  }\n\n  /* Save the current value of the database flags so that it can be \n  ** restored before returning. Then set the writable-schema flag, and\n  ** disable CHECK and foreign key constraints.  */\n  saved_flags = db->flags;\n  saved_nChange = db->nChange;\n  saved_nTotalChange = db->nTotalChange;\n  saved_mTrace = db->mTrace;\n  db->flags |= (SQLITE_WriteSchema | SQLITE_IgnoreChecks\n                 | SQLITE_PreferBuiltin | SQLITE_Vacuum);\n  db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder | SQLITE_CountRows);\n  db->mTrace = 0;\n\n  zDbMain = db->aDb[iDb].zDbSName;\n  pMain = db->aDb[iDb].pBt;\n  isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain));\n\n  /* Attach the temporary database as 'vacuum_db'. The synchronous pragma\n  ** can be set to 'off' for this file, as it is not recovered if a crash\n  ** occurs anyway. The integrity of the database is maintained by a\n  ** (possibly synchronous) transaction opened on the main database before\n  ** sqlite3BtreeCopyFile() is called.\n  **\n  ** An optimisation would be to use a non-journaled pager.\n  ** (Later:) I tried setting \"PRAGMA vacuum_db.journal_mode=OFF\" but\n  ** that actually made the VACUUM run slower.  Very little journalling\n  ** actually occurs when doing a vacuum since the vacuum_db is initially\n  ** empty.  Only the journal header is written.  Apparently it takes more\n  ** time to parse and run the PRAGMA to turn journalling off than it does\n  ** to write the journal header file.\n  */\n  nDb = db->nDb;\n  rc = execSql(db, pzErrMsg, \"ATTACH''AS vacuum_db\");\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\n  assert( (db->nDb-1)==nDb );\n  pDb = &db->aDb[nDb];\n  assert( strcmp(pDb->zDbSName,\"vacuum_db\")==0 );\n  pTemp = pDb->pBt;\n\n  /* The call to execSql() to attach the temp database has left the file\n  ** locked (as there was more than one active statement when the transaction\n  ** to read the schema was concluded. Unlock it here so that this doesn't\n  ** cause problems for the call to BtreeSetPageSize() below.  */\n  sqlite3BtreeCommit(pTemp);\n\n  nRes = sqlite3BtreeGetOptimalReserve(pMain);\n\n  /* A VACUUM cannot change the pagesize of an encrypted database. */\n#ifdef SQLITE_HAS_CODEC\n  if( db->nextPagesize ){\n    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);\n    int nKey;\n    char *zKey;\n    sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);\n    if( nKey ) db->nextPagesize = 0;\n  }\n#endif\n\n  sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);\n  sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));\n  sqlite3BtreeSetPagerFlags(pTemp, PAGER_SYNCHRONOUS_OFF|PAGER_CACHESPILL);\n\n  /* Begin a transaction and take an exclusive lock on the main database\n  ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below,\n  ** to ensure that we do not try to change the page-size on a WAL database.\n  */\n  rc = execSql(db, pzErrMsg, \"BEGIN\");\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\n  rc = sqlite3BtreeBeginTrans(pMain, 2);\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\n\n  /* Do not attempt to change the page size for a WAL database */\n  if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))\n                                               ==PAGER_JOURNALMODE_WAL ){\n    db->nextPagesize = 0;\n  }\n\n  if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0)\n   || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))\n   || NEVER(db->mallocFailed)\n  ){\n    rc = SQLITE_NOMEM_BKPT;\n    goto end_of_vacuum;\n  }\n\n#ifndef SQLITE_OMIT_AUTOVACUUM\n  sqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac :\n                                           sqlite3BtreeGetAutoVacuum(pMain));\n#endif\n\n  /* Query the schema of the main database. Create a mirror schema\n  ** in the temporary database.\n  */\n  db->init.iDb = nDb; /* force new CREATE statements into vacuum_db */\n  rc = execSqlF(db, pzErrMsg,\n      \"SELECT sql FROM \\\"%w\\\".sqlite_master\"\n      \" WHERE type='table'AND name<>'sqlite_sequence'\"\n      \" AND coalesce(rootpage,1)>0\",\n      zDbMain\n  );\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\n  rc = execSqlF(db, pzErrMsg,\n      \"SELECT sql FROM \\\"%w\\\".sqlite_master\"\n      \" WHERE type='index' AND length(sql)>10\",\n      zDbMain\n  );\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\n  db->init.iDb = 0;\n\n  /* Loop through the tables in the main database. For each, do\n  ** an \"INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;\" to copy\n  ** the contents to the temporary database.\n  */\n  rc = execSqlF(db, pzErrMsg,\n      \"SELECT'INSERT INTO vacuum_db.'||quote(name)\"\n      \"||' SELECT*FROM\\\"%w\\\".'||quote(name)\"\n      \"FROM vacuum_db.sqlite_master \"\n      \"WHERE type='table'AND coalesce(rootpage,1)>0\",\n      zDbMain\n  );\n  assert( (db->flags & SQLITE_Vacuum)!=0 );\n  db->flags &= ~SQLITE_Vacuum;\n  if( rc!=SQLITE_OK ) goto end_of_vacuum;\n\n  /* Copy the triggers, views, and virtual tables from the main database\n  ** over to the temporary database.  None of these objects has any\n  ** associated storage, so all we have to do is copy their entries\n  ** from the SQLITE_MASTER table.\n  */\n  rc = execSqlF(db, pzErrMsg,\n      \"INSERT INTO vacuum_db.sqlite_master\"\n      \" SELECT*FROM \\\"%w\\\".sqlite_master\"\n      \" WHERE type IN('view','trigger')\"\n      \" OR(type='table'AND rootpage=0)\",\n      zDbMain\n  );\n  if( rc ) goto end_of_vacuum;\n\n  /* At this point, there is a write transaction open on both the \n  ** vacuum database and the main database. Assuming no error occurs,\n  ** both transactions are closed by this block - the main database\n  ** transaction by sqlite3BtreeCopyFile() and the other by an explicit\n  ** call to sqlite3BtreeCommit().\n  */\n  {\n    u32 meta;\n    int i;\n\n    /* This array determines which meta meta values are preserved in the\n    ** vacuum.  Even entries are the meta value number and odd entries\n    ** are an increment to apply to the meta value after the vacuum.\n    ** The increment is used to increase the schema cookie so that other\n    ** connections to the same database will know to reread the schema.\n    */\n    static const unsigned char aCopy[] = {\n       BTREE_SCHEMA_VERSION,     1,  /* Add one to the old schema cookie */\n       BTREE_DEFAULT_CACHE_SIZE, 0,  /* Preserve the default page cache size */\n       BTREE_TEXT_ENCODING,      0,  /* Preserve the text encoding */\n       BTREE_USER_VERSION,       0,  /* Preserve the user version */\n       BTREE_APPLICATION_ID,     0,  /* Preserve the application id */\n    };\n\n    assert( 1==sqlite3BtreeIsInTrans(pTemp) );\n    assert( 1==sqlite3BtreeIsInTrans(pMain) );\n\n    /* Copy Btree meta values */\n    for(i=0; i<ArraySize(aCopy); i+=2){\n      /* GetMeta() and UpdateMeta() cannot fail in this context because\n      ** we already have page 1 loaded into cache and marked dirty. */\n      sqlite3BtreeGetMeta(pMain, aCopy[i], &meta);\n      rc = sqlite3BtreeUpdateMeta(pTemp, aCopy[i], meta+aCopy[i+1]);\n      if( NEVER(rc!=SQLITE_OK) ) goto end_of_vacuum;\n    }\n\n    rc = sqlite3BtreeCopyFile(pMain, pTemp);\n    if( rc!=SQLITE_OK ) goto end_of_vacuum;\n    rc = sqlite3BtreeCommit(pTemp);\n    if( rc!=SQLITE_OK ) goto end_of_vacuum;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    sqlite3BtreeSetAutoVacuum(pMain, sqlite3BtreeGetAutoVacuum(pTemp));\n#endif\n  }\n\n  assert( rc==SQLITE_OK );\n  rc = sqlite3BtreeSetPageSize(pMain, sqlite3BtreeGetPageSize(pTemp), nRes,1);\n\nend_of_vacuum:\n  /* Restore the original value of db->flags */\n  db->init.iDb = 0;\n  db->flags = saved_flags;\n  db->nChange = saved_nChange;\n  db->nTotalChange = saved_nTotalChange;\n  db->mTrace = saved_mTrace;\n  sqlite3BtreeSetPageSize(pMain, -1, -1, 1);\n\n  /* Currently there is an SQL level transaction open on the vacuum\n  ** database. No locks are held on any other files (since the main file\n  ** was committed at the btree level). So it safe to end the transaction\n  ** by manually setting the autoCommit flag to true and detaching the\n  ** vacuum database. The vacuum_db journal file is deleted when the pager\n  ** is closed by the DETACH.\n  */\n  db->autoCommit = 1;\n\n  if( pDb ){\n    sqlite3BtreeClose(pDb->pBt);\n    pDb->pBt = 0;\n    pDb->pSchema = 0;\n  }\n\n  /* This both clears the schemas and reduces the size of the db->aDb[]\n  ** array. */ \n  sqlite3ResetAllSchemasOfConnection(db);\n\n  return rc;\n}\n\n#endif  /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbe.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** The code in this file implements the function that runs the\n** bytecode of a prepared statement.\n**\n** Various scripts scan this source file in order to generate HTML\n** documentation, headers files, or other derived files.  The formatting\n** of the code in this file is, therefore, important.  See other comments\n** in this file for details.  If in doubt, do not deviate from existing\n** commenting and indentation practices when changing or adding code.\n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n/*\n** Invoke this macro on memory cells just prior to changing the\n** value of the cell.  This macro verifies that shallow copies are\n** not misused.  A shallow copy of a string or blob just copies a\n** pointer to the string or blob, not the content.  If the original\n** is changed while the copy is still in use, the string or blob might\n** be changed out from under the copy.  This macro verifies that nothing\n** like that ever happens.\n*/\n#ifdef SQLITE_DEBUG\n# define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M)\n#else\n# define memAboutToChange(P,M)\n#endif\n\n/*\n** The following global variable is incremented every time a cursor\n** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes.  The test\n** procedures use this information to make sure that indices are\n** working correctly.  This variable has no function other than to\n** help verify the correct operation of the library.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_search_count = 0;\n#endif\n\n/*\n** When this global variable is positive, it gets decremented once before\n** each instruction in the VDBE.  When it reaches zero, the u1.isInterrupted\n** field of the sqlite3 structure is set in order to simulate an interrupt.\n**\n** This facility is used for testing purposes only.  It does not function\n** in an ordinary build.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_interrupt_count = 0;\n#endif\n\n/*\n** The next global variable is incremented each type the OP_Sort opcode\n** is executed.  The test procedures use this information to make sure that\n** sorting is occurring or not occurring at appropriate times.   This variable\n** has no function other than to help verify the correct operation of the\n** library.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_sort_count = 0;\n#endif\n\n/*\n** The next global variable records the size of the largest MEM_Blob\n** or MEM_Str that has been used by a VDBE opcode.  The test procedures\n** use this information to make sure that the zero-blob functionality\n** is working correctly.   This variable has no function other than to\n** help verify the correct operation of the library.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_max_blobsize = 0;\nstatic void updateMaxBlobsize(Mem *p){\n  if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>sqlite3_max_blobsize ){\n    sqlite3_max_blobsize = p->n;\n  }\n}\n#endif\n\n/*\n** This macro evaluates to true if either the update hook or the preupdate\n** hook are enabled for database connect DB.\n*/\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n# define HAS_UPDATE_HOOK(DB) ((DB)->xPreUpdateCallback||(DB)->xUpdateCallback)\n#else\n# define HAS_UPDATE_HOOK(DB) ((DB)->xUpdateCallback)\n#endif\n\n/*\n** The next global variable is incremented each time the OP_Found opcode\n** is executed. This is used to test whether or not the foreign key\n** operation implemented using OP_FkIsZero is working. This variable\n** has no function other than to help verify the correct operation of the\n** library.\n*/\n#ifdef SQLITE_TEST\nint sqlite3_found_count = 0;\n#endif\n\n/*\n** Test a register to see if it exceeds the current maximum blob size.\n** If it does, record the new maximum blob size.\n*/\n#if defined(SQLITE_TEST) && !defined(SQLITE_OMIT_BUILTIN_TEST)\n# define UPDATE_MAX_BLOBSIZE(P)  updateMaxBlobsize(P)\n#else\n# define UPDATE_MAX_BLOBSIZE(P)\n#endif\n\n/*\n** Invoke the VDBE coverage callback, if that callback is defined.  This\n** feature is used for test suite validation only and does not appear an\n** production builds.\n**\n** M is an integer, 2 or 3, that indices how many different ways the\n** branch can go.  It is usually 2.  \"I\" is the direction the branch\n** goes.  0 means falls through.  1 means branch is taken.  2 means the\n** second alternative branch is taken.\n**\n** iSrcLine is the source code line (from the __LINE__ macro) that\n** generated the VDBE instruction.  This instrumentation assumes that all\n** source code is in a single file (the amalgamation).  Special values 1\n** and 2 for the iSrcLine parameter mean that this particular branch is\n** always taken or never taken, respectively.\n*/\n#if !defined(SQLITE_VDBE_COVERAGE)\n# define VdbeBranchTaken(I,M)\n#else\n# define VdbeBranchTaken(I,M) vdbeTakeBranch(pOp->iSrcLine,I,M)\n  static void vdbeTakeBranch(int iSrcLine, u8 I, u8 M){\n    if( iSrcLine<=2 && ALWAYS(iSrcLine>0) ){\n      M = iSrcLine;\n      /* Assert the truth of VdbeCoverageAlwaysTaken() and \n      ** VdbeCoverageNeverTaken() */\n      assert( (M & I)==I );\n    }else{\n      if( sqlite3GlobalConfig.xVdbeBranch==0 ) return;  /*NO_TEST*/\n      sqlite3GlobalConfig.xVdbeBranch(sqlite3GlobalConfig.pVdbeBranchArg,\n                                      iSrcLine,I,M);\n    }\n  }\n#endif\n\n/*\n** Convert the given register into a string if it isn't one\n** already. Return non-zero if a malloc() fails.\n*/\n#define Stringify(P, enc) \\\n   if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc,0)) \\\n     { goto no_mem; }\n\n/*\n** An ephemeral string value (signified by the MEM_Ephem flag) contains\n** a pointer to a dynamically allocated string where some other entity\n** is responsible for deallocating that string.  Because the register\n** does not control the string, it might be deleted without the register\n** knowing it.\n**\n** This routine converts an ephemeral string into a dynamically allocated\n** string that the register itself controls.  In other words, it\n** converts an MEM_Ephem string into a string with P.z==P.zMalloc.\n*/\n#define Deephemeralize(P) \\\n   if( ((P)->flags&MEM_Ephem)!=0 \\\n       && sqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;}\n\n/* Return true if the cursor was opened using the OP_OpenSorter opcode. */\n#define isSorter(x) ((x)->eCurType==CURTYPE_SORTER)\n\n/*\n** Allocate VdbeCursor number iCur.  Return a pointer to it.  Return NULL\n** if we run out of memory.\n*/\nstatic VdbeCursor *allocateCursor(\n  Vdbe *p,              /* The virtual machine */\n  int iCur,             /* Index of the new VdbeCursor */\n  int nField,           /* Number of fields in the table or index */\n  int iDb,              /* Database the cursor belongs to, or -1 */\n  u8 eCurType           /* Type of the new cursor */\n){\n  /* Find the memory cell that will be used to store the blob of memory\n  ** required for this VdbeCursor structure. It is convenient to use a \n  ** vdbe memory cell to manage the memory allocation required for a\n  ** VdbeCursor structure for the following reasons:\n  **\n  **   * Sometimes cursor numbers are used for a couple of different\n  **     purposes in a vdbe program. The different uses might require\n  **     different sized allocations. Memory cells provide growable\n  **     allocations.\n  **\n  **   * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can\n  **     be freed lazily via the sqlite3_release_memory() API. This\n  **     minimizes the number of malloc calls made by the system.\n  **\n  ** The memory cell for cursor 0 is aMem[0]. The rest are allocated from\n  ** the top of the register space.  Cursor 1 is at Mem[p->nMem-1].\n  ** Cursor 2 is at Mem[p->nMem-2]. And so forth.\n  */\n  Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem;\n\n  int nByte;\n  VdbeCursor *pCx = 0;\n  nByte = \n      ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + \n      (eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0);\n\n  assert( iCur>=0 && iCur<p->nCursor );\n  if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/\n    sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);\n    p->apCsr[iCur] = 0;\n  }\n  if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){\n    p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;\n    memset(pCx, 0, sizeof(VdbeCursor));\n    pCx->eCurType = eCurType;\n    pCx->iDb = iDb;\n    pCx->nField = nField;\n    pCx->aOffset = &pCx->aType[nField];\n    if( eCurType==CURTYPE_BTREE ){\n      pCx->uc.pCursor = (BtCursor*)\n          &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];\n      sqlite3BtreeCursorZero(pCx->uc.pCursor);\n    }\n  }\n  return pCx;\n}\n\n/*\n** Try to convert a value into a numeric representation if we can\n** do so without loss of information.  In other words, if the string\n** looks like a number, convert it into a number.  If it does not\n** look like a number, leave it alone.\n**\n** If the bTryForInt flag is true, then extra effort is made to give\n** an integer representation.  Strings that look like floating point\n** values but which have no fractional component (example: '48.00')\n** will have a MEM_Int representation when bTryForInt is true.\n**\n** If bTryForInt is false, then if the input string contains a decimal\n** point or exponential notation, the result is only MEM_Real, even\n** if there is an exact integer representation of the quantity.\n*/\nstatic void applyNumericAffinity(Mem *pRec, int bTryForInt){\n  double rValue;\n  i64 iValue;\n  u8 enc = pRec->enc;\n  assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real))==MEM_Str );\n  if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return;\n  if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){\n    pRec->u.i = iValue;\n    pRec->flags |= MEM_Int;\n  }else{\n    pRec->u.r = rValue;\n    pRec->flags |= MEM_Real;\n    if( bTryForInt ) sqlite3VdbeIntegerAffinity(pRec);\n  }\n}\n\n/*\n** Processing is determine by the affinity parameter:\n**\n** SQLITE_AFF_INTEGER:\n** SQLITE_AFF_REAL:\n** SQLITE_AFF_NUMERIC:\n**    Try to convert pRec to an integer representation or a \n**    floating-point representation if an integer representation\n**    is not possible.  Note that the integer representation is\n**    always preferred, even if the affinity is REAL, because\n**    an integer representation is more space efficient on disk.\n**\n** SQLITE_AFF_TEXT:\n**    Convert pRec to a text representation.\n**\n** SQLITE_AFF_BLOB:\n**    No-op.  pRec is unchanged.\n*/\nstatic void applyAffinity(\n  Mem *pRec,          /* The value to apply affinity to */\n  char affinity,      /* The affinity to be applied */\n  u8 enc              /* Use this text encoding */\n){\n  if( affinity>=SQLITE_AFF_NUMERIC ){\n    assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL\n             || affinity==SQLITE_AFF_NUMERIC );\n    if( (pRec->flags & MEM_Int)==0 ){ /*OPTIMIZATION-IF-FALSE*/\n      if( (pRec->flags & MEM_Real)==0 ){\n        if( pRec->flags & MEM_Str ) applyNumericAffinity(pRec,1);\n      }else{\n        sqlite3VdbeIntegerAffinity(pRec);\n      }\n    }\n  }else if( affinity==SQLITE_AFF_TEXT ){\n    /* Only attempt the conversion to TEXT if there is an integer or real\n    ** representation (blob and NULL do not get converted) but no string\n    ** representation.  It would be harmless to repeat the conversion if \n    ** there is already a string rep, but it is pointless to waste those\n    ** CPU cycles. */\n    if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/\n      if( (pRec->flags&(MEM_Real|MEM_Int)) ){\n        sqlite3VdbeMemStringify(pRec, enc, 1);\n      }\n    }\n    pRec->flags &= ~(MEM_Real|MEM_Int);\n  }\n}\n\n/*\n** Try to convert the type of a function argument or a result column\n** into a numeric representation.  Use either INTEGER or REAL whichever\n** is appropriate.  But only do the conversion if it is possible without\n** loss of information and return the revised type of the argument.\n*/\nint sqlite3_value_numeric_type(sqlite3_value *pVal){\n  int eType = sqlite3_value_type(pVal);\n  if( eType==SQLITE_TEXT ){\n    Mem *pMem = (Mem*)pVal;\n    applyNumericAffinity(pMem, 0);\n    eType = sqlite3_value_type(pVal);\n  }\n  return eType;\n}\n\n/*\n** Exported version of applyAffinity(). This one works on sqlite3_value*, \n** not the internal Mem* type.\n*/\nvoid sqlite3ValueApplyAffinity(\n  sqlite3_value *pVal, \n  u8 affinity, \n  u8 enc\n){\n  applyAffinity((Mem *)pVal, affinity, enc);\n}\n\n/*\n** pMem currently only holds a string type (or maybe a BLOB that we can\n** interpret as a string if we want to).  Compute its corresponding\n** numeric type, if has one.  Set the pMem->u.r and pMem->u.i fields\n** accordingly.\n*/\nstatic u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){\n  assert( (pMem->flags & (MEM_Int|MEM_Real))==0 );\n  assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 );\n  if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){\n    return 0;\n  }\n  if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==SQLITE_OK ){\n    return MEM_Int;\n  }\n  return MEM_Real;\n}\n\n/*\n** Return the numeric type for pMem, either MEM_Int or MEM_Real or both or\n** none.  \n**\n** Unlike applyNumericAffinity(), this routine does not modify pMem->flags.\n** But it does set pMem->u.r and pMem->u.i appropriately.\n*/\nstatic u16 numericType(Mem *pMem){\n  if( pMem->flags & (MEM_Int|MEM_Real) ){\n    return pMem->flags & (MEM_Int|MEM_Real);\n  }\n  if( pMem->flags & (MEM_Str|MEM_Blob) ){\n    return computeNumericType(pMem);\n  }\n  return 0;\n}\n\n#ifdef SQLITE_DEBUG\n/*\n** Write a nice string representation of the contents of cell pMem\n** into buffer zBuf, length nBuf.\n*/\nvoid sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){\n  char *zCsr = zBuf;\n  int f = pMem->flags;\n\n  static const char *const encnames[] = {\"(X)\", \"(8)\", \"(16LE)\", \"(16BE)\"};\n\n  if( f&MEM_Blob ){\n    int i;\n    char c;\n    if( f & MEM_Dyn ){\n      c = 'z';\n      assert( (f & (MEM_Static|MEM_Ephem))==0 );\n    }else if( f & MEM_Static ){\n      c = 't';\n      assert( (f & (MEM_Dyn|MEM_Ephem))==0 );\n    }else if( f & MEM_Ephem ){\n      c = 'e';\n      assert( (f & (MEM_Static|MEM_Dyn))==0 );\n    }else{\n      c = 's';\n    }\n\n    sqlite3_snprintf(100, zCsr, \"%c\", c);\n    zCsr += sqlite3Strlen30(zCsr);\n    sqlite3_snprintf(100, zCsr, \"%d[\", pMem->n);\n    zCsr += sqlite3Strlen30(zCsr);\n    for(i=0; i<16 && i<pMem->n; i++){\n      sqlite3_snprintf(100, zCsr, \"%02X\", ((int)pMem->z[i] & 0xFF));\n      zCsr += sqlite3Strlen30(zCsr);\n    }\n    for(i=0; i<16 && i<pMem->n; i++){\n      char z = pMem->z[i];\n      if( z<32 || z>126 ) *zCsr++ = '.';\n      else *zCsr++ = z;\n    }\n\n    sqlite3_snprintf(100, zCsr, \"]%s\", encnames[pMem->enc]);\n    zCsr += sqlite3Strlen30(zCsr);\n    if( f & MEM_Zero ){\n      sqlite3_snprintf(100, zCsr,\"+%dz\",pMem->u.nZero);\n      zCsr += sqlite3Strlen30(zCsr);\n    }\n    *zCsr = '\\0';\n  }else if( f & MEM_Str ){\n    int j, k;\n    zBuf[0] = ' ';\n    if( f & MEM_Dyn ){\n      zBuf[1] = 'z';\n      assert( (f & (MEM_Static|MEM_Ephem))==0 );\n    }else if( f & MEM_Static ){\n      zBuf[1] = 't';\n      assert( (f & (MEM_Dyn|MEM_Ephem))==0 );\n    }else if( f & MEM_Ephem ){\n      zBuf[1] = 'e';\n      assert( (f & (MEM_Static|MEM_Dyn))==0 );\n    }else{\n      zBuf[1] = 's';\n    }\n    k = 2;\n    sqlite3_snprintf(100, &zBuf[k], \"%d\", pMem->n);\n    k += sqlite3Strlen30(&zBuf[k]);\n    zBuf[k++] = '[';\n    for(j=0; j<15 && j<pMem->n; j++){\n      u8 c = pMem->z[j];\n      if( c>=0x20 && c<0x7f ){\n        zBuf[k++] = c;\n      }else{\n        zBuf[k++] = '.';\n      }\n    }\n    zBuf[k++] = ']';\n    sqlite3_snprintf(100,&zBuf[k], encnames[pMem->enc]);\n    k += sqlite3Strlen30(&zBuf[k]);\n    zBuf[k++] = 0;\n  }\n}\n#endif\n\n#ifdef SQLITE_DEBUG\n/*\n** Print the value of a register for tracing purposes:\n*/\nstatic void memTracePrint(Mem *p){\n  if( p->flags & MEM_Undefined ){\n    printf(\" undefined\");\n  }else if( p->flags & MEM_Null ){\n    printf(\" NULL\");\n  }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){\n    printf(\" si:%lld\", p->u.i);\n  }else if( p->flags & MEM_Int ){\n    printf(\" i:%lld\", p->u.i);\n#ifndef SQLITE_OMIT_FLOATING_POINT\n  }else if( p->flags & MEM_Real ){\n    printf(\" r:%g\", p->u.r);\n#endif\n  }else if( p->flags & MEM_RowSet ){\n    printf(\" (rowset)\");\n  }else{\n    char zBuf[200];\n    sqlite3VdbeMemPrettyPrint(p, zBuf);\n    printf(\" %s\", zBuf);\n  }\n  if( p->flags & MEM_Subtype ) printf(\" subtype=0x%02x\", p->eSubtype);\n}\nstatic void registerTrace(int iReg, Mem *p){\n  printf(\"REG[%d] = \", iReg);\n  memTracePrint(p);\n  printf(\"\\n\");\n}\n#endif\n\n#ifdef SQLITE_DEBUG\n#  define REGISTER_TRACE(R,M) if(db->flags&SQLITE_VdbeTrace)registerTrace(R,M)\n#else\n#  define REGISTER_TRACE(R,M)\n#endif\n\n\n#ifdef VDBE_PROFILE\n\n/* \n** hwtime.h contains inline assembler code for implementing \n** high-performance timing routines.\n*/\n#include \"hwtime.h\"\n\n#endif\n\n#ifndef NDEBUG\n/*\n** This function is only called from within an assert() expression. It\n** checks that the sqlite3.nTransaction variable is correctly set to\n** the number of non-transaction savepoints currently in the \n** linked list starting at sqlite3.pSavepoint.\n** \n** Usage:\n**\n**     assert( checkSavepointCount(db) );\n*/\nstatic int checkSavepointCount(sqlite3 *db){\n  int n = 0;\n  Savepoint *p;\n  for(p=db->pSavepoint; p; p=p->pNext) n++;\n  assert( n==(db->nSavepoint + db->isTransactionSavepoint) );\n  return 1;\n}\n#endif\n\n/*\n** Return the register of pOp->p2 after first preparing it to be\n** overwritten with an integer value.\n*/\nstatic SQLITE_NOINLINE Mem *out2PrereleaseWithClear(Mem *pOut){\n  sqlite3VdbeMemSetNull(pOut);\n  pOut->flags = MEM_Int;\n  return pOut;\n}\nstatic Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){\n  Mem *pOut;\n  assert( pOp->p2>0 );\n  assert( pOp->p2<=(p->nMem+1 - p->nCursor) );\n  pOut = &p->aMem[pOp->p2];\n  memAboutToChange(p, pOut);\n  if( VdbeMemDynamic(pOut) ){ /*OPTIMIZATION-IF-FALSE*/\n    return out2PrereleaseWithClear(pOut);\n  }else{\n    pOut->flags = MEM_Int;\n    return pOut;\n  }\n}\n\n\n/*\n** Execute as much of a VDBE program as we can.\n** This is the core of sqlite3_step().  \n*/\nint sqlite3VdbeExec(\n  Vdbe *p                    /* The VDBE */\n){\n  Op *aOp = p->aOp;          /* Copy of p->aOp */\n  Op *pOp = aOp;             /* Current operation */\n#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)\n  Op *pOrigOp;               /* Value of pOp at the top of the loop */\n#endif\n#ifdef SQLITE_DEBUG\n  int nExtraDelete = 0;      /* Verifies FORDELETE and AUXDELETE flags */\n#endif\n  int rc = SQLITE_OK;        /* Value to return */\n  sqlite3 *db = p->db;       /* The database */\n  u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */\n  u8 encoding = ENC(db);     /* The database encoding */\n  int iCompare = 0;          /* Result of last comparison */\n  unsigned nVmStep = 0;      /* Number of virtual machine steps */\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\n  unsigned nProgressLimit = 0;/* Invoke xProgress() when nVmStep reaches this */\n#endif\n  Mem *aMem = p->aMem;       /* Copy of p->aMem */\n  Mem *pIn1 = 0;             /* 1st input operand */\n  Mem *pIn2 = 0;             /* 2nd input operand */\n  Mem *pIn3 = 0;             /* 3rd input operand */\n  Mem *pOut = 0;             /* Output operand */\n  int *aPermute = 0;         /* Permutation of columns for OP_Compare */\n  i64 lastRowid = db->lastRowid;  /* Saved value of the last insert ROWID */\n#ifdef VDBE_PROFILE\n  u64 start;                 /* CPU clock count at start of opcode */\n#endif\n  /*** INSERT STACK UNION HERE ***/\n\n  assert( p->magic==VDBE_MAGIC_RUN );  /* sqlite3_step() verifies this */\n  sqlite3VdbeEnter(p);\n  if( p->rc==SQLITE_NOMEM ){\n    /* This happens if a malloc() inside a call to sqlite3_column_text() or\n    ** sqlite3_column_text16() failed.  */\n    goto no_mem;\n  }\n  assert( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_BUSY );\n  assert( p->bIsReader || p->readOnly!=0 );\n  p->rc = SQLITE_OK;\n  p->iCurrentTime = 0;\n  assert( p->explain==0 );\n  p->pResultSet = 0;\n  db->busyHandler.nBusy = 0;\n  if( db->u1.isInterrupted ) goto abort_due_to_interrupt;\n  sqlite3VdbeIOTraceSql(p);\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\n  if( db->xProgress ){\n    u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];\n    assert( 0 < db->nProgressOps );\n    nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);\n  }\n#endif\n#ifdef SQLITE_DEBUG\n  sqlite3BeginBenignMalloc();\n  if( p->pc==0\n   && (p->db->flags & (SQLITE_VdbeListing|SQLITE_VdbeEQP|SQLITE_VdbeTrace))!=0\n  ){\n    int i;\n    int once = 1;\n    sqlite3VdbePrintSql(p);\n    if( p->db->flags & SQLITE_VdbeListing ){\n      printf(\"VDBE Program Listing:\\n\");\n      for(i=0; i<p->nOp; i++){\n        sqlite3VdbePrintOp(stdout, i, &aOp[i]);\n      }\n    }\n    if( p->db->flags & SQLITE_VdbeEQP ){\n      for(i=0; i<p->nOp; i++){\n        if( aOp[i].opcode==OP_Explain ){\n          if( once ) printf(\"VDBE Query Plan:\\n\");\n          printf(\"%s\\n\", aOp[i].p4.z);\n          once = 0;\n        }\n      }\n    }\n    if( p->db->flags & SQLITE_VdbeTrace )  printf(\"VDBE Trace:\\n\");\n  }\n  sqlite3EndBenignMalloc();\n#endif\n  for(pOp=&aOp[p->pc]; 1; pOp++){\n    /* Errors are detected by individual opcodes, with an immediate\n    ** jumps to abort_due_to_error. */\n    assert( rc==SQLITE_OK );\n\n    assert( pOp>=aOp && pOp<&aOp[p->nOp]);\n#ifdef VDBE_PROFILE\n    start = sqlite3Hwtime();\n#endif\n    nVmStep++;\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n    if( p->anExec ) p->anExec[(int)(pOp-aOp)]++;\n#endif\n\n    /* Only allow tracing if SQLITE_DEBUG is defined.\n    */\n#ifdef SQLITE_DEBUG\n    if( db->flags & SQLITE_VdbeTrace ){\n      sqlite3VdbePrintOp(stdout, (int)(pOp - aOp), pOp);\n    }\n#endif\n      \n\n    /* Check to see if we need to simulate an interrupt.  This only happens\n    ** if we have a special test build.\n    */\n#ifdef SQLITE_TEST\n    if( sqlite3_interrupt_count>0 ){\n      sqlite3_interrupt_count--;\n      if( sqlite3_interrupt_count==0 ){\n        sqlite3_interrupt(db);\n      }\n    }\n#endif\n\n    /* Sanity checking on other operands */\n#ifdef SQLITE_DEBUG\n    {\n      u8 opProperty = sqlite3OpcodeProperty[pOp->opcode];\n      if( (opProperty & OPFLG_IN1)!=0 ){\n        assert( pOp->p1>0 );\n        assert( pOp->p1<=(p->nMem+1 - p->nCursor) );\n        assert( memIsValid(&aMem[pOp->p1]) );\n        assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p1]) );\n        REGISTER_TRACE(pOp->p1, &aMem[pOp->p1]);\n      }\n      if( (opProperty & OPFLG_IN2)!=0 ){\n        assert( pOp->p2>0 );\n        assert( pOp->p2<=(p->nMem+1 - p->nCursor) );\n        assert( memIsValid(&aMem[pOp->p2]) );\n        assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p2]) );\n        REGISTER_TRACE(pOp->p2, &aMem[pOp->p2]);\n      }\n      if( (opProperty & OPFLG_IN3)!=0 ){\n        assert( pOp->p3>0 );\n        assert( pOp->p3<=(p->nMem+1 - p->nCursor) );\n        assert( memIsValid(&aMem[pOp->p3]) );\n        assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p3]) );\n        REGISTER_TRACE(pOp->p3, &aMem[pOp->p3]);\n      }\n      if( (opProperty & OPFLG_OUT2)!=0 ){\n        assert( pOp->p2>0 );\n        assert( pOp->p2<=(p->nMem+1 - p->nCursor) );\n        memAboutToChange(p, &aMem[pOp->p2]);\n      }\n      if( (opProperty & OPFLG_OUT3)!=0 ){\n        assert( pOp->p3>0 );\n        assert( pOp->p3<=(p->nMem+1 - p->nCursor) );\n        memAboutToChange(p, &aMem[pOp->p3]);\n      }\n    }\n#endif\n#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)\n    pOrigOp = pOp;\n#endif\n  \n    switch( pOp->opcode ){\n\n/*****************************************************************************\n** What follows is a massive switch statement where each case implements a\n** separate instruction in the virtual machine.  If we follow the usual\n** indentation conventions, each case should be indented by 6 spaces.  But\n** that is a lot of wasted space on the left margin.  So the code within\n** the switch statement will break with convention and be flush-left. Another\n** big comment (similar to this one) will mark the point in the code where\n** we transition back to normal indentation.\n**\n** The formatting of each case is important.  The makefile for SQLite\n** generates two C files \"opcodes.h\" and \"opcodes.c\" by scanning this\n** file looking for lines that begin with \"case OP_\".  The opcodes.h files\n** will be filled with #defines that give unique integer values to each\n** opcode and the opcodes.c file is filled with an array of strings where\n** each string is the symbolic name for the corresponding opcode.  If the\n** case statement is followed by a comment of the form \"/# same as ... #/\"\n** that comment is used to determine the particular value of the opcode.\n**\n** Other keywords in the comment that follows each case are used to\n** construct the OPFLG_INITIALIZER value that initializes opcodeProperty[].\n** Keywords include: in1, in2, in3, out2, out3.  See\n** the mkopcodeh.awk script for additional information.\n**\n** Documentation about VDBE opcodes is generated by scanning this file\n** for lines of that contain \"Opcode:\".  That line and all subsequent\n** comment lines are used in the generation of the opcode.html documentation\n** file.\n**\n** SUMMARY:\n**\n**     Formatting is important to scripts that scan this file.\n**     Do not deviate from the formatting style currently in use.\n**\n*****************************************************************************/\n\n/* Opcode:  Goto * P2 * * *\n**\n** An unconditional jump to address P2.\n** The next instruction executed will be \n** the one at index P2 from the beginning of\n** the program.\n**\n** The P1 parameter is not actually used by this opcode.  However, it\n** is sometimes set to 1 instead of 0 as a hint to the command-line shell\n** that this Goto is the bottom of a loop and that the lines from P2 down\n** to the current line should be indented for EXPLAIN output.\n*/\ncase OP_Goto: {             /* jump */\njump_to_p2_and_check_for_interrupt:\n  pOp = &aOp[pOp->p2 - 1];\n\n  /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev,\n  ** OP_VNext, OP_RowSetNext, or OP_SorterNext) all jump here upon\n  ** completion.  Check to see if sqlite3_interrupt() has been called\n  ** or if the progress callback needs to be invoked. \n  **\n  ** This code uses unstructured \"goto\" statements and does not look clean.\n  ** But that is not due to sloppy coding habits. The code is written this\n  ** way for performance, to avoid having to run the interrupt and progress\n  ** checks on every opcode.  This helps sqlite3_step() to run about 1.5%\n  ** faster according to \"valgrind --tool=cachegrind\" */\ncheck_for_interrupt:\n  if( db->u1.isInterrupted ) goto abort_due_to_interrupt;\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\n  /* Call the progress callback if it is configured and the required number\n  ** of VDBE ops have been executed (either since this invocation of\n  ** sqlite3VdbeExec() or since last time the progress callback was called).\n  ** If the progress callback returns non-zero, exit the virtual machine with\n  ** a return code SQLITE_ABORT.\n  */\n  if( db->xProgress!=0 && nVmStep>=nProgressLimit ){\n    assert( db->nProgressOps!=0 );\n    nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);\n    if( db->xProgress(db->pProgressArg) ){\n      rc = SQLITE_INTERRUPT;\n      goto abort_due_to_error;\n    }\n  }\n#endif\n  \n  break;\n}\n\n/* Opcode:  Gosub P1 P2 * * *\n**\n** Write the current address onto register P1\n** and then jump to address P2.\n*/\ncase OP_Gosub: {            /* jump */\n  assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );\n  pIn1 = &aMem[pOp->p1];\n  assert( VdbeMemDynamic(pIn1)==0 );\n  memAboutToChange(p, pIn1);\n  pIn1->flags = MEM_Int;\n  pIn1->u.i = (int)(pOp-aOp);\n  REGISTER_TRACE(pOp->p1, pIn1);\n\n  /* Most jump operations do a goto to this spot in order to update\n  ** the pOp pointer. */\njump_to_p2:\n  pOp = &aOp[pOp->p2 - 1];\n  break;\n}\n\n/* Opcode:  Return P1 * * * *\n**\n** Jump to the next instruction after the address in register P1.  After\n** the jump, register P1 becomes undefined.\n*/\ncase OP_Return: {           /* in1 */\n  pIn1 = &aMem[pOp->p1];\n  assert( pIn1->flags==MEM_Int );\n  pOp = &aOp[pIn1->u.i];\n  pIn1->flags = MEM_Undefined;\n  break;\n}\n\n/* Opcode: InitCoroutine P1 P2 P3 * *\n**\n** Set up register P1 so that it will Yield to the coroutine\n** located at address P3.\n**\n** If P2!=0 then the coroutine implementation immediately follows\n** this opcode.  So jump over the coroutine implementation to\n** address P2.\n**\n** See also: EndCoroutine\n*/\ncase OP_InitCoroutine: {     /* jump */\n  assert( pOp->p1>0 &&  pOp->p1<=(p->nMem+1 - p->nCursor) );\n  assert( pOp->p2>=0 && pOp->p2<p->nOp );\n  assert( pOp->p3>=0 && pOp->p3<p->nOp );\n  pOut = &aMem[pOp->p1];\n  assert( !VdbeMemDynamic(pOut) );\n  pOut->u.i = pOp->p3 - 1;\n  pOut->flags = MEM_Int;\n  if( pOp->p2 ) goto jump_to_p2;\n  break;\n}\n\n/* Opcode:  EndCoroutine P1 * * * *\n**\n** The instruction at the address in register P1 is a Yield.\n** Jump to the P2 parameter of that Yield.\n** After the jump, register P1 becomes undefined.\n**\n** See also: InitCoroutine\n*/\ncase OP_EndCoroutine: {           /* in1 */\n  VdbeOp *pCaller;\n  pIn1 = &aMem[pOp->p1];\n  assert( pIn1->flags==MEM_Int );\n  assert( pIn1->u.i>=0 && pIn1->u.i<p->nOp );\n  pCaller = &aOp[pIn1->u.i];\n  assert( pCaller->opcode==OP_Yield );\n  assert( pCaller->p2>=0 && pCaller->p2<p->nOp );\n  pOp = &aOp[pCaller->p2 - 1];\n  pIn1->flags = MEM_Undefined;\n  break;\n}\n\n/* Opcode:  Yield P1 P2 * * *\n**\n** Swap the program counter with the value in register P1.  This\n** has the effect of yielding to a coroutine.\n**\n** If the coroutine that is launched by this instruction ends with\n** Yield or Return then continue to the next instruction.  But if\n** the coroutine launched by this instruction ends with\n** EndCoroutine, then jump to P2 rather than continuing with the\n** next instruction.\n**\n** See also: InitCoroutine\n*/\ncase OP_Yield: {            /* in1, jump */\n  int pcDest;\n  pIn1 = &aMem[pOp->p1];\n  assert( VdbeMemDynamic(pIn1)==0 );\n  pIn1->flags = MEM_Int;\n  pcDest = (int)pIn1->u.i;\n  pIn1->u.i = (int)(pOp - aOp);\n  REGISTER_TRACE(pOp->p1, pIn1);\n  pOp = &aOp[pcDest];\n  break;\n}\n\n/* Opcode:  HaltIfNull  P1 P2 P3 P4 P5\n** Synopsis: if r[P3]=null halt\n**\n** Check the value in register P3.  If it is NULL then Halt using\n** parameter P1, P2, and P4 as if this were a Halt instruction.  If the\n** value in register P3 is not NULL, then this routine is a no-op.\n** The P5 parameter should be 1.\n*/\ncase OP_HaltIfNull: {      /* in3 */\n  pIn3 = &aMem[pOp->p3];\n  if( (pIn3->flags & MEM_Null)==0 ) break;\n  /* Fall through into OP_Halt */\n}\n\n/* Opcode:  Halt P1 P2 * P4 P5\n**\n** Exit immediately.  All open cursors, etc are closed\n** automatically.\n**\n** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(),\n** or sqlite3_finalize().  For a normal halt, this should be SQLITE_OK (0).\n** For errors, it can be some other value.  If P1!=0 then P2 will determine\n** whether or not to rollback the current transaction.  Do not rollback\n** if P2==OE_Fail. Do the rollback if P2==OE_Rollback.  If P2==OE_Abort,\n** then back out all changes that have occurred during this execution of the\n** VDBE, but do not rollback the transaction. \n**\n** If P4 is not null then it is an error message string.\n**\n** P5 is a value between 0 and 4, inclusive, that modifies the P4 string.\n**\n**    0:  (no change)\n**    1:  NOT NULL contraint failed: P4\n**    2:  UNIQUE constraint failed: P4\n**    3:  CHECK constraint failed: P4\n**    4:  FOREIGN KEY constraint failed: P4\n**\n** If P5 is not zero and P4 is NULL, then everything after the \":\" is\n** omitted.\n**\n** There is an implied \"Halt 0 0 0\" instruction inserted at the very end of\n** every program.  So a jump past the last instruction of the program\n** is the same as executing Halt.\n*/\ncase OP_Halt: {\n  VdbeFrame *pFrame;\n  int pcx;\n\n  pcx = (int)(pOp - aOp);\n  if( pOp->p1==SQLITE_OK && p->pFrame ){\n    /* Halt the sub-program. Return control to the parent frame. */\n    pFrame = p->pFrame;\n    p->pFrame = pFrame->pParent;\n    p->nFrame--;\n    sqlite3VdbeSetChanges(db, p->nChange);\n    pcx = sqlite3VdbeFrameRestore(pFrame);\n    lastRowid = db->lastRowid;\n    if( pOp->p2==OE_Ignore ){\n      /* Instruction pcx is the OP_Program that invoked the sub-program \n      ** currently being halted. If the p2 instruction of this OP_Halt\n      ** instruction is set to OE_Ignore, then the sub-program is throwing\n      ** an IGNORE exception. In this case jump to the address specified\n      ** as the p2 of the calling OP_Program.  */\n      pcx = p->aOp[pcx].p2-1;\n    }\n    aOp = p->aOp;\n    aMem = p->aMem;\n    pOp = &aOp[pcx];\n    break;\n  }\n  p->rc = pOp->p1;\n  p->errorAction = (u8)pOp->p2;\n  p->pc = pcx;\n  assert( pOp->p5>=0 && pOp->p5<=4 );\n  if( p->rc ){\n    if( pOp->p5 ){\n      static const char * const azType[] = { \"NOT NULL\", \"UNIQUE\", \"CHECK\",\n                                             \"FOREIGN KEY\" };\n      testcase( pOp->p5==1 );\n      testcase( pOp->p5==2 );\n      testcase( pOp->p5==3 );\n      testcase( pOp->p5==4 );\n      sqlite3VdbeError(p, \"%s constraint failed\", azType[pOp->p5-1]);\n      if( pOp->p4.z ){\n        p->zErrMsg = sqlite3MPrintf(db, \"%z: %s\", p->zErrMsg, pOp->p4.z);\n      }\n    }else{\n      sqlite3VdbeError(p, \"%s\", pOp->p4.z);\n    }\n    sqlite3_log(pOp->p1, \"abort at %d in [%s]: %s\", pcx, p->zSql, p->zErrMsg);\n  }\n  rc = sqlite3VdbeHalt(p);\n  assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR );\n  if( rc==SQLITE_BUSY ){\n    p->rc = SQLITE_BUSY;\n  }else{\n    assert( rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT );\n    assert( rc==SQLITE_OK || db->nDeferredCons>0 || db->nDeferredImmCons>0 );\n    rc = p->rc ? SQLITE_ERROR : SQLITE_DONE;\n  }\n  goto vdbe_return;\n}\n\n/* Opcode: Integer P1 P2 * * *\n** Synopsis: r[P2]=P1\n**\n** The 32-bit integer value P1 is written into register P2.\n*/\ncase OP_Integer: {         /* out2 */\n  pOut = out2Prerelease(p, pOp);\n  pOut->u.i = pOp->p1;\n  break;\n}\n\n/* Opcode: Int64 * P2 * P4 *\n** Synopsis: r[P2]=P4\n**\n** P4 is a pointer to a 64-bit integer value.\n** Write that value into register P2.\n*/\ncase OP_Int64: {           /* out2 */\n  pOut = out2Prerelease(p, pOp);\n  assert( pOp->p4.pI64!=0 );\n  pOut->u.i = *pOp->p4.pI64;\n  break;\n}\n\n#ifndef SQLITE_OMIT_FLOATING_POINT\n/* Opcode: Real * P2 * P4 *\n** Synopsis: r[P2]=P4\n**\n** P4 is a pointer to a 64-bit floating point value.\n** Write that value into register P2.\n*/\ncase OP_Real: {            /* same as TK_FLOAT, out2 */\n  pOut = out2Prerelease(p, pOp);\n  pOut->flags = MEM_Real;\n  assert( !sqlite3IsNaN(*pOp->p4.pReal) );\n  pOut->u.r = *pOp->p4.pReal;\n  break;\n}\n#endif\n\n/* Opcode: String8 * P2 * P4 *\n** Synopsis: r[P2]='P4'\n**\n** P4 points to a nul terminated UTF-8 string. This opcode is transformed \n** into a String opcode before it is executed for the first time.  During\n** this transformation, the length of string P4 is computed and stored\n** as the P1 parameter.\n*/\ncase OP_String8: {         /* same as TK_STRING, out2 */\n  assert( pOp->p4.z!=0 );\n  pOut = out2Prerelease(p, pOp);\n  pOp->opcode = OP_String;\n  pOp->p1 = sqlite3Strlen30(pOp->p4.z);\n\n#ifndef SQLITE_OMIT_UTF16\n  if( encoding!=SQLITE_UTF8 ){\n    rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);\n    assert( rc==SQLITE_OK || rc==SQLITE_TOOBIG );\n    if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;\n    assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z );\n    assert( VdbeMemDynamic(pOut)==0 );\n    pOut->szMalloc = 0;\n    pOut->flags |= MEM_Static;\n    if( pOp->p4type==P4_DYNAMIC ){\n      sqlite3DbFree(db, pOp->p4.z);\n    }\n    pOp->p4type = P4_DYNAMIC;\n    pOp->p4.z = pOut->z;\n    pOp->p1 = pOut->n;\n  }\n  testcase( rc==SQLITE_TOOBIG );\n#endif\n  if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    goto too_big;\n  }\n  assert( rc==SQLITE_OK );\n  /* Fall through to the next case, OP_String */\n}\n  \n/* Opcode: String P1 P2 P3 P4 P5\n** Synopsis: r[P2]='P4' (len=P1)\n**\n** The string value P4 of length P1 (bytes) is stored in register P2.\n**\n** If P3 is not zero and the content of register P3 is equal to P5, then\n** the datatype of the register P2 is converted to BLOB.  The content is\n** the same sequence of bytes, it is merely interpreted as a BLOB instead\n** of a string, as if it had been CAST.  In other words:\n**\n** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB)\n*/\ncase OP_String: {          /* out2 */\n  assert( pOp->p4.z!=0 );\n  pOut = out2Prerelease(p, pOp);\n  pOut->flags = MEM_Str|MEM_Static|MEM_Term;\n  pOut->z = pOp->p4.z;\n  pOut->n = pOp->p1;\n  pOut->enc = encoding;\n  UPDATE_MAX_BLOBSIZE(pOut);\n#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n  if( pOp->p3>0 ){\n    assert( pOp->p3<=(p->nMem+1 - p->nCursor) );\n    pIn3 = &aMem[pOp->p3];\n    assert( pIn3->flags & MEM_Int );\n    if( pIn3->u.i==pOp->p5 ) pOut->flags = MEM_Blob|MEM_Static|MEM_Term;\n  }\n#endif\n  break;\n}\n\n/* Opcode: Null P1 P2 P3 * *\n** Synopsis: r[P2..P3]=NULL\n**\n** Write a NULL into registers P2.  If P3 greater than P2, then also write\n** NULL into register P3 and every register in between P2 and P3.  If P3\n** is less than P2 (typically P3 is zero) then only register P2 is\n** set to NULL.\n**\n** If the P1 value is non-zero, then also set the MEM_Cleared flag so that\n** NULL values will not compare equal even if SQLITE_NULLEQ is set on\n** OP_Ne or OP_Eq.\n*/\ncase OP_Null: {           /* out2 */\n  int cnt;\n  u16 nullFlag;\n  pOut = out2Prerelease(p, pOp);\n  cnt = pOp->p3-pOp->p2;\n  assert( pOp->p3<=(p->nMem+1 - p->nCursor) );\n  pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;\n  pOut->n = 0;\n  while( cnt>0 ){\n    pOut++;\n    memAboutToChange(p, pOut);\n    sqlite3VdbeMemSetNull(pOut);\n    pOut->flags = nullFlag;\n    pOut->n = 0;\n    cnt--;\n  }\n  break;\n}\n\n/* Opcode: SoftNull P1 * * * *\n** Synopsis: r[P1]=NULL\n**\n** Set register P1 to have the value NULL as seen by the OP_MakeRecord\n** instruction, but do not free any string or blob memory associated with\n** the register, so that if the value was a string or blob that was\n** previously copied using OP_SCopy, the copies will continue to be valid.\n*/\ncase OP_SoftNull: {\n  assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );\n  pOut = &aMem[pOp->p1];\n  pOut->flags = (pOut->flags|MEM_Null)&~MEM_Undefined;\n  break;\n}\n\n/* Opcode: Blob P1 P2 * P4 *\n** Synopsis: r[P2]=P4 (len=P1)\n**\n** P4 points to a blob of data P1 bytes long.  Store this\n** blob in register P2.\n*/\ncase OP_Blob: {                /* out2 */\n  assert( pOp->p1 <= SQLITE_MAX_LENGTH );\n  pOut = out2Prerelease(p, pOp);\n  sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);\n  pOut->enc = encoding;\n  UPDATE_MAX_BLOBSIZE(pOut);\n  break;\n}\n\n/* Opcode: Variable P1 P2 * P4 *\n** Synopsis: r[P2]=parameter(P1,P4)\n**\n** Transfer the values of bound parameter P1 into register P2\n**\n** If the parameter is named, then its name appears in P4.\n** The P4 value is used by sqlite3_bind_parameter_name().\n*/\ncase OP_Variable: {            /* out2 */\n  Mem *pVar;       /* Value being transferred */\n\n  assert( pOp->p1>0 && pOp->p1<=p->nVar );\n  assert( pOp->p4.z==0 || pOp->p4.z==p->azVar[pOp->p1-1] );\n  pVar = &p->aVar[pOp->p1 - 1];\n  if( sqlite3VdbeMemTooBig(pVar) ){\n    goto too_big;\n  }\n  pOut = out2Prerelease(p, pOp);\n  sqlite3VdbeMemShallowCopy(pOut, pVar, MEM_Static);\n  UPDATE_MAX_BLOBSIZE(pOut);\n  break;\n}\n\n/* Opcode: Move P1 P2 P3 * *\n** Synopsis: r[P2@P3]=r[P1@P3]\n**\n** Move the P3 values in register P1..P1+P3-1 over into\n** registers P2..P2+P3-1.  Registers P1..P1+P3-1 are\n** left holding a NULL.  It is an error for register ranges\n** P1..P1+P3-1 and P2..P2+P3-1 to overlap.  It is an error\n** for P3 to be less than 1.\n*/\ncase OP_Move: {\n  int n;           /* Number of registers left to copy */\n  int p1;          /* Register to copy from */\n  int p2;          /* Register to copy to */\n\n  n = pOp->p3;\n  p1 = pOp->p1;\n  p2 = pOp->p2;\n  assert( n>0 && p1>0 && p2>0 );\n  assert( p1+n<=p2 || p2+n<=p1 );\n\n  pIn1 = &aMem[p1];\n  pOut = &aMem[p2];\n  do{\n    assert( pOut<=&aMem[(p->nMem+1 - p->nCursor)] );\n    assert( pIn1<=&aMem[(p->nMem+1 - p->nCursor)] );\n    assert( memIsValid(pIn1) );\n    memAboutToChange(p, pOut);\n    sqlite3VdbeMemMove(pOut, pIn1);\n#ifdef SQLITE_DEBUG\n    if( pOut->pScopyFrom>=&aMem[p1] && pOut->pScopyFrom<pOut ){\n      pOut->pScopyFrom += pOp->p2 - p1;\n    }\n#endif\n    Deephemeralize(pOut);\n    REGISTER_TRACE(p2++, pOut);\n    pIn1++;\n    pOut++;\n  }while( --n );\n  break;\n}\n\n/* Opcode: Copy P1 P2 P3 * *\n** Synopsis: r[P2@P3+1]=r[P1@P3+1]\n**\n** Make a copy of registers P1..P1+P3 into registers P2..P2+P3.\n**\n** This instruction makes a deep copy of the value.  A duplicate\n** is made of any string or blob constant.  See also OP_SCopy.\n*/\ncase OP_Copy: {\n  int n;\n\n  n = pOp->p3;\n  pIn1 = &aMem[pOp->p1];\n  pOut = &aMem[pOp->p2];\n  assert( pOut!=pIn1 );\n  while( 1 ){\n    sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);\n    Deephemeralize(pOut);\n#ifdef SQLITE_DEBUG\n    pOut->pScopyFrom = 0;\n#endif\n    REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);\n    if( (n--)==0 ) break;\n    pOut++;\n    pIn1++;\n  }\n  break;\n}\n\n/* Opcode: SCopy P1 P2 * * *\n** Synopsis: r[P2]=r[P1]\n**\n** Make a shallow copy of register P1 into register P2.\n**\n** This instruction makes a shallow copy of the value.  If the value\n** is a string or blob, then the copy is only a pointer to the\n** original and hence if the original changes so will the copy.\n** Worse, if the original is deallocated, the copy becomes invalid.\n** Thus the program must guarantee that the original will not change\n** during the lifetime of the copy.  Use OP_Copy to make a complete\n** copy.\n*/\ncase OP_SCopy: {            /* out2 */\n  pIn1 = &aMem[pOp->p1];\n  pOut = &aMem[pOp->p2];\n  assert( pOut!=pIn1 );\n  sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);\n#ifdef SQLITE_DEBUG\n  if( pOut->pScopyFrom==0 ) pOut->pScopyFrom = pIn1;\n#endif\n  break;\n}\n\n/* Opcode: IntCopy P1 P2 * * *\n** Synopsis: r[P2]=r[P1]\n**\n** Transfer the integer value held in register P1 into register P2.\n**\n** This is an optimized version of SCopy that works only for integer\n** values.\n*/\ncase OP_IntCopy: {            /* out2 */\n  pIn1 = &aMem[pOp->p1];\n  assert( (pIn1->flags & MEM_Int)!=0 );\n  pOut = &aMem[pOp->p2];\n  sqlite3VdbeMemSetInt64(pOut, pIn1->u.i);\n  break;\n}\n\n/* Opcode: ResultRow P1 P2 * * *\n** Synopsis: output=r[P1@P2]\n**\n** The registers P1 through P1+P2-1 contain a single row of\n** results. This opcode causes the sqlite3_step() call to terminate\n** with an SQLITE_ROW return code and it sets up the sqlite3_stmt\n** structure to provide access to the r(P1)..r(P1+P2-1) values as\n** the result row.\n*/\ncase OP_ResultRow: {\n  Mem *pMem;\n  int i;\n  assert( p->nResColumn==pOp->p2 );\n  assert( pOp->p1>0 );\n  assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );\n\n#ifndef SQLITE_OMIT_PROGRESS_CALLBACK\n  /* Run the progress counter just before returning.\n  */\n  if( db->xProgress!=0\n   && nVmStep>=nProgressLimit\n   && db->xProgress(db->pProgressArg)!=0\n  ){\n    rc = SQLITE_INTERRUPT;\n    goto abort_due_to_error;\n  }\n#endif\n\n  /* If this statement has violated immediate foreign key constraints, do\n  ** not return the number of rows modified. And do not RELEASE the statement\n  ** transaction. It needs to be rolled back.  */\n  if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){\n    assert( db->flags&SQLITE_CountRows );\n    assert( p->usesStmtJournal );\n    goto abort_due_to_error;\n  }\n\n  /* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then \n  ** DML statements invoke this opcode to return the number of rows \n  ** modified to the user. This is the only way that a VM that\n  ** opens a statement transaction may invoke this opcode.\n  **\n  ** In case this is such a statement, close any statement transaction\n  ** opened by this VM before returning control to the user. This is to\n  ** ensure that statement-transactions are always nested, not overlapping.\n  ** If the open statement-transaction is not closed here, then the user\n  ** may step another VM that opens its own statement transaction. This\n  ** may lead to overlapping statement transactions.\n  **\n  ** The statement transaction is never a top-level transaction.  Hence\n  ** the RELEASE call below can never fail.\n  */\n  assert( p->iStatement==0 || db->flags&SQLITE_CountRows );\n  rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);\n  assert( rc==SQLITE_OK );\n\n  /* Invalidate all ephemeral cursor row caches */\n  p->cacheCtr = (p->cacheCtr + 2)|1;\n\n  /* Make sure the results of the current row are \\000 terminated\n  ** and have an assigned type.  The results are de-ephemeralized as\n  ** a side effect.\n  */\n  pMem = p->pResultSet = &aMem[pOp->p1];\n  for(i=0; i<pOp->p2; i++){\n    assert( memIsValid(&pMem[i]) );\n    Deephemeralize(&pMem[i]);\n    assert( (pMem[i].flags & MEM_Ephem)==0\n            || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 );\n    sqlite3VdbeMemNulTerminate(&pMem[i]);\n    REGISTER_TRACE(pOp->p1+i, &pMem[i]);\n  }\n  if( db->mallocFailed ) goto no_mem;\n\n  if( db->mTrace & SQLITE_TRACE_ROW ){\n    db->xTrace(SQLITE_TRACE_ROW, db->pTraceArg, p, 0);\n  }\n\n  /* Return SQLITE_ROW\n  */\n  p->pc = (int)(pOp - aOp) + 1;\n  rc = SQLITE_ROW;\n  goto vdbe_return;\n}\n\n/* Opcode: Concat P1 P2 P3 * *\n** Synopsis: r[P3]=r[P2]+r[P1]\n**\n** Add the text in register P1 onto the end of the text in\n** register P2 and store the result in register P3.\n** If either the P1 or P2 text are NULL then store NULL in P3.\n**\n**   P3 = P2 || P1\n**\n** It is illegal for P1 and P3 to be the same register. Sometimes,\n** if P3 is the same register as P2, the implementation is able\n** to avoid a memcpy().\n*/\ncase OP_Concat: {           /* same as TK_CONCAT, in1, in2, out3 */\n  i64 nByte;\n\n  pIn1 = &aMem[pOp->p1];\n  pIn2 = &aMem[pOp->p2];\n  pOut = &aMem[pOp->p3];\n  assert( pIn1!=pOut );\n  if( (pIn1->flags | pIn2->flags) & MEM_Null ){\n    sqlite3VdbeMemSetNull(pOut);\n    break;\n  }\n  if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;\n  Stringify(pIn1, encoding);\n  Stringify(pIn2, encoding);\n  nByte = pIn1->n + pIn2->n;\n  if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    goto too_big;\n  }\n  if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){\n    goto no_mem;\n  }\n  MemSetTypeFlag(pOut, MEM_Str);\n  if( pOut!=pIn2 ){\n    memcpy(pOut->z, pIn2->z, pIn2->n);\n  }\n  memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);\n  pOut->z[nByte]=0;\n  pOut->z[nByte+1] = 0;\n  pOut->flags |= MEM_Term;\n  pOut->n = (int)nByte;\n  pOut->enc = encoding;\n  UPDATE_MAX_BLOBSIZE(pOut);\n  break;\n}\n\n/* Opcode: Add P1 P2 P3 * *\n** Synopsis: r[P3]=r[P1]+r[P2]\n**\n** Add the value in register P1 to the value in register P2\n** and store the result in register P3.\n** If either input is NULL, the result is NULL.\n*/\n/* Opcode: Multiply P1 P2 P3 * *\n** Synopsis: r[P3]=r[P1]*r[P2]\n**\n**\n** Multiply the value in register P1 by the value in register P2\n** and store the result in register P3.\n** If either input is NULL, the result is NULL.\n*/\n/* Opcode: Subtract P1 P2 P3 * *\n** Synopsis: r[P3]=r[P2]-r[P1]\n**\n** Subtract the value in register P1 from the value in register P2\n** and store the result in register P3.\n** If either input is NULL, the result is NULL.\n*/\n/* Opcode: Divide P1 P2 P3 * *\n** Synopsis: r[P3]=r[P2]/r[P1]\n**\n** Divide the value in register P1 by the value in register P2\n** and store the result in register P3 (P3=P2/P1). If the value in \n** register P1 is zero, then the result is NULL. If either input is \n** NULL, the result is NULL.\n*/\n/* Opcode: Remainder P1 P2 P3 * *\n** Synopsis: r[P3]=r[P2]%r[P1]\n**\n** Compute the remainder after integer register P2 is divided by \n** register P1 and store the result in register P3. \n** If the value in register P1 is zero the result is NULL.\n** If either operand is NULL, the result is NULL.\n*/\ncase OP_Add:                   /* same as TK_PLUS, in1, in2, out3 */\ncase OP_Subtract:              /* same as TK_MINUS, in1, in2, out3 */\ncase OP_Multiply:              /* same as TK_STAR, in1, in2, out3 */\ncase OP_Divide:                /* same as TK_SLASH, in1, in2, out3 */\ncase OP_Remainder: {           /* same as TK_REM, in1, in2, out3 */\n  char bIntint;   /* Started out as two integer operands */\n  u16 flags;      /* Combined MEM_* flags from both inputs */\n  u16 type1;      /* Numeric type of left operand */\n  u16 type2;      /* Numeric type of right operand */\n  i64 iA;         /* Integer value of left operand */\n  i64 iB;         /* Integer value of right operand */\n  double rA;      /* Real value of left operand */\n  double rB;      /* Real value of right operand */\n\n  pIn1 = &aMem[pOp->p1];\n  type1 = numericType(pIn1);\n  pIn2 = &aMem[pOp->p2];\n  type2 = numericType(pIn2);\n  pOut = &aMem[pOp->p3];\n  flags = pIn1->flags | pIn2->flags;\n  if( (flags & MEM_Null)!=0 ) goto arithmetic_result_is_null;\n  if( (type1 & type2 & MEM_Int)!=0 ){\n    iA = pIn1->u.i;\n    iB = pIn2->u.i;\n    bIntint = 1;\n    switch( pOp->opcode ){\n      case OP_Add:       if( sqlite3AddInt64(&iB,iA) ) goto fp_math;  break;\n      case OP_Subtract:  if( sqlite3SubInt64(&iB,iA) ) goto fp_math;  break;\n      case OP_Multiply:  if( sqlite3MulInt64(&iB,iA) ) goto fp_math;  break;\n      case OP_Divide: {\n        if( iA==0 ) goto arithmetic_result_is_null;\n        if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math;\n        iB /= iA;\n        break;\n      }\n      default: {\n        if( iA==0 ) goto arithmetic_result_is_null;\n        if( iA==-1 ) iA = 1;\n        iB %= iA;\n        break;\n      }\n    }\n    pOut->u.i = iB;\n    MemSetTypeFlag(pOut, MEM_Int);\n  }else{\n    bIntint = 0;\nfp_math:\n    rA = sqlite3VdbeRealValue(pIn1);\n    rB = sqlite3VdbeRealValue(pIn2);\n    switch( pOp->opcode ){\n      case OP_Add:         rB += rA;       break;\n      case OP_Subtract:    rB -= rA;       break;\n      case OP_Multiply:    rB *= rA;       break;\n      case OP_Divide: {\n        /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\n        if( rA==(double)0 ) goto arithmetic_result_is_null;\n        rB /= rA;\n        break;\n      }\n      default: {\n        iA = (i64)rA;\n        iB = (i64)rB;\n        if( iA==0 ) goto arithmetic_result_is_null;\n        if( iA==-1 ) iA = 1;\n        rB = (double)(iB % iA);\n        break;\n      }\n    }\n#ifdef SQLITE_OMIT_FLOATING_POINT\n    pOut->u.i = rB;\n    MemSetTypeFlag(pOut, MEM_Int);\n#else\n    if( sqlite3IsNaN(rB) ){\n      goto arithmetic_result_is_null;\n    }\n    pOut->u.r = rB;\n    MemSetTypeFlag(pOut, MEM_Real);\n    if( ((type1|type2)&MEM_Real)==0 && !bIntint ){\n      sqlite3VdbeIntegerAffinity(pOut);\n    }\n#endif\n  }\n  break;\n\narithmetic_result_is_null:\n  sqlite3VdbeMemSetNull(pOut);\n  break;\n}\n\n/* Opcode: CollSeq P1 * * P4\n**\n** P4 is a pointer to a CollSeq struct. If the next call to a user function\n** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will\n** be returned. This is used by the built-in min(), max() and nullif()\n** functions.\n**\n** If P1 is not zero, then it is a register that a subsequent min() or\n** max() aggregate will set to 1 if the current row is not the minimum or\n** maximum.  The P1 register is initialized to 0 by this instruction.\n**\n** The interface used by the implementation of the aforementioned functions\n** to retrieve the collation sequence set by this opcode is not available\n** publicly.  Only built-in functions have access to this feature.\n*/\ncase OP_CollSeq: {\n  assert( pOp->p4type==P4_COLLSEQ );\n  if( pOp->p1 ){\n    sqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0);\n  }\n  break;\n}\n\n/* Opcode: Function0 P1 P2 P3 P4 P5\n** Synopsis: r[P3]=func(r[P2@P5])\n**\n** Invoke a user function (P4 is a pointer to a FuncDef object that\n** defines the function) with P5 arguments taken from register P2 and\n** successors.  The result of the function is stored in register P3.\n** Register P3 must not be one of the function inputs.\n**\n** P1 is a 32-bit bitmask indicating whether or not each argument to the \n** function was determined to be constant at compile time. If the first\n** argument was constant then bit 0 of P1 is set. This is used to determine\n** whether meta data associated with a user function argument using the\n** sqlite3_set_auxdata() API may be safely retained until the next\n** invocation of this opcode.\n**\n** See also: Function, AggStep, AggFinal\n*/\n/* Opcode: Function P1 P2 P3 P4 P5\n** Synopsis: r[P3]=func(r[P2@P5])\n**\n** Invoke a user function (P4 is a pointer to an sqlite3_context object that\n** contains a pointer to the function to be run) with P5 arguments taken\n** from register P2 and successors.  The result of the function is stored\n** in register P3.  Register P3 must not be one of the function inputs.\n**\n** P1 is a 32-bit bitmask indicating whether or not each argument to the \n** function was determined to be constant at compile time. If the first\n** argument was constant then bit 0 of P1 is set. This is used to determine\n** whether meta data associated with a user function argument using the\n** sqlite3_set_auxdata() API may be safely retained until the next\n** invocation of this opcode.\n**\n** SQL functions are initially coded as OP_Function0 with P4 pointing\n** to a FuncDef object.  But on first evaluation, the P4 operand is\n** automatically converted into an sqlite3_context object and the operation\n** changed to this OP_Function opcode.  In this way, the initialization of\n** the sqlite3_context object occurs only once, rather than once for each\n** evaluation of the function.\n**\n** See also: Function0, AggStep, AggFinal\n*/\ncase OP_Function0: {\n  int n;\n  sqlite3_context *pCtx;\n\n  assert( pOp->p4type==P4_FUNCDEF );\n  n = pOp->p5;\n  assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );\n  assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) );\n  assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+n );\n  pCtx = sqlite3DbMallocRawNN(db, sizeof(*pCtx) + (n-1)*sizeof(sqlite3_value*));\n  if( pCtx==0 ) goto no_mem;\n  pCtx->pOut = 0;\n  pCtx->pFunc = pOp->p4.pFunc;\n  pCtx->iOp = (int)(pOp - aOp);\n  pCtx->pVdbe = p;\n  pCtx->argc = n;\n  pOp->p4type = P4_FUNCCTX;\n  pOp->p4.pCtx = pCtx;\n  pOp->opcode = OP_Function;\n  /* Fall through into OP_Function */\n}\ncase OP_Function: {\n  int i;\n  sqlite3_context *pCtx;\n\n  assert( pOp->p4type==P4_FUNCCTX );\n  pCtx = pOp->p4.pCtx;\n\n  /* If this function is inside of a trigger, the register array in aMem[]\n  ** might change from one evaluation to the next.  The next block of code\n  ** checks to see if the register array has changed, and if so it\n  ** reinitializes the relavant parts of the sqlite3_context object */\n  pOut = &aMem[pOp->p3];\n  if( pCtx->pOut != pOut ){\n    pCtx->pOut = pOut;\n    for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];\n  }\n\n  memAboutToChange(p, pCtx->pOut);\n#ifdef SQLITE_DEBUG\n  for(i=0; i<pCtx->argc; i++){\n    assert( memIsValid(pCtx->argv[i]) );\n    REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);\n  }\n#endif\n  MemSetTypeFlag(pCtx->pOut, MEM_Null);\n  pCtx->fErrorOrAux = 0;\n  db->lastRowid = lastRowid;\n  (*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */\n  lastRowid = db->lastRowid;  /* Remember rowid changes made by xSFunc */\n\n  /* If the function returned an error, throw an exception */\n  if( pCtx->fErrorOrAux ){\n    if( pCtx->isError ){\n      sqlite3VdbeError(p, \"%s\", sqlite3_value_text(pCtx->pOut));\n      rc = pCtx->isError;\n    }\n    sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);\n    if( rc ) goto abort_due_to_error;\n  }\n\n  /* Copy the result of the function into register P3 */\n  if( pOut->flags & (MEM_Str|MEM_Blob) ){\n    sqlite3VdbeChangeEncoding(pCtx->pOut, encoding);\n    if( sqlite3VdbeMemTooBig(pCtx->pOut) ) goto too_big;\n  }\n\n  REGISTER_TRACE(pOp->p3, pCtx->pOut);\n  UPDATE_MAX_BLOBSIZE(pCtx->pOut);\n  break;\n}\n\n/* Opcode: BitAnd P1 P2 P3 * *\n** Synopsis: r[P3]=r[P1]&r[P2]\n**\n** Take the bit-wise AND of the values in register P1 and P2 and\n** store the result in register P3.\n** If either input is NULL, the result is NULL.\n*/\n/* Opcode: BitOr P1 P2 P3 * *\n** Synopsis: r[P3]=r[P1]|r[P2]\n**\n** Take the bit-wise OR of the values in register P1 and P2 and\n** store the result in register P3.\n** If either input is NULL, the result is NULL.\n*/\n/* Opcode: ShiftLeft P1 P2 P3 * *\n** Synopsis: r[P3]=r[P2]<<r[P1]\n**\n** Shift the integer value in register P2 to the left by the\n** number of bits specified by the integer in register P1.\n** Store the result in register P3.\n** If either input is NULL, the result is NULL.\n*/\n/* Opcode: ShiftRight P1 P2 P3 * *\n** Synopsis: r[P3]=r[P2]>>r[P1]\n**\n** Shift the integer value in register P2 to the right by the\n** number of bits specified by the integer in register P1.\n** Store the result in register P3.\n** If either input is NULL, the result is NULL.\n*/\ncase OP_BitAnd:                 /* same as TK_BITAND, in1, in2, out3 */\ncase OP_BitOr:                  /* same as TK_BITOR, in1, in2, out3 */\ncase OP_ShiftLeft:              /* same as TK_LSHIFT, in1, in2, out3 */\ncase OP_ShiftRight: {           /* same as TK_RSHIFT, in1, in2, out3 */\n  i64 iA;\n  u64 uA;\n  i64 iB;\n  u8 op;\n\n  pIn1 = &aMem[pOp->p1];\n  pIn2 = &aMem[pOp->p2];\n  pOut = &aMem[pOp->p3];\n  if( (pIn1->flags | pIn2->flags) & MEM_Null ){\n    sqlite3VdbeMemSetNull(pOut);\n    break;\n  }\n  iA = sqlite3VdbeIntValue(pIn2);\n  iB = sqlite3VdbeIntValue(pIn1);\n  op = pOp->opcode;\n  if( op==OP_BitAnd ){\n    iA &= iB;\n  }else if( op==OP_BitOr ){\n    iA |= iB;\n  }else if( iB!=0 ){\n    assert( op==OP_ShiftRight || op==OP_ShiftLeft );\n\n    /* If shifting by a negative amount, shift in the other direction */\n    if( iB<0 ){\n      assert( OP_ShiftRight==OP_ShiftLeft+1 );\n      op = 2*OP_ShiftLeft + 1 - op;\n      iB = iB>(-64) ? -iB : 64;\n    }\n\n    if( iB>=64 ){\n      iA = (iA>=0 || op==OP_ShiftLeft) ? 0 : -1;\n    }else{\n      memcpy(&uA, &iA, sizeof(uA));\n      if( op==OP_ShiftLeft ){\n        uA <<= iB;\n      }else{\n        uA >>= iB;\n        /* Sign-extend on a right shift of a negative number */\n        if( iA<0 ) uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-iB);\n      }\n      memcpy(&iA, &uA, sizeof(iA));\n    }\n  }\n  pOut->u.i = iA;\n  MemSetTypeFlag(pOut, MEM_Int);\n  break;\n}\n\n/* Opcode: AddImm  P1 P2 * * *\n** Synopsis: r[P1]=r[P1]+P2\n** \n** Add the constant P2 to the value in register P1.\n** The result is always an integer.\n**\n** To force any register to be an integer, just add 0.\n*/\ncase OP_AddImm: {            /* in1 */\n  pIn1 = &aMem[pOp->p1];\n  memAboutToChange(p, pIn1);\n  sqlite3VdbeMemIntegerify(pIn1);\n  pIn1->u.i += pOp->p2;\n  break;\n}\n\n/* Opcode: MustBeInt P1 P2 * * *\n** \n** Force the value in register P1 to be an integer.  If the value\n** in P1 is not an integer and cannot be converted into an integer\n** without data loss, then jump immediately to P2, or if P2==0\n** raise an SQLITE_MISMATCH exception.\n*/\ncase OP_MustBeInt: {            /* jump, in1 */\n  pIn1 = &aMem[pOp->p1];\n  if( (pIn1->flags & MEM_Int)==0 ){\n    applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);\n    VdbeBranchTaken((pIn1->flags&MEM_Int)==0, 2);\n    if( (pIn1->flags & MEM_Int)==0 ){\n      if( pOp->p2==0 ){\n        rc = SQLITE_MISMATCH;\n        goto abort_due_to_error;\n      }else{\n        goto jump_to_p2;\n      }\n    }\n  }\n  MemSetTypeFlag(pIn1, MEM_Int);\n  break;\n}\n\n#ifndef SQLITE_OMIT_FLOATING_POINT\n/* Opcode: RealAffinity P1 * * * *\n**\n** If register P1 holds an integer convert it to a real value.\n**\n** This opcode is used when extracting information from a column that\n** has REAL affinity.  Such column values may still be stored as\n** integers, for space efficiency, but after extraction we want them\n** to have only a real value.\n*/\ncase OP_RealAffinity: {                  /* in1 */\n  pIn1 = &aMem[pOp->p1];\n  if( pIn1->flags & MEM_Int ){\n    sqlite3VdbeMemRealify(pIn1);\n  }\n  break;\n}\n#endif\n\n#ifndef SQLITE_OMIT_CAST\n/* Opcode: Cast P1 P2 * * *\n** Synopsis: affinity(r[P1])\n**\n** Force the value in register P1 to be the type defined by P2.\n** \n** <ul>\n** <li value=\"97\"> TEXT\n** <li value=\"98\"> BLOB\n** <li value=\"99\"> NUMERIC\n** <li value=\"100\"> INTEGER\n** <li value=\"101\"> REAL\n** </ul>\n**\n** A NULL value is not changed by this routine.  It remains NULL.\n*/\ncase OP_Cast: {                  /* in1 */\n  assert( pOp->p2>=SQLITE_AFF_BLOB && pOp->p2<=SQLITE_AFF_REAL );\n  testcase( pOp->p2==SQLITE_AFF_TEXT );\n  testcase( pOp->p2==SQLITE_AFF_BLOB );\n  testcase( pOp->p2==SQLITE_AFF_NUMERIC );\n  testcase( pOp->p2==SQLITE_AFF_INTEGER );\n  testcase( pOp->p2==SQLITE_AFF_REAL );\n  pIn1 = &aMem[pOp->p1];\n  memAboutToChange(p, pIn1);\n  rc = ExpandBlob(pIn1);\n  sqlite3VdbeMemCast(pIn1, pOp->p2, encoding);\n  UPDATE_MAX_BLOBSIZE(pIn1);\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n#endif /* SQLITE_OMIT_CAST */\n\n/* Opcode: Eq P1 P2 P3 P4 P5\n** Synopsis: IF r[P3]==r[P1]\n**\n** Compare the values in register P1 and P3.  If reg(P3)==reg(P1) then\n** jump to address P2.  Or if the SQLITE_STOREP2 flag is set in P5, then\n** store the result of comparison in register P2.\n**\n** The SQLITE_AFF_MASK portion of P5 must be an affinity character -\n** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made \n** to coerce both inputs according to this affinity before the\n** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric\n** affinity is used. Note that the affinity conversions are stored\n** back into the input registers P1 and P3.  So this opcode can cause\n** persistent changes to registers P1 and P3.\n**\n** Once any conversions have taken place, and neither value is NULL, \n** the values are compared. If both values are blobs then memcmp() is\n** used to determine the results of the comparison.  If both values\n** are text, then the appropriate collating function specified in\n** P4 is used to do the comparison.  If P4 is not specified then\n** memcmp() is used to compare text string.  If both values are\n** numeric, then a numeric comparison is used. If the two values\n** are of different types, then numbers are considered less than\n** strings and strings are considered less than blobs.\n**\n** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either\n** true or false and is never NULL.  If both operands are NULL then the result\n** of comparison is true.  If either operand is NULL then the result is false.\n** If neither operand is NULL the result is the same as it would be if\n** the SQLITE_NULLEQ flag were omitted from P5.\n**\n** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the\n** content of r[P2] is only changed if the new value is NULL or 0 (false).\n** In other words, a prior r[P2] value will not be overwritten by 1 (true).\n*/\n/* Opcode: Ne P1 P2 P3 P4 P5\n** Synopsis: IF r[P3]!=r[P1]\n**\n** This works just like the Eq opcode except that the jump is taken if\n** the operands in registers P1 and P3 are not equal.  See the Eq opcode for\n** additional information.\n**\n** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the\n** content of r[P2] is only changed if the new value is NULL or 1 (true).\n** In other words, a prior r[P2] value will not be overwritten by 0 (false).\n*/\n/* Opcode: Lt P1 P2 P3 P4 P5\n** Synopsis: IF r[P3]<r[P1]\n**\n** Compare the values in register P1 and P3.  If reg(P3)<reg(P1) then\n** jump to address P2.  Or if the SQLITE_STOREP2 flag is set in P5 store\n** the result of comparison (0 or 1 or NULL) into register P2.\n**\n** If the SQLITE_JUMPIFNULL bit of P5 is set and either reg(P1) or\n** reg(P3) is NULL then the take the jump.  If the SQLITE_JUMPIFNULL \n** bit is clear then fall through if either operand is NULL.\n**\n** The SQLITE_AFF_MASK portion of P5 must be an affinity character -\n** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made \n** to coerce both inputs according to this affinity before the\n** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric\n** affinity is used. Note that the affinity conversions are stored\n** back into the input registers P1 and P3.  So this opcode can cause\n** persistent changes to registers P1 and P3.\n**\n** Once any conversions have taken place, and neither value is NULL, \n** the values are compared. If both values are blobs then memcmp() is\n** used to determine the results of the comparison.  If both values\n** are text, then the appropriate collating function specified in\n** P4 is  used to do the comparison.  If P4 is not specified then\n** memcmp() is used to compare text string.  If both values are\n** numeric, then a numeric comparison is used. If the two values\n** are of different types, then numbers are considered less than\n** strings and strings are considered less than blobs.\n*/\n/* Opcode: Le P1 P2 P3 P4 P5\n** Synopsis: IF r[P3]<=r[P1]\n**\n** This works just like the Lt opcode except that the jump is taken if\n** the content of register P3 is less than or equal to the content of\n** register P1.  See the Lt opcode for additional information.\n*/\n/* Opcode: Gt P1 P2 P3 P4 P5\n** Synopsis: IF r[P3]>r[P1]\n**\n** This works just like the Lt opcode except that the jump is taken if\n** the content of register P3 is greater than the content of\n** register P1.  See the Lt opcode for additional information.\n*/\n/* Opcode: Ge P1 P2 P3 P4 P5\n** Synopsis: IF r[P3]>=r[P1]\n**\n** This works just like the Lt opcode except that the jump is taken if\n** the content of register P3 is greater than or equal to the content of\n** register P1.  See the Lt opcode for additional information.\n*/\ncase OP_Eq:               /* same as TK_EQ, jump, in1, in3 */\ncase OP_Ne:               /* same as TK_NE, jump, in1, in3 */\ncase OP_Lt:               /* same as TK_LT, jump, in1, in3 */\ncase OP_Le:               /* same as TK_LE, jump, in1, in3 */\ncase OP_Gt:               /* same as TK_GT, jump, in1, in3 */\ncase OP_Ge: {             /* same as TK_GE, jump, in1, in3 */\n  int res, res2;      /* Result of the comparison of pIn1 against pIn3 */\n  char affinity;      /* Affinity to use for comparison */\n  u16 flags1;         /* Copy of initial value of pIn1->flags */\n  u16 flags3;         /* Copy of initial value of pIn3->flags */\n\n  pIn1 = &aMem[pOp->p1];\n  pIn3 = &aMem[pOp->p3];\n  flags1 = pIn1->flags;\n  flags3 = pIn3->flags;\n  if( (flags1 | flags3)&MEM_Null ){\n    /* One or both operands are NULL */\n    if( pOp->p5 & SQLITE_NULLEQ ){\n      /* If SQLITE_NULLEQ is set (which will only happen if the operator is\n      ** OP_Eq or OP_Ne) then take the jump or not depending on whether\n      ** or not both operands are null.\n      */\n      assert( pOp->opcode==OP_Eq || pOp->opcode==OP_Ne );\n      assert( (flags1 & MEM_Cleared)==0 );\n      assert( (pOp->p5 & SQLITE_JUMPIFNULL)==0 );\n      if( (flags1&MEM_Null)!=0\n       && (flags3&MEM_Null)!=0\n       && (flags3&MEM_Cleared)==0\n      ){\n        res = 0;  /* Operands are equal */\n      }else{\n        res = 1;  /* Operands are not equal */\n      }\n    }else{\n      /* SQLITE_NULLEQ is clear and at least one operand is NULL,\n      ** then the result is always NULL.\n      ** The jump is taken if the SQLITE_JUMPIFNULL bit is set.\n      */\n      if( pOp->p5 & SQLITE_STOREP2 ){\n        pOut = &aMem[pOp->p2];\n        iCompare = 1;    /* Operands are not equal */\n        memAboutToChange(p, pOut);\n        MemSetTypeFlag(pOut, MEM_Null);\n        REGISTER_TRACE(pOp->p2, pOut);\n      }else{\n        VdbeBranchTaken(2,3);\n        if( pOp->p5 & SQLITE_JUMPIFNULL ){\n          goto jump_to_p2;\n        }\n      }\n      break;\n    }\n  }else{\n    /* Neither operand is NULL.  Do a comparison. */\n    affinity = pOp->p5 & SQLITE_AFF_MASK;\n    if( affinity>=SQLITE_AFF_NUMERIC ){\n      if( (flags1 | flags3)&MEM_Str ){\n        if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){\n          applyNumericAffinity(pIn1,0);\n          testcase( flags3!=pIn3->flags ); /* Possible if pIn1==pIn3 */\n          flags3 = pIn3->flags;\n        }\n        if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){\n          applyNumericAffinity(pIn3,0);\n        }\n      }\n      /* Handle the common case of integer comparison here, as an\n      ** optimization, to avoid a call to sqlite3MemCompare() */\n      if( (pIn1->flags & pIn3->flags & MEM_Int)!=0 ){\n        if( pIn3->u.i > pIn1->u.i ){ res = +1; goto compare_op; }\n        if( pIn3->u.i < pIn1->u.i ){ res = -1; goto compare_op; }\n        res = 0;\n        goto compare_op;\n      }\n    }else if( affinity==SQLITE_AFF_TEXT ){\n      if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){\n        testcase( pIn1->flags & MEM_Int );\n        testcase( pIn1->flags & MEM_Real );\n        sqlite3VdbeMemStringify(pIn1, encoding, 1);\n        testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );\n        flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);\n        assert( pIn1!=pIn3 );\n      }\n      if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){\n        testcase( pIn3->flags & MEM_Int );\n        testcase( pIn3->flags & MEM_Real );\n        sqlite3VdbeMemStringify(pIn3, encoding, 1);\n        testcase( (flags3&MEM_Dyn) != (pIn3->flags&MEM_Dyn) );\n        flags3 = (pIn3->flags & ~MEM_TypeMask) | (flags3 & MEM_TypeMask);\n      }\n    }\n    assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );\n    res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);\n  }\ncompare_op:\n  switch( pOp->opcode ){\n    case OP_Eq:    res2 = res==0;     break;\n    case OP_Ne:    res2 = res;        break;\n    case OP_Lt:    res2 = res<0;      break;\n    case OP_Le:    res2 = res<=0;     break;\n    case OP_Gt:    res2 = res>0;      break;\n    default:       res2 = res>=0;     break;\n  }\n\n  /* Undo any changes made by applyAffinity() to the input registers. */\n  assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) );\n  pIn1->flags = flags1;\n  assert( (pIn3->flags & MEM_Dyn) == (flags3 & MEM_Dyn) );\n  pIn3->flags = flags3;\n\n  if( pOp->p5 & SQLITE_STOREP2 ){\n    pOut = &aMem[pOp->p2];\n    iCompare = res;\n    res2 = res2!=0;  /* For this path res2 must be exactly 0 or 1 */\n    if( (pOp->p5 & SQLITE_KEEPNULL)!=0 ){\n      /* The KEEPNULL flag prevents OP_Eq from overwriting a NULL with 1\n      ** and prevents OP_Ne from overwriting NULL with 0.  This flag\n      ** is only used in contexts where either:\n      **   (1) op==OP_Eq && (r[P2]==NULL || r[P2]==0)\n      **   (2) op==OP_Ne && (r[P2]==NULL || r[P2]==1)\n      ** Therefore it is not necessary to check the content of r[P2] for\n      ** NULL. */\n      assert( pOp->opcode==OP_Ne || pOp->opcode==OP_Eq );\n      assert( res2==0 || res2==1 );\n      testcase( res2==0 && pOp->opcode==OP_Eq );\n      testcase( res2==1 && pOp->opcode==OP_Eq );\n      testcase( res2==0 && pOp->opcode==OP_Ne );\n      testcase( res2==1 && pOp->opcode==OP_Ne );\n      if( (pOp->opcode==OP_Eq)==res2 ) break;\n    }\n    memAboutToChange(p, pOut);\n    MemSetTypeFlag(pOut, MEM_Int);\n    pOut->u.i = res2;\n    REGISTER_TRACE(pOp->p2, pOut);\n  }else{\n    VdbeBranchTaken(res!=0, (pOp->p5 & SQLITE_NULLEQ)?2:3);\n    if( res2 ){\n      goto jump_to_p2;\n    }\n  }\n  break;\n}\n\n/* Opcode: ElseNotEq * P2 * * *\n**\n** This opcode must immediately follow an OP_Lt or OP_Gt comparison operator.\n** If result of an OP_Eq comparison on the same two operands\n** would have be NULL or false (0), then then jump to P2. \n** If the result of an OP_Eq comparison on the two previous operands\n** would have been true (1), then fall through.\n*/\ncase OP_ElseNotEq: {       /* same as TK_ESCAPE, jump */\n  assert( pOp>aOp );\n  assert( pOp[-1].opcode==OP_Lt || pOp[-1].opcode==OP_Gt );\n  assert( pOp[-1].p5 & SQLITE_STOREP2 );\n  VdbeBranchTaken(iCompare!=0, 2);\n  if( iCompare!=0 ) goto jump_to_p2;\n  break;\n}\n\n\n/* Opcode: Permutation * * * P4 *\n**\n** Set the permutation used by the OP_Compare operator to be the array\n** of integers in P4.\n**\n** The permutation is only valid until the next OP_Compare that has\n** the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should \n** occur immediately prior to the OP_Compare.\n**\n** The first integer in the P4 integer array is the length of the array\n** and does not become part of the permutation.\n*/\ncase OP_Permutation: {\n  assert( pOp->p4type==P4_INTARRAY );\n  assert( pOp->p4.ai );\n  aPermute = pOp->p4.ai + 1;\n  break;\n}\n\n/* Opcode: Compare P1 P2 P3 P4 P5\n** Synopsis: r[P1@P3] <-> r[P2@P3]\n**\n** Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this\n** vector \"A\") and in reg(P2)..reg(P2+P3-1) (\"B\").  Save the result of\n** the comparison for use by the next OP_Jump instruct.\n**\n** If P5 has the OPFLAG_PERMUTE bit set, then the order of comparison is\n** determined by the most recent OP_Permutation operator.  If the\n** OPFLAG_PERMUTE bit is clear, then register are compared in sequential\n** order.\n**\n** P4 is a KeyInfo structure that defines collating sequences and sort\n** orders for the comparison.  The permutation applies to registers\n** only.  The KeyInfo elements are used sequentially.\n**\n** The comparison is a sort comparison, so NULLs compare equal,\n** NULLs are less than numbers, numbers are less than strings,\n** and strings are less than blobs.\n*/\ncase OP_Compare: {\n  int n;\n  int i;\n  int p1;\n  int p2;\n  const KeyInfo *pKeyInfo;\n  int idx;\n  CollSeq *pColl;    /* Collating sequence to use on this term */\n  int bRev;          /* True for DESCENDING sort order */\n\n  if( (pOp->p5 & OPFLAG_PERMUTE)==0 ) aPermute = 0;\n  n = pOp->p3;\n  pKeyInfo = pOp->p4.pKeyInfo;\n  assert( n>0 );\n  assert( pKeyInfo!=0 );\n  p1 = pOp->p1;\n  p2 = pOp->p2;\n#if SQLITE_DEBUG\n  if( aPermute ){\n    int k, mx = 0;\n    for(k=0; k<n; k++) if( aPermute[k]>mx ) mx = aPermute[k];\n    assert( p1>0 && p1+mx<=(p->nMem+1 - p->nCursor)+1 );\n    assert( p2>0 && p2+mx<=(p->nMem+1 - p->nCursor)+1 );\n  }else{\n    assert( p1>0 && p1+n<=(p->nMem+1 - p->nCursor)+1 );\n    assert( p2>0 && p2+n<=(p->nMem+1 - p->nCursor)+1 );\n  }\n#endif /* SQLITE_DEBUG */\n  for(i=0; i<n; i++){\n    idx = aPermute ? aPermute[i] : i;\n    assert( memIsValid(&aMem[p1+idx]) );\n    assert( memIsValid(&aMem[p2+idx]) );\n    REGISTER_TRACE(p1+idx, &aMem[p1+idx]);\n    REGISTER_TRACE(p2+idx, &aMem[p2+idx]);\n    assert( i<pKeyInfo->nField );\n    pColl = pKeyInfo->aColl[i];\n    bRev = pKeyInfo->aSortOrder[i];\n    iCompare = sqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl);\n    if( iCompare ){\n      if( bRev ) iCompare = -iCompare;\n      break;\n    }\n  }\n  aPermute = 0;\n  break;\n}\n\n/* Opcode: Jump P1 P2 P3 * *\n**\n** Jump to the instruction at address P1, P2, or P3 depending on whether\n** in the most recent OP_Compare instruction the P1 vector was less than\n** equal to, or greater than the P2 vector, respectively.\n*/\ncase OP_Jump: {             /* jump */\n  if( iCompare<0 ){\n    VdbeBranchTaken(0,3); pOp = &aOp[pOp->p1 - 1];\n  }else if( iCompare==0 ){\n    VdbeBranchTaken(1,3); pOp = &aOp[pOp->p2 - 1];\n  }else{\n    VdbeBranchTaken(2,3); pOp = &aOp[pOp->p3 - 1];\n  }\n  break;\n}\n\n/* Opcode: And P1 P2 P3 * *\n** Synopsis: r[P3]=(r[P1] && r[P2])\n**\n** Take the logical AND of the values in registers P1 and P2 and\n** write the result into register P3.\n**\n** If either P1 or P2 is 0 (false) then the result is 0 even if\n** the other input is NULL.  A NULL and true or two NULLs give\n** a NULL output.\n*/\n/* Opcode: Or P1 P2 P3 * *\n** Synopsis: r[P3]=(r[P1] || r[P2])\n**\n** Take the logical OR of the values in register P1 and P2 and\n** store the answer in register P3.\n**\n** If either P1 or P2 is nonzero (true) then the result is 1 (true)\n** even if the other input is NULL.  A NULL and false or two NULLs\n** give a NULL output.\n*/\ncase OP_And:              /* same as TK_AND, in1, in2, out3 */\ncase OP_Or: {             /* same as TK_OR, in1, in2, out3 */\n  int v1;    /* Left operand:  0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */\n  int v2;    /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */\n\n  pIn1 = &aMem[pOp->p1];\n  if( pIn1->flags & MEM_Null ){\n    v1 = 2;\n  }else{\n    v1 = sqlite3VdbeIntValue(pIn1)!=0;\n  }\n  pIn2 = &aMem[pOp->p2];\n  if( pIn2->flags & MEM_Null ){\n    v2 = 2;\n  }else{\n    v2 = sqlite3VdbeIntValue(pIn2)!=0;\n  }\n  if( pOp->opcode==OP_And ){\n    static const unsigned char and_logic[] = { 0, 0, 0, 0, 1, 2, 0, 2, 2 };\n    v1 = and_logic[v1*3+v2];\n  }else{\n    static const unsigned char or_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 };\n    v1 = or_logic[v1*3+v2];\n  }\n  pOut = &aMem[pOp->p3];\n  if( v1==2 ){\n    MemSetTypeFlag(pOut, MEM_Null);\n  }else{\n    pOut->u.i = v1;\n    MemSetTypeFlag(pOut, MEM_Int);\n  }\n  break;\n}\n\n/* Opcode: Not P1 P2 * * *\n** Synopsis: r[P2]= !r[P1]\n**\n** Interpret the value in register P1 as a boolean value.  Store the\n** boolean complement in register P2.  If the value in register P1 is \n** NULL, then a NULL is stored in P2.\n*/\ncase OP_Not: {                /* same as TK_NOT, in1, out2 */\n  pIn1 = &aMem[pOp->p1];\n  pOut = &aMem[pOp->p2];\n  sqlite3VdbeMemSetNull(pOut);\n  if( (pIn1->flags & MEM_Null)==0 ){\n    pOut->flags = MEM_Int;\n    pOut->u.i = !sqlite3VdbeIntValue(pIn1);\n  }\n  break;\n}\n\n/* Opcode: BitNot P1 P2 * * *\n** Synopsis: r[P1]= ~r[P1]\n**\n** Interpret the content of register P1 as an integer.  Store the\n** ones-complement of the P1 value into register P2.  If P1 holds\n** a NULL then store a NULL in P2.\n*/\ncase OP_BitNot: {             /* same as TK_BITNOT, in1, out2 */\n  pIn1 = &aMem[pOp->p1];\n  pOut = &aMem[pOp->p2];\n  sqlite3VdbeMemSetNull(pOut);\n  if( (pIn1->flags & MEM_Null)==0 ){\n    pOut->flags = MEM_Int;\n    pOut->u.i = ~sqlite3VdbeIntValue(pIn1);\n  }\n  break;\n}\n\n/* Opcode: Once P1 P2 * * *\n**\n** If the P1 value is equal to the P1 value on the OP_Init opcode at\n** instruction 0, then jump to P2.  If the two P1 values differ, then\n** set the P1 value on this opcode to equal the P1 value on the OP_Init\n** and fall through.\n*/\ncase OP_Once: {             /* jump */\n  assert( p->aOp[0].opcode==OP_Init );\n  VdbeBranchTaken(p->aOp[0].p1==pOp->p1, 2);\n  if( p->aOp[0].p1==pOp->p1 ){\n    goto jump_to_p2;\n  }else{\n    pOp->p1 = p->aOp[0].p1;\n  }\n  break;\n}\n\n/* Opcode: If P1 P2 P3 * *\n**\n** Jump to P2 if the value in register P1 is true.  The value\n** is considered true if it is numeric and non-zero.  If the value\n** in P1 is NULL then take the jump if and only if P3 is non-zero.\n*/\n/* Opcode: IfNot P1 P2 P3 * *\n**\n** Jump to P2 if the value in register P1 is False.  The value\n** is considered false if it has a numeric value of zero.  If the value\n** in P1 is NULL then take the jump if and only if P3 is non-zero.\n*/\ncase OP_If:                 /* jump, in1 */\ncase OP_IfNot: {            /* jump, in1 */\n  int c;\n  pIn1 = &aMem[pOp->p1];\n  if( pIn1->flags & MEM_Null ){\n    c = pOp->p3;\n  }else{\n#ifdef SQLITE_OMIT_FLOATING_POINT\n    c = sqlite3VdbeIntValue(pIn1)!=0;\n#else\n    c = sqlite3VdbeRealValue(pIn1)!=0.0;\n#endif\n    if( pOp->opcode==OP_IfNot ) c = !c;\n  }\n  VdbeBranchTaken(c!=0, 2);\n  if( c ){\n    goto jump_to_p2;\n  }\n  break;\n}\n\n/* Opcode: IsNull P1 P2 * * *\n** Synopsis: if r[P1]==NULL goto P2\n**\n** Jump to P2 if the value in register P1 is NULL.\n*/\ncase OP_IsNull: {            /* same as TK_ISNULL, jump, in1 */\n  pIn1 = &aMem[pOp->p1];\n  VdbeBranchTaken( (pIn1->flags & MEM_Null)!=0, 2);\n  if( (pIn1->flags & MEM_Null)!=0 ){\n    goto jump_to_p2;\n  }\n  break;\n}\n\n/* Opcode: NotNull P1 P2 * * *\n** Synopsis: if r[P1]!=NULL goto P2\n**\n** Jump to P2 if the value in register P1 is not NULL.  \n*/\ncase OP_NotNull: {            /* same as TK_NOTNULL, jump, in1 */\n  pIn1 = &aMem[pOp->p1];\n  VdbeBranchTaken( (pIn1->flags & MEM_Null)==0, 2);\n  if( (pIn1->flags & MEM_Null)==0 ){\n    goto jump_to_p2;\n  }\n  break;\n}\n\n/* Opcode: Column P1 P2 P3 P4 P5\n** Synopsis: r[P3]=PX\n**\n** Interpret the data that cursor P1 points to as a structure built using\n** the MakeRecord instruction.  (See the MakeRecord opcode for additional\n** information about the format of the data.)  Extract the P2-th column\n** from this record.  If there are less that (P2+1) \n** values in the record, extract a NULL.\n**\n** The value extracted is stored in register P3.\n**\n** If the column contains fewer than P2 fields, then extract a NULL.  Or,\n** if the P4 argument is a P4_MEM use the value of the P4 argument as\n** the result.\n**\n** If the OPFLAG_CLEARCACHE bit is set on P5 and P1 is a pseudo-table cursor,\n** then the cache of the cursor is reset prior to extracting the column.\n** The first OP_Column against a pseudo-table after the value of the content\n** register has changed should have this bit set.\n**\n** If the OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG bits are set on P5 when\n** the result is guaranteed to only be used as the argument of a length()\n** or typeof() function, respectively.  The loading of large blobs can be\n** skipped for length() and all content loading can be skipped for typeof().\n*/\ncase OP_Column: {\n  int p2;            /* column number to retrieve */\n  VdbeCursor *pC;    /* The VDBE cursor */\n  BtCursor *pCrsr;   /* The BTree cursor */\n  u32 *aOffset;      /* aOffset[i] is offset to start of data for i-th column */\n  int len;           /* The length of the serialized data for the column */\n  int i;             /* Loop counter */\n  Mem *pDest;        /* Where to write the extracted value */\n  Mem sMem;          /* For storing the record being decoded */\n  const u8 *zData;   /* Part of the record being decoded */\n  const u8 *zHdr;    /* Next unparsed byte of the header */\n  const u8 *zEndHdr; /* Pointer to first byte after the header */\n  u32 offset;        /* Offset into the data */\n  u64 offset64;      /* 64-bit offset */\n  u32 avail;         /* Number of bytes of available data */\n  u32 t;             /* A type code from the record header */\n  Mem *pReg;         /* PseudoTable input register */\n\n  pC = p->apCsr[pOp->p1];\n  p2 = pOp->p2;\n\n  /* If the cursor cache is stale, bring it up-to-date */\n  rc = sqlite3VdbeCursorMoveto(&pC, &p2);\n  if( rc ) goto abort_due_to_error;\n\n  assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );\n  pDest = &aMem[pOp->p3];\n  memAboutToChange(p, pDest);\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  assert( pC!=0 );\n  assert( p2<pC->nField );\n  aOffset = pC->aOffset;\n  assert( pC->eCurType!=CURTYPE_VTAB );\n  assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );\n  assert( pC->eCurType!=CURTYPE_SORTER );\n  pCrsr = pC->uc.pCursor;\n\n  if( pC->cacheStatus!=p->cacheCtr ){                /*OPTIMIZATION-IF-FALSE*/\n    if( pC->nullRow ){\n      if( pC->eCurType==CURTYPE_PSEUDO ){\n        assert( pC->uc.pseudoTableReg>0 );\n        pReg = &aMem[pC->uc.pseudoTableReg];\n        assert( pReg->flags & MEM_Blob );\n        assert( memIsValid(pReg) );\n        pC->payloadSize = pC->szRow = avail = pReg->n;\n        pC->aRow = (u8*)pReg->z;\n      }else{\n        sqlite3VdbeMemSetNull(pDest);\n        goto op_column_out;\n      }\n    }else{\n      assert( pC->eCurType==CURTYPE_BTREE );\n      assert( pCrsr );\n      assert( sqlite3BtreeCursorIsValid(pCrsr) );\n      pC->payloadSize = sqlite3BtreePayloadSize(pCrsr);\n      pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &avail);\n      assert( avail<=65536 );  /* Maximum page size is 64KiB */\n      if( pC->payloadSize <= (u32)avail ){\n        pC->szRow = pC->payloadSize;\n      }else if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){\n        goto too_big;\n      }else{\n        pC->szRow = avail;\n      }\n    }\n    pC->cacheStatus = p->cacheCtr;\n    pC->iHdrOffset = getVarint32(pC->aRow, offset);\n    pC->nHdrParsed = 0;\n    aOffset[0] = offset;\n\n\n    if( avail<offset ){      /*OPTIMIZATION-IF-FALSE*/\n      /* pC->aRow does not have to hold the entire row, but it does at least\n      ** need to cover the header of the record.  If pC->aRow does not contain\n      ** the complete header, then set it to zero, forcing the header to be\n      ** dynamically allocated. */\n      pC->aRow = 0;\n      pC->szRow = 0;\n\n      /* Make sure a corrupt database has not given us an oversize header.\n      ** Do this now to avoid an oversize memory allocation.\n      **\n      ** Type entries can be between 1 and 5 bytes each.  But 4 and 5 byte\n      ** types use so much data space that there can only be 4096 and 32 of\n      ** them, respectively.  So the maximum header length results from a\n      ** 3-byte type for each of the maximum of 32768 columns plus three\n      ** extra bytes for the header length itself.  32768*3 + 3 = 98307.\n      */\n      if( offset > 98307 || offset > pC->payloadSize ){\n        rc = SQLITE_CORRUPT_BKPT;\n        goto abort_due_to_error;\n      }\n    }else if( offset>0 ){ /*OPTIMIZATION-IF-TRUE*/\n      /* The following goto is an optimization.  It can be omitted and\n      ** everything will still work.  But OP_Column is measurably faster\n      ** by skipping the subsequent conditional, which is always true.\n      */\n      zData = pC->aRow;\n      assert( pC->nHdrParsed<=p2 );         /* Conditional skipped */\n      goto op_column_read_header;\n    }\n  }\n\n  /* Make sure at least the first p2+1 entries of the header have been\n  ** parsed and valid information is in aOffset[] and pC->aType[].\n  */\n  if( pC->nHdrParsed<=p2 ){\n    /* If there is more header available for parsing in the record, try\n    ** to extract additional fields up through the p2+1-th field \n    */\n    if( pC->iHdrOffset<aOffset[0] ){\n      /* Make sure zData points to enough of the record to cover the header. */\n      if( pC->aRow==0 ){\n        memset(&sMem, 0, sizeof(sMem));\n        rc = sqlite3VdbeMemFromBtree(pCrsr, 0, aOffset[0], !pC->isTable, &sMem);\n        if( rc!=SQLITE_OK ) goto abort_due_to_error;\n        zData = (u8*)sMem.z;\n      }else{\n        zData = pC->aRow;\n      }\n  \n      /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */\n    op_column_read_header:\n      i = pC->nHdrParsed;\n      offset64 = aOffset[i];\n      zHdr = zData + pC->iHdrOffset;\n      zEndHdr = zData + aOffset[0];\n      do{\n        if( (t = zHdr[0])<0x80 ){\n          zHdr++;\n          offset64 += sqlite3VdbeOneByteSerialTypeLen(t);\n        }else{\n          zHdr += sqlite3GetVarint32(zHdr, &t);\n          offset64 += sqlite3VdbeSerialTypeLen(t);\n        }\n        pC->aType[i++] = t;\n        aOffset[i] = (u32)(offset64 & 0xffffffff);\n      }while( i<=p2 && zHdr<zEndHdr );\n\n      /* The record is corrupt if any of the following are true:\n      ** (1) the bytes of the header extend past the declared header size\n      ** (2) the entire header was used but not all data was used\n      ** (3) the end of the data extends beyond the end of the record.\n      */\n      if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize))\n       || (offset64 > pC->payloadSize)\n      ){\n        if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);\n        rc = SQLITE_CORRUPT_BKPT;\n        goto abort_due_to_error;\n      }\n\n      pC->nHdrParsed = i;\n      pC->iHdrOffset = (u32)(zHdr - zData);\n      if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);\n    }else{\n      t = 0;\n    }\n\n    /* If after trying to extract new entries from the header, nHdrParsed is\n    ** still not up to p2, that means that the record has fewer than p2\n    ** columns.  So the result will be either the default value or a NULL.\n    */\n    if( pC->nHdrParsed<=p2 ){\n      if( pOp->p4type==P4_MEM ){\n        sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static);\n      }else{\n        sqlite3VdbeMemSetNull(pDest);\n      }\n      goto op_column_out;\n    }\n  }else{\n    t = pC->aType[p2];\n  }\n\n  /* Extract the content for the p2+1-th column.  Control can only\n  ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are\n  ** all valid.\n  */\n  assert( p2<pC->nHdrParsed );\n  assert( rc==SQLITE_OK );\n  assert( sqlite3VdbeCheckMemInvariants(pDest) );\n  if( VdbeMemDynamic(pDest) ){\n    sqlite3VdbeMemSetNull(pDest);\n  }\n  assert( t==pC->aType[p2] );\n  if( pC->szRow>=aOffset[p2+1] ){\n    /* This is the common case where the desired content fits on the original\n    ** page - where the content is not on an overflow page */\n    zData = pC->aRow + aOffset[p2];\n    if( t<12 ){\n      sqlite3VdbeSerialGet(zData, t, pDest);\n    }else{\n      /* If the column value is a string, we need a persistent value, not\n      ** a MEM_Ephem value.  This branch is a fast short-cut that is equivalent\n      ** to calling sqlite3VdbeSerialGet() and sqlite3VdbeDeephemeralize().\n      */\n      static const u16 aFlag[] = { MEM_Blob, MEM_Str|MEM_Term };\n      pDest->n = len = (t-12)/2;\n      pDest->enc = encoding;\n      if( pDest->szMalloc < len+2 ){\n        pDest->flags = MEM_Null;\n        if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem;\n      }else{\n        pDest->z = pDest->zMalloc;\n      }\n      memcpy(pDest->z, zData, len);\n      pDest->z[len] = 0;\n      pDest->z[len+1] = 0;\n      pDest->flags = aFlag[t&1];\n    }\n  }else{\n    pDest->enc = encoding;\n    /* This branch happens only when content is on overflow pages */\n    if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0\n          && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))\n     || (len = sqlite3VdbeSerialTypeLen(t))==0\n    ){\n      /* Content is irrelevant for\n      **    1. the typeof() function,\n      **    2. the length(X) function if X is a blob, and\n      **    3. if the content length is zero.\n      ** So we might as well use bogus content rather than reading\n      ** content from disk. */\n      static u8 aZero[8];  /* This is the bogus content */\n      sqlite3VdbeSerialGet(aZero, t, pDest);\n    }else{\n      rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, !pC->isTable,\n                                   pDest);\n      if( rc!=SQLITE_OK ) goto abort_due_to_error;\n      sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);\n      pDest->flags &= ~MEM_Ephem;\n    }\n  }\n\nop_column_out:\n  UPDATE_MAX_BLOBSIZE(pDest);\n  REGISTER_TRACE(pOp->p3, pDest);\n  break;\n}\n\n/* Opcode: Affinity P1 P2 * P4 *\n** Synopsis: affinity(r[P1@P2])\n**\n** Apply affinities to a range of P2 registers starting with P1.\n**\n** P4 is a string that is P2 characters long. The nth character of the\n** string indicates the column affinity that should be used for the nth\n** memory cell in the range.\n*/\ncase OP_Affinity: {\n  const char *zAffinity;   /* The affinity to be applied */\n  char cAff;               /* A single character of affinity */\n\n  zAffinity = pOp->p4.z;\n  assert( zAffinity!=0 );\n  assert( zAffinity[pOp->p2]==0 );\n  pIn1 = &aMem[pOp->p1];\n  while( (cAff = *(zAffinity++))!=0 ){\n    assert( pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)] );\n    assert( memIsValid(pIn1) );\n    applyAffinity(pIn1, cAff, encoding);\n    pIn1++;\n  }\n  break;\n}\n\n/* Opcode: MakeRecord P1 P2 P3 P4 *\n** Synopsis: r[P3]=mkrec(r[P1@P2])\n**\n** Convert P2 registers beginning with P1 into the [record format]\n** use as a data record in a database table or as a key\n** in an index.  The OP_Column opcode can decode the record later.\n**\n** P4 may be a string that is P2 characters long.  The nth character of the\n** string indicates the column affinity that should be used for the nth\n** field of the index key.\n**\n** The mapping from character to affinity is given by the SQLITE_AFF_\n** macros defined in sqliteInt.h.\n**\n** If P4 is NULL then all index fields have the affinity BLOB.\n*/\ncase OP_MakeRecord: {\n  u8 *zNewRecord;        /* A buffer to hold the data for the new record */\n  Mem *pRec;             /* The new record */\n  u64 nData;             /* Number of bytes of data space */\n  int nHdr;              /* Number of bytes of header space */\n  i64 nByte;             /* Data space required for this record */\n  i64 nZero;             /* Number of zero bytes at the end of the record */\n  int nVarint;           /* Number of bytes in a varint */\n  u32 serial_type;       /* Type field */\n  Mem *pData0;           /* First field to be combined into the record */\n  Mem *pLast;            /* Last field of the record */\n  int nField;            /* Number of fields in the record */\n  char *zAffinity;       /* The affinity string for the record */\n  int file_format;       /* File format to use for encoding */\n  int i;                 /* Space used in zNewRecord[] header */\n  int j;                 /* Space used in zNewRecord[] content */\n  u32 len;               /* Length of a field */\n\n  /* Assuming the record contains N fields, the record format looks\n  ** like this:\n  **\n  ** ------------------------------------------------------------------------\n  ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | \n  ** ------------------------------------------------------------------------\n  **\n  ** Data(0) is taken from register P1.  Data(1) comes from register P1+1\n  ** and so forth.\n  **\n  ** Each type field is a varint representing the serial type of the \n  ** corresponding data element (see sqlite3VdbeSerialType()). The\n  ** hdr-size field is also a varint which is the offset from the beginning\n  ** of the record to data0.\n  */\n  nData = 0;         /* Number of bytes of data space */\n  nHdr = 0;          /* Number of bytes of header space */\n  nZero = 0;         /* Number of zero bytes at the end of the record */\n  nField = pOp->p1;\n  zAffinity = pOp->p4.z;\n  assert( nField>0 && pOp->p2>0 && pOp->p2+nField<=(p->nMem+1 - p->nCursor)+1 );\n  pData0 = &aMem[nField];\n  nField = pOp->p2;\n  pLast = &pData0[nField-1];\n  file_format = p->minWriteFileFormat;\n\n  /* Identify the output register */\n  assert( pOp->p3<pOp->p1 || pOp->p3>=pOp->p1+pOp->p2 );\n  pOut = &aMem[pOp->p3];\n  memAboutToChange(p, pOut);\n\n  /* Apply the requested affinity to all inputs\n  */\n  assert( pData0<=pLast );\n  if( zAffinity ){\n    pRec = pData0;\n    do{\n      applyAffinity(pRec++, *(zAffinity++), encoding);\n      assert( zAffinity[0]==0 || pRec<=pLast );\n    }while( zAffinity[0] );\n  }\n\n  /* Loop through the elements that will make up the record to figure\n  ** out how much space is required for the new record.\n  */\n  pRec = pLast;\n  do{\n    assert( memIsValid(pRec) );\n    pRec->uTemp = serial_type = sqlite3VdbeSerialType(pRec, file_format, &len);\n    if( pRec->flags & MEM_Zero ){\n      if( nData ){\n        if( sqlite3VdbeMemExpandBlob(pRec) ) goto no_mem;\n      }else{\n        nZero += pRec->u.nZero;\n        len -= pRec->u.nZero;\n      }\n    }\n    nData += len;\n    testcase( serial_type==127 );\n    testcase( serial_type==128 );\n    nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type);\n    if( pRec==pData0 ) break;\n    pRec--;\n  }while(1);\n\n  /* EVIDENCE-OF: R-22564-11647 The header begins with a single varint\n  ** which determines the total number of bytes in the header. The varint\n  ** value is the size of the header in bytes including the size varint\n  ** itself. */\n  testcase( nHdr==126 );\n  testcase( nHdr==127 );\n  if( nHdr<=126 ){\n    /* The common case */\n    nHdr += 1;\n  }else{\n    /* Rare case of a really large header */\n    nVarint = sqlite3VarintLen(nHdr);\n    nHdr += nVarint;\n    if( nVarint<sqlite3VarintLen(nHdr) ) nHdr++;\n  }\n  nByte = nHdr+nData;\n  if( nByte+nZero>db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    goto too_big;\n  }\n\n  /* Make sure the output register has a buffer large enough to store \n  ** the new record. The output register (pOp->p3) is not allowed to\n  ** be one of the input registers (because the following call to\n  ** sqlite3VdbeMemClearAndResize() could clobber the value before it is used).\n  */\n  if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){\n    goto no_mem;\n  }\n  zNewRecord = (u8 *)pOut->z;\n\n  /* Write the record */\n  i = putVarint32(zNewRecord, nHdr);\n  j = nHdr;\n  assert( pData0<=pLast );\n  pRec = pData0;\n  do{\n    serial_type = pRec->uTemp;\n    /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more\n    ** additional varints, one per column. */\n    i += putVarint32(&zNewRecord[i], serial_type);            /* serial type */\n    /* EVIDENCE-OF: R-64536-51728 The values for each column in the record\n    ** immediately follow the header. */\n    j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */\n  }while( (++pRec)<=pLast );\n  assert( i==nHdr );\n  assert( j==nByte );\n\n  assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );\n  pOut->n = (int)nByte;\n  pOut->flags = MEM_Blob;\n  if( nZero ){\n    pOut->u.nZero = nZero;\n    pOut->flags |= MEM_Zero;\n  }\n  pOut->enc = SQLITE_UTF8;  /* In case the blob is ever converted to text */\n  REGISTER_TRACE(pOp->p3, pOut);\n  UPDATE_MAX_BLOBSIZE(pOut);\n  break;\n}\n\n/* Opcode: Count P1 P2 * * *\n** Synopsis: r[P2]=count()\n**\n** Store the number of entries (an integer value) in the table or index \n** opened by cursor P1 in register P2\n*/\n#ifndef SQLITE_OMIT_BTREECOUNT\ncase OP_Count: {         /* out2 */\n  i64 nEntry;\n  BtCursor *pCrsr;\n\n  assert( p->apCsr[pOp->p1]->eCurType==CURTYPE_BTREE );\n  pCrsr = p->apCsr[pOp->p1]->uc.pCursor;\n  assert( pCrsr );\n  nEntry = 0;  /* Not needed.  Only used to silence a warning. */\n  rc = sqlite3BtreeCount(pCrsr, &nEntry);\n  if( rc ) goto abort_due_to_error;\n  pOut = out2Prerelease(p, pOp);\n  pOut->u.i = nEntry;\n  break;\n}\n#endif\n\n/* Opcode: Savepoint P1 * * P4 *\n**\n** Open, release or rollback the savepoint named by parameter P4, depending\n** on the value of P1. To open a new savepoint, P1==0. To release (commit) an\n** existing savepoint, P1==1, or to rollback an existing savepoint P1==2.\n*/\ncase OP_Savepoint: {\n  int p1;                         /* Value of P1 operand */\n  char *zName;                    /* Name of savepoint */\n  int nName;\n  Savepoint *pNew;\n  Savepoint *pSavepoint;\n  Savepoint *pTmp;\n  int iSavepoint;\n  int ii;\n\n  p1 = pOp->p1;\n  zName = pOp->p4.z;\n\n  /* Assert that the p1 parameter is valid. Also that if there is no open\n  ** transaction, then there cannot be any savepoints. \n  */\n  assert( db->pSavepoint==0 || db->autoCommit==0 );\n  assert( p1==SAVEPOINT_BEGIN||p1==SAVEPOINT_RELEASE||p1==SAVEPOINT_ROLLBACK );\n  assert( db->pSavepoint || db->isTransactionSavepoint==0 );\n  assert( checkSavepointCount(db) );\n  assert( p->bIsReader );\n\n  if( p1==SAVEPOINT_BEGIN ){\n    if( db->nVdbeWrite>0 ){\n      /* A new savepoint cannot be created if there are active write \n      ** statements (i.e. open read/write incremental blob handles).\n      */\n      sqlite3VdbeError(p, \"cannot open savepoint - SQL statements in progress\");\n      rc = SQLITE_BUSY;\n    }else{\n      nName = sqlite3Strlen30(zName);\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n      /* This call is Ok even if this savepoint is actually a transaction\n      ** savepoint (and therefore should not prompt xSavepoint()) callbacks.\n      ** If this is a transaction savepoint being opened, it is guaranteed\n      ** that the db->aVTrans[] array is empty.  */\n      assert( db->autoCommit==0 || db->nVTrans==0 );\n      rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN,\n                                db->nStatement+db->nSavepoint);\n      if( rc!=SQLITE_OK ) goto abort_due_to_error;\n#endif\n\n      /* Create a new savepoint structure. */\n      pNew = sqlite3DbMallocRawNN(db, sizeof(Savepoint)+nName+1);\n      if( pNew ){\n        pNew->zName = (char *)&pNew[1];\n        memcpy(pNew->zName, zName, nName+1);\n    \n        /* If there is no open transaction, then mark this as a special\n        ** \"transaction savepoint\". */\n        if( db->autoCommit ){\n          db->autoCommit = 0;\n          db->isTransactionSavepoint = 1;\n        }else{\n          db->nSavepoint++;\n        }\n\n        /* Link the new savepoint into the database handle's list. */\n        pNew->pNext = db->pSavepoint;\n        db->pSavepoint = pNew;\n        pNew->nDeferredCons = db->nDeferredCons;\n        pNew->nDeferredImmCons = db->nDeferredImmCons;\n      }\n    }\n  }else{\n    iSavepoint = 0;\n\n    /* Find the named savepoint. If there is no such savepoint, then an\n    ** an error is returned to the user.  */\n    for(\n      pSavepoint = db->pSavepoint; \n      pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName);\n      pSavepoint = pSavepoint->pNext\n    ){\n      iSavepoint++;\n    }\n    if( !pSavepoint ){\n      sqlite3VdbeError(p, \"no such savepoint: %s\", zName);\n      rc = SQLITE_ERROR;\n    }else if( db->nVdbeWrite>0 && p1==SAVEPOINT_RELEASE ){\n      /* It is not possible to release (commit) a savepoint if there are \n      ** active write statements.\n      */\n      sqlite3VdbeError(p, \"cannot release savepoint - \"\n                          \"SQL statements in progress\");\n      rc = SQLITE_BUSY;\n    }else{\n\n      /* Determine whether or not this is a transaction savepoint. If so,\n      ** and this is a RELEASE command, then the current transaction \n      ** is committed. \n      */\n      int isTransaction = pSavepoint->pNext==0 && db->isTransactionSavepoint;\n      if( isTransaction && p1==SAVEPOINT_RELEASE ){\n        if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){\n          goto vdbe_return;\n        }\n        db->autoCommit = 1;\n        if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){\n          p->pc = (int)(pOp - aOp);\n          db->autoCommit = 0;\n          p->rc = rc = SQLITE_BUSY;\n          goto vdbe_return;\n        }\n        db->isTransactionSavepoint = 0;\n        rc = p->rc;\n      }else{\n        int isSchemaChange;\n        iSavepoint = db->nSavepoint - iSavepoint - 1;\n        if( p1==SAVEPOINT_ROLLBACK ){\n          isSchemaChange = (db->flags & SQLITE_InternChanges)!=0;\n          for(ii=0; ii<db->nDb; ii++){\n            rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,\n                                       SQLITE_ABORT_ROLLBACK,\n                                       isSchemaChange==0);\n            if( rc!=SQLITE_OK ) goto abort_due_to_error;\n          }\n        }else{\n          isSchemaChange = 0;\n        }\n        for(ii=0; ii<db->nDb; ii++){\n          rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);\n          if( rc!=SQLITE_OK ){\n            goto abort_due_to_error;\n          }\n        }\n        if( isSchemaChange ){\n          sqlite3ExpirePreparedStatements(db);\n          sqlite3ResetAllSchemasOfConnection(db);\n          db->flags = (db->flags | SQLITE_InternChanges);\n        }\n      }\n  \n      /* Regardless of whether this is a RELEASE or ROLLBACK, destroy all \n      ** savepoints nested inside of the savepoint being operated on. */\n      while( db->pSavepoint!=pSavepoint ){\n        pTmp = db->pSavepoint;\n        db->pSavepoint = pTmp->pNext;\n        sqlite3DbFree(db, pTmp);\n        db->nSavepoint--;\n      }\n\n      /* If it is a RELEASE, then destroy the savepoint being operated on \n      ** too. If it is a ROLLBACK TO, then set the number of deferred \n      ** constraint violations present in the database to the value stored\n      ** when the savepoint was created.  */\n      if( p1==SAVEPOINT_RELEASE ){\n        assert( pSavepoint==db->pSavepoint );\n        db->pSavepoint = pSavepoint->pNext;\n        sqlite3DbFree(db, pSavepoint);\n        if( !isTransaction ){\n          db->nSavepoint--;\n        }\n      }else{\n        db->nDeferredCons = pSavepoint->nDeferredCons;\n        db->nDeferredImmCons = pSavepoint->nDeferredImmCons;\n      }\n\n      if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){\n        rc = sqlite3VtabSavepoint(db, p1, iSavepoint);\n        if( rc!=SQLITE_OK ) goto abort_due_to_error;\n      }\n    }\n  }\n  if( rc ) goto abort_due_to_error;\n\n  break;\n}\n\n/* Opcode: AutoCommit P1 P2 * * *\n**\n** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll\n** back any currently active btree transactions. If there are any active\n** VMs (apart from this one), then a ROLLBACK fails.  A COMMIT fails if\n** there are active writing VMs or active VMs that use shared cache.\n**\n** This instruction causes the VM to halt.\n*/\ncase OP_AutoCommit: {\n  int desiredAutoCommit;\n  int iRollback;\n\n  desiredAutoCommit = pOp->p1;\n  iRollback = pOp->p2;\n  assert( desiredAutoCommit==1 || desiredAutoCommit==0 );\n  assert( desiredAutoCommit==1 || iRollback==0 );\n  assert( db->nVdbeActive>0 );  /* At least this one VM is active */\n  assert( p->bIsReader );\n\n  if( desiredAutoCommit!=db->autoCommit ){\n    if( iRollback ){\n      assert( desiredAutoCommit==1 );\n      sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\n      db->autoCommit = 1;\n    }else if( desiredAutoCommit && db->nVdbeWrite>0 ){\n      /* If this instruction implements a COMMIT and other VMs are writing\n      ** return an error indicating that the other VMs must complete first. \n      */\n      sqlite3VdbeError(p, \"cannot commit transaction - \"\n                          \"SQL statements in progress\");\n      rc = SQLITE_BUSY;\n      goto abort_due_to_error;\n    }else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){\n      goto vdbe_return;\n    }else{\n      db->autoCommit = (u8)desiredAutoCommit;\n    }\n    if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){\n      p->pc = (int)(pOp - aOp);\n      db->autoCommit = (u8)(1-desiredAutoCommit);\n      p->rc = rc = SQLITE_BUSY;\n      goto vdbe_return;\n    }\n    assert( db->nStatement==0 );\n    sqlite3CloseSavepoints(db);\n    if( p->rc==SQLITE_OK ){\n      rc = SQLITE_DONE;\n    }else{\n      rc = SQLITE_ERROR;\n    }\n    goto vdbe_return;\n  }else{\n    sqlite3VdbeError(p,\n        (!desiredAutoCommit)?\"cannot start a transaction within a transaction\":(\n        (iRollback)?\"cannot rollback - no transaction is active\":\n                   \"cannot commit - no transaction is active\"));\n         \n    rc = SQLITE_ERROR;\n    goto abort_due_to_error;\n  }\n  break;\n}\n\n/* Opcode: Transaction P1 P2 P3 P4 P5\n**\n** Begin a transaction on database P1 if a transaction is not already\n** active.\n** If P2 is non-zero, then a write-transaction is started, or if a \n** read-transaction is already active, it is upgraded to a write-transaction.\n** If P2 is zero, then a read-transaction is started.\n**\n** P1 is the index of the database file on which the transaction is\n** started.  Index 0 is the main database file and index 1 is the\n** file used for temporary tables.  Indices of 2 or more are used for\n** attached databases.\n**\n** If a write-transaction is started and the Vdbe.usesStmtJournal flag is\n** true (this flag is set if the Vdbe may modify more than one row and may\n** throw an ABORT exception), a statement transaction may also be opened.\n** More specifically, a statement transaction is opened iff the database\n** connection is currently not in autocommit mode, or if there are other\n** active statements. A statement transaction allows the changes made by this\n** VDBE to be rolled back after an error without having to roll back the\n** entire transaction. If no error is encountered, the statement transaction\n** will automatically commit when the VDBE halts.\n**\n** If P5!=0 then this opcode also checks the schema cookie against P3\n** and the schema generation counter against P4.\n** The cookie changes its value whenever the database schema changes.\n** This operation is used to detect when that the cookie has changed\n** and that the current process needs to reread the schema.  If the schema\n** cookie in P3 differs from the schema cookie in the database header or\n** if the schema generation counter in P4 differs from the current\n** generation counter, then an SQLITE_SCHEMA error is raised and execution\n** halts.  The sqlite3_step() wrapper function might then reprepare the\n** statement and rerun it from the beginning.\n*/\ncase OP_Transaction: {\n  Btree *pBt;\n  int iMeta;\n  int iGen;\n\n  assert( p->bIsReader );\n  assert( p->readOnly==0 || pOp->p2==0 );\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\n  assert( DbMaskTest(p->btreeMask, pOp->p1) );\n  if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){\n    rc = SQLITE_READONLY;\n    goto abort_due_to_error;\n  }\n  pBt = db->aDb[pOp->p1].pBt;\n\n  if( pBt ){\n    rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);\n    testcase( rc==SQLITE_BUSY_SNAPSHOT );\n    testcase( rc==SQLITE_BUSY_RECOVERY );\n    if( rc!=SQLITE_OK ){\n      if( (rc&0xff)==SQLITE_BUSY ){\n        p->pc = (int)(pOp - aOp);\n        p->rc = rc;\n        goto vdbe_return;\n      }\n      goto abort_due_to_error;\n    }\n\n    if( pOp->p2 && p->usesStmtJournal \n     && (db->autoCommit==0 || db->nVdbeRead>1) \n    ){\n      assert( sqlite3BtreeIsInTrans(pBt) );\n      if( p->iStatement==0 ){\n        assert( db->nStatement>=0 && db->nSavepoint>=0 );\n        db->nStatement++; \n        p->iStatement = db->nSavepoint + db->nStatement;\n      }\n\n      rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement-1);\n      if( rc==SQLITE_OK ){\n        rc = sqlite3BtreeBeginStmt(pBt, p->iStatement);\n      }\n\n      /* Store the current value of the database handles deferred constraint\n      ** counter. If the statement transaction needs to be rolled back,\n      ** the value of this counter needs to be restored too.  */\n      p->nStmtDefCons = db->nDeferredCons;\n      p->nStmtDefImmCons = db->nDeferredImmCons;\n    }\n\n    /* Gather the schema version number for checking:\n    ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema\n    ** version is checked to ensure that the schema has not changed since the\n    ** SQL statement was prepared.\n    */\n    sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&iMeta);\n    iGen = db->aDb[pOp->p1].pSchema->iGeneration;\n  }else{\n    iGen = iMeta = 0;\n  }\n  assert( pOp->p5==0 || pOp->p4type==P4_INT32 );\n  if( pOp->p5 && (iMeta!=pOp->p3 || iGen!=pOp->p4.i) ){\n    sqlite3DbFree(db, p->zErrMsg);\n    p->zErrMsg = sqlite3DbStrDup(db, \"database schema has changed\");\n    /* If the schema-cookie from the database file matches the cookie \n    ** stored with the in-memory representation of the schema, do\n    ** not reload the schema from the database file.\n    **\n    ** If virtual-tables are in use, this is not just an optimization.\n    ** Often, v-tables store their data in other SQLite tables, which\n    ** are queried from within xNext() and other v-table methods using\n    ** prepared queries. If such a query is out-of-date, we do not want to\n    ** discard the database schema, as the user code implementing the\n    ** v-table would have to be ready for the sqlite3_vtab structure itself\n    ** to be invalidated whenever sqlite3_step() is called from within \n    ** a v-table method.\n    */\n    if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){\n      sqlite3ResetOneSchema(db, pOp->p1);\n    }\n    p->expired = 1;\n    rc = SQLITE_SCHEMA;\n  }\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n\n/* Opcode: ReadCookie P1 P2 P3 * *\n**\n** Read cookie number P3 from database P1 and write it into register P2.\n** P3==1 is the schema version.  P3==2 is the database format.\n** P3==3 is the recommended pager cache size, and so forth.  P1==0 is\n** the main database file and P1==1 is the database file used to store\n** temporary tables.\n**\n** There must be a read-lock on the database (either a transaction\n** must be started or there must be an open cursor) before\n** executing this instruction.\n*/\ncase OP_ReadCookie: {               /* out2 */\n  int iMeta;\n  int iDb;\n  int iCookie;\n\n  assert( p->bIsReader );\n  iDb = pOp->p1;\n  iCookie = pOp->p3;\n  assert( pOp->p3<SQLITE_N_BTREE_META );\n  assert( iDb>=0 && iDb<db->nDb );\n  assert( db->aDb[iDb].pBt!=0 );\n  assert( DbMaskTest(p->btreeMask, iDb) );\n\n  sqlite3BtreeGetMeta(db->aDb[iDb].pBt, iCookie, (u32 *)&iMeta);\n  pOut = out2Prerelease(p, pOp);\n  pOut->u.i = iMeta;\n  break;\n}\n\n/* Opcode: SetCookie P1 P2 P3 * *\n**\n** Write the integer value P3 into cookie number P2 of database P1.\n** P2==1 is the schema version.  P2==2 is the database format.\n** P2==3 is the recommended pager cache \n** size, and so forth.  P1==0 is the main database file and P1==1 is the \n** database file used to store temporary tables.\n**\n** A transaction must be started before executing this opcode.\n*/\ncase OP_SetCookie: {\n  Db *pDb;\n  assert( pOp->p2<SQLITE_N_BTREE_META );\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\n  assert( DbMaskTest(p->btreeMask, pOp->p1) );\n  assert( p->readOnly==0 );\n  pDb = &db->aDb[pOp->p1];\n  assert( pDb->pBt!=0 );\n  assert( sqlite3SchemaMutexHeld(db, pOp->p1, 0) );\n  /* See note about index shifting on OP_ReadCookie */\n  rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3);\n  if( pOp->p2==BTREE_SCHEMA_VERSION ){\n    /* When the schema cookie changes, record the new cookie internally */\n    pDb->pSchema->schema_cookie = pOp->p3;\n    db->flags |= SQLITE_InternChanges;\n  }else if( pOp->p2==BTREE_FILE_FORMAT ){\n    /* Record changes in the file format */\n    pDb->pSchema->file_format = pOp->p3;\n  }\n  if( pOp->p1==1 ){\n    /* Invalidate all prepared statements whenever the TEMP database\n    ** schema is changed.  Ticket #1644 */\n    sqlite3ExpirePreparedStatements(db);\n    p->expired = 0;\n  }\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n\n/* Opcode: OpenRead P1 P2 P3 P4 P5\n** Synopsis: root=P2 iDb=P3\n**\n** Open a read-only cursor for the database table whose root page is\n** P2 in a database file.  The database file is determined by P3. \n** P3==0 means the main database, P3==1 means the database used for \n** temporary tables, and P3>1 means used the corresponding attached\n** database.  Give the new cursor an identifier of P1.  The P1\n** values need not be contiguous but all P1 values should be small integers.\n** It is an error for P1 to be negative.\n**\n** If P5!=0 then use the content of register P2 as the root page, not\n** the value of P2 itself.\n**\n** There will be a read lock on the database whenever there is an\n** open cursor.  If the database was unlocked prior to this instruction\n** then a read lock is acquired as part of this instruction.  A read\n** lock allows other processes to read the database but prohibits\n** any other process from modifying the database.  The read lock is\n** released when all cursors are closed.  If this instruction attempts\n** to get a read lock but fails, the script terminates with an\n** SQLITE_BUSY error code.\n**\n** The P4 value may be either an integer (P4_INT32) or a pointer to\n** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo \n** structure, then said structure defines the content and collating \n** sequence of the index being opened. Otherwise, if P4 is an integer \n** value, it is set to the number of columns in the table.\n**\n** See also: OpenWrite, ReopenIdx\n*/\n/* Opcode: ReopenIdx P1 P2 P3 P4 P5\n** Synopsis: root=P2 iDb=P3\n**\n** The ReopenIdx opcode works exactly like ReadOpen except that it first\n** checks to see if the cursor on P1 is already open with a root page\n** number of P2 and if it is this opcode becomes a no-op.  In other words,\n** if the cursor is already open, do not reopen it.\n**\n** The ReopenIdx opcode may only be used with P5==0 and with P4 being\n** a P4_KEYINFO object.  Furthermore, the P3 value must be the same as\n** every other ReopenIdx or OpenRead for the same cursor number.\n**\n** See the OpenRead opcode documentation for additional information.\n*/\n/* Opcode: OpenWrite P1 P2 P3 P4 P5\n** Synopsis: root=P2 iDb=P3\n**\n** Open a read/write cursor named P1 on the table or index whose root\n** page is P2.  Or if P5!=0 use the content of register P2 to find the\n** root page.\n**\n** The P4 value may be either an integer (P4_INT32) or a pointer to\n** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo \n** structure, then said structure defines the content and collating \n** sequence of the index being opened. Otherwise, if P4 is an integer \n** value, it is set to the number of columns in the table, or to the\n** largest index of any column of the table that is actually used.\n**\n** This instruction works just like OpenRead except that it opens the cursor\n** in read/write mode.  For a given table, there can be one or more read-only\n** cursors or a single read/write cursor but not both.\n**\n** See also OpenRead.\n*/\ncase OP_ReopenIdx: {\n  int nField;\n  KeyInfo *pKeyInfo;\n  int p2;\n  int iDb;\n  int wrFlag;\n  Btree *pX;\n  VdbeCursor *pCur;\n  Db *pDb;\n\n  assert( pOp->p5==0 || pOp->p5==OPFLAG_SEEKEQ );\n  assert( pOp->p4type==P4_KEYINFO );\n  pCur = p->apCsr[pOp->p1];\n  if( pCur && pCur->pgnoRoot==(u32)pOp->p2 ){\n    assert( pCur->iDb==pOp->p3 );      /* Guaranteed by the code generator */\n    goto open_cursor_set_hints;\n  }\n  /* If the cursor is not currently open or is open on a different\n  ** index, then fall through into OP_OpenRead to force a reopen */\ncase OP_OpenRead:\ncase OP_OpenWrite:\n\n  assert( pOp->opcode==OP_OpenWrite || pOp->p5==0 || pOp->p5==OPFLAG_SEEKEQ );\n  assert( p->bIsReader );\n  assert( pOp->opcode==OP_OpenRead || pOp->opcode==OP_ReopenIdx\n          || p->readOnly==0 );\n\n  if( p->expired ){\n    rc = SQLITE_ABORT_ROLLBACK;\n    goto abort_due_to_error;\n  }\n\n  nField = 0;\n  pKeyInfo = 0;\n  p2 = pOp->p2;\n  iDb = pOp->p3;\n  assert( iDb>=0 && iDb<db->nDb );\n  assert( DbMaskTest(p->btreeMask, iDb) );\n  pDb = &db->aDb[iDb];\n  pX = pDb->pBt;\n  assert( pX!=0 );\n  if( pOp->opcode==OP_OpenWrite ){\n    assert( OPFLAG_FORDELETE==BTREE_FORDELETE );\n    wrFlag = BTREE_WRCSR | (pOp->p5 & OPFLAG_FORDELETE);\n    assert( sqlite3SchemaMutexHeld(db, iDb, 0) );\n    if( pDb->pSchema->file_format < p->minWriteFileFormat ){\n      p->minWriteFileFormat = pDb->pSchema->file_format;\n    }\n  }else{\n    wrFlag = 0;\n  }\n  if( pOp->p5 & OPFLAG_P2ISREG ){\n    assert( p2>0 );\n    assert( p2<=(p->nMem+1 - p->nCursor) );\n    pIn2 = &aMem[p2];\n    assert( memIsValid(pIn2) );\n    assert( (pIn2->flags & MEM_Int)!=0 );\n    sqlite3VdbeMemIntegerify(pIn2);\n    p2 = (int)pIn2->u.i;\n    /* The p2 value always comes from a prior OP_CreateTable opcode and\n    ** that opcode will always set the p2 value to 2 or more or else fail.\n    ** If there were a failure, the prepared statement would have halted\n    ** before reaching this instruction. */\n    assert( p2>=2 );\n  }\n  if( pOp->p4type==P4_KEYINFO ){\n    pKeyInfo = pOp->p4.pKeyInfo;\n    assert( pKeyInfo->enc==ENC(db) );\n    assert( pKeyInfo->db==db );\n    nField = pKeyInfo->nField+pKeyInfo->nXField;\n  }else if( pOp->p4type==P4_INT32 ){\n    nField = pOp->p4.i;\n  }\n  assert( pOp->p1>=0 );\n  assert( nField>=0 );\n  testcase( nField==0 );  /* Table with INTEGER PRIMARY KEY and nothing else */\n  pCur = allocateCursor(p, pOp->p1, nField, iDb, CURTYPE_BTREE);\n  if( pCur==0 ) goto no_mem;\n  pCur->nullRow = 1;\n  pCur->isOrdered = 1;\n  pCur->pgnoRoot = p2;\n#ifdef SQLITE_DEBUG\n  pCur->wrFlag = wrFlag;\n#endif\n  rc = sqlite3BtreeCursor(pX, p2, wrFlag, pKeyInfo, pCur->uc.pCursor);\n  pCur->pKeyInfo = pKeyInfo;\n  /* Set the VdbeCursor.isTable variable. Previous versions of\n  ** SQLite used to check if the root-page flags were sane at this point\n  ** and report database corruption if they were not, but this check has\n  ** since moved into the btree layer.  */  \n  pCur->isTable = pOp->p4type!=P4_KEYINFO;\n\nopen_cursor_set_hints:\n  assert( OPFLAG_BULKCSR==BTREE_BULKLOAD );\n  assert( OPFLAG_SEEKEQ==BTREE_SEEK_EQ );\n  testcase( pOp->p5 & OPFLAG_BULKCSR );\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n  testcase( pOp->p2 & OPFLAG_SEEKEQ );\n#endif\n  sqlite3BtreeCursorHintFlags(pCur->uc.pCursor,\n                               (pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ)));\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n\n/* Opcode: OpenEphemeral P1 P2 * P4 P5\n** Synopsis: nColumn=P2\n**\n** Open a new cursor P1 to a transient table.\n** The cursor is always opened read/write even if \n** the main database is read-only.  The ephemeral\n** table is deleted automatically when the cursor is closed.\n**\n** P2 is the number of columns in the ephemeral table.\n** The cursor points to a BTree table if P4==0 and to a BTree index\n** if P4 is not 0.  If P4 is not NULL, it points to a KeyInfo structure\n** that defines the format of keys in the index.\n**\n** The P5 parameter can be a mask of the BTREE_* flags defined\n** in btree.h.  These flags control aspects of the operation of\n** the btree.  The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are\n** added automatically.\n*/\n/* Opcode: OpenAutoindex P1 P2 * P4 *\n** Synopsis: nColumn=P2\n**\n** This opcode works the same as OP_OpenEphemeral.  It has a\n** different name to distinguish its use.  Tables created using\n** by this opcode will be used for automatically created transient\n** indices in joins.\n*/\ncase OP_OpenAutoindex: \ncase OP_OpenEphemeral: {\n  VdbeCursor *pCx;\n  KeyInfo *pKeyInfo;\n\n  static const int vfsFlags = \n      SQLITE_OPEN_READWRITE |\n      SQLITE_OPEN_CREATE |\n      SQLITE_OPEN_EXCLUSIVE |\n      SQLITE_OPEN_DELETEONCLOSE |\n      SQLITE_OPEN_TRANSIENT_DB;\n  assert( pOp->p1>=0 );\n  assert( pOp->p2>=0 );\n  pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);\n  if( pCx==0 ) goto no_mem;\n  pCx->nullRow = 1;\n  pCx->isEphemeral = 1;\n  rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBt, \n                        BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, vfsFlags);\n  if( rc==SQLITE_OK ){\n    rc = sqlite3BtreeBeginTrans(pCx->pBt, 1);\n  }\n  if( rc==SQLITE_OK ){\n    /* If a transient index is required, create it by calling\n    ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before\n    ** opening it. If a transient table is required, just use the\n    ** automatically created table with root-page 1 (an BLOB_INTKEY table).\n    */\n    if( (pKeyInfo = pOp->p4.pKeyInfo)!=0 ){\n      int pgno;\n      assert( pOp->p4type==P4_KEYINFO );\n      rc = sqlite3BtreeCreateTable(pCx->pBt, &pgno, BTREE_BLOBKEY | pOp->p5); \n      if( rc==SQLITE_OK ){\n        assert( pgno==MASTER_ROOT+1 );\n        assert( pKeyInfo->db==db );\n        assert( pKeyInfo->enc==ENC(db) );\n        pCx->pKeyInfo = pKeyInfo;\n        rc = sqlite3BtreeCursor(pCx->pBt, pgno, BTREE_WRCSR,\n                                pKeyInfo, pCx->uc.pCursor);\n      }\n      pCx->isTable = 0;\n    }else{\n      rc = sqlite3BtreeCursor(pCx->pBt, MASTER_ROOT, BTREE_WRCSR,\n                              0, pCx->uc.pCursor);\n      pCx->isTable = 1;\n    }\n  }\n  if( rc ) goto abort_due_to_error;\n  pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);\n  break;\n}\n\n/* Opcode: SorterOpen P1 P2 P3 P4 *\n**\n** This opcode works like OP_OpenEphemeral except that it opens\n** a transient index that is specifically designed to sort large\n** tables using an external merge-sort algorithm.\n**\n** If argument P3 is non-zero, then it indicates that the sorter may\n** assume that a stable sort considering the first P3 fields of each\n** key is sufficient to produce the required results.\n*/\ncase OP_SorterOpen: {\n  VdbeCursor *pCx;\n\n  assert( pOp->p1>=0 );\n  assert( pOp->p2>=0 );\n  pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_SORTER);\n  if( pCx==0 ) goto no_mem;\n  pCx->pKeyInfo = pOp->p4.pKeyInfo;\n  assert( pCx->pKeyInfo->db==db );\n  assert( pCx->pKeyInfo->enc==ENC(db) );\n  rc = sqlite3VdbeSorterInit(db, pOp->p3, pCx);\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n\n/* Opcode: SequenceTest P1 P2 * * *\n** Synopsis: if( cursor[P1].ctr++ ) pc = P2\n**\n** P1 is a sorter cursor. If the sequence counter is currently zero, jump\n** to P2. Regardless of whether or not the jump is taken, increment the\n** the sequence value.\n*/\ncase OP_SequenceTest: {\n  VdbeCursor *pC;\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( isSorter(pC) );\n  if( (pC->seqCount++)==0 ){\n    goto jump_to_p2;\n  }\n  break;\n}\n\n/* Opcode: OpenPseudo P1 P2 P3 * *\n** Synopsis: P3 columns in r[P2]\n**\n** Open a new cursor that points to a fake table that contains a single\n** row of data.  The content of that one row is the content of memory\n** register P2.  In other words, cursor P1 becomes an alias for the \n** MEM_Blob content contained in register P2.\n**\n** A pseudo-table created by this opcode is used to hold a single\n** row output from the sorter so that the row can be decomposed into\n** individual columns using the OP_Column opcode.  The OP_Column opcode\n** is the only cursor opcode that works with a pseudo-table.\n**\n** P3 is the number of fields in the records that will be stored by\n** the pseudo-table.\n*/\ncase OP_OpenPseudo: {\n  VdbeCursor *pCx;\n\n  assert( pOp->p1>=0 );\n  assert( pOp->p3>=0 );\n  pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO);\n  if( pCx==0 ) goto no_mem;\n  pCx->nullRow = 1;\n  pCx->uc.pseudoTableReg = pOp->p2;\n  pCx->isTable = 1;\n  assert( pOp->p5==0 );\n  break;\n}\n\n/* Opcode: Close P1 * * * *\n**\n** Close a cursor previously opened as P1.  If P1 is not\n** currently open, this instruction is a no-op.\n*/\ncase OP_Close: {\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  sqlite3VdbeFreeCursor(p, p->apCsr[pOp->p1]);\n  p->apCsr[pOp->p1] = 0;\n  break;\n}\n\n#ifdef SQLITE_ENABLE_COLUMN_USED_MASK\n/* Opcode: ColumnsUsed P1 * * P4 *\n**\n** This opcode (which only exists if SQLite was compiled with\n** SQLITE_ENABLE_COLUMN_USED_MASK) identifies which columns of the\n** table or index for cursor P1 are used.  P4 is a 64-bit integer\n** (P4_INT64) in which the first 63 bits are one for each of the\n** first 63 columns of the table or index that are actually used\n** by the cursor.  The high-order bit is set if any column after\n** the 64th is used.\n*/\ncase OP_ColumnsUsed: {\n  VdbeCursor *pC;\n  pC = p->apCsr[pOp->p1];\n  assert( pC->eCurType==CURTYPE_BTREE );\n  pC->maskUsed = *(u64*)pOp->p4.pI64;\n  break;\n}\n#endif\n\n/* Opcode: SeekGE P1 P2 P3 P4 *\n** Synopsis: key=r[P3@P4]\n**\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \n** use the value in register P3 as the key.  If cursor P1 refers \n** to an SQL index, then P3 is the first in an array of P4 registers \n** that are used as an unpacked index key. \n**\n** Reposition cursor P1 so that  it points to the smallest entry that \n** is greater than or equal to the key value. If there are no records \n** greater than or equal to the key and P2 is not zero, then jump to P2.\n**\n** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this\n** opcode will always land on a record that equally equals the key, or\n** else jump immediately to P2.  When the cursor is OPFLAG_SEEKEQ, this\n** opcode must be followed by an IdxLE opcode with the same arguments.\n** The IdxLE opcode will be skipped if this opcode succeeds, but the\n** IdxLE opcode will be used on subsequent loop iterations.\n**\n** This opcode leaves the cursor configured to move in forward order,\n** from the beginning toward the end.  In other words, the cursor is\n** configured to use Next, not Prev.\n**\n** See also: Found, NotFound, SeekLt, SeekGt, SeekLe\n*/\n/* Opcode: SeekGT P1 P2 P3 P4 *\n** Synopsis: key=r[P3@P4]\n**\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \n** use the value in register P3 as a key. If cursor P1 refers \n** to an SQL index, then P3 is the first in an array of P4 registers \n** that are used as an unpacked index key. \n**\n** Reposition cursor P1 so that  it points to the smallest entry that \n** is greater than the key value. If there are no records greater than \n** the key and P2 is not zero, then jump to P2.\n**\n** This opcode leaves the cursor configured to move in forward order,\n** from the beginning toward the end.  In other words, the cursor is\n** configured to use Next, not Prev.\n**\n** See also: Found, NotFound, SeekLt, SeekGe, SeekLe\n*/\n/* Opcode: SeekLT P1 P2 P3 P4 * \n** Synopsis: key=r[P3@P4]\n**\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \n** use the value in register P3 as a key. If cursor P1 refers \n** to an SQL index, then P3 is the first in an array of P4 registers \n** that are used as an unpacked index key. \n**\n** Reposition cursor P1 so that  it points to the largest entry that \n** is less than the key value. If there are no records less than \n** the key and P2 is not zero, then jump to P2.\n**\n** This opcode leaves the cursor configured to move in reverse order,\n** from the end toward the beginning.  In other words, the cursor is\n** configured to use Prev, not Next.\n**\n** See also: Found, NotFound, SeekGt, SeekGe, SeekLe\n*/\n/* Opcode: SeekLE P1 P2 P3 P4 *\n** Synopsis: key=r[P3@P4]\n**\n** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), \n** use the value in register P3 as a key. If cursor P1 refers \n** to an SQL index, then P3 is the first in an array of P4 registers \n** that are used as an unpacked index key. \n**\n** Reposition cursor P1 so that it points to the largest entry that \n** is less than or equal to the key value. If there are no records \n** less than or equal to the key and P2 is not zero, then jump to P2.\n**\n** This opcode leaves the cursor configured to move in reverse order,\n** from the end toward the beginning.  In other words, the cursor is\n** configured to use Prev, not Next.\n**\n** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this\n** opcode will always land on a record that equally equals the key, or\n** else jump immediately to P2.  When the cursor is OPFLAG_SEEKEQ, this\n** opcode must be followed by an IdxGE opcode with the same arguments.\n** The IdxGE opcode will be skipped if this opcode succeeds, but the\n** IdxGE opcode will be used on subsequent loop iterations.\n**\n** See also: Found, NotFound, SeekGt, SeekGe, SeekLt\n*/\ncase OP_SeekLT:         /* jump, in3 */\ncase OP_SeekLE:         /* jump, in3 */\ncase OP_SeekGE:         /* jump, in3 */\ncase OP_SeekGT: {       /* jump, in3 */\n  int res;           /* Comparison result */\n  int oc;            /* Opcode */\n  VdbeCursor *pC;    /* The cursor to seek */\n  UnpackedRecord r;  /* The key to seek for */\n  int nField;        /* Number of columns or fields in the key */\n  i64 iKey;          /* The rowid we are to seek to */\n  int eqOnly;        /* Only interested in == results */\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  assert( pOp->p2!=0 );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( OP_SeekLE == OP_SeekLT+1 );\n  assert( OP_SeekGE == OP_SeekLT+2 );\n  assert( OP_SeekGT == OP_SeekLT+3 );\n  assert( pC->isOrdered );\n  assert( pC->uc.pCursor!=0 );\n  oc = pOp->opcode;\n  eqOnly = 0;\n  pC->nullRow = 0;\n#ifdef SQLITE_DEBUG\n  pC->seekOp = pOp->opcode;\n#endif\n\n  if( pC->isTable ){\n    /* The BTREE_SEEK_EQ flag is only set on index cursors */\n    assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0 );\n\n    /* The input value in P3 might be of any type: integer, real, string,\n    ** blob, or NULL.  But it needs to be an integer before we can do\n    ** the seek, so convert it. */\n    pIn3 = &aMem[pOp->p3];\n    if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){\n      applyNumericAffinity(pIn3, 0);\n    }\n    iKey = sqlite3VdbeIntValue(pIn3);\n\n    /* If the P3 value could not be converted into an integer without\n    ** loss of information, then special processing is required... */\n    if( (pIn3->flags & MEM_Int)==0 ){\n      if( (pIn3->flags & MEM_Real)==0 ){\n        /* If the P3 value cannot be converted into any kind of a number,\n        ** then the seek is not possible, so jump to P2 */\n        VdbeBranchTaken(1,2); goto jump_to_p2;\n        break;\n      }\n\n      /* If the approximation iKey is larger than the actual real search\n      ** term, substitute >= for > and < for <=. e.g. if the search term\n      ** is 4.9 and the integer approximation 5:\n      **\n      **        (x >  4.9)    ->     (x >= 5)\n      **        (x <= 4.9)    ->     (x <  5)\n      */\n      if( pIn3->u.r<(double)iKey ){\n        assert( OP_SeekGE==(OP_SeekGT-1) );\n        assert( OP_SeekLT==(OP_SeekLE-1) );\n        assert( (OP_SeekLE & 0x0001)==(OP_SeekGT & 0x0001) );\n        if( (oc & 0x0001)==(OP_SeekGT & 0x0001) ) oc--;\n      }\n\n      /* If the approximation iKey is smaller than the actual real search\n      ** term, substitute <= for < and > for >=.  */\n      else if( pIn3->u.r>(double)iKey ){\n        assert( OP_SeekLE==(OP_SeekLT+1) );\n        assert( OP_SeekGT==(OP_SeekGE+1) );\n        assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) );\n        if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++;\n      }\n    } \n    rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res);\n    pC->movetoTarget = iKey;  /* Used by OP_Delete */\n    if( rc!=SQLITE_OK ){\n      goto abort_due_to_error;\n    }\n  }else{\n    /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and\n    ** OP_SeekLE opcodes are allowed, and these must be immediately followed\n    ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key.\n    */\n    if( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ) ){\n      eqOnly = 1;\n      assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE );\n      assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );\n      assert( pOp[1].p1==pOp[0].p1 );\n      assert( pOp[1].p2==pOp[0].p2 );\n      assert( pOp[1].p3==pOp[0].p3 );\n      assert( pOp[1].p4.i==pOp[0].p4.i );\n    }\n\n    nField = pOp->p4.i;\n    assert( pOp->p4type==P4_INT32 );\n    assert( nField>0 );\n    r.pKeyInfo = pC->pKeyInfo;\n    r.nField = (u16)nField;\n\n    /* The next line of code computes as follows, only faster:\n    **   if( oc==OP_SeekGT || oc==OP_SeekLE ){\n    **     r.default_rc = -1;\n    **   }else{\n    **     r.default_rc = +1;\n    **   }\n    */\n    r.default_rc = ((1 & (oc - OP_SeekLT)) ? -1 : +1);\n    assert( oc!=OP_SeekGT || r.default_rc==-1 );\n    assert( oc!=OP_SeekLE || r.default_rc==-1 );\n    assert( oc!=OP_SeekGE || r.default_rc==+1 );\n    assert( oc!=OP_SeekLT || r.default_rc==+1 );\n\n    r.aMem = &aMem[pOp->p3];\n#ifdef SQLITE_DEBUG\n    { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }\n#endif\n    r.eqSeen = 0;\n    rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, &r, 0, 0, &res);\n    if( rc!=SQLITE_OK ){\n      goto abort_due_to_error;\n    }\n    if( eqOnly && r.eqSeen==0 ){\n      assert( res!=0 );\n      goto seek_not_found;\n    }\n  }\n  pC->deferredMoveto = 0;\n  pC->cacheStatus = CACHE_STALE;\n#ifdef SQLITE_TEST\n  sqlite3_search_count++;\n#endif\n  if( oc>=OP_SeekGE ){  assert( oc==OP_SeekGE || oc==OP_SeekGT );\n    if( res<0 || (res==0 && oc==OP_SeekGT) ){\n      res = 0;\n      rc = sqlite3BtreeNext(pC->uc.pCursor, &res);\n      if( rc!=SQLITE_OK ) goto abort_due_to_error;\n    }else{\n      res = 0;\n    }\n  }else{\n    assert( oc==OP_SeekLT || oc==OP_SeekLE );\n    if( res>0 || (res==0 && oc==OP_SeekLT) ){\n      res = 0;\n      rc = sqlite3BtreePrevious(pC->uc.pCursor, &res);\n      if( rc!=SQLITE_OK ) goto abort_due_to_error;\n    }else{\n      /* res might be negative because the table is empty.  Check to\n      ** see if this is the case.\n      */\n      res = sqlite3BtreeEof(pC->uc.pCursor);\n    }\n  }\nseek_not_found:\n  assert( pOp->p2>0 );\n  VdbeBranchTaken(res!=0,2);\n  if( res ){\n    goto jump_to_p2;\n  }else if( eqOnly ){\n    assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );\n    pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */\n  }\n  break;\n}\n\n/* Opcode: Found P1 P2 P3 P4 *\n** Synopsis: key=r[P3@P4]\n**\n** If P4==0 then register P3 holds a blob constructed by MakeRecord.  If\n** P4>0 then register P3 is the first of P4 registers that form an unpacked\n** record.\n**\n** Cursor P1 is on an index btree.  If the record identified by P3 and P4\n** is a prefix of any entry in P1 then a jump is made to P2 and\n** P1 is left pointing at the matching entry.\n**\n** This operation leaves the cursor in a state where it can be\n** advanced in the forward direction.  The Next instruction will work,\n** but not the Prev instruction.\n**\n** See also: NotFound, NoConflict, NotExists. SeekGe\n*/\n/* Opcode: NotFound P1 P2 P3 P4 *\n** Synopsis: key=r[P3@P4]\n**\n** If P4==0 then register P3 holds a blob constructed by MakeRecord.  If\n** P4>0 then register P3 is the first of P4 registers that form an unpacked\n** record.\n** \n** Cursor P1 is on an index btree.  If the record identified by P3 and P4\n** is not the prefix of any entry in P1 then a jump is made to P2.  If P1 \n** does contain an entry whose prefix matches the P3/P4 record then control\n** falls through to the next instruction and P1 is left pointing at the\n** matching entry.\n**\n** This operation leaves the cursor in a state where it cannot be\n** advanced in either direction.  In other words, the Next and Prev\n** opcodes do not work after this operation.\n**\n** See also: Found, NotExists, NoConflict\n*/\n/* Opcode: NoConflict P1 P2 P3 P4 *\n** Synopsis: key=r[P3@P4]\n**\n** If P4==0 then register P3 holds a blob constructed by MakeRecord.  If\n** P4>0 then register P3 is the first of P4 registers that form an unpacked\n** record.\n** \n** Cursor P1 is on an index btree.  If the record identified by P3 and P4\n** contains any NULL value, jump immediately to P2.  If all terms of the\n** record are not-NULL then a check is done to determine if any row in the\n** P1 index btree has a matching key prefix.  If there are no matches, jump\n** immediately to P2.  If there is a match, fall through and leave the P1\n** cursor pointing to the matching row.\n**\n** This opcode is similar to OP_NotFound with the exceptions that the\n** branch is always taken if any part of the search key input is NULL.\n**\n** This operation leaves the cursor in a state where it cannot be\n** advanced in either direction.  In other words, the Next and Prev\n** opcodes do not work after this operation.\n**\n** See also: NotFound, Found, NotExists\n*/\ncase OP_NoConflict:     /* jump, in3 */\ncase OP_NotFound:       /* jump, in3 */\ncase OP_Found: {        /* jump, in3 */\n  int alreadyExists;\n  int takeJump;\n  int ii;\n  VdbeCursor *pC;\n  int res;\n  char *pFree;\n  UnpackedRecord *pIdxKey;\n  UnpackedRecord r;\n  char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*4 + 7];\n\n#ifdef SQLITE_TEST\n  if( pOp->opcode!=OP_NoConflict ) sqlite3_found_count++;\n#endif\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  assert( pOp->p4type==P4_INT32 );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n#ifdef SQLITE_DEBUG\n  pC->seekOp = pOp->opcode;\n#endif\n  pIn3 = &aMem[pOp->p3];\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( pC->uc.pCursor!=0 );\n  assert( pC->isTable==0 );\n  pFree = 0;\n  if( pOp->p4.i>0 ){\n    r.pKeyInfo = pC->pKeyInfo;\n    r.nField = (u16)pOp->p4.i;\n    r.aMem = pIn3;\n#ifdef SQLITE_DEBUG\n    for(ii=0; ii<r.nField; ii++){\n      assert( memIsValid(&r.aMem[ii]) );\n      assert( (r.aMem[ii].flags & MEM_Zero)==0 || r.aMem[ii].n==0 );\n      if( ii ) REGISTER_TRACE(pOp->p3+ii, &r.aMem[ii]);\n    }\n#endif\n    pIdxKey = &r;\n  }else{\n    pIdxKey = sqlite3VdbeAllocUnpackedRecord(\n        pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree\n    );\n    if( pIdxKey==0 ) goto no_mem;\n    assert( pIn3->flags & MEM_Blob );\n    (void)ExpandBlob(pIn3);\n    sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey);\n  }\n  pIdxKey->default_rc = 0;\n  takeJump = 0;\n  if( pOp->opcode==OP_NoConflict ){\n    /* For the OP_NoConflict opcode, take the jump if any of the\n    ** input fields are NULL, since any key with a NULL will not\n    ** conflict */\n    for(ii=0; ii<pIdxKey->nField; ii++){\n      if( pIdxKey->aMem[ii].flags & MEM_Null ){\n        takeJump = 1;\n        break;\n      }\n    }\n  }\n  rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, pIdxKey, 0, 0, &res);\n  sqlite3DbFree(db, pFree);\n  if( rc!=SQLITE_OK ){\n    goto abort_due_to_error;\n  }\n  pC->seekResult = res;\n  alreadyExists = (res==0);\n  pC->nullRow = 1-alreadyExists;\n  pC->deferredMoveto = 0;\n  pC->cacheStatus = CACHE_STALE;\n  if( pOp->opcode==OP_Found ){\n    VdbeBranchTaken(alreadyExists!=0,2);\n    if( alreadyExists ) goto jump_to_p2;\n  }else{\n    VdbeBranchTaken(takeJump||alreadyExists==0,2);\n    if( takeJump || !alreadyExists ) goto jump_to_p2;\n  }\n  break;\n}\n\n/* Opcode: SeekRowid P1 P2 P3 * *\n** Synopsis: intkey=r[P3]\n**\n** P1 is the index of a cursor open on an SQL table btree (with integer\n** keys).  If register P3 does not contain an integer or if P1 does not\n** contain a record with rowid P3 then jump immediately to P2.  \n** Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain\n** a record with rowid P3 then \n** leave the cursor pointing at that record and fall through to the next\n** instruction.\n**\n** The OP_NotExists opcode performs the same operation, but with OP_NotExists\n** the P3 register must be guaranteed to contain an integer value.  With this\n** opcode, register P3 might not contain an integer.\n**\n** The OP_NotFound opcode performs the same operation on index btrees\n** (with arbitrary multi-value keys).\n**\n** This opcode leaves the cursor in a state where it cannot be advanced\n** in either direction.  In other words, the Next and Prev opcodes will\n** not work following this opcode.\n**\n** See also: Found, NotFound, NoConflict, SeekRowid\n*/\n/* Opcode: NotExists P1 P2 P3 * *\n** Synopsis: intkey=r[P3]\n**\n** P1 is the index of a cursor open on an SQL table btree (with integer\n** keys).  P3 is an integer rowid.  If P1 does not contain a record with\n** rowid P3 then jump immediately to P2.  Or, if P2 is 0, raise an\n** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then \n** leave the cursor pointing at that record and fall through to the next\n** instruction.\n**\n** The OP_SeekRowid opcode performs the same operation but also allows the\n** P3 register to contain a non-integer value, in which case the jump is\n** always taken.  This opcode requires that P3 always contain an integer.\n**\n** The OP_NotFound opcode performs the same operation on index btrees\n** (with arbitrary multi-value keys).\n**\n** This opcode leaves the cursor in a state where it cannot be advanced\n** in either direction.  In other words, the Next and Prev opcodes will\n** not work following this opcode.\n**\n** See also: Found, NotFound, NoConflict, SeekRowid\n*/\ncase OP_SeekRowid: {        /* jump, in3 */\n  VdbeCursor *pC;\n  BtCursor *pCrsr;\n  int res;\n  u64 iKey;\n\n  pIn3 = &aMem[pOp->p3];\n  if( (pIn3->flags & MEM_Int)==0 ){\n    applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding);\n    if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2;\n  }\n  /* Fall through into OP_NotExists */\ncase OP_NotExists:          /* jump, in3 */\n  pIn3 = &aMem[pOp->p3];\n  assert( pIn3->flags & MEM_Int );\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n#ifdef SQLITE_DEBUG\n  pC->seekOp = 0;\n#endif\n  assert( pC->isTable );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  pCrsr = pC->uc.pCursor;\n  assert( pCrsr!=0 );\n  res = 0;\n  iKey = pIn3->u.i;\n  rc = sqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res);\n  assert( rc==SQLITE_OK || res==0 );\n  pC->movetoTarget = iKey;  /* Used by OP_Delete */\n  pC->nullRow = 0;\n  pC->cacheStatus = CACHE_STALE;\n  pC->deferredMoveto = 0;\n  VdbeBranchTaken(res!=0,2);\n  pC->seekResult = res;\n  if( res!=0 ){\n    assert( rc==SQLITE_OK );\n    if( pOp->p2==0 ){\n      rc = SQLITE_CORRUPT_BKPT;\n    }else{\n      goto jump_to_p2;\n    }\n  }\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n\n/* Opcode: Sequence P1 P2 * * *\n** Synopsis: r[P2]=cursor[P1].ctr++\n**\n** Find the next available sequence number for cursor P1.\n** Write the sequence number into register P2.\n** The sequence number on the cursor is incremented after this\n** instruction.  \n*/\ncase OP_Sequence: {           /* out2 */\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  assert( p->apCsr[pOp->p1]!=0 );\n  assert( p->apCsr[pOp->p1]->eCurType!=CURTYPE_VTAB );\n  pOut = out2Prerelease(p, pOp);\n  pOut->u.i = p->apCsr[pOp->p1]->seqCount++;\n  break;\n}\n\n\n/* Opcode: NewRowid P1 P2 P3 * *\n** Synopsis: r[P2]=rowid\n**\n** Get a new integer record number (a.k.a \"rowid\") used as the key to a table.\n** The record number is not previously used as a key in the database\n** table that cursor P1 points to.  The new record number is written\n** written to register P2.\n**\n** If P3>0 then P3 is a register in the root frame of this VDBE that holds \n** the largest previously generated record number. No new record numbers are\n** allowed to be less than this value. When this value reaches its maximum, \n** an SQLITE_FULL error is generated. The P3 register is updated with the '\n** generated record number. This P3 mechanism is used to help implement the\n** AUTOINCREMENT feature.\n*/\ncase OP_NewRowid: {           /* out2 */\n  i64 v;                 /* The new rowid */\n  VdbeCursor *pC;        /* Cursor of table to get the new rowid */\n  int res;               /* Result of an sqlite3BtreeLast() */\n  int cnt;               /* Counter to limit the number of searches */\n  Mem *pMem;             /* Register holding largest rowid for AUTOINCREMENT */\n  VdbeFrame *pFrame;     /* Root frame of VDBE */\n\n  v = 0;\n  res = 0;\n  pOut = out2Prerelease(p, pOp);\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( pC->uc.pCursor!=0 );\n  {\n    /* The next rowid or record number (different terms for the same\n    ** thing) is obtained in a two-step algorithm.\n    **\n    ** First we attempt to find the largest existing rowid and add one\n    ** to that.  But if the largest existing rowid is already the maximum\n    ** positive integer, we have to fall through to the second\n    ** probabilistic algorithm\n    **\n    ** The second algorithm is to select a rowid at random and see if\n    ** it already exists in the table.  If it does not exist, we have\n    ** succeeded.  If the random rowid does exist, we select a new one\n    ** and try again, up to 100 times.\n    */\n    assert( pC->isTable );\n\n#ifdef SQLITE_32BIT_ROWID\n#   define MAX_ROWID 0x7fffffff\n#else\n    /* Some compilers complain about constants of the form 0x7fffffffffffffff.\n    ** Others complain about 0x7ffffffffffffffffLL.  The following macro seems\n    ** to provide the constant while making all compilers happy.\n    */\n#   define MAX_ROWID  (i64)( (((u64)0x7fffffff)<<32) | (u64)0xffffffff )\n#endif\n\n    if( !pC->useRandomRowid ){\n      rc = sqlite3BtreeLast(pC->uc.pCursor, &res);\n      if( rc!=SQLITE_OK ){\n        goto abort_due_to_error;\n      }\n      if( res ){\n        v = 1;   /* IMP: R-61914-48074 */\n      }else{\n        assert( sqlite3BtreeCursorIsValid(pC->uc.pCursor) );\n        v = sqlite3BtreeIntegerKey(pC->uc.pCursor);\n        if( v>=MAX_ROWID ){\n          pC->useRandomRowid = 1;\n        }else{\n          v++;   /* IMP: R-29538-34987 */\n        }\n      }\n    }\n\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n    if( pOp->p3 ){\n      /* Assert that P3 is a valid memory cell. */\n      assert( pOp->p3>0 );\n      if( p->pFrame ){\n        for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);\n        /* Assert that P3 is a valid memory cell. */\n        assert( pOp->p3<=pFrame->nMem );\n        pMem = &pFrame->aMem[pOp->p3];\n      }else{\n        /* Assert that P3 is a valid memory cell. */\n        assert( pOp->p3<=(p->nMem+1 - p->nCursor) );\n        pMem = &aMem[pOp->p3];\n        memAboutToChange(p, pMem);\n      }\n      assert( memIsValid(pMem) );\n\n      REGISTER_TRACE(pOp->p3, pMem);\n      sqlite3VdbeMemIntegerify(pMem);\n      assert( (pMem->flags & MEM_Int)!=0 );  /* mem(P3) holds an integer */\n      if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){\n        rc = SQLITE_FULL;   /* IMP: R-12275-61338 */\n        goto abort_due_to_error;\n      }\n      if( v<pMem->u.i+1 ){\n        v = pMem->u.i + 1;\n      }\n      pMem->u.i = v;\n    }\n#endif\n    if( pC->useRandomRowid ){\n      /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the\n      ** largest possible integer (9223372036854775807) then the database\n      ** engine starts picking positive candidate ROWIDs at random until\n      ** it finds one that is not previously used. */\n      assert( pOp->p3==0 );  /* We cannot be in random rowid mode if this is\n                             ** an AUTOINCREMENT table. */\n      cnt = 0;\n      do{\n        sqlite3_randomness(sizeof(v), &v);\n        v &= (MAX_ROWID>>1); v++;  /* Ensure that v is greater than zero */\n      }while(  ((rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)v,\n                                                 0, &res))==SQLITE_OK)\n            && (res==0)\n            && (++cnt<100));\n      if( rc ) goto abort_due_to_error;\n      if( res==0 ){\n        rc = SQLITE_FULL;   /* IMP: R-38219-53002 */\n        goto abort_due_to_error;\n      }\n      assert( v>0 );  /* EV: R-40812-03570 */\n    }\n    pC->deferredMoveto = 0;\n    pC->cacheStatus = CACHE_STALE;\n  }\n  pOut->u.i = v;\n  break;\n}\n\n/* Opcode: Insert P1 P2 P3 P4 P5\n** Synopsis: intkey=r[P3] data=r[P2]\n**\n** Write an entry into the table of cursor P1.  A new entry is\n** created if it doesn't already exist or the data for an existing\n** entry is overwritten.  The data is the value MEM_Blob stored in register\n** number P2. The key is stored in register P3. The key must\n** be a MEM_Int.\n**\n** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is\n** incremented (otherwise not).  If the OPFLAG_LASTROWID flag of P5 is set,\n** then rowid is stored for subsequent return by the\n** sqlite3_last_insert_rowid() function (otherwise it is unmodified).\n**\n** If the OPFLAG_USESEEKRESULT flag of P5 is set and if the result of\n** the last seek operation (OP_NotExists or OP_SeekRowid) was a success,\n** then this\n** operation will not attempt to find the appropriate row before doing\n** the insert but will instead overwrite the row that the cursor is\n** currently pointing to.  Presumably, the prior OP_NotExists or\n** OP_SeekRowid opcode\n** has already positioned the cursor correctly.  This is an optimization\n** that boosts performance by avoiding redundant seeks.\n**\n** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an\n** UPDATE operation.  Otherwise (if the flag is clear) then this opcode\n** is part of an INSERT operation.  The difference is only important to\n** the update hook.\n**\n** Parameter P4 may point to a Table structure, or may be NULL. If it is \n** not NULL, then the update-hook (sqlite3.xUpdateCallback) is invoked \n** following a successful insert.\n**\n** (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically\n** allocated, then ownership of P2 is transferred to the pseudo-cursor\n** and register P2 becomes ephemeral.  If the cursor is changed, the\n** value of register P2 will then change.  Make sure this does not\n** cause any problems.)\n**\n** This instruction only works on tables.  The equivalent instruction\n** for indices is OP_IdxInsert.\n*/\n/* Opcode: InsertInt P1 P2 P3 P4 P5\n** Synopsis: intkey=P3 data=r[P2]\n**\n** This works exactly like OP_Insert except that the key is the\n** integer value P3, not the value of the integer stored in register P3.\n*/\ncase OP_Insert: \ncase OP_InsertInt: {\n  Mem *pData;       /* MEM cell holding data for the record to be inserted */\n  Mem *pKey;        /* MEM cell holding key  for the record */\n  VdbeCursor *pC;   /* Cursor to table into which insert is written */\n  int seekResult;   /* Result of prior seek or 0 if no USESEEKRESULT flag */\n  const char *zDb;  /* database name - used by the update hook */\n  Table *pTab;      /* Table structure - used by update and pre-update hooks */\n  int op;           /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */\n  BtreePayload x;   /* Payload to be inserted */\n\n  op = 0;\n  pData = &aMem[pOp->p2];\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  assert( memIsValid(pData) );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( pC->uc.pCursor!=0 );\n  assert( pC->isTable );\n  assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC );\n  REGISTER_TRACE(pOp->p2, pData);\n\n  if( pOp->opcode==OP_Insert ){\n    pKey = &aMem[pOp->p3];\n    assert( pKey->flags & MEM_Int );\n    assert( memIsValid(pKey) );\n    REGISTER_TRACE(pOp->p3, pKey);\n    x.nKey = pKey->u.i;\n  }else{\n    assert( pOp->opcode==OP_InsertInt );\n    x.nKey = pOp->p3;\n  }\n\n  if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){\n    assert( pC->isTable );\n    assert( pC->iDb>=0 );\n    zDb = db->aDb[pC->iDb].zDbSName;\n    pTab = pOp->p4.pTab;\n    assert( HasRowid(pTab) );\n    op = ((pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT);\n  }else{\n    pTab = 0; /* Not needed.  Silence a comiler warning. */\n    zDb = 0;  /* Not needed.  Silence a compiler warning. */\n  }\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n  /* Invoke the pre-update hook, if any */\n  if( db->xPreUpdateCallback \n   && pOp->p4type==P4_TABLE\n   && !(pOp->p5 & OPFLAG_ISUPDATE)\n  ){\n    sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey, pOp->p2);\n  }\n#endif\n\n  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;\n  if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = x.nKey;\n  if( pData->flags & MEM_Null ){\n    x.pData = 0;\n    x.nData = 0;\n  }else{\n    assert( pData->flags & (MEM_Blob|MEM_Str) );\n    x.pData = pData->z;\n    x.nData = pData->n;\n  }\n  seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0);\n  if( pData->flags & MEM_Zero ){\n    x.nZero = pData->u.nZero;\n  }else{\n    x.nZero = 0;\n  }\n  x.pKey = 0;\n  rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,\n                          (pOp->p5 & OPFLAG_APPEND)!=0, seekResult\n  );\n  pC->deferredMoveto = 0;\n  pC->cacheStatus = CACHE_STALE;\n\n  /* Invoke the update-hook if required. */\n  if( rc ) goto abort_due_to_error;\n  if( db->xUpdateCallback && op ){\n    db->xUpdateCallback(db->pUpdateArg, op, zDb, pTab->zName, x.nKey);\n  }\n  break;\n}\n\n/* Opcode: Delete P1 P2 P3 P4 P5\n**\n** Delete the record at which the P1 cursor is currently pointing.\n**\n** If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then\n** the cursor will be left pointing at  either the next or the previous\n** record in the table. If it is left pointing at the next record, then\n** the next Next instruction will be a no-op. As a result, in this case\n** it is ok to delete a record from within a Next loop. If \n** OPFLAG_SAVEPOSITION bit of P5 is clear, then the cursor will be\n** left in an undefined state.\n**\n** If the OPFLAG_AUXDELETE bit is set on P5, that indicates that this\n** delete one of several associated with deleting a table row and all its\n** associated index entries.  Exactly one of those deletes is the \"primary\"\n** delete.  The others are all on OPFLAG_FORDELETE cursors or else are\n** marked with the AUXDELETE flag.\n**\n** If the OPFLAG_NCHANGE flag of P2 (NB: P2 not P5) is set, then the row\n** change count is incremented (otherwise not).\n**\n** P1 must not be pseudo-table.  It has to be a real table with\n** multiple rows.\n**\n** If P4 is not NULL then it points to a Table object. In this case either \n** the update or pre-update hook, or both, may be invoked. The P1 cursor must\n** have been positioned using OP_NotFound prior to invoking this opcode in \n** this case. Specifically, if one is configured, the pre-update hook is \n** invoked if P4 is not NULL. The update-hook is invoked if one is configured, \n** P4 is not NULL, and the OPFLAG_NCHANGE flag is set in P2.\n**\n** If the OPFLAG_ISUPDATE flag is set in P2, then P3 contains the address\n** of the memory cell that contains the value that the rowid of the row will\n** be set to by the update.\n*/\ncase OP_Delete: {\n  VdbeCursor *pC;\n  const char *zDb;\n  Table *pTab;\n  int opflags;\n\n  opflags = pOp->p2;\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( pC->uc.pCursor!=0 );\n  assert( pC->deferredMoveto==0 );\n\n#ifdef SQLITE_DEBUG\n  if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){\n    /* If p5 is zero, the seek operation that positioned the cursor prior to\n    ** OP_Delete will have also set the pC->movetoTarget field to the rowid of\n    ** the row that is being deleted */\n    i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor);\n    assert( pC->movetoTarget==iKey );\n  }\n#endif\n\n  /* If the update-hook or pre-update-hook will be invoked, set zDb to\n  ** the name of the db to pass as to it. Also set local pTab to a copy\n  ** of p4.pTab. Finally, if p5 is true, indicating that this cursor was\n  ** last moved with OP_Next or OP_Prev, not Seek or NotFound, set \n  ** VdbeCursor.movetoTarget to the current rowid.  */\n  if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){\n    assert( pC->iDb>=0 );\n    assert( pOp->p4.pTab!=0 );\n    zDb = db->aDb[pC->iDb].zDbSName;\n    pTab = pOp->p4.pTab;\n    if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){\n      pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor);\n    }\n  }else{\n    zDb = 0;   /* Not needed.  Silence a compiler warning. */\n    pTab = 0;  /* Not needed.  Silence a compiler warning. */\n  }\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n  /* Invoke the pre-update-hook if required. */\n  if( db->xPreUpdateCallback && pOp->p4.pTab && HasRowid(pTab) ){\n    assert( !(opflags & OPFLAG_ISUPDATE) || (aMem[pOp->p3].flags & MEM_Int) );\n    sqlite3VdbePreUpdateHook(p, pC,\n        (opflags & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_DELETE, \n        zDb, pTab, pC->movetoTarget,\n        pOp->p3\n    );\n  }\n  if( opflags & OPFLAG_ISNOOP ) break;\n#endif\n \n  /* Only flags that can be set are SAVEPOISTION and AUXDELETE */ \n  assert( (pOp->p5 & ~(OPFLAG_SAVEPOSITION|OPFLAG_AUXDELETE))==0 );\n  assert( OPFLAG_SAVEPOSITION==BTREE_SAVEPOSITION );\n  assert( OPFLAG_AUXDELETE==BTREE_AUXDELETE );\n\n#ifdef SQLITE_DEBUG\n  if( p->pFrame==0 ){\n    if( pC->isEphemeral==0\n        && (pOp->p5 & OPFLAG_AUXDELETE)==0\n        && (pC->wrFlag & OPFLAG_FORDELETE)==0\n      ){\n      nExtraDelete++;\n    }\n    if( pOp->p2 & OPFLAG_NCHANGE ){\n      nExtraDelete--;\n    }\n  }\n#endif\n\n  rc = sqlite3BtreeDelete(pC->uc.pCursor, pOp->p5);\n  pC->cacheStatus = CACHE_STALE;\n  if( rc ) goto abort_due_to_error;\n\n  /* Invoke the update-hook if required. */\n  if( opflags & OPFLAG_NCHANGE ){\n    p->nChange++;\n    if( db->xUpdateCallback && HasRowid(pTab) ){\n      db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, zDb, pTab->zName,\n          pC->movetoTarget);\n      assert( pC->iDb>=0 );\n    }\n  }\n\n  break;\n}\n/* Opcode: ResetCount * * * * *\n**\n** The value of the change counter is copied to the database handle\n** change counter (returned by subsequent calls to sqlite3_changes()).\n** Then the VMs internal change counter resets to 0.\n** This is used by trigger programs.\n*/\ncase OP_ResetCount: {\n  sqlite3VdbeSetChanges(db, p->nChange);\n  p->nChange = 0;\n  break;\n}\n\n/* Opcode: SorterCompare P1 P2 P3 P4\n** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2\n**\n** P1 is a sorter cursor. This instruction compares a prefix of the\n** record blob in register P3 against a prefix of the entry that \n** the sorter cursor currently points to.  Only the first P4 fields\n** of r[P3] and the sorter record are compared.\n**\n** If either P3 or the sorter contains a NULL in one of their significant\n** fields (not counting the P4 fields at the end which are ignored) then\n** the comparison is assumed to be equal.\n**\n** Fall through to next instruction if the two records compare equal to\n** each other.  Jump to P2 if they are different.\n*/\ncase OP_SorterCompare: {\n  VdbeCursor *pC;\n  int res;\n  int nKeyCol;\n\n  pC = p->apCsr[pOp->p1];\n  assert( isSorter(pC) );\n  assert( pOp->p4type==P4_INT32 );\n  pIn3 = &aMem[pOp->p3];\n  nKeyCol = pOp->p4.i;\n  res = 0;\n  rc = sqlite3VdbeSorterCompare(pC, pIn3, nKeyCol, &res);\n  VdbeBranchTaken(res!=0,2);\n  if( rc ) goto abort_due_to_error;\n  if( res ) goto jump_to_p2;\n  break;\n};\n\n/* Opcode: SorterData P1 P2 P3 * *\n** Synopsis: r[P2]=data\n**\n** Write into register P2 the current sorter data for sorter cursor P1.\n** Then clear the column header cache on cursor P3.\n**\n** This opcode is normally use to move a record out of the sorter and into\n** a register that is the source for a pseudo-table cursor created using\n** OpenPseudo.  That pseudo-table cursor is the one that is identified by\n** parameter P3.  Clearing the P3 column cache as part of this opcode saves\n** us from having to issue a separate NullRow instruction to clear that cache.\n*/\ncase OP_SorterData: {\n  VdbeCursor *pC;\n\n  pOut = &aMem[pOp->p2];\n  pC = p->apCsr[pOp->p1];\n  assert( isSorter(pC) );\n  rc = sqlite3VdbeSorterRowkey(pC, pOut);\n  assert( rc!=SQLITE_OK || (pOut->flags & MEM_Blob) );\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  if( rc ) goto abort_due_to_error;\n  p->apCsr[pOp->p3]->cacheStatus = CACHE_STALE;\n  break;\n}\n\n/* Opcode: RowData P1 P2 * * *\n** Synopsis: r[P2]=data\n**\n** Write into register P2 the complete row data for cursor P1.\n** There is no interpretation of the data.  \n** It is just copied onto the P2 register exactly as \n** it is found in the database file.\n**\n** If the P1 cursor must be pointing to a valid row (not a NULL row)\n** of a real table, not a pseudo-table.\n*/\n/* Opcode: RowKey P1 P2 * * *\n** Synopsis: r[P2]=key\n**\n** Write into register P2 the complete row key for cursor P1.\n** There is no interpretation of the data.  \n** The key is copied onto the P2 register exactly as \n** it is found in the database file.\n**\n** If the P1 cursor must be pointing to a valid row (not a NULL row)\n** of a real table, not a pseudo-table.\n*/\ncase OP_RowKey:\ncase OP_RowData: {\n  VdbeCursor *pC;\n  BtCursor *pCrsr;\n  u32 n;\n\n  pOut = &aMem[pOp->p2];\n  memAboutToChange(p, pOut);\n\n  /* Note that RowKey and RowData are really exactly the same instruction */\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( isSorter(pC)==0 );\n  assert( pC->isTable || pOp->opcode!=OP_RowData );\n  assert( pC->isTable==0 || pOp->opcode==OP_RowData );\n  assert( pC->nullRow==0 );\n  assert( pC->uc.pCursor!=0 );\n  pCrsr = pC->uc.pCursor;\n\n  /* The OP_RowKey and OP_RowData opcodes always follow OP_NotExists or\n  ** OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions\n  ** that might invalidate the cursor.\n  ** If this where not the case, on of the following assert()s\n  ** would fail.  Should this ever change (because of changes in the code\n  ** generator) then the fix would be to insert a call to\n  ** sqlite3VdbeCursorMoveto().\n  */\n  assert( pC->deferredMoveto==0 );\n  assert( sqlite3BtreeCursorIsValid(pCrsr) );\n#if 0  /* Not required due to the previous to assert() statements */\n  rc = sqlite3VdbeCursorMoveto(pC);\n  if( rc!=SQLITE_OK ) goto abort_due_to_error;\n#endif\n\n  n = sqlite3BtreePayloadSize(pCrsr);\n  if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    goto too_big;\n  }\n  testcase( n==0 );\n  if( sqlite3VdbeMemClearAndResize(pOut, MAX(n,32)) ){\n    goto no_mem;\n  }\n  pOut->n = n;\n  MemSetTypeFlag(pOut, MEM_Blob);\n  if( pC->isTable==0 ){\n    rc = sqlite3BtreeKey(pCrsr, 0, n, pOut->z);\n  }else{\n    rc = sqlite3BtreeData(pCrsr, 0, n, pOut->z);\n  }\n  if( rc ) goto abort_due_to_error;\n  pOut->enc = SQLITE_UTF8;  /* In case the blob is ever cast to text */\n  UPDATE_MAX_BLOBSIZE(pOut);\n  REGISTER_TRACE(pOp->p2, pOut);\n  break;\n}\n\n/* Opcode: Rowid P1 P2 * * *\n** Synopsis: r[P2]=rowid\n**\n** Store in register P2 an integer which is the key of the table entry that\n** P1 is currently point to.\n**\n** P1 can be either an ordinary table or a virtual table.  There used to\n** be a separate OP_VRowid opcode for use with virtual tables, but this\n** one opcode now works for both table types.\n*/\ncase OP_Rowid: {                 /* out2 */\n  VdbeCursor *pC;\n  i64 v;\n  sqlite3_vtab *pVtab;\n  const sqlite3_module *pModule;\n\n  pOut = out2Prerelease(p, pOp);\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );\n  if( pC->nullRow ){\n    pOut->flags = MEM_Null;\n    break;\n  }else if( pC->deferredMoveto ){\n    v = pC->movetoTarget;\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  }else if( pC->eCurType==CURTYPE_VTAB ){\n    assert( pC->uc.pVCur!=0 );\n    pVtab = pC->uc.pVCur->pVtab;\n    pModule = pVtab->pModule;\n    assert( pModule->xRowid );\n    rc = pModule->xRowid(pC->uc.pVCur, &v);\n    sqlite3VtabImportErrmsg(p, pVtab);\n    if( rc ) goto abort_due_to_error;\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n  }else{\n    assert( pC->eCurType==CURTYPE_BTREE );\n    assert( pC->uc.pCursor!=0 );\n    rc = sqlite3VdbeCursorRestore(pC);\n    if( rc ) goto abort_due_to_error;\n    if( pC->nullRow ){\n      pOut->flags = MEM_Null;\n      break;\n    }\n    v = sqlite3BtreeIntegerKey(pC->uc.pCursor);\n  }\n  pOut->u.i = v;\n  break;\n}\n\n/* Opcode: NullRow P1 * * * *\n**\n** Move the cursor P1 to a null row.  Any OP_Column operations\n** that occur while the cursor is on the null row will always\n** write a NULL.\n*/\ncase OP_NullRow: {\n  VdbeCursor *pC;\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  pC->nullRow = 1;\n  pC->cacheStatus = CACHE_STALE;\n  if( pC->eCurType==CURTYPE_BTREE ){\n    assert( pC->uc.pCursor!=0 );\n    sqlite3BtreeClearCursor(pC->uc.pCursor);\n  }\n  break;\n}\n\n/* Opcode: Last P1 P2 P3 * *\n**\n** The next use of the Rowid or Column or Prev instruction for P1 \n** will refer to the last entry in the database table or index.\n** If the table or index is empty and P2>0, then jump immediately to P2.\n** If P2 is 0 or if the table or index is not empty, fall through\n** to the following instruction.\n**\n** This opcode leaves the cursor configured to move in reverse order,\n** from the end toward the beginning.  In other words, the cursor is\n** configured to use Prev, not Next.\n*/\ncase OP_Last: {        /* jump */\n  VdbeCursor *pC;\n  BtCursor *pCrsr;\n  int res;\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  pCrsr = pC->uc.pCursor;\n  res = 0;\n  assert( pCrsr!=0 );\n  rc = sqlite3BtreeLast(pCrsr, &res);\n  pC->nullRow = (u8)res;\n  pC->deferredMoveto = 0;\n  pC->cacheStatus = CACHE_STALE;\n  pC->seekResult = pOp->p3;\n#ifdef SQLITE_DEBUG\n  pC->seekOp = OP_Last;\n#endif\n  if( rc ) goto abort_due_to_error;\n  if( pOp->p2>0 ){\n    VdbeBranchTaken(res!=0,2);\n    if( res ) goto jump_to_p2;\n  }\n  break;\n}\n\n\n/* Opcode: Sort P1 P2 * * *\n**\n** This opcode does exactly the same thing as OP_Rewind except that\n** it increments an undocumented global variable used for testing.\n**\n** Sorting is accomplished by writing records into a sorting index,\n** then rewinding that index and playing it back from beginning to\n** end.  We use the OP_Sort opcode instead of OP_Rewind to do the\n** rewinding so that the global variable will be incremented and\n** regression tests can determine whether or not the optimizer is\n** correctly optimizing out sorts.\n*/\ncase OP_SorterSort:    /* jump */\ncase OP_Sort: {        /* jump */\n#ifdef SQLITE_TEST\n  sqlite3_sort_count++;\n  sqlite3_search_count--;\n#endif\n  p->aCounter[SQLITE_STMTSTATUS_SORT]++;\n  /* Fall through into OP_Rewind */\n}\n/* Opcode: Rewind P1 P2 * * *\n**\n** The next use of the Rowid or Column or Next instruction for P1 \n** will refer to the first entry in the database table or index.\n** If the table or index is empty, jump immediately to P2.\n** If the table or index is not empty, fall through to the following \n** instruction.\n**\n** This opcode leaves the cursor configured to move in forward order,\n** from the beginning toward the end.  In other words, the cursor is\n** configured to use Next, not Prev.\n*/\ncase OP_Rewind: {        /* jump */\n  VdbeCursor *pC;\n  BtCursor *pCrsr;\n  int res;\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( isSorter(pC)==(pOp->opcode==OP_SorterSort) );\n  res = 1;\n#ifdef SQLITE_DEBUG\n  pC->seekOp = OP_Rewind;\n#endif\n  if( isSorter(pC) ){\n    rc = sqlite3VdbeSorterRewind(pC, &res);\n  }else{\n    assert( pC->eCurType==CURTYPE_BTREE );\n    pCrsr = pC->uc.pCursor;\n    assert( pCrsr );\n    rc = sqlite3BtreeFirst(pCrsr, &res);\n    pC->deferredMoveto = 0;\n    pC->cacheStatus = CACHE_STALE;\n  }\n  if( rc ) goto abort_due_to_error;\n  pC->nullRow = (u8)res;\n  assert( pOp->p2>0 && pOp->p2<p->nOp );\n  VdbeBranchTaken(res!=0,2);\n  if( res ) goto jump_to_p2;\n  break;\n}\n\n/* Opcode: Next P1 P2 P3 P4 P5\n**\n** Advance cursor P1 so that it points to the next key/data pair in its\n** table or index.  If there are no more key/value pairs then fall through\n** to the following instruction.  But if the cursor advance was successful,\n** jump immediately to P2.\n**\n** The Next opcode is only valid following an SeekGT, SeekGE, or\n** OP_Rewind opcode used to position the cursor.  Next is not allowed\n** to follow SeekLT, SeekLE, or OP_Last.\n**\n** The P1 cursor must be for a real table, not a pseudo-table.  P1 must have\n** been opened prior to this opcode or the program will segfault.\n**\n** The P3 value is a hint to the btree implementation. If P3==1, that\n** means P1 is an SQL index and that this instruction could have been\n** omitted if that index had been unique.  P3 is usually 0.  P3 is\n** always either 0 or 1.\n**\n** P4 is always of type P4_ADVANCE. The function pointer points to\n** sqlite3BtreeNext().\n**\n** If P5 is positive and the jump is taken, then event counter\n** number P5-1 in the prepared statement is incremented.\n**\n** See also: Prev, NextIfOpen\n*/\n/* Opcode: NextIfOpen P1 P2 P3 P4 P5\n**\n** This opcode works just like Next except that if cursor P1 is not\n** open it behaves a no-op.\n*/\n/* Opcode: Prev P1 P2 P3 P4 P5\n**\n** Back up cursor P1 so that it points to the previous key/data pair in its\n** table or index.  If there is no previous key/value pairs then fall through\n** to the following instruction.  But if the cursor backup was successful,\n** jump immediately to P2.\n**\n**\n** The Prev opcode is only valid following an SeekLT, SeekLE, or\n** OP_Last opcode used to position the cursor.  Prev is not allowed\n** to follow SeekGT, SeekGE, or OP_Rewind.\n**\n** The P1 cursor must be for a real table, not a pseudo-table.  If P1 is\n** not open then the behavior is undefined.\n**\n** The P3 value is a hint to the btree implementation. If P3==1, that\n** means P1 is an SQL index and that this instruction could have been\n** omitted if that index had been unique.  P3 is usually 0.  P3 is\n** always either 0 or 1.\n**\n** P4 is always of type P4_ADVANCE. The function pointer points to\n** sqlite3BtreePrevious().\n**\n** If P5 is positive and the jump is taken, then event counter\n** number P5-1 in the prepared statement is incremented.\n*/\n/* Opcode: PrevIfOpen P1 P2 P3 P4 P5\n**\n** This opcode works just like Prev except that if cursor P1 is not\n** open it behaves a no-op.\n*/\ncase OP_SorterNext: {  /* jump */\n  VdbeCursor *pC;\n  int res;\n\n  pC = p->apCsr[pOp->p1];\n  assert( isSorter(pC) );\n  res = 0;\n  rc = sqlite3VdbeSorterNext(db, pC, &res);\n  goto next_tail;\ncase OP_PrevIfOpen:    /* jump */\ncase OP_NextIfOpen:    /* jump */\n  if( p->apCsr[pOp->p1]==0 ) break;\n  /* Fall through */\ncase OP_Prev:          /* jump */\ncase OP_Next:          /* jump */\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  assert( pOp->p5<ArraySize(p->aCounter) );\n  pC = p->apCsr[pOp->p1];\n  res = pOp->p3;\n  assert( pC!=0 );\n  assert( pC->deferredMoveto==0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( res==0 || (res==1 && pC->isTable==0) );\n  testcase( res==1 );\n  assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext );\n  assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious );\n  assert( pOp->opcode!=OP_NextIfOpen || pOp->p4.xAdvance==sqlite3BtreeNext );\n  assert( pOp->opcode!=OP_PrevIfOpen || pOp->p4.xAdvance==sqlite3BtreePrevious);\n\n  /* The Next opcode is only used after SeekGT, SeekGE, and Rewind.\n  ** The Prev opcode is only used after SeekLT, SeekLE, and Last. */\n  assert( pOp->opcode!=OP_Next || pOp->opcode!=OP_NextIfOpen\n       || pC->seekOp==OP_SeekGT || pC->seekOp==OP_SeekGE\n       || pC->seekOp==OP_Rewind || pC->seekOp==OP_Found);\n  assert( pOp->opcode!=OP_Prev || pOp->opcode!=OP_PrevIfOpen\n       || pC->seekOp==OP_SeekLT || pC->seekOp==OP_SeekLE\n       || pC->seekOp==OP_Last );\n\n  rc = pOp->p4.xAdvance(pC->uc.pCursor, &res);\nnext_tail:\n  pC->cacheStatus = CACHE_STALE;\n  VdbeBranchTaken(res==0,2);\n  if( rc ) goto abort_due_to_error;\n  if( res==0 ){\n    pC->nullRow = 0;\n    p->aCounter[pOp->p5]++;\n#ifdef SQLITE_TEST\n    sqlite3_search_count++;\n#endif\n    goto jump_to_p2_and_check_for_interrupt;\n  }else{\n    pC->nullRow = 1;\n  }\n  goto check_for_interrupt;\n}\n\n/* Opcode: IdxInsert P1 P2 P3 * P5\n** Synopsis: key=r[P2]\n**\n** Register P2 holds an SQL index key made using the\n** MakeRecord instructions.  This opcode writes that key\n** into the index P1.  Data for the entry is nil.\n**\n** P3 is a flag that provides a hint to the b-tree layer that this\n** insert is likely to be an append.\n**\n** If P5 has the OPFLAG_NCHANGE bit set, then the change counter is\n** incremented by this instruction.  If the OPFLAG_NCHANGE bit is clear,\n** then the change counter is unchanged.\n**\n** If P5 has the OPFLAG_USESEEKRESULT bit set, then the cursor must have\n** just done a seek to the spot where the new entry is to be inserted.\n** This flag avoids doing an extra seek.\n**\n** This instruction only works for indices.  The equivalent instruction\n** for tables is OP_Insert.\n*/\ncase OP_SorterInsert:       /* in2 */\ncase OP_IdxInsert: {        /* in2 */\n  VdbeCursor *pC;\n  BtreePayload x;\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( isSorter(pC)==(pOp->opcode==OP_SorterInsert) );\n  pIn2 = &aMem[pOp->p2];\n  assert( pIn2->flags & MEM_Blob );\n  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;\n  assert( pC->eCurType==CURTYPE_BTREE || pOp->opcode==OP_SorterInsert );\n  assert( pC->isTable==0 );\n  rc = ExpandBlob(pIn2);\n  if( rc ) goto abort_due_to_error;\n  if( pOp->opcode==OP_SorterInsert ){\n    rc = sqlite3VdbeSorterWrite(pC, pIn2);\n  }else{\n    x.nKey = pIn2->n;\n    x.pKey = pIn2->z;\n    rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, pOp->p3, \n        ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)\n        );\n    assert( pC->deferredMoveto==0 );\n    pC->cacheStatus = CACHE_STALE;\n  }\n  if( rc) goto abort_due_to_error;\n  break;\n}\n\n/* Opcode: IdxDelete P1 P2 P3 * *\n** Synopsis: key=r[P2@P3]\n**\n** The content of P3 registers starting at register P2 form\n** an unpacked index key. This opcode removes that entry from the \n** index opened by cursor P1.\n*/\ncase OP_IdxDelete: {\n  VdbeCursor *pC;\n  BtCursor *pCrsr;\n  int res;\n  UnpackedRecord r;\n\n  assert( pOp->p3>0 );\n  assert( pOp->p2>0 && pOp->p2+pOp->p3<=(p->nMem+1 - p->nCursor)+1 );\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  pCrsr = pC->uc.pCursor;\n  assert( pCrsr!=0 );\n  assert( pOp->p5==0 );\n  r.pKeyInfo = pC->pKeyInfo;\n  r.nField = (u16)pOp->p3;\n  r.default_rc = 0;\n  r.aMem = &aMem[pOp->p2];\n  rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res);\n  if( rc ) goto abort_due_to_error;\n  if( res==0 ){\n    rc = sqlite3BtreeDelete(pCrsr, BTREE_AUXDELETE);\n    if( rc ) goto abort_due_to_error;\n  }\n  assert( pC->deferredMoveto==0 );\n  pC->cacheStatus = CACHE_STALE;\n  break;\n}\n\n/* Opcode: Seek P1 * P3 P4 *\n** Synopsis: Move P3 to P1.rowid\n**\n** P1 is an open index cursor and P3 is a cursor on the corresponding\n** table.  This opcode does a deferred seek of the P3 table cursor\n** to the row that corresponds to the current row of P1.\n**\n** This is a deferred seek.  Nothing actually happens until\n** the cursor is used to read a record.  That way, if no reads\n** occur, no unnecessary I/O happens.\n**\n** P4 may be an array of integers (type P4_INTARRAY) containing\n** one entry for each column in the P3 table.  If array entry a(i)\n** is non-zero, then reading column a(i)-1 from cursor P3 is \n** equivalent to performing the deferred seek and then reading column i \n** from P1.  This information is stored in P3 and used to redirect\n** reads against P3 over to P1, thus possibly avoiding the need to\n** seek and read cursor P3.\n*/\n/* Opcode: IdxRowid P1 P2 * * *\n** Synopsis: r[P2]=rowid\n**\n** Write into register P2 an integer which is the last entry in the record at\n** the end of the index key pointed to by cursor P1.  This integer should be\n** the rowid of the table entry to which this index entry points.\n**\n** See also: Rowid, MakeRecord.\n*/\ncase OP_Seek:\ncase OP_IdxRowid: {              /* out2 */\n  VdbeCursor *pC;                /* The P1 index cursor */\n  VdbeCursor *pTabCur;           /* The P2 table cursor (OP_Seek only) */\n  i64 rowid;                     /* Rowid that P1 current points to */\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( pC->uc.pCursor!=0 );\n  assert( pC->isTable==0 );\n  assert( pC->deferredMoveto==0 );\n  assert( !pC->nullRow || pOp->opcode==OP_IdxRowid );\n\n  /* The IdxRowid and Seek opcodes are combined because of the commonality\n  ** of sqlite3VdbeCursorRestore() and sqlite3VdbeIdxRowid(). */\n  rc = sqlite3VdbeCursorRestore(pC);\n\n  /* sqlite3VbeCursorRestore() can only fail if the record has been deleted\n  ** out from under the cursor.  That will never happens for an IdxRowid\n  ** or Seek opcode */\n  if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error;\n\n  if( !pC->nullRow ){\n    rowid = 0;  /* Not needed.  Only used to silence a warning. */\n    rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid);\n    if( rc!=SQLITE_OK ){\n      goto abort_due_to_error;\n    }\n    if( pOp->opcode==OP_Seek ){\n      assert( pOp->p3>=0 && pOp->p3<p->nCursor );\n      pTabCur = p->apCsr[pOp->p3];\n      assert( pTabCur!=0 );\n      assert( pTabCur->eCurType==CURTYPE_BTREE );\n      assert( pTabCur->uc.pCursor!=0 );\n      assert( pTabCur->isTable );\n      pTabCur->nullRow = 0;\n      pTabCur->movetoTarget = rowid;\n      pTabCur->deferredMoveto = 1;\n      assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 );\n      pTabCur->aAltMap = pOp->p4.ai;\n      pTabCur->pAltCursor = pC;\n    }else{\n      pOut = out2Prerelease(p, pOp);\n      pOut->u.i = rowid;\n      pOut->flags = MEM_Int;\n    }\n  }else{\n    assert( pOp->opcode==OP_IdxRowid );\n    sqlite3VdbeMemSetNull(&aMem[pOp->p2]);\n  }\n  break;\n}\n\n/* Opcode: IdxGE P1 P2 P3 P4 P5\n** Synopsis: key=r[P3@P4]\n**\n** The P4 register values beginning with P3 form an unpacked index \n** key that omits the PRIMARY KEY.  Compare this key value against the index \n** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID \n** fields at the end.\n**\n** If the P1 index entry is greater than or equal to the key value\n** then jump to P2.  Otherwise fall through to the next instruction.\n*/\n/* Opcode: IdxGT P1 P2 P3 P4 P5\n** Synopsis: key=r[P3@P4]\n**\n** The P4 register values beginning with P3 form an unpacked index \n** key that omits the PRIMARY KEY.  Compare this key value against the index \n** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID \n** fields at the end.\n**\n** If the P1 index entry is greater than the key value\n** then jump to P2.  Otherwise fall through to the next instruction.\n*/\n/* Opcode: IdxLT P1 P2 P3 P4 P5\n** Synopsis: key=r[P3@P4]\n**\n** The P4 register values beginning with P3 form an unpacked index \n** key that omits the PRIMARY KEY or ROWID.  Compare this key value against\n** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or\n** ROWID on the P1 index.\n**\n** If the P1 index entry is less than the key value then jump to P2.\n** Otherwise fall through to the next instruction.\n*/\n/* Opcode: IdxLE P1 P2 P3 P4 P5\n** Synopsis: key=r[P3@P4]\n**\n** The P4 register values beginning with P3 form an unpacked index \n** key that omits the PRIMARY KEY or ROWID.  Compare this key value against\n** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or\n** ROWID on the P1 index.\n**\n** If the P1 index entry is less than or equal to the key value then jump\n** to P2. Otherwise fall through to the next instruction.\n*/\ncase OP_IdxLE:          /* jump */\ncase OP_IdxGT:          /* jump */\ncase OP_IdxLT:          /* jump */\ncase OP_IdxGE:  {       /* jump */\n  VdbeCursor *pC;\n  int res;\n  UnpackedRecord r;\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  assert( pC->isOrdered );\n  assert( pC->eCurType==CURTYPE_BTREE );\n  assert( pC->uc.pCursor!=0);\n  assert( pC->deferredMoveto==0 );\n  assert( pOp->p5==0 || pOp->p5==1 );\n  assert( pOp->p4type==P4_INT32 );\n  r.pKeyInfo = pC->pKeyInfo;\n  r.nField = (u16)pOp->p4.i;\n  if( pOp->opcode<OP_IdxLT ){\n    assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxGT );\n    r.default_rc = -1;\n  }else{\n    assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT );\n    r.default_rc = 0;\n  }\n  r.aMem = &aMem[pOp->p3];\n#ifdef SQLITE_DEBUG\n  { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }\n#endif\n  res = 0;  /* Not needed.  Only used to silence a warning. */\n  rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);\n  assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) );\n  if( (pOp->opcode&1)==(OP_IdxLT&1) ){\n    assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxLT );\n    res = -res;\n  }else{\n    assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxGT );\n    res++;\n  }\n  VdbeBranchTaken(res>0,2);\n  if( rc ) goto abort_due_to_error;\n  if( res>0 ) goto jump_to_p2;\n  break;\n}\n\n/* Opcode: Destroy P1 P2 P3 * *\n**\n** Delete an entire database table or index whose root page in the database\n** file is given by P1.\n**\n** The table being destroyed is in the main database file if P3==0.  If\n** P3==1 then the table to be clear is in the auxiliary database file\n** that is used to store tables create using CREATE TEMPORARY TABLE.\n**\n** If AUTOVACUUM is enabled then it is possible that another root page\n** might be moved into the newly deleted root page in order to keep all\n** root pages contiguous at the beginning of the database.  The former\n** value of the root page that moved - its value before the move occurred -\n** is stored in register P2.  If no page \n** movement was required (because the table being dropped was already \n** the last one in the database) then a zero is stored in register P2.\n** If AUTOVACUUM is disabled then a zero is stored in register P2.\n**\n** See also: Clear\n*/\ncase OP_Destroy: {     /* out2 */\n  int iMoved;\n  int iDb;\n\n  assert( p->readOnly==0 );\n  assert( pOp->p1>1 );\n  pOut = out2Prerelease(p, pOp);\n  pOut->flags = MEM_Null;\n  if( db->nVdbeRead > db->nVDestroy+1 ){\n    rc = SQLITE_LOCKED;\n    p->errorAction = OE_Abort;\n    goto abort_due_to_error;\n  }else{\n    iDb = pOp->p3;\n    assert( DbMaskTest(p->btreeMask, iDb) );\n    iMoved = 0;  /* Not needed.  Only to silence a warning. */\n    rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved);\n    pOut->flags = MEM_Int;\n    pOut->u.i = iMoved;\n    if( rc ) goto abort_due_to_error;\n#ifndef SQLITE_OMIT_AUTOVACUUM\n    if( iMoved!=0 ){\n      sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1);\n      /* All OP_Destroy operations occur on the same btree */\n      assert( resetSchemaOnFault==0 || resetSchemaOnFault==iDb+1 );\n      resetSchemaOnFault = iDb+1;\n    }\n#endif\n  }\n  break;\n}\n\n/* Opcode: Clear P1 P2 P3\n**\n** Delete all contents of the database table or index whose root page\n** in the database file is given by P1.  But, unlike Destroy, do not\n** remove the table or index from the database file.\n**\n** The table being clear is in the main database file if P2==0.  If\n** P2==1 then the table to be clear is in the auxiliary database file\n** that is used to store tables create using CREATE TEMPORARY TABLE.\n**\n** If the P3 value is non-zero, then the table referred to must be an\n** intkey table (an SQL table, not an index). In this case the row change \n** count is incremented by the number of rows in the table being cleared. \n** If P3 is greater than zero, then the value stored in register P3 is\n** also incremented by the number of rows in the table being cleared.\n**\n** See also: Destroy\n*/\ncase OP_Clear: {\n  int nChange;\n \n  nChange = 0;\n  assert( p->readOnly==0 );\n  assert( DbMaskTest(p->btreeMask, pOp->p2) );\n  rc = sqlite3BtreeClearTable(\n      db->aDb[pOp->p2].pBt, pOp->p1, (pOp->p3 ? &nChange : 0)\n  );\n  if( pOp->p3 ){\n    p->nChange += nChange;\n    if( pOp->p3>0 ){\n      assert( memIsValid(&aMem[pOp->p3]) );\n      memAboutToChange(p, &aMem[pOp->p3]);\n      aMem[pOp->p3].u.i += nChange;\n    }\n  }\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n\n/* Opcode: ResetSorter P1 * * * *\n**\n** Delete all contents from the ephemeral table or sorter\n** that is open on cursor P1.\n**\n** This opcode only works for cursors used for sorting and\n** opened with OP_OpenEphemeral or OP_SorterOpen.\n*/\ncase OP_ResetSorter: {\n  VdbeCursor *pC;\n \n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  pC = p->apCsr[pOp->p1];\n  assert( pC!=0 );\n  if( isSorter(pC) ){\n    sqlite3VdbeSorterReset(db, pC->uc.pSorter);\n  }else{\n    assert( pC->eCurType==CURTYPE_BTREE );\n    assert( pC->isEphemeral );\n    rc = sqlite3BtreeClearTableOfCursor(pC->uc.pCursor);\n    if( rc ) goto abort_due_to_error;\n  }\n  break;\n}\n\n/* Opcode: CreateTable P1 P2 * * *\n** Synopsis: r[P2]=root iDb=P1\n**\n** Allocate a new table in the main database file if P1==0 or in the\n** auxiliary database file if P1==1 or in an attached database if\n** P1>1.  Write the root page number of the new table into\n** register P2\n**\n** The difference between a table and an index is this:  A table must\n** have a 4-byte integer key and can have arbitrary data.  An index\n** has an arbitrary key but no data.\n**\n** See also: CreateIndex\n*/\n/* Opcode: CreateIndex P1 P2 * * *\n** Synopsis: r[P2]=root iDb=P1\n**\n** Allocate a new index in the main database file if P1==0 or in the\n** auxiliary database file if P1==1 or in an attached database if\n** P1>1.  Write the root page number of the new table into\n** register P2.\n**\n** See documentation on OP_CreateTable for additional information.\n*/\ncase OP_CreateIndex:            /* out2 */\ncase OP_CreateTable: {          /* out2 */\n  int pgno;\n  int flags;\n  Db *pDb;\n\n  pOut = out2Prerelease(p, pOp);\n  pgno = 0;\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\n  assert( DbMaskTest(p->btreeMask, pOp->p1) );\n  assert( p->readOnly==0 );\n  pDb = &db->aDb[pOp->p1];\n  assert( pDb->pBt!=0 );\n  if( pOp->opcode==OP_CreateTable ){\n    /* flags = BTREE_INTKEY; */\n    flags = BTREE_INTKEY;\n  }else{\n    flags = BTREE_BLOBKEY;\n  }\n  rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);\n  if( rc ) goto abort_due_to_error;\n  pOut->u.i = pgno;\n  break;\n}\n\n/* Opcode: ParseSchema P1 * * P4 *\n**\n** Read and parse all entries from the SQLITE_MASTER table of database P1\n** that match the WHERE clause P4. \n**\n** This opcode invokes the parser to create a new virtual machine,\n** then runs the new virtual machine.  It is thus a re-entrant opcode.\n*/\ncase OP_ParseSchema: {\n  int iDb;\n  const char *zMaster;\n  char *zSql;\n  InitData initData;\n\n  /* Any prepared statement that invokes this opcode will hold mutexes\n  ** on every btree.  This is a prerequisite for invoking \n  ** sqlite3InitCallback().\n  */\n#ifdef SQLITE_DEBUG\n  for(iDb=0; iDb<db->nDb; iDb++){\n    assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );\n  }\n#endif\n\n  iDb = pOp->p1;\n  assert( iDb>=0 && iDb<db->nDb );\n  assert( DbHasProperty(db, iDb, DB_SchemaLoaded) );\n  /* Used to be a conditional */ {\n    zMaster = SCHEMA_TABLE(iDb);\n    initData.db = db;\n    initData.iDb = pOp->p1;\n    initData.pzErrMsg = &p->zErrMsg;\n    zSql = sqlite3MPrintf(db,\n       \"SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid\",\n       db->aDb[iDb].zDbSName, zMaster, pOp->p4.z);\n    if( zSql==0 ){\n      rc = SQLITE_NOMEM_BKPT;\n    }else{\n      assert( db->init.busy==0 );\n      db->init.busy = 1;\n      initData.rc = SQLITE_OK;\n      assert( !db->mallocFailed );\n      rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);\n      if( rc==SQLITE_OK ) rc = initData.rc;\n      sqlite3DbFree(db, zSql);\n      db->init.busy = 0;\n    }\n  }\n  if( rc ){\n    sqlite3ResetAllSchemasOfConnection(db);\n    if( rc==SQLITE_NOMEM ){\n      goto no_mem;\n    }\n    goto abort_due_to_error;\n  }\n  break;  \n}\n\n#if !defined(SQLITE_OMIT_ANALYZE)\n/* Opcode: LoadAnalysis P1 * * * *\n**\n** Read the sqlite_stat1 table for database P1 and load the content\n** of that table into the internal index hash table.  This will cause\n** the analysis to be used when preparing all subsequent queries.\n*/\ncase OP_LoadAnalysis: {\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\n  rc = sqlite3AnalysisLoad(db, pOp->p1);\n  if( rc ) goto abort_due_to_error;\n  break;  \n}\n#endif /* !defined(SQLITE_OMIT_ANALYZE) */\n\n/* Opcode: DropTable P1 * * P4 *\n**\n** Remove the internal (in-memory) data structures that describe\n** the table named P4 in database P1.  This is called after a table\n** is dropped from disk (using the Destroy opcode) in order to keep \n** the internal representation of the\n** schema consistent with what is on disk.\n*/\ncase OP_DropTable: {\n  sqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p4.z);\n  break;\n}\n\n/* Opcode: DropIndex P1 * * P4 *\n**\n** Remove the internal (in-memory) data structures that describe\n** the index named P4 in database P1.  This is called after an index\n** is dropped from disk (using the Destroy opcode)\n** in order to keep the internal representation of the\n** schema consistent with what is on disk.\n*/\ncase OP_DropIndex: {\n  sqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p4.z);\n  break;\n}\n\n/* Opcode: DropTrigger P1 * * P4 *\n**\n** Remove the internal (in-memory) data structures that describe\n** the trigger named P4 in database P1.  This is called after a trigger\n** is dropped from disk (using the Destroy opcode) in order to keep \n** the internal representation of the\n** schema consistent with what is on disk.\n*/\ncase OP_DropTrigger: {\n  sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p4.z);\n  break;\n}\n\n\n#ifndef SQLITE_OMIT_INTEGRITY_CHECK\n/* Opcode: IntegrityCk P1 P2 P3 P4 P5\n**\n** Do an analysis of the currently open database.  Store in\n** register P1 the text of an error message describing any problems.\n** If no problems are found, store a NULL in register P1.\n**\n** The register P3 contains the maximum number of allowed errors.\n** At most reg(P3) errors will be reported.\n** In other words, the analysis stops as soon as reg(P1) errors are \n** seen.  Reg(P1) is updated with the number of errors remaining.\n**\n** The root page numbers of all tables in the database are integers\n** stored in P4_INTARRAY argument.\n**\n** If P5 is not zero, the check is done on the auxiliary database\n** file, not the main database file.\n**\n** This opcode is used to implement the integrity_check pragma.\n*/\ncase OP_IntegrityCk: {\n  int nRoot;      /* Number of tables to check.  (Number of root pages.) */\n  int *aRoot;     /* Array of rootpage numbers for tables to be checked */\n  int nErr;       /* Number of errors reported */\n  char *z;        /* Text of the error report */\n  Mem *pnErr;     /* Register keeping track of errors remaining */\n\n  assert( p->bIsReader );\n  nRoot = pOp->p2;\n  aRoot = pOp->p4.ai;\n  assert( nRoot>0 );\n  assert( aRoot[nRoot]==0 );\n  assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );\n  pnErr = &aMem[pOp->p3];\n  assert( (pnErr->flags & MEM_Int)!=0 );\n  assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 );\n  pIn1 = &aMem[pOp->p1];\n  assert( pOp->p5<db->nDb );\n  assert( DbMaskTest(p->btreeMask, pOp->p5) );\n  z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot,\n                                 (int)pnErr->u.i, &nErr);\n  pnErr->u.i -= nErr;\n  sqlite3VdbeMemSetNull(pIn1);\n  if( nErr==0 ){\n    assert( z==0 );\n  }else if( z==0 ){\n    goto no_mem;\n  }else{\n    sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free);\n  }\n  UPDATE_MAX_BLOBSIZE(pIn1);\n  sqlite3VdbeChangeEncoding(pIn1, encoding);\n  break;\n}\n#endif /* SQLITE_OMIT_INTEGRITY_CHECK */\n\n/* Opcode: RowSetAdd P1 P2 * * *\n** Synopsis: rowset(P1)=r[P2]\n**\n** Insert the integer value held by register P2 into a boolean index\n** held in register P1.\n**\n** An assertion fails if P2 is not an integer.\n*/\ncase OP_RowSetAdd: {       /* in1, in2 */\n  pIn1 = &aMem[pOp->p1];\n  pIn2 = &aMem[pOp->p2];\n  assert( (pIn2->flags & MEM_Int)!=0 );\n  if( (pIn1->flags & MEM_RowSet)==0 ){\n    sqlite3VdbeMemSetRowSet(pIn1);\n    if( (pIn1->flags & MEM_RowSet)==0 ) goto no_mem;\n  }\n  sqlite3RowSetInsert(pIn1->u.pRowSet, pIn2->u.i);\n  break;\n}\n\n/* Opcode: RowSetRead P1 P2 P3 * *\n** Synopsis: r[P3]=rowset(P1)\n**\n** Extract the smallest value from boolean index P1 and put that value into\n** register P3.  Or, if boolean index P1 is initially empty, leave P3\n** unchanged and jump to instruction P2.\n*/\ncase OP_RowSetRead: {       /* jump, in1, out3 */\n  i64 val;\n\n  pIn1 = &aMem[pOp->p1];\n  if( (pIn1->flags & MEM_RowSet)==0 \n   || sqlite3RowSetNext(pIn1->u.pRowSet, &val)==0\n  ){\n    /* The boolean index is empty */\n    sqlite3VdbeMemSetNull(pIn1);\n    VdbeBranchTaken(1,2);\n    goto jump_to_p2_and_check_for_interrupt;\n  }else{\n    /* A value was pulled from the index */\n    VdbeBranchTaken(0,2);\n    sqlite3VdbeMemSetInt64(&aMem[pOp->p3], val);\n  }\n  goto check_for_interrupt;\n}\n\n/* Opcode: RowSetTest P1 P2 P3 P4\n** Synopsis: if r[P3] in rowset(P1) goto P2\n**\n** Register P3 is assumed to hold a 64-bit integer value. If register P1\n** contains a RowSet object and that RowSet object contains\n** the value held in P3, jump to register P2. Otherwise, insert the\n** integer in P3 into the RowSet and continue on to the\n** next opcode.\n**\n** The RowSet object is optimized for the case where successive sets\n** of integers, where each set contains no duplicates. Each set\n** of values is identified by a unique P4 value. The first set\n** must have P4==0, the final set P4=-1.  P4 must be either -1 or\n** non-negative.  For non-negative values of P4 only the lower 4\n** bits are significant.\n**\n** This allows optimizations: (a) when P4==0 there is no need to test\n** the rowset object for P3, as it is guaranteed not to contain it,\n** (b) when P4==-1 there is no need to insert the value, as it will\n** never be tested for, and (c) when a value that is part of set X is\n** inserted, there is no need to search to see if the same value was\n** previously inserted as part of set X (only if it was previously\n** inserted as part of some other set).\n*/\ncase OP_RowSetTest: {                     /* jump, in1, in3 */\n  int iSet;\n  int exists;\n\n  pIn1 = &aMem[pOp->p1];\n  pIn3 = &aMem[pOp->p3];\n  iSet = pOp->p4.i;\n  assert( pIn3->flags&MEM_Int );\n\n  /* If there is anything other than a rowset object in memory cell P1,\n  ** delete it now and initialize P1 with an empty rowset\n  */\n  if( (pIn1->flags & MEM_RowSet)==0 ){\n    sqlite3VdbeMemSetRowSet(pIn1);\n    if( (pIn1->flags & MEM_RowSet)==0 ) goto no_mem;\n  }\n\n  assert( pOp->p4type==P4_INT32 );\n  assert( iSet==-1 || iSet>=0 );\n  if( iSet ){\n    exists = sqlite3RowSetTest(pIn1->u.pRowSet, iSet, pIn3->u.i);\n    VdbeBranchTaken(exists!=0,2);\n    if( exists ) goto jump_to_p2;\n  }\n  if( iSet>=0 ){\n    sqlite3RowSetInsert(pIn1->u.pRowSet, pIn3->u.i);\n  }\n  break;\n}\n\n\n#ifndef SQLITE_OMIT_TRIGGER\n\n/* Opcode: Program P1 P2 P3 P4 P5\n**\n** Execute the trigger program passed as P4 (type P4_SUBPROGRAM). \n**\n** P1 contains the address of the memory cell that contains the first memory \n** cell in an array of values used as arguments to the sub-program. P2 \n** contains the address to jump to if the sub-program throws an IGNORE \n** exception using the RAISE() function. Register P3 contains the address \n** of a memory cell in this (the parent) VM that is used to allocate the \n** memory required by the sub-vdbe at runtime.\n**\n** P4 is a pointer to the VM containing the trigger program.\n**\n** If P5 is non-zero, then recursive program invocation is enabled.\n*/\ncase OP_Program: {        /* jump */\n  int nMem;               /* Number of memory registers for sub-program */\n  int nByte;              /* Bytes of runtime space required for sub-program */\n  Mem *pRt;               /* Register to allocate runtime space */\n  Mem *pMem;              /* Used to iterate through memory cells */\n  Mem *pEnd;              /* Last memory cell in new array */\n  VdbeFrame *pFrame;      /* New vdbe frame to execute in */\n  SubProgram *pProgram;   /* Sub-program to execute */\n  void *t;                /* Token identifying trigger */\n\n  pProgram = pOp->p4.pProgram;\n  pRt = &aMem[pOp->p3];\n  assert( pProgram->nOp>0 );\n  \n  /* If the p5 flag is clear, then recursive invocation of triggers is \n  ** disabled for backwards compatibility (p5 is set if this sub-program\n  ** is really a trigger, not a foreign key action, and the flag set\n  ** and cleared by the \"PRAGMA recursive_triggers\" command is clear).\n  ** \n  ** It is recursive invocation of triggers, at the SQL level, that is \n  ** disabled. In some cases a single trigger may generate more than one \n  ** SubProgram (if the trigger may be executed with more than one different \n  ** ON CONFLICT algorithm). SubProgram structures associated with a\n  ** single trigger all have the same value for the SubProgram.token \n  ** variable.  */\n  if( pOp->p5 ){\n    t = pProgram->token;\n    for(pFrame=p->pFrame; pFrame && pFrame->token!=t; pFrame=pFrame->pParent);\n    if( pFrame ) break;\n  }\n\n  if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){\n    rc = SQLITE_ERROR;\n    sqlite3VdbeError(p, \"too many levels of trigger recursion\");\n    goto abort_due_to_error;\n  }\n\n  /* Register pRt is used to store the memory required to save the state\n  ** of the current program, and the memory required at runtime to execute\n  ** the trigger program. If this trigger has been fired before, then pRt \n  ** is already allocated. Otherwise, it must be initialized.  */\n  if( (pRt->flags&MEM_Frame)==0 ){\n    /* SubProgram.nMem is set to the number of memory cells used by the \n    ** program stored in SubProgram.aOp. As well as these, one memory\n    ** cell is required for each cursor used by the program. Set local\n    ** variable nMem (and later, VdbeFrame.nChildMem) to this value.\n    */\n    nMem = pProgram->nMem + pProgram->nCsr;\n    assert( nMem>0 );\n    if( pProgram->nCsr==0 ) nMem++;\n    nByte = ROUND8(sizeof(VdbeFrame))\n              + nMem * sizeof(Mem)\n              + pProgram->nCsr * sizeof(VdbeCursor *);\n    pFrame = sqlite3DbMallocZero(db, nByte);\n    if( !pFrame ){\n      goto no_mem;\n    }\n    sqlite3VdbeMemRelease(pRt);\n    pRt->flags = MEM_Frame;\n    pRt->u.pFrame = pFrame;\n\n    pFrame->v = p;\n    pFrame->nChildMem = nMem;\n    pFrame->nChildCsr = pProgram->nCsr;\n    pFrame->pc = (int)(pOp - aOp);\n    pFrame->aMem = p->aMem;\n    pFrame->nMem = p->nMem;\n    pFrame->apCsr = p->apCsr;\n    pFrame->nCursor = p->nCursor;\n    pFrame->aOp = p->aOp;\n    pFrame->nOp = p->nOp;\n    pFrame->token = pProgram->token;\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n    pFrame->anExec = p->anExec;\n#endif\n\n    pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];\n    for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++){\n      pMem->flags = MEM_Undefined;\n      pMem->db = db;\n    }\n  }else{\n    pFrame = pRt->u.pFrame;\n    assert( pProgram->nMem+pProgram->nCsr==pFrame->nChildMem \n        || (pProgram->nCsr==0 && pProgram->nMem+1==pFrame->nChildMem) );\n    assert( pProgram->nCsr==pFrame->nChildCsr );\n    assert( (int)(pOp - aOp)==pFrame->pc );\n  }\n\n  p->nFrame++;\n  pFrame->pParent = p->pFrame;\n  pFrame->lastRowid = lastRowid;\n  pFrame->nChange = p->nChange;\n  pFrame->nDbChange = p->db->nChange;\n  assert( pFrame->pAuxData==0 );\n  pFrame->pAuxData = p->pAuxData;\n  p->pAuxData = 0;\n  p->nChange = 0;\n  p->pFrame = pFrame;\n  p->aMem = aMem = VdbeFrameMem(pFrame);\n  p->nMem = pFrame->nChildMem;\n  p->nCursor = (u16)pFrame->nChildCsr;\n  p->apCsr = (VdbeCursor **)&aMem[p->nMem];\n  p->aOp = aOp = pProgram->aOp;\n  p->nOp = pProgram->nOp;\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n  p->anExec = 0;\n#endif\n  pOp = &aOp[-1];\n\n  break;\n}\n\n/* Opcode: Param P1 P2 * * *\n**\n** This opcode is only ever present in sub-programs called via the \n** OP_Program instruction. Copy a value currently stored in a memory \n** cell of the calling (parent) frame to cell P2 in the current frames \n** address space. This is used by trigger programs to access the new.* \n** and old.* values.\n**\n** The address of the cell in the parent frame is determined by adding\n** the value of the P1 argument to the value of the P1 argument to the\n** calling OP_Program instruction.\n*/\ncase OP_Param: {           /* out2 */\n  VdbeFrame *pFrame;\n  Mem *pIn;\n  pOut = out2Prerelease(p, pOp);\n  pFrame = p->pFrame;\n  pIn = &pFrame->aMem[pOp->p1 + pFrame->aOp[pFrame->pc].p1];   \n  sqlite3VdbeMemShallowCopy(pOut, pIn, MEM_Ephem);\n  break;\n}\n\n#endif /* #ifndef SQLITE_OMIT_TRIGGER */\n\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n/* Opcode: FkCounter P1 P2 * * *\n** Synopsis: fkctr[P1]+=P2\n**\n** Increment a \"constraint counter\" by P2 (P2 may be negative or positive).\n** If P1 is non-zero, the database constraint counter is incremented \n** (deferred foreign key constraints). Otherwise, if P1 is zero, the \n** statement counter is incremented (immediate foreign key constraints).\n*/\ncase OP_FkCounter: {\n  if( db->flags & SQLITE_DeferFKs ){\n    db->nDeferredImmCons += pOp->p2;\n  }else if( pOp->p1 ){\n    db->nDeferredCons += pOp->p2;\n  }else{\n    p->nFkConstraint += pOp->p2;\n  }\n  break;\n}\n\n/* Opcode: FkIfZero P1 P2 * * *\n** Synopsis: if fkctr[P1]==0 goto P2\n**\n** This opcode tests if a foreign key constraint-counter is currently zero.\n** If so, jump to instruction P2. Otherwise, fall through to the next \n** instruction.\n**\n** If P1 is non-zero, then the jump is taken if the database constraint-counter\n** is zero (the one that counts deferred constraint violations). If P1 is\n** zero, the jump is taken if the statement constraint-counter is zero\n** (immediate foreign key constraint violations).\n*/\ncase OP_FkIfZero: {         /* jump */\n  if( pOp->p1 ){\n    VdbeBranchTaken(db->nDeferredCons==0 && db->nDeferredImmCons==0, 2);\n    if( db->nDeferredCons==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;\n  }else{\n    VdbeBranchTaken(p->nFkConstraint==0 && db->nDeferredImmCons==0, 2);\n    if( p->nFkConstraint==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;\n  }\n  break;\n}\n#endif /* #ifndef SQLITE_OMIT_FOREIGN_KEY */\n\n#ifndef SQLITE_OMIT_AUTOINCREMENT\n/* Opcode: MemMax P1 P2 * * *\n** Synopsis: r[P1]=max(r[P1],r[P2])\n**\n** P1 is a register in the root frame of this VM (the root frame is\n** different from the current frame if this instruction is being executed\n** within a sub-program). Set the value of register P1 to the maximum of \n** its current value and the value in register P2.\n**\n** This instruction throws an error if the memory cell is not initially\n** an integer.\n*/\ncase OP_MemMax: {        /* in2 */\n  VdbeFrame *pFrame;\n  if( p->pFrame ){\n    for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);\n    pIn1 = &pFrame->aMem[pOp->p1];\n  }else{\n    pIn1 = &aMem[pOp->p1];\n  }\n  assert( memIsValid(pIn1) );\n  sqlite3VdbeMemIntegerify(pIn1);\n  pIn2 = &aMem[pOp->p2];\n  sqlite3VdbeMemIntegerify(pIn2);\n  if( pIn1->u.i<pIn2->u.i){\n    pIn1->u.i = pIn2->u.i;\n  }\n  break;\n}\n#endif /* SQLITE_OMIT_AUTOINCREMENT */\n\n/* Opcode: IfPos P1 P2 P3 * *\n** Synopsis: if r[P1]>0 then r[P1]-=P3, goto P2\n**\n** Register P1 must contain an integer.\n** If the value of register P1 is 1 or greater, subtract P3 from the\n** value in P1 and jump to P2.\n**\n** If the initial value of register P1 is less than 1, then the\n** value is unchanged and control passes through to the next instruction.\n*/\ncase OP_IfPos: {        /* jump, in1 */\n  pIn1 = &aMem[pOp->p1];\n  assert( pIn1->flags&MEM_Int );\n  VdbeBranchTaken( pIn1->u.i>0, 2);\n  if( pIn1->u.i>0 ){\n    pIn1->u.i -= pOp->p3;\n    goto jump_to_p2;\n  }\n  break;\n}\n\n/* Opcode: OffsetLimit P1 P2 P3 * *\n** Synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)\n**\n** This opcode performs a commonly used computation associated with\n** LIMIT and OFFSET process.  r[P1] holds the limit counter.  r[P3]\n** holds the offset counter.  The opcode computes the combined value\n** of the LIMIT and OFFSET and stores that value in r[P2].  The r[P2]\n** value computed is the total number of rows that will need to be\n** visited in order to complete the query.\n**\n** If r[P3] is zero or negative, that means there is no OFFSET\n** and r[P2] is set to be the value of the LIMIT, r[P1].\n**\n** if r[P1] is zero or negative, that means there is no LIMIT\n** and r[P2] is set to -1. \n**\n** Otherwise, r[P2] is set to the sum of r[P1] and r[P3].\n*/\ncase OP_OffsetLimit: {    /* in1, out2, in3 */\n  pIn1 = &aMem[pOp->p1];\n  pIn3 = &aMem[pOp->p3];\n  pOut = out2Prerelease(p, pOp);\n  assert( pIn1->flags & MEM_Int );\n  assert( pIn3->flags & MEM_Int );\n  pOut->u.i = pIn1->u.i<=0 ? -1 : pIn1->u.i+(pIn3->u.i>0?pIn3->u.i:0);\n  break;\n}\n\n/* Opcode: IfNotZero P1 P2 P3 * *\n** Synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2\n**\n** Register P1 must contain an integer.  If the content of register P1 is\n** initially nonzero, then subtract P3 from the value in register P1 and\n** jump to P2.  If register P1 is initially zero, leave it unchanged\n** and fall through.\n*/\ncase OP_IfNotZero: {        /* jump, in1 */\n  pIn1 = &aMem[pOp->p1];\n  assert( pIn1->flags&MEM_Int );\n  VdbeBranchTaken(pIn1->u.i<0, 2);\n  if( pIn1->u.i ){\n     pIn1->u.i -= pOp->p3;\n     goto jump_to_p2;\n  }\n  break;\n}\n\n/* Opcode: DecrJumpZero P1 P2 * * *\n** Synopsis: if (--r[P1])==0 goto P2\n**\n** Register P1 must hold an integer.  Decrement the value in register P1\n** then jump to P2 if the new value is exactly zero.\n*/\ncase OP_DecrJumpZero: {      /* jump, in1 */\n  pIn1 = &aMem[pOp->p1];\n  assert( pIn1->flags&MEM_Int );\n  pIn1->u.i--;\n  VdbeBranchTaken(pIn1->u.i==0, 2);\n  if( pIn1->u.i==0 ) goto jump_to_p2;\n  break;\n}\n\n\n/* Opcode: AggStep0 * P2 P3 P4 P5\n** Synopsis: accum=r[P3] step(r[P2@P5])\n**\n** Execute the step function for an aggregate.  The\n** function has P5 arguments.   P4 is a pointer to the FuncDef\n** structure that specifies the function.  Register P3 is the\n** accumulator.\n**\n** The P5 arguments are taken from register P2 and its\n** successors.\n*/\n/* Opcode: AggStep * P2 P3 P4 P5\n** Synopsis: accum=r[P3] step(r[P2@P5])\n**\n** Execute the step function for an aggregate.  The\n** function has P5 arguments.   P4 is a pointer to an sqlite3_context\n** object that is used to run the function.  Register P3 is\n** as the accumulator.\n**\n** The P5 arguments are taken from register P2 and its\n** successors.\n**\n** This opcode is initially coded as OP_AggStep0.  On first evaluation,\n** the FuncDef stored in P4 is converted into an sqlite3_context and\n** the opcode is changed.  In this way, the initialization of the\n** sqlite3_context only happens once, instead of on each call to the\n** step function.\n*/\ncase OP_AggStep0: {\n  int n;\n  sqlite3_context *pCtx;\n\n  assert( pOp->p4type==P4_FUNCDEF );\n  n = pOp->p5;\n  assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );\n  assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) );\n  assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+n );\n  pCtx = sqlite3DbMallocRawNN(db, sizeof(*pCtx) + (n-1)*sizeof(sqlite3_value*));\n  if( pCtx==0 ) goto no_mem;\n  pCtx->pMem = 0;\n  pCtx->pFunc = pOp->p4.pFunc;\n  pCtx->iOp = (int)(pOp - aOp);\n  pCtx->pVdbe = p;\n  pCtx->argc = n;\n  pOp->p4type = P4_FUNCCTX;\n  pOp->p4.pCtx = pCtx;\n  pOp->opcode = OP_AggStep;\n  /* Fall through into OP_AggStep */\n}\ncase OP_AggStep: {\n  int i;\n  sqlite3_context *pCtx;\n  Mem *pMem;\n  Mem t;\n\n  assert( pOp->p4type==P4_FUNCCTX );\n  pCtx = pOp->p4.pCtx;\n  pMem = &aMem[pOp->p3];\n\n  /* If this function is inside of a trigger, the register array in aMem[]\n  ** might change from one evaluation to the next.  The next block of code\n  ** checks to see if the register array has changed, and if so it\n  ** reinitializes the relavant parts of the sqlite3_context object */\n  if( pCtx->pMem != pMem ){\n    pCtx->pMem = pMem;\n    for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];\n  }\n\n#ifdef SQLITE_DEBUG\n  for(i=0; i<pCtx->argc; i++){\n    assert( memIsValid(pCtx->argv[i]) );\n    REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);\n  }\n#endif\n\n  pMem->n++;\n  sqlite3VdbeMemInit(&t, db, MEM_Null);\n  pCtx->pOut = &t;\n  pCtx->fErrorOrAux = 0;\n  pCtx->skipFlag = 0;\n  (pCtx->pFunc->xSFunc)(pCtx,pCtx->argc,pCtx->argv); /* IMP: R-24505-23230 */\n  if( pCtx->fErrorOrAux ){\n    if( pCtx->isError ){\n      sqlite3VdbeError(p, \"%s\", sqlite3_value_text(&t));\n      rc = pCtx->isError;\n    }\n    sqlite3VdbeMemRelease(&t);\n    if( rc ) goto abort_due_to_error;\n  }else{\n    assert( t.flags==MEM_Null );\n  }\n  if( pCtx->skipFlag ){\n    assert( pOp[-1].opcode==OP_CollSeq );\n    i = pOp[-1].p1;\n    if( i ) sqlite3VdbeMemSetInt64(&aMem[i], 1);\n  }\n  break;\n}\n\n/* Opcode: AggFinal P1 P2 * P4 *\n** Synopsis: accum=r[P1] N=P2\n**\n** Execute the finalizer function for an aggregate.  P1 is\n** the memory location that is the accumulator for the aggregate.\n**\n** P2 is the number of arguments that the step function takes and\n** P4 is a pointer to the FuncDef for this function.  The P2\n** argument is not used by this opcode.  It is only there to disambiguate\n** functions that can take varying numbers of arguments.  The\n** P4 argument is only needed for the degenerate case where\n** the step function was not previously called.\n*/\ncase OP_AggFinal: {\n  Mem *pMem;\n  assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );\n  pMem = &aMem[pOp->p1];\n  assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 );\n  rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc);\n  if( rc ){\n    sqlite3VdbeError(p, \"%s\", sqlite3_value_text(pMem));\n    goto abort_due_to_error;\n  }\n  sqlite3VdbeChangeEncoding(pMem, encoding);\n  UPDATE_MAX_BLOBSIZE(pMem);\n  if( sqlite3VdbeMemTooBig(pMem) ){\n    goto too_big;\n  }\n  break;\n}\n\n#ifndef SQLITE_OMIT_WAL\n/* Opcode: Checkpoint P1 P2 P3 * *\n**\n** Checkpoint database P1. This is a no-op if P1 is not currently in\n** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL,\n** RESTART, or TRUNCATE.  Write 1 or 0 into mem[P3] if the checkpoint returns\n** SQLITE_BUSY or not, respectively.  Write the number of pages in the\n** WAL after the checkpoint into mem[P3+1] and the number of pages\n** in the WAL that have been checkpointed after the checkpoint\n** completes into mem[P3+2].  However on an error, mem[P3+1] and\n** mem[P3+2] are initialized to -1.\n*/\ncase OP_Checkpoint: {\n  int i;                          /* Loop counter */\n  int aRes[3];                    /* Results */\n  Mem *pMem;                      /* Write results here */\n\n  assert( p->readOnly==0 );\n  aRes[0] = 0;\n  aRes[1] = aRes[2] = -1;\n  assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE\n       || pOp->p2==SQLITE_CHECKPOINT_FULL\n       || pOp->p2==SQLITE_CHECKPOINT_RESTART\n       || pOp->p2==SQLITE_CHECKPOINT_TRUNCATE\n  );\n  rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);\n  if( rc ){\n    if( rc!=SQLITE_BUSY ) goto abort_due_to_error;\n    rc = SQLITE_OK;\n    aRes[0] = 1;\n  }\n  for(i=0, pMem = &aMem[pOp->p3]; i<3; i++, pMem++){\n    sqlite3VdbeMemSetInt64(pMem, (i64)aRes[i]);\n  }    \n  break;\n};  \n#endif\n\n#ifndef SQLITE_OMIT_PRAGMA\n/* Opcode: JournalMode P1 P2 P3 * *\n**\n** Change the journal mode of database P1 to P3. P3 must be one of the\n** PAGER_JOURNALMODE_XXX values. If changing between the various rollback\n** modes (delete, truncate, persist, off and memory), this is a simple\n** operation. No IO is required.\n**\n** If changing into or out of WAL mode the procedure is more complicated.\n**\n** Write a string containing the final journal-mode to register P2.\n*/\ncase OP_JournalMode: {    /* out2 */\n  Btree *pBt;                     /* Btree to change journal mode of */\n  Pager *pPager;                  /* Pager associated with pBt */\n  int eNew;                       /* New journal mode */\n  int eOld;                       /* The old journal mode */\n#ifndef SQLITE_OMIT_WAL\n  const char *zFilename;          /* Name of database file for pPager */\n#endif\n\n  pOut = out2Prerelease(p, pOp);\n  eNew = pOp->p3;\n  assert( eNew==PAGER_JOURNALMODE_DELETE \n       || eNew==PAGER_JOURNALMODE_TRUNCATE \n       || eNew==PAGER_JOURNALMODE_PERSIST \n       || eNew==PAGER_JOURNALMODE_OFF\n       || eNew==PAGER_JOURNALMODE_MEMORY\n       || eNew==PAGER_JOURNALMODE_WAL\n       || eNew==PAGER_JOURNALMODE_QUERY\n  );\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\n  assert( p->readOnly==0 );\n\n  pBt = db->aDb[pOp->p1].pBt;\n  pPager = sqlite3BtreePager(pBt);\n  eOld = sqlite3PagerGetJournalMode(pPager);\n  if( eNew==PAGER_JOURNALMODE_QUERY ) eNew = eOld;\n  if( !sqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld;\n\n#ifndef SQLITE_OMIT_WAL\n  zFilename = sqlite3PagerFilename(pPager, 1);\n\n  /* Do not allow a transition to journal_mode=WAL for a database\n  ** in temporary storage or if the VFS does not support shared memory \n  */\n  if( eNew==PAGER_JOURNALMODE_WAL\n   && (sqlite3Strlen30(zFilename)==0           /* Temp file */\n       || !sqlite3PagerWalSupported(pPager))   /* No shared-memory support */\n  ){\n    eNew = eOld;\n  }\n\n  if( (eNew!=eOld)\n   && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)\n  ){\n    if( !db->autoCommit || db->nVdbeRead>1 ){\n      rc = SQLITE_ERROR;\n      sqlite3VdbeError(p,\n          \"cannot change %s wal mode from within a transaction\",\n          (eNew==PAGER_JOURNALMODE_WAL ? \"into\" : \"out of\")\n      );\n      goto abort_due_to_error;\n    }else{\n \n      if( eOld==PAGER_JOURNALMODE_WAL ){\n        /* If leaving WAL mode, close the log file. If successful, the call\n        ** to PagerCloseWal() checkpoints and deletes the write-ahead-log \n        ** file. An EXCLUSIVE lock may still be held on the database file \n        ** after a successful return. \n        */\n        rc = sqlite3PagerCloseWal(pPager);\n        if( rc==SQLITE_OK ){\n          sqlite3PagerSetJournalMode(pPager, eNew);\n        }\n      }else if( eOld==PAGER_JOURNALMODE_MEMORY ){\n        /* Cannot transition directly from MEMORY to WAL.  Use mode OFF\n        ** as an intermediate */\n        sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);\n      }\n  \n      /* Open a transaction on the database file. Regardless of the journal\n      ** mode, this transaction always uses a rollback journal.\n      */\n      assert( sqlite3BtreeIsInTrans(pBt)==0 );\n      if( rc==SQLITE_OK ){\n        rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));\n      }\n    }\n  }\n#endif /* ifndef SQLITE_OMIT_WAL */\n\n  if( rc ) eNew = eOld;\n  eNew = sqlite3PagerSetJournalMode(pPager, eNew);\n\n  pOut->flags = MEM_Str|MEM_Static|MEM_Term;\n  pOut->z = (char *)sqlite3JournalModename(eNew);\n  pOut->n = sqlite3Strlen30(pOut->z);\n  pOut->enc = SQLITE_UTF8;\n  sqlite3VdbeChangeEncoding(pOut, encoding);\n  if( rc ) goto abort_due_to_error;\n  break;\n};\n#endif /* SQLITE_OMIT_PRAGMA */\n\n#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)\n/* Opcode: Vacuum P1 * * * *\n**\n** Vacuum the entire database P1.  P1 is 0 for \"main\", and 2 or more\n** for an attached database.  The \"temp\" database may not be vacuumed.\n*/\ncase OP_Vacuum: {\n  assert( p->readOnly==0 );\n  rc = sqlite3RunVacuum(&p->zErrMsg, db, pOp->p1);\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n#endif\n\n#if !defined(SQLITE_OMIT_AUTOVACUUM)\n/* Opcode: IncrVacuum P1 P2 * * *\n**\n** Perform a single step of the incremental vacuum procedure on\n** the P1 database. If the vacuum has finished, jump to instruction\n** P2. Otherwise, fall through to the next instruction.\n*/\ncase OP_IncrVacuum: {        /* jump */\n  Btree *pBt;\n\n  assert( pOp->p1>=0 && pOp->p1<db->nDb );\n  assert( DbMaskTest(p->btreeMask, pOp->p1) );\n  assert( p->readOnly==0 );\n  pBt = db->aDb[pOp->p1].pBt;\n  rc = sqlite3BtreeIncrVacuum(pBt);\n  VdbeBranchTaken(rc==SQLITE_DONE,2);\n  if( rc ){\n    if( rc!=SQLITE_DONE ) goto abort_due_to_error;\n    rc = SQLITE_OK;\n    goto jump_to_p2;\n  }\n  break;\n}\n#endif\n\n/* Opcode: Expire P1 * * * *\n**\n** Cause precompiled statements to expire.  When an expired statement\n** is executed using sqlite3_step() it will either automatically\n** reprepare itself (if it was originally created using sqlite3_prepare_v2())\n** or it will fail with SQLITE_SCHEMA.\n** \n** If P1 is 0, then all SQL statements become expired. If P1 is non-zero,\n** then only the currently executing statement is expired.\n*/\ncase OP_Expire: {\n  if( !pOp->p1 ){\n    sqlite3ExpirePreparedStatements(db);\n  }else{\n    p->expired = 1;\n  }\n  break;\n}\n\n#ifndef SQLITE_OMIT_SHARED_CACHE\n/* Opcode: TableLock P1 P2 P3 P4 *\n** Synopsis: iDb=P1 root=P2 write=P3\n**\n** Obtain a lock on a particular table. This instruction is only used when\n** the shared-cache feature is enabled. \n**\n** P1 is the index of the database in sqlite3.aDb[] of the database\n** on which the lock is acquired.  A readlock is obtained if P3==0 or\n** a write lock if P3==1.\n**\n** P2 contains the root-page of the table to lock.\n**\n** P4 contains a pointer to the name of the table being locked. This is only\n** used to generate an error message if the lock cannot be obtained.\n*/\ncase OP_TableLock: {\n  u8 isWriteLock = (u8)pOp->p3;\n  if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommitted) ){\n    int p1 = pOp->p1; \n    assert( p1>=0 && p1<db->nDb );\n    assert( DbMaskTest(p->btreeMask, p1) );\n    assert( isWriteLock==0 || isWriteLock==1 );\n    rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);\n    if( rc ){\n      if( (rc&0xFF)==SQLITE_LOCKED ){\n        const char *z = pOp->p4.z;\n        sqlite3VdbeError(p, \"database table is locked: %s\", z);\n      }\n      goto abort_due_to_error;\n    }\n  }\n  break;\n}\n#endif /* SQLITE_OMIT_SHARED_CACHE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VBegin * * * P4 *\n**\n** P4 may be a pointer to an sqlite3_vtab structure. If so, call the \n** xBegin method for that table.\n**\n** Also, whether or not P4 is set, check that this is not being called from\n** within a callback to a virtual table xSync() method. If it is, the error\n** code will be set to SQLITE_LOCKED.\n*/\ncase OP_VBegin: {\n  VTable *pVTab;\n  pVTab = pOp->p4.pVtab;\n  rc = sqlite3VtabBegin(db, pVTab);\n  if( pVTab ) sqlite3VtabImportErrmsg(p, pVTab->pVtab);\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VCreate P1 P2 * * *\n**\n** P2 is a register that holds the name of a virtual table in database \n** P1. Call the xCreate method for that table.\n*/\ncase OP_VCreate: {\n  Mem sMem;          /* For storing the record being decoded */\n  const char *zTab;  /* Name of the virtual table */\n\n  memset(&sMem, 0, sizeof(sMem));\n  sMem.db = db;\n  /* Because P2 is always a static string, it is impossible for the\n  ** sqlite3VdbeMemCopy() to fail */\n  assert( (aMem[pOp->p2].flags & MEM_Str)!=0 );\n  assert( (aMem[pOp->p2].flags & MEM_Static)!=0 );\n  rc = sqlite3VdbeMemCopy(&sMem, &aMem[pOp->p2]);\n  assert( rc==SQLITE_OK );\n  zTab = (const char*)sqlite3_value_text(&sMem);\n  assert( zTab || db->mallocFailed );\n  if( zTab ){\n    rc = sqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg);\n  }\n  sqlite3VdbeMemRelease(&sMem);\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VDestroy P1 * * P4 *\n**\n** P4 is the name of a virtual table in database P1.  Call the xDestroy method\n** of that table.\n*/\ncase OP_VDestroy: {\n  db->nVDestroy++;\n  rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z);\n  db->nVDestroy--;\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VOpen P1 * * P4 *\n**\n** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.\n** P1 is a cursor number.  This opcode opens a cursor to the virtual\n** table and stores that cursor in P1.\n*/\ncase OP_VOpen: {\n  VdbeCursor *pCur;\n  sqlite3_vtab_cursor *pVCur;\n  sqlite3_vtab *pVtab;\n  const sqlite3_module *pModule;\n\n  assert( p->bIsReader );\n  pCur = 0;\n  pVCur = 0;\n  pVtab = pOp->p4.pVtab->pVtab;\n  if( pVtab==0 || NEVER(pVtab->pModule==0) ){\n    rc = SQLITE_LOCKED;\n    goto abort_due_to_error;\n  }\n  pModule = pVtab->pModule;\n  rc = pModule->xOpen(pVtab, &pVCur);\n  sqlite3VtabImportErrmsg(p, pVtab);\n  if( rc ) goto abort_due_to_error;\n\n  /* Initialize sqlite3_vtab_cursor base class */\n  pVCur->pVtab = pVtab;\n\n  /* Initialize vdbe cursor object */\n  pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB);\n  if( pCur ){\n    pCur->uc.pVCur = pVCur;\n    pVtab->nRef++;\n  }else{\n    assert( db->mallocFailed );\n    pModule->xClose(pVCur);\n    goto no_mem;\n  }\n  break;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VFilter P1 P2 P3 P4 *\n** Synopsis: iplan=r[P3] zplan='P4'\n**\n** P1 is a cursor opened using VOpen.  P2 is an address to jump to if\n** the filtered result set is empty.\n**\n** P4 is either NULL or a string that was generated by the xBestIndex\n** method of the module.  The interpretation of the P4 string is left\n** to the module implementation.\n**\n** This opcode invokes the xFilter method on the virtual table specified\n** by P1.  The integer query plan parameter to xFilter is stored in register\n** P3. Register P3+1 stores the argc parameter to be passed to the\n** xFilter method. Registers P3+2..P3+1+argc are the argc\n** additional parameters which are passed to\n** xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter.\n**\n** A jump is made to P2 if the result set after filtering would be empty.\n*/\ncase OP_VFilter: {   /* jump */\n  int nArg;\n  int iQuery;\n  const sqlite3_module *pModule;\n  Mem *pQuery;\n  Mem *pArgc;\n  sqlite3_vtab_cursor *pVCur;\n  sqlite3_vtab *pVtab;\n  VdbeCursor *pCur;\n  int res;\n  int i;\n  Mem **apArg;\n\n  pQuery = &aMem[pOp->p3];\n  pArgc = &pQuery[1];\n  pCur = p->apCsr[pOp->p1];\n  assert( memIsValid(pQuery) );\n  REGISTER_TRACE(pOp->p3, pQuery);\n  assert( pCur->eCurType==CURTYPE_VTAB );\n  pVCur = pCur->uc.pVCur;\n  pVtab = pVCur->pVtab;\n  pModule = pVtab->pModule;\n\n  /* Grab the index number and argc parameters */\n  assert( (pQuery->flags&MEM_Int)!=0 && pArgc->flags==MEM_Int );\n  nArg = (int)pArgc->u.i;\n  iQuery = (int)pQuery->u.i;\n\n  /* Invoke the xFilter method */\n  res = 0;\n  apArg = p->apArg;\n  for(i = 0; i<nArg; i++){\n    apArg[i] = &pArgc[i+1];\n  }\n  rc = pModule->xFilter(pVCur, iQuery, pOp->p4.z, nArg, apArg);\n  sqlite3VtabImportErrmsg(p, pVtab);\n  if( rc ) goto abort_due_to_error;\n  res = pModule->xEof(pVCur);\n  pCur->nullRow = 0;\n  VdbeBranchTaken(res!=0,2);\n  if( res ) goto jump_to_p2;\n  break;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VColumn P1 P2 P3 * *\n** Synopsis: r[P3]=vcolumn(P2)\n**\n** Store the value of the P2-th column of\n** the row of the virtual-table that the \n** P1 cursor is pointing to into register P3.\n*/\ncase OP_VColumn: {\n  sqlite3_vtab *pVtab;\n  const sqlite3_module *pModule;\n  Mem *pDest;\n  sqlite3_context sContext;\n\n  VdbeCursor *pCur = p->apCsr[pOp->p1];\n  assert( pCur->eCurType==CURTYPE_VTAB );\n  assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );\n  pDest = &aMem[pOp->p3];\n  memAboutToChange(p, pDest);\n  if( pCur->nullRow ){\n    sqlite3VdbeMemSetNull(pDest);\n    break;\n  }\n  pVtab = pCur->uc.pVCur->pVtab;\n  pModule = pVtab->pModule;\n  assert( pModule->xColumn );\n  memset(&sContext, 0, sizeof(sContext));\n  sContext.pOut = pDest;\n  MemSetTypeFlag(pDest, MEM_Null);\n  rc = pModule->xColumn(pCur->uc.pVCur, &sContext, pOp->p2);\n  sqlite3VtabImportErrmsg(p, pVtab);\n  if( sContext.isError ){\n    rc = sContext.isError;\n  }\n  sqlite3VdbeChangeEncoding(pDest, encoding);\n  REGISTER_TRACE(pOp->p3, pDest);\n  UPDATE_MAX_BLOBSIZE(pDest);\n\n  if( sqlite3VdbeMemTooBig(pDest) ){\n    goto too_big;\n  }\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VNext P1 P2 * * *\n**\n** Advance virtual table P1 to the next row in its result set and\n** jump to instruction P2.  Or, if the virtual table has reached\n** the end of its result set, then fall through to the next instruction.\n*/\ncase OP_VNext: {   /* jump */\n  sqlite3_vtab *pVtab;\n  const sqlite3_module *pModule;\n  int res;\n  VdbeCursor *pCur;\n\n  res = 0;\n  pCur = p->apCsr[pOp->p1];\n  assert( pCur->eCurType==CURTYPE_VTAB );\n  if( pCur->nullRow ){\n    break;\n  }\n  pVtab = pCur->uc.pVCur->pVtab;\n  pModule = pVtab->pModule;\n  assert( pModule->xNext );\n\n  /* Invoke the xNext() method of the module. There is no way for the\n  ** underlying implementation to return an error if one occurs during\n  ** xNext(). Instead, if an error occurs, true is returned (indicating that \n  ** data is available) and the error code returned when xColumn or\n  ** some other method is next invoked on the save virtual table cursor.\n  */\n  rc = pModule->xNext(pCur->uc.pVCur);\n  sqlite3VtabImportErrmsg(p, pVtab);\n  if( rc ) goto abort_due_to_error;\n  res = pModule->xEof(pCur->uc.pVCur);\n  VdbeBranchTaken(!res,2);\n  if( !res ){\n    /* If there is data, jump to P2 */\n    goto jump_to_p2_and_check_for_interrupt;\n  }\n  goto check_for_interrupt;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VRename P1 * * P4 *\n**\n** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.\n** This opcode invokes the corresponding xRename method. The value\n** in register P1 is passed as the zName argument to the xRename method.\n*/\ncase OP_VRename: {\n  sqlite3_vtab *pVtab;\n  Mem *pName;\n\n  pVtab = pOp->p4.pVtab->pVtab;\n  pName = &aMem[pOp->p1];\n  assert( pVtab->pModule->xRename );\n  assert( memIsValid(pName) );\n  assert( p->readOnly==0 );\n  REGISTER_TRACE(pOp->p1, pName);\n  assert( pName->flags & MEM_Str );\n  testcase( pName->enc==SQLITE_UTF8 );\n  testcase( pName->enc==SQLITE_UTF16BE );\n  testcase( pName->enc==SQLITE_UTF16LE );\n  rc = sqlite3VdbeChangeEncoding(pName, SQLITE_UTF8);\n  if( rc ) goto abort_due_to_error;\n  rc = pVtab->pModule->xRename(pVtab, pName->z);\n  sqlite3VtabImportErrmsg(p, pVtab);\n  p->expired = 0;\n  if( rc ) goto abort_due_to_error;\n  break;\n}\n#endif\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/* Opcode: VUpdate P1 P2 P3 P4 P5\n** Synopsis: data=r[P3@P2]\n**\n** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.\n** This opcode invokes the corresponding xUpdate method. P2 values\n** are contiguous memory cells starting at P3 to pass to the xUpdate \n** invocation. The value in register (P3+P2-1) corresponds to the \n** p2th element of the argv array passed to xUpdate.\n**\n** The xUpdate method will do a DELETE or an INSERT or both.\n** The argv[0] element (which corresponds to memory cell P3)\n** is the rowid of a row to delete.  If argv[0] is NULL then no \n** deletion occurs.  The argv[1] element is the rowid of the new \n** row.  This can be NULL to have the virtual table select the new \n** rowid for itself.  The subsequent elements in the array are \n** the values of columns in the new row.\n**\n** If P2==1 then no insert is performed.  argv[0] is the rowid of\n** a row to delete.\n**\n** P1 is a boolean flag. If it is set to true and the xUpdate call\n** is successful, then the value returned by sqlite3_last_insert_rowid() \n** is set to the value of the rowid for the row just inserted.\n**\n** P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to\n** apply in the case of a constraint failure on an insert or update.\n*/\ncase OP_VUpdate: {\n  sqlite3_vtab *pVtab;\n  const sqlite3_module *pModule;\n  int nArg;\n  int i;\n  sqlite_int64 rowid;\n  Mem **apArg;\n  Mem *pX;\n\n  assert( pOp->p2==1        || pOp->p5==OE_Fail   || pOp->p5==OE_Rollback \n       || pOp->p5==OE_Abort || pOp->p5==OE_Ignore || pOp->p5==OE_Replace\n  );\n  assert( p->readOnly==0 );\n  pVtab = pOp->p4.pVtab->pVtab;\n  if( pVtab==0 || NEVER(pVtab->pModule==0) ){\n    rc = SQLITE_LOCKED;\n    goto abort_due_to_error;\n  }\n  pModule = pVtab->pModule;\n  nArg = pOp->p2;\n  assert( pOp->p4type==P4_VTAB );\n  if( ALWAYS(pModule->xUpdate) ){\n    u8 vtabOnConflict = db->vtabOnConflict;\n    apArg = p->apArg;\n    pX = &aMem[pOp->p3];\n    for(i=0; i<nArg; i++){\n      assert( memIsValid(pX) );\n      memAboutToChange(p, pX);\n      apArg[i] = pX;\n      pX++;\n    }\n    db->vtabOnConflict = pOp->p5;\n    rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);\n    db->vtabOnConflict = vtabOnConflict;\n    sqlite3VtabImportErrmsg(p, pVtab);\n    if( rc==SQLITE_OK && pOp->p1 ){\n      assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) );\n      db->lastRowid = lastRowid = rowid;\n    }\n    if( (rc&0xff)==SQLITE_CONSTRAINT && pOp->p4.pVtab->bConstraint ){\n      if( pOp->p5==OE_Ignore ){\n        rc = SQLITE_OK;\n      }else{\n        p->errorAction = ((pOp->p5==OE_Replace) ? OE_Abort : pOp->p5);\n      }\n    }else{\n      p->nChange++;\n    }\n    if( rc ) goto abort_due_to_error;\n  }\n  break;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifndef  SQLITE_OMIT_PAGER_PRAGMAS\n/* Opcode: Pagecount P1 P2 * * *\n**\n** Write the current number of pages in database P1 to memory cell P2.\n*/\ncase OP_Pagecount: {            /* out2 */\n  pOut = out2Prerelease(p, pOp);\n  pOut->u.i = sqlite3BtreeLastPage(db->aDb[pOp->p1].pBt);\n  break;\n}\n#endif\n\n\n#ifndef  SQLITE_OMIT_PAGER_PRAGMAS\n/* Opcode: MaxPgcnt P1 P2 P3 * *\n**\n** Try to set the maximum page count for database P1 to the value in P3.\n** Do not let the maximum page count fall below the current page count and\n** do not change the maximum page count value if P3==0.\n**\n** Store the maximum page count after the change in register P2.\n*/\ncase OP_MaxPgcnt: {            /* out2 */\n  unsigned int newMax;\n  Btree *pBt;\n\n  pOut = out2Prerelease(p, pOp);\n  pBt = db->aDb[pOp->p1].pBt;\n  newMax = 0;\n  if( pOp->p3 ){\n    newMax = sqlite3BtreeLastPage(pBt);\n    if( newMax < (unsigned)pOp->p3 ) newMax = (unsigned)pOp->p3;\n  }\n  pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax);\n  break;\n}\n#endif\n\n\n/* Opcode: Init P1 P2 * P4 *\n** Synopsis: Start at P2\n**\n** Programs contain a single instance of this opcode as the very first\n** opcode.\n**\n** If tracing is enabled (by the sqlite3_trace()) interface, then\n** the UTF-8 string contained in P4 is emitted on the trace callback.\n** Or if P4 is blank, use the string returned by sqlite3_sql().\n**\n** If P2 is not zero, jump to instruction P2.\n**\n** Increment the value of P1 so that OP_Once opcodes will jump the\n** first time they are evaluated for this run.\n*/\ncase OP_Init: {          /* jump */\n  char *zTrace;\n  int i;\n\n  /* If the P4 argument is not NULL, then it must be an SQL comment string.\n  ** The \"--\" string is broken up to prevent false-positives with srcck1.c.\n  **\n  ** This assert() provides evidence for:\n  ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that\n  ** would have been returned by the legacy sqlite3_trace() interface by\n  ** using the X argument when X begins with \"--\" and invoking\n  ** sqlite3_expanded_sql(P) otherwise.\n  */\n  assert( pOp->p4.z==0 || strncmp(pOp->p4.z, \"-\" \"- \", 3)==0 );\n  assert( pOp==p->aOp );  /* Always instruction 0 */\n\n#ifndef SQLITE_OMIT_TRACE\n  if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0\n   && !p->doingRerun\n   && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0\n  ){\n#ifndef SQLITE_OMIT_DEPRECATED\n    if( db->mTrace & SQLITE_TRACE_LEGACY ){\n      void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace;\n      char *z = sqlite3VdbeExpandSql(p, zTrace);\n      x(db->pTraceArg, z);\n      sqlite3_free(z);\n    }else\n#endif\n    {\n      (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, zTrace);\n    }\n  }\n#ifdef SQLITE_USE_FCNTL_TRACE\n  zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql);\n  if( zTrace ){\n    int j;\n    for(j=0; j<db->nDb; j++){\n      if( DbMaskTest(p->btreeMask, j)==0 ) continue;\n      sqlite3_file_control(db, db->aDb[j].zDbSName, SQLITE_FCNTL_TRACE, zTrace);\n    }\n  }\n#endif /* SQLITE_USE_FCNTL_TRACE */\n#ifdef SQLITE_DEBUG\n  if( (db->flags & SQLITE_SqlTrace)!=0\n   && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0\n  ){\n    sqlite3DebugPrintf(\"SQL-trace: %s\\n\", zTrace);\n  }\n#endif /* SQLITE_DEBUG */\n#endif /* SQLITE_OMIT_TRACE */\n  assert( pOp->p2>0 );\n  if( pOp->p1>=sqlite3GlobalConfig.iOnceResetThreshold ){\n    for(i=1; i<p->nOp; i++){\n      if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0;\n    }\n    pOp->p1 = 0;\n  }\n  pOp->p1++;\n  goto jump_to_p2;\n}\n\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n/* Opcode: CursorHint P1 * * P4 *\n**\n** Provide a hint to cursor P1 that it only needs to return rows that\n** satisfy the Expr in P4.  TK_REGISTER terms in the P4 expression refer\n** to values currently held in registers.  TK_COLUMN terms in the P4\n** expression refer to columns in the b-tree to which cursor P1 is pointing.\n*/\ncase OP_CursorHint: {\n  VdbeCursor *pC;\n\n  assert( pOp->p1>=0 && pOp->p1<p->nCursor );\n  assert( pOp->p4type==P4_EXPR );\n  pC = p->apCsr[pOp->p1];\n  if( pC ){\n    assert( pC->eCurType==CURTYPE_BTREE );\n    sqlite3BtreeCursorHint(pC->uc.pCursor, BTREE_HINT_RANGE,\n                           pOp->p4.pExpr, aMem);\n  }\n  break;\n}\n#endif /* SQLITE_ENABLE_CURSOR_HINTS */\n\n/* Opcode: Noop * * * * *\n**\n** Do nothing.  This instruction is often useful as a jump\n** destination.\n*/\n/*\n** The magic Explain opcode are only inserted when explain==2 (which\n** is to say when the EXPLAIN QUERY PLAN syntax is used.)\n** This opcode records information from the optimizer.  It is the\n** the same as a no-op.  This opcodesnever appears in a real VM program.\n*/\ndefault: {          /* This is really OP_Noop and OP_Explain */\n  assert( pOp->opcode==OP_Noop || pOp->opcode==OP_Explain );\n  break;\n}\n\n/*****************************************************************************\n** The cases of the switch statement above this line should all be indented\n** by 6 spaces.  But the left-most 6 spaces have been removed to improve the\n** readability.  From this point on down, the normal indentation rules are\n** restored.\n*****************************************************************************/\n    }\n\n#ifdef VDBE_PROFILE\n    {\n      u64 endTime = sqlite3Hwtime();\n      if( endTime>start ) pOrigOp->cycles += endTime - start;\n      pOrigOp->cnt++;\n    }\n#endif\n\n    /* The following code adds nothing to the actual functionality\n    ** of the program.  It is only here for testing and debugging.\n    ** On the other hand, it does burn CPU cycles every time through\n    ** the evaluator loop.  So we can leave it out when NDEBUG is defined.\n    */\n#ifndef NDEBUG\n    assert( pOp>=&aOp[-1] && pOp<&aOp[p->nOp-1] );\n\n#ifdef SQLITE_DEBUG\n    if( db->flags & SQLITE_VdbeTrace ){\n      u8 opProperty = sqlite3OpcodeProperty[pOrigOp->opcode];\n      if( rc!=0 ) printf(\"rc=%d\\n\",rc);\n      if( opProperty & (OPFLG_OUT2) ){\n        registerTrace(pOrigOp->p2, &aMem[pOrigOp->p2]);\n      }\n      if( opProperty & OPFLG_OUT3 ){\n        registerTrace(pOrigOp->p3, &aMem[pOrigOp->p3]);\n      }\n    }\n#endif  /* SQLITE_DEBUG */\n#endif  /* NDEBUG */\n  }  /* The end of the for(;;) loop the loops through opcodes */\n\n  /* If we reach this point, it means that execution is finished with\n  ** an error of some kind.\n  */\nabort_due_to_error:\n  if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT;\n  assert( rc );\n  if( p->zErrMsg==0 && rc!=SQLITE_IOERR_NOMEM ){\n    sqlite3VdbeError(p, \"%s\", sqlite3ErrStr(rc));\n  }\n  p->rc = rc;\n  sqlite3SystemError(db, rc);\n  testcase( sqlite3GlobalConfig.xLog!=0 );\n  sqlite3_log(rc, \"statement aborts at %d: [%s] %s\", \n                   (int)(pOp - aOp), p->zSql, p->zErrMsg);\n  sqlite3VdbeHalt(p);\n  if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);\n  rc = SQLITE_ERROR;\n  if( resetSchemaOnFault>0 ){\n    sqlite3ResetOneSchema(db, resetSchemaOnFault-1);\n  }\n\n  /* This is the only way out of this procedure.  We have to\n  ** release the mutexes on btrees that were acquired at the\n  ** top. */\nvdbe_return:\n  db->lastRowid = lastRowid;\n  testcase( nVmStep>0 );\n  p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep;\n  sqlite3VdbeLeave(p);\n  assert( rc!=SQLITE_OK || nExtraDelete==0 \n       || sqlite3_strlike(\"DELETE%\",p->zSql,0)!=0 \n  );\n  return rc;\n\n  /* Jump to here if a string or blob larger than SQLITE_MAX_LENGTH\n  ** is encountered.\n  */\ntoo_big:\n  sqlite3VdbeError(p, \"string or blob too big\");\n  rc = SQLITE_TOOBIG;\n  goto abort_due_to_error;\n\n  /* Jump to here if a malloc() fails.\n  */\nno_mem:\n  sqlite3OomFault(db);\n  sqlite3VdbeError(p, \"out of memory\");\n  rc = SQLITE_NOMEM_BKPT;\n  goto abort_due_to_error;\n\n  /* Jump to here if the sqlite3_interrupt() API sets the interrupt\n  ** flag.\n  */\nabort_due_to_interrupt:\n  assert( db->u1.isInterrupted );\n  rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;\n  p->rc = rc;\n  sqlite3VdbeError(p, \"%s\", sqlite3ErrStr(rc));\n  goto abort_due_to_error;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbe.h",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** Header file for the Virtual DataBase Engine (VDBE)\n**\n** This header defines the interface to the virtual database engine\n** or VDBE.  The VDBE implements an abstract machine that runs a\n** simple program to access and modify the underlying database.\n*/\n#ifndef SQLITE_VDBE_H\n#define SQLITE_VDBE_H\n#include <stdio.h>\n\n/*\n** A single VDBE is an opaque structure named \"Vdbe\".  Only routines\n** in the source file sqliteVdbe.c are allowed to see the insides\n** of this structure.\n*/\ntypedef struct Vdbe Vdbe;\n\n/*\n** The names of the following types declared in vdbeInt.h are required\n** for the VdbeOp definition.\n*/\ntypedef struct Mem Mem;\ntypedef struct SubProgram SubProgram;\n\n/*\n** A single instruction of the virtual machine has an opcode\n** and as many as three operands.  The instruction is recorded\n** as an instance of the following structure:\n*/\nstruct VdbeOp {\n  u8 opcode;          /* What operation to perform */\n  signed char p4type; /* One of the P4_xxx constants for p4 */\n  u8 notUsed1;\n  u8 p5;              /* Fifth parameter is an unsigned character */\n  int p1;             /* First operand */\n  int p2;             /* Second parameter (often the jump destination) */\n  int p3;             /* The third parameter */\n  union p4union {     /* fourth parameter */\n    int i;                 /* Integer value if p4type==P4_INT32 */\n    void *p;               /* Generic pointer */\n    char *z;               /* Pointer to data for string (char array) types */\n    i64 *pI64;             /* Used when p4type is P4_INT64 */\n    double *pReal;         /* Used when p4type is P4_REAL */\n    FuncDef *pFunc;        /* Used when p4type is P4_FUNCDEF */\n    sqlite3_context *pCtx; /* Used when p4type is P4_FUNCCTX */\n    CollSeq *pColl;        /* Used when p4type is P4_COLLSEQ */\n    Mem *pMem;             /* Used when p4type is P4_MEM */\n    VTable *pVtab;         /* Used when p4type is P4_VTAB */\n    KeyInfo *pKeyInfo;     /* Used when p4type is P4_KEYINFO */\n    int *ai;               /* Used when p4type is P4_INTARRAY */\n    SubProgram *pProgram;  /* Used when p4type is P4_SUBPROGRAM */\n    Table *pTab;           /* Used when p4type is P4_TABLE */\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n    Expr *pExpr;           /* Used when p4type is P4_EXPR */\n#endif\n    int (*xAdvance)(BtCursor *, int *);\n  } p4;\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n  char *zComment;          /* Comment to improve readability */\n#endif\n#ifdef VDBE_PROFILE\n  u32 cnt;                 /* Number of times this instruction was executed */\n  u64 cycles;              /* Total time spent executing this instruction */\n#endif\n#ifdef SQLITE_VDBE_COVERAGE\n  int iSrcLine;            /* Source-code line that generated this opcode */\n#endif\n};\ntypedef struct VdbeOp VdbeOp;\n\n\n/*\n** A sub-routine used to implement a trigger program.\n*/\nstruct SubProgram {\n  VdbeOp *aOp;                  /* Array of opcodes for sub-program */\n  int nOp;                      /* Elements in aOp[] */\n  int nMem;                     /* Number of memory cells required */\n  int nCsr;                     /* Number of cursors required */\n  void *token;                  /* id that may be used to recursive triggers */\n  SubProgram *pNext;            /* Next sub-program already visited */\n};\n\n/*\n** A smaller version of VdbeOp used for the VdbeAddOpList() function because\n** it takes up less space.\n*/\nstruct VdbeOpList {\n  u8 opcode;          /* What operation to perform */\n  signed char p1;     /* First operand */\n  signed char p2;     /* Second parameter (often the jump destination) */\n  signed char p3;     /* Third parameter */\n};\ntypedef struct VdbeOpList VdbeOpList;\n\n/*\n** Allowed values of VdbeOp.p4type\n*/\n#define P4_NOTUSED    0   /* The P4 parameter is not used */\n#define P4_DYNAMIC  (-1)  /* Pointer to a string obtained from sqliteMalloc() */\n#define P4_STATIC   (-2)  /* Pointer to a static string */\n#define P4_COLLSEQ  (-4)  /* P4 is a pointer to a CollSeq structure */\n#define P4_FUNCDEF  (-5)  /* P4 is a pointer to a FuncDef structure */\n#define P4_KEYINFO  (-6)  /* P4 is a pointer to a KeyInfo structure */\n#define P4_EXPR     (-7)  /* P4 is a pointer to an Expr tree */\n#define P4_MEM      (-8)  /* P4 is a pointer to a Mem*    structure */\n#define P4_TRANSIENT  0   /* P4 is a pointer to a transient string */\n#define P4_VTAB     (-10) /* P4 is a pointer to an sqlite3_vtab structure */\n#define P4_MPRINTF  (-11) /* P4 is a string obtained from sqlite3_mprintf() */\n#define P4_REAL     (-12) /* P4 is a 64-bit floating point value */\n#define P4_INT64    (-13) /* P4 is a 64-bit signed integer */\n#define P4_INT32    (-14) /* P4 is a 32-bit signed integer */\n#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */\n#define P4_SUBPROGRAM  (-18) /* P4 is a pointer to a SubProgram structure */\n#define P4_ADVANCE  (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */\n#define P4_TABLE    (-20) /* P4 is a pointer to a Table structure */\n#define P4_FUNCCTX  (-21) /* P4 is a pointer to an sqlite3_context object */\n\n/* Error message codes for OP_Halt */\n#define P5_ConstraintNotNull 1\n#define P5_ConstraintUnique  2\n#define P5_ConstraintCheck   3\n#define P5_ConstraintFK      4\n\n/*\n** The Vdbe.aColName array contains 5n Mem structures, where n is the \n** number of columns of data returned by the statement.\n*/\n#define COLNAME_NAME     0\n#define COLNAME_DECLTYPE 1\n#define COLNAME_DATABASE 2\n#define COLNAME_TABLE    3\n#define COLNAME_COLUMN   4\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\n# define COLNAME_N        5      /* Number of COLNAME_xxx symbols */\n#else\n# ifdef SQLITE_OMIT_DECLTYPE\n#   define COLNAME_N      1      /* Store only the name */\n# else\n#   define COLNAME_N      2      /* Store the name and decltype */\n# endif\n#endif\n\n/*\n** The following macro converts a relative address in the p2 field\n** of a VdbeOp structure into a negative number so that \n** sqlite3VdbeAddOpList() knows that the address is relative.  Calling\n** the macro again restores the address.\n*/\n#define ADDR(X)  (-1-(X))\n\n/*\n** The makefile scans the vdbe.c source file and creates the \"opcodes.h\"\n** header file that defines a number for each opcode used by the VDBE.\n*/\n#include \"opcodes.h\"\n\n/*\n** Prototypes for the VDBE interface.  See comments on the implementation\n** for a description of what each of these routines does.\n*/\nVdbe *sqlite3VdbeCreate(Parse*);\nint sqlite3VdbeAddOp0(Vdbe*,int);\nint sqlite3VdbeAddOp1(Vdbe*,int,int);\nint sqlite3VdbeAddOp2(Vdbe*,int,int,int);\nint sqlite3VdbeGoto(Vdbe*,int);\nint sqlite3VdbeLoadString(Vdbe*,int,const char*);\nvoid sqlite3VdbeMultiLoad(Vdbe*,int,const char*,...);\nint sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);\nint sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);\nint sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int);\nint sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);\nvoid sqlite3VdbeEndCoroutine(Vdbe*,int);\n#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)\n  void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N);\n#else\n# define sqlite3VdbeVerifyNoMallocRequired(A,B)\n#endif\nVdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno);\nvoid sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);\nvoid sqlite3VdbeChangeOpcode(Vdbe*, u32 addr, u8);\nvoid sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);\nvoid sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2);\nvoid sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3);\nvoid sqlite3VdbeChangeP5(Vdbe*, u8 P5);\nvoid sqlite3VdbeJumpHere(Vdbe*, int addr);\nint sqlite3VdbeChangeToNoop(Vdbe*, int addr);\nint sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op);\nvoid sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);\nvoid sqlite3VdbeSetP4KeyInfo(Parse*, Index*);\nvoid sqlite3VdbeUsesBtree(Vdbe*, int);\nVdbeOp *sqlite3VdbeGetOp(Vdbe*, int);\nint sqlite3VdbeMakeLabel(Vdbe*);\nvoid sqlite3VdbeRunOnlyOnce(Vdbe*);\nvoid sqlite3VdbeReusable(Vdbe*);\nvoid sqlite3VdbeDelete(Vdbe*);\nvoid sqlite3VdbeClearObject(sqlite3*,Vdbe*);\nvoid sqlite3VdbeMakeReady(Vdbe*,Parse*);\nint sqlite3VdbeFinalize(Vdbe*);\nvoid sqlite3VdbeResolveLabel(Vdbe*, int);\nint sqlite3VdbeCurrentAddr(Vdbe*);\n#ifdef SQLITE_DEBUG\n  int sqlite3VdbeAssertMayAbort(Vdbe *, int);\n#endif\nvoid sqlite3VdbeResetStepResult(Vdbe*);\nvoid sqlite3VdbeRewind(Vdbe*);\nint sqlite3VdbeReset(Vdbe*);\nvoid sqlite3VdbeSetNumCols(Vdbe*,int);\nint sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));\nvoid sqlite3VdbeCountChanges(Vdbe*);\nsqlite3 *sqlite3VdbeDb(Vdbe*);\nvoid sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int);\nvoid sqlite3VdbeSwap(Vdbe*,Vdbe*);\nVdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);\nsqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8);\nvoid sqlite3VdbeSetVarmask(Vdbe*, int);\n#ifndef SQLITE_OMIT_TRACE\n  char *sqlite3VdbeExpandSql(Vdbe*, const char*);\n#endif\nint sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);\n\nvoid sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);\nint sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);\nint sqlite3VdbeRecordCompareWithSkip(int, const void *, UnpackedRecord *, int);\nUnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **);\n\ntypedef int (*RecordCompare)(int,const void*,UnpackedRecord*);\nRecordCompare sqlite3VdbeFindCompare(UnpackedRecord*);\n\n#ifndef SQLITE_OMIT_TRIGGER\nvoid sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);\n#endif\n\n/* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on\n** each VDBE opcode.\n**\n** Use the SQLITE_ENABLE_MODULE_COMMENTS macro to see some extra no-op\n** comments in VDBE programs that show key decision points in the code\n** generator.\n*/\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n  void sqlite3VdbeComment(Vdbe*, const char*, ...);\n# define VdbeComment(X)  sqlite3VdbeComment X\n  void sqlite3VdbeNoopComment(Vdbe*, const char*, ...);\n# define VdbeNoopComment(X)  sqlite3VdbeNoopComment X\n# ifdef SQLITE_ENABLE_MODULE_COMMENTS\n#   define VdbeModuleComment(X)  sqlite3VdbeNoopComment X\n# else\n#   define VdbeModuleComment(X)\n# endif\n#else\n# define VdbeComment(X)\n# define VdbeNoopComment(X)\n# define VdbeModuleComment(X)\n#endif\n\n/*\n** The VdbeCoverage macros are used to set a coverage testing point\n** for VDBE branch instructions.  The coverage testing points are line\n** numbers in the sqlite3.c source file.  VDBE branch coverage testing\n** only works with an amalagmation build.  That's ok since a VDBE branch\n** coverage build designed for testing the test suite only.  No application\n** should ever ship with VDBE branch coverage measuring turned on.\n**\n**    VdbeCoverage(v)                  // Mark the previously coded instruction\n**                                     // as a branch\n**\n**    VdbeCoverageIf(v, conditional)   // Mark previous if conditional true\n**\n**    VdbeCoverageAlwaysTaken(v)       // Previous branch is always taken\n**\n**    VdbeCoverageNeverTaken(v)        // Previous branch is never taken\n**\n** Every VDBE branch operation must be tagged with one of the macros above.\n** If not, then when \"make test\" is run with -DSQLITE_VDBE_COVERAGE and\n** -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch()\n** routine in vdbe.c, alerting the developer to the missed tag.\n*/\n#ifdef SQLITE_VDBE_COVERAGE\n  void sqlite3VdbeSetLineNumber(Vdbe*,int);\n# define VdbeCoverage(v) sqlite3VdbeSetLineNumber(v,__LINE__)\n# define VdbeCoverageIf(v,x) if(x)sqlite3VdbeSetLineNumber(v,__LINE__)\n# define VdbeCoverageAlwaysTaken(v) sqlite3VdbeSetLineNumber(v,2);\n# define VdbeCoverageNeverTaken(v) sqlite3VdbeSetLineNumber(v,1);\n# define VDBE_OFFSET_LINENO(x) (__LINE__+x)\n#else\n# define VdbeCoverage(v)\n# define VdbeCoverageIf(v,x)\n# define VdbeCoverageAlwaysTaken(v)\n# define VdbeCoverageNeverTaken(v)\n# define VDBE_OFFSET_LINENO(x) 0\n#endif\n\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\nvoid sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*);\n#else\n# define sqlite3VdbeScanStatus(a,b,c,d,e)\n#endif\n\n#endif /* SQLITE_VDBE_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbeInt.h",
    "content": "/*\n** 2003 September 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This is the header file for information that is private to the\n** VDBE.  This information used to all be at the top of the single\n** source code file \"vdbe.c\".  When that file became too big (over\n** 6000 lines long) it was split up into several smaller files and\n** this header information was factored out.\n*/\n#ifndef SQLITE_VDBEINT_H\n#define SQLITE_VDBEINT_H\n\n/*\n** The maximum number of times that a statement will try to reparse\n** itself before giving up and returning SQLITE_SCHEMA.\n*/\n#ifndef SQLITE_MAX_SCHEMA_RETRY\n# define SQLITE_MAX_SCHEMA_RETRY 50\n#endif\n\n/*\n** VDBE_DISPLAY_P4 is true or false depending on whether or not the\n** \"explain\" P4 display logic is enabled.\n*/\n#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) \\\n     || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)\n# define VDBE_DISPLAY_P4 1\n#else\n# define VDBE_DISPLAY_P4 0\n#endif\n\n/*\n** SQL is translated into a sequence of instructions to be\n** executed by a virtual machine.  Each instruction is an instance\n** of the following structure.\n*/\ntypedef struct VdbeOp Op;\n\n/*\n** Boolean values\n*/\ntypedef unsigned Bool;\n\n/* Opaque type used by code in vdbesort.c */\ntypedef struct VdbeSorter VdbeSorter;\n\n/* Elements of the linked list at Vdbe.pAuxData */\ntypedef struct AuxData AuxData;\n\n/* Types of VDBE cursors */\n#define CURTYPE_BTREE       0\n#define CURTYPE_SORTER      1\n#define CURTYPE_VTAB        2\n#define CURTYPE_PSEUDO      3\n\n/*\n** A VdbeCursor is an superclass (a wrapper) for various cursor objects:\n**\n**      * A b-tree cursor\n**          -  In the main database or in an ephemeral database\n**          -  On either an index or a table\n**      * A sorter\n**      * A virtual table\n**      * A one-row \"pseudotable\" stored in a single register\n*/\ntypedef struct VdbeCursor VdbeCursor;\nstruct VdbeCursor {\n  u8 eCurType;          /* One of the CURTYPE_* values above */\n  i8 iDb;               /* Index of cursor database in db->aDb[] (or -1) */\n  u8 nullRow;           /* True if pointing to a row with no data */\n  u8 deferredMoveto;    /* A call to sqlite3BtreeMoveto() is needed */\n  u8 isTable;           /* True for rowid tables.  False for indexes */\n#ifdef SQLITE_DEBUG\n  u8 seekOp;            /* Most recent seek operation on this cursor */\n  u8 wrFlag;            /* The wrFlag argument to sqlite3BtreeCursor() */\n#endif\n  Bool isEphemeral:1;   /* True for an ephemeral table */\n  Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */\n  Bool isOrdered:1;     /* True if the table is not BTREE_UNORDERED */\n  Pgno pgnoRoot;        /* Root page of the open btree cursor */\n  i16 nField;           /* Number of fields in the header */\n  u16 nHdrParsed;       /* Number of header fields parsed so far */\n  union {\n    BtCursor *pCursor;          /* CURTYPE_BTREE.  Btree cursor */\n    sqlite3_vtab_cursor *pVCur; /* CURTYPE_VTAB.   Vtab cursor */\n    int pseudoTableReg;         /* CURTYPE_PSEUDO. Reg holding content. */\n    VdbeSorter *pSorter;        /* CURTYPE_SORTER. Sorter object */\n  } uc;\n  Btree *pBt;           /* Separate file holding temporary table */\n  KeyInfo *pKeyInfo;    /* Info about index keys needed by index cursors */\n  int seekResult;       /* Result of previous sqlite3BtreeMoveto() */\n  i64 seqCount;         /* Sequence counter */\n  i64 movetoTarget;     /* Argument to the deferred sqlite3BtreeMoveto() */\n  VdbeCursor *pAltCursor; /* Associated index cursor from which to read */\n  int *aAltMap;           /* Mapping from table to index column numbers */\n#ifdef SQLITE_ENABLE_COLUMN_USED_MASK\n  u64 maskUsed;         /* Mask of columns used by this cursor */\n#endif\n\n  /* Cached information about the header for the data record that the\n  ** cursor is currently pointing to.  Only valid if cacheStatus matches\n  ** Vdbe.cacheCtr.  Vdbe.cacheCtr will never take on the value of\n  ** CACHE_STALE and so setting cacheStatus=CACHE_STALE guarantees that\n  ** the cache is out of date.\n  **\n  ** aRow might point to (ephemeral) data for the current row, or it might\n  ** be NULL.\n  */\n  u32 cacheStatus;      /* Cache is valid if this matches Vdbe.cacheCtr */\n  u32 payloadSize;      /* Total number of bytes in the record */\n  u32 szRow;            /* Byte available in aRow */\n  u32 iHdrOffset;       /* Offset to next unparsed byte of the header */\n  const u8 *aRow;       /* Data for the current row, if all on one page */\n  u32 *aOffset;         /* Pointer to aType[nField] */\n  u32 aType[1];         /* Type values for all entries in the record */\n  /* 2*nField extra array elements allocated for aType[], beyond the one\n  ** static element declared in the structure.  nField total array slots for\n  ** aType[] and nField+1 array slots for aOffset[] */\n};\n\n\n/*\n** A value for VdbeCursor.cacheStatus that means the cache is always invalid.\n*/\n#define CACHE_STALE 0\n\n/*\n** When a sub-program is executed (OP_Program), a structure of this type\n** is allocated to store the current value of the program counter, as\n** well as the current memory cell array and various other frame specific\n** values stored in the Vdbe struct. When the sub-program is finished, \n** these values are copied back to the Vdbe from the VdbeFrame structure,\n** restoring the state of the VM to as it was before the sub-program\n** began executing.\n**\n** The memory for a VdbeFrame object is allocated and managed by a memory\n** cell in the parent (calling) frame. When the memory cell is deleted or\n** overwritten, the VdbeFrame object is not freed immediately. Instead, it\n** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame\n** list is deleted when the VM is reset in VdbeHalt(). The reason for doing\n** this instead of deleting the VdbeFrame immediately is to avoid recursive\n** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the\n** child frame are released.\n**\n** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is\n** set to NULL if the currently executing frame is the main program.\n*/\ntypedef struct VdbeFrame VdbeFrame;\nstruct VdbeFrame {\n  Vdbe *v;                /* VM this frame belongs to */\n  VdbeFrame *pParent;     /* Parent of this frame, or NULL if parent is main */\n  Op *aOp;                /* Program instructions for parent frame */\n  i64 *anExec;            /* Event counters from parent frame */\n  Mem *aMem;              /* Array of memory cells for parent frame */\n  VdbeCursor **apCsr;     /* Array of Vdbe cursors for parent frame */\n  void *token;            /* Copy of SubProgram.token */\n  i64 lastRowid;          /* Last insert rowid (sqlite3.lastRowid) */\n  AuxData *pAuxData;      /* Linked list of auxdata allocations */\n  int nCursor;            /* Number of entries in apCsr */\n  int pc;                 /* Program Counter in parent (calling) frame */\n  int nOp;                /* Size of aOp array */\n  int nMem;               /* Number of entries in aMem */\n  int nChildMem;          /* Number of memory cells for child frame */\n  int nChildCsr;          /* Number of cursors for child frame */\n  int nChange;            /* Statement changes (Vdbe.nChange)     */\n  int nDbChange;          /* Value of db->nChange */\n};\n\n#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])\n\n/*\n** Internally, the vdbe manipulates nearly all SQL values as Mem\n** structures. Each Mem struct may cache multiple representations (string,\n** integer etc.) of the same value.\n*/\nstruct Mem {\n  union MemValue {\n    double r;           /* Real value used when MEM_Real is set in flags */\n    i64 i;              /* Integer value used when MEM_Int is set in flags */\n    int nZero;          /* Used when bit MEM_Zero is set in flags */\n    FuncDef *pDef;      /* Used only when flags==MEM_Agg */\n    RowSet *pRowSet;    /* Used only when flags==MEM_RowSet */\n    VdbeFrame *pFrame;  /* Used when flags==MEM_Frame */\n  } u;\n  u16 flags;          /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */\n  u8  enc;            /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */\n  u8  eSubtype;       /* Subtype for this value */\n  int n;              /* Number of characters in string value, excluding '\\0' */\n  char *z;            /* String or BLOB value */\n  /* ShallowCopy only needs to copy the information above */\n  char *zMalloc;      /* Space to hold MEM_Str or MEM_Blob if szMalloc>0 */\n  int szMalloc;       /* Size of the zMalloc allocation */\n  u32 uTemp;          /* Transient storage for serial_type in OP_MakeRecord */\n  sqlite3 *db;        /* The associated database connection */\n  void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */\n#ifdef SQLITE_DEBUG\n  Mem *pScopyFrom;    /* This Mem is a shallow copy of pScopyFrom */\n  void *pFiller;      /* So that sizeof(Mem) is a multiple of 8 */\n#endif\n};\n\n/*\n** Size of struct Mem not including the Mem.zMalloc member or anything that\n** follows.\n*/\n#define MEMCELLSIZE offsetof(Mem,zMalloc)\n\n/* One or more of the following flags are set to indicate the validOK\n** representations of the value stored in the Mem struct.\n**\n** If the MEM_Null flag is set, then the value is an SQL NULL value.\n** No other flags may be set in this case.\n**\n** If the MEM_Str flag is set then Mem.z points at a string representation.\n** Usually this is encoded in the same unicode encoding as the main\n** database (see below for exceptions). If the MEM_Term flag is also\n** set, then the string is nul terminated. The MEM_Int and MEM_Real \n** flags may coexist with the MEM_Str flag.\n*/\n#define MEM_Null      0x0001   /* Value is NULL */\n#define MEM_Str       0x0002   /* Value is a string */\n#define MEM_Int       0x0004   /* Value is an integer */\n#define MEM_Real      0x0008   /* Value is a real number */\n#define MEM_Blob      0x0010   /* Value is a BLOB */\n#define MEM_AffMask   0x001f   /* Mask of affinity bits */\n#define MEM_RowSet    0x0020   /* Value is a RowSet object */\n#define MEM_Frame     0x0040   /* Value is a VdbeFrame object */\n#define MEM_Undefined 0x0080   /* Value is undefined */\n#define MEM_Cleared   0x0100   /* NULL set by OP_Null, not from data */\n#define MEM_TypeMask  0x81ff   /* Mask of type bits */\n\n\n/* Whenever Mem contains a valid string or blob representation, one of\n** the following flags must be set to determine the memory management\n** policy for Mem.z.  The MEM_Term flag tells us whether or not the\n** string is \\000 or \\u0000 terminated\n*/\n#define MEM_Term      0x0200   /* String rep is nul terminated */\n#define MEM_Dyn       0x0400   /* Need to call Mem.xDel() on Mem.z */\n#define MEM_Static    0x0800   /* Mem.z points to a static string */\n#define MEM_Ephem     0x1000   /* Mem.z points to an ephemeral string */\n#define MEM_Agg       0x2000   /* Mem.z points to an agg function context */\n#define MEM_Zero      0x4000   /* Mem.i contains count of 0s appended to blob */\n#define MEM_Subtype   0x8000   /* Mem.eSubtype is valid */\n#ifdef SQLITE_OMIT_INCRBLOB\n  #undef MEM_Zero\n  #define MEM_Zero 0x0000\n#endif\n\n/* Return TRUE if Mem X contains dynamically allocated content - anything\n** that needs to be deallocated to avoid a leak.\n*/\n#define VdbeMemDynamic(X)  \\\n  (((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame))!=0)\n\n/*\n** Clear any existing type flags from a Mem and replace them with f\n*/\n#define MemSetTypeFlag(p, f) \\\n   ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f)\n\n/*\n** Return true if a memory cell is not marked as invalid.  This macro\n** is for use inside assert() statements only.\n*/\n#ifdef SQLITE_DEBUG\n#define memIsValid(M)  ((M)->flags & MEM_Undefined)==0\n#endif\n\n/*\n** Each auxiliary data pointer stored by a user defined function \n** implementation calling sqlite3_set_auxdata() is stored in an instance\n** of this structure. All such structures associated with a single VM\n** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed\n** when the VM is halted (if not before).\n*/\nstruct AuxData {\n  int iOp;                        /* Instruction number of OP_Function opcode */\n  int iArg;                       /* Index of function argument. */\n  void *pAux;                     /* Aux data pointer */\n  void (*xDelete)(void *);        /* Destructor for the aux data */\n  AuxData *pNext;                 /* Next element in list */\n};\n\n/*\n** The \"context\" argument for an installable function.  A pointer to an\n** instance of this structure is the first argument to the routines used\n** implement the SQL functions.\n**\n** There is a typedef for this structure in sqlite.h.  So all routines,\n** even the public interface to SQLite, can use a pointer to this structure.\n** But this file is the only place where the internal details of this\n** structure are known.\n**\n** This structure is defined inside of vdbeInt.h because it uses substructures\n** (Mem) which are only defined there.\n*/\nstruct sqlite3_context {\n  Mem *pOut;              /* The return value is stored here */\n  FuncDef *pFunc;         /* Pointer to function information */\n  Mem *pMem;              /* Memory cell used to store aggregate context */\n  Vdbe *pVdbe;            /* The VM that owns this context */\n  int iOp;                /* Instruction number of OP_Function */\n  int isError;            /* Error code returned by the function. */\n  u8 skipFlag;            /* Skip accumulator loading if true */\n  u8 fErrorOrAux;         /* isError!=0 or pVdbe->pAuxData modified */\n  u8 argc;                /* Number of arguments */\n  sqlite3_value *argv[1]; /* Argument set */\n};\n\n/* A bitfield type for use inside of structures.  Always follow with :N where\n** N is the number of bits.\n*/\ntypedef unsigned bft;  /* Bit Field Type */\n\ntypedef struct ScanStatus ScanStatus;\nstruct ScanStatus {\n  int addrExplain;                /* OP_Explain for loop */\n  int addrLoop;                   /* Address of \"loops\" counter */\n  int addrVisit;                  /* Address of \"rows visited\" counter */\n  int iSelectID;                  /* The \"Select-ID\" for this loop */\n  LogEst nEst;                    /* Estimated output rows per loop */\n  char *zName;                    /* Name of table or index */\n};\n\n/*\n** An instance of the virtual machine.  This structure contains the complete\n** state of the virtual machine.\n**\n** The \"sqlite3_stmt\" structure pointer that is returned by sqlite3_prepare()\n** is really a pointer to an instance of this structure.\n*/\nstruct Vdbe {\n  sqlite3 *db;            /* The database connection that owns this statement */\n  Vdbe *pPrev,*pNext;     /* Linked list of VDBEs with the same Vdbe.db */\n  Parse *pParse;          /* Parsing context used to create this Vdbe */\n  ynVar nVar;             /* Number of entries in aVar[] */\n  ynVar nzVar;            /* Number of entries in azVar[] */\n  u32 magic;              /* Magic number for sanity checking */\n  int nMem;               /* Number of memory locations currently allocated */\n  int nCursor;            /* Number of slots in apCsr[] */\n  u32 cacheCtr;           /* VdbeCursor row cache generation counter */\n  int pc;                 /* The program counter */\n  int rc;                 /* Value to return */\n  int nChange;            /* Number of db changes made since last reset */\n  int iStatement;         /* Statement number (or 0 if has not opened stmt) */\n  i64 iCurrentTime;       /* Value of julianday('now') for this statement */\n  i64 nFkConstraint;      /* Number of imm. FK constraints this VM */\n  i64 nStmtDefCons;       /* Number of def. constraints when stmt started */\n  i64 nStmtDefImmCons;    /* Number of def. imm constraints when stmt started */\n\n  /* When allocating a new Vdbe object, all of the fields below should be\n  ** initialized to zero or NULL */\n\n  Op *aOp;                /* Space to hold the virtual machine's program */\n  Mem *aMem;              /* The memory locations */\n  Mem **apArg;            /* Arguments to currently executing user function */\n  Mem *aColName;          /* Column names to return */\n  Mem *pResultSet;        /* Pointer to an array of results */\n  char *zErrMsg;          /* Error message written here */\n  VdbeCursor **apCsr;     /* One element of this array for each open cursor */\n  Mem *aVar;              /* Values for the OP_Variable opcode. */\n  char **azVar;           /* Name of variables */\n#ifndef SQLITE_OMIT_TRACE\n  i64 startTime;          /* Time when query started - used for profiling */\n#endif\n  int nOp;                /* Number of instructions in the program */\n#ifdef SQLITE_DEBUG\n  int rcApp;              /* errcode set by sqlite3_result_error_code() */\n#endif\n  u16 nResColumn;         /* Number of columns in one row of the result set */\n  u8 errorAction;         /* Recovery action to do in case of an error */\n  u8 minWriteFileFormat;  /* Minimum file format for writable database files */\n  bft expired:1;          /* True if the VM needs to be recompiled */\n  bft doingRerun:1;       /* True if rerunning after an auto-reprepare */\n  bft explain:2;          /* True if EXPLAIN present on SQL command */\n  bft changeCntOn:1;      /* True to update the change-counter */\n  bft runOnlyOnce:1;      /* Automatically expire on reset */\n  bft usesStmtJournal:1;  /* True if uses a statement journal */\n  bft readOnly:1;         /* True for statements that do not write */\n  bft bIsReader:1;        /* True for statements that read */\n  bft isPrepareV2:1;      /* True if prepared with prepare_v2() */\n  yDbMask btreeMask;      /* Bitmask of db->aDb[] entries referenced */\n  yDbMask lockMask;       /* Subset of btreeMask that requires a lock */\n  u32 aCounter[5];        /* Counters used by sqlite3_stmt_status() */\n  char *zSql;             /* Text of the SQL statement that generated this */\n  void *pFree;            /* Free this when deleting the vdbe */\n  VdbeFrame *pFrame;      /* Parent frame */\n  VdbeFrame *pDelFrame;   /* List of frame objects to free on VM reset */\n  int nFrame;             /* Number of frames in pFrame list */\n  u32 expmask;            /* Binding to these vars invalidates VM */\n  SubProgram *pProgram;   /* Linked list of all sub-programs used by VM */\n  AuxData *pAuxData;      /* Linked list of auxdata allocations */\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n  i64 *anExec;            /* Number of times each op has been executed */\n  int nScan;              /* Entries in aScan[] */\n  ScanStatus *aScan;      /* Scan definitions for sqlite3_stmt_scanstatus() */\n#endif\n};\n\n/*\n** The following are allowed values for Vdbe.magic\n*/\n#define VDBE_MAGIC_INIT     0x16bceaa5    /* Building a VDBE program */\n#define VDBE_MAGIC_RUN      0x2df20da3    /* VDBE is ready to execute */\n#define VDBE_MAGIC_HALT     0x319c2973    /* VDBE has completed execution */\n#define VDBE_MAGIC_RESET    0x48fa9f76    /* Reset and ready to run again */\n#define VDBE_MAGIC_DEAD     0x5606c3c8    /* The VDBE has been deallocated */\n\n/*\n** Structure used to store the context required by the \n** sqlite3_preupdate_*() API functions.\n*/\nstruct PreUpdate {\n  Vdbe *v;\n  VdbeCursor *pCsr;               /* Cursor to read old values from */\n  int op;                         /* One of SQLITE_INSERT, UPDATE, DELETE */\n  u8 *aRecord;                    /* old.* database record */\n  KeyInfo keyinfo;\n  UnpackedRecord *pUnpacked;      /* Unpacked version of aRecord[] */\n  UnpackedRecord *pNewUnpacked;   /* Unpacked version of new.* record */\n  int iNewReg;                    /* Register for new.* values */\n  i64 iKey1;                      /* First key value passed to hook */\n  i64 iKey2;                      /* Second key value passed to hook */\n  Mem *aNew;                      /* Array of new.* values */\n  Table *pTab;                    /* Schema object being upated */          \n};\n\n/*\n** Function prototypes\n*/\nvoid sqlite3VdbeError(Vdbe*, const char *, ...);\nvoid sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*);\nvoid sqliteVdbePopStack(Vdbe*,int);\nint sqlite3VdbeCursorMoveto(VdbeCursor**, int*);\nint sqlite3VdbeCursorRestore(VdbeCursor*);\n#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)\nvoid sqlite3VdbePrintOp(FILE*, int, Op*);\n#endif\nu32 sqlite3VdbeSerialTypeLen(u32);\nu8 sqlite3VdbeOneByteSerialTypeLen(u8);\nu32 sqlite3VdbeSerialType(Mem*, int, u32*);\nu32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);\nu32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);\nvoid sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);\n\nint sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);\nint sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);\nint sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*);\nint sqlite3VdbeExec(Vdbe*);\nint sqlite3VdbeList(Vdbe*);\nint sqlite3VdbeHalt(Vdbe*);\nint sqlite3VdbeChangeEncoding(Mem *, int);\nint sqlite3VdbeMemTooBig(Mem*);\nint sqlite3VdbeMemCopy(Mem*, const Mem*);\nvoid sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);\nvoid sqlite3VdbeMemMove(Mem*, Mem*);\nint sqlite3VdbeMemNulTerminate(Mem*);\nint sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*));\nvoid sqlite3VdbeMemSetInt64(Mem*, i64);\n#ifdef SQLITE_OMIT_FLOATING_POINT\n# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64\n#else\n  void sqlite3VdbeMemSetDouble(Mem*, double);\n#endif\nvoid sqlite3VdbeMemInit(Mem*,sqlite3*,u16);\nvoid sqlite3VdbeMemSetNull(Mem*);\nvoid sqlite3VdbeMemSetZeroBlob(Mem*,int);\nvoid sqlite3VdbeMemSetRowSet(Mem*);\nint sqlite3VdbeMemMakeWriteable(Mem*);\nint sqlite3VdbeMemStringify(Mem*, u8, u8);\ni64 sqlite3VdbeIntValue(Mem*);\nint sqlite3VdbeMemIntegerify(Mem*);\ndouble sqlite3VdbeRealValue(Mem*);\nvoid sqlite3VdbeIntegerAffinity(Mem*);\nint sqlite3VdbeMemRealify(Mem*);\nint sqlite3VdbeMemNumerify(Mem*);\nvoid sqlite3VdbeMemCast(Mem*,u8,u8);\nint sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*);\nvoid sqlite3VdbeMemRelease(Mem *p);\nint sqlite3VdbeMemFinalize(Mem*, FuncDef*);\nconst char *sqlite3OpcodeName(int);\nint sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);\nint sqlite3VdbeMemClearAndResize(Mem *pMem, int n);\nint sqlite3VdbeCloseStatement(Vdbe *, int);\nvoid sqlite3VdbeFrameDelete(VdbeFrame*);\nint sqlite3VdbeFrameRestore(VdbeFrame *);\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\nvoid sqlite3VdbePreUpdateHook(Vdbe*,VdbeCursor*,int,const char*,Table*,i64,int);\n#endif\nint sqlite3VdbeTransferError(Vdbe *p);\n\nint sqlite3VdbeSorterInit(sqlite3 *, int, VdbeCursor *);\nvoid sqlite3VdbeSorterReset(sqlite3 *, VdbeSorter *);\nvoid sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *);\nint sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *);\nint sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *, int *);\nint sqlite3VdbeSorterRewind(const VdbeCursor *, int *);\nint sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *);\nint sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *);\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE) \n  void sqlite3VdbeEnter(Vdbe*);\n#else\n# define sqlite3VdbeEnter(X)\n#endif\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0\n  void sqlite3VdbeLeave(Vdbe*);\n#else\n# define sqlite3VdbeLeave(X)\n#endif\n\n#ifdef SQLITE_DEBUG\nvoid sqlite3VdbeMemAboutToChange(Vdbe*,Mem*);\nint sqlite3VdbeCheckMemInvariants(Mem*);\n#endif\n\n#ifndef SQLITE_OMIT_FOREIGN_KEY\nint sqlite3VdbeCheckFk(Vdbe *, int);\n#else\n# define sqlite3VdbeCheckFk(p,i) 0\n#endif\n\nint sqlite3VdbeMemTranslate(Mem*, u8);\n#ifdef SQLITE_DEBUG\n  void sqlite3VdbePrintSql(Vdbe*);\n  void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);\n#endif\nint sqlite3VdbeMemHandleBom(Mem *pMem);\n\n#ifndef SQLITE_OMIT_INCRBLOB\n  int sqlite3VdbeMemExpandBlob(Mem *);\n  #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)\n#else\n  #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK\n  #define ExpandBlob(P) SQLITE_OK\n#endif\n\n#endif /* !defined(SQLITE_VDBEINT_H) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbeapi.c",
    "content": "/*\n** 2004 May 26\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains code use to implement APIs that are part of the\n** VDBE.\n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** Return TRUE (non-zero) of the statement supplied as an argument needs\n** to be recompiled.  A statement needs to be recompiled whenever the\n** execution environment changes in a way that would alter the program\n** that sqlite3_prepare() generates.  For example, if new functions or\n** collating sequences are registered or if an authorizer function is\n** added or changed.\n*/\nint sqlite3_expired(sqlite3_stmt *pStmt){\n  Vdbe *p = (Vdbe*)pStmt;\n  return p==0 || p->expired;\n}\n#endif\n\n/*\n** Check on a Vdbe to make sure it has not been finalized.  Log\n** an error and return true if it has been finalized (or is otherwise\n** invalid).  Return false if it is ok.\n*/\nstatic int vdbeSafety(Vdbe *p){\n  if( p->db==0 ){\n    sqlite3_log(SQLITE_MISUSE, \"API called with finalized prepared statement\");\n    return 1;\n  }else{\n    return 0;\n  }\n}\nstatic int vdbeSafetyNotNull(Vdbe *p){\n  if( p==0 ){\n    sqlite3_log(SQLITE_MISUSE, \"API called with NULL prepared statement\");\n    return 1;\n  }else{\n    return vdbeSafety(p);\n  }\n}\n\n#ifndef SQLITE_OMIT_TRACE\n/*\n** Invoke the profile callback.  This routine is only called if we already\n** know that the profile callback is defined and needs to be invoked.\n*/\nstatic SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){\n  sqlite3_int64 iNow;\n  sqlite3_int64 iElapse;\n  assert( p->startTime>0 );\n  assert( db->xProfile!=0 || (db->mTrace & SQLITE_TRACE_PROFILE)!=0 );\n  assert( db->init.busy==0 );\n  assert( p->zSql!=0 );\n  sqlite3OsCurrentTimeInt64(db->pVfs, &iNow);\n  iElapse = (iNow - p->startTime)*1000000;\n  if( db->xProfile ){\n    db->xProfile(db->pProfileArg, p->zSql, iElapse);\n  }\n  if( db->mTrace & SQLITE_TRACE_PROFILE ){\n    db->xTrace(SQLITE_TRACE_PROFILE, db->pTraceArg, p, (void*)&iElapse);\n  }\n  p->startTime = 0;\n}\n/*\n** The checkProfileCallback(DB,P) macro checks to see if a profile callback\n** is needed, and it invokes the callback if it is needed.\n*/\n# define checkProfileCallback(DB,P) \\\n   if( ((P)->startTime)>0 ){ invokeProfileCallback(DB,P); }\n#else\n# define checkProfileCallback(DB,P)  /*no-op*/\n#endif\n\n/*\n** The following routine destroys a virtual machine that is created by\n** the sqlite3_compile() routine. The integer returned is an SQLITE_\n** success/failure code that describes the result of executing the virtual\n** machine.\n**\n** This routine sets the error code and string returned by\n** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().\n*/\nint sqlite3_finalize(sqlite3_stmt *pStmt){\n  int rc;\n  if( pStmt==0 ){\n    /* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL\n    ** pointer is a harmless no-op. */\n    rc = SQLITE_OK;\n  }else{\n    Vdbe *v = (Vdbe*)pStmt;\n    sqlite3 *db = v->db;\n    if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT;\n    sqlite3_mutex_enter(db->mutex);\n    checkProfileCallback(db, v);\n    rc = sqlite3VdbeFinalize(v);\n    rc = sqlite3ApiExit(db, rc);\n    sqlite3LeaveMutexAndCloseZombie(db);\n  }\n  return rc;\n}\n\n/*\n** Terminate the current execution of an SQL statement and reset it\n** back to its starting state so that it can be reused. A success code from\n** the prior execution is returned.\n**\n** This routine sets the error code and string returned by\n** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().\n*/\nint sqlite3_reset(sqlite3_stmt *pStmt){\n  int rc;\n  if( pStmt==0 ){\n    rc = SQLITE_OK;\n  }else{\n    Vdbe *v = (Vdbe*)pStmt;\n    sqlite3 *db = v->db;\n    sqlite3_mutex_enter(db->mutex);\n    checkProfileCallback(db, v);\n    rc = sqlite3VdbeReset(v);\n    sqlite3VdbeRewind(v);\n    assert( (rc & (db->errMask))==rc );\n    rc = sqlite3ApiExit(db, rc);\n    sqlite3_mutex_leave(db->mutex);\n  }\n  return rc;\n}\n\n/*\n** Set all the parameters in the compiled SQL statement to NULL.\n*/\nint sqlite3_clear_bindings(sqlite3_stmt *pStmt){\n  int i;\n  int rc = SQLITE_OK;\n  Vdbe *p = (Vdbe*)pStmt;\n#if SQLITE_THREADSAFE\n  sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;\n#endif\n  sqlite3_mutex_enter(mutex);\n  for(i=0; i<p->nVar; i++){\n    sqlite3VdbeMemRelease(&p->aVar[i]);\n    p->aVar[i].flags = MEM_Null;\n  }\n  if( p->isPrepareV2 && p->expmask ){\n    p->expired = 1;\n  }\n  sqlite3_mutex_leave(mutex);\n  return rc;\n}\n\n\n/**************************** sqlite3_value_  *******************************\n** The following routines extract information from a Mem or sqlite3_value\n** structure.\n*/\nconst void *sqlite3_value_blob(sqlite3_value *pVal){\n  Mem *p = (Mem*)pVal;\n  if( p->flags & (MEM_Blob|MEM_Str) ){\n    if( ExpandBlob(p)!=SQLITE_OK ){\n      assert( p->flags==MEM_Null && p->z==0 );\n      return 0;\n    }\n    p->flags |= MEM_Blob;\n    return p->n ? p->z : 0;\n  }else{\n    return sqlite3_value_text(pVal);\n  }\n}\nint sqlite3_value_bytes(sqlite3_value *pVal){\n  return sqlite3ValueBytes(pVal, SQLITE_UTF8);\n}\nint sqlite3_value_bytes16(sqlite3_value *pVal){\n  return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);\n}\ndouble sqlite3_value_double(sqlite3_value *pVal){\n  return sqlite3VdbeRealValue((Mem*)pVal);\n}\nint sqlite3_value_int(sqlite3_value *pVal){\n  return (int)sqlite3VdbeIntValue((Mem*)pVal);\n}\nsqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){\n  return sqlite3VdbeIntValue((Mem*)pVal);\n}\nunsigned int sqlite3_value_subtype(sqlite3_value *pVal){\n  Mem *pMem = (Mem*)pVal;\n  return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0);\n}\nconst unsigned char *sqlite3_value_text(sqlite3_value *pVal){\n  return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);\n}\n#ifndef SQLITE_OMIT_UTF16\nconst void *sqlite3_value_text16(sqlite3_value* pVal){\n  return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);\n}\nconst void *sqlite3_value_text16be(sqlite3_value *pVal){\n  return sqlite3ValueText(pVal, SQLITE_UTF16BE);\n}\nconst void *sqlite3_value_text16le(sqlite3_value *pVal){\n  return sqlite3ValueText(pVal, SQLITE_UTF16LE);\n}\n#endif /* SQLITE_OMIT_UTF16 */\n/* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five\n** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating\n** point number string BLOB NULL\n*/\nint sqlite3_value_type(sqlite3_value* pVal){\n  static const u8 aType[] = {\n     SQLITE_BLOB,     /* 0x00 */\n     SQLITE_NULL,     /* 0x01 */\n     SQLITE_TEXT,     /* 0x02 */\n     SQLITE_NULL,     /* 0x03 */\n     SQLITE_INTEGER,  /* 0x04 */\n     SQLITE_NULL,     /* 0x05 */\n     SQLITE_INTEGER,  /* 0x06 */\n     SQLITE_NULL,     /* 0x07 */\n     SQLITE_FLOAT,    /* 0x08 */\n     SQLITE_NULL,     /* 0x09 */\n     SQLITE_FLOAT,    /* 0x0a */\n     SQLITE_NULL,     /* 0x0b */\n     SQLITE_INTEGER,  /* 0x0c */\n     SQLITE_NULL,     /* 0x0d */\n     SQLITE_INTEGER,  /* 0x0e */\n     SQLITE_NULL,     /* 0x0f */\n     SQLITE_BLOB,     /* 0x10 */\n     SQLITE_NULL,     /* 0x11 */\n     SQLITE_TEXT,     /* 0x12 */\n     SQLITE_NULL,     /* 0x13 */\n     SQLITE_INTEGER,  /* 0x14 */\n     SQLITE_NULL,     /* 0x15 */\n     SQLITE_INTEGER,  /* 0x16 */\n     SQLITE_NULL,     /* 0x17 */\n     SQLITE_FLOAT,    /* 0x18 */\n     SQLITE_NULL,     /* 0x19 */\n     SQLITE_FLOAT,    /* 0x1a */\n     SQLITE_NULL,     /* 0x1b */\n     SQLITE_INTEGER,  /* 0x1c */\n     SQLITE_NULL,     /* 0x1d */\n     SQLITE_INTEGER,  /* 0x1e */\n     SQLITE_NULL,     /* 0x1f */\n  };\n  return aType[pVal->flags&MEM_AffMask];\n}\n\n/* Make a copy of an sqlite3_value object\n*/\nsqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){\n  sqlite3_value *pNew;\n  if( pOrig==0 ) return 0;\n  pNew = sqlite3_malloc( sizeof(*pNew) );\n  if( pNew==0 ) return 0;\n  memset(pNew, 0, sizeof(*pNew));\n  memcpy(pNew, pOrig, MEMCELLSIZE);\n  pNew->flags &= ~MEM_Dyn;\n  pNew->db = 0;\n  if( pNew->flags&(MEM_Str|MEM_Blob) ){\n    pNew->flags &= ~(MEM_Static|MEM_Dyn);\n    pNew->flags |= MEM_Ephem;\n    if( sqlite3VdbeMemMakeWriteable(pNew)!=SQLITE_OK ){\n      sqlite3ValueFree(pNew);\n      pNew = 0;\n    }\n  }\n  return pNew;\n}\n\n/* Destroy an sqlite3_value object previously obtained from\n** sqlite3_value_dup().\n*/\nvoid sqlite3_value_free(sqlite3_value *pOld){\n  sqlite3ValueFree(pOld);\n}\n  \n\n/**************************** sqlite3_result_  *******************************\n** The following routines are used by user-defined functions to specify\n** the function result.\n**\n** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the\n** result as a string or blob but if the string or blob is too large, it\n** then sets the error code to SQLITE_TOOBIG\n**\n** The invokeValueDestructor(P,X) routine invokes destructor function X()\n** on value P is not going to be used and need to be destroyed.\n*/\nstatic void setResultStrOrError(\n  sqlite3_context *pCtx,  /* Function context */\n  const char *z,          /* String pointer */\n  int n,                  /* Bytes in string, or negative */\n  u8 enc,                 /* Encoding of z.  0 for BLOBs */\n  void (*xDel)(void*)     /* Destructor function */\n){\n  if( sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel)==SQLITE_TOOBIG ){\n    sqlite3_result_error_toobig(pCtx);\n  }\n}\nstatic int invokeValueDestructor(\n  const void *p,             /* Value to destroy */\n  void (*xDel)(void*),       /* The destructor */\n  sqlite3_context *pCtx      /* Set a SQLITE_TOOBIG error if no NULL */\n){\n  assert( xDel!=SQLITE_DYNAMIC );\n  if( xDel==0 ){\n    /* noop */\n  }else if( xDel==SQLITE_TRANSIENT ){\n    /* noop */\n  }else{\n    xDel((void*)p);\n  }\n  if( pCtx ) sqlite3_result_error_toobig(pCtx);\n  return SQLITE_TOOBIG;\n}\nvoid sqlite3_result_blob(\n  sqlite3_context *pCtx, \n  const void *z, \n  int n, \n  void (*xDel)(void *)\n){\n  assert( n>=0 );\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  setResultStrOrError(pCtx, z, n, 0, xDel);\n}\nvoid sqlite3_result_blob64(\n  sqlite3_context *pCtx, \n  const void *z, \n  sqlite3_uint64 n,\n  void (*xDel)(void *)\n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  assert( xDel!=SQLITE_DYNAMIC );\n  if( n>0x7fffffff ){\n    (void)invokeValueDestructor(z, xDel, pCtx);\n  }else{\n    setResultStrOrError(pCtx, z, (int)n, 0, xDel);\n  }\n}\nvoid sqlite3_result_double(sqlite3_context *pCtx, double rVal){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  sqlite3VdbeMemSetDouble(pCtx->pOut, rVal);\n}\nvoid sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  pCtx->isError = SQLITE_ERROR;\n  pCtx->fErrorOrAux = 1;\n  sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);\n}\n#ifndef SQLITE_OMIT_UTF16\nvoid sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  pCtx->isError = SQLITE_ERROR;\n  pCtx->fErrorOrAux = 1;\n  sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);\n}\n#endif\nvoid sqlite3_result_int(sqlite3_context *pCtx, int iVal){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal);\n}\nvoid sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  sqlite3VdbeMemSetInt64(pCtx->pOut, iVal);\n}\nvoid sqlite3_result_null(sqlite3_context *pCtx){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  sqlite3VdbeMemSetNull(pCtx->pOut);\n}\nvoid sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){\n  Mem *pOut = pCtx->pOut;\n  assert( sqlite3_mutex_held(pOut->db->mutex) );\n  pOut->eSubtype = eSubtype & 0xff;\n  pOut->flags |= MEM_Subtype;\n}\nvoid sqlite3_result_text(\n  sqlite3_context *pCtx, \n  const char *z, \n  int n,\n  void (*xDel)(void *)\n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);\n}\nvoid sqlite3_result_text64(\n  sqlite3_context *pCtx, \n  const char *z, \n  sqlite3_uint64 n,\n  void (*xDel)(void *),\n  unsigned char enc\n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  assert( xDel!=SQLITE_DYNAMIC );\n  if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;\n  if( n>0x7fffffff ){\n    (void)invokeValueDestructor(z, xDel, pCtx);\n  }else{\n    setResultStrOrError(pCtx, z, (int)n, enc, xDel);\n  }\n}\n#ifndef SQLITE_OMIT_UTF16\nvoid sqlite3_result_text16(\n  sqlite3_context *pCtx, \n  const void *z, \n  int n, \n  void (*xDel)(void *)\n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel);\n}\nvoid sqlite3_result_text16be(\n  sqlite3_context *pCtx, \n  const void *z, \n  int n, \n  void (*xDel)(void *)\n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel);\n}\nvoid sqlite3_result_text16le(\n  sqlite3_context *pCtx, \n  const void *z, \n  int n, \n  void (*xDel)(void *)\n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel);\n}\n#endif /* SQLITE_OMIT_UTF16 */\nvoid sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  sqlite3VdbeMemCopy(pCtx->pOut, pValue);\n}\nvoid sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n);\n}\nint sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){\n  Mem *pOut = pCtx->pOut;\n  assert( sqlite3_mutex_held(pOut->db->mutex) );\n  if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    return SQLITE_TOOBIG;\n  }\n  sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n);\n  return SQLITE_OK;\n}\nvoid sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){\n  pCtx->isError = errCode;\n  pCtx->fErrorOrAux = 1;\n#ifdef SQLITE_DEBUG\n  if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;\n#endif\n  if( pCtx->pOut->flags & MEM_Null ){\n    sqlite3VdbeMemSetStr(pCtx->pOut, sqlite3ErrStr(errCode), -1, \n                         SQLITE_UTF8, SQLITE_STATIC);\n  }\n}\n\n/* Force an SQLITE_TOOBIG error. */\nvoid sqlite3_result_error_toobig(sqlite3_context *pCtx){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  pCtx->isError = SQLITE_TOOBIG;\n  pCtx->fErrorOrAux = 1;\n  sqlite3VdbeMemSetStr(pCtx->pOut, \"string or blob too big\", -1, \n                       SQLITE_UTF8, SQLITE_STATIC);\n}\n\n/* An SQLITE_NOMEM error. */\nvoid sqlite3_result_error_nomem(sqlite3_context *pCtx){\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  sqlite3VdbeMemSetNull(pCtx->pOut);\n  pCtx->isError = SQLITE_NOMEM_BKPT;\n  pCtx->fErrorOrAux = 1;\n  sqlite3OomFault(pCtx->pOut->db);\n}\n\n/*\n** This function is called after a transaction has been committed. It \n** invokes callbacks registered with sqlite3_wal_hook() as required.\n*/\nstatic int doWalCallbacks(sqlite3 *db){\n  int rc = SQLITE_OK;\n#ifndef SQLITE_OMIT_WAL\n  int i;\n  for(i=0; i<db->nDb; i++){\n    Btree *pBt = db->aDb[i].pBt;\n    if( pBt ){\n      int nEntry;\n      sqlite3BtreeEnter(pBt);\n      nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt));\n      sqlite3BtreeLeave(pBt);\n      if( db->xWalCallback && nEntry>0 && rc==SQLITE_OK ){\n        rc = db->xWalCallback(db->pWalArg, db, db->aDb[i].zDbSName, nEntry);\n      }\n    }\n  }\n#endif\n  return rc;\n}\n\n\n/*\n** Execute the statement pStmt, either until a row of data is ready, the\n** statement is completely executed or an error occurs.\n**\n** This routine implements the bulk of the logic behind the sqlite_step()\n** API.  The only thing omitted is the automatic recompile if a \n** schema change has occurred.  That detail is handled by the\n** outer sqlite3_step() wrapper procedure.\n*/\nstatic int sqlite3Step(Vdbe *p){\n  sqlite3 *db;\n  int rc;\n\n  assert(p);\n  if( p->magic!=VDBE_MAGIC_RUN ){\n    /* We used to require that sqlite3_reset() be called before retrying\n    ** sqlite3_step() after any error or after SQLITE_DONE.  But beginning\n    ** with version 3.7.0, we changed this so that sqlite3_reset() would\n    ** be called automatically instead of throwing the SQLITE_MISUSE error.\n    ** This \"automatic-reset\" change is not technically an incompatibility, \n    ** since any application that receives an SQLITE_MISUSE is broken by\n    ** definition.\n    **\n    ** Nevertheless, some published applications that were originally written\n    ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE \n    ** returns, and those were broken by the automatic-reset change.  As a\n    ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the\n    ** legacy behavior of returning SQLITE_MISUSE for cases where the \n    ** previous sqlite3_step() returned something other than a SQLITE_LOCKED\n    ** or SQLITE_BUSY error.\n    */\n#ifdef SQLITE_OMIT_AUTORESET\n    if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){\n      sqlite3_reset((sqlite3_stmt*)p);\n    }else{\n      return SQLITE_MISUSE_BKPT;\n    }\n#else\n    sqlite3_reset((sqlite3_stmt*)p);\n#endif\n  }\n\n  /* Check that malloc() has not failed. If it has, return early. */\n  db = p->db;\n  if( db->mallocFailed ){\n    p->rc = SQLITE_NOMEM;\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  if( p->pc<=0 && p->expired ){\n    p->rc = SQLITE_SCHEMA;\n    rc = SQLITE_ERROR;\n    goto end_of_step;\n  }\n  if( p->pc<0 ){\n    /* If there are no other statements currently running, then\n    ** reset the interrupt flag.  This prevents a call to sqlite3_interrupt\n    ** from interrupting a statement that has not yet started.\n    */\n    if( db->nVdbeActive==0 ){\n      db->u1.isInterrupted = 0;\n    }\n\n    assert( db->nVdbeWrite>0 || db->autoCommit==0 \n        || (db->nDeferredCons==0 && db->nDeferredImmCons==0)\n    );\n\n#ifndef SQLITE_OMIT_TRACE\n    if( (db->xProfile || (db->mTrace & SQLITE_TRACE_PROFILE)!=0)\n        && !db->init.busy && p->zSql ){\n      sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);\n    }else{\n      assert( p->startTime==0 );\n    }\n#endif\n\n    db->nVdbeActive++;\n    if( p->readOnly==0 ) db->nVdbeWrite++;\n    if( p->bIsReader ) db->nVdbeRead++;\n    p->pc = 0;\n  }\n#ifdef SQLITE_DEBUG\n  p->rcApp = SQLITE_OK;\n#endif\n#ifndef SQLITE_OMIT_EXPLAIN\n  if( p->explain ){\n    rc = sqlite3VdbeList(p);\n  }else\n#endif /* SQLITE_OMIT_EXPLAIN */\n  {\n    db->nVdbeExec++;\n    rc = sqlite3VdbeExec(p);\n    db->nVdbeExec--;\n  }\n\n#ifndef SQLITE_OMIT_TRACE\n  /* If the statement completed successfully, invoke the profile callback */\n  if( rc!=SQLITE_ROW ) checkProfileCallback(db, p);\n#endif\n\n  if( rc==SQLITE_DONE ){\n    assert( p->rc==SQLITE_OK );\n    p->rc = doWalCallbacks(db);\n    if( p->rc!=SQLITE_OK ){\n      rc = SQLITE_ERROR;\n    }\n  }\n\n  db->errCode = rc;\n  if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){\n    p->rc = SQLITE_NOMEM_BKPT;\n  }\nend_of_step:\n  /* At this point local variable rc holds the value that should be \n  ** returned if this statement was compiled using the legacy \n  ** sqlite3_prepare() interface. According to the docs, this can only\n  ** be one of the values in the first assert() below. Variable p->rc \n  ** contains the value that would be returned if sqlite3_finalize() \n  ** were called on statement p.\n  */\n  assert( rc==SQLITE_ROW  || rc==SQLITE_DONE   || rc==SQLITE_ERROR \n       || (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE\n  );\n  assert( (p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE) || p->rc==p->rcApp );\n  if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){\n    /* If this statement was prepared using sqlite3_prepare_v2(), and an\n    ** error has occurred, then return the error code in p->rc to the\n    ** caller. Set the error code in the database handle to the same value.\n    */ \n    rc = sqlite3VdbeTransferError(p);\n  }\n  return (rc&db->errMask);\n}\n\n/*\n** This is the top-level implementation of sqlite3_step().  Call\n** sqlite3Step() to do most of the work.  If a schema error occurs,\n** call sqlite3Reprepare() and try again.\n*/\nint sqlite3_step(sqlite3_stmt *pStmt){\n  int rc = SQLITE_OK;      /* Result from sqlite3Step() */\n  int rc2 = SQLITE_OK;     /* Result from sqlite3Reprepare() */\n  Vdbe *v = (Vdbe*)pStmt;  /* the prepared statement */\n  int cnt = 0;             /* Counter to prevent infinite loop of reprepares */\n  sqlite3 *db;             /* The database connection */\n\n  if( vdbeSafetyNotNull(v) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n  db = v->db;\n  sqlite3_mutex_enter(db->mutex);\n  v->doingRerun = 0;\n  while( (rc = sqlite3Step(v))==SQLITE_SCHEMA\n         && cnt++ < SQLITE_MAX_SCHEMA_RETRY ){\n    int savedPc = v->pc;\n    rc2 = rc = sqlite3Reprepare(v);\n    if( rc!=SQLITE_OK) break;\n    sqlite3_reset(pStmt);\n    if( savedPc>=0 ) v->doingRerun = 1;\n    assert( v->expired==0 );\n  }\n  if( rc2!=SQLITE_OK ){\n    /* This case occurs after failing to recompile an sql statement. \n    ** The error message from the SQL compiler has already been loaded \n    ** into the database handle. This block copies the error message \n    ** from the database handle into the statement and sets the statement\n    ** program counter to 0 to ensure that when the statement is \n    ** finalized or reset the parser error message is available via\n    ** sqlite3_errmsg() and sqlite3_errcode().\n    */\n    const char *zErr = (const char *)sqlite3_value_text(db->pErr); \n    sqlite3DbFree(db, v->zErrMsg);\n    if( !db->mallocFailed ){\n      v->zErrMsg = sqlite3DbStrDup(db, zErr);\n      v->rc = rc2;\n    } else {\n      v->zErrMsg = 0;\n      v->rc = rc = SQLITE_NOMEM_BKPT;\n    }\n  }\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n\n/*\n** Extract the user data from a sqlite3_context structure and return a\n** pointer to it.\n*/\nvoid *sqlite3_user_data(sqlite3_context *p){\n  assert( p && p->pFunc );\n  return p->pFunc->pUserData;\n}\n\n/*\n** Extract the user data from a sqlite3_context structure and return a\n** pointer to it.\n**\n** IMPLEMENTATION-OF: R-46798-50301 The sqlite3_context_db_handle() interface\n** returns a copy of the pointer to the database connection (the 1st\n** parameter) of the sqlite3_create_function() and\n** sqlite3_create_function16() routines that originally registered the\n** application defined function.\n*/\nsqlite3 *sqlite3_context_db_handle(sqlite3_context *p){\n  assert( p && p->pOut );\n  return p->pOut->db;\n}\n\n/*\n** Return the current time for a statement.  If the current time\n** is requested more than once within the same run of a single prepared\n** statement, the exact same time is returned for each invocation regardless\n** of the amount of time that elapses between invocations.  In other words,\n** the time returned is always the time of the first call.\n*/\nsqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context *p){\n  int rc;\n#ifndef SQLITE_ENABLE_STAT3_OR_STAT4\n  sqlite3_int64 *piTime = &p->pVdbe->iCurrentTime;\n  assert( p->pVdbe!=0 );\n#else\n  sqlite3_int64 iTime = 0;\n  sqlite3_int64 *piTime = p->pVdbe!=0 ? &p->pVdbe->iCurrentTime : &iTime;\n#endif\n  if( *piTime==0 ){\n    rc = sqlite3OsCurrentTimeInt64(p->pOut->db->pVfs, piTime);\n    if( rc ) *piTime = 0;\n  }\n  return *piTime;\n}\n\n/*\n** The following is the implementation of an SQL function that always\n** fails with an error message stating that the function is used in the\n** wrong context.  The sqlite3_overload_function() API might construct\n** SQL function that use this routine so that the functions will exist\n** for name resolution but are actually overloaded by the xFindFunction\n** method of virtual tables.\n*/\nvoid sqlite3InvalidFunction(\n  sqlite3_context *context,  /* The function calling context */\n  int NotUsed,               /* Number of arguments to the function */\n  sqlite3_value **NotUsed2   /* Value of each argument */\n){\n  const char *zName = context->pFunc->zName;\n  char *zErr;\n  UNUSED_PARAMETER2(NotUsed, NotUsed2);\n  zErr = sqlite3_mprintf(\n      \"unable to use function %s in the requested context\", zName);\n  sqlite3_result_error(context, zErr, -1);\n  sqlite3_free(zErr);\n}\n\n/*\n** Create a new aggregate context for p and return a pointer to\n** its pMem->z element.\n*/\nstatic SQLITE_NOINLINE void *createAggContext(sqlite3_context *p, int nByte){\n  Mem *pMem = p->pMem;\n  assert( (pMem->flags & MEM_Agg)==0 );\n  if( nByte<=0 ){\n    sqlite3VdbeMemSetNull(pMem);\n    pMem->z = 0;\n  }else{\n    sqlite3VdbeMemClearAndResize(pMem, nByte);\n    pMem->flags = MEM_Agg;\n    pMem->u.pDef = p->pFunc;\n    if( pMem->z ){\n      memset(pMem->z, 0, nByte);\n    }\n  }\n  return (void*)pMem->z;\n}\n\n/*\n** Allocate or return the aggregate context for a user function.  A new\n** context is allocated on the first call.  Subsequent calls return the\n** same context that was returned on prior calls.\n*/\nvoid *sqlite3_aggregate_context(sqlite3_context *p, int nByte){\n  assert( p && p->pFunc && p->pFunc->xFinalize );\n  assert( sqlite3_mutex_held(p->pOut->db->mutex) );\n  testcase( nByte<0 );\n  if( (p->pMem->flags & MEM_Agg)==0 ){\n    return createAggContext(p, nByte);\n  }else{\n    return (void*)p->pMem->z;\n  }\n}\n\n/*\n** Return the auxiliary data pointer, if any, for the iArg'th argument to\n** the user-function defined by pCtx.\n*/\nvoid *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){\n  AuxData *pAuxData;\n\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n#if SQLITE_ENABLE_STAT3_OR_STAT4\n  if( pCtx->pVdbe==0 ) return 0;\n#else\n  assert( pCtx->pVdbe!=0 );\n#endif\n  for(pAuxData=pCtx->pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){\n    if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break;\n  }\n\n  return (pAuxData ? pAuxData->pAux : 0);\n}\n\n/*\n** Set the auxiliary data pointer and delete function, for the iArg'th\n** argument to the user-function defined by pCtx. Any previous value is\n** deleted by calling the delete function specified when it was set.\n*/\nvoid sqlite3_set_auxdata(\n  sqlite3_context *pCtx, \n  int iArg, \n  void *pAux, \n  void (*xDelete)(void*)\n){\n  AuxData *pAuxData;\n  Vdbe *pVdbe = pCtx->pVdbe;\n\n  assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );\n  if( iArg<0 ) goto failed;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  if( pVdbe==0 ) goto failed;\n#else\n  assert( pVdbe!=0 );\n#endif\n\n  for(pAuxData=pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){\n    if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break;\n  }\n  if( pAuxData==0 ){\n    pAuxData = sqlite3DbMallocZero(pVdbe->db, sizeof(AuxData));\n    if( !pAuxData ) goto failed;\n    pAuxData->iOp = pCtx->iOp;\n    pAuxData->iArg = iArg;\n    pAuxData->pNext = pVdbe->pAuxData;\n    pVdbe->pAuxData = pAuxData;\n    if( pCtx->fErrorOrAux==0 ){\n      pCtx->isError = 0;\n      pCtx->fErrorOrAux = 1;\n    }\n  }else if( pAuxData->xDelete ){\n    pAuxData->xDelete(pAuxData->pAux);\n  }\n\n  pAuxData->pAux = pAux;\n  pAuxData->xDelete = xDelete;\n  return;\n\nfailed:\n  if( xDelete ){\n    xDelete(pAux);\n  }\n}\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** Return the number of times the Step function of an aggregate has been \n** called.\n**\n** This function is deprecated.  Do not use it for new code.  It is\n** provide only to avoid breaking legacy code.  New aggregate function\n** implementations should keep their own counts within their aggregate\n** context.\n*/\nint sqlite3_aggregate_count(sqlite3_context *p){\n  assert( p && p->pMem && p->pFunc && p->pFunc->xFinalize );\n  return p->pMem->n;\n}\n#endif\n\n/*\n** Return the number of columns in the result set for the statement pStmt.\n*/\nint sqlite3_column_count(sqlite3_stmt *pStmt){\n  Vdbe *pVm = (Vdbe *)pStmt;\n  return pVm ? pVm->nResColumn : 0;\n}\n\n/*\n** Return the number of values available from the current row of the\n** currently executing statement pStmt.\n*/\nint sqlite3_data_count(sqlite3_stmt *pStmt){\n  Vdbe *pVm = (Vdbe *)pStmt;\n  if( pVm==0 || pVm->pResultSet==0 ) return 0;\n  return pVm->nResColumn;\n}\n\n/*\n** Return a pointer to static memory containing an SQL NULL value.\n*/\nstatic const Mem *columnNullValue(void){\n  /* Even though the Mem structure contains an element\n  ** of type i64, on certain architectures (x86) with certain compiler\n  ** switches (-Os), gcc may align this Mem object on a 4-byte boundary\n  ** instead of an 8-byte one. This all works fine, except that when\n  ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s\n  ** that a Mem structure is located on an 8-byte boundary. To prevent\n  ** these assert()s from failing, when building with SQLITE_DEBUG defined\n  ** using gcc, we force nullMem to be 8-byte aligned using the magical\n  ** __attribute__((aligned(8))) macro.  */\n  static const Mem nullMem \n#if defined(SQLITE_DEBUG) && defined(__GNUC__)\n    __attribute__((aligned(8))) \n#endif\n    = {\n        /* .u          = */ {0},\n        /* .flags      = */ (u16)MEM_Null,\n        /* .enc        = */ (u8)0,\n        /* .eSubtype   = */ (u8)0,\n        /* .n          = */ (int)0,\n        /* .z          = */ (char*)0,\n        /* .zMalloc    = */ (char*)0,\n        /* .szMalloc   = */ (int)0,\n        /* .uTemp      = */ (u32)0,\n        /* .db         = */ (sqlite3*)0,\n        /* .xDel       = */ (void(*)(void*))0,\n#ifdef SQLITE_DEBUG\n        /* .pScopyFrom = */ (Mem*)0,\n        /* .pFiller    = */ (void*)0,\n#endif\n      };\n  return &nullMem;\n}\n\n/*\n** Check to see if column iCol of the given statement is valid.  If\n** it is, return a pointer to the Mem for the value of that column.\n** If iCol is not valid, return a pointer to a Mem which has a value\n** of NULL.\n*/\nstatic Mem *columnMem(sqlite3_stmt *pStmt, int i){\n  Vdbe *pVm;\n  Mem *pOut;\n\n  pVm = (Vdbe *)pStmt;\n  if( pVm==0 ) return (Mem*)columnNullValue();\n  assert( pVm->db );\n  sqlite3_mutex_enter(pVm->db->mutex);\n  if( pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){\n    pOut = &pVm->pResultSet[i];\n  }else{\n    sqlite3Error(pVm->db, SQLITE_RANGE);\n    pOut = (Mem*)columnNullValue();\n  }\n  return pOut;\n}\n\n/*\n** This function is called after invoking an sqlite3_value_XXX function on a \n** column value (i.e. a value returned by evaluating an SQL expression in the\n** select list of a SELECT statement) that may cause a malloc() failure. If \n** malloc() has failed, the threads mallocFailed flag is cleared and the result\n** code of statement pStmt set to SQLITE_NOMEM.\n**\n** Specifically, this is called from within:\n**\n**     sqlite3_column_int()\n**     sqlite3_column_int64()\n**     sqlite3_column_text()\n**     sqlite3_column_text16()\n**     sqlite3_column_real()\n**     sqlite3_column_bytes()\n**     sqlite3_column_bytes16()\n**     sqiite3_column_blob()\n*/\nstatic void columnMallocFailure(sqlite3_stmt *pStmt)\n{\n  /* If malloc() failed during an encoding conversion within an\n  ** sqlite3_column_XXX API, then set the return code of the statement to\n  ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR\n  ** and _finalize() will return NOMEM.\n  */\n  Vdbe *p = (Vdbe *)pStmt;\n  if( p ){\n    assert( p->db!=0 );\n    assert( sqlite3_mutex_held(p->db->mutex) );\n    p->rc = sqlite3ApiExit(p->db, p->rc);\n    sqlite3_mutex_leave(p->db->mutex);\n  }\n}\n\n/**************************** sqlite3_column_  *******************************\n** The following routines are used to access elements of the current row\n** in the result set.\n*/\nconst void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){\n  const void *val;\n  val = sqlite3_value_blob( columnMem(pStmt,i) );\n  /* Even though there is no encoding conversion, value_blob() might\n  ** need to call malloc() to expand the result of a zeroblob() \n  ** expression. \n  */\n  columnMallocFailure(pStmt);\n  return val;\n}\nint sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){\n  int val = sqlite3_value_bytes( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return val;\n}\nint sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){\n  int val = sqlite3_value_bytes16( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return val;\n}\ndouble sqlite3_column_double(sqlite3_stmt *pStmt, int i){\n  double val = sqlite3_value_double( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return val;\n}\nint sqlite3_column_int(sqlite3_stmt *pStmt, int i){\n  int val = sqlite3_value_int( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return val;\n}\nsqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){\n  sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return val;\n}\nconst unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){\n  const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return val;\n}\nsqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){\n  Mem *pOut = columnMem(pStmt, i);\n  if( pOut->flags&MEM_Static ){\n    pOut->flags &= ~MEM_Static;\n    pOut->flags |= MEM_Ephem;\n  }\n  columnMallocFailure(pStmt);\n  return (sqlite3_value *)pOut;\n}\n#ifndef SQLITE_OMIT_UTF16\nconst void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){\n  const void *val = sqlite3_value_text16( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return val;\n}\n#endif /* SQLITE_OMIT_UTF16 */\nint sqlite3_column_type(sqlite3_stmt *pStmt, int i){\n  int iType = sqlite3_value_type( columnMem(pStmt,i) );\n  columnMallocFailure(pStmt);\n  return iType;\n}\n\n/*\n** Convert the N-th element of pStmt->pColName[] into a string using\n** xFunc() then return that string.  If N is out of range, return 0.\n**\n** There are up to 5 names for each column.  useType determines which\n** name is returned.  Here are the names:\n**\n**    0      The column name as it should be displayed for output\n**    1      The datatype name for the column\n**    2      The name of the database that the column derives from\n**    3      The name of the table that the column derives from\n**    4      The name of the table column that the result column derives from\n**\n** If the result is not a simple column reference (if it is an expression\n** or a constant) then useTypes 2, 3, and 4 return NULL.\n*/\nstatic const void *columnName(\n  sqlite3_stmt *pStmt,\n  int N,\n  const void *(*xFunc)(Mem*),\n  int useType\n){\n  const void *ret;\n  Vdbe *p;\n  int n;\n  sqlite3 *db;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( pStmt==0 ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  ret = 0;\n  p = (Vdbe *)pStmt;\n  db = p->db;\n  assert( db!=0 );\n  n = sqlite3_column_count(pStmt);\n  if( N<n && N>=0 ){\n    N += useType*n;\n    sqlite3_mutex_enter(db->mutex);\n    assert( db->mallocFailed==0 );\n    ret = xFunc(&p->aColName[N]);\n     /* A malloc may have failed inside of the xFunc() call. If this\n    ** is the case, clear the mallocFailed flag and return NULL.\n    */\n    if( db->mallocFailed ){\n      sqlite3OomClear(db);\n      ret = 0;\n    }\n    sqlite3_mutex_leave(db->mutex);\n  }\n  return ret;\n}\n\n/*\n** Return the name of the Nth column of the result set returned by SQL\n** statement pStmt.\n*/\nconst char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);\n}\n#ifndef SQLITE_OMIT_UTF16\nconst void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);\n}\n#endif\n\n/*\n** Constraint:  If you have ENABLE_COLUMN_METADATA then you must\n** not define OMIT_DECLTYPE.\n*/\n#if defined(SQLITE_OMIT_DECLTYPE) && defined(SQLITE_ENABLE_COLUMN_METADATA)\n# error \"Must not define both SQLITE_OMIT_DECLTYPE \\\n         and SQLITE_ENABLE_COLUMN_METADATA\"\n#endif\n\n#ifndef SQLITE_OMIT_DECLTYPE\n/*\n** Return the column declaration type (if applicable) of the 'i'th column\n** of the result set of SQL statement pStmt.\n*/\nconst char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);\n}\n#ifndef SQLITE_OMIT_UTF16\nconst void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);\n}\n#endif /* SQLITE_OMIT_UTF16 */\n#endif /* SQLITE_OMIT_DECLTYPE */\n\n#ifdef SQLITE_ENABLE_COLUMN_METADATA\n/*\n** Return the name of the database from which a result column derives.\n** NULL is returned if the result column is an expression or constant or\n** anything else which is not an unambiguous reference to a database column.\n*/\nconst char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);\n}\n#ifndef SQLITE_OMIT_UTF16\nconst void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);\n}\n#endif /* SQLITE_OMIT_UTF16 */\n\n/*\n** Return the name of the table from which a result column derives.\n** NULL is returned if the result column is an expression or constant or\n** anything else which is not an unambiguous reference to a database column.\n*/\nconst char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);\n}\n#ifndef SQLITE_OMIT_UTF16\nconst void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);\n}\n#endif /* SQLITE_OMIT_UTF16 */\n\n/*\n** Return the name of the table column from which a result column derives.\n** NULL is returned if the result column is an expression or constant or\n** anything else which is not an unambiguous reference to a database column.\n*/\nconst char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);\n}\n#ifndef SQLITE_OMIT_UTF16\nconst void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){\n  return columnName(\n      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);\n}\n#endif /* SQLITE_OMIT_UTF16 */\n#endif /* SQLITE_ENABLE_COLUMN_METADATA */\n\n\n/******************************* sqlite3_bind_  ***************************\n** \n** Routines used to attach values to wildcards in a compiled SQL statement.\n*/\n/*\n** Unbind the value bound to variable i in virtual machine p. This is the \n** the same as binding a NULL value to the column. If the \"i\" parameter is\n** out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK.\n**\n** A successful evaluation of this routine acquires the mutex on p.\n** the mutex is released if any kind of error occurs.\n**\n** The error code stored in database p->db is overwritten with the return\n** value in any case.\n*/\nstatic int vdbeUnbind(Vdbe *p, int i){\n  Mem *pVar;\n  if( vdbeSafetyNotNull(p) ){\n    return SQLITE_MISUSE_BKPT;\n  }\n  sqlite3_mutex_enter(p->db->mutex);\n  if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){\n    sqlite3Error(p->db, SQLITE_MISUSE);\n    sqlite3_mutex_leave(p->db->mutex);\n    sqlite3_log(SQLITE_MISUSE, \n        \"bind on a busy prepared statement: [%s]\", p->zSql);\n    return SQLITE_MISUSE_BKPT;\n  }\n  if( i<1 || i>p->nVar ){\n    sqlite3Error(p->db, SQLITE_RANGE);\n    sqlite3_mutex_leave(p->db->mutex);\n    return SQLITE_RANGE;\n  }\n  i--;\n  pVar = &p->aVar[i];\n  sqlite3VdbeMemRelease(pVar);\n  pVar->flags = MEM_Null;\n  sqlite3Error(p->db, SQLITE_OK);\n\n  /* If the bit corresponding to this variable in Vdbe.expmask is set, then \n  ** binding a new value to this variable invalidates the current query plan.\n  **\n  ** IMPLEMENTATION-OF: R-48440-37595 If the specific value bound to host\n  ** parameter in the WHERE clause might influence the choice of query plan\n  ** for a statement, then the statement will be automatically recompiled,\n  ** as if there had been a schema change, on the first sqlite3_step() call\n  ** following any change to the bindings of that parameter.\n  */\n  if( p->isPrepareV2 &&\n     ((i<32 && p->expmask & ((u32)1 << i)) || p->expmask==0xffffffff)\n  ){\n    p->expired = 1;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Bind a text or BLOB value.\n*/\nstatic int bindText(\n  sqlite3_stmt *pStmt,   /* The statement to bind against */\n  int i,                 /* Index of the parameter to bind */\n  const void *zData,     /* Pointer to the data to be bound */\n  int nData,             /* Number of bytes of data to be bound */\n  void (*xDel)(void*),   /* Destructor for the data */\n  u8 encoding            /* Encoding for the data */\n){\n  Vdbe *p = (Vdbe *)pStmt;\n  Mem *pVar;\n  int rc;\n\n  rc = vdbeUnbind(p, i);\n  if( rc==SQLITE_OK ){\n    if( zData!=0 ){\n      pVar = &p->aVar[i-1];\n      rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);\n      if( rc==SQLITE_OK && encoding!=0 ){\n        rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));\n      }\n      sqlite3Error(p->db, rc);\n      rc = sqlite3ApiExit(p->db, rc);\n    }\n    sqlite3_mutex_leave(p->db->mutex);\n  }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){\n    xDel((void*)zData);\n  }\n  return rc;\n}\n\n\n/*\n** Bind a blob value to an SQL statement variable.\n*/\nint sqlite3_bind_blob(\n  sqlite3_stmt *pStmt, \n  int i, \n  const void *zData, \n  int nData, \n  void (*xDel)(void*)\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( nData<0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  return bindText(pStmt, i, zData, nData, xDel, 0);\n}\nint sqlite3_bind_blob64(\n  sqlite3_stmt *pStmt, \n  int i, \n  const void *zData, \n  sqlite3_uint64 nData, \n  void (*xDel)(void*)\n){\n  assert( xDel!=SQLITE_DYNAMIC );\n  if( nData>0x7fffffff ){\n    return invokeValueDestructor(zData, xDel, 0);\n  }else{\n    return bindText(pStmt, i, zData, (int)nData, xDel, 0);\n  }\n}\nint sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){\n  int rc;\n  Vdbe *p = (Vdbe *)pStmt;\n  rc = vdbeUnbind(p, i);\n  if( rc==SQLITE_OK ){\n    sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);\n    sqlite3_mutex_leave(p->db->mutex);\n  }\n  return rc;\n}\nint sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){\n  return sqlite3_bind_int64(p, i, (i64)iValue);\n}\nint sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){\n  int rc;\n  Vdbe *p = (Vdbe *)pStmt;\n  rc = vdbeUnbind(p, i);\n  if( rc==SQLITE_OK ){\n    sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);\n    sqlite3_mutex_leave(p->db->mutex);\n  }\n  return rc;\n}\nint sqlite3_bind_null(sqlite3_stmt *pStmt, int i){\n  int rc;\n  Vdbe *p = (Vdbe*)pStmt;\n  rc = vdbeUnbind(p, i);\n  if( rc==SQLITE_OK ){\n    sqlite3_mutex_leave(p->db->mutex);\n  }\n  return rc;\n}\nint sqlite3_bind_text( \n  sqlite3_stmt *pStmt, \n  int i, \n  const char *zData, \n  int nData, \n  void (*xDel)(void*)\n){\n  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);\n}\nint sqlite3_bind_text64( \n  sqlite3_stmt *pStmt, \n  int i, \n  const char *zData, \n  sqlite3_uint64 nData, \n  void (*xDel)(void*),\n  unsigned char enc\n){\n  assert( xDel!=SQLITE_DYNAMIC );\n  if( nData>0x7fffffff ){\n    return invokeValueDestructor(zData, xDel, 0);\n  }else{\n    if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;\n    return bindText(pStmt, i, zData, (int)nData, xDel, enc);\n  }\n}\n#ifndef SQLITE_OMIT_UTF16\nint sqlite3_bind_text16(\n  sqlite3_stmt *pStmt, \n  int i, \n  const void *zData, \n  int nData, \n  void (*xDel)(void*)\n){\n  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);\n}\n#endif /* SQLITE_OMIT_UTF16 */\nint sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){\n  int rc;\n  switch( sqlite3_value_type((sqlite3_value*)pValue) ){\n    case SQLITE_INTEGER: {\n      rc = sqlite3_bind_int64(pStmt, i, pValue->u.i);\n      break;\n    }\n    case SQLITE_FLOAT: {\n      rc = sqlite3_bind_double(pStmt, i, pValue->u.r);\n      break;\n    }\n    case SQLITE_BLOB: {\n      if( pValue->flags & MEM_Zero ){\n        rc = sqlite3_bind_zeroblob(pStmt, i, pValue->u.nZero);\n      }else{\n        rc = sqlite3_bind_blob(pStmt, i, pValue->z, pValue->n,SQLITE_TRANSIENT);\n      }\n      break;\n    }\n    case SQLITE_TEXT: {\n      rc = bindText(pStmt,i,  pValue->z, pValue->n, SQLITE_TRANSIENT,\n                              pValue->enc);\n      break;\n    }\n    default: {\n      rc = sqlite3_bind_null(pStmt, i);\n      break;\n    }\n  }\n  return rc;\n}\nint sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){\n  int rc;\n  Vdbe *p = (Vdbe *)pStmt;\n  rc = vdbeUnbind(p, i);\n  if( rc==SQLITE_OK ){\n    sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);\n    sqlite3_mutex_leave(p->db->mutex);\n  }\n  return rc;\n}\nint sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){\n  int rc;\n  Vdbe *p = (Vdbe *)pStmt;\n  sqlite3_mutex_enter(p->db->mutex);\n  if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){\n    rc = SQLITE_TOOBIG;\n  }else{\n    assert( (n & 0x7FFFFFFF)==n );\n    rc = sqlite3_bind_zeroblob(pStmt, i, n);\n  }\n  rc = sqlite3ApiExit(p->db, rc);\n  sqlite3_mutex_leave(p->db->mutex);\n  return rc;\n}\n\n/*\n** Return the number of wildcards that can be potentially bound to.\n** This routine is added to support DBD::SQLite.  \n*/\nint sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){\n  Vdbe *p = (Vdbe*)pStmt;\n  return p ? p->nVar : 0;\n}\n\n/*\n** Return the name of a wildcard parameter.  Return NULL if the index\n** is out of range or if the wildcard is unnamed.\n**\n** The result is always UTF-8.\n*/\nconst char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){\n  Vdbe *p = (Vdbe*)pStmt;\n  if( p==0 || i<1 || i>p->nzVar ){\n    return 0;\n  }\n  return p->azVar[i-1];\n}\n\n/*\n** Given a wildcard parameter name, return the index of the variable\n** with that name.  If there is no variable with the given name,\n** return 0.\n*/\nint sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){\n  int i;\n  if( p==0 ){\n    return 0;\n  }\n  if( zName ){\n    for(i=0; i<p->nzVar; i++){\n      const char *z = p->azVar[i];\n      if( z && strncmp(z,zName,nName)==0 && z[nName]==0 ){\n        return i+1;\n      }\n    }\n  }\n  return 0;\n}\nint sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){\n  return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName));\n}\n\n/*\n** Transfer all bindings from the first statement over to the second.\n*/\nint sqlite3TransferBindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){\n  Vdbe *pFrom = (Vdbe*)pFromStmt;\n  Vdbe *pTo = (Vdbe*)pToStmt;\n  int i;\n  assert( pTo->db==pFrom->db );\n  assert( pTo->nVar==pFrom->nVar );\n  sqlite3_mutex_enter(pTo->db->mutex);\n  for(i=0; i<pFrom->nVar; i++){\n    sqlite3VdbeMemMove(&pTo->aVar[i], &pFrom->aVar[i]);\n  }\n  sqlite3_mutex_leave(pTo->db->mutex);\n  return SQLITE_OK;\n}\n\n#ifndef SQLITE_OMIT_DEPRECATED\n/*\n** Deprecated external interface.  Internal/core SQLite code\n** should call sqlite3TransferBindings.\n**\n** It is misuse to call this routine with statements from different\n** database connections.  But as this is a deprecated interface, we\n** will not bother to check for that condition.\n**\n** If the two statements contain a different number of bindings, then\n** an SQLITE_ERROR is returned.  Nothing else can go wrong, so otherwise\n** SQLITE_OK is returned.\n*/\nint sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){\n  Vdbe *pFrom = (Vdbe*)pFromStmt;\n  Vdbe *pTo = (Vdbe*)pToStmt;\n  if( pFrom->nVar!=pTo->nVar ){\n    return SQLITE_ERROR;\n  }\n  if( pTo->isPrepareV2 && pTo->expmask ){\n    pTo->expired = 1;\n  }\n  if( pFrom->isPrepareV2 && pFrom->expmask ){\n    pFrom->expired = 1;\n  }\n  return sqlite3TransferBindings(pFromStmt, pToStmt);\n}\n#endif\n\n/*\n** Return the sqlite3* database handle to which the prepared statement given\n** in the argument belongs.  This is the same database handle that was\n** the first argument to the sqlite3_prepare() that was used to create\n** the statement in the first place.\n*/\nsqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){\n  return pStmt ? ((Vdbe*)pStmt)->db : 0;\n}\n\n/*\n** Return true if the prepared statement is guaranteed to not modify the\n** database.\n*/\nint sqlite3_stmt_readonly(sqlite3_stmt *pStmt){\n  return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;\n}\n\n/*\n** Return true if the prepared statement is in need of being reset.\n*/\nint sqlite3_stmt_busy(sqlite3_stmt *pStmt){\n  Vdbe *v = (Vdbe*)pStmt;\n  return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;\n}\n\n/*\n** Return a pointer to the next prepared statement after pStmt associated\n** with database connection pDb.  If pStmt is NULL, return the first\n** prepared statement for the database connection.  Return NULL if there\n** are no more.\n*/\nsqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){\n  sqlite3_stmt *pNext;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(pDb) ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  sqlite3_mutex_enter(pDb->mutex);\n  if( pStmt==0 ){\n    pNext = (sqlite3_stmt*)pDb->pVdbe;\n  }else{\n    pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;\n  }\n  sqlite3_mutex_leave(pDb->mutex);\n  return pNext;\n}\n\n/*\n** Return the value of a status counter for a prepared statement\n*/\nint sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){\n  Vdbe *pVdbe = (Vdbe*)pStmt;\n  u32 v;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !pStmt ){\n    (void)SQLITE_MISUSE_BKPT;\n    return 0;\n  }\n#endif\n  v = pVdbe->aCounter[op];\n  if( resetFlag ) pVdbe->aCounter[op] = 0;\n  return (int)v;\n}\n\n/*\n** Return the SQL associated with a prepared statement\n*/\nconst char *sqlite3_sql(sqlite3_stmt *pStmt){\n  Vdbe *p = (Vdbe *)pStmt;\n  return p ? p->zSql : 0;\n}\n\n/*\n** Return the SQL associated with a prepared statement with\n** bound parameters expanded.  Space to hold the returned string is\n** obtained from sqlite3_malloc().  The caller is responsible for\n** freeing the returned string by passing it to sqlite3_free().\n**\n** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of\n** expanded bound parameters.\n*/\nchar *sqlite3_expanded_sql(sqlite3_stmt *pStmt){\n#ifdef SQLITE_OMIT_TRACE\n  return 0;\n#else\n  char *z = 0;\n  const char *zSql = sqlite3_sql(pStmt);\n  if( zSql ){\n    Vdbe *p = (Vdbe *)pStmt;\n    sqlite3_mutex_enter(p->db->mutex);\n    z = sqlite3VdbeExpandSql(p, zSql);\n    sqlite3_mutex_leave(p->db->mutex);\n  }\n  return z;\n#endif\n}\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n/*\n** Allocate and populate an UnpackedRecord structure based on the serialized\n** record in nKey/pKey. Return a pointer to the new UnpackedRecord structure\n** if successful, or a NULL pointer if an OOM error is encountered.\n*/\nstatic UnpackedRecord *vdbeUnpackRecord(\n  KeyInfo *pKeyInfo, \n  int nKey, \n  const void *pKey\n){\n  char *dummy;                    /* Dummy argument for AllocUnpackedRecord() */\n  UnpackedRecord *pRet;           /* Return value */\n\n  pRet = sqlite3VdbeAllocUnpackedRecord(pKeyInfo, 0, 0, &dummy);\n  if( pRet ){\n    memset(pRet->aMem, 0, sizeof(Mem)*(pKeyInfo->nField+1));\n    sqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, pRet);\n  }\n  return pRet;\n}\n\n/*\n** This function is called from within a pre-update callback to retrieve\n** a field of the row currently being updated or deleted.\n*/\nint sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){\n  PreUpdate *p = db->pPreUpdate;\n  int rc = SQLITE_OK;\n\n  /* Test that this call is being made from within an SQLITE_DELETE or\n  ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */\n  if( !p || p->op==SQLITE_INSERT ){\n    rc = SQLITE_MISUSE_BKPT;\n    goto preupdate_old_out;\n  }\n  if( iIdx>=p->pCsr->nField || iIdx<0 ){\n    rc = SQLITE_RANGE;\n    goto preupdate_old_out;\n  }\n\n  /* If the old.* record has not yet been loaded into memory, do so now. */\n  if( p->pUnpacked==0 ){\n    u32 nRec;\n    u8 *aRec;\n\n    nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor);\n    aRec = sqlite3DbMallocRaw(db, nRec);\n    if( !aRec ) goto preupdate_old_out;\n    rc = sqlite3BtreeData(p->pCsr->uc.pCursor, 0, nRec, aRec);\n    if( rc==SQLITE_OK ){\n      p->pUnpacked = vdbeUnpackRecord(&p->keyinfo, nRec, aRec);\n      if( !p->pUnpacked ) rc = SQLITE_NOMEM;\n    }\n    if( rc!=SQLITE_OK ){\n      sqlite3DbFree(db, aRec);\n      goto preupdate_old_out;\n    }\n    p->aRecord = aRec;\n  }\n\n  if( iIdx>=p->pUnpacked->nField ){\n    *ppValue = (sqlite3_value *)columnNullValue();\n  }else{\n    Mem *pMem = *ppValue = &p->pUnpacked->aMem[iIdx];\n    *ppValue = &p->pUnpacked->aMem[iIdx];\n    if( iIdx==p->pTab->iPKey ){\n      sqlite3VdbeMemSetInt64(pMem, p->iKey1);\n    }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){\n      if( pMem->flags & MEM_Int ){\n        sqlite3VdbeMemRealify(pMem);\n      }\n    }\n  }\n\n preupdate_old_out:\n  sqlite3Error(db, rc);\n  return sqlite3ApiExit(db, rc);\n}\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n/*\n** This function is called from within a pre-update callback to retrieve\n** the number of columns in the row being updated, deleted or inserted.\n*/\nint sqlite3_preupdate_count(sqlite3 *db){\n  PreUpdate *p = db->pPreUpdate;\n  return (p ? p->keyinfo.nField : 0);\n}\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n/*\n** This function is designed to be called from within a pre-update callback\n** only. It returns zero if the change that caused the callback was made\n** immediately by a user SQL statement. Or, if the change was made by a\n** trigger program, it returns the number of trigger programs currently\n** on the stack (1 for a top-level trigger, 2 for a trigger fired by a \n** top-level trigger etc.).\n**\n** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL\n** or SET DEFAULT action is considered a trigger.\n*/\nint sqlite3_preupdate_depth(sqlite3 *db){\n  PreUpdate *p = db->pPreUpdate;\n  return (p ? p->v->nFrame : 0);\n}\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n/*\n** This function is called from within a pre-update callback to retrieve\n** a field of the row currently being updated or inserted.\n*/\nint sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){\n  PreUpdate *p = db->pPreUpdate;\n  int rc = SQLITE_OK;\n  Mem *pMem;\n\n  if( !p || p->op==SQLITE_DELETE ){\n    rc = SQLITE_MISUSE_BKPT;\n    goto preupdate_new_out;\n  }\n  if( iIdx>=p->pCsr->nField || iIdx<0 ){\n    rc = SQLITE_RANGE;\n    goto preupdate_new_out;\n  }\n\n  if( p->op==SQLITE_INSERT ){\n    /* For an INSERT, memory cell p->iNewReg contains the serialized record\n    ** that is being inserted. Deserialize it. */\n    UnpackedRecord *pUnpack = p->pNewUnpacked;\n    if( !pUnpack ){\n      Mem *pData = &p->v->aMem[p->iNewReg];\n      rc = ExpandBlob(pData);\n      if( rc!=SQLITE_OK ) goto preupdate_new_out;\n      pUnpack = vdbeUnpackRecord(&p->keyinfo, pData->n, pData->z);\n      if( !pUnpack ){\n        rc = SQLITE_NOMEM;\n        goto preupdate_new_out;\n      }\n      p->pNewUnpacked = pUnpack;\n    }\n    if( iIdx>=pUnpack->nField ){\n      pMem = (sqlite3_value *)columnNullValue();\n    }else{\n      pMem = &pUnpack->aMem[iIdx];\n      if( iIdx==p->pTab->iPKey ){\n        sqlite3VdbeMemSetInt64(pMem, p->iKey2);\n      }\n    }\n  }else{\n    /* For an UPDATE, memory cell (p->iNewReg+1+iIdx) contains the required\n    ** value. Make a copy of the cell contents and return a pointer to it.\n    ** It is not safe to return a pointer to the memory cell itself as the\n    ** caller may modify the value text encoding.\n    */\n    assert( p->op==SQLITE_UPDATE );\n    if( !p->aNew ){\n      p->aNew = (Mem *)sqlite3DbMallocZero(db, sizeof(Mem) * p->pCsr->nField);\n      if( !p->aNew ){\n        rc = SQLITE_NOMEM;\n        goto preupdate_new_out;\n      }\n    }\n    assert( iIdx>=0 && iIdx<p->pCsr->nField );\n    pMem = &p->aNew[iIdx];\n    if( pMem->flags==0 ){\n      if( iIdx==p->pTab->iPKey ){\n        sqlite3VdbeMemSetInt64(pMem, p->iKey2);\n      }else{\n        rc = sqlite3VdbeMemCopy(pMem, &p->v->aMem[p->iNewReg+1+iIdx]);\n        if( rc!=SQLITE_OK ) goto preupdate_new_out;\n      }\n    }\n  }\n  *ppValue = pMem;\n\n preupdate_new_out:\n  sqlite3Error(db, rc);\n  return sqlite3ApiExit(db, rc);\n}\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n/*\n** Return status data for a single loop within query pStmt.\n*/\nint sqlite3_stmt_scanstatus(\n  sqlite3_stmt *pStmt,            /* Prepared statement being queried */\n  int idx,                        /* Index of loop to report on */\n  int iScanStatusOp,              /* Which metric to return */\n  void *pOut                      /* OUT: Write the answer here */\n){\n  Vdbe *p = (Vdbe*)pStmt;\n  ScanStatus *pScan;\n  if( idx<0 || idx>=p->nScan ) return 1;\n  pScan = &p->aScan[idx];\n  switch( iScanStatusOp ){\n    case SQLITE_SCANSTAT_NLOOP: {\n      *(sqlite3_int64*)pOut = p->anExec[pScan->addrLoop];\n      break;\n    }\n    case SQLITE_SCANSTAT_NVISIT: {\n      *(sqlite3_int64*)pOut = p->anExec[pScan->addrVisit];\n      break;\n    }\n    case SQLITE_SCANSTAT_EST: {\n      double r = 1.0;\n      LogEst x = pScan->nEst;\n      while( x<100 ){\n        x += 10;\n        r *= 0.5;\n      }\n      *(double*)pOut = r*sqlite3LogEstToInt(x);\n      break;\n    }\n    case SQLITE_SCANSTAT_NAME: {\n      *(const char**)pOut = pScan->zName;\n      break;\n    }\n    case SQLITE_SCANSTAT_EXPLAIN: {\n      if( pScan->addrExplain ){\n        *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;\n      }else{\n        *(const char**)pOut = 0;\n      }\n      break;\n    }\n    case SQLITE_SCANSTAT_SELECTID: {\n      if( pScan->addrExplain ){\n        *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;\n      }else{\n        *(int*)pOut = -1;\n      }\n      break;\n    }\n    default: {\n      return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** Zero all counters associated with the sqlite3_stmt_scanstatus() data.\n*/\nvoid sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){\n  Vdbe *p = (Vdbe*)pStmt;\n  memset(p->anExec, 0, p->nOp * sizeof(i64));\n}\n#endif /* SQLITE_ENABLE_STMT_SCANSTATUS */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbeaux.c",
    "content": "/*\n** 2003 September 6\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used for creating, destroying, and populating\n** a VDBE (or an \"sqlite3_stmt\" as it is known to the outside world.) \n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n/*\n** Create a new virtual database engine.\n*/\nVdbe *sqlite3VdbeCreate(Parse *pParse){\n  sqlite3 *db = pParse->db;\n  Vdbe *p;\n  p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );\n  if( p==0 ) return 0;\n  memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));\n  p->db = db;\n  if( db->pVdbe ){\n    db->pVdbe->pPrev = p;\n  }\n  p->pNext = db->pVdbe;\n  p->pPrev = 0;\n  db->pVdbe = p;\n  p->magic = VDBE_MAGIC_INIT;\n  p->pParse = pParse;\n  assert( pParse->aLabel==0 );\n  assert( pParse->nLabel==0 );\n  assert( pParse->nOpAlloc==0 );\n  assert( pParse->szOpAlloc==0 );\n  return p;\n}\n\n/*\n** Change the error string stored in Vdbe.zErrMsg\n*/\nvoid sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){\n  va_list ap;\n  sqlite3DbFree(p->db, p->zErrMsg);\n  va_start(ap, zFormat);\n  p->zErrMsg = sqlite3VMPrintf(p->db, zFormat, ap);\n  va_end(ap);\n}\n\n/*\n** Remember the SQL string for a prepared statement.\n*/\nvoid sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){\n  assert( isPrepareV2==1 || isPrepareV2==0 );\n  if( p==0 ) return;\n#if defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_ENABLE_SQLLOG)\n  if( !isPrepareV2 ) return;\n#endif\n  assert( p->zSql==0 );\n  p->zSql = sqlite3DbStrNDup(p->db, z, n);\n  p->isPrepareV2 = (u8)isPrepareV2;\n}\n\n/*\n** Swap all content between two VDBE structures.\n*/\nvoid sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){\n  Vdbe tmp, *pTmp;\n  char *zTmp;\n  assert( pA->db==pB->db );\n  tmp = *pA;\n  *pA = *pB;\n  *pB = tmp;\n  pTmp = pA->pNext;\n  pA->pNext = pB->pNext;\n  pB->pNext = pTmp;\n  pTmp = pA->pPrev;\n  pA->pPrev = pB->pPrev;\n  pB->pPrev = pTmp;\n  zTmp = pA->zSql;\n  pA->zSql = pB->zSql;\n  pB->zSql = zTmp;\n  pB->isPrepareV2 = pA->isPrepareV2;\n}\n\n/*\n** Resize the Vdbe.aOp array so that it is at least nOp elements larger \n** than its current size. nOp is guaranteed to be less than or equal\n** to 1024/sizeof(Op).\n**\n** If an out-of-memory error occurs while resizing the array, return\n** SQLITE_NOMEM. In this case Vdbe.aOp and Parse.nOpAlloc remain \n** unchanged (this is so that any opcodes already allocated can be \n** correctly deallocated along with the rest of the Vdbe).\n*/\nstatic int growOpArray(Vdbe *v, int nOp){\n  VdbeOp *pNew;\n  Parse *p = v->pParse;\n\n  /* The SQLITE_TEST_REALLOC_STRESS compile-time option is designed to force\n  ** more frequent reallocs and hence provide more opportunities for \n  ** simulated OOM faults.  SQLITE_TEST_REALLOC_STRESS is generally used\n  ** during testing only.  With SQLITE_TEST_REALLOC_STRESS grow the op array\n  ** by the minimum* amount required until the size reaches 512.  Normal\n  ** operation (without SQLITE_TEST_REALLOC_STRESS) is to double the current\n  ** size of the op array or add 1KB of space, whichever is smaller. */\n#ifdef SQLITE_TEST_REALLOC_STRESS\n  int nNew = (p->nOpAlloc>=512 ? p->nOpAlloc*2 : p->nOpAlloc+nOp);\n#else\n  int nNew = (p->nOpAlloc ? p->nOpAlloc*2 : (int)(1024/sizeof(Op)));\n  UNUSED_PARAMETER(nOp);\n#endif\n\n  assert( nOp<=(1024/sizeof(Op)) );\n  assert( nNew>=(p->nOpAlloc+nOp) );\n  pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));\n  if( pNew ){\n    p->szOpAlloc = sqlite3DbMallocSize(p->db, pNew);\n    p->nOpAlloc = p->szOpAlloc/sizeof(Op);\n    v->aOp = pNew;\n  }\n  return (pNew ? SQLITE_OK : SQLITE_NOMEM_BKPT);\n}\n\n#ifdef SQLITE_DEBUG\n/* This routine is just a convenient place to set a breakpoint that will\n** fire after each opcode is inserted and displayed using\n** \"PRAGMA vdbe_addoptrace=on\".\n*/\nstatic void test_addop_breakpoint(void){\n  static int n = 0;\n  n++;\n}\n#endif\n\n/*\n** Add a new instruction to the list of instructions current in the\n** VDBE.  Return the address of the new instruction.\n**\n** Parameters:\n**\n**    p               Pointer to the VDBE\n**\n**    op              The opcode for this instruction\n**\n**    p1, p2, p3      Operands\n**\n** Use the sqlite3VdbeResolveLabel() function to fix an address and\n** the sqlite3VdbeChangeP4() function to change the value of the P4\n** operand.\n*/\nstatic SQLITE_NOINLINE int growOp3(Vdbe *p, int op, int p1, int p2, int p3){\n  assert( p->pParse->nOpAlloc<=p->nOp );\n  if( growOpArray(p, 1) ) return 1;\n  assert( p->pParse->nOpAlloc>p->nOp );\n  return sqlite3VdbeAddOp3(p, op, p1, p2, p3);\n}\nint sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){\n  int i;\n  VdbeOp *pOp;\n\n  i = p->nOp;\n  assert( p->magic==VDBE_MAGIC_INIT );\n  assert( op>=0 && op<0xff );\n  if( p->pParse->nOpAlloc<=i ){\n    return growOp3(p, op, p1, p2, p3);\n  }\n  p->nOp++;\n  pOp = &p->aOp[i];\n  pOp->opcode = (u8)op;\n  pOp->p5 = 0;\n  pOp->p1 = p1;\n  pOp->p2 = p2;\n  pOp->p3 = p3;\n  pOp->p4.p = 0;\n  pOp->p4type = P4_NOTUSED;\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n  pOp->zComment = 0;\n#endif\n#ifdef SQLITE_DEBUG\n  if( p->db->flags & SQLITE_VdbeAddopTrace ){\n    int jj, kk;\n    Parse *pParse = p->pParse;\n    for(jj=kk=0; jj<pParse->nColCache; jj++){\n      struct yColCache *x = pParse->aColCache + jj;\n      printf(\" r[%d]={%d:%d}\", x->iReg, x->iTable, x->iColumn);\n      kk++;\n    }\n    if( kk ) printf(\"\\n\");\n    sqlite3VdbePrintOp(0, i, &p->aOp[i]);\n    test_addop_breakpoint();\n  }\n#endif\n#ifdef VDBE_PROFILE\n  pOp->cycles = 0;\n  pOp->cnt = 0;\n#endif\n#ifdef SQLITE_VDBE_COVERAGE\n  pOp->iSrcLine = 0;\n#endif\n  return i;\n}\nint sqlite3VdbeAddOp0(Vdbe *p, int op){\n  return sqlite3VdbeAddOp3(p, op, 0, 0, 0);\n}\nint sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){\n  return sqlite3VdbeAddOp3(p, op, p1, 0, 0);\n}\nint sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){\n  return sqlite3VdbeAddOp3(p, op, p1, p2, 0);\n}\n\n/* Generate code for an unconditional jump to instruction iDest\n*/\nint sqlite3VdbeGoto(Vdbe *p, int iDest){\n  return sqlite3VdbeAddOp3(p, OP_Goto, 0, iDest, 0);\n}\n\n/* Generate code to cause the string zStr to be loaded into\n** register iDest\n*/\nint sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){\n  return sqlite3VdbeAddOp4(p, OP_String8, 0, iDest, 0, zStr, 0);\n}\n\n/*\n** Generate code that initializes multiple registers to string or integer\n** constants.  The registers begin with iDest and increase consecutively.\n** One register is initialized for each characgter in zTypes[].  For each\n** \"s\" character in zTypes[], the register is a string if the argument is\n** not NULL, or OP_Null if the value is a null pointer.  For each \"i\" character\n** in zTypes[], the register is initialized to an integer.\n*/\nvoid sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){\n  va_list ap;\n  int i;\n  char c;\n  va_start(ap, zTypes);\n  for(i=0; (c = zTypes[i])!=0; i++){\n    if( c=='s' ){\n      const char *z = va_arg(ap, const char*);\n      sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest++, 0, z, 0);\n    }else{\n      assert( c=='i' );\n      sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest++);\n    }\n  }\n  va_end(ap);\n}\n\n/*\n** Add an opcode that includes the p4 value as a pointer.\n*/\nint sqlite3VdbeAddOp4(\n  Vdbe *p,            /* Add the opcode to this VM */\n  int op,             /* The new opcode */\n  int p1,             /* The P1 operand */\n  int p2,             /* The P2 operand */\n  int p3,             /* The P3 operand */\n  const char *zP4,    /* The P4 operand */\n  int p4type          /* P4 operand type */\n){\n  int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);\n  sqlite3VdbeChangeP4(p, addr, zP4, p4type);\n  return addr;\n}\n\n/*\n** Add an opcode that includes the p4 value with a P4_INT64 or\n** P4_REAL type.\n*/\nint sqlite3VdbeAddOp4Dup8(\n  Vdbe *p,            /* Add the opcode to this VM */\n  int op,             /* The new opcode */\n  int p1,             /* The P1 operand */\n  int p2,             /* The P2 operand */\n  int p3,             /* The P3 operand */\n  const u8 *zP4,      /* The P4 operand */\n  int p4type          /* P4 operand type */\n){\n  char *p4copy = sqlite3DbMallocRawNN(sqlite3VdbeDb(p), 8);\n  if( p4copy ) memcpy(p4copy, zP4, 8);\n  return sqlite3VdbeAddOp4(p, op, p1, p2, p3, p4copy, p4type);\n}\n\n/*\n** Add an OP_ParseSchema opcode.  This routine is broken out from\n** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees\n** as having been used.\n**\n** The zWhere string must have been obtained from sqlite3_malloc().\n** This routine will take ownership of the allocated memory.\n*/\nvoid sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){\n  int j;\n  sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);\n  for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);\n}\n\n/*\n** Add an opcode that includes the p4 value as an integer.\n*/\nint sqlite3VdbeAddOp4Int(\n  Vdbe *p,            /* Add the opcode to this VM */\n  int op,             /* The new opcode */\n  int p1,             /* The P1 operand */\n  int p2,             /* The P2 operand */\n  int p3,             /* The P3 operand */\n  int p4              /* The P4 operand as an integer */\n){\n  int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);\n  sqlite3VdbeChangeP4(p, addr, SQLITE_INT_TO_PTR(p4), P4_INT32);\n  return addr;\n}\n\n/* Insert the end of a co-routine\n*/\nvoid sqlite3VdbeEndCoroutine(Vdbe *v, int regYield){\n  sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield);\n\n  /* Clear the temporary register cache, thereby ensuring that each\n  ** co-routine has its own independent set of registers, because co-routines\n  ** might expect their registers to be preserved across an OP_Yield, and\n  ** that could cause problems if two or more co-routines are using the same\n  ** temporary register.\n  */\n  v->pParse->nTempReg = 0;\n  v->pParse->nRangeReg = 0;\n}\n\n/*\n** Create a new symbolic label for an instruction that has yet to be\n** coded.  The symbolic label is really just a negative number.  The\n** label can be used as the P2 value of an operation.  Later, when\n** the label is resolved to a specific address, the VDBE will scan\n** through its operation list and change all values of P2 which match\n** the label into the resolved address.\n**\n** The VDBE knows that a P2 value is a label because labels are\n** always negative and P2 values are suppose to be non-negative.\n** Hence, a negative P2 value is a label that has yet to be resolved.\n**\n** Zero is returned if a malloc() fails.\n*/\nint sqlite3VdbeMakeLabel(Vdbe *v){\n  Parse *p = v->pParse;\n  int i = p->nLabel++;\n  assert( v->magic==VDBE_MAGIC_INIT );\n  if( (i & (i-1))==0 ){\n    p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel, \n                                       (i*2+1)*sizeof(p->aLabel[0]));\n  }\n  if( p->aLabel ){\n    p->aLabel[i] = -1;\n  }\n  return ADDR(i);\n}\n\n/*\n** Resolve label \"x\" to be the address of the next instruction to\n** be inserted.  The parameter \"x\" must have been obtained from\n** a prior call to sqlite3VdbeMakeLabel().\n*/\nvoid sqlite3VdbeResolveLabel(Vdbe *v, int x){\n  Parse *p = v->pParse;\n  int j = ADDR(x);\n  assert( v->magic==VDBE_MAGIC_INIT );\n  assert( j<p->nLabel );\n  assert( j>=0 );\n  if( p->aLabel ){\n    p->aLabel[j] = v->nOp;\n  }\n}\n\n/*\n** Mark the VDBE as one that can only be run one time.\n*/\nvoid sqlite3VdbeRunOnlyOnce(Vdbe *p){\n  p->runOnlyOnce = 1;\n}\n\n/*\n** Mark the VDBE as one that can only be run multiple times.\n*/\nvoid sqlite3VdbeReusable(Vdbe *p){\n  p->runOnlyOnce = 0;\n}\n\n#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */\n\n/*\n** The following type and function are used to iterate through all opcodes\n** in a Vdbe main program and each of the sub-programs (triggers) it may \n** invoke directly or indirectly. It should be used as follows:\n**\n**   Op *pOp;\n**   VdbeOpIter sIter;\n**\n**   memset(&sIter, 0, sizeof(sIter));\n**   sIter.v = v;                            // v is of type Vdbe* \n**   while( (pOp = opIterNext(&sIter)) ){\n**     // Do something with pOp\n**   }\n**   sqlite3DbFree(v->db, sIter.apSub);\n** \n*/\ntypedef struct VdbeOpIter VdbeOpIter;\nstruct VdbeOpIter {\n  Vdbe *v;                   /* Vdbe to iterate through the opcodes of */\n  SubProgram **apSub;        /* Array of subprograms */\n  int nSub;                  /* Number of entries in apSub */\n  int iAddr;                 /* Address of next instruction to return */\n  int iSub;                  /* 0 = main program, 1 = first sub-program etc. */\n};\nstatic Op *opIterNext(VdbeOpIter *p){\n  Vdbe *v = p->v;\n  Op *pRet = 0;\n  Op *aOp;\n  int nOp;\n\n  if( p->iSub<=p->nSub ){\n\n    if( p->iSub==0 ){\n      aOp = v->aOp;\n      nOp = v->nOp;\n    }else{\n      aOp = p->apSub[p->iSub-1]->aOp;\n      nOp = p->apSub[p->iSub-1]->nOp;\n    }\n    assert( p->iAddr<nOp );\n\n    pRet = &aOp[p->iAddr];\n    p->iAddr++;\n    if( p->iAddr==nOp ){\n      p->iSub++;\n      p->iAddr = 0;\n    }\n  \n    if( pRet->p4type==P4_SUBPROGRAM ){\n      int nByte = (p->nSub+1)*sizeof(SubProgram*);\n      int j;\n      for(j=0; j<p->nSub; j++){\n        if( p->apSub[j]==pRet->p4.pProgram ) break;\n      }\n      if( j==p->nSub ){\n        p->apSub = sqlite3DbReallocOrFree(v->db, p->apSub, nByte);\n        if( !p->apSub ){\n          pRet = 0;\n        }else{\n          p->apSub[p->nSub++] = pRet->p4.pProgram;\n        }\n      }\n    }\n  }\n\n  return pRet;\n}\n\n/*\n** Check if the program stored in the VM associated with pParse may\n** throw an ABORT exception (causing the statement, but not entire transaction\n** to be rolled back). This condition is true if the main program or any\n** sub-programs contains any of the following:\n**\n**   *  OP_Halt with P1=SQLITE_CONSTRAINT and P2=OE_Abort.\n**   *  OP_HaltIfNull with P1=SQLITE_CONSTRAINT and P2=OE_Abort.\n**   *  OP_Destroy\n**   *  OP_VUpdate\n**   *  OP_VRename\n**   *  OP_FkCounter with P2==0 (immediate foreign key constraint)\n**   *  OP_CreateTable and OP_InitCoroutine (for CREATE TABLE AS SELECT ...)\n**\n** Then check that the value of Parse.mayAbort is true if an\n** ABORT may be thrown, or false otherwise. Return true if it does\n** match, or false otherwise. This function is intended to be used as\n** part of an assert statement in the compiler. Similar to:\n**\n**   assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) );\n*/\nint sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){\n  int hasAbort = 0;\n  int hasFkCounter = 0;\n  int hasCreateTable = 0;\n  int hasInitCoroutine = 0;\n  Op *pOp;\n  VdbeOpIter sIter;\n  memset(&sIter, 0, sizeof(sIter));\n  sIter.v = v;\n\n  while( (pOp = opIterNext(&sIter))!=0 ){\n    int opcode = pOp->opcode;\n    if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename \n     || ((opcode==OP_Halt || opcode==OP_HaltIfNull) \n      && ((pOp->p1&0xff)==SQLITE_CONSTRAINT && pOp->p2==OE_Abort))\n    ){\n      hasAbort = 1;\n      break;\n    }\n    if( opcode==OP_CreateTable ) hasCreateTable = 1;\n    if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1;\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n    if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){\n      hasFkCounter = 1;\n    }\n#endif\n  }\n  sqlite3DbFree(v->db, sIter.apSub);\n\n  /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred.\n  ** If malloc failed, then the while() loop above may not have iterated\n  ** through all opcodes and hasAbort may be set incorrectly. Return\n  ** true for this case to prevent the assert() in the callers frame\n  ** from failing.  */\n  return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter\n              || (hasCreateTable && hasInitCoroutine) );\n}\n#endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */\n\n/*\n** This routine is called after all opcodes have been inserted.  It loops\n** through all the opcodes and fixes up some details.\n**\n** (1) For each jump instruction with a negative P2 value (a label)\n**     resolve the P2 value to an actual address.\n**\n** (2) Compute the maximum number of arguments used by any SQL function\n**     and store that value in *pMaxFuncArgs.\n**\n** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately\n**     indicate what the prepared statement actually does.\n**\n** (4) Initialize the p4.xAdvance pointer on opcodes that use it.\n**\n** (5) Reclaim the memory allocated for storing labels.\n**\n** This routine will only function correctly if the mkopcodeh.tcl generator\n** script numbers the opcodes correctly.  Changes to this routine must be\n** coordinated with changes to mkopcodeh.tcl.\n*/\nstatic void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){\n  int nMaxArgs = *pMaxFuncArgs;\n  Op *pOp;\n  Parse *pParse = p->pParse;\n  int *aLabel = pParse->aLabel;\n  p->readOnly = 1;\n  p->bIsReader = 0;\n  pOp = &p->aOp[p->nOp-1];\n  while(1){\n\n    /* Only JUMP opcodes and the short list of special opcodes in the switch\n    ** below need to be considered.  The mkopcodeh.tcl generator script groups\n    ** all these opcodes together near the front of the opcode list.  Skip\n    ** any opcode that does not need processing by virtual of the fact that\n    ** it is larger than SQLITE_MX_JUMP_OPCODE, as a performance optimization.\n    */\n    if( pOp->opcode<=SQLITE_MX_JUMP_OPCODE ){\n      /* NOTE: Be sure to update mkopcodeh.tcl when adding or removing\n      ** cases from this switch! */\n      switch( pOp->opcode ){\n        case OP_Transaction: {\n          if( pOp->p2!=0 ) p->readOnly = 0;\n          /* fall thru */\n        }\n        case OP_AutoCommit:\n        case OP_Savepoint: {\n          p->bIsReader = 1;\n          break;\n        }\n#ifndef SQLITE_OMIT_WAL\n        case OP_Checkpoint:\n#endif\n        case OP_Vacuum:\n        case OP_JournalMode: {\n          p->readOnly = 0;\n          p->bIsReader = 1;\n          break;\n        }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n        case OP_VUpdate: {\n          if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;\n          break;\n        }\n        case OP_VFilter: {\n          int n;\n          assert( (pOp - p->aOp) >= 3 );\n          assert( pOp[-1].opcode==OP_Integer );\n          n = pOp[-1].p1;\n          if( n>nMaxArgs ) nMaxArgs = n;\n          break;\n        }\n#endif\n        case OP_Next:\n        case OP_NextIfOpen:\n        case OP_SorterNext: {\n          pOp->p4.xAdvance = sqlite3BtreeNext;\n          pOp->p4type = P4_ADVANCE;\n          break;\n        }\n        case OP_Prev:\n        case OP_PrevIfOpen: {\n          pOp->p4.xAdvance = sqlite3BtreePrevious;\n          pOp->p4type = P4_ADVANCE;\n          break;\n        }\n      }\n      if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 && pOp->p2<0 ){\n        assert( ADDR(pOp->p2)<pParse->nLabel );\n        pOp->p2 = aLabel[ADDR(pOp->p2)];\n      }\n    }\n    if( pOp==p->aOp ) break;\n    pOp--;\n  }\n  sqlite3DbFree(p->db, pParse->aLabel);\n  pParse->aLabel = 0;\n  pParse->nLabel = 0;\n  *pMaxFuncArgs = nMaxArgs;\n  assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );\n}\n\n/*\n** Return the address of the next instruction to be inserted.\n*/\nint sqlite3VdbeCurrentAddr(Vdbe *p){\n  assert( p->magic==VDBE_MAGIC_INIT );\n  return p->nOp;\n}\n\n/*\n** Verify that at least N opcode slots are available in p without\n** having to malloc for more space (except when compiled using\n** SQLITE_TEST_REALLOC_STRESS).  This interface is used during testing\n** to verify that certain calls to sqlite3VdbeAddOpList() can never\n** fail due to a OOM fault and hence that the return value from\n** sqlite3VdbeAddOpList() will always be non-NULL.\n*/\n#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)\nvoid sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){\n  assert( p->nOp + N <= p->pParse->nOpAlloc );\n}\n#endif\n\n/*\n** This function returns a pointer to the array of opcodes associated with\n** the Vdbe passed as the first argument. It is the callers responsibility\n** to arrange for the returned array to be eventually freed using the \n** vdbeFreeOpArray() function.\n**\n** Before returning, *pnOp is set to the number of entries in the returned\n** array. Also, *pnMaxArg is set to the larger of its current value and \n** the number of entries in the Vdbe.apArg[] array required to execute the \n** returned program.\n*/\nVdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){\n  VdbeOp *aOp = p->aOp;\n  assert( aOp && !p->db->mallocFailed );\n\n  /* Check that sqlite3VdbeUsesBtree() was not called on this VM */\n  assert( DbMaskAllZero(p->btreeMask) );\n\n  resolveP2Values(p, pnMaxArg);\n  *pnOp = p->nOp;\n  p->aOp = 0;\n  return aOp;\n}\n\n/*\n** Add a whole list of operations to the operation stack.  Return a\n** pointer to the first operation inserted.\n**\n** Non-zero P2 arguments to jump instructions are automatically adjusted\n** so that the jump target is relative to the first operation inserted.\n*/\nVdbeOp *sqlite3VdbeAddOpList(\n  Vdbe *p,                     /* Add opcodes to the prepared statement */\n  int nOp,                     /* Number of opcodes to add */\n  VdbeOpList const *aOp,       /* The opcodes to be added */\n  int iLineno                  /* Source-file line number of first opcode */\n){\n  int i;\n  VdbeOp *pOut, *pFirst;\n  assert( nOp>0 );\n  assert( p->magic==VDBE_MAGIC_INIT );\n  if( p->nOp + nOp > p->pParse->nOpAlloc && growOpArray(p, nOp) ){\n    return 0;\n  }\n  pFirst = pOut = &p->aOp[p->nOp];\n  for(i=0; i<nOp; i++, aOp++, pOut++){\n    pOut->opcode = aOp->opcode;\n    pOut->p1 = aOp->p1;\n    pOut->p2 = aOp->p2;\n    assert( aOp->p2>=0 );\n    if( (sqlite3OpcodeProperty[aOp->opcode] & OPFLG_JUMP)!=0 && aOp->p2>0 ){\n      pOut->p2 += p->nOp;\n    }\n    pOut->p3 = aOp->p3;\n    pOut->p4type = P4_NOTUSED;\n    pOut->p4.p = 0;\n    pOut->p5 = 0;\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n    pOut->zComment = 0;\n#endif\n#ifdef SQLITE_VDBE_COVERAGE\n    pOut->iSrcLine = iLineno+i;\n#else\n    (void)iLineno;\n#endif\n#ifdef SQLITE_DEBUG\n    if( p->db->flags & SQLITE_VdbeAddopTrace ){\n      sqlite3VdbePrintOp(0, i+p->nOp, &p->aOp[i+p->nOp]);\n    }\n#endif\n  }\n  p->nOp += nOp;\n  return pFirst;\n}\n\n#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)\n/*\n** Add an entry to the array of counters managed by sqlite3_stmt_scanstatus().\n*/\nvoid sqlite3VdbeScanStatus(\n  Vdbe *p,                        /* VM to add scanstatus() to */\n  int addrExplain,                /* Address of OP_Explain (or 0) */\n  int addrLoop,                   /* Address of loop counter */ \n  int addrVisit,                  /* Address of rows visited counter */\n  LogEst nEst,                    /* Estimated number of output rows */\n  const char *zName               /* Name of table or index being scanned */\n){\n  int nByte = (p->nScan+1) * sizeof(ScanStatus);\n  ScanStatus *aNew;\n  aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);\n  if( aNew ){\n    ScanStatus *pNew = &aNew[p->nScan++];\n    pNew->addrExplain = addrExplain;\n    pNew->addrLoop = addrLoop;\n    pNew->addrVisit = addrVisit;\n    pNew->nEst = nEst;\n    pNew->zName = sqlite3DbStrDup(p->db, zName);\n    p->aScan = aNew;\n  }\n}\n#endif\n\n\n/*\n** Change the value of the opcode, or P1, P2, P3, or P5 operands\n** for a specific instruction.\n*/\nvoid sqlite3VdbeChangeOpcode(Vdbe *p, u32 addr, u8 iNewOpcode){\n  sqlite3VdbeGetOp(p,addr)->opcode = iNewOpcode;\n}\nvoid sqlite3VdbeChangeP1(Vdbe *p, u32 addr, int val){\n  sqlite3VdbeGetOp(p,addr)->p1 = val;\n}\nvoid sqlite3VdbeChangeP2(Vdbe *p, u32 addr, int val){\n  sqlite3VdbeGetOp(p,addr)->p2 = val;\n}\nvoid sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){\n  sqlite3VdbeGetOp(p,addr)->p3 = val;\n}\nvoid sqlite3VdbeChangeP5(Vdbe *p, u8 p5){\n  assert( p->nOp>0 || p->db->mallocFailed );\n  if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;\n}\n\n/*\n** Change the P2 operand of instruction addr so that it points to\n** the address of the next instruction to be coded.\n*/\nvoid sqlite3VdbeJumpHere(Vdbe *p, int addr){\n  sqlite3VdbeChangeP2(p, addr, p->nOp);\n}\n\n\n/*\n** If the input FuncDef structure is ephemeral, then free it.  If\n** the FuncDef is not ephermal, then do nothing.\n*/\nstatic void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){\n  if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){\n    sqlite3DbFree(db, pDef);\n  }\n}\n\nstatic void vdbeFreeOpArray(sqlite3 *, Op *, int);\n\n/*\n** Delete a P4 value if necessary.\n*/\nstatic SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){\n  if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);\n  sqlite3DbFree(db, p);\n}\nstatic SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){\n  freeEphemeralFunction(db, p->pFunc);\n  sqlite3DbFree(db, p);\n}\nstatic void freeP4(sqlite3 *db, int p4type, void *p4){\n  assert( db );\n  switch( p4type ){\n    case P4_FUNCCTX: {\n      freeP4FuncCtx(db, (sqlite3_context*)p4);\n      break;\n    }\n    case P4_REAL:\n    case P4_INT64:\n    case P4_DYNAMIC:\n    case P4_INTARRAY: {\n      sqlite3DbFree(db, p4);\n      break;\n    }\n    case P4_KEYINFO: {\n      if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4);\n      break;\n    }\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n    case P4_EXPR: {\n      sqlite3ExprDelete(db, (Expr*)p4);\n      break;\n    }\n#endif\n    case P4_MPRINTF: {\n      if( db->pnBytesFreed==0 ) sqlite3_free(p4);\n      break;\n    }\n    case P4_FUNCDEF: {\n      freeEphemeralFunction(db, (FuncDef*)p4);\n      break;\n    }\n    case P4_MEM: {\n      if( db->pnBytesFreed==0 ){\n        sqlite3ValueFree((sqlite3_value*)p4);\n      }else{\n        freeP4Mem(db, (Mem*)p4);\n      }\n      break;\n    }\n    case P4_VTAB : {\n      if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);\n      break;\n    }\n  }\n}\n\n/*\n** Free the space allocated for aOp and any p4 values allocated for the\n** opcodes contained within. If aOp is not NULL it is assumed to contain \n** nOp entries. \n*/\nstatic void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){\n  if( aOp ){\n    Op *pOp;\n    for(pOp=aOp; pOp<&aOp[nOp]; pOp++){\n      if( pOp->p4type ) freeP4(db, pOp->p4type, pOp->p4.p);\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n      sqlite3DbFree(db, pOp->zComment);\n#endif     \n    }\n  }\n  sqlite3DbFree(db, aOp);\n}\n\n/*\n** Link the SubProgram object passed as the second argument into the linked\n** list at Vdbe.pSubProgram. This list is used to delete all sub-program\n** objects when the VM is no longer required.\n*/\nvoid sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){\n  p->pNext = pVdbe->pProgram;\n  pVdbe->pProgram = p;\n}\n\n/*\n** Change the opcode at addr into OP_Noop\n*/\nint sqlite3VdbeChangeToNoop(Vdbe *p, int addr){\n  VdbeOp *pOp;\n  if( p->db->mallocFailed ) return 0;\n  assert( addr>=0 && addr<p->nOp );\n  pOp = &p->aOp[addr];\n  freeP4(p->db, pOp->p4type, pOp->p4.p);\n  pOp->p4type = P4_NOTUSED;\n  pOp->p4.z = 0;\n  pOp->opcode = OP_Noop;\n  return 1;\n}\n\n/*\n** If the last opcode is \"op\" and it is not a jump destination,\n** then remove it.  Return true if and only if an opcode was removed.\n*/\nint sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){\n  if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){\n    return sqlite3VdbeChangeToNoop(p, p->nOp-1);\n  }else{\n    return 0;\n  }\n}\n\n/*\n** Change the value of the P4 operand for a specific instruction.\n** This routine is useful when a large program is loaded from a\n** static array using sqlite3VdbeAddOpList but we want to make a\n** few minor changes to the program.\n**\n** If n>=0 then the P4 operand is dynamic, meaning that a copy of\n** the string is made into memory obtained from sqlite3_malloc().\n** A value of n==0 means copy bytes of zP4 up to and including the\n** first null byte.  If n>0 then copy n+1 bytes of zP4.\n** \n** Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points\n** to a string or structure that is guaranteed to exist for the lifetime of\n** the Vdbe. In these cases we can just copy the pointer.\n**\n** If addr<0 then change P4 on the most recently inserted instruction.\n*/\nstatic void SQLITE_NOINLINE vdbeChangeP4Full(\n  Vdbe *p,\n  Op *pOp,\n  const char *zP4,\n  int n\n){\n  if( pOp->p4type ){\n    freeP4(p->db, pOp->p4type, pOp->p4.p);\n    pOp->p4type = 0;\n    pOp->p4.p = 0;\n  }\n  if( n<0 ){\n    sqlite3VdbeChangeP4(p, (int)(pOp - p->aOp), zP4, n);\n  }else{\n    if( n==0 ) n = sqlite3Strlen30(zP4);\n    pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n);\n    pOp->p4type = P4_DYNAMIC;\n  }\n}\nvoid sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){\n  Op *pOp;\n  sqlite3 *db;\n  assert( p!=0 );\n  db = p->db;\n  assert( p->magic==VDBE_MAGIC_INIT );\n  assert( p->aOp!=0 || db->mallocFailed );\n  if( db->mallocFailed ){\n    if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);\n    return;\n  }\n  assert( p->nOp>0 );\n  assert( addr<p->nOp );\n  if( addr<0 ){\n    addr = p->nOp - 1;\n  }\n  pOp = &p->aOp[addr];\n  if( n>=0 || pOp->p4type ){\n    vdbeChangeP4Full(p, pOp, zP4, n);\n    return;\n  }\n  if( n==P4_INT32 ){\n    /* Note: this cast is safe, because the origin data point was an int\n    ** that was cast to a (const char *). */\n    pOp->p4.i = SQLITE_PTR_TO_INT(zP4);\n    pOp->p4type = P4_INT32;\n  }else if( zP4!=0 ){\n    assert( n<0 );\n    pOp->p4.p = (void*)zP4;\n    pOp->p4type = (signed char)n;\n    if( n==P4_VTAB ) sqlite3VtabLock((VTable*)zP4);\n  }\n}\n\n/*\n** Set the P4 on the most recently added opcode to the KeyInfo for the\n** index given.\n*/\nvoid sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){\n  Vdbe *v = pParse->pVdbe;\n  assert( v!=0 );\n  assert( pIdx!=0 );\n  sqlite3VdbeChangeP4(v, -1, (char*)sqlite3KeyInfoOfIndex(pParse, pIdx),\n                      P4_KEYINFO);\n}\n\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n/*\n** Change the comment on the most recently coded instruction.  Or\n** insert a No-op and add the comment to that new instruction.  This\n** makes the code easier to read during debugging.  None of this happens\n** in a production build.\n*/\nstatic void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){\n  assert( p->nOp>0 || p->aOp==0 );\n  assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed );\n  if( p->nOp ){\n    assert( p->aOp );\n    sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment);\n    p->aOp[p->nOp-1].zComment = sqlite3VMPrintf(p->db, zFormat, ap);\n  }\n}\nvoid sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){\n  va_list ap;\n  if( p ){\n    va_start(ap, zFormat);\n    vdbeVComment(p, zFormat, ap);\n    va_end(ap);\n  }\n}\nvoid sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){\n  va_list ap;\n  if( p ){\n    sqlite3VdbeAddOp0(p, OP_Noop);\n    va_start(ap, zFormat);\n    vdbeVComment(p, zFormat, ap);\n    va_end(ap);\n  }\n}\n#endif  /* NDEBUG */\n\n#ifdef SQLITE_VDBE_COVERAGE\n/*\n** Set the value if the iSrcLine field for the previously coded instruction.\n*/\nvoid sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){\n  sqlite3VdbeGetOp(v,-1)->iSrcLine = iLine;\n}\n#endif /* SQLITE_VDBE_COVERAGE */\n\n/*\n** Return the opcode for a given address.  If the address is -1, then\n** return the most recently inserted opcode.\n**\n** If a memory allocation error has occurred prior to the calling of this\n** routine, then a pointer to a dummy VdbeOp will be returned.  That opcode\n** is readable but not writable, though it is cast to a writable value.\n** The return of a dummy opcode allows the call to continue functioning\n** after an OOM fault without having to check to see if the return from \n** this routine is a valid pointer.  But because the dummy.opcode is 0,\n** dummy will never be written to.  This is verified by code inspection and\n** by running with Valgrind.\n*/\nVdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){\n  /* C89 specifies that the constant \"dummy\" will be initialized to all\n  ** zeros, which is correct.  MSVC generates a warning, nevertheless. */\n  static VdbeOp dummy;  /* Ignore the MSVC warning about no initializer */\n  assert( p->magic==VDBE_MAGIC_INIT );\n  if( addr<0 ){\n    addr = p->nOp - 1;\n  }\n  assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );\n  if( p->db->mallocFailed ){\n    return (VdbeOp*)&dummy;\n  }else{\n    return &p->aOp[addr];\n  }\n}\n\n#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS)\n/*\n** Return an integer value for one of the parameters to the opcode pOp\n** determined by character c.\n*/\nstatic int translateP(char c, const Op *pOp){\n  if( c=='1' ) return pOp->p1;\n  if( c=='2' ) return pOp->p2;\n  if( c=='3' ) return pOp->p3;\n  if( c=='4' ) return pOp->p4.i;\n  return pOp->p5;\n}\n\n/*\n** Compute a string for the \"comment\" field of a VDBE opcode listing.\n**\n** The Synopsis: field in comments in the vdbe.c source file gets converted\n** to an extra string that is appended to the sqlite3OpcodeName().  In the\n** absence of other comments, this synopsis becomes the comment on the opcode.\n** Some translation occurs:\n**\n**       \"PX\"      ->  \"r[X]\"\n**       \"PX@PY\"   ->  \"r[X..X+Y-1]\"  or \"r[x]\" if y is 0 or 1\n**       \"PX@PY+1\" ->  \"r[X..X+Y]\"    or \"r[x]\" if y is 0\n**       \"PY..PY\"  ->  \"r[X..Y]\"      or \"r[x]\" if y<=x\n*/\nstatic int displayComment(\n  const Op *pOp,     /* The opcode to be commented */\n  const char *zP4,   /* Previously obtained value for P4 */\n  char *zTemp,       /* Write result here */\n  int nTemp          /* Space available in zTemp[] */\n){\n  const char *zOpName;\n  const char *zSynopsis;\n  int nOpName;\n  int ii, jj;\n  char zAlt[50];\n  zOpName = sqlite3OpcodeName(pOp->opcode);\n  nOpName = sqlite3Strlen30(zOpName);\n  if( zOpName[nOpName+1] ){\n    int seenCom = 0;\n    char c;\n    zSynopsis = zOpName += nOpName + 1;\n    if( strncmp(zSynopsis,\"IF \",3)==0 ){\n      if( pOp->p5 & SQLITE_STOREP2 ){\n        sqlite3_snprintf(sizeof(zAlt), zAlt, \"r[P2] = (%s)\", zSynopsis+3);\n      }else{\n        sqlite3_snprintf(sizeof(zAlt), zAlt, \"if %s goto P2\", zSynopsis+3);\n      }\n      zSynopsis = zAlt;\n    }\n    for(ii=jj=0; jj<nTemp-1 && (c = zSynopsis[ii])!=0; ii++){\n      if( c=='P' ){\n        c = zSynopsis[++ii];\n        if( c=='4' ){\n          sqlite3_snprintf(nTemp-jj, zTemp+jj, \"%s\", zP4);\n        }else if( c=='X' ){\n          sqlite3_snprintf(nTemp-jj, zTemp+jj, \"%s\", pOp->zComment);\n          seenCom = 1;\n        }else{\n          int v1 = translateP(c, pOp);\n          int v2;\n          sqlite3_snprintf(nTemp-jj, zTemp+jj, \"%d\", v1);\n          if( strncmp(zSynopsis+ii+1, \"@P\", 2)==0 ){\n            ii += 3;\n            jj += sqlite3Strlen30(zTemp+jj);\n            v2 = translateP(zSynopsis[ii], pOp);\n            if( strncmp(zSynopsis+ii+1,\"+1\",2)==0 ){\n              ii += 2;\n              v2++;\n            }\n            if( v2>1 ){\n              sqlite3_snprintf(nTemp-jj, zTemp+jj, \"..%d\", v1+v2-1);\n            }\n          }else if( strncmp(zSynopsis+ii+1, \"..P3\", 4)==0 && pOp->p3==0 ){\n            ii += 4;\n          }\n        }\n        jj += sqlite3Strlen30(zTemp+jj);\n      }else{\n        zTemp[jj++] = c;\n      }\n    }\n    if( !seenCom && jj<nTemp-5 && pOp->zComment ){\n      sqlite3_snprintf(nTemp-jj, zTemp+jj, \"; %s\", pOp->zComment);\n      jj += sqlite3Strlen30(zTemp+jj);\n    }\n    if( jj<nTemp ) zTemp[jj] = 0;\n  }else if( pOp->zComment ){\n    sqlite3_snprintf(nTemp, zTemp, \"%s\", pOp->zComment);\n    jj = sqlite3Strlen30(zTemp);\n  }else{\n    zTemp[0] = 0;\n    jj = 0;\n  }\n  return jj;\n}\n#endif /* SQLITE_DEBUG */\n\n#if VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS)\n/*\n** Translate the P4.pExpr value for an OP_CursorHint opcode into text\n** that can be displayed in the P4 column of EXPLAIN output.\n*/\nstatic void displayP4Expr(StrAccum *p, Expr *pExpr){\n  const char *zOp = 0;\n  switch( pExpr->op ){\n    case TK_STRING:\n      sqlite3XPrintf(p, \"%Q\", pExpr->u.zToken);\n      break;\n    case TK_INTEGER:\n      sqlite3XPrintf(p, \"%d\", pExpr->u.iValue);\n      break;\n    case TK_NULL:\n      sqlite3XPrintf(p, \"NULL\");\n      break;\n    case TK_REGISTER: {\n      sqlite3XPrintf(p, \"r[%d]\", pExpr->iTable);\n      break;\n    }\n    case TK_COLUMN: {\n      if( pExpr->iColumn<0 ){\n        sqlite3XPrintf(p, \"rowid\");\n      }else{\n        sqlite3XPrintf(p, \"c%d\", (int)pExpr->iColumn);\n      }\n      break;\n    }\n    case TK_LT:      zOp = \"LT\";      break;\n    case TK_LE:      zOp = \"LE\";      break;\n    case TK_GT:      zOp = \"GT\";      break;\n    case TK_GE:      zOp = \"GE\";      break;\n    case TK_NE:      zOp = \"NE\";      break;\n    case TK_EQ:      zOp = \"EQ\";      break;\n    case TK_IS:      zOp = \"IS\";      break;\n    case TK_ISNOT:   zOp = \"ISNOT\";   break;\n    case TK_AND:     zOp = \"AND\";     break;\n    case TK_OR:      zOp = \"OR\";      break;\n    case TK_PLUS:    zOp = \"ADD\";     break;\n    case TK_STAR:    zOp = \"MUL\";     break;\n    case TK_MINUS:   zOp = \"SUB\";     break;\n    case TK_REM:     zOp = \"REM\";     break;\n    case TK_BITAND:  zOp = \"BITAND\";  break;\n    case TK_BITOR:   zOp = \"BITOR\";   break;\n    case TK_SLASH:   zOp = \"DIV\";     break;\n    case TK_LSHIFT:  zOp = \"LSHIFT\";  break;\n    case TK_RSHIFT:  zOp = \"RSHIFT\";  break;\n    case TK_CONCAT:  zOp = \"CONCAT\";  break;\n    case TK_UMINUS:  zOp = \"MINUS\";   break;\n    case TK_UPLUS:   zOp = \"PLUS\";    break;\n    case TK_BITNOT:  zOp = \"BITNOT\";  break;\n    case TK_NOT:     zOp = \"NOT\";     break;\n    case TK_ISNULL:  zOp = \"ISNULL\";  break;\n    case TK_NOTNULL: zOp = \"NOTNULL\"; break;\n\n    default:\n      sqlite3XPrintf(p, \"%s\", \"expr\");\n      break;\n  }\n\n  if( zOp ){\n    sqlite3XPrintf(p, \"%s(\", zOp);\n    displayP4Expr(p, pExpr->pLeft);\n    if( pExpr->pRight ){\n      sqlite3StrAccumAppend(p, \",\", 1);\n      displayP4Expr(p, pExpr->pRight);\n    }\n    sqlite3StrAccumAppend(p, \")\", 1);\n  }\n}\n#endif /* VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS) */\n\n\n#if VDBE_DISPLAY_P4\n/*\n** Compute a string that describes the P4 parameter for an opcode.\n** Use zTemp for any required temporary buffer space.\n*/\nstatic char *displayP4(Op *pOp, char *zTemp, int nTemp){\n  char *zP4 = zTemp;\n  StrAccum x;\n  assert( nTemp>=20 );\n  sqlite3StrAccumInit(&x, 0, zTemp, nTemp, 0);\n  switch( pOp->p4type ){\n    case P4_KEYINFO: {\n      int j;\n      KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;\n      assert( pKeyInfo->aSortOrder!=0 );\n      sqlite3XPrintf(&x, \"k(%d\", pKeyInfo->nField);\n      for(j=0; j<pKeyInfo->nField; j++){\n        CollSeq *pColl = pKeyInfo->aColl[j];\n        const char *zColl = pColl ? pColl->zName : \"\";\n        if( strcmp(zColl, \"BINARY\")==0 ) zColl = \"B\";\n        sqlite3XPrintf(&x, \",%s%s\", pKeyInfo->aSortOrder[j] ? \"-\" : \"\", zColl);\n      }\n      sqlite3StrAccumAppend(&x, \")\", 1);\n      break;\n    }\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n    case P4_EXPR: {\n      displayP4Expr(&x, pOp->p4.pExpr);\n      break;\n    }\n#endif\n    case P4_COLLSEQ: {\n      CollSeq *pColl = pOp->p4.pColl;\n      sqlite3XPrintf(&x, \"(%.20s)\", pColl->zName);\n      break;\n    }\n    case P4_FUNCDEF: {\n      FuncDef *pDef = pOp->p4.pFunc;\n      sqlite3XPrintf(&x, \"%s(%d)\", pDef->zName, pDef->nArg);\n      break;\n    }\n#ifdef SQLITE_DEBUG\n    case P4_FUNCCTX: {\n      FuncDef *pDef = pOp->p4.pCtx->pFunc;\n      sqlite3XPrintf(&x, \"%s(%d)\", pDef->zName, pDef->nArg);\n      break;\n    }\n#endif\n    case P4_INT64: {\n      sqlite3XPrintf(&x, \"%lld\", *pOp->p4.pI64);\n      break;\n    }\n    case P4_INT32: {\n      sqlite3XPrintf(&x, \"%d\", pOp->p4.i);\n      break;\n    }\n    case P4_REAL: {\n      sqlite3XPrintf(&x, \"%.16g\", *pOp->p4.pReal);\n      break;\n    }\n    case P4_MEM: {\n      Mem *pMem = pOp->p4.pMem;\n      if( pMem->flags & MEM_Str ){\n        zP4 = pMem->z;\n      }else if( pMem->flags & MEM_Int ){\n        sqlite3XPrintf(&x, \"%lld\", pMem->u.i);\n      }else if( pMem->flags & MEM_Real ){\n        sqlite3XPrintf(&x, \"%.16g\", pMem->u.r);\n      }else if( pMem->flags & MEM_Null ){\n        zP4 = \"NULL\";\n      }else{\n        assert( pMem->flags & MEM_Blob );\n        zP4 = \"(blob)\";\n      }\n      break;\n    }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    case P4_VTAB: {\n      sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab;\n      sqlite3XPrintf(&x, \"vtab:%p\", pVtab);\n      break;\n    }\n#endif\n    case P4_INTARRAY: {\n      int i;\n      int *ai = pOp->p4.ai;\n      int n = ai[0];   /* The first element of an INTARRAY is always the\n                       ** count of the number of elements to follow */\n      for(i=1; i<n; i++){\n        sqlite3XPrintf(&x, \",%d\", ai[i]);\n      }\n      zTemp[0] = '[';\n      sqlite3StrAccumAppend(&x, \"]\", 1);\n      break;\n    }\n    case P4_SUBPROGRAM: {\n      sqlite3XPrintf(&x, \"program\");\n      break;\n    }\n    case P4_ADVANCE: {\n      zTemp[0] = 0;\n      break;\n    }\n    case P4_TABLE: {\n      sqlite3XPrintf(&x, \"%s\", pOp->p4.pTab->zName);\n      break;\n    }\n    default: {\n      zP4 = pOp->p4.z;\n      if( zP4==0 ){\n        zP4 = zTemp;\n        zTemp[0] = 0;\n      }\n    }\n  }\n  sqlite3StrAccumFinish(&x);\n  assert( zP4!=0 );\n  return zP4;\n}\n#endif /* VDBE_DISPLAY_P4 */\n\n/*\n** Declare to the Vdbe that the BTree object at db->aDb[i] is used.\n**\n** The prepared statements need to know in advance the complete set of\n** attached databases that will be use.  A mask of these databases\n** is maintained in p->btreeMask.  The p->lockMask value is the subset of\n** p->btreeMask of databases that will require a lock.\n*/\nvoid sqlite3VdbeUsesBtree(Vdbe *p, int i){\n  assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );\n  assert( i<(int)sizeof(p->btreeMask)*8 );\n  DbMaskSet(p->btreeMask, i);\n  if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){\n    DbMaskSet(p->lockMask, i);\n  }\n}\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE)\n/*\n** If SQLite is compiled to support shared-cache mode and to be threadsafe,\n** this routine obtains the mutex associated with each BtShared structure\n** that may be accessed by the VM passed as an argument. In doing so it also\n** sets the BtShared.db member of each of the BtShared structures, ensuring\n** that the correct busy-handler callback is invoked if required.\n**\n** If SQLite is not threadsafe but does support shared-cache mode, then\n** sqlite3BtreeEnter() is invoked to set the BtShared.db variables\n** of all of BtShared structures accessible via the database handle \n** associated with the VM.\n**\n** If SQLite is not threadsafe and does not support shared-cache mode, this\n** function is a no-op.\n**\n** The p->btreeMask field is a bitmask of all btrees that the prepared \n** statement p will ever use.  Let N be the number of bits in p->btreeMask\n** corresponding to btrees that use shared cache.  Then the runtime of\n** this routine is N*N.  But as N is rarely more than 1, this should not\n** be a problem.\n*/\nvoid sqlite3VdbeEnter(Vdbe *p){\n  int i;\n  sqlite3 *db;\n  Db *aDb;\n  int nDb;\n  if( DbMaskAllZero(p->lockMask) ) return;  /* The common case */\n  db = p->db;\n  aDb = db->aDb;\n  nDb = db->nDb;\n  for(i=0; i<nDb; i++){\n    if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){\n      sqlite3BtreeEnter(aDb[i].pBt);\n    }\n  }\n}\n#endif\n\n#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0\n/*\n** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().\n*/\nstatic SQLITE_NOINLINE void vdbeLeave(Vdbe *p){\n  int i;\n  sqlite3 *db;\n  Db *aDb;\n  int nDb;\n  db = p->db;\n  aDb = db->aDb;\n  nDb = db->nDb;\n  for(i=0; i<nDb; i++){\n    if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){\n      sqlite3BtreeLeave(aDb[i].pBt);\n    }\n  }\n}\nvoid sqlite3VdbeLeave(Vdbe *p){\n  if( DbMaskAllZero(p->lockMask) ) return;  /* The common case */\n  vdbeLeave(p);\n}\n#endif\n\n#if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)\n/*\n** Print a single opcode.  This routine is used for debugging only.\n*/\nvoid sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){\n  char *zP4;\n  char zPtr[50];\n  char zCom[100];\n  static const char *zFormat1 = \"%4d %-13s %4d %4d %4d %-13s %.2X %s\\n\";\n  if( pOut==0 ) pOut = stdout;\n  zP4 = displayP4(pOp, zPtr, sizeof(zPtr));\n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n  displayComment(pOp, zP4, zCom, sizeof(zCom));\n#else\n  zCom[0] = 0;\n#endif\n  /* NB:  The sqlite3OpcodeName() function is implemented by code created\n  ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the\n  ** information from the vdbe.c source text */\n  fprintf(pOut, zFormat1, pc, \n      sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,\n      zCom\n  );\n  fflush(pOut);\n}\n#endif\n\n/*\n** Initialize an array of N Mem element.\n*/\nstatic void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){\n  while( (N--)>0 ){\n    p->db = db;\n    p->flags = flags;\n    p->szMalloc = 0;\n#ifdef SQLITE_DEBUG\n    p->pScopyFrom = 0;\n#endif\n    p++;\n  }\n}\n\n/*\n** Release an array of N Mem elements\n*/\nstatic void releaseMemArray(Mem *p, int N){\n  if( p && N ){\n    Mem *pEnd = &p[N];\n    sqlite3 *db = p->db;\n    if( db->pnBytesFreed ){\n      do{\n        if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);\n      }while( (++p)<pEnd );\n      return;\n    }\n    do{\n      assert( (&p[1])==pEnd || p[0].db==p[1].db );\n      assert( sqlite3VdbeCheckMemInvariants(p) );\n\n      /* This block is really an inlined version of sqlite3VdbeMemRelease()\n      ** that takes advantage of the fact that the memory cell value is \n      ** being set to NULL after releasing any dynamic resources.\n      **\n      ** The justification for duplicating code is that according to \n      ** callgrind, this causes a certain test case to hit the CPU 4.7 \n      ** percent less (x86 linux, gcc version 4.1.2, -O6) than if \n      ** sqlite3MemRelease() were called from here. With -O2, this jumps\n      ** to 6.6 percent. The test case is inserting 1000 rows into a table \n      ** with no indexes using a single prepared INSERT statement, bind() \n      ** and reset(). Inserts are grouped into a transaction.\n      */\n      testcase( p->flags & MEM_Agg );\n      testcase( p->flags & MEM_Dyn );\n      testcase( p->flags & MEM_Frame );\n      testcase( p->flags & MEM_RowSet );\n      if( p->flags&(MEM_Agg|MEM_Dyn|MEM_Frame|MEM_RowSet) ){\n        sqlite3VdbeMemRelease(p);\n      }else if( p->szMalloc ){\n        sqlite3DbFree(db, p->zMalloc);\n        p->szMalloc = 0;\n      }\n\n      p->flags = MEM_Undefined;\n    }while( (++p)<pEnd );\n  }\n}\n\n/*\n** Delete a VdbeFrame object and its contents. VdbeFrame objects are\n** allocated by the OP_Program opcode in sqlite3VdbeExec().\n*/\nvoid sqlite3VdbeFrameDelete(VdbeFrame *p){\n  int i;\n  Mem *aMem = VdbeFrameMem(p);\n  VdbeCursor **apCsr = (VdbeCursor **)&aMem[p->nChildMem];\n  for(i=0; i<p->nChildCsr; i++){\n    sqlite3VdbeFreeCursor(p->v, apCsr[i]);\n  }\n  releaseMemArray(aMem, p->nChildMem);\n  sqlite3VdbeDeleteAuxData(p->v->db, &p->pAuxData, -1, 0);\n  sqlite3DbFree(p->v->db, p);\n}\n\n#ifndef SQLITE_OMIT_EXPLAIN\n/*\n** Give a listing of the program in the virtual machine.\n**\n** The interface is the same as sqlite3VdbeExec().  But instead of\n** running the code, it invokes the callback once for each instruction.\n** This feature is used to implement \"EXPLAIN\".\n**\n** When p->explain==1, each instruction is listed.  When\n** p->explain==2, only OP_Explain instructions are listed and these\n** are shown in a different format.  p->explain==2 is used to implement\n** EXPLAIN QUERY PLAN.\n**\n** When p->explain==1, first the main program is listed, then each of\n** the trigger subprograms are listed one by one.\n*/\nint sqlite3VdbeList(\n  Vdbe *p                   /* The VDBE */\n){\n  int nRow;                            /* Stop when row count reaches this */\n  int nSub = 0;                        /* Number of sub-vdbes seen so far */\n  SubProgram **apSub = 0;              /* Array of sub-vdbes */\n  Mem *pSub = 0;                       /* Memory cell hold array of subprogs */\n  sqlite3 *db = p->db;                 /* The database connection */\n  int i;                               /* Loop counter */\n  int rc = SQLITE_OK;                  /* Return code */\n  Mem *pMem = &p->aMem[1];             /* First Mem of result set */\n\n  assert( p->explain );\n  assert( p->magic==VDBE_MAGIC_RUN );\n  assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );\n\n  /* Even though this opcode does not use dynamic strings for\n  ** the result, result columns may become dynamic if the user calls\n  ** sqlite3_column_text16(), causing a translation to UTF-16 encoding.\n  */\n  releaseMemArray(pMem, 8);\n  p->pResultSet = 0;\n\n  if( p->rc==SQLITE_NOMEM_BKPT ){\n    /* This happens if a malloc() inside a call to sqlite3_column_text() or\n    ** sqlite3_column_text16() failed.  */\n    sqlite3OomFault(db);\n    return SQLITE_ERROR;\n  }\n\n  /* When the number of output rows reaches nRow, that means the\n  ** listing has finished and sqlite3_step() should return SQLITE_DONE.\n  ** nRow is the sum of the number of rows in the main program, plus\n  ** the sum of the number of rows in all trigger subprograms encountered\n  ** so far.  The nRow value will increase as new trigger subprograms are\n  ** encountered, but p->pc will eventually catch up to nRow.\n  */\n  nRow = p->nOp;\n  if( p->explain==1 ){\n    /* The first 8 memory cells are used for the result set.  So we will\n    ** commandeer the 9th cell to use as storage for an array of pointers\n    ** to trigger subprograms.  The VDBE is guaranteed to have at least 9\n    ** cells.  */\n    assert( p->nMem>9 );\n    pSub = &p->aMem[9];\n    if( pSub->flags&MEM_Blob ){\n      /* On the first call to sqlite3_step(), pSub will hold a NULL.  It is\n      ** initialized to a BLOB by the P4_SUBPROGRAM processing logic below */\n      nSub = pSub->n/sizeof(Vdbe*);\n      apSub = (SubProgram **)pSub->z;\n    }\n    for(i=0; i<nSub; i++){\n      nRow += apSub[i]->nOp;\n    }\n  }\n\n  do{\n    i = p->pc++;\n  }while( i<nRow && p->explain==2 && p->aOp[i].opcode!=OP_Explain );\n  if( i>=nRow ){\n    p->rc = SQLITE_OK;\n    rc = SQLITE_DONE;\n  }else if( db->u1.isInterrupted ){\n    p->rc = SQLITE_INTERRUPT;\n    rc = SQLITE_ERROR;\n    sqlite3VdbeError(p, sqlite3ErrStr(p->rc));\n  }else{\n    char *zP4;\n    Op *pOp;\n    if( i<p->nOp ){\n      /* The output line number is small enough that we are still in the\n      ** main program. */\n      pOp = &p->aOp[i];\n    }else{\n      /* We are currently listing subprograms.  Figure out which one and\n      ** pick up the appropriate opcode. */\n      int j;\n      i -= p->nOp;\n      for(j=0; i>=apSub[j]->nOp; j++){\n        i -= apSub[j]->nOp;\n      }\n      pOp = &apSub[j]->aOp[i];\n    }\n    if( p->explain==1 ){\n      pMem->flags = MEM_Int;\n      pMem->u.i = i;                                /* Program counter */\n      pMem++;\n  \n      pMem->flags = MEM_Static|MEM_Str|MEM_Term;\n      pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */\n      assert( pMem->z!=0 );\n      pMem->n = sqlite3Strlen30(pMem->z);\n      pMem->enc = SQLITE_UTF8;\n      pMem++;\n\n      /* When an OP_Program opcode is encounter (the only opcode that has\n      ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms\n      ** kept in p->aMem[9].z to hold the new program - assuming this subprogram\n      ** has not already been seen.\n      */\n      if( pOp->p4type==P4_SUBPROGRAM ){\n        int nByte = (nSub+1)*sizeof(SubProgram*);\n        int j;\n        for(j=0; j<nSub; j++){\n          if( apSub[j]==pOp->p4.pProgram ) break;\n        }\n        if( j==nSub && SQLITE_OK==sqlite3VdbeMemGrow(pSub, nByte, nSub!=0) ){\n          apSub = (SubProgram **)pSub->z;\n          apSub[nSub++] = pOp->p4.pProgram;\n          pSub->flags |= MEM_Blob;\n          pSub->n = nSub*sizeof(SubProgram*);\n        }\n      }\n    }\n\n    pMem->flags = MEM_Int;\n    pMem->u.i = pOp->p1;                          /* P1 */\n    pMem++;\n\n    pMem->flags = MEM_Int;\n    pMem->u.i = pOp->p2;                          /* P2 */\n    pMem++;\n\n    pMem->flags = MEM_Int;\n    pMem->u.i = pOp->p3;                          /* P3 */\n    pMem++;\n\n    if( sqlite3VdbeMemClearAndResize(pMem, 100) ){ /* P4 */\n      assert( p->db->mallocFailed );\n      return SQLITE_ERROR;\n    }\n    pMem->flags = MEM_Str|MEM_Term;\n    zP4 = displayP4(pOp, pMem->z, pMem->szMalloc);\n    if( zP4!=pMem->z ){\n      pMem->n = 0;\n      sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0);\n    }else{\n      assert( pMem->z!=0 );\n      pMem->n = sqlite3Strlen30(pMem->z);\n      pMem->enc = SQLITE_UTF8;\n    }\n    pMem++;\n\n    if( p->explain==1 ){\n      if( sqlite3VdbeMemClearAndResize(pMem, 4) ){\n        assert( p->db->mallocFailed );\n        return SQLITE_ERROR;\n      }\n      pMem->flags = MEM_Str|MEM_Term;\n      pMem->n = 2;\n      sqlite3_snprintf(3, pMem->z, \"%.2x\", pOp->p5);   /* P5 */\n      pMem->enc = SQLITE_UTF8;\n      pMem++;\n  \n#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS\n      if( sqlite3VdbeMemClearAndResize(pMem, 500) ){\n        assert( p->db->mallocFailed );\n        return SQLITE_ERROR;\n      }\n      pMem->flags = MEM_Str|MEM_Term;\n      pMem->n = displayComment(pOp, zP4, pMem->z, 500);\n      pMem->enc = SQLITE_UTF8;\n#else\n      pMem->flags = MEM_Null;                       /* Comment */\n#endif\n    }\n\n    p->nResColumn = 8 - 4*(p->explain-1);\n    p->pResultSet = &p->aMem[1];\n    p->rc = SQLITE_OK;\n    rc = SQLITE_ROW;\n  }\n  return rc;\n}\n#endif /* SQLITE_OMIT_EXPLAIN */\n\n#ifdef SQLITE_DEBUG\n/*\n** Print the SQL that was used to generate a VDBE program.\n*/\nvoid sqlite3VdbePrintSql(Vdbe *p){\n  const char *z = 0;\n  if( p->zSql ){\n    z = p->zSql;\n  }else if( p->nOp>=1 ){\n    const VdbeOp *pOp = &p->aOp[0];\n    if( pOp->opcode==OP_Init && pOp->p4.z!=0 ){\n      z = pOp->p4.z;\n      while( sqlite3Isspace(*z) ) z++;\n    }\n  }\n  if( z ) printf(\"SQL: [%s]\\n\", z);\n}\n#endif\n\n#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)\n/*\n** Print an IOTRACE message showing SQL content.\n*/\nvoid sqlite3VdbeIOTraceSql(Vdbe *p){\n  int nOp = p->nOp;\n  VdbeOp *pOp;\n  if( sqlite3IoTrace==0 ) return;\n  if( nOp<1 ) return;\n  pOp = &p->aOp[0];\n  if( pOp->opcode==OP_Init && pOp->p4.z!=0 ){\n    int i, j;\n    char z[1000];\n    sqlite3_snprintf(sizeof(z), z, \"%s\", pOp->p4.z);\n    for(i=0; sqlite3Isspace(z[i]); i++){}\n    for(j=0; z[i]; i++){\n      if( sqlite3Isspace(z[i]) ){\n        if( z[i-1]!=' ' ){\n          z[j++] = ' ';\n        }\n      }else{\n        z[j++] = z[i];\n      }\n    }\n    z[j] = 0;\n    sqlite3IoTrace(\"SQL %s\\n\", z);\n  }\n}\n#endif /* !SQLITE_OMIT_TRACE && SQLITE_ENABLE_IOTRACE */\n\n/* An instance of this object describes bulk memory available for use\n** by subcomponents of a prepared statement.  Space is allocated out\n** of a ReusableSpace object by the allocSpace() routine below.\n*/\nstruct ReusableSpace {\n  u8 *pSpace;          /* Available memory */\n  int nFree;           /* Bytes of available memory */\n  int nNeeded;         /* Total bytes that could not be allocated */\n};\n\n/* Try to allocate nByte bytes of 8-byte aligned bulk memory for pBuf\n** from the ReusableSpace object.  Return a pointer to the allocated\n** memory on success.  If insufficient memory is available in the\n** ReusableSpace object, increase the ReusableSpace.nNeeded\n** value by the amount needed and return NULL.\n**\n** If pBuf is not initially NULL, that means that the memory has already\n** been allocated by a prior call to this routine, so just return a copy\n** of pBuf and leave ReusableSpace unchanged.\n**\n** This allocator is employed to repurpose unused slots at the end of the\n** opcode array of prepared state for other memory needs of the prepared\n** statement.\n*/\nstatic void *allocSpace(\n  struct ReusableSpace *p,  /* Bulk memory available for allocation */\n  void *pBuf,               /* Pointer to a prior allocation */\n  int nByte                 /* Bytes of memory needed */\n){\n  assert( EIGHT_BYTE_ALIGNMENT(p->pSpace) );\n  if( pBuf==0 ){\n    nByte = ROUND8(nByte);\n    if( nByte <= p->nFree ){\n      p->nFree -= nByte;\n      pBuf = &p->pSpace[p->nFree];\n    }else{\n      p->nNeeded += nByte;\n    }\n  }\n  assert( EIGHT_BYTE_ALIGNMENT(pBuf) );\n  return pBuf;\n}\n\n/*\n** Rewind the VDBE back to the beginning in preparation for\n** running it.\n*/\nvoid sqlite3VdbeRewind(Vdbe *p){\n#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)\n  int i;\n#endif\n  assert( p!=0 );\n  assert( p->magic==VDBE_MAGIC_INIT || p->magic==VDBE_MAGIC_RESET );\n\n  /* There should be at least one opcode.\n  */\n  assert( p->nOp>0 );\n\n  /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */\n  p->magic = VDBE_MAGIC_RUN;\n\n#ifdef SQLITE_DEBUG\n  for(i=0; i<p->nMem; i++){\n    assert( p->aMem[i].db==p->db );\n  }\n#endif\n  p->pc = -1;\n  p->rc = SQLITE_OK;\n  p->errorAction = OE_Abort;\n  p->nChange = 0;\n  p->cacheCtr = 1;\n  p->minWriteFileFormat = 255;\n  p->iStatement = 0;\n  p->nFkConstraint = 0;\n#ifdef VDBE_PROFILE\n  for(i=0; i<p->nOp; i++){\n    p->aOp[i].cnt = 0;\n    p->aOp[i].cycles = 0;\n  }\n#endif\n}\n\n/*\n** Prepare a virtual machine for execution for the first time after\n** creating the virtual machine.  This involves things such\n** as allocating registers and initializing the program counter.\n** After the VDBE has be prepped, it can be executed by one or more\n** calls to sqlite3VdbeExec().  \n**\n** This function may be called exactly once on each virtual machine.\n** After this routine is called the VM has been \"packaged\" and is ready\n** to run.  After this routine is called, further calls to \n** sqlite3VdbeAddOp() functions are prohibited.  This routine disconnects\n** the Vdbe from the Parse object that helped generate it so that the\n** the Vdbe becomes an independent entity and the Parse object can be\n** destroyed.\n**\n** Use the sqlite3VdbeRewind() procedure to restore a virtual machine back\n** to its initial state after it has been run.\n*/\nvoid sqlite3VdbeMakeReady(\n  Vdbe *p,                       /* The VDBE */\n  Parse *pParse                  /* Parsing context */\n){\n  sqlite3 *db;                   /* The database connection */\n  int nVar;                      /* Number of parameters */\n  int nMem;                      /* Number of VM memory registers */\n  int nCursor;                   /* Number of cursors required */\n  int nArg;                      /* Number of arguments in subprograms */\n  int n;                         /* Loop counter */\n  struct ReusableSpace x;        /* Reusable bulk memory */\n\n  assert( p!=0 );\n  assert( p->nOp>0 );\n  assert( pParse!=0 );\n  assert( p->magic==VDBE_MAGIC_INIT );\n  assert( pParse==p->pParse );\n  db = p->db;\n  assert( db->mallocFailed==0 );\n  nVar = pParse->nVar;\n  nMem = pParse->nMem;\n  nCursor = pParse->nTab;\n  nArg = pParse->nMaxArg;\n  \n  /* Each cursor uses a memory cell.  The first cursor (cursor 0) can\n  ** use aMem[0] which is not otherwise used by the VDBE program.  Allocate\n  ** space at the end of aMem[] for cursors 1 and greater.\n  ** See also: allocateCursor().\n  */\n  nMem += nCursor;\n  if( nCursor==0 && nMem>0 ) nMem++;  /* Space for aMem[0] even if not used */\n\n  /* Figure out how much reusable memory is available at the end of the\n  ** opcode array.  This extra memory will be reallocated for other elements\n  ** of the prepared statement.\n  */\n  n = ROUND8(sizeof(Op)*p->nOp);              /* Bytes of opcode memory used */\n  x.pSpace = &((u8*)p->aOp)[n];               /* Unused opcode memory */\n  assert( EIGHT_BYTE_ALIGNMENT(x.pSpace) );\n  x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n);  /* Bytes of unused memory */\n  assert( x.nFree>=0 );\n  assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) );\n\n  resolveP2Values(p, &nArg);\n  p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);\n  if( pParse->explain && nMem<10 ){\n    nMem = 10;\n  }\n  p->expired = 0;\n\n  /* Memory for registers, parameters, cursor, etc, is allocated in one or two\n  ** passes.  On the first pass, we try to reuse unused memory at the \n  ** end of the opcode array.  If we are unable to satisfy all memory\n  ** requirements by reusing the opcode array tail, then the second\n  ** pass will fill in the remainder using a fresh memory allocation.  \n  **\n  ** This two-pass approach that reuses as much memory as possible from\n  ** the leftover memory at the end of the opcode array.  This can significantly\n  ** reduce the amount of memory held by a prepared statement.\n  */\n  do {\n    x.nNeeded = 0;\n    p->aMem = allocSpace(&x, p->aMem, nMem*sizeof(Mem));\n    p->aVar = allocSpace(&x, p->aVar, nVar*sizeof(Mem));\n    p->apArg = allocSpace(&x, p->apArg, nArg*sizeof(Mem*));\n    p->apCsr = allocSpace(&x, p->apCsr, nCursor*sizeof(VdbeCursor*));\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n    p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));\n#endif\n    if( x.nNeeded==0 ) break;\n    x.pSpace = p->pFree = sqlite3DbMallocRawNN(db, x.nNeeded);\n    x.nFree = x.nNeeded;\n  }while( !db->mallocFailed );\n\n  p->nzVar = pParse->nzVar;\n  p->azVar = pParse->azVar;\n  pParse->nzVar =  0;\n  pParse->azVar = 0;\n  p->explain = pParse->explain;\n  if( db->mallocFailed ){\n    p->nVar = 0;\n    p->nCursor = 0;\n    p->nMem = 0;\n  }else{\n    p->nCursor = nCursor;\n    p->nVar = (ynVar)nVar;\n    initMemArray(p->aVar, nVar, db, MEM_Null);\n    p->nMem = nMem;\n    initMemArray(p->aMem, nMem, db, MEM_Undefined);\n    memset(p->apCsr, 0, nCursor*sizeof(VdbeCursor*));\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n    memset(p->anExec, 0, p->nOp*sizeof(i64));\n#endif\n  }\n  sqlite3VdbeRewind(p);\n}\n\n/*\n** Close a VDBE cursor and release all the resources that cursor \n** happens to hold.\n*/\nvoid sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){\n  if( pCx==0 ){\n    return;\n  }\n  assert( pCx->pBt==0 || pCx->eCurType==CURTYPE_BTREE );\n  switch( pCx->eCurType ){\n    case CURTYPE_SORTER: {\n      sqlite3VdbeSorterClose(p->db, pCx);\n      break;\n    }\n    case CURTYPE_BTREE: {\n      if( pCx->pBt ){\n        sqlite3BtreeClose(pCx->pBt);\n        /* The pCx->pCursor will be close automatically, if it exists, by\n        ** the call above. */\n      }else{\n        assert( pCx->uc.pCursor!=0 );\n        sqlite3BtreeCloseCursor(pCx->uc.pCursor);\n      }\n      break;\n    }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    case CURTYPE_VTAB: {\n      sqlite3_vtab_cursor *pVCur = pCx->uc.pVCur;\n      const sqlite3_module *pModule = pVCur->pVtab->pModule;\n      assert( pVCur->pVtab->nRef>0 );\n      pVCur->pVtab->nRef--;\n      pModule->xClose(pVCur);\n      break;\n    }\n#endif\n  }\n}\n\n/*\n** Close all cursors in the current frame.\n*/\nstatic void closeCursorsInFrame(Vdbe *p){\n  if( p->apCsr ){\n    int i;\n    for(i=0; i<p->nCursor; i++){\n      VdbeCursor *pC = p->apCsr[i];\n      if( pC ){\n        sqlite3VdbeFreeCursor(p, pC);\n        p->apCsr[i] = 0;\n      }\n    }\n  }\n}\n\n/*\n** Copy the values stored in the VdbeFrame structure to its Vdbe. This\n** is used, for example, when a trigger sub-program is halted to restore\n** control to the main program.\n*/\nint sqlite3VdbeFrameRestore(VdbeFrame *pFrame){\n  Vdbe *v = pFrame->v;\n  closeCursorsInFrame(v);\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n  v->anExec = pFrame->anExec;\n#endif\n  v->aOp = pFrame->aOp;\n  v->nOp = pFrame->nOp;\n  v->aMem = pFrame->aMem;\n  v->nMem = pFrame->nMem;\n  v->apCsr = pFrame->apCsr;\n  v->nCursor = pFrame->nCursor;\n  v->db->lastRowid = pFrame->lastRowid;\n  v->nChange = pFrame->nChange;\n  v->db->nChange = pFrame->nDbChange;\n  sqlite3VdbeDeleteAuxData(v->db, &v->pAuxData, -1, 0);\n  v->pAuxData = pFrame->pAuxData;\n  pFrame->pAuxData = 0;\n  return pFrame->pc;\n}\n\n/*\n** Close all cursors.\n**\n** Also release any dynamic memory held by the VM in the Vdbe.aMem memory \n** cell array. This is necessary as the memory cell array may contain\n** pointers to VdbeFrame objects, which may in turn contain pointers to\n** open cursors.\n*/\nstatic void closeAllCursors(Vdbe *p){\n  if( p->pFrame ){\n    VdbeFrame *pFrame;\n    for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);\n    sqlite3VdbeFrameRestore(pFrame);\n    p->pFrame = 0;\n    p->nFrame = 0;\n  }\n  assert( p->nFrame==0 );\n  closeCursorsInFrame(p);\n  if( p->aMem ){\n    releaseMemArray(p->aMem, p->nMem);\n  }\n  while( p->pDelFrame ){\n    VdbeFrame *pDel = p->pDelFrame;\n    p->pDelFrame = pDel->pParent;\n    sqlite3VdbeFrameDelete(pDel);\n  }\n\n  /* Delete any auxdata allocations made by the VM */\n  if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p->db, &p->pAuxData, -1, 0);\n  assert( p->pAuxData==0 );\n}\n\n/*\n** Clean up the VM after a single run.\n*/\nstatic void Cleanup(Vdbe *p){\n  sqlite3 *db = p->db;\n\n#ifdef SQLITE_DEBUG\n  /* Execute assert() statements to ensure that the Vdbe.apCsr[] and \n  ** Vdbe.aMem[] arrays have already been cleaned up.  */\n  int i;\n  if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );\n  if( p->aMem ){\n    for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );\n  }\n#endif\n\n  sqlite3DbFree(db, p->zErrMsg);\n  p->zErrMsg = 0;\n  p->pResultSet = 0;\n}\n\n/*\n** Set the number of result columns that will be returned by this SQL\n** statement. This is now set at compile time, rather than during\n** execution of the vdbe program so that sqlite3_column_count() can\n** be called on an SQL statement before sqlite3_step().\n*/\nvoid sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){\n  Mem *pColName;\n  int n;\n  sqlite3 *db = p->db;\n\n  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);\n  sqlite3DbFree(db, p->aColName);\n  n = nResColumn*COLNAME_N;\n  p->nResColumn = (u16)nResColumn;\n  p->aColName = pColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );\n  if( p->aColName==0 ) return;\n  initMemArray(p->aColName, n, p->db, MEM_Null);\n}\n\n/*\n** Set the name of the idx'th column to be returned by the SQL statement.\n** zName must be a pointer to a nul terminated string.\n**\n** This call must be made after a call to sqlite3VdbeSetNumCols().\n**\n** The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC\n** or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed\n** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed.\n*/\nint sqlite3VdbeSetColName(\n  Vdbe *p,                         /* Vdbe being configured */\n  int idx,                         /* Index of column zName applies to */\n  int var,                         /* One of the COLNAME_* constants */\n  const char *zName,               /* Pointer to buffer containing name */\n  void (*xDel)(void*)              /* Memory management strategy for zName */\n){\n  int rc;\n  Mem *pColName;\n  assert( idx<p->nResColumn );\n  assert( var<COLNAME_N );\n  if( p->db->mallocFailed ){\n    assert( !zName || xDel!=SQLITE_DYNAMIC );\n    return SQLITE_NOMEM_BKPT;\n  }\n  assert( p->aColName!=0 );\n  pColName = &(p->aColName[idx+var*p->nResColumn]);\n  rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel);\n  assert( rc!=0 || !zName || (pColName->flags&MEM_Term)!=0 );\n  return rc;\n}\n\n/*\n** A read or write transaction may or may not be active on database handle\n** db. If a transaction is active, commit it. If there is a\n** write-transaction spanning more than one database file, this routine\n** takes care of the master journal trickery.\n*/\nstatic int vdbeCommit(sqlite3 *db, Vdbe *p){\n  int i;\n  int nTrans = 0;  /* Number of databases with an active write-transaction\n                   ** that are candidates for a two-phase commit using a\n                   ** master-journal */\n  int rc = SQLITE_OK;\n  int needXcommit = 0;\n\n#ifdef SQLITE_OMIT_VIRTUALTABLE\n  /* With this option, sqlite3VtabSync() is defined to be simply \n  ** SQLITE_OK so p is not used. \n  */\n  UNUSED_PARAMETER(p);\n#endif\n\n  /* Before doing anything else, call the xSync() callback for any\n  ** virtual module tables written in this transaction. This has to\n  ** be done before determining whether a master journal file is \n  ** required, as an xSync() callback may add an attached database\n  ** to the transaction.\n  */\n  rc = sqlite3VtabSync(db, p);\n\n  /* This loop determines (a) if the commit hook should be invoked and\n  ** (b) how many database files have open write transactions, not \n  ** including the temp database. (b) is important because if more than \n  ** one database file has an open write transaction, a master journal\n  ** file is required for an atomic commit.\n  */ \n  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ \n    Btree *pBt = db->aDb[i].pBt;\n    if( sqlite3BtreeIsInTrans(pBt) ){\n      /* Whether or not a database might need a master journal depends upon\n      ** its journal mode (among other things).  This matrix determines which\n      ** journal modes use a master journal and which do not */\n      static const u8 aMJNeeded[] = {\n        /* DELETE   */  1,\n        /* PERSIST   */ 1,\n        /* OFF       */ 0,\n        /* TRUNCATE  */ 1,\n        /* MEMORY    */ 0,\n        /* WAL       */ 0\n      };\n      Pager *pPager;   /* Pager associated with pBt */\n      needXcommit = 1;\n      sqlite3BtreeEnter(pBt);\n      pPager = sqlite3BtreePager(pBt);\n      if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF\n       && aMJNeeded[sqlite3PagerGetJournalMode(pPager)]\n      ){ \n        assert( i!=1 );\n        nTrans++;\n      }\n      rc = sqlite3PagerExclusiveLock(pPager);\n      sqlite3BtreeLeave(pBt);\n    }\n  }\n  if( rc!=SQLITE_OK ){\n    return rc;\n  }\n\n  /* If there are any write-transactions at all, invoke the commit hook */\n  if( needXcommit && db->xCommitCallback ){\n    rc = db->xCommitCallback(db->pCommitArg);\n    if( rc ){\n      return SQLITE_CONSTRAINT_COMMITHOOK;\n    }\n  }\n\n  /* The simple case - no more than one database file (not counting the\n  ** TEMP database) has a transaction active.   There is no need for the\n  ** master-journal.\n  **\n  ** If the return value of sqlite3BtreeGetFilename() is a zero length\n  ** string, it means the main database is :memory: or a temp file.  In \n  ** that case we do not support atomic multi-file commits, so use the \n  ** simple case then too.\n  */\n  if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt))\n   || nTrans<=1\n  ){\n    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){\n      Btree *pBt = db->aDb[i].pBt;\n      if( pBt ){\n        rc = sqlite3BtreeCommitPhaseOne(pBt, 0);\n      }\n    }\n\n    /* Do the commit only if all databases successfully complete phase 1. \n    ** If one of the BtreeCommitPhaseOne() calls fails, this indicates an\n    ** IO error while deleting or truncating a journal file. It is unlikely,\n    ** but could happen. In this case abandon processing and return the error.\n    */\n    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){\n      Btree *pBt = db->aDb[i].pBt;\n      if( pBt ){\n        rc = sqlite3BtreeCommitPhaseTwo(pBt, 0);\n      }\n    }\n    if( rc==SQLITE_OK ){\n      sqlite3VtabCommit(db);\n    }\n  }\n\n  /* The complex case - There is a multi-file write-transaction active.\n  ** This requires a master journal file to ensure the transaction is\n  ** committed atomically.\n  */\n#ifndef SQLITE_OMIT_DISKIO\n  else{\n    sqlite3_vfs *pVfs = db->pVfs;\n    char *zMaster = 0;   /* File-name for the master journal */\n    char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt);\n    sqlite3_file *pMaster = 0;\n    i64 offset = 0;\n    int res;\n    int retryCount = 0;\n    int nMainFile;\n\n    /* Select a master journal file name */\n    nMainFile = sqlite3Strlen30(zMainFile);\n    zMaster = sqlite3MPrintf(db, \"%s-mjXXXXXX9XXz\", zMainFile);\n    if( zMaster==0 ) return SQLITE_NOMEM_BKPT;\n    do {\n      u32 iRandom;\n      if( retryCount ){\n        if( retryCount>100 ){\n          sqlite3_log(SQLITE_FULL, \"MJ delete: %s\", zMaster);\n          sqlite3OsDelete(pVfs, zMaster, 0);\n          break;\n        }else if( retryCount==1 ){\n          sqlite3_log(SQLITE_FULL, \"MJ collide: %s\", zMaster);\n        }\n      }\n      retryCount++;\n      sqlite3_randomness(sizeof(iRandom), &iRandom);\n      sqlite3_snprintf(13, &zMaster[nMainFile], \"-mj%06X9%02X\",\n                               (iRandom>>8)&0xffffff, iRandom&0xff);\n      /* The antipenultimate character of the master journal name must\n      ** be \"9\" to avoid name collisions when using 8+3 filenames. */\n      assert( zMaster[sqlite3Strlen30(zMaster)-3]=='9' );\n      sqlite3FileSuffix3(zMainFile, zMaster);\n      rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res);\n    }while( rc==SQLITE_OK && res );\n    if( rc==SQLITE_OK ){\n      /* Open the master journal. */\n      rc = sqlite3OsOpenMalloc(pVfs, zMaster, &pMaster, \n          SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|\n          SQLITE_OPEN_EXCLUSIVE|SQLITE_OPEN_MASTER_JOURNAL, 0\n      );\n    }\n    if( rc!=SQLITE_OK ){\n      sqlite3DbFree(db, zMaster);\n      return rc;\n    }\n \n    /* Write the name of each database file in the transaction into the new\n    ** master journal file. If an error occurs at this point close\n    ** and delete the master journal file. All the individual journal files\n    ** still have 'null' as the master journal pointer, so they will roll\n    ** back independently if a failure occurs.\n    */\n    for(i=0; i<db->nDb; i++){\n      Btree *pBt = db->aDb[i].pBt;\n      if( sqlite3BtreeIsInTrans(pBt) ){\n        char const *zFile = sqlite3BtreeGetJournalname(pBt);\n        if( zFile==0 ){\n          continue;  /* Ignore TEMP and :memory: databases */\n        }\n        assert( zFile[0]!=0 );\n        rc = sqlite3OsWrite(pMaster, zFile, sqlite3Strlen30(zFile)+1, offset);\n        offset += sqlite3Strlen30(zFile)+1;\n        if( rc!=SQLITE_OK ){\n          sqlite3OsCloseFree(pMaster);\n          sqlite3OsDelete(pVfs, zMaster, 0);\n          sqlite3DbFree(db, zMaster);\n          return rc;\n        }\n      }\n    }\n\n    /* Sync the master journal file. If the IOCAP_SEQUENTIAL device\n    ** flag is set this is not required.\n    */\n    if( 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL)\n     && SQLITE_OK!=(rc = sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL))\n    ){\n      sqlite3OsCloseFree(pMaster);\n      sqlite3OsDelete(pVfs, zMaster, 0);\n      sqlite3DbFree(db, zMaster);\n      return rc;\n    }\n\n    /* Sync all the db files involved in the transaction. The same call\n    ** sets the master journal pointer in each individual journal. If\n    ** an error occurs here, do not delete the master journal file.\n    **\n    ** If the error occurs during the first call to\n    ** sqlite3BtreeCommitPhaseOne(), then there is a chance that the\n    ** master journal file will be orphaned. But we cannot delete it,\n    ** in case the master journal file name was written into the journal\n    ** file before the failure occurred.\n    */\n    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ \n      Btree *pBt = db->aDb[i].pBt;\n      if( pBt ){\n        rc = sqlite3BtreeCommitPhaseOne(pBt, zMaster);\n      }\n    }\n    sqlite3OsCloseFree(pMaster);\n    assert( rc!=SQLITE_BUSY );\n    if( rc!=SQLITE_OK ){\n      sqlite3DbFree(db, zMaster);\n      return rc;\n    }\n\n    /* Delete the master journal file. This commits the transaction. After\n    ** doing this the directory is synced again before any individual\n    ** transaction files are deleted.\n    */\n    rc = sqlite3OsDelete(pVfs, zMaster, 1);\n    sqlite3DbFree(db, zMaster);\n    zMaster = 0;\n    if( rc ){\n      return rc;\n    }\n\n    /* All files and directories have already been synced, so the following\n    ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and\n    ** deleting or truncating journals. If something goes wrong while\n    ** this is happening we don't really care. The integrity of the\n    ** transaction is already guaranteed, but some stray 'cold' journals\n    ** may be lying around. Returning an error code won't help matters.\n    */\n    disable_simulated_io_errors();\n    sqlite3BeginBenignMalloc();\n    for(i=0; i<db->nDb; i++){ \n      Btree *pBt = db->aDb[i].pBt;\n      if( pBt ){\n        sqlite3BtreeCommitPhaseTwo(pBt, 1);\n      }\n    }\n    sqlite3EndBenignMalloc();\n    enable_simulated_io_errors();\n\n    sqlite3VtabCommit(db);\n  }\n#endif\n\n  return rc;\n}\n\n/* \n** This routine checks that the sqlite3.nVdbeActive count variable\n** matches the number of vdbe's in the list sqlite3.pVdbe that are\n** currently active. An assertion fails if the two counts do not match.\n** This is an internal self-check only - it is not an essential processing\n** step.\n**\n** This is a no-op if NDEBUG is defined.\n*/\n#ifndef NDEBUG\nstatic void checkActiveVdbeCnt(sqlite3 *db){\n  Vdbe *p;\n  int cnt = 0;\n  int nWrite = 0;\n  int nRead = 0;\n  p = db->pVdbe;\n  while( p ){\n    if( sqlite3_stmt_busy((sqlite3_stmt*)p) ){\n      cnt++;\n      if( p->readOnly==0 ) nWrite++;\n      if( p->bIsReader ) nRead++;\n    }\n    p = p->pNext;\n  }\n  assert( cnt==db->nVdbeActive );\n  assert( nWrite==db->nVdbeWrite );\n  assert( nRead==db->nVdbeRead );\n}\n#else\n#define checkActiveVdbeCnt(x)\n#endif\n\n/*\n** If the Vdbe passed as the first argument opened a statement-transaction,\n** close it now. Argument eOp must be either SAVEPOINT_ROLLBACK or\n** SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement\n** transaction is rolled back. If eOp is SAVEPOINT_RELEASE, then the \n** statement transaction is committed.\n**\n** If an IO error occurs, an SQLITE_IOERR_XXX error code is returned. \n** Otherwise SQLITE_OK.\n*/\nint sqlite3VdbeCloseStatement(Vdbe *p, int eOp){\n  sqlite3 *const db = p->db;\n  int rc = SQLITE_OK;\n\n  /* If p->iStatement is greater than zero, then this Vdbe opened a \n  ** statement transaction that should be closed here. The only exception\n  ** is that an IO error may have occurred, causing an emergency rollback.\n  ** In this case (db->nStatement==0), and there is nothing to do.\n  */\n  if( db->nStatement && p->iStatement ){\n    int i;\n    const int iSavepoint = p->iStatement-1;\n\n    assert( eOp==SAVEPOINT_ROLLBACK || eOp==SAVEPOINT_RELEASE);\n    assert( db->nStatement>0 );\n    assert( p->iStatement==(db->nStatement+db->nSavepoint) );\n\n    for(i=0; i<db->nDb; i++){ \n      int rc2 = SQLITE_OK;\n      Btree *pBt = db->aDb[i].pBt;\n      if( pBt ){\n        if( eOp==SAVEPOINT_ROLLBACK ){\n          rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint);\n        }\n        if( rc2==SQLITE_OK ){\n          rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint);\n        }\n        if( rc==SQLITE_OK ){\n          rc = rc2;\n        }\n      }\n    }\n    db->nStatement--;\n    p->iStatement = 0;\n\n    if( rc==SQLITE_OK ){\n      if( eOp==SAVEPOINT_ROLLBACK ){\n        rc = sqlite3VtabSavepoint(db, SAVEPOINT_ROLLBACK, iSavepoint);\n      }\n      if( rc==SQLITE_OK ){\n        rc = sqlite3VtabSavepoint(db, SAVEPOINT_RELEASE, iSavepoint);\n      }\n    }\n\n    /* If the statement transaction is being rolled back, also restore the \n    ** database handles deferred constraint counter to the value it had when \n    ** the statement transaction was opened.  */\n    if( eOp==SAVEPOINT_ROLLBACK ){\n      db->nDeferredCons = p->nStmtDefCons;\n      db->nDeferredImmCons = p->nStmtDefImmCons;\n    }\n  }\n  return rc;\n}\n\n/*\n** This function is called when a transaction opened by the database \n** handle associated with the VM passed as an argument is about to be \n** committed. If there are outstanding deferred foreign key constraint\n** violations, return SQLITE_ERROR. Otherwise, SQLITE_OK.\n**\n** If there are outstanding FK violations and this function returns \n** SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY\n** and write an error message to it. Then return SQLITE_ERROR.\n*/\n#ifndef SQLITE_OMIT_FOREIGN_KEY\nint sqlite3VdbeCheckFk(Vdbe *p, int deferred){\n  sqlite3 *db = p->db;\n  if( (deferred && (db->nDeferredCons+db->nDeferredImmCons)>0) \n   || (!deferred && p->nFkConstraint>0) \n  ){\n    p->rc = SQLITE_CONSTRAINT_FOREIGNKEY;\n    p->errorAction = OE_Abort;\n    sqlite3VdbeError(p, \"FOREIGN KEY constraint failed\");\n    return SQLITE_ERROR;\n  }\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** This routine is called the when a VDBE tries to halt.  If the VDBE\n** has made changes and is in autocommit mode, then commit those\n** changes.  If a rollback is needed, then do the rollback.\n**\n** This routine is the only way to move the state of a VM from\n** SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT.  It is harmless to\n** call this on a VM that is in the SQLITE_MAGIC_HALT state.\n**\n** Return an error code.  If the commit could not complete because of\n** lock contention, return SQLITE_BUSY.  If SQLITE_BUSY is returned, it\n** means the close did not happen and needs to be repeated.\n*/\nint sqlite3VdbeHalt(Vdbe *p){\n  int rc;                         /* Used to store transient return codes */\n  sqlite3 *db = p->db;\n\n  /* This function contains the logic that determines if a statement or\n  ** transaction will be committed or rolled back as a result of the\n  ** execution of this virtual machine. \n  **\n  ** If any of the following errors occur:\n  **\n  **     SQLITE_NOMEM\n  **     SQLITE_IOERR\n  **     SQLITE_FULL\n  **     SQLITE_INTERRUPT\n  **\n  ** Then the internal cache might have been left in an inconsistent\n  ** state.  We need to rollback the statement transaction, if there is\n  ** one, or the complete transaction if there is no statement transaction.\n  */\n\n  if( db->mallocFailed ){\n    p->rc = SQLITE_NOMEM_BKPT;\n  }\n  closeAllCursors(p);\n  if( p->magic!=VDBE_MAGIC_RUN ){\n    return SQLITE_OK;\n  }\n  checkActiveVdbeCnt(db);\n\n  /* No commit or rollback needed if the program never started or if the\n  ** SQL statement does not read or write a database file.  */\n  if( p->pc>=0 && p->bIsReader ){\n    int mrc;   /* Primary error code from p->rc */\n    int eStatementOp = 0;\n    int isSpecialError;            /* Set to true if a 'special' error */\n\n    /* Lock all btrees used by the statement */\n    sqlite3VdbeEnter(p);\n\n    /* Check for one of the special errors */\n    mrc = p->rc & 0xff;\n    isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR\n                     || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;\n    if( isSpecialError ){\n      /* If the query was read-only and the error code is SQLITE_INTERRUPT, \n      ** no rollback is necessary. Otherwise, at least a savepoint \n      ** transaction must be rolled back to restore the database to a \n      ** consistent state.\n      **\n      ** Even if the statement is read-only, it is important to perform\n      ** a statement or transaction rollback operation. If the error \n      ** occurred while writing to the journal, sub-journal or database\n      ** file as part of an effort to free up cache space (see function\n      ** pagerStress() in pager.c), the rollback is required to restore \n      ** the pager to a consistent state.\n      */\n      if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){\n        if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){\n          eStatementOp = SAVEPOINT_ROLLBACK;\n        }else{\n          /* We are forced to roll back the active transaction. Before doing\n          ** so, abort any other statements this handle currently has active.\n          */\n          sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\n          sqlite3CloseSavepoints(db);\n          db->autoCommit = 1;\n          p->nChange = 0;\n        }\n      }\n    }\n\n    /* Check for immediate foreign key violations. */\n    if( p->rc==SQLITE_OK ){\n      sqlite3VdbeCheckFk(p, 0);\n    }\n  \n    /* If the auto-commit flag is set and this is the only active writer \n    ** VM, then we do either a commit or rollback of the current transaction. \n    **\n    ** Note: This block also runs if one of the special errors handled \n    ** above has occurred. \n    */\n    if( !sqlite3VtabInSync(db) \n     && db->autoCommit \n     && db->nVdbeWrite==(p->readOnly==0) \n    ){\n      if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){\n        rc = sqlite3VdbeCheckFk(p, 1);\n        if( rc!=SQLITE_OK ){\n          if( NEVER(p->readOnly) ){\n            sqlite3VdbeLeave(p);\n            return SQLITE_ERROR;\n          }\n          rc = SQLITE_CONSTRAINT_FOREIGNKEY;\n        }else{ \n          /* The auto-commit flag is true, the vdbe program was successful \n          ** or hit an 'OR FAIL' constraint and there are no deferred foreign\n          ** key constraints to hold up the transaction. This means a commit \n          ** is required. */\n          rc = vdbeCommit(db, p);\n        }\n        if( rc==SQLITE_BUSY && p->readOnly ){\n          sqlite3VdbeLeave(p);\n          return SQLITE_BUSY;\n        }else if( rc!=SQLITE_OK ){\n          p->rc = rc;\n          sqlite3RollbackAll(db, SQLITE_OK);\n          p->nChange = 0;\n        }else{\n          db->nDeferredCons = 0;\n          db->nDeferredImmCons = 0;\n          db->flags &= ~SQLITE_DeferFKs;\n          sqlite3CommitInternalChanges(db);\n        }\n      }else{\n        sqlite3RollbackAll(db, SQLITE_OK);\n        p->nChange = 0;\n      }\n      db->nStatement = 0;\n    }else if( eStatementOp==0 ){\n      if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){\n        eStatementOp = SAVEPOINT_RELEASE;\n      }else if( p->errorAction==OE_Abort ){\n        eStatementOp = SAVEPOINT_ROLLBACK;\n      }else{\n        sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\n        sqlite3CloseSavepoints(db);\n        db->autoCommit = 1;\n        p->nChange = 0;\n      }\n    }\n  \n    /* If eStatementOp is non-zero, then a statement transaction needs to\n    ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to\n    ** do so. If this operation returns an error, and the current statement\n    ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the\n    ** current statement error code.\n    */\n    if( eStatementOp ){\n      rc = sqlite3VdbeCloseStatement(p, eStatementOp);\n      if( rc ){\n        if( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ){\n          p->rc = rc;\n          sqlite3DbFree(db, p->zErrMsg);\n          p->zErrMsg = 0;\n        }\n        sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);\n        sqlite3CloseSavepoints(db);\n        db->autoCommit = 1;\n        p->nChange = 0;\n      }\n    }\n  \n    /* If this was an INSERT, UPDATE or DELETE and no statement transaction\n    ** has been rolled back, update the database connection change-counter. \n    */\n    if( p->changeCntOn ){\n      if( eStatementOp!=SAVEPOINT_ROLLBACK ){\n        sqlite3VdbeSetChanges(db, p->nChange);\n      }else{\n        sqlite3VdbeSetChanges(db, 0);\n      }\n      p->nChange = 0;\n    }\n\n    /* Release the locks */\n    sqlite3VdbeLeave(p);\n  }\n\n  /* We have successfully halted and closed the VM.  Record this fact. */\n  if( p->pc>=0 ){\n    db->nVdbeActive--;\n    if( !p->readOnly ) db->nVdbeWrite--;\n    if( p->bIsReader ) db->nVdbeRead--;\n    assert( db->nVdbeActive>=db->nVdbeRead );\n    assert( db->nVdbeRead>=db->nVdbeWrite );\n    assert( db->nVdbeWrite>=0 );\n  }\n  p->magic = VDBE_MAGIC_HALT;\n  checkActiveVdbeCnt(db);\n  if( db->mallocFailed ){\n    p->rc = SQLITE_NOMEM_BKPT;\n  }\n\n  /* If the auto-commit flag is set to true, then any locks that were held\n  ** by connection db have now been released. Call sqlite3ConnectionUnlocked() \n  ** to invoke any required unlock-notify callbacks.\n  */\n  if( db->autoCommit ){\n    sqlite3ConnectionUnlocked(db);\n  }\n\n  assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 );\n  return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);\n}\n\n\n/*\n** Each VDBE holds the result of the most recent sqlite3_step() call\n** in p->rc.  This routine sets that result back to SQLITE_OK.\n*/\nvoid sqlite3VdbeResetStepResult(Vdbe *p){\n  p->rc = SQLITE_OK;\n}\n\n/*\n** Copy the error code and error message belonging to the VDBE passed\n** as the first argument to its database handle (so that they will be \n** returned by calls to sqlite3_errcode() and sqlite3_errmsg()).\n**\n** This function does not clear the VDBE error code or message, just\n** copies them to the database handle.\n*/\nint sqlite3VdbeTransferError(Vdbe *p){\n  sqlite3 *db = p->db;\n  int rc = p->rc;\n  if( p->zErrMsg ){\n    db->bBenignMalloc++;\n    sqlite3BeginBenignMalloc();\n    if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db);\n    sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);\n    sqlite3EndBenignMalloc();\n    db->bBenignMalloc--;\n    db->errCode = rc;\n  }else{\n    sqlite3Error(db, rc);\n  }\n  return rc;\n}\n\n#ifdef SQLITE_ENABLE_SQLLOG\n/*\n** If an SQLITE_CONFIG_SQLLOG hook is registered and the VM has been run, \n** invoke it.\n*/\nstatic void vdbeInvokeSqllog(Vdbe *v){\n  if( sqlite3GlobalConfig.xSqllog && v->rc==SQLITE_OK && v->zSql && v->pc>=0 ){\n    char *zExpanded = sqlite3VdbeExpandSql(v, v->zSql);\n    assert( v->db->init.busy==0 );\n    if( zExpanded ){\n      sqlite3GlobalConfig.xSqllog(\n          sqlite3GlobalConfig.pSqllogArg, v->db, zExpanded, 1\n      );\n      sqlite3DbFree(v->db, zExpanded);\n    }\n  }\n}\n#else\n# define vdbeInvokeSqllog(x)\n#endif\n\n/*\n** Clean up a VDBE after execution but do not delete the VDBE just yet.\n** Write any error messages into *pzErrMsg.  Return the result code.\n**\n** After this routine is run, the VDBE should be ready to be executed\n** again.\n**\n** To look at it another way, this routine resets the state of the\n** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to\n** VDBE_MAGIC_INIT.\n*/\nint sqlite3VdbeReset(Vdbe *p){\n  sqlite3 *db;\n  db = p->db;\n\n  /* If the VM did not run to completion or if it encountered an\n  ** error, then it might not have been halted properly.  So halt\n  ** it now.\n  */\n  sqlite3VdbeHalt(p);\n\n  /* If the VDBE has be run even partially, then transfer the error code\n  ** and error message from the VDBE into the main database structure.  But\n  ** if the VDBE has just been set to run but has not actually executed any\n  ** instructions yet, leave the main database error information unchanged.\n  */\n  if( p->pc>=0 ){\n    vdbeInvokeSqllog(p);\n    sqlite3VdbeTransferError(p);\n    sqlite3DbFree(db, p->zErrMsg);\n    p->zErrMsg = 0;\n    if( p->runOnlyOnce ) p->expired = 1;\n  }else if( p->rc && p->expired ){\n    /* The expired flag was set on the VDBE before the first call\n    ** to sqlite3_step(). For consistency (since sqlite3_step() was\n    ** called), set the database error in this case as well.\n    */\n    sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? \"%s\" : 0, p->zErrMsg);\n    sqlite3DbFree(db, p->zErrMsg);\n    p->zErrMsg = 0;\n  }\n\n  /* Reclaim all memory used by the VDBE\n  */\n  Cleanup(p);\n\n  /* Save profiling information from this VDBE run.\n  */\n#ifdef VDBE_PROFILE\n  {\n    FILE *out = fopen(\"vdbe_profile.out\", \"a\");\n    if( out ){\n      int i;\n      fprintf(out, \"---- \");\n      for(i=0; i<p->nOp; i++){\n        fprintf(out, \"%02x\", p->aOp[i].opcode);\n      }\n      fprintf(out, \"\\n\");\n      if( p->zSql ){\n        char c, pc = 0;\n        fprintf(out, \"-- \");\n        for(i=0; (c = p->zSql[i])!=0; i++){\n          if( pc=='\\n' ) fprintf(out, \"-- \");\n          putc(c, out);\n          pc = c;\n        }\n        if( pc!='\\n' ) fprintf(out, \"\\n\");\n      }\n      for(i=0; i<p->nOp; i++){\n        char zHdr[100];\n        sqlite3_snprintf(sizeof(zHdr), zHdr, \"%6u %12llu %8llu \",\n           p->aOp[i].cnt,\n           p->aOp[i].cycles,\n           p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0\n        );\n        fprintf(out, \"%s\", zHdr);\n        sqlite3VdbePrintOp(out, i, &p->aOp[i]);\n      }\n      fclose(out);\n    }\n  }\n#endif\n  p->iCurrentTime = 0;\n  p->magic = VDBE_MAGIC_RESET;\n  return p->rc & db->errMask;\n}\n \n/*\n** Clean up and delete a VDBE after execution.  Return an integer which is\n** the result code.  Write any error message text into *pzErrMsg.\n*/\nint sqlite3VdbeFinalize(Vdbe *p){\n  int rc = SQLITE_OK;\n  if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){\n    rc = sqlite3VdbeReset(p);\n    assert( (rc & p->db->errMask)==rc );\n  }\n  sqlite3VdbeDelete(p);\n  return rc;\n}\n\n/*\n** If parameter iOp is less than zero, then invoke the destructor for\n** all auxiliary data pointers currently cached by the VM passed as\n** the first argument.\n**\n** Or, if iOp is greater than or equal to zero, then the destructor is\n** only invoked for those auxiliary data pointers created by the user \n** function invoked by the OP_Function opcode at instruction iOp of \n** VM pVdbe, and only then if:\n**\n**    * the associated function parameter is the 32nd or later (counting\n**      from left to right), or\n**\n**    * the corresponding bit in argument mask is clear (where the first\n**      function parameter corresponds to bit 0 etc.).\n*/\nvoid sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, int iOp, int mask){\n  while( *pp ){\n    AuxData *pAux = *pp;\n    if( (iOp<0)\n     || (pAux->iOp==iOp && (pAux->iArg>31 || !(mask & MASKBIT32(pAux->iArg))))\n    ){\n      testcase( pAux->iArg==31 );\n      if( pAux->xDelete ){\n        pAux->xDelete(pAux->pAux);\n      }\n      *pp = pAux->pNext;\n      sqlite3DbFree(db, pAux);\n    }else{\n      pp= &pAux->pNext;\n    }\n  }\n}\n\n/*\n** Free all memory associated with the Vdbe passed as the second argument,\n** except for object itself, which is preserved.\n**\n** The difference between this function and sqlite3VdbeDelete() is that\n** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with\n** the database connection and frees the object itself.\n*/\nvoid sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){\n  SubProgram *pSub, *pNext;\n  int i;\n  assert( p->db==0 || p->db==db );\n  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);\n  for(pSub=p->pProgram; pSub; pSub=pNext){\n    pNext = pSub->pNext;\n    vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);\n    sqlite3DbFree(db, pSub);\n  }\n  if( p->magic!=VDBE_MAGIC_INIT ){\n    releaseMemArray(p->aVar, p->nVar);\n    for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]);\n    sqlite3DbFree(db, p->azVar);\n    sqlite3DbFree(db, p->pFree);\n  }\n  vdbeFreeOpArray(db, p->aOp, p->nOp);\n  sqlite3DbFree(db, p->aColName);\n  sqlite3DbFree(db, p->zSql);\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n  for(i=0; i<p->nScan; i++){\n    sqlite3DbFree(db, p->aScan[i].zName);\n  }\n  sqlite3DbFree(db, p->aScan);\n#endif\n}\n\n/*\n** Delete an entire VDBE.\n*/\nvoid sqlite3VdbeDelete(Vdbe *p){\n  sqlite3 *db;\n\n  if( NEVER(p==0) ) return;\n  db = p->db;\n  assert( sqlite3_mutex_held(db->mutex) );\n  sqlite3VdbeClearObject(db, p);\n  if( p->pPrev ){\n    p->pPrev->pNext = p->pNext;\n  }else{\n    assert( db->pVdbe==p );\n    db->pVdbe = p->pNext;\n  }\n  if( p->pNext ){\n    p->pNext->pPrev = p->pPrev;\n  }\n  p->magic = VDBE_MAGIC_DEAD;\n  p->db = 0;\n  sqlite3DbFree(db, p);\n}\n\n/*\n** The cursor \"p\" has a pending seek operation that has not yet been\n** carried out.  Seek the cursor now.  If an error occurs, return\n** the appropriate error code.\n*/\nstatic int SQLITE_NOINLINE handleDeferredMoveto(VdbeCursor *p){\n  int res, rc;\n#ifdef SQLITE_TEST\n  extern int sqlite3_search_count;\n#endif\n  assert( p->deferredMoveto );\n  assert( p->isTable );\n  assert( p->eCurType==CURTYPE_BTREE );\n  rc = sqlite3BtreeMovetoUnpacked(p->uc.pCursor, 0, p->movetoTarget, 0, &res);\n  if( rc ) return rc;\n  if( res!=0 ) return SQLITE_CORRUPT_BKPT;\n#ifdef SQLITE_TEST\n  sqlite3_search_count++;\n#endif\n  p->deferredMoveto = 0;\n  p->cacheStatus = CACHE_STALE;\n  return SQLITE_OK;\n}\n\n/*\n** Something has moved cursor \"p\" out of place.  Maybe the row it was\n** pointed to was deleted out from under it.  Or maybe the btree was\n** rebalanced.  Whatever the cause, try to restore \"p\" to the place it\n** is supposed to be pointing.  If the row was deleted out from under the\n** cursor, set the cursor to point to a NULL row.\n*/\nstatic int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){\n  int isDifferentRow, rc;\n  assert( p->eCurType==CURTYPE_BTREE );\n  assert( p->uc.pCursor!=0 );\n  assert( sqlite3BtreeCursorHasMoved(p->uc.pCursor) );\n  rc = sqlite3BtreeCursorRestore(p->uc.pCursor, &isDifferentRow);\n  p->cacheStatus = CACHE_STALE;\n  if( isDifferentRow ) p->nullRow = 1;\n  return rc;\n}\n\n/*\n** Check to ensure that the cursor is valid.  Restore the cursor\n** if need be.  Return any I/O error from the restore operation.\n*/\nint sqlite3VdbeCursorRestore(VdbeCursor *p){\n  assert( p->eCurType==CURTYPE_BTREE );\n  if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){\n    return handleMovedCursor(p);\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Make sure the cursor p is ready to read or write the row to which it\n** was last positioned.  Return an error code if an OOM fault or I/O error\n** prevents us from positioning the cursor to its correct position.\n**\n** If a MoveTo operation is pending on the given cursor, then do that\n** MoveTo now.  If no move is pending, check to see if the row has been\n** deleted out from under the cursor and if it has, mark the row as\n** a NULL row.\n**\n** If the cursor is already pointing to the correct row and that row has\n** not been deleted out from under the cursor, then this routine is a no-op.\n*/\nint sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){\n  VdbeCursor *p = *pp;\n  if( p->eCurType==CURTYPE_BTREE ){\n    if( p->deferredMoveto ){\n      int iMap;\n      if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 ){\n        *pp = p->pAltCursor;\n        *piCol = iMap - 1;\n        return SQLITE_OK;\n      }\n      return handleDeferredMoveto(p);\n    }\n    if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){\n      return handleMovedCursor(p);\n    }\n  }\n  return SQLITE_OK;\n}\n\n/*\n** The following functions:\n**\n** sqlite3VdbeSerialType()\n** sqlite3VdbeSerialTypeLen()\n** sqlite3VdbeSerialLen()\n** sqlite3VdbeSerialPut()\n** sqlite3VdbeSerialGet()\n**\n** encapsulate the code that serializes values for storage in SQLite\n** data and index records. Each serialized value consists of a\n** 'serial-type' and a blob of data. The serial type is an 8-byte unsigned\n** integer, stored as a varint.\n**\n** In an SQLite index record, the serial type is stored directly before\n** the blob of data that it corresponds to. In a table record, all serial\n** types are stored at the start of the record, and the blobs of data at\n** the end. Hence these functions allow the caller to handle the\n** serial-type and data blob separately.\n**\n** The following table describes the various storage classes for data:\n**\n**   serial type        bytes of data      type\n**   --------------     ---------------    ---------------\n**      0                     0            NULL\n**      1                     1            signed integer\n**      2                     2            signed integer\n**      3                     3            signed integer\n**      4                     4            signed integer\n**      5                     6            signed integer\n**      6                     8            signed integer\n**      7                     8            IEEE float\n**      8                     0            Integer constant 0\n**      9                     0            Integer constant 1\n**     10,11                               reserved for expansion\n**    N>=12 and even       (N-12)/2        BLOB\n**    N>=13 and odd        (N-13)/2        text\n**\n** The 8 and 9 types were added in 3.3.0, file format 4.  Prior versions\n** of SQLite will not understand those serial types.\n*/\n\n/*\n** Return the serial-type for the value stored in pMem.\n*/\nu32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *pLen){\n  int flags = pMem->flags;\n  u32 n;\n\n  assert( pLen!=0 );\n  if( flags&MEM_Null ){\n    *pLen = 0;\n    return 0;\n  }\n  if( flags&MEM_Int ){\n    /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */\n#   define MAX_6BYTE ((((i64)0x00008000)<<32)-1)\n    i64 i = pMem->u.i;\n    u64 u;\n    if( i<0 ){\n      u = ~i;\n    }else{\n      u = i;\n    }\n    if( u<=127 ){\n      if( (i&1)==i && file_format>=4 ){\n        *pLen = 0;\n        return 8+(u32)u;\n      }else{\n        *pLen = 1;\n        return 1;\n      }\n    }\n    if( u<=32767 ){ *pLen = 2; return 2; }\n    if( u<=8388607 ){ *pLen = 3; return 3; }\n    if( u<=2147483647 ){ *pLen = 4; return 4; }\n    if( u<=MAX_6BYTE ){ *pLen = 6; return 5; }\n    *pLen = 8;\n    return 6;\n  }\n  if( flags&MEM_Real ){\n    *pLen = 8;\n    return 7;\n  }\n  assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );\n  assert( pMem->n>=0 );\n  n = (u32)pMem->n;\n  if( flags & MEM_Zero ){\n    n += pMem->u.nZero;\n  }\n  *pLen = n;\n  return ((n*2) + 12 + ((flags&MEM_Str)!=0));\n}\n\n/*\n** The sizes for serial types less than 128\n*/\nstatic const u8 sqlite3SmallTypeSizes[] = {\n        /*  0   1   2   3   4   5   6   7   8   9 */   \n/*   0 */   0,  1,  2,  3,  4,  6,  8,  8,  0,  0,\n/*  10 */   0,  0,  0,  0,  1,  1,  2,  2,  3,  3,\n/*  20 */   4,  4,  5,  5,  6,  6,  7,  7,  8,  8,\n/*  30 */   9,  9, 10, 10, 11, 11, 12, 12, 13, 13,\n/*  40 */  14, 14, 15, 15, 16, 16, 17, 17, 18, 18,\n/*  50 */  19, 19, 20, 20, 21, 21, 22, 22, 23, 23,\n/*  60 */  24, 24, 25, 25, 26, 26, 27, 27, 28, 28,\n/*  70 */  29, 29, 30, 30, 31, 31, 32, 32, 33, 33,\n/*  80 */  34, 34, 35, 35, 36, 36, 37, 37, 38, 38,\n/*  90 */  39, 39, 40, 40, 41, 41, 42, 42, 43, 43,\n/* 100 */  44, 44, 45, 45, 46, 46, 47, 47, 48, 48,\n/* 110 */  49, 49, 50, 50, 51, 51, 52, 52, 53, 53,\n/* 120 */  54, 54, 55, 55, 56, 56, 57, 57\n};\n\n/*\n** Return the length of the data corresponding to the supplied serial-type.\n*/\nu32 sqlite3VdbeSerialTypeLen(u32 serial_type){\n  if( serial_type>=128 ){\n    return (serial_type-12)/2;\n  }else{\n    assert( serial_type<12 \n            || sqlite3SmallTypeSizes[serial_type]==(serial_type - 12)/2 );\n    return sqlite3SmallTypeSizes[serial_type];\n  }\n}\nu8 sqlite3VdbeOneByteSerialTypeLen(u8 serial_type){\n  assert( serial_type<128 );\n  return sqlite3SmallTypeSizes[serial_type];  \n}\n\n/*\n** If we are on an architecture with mixed-endian floating \n** points (ex: ARM7) then swap the lower 4 bytes with the \n** upper 4 bytes.  Return the result.\n**\n** For most architectures, this is a no-op.\n**\n** (later):  It is reported to me that the mixed-endian problem\n** on ARM7 is an issue with GCC, not with the ARM7 chip.  It seems\n** that early versions of GCC stored the two words of a 64-bit\n** float in the wrong order.  And that error has been propagated\n** ever since.  The blame is not necessarily with GCC, though.\n** GCC might have just copying the problem from a prior compiler.\n** I am also told that newer versions of GCC that follow a different\n** ABI get the byte order right.\n**\n** Developers using SQLite on an ARM7 should compile and run their\n** application using -DSQLITE_DEBUG=1 at least once.  With DEBUG\n** enabled, some asserts below will ensure that the byte order of\n** floating point values is correct.\n**\n** (2007-08-30)  Frank van Vugt has studied this problem closely\n** and has send his findings to the SQLite developers.  Frank\n** writes that some Linux kernels offer floating point hardware\n** emulation that uses only 32-bit mantissas instead of a full \n** 48-bits as required by the IEEE standard.  (This is the\n** CONFIG_FPE_FASTFPE option.)  On such systems, floating point\n** byte swapping becomes very complicated.  To avoid problems,\n** the necessary byte swapping is carried out using a 64-bit integer\n** rather than a 64-bit float.  Frank assures us that the code here\n** works for him.  We, the developers, have no way to independently\n** verify this, but Frank seems to know what he is talking about\n** so we trust him.\n*/\n#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT\nstatic u64 floatSwap(u64 in){\n  union {\n    u64 r;\n    u32 i[2];\n  } u;\n  u32 t;\n\n  u.r = in;\n  t = u.i[0];\n  u.i[0] = u.i[1];\n  u.i[1] = t;\n  return u.r;\n}\n# define swapMixedEndianFloat(X)  X = floatSwap(X)\n#else\n# define swapMixedEndianFloat(X)\n#endif\n\n/*\n** Write the serialized data blob for the value stored in pMem into \n** buf. It is assumed that the caller has allocated sufficient space.\n** Return the number of bytes written.\n**\n** nBuf is the amount of space left in buf[].  The caller is responsible\n** for allocating enough space to buf[] to hold the entire field, exclusive\n** of the pMem->u.nZero bytes for a MEM_Zero value.\n**\n** Return the number of bytes actually written into buf[].  The number\n** of bytes in the zero-filled tail is included in the return value only\n** if those bytes were zeroed in buf[].\n*/ \nu32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){\n  u32 len;\n\n  /* Integer and Real */\n  if( serial_type<=7 && serial_type>0 ){\n    u64 v;\n    u32 i;\n    if( serial_type==7 ){\n      assert( sizeof(v)==sizeof(pMem->u.r) );\n      memcpy(&v, &pMem->u.r, sizeof(v));\n      swapMixedEndianFloat(v);\n    }else{\n      v = pMem->u.i;\n    }\n    len = i = sqlite3SmallTypeSizes[serial_type];\n    assert( i>0 );\n    do{\n      buf[--i] = (u8)(v&0xFF);\n      v >>= 8;\n    }while( i );\n    return len;\n  }\n\n  /* String or blob */\n  if( serial_type>=12 ){\n    assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0)\n             == (int)sqlite3VdbeSerialTypeLen(serial_type) );\n    len = pMem->n;\n    if( len>0 ) memcpy(buf, pMem->z, len);\n    return len;\n  }\n\n  /* NULL or constants 0 or 1 */\n  return 0;\n}\n\n/* Input \"x\" is a sequence of unsigned characters that represent a\n** big-endian integer.  Return the equivalent native integer\n*/\n#define ONE_BYTE_INT(x)    ((i8)(x)[0])\n#define TWO_BYTE_INT(x)    (256*(i8)((x)[0])|(x)[1])\n#define THREE_BYTE_INT(x)  (65536*(i8)((x)[0])|((x)[1]<<8)|(x)[2])\n#define FOUR_BYTE_UINT(x)  (((u32)(x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])\n#define FOUR_BYTE_INT(x) (16777216*(i8)((x)[0])|((x)[1]<<16)|((x)[2]<<8)|(x)[3])\n\n/*\n** Deserialize the data blob pointed to by buf as serial type serial_type\n** and store the result in pMem.  Return the number of bytes read.\n**\n** This function is implemented as two separate routines for performance.\n** The few cases that require local variables are broken out into a separate\n** routine so that in most cases the overhead of moving the stack pointer\n** is avoided.\n*/ \nstatic u32 SQLITE_NOINLINE serialGet(\n  const unsigned char *buf,     /* Buffer to deserialize from */\n  u32 serial_type,              /* Serial type to deserialize */\n  Mem *pMem                     /* Memory cell to write value into */\n){\n  u64 x = FOUR_BYTE_UINT(buf);\n  u32 y = FOUR_BYTE_UINT(buf+4);\n  x = (x<<32) + y;\n  if( serial_type==6 ){\n    /* EVIDENCE-OF: R-29851-52272 Value is a big-endian 64-bit\n    ** twos-complement integer. */\n    pMem->u.i = *(i64*)&x;\n    pMem->flags = MEM_Int;\n    testcase( pMem->u.i<0 );\n  }else{\n    /* EVIDENCE-OF: R-57343-49114 Value is a big-endian IEEE 754-2008 64-bit\n    ** floating point number. */\n#if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT)\n    /* Verify that integers and floating point values use the same\n    ** byte order.  Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is\n    ** defined that 64-bit floating point values really are mixed\n    ** endian.\n    */\n    static const u64 t1 = ((u64)0x3ff00000)<<32;\n    static const double r1 = 1.0;\n    u64 t2 = t1;\n    swapMixedEndianFloat(t2);\n    assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 );\n#endif\n    assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 );\n    swapMixedEndianFloat(x);\n    memcpy(&pMem->u.r, &x, sizeof(x));\n    pMem->flags = sqlite3IsNaN(pMem->u.r) ? MEM_Null : MEM_Real;\n  }\n  return 8;\n}\nu32 sqlite3VdbeSerialGet(\n  const unsigned char *buf,     /* Buffer to deserialize from */\n  u32 serial_type,              /* Serial type to deserialize */\n  Mem *pMem                     /* Memory cell to write value into */\n){\n  switch( serial_type ){\n    case 10:   /* Reserved for future use */\n    case 11:   /* Reserved for future use */\n    case 0: {  /* Null */\n      /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */\n      pMem->flags = MEM_Null;\n      break;\n    }\n    case 1: {\n      /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement\n      ** integer. */\n      pMem->u.i = ONE_BYTE_INT(buf);\n      pMem->flags = MEM_Int;\n      testcase( pMem->u.i<0 );\n      return 1;\n    }\n    case 2: { /* 2-byte signed integer */\n      /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit\n      ** twos-complement integer. */\n      pMem->u.i = TWO_BYTE_INT(buf);\n      pMem->flags = MEM_Int;\n      testcase( pMem->u.i<0 );\n      return 2;\n    }\n    case 3: { /* 3-byte signed integer */\n      /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit\n      ** twos-complement integer. */\n      pMem->u.i = THREE_BYTE_INT(buf);\n      pMem->flags = MEM_Int;\n      testcase( pMem->u.i<0 );\n      return 3;\n    }\n    case 4: { /* 4-byte signed integer */\n      /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit\n      ** twos-complement integer. */\n      pMem->u.i = FOUR_BYTE_INT(buf);\n#ifdef __HP_cc \n      /* Work around a sign-extension bug in the HP compiler for HP/UX */\n      if( buf[0]&0x80 ) pMem->u.i |= 0xffffffff80000000LL;\n#endif\n      pMem->flags = MEM_Int;\n      testcase( pMem->u.i<0 );\n      return 4;\n    }\n    case 5: { /* 6-byte signed integer */\n      /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit\n      ** twos-complement integer. */\n      pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);\n      pMem->flags = MEM_Int;\n      testcase( pMem->u.i<0 );\n      return 6;\n    }\n    case 6:   /* 8-byte signed integer */\n    case 7: { /* IEEE floating point */\n      /* These use local variables, so do them in a separate routine\n      ** to avoid having to move the frame pointer in the common case */\n      return serialGet(buf,serial_type,pMem);\n    }\n    case 8:    /* Integer 0 */\n    case 9: {  /* Integer 1 */\n      /* EVIDENCE-OF: R-12976-22893 Value is the integer 0. */\n      /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */\n      pMem->u.i = serial_type-8;\n      pMem->flags = MEM_Int;\n      return 0;\n    }\n    default: {\n      /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in\n      ** length.\n      ** EVIDENCE-OF: R-28401-00140 Value is a string in the text encoding and\n      ** (N-13)/2 bytes in length. */\n      static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };\n      pMem->z = (char *)buf;\n      pMem->n = (serial_type-12)/2;\n      pMem->flags = aFlag[serial_type&1];\n      return pMem->n;\n    }\n  }\n  return 0;\n}\n/*\n** This routine is used to allocate sufficient space for an UnpackedRecord\n** structure large enough to be used with sqlite3VdbeRecordUnpack() if\n** the first argument is a pointer to KeyInfo structure pKeyInfo.\n**\n** The space is either allocated using sqlite3DbMallocRaw() or from within\n** the unaligned buffer passed via the second and third arguments (presumably\n** stack space). If the former, then *ppFree is set to a pointer that should\n** be eventually freed by the caller using sqlite3DbFree(). Or, if the \n** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL\n** before returning.\n**\n** If an OOM error occurs, NULL is returned.\n*/\nUnpackedRecord *sqlite3VdbeAllocUnpackedRecord(\n  KeyInfo *pKeyInfo,              /* Description of the record */\n  char *pSpace,                   /* Unaligned space available */\n  int szSpace,                    /* Size of pSpace[] in bytes */\n  char **ppFree                   /* OUT: Caller should free this pointer */\n){\n  UnpackedRecord *p;              /* Unpacked record to return */\n  int nOff;                       /* Increment pSpace by nOff to align it */\n  int nByte;                      /* Number of bytes required for *p */\n\n  /* We want to shift the pointer pSpace up such that it is 8-byte aligned.\n  ** Thus, we need to calculate a value, nOff, between 0 and 7, to shift \n  ** it by.  If pSpace is already 8-byte aligned, nOff should be zero.\n  */\n  nOff = (8 - (SQLITE_PTR_TO_INT(pSpace) & 7)) & 7;\n  nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);\n  if( nByte>szSpace+nOff ){\n    p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);\n    *ppFree = (char *)p;\n    if( !p ) return 0;\n  }else{\n    p = (UnpackedRecord*)&pSpace[nOff];\n    *ppFree = 0;\n  }\n\n  p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];\n  assert( pKeyInfo->aSortOrder!=0 );\n  p->pKeyInfo = pKeyInfo;\n  p->nField = pKeyInfo->nField + 1;\n  return p;\n}\n\n/*\n** Given the nKey-byte encoding of a record in pKey[], populate the \n** UnpackedRecord structure indicated by the fourth argument with the\n** contents of the decoded record.\n*/ \nvoid sqlite3VdbeRecordUnpack(\n  KeyInfo *pKeyInfo,     /* Information about the record format */\n  int nKey,              /* Size of the binary record */\n  const void *pKey,      /* The binary record */\n  UnpackedRecord *p      /* Populate this structure before returning. */\n){\n  const unsigned char *aKey = (const unsigned char *)pKey;\n  int d; \n  u32 idx;                        /* Offset in aKey[] to read from */\n  u16 u;                          /* Unsigned loop counter */\n  u32 szHdr;\n  Mem *pMem = p->aMem;\n\n  p->default_rc = 0;\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\n  idx = getVarint32(aKey, szHdr);\n  d = szHdr;\n  u = 0;\n  while( idx<szHdr && d<=nKey ){\n    u32 serial_type;\n\n    idx += getVarint32(&aKey[idx], serial_type);\n    pMem->enc = pKeyInfo->enc;\n    pMem->db = pKeyInfo->db;\n    /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */\n    pMem->szMalloc = 0;\n    pMem->z = 0;\n    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);\n    pMem++;\n    if( (++u)>=p->nField ) break;\n  }\n  assert( u<=pKeyInfo->nField + 1 );\n  p->nField = u;\n}\n\n#if SQLITE_DEBUG\n/*\n** This function compares two index or table record keys in the same way\n** as the sqlite3VdbeRecordCompare() routine. Unlike VdbeRecordCompare(),\n** this function deserializes and compares values using the\n** sqlite3VdbeSerialGet() and sqlite3MemCompare() functions. It is used\n** in assert() statements to ensure that the optimized code in\n** sqlite3VdbeRecordCompare() returns results with these two primitives.\n**\n** Return true if the result of comparison is equivalent to desiredResult.\n** Return false if there is a disagreement.\n*/\nstatic int vdbeRecordCompareDebug(\n  int nKey1, const void *pKey1, /* Left key */\n  const UnpackedRecord *pPKey2, /* Right key */\n  int desiredResult             /* Correct answer */\n){\n  u32 d1;            /* Offset into aKey[] of next data element */\n  u32 idx1;          /* Offset into aKey[] of next header element */\n  u32 szHdr1;        /* Number of bytes in header */\n  int i = 0;\n  int rc = 0;\n  const unsigned char *aKey1 = (const unsigned char *)pKey1;\n  KeyInfo *pKeyInfo;\n  Mem mem1;\n\n  pKeyInfo = pPKey2->pKeyInfo;\n  if( pKeyInfo->db==0 ) return 1;\n  mem1.enc = pKeyInfo->enc;\n  mem1.db = pKeyInfo->db;\n  /* mem1.flags = 0;  // Will be initialized by sqlite3VdbeSerialGet() */\n  VVA_ONLY( mem1.szMalloc = 0; ) /* Only needed by assert() statements */\n\n  /* Compilers may complain that mem1.u.i is potentially uninitialized.\n  ** We could initialize it, as shown here, to silence those complaints.\n  ** But in fact, mem1.u.i will never actually be used uninitialized, and doing \n  ** the unnecessary initialization has a measurable negative performance\n  ** impact, since this routine is a very high runner.  And so, we choose\n  ** to ignore the compiler warnings and leave this variable uninitialized.\n  */\n  /*  mem1.u.i = 0;  // not needed, here to silence compiler warning */\n  \n  idx1 = getVarint32(aKey1, szHdr1);\n  if( szHdr1>98307 ) return SQLITE_CORRUPT;\n  d1 = szHdr1;\n  assert( pKeyInfo->nField+pKeyInfo->nXField>=pPKey2->nField || CORRUPT_DB );\n  assert( pKeyInfo->aSortOrder!=0 );\n  assert( pKeyInfo->nField>0 );\n  assert( idx1<=szHdr1 || CORRUPT_DB );\n  do{\n    u32 serial_type1;\n\n    /* Read the serial types for the next element in each key. */\n    idx1 += getVarint32( aKey1+idx1, serial_type1 );\n\n    /* Verify that there is enough key space remaining to avoid\n    ** a buffer overread.  The \"d1+serial_type1+2\" subexpression will\n    ** always be greater than or equal to the amount of required key space.\n    ** Use that approximation to avoid the more expensive call to\n    ** sqlite3VdbeSerialTypeLen() in the common case.\n    */\n    if( d1+serial_type1+2>(u32)nKey1\n     && d1+sqlite3VdbeSerialTypeLen(serial_type1)>(u32)nKey1 \n    ){\n      break;\n    }\n\n    /* Extract the values to be compared.\n    */\n    d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);\n\n    /* Do the comparison\n    */\n    rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i], pKeyInfo->aColl[i]);\n    if( rc!=0 ){\n      assert( mem1.szMalloc==0 );  /* See comment below */\n      if( pKeyInfo->aSortOrder[i] ){\n        rc = -rc;  /* Invert the result for DESC sort order. */\n      }\n      goto debugCompareEnd;\n    }\n    i++;\n  }while( idx1<szHdr1 && i<pPKey2->nField );\n\n  /* No memory allocation is ever used on mem1.  Prove this using\n  ** the following assert().  If the assert() fails, it indicates a\n  ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1).\n  */\n  assert( mem1.szMalloc==0 );\n\n  /* rc==0 here means that one of the keys ran out of fields and\n  ** all the fields up to that point were equal. Return the default_rc\n  ** value.  */\n  rc = pPKey2->default_rc;\n\ndebugCompareEnd:\n  if( desiredResult==0 && rc==0 ) return 1;\n  if( desiredResult<0 && rc<0 ) return 1;\n  if( desiredResult>0 && rc>0 ) return 1;\n  if( CORRUPT_DB ) return 1;\n  if( pKeyInfo->db->mallocFailed ) return 1;\n  return 0;\n}\n#endif\n\n#if SQLITE_DEBUG\n/*\n** Count the number of fields (a.k.a. columns) in the record given by\n** pKey,nKey.  The verify that this count is less than or equal to the\n** limit given by pKeyInfo->nField + pKeyInfo->nXField.\n**\n** If this constraint is not satisfied, it means that the high-speed\n** vdbeRecordCompareInt() and vdbeRecordCompareString() routines will\n** not work correctly.  If this assert() ever fires, it probably means\n** that the KeyInfo.nField or KeyInfo.nXField values were computed\n** incorrectly.\n*/\nstatic void vdbeAssertFieldCountWithinLimits(\n  int nKey, const void *pKey,   /* The record to verify */ \n  const KeyInfo *pKeyInfo       /* Compare size with this KeyInfo */\n){\n  int nField = 0;\n  u32 szHdr;\n  u32 idx;\n  u32 notUsed;\n  const unsigned char *aKey = (const unsigned char*)pKey;\n\n  if( CORRUPT_DB ) return;\n  idx = getVarint32(aKey, szHdr);\n  assert( nKey>=0 );\n  assert( szHdr<=(u32)nKey );\n  while( idx<szHdr ){\n    idx += getVarint32(aKey+idx, notUsed);\n    nField++;\n  }\n  assert( nField <= pKeyInfo->nField+pKeyInfo->nXField );\n}\n#else\n# define vdbeAssertFieldCountWithinLimits(A,B,C)\n#endif\n\n/*\n** Both *pMem1 and *pMem2 contain string values. Compare the two values\n** using the collation sequence pColl. As usual, return a negative , zero\n** or positive value if *pMem1 is less than, equal to or greater than \n** *pMem2, respectively. Similar in spirit to \"rc = (*pMem1) - (*pMem2);\".\n*/\nstatic int vdbeCompareMemString(\n  const Mem *pMem1,\n  const Mem *pMem2,\n  const CollSeq *pColl,\n  u8 *prcErr                      /* If an OOM occurs, set to SQLITE_NOMEM */\n){\n  if( pMem1->enc==pColl->enc ){\n    /* The strings are already in the correct encoding.  Call the\n     ** comparison function directly */\n    return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z);\n  }else{\n    int rc;\n    const void *v1, *v2;\n    int n1, n2;\n    Mem c1;\n    Mem c2;\n    sqlite3VdbeMemInit(&c1, pMem1->db, MEM_Null);\n    sqlite3VdbeMemInit(&c2, pMem1->db, MEM_Null);\n    sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem);\n    sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem);\n    v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc);\n    n1 = v1==0 ? 0 : c1.n;\n    v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);\n    n2 = v2==0 ? 0 : c2.n;\n    rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);\n    if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM_BKPT;\n    sqlite3VdbeMemRelease(&c1);\n    sqlite3VdbeMemRelease(&c2);\n    return rc;\n  }\n}\n\n/*\n** The input pBlob is guaranteed to be a Blob that is not marked\n** with MEM_Zero.  Return true if it could be a zero-blob.\n*/\nstatic int isAllZero(const char *z, int n){\n  int i;\n  for(i=0; i<n; i++){\n    if( z[i] ) return 0;\n  }\n  return 1;\n}\n\n/*\n** Compare two blobs.  Return negative, zero, or positive if the first\n** is less than, equal to, or greater than the second, respectively.\n** If one blob is a prefix of the other, then the shorter is the lessor.\n*/\nstatic SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem *pB2){\n  int c;\n  int n1 = pB1->n;\n  int n2 = pB2->n;\n\n  /* It is possible to have a Blob value that has some non-zero content\n  ** followed by zero content.  But that only comes up for Blobs formed\n  ** by the OP_MakeRecord opcode, and such Blobs never get passed into\n  ** sqlite3MemCompare(). */\n  assert( (pB1->flags & MEM_Zero)==0 || n1==0 );\n  assert( (pB2->flags & MEM_Zero)==0 || n2==0 );\n\n  if( (pB1->flags|pB2->flags) & MEM_Zero ){\n    if( pB1->flags & pB2->flags & MEM_Zero ){\n      return pB1->u.nZero - pB2->u.nZero;\n    }else if( pB1->flags & MEM_Zero ){\n      if( !isAllZero(pB2->z, pB2->n) ) return -1;\n      return pB1->u.nZero - n2;\n    }else{\n      if( !isAllZero(pB1->z, pB1->n) ) return +1;\n      return n1 - pB2->u.nZero;\n    }\n  }\n  c = memcmp(pB1->z, pB2->z, n1>n2 ? n2 : n1);\n  if( c ) return c;\n  return n1 - n2;\n}\n\n/*\n** Do a comparison between a 64-bit signed integer and a 64-bit floating-point\n** number.  Return negative, zero, or positive if the first (i64) is less than,\n** equal to, or greater than the second (double).\n*/\nstatic int sqlite3IntFloatCompare(i64 i, double r){\n  if( sizeof(LONGDOUBLE_TYPE)>8 ){\n    LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i;\n    if( x<r ) return -1;\n    if( x>r ) return +1;\n    return 0;\n  }else{\n    i64 y;\n    double s;\n    if( r<-9223372036854775808.0 ) return +1;\n    if( r>9223372036854775807.0 ) return -1;\n    y = (i64)r;\n    if( i<y ) return -1;\n    if( i>y ){\n      if( y==SMALLEST_INT64 && r>0.0 ) return -1;\n      return +1;\n    }\n    s = (double)i;\n    if( s<r ) return -1;\n    if( s>r ) return +1;\n    return 0;\n  }\n}\n\n/*\n** Compare the values contained by the two memory cells, returning\n** negative, zero or positive if pMem1 is less than, equal to, or greater\n** than pMem2. Sorting order is NULL's first, followed by numbers (integers\n** and reals) sorted numerically, followed by text ordered by the collating\n** sequence pColl and finally blob's ordered by memcmp().\n**\n** Two NULL values are considered equal by this function.\n*/\nint sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){\n  int f1, f2;\n  int combined_flags;\n\n  f1 = pMem1->flags;\n  f2 = pMem2->flags;\n  combined_flags = f1|f2;\n  assert( (combined_flags & MEM_RowSet)==0 );\n \n  /* If one value is NULL, it is less than the other. If both values\n  ** are NULL, return 0.\n  */\n  if( combined_flags&MEM_Null ){\n    return (f2&MEM_Null) - (f1&MEM_Null);\n  }\n\n  /* At least one of the two values is a number\n  */\n  if( combined_flags&(MEM_Int|MEM_Real) ){\n    if( (f1 & f2 & MEM_Int)!=0 ){\n      if( pMem1->u.i < pMem2->u.i ) return -1;\n      if( pMem1->u.i > pMem2->u.i ) return +1;\n      return 0;\n    }\n    if( (f1 & f2 & MEM_Real)!=0 ){\n      if( pMem1->u.r < pMem2->u.r ) return -1;\n      if( pMem1->u.r > pMem2->u.r ) return +1;\n      return 0;\n    }\n    if( (f1&MEM_Int)!=0 ){\n      if( (f2&MEM_Real)!=0 ){\n        return sqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r);\n      }else{\n        return -1;\n      }\n    }\n    if( (f1&MEM_Real)!=0 ){\n      if( (f2&MEM_Int)!=0 ){\n        return -sqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r);\n      }else{\n        return -1;\n      }\n    }\n    return +1;\n  }\n\n  /* If one value is a string and the other is a blob, the string is less.\n  ** If both are strings, compare using the collating functions.\n  */\n  if( combined_flags&MEM_Str ){\n    if( (f1 & MEM_Str)==0 ){\n      return 1;\n    }\n    if( (f2 & MEM_Str)==0 ){\n      return -1;\n    }\n\n    assert( pMem1->enc==pMem2->enc || pMem1->db->mallocFailed );\n    assert( pMem1->enc==SQLITE_UTF8 || \n            pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );\n\n    /* The collation sequence must be defined at this point, even if\n    ** the user deletes the collation sequence after the vdbe program is\n    ** compiled (this was not always the case).\n    */\n    assert( !pColl || pColl->xCmp );\n\n    if( pColl ){\n      return vdbeCompareMemString(pMem1, pMem2, pColl, 0);\n    }\n    /* If a NULL pointer was passed as the collate function, fall through\n    ** to the blob case and use memcmp().  */\n  }\n \n  /* Both values must be blobs.  Compare using memcmp().  */\n  return sqlite3BlobCompare(pMem1, pMem2);\n}\n\n\n/*\n** The first argument passed to this function is a serial-type that\n** corresponds to an integer - all values between 1 and 9 inclusive \n** except 7. The second points to a buffer containing an integer value\n** serialized according to serial_type. This function deserializes\n** and returns the value.\n*/\nstatic i64 vdbeRecordDecodeInt(u32 serial_type, const u8 *aKey){\n  u32 y;\n  assert( CORRUPT_DB || (serial_type>=1 && serial_type<=9 && serial_type!=7) );\n  switch( serial_type ){\n    case 0:\n    case 1:\n      testcase( aKey[0]&0x80 );\n      return ONE_BYTE_INT(aKey);\n    case 2:\n      testcase( aKey[0]&0x80 );\n      return TWO_BYTE_INT(aKey);\n    case 3:\n      testcase( aKey[0]&0x80 );\n      return THREE_BYTE_INT(aKey);\n    case 4: {\n      testcase( aKey[0]&0x80 );\n      y = FOUR_BYTE_UINT(aKey);\n      return (i64)*(int*)&y;\n    }\n    case 5: {\n      testcase( aKey[0]&0x80 );\n      return FOUR_BYTE_UINT(aKey+2) + (((i64)1)<<32)*TWO_BYTE_INT(aKey);\n    }\n    case 6: {\n      u64 x = FOUR_BYTE_UINT(aKey);\n      testcase( aKey[0]&0x80 );\n      x = (x<<32) | FOUR_BYTE_UINT(aKey+4);\n      return (i64)*(i64*)&x;\n    }\n  }\n\n  return (serial_type - 8);\n}\n\n/*\n** This function compares the two table rows or index records\n** specified by {nKey1, pKey1} and pPKey2.  It returns a negative, zero\n** or positive integer if key1 is less than, equal to or \n** greater than key2.  The {nKey1, pKey1} key must be a blob\n** created by the OP_MakeRecord opcode of the VDBE.  The pPKey2\n** key must be a parsed key such as obtained from\n** sqlite3VdbeParseRecord.\n**\n** If argument bSkip is non-zero, it is assumed that the caller has already\n** determined that the first fields of the keys are equal.\n**\n** Key1 and Key2 do not have to contain the same number of fields. If all \n** fields that appear in both keys are equal, then pPKey2->default_rc is \n** returned.\n**\n** If database corruption is discovered, set pPKey2->errCode to \n** SQLITE_CORRUPT and return 0. If an OOM error is encountered, \n** pPKey2->errCode is set to SQLITE_NOMEM and, if it is not NULL, the\n** malloc-failed flag set on database handle (pPKey2->pKeyInfo->db).\n*/\nint sqlite3VdbeRecordCompareWithSkip(\n  int nKey1, const void *pKey1,   /* Left key */\n  UnpackedRecord *pPKey2,         /* Right key */\n  int bSkip                       /* If true, skip the first field */\n){\n  u32 d1;                         /* Offset into aKey[] of next data element */\n  int i;                          /* Index of next field to compare */\n  u32 szHdr1;                     /* Size of record header in bytes */\n  u32 idx1;                       /* Offset of first type in header */\n  int rc = 0;                     /* Return value */\n  Mem *pRhs = pPKey2->aMem;       /* Next field of pPKey2 to compare */\n  KeyInfo *pKeyInfo = pPKey2->pKeyInfo;\n  const unsigned char *aKey1 = (const unsigned char *)pKey1;\n  Mem mem1;\n\n  /* If bSkip is true, then the caller has already determined that the first\n  ** two elements in the keys are equal. Fix the various stack variables so\n  ** that this routine begins comparing at the second field. */\n  if( bSkip ){\n    u32 s1;\n    idx1 = 1 + getVarint32(&aKey1[1], s1);\n    szHdr1 = aKey1[0];\n    d1 = szHdr1 + sqlite3VdbeSerialTypeLen(s1);\n    i = 1;\n    pRhs++;\n  }else{\n    idx1 = getVarint32(aKey1, szHdr1);\n    d1 = szHdr1;\n    if( d1>(unsigned)nKey1 ){ \n      pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;\n      return 0;  /* Corruption */\n    }\n    i = 0;\n  }\n\n  VVA_ONLY( mem1.szMalloc = 0; ) /* Only needed by assert() statements */\n  assert( pPKey2->pKeyInfo->nField+pPKey2->pKeyInfo->nXField>=pPKey2->nField \n       || CORRUPT_DB );\n  assert( pPKey2->pKeyInfo->aSortOrder!=0 );\n  assert( pPKey2->pKeyInfo->nField>0 );\n  assert( idx1<=szHdr1 || CORRUPT_DB );\n  do{\n    u32 serial_type;\n\n    /* RHS is an integer */\n    if( pRhs->flags & MEM_Int ){\n      serial_type = aKey1[idx1];\n      testcase( serial_type==12 );\n      if( serial_type>=10 ){\n        rc = +1;\n      }else if( serial_type==0 ){\n        rc = -1;\n      }else if( serial_type==7 ){\n        sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);\n        rc = -sqlite3IntFloatCompare(pRhs->u.i, mem1.u.r);\n      }else{\n        i64 lhs = vdbeRecordDecodeInt(serial_type, &aKey1[d1]);\n        i64 rhs = pRhs->u.i;\n        if( lhs<rhs ){\n          rc = -1;\n        }else if( lhs>rhs ){\n          rc = +1;\n        }\n      }\n    }\n\n    /* RHS is real */\n    else if( pRhs->flags & MEM_Real ){\n      serial_type = aKey1[idx1];\n      if( serial_type>=10 ){\n        /* Serial types 12 or greater are strings and blobs (greater than\n        ** numbers). Types 10 and 11 are currently \"reserved for future \n        ** use\", so it doesn't really matter what the results of comparing\n        ** them to numberic values are.  */\n        rc = +1;\n      }else if( serial_type==0 ){\n        rc = -1;\n      }else{\n        sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1);\n        if( serial_type==7 ){\n          if( mem1.u.r<pRhs->u.r ){\n            rc = -1;\n          }else if( mem1.u.r>pRhs->u.r ){\n            rc = +1;\n          }\n        }else{\n          rc = sqlite3IntFloatCompare(mem1.u.i, pRhs->u.r);\n        }\n      }\n    }\n\n    /* RHS is a string */\n    else if( pRhs->flags & MEM_Str ){\n      getVarint32(&aKey1[idx1], serial_type);\n      testcase( serial_type==12 );\n      if( serial_type<12 ){\n        rc = -1;\n      }else if( !(serial_type & 0x01) ){\n        rc = +1;\n      }else{\n        mem1.n = (serial_type - 12) / 2;\n        testcase( (d1+mem1.n)==(unsigned)nKey1 );\n        testcase( (d1+mem1.n+1)==(unsigned)nKey1 );\n        if( (d1+mem1.n) > (unsigned)nKey1 ){\n          pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;\n          return 0;                /* Corruption */\n        }else if( pKeyInfo->aColl[i] ){\n          mem1.enc = pKeyInfo->enc;\n          mem1.db = pKeyInfo->db;\n          mem1.flags = MEM_Str;\n          mem1.z = (char*)&aKey1[d1];\n          rc = vdbeCompareMemString(\n              &mem1, pRhs, pKeyInfo->aColl[i], &pPKey2->errCode\n          );\n        }else{\n          int nCmp = MIN(mem1.n, pRhs->n);\n          rc = memcmp(&aKey1[d1], pRhs->z, nCmp);\n          if( rc==0 ) rc = mem1.n - pRhs->n; \n        }\n      }\n    }\n\n    /* RHS is a blob */\n    else if( pRhs->flags & MEM_Blob ){\n      assert( (pRhs->flags & MEM_Zero)==0 || pRhs->n==0 );\n      getVarint32(&aKey1[idx1], serial_type);\n      testcase( serial_type==12 );\n      if( serial_type<12 || (serial_type & 0x01) ){\n        rc = -1;\n      }else{\n        int nStr = (serial_type - 12) / 2;\n        testcase( (d1+nStr)==(unsigned)nKey1 );\n        testcase( (d1+nStr+1)==(unsigned)nKey1 );\n        if( (d1+nStr) > (unsigned)nKey1 ){\n          pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;\n          return 0;                /* Corruption */\n        }else if( pRhs->flags & MEM_Zero ){\n          if( !isAllZero((const char*)&aKey1[d1],nStr) ){\n            rc = 1;\n          }else{\n            rc = nStr - pRhs->u.nZero;\n          }\n        }else{\n          int nCmp = MIN(nStr, pRhs->n);\n          rc = memcmp(&aKey1[d1], pRhs->z, nCmp);\n          if( rc==0 ) rc = nStr - pRhs->n;\n        }\n      }\n    }\n\n    /* RHS is null */\n    else{\n      serial_type = aKey1[idx1];\n      rc = (serial_type!=0);\n    }\n\n    if( rc!=0 ){\n      if( pKeyInfo->aSortOrder[i] ){\n        rc = -rc;\n      }\n      assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, rc) );\n      assert( mem1.szMalloc==0 );  /* See comment below */\n      return rc;\n    }\n\n    i++;\n    pRhs++;\n    d1 += sqlite3VdbeSerialTypeLen(serial_type);\n    idx1 += sqlite3VarintLen(serial_type);\n  }while( idx1<(unsigned)szHdr1 && i<pPKey2->nField && d1<=(unsigned)nKey1 );\n\n  /* No memory allocation is ever used on mem1.  Prove this using\n  ** the following assert().  If the assert() fails, it indicates a\n  ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1).  */\n  assert( mem1.szMalloc==0 );\n\n  /* rc==0 here means that one or both of the keys ran out of fields and\n  ** all the fields up to that point were equal. Return the default_rc\n  ** value.  */\n  assert( CORRUPT_DB \n       || vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, pPKey2->default_rc) \n       || pKeyInfo->db->mallocFailed\n  );\n  pPKey2->eqSeen = 1;\n  return pPKey2->default_rc;\n}\nint sqlite3VdbeRecordCompare(\n  int nKey1, const void *pKey1,   /* Left key */\n  UnpackedRecord *pPKey2          /* Right key */\n){\n  return sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 0);\n}\n\n\n/*\n** This function is an optimized version of sqlite3VdbeRecordCompare() \n** that (a) the first field of pPKey2 is an integer, and (b) the \n** size-of-header varint at the start of (pKey1/nKey1) fits in a single\n** byte (i.e. is less than 128).\n**\n** To avoid concerns about buffer overreads, this routine is only used\n** on schemas where the maximum valid header size is 63 bytes or less.\n*/\nstatic int vdbeRecordCompareInt(\n  int nKey1, const void *pKey1, /* Left key */\n  UnpackedRecord *pPKey2        /* Right key */\n){\n  const u8 *aKey = &((const u8*)pKey1)[*(const u8*)pKey1 & 0x3F];\n  int serial_type = ((const u8*)pKey1)[1];\n  int res;\n  u32 y;\n  u64 x;\n  i64 v;\n  i64 lhs;\n\n  vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);\n  assert( (*(u8*)pKey1)<=0x3F || CORRUPT_DB );\n  switch( serial_type ){\n    case 1: { /* 1-byte signed integer */\n      lhs = ONE_BYTE_INT(aKey);\n      testcase( lhs<0 );\n      break;\n    }\n    case 2: { /* 2-byte signed integer */\n      lhs = TWO_BYTE_INT(aKey);\n      testcase( lhs<0 );\n      break;\n    }\n    case 3: { /* 3-byte signed integer */\n      lhs = THREE_BYTE_INT(aKey);\n      testcase( lhs<0 );\n      break;\n    }\n    case 4: { /* 4-byte signed integer */\n      y = FOUR_BYTE_UINT(aKey);\n      lhs = (i64)*(int*)&y;\n      testcase( lhs<0 );\n      break;\n    }\n    case 5: { /* 6-byte signed integer */\n      lhs = FOUR_BYTE_UINT(aKey+2) + (((i64)1)<<32)*TWO_BYTE_INT(aKey);\n      testcase( lhs<0 );\n      break;\n    }\n    case 6: { /* 8-byte signed integer */\n      x = FOUR_BYTE_UINT(aKey);\n      x = (x<<32) | FOUR_BYTE_UINT(aKey+4);\n      lhs = *(i64*)&x;\n      testcase( lhs<0 );\n      break;\n    }\n    case 8: \n      lhs = 0;\n      break;\n    case 9:\n      lhs = 1;\n      break;\n\n    /* This case could be removed without changing the results of running\n    ** this code. Including it causes gcc to generate a faster switch \n    ** statement (since the range of switch targets now starts at zero and\n    ** is contiguous) but does not cause any duplicate code to be generated\n    ** (as gcc is clever enough to combine the two like cases). Other \n    ** compilers might be similar.  */ \n    case 0: case 7:\n      return sqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2);\n\n    default:\n      return sqlite3VdbeRecordCompare(nKey1, pKey1, pPKey2);\n  }\n\n  v = pPKey2->aMem[0].u.i;\n  if( v>lhs ){\n    res = pPKey2->r1;\n  }else if( v<lhs ){\n    res = pPKey2->r2;\n  }else if( pPKey2->nField>1 ){\n    /* The first fields of the two keys are equal. Compare the trailing \n    ** fields.  */\n    res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1);\n  }else{\n    /* The first fields of the two keys are equal and there are no trailing\n    ** fields. Return pPKey2->default_rc in this case. */\n    res = pPKey2->default_rc;\n    pPKey2->eqSeen = 1;\n  }\n\n  assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res) );\n  return res;\n}\n\n/*\n** This function is an optimized version of sqlite3VdbeRecordCompare() \n** that (a) the first field of pPKey2 is a string, that (b) the first field\n** uses the collation sequence BINARY and (c) that the size-of-header varint \n** at the start of (pKey1/nKey1) fits in a single byte.\n*/\nstatic int vdbeRecordCompareString(\n  int nKey1, const void *pKey1, /* Left key */\n  UnpackedRecord *pPKey2        /* Right key */\n){\n  const u8 *aKey1 = (const u8*)pKey1;\n  int serial_type;\n  int res;\n\n  assert( pPKey2->aMem[0].flags & MEM_Str );\n  vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);\n  getVarint32(&aKey1[1], serial_type);\n  if( serial_type<12 ){\n    res = pPKey2->r1;      /* (pKey1/nKey1) is a number or a null */\n  }else if( !(serial_type & 0x01) ){ \n    res = pPKey2->r2;      /* (pKey1/nKey1) is a blob */\n  }else{\n    int nCmp;\n    int nStr;\n    int szHdr = aKey1[0];\n\n    nStr = (serial_type-12) / 2;\n    if( (szHdr + nStr) > nKey1 ){\n      pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;\n      return 0;    /* Corruption */\n    }\n    nCmp = MIN( pPKey2->aMem[0].n, nStr );\n    res = memcmp(&aKey1[szHdr], pPKey2->aMem[0].z, nCmp);\n\n    if( res==0 ){\n      res = nStr - pPKey2->aMem[0].n;\n      if( res==0 ){\n        if( pPKey2->nField>1 ){\n          res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1);\n        }else{\n          res = pPKey2->default_rc;\n          pPKey2->eqSeen = 1;\n        }\n      }else if( res>0 ){\n        res = pPKey2->r2;\n      }else{\n        res = pPKey2->r1;\n      }\n    }else if( res>0 ){\n      res = pPKey2->r2;\n    }else{\n      res = pPKey2->r1;\n    }\n  }\n\n  assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res)\n       || CORRUPT_DB\n       || pPKey2->pKeyInfo->db->mallocFailed\n  );\n  return res;\n}\n\n/*\n** Return a pointer to an sqlite3VdbeRecordCompare() compatible function\n** suitable for comparing serialized records to the unpacked record passed\n** as the only argument.\n*/\nRecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){\n  /* varintRecordCompareInt() and varintRecordCompareString() both assume\n  ** that the size-of-header varint that occurs at the start of each record\n  ** fits in a single byte (i.e. is 127 or less). varintRecordCompareInt()\n  ** also assumes that it is safe to overread a buffer by at least the \n  ** maximum possible legal header size plus 8 bytes. Because there is\n  ** guaranteed to be at least 74 (but not 136) bytes of padding following each\n  ** buffer passed to varintRecordCompareInt() this makes it convenient to\n  ** limit the size of the header to 64 bytes in cases where the first field\n  ** is an integer.\n  **\n  ** The easiest way to enforce this limit is to consider only records with\n  ** 13 fields or less. If the first field is an integer, the maximum legal\n  ** header size is (12*5 + 1 + 1) bytes.  */\n  if( (p->pKeyInfo->nField + p->pKeyInfo->nXField)<=13 ){\n    int flags = p->aMem[0].flags;\n    if( p->pKeyInfo->aSortOrder[0] ){\n      p->r1 = 1;\n      p->r2 = -1;\n    }else{\n      p->r1 = -1;\n      p->r2 = 1;\n    }\n    if( (flags & MEM_Int) ){\n      return vdbeRecordCompareInt;\n    }\n    testcase( flags & MEM_Real );\n    testcase( flags & MEM_Null );\n    testcase( flags & MEM_Blob );\n    if( (flags & (MEM_Real|MEM_Null|MEM_Blob))==0 && p->pKeyInfo->aColl[0]==0 ){\n      assert( flags & MEM_Str );\n      return vdbeRecordCompareString;\n    }\n  }\n\n  return sqlite3VdbeRecordCompare;\n}\n\n/*\n** pCur points at an index entry created using the OP_MakeRecord opcode.\n** Read the rowid (the last field in the record) and store it in *rowid.\n** Return SQLITE_OK if everything works, or an error code otherwise.\n**\n** pCur might be pointing to text obtained from a corrupt database file.\n** So the content cannot be trusted.  Do appropriate checks on the content.\n*/\nint sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){\n  i64 nCellKey = 0;\n  int rc;\n  u32 szHdr;        /* Size of the header */\n  u32 typeRowid;    /* Serial type of the rowid */\n  u32 lenRowid;     /* Size of the rowid */\n  Mem m, v;\n\n  /* Get the size of the index entry.  Only indices entries of less\n  ** than 2GiB are support - anything large must be database corruption.\n  ** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so\n  ** this code can safely assume that nCellKey is 32-bits  \n  */\n  assert( sqlite3BtreeCursorIsValid(pCur) );\n  nCellKey = sqlite3BtreePayloadSize(pCur);\n  assert( (nCellKey & SQLITE_MAX_U32)==(u64)nCellKey );\n\n  /* Read in the complete content of the index entry */\n  sqlite3VdbeMemInit(&m, db, 0);\n  rc = sqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, 1, &m);\n  if( rc ){\n    return rc;\n  }\n\n  /* The index entry must begin with a header size */\n  (void)getVarint32((u8*)m.z, szHdr);\n  testcase( szHdr==3 );\n  testcase( szHdr==m.n );\n  if( unlikely(szHdr<3 || (int)szHdr>m.n) ){\n    goto idx_rowid_corruption;\n  }\n\n  /* The last field of the index should be an integer - the ROWID.\n  ** Verify that the last entry really is an integer. */\n  (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid);\n  testcase( typeRowid==1 );\n  testcase( typeRowid==2 );\n  testcase( typeRowid==3 );\n  testcase( typeRowid==4 );\n  testcase( typeRowid==5 );\n  testcase( typeRowid==6 );\n  testcase( typeRowid==8 );\n  testcase( typeRowid==9 );\n  if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){\n    goto idx_rowid_corruption;\n  }\n  lenRowid = sqlite3SmallTypeSizes[typeRowid];\n  testcase( (u32)m.n==szHdr+lenRowid );\n  if( unlikely((u32)m.n<szHdr+lenRowid) ){\n    goto idx_rowid_corruption;\n  }\n\n  /* Fetch the integer off the end of the index record */\n  sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);\n  *rowid = v.u.i;\n  sqlite3VdbeMemRelease(&m);\n  return SQLITE_OK;\n\n  /* Jump here if database corruption is detected after m has been\n  ** allocated.  Free the m object and return SQLITE_CORRUPT. */\nidx_rowid_corruption:\n  testcase( m.szMalloc!=0 );\n  sqlite3VdbeMemRelease(&m);\n  return SQLITE_CORRUPT_BKPT;\n}\n\n/*\n** Compare the key of the index entry that cursor pC is pointing to against\n** the key string in pUnpacked.  Write into *pRes a number\n** that is negative, zero, or positive if pC is less than, equal to,\n** or greater than pUnpacked.  Return SQLITE_OK on success.\n**\n** pUnpacked is either created without a rowid or is truncated so that it\n** omits the rowid at the end.  The rowid at the end of the index entry\n** is ignored as well.  Hence, this routine only compares the prefixes \n** of the keys prior to the final rowid, not the entire key.\n*/\nint sqlite3VdbeIdxKeyCompare(\n  sqlite3 *db,                     /* Database connection */\n  VdbeCursor *pC,                  /* The cursor to compare against */\n  UnpackedRecord *pUnpacked,       /* Unpacked version of key */\n  int *res                         /* Write the comparison result here */\n){\n  i64 nCellKey = 0;\n  int rc;\n  BtCursor *pCur;\n  Mem m;\n\n  assert( pC->eCurType==CURTYPE_BTREE );\n  pCur = pC->uc.pCursor;\n  assert( sqlite3BtreeCursorIsValid(pCur) );\n  nCellKey = sqlite3BtreePayloadSize(pCur);\n  /* nCellKey will always be between 0 and 0xffffffff because of the way\n  ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */\n  if( nCellKey<=0 || nCellKey>0x7fffffff ){\n    *res = 0;\n    return SQLITE_CORRUPT_BKPT;\n  }\n  sqlite3VdbeMemInit(&m, db, 0);\n  rc = sqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, 1, &m);\n  if( rc ){\n    return rc;\n  }\n  *res = sqlite3VdbeRecordCompare(m.n, m.z, pUnpacked);\n  sqlite3VdbeMemRelease(&m);\n  return SQLITE_OK;\n}\n\n/*\n** This routine sets the value to be returned by subsequent calls to\n** sqlite3_changes() on the database handle 'db'. \n*/\nvoid sqlite3VdbeSetChanges(sqlite3 *db, int nChange){\n  assert( sqlite3_mutex_held(db->mutex) );\n  db->nChange = nChange;\n  db->nTotalChange += nChange;\n}\n\n/*\n** Set a flag in the vdbe to update the change counter when it is finalised\n** or reset.\n*/\nvoid sqlite3VdbeCountChanges(Vdbe *v){\n  v->changeCntOn = 1;\n}\n\n/*\n** Mark every prepared statement associated with a database connection\n** as expired.\n**\n** An expired statement means that recompilation of the statement is\n** recommend.  Statements expire when things happen that make their\n** programs obsolete.  Removing user-defined functions or collating\n** sequences, or changing an authorization function are the types of\n** things that make prepared statements obsolete.\n*/\nvoid sqlite3ExpirePreparedStatements(sqlite3 *db){\n  Vdbe *p;\n  for(p = db->pVdbe; p; p=p->pNext){\n    p->expired = 1;\n  }\n}\n\n/*\n** Return the database associated with the Vdbe.\n*/\nsqlite3 *sqlite3VdbeDb(Vdbe *v){\n  return v->db;\n}\n\n/*\n** Return a pointer to an sqlite3_value structure containing the value bound\n** parameter iVar of VM v. Except, if the value is an SQL NULL, return \n** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_*\n** constants) to the value before returning it.\n**\n** The returned value must be freed by the caller using sqlite3ValueFree().\n*/\nsqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){\n  assert( iVar>0 );\n  if( v ){\n    Mem *pMem = &v->aVar[iVar-1];\n    if( 0==(pMem->flags & MEM_Null) ){\n      sqlite3_value *pRet = sqlite3ValueNew(v->db);\n      if( pRet ){\n        sqlite3VdbeMemCopy((Mem *)pRet, pMem);\n        sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8);\n      }\n      return pRet;\n    }\n  }\n  return 0;\n}\n\n/*\n** Configure SQL variable iVar so that binding a new value to it signals\n** to sqlite3_reoptimize() that re-preparing the statement may result\n** in a better query plan.\n*/\nvoid sqlite3VdbeSetVarmask(Vdbe *v, int iVar){\n  assert( iVar>0 );\n  if( iVar>32 ){\n    v->expmask = 0xffffffff;\n  }else{\n    v->expmask |= ((u32)1 << (iVar-1));\n  }\n}\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/*\n** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored\n** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored\n** in memory obtained from sqlite3DbMalloc).\n*/\nvoid sqlite3VtabImportErrmsg(Vdbe *p, sqlite3_vtab *pVtab){\n  if( pVtab->zErrMsg ){\n    sqlite3 *db = p->db;\n    sqlite3DbFree(db, p->zErrMsg);\n    p->zErrMsg = sqlite3DbStrDup(db, pVtab->zErrMsg);\n    sqlite3_free(pVtab->zErrMsg);\n    pVtab->zErrMsg = 0;\n  }\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n\n/*\n** If the second argument is not NULL, release any allocations associated \n** with the memory cells in the p->aMem[] array. Also free the UnpackedRecord\n** structure itself, using sqlite3DbFree().\n**\n** This function is used to free UnpackedRecord structures allocated by\n** the vdbeUnpackRecord() function found in vdbeapi.c.\n*/\nstatic void vdbeFreeUnpacked(sqlite3 *db, UnpackedRecord *p){\n  if( p ){\n    int i;\n    for(i=0; i<p->nField; i++){\n      Mem *pMem = &p->aMem[i];\n      if( pMem->zMalloc ) sqlite3VdbeMemRelease(pMem);\n    }\n    sqlite3DbFree(db, p);\n  }\n}\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n/*\n** Invoke the pre-update hook. If this is an UPDATE or DELETE pre-update call,\n** then cursor passed as the second argument should point to the row about\n** to be update or deleted. If the application calls sqlite3_preupdate_old(),\n** the required value will be read from the row the cursor points to.\n*/\nvoid sqlite3VdbePreUpdateHook(\n  Vdbe *v,                        /* Vdbe pre-update hook is invoked by */\n  VdbeCursor *pCsr,               /* Cursor to grab old.* values from */\n  int op,                         /* SQLITE_INSERT, UPDATE or DELETE */\n  const char *zDb,                /* Database name */\n  Table *pTab,                    /* Modified table */\n  i64 iKey1,                      /* Initial key value */\n  int iReg                        /* Register for new.* record */\n){\n  sqlite3 *db = v->db;\n  i64 iKey2;\n  PreUpdate preupdate;\n  const char *zTbl = pTab->zName;\n  static const u8 fakeSortOrder = 0;\n\n  assert( db->pPreUpdate==0 );\n  memset(&preupdate, 0, sizeof(PreUpdate));\n  if( op==SQLITE_UPDATE ){\n    iKey2 = v->aMem[iReg].u.i;\n  }else{\n    iKey2 = iKey1;\n  }\n\n  assert( pCsr->nField==pTab->nCol \n       || (pCsr->nField==pTab->nCol+1 && op==SQLITE_DELETE && iReg==-1)\n  );\n\n  preupdate.v = v;\n  preupdate.pCsr = pCsr;\n  preupdate.op = op;\n  preupdate.iNewReg = iReg;\n  preupdate.keyinfo.db = db;\n  preupdate.keyinfo.enc = ENC(db);\n  preupdate.keyinfo.nField = pTab->nCol;\n  preupdate.keyinfo.aSortOrder = (u8*)&fakeSortOrder;\n  preupdate.iKey1 = iKey1;\n  preupdate.iKey2 = iKey2;\n  preupdate.pTab = pTab;\n\n  db->pPreUpdate = &preupdate;\n  db->xPreUpdateCallback(db->pPreUpdateArg, db, op, zDb, zTbl, iKey1, iKey2);\n  db->pPreUpdate = 0;\n  sqlite3DbFree(db, preupdate.aRecord);\n  vdbeFreeUnpacked(db, preupdate.pUnpacked);\n  vdbeFreeUnpacked(db, preupdate.pNewUnpacked);\n  if( preupdate.aNew ){\n    int i;\n    for(i=0; i<pCsr->nField; i++){\n      sqlite3VdbeMemRelease(&preupdate.aNew[i]);\n    }\n    sqlite3DbFree(db, preupdate.aNew);\n  }\n}\n#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbeblob.c",
    "content": "/*\n** 2007 May 1\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains code used to implement incremental BLOB I/O.\n*/\n\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n#ifndef SQLITE_OMIT_INCRBLOB\n\n/*\n** Valid sqlite3_blob* handles point to Incrblob structures.\n*/\ntypedef struct Incrblob Incrblob;\nstruct Incrblob {\n  int flags;              /* Copy of \"flags\" passed to sqlite3_blob_open() */\n  int nByte;              /* Size of open blob, in bytes */\n  int iOffset;            /* Byte offset of blob in cursor data */\n  int iCol;               /* Table column this handle is open on */\n  BtCursor *pCsr;         /* Cursor pointing at blob row */\n  sqlite3_stmt *pStmt;    /* Statement holding cursor open */\n  sqlite3 *db;            /* The associated database */\n  char *zDb;              /* Database name */\n  Table *pTab;            /* Table object */\n};\n\n\n/*\n** This function is used by both blob_open() and blob_reopen(). It seeks\n** the b-tree cursor associated with blob handle p to point to row iRow.\n** If successful, SQLITE_OK is returned and subsequent calls to\n** sqlite3_blob_read() or sqlite3_blob_write() access the specified row.\n**\n** If an error occurs, or if the specified row does not exist or does not\n** contain a value of type TEXT or BLOB in the column nominated when the\n** blob handle was opened, then an error code is returned and *pzErr may\n** be set to point to a buffer containing an error message. It is the\n** responsibility of the caller to free the error message buffer using\n** sqlite3DbFree().\n**\n** If an error does occur, then the b-tree cursor is closed. All subsequent\n** calls to sqlite3_blob_read(), blob_write() or blob_reopen() will \n** immediately return SQLITE_ABORT.\n*/\nstatic int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){\n  int rc;                         /* Error code */\n  char *zErr = 0;                 /* Error message */\n  Vdbe *v = (Vdbe *)p->pStmt;\n\n  /* Set the value of the SQL statements only variable to integer iRow. \n  ** This is done directly instead of using sqlite3_bind_int64() to avoid \n  ** triggering asserts related to mutexes.\n  */\n  assert( v->aVar[0].flags&MEM_Int );\n  v->aVar[0].u.i = iRow;\n\n  rc = sqlite3_step(p->pStmt);\n  if( rc==SQLITE_ROW ){\n    VdbeCursor *pC = v->apCsr[0];\n    u32 type = pC->aType[p->iCol];\n    if( type<12 ){\n      zErr = sqlite3MPrintf(p->db, \"cannot open value of type %s\",\n          type==0?\"null\": type==7?\"real\": \"integer\"\n      );\n      rc = SQLITE_ERROR;\n      sqlite3_finalize(p->pStmt);\n      p->pStmt = 0;\n    }else{\n      p->iOffset = pC->aType[p->iCol + pC->nField];\n      p->nByte = sqlite3VdbeSerialTypeLen(type);\n      p->pCsr =  pC->uc.pCursor;\n      sqlite3BtreeIncrblobCursor(p->pCsr);\n    }\n  }\n\n  if( rc==SQLITE_ROW ){\n    rc = SQLITE_OK;\n  }else if( p->pStmt ){\n    rc = sqlite3_finalize(p->pStmt);\n    p->pStmt = 0;\n    if( rc==SQLITE_OK ){\n      zErr = sqlite3MPrintf(p->db, \"no such rowid: %lld\", iRow);\n      rc = SQLITE_ERROR;\n    }else{\n      zErr = sqlite3MPrintf(p->db, \"%s\", sqlite3_errmsg(p->db));\n    }\n  }\n\n  assert( rc!=SQLITE_OK || zErr==0 );\n  assert( rc!=SQLITE_ROW && rc!=SQLITE_DONE );\n\n  *pzErr = zErr;\n  return rc;\n}\n\n/*\n** Open a blob handle.\n*/\nint sqlite3_blob_open(\n  sqlite3* db,            /* The database connection */\n  const char *zDb,        /* The attached database containing the blob */\n  const char *zTable,     /* The table containing the blob */\n  const char *zColumn,    /* The column containing the blob */\n  sqlite_int64 iRow,      /* The row containing the glob */\n  int flags,              /* True -> read/write access, false -> read-only */\n  sqlite3_blob **ppBlob   /* Handle for accessing the blob returned here */\n){\n  int nAttempt = 0;\n  int iCol;               /* Index of zColumn in row-record */\n  int rc = SQLITE_OK;\n  char *zErr = 0;\n  Table *pTab;\n  Parse *pParse = 0;\n  Incrblob *pBlob = 0;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( ppBlob==0 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  *ppBlob = 0;\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zTable==0 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  flags = !!flags;                /* flags = (flags ? 1 : 0); */\n\n  sqlite3_mutex_enter(db->mutex);\n\n  pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob));\n  if( !pBlob ) goto blob_open_out;\n  pParse = sqlite3StackAllocRaw(db, sizeof(*pParse));\n  if( !pParse ) goto blob_open_out;\n\n  do {\n    memset(pParse, 0, sizeof(Parse));\n    pParse->db = db;\n    sqlite3DbFree(db, zErr);\n    zErr = 0;\n\n    sqlite3BtreeEnterAll(db);\n    pTab = sqlite3LocateTable(pParse, 0, zTable, zDb);\n    if( pTab && IsVirtual(pTab) ){\n      pTab = 0;\n      sqlite3ErrorMsg(pParse, \"cannot open virtual table: %s\", zTable);\n    }\n    if( pTab && !HasRowid(pTab) ){\n      pTab = 0;\n      sqlite3ErrorMsg(pParse, \"cannot open table without rowid: %s\", zTable);\n    }\n#ifndef SQLITE_OMIT_VIEW\n    if( pTab && pTab->pSelect ){\n      pTab = 0;\n      sqlite3ErrorMsg(pParse, \"cannot open view: %s\", zTable);\n    }\n#endif\n    if( !pTab ){\n      if( pParse->zErrMsg ){\n        sqlite3DbFree(db, zErr);\n        zErr = pParse->zErrMsg;\n        pParse->zErrMsg = 0;\n      }\n      rc = SQLITE_ERROR;\n      sqlite3BtreeLeaveAll(db);\n      goto blob_open_out;\n    }\n    pBlob->pTab = pTab;\n    pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName;\n\n    /* Now search pTab for the exact column. */\n    for(iCol=0; iCol<pTab->nCol; iCol++) {\n      if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){\n        break;\n      }\n    }\n    if( iCol==pTab->nCol ){\n      sqlite3DbFree(db, zErr);\n      zErr = sqlite3MPrintf(db, \"no such column: \\\"%s\\\"\", zColumn);\n      rc = SQLITE_ERROR;\n      sqlite3BtreeLeaveAll(db);\n      goto blob_open_out;\n    }\n\n    /* If the value is being opened for writing, check that the\n    ** column is not indexed, and that it is not part of a foreign key. \n    ** It is against the rules to open a column to which either of these\n    ** descriptions applies for writing.  */\n    if( flags ){\n      const char *zFault = 0;\n      Index *pIdx;\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n      if( db->flags&SQLITE_ForeignKeys ){\n        /* Check that the column is not part of an FK child key definition. It\n        ** is not necessary to check if it is part of a parent key, as parent\n        ** key columns must be indexed. The check below will pick up this \n        ** case.  */\n        FKey *pFKey;\n        for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){\n          int j;\n          for(j=0; j<pFKey->nCol; j++){\n            if( pFKey->aCol[j].iFrom==iCol ){\n              zFault = \"foreign key\";\n            }\n          }\n        }\n      }\n#endif\n      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n        int j;\n        for(j=0; j<pIdx->nKeyCol; j++){\n          /* FIXME: Be smarter about indexes that use expressions */\n          if( pIdx->aiColumn[j]==iCol || pIdx->aiColumn[j]==XN_EXPR ){\n            zFault = \"indexed\";\n          }\n        }\n      }\n      if( zFault ){\n        sqlite3DbFree(db, zErr);\n        zErr = sqlite3MPrintf(db, \"cannot open %s column for writing\", zFault);\n        rc = SQLITE_ERROR;\n        sqlite3BtreeLeaveAll(db);\n        goto blob_open_out;\n      }\n    }\n\n    pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(pParse);\n    assert( pBlob->pStmt || db->mallocFailed );\n    if( pBlob->pStmt ){\n      \n      /* This VDBE program seeks a btree cursor to the identified \n      ** db/table/row entry. The reason for using a vdbe program instead\n      ** of writing code to use the b-tree layer directly is that the\n      ** vdbe program will take advantage of the various transaction,\n      ** locking and error handling infrastructure built into the vdbe.\n      **\n      ** After seeking the cursor, the vdbe executes an OP_ResultRow.\n      ** Code external to the Vdbe then \"borrows\" the b-tree cursor and\n      ** uses it to implement the blob_read(), blob_write() and \n      ** blob_bytes() functions.\n      **\n      ** The sqlite3_blob_close() function finalizes the vdbe program,\n      ** which closes the b-tree cursor and (possibly) commits the \n      ** transaction.\n      */\n      static const int iLn = VDBE_OFFSET_LINENO(2);\n      static const VdbeOpList openBlob[] = {\n        {OP_TableLock,      0, 0, 0},  /* 0: Acquire a read or write lock */\n        {OP_OpenRead,       0, 0, 0},  /* 1: Open a cursor */\n        {OP_Variable,       1, 1, 0},  /* 2: Move ?1 into reg[1] */\n        {OP_NotExists,      0, 7, 1},  /* 3: Seek the cursor */\n        {OP_Column,         0, 0, 1},  /* 4  */\n        {OP_ResultRow,      1, 0, 0},  /* 5  */\n        {OP_Goto,           0, 2, 0},  /* 6  */\n        {OP_Close,          0, 0, 0},  /* 7  */\n        {OP_Halt,           0, 0, 0},  /* 8  */\n      };\n      Vdbe *v = (Vdbe *)pBlob->pStmt;\n      int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n      VdbeOp *aOp;\n\n      sqlite3VdbeAddOp4Int(v, OP_Transaction, iDb, flags, \n                           pTab->pSchema->schema_cookie,\n                           pTab->pSchema->iGeneration);\n      sqlite3VdbeChangeP5(v, 1);     \n      aOp = sqlite3VdbeAddOpList(v, ArraySize(openBlob), openBlob, iLn);\n\n      /* Make sure a mutex is held on the table to be accessed */\n      sqlite3VdbeUsesBtree(v, iDb); \n\n      if( db->mallocFailed==0 ){\n        assert( aOp!=0 );\n        /* Configure the OP_TableLock instruction */\n#ifdef SQLITE_OMIT_SHARED_CACHE\n        aOp[0].opcode = OP_Noop;\n#else\n        aOp[0].p1 = iDb;\n        aOp[0].p2 = pTab->tnum;\n        aOp[0].p3 = flags;\n        sqlite3VdbeChangeP4(v, 1, pTab->zName, P4_TRANSIENT);\n      }\n      if( db->mallocFailed==0 ){\n#endif\n\n        /* Remove either the OP_OpenWrite or OpenRead. Set the P2 \n        ** parameter of the other to pTab->tnum.  */\n        if( flags ) aOp[1].opcode = OP_OpenWrite;\n        aOp[1].p2 = pTab->tnum;\n        aOp[1].p3 = iDb;   \n\n        /* Configure the number of columns. Configure the cursor to\n        ** think that the table has one more column than it really\n        ** does. An OP_Column to retrieve this imaginary column will\n        ** always return an SQL NULL. This is useful because it means\n        ** we can invoke OP_Column to fill in the vdbe cursors type \n        ** and offset cache without causing any IO.\n        */\n        aOp[1].p4type = P4_INT32;\n        aOp[1].p4.i = pTab->nCol+1;\n        aOp[4].p2 = pTab->nCol;\n\n        pParse->nVar = 1;\n        pParse->nMem = 1;\n        pParse->nTab = 1;\n        sqlite3VdbeMakeReady(v, pParse);\n      }\n    }\n   \n    pBlob->flags = flags;\n    pBlob->iCol = iCol;\n    pBlob->db = db;\n    sqlite3BtreeLeaveAll(db);\n    if( db->mallocFailed ){\n      goto blob_open_out;\n    }\n    sqlite3_bind_int64(pBlob->pStmt, 1, iRow);\n    rc = blobSeekToRow(pBlob, iRow, &zErr);\n  } while( (++nAttempt)<SQLITE_MAX_SCHEMA_RETRY && rc==SQLITE_SCHEMA );\n\nblob_open_out:\n  if( rc==SQLITE_OK && db->mallocFailed==0 ){\n    *ppBlob = (sqlite3_blob *)pBlob;\n  }else{\n    if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt);\n    sqlite3DbFree(db, pBlob);\n  }\n  sqlite3ErrorWithMsg(db, rc, (zErr ? \"%s\" : 0), zErr);\n  sqlite3DbFree(db, zErr);\n  sqlite3ParserReset(pParse);\n  sqlite3StackFree(db, pParse);\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** Close a blob handle that was previously created using\n** sqlite3_blob_open().\n*/\nint sqlite3_blob_close(sqlite3_blob *pBlob){\n  Incrblob *p = (Incrblob *)pBlob;\n  int rc;\n  sqlite3 *db;\n\n  if( p ){\n    db = p->db;\n    sqlite3_mutex_enter(db->mutex);\n    rc = sqlite3_finalize(p->pStmt);\n    sqlite3DbFree(db, p);\n    sqlite3_mutex_leave(db->mutex);\n  }else{\n    rc = SQLITE_OK;\n  }\n  return rc;\n}\n\n/*\n** Perform a read or write operation on a blob\n*/\nstatic int blobReadWrite(\n  sqlite3_blob *pBlob, \n  void *z, \n  int n, \n  int iOffset, \n  int (*xCall)(BtCursor*, u32, u32, void*)\n){\n  int rc;\n  Incrblob *p = (Incrblob *)pBlob;\n  Vdbe *v;\n  sqlite3 *db;\n\n  if( p==0 ) return SQLITE_MISUSE_BKPT;\n  db = p->db;\n  sqlite3_mutex_enter(db->mutex);\n  v = (Vdbe*)p->pStmt;\n\n  if( n<0 || iOffset<0 || ((sqlite3_int64)iOffset+n)>p->nByte ){\n    /* Request is out of range. Return a transient error. */\n    rc = SQLITE_ERROR;\n  }else if( v==0 ){\n    /* If there is no statement handle, then the blob-handle has\n    ** already been invalidated. Return SQLITE_ABORT in this case.\n    */\n    rc = SQLITE_ABORT;\n  }else{\n    /* Call either BtreeData() or BtreePutData(). If SQLITE_ABORT is\n    ** returned, clean-up the statement handle.\n    */\n    assert( db == v->db );\n    sqlite3BtreeEnterCursor(p->pCsr);\n\n#ifdef SQLITE_ENABLE_PREUPDATE_HOOK\n    if( xCall==sqlite3BtreePutData && db->xPreUpdateCallback ){\n      /* If a pre-update hook is registered and this is a write cursor, \n      ** invoke it here. \n      ** \n      ** TODO: The preupdate-hook is passed SQLITE_DELETE, even though this\n      ** operation should really be an SQLITE_UPDATE. This is probably\n      ** incorrect, but is convenient because at this point the new.* values \n      ** are not easily obtainable. And for the sessions module, an \n      ** SQLITE_UPDATE where the PK columns do not change is handled in the \n      ** same way as an SQLITE_DELETE (the SQLITE_DELETE code is actually\n      ** slightly more efficient). Since you cannot write to a PK column\n      ** using the incremental-blob API, this works. For the sessions module\n      ** anyhow.\n      */\n      sqlite3_int64 iKey;\n      iKey = sqlite3BtreeIntegerKey(p->pCsr);\n      sqlite3VdbePreUpdateHook(\n          v, v->apCsr[0], SQLITE_DELETE, p->zDb, p->pTab, iKey, -1\n      );\n    }\n#endif\n\n    rc = xCall(p->pCsr, iOffset+p->iOffset, n, z);\n    sqlite3BtreeLeaveCursor(p->pCsr);\n    if( rc==SQLITE_ABORT ){\n      sqlite3VdbeFinalize(v);\n      p->pStmt = 0;\n    }else{\n      v->rc = rc;\n    }\n  }\n  sqlite3Error(db, rc);\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** Read data from a blob handle.\n*/\nint sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){\n  return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData);\n}\n\n/*\n** Write data to a blob handle.\n*/\nint sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){\n  return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData);\n}\n\n/*\n** Query a blob handle for the size of the data.\n**\n** The Incrblob.nByte field is fixed for the lifetime of the Incrblob\n** so no mutex is required for access.\n*/\nint sqlite3_blob_bytes(sqlite3_blob *pBlob){\n  Incrblob *p = (Incrblob *)pBlob;\n  return (p && p->pStmt) ? p->nByte : 0;\n}\n\n/*\n** Move an existing blob handle to point to a different row of the same\n** database table.\n**\n** If an error occurs, or if the specified row does not exist or does not\n** contain a blob or text value, then an error code is returned and the\n** database handle error code and message set. If this happens, then all \n** subsequent calls to sqlite3_blob_xxx() functions (except blob_close()) \n** immediately return SQLITE_ABORT.\n*/\nint sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){\n  int rc;\n  Incrblob *p = (Incrblob *)pBlob;\n  sqlite3 *db;\n\n  if( p==0 ) return SQLITE_MISUSE_BKPT;\n  db = p->db;\n  sqlite3_mutex_enter(db->mutex);\n\n  if( p->pStmt==0 ){\n    /* If there is no statement handle, then the blob-handle has\n    ** already been invalidated. Return SQLITE_ABORT in this case.\n    */\n    rc = SQLITE_ABORT;\n  }else{\n    char *zErr;\n    rc = blobSeekToRow(p, iRow, &zErr);\n    if( rc!=SQLITE_OK ){\n      sqlite3ErrorWithMsg(db, rc, (zErr ? \"%s\" : 0), zErr);\n      sqlite3DbFree(db, zErr);\n    }\n    assert( rc!=SQLITE_SCHEMA );\n  }\n\n  rc = sqlite3ApiExit(db, rc);\n  assert( rc==SQLITE_OK || p->pStmt==0 );\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n#endif /* #ifndef SQLITE_OMIT_INCRBLOB */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbemem.c",
    "content": "/*\n** 2004 May 26\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains code use to manipulate \"Mem\" structure.  A \"Mem\"\n** stores a single value in the VDBE.  Mem is an opaque structure visible\n** only within the VDBE.  Interface routines refer to a Mem using the\n** name sqlite_value\n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n#ifdef SQLITE_DEBUG\n/*\n** Check invariants on a Mem object.\n**\n** This routine is intended for use inside of assert() statements, like\n** this:    assert( sqlite3VdbeCheckMemInvariants(pMem) );\n*/\nint sqlite3VdbeCheckMemInvariants(Mem *p){\n  /* If MEM_Dyn is set then Mem.xDel!=0.  \n  ** Mem.xDel is might not be initialized if MEM_Dyn is clear.\n  */\n  assert( (p->flags & MEM_Dyn)==0 || p->xDel!=0 );\n\n  /* MEM_Dyn may only be set if Mem.szMalloc==0.  In this way we\n  ** ensure that if Mem.szMalloc>0 then it is safe to do\n  ** Mem.z = Mem.zMalloc without having to check Mem.flags&MEM_Dyn.\n  ** That saves a few cycles in inner loops. */\n  assert( (p->flags & MEM_Dyn)==0 || p->szMalloc==0 );\n\n  /* Cannot be both MEM_Int and MEM_Real at the same time */\n  assert( (p->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real) );\n\n  /* The szMalloc field holds the correct memory allocation size */\n  assert( p->szMalloc==0\n       || p->szMalloc==sqlite3DbMallocSize(p->db,p->zMalloc) );\n\n  /* If p holds a string or blob, the Mem.z must point to exactly\n  ** one of the following:\n  **\n  **   (1) Memory in Mem.zMalloc and managed by the Mem object\n  **   (2) Memory to be freed using Mem.xDel\n  **   (3) An ephemeral string or blob\n  **   (4) A static string or blob\n  */\n  if( (p->flags & (MEM_Str|MEM_Blob)) && p->n>0 ){\n    assert( \n      ((p->szMalloc>0 && p->z==p->zMalloc)? 1 : 0) +\n      ((p->flags&MEM_Dyn)!=0 ? 1 : 0) +\n      ((p->flags&MEM_Ephem)!=0 ? 1 : 0) +\n      ((p->flags&MEM_Static)!=0 ? 1 : 0) == 1\n    );\n  }\n  return 1;\n}\n#endif\n\n\n/*\n** If pMem is an object with a valid string representation, this routine\n** ensures the internal encoding for the string representation is\n** 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE.\n**\n** If pMem is not a string object, or the encoding of the string\n** representation is already stored using the requested encoding, then this\n** routine is a no-op.\n**\n** SQLITE_OK is returned if the conversion is successful (or not required).\n** SQLITE_NOMEM may be returned if a malloc() fails during conversion\n** between formats.\n*/\nint sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){\n#ifndef SQLITE_OMIT_UTF16\n  int rc;\n#endif\n  assert( (pMem->flags&MEM_RowSet)==0 );\n  assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE\n           || desiredEnc==SQLITE_UTF16BE );\n  if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){\n    return SQLITE_OK;\n  }\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n#ifdef SQLITE_OMIT_UTF16\n  return SQLITE_ERROR;\n#else\n\n  /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned,\n  ** then the encoding of the value may not have changed.\n  */\n  rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc);\n  assert(rc==SQLITE_OK    || rc==SQLITE_NOMEM);\n  assert(rc==SQLITE_OK    || pMem->enc!=desiredEnc);\n  assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);\n  return rc;\n#endif\n}\n\n/*\n** Make sure pMem->z points to a writable allocation of at least \n** min(n,32) bytes.\n**\n** If the bPreserve argument is true, then copy of the content of\n** pMem->z into the new allocation.  pMem must be either a string or\n** blob if bPreserve is true.  If bPreserve is false, any prior content\n** in pMem->z is discarded.\n*/\nSQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){\n  assert( sqlite3VdbeCheckMemInvariants(pMem) );\n  assert( (pMem->flags&MEM_RowSet)==0 );\n  testcase( pMem->db==0 );\n\n  /* If the bPreserve flag is set to true, then the memory cell must already\n  ** contain a valid string or blob value.  */\n  assert( bPreserve==0 || pMem->flags&(MEM_Blob|MEM_Str) );\n  testcase( bPreserve && pMem->z==0 );\n\n  assert( pMem->szMalloc==0\n       || pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) );\n  if( pMem->szMalloc<n ){\n    if( n<32 ) n = 32;\n    if( bPreserve && pMem->szMalloc>0 && pMem->z==pMem->zMalloc ){\n      pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);\n      bPreserve = 0;\n    }else{\n      if( pMem->szMalloc>0 ) sqlite3DbFree(pMem->db, pMem->zMalloc);\n      pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);\n    }\n    if( pMem->zMalloc==0 ){\n      sqlite3VdbeMemSetNull(pMem);\n      pMem->z = 0;\n      pMem->szMalloc = 0;\n      return SQLITE_NOMEM_BKPT;\n    }else{\n      pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);\n    }\n  }\n\n  if( bPreserve && pMem->z && pMem->z!=pMem->zMalloc ){\n    memcpy(pMem->zMalloc, pMem->z, pMem->n);\n  }\n  if( (pMem->flags&MEM_Dyn)!=0 ){\n    assert( pMem->xDel!=0 && pMem->xDel!=SQLITE_DYNAMIC );\n    pMem->xDel((void *)(pMem->z));\n  }\n\n  pMem->z = pMem->zMalloc;\n  pMem->flags &= ~(MEM_Dyn|MEM_Ephem|MEM_Static);\n  return SQLITE_OK;\n}\n\n/*\n** Change the pMem->zMalloc allocation to be at least szNew bytes.\n** If pMem->zMalloc already meets or exceeds the requested size, this\n** routine is a no-op.\n**\n** Any prior string or blob content in the pMem object may be discarded.\n** The pMem->xDel destructor is called, if it exists.  Though MEM_Str\n** and MEM_Blob values may be discarded, MEM_Int, MEM_Real, and MEM_Null\n** values are preserved.\n**\n** Return SQLITE_OK on success or an error code (probably SQLITE_NOMEM)\n** if unable to complete the resizing.\n*/\nint sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){\n  assert( szNew>0 );\n  assert( (pMem->flags & MEM_Dyn)==0 || pMem->szMalloc==0 );\n  if( pMem->szMalloc<szNew ){\n    return sqlite3VdbeMemGrow(pMem, szNew, 0);\n  }\n  assert( (pMem->flags & MEM_Dyn)==0 );\n  pMem->z = pMem->zMalloc;\n  pMem->flags &= (MEM_Null|MEM_Int|MEM_Real);\n  return SQLITE_OK;\n}\n\n/*\n** Change pMem so that its MEM_Str or MEM_Blob value is stored in\n** MEM.zMalloc, where it can be safely written.\n**\n** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.\n*/\nint sqlite3VdbeMemMakeWriteable(Mem *pMem){\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( (pMem->flags&MEM_RowSet)==0 );\n  if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){\n    if( ExpandBlob(pMem) ) return SQLITE_NOMEM;\n    if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){\n      if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){\n        return SQLITE_NOMEM_BKPT;\n      }\n      pMem->z[pMem->n] = 0;\n      pMem->z[pMem->n+1] = 0;\n      pMem->flags |= MEM_Term;\n    }\n  }\n  pMem->flags &= ~MEM_Ephem;\n#ifdef SQLITE_DEBUG\n  pMem->pScopyFrom = 0;\n#endif\n\n  return SQLITE_OK;\n}\n\n/*\n** If the given Mem* has a zero-filled tail, turn it into an ordinary\n** blob stored in dynamically allocated space.\n*/\n#ifndef SQLITE_OMIT_INCRBLOB\nint sqlite3VdbeMemExpandBlob(Mem *pMem){\n  int nByte;\n  assert( pMem->flags & MEM_Zero );\n  assert( pMem->flags&MEM_Blob );\n  assert( (pMem->flags&MEM_RowSet)==0 );\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n\n  /* Set nByte to the number of bytes required to store the expanded blob. */\n  nByte = pMem->n + pMem->u.nZero;\n  if( nByte<=0 ){\n    nByte = 1;\n  }\n  if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  memset(&pMem->z[pMem->n], 0, pMem->u.nZero);\n  pMem->n += pMem->u.nZero;\n  pMem->flags &= ~(MEM_Zero|MEM_Term);\n  return SQLITE_OK;\n}\n#endif\n\n/*\n** It is already known that pMem contains an unterminated string.\n** Add the zero terminator.\n*/\nstatic SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){\n  if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  pMem->z[pMem->n] = 0;\n  pMem->z[pMem->n+1] = 0;\n  pMem->flags |= MEM_Term;\n  return SQLITE_OK;\n}\n\n/*\n** Make sure the given Mem is \\u0000 terminated.\n*/\nint sqlite3VdbeMemNulTerminate(Mem *pMem){\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  testcase( (pMem->flags & (MEM_Term|MEM_Str))==(MEM_Term|MEM_Str) );\n  testcase( (pMem->flags & (MEM_Term|MEM_Str))==0 );\n  if( (pMem->flags & (MEM_Term|MEM_Str))!=MEM_Str ){\n    return SQLITE_OK;   /* Nothing to do */\n  }else{\n    return vdbeMemAddTerminator(pMem);\n  }\n}\n\n/*\n** Add MEM_Str to the set of representations for the given Mem.  Numbers\n** are converted using sqlite3_snprintf().  Converting a BLOB to a string\n** is a no-op.\n**\n** Existing representations MEM_Int and MEM_Real are invalidated if\n** bForce is true but are retained if bForce is false.\n**\n** A MEM_Null value will never be passed to this function. This function is\n** used for converting values to text for returning to the user (i.e. via\n** sqlite3_value_text()), or for ensuring that values to be used as btree\n** keys are strings. In the former case a NULL pointer is returned the\n** user and the latter is an internal programming error.\n*/\nint sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){\n  int fg = pMem->flags;\n  const int nByte = 32;\n\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( !(fg&MEM_Zero) );\n  assert( !(fg&(MEM_Str|MEM_Blob)) );\n  assert( fg&(MEM_Int|MEM_Real) );\n  assert( (pMem->flags&MEM_RowSet)==0 );\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\n\n\n  if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){\n    pMem->enc = 0;\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  /* For a Real or Integer, use sqlite3_snprintf() to produce the UTF-8\n  ** string representation of the value. Then, if the required encoding\n  ** is UTF-16le or UTF-16be do a translation.\n  ** \n  ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.\n  */\n  if( fg & MEM_Int ){\n    sqlite3_snprintf(nByte, pMem->z, \"%lld\", pMem->u.i);\n  }else{\n    assert( fg & MEM_Real );\n    sqlite3_snprintf(nByte, pMem->z, \"%!.15g\", pMem->u.r);\n  }\n  pMem->n = sqlite3Strlen30(pMem->z);\n  pMem->enc = SQLITE_UTF8;\n  pMem->flags |= MEM_Str|MEM_Term;\n  if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real);\n  sqlite3VdbeChangeEncoding(pMem, enc);\n  return SQLITE_OK;\n}\n\n/*\n** Memory cell pMem contains the context of an aggregate function.\n** This routine calls the finalize method for that function.  The\n** result of the aggregate is stored back into pMem.\n**\n** Return SQLITE_ERROR if the finalizer reports an error.  SQLITE_OK\n** otherwise.\n*/\nint sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){\n  int rc = SQLITE_OK;\n  if( ALWAYS(pFunc && pFunc->xFinalize) ){\n    sqlite3_context ctx;\n    Mem t;\n    assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );\n    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n    memset(&ctx, 0, sizeof(ctx));\n    memset(&t, 0, sizeof(t));\n    t.flags = MEM_Null;\n    t.db = pMem->db;\n    ctx.pOut = &t;\n    ctx.pMem = pMem;\n    ctx.pFunc = pFunc;\n    pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */\n    assert( (pMem->flags & MEM_Dyn)==0 );\n    if( pMem->szMalloc>0 ) sqlite3DbFree(pMem->db, pMem->zMalloc);\n    memcpy(pMem, &t, sizeof(t));\n    rc = ctx.isError;\n  }\n  return rc;\n}\n\n/*\n** If the memory cell contains a value that must be freed by\n** invoking the external callback in Mem.xDel, then this routine\n** will free that value.  It also sets Mem.flags to MEM_Null.\n**\n** This is a helper routine for sqlite3VdbeMemSetNull() and\n** for sqlite3VdbeMemRelease().  Use those other routines as the\n** entry point for releasing Mem resources.\n*/\nstatic SQLITE_NOINLINE void vdbeMemClearExternAndSetNull(Mem *p){\n  assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) );\n  assert( VdbeMemDynamic(p) );\n  if( p->flags&MEM_Agg ){\n    sqlite3VdbeMemFinalize(p, p->u.pDef);\n    assert( (p->flags & MEM_Agg)==0 );\n    testcase( p->flags & MEM_Dyn );\n  }\n  if( p->flags&MEM_Dyn ){\n    assert( (p->flags&MEM_RowSet)==0 );\n    assert( p->xDel!=SQLITE_DYNAMIC && p->xDel!=0 );\n    p->xDel((void *)p->z);\n  }else if( p->flags&MEM_RowSet ){\n    sqlite3RowSetClear(p->u.pRowSet);\n  }else if( p->flags&MEM_Frame ){\n    VdbeFrame *pFrame = p->u.pFrame;\n    pFrame->pParent = pFrame->v->pDelFrame;\n    pFrame->v->pDelFrame = pFrame;\n  }\n  p->flags = MEM_Null;\n}\n\n/*\n** Release memory held by the Mem p, both external memory cleared\n** by p->xDel and memory in p->zMalloc.\n**\n** This is a helper routine invoked by sqlite3VdbeMemRelease() in\n** the unusual case where there really is memory in p that needs\n** to be freed.\n*/\nstatic SQLITE_NOINLINE void vdbeMemClear(Mem *p){\n  if( VdbeMemDynamic(p) ){\n    vdbeMemClearExternAndSetNull(p);\n  }\n  if( p->szMalloc ){\n    sqlite3DbFree(p->db, p->zMalloc);\n    p->szMalloc = 0;\n  }\n  p->z = 0;\n}\n\n/*\n** Release any memory resources held by the Mem.  Both the memory that is\n** free by Mem.xDel and the Mem.zMalloc allocation are freed.\n**\n** Use this routine prior to clean up prior to abandoning a Mem, or to\n** reset a Mem back to its minimum memory utilization.\n**\n** Use sqlite3VdbeMemSetNull() to release just the Mem.xDel space\n** prior to inserting new content into the Mem.\n*/\nvoid sqlite3VdbeMemRelease(Mem *p){\n  assert( sqlite3VdbeCheckMemInvariants(p) );\n  if( VdbeMemDynamic(p) || p->szMalloc ){\n    vdbeMemClear(p);\n  }\n}\n\n/*\n** Convert a 64-bit IEEE double into a 64-bit signed integer.\n** If the double is out of range of a 64-bit signed integer then\n** return the closest available 64-bit signed integer.\n*/\nstatic i64 doubleToInt64(double r){\n#ifdef SQLITE_OMIT_FLOATING_POINT\n  /* When floating-point is omitted, double and int64 are the same thing */\n  return r;\n#else\n  /*\n  ** Many compilers we encounter do not define constants for the\n  ** minimum and maximum 64-bit integers, or they define them\n  ** inconsistently.  And many do not understand the \"LL\" notation.\n  ** So we define our own static constants here using nothing\n  ** larger than a 32-bit integer constant.\n  */\n  static const i64 maxInt = LARGEST_INT64;\n  static const i64 minInt = SMALLEST_INT64;\n\n  if( r<=(double)minInt ){\n    return minInt;\n  }else if( r>=(double)maxInt ){\n    return maxInt;\n  }else{\n    return (i64)r;\n  }\n#endif\n}\n\n/*\n** Return some kind of integer value which is the best we can do\n** at representing the value that *pMem describes as an integer.\n** If pMem is an integer, then the value is exact.  If pMem is\n** a floating-point then the value returned is the integer part.\n** If pMem is a string or blob, then we make an attempt to convert\n** it into an integer and return that.  If pMem represents an\n** an SQL-NULL value, return 0.\n**\n** If pMem represents a string value, its encoding might be changed.\n*/\ni64 sqlite3VdbeIntValue(Mem *pMem){\n  int flags;\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\n  flags = pMem->flags;\n  if( flags & MEM_Int ){\n    return pMem->u.i;\n  }else if( flags & MEM_Real ){\n    return doubleToInt64(pMem->u.r);\n  }else if( flags & (MEM_Str|MEM_Blob) ){\n    i64 value = 0;\n    assert( pMem->z || pMem->n==0 );\n    sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);\n    return value;\n  }else{\n    return 0;\n  }\n}\n\n/*\n** Return the best representation of pMem that we can get into a\n** double.  If pMem is already a double or an integer, return its\n** value.  If it is a string or blob, try to convert it to a double.\n** If it is a NULL, return 0.0.\n*/\ndouble sqlite3VdbeRealValue(Mem *pMem){\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\n  if( pMem->flags & MEM_Real ){\n    return pMem->u.r;\n  }else if( pMem->flags & MEM_Int ){\n    return (double)pMem->u.i;\n  }else if( pMem->flags & (MEM_Str|MEM_Blob) ){\n    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\n    double val = (double)0;\n    sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc);\n    return val;\n  }else{\n    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */\n    return (double)0;\n  }\n}\n\n/*\n** The MEM structure is already a MEM_Real.  Try to also make it a\n** MEM_Int if we can.\n*/\nvoid sqlite3VdbeIntegerAffinity(Mem *pMem){\n  i64 ix;\n  assert( pMem->flags & MEM_Real );\n  assert( (pMem->flags & MEM_RowSet)==0 );\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\n\n  ix = doubleToInt64(pMem->u.r);\n\n  /* Only mark the value as an integer if\n  **\n  **    (1) the round-trip conversion real->int->real is a no-op, and\n  **    (2) The integer is neither the largest nor the smallest\n  **        possible integer (ticket #3922)\n  **\n  ** The second and third terms in the following conditional enforces\n  ** the second condition under the assumption that addition overflow causes\n  ** values to wrap around.\n  */\n  if( pMem->u.r==ix && ix>SMALLEST_INT64 && ix<LARGEST_INT64 ){\n    pMem->u.i = ix;\n    MemSetTypeFlag(pMem, MEM_Int);\n  }\n}\n\n/*\n** Convert pMem to type integer.  Invalidate any prior representations.\n*/\nint sqlite3VdbeMemIntegerify(Mem *pMem){\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( (pMem->flags & MEM_RowSet)==0 );\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\n\n  pMem->u.i = sqlite3VdbeIntValue(pMem);\n  MemSetTypeFlag(pMem, MEM_Int);\n  return SQLITE_OK;\n}\n\n/*\n** Convert pMem so that it is of type MEM_Real.\n** Invalidate any prior representations.\n*/\nint sqlite3VdbeMemRealify(Mem *pMem){\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( EIGHT_BYTE_ALIGNMENT(pMem) );\n\n  pMem->u.r = sqlite3VdbeRealValue(pMem);\n  MemSetTypeFlag(pMem, MEM_Real);\n  return SQLITE_OK;\n}\n\n/*\n** Convert pMem so that it has types MEM_Real or MEM_Int or both.\n** Invalidate any prior representations.\n**\n** Every effort is made to force the conversion, even if the input\n** is a string that does not look completely like a number.  Convert\n** as much of the string as we can and ignore the rest.\n*/\nint sqlite3VdbeMemNumerify(Mem *pMem){\n  if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){\n    assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );\n    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n    if( 0==sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc) ){\n      MemSetTypeFlag(pMem, MEM_Int);\n    }else{\n      pMem->u.r = sqlite3VdbeRealValue(pMem);\n      MemSetTypeFlag(pMem, MEM_Real);\n      sqlite3VdbeIntegerAffinity(pMem);\n    }\n  }\n  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 );\n  pMem->flags &= ~(MEM_Str|MEM_Blob|MEM_Zero);\n  return SQLITE_OK;\n}\n\n/*\n** Cast the datatype of the value in pMem according to the affinity\n** \"aff\".  Casting is different from applying affinity in that a cast\n** is forced.  In other words, the value is converted into the desired\n** affinity even if that results in loss of data.  This routine is\n** used (for example) to implement the SQL \"cast()\" operator.\n*/\nvoid sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){\n  if( pMem->flags & MEM_Null ) return;\n  switch( aff ){\n    case SQLITE_AFF_BLOB: {   /* Really a cast to BLOB */\n      if( (pMem->flags & MEM_Blob)==0 ){\n        sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);\n        assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );\n        if( pMem->flags & MEM_Str ) MemSetTypeFlag(pMem, MEM_Blob);\n      }else{\n        pMem->flags &= ~(MEM_TypeMask&~MEM_Blob);\n      }\n      break;\n    }\n    case SQLITE_AFF_NUMERIC: {\n      sqlite3VdbeMemNumerify(pMem);\n      break;\n    }\n    case SQLITE_AFF_INTEGER: {\n      sqlite3VdbeMemIntegerify(pMem);\n      break;\n    }\n    case SQLITE_AFF_REAL: {\n      sqlite3VdbeMemRealify(pMem);\n      break;\n    }\n    default: {\n      assert( aff==SQLITE_AFF_TEXT );\n      assert( MEM_Str==(MEM_Blob>>3) );\n      pMem->flags |= (pMem->flags&MEM_Blob)>>3;\n      sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding);\n      assert( pMem->flags & MEM_Str || pMem->db->mallocFailed );\n      pMem->flags &= ~(MEM_Int|MEM_Real|MEM_Blob|MEM_Zero);\n      break;\n    }\n  }\n}\n\n/*\n** Initialize bulk memory to be a consistent Mem object.\n**\n** The minimum amount of initialization feasible is performed.\n*/\nvoid sqlite3VdbeMemInit(Mem *pMem, sqlite3 *db, u16 flags){\n  assert( (flags & ~MEM_TypeMask)==0 );\n  pMem->flags = flags;\n  pMem->db = db;\n  pMem->szMalloc = 0;\n}\n\n\n/*\n** Delete any previous value and set the value stored in *pMem to NULL.\n**\n** This routine calls the Mem.xDel destructor to dispose of values that\n** require the destructor.  But it preserves the Mem.zMalloc memory allocation.\n** To free all resources, use sqlite3VdbeMemRelease(), which both calls this\n** routine to invoke the destructor and deallocates Mem.zMalloc.\n**\n** Use this routine to reset the Mem prior to insert a new value.\n**\n** Use sqlite3VdbeMemRelease() to complete erase the Mem prior to abandoning it.\n*/\nvoid sqlite3VdbeMemSetNull(Mem *pMem){\n  if( VdbeMemDynamic(pMem) ){\n    vdbeMemClearExternAndSetNull(pMem);\n  }else{\n    pMem->flags = MEM_Null;\n  }\n}\nvoid sqlite3ValueSetNull(sqlite3_value *p){\n  sqlite3VdbeMemSetNull((Mem*)p); \n}\n\n/*\n** Delete any previous value and set the value to be a BLOB of length\n** n containing all zeros.\n*/\nvoid sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){\n  sqlite3VdbeMemRelease(pMem);\n  pMem->flags = MEM_Blob|MEM_Zero;\n  pMem->n = 0;\n  if( n<0 ) n = 0;\n  pMem->u.nZero = n;\n  pMem->enc = SQLITE_UTF8;\n  pMem->z = 0;\n}\n\n/*\n** The pMem is known to contain content that needs to be destroyed prior\n** to a value change.  So invoke the destructor, then set the value to\n** a 64-bit integer.\n*/\nstatic SQLITE_NOINLINE void vdbeReleaseAndSetInt64(Mem *pMem, i64 val){\n  sqlite3VdbeMemSetNull(pMem);\n  pMem->u.i = val;\n  pMem->flags = MEM_Int;\n}\n\n/*\n** Delete any previous value and set the value stored in *pMem to val,\n** manifest type INTEGER.\n*/\nvoid sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){\n  if( VdbeMemDynamic(pMem) ){\n    vdbeReleaseAndSetInt64(pMem, val);\n  }else{\n    pMem->u.i = val;\n    pMem->flags = MEM_Int;\n  }\n}\n\n#ifndef SQLITE_OMIT_FLOATING_POINT\n/*\n** Delete any previous value and set the value stored in *pMem to val,\n** manifest type REAL.\n*/\nvoid sqlite3VdbeMemSetDouble(Mem *pMem, double val){\n  sqlite3VdbeMemSetNull(pMem);\n  if( !sqlite3IsNaN(val) ){\n    pMem->u.r = val;\n    pMem->flags = MEM_Real;\n  }\n}\n#endif\n\n/*\n** Delete any previous value and set the value of pMem to be an\n** empty boolean index.\n*/\nvoid sqlite3VdbeMemSetRowSet(Mem *pMem){\n  sqlite3 *db = pMem->db;\n  assert( db!=0 );\n  assert( (pMem->flags & MEM_RowSet)==0 );\n  sqlite3VdbeMemRelease(pMem);\n  pMem->zMalloc = sqlite3DbMallocRawNN(db, 64);\n  if( db->mallocFailed ){\n    pMem->flags = MEM_Null;\n    pMem->szMalloc = 0;\n  }else{\n    assert( pMem->zMalloc );\n    pMem->szMalloc = sqlite3DbMallocSize(db, pMem->zMalloc);\n    pMem->u.pRowSet = sqlite3RowSetInit(db, pMem->zMalloc, pMem->szMalloc);\n    assert( pMem->u.pRowSet!=0 );\n    pMem->flags = MEM_RowSet;\n  }\n}\n\n/*\n** Return true if the Mem object contains a TEXT or BLOB that is\n** too large - whose size exceeds SQLITE_MAX_LENGTH.\n*/\nint sqlite3VdbeMemTooBig(Mem *p){\n  assert( p->db!=0 );\n  if( p->flags & (MEM_Str|MEM_Blob) ){\n    int n = p->n;\n    if( p->flags & MEM_Zero ){\n      n += p->u.nZero;\n    }\n    return n>p->db->aLimit[SQLITE_LIMIT_LENGTH];\n  }\n  return 0; \n}\n\n#ifdef SQLITE_DEBUG\n/*\n** This routine prepares a memory cell for modification by breaking\n** its link to a shallow copy and by marking any current shallow\n** copies of this cell as invalid.\n**\n** This is used for testing and debugging only - to make sure shallow\n** copies are not misused.\n*/\nvoid sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){\n  int i;\n  Mem *pX;\n  for(i=0, pX=pVdbe->aMem; i<pVdbe->nMem; i++, pX++){\n    if( pX->pScopyFrom==pMem ){\n      pX->flags |= MEM_Undefined;\n      pX->pScopyFrom = 0;\n    }\n  }\n  pMem->pScopyFrom = 0;\n}\n#endif /* SQLITE_DEBUG */\n\n\n/*\n** Make an shallow copy of pFrom into pTo.  Prior contents of\n** pTo are freed.  The pFrom->z field is not duplicated.  If\n** pFrom->z is used, then pTo->z points to the same thing as pFrom->z\n** and flags gets srcType (either MEM_Ephem or MEM_Static).\n*/\nstatic SQLITE_NOINLINE void vdbeClrCopy(Mem *pTo, const Mem *pFrom, int eType){\n  vdbeMemClearExternAndSetNull(pTo);\n  assert( !VdbeMemDynamic(pTo) );\n  sqlite3VdbeMemShallowCopy(pTo, pFrom, eType);\n}\nvoid sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){\n  assert( (pFrom->flags & MEM_RowSet)==0 );\n  assert( pTo->db==pFrom->db );\n  if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }\n  memcpy(pTo, pFrom, MEMCELLSIZE);\n  if( (pFrom->flags&MEM_Static)==0 ){\n    pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);\n    assert( srcType==MEM_Ephem || srcType==MEM_Static );\n    pTo->flags |= srcType;\n  }\n}\n\n/*\n** Make a full copy of pFrom into pTo.  Prior contents of pTo are\n** freed before the copy is made.\n*/\nint sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){\n  int rc = SQLITE_OK;\n\n  assert( (pFrom->flags & MEM_RowSet)==0 );\n  if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo);\n  memcpy(pTo, pFrom, MEMCELLSIZE);\n  pTo->flags &= ~MEM_Dyn;\n  if( pTo->flags&(MEM_Str|MEM_Blob) ){\n    if( 0==(pFrom->flags&MEM_Static) ){\n      pTo->flags |= MEM_Ephem;\n      rc = sqlite3VdbeMemMakeWriteable(pTo);\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Transfer the contents of pFrom to pTo. Any existing value in pTo is\n** freed. If pFrom contains ephemeral data, a copy is made.\n**\n** pFrom contains an SQL NULL when this routine returns.\n*/\nvoid sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){\n  assert( pFrom->db==0 || sqlite3_mutex_held(pFrom->db->mutex) );\n  assert( pTo->db==0 || sqlite3_mutex_held(pTo->db->mutex) );\n  assert( pFrom->db==0 || pTo->db==0 || pFrom->db==pTo->db );\n\n  sqlite3VdbeMemRelease(pTo);\n  memcpy(pTo, pFrom, sizeof(Mem));\n  pFrom->flags = MEM_Null;\n  pFrom->szMalloc = 0;\n}\n\n/*\n** Change the value of a Mem to be a string or a BLOB.\n**\n** The memory management strategy depends on the value of the xDel\n** parameter. If the value passed is SQLITE_TRANSIENT, then the \n** string is copied into a (possibly existing) buffer managed by the \n** Mem structure. Otherwise, any existing buffer is freed and the\n** pointer copied.\n**\n** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH\n** size limit) then no memory allocation occurs.  If the string can be\n** stored without allocating memory, then it is.  If a memory allocation\n** is required to store the string, then value of pMem is unchanged.  In\n** either case, SQLITE_TOOBIG is returned.\n*/\nint sqlite3VdbeMemSetStr(\n  Mem *pMem,          /* Memory cell to set to string value */\n  const char *z,      /* String pointer */\n  int n,              /* Bytes in string, or negative */\n  u8 enc,             /* Encoding of z.  0 for BLOBs */\n  void (*xDel)(void*) /* Destructor function */\n){\n  int nByte = n;      /* New value for pMem->n */\n  int iLimit;         /* Maximum allowed string or blob size */\n  u16 flags = 0;      /* New value for pMem->flags */\n\n  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );\n  assert( (pMem->flags & MEM_RowSet)==0 );\n\n  /* If z is a NULL pointer, set pMem to contain an SQL NULL. */\n  if( !z ){\n    sqlite3VdbeMemSetNull(pMem);\n    return SQLITE_OK;\n  }\n\n  if( pMem->db ){\n    iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];\n  }else{\n    iLimit = SQLITE_MAX_LENGTH;\n  }\n  flags = (enc==0?MEM_Blob:MEM_Str);\n  if( nByte<0 ){\n    assert( enc!=0 );\n    if( enc==SQLITE_UTF8 ){\n      nByte = sqlite3Strlen30(z);\n      if( nByte>iLimit ) nByte = iLimit+1;\n    }else{\n      for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}\n    }\n    flags |= MEM_Term;\n  }\n\n  /* The following block sets the new values of Mem.z and Mem.xDel. It\n  ** also sets a flag in local variable \"flags\" to indicate the memory\n  ** management (one of MEM_Dyn or MEM_Static).\n  */\n  if( xDel==SQLITE_TRANSIENT ){\n    int nAlloc = nByte;\n    if( flags&MEM_Term ){\n      nAlloc += (enc==SQLITE_UTF8?1:2);\n    }\n    if( nByte>iLimit ){\n      return SQLITE_TOOBIG;\n    }\n    testcase( nAlloc==0 );\n    testcase( nAlloc==31 );\n    testcase( nAlloc==32 );\n    if( sqlite3VdbeMemClearAndResize(pMem, MAX(nAlloc,32)) ){\n      return SQLITE_NOMEM_BKPT;\n    }\n    memcpy(pMem->z, z, nAlloc);\n  }else if( xDel==SQLITE_DYNAMIC ){\n    sqlite3VdbeMemRelease(pMem);\n    pMem->zMalloc = pMem->z = (char *)z;\n    pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);\n  }else{\n    sqlite3VdbeMemRelease(pMem);\n    pMem->z = (char *)z;\n    pMem->xDel = xDel;\n    flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);\n  }\n\n  pMem->n = nByte;\n  pMem->flags = flags;\n  pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);\n\n#ifndef SQLITE_OMIT_UTF16\n  if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){\n    return SQLITE_NOMEM_BKPT;\n  }\n#endif\n\n  if( nByte>iLimit ){\n    return SQLITE_TOOBIG;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Move data out of a btree key or data field and into a Mem structure.\n** The data or key is taken from the entry that pCur is currently pointing\n** to.  offset and amt determine what portion of the data or key to retrieve.\n** key is true to get the key or false to get data.  The result is written\n** into the pMem element.\n**\n** The pMem object must have been initialized.  This routine will use\n** pMem->zMalloc to hold the content from the btree, if possible.  New\n** pMem->zMalloc space will be allocated if necessary.  The calling routine\n** is responsible for making sure that the pMem object is eventually\n** destroyed.\n**\n** If this routine fails for any reason (malloc returns NULL or unable\n** to read from the disk) then the pMem is left in an inconsistent state.\n*/\nstatic SQLITE_NOINLINE int vdbeMemFromBtreeResize(\n  BtCursor *pCur,   /* Cursor pointing at record to retrieve. */\n  u32 offset,       /* Offset from the start of data to return bytes from. */\n  u32 amt,          /* Number of bytes to return. */\n  int key,          /* If true, retrieve from the btree key, not data. */\n  Mem *pMem         /* OUT: Return data in this Mem structure. */\n){\n  int rc;\n  pMem->flags = MEM_Null;\n  if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+2)) ){\n    if( key ){\n      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);\n    }else{\n      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);\n    }\n    if( rc==SQLITE_OK ){\n      pMem->z[amt] = 0;\n      pMem->z[amt+1] = 0;\n      pMem->flags = MEM_Blob|MEM_Term;\n      pMem->n = (int)amt;\n    }else{\n      sqlite3VdbeMemRelease(pMem);\n    }\n  }\n  return rc;\n}\nint sqlite3VdbeMemFromBtree(\n  BtCursor *pCur,   /* Cursor pointing at record to retrieve. */\n  u32 offset,       /* Offset from the start of data to return bytes from. */\n  u32 amt,          /* Number of bytes to return. */\n  int key,          /* If true, retrieve from the btree key, not data. */\n  Mem *pMem         /* OUT: Return data in this Mem structure. */\n){\n  char *zData;        /* Data from the btree layer */\n  u32 available = 0;  /* Number of bytes available on the local btree page */\n  int rc = SQLITE_OK; /* Return code */\n\n  assert( sqlite3BtreeCursorIsValid(pCur) );\n  assert( !VdbeMemDynamic(pMem) );\n\n  /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() \n  ** that both the BtShared and database handle mutexes are held. */\n  assert( (pMem->flags & MEM_RowSet)==0 );\n  zData = (char *)sqlite3BtreePayloadFetch(pCur, &available);\n  assert( zData!=0 );\n\n  if( offset+amt<=available ){\n    pMem->z = &zData[offset];\n    pMem->flags = MEM_Blob|MEM_Ephem;\n    pMem->n = (int)amt;\n  }else{\n    rc = vdbeMemFromBtreeResize(pCur, offset, amt, key, pMem);\n  }\n\n  return rc;\n}\n\n/*\n** The pVal argument is known to be a value other than NULL.\n** Convert it into a string with encoding enc and return a pointer\n** to a zero-terminated version of that string.\n*/\nstatic SQLITE_NOINLINE const void *valueToText(sqlite3_value* pVal, u8 enc){\n  assert( pVal!=0 );\n  assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );\n  assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );\n  assert( (pVal->flags & MEM_RowSet)==0 );\n  assert( (pVal->flags & (MEM_Null))==0 );\n  if( pVal->flags & (MEM_Blob|MEM_Str) ){\n    pVal->flags |= MEM_Str;\n    if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){\n      sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);\n    }\n    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){\n      assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );\n      if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){\n        return 0;\n      }\n    }\n    sqlite3VdbeMemNulTerminate(pVal); /* IMP: R-31275-44060 */\n  }else{\n    sqlite3VdbeMemStringify(pVal, enc, 0);\n    assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) );\n  }\n  assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0\n              || pVal->db->mallocFailed );\n  if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){\n    return pVal->z;\n  }else{\n    return 0;\n  }\n}\n\n/* This function is only available internally, it is not part of the\n** external API. It works in a similar way to sqlite3_value_text(),\n** except the data returned is in the encoding specified by the second\n** parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or\n** SQLITE_UTF8.\n**\n** (2006-02-16:)  The enc value can be or-ed with SQLITE_UTF16_ALIGNED.\n** If that is the case, then the result must be aligned on an even byte\n** boundary.\n*/\nconst void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){\n  if( !pVal ) return 0;\n  assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );\n  assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );\n  assert( (pVal->flags & MEM_RowSet)==0 );\n  if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){\n    return pVal->z;\n  }\n  if( pVal->flags&MEM_Null ){\n    return 0;\n  }\n  return valueToText(pVal, enc);\n}\n\n/*\n** Create a new sqlite3_value object.\n*/\nsqlite3_value *sqlite3ValueNew(sqlite3 *db){\n  Mem *p = sqlite3DbMallocZero(db, sizeof(*p));\n  if( p ){\n    p->flags = MEM_Null;\n    p->db = db;\n  }\n  return p;\n}\n\n/*\n** Context object passed by sqlite3Stat4ProbeSetValue() through to \n** valueNew(). See comments above valueNew() for details.\n*/\nstruct ValueNewStat4Ctx {\n  Parse *pParse;\n  Index *pIdx;\n  UnpackedRecord **ppRec;\n  int iVal;\n};\n\n/*\n** Allocate and return a pointer to a new sqlite3_value object. If\n** the second argument to this function is NULL, the object is allocated\n** by calling sqlite3ValueNew().\n**\n** Otherwise, if the second argument is non-zero, then this function is \n** being called indirectly by sqlite3Stat4ProbeSetValue(). If it has not\n** already been allocated, allocate the UnpackedRecord structure that \n** that function will return to its caller here. Then return a pointer to\n** an sqlite3_value within the UnpackedRecord.a[] array.\n*/\nstatic sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  if( p ){\n    UnpackedRecord *pRec = p->ppRec[0];\n\n    if( pRec==0 ){\n      Index *pIdx = p->pIdx;      /* Index being probed */\n      int nByte;                  /* Bytes of space to allocate */\n      int i;                      /* Counter variable */\n      int nCol = pIdx->nColumn;   /* Number of index columns including rowid */\n  \n      nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord));\n      pRec = (UnpackedRecord*)sqlite3DbMallocZero(db, nByte);\n      if( pRec ){\n        pRec->pKeyInfo = sqlite3KeyInfoOfIndex(p->pParse, pIdx);\n        if( pRec->pKeyInfo ){\n          assert( pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField==nCol );\n          assert( pRec->pKeyInfo->enc==ENC(db) );\n          pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord)));\n          for(i=0; i<nCol; i++){\n            pRec->aMem[i].flags = MEM_Null;\n            pRec->aMem[i].db = db;\n          }\n        }else{\n          sqlite3DbFree(db, pRec);\n          pRec = 0;\n        }\n      }\n      if( pRec==0 ) return 0;\n      p->ppRec[0] = pRec;\n    }\n  \n    pRec->nField = p->iVal+1;\n    return &pRec->aMem[p->iVal];\n  }\n#else\n  UNUSED_PARAMETER(p);\n#endif /* defined(SQLITE_ENABLE_STAT3_OR_STAT4) */\n  return sqlite3ValueNew(db);\n}\n\n/*\n** The expression object indicated by the second argument is guaranteed\n** to be a scalar SQL function. If\n**\n**   * all function arguments are SQL literals,\n**   * one of the SQLITE_FUNC_CONSTANT or _SLOCHNG function flags is set, and\n**   * the SQLITE_FUNC_NEEDCOLL function flag is not set,\n**\n** then this routine attempts to invoke the SQL function. Assuming no\n** error occurs, output parameter (*ppVal) is set to point to a value \n** object containing the result before returning SQLITE_OK.\n**\n** Affinity aff is applied to the result of the function before returning.\n** If the result is a text value, the sqlite3_value object uses encoding \n** enc.\n**\n** If the conditions above are not met, this function returns SQLITE_OK\n** and sets (*ppVal) to NULL. Or, if an error occurs, (*ppVal) is set to\n** NULL and an SQLite error code returned.\n*/\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\nstatic int valueFromFunction(\n  sqlite3 *db,                    /* The database connection */\n  Expr *p,                        /* The expression to evaluate */\n  u8 enc,                         /* Encoding to use */\n  u8 aff,                         /* Affinity to use */\n  sqlite3_value **ppVal,          /* Write the new value here */\n  struct ValueNewStat4Ctx *pCtx   /* Second argument for valueNew() */\n){\n  sqlite3_context ctx;            /* Context object for function invocation */\n  sqlite3_value **apVal = 0;      /* Function arguments */\n  int nVal = 0;                   /* Size of apVal[] array */\n  FuncDef *pFunc = 0;             /* Function definition */\n  sqlite3_value *pVal = 0;        /* New value */\n  int rc = SQLITE_OK;             /* Return code */\n  ExprList *pList = 0;            /* Function arguments */\n  int i;                          /* Iterator variable */\n\n  assert( pCtx!=0 );\n  assert( (p->flags & EP_TokenOnly)==0 );\n  pList = p->x.pList;\n  if( pList ) nVal = pList->nExpr;\n  pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0);\n  assert( pFunc );\n  if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0 \n   || (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)\n  ){\n    return SQLITE_OK;\n  }\n\n  if( pList ){\n    apVal = (sqlite3_value**)sqlite3DbMallocZero(db, sizeof(apVal[0]) * nVal);\n    if( apVal==0 ){\n      rc = SQLITE_NOMEM_BKPT;\n      goto value_from_function_out;\n    }\n    for(i=0; i<nVal; i++){\n      rc = sqlite3ValueFromExpr(db, pList->a[i].pExpr, enc, aff, &apVal[i]);\n      if( apVal[i]==0 || rc!=SQLITE_OK ) goto value_from_function_out;\n    }\n  }\n\n  pVal = valueNew(db, pCtx);\n  if( pVal==0 ){\n    rc = SQLITE_NOMEM_BKPT;\n    goto value_from_function_out;\n  }\n\n  assert( pCtx->pParse->rc==SQLITE_OK );\n  memset(&ctx, 0, sizeof(ctx));\n  ctx.pOut = pVal;\n  ctx.pFunc = pFunc;\n  pFunc->xSFunc(&ctx, nVal, apVal);\n  if( ctx.isError ){\n    rc = ctx.isError;\n    sqlite3ErrorMsg(pCtx->pParse, \"%s\", sqlite3_value_text(pVal));\n  }else{\n    sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);\n    assert( rc==SQLITE_OK );\n    rc = sqlite3VdbeChangeEncoding(pVal, enc);\n    if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){\n      rc = SQLITE_TOOBIG;\n      pCtx->pParse->nErr++;\n    }\n  }\n  pCtx->pParse->rc = rc;\n\n value_from_function_out:\n  if( rc!=SQLITE_OK ){\n    pVal = 0;\n  }\n  if( apVal ){\n    for(i=0; i<nVal; i++){\n      sqlite3ValueFree(apVal[i]);\n    }\n    sqlite3DbFree(db, apVal);\n  }\n\n  *ppVal = pVal;\n  return rc;\n}\n#else\n# define valueFromFunction(a,b,c,d,e,f) SQLITE_OK\n#endif /* defined(SQLITE_ENABLE_STAT3_OR_STAT4) */\n\n/*\n** Extract a value from the supplied expression in the manner described\n** above sqlite3ValueFromExpr(). Allocate the sqlite3_value object\n** using valueNew().\n**\n** If pCtx is NULL and an error occurs after the sqlite3_value object\n** has been allocated, it is freed before returning. Or, if pCtx is not\n** NULL, it is assumed that the caller will free any allocated object\n** in all cases.\n*/\nstatic int valueFromExpr(\n  sqlite3 *db,                    /* The database connection */\n  Expr *pExpr,                    /* The expression to evaluate */\n  u8 enc,                         /* Encoding to use */\n  u8 affinity,                    /* Affinity to use */\n  sqlite3_value **ppVal,          /* Write the new value here */\n  struct ValueNewStat4Ctx *pCtx   /* Second argument for valueNew() */\n){\n  int op;\n  char *zVal = 0;\n  sqlite3_value *pVal = 0;\n  int negInt = 1;\n  const char *zNeg = \"\";\n  int rc = SQLITE_OK;\n\n  assert( pExpr!=0 );\n  while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;\n  if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;\n\n  /* Compressed expressions only appear when parsing the DEFAULT clause\n  ** on a table column definition, and hence only when pCtx==0.  This\n  ** check ensures that an EP_TokenOnly expression is never passed down\n  ** into valueFromFunction(). */\n  assert( (pExpr->flags & EP_TokenOnly)==0 || pCtx==0 );\n\n  if( op==TK_CAST ){\n    u8 aff = sqlite3AffinityType(pExpr->u.zToken,0);\n    rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);\n    testcase( rc!=SQLITE_OK );\n    if( *ppVal ){\n      sqlite3VdbeMemCast(*ppVal, aff, SQLITE_UTF8);\n      sqlite3ValueApplyAffinity(*ppVal, affinity, SQLITE_UTF8);\n    }\n    return rc;\n  }\n\n  /* Handle negative integers in a single step.  This is needed in the\n  ** case when the value is -9223372036854775808.\n  */\n  if( op==TK_UMINUS\n   && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){\n    pExpr = pExpr->pLeft;\n    op = pExpr->op;\n    negInt = -1;\n    zNeg = \"-\";\n  }\n\n  if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){\n    pVal = valueNew(db, pCtx);\n    if( pVal==0 ) goto no_mem;\n    if( ExprHasProperty(pExpr, EP_IntValue) ){\n      sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt);\n    }else{\n      zVal = sqlite3MPrintf(db, \"%s%s\", zNeg, pExpr->u.zToken);\n      if( zVal==0 ) goto no_mem;\n      sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);\n    }\n    if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){\n      sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);\n    }else{\n      sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);\n    }\n    if( pVal->flags & (MEM_Int|MEM_Real) ) pVal->flags &= ~MEM_Str;\n    if( enc!=SQLITE_UTF8 ){\n      rc = sqlite3VdbeChangeEncoding(pVal, enc);\n    }\n  }else if( op==TK_UMINUS ) {\n    /* This branch happens for multiple negative signs.  Ex: -(-5) */\n    if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) \n     && pVal!=0\n    ){\n      sqlite3VdbeMemNumerify(pVal);\n      if( pVal->flags & MEM_Real ){\n        pVal->u.r = -pVal->u.r;\n      }else if( pVal->u.i==SMALLEST_INT64 ){\n        pVal->u.r = -(double)SMALLEST_INT64;\n        MemSetTypeFlag(pVal, MEM_Real);\n      }else{\n        pVal->u.i = -pVal->u.i;\n      }\n      sqlite3ValueApplyAffinity(pVal, affinity, enc);\n    }\n  }else if( op==TK_NULL ){\n    pVal = valueNew(db, pCtx);\n    if( pVal==0 ) goto no_mem;\n  }\n#ifndef SQLITE_OMIT_BLOB_LITERAL\n  else if( op==TK_BLOB ){\n    int nVal;\n    assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );\n    assert( pExpr->u.zToken[1]=='\\'' );\n    pVal = valueNew(db, pCtx);\n    if( !pVal ) goto no_mem;\n    zVal = &pExpr->u.zToken[2];\n    nVal = sqlite3Strlen30(zVal)-1;\n    assert( zVal[nVal]=='\\'' );\n    sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,\n                         0, SQLITE_DYNAMIC);\n  }\n#endif\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  else if( op==TK_FUNCTION && pCtx!=0 ){\n    rc = valueFromFunction(db, pExpr, enc, affinity, &pVal, pCtx);\n  }\n#endif\n\n  *ppVal = pVal;\n  return rc;\n\nno_mem:\n  sqlite3OomFault(db);\n  sqlite3DbFree(db, zVal);\n  assert( *ppVal==0 );\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  if( pCtx==0 ) sqlite3ValueFree(pVal);\n#else\n  assert( pCtx==0 ); sqlite3ValueFree(pVal);\n#endif\n  return SQLITE_NOMEM_BKPT;\n}\n\n/*\n** Create a new sqlite3_value object, containing the value of pExpr.\n**\n** This only works for very simple expressions that consist of one constant\n** token (i.e. \"5\", \"5.1\", \"'a string'\"). If the expression can\n** be converted directly into a value, then the value is allocated and\n** a pointer written to *ppVal. The caller is responsible for deallocating\n** the value by passing it to sqlite3ValueFree() later on. If the expression\n** cannot be converted to a value, then *ppVal is set to NULL.\n*/\nint sqlite3ValueFromExpr(\n  sqlite3 *db,              /* The database connection */\n  Expr *pExpr,              /* The expression to evaluate */\n  u8 enc,                   /* Encoding to use */\n  u8 affinity,              /* Affinity to use */\n  sqlite3_value **ppVal     /* Write the new value here */\n){\n  return pExpr ? valueFromExpr(db, pExpr, enc, affinity, ppVal, 0) : 0;\n}\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/*\n** The implementation of the sqlite_record() function. This function accepts\n** a single argument of any type. The return value is a formatted database \n** record (a blob) containing the argument value.\n**\n** This is used to convert the value stored in the 'sample' column of the\n** sqlite_stat3 table to the record format SQLite uses internally.\n*/\nstatic void recordFunc(\n  sqlite3_context *context,\n  int argc,\n  sqlite3_value **argv\n){\n  const int file_format = 1;\n  u32 iSerial;                    /* Serial type */\n  int nSerial;                    /* Bytes of space for iSerial as varint */\n  u32 nVal;                       /* Bytes of space required for argv[0] */\n  int nRet;\n  sqlite3 *db;\n  u8 *aRet;\n\n  UNUSED_PARAMETER( argc );\n  iSerial = sqlite3VdbeSerialType(argv[0], file_format, &nVal);\n  nSerial = sqlite3VarintLen(iSerial);\n  db = sqlite3_context_db_handle(context);\n\n  nRet = 1 + nSerial + nVal;\n  aRet = sqlite3DbMallocRawNN(db, nRet);\n  if( aRet==0 ){\n    sqlite3_result_error_nomem(context);\n  }else{\n    aRet[0] = nSerial+1;\n    putVarint32(&aRet[1], iSerial);\n    sqlite3VdbeSerialPut(&aRet[1+nSerial], argv[0], iSerial);\n    sqlite3_result_blob(context, aRet, nRet, SQLITE_TRANSIENT);\n    sqlite3DbFree(db, aRet);\n  }\n}\n\n/*\n** Register built-in functions used to help read ANALYZE data.\n*/\nvoid sqlite3AnalyzeFunctions(void){\n  static FuncDef aAnalyzeTableFuncs[] = {\n    FUNCTION(sqlite_record,   1, 0, 0, recordFunc),\n  };\n  sqlite3InsertBuiltinFuncs(aAnalyzeTableFuncs, ArraySize(aAnalyzeTableFuncs));\n}\n\n/*\n** Attempt to extract a value from pExpr and use it to construct *ppVal.\n**\n** If pAlloc is not NULL, then an UnpackedRecord object is created for\n** pAlloc if one does not exist and the new value is added to the\n** UnpackedRecord object.\n**\n** A value is extracted in the following cases:\n**\n**  * (pExpr==0). In this case the value is assumed to be an SQL NULL,\n**\n**  * The expression is a bound variable, and this is a reprepare, or\n**\n**  * The expression is a literal value.\n**\n** On success, *ppVal is made to point to the extracted value.  The caller\n** is responsible for ensuring that the value is eventually freed.\n*/\nstatic int stat4ValueFromExpr(\n  Parse *pParse,                  /* Parse context */\n  Expr *pExpr,                    /* The expression to extract a value from */\n  u8 affinity,                    /* Affinity to use */\n  struct ValueNewStat4Ctx *pAlloc,/* How to allocate space.  Or NULL */\n  sqlite3_value **ppVal           /* OUT: New value object (or NULL) */\n){\n  int rc = SQLITE_OK;\n  sqlite3_value *pVal = 0;\n  sqlite3 *db = pParse->db;\n\n  /* Skip over any TK_COLLATE nodes */\n  pExpr = sqlite3ExprSkipCollate(pExpr);\n\n  if( !pExpr ){\n    pVal = valueNew(db, pAlloc);\n    if( pVal ){\n      sqlite3VdbeMemSetNull((Mem*)pVal);\n    }\n  }else if( pExpr->op==TK_VARIABLE\n        || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE)\n  ){\n    Vdbe *v;\n    int iBindVar = pExpr->iColumn;\n    sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar);\n    if( (v = pParse->pReprepare)!=0 ){\n      pVal = valueNew(db, pAlloc);\n      if( pVal ){\n        rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]);\n        if( rc==SQLITE_OK ){\n          sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));\n        }\n        pVal->db = pParse->db;\n      }\n    }\n  }else{\n    rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, pAlloc);\n  }\n\n  assert( pVal==0 || pVal->db==db );\n  *ppVal = pVal;\n  return rc;\n}\n\n/*\n** This function is used to allocate and populate UnpackedRecord \n** structures intended to be compared against sample index keys stored \n** in the sqlite_stat4 table.\n**\n** A single call to this function populates zero or more fields of the\n** record starting with field iVal (fields are numbered from left to\n** right starting with 0). A single field is populated if:\n**\n**  * (pExpr==0). In this case the value is assumed to be an SQL NULL,\n**\n**  * The expression is a bound variable, and this is a reprepare, or\n**\n**  * The sqlite3ValueFromExpr() function is able to extract a value \n**    from the expression (i.e. the expression is a literal value).\n**\n** Or, if pExpr is a TK_VECTOR, one field is populated for each of the\n** vector components that match either of the two latter criteria listed\n** above.\n**\n** Before any value is appended to the record, the affinity of the \n** corresponding column within index pIdx is applied to it. Before\n** this function returns, output parameter *pnExtract is set to the\n** number of values appended to the record.\n**\n** When this function is called, *ppRec must either point to an object\n** allocated by an earlier call to this function, or must be NULL. If it\n** is NULL and a value can be successfully extracted, a new UnpackedRecord\n** is allocated (and *ppRec set to point to it) before returning.\n**\n** Unless an error is encountered, SQLITE_OK is returned. It is not an\n** error if a value cannot be extracted from pExpr. If an error does\n** occur, an SQLite error code is returned.\n*/\nint sqlite3Stat4ProbeSetValue(\n  Parse *pParse,                  /* Parse context */\n  Index *pIdx,                    /* Index being probed */\n  UnpackedRecord **ppRec,         /* IN/OUT: Probe record */\n  Expr *pExpr,                    /* The expression to extract a value from */\n  int nElem,                      /* Maximum number of values to append */\n  int iVal,                       /* Array element to populate */\n  int *pnExtract                  /* OUT: Values appended to the record */\n){\n  int rc = SQLITE_OK;\n  int nExtract = 0;\n\n  if( pExpr==0 || pExpr->op!=TK_SELECT ){\n    int i;\n    struct ValueNewStat4Ctx alloc;\n\n    alloc.pParse = pParse;\n    alloc.pIdx = pIdx;\n    alloc.ppRec = ppRec;\n\n    for(i=0; i<nElem; i++){\n      sqlite3_value *pVal = 0;\n      Expr *pElem = (pExpr ? sqlite3VectorFieldSubexpr(pExpr, i) : 0);\n      u8 aff = sqlite3IndexColumnAffinity(pParse->db, pIdx, iVal+i);\n      alloc.iVal = iVal+i;\n      rc = stat4ValueFromExpr(pParse, pElem, aff, &alloc, &pVal);\n      if( !pVal ) break;\n      nExtract++;\n    }\n  }\n\n  *pnExtract = nExtract;\n  return rc;\n}\n\n/*\n** Attempt to extract a value from expression pExpr using the methods\n** as described for sqlite3Stat4ProbeSetValue() above. \n**\n** If successful, set *ppVal to point to a new value object and return \n** SQLITE_OK. If no value can be extracted, but no other error occurs\n** (e.g. OOM), return SQLITE_OK and set *ppVal to NULL. Or, if an error\n** does occur, return an SQLite error code. The final value of *ppVal\n** is undefined in this case.\n*/\nint sqlite3Stat4ValueFromExpr(\n  Parse *pParse,                  /* Parse context */\n  Expr *pExpr,                    /* The expression to extract a value from */\n  u8 affinity,                    /* Affinity to use */\n  sqlite3_value **ppVal           /* OUT: New value object (or NULL) */\n){\n  return stat4ValueFromExpr(pParse, pExpr, affinity, 0, ppVal);\n}\n\n/*\n** Extract the iCol-th column from the nRec-byte record in pRec.  Write\n** the column value into *ppVal.  If *ppVal is initially NULL then a new\n** sqlite3_value object is allocated.\n**\n** If *ppVal is initially NULL then the caller is responsible for \n** ensuring that the value written into *ppVal is eventually freed.\n*/\nint sqlite3Stat4Column(\n  sqlite3 *db,                    /* Database handle */\n  const void *pRec,               /* Pointer to buffer containing record */\n  int nRec,                       /* Size of buffer pRec in bytes */\n  int iCol,                       /* Column to extract */\n  sqlite3_value **ppVal           /* OUT: Extracted value */\n){\n  u32 t;                          /* a column type code */\n  int nHdr;                       /* Size of the header in the record */\n  int iHdr;                       /* Next unread header byte */\n  int iField;                     /* Next unread data byte */\n  int szField;                    /* Size of the current data field */\n  int i;                          /* Column index */\n  u8 *a = (u8*)pRec;              /* Typecast byte array */\n  Mem *pMem = *ppVal;             /* Write result into this Mem object */\n\n  assert( iCol>0 );\n  iHdr = getVarint32(a, nHdr);\n  if( nHdr>nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT;\n  iField = nHdr;\n  for(i=0; i<=iCol; i++){\n    iHdr += getVarint32(&a[iHdr], t);\n    testcase( iHdr==nHdr );\n    testcase( iHdr==nHdr+1 );\n    if( iHdr>nHdr ) return SQLITE_CORRUPT_BKPT;\n    szField = sqlite3VdbeSerialTypeLen(t);\n    iField += szField;\n  }\n  testcase( iField==nRec );\n  testcase( iField==nRec+1 );\n  if( iField>nRec ) return SQLITE_CORRUPT_BKPT;\n  if( pMem==0 ){\n    pMem = *ppVal = sqlite3ValueNew(db);\n    if( pMem==0 ) return SQLITE_NOMEM_BKPT;\n  }\n  sqlite3VdbeSerialGet(&a[iField-szField], t, pMem);\n  pMem->enc = ENC(db);\n  return SQLITE_OK;\n}\n\n/*\n** Unless it is NULL, the argument must be an UnpackedRecord object returned\n** by an earlier call to sqlite3Stat4ProbeSetValue(). This call deletes\n** the object.\n*/\nvoid sqlite3Stat4ProbeFree(UnpackedRecord *pRec){\n  if( pRec ){\n    int i;\n    int nCol = pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField;\n    Mem *aMem = pRec->aMem;\n    sqlite3 *db = aMem[0].db;\n    for(i=0; i<nCol; i++){\n      sqlite3VdbeMemRelease(&aMem[i]);\n    }\n    sqlite3KeyInfoUnref(pRec->pKeyInfo);\n    sqlite3DbFree(db, pRec);\n  }\n}\n#endif /* ifdef SQLITE_ENABLE_STAT4 */\n\n/*\n** Change the string value of an sqlite3_value object\n*/\nvoid sqlite3ValueSetStr(\n  sqlite3_value *v,     /* Value to be set */\n  int n,                /* Length of string z */\n  const void *z,        /* Text of the new string */\n  u8 enc,               /* Encoding to use */\n  void (*xDel)(void*)   /* Destructor for the string */\n){\n  if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel);\n}\n\n/*\n** Free an sqlite3_value object\n*/\nvoid sqlite3ValueFree(sqlite3_value *v){\n  if( !v ) return;\n  sqlite3VdbeMemRelease((Mem *)v);\n  sqlite3DbFree(((Mem*)v)->db, v);\n}\n\n/*\n** The sqlite3ValueBytes() routine returns the number of bytes in the\n** sqlite3_value object assuming that it uses the encoding \"enc\".\n** The valueBytes() routine is a helper function.\n*/\nstatic SQLITE_NOINLINE int valueBytes(sqlite3_value *pVal, u8 enc){\n  return valueToText(pVal, enc)!=0 ? pVal->n : 0;\n}\nint sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){\n  Mem *p = (Mem*)pVal;\n  assert( (p->flags & MEM_Null)==0 || (p->flags & (MEM_Str|MEM_Blob))==0 );\n  if( (p->flags & MEM_Str)!=0 && pVal->enc==enc ){\n    return p->n;\n  }\n  if( (p->flags & MEM_Blob)!=0 ){\n    if( p->flags & MEM_Zero ){\n      return p->n + p->u.nZero;\n    }else{\n      return p->n;\n    }\n  }\n  if( p->flags & MEM_Null ) return 0;\n  return valueBytes(pVal, enc);\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbesort.c",
    "content": "/*\n** 2011-07-09\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code for the VdbeSorter object, used in concert with\n** a VdbeCursor to sort large numbers of keys for CREATE INDEX statements\n** or by SELECT statements with ORDER BY clauses that cannot be satisfied\n** using indexes and without LIMIT clauses.\n**\n** The VdbeSorter object implements a multi-threaded external merge sort\n** algorithm that is efficient even if the number of elements being sorted\n** exceeds the available memory.\n**\n** Here is the (internal, non-API) interface between this module and the\n** rest of the SQLite system:\n**\n**    sqlite3VdbeSorterInit()       Create a new VdbeSorter object.\n**\n**    sqlite3VdbeSorterWrite()      Add a single new row to the VdbeSorter\n**                                  object.  The row is a binary blob in the\n**                                  OP_MakeRecord format that contains both\n**                                  the ORDER BY key columns and result columns\n**                                  in the case of a SELECT w/ ORDER BY, or\n**                                  the complete record for an index entry\n**                                  in the case of a CREATE INDEX.\n**\n**    sqlite3VdbeSorterRewind()     Sort all content previously added.\n**                                  Position the read cursor on the\n**                                  first sorted element.\n**\n**    sqlite3VdbeSorterNext()       Advance the read cursor to the next sorted\n**                                  element.\n**\n**    sqlite3VdbeSorterRowkey()     Return the complete binary blob for the\n**                                  row currently under the read cursor.\n**\n**    sqlite3VdbeSorterCompare()    Compare the binary blob for the row\n**                                  currently under the read cursor against\n**                                  another binary blob X and report if\n**                                  X is strictly less than the read cursor.\n**                                  Used to enforce uniqueness in a\n**                                  CREATE UNIQUE INDEX statement.\n**\n**    sqlite3VdbeSorterClose()      Close the VdbeSorter object and reclaim\n**                                  all resources.\n**\n**    sqlite3VdbeSorterReset()      Refurbish the VdbeSorter for reuse.  This\n**                                  is like Close() followed by Init() only\n**                                  much faster.\n**\n** The interfaces above must be called in a particular order.  Write() can \n** only occur in between Init()/Reset() and Rewind().  Next(), Rowkey(), and\n** Compare() can only occur in between Rewind() and Close()/Reset(). i.e.\n**\n**   Init()\n**   for each record: Write()\n**   Rewind()\n**     Rowkey()/Compare()\n**   Next() \n**   Close()\n**\n** Algorithm:\n**\n** Records passed to the sorter via calls to Write() are initially held \n** unsorted in main memory. Assuming the amount of memory used never exceeds\n** a threshold, when Rewind() is called the set of records is sorted using\n** an in-memory merge sort. In this case, no temporary files are required\n** and subsequent calls to Rowkey(), Next() and Compare() read records \n** directly from main memory.\n**\n** If the amount of space used to store records in main memory exceeds the\n** threshold, then the set of records currently in memory are sorted and\n** written to a temporary file in \"Packed Memory Array\" (PMA) format.\n** A PMA created at this point is known as a \"level-0 PMA\". Higher levels\n** of PMAs may be created by merging existing PMAs together - for example\n** merging two or more level-0 PMAs together creates a level-1 PMA.\n**\n** The threshold for the amount of main memory to use before flushing \n** records to a PMA is roughly the same as the limit configured for the\n** page-cache of the main database. Specifically, the threshold is set to \n** the value returned by \"PRAGMA main.page_size\" multipled by \n** that returned by \"PRAGMA main.cache_size\", in bytes.\n**\n** If the sorter is running in single-threaded mode, then all PMAs generated\n** are appended to a single temporary file. Or, if the sorter is running in\n** multi-threaded mode then up to (N+1) temporary files may be opened, where\n** N is the configured number of worker threads. In this case, instead of\n** sorting the records and writing the PMA to a temporary file itself, the\n** calling thread usually launches a worker thread to do so. Except, if\n** there are already N worker threads running, the main thread does the work\n** itself.\n**\n** The sorter is running in multi-threaded mode if (a) the library was built\n** with pre-processor symbol SQLITE_MAX_WORKER_THREADS set to a value greater\n** than zero, and (b) worker threads have been enabled at runtime by calling\n** \"PRAGMA threads=N\" with some value of N greater than 0.\n**\n** When Rewind() is called, any data remaining in memory is flushed to a \n** final PMA. So at this point the data is stored in some number of sorted\n** PMAs within temporary files on disk.\n**\n** If there are fewer than SORTER_MAX_MERGE_COUNT PMAs in total and the\n** sorter is running in single-threaded mode, then these PMAs are merged\n** incrementally as keys are retreived from the sorter by the VDBE.  The\n** MergeEngine object, described in further detail below, performs this\n** merge.\n**\n** Or, if running in multi-threaded mode, then a background thread is\n** launched to merge the existing PMAs. Once the background thread has\n** merged T bytes of data into a single sorted PMA, the main thread \n** begins reading keys from that PMA while the background thread proceeds\n** with merging the next T bytes of data. And so on.\n**\n** Parameter T is set to half the value of the memory threshold used \n** by Write() above to determine when to create a new PMA.\n**\n** If there are more than SORTER_MAX_MERGE_COUNT PMAs in total when \n** Rewind() is called, then a hierarchy of incremental-merges is used. \n** First, T bytes of data from the first SORTER_MAX_MERGE_COUNT PMAs on \n** disk are merged together. Then T bytes of data from the second set, and\n** so on, such that no operation ever merges more than SORTER_MAX_MERGE_COUNT\n** PMAs at a time. This done is to improve locality.\n**\n** If running in multi-threaded mode and there are more than\n** SORTER_MAX_MERGE_COUNT PMAs on disk when Rewind() is called, then more\n** than one background thread may be created. Specifically, there may be\n** one background thread for each temporary file on disk, and one background\n** thread to merge the output of each of the others to a single PMA for\n** the main thread to read from.\n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n/* \n** If SQLITE_DEBUG_SORTER_THREADS is defined, this module outputs various\n** messages to stderr that may be helpful in understanding the performance\n** characteristics of the sorter in multi-threaded mode.\n*/\n#if 0\n# define SQLITE_DEBUG_SORTER_THREADS 1\n#endif\n\n/*\n** Hard-coded maximum amount of data to accumulate in memory before flushing\n** to a level 0 PMA. The purpose of this limit is to prevent various integer\n** overflows. 512MiB.\n*/\n#define SQLITE_MAX_PMASZ    (1<<29)\n\n/*\n** Private objects used by the sorter\n*/\ntypedef struct MergeEngine MergeEngine;     /* Merge PMAs together */\ntypedef struct PmaReader PmaReader;         /* Incrementally read one PMA */\ntypedef struct PmaWriter PmaWriter;         /* Incrementally write one PMA */\ntypedef struct SorterRecord SorterRecord;   /* A record being sorted */\ntypedef struct SortSubtask SortSubtask;     /* A sub-task in the sort process */\ntypedef struct SorterFile SorterFile;       /* Temporary file object wrapper */\ntypedef struct SorterList SorterList;       /* In-memory list of records */\ntypedef struct IncrMerger IncrMerger;       /* Read & merge multiple PMAs */\n\n/*\n** A container for a temp file handle and the current amount of data \n** stored in the file.\n*/\nstruct SorterFile {\n  sqlite3_file *pFd;              /* File handle */\n  i64 iEof;                       /* Bytes of data stored in pFd */\n};\n\n/*\n** An in-memory list of objects to be sorted.\n**\n** If aMemory==0 then each object is allocated separately and the objects\n** are connected using SorterRecord.u.pNext.  If aMemory!=0 then all objects\n** are stored in the aMemory[] bulk memory, one right after the other, and\n** are connected using SorterRecord.u.iNext.\n*/\nstruct SorterList {\n  SorterRecord *pList;            /* Linked list of records */\n  u8 *aMemory;                    /* If non-NULL, bulk memory to hold pList */\n  int szPMA;                      /* Size of pList as PMA in bytes */\n};\n\n/*\n** The MergeEngine object is used to combine two or more smaller PMAs into\n** one big PMA using a merge operation.  Separate PMAs all need to be\n** combined into one big PMA in order to be able to step through the sorted\n** records in order.\n**\n** The aReadr[] array contains a PmaReader object for each of the PMAs being\n** merged.  An aReadr[] object either points to a valid key or else is at EOF.\n** (\"EOF\" means \"End Of File\".  When aReadr[] is at EOF there is no more data.)\n** For the purposes of the paragraphs below, we assume that the array is\n** actually N elements in size, where N is the smallest power of 2 greater\n** to or equal to the number of PMAs being merged. The extra aReadr[] elements\n** are treated as if they are empty (always at EOF).\n**\n** The aTree[] array is also N elements in size. The value of N is stored in\n** the MergeEngine.nTree variable.\n**\n** The final (N/2) elements of aTree[] contain the results of comparing\n** pairs of PMA keys together. Element i contains the result of \n** comparing aReadr[2*i-N] and aReadr[2*i-N+1]. Whichever key is smaller, the\n** aTree element is set to the index of it. \n**\n** For the purposes of this comparison, EOF is considered greater than any\n** other key value. If the keys are equal (only possible with two EOF\n** values), it doesn't matter which index is stored.\n**\n** The (N/4) elements of aTree[] that precede the final (N/2) described \n** above contains the index of the smallest of each block of 4 PmaReaders\n** And so on. So that aTree[1] contains the index of the PmaReader that \n** currently points to the smallest key value. aTree[0] is unused.\n**\n** Example:\n**\n**     aReadr[0] -> Banana\n**     aReadr[1] -> Feijoa\n**     aReadr[2] -> Elderberry\n**     aReadr[3] -> Currant\n**     aReadr[4] -> Grapefruit\n**     aReadr[5] -> Apple\n**     aReadr[6] -> Durian\n**     aReadr[7] -> EOF\n**\n**     aTree[] = { X, 5   0, 5    0, 3, 5, 6 }\n**\n** The current element is \"Apple\" (the value of the key indicated by \n** PmaReader 5). When the Next() operation is invoked, PmaReader 5 will\n** be advanced to the next key in its segment. Say the next key is\n** \"Eggplant\":\n**\n**     aReadr[5] -> Eggplant\n**\n** The contents of aTree[] are updated first by comparing the new PmaReader\n** 5 key to the current key of PmaReader 4 (still \"Grapefruit\"). The PmaReader\n** 5 value is still smaller, so aTree[6] is set to 5. And so on up the tree.\n** The value of PmaReader 6 - \"Durian\" - is now smaller than that of PmaReader\n** 5, so aTree[3] is set to 6. Key 0 is smaller than key 6 (Banana<Durian),\n** so the value written into element 1 of the array is 0. As follows:\n**\n**     aTree[] = { X, 0   0, 6    0, 3, 5, 6 }\n**\n** In other words, each time we advance to the next sorter element, log2(N)\n** key comparison operations are required, where N is the number of segments\n** being merged (rounded up to the next power of 2).\n*/\nstruct MergeEngine {\n  int nTree;                 /* Used size of aTree/aReadr (power of 2) */\n  SortSubtask *pTask;        /* Used by this thread only */\n  int *aTree;                /* Current state of incremental merge */\n  PmaReader *aReadr;         /* Array of PmaReaders to merge data from */\n};\n\n/*\n** This object represents a single thread of control in a sort operation.\n** Exactly VdbeSorter.nTask instances of this object are allocated\n** as part of each VdbeSorter object. Instances are never allocated any\n** other way. VdbeSorter.nTask is set to the number of worker threads allowed\n** (see SQLITE_CONFIG_WORKER_THREADS) plus one (the main thread).  Thus for\n** single-threaded operation, there is exactly one instance of this object\n** and for multi-threaded operation there are two or more instances.\n**\n** Essentially, this structure contains all those fields of the VdbeSorter\n** structure for which each thread requires a separate instance. For example,\n** each thread requries its own UnpackedRecord object to unpack records in\n** as part of comparison operations.\n**\n** Before a background thread is launched, variable bDone is set to 0. Then, \n** right before it exits, the thread itself sets bDone to 1. This is used for \n** two purposes:\n**\n**   1. When flushing the contents of memory to a level-0 PMA on disk, to\n**      attempt to select a SortSubtask for which there is not already an\n**      active background thread (since doing so causes the main thread\n**      to block until it finishes).\n**\n**   2. If SQLITE_DEBUG_SORTER_THREADS is defined, to determine if a call\n**      to sqlite3ThreadJoin() is likely to block. Cases that are likely to\n**      block provoke debugging output.\n**\n** In both cases, the effects of the main thread seeing (bDone==0) even\n** after the thread has finished are not dire. So we don't worry about\n** memory barriers and such here.\n*/\ntypedef int (*SorterCompare)(SortSubtask*,int*,const void*,int,const void*,int);\nstruct SortSubtask {\n  SQLiteThread *pThread;          /* Background thread, if any */\n  int bDone;                      /* Set if thread is finished but not joined */\n  VdbeSorter *pSorter;            /* Sorter that owns this sub-task */\n  UnpackedRecord *pUnpacked;      /* Space to unpack a record */\n  SorterList list;                /* List for thread to write to a PMA */\n  int nPMA;                       /* Number of PMAs currently in file */\n  SorterCompare xCompare;         /* Compare function to use */\n  SorterFile file;                /* Temp file for level-0 PMAs */\n  SorterFile file2;               /* Space for other PMAs */\n};\n\n\n/*\n** Main sorter structure. A single instance of this is allocated for each \n** sorter cursor created by the VDBE.\n**\n** mxKeysize:\n**   As records are added to the sorter by calls to sqlite3VdbeSorterWrite(),\n**   this variable is updated so as to be set to the size on disk of the\n**   largest record in the sorter.\n*/\nstruct VdbeSorter {\n  int mnPmaSize;                  /* Minimum PMA size, in bytes */\n  int mxPmaSize;                  /* Maximum PMA size, in bytes.  0==no limit */\n  int mxKeysize;                  /* Largest serialized key seen so far */\n  int pgsz;                       /* Main database page size */\n  PmaReader *pReader;             /* Readr data from here after Rewind() */\n  MergeEngine *pMerger;           /* Or here, if bUseThreads==0 */\n  sqlite3 *db;                    /* Database connection */\n  KeyInfo *pKeyInfo;              /* How to compare records */\n  UnpackedRecord *pUnpacked;      /* Used by VdbeSorterCompare() */\n  SorterList list;                /* List of in-memory records */\n  int iMemory;                    /* Offset of free space in list.aMemory */\n  int nMemory;                    /* Size of list.aMemory allocation in bytes */\n  u8 bUsePMA;                     /* True if one or more PMAs created */\n  u8 bUseThreads;                 /* True to use background threads */\n  u8 iPrev;                       /* Previous thread used to flush PMA */\n  u8 nTask;                       /* Size of aTask[] array */\n  u8 typeMask;\n  SortSubtask aTask[1];           /* One or more subtasks */\n};\n\n#define SORTER_TYPE_INTEGER 0x01\n#define SORTER_TYPE_TEXT    0x02\n\n/*\n** An instance of the following object is used to read records out of a\n** PMA, in sorted order.  The next key to be read is cached in nKey/aKey.\n** aKey might point into aMap or into aBuffer.  If neither of those locations\n** contain a contiguous representation of the key, then aAlloc is allocated\n** and the key is copied into aAlloc and aKey is made to poitn to aAlloc.\n**\n** pFd==0 at EOF.\n*/\nstruct PmaReader {\n  i64 iReadOff;               /* Current read offset */\n  i64 iEof;                   /* 1 byte past EOF for this PmaReader */\n  int nAlloc;                 /* Bytes of space at aAlloc */\n  int nKey;                   /* Number of bytes in key */\n  sqlite3_file *pFd;          /* File handle we are reading from */\n  u8 *aAlloc;                 /* Space for aKey if aBuffer and pMap wont work */\n  u8 *aKey;                   /* Pointer to current key */\n  u8 *aBuffer;                /* Current read buffer */\n  int nBuffer;                /* Size of read buffer in bytes */\n  u8 *aMap;                   /* Pointer to mapping of entire file */\n  IncrMerger *pIncr;          /* Incremental merger */\n};\n\n/*\n** Normally, a PmaReader object iterates through an existing PMA stored \n** within a temp file. However, if the PmaReader.pIncr variable points to\n** an object of the following type, it may be used to iterate/merge through\n** multiple PMAs simultaneously.\n**\n** There are two types of IncrMerger object - single (bUseThread==0) and \n** multi-threaded (bUseThread==1). \n**\n** A multi-threaded IncrMerger object uses two temporary files - aFile[0] \n** and aFile[1]. Neither file is allowed to grow to more than mxSz bytes in \n** size. When the IncrMerger is initialized, it reads enough data from \n** pMerger to populate aFile[0]. It then sets variables within the \n** corresponding PmaReader object to read from that file and kicks off \n** a background thread to populate aFile[1] with the next mxSz bytes of \n** sorted record data from pMerger. \n**\n** When the PmaReader reaches the end of aFile[0], it blocks until the\n** background thread has finished populating aFile[1]. It then exchanges\n** the contents of the aFile[0] and aFile[1] variables within this structure,\n** sets the PmaReader fields to read from the new aFile[0] and kicks off\n** another background thread to populate the new aFile[1]. And so on, until\n** the contents of pMerger are exhausted.\n**\n** A single-threaded IncrMerger does not open any temporary files of its\n** own. Instead, it has exclusive access to mxSz bytes of space beginning\n** at offset iStartOff of file pTask->file2. And instead of using a \n** background thread to prepare data for the PmaReader, with a single\n** threaded IncrMerger the allocate part of pTask->file2 is \"refilled\" with\n** keys from pMerger by the calling thread whenever the PmaReader runs out\n** of data.\n*/\nstruct IncrMerger {\n  SortSubtask *pTask;             /* Task that owns this merger */\n  MergeEngine *pMerger;           /* Merge engine thread reads data from */\n  i64 iStartOff;                  /* Offset to start writing file at */\n  int mxSz;                       /* Maximum bytes of data to store */\n  int bEof;                       /* Set to true when merge is finished */\n  int bUseThread;                 /* True to use a bg thread for this object */\n  SorterFile aFile[2];            /* aFile[0] for reading, [1] for writing */\n};\n\n/*\n** An instance of this object is used for writing a PMA.\n**\n** The PMA is written one record at a time.  Each record is of an arbitrary\n** size.  But I/O is more efficient if it occurs in page-sized blocks where\n** each block is aligned on a page boundary.  This object caches writes to\n** the PMA so that aligned, page-size blocks are written.\n*/\nstruct PmaWriter {\n  int eFWErr;                     /* Non-zero if in an error state */\n  u8 *aBuffer;                    /* Pointer to write buffer */\n  int nBuffer;                    /* Size of write buffer in bytes */\n  int iBufStart;                  /* First byte of buffer to write */\n  int iBufEnd;                    /* Last byte of buffer to write */\n  i64 iWriteOff;                  /* Offset of start of buffer in file */\n  sqlite3_file *pFd;              /* File handle to write to */\n};\n\n/*\n** This object is the header on a single record while that record is being\n** held in memory and prior to being written out as part of a PMA.\n**\n** How the linked list is connected depends on how memory is being managed\n** by this module. If using a separate allocation for each in-memory record\n** (VdbeSorter.list.aMemory==0), then the list is always connected using the\n** SorterRecord.u.pNext pointers.\n**\n** Or, if using the single large allocation method (VdbeSorter.list.aMemory!=0),\n** then while records are being accumulated the list is linked using the\n** SorterRecord.u.iNext offset. This is because the aMemory[] array may\n** be sqlite3Realloc()ed while records are being accumulated. Once the VM\n** has finished passing records to the sorter, or when the in-memory buffer\n** is full, the list is sorted. As part of the sorting process, it is\n** converted to use the SorterRecord.u.pNext pointers. See function\n** vdbeSorterSort() for details.\n*/\nstruct SorterRecord {\n  int nVal;                       /* Size of the record in bytes */\n  union {\n    SorterRecord *pNext;          /* Pointer to next record in list */\n    int iNext;                    /* Offset within aMemory of next record */\n  } u;\n  /* The data for the record immediately follows this header */\n};\n\n/* Return a pointer to the buffer containing the record data for SorterRecord\n** object p. Should be used as if:\n**\n**   void *SRVAL(SorterRecord *p) { return (void*)&p[1]; }\n*/\n#define SRVAL(p) ((void*)((SorterRecord*)(p) + 1))\n\n\n/* Maximum number of PMAs that a single MergeEngine can merge */\n#define SORTER_MAX_MERGE_COUNT 16\n\nstatic int vdbeIncrSwap(IncrMerger*);\nstatic void vdbeIncrFree(IncrMerger *);\n\n/*\n** Free all memory belonging to the PmaReader object passed as the\n** argument. All structure fields are set to zero before returning.\n*/\nstatic void vdbePmaReaderClear(PmaReader *pReadr){\n  sqlite3_free(pReadr->aAlloc);\n  sqlite3_free(pReadr->aBuffer);\n  if( pReadr->aMap ) sqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap);\n  vdbeIncrFree(pReadr->pIncr);\n  memset(pReadr, 0, sizeof(PmaReader));\n}\n\n/*\n** Read the next nByte bytes of data from the PMA p.\n** If successful, set *ppOut to point to a buffer containing the data\n** and return SQLITE_OK. Otherwise, if an error occurs, return an SQLite\n** error code.\n**\n** The buffer returned in *ppOut is only valid until the\n** next call to this function.\n*/\nstatic int vdbePmaReadBlob(\n  PmaReader *p,                   /* PmaReader from which to take the blob */\n  int nByte,                      /* Bytes of data to read */\n  u8 **ppOut                      /* OUT: Pointer to buffer containing data */\n){\n  int iBuf;                       /* Offset within buffer to read from */\n  int nAvail;                     /* Bytes of data available in buffer */\n\n  if( p->aMap ){\n    *ppOut = &p->aMap[p->iReadOff];\n    p->iReadOff += nByte;\n    return SQLITE_OK;\n  }\n\n  assert( p->aBuffer );\n\n  /* If there is no more data to be read from the buffer, read the next \n  ** p->nBuffer bytes of data from the file into it. Or, if there are less\n  ** than p->nBuffer bytes remaining in the PMA, read all remaining data.  */\n  iBuf = p->iReadOff % p->nBuffer;\n  if( iBuf==0 ){\n    int nRead;                    /* Bytes to read from disk */\n    int rc;                       /* sqlite3OsRead() return code */\n\n    /* Determine how many bytes of data to read. */\n    if( (p->iEof - p->iReadOff) > (i64)p->nBuffer ){\n      nRead = p->nBuffer;\n    }else{\n      nRead = (int)(p->iEof - p->iReadOff);\n    }\n    assert( nRead>0 );\n\n    /* Readr data from the file. Return early if an error occurs. */\n    rc = sqlite3OsRead(p->pFd, p->aBuffer, nRead, p->iReadOff);\n    assert( rc!=SQLITE_IOERR_SHORT_READ );\n    if( rc!=SQLITE_OK ) return rc;\n  }\n  nAvail = p->nBuffer - iBuf; \n\n  if( nByte<=nAvail ){\n    /* The requested data is available in the in-memory buffer. In this\n    ** case there is no need to make a copy of the data, just return a \n    ** pointer into the buffer to the caller.  */\n    *ppOut = &p->aBuffer[iBuf];\n    p->iReadOff += nByte;\n  }else{\n    /* The requested data is not all available in the in-memory buffer.\n    ** In this case, allocate space at p->aAlloc[] to copy the requested\n    ** range into. Then return a copy of pointer p->aAlloc to the caller.  */\n    int nRem;                     /* Bytes remaining to copy */\n\n    /* Extend the p->aAlloc[] allocation if required. */\n    if( p->nAlloc<nByte ){\n      u8 *aNew;\n      int nNew = MAX(128, p->nAlloc*2);\n      while( nByte>nNew ) nNew = nNew*2;\n      aNew = sqlite3Realloc(p->aAlloc, nNew);\n      if( !aNew ) return SQLITE_NOMEM_BKPT;\n      p->nAlloc = nNew;\n      p->aAlloc = aNew;\n    }\n\n    /* Copy as much data as is available in the buffer into the start of\n    ** p->aAlloc[].  */\n    memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail);\n    p->iReadOff += nAvail;\n    nRem = nByte - nAvail;\n\n    /* The following loop copies up to p->nBuffer bytes per iteration into\n    ** the p->aAlloc[] buffer.  */\n    while( nRem>0 ){\n      int rc;                     /* vdbePmaReadBlob() return code */\n      int nCopy;                  /* Number of bytes to copy */\n      u8 *aNext;                  /* Pointer to buffer to copy data from */\n\n      nCopy = nRem;\n      if( nRem>p->nBuffer ) nCopy = p->nBuffer;\n      rc = vdbePmaReadBlob(p, nCopy, &aNext);\n      if( rc!=SQLITE_OK ) return rc;\n      assert( aNext!=p->aAlloc );\n      memcpy(&p->aAlloc[nByte - nRem], aNext, nCopy);\n      nRem -= nCopy;\n    }\n\n    *ppOut = p->aAlloc;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Read a varint from the stream of data accessed by p. Set *pnOut to\n** the value read.\n*/\nstatic int vdbePmaReadVarint(PmaReader *p, u64 *pnOut){\n  int iBuf;\n\n  if( p->aMap ){\n    p->iReadOff += sqlite3GetVarint(&p->aMap[p->iReadOff], pnOut);\n  }else{\n    iBuf = p->iReadOff % p->nBuffer;\n    if( iBuf && (p->nBuffer-iBuf)>=9 ){\n      p->iReadOff += sqlite3GetVarint(&p->aBuffer[iBuf], pnOut);\n    }else{\n      u8 aVarint[16], *a;\n      int i = 0, rc;\n      do{\n        rc = vdbePmaReadBlob(p, 1, &a);\n        if( rc ) return rc;\n        aVarint[(i++)&0xf] = a[0];\n      }while( (a[0]&0x80)!=0 );\n      sqlite3GetVarint(aVarint, pnOut);\n    }\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Attempt to memory map file pFile. If successful, set *pp to point to the\n** new mapping and return SQLITE_OK. If the mapping is not attempted \n** (because the file is too large or the VFS layer is configured not to use\n** mmap), return SQLITE_OK and set *pp to NULL.\n**\n** Or, if an error occurs, return an SQLite error code. The final value of\n** *pp is undefined in this case.\n*/\nstatic int vdbeSorterMapFile(SortSubtask *pTask, SorterFile *pFile, u8 **pp){\n  int rc = SQLITE_OK;\n  if( pFile->iEof<=(i64)(pTask->pSorter->db->nMaxSorterMmap) ){\n    sqlite3_file *pFd = pFile->pFd;\n    if( pFd->pMethods->iVersion>=3 ){\n      rc = sqlite3OsFetch(pFd, 0, (int)pFile->iEof, (void**)pp);\n      testcase( rc!=SQLITE_OK );\n    }\n  }\n  return rc;\n}\n\n/*\n** Attach PmaReader pReadr to file pFile (if it is not already attached to\n** that file) and seek it to offset iOff within the file.  Return SQLITE_OK \n** if successful, or an SQLite error code if an error occurs.\n*/\nstatic int vdbePmaReaderSeek(\n  SortSubtask *pTask,             /* Task context */\n  PmaReader *pReadr,              /* Reader whose cursor is to be moved */\n  SorterFile *pFile,              /* Sorter file to read from */\n  i64 iOff                        /* Offset in pFile */\n){\n  int rc = SQLITE_OK;\n\n  assert( pReadr->pIncr==0 || pReadr->pIncr->bEof==0 );\n\n  if( sqlite3FaultSim(201) ) return SQLITE_IOERR_READ;\n  if( pReadr->aMap ){\n    sqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap);\n    pReadr->aMap = 0;\n  }\n  pReadr->iReadOff = iOff;\n  pReadr->iEof = pFile->iEof;\n  pReadr->pFd = pFile->pFd;\n\n  rc = vdbeSorterMapFile(pTask, pFile, &pReadr->aMap);\n  if( rc==SQLITE_OK && pReadr->aMap==0 ){\n    int pgsz = pTask->pSorter->pgsz;\n    int iBuf = pReadr->iReadOff % pgsz;\n    if( pReadr->aBuffer==0 ){\n      pReadr->aBuffer = (u8*)sqlite3Malloc(pgsz);\n      if( pReadr->aBuffer==0 ) rc = SQLITE_NOMEM_BKPT;\n      pReadr->nBuffer = pgsz;\n    }\n    if( rc==SQLITE_OK && iBuf ){\n      int nRead = pgsz - iBuf;\n      if( (pReadr->iReadOff + nRead) > pReadr->iEof ){\n        nRead = (int)(pReadr->iEof - pReadr->iReadOff);\n      }\n      rc = sqlite3OsRead(\n          pReadr->pFd, &pReadr->aBuffer[iBuf], nRead, pReadr->iReadOff\n      );\n      testcase( rc!=SQLITE_OK );\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Advance PmaReader pReadr to the next key in its PMA. Return SQLITE_OK if\n** no error occurs, or an SQLite error code if one does.\n*/\nstatic int vdbePmaReaderNext(PmaReader *pReadr){\n  int rc = SQLITE_OK;             /* Return Code */\n  u64 nRec = 0;                   /* Size of record in bytes */\n\n\n  if( pReadr->iReadOff>=pReadr->iEof ){\n    IncrMerger *pIncr = pReadr->pIncr;\n    int bEof = 1;\n    if( pIncr ){\n      rc = vdbeIncrSwap(pIncr);\n      if( rc==SQLITE_OK && pIncr->bEof==0 ){\n        rc = vdbePmaReaderSeek(\n            pIncr->pTask, pReadr, &pIncr->aFile[0], pIncr->iStartOff\n        );\n        bEof = 0;\n      }\n    }\n\n    if( bEof ){\n      /* This is an EOF condition */\n      vdbePmaReaderClear(pReadr);\n      testcase( rc!=SQLITE_OK );\n      return rc;\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = vdbePmaReadVarint(pReadr, &nRec);\n  }\n  if( rc==SQLITE_OK ){\n    pReadr->nKey = (int)nRec;\n    rc = vdbePmaReadBlob(pReadr, (int)nRec, &pReadr->aKey);\n    testcase( rc!=SQLITE_OK );\n  }\n\n  return rc;\n}\n\n/*\n** Initialize PmaReader pReadr to scan through the PMA stored in file pFile\n** starting at offset iStart and ending at offset iEof-1. This function \n** leaves the PmaReader pointing to the first key in the PMA (or EOF if the \n** PMA is empty).\n**\n** If the pnByte parameter is NULL, then it is assumed that the file \n** contains a single PMA, and that that PMA omits the initial length varint.\n*/\nstatic int vdbePmaReaderInit(\n  SortSubtask *pTask,             /* Task context */\n  SorterFile *pFile,              /* Sorter file to read from */\n  i64 iStart,                     /* Start offset in pFile */\n  PmaReader *pReadr,              /* PmaReader to populate */\n  i64 *pnByte                     /* IN/OUT: Increment this value by PMA size */\n){\n  int rc;\n\n  assert( pFile->iEof>iStart );\n  assert( pReadr->aAlloc==0 && pReadr->nAlloc==0 );\n  assert( pReadr->aBuffer==0 );\n  assert( pReadr->aMap==0 );\n\n  rc = vdbePmaReaderSeek(pTask, pReadr, pFile, iStart);\n  if( rc==SQLITE_OK ){\n    u64 nByte = 0;                 /* Size of PMA in bytes */\n    rc = vdbePmaReadVarint(pReadr, &nByte);\n    pReadr->iEof = pReadr->iReadOff + nByte;\n    *pnByte += nByte;\n  }\n\n  if( rc==SQLITE_OK ){\n    rc = vdbePmaReaderNext(pReadr);\n  }\n  return rc;\n}\n\n/*\n** A version of vdbeSorterCompare() that assumes that it has already been\n** determined that the first field of key1 is equal to the first field of \n** key2.\n*/\nstatic int vdbeSorterCompareTail(\n  SortSubtask *pTask,             /* Subtask context (for pKeyInfo) */\n  int *pbKey2Cached,              /* True if pTask->pUnpacked is pKey2 */\n  const void *pKey1, int nKey1,   /* Left side of comparison */\n  const void *pKey2, int nKey2    /* Right side of comparison */\n){\n  UnpackedRecord *r2 = pTask->pUnpacked;\n  if( *pbKey2Cached==0 ){\n    sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2);\n    *pbKey2Cached = 1;\n  }\n  return sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, r2, 1);\n}\n\n/*\n** Compare key1 (buffer pKey1, size nKey1 bytes) with key2 (buffer pKey2, \n** size nKey2 bytes). Use (pTask->pKeyInfo) for the collation sequences\n** used by the comparison. Return the result of the comparison.\n**\n** If IN/OUT parameter *pbKey2Cached is true when this function is called,\n** it is assumed that (pTask->pUnpacked) contains the unpacked version\n** of key2. If it is false, (pTask->pUnpacked) is populated with the unpacked\n** version of key2 and *pbKey2Cached set to true before returning.\n**\n** If an OOM error is encountered, (pTask->pUnpacked->error_rc) is set\n** to SQLITE_NOMEM.\n*/\nstatic int vdbeSorterCompare(\n  SortSubtask *pTask,             /* Subtask context (for pKeyInfo) */\n  int *pbKey2Cached,              /* True if pTask->pUnpacked is pKey2 */\n  const void *pKey1, int nKey1,   /* Left side of comparison */\n  const void *pKey2, int nKey2    /* Right side of comparison */\n){\n  UnpackedRecord *r2 = pTask->pUnpacked;\n  if( !*pbKey2Cached ){\n    sqlite3VdbeRecordUnpack(pTask->pSorter->pKeyInfo, nKey2, pKey2, r2);\n    *pbKey2Cached = 1;\n  }\n  return sqlite3VdbeRecordCompare(nKey1, pKey1, r2);\n}\n\n/*\n** A specially optimized version of vdbeSorterCompare() that assumes that\n** the first field of each key is a TEXT value and that the collation\n** sequence to compare them with is BINARY.\n*/\nstatic int vdbeSorterCompareText(\n  SortSubtask *pTask,             /* Subtask context (for pKeyInfo) */\n  int *pbKey2Cached,              /* True if pTask->pUnpacked is pKey2 */\n  const void *pKey1, int nKey1,   /* Left side of comparison */\n  const void *pKey2, int nKey2    /* Right side of comparison */\n){\n  const u8 * const p1 = (const u8 * const)pKey1;\n  const u8 * const p2 = (const u8 * const)pKey2;\n  const u8 * const v1 = &p1[ p1[0] ];   /* Pointer to value 1 */\n  const u8 * const v2 = &p2[ p2[0] ];   /* Pointer to value 2 */\n\n  int n1;\n  int n2;\n  int res;\n\n  getVarint32(&p1[1], n1); n1 = (n1 - 13) / 2;\n  getVarint32(&p2[1], n2); n2 = (n2 - 13) / 2;\n  res = memcmp(v1, v2, MIN(n1, n2));\n  if( res==0 ){\n    res = n1 - n2;\n  }\n\n  if( res==0 ){\n    if( pTask->pSorter->pKeyInfo->nField>1 ){\n      res = vdbeSorterCompareTail(\n          pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2\n      );\n    }\n  }else{\n    if( pTask->pSorter->pKeyInfo->aSortOrder[0] ){\n      res = res * -1;\n    }\n  }\n\n  return res;\n}\n\n/*\n** A specially optimized version of vdbeSorterCompare() that assumes that\n** the first field of each key is an INTEGER value.\n*/\nstatic int vdbeSorterCompareInt(\n  SortSubtask *pTask,             /* Subtask context (for pKeyInfo) */\n  int *pbKey2Cached,              /* True if pTask->pUnpacked is pKey2 */\n  const void *pKey1, int nKey1,   /* Left side of comparison */\n  const void *pKey2, int nKey2    /* Right side of comparison */\n){\n  const u8 * const p1 = (const u8 * const)pKey1;\n  const u8 * const p2 = (const u8 * const)pKey2;\n  const int s1 = p1[1];                 /* Left hand serial type */\n  const int s2 = p2[1];                 /* Right hand serial type */\n  const u8 * const v1 = &p1[ p1[0] ];   /* Pointer to value 1 */\n  const u8 * const v2 = &p2[ p2[0] ];   /* Pointer to value 2 */\n  int res;                              /* Return value */\n\n  assert( (s1>0 && s1<7) || s1==8 || s1==9 );\n  assert( (s2>0 && s2<7) || s2==8 || s2==9 );\n\n  if( s1>7 && s2>7 ){\n    res = s1 - s2;\n  }else{\n    if( s1==s2 ){\n      if( (*v1 ^ *v2) & 0x80 ){\n        /* The two values have different signs */\n        res = (*v1 & 0x80) ? -1 : +1;\n      }else{\n        /* The two values have the same sign. Compare using memcmp(). */\n        static const u8 aLen[] = {0, 1, 2, 3, 4, 6, 8 };\n        int i;\n        res = 0;\n        for(i=0; i<aLen[s1]; i++){\n          if( (res = v1[i] - v2[i]) ) break;\n        }\n      }\n    }else{\n      if( s2>7 ){\n        res = +1;\n      }else if( s1>7 ){\n        res = -1;\n      }else{\n        res = s1 - s2;\n      }\n      assert( res!=0 );\n\n      if( res>0 ){\n        if( *v1 & 0x80 ) res = -1;\n      }else{\n        if( *v2 & 0x80 ) res = +1;\n      }\n    }\n  }\n\n  if( res==0 ){\n    if( pTask->pSorter->pKeyInfo->nField>1 ){\n      res = vdbeSorterCompareTail(\n          pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2\n      );\n    }\n  }else if( pTask->pSorter->pKeyInfo->aSortOrder[0] ){\n    res = res * -1;\n  }\n\n  return res;\n}\n\n/*\n** Initialize the temporary index cursor just opened as a sorter cursor.\n**\n** Usually, the sorter module uses the value of (pCsr->pKeyInfo->nField)\n** to determine the number of fields that should be compared from the\n** records being sorted. However, if the value passed as argument nField\n** is non-zero and the sorter is able to guarantee a stable sort, nField\n** is used instead. This is used when sorting records for a CREATE INDEX\n** statement. In this case, keys are always delivered to the sorter in\n** order of the primary key, which happens to be make up the final part \n** of the records being sorted. So if the sort is stable, there is never\n** any reason to compare PK fields and they can be ignored for a small\n** performance boost.\n**\n** The sorter can guarantee a stable sort when running in single-threaded\n** mode, but not in multi-threaded mode.\n**\n** SQLITE_OK is returned if successful, or an SQLite error code otherwise.\n*/\nint sqlite3VdbeSorterInit(\n  sqlite3 *db,                    /* Database connection (for malloc()) */\n  int nField,                     /* Number of key fields in each record */\n  VdbeCursor *pCsr                /* Cursor that holds the new sorter */\n){\n  int pgsz;                       /* Page size of main database */\n  int i;                          /* Used to iterate through aTask[] */\n  VdbeSorter *pSorter;            /* The new sorter */\n  KeyInfo *pKeyInfo;              /* Copy of pCsr->pKeyInfo with db==0 */\n  int szKeyInfo;                  /* Size of pCsr->pKeyInfo in bytes */\n  int sz;                         /* Size of pSorter in bytes */\n  int rc = SQLITE_OK;\n#if SQLITE_MAX_WORKER_THREADS==0\n# define nWorker 0\n#else\n  int nWorker;\n#endif\n\n  /* Initialize the upper limit on the number of worker threads */\n#if SQLITE_MAX_WORKER_THREADS>0\n  if( sqlite3TempInMemory(db) || sqlite3GlobalConfig.bCoreMutex==0 ){\n    nWorker = 0;\n  }else{\n    nWorker = db->aLimit[SQLITE_LIMIT_WORKER_THREADS];\n  }\n#endif\n\n  /* Do not allow the total number of threads (main thread + all workers)\n  ** to exceed the maximum merge count */\n#if SQLITE_MAX_WORKER_THREADS>=SORTER_MAX_MERGE_COUNT\n  if( nWorker>=SORTER_MAX_MERGE_COUNT ){\n    nWorker = SORTER_MAX_MERGE_COUNT-1;\n  }\n#endif\n\n  assert( pCsr->pKeyInfo && pCsr->pBt==0 );\n  assert( pCsr->eCurType==CURTYPE_SORTER );\n  szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nField-1)*sizeof(CollSeq*);\n  sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);\n\n  pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);\n  pCsr->uc.pSorter = pSorter;\n  if( pSorter==0 ){\n    rc = SQLITE_NOMEM_BKPT;\n  }else{\n    pSorter->pKeyInfo = pKeyInfo = (KeyInfo*)((u8*)pSorter + sz);\n    memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);\n    pKeyInfo->db = 0;\n    if( nField && nWorker==0 ){\n      pKeyInfo->nXField += (pKeyInfo->nField - nField);\n      pKeyInfo->nField = nField;\n    }\n    pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);\n    pSorter->nTask = nWorker + 1;\n    pSorter->iPrev = (u8)(nWorker - 1);\n    pSorter->bUseThreads = (pSorter->nTask>1);\n    pSorter->db = db;\n    for(i=0; i<pSorter->nTask; i++){\n      SortSubtask *pTask = &pSorter->aTask[i];\n      pTask->pSorter = pSorter;\n    }\n\n    if( !sqlite3TempInMemory(db) ){\n      i64 mxCache;                /* Cache size in bytes*/\n      u32 szPma = sqlite3GlobalConfig.szPma;\n      pSorter->mnPmaSize = szPma * pgsz;\n\n      mxCache = db->aDb[0].pSchema->cache_size;\n      if( mxCache<0 ){\n        /* A negative cache-size value C indicates that the cache is abs(C)\n        ** KiB in size.  */\n        mxCache = mxCache * -1024;\n      }else{\n        mxCache = mxCache * pgsz;\n      }\n      mxCache = MIN(mxCache, SQLITE_MAX_PMASZ);\n      pSorter->mxPmaSize = MAX(pSorter->mnPmaSize, (int)mxCache);\n\n      /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of\n      ** scratch memory using SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary\n      ** large heap allocations.\n      */\n      if( sqlite3GlobalConfig.pScratch==0 ){\n        assert( pSorter->iMemory==0 );\n        pSorter->nMemory = pgsz;\n        pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz);\n        if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM_BKPT;\n      }\n    }\n\n    if( (pKeyInfo->nField+pKeyInfo->nXField)<13 \n     && (pKeyInfo->aColl[0]==0 || pKeyInfo->aColl[0]==db->pDfltColl)\n    ){\n      pSorter->typeMask = SORTER_TYPE_INTEGER | SORTER_TYPE_TEXT;\n    }\n  }\n\n  return rc;\n}\n#undef nWorker   /* Defined at the top of this function */\n\n/*\n** Free the list of sorted records starting at pRecord.\n*/\nstatic void vdbeSorterRecordFree(sqlite3 *db, SorterRecord *pRecord){\n  SorterRecord *p;\n  SorterRecord *pNext;\n  for(p=pRecord; p; p=pNext){\n    pNext = p->u.pNext;\n    sqlite3DbFree(db, p);\n  }\n}\n\n/*\n** Free all resources owned by the object indicated by argument pTask. All \n** fields of *pTask are zeroed before returning.\n*/\nstatic void vdbeSortSubtaskCleanup(sqlite3 *db, SortSubtask *pTask){\n  sqlite3DbFree(db, pTask->pUnpacked);\n#if SQLITE_MAX_WORKER_THREADS>0\n  /* pTask->list.aMemory can only be non-zero if it was handed memory\n  ** from the main thread.  That only occurs SQLITE_MAX_WORKER_THREADS>0 */\n  if( pTask->list.aMemory ){\n    sqlite3_free(pTask->list.aMemory);\n  }else\n#endif\n  {\n    assert( pTask->list.aMemory==0 );\n    vdbeSorterRecordFree(0, pTask->list.pList);\n  }\n  if( pTask->file.pFd ){\n    sqlite3OsCloseFree(pTask->file.pFd);\n  }\n  if( pTask->file2.pFd ){\n    sqlite3OsCloseFree(pTask->file2.pFd);\n  }\n  memset(pTask, 0, sizeof(SortSubtask));\n}\n\n#ifdef SQLITE_DEBUG_SORTER_THREADS\nstatic void vdbeSorterWorkDebug(SortSubtask *pTask, const char *zEvent){\n  i64 t;\n  int iTask = (pTask - pTask->pSorter->aTask);\n  sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t);\n  fprintf(stderr, \"%lld:%d %s\\n\", t, iTask, zEvent);\n}\nstatic void vdbeSorterRewindDebug(const char *zEvent){\n  i64 t;\n  sqlite3OsCurrentTimeInt64(sqlite3_vfs_find(0), &t);\n  fprintf(stderr, \"%lld:X %s\\n\", t, zEvent);\n}\nstatic void vdbeSorterPopulateDebug(\n  SortSubtask *pTask,\n  const char *zEvent\n){\n  i64 t;\n  int iTask = (pTask - pTask->pSorter->aTask);\n  sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t);\n  fprintf(stderr, \"%lld:bg%d %s\\n\", t, iTask, zEvent);\n}\nstatic void vdbeSorterBlockDebug(\n  SortSubtask *pTask,\n  int bBlocked,\n  const char *zEvent\n){\n  if( bBlocked ){\n    i64 t;\n    sqlite3OsCurrentTimeInt64(pTask->pSorter->db->pVfs, &t);\n    fprintf(stderr, \"%lld:main %s\\n\", t, zEvent);\n  }\n}\n#else\n# define vdbeSorterWorkDebug(x,y)\n# define vdbeSorterRewindDebug(y)\n# define vdbeSorterPopulateDebug(x,y)\n# define vdbeSorterBlockDebug(x,y,z)\n#endif\n\n#if SQLITE_MAX_WORKER_THREADS>0\n/*\n** Join thread pTask->thread.\n*/\nstatic int vdbeSorterJoinThread(SortSubtask *pTask){\n  int rc = SQLITE_OK;\n  if( pTask->pThread ){\n#ifdef SQLITE_DEBUG_SORTER_THREADS\n    int bDone = pTask->bDone;\n#endif\n    void *pRet = SQLITE_INT_TO_PTR(SQLITE_ERROR);\n    vdbeSorterBlockDebug(pTask, !bDone, \"enter\");\n    (void)sqlite3ThreadJoin(pTask->pThread, &pRet);\n    vdbeSorterBlockDebug(pTask, !bDone, \"exit\");\n    rc = SQLITE_PTR_TO_INT(pRet);\n    assert( pTask->bDone==1 );\n    pTask->bDone = 0;\n    pTask->pThread = 0;\n  }\n  return rc;\n}\n\n/*\n** Launch a background thread to run xTask(pIn).\n*/\nstatic int vdbeSorterCreateThread(\n  SortSubtask *pTask,             /* Thread will use this task object */\n  void *(*xTask)(void*),          /* Routine to run in a separate thread */\n  void *pIn                       /* Argument passed into xTask() */\n){\n  assert( pTask->pThread==0 && pTask->bDone==0 );\n  return sqlite3ThreadCreate(&pTask->pThread, xTask, pIn);\n}\n\n/*\n** Join all outstanding threads launched by SorterWrite() to create \n** level-0 PMAs.\n*/\nstatic int vdbeSorterJoinAll(VdbeSorter *pSorter, int rcin){\n  int rc = rcin;\n  int i;\n\n  /* This function is always called by the main user thread.\n  **\n  ** If this function is being called after SorterRewind() has been called, \n  ** it is possible that thread pSorter->aTask[pSorter->nTask-1].pThread\n  ** is currently attempt to join one of the other threads. To avoid a race\n  ** condition where this thread also attempts to join the same object, join \n  ** thread pSorter->aTask[pSorter->nTask-1].pThread first. */\n  for(i=pSorter->nTask-1; i>=0; i--){\n    SortSubtask *pTask = &pSorter->aTask[i];\n    int rc2 = vdbeSorterJoinThread(pTask);\n    if( rc==SQLITE_OK ) rc = rc2;\n  }\n  return rc;\n}\n#else\n# define vdbeSorterJoinAll(x,rcin) (rcin)\n# define vdbeSorterJoinThread(pTask) SQLITE_OK\n#endif\n\n/*\n** Allocate a new MergeEngine object capable of handling up to\n** nReader PmaReader inputs.\n**\n** nReader is automatically rounded up to the next power of two.\n** nReader may not exceed SORTER_MAX_MERGE_COUNT even after rounding up.\n*/\nstatic MergeEngine *vdbeMergeEngineNew(int nReader){\n  int N = 2;                      /* Smallest power of two >= nReader */\n  int nByte;                      /* Total bytes of space to allocate */\n  MergeEngine *pNew;              /* Pointer to allocated object to return */\n\n  assert( nReader<=SORTER_MAX_MERGE_COUNT );\n\n  while( N<nReader ) N += N;\n  nByte = sizeof(MergeEngine) + N * (sizeof(int) + sizeof(PmaReader));\n\n  pNew = sqlite3FaultSim(100) ? 0 : (MergeEngine*)sqlite3MallocZero(nByte);\n  if( pNew ){\n    pNew->nTree = N;\n    pNew->pTask = 0;\n    pNew->aReadr = (PmaReader*)&pNew[1];\n    pNew->aTree = (int*)&pNew->aReadr[N];\n  }\n  return pNew;\n}\n\n/*\n** Free the MergeEngine object passed as the only argument.\n*/\nstatic void vdbeMergeEngineFree(MergeEngine *pMerger){\n  int i;\n  if( pMerger ){\n    for(i=0; i<pMerger->nTree; i++){\n      vdbePmaReaderClear(&pMerger->aReadr[i]);\n    }\n  }\n  sqlite3_free(pMerger);\n}\n\n/*\n** Free all resources associated with the IncrMerger object indicated by\n** the first argument.\n*/\nstatic void vdbeIncrFree(IncrMerger *pIncr){\n  if( pIncr ){\n#if SQLITE_MAX_WORKER_THREADS>0\n    if( pIncr->bUseThread ){\n      vdbeSorterJoinThread(pIncr->pTask);\n      if( pIncr->aFile[0].pFd ) sqlite3OsCloseFree(pIncr->aFile[0].pFd);\n      if( pIncr->aFile[1].pFd ) sqlite3OsCloseFree(pIncr->aFile[1].pFd);\n    }\n#endif\n    vdbeMergeEngineFree(pIncr->pMerger);\n    sqlite3_free(pIncr);\n  }\n}\n\n/*\n** Reset a sorting cursor back to its original empty state.\n*/\nvoid sqlite3VdbeSorterReset(sqlite3 *db, VdbeSorter *pSorter){\n  int i;\n  (void)vdbeSorterJoinAll(pSorter, SQLITE_OK);\n  assert( pSorter->bUseThreads || pSorter->pReader==0 );\n#if SQLITE_MAX_WORKER_THREADS>0\n  if( pSorter->pReader ){\n    vdbePmaReaderClear(pSorter->pReader);\n    sqlite3DbFree(db, pSorter->pReader);\n    pSorter->pReader = 0;\n  }\n#endif\n  vdbeMergeEngineFree(pSorter->pMerger);\n  pSorter->pMerger = 0;\n  for(i=0; i<pSorter->nTask; i++){\n    SortSubtask *pTask = &pSorter->aTask[i];\n    vdbeSortSubtaskCleanup(db, pTask);\n    pTask->pSorter = pSorter;\n  }\n  if( pSorter->list.aMemory==0 ){\n    vdbeSorterRecordFree(0, pSorter->list.pList);\n  }\n  pSorter->list.pList = 0;\n  pSorter->list.szPMA = 0;\n  pSorter->bUsePMA = 0;\n  pSorter->iMemory = 0;\n  pSorter->mxKeysize = 0;\n  sqlite3DbFree(db, pSorter->pUnpacked);\n  pSorter->pUnpacked = 0;\n}\n\n/*\n** Free any cursor components allocated by sqlite3VdbeSorterXXX routines.\n*/\nvoid sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){\n  VdbeSorter *pSorter;\n  assert( pCsr->eCurType==CURTYPE_SORTER );\n  pSorter = pCsr->uc.pSorter;\n  if( pSorter ){\n    sqlite3VdbeSorterReset(db, pSorter);\n    sqlite3_free(pSorter->list.aMemory);\n    sqlite3DbFree(db, pSorter);\n    pCsr->uc.pSorter = 0;\n  }\n}\n\n#if SQLITE_MAX_MMAP_SIZE>0\n/*\n** The first argument is a file-handle open on a temporary file. The file\n** is guaranteed to be nByte bytes or smaller in size. This function\n** attempts to extend the file to nByte bytes in size and to ensure that\n** the VFS has memory mapped it.\n**\n** Whether or not the file does end up memory mapped of course depends on\n** the specific VFS implementation.\n*/\nstatic void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){\n  if( nByte<=(i64)(db->nMaxSorterMmap) && pFd->pMethods->iVersion>=3 ){\n    void *p = 0;\n    int chunksize = 4*1024;\n    sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_CHUNK_SIZE, &chunksize);\n    sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_SIZE_HINT, &nByte);\n    sqlite3OsFetch(pFd, 0, (int)nByte, &p);\n    sqlite3OsUnfetch(pFd, 0, p);\n  }\n}\n#else\n# define vdbeSorterExtendFile(x,y,z)\n#endif\n\n/*\n** Allocate space for a file-handle and open a temporary file. If successful,\n** set *ppFd to point to the malloc'd file-handle and return SQLITE_OK.\n** Otherwise, set *ppFd to 0 and return an SQLite error code.\n*/\nstatic int vdbeSorterOpenTempFile(\n  sqlite3 *db,                    /* Database handle doing sort */\n  i64 nExtend,                    /* Attempt to extend file to this size */\n  sqlite3_file **ppFd\n){\n  int rc;\n  if( sqlite3FaultSim(202) ) return SQLITE_IOERR_ACCESS;\n  rc = sqlite3OsOpenMalloc(db->pVfs, 0, ppFd,\n      SQLITE_OPEN_TEMP_JOURNAL |\n      SQLITE_OPEN_READWRITE    | SQLITE_OPEN_CREATE |\n      SQLITE_OPEN_EXCLUSIVE    | SQLITE_OPEN_DELETEONCLOSE, &rc\n  );\n  if( rc==SQLITE_OK ){\n    i64 max = SQLITE_MAX_MMAP_SIZE;\n    sqlite3OsFileControlHint(*ppFd, SQLITE_FCNTL_MMAP_SIZE, (void*)&max);\n    if( nExtend>0 ){\n      vdbeSorterExtendFile(db, *ppFd, nExtend);\n    }\n  }\n  return rc;\n}\n\n/*\n** If it has not already been allocated, allocate the UnpackedRecord \n** structure at pTask->pUnpacked. Return SQLITE_OK if successful (or \n** if no allocation was required), or SQLITE_NOMEM otherwise.\n*/\nstatic int vdbeSortAllocUnpacked(SortSubtask *pTask){\n  if( pTask->pUnpacked==0 ){\n    char *pFree;\n    pTask->pUnpacked = sqlite3VdbeAllocUnpackedRecord(\n        pTask->pSorter->pKeyInfo, 0, 0, &pFree\n    );\n    assert( pTask->pUnpacked==(UnpackedRecord*)pFree );\n    if( pFree==0 ) return SQLITE_NOMEM_BKPT;\n    pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nField;\n    pTask->pUnpacked->errCode = 0;\n  }\n  return SQLITE_OK;\n}\n\n\n/*\n** Merge the two sorted lists p1 and p2 into a single list.\n*/\nstatic SorterRecord *vdbeSorterMerge(\n  SortSubtask *pTask,             /* Calling thread context */\n  SorterRecord *p1,               /* First list to merge */\n  SorterRecord *p2                /* Second list to merge */\n){\n  SorterRecord *pFinal = 0;\n  SorterRecord **pp = &pFinal;\n  int bCached = 0;\n\n  assert( p1!=0 && p2!=0 );\n  for(;;){\n    int res;\n    res = pTask->xCompare(\n        pTask, &bCached, SRVAL(p1), p1->nVal, SRVAL(p2), p2->nVal\n    );\n\n    if( res<=0 ){\n      *pp = p1;\n      pp = &p1->u.pNext;\n      p1 = p1->u.pNext;\n      if( p1==0 ){\n        *pp = p2;\n        break;\n      }\n    }else{\n      *pp = p2;\n      pp = &p2->u.pNext;\n      p2 = p2->u.pNext;\n      bCached = 0;\n      if( p2==0 ){\n        *pp = p1;\n        break;\n      }\n    }\n  }\n  return pFinal;\n}\n\n/*\n** Return the SorterCompare function to compare values collected by the\n** sorter object passed as the only argument.\n*/\nstatic SorterCompare vdbeSorterGetCompare(VdbeSorter *p){\n  if( p->typeMask==SORTER_TYPE_INTEGER ){\n    return vdbeSorterCompareInt;\n  }else if( p->typeMask==SORTER_TYPE_TEXT ){\n    return vdbeSorterCompareText; \n  }\n  return vdbeSorterCompare;\n}\n\n/*\n** Sort the linked list of records headed at pTask->pList. Return \n** SQLITE_OK if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if \n** an error occurs.\n*/\nstatic int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){\n  int i;\n  SorterRecord **aSlot;\n  SorterRecord *p;\n  int rc;\n\n  rc = vdbeSortAllocUnpacked(pTask);\n  if( rc!=SQLITE_OK ) return rc;\n\n  p = pList->pList;\n  pTask->xCompare = vdbeSorterGetCompare(pTask->pSorter);\n\n  aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *));\n  if( !aSlot ){\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  while( p ){\n    SorterRecord *pNext;\n    if( pList->aMemory ){\n      if( (u8*)p==pList->aMemory ){\n        pNext = 0;\n      }else{\n        assert( p->u.iNext<sqlite3MallocSize(pList->aMemory) );\n        pNext = (SorterRecord*)&pList->aMemory[p->u.iNext];\n      }\n    }else{\n      pNext = p->u.pNext;\n    }\n\n    p->u.pNext = 0;\n    for(i=0; aSlot[i]; i++){\n      p = vdbeSorterMerge(pTask, p, aSlot[i]);\n      aSlot[i] = 0;\n    }\n    aSlot[i] = p;\n    p = pNext;\n  }\n\n  p = 0;\n  for(i=0; i<64; i++){\n    if( aSlot[i]==0 ) continue;\n    p = p ? vdbeSorterMerge(pTask, p, aSlot[i]) : aSlot[i];\n  }\n  pList->pList = p;\n\n  sqlite3_free(aSlot);\n  assert( pTask->pUnpacked->errCode==SQLITE_OK \n       || pTask->pUnpacked->errCode==SQLITE_NOMEM \n  );\n  return pTask->pUnpacked->errCode;\n}\n\n/*\n** Initialize a PMA-writer object.\n*/\nstatic void vdbePmaWriterInit(\n  sqlite3_file *pFd,              /* File handle to write to */\n  PmaWriter *p,                   /* Object to populate */\n  int nBuf,                       /* Buffer size */\n  i64 iStart                      /* Offset of pFd to begin writing at */\n){\n  memset(p, 0, sizeof(PmaWriter));\n  p->aBuffer = (u8*)sqlite3Malloc(nBuf);\n  if( !p->aBuffer ){\n    p->eFWErr = SQLITE_NOMEM_BKPT;\n  }else{\n    p->iBufEnd = p->iBufStart = (iStart % nBuf);\n    p->iWriteOff = iStart - p->iBufStart;\n    p->nBuffer = nBuf;\n    p->pFd = pFd;\n  }\n}\n\n/*\n** Write nData bytes of data to the PMA. Return SQLITE_OK\n** if successful, or an SQLite error code if an error occurs.\n*/\nstatic void vdbePmaWriteBlob(PmaWriter *p, u8 *pData, int nData){\n  int nRem = nData;\n  while( nRem>0 && p->eFWErr==0 ){\n    int nCopy = nRem;\n    if( nCopy>(p->nBuffer - p->iBufEnd) ){\n      nCopy = p->nBuffer - p->iBufEnd;\n    }\n\n    memcpy(&p->aBuffer[p->iBufEnd], &pData[nData-nRem], nCopy);\n    p->iBufEnd += nCopy;\n    if( p->iBufEnd==p->nBuffer ){\n      p->eFWErr = sqlite3OsWrite(p->pFd, \n          &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, \n          p->iWriteOff + p->iBufStart\n      );\n      p->iBufStart = p->iBufEnd = 0;\n      p->iWriteOff += p->nBuffer;\n    }\n    assert( p->iBufEnd<p->nBuffer );\n\n    nRem -= nCopy;\n  }\n}\n\n/*\n** Flush any buffered data to disk and clean up the PMA-writer object.\n** The results of using the PMA-writer after this call are undefined.\n** Return SQLITE_OK if flushing the buffered data succeeds or is not \n** required. Otherwise, return an SQLite error code.\n**\n** Before returning, set *piEof to the offset immediately following the\n** last byte written to the file.\n*/\nstatic int vdbePmaWriterFinish(PmaWriter *p, i64 *piEof){\n  int rc;\n  if( p->eFWErr==0 && ALWAYS(p->aBuffer) && p->iBufEnd>p->iBufStart ){\n    p->eFWErr = sqlite3OsWrite(p->pFd, \n        &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, \n        p->iWriteOff + p->iBufStart\n    );\n  }\n  *piEof = (p->iWriteOff + p->iBufEnd);\n  sqlite3_free(p->aBuffer);\n  rc = p->eFWErr;\n  memset(p, 0, sizeof(PmaWriter));\n  return rc;\n}\n\n/*\n** Write value iVal encoded as a varint to the PMA. Return \n** SQLITE_OK if successful, or an SQLite error code if an error occurs.\n*/\nstatic void vdbePmaWriteVarint(PmaWriter *p, u64 iVal){\n  int nByte; \n  u8 aByte[10];\n  nByte = sqlite3PutVarint(aByte, iVal);\n  vdbePmaWriteBlob(p, aByte, nByte);\n}\n\n/*\n** Write the current contents of in-memory linked-list pList to a level-0\n** PMA in the temp file belonging to sub-task pTask. Return SQLITE_OK if \n** successful, or an SQLite error code otherwise.\n**\n** The format of a PMA is:\n**\n**     * A varint. This varint contains the total number of bytes of content\n**       in the PMA (not including the varint itself).\n**\n**     * One or more records packed end-to-end in order of ascending keys. \n**       Each record consists of a varint followed by a blob of data (the \n**       key). The varint is the number of bytes in the blob of data.\n*/\nstatic int vdbeSorterListToPMA(SortSubtask *pTask, SorterList *pList){\n  sqlite3 *db = pTask->pSorter->db;\n  int rc = SQLITE_OK;             /* Return code */\n  PmaWriter writer;               /* Object used to write to the file */\n\n#ifdef SQLITE_DEBUG\n  /* Set iSz to the expected size of file pTask->file after writing the PMA. \n  ** This is used by an assert() statement at the end of this function.  */\n  i64 iSz = pList->szPMA + sqlite3VarintLen(pList->szPMA) + pTask->file.iEof;\n#endif\n\n  vdbeSorterWorkDebug(pTask, \"enter\");\n  memset(&writer, 0, sizeof(PmaWriter));\n  assert( pList->szPMA>0 );\n\n  /* If the first temporary PMA file has not been opened, open it now. */\n  if( pTask->file.pFd==0 ){\n    rc = vdbeSorterOpenTempFile(db, 0, &pTask->file.pFd);\n    assert( rc!=SQLITE_OK || pTask->file.pFd );\n    assert( pTask->file.iEof==0 );\n    assert( pTask->nPMA==0 );\n  }\n\n  /* Try to get the file to memory map */\n  if( rc==SQLITE_OK ){\n    vdbeSorterExtendFile(db, pTask->file.pFd, pTask->file.iEof+pList->szPMA+9);\n  }\n\n  /* Sort the list */\n  if( rc==SQLITE_OK ){\n    rc = vdbeSorterSort(pTask, pList);\n  }\n\n  if( rc==SQLITE_OK ){\n    SorterRecord *p;\n    SorterRecord *pNext = 0;\n\n    vdbePmaWriterInit(pTask->file.pFd, &writer, pTask->pSorter->pgsz,\n                      pTask->file.iEof);\n    pTask->nPMA++;\n    vdbePmaWriteVarint(&writer, pList->szPMA);\n    for(p=pList->pList; p; p=pNext){\n      pNext = p->u.pNext;\n      vdbePmaWriteVarint(&writer, p->nVal);\n      vdbePmaWriteBlob(&writer, SRVAL(p), p->nVal);\n      if( pList->aMemory==0 ) sqlite3_free(p);\n    }\n    pList->pList = p;\n    rc = vdbePmaWriterFinish(&writer, &pTask->file.iEof);\n  }\n\n  vdbeSorterWorkDebug(pTask, \"exit\");\n  assert( rc!=SQLITE_OK || pList->pList==0 );\n  assert( rc!=SQLITE_OK || pTask->file.iEof==iSz );\n  return rc;\n}\n\n/*\n** Advance the MergeEngine to its next entry.\n** Set *pbEof to true there is no next entry because\n** the MergeEngine has reached the end of all its inputs.\n**\n** Return SQLITE_OK if successful or an error code if an error occurs.\n*/\nstatic int vdbeMergeEngineStep(\n  MergeEngine *pMerger,      /* The merge engine to advance to the next row */\n  int *pbEof                 /* Set TRUE at EOF.  Set false for more content */\n){\n  int rc;\n  int iPrev = pMerger->aTree[1];/* Index of PmaReader to advance */\n  SortSubtask *pTask = pMerger->pTask;\n\n  /* Advance the current PmaReader */\n  rc = vdbePmaReaderNext(&pMerger->aReadr[iPrev]);\n\n  /* Update contents of aTree[] */\n  if( rc==SQLITE_OK ){\n    int i;                      /* Index of aTree[] to recalculate */\n    PmaReader *pReadr1;         /* First PmaReader to compare */\n    PmaReader *pReadr2;         /* Second PmaReader to compare */\n    int bCached = 0;\n\n    /* Find the first two PmaReaders to compare. The one that was just\n    ** advanced (iPrev) and the one next to it in the array.  */\n    pReadr1 = &pMerger->aReadr[(iPrev & 0xFFFE)];\n    pReadr2 = &pMerger->aReadr[(iPrev | 0x0001)];\n\n    for(i=(pMerger->nTree+iPrev)/2; i>0; i=i/2){\n      /* Compare pReadr1 and pReadr2. Store the result in variable iRes. */\n      int iRes;\n      if( pReadr1->pFd==0 ){\n        iRes = +1;\n      }else if( pReadr2->pFd==0 ){\n        iRes = -1;\n      }else{\n        iRes = pTask->xCompare(pTask, &bCached,\n            pReadr1->aKey, pReadr1->nKey, pReadr2->aKey, pReadr2->nKey\n        );\n      }\n\n      /* If pReadr1 contained the smaller value, set aTree[i] to its index.\n      ** Then set pReadr2 to the next PmaReader to compare to pReadr1. In this\n      ** case there is no cache of pReadr2 in pTask->pUnpacked, so set\n      ** pKey2 to point to the record belonging to pReadr2.\n      **\n      ** Alternatively, if pReadr2 contains the smaller of the two values,\n      ** set aTree[i] to its index and update pReadr1. If vdbeSorterCompare()\n      ** was actually called above, then pTask->pUnpacked now contains\n      ** a value equivalent to pReadr2. So set pKey2 to NULL to prevent\n      ** vdbeSorterCompare() from decoding pReadr2 again.\n      **\n      ** If the two values were equal, then the value from the oldest\n      ** PMA should be considered smaller. The VdbeSorter.aReadr[] array\n      ** is sorted from oldest to newest, so pReadr1 contains older values\n      ** than pReadr2 iff (pReadr1<pReadr2).  */\n      if( iRes<0 || (iRes==0 && pReadr1<pReadr2) ){\n        pMerger->aTree[i] = (int)(pReadr1 - pMerger->aReadr);\n        pReadr2 = &pMerger->aReadr[ pMerger->aTree[i ^ 0x0001] ];\n        bCached = 0;\n      }else{\n        if( pReadr1->pFd ) bCached = 0;\n        pMerger->aTree[i] = (int)(pReadr2 - pMerger->aReadr);\n        pReadr1 = &pMerger->aReadr[ pMerger->aTree[i ^ 0x0001] ];\n      }\n    }\n    *pbEof = (pMerger->aReadr[pMerger->aTree[1]].pFd==0);\n  }\n\n  return (rc==SQLITE_OK ? pTask->pUnpacked->errCode : rc);\n}\n\n#if SQLITE_MAX_WORKER_THREADS>0\n/*\n** The main routine for background threads that write level-0 PMAs.\n*/\nstatic void *vdbeSorterFlushThread(void *pCtx){\n  SortSubtask *pTask = (SortSubtask*)pCtx;\n  int rc;                         /* Return code */\n  assert( pTask->bDone==0 );\n  rc = vdbeSorterListToPMA(pTask, &pTask->list);\n  pTask->bDone = 1;\n  return SQLITE_INT_TO_PTR(rc);\n}\n#endif /* SQLITE_MAX_WORKER_THREADS>0 */\n\n/*\n** Flush the current contents of VdbeSorter.list to a new PMA, possibly\n** using a background thread.\n*/\nstatic int vdbeSorterFlushPMA(VdbeSorter *pSorter){\n#if SQLITE_MAX_WORKER_THREADS==0\n  pSorter->bUsePMA = 1;\n  return vdbeSorterListToPMA(&pSorter->aTask[0], &pSorter->list);\n#else\n  int rc = SQLITE_OK;\n  int i;\n  SortSubtask *pTask = 0;    /* Thread context used to create new PMA */\n  int nWorker = (pSorter->nTask-1);\n\n  /* Set the flag to indicate that at least one PMA has been written. \n  ** Or will be, anyhow.  */\n  pSorter->bUsePMA = 1;\n\n  /* Select a sub-task to sort and flush the current list of in-memory\n  ** records to disk. If the sorter is running in multi-threaded mode,\n  ** round-robin between the first (pSorter->nTask-1) tasks. Except, if\n  ** the background thread from a sub-tasks previous turn is still running,\n  ** skip it. If the first (pSorter->nTask-1) sub-tasks are all still busy,\n  ** fall back to using the final sub-task. The first (pSorter->nTask-1)\n  ** sub-tasks are prefered as they use background threads - the final \n  ** sub-task uses the main thread. */\n  for(i=0; i<nWorker; i++){\n    int iTest = (pSorter->iPrev + i + 1) % nWorker;\n    pTask = &pSorter->aTask[iTest];\n    if( pTask->bDone ){\n      rc = vdbeSorterJoinThread(pTask);\n    }\n    if( rc!=SQLITE_OK || pTask->pThread==0 ) break;\n  }\n\n  if( rc==SQLITE_OK ){\n    if( i==nWorker ){\n      /* Use the foreground thread for this operation */\n      rc = vdbeSorterListToPMA(&pSorter->aTask[nWorker], &pSorter->list);\n    }else{\n      /* Launch a background thread for this operation */\n      u8 *aMem = pTask->list.aMemory;\n      void *pCtx = (void*)pTask;\n\n      assert( pTask->pThread==0 && pTask->bDone==0 );\n      assert( pTask->list.pList==0 );\n      assert( pTask->list.aMemory==0 || pSorter->list.aMemory!=0 );\n\n      pSorter->iPrev = (u8)(pTask - pSorter->aTask);\n      pTask->list = pSorter->list;\n      pSorter->list.pList = 0;\n      pSorter->list.szPMA = 0;\n      if( aMem ){\n        pSorter->list.aMemory = aMem;\n        pSorter->nMemory = sqlite3MallocSize(aMem);\n      }else if( pSorter->list.aMemory ){\n        pSorter->list.aMemory = sqlite3Malloc(pSorter->nMemory);\n        if( !pSorter->list.aMemory ) return SQLITE_NOMEM_BKPT;\n      }\n\n      rc = vdbeSorterCreateThread(pTask, vdbeSorterFlushThread, pCtx);\n    }\n  }\n\n  return rc;\n#endif /* SQLITE_MAX_WORKER_THREADS!=0 */\n}\n\n/*\n** Add a record to the sorter.\n*/\nint sqlite3VdbeSorterWrite(\n  const VdbeCursor *pCsr,         /* Sorter cursor */\n  Mem *pVal                       /* Memory cell containing record */\n){\n  VdbeSorter *pSorter;\n  int rc = SQLITE_OK;             /* Return Code */\n  SorterRecord *pNew;             /* New list element */\n  int bFlush;                     /* True to flush contents of memory to PMA */\n  int nReq;                       /* Bytes of memory required */\n  int nPMA;                       /* Bytes of PMA space required */\n  int t;                          /* serial type of first record field */\n\n  assert( pCsr->eCurType==CURTYPE_SORTER );\n  pSorter = pCsr->uc.pSorter;\n  getVarint32((const u8*)&pVal->z[1], t);\n  if( t>0 && t<10 && t!=7 ){\n    pSorter->typeMask &= SORTER_TYPE_INTEGER;\n  }else if( t>10 && (t & 0x01) ){\n    pSorter->typeMask &= SORTER_TYPE_TEXT;\n  }else{\n    pSorter->typeMask = 0;\n  }\n\n  assert( pSorter );\n\n  /* Figure out whether or not the current contents of memory should be\n  ** flushed to a PMA before continuing. If so, do so.\n  **\n  ** If using the single large allocation mode (pSorter->aMemory!=0), then\n  ** flush the contents of memory to a new PMA if (a) at least one value is\n  ** already in memory and (b) the new value will not fit in memory.\n  ** \n  ** Or, if using separate allocations for each record, flush the contents\n  ** of memory to a PMA if either of the following are true:\n  **\n  **   * The total memory allocated for the in-memory list is greater \n  **     than (page-size * cache-size), or\n  **\n  **   * The total memory allocated for the in-memory list is greater \n  **     than (page-size * 10) and sqlite3HeapNearlyFull() returns true.\n  */\n  nReq = pVal->n + sizeof(SorterRecord);\n  nPMA = pVal->n + sqlite3VarintLen(pVal->n);\n  if( pSorter->mxPmaSize ){\n    if( pSorter->list.aMemory ){\n      bFlush = pSorter->iMemory && (pSorter->iMemory+nReq) > pSorter->mxPmaSize;\n    }else{\n      bFlush = (\n          (pSorter->list.szPMA > pSorter->mxPmaSize)\n       || (pSorter->list.szPMA > pSorter->mnPmaSize && sqlite3HeapNearlyFull())\n      );\n    }\n    if( bFlush ){\n      rc = vdbeSorterFlushPMA(pSorter);\n      pSorter->list.szPMA = 0;\n      pSorter->iMemory = 0;\n      assert( rc!=SQLITE_OK || pSorter->list.pList==0 );\n    }\n  }\n\n  pSorter->list.szPMA += nPMA;\n  if( nPMA>pSorter->mxKeysize ){\n    pSorter->mxKeysize = nPMA;\n  }\n\n  if( pSorter->list.aMemory ){\n    int nMin = pSorter->iMemory + nReq;\n\n    if( nMin>pSorter->nMemory ){\n      u8 *aNew;\n      int iListOff = (u8*)pSorter->list.pList - pSorter->list.aMemory;\n      int nNew = pSorter->nMemory * 2;\n      while( nNew < nMin ) nNew = nNew*2;\n      if( nNew > pSorter->mxPmaSize ) nNew = pSorter->mxPmaSize;\n      if( nNew < nMin ) nNew = nMin;\n\n      aNew = sqlite3Realloc(pSorter->list.aMemory, nNew);\n      if( !aNew ) return SQLITE_NOMEM_BKPT;\n      pSorter->list.pList = (SorterRecord*)&aNew[iListOff];\n      pSorter->list.aMemory = aNew;\n      pSorter->nMemory = nNew;\n    }\n\n    pNew = (SorterRecord*)&pSorter->list.aMemory[pSorter->iMemory];\n    pSorter->iMemory += ROUND8(nReq);\n    if( pSorter->list.pList ){\n      pNew->u.iNext = (int)((u8*)(pSorter->list.pList) - pSorter->list.aMemory);\n    }\n  }else{\n    pNew = (SorterRecord *)sqlite3Malloc(nReq);\n    if( pNew==0 ){\n      return SQLITE_NOMEM_BKPT;\n    }\n    pNew->u.pNext = pSorter->list.pList;\n  }\n\n  memcpy(SRVAL(pNew), pVal->z, pVal->n);\n  pNew->nVal = pVal->n;\n  pSorter->list.pList = pNew;\n\n  return rc;\n}\n\n/*\n** Read keys from pIncr->pMerger and populate pIncr->aFile[1]. The format\n** of the data stored in aFile[1] is the same as that used by regular PMAs,\n** except that the number-of-bytes varint is omitted from the start.\n*/\nstatic int vdbeIncrPopulate(IncrMerger *pIncr){\n  int rc = SQLITE_OK;\n  int rc2;\n  i64 iStart = pIncr->iStartOff;\n  SorterFile *pOut = &pIncr->aFile[1];\n  SortSubtask *pTask = pIncr->pTask;\n  MergeEngine *pMerger = pIncr->pMerger;\n  PmaWriter writer;\n  assert( pIncr->bEof==0 );\n\n  vdbeSorterPopulateDebug(pTask, \"enter\");\n\n  vdbePmaWriterInit(pOut->pFd, &writer, pTask->pSorter->pgsz, iStart);\n  while( rc==SQLITE_OK ){\n    int dummy;\n    PmaReader *pReader = &pMerger->aReadr[ pMerger->aTree[1] ];\n    int nKey = pReader->nKey;\n    i64 iEof = writer.iWriteOff + writer.iBufEnd;\n\n    /* Check if the output file is full or if the input has been exhausted.\n    ** In either case exit the loop. */\n    if( pReader->pFd==0 ) break;\n    if( (iEof + nKey + sqlite3VarintLen(nKey))>(iStart + pIncr->mxSz) ) break;\n\n    /* Write the next key to the output. */\n    vdbePmaWriteVarint(&writer, nKey);\n    vdbePmaWriteBlob(&writer, pReader->aKey, nKey);\n    assert( pIncr->pMerger->pTask==pTask );\n    rc = vdbeMergeEngineStep(pIncr->pMerger, &dummy);\n  }\n\n  rc2 = vdbePmaWriterFinish(&writer, &pOut->iEof);\n  if( rc==SQLITE_OK ) rc = rc2;\n  vdbeSorterPopulateDebug(pTask, \"exit\");\n  return rc;\n}\n\n#if SQLITE_MAX_WORKER_THREADS>0\n/*\n** The main routine for background threads that populate aFile[1] of\n** multi-threaded IncrMerger objects.\n*/\nstatic void *vdbeIncrPopulateThread(void *pCtx){\n  IncrMerger *pIncr = (IncrMerger*)pCtx;\n  void *pRet = SQLITE_INT_TO_PTR( vdbeIncrPopulate(pIncr) );\n  pIncr->pTask->bDone = 1;\n  return pRet;\n}\n\n/*\n** Launch a background thread to populate aFile[1] of pIncr.\n*/\nstatic int vdbeIncrBgPopulate(IncrMerger *pIncr){\n  void *p = (void*)pIncr;\n  assert( pIncr->bUseThread );\n  return vdbeSorterCreateThread(pIncr->pTask, vdbeIncrPopulateThread, p);\n}\n#endif\n\n/*\n** This function is called when the PmaReader corresponding to pIncr has\n** finished reading the contents of aFile[0]. Its purpose is to \"refill\"\n** aFile[0] such that the PmaReader should start rereading it from the\n** beginning.\n**\n** For single-threaded objects, this is accomplished by literally reading \n** keys from pIncr->pMerger and repopulating aFile[0]. \n**\n** For multi-threaded objects, all that is required is to wait until the \n** background thread is finished (if it is not already) and then swap \n** aFile[0] and aFile[1] in place. If the contents of pMerger have not\n** been exhausted, this function also launches a new background thread\n** to populate the new aFile[1].\n**\n** SQLITE_OK is returned on success, or an SQLite error code otherwise.\n*/\nstatic int vdbeIncrSwap(IncrMerger *pIncr){\n  int rc = SQLITE_OK;\n\n#if SQLITE_MAX_WORKER_THREADS>0\n  if( pIncr->bUseThread ){\n    rc = vdbeSorterJoinThread(pIncr->pTask);\n\n    if( rc==SQLITE_OK ){\n      SorterFile f0 = pIncr->aFile[0];\n      pIncr->aFile[0] = pIncr->aFile[1];\n      pIncr->aFile[1] = f0;\n    }\n\n    if( rc==SQLITE_OK ){\n      if( pIncr->aFile[0].iEof==pIncr->iStartOff ){\n        pIncr->bEof = 1;\n      }else{\n        rc = vdbeIncrBgPopulate(pIncr);\n      }\n    }\n  }else\n#endif\n  {\n    rc = vdbeIncrPopulate(pIncr);\n    pIncr->aFile[0] = pIncr->aFile[1];\n    if( pIncr->aFile[0].iEof==pIncr->iStartOff ){\n      pIncr->bEof = 1;\n    }\n  }\n\n  return rc;\n}\n\n/*\n** Allocate and return a new IncrMerger object to read data from pMerger.\n**\n** If an OOM condition is encountered, return NULL. In this case free the\n** pMerger argument before returning.\n*/\nstatic int vdbeIncrMergerNew(\n  SortSubtask *pTask,     /* The thread that will be using the new IncrMerger */\n  MergeEngine *pMerger,   /* The MergeEngine that the IncrMerger will control */\n  IncrMerger **ppOut      /* Write the new IncrMerger here */\n){\n  int rc = SQLITE_OK;\n  IncrMerger *pIncr = *ppOut = (IncrMerger*)\n       (sqlite3FaultSim(100) ? 0 : sqlite3MallocZero(sizeof(*pIncr)));\n  if( pIncr ){\n    pIncr->pMerger = pMerger;\n    pIncr->pTask = pTask;\n    pIncr->mxSz = MAX(pTask->pSorter->mxKeysize+9,pTask->pSorter->mxPmaSize/2);\n    pTask->file2.iEof += pIncr->mxSz;\n  }else{\n    vdbeMergeEngineFree(pMerger);\n    rc = SQLITE_NOMEM_BKPT;\n  }\n  return rc;\n}\n\n#if SQLITE_MAX_WORKER_THREADS>0\n/*\n** Set the \"use-threads\" flag on object pIncr.\n*/\nstatic void vdbeIncrMergerSetThreads(IncrMerger *pIncr){\n  pIncr->bUseThread = 1;\n  pIncr->pTask->file2.iEof -= pIncr->mxSz;\n}\n#endif /* SQLITE_MAX_WORKER_THREADS>0 */\n\n\n\n/*\n** Recompute pMerger->aTree[iOut] by comparing the next keys on the\n** two PmaReaders that feed that entry.  Neither of the PmaReaders\n** are advanced.  This routine merely does the comparison.\n*/\nstatic void vdbeMergeEngineCompare(\n  MergeEngine *pMerger,  /* Merge engine containing PmaReaders to compare */\n  int iOut               /* Store the result in pMerger->aTree[iOut] */\n){\n  int i1;\n  int i2;\n  int iRes;\n  PmaReader *p1;\n  PmaReader *p2;\n\n  assert( iOut<pMerger->nTree && iOut>0 );\n\n  if( iOut>=(pMerger->nTree/2) ){\n    i1 = (iOut - pMerger->nTree/2) * 2;\n    i2 = i1 + 1;\n  }else{\n    i1 = pMerger->aTree[iOut*2];\n    i2 = pMerger->aTree[iOut*2+1];\n  }\n\n  p1 = &pMerger->aReadr[i1];\n  p2 = &pMerger->aReadr[i2];\n\n  if( p1->pFd==0 ){\n    iRes = i2;\n  }else if( p2->pFd==0 ){\n    iRes = i1;\n  }else{\n    SortSubtask *pTask = pMerger->pTask;\n    int bCached = 0;\n    int res;\n    assert( pTask->pUnpacked!=0 );  /* from vdbeSortSubtaskMain() */\n    res = pTask->xCompare(\n        pTask, &bCached, p1->aKey, p1->nKey, p2->aKey, p2->nKey\n    );\n    if( res<=0 ){\n      iRes = i1;\n    }else{\n      iRes = i2;\n    }\n  }\n\n  pMerger->aTree[iOut] = iRes;\n}\n\n/*\n** Allowed values for the eMode parameter to vdbeMergeEngineInit()\n** and vdbePmaReaderIncrMergeInit().\n**\n** Only INCRINIT_NORMAL is valid in single-threaded builds (when\n** SQLITE_MAX_WORKER_THREADS==0).  The other values are only used\n** when there exists one or more separate worker threads.\n*/\n#define INCRINIT_NORMAL 0\n#define INCRINIT_TASK   1\n#define INCRINIT_ROOT   2\n\n/* \n** Forward reference required as the vdbeIncrMergeInit() and\n** vdbePmaReaderIncrInit() routines are called mutually recursively when\n** building a merge tree.\n*/\nstatic int vdbePmaReaderIncrInit(PmaReader *pReadr, int eMode);\n\n/*\n** Initialize the MergeEngine object passed as the second argument. Once this\n** function returns, the first key of merged data may be read from the \n** MergeEngine object in the usual fashion.\n**\n** If argument eMode is INCRINIT_ROOT, then it is assumed that any IncrMerge\n** objects attached to the PmaReader objects that the merger reads from have\n** already been populated, but that they have not yet populated aFile[0] and\n** set the PmaReader objects up to read from it. In this case all that is\n** required is to call vdbePmaReaderNext() on each PmaReader to point it at\n** its first key.\n**\n** Otherwise, if eMode is any value other than INCRINIT_ROOT, then use \n** vdbePmaReaderIncrMergeInit() to initialize each PmaReader that feeds data \n** to pMerger.\n**\n** SQLITE_OK is returned if successful, or an SQLite error code otherwise.\n*/\nstatic int vdbeMergeEngineInit(\n  SortSubtask *pTask,             /* Thread that will run pMerger */\n  MergeEngine *pMerger,           /* MergeEngine to initialize */\n  int eMode                       /* One of the INCRINIT_XXX constants */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  int i;                          /* For looping over PmaReader objects */\n  int nTree = pMerger->nTree;\n\n  /* eMode is always INCRINIT_NORMAL in single-threaded mode */\n  assert( SQLITE_MAX_WORKER_THREADS>0 || eMode==INCRINIT_NORMAL );\n\n  /* Verify that the MergeEngine is assigned to a single thread */\n  assert( pMerger->pTask==0 );\n  pMerger->pTask = pTask;\n\n  for(i=0; i<nTree; i++){\n    if( SQLITE_MAX_WORKER_THREADS>0 && eMode==INCRINIT_ROOT ){\n      /* PmaReaders should be normally initialized in order, as if they are\n      ** reading from the same temp file this makes for more linear file IO.\n      ** However, in the INCRINIT_ROOT case, if PmaReader aReadr[nTask-1] is\n      ** in use it will block the vdbePmaReaderNext() call while it uses\n      ** the main thread to fill its buffer. So calling PmaReaderNext()\n      ** on this PmaReader before any of the multi-threaded PmaReaders takes\n      ** better advantage of multi-processor hardware. */\n      rc = vdbePmaReaderNext(&pMerger->aReadr[nTree-i-1]);\n    }else{\n      rc = vdbePmaReaderIncrInit(&pMerger->aReadr[i], INCRINIT_NORMAL);\n    }\n    if( rc!=SQLITE_OK ) return rc;\n  }\n\n  for(i=pMerger->nTree-1; i>0; i--){\n    vdbeMergeEngineCompare(pMerger, i);\n  }\n  return pTask->pUnpacked->errCode;\n}\n\n/*\n** The PmaReader passed as the first argument is guaranteed to be an\n** incremental-reader (pReadr->pIncr!=0). This function serves to open\n** and/or initialize the temp file related fields of the IncrMerge\n** object at (pReadr->pIncr).\n**\n** If argument eMode is set to INCRINIT_NORMAL, then all PmaReaders\n** in the sub-tree headed by pReadr are also initialized. Data is then \n** loaded into the buffers belonging to pReadr and it is set to point to \n** the first key in its range.\n**\n** If argument eMode is set to INCRINIT_TASK, then pReadr is guaranteed\n** to be a multi-threaded PmaReader and this function is being called in a\n** background thread. In this case all PmaReaders in the sub-tree are \n** initialized as for INCRINIT_NORMAL and the aFile[1] buffer belonging to\n** pReadr is populated. However, pReadr itself is not set up to point\n** to its first key. A call to vdbePmaReaderNext() is still required to do\n** that. \n**\n** The reason this function does not call vdbePmaReaderNext() immediately \n** in the INCRINIT_TASK case is that vdbePmaReaderNext() assumes that it has\n** to block on thread (pTask->thread) before accessing aFile[1]. But, since\n** this entire function is being run by thread (pTask->thread), that will\n** lead to the current background thread attempting to join itself.\n**\n** Finally, if argument eMode is set to INCRINIT_ROOT, it may be assumed\n** that pReadr->pIncr is a multi-threaded IncrMerge objects, and that all\n** child-trees have already been initialized using IncrInit(INCRINIT_TASK).\n** In this case vdbePmaReaderNext() is called on all child PmaReaders and\n** the current PmaReader set to point to the first key in its range.\n**\n** SQLITE_OK is returned if successful, or an SQLite error code otherwise.\n*/\nstatic int vdbePmaReaderIncrMergeInit(PmaReader *pReadr, int eMode){\n  int rc = SQLITE_OK;\n  IncrMerger *pIncr = pReadr->pIncr;\n  SortSubtask *pTask = pIncr->pTask;\n  sqlite3 *db = pTask->pSorter->db;\n\n  /* eMode is always INCRINIT_NORMAL in single-threaded mode */\n  assert( SQLITE_MAX_WORKER_THREADS>0 || eMode==INCRINIT_NORMAL );\n\n  rc = vdbeMergeEngineInit(pTask, pIncr->pMerger, eMode);\n\n  /* Set up the required files for pIncr. A multi-theaded IncrMerge object\n  ** requires two temp files to itself, whereas a single-threaded object\n  ** only requires a region of pTask->file2. */\n  if( rc==SQLITE_OK ){\n    int mxSz = pIncr->mxSz;\n#if SQLITE_MAX_WORKER_THREADS>0\n    if( pIncr->bUseThread ){\n      rc = vdbeSorterOpenTempFile(db, mxSz, &pIncr->aFile[0].pFd);\n      if( rc==SQLITE_OK ){\n        rc = vdbeSorterOpenTempFile(db, mxSz, &pIncr->aFile[1].pFd);\n      }\n    }else\n#endif\n    /*if( !pIncr->bUseThread )*/{\n      if( pTask->file2.pFd==0 ){\n        assert( pTask->file2.iEof>0 );\n        rc = vdbeSorterOpenTempFile(db, pTask->file2.iEof, &pTask->file2.pFd);\n        pTask->file2.iEof = 0;\n      }\n      if( rc==SQLITE_OK ){\n        pIncr->aFile[1].pFd = pTask->file2.pFd;\n        pIncr->iStartOff = pTask->file2.iEof;\n        pTask->file2.iEof += mxSz;\n      }\n    }\n  }\n\n#if SQLITE_MAX_WORKER_THREADS>0\n  if( rc==SQLITE_OK && pIncr->bUseThread ){\n    /* Use the current thread to populate aFile[1], even though this\n    ** PmaReader is multi-threaded. If this is an INCRINIT_TASK object,\n    ** then this function is already running in background thread \n    ** pIncr->pTask->thread. \n    **\n    ** If this is the INCRINIT_ROOT object, then it is running in the \n    ** main VDBE thread. But that is Ok, as that thread cannot return\n    ** control to the VDBE or proceed with anything useful until the \n    ** first results are ready from this merger object anyway.\n    */\n    assert( eMode==INCRINIT_ROOT || eMode==INCRINIT_TASK );\n    rc = vdbeIncrPopulate(pIncr);\n  }\n#endif\n\n  if( rc==SQLITE_OK && (SQLITE_MAX_WORKER_THREADS==0 || eMode!=INCRINIT_TASK) ){\n    rc = vdbePmaReaderNext(pReadr);\n  }\n\n  return rc;\n}\n\n#if SQLITE_MAX_WORKER_THREADS>0\n/*\n** The main routine for vdbePmaReaderIncrMergeInit() operations run in \n** background threads.\n*/\nstatic void *vdbePmaReaderBgIncrInit(void *pCtx){\n  PmaReader *pReader = (PmaReader*)pCtx;\n  void *pRet = SQLITE_INT_TO_PTR(\n                  vdbePmaReaderIncrMergeInit(pReader,INCRINIT_TASK)\n               );\n  pReader->pIncr->pTask->bDone = 1;\n  return pRet;\n}\n#endif\n\n/*\n** If the PmaReader passed as the first argument is not an incremental-reader\n** (if pReadr->pIncr==0), then this function is a no-op. Otherwise, it invokes\n** the vdbePmaReaderIncrMergeInit() function with the parameters passed to\n** this routine to initialize the incremental merge.\n** \n** If the IncrMerger object is multi-threaded (IncrMerger.bUseThread==1), \n** then a background thread is launched to call vdbePmaReaderIncrMergeInit().\n** Or, if the IncrMerger is single threaded, the same function is called\n** using the current thread.\n*/\nstatic int vdbePmaReaderIncrInit(PmaReader *pReadr, int eMode){\n  IncrMerger *pIncr = pReadr->pIncr;   /* Incremental merger */\n  int rc = SQLITE_OK;                  /* Return code */\n  if( pIncr ){\n#if SQLITE_MAX_WORKER_THREADS>0\n    assert( pIncr->bUseThread==0 || eMode==INCRINIT_TASK );\n    if( pIncr->bUseThread ){\n      void *pCtx = (void*)pReadr;\n      rc = vdbeSorterCreateThread(pIncr->pTask, vdbePmaReaderBgIncrInit, pCtx);\n    }else\n#endif\n    {\n      rc = vdbePmaReaderIncrMergeInit(pReadr, eMode);\n    }\n  }\n  return rc;\n}\n\n/*\n** Allocate a new MergeEngine object to merge the contents of nPMA level-0\n** PMAs from pTask->file. If no error occurs, set *ppOut to point to\n** the new object and return SQLITE_OK. Or, if an error does occur, set *ppOut\n** to NULL and return an SQLite error code.\n**\n** When this function is called, *piOffset is set to the offset of the\n** first PMA to read from pTask->file. Assuming no error occurs, it is \n** set to the offset immediately following the last byte of the last\n** PMA before returning. If an error does occur, then the final value of\n** *piOffset is undefined.\n*/\nstatic int vdbeMergeEngineLevel0(\n  SortSubtask *pTask,             /* Sorter task to read from */\n  int nPMA,                       /* Number of PMAs to read */\n  i64 *piOffset,                  /* IN/OUT: Readr offset in pTask->file */\n  MergeEngine **ppOut             /* OUT: New merge-engine */\n){\n  MergeEngine *pNew;              /* Merge engine to return */\n  i64 iOff = *piOffset;\n  int i;\n  int rc = SQLITE_OK;\n\n  *ppOut = pNew = vdbeMergeEngineNew(nPMA);\n  if( pNew==0 ) rc = SQLITE_NOMEM_BKPT;\n\n  for(i=0; i<nPMA && rc==SQLITE_OK; i++){\n    i64 nDummy = 0;\n    PmaReader *pReadr = &pNew->aReadr[i];\n    rc = vdbePmaReaderInit(pTask, &pTask->file, iOff, pReadr, &nDummy);\n    iOff = pReadr->iEof;\n  }\n\n  if( rc!=SQLITE_OK ){\n    vdbeMergeEngineFree(pNew);\n    *ppOut = 0;\n  }\n  *piOffset = iOff;\n  return rc;\n}\n\n/*\n** Return the depth of a tree comprising nPMA PMAs, assuming a fanout of\n** SORTER_MAX_MERGE_COUNT. The returned value does not include leaf nodes.\n**\n** i.e.\n**\n**   nPMA<=16    -> TreeDepth() == 0\n**   nPMA<=256   -> TreeDepth() == 1\n**   nPMA<=65536 -> TreeDepth() == 2\n*/\nstatic int vdbeSorterTreeDepth(int nPMA){\n  int nDepth = 0;\n  i64 nDiv = SORTER_MAX_MERGE_COUNT;\n  while( nDiv < (i64)nPMA ){\n    nDiv = nDiv * SORTER_MAX_MERGE_COUNT;\n    nDepth++;\n  }\n  return nDepth;\n}\n\n/*\n** pRoot is the root of an incremental merge-tree with depth nDepth (according\n** to vdbeSorterTreeDepth()). pLeaf is the iSeq'th leaf to be added to the\n** tree, counting from zero. This function adds pLeaf to the tree.\n**\n** If successful, SQLITE_OK is returned. If an error occurs, an SQLite error\n** code is returned and pLeaf is freed.\n*/\nstatic int vdbeSorterAddToTree(\n  SortSubtask *pTask,             /* Task context */\n  int nDepth,                     /* Depth of tree according to TreeDepth() */\n  int iSeq,                       /* Sequence number of leaf within tree */\n  MergeEngine *pRoot,             /* Root of tree */\n  MergeEngine *pLeaf              /* Leaf to add to tree */\n){\n  int rc = SQLITE_OK;\n  int nDiv = 1;\n  int i;\n  MergeEngine *p = pRoot;\n  IncrMerger *pIncr;\n\n  rc = vdbeIncrMergerNew(pTask, pLeaf, &pIncr);\n\n  for(i=1; i<nDepth; i++){\n    nDiv = nDiv * SORTER_MAX_MERGE_COUNT;\n  }\n\n  for(i=1; i<nDepth && rc==SQLITE_OK; i++){\n    int iIter = (iSeq / nDiv) % SORTER_MAX_MERGE_COUNT;\n    PmaReader *pReadr = &p->aReadr[iIter];\n\n    if( pReadr->pIncr==0 ){\n      MergeEngine *pNew = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT);\n      if( pNew==0 ){\n        rc = SQLITE_NOMEM_BKPT;\n      }else{\n        rc = vdbeIncrMergerNew(pTask, pNew, &pReadr->pIncr);\n      }\n    }\n    if( rc==SQLITE_OK ){\n      p = pReadr->pIncr->pMerger;\n      nDiv = nDiv / SORTER_MAX_MERGE_COUNT;\n    }\n  }\n\n  if( rc==SQLITE_OK ){\n    p->aReadr[iSeq % SORTER_MAX_MERGE_COUNT].pIncr = pIncr;\n  }else{\n    vdbeIncrFree(pIncr);\n  }\n  return rc;\n}\n\n/*\n** This function is called as part of a SorterRewind() operation on a sorter\n** that has already written two or more level-0 PMAs to one or more temp\n** files. It builds a tree of MergeEngine/IncrMerger/PmaReader objects that \n** can be used to incrementally merge all PMAs on disk.\n**\n** If successful, SQLITE_OK is returned and *ppOut set to point to the\n** MergeEngine object at the root of the tree before returning. Or, if an\n** error occurs, an SQLite error code is returned and the final value \n** of *ppOut is undefined.\n*/\nstatic int vdbeSorterMergeTreeBuild(\n  VdbeSorter *pSorter,       /* The VDBE cursor that implements the sort */\n  MergeEngine **ppOut        /* Write the MergeEngine here */\n){\n  MergeEngine *pMain = 0;\n  int rc = SQLITE_OK;\n  int iTask;\n\n#if SQLITE_MAX_WORKER_THREADS>0\n  /* If the sorter uses more than one task, then create the top-level \n  ** MergeEngine here. This MergeEngine will read data from exactly \n  ** one PmaReader per sub-task.  */\n  assert( pSorter->bUseThreads || pSorter->nTask==1 );\n  if( pSorter->nTask>1 ){\n    pMain = vdbeMergeEngineNew(pSorter->nTask);\n    if( pMain==0 ) rc = SQLITE_NOMEM_BKPT;\n  }\n#endif\n\n  for(iTask=0; rc==SQLITE_OK && iTask<pSorter->nTask; iTask++){\n    SortSubtask *pTask = &pSorter->aTask[iTask];\n    assert( pTask->nPMA>0 || SQLITE_MAX_WORKER_THREADS>0 );\n    if( SQLITE_MAX_WORKER_THREADS==0 || pTask->nPMA ){\n      MergeEngine *pRoot = 0;     /* Root node of tree for this task */\n      int nDepth = vdbeSorterTreeDepth(pTask->nPMA);\n      i64 iReadOff = 0;\n\n      if( pTask->nPMA<=SORTER_MAX_MERGE_COUNT ){\n        rc = vdbeMergeEngineLevel0(pTask, pTask->nPMA, &iReadOff, &pRoot);\n      }else{\n        int i;\n        int iSeq = 0;\n        pRoot = vdbeMergeEngineNew(SORTER_MAX_MERGE_COUNT);\n        if( pRoot==0 ) rc = SQLITE_NOMEM_BKPT;\n        for(i=0; i<pTask->nPMA && rc==SQLITE_OK; i += SORTER_MAX_MERGE_COUNT){\n          MergeEngine *pMerger = 0; /* New level-0 PMA merger */\n          int nReader;              /* Number of level-0 PMAs to merge */\n\n          nReader = MIN(pTask->nPMA - i, SORTER_MAX_MERGE_COUNT);\n          rc = vdbeMergeEngineLevel0(pTask, nReader, &iReadOff, &pMerger);\n          if( rc==SQLITE_OK ){\n            rc = vdbeSorterAddToTree(pTask, nDepth, iSeq++, pRoot, pMerger);\n          }\n        }\n      }\n\n      if( rc==SQLITE_OK ){\n#if SQLITE_MAX_WORKER_THREADS>0\n        if( pMain!=0 ){\n          rc = vdbeIncrMergerNew(pTask, pRoot, &pMain->aReadr[iTask].pIncr);\n        }else\n#endif\n        {\n          assert( pMain==0 );\n          pMain = pRoot;\n        }\n      }else{\n        vdbeMergeEngineFree(pRoot);\n      }\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    vdbeMergeEngineFree(pMain);\n    pMain = 0;\n  }\n  *ppOut = pMain;\n  return rc;\n}\n\n/*\n** This function is called as part of an sqlite3VdbeSorterRewind() operation\n** on a sorter that has written two or more PMAs to temporary files. It sets\n** up either VdbeSorter.pMerger (for single threaded sorters) or pReader\n** (for multi-threaded sorters) so that it can be used to iterate through\n** all records stored in the sorter.\n**\n** SQLITE_OK is returned if successful, or an SQLite error code otherwise.\n*/\nstatic int vdbeSorterSetupMerge(VdbeSorter *pSorter){\n  int rc;                         /* Return code */\n  SortSubtask *pTask0 = &pSorter->aTask[0];\n  MergeEngine *pMain = 0;\n#if SQLITE_MAX_WORKER_THREADS\n  sqlite3 *db = pTask0->pSorter->db;\n  int i;\n  SorterCompare xCompare = vdbeSorterGetCompare(pSorter);\n  for(i=0; i<pSorter->nTask; i++){\n    pSorter->aTask[i].xCompare = xCompare;\n  }\n#endif\n\n  rc = vdbeSorterMergeTreeBuild(pSorter, &pMain);\n  if( rc==SQLITE_OK ){\n#if SQLITE_MAX_WORKER_THREADS\n    assert( pSorter->bUseThreads==0 || pSorter->nTask>1 );\n    if( pSorter->bUseThreads ){\n      int iTask;\n      PmaReader *pReadr = 0;\n      SortSubtask *pLast = &pSorter->aTask[pSorter->nTask-1];\n      rc = vdbeSortAllocUnpacked(pLast);\n      if( rc==SQLITE_OK ){\n        pReadr = (PmaReader*)sqlite3DbMallocZero(db, sizeof(PmaReader));\n        pSorter->pReader = pReadr;\n        if( pReadr==0 ) rc = SQLITE_NOMEM_BKPT;\n      }\n      if( rc==SQLITE_OK ){\n        rc = vdbeIncrMergerNew(pLast, pMain, &pReadr->pIncr);\n        if( rc==SQLITE_OK ){\n          vdbeIncrMergerSetThreads(pReadr->pIncr);\n          for(iTask=0; iTask<(pSorter->nTask-1); iTask++){\n            IncrMerger *pIncr;\n            if( (pIncr = pMain->aReadr[iTask].pIncr) ){\n              vdbeIncrMergerSetThreads(pIncr);\n              assert( pIncr->pTask!=pLast );\n            }\n          }\n          for(iTask=0; rc==SQLITE_OK && iTask<pSorter->nTask; iTask++){\n            /* Check that:\n            **   \n            **   a) The incremental merge object is configured to use the\n            **      right task, and\n            **   b) If it is using task (nTask-1), it is configured to run\n            **      in single-threaded mode. This is important, as the\n            **      root merge (INCRINIT_ROOT) will be using the same task\n            **      object.\n            */\n            PmaReader *p = &pMain->aReadr[iTask];\n            assert( p->pIncr==0 || (\n                (p->pIncr->pTask==&pSorter->aTask[iTask])             /* a */\n             && (iTask!=pSorter->nTask-1 || p->pIncr->bUseThread==0)  /* b */\n            ));\n            rc = vdbePmaReaderIncrInit(p, INCRINIT_TASK);\n          }\n        }\n        pMain = 0;\n      }\n      if( rc==SQLITE_OK ){\n        rc = vdbePmaReaderIncrMergeInit(pReadr, INCRINIT_ROOT);\n      }\n    }else\n#endif\n    {\n      rc = vdbeMergeEngineInit(pTask0, pMain, INCRINIT_NORMAL);\n      pSorter->pMerger = pMain;\n      pMain = 0;\n    }\n  }\n\n  if( rc!=SQLITE_OK ){\n    vdbeMergeEngineFree(pMain);\n  }\n  return rc;\n}\n\n\n/*\n** Once the sorter has been populated by calls to sqlite3VdbeSorterWrite,\n** this function is called to prepare for iterating through the records\n** in sorted order.\n*/\nint sqlite3VdbeSorterRewind(const VdbeCursor *pCsr, int *pbEof){\n  VdbeSorter *pSorter;\n  int rc = SQLITE_OK;             /* Return code */\n\n  assert( pCsr->eCurType==CURTYPE_SORTER );\n  pSorter = pCsr->uc.pSorter;\n  assert( pSorter );\n\n  /* If no data has been written to disk, then do not do so now. Instead,\n  ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly\n  ** from the in-memory list.  */\n  if( pSorter->bUsePMA==0 ){\n    if( pSorter->list.pList ){\n      *pbEof = 0;\n      rc = vdbeSorterSort(&pSorter->aTask[0], &pSorter->list);\n    }else{\n      *pbEof = 1;\n    }\n    return rc;\n  }\n\n  /* Write the current in-memory list to a PMA. When the VdbeSorterWrite() \n  ** function flushes the contents of memory to disk, it immediately always\n  ** creates a new list consisting of a single key immediately afterwards.\n  ** So the list is never empty at this point.  */\n  assert( pSorter->list.pList );\n  rc = vdbeSorterFlushPMA(pSorter);\n\n  /* Join all threads */\n  rc = vdbeSorterJoinAll(pSorter, rc);\n\n  vdbeSorterRewindDebug(\"rewind\");\n\n  /* Assuming no errors have occurred, set up a merger structure to \n  ** incrementally read and merge all remaining PMAs.  */\n  assert( pSorter->pReader==0 );\n  if( rc==SQLITE_OK ){\n    rc = vdbeSorterSetupMerge(pSorter);\n    *pbEof = 0;\n  }\n\n  vdbeSorterRewindDebug(\"rewinddone\");\n  return rc;\n}\n\n/*\n** Advance to the next element in the sorter.\n*/\nint sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){\n  VdbeSorter *pSorter;\n  int rc;                         /* Return code */\n\n  assert( pCsr->eCurType==CURTYPE_SORTER );\n  pSorter = pCsr->uc.pSorter;\n  assert( pSorter->bUsePMA || (pSorter->pReader==0 && pSorter->pMerger==0) );\n  if( pSorter->bUsePMA ){\n    assert( pSorter->pReader==0 || pSorter->pMerger==0 );\n    assert( pSorter->bUseThreads==0 || pSorter->pReader );\n    assert( pSorter->bUseThreads==1 || pSorter->pMerger );\n#if SQLITE_MAX_WORKER_THREADS>0\n    if( pSorter->bUseThreads ){\n      rc = vdbePmaReaderNext(pSorter->pReader);\n      *pbEof = (pSorter->pReader->pFd==0);\n    }else\n#endif\n    /*if( !pSorter->bUseThreads )*/ {\n      assert( pSorter->pMerger!=0 );\n      assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) );\n      rc = vdbeMergeEngineStep(pSorter->pMerger, pbEof);\n    }\n  }else{\n    SorterRecord *pFree = pSorter->list.pList;\n    pSorter->list.pList = pFree->u.pNext;\n    pFree->u.pNext = 0;\n    if( pSorter->list.aMemory==0 ) vdbeSorterRecordFree(db, pFree);\n    *pbEof = !pSorter->list.pList;\n    rc = SQLITE_OK;\n  }\n  return rc;\n}\n\n/*\n** Return a pointer to a buffer owned by the sorter that contains the \n** current key.\n*/\nstatic void *vdbeSorterRowkey(\n  const VdbeSorter *pSorter,      /* Sorter object */\n  int *pnKey                      /* OUT: Size of current key in bytes */\n){\n  void *pKey;\n  if( pSorter->bUsePMA ){\n    PmaReader *pReader;\n#if SQLITE_MAX_WORKER_THREADS>0\n    if( pSorter->bUseThreads ){\n      pReader = pSorter->pReader;\n    }else\n#endif\n    /*if( !pSorter->bUseThreads )*/{\n      pReader = &pSorter->pMerger->aReadr[pSorter->pMerger->aTree[1]];\n    }\n    *pnKey = pReader->nKey;\n    pKey = pReader->aKey;\n  }else{\n    *pnKey = pSorter->list.pList->nVal;\n    pKey = SRVAL(pSorter->list.pList);\n  }\n  return pKey;\n}\n\n/*\n** Copy the current sorter key into the memory cell pOut.\n*/\nint sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){\n  VdbeSorter *pSorter;\n  void *pKey; int nKey;           /* Sorter key to copy into pOut */\n\n  assert( pCsr->eCurType==CURTYPE_SORTER );\n  pSorter = pCsr->uc.pSorter;\n  pKey = vdbeSorterRowkey(pSorter, &nKey);\n  if( sqlite3VdbeMemClearAndResize(pOut, nKey) ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  pOut->n = nKey;\n  MemSetTypeFlag(pOut, MEM_Blob);\n  memcpy(pOut->z, pKey, nKey);\n\n  return SQLITE_OK;\n}\n\n/*\n** Compare the key in memory cell pVal with the key that the sorter cursor\n** passed as the first argument currently points to. For the purposes of\n** the comparison, ignore the rowid field at the end of each record.\n**\n** If the sorter cursor key contains any NULL values, consider it to be\n** less than pVal. Even if pVal also contains NULL values.\n**\n** If an error occurs, return an SQLite error code (i.e. SQLITE_NOMEM).\n** Otherwise, set *pRes to a negative, zero or positive value if the\n** key in pVal is smaller than, equal to or larger than the current sorter\n** key.\n**\n** This routine forms the core of the OP_SorterCompare opcode, which in\n** turn is used to verify uniqueness when constructing a UNIQUE INDEX.\n*/\nint sqlite3VdbeSorterCompare(\n  const VdbeCursor *pCsr,         /* Sorter cursor */\n  Mem *pVal,                      /* Value to compare to current sorter key */\n  int nKeyCol,                    /* Compare this many columns */\n  int *pRes                       /* OUT: Result of comparison */\n){\n  VdbeSorter *pSorter;\n  UnpackedRecord *r2;\n  KeyInfo *pKeyInfo;\n  int i;\n  void *pKey; int nKey;           /* Sorter key to compare pVal with */\n\n  assert( pCsr->eCurType==CURTYPE_SORTER );\n  pSorter = pCsr->uc.pSorter;\n  r2 = pSorter->pUnpacked;\n  pKeyInfo = pCsr->pKeyInfo;\n  if( r2==0 ){\n    char *p;\n    r2 = pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pKeyInfo,0,0,&p);\n    assert( pSorter->pUnpacked==(UnpackedRecord*)p );\n    if( r2==0 ) return SQLITE_NOMEM_BKPT;\n    r2->nField = nKeyCol;\n  }\n  assert( r2->nField==nKeyCol );\n\n  pKey = vdbeSorterRowkey(pSorter, &nKey);\n  sqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, r2);\n  for(i=0; i<nKeyCol; i++){\n    if( r2->aMem[i].flags & MEM_Null ){\n      *pRes = -1;\n      return SQLITE_OK;\n    }\n  }\n\n  *pRes = sqlite3VdbeRecordCompare(pVal->n, pVal->z, r2);\n  return SQLITE_OK;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vdbetrace.c",
    "content": "/*\n** 2009 November 25\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains code used to insert the values of host parameters\n** (aka \"wildcards\") into the SQL text output by sqlite3_trace().\n**\n** The Vdbe parse-tree explainer is also found here.\n*/\n#include \"sqliteInt.h\"\n#include \"vdbeInt.h\"\n\n#ifndef SQLITE_OMIT_TRACE\n\n/*\n** zSql is a zero-terminated string of UTF-8 SQL text.  Return the number of\n** bytes in this text up to but excluding the first character in\n** a host parameter.  If the text contains no host parameters, return\n** the total number of bytes in the text.\n*/\nstatic int findNextHostParameter(const char *zSql, int *pnToken){\n  int tokenType;\n  int nTotal = 0;\n  int n;\n\n  *pnToken = 0;\n  while( zSql[0] ){\n    n = sqlite3GetToken((u8*)zSql, &tokenType);\n    assert( n>0 && tokenType!=TK_ILLEGAL );\n    if( tokenType==TK_VARIABLE ){\n      *pnToken = n;\n      break;\n    }\n    nTotal += n;\n    zSql += n;\n  }\n  return nTotal;\n}\n\n/*\n** This function returns a pointer to a nul-terminated string in memory\n** obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the\n** string contains a copy of zRawSql but with host parameters expanded to \n** their current bindings. Or, if sqlite3.nVdbeExec is greater than 1, \n** then the returned string holds a copy of zRawSql with \"-- \" prepended\n** to each line of text.\n**\n** If the SQLITE_TRACE_SIZE_LIMIT macro is defined to an integer, then\n** then long strings and blobs are truncated to that many bytes.  This\n** can be used to prevent unreasonably large trace strings when dealing\n** with large (multi-megabyte) strings and blobs.\n**\n** The calling function is responsible for making sure the memory returned\n** is eventually freed.\n**\n** ALGORITHM:  Scan the input string looking for host parameters in any of\n** these forms:  ?, ?N, $A, @A, :A.  Take care to avoid text within\n** string literals, quoted identifier names, and comments.  For text forms,\n** the host parameter index is found by scanning the prepared\n** statement for the corresponding OP_Variable opcode.  Once the host\n** parameter index is known, locate the value in p->aVar[].  Then render\n** the value as a literal in place of the host parameter name.\n*/\nchar *sqlite3VdbeExpandSql(\n  Vdbe *p,                 /* The prepared statement being evaluated */\n  const char *zRawSql      /* Raw text of the SQL statement */\n){\n  sqlite3 *db;             /* The database connection */\n  int idx = 0;             /* Index of a host parameter */\n  int nextIndex = 1;       /* Index of next ? host parameter */\n  int n;                   /* Length of a token prefix */\n  int nToken;              /* Length of the parameter token */\n  int i;                   /* Loop counter */\n  Mem *pVar;               /* Value of a host parameter */\n  StrAccum out;            /* Accumulate the output here */\n#ifndef SQLITE_OMIT_UTF16\n  Mem utf8;                /* Used to convert UTF16 parameters into UTF8 for display */\n#endif\n  char zBase[100];         /* Initial working space */\n\n  db = p->db;\n  sqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), \n                      db->aLimit[SQLITE_LIMIT_LENGTH]);\n  if( db->nVdbeExec>1 ){\n    while( *zRawSql ){\n      const char *zStart = zRawSql;\n      while( *(zRawSql++)!='\\n' && *zRawSql );\n      sqlite3StrAccumAppend(&out, \"-- \", 3);\n      assert( (zRawSql - zStart) > 0 );\n      sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart));\n    }\n  }else if( p->nVar==0 ){\n    sqlite3StrAccumAppend(&out, zRawSql, sqlite3Strlen30(zRawSql));\n  }else{\n    while( zRawSql[0] ){\n      n = findNextHostParameter(zRawSql, &nToken);\n      assert( n>0 );\n      sqlite3StrAccumAppend(&out, zRawSql, n);\n      zRawSql += n;\n      assert( zRawSql[0] || nToken==0 );\n      if( nToken==0 ) break;\n      if( zRawSql[0]=='?' ){\n        if( nToken>1 ){\n          assert( sqlite3Isdigit(zRawSql[1]) );\n          sqlite3GetInt32(&zRawSql[1], &idx);\n        }else{\n          idx = nextIndex;\n        }\n      }else{\n        assert( zRawSql[0]==':' || zRawSql[0]=='$' ||\n                zRawSql[0]=='@' || zRawSql[0]=='#' );\n        testcase( zRawSql[0]==':' );\n        testcase( zRawSql[0]=='$' );\n        testcase( zRawSql[0]=='@' );\n        testcase( zRawSql[0]=='#' );\n        idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken);\n        assert( idx>0 );\n      }\n      zRawSql += nToken;\n      nextIndex = idx + 1;\n      assert( idx>0 && idx<=p->nVar );\n      pVar = &p->aVar[idx-1];\n      if( pVar->flags & MEM_Null ){\n        sqlite3StrAccumAppend(&out, \"NULL\", 4);\n      }else if( pVar->flags & MEM_Int ){\n        sqlite3XPrintf(&out, \"%lld\", pVar->u.i);\n      }else if( pVar->flags & MEM_Real ){\n        sqlite3XPrintf(&out, \"%!.15g\", pVar->u.r);\n      }else if( pVar->flags & MEM_Str ){\n        int nOut;  /* Number of bytes of the string text to include in output */\n#ifndef SQLITE_OMIT_UTF16\n        u8 enc = ENC(db);\n        if( enc!=SQLITE_UTF8 ){\n          memset(&utf8, 0, sizeof(utf8));\n          utf8.db = db;\n          sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC);\n          if( SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){\n            out.accError = STRACCUM_NOMEM;\n            out.nAlloc = 0;\n          }\n          pVar = &utf8;\n        }\n#endif\n        nOut = pVar->n;\n#ifdef SQLITE_TRACE_SIZE_LIMIT\n        if( nOut>SQLITE_TRACE_SIZE_LIMIT ){\n          nOut = SQLITE_TRACE_SIZE_LIMIT;\n          while( nOut<pVar->n && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; }\n        }\n#endif    \n        sqlite3XPrintf(&out, \"'%.*q'\", nOut, pVar->z);\n#ifdef SQLITE_TRACE_SIZE_LIMIT\n        if( nOut<pVar->n ){\n          sqlite3XPrintf(&out, \"/*+%d bytes*/\", pVar->n-nOut);\n        }\n#endif\n#ifndef SQLITE_OMIT_UTF16\n        if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8);\n#endif\n      }else if( pVar->flags & MEM_Zero ){\n        sqlite3XPrintf(&out, \"zeroblob(%d)\", pVar->u.nZero);\n      }else{\n        int nOut;  /* Number of bytes of the blob to include in output */\n        assert( pVar->flags & MEM_Blob );\n        sqlite3StrAccumAppend(&out, \"x'\", 2);\n        nOut = pVar->n;\n#ifdef SQLITE_TRACE_SIZE_LIMIT\n        if( nOut>SQLITE_TRACE_SIZE_LIMIT ) nOut = SQLITE_TRACE_SIZE_LIMIT;\n#endif\n        for(i=0; i<nOut; i++){\n          sqlite3XPrintf(&out, \"%02x\", pVar->z[i]&0xff);\n        }\n        sqlite3StrAccumAppend(&out, \"'\", 1);\n#ifdef SQLITE_TRACE_SIZE_LIMIT\n        if( nOut<pVar->n ){\n          sqlite3XPrintf(&out, \"/*+%d bytes*/\", pVar->n-nOut);\n        }\n#endif\n      }\n    }\n  }\n  if( out.accError ) sqlite3StrAccumReset(&out);\n  return sqlite3StrAccumFinish(&out);\n}\n\n#endif /* #ifndef SQLITE_OMIT_TRACE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vtab.c",
    "content": "/*\n** 2006 June 10\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains code used to help implement virtual tables.\n*/\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n#include \"sqliteInt.h\"\n\n/*\n** Before a virtual table xCreate() or xConnect() method is invoked, the\n** sqlite3.pVtabCtx member variable is set to point to an instance of\n** this struct allocated on the stack. It is used by the implementation of \n** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which\n** are invoked only from within xCreate and xConnect methods.\n*/\nstruct VtabCtx {\n  VTable *pVTable;    /* The virtual table being constructed */\n  Table *pTab;        /* The Table object to which the virtual table belongs */\n  VtabCtx *pPrior;    /* Parent context (if any) */\n  int bDeclared;      /* True after sqlite3_declare_vtab() is called */\n};\n\n/*\n** The actual function that does the work of creating a new module.\n** This function implements the sqlite3_create_module() and\n** sqlite3_create_module_v2() interfaces.\n*/\nstatic int createModule(\n  sqlite3 *db,                    /* Database in which module is registered */\n  const char *zName,              /* Name assigned to this module */\n  const sqlite3_module *pModule,  /* The definition of the module */\n  void *pAux,                     /* Context pointer for xCreate/xConnect */\n  void (*xDestroy)(void *)        /* Module destructor function */\n){\n  int rc = SQLITE_OK;\n  int nName;\n\n  sqlite3_mutex_enter(db->mutex);\n  nName = sqlite3Strlen30(zName);\n  if( sqlite3HashFind(&db->aModule, zName) ){\n    rc = SQLITE_MISUSE_BKPT;\n  }else{\n    Module *pMod;\n    pMod = (Module *)sqlite3DbMallocRawNN(db, sizeof(Module) + nName + 1);\n    if( pMod ){\n      Module *pDel;\n      char *zCopy = (char *)(&pMod[1]);\n      memcpy(zCopy, zName, nName+1);\n      pMod->zName = zCopy;\n      pMod->pModule = pModule;\n      pMod->pAux = pAux;\n      pMod->xDestroy = xDestroy;\n      pMod->pEpoTab = 0;\n      pDel = (Module *)sqlite3HashInsert(&db->aModule,zCopy,(void*)pMod);\n      assert( pDel==0 || pDel==pMod );\n      if( pDel ){\n        sqlite3OomFault(db);\n        sqlite3DbFree(db, pDel);\n      }\n    }\n  }\n  rc = sqlite3ApiExit(db, rc);\n  if( rc!=SQLITE_OK && xDestroy ) xDestroy(pAux);\n\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n\n/*\n** External API function used to create a new virtual-table module.\n*/\nint sqlite3_create_module(\n  sqlite3 *db,                    /* Database in which module is registered */\n  const char *zName,              /* Name assigned to this module */\n  const sqlite3_module *pModule,  /* The definition of the module */\n  void *pAux                      /* Context pointer for xCreate/xConnect */\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  return createModule(db, zName, pModule, pAux, 0);\n}\n\n/*\n** External API function used to create a new virtual-table module.\n*/\nint sqlite3_create_module_v2(\n  sqlite3 *db,                    /* Database in which module is registered */\n  const char *zName,              /* Name assigned to this module */\n  const sqlite3_module *pModule,  /* The definition of the module */\n  void *pAux,                     /* Context pointer for xCreate/xConnect */\n  void (*xDestroy)(void *)        /* Module destructor function */\n){\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zName==0 ) return SQLITE_MISUSE_BKPT;\n#endif\n  return createModule(db, zName, pModule, pAux, xDestroy);\n}\n\n/*\n** Lock the virtual table so that it cannot be disconnected.\n** Locks nest.  Every lock should have a corresponding unlock.\n** If an unlock is omitted, resources leaks will occur.  \n**\n** If a disconnect is attempted while a virtual table is locked,\n** the disconnect is deferred until all locks have been removed.\n*/\nvoid sqlite3VtabLock(VTable *pVTab){\n  pVTab->nRef++;\n}\n\n\n/*\n** pTab is a pointer to a Table structure representing a virtual-table.\n** Return a pointer to the VTable object used by connection db to access \n** this virtual-table, if one has been created, or NULL otherwise.\n*/\nVTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){\n  VTable *pVtab;\n  assert( IsVirtual(pTab) );\n  for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext);\n  return pVtab;\n}\n\n/*\n** Decrement the ref-count on a virtual table object. When the ref-count\n** reaches zero, call the xDisconnect() method to delete the object.\n*/\nvoid sqlite3VtabUnlock(VTable *pVTab){\n  sqlite3 *db = pVTab->db;\n\n  assert( db );\n  assert( pVTab->nRef>0 );\n  assert( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ZOMBIE );\n\n  pVTab->nRef--;\n  if( pVTab->nRef==0 ){\n    sqlite3_vtab *p = pVTab->pVtab;\n    if( p ){\n      p->pModule->xDisconnect(p);\n    }\n    sqlite3DbFree(db, pVTab);\n  }\n}\n\n/*\n** Table p is a virtual table. This function moves all elements in the\n** p->pVTable list to the sqlite3.pDisconnect lists of their associated\n** database connections to be disconnected at the next opportunity. \n** Except, if argument db is not NULL, then the entry associated with\n** connection db is left in the p->pVTable list.\n*/\nstatic VTable *vtabDisconnectAll(sqlite3 *db, Table *p){\n  VTable *pRet = 0;\n  VTable *pVTable = p->pVTable;\n  p->pVTable = 0;\n\n  /* Assert that the mutex (if any) associated with the BtShared database \n  ** that contains table p is held by the caller. See header comments \n  ** above function sqlite3VtabUnlockList() for an explanation of why\n  ** this makes it safe to access the sqlite3.pDisconnect list of any\n  ** database connection that may have an entry in the p->pVTable list.\n  */\n  assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) );\n\n  while( pVTable ){\n    sqlite3 *db2 = pVTable->db;\n    VTable *pNext = pVTable->pNext;\n    assert( db2 );\n    if( db2==db ){\n      pRet = pVTable;\n      p->pVTable = pRet;\n      pRet->pNext = 0;\n    }else{\n      pVTable->pNext = db2->pDisconnect;\n      db2->pDisconnect = pVTable;\n    }\n    pVTable = pNext;\n  }\n\n  assert( !db || pRet );\n  return pRet;\n}\n\n/*\n** Table *p is a virtual table. This function removes the VTable object\n** for table *p associated with database connection db from the linked\n** list in p->pVTab. It also decrements the VTable ref count. This is\n** used when closing database connection db to free all of its VTable\n** objects without disturbing the rest of the Schema object (which may\n** be being used by other shared-cache connections).\n*/\nvoid sqlite3VtabDisconnect(sqlite3 *db, Table *p){\n  VTable **ppVTab;\n\n  assert( IsVirtual(p) );\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\n  assert( sqlite3_mutex_held(db->mutex) );\n\n  for(ppVTab=&p->pVTable; *ppVTab; ppVTab=&(*ppVTab)->pNext){\n    if( (*ppVTab)->db==db  ){\n      VTable *pVTab = *ppVTab;\n      *ppVTab = pVTab->pNext;\n      sqlite3VtabUnlock(pVTab);\n      break;\n    }\n  }\n}\n\n\n/*\n** Disconnect all the virtual table objects in the sqlite3.pDisconnect list.\n**\n** This function may only be called when the mutexes associated with all\n** shared b-tree databases opened using connection db are held by the \n** caller. This is done to protect the sqlite3.pDisconnect list. The\n** sqlite3.pDisconnect list is accessed only as follows:\n**\n**   1) By this function. In this case, all BtShared mutexes and the mutex\n**      associated with the database handle itself must be held.\n**\n**   2) By function vtabDisconnectAll(), when it adds a VTable entry to\n**      the sqlite3.pDisconnect list. In this case either the BtShared mutex\n**      associated with the database the virtual table is stored in is held\n**      or, if the virtual table is stored in a non-sharable database, then\n**      the database handle mutex is held.\n**\n** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously \n** by multiple threads. It is thread-safe.\n*/\nvoid sqlite3VtabUnlockList(sqlite3 *db){\n  VTable *p = db->pDisconnect;\n  db->pDisconnect = 0;\n\n  assert( sqlite3BtreeHoldsAllMutexes(db) );\n  assert( sqlite3_mutex_held(db->mutex) );\n\n  if( p ){\n    sqlite3ExpirePreparedStatements(db);\n    do {\n      VTable *pNext = p->pNext;\n      sqlite3VtabUnlock(p);\n      p = pNext;\n    }while( p );\n  }\n}\n\n/*\n** Clear any and all virtual-table information from the Table record.\n** This routine is called, for example, just before deleting the Table\n** record.\n**\n** Since it is a virtual-table, the Table structure contains a pointer\n** to the head of a linked list of VTable structures. Each VTable \n** structure is associated with a single sqlite3* user of the schema.\n** The reference count of the VTable structure associated with database \n** connection db is decremented immediately (which may lead to the \n** structure being xDisconnected and free). Any other VTable structures\n** in the list are moved to the sqlite3.pDisconnect list of the associated \n** database connection.\n*/\nvoid sqlite3VtabClear(sqlite3 *db, Table *p){\n  if( !db || db->pnBytesFreed==0 ) vtabDisconnectAll(0, p);\n  if( p->azModuleArg ){\n    int i;\n    for(i=0; i<p->nModuleArg; i++){\n      if( i!=1 ) sqlite3DbFree(db, p->azModuleArg[i]);\n    }\n    sqlite3DbFree(db, p->azModuleArg);\n  }\n}\n\n/*\n** Add a new module argument to pTable->azModuleArg[].\n** The string is not copied - the pointer is stored.  The\n** string will be freed automatically when the table is\n** deleted.\n*/\nstatic void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){\n  int nBytes = sizeof(char *)*(2+pTable->nModuleArg);\n  char **azModuleArg;\n  azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes);\n  if( azModuleArg==0 ){\n    sqlite3DbFree(db, zArg);\n  }else{\n    int i = pTable->nModuleArg++;\n    azModuleArg[i] = zArg;\n    azModuleArg[i+1] = 0;\n    pTable->azModuleArg = azModuleArg;\n  }\n}\n\n/*\n** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE\n** statement.  The module name has been parsed, but the optional list\n** of parameters that follow the module name are still pending.\n*/\nvoid sqlite3VtabBeginParse(\n  Parse *pParse,        /* Parsing context */\n  Token *pName1,        /* Name of new table, or database name */\n  Token *pName2,        /* Name of new table or NULL */\n  Token *pModuleName,   /* Name of the module for the virtual table */\n  int ifNotExists       /* No error if the table already exists */\n){\n  int iDb;              /* The database the table is being created in */\n  Table *pTable;        /* The new virtual table */\n  sqlite3 *db;          /* Database connection */\n\n  sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, ifNotExists);\n  pTable = pParse->pNewTable;\n  if( pTable==0 ) return;\n  assert( 0==pTable->pIndex );\n\n  db = pParse->db;\n  iDb = sqlite3SchemaToIndex(db, pTable->pSchema);\n  assert( iDb>=0 );\n\n  pTable->tabFlags |= TF_Virtual;\n  pTable->nModuleArg = 0;\n  addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));\n  addModuleArgument(db, pTable, 0);\n  addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));\n  assert( (pParse->sNameToken.z==pName2->z && pName2->z!=0)\n       || (pParse->sNameToken.z==pName1->z && pName2->z==0)\n  );\n  pParse->sNameToken.n = (int)(\n      &pModuleName->z[pModuleName->n] - pParse->sNameToken.z\n  );\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n  /* Creating a virtual table invokes the authorization callback twice.\n  ** The first invocation, to obtain permission to INSERT a row into the\n  ** sqlite_master table, has already been made by sqlite3StartTable().\n  ** The second call, to obtain permission to create the table, is made now.\n  */\n  if( pTable->azModuleArg ){\n    sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, \n            pTable->azModuleArg[0], pParse->db->aDb[iDb].zDbSName);\n  }\n#endif\n}\n\n/*\n** This routine takes the module argument that has been accumulating\n** in pParse->zArg[] and appends it to the list of arguments on the\n** virtual table currently under construction in pParse->pTable.\n*/\nstatic void addArgumentToVtab(Parse *pParse){\n  if( pParse->sArg.z && pParse->pNewTable ){\n    const char *z = (const char*)pParse->sArg.z;\n    int n = pParse->sArg.n;\n    sqlite3 *db = pParse->db;\n    addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n));\n  }\n}\n\n/*\n** The parser calls this routine after the CREATE VIRTUAL TABLE statement\n** has been completely parsed.\n*/\nvoid sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){\n  Table *pTab = pParse->pNewTable;  /* The table being constructed */\n  sqlite3 *db = pParse->db;         /* The database connection */\n\n  if( pTab==0 ) return;\n  addArgumentToVtab(pParse);\n  pParse->sArg.z = 0;\n  if( pTab->nModuleArg<1 ) return;\n  \n  /* If the CREATE VIRTUAL TABLE statement is being entered for the\n  ** first time (in other words if the virtual table is actually being\n  ** created now instead of just being read out of sqlite_master) then\n  ** do additional initialization work and store the statement text\n  ** in the sqlite_master table.\n  */\n  if( !db->init.busy ){\n    char *zStmt;\n    char *zWhere;\n    int iDb;\n    int iReg;\n    Vdbe *v;\n\n    /* Compute the complete text of the CREATE VIRTUAL TABLE statement */\n    if( pEnd ){\n      pParse->sNameToken.n = (int)(pEnd->z - pParse->sNameToken.z) + pEnd->n;\n    }\n    zStmt = sqlite3MPrintf(db, \"CREATE VIRTUAL TABLE %T\", &pParse->sNameToken);\n\n    /* A slot for the record has already been allocated in the \n    ** SQLITE_MASTER table.  We just need to update that slot with all\n    ** the information we've collected.  \n    **\n    ** The VM register number pParse->regRowid holds the rowid of an\n    ** entry in the sqlite_master table tht was created for this vtab\n    ** by sqlite3StartTable().\n    */\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n    sqlite3NestedParse(pParse,\n      \"UPDATE %Q.%s \"\n         \"SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q \"\n       \"WHERE rowid=#%d\",\n      db->aDb[iDb].zDbSName, SCHEMA_TABLE(iDb),\n      pTab->zName,\n      pTab->zName,\n      zStmt,\n      pParse->regRowid\n    );\n    sqlite3DbFree(db, zStmt);\n    v = sqlite3GetVdbe(pParse);\n    sqlite3ChangeCookie(pParse, iDb);\n\n    sqlite3VdbeAddOp0(v, OP_Expire);\n    zWhere = sqlite3MPrintf(db, \"name='%q' AND type='table'\", pTab->zName);\n    sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);\n\n    iReg = ++pParse->nMem;\n    sqlite3VdbeLoadString(v, iReg, pTab->zName);\n    sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);\n  }\n\n  /* If we are rereading the sqlite_master table create the in-memory\n  ** record of the table. The xConnect() method is not called until\n  ** the first time the virtual table is used in an SQL statement. This\n  ** allows a schema that contains virtual tables to be loaded before\n  ** the required virtual table implementations are registered.  */\n  else {\n    Table *pOld;\n    Schema *pSchema = pTab->pSchema;\n    const char *zName = pTab->zName;\n    assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );\n    pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);\n    if( pOld ){\n      sqlite3OomFault(db);\n      assert( pTab==pOld );  /* Malloc must have failed inside HashInsert() */\n      return;\n    }\n    pParse->pNewTable = 0;\n  }\n}\n\n/*\n** The parser calls this routine when it sees the first token\n** of an argument to the module name in a CREATE VIRTUAL TABLE statement.\n*/\nvoid sqlite3VtabArgInit(Parse *pParse){\n  addArgumentToVtab(pParse);\n  pParse->sArg.z = 0;\n  pParse->sArg.n = 0;\n}\n\n/*\n** The parser calls this routine for each token after the first token\n** in an argument to the module name in a CREATE VIRTUAL TABLE statement.\n*/\nvoid sqlite3VtabArgExtend(Parse *pParse, Token *p){\n  Token *pArg = &pParse->sArg;\n  if( pArg->z==0 ){\n    pArg->z = p->z;\n    pArg->n = p->n;\n  }else{\n    assert(pArg->z <= p->z);\n    pArg->n = (int)(&p->z[p->n] - pArg->z);\n  }\n}\n\n/*\n** Invoke a virtual table constructor (either xCreate or xConnect). The\n** pointer to the function to invoke is passed as the fourth parameter\n** to this procedure.\n*/\nstatic int vtabCallConstructor(\n  sqlite3 *db, \n  Table *pTab,\n  Module *pMod,\n  int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**),\n  char **pzErr\n){\n  VtabCtx sCtx;\n  VTable *pVTable;\n  int rc;\n  const char *const*azArg = (const char *const*)pTab->azModuleArg;\n  int nArg = pTab->nModuleArg;\n  char *zErr = 0;\n  char *zModuleName;\n  int iDb;\n  VtabCtx *pCtx;\n\n  /* Check that the virtual-table is not already being initialized */\n  for(pCtx=db->pVtabCtx; pCtx; pCtx=pCtx->pPrior){\n    if( pCtx->pTab==pTab ){\n      *pzErr = sqlite3MPrintf(db, \n          \"vtable constructor called recursively: %s\", pTab->zName\n      );\n      return SQLITE_LOCKED;\n    }\n  }\n\n  zModuleName = sqlite3MPrintf(db, \"%s\", pTab->zName);\n  if( !zModuleName ){\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  pVTable = sqlite3DbMallocZero(db, sizeof(VTable));\n  if( !pVTable ){\n    sqlite3DbFree(db, zModuleName);\n    return SQLITE_NOMEM_BKPT;\n  }\n  pVTable->db = db;\n  pVTable->pMod = pMod;\n\n  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n  pTab->azModuleArg[1] = db->aDb[iDb].zDbSName;\n\n  /* Invoke the virtual table constructor */\n  assert( &db->pVtabCtx );\n  assert( xConstruct );\n  sCtx.pTab = pTab;\n  sCtx.pVTable = pVTable;\n  sCtx.pPrior = db->pVtabCtx;\n  sCtx.bDeclared = 0;\n  db->pVtabCtx = &sCtx;\n  rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);\n  db->pVtabCtx = sCtx.pPrior;\n  if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);\n  assert( sCtx.pTab==pTab );\n\n  if( SQLITE_OK!=rc ){\n    if( zErr==0 ){\n      *pzErr = sqlite3MPrintf(db, \"vtable constructor failed: %s\", zModuleName);\n    }else {\n      *pzErr = sqlite3MPrintf(db, \"%s\", zErr);\n      sqlite3_free(zErr);\n    }\n    sqlite3DbFree(db, pVTable);\n  }else if( ALWAYS(pVTable->pVtab) ){\n    /* Justification of ALWAYS():  A correct vtab constructor must allocate\n    ** the sqlite3_vtab object if successful.  */\n    memset(pVTable->pVtab, 0, sizeof(pVTable->pVtab[0]));\n    pVTable->pVtab->pModule = pMod->pModule;\n    pVTable->nRef = 1;\n    if( sCtx.bDeclared==0 ){\n      const char *zFormat = \"vtable constructor did not declare schema: %s\";\n      *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);\n      sqlite3VtabUnlock(pVTable);\n      rc = SQLITE_ERROR;\n    }else{\n      int iCol;\n      u8 oooHidden = 0;\n      /* If everything went according to plan, link the new VTable structure\n      ** into the linked list headed by pTab->pVTable. Then loop through the \n      ** columns of the table to see if any of them contain the token \"hidden\".\n      ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from\n      ** the type string.  */\n      pVTable->pNext = pTab->pVTable;\n      pTab->pVTable = pVTable;\n\n      for(iCol=0; iCol<pTab->nCol; iCol++){\n        char *zType = sqlite3ColumnType(&pTab->aCol[iCol], \"\");\n        int nType;\n        int i = 0;\n        nType = sqlite3Strlen30(zType);\n        for(i=0; i<nType; i++){\n          if( 0==sqlite3StrNICmp(\"hidden\", &zType[i], 6)\n           && (i==0 || zType[i-1]==' ')\n           && (zType[i+6]=='\\0' || zType[i+6]==' ')\n          ){\n            break;\n          }\n        }\n        if( i<nType ){\n          int j;\n          int nDel = 6 + (zType[i+6] ? 1 : 0);\n          for(j=i; (j+nDel)<=nType; j++){\n            zType[j] = zType[j+nDel];\n          }\n          if( zType[i]=='\\0' && i>0 ){\n            assert(zType[i-1]==' ');\n            zType[i-1] = '\\0';\n          }\n          pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;\n          oooHidden = TF_OOOHidden;\n        }else{\n          pTab->tabFlags |= oooHidden;\n        }\n      }\n    }\n  }\n\n  sqlite3DbFree(db, zModuleName);\n  return rc;\n}\n\n/*\n** This function is invoked by the parser to call the xConnect() method\n** of the virtual table pTab. If an error occurs, an error code is returned \n** and an error left in pParse.\n**\n** This call is a no-op if table pTab is not a virtual table.\n*/\nint sqlite3VtabCallConnect(Parse *pParse, Table *pTab){\n  sqlite3 *db = pParse->db;\n  const char *zMod;\n  Module *pMod;\n  int rc;\n\n  assert( pTab );\n  if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){\n    return SQLITE_OK;\n  }\n\n  /* Locate the required virtual table module */\n  zMod = pTab->azModuleArg[0];\n  pMod = (Module*)sqlite3HashFind(&db->aModule, zMod);\n\n  if( !pMod ){\n    const char *zModule = pTab->azModuleArg[0];\n    sqlite3ErrorMsg(pParse, \"no such module: %s\", zModule);\n    rc = SQLITE_ERROR;\n  }else{\n    char *zErr = 0;\n    rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);\n    if( rc!=SQLITE_OK ){\n      sqlite3ErrorMsg(pParse, \"%s\", zErr);\n    }\n    sqlite3DbFree(db, zErr);\n  }\n\n  return rc;\n}\n/*\n** Grow the db->aVTrans[] array so that there is room for at least one\n** more v-table. Return SQLITE_NOMEM if a malloc fails, or SQLITE_OK otherwise.\n*/\nstatic int growVTrans(sqlite3 *db){\n  const int ARRAY_INCR = 5;\n\n  /* Grow the sqlite3.aVTrans array if required */\n  if( (db->nVTrans%ARRAY_INCR)==0 ){\n    VTable **aVTrans;\n    int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR);\n    aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes);\n    if( !aVTrans ){\n      return SQLITE_NOMEM_BKPT;\n    }\n    memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR);\n    db->aVTrans = aVTrans;\n  }\n\n  return SQLITE_OK;\n}\n\n/*\n** Add the virtual table pVTab to the array sqlite3.aVTrans[]. Space should\n** have already been reserved using growVTrans().\n*/\nstatic void addToVTrans(sqlite3 *db, VTable *pVTab){\n  /* Add pVtab to the end of sqlite3.aVTrans */\n  db->aVTrans[db->nVTrans++] = pVTab;\n  sqlite3VtabLock(pVTab);\n}\n\n/*\n** This function is invoked by the vdbe to call the xCreate method\n** of the virtual table named zTab in database iDb. \n**\n** If an error occurs, *pzErr is set to point to an English language\n** description of the error and an SQLITE_XXX error code is returned.\n** In this case the caller must call sqlite3DbFree(db, ) on *pzErr.\n*/\nint sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){\n  int rc = SQLITE_OK;\n  Table *pTab;\n  Module *pMod;\n  const char *zMod;\n\n  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName);\n  assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable );\n\n  /* Locate the required virtual table module */\n  zMod = pTab->azModuleArg[0];\n  pMod = (Module*)sqlite3HashFind(&db->aModule, zMod);\n\n  /* If the module has been registered and includes a Create method, \n  ** invoke it now. If the module has not been registered, return an \n  ** error. Otherwise, do nothing.\n  */\n  if( pMod==0 || pMod->pModule->xCreate==0 || pMod->pModule->xDestroy==0 ){\n    *pzErr = sqlite3MPrintf(db, \"no such module: %s\", zMod);\n    rc = SQLITE_ERROR;\n  }else{\n    rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr);\n  }\n\n  /* Justification of ALWAYS():  The xConstructor method is required to\n  ** create a valid sqlite3_vtab if it returns SQLITE_OK. */\n  if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){\n    rc = growVTrans(db);\n    if( rc==SQLITE_OK ){\n      addToVTrans(db, sqlite3GetVTable(db, pTab));\n    }\n  }\n\n  return rc;\n}\n\n/*\n** This function is used to set the schema of a virtual table.  It is only\n** valid to call this function from within the xCreate() or xConnect() of a\n** virtual table module.\n*/\nint sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){\n  VtabCtx *pCtx;\n  Parse *pParse;\n  int rc = SQLITE_OK;\n  Table *pTab;\n  char *zErr = 0;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){\n    return SQLITE_MISUSE_BKPT;\n  }\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  pCtx = db->pVtabCtx;\n  if( !pCtx || pCtx->bDeclared ){\n    sqlite3Error(db, SQLITE_MISUSE);\n    sqlite3_mutex_leave(db->mutex);\n    return SQLITE_MISUSE_BKPT;\n  }\n  pTab = pCtx->pTab;\n  assert( (pTab->tabFlags & TF_Virtual)!=0 );\n\n  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));\n  if( pParse==0 ){\n    rc = SQLITE_NOMEM_BKPT;\n  }else{\n    pParse->declareVtab = 1;\n    pParse->db = db;\n    pParse->nQueryLoop = 1;\n  \n    if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr) \n     && pParse->pNewTable\n     && !db->mallocFailed\n     && !pParse->pNewTable->pSelect\n     && (pParse->pNewTable->tabFlags & TF_Virtual)==0\n    ){\n      if( !pTab->aCol ){\n        Table *pNew = pParse->pNewTable;\n        Index *pIdx;\n        pTab->aCol = pNew->aCol;\n        pTab->nCol = pNew->nCol;\n        pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);\n        pNew->nCol = 0;\n        pNew->aCol = 0;\n        assert( pTab->pIndex==0 );\n        if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 ){\n          rc = SQLITE_ERROR;\n        }\n        pIdx = pNew->pIndex;\n        if( pIdx ){\n          assert( pIdx->pNext==0 );\n          pTab->pIndex = pIdx;\n          pNew->pIndex = 0;\n          pIdx->pTable = pTab;\n        }\n      }\n      pCtx->bDeclared = 1;\n    }else{\n      sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? \"%s\" : 0), zErr);\n      sqlite3DbFree(db, zErr);\n      rc = SQLITE_ERROR;\n    }\n    pParse->declareVtab = 0;\n  \n    if( pParse->pVdbe ){\n      sqlite3VdbeFinalize(pParse->pVdbe);\n    }\n    sqlite3DeleteTable(db, pParse->pNewTable);\n    sqlite3ParserReset(pParse);\n    sqlite3StackFree(db, pParse);\n  }\n\n  assert( (rc&0xff)==rc );\n  rc = sqlite3ApiExit(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n/*\n** This function is invoked by the vdbe to call the xDestroy method\n** of the virtual table named zTab in database iDb. This occurs\n** when a DROP TABLE is mentioned.\n**\n** This call is a no-op if zTab is not a virtual table.\n*/\nint sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){\n  int rc = SQLITE_OK;\n  Table *pTab;\n\n  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName);\n  if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){\n    VTable *p;\n    int (*xDestroy)(sqlite3_vtab *);\n    for(p=pTab->pVTable; p; p=p->pNext){\n      assert( p->pVtab );\n      if( p->pVtab->nRef>0 ){\n        return SQLITE_LOCKED;\n      }\n    }\n    p = vtabDisconnectAll(db, pTab);\n    xDestroy = p->pMod->pModule->xDestroy;\n    assert( xDestroy!=0 );  /* Checked before the virtual table is created */\n    rc = xDestroy(p->pVtab);\n    /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */\n    if( rc==SQLITE_OK ){\n      assert( pTab->pVTable==p && p->pNext==0 );\n      p->pVtab = 0;\n      pTab->pVTable = 0;\n      sqlite3VtabUnlock(p);\n    }\n  }\n\n  return rc;\n}\n\n/*\n** This function invokes either the xRollback or xCommit method\n** of each of the virtual tables in the sqlite3.aVTrans array. The method\n** called is identified by the second argument, \"offset\", which is\n** the offset of the method to call in the sqlite3_module structure.\n**\n** The array is cleared after invoking the callbacks. \n*/\nstatic void callFinaliser(sqlite3 *db, int offset){\n  int i;\n  if( db->aVTrans ){\n    VTable **aVTrans = db->aVTrans;\n    db->aVTrans = 0;\n    for(i=0; i<db->nVTrans; i++){\n      VTable *pVTab = aVTrans[i];\n      sqlite3_vtab *p = pVTab->pVtab;\n      if( p ){\n        int (*x)(sqlite3_vtab *);\n        x = *(int (**)(sqlite3_vtab *))((char *)p->pModule + offset);\n        if( x ) x(p);\n      }\n      pVTab->iSavepoint = 0;\n      sqlite3VtabUnlock(pVTab);\n    }\n    sqlite3DbFree(db, aVTrans);\n    db->nVTrans = 0;\n  }\n}\n\n/*\n** Invoke the xSync method of all virtual tables in the sqlite3.aVTrans\n** array. Return the error code for the first error that occurs, or\n** SQLITE_OK if all xSync operations are successful.\n**\n** If an error message is available, leave it in p->zErrMsg.\n*/\nint sqlite3VtabSync(sqlite3 *db, Vdbe *p){\n  int i;\n  int rc = SQLITE_OK;\n  VTable **aVTrans = db->aVTrans;\n\n  db->aVTrans = 0;\n  for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){\n    int (*x)(sqlite3_vtab *);\n    sqlite3_vtab *pVtab = aVTrans[i]->pVtab;\n    if( pVtab && (x = pVtab->pModule->xSync)!=0 ){\n      rc = x(pVtab);\n      sqlite3VtabImportErrmsg(p, pVtab);\n    }\n  }\n  db->aVTrans = aVTrans;\n  return rc;\n}\n\n/*\n** Invoke the xRollback method of all virtual tables in the \n** sqlite3.aVTrans array. Then clear the array itself.\n*/\nint sqlite3VtabRollback(sqlite3 *db){\n  callFinaliser(db, offsetof(sqlite3_module,xRollback));\n  return SQLITE_OK;\n}\n\n/*\n** Invoke the xCommit method of all virtual tables in the \n** sqlite3.aVTrans array. Then clear the array itself.\n*/\nint sqlite3VtabCommit(sqlite3 *db){\n  callFinaliser(db, offsetof(sqlite3_module,xCommit));\n  return SQLITE_OK;\n}\n\n/*\n** If the virtual table pVtab supports the transaction interface\n** (xBegin/xRollback/xCommit and optionally xSync) and a transaction is\n** not currently open, invoke the xBegin method now.\n**\n** If the xBegin call is successful, place the sqlite3_vtab pointer\n** in the sqlite3.aVTrans array.\n*/\nint sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){\n  int rc = SQLITE_OK;\n  const sqlite3_module *pModule;\n\n  /* Special case: If db->aVTrans is NULL and db->nVTrans is greater\n  ** than zero, then this function is being called from within a\n  ** virtual module xSync() callback. It is illegal to write to \n  ** virtual module tables in this case, so return SQLITE_LOCKED.\n  */\n  if( sqlite3VtabInSync(db) ){\n    return SQLITE_LOCKED;\n  }\n  if( !pVTab ){\n    return SQLITE_OK;\n  } \n  pModule = pVTab->pVtab->pModule;\n\n  if( pModule->xBegin ){\n    int i;\n\n    /* If pVtab is already in the aVTrans array, return early */\n    for(i=0; i<db->nVTrans; i++){\n      if( db->aVTrans[i]==pVTab ){\n        return SQLITE_OK;\n      }\n    }\n\n    /* Invoke the xBegin method. If successful, add the vtab to the \n    ** sqlite3.aVTrans[] array. */\n    rc = growVTrans(db);\n    if( rc==SQLITE_OK ){\n      rc = pModule->xBegin(pVTab->pVtab);\n      if( rc==SQLITE_OK ){\n        int iSvpt = db->nStatement + db->nSavepoint;\n        addToVTrans(db, pVTab);\n        if( iSvpt && pModule->xSavepoint ){\n          pVTab->iSavepoint = iSvpt;\n          rc = pModule->xSavepoint(pVTab->pVtab, iSvpt-1);\n        }\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** Invoke either the xSavepoint, xRollbackTo or xRelease method of all\n** virtual tables that currently have an open transaction. Pass iSavepoint\n** as the second argument to the virtual table method invoked.\n**\n** If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is\n** SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is \n** SAVEPOINT_RELEASE, then the xRelease method of each virtual table with\n** an open transaction is invoked.\n**\n** If any virtual table method returns an error code other than SQLITE_OK, \n** processing is abandoned and the error returned to the caller of this\n** function immediately. If all calls to virtual table methods are successful,\n** SQLITE_OK is returned.\n*/\nint sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){\n  int rc = SQLITE_OK;\n\n  assert( op==SAVEPOINT_RELEASE||op==SAVEPOINT_ROLLBACK||op==SAVEPOINT_BEGIN );\n  assert( iSavepoint>=-1 );\n  if( db->aVTrans ){\n    int i;\n    for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){\n      VTable *pVTab = db->aVTrans[i];\n      const sqlite3_module *pMod = pVTab->pMod->pModule;\n      if( pVTab->pVtab && pMod->iVersion>=2 ){\n        int (*xMethod)(sqlite3_vtab *, int);\n        switch( op ){\n          case SAVEPOINT_BEGIN:\n            xMethod = pMod->xSavepoint;\n            pVTab->iSavepoint = iSavepoint+1;\n            break;\n          case SAVEPOINT_ROLLBACK:\n            xMethod = pMod->xRollbackTo;\n            break;\n          default:\n            xMethod = pMod->xRelease;\n            break;\n        }\n        if( xMethod && pVTab->iSavepoint>iSavepoint ){\n          rc = xMethod(pVTab->pVtab, iSavepoint);\n        }\n      }\n    }\n  }\n  return rc;\n}\n\n/*\n** The first parameter (pDef) is a function implementation.  The\n** second parameter (pExpr) is the first argument to this function.\n** If pExpr is a column in a virtual table, then let the virtual\n** table implementation have an opportunity to overload the function.\n**\n** This routine is used to allow virtual table implementations to\n** overload MATCH, LIKE, GLOB, and REGEXP operators.\n**\n** Return either the pDef argument (indicating no change) or a \n** new FuncDef structure that is marked as ephemeral using the\n** SQLITE_FUNC_EPHEM flag.\n*/\nFuncDef *sqlite3VtabOverloadFunction(\n  sqlite3 *db,    /* Database connection for reporting malloc problems */\n  FuncDef *pDef,  /* Function to possibly overload */\n  int nArg,       /* Number of arguments to the function */\n  Expr *pExpr     /* First argument to the function */\n){\n  Table *pTab;\n  sqlite3_vtab *pVtab;\n  sqlite3_module *pMod;\n  void (*xSFunc)(sqlite3_context*,int,sqlite3_value**) = 0;\n  void *pArg = 0;\n  FuncDef *pNew;\n  int rc = 0;\n  char *zLowerName;\n  unsigned char *z;\n\n\n  /* Check to see the left operand is a column in a virtual table */\n  if( NEVER(pExpr==0) ) return pDef;\n  if( pExpr->op!=TK_COLUMN ) return pDef;\n  pTab = pExpr->pTab;\n  if( NEVER(pTab==0) ) return pDef;\n  if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;\n  pVtab = sqlite3GetVTable(db, pTab)->pVtab;\n  assert( pVtab!=0 );\n  assert( pVtab->pModule!=0 );\n  pMod = (sqlite3_module *)pVtab->pModule;\n  if( pMod->xFindFunction==0 ) return pDef;\n \n  /* Call the xFindFunction method on the virtual table implementation\n  ** to see if the implementation wants to overload this function \n  */\n  zLowerName = sqlite3DbStrDup(db, pDef->zName);\n  if( zLowerName ){\n    for(z=(unsigned char*)zLowerName; *z; z++){\n      *z = sqlite3UpperToLower[*z];\n    }\n    rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xSFunc, &pArg);\n    sqlite3DbFree(db, zLowerName);\n  }\n  if( rc==0 ){\n    return pDef;\n  }\n\n  /* Create a new ephemeral function definition for the overloaded\n  ** function */\n  pNew = sqlite3DbMallocZero(db, sizeof(*pNew)\n                             + sqlite3Strlen30(pDef->zName) + 1);\n  if( pNew==0 ){\n    return pDef;\n  }\n  *pNew = *pDef;\n  pNew->zName = (const char*)&pNew[1];\n  memcpy((char*)&pNew[1], pDef->zName, sqlite3Strlen30(pDef->zName)+1);\n  pNew->xSFunc = xSFunc;\n  pNew->pUserData = pArg;\n  pNew->funcFlags |= SQLITE_FUNC_EPHEM;\n  return pNew;\n}\n\n/*\n** Make sure virtual table pTab is contained in the pParse->apVirtualLock[]\n** array so that an OP_VBegin will get generated for it.  Add pTab to the\n** array if it is missing.  If pTab is already in the array, this routine\n** is a no-op.\n*/\nvoid sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){\n  Parse *pToplevel = sqlite3ParseToplevel(pParse);\n  int i, n;\n  Table **apVtabLock;\n\n  assert( IsVirtual(pTab) );\n  for(i=0; i<pToplevel->nVtabLock; i++){\n    if( pTab==pToplevel->apVtabLock[i] ) return;\n  }\n  n = (pToplevel->nVtabLock+1)*sizeof(pToplevel->apVtabLock[0]);\n  apVtabLock = sqlite3_realloc64(pToplevel->apVtabLock, n);\n  if( apVtabLock ){\n    pToplevel->apVtabLock = apVtabLock;\n    pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab;\n  }else{\n    sqlite3OomFault(pToplevel->db);\n  }\n}\n\n/*\n** Check to see if virtual table module pMod can be have an eponymous\n** virtual table instance.  If it can, create one if one does not already\n** exist. Return non-zero if the eponymous virtual table instance exists\n** when this routine returns, and return zero if it does not exist.\n**\n** An eponymous virtual table instance is one that is named after its\n** module, and more importantly, does not require a CREATE VIRTUAL TABLE\n** statement in order to come into existance.  Eponymous virtual table\n** instances always exist.  They cannot be DROP-ed.\n**\n** Any virtual table module for which xConnect and xCreate are the same\n** method can have an eponymous virtual table instance.\n*/\nint sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){\n  const sqlite3_module *pModule = pMod->pModule;\n  Table *pTab;\n  char *zErr = 0;\n  int rc;\n  sqlite3 *db = pParse->db;\n  if( pMod->pEpoTab ) return 1;\n  if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0;\n  pTab = sqlite3DbMallocZero(db, sizeof(Table));\n  if( pTab==0 ) return 0;\n  pTab->zName = sqlite3DbStrDup(db, pMod->zName);\n  if( pTab->zName==0 ){\n    sqlite3DbFree(db, pTab);\n    return 0;\n  }\n  pMod->pEpoTab = pTab;\n  pTab->nRef = 1;\n  pTab->pSchema = db->aDb[0].pSchema;\n  pTab->tabFlags |= TF_Virtual;\n  pTab->nModuleArg = 0;\n  pTab->iPKey = -1;\n  addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));\n  addModuleArgument(db, pTab, 0);\n  addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));\n  rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);\n  if( rc ){\n    sqlite3ErrorMsg(pParse, \"%s\", zErr);\n    sqlite3DbFree(db, zErr);\n    sqlite3VtabEponymousTableClear(db, pMod);\n    return 0;\n  }\n  return 1;\n}\n\n/*\n** Erase the eponymous virtual table instance associated with\n** virtual table module pMod, if it exists.\n*/\nvoid sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){\n  Table *pTab = pMod->pEpoTab;\n  if( pTab!=0 ){\n    /* Mark the table as Ephemeral prior to deleting it, so that the\n    ** sqlite3DeleteTable() routine will know that it is not stored in \n    ** the schema. */\n    pTab->tabFlags |= TF_Ephemeral;\n    sqlite3DeleteTable(db, pTab);\n    pMod->pEpoTab = 0;\n  }\n}\n\n/*\n** Return the ON CONFLICT resolution mode in effect for the virtual\n** table update operation currently in progress.\n**\n** The results of this routine are undefined unless it is called from\n** within an xUpdate method.\n*/\nint sqlite3_vtab_on_conflict(sqlite3 *db){\n  static const unsigned char aMap[] = { \n    SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE \n  };\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  assert( OE_Rollback==1 && OE_Abort==2 && OE_Fail==3 );\n  assert( OE_Ignore==4 && OE_Replace==5 );\n  assert( db->vtabOnConflict>=1 && db->vtabOnConflict<=5 );\n  return (int)aMap[db->vtabOnConflict-1];\n}\n\n/*\n** Call from within the xCreate() or xConnect() methods to provide \n** the SQLite core with additional information about the behavior\n** of the virtual table being implemented.\n*/\nint sqlite3_vtab_config(sqlite3 *db, int op, ...){\n  va_list ap;\n  int rc = SQLITE_OK;\n\n#ifdef SQLITE_ENABLE_API_ARMOR\n  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;\n#endif\n  sqlite3_mutex_enter(db->mutex);\n  va_start(ap, op);\n  switch( op ){\n    case SQLITE_VTAB_CONSTRAINT_SUPPORT: {\n      VtabCtx *p = db->pVtabCtx;\n      if( !p ){\n        rc = SQLITE_MISUSE_BKPT;\n      }else{\n        assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 );\n        p->pVTable->bConstraint = (u8)va_arg(ap, int);\n      }\n      break;\n    }\n    default:\n      rc = SQLITE_MISUSE_BKPT;\n      break;\n  }\n  va_end(ap);\n\n  if( rc!=SQLITE_OK ) sqlite3Error(db, rc);\n  sqlite3_mutex_leave(db->mutex);\n  return rc;\n}\n\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/vxworks.h",
    "content": "/*\n** 2015-03-02\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n******************************************************************************\n**\n** This file contains code that is specific to Wind River's VxWorks\n*/\n#if defined(__RTP__) || defined(_WRS_KERNEL)\n/* This is VxWorks.  Set up things specially for that OS\n*/\n#include <vxWorks.h>\n#include <pthread.h>  /* amalgamator: dontcache */\n#define OS_VXWORKS 1\n#define SQLITE_OS_OTHER 0\n#define SQLITE_HOMEGROWN_RECURSIVE_MUTEX 1\n#define SQLITE_OMIT_LOAD_EXTENSION 1\n#define SQLITE_ENABLE_LOCKING_STYLE 0\n#define HAVE_UTIME 1\n#else\n/* This is not VxWorks. */\n#define OS_VXWORKS 0\n#define HAVE_FCHOWN 1\n#define HAVE_READLINK 1\n#define HAVE_LSTAT 1\n#endif /* defined(_WRS_KERNEL) */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/wal.c",
    "content": "/*\n** 2010 February 1\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains the implementation of a write-ahead log (WAL) used in \n** \"journal_mode=WAL\" mode.\n**\n** WRITE-AHEAD LOG (WAL) FILE FORMAT\n**\n** A WAL file consists of a header followed by zero or more \"frames\".\n** Each frame records the revised content of a single page from the\n** database file.  All changes to the database are recorded by writing\n** frames into the WAL.  Transactions commit when a frame is written that\n** contains a commit marker.  A single WAL can and usually does record \n** multiple transactions.  Periodically, the content of the WAL is\n** transferred back into the database file in an operation called a\n** \"checkpoint\".\n**\n** A single WAL file can be used multiple times.  In other words, the\n** WAL can fill up with frames and then be checkpointed and then new\n** frames can overwrite the old ones.  A WAL always grows from beginning\n** toward the end.  Checksums and counters attached to each frame are\n** used to determine which frames within the WAL are valid and which\n** are leftovers from prior checkpoints.\n**\n** The WAL header is 32 bytes in size and consists of the following eight\n** big-endian 32-bit unsigned integer values:\n**\n**     0: Magic number.  0x377f0682 or 0x377f0683\n**     4: File format version.  Currently 3007000\n**     8: Database page size.  Example: 1024\n**    12: Checkpoint sequence number\n**    16: Salt-1, random integer incremented with each checkpoint\n**    20: Salt-2, a different random integer changing with each ckpt\n**    24: Checksum-1 (first part of checksum for first 24 bytes of header).\n**    28: Checksum-2 (second part of checksum for first 24 bytes of header).\n**\n** Immediately following the wal-header are zero or more frames. Each\n** frame consists of a 24-byte frame-header followed by a <page-size> bytes\n** of page data. The frame-header is six big-endian 32-bit unsigned \n** integer values, as follows:\n**\n**     0: Page number.\n**     4: For commit records, the size of the database image in pages \n**        after the commit. For all other records, zero.\n**     8: Salt-1 (copied from the header)\n**    12: Salt-2 (copied from the header)\n**    16: Checksum-1.\n**    20: Checksum-2.\n**\n** A frame is considered valid if and only if the following conditions are\n** true:\n**\n**    (1) The salt-1 and salt-2 values in the frame-header match\n**        salt values in the wal-header\n**\n**    (2) The checksum values in the final 8 bytes of the frame-header\n**        exactly match the checksum computed consecutively on the\n**        WAL header and the first 8 bytes and the content of all frames\n**        up to and including the current frame.\n**\n** The checksum is computed using 32-bit big-endian integers if the\n** magic number in the first 4 bytes of the WAL is 0x377f0683 and it\n** is computed using little-endian if the magic number is 0x377f0682.\n** The checksum values are always stored in the frame header in a\n** big-endian format regardless of which byte order is used to compute\n** the checksum.  The checksum is computed by interpreting the input as\n** an even number of unsigned 32-bit integers: x[0] through x[N].  The\n** algorithm used for the checksum is as follows:\n** \n**   for i from 0 to n-1 step 2:\n**     s0 += x[i] + s1;\n**     s1 += x[i+1] + s0;\n**   endfor\n**\n** Note that s0 and s1 are both weighted checksums using fibonacci weights\n** in reverse order (the largest fibonacci weight occurs on the first element\n** of the sequence being summed.)  The s1 value spans all 32-bit \n** terms of the sequence whereas s0 omits the final term.\n**\n** On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the\n** WAL is transferred into the database, then the database is VFS.xSync-ed.\n** The VFS.xSync operations serve as write barriers - all writes launched\n** before the xSync must complete before any write that launches after the\n** xSync begins.\n**\n** After each checkpoint, the salt-1 value is incremented and the salt-2\n** value is randomized.  This prevents old and new frames in the WAL from\n** being considered valid at the same time and being checkpointing together\n** following a crash.\n**\n** READER ALGORITHM\n**\n** To read a page from the database (call it page number P), a reader\n** first checks the WAL to see if it contains page P.  If so, then the\n** last valid instance of page P that is a followed by a commit frame\n** or is a commit frame itself becomes the value read.  If the WAL\n** contains no copies of page P that are valid and which are a commit\n** frame or are followed by a commit frame, then page P is read from\n** the database file.\n**\n** To start a read transaction, the reader records the index of the last\n** valid frame in the WAL.  The reader uses this recorded \"mxFrame\" value\n** for all subsequent read operations.  New transactions can be appended\n** to the WAL, but as long as the reader uses its original mxFrame value\n** and ignores the newly appended content, it will see a consistent snapshot\n** of the database from a single point in time.  This technique allows\n** multiple concurrent readers to view different versions of the database\n** content simultaneously.\n**\n** The reader algorithm in the previous paragraphs works correctly, but \n** because frames for page P can appear anywhere within the WAL, the\n** reader has to scan the entire WAL looking for page P frames.  If the\n** WAL is large (multiple megabytes is typical) that scan can be slow,\n** and read performance suffers.  To overcome this problem, a separate\n** data structure called the wal-index is maintained to expedite the\n** search for frames of a particular page.\n** \n** WAL-INDEX FORMAT\n**\n** Conceptually, the wal-index is shared memory, though VFS implementations\n** might choose to implement the wal-index using a mmapped file.  Because\n** the wal-index is shared memory, SQLite does not support journal_mode=WAL \n** on a network filesystem.  All users of the database must be able to\n** share memory.\n**\n** The wal-index is transient.  After a crash, the wal-index can (and should\n** be) reconstructed from the original WAL file.  In fact, the VFS is required\n** to either truncate or zero the header of the wal-index when the last\n** connection to it closes.  Because the wal-index is transient, it can\n** use an architecture-specific format; it does not have to be cross-platform.\n** Hence, unlike the database and WAL file formats which store all values\n** as big endian, the wal-index can store multi-byte values in the native\n** byte order of the host computer.\n**\n** The purpose of the wal-index is to answer this question quickly:  Given\n** a page number P and a maximum frame index M, return the index of the \n** last frame in the wal before frame M for page P in the WAL, or return\n** NULL if there are no frames for page P in the WAL prior to M.\n**\n** The wal-index consists of a header region, followed by an one or\n** more index blocks.  \n**\n** The wal-index header contains the total number of frames within the WAL\n** in the mxFrame field.\n**\n** Each index block except for the first contains information on \n** HASHTABLE_NPAGE frames. The first index block contains information on\n** HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and \n** HASHTABLE_NPAGE are selected so that together the wal-index header and\n** first index block are the same size as all other index blocks in the\n** wal-index.\n**\n** Each index block contains two sections, a page-mapping that contains the\n** database page number associated with each wal frame, and a hash-table \n** that allows readers to query an index block for a specific page number.\n** The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE\n** for the first index block) 32-bit page numbers. The first entry in the \n** first index-block contains the database page number corresponding to the\n** first frame in the WAL file. The first entry in the second index block\n** in the WAL file corresponds to the (HASHTABLE_NPAGE_ONE+1)th frame in\n** the log, and so on.\n**\n** The last index block in a wal-index usually contains less than the full\n** complement of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE) page-numbers,\n** depending on the contents of the WAL file. This does not change the\n** allocated size of the page-mapping array - the page-mapping array merely\n** contains unused entries.\n**\n** Even without using the hash table, the last frame for page P\n** can be found by scanning the page-mapping sections of each index block\n** starting with the last index block and moving toward the first, and\n** within each index block, starting at the end and moving toward the\n** beginning.  The first entry that equals P corresponds to the frame\n** holding the content for that page.\n**\n** The hash table consists of HASHTABLE_NSLOT 16-bit unsigned integers.\n** HASHTABLE_NSLOT = 2*HASHTABLE_NPAGE, and there is one entry in the\n** hash table for each page number in the mapping section, so the hash \n** table is never more than half full.  The expected number of collisions \n** prior to finding a match is 1.  Each entry of the hash table is an\n** 1-based index of an entry in the mapping section of the same\n** index block.   Let K be the 1-based index of the largest entry in\n** the mapping section.  (For index blocks other than the last, K will\n** always be exactly HASHTABLE_NPAGE (4096) and for the last index block\n** K will be (mxFrame%HASHTABLE_NPAGE).)  Unused slots of the hash table\n** contain a value of 0.\n**\n** To look for page P in the hash table, first compute a hash iKey on\n** P as follows:\n**\n**      iKey = (P * 383) % HASHTABLE_NSLOT\n**\n** Then start scanning entries of the hash table, starting with iKey\n** (wrapping around to the beginning when the end of the hash table is\n** reached) until an unused hash slot is found. Let the first unused slot\n** be at index iUnused.  (iUnused might be less than iKey if there was\n** wrap-around.) Because the hash table is never more than half full,\n** the search is guaranteed to eventually hit an unused entry.  Let \n** iMax be the value between iKey and iUnused, closest to iUnused,\n** where aHash[iMax]==P.  If there is no iMax entry (if there exists\n** no hash slot such that aHash[i]==p) then page P is not in the\n** current index block.  Otherwise the iMax-th mapping entry of the\n** current index block corresponds to the last entry that references \n** page P.\n**\n** A hash search begins with the last index block and moves toward the\n** first index block, looking for entries corresponding to page P.  On\n** average, only two or three slots in each index block need to be\n** examined in order to either find the last entry for page P, or to\n** establish that no such entry exists in the block.  Each index block\n** holds over 4000 entries.  So two or three index blocks are sufficient\n** to cover a typical 10 megabyte WAL file, assuming 1K pages.  8 or 10\n** comparisons (on average) suffice to either locate a frame in the\n** WAL or to establish that the frame does not exist in the WAL.  This\n** is much faster than scanning the entire 10MB WAL.\n**\n** Note that entries are added in order of increasing K.  Hence, one\n** reader might be using some value K0 and a second reader that started\n** at a later time (after additional transactions were added to the WAL\n** and to the wal-index) might be using a different value K1, where K1>K0.\n** Both readers can use the same hash table and mapping section to get\n** the correct result.  There may be entries in the hash table with\n** K>K0 but to the first reader, those entries will appear to be unused\n** slots in the hash table and so the first reader will get an answer as\n** if no values greater than K0 had ever been inserted into the hash table\n** in the first place - which is what reader one wants.  Meanwhile, the\n** second reader using K1 will see additional values that were inserted\n** later, which is exactly what reader two wants.  \n**\n** When a rollback occurs, the value of K is decreased. Hash table entries\n** that correspond to frames greater than the new K value are removed\n** from the hash table at this point.\n*/\n#ifndef SQLITE_OMIT_WAL\n\n#include \"wal.h\"\n#if SQLITE_WCDB_SIGNAL_RETRY\n#include \"os_wcdb.h\"\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n\n/*\n** Trace output macros\n*/\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\nint sqlite3WalTrace = 0;\n# define WALTRACE(X)  if(sqlite3WalTrace) sqlite3DebugPrintf X\n#else\n# define WALTRACE(X)\n#endif\n\n/*\n** The maximum (and only) versions of the wal and wal-index formats\n** that may be interpreted by this version of SQLite.\n**\n** If a client begins recovering a WAL file and finds that (a) the checksum\n** values in the wal-header are correct and (b) the version field is not\n** WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN.\n**\n** Similarly, if a client successfully reads a wal-index header (i.e. the \n** checksum test is successful) and finds that the version field is not\n** WALINDEX_MAX_VERSION, then no read-transaction is opened and SQLite\n** returns SQLITE_CANTOPEN.\n*/\n#define WAL_MAX_VERSION      3007000\n#define WALINDEX_MAX_VERSION 3007000\n\n/*\n** Indices of various locking bytes.   WAL_NREADER is the number\n** of available reader locks and should be at least 3.  The default\n** is SQLITE_SHM_NLOCK==8 and  WAL_NREADER==5.\n*/\n#define WAL_WRITE_LOCK         0\n#define WAL_ALL_BUT_WRITE      1\n#define WAL_CKPT_LOCK          1\n#define WAL_RECOVER_LOCK       2\n#define WAL_READ_LOCK(I)       (3+(I))\n#define WAL_NREADER            (SQLITE_SHM_NLOCK-3)\n\n\n/* Object declarations */\ntypedef struct WalIndexHdr WalIndexHdr;\ntypedef struct WalIterator WalIterator;\ntypedef struct WalCkptInfo WalCkptInfo;\n\n\n/*\n** The following object holds a copy of the wal-index header content.\n**\n** The actual header in the wal-index consists of two copies of this\n** object followed by one instance of the WalCkptInfo object.\n** For all versions of SQLite through 3.10.0 and probably beyond,\n** the locking bytes (WalCkptInfo.aLock) start at offset 120 and\n** the total header size is 136 bytes.\n**\n** The szPage value can be any power of 2 between 512 and 32768, inclusive.\n** Or it can be 1 to represent a 65536-byte page.  The latter case was\n** added in 3.7.1 when support for 64K pages was added.  \n*/\nstruct WalIndexHdr {\n  u32 iVersion;                   /* Wal-index version */\n  u32 unused;                     /* Unused (padding) field */\n  u32 iChange;                    /* Counter incremented each transaction */\n  u8 isInit;                      /* 1 when initialized */\n  u8 bigEndCksum;                 /* True if checksums in WAL are big-endian */\n  u16 szPage;                     /* Database page size in bytes. 1==64K */\n  u32 mxFrame;                    /* Index of last valid frame in the WAL */\n  u32 nPage;                      /* Size of database in pages */\n  u32 aFrameCksum[2];             /* Checksum of last frame in log */\n  u32 aSalt[2];                   /* Two salt values copied from WAL header */\n  u32 aCksum[2];                  /* Checksum over all prior fields */\n};\n\n/*\n** A copy of the following object occurs in the wal-index immediately\n** following the second copy of the WalIndexHdr.  This object stores\n** information used by checkpoint.\n**\n** nBackfill is the number of frames in the WAL that have been written\n** back into the database. (We call the act of moving content from WAL to\n** database \"backfilling\".)  The nBackfill number is never greater than\n** WalIndexHdr.mxFrame.  nBackfill can only be increased by threads\n** holding the WAL_CKPT_LOCK lock (which includes a recovery thread).\n** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from\n** mxFrame back to zero when the WAL is reset.\n**\n** nBackfillAttempted is the largest value of nBackfill that a checkpoint\n** has attempted to achieve.  Normally nBackfill==nBackfillAtempted, however\n** the nBackfillAttempted is set before any backfilling is done and the\n** nBackfill is only set after all backfilling completes.  So if a checkpoint\n** crashes, nBackfillAttempted might be larger than nBackfill.  The\n** WalIndexHdr.mxFrame must never be less than nBackfillAttempted.\n**\n** The aLock[] field is a set of bytes used for locking.  These bytes should\n** never be read or written.\n**\n** There is one entry in aReadMark[] for each reader lock.  If a reader\n** holds read-lock K, then the value in aReadMark[K] is no greater than\n** the mxFrame for that reader.  The value READMARK_NOT_USED (0xffffffff)\n** for any aReadMark[] means that entry is unused.  aReadMark[0] is \n** a special case; its value is never used and it exists as a place-holder\n** to avoid having to offset aReadMark[] indexs by one.  Readers holding\n** WAL_READ_LOCK(0) always ignore the entire WAL and read all content\n** directly from the database.\n**\n** The value of aReadMark[K] may only be changed by a thread that\n** is holding an exclusive lock on WAL_READ_LOCK(K).  Thus, the value of\n** aReadMark[K] cannot changed while there is a reader is using that mark\n** since the reader will be holding a shared lock on WAL_READ_LOCK(K).\n**\n** The checkpointer may only transfer frames from WAL to database where\n** the frame numbers are less than or equal to every aReadMark[] that is\n** in use (that is, every aReadMark[j] for which there is a corresponding\n** WAL_READ_LOCK(j)).  New readers (usually) pick the aReadMark[] with the\n** largest value and will increase an unused aReadMark[] to mxFrame if there\n** is not already an aReadMark[] equal to mxFrame.  The exception to the\n** previous sentence is when nBackfill equals mxFrame (meaning that everything\n** in the WAL has been backfilled into the database) then new readers\n** will choose aReadMark[0] which has value 0 and hence such reader will\n** get all their all content directly from the database file and ignore \n** the WAL.\n**\n** Writers normally append new frames to the end of the WAL.  However,\n** if nBackfill equals mxFrame (meaning that all WAL content has been\n** written back into the database) and if no readers are using the WAL\n** (in other words, if there are no WAL_READ_LOCK(i) where i>0) then\n** the writer will first \"reset\" the WAL back to the beginning and start\n** writing new content beginning at frame 1.\n**\n** We assume that 32-bit loads are atomic and so no locks are needed in\n** order to read from any aReadMark[] entries.\n*/\nstruct WalCkptInfo {\n  u32 nBackfill;                  /* Number of WAL frames backfilled into DB */\n  u32 aReadMark[WAL_NREADER];     /* Reader marks */\n  u8 aLock[SQLITE_SHM_NLOCK];     /* Reserved space for locks */\n  u32 nBackfillAttempted;         /* WAL frames perhaps written, or maybe not */\n  u32 notUsed0;                   /* Available for future enhancements */\n};\n#define READMARK_NOT_USED  0xffffffff\n\n\n/* A block of WALINDEX_LOCK_RESERVED bytes beginning at\n** WALINDEX_LOCK_OFFSET is reserved for locks. Since some systems\n** only support mandatory file-locks, we do not read or write data\n** from the region of the file on which locks are applied.\n*/\n#define WALINDEX_LOCK_OFFSET (sizeof(WalIndexHdr)*2+offsetof(WalCkptInfo,aLock))\n#define WALINDEX_HDR_SIZE    (sizeof(WalIndexHdr)*2+sizeof(WalCkptInfo))\n\n/* Size of header before each frame in wal */\n#define WAL_FRAME_HDRSIZE 24\n\n/* Size of write ahead log header, including checksum. */\n/* #define WAL_HDRSIZE 24 */\n#define WAL_HDRSIZE 32\n\n/* WAL magic value. Either this value, or the same value with the least\n** significant bit also set (WAL_MAGIC | 0x00000001) is stored in 32-bit\n** big-endian format in the first 4 bytes of a WAL file.\n**\n** If the LSB is set, then the checksums for each frame within the WAL\n** file are calculated by treating all data as an array of 32-bit \n** big-endian words. Otherwise, they are calculated by interpreting \n** all data as 32-bit little-endian words.\n*/\n#define WAL_MAGIC 0x377f0682\n\n/*\n** Return the offset of frame iFrame in the write-ahead log file, \n** assuming a database page size of szPage bytes. The offset returned\n** is to the start of the write-ahead log frame-header.\n*/\n#define walFrameOffset(iFrame, szPage) (                               \\\n  WAL_HDRSIZE + ((iFrame)-1)*(i64)((szPage)+WAL_FRAME_HDRSIZE)         \\\n)\n\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\ntypedef struct WalCheckpointHandler WalCheckpointHandler; \nstruct WalCheckpointHandler {\n  int (*xFunc)(void *,int);  /* The checkpoint callback */\n  void *pArg;                /* First arg to checkpoint callback */\n};\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n/*\n** An open write-ahead log file is represented by an instance of the\n** following object.\n*/\nstruct Wal {\n  sqlite3_vfs *pVfs;         /* The VFS used to create pDbFd */\n  sqlite3_file *pDbFd;       /* File handle for the database file */\n  sqlite3_file *pWalFd;      /* File handle for WAL file */\n  u32 iCallback;             /* Value to pass to log callback (or 0) */\n  i64 mxWalSize;             /* Truncate WAL to this size upon reset */\n  int nWiData;               /* Size of array apWiData */\n  int szFirstBlock;          /* Size of first block written to WAL file */\n  volatile u32 **apWiData;   /* Pointer to wal-index content in memory */\n  u32 szPage;                /* Database page size */\n  i16 readLock;              /* Which read lock is being held.  -1 for none */\n  u8 syncFlags;              /* Flags to use to sync header writes */\n  u8 exclusiveMode;          /* Non-zero if connection is in exclusive mode */\n  u8 writeLock;              /* True if in a write transaction */\n  u8 ckptLock;               /* True if holding a checkpoint lock */\n  u8 readOnly;               /* WAL_RDWR, WAL_RDONLY, or WAL_SHM_RDONLY */\n  u8 truncateOnCommit;       /* True to truncate WAL file on commit */\n  u8 syncHeader;             /* Fsync the WAL header if true */\n  u8 padToSectorBoundary;    /* Pad transactions out to the next sector */\n  WalIndexHdr hdr;           /* Wal-index header for current transaction */\n  u32 minFrame;              /* Ignore wal frames before this one */\n  u32 iReCksum;              /* On commit, recalculate checksums from here */\n  const char *zWalName;      /* Name of WAL file */\n  u32 nCkpt;                 /* Checkpoint sequence counter in the wal-header */\n#ifdef SQLITE_DEBUG\n  u8 lockError;              /* True if a locking error has occurred */\n#endif\n#ifdef SQLITE_ENABLE_SNAPSHOT\n  WalIndexHdr *pSnapshot;    /* Start transaction here if not NULL */\n#endif\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\n  WalCheckpointHandler checkpointHandler; /* Checkpoint callback */\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n};\n\n/*\n** Candidate values for Wal.exclusiveMode.\n*/\n#define WAL_NORMAL_MODE     0\n#define WAL_EXCLUSIVE_MODE  1     \n#define WAL_HEAPMEMORY_MODE 2\n\n/*\n** Possible values for WAL.readOnly\n*/\n#define WAL_RDWR        0    /* Normal read/write connection */\n#define WAL_RDONLY      1    /* The WAL file is readonly */\n#define WAL_SHM_RDONLY  2    /* The SHM file is readonly */\n\n/*\n** Each page of the wal-index mapping contains a hash-table made up of\n** an array of HASHTABLE_NSLOT elements of the following type.\n*/\ntypedef u16 ht_slot;\n\n/*\n** This structure is used to implement an iterator that loops through\n** all frames in the WAL in database page order. Where two or more frames\n** correspond to the same database page, the iterator visits only the \n** frame most recently written to the WAL (in other words, the frame with\n** the largest index).\n**\n** The internals of this structure are only accessed by:\n**\n**   walIteratorInit() - Create a new iterator,\n**   walIteratorNext() - Step an iterator,\n**   walIteratorFree() - Free an iterator.\n**\n** This functionality is used by the checkpoint code (see walCheckpoint()).\n*/\nstruct WalIterator {\n  int iPrior;                     /* Last result returned from the iterator */\n  int nSegment;                   /* Number of entries in aSegment[] */\n  struct WalSegment {\n    int iNext;                    /* Next slot in aIndex[] not yet returned */\n    ht_slot *aIndex;              /* i0, i1, i2... such that aPgno[iN] ascend */\n    u32 *aPgno;                   /* Array of page numbers. */\n    int nEntry;                   /* Nr. of entries in aPgno[] and aIndex[] */\n    int iZero;                    /* Frame number associated with aPgno[0] */\n  } aSegment[1];                  /* One for every 32KB page in the wal-index */\n};\n\n/*\n** Define the parameters of the hash tables in the wal-index file. There\n** is a hash-table following every HASHTABLE_NPAGE page numbers in the\n** wal-index.\n**\n** Changing any of these constants will alter the wal-index format and\n** create incompatibilities.\n*/\n#define HASHTABLE_NPAGE      4096                 /* Must be power of 2 */\n#define HASHTABLE_HASH_1     383                  /* Should be prime */\n#define HASHTABLE_NSLOT      (HASHTABLE_NPAGE*2)  /* Must be a power of 2 */\n\n/* \n** The block of page numbers associated with the first hash-table in a\n** wal-index is smaller than usual. This is so that there is a complete\n** hash-table on each aligned 32KB page of the wal-index.\n*/\n#define HASHTABLE_NPAGE_ONE  (HASHTABLE_NPAGE - (WALINDEX_HDR_SIZE/sizeof(u32)))\n\n/* The wal-index is divided into pages of WALINDEX_PGSZ bytes each. */\n#define WALINDEX_PGSZ   (                                         \\\n    sizeof(ht_slot)*HASHTABLE_NSLOT + HASHTABLE_NPAGE*sizeof(u32) \\\n)\n\n/*\n** Obtain a pointer to the iPage'th page of the wal-index. The wal-index\n** is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are\n** numbered from zero.\n**\n** If this call is successful, *ppPage is set to point to the wal-index\n** page and SQLITE_OK is returned. If an error (an OOM or VFS error) occurs,\n** then an SQLite error code is returned and *ppPage is set to 0.\n*/\nstatic int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){\n  int rc = SQLITE_OK;\n\n  /* Enlarge the pWal->apWiData[] array if required */\n  if( pWal->nWiData<=iPage ){\n    int nByte = sizeof(u32*)*(iPage+1);\n    volatile u32 **apNew;\n    apNew = (volatile u32 **)sqlite3_realloc64((void *)pWal->apWiData, nByte);\n    if( !apNew ){\n      *ppPage = 0;\n      return SQLITE_NOMEM_BKPT;\n    }\n    memset((void*)&apNew[pWal->nWiData], 0,\n           sizeof(u32*)*(iPage+1-pWal->nWiData));\n    pWal->apWiData = apNew;\n    pWal->nWiData = iPage+1;\n  }\n\n  /* Request a pointer to the required page from the VFS */\n  if( pWal->apWiData[iPage]==0 ){\n    if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){\n      pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ);\n      if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM_BKPT;\n    }else{\n      rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, \n          pWal->writeLock, (void volatile **)&pWal->apWiData[iPage]\n      );\n      if( rc==SQLITE_READONLY ){\n        pWal->readOnly |= WAL_SHM_RDONLY;\n        rc = SQLITE_OK;\n      }\n    }\n  }\n\n  *ppPage = pWal->apWiData[iPage];\n  assert( iPage==0 || *ppPage || rc!=SQLITE_OK );\n  return rc;\n}\n\n/*\n** Return a pointer to the WalCkptInfo structure in the wal-index.\n*/\nstatic volatile WalCkptInfo *walCkptInfo(Wal *pWal){\n  assert( pWal->nWiData>0 && pWal->apWiData[0] );\n  return (volatile WalCkptInfo*)&(pWal->apWiData[0][sizeof(WalIndexHdr)/2]);\n}\n\n/*\n** Return a pointer to the WalIndexHdr structure in the wal-index.\n*/\nstatic volatile WalIndexHdr *walIndexHdr(Wal *pWal){\n  assert( pWal->nWiData>0 && pWal->apWiData[0] );\n  return (volatile WalIndexHdr*)pWal->apWiData[0];\n}\n\n/*\n** The argument to this macro must be of type u32. On a little-endian\n** architecture, it returns the u32 value that results from interpreting\n** the 4 bytes as a big-endian value. On a big-endian architecture, it\n** returns the value that would be produced by interpreting the 4 bytes\n** of the input value as a little-endian integer.\n*/\n#define BYTESWAP32(x) ( \\\n    (((x)&0x000000FF)<<24) + (((x)&0x0000FF00)<<8)  \\\n  + (((x)&0x00FF0000)>>8)  + (((x)&0xFF000000)>>24) \\\n)\n\n/*\n** Generate or extend an 8 byte checksum based on the data in \n** array aByte[] and the initial values of aIn[0] and aIn[1] (or\n** initial values of 0 and 0 if aIn==NULL).\n**\n** The checksum is written back into aOut[] before returning.\n**\n** nByte must be a positive multiple of 8.\n*/\nstatic void walChecksumBytes(\n  int nativeCksum, /* True for native byte-order, false for non-native */\n  u8 *a,           /* Content to be checksummed */\n  int nByte,       /* Bytes of content in a[].  Must be a multiple of 8. */\n  const u32 *aIn,  /* Initial checksum value input */\n  u32 *aOut        /* OUT: Final checksum value output */\n){\n  u32 s1, s2;\n  u32 *aData = (u32 *)a;\n  u32 *aEnd = (u32 *)&a[nByte];\n\n  if( aIn ){\n    s1 = aIn[0];\n    s2 = aIn[1];\n  }else{\n    s1 = s2 = 0;\n  }\n\n  assert( nByte>=8 );\n  assert( (nByte&0x00000007)==0 );\n\n  if( nativeCksum ){\n    do {\n      s1 += *aData++ + s2;\n      s2 += *aData++ + s1;\n    }while( aData<aEnd );\n  }else{\n    do {\n      s1 += BYTESWAP32(aData[0]) + s2;\n      s2 += BYTESWAP32(aData[1]) + s1;\n      aData += 2;\n    }while( aData<aEnd );\n  }\n\n  aOut[0] = s1;\n  aOut[1] = s2;\n}\n\nstatic void walShmBarrier(Wal *pWal){\n  if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){\n    sqlite3OsShmBarrier(pWal->pDbFd);\n  }\n}\n\n/*\n** Write the header information in pWal->hdr into the wal-index.\n**\n** The checksum on pWal->hdr is updated before it is written.\n*/\nstatic void walIndexWriteHdr(Wal *pWal){\n  volatile WalIndexHdr *aHdr = walIndexHdr(pWal);\n  const int nCksum = offsetof(WalIndexHdr, aCksum);\n\n  assert( pWal->writeLock );\n  pWal->hdr.isInit = 1;\n  pWal->hdr.iVersion = WALINDEX_MAX_VERSION;\n  walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum);\n  memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr));\n  walShmBarrier(pWal);\n  memcpy((void*)&aHdr[0], (const void*)&pWal->hdr, sizeof(WalIndexHdr));\n}\n\n/*\n** This function encodes a single frame header and writes it to a buffer\n** supplied by the caller. A frame-header is made up of a series of \n** 4-byte big-endian integers, as follows:\n**\n**     0: Page number.\n**     4: For commit records, the size of the database image in pages \n**        after the commit. For all other records, zero.\n**     8: Salt-1 (copied from the wal-header)\n**    12: Salt-2 (copied from the wal-header)\n**    16: Checksum-1.\n**    20: Checksum-2.\n*/\nstatic void walEncodeFrame(\n  Wal *pWal,                      /* The write-ahead log */\n  u32 iPage,                      /* Database page number for frame */\n  u32 nTruncate,                  /* New db size (or 0 for non-commit frames) */\n  u8 *aData,                      /* Pointer to page data */\n  u8 *aFrame                      /* OUT: Write encoded frame here */\n){\n  int nativeCksum;                /* True for native byte-order checksums */\n  u32 *aCksum = pWal->hdr.aFrameCksum;\n  assert( WAL_FRAME_HDRSIZE==24 );\n  sqlite3Put4byte(&aFrame[0], iPage);\n  sqlite3Put4byte(&aFrame[4], nTruncate);\n  if( pWal->iReCksum==0 ){\n    memcpy(&aFrame[8], pWal->hdr.aSalt, 8);\n\n    nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);\n    walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);\n    walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);\n\n    sqlite3Put4byte(&aFrame[16], aCksum[0]);\n    sqlite3Put4byte(&aFrame[20], aCksum[1]);\n  }else{\n    memset(&aFrame[8], 0, 16);\n  }\n}\n\n/*\n** Check to see if the frame with header in aFrame[] and content\n** in aData[] is valid.  If it is a valid frame, fill *piPage and\n** *pnTruncate and return true.  Return if the frame is not valid.\n*/\nstatic int walDecodeFrame(\n  Wal *pWal,                      /* The write-ahead log */\n  u32 *piPage,                    /* OUT: Database page number for frame */\n  u32 *pnTruncate,                /* OUT: New db size (or 0 if not commit) */\n  u8 *aData,                      /* Pointer to page data (for checksum) */\n  u8 *aFrame                      /* Frame data */\n){\n  int nativeCksum;                /* True for native byte-order checksums */\n  u32 *aCksum = pWal->hdr.aFrameCksum;\n  u32 pgno;                       /* Page number of the frame */\n  assert( WAL_FRAME_HDRSIZE==24 );\n\n  /* A frame is only valid if the salt values in the frame-header\n  ** match the salt values in the wal-header. \n  */\n  if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){\n    return 0;\n  }\n\n  /* A frame is only valid if the page number is creater than zero.\n  */\n  pgno = sqlite3Get4byte(&aFrame[0]);\n  if( pgno==0 ){\n    return 0;\n  }\n\n  /* A frame is only valid if a checksum of the WAL header,\n  ** all prior frams, the first 16 bytes of this frame-header, \n  ** and the frame-data matches the checksum in the last 8 \n  ** bytes of this frame-header.\n  */\n  nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN);\n  walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum);\n  walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum);\n  if( aCksum[0]!=sqlite3Get4byte(&aFrame[16]) \n   || aCksum[1]!=sqlite3Get4byte(&aFrame[20]) \n  ){\n    /* Checksum failed. */\n    return 0;\n  }\n\n  /* If we reach this point, the frame is valid.  Return the page number\n  ** and the new database size.\n  */\n  *piPage = pgno;\n  *pnTruncate = sqlite3Get4byte(&aFrame[4]);\n  return 1;\n}\n\n\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\n/*\n** Names of locks.  This routine is used to provide debugging output and is not\n** a part of an ordinary build.\n*/\nstatic const char *walLockName(int lockIdx){\n  if( lockIdx==WAL_WRITE_LOCK ){\n    return \"WRITE-LOCK\";\n  }else if( lockIdx==WAL_CKPT_LOCK ){\n    return \"CKPT-LOCK\";\n  }else if( lockIdx==WAL_RECOVER_LOCK ){\n    return \"RECOVER-LOCK\";\n  }else{\n    static char zName[15];\n    sqlite3_snprintf(sizeof(zName), zName, \"READ-LOCK[%d]\",\n                     lockIdx-WAL_READ_LOCK(0));\n    return zName;\n  }\n}\n#endif /*defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */\n    \n\n/*\n** Set or release locks on the WAL.  Locks are either shared or exclusive.\n** A lock cannot be moved directly between shared and exclusive - it must go\n** through the unlocked state first.\n**\n** In locking_mode=EXCLUSIVE, all of these routines become no-ops.\n*/\nstatic int walLockShared(Wal *pWal, int lockIdx){\n  int rc;\n  if( pWal->exclusiveMode ) return SQLITE_OK;\n  rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1,\n                        SQLITE_SHM_LOCK | SQLITE_SHM_SHARED);\n  WALTRACE((\"WAL%p: acquire SHARED-%s %s\\n\", pWal,\n            walLockName(lockIdx), rc ? \"failed\" : \"ok\"));\n  VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); )\n  return rc;\n}\nstatic void walUnlockShared(Wal *pWal, int lockIdx){\n  if( pWal->exclusiveMode ) return;\n  (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1,\n                         SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED);\n  WALTRACE((\"WAL%p: release SHARED-%s\\n\", pWal, walLockName(lockIdx)));\n}\nstatic int walLockExclusive(Wal *pWal, int lockIdx, int n){\n  int rc;\n  if( pWal->exclusiveMode ) return SQLITE_OK;\n  rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, n,\n                        SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE);\n  WALTRACE((\"WAL%p: acquire EXCLUSIVE-%s cnt=%d %s\\n\", pWal,\n            walLockName(lockIdx), n, rc ? \"failed\" : \"ok\"));\n  VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); )\n  return rc;\n}\nstatic void walUnlockExclusive(Wal *pWal, int lockIdx, int n){\n  if( pWal->exclusiveMode ) return;\n  (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, n,\n                         SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE);\n  WALTRACE((\"WAL%p: release EXCLUSIVE-%s cnt=%d\\n\", pWal,\n             walLockName(lockIdx), n));\n}\n\n/*\n** Compute a hash on a page number.  The resulting hash value must land\n** between 0 and (HASHTABLE_NSLOT-1).  The walHashNext() function advances\n** the hash to the next value in the event of a collision.\n*/\nstatic int walHash(u32 iPage){\n  assert( iPage>0 );\n  assert( (HASHTABLE_NSLOT & (HASHTABLE_NSLOT-1))==0 );\n  return (iPage*HASHTABLE_HASH_1) & (HASHTABLE_NSLOT-1);\n}\nstatic int walNextHash(int iPriorHash){\n  return (iPriorHash+1)&(HASHTABLE_NSLOT-1);\n}\n\n/* \n** Return pointers to the hash table and page number array stored on\n** page iHash of the wal-index. The wal-index is broken into 32KB pages\n** numbered starting from 0.\n**\n** Set output variable *paHash to point to the start of the hash table\n** in the wal-index file. Set *piZero to one less than the frame \n** number of the first frame indexed by this hash table. If a\n** slot in the hash table is set to N, it refers to frame number \n** (*piZero+N) in the log.\n**\n** Finally, set *paPgno so that *paPgno[1] is the page number of the\n** first frame indexed by the hash table, frame (*piZero+1).\n*/\nstatic int walHashGet(\n  Wal *pWal,                      /* WAL handle */\n  int iHash,                      /* Find the iHash'th table */\n  volatile ht_slot **paHash,      /* OUT: Pointer to hash index */\n  volatile u32 **paPgno,          /* OUT: Pointer to page number array */\n  u32 *piZero                     /* OUT: Frame associated with *paPgno[0] */\n){\n  int rc;                         /* Return code */\n  volatile u32 *aPgno;\n\n  rc = walIndexPage(pWal, iHash, &aPgno);\n  assert( rc==SQLITE_OK || iHash>0 );\n\n  if( rc==SQLITE_OK ){\n    u32 iZero;\n    volatile ht_slot *aHash;\n\n    aHash = (volatile ht_slot *)&aPgno[HASHTABLE_NPAGE];\n    if( iHash==0 ){\n      aPgno = &aPgno[WALINDEX_HDR_SIZE/sizeof(u32)];\n      iZero = 0;\n    }else{\n      iZero = HASHTABLE_NPAGE_ONE + (iHash-1)*HASHTABLE_NPAGE;\n    }\n  \n    *paPgno = &aPgno[-1];\n    *paHash = aHash;\n    *piZero = iZero;\n  }\n  return rc;\n}\n\n/*\n** Return the number of the wal-index page that contains the hash-table\n** and page-number array that contain entries corresponding to WAL frame\n** iFrame. The wal-index is broken up into 32KB pages. Wal-index pages \n** are numbered starting from 0.\n*/\nstatic int walFramePage(u32 iFrame){\n  int iHash = (iFrame+HASHTABLE_NPAGE-HASHTABLE_NPAGE_ONE-1) / HASHTABLE_NPAGE;\n  assert( (iHash==0 || iFrame>HASHTABLE_NPAGE_ONE)\n       && (iHash>=1 || iFrame<=HASHTABLE_NPAGE_ONE)\n       && (iHash<=1 || iFrame>(HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE))\n       && (iHash>=2 || iFrame<=HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE)\n       && (iHash<=2 || iFrame>(HASHTABLE_NPAGE_ONE+2*HASHTABLE_NPAGE))\n  );\n  return iHash;\n}\n\n/*\n** Return the page number associated with frame iFrame in this WAL.\n*/\nstatic u32 walFramePgno(Wal *pWal, u32 iFrame){\n  int iHash = walFramePage(iFrame);\n  if( iHash==0 ){\n    return pWal->apWiData[0][WALINDEX_HDR_SIZE/sizeof(u32) + iFrame - 1];\n  }\n  return pWal->apWiData[iHash][(iFrame-1-HASHTABLE_NPAGE_ONE)%HASHTABLE_NPAGE];\n}\n\n/*\n** Remove entries from the hash table that point to WAL slots greater\n** than pWal->hdr.mxFrame.\n**\n** This function is called whenever pWal->hdr.mxFrame is decreased due\n** to a rollback or savepoint.\n**\n** At most only the hash table containing pWal->hdr.mxFrame needs to be\n** updated.  Any later hash tables will be automatically cleared when\n** pWal->hdr.mxFrame advances to the point where those hash tables are\n** actually needed.\n*/\nstatic void walCleanupHash(Wal *pWal){\n  volatile ht_slot *aHash = 0;    /* Pointer to hash table to clear */\n  volatile u32 *aPgno = 0;        /* Page number array for hash table */\n  u32 iZero = 0;                  /* frame == (aHash[x]+iZero) */\n  int iLimit = 0;                 /* Zero values greater than this */\n  int nByte;                      /* Number of bytes to zero in aPgno[] */\n  int i;                          /* Used to iterate through aHash[] */\n\n  assert( pWal->writeLock );\n  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 );\n  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE );\n  testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 );\n\n  if( pWal->hdr.mxFrame==0 ) return;\n\n  /* Obtain pointers to the hash-table and page-number array containing \n  ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed\n  ** that the page said hash-table and array reside on is already mapped.\n  */\n  assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) );\n  assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] );\n  walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &aHash, &aPgno, &iZero);\n\n  /* Zero all hash-table entries that correspond to frame numbers greater\n  ** than pWal->hdr.mxFrame.\n  */\n  iLimit = pWal->hdr.mxFrame - iZero;\n  assert( iLimit>0 );\n  for(i=0; i<HASHTABLE_NSLOT; i++){\n    if( aHash[i]>iLimit ){\n      aHash[i] = 0;\n    }\n  }\n  \n  /* Zero the entries in the aPgno array that correspond to frames with\n  ** frame numbers greater than pWal->hdr.mxFrame. \n  */\n  nByte = (int)((char *)aHash - (char *)&aPgno[iLimit+1]);\n  memset((void *)&aPgno[iLimit+1], 0, nByte);\n\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\n  /* Verify that the every entry in the mapping region is still reachable\n  ** via the hash table even after the cleanup.\n  */\n  if( iLimit ){\n    int j;           /* Loop counter */\n    int iKey;        /* Hash key */\n    for(j=1; j<=iLimit; j++){\n      for(iKey=walHash(aPgno[j]); aHash[iKey]; iKey=walNextHash(iKey)){\n        if( aHash[iKey]==j ) break;\n      }\n      assert( aHash[iKey]==j );\n    }\n  }\n#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */\n}\n\n\n/*\n** Set an entry in the wal-index that will map database page number\n** pPage into WAL frame iFrame.\n*/\nstatic int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){\n  int rc;                         /* Return code */\n  u32 iZero = 0;                  /* One less than frame number of aPgno[1] */\n  volatile u32 *aPgno = 0;        /* Page number array */\n  volatile ht_slot *aHash = 0;    /* Hash table */\n\n  rc = walHashGet(pWal, walFramePage(iFrame), &aHash, &aPgno, &iZero);\n\n  /* Assuming the wal-index file was successfully mapped, populate the\n  ** page number array and hash table entry.\n  */\n  if( rc==SQLITE_OK ){\n    int iKey;                     /* Hash table key */\n    int idx;                      /* Value to write to hash-table slot */\n    int nCollide;                 /* Number of hash collisions */\n\n    idx = iFrame - iZero;\n    assert( idx <= HASHTABLE_NSLOT/2 + 1 );\n    \n    /* If this is the first entry to be added to this hash-table, zero the\n    ** entire hash table and aPgno[] array before proceeding. \n    */\n    if( idx==1 ){\n      int nByte = (int)((u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1]);\n      memset((void*)&aPgno[1], 0, nByte);\n    }\n\n    /* If the entry in aPgno[] is already set, then the previous writer\n    ** must have exited unexpectedly in the middle of a transaction (after\n    ** writing one or more dirty pages to the WAL to free up memory). \n    ** Remove the remnants of that writers uncommitted transaction from \n    ** the hash-table before writing any new entries.\n    */\n    if( aPgno[idx] ){\n      walCleanupHash(pWal);\n      assert( !aPgno[idx] );\n    }\n\n    /* Write the aPgno[] array entry and the hash-table slot. */\n    nCollide = idx;\n    for(iKey=walHash(iPage); aHash[iKey]; iKey=walNextHash(iKey)){\n      if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT;\n    }\n    aPgno[idx] = iPage;\n    aHash[iKey] = (ht_slot)idx;\n\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\n    /* Verify that the number of entries in the hash table exactly equals\n    ** the number of entries in the mapping region.\n    */\n    {\n      int i;           /* Loop counter */\n      int nEntry = 0;  /* Number of entries in the hash table */\n      for(i=0; i<HASHTABLE_NSLOT; i++){ if( aHash[i] ) nEntry++; }\n      assert( nEntry==idx );\n    }\n\n    /* Verify that the every entry in the mapping region is reachable\n    ** via the hash table.  This turns out to be a really, really expensive\n    ** thing to check, so only do this occasionally - not on every\n    ** iteration.\n    */\n    if( (idx&0x3ff)==0 ){\n      int i;           /* Loop counter */\n      for(i=1; i<=idx; i++){\n        for(iKey=walHash(aPgno[i]); aHash[iKey]; iKey=walNextHash(iKey)){\n          if( aHash[iKey]==i ) break;\n        }\n        assert( aHash[iKey]==i );\n      }\n    }\n#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */\n  }\n\n\n  return rc;\n}\n\n\n/*\n** Recover the wal-index by reading the write-ahead log file. \n**\n** This routine first tries to establish an exclusive lock on the\n** wal-index to prevent other threads/processes from doing anything\n** with the WAL or wal-index while recovery is running.  The\n** WAL_RECOVER_LOCK is also held so that other threads will know\n** that this thread is running recovery.  If unable to establish\n** the necessary locks, this routine returns SQLITE_BUSY.\n*/\nstatic int walIndexRecover(Wal *pWal){\n  int rc;                         /* Return Code */\n  i64 nSize;                      /* Size of log file */\n  u32 aFrameCksum[2] = {0, 0};\n  int iLock;                      /* Lock offset to lock for checkpoint */\n  int nLock;                      /* Number of locks to hold */\n\n  /* Obtain an exclusive lock on all byte in the locking range not already\n  ** locked by the caller. The caller is guaranteed to have locked the\n  ** WAL_WRITE_LOCK byte, and may have also locked the WAL_CKPT_LOCK byte.\n  ** If successful, the same bytes that are locked here are unlocked before\n  ** this function returns.\n  */\n  assert( pWal->ckptLock==1 || pWal->ckptLock==0 );\n  assert( WAL_ALL_BUT_WRITE==WAL_WRITE_LOCK+1 );\n  assert( WAL_CKPT_LOCK==WAL_ALL_BUT_WRITE );\n  assert( pWal->writeLock );\n  iLock = WAL_ALL_BUT_WRITE + pWal->ckptLock;\n  nLock = SQLITE_SHM_NLOCK - iLock;\n  rc = walLockExclusive(pWal, iLock, nLock);\n  if( rc ){\n    return rc;\n  }\n  WALTRACE((\"WAL%p: recovery begin...\\n\", pWal));\n\n  memset(&pWal->hdr, 0, sizeof(WalIndexHdr));\n\n  rc = sqlite3OsFileSize(pWal->pWalFd, &nSize);\n  if( rc!=SQLITE_OK ){\n    goto recovery_error;\n  }\n\n  if( nSize>WAL_HDRSIZE ){\n    u8 aBuf[WAL_HDRSIZE];         /* Buffer to load WAL header into */\n    u8 *aFrame = 0;               /* Malloc'd buffer to load entire frame */\n    int szFrame;                  /* Number of bytes in buffer aFrame[] */\n    u8 *aData;                    /* Pointer to data part of aFrame buffer */\n    int iFrame;                   /* Index of last frame read */\n    i64 iOffset;                  /* Next offset to read from log file */\n    int szPage;                   /* Page size according to the log */\n    u32 magic;                    /* Magic value read from WAL header */\n    u32 version;                  /* Magic value read from WAL header */\n    int isValid;                  /* True if this frame is valid */\n\n    /* Read in the WAL header. */\n    rc = sqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0);\n    if( rc!=SQLITE_OK ){\n      goto recovery_error;\n    }\n\n    /* If the database page size is not a power of two, or is greater than\n    ** SQLITE_MAX_PAGE_SIZE, conclude that the WAL file contains no valid \n    ** data. Similarly, if the 'magic' value is invalid, ignore the whole\n    ** WAL file.\n    */\n    magic = sqlite3Get4byte(&aBuf[0]);\n    szPage = sqlite3Get4byte(&aBuf[8]);\n    if( (magic&0xFFFFFFFE)!=WAL_MAGIC \n     || szPage&(szPage-1) \n     || szPage>SQLITE_MAX_PAGE_SIZE \n     || szPage<512 \n    ){\n      goto finished;\n    }\n    pWal->hdr.bigEndCksum = (u8)(magic&0x00000001);\n    pWal->szPage = szPage;\n    pWal->nCkpt = sqlite3Get4byte(&aBuf[12]);\n    memcpy(&pWal->hdr.aSalt, &aBuf[16], 8);\n\n    /* Verify that the WAL header checksum is correct */\n    walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN, \n        aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum\n    );\n    if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])\n     || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])\n    ){\n      goto finished;\n    }\n\n    /* Verify that the version number on the WAL format is one that\n    ** are able to understand */\n    version = sqlite3Get4byte(&aBuf[4]);\n    if( version!=WAL_MAX_VERSION ){\n      rc = SQLITE_CANTOPEN_BKPT;\n      goto finished;\n    }\n\n    /* Malloc a buffer to read frames into. */\n    szFrame = szPage + WAL_FRAME_HDRSIZE;\n    aFrame = (u8 *)sqlite3_malloc64(szFrame);\n    if( !aFrame ){\n      rc = SQLITE_NOMEM_BKPT;\n      goto recovery_error;\n    }\n    aData = &aFrame[WAL_FRAME_HDRSIZE];\n\n    /* Read all frames from the log file. */\n    iFrame = 0;\n    for(iOffset=WAL_HDRSIZE; (iOffset+szFrame)<=nSize; iOffset+=szFrame){\n      u32 pgno;                   /* Database page number for frame */\n      u32 nTruncate;              /* dbsize field from frame header */\n\n      /* Read and decode the next log frame. */\n      iFrame++;\n      rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset);\n      if( rc!=SQLITE_OK ) break;\n      isValid = walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame);\n      if( !isValid ) break;\n      rc = walIndexAppend(pWal, iFrame, pgno);\n      if( rc!=SQLITE_OK ) break;\n\n      /* If nTruncate is non-zero, this is a commit record. */\n      if( nTruncate ){\n        pWal->hdr.mxFrame = iFrame;\n        pWal->hdr.nPage = nTruncate;\n        pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));\n        testcase( szPage<=32768 );\n        testcase( szPage>=65536 );\n        aFrameCksum[0] = pWal->hdr.aFrameCksum[0];\n        aFrameCksum[1] = pWal->hdr.aFrameCksum[1];\n      }\n    }\n\n    sqlite3_free(aFrame);\n  }\n\nfinished:\n  if( rc==SQLITE_OK ){\n    volatile WalCkptInfo *pInfo;\n    int i;\n    pWal->hdr.aFrameCksum[0] = aFrameCksum[0];\n    pWal->hdr.aFrameCksum[1] = aFrameCksum[1];\n    walIndexWriteHdr(pWal);\n\n    /* Reset the checkpoint-header. This is safe because this thread is \n    ** currently holding locks that exclude all other readers, writers and\n    ** checkpointers.\n    */\n    pInfo = walCkptInfo(pWal);\n    pInfo->nBackfill = 0;\n    pInfo->nBackfillAttempted = pWal->hdr.mxFrame;\n    pInfo->aReadMark[0] = 0;\n    for(i=1; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;\n    if( pWal->hdr.mxFrame ) pInfo->aReadMark[1] = pWal->hdr.mxFrame;\n\n    /* If more than one frame was recovered from the log file, report an\n    ** event via sqlite3_log(). This is to help with identifying performance\n    ** problems caused by applications routinely shutting down without\n    ** checkpointing the log file.\n    */\n    if( pWal->hdr.nPage ){\n      sqlite3_log(SQLITE_NOTICE_RECOVER_WAL,\n          \"recovered %d frames from WAL file %s\",\n          pWal->hdr.mxFrame, pWal->zWalName\n      );\n    }\n  }\n\nrecovery_error:\n  WALTRACE((\"WAL%p: recovery %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\n  walUnlockExclusive(pWal, iLock, nLock);\n  return rc;\n}\n\n/*\n** Close an open wal-index.\n*/\nstatic void walIndexClose(Wal *pWal, int isDelete){\n  if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){\n    int i;\n    for(i=0; i<pWal->nWiData; i++){\n      sqlite3_free((void *)pWal->apWiData[i]);\n      pWal->apWiData[i] = 0;\n    }\n  }else{\n    sqlite3OsShmUnmap(pWal->pDbFd, isDelete);\n  }\n}\n\n/* \n** Open a connection to the WAL file zWalName. The database file must \n** already be opened on connection pDbFd. The buffer that zWalName points\n** to must remain valid for the lifetime of the returned Wal* handle.\n**\n** A SHARED lock should be held on the database file when this function\n** is called. The purpose of this SHARED lock is to prevent any other\n** client from unlinking the WAL or wal-index file. If another process\n** were to do this just after this client opened one of these files, the\n** system would be badly broken.\n**\n** If the log file is successfully opened, SQLITE_OK is returned and \n** *ppWal is set to point to a new WAL handle. If an error occurs,\n** an SQLite error code is returned and *ppWal is left unmodified.\n*/\nint sqlite3WalOpen(\n  sqlite3_vfs *pVfs,              /* vfs module to open wal and wal-index */\n  sqlite3_file *pDbFd,            /* The open database file */\n  const char *zWalName,           /* Name of the WAL file */\n  int bNoShm,                     /* True to run in heap-memory mode */\n  i64 mxWalSize,                  /* Truncate WAL to this size on reset */\n  Wal **ppWal                     /* OUT: Allocated Wal handle */\n){\n  int rc;                         /* Return Code */\n  Wal *pRet;                      /* Object to allocate and return */\n  int flags;                      /* Flags passed to OsOpen() */\n\n  assert( zWalName && zWalName[0] );\n  assert( pDbFd );\n\n  /* In the amalgamation, the os_unix.c and os_win.c source files come before\n  ** this source file.  Verify that the #defines of the locking byte offsets\n  ** in os_unix.c and os_win.c agree with the WALINDEX_LOCK_OFFSET value.\n  ** For that matter, if the lock offset ever changes from its initial design\n  ** value of 120, we need to know that so there is an assert() to check it.\n  */\n  assert( 120==WALINDEX_LOCK_OFFSET );\n  assert( 136==WALINDEX_HDR_SIZE );\n#ifdef WIN_SHM_BASE\n  assert( WIN_SHM_BASE==WALINDEX_LOCK_OFFSET );\n#endif\n#ifdef UNIX_SHM_BASE\n  assert( UNIX_SHM_BASE==WALINDEX_LOCK_OFFSET );\n#endif\n\n\n  /* Allocate an instance of struct Wal to return. */\n  *ppWal = 0;\n  pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile);\n  if( !pRet ){\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  pRet->pVfs = pVfs;\n  pRet->pWalFd = (sqlite3_file *)&pRet[1];\n  pRet->pDbFd = pDbFd;\n  pRet->readLock = -1;\n  pRet->mxWalSize = mxWalSize;\n  pRet->zWalName = zWalName;\n  pRet->syncHeader = 1;\n  pRet->padToSectorBoundary = 1;\n  pRet->exclusiveMode = (bNoShm ? WAL_HEAPMEMORY_MODE: WAL_NORMAL_MODE);\n\n  /* Open file handle on the write-ahead log file. */\n  flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_WAL);\n  rc = sqlite3OsOpen(pVfs, zWalName, pRet->pWalFd, flags, &flags);\n  if( rc==SQLITE_OK && flags&SQLITE_OPEN_READONLY ){\n    pRet->readOnly = WAL_RDONLY;\n  }\n\n  if( rc!=SQLITE_OK ){\n    walIndexClose(pRet, 0);\n    sqlite3OsClose(pRet->pWalFd);\n    sqlite3_free(pRet);\n  }else{\n    int iDC = sqlite3OsDeviceCharacteristics(pDbFd);\n    if( iDC & SQLITE_IOCAP_SEQUENTIAL ){ pRet->syncHeader = 0; }\n    if( iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE ){\n      pRet->padToSectorBoundary = 0;\n    }\n    *ppWal = pRet;\n    WALTRACE((\"WAL%d: opened\\n\", pRet));\n  }\n  return rc;\n}\n\n/*\n** Change the size to which the WAL file is trucated on each reset.\n*/\nvoid sqlite3WalLimit(Wal *pWal, i64 iLimit){\n  if( pWal ) pWal->mxWalSize = iLimit;\n}\n\n/*\n** Find the smallest page number out of all pages held in the WAL that\n** has not been returned by any prior invocation of this method on the\n** same WalIterator object.   Write into *piFrame the frame index where\n** that page was last written into the WAL.  Write into *piPage the page\n** number.\n**\n** Return 0 on success.  If there are no pages in the WAL with a page\n** number larger than *piPage, then return 1.\n*/\nstatic int walIteratorNext(\n  WalIterator *p,               /* Iterator */\n  u32 *piPage,                  /* OUT: The page number of the next page */\n  u32 *piFrame                  /* OUT: Wal frame index of next page */\n){\n  u32 iMin;                     /* Result pgno must be greater than iMin */\n  u32 iRet = 0xFFFFFFFF;        /* 0xffffffff is never a valid page number */\n  int i;                        /* For looping through segments */\n\n  iMin = p->iPrior;\n  assert( iMin<0xffffffff );\n  for(i=p->nSegment-1; i>=0; i--){\n    struct WalSegment *pSegment = &p->aSegment[i];\n    while( pSegment->iNext<pSegment->nEntry ){\n      u32 iPg = pSegment->aPgno[pSegment->aIndex[pSegment->iNext]];\n      if( iPg>iMin ){\n        if( iPg<iRet ){\n          iRet = iPg;\n          *piFrame = pSegment->iZero + pSegment->aIndex[pSegment->iNext];\n        }\n        break;\n      }\n      pSegment->iNext++;\n    }\n  }\n\n  *piPage = p->iPrior = iRet;\n  return (iRet==0xFFFFFFFF);\n}\n\n/*\n** This function merges two sorted lists into a single sorted list.\n**\n** aLeft[] and aRight[] are arrays of indices.  The sort key is\n** aContent[aLeft[]] and aContent[aRight[]].  Upon entry, the following\n** is guaranteed for all J<K:\n**\n**        aContent[aLeft[J]] < aContent[aLeft[K]]\n**        aContent[aRight[J]] < aContent[aRight[K]]\n**\n** This routine overwrites aRight[] with a new (probably longer) sequence\n** of indices such that the aRight[] contains every index that appears in\n** either aLeft[] or the old aRight[] and such that the second condition\n** above is still met.\n**\n** The aContent[aLeft[X]] values will be unique for all X.  And the\n** aContent[aRight[X]] values will be unique too.  But there might be\n** one or more combinations of X and Y such that\n**\n**      aLeft[X]!=aRight[Y]  &&  aContent[aLeft[X]] == aContent[aRight[Y]]\n**\n** When that happens, omit the aLeft[X] and use the aRight[Y] index.\n*/\nstatic void walMerge(\n  const u32 *aContent,            /* Pages in wal - keys for the sort */\n  ht_slot *aLeft,                 /* IN: Left hand input list */\n  int nLeft,                      /* IN: Elements in array *paLeft */\n  ht_slot **paRight,              /* IN/OUT: Right hand input list */\n  int *pnRight,                   /* IN/OUT: Elements in *paRight */\n  ht_slot *aTmp                   /* Temporary buffer */\n){\n  int iLeft = 0;                  /* Current index in aLeft */\n  int iRight = 0;                 /* Current index in aRight */\n  int iOut = 0;                   /* Current index in output buffer */\n  int nRight = *pnRight;\n  ht_slot *aRight = *paRight;\n\n  assert( nLeft>0 && nRight>0 );\n  while( iRight<nRight || iLeft<nLeft ){\n    ht_slot logpage;\n    Pgno dbpage;\n\n    if( (iLeft<nLeft) \n     && (iRight>=nRight || aContent[aLeft[iLeft]]<aContent[aRight[iRight]])\n    ){\n      logpage = aLeft[iLeft++];\n    }else{\n      logpage = aRight[iRight++];\n    }\n    dbpage = aContent[logpage];\n\n    aTmp[iOut++] = logpage;\n    if( iLeft<nLeft && aContent[aLeft[iLeft]]==dbpage ) iLeft++;\n\n    assert( iLeft>=nLeft || aContent[aLeft[iLeft]]>dbpage );\n    assert( iRight>=nRight || aContent[aRight[iRight]]>dbpage );\n  }\n\n  *paRight = aLeft;\n  *pnRight = iOut;\n  memcpy(aLeft, aTmp, sizeof(aTmp[0])*iOut);\n}\n\n/*\n** Sort the elements in list aList using aContent[] as the sort key.\n** Remove elements with duplicate keys, preferring to keep the\n** larger aList[] values.\n**\n** The aList[] entries are indices into aContent[].  The values in\n** aList[] are to be sorted so that for all J<K:\n**\n**      aContent[aList[J]] < aContent[aList[K]]\n**\n** For any X and Y such that\n**\n**      aContent[aList[X]] == aContent[aList[Y]]\n**\n** Keep the larger of the two values aList[X] and aList[Y] and discard\n** the smaller.\n*/\nstatic void walMergesort(\n  const u32 *aContent,            /* Pages in wal */\n  ht_slot *aBuffer,               /* Buffer of at least *pnList items to use */\n  ht_slot *aList,                 /* IN/OUT: List to sort */\n  int *pnList                     /* IN/OUT: Number of elements in aList[] */\n){\n  struct Sublist {\n    int nList;                    /* Number of elements in aList */\n    ht_slot *aList;               /* Pointer to sub-list content */\n  };\n\n  const int nList = *pnList;      /* Size of input list */\n  int nMerge = 0;                 /* Number of elements in list aMerge */\n  ht_slot *aMerge = 0;            /* List to be merged */\n  int iList;                      /* Index into input list */\n  u32 iSub = 0;                   /* Index into aSub array */\n  struct Sublist aSub[13];        /* Array of sub-lists */\n\n  memset(aSub, 0, sizeof(aSub));\n  assert( nList<=HASHTABLE_NPAGE && nList>0 );\n  assert( HASHTABLE_NPAGE==(1<<(ArraySize(aSub)-1)) );\n\n  for(iList=0; iList<nList; iList++){\n    nMerge = 1;\n    aMerge = &aList[iList];\n    for(iSub=0; iList & (1<<iSub); iSub++){\n      struct Sublist *p;\n      assert( iSub<ArraySize(aSub) );\n      p = &aSub[iSub];\n      assert( p->aList && p->nList<=(1<<iSub) );\n      assert( p->aList==&aList[iList&~((2<<iSub)-1)] );\n      walMerge(aContent, p->aList, p->nList, &aMerge, &nMerge, aBuffer);\n    }\n    aSub[iSub].aList = aMerge;\n    aSub[iSub].nList = nMerge;\n  }\n\n  for(iSub++; iSub<ArraySize(aSub); iSub++){\n    if( nList & (1<<iSub) ){\n      struct Sublist *p;\n      assert( iSub<ArraySize(aSub) );\n      p = &aSub[iSub];\n      assert( p->nList<=(1<<iSub) );\n      assert( p->aList==&aList[nList&~((2<<iSub)-1)] );\n      walMerge(aContent, p->aList, p->nList, &aMerge, &nMerge, aBuffer);\n    }\n  }\n  assert( aMerge==aList );\n  *pnList = nMerge;\n\n#ifdef SQLITE_DEBUG\n  {\n    int i;\n    for(i=1; i<*pnList; i++){\n      assert( aContent[aList[i]] > aContent[aList[i-1]] );\n    }\n  }\n#endif\n}\n\n/* \n** Free an iterator allocated by walIteratorInit().\n*/\nstatic void walIteratorFree(WalIterator *p){\n  sqlite3_free(p);\n}\n\n/*\n** Construct a WalInterator object that can be used to loop over all \n** pages in the WAL in ascending order. The caller must hold the checkpoint\n** lock.\n**\n** On success, make *pp point to the newly allocated WalInterator object\n** return SQLITE_OK. Otherwise, return an error code. If this routine\n** returns an error, the value of *pp is undefined.\n**\n** The calling routine should invoke walIteratorFree() to destroy the\n** WalIterator object when it has finished with it.\n*/\nstatic int walIteratorInit(Wal *pWal, WalIterator **pp){\n  WalIterator *p;                 /* Return value */\n  int nSegment;                   /* Number of segments to merge */\n  u32 iLast;                      /* Last frame in log */\n  int nByte;                      /* Number of bytes to allocate */\n  int i;                          /* Iterator variable */\n  ht_slot *aTmp;                  /* Temp space used by merge-sort */\n  int rc = SQLITE_OK;             /* Return Code */\n\n  /* This routine only runs while holding the checkpoint lock. And\n  ** it only runs if there is actually content in the log (mxFrame>0).\n  */\n  assert( pWal->ckptLock && pWal->hdr.mxFrame>0 );\n  iLast = pWal->hdr.mxFrame;\n\n  /* Allocate space for the WalIterator object. */\n  nSegment = walFramePage(iLast) + 1;\n  nByte = sizeof(WalIterator) \n        + (nSegment-1)*sizeof(struct WalSegment)\n        + iLast*sizeof(ht_slot);\n  p = (WalIterator *)sqlite3_malloc64(nByte);\n  if( !p ){\n    return SQLITE_NOMEM_BKPT;\n  }\n  memset(p, 0, nByte);\n  p->nSegment = nSegment;\n\n  /* Allocate temporary space used by the merge-sort routine. This block\n  ** of memory will be freed before this function returns.\n  */\n  aTmp = (ht_slot *)sqlite3_malloc64(\n      sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)\n  );\n  if( !aTmp ){\n    rc = SQLITE_NOMEM_BKPT;\n  }\n\n  for(i=0; rc==SQLITE_OK && i<nSegment; i++){\n    volatile ht_slot *aHash;\n    u32 iZero;\n    volatile u32 *aPgno;\n\n    rc = walHashGet(pWal, i, &aHash, &aPgno, &iZero);\n    if( rc==SQLITE_OK ){\n      int j;                      /* Counter variable */\n      int nEntry;                 /* Number of entries in this segment */\n      ht_slot *aIndex;            /* Sorted index for this segment */\n\n      aPgno++;\n      if( (i+1)==nSegment ){\n        nEntry = (int)(iLast - iZero);\n      }else{\n        nEntry = (int)((u32*)aHash - (u32*)aPgno);\n      }\n      aIndex = &((ht_slot *)&p->aSegment[p->nSegment])[iZero];\n      iZero++;\n  \n      for(j=0; j<nEntry; j++){\n        aIndex[j] = (ht_slot)j;\n      }\n      walMergesort((u32 *)aPgno, aTmp, aIndex, &nEntry);\n      p->aSegment[i].iZero = iZero;\n      p->aSegment[i].nEntry = nEntry;\n      p->aSegment[i].aIndex = aIndex;\n      p->aSegment[i].aPgno = (u32 *)aPgno;\n    }\n  }\n  sqlite3_free(aTmp);\n\n  if( rc!=SQLITE_OK ){\n    walIteratorFree(p);\n  }\n  *pp = p;\n  return rc;\n}\n\n/*\n** Attempt to obtain the exclusive WAL lock defined by parameters lockIdx and\n** n. If the attempt fails and parameter xBusy is not NULL, then it is a\n** busy-handler function. Invoke it and retry the lock until either the\n** lock is successfully obtained or the busy-handler returns 0.\n*/\nstatic int walBusyLock(\n  Wal *pWal,                      /* WAL connection */\n  int (*xBusy)(void*),            /* Function to call when busy */\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\n  int lockIdx,                    /* Offset of first byte to lock */\n  int n                           /* Number of bytes to lock */\n){\n  int rc;\n  do {\n    rc = walLockExclusive(pWal, lockIdx, n);\n  }while( xBusy && rc==SQLITE_BUSY && xBusy(pBusyArg) );\n  return rc;\n}\n\n/*\n** The cache of the wal-index header must be valid to call this function.\n** Return the page-size in bytes used by the database.\n*/\nstatic int walPagesize(Wal *pWal){\n  return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);\n}\n\n/*\n** The following is guaranteed when this function is called:\n**\n**   a) the WRITER lock is held,\n**   b) the entire log file has been checkpointed, and\n**   c) any existing readers are reading exclusively from the database\n**      file - there are no readers that may attempt to read a frame from\n**      the log file.\n**\n** This function updates the shared-memory structures so that the next\n** client to write to the database (which may be this one) does so by\n** writing frames into the start of the log file.\n**\n** The value of parameter salt1 is used as the aSalt[1] value in the \n** new wal-index header. It should be passed a pseudo-random value (i.e. \n** one obtained from sqlite3_randomness()).\n*/\nstatic void walRestartHdr(Wal *pWal, u32 salt1){\n  volatile WalCkptInfo *pInfo = walCkptInfo(pWal);\n  int i;                          /* Loop counter */\n  u32 *aSalt = pWal->hdr.aSalt;   /* Big-endian salt values */\n  pWal->nCkpt++;\n  pWal->hdr.mxFrame = 0;\n  sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0]));\n  memcpy(&pWal->hdr.aSalt[1], &salt1, 4);\n  walIndexWriteHdr(pWal);\n  pInfo->nBackfill = 0;\n  pInfo->nBackfillAttempted = 0;\n  pInfo->aReadMark[1] = 0;\n  for(i=2; i<WAL_NREADER; i++) pInfo->aReadMark[i] = READMARK_NOT_USED;\n  assert( pInfo->aReadMark[0]==0 );\n}\n\n/*\n** Copy as much content as we can from the WAL back into the database file\n** in response to an sqlite3_wal_checkpoint() request or the equivalent.\n**\n** The amount of information copies from WAL to database might be limited\n** by active readers.  This routine will never overwrite a database page\n** that a concurrent reader might be using.\n**\n** All I/O barrier operations (a.k.a fsyncs) occur in this routine when\n** SQLite is in WAL-mode in synchronous=NORMAL.  That means that if \n** checkpoints are always run by a background thread or background \n** process, foreground threads will never block on a lengthy fsync call.\n**\n** Fsync is called on the WAL before writing content out of the WAL and\n** into the database.  This ensures that if the new content is persistent\n** in the WAL and can be recovered following a power-loss or hard reset.\n**\n** Fsync is also called on the database file if (and only if) the entire\n** WAL content is copied into the database file.  This second fsync makes\n** it safe to delete the WAL since the new content will persist in the\n** database file.\n**\n** This routine uses and updates the nBackfill field of the wal-index header.\n** This is the only routine that will increase the value of nBackfill.  \n** (A WAL reset or recovery will revert nBackfill to zero, but not increase\n** its value.)\n**\n** The caller must be holding sufficient locks to ensure that no other\n** checkpoint is running (in any other thread or process) at the same\n** time.\n*/\nstatic int walCheckpoint(\n  Wal *pWal,                      /* Wal connection */\n  int eMode,                      /* One of PASSIVE, FULL or RESTART */\n  int (*xBusy)(void*),            /* Function to call when busy */\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\n  int sync_flags,                 /* Flags for OsSync() (or 0) */\n  u8 *zBuf                        /* Temporary buffer to use */\n){\n  int rc = SQLITE_OK;             /* Return code */\n  int szPage;                     /* Database page-size */\n  WalIterator *pIter = 0;         /* Wal iterator context */\n  u32 iDbpage = 0;                /* Next database page to write */\n  u32 iFrame = 0;                 /* Wal frame containing data for iDbpage */\n  u32 mxSafeFrame;                /* Max frame that can be backfilled */\n  u32 mxPage;                     /* Max database page to write */\n  int i;                          /* Loop counter */\n  volatile WalCkptInfo *pInfo;    /* The checkpoint status information */\n\n  szPage = walPagesize(pWal);\n  testcase( szPage<=32768 );\n  testcase( szPage>=65536 );\n  pInfo = walCkptInfo(pWal);\n  if( pInfo->nBackfill<pWal->hdr.mxFrame ){\n\n    /* Allocate the iterator */\n    rc = walIteratorInit(pWal, &pIter);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    assert( pIter );\n\n    /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked\n    ** in the SQLITE_CHECKPOINT_PASSIVE mode. */\n    assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );\n\n    /* Compute in mxSafeFrame the index of the last frame of the WAL that is\n    ** safe to write into the database.  Frames beyond mxSafeFrame might\n    ** overwrite database pages that are in use by active readers and thus\n    ** cannot be backfilled from the WAL.\n    */\n    mxSafeFrame = pWal->hdr.mxFrame;\n    mxPage = pWal->hdr.nPage;\n    for(i=1; i<WAL_NREADER; i++){\n      /* Thread-sanitizer reports that the following is an unsafe read,\n      ** as some other thread may be in the process of updating the value\n      ** of the aReadMark[] slot. The assumption here is that if that is\n      ** happening, the other client may only be increasing the value,\n      ** not decreasing it. So assuming either that either the \"old\" or\n      ** \"new\" version of the value is read, and not some arbitrary value\n      ** that would never be written by a real client, things are still \n      ** safe.  */\n      u32 y = pInfo->aReadMark[i];\n      if( mxSafeFrame>y ){\n        assert( y<=pWal->hdr.mxFrame );\n        rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1);\n        if( rc==SQLITE_OK ){\n          pInfo->aReadMark[i] = (i==1 ? mxSafeFrame : READMARK_NOT_USED);\n          walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);\n        }else if( rc==SQLITE_BUSY ){\n          mxSafeFrame = y;\n          xBusy = 0;\n        }else{\n          goto walcheckpoint_out;\n        }\n      }\n    }\n\n    if( pInfo->nBackfill<mxSafeFrame\n     && (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK\n    ){\n      i64 nSize;                    /* Current size of database file */\n      u32 nBackfill = pInfo->nBackfill;\n\n      pInfo->nBackfillAttempted = mxSafeFrame;\n\n      /* Sync the WAL to disk */\n      if( sync_flags ){\n        rc = sqlite3OsSync(pWal->pWalFd, sync_flags);\n      }\n\n      /* If the database may grow as a result of this checkpoint, hint\n      ** about the eventual size of the db file to the VFS layer.\n      */\n      if( rc==SQLITE_OK ){\n        i64 nReq = ((i64)mxPage * szPage);\n        rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);\n        if( rc==SQLITE_OK && nSize<nReq ){\n          sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);\n        }\n      }\n\n      /* Iterate through the contents of the WAL, copying data to the db file */\n      while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){\n        i64 iOffset;\n        assert( walFramePgno(pWal, iFrame)==iDbpage );\n        if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){\n          continue;\n        }\n        iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE;\n        /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */\n        rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset);\n        if( rc!=SQLITE_OK ) break;\n        iOffset = (iDbpage-1)*(i64)szPage;\n        testcase( IS_BIG_INT(iOffset) );\n        rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset);\n        if( rc!=SQLITE_OK ) break;\n      }\n\n      /* If work was actually accomplished... */\n      if( rc==SQLITE_OK ){\n        if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){\n          i64 szDb = pWal->hdr.nPage*(i64)szPage;\n          testcase( IS_BIG_INT(szDb) );\n          rc = sqlite3OsTruncate(pWal->pDbFd, szDb);\n          if( rc==SQLITE_OK && sync_flags ){\n            rc = sqlite3OsSync(pWal->pDbFd, sync_flags);\n          }\n        }\n        if( rc==SQLITE_OK ){\n          pInfo->nBackfill = mxSafeFrame;\n        }\n      }\n\n      /* Release the reader lock held while backfilling */\n      walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1);\n    }\n\n    if( rc==SQLITE_BUSY ){\n      /* Reset the return code so as not to report a checkpoint failure\n      ** just because there are active readers.  */\n      rc = SQLITE_OK;\n    }\n  }\n\n  /* If this is an SQLITE_CHECKPOINT_RESTART or TRUNCATE operation, and the\n  ** entire wal file has been copied into the database file, then block \n  ** until all readers have finished using the wal file. This ensures that \n  ** the next process to write to the database restarts the wal file.\n  */\n  if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){\n    assert( pWal->writeLock );\n    if( pInfo->nBackfill<pWal->hdr.mxFrame ){\n      rc = SQLITE_BUSY;\n    }else if( eMode>=SQLITE_CHECKPOINT_RESTART ){\n      u32 salt1;\n      sqlite3_randomness(4, &salt1);\n      assert( pInfo->nBackfill==pWal->hdr.mxFrame );\n      rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);\n      if( rc==SQLITE_OK ){\n        if( eMode==SQLITE_CHECKPOINT_TRUNCATE ){\n          /* IMPLEMENTATION-OF: R-44699-57140 This mode works the same way as\n          ** SQLITE_CHECKPOINT_RESTART with the addition that it also\n          ** truncates the log file to zero bytes just prior to a\n          ** successful return.\n          **\n          ** In theory, it might be safe to do this without updating the\n          ** wal-index header in shared memory, as all subsequent reader or\n          ** writer clients should see that the entire log file has been\n          ** checkpointed and behave accordingly. This seems unsafe though,\n          ** as it would leave the system in a state where the contents of\n          ** the wal-index header do not match the contents of the \n          ** file-system. To avoid this, update the wal-index header to\n          ** indicate that the log file contains zero valid frames.  */\n          walRestartHdr(pWal, salt1);\n          rc = sqlite3OsTruncate(pWal->pWalFd, 0);\n        }\n        walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);\n      }\n    }\n  }\n\n walcheckpoint_out:\n  walIteratorFree(pIter);\n  return rc;\n}\n\n/*\n** If the WAL file is currently larger than nMax bytes in size, truncate\n** it to exactly nMax bytes. If an error occurs while doing so, ignore it.\n*/\nstatic void walLimitSize(Wal *pWal, i64 nMax){\n  i64 sz;\n  int rx;\n  sqlite3BeginBenignMalloc();\n  rx = sqlite3OsFileSize(pWal->pWalFd, &sz);\n  if( rx==SQLITE_OK && (sz > nMax ) ){\n    rx = sqlite3OsTruncate(pWal->pWalFd, nMax);\n  }\n  sqlite3EndBenignMalloc();\n  if( rx ){\n    sqlite3_log(rx, \"cannot limit WAL size: %s\", pWal->zWalName);\n  }\n}\n\n/*\n** Close a connection to a log file.\n*/\nint sqlite3WalClose(\n  Wal *pWal,                      /* Wal to close */\n  int sync_flags,                 /* Flags to pass to OsSync() (or 0) */\n  int nBuf,\n  u8 *zBuf                        /* Buffer of at least nBuf bytes */\n){\n  int rc = SQLITE_OK;\n  if( pWal ){\n    int isDelete = 0;             /* True to unlink wal and wal-index files */\n\n    /* If an EXCLUSIVE lock can be obtained on the database file (using the\n    ** ordinary, rollback-mode locking methods, this guarantees that the\n    ** connection associated with this log file is the only connection to\n    ** the database. In this case checkpoint the database and unlink both\n    ** the wal and wal-index files.\n    **\n    ** The EXCLUSIVE lock is not released before returning.\n    */\n    rc = sqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE);\n    if( rc==SQLITE_OK ){\n      if( pWal->exclusiveMode==WAL_NORMAL_MODE ){\n        pWal->exclusiveMode = WAL_EXCLUSIVE_MODE;\n      }\n      rc = sqlite3WalCheckpoint(\n          pWal, SQLITE_CHECKPOINT_PASSIVE, 0, 0, sync_flags, nBuf, zBuf, 0, 0\n      );\n      if( rc==SQLITE_OK ){\n        int bPersist = -1;\n        sqlite3OsFileControlHint(\n            pWal->pDbFd, SQLITE_FCNTL_PERSIST_WAL, &bPersist\n        );\n        if( bPersist!=1 ){\n          /* Try to delete the WAL file if the checkpoint completed and\n          ** fsyned (rc==SQLITE_OK) and if we are not in persistent-wal\n          ** mode (!bPersist) */\n          isDelete = 1;\n        }else if( pWal->mxWalSize>=0 ){\n          /* Try to truncate the WAL file to zero bytes if the checkpoint\n          ** completed and fsynced (rc==SQLITE_OK) and we are in persistent\n          ** WAL mode (bPersist) and if the PRAGMA journal_size_limit is a\n          ** non-negative value (pWal->mxWalSize>=0).  Note that we truncate\n          ** to zero bytes as truncating to the journal_size_limit might\n          ** leave a corrupt WAL file on disk. */\n          walLimitSize(pWal, 0);\n        }\n      }\n    }\n\n    walIndexClose(pWal, isDelete);\n    sqlite3OsClose(pWal->pWalFd);\n    if( isDelete ){\n      sqlite3BeginBenignMalloc();\n      sqlite3OsDelete(pWal->pVfs, pWal->zWalName, 0);\n      sqlite3EndBenignMalloc();\n    }\n    WALTRACE((\"WAL%p: closed\\n\", pWal));\n    sqlite3_free((void *)pWal->apWiData);\n    sqlite3_free(pWal);\n  }\n  return rc;\n}\n\n/*\n** Try to read the wal-index header.  Return 0 on success and 1 if\n** there is a problem.\n**\n** The wal-index is in shared memory.  Another thread or process might\n** be writing the header at the same time this procedure is trying to\n** read it, which might result in inconsistency.  A dirty read is detected\n** by verifying that both copies of the header are the same and also by\n** a checksum on the header.\n**\n** If and only if the read is consistent and the header is different from\n** pWal->hdr, then pWal->hdr is updated to the content of the new header\n** and *pChanged is set to 1.\n**\n** If the checksum cannot be verified return non-zero. If the header\n** is read successfully and the checksum verified, return zero.\n*/\nstatic int walIndexTryHdr(Wal *pWal, int *pChanged){\n  u32 aCksum[2];                  /* Checksum on the header content */\n  WalIndexHdr h1, h2;             /* Two copies of the header content */\n  WalIndexHdr volatile *aHdr;     /* Header in shared memory */\n\n  /* The first page of the wal-index must be mapped at this point. */\n  assert( pWal->nWiData>0 && pWal->apWiData[0] );\n\n  /* Read the header. This might happen concurrently with a write to the\n  ** same area of shared memory on a different CPU in a SMP,\n  ** meaning it is possible that an inconsistent snapshot is read\n  ** from the file. If this happens, return non-zero.\n  **\n  ** There are two copies of the header at the beginning of the wal-index.\n  ** When reading, read [0] first then [1].  Writes are in the reverse order.\n  ** Memory barriers are used to prevent the compiler or the hardware from\n  ** reordering the reads and writes.\n  */\n  aHdr = walIndexHdr(pWal);\n  memcpy(&h1, (void *)&aHdr[0], sizeof(h1));\n  walShmBarrier(pWal);\n  memcpy(&h2, (void *)&aHdr[1], sizeof(h2));\n\n  if( memcmp(&h1, &h2, sizeof(h1))!=0 ){\n    return 1;   /* Dirty read */\n  }  \n  if( h1.isInit==0 ){\n    return 1;   /* Malformed header - probably all zeros */\n  }\n  walChecksumBytes(1, (u8*)&h1, sizeof(h1)-sizeof(h1.aCksum), 0, aCksum);\n  if( aCksum[0]!=h1.aCksum[0] || aCksum[1]!=h1.aCksum[1] ){\n    return 1;   /* Checksum does not match */\n  }\n\n  if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){\n    *pChanged = 1;\n    memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr));\n    pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16);\n    testcase( pWal->szPage<=32768 );\n    testcase( pWal->szPage>=65536 );\n  }\n\n  /* The header was successfully read. Return zero. */\n  return 0;\n}\n\n/*\n** Read the wal-index header from the wal-index and into pWal->hdr.\n** If the wal-header appears to be corrupt, try to reconstruct the\n** wal-index from the WAL before returning.\n**\n** Set *pChanged to 1 if the wal-index header value in pWal->hdr is\n** changed by this operation.  If pWal->hdr is unchanged, set *pChanged\n** to 0.\n**\n** If the wal-index header is successfully read, return SQLITE_OK. \n** Otherwise an SQLite error code.\n*/\nstatic int walIndexReadHdr(Wal *pWal, int *pChanged){\n  int rc;                         /* Return code */\n  int badHdr;                     /* True if a header read failed */\n  volatile u32 *page0;            /* Chunk of wal-index containing header */\n\n  /* Ensure that page 0 of the wal-index (the page that contains the \n  ** wal-index header) is mapped. Return early if an error occurs here.\n  */\n  assert( pChanged );\n  rc = walIndexPage(pWal, 0, &page0);\n  if( rc!=SQLITE_OK ){\n    return rc;\n  };\n  assert( page0 || pWal->writeLock==0 );\n\n  /* If the first page of the wal-index has been mapped, try to read the\n  ** wal-index header immediately, without holding any lock. This usually\n  ** works, but may fail if the wal-index header is corrupt or currently \n  ** being modified by another thread or process.\n  */\n  badHdr = (page0 ? walIndexTryHdr(pWal, pChanged) : 1);\n\n  /* If the first attempt failed, it might have been due to a race\n  ** with a writer.  So get a WRITE lock and try again.\n  */\n  assert( badHdr==0 || pWal->writeLock==0 );\n  if( badHdr ){\n    if( pWal->readOnly & WAL_SHM_RDONLY ){\n      if( SQLITE_OK==(rc = walLockShared(pWal, WAL_WRITE_LOCK)) ){\n        walUnlockShared(pWal, WAL_WRITE_LOCK);\n        rc = SQLITE_READONLY_RECOVERY;\n      }\n    }else if( SQLITE_OK==(rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1)) ){\n      pWal->writeLock = 1;\n      if( SQLITE_OK==(rc = walIndexPage(pWal, 0, &page0)) ){\n        badHdr = walIndexTryHdr(pWal, pChanged);\n        if( badHdr ){\n          /* If the wal-index header is still malformed even while holding\n          ** a WRITE lock, it can only mean that the header is corrupted and\n          ** needs to be reconstructed.  So run recovery to do exactly that.\n          */\n          rc = walIndexRecover(pWal);\n          *pChanged = 1;\n        }\n      }\n      pWal->writeLock = 0;\n      walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);\n    }\n  }\n\n  /* If the header is read successfully, check the version number to make\n  ** sure the wal-index was not constructed with some future format that\n  ** this version of SQLite cannot understand.\n  */\n  if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){\n    rc = SQLITE_CANTOPEN_BKPT;\n  }\n\n  return rc;\n}\n\n/*\n** This is the value that walTryBeginRead returns when it needs to\n** be retried.\n*/\n#define WAL_RETRY  (-1)\n\n/*\n** Attempt to start a read transaction.  This might fail due to a race or\n** other transient condition.  When that happens, it returns WAL_RETRY to\n** indicate to the caller that it is safe to retry immediately.\n**\n** On success return SQLITE_OK.  On a permanent failure (such an\n** I/O error or an SQLITE_BUSY because another process is running\n** recovery) return a positive error code.\n**\n** The useWal parameter is true to force the use of the WAL and disable\n** the case where the WAL is bypassed because it has been completely\n** checkpointed.  If useWal==0 then this routine calls walIndexReadHdr() \n** to make a copy of the wal-index header into pWal->hdr.  If the \n** wal-index header has changed, *pChanged is set to 1 (as an indication \n** to the caller that the local paget cache is obsolete and needs to be \n** flushed.)  When useWal==1, the wal-index header is assumed to already\n** be loaded and the pChanged parameter is unused.\n**\n** The caller must set the cnt parameter to the number of prior calls to\n** this routine during the current read attempt that returned WAL_RETRY.\n** This routine will start taking more aggressive measures to clear the\n** race conditions after multiple WAL_RETRY returns, and after an excessive\n** number of errors will ultimately return SQLITE_PROTOCOL.  The\n** SQLITE_PROTOCOL return indicates that some other process has gone rogue\n** and is not honoring the locking protocol.  There is a vanishingly small\n** chance that SQLITE_PROTOCOL could be returned because of a run of really\n** bad luck when there is lots of contention for the wal-index, but that\n** possibility is so small that it can be safely neglected, we believe.\n**\n** On success, this routine obtains a read lock on \n** WAL_READ_LOCK(pWal->readLock).  The pWal->readLock integer is\n** in the range 0 <= pWal->readLock < WAL_NREADER.  If pWal->readLock==(-1)\n** that means the Wal does not hold any read lock.  The reader must not\n** access any database page that is modified by a WAL frame up to and\n** including frame number aReadMark[pWal->readLock].  The reader will\n** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0\n** Or if pWal->readLock==0, then the reader will ignore the WAL\n** completely and get all content directly from the database file.\n** If the useWal parameter is 1 then the WAL will never be ignored and\n** this routine will always set pWal->readLock>0 on success.\n** When the read transaction is completed, the caller must release the\n** lock on WAL_READ_LOCK(pWal->readLock) and set pWal->readLock to -1.\n**\n** This routine uses the nBackfill and aReadMark[] fields of the header\n** to select a particular WAL_READ_LOCK() that strives to let the\n** checkpoint process do as much work as possible.  This routine might\n** update values of the aReadMark[] array in the header, but if it does\n** so it takes care to hold an exclusive lock on the corresponding\n** WAL_READ_LOCK() while changing values.\n*/\nstatic int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){\n  volatile WalCkptInfo *pInfo;    /* Checkpoint information in wal-index */\n  u32 mxReadMark;                 /* Largest aReadMark[] value */\n  int mxI;                        /* Index of largest aReadMark[] value */\n  int i;                          /* Loop counter */\n  int rc = SQLITE_OK;             /* Return code  */\n  u32 mxFrame;                    /* Wal frame to lock to */\n\n  assert( pWal->readLock<0 );     /* Not currently locked */\n\n  /* Take steps to avoid spinning forever if there is a protocol error.\n  **\n  ** Circumstances that cause a RETRY should only last for the briefest\n  ** instances of time.  No I/O or other system calls are done while the\n  ** locks are held, so the locks should not be held for very long. But \n  ** if we are unlucky, another process that is holding a lock might get\n  ** paged out or take a page-fault that is time-consuming to resolve, \n  ** during the few nanoseconds that it is holding the lock.  In that case,\n  ** it might take longer than normal for the lock to free.\n  **\n  ** After 5 RETRYs, we begin calling sqlite3OsSleep().  The first few\n  ** calls to sqlite3OsSleep() have a delay of 1 microsecond.  Really this\n  ** is more of a scheduler yield than an actual delay.  But on the 10th\n  ** an subsequent retries, the delays start becoming longer and longer, \n  ** so that on the 100th (and last) RETRY we delay for 323 milliseconds.\n  ** The total delay time before giving up is less than 10 seconds.\n  */\n  if( cnt>5 ){\n    int nDelay = 1;                      /* Pause time in microseconds */\n    if( cnt>100 ){\n      VVA_ONLY( pWal->lockError = 1; )\n      return SQLITE_PROTOCOL;\n    }\n    if( cnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39;\n    sqlite3OsSleep(pWal->pVfs, nDelay);\n  }\n\n  if( !useWal ){\n    rc = walIndexReadHdr(pWal, pChanged);\n    if( rc==SQLITE_BUSY ){\n      /* If there is not a recovery running in another thread or process\n      ** then convert BUSY errors to WAL_RETRY.  If recovery is known to\n      ** be running, convert BUSY to BUSY_RECOVERY.  There is a race here\n      ** which might cause WAL_RETRY to be returned even if BUSY_RECOVERY\n      ** would be technically correct.  But the race is benign since with\n      ** WAL_RETRY this routine will be called again and will probably be\n      ** right on the second iteration.\n      */\n      if( pWal->apWiData[0]==0 ){\n        /* This branch is taken when the xShmMap() method returns SQLITE_BUSY.\n        ** We assume this is a transient condition, so return WAL_RETRY. The\n        ** xShmMap() implementation used by the default unix and win32 VFS \n        ** modules may return SQLITE_BUSY due to a race condition in the \n        ** code that determines whether or not the shared-memory region \n        ** must be zeroed before the requested page is returned.\n        */\n        rc = WAL_RETRY;\n      }else if( SQLITE_OK==(rc = walLockShared(pWal, WAL_RECOVER_LOCK)) ){\n        walUnlockShared(pWal, WAL_RECOVER_LOCK);\n        rc = WAL_RETRY;\n      }else if( rc==SQLITE_BUSY ){\n        rc = SQLITE_BUSY_RECOVERY;\n      }\n    }\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n  }\n\n  pInfo = walCkptInfo(pWal);\n  if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame \n#ifdef SQLITE_ENABLE_SNAPSHOT\n   && (pWal->pSnapshot==0 || pWal->hdr.mxFrame==0\n     || 0==memcmp(&pWal->hdr, pWal->pSnapshot, sizeof(WalIndexHdr)))\n#endif\n  ){\n    /* The WAL has been completely backfilled (or it is empty).\n    ** and can be safely ignored.\n    */\n    rc = walLockShared(pWal, WAL_READ_LOCK(0));\n    walShmBarrier(pWal);\n    if( rc==SQLITE_OK ){\n      if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){\n        /* It is not safe to allow the reader to continue here if frames\n        ** may have been appended to the log before READ_LOCK(0) was obtained.\n        ** When holding READ_LOCK(0), the reader ignores the entire log file,\n        ** which implies that the database file contains a trustworthy\n        ** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from\n        ** happening, this is usually correct.\n        **\n        ** However, if frames have been appended to the log (or if the log \n        ** is wrapped and written for that matter) before the READ_LOCK(0)\n        ** is obtained, that is not necessarily true. A checkpointer may\n        ** have started to backfill the appended frames but crashed before\n        ** it finished. Leaving a corrupt image in the database file.\n        */\n        walUnlockShared(pWal, WAL_READ_LOCK(0));\n        return WAL_RETRY;\n      }\n      pWal->readLock = 0;\n      return SQLITE_OK;\n    }else if( rc!=SQLITE_BUSY ){\n      return rc;\n    }\n  }\n\n  /* If we get this far, it means that the reader will want to use\n  ** the WAL to get at content from recent commits.  The job now is\n  ** to select one of the aReadMark[] entries that is closest to\n  ** but not exceeding pWal->hdr.mxFrame and lock that entry.\n  */\n  mxReadMark = 0;\n  mxI = 0;\n  mxFrame = pWal->hdr.mxFrame;\n#ifdef SQLITE_ENABLE_SNAPSHOT\n  if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){\n    mxFrame = pWal->pSnapshot->mxFrame;\n  }\n#endif\n  for(i=1; i<WAL_NREADER; i++){\n    u32 thisMark = pInfo->aReadMark[i];\n    if( mxReadMark<=thisMark && thisMark<=mxFrame ){\n      assert( thisMark!=READMARK_NOT_USED );\n      mxReadMark = thisMark;\n      mxI = i;\n    }\n  }\n  if( (pWal->readOnly & WAL_SHM_RDONLY)==0\n   && (mxReadMark<mxFrame || mxI==0)\n  ){\n    for(i=1; i<WAL_NREADER; i++){\n#if SQLITE_WCDB_SIGNAL_RETRY\n      int bWait = WCDBOsFileGetWait(pWal->pDbFd);\n      WCDBOsFileSetWait(pWal->pDbFd, 0);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n      rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1);\n#if SQLITE_WCDB_SIGNAL_RETRY\n      WCDBOsFileSetWait(pWal->pDbFd, bWait);\n#endif// SQLITE_WCDB_SIGNAL_RETRY\n      if( rc==SQLITE_OK ){\n        mxReadMark = pInfo->aReadMark[i] = mxFrame;\n        mxI = i;\n        walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1);\n        break;\n      }else if( rc!=SQLITE_BUSY ){\n        return rc;\n      }\n    }\n  }\n  if( mxI==0 ){\n    assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 );\n    return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTLOCK;\n  }\n\n  rc = walLockShared(pWal, WAL_READ_LOCK(mxI));\n  if( rc ){\n    return rc==SQLITE_BUSY ? WAL_RETRY : rc;\n  }\n  /* Now that the read-lock has been obtained, check that neither the\n  ** value in the aReadMark[] array or the contents of the wal-index\n  ** header have changed.\n  **\n  ** It is necessary to check that the wal-index header did not change\n  ** between the time it was read and when the shared-lock was obtained\n  ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility\n  ** that the log file may have been wrapped by a writer, or that frames\n  ** that occur later in the log than pWal->hdr.mxFrame may have been\n  ** copied into the database by a checkpointer. If either of these things\n  ** happened, then reading the database with the current value of\n  ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry\n  ** instead.\n  **\n  ** Before checking that the live wal-index header has not changed\n  ** since it was read, set Wal.minFrame to the first frame in the wal\n  ** file that has not yet been checkpointed. This client will not need\n  ** to read any frames earlier than minFrame from the wal file - they\n  ** can be safely read directly from the database file.\n  **\n  ** Because a ShmBarrier() call is made between taking the copy of \n  ** nBackfill and checking that the wal-header in shared-memory still\n  ** matches the one cached in pWal->hdr, it is guaranteed that the \n  ** checkpointer that set nBackfill was not working with a wal-index\n  ** header newer than that cached in pWal->hdr. If it were, that could\n  ** cause a problem. The checkpointer could omit to checkpoint\n  ** a version of page X that lies before pWal->minFrame (call that version\n  ** A) on the basis that there is a newer version (version B) of the same\n  ** page later in the wal file. But if version B happens to like past\n  ** frame pWal->hdr.mxFrame - then the client would incorrectly assume\n  ** that it can read version A from the database file. However, since\n  ** we can guarantee that the checkpointer that set nBackfill could not\n  ** see any pages past pWal->hdr.mxFrame, this problem does not come up.\n  */\n  pWal->minFrame = pInfo->nBackfill+1;\n  walShmBarrier(pWal);\n  if( pInfo->aReadMark[mxI]!=mxReadMark\n   || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))\n  ){\n    walUnlockShared(pWal, WAL_READ_LOCK(mxI));\n    return WAL_RETRY;\n  }else{\n    assert( mxReadMark<=pWal->hdr.mxFrame );\n    pWal->readLock = (i16)mxI;\n  }\n  return rc;\n}\n\n/*\n** Begin a read transaction on the database.\n**\n** This routine used to be called sqlite3OpenSnapshot() and with good reason:\n** it takes a snapshot of the state of the WAL and wal-index for the current\n** instant in time.  The current thread will continue to use this snapshot.\n** Other threads might append new content to the WAL and wal-index but\n** that extra content is ignored by the current thread.\n**\n** If the database contents have changes since the previous read\n** transaction, then *pChanged is set to 1 before returning.  The\n** Pager layer will use this to know that is cache is stale and\n** needs to be flushed.\n*/\nint sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){\n  int rc;                         /* Return code */\n  int cnt = 0;                    /* Number of TryBeginRead attempts */\n\n#ifdef SQLITE_ENABLE_SNAPSHOT\n  int bChanged = 0;\n  WalIndexHdr *pSnapshot = pWal->pSnapshot;\n  if( pSnapshot && memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){\n    bChanged = 1;\n  }\n#endif\n\n  do{\n    rc = walTryBeginRead(pWal, pChanged, 0, ++cnt);\n  }while( rc==WAL_RETRY );\n  testcase( (rc&0xff)==SQLITE_BUSY );\n  testcase( (rc&0xff)==SQLITE_IOERR );\n  testcase( rc==SQLITE_PROTOCOL );\n  testcase( rc==SQLITE_OK );\n\n#ifdef SQLITE_ENABLE_SNAPSHOT\n  if( rc==SQLITE_OK ){\n    if( pSnapshot && memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){\n      /* At this point the client has a lock on an aReadMark[] slot holding\n      ** a value equal to or smaller than pSnapshot->mxFrame, but pWal->hdr\n      ** is populated with the wal-index header corresponding to the head\n      ** of the wal file. Verify that pSnapshot is still valid before\n      ** continuing.  Reasons why pSnapshot might no longer be valid:\n      **\n      **    (1)  The WAL file has been reset since the snapshot was taken.\n      **         In this case, the salt will have changed.\n      **\n      **    (2)  A checkpoint as been attempted that wrote frames past\n      **         pSnapshot->mxFrame into the database file.  Note that the\n      **         checkpoint need not have completed for this to cause problems.\n      */\n      volatile WalCkptInfo *pInfo = walCkptInfo(pWal);\n\n      assert( pWal->readLock>0 || pWal->hdr.mxFrame==0 );\n      assert( pInfo->aReadMark[pWal->readLock]<=pSnapshot->mxFrame );\n\n      /* It is possible that there is a checkpointer thread running \n      ** concurrent with this code. If this is the case, it may be that the\n      ** checkpointer has already determined that it will checkpoint \n      ** snapshot X, where X is later in the wal file than pSnapshot, but \n      ** has not yet set the pInfo->nBackfillAttempted variable to indicate \n      ** its intent. To avoid the race condition this leads to, ensure that\n      ** there is no checkpointer process by taking a shared CKPT lock \n      ** before checking pInfo->nBackfillAttempted.  */\n      rc = walLockShared(pWal, WAL_CKPT_LOCK);\n\n      if( rc==SQLITE_OK ){\n        /* Check that the wal file has not been wrapped. Assuming that it has\n        ** not, also check that no checkpointer has attempted to checkpoint any\n        ** frames beyond pSnapshot->mxFrame. If either of these conditions are\n        ** true, return SQLITE_BUSY_SNAPSHOT. Otherwise, overwrite pWal->hdr\n        ** with *pSnapshot and set *pChanged as appropriate for opening the\n        ** snapshot.  */\n        if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt))\n         && pSnapshot->mxFrame>=pInfo->nBackfillAttempted\n        ){\n          assert( pWal->readLock>0 );\n          memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr));\n          *pChanged = bChanged;\n        }else{\n          rc = SQLITE_BUSY_SNAPSHOT;\n        }\n\n        /* Release the shared CKPT lock obtained above. */\n        walUnlockShared(pWal, WAL_CKPT_LOCK);\n      }\n\n\n      if( rc!=SQLITE_OK ){\n        sqlite3WalEndReadTransaction(pWal);\n      }\n    }\n  }\n#endif\n  return rc;\n}\n\n/*\n** Finish with a read transaction.  All this does is release the\n** read-lock.\n*/\nvoid sqlite3WalEndReadTransaction(Wal *pWal){\n  sqlite3WalEndWriteTransaction(pWal);\n  if( pWal->readLock>=0 ){\n    walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));\n    pWal->readLock = -1;\n  }\n}\n\n/*\n** Search the wal file for page pgno. If found, set *piRead to the frame that\n** contains the page. Otherwise, if pgno is not in the wal file, set *piRead\n** to zero.\n**\n** Return SQLITE_OK if successful, or an error code if an error occurs. If an\n** error does occur, the final value of *piRead is undefined.\n*/\nint sqlite3WalFindFrame(\n  Wal *pWal,                      /* WAL handle */\n  Pgno pgno,                      /* Database page number to read data for */\n  u32 *piRead                     /* OUT: Frame number (or zero) */\n){\n  u32 iRead = 0;                  /* If !=0, WAL frame to return data from */\n  u32 iLast = pWal->hdr.mxFrame;  /* Last page in WAL for this reader */\n  int iHash;                      /* Used to loop through N hash tables */\n  int iMinHash;\n\n  /* This routine is only be called from within a read transaction. */\n  assert( pWal->readLock>=0 || pWal->lockError );\n\n  /* If the \"last page\" field of the wal-index header snapshot is 0, then\n  ** no data will be read from the wal under any circumstances. Return early\n  ** in this case as an optimization.  Likewise, if pWal->readLock==0, \n  ** then the WAL is ignored by the reader so return early, as if the \n  ** WAL were empty.\n  */\n  if( iLast==0 || pWal->readLock==0 ){\n    *piRead = 0;\n    return SQLITE_OK;\n  }\n\n  /* Search the hash table or tables for an entry matching page number\n  ** pgno. Each iteration of the following for() loop searches one\n  ** hash table (each hash table indexes up to HASHTABLE_NPAGE frames).\n  **\n  ** This code might run concurrently to the code in walIndexAppend()\n  ** that adds entries to the wal-index (and possibly to this hash \n  ** table). This means the value just read from the hash \n  ** slot (aHash[iKey]) may have been added before or after the \n  ** current read transaction was opened. Values added after the\n  ** read transaction was opened may have been written incorrectly -\n  ** i.e. these slots may contain garbage data. However, we assume\n  ** that any slots written before the current read transaction was\n  ** opened remain unmodified.\n  **\n  ** For the reasons above, the if(...) condition featured in the inner\n  ** loop of the following block is more stringent that would be required \n  ** if we had exclusive access to the hash-table:\n  **\n  **   (aPgno[iFrame]==pgno): \n  **     This condition filters out normal hash-table collisions.\n  **\n  **   (iFrame<=iLast): \n  **     This condition filters out entries that were added to the hash\n  **     table after the current read-transaction had started.\n  */\n  iMinHash = walFramePage(pWal->minFrame);\n  for(iHash=walFramePage(iLast); iHash>=iMinHash && iRead==0; iHash--){\n    volatile ht_slot *aHash;      /* Pointer to hash table */\n    volatile u32 *aPgno;          /* Pointer to array of page numbers */\n    u32 iZero;                    /* Frame number corresponding to aPgno[0] */\n    int iKey;                     /* Hash slot index */\n    int nCollide;                 /* Number of hash collisions remaining */\n    int rc;                       /* Error code */\n\n    rc = walHashGet(pWal, iHash, &aHash, &aPgno, &iZero);\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n    nCollide = HASHTABLE_NSLOT;\n    for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){\n      u32 iFrame = aHash[iKey] + iZero;\n      if( iFrame<=iLast && iFrame>=pWal->minFrame && aPgno[aHash[iKey]]==pgno ){\n        assert( iFrame>iRead || CORRUPT_DB );\n        iRead = iFrame;\n      }\n      if( (nCollide--)==0 ){\n        return SQLITE_CORRUPT_BKPT;\n      }\n    }\n  }\n\n#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT\n  /* If expensive assert() statements are available, do a linear search\n  ** of the wal-index file content. Make sure the results agree with the\n  ** result obtained using the hash indexes above.  */\n  {\n    u32 iRead2 = 0;\n    u32 iTest;\n    assert( pWal->minFrame>0 );\n    for(iTest=iLast; iTest>=pWal->minFrame; iTest--){\n      if( walFramePgno(pWal, iTest)==pgno ){\n        iRead2 = iTest;\n        break;\n      }\n    }\n    assert( iRead==iRead2 );\n  }\n#endif\n\n  *piRead = iRead;\n  return SQLITE_OK;\n}\n\n/*\n** Read the contents of frame iRead from the wal file into buffer pOut\n** (which is nOut bytes in size). Return SQLITE_OK if successful, or an\n** error code otherwise.\n*/\nint sqlite3WalReadFrame(\n  Wal *pWal,                      /* WAL handle */\n  u32 iRead,                      /* Frame to read */\n  int nOut,                       /* Size of buffer pOut in bytes */\n  u8 *pOut                        /* Buffer to write page data to */\n){\n  int sz;\n  i64 iOffset;\n  sz = pWal->hdr.szPage;\n  sz = (sz&0xfe00) + ((sz&0x0001)<<16);\n  testcase( sz<=32768 );\n  testcase( sz>=65536 );\n  iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE;\n  /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */\n  return sqlite3OsRead(pWal->pWalFd, pOut, (nOut>sz ? sz : nOut), iOffset);\n}\n\n/* \n** Return the size of the database in pages (or zero, if unknown).\n*/\nPgno sqlite3WalDbsize(Wal *pWal){\n  if( pWal && ALWAYS(pWal->readLock>=0) ){\n    return pWal->hdr.nPage;\n  }\n  return 0;\n}\n\n\n/* \n** This function starts a write transaction on the WAL.\n**\n** A read transaction must have already been started by a prior call\n** to sqlite3WalBeginReadTransaction().\n**\n** If another thread or process has written into the database since\n** the read transaction was started, then it is not possible for this\n** thread to write as doing so would cause a fork.  So this routine\n** returns SQLITE_BUSY in that case and no write transaction is started.\n**\n** There can only be a single writer active at a time.\n*/\nint sqlite3WalBeginWriteTransaction(Wal *pWal){\n  int rc;\n\n  /* Cannot start a write transaction without first holding a read\n  ** transaction. */\n  assert( pWal->readLock>=0 );\n  assert( pWal->writeLock==0 && pWal->iReCksum==0 );\n\n  if( pWal->readOnly ){\n    return SQLITE_READONLY;\n  }\n\n  /* Only one writer allowed at a time.  Get the write lock.  Return\n  ** SQLITE_BUSY if unable.\n  */\n  rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1);\n  if( rc ){\n    return rc;\n  }\n  pWal->writeLock = 1;\n\n  /* If another connection has written to the database file since the\n  ** time the read transaction on this connection was started, then\n  ** the write is disallowed.\n  */\n  if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){\n    walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);\n    pWal->writeLock = 0;\n    rc = SQLITE_BUSY_SNAPSHOT;\n  }\n\n  return rc;\n}\n\n/*\n** End a write transaction.  The commit has already been done.  This\n** routine merely releases the lock.\n*/\nint sqlite3WalEndWriteTransaction(Wal *pWal){\n  if( pWal->writeLock ){\n    walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);\n    pWal->writeLock = 0;\n    pWal->iReCksum = 0;\n    pWal->truncateOnCommit = 0;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** If any data has been written (but not committed) to the log file, this\n** function moves the write-pointer back to the start of the transaction.\n**\n** Additionally, the callback function is invoked for each frame written\n** to the WAL since the start of the transaction. If the callback returns\n** other than SQLITE_OK, it is not invoked again and the error code is\n** returned to the caller.\n**\n** Otherwise, if the callback function does not return an error, this\n** function returns SQLITE_OK.\n*/\nint sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){\n  int rc = SQLITE_OK;\n  if( ALWAYS(pWal->writeLock) ){\n    Pgno iMax = pWal->hdr.mxFrame;\n    Pgno iFrame;\n  \n    /* Restore the clients cache of the wal-index header to the state it\n    ** was in before the client began writing to the database. \n    */\n    memcpy(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr));\n\n    for(iFrame=pWal->hdr.mxFrame+1; \n        ALWAYS(rc==SQLITE_OK) && iFrame<=iMax; \n        iFrame++\n    ){\n      /* This call cannot fail. Unless the page for which the page number\n      ** is passed as the second argument is (a) in the cache and \n      ** (b) has an outstanding reference, then xUndo is either a no-op\n      ** (if (a) is false) or simply expels the page from the cache (if (b)\n      ** is false).\n      **\n      ** If the upper layer is doing a rollback, it is guaranteed that there\n      ** are no outstanding references to any page other than page 1. And\n      ** page 1 is never written to the log until the transaction is\n      ** committed. As a result, the call to xUndo may not fail.\n      */\n      assert( walFramePgno(pWal, iFrame)!=1 );\n      rc = xUndo(pUndoCtx, walFramePgno(pWal, iFrame));\n    }\n    if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);\n  }\n  return rc;\n}\n\n/* \n** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32 \n** values. This function populates the array with values required to \n** \"rollback\" the write position of the WAL handle back to the current \n** point in the event of a savepoint rollback (via WalSavepointUndo()).\n*/\nvoid sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){\n  assert( pWal->writeLock );\n  aWalData[0] = pWal->hdr.mxFrame;\n  aWalData[1] = pWal->hdr.aFrameCksum[0];\n  aWalData[2] = pWal->hdr.aFrameCksum[1];\n  aWalData[3] = pWal->nCkpt;\n}\n\n/* \n** Move the write position of the WAL back to the point identified by\n** the values in the aWalData[] array. aWalData must point to an array\n** of WAL_SAVEPOINT_NDATA u32 values that has been previously populated\n** by a call to WalSavepoint().\n*/\nint sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){\n  int rc = SQLITE_OK;\n\n  assert( pWal->writeLock );\n  assert( aWalData[3]!=pWal->nCkpt || aWalData[0]<=pWal->hdr.mxFrame );\n\n  if( aWalData[3]!=pWal->nCkpt ){\n    /* This savepoint was opened immediately after the write-transaction\n    ** was started. Right after that, the writer decided to wrap around\n    ** to the start of the log. Update the savepoint values to match.\n    */\n    aWalData[0] = 0;\n    aWalData[3] = pWal->nCkpt;\n  }\n\n  if( aWalData[0]<pWal->hdr.mxFrame ){\n    pWal->hdr.mxFrame = aWalData[0];\n    pWal->hdr.aFrameCksum[0] = aWalData[1];\n    pWal->hdr.aFrameCksum[1] = aWalData[2];\n    walCleanupHash(pWal);\n  }\n\n  return rc;\n}\n\n/*\n** This function is called just before writing a set of frames to the log\n** file (see sqlite3WalFrames()). It checks to see if, instead of appending\n** to the current log file, it is possible to overwrite the start of the\n** existing log file with the new frames (i.e. \"reset\" the log). If so,\n** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left\n** unchanged.\n**\n** SQLITE_OK is returned if no error is encountered (regardless of whether\n** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned\n** if an error occurs.\n*/\nstatic int walRestartLog(Wal *pWal){\n  int rc = SQLITE_OK;\n  int cnt;\n\n  if( pWal->readLock==0 ){\n    volatile WalCkptInfo *pInfo = walCkptInfo(pWal);\n    assert( pInfo->nBackfill==pWal->hdr.mxFrame );\n    if( pInfo->nBackfill>0 ){\n      u32 salt1;\n      sqlite3_randomness(4, &salt1);\n      rc = walLockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);\n      if( rc==SQLITE_OK ){\n        /* If all readers are using WAL_READ_LOCK(0) (in other words if no\n        ** readers are currently using the WAL), then the transactions\n        ** frames will overwrite the start of the existing log. Update the\n        ** wal-index header to reflect this.\n        **\n        ** In theory it would be Ok to update the cache of the header only\n        ** at this point. But updating the actual wal-index header is also\n        ** safe and means there is no special case for sqlite3WalUndo()\n        ** to handle if this transaction is rolled back.  */\n        walRestartHdr(pWal, salt1);\n        walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);\n      }else if( rc!=SQLITE_BUSY ){\n        return rc;\n      }\n    }\n    walUnlockShared(pWal, WAL_READ_LOCK(0));\n    pWal->readLock = -1;\n    cnt = 0;\n    do{\n      int notUsed;\n      rc = walTryBeginRead(pWal, &notUsed, 1, ++cnt);\n    }while( rc==WAL_RETRY );\n    assert( (rc&0xff)!=SQLITE_BUSY ); /* BUSY not possible when useWal==1 */\n    testcase( (rc&0xff)==SQLITE_IOERR );\n    testcase( rc==SQLITE_PROTOCOL );\n    testcase( rc==SQLITE_OK );\n  }\n  return rc;\n}\n\n/*\n** Information about the current state of the WAL file and where\n** the next fsync should occur - passed from sqlite3WalFrames() into\n** walWriteToLog().\n*/\ntypedef struct WalWriter {\n  Wal *pWal;                   /* The complete WAL information */\n  sqlite3_file *pFd;           /* The WAL file to which we write */\n  sqlite3_int64 iSyncPoint;    /* Fsync at this offset */\n  int syncFlags;               /* Flags for the fsync */\n  int szPage;                  /* Size of one page */\n} WalWriter;\n\n/*\n** Write iAmt bytes of content into the WAL file beginning at iOffset.\n** Do a sync when crossing the p->iSyncPoint boundary.\n**\n** In other words, if iSyncPoint is in between iOffset and iOffset+iAmt,\n** first write the part before iSyncPoint, then sync, then write the\n** rest.\n*/\nstatic int walWriteToLog(\n  WalWriter *p,              /* WAL to write to */\n  void *pContent,            /* Content to be written */\n  int iAmt,                  /* Number of bytes to write */\n  sqlite3_int64 iOffset      /* Start writing at this offset */\n){\n  int rc;\n  if( iOffset<p->iSyncPoint && iOffset+iAmt>=p->iSyncPoint ){\n    int iFirstAmt = (int)(p->iSyncPoint - iOffset);\n    rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);\n    if( rc ) return rc;\n    iOffset += iFirstAmt;\n    iAmt -= iFirstAmt;\n    pContent = (void*)(iFirstAmt + (char*)pContent);\n    assert( p->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) );\n    rc = sqlite3OsSync(p->pFd, p->syncFlags & SQLITE_SYNC_MASK);\n    if( iAmt==0 || rc ) return rc;\n  }\n  rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);\n  return rc;\n}\n\n/*\n** Write out a single frame of the WAL\n*/\nstatic int walWriteOneFrame(\n  WalWriter *p,               /* Where to write the frame */\n  PgHdr *pPage,               /* The page of the frame to be written */\n  int nTruncate,              /* The commit flag.  Usually 0.  >0 for commit */\n  sqlite3_int64 iOffset       /* Byte offset at which to write */\n){\n  int rc;                         /* Result code from subfunctions */\n  void *pData;                    /* Data actually written */\n  u8 aFrame[WAL_FRAME_HDRSIZE];   /* Buffer to assemble frame-header in */\n#if defined(SQLITE_HAS_CODEC)\n  if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM_BKPT;\n#else\n  pData = pPage->pData;\n#endif\n  walEncodeFrame(p->pWal, pPage->pgno, nTruncate, pData, aFrame);\n  rc = walWriteToLog(p, aFrame, sizeof(aFrame), iOffset);\n  if( rc ) return rc;\n  /* Write the page data */\n  rc = walWriteToLog(p, pData, p->szPage, iOffset+sizeof(aFrame));\n  return rc;\n}\n\n/*\n** This function is called as part of committing a transaction within which\n** one or more frames have been overwritten. It updates the checksums for\n** all frames written to the wal file by the current transaction starting\n** with the earliest to have been overwritten.\n**\n** SQLITE_OK is returned if successful, or an SQLite error code otherwise.\n*/\nstatic int walRewriteChecksums(Wal *pWal, u32 iLast){\n  const int szPage = pWal->szPage;/* Database page size */\n  int rc = SQLITE_OK;             /* Return code */\n  u8 *aBuf;                       /* Buffer to load data from wal file into */\n  u8 aFrame[WAL_FRAME_HDRSIZE];   /* Buffer to assemble frame-headers in */\n  u32 iRead;                      /* Next frame to read from wal file */\n  i64 iCksumOff;\n\n  aBuf = sqlite3_malloc(szPage + WAL_FRAME_HDRSIZE);\n  if( aBuf==0 ) return SQLITE_NOMEM_BKPT;\n\n  /* Find the checksum values to use as input for the recalculating the\n  ** first checksum. If the first frame is frame 1 (implying that the current\n  ** transaction restarted the wal file), these values must be read from the\n  ** wal-file header. Otherwise, read them from the frame header of the\n  ** previous frame.  */\n  assert( pWal->iReCksum>0 );\n  if( pWal->iReCksum==1 ){\n    iCksumOff = 24;\n  }else{\n    iCksumOff = walFrameOffset(pWal->iReCksum-1, szPage) + 16;\n  }\n  rc = sqlite3OsRead(pWal->pWalFd, aBuf, sizeof(u32)*2, iCksumOff);\n  pWal->hdr.aFrameCksum[0] = sqlite3Get4byte(aBuf);\n  pWal->hdr.aFrameCksum[1] = sqlite3Get4byte(&aBuf[sizeof(u32)]);\n\n  iRead = pWal->iReCksum;\n  pWal->iReCksum = 0;\n  for(; rc==SQLITE_OK && iRead<=iLast; iRead++){\n    i64 iOff = walFrameOffset(iRead, szPage);\n    rc = sqlite3OsRead(pWal->pWalFd, aBuf, szPage+WAL_FRAME_HDRSIZE, iOff);\n    if( rc==SQLITE_OK ){\n      u32 iPgno, nDbSize;\n      iPgno = sqlite3Get4byte(aBuf);\n      nDbSize = sqlite3Get4byte(&aBuf[4]);\n\n      walEncodeFrame(pWal, iPgno, nDbSize, &aBuf[WAL_FRAME_HDRSIZE], aFrame);\n      rc = sqlite3OsWrite(pWal->pWalFd, aFrame, sizeof(aFrame), iOff);\n    }\n  }\n\n  sqlite3_free(aBuf);\n  return rc;\n}\n\n/* \n** Write a set of frames to the log. The caller must hold the write-lock\n** on the log file (obtained using sqlite3WalBeginWriteTransaction()).\n*/\nint sqlite3WalFrames(\n  Wal *pWal,                      /* Wal handle to write to */\n  int szPage,                     /* Database page-size in bytes */\n  PgHdr *pList,                   /* List of dirty pages to write */\n  Pgno nTruncate,                 /* Database size after this commit */\n  int isCommit,                   /* True if this is a commit */\n  int sync_flags                  /* Flags to pass to OsSync() (or 0) */\n){\n  int rc;                         /* Used to catch return codes */\n  u32 iFrame;                     /* Next frame address */\n  PgHdr *p;                       /* Iterator to run through pList with. */\n  PgHdr *pLast = 0;               /* Last frame in list */\n  int nExtra = 0;                 /* Number of extra copies of last page */\n  int szFrame;                    /* The size of a single frame */\n  i64 iOffset;                    /* Next byte to write in WAL file */\n  WalWriter w;                    /* The writer */\n  u32 iFirst = 0;                 /* First frame that may be overwritten */\n  WalIndexHdr *pLive;             /* Pointer to shared header */\n\n  assert( pList );\n  assert( pWal->writeLock );\n\n  /* If this frame set completes a transaction, then nTruncate>0.  If\n  ** nTruncate==0 then this frame set does not complete the transaction. */\n  assert( (isCommit!=0)==(nTruncate!=0) );\n\n#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)\n  { int cnt; for(cnt=0, p=pList; p; p=p->pDirty, cnt++){}\n    WALTRACE((\"WAL%p: frame write begin. %d frames. mxFrame=%d. %s\\n\",\n              pWal, cnt, pWal->hdr.mxFrame, isCommit ? \"Commit\" : \"Spill\"));\n  }\n#endif\n\n  pLive = (WalIndexHdr*)walIndexHdr(pWal);\n  if( memcmp(&pWal->hdr, (void *)pLive, sizeof(WalIndexHdr))!=0 ){\n    iFirst = pLive->mxFrame+1;\n  }\n\n  /* See if it is possible to write these frames into the start of the\n  ** log file, instead of appending to it at pWal->hdr.mxFrame.\n  */\n  if( SQLITE_OK!=(rc = walRestartLog(pWal)) ){\n    return rc;\n  }\n\n  /* If this is the first frame written into the log, write the WAL\n  ** header to the start of the WAL file. See comments at the top of\n  ** this source file for a description of the WAL header format.\n  */\n  iFrame = pWal->hdr.mxFrame;\n  if( iFrame==0 ){\n    u8 aWalHdr[WAL_HDRSIZE];      /* Buffer to assemble wal-header in */\n    u32 aCksum[2];                /* Checksum for wal-header */\n\n    sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN));\n    sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION);\n    sqlite3Put4byte(&aWalHdr[8], szPage);\n    sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt);\n    if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);\n    memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8);\n    walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum);\n    sqlite3Put4byte(&aWalHdr[24], aCksum[0]);\n    sqlite3Put4byte(&aWalHdr[28], aCksum[1]);\n    \n    pWal->szPage = szPage;\n    pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN;\n    pWal->hdr.aFrameCksum[0] = aCksum[0];\n    pWal->hdr.aFrameCksum[1] = aCksum[1];\n    pWal->truncateOnCommit = 1;\n\n    rc = sqlite3OsWrite(pWal->pWalFd, aWalHdr, sizeof(aWalHdr), 0);\n    WALTRACE((\"WAL%p: wal-header write %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\n    if( rc!=SQLITE_OK ){\n      return rc;\n    }\n\n    /* Sync the header (unless SQLITE_IOCAP_SEQUENTIAL is true or unless\n    ** all syncing is turned off by PRAGMA synchronous=OFF).  Otherwise\n    ** an out-of-order write following a WAL restart could result in\n    ** database corruption.  See the ticket:\n    **\n    **     http://localhost:591/sqlite/info/ff5be73dee\n    */\n    if( pWal->syncHeader && sync_flags ){\n      rc = sqlite3OsSync(pWal->pWalFd, sync_flags & SQLITE_SYNC_MASK);\n      if( rc ) return rc;\n    }\n  }\n  assert( (int)pWal->szPage==szPage );\n\n  /* Setup information needed to write frames into the WAL */\n  w.pWal = pWal;\n  w.pFd = pWal->pWalFd;\n  w.iSyncPoint = 0;\n  w.syncFlags = sync_flags;\n  w.szPage = szPage;\n  iOffset = walFrameOffset(iFrame+1, szPage);\n  szFrame = szPage + WAL_FRAME_HDRSIZE;\n\n  /* Write all frames into the log file exactly once */\n  for(p=pList; p; p=p->pDirty){\n    int nDbSize;   /* 0 normally.  Positive == commit flag */\n\n    /* Check if this page has already been written into the wal file by\n    ** the current transaction. If so, overwrite the existing frame and\n    ** set Wal.writeLock to WAL_WRITELOCK_RECKSUM - indicating that \n    ** checksums must be recomputed when the transaction is committed.  */\n    if( iFirst && (p->pDirty || isCommit==0) ){\n      u32 iWrite = 0;\n      VVA_ONLY(rc =) sqlite3WalFindFrame(pWal, p->pgno, &iWrite);\n      assert( rc==SQLITE_OK || iWrite==0 );\n      if( iWrite>=iFirst ){\n        i64 iOff = walFrameOffset(iWrite, szPage) + WAL_FRAME_HDRSIZE;\n        void *pData;\n        if( pWal->iReCksum==0 || iWrite<pWal->iReCksum ){\n          pWal->iReCksum = iWrite;\n        }\n#if defined(SQLITE_HAS_CODEC)\n        if( (pData = sqlite3PagerCodec(p))==0 ) return SQLITE_NOMEM;\n#else\n        pData = p->pData;\n#endif\n        rc = sqlite3OsWrite(pWal->pWalFd, pData, szPage, iOff);\n        if( rc ) return rc;\n        p->flags &= ~PGHDR_WAL_APPEND;\n        continue;\n      }\n    }\n\n    iFrame++;\n    assert( iOffset==walFrameOffset(iFrame, szPage) );\n    nDbSize = (isCommit && p->pDirty==0) ? nTruncate : 0;\n    rc = walWriteOneFrame(&w, p, nDbSize, iOffset);\n    if( rc ) return rc;\n    pLast = p;\n    iOffset += szFrame;\n    p->flags |= PGHDR_WAL_APPEND;\n  }\n\n  /* Recalculate checksums within the wal file if required. */\n  if( isCommit && pWal->iReCksum ){\n    rc = walRewriteChecksums(pWal, iFrame);\n    if( rc ) return rc;\n  }\n\n  /* If this is the end of a transaction, then we might need to pad\n  ** the transaction and/or sync the WAL file.\n  **\n  ** Padding and syncing only occur if this set of frames complete a\n  ** transaction and if PRAGMA synchronous=FULL.  If synchronous==NORMAL\n  ** or synchronous==OFF, then no padding or syncing are needed.\n  **\n  ** If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not\n  ** needed and only the sync is done.  If padding is needed, then the\n  ** final frame is repeated (with its commit mark) until the next sector\n  ** boundary is crossed.  Only the part of the WAL prior to the last\n  ** sector boundary is synced; the part of the last frame that extends\n  ** past the sector boundary is written after the sync.\n  */\n  if( isCommit && (sync_flags & WAL_SYNC_TRANSACTIONS)!=0 ){\n    int bSync = 1;\n    if( pWal->padToSectorBoundary ){\n      int sectorSize = sqlite3SectorSize(pWal->pWalFd);\n      w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize;\n      bSync = (w.iSyncPoint==iOffset);\n      testcase( bSync );\n      while( iOffset<w.iSyncPoint ){\n        rc = walWriteOneFrame(&w, pLast, nTruncate, iOffset);\n        if( rc ) return rc;\n        iOffset += szFrame;\n        nExtra++;\n      }\n    }\n    if( bSync ){\n      assert( rc==SQLITE_OK );\n      rc = sqlite3OsSync(w.pFd, sync_flags & SQLITE_SYNC_MASK);\n    }\n  }\n\n  /* If this frame set completes the first transaction in the WAL and\n  ** if PRAGMA journal_size_limit is set, then truncate the WAL to the\n  ** journal size limit, if possible.\n  */\n  if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ){\n    i64 sz = pWal->mxWalSize;\n    if( walFrameOffset(iFrame+nExtra+1, szPage)>pWal->mxWalSize ){\n      sz = walFrameOffset(iFrame+nExtra+1, szPage);\n    }\n    walLimitSize(pWal, sz);\n    pWal->truncateOnCommit = 0;\n  }\n\n  /* Append data to the wal-index. It is not necessary to lock the \n  ** wal-index to do this as the SQLITE_SHM_WRITE lock held on the wal-index\n  ** guarantees that there are no other writers, and no data that may\n  ** be in use by existing readers is being overwritten.\n  */\n  iFrame = pWal->hdr.mxFrame;\n  for(p=pList; p && rc==SQLITE_OK; p=p->pDirty){\n    if( (p->flags & PGHDR_WAL_APPEND)==0 ) continue;\n    iFrame++;\n    rc = walIndexAppend(pWal, iFrame, p->pgno);\n  }\n  while( rc==SQLITE_OK && nExtra>0 ){\n    iFrame++;\n    nExtra--;\n    rc = walIndexAppend(pWal, iFrame, pLast->pgno);\n  }\n\n  if( rc==SQLITE_OK ){\n    /* Update the private copy of the header. */\n    pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));\n    testcase( szPage<=32768 );\n    testcase( szPage>=65536 );\n    pWal->hdr.mxFrame = iFrame;\n    if( isCommit ){\n      pWal->hdr.iChange++;\n      pWal->hdr.nPage = nTruncate;\n    }\n    /* If this is a commit, update the wal-index header too. */\n    if( isCommit ){\n      walIndexWriteHdr(pWal);\n      pWal->iCallback = iFrame;\n    }\n  }\n\n  WALTRACE((\"WAL%p: frame write %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\n  return rc;\n}\n\n/* \n** This routine is called to implement sqlite3_wal_checkpoint() and\n** related interfaces.\n**\n** Obtain a CHECKPOINT lock and then backfill as much information as\n** we can from WAL into the database.\n**\n** If parameter xBusy is not NULL, it is a pointer to a busy-handler\n** callback. In this case this function runs a blocking checkpoint.\n*/\nint sqlite3WalCheckpoint(\n  Wal *pWal,                      /* Wal connection */\n  int eMode,                      /* PASSIVE, FULL, RESTART, or TRUNCATE */\n  int (*xBusy)(void*),            /* Function to call when busy */\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\n  int sync_flags,                 /* Flags to sync db file with (or 0) */\n  int nBuf,                       /* Size of temporary buffer */\n  u8 *zBuf,                       /* Temporary buffer to use */\n  int *pnLog,                     /* OUT: Number of frames in WAL */\n  int *pnCkpt                     /* OUT: Number of backfilled frames in WAL */\n){\n  int rc;                         /* Return code */\n  int isChanged = 0;              /* True if a new wal-index header is loaded */\n  int eMode2 = eMode;             /* Mode to pass to walCheckpoint() */\n  int (*xBusy2)(void*) = xBusy;   /* Busy handler for eMode2 */\n\n  assert( pWal->ckptLock==0 );\n  assert( pWal->writeLock==0 );\n\n  /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked\n  ** in the SQLITE_CHECKPOINT_PASSIVE mode. */\n  assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );\n\n  if( pWal->readOnly ) return SQLITE_READONLY;\n  WALTRACE((\"WAL%p: checkpoint begins\\n\", pWal));\n    \n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\n  if (pWal->checkpointHandler.xFunc) {\n    rc = pWal->checkpointHandler.xFunc(pWal->checkpointHandler.pArg, -1);\n    if ( rc ) {\n      return rc;\n    }\n  }\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n  /* IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive \n  ** \"checkpoint\" lock on the database file. */\n  rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);\n  if( rc ){\n    /* EVIDENCE-OF: R-10421-19736 If any other process is running a\n    ** checkpoint operation at the same time, the lock cannot be obtained and\n    ** SQLITE_BUSY is returned.\n    ** EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured,\n    ** it will not be invoked in this case.\n    */\n    testcase( rc==SQLITE_BUSY );\n    testcase( xBusy!=0 );\n    return rc;\n  }\n  pWal->ckptLock = 1;\n\n  /* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and\n  ** TRUNCATE modes also obtain the exclusive \"writer\" lock on the database\n  ** file.\n  **\n  ** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained\n  ** immediately, and a busy-handler is configured, it is invoked and the\n  ** writer lock retried until either the busy-handler returns 0 or the\n  ** lock is successfully obtained.\n  */\n  if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){\n    rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_WRITE_LOCK, 1);\n    if( rc==SQLITE_OK ){\n      pWal->writeLock = 1;\n    }else if( rc==SQLITE_BUSY ){\n      eMode2 = SQLITE_CHECKPOINT_PASSIVE;\n      xBusy2 = 0;\n      rc = SQLITE_OK;\n    }\n  }\n\n  /* Read the wal-index header. */\n  if( rc==SQLITE_OK ){\n    rc = walIndexReadHdr(pWal, &isChanged);\n    if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){\n      sqlite3OsUnfetch(pWal->pDbFd, 0, 0);\n    }\n  }\n\n  /* Copy data from the log to the database file. */\n  if( rc==SQLITE_OK ){\n\n    if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){\n      rc = SQLITE_CORRUPT_BKPT;\n    }else{\n      rc = walCheckpoint(pWal, eMode2, xBusy2, pBusyArg, sync_flags, zBuf);\n    }\n\n    /* If no error occurred, set the output variables. */\n    if( rc==SQLITE_OK || rc==SQLITE_BUSY ){\n      if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;\n      if( pnCkpt ) *pnCkpt = (int)(walCkptInfo(pWal)->nBackfill);\n    }\n  }\n\n  if( isChanged ){\n    /* If a new wal-index header was loaded before the checkpoint was \n    ** performed, then the pager-cache associated with pWal is now\n    ** out of date. So zero the cached wal-index header to ensure that\n    ** next time the pager opens a snapshot on this database it knows that\n    ** the cache needs to be reset.\n    */\n    memset(&pWal->hdr, 0, sizeof(WalIndexHdr));\n  }\n\n  /* Release the locks. */\n  sqlite3WalEndWriteTransaction(pWal);\n  walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1);\n  pWal->ckptLock = 0;\n  WALTRACE((\"WAL%p: checkpoint %s\\n\", pWal, rc ? \"failed\" : \"ok\"));\n  \n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\n  if (pWal->checkpointHandler.xFunc) {\n    pWal->checkpointHandler.xFunc(pWal->checkpointHandler.pArg, rc);\n  }\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n  return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc);\n}\n\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\nint sqlite3WalCheckpointHandler(Wal *pWal, \n                                int (*xCheckpoint)(void*,int), \n                                void* pArg){\n  pWal->checkpointHandler.xFunc = xCheckpoint;\n  pWal->checkpointHandler.pArg = pArg;\n  return SQLITE_OK;\n}\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n/* Return the value to pass to a sqlite3_wal_hook callback, the\n** number of frames in the WAL at the point of the last commit since\n** sqlite3WalCallback() was called.  If no commits have occurred since\n** the last call, then return 0.\n*/\nint sqlite3WalCallback(Wal *pWal){\n  u32 ret = 0;\n  if( pWal ){\n    ret = pWal->iCallback;\n    pWal->iCallback = 0;\n  }\n  return (int)ret;\n}\n\n/*\n** This function is called to change the WAL subsystem into or out\n** of locking_mode=EXCLUSIVE.\n**\n** If op is zero, then attempt to change from locking_mode=EXCLUSIVE\n** into locking_mode=NORMAL.  This means that we must acquire a lock\n** on the pWal->readLock byte.  If the WAL is already in locking_mode=NORMAL\n** or if the acquisition of the lock fails, then return 0.  If the\n** transition out of exclusive-mode is successful, return 1.  This\n** operation must occur while the pager is still holding the exclusive\n** lock on the main database file.\n**\n** If op is one, then change from locking_mode=NORMAL into \n** locking_mode=EXCLUSIVE.  This means that the pWal->readLock must\n** be released.  Return 1 if the transition is made and 0 if the\n** WAL is already in exclusive-locking mode - meaning that this\n** routine is a no-op.  The pager must already hold the exclusive lock\n** on the main database file before invoking this operation.\n**\n** If op is negative, then do a dry-run of the op==1 case but do\n** not actually change anything. The pager uses this to see if it\n** should acquire the database exclusive lock prior to invoking\n** the op==1 case.\n*/\nint sqlite3WalExclusiveMode(Wal *pWal, int op){\n  int rc;\n  assert( pWal->writeLock==0 );\n  assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 );\n\n  /* pWal->readLock is usually set, but might be -1 if there was a \n  ** prior error while attempting to acquire are read-lock. This cannot \n  ** happen if the connection is actually in exclusive mode (as no xShmLock\n  ** locks are taken in this case). Nor should the pager attempt to\n  ** upgrade to exclusive-mode following such an error.\n  */\n  assert( pWal->readLock>=0 || pWal->lockError );\n  assert( pWal->readLock>=0 || (op<=0 && pWal->exclusiveMode==0) );\n\n  if( op==0 ){\n    if( pWal->exclusiveMode ){\n      pWal->exclusiveMode = 0;\n      if( walLockShared(pWal, WAL_READ_LOCK(pWal->readLock))!=SQLITE_OK ){\n        pWal->exclusiveMode = 1;\n      }\n      rc = pWal->exclusiveMode==0;\n    }else{\n      /* Already in locking_mode=NORMAL */\n      rc = 0;\n    }\n  }else if( op>0 ){\n    assert( pWal->exclusiveMode==0 );\n    assert( pWal->readLock>=0 );\n    walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock));\n    pWal->exclusiveMode = 1;\n    rc = 1;\n  }else{\n    rc = pWal->exclusiveMode==0;\n  }\n  return rc;\n}\n\n/* \n** Return true if the argument is non-NULL and the WAL module is using\n** heap-memory for the wal-index. Otherwise, if the argument is NULL or the\n** WAL module is using shared-memory, return false. \n*/\nint sqlite3WalHeapMemory(Wal *pWal){\n  return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE );\n}\n\n#ifdef SQLITE_ENABLE_SNAPSHOT\n/* Create a snapshot object.  The content of a snapshot is opaque to\n** every other subsystem, so the WAL module can put whatever it needs\n** in the object.\n*/\nint sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot){\n  int rc = SQLITE_OK;\n  WalIndexHdr *pRet;\n\n  assert( pWal->readLock>=0 && pWal->writeLock==0 );\n\n  pRet = (WalIndexHdr*)sqlite3_malloc(sizeof(WalIndexHdr));\n  if( pRet==0 ){\n    rc = SQLITE_NOMEM_BKPT;\n  }else{\n    memcpy(pRet, &pWal->hdr, sizeof(WalIndexHdr));\n    *ppSnapshot = (sqlite3_snapshot*)pRet;\n  }\n\n  return rc;\n}\n\n/* Try to open on pSnapshot when the next read-transaction starts\n*/\nvoid sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot){\n  pWal->pSnapshot = (WalIndexHdr*)pSnapshot;\n}\n\n/* \n** Return a +ve value if snapshot p1 is newer than p2. A -ve value if\n** p1 is older than p2 and zero if p1 and p2 are the same snapshot.\n*/\nint sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapshot *p2){\n  WalIndexHdr *pHdr1 = (WalIndexHdr*)p1;\n  WalIndexHdr *pHdr2 = (WalIndexHdr*)p2;\n\n  /* aSalt[0] is a copy of the value stored in the wal file header. It\n  ** is incremented each time the wal file is restarted.  */\n  if( pHdr1->aSalt[0]<pHdr2->aSalt[0] ) return -1;\n  if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1;\n  if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1;\n  if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1;\n  return 0;\n}\n#endif /* SQLITE_ENABLE_SNAPSHOT */\n\n#ifdef SQLITE_ENABLE_ZIPVFS\n/*\n** If the argument is not NULL, it points to a Wal object that holds a\n** read-lock. This function returns the database page-size if it is known,\n** or zero if it is not (or if pWal is NULL).\n*/\nint sqlite3WalFramesize(Wal *pWal){\n  assert( pWal==0 || pWal->readLock>=0 );\n  return (pWal ? pWal->szPage : 0);\n}\n#endif\n\n/* Return the sqlite3_file object for the WAL file\n*/\nsqlite3_file *sqlite3WalFile(Wal *pWal){\n  return pWal->pWalFd;\n}\n\n#endif /* #ifndef SQLITE_OMIT_WAL */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/wal.h",
    "content": "/*\n** 2010 February 1\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This header file defines the interface to the write-ahead logging \n** system. Refer to the comments below and the header comment attached to \n** the implementation of each function in log.c for further details.\n*/\n\n#ifndef SQLITE_WAL_H\n#define SQLITE_WAL_H\n\n#include \"sqliteInt.h\"\n\n/* Additional values that can be added to the sync_flags argument of\n** sqlite3WalFrames():\n*/\n#define WAL_SYNC_TRANSACTIONS  0x20   /* Sync at the end of each transaction */\n#define SQLITE_SYNC_MASK       0x13   /* Mask off the SQLITE_SYNC_* values */\n\n#ifdef SQLITE_OMIT_WAL\n# define sqlite3WalOpen(x,y,z)                   0\n# define sqlite3WalLimit(x,y)\n# define sqlite3WalClose(w,x,y,z)                0\n# define sqlite3WalBeginReadTransaction(y,z)     0\n# define sqlite3WalEndReadTransaction(z)\n# define sqlite3WalDbsize(y)                     0\n# define sqlite3WalBeginWriteTransaction(y)      0\n# define sqlite3WalEndWriteTransaction(x)        0\n# define sqlite3WalUndo(x,y,z)                   0\n# define sqlite3WalSavepoint(y,z)\n# define sqlite3WalSavepointUndo(y,z)            0\n# define sqlite3WalFrames(u,v,w,x,y,z)           0\n# define sqlite3WalCheckpoint(r,s,t,u,v,w,x,y,z) 0\n# define sqlite3WalCallback(z)                   0\n# define sqlite3WalExclusiveMode(y,z)            0\n# define sqlite3WalHeapMemory(z)                 0\n# define sqlite3WalFramesize(z)                  0\n# define sqlite3WalFindFrame(x,y,z)              0\n# define sqlite3WalFile(x)                       0\n#else\n\n#define WAL_SAVEPOINT_NDATA 4\n\n/* Connection to a write-ahead log (WAL) file. \n** There is one object of this type for each pager. \n*/\ntypedef struct Wal Wal;\n\n/* Open and close a connection to a write-ahead log. */\nint sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *, int, i64, Wal**);\nint sqlite3WalClose(Wal *pWal, int sync_flags, int, u8 *);\n\n/* Set the limiting size of a WAL file. */\nvoid sqlite3WalLimit(Wal*, i64);\n\n/* Used by readers to open (lock) and close (unlock) a snapshot.  A \n** snapshot is like a read-transaction.  It is the state of the database\n** at an instant in time.  sqlite3WalOpenSnapshot gets a read lock and\n** preserves the current state even if the other threads or processes\n** write to or checkpoint the WAL.  sqlite3WalCloseSnapshot() closes the\n** transaction and releases the lock.\n*/\nint sqlite3WalBeginReadTransaction(Wal *pWal, int *);\nvoid sqlite3WalEndReadTransaction(Wal *pWal);\n\n/* Read a page from the write-ahead log, if it is present. */\nint sqlite3WalFindFrame(Wal *, Pgno, u32 *);\nint sqlite3WalReadFrame(Wal *, u32, int, u8 *);\n\n/* If the WAL is not empty, return the size of the database. */\nPgno sqlite3WalDbsize(Wal *pWal);\n\n/* Obtain or release the WRITER lock. */\nint sqlite3WalBeginWriteTransaction(Wal *pWal);\nint sqlite3WalEndWriteTransaction(Wal *pWal);\n\n/* Undo any frames written (but not committed) to the log */\nint sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx);\n\n/* Return an integer that records the current (uncommitted) write\n** position in the WAL */\nvoid sqlite3WalSavepoint(Wal *pWal, u32 *aWalData);\n\n/* Move the write position of the WAL back to iFrame.  Called in\n** response to a ROLLBACK TO command. */\nint sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData);\n\n/* Write a frame or frames to the log. */\nint sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int);\n\n/* Copy pages from the log to the database file */ \nint sqlite3WalCheckpoint(\n  Wal *pWal,                      /* Write-ahead log connection */\n  int eMode,                      /* One of PASSIVE, FULL and RESTART */\n  int (*xBusy)(void*),            /* Function to call when busy */\n  void *pBusyArg,                 /* Context argument for xBusyHandler */\n  int sync_flags,                 /* Flags to sync db file with (or 0) */\n  int nBuf,                       /* Size of buffer nBuf */\n  u8 *zBuf,                       /* Temporary buffer to use */\n  int *pnLog,                     /* OUT: Number of frames in WAL */\n  int *pnCkpt                     /* OUT: Number of backfilled frames in WAL */\n);\n\n#ifdef SQLITE_WCDB_CHECKPOINT_HANDLER\nint sqlite3WalCheckpointHandler(Wal *, int (*)(void*,int), void*);\n#endif //SQLITE_WCDB_CHECKPOINT_HANDLER\n\n/* Return the value to pass to a sqlite3_wal_hook callback, the\n** number of frames in the WAL at the point of the last commit since\n** sqlite3WalCallback() was called.  If no commits have occurred since\n** the last call, then return 0.\n*/\nint sqlite3WalCallback(Wal *pWal);\n\n/* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released)\n** by the pager layer on the database file.\n*/\nint sqlite3WalExclusiveMode(Wal *pWal, int op);\n\n/* Return true if the argument is non-NULL and the WAL module is using\n** heap-memory for the wal-index. Otherwise, if the argument is NULL or the\n** WAL module is using shared-memory, return false. \n*/\nint sqlite3WalHeapMemory(Wal *pWal);\n\n#ifdef SQLITE_ENABLE_SNAPSHOT\nint sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot);\nvoid sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot);\n#endif\n\n#ifdef SQLITE_ENABLE_ZIPVFS\n/* If the WAL file is not empty, return the number of bytes of content\n** stored in each frame (i.e. the db page-size when the WAL was created).\n*/\nint sqlite3WalFramesize(Wal *pWal);\n#endif\n\n/* Return the sqlite3_file object for the WAL file */\nsqlite3_file *sqlite3WalFile(Wal *pWal);\n\n#endif /* ifndef SQLITE_OMIT_WAL */\n#endif /* SQLITE_WAL_H */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/walker.c",
    "content": "/*\n** 2008 August 16\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This file contains routines used for walking the parser tree for\n** an SQL statement.\n*/\n#include \"sqliteInt.h\"\n#include <stdlib.h>\n#include <string.h>\n\n\n/*\n** Walk an expression tree.  Invoke the callback once for each node\n** of the expression, while descending.  (In other words, the callback\n** is invoked before visiting children.)\n**\n** The return value from the callback should be one of the WRC_*\n** constants to specify how to proceed with the walk.\n**\n**    WRC_Continue      Continue descending down the tree.\n**\n**    WRC_Prune         Do not descend into child nodes.  But allow\n**                      the walk to continue with sibling nodes.\n**\n**    WRC_Abort         Do no more callbacks.  Unwind the stack and\n**                      return the top-level walk call.\n**\n** The return value from this routine is WRC_Abort to abandon the tree walk\n** and WRC_Continue to continue.\n*/\nstatic SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){\n  int rc;\n  testcase( ExprHasProperty(pExpr, EP_TokenOnly) );\n  testcase( ExprHasProperty(pExpr, EP_Reduced) );\n  rc = pWalker->xExprCallback(pWalker, pExpr);\n  if( rc || ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){\n    return rc & WRC_Abort;\n  }\n  if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;\n  if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;\n  if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n    if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;\n  }else if( pExpr->x.pList ){\n    if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;\n  }\n  return WRC_Continue;\n}\nint sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){\n  return pExpr ? walkExpr(pWalker,pExpr) : WRC_Continue;\n}\n\n/*\n** Call sqlite3WalkExpr() for every expression in list p or until\n** an abort request is seen.\n*/\nint sqlite3WalkExprList(Walker *pWalker, ExprList *p){\n  int i;\n  struct ExprList_item *pItem;\n  if( p ){\n    for(i=p->nExpr, pItem=p->a; i>0; i--, pItem++){\n      if( sqlite3WalkExpr(pWalker, pItem->pExpr) ) return WRC_Abort;\n    }\n  }\n  return WRC_Continue;\n}\n\n/*\n** Walk all expressions associated with SELECT statement p.  Do\n** not invoke the SELECT callback on p, but do (of course) invoke\n** any expr callbacks and SELECT callbacks that come from subqueries.\n** Return WRC_Abort or WRC_Continue.\n*/\nint sqlite3WalkSelectExpr(Walker *pWalker, Select *p){\n  if( sqlite3WalkExprList(pWalker, p->pEList) ) return WRC_Abort;\n  if( sqlite3WalkExpr(pWalker, p->pWhere) ) return WRC_Abort;\n  if( sqlite3WalkExprList(pWalker, p->pGroupBy) ) return WRC_Abort;\n  if( sqlite3WalkExpr(pWalker, p->pHaving) ) return WRC_Abort;\n  if( sqlite3WalkExprList(pWalker, p->pOrderBy) ) return WRC_Abort;\n  if( sqlite3WalkExpr(pWalker, p->pLimit) ) return WRC_Abort;\n  if( sqlite3WalkExpr(pWalker, p->pOffset) ) return WRC_Abort;\n  return WRC_Continue;\n}\n\n/*\n** Walk the parse trees associated with all subqueries in the\n** FROM clause of SELECT statement p.  Do not invoke the select\n** callback on p, but do invoke it on each FROM clause subquery\n** and on any subqueries further down in the tree.  Return \n** WRC_Abort or WRC_Continue;\n*/\nint sqlite3WalkSelectFrom(Walker *pWalker, Select *p){\n  SrcList *pSrc;\n  int i;\n  struct SrcList_item *pItem;\n\n  pSrc = p->pSrc;\n  if( ALWAYS(pSrc) ){\n    for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){\n      if( sqlite3WalkSelect(pWalker, pItem->pSelect) ){\n        return WRC_Abort;\n      }\n      if( pItem->fg.isTabFunc\n       && sqlite3WalkExprList(pWalker, pItem->u1.pFuncArg)\n      ){\n        return WRC_Abort;\n      }\n    }\n  }\n  return WRC_Continue;\n} \n\n/*\n** Call sqlite3WalkExpr() for every expression in Select statement p.\n** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and\n** on the compound select chain, p->pPrior. \n**\n** If it is not NULL, the xSelectCallback() callback is invoked before\n** the walk of the expressions and FROM clause. The xSelectCallback2()\n** method, if it is not NULL, is invoked following the walk of the \n** expressions and FROM clause.\n**\n** Return WRC_Continue under normal conditions.  Return WRC_Abort if\n** there is an abort request.\n**\n** If the Walker does not have an xSelectCallback() then this routine\n** is a no-op returning WRC_Continue.\n*/\nint sqlite3WalkSelect(Walker *pWalker, Select *p){\n  int rc;\n  if( p==0 || (pWalker->xSelectCallback==0 && pWalker->xSelectCallback2==0) ){\n    return WRC_Continue;\n  }\n  rc = WRC_Continue;\n  pWalker->walkerDepth++;\n  while( p ){\n    if( pWalker->xSelectCallback ){\n       rc = pWalker->xSelectCallback(pWalker, p);\n       if( rc ) break;\n    }\n    if( sqlite3WalkSelectExpr(pWalker, p)\n     || sqlite3WalkSelectFrom(pWalker, p)\n    ){\n      pWalker->walkerDepth--;\n      return WRC_Abort;\n    }\n    if( pWalker->xSelectCallback2 ){\n      pWalker->xSelectCallback2(pWalker, p);\n    }\n    p = p->pPrior;\n  }\n  pWalker->walkerDepth--;\n  return rc & WRC_Abort;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/where.c",
    "content": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This module contains C code that generates VDBE code used to process\n** the WHERE clause of SQL statements.  This module is responsible for\n** generating the code that loops through a table looking for applicable\n** rows.  Indices are selected and used to speed the search when doing\n** so is applicable.  Because this module is responsible for selecting\n** indices, you might also think of this module as the \"query optimizer\".\n*/\n#include \"sqliteInt.h\"\n#include \"whereInt.h\"\n\n/* Forward declaration of methods */\nstatic int whereLoopResize(sqlite3*, WhereLoop*, int);\n\n/* Test variable that can be set to enable WHERE tracing */\n#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)\n/***/ int sqlite3WhereTrace = 0;\n#endif\n\n\n/*\n** Return the estimated number of output rows from a WHERE clause\n*/\nLogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){\n  return pWInfo->nRowOut;\n}\n\n/*\n** Return one of the WHERE_DISTINCT_xxxxx values to indicate how this\n** WHERE clause returns outputs for DISTINCT processing.\n*/\nint sqlite3WhereIsDistinct(WhereInfo *pWInfo){\n  return pWInfo->eDistinct;\n}\n\n/*\n** Return TRUE if the WHERE clause returns rows in ORDER BY order.\n** Return FALSE if the output needs to be sorted.\n*/\nint sqlite3WhereIsOrdered(WhereInfo *pWInfo){\n  return pWInfo->nOBSat;\n}\n\n/*\n** Return TRUE if the innermost loop of the WHERE clause implementation\n** returns rows in ORDER BY order for complete run of the inner loop.\n**\n** Across multiple iterations of outer loops, the output rows need not be\n** sorted.  As long as rows are sorted for just the innermost loop, this\n** routine can return TRUE.\n*/\nint sqlite3WhereOrderedInnerLoop(WhereInfo *pWInfo){\n  return pWInfo->bOrderedInnerLoop;\n}\n\n/*\n** Return the VDBE address or label to jump to in order to continue\n** immediately with the next row of a WHERE clause.\n*/\nint sqlite3WhereContinueLabel(WhereInfo *pWInfo){\n  assert( pWInfo->iContinue!=0 );\n  return pWInfo->iContinue;\n}\n\n/*\n** Return the VDBE address or label to jump to in order to break\n** out of a WHERE loop.\n*/\nint sqlite3WhereBreakLabel(WhereInfo *pWInfo){\n  return pWInfo->iBreak;\n}\n\n/*\n** Return ONEPASS_OFF (0) if an UPDATE or DELETE statement is unable to\n** operate directly on the rowis returned by a WHERE clause.  Return\n** ONEPASS_SINGLE (1) if the statement can operation directly because only\n** a single row is to be changed.  Return ONEPASS_MULTI (2) if the one-pass\n** optimization can be used on multiple \n**\n** If the ONEPASS optimization is used (if this routine returns true)\n** then also write the indices of open cursors used by ONEPASS\n** into aiCur[0] and aiCur[1].  iaCur[0] gets the cursor of the data\n** table and iaCur[1] gets the cursor used by an auxiliary index.\n** Either value may be -1, indicating that cursor is not used.\n** Any cursors returned will have been opened for writing.\n**\n** aiCur[0] and aiCur[1] both get -1 if the where-clause logic is\n** unable to use the ONEPASS optimization.\n*/\nint sqlite3WhereOkOnePass(WhereInfo *pWInfo, int *aiCur){\n  memcpy(aiCur, pWInfo->aiCurOnePass, sizeof(int)*2);\n#ifdef WHERETRACE_ENABLED\n  if( sqlite3WhereTrace && pWInfo->eOnePass!=ONEPASS_OFF ){\n    sqlite3DebugPrintf(\"%s cursors: %d %d\\n\",\n         pWInfo->eOnePass==ONEPASS_SINGLE ? \"ONEPASS_SINGLE\" : \"ONEPASS_MULTI\",\n         aiCur[0], aiCur[1]);\n  }\n#endif\n  return pWInfo->eOnePass;\n}\n\n/*\n** Move the content of pSrc into pDest\n*/\nstatic void whereOrMove(WhereOrSet *pDest, WhereOrSet *pSrc){\n  pDest->n = pSrc->n;\n  memcpy(pDest->a, pSrc->a, pDest->n*sizeof(pDest->a[0]));\n}\n\n/*\n** Try to insert a new prerequisite/cost entry into the WhereOrSet pSet.\n**\n** The new entry might overwrite an existing entry, or it might be\n** appended, or it might be discarded.  Do whatever is the right thing\n** so that pSet keeps the N_OR_COST best entries seen so far.\n*/\nstatic int whereOrInsert(\n  WhereOrSet *pSet,      /* The WhereOrSet to be updated */\n  Bitmask prereq,        /* Prerequisites of the new entry */\n  LogEst rRun,           /* Run-cost of the new entry */\n  LogEst nOut            /* Number of outputs for the new entry */\n){\n  u16 i;\n  WhereOrCost *p;\n  for(i=pSet->n, p=pSet->a; i>0; i--, p++){\n    if( rRun<=p->rRun && (prereq & p->prereq)==prereq ){\n      goto whereOrInsert_done;\n    }\n    if( p->rRun<=rRun && (p->prereq & prereq)==p->prereq ){\n      return 0;\n    }\n  }\n  if( pSet->n<N_OR_COST ){\n    p = &pSet->a[pSet->n++];\n    p->nOut = nOut;\n  }else{\n    p = pSet->a;\n    for(i=1; i<pSet->n; i++){\n      if( p->rRun>pSet->a[i].rRun ) p = pSet->a + i;\n    }\n    if( p->rRun<=rRun ) return 0;\n  }\nwhereOrInsert_done:\n  p->prereq = prereq;\n  p->rRun = rRun;\n  if( p->nOut>nOut ) p->nOut = nOut;\n  return 1;\n}\n\n/*\n** Return the bitmask for the given cursor number.  Return 0 if\n** iCursor is not in the set.\n*/\nBitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){\n  int i;\n  assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 );\n  for(i=0; i<pMaskSet->n; i++){\n    if( pMaskSet->ix[i]==iCursor ){\n      return MASKBIT(i);\n    }\n  }\n  return 0;\n}\n\n/*\n** Create a new mask for cursor iCursor.\n**\n** There is one cursor per table in the FROM clause.  The number of\n** tables in the FROM clause is limited by a test early in the\n** sqlite3WhereBegin() routine.  So we know that the pMaskSet->ix[]\n** array will never overflow.\n*/\nstatic void createMask(WhereMaskSet *pMaskSet, int iCursor){\n  assert( pMaskSet->n < ArraySize(pMaskSet->ix) );\n  pMaskSet->ix[pMaskSet->n++] = iCursor;\n}\n\n/*\n** Advance to the next WhereTerm that matches according to the criteria\n** established when the pScan object was initialized by whereScanInit().\n** Return NULL if there are no more matching WhereTerms.\n*/\nstatic WhereTerm *whereScanNext(WhereScan *pScan){\n  int iCur;            /* The cursor on the LHS of the term */\n  i16 iColumn;         /* The column on the LHS of the term.  -1 for IPK */\n  Expr *pX;            /* An expression being tested */\n  WhereClause *pWC;    /* Shorthand for pScan->pWC */\n  WhereTerm *pTerm;    /* The term being tested */\n  int k = pScan->k;    /* Where to start scanning */\n\n  while( pScan->iEquiv<=pScan->nEquiv ){\n    iCur = pScan->aiCur[pScan->iEquiv-1];\n    iColumn = pScan->aiColumn[pScan->iEquiv-1];\n    if( iColumn==XN_EXPR && pScan->pIdxExpr==0 ) return 0;\n    while( (pWC = pScan->pWC)!=0 ){\n      for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){\n        if( pTerm->leftCursor==iCur\n         && pTerm->u.leftColumn==iColumn\n         && (iColumn!=XN_EXPR\n             || sqlite3ExprCompare(pTerm->pExpr->pLeft,pScan->pIdxExpr,iCur)==0)\n         && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))\n        ){\n          if( (pTerm->eOperator & WO_EQUIV)!=0\n           && pScan->nEquiv<ArraySize(pScan->aiCur)\n           && (pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight))->op==TK_COLUMN\n          ){\n            int j;\n            for(j=0; j<pScan->nEquiv; j++){\n              if( pScan->aiCur[j]==pX->iTable\n               && pScan->aiColumn[j]==pX->iColumn ){\n                  break;\n              }\n            }\n            if( j==pScan->nEquiv ){\n              pScan->aiCur[j] = pX->iTable;\n              pScan->aiColumn[j] = pX->iColumn;\n              pScan->nEquiv++;\n            }\n          }\n          if( (pTerm->eOperator & pScan->opMask)!=0 ){\n            /* Verify the affinity and collating sequence match */\n            if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){\n              CollSeq *pColl;\n              Parse *pParse = pWC->pWInfo->pParse;\n              pX = pTerm->pExpr;\n              if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){\n                continue;\n              }\n              assert(pX->pLeft);\n              pColl = sqlite3BinaryCompareCollSeq(pParse,\n                                                  pX->pLeft, pX->pRight);\n              if( pColl==0 ) pColl = pParse->db->pDfltColl;\n              if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){\n                continue;\n              }\n            }\n            if( (pTerm->eOperator & (WO_EQ|WO_IS))!=0\n             && (pX = pTerm->pExpr->pRight)->op==TK_COLUMN\n             && pX->iTable==pScan->aiCur[0]\n             && pX->iColumn==pScan->aiColumn[0]\n            ){\n              testcase( pTerm->eOperator & WO_IS );\n              continue;\n            }\n            pScan->k = k+1;\n            return pTerm;\n          }\n        }\n      }\n      pScan->pWC = pScan->pWC->pOuter;\n      k = 0;\n    }\n    pScan->pWC = pScan->pOrigWC;\n    k = 0;\n    pScan->iEquiv++;\n  }\n  return 0;\n}\n\n/*\n** Initialize a WHERE clause scanner object.  Return a pointer to the\n** first match.  Return NULL if there are no matches.\n**\n** The scanner will be searching the WHERE clause pWC.  It will look\n** for terms of the form \"X <op> <expr>\" where X is column iColumn of table\n** iCur.   Or if pIdx!=0 then X is column iColumn of index pIdx.  pIdx\n** must be one of the indexes of table iCur.\n**\n** The <op> must be one of the operators described by opMask.\n**\n** If the search is for X and the WHERE clause contains terms of the\n** form X=Y then this routine might also return terms of the form\n** \"Y <op> <expr>\".  The number of levels of transitivity is limited,\n** but is enough to handle most commonly occurring SQL statements.\n**\n** If X is not the INTEGER PRIMARY KEY then X must be compatible with\n** index pIdx.\n*/\nstatic WhereTerm *whereScanInit(\n  WhereScan *pScan,       /* The WhereScan object being initialized */\n  WhereClause *pWC,       /* The WHERE clause to be scanned */\n  int iCur,               /* Cursor to scan for */\n  int iColumn,            /* Column to scan for */\n  u32 opMask,             /* Operator(s) to scan for */\n  Index *pIdx             /* Must be compatible with this index */\n){\n  int j = 0;\n\n  /* memset(pScan, 0, sizeof(*pScan)); */\n  pScan->pOrigWC = pWC;\n  pScan->pWC = pWC;\n  pScan->pIdxExpr = 0;\n  if( pIdx ){\n    j = iColumn;\n    iColumn = pIdx->aiColumn[j];\n    if( iColumn==XN_EXPR ) pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr;\n    if( iColumn==pIdx->pTable->iPKey ) iColumn = XN_ROWID;\n  }\n  if( pIdx && iColumn>=0 ){\n    pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity;\n    pScan->zCollName = pIdx->azColl[j];\n  }else{\n    pScan->idxaff = 0;\n    pScan->zCollName = 0;\n  }\n  pScan->opMask = opMask;\n  pScan->k = 0;\n  pScan->aiCur[0] = iCur;\n  pScan->aiColumn[0] = iColumn;\n  pScan->nEquiv = 1;\n  pScan->iEquiv = 1;\n  return whereScanNext(pScan);\n}\n\n/*\n** Search for a term in the WHERE clause that is of the form \"X <op> <expr>\"\n** where X is a reference to the iColumn of table iCur or of index pIdx\n** if pIdx!=0 and <op> is one of the WO_xx operator codes specified by\n** the op parameter.  Return a pointer to the term.  Return 0 if not found.\n**\n** If pIdx!=0 then it must be one of the indexes of table iCur.  \n** Search for terms matching the iColumn-th column of pIdx\n** rather than the iColumn-th column of table iCur.\n**\n** The term returned might by Y=<expr> if there is another constraint in\n** the WHERE clause that specifies that X=Y.  Any such constraints will be\n** identified by the WO_EQUIV bit in the pTerm->eOperator field.  The\n** aiCur[]/iaColumn[] arrays hold X and all its equivalents. There are 11\n** slots in aiCur[]/aiColumn[] so that means we can look for X plus up to 10\n** other equivalent values.  Hence a search for X will return <expr> if X=A1\n** and A1=A2 and A2=A3 and ... and A9=A10 and A10=<expr>.\n**\n** If there are multiple terms in the WHERE clause of the form \"X <op> <expr>\"\n** then try for the one with no dependencies on <expr> - in other words where\n** <expr> is a constant expression of some kind.  Only return entries of\n** the form \"X <op> Y\" where Y is a column in another table if no terms of\n** the form \"X <op> <const-expr>\" exist.   If no terms with a constant RHS\n** exist, try to return a term that does not use WO_EQUIV.\n*/\nWhereTerm *sqlite3WhereFindTerm(\n  WhereClause *pWC,     /* The WHERE clause to be searched */\n  int iCur,             /* Cursor number of LHS */\n  int iColumn,          /* Column number of LHS */\n  Bitmask notReady,     /* RHS must not overlap with this mask */\n  u32 op,               /* Mask of WO_xx values describing operator */\n  Index *pIdx           /* Must be compatible with this index, if not NULL */\n){\n  WhereTerm *pResult = 0;\n  WhereTerm *p;\n  WhereScan scan;\n\n  p = whereScanInit(&scan, pWC, iCur, iColumn, op, pIdx);\n  op &= WO_EQ|WO_IS;\n  while( p ){\n    if( (p->prereqRight & notReady)==0 ){\n      if( p->prereqRight==0 && (p->eOperator&op)!=0 ){\n        testcase( p->eOperator & WO_IS );\n        return p;\n      }\n      if( pResult==0 ) pResult = p;\n    }\n    p = whereScanNext(&scan);\n  }\n  return pResult;\n}\n\n/*\n** This function searches pList for an entry that matches the iCol-th column\n** of index pIdx.\n**\n** If such an expression is found, its index in pList->a[] is returned. If\n** no expression is found, -1 is returned.\n*/\nstatic int findIndexCol(\n  Parse *pParse,                  /* Parse context */\n  ExprList *pList,                /* Expression list to search */\n  int iBase,                      /* Cursor for table associated with pIdx */\n  Index *pIdx,                    /* Index to match column of */\n  int iCol                        /* Column of index to match */\n){\n  int i;\n  const char *zColl = pIdx->azColl[iCol];\n\n  for(i=0; i<pList->nExpr; i++){\n    Expr *p = sqlite3ExprSkipCollate(pList->a[i].pExpr);\n    if( p->op==TK_COLUMN\n     && p->iColumn==pIdx->aiColumn[iCol]\n     && p->iTable==iBase\n    ){\n      CollSeq *pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr);\n      if( pColl && 0==sqlite3StrICmp(pColl->zName, zColl) ){\n        return i;\n      }\n    }\n  }\n\n  return -1;\n}\n\n/*\n** Return TRUE if the iCol-th column of index pIdx is NOT NULL\n*/\nstatic int indexColumnNotNull(Index *pIdx, int iCol){\n  int j;\n  assert( pIdx!=0 );\n  assert( iCol>=0 && iCol<pIdx->nColumn );\n  j = pIdx->aiColumn[iCol];\n  if( j>=0 ){\n    return pIdx->pTable->aCol[j].notNull;\n  }else if( j==(-1) ){\n    return 1;\n  }else{\n    assert( j==(-2) );\n    return 0;  /* Assume an indexed expression can always yield a NULL */\n\n  }\n}\n\n/*\n** Return true if the DISTINCT expression-list passed as the third argument\n** is redundant.\n**\n** A DISTINCT list is redundant if any subset of the columns in the\n** DISTINCT list are collectively unique and individually non-null.\n*/\nstatic int isDistinctRedundant(\n  Parse *pParse,            /* Parsing context */\n  SrcList *pTabList,        /* The FROM clause */\n  WhereClause *pWC,         /* The WHERE clause */\n  ExprList *pDistinct       /* The result set that needs to be DISTINCT */\n){\n  Table *pTab;\n  Index *pIdx;\n  int i;                          \n  int iBase;\n\n  /* If there is more than one table or sub-select in the FROM clause of\n  ** this query, then it will not be possible to show that the DISTINCT \n  ** clause is redundant. */\n  if( pTabList->nSrc!=1 ) return 0;\n  iBase = pTabList->a[0].iCursor;\n  pTab = pTabList->a[0].pTab;\n\n  /* If any of the expressions is an IPK column on table iBase, then return \n  ** true. Note: The (p->iTable==iBase) part of this test may be false if the\n  ** current SELECT is a correlated sub-query.\n  */\n  for(i=0; i<pDistinct->nExpr; i++){\n    Expr *p = sqlite3ExprSkipCollate(pDistinct->a[i].pExpr);\n    if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1;\n  }\n\n  /* Loop through all indices on the table, checking each to see if it makes\n  ** the DISTINCT qualifier redundant. It does so if:\n  **\n  **   1. The index is itself UNIQUE, and\n  **\n  **   2. All of the columns in the index are either part of the pDistinct\n  **      list, or else the WHERE clause contains a term of the form \"col=X\",\n  **      where X is a constant value. The collation sequences of the\n  **      comparison and select-list expressions must match those of the index.\n  **\n  **   3. All of those index columns for which the WHERE clause does not\n  **      contain a \"col=X\" term are subject to a NOT NULL constraint.\n  */\n  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n    if( !IsUniqueIndex(pIdx) ) continue;\n    for(i=0; i<pIdx->nKeyCol; i++){\n      if( 0==sqlite3WhereFindTerm(pWC, iBase, i, ~(Bitmask)0, WO_EQ, pIdx) ){\n        if( findIndexCol(pParse, pDistinct, iBase, pIdx, i)<0 ) break;\n        if( indexColumnNotNull(pIdx, i)==0 ) break;\n      }\n    }\n    if( i==pIdx->nKeyCol ){\n      /* This index implies that the DISTINCT qualifier is redundant. */\n      return 1;\n    }\n  }\n\n  return 0;\n}\n\n\n/*\n** Estimate the logarithm of the input value to base 2.\n*/\nstatic LogEst estLog(LogEst N){\n  return N<=10 ? 0 : sqlite3LogEst(N) - 33;\n}\n\n/*\n** Convert OP_Column opcodes to OP_Copy in previously generated code.\n**\n** This routine runs over generated VDBE code and translates OP_Column\n** opcodes into OP_Copy when the table is being accessed via co-routine \n** instead of via table lookup.\n**\n** If the bIncrRowid parameter is 0, then any OP_Rowid instructions on\n** cursor iTabCur are transformed into OP_Null. Or, if bIncrRowid is non-zero,\n** then each OP_Rowid is transformed into an instruction to increment the\n** value stored in its output register.\n*/\nstatic void translateColumnToCopy(\n  Vdbe *v,            /* The VDBE containing code to translate */\n  int iStart,         /* Translate from this opcode to the end */\n  int iTabCur,        /* OP_Column/OP_Rowid references to this table */\n  int iRegister,      /* The first column is in this register */\n  int bIncrRowid      /* If non-zero, transform OP_rowid to OP_AddImm(1) */\n){\n  VdbeOp *pOp = sqlite3VdbeGetOp(v, iStart);\n  int iEnd = sqlite3VdbeCurrentAddr(v);\n  for(; iStart<iEnd; iStart++, pOp++){\n    if( pOp->p1!=iTabCur ) continue;\n    if( pOp->opcode==OP_Column ){\n      pOp->opcode = OP_Copy;\n      pOp->p1 = pOp->p2 + iRegister;\n      pOp->p2 = pOp->p3;\n      pOp->p3 = 0;\n    }else if( pOp->opcode==OP_Rowid ){\n      if( bIncrRowid ){\n        /* Increment the value stored in the P2 operand of the OP_Rowid. */\n        pOp->opcode = OP_AddImm;\n        pOp->p1 = pOp->p2;\n        pOp->p2 = 1;\n      }else{\n        pOp->opcode = OP_Null;\n        pOp->p1 = 0;\n        pOp->p3 = 0;\n      }\n    }\n  }\n}\n\n/*\n** Two routines for printing the content of an sqlite3_index_info\n** structure.  Used for testing and debugging only.  If neither\n** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines\n** are no-ops.\n*/\n#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED)\nstatic void TRACE_IDX_INPUTS(sqlite3_index_info *p){\n  int i;\n  if( !sqlite3WhereTrace ) return;\n  for(i=0; i<p->nConstraint; i++){\n    sqlite3DebugPrintf(\"  constraint[%d]: col=%d termid=%d op=%d usabled=%d\\n\",\n       i,\n       p->aConstraint[i].iColumn,\n       p->aConstraint[i].iTermOffset,\n       p->aConstraint[i].op,\n       p->aConstraint[i].usable);\n  }\n  for(i=0; i<p->nOrderBy; i++){\n    sqlite3DebugPrintf(\"  orderby[%d]: col=%d desc=%d\\n\",\n       i,\n       p->aOrderBy[i].iColumn,\n       p->aOrderBy[i].desc);\n  }\n}\nstatic void TRACE_IDX_OUTPUTS(sqlite3_index_info *p){\n  int i;\n  if( !sqlite3WhereTrace ) return;\n  for(i=0; i<p->nConstraint; i++){\n    sqlite3DebugPrintf(\"  usage[%d]: argvIdx=%d omit=%d\\n\",\n       i,\n       p->aConstraintUsage[i].argvIndex,\n       p->aConstraintUsage[i].omit);\n  }\n  sqlite3DebugPrintf(\"  idxNum=%d\\n\", p->idxNum);\n  sqlite3DebugPrintf(\"  idxStr=%s\\n\", p->idxStr);\n  sqlite3DebugPrintf(\"  orderByConsumed=%d\\n\", p->orderByConsumed);\n  sqlite3DebugPrintf(\"  estimatedCost=%g\\n\", p->estimatedCost);\n  sqlite3DebugPrintf(\"  estimatedRows=%lld\\n\", p->estimatedRows);\n}\n#else\n#define TRACE_IDX_INPUTS(A)\n#define TRACE_IDX_OUTPUTS(A)\n#endif\n\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\n/*\n** Return TRUE if the WHERE clause term pTerm is of a form where it\n** could be used with an index to access pSrc, assuming an appropriate\n** index existed.\n*/\nstatic int termCanDriveIndex(\n  WhereTerm *pTerm,              /* WHERE clause term to check */\n  struct SrcList_item *pSrc,     /* Table we are trying to access */\n  Bitmask notReady               /* Tables in outer loops of the join */\n){\n  char aff;\n  if( pTerm->leftCursor!=pSrc->iCursor ) return 0;\n  if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;\n  if( (pTerm->prereqRight & notReady)!=0 ) return 0;\n  if( pTerm->u.leftColumn<0 ) return 0;\n  aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity;\n  if( !sqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0;\n  testcase( pTerm->pExpr->op==TK_IS );\n  return 1;\n}\n#endif\n\n\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\n/*\n** Generate code to construct the Index object for an automatic index\n** and to set up the WhereLevel object pLevel so that the code generator\n** makes use of the automatic index.\n*/\nstatic void constructAutomaticIndex(\n  Parse *pParse,              /* The parsing context */\n  WhereClause *pWC,           /* The WHERE clause */\n  struct SrcList_item *pSrc,  /* The FROM clause term to get the next index */\n  Bitmask notReady,           /* Mask of cursors that are not available */\n  WhereLevel *pLevel          /* Write new index here */\n){\n  int nKeyCol;                /* Number of columns in the constructed index */\n  WhereTerm *pTerm;           /* A single term of the WHERE clause */\n  WhereTerm *pWCEnd;          /* End of pWC->a[] */\n  Index *pIdx;                /* Object describing the transient index */\n  Vdbe *v;                    /* Prepared statement under construction */\n  int addrInit;               /* Address of the initialization bypass jump */\n  Table *pTable;              /* The table being indexed */\n  int addrTop;                /* Top of the index fill loop */\n  int regRecord;              /* Register holding an index record */\n  int n;                      /* Column counter */\n  int i;                      /* Loop counter */\n  int mxBitCol;               /* Maximum column in pSrc->colUsed */\n  CollSeq *pColl;             /* Collating sequence to on a column */\n  WhereLoop *pLoop;           /* The Loop object */\n  char *zNotUsed;             /* Extra space on the end of pIdx */\n  Bitmask idxCols;            /* Bitmap of columns used for indexing */\n  Bitmask extraCols;          /* Bitmap of additional columns */\n  u8 sentWarning = 0;         /* True if a warnning has been issued */\n  Expr *pPartial = 0;         /* Partial Index Expression */\n  int iContinue = 0;          /* Jump here to skip excluded rows */\n  struct SrcList_item *pTabItem;  /* FROM clause term being indexed */\n  int addrCounter = 0;        /* Address where integer counter is initialized */\n  int regBase;                /* Array of registers where record is assembled */\n\n  /* Generate code to skip over the creation and initialization of the\n  ** transient index on 2nd and subsequent iterations of the loop. */\n  v = pParse->pVdbe;\n  assert( v!=0 );\n  addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);\n\n  /* Count the number of columns that will be added to the index\n  ** and used to match WHERE clause constraints */\n  nKeyCol = 0;\n  pTable = pSrc->pTab;\n  pWCEnd = &pWC->a[pWC->nTerm];\n  pLoop = pLevel->pWLoop;\n  idxCols = 0;\n  for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){\n    Expr *pExpr = pTerm->pExpr;\n    assert( !ExprHasProperty(pExpr, EP_FromJoin)    /* prereq always non-zero */\n         || pExpr->iRightJoinTable!=pSrc->iCursor   /*   for the right-hand   */\n         || pLoop->prereq!=0 );                     /*   table of a LEFT JOIN */\n    if( pLoop->prereq==0\n     && (pTerm->wtFlags & TERM_VIRTUAL)==0\n     && !ExprHasProperty(pExpr, EP_FromJoin)\n     && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){\n      pPartial = sqlite3ExprAnd(pParse->db, pPartial,\n                                sqlite3ExprDup(pParse->db, pExpr, 0));\n    }\n    if( termCanDriveIndex(pTerm, pSrc, notReady) ){\n      int iCol = pTerm->u.leftColumn;\n      Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);\n      testcase( iCol==BMS );\n      testcase( iCol==BMS-1 );\n      if( !sentWarning ){\n        sqlite3_log(SQLITE_WARNING_AUTOINDEX,\n            \"automatic index on %s(%s)\", pTable->zName,\n            pTable->aCol[iCol].zName);\n        sentWarning = 1;\n      }\n      if( (idxCols & cMask)==0 ){\n        if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){\n          goto end_auto_index_create;\n        }\n        pLoop->aLTerm[nKeyCol++] = pTerm;\n        idxCols |= cMask;\n      }\n    }\n  }\n  assert( nKeyCol>0 );\n  pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;\n  pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED\n                     | WHERE_AUTO_INDEX;\n\n  /* Count the number of additional columns needed to create a\n  ** covering index.  A \"covering index\" is an index that contains all\n  ** columns that are needed by the query.  With a covering index, the\n  ** original table never needs to be accessed.  Automatic indices must\n  ** be a covering index because the index will not be updated if the\n  ** original table changes and the index and table cannot both be used\n  ** if they go out of sync.\n  */\n  extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));\n  mxBitCol = MIN(BMS-1,pTable->nCol);\n  testcase( pTable->nCol==BMS-1 );\n  testcase( pTable->nCol==BMS-2 );\n  for(i=0; i<mxBitCol; i++){\n    if( extraCols & MASKBIT(i) ) nKeyCol++;\n  }\n  if( pSrc->colUsed & MASKBIT(BMS-1) ){\n    nKeyCol += pTable->nCol - BMS + 1;\n  }\n\n  /* Construct the Index object to describe this index */\n  pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);\n  if( pIdx==0 ) goto end_auto_index_create;\n  pLoop->u.btree.pIndex = pIdx;\n  pIdx->zName = \"auto-index\";\n  pIdx->pTable = pTable;\n  n = 0;\n  idxCols = 0;\n  for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){\n    if( termCanDriveIndex(pTerm, pSrc, notReady) ){\n      int iCol = pTerm->u.leftColumn;\n      Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);\n      testcase( iCol==BMS-1 );\n      testcase( iCol==BMS );\n      if( (idxCols & cMask)==0 ){\n        Expr *pX = pTerm->pExpr;\n        idxCols |= cMask;\n        pIdx->aiColumn[n] = pTerm->u.leftColumn;\n        pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);\n        pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;\n        n++;\n      }\n    }\n  }\n  assert( (u32)n==pLoop->u.btree.nEq );\n\n  /* Add additional columns needed to make the automatic index into\n  ** a covering index */\n  for(i=0; i<mxBitCol; i++){\n    if( extraCols & MASKBIT(i) ){\n      pIdx->aiColumn[n] = i;\n      pIdx->azColl[n] = sqlite3StrBINARY;\n      n++;\n    }\n  }\n  if( pSrc->colUsed & MASKBIT(BMS-1) ){\n    for(i=BMS-1; i<pTable->nCol; i++){\n      pIdx->aiColumn[n] = i;\n      pIdx->azColl[n] = sqlite3StrBINARY;\n      n++;\n    }\n  }\n  assert( n==nKeyCol );\n  pIdx->aiColumn[n] = XN_ROWID;\n  pIdx->azColl[n] = sqlite3StrBINARY;\n\n  /* Create the automatic index */\n  assert( pLevel->iIdxCur>=0 );\n  pLevel->iIdxCur = pParse->nTab++;\n  sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);\n  sqlite3VdbeSetP4KeyInfo(pParse, pIdx);\n  VdbeComment((v, \"for %s\", pTable->zName));\n\n  /* Fill the automatic index with content */\n  sqlite3ExprCachePush(pParse);\n  pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];\n  if( pTabItem->fg.viaCoroutine ){\n    int regYield = pTabItem->regReturn;\n    addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);\n    sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);\n    addrTop =  sqlite3VdbeAddOp1(v, OP_Yield, regYield);\n    VdbeCoverage(v);\n    VdbeComment((v, \"next row of \\\"%s\\\"\", pTabItem->pTab->zName));\n  }else{\n    addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);\n  }\n  if( pPartial ){\n    iContinue = sqlite3VdbeMakeLabel(v);\n    sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);\n    pLoop->wsFlags |= WHERE_PARTIALIDX;\n  }\n  regRecord = sqlite3GetTempReg(pParse);\n  regBase = sqlite3GenerateIndexKey(\n      pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0\n  );\n  sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);\n  sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\n  if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);\n  if( pTabItem->fg.viaCoroutine ){\n    sqlite3VdbeChangeP2(v, addrCounter, regBase+n);\n    translateColumnToCopy(v, addrTop, pLevel->iTabCur, pTabItem->regResult, 1);\n    sqlite3VdbeGoto(v, addrTop);\n    pTabItem->fg.viaCoroutine = 0;\n  }else{\n    sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);\n  }\n  sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);\n  sqlite3VdbeJumpHere(v, addrTop);\n  sqlite3ReleaseTempReg(pParse, regRecord);\n  sqlite3ExprCachePop(pParse);\n  \n  /* Jump here when skipping the initialization */\n  sqlite3VdbeJumpHere(v, addrInit);\n\nend_auto_index_create:\n  sqlite3ExprDelete(pParse->db, pPartial);\n}\n#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/*\n** Allocate and populate an sqlite3_index_info structure. It is the \n** responsibility of the caller to eventually release the structure\n** by passing the pointer returned by this function to sqlite3_free().\n*/\nstatic sqlite3_index_info *allocateIndexInfo(\n  Parse *pParse,\n  WhereClause *pWC,\n  Bitmask mUnusable,              /* Ignore terms with these prereqs */\n  struct SrcList_item *pSrc,\n  ExprList *pOrderBy,\n  u16 *pmNoOmit                   /* Mask of terms not to omit */\n){\n  int i, j;\n  int nTerm;\n  struct sqlite3_index_constraint *pIdxCons;\n  struct sqlite3_index_orderby *pIdxOrderBy;\n  struct sqlite3_index_constraint_usage *pUsage;\n  WhereTerm *pTerm;\n  int nOrderBy;\n  sqlite3_index_info *pIdxInfo;\n  u16 mNoOmit = 0;\n\n  /* Count the number of possible WHERE clause constraints referring\n  ** to this virtual table */\n  for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){\n    if( pTerm->leftCursor != pSrc->iCursor ) continue;\n    if( pTerm->prereqRight & mUnusable ) continue;\n    assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );\n    testcase( pTerm->eOperator & WO_IN );\n    testcase( pTerm->eOperator & WO_ISNULL );\n    testcase( pTerm->eOperator & WO_IS );\n    testcase( pTerm->eOperator & WO_ALL );\n    if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue;\n    if( pTerm->wtFlags & TERM_VNULL ) continue;\n    assert( pTerm->u.leftColumn>=(-1) );\n    nTerm++;\n  }\n\n  /* If the ORDER BY clause contains only columns in the current \n  ** virtual table then allocate space for the aOrderBy part of\n  ** the sqlite3_index_info structure.\n  */\n  nOrderBy = 0;\n  if( pOrderBy ){\n    int n = pOrderBy->nExpr;\n    for(i=0; i<n; i++){\n      Expr *pExpr = pOrderBy->a[i].pExpr;\n      if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;\n    }\n    if( i==n){\n      nOrderBy = n;\n    }\n  }\n\n  /* Allocate the sqlite3_index_info structure\n  */\n  pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo)\n                           + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm\n                           + sizeof(*pIdxOrderBy)*nOrderBy );\n  if( pIdxInfo==0 ){\n    sqlite3ErrorMsg(pParse, \"out of memory\");\n    return 0;\n  }\n\n  /* Initialize the structure.  The sqlite3_index_info structure contains\n  ** many fields that are declared \"const\" to prevent xBestIndex from\n  ** changing them.  We have to do some funky casting in order to\n  ** initialize those fields.\n  */\n  pIdxCons = (struct sqlite3_index_constraint*)&pIdxInfo[1];\n  pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm];\n  pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy];\n  *(int*)&pIdxInfo->nConstraint = nTerm;\n  *(int*)&pIdxInfo->nOrderBy = nOrderBy;\n  *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint = pIdxCons;\n  *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy;\n  *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage =\n                                                                   pUsage;\n\n  for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){\n    u8 op;\n    if( pTerm->leftCursor != pSrc->iCursor ) continue;\n    if( pTerm->prereqRight & mUnusable ) continue;\n    assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );\n    testcase( pTerm->eOperator & WO_IN );\n    testcase( pTerm->eOperator & WO_IS );\n    testcase( pTerm->eOperator & WO_ISNULL );\n    testcase( pTerm->eOperator & WO_ALL );\n    if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue;\n    if( pTerm->wtFlags & TERM_VNULL ) continue;\n    assert( pTerm->u.leftColumn>=(-1) );\n    pIdxCons[j].iColumn = pTerm->u.leftColumn;\n    pIdxCons[j].iTermOffset = i;\n    op = (u8)pTerm->eOperator & WO_ALL;\n    if( op==WO_IN ) op = WO_EQ;\n    if( op==WO_MATCH ){\n      op = pTerm->eMatchOp;\n    }\n    pIdxCons[j].op = op;\n    /* The direct assignment in the previous line is possible only because\n    ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical.  The\n    ** following asserts verify this fact. */\n    assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ );\n    assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT );\n    assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE );\n    assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT );\n    assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE );\n    assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH );\n    assert( pTerm->eOperator & (WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) );\n\n    if( op & (WO_LT|WO_LE|WO_GT|WO_GE)\n     && sqlite3ExprIsVector(pTerm->pExpr->pRight) \n    ){\n      if( i<16 ) mNoOmit |= (1 << i);\n      if( op==WO_LT ) pIdxCons[j].op = WO_LE;\n      if( op==WO_GT ) pIdxCons[j].op = WO_GE;\n    }\n\n    j++;\n  }\n  for(i=0; i<nOrderBy; i++){\n    Expr *pExpr = pOrderBy->a[i].pExpr;\n    pIdxOrderBy[i].iColumn = pExpr->iColumn;\n    pIdxOrderBy[i].desc = pOrderBy->a[i].sortOrder;\n  }\n\n  *pmNoOmit = mNoOmit;\n  return pIdxInfo;\n}\n\n/*\n** The table object reference passed as the second argument to this function\n** must represent a virtual table. This function invokes the xBestIndex()\n** method of the virtual table with the sqlite3_index_info object that\n** comes in as the 3rd argument to this function.\n**\n** If an error occurs, pParse is populated with an error message and a\n** non-zero value is returned. Otherwise, 0 is returned and the output\n** part of the sqlite3_index_info structure is left populated.\n**\n** Whether or not an error is returned, it is the responsibility of the\n** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates\n** that this is required.\n*/\nstatic int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){\n  sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;\n  int rc;\n\n  TRACE_IDX_INPUTS(p);\n  rc = pVtab->pModule->xBestIndex(pVtab, p);\n  TRACE_IDX_OUTPUTS(p);\n\n  if( rc!=SQLITE_OK ){\n    if( rc==SQLITE_NOMEM ){\n      sqlite3OomFault(pParse->db);\n    }else if( !pVtab->zErrMsg ){\n      sqlite3ErrorMsg(pParse, \"%s\", sqlite3ErrStr(rc));\n    }else{\n      sqlite3ErrorMsg(pParse, \"%s\", pVtab->zErrMsg);\n    }\n  }\n  sqlite3_free(pVtab->zErrMsg);\n  pVtab->zErrMsg = 0;\n\n#if 0\n  /* This error is now caught by the caller.\n  ** Search for \"xBestIndex malfunction\" below */\n  for(i=0; i<p->nConstraint; i++){\n    if( !p->aConstraint[i].usable && p->aConstraintUsage[i].argvIndex>0 ){\n      sqlite3ErrorMsg(pParse, \n          \"table %s: xBestIndex returned an invalid plan\", pTab->zName);\n    }\n  }\n#endif\n\n  return pParse->nErr;\n}\n#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/*\n** Estimate the location of a particular key among all keys in an\n** index.  Store the results in aStat as follows:\n**\n**    aStat[0]      Est. number of rows less than pRec\n**    aStat[1]      Est. number of rows equal to pRec\n**\n** Return the index of the sample that is the smallest sample that\n** is greater than or equal to pRec. Note that this index is not an index\n** into the aSample[] array - it is an index into a virtual set of samples\n** based on the contents of aSample[] and the number of fields in record \n** pRec. \n*/\nstatic int whereKeyStats(\n  Parse *pParse,              /* Database connection */\n  Index *pIdx,                /* Index to consider domain of */\n  UnpackedRecord *pRec,       /* Vector of values to consider */\n  int roundUp,                /* Round up if true.  Round down if false */\n  tRowcnt *aStat              /* OUT: stats written here */\n){\n  IndexSample *aSample = pIdx->aSample;\n  int iCol;                   /* Index of required stats in anEq[] etc. */\n  int i;                      /* Index of first sample >= pRec */\n  int iSample;                /* Smallest sample larger than or equal to pRec */\n  int iMin = 0;               /* Smallest sample not yet tested */\n  int iTest;                  /* Next sample to test */\n  int res;                    /* Result of comparison operation */\n  int nField;                 /* Number of fields in pRec */\n  tRowcnt iLower = 0;         /* anLt[] + anEq[] of largest sample pRec is > */\n\n#ifndef SQLITE_DEBUG\n  UNUSED_PARAMETER( pParse );\n#endif\n  assert( pRec!=0 );\n  assert( pIdx->nSample>0 );\n  assert( pRec->nField>0 && pRec->nField<=pIdx->nSampleCol );\n\n  /* Do a binary search to find the first sample greater than or equal\n  ** to pRec. If pRec contains a single field, the set of samples to search\n  ** is simply the aSample[] array. If the samples in aSample[] contain more\n  ** than one fields, all fields following the first are ignored.\n  **\n  ** If pRec contains N fields, where N is more than one, then as well as the\n  ** samples in aSample[] (truncated to N fields), the search also has to\n  ** consider prefixes of those samples. For example, if the set of samples\n  ** in aSample is:\n  **\n  **     aSample[0] = (a, 5) \n  **     aSample[1] = (a, 10) \n  **     aSample[2] = (b, 5) \n  **     aSample[3] = (c, 100) \n  **     aSample[4] = (c, 105)\n  **\n  ** Then the search space should ideally be the samples above and the \n  ** unique prefixes [a], [b] and [c]. But since that is hard to organize, \n  ** the code actually searches this set:\n  **\n  **     0: (a) \n  **     1: (a, 5) \n  **     2: (a, 10) \n  **     3: (a, 10) \n  **     4: (b) \n  **     5: (b, 5) \n  **     6: (c) \n  **     7: (c, 100) \n  **     8: (c, 105)\n  **     9: (c, 105)\n  **\n  ** For each sample in the aSample[] array, N samples are present in the\n  ** effective sample array. In the above, samples 0 and 1 are based on \n  ** sample aSample[0]. Samples 2 and 3 on aSample[1] etc.\n  **\n  ** Often, sample i of each block of N effective samples has (i+1) fields.\n  ** Except, each sample may be extended to ensure that it is greater than or\n  ** equal to the previous sample in the array. For example, in the above, \n  ** sample 2 is the first sample of a block of N samples, so at first it \n  ** appears that it should be 1 field in size. However, that would make it \n  ** smaller than sample 1, so the binary search would not work. As a result, \n  ** it is extended to two fields. The duplicates that this creates do not \n  ** cause any problems.\n  */\n  nField = pRec->nField;\n  iCol = 0;\n  iSample = pIdx->nSample * nField;\n  do{\n    int iSamp;                    /* Index in aSample[] of test sample */\n    int n;                        /* Number of fields in test sample */\n\n    iTest = (iMin+iSample)/2;\n    iSamp = iTest / nField;\n    if( iSamp>0 ){\n      /* The proposed effective sample is a prefix of sample aSample[iSamp].\n      ** Specifically, the shortest prefix of at least (1 + iTest%nField) \n      ** fields that is greater than the previous effective sample.  */\n      for(n=(iTest % nField) + 1; n<nField; n++){\n        if( aSample[iSamp-1].anLt[n-1]!=aSample[iSamp].anLt[n-1] ) break;\n      }\n    }else{\n      n = iTest + 1;\n    }\n\n    pRec->nField = n;\n    res = sqlite3VdbeRecordCompare(aSample[iSamp].n, aSample[iSamp].p, pRec);\n    if( res<0 ){\n      iLower = aSample[iSamp].anLt[n-1] + aSample[iSamp].anEq[n-1];\n      iMin = iTest+1;\n    }else if( res==0 && n<nField ){\n      iLower = aSample[iSamp].anLt[n-1];\n      iMin = iTest+1;\n      res = -1;\n    }else{\n      iSample = iTest;\n      iCol = n-1;\n    }\n  }while( res && iMin<iSample );\n  i = iSample / nField;\n\n#ifdef SQLITE_DEBUG\n  /* The following assert statements check that the binary search code\n  ** above found the right answer. This block serves no purpose other\n  ** than to invoke the asserts.  */\n  if( pParse->db->mallocFailed==0 ){\n    if( res==0 ){\n      /* If (res==0) is true, then pRec must be equal to sample i. */\n      assert( i<pIdx->nSample );\n      assert( iCol==nField-1 );\n      pRec->nField = nField;\n      assert( 0==sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec) \n           || pParse->db->mallocFailed \n      );\n    }else{\n      /* Unless i==pIdx->nSample, indicating that pRec is larger than\n      ** all samples in the aSample[] array, pRec must be smaller than the\n      ** (iCol+1) field prefix of sample i.  */\n      assert( i<=pIdx->nSample && i>=0 );\n      pRec->nField = iCol+1;\n      assert( i==pIdx->nSample \n           || sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec)>0\n           || pParse->db->mallocFailed );\n\n      /* if i==0 and iCol==0, then record pRec is smaller than all samples\n      ** in the aSample[] array. Otherwise, if (iCol>0) then pRec must\n      ** be greater than or equal to the (iCol) field prefix of sample i.\n      ** If (i>0), then pRec must also be greater than sample (i-1).  */\n      if( iCol>0 ){\n        pRec->nField = iCol;\n        assert( sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec)<=0\n             || pParse->db->mallocFailed );\n      }\n      if( i>0 ){\n        pRec->nField = nField;\n        assert( sqlite3VdbeRecordCompare(aSample[i-1].n, aSample[i-1].p, pRec)<0\n             || pParse->db->mallocFailed );\n      }\n    }\n  }\n#endif /* ifdef SQLITE_DEBUG */\n\n  if( res==0 ){\n    /* Record pRec is equal to sample i */\n    assert( iCol==nField-1 );\n    aStat[0] = aSample[i].anLt[iCol];\n    aStat[1] = aSample[i].anEq[iCol];\n  }else{\n    /* At this point, the (iCol+1) field prefix of aSample[i] is the first \n    ** sample that is greater than pRec. Or, if i==pIdx->nSample then pRec\n    ** is larger than all samples in the array. */\n    tRowcnt iUpper, iGap;\n    if( i>=pIdx->nSample ){\n      iUpper = sqlite3LogEstToInt(pIdx->aiRowLogEst[0]);\n    }else{\n      iUpper = aSample[i].anLt[iCol];\n    }\n\n    if( iLower>=iUpper ){\n      iGap = 0;\n    }else{\n      iGap = iUpper - iLower;\n    }\n    if( roundUp ){\n      iGap = (iGap*2)/3;\n    }else{\n      iGap = iGap/3;\n    }\n    aStat[0] = iLower + iGap;\n    aStat[1] = pIdx->aAvgEq[iCol];\n  }\n\n  /* Restore the pRec->nField value before returning.  */\n  pRec->nField = nField;\n  return i;\n}\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n/*\n** If it is not NULL, pTerm is a term that provides an upper or lower\n** bound on a range scan. Without considering pTerm, it is estimated \n** that the scan will visit nNew rows. This function returns the number\n** estimated to be visited after taking pTerm into account.\n**\n** If the user explicitly specified a likelihood() value for this term,\n** then the return value is the likelihood multiplied by the number of\n** input rows. Otherwise, this function assumes that an \"IS NOT NULL\" term\n** has a likelihood of 0.50, and any other term a likelihood of 0.25.\n*/\nstatic LogEst whereRangeAdjust(WhereTerm *pTerm, LogEst nNew){\n  LogEst nRet = nNew;\n  if( pTerm ){\n    if( pTerm->truthProb<=0 ){\n      nRet += pTerm->truthProb;\n    }else if( (pTerm->wtFlags & TERM_VNULL)==0 ){\n      nRet -= 20;        assert( 20==sqlite3LogEst(4) );\n    }\n  }\n  return nRet;\n}\n\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/*\n** Return the affinity for a single column of an index.\n*/\nchar sqlite3IndexColumnAffinity(sqlite3 *db, Index *pIdx, int iCol){\n  assert( iCol>=0 && iCol<pIdx->nColumn );\n  if( !pIdx->zColAff ){\n    if( sqlite3IndexAffinityStr(db, pIdx)==0 ) return SQLITE_AFF_BLOB;\n  }\n  return pIdx->zColAff[iCol];\n}\n#endif\n\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/* \n** This function is called to estimate the number of rows visited by a\n** range-scan on a skip-scan index. For example:\n**\n**   CREATE INDEX i1 ON t1(a, b, c);\n**   SELECT * FROM t1 WHERE a=? AND c BETWEEN ? AND ?;\n**\n** Value pLoop->nOut is currently set to the estimated number of rows \n** visited for scanning (a=? AND b=?). This function reduces that estimate \n** by some factor to account for the (c BETWEEN ? AND ?) expression based\n** on the stat4 data for the index. this scan will be peformed multiple \n** times (once for each (a,b) combination that matches a=?) is dealt with \n** by the caller.\n**\n** It does this by scanning through all stat4 samples, comparing values\n** extracted from pLower and pUpper with the corresponding column in each\n** sample. If L and U are the number of samples found to be less than or\n** equal to the values extracted from pLower and pUpper respectively, and\n** N is the total number of samples, the pLoop->nOut value is adjusted\n** as follows:\n**\n**   nOut = nOut * ( min(U - L, 1) / N )\n**\n** If pLower is NULL, or a value cannot be extracted from the term, L is\n** set to zero. If pUpper is NULL, or a value cannot be extracted from it,\n** U is set to N.\n**\n** Normally, this function sets *pbDone to 1 before returning. However,\n** if no value can be extracted from either pLower or pUpper (and so the\n** estimate of the number of rows delivered remains unchanged), *pbDone\n** is left as is.\n**\n** If an error occurs, an SQLite error code is returned. Otherwise, \n** SQLITE_OK.\n*/\nstatic int whereRangeSkipScanEst(\n  Parse *pParse,       /* Parsing & code generating context */\n  WhereTerm *pLower,   /* Lower bound on the range. ex: \"x>123\" Might be NULL */\n  WhereTerm *pUpper,   /* Upper bound on the range. ex: \"x<455\" Might be NULL */\n  WhereLoop *pLoop,    /* Update the .nOut value of this loop */\n  int *pbDone          /* Set to true if at least one expr. value extracted */\n){\n  Index *p = pLoop->u.btree.pIndex;\n  int nEq = pLoop->u.btree.nEq;\n  sqlite3 *db = pParse->db;\n  int nLower = -1;\n  int nUpper = p->nSample+1;\n  int rc = SQLITE_OK;\n  u8 aff = sqlite3IndexColumnAffinity(db, p, nEq);\n  CollSeq *pColl;\n  \n  sqlite3_value *p1 = 0;          /* Value extracted from pLower */\n  sqlite3_value *p2 = 0;          /* Value extracted from pUpper */\n  sqlite3_value *pVal = 0;        /* Value extracted from record */\n\n  pColl = sqlite3LocateCollSeq(pParse, p->azColl[nEq]);\n  if( pLower ){\n    rc = sqlite3Stat4ValueFromExpr(pParse, pLower->pExpr->pRight, aff, &p1);\n    nLower = 0;\n  }\n  if( pUpper && rc==SQLITE_OK ){\n    rc = sqlite3Stat4ValueFromExpr(pParse, pUpper->pExpr->pRight, aff, &p2);\n    nUpper = p2 ? 0 : p->nSample;\n  }\n\n  if( p1 || p2 ){\n    int i;\n    int nDiff;\n    for(i=0; rc==SQLITE_OK && i<p->nSample; i++){\n      rc = sqlite3Stat4Column(db, p->aSample[i].p, p->aSample[i].n, nEq, &pVal);\n      if( rc==SQLITE_OK && p1 ){\n        int res = sqlite3MemCompare(p1, pVal, pColl);\n        if( res>=0 ) nLower++;\n      }\n      if( rc==SQLITE_OK && p2 ){\n        int res = sqlite3MemCompare(p2, pVal, pColl);\n        if( res>=0 ) nUpper++;\n      }\n    }\n    nDiff = (nUpper - nLower);\n    if( nDiff<=0 ) nDiff = 1;\n\n    /* If there is both an upper and lower bound specified, and the \n    ** comparisons indicate that they are close together, use the fallback\n    ** method (assume that the scan visits 1/64 of the rows) for estimating\n    ** the number of rows visited. Otherwise, estimate the number of rows\n    ** using the method described in the header comment for this function. */\n    if( nDiff!=1 || pUpper==0 || pLower==0 ){\n      int nAdjust = (sqlite3LogEst(p->nSample) - sqlite3LogEst(nDiff));\n      pLoop->nOut -= nAdjust;\n      *pbDone = 1;\n      WHERETRACE(0x10, (\"range skip-scan regions: %u..%u  adjust=%d est=%d\\n\",\n                           nLower, nUpper, nAdjust*-1, pLoop->nOut));\n    }\n\n  }else{\n    assert( *pbDone==0 );\n  }\n\n  sqlite3ValueFree(p1);\n  sqlite3ValueFree(p2);\n  sqlite3ValueFree(pVal);\n\n  return rc;\n}\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n/*\n** This function is used to estimate the number of rows that will be visited\n** by scanning an index for a range of values. The range may have an upper\n** bound, a lower bound, or both. The WHERE clause terms that set the upper\n** and lower bounds are represented by pLower and pUpper respectively. For\n** example, assuming that index p is on t1(a):\n**\n**   ... FROM t1 WHERE a > ? AND a < ? ...\n**                    |_____|   |_____|\n**                       |         |\n**                     pLower    pUpper\n**\n** If either of the upper or lower bound is not present, then NULL is passed in\n** place of the corresponding WhereTerm.\n**\n** The value in (pBuilder->pNew->u.btree.nEq) is the number of the index\n** column subject to the range constraint. Or, equivalently, the number of\n** equality constraints optimized by the proposed index scan. For example,\n** assuming index p is on t1(a, b), and the SQL query is:\n**\n**   ... FROM t1 WHERE a = ? AND b > ? AND b < ? ...\n**\n** then nEq is set to 1 (as the range restricted column, b, is the second \n** left-most column of the index). Or, if the query is:\n**\n**   ... FROM t1 WHERE a > ? AND a < ? ...\n**\n** then nEq is set to 0.\n**\n** When this function is called, *pnOut is set to the sqlite3LogEst() of the\n** number of rows that the index scan is expected to visit without \n** considering the range constraints. If nEq is 0, then *pnOut is the number of \n** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced)\n** to account for the range constraints pLower and pUpper.\n** \n** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be\n** used, a single range inequality reduces the search space by a factor of 4. \n** and a pair of constraints (x>? AND x<?) reduces the expected number of\n** rows visited by a factor of 64.\n*/\nstatic int whereRangeScanEst(\n  Parse *pParse,       /* Parsing & code generating context */\n  WhereLoopBuilder *pBuilder,\n  WhereTerm *pLower,   /* Lower bound on the range. ex: \"x>123\" Might be NULL */\n  WhereTerm *pUpper,   /* Upper bound on the range. ex: \"x<455\" Might be NULL */\n  WhereLoop *pLoop     /* Modify the .nOut and maybe .rRun fields */\n){\n  int rc = SQLITE_OK;\n  int nOut = pLoop->nOut;\n  LogEst nNew;\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  Index *p = pLoop->u.btree.pIndex;\n  int nEq = pLoop->u.btree.nEq;\n\n  if( p->nSample>0 && nEq<p->nSampleCol ){\n    if( nEq==pBuilder->nRecValid ){\n      UnpackedRecord *pRec = pBuilder->pRec;\n      tRowcnt a[2];\n      int nBtm = pLoop->u.btree.nBtm;\n      int nTop = pLoop->u.btree.nTop;\n\n      /* Variable iLower will be set to the estimate of the number of rows in \n      ** the index that are less than the lower bound of the range query. The\n      ** lower bound being the concatenation of $P and $L, where $P is the\n      ** key-prefix formed by the nEq values matched against the nEq left-most\n      ** columns of the index, and $L is the value in pLower.\n      **\n      ** Or, if pLower is NULL or $L cannot be extracted from it (because it\n      ** is not a simple variable or literal value), the lower bound of the\n      ** range is $P. Due to a quirk in the way whereKeyStats() works, even\n      ** if $L is available, whereKeyStats() is called for both ($P) and \n      ** ($P:$L) and the larger of the two returned values is used.\n      **\n      ** Similarly, iUpper is to be set to the estimate of the number of rows\n      ** less than the upper bound of the range query. Where the upper bound\n      ** is either ($P) or ($P:$U). Again, even if $U is available, both values\n      ** of iUpper are requested of whereKeyStats() and the smaller used.\n      **\n      ** The number of rows between the two bounds is then just iUpper-iLower.\n      */\n      tRowcnt iLower;     /* Rows less than the lower bound */\n      tRowcnt iUpper;     /* Rows less than the upper bound */\n      int iLwrIdx = -2;   /* aSample[] for the lower bound */\n      int iUprIdx = -1;   /* aSample[] for the upper bound */\n\n      if( pRec ){\n        testcase( pRec->nField!=pBuilder->nRecValid );\n        pRec->nField = pBuilder->nRecValid;\n      }\n      /* Determine iLower and iUpper using ($P) only. */\n      if( nEq==0 ){\n        iLower = 0;\n        iUpper = p->nRowEst0;\n      }else{\n        /* Note: this call could be optimized away - since the same values must \n        ** have been requested when testing key $P in whereEqualScanEst().  */\n        whereKeyStats(pParse, p, pRec, 0, a);\n        iLower = a[0];\n        iUpper = a[0] + a[1];\n      }\n\n      assert( pLower==0 || (pLower->eOperator & (WO_GT|WO_GE))!=0 );\n      assert( pUpper==0 || (pUpper->eOperator & (WO_LT|WO_LE))!=0 );\n      assert( p->aSortOrder!=0 );\n      if( p->aSortOrder[nEq] ){\n        /* The roles of pLower and pUpper are swapped for a DESC index */\n        SWAP(WhereTerm*, pLower, pUpper);\n        SWAP(int, nBtm, nTop);\n      }\n\n      /* If possible, improve on the iLower estimate using ($P:$L). */\n      if( pLower ){\n        int n;                    /* Values extracted from pExpr */\n        Expr *pExpr = pLower->pExpr->pRight;\n        rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nBtm, nEq, &n);\n        if( rc==SQLITE_OK && n ){\n          tRowcnt iNew;\n          u16 mask = WO_GT|WO_LE;\n          if( sqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT);\n          iLwrIdx = whereKeyStats(pParse, p, pRec, 0, a);\n          iNew = a[0] + ((pLower->eOperator & mask) ? a[1] : 0);\n          if( iNew>iLower ) iLower = iNew;\n          nOut--;\n          pLower = 0;\n        }\n      }\n\n      /* If possible, improve on the iUpper estimate using ($P:$U). */\n      if( pUpper ){\n        int n;                    /* Values extracted from pExpr */\n        Expr *pExpr = pUpper->pExpr->pRight;\n        rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nTop, nEq, &n);\n        if( rc==SQLITE_OK && n ){\n          tRowcnt iNew;\n          u16 mask = WO_GT|WO_LE;\n          if( sqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT);\n          iUprIdx = whereKeyStats(pParse, p, pRec, 1, a);\n          iNew = a[0] + ((pUpper->eOperator & mask) ? a[1] : 0);\n          if( iNew<iUpper ) iUpper = iNew;\n          nOut--;\n          pUpper = 0;\n        }\n      }\n\n      pBuilder->pRec = pRec;\n      if( rc==SQLITE_OK ){\n        if( iUpper>iLower ){\n          nNew = sqlite3LogEst(iUpper - iLower);\n          /* TUNING:  If both iUpper and iLower are derived from the same\n          ** sample, then assume they are 4x more selective.  This brings\n          ** the estimated selectivity more in line with what it would be\n          ** if estimated without the use of STAT3/4 tables. */\n          if( iLwrIdx==iUprIdx ) nNew -= 20;  assert( 20==sqlite3LogEst(4) );\n        }else{\n          nNew = 10;        assert( 10==sqlite3LogEst(2) );\n        }\n        if( nNew<nOut ){\n          nOut = nNew;\n        }\n        WHERETRACE(0x10, (\"STAT4 range scan: %u..%u  est=%d\\n\",\n                           (u32)iLower, (u32)iUpper, nOut));\n      }\n    }else{\n      int bDone = 0;\n      rc = whereRangeSkipScanEst(pParse, pLower, pUpper, pLoop, &bDone);\n      if( bDone ) return rc;\n    }\n  }\n#else\n  UNUSED_PARAMETER(pParse);\n  UNUSED_PARAMETER(pBuilder);\n  assert( pLower || pUpper );\n#endif\n  assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 );\n  nNew = whereRangeAdjust(pLower, nOut);\n  nNew = whereRangeAdjust(pUpper, nNew);\n\n  /* TUNING: If there is both an upper and lower limit and neither limit\n  ** has an application-defined likelihood(), assume the range is\n  ** reduced by an additional 75%. This means that, by default, an open-ended\n  ** range query (e.g. col > ?) is assumed to match 1/4 of the rows in the\n  ** index. While a closed range (e.g. col BETWEEN ? AND ?) is estimated to\n  ** match 1/64 of the index. */ \n  if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){\n    nNew -= 20;\n  }\n\n  nOut -= (pLower!=0) + (pUpper!=0);\n  if( nNew<10 ) nNew = 10;\n  if( nNew<nOut ) nOut = nNew;\n#if defined(WHERETRACE_ENABLED)\n  if( pLoop->nOut>nOut ){\n    WHERETRACE(0x10,(\"Range scan lowers nOut from %d to %d\\n\",\n                    pLoop->nOut, nOut));\n  }\n#endif\n  pLoop->nOut = (LogEst)nOut;\n  return rc;\n}\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/*\n** Estimate the number of rows that will be returned based on\n** an equality constraint x=VALUE and where that VALUE occurs in\n** the histogram data.  This only works when x is the left-most\n** column of an index and sqlite_stat3 histogram data is available\n** for that index.  When pExpr==NULL that means the constraint is\n** \"x IS NULL\" instead of \"x=VALUE\".\n**\n** Write the estimated row count into *pnRow and return SQLITE_OK. \n** If unable to make an estimate, leave *pnRow unchanged and return\n** non-zero.\n**\n** This routine can fail if it is unable to load a collating sequence\n** required for string comparison, or if unable to allocate memory\n** for a UTF conversion required for comparison.  The error is stored\n** in the pParse structure.\n*/\nstatic int whereEqualScanEst(\n  Parse *pParse,       /* Parsing & code generating context */\n  WhereLoopBuilder *pBuilder,\n  Expr *pExpr,         /* Expression for VALUE in the x=VALUE constraint */\n  tRowcnt *pnRow       /* Write the revised row estimate here */\n){\n  Index *p = pBuilder->pNew->u.btree.pIndex;\n  int nEq = pBuilder->pNew->u.btree.nEq;\n  UnpackedRecord *pRec = pBuilder->pRec;\n  int rc;                   /* Subfunction return code */\n  tRowcnt a[2];             /* Statistics */\n  int bOk;\n\n  assert( nEq>=1 );\n  assert( nEq<=p->nColumn );\n  assert( p->aSample!=0 );\n  assert( p->nSample>0 );\n  assert( pBuilder->nRecValid<nEq );\n\n  /* If values are not available for all fields of the index to the left\n  ** of this one, no estimate can be made. Return SQLITE_NOTFOUND. */\n  if( pBuilder->nRecValid<(nEq-1) ){\n    return SQLITE_NOTFOUND;\n  }\n\n  /* This is an optimization only. The call to sqlite3Stat4ProbeSetValue()\n  ** below would return the same value.  */\n  if( nEq>=p->nColumn ){\n    *pnRow = 1;\n    return SQLITE_OK;\n  }\n\n  rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, 1, nEq-1, &bOk);\n  pBuilder->pRec = pRec;\n  if( rc!=SQLITE_OK ) return rc;\n  if( bOk==0 ) return SQLITE_NOTFOUND;\n  pBuilder->nRecValid = nEq;\n\n  whereKeyStats(pParse, p, pRec, 0, a);\n  WHERETRACE(0x10,(\"equality scan regions %s(%d): %d\\n\",\n                   p->zName, nEq-1, (int)a[1]));\n  *pnRow = a[1];\n  \n  return rc;\n}\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n/*\n** Estimate the number of rows that will be returned based on\n** an IN constraint where the right-hand side of the IN operator\n** is a list of values.  Example:\n**\n**        WHERE x IN (1,2,3,4)\n**\n** Write the estimated row count into *pnRow and return SQLITE_OK. \n** If unable to make an estimate, leave *pnRow unchanged and return\n** non-zero.\n**\n** This routine can fail if it is unable to load a collating sequence\n** required for string comparison, or if unable to allocate memory\n** for a UTF conversion required for comparison.  The error is stored\n** in the pParse structure.\n*/\nstatic int whereInScanEst(\n  Parse *pParse,       /* Parsing & code generating context */\n  WhereLoopBuilder *pBuilder,\n  ExprList *pList,     /* The value list on the RHS of \"x IN (v1,v2,v3,...)\" */\n  tRowcnt *pnRow       /* Write the revised row estimate here */\n){\n  Index *p = pBuilder->pNew->u.btree.pIndex;\n  i64 nRow0 = sqlite3LogEstToInt(p->aiRowLogEst[0]);\n  int nRecValid = pBuilder->nRecValid;\n  int rc = SQLITE_OK;     /* Subfunction return code */\n  tRowcnt nEst;           /* Number of rows for a single term */\n  tRowcnt nRowEst = 0;    /* New estimate of the number of rows */\n  int i;                  /* Loop counter */\n\n  assert( p->aSample!=0 );\n  for(i=0; rc==SQLITE_OK && i<pList->nExpr; i++){\n    nEst = nRow0;\n    rc = whereEqualScanEst(pParse, pBuilder, pList->a[i].pExpr, &nEst);\n    nRowEst += nEst;\n    pBuilder->nRecValid = nRecValid;\n  }\n\n  if( rc==SQLITE_OK ){\n    if( nRowEst > nRow0 ) nRowEst = nRow0;\n    *pnRow = nRowEst;\n    WHERETRACE(0x10,(\"IN row estimate: est=%d\\n\", nRowEst));\n  }\n  assert( pBuilder->nRecValid==nRecValid );\n  return rc;\n}\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n\n#ifdef WHERETRACE_ENABLED\n/*\n** Print the content of a WhereTerm object\n*/\nstatic void whereTermPrint(WhereTerm *pTerm, int iTerm){\n  if( pTerm==0 ){\n    sqlite3DebugPrintf(\"TERM-%-3d NULL\\n\", iTerm);\n  }else{\n    char zType[4];\n    char zLeft[50];\n    memcpy(zType, \"...\", 4);\n    if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V';\n    if( pTerm->eOperator & WO_EQUIV  ) zType[1] = 'E';\n    if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L';\n    if( pTerm->eOperator & WO_SINGLE ){\n      sqlite3_snprintf(sizeof(zLeft),zLeft,\"left={%d:%d}\",\n                       pTerm->leftCursor, pTerm->u.leftColumn);\n    }else if( (pTerm->eOperator & WO_OR)!=0 && pTerm->u.pOrInfo!=0 ){\n      sqlite3_snprintf(sizeof(zLeft),zLeft,\"indexable=0x%lld\", \n                       pTerm->u.pOrInfo->indexable);\n    }else{\n      sqlite3_snprintf(sizeof(zLeft),zLeft,\"left=%d\", pTerm->leftCursor);\n    }\n    sqlite3DebugPrintf(\n       \"TERM-%-3d %p %s %-12s prob=%-3d op=0x%03x wtFlags=0x%04x\",\n       iTerm, pTerm, zType, zLeft, pTerm->truthProb,\n       pTerm->eOperator, pTerm->wtFlags);\n    if( pTerm->iField ){\n      sqlite3DebugPrintf(\" iField=%d\\n\", pTerm->iField);\n    }else{\n      sqlite3DebugPrintf(\"\\n\");\n    }\n    sqlite3TreeViewExpr(0, pTerm->pExpr, 0);\n  }\n}\n#endif\n\n#ifdef WHERETRACE_ENABLED\n/*\n** Show the complete content of a WhereClause\n*/\nvoid sqlite3WhereClausePrint(WhereClause *pWC){\n  int i;\n  for(i=0; i<pWC->nTerm; i++){\n    whereTermPrint(&pWC->a[i], i);\n  }\n}\n#endif\n\n#ifdef WHERETRACE_ENABLED\n/*\n** Print a WhereLoop object for debugging purposes\n*/\nstatic void whereLoopPrint(WhereLoop *p, WhereClause *pWC){\n  WhereInfo *pWInfo = pWC->pWInfo;\n  int nb = 1+(pWInfo->pTabList->nSrc+3)/4;\n  struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab;\n  Table *pTab = pItem->pTab;\n  Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1;\n  sqlite3DebugPrintf(\"%c%2d.%0*llx.%0*llx\", p->cId,\n                     p->iTab, nb, p->maskSelf, nb, p->prereq & mAll);\n  sqlite3DebugPrintf(\" %12s\",\n                     pItem->zAlias ? pItem->zAlias : pTab->zName);\n  if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){\n    const char *zName;\n    if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){\n      if( strncmp(zName, \"sqlite_autoindex_\", 17)==0 ){\n        int i = sqlite3Strlen30(zName) - 1;\n        while( zName[i]!='_' ) i--;\n        zName += i;\n      }\n      sqlite3DebugPrintf(\".%-16s %2d\", zName, p->u.btree.nEq);\n    }else{\n      sqlite3DebugPrintf(\"%20s\",\"\");\n    }\n  }else{\n    char *z;\n    if( p->u.vtab.idxStr ){\n      z = sqlite3_mprintf(\"(%d,\\\"%s\\\",%x)\",\n                p->u.vtab.idxNum, p->u.vtab.idxStr, p->u.vtab.omitMask);\n    }else{\n      z = sqlite3_mprintf(\"(%d,%x)\", p->u.vtab.idxNum, p->u.vtab.omitMask);\n    }\n    sqlite3DebugPrintf(\" %-19s\", z);\n    sqlite3_free(z);\n  }\n  if( p->wsFlags & WHERE_SKIPSCAN ){\n    sqlite3DebugPrintf(\" f %05x %d-%d\", p->wsFlags, p->nLTerm,p->nSkip);\n  }else{\n    sqlite3DebugPrintf(\" f %05x N %d\", p->wsFlags, p->nLTerm);\n  }\n  sqlite3DebugPrintf(\" cost %d,%d,%d\\n\", p->rSetup, p->rRun, p->nOut);\n  if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){\n    int i;\n    for(i=0; i<p->nLTerm; i++){\n      whereTermPrint(p->aLTerm[i], i);\n    }\n  }\n}\n#endif\n\n/*\n** Convert bulk memory into a valid WhereLoop that can be passed\n** to whereLoopClear harmlessly.\n*/\nstatic void whereLoopInit(WhereLoop *p){\n  p->aLTerm = p->aLTermSpace;\n  p->nLTerm = 0;\n  p->nLSlot = ArraySize(p->aLTermSpace);\n  p->wsFlags = 0;\n}\n\n/*\n** Clear the WhereLoop.u union.  Leave WhereLoop.pLTerm intact.\n*/\nstatic void whereLoopClearUnion(sqlite3 *db, WhereLoop *p){\n  if( p->wsFlags & (WHERE_VIRTUALTABLE|WHERE_AUTO_INDEX) ){\n    if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 && p->u.vtab.needFree ){\n      sqlite3_free(p->u.vtab.idxStr);\n      p->u.vtab.needFree = 0;\n      p->u.vtab.idxStr = 0;\n    }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){\n      sqlite3DbFree(db, p->u.btree.pIndex->zColAff);\n      sqlite3DbFree(db, p->u.btree.pIndex);\n      p->u.btree.pIndex = 0;\n    }\n  }\n}\n\n/*\n** Deallocate internal memory used by a WhereLoop object\n*/\nstatic void whereLoopClear(sqlite3 *db, WhereLoop *p){\n  if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFree(db, p->aLTerm);\n  whereLoopClearUnion(db, p);\n  whereLoopInit(p);\n}\n\n/*\n** Increase the memory allocation for pLoop->aLTerm[] to be at least n.\n*/\nstatic int whereLoopResize(sqlite3 *db, WhereLoop *p, int n){\n  WhereTerm **paNew;\n  if( p->nLSlot>=n ) return SQLITE_OK;\n  n = (n+7)&~7;\n  paNew = sqlite3DbMallocRawNN(db, sizeof(p->aLTerm[0])*n);\n  if( paNew==0 ) return SQLITE_NOMEM_BKPT;\n  memcpy(paNew, p->aLTerm, sizeof(p->aLTerm[0])*p->nLSlot);\n  if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFree(db, p->aLTerm);\n  p->aLTerm = paNew;\n  p->nLSlot = n;\n  return SQLITE_OK;\n}\n\n/*\n** Transfer content from the second pLoop into the first.\n*/\nstatic int whereLoopXfer(sqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){\n  whereLoopClearUnion(db, pTo);\n  if( whereLoopResize(db, pTo, pFrom->nLTerm) ){\n    memset(&pTo->u, 0, sizeof(pTo->u));\n    return SQLITE_NOMEM_BKPT;\n  }\n  memcpy(pTo, pFrom, WHERE_LOOP_XFER_SZ);\n  memcpy(pTo->aLTerm, pFrom->aLTerm, pTo->nLTerm*sizeof(pTo->aLTerm[0]));\n  if( pFrom->wsFlags & WHERE_VIRTUALTABLE ){\n    pFrom->u.vtab.needFree = 0;\n  }else if( (pFrom->wsFlags & WHERE_AUTO_INDEX)!=0 ){\n    pFrom->u.btree.pIndex = 0;\n  }\n  return SQLITE_OK;\n}\n\n/*\n** Delete a WhereLoop object\n*/\nstatic void whereLoopDelete(sqlite3 *db, WhereLoop *p){\n  whereLoopClear(db, p);\n  sqlite3DbFree(db, p);\n}\n\n/*\n** Free a WhereInfo structure\n*/\nstatic void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){\n  if( ALWAYS(pWInfo) ){\n    int i;\n    for(i=0; i<pWInfo->nLevel; i++){\n      WhereLevel *pLevel = &pWInfo->a[i];\n      if( pLevel->pWLoop && (pLevel->pWLoop->wsFlags & WHERE_IN_ABLE) ){\n        sqlite3DbFree(db, pLevel->u.in.aInLoop);\n      }\n    }\n    sqlite3WhereClauseClear(&pWInfo->sWC);\n    while( pWInfo->pLoops ){\n      WhereLoop *p = pWInfo->pLoops;\n      pWInfo->pLoops = p->pNextLoop;\n      whereLoopDelete(db, p);\n    }\n    sqlite3DbFree(db, pWInfo);\n  }\n}\n\n/*\n** Return TRUE if all of the following are true:\n**\n**   (1)  X has the same or lower cost that Y\n**   (2)  X is a proper subset of Y\n**   (3)  X skips at least as many columns as Y\n**\n** By \"proper subset\" we mean that X uses fewer WHERE clause terms\n** than Y and that every WHERE clause term used by X is also used\n** by Y.\n**\n** If X is a proper subset of Y then Y is a better choice and ought\n** to have a lower cost.  This routine returns TRUE when that cost \n** relationship is inverted and needs to be adjusted.  The third rule\n** was added because if X uses skip-scan less than Y it still might\n** deserve a lower cost even if it is a proper subset of Y.\n*/\nstatic int whereLoopCheaperProperSubset(\n  const WhereLoop *pX,       /* First WhereLoop to compare */\n  const WhereLoop *pY        /* Compare against this WhereLoop */\n){\n  int i, j;\n  if( pX->nLTerm-pX->nSkip >= pY->nLTerm-pY->nSkip ){\n    return 0; /* X is not a subset of Y */\n  }\n  if( pY->nSkip > pX->nSkip ) return 0;\n  if( pX->rRun >= pY->rRun ){\n    if( pX->rRun > pY->rRun ) return 0;    /* X costs more than Y */\n    if( pX->nOut > pY->nOut ) return 0;    /* X costs more than Y */\n  }\n  for(i=pX->nLTerm-1; i>=0; i--){\n    if( pX->aLTerm[i]==0 ) continue;\n    for(j=pY->nLTerm-1; j>=0; j--){\n      if( pY->aLTerm[j]==pX->aLTerm[i] ) break;\n    }\n    if( j<0 ) return 0;  /* X not a subset of Y since term X[i] not used by Y */\n  }\n  return 1;  /* All conditions meet */\n}\n\n/*\n** Try to adjust the cost of WhereLoop pTemplate upwards or downwards so\n** that:\n**\n**   (1) pTemplate costs less than any other WhereLoops that are a proper\n**       subset of pTemplate\n**\n**   (2) pTemplate costs more than any other WhereLoops for which pTemplate\n**       is a proper subset.\n**\n** To say \"WhereLoop X is a proper subset of Y\" means that X uses fewer\n** WHERE clause terms than Y and that every WHERE clause term used by X is\n** also used by Y.\n*/\nstatic void whereLoopAdjustCost(const WhereLoop *p, WhereLoop *pTemplate){\n  if( (pTemplate->wsFlags & WHERE_INDEXED)==0 ) return;\n  for(; p; p=p->pNextLoop){\n    if( p->iTab!=pTemplate->iTab ) continue;\n    if( (p->wsFlags & WHERE_INDEXED)==0 ) continue;\n    if( whereLoopCheaperProperSubset(p, pTemplate) ){\n      /* Adjust pTemplate cost downward so that it is cheaper than its \n      ** subset p. */\n      WHERETRACE(0x80,(\"subset cost adjustment %d,%d to %d,%d\\n\",\n                       pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut-1));\n      pTemplate->rRun = p->rRun;\n      pTemplate->nOut = p->nOut - 1;\n    }else if( whereLoopCheaperProperSubset(pTemplate, p) ){\n      /* Adjust pTemplate cost upward so that it is costlier than p since\n      ** pTemplate is a proper subset of p */\n      WHERETRACE(0x80,(\"subset cost adjustment %d,%d to %d,%d\\n\",\n                       pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut+1));\n      pTemplate->rRun = p->rRun;\n      pTemplate->nOut = p->nOut + 1;\n    }\n  }\n}\n\n/*\n** Search the list of WhereLoops in *ppPrev looking for one that can be\n** supplanted by pTemplate.\n**\n** Return NULL if the WhereLoop list contains an entry that can supplant\n** pTemplate, in other words if pTemplate does not belong on the list.\n**\n** If pX is a WhereLoop that pTemplate can supplant, then return the\n** link that points to pX.\n**\n** If pTemplate cannot supplant any existing element of the list but needs\n** to be added to the list, then return a pointer to the tail of the list.\n*/\nstatic WhereLoop **whereLoopFindLesser(\n  WhereLoop **ppPrev,\n  const WhereLoop *pTemplate\n){\n  WhereLoop *p;\n  for(p=(*ppPrev); p; ppPrev=&p->pNextLoop, p=*ppPrev){\n    if( p->iTab!=pTemplate->iTab || p->iSortIdx!=pTemplate->iSortIdx ){\n      /* If either the iTab or iSortIdx values for two WhereLoop are different\n      ** then those WhereLoops need to be considered separately.  Neither is\n      ** a candidate to replace the other. */\n      continue;\n    }\n    /* In the current implementation, the rSetup value is either zero\n    ** or the cost of building an automatic index (NlogN) and the NlogN\n    ** is the same for compatible WhereLoops. */\n    assert( p->rSetup==0 || pTemplate->rSetup==0 \n                 || p->rSetup==pTemplate->rSetup );\n\n    /* whereLoopAddBtree() always generates and inserts the automatic index\n    ** case first.  Hence compatible candidate WhereLoops never have a larger\n    ** rSetup. Call this SETUP-INVARIANT */\n    assert( p->rSetup>=pTemplate->rSetup );\n\n    /* Any loop using an appliation-defined index (or PRIMARY KEY or\n    ** UNIQUE constraint) with one or more == constraints is better\n    ** than an automatic index. Unless it is a skip-scan. */\n    if( (p->wsFlags & WHERE_AUTO_INDEX)!=0\n     && (pTemplate->nSkip)==0\n     && (pTemplate->wsFlags & WHERE_INDEXED)!=0\n     && (pTemplate->wsFlags & WHERE_COLUMN_EQ)!=0\n     && (p->prereq & pTemplate->prereq)==pTemplate->prereq\n    ){\n      break;\n    }\n\n    /* If existing WhereLoop p is better than pTemplate, pTemplate can be\n    ** discarded.  WhereLoop p is better if:\n    **   (1)  p has no more dependencies than pTemplate, and\n    **   (2)  p has an equal or lower cost than pTemplate\n    */\n    if( (p->prereq & pTemplate->prereq)==p->prereq    /* (1)  */\n     && p->rSetup<=pTemplate->rSetup                  /* (2a) */\n     && p->rRun<=pTemplate->rRun                      /* (2b) */\n     && p->nOut<=pTemplate->nOut                      /* (2c) */\n    ){\n      return 0;  /* Discard pTemplate */\n    }\n\n    /* If pTemplate is always better than p, then cause p to be overwritten\n    ** with pTemplate.  pTemplate is better than p if:\n    **   (1)  pTemplate has no more dependences than p, and\n    **   (2)  pTemplate has an equal or lower cost than p.\n    */\n    if( (p->prereq & pTemplate->prereq)==pTemplate->prereq   /* (1)  */\n     && p->rRun>=pTemplate->rRun                             /* (2a) */\n     && p->nOut>=pTemplate->nOut                             /* (2b) */\n    ){\n      assert( p->rSetup>=pTemplate->rSetup ); /* SETUP-INVARIANT above */\n      break;   /* Cause p to be overwritten by pTemplate */\n    }\n  }\n  return ppPrev;\n}\n\n/*\n** Insert or replace a WhereLoop entry using the template supplied.\n**\n** An existing WhereLoop entry might be overwritten if the new template\n** is better and has fewer dependencies.  Or the template will be ignored\n** and no insert will occur if an existing WhereLoop is faster and has\n** fewer dependencies than the template.  Otherwise a new WhereLoop is\n** added based on the template.\n**\n** If pBuilder->pOrSet is not NULL then we care about only the\n** prerequisites and rRun and nOut costs of the N best loops.  That\n** information is gathered in the pBuilder->pOrSet object.  This special\n** processing mode is used only for OR clause processing.\n**\n** When accumulating multiple loops (when pBuilder->pOrSet is NULL) we\n** still might overwrite similar loops with the new template if the\n** new template is better.  Loops may be overwritten if the following \n** conditions are met:\n**\n**    (1)  They have the same iTab.\n**    (2)  They have the same iSortIdx.\n**    (3)  The template has same or fewer dependencies than the current loop\n**    (4)  The template has the same or lower cost than the current loop\n*/\nstatic int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){\n  WhereLoop **ppPrev, *p;\n  WhereInfo *pWInfo = pBuilder->pWInfo;\n  sqlite3 *db = pWInfo->pParse->db;\n  int rc;\n\n  /* If pBuilder->pOrSet is defined, then only keep track of the costs\n  ** and prereqs.\n  */\n  if( pBuilder->pOrSet!=0 ){\n    if( pTemplate->nLTerm ){\n#if WHERETRACE_ENABLED\n      u16 n = pBuilder->pOrSet->n;\n      int x =\n#endif\n      whereOrInsert(pBuilder->pOrSet, pTemplate->prereq, pTemplate->rRun,\n                                    pTemplate->nOut);\n#if WHERETRACE_ENABLED /* 0x8 */\n      if( sqlite3WhereTrace & 0x8 ){\n        sqlite3DebugPrintf(x?\"   or-%d:  \":\"   or-X:  \", n);\n        whereLoopPrint(pTemplate, pBuilder->pWC);\n      }\n#endif\n    }\n    return SQLITE_OK;\n  }\n\n  /* Look for an existing WhereLoop to replace with pTemplate\n  */\n  whereLoopAdjustCost(pWInfo->pLoops, pTemplate);\n  ppPrev = whereLoopFindLesser(&pWInfo->pLoops, pTemplate);\n\n  if( ppPrev==0 ){\n    /* There already exists a WhereLoop on the list that is better\n    ** than pTemplate, so just ignore pTemplate */\n#if WHERETRACE_ENABLED /* 0x8 */\n    if( sqlite3WhereTrace & 0x8 ){\n      sqlite3DebugPrintf(\"   skip: \");\n      whereLoopPrint(pTemplate, pBuilder->pWC);\n    }\n#endif\n    return SQLITE_OK;  \n  }else{\n    p = *ppPrev;\n  }\n\n  /* If we reach this point it means that either p[] should be overwritten\n  ** with pTemplate[] if p[] exists, or if p==NULL then allocate a new\n  ** WhereLoop and insert it.\n  */\n#if WHERETRACE_ENABLED /* 0x8 */\n  if( sqlite3WhereTrace & 0x8 ){\n    if( p!=0 ){\n      sqlite3DebugPrintf(\"replace: \");\n      whereLoopPrint(p, pBuilder->pWC);\n    }\n    sqlite3DebugPrintf(\"    add: \");\n    whereLoopPrint(pTemplate, pBuilder->pWC);\n  }\n#endif\n  if( p==0 ){\n    /* Allocate a new WhereLoop to add to the end of the list */\n    *ppPrev = p = sqlite3DbMallocRawNN(db, sizeof(WhereLoop));\n    if( p==0 ) return SQLITE_NOMEM_BKPT;\n    whereLoopInit(p);\n    p->pNextLoop = 0;\n  }else{\n    /* We will be overwriting WhereLoop p[].  But before we do, first\n    ** go through the rest of the list and delete any other entries besides\n    ** p[] that are also supplated by pTemplate */\n    WhereLoop **ppTail = &p->pNextLoop;\n    WhereLoop *pToDel;\n    while( *ppTail ){\n      ppTail = whereLoopFindLesser(ppTail, pTemplate);\n      if( ppTail==0 ) break;\n      pToDel = *ppTail;\n      if( pToDel==0 ) break;\n      *ppTail = pToDel->pNextLoop;\n#if WHERETRACE_ENABLED /* 0x8 */\n      if( sqlite3WhereTrace & 0x8 ){\n        sqlite3DebugPrintf(\" delete: \");\n        whereLoopPrint(pToDel, pBuilder->pWC);\n      }\n#endif\n      whereLoopDelete(db, pToDel);\n    }\n  }\n  rc = whereLoopXfer(db, p, pTemplate);\n  if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){\n    Index *pIndex = p->u.btree.pIndex;\n    if( pIndex && pIndex->tnum==0 ){\n      p->u.btree.pIndex = 0;\n    }\n  }\n  return rc;\n}\n\n/*\n** Adjust the WhereLoop.nOut value downward to account for terms of the\n** WHERE clause that reference the loop but which are not used by an\n** index.\n*\n** For every WHERE clause term that is not used by the index\n** and which has a truth probability assigned by one of the likelihood(),\n** likely(), or unlikely() SQL functions, reduce the estimated number\n** of output rows by the probability specified.\n**\n** TUNING:  For every WHERE clause term that is not used by the index\n** and which does not have an assigned truth probability, heuristics\n** described below are used to try to estimate the truth probability.\n** TODO --> Perhaps this is something that could be improved by better\n** table statistics.\n**\n** Heuristic 1:  Estimate the truth probability as 93.75%.  The 93.75%\n** value corresponds to -1 in LogEst notation, so this means decrement\n** the WhereLoop.nOut field for every such WHERE clause term.\n**\n** Heuristic 2:  If there exists one or more WHERE clause terms of the\n** form \"x==EXPR\" and EXPR is not a constant 0 or 1, then make sure the\n** final output row estimate is no greater than 1/4 of the total number\n** of rows in the table.  In other words, assume that x==EXPR will filter\n** out at least 3 out of 4 rows.  If EXPR is -1 or 0 or 1, then maybe the\n** \"x\" column is boolean or else -1 or 0 or 1 is a common default value\n** on the \"x\" column and so in that case only cap the output row estimate\n** at 1/2 instead of 1/4.\n*/\nstatic void whereLoopOutputAdjust(\n  WhereClause *pWC,      /* The WHERE clause */\n  WhereLoop *pLoop,      /* The loop to adjust downward */\n  LogEst nRow            /* Number of rows in the entire table */\n){\n  WhereTerm *pTerm, *pX;\n  Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);\n  int i, j, k;\n  LogEst iReduce = 0;    /* pLoop->nOut should not exceed nRow-iReduce */\n\n  assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 );\n  for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){\n    if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;\n    if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;\n    if( (pTerm->prereqAll & notAllowed)!=0 ) continue;\n    for(j=pLoop->nLTerm-1; j>=0; j--){\n      pX = pLoop->aLTerm[j];\n      if( pX==0 ) continue;\n      if( pX==pTerm ) break;\n      if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;\n    }\n    if( j<0 ){\n      if( pTerm->truthProb<=0 ){\n        /* If a truth probability is specified using the likelihood() hints,\n        ** then use the probability provided by the application. */\n        pLoop->nOut += pTerm->truthProb;\n      }else{\n        /* In the absence of explicit truth probabilities, use heuristics to\n        ** guess a reasonable truth probability. */\n        pLoop->nOut--;\n        if( pTerm->eOperator&(WO_EQ|WO_IS) ){\n          Expr *pRight = pTerm->pExpr->pRight;\n          testcase( pTerm->pExpr->op==TK_IS );\n          if( sqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){\n            k = 10;\n          }else{\n            k = 20;\n          }\n          if( iReduce<k ) iReduce = k;\n        }\n      }\n    }\n  }\n  if( pLoop->nOut > nRow-iReduce )  pLoop->nOut = nRow - iReduce;\n}\n\n/* \n** Term pTerm is a vector range comparison operation. The first comparison\n** in the vector can be optimized using column nEq of the index. This\n** function returns the total number of vector elements that can be used\n** as part of the range comparison.\n**\n** For example, if the query is:\n**\n**   WHERE a = ? AND (b, c, d) > (?, ?, ?)\n**\n** and the index:\n**\n**   CREATE INDEX ... ON (a, b, c, d, e)\n**\n** then this function would be invoked with nEq=1. The value returned in\n** this case is 3.\n*/\nstatic int whereRangeVectorLen(\n  Parse *pParse,       /* Parsing context */\n  int iCur,            /* Cursor open on pIdx */\n  Index *pIdx,         /* The index to be used for a inequality constraint */\n  int nEq,             /* Number of prior equality constraints on same index */\n  WhereTerm *pTerm     /* The vector inequality constraint */\n){\n  int nCmp = sqlite3ExprVectorSize(pTerm->pExpr->pLeft);\n  int i;\n\n  nCmp = MIN(nCmp, (pIdx->nColumn - nEq));\n  for(i=1; i<nCmp; i++){\n    /* Test if comparison i of pTerm is compatible with column (i+nEq) \n    ** of the index. If not, exit the loop.  */\n    char aff;                     /* Comparison affinity */\n    char idxaff = 0;              /* Indexed columns affinity */\n    CollSeq *pColl;               /* Comparison collation sequence */\n    Expr *pLhs = pTerm->pExpr->pLeft->x.pList->a[i].pExpr;\n    Expr *pRhs = pTerm->pExpr->pRight;\n    if( pRhs->flags & EP_xIsSelect ){\n      pRhs = pRhs->x.pSelect->pEList->a[i].pExpr;\n    }else{\n      pRhs = pRhs->x.pList->a[i].pExpr;\n    }\n\n    /* Check that the LHS of the comparison is a column reference to\n    ** the right column of the right source table. And that the sort\n    ** order of the index column is the same as the sort order of the\n    ** leftmost index column.  */\n    if( pLhs->op!=TK_COLUMN \n     || pLhs->iTable!=iCur \n     || pLhs->iColumn!=pIdx->aiColumn[i+nEq] \n     || pIdx->aSortOrder[i+nEq]!=pIdx->aSortOrder[nEq]\n    ){\n      break;\n    }\n\n    testcase( pLhs->iColumn==XN_ROWID );\n    aff = sqlite3CompareAffinity(pRhs, sqlite3ExprAffinity(pLhs));\n    idxaff = sqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn);\n    if( aff!=idxaff ) break;\n\n    pColl = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);\n    if( pColl==0 ) break;\n    if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break;\n  }\n  return i;\n}\n\n/*\n** Adjust the cost C by the costMult facter T.  This only occurs if\n** compiled with -DSQLITE_ENABLE_COSTMULT\n*/\n#ifdef SQLITE_ENABLE_COSTMULT\n# define ApplyCostMultiplier(C,T)  C += T\n#else\n# define ApplyCostMultiplier(C,T)\n#endif\n\n/*\n** We have so far matched pBuilder->pNew->u.btree.nEq terms of the \n** index pIndex. Try to match one more.\n**\n** When this function is called, pBuilder->pNew->nOut contains the \n** number of rows expected to be visited by filtering using the nEq \n** terms only. If it is modified, this value is restored before this \n** function returns.\n**\n** If pProbe->tnum==0, that means pIndex is a fake index used for the\n** INTEGER PRIMARY KEY.\n*/\nstatic int whereLoopAddBtreeIndex(\n  WhereLoopBuilder *pBuilder,     /* The WhereLoop factory */\n  struct SrcList_item *pSrc,      /* FROM clause term being analyzed */\n  Index *pProbe,                  /* An index on pSrc */\n  LogEst nInMul                   /* log(Number of iterations due to IN) */\n){\n  WhereInfo *pWInfo = pBuilder->pWInfo;  /* WHERE analyse context */\n  Parse *pParse = pWInfo->pParse;        /* Parsing context */\n  sqlite3 *db = pParse->db;       /* Database connection malloc context */\n  WhereLoop *pNew;                /* Template WhereLoop under construction */\n  WhereTerm *pTerm;               /* A WhereTerm under consideration */\n  int opMask;                     /* Valid operators for constraints */\n  WhereScan scan;                 /* Iterator for WHERE terms */\n  Bitmask saved_prereq;           /* Original value of pNew->prereq */\n  u16 saved_nLTerm;               /* Original value of pNew->nLTerm */\n  u16 saved_nEq;                  /* Original value of pNew->u.btree.nEq */\n  u16 saved_nBtm;                 /* Original value of pNew->u.btree.nBtm */\n  u16 saved_nTop;                 /* Original value of pNew->u.btree.nTop */\n  u16 saved_nSkip;                /* Original value of pNew->nSkip */\n  u32 saved_wsFlags;              /* Original value of pNew->wsFlags */\n  LogEst saved_nOut;              /* Original value of pNew->nOut */\n  int rc = SQLITE_OK;             /* Return code */\n  LogEst rSize;                   /* Number of rows in the table */\n  LogEst rLogSize;                /* Logarithm of table size */\n  WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */\n\n  pNew = pBuilder->pNew;\n  if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;\n  WHERETRACE(0x800, (\"BEGIN addBtreeIdx(%s), nEq=%d\\n\",\n                     pProbe->zName, pNew->u.btree.nEq));\n\n  assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );\n  assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );\n  if( pNew->wsFlags & WHERE_BTM_LIMIT ){\n    opMask = WO_LT|WO_LE;\n  }else{\n    assert( pNew->u.btree.nBtm==0 );\n    opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS;\n  }\n  if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);\n\n  assert( pNew->u.btree.nEq<pProbe->nColumn );\n\n  saved_nEq = pNew->u.btree.nEq;\n  saved_nBtm = pNew->u.btree.nBtm;\n  saved_nTop = pNew->u.btree.nTop;\n  saved_nSkip = pNew->nSkip;\n  saved_nLTerm = pNew->nLTerm;\n  saved_wsFlags = pNew->wsFlags;\n  saved_prereq = pNew->prereq;\n  saved_nOut = pNew->nOut;\n  pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, saved_nEq,\n                        opMask, pProbe);\n  pNew->rSetup = 0;\n  rSize = pProbe->aiRowLogEst[0];\n  rLogSize = estLog(rSize);\n  for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){\n    u16 eOp = pTerm->eOperator;   /* Shorthand for pTerm->eOperator */\n    LogEst rCostIdx;\n    LogEst nOutUnadjusted;        /* nOut before IN() and WHERE adjustments */\n    int nIn = 0;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    int nRecValid = pBuilder->nRecValid;\n#endif\n    if( (eOp==WO_ISNULL || (pTerm->wtFlags&TERM_VNULL)!=0)\n     && indexColumnNotNull(pProbe, saved_nEq)\n    ){\n      continue; /* ignore IS [NOT] NULL constraints on NOT NULL columns */\n    }\n    if( pTerm->prereqRight & pNew->maskSelf ) continue;\n\n    /* Do not allow the upper bound of a LIKE optimization range constraint\n    ** to mix with a lower range bound from some other source */\n    if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;\n\n    /* Do not allow IS constraints from the WHERE clause to be used by the\n    ** right table of a LEFT JOIN.  Only constraints in the ON clause are\n    ** allowed */\n    if( (pSrc->fg.jointype & JT_LEFT)!=0\n     && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)\n     && (eOp & (WO_IS|WO_ISNULL))!=0\n    ){\n      testcase( eOp & WO_IS );\n      testcase( eOp & WO_ISNULL );\n      continue;\n    }\n\n    pNew->wsFlags = saved_wsFlags;\n    pNew->u.btree.nEq = saved_nEq;\n    pNew->u.btree.nBtm = saved_nBtm;\n    pNew->u.btree.nTop = saved_nTop;\n    pNew->nLTerm = saved_nLTerm;\n    if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */\n    pNew->aLTerm[pNew->nLTerm++] = pTerm;\n    pNew->prereq = (saved_prereq | pTerm->prereqRight) & ~pNew->maskSelf;\n\n    assert( nInMul==0\n        || (pNew->wsFlags & WHERE_COLUMN_NULL)!=0 \n        || (pNew->wsFlags & WHERE_COLUMN_IN)!=0 \n        || (pNew->wsFlags & WHERE_SKIPSCAN)!=0 \n    );\n\n    if( eOp & WO_IN ){\n      Expr *pExpr = pTerm->pExpr;\n      pNew->wsFlags |= WHERE_COLUMN_IN;\n      if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n        /* \"x IN (SELECT ...)\":  TUNING: the SELECT returns 25 rows */\n        int i;\n        nIn = 46;  assert( 46==sqlite3LogEst(25) );\n\n        /* The expression may actually be of the form (x, y) IN (SELECT...).\n        ** In this case there is a separate term for each of (x) and (y).\n        ** However, the nIn multiplier should only be applied once, not once\n        ** for each such term. The following loop checks that pTerm is the\n        ** first such term in use, and sets nIn back to 0 if it is not. */\n        for(i=0; i<pNew->nLTerm-1; i++){\n          if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;\n        }\n      }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){\n        /* \"x IN (value, value, ...)\" */\n        nIn = sqlite3LogEst(pExpr->x.pList->nExpr);\n        assert( nIn>0 );  /* RHS always has 2 or more terms...  The parser\n                          ** changes \"x IN (?)\" into \"x=?\". */\n      }\n    }else if( eOp & (WO_EQ|WO_IS) ){\n      int iCol = pProbe->aiColumn[saved_nEq];\n      pNew->wsFlags |= WHERE_COLUMN_EQ;\n      assert( saved_nEq==pNew->u.btree.nEq );\n      if( iCol==XN_ROWID \n       || (iCol>0 && nInMul==0 && saved_nEq==pProbe->nKeyCol-1)\n      ){\n        if( iCol>=0 && pProbe->uniqNotNull==0 ){\n          pNew->wsFlags |= WHERE_UNQ_WANTED;\n        }else{\n          pNew->wsFlags |= WHERE_ONEROW;\n        }\n      }\n    }else if( eOp & WO_ISNULL ){\n      pNew->wsFlags |= WHERE_COLUMN_NULL;\n    }else if( eOp & (WO_GT|WO_GE) ){\n      testcase( eOp & WO_GT );\n      testcase( eOp & WO_GE );\n      pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_BTM_LIMIT;\n      pNew->u.btree.nBtm = whereRangeVectorLen(\n          pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm\n      );\n      pBtm = pTerm;\n      pTop = 0;\n      if( pTerm->wtFlags & TERM_LIKEOPT ){\n        /* Range contraints that come from the LIKE optimization are\n        ** always used in pairs. */\n        pTop = &pTerm[1];\n        assert( (pTop-(pTerm->pWC->a))<pTerm->pWC->nTerm );\n        assert( pTop->wtFlags & TERM_LIKEOPT );\n        assert( pTop->eOperator==WO_LT );\n        if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */\n        pNew->aLTerm[pNew->nLTerm++] = pTop;\n        pNew->wsFlags |= WHERE_TOP_LIMIT;\n        pNew->u.btree.nTop = 1;\n      }\n    }else{\n      assert( eOp & (WO_LT|WO_LE) );\n      testcase( eOp & WO_LT );\n      testcase( eOp & WO_LE );\n      pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_TOP_LIMIT;\n      pNew->u.btree.nTop = whereRangeVectorLen(\n          pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm\n      );\n      pTop = pTerm;\n      pBtm = (pNew->wsFlags & WHERE_BTM_LIMIT)!=0 ?\n                     pNew->aLTerm[pNew->nLTerm-2] : 0;\n    }\n\n    /* At this point pNew->nOut is set to the number of rows expected to\n    ** be visited by the index scan before considering term pTerm, or the\n    ** values of nIn and nInMul. In other words, assuming that all \n    ** \"x IN(...)\" terms are replaced with \"x = ?\". This block updates\n    ** the value of pNew->nOut to account for pTerm (but not nIn/nInMul).  */\n    assert( pNew->nOut==saved_nOut );\n    if( pNew->wsFlags & WHERE_COLUMN_RANGE ){\n      /* Adjust nOut using stat3/stat4 data. Or, if there is no stat3/stat4\n      ** data, using some other estimate.  */\n      whereRangeScanEst(pParse, pBuilder, pBtm, pTop, pNew);\n    }else{\n      int nEq = ++pNew->u.btree.nEq;\n      assert( eOp & (WO_ISNULL|WO_EQ|WO_IN|WO_IS) );\n\n      assert( pNew->nOut==saved_nOut );\n      if( pTerm->truthProb<=0 && pProbe->aiColumn[saved_nEq]>=0 ){\n        assert( (eOp & WO_IN) || nIn==0 );\n        testcase( eOp & WO_IN );\n        pNew->nOut += pTerm->truthProb;\n        pNew->nOut -= nIn;\n      }else{\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n        tRowcnt nOut = 0;\n        if( nInMul==0 \n         && pProbe->nSample \n         && pNew->u.btree.nEq<=pProbe->nSampleCol\n         && ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect))\n        ){\n          Expr *pExpr = pTerm->pExpr;\n          if( (eOp & (WO_EQ|WO_ISNULL|WO_IS))!=0 ){\n            testcase( eOp & WO_EQ );\n            testcase( eOp & WO_IS );\n            testcase( eOp & WO_ISNULL );\n            rc = whereEqualScanEst(pParse, pBuilder, pExpr->pRight, &nOut);\n          }else{\n            rc = whereInScanEst(pParse, pBuilder, pExpr->x.pList, &nOut);\n          }\n          if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;\n          if( rc!=SQLITE_OK ) break;          /* Jump out of the pTerm loop */\n          if( nOut ){\n            pNew->nOut = sqlite3LogEst(nOut);\n            if( pNew->nOut>saved_nOut ) pNew->nOut = saved_nOut;\n            pNew->nOut -= nIn;\n          }\n        }\n        if( nOut==0 )\n#endif\n        {\n          pNew->nOut += (pProbe->aiRowLogEst[nEq] - pProbe->aiRowLogEst[nEq-1]);\n          if( eOp & WO_ISNULL ){\n            /* TUNING: If there is no likelihood() value, assume that a \n            ** \"col IS NULL\" expression matches twice as many rows \n            ** as (col=?). */\n            pNew->nOut += 10;\n          }\n        }\n      }\n    }\n\n    /* Set rCostIdx to the cost of visiting selected rows in index. Add\n    ** it to pNew->rRun, which is currently set to the cost of the index\n    ** seek only. Then, if this is a non-covering index, add the cost of\n    ** visiting the rows in the main table.  */\n    rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;\n    pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx);\n    if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){\n      pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16);\n    }\n    ApplyCostMultiplier(pNew->rRun, pProbe->pTable->costMult);\n\n    nOutUnadjusted = pNew->nOut;\n    pNew->rRun += nInMul + nIn;\n    pNew->nOut += nInMul + nIn;\n    whereLoopOutputAdjust(pBuilder->pWC, pNew, rSize);\n    rc = whereLoopInsert(pBuilder, pNew);\n\n    if( pNew->wsFlags & WHERE_COLUMN_RANGE ){\n      pNew->nOut = saved_nOut;\n    }else{\n      pNew->nOut = nOutUnadjusted;\n    }\n\n    if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0\n     && pNew->u.btree.nEq<pProbe->nColumn\n    ){\n      whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn);\n    }\n    pNew->nOut = saved_nOut;\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    pBuilder->nRecValid = nRecValid;\n#endif\n  }\n  pNew->prereq = saved_prereq;\n  pNew->u.btree.nEq = saved_nEq;\n  pNew->u.btree.nBtm = saved_nBtm;\n  pNew->u.btree.nTop = saved_nTop;\n  pNew->nSkip = saved_nSkip;\n  pNew->wsFlags = saved_wsFlags;\n  pNew->nOut = saved_nOut;\n  pNew->nLTerm = saved_nLTerm;\n\n  /* Consider using a skip-scan if there are no WHERE clause constraints\n  ** available for the left-most terms of the index, and if the average\n  ** number of repeats in the left-most terms is at least 18. \n  **\n  ** The magic number 18 is selected on the basis that scanning 17 rows\n  ** is almost always quicker than an index seek (even though if the index\n  ** contains fewer than 2^17 rows we assume otherwise in other parts of\n  ** the code). And, even if it is not, it should not be too much slower. \n  ** On the other hand, the extra seeks could end up being significantly\n  ** more expensive.  */\n  assert( 42==sqlite3LogEst(18) );\n  if( saved_nEq==saved_nSkip\n   && saved_nEq+1<pProbe->nKeyCol\n   && pProbe->noSkipScan==0\n   && pProbe->aiRowLogEst[saved_nEq+1]>=42  /* TUNING: Minimum for skip-scan */\n   && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK\n  ){\n    LogEst nIter;\n    pNew->u.btree.nEq++;\n    pNew->nSkip++;\n    pNew->aLTerm[pNew->nLTerm++] = 0;\n    pNew->wsFlags |= WHERE_SKIPSCAN;\n    nIter = pProbe->aiRowLogEst[saved_nEq] - pProbe->aiRowLogEst[saved_nEq+1];\n    pNew->nOut -= nIter;\n    /* TUNING:  Because uncertainties in the estimates for skip-scan queries,\n    ** add a 1.375 fudge factor to make skip-scan slightly less likely. */\n    nIter += 5;\n    whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter + nInMul);\n    pNew->nOut = saved_nOut;\n    pNew->u.btree.nEq = saved_nEq;\n    pNew->nSkip = saved_nSkip;\n    pNew->wsFlags = saved_wsFlags;\n  }\n\n  WHERETRACE(0x800, (\"END addBtreeIdx(%s), nEq=%d, rc=%d\\n\",\n                      pProbe->zName, saved_nEq, rc));\n  return rc;\n}\n\n/*\n** Return True if it is possible that pIndex might be useful in\n** implementing the ORDER BY clause in pBuilder.\n**\n** Return False if pBuilder does not contain an ORDER BY clause or\n** if there is no way for pIndex to be useful in implementing that\n** ORDER BY clause.\n*/\nstatic int indexMightHelpWithOrderBy(\n  WhereLoopBuilder *pBuilder,\n  Index *pIndex,\n  int iCursor\n){\n  ExprList *pOB;\n  ExprList *aColExpr;\n  int ii, jj;\n\n  if( pIndex->bUnordered ) return 0;\n  if( (pOB = pBuilder->pWInfo->pOrderBy)==0 ) return 0;\n  for(ii=0; ii<pOB->nExpr; ii++){\n    Expr *pExpr = sqlite3ExprSkipCollate(pOB->a[ii].pExpr);\n    if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){\n      if( pExpr->iColumn<0 ) return 1;\n      for(jj=0; jj<pIndex->nKeyCol; jj++){\n        if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1;\n      }\n    }else if( (aColExpr = pIndex->aColExpr)!=0 ){\n      for(jj=0; jj<pIndex->nKeyCol; jj++){\n        if( pIndex->aiColumn[jj]!=XN_EXPR ) continue;\n        if( sqlite3ExprCompare(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){\n          return 1;\n        }\n      }\n    }\n  }\n  return 0;\n}\n\n/*\n** Return a bitmask where 1s indicate that the corresponding column of\n** the table is used by an index.  Only the first 63 columns are considered.\n*/\nstatic Bitmask columnsInIndex(Index *pIdx){\n  Bitmask m = 0;\n  int j;\n  for(j=pIdx->nColumn-1; j>=0; j--){\n    int x = pIdx->aiColumn[j];\n    if( x>=0 ){\n      testcase( x==BMS-1 );\n      testcase( x==BMS-2 );\n      if( x<BMS-1 ) m |= MASKBIT(x);\n    }\n  }\n  return m;\n}\n\n/* Check to see if a partial index with pPartIndexWhere can be used\n** in the current query.  Return true if it can be and false if not.\n*/\nstatic int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){\n  int i;\n  WhereTerm *pTerm;\n  while( pWhere->op==TK_AND ){\n    if( !whereUsablePartialIndex(iTab,pWC,pWhere->pLeft) ) return 0;\n    pWhere = pWhere->pRight;\n  }\n  for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){\n    Expr *pExpr = pTerm->pExpr;\n    if( sqlite3ExprImpliesExpr(pExpr, pWhere, iTab) \n     && (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab)\n    ){\n      return 1;\n    }\n  }\n  return 0;\n}\n\n/*\n** Add all WhereLoop objects for a single table of the join where the table\n** is identified by pBuilder->pNew->iTab.  That table is guaranteed to be\n** a b-tree table, not a virtual table.\n**\n** The costs (WhereLoop.rRun) of the b-tree loops added by this function\n** are calculated as follows:\n**\n** For a full scan, assuming the table (or index) contains nRow rows:\n**\n**     cost = nRow * 3.0                    // full-table scan\n**     cost = nRow * K                      // scan of covering index\n**     cost = nRow * (K+3.0)                // scan of non-covering index\n**\n** where K is a value between 1.1 and 3.0 set based on the relative \n** estimated average size of the index and table records.\n**\n** For an index scan, where nVisit is the number of index rows visited\n** by the scan, and nSeek is the number of seek operations required on \n** the index b-tree:\n**\n**     cost = nSeek * (log(nRow) + K * nVisit)          // covering index\n**     cost = nSeek * (log(nRow) + (K+3.0) * nVisit)    // non-covering index\n**\n** Normally, nSeek is 1. nSeek values greater than 1 come about if the \n** WHERE clause includes \"x IN (....)\" terms used in place of \"x=?\". Or when \n** implicit \"x IN (SELECT x FROM tbl)\" terms are added for skip-scans.\n**\n** The estimated values (nRow, nVisit, nSeek) often contain a large amount\n** of uncertainty.  For this reason, scoring is designed to pick plans that\n** \"do the least harm\" if the estimates are inaccurate.  For example, a\n** log(nRow) factor is omitted from a non-covering index scan in order to\n** bias the scoring in favor of using an index, since the worst-case\n** performance of using an index is far better than the worst-case performance\n** of a full table scan.\n*/\nstatic int whereLoopAddBtree(\n  WhereLoopBuilder *pBuilder, /* WHERE clause information */\n  Bitmask mPrereq             /* Extra prerequesites for using this table */\n){\n  WhereInfo *pWInfo;          /* WHERE analysis context */\n  Index *pProbe;              /* An index we are evaluating */\n  Index sPk;                  /* A fake index object for the primary key */\n  LogEst aiRowEstPk[2];       /* The aiRowLogEst[] value for the sPk index */\n  i16 aiColumnPk = -1;        /* The aColumn[] value for the sPk index */\n  SrcList *pTabList;          /* The FROM clause */\n  struct SrcList_item *pSrc;  /* The FROM clause btree term to add */\n  WhereLoop *pNew;            /* Template WhereLoop object */\n  int rc = SQLITE_OK;         /* Return code */\n  int iSortIdx = 1;           /* Index number */\n  int b;                      /* A boolean value */\n  LogEst rSize;               /* number of rows in the table */\n  LogEst rLogSize;            /* Logarithm of the number of rows in the table */\n  WhereClause *pWC;           /* The parsed WHERE clause */\n  Table *pTab;                /* Table being queried */\n  \n  pNew = pBuilder->pNew;\n  pWInfo = pBuilder->pWInfo;\n  pTabList = pWInfo->pTabList;\n  pSrc = pTabList->a + pNew->iTab;\n  pTab = pSrc->pTab;\n  pWC = pBuilder->pWC;\n  assert( !IsVirtual(pSrc->pTab) );\n\n  if( pSrc->pIBIndex ){\n    /* An INDEXED BY clause specifies a particular index to use */\n    pProbe = pSrc->pIBIndex;\n  }else if( !HasRowid(pTab) ){\n    pProbe = pTab->pIndex;\n  }else{\n    /* There is no INDEXED BY clause.  Create a fake Index object in local\n    ** variable sPk to represent the rowid primary key index.  Make this\n    ** fake index the first in a chain of Index objects with all of the real\n    ** indices to follow */\n    Index *pFirst;                  /* First of real indices on the table */\n    memset(&sPk, 0, sizeof(Index));\n    sPk.nKeyCol = 1;\n    sPk.nColumn = 1;\n    sPk.aiColumn = &aiColumnPk;\n    sPk.aiRowLogEst = aiRowEstPk;\n    sPk.onError = OE_Replace;\n    sPk.pTable = pTab;\n    sPk.szIdxRow = pTab->szTabRow;\n    aiRowEstPk[0] = pTab->nRowLogEst;\n    aiRowEstPk[1] = 0;\n    pFirst = pSrc->pTab->pIndex;\n    if( pSrc->fg.notIndexed==0 ){\n      /* The real indices of the table are only considered if the\n      ** NOT INDEXED qualifier is omitted from the FROM clause */\n      sPk.pNext = pFirst;\n    }\n    pProbe = &sPk;\n  }\n  rSize = pTab->nRowLogEst;\n  rLogSize = estLog(rSize);\n\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\n  /* Automatic indexes */\n  if( !pBuilder->pOrSet      /* Not part of an OR optimization */\n   && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0\n   && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0\n   && pSrc->pIBIndex==0      /* Has no INDEXED BY clause */\n   && !pSrc->fg.notIndexed   /* Has no NOT INDEXED clause */\n   && HasRowid(pTab)         /* Not WITHOUT ROWID table. (FIXME: Why not?) */\n   && !pSrc->fg.isCorrelated /* Not a correlated subquery */\n   && !pSrc->fg.isRecursive  /* Not a recursive common table expression. */\n  ){\n    /* Generate auto-index WhereLoops */\n    WhereTerm *pTerm;\n    WhereTerm *pWCEnd = pWC->a + pWC->nTerm;\n    for(pTerm=pWC->a; rc==SQLITE_OK && pTerm<pWCEnd; pTerm++){\n      if( pTerm->prereqRight & pNew->maskSelf ) continue;\n      if( termCanDriveIndex(pTerm, pSrc, 0) ){\n        pNew->u.btree.nEq = 1;\n        pNew->nSkip = 0;\n        pNew->u.btree.pIndex = 0;\n        pNew->nLTerm = 1;\n        pNew->aLTerm[0] = pTerm;\n        /* TUNING: One-time cost for computing the automatic index is\n        ** estimated to be X*N*log2(N) where N is the number of rows in\n        ** the table being indexed and where X is 7 (LogEst=28) for normal\n        ** tables or 1.375 (LogEst=4) for views and subqueries.  The value\n        ** of X is smaller for views and subqueries so that the query planner\n        ** will be more aggressive about generating automatic indexes for\n        ** those objects, since there is no opportunity to add schema\n        ** indexes on subqueries and views. */\n        pNew->rSetup = rLogSize + rSize + 4;\n        if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){\n          pNew->rSetup += 24;\n        }\n        ApplyCostMultiplier(pNew->rSetup, pTab->costMult);\n        if( pNew->rSetup<0 ) pNew->rSetup = 0;\n        /* TUNING: Each index lookup yields 20 rows in the table.  This\n        ** is more than the usual guess of 10 rows, since we have no way\n        ** of knowing how selective the index will ultimately be.  It would\n        ** not be unreasonable to make this value much larger. */\n        pNew->nOut = 43;  assert( 43==sqlite3LogEst(20) );\n        pNew->rRun = sqlite3LogEstAdd(rLogSize,pNew->nOut);\n        pNew->wsFlags = WHERE_AUTO_INDEX;\n        pNew->prereq = mPrereq | pTerm->prereqRight;\n        rc = whereLoopInsert(pBuilder, pNew);\n      }\n    }\n  }\n#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */\n\n  /* Loop over all indices\n  */\n  for(; rc==SQLITE_OK && pProbe; pProbe=pProbe->pNext, iSortIdx++){\n    if( pProbe->pPartIdxWhere!=0\n     && !whereUsablePartialIndex(pSrc->iCursor, pWC, pProbe->pPartIdxWhere) ){\n      testcase( pNew->iTab!=pSrc->iCursor );  /* See ticket [98d973b8f5] */\n      continue;  /* Partial index inappropriate for this query */\n    }\n    rSize = pProbe->aiRowLogEst[0];\n    pNew->u.btree.nEq = 0;\n    pNew->u.btree.nBtm = 0;\n    pNew->u.btree.nTop = 0;\n    pNew->nSkip = 0;\n    pNew->nLTerm = 0;\n    pNew->iSortIdx = 0;\n    pNew->rSetup = 0;\n    pNew->prereq = mPrereq;\n    pNew->nOut = rSize;\n    pNew->u.btree.pIndex = pProbe;\n    b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor);\n    /* The ONEPASS_DESIRED flags never occurs together with ORDER BY */\n    assert( (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 || b==0 );\n    if( pProbe->tnum<=0 ){\n      /* Integer primary key index */\n      pNew->wsFlags = WHERE_IPK;\n\n      /* Full table scan */\n      pNew->iSortIdx = b ? iSortIdx : 0;\n      /* TUNING: Cost of full table scan is (N*3.0). */\n      pNew->rRun = rSize + 16;\n      ApplyCostMultiplier(pNew->rRun, pTab->costMult);\n      whereLoopOutputAdjust(pWC, pNew, rSize);\n      rc = whereLoopInsert(pBuilder, pNew);\n      pNew->nOut = rSize;\n      if( rc ) break;\n    }else{\n      Bitmask m;\n      if( pProbe->isCovering ){\n        pNew->wsFlags = WHERE_IDX_ONLY | WHERE_INDEXED;\n        m = 0;\n      }else{\n        m = pSrc->colUsed & ~columnsInIndex(pProbe);\n        pNew->wsFlags = (m==0) ? (WHERE_IDX_ONLY|WHERE_INDEXED) : WHERE_INDEXED;\n      }\n\n      /* Full scan via index */\n      if( b\n       || !HasRowid(pTab)\n       || pProbe->pPartIdxWhere!=0\n       || ( m==0\n         && pProbe->bUnordered==0\n         && (pProbe->szIdxRow<pTab->szTabRow)\n         && (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0\n         && sqlite3GlobalConfig.bUseCis\n         && OptimizationEnabled(pWInfo->pParse->db, SQLITE_CoverIdxScan)\n          )\n      ){\n        pNew->iSortIdx = b ? iSortIdx : 0;\n\n        /* The cost of visiting the index rows is N*K, where K is\n        ** between 1.1 and 3.0, depending on the relative sizes of the\n        ** index and table rows. */\n        pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow;\n        if( m!=0 ){\n          /* If this is a non-covering index scan, add in the cost of\n          ** doing table lookups.  The cost will be 3x the number of\n          ** lookups.  Take into account WHERE clause terms that can be\n          ** satisfied using just the index, and that do not require a\n          ** table lookup. */\n          LogEst nLookup = rSize + 16;  /* Base cost:  N*3 */\n          int ii;\n          int iCur = pSrc->iCursor;\n          WhereClause *pWC2 = &pWInfo->sWC;\n          for(ii=0; ii<pWC2->nTerm; ii++){\n            WhereTerm *pTerm = &pWC2->a[ii];\n            if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){\n              break;\n            }\n            /* pTerm can be evaluated using just the index.  So reduce\n            ** the expected number of table lookups accordingly */\n            if( pTerm->truthProb<=0 ){\n              nLookup += pTerm->truthProb;\n            }else{\n              nLookup--;\n              if( pTerm->eOperator & (WO_EQ|WO_IS) ) nLookup -= 19;\n            }\n          }\n          \n          pNew->rRun = sqlite3LogEstAdd(pNew->rRun, nLookup);\n        }\n        ApplyCostMultiplier(pNew->rRun, pTab->costMult);\n        whereLoopOutputAdjust(pWC, pNew, rSize);\n        rc = whereLoopInsert(pBuilder, pNew);\n        pNew->nOut = rSize;\n        if( rc ) break;\n      }\n    }\n\n    rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0);\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n    sqlite3Stat4ProbeFree(pBuilder->pRec);\n    pBuilder->nRecValid = 0;\n    pBuilder->pRec = 0;\n#endif\n\n    /* If there was an INDEXED BY clause, then only that one index is\n    ** considered. */\n    if( pSrc->pIBIndex ) break;\n  }\n  return rc;\n}\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n\n/*\n** Argument pIdxInfo is already populated with all constraints that may\n** be used by the virtual table identified by pBuilder->pNew->iTab. This\n** function marks a subset of those constraints usable, invokes the\n** xBestIndex method and adds the returned plan to pBuilder.\n**\n** A constraint is marked usable if:\n**\n**   * Argument mUsable indicates that its prerequisites are available, and\n**\n**   * It is not one of the operators specified in the mExclude mask passed\n**     as the fourth argument (which in practice is either WO_IN or 0).\n**\n** Argument mPrereq is a mask of tables that must be scanned before the\n** virtual table in question. These are added to the plans prerequisites\n** before it is added to pBuilder.\n**\n** Output parameter *pbIn is set to true if the plan added to pBuilder\n** uses one or more WO_IN terms, or false otherwise.\n*/\nstatic int whereLoopAddVirtualOne(\n  WhereLoopBuilder *pBuilder,\n  Bitmask mPrereq,                /* Mask of tables that must be used. */\n  Bitmask mUsable,                /* Mask of usable tables */\n  u16 mExclude,                   /* Exclude terms using these operators */\n  sqlite3_index_info *pIdxInfo,   /* Populated object for xBestIndex */\n  u16 mNoOmit,                    /* Do not omit these constraints */\n  int *pbIn                       /* OUT: True if plan uses an IN(...) op */\n){\n  WhereClause *pWC = pBuilder->pWC;\n  struct sqlite3_index_constraint *pIdxCons;\n  struct sqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage;\n  int i;\n  int mxTerm;\n  int rc = SQLITE_OK;\n  WhereLoop *pNew = pBuilder->pNew;\n  Parse *pParse = pBuilder->pWInfo->pParse;\n  struct SrcList_item *pSrc = &pBuilder->pWInfo->pTabList->a[pNew->iTab];\n  int nConstraint = pIdxInfo->nConstraint;\n\n  assert( (mUsable & mPrereq)==mPrereq );\n  *pbIn = 0;\n  pNew->prereq = mPrereq;\n\n  /* Set the usable flag on the subset of constraints identified by \n  ** arguments mUsable and mExclude. */\n  pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;\n  for(i=0; i<nConstraint; i++, pIdxCons++){\n    WhereTerm *pTerm = &pWC->a[pIdxCons->iTermOffset];\n    pIdxCons->usable = 0;\n    if( (pTerm->prereqRight & mUsable)==pTerm->prereqRight \n     && (pTerm->eOperator & mExclude)==0\n    ){\n      pIdxCons->usable = 1;\n    }\n  }\n\n  /* Initialize the output fields of the sqlite3_index_info structure */\n  memset(pUsage, 0, sizeof(pUsage[0])*nConstraint);\n  assert( pIdxInfo->needToFreeIdxStr==0 );\n  pIdxInfo->idxStr = 0;\n  pIdxInfo->idxNum = 0;\n  pIdxInfo->orderByConsumed = 0;\n  pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (double)2;\n  pIdxInfo->estimatedRows = 25;\n  pIdxInfo->idxFlags = 0;\n  pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed;\n\n  /* Invoke the virtual table xBestIndex() method */\n  rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo);\n  if( rc ) return rc;\n\n  mxTerm = -1;\n  assert( pNew->nLSlot>=nConstraint );\n  for(i=0; i<nConstraint; i++) pNew->aLTerm[i] = 0;\n  pNew->u.vtab.omitMask = 0;\n  pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;\n  for(i=0; i<nConstraint; i++, pIdxCons++){\n    int iTerm;\n    if( (iTerm = pUsage[i].argvIndex - 1)>=0 ){\n      WhereTerm *pTerm;\n      int j = pIdxCons->iTermOffset;\n      if( iTerm>=nConstraint\n       || j<0\n       || j>=pWC->nTerm\n       || pNew->aLTerm[iTerm]!=0\n       || pIdxCons->usable==0\n      ){\n        rc = SQLITE_ERROR;\n        sqlite3ErrorMsg(pParse,\"%s.xBestIndex malfunction\",pSrc->pTab->zName);\n        return rc;\n      }\n      testcase( iTerm==nConstraint-1 );\n      testcase( j==0 );\n      testcase( j==pWC->nTerm-1 );\n      pTerm = &pWC->a[j];\n      pNew->prereq |= pTerm->prereqRight;\n      assert( iTerm<pNew->nLSlot );\n      pNew->aLTerm[iTerm] = pTerm;\n      if( iTerm>mxTerm ) mxTerm = iTerm;\n      testcase( iTerm==15 );\n      testcase( iTerm==16 );\n      if( iTerm<16 && pUsage[i].omit ) pNew->u.vtab.omitMask |= 1<<iTerm;\n      if( (pTerm->eOperator & WO_IN)!=0 ){\n        /* A virtual table that is constrained by an IN clause may not\n        ** consume the ORDER BY clause because (1) the order of IN terms\n        ** is not necessarily related to the order of output terms and\n        ** (2) Multiple outputs from a single IN value will not merge\n        ** together.  */\n        pIdxInfo->orderByConsumed = 0;\n        pIdxInfo->idxFlags &= ~SQLITE_INDEX_SCAN_UNIQUE;\n        *pbIn = 1; assert( (mExclude & WO_IN)==0 );\n      }\n    }\n  }\n  pNew->u.vtab.omitMask &= ~mNoOmit;\n\n  pNew->nLTerm = mxTerm+1;\n  assert( pNew->nLTerm<=pNew->nLSlot );\n  pNew->u.vtab.idxNum = pIdxInfo->idxNum;\n  pNew->u.vtab.needFree = pIdxInfo->needToFreeIdxStr;\n  pIdxInfo->needToFreeIdxStr = 0;\n  pNew->u.vtab.idxStr = pIdxInfo->idxStr;\n  pNew->u.vtab.isOrdered = (i8)(pIdxInfo->orderByConsumed ?\n      pIdxInfo->nOrderBy : 0);\n  pNew->rSetup = 0;\n  pNew->rRun = sqlite3LogEstFromDouble(pIdxInfo->estimatedCost);\n  pNew->nOut = sqlite3LogEst(pIdxInfo->estimatedRows);\n\n  /* Set the WHERE_ONEROW flag if the xBestIndex() method indicated\n  ** that the scan will visit at most one row. Clear it otherwise. */\n  if( pIdxInfo->idxFlags & SQLITE_INDEX_SCAN_UNIQUE ){\n    pNew->wsFlags |= WHERE_ONEROW;\n  }else{\n    pNew->wsFlags &= ~WHERE_ONEROW;\n  }\n  rc = whereLoopInsert(pBuilder, pNew);\n  if( pNew->u.vtab.needFree ){\n    sqlite3_free(pNew->u.vtab.idxStr);\n    pNew->u.vtab.needFree = 0;\n  }\n  WHERETRACE(0xffff, (\"  bIn=%d prereqIn=%04llx prereqOut=%04llx\\n\",\n                      *pbIn, (sqlite3_uint64)mPrereq,\n                      (sqlite3_uint64)(pNew->prereq & ~mPrereq)));\n\n  return rc;\n}\n\n\n/*\n** Add all WhereLoop objects for a table of the join identified by\n** pBuilder->pNew->iTab.  That table is guaranteed to be a virtual table.\n**\n** If there are no LEFT or CROSS JOIN joins in the query, both mPrereq and\n** mUnusable are set to 0. Otherwise, mPrereq is a mask of all FROM clause\n** entries that occur before the virtual table in the FROM clause and are\n** separated from it by at least one LEFT or CROSS JOIN. Similarly, the\n** mUnusable mask contains all FROM clause entries that occur after the\n** virtual table and are separated from it by at least one LEFT or \n** CROSS JOIN. \n**\n** For example, if the query were:\n**\n**   ... FROM t1, t2 LEFT JOIN t3, t4, vt CROSS JOIN t5, t6;\n**\n** then mPrereq corresponds to (t1, t2) and mUnusable to (t5, t6).\n**\n** All the tables in mPrereq must be scanned before the current virtual \n** table. So any terms for which all prerequisites are satisfied by \n** mPrereq may be specified as \"usable\" in all calls to xBestIndex. \n** Conversely, all tables in mUnusable must be scanned after the current\n** virtual table, so any terms for which the prerequisites overlap with\n** mUnusable should always be configured as \"not-usable\" for xBestIndex.\n*/\nstatic int whereLoopAddVirtual(\n  WhereLoopBuilder *pBuilder,  /* WHERE clause information */\n  Bitmask mPrereq,             /* Tables that must be scanned before this one */\n  Bitmask mUnusable            /* Tables that must be scanned after this one */\n){\n  int rc = SQLITE_OK;          /* Return code */\n  WhereInfo *pWInfo;           /* WHERE analysis context */\n  Parse *pParse;               /* The parsing context */\n  WhereClause *pWC;            /* The WHERE clause */\n  struct SrcList_item *pSrc;   /* The FROM clause term to search */\n  sqlite3_index_info *p;       /* Object to pass to xBestIndex() */\n  int nConstraint;             /* Number of constraints in p */\n  int bIn;                     /* True if plan uses IN(...) operator */\n  WhereLoop *pNew;\n  Bitmask mBest;               /* Tables used by best possible plan */\n  u16 mNoOmit;\n\n  assert( (mPrereq & mUnusable)==0 );\n  pWInfo = pBuilder->pWInfo;\n  pParse = pWInfo->pParse;\n  pWC = pBuilder->pWC;\n  pNew = pBuilder->pNew;\n  pSrc = &pWInfo->pTabList->a[pNew->iTab];\n  assert( IsVirtual(pSrc->pTab) );\n  p = allocateIndexInfo(pParse, pWC, mUnusable, pSrc, pBuilder->pOrderBy, \n      &mNoOmit);\n  if( p==0 ) return SQLITE_NOMEM_BKPT;\n  pNew->rSetup = 0;\n  pNew->wsFlags = WHERE_VIRTUALTABLE;\n  pNew->nLTerm = 0;\n  pNew->u.vtab.needFree = 0;\n  nConstraint = p->nConstraint;\n  if( whereLoopResize(pParse->db, pNew, nConstraint) ){\n    sqlite3DbFree(pParse->db, p);\n    return SQLITE_NOMEM_BKPT;\n  }\n\n  /* First call xBestIndex() with all constraints usable. */\n  WHERETRACE(0x40, (\"  VirtualOne: all usable\\n\"));\n  rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn);\n\n  /* If the call to xBestIndex() with all terms enabled produced a plan\n  ** that does not require any source tables (IOW: a plan with mBest==0),\n  ** then there is no point in making any further calls to xBestIndex() \n  ** since they will all return the same result (if the xBestIndex()\n  ** implementation is sane). */\n  if( rc==SQLITE_OK && (mBest = (pNew->prereq & ~mPrereq))!=0 ){\n    int seenZero = 0;             /* True if a plan with no prereqs seen */\n    int seenZeroNoIN = 0;         /* Plan with no prereqs and no IN(...) seen */\n    Bitmask mPrev = 0;\n    Bitmask mBestNoIn = 0;\n\n    /* If the plan produced by the earlier call uses an IN(...) term, call\n    ** xBestIndex again, this time with IN(...) terms disabled. */\n    if( bIn ){\n      WHERETRACE(0x40, (\"  VirtualOne: all usable w/o IN\\n\"));\n      rc = whereLoopAddVirtualOne(\n          pBuilder, mPrereq, ALLBITS, WO_IN, p, mNoOmit, &bIn);\n      assert( bIn==0 );\n      mBestNoIn = pNew->prereq & ~mPrereq;\n      if( mBestNoIn==0 ){\n        seenZero = 1;\n        seenZeroNoIN = 1;\n      }\n    }\n\n    /* Call xBestIndex once for each distinct value of (prereqRight & ~mPrereq) \n    ** in the set of terms that apply to the current virtual table.  */\n    while( rc==SQLITE_OK ){\n      int i;\n      Bitmask mNext = ALLBITS;\n      assert( mNext>0 );\n      for(i=0; i<nConstraint; i++){\n        Bitmask mThis = (\n            pWC->a[p->aConstraint[i].iTermOffset].prereqRight & ~mPrereq\n        );\n        if( mThis>mPrev && mThis<mNext ) mNext = mThis;\n      }\n      mPrev = mNext;\n      if( mNext==ALLBITS ) break;\n      if( mNext==mBest || mNext==mBestNoIn ) continue;\n      WHERETRACE(0x40, (\"  VirtualOne: mPrev=%04llx mNext=%04llx\\n\",\n                       (sqlite3_uint64)mPrev, (sqlite3_uint64)mNext));\n      rc = whereLoopAddVirtualOne(\n          pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn);\n      if( pNew->prereq==mPrereq ){\n        seenZero = 1;\n        if( bIn==0 ) seenZeroNoIN = 1;\n      }\n    }\n\n    /* If the calls to xBestIndex() in the above loop did not find a plan\n    ** that requires no source tables at all (i.e. one guaranteed to be\n    ** usable), make a call here with all source tables disabled */\n    if( rc==SQLITE_OK && seenZero==0 ){\n      WHERETRACE(0x40, (\"  VirtualOne: all disabled\\n\"));\n      rc = whereLoopAddVirtualOne(\n          pBuilder, mPrereq, mPrereq, 0, p, mNoOmit, &bIn);\n      if( bIn==0 ) seenZeroNoIN = 1;\n    }\n\n    /* If the calls to xBestIndex() have so far failed to find a plan\n    ** that requires no source tables at all and does not use an IN(...)\n    ** operator, make a final call to obtain one here.  */\n    if( rc==SQLITE_OK && seenZeroNoIN==0 ){\n      WHERETRACE(0x40, (\"  VirtualOne: all disabled and w/o IN\\n\"));\n      rc = whereLoopAddVirtualOne(\n          pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn);\n    }\n  }\n\n  if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr);\n  sqlite3DbFree(pParse->db, p);\n  return rc;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n/*\n** Add WhereLoop entries to handle OR terms.  This works for either\n** btrees or virtual tables.\n*/\nstatic int whereLoopAddOr(\n  WhereLoopBuilder *pBuilder, \n  Bitmask mPrereq, \n  Bitmask mUnusable\n){\n  WhereInfo *pWInfo = pBuilder->pWInfo;\n  WhereClause *pWC;\n  WhereLoop *pNew;\n  WhereTerm *pTerm, *pWCEnd;\n  int rc = SQLITE_OK;\n  int iCur;\n  WhereClause tempWC;\n  WhereLoopBuilder sSubBuild;\n  WhereOrSet sSum, sCur;\n  struct SrcList_item *pItem;\n  \n  pWC = pBuilder->pWC;\n  pWCEnd = pWC->a + pWC->nTerm;\n  pNew = pBuilder->pNew;\n  memset(&sSum, 0, sizeof(sSum));\n  pItem = pWInfo->pTabList->a + pNew->iTab;\n  iCur = pItem->iCursor;\n\n  for(pTerm=pWC->a; pTerm<pWCEnd && rc==SQLITE_OK; pTerm++){\n    if( (pTerm->eOperator & WO_OR)!=0\n     && (pTerm->u.pOrInfo->indexable & pNew->maskSelf)!=0 \n    ){\n      WhereClause * const pOrWC = &pTerm->u.pOrInfo->wc;\n      WhereTerm * const pOrWCEnd = &pOrWC->a[pOrWC->nTerm];\n      WhereTerm *pOrTerm;\n      int once = 1;\n      int i, j;\n    \n      sSubBuild = *pBuilder;\n      sSubBuild.pOrderBy = 0;\n      sSubBuild.pOrSet = &sCur;\n\n      WHERETRACE(0x200, (\"Begin processing OR-clause %p\\n\", pTerm));\n      for(pOrTerm=pOrWC->a; pOrTerm<pOrWCEnd; pOrTerm++){\n        if( (pOrTerm->eOperator & WO_AND)!=0 ){\n          sSubBuild.pWC = &pOrTerm->u.pAndInfo->wc;\n        }else if( pOrTerm->leftCursor==iCur ){\n          tempWC.pWInfo = pWC->pWInfo;\n          tempWC.pOuter = pWC;\n          tempWC.op = TK_AND;\n          tempWC.nTerm = 1;\n          tempWC.a = pOrTerm;\n          sSubBuild.pWC = &tempWC;\n        }else{\n          continue;\n        }\n        sCur.n = 0;\n#ifdef WHERETRACE_ENABLED\n        WHERETRACE(0x200, (\"OR-term %d of %p has %d subterms:\\n\", \n                   (int)(pOrTerm-pOrWC->a), pTerm, sSubBuild.pWC->nTerm));\n        if( sqlite3WhereTrace & 0x400 ){\n          sqlite3WhereClausePrint(sSubBuild.pWC);\n        }\n#endif\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n        if( IsVirtual(pItem->pTab) ){\n          rc = whereLoopAddVirtual(&sSubBuild, mPrereq, mUnusable);\n        }else\n#endif\n        {\n          rc = whereLoopAddBtree(&sSubBuild, mPrereq);\n        }\n        if( rc==SQLITE_OK ){\n          rc = whereLoopAddOr(&sSubBuild, mPrereq, mUnusable);\n        }\n        assert( rc==SQLITE_OK || sCur.n==0 );\n        if( sCur.n==0 ){\n          sSum.n = 0;\n          break;\n        }else if( once ){\n          whereOrMove(&sSum, &sCur);\n          once = 0;\n        }else{\n          WhereOrSet sPrev;\n          whereOrMove(&sPrev, &sSum);\n          sSum.n = 0;\n          for(i=0; i<sPrev.n; i++){\n            for(j=0; j<sCur.n; j++){\n              whereOrInsert(&sSum, sPrev.a[i].prereq | sCur.a[j].prereq,\n                            sqlite3LogEstAdd(sPrev.a[i].rRun, sCur.a[j].rRun),\n                            sqlite3LogEstAdd(sPrev.a[i].nOut, sCur.a[j].nOut));\n            }\n          }\n        }\n      }\n      pNew->nLTerm = 1;\n      pNew->aLTerm[0] = pTerm;\n      pNew->wsFlags = WHERE_MULTI_OR;\n      pNew->rSetup = 0;\n      pNew->iSortIdx = 0;\n      memset(&pNew->u, 0, sizeof(pNew->u));\n      for(i=0; rc==SQLITE_OK && i<sSum.n; i++){\n        /* TUNING: Currently sSum.a[i].rRun is set to the sum of the costs\n        ** of all sub-scans required by the OR-scan. However, due to rounding\n        ** errors, it may be that the cost of the OR-scan is equal to its\n        ** most expensive sub-scan. Add the smallest possible penalty \n        ** (equivalent to multiplying the cost by 1.07) to ensure that \n        ** this does not happen. Otherwise, for WHERE clauses such as the\n        ** following where there is an index on \"y\":\n        **\n        **     WHERE likelihood(x=?, 0.99) OR y=?\n        **\n        ** the planner may elect to \"OR\" together a full-table scan and an\n        ** index lookup. And other similarly odd results.  */\n        pNew->rRun = sSum.a[i].rRun + 1;\n        pNew->nOut = sSum.a[i].nOut;\n        pNew->prereq = sSum.a[i].prereq;\n        rc = whereLoopInsert(pBuilder, pNew);\n      }\n      WHERETRACE(0x200, (\"End processing OR-clause %p\\n\", pTerm));\n    }\n  }\n  return rc;\n}\n\n/*\n** Add all WhereLoop objects for all tables \n*/\nstatic int whereLoopAddAll(WhereLoopBuilder *pBuilder){\n  WhereInfo *pWInfo = pBuilder->pWInfo;\n  Bitmask mPrereq = 0;\n  Bitmask mPrior = 0;\n  int iTab;\n  SrcList *pTabList = pWInfo->pTabList;\n  struct SrcList_item *pItem;\n  struct SrcList_item *pEnd = &pTabList->a[pWInfo->nLevel];\n  sqlite3 *db = pWInfo->pParse->db;\n  int rc = SQLITE_OK;\n  WhereLoop *pNew;\n  u8 priorJointype = 0;\n\n  /* Loop over the tables in the join, from left to right */\n  pNew = pBuilder->pNew;\n  whereLoopInit(pNew);\n  for(iTab=0, pItem=pTabList->a; pItem<pEnd; iTab++, pItem++){\n    Bitmask mUnusable = 0;\n    pNew->iTab = iTab;\n    pNew->maskSelf = sqlite3WhereGetMask(&pWInfo->sMaskSet, pItem->iCursor);\n    if( ((pItem->fg.jointype|priorJointype) & (JT_LEFT|JT_CROSS))!=0 ){\n      /* This condition is true when pItem is the FROM clause term on the\n      ** right-hand-side of a LEFT or CROSS JOIN.  */\n      mPrereq = mPrior;\n    }\n    priorJointype = pItem->fg.jointype;\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    if( IsVirtual(pItem->pTab) ){\n      struct SrcList_item *p;\n      for(p=&pItem[1]; p<pEnd; p++){\n        if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){\n          mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor);\n        }\n      }\n      rc = whereLoopAddVirtual(pBuilder, mPrereq, mUnusable);\n    }else\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n    {\n      rc = whereLoopAddBtree(pBuilder, mPrereq);\n    }\n    if( rc==SQLITE_OK ){\n      rc = whereLoopAddOr(pBuilder, mPrereq, mUnusable);\n    }\n    mPrior |= pNew->maskSelf;\n    if( rc || db->mallocFailed ) break;\n  }\n\n  whereLoopClear(db, pNew);\n  return rc;\n}\n\n/*\n** Examine a WherePath (with the addition of the extra WhereLoop of the 5th\n** parameters) to see if it outputs rows in the requested ORDER BY\n** (or GROUP BY) without requiring a separate sort operation.  Return N:\n** \n**   N>0:   N terms of the ORDER BY clause are satisfied\n**   N==0:  No terms of the ORDER BY clause are satisfied\n**   N<0:   Unknown yet how many terms of ORDER BY might be satisfied.   \n**\n** Note that processing for WHERE_GROUPBY and WHERE_DISTINCTBY is not as\n** strict.  With GROUP BY and DISTINCT the only requirement is that\n** equivalent rows appear immediately adjacent to one another.  GROUP BY\n** and DISTINCT do not require rows to appear in any particular order as long\n** as equivalent rows are grouped together.  Thus for GROUP BY and DISTINCT\n** the pOrderBy terms can be matched in any order.  With ORDER BY, the \n** pOrderBy terms must be matched in strict left-to-right order.\n*/\nstatic i8 wherePathSatisfiesOrderBy(\n  WhereInfo *pWInfo,    /* The WHERE clause */\n  ExprList *pOrderBy,   /* ORDER BY or GROUP BY or DISTINCT clause to check */\n  WherePath *pPath,     /* The WherePath to check */\n  u16 wctrlFlags,       /* WHERE_GROUPBY or _DISTINCTBY or _ORDERBY_LIMIT */\n  u16 nLoop,            /* Number of entries in pPath->aLoop[] */\n  WhereLoop *pLast,     /* Add this WhereLoop to the end of pPath->aLoop[] */\n  Bitmask *pRevMask     /* OUT: Mask of WhereLoops to run in reverse order */\n){\n  u8 revSet;            /* True if rev is known */\n  u8 rev;               /* Composite sort order */\n  u8 revIdx;            /* Index sort order */\n  u8 isOrderDistinct;   /* All prior WhereLoops are order-distinct */\n  u8 distinctColumns;   /* True if the loop has UNIQUE NOT NULL columns */\n  u8 isMatch;           /* iColumn matches a term of the ORDER BY clause */\n  u16 eqOpMask;         /* Allowed equality operators */\n  u16 nKeyCol;          /* Number of key columns in pIndex */\n  u16 nColumn;          /* Total number of ordered columns in the index */\n  u16 nOrderBy;         /* Number terms in the ORDER BY clause */\n  int iLoop;            /* Index of WhereLoop in pPath being processed */\n  int i, j;             /* Loop counters */\n  int iCur;             /* Cursor number for current WhereLoop */\n  int iColumn;          /* A column number within table iCur */\n  WhereLoop *pLoop = 0; /* Current WhereLoop being processed. */\n  WhereTerm *pTerm;     /* A single term of the WHERE clause */\n  Expr *pOBExpr;        /* An expression from the ORDER BY clause */\n  CollSeq *pColl;       /* COLLATE function from an ORDER BY clause term */\n  Index *pIndex;        /* The index associated with pLoop */\n  sqlite3 *db = pWInfo->pParse->db;  /* Database connection */\n  Bitmask obSat = 0;    /* Mask of ORDER BY terms satisfied so far */\n  Bitmask obDone;       /* Mask of all ORDER BY terms */\n  Bitmask orderDistinctMask;  /* Mask of all well-ordered loops */\n  Bitmask ready;              /* Mask of inner loops */\n\n  /*\n  ** We say the WhereLoop is \"one-row\" if it generates no more than one\n  ** row of output.  A WhereLoop is one-row if all of the following are true:\n  **  (a) All index columns match with WHERE_COLUMN_EQ.\n  **  (b) The index is unique\n  ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row.\n  ** Every one-row WhereLoop will have the WHERE_ONEROW bit set in wsFlags.\n  **\n  ** We say the WhereLoop is \"order-distinct\" if the set of columns from\n  ** that WhereLoop that are in the ORDER BY clause are different for every\n  ** row of the WhereLoop.  Every one-row WhereLoop is automatically\n  ** order-distinct.   A WhereLoop that has no columns in the ORDER BY clause\n  ** is not order-distinct. To be order-distinct is not quite the same as being\n  ** UNIQUE since a UNIQUE column or index can have multiple rows that \n  ** are NULL and NULL values are equivalent for the purpose of order-distinct.\n  ** To be order-distinct, the columns must be UNIQUE and NOT NULL.\n  **\n  ** The rowid for a table is always UNIQUE and NOT NULL so whenever the\n  ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is\n  ** automatically order-distinct.\n  */\n\n  assert( pOrderBy!=0 );\n  if( nLoop && OptimizationDisabled(db, SQLITE_OrderByIdxJoin) ) return 0;\n\n  nOrderBy = pOrderBy->nExpr;\n  testcase( nOrderBy==BMS-1 );\n  if( nOrderBy>BMS-1 ) return 0;  /* Cannot optimize overly large ORDER BYs */\n  isOrderDistinct = 1;\n  obDone = MASKBIT(nOrderBy)-1;\n  orderDistinctMask = 0;\n  ready = 0;\n  eqOpMask = WO_EQ | WO_IS | WO_ISNULL;\n  if( wctrlFlags & WHERE_ORDERBY_LIMIT ) eqOpMask |= WO_IN;\n  for(iLoop=0; isOrderDistinct && obSat<obDone && iLoop<=nLoop; iLoop++){\n    if( iLoop>0 ) ready |= pLoop->maskSelf;\n    if( iLoop<nLoop ){\n      pLoop = pPath->aLoop[iLoop];\n      if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue;\n    }else{\n      pLoop = pLast;\n    }\n    if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){\n      if( pLoop->u.vtab.isOrdered ) obSat = obDone;\n      break;\n    }\n    iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor;\n\n    /* Mark off any ORDER BY term X that is a column in the table of\n    ** the current loop for which there is term in the WHERE\n    ** clause of the form X IS NULL or X=? that reference only outer\n    ** loops.\n    */\n    for(i=0; i<nOrderBy; i++){\n      if( MASKBIT(i) & obSat ) continue;\n      pOBExpr = sqlite3ExprSkipCollate(pOrderBy->a[i].pExpr);\n      if( pOBExpr->op!=TK_COLUMN ) continue;\n      if( pOBExpr->iTable!=iCur ) continue;\n      pTerm = sqlite3WhereFindTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn,\n                       ~ready, eqOpMask, 0);\n      if( pTerm==0 ) continue;\n      if( pTerm->eOperator==WO_IN ){\n        /* IN terms are only valid for sorting in the ORDER BY LIMIT \n        ** optimization, and then only if they are actually used\n        ** by the query plan */\n        assert( wctrlFlags & WHERE_ORDERBY_LIMIT );\n        for(j=0; j<pLoop->nLTerm && pTerm!=pLoop->aLTerm[j]; j++){}\n        if( j>=pLoop->nLTerm ) continue;\n      }\n      if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){\n        const char *z1, *z2;\n        pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr);\n        if( !pColl ) pColl = db->pDfltColl;\n        z1 = pColl->zName;\n        pColl = sqlite3ExprCollSeq(pWInfo->pParse, pTerm->pExpr);\n        if( !pColl ) pColl = db->pDfltColl;\n        z2 = pColl->zName;\n        if( sqlite3StrICmp(z1, z2)!=0 ) continue;\n        testcase( pTerm->pExpr->op==TK_IS );\n      }\n      obSat |= MASKBIT(i);\n    }\n\n    if( (pLoop->wsFlags & WHERE_ONEROW)==0 ){\n      if( pLoop->wsFlags & WHERE_IPK ){\n        pIndex = 0;\n        nKeyCol = 0;\n        nColumn = 1;\n      }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){\n        return 0;\n      }else{\n        nKeyCol = pIndex->nKeyCol;\n        nColumn = pIndex->nColumn;\n        assert( nColumn==nKeyCol+1 || !HasRowid(pIndex->pTable) );\n        assert( pIndex->aiColumn[nColumn-1]==XN_ROWID\n                          || !HasRowid(pIndex->pTable));\n        isOrderDistinct = IsUniqueIndex(pIndex);\n      }\n\n      /* Loop through all columns of the index and deal with the ones\n      ** that are not constrained by == or IN.\n      */\n      rev = revSet = 0;\n      distinctColumns = 0;\n      for(j=0; j<nColumn; j++){\n        u8 bOnce = 1; /* True to run the ORDER BY search loop */\n\n        assert( j>=pLoop->u.btree.nEq \n            || (pLoop->aLTerm[j]==0)==(j<pLoop->nSkip)\n        );\n        if( j<pLoop->u.btree.nEq && j>=pLoop->nSkip ){\n          u16 eOp = pLoop->aLTerm[j]->eOperator;\n\n          /* Skip over == and IS and ISNULL terms.  (Also skip IN terms when\n          ** doing WHERE_ORDERBY_LIMIT processing). \n          **\n          ** If the current term is a column of an ((?,?) IN (SELECT...)) \n          ** expression for which the SELECT returns more than one column,\n          ** check that it is the only column used by this loop. Otherwise,\n          ** if it is one of two or more, none of the columns can be\n          ** considered to match an ORDER BY term.  */\n          if( (eOp & eqOpMask)!=0 ){\n            if( eOp & WO_ISNULL ){\n              testcase( isOrderDistinct );\n              isOrderDistinct = 0;\n            }\n            continue;  \n          }else if( ALWAYS(eOp & WO_IN) ){\n            /* ALWAYS() justification: eOp is an equality operator due to the\n            ** j<pLoop->u.btree.nEq constraint above.  Any equality other\n            ** than WO_IN is captured by the previous \"if\".  So this one\n            ** always has to be WO_IN. */\n            Expr *pX = pLoop->aLTerm[j]->pExpr;\n            for(i=j+1; i<pLoop->u.btree.nEq; i++){\n              if( pLoop->aLTerm[i]->pExpr==pX ){\n                assert( (pLoop->aLTerm[i]->eOperator & WO_IN) );\n                bOnce = 0;\n                break;\n              }\n            }\n          }\n        }\n\n        /* Get the column number in the table (iColumn) and sort order\n        ** (revIdx) for the j-th column of the index.\n        */\n        if( pIndex ){\n          iColumn = pIndex->aiColumn[j];\n          revIdx = pIndex->aSortOrder[j];\n          if( iColumn==pIndex->pTable->iPKey ) iColumn = -1;\n        }else{\n          iColumn = XN_ROWID;\n          revIdx = 0;\n        }\n\n        /* An unconstrained column that might be NULL means that this\n        ** WhereLoop is not well-ordered\n        */\n        if( isOrderDistinct\n         && iColumn>=0\n         && j>=pLoop->u.btree.nEq\n         && pIndex->pTable->aCol[iColumn].notNull==0\n        ){\n          isOrderDistinct = 0;\n        }\n\n        /* Find the ORDER BY term that corresponds to the j-th column\n        ** of the index and mark that ORDER BY term off \n        */\n        isMatch = 0;\n        for(i=0; bOnce && i<nOrderBy; i++){\n          if( MASKBIT(i) & obSat ) continue;\n          pOBExpr = sqlite3ExprSkipCollate(pOrderBy->a[i].pExpr);\n          testcase( wctrlFlags & WHERE_GROUPBY );\n          testcase( wctrlFlags & WHERE_DISTINCTBY );\n          if( (wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY))==0 ) bOnce = 0;\n          if( iColumn>=(-1) ){\n            if( pOBExpr->op!=TK_COLUMN ) continue;\n            if( pOBExpr->iTable!=iCur ) continue;\n            if( pOBExpr->iColumn!=iColumn ) continue;\n          }else{\n            if( sqlite3ExprCompare(pOBExpr,pIndex->aColExpr->a[j].pExpr,iCur) ){\n              continue;\n            }\n          }\n          if( iColumn>=0 ){\n            pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr);\n            if( !pColl ) pColl = db->pDfltColl;\n            if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue;\n          }\n          isMatch = 1;\n          break;\n        }\n        if( isMatch && (wctrlFlags & WHERE_GROUPBY)==0 ){\n          /* Make sure the sort order is compatible in an ORDER BY clause.\n          ** Sort order is irrelevant for a GROUP BY clause. */\n          if( revSet ){\n            if( (rev ^ revIdx)!=pOrderBy->a[i].sortOrder ) isMatch = 0;\n          }else{\n            rev = revIdx ^ pOrderBy->a[i].sortOrder;\n            if( rev ) *pRevMask |= MASKBIT(iLoop);\n            revSet = 1;\n          }\n        }\n        if( isMatch ){\n          if( iColumn==XN_ROWID ){\n            testcase( distinctColumns==0 );\n            distinctColumns = 1;\n          }\n          obSat |= MASKBIT(i);\n        }else{\n          /* No match found */\n          if( j==0 || j<nKeyCol ){\n            testcase( isOrderDistinct!=0 );\n            isOrderDistinct = 0;\n          }\n          break;\n        }\n      } /* end Loop over all index columns */\n      if( distinctColumns ){\n        testcase( isOrderDistinct==0 );\n        isOrderDistinct = 1;\n      }\n    } /* end-if not one-row */\n\n    /* Mark off any other ORDER BY terms that reference pLoop */\n    if( isOrderDistinct ){\n      orderDistinctMask |= pLoop->maskSelf;\n      for(i=0; i<nOrderBy; i++){\n        Expr *p;\n        Bitmask mTerm;\n        if( MASKBIT(i) & obSat ) continue;\n        p = pOrderBy->a[i].pExpr;\n        mTerm = sqlite3WhereExprUsage(&pWInfo->sMaskSet,p);\n        if( mTerm==0 && !sqlite3ExprIsConstant(p) ) continue;\n        if( (mTerm&~orderDistinctMask)==0 ){\n          obSat |= MASKBIT(i);\n        }\n      }\n    }\n  } /* End the loop over all WhereLoops from outer-most down to inner-most */\n  if( obSat==obDone ) return (i8)nOrderBy;\n  if( !isOrderDistinct ){\n    for(i=nOrderBy-1; i>0; i--){\n      Bitmask m = MASKBIT(i) - 1;\n      if( (obSat&m)==m ) return i;\n    }\n    return 0;\n  }\n  return -1;\n}\n\n\n/*\n** If the WHERE_GROUPBY flag is set in the mask passed to sqlite3WhereBegin(),\n** the planner assumes that the specified pOrderBy list is actually a GROUP\n** BY clause - and so any order that groups rows as required satisfies the\n** request.\n**\n** Normally, in this case it is not possible for the caller to determine\n** whether or not the rows are really being delivered in sorted order, or\n** just in some other order that provides the required grouping. However,\n** if the WHERE_SORTBYGROUP flag is also passed to sqlite3WhereBegin(), then\n** this function may be called on the returned WhereInfo object. It returns\n** true if the rows really will be sorted in the specified order, or false\n** otherwise.\n**\n** For example, assuming:\n**\n**   CREATE INDEX i1 ON t1(x, Y);\n**\n** then\n**\n**   SELECT * FROM t1 GROUP BY x,y ORDER BY x,y;   -- IsSorted()==1\n**   SELECT * FROM t1 GROUP BY y,x ORDER BY y,x;   -- IsSorted()==0\n*/\nint sqlite3WhereIsSorted(WhereInfo *pWInfo){\n  assert( pWInfo->wctrlFlags & WHERE_GROUPBY );\n  assert( pWInfo->wctrlFlags & WHERE_SORTBYGROUP );\n  return pWInfo->sorted;\n}\n\n#ifdef WHERETRACE_ENABLED\n/* For debugging use only: */\nstatic const char *wherePathName(WherePath *pPath, int nLoop, WhereLoop *pLast){\n  static char zName[65];\n  int i;\n  for(i=0; i<nLoop; i++){ zName[i] = pPath->aLoop[i]->cId; }\n  if( pLast ) zName[i++] = pLast->cId;\n  zName[i] = 0;\n  return zName;\n}\n#endif\n\n/*\n** Return the cost of sorting nRow rows, assuming that the keys have \n** nOrderby columns and that the first nSorted columns are already in\n** order.\n*/\nstatic LogEst whereSortingCost(\n  WhereInfo *pWInfo,\n  LogEst nRow,\n  int nOrderBy,\n  int nSorted\n){\n  /* TUNING: Estimated cost of a full external sort, where N is \n  ** the number of rows to sort is:\n  **\n  **   cost = (3.0 * N * log(N)).\n  ** \n  ** Or, if the order-by clause has X terms but only the last Y \n  ** terms are out of order, then block-sorting will reduce the \n  ** sorting cost to:\n  **\n  **   cost = (3.0 * N * log(N)) * (Y/X)\n  **\n  ** The (Y/X) term is implemented using stack variable rScale\n  ** below.  */\n  LogEst rScale, rSortCost;\n  assert( nOrderBy>0 && 66==sqlite3LogEst(100) );\n  rScale = sqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66;\n  rSortCost = nRow + rScale + 16;\n\n  /* Multiple by log(M) where M is the number of output rows.\n  ** Use the LIMIT for M if it is smaller */\n  if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 && pWInfo->iLimit<nRow ){\n    nRow = pWInfo->iLimit;\n  }\n  rSortCost += estLog(nRow);\n  return rSortCost;\n}\n\n/*\n** Given the list of WhereLoop objects at pWInfo->pLoops, this routine\n** attempts to find the lowest cost path that visits each WhereLoop\n** once.  This path is then loaded into the pWInfo->a[].pWLoop fields.\n**\n** Assume that the total number of output rows that will need to be sorted\n** will be nRowEst (in the 10*log2 representation).  Or, ignore sorting\n** costs if nRowEst==0.\n**\n** Return SQLITE_OK on success or SQLITE_NOMEM of a memory allocation\n** error occurs.\n*/\nstatic int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){\n  int mxChoice;             /* Maximum number of simultaneous paths tracked */\n  int nLoop;                /* Number of terms in the join */\n  Parse *pParse;            /* Parsing context */\n  sqlite3 *db;              /* The database connection */\n  int iLoop;                /* Loop counter over the terms of the join */\n  int ii, jj;               /* Loop counters */\n  int mxI = 0;              /* Index of next entry to replace */\n  int nOrderBy;             /* Number of ORDER BY clause terms */\n  LogEst mxCost = 0;        /* Maximum cost of a set of paths */\n  LogEst mxUnsorted = 0;    /* Maximum unsorted cost of a set of path */\n  int nTo, nFrom;           /* Number of valid entries in aTo[] and aFrom[] */\n  WherePath *aFrom;         /* All nFrom paths at the previous level */\n  WherePath *aTo;           /* The nTo best paths at the current level */\n  WherePath *pFrom;         /* An element of aFrom[] that we are working on */\n  WherePath *pTo;           /* An element of aTo[] that we are working on */\n  WhereLoop *pWLoop;        /* One of the WhereLoop objects */\n  WhereLoop **pX;           /* Used to divy up the pSpace memory */\n  LogEst *aSortCost = 0;    /* Sorting and partial sorting costs */\n  char *pSpace;             /* Temporary memory used by this routine */\n  int nSpace;               /* Bytes of space allocated at pSpace */\n\n  pParse = pWInfo->pParse;\n  db = pParse->db;\n  nLoop = pWInfo->nLevel;\n  /* TUNING: For simple queries, only the best path is tracked.\n  ** For 2-way joins, the 5 best paths are followed.\n  ** For joins of 3 or more tables, track the 10 best paths */\n  mxChoice = (nLoop<=1) ? 1 : (nLoop==2 ? 5 : 10);\n  assert( nLoop<=pWInfo->pTabList->nSrc );\n  WHERETRACE(0x002, (\"---- begin solver.  (nRowEst=%d)\\n\", nRowEst));\n\n  /* If nRowEst is zero and there is an ORDER BY clause, ignore it. In this\n  ** case the purpose of this call is to estimate the number of rows returned\n  ** by the overall query. Once this estimate has been obtained, the caller\n  ** will invoke this function a second time, passing the estimate as the\n  ** nRowEst parameter.  */\n  if( pWInfo->pOrderBy==0 || nRowEst==0 ){\n    nOrderBy = 0;\n  }else{\n    nOrderBy = pWInfo->pOrderBy->nExpr;\n  }\n\n  /* Allocate and initialize space for aTo, aFrom and aSortCost[] */\n  nSpace = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2;\n  nSpace += sizeof(LogEst) * nOrderBy;\n  pSpace = sqlite3DbMallocRawNN(db, nSpace);\n  if( pSpace==0 ) return SQLITE_NOMEM_BKPT;\n  aTo = (WherePath*)pSpace;\n  aFrom = aTo+mxChoice;\n  memset(aFrom, 0, sizeof(aFrom[0]));\n  pX = (WhereLoop**)(aFrom+mxChoice);\n  for(ii=mxChoice*2, pFrom=aTo; ii>0; ii--, pFrom++, pX += nLoop){\n    pFrom->aLoop = pX;\n  }\n  if( nOrderBy ){\n    /* If there is an ORDER BY clause and it is not being ignored, set up\n    ** space for the aSortCost[] array. Each element of the aSortCost array\n    ** is either zero - meaning it has not yet been initialized - or the\n    ** cost of sorting nRowEst rows of data where the first X terms of\n    ** the ORDER BY clause are already in order, where X is the array \n    ** index.  */\n    aSortCost = (LogEst*)pX;\n    memset(aSortCost, 0, sizeof(LogEst) * nOrderBy);\n  }\n  assert( aSortCost==0 || &pSpace[nSpace]==(char*)&aSortCost[nOrderBy] );\n  assert( aSortCost!=0 || &pSpace[nSpace]==(char*)pX );\n\n  /* Seed the search with a single WherePath containing zero WhereLoops.\n  **\n  ** TUNING: Do not let the number of iterations go above 28.  If the cost\n  ** of computing an automatic index is not paid back within the first 28\n  ** rows, then do not use the automatic index. */\n  aFrom[0].nRow = MIN(pParse->nQueryLoop, 48);  assert( 48==sqlite3LogEst(28) );\n  nFrom = 1;\n  assert( aFrom[0].isOrdered==0 );\n  if( nOrderBy ){\n    /* If nLoop is zero, then there are no FROM terms in the query. Since\n    ** in this case the query may return a maximum of one row, the results\n    ** are already in the requested order. Set isOrdered to nOrderBy to\n    ** indicate this. Or, if nLoop is greater than zero, set isOrdered to\n    ** -1, indicating that the result set may or may not be ordered, \n    ** depending on the loops added to the current plan.  */\n    aFrom[0].isOrdered = nLoop>0 ? -1 : nOrderBy;\n  }\n\n  /* Compute successively longer WherePaths using the previous generation\n  ** of WherePaths as the basis for the next.  Keep track of the mxChoice\n  ** best paths at each generation */\n  for(iLoop=0; iLoop<nLoop; iLoop++){\n    nTo = 0;\n    for(ii=0, pFrom=aFrom; ii<nFrom; ii++, pFrom++){\n      for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){\n        LogEst nOut;                      /* Rows visited by (pFrom+pWLoop) */\n        LogEst rCost;                     /* Cost of path (pFrom+pWLoop) */\n        LogEst rUnsorted;                 /* Unsorted cost of (pFrom+pWLoop) */\n        i8 isOrdered = pFrom->isOrdered;  /* isOrdered for (pFrom+pWLoop) */\n        Bitmask maskNew;                  /* Mask of src visited by (..) */\n        Bitmask revMask = 0;              /* Mask of rev-order loops for (..) */\n\n        if( (pWLoop->prereq & ~pFrom->maskLoop)!=0 ) continue;\n        if( (pWLoop->maskSelf & pFrom->maskLoop)!=0 ) continue;\n        if( (pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 && pFrom->nRow<10 ){\n          /* Do not use an automatic index if the this loop is expected\n          ** to run less than 2 times. */\n          assert( 10==sqlite3LogEst(2) );\n          continue;\n        }\n        /* At this point, pWLoop is a candidate to be the next loop. \n        ** Compute its cost */\n        rUnsorted = sqlite3LogEstAdd(pWLoop->rSetup,pWLoop->rRun + pFrom->nRow);\n        rUnsorted = sqlite3LogEstAdd(rUnsorted, pFrom->rUnsorted);\n        nOut = pFrom->nRow + pWLoop->nOut;\n        maskNew = pFrom->maskLoop | pWLoop->maskSelf;\n        if( isOrdered<0 ){\n          isOrdered = wherePathSatisfiesOrderBy(pWInfo,\n                       pWInfo->pOrderBy, pFrom, pWInfo->wctrlFlags,\n                       iLoop, pWLoop, &revMask);\n        }else{\n          revMask = pFrom->revLoop;\n        }\n        if( isOrdered>=0 && isOrdered<nOrderBy ){\n          if( aSortCost[isOrdered]==0 ){\n            aSortCost[isOrdered] = whereSortingCost(\n                pWInfo, nRowEst, nOrderBy, isOrdered\n            );\n          }\n          rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]);\n\n          WHERETRACE(0x002,\n              (\"---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\\n\",\n               aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy, \n               rUnsorted, rCost));\n        }else{\n          rCost = rUnsorted;\n        }\n\n        /* Check to see if pWLoop should be added to the set of\n        ** mxChoice best-so-far paths.\n        **\n        ** First look for an existing path among best-so-far paths\n        ** that covers the same set of loops and has the same isOrdered\n        ** setting as the current path candidate.\n        **\n        ** The term \"((pTo->isOrdered^isOrdered)&0x80)==0\" is equivalent\n        ** to (pTo->isOrdered==(-1))==(isOrdered==(-1))\" for the range\n        ** of legal values for isOrdered, -1..64.\n        */\n        for(jj=0, pTo=aTo; jj<nTo; jj++, pTo++){\n          if( pTo->maskLoop==maskNew\n           && ((pTo->isOrdered^isOrdered)&0x80)==0\n          ){\n            testcase( jj==nTo-1 );\n            break;\n          }\n        }\n        if( jj>=nTo ){\n          /* None of the existing best-so-far paths match the candidate. */\n          if( nTo>=mxChoice\n           && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted))\n          ){\n            /* The current candidate is no better than any of the mxChoice\n            ** paths currently in the best-so-far buffer.  So discard\n            ** this candidate as not viable. */\n#ifdef WHERETRACE_ENABLED /* 0x4 */\n            if( sqlite3WhereTrace&0x4 ){\n              sqlite3DebugPrintf(\"Skip   %s cost=%-3d,%3d order=%c\\n\",\n                  wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,\n                  isOrdered>=0 ? isOrdered+'0' : '?');\n            }\n#endif\n            continue;\n          }\n          /* If we reach this points it means that the new candidate path\n          ** needs to be added to the set of best-so-far paths. */\n          if( nTo<mxChoice ){\n            /* Increase the size of the aTo set by one */\n            jj = nTo++;\n          }else{\n            /* New path replaces the prior worst to keep count below mxChoice */\n            jj = mxI;\n          }\n          pTo = &aTo[jj];\n#ifdef WHERETRACE_ENABLED /* 0x4 */\n          if( sqlite3WhereTrace&0x4 ){\n            sqlite3DebugPrintf(\"New    %s cost=%-3d,%3d order=%c\\n\",\n                wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,\n                isOrdered>=0 ? isOrdered+'0' : '?');\n          }\n#endif\n        }else{\n          /* Control reaches here if best-so-far path pTo=aTo[jj] covers the\n          ** same set of loops and has the sam isOrdered setting as the\n          ** candidate path.  Check to see if the candidate should replace\n          ** pTo or if the candidate should be skipped */\n          if( pTo->rCost<rCost || (pTo->rCost==rCost && pTo->nRow<=nOut) ){\n#ifdef WHERETRACE_ENABLED /* 0x4 */\n            if( sqlite3WhereTrace&0x4 ){\n              sqlite3DebugPrintf(\n                  \"Skip   %s cost=%-3d,%3d order=%c\",\n                  wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,\n                  isOrdered>=0 ? isOrdered+'0' : '?');\n              sqlite3DebugPrintf(\"   vs %s cost=%-3d,%d order=%c\\n\",\n                  wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,\n                  pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');\n            }\n#endif\n            /* Discard the candidate path from further consideration */\n            testcase( pTo->rCost==rCost );\n            continue;\n          }\n          testcase( pTo->rCost==rCost+1 );\n          /* Control reaches here if the candidate path is better than the\n          ** pTo path.  Replace pTo with the candidate. */\n#ifdef WHERETRACE_ENABLED /* 0x4 */\n          if( sqlite3WhereTrace&0x4 ){\n            sqlite3DebugPrintf(\n                \"Update %s cost=%-3d,%3d order=%c\",\n                wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,\n                isOrdered>=0 ? isOrdered+'0' : '?');\n            sqlite3DebugPrintf(\"  was %s cost=%-3d,%3d order=%c\\n\",\n                wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,\n                pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');\n          }\n#endif\n        }\n        /* pWLoop is a winner.  Add it to the set of best so far */\n        pTo->maskLoop = pFrom->maskLoop | pWLoop->maskSelf;\n        pTo->revLoop = revMask;\n        pTo->nRow = nOut;\n        pTo->rCost = rCost;\n        pTo->rUnsorted = rUnsorted;\n        pTo->isOrdered = isOrdered;\n        memcpy(pTo->aLoop, pFrom->aLoop, sizeof(WhereLoop*)*iLoop);\n        pTo->aLoop[iLoop] = pWLoop;\n        if( nTo>=mxChoice ){\n          mxI = 0;\n          mxCost = aTo[0].rCost;\n          mxUnsorted = aTo[0].nRow;\n          for(jj=1, pTo=&aTo[1]; jj<mxChoice; jj++, pTo++){\n            if( pTo->rCost>mxCost \n             || (pTo->rCost==mxCost && pTo->rUnsorted>mxUnsorted) \n            ){\n              mxCost = pTo->rCost;\n              mxUnsorted = pTo->rUnsorted;\n              mxI = jj;\n            }\n          }\n        }\n      }\n    }\n\n#ifdef WHERETRACE_ENABLED  /* >=2 */\n    if( sqlite3WhereTrace & 0x02 ){\n      sqlite3DebugPrintf(\"---- after round %d ----\\n\", iLoop);\n      for(ii=0, pTo=aTo; ii<nTo; ii++, pTo++){\n        sqlite3DebugPrintf(\" %s cost=%-3d nrow=%-3d order=%c\",\n           wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,\n           pTo->isOrdered>=0 ? (pTo->isOrdered+'0') : '?');\n        if( pTo->isOrdered>0 ){\n          sqlite3DebugPrintf(\" rev=0x%llx\\n\", pTo->revLoop);\n        }else{\n          sqlite3DebugPrintf(\"\\n\");\n        }\n      }\n    }\n#endif\n\n    /* Swap the roles of aFrom and aTo for the next generation */\n    pFrom = aTo;\n    aTo = aFrom;\n    aFrom = pFrom;\n    nFrom = nTo;\n  }\n\n  if( nFrom==0 ){\n    sqlite3ErrorMsg(pParse, \"no query solution\");\n    sqlite3DbFree(db, pSpace);\n    return SQLITE_ERROR;\n  }\n  \n  /* Find the lowest cost path.  pFrom will be left pointing to that path */\n  pFrom = aFrom;\n  for(ii=1; ii<nFrom; ii++){\n    if( pFrom->rCost>aFrom[ii].rCost ) pFrom = &aFrom[ii];\n  }\n  assert( pWInfo->nLevel==nLoop );\n  /* Load the lowest cost path into pWInfo */\n  for(iLoop=0; iLoop<nLoop; iLoop++){\n    WhereLevel *pLevel = pWInfo->a + iLoop;\n    pLevel->pWLoop = pWLoop = pFrom->aLoop[iLoop];\n    pLevel->iFrom = pWLoop->iTab;\n    pLevel->iTabCur = pWInfo->pTabList->a[pLevel->iFrom].iCursor;\n  }\n  if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)!=0\n   && (pWInfo->wctrlFlags & WHERE_DISTINCTBY)==0\n   && pWInfo->eDistinct==WHERE_DISTINCT_NOOP\n   && nRowEst\n  ){\n    Bitmask notUsed;\n    int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pDistinctSet, pFrom,\n                 WHERE_DISTINCTBY, nLoop-1, pFrom->aLoop[nLoop-1], &notUsed);\n    if( rc==pWInfo->pDistinctSet->nExpr ){\n      pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;\n    }\n  }\n  if( pWInfo->pOrderBy ){\n    if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){\n      if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){\n        pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;\n      }\n    }else{\n      pWInfo->nOBSat = pFrom->isOrdered;\n      pWInfo->revMask = pFrom->revLoop;\n      if( pWInfo->nOBSat<=0 ){\n        pWInfo->nOBSat = 0;\n        if( nLoop>0 ){\n          u32 wsFlags = pFrom->aLoop[nLoop-1]->wsFlags;\n          if( (wsFlags & WHERE_ONEROW)==0 \n           && (wsFlags&(WHERE_IPK|WHERE_COLUMN_IN))!=(WHERE_IPK|WHERE_COLUMN_IN)\n          ){\n            Bitmask m = 0;\n            int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom,\n                      WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m);\n            testcase( wsFlags & WHERE_IPK );\n            testcase( wsFlags & WHERE_COLUMN_IN );\n            if( rc==pWInfo->pOrderBy->nExpr ){\n              pWInfo->bOrderedInnerLoop = 1;\n              pWInfo->revMask = m;\n            }\n          }\n        }\n      }\n    }\n    if( (pWInfo->wctrlFlags & WHERE_SORTBYGROUP)\n        && pWInfo->nOBSat==pWInfo->pOrderBy->nExpr && nLoop>0\n    ){\n      Bitmask revMask = 0;\n      int nOrder = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, \n          pFrom, 0, nLoop-1, pFrom->aLoop[nLoop-1], &revMask\n      );\n      assert( pWInfo->sorted==0 );\n      if( nOrder==pWInfo->pOrderBy->nExpr ){\n        pWInfo->sorted = 1;\n        pWInfo->revMask = revMask;\n      }\n    }\n  }\n\n\n  pWInfo->nRowOut = pFrom->nRow;\n\n  /* Free temporary memory and return success */\n  sqlite3DbFree(db, pSpace);\n  return SQLITE_OK;\n}\n\n/*\n** Most queries use only a single table (they are not joins) and have\n** simple == constraints against indexed fields.  This routine attempts\n** to plan those simple cases using much less ceremony than the\n** general-purpose query planner, and thereby yield faster sqlite3_prepare()\n** times for the common case.\n**\n** Return non-zero on success, if this query can be handled by this\n** no-frills query planner.  Return zero if this query needs the \n** general-purpose query planner.\n*/\nstatic int whereShortCut(WhereLoopBuilder *pBuilder){\n  WhereInfo *pWInfo;\n  struct SrcList_item *pItem;\n  WhereClause *pWC;\n  WhereTerm *pTerm;\n  WhereLoop *pLoop;\n  int iCur;\n  int j;\n  Table *pTab;\n  Index *pIdx;\n\n  pWInfo = pBuilder->pWInfo;\n  if( pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE ) return 0;\n  assert( pWInfo->pTabList->nSrc>=1 );\n  pItem = pWInfo->pTabList->a;\n  pTab = pItem->pTab;\n  if( IsVirtual(pTab) ) return 0;\n  if( pItem->fg.isIndexedBy ) return 0;\n  iCur = pItem->iCursor;\n  pWC = &pWInfo->sWC;\n  pLoop = pBuilder->pNew;\n  pLoop->wsFlags = 0;\n  pLoop->nSkip = 0;\n  pTerm = sqlite3WhereFindTerm(pWC, iCur, -1, 0, WO_EQ|WO_IS, 0);\n  if( pTerm ){\n    testcase( pTerm->eOperator & WO_IS );\n    pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW;\n    pLoop->aLTerm[0] = pTerm;\n    pLoop->nLTerm = 1;\n    pLoop->u.btree.nEq = 1;\n    /* TUNING: Cost of a rowid lookup is 10 */\n    pLoop->rRun = 33;  /* 33==sqlite3LogEst(10) */\n  }else{\n    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n      int opMask;\n      assert( pLoop->aLTermSpace==pLoop->aLTerm );\n      if( !IsUniqueIndex(pIdx)\n       || pIdx->pPartIdxWhere!=0 \n       || pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace) \n      ) continue;\n      opMask = pIdx->uniqNotNull ? (WO_EQ|WO_IS) : WO_EQ;\n      for(j=0; j<pIdx->nKeyCol; j++){\n        pTerm = sqlite3WhereFindTerm(pWC, iCur, j, 0, opMask, pIdx);\n        if( pTerm==0 ) break;\n        testcase( pTerm->eOperator & WO_IS );\n        pLoop->aLTerm[j] = pTerm;\n      }\n      if( j!=pIdx->nKeyCol ) continue;\n      pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_ONEROW|WHERE_INDEXED;\n      if( pIdx->isCovering || (pItem->colUsed & ~columnsInIndex(pIdx))==0 ){\n        pLoop->wsFlags |= WHERE_IDX_ONLY;\n      }\n      pLoop->nLTerm = j;\n      pLoop->u.btree.nEq = j;\n      pLoop->u.btree.pIndex = pIdx;\n      /* TUNING: Cost of a unique index lookup is 15 */\n      pLoop->rRun = 39;  /* 39==sqlite3LogEst(15) */\n      break;\n    }\n  }\n  if( pLoop->wsFlags ){\n    pLoop->nOut = (LogEst)1;\n    pWInfo->a[0].pWLoop = pLoop;\n    pLoop->maskSelf = sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur);\n    pWInfo->a[0].iTabCur = iCur;\n    pWInfo->nRowOut = 1;\n    if( pWInfo->pOrderBy ) pWInfo->nOBSat =  pWInfo->pOrderBy->nExpr;\n    if( pWInfo->wctrlFlags & WHERE_WANT_DISTINCT ){\n      pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;\n    }\n#ifdef SQLITE_DEBUG\n    pLoop->cId = '0';\n#endif\n    return 1;\n  }\n  return 0;\n}\n\n/*\n** Generate the beginning of the loop used for WHERE clause processing.\n** The return value is a pointer to an opaque structure that contains\n** information needed to terminate the loop.  Later, the calling routine\n** should invoke sqlite3WhereEnd() with the return value of this function\n** in order to complete the WHERE clause processing.\n**\n** If an error occurs, this routine returns NULL.\n**\n** The basic idea is to do a nested loop, one loop for each table in\n** the FROM clause of a select.  (INSERT and UPDATE statements are the\n** same as a SELECT with only a single table in the FROM clause.)  For\n** example, if the SQL is this:\n**\n**       SELECT * FROM t1, t2, t3 WHERE ...;\n**\n** Then the code generated is conceptually like the following:\n**\n**      foreach row1 in t1 do       \\    Code generated\n**        foreach row2 in t2 do      |-- by sqlite3WhereBegin()\n**          foreach row3 in t3 do   /\n**            ...\n**          end                     \\    Code generated\n**        end                        |-- by sqlite3WhereEnd()\n**      end                         /\n**\n** Note that the loops might not be nested in the order in which they\n** appear in the FROM clause if a different order is better able to make\n** use of indices.  Note also that when the IN operator appears in\n** the WHERE clause, it might result in additional nested loops for\n** scanning through all values on the right-hand side of the IN.\n**\n** There are Btree cursors associated with each table.  t1 uses cursor\n** number pTabList->a[0].iCursor.  t2 uses the cursor pTabList->a[1].iCursor.\n** And so forth.  This routine generates code to open those VDBE cursors\n** and sqlite3WhereEnd() generates the code to close them.\n**\n** The code that sqlite3WhereBegin() generates leaves the cursors named\n** in pTabList pointing at their appropriate entries.  The [...] code\n** can use OP_Column and OP_Rowid opcodes on these cursors to extract\n** data from the various tables of the loop.\n**\n** If the WHERE clause is empty, the foreach loops must each scan their\n** entire tables.  Thus a three-way join is an O(N^3) operation.  But if\n** the tables have indices and there are terms in the WHERE clause that\n** refer to those indices, a complete table scan can be avoided and the\n** code will run much faster.  Most of the work of this routine is checking\n** to see if there are indices that can be used to speed up the loop.\n**\n** Terms of the WHERE clause are also used to limit which rows actually\n** make it to the \"...\" in the middle of the loop.  After each \"foreach\",\n** terms of the WHERE clause that use only terms in that loop and outer\n** loops are evaluated and if false a jump is made around all subsequent\n** inner loops (or around the \"...\" if the test occurs within the inner-\n** most loop)\n**\n** OUTER JOINS\n**\n** An outer join of tables t1 and t2 is conceptally coded as follows:\n**\n**    foreach row1 in t1 do\n**      flag = 0\n**      foreach row2 in t2 do\n**        start:\n**          ...\n**          flag = 1\n**      end\n**      if flag==0 then\n**        move the row2 cursor to a null row\n**        goto start\n**      fi\n**    end\n**\n** ORDER BY CLAUSE PROCESSING\n**\n** pOrderBy is a pointer to the ORDER BY clause (or the GROUP BY clause\n** if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement\n** if there is one.  If there is no ORDER BY clause or if this routine\n** is called from an UPDATE or DELETE statement, then pOrderBy is NULL.\n**\n** The iIdxCur parameter is the cursor number of an index.  If \n** WHERE_OR_SUBCLAUSE is set, iIdxCur is the cursor number of an index\n** to use for OR clause processing.  The WHERE clause should use this\n** specific cursor.  If WHERE_ONEPASS_DESIRED is set, then iIdxCur is\n** the first cursor in an array of cursors for all indices.  iIdxCur should\n** be used to compute the appropriate cursor depending on which index is\n** used.\n*/\nWhereInfo *sqlite3WhereBegin(\n  Parse *pParse,          /* The parser context */\n  SrcList *pTabList,      /* FROM clause: A list of all tables to be scanned */\n  Expr *pWhere,           /* The WHERE clause */\n  ExprList *pOrderBy,     /* An ORDER BY (or GROUP BY) clause, or NULL */\n  ExprList *pDistinctSet, /* Try not to output two rows that duplicate these */\n  u16 wctrlFlags,         /* The WHERE_* flags defined in sqliteInt.h */\n  int iAuxArg             /* If WHERE_OR_SUBCLAUSE is set, index cursor number\n                          ** If WHERE_USE_LIMIT, then the limit amount */\n){\n  int nByteWInfo;            /* Num. bytes allocated for WhereInfo struct */\n  int nTabList;              /* Number of elements in pTabList */\n  WhereInfo *pWInfo;         /* Will become the return value of this function */\n  Vdbe *v = pParse->pVdbe;   /* The virtual database engine */\n  Bitmask notReady;          /* Cursors that are not yet positioned */\n  WhereLoopBuilder sWLB;     /* The WhereLoop builder */\n  WhereMaskSet *pMaskSet;    /* The expression mask set */\n  WhereLevel *pLevel;        /* A single level in pWInfo->a[] */\n  WhereLoop *pLoop;          /* Pointer to a single WhereLoop object */\n  int ii;                    /* Loop counter */\n  sqlite3 *db;               /* Database connection */\n  int rc;                    /* Return code */\n  u8 bFordelete = 0;         /* OPFLAG_FORDELETE or zero, as appropriate */\n\n  assert( (wctrlFlags & WHERE_ONEPASS_MULTIROW)==0 || (\n        (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 \n     && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 \n  ));\n\n  /* Only one of WHERE_OR_SUBCLAUSE or WHERE_USE_LIMIT */\n  assert( (wctrlFlags & WHERE_OR_SUBCLAUSE)==0\n            || (wctrlFlags & WHERE_USE_LIMIT)==0 );\n\n  /* Variable initialization */\n  db = pParse->db;\n  memset(&sWLB, 0, sizeof(sWLB));\n\n  /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */\n  testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );\n  if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;\n  sWLB.pOrderBy = pOrderBy;\n\n  /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via\n  ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */\n  if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){\n    wctrlFlags &= ~WHERE_WANT_DISTINCT;\n  }\n\n  /* The number of tables in the FROM clause is limited by the number of\n  ** bits in a Bitmask \n  */\n  testcase( pTabList->nSrc==BMS );\n  if( pTabList->nSrc>BMS ){\n    sqlite3ErrorMsg(pParse, \"at most %d tables in a join\", BMS);\n    return 0;\n  }\n\n  /* This function normally generates a nested loop for all tables in \n  ** pTabList.  But if the WHERE_OR_SUBCLAUSE flag is set, then we should\n  ** only generate code for the first table in pTabList and assume that\n  ** any cursors associated with subsequent tables are uninitialized.\n  */\n  nTabList = (wctrlFlags & WHERE_OR_SUBCLAUSE) ? 1 : pTabList->nSrc;\n\n  /* Allocate and initialize the WhereInfo structure that will become the\n  ** return value. A single allocation is used to store the WhereInfo\n  ** struct, the contents of WhereInfo.a[], the WhereClause structure\n  ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte\n  ** field (type Bitmask) it must be aligned on an 8-byte boundary on\n  ** some architectures. Hence the ROUND8() below.\n  */\n  nByteWInfo = ROUND8(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel));\n  pWInfo = sqlite3DbMallocRawNN(db, nByteWInfo + sizeof(WhereLoop));\n  if( db->mallocFailed ){\n    sqlite3DbFree(db, pWInfo);\n    pWInfo = 0;\n    goto whereBeginError;\n  }\n  pWInfo->pParse = pParse;\n  pWInfo->pTabList = pTabList;\n  pWInfo->pOrderBy = pOrderBy;\n  pWInfo->pDistinctSet = pDistinctSet;\n  pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1;\n  pWInfo->nLevel = nTabList;\n  pWInfo->iBreak = pWInfo->iContinue = sqlite3VdbeMakeLabel(v);\n  pWInfo->wctrlFlags = wctrlFlags;\n  pWInfo->iLimit = iAuxArg;\n  pWInfo->savedNQueryLoop = pParse->nQueryLoop;\n  memset(&pWInfo->nOBSat, 0, \n         offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat));\n  memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel));\n  assert( pWInfo->eOnePass==ONEPASS_OFF );  /* ONEPASS defaults to OFF */\n  pMaskSet = &pWInfo->sMaskSet;\n  sWLB.pWInfo = pWInfo;\n  sWLB.pWC = &pWInfo->sWC;\n  sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo);\n  assert( EIGHT_BYTE_ALIGNMENT(sWLB.pNew) );\n  whereLoopInit(sWLB.pNew);\n#ifdef SQLITE_DEBUG\n  sWLB.pNew->cId = '*';\n#endif\n\n  /* Split the WHERE clause into separate subexpressions where each\n  ** subexpression is separated by an AND operator.\n  */\n  initMaskSet(pMaskSet);\n  sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo);\n  sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);\n    \n  /* Special case: a WHERE clause that is constant.  Evaluate the\n  ** expression and either jump over all of the code or fall thru.\n  */\n  for(ii=0; ii<sWLB.pWC->nTerm; ii++){\n    if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){\n      sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak,\n                         SQLITE_JUMPIFNULL);\n      sWLB.pWC->a[ii].wtFlags |= TERM_CODED;\n    }\n  }\n\n  /* Special case: No FROM clause\n  */\n  if( nTabList==0 ){\n    if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr;\n    if( wctrlFlags & WHERE_WANT_DISTINCT ){\n      pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;\n    }\n  }\n\n  /* Assign a bit from the bitmask to every term in the FROM clause.\n  **\n  ** The N-th term of the FROM clause is assigned a bitmask of 1<<N.\n  **\n  ** The rule of the previous sentence ensures thta if X is the bitmask for\n  ** a table T, then X-1 is the bitmask for all other tables to the left of T.\n  ** Knowing the bitmask for all tables to the left of a left join is\n  ** important.  Ticket #3015.\n  **\n  ** Note that bitmasks are created for all pTabList->nSrc tables in\n  ** pTabList, not just the first nTabList tables.  nTabList is normally\n  ** equal to pTabList->nSrc but might be shortened to 1 if the\n  ** WHERE_OR_SUBCLAUSE flag is set.\n  */\n  for(ii=0; ii<pTabList->nSrc; ii++){\n    createMask(pMaskSet, pTabList->a[ii].iCursor);\n    sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC);\n  }\n#ifdef SQLITE_DEBUG\n  for(ii=0; ii<pTabList->nSrc; ii++){\n    Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor);\n    assert( m==MASKBIT(ii) );\n  }\n#endif\n\n  /* Analyze all of the subexpressions. */\n  sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);\n  if( db->mallocFailed ) goto whereBeginError;\n\n  if( wctrlFlags & WHERE_WANT_DISTINCT ){\n    if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pDistinctSet) ){\n      /* The DISTINCT marking is pointless.  Ignore it. */\n      pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;\n    }else if( pOrderBy==0 ){\n      /* Try to ORDER BY the result set to make distinct processing easier */\n      pWInfo->wctrlFlags |= WHERE_DISTINCTBY;\n      pWInfo->pOrderBy = pDistinctSet;\n    }\n  }\n\n  /* Construct the WhereLoop objects */\n#if defined(WHERETRACE_ENABLED)\n  if( sqlite3WhereTrace & 0xffff ){\n    sqlite3DebugPrintf(\"*** Optimizer Start *** (wctrlFlags: 0x%x\",wctrlFlags);\n    if( wctrlFlags & WHERE_USE_LIMIT ){\n      sqlite3DebugPrintf(\", limit: %d\", iAuxArg);\n    }\n    sqlite3DebugPrintf(\")\\n\");\n  }\n  if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */\n    sqlite3WhereClausePrint(sWLB.pWC);\n  }\n#endif\n\n  if( nTabList!=1 || whereShortCut(&sWLB)==0 ){\n    rc = whereLoopAddAll(&sWLB);\n    if( rc ) goto whereBeginError;\n  \n#ifdef WHERETRACE_ENABLED\n    if( sqlite3WhereTrace ){    /* Display all of the WhereLoop objects */\n      WhereLoop *p;\n      int i;\n      static const char zLabel[] = \"0123456789abcdefghijklmnopqrstuvwyxz\"\n                                             \"ABCDEFGHIJKLMNOPQRSTUVWYXZ\";\n      for(p=pWInfo->pLoops, i=0; p; p=p->pNextLoop, i++){\n        p->cId = zLabel[i%sizeof(zLabel)];\n        whereLoopPrint(p, sWLB.pWC);\n      }\n    }\n#endif\n  \n    wherePathSolver(pWInfo, 0);\n    if( db->mallocFailed ) goto whereBeginError;\n    if( pWInfo->pOrderBy ){\n       wherePathSolver(pWInfo, pWInfo->nRowOut+1);\n       if( db->mallocFailed ) goto whereBeginError;\n    }\n  }\n  if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){\n     pWInfo->revMask = ALLBITS;\n  }\n  if( pParse->nErr || NEVER(db->mallocFailed) ){\n    goto whereBeginError;\n  }\n#ifdef WHERETRACE_ENABLED\n  if( sqlite3WhereTrace ){\n    sqlite3DebugPrintf(\"---- Solution nRow=%d\", pWInfo->nRowOut);\n    if( pWInfo->nOBSat>0 ){\n      sqlite3DebugPrintf(\" ORDERBY=%d,0x%llx\", pWInfo->nOBSat, pWInfo->revMask);\n    }\n    switch( pWInfo->eDistinct ){\n      case WHERE_DISTINCT_UNIQUE: {\n        sqlite3DebugPrintf(\"  DISTINCT=unique\");\n        break;\n      }\n      case WHERE_DISTINCT_ORDERED: {\n        sqlite3DebugPrintf(\"  DISTINCT=ordered\");\n        break;\n      }\n      case WHERE_DISTINCT_UNORDERED: {\n        sqlite3DebugPrintf(\"  DISTINCT=unordered\");\n        break;\n      }\n    }\n    sqlite3DebugPrintf(\"\\n\");\n    for(ii=0; ii<pWInfo->nLevel; ii++){\n      whereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC);\n    }\n  }\n#endif\n  /* Attempt to omit tables from the join that do not effect the result */\n  if( pWInfo->nLevel>=2\n   && pDistinctSet!=0\n   && OptimizationEnabled(db, SQLITE_OmitNoopJoin)\n  ){\n    Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pDistinctSet);\n    if( sWLB.pOrderBy ){\n      tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);\n    }\n    while( pWInfo->nLevel>=2 ){\n      WhereTerm *pTerm, *pEnd;\n      pLoop = pWInfo->a[pWInfo->nLevel-1].pWLoop;\n      if( (pWInfo->pTabList->a[pLoop->iTab].fg.jointype & JT_LEFT)==0 ) break;\n      if( (wctrlFlags & WHERE_WANT_DISTINCT)==0\n       && (pLoop->wsFlags & WHERE_ONEROW)==0\n      ){\n        break;\n      }\n      if( (tabUsed & pLoop->maskSelf)!=0 ) break;\n      pEnd = sWLB.pWC->a + sWLB.pWC->nTerm;\n      for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){\n        if( (pTerm->prereqAll & pLoop->maskSelf)!=0\n         && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)\n        ){\n          break;\n        }\n      }\n      if( pTerm<pEnd ) break;\n      WHERETRACE(0xffff, (\"-> drop loop %c not used\\n\", pLoop->cId));\n      pWInfo->nLevel--;\n      nTabList--;\n    }\n  }\n  WHERETRACE(0xffff,(\"*** Optimizer Finished ***\\n\"));\n  pWInfo->pParse->nQueryLoop += pWInfo->nRowOut;\n\n  /* If the caller is an UPDATE or DELETE statement that is requesting\n  ** to use a one-pass algorithm, determine if this is appropriate.\n  */\n  assert( (wctrlFlags & WHERE_ONEPASS_DESIRED)==0 || pWInfo->nLevel==1 );\n  if( (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 ){\n    int wsFlags = pWInfo->a[0].pWLoop->wsFlags;\n    int bOnerow = (wsFlags & WHERE_ONEROW)!=0;\n    if( bOnerow\n     || ((wctrlFlags & WHERE_ONEPASS_MULTIROW)!=0\n           && 0==(wsFlags & WHERE_VIRTUALTABLE))\n    ){\n      pWInfo->eOnePass = bOnerow ? ONEPASS_SINGLE : ONEPASS_MULTI;\n      if( HasRowid(pTabList->a[0].pTab) && (wsFlags & WHERE_IDX_ONLY) ){\n        if( wctrlFlags & WHERE_ONEPASS_MULTIROW ){\n          bFordelete = OPFLAG_FORDELETE;\n        }\n        pWInfo->a[0].pWLoop->wsFlags = (wsFlags & ~WHERE_IDX_ONLY);\n      }\n    }\n  }\n\n  /* Open all tables in the pTabList and any indices selected for\n  ** searching those tables.\n  */\n  for(ii=0, pLevel=pWInfo->a; ii<nTabList; ii++, pLevel++){\n    Table *pTab;     /* Table to open */\n    int iDb;         /* Index of database containing table/index */\n    struct SrcList_item *pTabItem;\n\n    pTabItem = &pTabList->a[pLevel->iFrom];\n    pTab = pTabItem->pTab;\n    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);\n    pLoop = pLevel->pWLoop;\n    if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){\n      /* Do nothing */\n    }else\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){\n      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);\n      int iCur = pTabItem->iCursor;\n      sqlite3VdbeAddOp4(v, OP_VOpen, iCur, 0, 0, pVTab, P4_VTAB);\n    }else if( IsVirtual(pTab) ){\n      /* noop */\n    }else\n#endif\n    if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0\n         && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){\n      int op = OP_OpenRead;\n      if( pWInfo->eOnePass!=ONEPASS_OFF ){\n        op = OP_OpenWrite;\n        pWInfo->aiCurOnePass[0] = pTabItem->iCursor;\n      };\n      sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op);\n      assert( pTabItem->iCursor==pLevel->iTabCur );\n      testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS-1 );\n      testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS );\n      if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol<BMS && HasRowid(pTab) ){\n        Bitmask b = pTabItem->colUsed;\n        int n = 0;\n        for(; b; b=b>>1, n++){}\n        sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);\n        assert( n<=pTab->nCol );\n      }\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n      if( pLoop->u.btree.pIndex!=0 ){\n        sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);\n      }else\n#endif\n      {\n        sqlite3VdbeChangeP5(v, bFordelete);\n      }\n#ifdef SQLITE_ENABLE_COLUMN_USED_MASK\n      sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, pTabItem->iCursor, 0, 0,\n                            (const u8*)&pTabItem->colUsed, P4_INT64);\n#endif\n    }else{\n      sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);\n    }\n    if( pLoop->wsFlags & WHERE_INDEXED ){\n      Index *pIx = pLoop->u.btree.pIndex;\n      int iIndexCur;\n      int op = OP_OpenRead;\n      /* iAuxArg is always set if to a positive value if ONEPASS is possible */\n      assert( iAuxArg!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 );\n      if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)\n       && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0\n      ){\n        /* This is one term of an OR-optimization using the PRIMARY KEY of a\n        ** WITHOUT ROWID table.  No need for a separate index */\n        iIndexCur = pLevel->iTabCur;\n        op = 0;\n      }else if( pWInfo->eOnePass!=ONEPASS_OFF ){\n        Index *pJ = pTabItem->pTab->pIndex;\n        iIndexCur = iAuxArg;\n        assert( wctrlFlags & WHERE_ONEPASS_DESIRED );\n        while( ALWAYS(pJ) && pJ!=pIx ){\n          iIndexCur++;\n          pJ = pJ->pNext;\n        }\n        op = OP_OpenWrite;\n        pWInfo->aiCurOnePass[1] = iIndexCur;\n      }else if( iAuxArg && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ){\n        iIndexCur = iAuxArg;\n        op = OP_ReopenIdx;\n      }else{\n        iIndexCur = pParse->nTab++;\n      }\n      pLevel->iIdxCur = iIndexCur;\n      assert( pIx->pSchema==pTab->pSchema );\n      assert( iIndexCur>=0 );\n      if( op ){\n        sqlite3VdbeAddOp3(v, op, iIndexCur, pIx->tnum, iDb);\n        sqlite3VdbeSetP4KeyInfo(pParse, pIx);\n        if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0\n         && (pLoop->wsFlags & (WHERE_COLUMN_RANGE|WHERE_SKIPSCAN))==0\n         && (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0\n        ){\n          sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ); /* Hint to COMDB2 */\n        }\n        VdbeComment((v, \"%s\", pIx->zName));\n#ifdef SQLITE_ENABLE_COLUMN_USED_MASK\n        {\n          u64 colUsed = 0;\n          int ii, jj;\n          for(ii=0; ii<pIx->nColumn; ii++){\n            jj = pIx->aiColumn[ii];\n            if( jj<0 ) continue;\n            if( jj>63 ) jj = 63;\n            if( (pTabItem->colUsed & MASKBIT(jj))==0 ) continue;\n            colUsed |= ((u64)1)<<(ii<63 ? ii : 63);\n          }\n          sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, iIndexCur, 0, 0,\n                                (u8*)&colUsed, P4_INT64);\n        }\n#endif /* SQLITE_ENABLE_COLUMN_USED_MASK */\n      }\n    }\n    if( iDb>=0 ) sqlite3CodeVerifySchema(pParse, iDb);\n  }\n  pWInfo->iTop = sqlite3VdbeCurrentAddr(v);\n  if( db->mallocFailed ) goto whereBeginError;\n\n  /* Generate the code to do the search.  Each iteration of the for\n  ** loop below generates code for a single nested loop of the VM\n  ** program.\n  */\n  notReady = ~(Bitmask)0;\n  for(ii=0; ii<nTabList; ii++){\n    int addrExplain;\n    int wsFlags;\n    pLevel = &pWInfo->a[ii];\n    wsFlags = pLevel->pWLoop->wsFlags;\n#ifndef SQLITE_OMIT_AUTOMATIC_INDEX\n    if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){\n      constructAutomaticIndex(pParse, &pWInfo->sWC,\n                &pTabList->a[pLevel->iFrom], notReady, pLevel);\n      if( db->mallocFailed ) goto whereBeginError;\n    }\n#endif\n    addrExplain = sqlite3WhereExplainOneScan(\n        pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags\n    );\n    pLevel->addrBody = sqlite3VdbeCurrentAddr(v);\n    notReady = sqlite3WhereCodeOneLoopStart(pWInfo, ii, notReady);\n    pWInfo->iContinue = pLevel->addrCont;\n    if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_OR_SUBCLAUSE)==0 ){\n      sqlite3WhereAddScanStatus(v, pTabList, pLevel, addrExplain);\n    }\n  }\n\n  /* Done. */\n  VdbeModuleComment((v, \"Begin WHERE-core\"));\n  return pWInfo;\n\n  /* Jump here if malloc fails */\nwhereBeginError:\n  if( pWInfo ){\n    pParse->nQueryLoop = pWInfo->savedNQueryLoop;\n    whereInfoFree(db, pWInfo);\n  }\n  return 0;\n}\n\n/*\n** Generate the end of the WHERE loop.  See comments on \n** sqlite3WhereBegin() for additional information.\n*/\nvoid sqlite3WhereEnd(WhereInfo *pWInfo){\n  Parse *pParse = pWInfo->pParse;\n  Vdbe *v = pParse->pVdbe;\n  int i;\n  WhereLevel *pLevel;\n  WhereLoop *pLoop;\n  SrcList *pTabList = pWInfo->pTabList;\n  sqlite3 *db = pParse->db;\n\n  /* Generate loop termination code.\n  */\n  VdbeModuleComment((v, \"End WHERE-core\"));\n  sqlite3ExprCacheClear(pParse);\n  for(i=pWInfo->nLevel-1; i>=0; i--){\n    int addr;\n    pLevel = &pWInfo->a[i];\n    pLoop = pLevel->pWLoop;\n    sqlite3VdbeResolveLabel(v, pLevel->addrCont);\n    if( pLevel->op!=OP_Noop ){\n      sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);\n      sqlite3VdbeChangeP5(v, pLevel->p5);\n      VdbeCoverage(v);\n      VdbeCoverageIf(v, pLevel->op==OP_Next);\n      VdbeCoverageIf(v, pLevel->op==OP_Prev);\n      VdbeCoverageIf(v, pLevel->op==OP_VNext);\n    }\n    if( pLoop->wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){\n      struct InLoop *pIn;\n      int j;\n      sqlite3VdbeResolveLabel(v, pLevel->addrNxt);\n      for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){\n        sqlite3VdbeJumpHere(v, pIn->addrInTop+1);\n        if( pIn->eEndLoopOp!=OP_Noop ){\n          sqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop);\n          VdbeCoverage(v);\n          VdbeCoverageIf(v, pIn->eEndLoopOp==OP_PrevIfOpen);\n          VdbeCoverageIf(v, pIn->eEndLoopOp==OP_NextIfOpen);\n        }\n        sqlite3VdbeJumpHere(v, pIn->addrInTop-1);\n      }\n    }\n    sqlite3VdbeResolveLabel(v, pLevel->addrBrk);\n    if( pLevel->addrSkip ){\n      sqlite3VdbeGoto(v, pLevel->addrSkip);\n      VdbeComment((v, \"next skip-scan on %s\", pLoop->u.btree.pIndex->zName));\n      sqlite3VdbeJumpHere(v, pLevel->addrSkip);\n      sqlite3VdbeJumpHere(v, pLevel->addrSkip-2);\n    }\n#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n    if( pLevel->addrLikeRep ){\n      sqlite3VdbeAddOp2(v, OP_DecrJumpZero, (int)(pLevel->iLikeRepCntr>>1),\n                        pLevel->addrLikeRep);\n      VdbeCoverage(v);\n    }\n#endif\n    if( pLevel->iLeftJoin ){\n      int ws = pLoop->wsFlags;\n      addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v);\n      assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 );\n      if( (ws & WHERE_IDX_ONLY)==0 ){\n        sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor);\n      }\n      if( (ws & WHERE_INDEXED) \n       || ((ws & WHERE_MULTI_OR) && pLevel->u.pCovidx) \n      ){\n        sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);\n      }\n      if( pLevel->op==OP_Return ){\n        sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst);\n      }else{\n        sqlite3VdbeGoto(v, pLevel->addrFirst);\n      }\n      sqlite3VdbeJumpHere(v, addr);\n    }\n    VdbeModuleComment((v, \"End WHERE-loop%d: %s\", i,\n                     pWInfo->pTabList->a[pLevel->iFrom].pTab->zName));\n  }\n\n  /* The \"break\" point is here, just past the end of the outer loop.\n  ** Set it.\n  */\n  sqlite3VdbeResolveLabel(v, pWInfo->iBreak);\n\n  assert( pWInfo->nLevel<=pTabList->nSrc );\n  for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){\n    int k, last;\n    VdbeOp *pOp;\n    Index *pIdx = 0;\n    struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];\n    Table *pTab = pTabItem->pTab;\n    assert( pTab!=0 );\n    pLoop = pLevel->pWLoop;\n\n    /* For a co-routine, change all OP_Column references to the table of\n    ** the co-routine into OP_Copy of result contained in a register.\n    ** OP_Rowid becomes OP_Null.\n    */\n    if( pTabItem->fg.viaCoroutine && !db->mallocFailed ){\n      translateColumnToCopy(v, pLevel->addrBody, pLevel->iTabCur,\n                            pTabItem->regResult, 0);\n      continue;\n    }\n\n    /* Close all of the cursors that were opened by sqlite3WhereBegin.\n    ** Except, do not close cursors that will be reused by the OR optimization\n    ** (WHERE_OR_SUBCLAUSE).  And do not close the OP_OpenWrite cursors\n    ** created for the ONEPASS optimization.\n    */\n    if( (pTab->tabFlags & TF_Ephemeral)==0\n     && pTab->pSelect==0\n     && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0\n    ){\n      int ws = pLoop->wsFlags;\n      if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){\n        sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);\n      }\n      if( (ws & WHERE_INDEXED)!=0\n       && (ws & (WHERE_IPK|WHERE_AUTO_INDEX))==0 \n       && pLevel->iIdxCur!=pWInfo->aiCurOnePass[1]\n      ){\n        sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur);\n      }\n    }\n\n    /* If this scan uses an index, make VDBE code substitutions to read data\n    ** from the index instead of from the table where possible.  In some cases\n    ** this optimization prevents the table from ever being read, which can\n    ** yield a significant performance boost.\n    ** \n    ** Calls to the code generator in between sqlite3WhereBegin and\n    ** sqlite3WhereEnd will have created code that references the table\n    ** directly.  This loop scans all that code looking for opcodes\n    ** that reference the table and converts them into opcodes that\n    ** reference the index.\n    */\n    if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){\n      pIdx = pLoop->u.btree.pIndex;\n    }else if( pLoop->wsFlags & WHERE_MULTI_OR ){\n      pIdx = pLevel->u.pCovidx;\n    }\n    if( pIdx\n     && (pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable))\n     && !db->mallocFailed\n    ){\n      last = sqlite3VdbeCurrentAddr(v);\n      k = pLevel->addrBody;\n      pOp = sqlite3VdbeGetOp(v, k);\n      for(; k<last; k++, pOp++){\n        if( pOp->p1!=pLevel->iTabCur ) continue;\n        if( pOp->opcode==OP_Column ){\n          int x = pOp->p2;\n          assert( pIdx->pTable==pTab );\n          if( !HasRowid(pTab) ){\n            Index *pPk = sqlite3PrimaryKeyIndex(pTab);\n            x = pPk->aiColumn[x];\n            assert( x>=0 );\n          }\n          x = sqlite3ColumnOfIndex(pIdx, x);\n          if( x>=0 ){\n            pOp->p2 = x;\n            pOp->p1 = pLevel->iIdxCur;\n          }\n          assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 || x>=0 );\n        }else if( pOp->opcode==OP_Rowid ){\n          pOp->p1 = pLevel->iIdxCur;\n          pOp->opcode = OP_IdxRowid;\n        }\n      }\n    }\n  }\n\n  /* Final cleanup\n  */\n  pParse->nQueryLoop = pWInfo->savedNQueryLoop;\n  whereInfoFree(db, pWInfo);\n  return;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/whereInt.h",
    "content": "/*\n** 2013-11-12\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n**\n** This file contains structure and macro definitions for the query\n** planner logic in \"where.c\".  These definitions are broken out into\n** a separate source file for easier editing.\n*/\n\n/*\n** Trace output macros\n*/\n#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)\n/***/ int sqlite3WhereTrace;\n#endif\n#if defined(SQLITE_DEBUG) \\\n    && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))\n# define WHERETRACE(K,X)  if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X\n# define WHERETRACE_ENABLED 1\n#else\n# define WHERETRACE(K,X)\n#endif\n\n/* Forward references\n*/\ntypedef struct WhereClause WhereClause;\ntypedef struct WhereMaskSet WhereMaskSet;\ntypedef struct WhereOrInfo WhereOrInfo;\ntypedef struct WhereAndInfo WhereAndInfo;\ntypedef struct WhereLevel WhereLevel;\ntypedef struct WhereLoop WhereLoop;\ntypedef struct WherePath WherePath;\ntypedef struct WhereTerm WhereTerm;\ntypedef struct WhereLoopBuilder WhereLoopBuilder;\ntypedef struct WhereScan WhereScan;\ntypedef struct WhereOrCost WhereOrCost;\ntypedef struct WhereOrSet WhereOrSet;\n\n/*\n** This object contains information needed to implement a single nested\n** loop in WHERE clause.\n**\n** Contrast this object with WhereLoop.  This object describes the\n** implementation of the loop.  WhereLoop describes the algorithm.\n** This object contains a pointer to the WhereLoop algorithm as one of\n** its elements.\n**\n** The WhereInfo object contains a single instance of this object for\n** each term in the FROM clause (which is to say, for each of the\n** nested loops as implemented).  The order of WhereLevel objects determines\n** the loop nested order, with WhereInfo.a[0] being the outer loop and\n** WhereInfo.a[WhereInfo.nLevel-1] being the inner loop.\n*/\nstruct WhereLevel {\n  int iLeftJoin;        /* Memory cell used to implement LEFT OUTER JOIN */\n  int iTabCur;          /* The VDBE cursor used to access the table */\n  int iIdxCur;          /* The VDBE cursor used to access pIdx */\n  int addrBrk;          /* Jump here to break out of the loop */\n  int addrNxt;          /* Jump here to start the next IN combination */\n  int addrSkip;         /* Jump here for next iteration of skip-scan */\n  int addrCont;         /* Jump here to continue with the next loop cycle */\n  int addrFirst;        /* First instruction of interior of the loop */\n  int addrBody;         /* Beginning of the body of this loop */\n#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n  u32 iLikeRepCntr;     /* LIKE range processing counter register (times 2) */\n  int addrLikeRep;      /* LIKE range processing address */\n#endif\n  u8 iFrom;             /* Which entry in the FROM clause */\n  u8 op, p3, p5;        /* Opcode, P3 & P5 of the opcode that ends the loop */\n  int p1, p2;           /* Operands of the opcode used to ends the loop */\n  union {               /* Information that depends on pWLoop->wsFlags */\n    struct {\n      int nIn;              /* Number of entries in aInLoop[] */\n      struct InLoop {\n        int iCur;              /* The VDBE cursor used by this IN operator */\n        int addrInTop;         /* Top of the IN loop */\n        u8 eEndLoopOp;         /* IN Loop terminator. OP_Next or OP_Prev */\n      } *aInLoop;           /* Information about each nested IN operator */\n    } in;                 /* Used when pWLoop->wsFlags&WHERE_IN_ABLE */\n    Index *pCovidx;       /* Possible covering index for WHERE_MULTI_OR */\n  } u;\n  struct WhereLoop *pWLoop;  /* The selected WhereLoop object */\n  Bitmask notReady;          /* FROM entries not usable at this level */\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n  int addrVisit;        /* Address at which row is visited */\n#endif\n};\n\n/*\n** Each instance of this object represents an algorithm for evaluating one\n** term of a join.  Every term of the FROM clause will have at least\n** one corresponding WhereLoop object (unless INDEXED BY constraints\n** prevent a query solution - which is an error) and many terms of the\n** FROM clause will have multiple WhereLoop objects, each describing a\n** potential way of implementing that FROM-clause term, together with\n** dependencies and cost estimates for using the chosen algorithm.\n**\n** Query planning consists of building up a collection of these WhereLoop\n** objects, then computing a particular sequence of WhereLoop objects, with\n** one WhereLoop object per FROM clause term, that satisfy all dependencies\n** and that minimize the overall cost.\n*/\nstruct WhereLoop {\n  Bitmask prereq;       /* Bitmask of other loops that must run first */\n  Bitmask maskSelf;     /* Bitmask identifying table iTab */\n#ifdef SQLITE_DEBUG\n  char cId;             /* Symbolic ID of this loop for debugging use */\n#endif\n  u8 iTab;              /* Position in FROM clause of table for this loop */\n  u8 iSortIdx;          /* Sorting index number.  0==None */\n  LogEst rSetup;        /* One-time setup cost (ex: create transient index) */\n  LogEst rRun;          /* Cost of running each loop */\n  LogEst nOut;          /* Estimated number of output rows */\n  union {\n    struct {               /* Information for internal btree tables */\n      u16 nEq;               /* Number of equality constraints */\n      u16 nBtm;              /* Size of BTM vector */\n      u16 nTop;              /* Size of TOP vector */\n      Index *pIndex;         /* Index used, or NULL */\n    } btree;\n    struct {               /* Information for virtual tables */\n      int idxNum;            /* Index number */\n      u8 needFree;           /* True if sqlite3_free(idxStr) is needed */\n      i8 isOrdered;          /* True if satisfies ORDER BY */\n      u16 omitMask;          /* Terms that may be omitted */\n      char *idxStr;          /* Index identifier string */\n    } vtab;\n  } u;\n  u32 wsFlags;          /* WHERE_* flags describing the plan */\n  u16 nLTerm;           /* Number of entries in aLTerm[] */\n  u16 nSkip;            /* Number of NULL aLTerm[] entries */\n  /**** whereLoopXfer() copies fields above ***********************/\n# define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot)\n  u16 nLSlot;           /* Number of slots allocated for aLTerm[] */\n  WhereTerm **aLTerm;   /* WhereTerms used */\n  WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */\n  WhereTerm *aLTermSpace[3];  /* Initial aLTerm[] space */\n};\n\n/* This object holds the prerequisites and the cost of running a\n** subquery on one operand of an OR operator in the WHERE clause.\n** See WhereOrSet for additional information \n*/\nstruct WhereOrCost {\n  Bitmask prereq;     /* Prerequisites */\n  LogEst rRun;        /* Cost of running this subquery */\n  LogEst nOut;        /* Number of outputs for this subquery */\n};\n\n/* The WhereOrSet object holds a set of possible WhereOrCosts that\n** correspond to the subquery(s) of OR-clause processing.  Only the\n** best N_OR_COST elements are retained.\n*/\n#define N_OR_COST 3\nstruct WhereOrSet {\n  u16 n;                      /* Number of valid a[] entries */\n  WhereOrCost a[N_OR_COST];   /* Set of best costs */\n};\n\n/*\n** Each instance of this object holds a sequence of WhereLoop objects\n** that implement some or all of a query plan.\n**\n** Think of each WhereLoop object as a node in a graph with arcs\n** showing dependencies and costs for travelling between nodes.  (That is\n** not a completely accurate description because WhereLoop costs are a\n** vector, not a scalar, and because dependencies are many-to-one, not\n** one-to-one as are graph nodes.  But it is a useful visualization aid.)\n** Then a WherePath object is a path through the graph that visits some\n** or all of the WhereLoop objects once.\n**\n** The \"solver\" works by creating the N best WherePath objects of length\n** 1.  Then using those as a basis to compute the N best WherePath objects\n** of length 2.  And so forth until the length of WherePaths equals the\n** number of nodes in the FROM clause.  The best (lowest cost) WherePath\n** at the end is the chosen query plan.\n*/\nstruct WherePath {\n  Bitmask maskLoop;     /* Bitmask of all WhereLoop objects in this path */\n  Bitmask revLoop;      /* aLoop[]s that should be reversed for ORDER BY */\n  LogEst nRow;          /* Estimated number of rows generated by this path */\n  LogEst rCost;         /* Total cost of this path */\n  LogEst rUnsorted;     /* Total cost of this path ignoring sorting costs */\n  i8 isOrdered;         /* No. of ORDER BY terms satisfied. -1 for unknown */\n  WhereLoop **aLoop;    /* Array of WhereLoop objects implementing this path */\n};\n\n/*\n** The query generator uses an array of instances of this structure to\n** help it analyze the subexpressions of the WHERE clause.  Each WHERE\n** clause subexpression is separated from the others by AND operators,\n** usually, or sometimes subexpressions separated by OR.\n**\n** All WhereTerms are collected into a single WhereClause structure.  \n** The following identity holds:\n**\n**        WhereTerm.pWC->a[WhereTerm.idx] == WhereTerm\n**\n** When a term is of the form:\n**\n**              X <op> <expr>\n**\n** where X is a column name and <op> is one of certain operators,\n** then WhereTerm.leftCursor and WhereTerm.u.leftColumn record the\n** cursor number and column number for X.  WhereTerm.eOperator records\n** the <op> using a bitmask encoding defined by WO_xxx below.  The\n** use of a bitmask encoding for the operator allows us to search\n** quickly for terms that match any of several different operators.\n**\n** A WhereTerm might also be two or more subterms connected by OR:\n**\n**         (t1.X <op> <expr>) OR (t1.Y <op> <expr>) OR ....\n**\n** In this second case, wtFlag has the TERM_ORINFO bit set and eOperator==WO_OR\n** and the WhereTerm.u.pOrInfo field points to auxiliary information that\n** is collected about the OR clause.\n**\n** If a term in the WHERE clause does not match either of the two previous\n** categories, then eOperator==0.  The WhereTerm.pExpr field is still set\n** to the original subexpression content and wtFlags is set up appropriately\n** but no other fields in the WhereTerm object are meaningful.\n**\n** When eOperator!=0, prereqRight and prereqAll record sets of cursor numbers,\n** but they do so indirectly.  A single WhereMaskSet structure translates\n** cursor number into bits and the translated bit is stored in the prereq\n** fields.  The translation is used in order to maximize the number of\n** bits that will fit in a Bitmask.  The VDBE cursor numbers might be\n** spread out over the non-negative integers.  For example, the cursor\n** numbers might be 3, 8, 9, 10, 20, 23, 41, and 45.  The WhereMaskSet\n** translates these sparse cursor numbers into consecutive integers\n** beginning with 0 in order to make the best possible use of the available\n** bits in the Bitmask.  So, in the example above, the cursor numbers\n** would be mapped into integers 0 through 7.\n**\n** The number of terms in a join is limited by the number of bits\n** in prereqRight and prereqAll.  The default is 64 bits, hence SQLite\n** is only able to process joins with 64 or fewer tables.\n*/\nstruct WhereTerm {\n  Expr *pExpr;            /* Pointer to the subexpression that is this term */\n  WhereClause *pWC;       /* The clause this term is part of */\n  LogEst truthProb;       /* Probability of truth for this expression */\n  u16 wtFlags;            /* TERM_xxx bit flags.  See below */\n  u16 eOperator;          /* A WO_xx value describing <op> */\n  u8 nChild;              /* Number of children that must disable us */\n  u8 eMatchOp;            /* Op for vtab MATCH/LIKE/GLOB/REGEXP terms */\n  int iParent;            /* Disable pWC->a[iParent] when this term disabled */\n  int leftCursor;         /* Cursor number of X in \"X <op> <expr>\" */\n  int iField;             /* Field in (?,?,?) IN (SELECT...) vector */\n  union {\n    int leftColumn;         /* Column number of X in \"X <op> <expr>\" */\n    WhereOrInfo *pOrInfo;   /* Extra information if (eOperator & WO_OR)!=0 */\n    WhereAndInfo *pAndInfo; /* Extra information if (eOperator& WO_AND)!=0 */\n  } u;\n  Bitmask prereqRight;    /* Bitmask of tables used by pExpr->pRight */\n  Bitmask prereqAll;      /* Bitmask of tables referenced by pExpr */\n};\n\n/*\n** Allowed values of WhereTerm.wtFlags\n*/\n#define TERM_DYNAMIC    0x01   /* Need to call sqlite3ExprDelete(db, pExpr) */\n#define TERM_VIRTUAL    0x02   /* Added by the optimizer.  Do not code */\n#define TERM_CODED      0x04   /* This term is already coded */\n#define TERM_COPIED     0x08   /* Has a child */\n#define TERM_ORINFO     0x10   /* Need to free the WhereTerm.u.pOrInfo object */\n#define TERM_ANDINFO    0x20   /* Need to free the WhereTerm.u.pAndInfo obj */\n#define TERM_OR_OK      0x40   /* Used during OR-clause processing */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n#  define TERM_VNULL    0x80   /* Manufactured x>NULL or x<=NULL term */\n#else\n#  define TERM_VNULL    0x00   /* Disabled if not using stat3 */\n#endif\n#define TERM_LIKEOPT    0x100  /* Virtual terms from the LIKE optimization */\n#define TERM_LIKECOND   0x200  /* Conditionally this LIKE operator term */\n#define TERM_LIKE       0x400  /* The original LIKE operator */\n#define TERM_IS         0x800  /* Term.pExpr is an IS operator */\n\n/*\n** An instance of the WhereScan object is used as an iterator for locating\n** terms in the WHERE clause that are useful to the query planner.\n*/\nstruct WhereScan {\n  WhereClause *pOrigWC;      /* Original, innermost WhereClause */\n  WhereClause *pWC;          /* WhereClause currently being scanned */\n  const char *zCollName;     /* Required collating sequence, if not NULL */\n  Expr *pIdxExpr;            /* Search for this index expression */\n  char idxaff;               /* Must match this affinity, if zCollName!=NULL */\n  unsigned char nEquiv;      /* Number of entries in aEquiv[] */\n  unsigned char iEquiv;      /* Next unused slot in aEquiv[] */\n  u32 opMask;                /* Acceptable operators */\n  int k;                     /* Resume scanning at this->pWC->a[this->k] */\n  int aiCur[11];             /* Cursors in the equivalence class */\n  i16 aiColumn[11];          /* Corresponding column number in the eq-class */\n};\n\n/*\n** An instance of the following structure holds all information about a\n** WHERE clause.  Mostly this is a container for one or more WhereTerms.\n**\n** Explanation of pOuter:  For a WHERE clause of the form\n**\n**           a AND ((b AND c) OR (d AND e)) AND f\n**\n** There are separate WhereClause objects for the whole clause and for\n** the subclauses \"(b AND c)\" and \"(d AND e)\".  The pOuter field of the\n** subclauses points to the WhereClause object for the whole clause.\n*/\nstruct WhereClause {\n  WhereInfo *pWInfo;       /* WHERE clause processing context */\n  WhereClause *pOuter;     /* Outer conjunction */\n  u8 op;                   /* Split operator.  TK_AND or TK_OR */\n  int nTerm;               /* Number of terms */\n  int nSlot;               /* Number of entries in a[] */\n  WhereTerm *a;            /* Each a[] describes a term of the WHERE cluase */\n#if defined(SQLITE_SMALL_STACK)\n  WhereTerm aStatic[1];    /* Initial static space for a[] */\n#else\n  WhereTerm aStatic[8];    /* Initial static space for a[] */\n#endif\n};\n\n/*\n** A WhereTerm with eOperator==WO_OR has its u.pOrInfo pointer set to\n** a dynamically allocated instance of the following structure.\n*/\nstruct WhereOrInfo {\n  WhereClause wc;          /* Decomposition into subterms */\n  Bitmask indexable;       /* Bitmask of all indexable tables in the clause */\n};\n\n/*\n** A WhereTerm with eOperator==WO_AND has its u.pAndInfo pointer set to\n** a dynamically allocated instance of the following structure.\n*/\nstruct WhereAndInfo {\n  WhereClause wc;          /* The subexpression broken out */\n};\n\n/*\n** An instance of the following structure keeps track of a mapping\n** between VDBE cursor numbers and bits of the bitmasks in WhereTerm.\n**\n** The VDBE cursor numbers are small integers contained in \n** SrcList_item.iCursor and Expr.iTable fields.  For any given WHERE \n** clause, the cursor numbers might not begin with 0 and they might\n** contain gaps in the numbering sequence.  But we want to make maximum\n** use of the bits in our bitmasks.  This structure provides a mapping\n** from the sparse cursor numbers into consecutive integers beginning\n** with 0.\n**\n** If WhereMaskSet.ix[A]==B it means that The A-th bit of a Bitmask\n** corresponds VDBE cursor number B.  The A-th bit of a bitmask is 1<<A.\n**\n** For example, if the WHERE clause expression used these VDBE\n** cursors:  4, 5, 8, 29, 57, 73.  Then the  WhereMaskSet structure\n** would map those cursor numbers into bits 0 through 5.\n**\n** Note that the mapping is not necessarily ordered.  In the example\n** above, the mapping might go like this:  4->3, 5->1, 8->2, 29->0,\n** 57->5, 73->4.  Or one of 719 other combinations might be used. It\n** does not really matter.  What is important is that sparse cursor\n** numbers all get mapped into bit numbers that begin with 0 and contain\n** no gaps.\n*/\nstruct WhereMaskSet {\n  int n;                        /* Number of assigned cursor values */\n  int ix[BMS];                  /* Cursor assigned to each bit */\n};\n\n/*\n** Initialize a WhereMaskSet object\n*/\n#define initMaskSet(P)  (P)->n=0\n\n/*\n** This object is a convenience wrapper holding all information needed\n** to construct WhereLoop objects for a particular query.\n*/\nstruct WhereLoopBuilder {\n  WhereInfo *pWInfo;        /* Information about this WHERE */\n  WhereClause *pWC;         /* WHERE clause terms */\n  ExprList *pOrderBy;       /* ORDER BY clause */\n  WhereLoop *pNew;          /* Template WhereLoop */\n  WhereOrSet *pOrSet;       /* Record best loops here, if not NULL */\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  UnpackedRecord *pRec;     /* Probe for stat4 (if required) */\n  int nRecValid;            /* Number of valid fields currently in pRec */\n#endif\n};\n\n/*\n** The WHERE clause processing routine has two halves.  The\n** first part does the start of the WHERE loop and the second\n** half does the tail of the WHERE loop.  An instance of\n** this structure is returned by the first half and passed\n** into the second half to give some continuity.\n**\n** An instance of this object holds the complete state of the query\n** planner.\n*/\nstruct WhereInfo {\n  Parse *pParse;            /* Parsing and code generating context */\n  SrcList *pTabList;        /* List of tables in the join */\n  ExprList *pOrderBy;       /* The ORDER BY clause or NULL */\n  ExprList *pDistinctSet;   /* DISTINCT over all these values */\n  LogEst iLimit;            /* LIMIT if wctrlFlags has WHERE_USE_LIMIT */\n  int aiCurOnePass[2];      /* OP_OpenWrite cursors for the ONEPASS opt */\n  int iContinue;            /* Jump here to continue with next record */\n  int iBreak;               /* Jump here to break out of the loop */\n  int savedNQueryLoop;      /* pParse->nQueryLoop outside the WHERE loop */\n  u16 wctrlFlags;           /* Flags originally passed to sqlite3WhereBegin() */\n  u8 nLevel;                /* Number of nested loop */\n  i8 nOBSat;                /* Number of ORDER BY terms satisfied by indices */\n  u8 sorted;                /* True if really sorted (not just grouped) */\n  u8 eOnePass;              /* ONEPASS_OFF, or _SINGLE, or _MULTI */\n  u8 untestedTerms;         /* Not all WHERE terms resolved by outer loop */\n  u8 eDistinct;             /* One of the WHERE_DISTINCT_* values */\n  u8 bOrderedInnerLoop;     /* True if only the inner-most loop is ordered */\n  int iTop;                 /* The very beginning of the WHERE loop */\n  WhereLoop *pLoops;        /* List of all WhereLoop objects */\n  Bitmask revMask;          /* Mask of ORDER BY terms that need reversing */\n  LogEst nRowOut;           /* Estimated number of output rows */\n  WhereClause sWC;          /* Decomposition of the WHERE clause */\n  WhereMaskSet sMaskSet;    /* Map cursor numbers to bitmasks */\n  WhereLevel a[1];          /* Information about each nest loop in WHERE */\n};\n\n/*\n** Private interfaces - callable only by other where.c routines.\n**\n** where.c:\n*/\nBitmask sqlite3WhereGetMask(WhereMaskSet*,int);\n#ifdef WHERETRACE_ENABLED\nvoid sqlite3WhereClausePrint(WhereClause *pWC);\n#endif\nWhereTerm *sqlite3WhereFindTerm(\n  WhereClause *pWC,     /* The WHERE clause to be searched */\n  int iCur,             /* Cursor number of LHS */\n  int iColumn,          /* Column number of LHS */\n  Bitmask notReady,     /* RHS must not overlap with this mask */\n  u32 op,               /* Mask of WO_xx values describing operator */\n  Index *pIdx           /* Must be compatible with this index, if not NULL */\n);\n\n/* wherecode.c: */\n#ifndef SQLITE_OMIT_EXPLAIN\nint sqlite3WhereExplainOneScan(\n  Parse *pParse,                  /* Parse context */\n  SrcList *pTabList,              /* Table list this loop refers to */\n  WhereLevel *pLevel,             /* Scan to write OP_Explain opcode for */\n  int iLevel,                     /* Value for \"level\" column of output */\n  int iFrom,                      /* Value for \"from\" column of output */\n  u16 wctrlFlags                  /* Flags passed to sqlite3WhereBegin() */\n);\n#else\n# define sqlite3WhereExplainOneScan(u,v,w,x,y,z) 0\n#endif /* SQLITE_OMIT_EXPLAIN */\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\nvoid sqlite3WhereAddScanStatus(\n  Vdbe *v,                        /* Vdbe to add scanstatus entry to */\n  SrcList *pSrclist,              /* FROM clause pLvl reads data from */\n  WhereLevel *pLvl,               /* Level to add scanstatus() entry for */\n  int addrExplain                 /* Address of OP_Explain (or 0) */\n);\n#else\n# define sqlite3WhereAddScanStatus(a, b, c, d) ((void)d)\n#endif\nBitmask sqlite3WhereCodeOneLoopStart(\n  WhereInfo *pWInfo,   /* Complete information about the WHERE clause */\n  int iLevel,          /* Which level of pWInfo->a[] should be coded */\n  Bitmask notReady     /* Which tables are currently available */\n);\n\n/* whereexpr.c: */\nvoid sqlite3WhereClauseInit(WhereClause*,WhereInfo*);\nvoid sqlite3WhereClauseClear(WhereClause*);\nvoid sqlite3WhereSplit(WhereClause*,Expr*,u8);\nBitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*);\nBitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*);\nvoid sqlite3WhereExprAnalyze(SrcList*, WhereClause*);\nvoid sqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereClause*);\n\n\n\n\n\n/*\n** Bitmasks for the operators on WhereTerm objects.  These are all\n** operators that are of interest to the query planner.  An\n** OR-ed combination of these values can be used when searching for\n** particular WhereTerms within a WhereClause.\n**\n** Value constraints:\n**     WO_EQ    == SQLITE_INDEX_CONSTRAINT_EQ\n**     WO_LT    == SQLITE_INDEX_CONSTRAINT_LT\n**     WO_LE    == SQLITE_INDEX_CONSTRAINT_LE\n**     WO_GT    == SQLITE_INDEX_CONSTRAINT_GT\n**     WO_GE    == SQLITE_INDEX_CONSTRAINT_GE\n**     WO_MATCH == SQLITE_INDEX_CONSTRAINT_MATCH\n*/\n#define WO_IN     0x0001\n#define WO_EQ     0x0002\n#define WO_LT     (WO_EQ<<(TK_LT-TK_EQ))\n#define WO_LE     (WO_EQ<<(TK_LE-TK_EQ))\n#define WO_GT     (WO_EQ<<(TK_GT-TK_EQ))\n#define WO_GE     (WO_EQ<<(TK_GE-TK_EQ))\n#define WO_MATCH  0x0040\n#define WO_IS     0x0080\n#define WO_ISNULL 0x0100\n#define WO_OR     0x0200       /* Two or more OR-connected terms */\n#define WO_AND    0x0400       /* Two or more AND-connected terms */\n#define WO_EQUIV  0x0800       /* Of the form A==B, both columns */\n#define WO_NOOP   0x1000       /* This term does not restrict search space */\n\n#define WO_ALL    0x1fff       /* Mask of all possible WO_* values */\n#define WO_SINGLE 0x01ff       /* Mask of all non-compound WO_* values */\n\n/*\n** These are definitions of bits in the WhereLoop.wsFlags field.\n** The particular combination of bits in each WhereLoop help to\n** determine the algorithm that WhereLoop represents.\n*/\n#define WHERE_COLUMN_EQ    0x00000001  /* x=EXPR */\n#define WHERE_COLUMN_RANGE 0x00000002  /* x<EXPR and/or x>EXPR */\n#define WHERE_COLUMN_IN    0x00000004  /* x IN (...) */\n#define WHERE_COLUMN_NULL  0x00000008  /* x IS NULL */\n#define WHERE_CONSTRAINT   0x0000000f  /* Any of the WHERE_COLUMN_xxx values */\n#define WHERE_TOP_LIMIT    0x00000010  /* x<EXPR or x<=EXPR constraint */\n#define WHERE_BTM_LIMIT    0x00000020  /* x>EXPR or x>=EXPR constraint */\n#define WHERE_BOTH_LIMIT   0x00000030  /* Both x>EXPR and x<EXPR */\n#define WHERE_IDX_ONLY     0x00000040  /* Use index only - omit table */\n#define WHERE_IPK          0x00000100  /* x is the INTEGER PRIMARY KEY */\n#define WHERE_INDEXED      0x00000200  /* WhereLoop.u.btree.pIndex is valid */\n#define WHERE_VIRTUALTABLE 0x00000400  /* WhereLoop.u.vtab is valid */\n#define WHERE_IN_ABLE      0x00000800  /* Able to support an IN operator */\n#define WHERE_ONEROW       0x00001000  /* Selects no more than one row */\n#define WHERE_MULTI_OR     0x00002000  /* OR using multiple indices */\n#define WHERE_AUTO_INDEX   0x00004000  /* Uses an ephemeral index */\n#define WHERE_SKIPSCAN     0x00008000  /* Uses the skip-scan algorithm */\n#define WHERE_UNQ_WANTED   0x00010000  /* WHERE_ONEROW would have been helpful*/\n#define WHERE_PARTIALIDX   0x00020000  /* The automatic index is partial */\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/wherecode.c",
    "content": "/*\n** 2015-06-06\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This module contains C code that generates VDBE code used to process\n** the WHERE clause of SQL statements.\n**\n** This file was split off from where.c on 2015-06-06 in order to reduce the\n** size of where.c and make it easier to edit.  This file contains the routines\n** that actually generate the bulk of the WHERE loop code.  The original where.c\n** file retains the code that does query planning and analysis.\n*/\n#include \"sqliteInt.h\"\n#include \"whereInt.h\"\n\n#ifndef SQLITE_OMIT_EXPLAIN\n\n/*\n** Return the name of the i-th column of the pIdx index.\n*/\nstatic const char *explainIndexColumnName(Index *pIdx, int i){\n  i = pIdx->aiColumn[i];\n  if( i==XN_EXPR ) return \"<expr>\";\n  if( i==XN_ROWID ) return \"rowid\";\n  return pIdx->pTable->aCol[i].zName;\n}\n\n/*\n** This routine is a helper for explainIndexRange() below\n**\n** pStr holds the text of an expression that we are building up one term\n** at a time.  This routine adds a new term to the end of the expression.\n** Terms are separated by AND so add the \"AND\" text for second and subsequent\n** terms only.\n*/\nstatic void explainAppendTerm(\n  StrAccum *pStr,             /* The text expression being built */\n  Index *pIdx,                /* Index to read column names from */\n  int nTerm,                  /* Number of terms */\n  int iTerm,                  /* Zero-based index of first term. */\n  int bAnd,                   /* Non-zero to append \" AND \" */\n  const char *zOp             /* Name of the operator */\n){\n  int i;\n\n  assert( nTerm>=1 );\n  if( bAnd ) sqlite3StrAccumAppend(pStr, \" AND \", 5);\n\n  if( nTerm>1 ) sqlite3StrAccumAppend(pStr, \"(\", 1);\n  for(i=0; i<nTerm; i++){\n    if( i ) sqlite3StrAccumAppend(pStr, \",\", 1);\n    sqlite3StrAccumAppendAll(pStr, explainIndexColumnName(pIdx, iTerm+i));\n  }\n  if( nTerm>1 ) sqlite3StrAccumAppend(pStr, \")\", 1);\n\n  sqlite3StrAccumAppend(pStr, zOp, 1);\n\n  if( nTerm>1 ) sqlite3StrAccumAppend(pStr, \"(\", 1);\n  for(i=0; i<nTerm; i++){\n    if( i ) sqlite3StrAccumAppend(pStr, \",\", 1);\n    sqlite3StrAccumAppend(pStr, \"?\", 1);\n  }\n  if( nTerm>1 ) sqlite3StrAccumAppend(pStr, \")\", 1);\n}\n\n/*\n** Argument pLevel describes a strategy for scanning table pTab. This \n** function appends text to pStr that describes the subset of table\n** rows scanned by the strategy in the form of an SQL expression.\n**\n** For example, if the query:\n**\n**   SELECT * FROM t1 WHERE a=1 AND b>2;\n**\n** is run and there is an index on (a, b), then this function returns a\n** string similar to:\n**\n**   \"a=? AND b>?\"\n*/\nstatic void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){\n  Index *pIndex = pLoop->u.btree.pIndex;\n  u16 nEq = pLoop->u.btree.nEq;\n  u16 nSkip = pLoop->nSkip;\n  int i, j;\n\n  if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;\n  sqlite3StrAccumAppend(pStr, \" (\", 2);\n  for(i=0; i<nEq; i++){\n    const char *z = explainIndexColumnName(pIndex, i);\n    if( i ) sqlite3StrAccumAppend(pStr, \" AND \", 5);\n    sqlite3XPrintf(pStr, i>=nSkip ? \"%s=?\" : \"ANY(%s)\", z);\n  }\n\n  j = i;\n  if( pLoop->wsFlags&WHERE_BTM_LIMIT ){\n    explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, \">\");\n    i = 1;\n  }\n  if( pLoop->wsFlags&WHERE_TOP_LIMIT ){\n    explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, \"<\");\n  }\n  sqlite3StrAccumAppend(pStr, \")\", 1);\n}\n\n/*\n** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN\n** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was\n** defined at compile-time. If it is not a no-op, a single OP_Explain opcode \n** is added to the output to describe the table scan strategy in pLevel.\n**\n** If an OP_Explain opcode is added to the VM, its address is returned.\n** Otherwise, if no OP_Explain is coded, zero is returned.\n*/\nint sqlite3WhereExplainOneScan(\n  Parse *pParse,                  /* Parse context */\n  SrcList *pTabList,              /* Table list this loop refers to */\n  WhereLevel *pLevel,             /* Scan to write OP_Explain opcode for */\n  int iLevel,                     /* Value for \"level\" column of output */\n  int iFrom,                      /* Value for \"from\" column of output */\n  u16 wctrlFlags                  /* Flags passed to sqlite3WhereBegin() */\n){\n  int ret = 0;\n#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)\n  if( pParse->explain==2 )\n#endif\n  {\n    struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];\n    Vdbe *v = pParse->pVdbe;      /* VM being constructed */\n    sqlite3 *db = pParse->db;     /* Database handle */\n    int iId = pParse->iSelectId;  /* Select id (left-most output column) */\n    int isSearch;                 /* True for a SEARCH. False for SCAN. */\n    WhereLoop *pLoop;             /* The controlling WhereLoop object */\n    u32 flags;                    /* Flags that describe this loop */\n    char *zMsg;                   /* Text to add to EQP output */\n    StrAccum str;                 /* EQP output string */\n    char zBuf[100];               /* Initial space for EQP output string */\n\n    pLoop = pLevel->pWLoop;\n    flags = pLoop->wsFlags;\n    if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_OR_SUBCLAUSE) ) return 0;\n\n    isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0\n            || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))\n            || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));\n\n    sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH);\n    sqlite3StrAccumAppendAll(&str, isSearch ? \"SEARCH\" : \"SCAN\");\n    if( pItem->pSelect ){\n      sqlite3XPrintf(&str, \" SUBQUERY %d\", pItem->iSelectId);\n    }else{\n      sqlite3XPrintf(&str, \" TABLE %s\", pItem->zName);\n    }\n\n    if( pItem->zAlias ){\n      sqlite3XPrintf(&str, \" AS %s\", pItem->zAlias);\n    }\n    if( (flags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0 ){\n      const char *zFmt = 0;\n      Index *pIdx;\n\n      assert( pLoop->u.btree.pIndex!=0 );\n      pIdx = pLoop->u.btree.pIndex;\n      assert( !(flags&WHERE_AUTO_INDEX) || (flags&WHERE_IDX_ONLY) );\n      if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){\n        if( isSearch ){\n          zFmt = \"PRIMARY KEY\";\n        }\n      }else if( flags & WHERE_PARTIALIDX ){\n        zFmt = \"AUTOMATIC PARTIAL COVERING INDEX\";\n      }else if( flags & WHERE_AUTO_INDEX ){\n        zFmt = \"AUTOMATIC COVERING INDEX\";\n      }else if( flags & WHERE_IDX_ONLY ){\n        zFmt = \"COVERING INDEX %s\";\n      }else{\n        zFmt = \"INDEX %s\";\n      }\n      if( zFmt ){\n        sqlite3StrAccumAppend(&str, \" USING \", 7);\n        sqlite3XPrintf(&str, zFmt, pIdx->zName);\n        explainIndexRange(&str, pLoop);\n      }\n    }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){\n      const char *zRangeOp;\n      if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){\n        zRangeOp = \"=\";\n      }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){\n        zRangeOp = \">? AND rowid<\";\n      }else if( flags&WHERE_BTM_LIMIT ){\n        zRangeOp = \">\";\n      }else{\n        assert( flags&WHERE_TOP_LIMIT);\n        zRangeOp = \"<\";\n      }\n      sqlite3XPrintf(&str, \" USING INTEGER PRIMARY KEY (rowid%s?)\",zRangeOp);\n    }\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n    else if( (flags & WHERE_VIRTUALTABLE)!=0 ){\n      sqlite3XPrintf(&str, \" VIRTUAL TABLE INDEX %d:%s\",\n                  pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr);\n    }\n#endif\n#ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS\n    if( pLoop->nOut>=10 ){\n      sqlite3XPrintf(&str, \" (~%llu rows)\", sqlite3LogEstToInt(pLoop->nOut));\n    }else{\n      sqlite3StrAccumAppend(&str, \" (~1 row)\", 9);\n    }\n#endif\n    zMsg = sqlite3StrAccumFinish(&str);\n    ret = sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg,P4_DYNAMIC);\n  }\n  return ret;\n}\n#endif /* SQLITE_OMIT_EXPLAIN */\n\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n/*\n** Configure the VM passed as the first argument with an\n** sqlite3_stmt_scanstatus() entry corresponding to the scan used to \n** implement level pLvl. Argument pSrclist is a pointer to the FROM \n** clause that the scan reads data from.\n**\n** If argument addrExplain is not 0, it must be the address of an \n** OP_Explain instruction that describes the same loop.\n*/\nvoid sqlite3WhereAddScanStatus(\n  Vdbe *v,                        /* Vdbe to add scanstatus entry to */\n  SrcList *pSrclist,              /* FROM clause pLvl reads data from */\n  WhereLevel *pLvl,               /* Level to add scanstatus() entry for */\n  int addrExplain                 /* Address of OP_Explain (or 0) */\n){\n  const char *zObj = 0;\n  WhereLoop *pLoop = pLvl->pWLoop;\n  if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0  &&  pLoop->u.btree.pIndex!=0 ){\n    zObj = pLoop->u.btree.pIndex->zName;\n  }else{\n    zObj = pSrclist->a[pLvl->iFrom].zName;\n  }\n  sqlite3VdbeScanStatus(\n      v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj\n  );\n}\n#endif\n\n\n/*\n** Disable a term in the WHERE clause.  Except, do not disable the term\n** if it controls a LEFT OUTER JOIN and it did not originate in the ON\n** or USING clause of that join.\n**\n** Consider the term t2.z='ok' in the following queries:\n**\n**   (1)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok'\n**   (2)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'\n**   (3)  SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'\n**\n** The t2.z='ok' is disabled in the in (2) because it originates\n** in the ON clause.  The term is disabled in (3) because it is not part\n** of a LEFT OUTER JOIN.  In (1), the term is not disabled.\n**\n** Disabling a term causes that term to not be tested in the inner loop\n** of the join.  Disabling is an optimization.  When terms are satisfied\n** by indices, we disable them to prevent redundant tests in the inner\n** loop.  We would get the correct results if nothing were ever disabled,\n** but joins might run a little slower.  The trick is to disable as much\n** as we can without disabling too much.  If we disabled in (1), we'd get\n** the wrong answer.  See ticket #813.\n**\n** If all the children of a term are disabled, then that term is also\n** automatically disabled.  In this way, terms get disabled if derived\n** virtual terms are tested first.  For example:\n**\n**      x GLOB 'abc*' AND x>='abc' AND x<'acd'\n**      \\___________/     \\______/     \\_____/\n**         parent          child1       child2\n**\n** Only the parent term was in the original WHERE clause.  The child1\n** and child2 terms were added by the LIKE optimization.  If both of\n** the virtual child terms are valid, then testing of the parent can be \n** skipped.\n**\n** Usually the parent term is marked as TERM_CODED.  But if the parent\n** term was originally TERM_LIKE, then the parent gets TERM_LIKECOND instead.\n** The TERM_LIKECOND marking indicates that the term should be coded inside\n** a conditional such that is only evaluated on the second pass of a\n** LIKE-optimization loop, when scanning BLOBs instead of strings.\n*/\nstatic void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){\n  int nLoop = 0;\n  while( ALWAYS(pTerm!=0)\n      && (pTerm->wtFlags & TERM_CODED)==0\n      && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))\n      && (pLevel->notReady & pTerm->prereqAll)==0\n  ){\n    if( nLoop && (pTerm->wtFlags & TERM_LIKE)!=0 ){\n      pTerm->wtFlags |= TERM_LIKECOND;\n    }else{\n      pTerm->wtFlags |= TERM_CODED;\n    }\n    if( pTerm->iParent<0 ) break;\n    pTerm = &pTerm->pWC->a[pTerm->iParent];\n    pTerm->nChild--;\n    if( pTerm->nChild!=0 ) break;\n    nLoop++;\n  }\n}\n\n/*\n** Code an OP_Affinity opcode to apply the column affinity string zAff\n** to the n registers starting at base. \n**\n** As an optimization, SQLITE_AFF_BLOB entries (which are no-ops) at the\n** beginning and end of zAff are ignored.  If all entries in zAff are\n** SQLITE_AFF_BLOB, then no code gets generated.\n**\n** This routine makes its own copy of zAff so that the caller is free\n** to modify zAff after this routine returns.\n*/\nstatic void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){\n  Vdbe *v = pParse->pVdbe;\n  if( zAff==0 ){\n    assert( pParse->db->mallocFailed );\n    return;\n  }\n  assert( v!=0 );\n\n  /* Adjust base and n to skip over SQLITE_AFF_BLOB entries at the beginning\n  ** and end of the affinity string.\n  */\n  while( n>0 && zAff[0]==SQLITE_AFF_BLOB ){\n    n--;\n    base++;\n    zAff++;\n  }\n  while( n>1 && zAff[n-1]==SQLITE_AFF_BLOB ){\n    n--;\n  }\n\n  /* Code the OP_Affinity opcode if there is anything left to do. */\n  if( n>0 ){\n    sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n);\n    sqlite3ExprCacheAffinityChange(pParse, base, n);\n  }\n}\n\n/*\n** Expression pRight, which is the RHS of a comparison operation, is \n** either a vector of n elements or, if n==1, a scalar expression.\n** Before the comparison operation, affinity zAff is to be applied\n** to the pRight values. This function modifies characters within the\n** affinity string to SQLITE_AFF_BLOB if either:\n**\n**   * the comparison will be performed with no affinity, or\n**   * the affinity change in zAff is guaranteed not to change the value.\n*/\nstatic void updateRangeAffinityStr(\n  Expr *pRight,                   /* RHS of comparison */\n  int n,                          /* Number of vector elements in comparison */\n  char *zAff                      /* Affinity string to modify */\n){\n  int i;\n  for(i=0; i<n; i++){\n    Expr *p = sqlite3VectorFieldSubexpr(pRight, i);\n    if( sqlite3CompareAffinity(p, zAff[i])==SQLITE_AFF_BLOB\n     || sqlite3ExprNeedsNoAffinityChange(p, zAff[i])\n    ){\n      zAff[i] = SQLITE_AFF_BLOB;\n    }\n  }\n}\n\n/*\n** Generate code for a single equality term of the WHERE clause.  An equality\n** term can be either X=expr or X IN (...).   pTerm is the term to be \n** coded.\n**\n** The current value for the constraint is left in a register, the index\n** of which is returned.  An attempt is made store the result in iTarget but\n** this is only guaranteed for TK_ISNULL and TK_IN constraints.  If the\n** constraint is a TK_EQ or TK_IS, then the current value might be left in\n** some other register and it is the caller's responsibility to compensate.\n**\n** For a constraint of the form X=expr, the expression is evaluated in\n** straight-line code.  For constraints of the form X IN (...)\n** this routine sets up a loop that will iterate over all values of X.\n*/\nstatic int codeEqualityTerm(\n  Parse *pParse,      /* The parsing context */\n  WhereTerm *pTerm,   /* The term of the WHERE clause to be coded */\n  WhereLevel *pLevel, /* The level of the FROM clause we are working on */\n  int iEq,            /* Index of the equality term within this level */\n  int bRev,           /* True for reverse-order IN operations */\n  int iTarget         /* Attempt to leave results in this register */\n){\n  Expr *pX = pTerm->pExpr;\n  Vdbe *v = pParse->pVdbe;\n  int iReg;                  /* Register holding results */\n\n  assert( pLevel->pWLoop->aLTerm[iEq]==pTerm );\n  assert( iTarget>0 );\n  if( pX->op==TK_EQ || pX->op==TK_IS ){\n    iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);\n  }else if( pX->op==TK_ISNULL ){\n    iReg = iTarget;\n    sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);\n#ifndef SQLITE_OMIT_SUBQUERY\n  }else{\n    int eType = IN_INDEX_NOOP;\n    int iTab;\n    struct InLoop *pIn;\n    WhereLoop *pLoop = pLevel->pWLoop;\n    int i;\n    int nEq = 0;\n    int *aiMap = 0;\n\n    if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0\n      && pLoop->u.btree.pIndex!=0\n      && pLoop->u.btree.pIndex->aSortOrder[iEq]\n    ){\n      testcase( iEq==0 );\n      testcase( bRev );\n      bRev = !bRev;\n    }\n    assert( pX->op==TK_IN );\n    iReg = iTarget;\n\n    for(i=0; i<iEq; i++){\n      if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){\n        disableTerm(pLevel, pTerm);\n        return iTarget;\n      }\n    }\n    for(i=iEq;i<pLoop->nLTerm; i++){\n      if( ALWAYS(pLoop->aLTerm[i]) && pLoop->aLTerm[i]->pExpr==pX ) nEq++;\n    }\n\n    if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){\n      eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0);\n    }else{\n      Select *pSelect = pX->x.pSelect;\n      sqlite3 *db = pParse->db;\n      u16 savedDbOptFlags = db->dbOptFlags;\n      ExprList *pOrigRhs = pSelect->pEList;\n      ExprList *pOrigLhs = pX->pLeft->x.pList;\n      ExprList *pRhs = 0;         /* New Select.pEList for RHS */\n      ExprList *pLhs = 0;         /* New pX->pLeft vector */\n\n      for(i=iEq;i<pLoop->nLTerm; i++){\n        if( pLoop->aLTerm[i]->pExpr==pX ){\n          int iField = pLoop->aLTerm[i]->iField - 1;\n          Expr *pNewRhs = sqlite3ExprDup(db, pOrigRhs->a[iField].pExpr, 0);\n          Expr *pNewLhs = sqlite3ExprDup(db, pOrigLhs->a[iField].pExpr, 0);\n\n          pRhs = sqlite3ExprListAppend(pParse, pRhs, pNewRhs);\n          pLhs = sqlite3ExprListAppend(pParse, pLhs, pNewLhs);\n        }\n      }\n      if( !db->mallocFailed ){\n        Expr *pLeft = pX->pLeft;\n\n        if( pSelect->pOrderBy ){\n          /* If the SELECT statement has an ORDER BY clause, zero the \n          ** iOrderByCol variables. These are set to non-zero when an \n          ** ORDER BY term exactly matches one of the terms of the \n          ** result-set. Since the result-set of the SELECT statement may\n          ** have been modified or reordered, these variables are no longer \n          ** set correctly.  Since setting them is just an optimization, \n          ** it's easiest just to zero them here.  */\n          ExprList *pOrderBy = pSelect->pOrderBy;\n          for(i=0; i<pOrderBy->nExpr; i++){\n            pOrderBy->a[i].u.x.iOrderByCol = 0;\n          }\n        }\n\n        /* Take care here not to generate a TK_VECTOR containing only a\n        ** single value. Since the parser never creates such a vector, some\n        ** of the subroutines do not handle this case.  */\n        if( pLhs->nExpr==1 ){\n          pX->pLeft = pLhs->a[0].pExpr;\n        }else{\n          pLeft->x.pList = pLhs;\n          aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int) * nEq);\n          testcase( aiMap==0 );\n        }\n        pSelect->pEList = pRhs;\n        db->dbOptFlags |= SQLITE_QueryFlattener;\n        eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap);\n        db->dbOptFlags = savedDbOptFlags;\n        testcase( aiMap!=0 && aiMap[0]!=0 );\n        pSelect->pEList = pOrigRhs;\n        pLeft->x.pList = pOrigLhs;\n        pX->pLeft = pLeft;\n      }\n      sqlite3ExprListDelete(pParse->db, pLhs);\n      sqlite3ExprListDelete(pParse->db, pRhs);\n    }\n\n    if( eType==IN_INDEX_INDEX_DESC ){\n      testcase( bRev );\n      bRev = !bRev;\n    }\n    iTab = pX->iTable;\n    sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);\n    VdbeCoverageIf(v, bRev);\n    VdbeCoverageIf(v, !bRev);\n    assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );\n\n    pLoop->wsFlags |= WHERE_IN_ABLE;\n    if( pLevel->u.in.nIn==0 ){\n      pLevel->addrNxt = sqlite3VdbeMakeLabel(v);\n    }\n\n    i = pLevel->u.in.nIn;\n    pLevel->u.in.nIn += nEq;\n    pLevel->u.in.aInLoop =\n       sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,\n                              sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);\n    pIn = pLevel->u.in.aInLoop;\n    if( pIn ){\n      int iMap = 0;               /* Index in aiMap[] */\n      pIn += i;\n      for(i=iEq;i<pLoop->nLTerm; i++){\n        if( pLoop->aLTerm[i]->pExpr==pX ){\n          int iOut = iReg + i - iEq;\n          if( eType==IN_INDEX_ROWID ){\n            testcase( nEq>1 );  /* Happens with a UNIQUE index on ROWID */\n            pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iOut);\n          }else{\n            int iCol = aiMap ? aiMap[iMap++] : 0;\n            pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut);\n          }\n          sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v);\n          if( i==iEq ){\n            pIn->iCur = iTab;\n            pIn->eEndLoopOp = bRev ? OP_PrevIfOpen : OP_NextIfOpen;\n          }else{\n            pIn->eEndLoopOp = OP_Noop;\n          }\n          pIn++;\n        }\n      }\n    }else{\n      pLevel->u.in.nIn = 0;\n    }\n    sqlite3DbFree(pParse->db, aiMap);\n#endif\n  }\n  disableTerm(pLevel, pTerm);\n  return iReg;\n}\n\n/*\n** Generate code that will evaluate all == and IN constraints for an\n** index scan.\n**\n** For example, consider table t1(a,b,c,d,e,f) with index i1(a,b,c).\n** Suppose the WHERE clause is this:  a==5 AND b IN (1,2,3) AND c>5 AND c<10\n** The index has as many as three equality constraints, but in this\n** example, the third \"c\" value is an inequality.  So only two \n** constraints are coded.  This routine will generate code to evaluate\n** a==5 and b IN (1,2,3).  The current values for a and b will be stored\n** in consecutive registers and the index of the first register is returned.\n**\n** In the example above nEq==2.  But this subroutine works for any value\n** of nEq including 0.  If nEq==0, this routine is nearly a no-op.\n** The only thing it does is allocate the pLevel->iMem memory cell and\n** compute the affinity string.\n**\n** The nExtraReg parameter is 0 or 1.  It is 0 if all WHERE clause constraints\n** are == or IN and are covered by the nEq.  nExtraReg is 1 if there is\n** an inequality constraint (such as the \"c>=5 AND c<10\" in the example) that\n** occurs after the nEq quality constraints.\n**\n** This routine allocates a range of nEq+nExtraReg memory cells and returns\n** the index of the first memory cell in that range. The code that\n** calls this routine will use that memory range to store keys for\n** start and termination conditions of the loop.\n** key value of the loop.  If one or more IN operators appear, then\n** this routine allocates an additional nEq memory cells for internal\n** use.\n**\n** Before returning, *pzAff is set to point to a buffer containing a\n** copy of the column affinity string of the index allocated using\n** sqlite3DbMalloc(). Except, entries in the copy of the string associated\n** with equality constraints that use BLOB or NONE affinity are set to\n** SQLITE_AFF_BLOB. This is to deal with SQL such as the following:\n**\n**   CREATE TABLE t1(a TEXT PRIMARY KEY, b);\n**   SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b;\n**\n** In the example above, the index on t1(a) has TEXT affinity. But since\n** the right hand side of the equality constraint (t2.b) has BLOB/NONE affinity,\n** no conversion should be attempted before using a t2.b value as part of\n** a key to search the index. Hence the first byte in the returned affinity\n** string in this example would be set to SQLITE_AFF_BLOB.\n*/\nstatic int codeAllEqualityTerms(\n  Parse *pParse,        /* Parsing context */\n  WhereLevel *pLevel,   /* Which nested loop of the FROM we are coding */\n  int bRev,             /* Reverse the order of IN operators */\n  int nExtraReg,        /* Number of extra registers to allocate */\n  char **pzAff          /* OUT: Set to point to affinity string */\n){\n  u16 nEq;                      /* The number of == or IN constraints to code */\n  u16 nSkip;                    /* Number of left-most columns to skip */\n  Vdbe *v = pParse->pVdbe;      /* The vm under construction */\n  Index *pIdx;                  /* The index being used for this loop */\n  WhereTerm *pTerm;             /* A single constraint term */\n  WhereLoop *pLoop;             /* The WhereLoop object */\n  int j;                        /* Loop counter */\n  int regBase;                  /* Base register */\n  int nReg;                     /* Number of registers to allocate */\n  char *zAff;                   /* Affinity string to return */\n\n  /* This module is only called on query plans that use an index. */\n  pLoop = pLevel->pWLoop;\n  assert( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 );\n  nEq = pLoop->u.btree.nEq;\n  nSkip = pLoop->nSkip;\n  pIdx = pLoop->u.btree.pIndex;\n  assert( pIdx!=0 );\n\n  /* Figure out how many memory cells we will need then allocate them.\n  */\n  regBase = pParse->nMem + 1;\n  nReg = pLoop->u.btree.nEq + nExtraReg;\n  pParse->nMem += nReg;\n\n  zAff = sqlite3DbStrDup(pParse->db,sqlite3IndexAffinityStr(pParse->db,pIdx));\n  assert( zAff!=0 || pParse->db->mallocFailed );\n\n  if( nSkip ){\n    int iIdxCur = pLevel->iIdxCur;\n    sqlite3VdbeAddOp1(v, (bRev?OP_Last:OP_Rewind), iIdxCur);\n    VdbeCoverageIf(v, bRev==0);\n    VdbeCoverageIf(v, bRev!=0);\n    VdbeComment((v, \"begin skip-scan on %s\", pIdx->zName));\n    j = sqlite3VdbeAddOp0(v, OP_Goto);\n    pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT),\n                            iIdxCur, 0, regBase, nSkip);\n    VdbeCoverageIf(v, bRev==0);\n    VdbeCoverageIf(v, bRev!=0);\n    sqlite3VdbeJumpHere(v, j);\n    for(j=0; j<nSkip; j++){\n      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, j, regBase+j);\n      testcase( pIdx->aiColumn[j]==XN_EXPR );\n      VdbeComment((v, \"%s\", explainIndexColumnName(pIdx, j)));\n    }\n  }    \n\n  /* Evaluate the equality constraints\n  */\n  assert( zAff==0 || (int)strlen(zAff)>=nEq );\n  for(j=nSkip; j<nEq; j++){\n    int r1;\n    pTerm = pLoop->aLTerm[j];\n    assert( pTerm!=0 );\n    /* The following testcase is true for indices with redundant columns. \n    ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */\n    testcase( (pTerm->wtFlags & TERM_CODED)!=0 );\n    testcase( pTerm->wtFlags & TERM_VIRTUAL );\n    r1 = codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, regBase+j);\n    if( r1!=regBase+j ){\n      if( nReg==1 ){\n        sqlite3ReleaseTempReg(pParse, regBase);\n        regBase = r1;\n      }else{\n        sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j);\n      }\n    }\n    if( pTerm->eOperator & WO_IN ){\n      if( pTerm->pExpr->flags & EP_xIsSelect ){\n        /* No affinity ever needs to be (or should be) applied to a value\n        ** from the RHS of an \"? IN (SELECT ...)\" expression. The \n        ** sqlite3FindInIndex() routine has already ensured that the \n        ** affinity of the comparison has been applied to the value.  */\n        if( zAff ) zAff[j] = SQLITE_AFF_BLOB;\n      }\n    }else if( (pTerm->eOperator & WO_ISNULL)==0 ){\n      Expr *pRight = pTerm->pExpr->pRight;\n      if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){\n        sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);\n        VdbeCoverage(v);\n      }\n      if( zAff ){\n        if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){\n          zAff[j] = SQLITE_AFF_BLOB;\n        }\n        if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){\n          zAff[j] = SQLITE_AFF_BLOB;\n        }\n      }\n    }\n  }\n  *pzAff = zAff;\n  return regBase;\n}\n\n#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n/*\n** If the most recently coded instruction is a constant range constraint\n** (a string literal) that originated from the LIKE optimization, then \n** set P3 and P5 on the OP_String opcode so that the string will be cast\n** to a BLOB at appropriate times.\n**\n** The LIKE optimization trys to evaluate \"x LIKE 'abc%'\" as a range\n** expression: \"x>='ABC' AND x<'abd'\".  But this requires that the range\n** scan loop run twice, once for strings and a second time for BLOBs.\n** The OP_String opcodes on the second pass convert the upper and lower\n** bound string constants to blobs.  This routine makes the necessary changes\n** to the OP_String opcodes for that to happen.\n**\n** Except, of course, if SQLITE_LIKE_DOESNT_MATCH_BLOBS is defined, then\n** only the one pass through the string space is required, so this routine\n** becomes a no-op.\n*/\nstatic void whereLikeOptimizationStringFixup(\n  Vdbe *v,                /* prepared statement under construction */\n  WhereLevel *pLevel,     /* The loop that contains the LIKE operator */\n  WhereTerm *pTerm        /* The upper or lower bound just coded */\n){\n  if( pTerm->wtFlags & TERM_LIKEOPT ){\n    VdbeOp *pOp;\n    assert( pLevel->iLikeRepCntr>0 );\n    pOp = sqlite3VdbeGetOp(v, -1);\n    assert( pOp!=0 );\n    assert( pOp->opcode==OP_String8 \n            || pTerm->pWC->pWInfo->pParse->db->mallocFailed );\n    pOp->p3 = (int)(pLevel->iLikeRepCntr>>1);  /* Register holding counter */\n    pOp->p5 = (u8)(pLevel->iLikeRepCntr&1);    /* ASC or DESC */\n  }\n}\n#else\n# define whereLikeOptimizationStringFixup(A,B,C)\n#endif\n\n#ifdef SQLITE_ENABLE_CURSOR_HINTS\n/*\n** Information is passed from codeCursorHint() down to individual nodes of\n** the expression tree (by sqlite3WalkExpr()) using an instance of this\n** structure.\n*/\nstruct CCurHint {\n  int iTabCur;    /* Cursor for the main table */\n  int iIdxCur;    /* Cursor for the index, if pIdx!=0.  Unused otherwise */\n  Index *pIdx;    /* The index used to access the table */\n};\n\n/*\n** This function is called for every node of an expression that is a candidate\n** for a cursor hint on an index cursor.  For TK_COLUMN nodes that reference\n** the table CCurHint.iTabCur, verify that the same column can be\n** accessed through the index.  If it cannot, then set pWalker->eCode to 1.\n*/\nstatic int codeCursorHintCheckExpr(Walker *pWalker, Expr *pExpr){\n  struct CCurHint *pHint = pWalker->u.pCCurHint;\n  assert( pHint->pIdx!=0 );\n  if( pExpr->op==TK_COLUMN\n   && pExpr->iTable==pHint->iTabCur\n   && sqlite3ColumnOfIndex(pHint->pIdx, pExpr->iColumn)<0\n  ){\n    pWalker->eCode = 1;\n  }\n  return WRC_Continue;\n}\n\n/*\n** Test whether or not expression pExpr, which was part of a WHERE clause,\n** should be included in the cursor-hint for a table that is on the rhs\n** of a LEFT JOIN. Set Walker.eCode to non-zero before returning if the \n** expression is not suitable.\n**\n** An expression is unsuitable if it might evaluate to non NULL even if\n** a TK_COLUMN node that does affect the value of the expression is set\n** to NULL. For example:\n**\n**   col IS NULL\n**   col IS NOT NULL\n**   coalesce(col, 1)\n**   CASE WHEN col THEN 0 ELSE 1 END\n*/\nstatic int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){\n  if( pExpr->op==TK_IS \n   || pExpr->op==TK_ISNULL || pExpr->op==TK_ISNOT \n   || pExpr->op==TK_NOTNULL || pExpr->op==TK_CASE \n  ){\n    pWalker->eCode = 1;\n  }else if( pExpr->op==TK_FUNCTION ){\n    int d1;\n    char d2[3];\n    if( 0==sqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){\n      pWalker->eCode = 1;\n    }\n  }\n\n  return WRC_Continue;\n}\n\n\n/*\n** This function is called on every node of an expression tree used as an\n** argument to the OP_CursorHint instruction. If the node is a TK_COLUMN\n** that accesses any table other than the one identified by\n** CCurHint.iTabCur, then do the following:\n**\n**   1) allocate a register and code an OP_Column instruction to read \n**      the specified column into the new register, and\n**\n**   2) transform the expression node to a TK_REGISTER node that reads \n**      from the newly populated register.\n**\n** Also, if the node is a TK_COLUMN that does access the table idenified\n** by pCCurHint.iTabCur, and an index is being used (which we will\n** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into\n** an access of the index rather than the original table.\n*/\nstatic int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){\n  int rc = WRC_Continue;\n  struct CCurHint *pHint = pWalker->u.pCCurHint;\n  if( pExpr->op==TK_COLUMN ){\n    if( pExpr->iTable!=pHint->iTabCur ){\n      Vdbe *v = pWalker->pParse->pVdbe;\n      int reg = ++pWalker->pParse->nMem;   /* Register for column value */\n      sqlite3ExprCodeGetColumnOfTable(\n          v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg\n      );\n      pExpr->op = TK_REGISTER;\n      pExpr->iTable = reg;\n    }else if( pHint->pIdx!=0 ){\n      pExpr->iTable = pHint->iIdxCur;\n      pExpr->iColumn = sqlite3ColumnOfIndex(pHint->pIdx, pExpr->iColumn);\n      assert( pExpr->iColumn>=0 );\n    }\n  }else if( pExpr->op==TK_AGG_FUNCTION ){\n    /* An aggregate function in the WHERE clause of a query means this must\n    ** be a correlated sub-query, and expression pExpr is an aggregate from\n    ** the parent context. Do not walk the function arguments in this case.\n    **\n    ** todo: It should be possible to replace this node with a TK_REGISTER\n    ** expression, as the result of the expression must be stored in a \n    ** register at this point. The same holds for TK_AGG_COLUMN nodes. */\n    rc = WRC_Prune;\n  }\n  return rc;\n}\n\n/*\n** Insert an OP_CursorHint instruction if it is appropriate to do so.\n*/\nstatic void codeCursorHint(\n  struct SrcList_item *pTabItem,  /* FROM clause item */\n  WhereInfo *pWInfo,    /* The where clause */\n  WhereLevel *pLevel,   /* Which loop to provide hints for */\n  WhereTerm *pEndRange  /* Hint this end-of-scan boundary term if not NULL */\n){\n  Parse *pParse = pWInfo->pParse;\n  sqlite3 *db = pParse->db;\n  Vdbe *v = pParse->pVdbe;\n  Expr *pExpr = 0;\n  WhereLoop *pLoop = pLevel->pWLoop;\n  int iCur;\n  WhereClause *pWC;\n  WhereTerm *pTerm;\n  int i, j;\n  struct CCurHint sHint;\n  Walker sWalker;\n\n  if( OptimizationDisabled(db, SQLITE_CursorHints) ) return;\n  iCur = pLevel->iTabCur;\n  assert( iCur==pWInfo->pTabList->a[pLevel->iFrom].iCursor );\n  sHint.iTabCur = iCur;\n  sHint.iIdxCur = pLevel->iIdxCur;\n  sHint.pIdx = pLoop->u.btree.pIndex;\n  memset(&sWalker, 0, sizeof(sWalker));\n  sWalker.pParse = pParse;\n  sWalker.u.pCCurHint = &sHint;\n  pWC = &pWInfo->sWC;\n  for(i=0; i<pWC->nTerm; i++){\n    pTerm = &pWC->a[i];\n    if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;\n    if( pTerm->prereqAll & pLevel->notReady ) continue;\n\n    /* Any terms specified as part of the ON(...) clause for any LEFT \n    ** JOIN for which the current table is not the rhs are omitted\n    ** from the cursor-hint. \n    **\n    ** If this table is the rhs of a LEFT JOIN, \"IS\" or \"IS NULL\" terms \n    ** that were specified as part of the WHERE clause must be excluded.\n    ** This is to address the following:\n    **\n    **   SELECT ... t1 LEFT JOIN t2 ON (t1.a=t2.b) WHERE t2.c IS NULL;\n    **\n    ** Say there is a single row in t2 that matches (t1.a=t2.b), but its\n    ** t2.c values is not NULL. If the (t2.c IS NULL) constraint is \n    ** pushed down to the cursor, this row is filtered out, causing\n    ** SQLite to synthesize a row of NULL values. Which does match the\n    ** WHERE clause, and so the query returns a row. Which is incorrect.\n    **\n    ** For the same reason, WHERE terms such as:\n    **\n    **   WHERE 1 = (t2.c IS NULL)\n    **\n    ** are also excluded. See codeCursorHintIsOrFunction() for details.\n    */\n    if( pTabItem->fg.jointype & JT_LEFT ){\n      Expr *pExpr = pTerm->pExpr;\n      if( !ExprHasProperty(pExpr, EP_FromJoin) \n       || pExpr->iRightJoinTable!=pTabItem->iCursor\n      ){\n        sWalker.eCode = 0;\n        sWalker.xExprCallback = codeCursorHintIsOrFunction;\n        sqlite3WalkExpr(&sWalker, pTerm->pExpr);\n        if( sWalker.eCode ) continue;\n      }\n    }else{\n      if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue;\n    }\n\n    /* All terms in pWLoop->aLTerm[] except pEndRange are used to initialize\n    ** the cursor.  These terms are not needed as hints for a pure range\n    ** scan (that has no == terms) so omit them. */\n    if( pLoop->u.btree.nEq==0 && pTerm!=pEndRange ){\n      for(j=0; j<pLoop->nLTerm && pLoop->aLTerm[j]!=pTerm; j++){}\n      if( j<pLoop->nLTerm ) continue;\n    }\n\n    /* No subqueries or non-deterministic functions allowed */\n    if( sqlite3ExprContainsSubquery(pTerm->pExpr) ) continue;\n\n    /* For an index scan, make sure referenced columns are actually in\n    ** the index. */\n    if( sHint.pIdx!=0 ){\n      sWalker.eCode = 0;\n      sWalker.xExprCallback = codeCursorHintCheckExpr;\n      sqlite3WalkExpr(&sWalker, pTerm->pExpr);\n      if( sWalker.eCode ) continue;\n    }\n\n    /* If we survive all prior tests, that means this term is worth hinting */\n    pExpr = sqlite3ExprAnd(db, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));\n  }\n  if( pExpr!=0 ){\n    sWalker.xExprCallback = codeCursorHintFixExpr;\n    sqlite3WalkExpr(&sWalker, pExpr);\n    sqlite3VdbeAddOp4(v, OP_CursorHint, \n                      (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0,\n                      (const char*)pExpr, P4_EXPR);\n  }\n}\n#else\n# define codeCursorHint(A,B,C,D)  /* No-op */\n#endif /* SQLITE_ENABLE_CURSOR_HINTS */\n\n/*\n** Cursor iCur is open on an intkey b-tree (a table). Register iRowid contains\n** a rowid value just read from cursor iIdxCur, open on index pIdx. This\n** function generates code to do a deferred seek of cursor iCur to the \n** rowid stored in register iRowid.\n**\n** Normally, this is just:\n**\n**   OP_Seek $iCur $iRowid\n**\n** However, if the scan currently being coded is a branch of an OR-loop and\n** the statement currently being coded is a SELECT, then P3 of the OP_Seek\n** is set to iIdxCur and P4 is set to point to an array of integers\n** containing one entry for each column of the table cursor iCur is open \n** on. For each table column, if the column is the i'th column of the \n** index, then the corresponding array entry is set to (i+1). If the column\n** does not appear in the index at all, the array entry is set to 0.\n*/\nstatic void codeDeferredSeek(\n  WhereInfo *pWInfo,              /* Where clause context */\n  Index *pIdx,                    /* Index scan is using */\n  int iCur,                       /* Cursor for IPK b-tree */\n  int iIdxCur                     /* Index cursor */\n){\n  Parse *pParse = pWInfo->pParse; /* Parse context */\n  Vdbe *v = pParse->pVdbe;        /* Vdbe to generate code within */\n\n  assert( iIdxCur>0 );\n  assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 );\n  \n  sqlite3VdbeAddOp3(v, OP_Seek, iIdxCur, 0, iCur);\n  if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)\n   && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask)\n  ){\n    int i;\n    Table *pTab = pIdx->pTable;\n    int *ai = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1));\n    if( ai ){\n      ai[0] = pTab->nCol;\n      for(i=0; i<pIdx->nColumn-1; i++){\n        assert( pIdx->aiColumn[i]<pTab->nCol );\n        if( pIdx->aiColumn[i]>=0 ) ai[pIdx->aiColumn[i]+1] = i+1;\n      }\n      sqlite3VdbeChangeP4(v, -1, (char*)ai, P4_INTARRAY);\n    }\n  }\n}\n\n/*\n** If the expression passed as the second argument is a vector, generate\n** code to write the first nReg elements of the vector into an array\n** of registers starting with iReg.\n**\n** If the expression is not a vector, then nReg must be passed 1. In\n** this case, generate code to evaluate the expression and leave the\n** result in register iReg.\n*/\nstatic void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){\n  assert( nReg>0 );\n  if( sqlite3ExprIsVector(p) ){\n#ifndef SQLITE_OMIT_SUBQUERY\n    if( (p->flags & EP_xIsSelect) ){\n      Vdbe *v = pParse->pVdbe;\n      int iSelect = sqlite3CodeSubselect(pParse, p, 0, 0);\n      sqlite3VdbeAddOp3(v, OP_Copy, iSelect, iReg, nReg-1);\n    }else\n#endif\n    {\n      int i;\n      ExprList *pList = p->x.pList;\n      assert( nReg<=pList->nExpr );\n      for(i=0; i<nReg; i++){\n        sqlite3ExprCode(pParse, pList->a[i].pExpr, iReg+i);\n      }\n    }\n  }else{\n    assert( nReg==1 );\n    sqlite3ExprCode(pParse, p, iReg);\n  }\n}\n\n/*\n** Generate code for the start of the iLevel-th loop in the WHERE clause\n** implementation described by pWInfo.\n*/\nBitmask sqlite3WhereCodeOneLoopStart(\n  WhereInfo *pWInfo,   /* Complete information about the WHERE clause */\n  int iLevel,          /* Which level of pWInfo->a[] should be coded */\n  Bitmask notReady     /* Which tables are currently available */\n){\n  int j, k;            /* Loop counters */\n  int iCur;            /* The VDBE cursor for the table */\n  int addrNxt;         /* Where to jump to continue with the next IN case */\n  int omitTable;       /* True if we use the index only */\n  int bRev;            /* True if we need to scan in reverse order */\n  WhereLevel *pLevel;  /* The where level to be coded */\n  WhereLoop *pLoop;    /* The WhereLoop object being coded */\n  WhereClause *pWC;    /* Decomposition of the entire WHERE clause */\n  WhereTerm *pTerm;               /* A WHERE clause term */\n  Parse *pParse;                  /* Parsing context */\n  sqlite3 *db;                    /* Database connection */\n  Vdbe *v;                        /* The prepared stmt under constructions */\n  struct SrcList_item *pTabItem;  /* FROM clause term being coded */\n  int addrBrk;                    /* Jump here to break out of the loop */\n  int addrCont;                   /* Jump here to continue with next cycle */\n  int iRowidReg = 0;        /* Rowid is stored in this register, if not zero */\n  int iReleaseReg = 0;      /* Temp register to free before returning */\n\n  pParse = pWInfo->pParse;\n  v = pParse->pVdbe;\n  pWC = &pWInfo->sWC;\n  db = pParse->db;\n  pLevel = &pWInfo->a[iLevel];\n  pLoop = pLevel->pWLoop;\n  pTabItem = &pWInfo->pTabList->a[pLevel->iFrom];\n  iCur = pTabItem->iCursor;\n  pLevel->notReady = notReady & ~sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur);\n  bRev = (pWInfo->revMask>>iLevel)&1;\n  omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0 \n           && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;\n  VdbeModuleComment((v, \"Begin WHERE-loop%d: %s\",iLevel,pTabItem->pTab->zName));\n\n  /* Create labels for the \"break\" and \"continue\" instructions\n  ** for the current loop.  Jump to addrBrk to break out of a loop.\n  ** Jump to cont to go immediately to the next iteration of the\n  ** loop.\n  **\n  ** When there is an IN operator, we also have a \"addrNxt\" label that\n  ** means to continue with the next IN value combination.  When\n  ** there are no IN operators in the constraints, the \"addrNxt\" label\n  ** is the same as \"addrBrk\".\n  */\n  addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v);\n  addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v);\n\n  /* If this is the right table of a LEFT OUTER JOIN, allocate and\n  ** initialize a memory cell that records if this table matches any\n  ** row of the left table of the join.\n  */\n  if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){\n    pLevel->iLeftJoin = ++pParse->nMem;\n    sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);\n    VdbeComment((v, \"init LEFT JOIN no-match flag\"));\n  }\n\n  /* Special case of a FROM clause subquery implemented as a co-routine */\n  if( pTabItem->fg.viaCoroutine ){\n    int regYield = pTabItem->regReturn;\n    sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);\n    pLevel->p2 =  sqlite3VdbeAddOp2(v, OP_Yield, regYield, addrBrk);\n    VdbeCoverage(v);\n    VdbeComment((v, \"next row of \\\"%s\\\"\", pTabItem->pTab->zName));\n    pLevel->op = OP_Goto;\n  }else\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  if(  (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){\n    /* Case 1:  The table is a virtual-table.  Use the VFilter and VNext\n    **          to access the data.\n    */\n    int iReg;   /* P3 Value for OP_VFilter */\n    int addrNotFound;\n    int nConstraint = pLoop->nLTerm;\n    int iIn;    /* Counter for IN constraints */\n\n    sqlite3ExprCachePush(pParse);\n    iReg = sqlite3GetTempRange(pParse, nConstraint+2);\n    addrNotFound = pLevel->addrBrk;\n    for(j=0; j<nConstraint; j++){\n      int iTarget = iReg+j+2;\n      pTerm = pLoop->aLTerm[j];\n      if( NEVER(pTerm==0) ) continue;\n      if( pTerm->eOperator & WO_IN ){\n        codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget);\n        addrNotFound = pLevel->addrNxt;\n      }else{\n        Expr *pRight = pTerm->pExpr->pRight;\n        codeExprOrVector(pParse, pRight, iTarget, 1);\n      }\n    }\n    sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg);\n    sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1);\n    sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg,\n                      pLoop->u.vtab.idxStr,\n                      pLoop->u.vtab.needFree ? P4_MPRINTF : P4_STATIC);\n    VdbeCoverage(v);\n    pLoop->u.vtab.needFree = 0;\n    pLevel->p1 = iCur;\n    pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext;\n    pLevel->p2 = sqlite3VdbeCurrentAddr(v);\n    iIn = pLevel->u.in.nIn;\n    for(j=nConstraint-1; j>=0; j--){\n      pTerm = pLoop->aLTerm[j];\n      if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){\n        disableTerm(pLevel, pTerm);\n      }else if( (pTerm->eOperator & WO_IN)!=0 ){\n        Expr *pCompare;  /* The comparison operator */\n        Expr *pRight;    /* RHS of the comparison */\n        VdbeOp *pOp;     /* Opcode to access the value of the IN constraint */\n\n        /* Reload the constraint value into reg[iReg+j+2].  The same value\n        ** was loaded into the same register prior to the OP_VFilter, but\n        ** the xFilter implementation might have changed the datatype or\n        ** encoding of the value in the register, so it *must* be reloaded. */\n        assert( pLevel->u.in.aInLoop!=0 || db->mallocFailed );\n        if( !db->mallocFailed ){\n          assert( iIn>0 );\n          pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[--iIn].addrInTop);\n          assert( pOp->opcode==OP_Column || pOp->opcode==OP_Rowid );\n          assert( pOp->opcode!=OP_Column || pOp->p3==iReg+j+2 );\n          assert( pOp->opcode!=OP_Rowid || pOp->p2==iReg+j+2 );\n          testcase( pOp->opcode==OP_Rowid );\n          sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3);\n        }\n\n        /* Generate code that will continue to the next row if \n        ** the IN constraint is not satisfied */\n        pCompare = sqlite3PExpr(pParse, TK_EQ, 0, 0, 0);\n        assert( pCompare!=0 || db->mallocFailed );\n        if( pCompare ){\n          pCompare->pLeft = pTerm->pExpr->pLeft;\n          pCompare->pRight = pRight = sqlite3Expr(db, TK_REGISTER, 0);\n          if( pRight ){\n            pRight->iTable = iReg+j+2;\n            sqlite3ExprIfFalse(pParse, pCompare, pLevel->addrCont, 0);\n          }\n          pCompare->pLeft = 0;\n          sqlite3ExprDelete(db, pCompare);\n        }\n      }\n    }\n    /* These registers need to be preserved in case there is an IN operator\n    ** loop.  So we could deallocate the registers here (and potentially\n    ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0.  But it seems\n    ** simpler and safer to simply not reuse the registers.\n    **\n    **    sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);\n    */\n    sqlite3ExprCachePop(pParse);\n  }else\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n  if( (pLoop->wsFlags & WHERE_IPK)!=0\n   && (pLoop->wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_EQ))!=0\n  ){\n    /* Case 2:  We can directly reference a single row using an\n    **          equality comparison against the ROWID field.  Or\n    **          we reference multiple rows using a \"rowid IN (...)\"\n    **          construct.\n    */\n    assert( pLoop->u.btree.nEq==1 );\n    pTerm = pLoop->aLTerm[0];\n    assert( pTerm!=0 );\n    assert( pTerm->pExpr!=0 );\n    assert( omitTable==0 );\n    testcase( pTerm->wtFlags & TERM_VIRTUAL );\n    iReleaseReg = ++pParse->nMem;\n    iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg);\n    if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);\n    addrNxt = pLevel->addrNxt;\n    sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg);\n    VdbeCoverage(v);\n    sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1);\n    sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);\n    VdbeComment((v, \"pk\"));\n    pLevel->op = OP_Noop;\n  }else if( (pLoop->wsFlags & WHERE_IPK)!=0\n         && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0\n  ){\n    /* Case 3:  We have an inequality comparison against the ROWID field.\n    */\n    int testOp = OP_Noop;\n    int start;\n    int memEndValue = 0;\n    WhereTerm *pStart, *pEnd;\n\n    assert( omitTable==0 );\n    j = 0;\n    pStart = pEnd = 0;\n    if( pLoop->wsFlags & WHERE_BTM_LIMIT ) pStart = pLoop->aLTerm[j++];\n    if( pLoop->wsFlags & WHERE_TOP_LIMIT ) pEnd = pLoop->aLTerm[j++];\n    assert( pStart!=0 || pEnd!=0 );\n    if( bRev ){\n      pTerm = pStart;\n      pStart = pEnd;\n      pEnd = pTerm;\n    }\n    codeCursorHint(pTabItem, pWInfo, pLevel, pEnd);\n    if( pStart ){\n      Expr *pX;             /* The expression that defines the start bound */\n      int r1, rTemp;        /* Registers for holding the start boundary */\n      int op;               /* Cursor seek operation */\n\n      /* The following constant maps TK_xx codes into corresponding \n      ** seek opcodes.  It depends on a particular ordering of TK_xx\n      */\n      const u8 aMoveOp[] = {\n           /* TK_GT */  OP_SeekGT,\n           /* TK_LE */  OP_SeekLE,\n           /* TK_LT */  OP_SeekLT,\n           /* TK_GE */  OP_SeekGE\n      };\n      assert( TK_LE==TK_GT+1 );      /* Make sure the ordering.. */\n      assert( TK_LT==TK_GT+2 );      /*  ... of the TK_xx values... */\n      assert( TK_GE==TK_GT+3 );      /*  ... is correcct. */\n\n      assert( (pStart->wtFlags & TERM_VNULL)==0 );\n      testcase( pStart->wtFlags & TERM_VIRTUAL );\n      pX = pStart->pExpr;\n      assert( pX!=0 );\n      testcase( pStart->leftCursor!=iCur ); /* transitive constraints */\n      if( sqlite3ExprIsVector(pX->pRight) ){\n        r1 = rTemp = sqlite3GetTempReg(pParse);\n        codeExprOrVector(pParse, pX->pRight, r1, 1);\n        op = aMoveOp[(pX->op - TK_GT) | 0x0001];\n      }else{\n        r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp);\n        disableTerm(pLevel, pStart);\n        op = aMoveOp[(pX->op - TK_GT)];\n      }\n      sqlite3VdbeAddOp3(v, op, iCur, addrBrk, r1);\n      VdbeComment((v, \"pk\"));\n      VdbeCoverageIf(v, pX->op==TK_GT);\n      VdbeCoverageIf(v, pX->op==TK_LE);\n      VdbeCoverageIf(v, pX->op==TK_LT);\n      VdbeCoverageIf(v, pX->op==TK_GE);\n      sqlite3ExprCacheAffinityChange(pParse, r1, 1);\n      sqlite3ReleaseTempReg(pParse, rTemp);\n    }else{\n      sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrBrk);\n      VdbeCoverageIf(v, bRev==0);\n      VdbeCoverageIf(v, bRev!=0);\n    }\n    if( pEnd ){\n      Expr *pX;\n      pX = pEnd->pExpr;\n      assert( pX!=0 );\n      assert( (pEnd->wtFlags & TERM_VNULL)==0 );\n      testcase( pEnd->leftCursor!=iCur ); /* Transitive constraints */\n      testcase( pEnd->wtFlags & TERM_VIRTUAL );\n      memEndValue = ++pParse->nMem;\n      codeExprOrVector(pParse, pX->pRight, memEndValue, 1);\n      if( 0==sqlite3ExprIsVector(pX->pRight) \n       && (pX->op==TK_LT || pX->op==TK_GT) \n      ){\n        testOp = bRev ? OP_Le : OP_Ge;\n      }else{\n        testOp = bRev ? OP_Lt : OP_Gt;\n      }\n      if( 0==sqlite3ExprIsVector(pX->pRight) ){\n        disableTerm(pLevel, pEnd);\n      }\n    }\n    start = sqlite3VdbeCurrentAddr(v);\n    pLevel->op = bRev ? OP_Prev : OP_Next;\n    pLevel->p1 = iCur;\n    pLevel->p2 = start;\n    assert( pLevel->p5==0 );\n    if( testOp!=OP_Noop ){\n      iRowidReg = ++pParse->nMem;\n      sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg);\n      sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);\n      sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg);\n      VdbeCoverageIf(v, testOp==OP_Le);\n      VdbeCoverageIf(v, testOp==OP_Lt);\n      VdbeCoverageIf(v, testOp==OP_Ge);\n      VdbeCoverageIf(v, testOp==OP_Gt);\n      sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL);\n    }\n  }else if( pLoop->wsFlags & WHERE_INDEXED ){\n    /* Case 4: A scan using an index.\n    **\n    **         The WHERE clause may contain zero or more equality \n    **         terms (\"==\" or \"IN\" operators) that refer to the N\n    **         left-most columns of the index. It may also contain\n    **         inequality constraints (>, <, >= or <=) on the indexed\n    **         column that immediately follows the N equalities. Only \n    **         the right-most column can be an inequality - the rest must\n    **         use the \"==\" and \"IN\" operators. For example, if the \n    **         index is on (x,y,z), then the following clauses are all \n    **         optimized:\n    **\n    **            x=5\n    **            x=5 AND y=10\n    **            x=5 AND y<10\n    **            x=5 AND y>5 AND y<10\n    **            x=5 AND y=5 AND z<=10\n    **\n    **         The z<10 term of the following cannot be used, only\n    **         the x=5 term:\n    **\n    **            x=5 AND z<10\n    **\n    **         N may be zero if there are inequality constraints.\n    **         If there are no inequality constraints, then N is at\n    **         least one.\n    **\n    **         This case is also used when there are no WHERE clause\n    **         constraints but an index is selected anyway, in order\n    **         to force the output order to conform to an ORDER BY.\n    */  \n    static const u8 aStartOp[] = {\n      0,\n      0,\n      OP_Rewind,           /* 2: (!start_constraints && startEq &&  !bRev) */\n      OP_Last,             /* 3: (!start_constraints && startEq &&   bRev) */\n      OP_SeekGT,           /* 4: (start_constraints  && !startEq && !bRev) */\n      OP_SeekLT,           /* 5: (start_constraints  && !startEq &&  bRev) */\n      OP_SeekGE,           /* 6: (start_constraints  &&  startEq && !bRev) */\n      OP_SeekLE            /* 7: (start_constraints  &&  startEq &&  bRev) */\n    };\n    static const u8 aEndOp[] = {\n      OP_IdxGE,            /* 0: (end_constraints && !bRev && !endEq) */\n      OP_IdxGT,            /* 1: (end_constraints && !bRev &&  endEq) */\n      OP_IdxLE,            /* 2: (end_constraints &&  bRev && !endEq) */\n      OP_IdxLT,            /* 3: (end_constraints &&  bRev &&  endEq) */\n    };\n    u16 nEq = pLoop->u.btree.nEq;     /* Number of == or IN terms */\n    u16 nBtm = pLoop->u.btree.nBtm;   /* Length of BTM vector */\n    u16 nTop = pLoop->u.btree.nTop;   /* Length of TOP vector */\n    int regBase;                 /* Base register holding constraint values */\n    WhereTerm *pRangeStart = 0;  /* Inequality constraint at range start */\n    WhereTerm *pRangeEnd = 0;    /* Inequality constraint at range end */\n    int startEq;                 /* True if range start uses ==, >= or <= */\n    int endEq;                   /* True if range end uses ==, >= or <= */\n    int start_constraints;       /* Start of range is constrained */\n    int nConstraint;             /* Number of constraint terms */\n    Index *pIdx;                 /* The index we will be using */\n    int iIdxCur;                 /* The VDBE cursor for the index */\n    int nExtraReg = 0;           /* Number of extra registers needed */\n    int op;                      /* Instruction opcode */\n    char *zStartAff;             /* Affinity for start of range constraint */\n    char *zEndAff = 0;           /* Affinity for end of range constraint */\n    u8 bSeekPastNull = 0;        /* True to seek past initial nulls */\n    u8 bStopAtNull = 0;          /* Add condition to terminate at NULLs */\n\n    pIdx = pLoop->u.btree.pIndex;\n    iIdxCur = pLevel->iIdxCur;\n    assert( nEq>=pLoop->nSkip );\n\n    /* If this loop satisfies a sort order (pOrderBy) request that \n    ** was passed to this function to implement a \"SELECT min(x) ...\" \n    ** query, then the caller will only allow the loop to run for\n    ** a single iteration. This means that the first row returned\n    ** should not have a NULL value stored in 'x'. If column 'x' is\n    ** the first one after the nEq equality constraints in the index,\n    ** this requires some special handling.\n    */\n    assert( pWInfo->pOrderBy==0\n         || pWInfo->pOrderBy->nExpr==1\n         || (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0 );\n    if( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0\n     && pWInfo->nOBSat>0\n     && (pIdx->nKeyCol>nEq)\n    ){\n      assert( pLoop->nSkip==0 );\n      bSeekPastNull = 1;\n      nExtraReg = 1;\n    }\n\n    /* Find any inequality constraint terms for the start and end \n    ** of the range. \n    */\n    j = nEq;\n    if( pLoop->wsFlags & WHERE_BTM_LIMIT ){\n      pRangeStart = pLoop->aLTerm[j++];\n      nExtraReg = MAX(nExtraReg, pLoop->u.btree.nBtm);\n      /* Like optimization range constraints always occur in pairs */\n      assert( (pRangeStart->wtFlags & TERM_LIKEOPT)==0 || \n              (pLoop->wsFlags & WHERE_TOP_LIMIT)!=0 );\n    }\n    if( pLoop->wsFlags & WHERE_TOP_LIMIT ){\n      pRangeEnd = pLoop->aLTerm[j++];\n      nExtraReg = MAX(nExtraReg, pLoop->u.btree.nTop);\n#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n      if( (pRangeEnd->wtFlags & TERM_LIKEOPT)!=0 ){\n        assert( pRangeStart!=0 );                     /* LIKE opt constraints */\n        assert( pRangeStart->wtFlags & TERM_LIKEOPT );   /* occur in pairs */\n        pLevel->iLikeRepCntr = (u32)++pParse->nMem;\n        sqlite3VdbeAddOp2(v, OP_Integer, 1, (int)pLevel->iLikeRepCntr);\n        VdbeComment((v, \"LIKE loop counter\"));\n        pLevel->addrLikeRep = sqlite3VdbeCurrentAddr(v);\n        /* iLikeRepCntr actually stores 2x the counter register number.  The\n        ** bottom bit indicates whether the search order is ASC or DESC. */\n        testcase( bRev );\n        testcase( pIdx->aSortOrder[nEq]==SQLITE_SO_DESC );\n        assert( (bRev & ~1)==0 );\n        pLevel->iLikeRepCntr <<=1;\n        pLevel->iLikeRepCntr |= bRev ^ (pIdx->aSortOrder[nEq]==SQLITE_SO_DESC);\n      }\n#endif\n      if( pRangeStart==0 ){\n        j = pIdx->aiColumn[nEq];\n        if( (j>=0 && pIdx->pTable->aCol[j].notNull==0) || j==XN_EXPR ){\n          bSeekPastNull = 1;\n        }\n      }\n    }\n    assert( pRangeEnd==0 || (pRangeEnd->wtFlags & TERM_VNULL)==0 );\n\n    /* If we are doing a reverse order scan on an ascending index, or\n    ** a forward order scan on a descending index, interchange the \n    ** start and end terms (pRangeStart and pRangeEnd).\n    */\n    if( (nEq<pIdx->nKeyCol && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC))\n     || (bRev && pIdx->nKeyCol==nEq)\n    ){\n      SWAP(WhereTerm *, pRangeEnd, pRangeStart);\n      SWAP(u8, bSeekPastNull, bStopAtNull);\n      SWAP(u8, nBtm, nTop);\n    }\n\n    /* Generate code to evaluate all constraint terms using == or IN\n    ** and store the values of those terms in an array of registers\n    ** starting at regBase.\n    */\n    codeCursorHint(pTabItem, pWInfo, pLevel, pRangeEnd);\n    regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff);\n    assert( zStartAff==0 || sqlite3Strlen30(zStartAff)>=nEq );\n    if( zStartAff && nTop ){\n      zEndAff = sqlite3DbStrDup(db, &zStartAff[nEq]);\n    }\n    addrNxt = pLevel->addrNxt;\n\n    testcase( pRangeStart && (pRangeStart->eOperator & WO_LE)!=0 );\n    testcase( pRangeStart && (pRangeStart->eOperator & WO_GE)!=0 );\n    testcase( pRangeEnd && (pRangeEnd->eOperator & WO_LE)!=0 );\n    testcase( pRangeEnd && (pRangeEnd->eOperator & WO_GE)!=0 );\n    startEq = !pRangeStart || pRangeStart->eOperator & (WO_LE|WO_GE);\n    endEq =   !pRangeEnd || pRangeEnd->eOperator & (WO_LE|WO_GE);\n    start_constraints = pRangeStart || nEq>0;\n\n    /* Seek the index cursor to the start of the range. */\n    nConstraint = nEq;\n    if( pRangeStart ){\n      Expr *pRight = pRangeStart->pExpr->pRight;\n      codeExprOrVector(pParse, pRight, regBase+nEq, nBtm);\n      whereLikeOptimizationStringFixup(v, pLevel, pRangeStart);\n      if( (pRangeStart->wtFlags & TERM_VNULL)==0\n       && sqlite3ExprCanBeNull(pRight)\n      ){\n        sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);\n        VdbeCoverage(v);\n      }\n      if( zStartAff ){\n        updateRangeAffinityStr(pRight, nBtm, &zStartAff[nEq]);\n      }  \n      nConstraint += nBtm;\n      testcase( pRangeStart->wtFlags & TERM_VIRTUAL );\n      if( sqlite3ExprIsVector(pRight)==0 ){\n        disableTerm(pLevel, pRangeStart);\n      }else{\n        startEq = 1;\n      }\n      bSeekPastNull = 0;\n    }else if( bSeekPastNull ){\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);\n      nConstraint++;\n      startEq = 0;\n      start_constraints = 1;\n    }\n    codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff);\n    if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){\n      /* The skip-scan logic inside the call to codeAllEqualityConstraints()\n      ** above has already left the cursor sitting on the correct row,\n      ** so no further seeking is needed */\n    }else{\n      op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];\n      assert( op!=0 );\n      sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);\n      VdbeCoverage(v);\n      VdbeCoverageIf(v, op==OP_Rewind);  testcase( op==OP_Rewind );\n      VdbeCoverageIf(v, op==OP_Last);    testcase( op==OP_Last );\n      VdbeCoverageIf(v, op==OP_SeekGT);  testcase( op==OP_SeekGT );\n      VdbeCoverageIf(v, op==OP_SeekGE);  testcase( op==OP_SeekGE );\n      VdbeCoverageIf(v, op==OP_SeekLE);  testcase( op==OP_SeekLE );\n      VdbeCoverageIf(v, op==OP_SeekLT);  testcase( op==OP_SeekLT );\n    }\n\n    /* Load the value for the inequality constraint at the end of the\n    ** range (if any).\n    */\n    nConstraint = nEq;\n    if( pRangeEnd ){\n      Expr *pRight = pRangeEnd->pExpr->pRight;\n      sqlite3ExprCacheRemove(pParse, regBase+nEq, 1);\n      codeExprOrVector(pParse, pRight, regBase+nEq, nTop);\n      whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);\n      if( (pRangeEnd->wtFlags & TERM_VNULL)==0\n       && sqlite3ExprCanBeNull(pRight)\n      ){\n        sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);\n        VdbeCoverage(v);\n      }\n      if( zEndAff ){\n        updateRangeAffinityStr(pRight, nTop, zEndAff);\n        codeApplyAffinity(pParse, regBase+nEq, nTop, zEndAff);\n      }else{\n        assert( pParse->db->mallocFailed );\n      }\n      nConstraint += nTop;\n      testcase( pRangeEnd->wtFlags & TERM_VIRTUAL );\n\n      if( sqlite3ExprIsVector(pRight)==0 ){\n        disableTerm(pLevel, pRangeEnd);\n      }else{\n        endEq = 1;\n      }\n    }else if( bStopAtNull ){\n      sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);\n      endEq = 0;\n      nConstraint++;\n    }\n    sqlite3DbFree(db, zStartAff);\n    sqlite3DbFree(db, zEndAff);\n\n    /* Top of the loop body */\n    pLevel->p2 = sqlite3VdbeCurrentAddr(v);\n\n    /* Check if the index cursor is past the end of the range. */\n    if( nConstraint ){\n      op = aEndOp[bRev*2 + endEq];\n      sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint);\n      testcase( op==OP_IdxGT );  VdbeCoverageIf(v, op==OP_IdxGT );\n      testcase( op==OP_IdxGE );  VdbeCoverageIf(v, op==OP_IdxGE );\n      testcase( op==OP_IdxLT );  VdbeCoverageIf(v, op==OP_IdxLT );\n      testcase( op==OP_IdxLE );  VdbeCoverageIf(v, op==OP_IdxLE );\n    }\n\n    /* Seek the table cursor, if required */\n    if( omitTable ){\n      /* pIdx is a covering index.  No need to access the main table. */\n    }else if( HasRowid(pIdx->pTable) ){\n      if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){\n        iRowidReg = ++pParse->nMem;\n        sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg);\n        sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);\n        sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg);\n        VdbeCoverage(v);\n      }else{\n        codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur);\n      }\n    }else if( iCur!=iIdxCur ){\n      Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable);\n      iRowidReg = sqlite3GetTempRange(pParse, pPk->nKeyCol);\n      for(j=0; j<pPk->nKeyCol; j++){\n        k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]);\n        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, iRowidReg+j);\n      }\n      sqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont,\n                           iRowidReg, pPk->nKeyCol); VdbeCoverage(v);\n    }\n\n    /* Record the instruction used to terminate the loop. */\n    if( pLoop->wsFlags & WHERE_ONEROW ){\n      pLevel->op = OP_Noop;\n    }else if( bRev ){\n      pLevel->op = OP_Prev;\n    }else{\n      pLevel->op = OP_Next;\n    }\n    pLevel->p1 = iIdxCur;\n    pLevel->p3 = (pLoop->wsFlags&WHERE_UNQ_WANTED)!=0 ? 1:0;\n    if( (pLoop->wsFlags & WHERE_CONSTRAINT)==0 ){\n      pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;\n    }else{\n      assert( pLevel->p5==0 );\n    }\n  }else\n\n#ifndef SQLITE_OMIT_OR_OPTIMIZATION\n  if( pLoop->wsFlags & WHERE_MULTI_OR ){\n    /* Case 5:  Two or more separately indexed terms connected by OR\n    **\n    ** Example:\n    **\n    **   CREATE TABLE t1(a,b,c,d);\n    **   CREATE INDEX i1 ON t1(a);\n    **   CREATE INDEX i2 ON t1(b);\n    **   CREATE INDEX i3 ON t1(c);\n    **\n    **   SELECT * FROM t1 WHERE a=5 OR b=7 OR (c=11 AND d=13)\n    **\n    ** In the example, there are three indexed terms connected by OR.\n    ** The top of the loop looks like this:\n    **\n    **          Null       1                # Zero the rowset in reg 1\n    **\n    ** Then, for each indexed term, the following. The arguments to\n    ** RowSetTest are such that the rowid of the current row is inserted\n    ** into the RowSet. If it is already present, control skips the\n    ** Gosub opcode and jumps straight to the code generated by WhereEnd().\n    **\n    **        sqlite3WhereBegin(<term>)\n    **          RowSetTest                  # Insert rowid into rowset\n    **          Gosub      2 A\n    **        sqlite3WhereEnd()\n    **\n    ** Following the above, code to terminate the loop. Label A, the target\n    ** of the Gosub above, jumps to the instruction right after the Goto.\n    **\n    **          Null       1                # Zero the rowset in reg 1\n    **          Goto       B                # The loop is finished.\n    **\n    **       A: <loop body>                 # Return data, whatever.\n    **\n    **          Return     2                # Jump back to the Gosub\n    **\n    **       B: <after the loop>\n    **\n    ** Added 2014-05-26: If the table is a WITHOUT ROWID table, then\n    ** use an ephemeral index instead of a RowSet to record the primary\n    ** keys of the rows we have already seen.\n    **\n    */\n    WhereClause *pOrWc;    /* The OR-clause broken out into subterms */\n    SrcList *pOrTab;       /* Shortened table list or OR-clause generation */\n    Index *pCov = 0;             /* Potential covering index (or NULL) */\n    int iCovCur = pParse->nTab++;  /* Cursor used for index scans (if any) */\n\n    int regReturn = ++pParse->nMem;           /* Register used with OP_Gosub */\n    int regRowset = 0;                        /* Register for RowSet object */\n    int regRowid = 0;                         /* Register holding rowid */\n    int iLoopBody = sqlite3VdbeMakeLabel(v);  /* Start of loop body */\n    int iRetInit;                             /* Address of regReturn init */\n    int untestedTerms = 0;             /* Some terms not completely tested */\n    int ii;                            /* Loop counter */\n    u16 wctrlFlags;                    /* Flags for sub-WHERE clause */\n    Expr *pAndExpr = 0;                /* An \".. AND (...)\" expression */\n    Table *pTab = pTabItem->pTab;\n\n    pTerm = pLoop->aLTerm[0];\n    assert( pTerm!=0 );\n    assert( pTerm->eOperator & WO_OR );\n    assert( (pTerm->wtFlags & TERM_ORINFO)!=0 );\n    pOrWc = &pTerm->u.pOrInfo->wc;\n    pLevel->op = OP_Return;\n    pLevel->p1 = regReturn;\n\n    /* Set up a new SrcList in pOrTab containing the table being scanned\n    ** by this loop in the a[0] slot and all notReady tables in a[1..] slots.\n    ** This becomes the SrcList in the recursive call to sqlite3WhereBegin().\n    */\n    if( pWInfo->nLevel>1 ){\n      int nNotReady;                 /* The number of notReady tables */\n      struct SrcList_item *origSrc;     /* Original list of tables */\n      nNotReady = pWInfo->nLevel - iLevel - 1;\n      pOrTab = sqlite3StackAllocRaw(db,\n                            sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0]));\n      if( pOrTab==0 ) return notReady;\n      pOrTab->nAlloc = (u8)(nNotReady + 1);\n      pOrTab->nSrc = pOrTab->nAlloc;\n      memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem));\n      origSrc = pWInfo->pTabList->a;\n      for(k=1; k<=nNotReady; k++){\n        memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k]));\n      }\n    }else{\n      pOrTab = pWInfo->pTabList;\n    }\n\n    /* Initialize the rowset register to contain NULL. An SQL NULL is \n    ** equivalent to an empty rowset.  Or, create an ephemeral index\n    ** capable of holding primary keys in the case of a WITHOUT ROWID.\n    **\n    ** Also initialize regReturn to contain the address of the instruction \n    ** immediately following the OP_Return at the bottom of the loop. This\n    ** is required in a few obscure LEFT JOIN cases where control jumps\n    ** over the top of the loop into the body of it. In this case the \n    ** correct response for the end-of-loop code (the OP_Return) is to \n    ** fall through to the next instruction, just as an OP_Next does if\n    ** called on an uninitialized cursor.\n    */\n    if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){\n      if( HasRowid(pTab) ){\n        regRowset = ++pParse->nMem;\n        sqlite3VdbeAddOp2(v, OP_Null, 0, regRowset);\n      }else{\n        Index *pPk = sqlite3PrimaryKeyIndex(pTab);\n        regRowset = pParse->nTab++;\n        sqlite3VdbeAddOp2(v, OP_OpenEphemeral, regRowset, pPk->nKeyCol);\n        sqlite3VdbeSetP4KeyInfo(pParse, pPk);\n      }\n      regRowid = ++pParse->nMem;\n    }\n    iRetInit = sqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn);\n\n    /* If the original WHERE clause is z of the form:  (x1 OR x2 OR ...) AND y\n    ** Then for every term xN, evaluate as the subexpression: xN AND z\n    ** That way, terms in y that are factored into the disjunction will\n    ** be picked up by the recursive calls to sqlite3WhereBegin() below.\n    **\n    ** Actually, each subexpression is converted to \"xN AND w\" where w is\n    ** the \"interesting\" terms of z - terms that did not originate in the\n    ** ON or USING clause of a LEFT JOIN, and terms that are usable as \n    ** indices.\n    **\n    ** This optimization also only applies if the (x1 OR x2 OR ...) term\n    ** is not contained in the ON clause of a LEFT JOIN.\n    ** See ticket http://www.sqlite.org/src/info/f2369304e4\n    */\n    if( pWC->nTerm>1 ){\n      int iTerm;\n      for(iTerm=0; iTerm<pWC->nTerm; iTerm++){\n        Expr *pExpr = pWC->a[iTerm].pExpr;\n        if( &pWC->a[iTerm] == pTerm ) continue;\n        if( ExprHasProperty(pExpr, EP_FromJoin) ) continue;\n        testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );\n        testcase( pWC->a[iTerm].wtFlags & TERM_CODED );\n        if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;\n        if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;\n        testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );\n        pExpr = sqlite3ExprDup(db, pExpr, 0);\n        pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);\n      }\n      if( pAndExpr ){\n        pAndExpr = sqlite3PExpr(pParse, TK_AND|TKFLG_DONTFOLD, 0, pAndExpr, 0);\n      }\n    }\n\n    /* Run a separate WHERE clause for each term of the OR clause.  After\n    ** eliminating duplicates from other WHERE clauses, the action for each\n    ** sub-WHERE clause is to to invoke the main loop body as a subroutine.\n    */\n    wctrlFlags =  WHERE_OR_SUBCLAUSE | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE);\n    for(ii=0; ii<pOrWc->nTerm; ii++){\n      WhereTerm *pOrTerm = &pOrWc->a[ii];\n      if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){\n        WhereInfo *pSubWInfo;           /* Info for single OR-term scan */\n        Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */\n        int jmp1 = 0;                   /* Address of jump operation */\n        if( pAndExpr && !ExprHasProperty(pOrExpr, EP_FromJoin) ){\n          pAndExpr->pLeft = pOrExpr;\n          pOrExpr = pAndExpr;\n        }\n        /* Loop through table entries that match term pOrTerm. */\n        WHERETRACE(0xffff, (\"Subplan for OR-clause:\\n\"));\n        pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0,\n                                      wctrlFlags, iCovCur);\n        assert( pSubWInfo || pParse->nErr || db->mallocFailed );\n        if( pSubWInfo ){\n          WhereLoop *pSubLoop;\n          int addrExplain = sqlite3WhereExplainOneScan(\n              pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0\n          );\n          sqlite3WhereAddScanStatus(v, pOrTab, &pSubWInfo->a[0], addrExplain);\n\n          /* This is the sub-WHERE clause body.  First skip over\n          ** duplicate rows from prior sub-WHERE clauses, and record the\n          ** rowid (or PRIMARY KEY) for the current row so that the same\n          ** row will be skipped in subsequent sub-WHERE clauses.\n          */\n          if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){\n            int r;\n            int iSet = ((ii==pOrWc->nTerm-1)?-1:ii);\n            if( HasRowid(pTab) ){\n              r = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, regRowid, 0);\n              jmp1 = sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 0,\n                                           r,iSet);\n              VdbeCoverage(v);\n            }else{\n              Index *pPk = sqlite3PrimaryKeyIndex(pTab);\n              int nPk = pPk->nKeyCol;\n              int iPk;\n\n              /* Read the PK into an array of temp registers. */\n              r = sqlite3GetTempRange(pParse, nPk);\n              for(iPk=0; iPk<nPk; iPk++){\n                int iCol = pPk->aiColumn[iPk];\n                sqlite3ExprCodeGetColumnToReg(pParse, pTab, iCol, iCur, r+iPk);\n              }\n\n              /* Check if the temp table already contains this key. If so,\n              ** the row has already been included in the result set and\n              ** can be ignored (by jumping past the Gosub below). Otherwise,\n              ** insert the key into the temp table and proceed with processing\n              ** the row.\n              **\n              ** Use some of the same optimizations as OP_RowSetTest: If iSet\n              ** is zero, assume that the key cannot already be present in\n              ** the temp table. And if iSet is -1, assume that there is no \n              ** need to insert the key into the temp table, as it will never \n              ** be tested for.  */ \n              if( iSet ){\n                jmp1 = sqlite3VdbeAddOp4Int(v, OP_Found, regRowset, 0, r, nPk);\n                VdbeCoverage(v);\n              }\n              if( iSet>=0 ){\n                sqlite3VdbeAddOp3(v, OP_MakeRecord, r, nPk, regRowid);\n                sqlite3VdbeAddOp3(v, OP_IdxInsert, regRowset, regRowid, 0);\n                if( iSet ) sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);\n              }\n\n              /* Release the array of temp registers */\n              sqlite3ReleaseTempRange(pParse, r, nPk);\n            }\n          }\n\n          /* Invoke the main loop body as a subroutine */\n          sqlite3VdbeAddOp2(v, OP_Gosub, regReturn, iLoopBody);\n\n          /* Jump here (skipping the main loop body subroutine) if the\n          ** current sub-WHERE row is a duplicate from prior sub-WHEREs. */\n          if( jmp1 ) sqlite3VdbeJumpHere(v, jmp1);\n\n          /* The pSubWInfo->untestedTerms flag means that this OR term\n          ** contained one or more AND term from a notReady table.  The\n          ** terms from the notReady table could not be tested and will\n          ** need to be tested later.\n          */\n          if( pSubWInfo->untestedTerms ) untestedTerms = 1;\n\n          /* If all of the OR-connected terms are optimized using the same\n          ** index, and the index is opened using the same cursor number\n          ** by each call to sqlite3WhereBegin() made by this loop, it may\n          ** be possible to use that index as a covering index.\n          **\n          ** If the call to sqlite3WhereBegin() above resulted in a scan that\n          ** uses an index, and this is either the first OR-connected term\n          ** processed or the index is the same as that used by all previous\n          ** terms, set pCov to the candidate covering index. Otherwise, set \n          ** pCov to NULL to indicate that no candidate covering index will \n          ** be available.\n          */\n          pSubLoop = pSubWInfo->a[0].pWLoop;\n          assert( (pSubLoop->wsFlags & WHERE_AUTO_INDEX)==0 );\n          if( (pSubLoop->wsFlags & WHERE_INDEXED)!=0\n           && (ii==0 || pSubLoop->u.btree.pIndex==pCov)\n           && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))\n          ){\n            assert( pSubWInfo->a[0].iIdxCur==iCovCur );\n            pCov = pSubLoop->u.btree.pIndex;\n          }else{\n            pCov = 0;\n          }\n\n          /* Finish the loop through table entries that match term pOrTerm. */\n          sqlite3WhereEnd(pSubWInfo);\n        }\n      }\n    }\n    pLevel->u.pCovidx = pCov;\n    if( pCov ) pLevel->iIdxCur = iCovCur;\n    if( pAndExpr ){\n      pAndExpr->pLeft = 0;\n      sqlite3ExprDelete(db, pAndExpr);\n    }\n    sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v));\n    sqlite3VdbeGoto(v, pLevel->addrBrk);\n    sqlite3VdbeResolveLabel(v, iLoopBody);\n\n    if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab);\n    if( !untestedTerms ) disableTerm(pLevel, pTerm);\n  }else\n#endif /* SQLITE_OMIT_OR_OPTIMIZATION */\n\n  {\n    /* Case 6:  There is no usable index.  We must do a complete\n    **          scan of the entire table.\n    */\n    static const u8 aStep[] = { OP_Next, OP_Prev };\n    static const u8 aStart[] = { OP_Rewind, OP_Last };\n    assert( bRev==0 || bRev==1 );\n    if( pTabItem->fg.isRecursive ){\n      /* Tables marked isRecursive have only a single row that is stored in\n      ** a pseudo-cursor.  No need to Rewind or Next such cursors. */\n      pLevel->op = OP_Noop;\n    }else{\n      codeCursorHint(pTabItem, pWInfo, pLevel, 0);\n      pLevel->op = aStep[bRev];\n      pLevel->p1 = iCur;\n      pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk);\n      VdbeCoverageIf(v, bRev==0);\n      VdbeCoverageIf(v, bRev!=0);\n      pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;\n    }\n  }\n\n#ifdef SQLITE_ENABLE_STMT_SCANSTATUS\n  pLevel->addrVisit = sqlite3VdbeCurrentAddr(v);\n#endif\n\n  /* Insert code to test every subexpression that can be completely\n  ** computed using the current set of tables.\n  */\n  for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){\n    Expr *pE;\n    int skipLikeAddr = 0;\n    testcase( pTerm->wtFlags & TERM_VIRTUAL );\n    testcase( pTerm->wtFlags & TERM_CODED );\n    if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;\n    if( (pTerm->prereqAll & pLevel->notReady)!=0 ){\n      testcase( pWInfo->untestedTerms==0\n               && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 );\n      pWInfo->untestedTerms = 1;\n      continue;\n    }\n    pE = pTerm->pExpr;\n    assert( pE!=0 );\n    if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){\n      continue;\n    }\n    if( pTerm->wtFlags & TERM_LIKECOND ){\n      /* If the TERM_LIKECOND flag is set, that means that the range search\n      ** is sufficient to guarantee that the LIKE operator is true, so we\n      ** can skip the call to the like(A,B) function.  But this only works\n      ** for strings.  So do not skip the call to the function on the pass\n      ** that compares BLOBs. */\n#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS\n      continue;\n#else\n      u32 x = pLevel->iLikeRepCntr;\n      assert( x>0 );\n      skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)? OP_IfNot : OP_If, (int)(x>>1));\n      VdbeCoverage(v);\n#endif\n    }\n    sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);\n    if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr);\n    pTerm->wtFlags |= TERM_CODED;\n  }\n\n  /* Insert code to test for implied constraints based on transitivity\n  ** of the \"==\" operator.\n  **\n  ** Example: If the WHERE clause contains \"t1.a=t2.b\" and \"t2.b=123\"\n  ** and we are coding the t1 loop and the t2 loop has not yet coded,\n  ** then we cannot use the \"t1.a=t2.b\" constraint, but we can code\n  ** the implied \"t1.a=123\" constraint.\n  */\n  for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){\n    Expr *pE, sEAlt;\n    WhereTerm *pAlt;\n    if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;\n    if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue;\n    if( (pTerm->eOperator & WO_EQUIV)==0 ) continue;\n    if( pTerm->leftCursor!=iCur ) continue;\n    if( pLevel->iLeftJoin ) continue;\n    pE = pTerm->pExpr;\n    assert( !ExprHasProperty(pE, EP_FromJoin) );\n    assert( (pTerm->prereqRight & pLevel->notReady)!=0 );\n    pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.leftColumn, notReady,\n                    WO_EQ|WO_IN|WO_IS, 0);\n    if( pAlt==0 ) continue;\n    if( pAlt->wtFlags & (TERM_CODED) ) continue;\n    testcase( pAlt->eOperator & WO_EQ );\n    testcase( pAlt->eOperator & WO_IS );\n    testcase( pAlt->eOperator & WO_IN );\n    VdbeModuleComment((v, \"begin transitive constraint\"));\n    sEAlt = *pAlt->pExpr;\n    sEAlt.pLeft = pE->pLeft;\n    sqlite3ExprIfFalse(pParse, &sEAlt, addrCont, SQLITE_JUMPIFNULL);\n  }\n\n  /* For a LEFT OUTER JOIN, generate code that will record the fact that\n  ** at least one row of the right table has matched the left table.  \n  */\n  if( pLevel->iLeftJoin ){\n    pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);\n    sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);\n    VdbeComment((v, \"record LEFT JOIN hit\"));\n    sqlite3ExprCacheClear(pParse);\n    for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){\n      testcase( pTerm->wtFlags & TERM_VIRTUAL );\n      testcase( pTerm->wtFlags & TERM_CODED );\n      if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;\n      if( (pTerm->prereqAll & pLevel->notReady)!=0 ){\n        assert( pWInfo->untestedTerms );\n        continue;\n      }\n      assert( pTerm->pExpr );\n      sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);\n      pTerm->wtFlags |= TERM_CODED;\n    }\n  }\n\n  return pLevel->notReady;\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher/src/whereexpr.c",
    "content": "/*\n** 2015-06-08\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a blessing:\n**\n**    May you do good and not evil.\n**    May you find forgiveness for yourself and forgive others.\n**    May you share freely, never taking more than you give.\n**\n*************************************************************************\n** This module contains C code that generates VDBE code used to process\n** the WHERE clause of SQL statements.\n**\n** This file was originally part of where.c but was split out to improve\n** readability and editabiliity.  This file contains utility routines for\n** analyzing Expr objects in the WHERE clause.\n*/\n#include \"sqliteInt.h\"\n#include \"whereInt.h\"\n\n/* Forward declarations */\nstatic void exprAnalyze(SrcList*, WhereClause*, int);\n\n/*\n** Deallocate all memory associated with a WhereOrInfo object.\n*/\nstatic void whereOrInfoDelete(sqlite3 *db, WhereOrInfo *p){\n  sqlite3WhereClauseClear(&p->wc);\n  sqlite3DbFree(db, p);\n}\n\n/*\n** Deallocate all memory associated with a WhereAndInfo object.\n*/\nstatic void whereAndInfoDelete(sqlite3 *db, WhereAndInfo *p){\n  sqlite3WhereClauseClear(&p->wc);\n  sqlite3DbFree(db, p);\n}\n\n/*\n** Add a single new WhereTerm entry to the WhereClause object pWC.\n** The new WhereTerm object is constructed from Expr p and with wtFlags.\n** The index in pWC->a[] of the new WhereTerm is returned on success.\n** 0 is returned if the new WhereTerm could not be added due to a memory\n** allocation error.  The memory allocation failure will be recorded in\n** the db->mallocFailed flag so that higher-level functions can detect it.\n**\n** This routine will increase the size of the pWC->a[] array as necessary.\n**\n** If the wtFlags argument includes TERM_DYNAMIC, then responsibility\n** for freeing the expression p is assumed by the WhereClause object pWC.\n** This is true even if this routine fails to allocate a new WhereTerm.\n**\n** WARNING:  This routine might reallocate the space used to store\n** WhereTerms.  All pointers to WhereTerms should be invalidated after\n** calling this routine.  Such pointers may be reinitialized by referencing\n** the pWC->a[] array.\n*/\nstatic int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){\n  WhereTerm *pTerm;\n  int idx;\n  testcase( wtFlags & TERM_VIRTUAL );\n  if( pWC->nTerm>=pWC->nSlot ){\n    WhereTerm *pOld = pWC->a;\n    sqlite3 *db = pWC->pWInfo->pParse->db;\n    pWC->a = sqlite3DbMallocRawNN(db, sizeof(pWC->a[0])*pWC->nSlot*2 );\n    if( pWC->a==0 ){\n      if( wtFlags & TERM_DYNAMIC ){\n        sqlite3ExprDelete(db, p);\n      }\n      pWC->a = pOld;\n      return 0;\n    }\n    memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);\n    if( pOld!=pWC->aStatic ){\n      sqlite3DbFree(db, pOld);\n    }\n    pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);\n  }\n  pTerm = &pWC->a[idx = pWC->nTerm++];\n  if( p && ExprHasProperty(p, EP_Unlikely) ){\n    pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;\n  }else{\n    pTerm->truthProb = 1;\n  }\n  pTerm->pExpr = sqlite3ExprSkipCollate(p);\n  pTerm->wtFlags = wtFlags;\n  pTerm->pWC = pWC;\n  pTerm->iParent = -1;\n  memset(&pTerm->eOperator, 0,\n         sizeof(WhereTerm) - offsetof(WhereTerm,eOperator));\n  return idx;\n}\n\n/*\n** Return TRUE if the given operator is one of the operators that is\n** allowed for an indexable WHERE clause term.  The allowed operators are\n** \"=\", \"<\", \">\", \"<=\", \">=\", \"IN\", \"IS\", and \"IS NULL\"\n*/\nstatic int allowedOp(int op){\n  assert( TK_GT>TK_EQ && TK_GT<TK_GE );\n  assert( TK_LT>TK_EQ && TK_LT<TK_GE );\n  assert( TK_LE>TK_EQ && TK_LE<TK_GE );\n  assert( TK_GE==TK_EQ+4 );\n  return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS;\n}\n\n/*\n** Commute a comparison operator.  Expressions of the form \"X op Y\"\n** are converted into \"Y op X\".\n**\n** If left/right precedence rules come into play when determining the\n** collating sequence, then COLLATE operators are adjusted to ensure\n** that the collating sequence does not change.  For example:\n** \"Y collate NOCASE op X\" becomes \"X op Y\" because any collation sequence on\n** the left hand side of a comparison overrides any collation sequence \n** attached to the right. For the same reason the EP_Collate flag\n** is not commuted.\n*/\nstatic void exprCommute(Parse *pParse, Expr *pExpr){\n  u16 expRight = (pExpr->pRight->flags & EP_Collate);\n  u16 expLeft = (pExpr->pLeft->flags & EP_Collate);\n  assert( allowedOp(pExpr->op) && pExpr->op!=TK_IN );\n  if( expRight==expLeft ){\n    /* Either X and Y both have COLLATE operator or neither do */\n    if( expRight ){\n      /* Both X and Y have COLLATE operators.  Make sure X is always\n      ** used by clearing the EP_Collate flag from Y. */\n      pExpr->pRight->flags &= ~EP_Collate;\n    }else if( sqlite3ExprCollSeq(pParse, pExpr->pLeft)!=0 ){\n      /* Neither X nor Y have COLLATE operators, but X has a non-default\n      ** collating sequence.  So add the EP_Collate marker on X to cause\n      ** it to be searched first. */\n      pExpr->pLeft->flags |= EP_Collate;\n    }\n  }\n  SWAP(Expr*,pExpr->pRight,pExpr->pLeft);\n  if( pExpr->op>=TK_GT ){\n    assert( TK_LT==TK_GT+2 );\n    assert( TK_GE==TK_LE+2 );\n    assert( TK_GT>TK_EQ );\n    assert( TK_GT<TK_LE );\n    assert( pExpr->op>=TK_GT && pExpr->op<=TK_GE );\n    pExpr->op = ((pExpr->op-TK_GT)^2)+TK_GT;\n  }\n}\n\n/*\n** Translate from TK_xx operator to WO_xx bitmask.\n*/\nstatic u16 operatorMask(int op){\n  u16 c;\n  assert( allowedOp(op) );\n  if( op==TK_IN ){\n    c = WO_IN;\n  }else if( op==TK_ISNULL ){\n    c = WO_ISNULL;\n  }else if( op==TK_IS ){\n    c = WO_IS;\n  }else{\n    assert( (WO_EQ<<(op-TK_EQ)) < 0x7fff );\n    c = (u16)(WO_EQ<<(op-TK_EQ));\n  }\n  assert( op!=TK_ISNULL || c==WO_ISNULL );\n  assert( op!=TK_IN || c==WO_IN );\n  assert( op!=TK_EQ || c==WO_EQ );\n  assert( op!=TK_LT || c==WO_LT );\n  assert( op!=TK_LE || c==WO_LE );\n  assert( op!=TK_GT || c==WO_GT );\n  assert( op!=TK_GE || c==WO_GE );\n  assert( op!=TK_IS || c==WO_IS );\n  return c;\n}\n\n\n#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION\n/*\n** Check to see if the given expression is a LIKE or GLOB operator that\n** can be optimized using inequality constraints.  Return TRUE if it is\n** so and false if not.\n**\n** In order for the operator to be optimizible, the RHS must be a string\n** literal that does not begin with a wildcard.  The LHS must be a column\n** that may only be NULL, a string, or a BLOB, never a number. (This means\n** that virtual tables cannot participate in the LIKE optimization.)  The\n** collating sequence for the column on the LHS must be appropriate for\n** the operator.\n*/\nstatic int isLikeOrGlob(\n  Parse *pParse,    /* Parsing and code generating context */\n  Expr *pExpr,      /* Test this expression */\n  Expr **ppPrefix,  /* Pointer to TK_STRING expression with pattern prefix */\n  int *pisComplete, /* True if the only wildcard is % in the last character */\n  int *pnoCase      /* True if uppercase is equivalent to lowercase */\n){\n  const char *z = 0;         /* String on RHS of LIKE operator */\n  Expr *pRight, *pLeft;      /* Right and left size of LIKE operator */\n  ExprList *pList;           /* List of operands to the LIKE operator */\n  int c;                     /* One character in z[] */\n  int cnt;                   /* Number of non-wildcard prefix characters */\n  char wc[3];                /* Wildcard characters */\n  sqlite3 *db = pParse->db;  /* Database connection */\n  sqlite3_value *pVal = 0;\n  int op;                    /* Opcode of pRight */\n  int rc;                    /* Result code to return */\n\n  if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){\n    return 0;\n  }\n#ifdef SQLITE_EBCDIC\n  if( *pnoCase ) return 0;\n#endif\n  pList = pExpr->x.pList;\n  pLeft = pList->a[1].pExpr;\n  if( pLeft->op!=TK_COLUMN \n   || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT \n   || IsVirtual(pLeft->pTab)  /* Value might be numeric */\n  ){\n    /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must\n    ** be the name of an indexed column with TEXT affinity. */\n    return 0;\n  }\n  assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */\n\n  pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);\n  op = pRight->op;\n  if( op==TK_VARIABLE ){\n    Vdbe *pReprepare = pParse->pReprepare;\n    int iCol = pRight->iColumn;\n    pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB);\n    if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){\n      z = (char *)sqlite3_value_text(pVal);\n    }\n    sqlite3VdbeSetVarmask(pParse->pVdbe, iCol);\n    assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );\n  }else if( op==TK_STRING ){\n    z = pRight->u.zToken;\n  }\n  if( z ){\n    cnt = 0;\n    while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){\n      cnt++;\n    }\n    if( cnt!=0 && 255!=(u8)z[cnt-1] ){\n      Expr *pPrefix;\n      *pisComplete = c==wc[0] && z[cnt+1]==0;\n      pPrefix = sqlite3Expr(db, TK_STRING, z);\n      if( pPrefix ) pPrefix->u.zToken[cnt] = 0;\n      *ppPrefix = pPrefix;\n      if( op==TK_VARIABLE ){\n        Vdbe *v = pParse->pVdbe;\n        sqlite3VdbeSetVarmask(v, pRight->iColumn);\n        if( *pisComplete && pRight->u.zToken[1] ){\n          /* If the rhs of the LIKE expression is a variable, and the current\n          ** value of the variable means there is no need to invoke the LIKE\n          ** function, then no OP_Variable will be added to the program.\n          ** This causes problems for the sqlite3_bind_parameter_name()\n          ** API. To work around them, add a dummy OP_Variable here.\n          */ \n          int r1 = sqlite3GetTempReg(pParse);\n          sqlite3ExprCodeTarget(pParse, pRight, r1);\n          sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);\n          sqlite3ReleaseTempReg(pParse, r1);\n        }\n      }\n    }else{\n      z = 0;\n    }\n  }\n\n  rc = (z!=0);\n  sqlite3ValueFree(pVal);\n  return rc;\n}\n#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */\n\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n/*\n** Check to see if the given expression is of the form\n**\n**         column OP expr\n**\n** where OP is one of MATCH, GLOB, LIKE or REGEXP and \"column\" is a \n** column of a virtual table.\n**\n** If it is then return TRUE.  If not, return FALSE.\n*/\nstatic int isMatchOfColumn(\n  Expr *pExpr,                    /* Test this expression */\n  unsigned char *peOp2            /* OUT: 0 for MATCH, or else an op2 value */\n){\n  static const struct Op2 {\n    const char *zOp;\n    unsigned char eOp2;\n  } aOp[] = {\n    { \"match\",  SQLITE_INDEX_CONSTRAINT_MATCH },\n    { \"glob\",   SQLITE_INDEX_CONSTRAINT_GLOB },\n    { \"like\",   SQLITE_INDEX_CONSTRAINT_LIKE },\n    { \"regexp\", SQLITE_INDEX_CONSTRAINT_REGEXP }\n  };\n  ExprList *pList;\n  Expr *pCol;                     /* Column reference */\n  int i;\n\n  if( pExpr->op!=TK_FUNCTION ){\n    return 0;\n  }\n  pList = pExpr->x.pList;\n  if( pList==0 || pList->nExpr!=2 ){\n    return 0;\n  }\n  pCol = pList->a[1].pExpr;\n  if( pCol->op!=TK_COLUMN || !IsVirtual(pCol->pTab) ){\n    return 0;\n  }\n  for(i=0; i<ArraySize(aOp); i++){\n    if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){\n      *peOp2 = aOp[i].eOp2;\n      return 1;\n    }\n  }\n  return 0;\n}\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n/*\n** If the pBase expression originated in the ON or USING clause of\n** a join, then transfer the appropriate markings over to derived.\n*/\nstatic void transferJoinMarkings(Expr *pDerived, Expr *pBase){\n  if( pDerived ){\n    pDerived->flags |= pBase->flags & EP_FromJoin;\n    pDerived->iRightJoinTable = pBase->iRightJoinTable;\n  }\n}\n\n/*\n** Mark term iChild as being a child of term iParent\n*/\nstatic void markTermAsChild(WhereClause *pWC, int iChild, int iParent){\n  pWC->a[iChild].iParent = iParent;\n  pWC->a[iChild].truthProb = pWC->a[iParent].truthProb;\n  pWC->a[iParent].nChild++;\n}\n\n/*\n** Return the N-th AND-connected subterm of pTerm.  Or if pTerm is not\n** a conjunction, then return just pTerm when N==0.  If N is exceeds\n** the number of available subterms, return NULL.\n*/\nstatic WhereTerm *whereNthSubterm(WhereTerm *pTerm, int N){\n  if( pTerm->eOperator!=WO_AND ){\n    return N==0 ? pTerm : 0;\n  }\n  if( N<pTerm->u.pAndInfo->wc.nTerm ){\n    return &pTerm->u.pAndInfo->wc.a[N];\n  }\n  return 0;\n}\n\n/*\n** Subterms pOne and pTwo are contained within WHERE clause pWC.  The\n** two subterms are in disjunction - they are OR-ed together.\n**\n** If these two terms are both of the form:  \"A op B\" with the same\n** A and B values but different operators and if the operators are\n** compatible (if one is = and the other is <, for example) then\n** add a new virtual AND term to pWC that is the combination of the\n** two.\n**\n** Some examples:\n**\n**    x<y OR x=y    -->     x<=y\n**    x=y OR x=y    -->     x=y\n**    x<=y OR x<y   -->     x<=y\n**\n** The following is NOT generated:\n**\n**    x<y OR x>y    -->     x!=y     \n*/\nstatic void whereCombineDisjuncts(\n  SrcList *pSrc,         /* the FROM clause */\n  WhereClause *pWC,      /* The complete WHERE clause */\n  WhereTerm *pOne,       /* First disjunct */\n  WhereTerm *pTwo        /* Second disjunct */\n){\n  u16 eOp = pOne->eOperator | pTwo->eOperator;\n  sqlite3 *db;           /* Database connection (for malloc) */\n  Expr *pNew;            /* New virtual expression */\n  int op;                /* Operator for the combined expression */\n  int idxNew;            /* Index in pWC of the next virtual term */\n\n  if( (pOne->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE))==0 ) return;\n  if( (pTwo->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE))==0 ) return;\n  if( (eOp & (WO_EQ|WO_LT|WO_LE))!=eOp\n   && (eOp & (WO_EQ|WO_GT|WO_GE))!=eOp ) return;\n  assert( pOne->pExpr->pLeft!=0 && pOne->pExpr->pRight!=0 );\n  assert( pTwo->pExpr->pLeft!=0 && pTwo->pExpr->pRight!=0 );\n  if( sqlite3ExprCompare(pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return;\n  if( sqlite3ExprCompare(pOne->pExpr->pRight, pTwo->pExpr->pRight, -1) )return;\n  /* If we reach this point, it means the two subterms can be combined */\n  if( (eOp & (eOp-1))!=0 ){\n    if( eOp & (WO_LT|WO_LE) ){\n      eOp = WO_LE;\n    }else{\n      assert( eOp & (WO_GT|WO_GE) );\n      eOp = WO_GE;\n    }\n  }\n  db = pWC->pWInfo->pParse->db;\n  pNew = sqlite3ExprDup(db, pOne->pExpr, 0);\n  if( pNew==0 ) return;\n  for(op=TK_EQ; eOp!=(WO_EQ<<(op-TK_EQ)); op++){ assert( op<TK_GE ); }\n  pNew->op = op;\n  idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);\n  exprAnalyze(pSrc, pWC, idxNew);\n}\n\n#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)\n/*\n** Analyze a term that consists of two or more OR-connected\n** subterms.  So in:\n**\n**     ... WHERE  (a=5) AND (b=7 OR c=9 OR d=13) AND (d=13)\n**                          ^^^^^^^^^^^^^^^^^^^^\n**\n** This routine analyzes terms such as the middle term in the above example.\n** A WhereOrTerm object is computed and attached to the term under\n** analysis, regardless of the outcome of the analysis.  Hence:\n**\n**     WhereTerm.wtFlags   |=  TERM_ORINFO\n**     WhereTerm.u.pOrInfo  =  a dynamically allocated WhereOrTerm object\n**\n** The term being analyzed must have two or more of OR-connected subterms.\n** A single subterm might be a set of AND-connected sub-subterms.\n** Examples of terms under analysis:\n**\n**     (A)     t1.x=t2.y OR t1.x=t2.z OR t1.y=15 OR t1.z=t3.a+5\n**     (B)     x=expr1 OR expr2=x OR x=expr3\n**     (C)     t1.x=t2.y OR (t1.x=t2.z AND t1.y=15)\n**     (D)     x=expr1 OR (y>11 AND y<22 AND z LIKE '*hello*')\n**     (E)     (p.a=1 AND q.b=2 AND r.c=3) OR (p.x=4 AND q.y=5 AND r.z=6)\n**     (F)     x>A OR (x=A AND y>=B)\n**\n** CASE 1:\n**\n** If all subterms are of the form T.C=expr for some single column of C and\n** a single table T (as shown in example B above) then create a new virtual\n** term that is an equivalent IN expression.  In other words, if the term\n** being analyzed is:\n**\n**      x = expr1  OR  expr2 = x  OR  x = expr3\n**\n** then create a new virtual term like this:\n**\n**      x IN (expr1,expr2,expr3)\n**\n** CASE 2:\n**\n** If there are exactly two disjuncts and one side has x>A and the other side\n** has x=A (for the same x and A) then add a new virtual conjunct term to the\n** WHERE clause of the form \"x>=A\".  Example:\n**\n**      x>A OR (x=A AND y>B)    adds:    x>=A\n**\n** The added conjunct can sometimes be helpful in query planning.\n**\n** CASE 3:\n**\n** If all subterms are indexable by a single table T, then set\n**\n**     WhereTerm.eOperator              =  WO_OR\n**     WhereTerm.u.pOrInfo->indexable  |=  the cursor number for table T\n**\n** A subterm is \"indexable\" if it is of the form\n** \"T.C <op> <expr>\" where C is any column of table T and \n** <op> is one of \"=\", \"<\", \"<=\", \">\", \">=\", \"IS NULL\", or \"IN\".\n** A subterm is also indexable if it is an AND of two or more\n** subsubterms at least one of which is indexable.  Indexable AND \n** subterms have their eOperator set to WO_AND and they have\n** u.pAndInfo set to a dynamically allocated WhereAndTerm object.\n**\n** From another point of view, \"indexable\" means that the subterm could\n** potentially be used with an index if an appropriate index exists.\n** This analysis does not consider whether or not the index exists; that\n** is decided elsewhere.  This analysis only looks at whether subterms\n** appropriate for indexing exist.\n**\n** All examples A through E above satisfy case 3.  But if a term\n** also satisfies case 1 (such as B) we know that the optimizer will\n** always prefer case 1, so in that case we pretend that case 3 is not\n** satisfied.\n**\n** It might be the case that multiple tables are indexable.  For example,\n** (E) above is indexable on tables P, Q, and R.\n**\n** Terms that satisfy case 3 are candidates for lookup by using\n** separate indices to find rowids for each subterm and composing\n** the union of all rowids using a RowSet object.  This is similar\n** to \"bitmap indices\" in other database engines.\n**\n** OTHERWISE:\n**\n** If none of cases 1, 2, or 3 apply, then leave the eOperator set to\n** zero.  This term is not useful for search.\n*/\nstatic void exprAnalyzeOrTerm(\n  SrcList *pSrc,            /* the FROM clause */\n  WhereClause *pWC,         /* the complete WHERE clause */\n  int idxTerm               /* Index of the OR-term to be analyzed */\n){\n  WhereInfo *pWInfo = pWC->pWInfo;        /* WHERE clause processing context */\n  Parse *pParse = pWInfo->pParse;         /* Parser context */\n  sqlite3 *db = pParse->db;               /* Database connection */\n  WhereTerm *pTerm = &pWC->a[idxTerm];    /* The term to be analyzed */\n  Expr *pExpr = pTerm->pExpr;             /* The expression of the term */\n  int i;                                  /* Loop counters */\n  WhereClause *pOrWc;       /* Breakup of pTerm into subterms */\n  WhereTerm *pOrTerm;       /* A Sub-term within the pOrWc */\n  WhereOrInfo *pOrInfo;     /* Additional information associated with pTerm */\n  Bitmask chngToIN;         /* Tables that might satisfy case 1 */\n  Bitmask indexable;        /* Tables that are indexable, satisfying case 2 */\n\n  /*\n  ** Break the OR clause into its separate subterms.  The subterms are\n  ** stored in a WhereClause structure containing within the WhereOrInfo\n  ** object that is attached to the original OR clause term.\n  */\n  assert( (pTerm->wtFlags & (TERM_DYNAMIC|TERM_ORINFO|TERM_ANDINFO))==0 );\n  assert( pExpr->op==TK_OR );\n  pTerm->u.pOrInfo = pOrInfo = sqlite3DbMallocZero(db, sizeof(*pOrInfo));\n  if( pOrInfo==0 ) return;\n  pTerm->wtFlags |= TERM_ORINFO;\n  pOrWc = &pOrInfo->wc;\n  memset(pOrWc->aStatic, 0, sizeof(pOrWc->aStatic));\n  sqlite3WhereClauseInit(pOrWc, pWInfo);\n  sqlite3WhereSplit(pOrWc, pExpr, TK_OR);\n  sqlite3WhereExprAnalyze(pSrc, pOrWc);\n  if( db->mallocFailed ) return;\n  assert( pOrWc->nTerm>=2 );\n\n  /*\n  ** Compute the set of tables that might satisfy cases 1 or 3.\n  */\n  indexable = ~(Bitmask)0;\n  chngToIN = ~(Bitmask)0;\n  for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0 && indexable; i--, pOrTerm++){\n    if( (pOrTerm->eOperator & WO_SINGLE)==0 ){\n      WhereAndInfo *pAndInfo;\n      assert( (pOrTerm->wtFlags & (TERM_ANDINFO|TERM_ORINFO))==0 );\n      chngToIN = 0;\n      pAndInfo = sqlite3DbMallocRawNN(db, sizeof(*pAndInfo));\n      if( pAndInfo ){\n        WhereClause *pAndWC;\n        WhereTerm *pAndTerm;\n        int j;\n        Bitmask b = 0;\n        pOrTerm->u.pAndInfo = pAndInfo;\n        pOrTerm->wtFlags |= TERM_ANDINFO;\n        pOrTerm->eOperator = WO_AND;\n        pAndWC = &pAndInfo->wc;\n        memset(pAndWC->aStatic, 0, sizeof(pAndWC->aStatic));\n        sqlite3WhereClauseInit(pAndWC, pWC->pWInfo);\n        sqlite3WhereSplit(pAndWC, pOrTerm->pExpr, TK_AND);\n        sqlite3WhereExprAnalyze(pSrc, pAndWC);\n        pAndWC->pOuter = pWC;\n        if( !db->mallocFailed ){\n          for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){\n            assert( pAndTerm->pExpr );\n            if( allowedOp(pAndTerm->pExpr->op) \n             || pAndTerm->eOperator==WO_MATCH \n            ){\n              b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor);\n            }\n          }\n        }\n        indexable &= b;\n      }\n    }else if( pOrTerm->wtFlags & TERM_COPIED ){\n      /* Skip this term for now.  We revisit it when we process the\n      ** corresponding TERM_VIRTUAL term */\n    }else{\n      Bitmask b;\n      b = sqlite3WhereGetMask(&pWInfo->sMaskSet, pOrTerm->leftCursor);\n      if( pOrTerm->wtFlags & TERM_VIRTUAL ){\n        WhereTerm *pOther = &pOrWc->a[pOrTerm->iParent];\n        b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pOther->leftCursor);\n      }\n      indexable &= b;\n      if( (pOrTerm->eOperator & WO_EQ)==0 ){\n        chngToIN = 0;\n      }else{\n        chngToIN &= b;\n      }\n    }\n  }\n\n  /*\n  ** Record the set of tables that satisfy case 3.  The set might be\n  ** empty.\n  */\n  pOrInfo->indexable = indexable;\n  pTerm->eOperator = indexable==0 ? 0 : WO_OR;\n\n  /* For a two-way OR, attempt to implementation case 2.\n  */\n  if( indexable && pOrWc->nTerm==2 ){\n    int iOne = 0;\n    WhereTerm *pOne;\n    while( (pOne = whereNthSubterm(&pOrWc->a[0],iOne++))!=0 ){\n      int iTwo = 0;\n      WhereTerm *pTwo;\n      while( (pTwo = whereNthSubterm(&pOrWc->a[1],iTwo++))!=0 ){\n        whereCombineDisjuncts(pSrc, pWC, pOne, pTwo);\n      }\n    }\n  }\n\n  /*\n  ** chngToIN holds a set of tables that *might* satisfy case 1.  But\n  ** we have to do some additional checking to see if case 1 really\n  ** is satisfied.\n  **\n  ** chngToIN will hold either 0, 1, or 2 bits.  The 0-bit case means\n  ** that there is no possibility of transforming the OR clause into an\n  ** IN operator because one or more terms in the OR clause contain\n  ** something other than == on a column in the single table.  The 1-bit\n  ** case means that every term of the OR clause is of the form\n  ** \"table.column=expr\" for some single table.  The one bit that is set\n  ** will correspond to the common table.  We still need to check to make\n  ** sure the same column is used on all terms.  The 2-bit case is when\n  ** the all terms are of the form \"table1.column=table2.column\".  It\n  ** might be possible to form an IN operator with either table1.column\n  ** or table2.column as the LHS if either is common to every term of\n  ** the OR clause.\n  **\n  ** Note that terms of the form \"table.column1=table.column2\" (the\n  ** same table on both sizes of the ==) cannot be optimized.\n  */\n  if( chngToIN ){\n    int okToChngToIN = 0;     /* True if the conversion to IN is valid */\n    int iColumn = -1;         /* Column index on lhs of IN operator */\n    int iCursor = -1;         /* Table cursor common to all terms */\n    int j = 0;                /* Loop counter */\n\n    /* Search for a table and column that appears on one side or the\n    ** other of the == operator in every subterm.  That table and column\n    ** will be recorded in iCursor and iColumn.  There might not be any\n    ** such table and column.  Set okToChngToIN if an appropriate table\n    ** and column is found but leave okToChngToIN false if not found.\n    */\n    for(j=0; j<2 && !okToChngToIN; j++){\n      pOrTerm = pOrWc->a;\n      for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){\n        assert( pOrTerm->eOperator & WO_EQ );\n        pOrTerm->wtFlags &= ~TERM_OR_OK;\n        if( pOrTerm->leftCursor==iCursor ){\n          /* This is the 2-bit case and we are on the second iteration and\n          ** current term is from the first iteration.  So skip this term. */\n          assert( j==1 );\n          continue;\n        }\n        if( (chngToIN & sqlite3WhereGetMask(&pWInfo->sMaskSet,\n                                            pOrTerm->leftCursor))==0 ){\n          /* This term must be of the form t1.a==t2.b where t2 is in the\n          ** chngToIN set but t1 is not.  This term will be either preceded\n          ** or follwed by an inverted copy (t2.b==t1.a).  Skip this term \n          ** and use its inversion. */\n          testcase( pOrTerm->wtFlags & TERM_COPIED );\n          testcase( pOrTerm->wtFlags & TERM_VIRTUAL );\n          assert( pOrTerm->wtFlags & (TERM_COPIED|TERM_VIRTUAL) );\n          continue;\n        }\n        iColumn = pOrTerm->u.leftColumn;\n        iCursor = pOrTerm->leftCursor;\n        break;\n      }\n      if( i<0 ){\n        /* No candidate table+column was found.  This can only occur\n        ** on the second iteration */\n        assert( j==1 );\n        assert( IsPowerOfTwo(chngToIN) );\n        assert( chngToIN==sqlite3WhereGetMask(&pWInfo->sMaskSet, iCursor) );\n        break;\n      }\n      testcase( j==1 );\n\n      /* We have found a candidate table and column.  Check to see if that\n      ** table and column is common to every term in the OR clause */\n      okToChngToIN = 1;\n      for(; i>=0 && okToChngToIN; i--, pOrTerm++){\n        assert( pOrTerm->eOperator & WO_EQ );\n        if( pOrTerm->leftCursor!=iCursor ){\n          pOrTerm->wtFlags &= ~TERM_OR_OK;\n        }else if( pOrTerm->u.leftColumn!=iColumn ){\n          okToChngToIN = 0;\n        }else{\n          int affLeft, affRight;\n          /* If the right-hand side is also a column, then the affinities\n          ** of both right and left sides must be such that no type\n          ** conversions are required on the right.  (Ticket #2249)\n          */\n          affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight);\n          affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft);\n          if( affRight!=0 && affRight!=affLeft ){\n            okToChngToIN = 0;\n          }else{\n            pOrTerm->wtFlags |= TERM_OR_OK;\n          }\n        }\n      }\n    }\n\n    /* At this point, okToChngToIN is true if original pTerm satisfies\n    ** case 1.  In that case, construct a new virtual term that is \n    ** pTerm converted into an IN operator.\n    */\n    if( okToChngToIN ){\n      Expr *pDup;            /* A transient duplicate expression */\n      ExprList *pList = 0;   /* The RHS of the IN operator */\n      Expr *pLeft = 0;       /* The LHS of the IN operator */\n      Expr *pNew;            /* The complete IN operator */\n\n      for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){\n        if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue;\n        assert( pOrTerm->eOperator & WO_EQ );\n        assert( pOrTerm->leftCursor==iCursor );\n        assert( pOrTerm->u.leftColumn==iColumn );\n        pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0);\n        pList = sqlite3ExprListAppend(pWInfo->pParse, pList, pDup);\n        pLeft = pOrTerm->pExpr->pLeft;\n      }\n      assert( pLeft!=0 );\n      pDup = sqlite3ExprDup(db, pLeft, 0);\n      pNew = sqlite3PExpr(pParse, TK_IN, pDup, 0, 0);\n      if( pNew ){\n        int idxNew;\n        transferJoinMarkings(pNew, pExpr);\n        assert( !ExprHasProperty(pNew, EP_xIsSelect) );\n        pNew->x.pList = pList;\n        idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);\n        testcase( idxNew==0 );\n        exprAnalyze(pSrc, pWC, idxNew);\n        pTerm = &pWC->a[idxTerm];\n        markTermAsChild(pWC, idxNew, idxTerm);\n      }else{\n        sqlite3ExprListDelete(db, pList);\n      }\n      pTerm->eOperator = WO_NOOP;  /* case 1 trumps case 3 */\n    }\n  }\n}\n#endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */\n\n/*\n** We already know that pExpr is a binary operator where both operands are\n** column references.  This routine checks to see if pExpr is an equivalence\n** relation:\n**   1.  The SQLITE_Transitive optimization must be enabled\n**   2.  Must be either an == or an IS operator\n**   3.  Not originating in the ON clause of an OUTER JOIN\n**   4.  The affinities of A and B must be compatible\n**   5a. Both operands use the same collating sequence OR\n**   5b. The overall collating sequence is BINARY\n** If this routine returns TRUE, that means that the RHS can be substituted\n** for the LHS anyplace else in the WHERE clause where the LHS column occurs.\n** This is an optimization.  No harm comes from returning 0.  But if 1 is\n** returned when it should not be, then incorrect answers might result.\n*/\nstatic int termIsEquivalence(Parse *pParse, Expr *pExpr){\n  char aff1, aff2;\n  CollSeq *pColl;\n  const char *zColl1, *zColl2;\n  if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0;\n  if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0;\n  if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0;\n  aff1 = sqlite3ExprAffinity(pExpr->pLeft);\n  aff2 = sqlite3ExprAffinity(pExpr->pRight);\n  if( aff1!=aff2\n   && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2))\n  ){\n    return 0;\n  }\n  pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);\n  if( pColl==0 || sqlite3StrICmp(pColl->zName, \"BINARY\")==0 ) return 1;\n  pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft);\n  zColl1 = pColl ? pColl->zName : 0;\n  pColl = sqlite3ExprCollSeq(pParse, pExpr->pRight);\n  zColl2 = pColl ? pColl->zName : 0;\n  return sqlite3_stricmp(zColl1, zColl2)==0;\n}\n\n/*\n** Recursively walk the expressions of a SELECT statement and generate\n** a bitmask indicating which tables are used in that expression\n** tree.\n*/\nstatic Bitmask exprSelectUsage(WhereMaskSet *pMaskSet, Select *pS){\n  Bitmask mask = 0;\n  while( pS ){\n    SrcList *pSrc = pS->pSrc;\n    mask |= sqlite3WhereExprListUsage(pMaskSet, pS->pEList);\n    mask |= sqlite3WhereExprListUsage(pMaskSet, pS->pGroupBy);\n    mask |= sqlite3WhereExprListUsage(pMaskSet, pS->pOrderBy);\n    mask |= sqlite3WhereExprUsage(pMaskSet, pS->pWhere);\n    mask |= sqlite3WhereExprUsage(pMaskSet, pS->pHaving);\n    if( ALWAYS(pSrc!=0) ){\n      int i;\n      for(i=0; i<pSrc->nSrc; i++){\n        mask |= exprSelectUsage(pMaskSet, pSrc->a[i].pSelect);\n        mask |= sqlite3WhereExprUsage(pMaskSet, pSrc->a[i].pOn);\n      }\n    }\n    pS = pS->pPrior;\n  }\n  return mask;\n}\n\n/*\n** Expression pExpr is one operand of a comparison operator that might\n** be useful for indexing.  This routine checks to see if pExpr appears\n** in any index.  Return TRUE (1) if pExpr is an indexed term and return\n** FALSE (0) if not.  If TRUE is returned, also set *piCur to the cursor\n** number of the table that is indexed and *piColumn to the column number\n** of the column that is indexed, or XN_EXPR (-2) if an expression is being\n** indexed.\n**\n** If pExpr is a TK_COLUMN column reference, then this routine always returns\n** true even if that particular column is not indexed, because the column\n** might be added to an automatic index later.\n*/\nstatic int exprMightBeIndexed(\n  SrcList *pFrom,        /* The FROM clause */\n  int op,                /* The specific comparison operator */\n  Bitmask mPrereq,       /* Bitmask of FROM clause terms referenced by pExpr */\n  Expr *pExpr,           /* An operand of a comparison operator */\n  int *piCur,            /* Write the referenced table cursor number here */\n  int *piColumn          /* Write the referenced table column number here */\n){\n  Index *pIdx;\n  int i;\n  int iCur;\n\n  /* If this expression is a vector to the left or right of a \n  ** inequality constraint (>, <, >= or <=), perform the processing \n  ** on the first element of the vector.  */\n  assert( TK_GT+1==TK_LE && TK_GT+2==TK_LT && TK_GT+3==TK_GE );\n  assert( TK_IS<TK_GE && TK_ISNULL<TK_GE && TK_IN<TK_GE );\n  assert( op<=TK_GE );\n  if( pExpr->op==TK_VECTOR && (op>=TK_GT && ALWAYS(op<=TK_GE)) ){\n    pExpr = pExpr->x.pList->a[0].pExpr;\n  }\n\n  if( pExpr->op==TK_COLUMN ){\n    *piCur = pExpr->iTable;\n    *piColumn = pExpr->iColumn;\n    return 1;\n  }\n  if( mPrereq==0 ) return 0;                 /* No table references */\n  if( (mPrereq&(mPrereq-1))!=0 ) return 0;   /* Refs more than one table */\n  for(i=0; mPrereq>1; i++, mPrereq>>=1){}\n  iCur = pFrom->a[i].iCursor;\n  for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){\n    if( pIdx->aColExpr==0 ) continue;\n    for(i=0; i<pIdx->nKeyCol; i++){\n      if( pIdx->aiColumn[i]!=XN_EXPR ) continue;\n      if( sqlite3ExprCompare(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){\n        *piCur = iCur;\n        *piColumn = XN_EXPR;\n        return 1;\n      }\n    }\n  }\n  return 0;\n}\n\n/*\n** The input to this routine is an WhereTerm structure with only the\n** \"pExpr\" field filled in.  The job of this routine is to analyze the\n** subexpression and populate all the other fields of the WhereTerm\n** structure.\n**\n** If the expression is of the form \"<expr> <op> X\" it gets commuted\n** to the standard form of \"X <op> <expr>\".\n**\n** If the expression is of the form \"X <op> Y\" where both X and Y are\n** columns, then the original expression is unchanged and a new virtual\n** term of the form \"Y <op> X\" is added to the WHERE clause and\n** analyzed separately.  The original term is marked with TERM_COPIED\n** and the new term is marked with TERM_DYNAMIC (because it's pExpr\n** needs to be freed with the WhereClause) and TERM_VIRTUAL (because it\n** is a commuted copy of a prior term.)  The original term has nChild=1\n** and the copy has idxParent set to the index of the original term.\n*/\nstatic void exprAnalyze(\n  SrcList *pSrc,            /* the FROM clause */\n  WhereClause *pWC,         /* the WHERE clause */\n  int idxTerm               /* Index of the term to be analyzed */\n){\n  WhereInfo *pWInfo = pWC->pWInfo; /* WHERE clause processing context */\n  WhereTerm *pTerm;                /* The term to be analyzed */\n  WhereMaskSet *pMaskSet;          /* Set of table index masks */\n  Expr *pExpr;                     /* The expression to be analyzed */\n  Bitmask prereqLeft;              /* Prerequesites of the pExpr->pLeft */\n  Bitmask prereqAll;               /* Prerequesites of pExpr */\n  Bitmask extraRight = 0;          /* Extra dependencies on LEFT JOIN */\n  Expr *pStr1 = 0;                 /* RHS of LIKE/GLOB operator */\n  int isComplete = 0;              /* RHS of LIKE/GLOB ends with wildcard */\n  int noCase = 0;                  /* uppercase equivalent to lowercase */\n  int op;                          /* Top-level operator.  pExpr->op */\n  Parse *pParse = pWInfo->pParse;  /* Parsing context */\n  sqlite3 *db = pParse->db;        /* Database connection */\n  unsigned char eOp2;              /* op2 value for LIKE/REGEXP/GLOB */\n\n  if( db->mallocFailed ){\n    return;\n  }\n  pTerm = &pWC->a[idxTerm];\n  pMaskSet = &pWInfo->sMaskSet;\n  pExpr = pTerm->pExpr;\n  assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE );\n  prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft);\n  op = pExpr->op;\n  if( op==TK_IN ){\n    assert( pExpr->pRight==0 );\n    if( sqlite3ExprCheckIN(pParse, pExpr) ) return;\n    if( ExprHasProperty(pExpr, EP_xIsSelect) ){\n      pTerm->prereqRight = exprSelectUsage(pMaskSet, pExpr->x.pSelect);\n    }else{\n      pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList);\n    }\n  }else if( op==TK_ISNULL ){\n    pTerm->prereqRight = 0;\n  }else{\n    pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);\n  }\n  prereqAll = sqlite3WhereExprUsage(pMaskSet, pExpr);\n  if( ExprHasProperty(pExpr, EP_FromJoin) ){\n    Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);\n    prereqAll |= x;\n    extraRight = x-1;  /* ON clause terms may not be used with an index\n                       ** on left table of a LEFT JOIN.  Ticket #3015 */\n  }\n  pTerm->prereqAll = prereqAll;\n  pTerm->leftCursor = -1;\n  pTerm->iParent = -1;\n  pTerm->eOperator = 0;\n  if( allowedOp(op) ){\n    int iCur, iColumn;\n    Expr *pLeft = sqlite3ExprSkipCollate(pExpr->pLeft);\n    Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight);\n    u16 opMask = (pTerm->prereqRight & prereqLeft)==0 ? WO_ALL : WO_EQUIV;\n\n    if( pTerm->iField>0 ){\n      assert( op==TK_IN );\n      assert( pLeft->op==TK_VECTOR );\n      pLeft = pLeft->x.pList->a[pTerm->iField-1].pExpr;\n    }\n\n    if( exprMightBeIndexed(pSrc, op, prereqLeft, pLeft, &iCur, &iColumn) ){\n      pTerm->leftCursor = iCur;\n      pTerm->u.leftColumn = iColumn;\n      pTerm->eOperator = operatorMask(op) & opMask;\n    }\n    if( op==TK_IS ) pTerm->wtFlags |= TERM_IS;\n    if( pRight \n     && exprMightBeIndexed(pSrc, op, pTerm->prereqRight, pRight, &iCur,&iColumn)\n    ){\n      WhereTerm *pNew;\n      Expr *pDup;\n      u16 eExtraOp = 0;        /* Extra bits for pNew->eOperator */\n      assert( pTerm->iField==0 );\n      if( pTerm->leftCursor>=0 ){\n        int idxNew;\n        pDup = sqlite3ExprDup(db, pExpr, 0);\n        if( db->mallocFailed ){\n          sqlite3ExprDelete(db, pDup);\n          return;\n        }\n        idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);\n        if( idxNew==0 ) return;\n        pNew = &pWC->a[idxNew];\n        markTermAsChild(pWC, idxNew, idxTerm);\n        if( op==TK_IS ) pNew->wtFlags |= TERM_IS;\n        pTerm = &pWC->a[idxTerm];\n        pTerm->wtFlags |= TERM_COPIED;\n\n        if( termIsEquivalence(pParse, pDup) ){\n          pTerm->eOperator |= WO_EQUIV;\n          eExtraOp = WO_EQUIV;\n        }\n      }else{\n        pDup = pExpr;\n        pNew = pTerm;\n      }\n      exprCommute(pParse, pDup);\n      pNew->leftCursor = iCur;\n      pNew->u.leftColumn = iColumn;\n      testcase( (prereqLeft | extraRight) != prereqLeft );\n      pNew->prereqRight = prereqLeft | extraRight;\n      pNew->prereqAll = prereqAll;\n      pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask;\n    }\n  }\n\n#ifndef SQLITE_OMIT_BETWEEN_OPTIMIZATION\n  /* If a term is the BETWEEN operator, create two new virtual terms\n  ** that define the range that the BETWEEN implements.  For example:\n  **\n  **      a BETWEEN b AND c\n  **\n  ** is converted into:\n  **\n  **      (a BETWEEN b AND c) AND (a>=b) AND (a<=c)\n  **\n  ** The two new terms are added onto the end of the WhereClause object.\n  ** The new terms are \"dynamic\" and are children of the original BETWEEN\n  ** term.  That means that if the BETWEEN term is coded, the children are\n  ** skipped.  Or, if the children are satisfied by an index, the original\n  ** BETWEEN term is skipped.\n  */\n  else if( pExpr->op==TK_BETWEEN && pWC->op==TK_AND ){\n    ExprList *pList = pExpr->x.pList;\n    int i;\n    static const u8 ops[] = {TK_GE, TK_LE};\n    assert( pList!=0 );\n    assert( pList->nExpr==2 );\n    for(i=0; i<2; i++){\n      Expr *pNewExpr;\n      int idxNew;\n      pNewExpr = sqlite3PExpr(pParse, ops[i], \n                             sqlite3ExprDup(db, pExpr->pLeft, 0),\n                             sqlite3ExprDup(db, pList->a[i].pExpr, 0), 0);\n      transferJoinMarkings(pNewExpr, pExpr);\n      idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);\n      testcase( idxNew==0 );\n      exprAnalyze(pSrc, pWC, idxNew);\n      pTerm = &pWC->a[idxTerm];\n      markTermAsChild(pWC, idxNew, idxTerm);\n    }\n  }\n#endif /* SQLITE_OMIT_BETWEEN_OPTIMIZATION */\n\n#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)\n  /* Analyze a term that is composed of two or more subterms connected by\n  ** an OR operator.\n  */\n  else if( pExpr->op==TK_OR ){\n    assert( pWC->op==TK_AND );\n    exprAnalyzeOrTerm(pSrc, pWC, idxTerm);\n    pTerm = &pWC->a[idxTerm];\n  }\n#endif /* SQLITE_OMIT_OR_OPTIMIZATION */\n\n#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION\n  /* Add constraints to reduce the search space on a LIKE or GLOB\n  ** operator.\n  **\n  ** A like pattern of the form \"x LIKE 'aBc%'\" is changed into constraints\n  **\n  **          x>='ABC' AND x<'abd' AND x LIKE 'aBc%'\n  **\n  ** The last character of the prefix \"abc\" is incremented to form the\n  ** termination condition \"abd\".  If case is not significant (the default\n  ** for LIKE) then the lower-bound is made all uppercase and the upper-\n  ** bound is made all lowercase so that the bounds also work when comparing\n  ** BLOBs.\n  */\n  if( pWC->op==TK_AND \n   && isLikeOrGlob(pParse, pExpr, &pStr1, &isComplete, &noCase)\n  ){\n    Expr *pLeft;       /* LHS of LIKE/GLOB operator */\n    Expr *pStr2;       /* Copy of pStr1 - RHS of LIKE/GLOB operator */\n    Expr *pNewExpr1;\n    Expr *pNewExpr2;\n    int idxNew1;\n    int idxNew2;\n    const char *zCollSeqName;     /* Name of collating sequence */\n    const u16 wtFlags = TERM_LIKEOPT | TERM_VIRTUAL | TERM_DYNAMIC;\n\n    pLeft = pExpr->x.pList->a[1].pExpr;\n    pStr2 = sqlite3ExprDup(db, pStr1, 0);\n\n    /* Convert the lower bound to upper-case and the upper bound to\n    ** lower-case (upper-case is less than lower-case in ASCII) so that\n    ** the range constraints also work for BLOBs\n    */\n    if( noCase && !pParse->db->mallocFailed ){\n      int i;\n      char c;\n      pTerm->wtFlags |= TERM_LIKE;\n      for(i=0; (c = pStr1->u.zToken[i])!=0; i++){\n        pStr1->u.zToken[i] = sqlite3Toupper(c);\n        pStr2->u.zToken[i] = sqlite3Tolower(c);\n      }\n    }\n\n    if( !db->mallocFailed ){\n      u8 c, *pC;       /* Last character before the first wildcard */\n      pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1];\n      c = *pC;\n      if( noCase ){\n        /* The point is to increment the last character before the first\n        ** wildcard.  But if we increment '@', that will push it into the\n        ** alphabetic range where case conversions will mess up the \n        ** inequality.  To avoid this, make sure to also run the full\n        ** LIKE on all candidate expressions by clearing the isComplete flag\n        */\n        if( c=='A'-1 ) isComplete = 0;\n        c = sqlite3UpperToLower[c];\n      }\n      *pC = c + 1;\n    }\n    zCollSeqName = noCase ? \"NOCASE\" : \"BINARY\";\n    pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);\n    pNewExpr1 = sqlite3PExpr(pParse, TK_GE,\n           sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName),\n           pStr1, 0);\n    transferJoinMarkings(pNewExpr1, pExpr);\n    idxNew1 = whereClauseInsert(pWC, pNewExpr1, wtFlags);\n    testcase( idxNew1==0 );\n    exprAnalyze(pSrc, pWC, idxNew1);\n    pNewExpr2 = sqlite3ExprDup(db, pLeft, 0);\n    pNewExpr2 = sqlite3PExpr(pParse, TK_LT,\n           sqlite3ExprAddCollateString(pParse,pNewExpr2,zCollSeqName),\n           pStr2, 0);\n    transferJoinMarkings(pNewExpr2, pExpr);\n    idxNew2 = whereClauseInsert(pWC, pNewExpr2, wtFlags);\n    testcase( idxNew2==0 );\n    exprAnalyze(pSrc, pWC, idxNew2);\n    pTerm = &pWC->a[idxTerm];\n    if( isComplete ){\n      markTermAsChild(pWC, idxNew1, idxTerm);\n      markTermAsChild(pWC, idxNew2, idxTerm);\n    }\n  }\n#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */\n\n#ifndef SQLITE_OMIT_VIRTUALTABLE\n  /* Add a WO_MATCH auxiliary term to the constraint set if the\n  ** current expression is of the form:  column MATCH expr.\n  ** This information is used by the xBestIndex methods of\n  ** virtual tables.  The native query optimizer does not attempt\n  ** to do anything with MATCH functions.\n  */\n  if( pWC->op==TK_AND && isMatchOfColumn(pExpr, &eOp2) ){\n    int idxNew;\n    Expr *pRight, *pLeft;\n    WhereTerm *pNewTerm;\n    Bitmask prereqColumn, prereqExpr;\n\n    pRight = pExpr->x.pList->a[0].pExpr;\n    pLeft = pExpr->x.pList->a[1].pExpr;\n    prereqExpr = sqlite3WhereExprUsage(pMaskSet, pRight);\n    prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft);\n    if( (prereqExpr & prereqColumn)==0 ){\n      Expr *pNewExpr;\n      pNewExpr = sqlite3PExpr(pParse, TK_MATCH, \n                              0, sqlite3ExprDup(db, pRight, 0), 0);\n      idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);\n      testcase( idxNew==0 );\n      pNewTerm = &pWC->a[idxNew];\n      pNewTerm->prereqRight = prereqExpr;\n      pNewTerm->leftCursor = pLeft->iTable;\n      pNewTerm->u.leftColumn = pLeft->iColumn;\n      pNewTerm->eOperator = WO_MATCH;\n      pNewTerm->eMatchOp = eOp2;\n      markTermAsChild(pWC, idxNew, idxTerm);\n      pTerm = &pWC->a[idxTerm];\n      pTerm->wtFlags |= TERM_COPIED;\n      pNewTerm->prereqAll = pTerm->prereqAll;\n    }\n  }\n#endif /* SQLITE_OMIT_VIRTUALTABLE */\n\n  /* If there is a vector == or IS term - e.g. \"(a, b) == (?, ?)\" - create\n  ** new terms for each component comparison - \"a = ?\" and \"b = ?\".  The\n  ** new terms completely replace the original vector comparison, which is\n  ** no longer used.\n  **\n  ** This is only required if at least one side of the comparison operation\n  ** is not a sub-select.  */\n  if( pWC->op==TK_AND \n  && (pExpr->op==TK_EQ || pExpr->op==TK_IS)\n  && sqlite3ExprIsVector(pExpr->pLeft)\n  && ( (pExpr->pLeft->flags & EP_xIsSelect)==0 \n    || (pExpr->pRight->flags & EP_xIsSelect)==0\n  )){\n    int nLeft = sqlite3ExprVectorSize(pExpr->pLeft);\n    int i;\n    assert( nLeft==sqlite3ExprVectorSize(pExpr->pRight) );\n    for(i=0; i<nLeft; i++){\n      int idxNew;\n      Expr *pNew;\n      Expr *pLeft = sqlite3ExprForVectorField(pParse, pExpr->pLeft, i);\n      Expr *pRight = sqlite3ExprForVectorField(pParse, pExpr->pRight, i);\n\n      pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight, 0);\n      transferJoinMarkings(pNew, pExpr);\n      idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC);\n      exprAnalyze(pSrc, pWC, idxNew);\n    }\n    pTerm = &pWC->a[idxTerm];\n    pTerm->wtFlags = TERM_CODED|TERM_VIRTUAL;  /* Disable the original */\n    pTerm->eOperator = 0;\n  }\n\n  /* If there is a vector IN term - e.g. \"(a, b) IN (SELECT ...)\" - create\n  ** a virtual term for each vector component. The expression object\n  ** used by each such virtual term is pExpr (the full vector IN(...) \n  ** expression). The WhereTerm.iField variable identifies the index within\n  ** the vector on the LHS that the virtual term represents.\n  **\n  ** This only works if the RHS is a simple SELECT, not a compound\n  */\n  if( pWC->op==TK_AND && pExpr->op==TK_IN && pTerm->iField==0\n   && pExpr->pLeft->op==TK_VECTOR\n   && pExpr->x.pSelect->pPrior==0\n  ){\n    int i;\n    for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){\n      int idxNew;\n      idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL);\n      pWC->a[idxNew].iField = i+1;\n      exprAnalyze(pSrc, pWC, idxNew);\n      markTermAsChild(pWC, idxNew, idxTerm);\n    }\n  }\n\n#ifdef SQLITE_ENABLE_STAT3_OR_STAT4\n  /* When sqlite_stat3 histogram data is available an operator of the\n  ** form \"x IS NOT NULL\" can sometimes be evaluated more efficiently\n  ** as \"x>NULL\" if x is not an INTEGER PRIMARY KEY.  So construct a\n  ** virtual term of that form.\n  **\n  ** Note that the virtual term must be tagged with TERM_VNULL.\n  */\n  if( pExpr->op==TK_NOTNULL\n   && pExpr->pLeft->op==TK_COLUMN\n   && pExpr->pLeft->iColumn>=0\n   && OptimizationEnabled(db, SQLITE_Stat34)\n  ){\n    Expr *pNewExpr;\n    Expr *pLeft = pExpr->pLeft;\n    int idxNew;\n    WhereTerm *pNewTerm;\n\n    pNewExpr = sqlite3PExpr(pParse, TK_GT,\n                            sqlite3ExprDup(db, pLeft, 0),\n                            sqlite3ExprAlloc(db, TK_NULL, 0, 0), 0);\n\n    idxNew = whereClauseInsert(pWC, pNewExpr,\n                              TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL);\n    if( idxNew ){\n      pNewTerm = &pWC->a[idxNew];\n      pNewTerm->prereqRight = 0;\n      pNewTerm->leftCursor = pLeft->iTable;\n      pNewTerm->u.leftColumn = pLeft->iColumn;\n      pNewTerm->eOperator = WO_GT;\n      markTermAsChild(pWC, idxNew, idxTerm);\n      pTerm = &pWC->a[idxTerm];\n      pTerm->wtFlags |= TERM_COPIED;\n      pNewTerm->prereqAll = pTerm->prereqAll;\n    }\n  }\n#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */\n\n  /* Prevent ON clause terms of a LEFT JOIN from being used to drive\n  ** an index for tables to the left of the join.\n  */\n  testcase( pTerm!=&pWC->a[idxTerm] );\n  pTerm = &pWC->a[idxTerm];\n  pTerm->prereqRight |= extraRight;\n}\n\n/***************************************************************************\n** Routines with file scope above.  Interface to the rest of the where.c\n** subsystem follows.\n***************************************************************************/\n\n/*\n** This routine identifies subexpressions in the WHERE clause where\n** each subexpression is separated by the AND operator or some other\n** operator specified in the op parameter.  The WhereClause structure\n** is filled with pointers to subexpressions.  For example:\n**\n**    WHERE  a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22)\n**           \\________/     \\_______________/     \\________________/\n**            slot[0]            slot[1]               slot[2]\n**\n** The original WHERE clause in pExpr is unaltered.  All this routine\n** does is make slot[] entries point to substructure within pExpr.\n**\n** In the previous sentence and in the diagram, \"slot[]\" refers to\n** the WhereClause.a[] array.  The slot[] array grows as needed to contain\n** all terms of the WHERE clause.\n*/\nvoid sqlite3WhereSplit(WhereClause *pWC, Expr *pExpr, u8 op){\n  Expr *pE2 = sqlite3ExprSkipCollate(pExpr);\n  pWC->op = op;\n  if( pE2==0 ) return;\n  if( pE2->op!=op ){\n    whereClauseInsert(pWC, pExpr, 0);\n  }else{\n    sqlite3WhereSplit(pWC, pE2->pLeft, op);\n    sqlite3WhereSplit(pWC, pE2->pRight, op);\n  }\n}\n\n/*\n** Initialize a preallocated WhereClause structure.\n*/\nvoid sqlite3WhereClauseInit(\n  WhereClause *pWC,        /* The WhereClause to be initialized */\n  WhereInfo *pWInfo        /* The WHERE processing context */\n){\n  pWC->pWInfo = pWInfo;\n  pWC->pOuter = 0;\n  pWC->nTerm = 0;\n  pWC->nSlot = ArraySize(pWC->aStatic);\n  pWC->a = pWC->aStatic;\n}\n\n/*\n** Deallocate a WhereClause structure.  The WhereClause structure\n** itself is not freed.  This routine is the inverse of\n** sqlite3WhereClauseInit().\n*/\nvoid sqlite3WhereClauseClear(WhereClause *pWC){\n  int i;\n  WhereTerm *a;\n  sqlite3 *db = pWC->pWInfo->pParse->db;\n  for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){\n    if( a->wtFlags & TERM_DYNAMIC ){\n      sqlite3ExprDelete(db, a->pExpr);\n    }\n    if( a->wtFlags & TERM_ORINFO ){\n      whereOrInfoDelete(db, a->u.pOrInfo);\n    }else if( a->wtFlags & TERM_ANDINFO ){\n      whereAndInfoDelete(db, a->u.pAndInfo);\n    }\n  }\n  if( pWC->a!=pWC->aStatic ){\n    sqlite3DbFree(db, pWC->a);\n  }\n}\n\n\n/*\n** These routines walk (recursively) an expression tree and generate\n** a bitmask indicating which tables are used in that expression\n** tree.\n*/\nBitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){\n  Bitmask mask;\n  if( p==0 ) return 0;\n  if( p->op==TK_COLUMN ){\n    mask = sqlite3WhereGetMask(pMaskSet, p->iTable);\n    return mask;\n  }\n  assert( !ExprHasProperty(p, EP_TokenOnly) );\n  mask = p->pRight ? sqlite3WhereExprUsage(pMaskSet, p->pRight) : 0;\n  if( p->pLeft ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pLeft);\n  if( ExprHasProperty(p, EP_xIsSelect) ){\n    mask |= exprSelectUsage(pMaskSet, p->x.pSelect);\n  }else if( p->x.pList ){\n    mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList);\n  }\n  return mask;\n}\nBitmask sqlite3WhereExprListUsage(WhereMaskSet *pMaskSet, ExprList *pList){\n  int i;\n  Bitmask mask = 0;\n  if( pList ){\n    for(i=0; i<pList->nExpr; i++){\n      mask |= sqlite3WhereExprUsage(pMaskSet, pList->a[i].pExpr);\n    }\n  }\n  return mask;\n}\n\n\n/*\n** Call exprAnalyze on all terms in a WHERE clause.  \n**\n** Note that exprAnalyze() might add new virtual terms onto the\n** end of the WHERE clause.  We do not want to analyze these new\n** virtual terms, so start analyzing at the end and work forward\n** so that the added virtual terms are never processed.\n*/\nvoid sqlite3WhereExprAnalyze(\n  SrcList *pTabList,       /* the FROM clause */\n  WhereClause *pWC         /* the WHERE clause to be analyzed */\n){\n  int i;\n  for(i=pWC->nTerm-1; i>=0; i--){\n    exprAnalyze(pTabList, pWC, i);\n  }\n}\n\n/*\n** For table-valued-functions, transform the function arguments into\n** new WHERE clause terms.  \n**\n** Each function argument translates into an equality constraint against\n** a HIDDEN column in the table.\n*/\nvoid sqlite3WhereTabFuncArgs(\n  Parse *pParse,                    /* Parsing context */\n  struct SrcList_item *pItem,       /* The FROM clause term to process */\n  WhereClause *pWC                  /* Xfer function arguments to here */\n){\n  Table *pTab;\n  int j, k;\n  ExprList *pArgs;\n  Expr *pColRef;\n  Expr *pTerm;\n  if( pItem->fg.isTabFunc==0 ) return;\n  pTab = pItem->pTab;\n  assert( pTab!=0 );\n  pArgs = pItem->u1.pFuncArg;\n  if( pArgs==0 ) return;\n  for(j=k=0; j<pArgs->nExpr; j++){\n    while( k<pTab->nCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){k++;}\n    if( k>=pTab->nCol ){\n      sqlite3ErrorMsg(pParse, \"too many arguments on %s() - max %d\",\n                      pTab->zName, j);\n      return;\n    }\n    pColRef = sqlite3ExprAlloc(pParse->db, TK_COLUMN, 0, 0);\n    if( pColRef==0 ) return;\n    pColRef->iTable = pItem->iCursor;\n    pColRef->iColumn = k++;\n    pColRef->pTab = pTab;\n    pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef,\n                         sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);\n    whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);\n  }\n}\n"
  },
  {
    "path": "JetChat/Pods/WCDBOptimizedSQLCipher.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t043ACCF720B9550BAFD6A6FFC74D58D8 /* complete.c in Sources */ = {isa = PBXBuildFile; fileRef = 6683F04D8CD90EC04E0E87DCE3FF3280 /* complete.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t04BA00A7CE0C6399CB530F18AB3A1177 /* rtree.h in Headers */ = {isa = PBXBuildFile; fileRef = B1EAC7A7AF46ED7FBE04D6DE7F8FC930 /* rtree.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t04F059E7EC3B21B0AE7AA8CC2AFA97A4 /* vdbesort.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B83A3E54D5945DFE0DF9326F6ED5DCA /* vdbesort.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t086ECBBBF3BCC1A6B81D5EF1D70C8A7F /* analyze.c in Sources */ = {isa = PBXBuildFile; fileRef = E3E04C018AB0C4D4950420528F2FA36E /* analyze.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t09544F9659FB1F6405E61B616127BA78 /* fts3_expr.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BEC902D9608DC5DEB728AA1110B2E4E /* fts3_expr.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t0DA5A38897211085AF6EF8F48509A35B /* fts3_tokenize_vtab.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DE42EE18C7CFB26E84176CFFBF683D7 /* fts3_tokenize_vtab.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t0EA8935B3590163C3C877E3A1C61E49F /* rtree.c in Sources */ = {isa = PBXBuildFile; fileRef = DFBF969F4926C2B5F81BAAA17226DDB8 /* rtree.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t11EF509CC714D5FEE1DFCDB1EB44398E /* os_wcdb.h in Headers */ = {isa = PBXBuildFile; fileRef = 7421BE18E75BB2A9FBA21BE93F40E676 /* os_wcdb.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t134E6A8F537AF5F24136750B077D6822 /* opcodes.c in Sources */ = {isa = PBXBuildFile; fileRef = 33721E5127EBCDD8CE2031FA79291E20 /* opcodes.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t1483A839D1A617764155CE3A5AE53BBC /* fts3.h in Headers */ = {isa = PBXBuildFile; fileRef = 614C7D5150BDB418C2738FD6D2762D06 /* fts3.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t14B9EC7F7EA64329D2A91453A50F1128 /* vdbe.h in Headers */ = {isa = PBXBuildFile; fileRef = F7959D92A198DB710BD43F6955752638 /* vdbe.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t16FF60E261C45FC2070F0D98E736A57A /* fault.c in Sources */ = {isa = PBXBuildFile; fileRef = 332F03A91E83E44B4A7B66A224BE32AE /* fault.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t17A30843D8D9CED76363E7C3CEF162C4 /* func.c in Sources */ = {isa = PBXBuildFile; fileRef = 1F03A49E4F89E1CF680296FBC1DEF957 /* func.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t1889A9404CD0C0E28CC9920FD937E3AF /* fts3_tokenizer.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C18318F324A10A734F5443B6104BFA0 /* fts3_tokenizer.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t1966AF6E2CE98291977D8E52DF5740AB /* fts3_tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0735CA49080D749DFB1D4012410F7256 /* fts3_tokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t19CFB0C5051700285570D5FB2077FD76 /* sqliteicu.h in Headers */ = {isa = PBXBuildFile; fileRef = 648363999E9638887D84B3919BC056FD /* sqliteicu.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t1BDEB5F15FAF45E9F721B441961B8C34 /* fkey.c in Sources */ = {isa = PBXBuildFile; fileRef = 0AD7D0377FDB77F1561846685D59B53E /* fkey.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t1BEBE236DCFE7DB5BFAE45E6BC9789D0 /* vdbe.c in Sources */ = {isa = PBXBuildFile; fileRef = 6250266A11D2A613F08EDB067DA029CF /* vdbe.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t1DAA571F6004AC252CA41DFE13A161CB /* crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 988051A9013C8F38137003BA3832E71B /* crypto.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t2022F1EECECCE719EC30543112A168E4 /* opcodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DD3DA7D95B631FBD51FC6C0D876B26D /* opcodes.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t217AB62C5B931789431ABED1AA6CCE3D /* malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 935B30A328C84E8A46E0D1B74EF58ABE /* malloc.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t24A589CE392D5D18C6BEC3A0B7C783D6 /* bitvec.c in Sources */ = {isa = PBXBuildFile; fileRef = 937FD3C2AEF0BC415017C360470E148B /* bitvec.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t2912D7785B90B909F2146257B43E0AB0 /* fts3_hash.c in Sources */ = {isa = PBXBuildFile; fileRef = D3240BA27F9C0921364220F327356317 /* fts3_hash.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t2A4B692D0B2FC5CF4DD1911B12F64908 /* icu.c in Sources */ = {isa = PBXBuildFile; fileRef = 430EFE90AE7FFE25848EAC2B606F3E76 /* icu.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t2B78928D029F702E10AC2E979AAE30F4 /* expr.c in Sources */ = {isa = PBXBuildFile; fileRef = 06448EF0069122331E01D59733FF9A7F /* expr.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t2C00E9D43090AFC189BD478A56118EFD /* wherecode.c in Sources */ = {isa = PBXBuildFile; fileRef = C05BA11F543AE011C05ECC38E1401762 /* wherecode.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t2DD2F6A4BEBDC14176696B9BD40E1000 /* crypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C65C29C60F0356FDD1C6DEC5757ACAD /* crypto.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t2FC562B90F631F8FFBFCA8130C53AF9B /* vdbemem.c in Sources */ = {isa = PBXBuildFile; fileRef = 29EFDDE9D7A02F3681864BAC8181D379 /* vdbemem.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t313FB26D8BA160E88D509EFC47311DCB /* wal.c in Sources */ = {isa = PBXBuildFile; fileRef = DBF27EA851EE9B248F054D3C373FDEB2 /* wal.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t317CA528BF1CC438A0713877CC54DF7C /* tokenize.c in Sources */ = {isa = PBXBuildFile; fileRef = D4D4AC471AA7E21D2FD210E58D4C299D /* tokenize.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t347CD1BB4A6B56F555E349847EFA2541 /* WCDBOptimizedSQLCipher-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F6B6C940C90CB04F6C891C17D90BE5C0 /* WCDBOptimizedSQLCipher-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3796A5DFBC47658BC7E86A958E8F37C1 /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = A8E0FD8FC7DD16DE7DF0EDC9C64E1BCE /* hash.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t37D869D1E39E0F6980A26FFD9F50D730 /* pager.c in Sources */ = {isa = PBXBuildFile; fileRef = 79AE7202D5ABF67E998D050FDAFE17E7 /* pager.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t382AF1D5DEE1F6873D6560D11F960694 /* btmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BA02A79F75C5F78A60803AD455AEB96 /* btmutex.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t399ED801CB4CDA1F34BDE41E96F7A7A6 /* queue.h in Headers */ = {isa = PBXBuildFile; fileRef = E8B4DDA2AA8F96828863CB4860544C13 /* queue.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t3AF960E0330666382269BD45A5B62948 /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = B9F0667481991942E44FA6D8F5EEA737 /* random.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t3B74E52618782846004B2EFFE66D2CB6 /* crypto_libtomcrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D0906AFCA034B3D06A1B28951BF9D86 /* crypto_libtomcrypt.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t3DE6A7FA6CC2C6A20F8585F2CC610DD9 /* parse.h in Headers */ = {isa = PBXBuildFile; fileRef = 064BC0EFC3942E7E6791FBDA19097410 /* parse.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t3E8DB8B452854518706AC210252D5D5B /* mem0.c in Sources */ = {isa = PBXBuildFile; fileRef = 07B0B0B9BF3995F9F30AE9AE478F8761 /* mem0.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t3EB317C1027FB4897697E355AF8D16B5 /* fts3_porter.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D3F68564E96D6C649CB902905B9701A /* fts3_porter.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t4398BFDCE042AB0B217F9EE1D4470D2C /* btree.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C296E85EF0CA139EC37484FFBE6766F /* btree.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t45546860F2D6F0C848B158A81F5EECF3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCC92FB1C24C7CDCC7D17F051008EE0A /* Foundation.framework */; };\n\t\t4592021AD89CB345F6F8E22FA791C624 /* sqlite3ext.h in Headers */ = {isa = PBXBuildFile; fileRef = CD2CCFCCB0AE0CC0490DEF036F7612E1 /* sqlite3ext.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t4AF7AE5D6EF14A134D288C5D5C4E2D61 /* printf.c in Sources */ = {isa = PBXBuildFile; fileRef = 652DFC6FD9E28742FD37A607B3CB11D3 /* printf.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t4FDA56F70439EC006671D85893F10A4B /* pager.h in Headers */ = {isa = PBXBuildFile; fileRef = F9E6356B79A88B87FCBD8D4D4545D3EC /* pager.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t5138758EA23D8FA509240C4824D3C43A /* vdbetrace.c in Sources */ = {isa = PBXBuildFile; fileRef = B52F5BE4DEA26D2CE095BEFAFDDA8211 /* vdbetrace.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t5153DAF164ED49C5CA0EAF1D0EB07982 /* pragma.h in Headers */ = {isa = PBXBuildFile; fileRef = E6528DAE57C35C6E98F32918EE2DC03B /* pragma.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t52AB1BAF4304384AC31E0AC01F5218C1 /* crypto_cc.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C9926DCD9700CAA25779D0F3D0BF2DF /* crypto_cc.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t538C1DF20605C513C9F5A8A4A0562A67 /* mem3.c in Sources */ = {isa = PBXBuildFile; fileRef = A44FC13886FE6C9F4A77B833FD7B705D /* mem3.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t551B871170EE741873DB5C3C321C831C /* fts3_hash.h in Headers */ = {isa = PBXBuildFile; fileRef = 3138B008FE8FDC6E5895BB0D9A4B0BBD /* fts3_hash.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t55DCF375BF50253400A95667292806E7 /* vacuum.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CFC230C280191213CA1F7CC9EDBC /* vacuum.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t58A7E8A33CF3CF5F9356776AFA532391 /* treeview.c in Sources */ = {isa = PBXBuildFile; fileRef = AF74746F0F7096FF27C6C34DA0A82C2A /* treeview.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t5965867CE49B7065EFAA266994DFD908 /* os.h in Headers */ = {isa = PBXBuildFile; fileRef = F4D2C2116F3663C0BF0983B62CE86754 /* os.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t5A0203D022723665B0AA4EE0CFAA1457 /* sqliteLimit.h in Headers */ = {isa = PBXBuildFile; fileRef = F799F50D34DF99963433DA8BA939A1EB /* sqliteLimit.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t5AD212A59EFC714B69C84CC43E7CB3FF /* util.c in Sources */ = {isa = PBXBuildFile; fileRef = BC645A6F49D3C0ABAC257798ABCDF6BE /* util.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t5C71CBFFD72CBA17837586C1AAFB7D77 /* loadext.c in Sources */ = {isa = PBXBuildFile; fileRef = 58BAD830CEE9D3F881A3C0C6CCB908B7 /* loadext.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t5F77D36A58EE05E8BF389B3FB5DC9CA8 /* sqlite3userauth.h in Headers */ = {isa = PBXBuildFile; fileRef = CE889954D3F29D5E844A4BF7A3BF070C /* sqlite3userauth.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t5FBF1CB5E45D7007F9DBB64C53CD07C4 /* callback.c in Sources */ = {isa = PBXBuildFile; fileRef = 051B73102DA7614F09712D04AE68B33B /* callback.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t5FE3EA8A43323CA4A27E46E76B8F85E8 /* dbstat.c in Sources */ = {isa = PBXBuildFile; fileRef = F7F149752D910BF4FF892F4E9CE06CE4 /* dbstat.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t62D1D1C09F422BDE0C84B09E35A6CF15 /* mutex_wcdb.h in Headers */ = {isa = PBXBuildFile; fileRef = ACFCD540FAFB582780477DE2CA22CF4C /* mutex_wcdb.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t65E253F98D1812924AA7C3B8626EE044 /* fts3_write.c in Sources */ = {isa = PBXBuildFile; fileRef = 86E06BABCE715EA98BF4E2EAAFAB4D86 /* fts3_write.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t6B9C2AB81C98C177A776BE6A4EA2A6BD /* fts3_tokenizer1.c in Sources */ = {isa = PBXBuildFile; fileRef = 0C9E70EDC5462D6E02AA2BBBED913A01 /* fts3_tokenizer1.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t6BA80ECFA75D7799B0E63205FCFEA034 /* resolve.c in Sources */ = {isa = PBXBuildFile; fileRef = E4339CF5A192B80F4A550516D28B110C /* resolve.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t6D0347EB4716F42F268315B7ACB811E2 /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = E40B804D878D8F0B4374971749F23E75 /* hash.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t6DB2C6F2DD31603E9394E7E1C2B6F14C /* fts5.h in Headers */ = {isa = PBXBuildFile; fileRef = BF4119822AE3DB6E86C3706D5B20E90A /* fts5.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t6ED4783C9F5B4A1288799E59B6A9BE3F /* keywordhash.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE6879425105DD5FD3421F04CD274F3 /* keywordhash.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t70B138ADAF3ED65D826BB775062E45D3 /* alter.c in Sources */ = {isa = PBXBuildFile; fileRef = BDA214F3C3961648F8BC817A89964F5A /* alter.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t713F875F484933076CC14508AE206381 /* legacy.c in Sources */ = {isa = PBXBuildFile; fileRef = 51E3496EE7A697BEA1642D0035041F00 /* legacy.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t71FFCD64370877D3180086B00EDA7767 /* whereexpr.c in Sources */ = {isa = PBXBuildFile; fileRef = DA4C36C58BE099887836F305DA416295 /* whereexpr.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t74BF8A62A6C4634264C0778AE2432DB7 /* fts5.c in Sources */ = {isa = PBXBuildFile; fileRef = 9A22E03EDEC2A804E9278E46C8076B2B /* fts5.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t74F652B131BFEC3B7E9F5F826285F51F /* auth.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A849DC38A95BB617820DACC73B79A3D /* auth.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t75FD788B8B65A957BC3CB344744B94F0 /* backup.c in Sources */ = {isa = PBXBuildFile; fileRef = ED19BA196E09A040A675BB85687D5494 /* backup.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t764C4513049DD17FA6F13BBEAD9FC9EF /* trigger.c in Sources */ = {isa = PBXBuildFile; fileRef = 434E0A57323051116C8BDA321D1BEF1E /* trigger.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t765E8BDC962AC8D57C0AF8C184764B16 /* mutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 67614F219C94B57C08C94B88DC79C6EA /* mutex.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t7722FBBFC63A4E5AED68E36EAD692601 /* vxworks.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C5371BE2D6CCE1F9C843ABF29DAB76C /* vxworks.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t7731A5E7A6661574BBE900C1B94F3C74 /* mutex_noop.c in Sources */ = {isa = PBXBuildFile; fileRef = 5876D67954434637C1B748FA1A5BC120 /* mutex_noop.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t7FD9C2C40137E5249F861A39745DC58A /* msvc.h in Headers */ = {isa = PBXBuildFile; fileRef = 410FFC5A8B151D55632D11252852B205 /* msvc.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t80F23ACEC34F28241FC4D3D988D6B46B /* fts3_aux.c in Sources */ = {isa = PBXBuildFile; fileRef = 2C4ACC76635AA847C9B3B244532B426D /* fts3_aux.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t84AA63B938B22245F5E0DD20C3C0BE31 /* memjournal.c in Sources */ = {isa = PBXBuildFile; fileRef = FE0F6CB5A17E7C90E432D802B2613CCD /* memjournal.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t8597A704713FE849EDC4F865D0308F20 /* pragma.c in Sources */ = {isa = PBXBuildFile; fileRef = 268526B7747CDA4DB11F20E7B43C4D67 /* pragma.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t86FACB3B0DDC8ABB05745865EB4A80C5 /* threads.c in Sources */ = {isa = PBXBuildFile; fileRef = 812FAC9B927A9F72B9D7EEE4104098E2 /* threads.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t87097E871B2AD28F09D62F4F9C81C5F8 /* btree.h in Headers */ = {isa = PBXBuildFile; fileRef = C421913B61AC7DF8E8FA629A1D16CD15 /* btree.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\t887ECB05F844B509135EA9D2E49F4756 /* fts3.c in Sources */ = {isa = PBXBuildFile; fileRef = 963BFFE171D2389EFA4CA38E7F6866C5 /* fts3.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t8CB34315414362CE2CBE833F78B83BEB /* vtab.c in Sources */ = {isa = PBXBuildFile; fileRef = 037CDEB54E85EE1B28EDD8159C734B45 /* vtab.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t8F7859BA3E438C8D535351CAA04A87CF /* crypto_impl.c in Sources */ = {isa = PBXBuildFile; fileRef = 97544068E139CE57CB497F77DA42BE68 /* crypto_impl.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9161FDA5D85B4A8AC166C82958AB19A3 /* queue.c in Sources */ = {isa = PBXBuildFile; fileRef = E8283293458668B10491F7230969E33C /* queue.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9712E69F6897A79932E7356D17B4EFE6 /* ctime.c in Sources */ = {isa = PBXBuildFile; fileRef = B5FF0B3176815EA968515AD731B9B9A5 /* ctime.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9A0AF04C08614AE039C0FB82ABD4BBC4 /* status.c in Sources */ = {isa = PBXBuildFile; fileRef = 67229A14035C3C0B744AE45548552E4E /* status.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9A6164C6B81251208E9F0FE10456E077 /* update.c in Sources */ = {isa = PBXBuildFile; fileRef = 833CF18208052150B7CD6989FDFCA599 /* update.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9AF5EC6809F417A9E0456A01BDA1858A /* prepare.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DA4E8245FB21C4FB6A9100588D083F6 /* prepare.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9C456714EC7C859B2AC0A0C4DD11A6A6 /* vdbeaux.c in Sources */ = {isa = PBXBuildFile; fileRef = 88D3E044C2500DB71F81E810675651CA /* vdbeaux.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9D40AEE536FBB1086E7A28F011555C0F /* where.c in Sources */ = {isa = PBXBuildFile; fileRef = 363EF9BAE5E022AE8DA61E8264983AD7 /* where.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9D8EEF819AE4F032C407DF8825BE4021 /* build.c in Sources */ = {isa = PBXBuildFile; fileRef = 119A45534E96C88ED7B76FE6BCC431F2 /* build.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\t9F555968582C15676E557DD7E70835E6 /* sqlite3rtree.h in Headers */ = {isa = PBXBuildFile; fileRef = 721F3987C9416E44CE047814AF9E72A0 /* sqlite3rtree.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tA0AE1B4EC430BA422074318CDB5FE6BB /* os_common.h in Headers */ = {isa = PBXBuildFile; fileRef = ECAF30D20A8E2E10CEE3406FF7F16271 /* os_common.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tA0C4CA370E50E4C8643B99A883633888 /* fts3_snippet.c in Sources */ = {isa = PBXBuildFile; fileRef = 91C067E0DFAE68F8850F58EC0F2B2252 /* fts3_snippet.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tA1D8FEA6430105CF9244B8E3A1BECAB8 /* mutex_unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 59183CD5CE32B871F04D3A2232CA9DA1 /* mutex_unix.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tA382A069E6448B2E11A7C50E5446074C /* sqlite3rbu.c in Sources */ = {isa = PBXBuildFile; fileRef = 60137F151FAFC508CF9FDA5AAD727E8E /* sqlite3rbu.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tA40BFF6BD5669424AC49EC8955A286CB /* mem1.c in Sources */ = {isa = PBXBuildFile; fileRef = 7B2254DAC1994EE4C3E4B98FCF083BE9 /* mem1.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tA5CA0C886F0E55B268DC2B44FFA29B91 /* global.c in Sources */ = {isa = PBXBuildFile; fileRef = 1161EDC5D1F0A7CA57305FDCD3279A09 /* global.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tA62210DEF0CC8CF10EAA3F8F16B05279 /* os_wcdb.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D3F4D00FA5869044370CB594FAFE517 /* os_wcdb.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tA709CA20697CFE7AD211C104C1A25311 /* sqlite3.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E6DD04944FA96933CAF6A3C369243CC /* sqlite3.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tAA92C333BFF068784E18D0451D9E0AD2 /* os_unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 40EE6BB1D61FA507A23E2F815C9C4D71 /* os_unix.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tAB25F7CFB8368321F424C8F0D774704D /* sqliteInt.h in Headers */ = {isa = PBXBuildFile; fileRef = 4608DDFE819BC7159E4BE28E930A2D96 /* sqliteInt.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tB313B64B2E44469D53564BB76B35C24D /* os_setup.h in Headers */ = {isa = PBXBuildFile; fileRef = 4747A56CBD10A368FCE4155574E05007 /* os_setup.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tB32C03E8A710DAABFD445B2607751C90 /* insert.c in Sources */ = {isa = PBXBuildFile; fileRef = 3266B95CB618DDEBF6EE6B85D3053762 /* insert.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tB6F600ACB50C3D912C85966583C74948 /* vdbeblob.c in Sources */ = {isa = PBXBuildFile; fileRef = 792664979E7BB9EDF51497470E314406 /* vdbeblob.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tB9ADE4C107A282EA32728A9CCF0E2B51 /* os.c in Sources */ = {isa = PBXBuildFile; fileRef = 85B4278035197B9BA14D7AE1965CEE78 /* os.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tBCD534F6AE3C303AB71FCDBDE6BADF1C /* mem5.c in Sources */ = {isa = PBXBuildFile; fileRef = B39A54986C07C15C6A56D94ABE7EDCE6 /* mem5.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tBF1B9921683E1CC9CCE92CB100353180 /* utf.c in Sources */ = {isa = PBXBuildFile; fileRef = 9662B31D1314BF5B3A816AB022018B73 /* utf.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tC01F82CB0A1EFF2E5424110900541504 /* pcache1.c in Sources */ = {isa = PBXBuildFile; fileRef = 72141657F7470A253FFE8EC3A2E221CF /* pcache1.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tC0EA54E3A77CD32A4EB26558ED1C7048 /* date.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D3C5D6B4D0CB3269DD2F25494B202A5 /* date.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tC2A65020803D52D93AE0EBBB726791AF /* sqlcipher.h in Headers */ = {isa = PBXBuildFile; fileRef = C3D2C5D94972302516CD7888DA120573 /* sqlcipher.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tC4B693D99CC1E421C3651237D253713A /* delete.c in Sources */ = {isa = PBXBuildFile; fileRef = A85408398505911C8994916B87FEFACD /* delete.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tC5DF43B3246A45C92CA9F65206225D08 /* select.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D0A9FF88112D00242615E4FB9316C04 /* select.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tC62DF52D484AC2F663A46065A64AFF38 /* parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 601F513D436E64AE9FD9F356F59A79AD /* parse.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tC84A95A97D76FB1DFE9C5520BA57FC03 /* walker.c in Sources */ = {isa = PBXBuildFile; fileRef = 5527C34563A66DC7C6C68E526EE532E6 /* walker.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tC92DD37DC9E13597C5F74A0E9F91961E /* WCDBOptimizedSQLCipher-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = A0B3B6B3B7652EAC5FD7F2315D1D0755 /* WCDBOptimizedSQLCipher-dummy.m */; };\n\t\tD15097F68A356C28CE0BF9C91B637499 /* fts3_unicode2.c in Sources */ = {isa = PBXBuildFile; fileRef = 89ED719BA8FB0FF2AE366D3CF1E07781 /* fts3_unicode2.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tD1D9C0F63980292F29C3F37D63BDF176 /* fts3_unicode.c in Sources */ = {isa = PBXBuildFile; fileRef = 751A683F5B939E7F841A6D8AE4EB35EF /* fts3_unicode.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tD20DF4AFA08F00F6F3DF98080DA8482D /* fts3_icu.c in Sources */ = {isa = PBXBuildFile; fileRef = 933DEBE621531EC2E02EC9A1E2E984B7 /* fts3_icu.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tD293BCC1F74D1EB76F2C3503F0785E77 /* pcache.c in Sources */ = {isa = PBXBuildFile; fileRef = E57491323FA1027B616668C854DB4003 /* pcache.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tDCDEAA79E5FE0F51FB280AAE91E7B173 /* vdbeapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 62C4E94D0175D65F1A756AD8DC11D2F3 /* vdbeapi.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tDD0AB85D1155539ED44EC58E46B911F2 /* vdbeInt.h in Headers */ = {isa = PBXBuildFile; fileRef = 6DD39E990CAB71140927BCE3C1ACAB07 /* vdbeInt.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tDD8FC9551094218E1A8906573848253E /* sqlite3rbu.h in Headers */ = {isa = PBXBuildFile; fileRef = D4A23558E0D15744A3ABBEB74E853EF3 /* sqlite3rbu.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tDDB1A36186F1E71A78104E6E40D82947 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0C6762D778B68F84BC714555F7CFA7E /* Security.framework */; };\n\t\tDE24A6D9B09B99F115743263D13D0EF5 /* wal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E681F6C89E26DC10771AB5339F6F39F /* wal.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tDE4FE7FFE0E76D26AAE1422BE081AF1C /* pcache.h in Headers */ = {isa = PBXBuildFile; fileRef = 3050610B9FCFF83FF44C5BC79015B1DD /* pcache.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tDE6C09FEBBE6D09776A4CDE50F885880 /* rowset.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E5AEEE9D0649E6EBE841FF6125A23D7 /* rowset.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tE3067F40706E44F7014E85624D401F4B /* fts3Int.h in Headers */ = {isa = PBXBuildFile; fileRef = 39046DCAF954DAE3A5386478EE30834E /* fts3Int.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tE48632504681F1CA5D2B9BF3EDB9C9F2 /* notify.c in Sources */ = {isa = PBXBuildFile; fileRef = 44910D058B0DC1DB4A92A59DA20A1FA6 /* notify.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tE772C17070128A166AFC702F1956E364 /* mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 636D68D6EF5C0F6763D7A09ECDB9537A /* mutex.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tE8CFBAC39BFBA9072D76EFD8BED71021 /* attach.c in Sources */ = {isa = PBXBuildFile; fileRef = A8E3FBFB1CE731B6506195E943C61FF7 /* attach.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tE980E1084A188A7F6318F23BAE741750 /* mutex_wcdb.c in Sources */ = {isa = PBXBuildFile; fileRef = 66AFC381737A5011928540E8B5E4BB16 /* mutex_wcdb.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tE9D23397E76C36DF3AA3B68846F8192A /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = F5728CBED975DB579A9AEFA056DB7AFA /* table.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tF491F71196A41A6CEE970C0F76C1EB85 /* whereInt.h in Headers */ = {isa = PBXBuildFile; fileRef = 5FD4F5B17E0258A209438AF8FEBAFB47 /* whereInt.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tF71DEF6C3C64B71C4C7F2FFE5CADF31E /* mem2.c in Sources */ = {isa = PBXBuildFile; fileRef = C07AA943D90579CFE7F1514E90262D5C /* mem2.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n\t\tFCCD624F891065FC9A2438BEC802247A /* hwtime.h in Headers */ = {isa = PBXBuildFile; fileRef = 00755CF21DA6F623B23EE09248532B38 /* hwtime.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tFD253DAF111DABBD077618C032EDB540 /* btreeInt.h in Headers */ = {isa = PBXBuildFile; fileRef = 331CE9004B51207EEB6D3155410EC7F1 /* btreeInt.h */; settings = {ATTRIBUTES = (Project, ); }; };\n\t\tFF8000A24E39BCC20BFA15D2D63AD0BE /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = EDD84DBE8D8D6D03C570E0E853A98FDF /* main.c */; settings = {COMPILER_FLAGS = \"-fno-objc-arc\"; }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t00755CF21DA6F623B23EE09248532B38 /* hwtime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = hwtime.h; path = src/hwtime.h; sourceTree = \"<group>\"; };\n\t\t037CDEB54E85EE1B28EDD8159C734B45 /* vtab.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vtab.c; path = src/vtab.c; sourceTree = \"<group>\"; };\n\t\t051B73102DA7614F09712D04AE68B33B /* callback.c */ = {isa = PBXFileReference; includeInIndex = 1; name = callback.c; path = src/callback.c; sourceTree = \"<group>\"; };\n\t\t06448EF0069122331E01D59733FF9A7F /* expr.c */ = {isa = PBXFileReference; includeInIndex = 1; name = expr.c; path = src/expr.c; sourceTree = \"<group>\"; };\n\t\t064BC0EFC3942E7E6791FBDA19097410 /* parse.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = parse.h; sourceTree = \"<group>\"; };\n\t\t0735CA49080D749DFB1D4012410F7256 /* fts3_tokenizer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = fts3_tokenizer.h; path = ext/fts3/fts3_tokenizer.h; sourceTree = \"<group>\"; };\n\t\t07B0B0B9BF3995F9F30AE9AE478F8761 /* mem0.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mem0.c; path = src/mem0.c; sourceTree = \"<group>\"; };\n\t\t08682B39026711259E97F41DFDB2CFAB /* WCDBOptimizedSQLCipher.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = WCDBOptimizedSQLCipher.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t0AD7D0377FDB77F1561846685D59B53E /* fkey.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fkey.c; path = src/fkey.c; sourceTree = \"<group>\"; };\n\t\t0C296E85EF0CA139EC37484FFBE6766F /* btree.c */ = {isa = PBXFileReference; includeInIndex = 1; name = btree.c; path = src/btree.c; sourceTree = \"<group>\"; };\n\t\t0C9E70EDC5462D6E02AA2BBBED913A01 /* fts3_tokenizer1.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_tokenizer1.c; path = ext/fts3/fts3_tokenizer1.c; sourceTree = \"<group>\"; };\n\t\t0E5AEEE9D0649E6EBE841FF6125A23D7 /* rowset.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rowset.c; path = src/rowset.c; sourceTree = \"<group>\"; };\n\t\t0F519EFEDB81A9A1200E59557505323E /* WCDBOptimizedSQLCipher */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = WCDBOptimizedSQLCipher; path = sqlcipher.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t1161EDC5D1F0A7CA57305FDCD3279A09 /* global.c */ = {isa = PBXFileReference; includeInIndex = 1; name = global.c; path = src/global.c; sourceTree = \"<group>\"; };\n\t\t119A45534E96C88ED7B76FE6BCC431F2 /* build.c */ = {isa = PBXFileReference; includeInIndex = 1; name = build.c; path = src/build.c; sourceTree = \"<group>\"; };\n\t\t121470D718849383F7B497A303F5129A /* WCDBOptimizedSQLCipher-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"WCDBOptimizedSQLCipher-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t198ABF31F4C3AA68A0F6E3E8B3F31218 /* WCDBOptimizedSQLCipher.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = WCDBOptimizedSQLCipher.modulemap; sourceTree = \"<group>\"; };\n\t\t1F03A49E4F89E1CF680296FBC1DEF957 /* func.c */ = {isa = PBXFileReference; includeInIndex = 1; name = func.c; path = src/func.c; sourceTree = \"<group>\"; };\n\t\t268526B7747CDA4DB11F20E7B43C4D67 /* pragma.c */ = {isa = PBXFileReference; includeInIndex = 1; name = pragma.c; path = src/pragma.c; sourceTree = \"<group>\"; };\n\t\t29EFDDE9D7A02F3681864BAC8181D379 /* vdbemem.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vdbemem.c; path = src/vdbemem.c; sourceTree = \"<group>\"; };\n\t\t2B83A3E54D5945DFE0DF9326F6ED5DCA /* vdbesort.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vdbesort.c; path = src/vdbesort.c; sourceTree = \"<group>\"; };\n\t\t2BA02A79F75C5F78A60803AD455AEB96 /* btmutex.c */ = {isa = PBXFileReference; includeInIndex = 1; name = btmutex.c; path = src/btmutex.c; sourceTree = \"<group>\"; };\n\t\t2BEC902D9608DC5DEB728AA1110B2E4E /* fts3_expr.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_expr.c; path = ext/fts3/fts3_expr.c; sourceTree = \"<group>\"; };\n\t\t2C18318F324A10A734F5443B6104BFA0 /* fts3_tokenizer.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_tokenizer.c; path = ext/fts3/fts3_tokenizer.c; sourceTree = \"<group>\"; };\n\t\t2C4ACC76635AA847C9B3B244532B426D /* fts3_aux.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_aux.c; path = ext/fts3/fts3_aux.c; sourceTree = \"<group>\"; };\n\t\t2C5371BE2D6CCE1F9C843ABF29DAB76C /* vxworks.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vxworks.h; path = src/vxworks.h; sourceTree = \"<group>\"; };\n\t\t2DA4E8245FB21C4FB6A9100588D083F6 /* prepare.c */ = {isa = PBXFileReference; includeInIndex = 1; name = prepare.c; path = src/prepare.c; sourceTree = \"<group>\"; };\n\t\t2DE42EE18C7CFB26E84176CFFBF683D7 /* fts3_tokenize_vtab.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_tokenize_vtab.c; path = ext/fts3/fts3_tokenize_vtab.c; sourceTree = \"<group>\"; };\n\t\t3050610B9FCFF83FF44C5BC79015B1DD /* pcache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = pcache.h; path = src/pcache.h; sourceTree = \"<group>\"; };\n\t\t3138B008FE8FDC6E5895BB0D9A4B0BBD /* fts3_hash.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = fts3_hash.h; path = ext/fts3/fts3_hash.h; sourceTree = \"<group>\"; };\n\t\t3266B95CB618DDEBF6EE6B85D3053762 /* insert.c */ = {isa = PBXFileReference; includeInIndex = 1; name = insert.c; path = src/insert.c; sourceTree = \"<group>\"; };\n\t\t331CE9004B51207EEB6D3155410EC7F1 /* btreeInt.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = btreeInt.h; path = src/btreeInt.h; sourceTree = \"<group>\"; };\n\t\t332F03A91E83E44B4A7B66A224BE32AE /* fault.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fault.c; path = src/fault.c; sourceTree = \"<group>\"; };\n\t\t33721E5127EBCDD8CE2031FA79291E20 /* opcodes.c */ = {isa = PBXFileReference; includeInIndex = 1; path = opcodes.c; sourceTree = \"<group>\"; };\n\t\t363EF9BAE5E022AE8DA61E8264983AD7 /* where.c */ = {isa = PBXFileReference; includeInIndex = 1; name = where.c; path = src/where.c; sourceTree = \"<group>\"; };\n\t\t39046DCAF954DAE3A5386478EE30834E /* fts3Int.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = fts3Int.h; path = ext/fts3/fts3Int.h; sourceTree = \"<group>\"; };\n\t\t3C5DA2B0A7DCA834133E30998E12FF84 /* WCDBOptimizedSQLCipher-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"WCDBOptimizedSQLCipher-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t40EE6BB1D61FA507A23E2F815C9C4D71 /* os_unix.c */ = {isa = PBXFileReference; includeInIndex = 1; name = os_unix.c; path = src/os_unix.c; sourceTree = \"<group>\"; };\n\t\t410FFC5A8B151D55632D11252852B205 /* msvc.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = msvc.h; path = src/msvc.h; sourceTree = \"<group>\"; };\n\t\t430EFE90AE7FFE25848EAC2B606F3E76 /* icu.c */ = {isa = PBXFileReference; includeInIndex = 1; name = icu.c; path = ext/icu/icu.c; sourceTree = \"<group>\"; };\n\t\t434E0A57323051116C8BDA321D1BEF1E /* trigger.c */ = {isa = PBXFileReference; includeInIndex = 1; name = trigger.c; path = src/trigger.c; sourceTree = \"<group>\"; };\n\t\t44910D058B0DC1DB4A92A59DA20A1FA6 /* notify.c */ = {isa = PBXFileReference; includeInIndex = 1; name = notify.c; path = src/notify.c; sourceTree = \"<group>\"; };\n\t\t4608DDFE819BC7159E4BE28E930A2D96 /* sqliteInt.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliteInt.h; path = src/sqliteInt.h; sourceTree = \"<group>\"; };\n\t\t4747A56CBD10A368FCE4155574E05007 /* os_setup.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = os_setup.h; path = src/os_setup.h; sourceTree = \"<group>\"; };\n\t\t4C9926DCD9700CAA25779D0F3D0BF2DF /* crypto_cc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = crypto_cc.c; path = src/crypto_cc.c; sourceTree = \"<group>\"; };\n\t\t4D3F4D00FA5869044370CB594FAFE517 /* os_wcdb.c */ = {isa = PBXFileReference; includeInIndex = 1; name = os_wcdb.c; path = src/os_wcdb.c; sourceTree = \"<group>\"; };\n\t\t51E3496EE7A697BEA1642D0035041F00 /* legacy.c */ = {isa = PBXFileReference; includeInIndex = 1; name = legacy.c; path = src/legacy.c; sourceTree = \"<group>\"; };\n\t\t5527C34563A66DC7C6C68E526EE532E6 /* walker.c */ = {isa = PBXFileReference; includeInIndex = 1; name = walker.c; path = src/walker.c; sourceTree = \"<group>\"; };\n\t\t5876D67954434637C1B748FA1A5BC120 /* mutex_noop.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mutex_noop.c; path = src/mutex_noop.c; sourceTree = \"<group>\"; };\n\t\t58BAD830CEE9D3F881A3C0C6CCB908B7 /* loadext.c */ = {isa = PBXFileReference; includeInIndex = 1; name = loadext.c; path = src/loadext.c; sourceTree = \"<group>\"; };\n\t\t59183CD5CE32B871F04D3A2232CA9DA1 /* mutex_unix.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mutex_unix.c; path = src/mutex_unix.c; sourceTree = \"<group>\"; };\n\t\t5FD4F5B17E0258A209438AF8FEBAFB47 /* whereInt.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = whereInt.h; path = src/whereInt.h; sourceTree = \"<group>\"; };\n\t\t60137F151FAFC508CF9FDA5AAD727E8E /* sqlite3rbu.c */ = {isa = PBXFileReference; includeInIndex = 1; name = sqlite3rbu.c; path = ext/rbu/sqlite3rbu.c; sourceTree = \"<group>\"; };\n\t\t601F513D436E64AE9FD9F356F59A79AD /* parse.c */ = {isa = PBXFileReference; includeInIndex = 1; path = parse.c; sourceTree = \"<group>\"; };\n\t\t614C7D5150BDB418C2738FD6D2762D06 /* fts3.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = fts3.h; path = ext/fts3/fts3.h; sourceTree = \"<group>\"; };\n\t\t6250266A11D2A613F08EDB067DA029CF /* vdbe.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vdbe.c; path = src/vdbe.c; sourceTree = \"<group>\"; };\n\t\t62C4E94D0175D65F1A756AD8DC11D2F3 /* vdbeapi.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vdbeapi.c; path = src/vdbeapi.c; sourceTree = \"<group>\"; };\n\t\t636D68D6EF5C0F6763D7A09ECDB9537A /* mutex.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mutex.h; path = src/mutex.h; sourceTree = \"<group>\"; };\n\t\t648363999E9638887D84B3919BC056FD /* sqliteicu.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliteicu.h; path = ext/icu/sqliteicu.h; sourceTree = \"<group>\"; };\n\t\t652DFC6FD9E28742FD37A607B3CB11D3 /* printf.c */ = {isa = PBXFileReference; includeInIndex = 1; name = printf.c; path = src/printf.c; sourceTree = \"<group>\"; };\n\t\t6683F04D8CD90EC04E0E87DCE3FF3280 /* complete.c */ = {isa = PBXFileReference; includeInIndex = 1; name = complete.c; path = src/complete.c; sourceTree = \"<group>\"; };\n\t\t66AFC381737A5011928540E8B5E4BB16 /* mutex_wcdb.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mutex_wcdb.c; path = src/mutex_wcdb.c; sourceTree = \"<group>\"; };\n\t\t67229A14035C3C0B744AE45548552E4E /* status.c */ = {isa = PBXFileReference; includeInIndex = 1; name = status.c; path = src/status.c; sourceTree = \"<group>\"; };\n\t\t67614F219C94B57C08C94B88DC79C6EA /* mutex.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mutex.c; path = src/mutex.c; sourceTree = \"<group>\"; };\n\t\t6A24CFC230C280191213CA1F7CC9EDBC /* vacuum.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vacuum.c; path = src/vacuum.c; sourceTree = \"<group>\"; };\n\t\t6A849DC38A95BB617820DACC73B79A3D /* auth.c */ = {isa = PBXFileReference; includeInIndex = 1; name = auth.c; path = src/auth.c; sourceTree = \"<group>\"; };\n\t\t6DD39E990CAB71140927BCE3C1ACAB07 /* vdbeInt.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vdbeInt.h; path = src/vdbeInt.h; sourceTree = \"<group>\"; };\n\t\t72141657F7470A253FFE8EC3A2E221CF /* pcache1.c */ = {isa = PBXFileReference; includeInIndex = 1; name = pcache1.c; path = src/pcache1.c; sourceTree = \"<group>\"; };\n\t\t721F3987C9416E44CE047814AF9E72A0 /* sqlite3rtree.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqlite3rtree.h; path = ext/rtree/sqlite3rtree.h; sourceTree = \"<group>\"; };\n\t\t7421BE18E75BB2A9FBA21BE93F40E676 /* os_wcdb.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = os_wcdb.h; path = src/os_wcdb.h; sourceTree = \"<group>\"; };\n\t\t751A683F5B939E7F841A6D8AE4EB35EF /* fts3_unicode.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_unicode.c; path = ext/fts3/fts3_unicode.c; sourceTree = \"<group>\"; };\n\t\t792664979E7BB9EDF51497470E314406 /* vdbeblob.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vdbeblob.c; path = src/vdbeblob.c; sourceTree = \"<group>\"; };\n\t\t79AE7202D5ABF67E998D050FDAFE17E7 /* pager.c */ = {isa = PBXFileReference; includeInIndex = 1; name = pager.c; path = src/pager.c; sourceTree = \"<group>\"; };\n\t\t7B2254DAC1994EE4C3E4B98FCF083BE9 /* mem1.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mem1.c; path = src/mem1.c; sourceTree = \"<group>\"; };\n\t\t7C65C29C60F0356FDD1C6DEC5757ACAD /* crypto.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = crypto.h; path = src/crypto.h; sourceTree = \"<group>\"; };\n\t\t7D3C5D6B4D0CB3269DD2F25494B202A5 /* date.c */ = {isa = PBXFileReference; includeInIndex = 1; name = date.c; path = src/date.c; sourceTree = \"<group>\"; };\n\t\t812FAC9B927A9F72B9D7EEE4104098E2 /* threads.c */ = {isa = PBXFileReference; includeInIndex = 1; name = threads.c; path = src/threads.c; sourceTree = \"<group>\"; };\n\t\t833CF18208052150B7CD6989FDFCA599 /* update.c */ = {isa = PBXFileReference; includeInIndex = 1; name = update.c; path = src/update.c; sourceTree = \"<group>\"; };\n\t\t85B4278035197B9BA14D7AE1965CEE78 /* os.c */ = {isa = PBXFileReference; includeInIndex = 1; name = os.c; path = src/os.c; sourceTree = \"<group>\"; };\n\t\t86E06BABCE715EA98BF4E2EAAFAB4D86 /* fts3_write.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_write.c; path = ext/fts3/fts3_write.c; sourceTree = \"<group>\"; };\n\t\t88D3E044C2500DB71F81E810675651CA /* vdbeaux.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vdbeaux.c; path = src/vdbeaux.c; sourceTree = \"<group>\"; };\n\t\t89ED719BA8FB0FF2AE366D3CF1E07781 /* fts3_unicode2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_unicode2.c; path = ext/fts3/fts3_unicode2.c; sourceTree = \"<group>\"; };\n\t\t8D3F68564E96D6C649CB902905B9701A /* fts3_porter.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_porter.c; path = ext/fts3/fts3_porter.c; sourceTree = \"<group>\"; };\n\t\t8E6DD04944FA96933CAF6A3C369243CC /* sqlite3.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = sqlite3.h; sourceTree = \"<group>\"; };\n\t\t91C067E0DFAE68F8850F58EC0F2B2252 /* fts3_snippet.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_snippet.c; path = ext/fts3/fts3_snippet.c; sourceTree = \"<group>\"; };\n\t\t933DEBE621531EC2E02EC9A1E2E984B7 /* fts3_icu.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_icu.c; path = ext/fts3/fts3_icu.c; sourceTree = \"<group>\"; };\n\t\t935B30A328C84E8A46E0D1B74EF58ABE /* malloc.c */ = {isa = PBXFileReference; includeInIndex = 1; name = malloc.c; path = src/malloc.c; sourceTree = \"<group>\"; };\n\t\t937FD3C2AEF0BC415017C360470E148B /* bitvec.c */ = {isa = PBXFileReference; includeInIndex = 1; name = bitvec.c; path = src/bitvec.c; sourceTree = \"<group>\"; };\n\t\t963BFFE171D2389EFA4CA38E7F6866C5 /* fts3.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3.c; path = ext/fts3/fts3.c; sourceTree = \"<group>\"; };\n\t\t9662B31D1314BF5B3A816AB022018B73 /* utf.c */ = {isa = PBXFileReference; includeInIndex = 1; name = utf.c; path = src/utf.c; sourceTree = \"<group>\"; };\n\t\t97544068E139CE57CB497F77DA42BE68 /* crypto_impl.c */ = {isa = PBXFileReference; includeInIndex = 1; name = crypto_impl.c; path = src/crypto_impl.c; sourceTree = \"<group>\"; };\n\t\t988051A9013C8F38137003BA3832E71B /* crypto.c */ = {isa = PBXFileReference; includeInIndex = 1; name = crypto.c; path = src/crypto.c; sourceTree = \"<group>\"; };\n\t\t9A22E03EDEC2A804E9278E46C8076B2B /* fts5.c */ = {isa = PBXFileReference; includeInIndex = 1; path = fts5.c; sourceTree = \"<group>\"; };\n\t\t9D0906AFCA034B3D06A1B28951BF9D86 /* crypto_libtomcrypt.c */ = {isa = PBXFileReference; includeInIndex = 1; name = crypto_libtomcrypt.c; path = src/crypto_libtomcrypt.c; sourceTree = \"<group>\"; };\n\t\t9D0A9FF88112D00242615E4FB9316C04 /* select.c */ = {isa = PBXFileReference; includeInIndex = 1; name = select.c; path = src/select.c; sourceTree = \"<group>\"; };\n\t\t9DD3DA7D95B631FBD51FC6C0D876B26D /* opcodes.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = opcodes.h; sourceTree = \"<group>\"; };\n\t\t9E681F6C89E26DC10771AB5339F6F39F /* wal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = wal.h; path = src/wal.h; sourceTree = \"<group>\"; };\n\t\tA0B3B6B3B7652EAC5FD7F2315D1D0755 /* WCDBOptimizedSQLCipher-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"WCDBOptimizedSQLCipher-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tA44FC13886FE6C9F4A77B833FD7B705D /* mem3.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mem3.c; path = src/mem3.c; sourceTree = \"<group>\"; };\n\t\tA85408398505911C8994916B87FEFACD /* delete.c */ = {isa = PBXFileReference; includeInIndex = 1; name = delete.c; path = src/delete.c; sourceTree = \"<group>\"; };\n\t\tA8E0FD8FC7DD16DE7DF0EDC9C64E1BCE /* hash.c */ = {isa = PBXFileReference; includeInIndex = 1; name = hash.c; path = src/hash.c; sourceTree = \"<group>\"; };\n\t\tA8E3FBFB1CE731B6506195E943C61FF7 /* attach.c */ = {isa = PBXFileReference; includeInIndex = 1; name = attach.c; path = src/attach.c; sourceTree = \"<group>\"; };\n\t\tACFCD540FAFB582780477DE2CA22CF4C /* mutex_wcdb.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mutex_wcdb.h; path = src/mutex_wcdb.h; sourceTree = \"<group>\"; };\n\t\tAF74746F0F7096FF27C6C34DA0A82C2A /* treeview.c */ = {isa = PBXFileReference; includeInIndex = 1; name = treeview.c; path = src/treeview.c; sourceTree = \"<group>\"; };\n\t\tB1EAC7A7AF46ED7FBE04D6DE7F8FC930 /* rtree.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = rtree.h; path = ext/rtree/rtree.h; sourceTree = \"<group>\"; };\n\t\tB39A54986C07C15C6A56D94ABE7EDCE6 /* mem5.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mem5.c; path = src/mem5.c; sourceTree = \"<group>\"; };\n\t\tB52F5BE4DEA26D2CE095BEFAFDDA8211 /* vdbetrace.c */ = {isa = PBXFileReference; includeInIndex = 1; name = vdbetrace.c; path = src/vdbetrace.c; sourceTree = \"<group>\"; };\n\t\tB5FF0B3176815EA968515AD731B9B9A5 /* ctime.c */ = {isa = PBXFileReference; includeInIndex = 1; name = ctime.c; path = src/ctime.c; sourceTree = \"<group>\"; };\n\t\tB9F0667481991942E44FA6D8F5EEA737 /* random.c */ = {isa = PBXFileReference; includeInIndex = 1; name = random.c; path = src/random.c; sourceTree = \"<group>\"; };\n\t\tBC645A6F49D3C0ABAC257798ABCDF6BE /* util.c */ = {isa = PBXFileReference; includeInIndex = 1; name = util.c; path = src/util.c; sourceTree = \"<group>\"; };\n\t\tBCC92FB1C24C7CDCC7D17F051008EE0A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tBCE6879425105DD5FD3421F04CD274F3 /* keywordhash.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = keywordhash.h; sourceTree = \"<group>\"; };\n\t\tBDA214F3C3961648F8BC817A89964F5A /* alter.c */ = {isa = PBXFileReference; includeInIndex = 1; name = alter.c; path = src/alter.c; sourceTree = \"<group>\"; };\n\t\tBF4119822AE3DB6E86C3706D5B20E90A /* fts5.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = fts5.h; sourceTree = \"<group>\"; };\n\t\tC05BA11F543AE011C05ECC38E1401762 /* wherecode.c */ = {isa = PBXFileReference; includeInIndex = 1; name = wherecode.c; path = src/wherecode.c; sourceTree = \"<group>\"; };\n\t\tC07AA943D90579CFE7F1514E90262D5C /* mem2.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mem2.c; path = src/mem2.c; sourceTree = \"<group>\"; };\n\t\tC0C6762D778B68F84BC714555F7CFA7E /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };\n\t\tC3D2C5D94972302516CD7888DA120573 /* sqlcipher.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqlcipher.h; path = src/sqlcipher.h; sourceTree = \"<group>\"; };\n\t\tC421913B61AC7DF8E8FA629A1D16CD15 /* btree.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = btree.h; path = src/btree.h; sourceTree = \"<group>\"; };\n\t\tCD2CCFCCB0AE0CC0490DEF036F7612E1 /* sqlite3ext.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqlite3ext.h; path = src/sqlite3ext.h; sourceTree = \"<group>\"; };\n\t\tCE889954D3F29D5E844A4BF7A3BF070C /* sqlite3userauth.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqlite3userauth.h; path = ext/userauth/sqlite3userauth.h; sourceTree = \"<group>\"; };\n\t\tD3240BA27F9C0921364220F327356317 /* fts3_hash.c */ = {isa = PBXFileReference; includeInIndex = 1; name = fts3_hash.c; path = ext/fts3/fts3_hash.c; sourceTree = \"<group>\"; };\n\t\tD4A23558E0D15744A3ABBEB74E853EF3 /* sqlite3rbu.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqlite3rbu.h; path = ext/rbu/sqlite3rbu.h; sourceTree = \"<group>\"; };\n\t\tD4D4AC471AA7E21D2FD210E58D4C299D /* tokenize.c */ = {isa = PBXFileReference; includeInIndex = 1; name = tokenize.c; path = src/tokenize.c; sourceTree = \"<group>\"; };\n\t\tDA4C36C58BE099887836F305DA416295 /* whereexpr.c */ = {isa = PBXFileReference; includeInIndex = 1; name = whereexpr.c; path = src/whereexpr.c; sourceTree = \"<group>\"; };\n\t\tDB8F78AF186FCB18268F938C619D94C9 /* WCDBOptimizedSQLCipher.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = WCDBOptimizedSQLCipher.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tDBF27EA851EE9B248F054D3C373FDEB2 /* wal.c */ = {isa = PBXFileReference; includeInIndex = 1; name = wal.c; path = src/wal.c; sourceTree = \"<group>\"; };\n\t\tDFBF969F4926C2B5F81BAAA17226DDB8 /* rtree.c */ = {isa = PBXFileReference; includeInIndex = 1; name = rtree.c; path = ext/rtree/rtree.c; sourceTree = \"<group>\"; };\n\t\tE3E04C018AB0C4D4950420528F2FA36E /* analyze.c */ = {isa = PBXFileReference; includeInIndex = 1; name = analyze.c; path = src/analyze.c; sourceTree = \"<group>\"; };\n\t\tE40B804D878D8F0B4374971749F23E75 /* hash.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = hash.h; path = src/hash.h; sourceTree = \"<group>\"; };\n\t\tE4339CF5A192B80F4A550516D28B110C /* resolve.c */ = {isa = PBXFileReference; includeInIndex = 1; name = resolve.c; path = src/resolve.c; sourceTree = \"<group>\"; };\n\t\tE57491323FA1027B616668C854DB4003 /* pcache.c */ = {isa = PBXFileReference; includeInIndex = 1; name = pcache.c; path = src/pcache.c; sourceTree = \"<group>\"; };\n\t\tE6528DAE57C35C6E98F32918EE2DC03B /* pragma.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = pragma.h; path = src/pragma.h; sourceTree = \"<group>\"; };\n\t\tE8283293458668B10491F7230969E33C /* queue.c */ = {isa = PBXFileReference; includeInIndex = 1; name = queue.c; path = src/queue.c; sourceTree = \"<group>\"; };\n\t\tE8B4DDA2AA8F96828863CB4860544C13 /* queue.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = queue.h; path = src/queue.h; sourceTree = \"<group>\"; };\n\t\tECAF30D20A8E2E10CEE3406FF7F16271 /* os_common.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = os_common.h; path = src/os_common.h; sourceTree = \"<group>\"; };\n\t\tED19BA196E09A040A675BB85687D5494 /* backup.c */ = {isa = PBXFileReference; includeInIndex = 1; name = backup.c; path = src/backup.c; sourceTree = \"<group>\"; };\n\t\tEDD84DBE8D8D6D03C570E0E853A98FDF /* main.c */ = {isa = PBXFileReference; includeInIndex = 1; name = main.c; path = src/main.c; sourceTree = \"<group>\"; };\n\t\tF4D2C2116F3663C0BF0983B62CE86754 /* os.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = os.h; path = src/os.h; sourceTree = \"<group>\"; };\n\t\tF5728CBED975DB579A9AEFA056DB7AFA /* table.c */ = {isa = PBXFileReference; includeInIndex = 1; name = table.c; path = src/table.c; sourceTree = \"<group>\"; };\n\t\tF6B6C940C90CB04F6C891C17D90BE5C0 /* WCDBOptimizedSQLCipher-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"WCDBOptimizedSQLCipher-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tF7959D92A198DB710BD43F6955752638 /* vdbe.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = vdbe.h; path = src/vdbe.h; sourceTree = \"<group>\"; };\n\t\tF799F50D34DF99963433DA8BA939A1EB /* sqliteLimit.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = sqliteLimit.h; path = src/sqliteLimit.h; sourceTree = \"<group>\"; };\n\t\tF7F149752D910BF4FF892F4E9CE06CE4 /* dbstat.c */ = {isa = PBXFileReference; includeInIndex = 1; name = dbstat.c; path = src/dbstat.c; sourceTree = \"<group>\"; };\n\t\tF9E6356B79A88B87FCBD8D4D4545D3EC /* pager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = pager.h; path = src/pager.h; sourceTree = \"<group>\"; };\n\t\tFE0F6CB5A17E7C90E432D802B2613CCD /* memjournal.c */ = {isa = PBXFileReference; includeInIndex = 1; name = memjournal.c; path = src/memjournal.c; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t15277FAD18E07212724FBA93ACEA8146 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t45546860F2D6F0C848B158A81F5EECF3 /* Foundation.framework in Frameworks */,\n\t\t\t\tDDB1A36186F1E71A78104E6E40D82947 /* Security.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t0DAE58BAFD6FEB435349F5C4CCFC2AAF = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF4C6A3E69EBBCD9618A17E3C3DC776E9 /* Frameworks */,\n\t\t\t\t147800591E58E0EC10CDA5550E921DB2 /* Products */,\n\t\t\t\t7C073B5154D6EBF31C8FB4CE03E105AF /* WCDBOptimizedSQLCipher */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t147800591E58E0EC10CDA5550E921DB2 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t0F519EFEDB81A9A1200E59557505323E /* WCDBOptimizedSQLCipher */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7C073B5154D6EBF31C8FB4CE03E105AF /* WCDBOptimizedSQLCipher */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBDA214F3C3961648F8BC817A89964F5A /* alter.c */,\n\t\t\t\tE3E04C018AB0C4D4950420528F2FA36E /* analyze.c */,\n\t\t\t\tA8E3FBFB1CE731B6506195E943C61FF7 /* attach.c */,\n\t\t\t\t6A849DC38A95BB617820DACC73B79A3D /* auth.c */,\n\t\t\t\tED19BA196E09A040A675BB85687D5494 /* backup.c */,\n\t\t\t\t937FD3C2AEF0BC415017C360470E148B /* bitvec.c */,\n\t\t\t\t2BA02A79F75C5F78A60803AD455AEB96 /* btmutex.c */,\n\t\t\t\t0C296E85EF0CA139EC37484FFBE6766F /* btree.c */,\n\t\t\t\tC421913B61AC7DF8E8FA629A1D16CD15 /* btree.h */,\n\t\t\t\t331CE9004B51207EEB6D3155410EC7F1 /* btreeInt.h */,\n\t\t\t\t119A45534E96C88ED7B76FE6BCC431F2 /* build.c */,\n\t\t\t\t051B73102DA7614F09712D04AE68B33B /* callback.c */,\n\t\t\t\t6683F04D8CD90EC04E0E87DCE3FF3280 /* complete.c */,\n\t\t\t\t988051A9013C8F38137003BA3832E71B /* crypto.c */,\n\t\t\t\t7C65C29C60F0356FDD1C6DEC5757ACAD /* crypto.h */,\n\t\t\t\t4C9926DCD9700CAA25779D0F3D0BF2DF /* crypto_cc.c */,\n\t\t\t\t97544068E139CE57CB497F77DA42BE68 /* crypto_impl.c */,\n\t\t\t\t9D0906AFCA034B3D06A1B28951BF9D86 /* crypto_libtomcrypt.c */,\n\t\t\t\tB5FF0B3176815EA968515AD731B9B9A5 /* ctime.c */,\n\t\t\t\t7D3C5D6B4D0CB3269DD2F25494B202A5 /* date.c */,\n\t\t\t\tF7F149752D910BF4FF892F4E9CE06CE4 /* dbstat.c */,\n\t\t\t\tA85408398505911C8994916B87FEFACD /* delete.c */,\n\t\t\t\t06448EF0069122331E01D59733FF9A7F /* expr.c */,\n\t\t\t\t332F03A91E83E44B4A7B66A224BE32AE /* fault.c */,\n\t\t\t\t0AD7D0377FDB77F1561846685D59B53E /* fkey.c */,\n\t\t\t\t963BFFE171D2389EFA4CA38E7F6866C5 /* fts3.c */,\n\t\t\t\t614C7D5150BDB418C2738FD6D2762D06 /* fts3.h */,\n\t\t\t\t2C4ACC76635AA847C9B3B244532B426D /* fts3_aux.c */,\n\t\t\t\t2BEC902D9608DC5DEB728AA1110B2E4E /* fts3_expr.c */,\n\t\t\t\tD3240BA27F9C0921364220F327356317 /* fts3_hash.c */,\n\t\t\t\t3138B008FE8FDC6E5895BB0D9A4B0BBD /* fts3_hash.h */,\n\t\t\t\t933DEBE621531EC2E02EC9A1E2E984B7 /* fts3_icu.c */,\n\t\t\t\t8D3F68564E96D6C649CB902905B9701A /* fts3_porter.c */,\n\t\t\t\t91C067E0DFAE68F8850F58EC0F2B2252 /* fts3_snippet.c */,\n\t\t\t\t2DE42EE18C7CFB26E84176CFFBF683D7 /* fts3_tokenize_vtab.c */,\n\t\t\t\t2C18318F324A10A734F5443B6104BFA0 /* fts3_tokenizer.c */,\n\t\t\t\t0735CA49080D749DFB1D4012410F7256 /* fts3_tokenizer.h */,\n\t\t\t\t0C9E70EDC5462D6E02AA2BBBED913A01 /* fts3_tokenizer1.c */,\n\t\t\t\t751A683F5B939E7F841A6D8AE4EB35EF /* fts3_unicode.c */,\n\t\t\t\t89ED719BA8FB0FF2AE366D3CF1E07781 /* fts3_unicode2.c */,\n\t\t\t\t86E06BABCE715EA98BF4E2EAAFAB4D86 /* fts3_write.c */,\n\t\t\t\t39046DCAF954DAE3A5386478EE30834E /* fts3Int.h */,\n\t\t\t\t9A22E03EDEC2A804E9278E46C8076B2B /* fts5.c */,\n\t\t\t\tBF4119822AE3DB6E86C3706D5B20E90A /* fts5.h */,\n\t\t\t\t1F03A49E4F89E1CF680296FBC1DEF957 /* func.c */,\n\t\t\t\t1161EDC5D1F0A7CA57305FDCD3279A09 /* global.c */,\n\t\t\t\tA8E0FD8FC7DD16DE7DF0EDC9C64E1BCE /* hash.c */,\n\t\t\t\tE40B804D878D8F0B4374971749F23E75 /* hash.h */,\n\t\t\t\t00755CF21DA6F623B23EE09248532B38 /* hwtime.h */,\n\t\t\t\t430EFE90AE7FFE25848EAC2B606F3E76 /* icu.c */,\n\t\t\t\t3266B95CB618DDEBF6EE6B85D3053762 /* insert.c */,\n\t\t\t\tBCE6879425105DD5FD3421F04CD274F3 /* keywordhash.h */,\n\t\t\t\t51E3496EE7A697BEA1642D0035041F00 /* legacy.c */,\n\t\t\t\t58BAD830CEE9D3F881A3C0C6CCB908B7 /* loadext.c */,\n\t\t\t\tEDD84DBE8D8D6D03C570E0E853A98FDF /* main.c */,\n\t\t\t\t935B30A328C84E8A46E0D1B74EF58ABE /* malloc.c */,\n\t\t\t\t07B0B0B9BF3995F9F30AE9AE478F8761 /* mem0.c */,\n\t\t\t\t7B2254DAC1994EE4C3E4B98FCF083BE9 /* mem1.c */,\n\t\t\t\tC07AA943D90579CFE7F1514E90262D5C /* mem2.c */,\n\t\t\t\tA44FC13886FE6C9F4A77B833FD7B705D /* mem3.c */,\n\t\t\t\tB39A54986C07C15C6A56D94ABE7EDCE6 /* mem5.c */,\n\t\t\t\tFE0F6CB5A17E7C90E432D802B2613CCD /* memjournal.c */,\n\t\t\t\t410FFC5A8B151D55632D11252852B205 /* msvc.h */,\n\t\t\t\t67614F219C94B57C08C94B88DC79C6EA /* mutex.c */,\n\t\t\t\t636D68D6EF5C0F6763D7A09ECDB9537A /* mutex.h */,\n\t\t\t\t5876D67954434637C1B748FA1A5BC120 /* mutex_noop.c */,\n\t\t\t\t59183CD5CE32B871F04D3A2232CA9DA1 /* mutex_unix.c */,\n\t\t\t\t66AFC381737A5011928540E8B5E4BB16 /* mutex_wcdb.c */,\n\t\t\t\tACFCD540FAFB582780477DE2CA22CF4C /* mutex_wcdb.h */,\n\t\t\t\t44910D058B0DC1DB4A92A59DA20A1FA6 /* notify.c */,\n\t\t\t\t33721E5127EBCDD8CE2031FA79291E20 /* opcodes.c */,\n\t\t\t\t9DD3DA7D95B631FBD51FC6C0D876B26D /* opcodes.h */,\n\t\t\t\t85B4278035197B9BA14D7AE1965CEE78 /* os.c */,\n\t\t\t\tF4D2C2116F3663C0BF0983B62CE86754 /* os.h */,\n\t\t\t\tECAF30D20A8E2E10CEE3406FF7F16271 /* os_common.h */,\n\t\t\t\t4747A56CBD10A368FCE4155574E05007 /* os_setup.h */,\n\t\t\t\t40EE6BB1D61FA507A23E2F815C9C4D71 /* os_unix.c */,\n\t\t\t\t4D3F4D00FA5869044370CB594FAFE517 /* os_wcdb.c */,\n\t\t\t\t7421BE18E75BB2A9FBA21BE93F40E676 /* os_wcdb.h */,\n\t\t\t\t79AE7202D5ABF67E998D050FDAFE17E7 /* pager.c */,\n\t\t\t\tF9E6356B79A88B87FCBD8D4D4545D3EC /* pager.h */,\n\t\t\t\t601F513D436E64AE9FD9F356F59A79AD /* parse.c */,\n\t\t\t\t064BC0EFC3942E7E6791FBDA19097410 /* parse.h */,\n\t\t\t\tE57491323FA1027B616668C854DB4003 /* pcache.c */,\n\t\t\t\t3050610B9FCFF83FF44C5BC79015B1DD /* pcache.h */,\n\t\t\t\t72141657F7470A253FFE8EC3A2E221CF /* pcache1.c */,\n\t\t\t\t268526B7747CDA4DB11F20E7B43C4D67 /* pragma.c */,\n\t\t\t\tE6528DAE57C35C6E98F32918EE2DC03B /* pragma.h */,\n\t\t\t\t2DA4E8245FB21C4FB6A9100588D083F6 /* prepare.c */,\n\t\t\t\t652DFC6FD9E28742FD37A607B3CB11D3 /* printf.c */,\n\t\t\t\tE8283293458668B10491F7230969E33C /* queue.c */,\n\t\t\t\tE8B4DDA2AA8F96828863CB4860544C13 /* queue.h */,\n\t\t\t\tB9F0667481991942E44FA6D8F5EEA737 /* random.c */,\n\t\t\t\tE4339CF5A192B80F4A550516D28B110C /* resolve.c */,\n\t\t\t\t0E5AEEE9D0649E6EBE841FF6125A23D7 /* rowset.c */,\n\t\t\t\tDFBF969F4926C2B5F81BAAA17226DDB8 /* rtree.c */,\n\t\t\t\tB1EAC7A7AF46ED7FBE04D6DE7F8FC930 /* rtree.h */,\n\t\t\t\t9D0A9FF88112D00242615E4FB9316C04 /* select.c */,\n\t\t\t\tC3D2C5D94972302516CD7888DA120573 /* sqlcipher.h */,\n\t\t\t\t8E6DD04944FA96933CAF6A3C369243CC /* sqlite3.h */,\n\t\t\t\tCD2CCFCCB0AE0CC0490DEF036F7612E1 /* sqlite3ext.h */,\n\t\t\t\t60137F151FAFC508CF9FDA5AAD727E8E /* sqlite3rbu.c */,\n\t\t\t\tD4A23558E0D15744A3ABBEB74E853EF3 /* sqlite3rbu.h */,\n\t\t\t\t721F3987C9416E44CE047814AF9E72A0 /* sqlite3rtree.h */,\n\t\t\t\tCE889954D3F29D5E844A4BF7A3BF070C /* sqlite3userauth.h */,\n\t\t\t\t648363999E9638887D84B3919BC056FD /* sqliteicu.h */,\n\t\t\t\t4608DDFE819BC7159E4BE28E930A2D96 /* sqliteInt.h */,\n\t\t\t\tF799F50D34DF99963433DA8BA939A1EB /* sqliteLimit.h */,\n\t\t\t\t67229A14035C3C0B744AE45548552E4E /* status.c */,\n\t\t\t\tF5728CBED975DB579A9AEFA056DB7AFA /* table.c */,\n\t\t\t\t812FAC9B927A9F72B9D7EEE4104098E2 /* threads.c */,\n\t\t\t\tD4D4AC471AA7E21D2FD210E58D4C299D /* tokenize.c */,\n\t\t\t\tAF74746F0F7096FF27C6C34DA0A82C2A /* treeview.c */,\n\t\t\t\t434E0A57323051116C8BDA321D1BEF1E /* trigger.c */,\n\t\t\t\t833CF18208052150B7CD6989FDFCA599 /* update.c */,\n\t\t\t\t9662B31D1314BF5B3A816AB022018B73 /* utf.c */,\n\t\t\t\tBC645A6F49D3C0ABAC257798ABCDF6BE /* util.c */,\n\t\t\t\t6A24CFC230C280191213CA1F7CC9EDBC /* vacuum.c */,\n\t\t\t\t6250266A11D2A613F08EDB067DA029CF /* vdbe.c */,\n\t\t\t\tF7959D92A198DB710BD43F6955752638 /* vdbe.h */,\n\t\t\t\t62C4E94D0175D65F1A756AD8DC11D2F3 /* vdbeapi.c */,\n\t\t\t\t88D3E044C2500DB71F81E810675651CA /* vdbeaux.c */,\n\t\t\t\t792664979E7BB9EDF51497470E314406 /* vdbeblob.c */,\n\t\t\t\t6DD39E990CAB71140927BCE3C1ACAB07 /* vdbeInt.h */,\n\t\t\t\t29EFDDE9D7A02F3681864BAC8181D379 /* vdbemem.c */,\n\t\t\t\t2B83A3E54D5945DFE0DF9326F6ED5DCA /* vdbesort.c */,\n\t\t\t\tB52F5BE4DEA26D2CE095BEFAFDDA8211 /* vdbetrace.c */,\n\t\t\t\t037CDEB54E85EE1B28EDD8159C734B45 /* vtab.c */,\n\t\t\t\t2C5371BE2D6CCE1F9C843ABF29DAB76C /* vxworks.h */,\n\t\t\t\tDBF27EA851EE9B248F054D3C373FDEB2 /* wal.c */,\n\t\t\t\t9E681F6C89E26DC10771AB5339F6F39F /* wal.h */,\n\t\t\t\t5527C34563A66DC7C6C68E526EE532E6 /* walker.c */,\n\t\t\t\t363EF9BAE5E022AE8DA61E8264983AD7 /* where.c */,\n\t\t\t\tC05BA11F543AE011C05ECC38E1401762 /* wherecode.c */,\n\t\t\t\tDA4C36C58BE099887836F305DA416295 /* whereexpr.c */,\n\t\t\t\t5FD4F5B17E0258A209438AF8FEBAFB47 /* whereInt.h */,\n\t\t\t\tB9E8AD64DE5609426D08F9C712F7C419 /* Support Files */,\n\t\t\t);\n\t\t\tname = WCDBOptimizedSQLCipher;\n\t\t\tpath = WCDBOptimizedSQLCipher;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB9E8AD64DE5609426D08F9C712F7C419 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t198ABF31F4C3AA68A0F6E3E8B3F31218 /* WCDBOptimizedSQLCipher.modulemap */,\n\t\t\t\tA0B3B6B3B7652EAC5FD7F2315D1D0755 /* WCDBOptimizedSQLCipher-dummy.m */,\n\t\t\t\t3C5DA2B0A7DCA834133E30998E12FF84 /* WCDBOptimizedSQLCipher-Info.plist */,\n\t\t\t\t121470D718849383F7B497A303F5129A /* WCDBOptimizedSQLCipher-prefix.pch */,\n\t\t\t\tF6B6C940C90CB04F6C891C17D90BE5C0 /* WCDBOptimizedSQLCipher-umbrella.h */,\n\t\t\t\t08682B39026711259E97F41DFDB2CFAB /* WCDBOptimizedSQLCipher.debug.xcconfig */,\n\t\t\t\tDB8F78AF186FCB18268F938C619D94C9 /* WCDBOptimizedSQLCipher.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/WCDBOptimizedSQLCipher\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD9CEFA39E40C4ED3FBFF135431E510AA /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tBCC92FB1C24C7CDCC7D17F051008EE0A /* Foundation.framework */,\n\t\t\t\tC0C6762D778B68F84BC714555F7CFA7E /* Security.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF4C6A3E69EBBCD9618A17E3C3DC776E9 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD9CEFA39E40C4ED3FBFF135431E510AA /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tEDFCBA23F1A3D76BCB4F6D8704195DCE /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t87097E871B2AD28F09D62F4F9C81C5F8 /* btree.h in Headers */,\n\t\t\t\tFD253DAF111DABBD077618C032EDB540 /* btreeInt.h in Headers */,\n\t\t\t\t2DD2F6A4BEBDC14176696B9BD40E1000 /* crypto.h in Headers */,\n\t\t\t\t1483A839D1A617764155CE3A5AE53BBC /* fts3.h in Headers */,\n\t\t\t\t551B871170EE741873DB5C3C321C831C /* fts3_hash.h in Headers */,\n\t\t\t\t1966AF6E2CE98291977D8E52DF5740AB /* fts3_tokenizer.h in Headers */,\n\t\t\t\tE3067F40706E44F7014E85624D401F4B /* fts3Int.h in Headers */,\n\t\t\t\t6DB2C6F2DD31603E9394E7E1C2B6F14C /* fts5.h in Headers */,\n\t\t\t\t6D0347EB4716F42F268315B7ACB811E2 /* hash.h in Headers */,\n\t\t\t\tFCCD624F891065FC9A2438BEC802247A /* hwtime.h in Headers */,\n\t\t\t\t6ED4783C9F5B4A1288799E59B6A9BE3F /* keywordhash.h in Headers */,\n\t\t\t\t7FD9C2C40137E5249F861A39745DC58A /* msvc.h in Headers */,\n\t\t\t\tE772C17070128A166AFC702F1956E364 /* mutex.h in Headers */,\n\t\t\t\t62D1D1C09F422BDE0C84B09E35A6CF15 /* mutex_wcdb.h in Headers */,\n\t\t\t\t2022F1EECECCE719EC30543112A168E4 /* opcodes.h in Headers */,\n\t\t\t\t5965867CE49B7065EFAA266994DFD908 /* os.h in Headers */,\n\t\t\t\tA0AE1B4EC430BA422074318CDB5FE6BB /* os_common.h in Headers */,\n\t\t\t\tB313B64B2E44469D53564BB76B35C24D /* os_setup.h in Headers */,\n\t\t\t\t11EF509CC714D5FEE1DFCDB1EB44398E /* os_wcdb.h in Headers */,\n\t\t\t\t4FDA56F70439EC006671D85893F10A4B /* pager.h in Headers */,\n\t\t\t\t3DE6A7FA6CC2C6A20F8585F2CC610DD9 /* parse.h in Headers */,\n\t\t\t\tDE4FE7FFE0E76D26AAE1422BE081AF1C /* pcache.h in Headers */,\n\t\t\t\t5153DAF164ED49C5CA0EAF1D0EB07982 /* pragma.h in Headers */,\n\t\t\t\t399ED801CB4CDA1F34BDE41E96F7A7A6 /* queue.h in Headers */,\n\t\t\t\t04BA00A7CE0C6399CB530F18AB3A1177 /* rtree.h in Headers */,\n\t\t\t\tC2A65020803D52D93AE0EBBB726791AF /* sqlcipher.h in Headers */,\n\t\t\t\tA709CA20697CFE7AD211C104C1A25311 /* sqlite3.h in Headers */,\n\t\t\t\t4592021AD89CB345F6F8E22FA791C624 /* sqlite3ext.h in Headers */,\n\t\t\t\tDD8FC9551094218E1A8906573848253E /* sqlite3rbu.h in Headers */,\n\t\t\t\t9F555968582C15676E557DD7E70835E6 /* sqlite3rtree.h in Headers */,\n\t\t\t\t5F77D36A58EE05E8BF389B3FB5DC9CA8 /* sqlite3userauth.h in Headers */,\n\t\t\t\t19CFB0C5051700285570D5FB2077FD76 /* sqliteicu.h in Headers */,\n\t\t\t\tAB25F7CFB8368321F424C8F0D774704D /* sqliteInt.h in Headers */,\n\t\t\t\t5A0203D022723665B0AA4EE0CFAA1457 /* sqliteLimit.h in Headers */,\n\t\t\t\t14B9EC7F7EA64329D2A91453A50F1128 /* vdbe.h in Headers */,\n\t\t\t\tDD0AB85D1155539ED44EC58E46B911F2 /* vdbeInt.h in Headers */,\n\t\t\t\t7722FBBFC63A4E5AED68E36EAD692601 /* vxworks.h in Headers */,\n\t\t\t\tDE24A6D9B09B99F115743263D13D0EF5 /* wal.h in Headers */,\n\t\t\t\t347CD1BB4A6B56F555E349847EFA2541 /* WCDBOptimizedSQLCipher-umbrella.h in Headers */,\n\t\t\t\tF491F71196A41A6CEE970C0F76C1EB85 /* whereInt.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t8820E4661B26990965C45655F51ED18B /* WCDBOptimizedSQLCipher */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = E7805B209F531D59B41B6BC54226E5C1 /* Build configuration list for PBXNativeTarget \"WCDBOptimizedSQLCipher\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tEDFCBA23F1A3D76BCB4F6D8704195DCE /* Headers */,\n\t\t\t\t95FF0E1B114CD91238B0AFC198D2CAA2 /* Sources */,\n\t\t\t\t15277FAD18E07212724FBA93ACEA8146 /* Frameworks */,\n\t\t\t\tB002EC137CC03571840EA88A5466F78C /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = WCDBOptimizedSQLCipher;\n\t\t\tproductName = sqlcipher;\n\t\t\tproductReference = 0F519EFEDB81A9A1200E59557505323E /* WCDBOptimizedSQLCipher */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tF789038590B81C9A16D6ABFF18F9F7E4 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = B89F9BE20D4D31D1A87BA57C4F35FBC2 /* Build configuration list for PBXProject \"WCDBOptimizedSQLCipher\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 0DAE58BAFD6FEB435349F5C4CCFC2AAF;\n\t\t\tproductRefGroup = 147800591E58E0EC10CDA5550E921DB2 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t8820E4661B26990965C45655F51ED18B /* WCDBOptimizedSQLCipher */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tB002EC137CC03571840EA88A5466F78C /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t95FF0E1B114CD91238B0AFC198D2CAA2 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t70B138ADAF3ED65D826BB775062E45D3 /* alter.c in Sources */,\n\t\t\t\t086ECBBBF3BCC1A6B81D5EF1D70C8A7F /* analyze.c in Sources */,\n\t\t\t\tE8CFBAC39BFBA9072D76EFD8BED71021 /* attach.c in Sources */,\n\t\t\t\t74F652B131BFEC3B7E9F5F826285F51F /* auth.c in Sources */,\n\t\t\t\t75FD788B8B65A957BC3CB344744B94F0 /* backup.c in Sources */,\n\t\t\t\t24A589CE392D5D18C6BEC3A0B7C783D6 /* bitvec.c in Sources */,\n\t\t\t\t382AF1D5DEE1F6873D6560D11F960694 /* btmutex.c in Sources */,\n\t\t\t\t4398BFDCE042AB0B217F9EE1D4470D2C /* btree.c in Sources */,\n\t\t\t\t9D8EEF819AE4F032C407DF8825BE4021 /* build.c in Sources */,\n\t\t\t\t5FBF1CB5E45D7007F9DBB64C53CD07C4 /* callback.c in Sources */,\n\t\t\t\t043ACCF720B9550BAFD6A6FFC74D58D8 /* complete.c in Sources */,\n\t\t\t\t1DAA571F6004AC252CA41DFE13A161CB /* crypto.c in Sources */,\n\t\t\t\t52AB1BAF4304384AC31E0AC01F5218C1 /* crypto_cc.c in Sources */,\n\t\t\t\t8F7859BA3E438C8D535351CAA04A87CF /* crypto_impl.c in Sources */,\n\t\t\t\t3B74E52618782846004B2EFFE66D2CB6 /* crypto_libtomcrypt.c in Sources */,\n\t\t\t\t9712E69F6897A79932E7356D17B4EFE6 /* ctime.c in Sources */,\n\t\t\t\tC0EA54E3A77CD32A4EB26558ED1C7048 /* date.c in Sources */,\n\t\t\t\t5FE3EA8A43323CA4A27E46E76B8F85E8 /* dbstat.c in Sources */,\n\t\t\t\tC4B693D99CC1E421C3651237D253713A /* delete.c in Sources */,\n\t\t\t\t2B78928D029F702E10AC2E979AAE30F4 /* expr.c in Sources */,\n\t\t\t\t16FF60E261C45FC2070F0D98E736A57A /* fault.c in Sources */,\n\t\t\t\t1BDEB5F15FAF45E9F721B441961B8C34 /* fkey.c in Sources */,\n\t\t\t\t887ECB05F844B509135EA9D2E49F4756 /* fts3.c in Sources */,\n\t\t\t\t80F23ACEC34F28241FC4D3D988D6B46B /* fts3_aux.c in Sources */,\n\t\t\t\t09544F9659FB1F6405E61B616127BA78 /* fts3_expr.c in Sources */,\n\t\t\t\t2912D7785B90B909F2146257B43E0AB0 /* fts3_hash.c in Sources */,\n\t\t\t\tD20DF4AFA08F00F6F3DF98080DA8482D /* fts3_icu.c in Sources */,\n\t\t\t\t3EB317C1027FB4897697E355AF8D16B5 /* fts3_porter.c in Sources */,\n\t\t\t\tA0C4CA370E50E4C8643B99A883633888 /* fts3_snippet.c in Sources */,\n\t\t\t\t0DA5A38897211085AF6EF8F48509A35B /* fts3_tokenize_vtab.c in Sources */,\n\t\t\t\t1889A9404CD0C0E28CC9920FD937E3AF /* fts3_tokenizer.c in Sources */,\n\t\t\t\t6B9C2AB81C98C177A776BE6A4EA2A6BD /* fts3_tokenizer1.c in Sources */,\n\t\t\t\tD1D9C0F63980292F29C3F37D63BDF176 /* fts3_unicode.c in Sources */,\n\t\t\t\tD15097F68A356C28CE0BF9C91B637499 /* fts3_unicode2.c in Sources */,\n\t\t\t\t65E253F98D1812924AA7C3B8626EE044 /* fts3_write.c in Sources */,\n\t\t\t\t74BF8A62A6C4634264C0778AE2432DB7 /* fts5.c in Sources */,\n\t\t\t\t17A30843D8D9CED76363E7C3CEF162C4 /* func.c in Sources */,\n\t\t\t\tA5CA0C886F0E55B268DC2B44FFA29B91 /* global.c in Sources */,\n\t\t\t\t3796A5DFBC47658BC7E86A958E8F37C1 /* hash.c in Sources */,\n\t\t\t\t2A4B692D0B2FC5CF4DD1911B12F64908 /* icu.c in Sources */,\n\t\t\t\tB32C03E8A710DAABFD445B2607751C90 /* insert.c in Sources */,\n\t\t\t\t713F875F484933076CC14508AE206381 /* legacy.c in Sources */,\n\t\t\t\t5C71CBFFD72CBA17837586C1AAFB7D77 /* loadext.c in Sources */,\n\t\t\t\tFF8000A24E39BCC20BFA15D2D63AD0BE /* main.c in Sources */,\n\t\t\t\t217AB62C5B931789431ABED1AA6CCE3D /* malloc.c in Sources */,\n\t\t\t\t3E8DB8B452854518706AC210252D5D5B /* mem0.c in Sources */,\n\t\t\t\tA40BFF6BD5669424AC49EC8955A286CB /* mem1.c in Sources */,\n\t\t\t\tF71DEF6C3C64B71C4C7F2FFE5CADF31E /* mem2.c in Sources */,\n\t\t\t\t538C1DF20605C513C9F5A8A4A0562A67 /* mem3.c in Sources */,\n\t\t\t\tBCD534F6AE3C303AB71FCDBDE6BADF1C /* mem5.c in Sources */,\n\t\t\t\t84AA63B938B22245F5E0DD20C3C0BE31 /* memjournal.c in Sources */,\n\t\t\t\t765E8BDC962AC8D57C0AF8C184764B16 /* mutex.c in Sources */,\n\t\t\t\t7731A5E7A6661574BBE900C1B94F3C74 /* mutex_noop.c in Sources */,\n\t\t\t\tA1D8FEA6430105CF9244B8E3A1BECAB8 /* mutex_unix.c in Sources */,\n\t\t\t\tE980E1084A188A7F6318F23BAE741750 /* mutex_wcdb.c in Sources */,\n\t\t\t\tE48632504681F1CA5D2B9BF3EDB9C9F2 /* notify.c in Sources */,\n\t\t\t\t134E6A8F537AF5F24136750B077D6822 /* opcodes.c in Sources */,\n\t\t\t\tB9ADE4C107A282EA32728A9CCF0E2B51 /* os.c in Sources */,\n\t\t\t\tAA92C333BFF068784E18D0451D9E0AD2 /* os_unix.c in Sources */,\n\t\t\t\tA62210DEF0CC8CF10EAA3F8F16B05279 /* os_wcdb.c in Sources */,\n\t\t\t\t37D869D1E39E0F6980A26FFD9F50D730 /* pager.c in Sources */,\n\t\t\t\tC62DF52D484AC2F663A46065A64AFF38 /* parse.c in Sources */,\n\t\t\t\tD293BCC1F74D1EB76F2C3503F0785E77 /* pcache.c in Sources */,\n\t\t\t\tC01F82CB0A1EFF2E5424110900541504 /* pcache1.c in Sources */,\n\t\t\t\t8597A704713FE849EDC4F865D0308F20 /* pragma.c in Sources */,\n\t\t\t\t9AF5EC6809F417A9E0456A01BDA1858A /* prepare.c in Sources */,\n\t\t\t\t4AF7AE5D6EF14A134D288C5D5C4E2D61 /* printf.c in Sources */,\n\t\t\t\t9161FDA5D85B4A8AC166C82958AB19A3 /* queue.c in Sources */,\n\t\t\t\t3AF960E0330666382269BD45A5B62948 /* random.c in Sources */,\n\t\t\t\t6BA80ECFA75D7799B0E63205FCFEA034 /* resolve.c in Sources */,\n\t\t\t\tDE6C09FEBBE6D09776A4CDE50F885880 /* rowset.c in Sources */,\n\t\t\t\t0EA8935B3590163C3C877E3A1C61E49F /* rtree.c in Sources */,\n\t\t\t\tC5DF43B3246A45C92CA9F65206225D08 /* select.c in Sources */,\n\t\t\t\tA382A069E6448B2E11A7C50E5446074C /* sqlite3rbu.c in Sources */,\n\t\t\t\t9A0AF04C08614AE039C0FB82ABD4BBC4 /* status.c in Sources */,\n\t\t\t\tE9D23397E76C36DF3AA3B68846F8192A /* table.c in Sources */,\n\t\t\t\t86FACB3B0DDC8ABB05745865EB4A80C5 /* threads.c in Sources */,\n\t\t\t\t317CA528BF1CC438A0713877CC54DF7C /* tokenize.c in Sources */,\n\t\t\t\t58A7E8A33CF3CF5F9356776AFA532391 /* treeview.c in Sources */,\n\t\t\t\t764C4513049DD17FA6F13BBEAD9FC9EF /* trigger.c in Sources */,\n\t\t\t\t9A6164C6B81251208E9F0FE10456E077 /* update.c in Sources */,\n\t\t\t\tBF1B9921683E1CC9CCE92CB100353180 /* utf.c in Sources */,\n\t\t\t\t5AD212A59EFC714B69C84CC43E7CB3FF /* util.c in Sources */,\n\t\t\t\t55DCF375BF50253400A95667292806E7 /* vacuum.c in Sources */,\n\t\t\t\t1BEBE236DCFE7DB5BFAE45E6BC9789D0 /* vdbe.c in Sources */,\n\t\t\t\tDCDEAA79E5FE0F51FB280AAE91E7B173 /* vdbeapi.c in Sources */,\n\t\t\t\t9C456714EC7C859B2AC0A0C4DD11A6A6 /* vdbeaux.c in Sources */,\n\t\t\t\tB6F600ACB50C3D912C85966583C74948 /* vdbeblob.c in Sources */,\n\t\t\t\t2FC562B90F631F8FFBFCA8130C53AF9B /* vdbemem.c in Sources */,\n\t\t\t\t04F059E7EC3B21B0AE7AA8CC2AFA97A4 /* vdbesort.c in Sources */,\n\t\t\t\t5138758EA23D8FA509240C4824D3C43A /* vdbetrace.c in Sources */,\n\t\t\t\t8CB34315414362CE2CBE833F78B83BEB /* vtab.c in Sources */,\n\t\t\t\t313FB26D8BA160E88D509EFC47311DCB /* wal.c in Sources */,\n\t\t\t\tC84A95A97D76FB1DFE9C5520BA57FC03 /* walker.c in Sources */,\n\t\t\t\tC92DD37DC9E13597C5F74A0E9F91961E /* WCDBOptimizedSQLCipher-dummy.m in Sources */,\n\t\t\t\t9D40AEE536FBB1086E7A28F011555C0F /* where.c in Sources */,\n\t\t\t\t2C00E9D43090AFC189BD478A56118EFD /* wherecode.c in Sources */,\n\t\t\t\t71FFCD64370877D3180086B00EDA7767 /* whereexpr.c in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t074CC0DF16BA906E14DE59A240BF1397 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = DB8F78AF186FCB18268F938C619D94C9 /* WCDBOptimizedSQLCipher.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = sqlcipher;\n\t\t\t\tPRODUCT_NAME = sqlcipher;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t48428442BA05BEE2F67A589765C4BAC9 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t4CF564E6E42E83E6435E90AA2C8B3532 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tD02C13E3CFE802B76020D3109181DF3F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 08682B39026711259E97F41DFDB2CFAB /* WCDBOptimizedSQLCipher.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/WCDBOptimizedSQLCipher/WCDBOptimizedSQLCipher.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = sqlcipher;\n\t\t\t\tPRODUCT_NAME = sqlcipher;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\tB89F9BE20D4D31D1A87BA57C4F35FBC2 /* Build configuration list for PBXProject \"WCDBOptimizedSQLCipher\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t4CF564E6E42E83E6435E90AA2C8B3532 /* Debug */,\n\t\t\t\t48428442BA05BEE2F67A589765C4BAC9 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tE7805B209F531D59B41B6BC54226E5C1 /* Build configuration list for PBXNativeTarget \"WCDBOptimizedSQLCipher\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD02C13E3CFE802B76020D3109181DF3F /* Debug */,\n\t\t\t\t074CC0DF16BA906E14DE59A240BF1397 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = F789038590B81C9A16D6ABFF18F9F7E4 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 杨波\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/README.md",
    "content": "![](https://github.com/indulgeIn/YBImageBrowser/blob/master/Images/banner.png)\n\n[![CocoaPods](https://img.shields.io/cocoapods/v/YBImageBrowser.svg)](https://cocoapods.org/pods/YBImageBrowser)&nbsp;\n[![CocoaPods](https://img.shields.io/cocoapods/p/YBImageBrowser.svg)](https://github.com/indulgeIn/YBImageBrowser)&nbsp;\n[![License](https://img.shields.io/github/license/indulgeIn/YBImageBrowser.svg)](https://github.com/indulgeIn/YBImageBrowser)&nbsp;\n\n**iOS 图片浏览器，功能强大，易于拓展，性能优化和内存控制让其运行更加的流畅和稳健。**\n\n##### 相关文章：\n##### [YBImageBrowser 重构心得：如何优化架构、性能、内存？](https://www.jianshu.com/p/ef53d0094437)\n##### [避免 iOS 组件依赖冲突的小技巧](https://www.jianshu.com/p/0e3283275300)\n\n\n## 注意事项\n\n#### 关于 3.x 版本 (使用 2.x 版本请切换到 store_2.x 分支)\n\n为了彻底解决 2.x 版本的设计缺陷和代码漏洞，特花费大量业余时间进行了 3.x 深度重构，所以没办法做到向下兼容，希望社区朋友们能体谅，根据情况进行版本迁移。\n3.x 版本有着更科学的架构，更极致的性能提升，更严格的内存控制，使用起来会更得心应手，也便于将来的迭代优化。\n\n#### 提问须知\n\n考虑到笔者的精力问题，遇到问题请先查看 API、效仿 Demo、阅读 README、搜索 Issues。请不要提出与组件无关的问题，比如 CocoaPods 的错误，如果是 BUG 或 Feature 最好是提 Issue。\n\n# 目录\n\n* [预览](#预览)\n* [特性](#特性)\n* [安装](#安装)\n* [用法](#用法)\n* [常见问题](#常见问题)\n\n\n# 预览\n\n![](https://github.com/indulgeIn/YBImageBrowser/blob/master/Images/preview.gif)\n\n\n\n# 特性\n\n- 支持 GIF，APNG，WebP 等本地和网络图片类型（由 YYImage、SDWebImage 提供支持）。\n- 支持系统相册图片和视频。\n- 支持简单的视频播放。\n- 支持高清图浏览。\n- 支持图片预处理（比如添加水印）。\n- 支持根据图片的大小判断是否需要预先解码（精确控制内存）。\n- 支持图片压缩、裁剪的界限设定。\n- 支持修改下载图片的 NSURLRequest。\n- 支持主动旋转或跟随控制器旋转。\n- 支持自定义图标。\n- 支持自定义 Toast/Loading。\n- 支持自定义文案（默认提供中文和英文）。\n- 支持自定义工具视图（比如查看原图功能）。\n- 支持自定义 Cell（比如添加一个广告模块）。\n- 支持添加到其它父视图上使用（比如加到控制器上）。\n- 支持转场动效、图片布局等深度定制。\n- 支持数据重载、局部更新。\n- 支持低粒度的内存控制和性能调优。\n- 极致的性能优化和严格的内存控制让其运行更加的流畅和稳健。\n\n\n# 安装\n\n## CocoaPods\n\n支持分库导入，核心部分就是图片浏览功能，视频播放作为拓展功能按需导入。\n\n1. 在 Podfile 中添加：\n```\npod 'YBImageBrowser'\npod 'YBImageBrowser/Video'  //视频功能需添加\n```\n2. 执行 `pod install` 或 `pod update`。\n3. 导入 `<YBImageBrowser/YBImageBrowser.h>`，视频功能需导入`<YBImageBrowser/YBIBVideoData.h>`。\n4. 注意：如果你需要支持 WebP，可以在 Podfile 中添加 `pod 'YYImage/WebP'`。\n\n若搜索不到库，可执行`pod repo update`，或使用 `rm ~/Library/Caches/CocoaPods/search_index.json` 移除本地索引然后再执行安装，或更新一下 CocoaPods 版本。\n\n#### 去除 SDWebImage 的依赖（版本需 >= 3.0.4）\n\nPodfile 相应的配置变为：\n```\npod 'YBImageBrowser/NOSD'\npod 'YBImageBrowser/VideoNOSD'  //视频功能需添加\n```\n这时你必须定义一个类实现`YBIBWebImageMediator`协议，并赋值给`YBImageBrowser`类的`webImageMediator`属性（可以参考 `YBIBDefaultWebImageMediator`的实现）。\n\n\n## 手动导入\n\n1. 下载 YBImageBrowser 文件夹所有内容并且拖入你的工程中，视频功能还需下载 Video 文件夹所有内容。\n2. 链接以下 frameworks：\n* SDWebImage\n* YYImage\n3. 导入 `YBImageBrowser.h`，视频功能需导入`YBIBVideoData.h`\n4. 注意：如果你需要支持 WebP，可以在 Podfile 中添加 `pod 'YYImage/WebP'`，或者到手动下载 [YYImage 仓库](https://github.com/ibireme/YYImage) 的 webP 支持文件。\n\n\n\n\n# 用法\n\n初始化`YBImageBrowser`并且赋值数据源`id<YBIBDataProtocol>`，默认提供`YBIBImageData` (图片) 和`YBIBVideoData` (视频) 两种数据源。\n\n图片处理是组件的核心，笔者精力有限，视频播放做得很轻量，若有更高的要求最好是自定义 Cell，望体谅。\n\nDemo 中提供了很多示例代码，演示较复杂的拓展方式，所以若需要深度定制最好是下载 Demo 查看。\n\n建议不对`YBImageBrowser`进行复用，目前还存在一些逻辑漏洞。\n\n\n## 基本使用\n\n```\n// 本地图片\nYBIBImageData *data0 = [YBIBImageData new];\ndata0.imageName = ...;\ndata0.projectiveView = ...;\n\n// 网络图片\nYBIBImageData *data1 = [YBIBImageData new];\ndata1.imageURL = ...;\ndata1.projectiveView = ...;\n\n// 视频\nYBIBVideoData *data2 = [YBIBVideoData new];\ndata2.videoURL = ...;\ndata2.projectiveView = ...;\n\nYBImageBrowser *browser = [YBImageBrowser new];\nbrowser.dataSourceArray = @[data0, data1, data2];\nbrowser.currentPage = ...;\n[browser show];\n```\n\n\n## 设置支持的旋转方向\n\n当图片浏览器依托的 UIViewController 仅支持一个方向：\n\n这种情况通过`YBImageBrowser.new.supportedOrientations`设置图片浏览器支持的旋转方向。\n\n否则：\n\n上面的属性将失效，图片浏览器会跟随控制器的旋转而旋转，由于各种原因这种情况的旋转过渡有瑕疵，建议不使用这种方式。\n\n\n## 自定义图标\n\n修改`YBIBIconManager.sharedManager`实例的属性。\n\n\n## 自定义文案\n\n修改`YBIBCopywriter.sharedCopywriter`实例的属性。\n\n\n## 自定义 Toast / Loading\n\n实现`YBIBAuxiliaryViewHandler`协议，并且赋值给`YBImageBrowser.new.auxiliaryViewHandler`属性，可参考和协议同名的默认实现类。\n\n\n## 自定义工具视图（ToolView）\n\n默认实现的`YBImageBrowser.new.defaultToolViewHandler`处理器可以做一些属性配置，当满足不了业务需求时，最好是进行自定义，参考默认实现或 Demo 中“查看原图”功能实现。\n\n定义一个或多个类实现`YBIBToolViewHandler`协议，并且装入`YBImageBrowser.new.toolViewHandlers`数组属性。建议使用一个中介者来实现这个协议，然后所有的工具视图都由这个中介者来管理，当然也可以让每一个自定义的工具 UIView 都实现`YBIBToolViewHandler`协议，请根据具体需求取舍。\n\n\n## 自定义 Cell\n\n当默认提供的`YBIBImageData` (图片) 和`YBIBVideoData` (视频) 满足不了需求时，可自定义拓展 Cell，参考默认实现或 Demo 中的示例代码。\n\n定义一个实现`YBIBCellProtocol`协议的`UICollectionViewCell`类和一个实现`YBIBDataProtocol`协议的数据类，当要求不高时实现必选协议方法就能跑起来了，若对交互有要求就相对比较复杂，最好是参考默认的交互动效实现。\n\n在某些场景下，甚至可以直接继承项目中的 Cell 来做自定义。\n\n\n# 常见问题\n\n## SDWebImage Pods 版本兼容问题\n\nSDWebImage 有两种情况会出现兼容问题：该库对 SDWebImage 采用模糊向上依赖，但将来 SDWebImage 可能没做好向下兼容；当其它库依赖 SDWebImage 更低或更高 API 不兼容版本。对于这种情况，可以尝试以下方式解决：\n- Podfile 中采用去除 SDWebImage 依赖的方式导入，只需要实现一个中介者（见[安装](#安装)部分）。\n- 更改其它库对 SDWebImage 的依赖版本。\n- 手动导入 YBImageBrowser，然后修改`YBIBDefaultWebImageMediator`文件。\n\n为什么不去除依赖 SDWebImage 自己实现？时间成本太高。\n为什么不拖入 SDWebImage 修改类名？会扩大组件的体积，若外部有 SDWebImage 就存在一份多余代码。\n\n## 依赖的 YYImage 与项目依赖的 YYKit 冲突\n\n实际上 YYKit 有把各个组件拆分出来，建议项目中分开导入：\n```\npod 'YYModel'\npod 'YYCache'\npod 'YYImage'\npod 'YYWebImage'\npod 'YYText'\n...\n```\n而且这样更灵活便于取舍。\n\n## 低内存设备 OOM 问题\n\n组件内部会降低在低内存设备上的性能，减小内存占用，但若高清图过多，可能需要手动去控制（以下是硬件消耗很低的状态）：\n\n```\nYBIBImageData *data = YBIBImageData.new;\n// 取消预解码\ndata.shouldPreDecodeAsync = NO;\n// 直接设大触发裁剪比例，绘制更小的裁剪区域压力更小，不过可能会让用户感觉奇怪，放很大才开始裁剪显示高清局部（这个属性很多时候不需要显式设置，内部会动态计算）\ndata.cuttingZoomScale = 10;\n\nYBImageBrowser *browser = YBImageBrowser.new;\n// 调低图片的缓存数量\nbrowser.ybib_imageCache.imageCacheCountLimit = 1;\n// 预加载数量设为 0\nbrowser.preloadCount = 0;\n```\n\n## 视频播放功能简陋\n\n关于大家提的关于视频的需求，有些成本过高，笔者精力有限望体谅。若组件默认的视频播放器满足不了需求，就自定义一个 Cell 吧，把成熟的播放器集成到组件中肯定更加的稳定。\n\n## 关于 Swift 版本\n\n考虑时间成本，目前没有写 Swift 版本的计划。 \n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoActionBar.h",
    "content": "//\n//  YBIBVideoActionBar.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBIBVideoActionBar;\n\n@protocol YBIBVideoActionBarDelegate <NSObject>\n@required\n\n- (void)yb_videoActionBar:(YBIBVideoActionBar *)actionBar clickPlayButton:(UIButton *)playButton;\n\n- (void)yb_videoActionBar:(YBIBVideoActionBar *)actionBar clickPauseButton:(UIButton *)pauseButton;\n\n- (void)yb_videoActionBar:(YBIBVideoActionBar *)actionBar changeValue:(float)value;\n\n@end\n\n@interface YBIBVideoActionBar : UIView\n\n@property (nonatomic, weak) id<YBIBVideoActionBarDelegate> delegate;\n\n- (void)setMaxValue:(float)value;\n\n- (void)setCurrentValue:(float)value;\n\n- (void)pause;\n\n- (void)play;\n\n+ (CGFloat)defaultHeight;\n\n@property (nonatomic, assign, readonly) BOOL isTouchInside;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoActionBar.m",
    "content": "//\n//  YBIBVideoActionBar.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBVideoActionBar.h\"\n#import \"YBIBIconManager.h\"\n\n\n@interface YBVideoBrowseActionSlider : UISlider\n@end\n@implementation YBVideoBrowseActionSlider\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self setThumbImage:YBIBIconManager.sharedManager.videoDragCircleImage() forState:UIControlStateNormal];\n        self.minimumTrackTintColor = UIColor.whiteColor;\n        self.maximumTrackTintColor = [UIColor.whiteColor colorWithAlphaComponent:0.5];\n        self.layer.shadowColor = UIColor.darkGrayColor.CGColor;\n        self.layer.shadowOffset = CGSizeMake(0, 1);\n        self.layer.shadowOpacity = 1;\n        self.layer.shadowRadius = 4;\n    }\n    return self;\n}\n- (CGRect)trackRectForBounds:(CGRect)bounds {\n    CGRect frame = [super trackRectForBounds:bounds];\n    return CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, 2);\n}\n- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value {\n    CGRect frame = [super thumbRectForBounds:bounds trackRect:rect value:value];\n    return CGRectMake(frame.origin.x - 10, frame.origin.y - 10, frame.size.width + 20, frame.size.height + 20);\n}\n@end\n\n\n@interface YBIBVideoActionBar ()\n@property (nonatomic, strong) UIButton *playButton;\n@property (nonatomic, strong) UILabel *preTimeLabel;\n@property (nonatomic, strong) UILabel *sufTimeLabel;\n@property (nonatomic, strong) YBVideoBrowseActionSlider *slider;\n@end\n\n@implementation YBIBVideoActionBar {\n    BOOL _dragging;\n}\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        _dragging = NO;\n        [self addSubview:self.playButton];\n        [self addSubview:self.preTimeLabel];\n        [self addSubview:self.sufTimeLabel];\n        [self addSubview:self.slider];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    CGFloat width = self.bounds.size.width, height = self.bounds.size.height, labelWidth = 55, buttonWidth = 44, labelOffset = 10;\n    CGFloat imageWidth = YBIBIconManager.sharedManager.videoPlayImage().size.width;\n    CGFloat offset = (buttonWidth - imageWidth) * 0.5;\n    \n    self.playButton.frame = CGRectMake(10, 0, buttonWidth, height);\n    self.preTimeLabel.frame = CGRectMake(CGRectGetMaxX(self.playButton.frame) + labelOffset - offset, 0, labelWidth, height);\n    self.sufTimeLabel.frame = CGRectMake(width - labelWidth - labelOffset, 0, labelWidth, height);\n    self.slider.frame = CGRectMake(CGRectGetMaxX(self.preTimeLabel.frame), 0, CGRectGetMinX(self.sufTimeLabel.frame) - CGRectGetMaxX(self.preTimeLabel.frame), height);\n}\n\n#pragma mark - public\n\n+ (CGFloat)defaultHeight {\n    return 44;\n}\n\n- (void)setMaxValue:(float)value {\n    self.slider.maximumValue = value;\n    self.sufTimeLabel.attributedText = [self.class timeformatFromSeconds:value];\n}\n\n- (void)setCurrentValue:(float)value {\n    if (!_dragging) {\n        [self.slider setValue:value animated:YES];\n    }\n    self.preTimeLabel.attributedText = [self.class timeformatFromSeconds:value];\n}\n\n- (void)pause {\n    self.playButton.selected = NO;\n}\n\n- (void)play {\n    _dragging = NO;\n    self.playButton.selected = YES;\n    self.slider.userInteractionEnabled = YES;\n}\n\n#pragma mark - private\n\n+ (NSAttributedString *)timeformatFromSeconds:(NSInteger)seconds {\n    NSInteger hour = seconds / 3600, min = (seconds % 3600) / 60, sec = seconds % 60;\n    NSString *text = seconds > 3600 ? [NSString stringWithFormat:@\"%02ld:%02ld:%02ld\", (long)hour, (long)min, (long)sec] : [NSString stringWithFormat:@\"%02ld:%02ld\", (long)min, (long)sec];\n    \n    NSShadow *shadow = [NSShadow new];\n    shadow.shadowBlurRadius = 4;\n    shadow.shadowOffset = CGSizeMake(0, 1);\n    shadow.shadowColor = UIColor.darkGrayColor;\n    NSAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSShadowAttributeName:shadow, NSFontAttributeName:[UIFont boldSystemFontOfSize:11]}];\n    return attr;\n}\n\n#pragma mark - touch event\n\n- (void)clickPlayButton:(UIButton *)button {\n    button.userInteractionEnabled = NO;\n    if (button.selected) {\n        [self.delegate yb_videoActionBar:self clickPauseButton:button];\n    } else {\n        [self.delegate yb_videoActionBar:self clickPlayButton:button];\n    }\n    button.userInteractionEnabled = YES;\n}\n\n- (void)respondsToSliderTouchFinished:(UISlider *)slider {\n    [self.delegate yb_videoActionBar:self changeValue:slider.value];\n}\n\n- (void)respondsToSliderTouchDown:(UISlider *)slider {\n    _dragging = YES;\n    slider.userInteractionEnabled = NO;\n}\n\n#pragma mark - getters\n\n- (UIButton *)playButton {\n    if (!_playButton) {\n        _playButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        [_playButton setImage:YBIBIconManager.sharedManager.videoPlayImage() forState:UIControlStateNormal];\n        [_playButton setImage:YBIBIconManager.sharedManager.videoPauseImage() forState:UIControlStateSelected];\n        [_playButton addTarget:self action:@selector(clickPlayButton:) forControlEvents:UIControlEventTouchUpInside];\n        _playButton.layer.shadowColor = UIColor.darkGrayColor.CGColor;\n        _playButton.layer.shadowOffset = CGSizeMake(0, 1);\n        _playButton.layer.shadowOpacity = 1;\n        _playButton.layer.shadowRadius = 4;\n    }\n    return _playButton;\n}\n\n- (UILabel *)preTimeLabel {\n    if (!_preTimeLabel) {\n        _preTimeLabel = [UILabel new];\n        _preTimeLabel.attributedText = [self.class timeformatFromSeconds:0];\n        _preTimeLabel.adjustsFontSizeToFitWidth = YES;\n        _preTimeLabel.textAlignment = NSTextAlignmentCenter;\n        _preTimeLabel.textColor = [UIColor.whiteColor colorWithAlphaComponent:0.9];\n    }\n    return _preTimeLabel;\n}\n\n- (UILabel *)sufTimeLabel {\n    if (!_sufTimeLabel) {\n        _sufTimeLabel = [UILabel new];\n        _sufTimeLabel.attributedText = [self.class timeformatFromSeconds:0];\n        _sufTimeLabel.adjustsFontSizeToFitWidth = YES;\n        _sufTimeLabel.textAlignment = NSTextAlignmentCenter;\n        _sufTimeLabel.textColor = [UIColor.whiteColor colorWithAlphaComponent:0.9];\n    }\n    return _sufTimeLabel;\n}\n\n- (YBVideoBrowseActionSlider *)slider {\n    if (!_slider) {\n        _slider = [YBVideoBrowseActionSlider new];\n        [_slider addTarget:self action:@selector(respondsToSliderTouchFinished:) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchCancel|UIControlEventTouchUpOutside];\n        [_slider addTarget:self action:@selector(respondsToSliderTouchDown:) forControlEvents:UIControlEventTouchDown];\n    }\n    return _slider;\n}\n\n- (BOOL)isTouchInside {\n    return self.slider.isTouchInside;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoCell+Internal.h",
    "content": "//\n//  YBIBVideoCell+Internal.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/12/23.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBVideoCell.h\"\n#import \"YBIBVideoView.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBVideoCell ()\n\n@property (nonatomic, strong) YBIBVideoView *videoView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoCell.h",
    "content": "//\n//  YBIBVideoCell.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/10.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBCellProtocol.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBVideoCell : UICollectionViewCell <YBIBCellProtocol>\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoCell.m",
    "content": "//\n//  YBIBVideoCell.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/10.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBVideoCell.h\"\n#import \"YBIBVideoData.h\"\n#import \"YBIBVideoData+Internal.h\"\n#import \"YBIBCopywriter.h\"\n#import \"YBIBIconManager.h\"\n#import <objc/runtime.h>\n#import \"YBIBVideoCell+Internal.h\"\n\n@interface NSObject (YBIBVideoPlayingRecord)\n- (void)ybib_videoPlayingAdd:(NSObject *)obj;\n- (void)ybib_videoPlayingRemove:(NSObject *)obj;\n- (BOOL)ybib_noVideoPlaying;\n@end\n@implementation NSObject (YBIBVideoPlayingRecord)\n- (NSMutableSet *)ybib_videoPlayingSet {\n    static void *kRecordKey = &kRecordKey;\n    NSMutableSet *set = objc_getAssociatedObject(self, kRecordKey);\n    if (!set) {\n        set = [NSMutableSet set];\n        objc_setAssociatedObject(self, kRecordKey, set, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    return set;\n}\n- (void)ybib_videoPlayingAdd:(NSObject *)obj {\n    [[self ybib_videoPlayingSet] addObject:[NSString stringWithFormat:@\"%p\", obj]];\n}\n- (void)ybib_videoPlayingRemove:(NSObject *)obj {\n    [[self ybib_videoPlayingSet] removeObject:[NSString stringWithFormat:@\"%p\", obj]];\n}\n- (BOOL)ybib_noVideoPlaying {\n    return [self ybib_videoPlayingSet].count == 0;\n}\n@end\n\n\n@interface YBIBVideoCell () <YBIBVideoDataDelegate, YBIBVideoViewDelegate, UIGestureRecognizerDelegate>\n@end\n\n@implementation YBIBVideoCell {\n    CGPoint _interactStartPoint;\n    BOOL _interacting;\n}\n\n#pragma mark - life cycle\n\n- (void)dealloc {\n    [self.yb_backView ybib_videoPlayingRemove:self];\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self initValue];\n        [self.contentView addSubview:self.videoView];\n        [self addGesture];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    self.videoView.frame = self.bounds;\n}\n\n- (void)initValue {\n    _interactStartPoint = CGPointZero;\n    _interacting = NO;\n}\n\n- (void)prepareForReuse {\n    ((YBIBVideoData *)self.yb_cellData).delegate = nil;\n    self.videoView.thumbImageView.image = nil;\n    [self hideAuxiliaryView];\n    [self.videoView reset];\n    self.videoView.asset = nil;\n    [super prepareForReuse];\n}\n\n#pragma mark - private\n\n- (void)hideAuxiliaryView {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    [self.yb_auxiliaryViewHandler() yb_hideToastWithContainer:self];\n}\n\n- (void)updateImageLayoutWithOrientation:(UIDeviceOrientation)orientation previousImageSize:(CGSize)previousImageSize {\n    YBIBVideoData *data = self.yb_cellData;\n    UIImage *image = self.videoView.thumbImageView.image;\n    CGSize imageSize = image.size;\n    \n    CGRect imageViewFrame = [data yb_imageViewFrameWithContainerSize:self.yb_containerSize(orientation) imageSize:imageSize orientation:orientation];\n    \n    CGFloat scale;\n    if (previousImageSize.width > 0 && previousImageSize.height > 0) {\n        scale = imageSize.width / imageSize.height - previousImageSize.width / previousImageSize.height;\n    } else {\n        scale = 0;\n    }\n    // '0.001' is admissible error.\n    if (ABS(scale) <= 0.001) {\n        self.videoView.thumbImageView.frame = imageViewFrame;\n    } else {\n        [UIView animateWithDuration:0.25 animations:^{\n            self.videoView.thumbImageView.frame = imageViewFrame;\n        }];\n    }\n}\n\n- (void)hideBrowser {\n    ((YBIBVideoData *)self.yb_cellData).delegate = nil;\n    self.videoView.thumbImageView.hidden = NO;\n    self.videoView.autoPlayCount = 0;\n    [self.videoView reset];\n    [self.videoView hideToolBar:YES];\n    [self.videoView hidePlayButton];\n    self.yb_hideBrowser();\n    _interacting = NO;\n}\n\n- (void)hideToolViews:(BOOL)hide {\n    if (hide) {\n        self.yb_hideToolViews(YES);\n    } else {\n        if ([self.yb_backView ybib_noVideoPlaying]) {\n            self.yb_hideToolViews(NO);\n        }\n    }\n}\n\n#pragma mark - <YBIBCellProtocol>\n\n@synthesize yb_currentOrientation = _yb_currentOrientation;\n@synthesize yb_containerSize = _yb_containerSize;\n@synthesize yb_backView = _yb_backView;\n@synthesize yb_collectionView = _yb_collectionView;\n@synthesize yb_isTransitioning = _yb_isTransitioning;\n@synthesize yb_auxiliaryViewHandler = _yb_auxiliaryViewHandler;\n@synthesize yb_hideStatusBar = _yb_hideStatusBar;\n@synthesize yb_hideBrowser = _yb_hideBrowser;\n@synthesize yb_hideToolViews = _yb_hideToolViews;\n@synthesize yb_cellData = _yb_cellData;\n@synthesize yb_currentPage = _yb_currentPage;\n@synthesize yb_selfPage = _yb_selfPage;\n@synthesize yb_cellIsInCenter = _yb_cellIsInCenter;\n@synthesize yb_isRotating = _yb_isRotating;\n\n- (void)setYb_cellData:(id<YBIBDataProtocol>)yb_cellData {\n    _yb_cellData = yb_cellData;\n    YBIBVideoData *data = (YBIBVideoData *)yb_cellData;\n    data.delegate = self;\n    \n    UIDeviceOrientation orientation = self.yb_currentOrientation();\n    CGSize containerSize = self.yb_containerSize(orientation);\n    [self.videoView updateLayoutWithExpectOrientation:orientation containerSize:containerSize];\n    self.videoView.autoPlayCount = data.autoPlayCount;\n    self.videoView.topBar.cancelButton.hidden = data.shouldHideForkButton;\n}\n\n- (void)yb_orientationWillChangeWithExpectOrientation:(UIDeviceOrientation)orientation {\n    if (_interacting) [self restoreGestureInteractionWithDuration:0];\n}\n\n- (void)yb_orientationChangeAnimationWithExpectOrientation:(UIDeviceOrientation)orientation {\n    [self updateImageLayoutWithOrientation:orientation previousImageSize:self.videoView.thumbImageView.image.size];\n    CGSize containerSize = self.yb_containerSize(orientation);\n    [self.videoView updateLayoutWithExpectOrientation:orientation containerSize:containerSize];\n}\n\n- (UIView *)yb_foregroundView {\n    return self.videoView.thumbImageView;\n}\n\n- (void)yb_pageChanged {\n    if (self.yb_currentPage() != self.yb_selfPage()) {\n        [self.videoView reset];\n        [self hideToolViews:NO];\n        [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n        if (_interacting) [self restoreGestureInteractionWithDuration:0];\n        self.videoView.needAutoPlay = NO;\n    } else {\n        self.videoView.needAutoPlay = YES;\n    }\n}\n\n#pragma mark - <YBIBVideoDataDelegate>\n\n- (void)yb_startLoadingAVAssetFromPHAssetForData:(YBIBVideoData *)data {}\n\n- (void)yb_finishLoadingAVAssetFromPHAssetForData:(YBIBVideoData *)data {}\n\n- (void)yb_startLoadingFirstFrameForData:(YBIBVideoData *)data {\n    if (!self.videoView.thumbImageView.image) {\n        [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self];\n    }\n}\n\n- (void)yb_finishLoadingFirstFrameForData:(YBIBVideoData *)data {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n}\n\n- (void)yb_videoData:(YBIBVideoData *)data downloadingWithProgress:(CGFloat)progress {\n    [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self progress:progress];\n}\n\n- (void)yb_finishDownloadingForData:(YBIBVideoData *)data {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n}\n\n- (void)yb_videoData:(YBIBVideoData *)data readyForAVAsset:(AVAsset *)asset {\n    self.videoView.asset = asset;\n}\n\n- (void)yb_videoData:(YBIBVideoData *)data readyForThumbImage:(UIImage *)image {\n    if (!self.videoView.isPlaying) {\n        self.videoView.thumbImageView.hidden = NO;\n    }\n    \n    if (!self.videoView.thumbImageView.image) {\n        CGSize previousSize = self.videoView.thumbImageView.image.size;\n        self.videoView.thumbImageView.image = image;\n        [self updateImageLayoutWithOrientation:self.yb_currentOrientation() previousImageSize:previousSize];\n    }\n}\n\n- (void)yb_videoIsInvalidForData:(YBIBVideoData *)data {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    NSString *imageIsInvalid = [YBIBCopywriter sharedCopywriter].videoIsInvalid;\n    if (self.videoView.thumbImageView.image) {\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self text:imageIsInvalid];\n    } else {\n        [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self text:imageIsInvalid];\n    }\n}\n\n#pragma mark - <YBIBVideoViewDelegate>\n\n- (BOOL)yb_isFreezingForVideoView:(YBIBVideoView *)view {\n    return self.yb_isTransitioning();\n}\n\n- (void)yb_preparePlayForVideoView:(YBIBVideoView *)view {\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        if (!view.isPlaying && !view.isPlayFailed && self.yb_selfPage() == self.yb_currentPage()) {\n            [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self];\n        }\n    });\n}\n\n- (void)yb_startPlayForVideoView:(YBIBVideoView *)view {\n    self.videoView.thumbImageView.hidden = YES;\n    [self.yb_backView ybib_videoPlayingAdd:self];\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    [self hideToolViews:YES];\n}\n\n- (void)yb_didPlayToEndTimeForVideoView:(YBIBVideoView *)view {\n    YBIBVideoData *data = (YBIBVideoData *)self.yb_cellData;\n    if (data.repeatPlayCount == NSUIntegerMax) {\n        [view preparPlay];\n    } else if (data.repeatPlayCount > 0) {\n        --data.repeatPlayCount;\n        [view preparPlay];\n    } else {\n        [self hideToolViews:NO];\n    }\n}\n\n- (void)yb_finishPlayForVideoView:(YBIBVideoView *)view {\n    [self.yb_backView ybib_videoPlayingRemove:self];\n    [self hideToolViews:NO];\n}\n\n- (void)yb_playFailedForVideoView:(YBIBVideoView *)view {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self text:YBIBCopywriter.sharedCopywriter.videoError];\n}\n\n- (void)yb_respondsToTapGestureForVideoView:(YBIBVideoView *)view {\n    if (self.yb_isRotating()) return;\n    \n    YBIBVideoData *data = self.yb_cellData;\n    if (data.singleTouchBlock) {\n        data.singleTouchBlock(data);\n    } else {\n        [self hideBrowser];\n    }\n}\n\n- (void)yb_cancelledForVideoView:(YBIBVideoView *)view {\n    if (self.yb_isRotating()) return;\n    \n    [self hideBrowser];\n}\n\n- (CGSize)yb_containerSizeForVideoView:(YBIBVideoView *)view {\n    return self.yb_containerSize(self.yb_currentOrientation());\n}\n\n- (void)yb_autoPlayCountChanged:(NSUInteger)count {\n    YBIBVideoData *data = (YBIBVideoData *)self.yb_cellData;\n    data.autoPlayCount = count;\n}\n\n#pragma mark - <UIGestureRecognizerDelegate>\n\n- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {\n    return YES;\n}\n\n#pragma mark - gesture\n\n- (void)addGesture {\n    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(respondsToPanGesture:)];\n    panGesture.cancelsTouchesInView = NO;\n    panGesture.delegate = self;\n    [self.videoView.tapGesture requireGestureRecognizerToFail:panGesture];\n    [self.videoView addGestureRecognizer:panGesture];\n}\n\n- (void)respondsToPanGesture:(UIPanGestureRecognizer *)pan {\n    if (self.yb_isRotating()) return;\n    if ((!self.videoView.thumbImageView.image && !self.videoView.isPlaying)) return;\n    \n    YBIBInteractionProfile *profile = ((YBIBVideoData *)self.yb_cellData).interactionProfile;\n    if (profile.disable) return;\n    \n    CGPoint point = [pan locationInView:self];\n    CGSize containerSize = self.yb_containerSize(self.yb_currentOrientation());\n    \n    if (pan.state == UIGestureRecognizerStateBegan) {\n        _interactStartPoint = point;\n    } else if (pan.state == UIGestureRecognizerStateCancelled || pan.state == UIGestureRecognizerStateEnded || pan.state == UIGestureRecognizerStateRecognized || pan.state == UIGestureRecognizerStateFailed) {\n        \n        // End\n        if (_interacting) {\n            CGPoint velocity = [pan velocityInView:self.videoView];\n            \n            BOOL velocityArrive = ABS(velocity.y) > profile.dismissVelocityY;\n            BOOL distanceArrive = ABS(point.y - _interactStartPoint.y) > containerSize.height * profile.dismissScale;\n            \n            BOOL shouldDismiss = distanceArrive || velocityArrive;\n            if (shouldDismiss) {\n                [self hideBrowser];\n            } else {\n                [self restoreGestureInteractionWithDuration:profile.restoreDuration];\n            }\n        }\n        \n    } else if (pan.state == UIGestureRecognizerStateChanged) {\n        \n        if (_interacting) {\n            \n            // Change\n            self.videoView.center = point;\n            CGFloat scale = 1 - ABS(point.y - _interactStartPoint.y) / (containerSize.height * 1.2);\n            if (scale > 1) scale = 1;\n            if (scale < 0.35) scale = 0.35;\n            self.videoView.transform = CGAffineTransformMakeScale(scale, scale);\n            \n            CGFloat alpha = 1 - ABS(point.y - _interactStartPoint.y) / (containerSize.height * 0.7);\n            if (alpha > 1) alpha = 1;\n            if (alpha < 0) alpha = 0;\n            self.yb_backView.backgroundColor = [self.yb_backView.backgroundColor colorWithAlphaComponent:alpha];\n            \n        } else {\n            \n            // Start\n            if (CGPointEqualToPoint(_interactStartPoint, CGPointZero) || self.yb_currentPage() != self.yb_selfPage() || !self.yb_cellIsInCenter() || self.videoView.actionBar.isTouchInside) return;\n            \n            CGPoint velocityPoint = [pan velocityInView:self.videoView];\n            CGFloat triggerDistance = profile.triggerDistance;\n            \n            BOOL distanceArrive = ABS(point.y - _interactStartPoint.y) > triggerDistance && (ABS(point.x - _interactStartPoint.x) < triggerDistance && ABS(velocityPoint.x) < 500);\n            \n            BOOL shouldStart = distanceArrive;\n            if (!shouldStart) return;\n            \n            [self.videoView hideToolBar:YES];\n            \n            _interactStartPoint = point;\n            \n            CGRect startFrame = self.videoView.bounds;\n            CGFloat anchorX = (point.x - startFrame.origin.x) / startFrame.size.width,\n            anchorY = (point.y - startFrame.origin.y) / startFrame.size.height;\n            self.videoView.layer.anchorPoint = CGPointMake(anchorX, anchorY);\n            self.videoView.userInteractionEnabled = NO;\n            self.videoView.center = point;\n            \n            [self hideToolViews:YES];\n            self.yb_hideStatusBar(NO);\n            self.yb_collectionView().scrollEnabled = NO;\n            \n            _interacting = YES;\n        }\n    }\n}\n\n- (void)restoreGestureInteractionWithDuration:(NSTimeInterval)duration {\n    [self.videoView hideToolBar:NO];\n    \n    CGSize containerSize = self.yb_containerSize(self.yb_currentOrientation());\n    \n    void (^animations)(void) = ^{\n        self.yb_backView.backgroundColor = [self.yb_backView.backgroundColor colorWithAlphaComponent:1];\n        \n        CGPoint anchorPoint = self.videoView.layer.anchorPoint;\n        self.videoView.center = CGPointMake(containerSize.width * anchorPoint.x, containerSize.height * anchorPoint.y);\n        self.videoView.transform = CGAffineTransformIdentity;\n    };\n    void (^completion)(BOOL finished) = ^(BOOL finished){\n        self.videoView.layer.anchorPoint = CGPointMake(0.5, 0.5);\n        self.videoView.center = CGPointMake(containerSize.width * 0.5, containerSize.height * 0.5);\n        self.videoView.userInteractionEnabled = YES;\n        \n        self.yb_hideStatusBar(YES);\n        self.yb_collectionView().scrollEnabled = YES;\n        if (!self.videoView.isPlaying) [self hideToolViews:NO];;\n        \n        self->_interactStartPoint = CGPointZero;\n        self->_interacting = NO;\n    };\n    if (duration <= 0) {\n        animations();\n        completion(NO);\n    } else {\n        [UIView animateWithDuration:duration animations:animations completion:completion];\n    }\n}\n\n#pragma mark - getters & setters\n\n- (YBIBVideoView *)videoView {\n    if (!_videoView) {\n        _videoView = [YBIBVideoView new];\n        _videoView.delegate = self;\n    }\n    return _videoView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoData+Internal.h",
    "content": "//\n//  YBIBVideoData+Internal.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBVideoData.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBIBVideoData;\n\n@protocol YBIBVideoDataDelegate <NSObject>\n@required\n\n- (void)yb_startLoadingAVAssetFromPHAssetForData:(YBIBVideoData *)data;\n\n- (void)yb_finishLoadingAVAssetFromPHAssetForData:(YBIBVideoData *)data;\n\n- (void)yb_startLoadingFirstFrameForData:(YBIBVideoData *)data;\n\n- (void)yb_finishLoadingFirstFrameForData:(YBIBVideoData *)data;\n\n- (void)yb_videoData:(YBIBVideoData *)data downloadingWithProgress:(CGFloat)progress;\n\n- (void)yb_finishDownloadingForData:(YBIBVideoData *)data;\n\n- (void)yb_videoData:(YBIBVideoData *)data readyForThumbImage:(UIImage *)image;\n\n- (void)yb_videoData:(YBIBVideoData *)data readyForAVAsset:(AVAsset *)asset;\n\n- (void)yb_videoIsInvalidForData:(YBIBVideoData *)data;\n\n@end\n\n@interface YBIBVideoData ()\n\n@property (nonatomic, assign, getter=isLoadingAVAssetFromPHAsset) BOOL loadingAVAssetFromPHAsset;\n\n@property (nonatomic, assign, getter=isLoadingFirstFrame) BOOL loadingFirstFrame;\n\n@property (nonatomic, assign, getter=isDownloading) BOOL downloading;\n\n@property (nonatomic, weak) id<YBIBVideoDataDelegate> delegate;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoData.h",
    "content": "//\n//  YBIBVideoData.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/10.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <Photos/Photos.h>\n#import \"YBIBDataProtocol.h\"\n#import \"YBIBInteractionProfile.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBIBVideoData;\n\n/// 单击事件的处理闭包\ntypedef void (^YBIBVideoSingleTouchBlock)(YBIBVideoData *videoData);\n\n\n/**\n 图片数据类，承担配置数据和处理数据的责任\n */\n@interface YBIBVideoData : NSObject <YBIBDataProtocol>\n\n/// 视频 URL\n@property (nonatomic, copy, nullable) NSURL *videoURL;\n\n/// 相册视频资源\n@property (nonatomic, strong, nullable) PHAsset *videoPHAsset;\n\n/// 视频 AVAsset (通常使用 AVURLAsset)\n@property (nonatomic, strong, nullable) AVAsset *videoAVAsset;\n\n/// 投影视图，当前数据模型对应外界业务的 UIView (通常为 UIImageView)，做转场动效用\n@property (nonatomic, weak, nullable) __kindof UIView *projectiveView;\n\n/// 预览图/缩约图，若 projectiveView 存在且是 UIImageView 类型将会自动获取缩约图\n@property (nonatomic, strong, nullable) UIImage *thumbImage;\n\n/// 是否允许保存到相册\n@property (nonatomic, assign) BOOL allowSaveToPhotoAlbum;\n\n/// 自动播放次数，默认为 0，NSUIntegerMax 表示无限次\n@property (nonatomic, assign) NSUInteger autoPlayCount;\n\n/// 重复播放次数，默认为 0，NSUIntegerMax 表示无限次\n@property (nonatomic, assign) NSUInteger repeatPlayCount;\n\n/// 预留属性可随意使用\n@property (nonatomic, strong, nullable) id extraData;\n\n/// 手势交互动效配置文件\n@property (nonatomic, strong) YBIBInteractionProfile *interactionProfile;\n\n/// 单击的处理（视频未播放时），默认是退出图片浏览器\n@property (nonatomic, copy, nullable) YBIBVideoSingleTouchBlock singleTouchBlock;\n\n/// 是否要隐藏播放时的叉叉（取消）按钮\n@property (nonatomic, assign) BOOL shouldHideForkButton;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoData.m",
    "content": "//\n//  YBIBVideoData.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/10.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBVideoData.h\"\n#import \"YBIBVideoCell.h\"\n#import \"YBIBVideoData+Internal.h\"\n#import \"YBIBUtilities.h\"\n#import \"YBIBPhotoAlbumManager.h\"\n#import \"YBIBCopywriter.h\"\n\nextern CGImageRef YYCGImageCreateDecodedCopy(CGImageRef imageRef, BOOL decodeForDisplay);\n\n@interface YBIBVideoData () <NSURLSessionDelegate>\n@end\n\n@implementation YBIBVideoData {\n    NSURLSessionDownloadTask *_downloadTask;\n}\n\n#pragma mark - life cycle\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        [self initValue];\n    }\n    return self;\n}\n\n- (void)initValue {\n    _loadingFirstFrame = NO;\n    _loadingAVAssetFromPHAsset = NO;\n    _downloading = NO;\n    _interactionProfile = [YBIBInteractionProfile new];\n    _repeatPlayCount = 0;\n    _autoPlayCount = 0;\n    _shouldHideForkButton = NO;\n    _allowSaveToPhotoAlbum = YES;\n}\n\n#pragma mark - load data\n\n- (void)loadData {\n    // Always load 'thumbImage'.\n    [self loadThumbImage];\n    \n    if (self.videoAVAsset) {\n        [self.delegate yb_videoData:self readyForAVAsset:self.videoAVAsset];\n    } else if (self.videoPHAsset) {\n        [self loadAVAssetFromPHAsset];\n    } else {\n        [self.delegate yb_videoIsInvalidForData:self];\n    }\n}\n\n- (void)loadAVAssetFromPHAsset {\n    if (!self.videoPHAsset) return;\n    if (self.isLoadingAVAssetFromPHAsset) {\n        self.loadingAVAssetFromPHAsset = YES;\n        return;\n    }\n    \n    self.loadingAVAssetFromPHAsset = YES;\n    [YBIBPhotoAlbumManager getAVAssetWithPHAsset:self.videoPHAsset completion:^(AVAsset * _Nullable asset) {\n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            self.loadingAVAssetFromPHAsset = NO;\n            \n            self.videoAVAsset = asset;\n            [self.delegate yb_videoData:self readyForAVAsset:self.videoAVAsset];\n            [self loadThumbImage];\n        })\n    }];\n}\n\n- (void)loadThumbImage {\n    if (self.thumbImage) {\n        [self.delegate yb_videoData:self readyForThumbImage:self.thumbImage];\n    } else if (self.projectiveView && [self.projectiveView isKindOfClass:UIImageView.self] && ((UIImageView *)self.projectiveView).image) {\n        self.thumbImage = ((UIImageView *)self.projectiveView).image;\n        [self.delegate yb_videoData:self readyForThumbImage:self.thumbImage];\n    } else {\n        [self loadThumbImage_firstFrame];\n    }\n}\n- (void)loadThumbImage_firstFrame {\n    if (!self.videoAVAsset) return;\n    if (self.isLoadingFirstFrame) {\n        self.loadingFirstFrame = YES;\n        return;\n    }\n    \n    self.loadingFirstFrame = YES;\n    CGSize containerSize = self.yb_containerSize(self.yb_currentOrientation());\n    CGSize maximumSize = containerSize;\n    \n    __weak typeof(self) wSelf = self;\n    YBIB_DISPATCH_ASYNC(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        \n        AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:self.videoAVAsset];\n        generator.appliesPreferredTrackTransform = YES;\n        generator.maximumSize = maximumSize;\n        NSError *error = nil;\n        CGImageRef cgImage = [generator copyCGImageAtTime:CMTimeMake(0, 1) actualTime:NULL error:&error];\n        CGImageRef decodedImage = YYCGImageCreateDecodedCopy(cgImage, YES);\n        UIImage *resultImage = [UIImage imageWithCGImage:decodedImage];\n        if (cgImage) CGImageRelease(cgImage);\n        if (decodedImage) CGImageRelease(decodedImage);\n        \n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            self.loadingFirstFrame = NO;\n            if (!error && resultImage) {\n                self.thumbImage = resultImage;\n                [self.delegate yb_videoData:self readyForThumbImage:self.thumbImage];\n            }\n        })\n    })\n}\n\n#pragma mark - <YBIBDataProtocol>\n\n@synthesize yb_currentOrientation = _yb_currentOrientation;\n@synthesize yb_containerView = _yb_containerView;\n@synthesize yb_containerSize = _yb_containerSize;\n@synthesize yb_isHideTransitioning = _yb_isHideTransitioning;\n@synthesize yb_auxiliaryViewHandler = _yb_auxiliaryViewHandler;\n\n- (nonnull Class)yb_classOfCell {\n    return YBIBVideoCell.self;\n}\n\n- (UIView *)yb_projectiveView {\n    return self.projectiveView;\n}\n\n- (CGRect)yb_imageViewFrameWithContainerSize:(CGSize)containerSize imageSize:(CGSize)imageSize orientation:(UIDeviceOrientation)orientation {\n    if (containerSize.width <= 0 || containerSize.height <= 0 || imageSize.width <= 0 || imageSize.height <= 0) return CGRectZero;\n    CGFloat x = 0, y = 0, width = 0, height = 0;\n    if (imageSize.width / imageSize.height >= containerSize.width / containerSize.height) {\n        width = containerSize.width;\n        height = containerSize.width * (imageSize.height / imageSize.width);\n        x = 0;\n        y = (containerSize.height - height) / 2.0;\n    } else {\n        height = containerSize.height;\n        width = containerSize.height * (imageSize.width / imageSize.height);\n        x = (containerSize.width - width) / 2.0;\n        y = 0;\n    }\n    return CGRectMake(x, y, width, height);\n}\n\n- (void)yb_preload {\n    if (!self.delegate) {\n        [self loadData];\n    }\n}\n\n- (BOOL)yb_allowSaveToPhotoAlbum {\n    return self.allowSaveToPhotoAlbum;\n}\n\n- (void)yb_saveToPhotoAlbum {\n    void(^unableToSave)(void) = ^(){\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].unableToSave];\n    };\n    \n    if (self.videoAVAsset && [self.videoAVAsset isKindOfClass:AVURLAsset.class]) {\n        AVURLAsset *asset = (AVURLAsset *)self.videoAVAsset;\n        NSURL *URL = asset.URL;\n        if ([URL.scheme isEqualToString:@\"file\"]) {\n            NSString *path = URL.path;\n            if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path)) {\n                UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(UISaveVideoAtPathToSavedPhotosAlbum_videoPath:didFinishSavingWithError:contextInfo:), nil);\n            } else {\n                unableToSave();\n            }\n        } else if ([URL.scheme containsString:@\"http\"]) {\n            [self downloadWithURL:URL];\n        } else {\n            unableToSave();\n        }\n    } else {\n        unableToSave();\n    }\n}\n\n#pragma mark - private\n\n- (void)UISaveVideoAtPathToSavedPhotosAlbum_videoPath:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{\n    if (error) {\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].saveToPhotoAlbumFailed];\n    } else {\n        [self.yb_auxiliaryViewHandler() yb_showCorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].saveToPhotoAlbumSuccess];\n    }\n}\n\n- (void)downloadWithURL:(NSURL *)URL {\n    if (self.isDownloading) {\n        self.downloading = YES;\n        return;\n    }\n    \n    self.downloading = YES;\n    NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];\n    NSURLSession *session = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue mainQueue]];\n    _downloadTask = [session downloadTaskWithURL:URL];\n    [_downloadTask resume];\n}\n\n#pragma mark - <NSURLSessionDelegate>\n\n- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask\n      didWriteData:(int64_t)bytesWritten\n totalBytesWritten:(int64_t)totalBytesWritten\ntotalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {\n    CGFloat progress = totalBytesWritten / (double)totalBytesExpectedToWrite;\n    if (progress < 0) progress = 0;\n    if (progress > 1) progress = 1;\n    [self.delegate yb_videoData:self downloadingWithProgress:progress];\n}\n\n- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task\ndidCompleteWithError:(nullable NSError *)error {\n    if (error) {\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].downloadFailed];\n    }\n    self.downloading = NO;\n}\n\n- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask\ndidFinishDownloadingToURL:(NSURL *)location {\n    NSString *cache = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];\n    NSString *file = [cache stringByAppendingPathComponent:downloadTask.response.suggestedFilename];\n    [[NSFileManager defaultManager] moveItemAtURL:location toURL:[NSURL fileURLWithPath:file] error:nil];\n    if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(file)) {\n        UISaveVideoAtPathToSavedPhotosAlbum(file, self, @selector(UISaveVideoAtPathToSavedPhotosAlbum_videoPath:didFinishSavingWithError:contextInfo:), nil);\n    } else {\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].saveToPhotoAlbumFailed];\n    }\n    self.downloading = NO;\n}\n\n#pragma mark - getters & setters\n\n- (void)setVideoURL:(NSURL *)videoURL{\n    _videoURL = [videoURL isKindOfClass:NSString.class] ? [NSURL URLWithString:(NSString *)videoURL] : videoURL;\n    self.videoAVAsset = [AVURLAsset URLAssetWithURL:_videoURL options:nil];\n}\n\n- (void)setDownloading:(BOOL)downloading {\n    _downloading = downloading;\n    if (downloading) {\n        [self.delegate yb_videoData:self downloadingWithProgress:0];\n    } else {\n        [self.delegate yb_finishDownloadingForData:self];\n    }\n}\n\n- (void)setLoadingAVAssetFromPHAsset:(BOOL)loadingAVAssetFromPHAsset {\n    _loadingAVAssetFromPHAsset = loadingAVAssetFromPHAsset;\n    if (loadingAVAssetFromPHAsset) {\n        [self.delegate yb_startLoadingAVAssetFromPHAssetForData:self];\n    } else {\n        [self.delegate yb_finishLoadingAVAssetFromPHAssetForData:self];\n    }\n}\n\n- (void)setLoadingFirstFrame:(BOOL)loadingFirstFrame {\n    _loadingFirstFrame = loadingFirstFrame;\n    if (loadingFirstFrame) {\n        [self.delegate yb_startLoadingFirstFrameForData:self];\n    } else {\n        [self.delegate yb_finishLoadingFirstFrameForData:self];\n    }\n}\n\n@synthesize delegate = _delegate;\n- (void)setDelegate:(id<YBIBVideoDataDelegate>)delegate {\n    _delegate = delegate;\n    if (delegate) {\n        [self loadData];\n    }\n}\n- (id<YBIBVideoDataDelegate>)delegate {\n    // Stop sending data to the '_delegate' if it is transiting.\n    return self.yb_isHideTransitioning() ? nil : _delegate;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoTopBar.h",
    "content": "//\n//  YBIBVideoTopBar.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBVideoTopBar : UIView\n\n@property (nonatomic, strong, readonly) UIButton *cancelButton;\n\n+ (CGFloat)defaultHeight;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoTopBar.m",
    "content": "//\n//  YBIBVideoTopBar.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBVideoTopBar.h\"\n#import \"YBIBIconManager.h\"\n\n@interface YBIBVideoTopBar ()\n@property (nonatomic, strong) UIButton *cancelButton;\n@end\n\n@implementation YBIBVideoTopBar\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self addSubview:self.cancelButton];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    CGFloat buttonWidth = 54;\n    self.cancelButton.frame = CGRectMake(0, 0, buttonWidth, self.bounds.size.height);\n}\n\n#pragma mark - public\n\n+ (CGFloat)defaultHeight {\n    return 50;\n}\n\n#pragma mark - getter\n\n- (UIButton *)cancelButton {\n    if (!_cancelButton) {\n        _cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        [_cancelButton setImage:YBIBIconManager.sharedManager.videoCancelImage() forState:UIControlStateNormal];\n        _cancelButton.layer.shadowColor = UIColor.darkGrayColor.CGColor;\n        _cancelButton.layer.shadowOffset = CGSizeMake(0, 1);\n        _cancelButton.layer.shadowOpacity = 1;\n        _cancelButton.layer.shadowRadius = 4;\n    }\n    return _cancelButton;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoView.h",
    "content": "//\n//  YBIBVideoView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBVideoActionBar.h\"\n#import \"YBIBVideoTopBar.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBIBVideoView;\n\n@protocol YBIBVideoViewDelegate <NSObject>\n@required\n\n- (BOOL)yb_isFreezingForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_preparePlayForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_startPlayForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_finishPlayForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_didPlayToEndTimeForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_playFailedForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_respondsToTapGestureForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_cancelledForVideoView:(YBIBVideoView *)view;\n\n- (CGSize)yb_containerSizeForVideoView:(YBIBVideoView *)view;\n\n- (void)yb_autoPlayCountChanged:(NSUInteger)count;\n\n@end\n\n@interface YBIBVideoView : UIView\n\n@property (nonatomic, strong) UIImageView *thumbImageView;\n\n@property (nonatomic, weak) id<YBIBVideoViewDelegate> delegate;\n\n- (void)updateLayoutWithExpectOrientation:(UIDeviceOrientation)orientation containerSize:(CGSize)containerSize;\n\n@property (nonatomic, strong, nullable) AVAsset *asset;\n\n@property (nonatomic, assign, readonly, getter=isPlaying) BOOL playing;\n\n@property (nonatomic, assign, readonly, getter=isPlayFailed) BOOL playFailed;\n\n@property (nonatomic, assign, readonly, getter=isPreparingPlay) BOOL preparingPlay;\n\n@property (nonatomic, strong, readonly) UITapGestureRecognizer *tapGesture;\n\n- (void)reset;\n\n- (void)hideToolBar:(BOOL)hide;\n\n- (void)hidePlayButton;\n\n- (void)preparPlay;\n\n@property (nonatomic, assign) BOOL needAutoPlay;\n\n@property (nonatomic, assign) NSUInteger autoPlayCount;\n\n@property (nonatomic, strong, readonly) YBIBVideoTopBar *topBar;\n@property (nonatomic, strong, readonly) YBIBVideoActionBar *actionBar;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/Video/YBIBVideoView.m",
    "content": "//\n//  YBIBVideoView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <AVFoundation/AVFoundation.h>\n#import \"YBIBVideoView.h\"\n#import \"YBIBVideoActionBar.h\"\n#import \"YBIBVideoTopBar.h\"\n#import \"YBIBUtilities.h\"\n#import \"YBIBIconManager.h\"\n\n@interface YBIBVideoView () <YBIBVideoActionBarDelegate>\n@property (nonatomic, strong) YBIBVideoTopBar *topBar;\n@property (nonatomic, strong) YBIBVideoActionBar *actionBar;\n@property (nonatomic, strong) UIButton *playButton;\n@end\n\n@implementation YBIBVideoView {\n    AVPlayer *_player;\n    AVPlayerItem *_playerItem;\n    AVPlayerLayer *_playerLayer;\n    BOOL _active;\n}\n\n#pragma mark - life cycle\n\n- (void)dealloc {\n    [self removeObserverForSystem];\n    [self reset];\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self initValue];\n        self.backgroundColor = UIColor.clearColor;\n        \n        [self addSubview:self.thumbImageView];\n        [self addSubview:self.topBar];\n        [self addSubview:self.actionBar];\n        [self addSubview:self.playButton];\n        [self addObserverForSystem];\n        \n        _tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(respondsToTapGesture:)];\n        [self addGestureRecognizer:_tapGesture];\n    }\n    return self;\n}\n\n- (void)initValue {\n    _playing = NO;\n    _active = YES;\n    _needAutoPlay = NO;\n    _autoPlayCount = 0;\n    _playFailed = NO;\n    _preparingPlay = NO;\n}\n\n#pragma mark - public\n\n- (void)updateLayoutWithExpectOrientation:(UIDeviceOrientation)orientation containerSize:(CGSize)containerSize {\n    UIEdgeInsets padding = YBIBPaddingByBrowserOrientation(orientation);\n    CGFloat width = containerSize.width - padding.left - padding.right, height = containerSize.height;\n    self.topBar.frame = CGRectMake(padding.left, padding.top, width, [YBIBVideoTopBar defaultHeight]);\n    self.actionBar.frame = CGRectMake(padding.left, height - [YBIBVideoActionBar defaultHeight] - padding.bottom - 10, width, [YBIBVideoActionBar defaultHeight]);\n    self.playButton.center = CGPointMake(containerSize.width / 2.0, containerSize.height / 2.0);\n    _playerLayer.frame = (CGRect){CGPointZero, containerSize};\n}\n\n- (void)reset {\n    [self removeObserverForPlayer];\n    \n    // If set '_playerLayer.player = nil' or '_player = nil', can not cancel observeing of 'addPeriodicTimeObserverForInterval'.\n    [_player pause];\n    _playerItem = nil;\n    [_playerLayer removeFromSuperlayer];\n    _playerLayer = nil;\n\n    [self finishPlay];\n}\n\n- (void)hideToolBar:(BOOL)hide {\n    if (hide) {\n        self.actionBar.hidden = YES;\n        self.topBar.hidden = YES;\n    } else if (self.isPlaying) {\n        self.actionBar.hidden = NO;\n        self.topBar.hidden = NO;\n    }\n}\n\n- (void)hidePlayButton {\n    self.playButton.hidden = YES;\n}\n\n#pragma mark - private\n\n- (void)videoJumpWithScale:(float)scale {\n    CMTime startTime = CMTimeMakeWithSeconds(scale, _player.currentTime.timescale);\n    AVPlayer *tmpPlayer = _player;\n    \n    if (CMTIME_IS_INDEFINITE(startTime) || CMTIME_IS_INVALID(startTime)) return;\n    [_player seekToTime:startTime toleranceBefore:CMTimeMake(1, 1000) toleranceAfter:CMTimeMake(1, 1000) completionHandler:^(BOOL finished) {\n        if (finished && tmpPlayer == self->_player) {\n            [self startPlay];\n        }\n    }];\n}\n\n- (void)preparPlay {\n    _preparingPlay = YES;\n    _playFailed = NO;\n    \n    self.playButton.hidden = YES;\n    \n    [self.delegate yb_preparePlayForVideoView:self];\n    \n    if (!_playerLayer) {\n        _playerItem = [AVPlayerItem playerItemWithAsset:self.asset];\n        _player = [AVPlayer playerWithPlayerItem:_playerItem];\n        \n        _playerLayer = [AVPlayerLayer playerLayerWithPlayer:_player];\n        _playerLayer.frame = (CGRect){CGPointZero, [self.delegate yb_containerSizeForVideoView:self]};\n        [self.layer insertSublayer:_playerLayer above:self.thumbImageView.layer];\n        \n        [self addObserverForPlayer];\n    } else {\n        [self videoJumpWithScale:0];\n    }\n}\n\n- (void)startPlay {\n    if (_player) {\n        _playing = YES;\n        \n        [_player play];\n        [self.actionBar play];\n        \n        self.topBar.hidden = NO;\n        self.actionBar.hidden = NO;\n        \n        [self.delegate yb_startPlayForVideoView:self];\n    }\n}\n\n- (void)finishPlay {\n    self.playButton.hidden = NO;\n    [self.actionBar setCurrentValue:0];\n    self.actionBar.hidden = YES;\n    self.topBar.hidden = YES;\n    \n    _playing = NO;\n    \n    [self.delegate yb_finishPlayForVideoView:self];\n}\n\n- (void)playerPause {\n    if (_player) {\n        [_player pause];\n        [self.actionBar pause];\n    }\n}\n\n- (BOOL)autoPlay {\n    if (self.autoPlayCount == NSUIntegerMax) {\n        [self preparPlay];\n    } else if (self.autoPlayCount > 0) {\n        --self.autoPlayCount;\n        [self.delegate yb_autoPlayCountChanged:self.autoPlayCount];\n        [self preparPlay];\n    } else {\n        return NO;\n    }\n    return YES;\n}\n\n#pragma mark - <YBIBVideoActionBarDelegate>\n\n- (void)yb_videoActionBar:(YBIBVideoActionBar *)actionBar clickPlayButton:(UIButton *)playButton {\n    [self startPlay];\n}\n\n- (void)yb_videoActionBar:(YBIBVideoActionBar *)actionBar clickPauseButton:(UIButton *)pauseButton {\n    [self playerPause];\n}\n\n- (void)yb_videoActionBar:(YBIBVideoActionBar *)actionBar changeValue:(float)value {\n    [self videoJumpWithScale:value];\n}\n\n#pragma mark - observe\n\n- (void)addObserverForPlayer {\n    [_playerItem addObserver:self forKeyPath:@\"status\" options:NSKeyValueObservingOptionNew context:nil];\n    __weak typeof(self) wSelf = self;\n    [_player addPeriodicTimeObserverForInterval:CMTimeMake(1, 1) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {\n        __strong typeof(wSelf) self = wSelf;\n        if (!self) return;\n        float currentTime = time.value / time.timescale;\n        [self.actionBar setCurrentValue:currentTime];\n    }];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didPlayToEndTime:) name:AVPlayerItemDidPlayToEndTimeNotification object:_playerItem];\n}\n\n- (void)removeObserverForPlayer {\n    [_playerItem removeObserver:self forKeyPath:@\"status\"];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:_playerItem];\n}\n\n- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{\n    if (![self.delegate yb_isFreezingForVideoView:self]) {\n        if (object == _playerItem) {\n            if ([keyPath isEqualToString:@\"status\"]) {\n                [self playerItemStatusChanged];\n            }\n        }\n    }\n}\n\n- (void)didPlayToEndTime:(NSNotification *)noti {\n    if (noti.object == _playerItem) {\n        [self finishPlay];\n        [self.delegate yb_didPlayToEndTimeForVideoView:self];\n    }\n}\n\n- (void)playerItemStatusChanged {\n    if (!_active) return;\n    \n    _preparingPlay = NO;\n    \n    switch (_playerItem.status) {\n        case AVPlayerItemStatusReadyToPlay: {\n            // Delay to update UI.\n            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n                [self startPlay];\n                double max = CMTimeGetSeconds(self->_playerItem.duration);\n                [self.actionBar setMaxValue:(isnan(max) || isinf(max)) ? 0 : max];\n            });\n        }\n            break;\n        case AVPlayerItemStatusUnknown: {\n            _playFailed = YES;\n            [self.delegate yb_playFailedForVideoView:self];\n            [self reset];\n        }\n            break;\n        case AVPlayerItemStatusFailed: {\n            _playFailed = YES;\n            [self.delegate yb_playFailedForVideoView:self];\n            [self reset];\n        }\n            break;\n    }\n}\n\n- (void)removeObserverForSystem {\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarFrameNotification object:nil];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:AVAudioSessionRouteChangeNotification object:nil];\n}\n\n- (void)addObserverForSystem {\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeStatusBarFrame) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];\n    [[AVAudioSession sharedInstance] setActive:YES error:nil];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:)   name:AVAudioSessionRouteChangeNotification object:nil];\n}\n\n- (void)applicationWillResignActive:(NSNotification *)notification {\n    _active = NO;\n    [self playerPause];\n}\n\n- (void)applicationDidBecomeActive:(NSNotification *)notification {\n    _active = YES;\n}\n\n- (void)didChangeStatusBarFrame {\n    if ([UIApplication sharedApplication].statusBarFrame.size.height > YBIBStatusbarHeight()) {\n        [self playerPause];\n    }\n}\n\n- (void)audioRouteChangeListenerCallback:(NSNotification*)notification {\n    YBIB_DISPATCH_ASYNC_MAIN(^{\n        NSDictionary *interuptionDict = notification.userInfo;\n        NSInteger routeChangeReason = [[interuptionDict valueForKey:AVAudioSessionRouteChangeReasonKey] integerValue];\n        switch (routeChangeReason) {\n            case AVAudioSessionRouteChangeReasonOldDeviceUnavailable:\n                [self playerPause];\n                break;\n        }\n    })\n}\n\n#pragma mark - event\n\n- (void)respondsToTapGesture:(UITapGestureRecognizer *)tap {\n    if (self.isPlaying) {\n        self.actionBar.hidden = !self.actionBar.isHidden;\n        self.topBar.hidden = !self.topBar.isHidden;\n    } else {\n        [self.delegate yb_respondsToTapGestureForVideoView:self];\n    }\n}\n\n- (void)clickCancelButton:(UIButton *)button {\n    [self.delegate yb_cancelledForVideoView:self];\n}\n\n- (void)clickPlayButton:(UIButton *)button {\n    [self preparPlay];\n}\n\n#pragma mark - getters & setters\n\n- (void)setNeedAutoPlay:(BOOL)needAutoPlay {\n    if (needAutoPlay && _asset && !self.isPlaying) {\n        [self autoPlay];\n    } else {\n        _needAutoPlay = needAutoPlay;\n    }\n}\n\n@synthesize asset = _asset;\n- (void)setAsset:(AVAsset *)asset {\n    _asset = asset;\n    if (!asset) return;\n    if (self.needAutoPlay) {\n        if (![self autoPlay]) {\n            self.playButton.hidden = NO;\n        }\n        self.needAutoPlay = NO;\n    } else {\n        self.playButton.hidden = NO;\n    }\n}\n- (AVAsset *)asset {\n    if ([_asset isKindOfClass:AVURLAsset.class]) {\n        _asset = [AVURLAsset assetWithURL:((AVURLAsset *)_asset).URL];\n    }\n    return _asset;\n}\n\n- (YBIBVideoTopBar *)topBar {\n    if (!_topBar) {\n        _topBar = [YBIBVideoTopBar new];\n        [_topBar.cancelButton addTarget:self action:@selector(clickCancelButton:) forControlEvents:UIControlEventTouchUpInside];\n        _topBar.hidden = YES;\n    }\n    return _topBar;\n}\n\n- (YBIBVideoActionBar *)actionBar {\n    if (!_actionBar) {\n        _actionBar = [YBIBVideoActionBar new];\n        _actionBar.delegate = self;\n        _actionBar.hidden = YES;\n    }\n    return _actionBar;\n}\n\n- (UIButton *)playButton {\n    if (!_playButton) {\n        _playButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        _playButton.bounds = CGRectMake(0, 0, 100, 100);\n        [_playButton setImage:YBIBIconManager.sharedManager.videoBigPlayImage() forState:UIControlStateNormal];\n        [_playButton addTarget:self action:@selector(clickPlayButton:) forControlEvents:UIControlEventTouchUpInside];\n        _playButton.hidden = YES;\n        _playButton.layer.shadowColor = UIColor.darkGrayColor.CGColor;\n        _playButton.layer.shadowOffset = CGSizeMake(0, 1);\n        _playButton.layer.shadowOpacity = 1;\n        _playButton.layer.shadowRadius = 4;\n    }\n    return _playButton;\n}\n\n- (UIImageView *)thumbImageView {\n    if (!_thumbImageView) {\n        _thumbImageView = [UIImageView new];\n        _thumbImageView.contentMode = UIViewContentModeScaleAspectFit;\n        _thumbImageView.layer.masksToBounds = YES;\n    }\n    return _thumbImageView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/AuxiliaryView/YBIBAuxiliaryViewHandler.h",
    "content": "//\n//  YBIBAuxiliaryViewHandler.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/27.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBAuxiliaryViewHandler <NSObject>\n\n@required\n\n/// 展示正确情况的提示\n- (void)yb_showCorrectToastWithContainer:(UIView *)container text:(NSString *)text;\n/// 展示错误情况的提示\n- (void)yb_showIncorrectToastWithContainer:(UIView *)container text:(NSString *)text;\n/// 隐藏所有提示\n- (void)yb_hideToastWithContainer:(UIView *)container;\n\n/// 展示加载视图\n- (void)yb_showLoadingWithContainer:(UIView *)container;\n/// 展示带进度的加载视图\n- (void)yb_showLoadingWithContainer:(UIView *)container progress:(CGFloat)progress;\n/// 展示带文字的视图\n- (void)yb_showLoadingWithContainer:(UIView *)container text:(NSString *)text;\n/// 隐藏所有视图\n- (void)yb_hideLoadingWithContainer:(UIView *)container;\n\n@end\n\n@interface YBIBAuxiliaryViewHandler : NSObject <YBIBAuxiliaryViewHandler>\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/AuxiliaryView/YBIBAuxiliaryViewHandler.m",
    "content": "//\n//  YBIBAuxiliaryViewHandler.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/27.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBAuxiliaryViewHandler.h\"\n#import \"YBIBToastView.h\"\n#import \"YBIBLoadingView.h\"\n\n@implementation YBIBAuxiliaryViewHandler\n\n#pragma mark - <YBIBAuxiliaryViewHandler>\n\n- (void)yb_showCorrectToastWithContainer:(UIView *)container text:(NSString *)text {\n    [container ybib_showHookToast:text];\n}\n\n- (void)yb_showIncorrectToastWithContainer:(UIView *)container text:(NSString *)text {\n    [container ybib_showForkToast:text];\n}\n\n- (void)yb_hideToastWithContainer:(UIView *)container {\n    [container ybib_hideToast];\n}\n\n- (void)yb_showLoadingWithContainer:(UIView *)container {\n    [container ybib_showLoading];\n}\n\n- (void)yb_showLoadingWithContainer:(UIView *)container progress:(CGFloat)progress {\n    [container ybib_showLoadingWithProgress:progress];\n}\n\n- (void)yb_showLoadingWithContainer:(UIView *)container text:(NSString *)text {\n    [container ybib_showLoadingWithText:text click:nil];\n}\n\n- (void)yb_hideLoadingWithContainer:(UIView *)container {\n    [container ybib_hideLoading];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/AuxiliaryView/YBIBLoadingView.h",
    "content": "//\n//  YBIBLoadingView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/9/1.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UIView (YBIBLoading)\n\n- (void)ybib_showLoading;\n\n- (void)ybib_showLoadingWithProgress:(CGFloat)progress;\n\n- (void)ybib_showLoadingWithText:(NSString *)text click:(nullable void(^)(void))click;\n\n- (void)ybib_hideLoading;\n\n@end\n\n\n@interface YBIBLoadingView : UIView\n\n- (void)show;\n\n- (void)showProgress:(CGFloat)progress;\n\n- (void)showText:(NSString *)text click:(void(^)(void))click;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/AuxiliaryView/YBIBLoadingView.m",
    "content": "//\n//  YBIBLoadingView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/9/1.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBIBLoadingView.h\"\n#import \"YBIBIconManager.h\"\n#import <objc/runtime.h>\n\n@interface UIView ()\n@property (nonatomic, strong, readonly) YBIBLoadingView *ybib_loading;\n@end\n\n@implementation UIView (YBIBLoading)\n\n- (void)ybib_showLoadingWithProgress:(CGFloat)progress {\n    [self ybib_addLoadingView];\n    [self.ybib_loading showProgress:progress];\n}\n\n- (void)ybib_showLoading {\n    [self ybib_addLoadingView];\n    [self.ybib_loading show];\n}\n\n- (void)ybib_showLoadingWithText:(NSString *)text click:(void (^)(void))click {\n    [self ybib_addLoadingView];\n    [self.ybib_loading showText:text click:click];\n}\n\n- (void)ybib_addLoadingView {\n    YBIBLoadingView *loading = self.ybib_loading;\n    if (!loading.superview) {\n        [self addSubview:loading];\n        loading.translatesAutoresizingMaskIntoConstraints = NO;\n        NSLayoutConstraint *layA = [NSLayoutConstraint constraintWithItem:loading attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:0];\n        NSLayoutConstraint *layB = [NSLayoutConstraint constraintWithItem:loading attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:0];\n        NSLayoutConstraint *layC = [NSLayoutConstraint constraintWithItem:loading attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:0];\n        NSLayoutConstraint *layD = [NSLayoutConstraint constraintWithItem:loading attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:0];\n        [self addConstraints:@[layA, layB, layC, layD]];\n    }\n}\n\n- (void)ybib_hideLoading {\n    YBIBLoadingView *loading = self.ybib_loading;\n    if (loading && loading.superview) {\n        [loading removeFromSuperview];\n    }\n}\n\nstatic void *YBIBLoadingKey = &YBIBLoadingKey;\n- (void)setYbib_loading:(YBIBLoadingView *)ybib_loading {\n    objc_setAssociatedObject(self, YBIBLoadingKey, ybib_loading, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n- (YBIBLoadingView *)ybib_loading {\n    YBIBLoadingView *loading = objc_getAssociatedObject(self, YBIBLoadingKey);\n    if (!loading) {\n        loading = [YBIBLoadingView new];\n        self.ybib_loading = loading;\n    }\n    return loading;\n}\n\n@end\n\n\n@interface YBIBProgressDrawView : UIView\n@property (nonatomic, assign) CGFloat progress;\n@end\n@implementation YBIBProgressDrawView\n- (void)drawRect:(CGRect)rect {\n    if (self.isHidden) return;\n    \n    CGFloat progress = (isnan(_progress) || isinf(_progress) || _progress < 0) ? 0 : _progress;\n    \n    CGFloat radius = 17;\n    CGFloat strokeWidth = 3;\n    CGPoint center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));\n    \n    [[UIColor lightGrayColor] setStroke];\n    UIBezierPath *bottomPath = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:0 endAngle:M_PI * 2 clockwise:YES];\n    bottomPath.lineWidth = 4.0;\n    bottomPath.lineCapStyle = kCGLineCapRound;\n    bottomPath.lineJoinStyle = kCGLineCapRound;\n    [bottomPath stroke];\n    \n    [[UIColor whiteColor] setStroke];\n    UIBezierPath *activePath = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:-M_PI / 2.0 endAngle:M_PI * 2 * progress - M_PI / 2.0 clockwise:true];\n    activePath.lineWidth = strokeWidth;\n    activePath.lineCapStyle = kCGLineCapRound;\n    activePath.lineJoinStyle = kCGLineCapRound;\n    [activePath stroke];\n    \n    NSShadow *shadow = [NSShadow new];\n    shadow.shadowBlurRadius = 4;\n    shadow.shadowOffset = CGSizeMake(0, 1);\n    shadow.shadowColor = UIColor.darkGrayColor;\n    NSString *string = [NSString stringWithFormat:@\"%.0lf%@\", progress * 100, @\"%\"];\n    NSMutableAttributedString *atts = [[NSMutableAttributedString alloc] initWithString:string attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:10], NSForegroundColorAttributeName:[UIColor whiteColor], NSShadowAttributeName:shadow}];\n    CGSize size = atts.size;\n    [atts drawAtPoint:CGPointMake(center.x - size.width / 2.0, center.y - size.height / 2.0)];\n}\n@end\n\n\ntypedef NS_ENUM(NSUInteger, YBImageBrowserProgressType) {\n    YBImageBrowserProgressTypeProgress,\n    YBImageBrowserProgressTypeLoad,\n    YBImageBrowserProgressTypeText\n};\n\n@interface YBIBLoadingView () {\n    YBImageBrowserProgressType  _type;\n}\n@property (nonatomic, strong) UILabel *textLabel;\n@property (nonatomic, strong) UIImageView *imageView;\n@property (nonatomic, strong) YBIBProgressDrawView *drawView;\n@property (nonatomic, copy) void(^clickTextLabelBlock)(void);\n@end\n\n@implementation YBIBLoadingView\n\n#pragma mark life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0];\n        self.userInteractionEnabled = NO;\n        \n        [self addSubview:self.drawView];\n        [self addSubview:self.textLabel];\n        [self addSubview:self.imageView];\n    }\n    return self;\n}\n\n- (void)updateConstraints {\n    self.textLabel.translatesAutoresizingMaskIntoConstraints = NO;\n    NSLayoutConstraint *layA = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:20];\n    NSLayoutConstraint *layB = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:-20];\n    NSLayoutConstraint *layC = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1 constant:0];\n    \n    self.imageView.translatesAutoresizingMaskIntoConstraints = NO;\n    NSLayoutConstraint *layE = [NSLayoutConstraint constraintWithItem:self.imageView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0];\n    NSLayoutConstraint *layF = [NSLayoutConstraint constraintWithItem:self.imageView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1 constant:0];\n    \n    self.drawView.translatesAutoresizingMaskIntoConstraints = NO;\n    NSLayoutConstraint *layG = [NSLayoutConstraint constraintWithItem:self.drawView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0];\n    NSLayoutConstraint *layH = [NSLayoutConstraint constraintWithItem:self.drawView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1 constant:0];\n    NSLayoutConstraint *layI = [NSLayoutConstraint constraintWithItem:self.drawView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:50];\n    NSLayoutConstraint *layJ = [NSLayoutConstraint constraintWithItem:self.drawView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:50];\n    \n    [self addConstraints:@[layA, layB, layC, layE, layF, layG, layH, layI, layJ]];\n    [super updateConstraints];\n}\n\n#pragma mark public\n\n- (void)showProgress:(CGFloat)progress {\n    self.userInteractionEnabled = NO;\n    _type = YBImageBrowserProgressTypeProgress;\n    self.drawView.hidden = NO;\n    self.textLabel.hidden = YES;\n    self.imageView.hidden = YES;\n    [self stopImageViewAnimation];\n    \n    self.drawView.progress = progress;\n    [self.drawView setNeedsDisplay];\n}\n\n- (void)show {\n    self.userInteractionEnabled = NO;\n    _type = YBImageBrowserProgressTypeLoad;\n    self.drawView.hidden = YES;\n    self.textLabel.hidden = YES;\n    self.imageView.hidden = NO;\n    \n    [self startImageViewAnimation];\n    [self.drawView setNeedsDisplay];\n}\n\n- (void)startImageViewAnimation {\n    CABasicAnimation *ra = [CABasicAnimation animationWithKeyPath:@\"transform.rotation.z\"];\n    ra.toValue = [NSNumber numberWithFloat:M_PI * 2];\n    ra.duration = 1;\n    ra.cumulative = YES;\n    ra.repeatCount = HUGE_VALF;\n    ra.removedOnCompletion = NO;\n    ra.fillMode = kCAFillModeForwards;\n    [self.imageView.layer addAnimation:ra forKey:@\"ra\"];\n}\n\n- (void)stopImageViewAnimation {\n    [self.imageView.layer removeAllAnimations];\n}\n\n- (void)showText:(NSString *)text click:(void (^)(void))click {\n    self.userInteractionEnabled = click ? YES : NO;\n    _type = YBImageBrowserProgressTypeText;\n    self.drawView.hidden = YES;\n    self.textLabel.hidden = NO;\n    self.imageView.hidden = YES;\n    [self stopImageViewAnimation];\n    \n    self.textLabel.text = text;\n    self.clickTextLabelBlock = click;\n    [self.drawView setNeedsDisplay];\n}\n\n#pragma mark - touch event\n\n- (void)respondsToTapTextlabel {\n    if (self.clickTextLabelBlock) {\n        self.clickTextLabelBlock();\n    }\n}\n\n#pragma mark - getter\n\n- (YBIBProgressDrawView *)drawView {\n    if (!_drawView) {\n        _drawView = [YBIBProgressDrawView new];\n        _drawView.backgroundColor = [UIColor clearColor];\n    }\n    return _drawView;\n}\n\n- (UILabel *)textLabel {\n    if (!_textLabel) {\n        _textLabel = [UILabel new];\n        _textLabel.textColor = [UIColor whiteColor];\n        _textLabel.numberOfLines = 0;\n        _textLabel.font = [UIFont systemFontOfSize:14];\n        _textLabel.textAlignment = NSTextAlignmentCenter;\n        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(respondsToTapTextlabel)];\n        [_textLabel addGestureRecognizer:tapGesture];\n        _textLabel.userInteractionEnabled = YES;\n    }\n    return _textLabel;\n}\n\n- (UIImageView *)imageView {\n    if (!_imageView) {\n        _imageView = [UIImageView new];\n        _imageView.image = [YBIBIconManager sharedManager].loadingImage();\n        _imageView.layer.shadowColor = UIColor.darkGrayColor.CGColor;\n        _imageView.layer.shadowOffset = CGSizeMake(0, 1);\n        _imageView.layer.shadowOpacity = 1;\n        _imageView.layer.shadowRadius = 4;\n    }\n    return _imageView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/AuxiliaryView/YBIBToastView.h",
    "content": "//\n//  YBIBToastView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/20.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UIView (YBIBToast)\n\n- (void)ybib_showHookToast:(NSString *)text;\n\n- (void)ybib_showForkToast:(NSString *)text;\n\n- (void)ybib_hideToast;\n\n@end\n\n\ntypedef NS_ENUM(NSInteger, YBIBToastType) {\n    YBIBToastTypeNone,\n    YBIBToastTypeHook,\n    YBIBToastTypeFork\n};\n\n@interface YBIBToastView : UIView\n\n- (void)showWithText:(NSString *)text type:(YBIBToastType)type;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/AuxiliaryView/YBIBToastView.m",
    "content": "//\n//  YBIBToastView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/20.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBToastView.h\"\n#import <objc/runtime.h>\n\n@interface UIView ()\n@property (nonatomic, strong, readonly) YBIBToastView *ybib_toast;\n@end\n\n@implementation UIView (YBIBToast)\n\n- (void)ybib_showHookToast:(NSString *)text {\n    [self ybib_showToastWithText:text type:YBIBToastTypeHook hideAfterDelay:1.7];\n}\n\n- (void)ybib_showForkToast:(NSString *)text {\n    [self ybib_showToastWithText:text type:YBIBToastTypeFork hideAfterDelay:1.7];\n}\n\n- (void)ybib_showToastWithText:(NSString *)text type:(YBIBToastType)type hideAfterDelay:(NSTimeInterval)delay {\n    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(ybib_hideToast) object:nil];\n    \n    YBIBToastView *toast = self.ybib_toast;\n    if (!toast.superview) {\n        [self addSubview:toast];\n        toast.translatesAutoresizingMaskIntoConstraints = NO;\n        NSLayoutConstraint *layA = [NSLayoutConstraint constraintWithItem:toast attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1 constant:0];\n        NSLayoutConstraint *layB = [NSLayoutConstraint constraintWithItem:toast attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1 constant:0];\n        NSLayoutConstraint *layC = [NSLayoutConstraint constraintWithItem:toast attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:40];\n        NSLayoutConstraint *layD = [NSLayoutConstraint constraintWithItem:toast attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationLessThanOrEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:-40];\n        [self addConstraints:@[layA, layB, layC, layD]];\n    }\n    \n    [toast showWithText:text type:type];\n    [self performSelector:@selector(ybib_hideToast) withObject:nil afterDelay:delay];\n}\n\n- (void)ybib_hideToast {\n    YBIBToastView *toast = self.ybib_toast;\n    if (toast && toast.superview) {\n        [UIView animateWithDuration:0.25 animations:^{\n            toast.alpha = 0;\n        } completion:^(BOOL finished) {\n            [toast removeFromSuperview];\n            toast.alpha = 1;\n        }];\n    }\n}\n\nstatic void *YBIBToastKey = &YBIBToastKey;\n- (void)setYbib_toast:(YBIBToastView *)ybib_toast {\n    objc_setAssociatedObject(self, YBIBToastKey, ybib_toast, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n- (YBIBToastView *)ybib_toast {\n    YBIBToastView *toast = objc_getAssociatedObject(self, YBIBToastKey);\n    if (!toast) {\n        toast = [YBIBToastView new];\n        self.ybib_toast = toast;\n    }\n    return toast;\n}\n\n@end\n\n\n@interface YBIBToastView () {\n    YBIBToastType _type;\n    CAShapeLayer *_shapeLayer;\n}\n@property (nonatomic, strong) UILabel *textLabel;\n@end\n\n@implementation YBIBToastView\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.8];\n        self.userInteractionEnabled = NO;\n        self.layer.cornerRadius = 7;\n        \n        [self addSubview:self.textLabel];\n    }\n    return self;\n}\n\n- (void)updateConstraints {\n    self.textLabel.translatesAutoresizingMaskIntoConstraints = NO;\n    NSLayoutConstraint *layA = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1 constant:20];\n    NSLayoutConstraint *layB = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1 constant:-20];\n    NSLayoutConstraint *layC = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1 constant:-15];\n    NSLayoutConstraint *layD = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1 constant:70];\n    NSLayoutConstraint *layE = [NSLayoutConstraint constraintWithItem:self.textLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:60];\n    [self addConstraints:@[layA, layB, layC, layD, layE]];\n    [super updateConstraints];\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    [self startAnimation];\n}\n\n#pragma mark - animation\n\n- (void)showWithText:(NSString *)text type:(YBIBToastType)type {\n    self.textLabel.text = text;\n    _type = type;\n    [self setNeedsLayout];\n}\n\n- (void)startAnimation {\n    if (_shapeLayer && _shapeLayer.superlayer) {\n        [_shapeLayer removeFromSuperlayer];\n    }\n    _shapeLayer = [CAShapeLayer layer];\n    _shapeLayer.strokeColor = [UIColor whiteColor].CGColor;\n    _shapeLayer.fillColor = [UIColor clearColor].CGColor;\n    _shapeLayer.lineWidth = 5.0;\n    _shapeLayer.lineCap = @\"round\";\n    _shapeLayer.lineJoin = @\"round\";\n    _shapeLayer.strokeStart = 0.0;\n    _shapeLayer.strokeEnd = 0.0;\n    \n    UIBezierPath *bezierPath = [UIBezierPath bezierPath];\n    CGFloat r = 13.0;\n    CGFloat x = self.bounds.size.width / 2.0;\n    CGFloat y = 38.0;\n    switch (_type) {\n        case YBIBToastTypeHook: {\n            [bezierPath moveToPoint:CGPointMake(x - r - r / 2, y)];\n            [bezierPath addLineToPoint:CGPointMake(x - r / 2, y + r)];\n            [bezierPath addLineToPoint:CGPointMake(x + r * 2 - r / 2, y - r)];\n        }\n            break;\n        case YBIBToastTypeFork: {\n            [bezierPath moveToPoint:CGPointMake(x - r, y - r)];\n            [bezierPath addLineToPoint:CGPointMake(x + r, y + r)];\n            [bezierPath moveToPoint:CGPointMake(x - r, y + r)];\n            [bezierPath addLineToPoint:CGPointMake(x + r, y - r)];\n        }\n            break;\n        default:break;\n    }\n    \n    CABasicAnimation *baseAnimation = [CABasicAnimation animationWithKeyPath:@\"strokeEnd\"];\n    [baseAnimation setFromValue:@0.0];\n    [baseAnimation setToValue:@1.0];\n    [baseAnimation setDuration:0.3];\n    baseAnimation.removedOnCompletion = NO;\n    baseAnimation.fillMode = kCAFillModeBoth;\n    \n    _shapeLayer.path = bezierPath.CGPath;\n    [self.layer addSublayer:_shapeLayer];\n    [_shapeLayer addAnimation:baseAnimation forKey:@\"strokeEnd\"];\n}\n\n#pragma mark - getter\n\n- (UILabel *)textLabel {\n    if (!_textLabel) {\n        _textLabel = [UILabel new];\n        _textLabel.textColor = [UIColor whiteColor];\n        _textLabel.font = [UIFont systemFontOfSize:14];\n        _textLabel.textAlignment = NSTextAlignmentCenter;\n        _textLabel.numberOfLines = 0;\n    }\n    return _textLabel;\n}\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/NSObject+YBImageBrowser.h",
    "content": "//\n//  NSObject+YBImageBrowser.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/9/26.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface NSObject (YBImageBrowser)\n\n@property (nonatomic, assign) CGFloat ybib_originAlpha;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/NSObject+YBImageBrowser.m",
    "content": "//\n//  NSObject+YBImageBrowser.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/9/26.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"NSObject+YBImageBrowser.h\"\n#import <objc/runtime.h>\n\n@implementation NSObject (YBImageBrowser)\n\nstatic void *YBIBOriginAlphaKey = &YBIBOriginAlphaKey;\n- (void)setYbib_originAlpha:(CGFloat)ybib_originAlpha {\n    objc_setAssociatedObject(self, YBIBOriginAlphaKey, @(ybib_originAlpha), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n- (CGFloat)ybib_originAlpha {\n    NSNumber *alpha = objc_getAssociatedObject(self, YBIBOriginAlphaKey);\n    return alpha ? alpha.floatValue : 1;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBAnimatedTransition.h",
    "content": "//\n//  YBIBAnimatedTransition.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/6.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBAnimatedTransition <NSObject>\n@required\n\n- (void)yb_showTransitioningWithContainer:(UIView *)container startView:(nullable __kindof UIView *)startView startImage:(nullable UIImage *)startImage endFrame:(CGRect)endFrame orientation:(UIDeviceOrientation)orientation completion:(void(^)(void))completion;\n\n- (void)yb_hideTransitioningWithContainer:(UIView *)container startView:(nullable __kindof UIView *)startView endView:(UIView *)endView orientation:(UIDeviceOrientation)orientation completion:(void(^)(void))completion;\n\n@end\n\n\ntypedef NS_ENUM(NSInteger, YBIBTransitionType) {\n    /// 无动效\n    YBIBTransitionTypeNone,\n    /// 渐隐\n    YBIBTransitionTypeFade,\n    /// 连贯移动\n    YBIBTransitionTypeCoherent\n};\n\n@interface YBIBAnimatedTransition : NSObject <YBIBAnimatedTransition>\n\n/// 入场动效类型\n@property (nonatomic, assign) YBIBTransitionType showType;\n/// 出场动效类型\n@property (nonatomic, assign) YBIBTransitionType hideType;\n\n/// 入场动效持续时间\n@property (nonatomic, assign) NSTimeInterval showDuration;\n/// 出场动效持续时间\n@property (nonatomic, assign) NSTimeInterval hideDuration;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBAnimatedTransition.m",
    "content": "//\n//  YBIBAnimatedTransition.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/6.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBAnimatedTransition.h\"\n\nextern CGFloat YBIBRotationAngle(UIDeviceOrientation startOrientation, UIDeviceOrientation endOrientation);\n\n@implementation YBIBAnimatedTransition\n\n#pragma mark - life cycle\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _showType = _hideType = YBIBTransitionTypeCoherent;\n        _showDuration = _hideDuration = 0.25;\n    }\n    return self;\n}\n\n#pragma mark - <YBIBAnimationHandler>\n\n- (void)yb_showTransitioningWithContainer:(UIView *)container startView:(__kindof UIView *)startView startImage:(UIImage *)startImage endFrame:(CGRect)endFrame orientation:(UIDeviceOrientation)orientation completion:(void (^)(void))completion {\n    YBIBTransitionType type = self.showType;\n    if (type == YBIBTransitionTypeCoherent) {\n        if (CGRectIsEmpty(endFrame) || !startView || orientation != (UIDeviceOrientation)UIApplication.sharedApplication.statusBarOrientation) {\n            type = YBIBTransitionTypeFade;\n        }\n    }\n    \n    switch (type) {\n        case YBIBTransitionTypeNone: {\n            completion();\n        }\n            break;\n        case YBIBTransitionTypeFade: {\n            \n            BOOL animateValid = !CGRectIsEmpty(endFrame) && startView;\n            \n            UIImageView *animateImageView;\n            if (animateValid) {\n                animateImageView = [self imageViewAssimilateToView:startView];\n                animateImageView.frame = endFrame;\n                animateImageView.image = startImage;\n                [container addSubview:animateImageView];\n            }\n            \n            CGFloat rawAlpha = container.alpha;\n            container.alpha = 0;\n            \n            if (!animateValid) completion();\n                \n            [UIView animateWithDuration:self.showDuration animations:^{\n                container.alpha = rawAlpha;\n            } completion:^(BOOL finished) {\n                if (animateValid) {\n                    [animateImageView removeFromSuperview];\n                    completion();\n                }\n            }];\n            \n        }\n            break;\n        case YBIBTransitionTypeCoherent: {\n            \n            UIImageView *animateImageView = [self imageViewAssimilateToView:startView];\n            animateImageView.frame = [startView convertRect:startView.bounds toView:container];\n            animateImageView.image = startImage;\n            \n            [container addSubview:animateImageView];\n            \n            UIColor *rawBackgroundColor = container.backgroundColor;\n            container.backgroundColor = [rawBackgroundColor colorWithAlphaComponent:0];\n            \n            [UIView animateWithDuration:self.showDuration animations:^{\n                animateImageView.frame = endFrame;\n                container.backgroundColor = rawBackgroundColor;\n            } completion:^(BOOL finished) {\n                completion();\n                // Disappear smoothly.\n                [UIView animateWithDuration:0.2 animations:^{\n                    animateImageView.alpha = 0;\n                } completion:^(BOOL finished) {\n                    [animateImageView removeFromSuperview];\n                }];\n            }];\n            \n        }\n            break;\n    }\n}\n\n- (void)yb_hideTransitioningWithContainer:(UIView *)container startView:(__kindof UIView *)startView endView:(UIView *)endView orientation:(UIDeviceOrientation)orientation completion:(void (^)(void))completion {\n    YBIBTransitionType type = self.hideType;\n    if (type == YBIBTransitionTypeCoherent && (!startView || !endView)) {\n        type = YBIBTransitionTypeFade;\n    }\n    \n    switch (type) {\n        case YBIBTransitionTypeNone: {\n            completion();\n        }\n            break;\n        case YBIBTransitionTypeFade: {\n            \n            CGFloat rawAlpha = container.alpha;\n            \n            [UIView animateWithDuration:self.hideDuration animations:^{\n                container.alpha = 0;\n            } completion:^(BOOL finished) {\n                completion();\n                container.alpha = rawAlpha;\n            }];\n            \n        }\n            break;\n        case YBIBTransitionTypeCoherent: {\n            \n            CGRect startFrame = startView.frame;\n            CGRect endFrame = [endView convertRect:endView.bounds toView:startView.superview];\n            \n            UIColor *rawBackgroundColor = container.backgroundColor;\n            \n            [UIView animateWithDuration:self.hideDuration animations:^{\n                \n                container.backgroundColor = [rawBackgroundColor colorWithAlphaComponent:0];\n                \n                startView.contentMode = endView.contentMode;\n                \n                CGAffineTransform transform = startView.transform;\n                UIDeviceOrientation statusBarOrientation = (UIDeviceOrientation)UIApplication.sharedApplication.statusBarOrientation;\n                if (orientation != statusBarOrientation) {\n                    transform = CGAffineTransformRotate(transform, YBIBRotationAngle(orientation, statusBarOrientation));\n                }\n                \n                if ([startView isKindOfClass:UIImageView.self]) {\n                    startView.frame = endFrame;\n                    startView.transform = transform;\n                } else {\n                    CGFloat scale = MAX(endFrame.size.width / startFrame.size.width, endFrame.size.height / startFrame.size.height);\n                    startView.center = CGPointMake(endFrame.size.width * startView.layer.anchorPoint.x + endFrame.origin.x, endFrame.size.height * startView.layer.anchorPoint.y + endFrame.origin.y);\n                    startView.transform = CGAffineTransformScale(transform, scale, scale);\n                }\n                \n            } completion:^(BOOL finished) {\n                completion();\n                container.backgroundColor = rawBackgroundColor;\n            }];\n            \n        }\n            break;\n    }\n}\n\n#pragma mark - private\n\n- (UIImageView *)imageViewAssimilateToView:(nullable __kindof UIView *)view {\n    UIImageView *animateImageView = [UIImageView new];\n    if ([view isKindOfClass:UIImageView.self]) {\n        animateImageView.contentMode = view.contentMode;\n    } else {\n        animateImageView.contentMode = UIViewContentModeScaleAspectFill;\n    }\n    animateImageView.layer.masksToBounds = view.layer.masksToBounds;\n    animateImageView.layer.cornerRadius = view.layer.cornerRadius;\n    animateImageView.layer.backgroundColor = view.layer.backgroundColor;\n    return animateImageView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBCollectionView.h",
    "content": "//\n//  YBIBCollectionView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/6.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBCollectionViewLayout.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBCollectionView : UICollectionView\n\n@property (nonatomic, strong, readonly) YBIBCollectionViewLayout *layout;\n\n- (NSString *)reuseIdentifierForCellClass:(Class)cellClass;\n\n- (nullable UICollectionViewCell *)centerCell;\n\n- (void)scrollToPage:(NSInteger)page;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBCollectionView.m",
    "content": "//\n//  YBIBCollectionView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/6.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBCollectionView.h\"\n\n@implementation YBIBCollectionView {\n    NSMutableSet *_reuseSet;\n}\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    _layout = [YBIBCollectionViewLayout new];\n    return [self initWithFrame:frame collectionViewLayout:_layout];\n}\n\n- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(nonnull UICollectionViewLayout *)layout {\n    self = [super initWithFrame:frame collectionViewLayout:layout];\n    if (self) {\n        self.backgroundColor = [UIColor clearColor];\n        self.pagingEnabled = YES;\n        self.showsHorizontalScrollIndicator = NO;\n        self.showsVerticalScrollIndicator = NO;\n        self.alwaysBounceVertical = NO;\n        self.alwaysBounceHorizontal = NO;\n        self.decelerationRate = UIScrollViewDecelerationRateFast;\n        if (@available(iOS 11.0, *)) {\n            self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;\n        }\n        _reuseSet = [NSMutableSet set];\n    }\n    return self;\n}\n\n#pragma mark - public\n\n- (NSString *)reuseIdentifierForCellClass:(Class)cellClass {\n    NSString *identifier = NSStringFromClass(cellClass);\n    if (![_reuseSet containsObject:identifier]) {\n        NSString *path = [[NSBundle mainBundle] pathForResource:identifier ofType:@\"nib\"];\n        if (path) {\n            [self registerNib:[UINib nibWithNibName:identifier bundle:nil] forCellWithReuseIdentifier:identifier];\n        } else {\n            [self registerClass:cellClass forCellWithReuseIdentifier:identifier];\n        }\n        [_reuseSet addObject:identifier];\n    }\n    return identifier;\n}\n\n- (UICollectionViewCell *)centerCell {\n    NSArray<UICollectionViewCell *> *cells = [self visibleCells];\n    if (cells.count == 0) return nil;\n    \n    UICollectionViewCell *res = cells[0];\n    CGFloat centerX = self.contentOffset.x + (self.bounds.size.width / 2.0);\n    for (int i = 1; i < cells.count; ++i) {\n        if (ABS(cells[i].center.x - centerX) < ABS(res.center.x - centerX)) {\n            res = cells[i];\n        }\n    }\n    return res;\n}\n\n- (void)scrollToPage:(NSInteger)page {\n    [self setContentOffset:CGPointMake(self.bounds.size.width * page, 0)];\n}\n\n#pragma mark - hit test\n\n- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {\n    UIView *view = [super hitTest:point withEvent:event];\n    // When the hit-test view is 'UISlider', set '_scrollEnabled' to 'NO', avoid gesture conflicts.\n    self.scrollEnabled = ![view isKindOfClass:UISlider.class];\n    return view;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBCollectionViewLayout.h",
    "content": "//\n//  YBIBCollectionViewLayout.h\n//  YBImageBrowserDemo\n//\n//  Created by 杨少 on 2018/4/17.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface YBIBCollectionViewLayout : UICollectionViewFlowLayout\n\n@property (nonatomic, assign) CGFloat distanceBetweenPages;\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBCollectionViewLayout.m",
    "content": "//\n//  YBIBCollectionViewLayout.m\n//  YBImageBrowserDemo\n//\n//  Created by 杨少 on 2018/4/17.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBIBCollectionViewLayout.h\"\n\n@implementation YBIBCollectionViewLayout\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        self.minimumLineSpacing = 0;\n        self.minimumInteritemSpacing = 0;\n        self.sectionInset = UIEdgeInsetsZero;\n        self.scrollDirection = UICollectionViewScrollDirectionHorizontal;\n        _distanceBetweenPages = 20;\n    }\n    return self;\n}\n\n- (void)prepareLayout {\n    [super prepareLayout];\n    self.itemSize = self.collectionView.bounds.size;\n}\n\n- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {\n    NSArray<UICollectionViewLayoutAttributes *> *layoutAttsArray = [[NSArray alloc] initWithArray:[super layoutAttributesForElementsInRect:rect] copyItems:YES];\n    CGFloat halfWidth = self.collectionView.bounds.size.width / 2.0;\n    CGFloat centerX = self.collectionView.contentOffset.x + halfWidth;\n    [layoutAttsArray enumerateObjectsUsingBlock:^(UICollectionViewLayoutAttributes * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {\n        obj.center = CGPointMake(obj.center.x + (obj.center.x - centerX) / halfWidth * self.distanceBetweenPages / 2, obj.center.y);\n    }];\n    return layoutAttsArray;\n}\n\n- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {\n    return YES;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBContainerView.h",
    "content": "//\n//  YBIBContainerView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBContainerView : UIView\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBContainerView.m",
    "content": "//\n//  YBIBContainerView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/11.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBContainerView.h\"\n\n@implementation YBIBContainerView\n\n- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {\n    UIView *originView = [super hitTest:point withEvent:event];\n    if ([originView isKindOfClass:self.class]) {\n        // Continue hit-testing if the view is kind of 'self.class'.\n        return nil;\n    }\n    return originView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBDataMediator.h",
    "content": "//\n//  YBIBDataMediator.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/6.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBImageBrowser.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBDataMediator : NSObject\n\n- (instancetype)initWithBrowser:(YBImageBrowser *)browser;\n\n@property (nonatomic, assign) NSUInteger dataCacheCountLimit;\n\n- (NSInteger)numberOfCells;\n\n- (id<YBIBDataProtocol>)dataForCellAtIndex:(NSInteger)index;\n\n- (void)clear;\n\n@property (nonatomic, assign) NSUInteger preloadCount;\n\n- (void)preloadWithPage:(NSInteger)page;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBDataMediator.m",
    "content": "//\n//  YBIBDataMediator.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/6.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBDataMediator.h\"\n#import \"YBImageBrowser+Internal.h\"\n\n@implementation YBIBDataMediator {\n    __weak YBImageBrowser *_browser;\n    NSCache<NSNumber *, id<YBIBDataProtocol>> *_dataCache;\n}\n\n#pragma mark - life cycle\n\n- (instancetype)initWithBrowser:(YBImageBrowser *)browser {\n    if (self = [super init]) {\n        _browser = browser;\n        _dataCache = [NSCache new];\n    }\n    return self;\n}\n\n#pragma mark - public\n\n- (NSInteger)numberOfCells {\n    return _browser.dataSource ? [_browser.dataSource yb_numberOfCellsInImageBrowser:_browser] : _browser.dataSourceArray.count;\n}\n\n- (id<YBIBDataProtocol>)dataForCellAtIndex:(NSInteger)index {\n    if (index < 0 || index > self.numberOfCells - 1) return nil;\n    \n    id<YBIBDataProtocol> data = [_dataCache objectForKey:@(index)];\n    if (!data) {\n        data = _browser.dataSource ? [_browser.dataSource yb_imageBrowser:_browser dataForCellAtIndex:index] : _browser.dataSourceArray[index];\n        [_dataCache setObject:data forKey:@(index)];\n        [_browser implementGetBaseInfoProtocol:data];\n    }\n    return data;\n}\n\n- (void)clear {\n    [_dataCache removeAllObjects];\n}\n\n- (void)preloadWithPage:(NSInteger)page {\n    if (_preloadCount == 0) return;\n    \n    NSInteger left = -(_preloadCount / 2), right = _preloadCount - ABS(left);\n    for (NSInteger i = left; i <= right; ++i) {\n        if (i == 0) continue;\n        id<YBIBDataProtocol> targetData = [self dataForCellAtIndex:page + i];\n        if ([targetData respondsToSelector:@selector(yb_preload)]) {\n            [targetData yb_preload];\n        }\n    }\n}\n\n#pragma mark - getters & setters\n\n- (void)setDataCacheCountLimit:(NSUInteger)dataCacheCountLimit {\n    _dataCacheCountLimit = dataCacheCountLimit;\n    _dataCache.countLimit = dataCacheCountLimit;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBScreenRotationHandler.h",
    "content": "//\n//  YBIBScreenRotationHandler.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/8.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBImageBrowser.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBScreenRotationHandler : NSObject\n\n- (instancetype)initWithBrowser:(YBImageBrowser *)browser;\n\n- (void)startObserveStatusBarOrientation;\n\n- (void)startObserveDeviceOrientation;\n\n- (void)clear;\n\n- (void)configContainerSize:(CGSize)size;\n\n- (CGSize)containerSizeWithOrientation:(UIDeviceOrientation)orientation;\n\n@property (nonatomic, assign, readonly, getter=isRotating) BOOL rotating;\n\n@property (nonatomic, assign, readonly) UIDeviceOrientation currentOrientation;\n\n@property (nonatomic, assign) UIInterfaceOrientationMask supportedOrientations;\n\n@property (nonatomic, assign) NSTimeInterval rotationDuration;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBIBScreenRotationHandler.m",
    "content": "//\n//  YBIBScreenRotationHandler.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/8.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBScreenRotationHandler.h\"\n#import \"YBIBUtilities.h\"\n#import \"YBIBCellProtocol.h\"\n#import \"YBImageBrowser+Internal.h\"\n\nBOOL YBIBValidDeviceOrientation(UIDeviceOrientation orientation) {\n    static NSSet *validSet;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        validSet = [NSSet setWithObjects:@(UIDeviceOrientationPortrait), @(UIDeviceOrientationPortraitUpsideDown), @(UIDeviceOrientationLandscapeLeft), @(UIDeviceOrientationLandscapeRight), nil];\n    });\n    return [validSet containsObject:@(orientation)];\n}\n\nCGFloat YBIBRotationAngle(UIDeviceOrientation startOrientation, UIDeviceOrientation endOrientation) {\n    static NSDictionary<NSNumber*, NSNumber*> *angleMap;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        angleMap = @{@(UIDeviceOrientationPortrait):@(0), @(UIDeviceOrientationPortraitUpsideDown):@(M_PI), @(UIDeviceOrientationLandscapeLeft):@(M_PI_2), @(UIDeviceOrientationLandscapeRight): @(-M_PI_2)};\n    });\n    NSNumber *start = angleMap[@(startOrientation)], *end = angleMap[@(endOrientation)];\n    CGFloat res = CGFLOAT_IS_DOUBLE ? end.doubleValue - start.doubleValue : end.floatValue - start.floatValue;\n    if (ABS(res) > M_PI) {\n        return res > 0 ? res - M_PI * 2 : M_PI * 2 + res;\n    }\n    return res;\n}\n\n\nstatic NSUInteger const kMaskNull = 10000;\n\n@interface YBIBScreenRotationHandler ()\n@property (nonatomic, assign) BOOL rotating;\n@property (nonatomic, assign) UIDeviceOrientation currentOrientation;\n@end\n\n@implementation YBIBScreenRotationHandler {\n    __weak YBImageBrowser *_browser;\n    CGSize _verticalContainerSize;\n    CGSize _horizontalContainerSize;\n    NSInteger _recordPage;\n}\n\n#pragma mark - life cycle\n\n- (void)dealloc {\n    [self clear];\n}\n\n- (instancetype)initWithBrowser:(YBImageBrowser *)browser {\n    if (self = [super init]) {\n        _browser = browser;\n        _rotating = NO;\n        _supportedOrientations = UIInterfaceOrientationMaskAllButUpsideDown;\n        _rotationDuration = 0.25;\n    }\n    return self;\n}\n\n#pragma mark - public\n\n- (void)startObserveStatusBarOrientation {\n    self.currentOrientation = (UIDeviceOrientation)UIApplication.sharedApplication.statusBarOrientation;\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidChangedStatusBarOrientationNotification:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillChangeStatusBarOrientationNotification:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];\n}\n\n- (void)startObserveDeviceOrientation {\n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChangeNotification:) name:UIDeviceOrientationDidChangeNotification object:nil];\n}\n\n- (void)clear {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n- (void)configContainerSize:(CGSize)size {\n    if (UIDeviceOrientationIsLandscape(self.currentOrientation)) {\n        // Now is horizontal.\n        _verticalContainerSize = CGSizeMake(size.height, size.width);\n        _horizontalContainerSize = size;\n    } else {\n        // Now is vertical.\n        _verticalContainerSize = size;\n        _horizontalContainerSize = CGSizeMake(size.height, size.width);\n    }\n}\n\n- (CGSize)containerSizeWithOrientation:(UIDeviceOrientation)orientation {\n    return UIDeviceOrientationIsLandscape(orientation) ? _horizontalContainerSize : _verticalContainerSize;\n}\n\n#pragma mark - private\n\n- (BOOL)supportedOfOrientation:(UIDeviceOrientation)orientation {\n    if (!YBIBValidDeviceOrientation(orientation)) return NO;\n    NSMutableSet *set = [NSMutableSet set];\n    if (_supportedOrientations & UIInterfaceOrientationMaskPortrait) [set addObject:@(UIDeviceOrientationPortrait)];\n    if (_supportedOrientations & UIInterfaceOrientationMaskPortraitUpsideDown) [set addObject:@(UIDeviceOrientationPortraitUpsideDown)];\n    if (_supportedOrientations & UIInterfaceOrientationMaskLandscapeRight) [set addObject:@(UIDeviceOrientationLandscapeLeft)];\n    if (_supportedOrientations & UIInterfaceOrientationMaskLandscapeLeft) [set addObject:@(UIDeviceOrientationLandscapeRight)];\n    return [set containsObject:@(orientation)];\n}\n\n- (BOOL)supportedOnlyOneSystemOrientation {\n    UIInterfaceOrientationMask mask = [self supportSystemOrientationMask];\n    return mask == (mask & (-mask));\n}\n\n- (void)orientationWillChangeWithExpectOrientation:(UIDeviceOrientation)orientation centerCell:(UICollectionViewCell<YBIBCellProtocol> *)centerCell {\n    if ([centerCell respondsToSelector:@selector(yb_orientationWillChangeWithExpectOrientation:)]) {\n        [centerCell yb_orientationWillChangeWithExpectOrientation:orientation];\n    }\n    for (id<YBIBToolViewHandler> handler in _browser.toolViewHandlers) {\n        if ([handler respondsToSelector:@selector(yb_orientationWillChangeWithExpectOrientation:)]) {\n            [handler yb_orientationWillChangeWithExpectOrientation:orientation];\n        }\n    }\n}\n\n- (void)orientationChangeAnimationWithExpectOrientation:(UIDeviceOrientation)orientation centerCell:(UICollectionViewCell<YBIBCellProtocol> *)centerCell {\n    if ([centerCell respondsToSelector:@selector(yb_orientationChangeAnimationWithExpectOrientation:)]) {\n        [centerCell yb_orientationChangeAnimationWithExpectOrientation:orientation];\n        [centerCell layoutIfNeeded];    // Compatible with autolayout.\n    }\n    for (id<YBIBToolViewHandler> handler in _browser.toolViewHandlers) {\n        if ([handler respondsToSelector:@selector(yb_orientationChangeAnimationWithExpectOrientation:)]) {\n            [handler yb_orientationChangeAnimationWithExpectOrientation:orientation];\n        }\n    }\n}\n\n- (void)orientationDidChangedWithOrientation:(UIDeviceOrientation)orientation centerCell:(UICollectionViewCell<YBIBCellProtocol> *)centerCell {\n    if ([centerCell respondsToSelector:@selector(yb_orientationDidChangedWithOrientation:)]) {\n        [centerCell yb_orientationDidChangedWithOrientation:orientation];\n    }\n    for (id<YBIBToolViewHandler> handler in _browser.toolViewHandlers) {\n        if ([handler respondsToSelector:@selector(yb_orientationDidChangedWithOrientation:)]) {\n            [handler yb_orientationDidChangedWithOrientation:orientation];\n        }\n    }\n}\n\n#pragma mark - event\n\n- (void)deviceOrientationDidChangeNotification:(NSNotification *)note {\n    if (![self supportedOnlyOneSystemOrientation]) return;\n    if (_browser.isTransitioning || self.rotating) return;\n    \n    UIDeviceOrientation expectOrientation = [UIDevice currentDevice].orientation;\n    if (expectOrientation == self.currentOrientation || ![self supportedOfOrientation:expectOrientation]) return;\n    \n    self.rotating = YES;\n    \n    // Align.\n    [_browser.collectionView scrollToPage:_browser.currentPage];\n    // Record current page number before transforming.\n    NSInteger currentPage = _browser.currentPage;\n    \n    UIDeviceOrientation statusBarOrientation = (UIDeviceOrientation)UIApplication.sharedApplication.statusBarOrientation;\n    CGFloat angleStatusBarToExpect = YBIBRotationAngle(statusBarOrientation, expectOrientation);\n    CGFloat angleCurrentToExpect = YBIBRotationAngle(_currentOrientation, expectOrientation);\n    CGRect expectBounds = (CGRect){CGPointZero, [self containerSizeWithOrientation:expectOrientation]};\n    UICollectionViewCell<YBIBCellProtocol> *centerCell = (UICollectionViewCell<YBIBCellProtocol> *)self->_browser.collectionView.centerCell;\n    // Animate smoothly if bigger rotation angle.\n    NSTimeInterval duration = self.rotationDuration * (ABS(angleCurrentToExpect) > M_PI_2 ? 2 : 1);\n\n    // 'collectionView' transformation.\n    self->_browser.collectionView.bounds = expectBounds;\n    self->_browser.collectionView.transform = CGAffineTransformMakeRotation(angleStatusBarToExpect);\n    centerCell.contentView.transform = CGAffineTransformMakeRotation(-angleCurrentToExpect);\n    \n    // Reset to prevent the page number change after transforming.\n    [self->_browser.collectionView scrollToPage:currentPage];\n    \n    [self orientationWillChangeWithExpectOrientation:expectOrientation centerCell:centerCell];\n    \n    [UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{\n        \n        // Maybe the internal UI need to transform.\n        [self orientationChangeAnimationWithExpectOrientation:expectOrientation centerCell:centerCell];\n        \n        centerCell.contentView.bounds = expectBounds;\n        centerCell.contentView.transform = CGAffineTransformIdentity;\n        \n        self->_browser.containerView.bounds = expectBounds;\n        self->_browser.containerView.transform = CGAffineTransformMakeRotation(angleStatusBarToExpect);\n        \n    } completion:^(BOOL finished) {\n        self.currentOrientation = expectOrientation;\n        self.rotating = NO;\n        \n        [self orientationDidChangedWithOrientation:expectOrientation centerCell:centerCell];\n    }];\n}\n\n- (void)applicationWillChangeStatusBarOrientationNotification:(NSNotification *)noti {\n    if ([self supportedOnlyOneSystemOrientation]) return;\n    \n    self.rotating = YES;\n    // Record current page number before transforming.\n    _recordPage = _browser.currentPage;\n    \n    UICollectionViewCell<YBIBCellProtocol> *centerCell = (UICollectionViewCell<YBIBCellProtocol> *)self->_browser.collectionView.centerCell;\n    UIDeviceOrientation expectOrientation = ((NSNumber *)noti.userInfo[UIApplicationStatusBarOrientationUserInfoKey]).integerValue;\n    [self orientationWillChangeWithExpectOrientation:expectOrientation centerCell:centerCell];\n}\n\n- (void)applicationDidChangedStatusBarOrientationNotification:(NSNotification *)noti {\n    if ([self supportedOnlyOneSystemOrientation]) return;\n    \n    UIDeviceOrientation expectOrientation = (UIDeviceOrientation)UIApplication.sharedApplication.statusBarOrientation;\n    UICollectionViewCell<YBIBCellProtocol> *centerCell = (UICollectionViewCell<YBIBCellProtocol> *)self->_browser.collectionView.centerCell;\n    \n    [self orientationChangeAnimationWithExpectOrientation:expectOrientation centerCell:centerCell];\n    \n    CGRect expectBounds = (CGRect){CGPointZero, [self containerSizeWithOrientation:expectOrientation]};\n    self->_browser.collectionView.layout.itemSize = expectBounds.size;\n    \n    // Reset to prevent the page number change after transforming.\n    [_browser.collectionView scrollToPage:_recordPage];\n    \n    self.currentOrientation = expectOrientation;\n    self.rotating = NO;\n    \n    [self orientationDidChangedWithOrientation:expectOrientation centerCell:centerCell];\n}\n\n#pragma mark - getters & setters\n\n- (void)setRotating:(BOOL)rotating {\n    _rotating = rotating;\n    _browser.containerView.userInteractionEnabled = !rotating;\n    _browser.collectionView.userInteractionEnabled = !rotating;\n    _browser.collectionView.panGestureRecognizer.enabled = !rotating;\n}\n\n#pragma mark - calculate supported orientation of system\n\n- (UIInterfaceOrientationMask)supportSystemOrientationMask {\n    UIInterfaceOrientationMask limitMask = 0;\n    // IphoneX series do not support UIInterfaceOrientationMaskPortraitUpsideDown, except selector '-application:supportedInterfaceOrientationsForWindow:' of '[UIApplication sharedApplication].delegate' return 0. Maybe it is BUG of Apple.\n    BOOL ignoreUpsideDownIfIphoneX = YES;\n    UIInterfaceOrientationMask delegateMask = [self maskOfApplicationDelegate];\n    if (delegateMask != kMaskNull) {\n        if (delegateMask == 0) {\n            // Apple do.\n            limitMask = UIInterfaceOrientationMaskAll;\n            ignoreUpsideDownIfIphoneX = NO;\n        } else {\n            limitMask = delegateMask;\n        }\n    } else {\n        // Lower priority.\n        limitMask = [self maskOfInfoPlist];\n    }\n    \n    UIInterfaceOrientationMask supportMask = limitMask & [self maskOfViewController];\n    \n    if (ignoreUpsideDownIfIphoneX && YBIBIsIphoneXSeries() && (supportMask & UIInterfaceOrientationMaskPortraitUpsideDown)) {\n        supportMask ^= UIInterfaceOrientationMaskPortraitUpsideDown;\n    }\n    return supportMask;\n}\n\n- (UIInterfaceOrientationMask)maskOfInfoPlist {\n    // 'Info.plist' will not change in a process.\n    static UIInterfaceOrientationMask mask = 0;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSString *path = [[NSBundle mainBundle] pathForResource:@\"Info\" ofType:@\"plist\"];\n        NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:path];\n        NSArray *array = dict[@\"UISupportedInterfaceOrientations\"];\n        NSSet *set = [NSSet setWithArray:array];\n        if ([set containsObject:@\"UIInterfaceOrientationPortrait\"]) mask |= UIInterfaceOrientationMaskPortrait;\n        if ([set containsObject:@\"UIInterfaceOrientationLandscapeRight\"]) mask |= UIInterfaceOrientationMaskLandscapeRight;\n        if ([set containsObject:@\"UIInterfaceOrientationLandscapeLeft\"]) mask |= UIInterfaceOrientationMaskLandscapeLeft;\n        if ([set containsObject:@\"UIInterfaceOrientationPortraitUpsideDown\"]) mask |= UIInterfaceOrientationMaskPortraitUpsideDown;\n    });\n    return mask == 0 ? kMaskNull : mask;\n}\n\n- (UIInterfaceOrientationMask)maskOfApplicationDelegate {\n    UIInterfaceOrientationMask mask = kMaskNull;\n    id<UIApplicationDelegate> delegate = [UIApplication sharedApplication].delegate;\n    if ([delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) {\n        mask = [delegate application:[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:_browser.window];\n    }\n    return mask;\n}\n\n- (UIInterfaceOrientationMask)maskOfViewController {\n    UIInterfaceOrientationMask mask = kMaskNull;\n    \n    // Find the UIViewController whitch 'browser' followed.\n    UIViewController *target = nil;\n    id next = _browser;\n    while (next) {\n        if ([next isKindOfClass:UIViewController.self]) {\n            target = next;\n            break;\n        }\n        if ([next isKindOfClass:UIWindow.self]) {\n            target = YBIBTopControllerByWindow(next);\n            break;\n        }\n        next = [next nextResponder];\n    }\n    \n    // Cover directly.\n    if (target.tabBarController) {\n        mask = target.tabBarController.shouldAutorotate ? target.tabBarController.supportedInterfaceOrientations : 0;\n    } else if (target.navigationController) {\n        mask = target.navigationController.shouldAutorotate ? target.navigationController.supportedInterfaceOrientations : 0;\n    } else {\n        mask = target.shouldAutorotate ? target.supportedInterfaceOrientations : 0;\n    }\n    return mask;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Base/YBImageBrowser+Internal.h",
    "content": "//\n//  YBImageBrowser+Internal.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/1.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBImageBrowser.h\"\n#import \"YBIBContainerView.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBImageBrowser ()\n\n@property (nonatomic, strong) YBIBContainerView *containerView;\n\n- (void)implementGetBaseInfoProtocol:(id<YBIBGetBaseInfoProtocol>)obj;\n\n@property (nonatomic, weak, nullable) NSObject *hiddenProjectiveView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBCopywriter.h",
    "content": "//\n//  YBIBCopywriter.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/9/13.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef NS_ENUM(NSInteger, YBIBCopywriterType) {\n    /// 简体中文\n    YBIBCopywriterTypeSimplifiedChinese,\n    /// 英文\n    YBIBCopywriterTypeEnglish\n};\n\n/**\n 文案管理类\n */\n@interface YBIBCopywriter : NSObject\n\n/**\n 唯一有效单例\n */\n+ (instancetype)sharedCopywriter;\n\n/// 语言类型\n@property (nonatomic, assign) YBIBCopywriterType type;\n\n#pragma - 以下文案可更改\n\n@property (nonatomic, copy) NSString *videoIsInvalid;\n\n@property (nonatomic, copy) NSString *videoError;\n\n@property (nonatomic, copy) NSString *unableToSave;\n\n@property (nonatomic, copy) NSString *imageIsInvalid;\n\n@property (nonatomic, copy) NSString *downloadFailed;\n\n@property (nonatomic, copy) NSString *getPhotoAlbumAuthorizationFailed;\n\n@property (nonatomic, copy) NSString *saveToPhotoAlbumSuccess;\n\n@property (nonatomic, copy) NSString *saveToPhotoAlbumFailed;\n\n@property (nonatomic, copy) NSString *saveToPhotoAlbum;\n\n@property (nonatomic, copy) NSString *cancel;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBCopywriter.m",
    "content": "//\n//  YBIBCopywriter.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/9/13.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBIBCopywriter.h\"\n\n@implementation YBIBCopywriter\n\n#pragma mark - life cycle\n\n+ (instancetype)sharedCopywriter {\n    static YBIBCopywriter *copywriter = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        copywriter = [YBIBCopywriter new];\n    });\n    return copywriter;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _type = YBIBCopywriterTypeSimplifiedChinese;\n        NSArray *appleLanguages = [[NSUserDefaults standardUserDefaults] objectForKey:@\"AppleLanguages\"];\n        if (appleLanguages && appleLanguages.count > 0) {\n            NSString *languages = appleLanguages[0];\n            if (![languages hasPrefix:@\"zh-Hans\"]) {\n                _type = YBIBCopywriterTypeEnglish;\n            }\n        }\n        \n        [self initCopy];\n    }\n    return self;\n}\n\n#pragma mark - private\n\n- (void)initCopy {\n    BOOL en = self.type == YBIBCopywriterTypeEnglish;\n    \n    self.videoIsInvalid = en ? @\"Video is invalid\" : @\"视频无效\";\n    self.videoError = en ? @\"Video error\" : @\"视频错误\";\n    self.unableToSave = en ? @\"Unable to save\" : @\"无法保存\";\n    self.imageIsInvalid = en ? @\"Image is invalid\" : @\"图片无效\";\n    self.downloadFailed = en ? @\"Download failed\" : @\"加载图片失败\";\n    self.getPhotoAlbumAuthorizationFailed = en ? @\"Failed to get album authorization\" : @\"获取相册权限失败\";\n    self.saveToPhotoAlbumSuccess = en ? @\"Save successful\" : @\"已保存到系统相册\";\n    self.saveToPhotoAlbumFailed = en ? @\"Save failed\" : @\"保存失败\";\n    self.saveToPhotoAlbum = en ? @\"Save\" : @\"保存到相册\";\n    self.cancel = en ? @\"Cancel\" : @\"取消\";\n}\n\n#pragma mark - public\n\n- (void)setType:(YBIBCopywriterType)type {\n    _type = type;\n    [self initCopy];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBIconManager.h",
    "content": "//\n//  YBIBIconManager.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/8/29.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface UIImage (YBImageBrowser)\n\n/**\n 获取图片便利构造方法\n\n @param name 图片名字\n @param bundle 资源对象\n @return 图片实例\n */\n+ (instancetype)ybib_imageNamed:(NSString *)name bundle:(NSBundle *)bundle;\n\n@end\n\n\n/// 获取图片闭包\ntypedef UIImage * _Nullable (^YBIBIconBlock)(void);\n\n/**\n 图标管理类\n */\n@interface YBIBIconManager : NSObject\n\n/**\n 唯一有效单例\n */\n+ (instancetype)sharedManager;\n\n#pragma - 以下图片可更改\n\n/// 基本-加载\n@property (nonatomic, copy) YBIBIconBlock loadingImage;\n\n/// 工具视图-保存\n@property (nonatomic, copy) YBIBIconBlock toolSaveImage;\n/// 工具视图-更多\n@property (nonatomic, copy) YBIBIconBlock toolMoreImage;\n\n/// 视频-播放\n@property (nonatomic, copy) YBIBIconBlock videoPlayImage;\n/// 视频-暂停\n@property (nonatomic, copy) YBIBIconBlock videoPauseImage;\n/// 视频-取消\n@property (nonatomic, copy) YBIBIconBlock videoCancelImage;\n/// 视频-播放大图\n@property (nonatomic, copy) YBIBIconBlock videoBigPlayImage;\n/// 视频-拖动圆点\n@property (nonatomic, copy) YBIBIconBlock videoDragCircleImage;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBIconManager.m",
    "content": "//\n//  YBIBIconManager.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/8/29.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBIBIconManager.h\"\n\n// The best order for path scale search.\nstatic NSArray *_NSBundlePreferredScales() {\n    static NSArray *scales;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        CGFloat screenScale = [UIScreen mainScreen].scale;\n        if (screenScale <= 1) {\n            scales = @[@1,@2,@3];\n        } else if (screenScale <= 2) {\n            scales = @[@2,@3,@1];\n        } else {\n            scales = @[@3,@2,@1];\n        }\n    });\n    return scales;\n}\n\n// Add scale modifier to the file name (without path extension), from @\"name\" to @\"name@2x\".\nstatic NSString *_NSStringByAppendingNameScale(NSString *string, CGFloat scale) {\n    if (!string) return nil;\n    if (fabs(scale - 1) <= __FLT_EPSILON__ || string.length == 0 || [string hasSuffix:@\"/\"]) return string.copy;\n    return [string stringByAppendingFormat:@\"@%@x\", @(scale)];\n}\n\n@implementation UIImage (YBImageBrowser)\n\n+ (instancetype)ybib_imageNamed:(NSString *)name bundle:(NSBundle *)bundle {\n    if (name.length == 0) return nil;\n    if ([name hasSuffix:@\"/\"]) return nil;\n    \n    NSString *res = name.stringByDeletingPathExtension;\n    NSString *ext = name.pathExtension;\n    NSString *path = nil;\n    CGFloat scale = 1;\n    \n    // If no extension, guess by system supported (same as UIImage).\n    NSArray *exts = ext.length > 0 ? @[ext] : @[@\"\", @\"png\", @\"jpeg\", @\"jpg\", @\"gif\", @\"webp\", @\"apng\"];\n    NSArray *scales = _NSBundlePreferredScales();\n    for (int s = 0; s < scales.count; s++) {\n        scale = ((NSNumber *)scales[s]).floatValue;\n        NSString *scaledName = _NSStringByAppendingNameScale(res, scale);\n        for (NSString *e in exts) {\n            path = [bundle pathForResource:scaledName ofType:e];\n            if (path) break;\n        }\n        if (path) break;\n    }\n    if (path.length == 0) {\n        // Assets.xcassets supported.\n        return [self imageNamed:name];\n    }\n    \n    NSData *data = [NSData dataWithContentsOfFile:path];\n    if (data.length == 0) return nil;\n    \n    return [[self alloc] initWithData:data scale:scale];\n}\n\n@end\n\n\nNSBundle *YBIBDefaultBundle(void) {\n    static NSBundle *bundle = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSBundle *_bundle = [NSBundle bundleForClass:NSClassFromString(@\"YBImageBrowser\")];\n        NSString *path = [_bundle pathForResource:@\"YBImageBrowser\" ofType:@\"bundle\"];\n        bundle = [NSBundle bundleWithPath:path];\n    });\n    return bundle;\n}\n\nNSBundle *YBIBVideoBundle(void) {\n    static NSBundle *bundle = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSBundle *_bundle = [NSBundle bundleForClass:NSClassFromString(@\"YBImageBrowser\")];\n        NSString *path = [_bundle pathForResource:@\"YBImageBrowserVideo\" ofType:@\"bundle\"];\n        bundle = [NSBundle bundleWithPath:path];\n    });\n    return bundle;\n}\n\n@implementation YBIBIconManager\n\n+ (instancetype)sharedManager {\n    static YBIBIconManager *manager = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        manager = [YBIBIconManager new];\n    });\n    return manager;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _loadingImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_loading\" bundle:YBIBDefaultBundle()];\n        };\n        \n        _toolSaveImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_save\" bundle:YBIBDefaultBundle()];\n        };\n        _toolMoreImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_more\" bundle:YBIBDefaultBundle()];\n        };\n        \n        _videoPlayImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_play\" bundle:YBIBVideoBundle()];\n        };\n        _videoPauseImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_pause\" bundle:YBIBVideoBundle()];\n        };\n        _videoCancelImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_cancel\" bundle:YBIBVideoBundle()];\n        };\n        _videoBigPlayImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_bigPlay\" bundle:YBIBVideoBundle()];\n        };\n        _videoDragCircleImage = ^UIImage * _Nullable{\n            return [UIImage ybib_imageNamed:@\"ybib_circlePoint\" bundle:YBIBVideoBundle()];\n        };\n    }\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBPhotoAlbumManager.h",
    "content": "//\n//  YBIBPhotoAlbumManager.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/8/28.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import <Photos/Photos.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBPhotoAlbumManager : NSObject\n\n/**\n Get photo album authorization.\n */\n+ (void)getPhotoAlbumAuthorizationSuccess:(void(^)(void))success failed:(void(^)(void))failed;\n\n/**\n Get 'AVAsset' by 'PHAsset' asynchronously, callback is in child thread.\n */\n+ (void)getAVAssetWithPHAsset:(PHAsset *)phAsset completion:(void(^)(AVAsset * _Nullable asset))completion;\n\n/**\n Get 'ImageData' by 'PHAsset' synchronously, callback is in child thread.\n */\n+ (void)getImageDataWithPHAsset:(PHAsset *)phAsset completion:(void(^)(NSData * _Nullable data))completion;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBPhotoAlbumManager.m",
    "content": "//\n//  YBIBPhotoAlbumManager.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/8/28.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBIBPhotoAlbumManager.h\"\n#import \"YBIBUtilities.h\"\n\n@implementation YBIBPhotoAlbumManager\n\n+ (void)getAVAssetWithPHAsset:(PHAsset *)phAsset completion:(nonnull void (^)(AVAsset * _Nullable))completion {\n    PHVideoRequestOptions *options = [PHVideoRequestOptions new];\n    options.networkAccessAllowed = YES;\n    [[PHImageManager defaultManager] requestAVAssetForVideo:phAsset options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {\n        completion(asset);\n    }];\n}\n\n+ (void)getImageDataWithPHAsset:(PHAsset *)phAsset completion:(nonnull void (^)(NSData * _Nullable))completion {\n    PHImageRequestOptions *options = [PHImageRequestOptions new];\n    options.networkAccessAllowed = YES;\n    options.resizeMode = PHImageRequestOptionsResizeModeNone;\n    // Only when this property is YES, the callback will in child thread.\n    options.synchronous = YES;\n    [[PHImageManager defaultManager] requestImageDataForAsset:phAsset options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {\n        BOOL complete = ![[info objectForKey:PHImageCancelledKey] boolValue] && ![info objectForKey:PHImageErrorKey] && ![[info objectForKey:PHImageResultIsDegradedKey] boolValue];\n        if (complete && imageData) {\n            completion(imageData);\n        } else {\n            completion(nil);\n        }\n    }];\n}\n\n+ (void)getPhotoAlbumAuthorizationSuccess:(void(^)(void))success failed:(void(^)(void))failed {\n    PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];\n    switch (status) {\n        case PHAuthorizationStatusDenied:\n            if (failed) failed();\n            break;\n        case PHAuthorizationStatusRestricted:\n            if (failed) failed();\n            break;\n        case PHAuthorizationStatusNotDetermined: {\n            [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status){\n                YBIB_DISPATCH_ASYNC_MAIN(^{\n                    if (status == PHAuthorizationStatusAuthorized) {\n                        if (success) success();\n                    } else {\n                        if (failed) failed();\n                    }\n                })\n            }];\n        }\n            break;\n        case PHAuthorizationStatusAuthorized:\n            if (success) success();\n            break;\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBSentinel.h",
    "content": "//\n//  YBIBSentinel.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/18.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Thread safe.\n */\n@interface YBIBSentinel : NSObject\n\n/// Returns the current value of the counter.\n@property (readonly) int32_t value;\n\n/**\n Increase the value atomically.\n @return The new value.\n */\n- (int32_t)increase;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBSentinel.m",
    "content": "//\n//  YBIBSentinel.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/18.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBSentinel.h\"\n#import <libkern/OSAtomic.h>\n\n@implementation YBIBSentinel {\n    int32_t _value;\n}\n\n- (int32_t)value {\n    return _value;\n}\n\n- (int32_t)increase {\n    return OSAtomicIncrement32(&_value);\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBUtilities.h",
    "content": "//\n//  YBIBUtilities.h\n//  YBImageBrowserDemo\n//\n//  Created by 杨少 on 2018/4/11.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n\n#define YBIB_DISPATCH_ASYNC(queue, block)\\\nif (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(queue)) == 0) {\\\nblock();\\\n} else {\\\ndispatch_async(queue, block);\\\n}\n\n#define YBIB_DISPATCH_ASYNC_MAIN(block) YBIB_DISPATCH_ASYNC(dispatch_get_main_queue(), block)\n\n\n#define YBIB_CODE_EXEC_TIME(KEY, ...) \\\nCFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent(); \\\n__VA_ARGS__ \\\nCFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() - startTime); \\\nNSLog(@\"%@ Time-Consuming: %fms\", KEY, linkTime * 1000.0);\n\n\nUIWindow * _Nonnull YBIBNormalWindow(void);\n\nUIViewController * _Nullable YBIBTopController(void);\nUIViewController * _Nullable YBIBTopControllerByWindow(UIWindow *);\n\nBOOL YBIBLowMemory(void);\n\nBOOL YBIBIsIphoneXSeries(void);\nCGFloat YBIBStatusbarHeight(void);\nCGFloat YBIBSafeAreaBottomHeight(void);\n\nUIImage *YBIBSnapshotView(UIView *);\n\n/// This is orientation of 'YBImageBrowser' not 'UIDevice'.\nUIEdgeInsets YBIBPaddingByBrowserOrientation(UIDeviceOrientation);\n\n\n@interface YBIBUtilities : NSObject\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Helper/YBIBUtilities.m",
    "content": "//\n//  YBIBUtilities.m\n//  YBImageBrowserDemo\n//\n//  Created by 杨少 on 2018/4/11.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBIBUtilities.h\"\n#import <sys/utsname.h>\n\n\nUIWindow * _Nullable YBIBNormalWindow(void) {\n    UIWindow *window = [[UIApplication sharedApplication] keyWindow];\n    if (window.windowLevel != UIWindowLevelNormal) {\n        NSArray *windows = [[UIApplication sharedApplication] windows];\n        for(UIWindow *temp in windows) {\n            if (temp.windowLevel == UIWindowLevelNormal) {\n                return temp;\n            }\n        }\n    }\n    return window;\n}\n\nUIViewController * _Nullable YBIBTopController(void) {\n    return YBIBTopControllerByWindow(YBIBNormalWindow());\n}\n\nUIViewController * _Nullable YBIBTopControllerByWindow(UIWindow *window) {\n    if (!window) return nil;\n        \n    UIViewController *top = nil;\n    id nextResponder;\n    if (window.subviews.count > 0) {\n        UIView *frontView = [window.subviews objectAtIndex:0];\n        nextResponder = frontView.nextResponder;\n    }\n    if (nextResponder && [nextResponder isKindOfClass:UIViewController.class]) {\n        top = nextResponder;\n    } else {\n        top = window.rootViewController;\n    }\n    \n    while ([top isKindOfClass:UITabBarController.class] || [top isKindOfClass:UINavigationController.class] || top.presentedViewController) {\n        if ([top isKindOfClass:UITabBarController.class]) {\n            top = ((UITabBarController *)top).selectedViewController;\n        } else if ([top isKindOfClass:UINavigationController.class]) {\n            top = ((UINavigationController *)top).topViewController;\n        } else if (top.presentedViewController) {\n            top = top.presentedViewController;\n        }\n    }\n    return top;\n}\n\nBOOL YBIBLowMemory(void) {\n    static BOOL lowMemory = NO;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        unsigned long long physicalMemory = [[NSProcessInfo processInfo] physicalMemory];\n        lowMemory = physicalMemory > 0 && physicalMemory < 1024 * 1024 * 1500;\n    });\n    return lowMemory;\n}\n\nBOOL YBIBIsIphoneXSeries(void) {\n    return YBIBStatusbarHeight() > 20;\n}\n\nCGFloat YBIBStatusbarHeight(void) {\n    CGFloat height = 0;\n    if (@available(iOS 11.0, *)) {\n        height = UIApplication.sharedApplication.delegate.window.safeAreaInsets.top;\n    }\n    if (height <= 0) {\n        height = UIApplication.sharedApplication.statusBarFrame.size.height;\n    }\n    if (height <= 0) {\n        height = 20;\n    }\n    return height;\n}\n\nCGFloat YBIBSafeAreaBottomHeight(void) {\n    CGFloat bottom = 0;\n    if (@available(iOS 11.0, *)) {\n        bottom = UIApplication.sharedApplication.delegate.window.safeAreaInsets.bottom;\n    }\n    return bottom;\n}\n\nUIImage *YBIBSnapshotView(UIView *view) {\n    UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, [UIScreen mainScreen].scale);\n    [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];\n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    return image;\n}\n\nUIEdgeInsets YBIBPaddingByBrowserOrientation(UIDeviceOrientation orientation) {\n    UIEdgeInsets padding = UIEdgeInsetsZero;\n    if (!YBIBIsIphoneXSeries()) return padding;\n    \n    UIDeviceOrientation barOrientation = (UIDeviceOrientation)UIApplication.sharedApplication.statusBarOrientation;\n    \n    if (UIDeviceOrientationIsLandscape(orientation)) {\n        BOOL same = orientation == barOrientation;\n        BOOL reverse = !same && UIDeviceOrientationIsLandscape(barOrientation);\n        if (same) {\n            padding.bottom = YBIBSafeAreaBottomHeight();\n            padding.top = 0;\n        } else if (reverse) {\n            padding.top = YBIBSafeAreaBottomHeight();\n            padding.bottom = 0;\n        }\n        padding.left = padding.right = MAX(YBIBSafeAreaBottomHeight(), YBIBStatusbarHeight());\n    } else {\n        if (orientation == UIDeviceOrientationPortrait) {\n            padding.top = YBIBStatusbarHeight();\n            padding.bottom = barOrientation == UIDeviceOrientationPortrait ? YBIBSafeAreaBottomHeight() : 0;\n        } else {\n            padding.bottom = YBIBStatusbarHeight();\n            padding.top = barOrientation == UIDeviceOrientationPortrait ? YBIBSafeAreaBottomHeight() : 0;\n        }\n        padding.left = padding.right = UIDeviceOrientationIsLandscape(barOrientation) ? YBIBSafeAreaBottomHeight() : 0 ;\n    }\n    return padding;\n}\n\n\n@implementation YBIBUtilities\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageCache+Internal.h",
    "content": "//\n//  YBIBImageCache+Internal.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/13.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBImageCache.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef NS_ENUM(NSInteger, YBIBImageCacheType) {\n    YBIBImageCacheTypeOrigin,\n    YBIBImageCacheTypeCompressed\n};\n\n/**\n Not thread safe.\n */\n@interface YBIBImageCache ()\n\n- (void)setImage:(UIImage *)image type:(YBIBImageCacheType)type forKey:(NSString *)key resident:(BOOL)resident;\n\n- (nullable UIImage *)imageForKey:(NSString *)key type:(YBIBImageCacheType)type;\n\n- (void)removeForKey:(NSString *)key;\n\n- (void)removeResidentForKey:(NSString *)key;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageCache.h",
    "content": "//\n//  YBIBImageCache.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/13.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBIBImageCache;\n\n@interface NSObject (YBIBImageCache)\n\n/// 图片浏览器持有的图片缓存管理类\n@property (nonatomic, strong, readonly) YBIBImageCache *ybib_imageCache;\n\n@end\n\n\n@interface YBIBImageCache : NSObject\n\n/// 缓存数量限制（一个单位表示一个 YBIBImageData 产生的所有图片数据）\n@property (nonatomic, assign) NSUInteger imageCacheCountLimit;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageCache.m",
    "content": "//\n//  YBIBImageCache.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/13.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBImageCache.h\"\n#import \"YBIBImageCache+Internal.h\"\n#import \"YBIBUtilities.h\"\n#import <objc/runtime.h>\n\n\n@implementation NSObject (YBIBImageCache)\nstatic void *YBIBImageCacheKey = &YBIBImageCacheKey;\n- (void)setYbib_imageCache:(YBIBImageCache *)ybib_imageCache {\n    objc_setAssociatedObject(self, YBIBImageCacheKey, ybib_imageCache, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n- (YBIBImageCache *)ybib_imageCache {\n    YBIBImageCache *cache = objc_getAssociatedObject(self, YBIBImageCacheKey);\n    if (!cache) {\n        cache = [YBIBImageCache new];\n        self.ybib_imageCache = cache;\n    }\n    return cache;\n}\n@end\n\n\n@interface YBIBImageCachePack : NSObject\n@property (nonatomic, strong) UIImage *originImage;\n@property (nonatomic, strong) UIImage *compressedImage;\n@end\n@implementation YBIBImageCachePack\n@end\n\n\n@implementation YBIBImageCache {\n    NSCache<NSString *, YBIBImageCachePack *> *_imageCache;\n    NSMutableDictionary<NSString *, YBIBImageCachePack *> *_residentCache;\n}\n\n#pragma mark - life cycle\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _imageCache = [NSCache new];\n        _imageCache.countLimit = _imageCacheCountLimit = YBIBLowMemory() ? 6 : 12;\n        _residentCache = [NSMutableDictionary dictionary];\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n    }\n    return self;\n}\n\n#pragma mark - event\n\n- (void)didReceiveMemoryWarning:(NSNotification *)notification {\n    [_imageCache removeAllObjects];\n    [_residentCache removeAllObjects];\n}\n\n#pragma mark - public\n\n- (void)setImage:(UIImage *)image type:(YBIBImageCacheType)type forKey:(NSString *)key resident:(BOOL)resident {\n    YBIBImageCachePack *pack = [_imageCache objectForKey:key];\n    if (!pack) {\n        pack = [YBIBImageCachePack new];\n        [_imageCache setObject:pack forKey:key];\n    }\n    switch (type) {\n        case YBIBImageCacheTypeOrigin:\n            pack.originImage = image;\n            break;\n        case YBIBImageCacheTypeCompressed:\n            pack.compressedImage = image;\n            break;\n    }\n    [_residentCache setObject:pack forKey:key];\n}\n\n- (UIImage *)imageForKey:(NSString *)key type:(YBIBImageCacheType)type {\n    YBIBImageCachePack *pack = [_imageCache objectForKey:key] ?: [_residentCache objectForKey:key];\n    switch (type) {\n        case YBIBImageCacheTypeOrigin: return pack.originImage;\n        case YBIBImageCacheTypeCompressed: return pack.compressedImage;\n        default: return nil;\n    }\n}\n\n- (void)removeForKey:(NSString *)key {\n    [_imageCache removeObjectForKey:key];\n    [_residentCache removeObjectForKey:key];\n}\n\n- (void)removeResidentForKey:(NSString *)key {\n    [_residentCache removeObjectForKey:key];\n}\n\n#pragma mark - setter\n\n- (void)setImageCacheCountLimit:(NSUInteger)imageCacheCountLimit {\n    _imageCacheCountLimit = imageCacheCountLimit;\n    _imageCache.countLimit = imageCacheCountLimit;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageCell+Internal.h",
    "content": "//\n//  YBIBImageCell+Internal.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/12/23.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBImageCell.h\"\n#import \"YBIBImageScrollView.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBImageCell ()\n\n@property (nonatomic, strong) YBIBImageScrollView *imageScrollView;\n\n@property (nonatomic, strong) UIImageView *tailoringImageView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageCell.h",
    "content": "//\n//  YBIBImageCell.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBCellProtocol.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBImageCell : UICollectionViewCell <YBIBCellProtocol>\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageCell.m",
    "content": "//\n//  YBIBImageCell.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBImageCell.h\"\n#import \"YBIBImageData.h\"\n#import \"YBIBIconManager.h\"\n#import \"YBIBImageCell+Internal.h\"\n#import \"YBIBImageData+Internal.h\"\n#import \"YBIBCopywriter.h\"\n#import \"YBIBUtilities.h\"\n\n@interface YBIBImageCell () <YBIBImageDataDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate>\n@end\n\n@implementation YBIBImageCell {\n    CGPoint _interactStartPoint;\n    BOOL _interacting;\n}\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self initValue];\n        [self.contentView addSubview:self.imageScrollView];\n        [self addGesture];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    self.imageScrollView.frame = self.bounds;\n}\n\n- (void)initValue {\n    _interactStartPoint = CGPointZero;\n    _interacting = NO;\n}\n\n- (void)prepareForReuse {\n    ((YBIBImageData *)self.yb_cellData).delegate = nil;\n    [self.imageScrollView reset];\n    [self hideTailoringImageView];\n    [self hideAuxiliaryView];\n    [super prepareForReuse];\n}\n\n#pragma mark - <YBIBCellProtocol>\n\n@synthesize yb_currentOrientation = _yb_currentOrientation;\n@synthesize yb_containerSize = _yb_containerSize;\n@synthesize yb_backView = _yb_backView;\n@synthesize yb_collectionView = _yb_collectionView;\n@synthesize yb_isTransitioning = _yb_isTransitioning;\n@synthesize yb_isRotating = _yb_isRotating;\n@synthesize yb_auxiliaryViewHandler = _yb_auxiliaryViewHandler;\n@synthesize yb_hideStatusBar = _yb_hideStatusBar;\n@synthesize yb_hideBrowser = _yb_hideBrowser;\n@synthesize yb_hideToolViews = _yb_hideToolViews;\n@synthesize yb_cellData = _yb_cellData;\n@synthesize yb_cellIsInCenter = _yb_cellIsInCenter;\n@synthesize yb_selfPage = _yb_selfPage;\n@synthesize yb_currentPage = _yb_currentPage;\n\n- (void)setYb_cellData:(id<YBIBDataProtocol>)yb_cellData {\n    _yb_cellData = yb_cellData;\n    ((YBIBImageData *)yb_cellData).delegate = self;\n}\n\n- (UIView *)yb_foregroundView {\n    return self.imageScrollView.imageView;\n}\n\n- (void)yb_orientationWillChangeWithExpectOrientation:(UIDeviceOrientation)orientation {\n    [self hideTailoringImageView];\n}\n\n- (void)yb_orientationChangeAnimationWithExpectOrientation:(UIDeviceOrientation)orientation {\n    [self updateImageLayoutWithOrientation:orientation previousImageSize:self.imageScrollView.imageView.image.size];\n}\n\n#pragma mark - private\n\n- (CGSize)contentSizeWithContainerSize:(CGSize)containerSize imageViewFrame:(CGRect)imageViewFrame {\n    return CGSizeMake(MAX(containerSize.width, imageViewFrame.size.width), MAX(containerSize.height, imageViewFrame.size.height));\n}\n\n- (void)updateImageLayoutWithOrientation:(UIDeviceOrientation)orientation previousImageSize:(CGSize)previousImageSize {\n    if (_interacting) [self restoreInteractionWithDuration:0];\n    \n    YBIBImageData *data = self.yb_cellData;\n    \n    CGSize imageSize;\n    \n    UIImage *image = self.imageScrollView.imageView.image;\n    YBIBScrollImageType imageType = self.imageScrollView.imageType;\n    if (imageType == YBIBScrollImageTypeCompressed) {\n        imageSize = data.originImage ? data.originImage.size : image.size;\n    } else {\n        imageSize = image.size;\n    }\n    \n    CGSize containerSize = self.yb_containerSize(orientation);\n    CGRect imageViewFrame = [data.layout yb_imageViewFrameWithContainerSize:containerSize imageSize:imageSize orientation:orientation];\n    CGSize contentSize = [self contentSizeWithContainerSize:containerSize imageViewFrame:imageViewFrame];\n    CGFloat maxZoomScale = imageType == YBIBScrollImageTypeThumb ? 1 : [data.layout yb_maximumZoomScaleWithContainerSize:containerSize imageSize:imageSize orientation:orientation];\n    \n    // 'zoomScale' must set before 'contentSize' and 'imageView.frame'.\n    self.imageScrollView.zoomScale = 1;\n    self.imageScrollView.contentSize = contentSize;\n    self.imageScrollView.minimumZoomScale = 1;\n    self.imageScrollView.maximumZoomScale = maxZoomScale;\n    \n    CGFloat scale;\n    if (previousImageSize.width > 0 && previousImageSize.height > 0) {\n        scale = imageSize.width / imageSize.height - previousImageSize.width / previousImageSize.height;\n    } else {\n        scale = 0;\n    }\n    // '0.001' is admissible error.\n    if (ABS(scale) <= 0.001) {\n        self.imageScrollView.imageView.frame = imageViewFrame;\n    } else {\n        [UIView animateWithDuration:0.25 animations:^{\n            self.imageScrollView.imageView.frame = imageViewFrame;\n        }];\n    }\n}\n\n- (void)cuttingImage {\n    // This method has been delayed called, so 'browser' may be in transit now.\n    if (self.yb_isTransitioning()) return;\n    if (_interacting) return;\n    \n    YBIBImageData *data = self.yb_cellData;\n    if (!data.originImage) return;\n    \n    if (self.imageScrollView.zoomScale < data.cuttingZoomScale) return;\n    \n    if ([data shouldCompress]) {\n        [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cuttingImage_) object:nil];\n        [self performSelector:@selector(cuttingImage_) withObject:nil afterDelay:0.15];\n    }\n}\n- (void)cuttingImage_ {\n    YBIBImageData *data = self.yb_cellData;\n    if (!data.originImage) return;\n    \n    CGFloat scale = data.originImage.size.width / self.imageScrollView.contentSize.width;\n    CGFloat x = self.imageScrollView.contentOffset.x * scale,\n    y = self.imageScrollView.contentOffset.y * scale,\n    width = self.imageScrollView.bounds.size.width * scale,\n    height = self.imageScrollView.bounds.size.height * scale;\n    \n    __weak typeof(self) wSelf = self;\n    [data cuttingImageToRect:CGRectMake(x, y, width, height) complete:^(UIImage *image) {\n        if (!image) return;\n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            if (data == self.yb_cellData && !self.imageScrollView.isDragging && !self->_interacting && !self.yb_isTransitioning()) {\n                [self showTailoringImageView:image];\n            }\n        })\n    }];\n}\n\n- (void)showTailoringImageView:(UIImage *)image {\n    CGSize containerSize = self.yb_containerSize(self.yb_currentOrientation());\n    if (!self.tailoringImageView.superview) {\n        [self.contentView addSubview:self.tailoringImageView];\n    }\n    self.tailoringImageView.frame = CGRectMake(0, 0, containerSize.width, containerSize.height);\n    self.tailoringImageView.hidden = NO;\n    self.tailoringImageView.image = image;\n}\n\n- (void)hideTailoringImageView {\n    // Don't use 'getter' method, because it's according to the need to load.\n    if (_tailoringImageView) {\n        self.tailoringImageView.hidden = YES;\n    }\n}\n\n- (void)hideAuxiliaryView {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    [self.yb_auxiliaryViewHandler() yb_hideToastWithContainer:self];\n}\n\n- (void)hideBrowser {\n    ((YBIBImageData *)self.yb_cellData).delegate = nil;\n    [self hideTailoringImageView];\n    [self hideAuxiliaryView];\n    self.yb_hideBrowser();\n    _interacting = NO;\n}\n\n#pragma mark - <YBIBImageDataDelegate>\n\n- (void)yb_imageData:(YBIBImageData *)data startLoadingWithStatus:(YBIBImageLoadingStatus)status {\n    switch (status) {\n        case YBIBImageLoadingStatusDecoding: {\n            if (!self.imageScrollView.imageView.image) {\n                [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self];\n            }\n        }\n            break;\n        case YBIBImageLoadingStatusProcessing: {\n            if (!self.imageScrollView.imageView.image) {\n                [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self];\n            }\n        }\n            break;\n        case YBIBImageLoadingStatusCompressing: {\n            if (!self.imageScrollView.imageView.image) {\n                [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self];\n            }\n        }\n            break;\n        case YBIBImageLoadingStatusReadingPHAsset: {\n            if (!self.imageScrollView.imageView.image) {\n                [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self];\n            }\n        }\n            break;\n        case YBIBImageLoadingStatusNone: {\n            [self hideAuxiliaryView];\n        }\n            break;\n        default:\n            break;\n    }\n}\n\n- (void)yb_imageData:(YBIBImageData *)data readyForImage:(__kindof UIImage *)image {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    if (self.imageScrollView.imageView.image == image) return;\n    \n    CGSize size = self.imageScrollView.imageView.image.size;\n    [self.imageScrollView setImage:image type:YBIBScrollImageTypeOriginal];\n    [self updateImageLayoutWithOrientation:self.yb_currentOrientation() previousImageSize:size];\n}\n\n- (void)yb_imageData:(YBIBImageData *)data readyForCompressedImage:(__kindof UIImage *)image {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    if (self.imageScrollView.imageView.image == image) return;\n    \n    CGSize size = self.imageScrollView.imageView.image.size;\n    [self.imageScrollView setImage:image type:YBIBScrollImageTypeCompressed];\n    [self updateImageLayoutWithOrientation:self.yb_currentOrientation() previousImageSize:size];\n}\n\n- (void)yb_imageData:(YBIBImageData *)data readyForThumbImage:(__kindof UIImage *)image {\n    if (self.imageScrollView.imageView.image) return;\n    \n    [self.imageScrollView setImage:image type:YBIBScrollImageTypeThumb];\n    [self updateImageLayoutWithOrientation:self.yb_currentOrientation() previousImageSize:image.size];\n}\n\n- (void)yb_imageIsInvalidForData:(YBIBImageData *)data {\n    [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n    NSString *imageIsInvalid = [YBIBCopywriter sharedCopywriter].imageIsInvalid;\n    if (self.imageScrollView.imageView.image) {\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self text:imageIsInvalid];\n    } else {\n        [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self text:imageIsInvalid];\n    }\n}\n\n- (void)yb_imageData:(YBIBImageData *)data downloadProgress:(CGFloat)progress {\n    [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self progress:progress];\n}\n\n- (void)yb_imageDownloadFailedForData:(YBIBImageData *)data {\n    if (self.imageScrollView.imageView.image) {\n        [self.yb_auxiliaryViewHandler() yb_hideLoadingWithContainer:self];\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self text:[YBIBCopywriter sharedCopywriter].downloadFailed];\n    } else {\n        [self.yb_auxiliaryViewHandler() yb_showLoadingWithContainer:self text:[YBIBCopywriter sharedCopywriter].downloadFailed];\n    }\n}\n\n#pragma mark - gesture\n\n- (void)addGesture {\n    UITapGestureRecognizer *tapSingle = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(respondsToTapSingle:)];\n    tapSingle.numberOfTapsRequired = 1;\n    UITapGestureRecognizer *tapDouble = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(respondsToTapDouble:)];\n    tapDouble.numberOfTapsRequired = 2;\n    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(respondsToPan:)];\n    pan.maximumNumberOfTouches = 1;\n    pan.delegate = self;\n    \n    [tapSingle requireGestureRecognizerToFail:tapDouble];\n    [tapSingle requireGestureRecognizerToFail:pan];\n    [tapDouble requireGestureRecognizerToFail:pan];\n    \n    [self addGestureRecognizer:tapSingle];\n    [self addGestureRecognizer:tapDouble];\n    [self addGestureRecognizer:pan];\n}\n\n- (void)respondsToTapSingle:(UITapGestureRecognizer *)tap {\n    if (self.yb_isRotating()) return;\n    \n    YBIBImageData *data = self.yb_cellData;\n    if (data.singleTouchBlock) {\n        data.singleTouchBlock(data);\n    } else {\n        [self hideTailoringImageView];\n        [self hideAuxiliaryView];\n        self.yb_hideBrowser();\n    }\n}\n\n- (void)respondsToTapDouble:(UITapGestureRecognizer *)tap {\n    if (self.yb_isRotating()) return;\n    \n    [self hideTailoringImageView];\n    \n    UIScrollView *scrollView = self.imageScrollView;\n    UIView *zoomView = [self viewForZoomingInScrollView:scrollView];\n    CGPoint point = [tap locationInView:zoomView];\n    if (!CGRectContainsPoint(zoomView.bounds, point)) return;\n    if (scrollView.zoomScale == scrollView.maximumZoomScale) {\n        [scrollView setZoomScale:1 animated:YES];\n    } else {\n        [scrollView zoomToRect:CGRectMake(point.x, point.y, 1, 1) animated:YES];\n    }\n}\n\n- (void)respondsToPan:(UIPanGestureRecognizer *)pan {\n    if (self.yb_isRotating()) return;\n    \n    YBIBInteractionProfile *profile = ((YBIBImageData *)self.yb_cellData).interactionProfile;\n    if (profile.disable) return;\n    if ((CGRectIsEmpty(self.imageScrollView.imageView.frame) || !self.imageScrollView.imageView.image)) return;\n    \n    CGPoint point = [pan locationInView:self];\n    CGSize containerSize = self.yb_containerSize(self.yb_currentOrientation());\n    \n    if (pan.state == UIGestureRecognizerStateBegan) {\n        _interactStartPoint = point;\n    } else if (pan.state == UIGestureRecognizerStateCancelled || pan.state == UIGestureRecognizerStateEnded || pan.state == UIGestureRecognizerStateRecognized || pan.state == UIGestureRecognizerStateFailed) {\n        \n        // End.\n        if (_interacting) {\n            CGPoint velocity = [pan velocityInView:self.imageScrollView];\n            \n            BOOL velocityArrive = ABS(velocity.y) > profile.dismissVelocityY;\n            BOOL distanceArrive = ABS(point.y - _interactStartPoint.y) > containerSize.height * profile.dismissScale;\n            \n            BOOL shouldDismiss = distanceArrive || velocityArrive;\n            if (shouldDismiss) {\n                [self hideBrowser];\n            } else {\n                [self restoreInteractionWithDuration:profile.restoreDuration];\n            }\n        }\n        \n    } else if (pan.state == UIGestureRecognizerStateChanged) {\n        if (_interacting) {\n\n            // Change.\n            self.imageScrollView.center = point;\n            CGFloat scale = 1 - ABS(point.y - _interactStartPoint.y) / (containerSize.height * 1.2);\n            if (scale > 1) scale = 1;\n            if (scale < 0.35) scale = 0.35;\n            self.imageScrollView.transform = CGAffineTransformMakeScale(scale, scale);\n\n            CGFloat alpha = 1 - ABS(point.y - _interactStartPoint.y) / (containerSize.height * 0.7);\n            if (alpha > 1) alpha = 1;\n            if (alpha < 0) alpha = 0;\n            self.yb_backView.backgroundColor = [self.yb_backView.backgroundColor colorWithAlphaComponent:alpha];\n\n        } else {\n\n            // Start.\n            if (CGPointEqualToPoint(_interactStartPoint, CGPointZero) || self.yb_currentPage() != self.yb_selfPage() || !self.yb_cellIsInCenter() || self.imageScrollView.isZooming) return;\n\n            CGPoint velocity = [pan velocityInView:self.imageScrollView];\n            CGFloat triggerDistance = profile.triggerDistance;\n            CGFloat offsetY = self.imageScrollView.contentOffset.y, height = self.imageScrollView.bounds.size.height;\n\n            BOOL distanceArrive = ABS(point.x - _interactStartPoint.x) < triggerDistance && ABS(velocity.x) < 500;\n            BOOL upArrive = point.y - _interactStartPoint.y > triggerDistance && offsetY <= 1;\n            BOOL downArrive = point.y - _interactStartPoint.y < -triggerDistance && offsetY + height >= MAX(self.imageScrollView.contentSize.height, height) - 1;\n\n            BOOL shouldStart = (upArrive || downArrive) && distanceArrive;\n            if (!shouldStart) return;\n\n            _interactStartPoint = point;\n\n            CGRect startFrame = self.imageScrollView.frame;\n            CGFloat anchorX = point.x / startFrame.size.width, anchorY = point.y / startFrame.size.height;\n            self.imageScrollView.layer.anchorPoint = CGPointMake(anchorX, anchorY);\n            self.imageScrollView.userInteractionEnabled = NO;\n            self.imageScrollView.scrollEnabled = NO;\n            self.imageScrollView.center = point;\n            \n            self.yb_hideToolViews(YES);\n            self.yb_hideStatusBar(NO);\n            self.yb_collectionView().scrollEnabled = NO;\n            [self hideTailoringImageView];\n\n            _interacting = YES;\n        }\n    }\n}\n\n- (void)restoreInteractionWithDuration:(NSTimeInterval)duration {\n    CGSize containerSize = self.yb_containerSize(self.yb_currentOrientation());\n    \n    void (^animations)(void) = ^{\n        self.yb_backView.backgroundColor = [self.yb_backView.backgroundColor colorWithAlphaComponent:1];\n        \n        CGPoint anchorPoint = self.imageScrollView.layer.anchorPoint;\n        self.imageScrollView.center = CGPointMake(containerSize.width * anchorPoint.x, containerSize.height * anchorPoint.y);\n        self.imageScrollView.transform = CGAffineTransformIdentity;\n    };\n    void (^completion)(BOOL finished) = ^(BOOL finished){\n        self.imageScrollView.layer.anchorPoint = CGPointMake(0.5, 0.5);\n        self.imageScrollView.center = CGPointMake(containerSize.width * 0.5, containerSize.height * 0.5);\n        self.imageScrollView.userInteractionEnabled = YES;\n        self.imageScrollView.scrollEnabled = YES;\n        \n        self.yb_hideToolViews(NO);\n        self.yb_hideStatusBar(YES);\n        self.yb_collectionView().scrollEnabled = YES;\n        [self cuttingImage];\n        \n        self->_interactStartPoint = CGPointZero;\n        self->_interacting = NO;\n    };\n    \n    if (duration <= 0) {\n        animations();\n        completion(NO);\n    } else {\n        [UIView animateWithDuration:duration animations:animations completion:completion];\n    }\n}\n\n#pragma mark - <UIScrollViewDelegate>\n\n- (void)scrollViewDidZoom:(UIScrollView *)scrollView {\n    YBIBImageData *data = self.yb_cellData;\n    if (data.imageDidZoomBlock) {\n        data.imageDidZoomBlock(data, scrollView);\n    }\n    \n    CGRect imageViewFrame = self.imageScrollView.imageView.frame;\n    CGFloat width = imageViewFrame.size.width,\n    height = imageViewFrame.size.height,\n    sHeight = scrollView.bounds.size.height,\n    sWidth = scrollView.bounds.size.width;\n    if (height > sHeight) {\n        imageViewFrame.origin.y = 0;\n    } else {\n        imageViewFrame.origin.y = (sHeight - height) / 2.0;\n    }\n    if (width > sWidth) {\n        imageViewFrame.origin.x = 0;\n    } else {\n        imageViewFrame.origin.x = (sWidth - width) / 2.0;\n    }\n    self.imageScrollView.imageView.frame = imageViewFrame;\n}\n\n- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {\n    return self.imageScrollView.imageView;\n}\n\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n    YBIBImageData *data = self.yb_cellData;\n    if (data.imageDidScrollBlock) {\n        data.imageDidScrollBlock(data, scrollView);\n    }\n    \n    [self cuttingImage];\n}\n\n- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view {\n    [self hideTailoringImageView];\n}\n\n- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {\n    [self hideTailoringImageView];\n}\n\n#pragma mark - <UIGestureRecognizerDelegate>\n\n- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {\n    return YES;\n}\n\n#pragma mark - getters\n\n- (YBIBImageScrollView *)imageScrollView {\n    if (!_imageScrollView) {\n        _imageScrollView = [YBIBImageScrollView new];\n        _imageScrollView.delegate = self;\n    }\n    return _imageScrollView;\n}\n\n- (UIImageView *)tailoringImageView {\n    if (!_tailoringImageView) {\n        _tailoringImageView = [UIImageView new];\n        _tailoringImageView.contentMode = UIViewContentModeScaleAspectFit;\n    }\n    return _tailoringImageView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageData+Internal.h",
    "content": "//\n//  YBIBImageData+Internal.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/12.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBImageData.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef NS_ENUM(NSInteger, YBIBImageLoadingStatus) {\n    YBIBImageLoadingStatusNone,\n    YBIBImageLoadingStatusCompressing,\n    YBIBImageLoadingStatusDecoding,\n    YBIBImageLoadingStatusQuerying,\n    YBIBImageLoadingStatusProcessing,\n    YBIBImageLoadingStatusDownloading,\n    YBIBImageLoadingStatusReadingPHAsset,\n};\n\n@class YBIBImageData;\n\n@protocol YBIBImageDataDelegate <NSObject>\n@required\n\n- (void)yb_imageData:(YBIBImageData *)data startLoadingWithStatus:(YBIBImageLoadingStatus)status;\n\n- (void)yb_imageIsInvalidForData:(YBIBImageData *)data;\n\n- (void)yb_imageData:(YBIBImageData *)data readyForImage:(__kindof UIImage *)image;\n\n- (void)yb_imageData:(YBIBImageData *)data readyForThumbImage:(__kindof UIImage *)image;\n\n- (void)yb_imageData:(YBIBImageData *)data readyForCompressedImage:(__kindof UIImage *)image;\n\n- (void)yb_imageData:(YBIBImageData *)data downloadProgress:(CGFloat)progress;\n\n- (void)yb_imageDownloadFailedForData:(YBIBImageData *)data;\n\n@end\n\n@interface YBIBImageData ()\n\n@property (nonatomic, weak) id<YBIBImageDataDelegate> delegate;\n\n/// The status of asynchronous tasks.\n@property (nonatomic, assign) YBIBImageLoadingStatus loadingStatus;\n\n/// The origin image.\n@property (nonatomic, strong) UIImage *originImage;\n\n/// The image compressed by 'originImage' if need.\n@property (nonatomic, strong) UIImage *compressedImage;\n\n- (BOOL)shouldCompress;\n\n- (void)cuttingImageToRect:(CGRect)rect complete:(void(^)(UIImage * _Nullable image))complete;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageData.h",
    "content": "//\n//  YBIBImageData.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <Photos/Photos.h>\n#import \"YBIBDataProtocol.h\"\n#import \"YBIBImageLayout.h\"\n#import \"YBIBImageCache.h\"\n#import \"YBIBInteractionProfile.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBIBImageData;\n\n/// 获取 NSData 的闭包\ntypedef NSData * _Nullable (^YBIBImageDataBlock)(void);\n\n/// 获取 UIImage 的闭包\ntypedef UIImage * _Nullable (^YBIBImageBlock)(void);\n\n/// 修改 NSURLRequest 并返回的闭包\ntypedef NSURLRequest * _Nullable (^YBIBRequestModifierBlock)(YBIBImageData *imageData, NSURLRequest *request);\n\n/// 根据图片逻辑像素和 scale 判断是否需要预解码的闭包\ntypedef BOOL (^YBIBPreDecodeDecisionBlock)(YBIBImageData *imageData, CGSize imageSize, CGFloat scale);\n\n/// 修改 UIImage 并返回的闭包\ntypedef void (^YBIBImageModifierBlock)(YBIBImageData *imageData, UIImage *image, void(^completion)(UIImage *processedImage));\n\n/// 单击事件的处理闭包\ntypedef void (^YBIBImageSingleTouchBlock)(YBIBImageData *imageData);\n\n/// 内部图片滚动视图状态回调闭包\ntypedef void (^YBIBImageScrollViewStatusBlock)(YBIBImageData *imageData, UIScrollView *scrollView);\n\n\n/**\n 图片数据类，承担配置数据和处理数据的责任\n */\n@interface YBIBImageData : NSObject <YBIBDataProtocol>\n\n/// 本地图片名字\n@property (nonatomic, copy, nullable) NSString *imageName;\n\n/// 本地图片路径\n@property (nonatomic, copy, nullable) NSString *imagePath;\n\n/// 本地图片字节码，返回 NSData\n@property (nonatomic, copy, nullable) YBIBImageDataBlock imageData;\n\n/// 本地图片，返回 UIImage 及其衍生类 (若不是遵循'YYAnimatedImage'协议的类型，将失去对动图和拓展格式的支持)\n@property (nonatomic, copy, nullable) YBIBImageBlock image;\n\n/// 网络图片资源\n@property (nonatomic, copy, nullable) NSURL *imageURL;\n\n/// 修改 NSURLRequest 并返回\n@property (nonatomic, copy, nullable) YBIBRequestModifierBlock requestModifier;\n\n/// 相册图片资源\n@property (nonatomic, strong, nullable) PHAsset *imagePHAsset;\n\n/// 投影视图，当前数据模型对应外界业务的 UIView (通常为 UIImageView)，做转场动效用\n@property (nonatomic, weak, nullable) __kindof UIView *projectiveView;\n\n/// 预览图/缩约图，注意若这个图片过大会导致内存压力（若 projectiveView 存在且是 UIImageView 类型将会自动获取缩约图）\n@property (nonatomic, strong, nullable) UIImage *thumbImage;\n\n/// 预览图/缩约图 URL，缓存中未找到则忽略（若 projectiveView 存在且是 UIImageView 类型将会自动获取缩约图）\n@property (nonatomic, copy, nullable) NSURL *thumbURL;\n\n/// 是否允许保存到相册\n@property (nonatomic, assign) BOOL allowSaveToPhotoAlbum;\n\n/// 根据图片信息判断是否需要预解码\n@property (nonatomic, copy, nullable) YBIBPreDecodeDecisionBlock preDecodeDecision;\n\n/// 是否异步预解码，默认为 YES\n@property (nonatomic, assign) BOOL shouldPreDecodeAsync;\n\n/// 压缩物理像素界限大小，当图片超过这个值将会被压缩显示，默认为 4096*4096\n@property (nonatomic, assign) CGFloat compressingSize;\n\n/// 触发裁剪的缩放比例，必须大于等于 1，默认情况内部会动态计算 (仅当图片需要压缩显示时有效)\n@property (nonatomic, assign) CGFloat cuttingZoomScale;\n\n/**\n 判断图片是否需要压缩显示\n */\n- (BOOL)shouldCompressWithImage:(UIImage *)image;\n\n/**\n 修改原始图片并返回处理后的图片 (特别注意当 image 是大图的时候，避免 OOM)\n Example:\n    [... setImageModifier:^(YBIBImageData *imageData, UIImage * _Nonnull image, void (^ _Nonnull completion)(UIImage * _Nonnull)) {\n        //step 1 : Add watermark, trademark, etc. (Sync or async).\n        ... processing code ...\n        //step 2 : Return the processed UIImage.\n        completion(image);\n    }];\n */\n@property (nonatomic, copy, nullable) YBIBImageModifierBlock originImageModifier;\n\n/// 修改压缩图片并返回处理后的图片 (仅在当前图片需要被压缩时有效)\n@property (nonatomic, copy, nullable) YBIBImageModifierBlock compressedImageModifier;\n\n/// 修改裁剪图片并返回处理后的图片 (仅在当前图片需要被裁剪时有效)\n@property (nonatomic, copy, nullable) YBIBImageModifierBlock cuttedImageModifier;\n\n/// 预留属性可随意使用\n@property (nonatomic, strong, nullable) id extraData;\n\n/// 手势交互动效配置文件\n@property (nonatomic, strong) YBIBInteractionProfile *interactionProfile;\n\n/// 单击的处理，默认是退出图片浏览器\n@property (nonatomic, copy, nullable) YBIBImageSingleTouchBlock singleTouchBlock;\n\n/// 图片滚动的回调\n@property (nonatomic, copy, nullable) YBIBImageScrollViewStatusBlock imageDidScrollBlock;\n\n/// 图片缩放的回调\n@property (nonatomic, copy, nullable) YBIBImageScrollViewStatusBlock imageDidZoomBlock;\n\n/// 图片布局类 (赋值可自定义)\n@property (nonatomic, strong) id<YBIBImageLayout> layout;\n/// 默认图片布局类 (可配置其属性)\n@property (nonatomic, weak, readonly) YBIBImageLayout *defaultLayout;\n\n/**\n 终止处理数据程序\n */\n- (void)stopLoading;\n\n/**\n 清除缓存的数据\n */\n- (void)clearCache;\n\n/**\n 加载数据，一般不需要调用这个方法，当该数据对象做了数据更新时调用\n */\n- (void)loadData;\n\n/// 处理后的原始图片\n@property (nonatomic, strong, readonly) UIImage *originImage;\n\n/// 处理后的压缩图片\n@property (nonatomic, strong, readonly) UIImage *compressedImage;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageData.m",
    "content": "//\n//  YBIBImageData.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBImage.h\"\n#import \"YBIBImageData.h\"\n#import \"YBIBImageCell.h\"\n#import \"YBIBPhotoAlbumManager.h\"\n#import \"YBIBImageData+Internal.h\"\n#import \"YBIBUtilities.h\"\n#import \"YBIBImageCache+Internal.h\"\n#import \"YBIBSentinel.h\"\n#import \"YBIBCopywriter.h\"\n#import <AssetsLibrary/AssetsLibrary.h>\n\nextern CGImageRef YYCGImageCreateDecodedCopy(CGImageRef imageRef, BOOL decodeForDisplay);\n\nstatic dispatch_queue_t YBIBImageProcessingQueue(void) {\n    static dispatch_queue_t queue;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        queue = dispatch_queue_create(\"com.yangbo.imagebrowser.imageprocessing\", DISPATCH_QUEUE_CONCURRENT);\n    });\n    return queue;\n}\n\n@implementation YBIBImageData {\n    __weak id _downloadToken;\n    YBIBSentinel *_cuttingSentinel;\n    /// Stop processing tasks when in freeze.\n    BOOL _freezing;\n}\n\n#pragma mark - life cycle\n\n- (void)dealloc {\n    if (_downloadToken && [self.yb_webImageMediator() respondsToSelector:@selector(yb_cancelTaskWithDownloadToken:)]) {\n        [self.yb_webImageMediator() yb_cancelTaskWithDownloadToken:_downloadToken];\n    }\n    [self.imageCache removeForKey:self.cacheKey];\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        [self initValue];\n    }\n    return self;\n}\n\n- (void)initValue {\n    _defaultLayout = _layout = [YBIBImageLayout new];\n    _loadingStatus = YBIBImageLoadingStatusNone;\n    _compressingSize = 4096 * 4096;\n    _shouldPreDecodeAsync = YES;\n    _freezing = NO;\n    _cuttingSentinel = [YBIBSentinel new];\n    _interactionProfile = [YBIBInteractionProfile new];\n    _allowSaveToPhotoAlbum = YES;\n}\n\n#pragma mark - load data\n\n- (void)loadData {\n    _freezing = NO;\n    \n    // Avoid handling asynchronous tasks repeatedly.\n    if (self.loadingStatus != YBIBImageLoadingStatusNone) {\n        [self loadThumbImage];\n        self.loadingStatus = self.loadingStatus;\n        return;\n    }\n    \n    if (self.originImage) {\n        [self loadOriginImage];\n    } else if (self.imageName || self.imagePath || self.imageData) {\n        [self loadYBImage];\n    } else if (self.image) {\n        [self loadImageBlock];\n    } else if (self.imageURL) {\n        [self loadThumbImage];\n        [self loadURL];\n    } else if (self.imagePHAsset) {\n        [self loadThumbImage];\n        [self loadPHAsset];\n    } else {\n        [self.delegate yb_imageIsInvalidForData:self];\n    }\n}\n\n- (void)loadOriginImage {\n    if (_freezing) return;\n    if (!self.originImage) return;\n    \n    if ([self shouldCompress]) {\n        if (self.compressedImage) {\n            [self.delegate yb_imageData:self readyForCompressedImage:self.compressedImage];\n        } else {\n            [self loadThumbImage];\n            [self loadOriginImage_compress];\n        }\n    } else {\n        [self.delegate yb_imageData:self readyForImage:self.originImage];\n    }\n}\n- (void)loadOriginImage_compress {\n    if (_freezing) return;\n    if (!self.originImage) return;\n    \n    self.loadingStatus = YBIBImageLoadingStatusCompressing;\n    __weak typeof(self) wSelf = self;\n    CGSize size = [self bestSizeOfCompressing];\n\n    YBIB_DISPATCH_ASYNC(YBIBImageProcessingQueue(), ^{\n        if (self->_freezing) {\n            self.loadingStatus = YBIBImageLoadingStatusNone;\n            return;\n        }\n        // Ensure the best display effect.\n        UIGraphicsBeginImageContextWithOptions(size, NO, UIScreen.mainScreen.scale);\n        [self.originImage drawInRect:CGRectMake(0, 0, size.width, size.height)];\n        if (self->_freezing) {\n            UIGraphicsEndImageContext();\n            self.loadingStatus = YBIBImageLoadingStatusNone;\n            return;\n        }\n        UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        \n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            \n            self.loadingStatus = YBIBImageLoadingStatusNone;\n            \n            [self modifyImageWithModifier:self.compressedImageModifier image:resultImage completion:^(UIImage *processedImage) {\n                __strong typeof(wSelf) self = wSelf;\n                if (!self) return;\n                self.compressedImage = processedImage ?: self.originImage;\n                [self.delegate yb_imageData:self readyForCompressedImage:self.compressedImage];\n            }];\n        })\n    })\n}\n\n- (void)loadYBImage {\n    if (_freezing) return;\n    NSString *name = self.imageName.copy;\n    NSString *path = self.imagePath.copy;\n    NSData *data = self.imageData ? self.imageData().copy : nil;\n    if (name.length == 0 && path.length == 0 && data.length == 0) return;\n    \n    YBImageDecodeDecision decision = [self defaultDecodeDecision];\n    \n    __block YBImage *image;\n    __weak typeof(self) wSelf = self;\n    void(^dealBlock)(void) = ^{\n        if (name.length > 0) {\n            image = [YBImage imageNamed:name decodeDecision:decision];\n        } else if (path.length > 0) {\n            image = [YBImage imageWithContentsOfFile:path decodeDecision:decision];\n        } else if (data.length > 0) {\n            image = [YBImage imageWithData:data scale:UIScreen.mainScreen.scale decodeDecision:decision];\n        }\n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            self.loadingStatus = YBIBImageLoadingStatusNone;\n            if (image) {\n                [self setOriginImageAndLoadWithImage:image];\n            } else {\n                [self.delegate yb_imageIsInvalidForData:self];\n            }\n        })\n    };\n    \n    if (self.shouldPreDecodeAsync) {\n        [self loadThumbImage];\n        self.loadingStatus = YBIBImageLoadingStatusDecoding;\n        YBIB_DISPATCH_ASYNC(YBIBImageProcessingQueue(), dealBlock)\n    } else {\n        self.loadingStatus = YBIBImageLoadingStatusDecoding;\n        dealBlock();\n    }\n}\n\n- (void)loadImageBlock {\n    if (_freezing) return;\n    __block UIImage *image = self.image ? self.image() : nil;\n    if (!image) return;\n    \n    BOOL shouldPreDecode = self.preDecodeDecision ? self.preDecodeDecision(self, image.size, image.scale) : ![self shouldCompressWithImage:image];\n    \n    __weak typeof(self) wSelf = self;\n    void(^dealBlock)(void) = ^{\n        // Do not need to decode If 'image' conformed 'YYAnimatedImage'. (Not entirely accurate.)\n        if (![image conformsToProtocol:@protocol(YYAnimatedImage)]) {\n            CGImageRef cgImage = YYCGImageCreateDecodedCopy(image.CGImage, shouldPreDecode);\n            image = [UIImage imageWithCGImage:cgImage scale:image.scale orientation:image.imageOrientation];\n            if (cgImage) CGImageRelease(cgImage);\n        }\n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            self.loadingStatus = YBIBImageLoadingStatusNone;\n            [self setOriginImageAndLoadWithImage:image];\n        })\n    };\n    \n    if (self.shouldPreDecodeAsync) {\n        [self loadThumbImage];\n        self.loadingStatus = YBIBImageLoadingStatusDecoding;\n        YBIB_DISPATCH_ASYNC(YBIBImageProcessingQueue(), dealBlock)\n    } else {\n        self.loadingStatus = YBIBImageLoadingStatusDecoding;\n        dealBlock();\n    }\n}\n\n- (void)loadURL {\n    if (!self.imageURL || self.imageURL.absoluteString.length == 0) return;\n    [self loadURL_queryCache];\n}\n- (void)loadURL_queryCache {\n    if (_freezing) return;\n    if (!self.imageURL || self.imageURL.absoluteString.length == 0) return;\n    \n    YBImageDecodeDecision decision = [self defaultDecodeDecision];\n    \n    self.loadingStatus = YBIBImageLoadingStatusQuerying;\n    [self.yb_webImageMediator() yb_queryCacheOperationForKey:self.imageURL completed:^(UIImage * _Nullable image, NSData * _Nullable imageData) {\n        if (!imageData || imageData.length == 0) {\n            YBIB_DISPATCH_ASYNC_MAIN(^{\n                self.loadingStatus = YBIBImageLoadingStatusNone;\n                [self loadURL_download];\n            })\n            return;\n        }\n        \n        YBIB_DISPATCH_ASYNC(YBIBImageProcessingQueue(), ^{\n            if (self->_freezing) {\n                self.loadingStatus = YBIBImageLoadingStatusNone;\n                return;\n            }\n            YBImage *image = [YBImage imageWithData:imageData scale:UIScreen.mainScreen.scale decodeDecision:decision];\n            __weak typeof(self) wSelf = self;\n            YBIB_DISPATCH_ASYNC_MAIN(^{\n                __strong typeof(wSelf) self = wSelf;\n                if (!self) return;\n                self.loadingStatus = YBIBImageLoadingStatusNone;\n                if (image) {    // Maybe the image data is invalid.\n                    [self setOriginImageAndLoadWithImage:image];\n                } else {\n                    [self loadURL_download];\n                }\n            })\n        })\n    }];\n}\n- (void)loadURL_download {\n    if (_freezing) return;\n    if (!self.imageURL || self.imageURL.absoluteString.length == 0) return;\n    \n    YBImageDecodeDecision decision = [self defaultDecodeDecision];\n    \n    self.loadingStatus = YBIBImageLoadingStatusDownloading;\n    __weak typeof(self) wSelf = self;\n    _downloadToken = [self.yb_webImageMediator() yb_downloadImageWithURL:self.imageURL requestModifier:^NSURLRequest * _Nullable(NSURLRequest * _Nonnull request) {\n        return self.requestModifier ? self.requestModifier(self, request) : request;\n    } progress:^(NSInteger receivedSize, NSInteger expectedSize) {\n        CGFloat progress = receivedSize * 1.0 / expectedSize ?: 0;\n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            [self.delegate yb_imageData:self downloadProgress:progress];\n        })\n    } success:^(NSData * _Nullable imageData, BOOL finished) {\n        if (!finished) return;\n        \n        YBIB_DISPATCH_ASYNC(YBIBImageProcessingQueue(), ^{\n            if (self->_freezing) {\n                self.loadingStatus = YBIBImageLoadingStatusNone;\n                return;\n            }\n            YBImage *image = [YBImage imageWithData:imageData scale:UIScreen.mainScreen.scale decodeDecision:decision];\n            YBIB_DISPATCH_ASYNC_MAIN(^{\n                __strong typeof(wSelf) self = wSelf;\n                if (!self) return;\n                [self.yb_webImageMediator() yb_storeToDiskWithImageData:imageData forKey:self.imageURL];\n                self.loadingStatus = YBIBImageLoadingStatusNone;\n                if (image) {\n                    [self setOriginImageAndLoadWithImage:image];\n                } else {\n                    [self.delegate yb_imageIsInvalidForData:self];\n                }\n            })\n        })\n    } failed:^(NSError * _Nullable error, BOOL finished) {\n        if (!finished) return;\n        __strong typeof(wSelf) self = wSelf;\n        if (!self) return;\n        self.loadingStatus = YBIBImageLoadingStatusNone;\n        [self.delegate yb_imageDownloadFailedForData:self];\n    }];\n}\n\n- (void)loadPHAsset {\n    if (_freezing) return;\n    if (!self.imagePHAsset) return;\n    \n    YBImageDecodeDecision decision = [self defaultDecodeDecision];\n    \n    self.loadingStatus = YBIBImageLoadingStatusReadingPHAsset;\n    YBIB_DISPATCH_ASYNC(YBIBImageProcessingQueue(), ^{\n        [YBIBPhotoAlbumManager getImageDataWithPHAsset:self.imagePHAsset completion:^(NSData * _Nullable data) {\n            if (self->_freezing) {\n                self.loadingStatus = YBIBImageLoadingStatusNone;\n                return;\n            }\n            YBImage *image = [YBImage imageWithData:data scale:UIScreen.mainScreen.scale decodeDecision:decision];\n            __weak typeof(self) wSelf = self;\n            YBIB_DISPATCH_ASYNC_MAIN(^{\n                __strong typeof(wSelf) self = wSelf;\n                if (!self) return;\n                \n                self.loadingStatus = YBIBImageLoadingStatusNone;\n                if (image) {\n                    [self setOriginImageAndLoadWithImage:image];\n                } else {\n                    [self.delegate yb_imageIsInvalidForData:self];\n                }\n            })\n        }];\n    })\n}\n\n- (void)loadThumbImage {\n    if (_freezing) return;\n    if (self.thumbImage) {\n        [self.delegate yb_imageData:self readyForThumbImage:self.thumbImage];\n    } else if (self.thumbURL) {\n        __weak typeof(self) wSelf = self;\n        [self.yb_webImageMediator() yb_queryCacheOperationForKey:self.thumbURL completed:^(UIImage * _Nullable image, NSData * _Nullable imageData) {\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            \n            UIImage *thumbImage;\n            if (image) {\n                thumbImage = image;\n            } else if (imageData) {\n                thumbImage = [UIImage imageWithData:imageData];\n            }\n            // If the target image is ready, ignore the thumb image.\n            BOOL shouldIgnore = [self shouldCompress] ? (self.compressedImage != nil) : (self.originImage != nil);\n            if (!shouldIgnore && thumbImage) {\n                [self.delegate yb_imageData:self readyForThumbImage:thumbImage];\n            }\n        }];\n    } else if (self.projectiveView && [self.projectiveView isKindOfClass:UIImageView.self] && ((UIImageView *)self.projectiveView).image) {\n        UIImage *thumbImage = ((UIImageView *)self.projectiveView).image;\n        [self.delegate yb_imageData:self readyForThumbImage:thumbImage];\n    }\n}\n\n#pragma mark - internal\n\n- (void)cuttingImageToRect:(CGRect)rect complete:(void (^)(UIImage * _Nullable))complete {\n    if (_freezing) return;\n    if (!self.originImage) return;\n    \n    int32_t value = [_cuttingSentinel increase];\n    BOOL (^isCancelled)(void) = ^BOOL(void) {\n        if (self->_freezing) return YES;\n        return value != self->_cuttingSentinel.value;\n    };\n    \n    YBIB_DISPATCH_ASYNC(YBIBImageProcessingQueue(), ^{\n        if (isCancelled()) {\n            complete(nil);\n            return;\n        }\n        CGFloat scale = self.originImage.scale;\n        CGFloat width = self.originImage.size.width;\n        CGFloat height = self.originImage.size.height;\n        \n        BOOL reverseWidthHeight = NO;\n        CGAffineTransform transform = CGAffineTransformIdentity;\n        switch (self.originImage.imageOrientation) {\n            case UIImageOrientationDown:\n            case UIImageOrientationDownMirrored:\n                CGAffineTransformTranslate(CGAffineTransformMakeRotation(-M_PI), -width, -height);\n                break;\n            case UIImageOrientationLeft:\n            case UIImageOrientationLeftMirrored:\n                transform = CGAffineTransformTranslate(CGAffineTransformMakeRotation(M_PI_2), 0, -height);\n                reverseWidthHeight = YES;\n                break;\n            case UIImageOrientationRight:\n            case UIImageOrientationRightMirrored:\n                transform = CGAffineTransformTranslate(CGAffineTransformMakeRotation(-M_PI_2), -width, 0);\n                reverseWidthHeight = YES;\n                break;\n            default: break;\n        }\n        transform = CGAffineTransformScale(transform, scale, scale);\n        CGRect correctRect = CGRectApplyAffineTransform(rect, transform);\n        CGImageRef cgImage = CGImageCreateWithImageInRect(self.originImage.CGImage, correctRect);\n        \n        if (isCancelled()) {\n            complete(nil);\n            if (cgImage) CGImageRelease(cgImage);\n            return;\n        }\n        CGFloat cgWidth = reverseWidthHeight ? CGImageGetHeight(cgImage) : CGImageGetWidth(cgImage);\n        CGFloat cgHeight = reverseWidthHeight ? CGImageGetWidth(cgImage) : CGImageGetHeight(cgImage);\n        CGSize size = [self bestSizeOfCuttingWithOriginSize:CGSizeMake(cgWidth / scale, cgHeight / scale)];\n        UIImage *tmpImage = [UIImage imageWithCGImage:cgImage scale:self.originImage.scale orientation:self.originImage.imageOrientation];\n        if (isCancelled()) {\n            complete(nil);\n            if (cgImage) CGImageRelease(cgImage);\n            return;\n        }\n        \n        // Ensure the best display effect.\n        UIGraphicsBeginImageContextWithOptions(size, NO, UIScreen.mainScreen.scale);\n        [tmpImage drawInRect:CGRectMake(0, 0, size.width, size.height)];\n        if (isCancelled()) {\n            complete(nil);\n            UIGraphicsEndImageContext();\n            if (cgImage) CGImageRelease(cgImage);\n            return;\n        }\n        UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        if (cgImage) CGImageRelease(cgImage);\n        \n        __weak typeof(self) wSelf = self;\n        YBIB_DISPATCH_ASYNC_MAIN(^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            \n            [self modifyImageWithModifier:self.cuttedImageModifier image:resultImage completion:^(UIImage *image) {\n                __strong typeof(wSelf) self = wSelf;\n                if (!self) return;\n                complete(image);\n            }];\n        })\n    })\n}\n\n- (BOOL)shouldCompress {\n    return [self shouldCompressWithImage:self.originImage];\n}\n\n#pragma mark - public\n\n- (BOOL)shouldCompressWithImage:(UIImage *)image {\n    if (!image) return NO;\n    return [self shouldCompressWithImageSize:image.size scale:image.scale];\n}\n\n- (void)stopLoading {\n    _freezing = YES;\n    self.loadingStatus = YBIBImageLoadingStatusNone;\n}\n\n- (void)clearCache {\n    [self.imageCache removeForKey:self.cacheKey];\n}\n\n#pragma mark - private\n\n/// 'size': logic pixel.\n- (BOOL)shouldCompressWithImageSize:(CGSize)size scale:(CGFloat)scale {\n    return size.width * scale * size.height * scale > self.compressingSize;\n}\n\n/// Logic pixel.\n- (CGSize)bestSizeOfCompressing {\n    if (!self.originImage) return CGSizeZero;\n    UIDeviceOrientation orientation = self.yb_currentOrientation();\n    CGRect imageViewFrame = [self.layout yb_imageViewFrameWithContainerSize:self.yb_containerSize(orientation) imageSize:self.originImage.size orientation:orientation];\n    return imageViewFrame.size;\n}\n\n/// Logic pixel.\n- (CGSize)bestSizeOfCuttingWithOriginSize:(CGSize)originSize {\n    CGSize containerSize = self.yb_containerSize(self.yb_currentOrientation());\n    CGFloat maxWidth = containerSize.width, maxHeight = containerSize.height;\n    CGFloat oWidth = originSize.width, oHeight = originSize.height;\n    if (maxWidth <= 0 || maxHeight <= 0 || oWidth <= 0 || oHeight <= 0) return CGSizeZero;\n    \n    if (oWidth <= maxWidth && oHeight <= maxHeight) {\n        return originSize;\n    }\n    CGFloat rWidth = 0, rHeight = 0;\n    if (oWidth / maxWidth < oHeight / maxHeight) {\n        rHeight = maxHeight;\n        rWidth = oWidth / oHeight * rHeight;\n    } else {\n        rWidth = maxWidth;\n        rHeight = oHeight / oWidth * rWidth;\n    }\n    return CGSizeMake(rWidth, rHeight);\n}\n\n- (YBImageDecodeDecision)defaultDecodeDecision {\n    __weak typeof(self) wSelf = self;\n    return ^BOOL(CGSize imageSize, CGFloat scale) {\n        __strong typeof(wSelf) self = wSelf;\n        if (!self) return NO;\n        CGSize logicSize = CGSizeMake(imageSize.width / scale, imageSize.height / scale);\n        if (self.preDecodeDecision) return self.preDecodeDecision(self, logicSize, scale);\n        if ([self shouldCompressWithImageSize:logicSize scale:scale]) return NO;\n        return YES;\n    };\n}\n\n- (void)modifyImageWithModifier:(YBIBImageModifierBlock)modifier image:(UIImage *)image completion:(void(^)(UIImage *processedImage))completion {\n    if (modifier) {\n        self.loadingStatus = YBIBImageLoadingStatusProcessing;\n        __weak typeof(self) wSelf = self;\n        modifier(self, image, ^(UIImage *processedImage){\n            // This step is necessary, maybe 'self' is already 'dealloc' if processing code takes too much time.\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            self.loadingStatus = YBIBImageLoadingStatusNone;\n            completion(processedImage);\n        });\n    } else {\n        completion(image);\n    }\n}\n\n- (void)setOriginImageAndLoadWithImage:(UIImage *)image {\n    __weak typeof(self) wSelf = self;\n    [self modifyImageWithModifier:self.originImageModifier image:image completion:^(UIImage *processedImage) {\n        __strong typeof(wSelf) self = wSelf;\n        if (!self) return;\n        self.originImage = processedImage;\n        [self loadOriginImage];\n    }];\n}\n\n- (void)saveToPhotoAlbumCompleteWithError:(nullable NSError *)error {\n    if (error) {\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].saveToPhotoAlbumFailed];\n    } else {\n        [self.yb_auxiliaryViewHandler() yb_showCorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].saveToPhotoAlbumSuccess];\n    }\n}\n\n- (void)UIImageWriteToSavedPhotosAlbum_completedWithImage:(UIImage *)image error:(NSError *)error context:(void *)context {\n    [self saveToPhotoAlbumCompleteWithError:error];\n}\n\n- (YBIBImageCache *)imageCache {\n    return self.yb_backView.ybib_imageCache;\n}\n\n#pragma mark - <YBIBDataProtocol>\n\n@synthesize yb_isHideTransitioning = _yb_isHideTransitioning;\n@synthesize yb_currentOrientation = _yb_currentOrientation;\n@synthesize yb_containerSize = _yb_containerSize;\n@synthesize yb_containerView = _yb_containerView;\n@synthesize yb_auxiliaryViewHandler = _yb_auxiliaryViewHandler;\n@synthesize yb_webImageMediator = _yb_webImageMediator;\n@synthesize yb_backView = _yb_backView;\n\n- (nonnull Class)yb_classOfCell {\n    return YBIBImageCell.self;\n}\n\n- (UIView *)yb_projectiveView {\n    return self.projectiveView;\n}\n\n- (CGRect)yb_imageViewFrameWithContainerSize:(CGSize)containerSize imageSize:(CGSize)imageSize orientation:(UIDeviceOrientation)orientation {\n    return [self.layout yb_imageViewFrameWithContainerSize:containerSize imageSize:imageSize orientation:orientation];\n}\n\n- (void)yb_preload {\n    if (!self.delegate) {\n        [self loadData];\n    }\n}\n\n- (BOOL)yb_allowSaveToPhotoAlbum {\n    return self.allowSaveToPhotoAlbum;\n}\n\n- (void)yb_saveToPhotoAlbum {\n    void(^saveData)(NSData *) = ^(NSData * _Nonnull data){\n        [[ALAssetsLibrary new] writeImageDataToSavedPhotosAlbum:data metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) {\n            [self saveToPhotoAlbumCompleteWithError:error];\n        }];\n    };\n    void(^saveImage)(UIImage *) = ^(UIImage * _Nonnull image){\n        UIImageWriteToSavedPhotosAlbum(image, self, @selector(UIImageWriteToSavedPhotosAlbum_completedWithImage:error:context:), NULL);\n    };\n    void(^unableToSave)(void) = ^(){\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].unableToSave];\n    };\n    \n    [YBIBPhotoAlbumManager getPhotoAlbumAuthorizationSuccess:^{\n        if ([self.originImage conformsToProtocol:@protocol(YYAnimatedImage)] && [self.originImage respondsToSelector:@selector(animatedImageData)] && [self.originImage performSelector:@selector(animatedImageData)]) {\n            NSData *data = [self.originImage performSelector:@selector(animatedImageData)];\n            data ? saveData(data) : unableToSave();\n        } else if (self.originImage) {\n            saveImage(self.originImage);\n        } else if (self.imageURL) {\n            [self.yb_webImageMediator() yb_queryCacheOperationForKey:self.imageURL completed:^(UIImage * _Nullable image, NSData * _Nullable data) {\n                if (data) {\n                    saveData(data);\n                } else if (image) {\n                    saveImage(image);\n                } else {\n                    unableToSave();\n                }\n            }];\n        } else {\n            unableToSave();\n        }\n    } failed:^{\n        [self.yb_auxiliaryViewHandler() yb_showIncorrectToastWithContainer:self.yb_containerView text:[YBIBCopywriter sharedCopywriter].getPhotoAlbumAuthorizationFailed];\n    }];\n}\n\n#pragma mark - getters & setters\n\n@synthesize delegate = _delegate;\n- (void)setDelegate:(id<YBIBImageDataDelegate>)delegate {\n    _delegate = delegate;\n    if (delegate) {\n        [self loadData];\n    } else {\n        _freezing = YES;\n        // Remove the resident cache if '_delegate' is nil.\n        [self.imageCache removeResidentForKey:self.cacheKey];\n    }\n}\n- (id<YBIBImageDataDelegate>)delegate {\n    // Stop sending data to the '_delegate' if it is transiting.\n    return self.yb_isHideTransitioning() ? nil : _delegate;\n}\n\n- (void)setImageURL:(NSURL *)imageURL {\n    _imageURL = [imageURL isKindOfClass:NSString.class] ? [NSURL URLWithString:(NSString *)imageURL] : imageURL;\n}\n\n- (NSString *)cacheKey {\n    return [NSString stringWithFormat:@\"%p\", self];\n}\n\n- (void)setOriginImage:(__kindof UIImage *)originImage {\n    // 'image' should be resident if '_delegate' exists.\n    [self.imageCache setImage:originImage type:YBIBImageCacheTypeOrigin forKey:self.cacheKey resident:self->_delegate != nil];\n}\n- (UIImage *)originImage {\n    return [self.imageCache imageForKey:self.cacheKey type:YBIBImageCacheTypeOrigin];\n}\n\n- (void)setCompressedImage:(UIImage *)compressedImage {\n    // 'image' should be resident if '_delegate' exists.\n    [self.imageCache setImage:compressedImage type:YBIBImageCacheTypeCompressed forKey:self.cacheKey resident:_delegate != nil];\n}\n- (UIImage *)compressedImage {\n    return [self.imageCache imageForKey:self.cacheKey type:YBIBImageCacheTypeCompressed];\n}\n\n- (void)setLoadingStatus:(YBIBImageLoadingStatus)loadingStatus {\n    // Ensure thread safety.\n    YBIB_DISPATCH_ASYNC_MAIN(^{\n        self->_loadingStatus = loadingStatus;\n        [self.delegate yb_imageData:self startLoadingWithStatus:loadingStatus];\n    });\n}\n\n- (CGFloat)cuttingZoomScale {\n    if (_cuttingZoomScale >= 1) return _cuttingZoomScale;\n    _cuttingZoomScale = 1.1;\n    if (!self.originImage) return _cuttingZoomScale;\n    CGFloat imagePixel = self.originImage.size.width * self.originImage.size.height * self.originImage.scale * self.originImage.scale;\n    // The larger the image size, the larger the '_cuttingZoomScale', in order to reduce the burden of CPU and memory.\n    CGFloat scale = YBIBLowMemory() ? 0.28 : 0.19;\n    _cuttingZoomScale += (imagePixel / self.compressingSize * scale);\n    return _cuttingZoomScale;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageLayout.h",
    "content": "//\n//  YBIBImageLayout.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/12.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBImageLayout <NSObject>\n@required\n\n/**\n 计算图片展示的位置\n\n @param containerSize 容器大小\n @param imageSize 图片大小 (逻辑像素)\n @param orientation 图片浏览器的方向\n @return 图片展示的位置 (frame)\n */\n- (CGRect)yb_imageViewFrameWithContainerSize:(CGSize)containerSize imageSize:(CGSize)imageSize orientation:(UIDeviceOrientation)orientation;\n\n/**\n 计算最大缩放比例\n\n @param containerSize 容器大小\n @param imageSize 图片大小 (逻辑像素)\n @param orientation 图片浏览器的方向\n @return 最大缩放比例\n */\n- (CGFloat)yb_maximumZoomScaleWithContainerSize:(CGSize)containerSize imageSize:(CGSize)imageSize orientation:(UIDeviceOrientation)orientation;\n\n@end\n\ntypedef NS_ENUM(NSUInteger, YBIBImageFillType) {\n    /// 宽度优先填充满\n    YBIBImageFillTypeFullWidth,\n    /// 完整显示\n    YBIBImageFillTypeCompletely\n};\n\n@interface YBIBImageLayout : NSObject <YBIBImageLayout>\n\n/// 纵向的填充方式，默认 YBIBImageFillTypeCompletely\n@property (nonatomic, assign) YBIBImageFillType verticalFillType;\n\n/// 横向的填充方式，默认 YBIBImageFillTypeFullWidth\n@property (nonatomic, assign) YBIBImageFillType horizontalFillType;\n\n/// 最大缩放比例 (必须大于 1 才有效，若不指定内部会自动计算)\n@property (nonatomic, assign) CGFloat maxZoomScale;\n\n/// 自动计算严格缩放比例后，再乘以这个值作为最终缩放比例，默认 1.5\n@property (nonatomic, assign) CGFloat zoomScaleSurplus;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageLayout.m",
    "content": "//\n//  YBIBImageLayout.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/12.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBImageLayout.h\"\n\n@implementation YBIBImageLayout\n\n#pragma mark - life cycle\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _verticalFillType = YBIBImageFillTypeCompletely;\n        _horizontalFillType = YBIBImageFillTypeFullWidth;\n        _zoomScaleSurplus = 1.5;\n    }\n    return self;\n}\n\n#pragma mark - private\n\n- (YBIBImageFillType)fillTypeByOrientation:(UIDeviceOrientation)orientation {\n    return UIDeviceOrientationIsLandscape(orientation) ? self.horizontalFillType : self.verticalFillType;\n}\n\n#pragma mark - <YBIBImageLayout>\n\n- (CGRect)yb_imageViewFrameWithContainerSize:(CGSize)containerSize imageSize:(CGSize)imageSize orientation:(UIDeviceOrientation)orientation {\n    if (containerSize.width <= 0 || containerSize.height <= 0 || imageSize.width <= 0 || imageSize.height <= 0) return CGRectZero;\n    \n    CGFloat x = 0, y = 0, width = 0, height = 0;\n    switch ([self fillTypeByOrientation:orientation]) {\n        case YBIBImageFillTypeFullWidth: {\n            x = 0;\n            width = containerSize.width;\n            height = containerSize.width * (imageSize.height / imageSize.width);\n            if (imageSize.width / imageSize.height >= containerSize.width / containerSize.height)\n                y = (containerSize.height - height) / 2.0;\n            else\n                y = 0;\n        }\n            break;\n        case YBIBImageFillTypeCompletely: {\n            if (imageSize.width / imageSize.height >= containerSize.width / containerSize.height) {\n                width = containerSize.width;\n                height = containerSize.width * (imageSize.height / imageSize.width);\n                x = 0;\n                y = (containerSize.height - height) / 2.0;\n            } else {\n                height = containerSize.height;\n                width = containerSize.height * (imageSize.width / imageSize.height);\n                x = (containerSize.width - width) / 2.0;\n                y = 0;\n            }\n        }\n            break;\n        default: return CGRectZero;\n    }\n    return CGRectMake(x, y, width, height);\n}\n\n- (CGFloat)yb_maximumZoomScaleWithContainerSize:(CGSize)containerSize imageSize:(CGSize)imageSize orientation:(UIDeviceOrientation)orientation {\n    if (self.maxZoomScale >= 1) return self.maxZoomScale;\n    \n    if (containerSize.width <= 0 || containerSize.height <= 0) return 0;\n    \n    CGFloat scale = [UIScreen mainScreen].scale;\n    if (scale <= 0) return 0;\n    \n    CGFloat widthScale = imageSize.width / scale / containerSize.width,\n    heightScale = imageSize.height / scale / containerSize.height,\n    maxScale = 1;\n    switch ([self fillTypeByOrientation:orientation]) {\n        case YBIBImageFillTypeFullWidth:\n            maxScale = widthScale;\n            break;\n        case YBIBImageFillTypeCompletely:\n            maxScale = MAX(widthScale, heightScale);\n            break;\n        default: return 0;\n    }\n    return MAX(maxScale, 1) * self.zoomScaleSurplus;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageScrollView.h",
    "content": "//\n//  YBIBImageScrollView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/10.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBImage.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef NS_ENUM(NSInteger, YBIBScrollImageType) {\n    YBIBScrollImageTypeNone,\n    YBIBScrollImageTypeOriginal,\n    YBIBScrollImageTypeCompressed,\n    YBIBScrollImageTypeThumb\n};\n\n@interface YBIBImageScrollView : UIScrollView\n\n- (void)setImage:(__kindof UIImage *)image type:(YBIBScrollImageType)type;\n\n@property (nonatomic, strong, readonly) YYAnimatedImageView *imageView;\n\n@property (nonatomic, assign) YBIBScrollImageType imageType;\n\n- (void)reset;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBImageScrollView.m",
    "content": "//\n//  YBIBImageScrollView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/10.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBImageScrollView.h\"\n\n@interface YBIBImageScrollView ()\n@property (nonatomic, strong) YYAnimatedImageView *imageView;\n@end\n\n@implementation YBIBImageScrollView\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        self.showsHorizontalScrollIndicator = NO;\n        self.showsVerticalScrollIndicator = NO;\n        self.decelerationRate = UIScrollViewDecelerationRateFast;\n        self.maximumZoomScale = 1;\n        self.minimumZoomScale = 1;\n        self.alwaysBounceHorizontal = NO;\n        self.alwaysBounceVertical = NO;\n        self.layer.masksToBounds = NO;\n        if (@available(iOS 11.0, *)) {\n            self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;\n        }\n\n        [self addSubview:self.imageView];\n    }\n    return self;\n}\n\n#pragma mark - public\n\n- (void)setImage:(__kindof UIImage *)image type:(YBIBScrollImageType)type {\n    self.imageView.image = image;\n    self.imageType = type;\n}\n\n- (void)reset {\n    self.zoomScale = 1;\n    self.imageView.image = nil;\n    self.imageView.frame = CGRectZero;\n    self.imageType = YBIBScrollImageTypeNone;\n}\n\n#pragma mark - getters\n\n- (YYAnimatedImageView *)imageView {\n    if (!_imageView) {\n        _imageView = [YYAnimatedImageView new];\n        _imageView.contentMode = UIViewContentModeScaleAspectFill;\n        _imageView.layer.masksToBounds = YES;\n    }\n    return _imageView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBInteractionProfile.h",
    "content": "//\n//  YBIBInteractionProfile.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/30.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBInteractionProfile : NSObject\n\n/// 是否取消手势交互动效\n@property (nonatomic, assign) BOOL disable;\n\n/// 拖动的距离与最大高度的比例，达到这个比例就会出场\n@property (nonatomic, assign) CGFloat dismissScale;\n\n/// 拖动的速度，达到这个值就会出场\n@property (nonatomic, assign) CGFloat dismissVelocityY;\n\n/// 拖动动效复位时的时长\n@property (nonatomic, assign) CGFloat restoreDuration;\n\n/// 拖动触发手势交互动效的起始距离\n@property (nonatomic, assign) CGFloat triggerDistance;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBIBInteractionProfile.m",
    "content": "//\n//  YBIBInteractionProfile.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/30.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBInteractionProfile.h\"\n\n@implementation YBIBInteractionProfile\n\n- (instancetype)init {\n    self = [super init];\n    if (self) {\n        _disable = NO;\n        _dismissScale = 0.22;\n        _dismissVelocityY = 800;\n        _restoreDuration = 0.15;\n        _triggerDistance = 3;\n    }\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBImage.h",
    "content": "//\n//  YBImage.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/8/31.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#if __has_include(<YYImage/YYImage.h>)\n#import <YYImage/YYFrameImage.h>\n#import <YYImage/YYSpriteSheetImage.h>\n#import <YYImage/YYImageCoder.h>\n#import <YYImage/YYAnimatedImageView.h>\n#elif __has_include(<YYWebImage/YYImage.h>)\n#import <YYWebImage/YYFrameImage.h>\n#import <YYWebImage/YYSpriteSheetImage.h>\n#import <YYWebImage/YYImageCoder.h>\n#import <YYWebImage/YYAnimatedImageView.h>\n#else\n#import \"YYFrameImage.h\"\n#import \"YYSpriteSheetImage.h\"\n#import \"YYImageCoder.h\"\n#import \"YYAnimatedImageView.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/// 🙄波儿菜：Decide whether should to decode by image size. ('imageSize': physical pixel)\ntypedef BOOL(^YBImageDecodeDecision)(CGSize imageSize, CGFloat scale);\n\n/**\n It is a fully compatible `UIImage` subclass. It extends the UIImage\n to support animated WebP, APNG and GIF format image data decoding. It also\n support NSCoding protocol to archive and unarchive multi-frame image data.\n \n If the image is created from multi-frame image data, and you want to play the\n animation, try replace UIImageView with `YYAnimatedImageView`.\n \n 🙄波儿菜：Copied from 'YYImage' and made some extensions.\n */\n\n@interface YBImage : UIImage <YYAnimatedImage>\n\n+ (nullable __kindof UIImage *)imageNamed:(NSString *)name; // no cache!\n+ (nullable YBImage *)imageWithContentsOfFile:(NSString *)path;\n+ (nullable YBImage *)imageWithData:(NSData *)data;\n+ (nullable YBImage *)imageWithData:(NSData *)data scale:(CGFloat)scale;\n\n/// 🙄波儿菜：Expand methodes.\n/// Start ->\n+ (nullable __kindof UIImage *)imageNamed:(NSString *)name decodeDecision:(nullable YBImageDecodeDecision)decodeDecision;\n+ (nullable YBImage *)imageWithContentsOfFile:(NSString *)path decodeDecision:(nullable YBImageDecodeDecision)decodeDecision;\n+ (nullable YBImage *)imageWithData:(NSData *)data decodeDecision:(nullable YBImageDecodeDecision)decodeDecision;\n+ (nullable YBImage *)imageWithData:(NSData *)data scale:(CGFloat)scale decodeDecision:(nullable YBImageDecodeDecision)decodeDecision;\n/// <- End\n\n/**\n If the image is created from data or file, then the value indicates the data type.\n */\n@property (nonatomic, readonly) YYImageType animatedImageType;\n\n/**\n If the image is created from animated image data (multi-frame GIF/APNG/WebP),\n this property stores the original image data.\n */\n@property (nullable, nonatomic, readonly) NSData *animatedImageData;\n\n/**\n The total memory usage (in bytes) if all frame images was loaded into memory.\n The value is 0 if the image is not created from a multi-frame image data.\n */\n@property (nonatomic, readonly) NSUInteger animatedImageMemorySize;\n\n/**\n Preload all frame image to memory.\n \n @discussion Set this property to `YES` will block the calling thread to decode\n all animation frame image to memory, set to `NO` will release the preloaded frames.\n If the image is shared by lots of image views (such as emoticon), preload all\n frames will reduce the CPU cost.\n \n See `animatedImageMemorySize` for memory cost.\n */\n@property (nonatomic) BOOL preloadAllAnimatedImageFrames;\n\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Image/YBImage.m",
    "content": "//\n//  YBImage.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/8/31.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBImage.h\"\n#import \"YBIBImageData.h\"\n#import \"YBIBUtilities.h\"\n\n/**\n An array of NSNumber objects, shows the best order for path scale search.\n e.g. iPhone3GS:@[@1,@2,@3] iPhone5:@[@2,@3,@1]  iPhone6 Plus:@[@3,@2,@1]\n */\nstatic NSArray *_NSBundlePreferredScales() {\n    static NSArray *scales;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        CGFloat screenScale = [UIScreen mainScreen].scale;\n        if (screenScale <= 1) {\n            scales = @[@1,@2,@3];\n        } else if (screenScale <= 2) {\n            scales = @[@2,@3,@1];\n        } else {\n            scales = @[@3,@2,@1];\n        }\n    });\n    return scales;\n}\n\n/**\n Add scale modifier to the file name (without path extension),\n From @\"name\" to @\"name@2x\".\n \n e.g.\n <table>\n <tr><th>Before     </th><th>After(scale:2)</th></tr>\n <tr><td>\"icon\"     </td><td>\"icon@2x\"     </td></tr>\n <tr><td>\"icon \"    </td><td>\"icon @2x\"    </td></tr>\n <tr><td>\"icon.top\" </td><td>\"icon.top@2x\" </td></tr>\n <tr><td>\"/p/name\"  </td><td>\"/p/name@2x\"  </td></tr>\n <tr><td>\"/path/\"   </td><td>\"/path/\"      </td></tr>\n </table>\n \n @param scale Resource scale.\n @return String by add scale modifier, or just return if it's not end with file name.\n */\nstatic NSString *_NSStringByAppendingNameScale(NSString *string, CGFloat scale) {\n    if (!string) return nil;\n    if (fabs(scale - 1) <= __FLT_EPSILON__ || string.length == 0 || [string hasSuffix:@\"/\"]) return string.copy;\n    return [string stringByAppendingFormat:@\"@%@x\", @(scale)];\n}\n\n/**\n Return the path scale.\n \n e.g.\n <table>\n <tr><th>Path            </th><th>Scale </th></tr>\n <tr><td>\"icon.png\"      </td><td>1     </td></tr>\n <tr><td>\"icon@2x.png\"   </td><td>2     </td></tr>\n <tr><td>\"icon@2.5x.png\" </td><td>2.5   </td></tr>\n <tr><td>\"icon@2x\"       </td><td>1     </td></tr>\n <tr><td>\"icon@2x..png\"  </td><td>1     </td></tr>\n <tr><td>\"icon@2x.png/\"  </td><td>1     </td></tr>\n </table>\n */\nstatic CGFloat _NSStringPathScale(NSString *string) {\n    if (string.length == 0 || [string hasSuffix:@\"/\"]) return 1;\n    NSString *name = string.stringByDeletingPathExtension;\n    __block CGFloat scale = 1;\n    \n    NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:@\"@[0-9]+\\\\.?[0-9]*x$\" options:NSRegularExpressionAnchorsMatchLines error:nil];\n    [pattern enumerateMatchesInString:name options:kNilOptions range:NSMakeRange(0, name.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        if (result.range.location >= 3) {\n            scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue;\n        }\n    }];\n    \n    return scale;\n}\n\n\n@implementation YBImage {\n    YYImageDecoder *_decoder;\n    NSArray *_preloadedFrames;\n    dispatch_semaphore_t _preloadedLock;\n    NSUInteger _bytesPerFrame;\n}\n\n+ (__kindof UIImage *)imageNamed:(NSString *)name {\n    return [self imageNamed:name decodeDecision:nil];\n}\n+ (__kindof UIImage *)imageNamed:(NSString *)name decodeDecision:(nullable YBImageDecodeDecision)decodeDecision {\n    if (name.length == 0) return nil;\n    if ([name hasSuffix:@\"/\"]) return nil;\n    \n    NSString *res = name.stringByDeletingPathExtension;\n    NSString *ext = name.pathExtension;\n    NSString *path = nil;\n    CGFloat scale = 1;\n    \n    // If no extension, guess by system supported (same as UIImage).\n    NSArray *exts = ext.length > 0 ? @[ext] : @[@\"\", @\"png\", @\"jpeg\", @\"jpg\", @\"gif\", @\"webp\", @\"apng\"];\n    NSArray *scales = _NSBundlePreferredScales();\n    for (int s = 0; s < scales.count; s++) {\n        scale = ((NSNumber *)scales[s]).floatValue;\n        NSString *scaledName = _NSStringByAppendingNameScale(res, scale);\n        for (NSString *e in exts) {\n            path = [[NSBundle mainBundle] pathForResource:scaledName ofType:e];\n            if (path) break;\n        }\n        if (path) break;\n    }\n    if (path.length == 0) {\n        // 🙄波儿菜：Assets.xcassets supported.\n        return [super imageNamed:name];\n    }\n    \n    NSData *data = [NSData dataWithContentsOfFile:path];\n    if (data.length == 0) return nil;\n    \n    return [[self alloc] initWithData:data scale:scale decodeDecision:decodeDecision];\n}\n\n+ (YBImage *)imageWithContentsOfFile:(NSString *)path {\n    return [self imageWithContentsOfFile:path decodeDecision:nil];\n}\n+ (YBImage *)imageWithContentsOfFile:(NSString *)path decodeDecision:(nullable YBImageDecodeDecision)decodeDecision {\n    return [[self alloc] initWithContentsOfFile:path decodeDecision:decodeDecision];\n}\n\n+ (YBImage *)imageWithData:(NSData *)data {\n    return [self imageWithData:data decodeDecision:nil];\n}\n+ (YBImage *)imageWithData:(NSData *)data decodeDecision:(nullable YBImageDecodeDecision)decodeDecision {\n    return [[self alloc] initWithData:data decodeDecision:decodeDecision];\n}\n\n+ (YBImage *)imageWithData:(NSData *)data scale:(CGFloat)scale {\n    return [self imageWithData:data scale:scale decodeDecision:nil];\n}\n+ (YBImage *)imageWithData:(NSData *)data scale:(CGFloat)scale decodeDecision:(nullable YBImageDecodeDecision)decodeDecision {\n    return [[self alloc] initWithData:data scale:scale decodeDecision:decodeDecision];\n}\n\n- (instancetype)initWithContentsOfFile:(NSString *)path {\n    return [self initWithContentsOfFile:path decodeDecision:nil];\n}\n- (instancetype)initWithContentsOfFile:(NSString *)path decodeDecision:(nullable YBImageDecodeDecision)decodeDecision {\n    NSData *data = [NSData dataWithContentsOfFile:path];\n    return [self initWithData:data scale:_NSStringPathScale(path) decodeDecision:decodeDecision];\n}\n\n- (instancetype)initWithData:(NSData *)data {\n    return [self initWithData:data decodeDecision:nil];\n}\n- (instancetype)initWithData:(NSData *)data decodeDecision:(nullable YBImageDecodeDecision)decodeDecision {\n    return [self initWithData:data scale:1 decodeDecision:decodeDecision];\n}\n\n- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale {\n    return [self initWithData:data scale:scale decodeDecision:nil];\n}\n- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale decodeDecision:(nullable YBImageDecodeDecision)decodeDecision {\n    if (data.length == 0) return nil;\n    if (scale <= 0) scale = [UIScreen mainScreen].scale;\n    _preloadedLock = dispatch_semaphore_create(1);\n    @autoreleasepool {\n        YYImageDecoder *decoder = [YYImageDecoder decoderWithData:data scale:scale];\n        \n        // 🙄波儿菜：Determine whether should to decode.\n        BOOL decodeForDisplay = YES;\n        if (decodeDecision) {\n            decodeForDisplay = decodeDecision(CGSizeMake(decoder.width, decoder.height), decoder.scale ?: 1);\n        }\n        \n        YYImageFrame *frame = [decoder frameAtIndex:0 decodeForDisplay:decodeForDisplay];\n        UIImage *image = frame.image;\n        if (!image) return nil;\n        self = [self initWithCGImage:image.CGImage scale:decoder.scale orientation:image.imageOrientation];\n        if (!self) return nil;\n        _animatedImageType = decoder.type;\n        if (decoder.frameCount > 1) {\n            _decoder = decoder;\n            _bytesPerFrame = CGImageGetBytesPerRow(image.CGImage) * CGImageGetHeight(image.CGImage);\n            _animatedImageMemorySize = _bytesPerFrame * decoder.frameCount;\n        }\n        self.yy_isDecodedForDisplay = YES;\n    }\n    return self;\n}\n\n- (NSData *)animatedImageData {\n    return _decoder.data;\n}\n\n- (void)setPreloadAllAnimatedImageFrames:(BOOL)preloadAllAnimatedImageFrames {\n    if (_preloadAllAnimatedImageFrames != preloadAllAnimatedImageFrames) {\n        if (preloadAllAnimatedImageFrames && _decoder.frameCount > 0) {\n            NSMutableArray *frames = [NSMutableArray new];\n            for (NSUInteger i = 0, max = _decoder.frameCount; i < max; i++) {\n                UIImage *img = [self animatedImageFrameAtIndex:i];\n                if (img) {\n                    [frames addObject:img];\n                } else {\n                    [frames addObject:[NSNull null]];\n                }\n            }\n            dispatch_semaphore_wait(_preloadedLock, DISPATCH_TIME_FOREVER);\n            _preloadedFrames = frames;\n            dispatch_semaphore_signal(_preloadedLock);\n        } else {\n            dispatch_semaphore_wait(_preloadedLock, DISPATCH_TIME_FOREVER);\n            _preloadedFrames = nil;\n            dispatch_semaphore_signal(_preloadedLock);\n        }\n    }\n}\n\n#pragma mark - protocol NSCoding\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    NSNumber *scale = [aDecoder decodeObjectForKey:@\"YYImageScale\"];\n    NSData *data = [aDecoder decodeObjectForKey:@\"YYImageData\"];\n    if (data.length) {\n        self = [self initWithData:data scale:scale.doubleValue];\n    } else {\n        self = [super initWithCoder:aDecoder];\n    }\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    if (_decoder.data.length) {\n        [aCoder encodeObject:@(self.scale) forKey:@\"YYImageScale\"];\n        [aCoder encodeObject:_decoder.data forKey:@\"YYImageData\"];\n    } else {\n        [super encodeWithCoder:aCoder]; // Apple use UIImagePNGRepresentation() to encode UIImage.\n    }\n}\n\n#pragma mark - protocol YYAnimatedImage\n\n- (NSUInteger)animatedImageFrameCount {\n    return _decoder.frameCount;\n}\n\n- (NSUInteger)animatedImageLoopCount {\n    return _decoder.loopCount;\n}\n\n- (NSUInteger)animatedImageBytesPerFrame {\n    return _bytesPerFrame;\n}\n\n- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {\n    if (index >= _decoder.frameCount) return nil;\n    dispatch_semaphore_wait(_preloadedLock, DISPATCH_TIME_FOREVER);\n    UIImage *image = _preloadedFrames[index];\n    dispatch_semaphore_signal(_preloadedLock);\n    if (image) return image == (id)[NSNull null] ? nil : image;\n    return [_decoder frameAtIndex:index decodeForDisplay:YES].image;\n}\n\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index {\n    NSTimeInterval duration = [_decoder frameDurationAtIndex:index];\n    \n    /*\n     http://opensource.apple.com/source/WebCore/WebCore-7600.1.25/platform/graphics/cg/ImageSourceCG.cpp\n     Many annoying ads specify a 0 duration to make an image flash as quickly as\n     possible. We follow Safari and Firefox's behavior and use a duration of 100 ms\n     for any frames that specify a duration of <= 10 ms.\n     See <rdar://problem/7689300> and <http://webkit.org/b/36082> for more information.\n     \n     See also: http://nullsleep.tumblr.com/post/16524517190/animated-gif-minimum-frame-delay-browser.\n     */\n    if (duration < 0.011f) return 0.100f;\n    return duration;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Protocol/YBIBCellProtocol.h",
    "content": "//\n//  YBIBCellProtocol.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBGetBaseInfoProtocol.h\"\n#import \"YBIBOrientationReceiveProtocol.h\"\n#import \"YBIBOperateBrowserProtocol.h\"\n\n@protocol YBIBDataProtocol;\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBCellProtocol <YBIBGetBaseInfoProtocol, YBIBOperateBrowserProtocol, YBIBOrientationReceiveProtocol>\n\n@required\n\n/// Cell 对应的 Data\n@property (nonatomic, strong) id<YBIBDataProtocol> yb_cellData;\n\n@optional\n\n/**\n 获取前景视图，出入场时需要用这个返回值做动效\n\n @return 前景视图\n */\n- (__kindof UIView *)yb_foregroundView;\n\n/**\n 页码变化了\n */\n- (void)yb_pageChanged;\n\n/// 当前 Cell 的页码\n@property (nonatomic, copy) NSInteger(^yb_selfPage)(void);\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Protocol/YBIBDataProtocol.h",
    "content": "//\n//  YBIBDataProtocol.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBGetBaseInfoProtocol.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBDataProtocol <YBIBGetBaseInfoProtocol>\n\n@required\n\n/**\n 当前 Data 对应 Cell 的类类型\n\n @return Class 类型\n */\n- (Class)yb_classOfCell;\n\n@optional\n\n/**\n 获取投影视图，当前数据模型对应外界业务的 UIView (通常为 UIImageView)，做转场动效用\n \n 这个方法会在做出入场动效时调用，若未实现时将无法进行平滑的入场\n\n @return 投影视图\n */\n- (__kindof UIView *)yb_projectiveView;\n\n/**\n 通过一系列数据，计算并返回图片视图在容器中的 frame\n \n 这个方法会在做入场动效时调用，若未实现时将无法进行平滑的入场\n\n @param containerSize 容器大小\n @param imageSize 图片大小 (逻辑像素)\n @param orientation 图片浏览器的方向\n @return 计算好的 frame\n */\n- (CGRect)yb_imageViewFrameWithContainerSize:(CGSize)containerSize imageSize:(CGSize)imageSize orientation:(UIDeviceOrientation)orientation;\n\n/**\n 预加载数据，有效的预加载能提高性能，请注意管理内存\n */\n- (void)yb_preload;\n\n/**\n 保存到相册\n */\n- (void)yb_saveToPhotoAlbum;\n\n/**\n 是否允许保存到相册\n */\n- (BOOL)yb_allowSaveToPhotoAlbum;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Protocol/YBIBGetBaseInfoProtocol.h",
    "content": "//\n//  YBIBGetBaseInfoProtocol.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/23.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n#import \"YBIBAuxiliaryViewHandler.h\"\n#import \"YBIBWebImageMediator.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBGetBaseInfoProtocol <NSObject>\n\n@optional\n\n/// 当前的方向\n@property (nonatomic, copy) UIDeviceOrientation(^yb_currentOrientation)(void);\n\n/// 根据方向获取容器大小\n@property (nonatomic, copy) CGSize(^yb_containerSize)(UIDeviceOrientation orientation);\n\n/// 容器视图 (可在上面添加子视图)\n@property (nonatomic, weak) UIView *yb_containerView;\n\n/// 辅助视图处理器\n@property (nonatomic, copy) id<YBIBAuxiliaryViewHandler>(^yb_auxiliaryViewHandler)(void);\n\n/// 图片下载缓存相关中介者\n@property (nonatomic, copy) id<YBIBWebImageMediator>(^yb_webImageMediator)(void);\n\n/// 当前页码\n@property (nonatomic, copy) NSInteger(^yb_currentPage)(void);\n\n/// 总页码数量\n@property (nonatomic, copy) NSInteger(^yb_totalPage)(void);\n\n/// 判断当前展示的 cell 是否恰好在屏幕中间\n@property (nonatomic, copy) BOOL(^yb_cellIsInCenter)(void);\n\n/// 是否正在转场\n@property (nonatomic, copy) BOOL(^yb_isTransitioning)(void);\n/// 是否正在展示过程转场\n@property (nonatomic, copy) BOOL(^yb_isShowTransitioning)(void);\n/// 是否正在隐藏过程转场\n@property (nonatomic, copy) BOOL(^yb_isHideTransitioning)(void);\n\n/// 是否正在旋转\n@property (nonatomic, copy) BOOL(^yb_isRotating)(void);\n\n/// 背景视图 (也就是 YBImageBrower 对象，不可在上面添加子视图。作用：一是可以更改透明度和颜色，入场和出场动效有用；二是可以用来比较内存指针，在做不同实例差异化功能时可能有用，虽然不提倡这么做)\n@property (nonatomic, weak) __kindof UIView *yb_backView;\n\n/// 集合视图\n@property (nonatomic, copy) __kindof UICollectionView *(^yb_collectionView)(void);\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Protocol/YBIBOperateBrowserProtocol.h",
    "content": "//\n//  YBIBOperateBrowserProtocol.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/8.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBOperateBrowserProtocol <NSObject>\n\n@optional\n\n/// 隐藏图片浏览器\n@property (nonatomic, copy) void(^yb_hideBrowser)(void);\n\n/// 是否隐藏状态栏\n@property (nonatomic, copy) void(^yb_hideStatusBar)(BOOL);\n\n/// 是否隐藏工具视图\n@property (nonatomic, copy) void(^yb_hideToolViews)(BOOL);\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Protocol/YBIBOrientationReceiveProtocol.h",
    "content": "//\n//  YBIBOrientationReceiveProtocol.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/8.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBOrientationReceiveProtocol <NSObject>\n\n@optional\n\n/**\n 图片浏览器的方向将要变化\n\n @param orientation 期望的方向\n */\n- (void)yb_orientationWillChangeWithExpectOrientation:(UIDeviceOrientation)orientation;\n\n/**\n 图片浏览器的方向变化动效调用，实现的变化会自动转换为动画\n\n @param orientation 期望的方向\n */\n- (void)yb_orientationChangeAnimationWithExpectOrientation:(UIDeviceOrientation)orientation;\n\n/**\n 图片浏览器的方向已经变化\n\n @param orientation 当前的方向\n */\n- (void)yb_orientationDidChangedWithOrientation:(UIDeviceOrientation)orientation;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Protocol/YBImageBrowserDataSource.h",
    "content": "//\n//  YBImageBrowserDataSource.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2018/8/25.\n//  Copyright © 2018年 波儿菜. All rights reserved.\n//\n\n#import \"YBIBDataProtocol.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBImageBrowser;\n\n@protocol YBImageBrowserDataSource <NSObject>\n\n@required\n\n/**\n 返回数据源数量\n\n @param imageBrowser 图片浏览器\n @return 数量\n */\n- (NSInteger)yb_numberOfCellsInImageBrowser:(YBImageBrowser *)imageBrowser;\n\n/**\n 返回当前下标对应的数据\n\n @param imageBrowser 图片浏览器\n @param index 当前下标\n @return 数据\n */\n- (id<YBIBDataProtocol>)yb_imageBrowser:(YBImageBrowser *)imageBrowser dataForCellAtIndex:(NSInteger)index;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/Protocol/YBImageBrowserDelegate.h",
    "content": "//\n//  YBImageBrowserDelegate.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/9.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBDataProtocol.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@class YBImageBrowser;\n\n@protocol YBImageBrowserDelegate <NSObject>\n\n@optional\n\n/**\n 页码变化\n\n @param imageBrowser 图片浏览器\n @param page 当前页码\n @param data 数据\n */\n- (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser pageChanged:(NSInteger)page data:(id<YBIBDataProtocol>)data;\n\n/**\n 响应长按手势（若实现该方法将阻止其它地方捕获到长按事件）\n\n @param imageBrowser 图片浏览器\n @param data 数据\n */\n- (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser respondsToLongPressWithData:(id<YBIBDataProtocol>)data;\n\n/**\n 开始转场\n\n @param imageBrowser 图片浏览器\n @param isShow YES 表示入场，NO 表示出场\n */\n- (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser beginTransitioningWithIsShow:(BOOL)isShow;\n\n/**\n 结束转场\n\n @param imageBrowser 图片浏览器\n @param isShow YES 表示入场，NO 表示出场\n */\n- (void)yb_imageBrowser:(YBImageBrowser *)imageBrowser endTransitioningWithIsShow:(BOOL)isShow;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/ToolView/YBIBSheetView.h",
    "content": "//\n//  YBIBSheetView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/6.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBDataProtocol;\n\ntypedef void(^YBIBSheetActionBlock)(id<YBIBDataProtocol> data);\n\n@interface YBIBSheetAction : NSObject\n\n/// 显示的名字\n@property (nonatomic, copy) NSString *name;\n\n/// 点击回调闭包\n@property (nonatomic, copy, nullable) YBIBSheetActionBlock action;\n\n+ (instancetype)actionWithName:(NSString *)name action:(_Nullable YBIBSheetActionBlock)action;\n\n@end\n\n\n@interface YBIBSheetView : UIView\n\n/// 数据源 (可自定义添加)\n@property (nonatomic, strong) NSMutableArray<YBIBSheetAction *> *actions;\n\n/// 列表 Cell 的高度\n@property (nonatomic, assign) CGFloat cellHeight;\n\n/// 列表最大高度与容器高度的比例\n@property (nonatomic, assign) CGFloat maxHeightScale;\n\n/// 取消的文本\n@property (nonatomic, copy) NSString *cancelText;\n\n/// 显示动画持续时间\n@property (nonatomic, assign) NSTimeInterval showDuration;\n\n/// 隐藏动画持续时间\n@property (nonatomic, assign) NSTimeInterval hideDuration;\n\n/// 背景透明度\n@property (nonatomic, assign) CGFloat backAlpha;\n\n/**\n 展示\n\n @param view 指定父视图\n @param orientation 当前方向\n */\n- (void)showToView:(UIView *)view orientation:(UIDeviceOrientation)orientation;\n\n/**\n 隐藏\n\n @param animation 是否带动画\n */\n- (void)hideWithAnimation:(BOOL)animation;\n\n/// 获取当前数据的闭包\n@property (nonatomic, copy) id<YBIBDataProtocol>(^currentdata)(void);\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/ToolView/YBIBSheetView.m",
    "content": "//\n//  YBIBSheetView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/6.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBSheetView.h\"\n#import \"YBIBUtilities.h\"\n#import \"YBIBCopywriter.h\"\n\n\n@implementation YBIBSheetAction\n+ (instancetype)actionWithName:(NSString *)name action:(YBIBSheetActionBlock)action {\n    YBIBSheetAction *sheetAction = [YBIBSheetAction new];\n    sheetAction.name = name;\n    sheetAction.action = action;\n    return sheetAction;\n}\n@end\n\n\n@interface YBIBSheetCell : UITableViewCell\n@property (nonatomic, strong) UILabel *titleLabel;\n@property (nonatomic, strong) CALayer *line;\n@end\n@implementation YBIBSheetCell\n- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {\n    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {\n        self.selectionStyle = UITableViewCellSelectionStyleNone;\n        _titleLabel = [UILabel new];\n        _titleLabel.textColor = UIColor.darkTextColor;\n        _titleLabel.font = [UIFont fontWithName:@\"Avenir-Medium\" size:16];\n        _titleLabel.textAlignment = NSTextAlignmentCenter;\n        _line = [CALayer new];\n        _line.backgroundColor = UIColor.groupTableViewBackgroundColor.CGColor;\n        [self.contentView addSubview:_titleLabel];\n        [self.contentView.layer addSublayer:_line];\n    }\n    return self;\n}\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    CGFloat width = self.contentView.bounds.size.width, height = self.contentView.bounds.size.height;\n    CGFloat lineHeight = 0.5;\n    _line.frame = CGRectMake(0, height - lineHeight, width, lineHeight);\n    CGFloat offset = 15;\n    _titleLabel.frame = CGRectMake(offset, 0, width - offset * 2, height);\n}\n@end\n\n\nstatic CGFloat kOffsetSpace = 5;\n\n@interface YBIBSheetView () <UITableViewDelegate, UITableViewDataSource>\n@property (nonatomic, strong) UITableView *tableView;\n@end\n\n@implementation YBIBSheetView {\n    CGRect _tableShowFrame;\n    CGRect _tableHideFrame;\n}\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        _cancelText = [YBIBCopywriter sharedCopywriter].cancel;\n        _maxHeightScale = 0.7;\n        _showDuration = 0.2;\n        _hideDuration = 0.1;\n        _cellHeight = 50;\n        _backAlpha = 0.3;\n        _actions = [NSMutableArray array];\n        \n        [self addSubview:self.tableView];\n    }\n    return self;\n}\n\n#pragma mark - public\n\n- (void)showToView:(UIView *)view orientation:(UIDeviceOrientation)orientation {\n    if (self.actions.count == 0) return;\n    \n    [view addSubview:self];\n    self.frame = view.bounds;\n    \n    UIEdgeInsets padding = YBIBPaddingByBrowserOrientation(orientation);\n    \n    CGFloat footerHeight = padding.bottom;\n    CGFloat tableHeight = self.cellHeight * (self.actions.count + 1) + kOffsetSpace + footerHeight;\n    \n    _tableShowFrame = self.frame;\n    _tableShowFrame.size.height = MIN(self.maxHeightScale * self.bounds.size.height, tableHeight);\n    _tableShowFrame.origin.y = self.bounds.size.height - _tableShowFrame.size.height;\n    \n    _tableHideFrame = _tableShowFrame;\n    _tableHideFrame.origin.y = self.bounds.size.height;\n    \n    self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0];\n    self.tableView.frame = _tableHideFrame;\n    self.tableView.tableFooterView.bounds = CGRectMake(0, 0, self.tableView.frame.size.width, footerHeight);\n    [UIView animateWithDuration:self.showDuration animations:^{\n        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:self->_backAlpha];\n        self.tableView.frame = self->_tableShowFrame;\n    }];\n}\n\n- (void)hideWithAnimation:(BOOL)animation {\n    if (!self.superview) return;\n    \n    void(^animationsBlock)(void) = ^{\n        self.tableView.frame = self->_tableHideFrame;\n        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0];\n    };\n    void(^completionBlock)(BOOL n) = ^(BOOL n){\n        [self removeFromSuperview];\n    };\n    if (animation) {\n        [UIView animateWithDuration:self.hideDuration animations:animationsBlock completion:completionBlock];\n    } else {\n        animationsBlock();\n        completionBlock(NO);\n    }\n}\n\n#pragma mark - touch\n\n- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {\n    CGPoint point = [touches.anyObject locationInView:self];\n    if (!CGRectContainsPoint(self.tableView.frame, point)) {\n        [self hideWithAnimation:YES];\n    }\n}\n\n#pragma mark - <UITableViewDataSource>\n\n- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {\n    return 2;\n}\n\n- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {\n    return section == 0 ? self.actions.count : 1;\n}\n\n- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {\n    return self.cellHeight;\n}\n\n- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {\n    return section == 0 ? CGFLOAT_MIN : kOffsetSpace;\n}\n\n- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {\n    return CGFLOAT_MIN;\n}\n\n- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n    YBIBSheetCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(YBIBSheetCell.self)];\n    if (indexPath.section == 0) {\n        cell.line.hidden = NO;\n        YBIBSheetAction *action = self.actions[indexPath.row];\n        cell.titleLabel.text = action.name;\n    } else {\n        cell.line.hidden = YES;\n        cell.titleLabel.text = self.cancelText;\n    }\n    return cell;\n}\n\n#pragma mark - <UITableViewDelegate>\n\n- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {\n    if (indexPath.section == 0) {\n        YBIBSheetAction *action = self.actions[indexPath.row];\n        if (action.action) action.action(self.currentdata());\n    } else {\n        [self hideWithAnimation:YES];\n    }\n}\n\n#pragma mark - getters\n\n- (UITableView *)tableView {\n    if (!_tableView) {\n        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];\n        _tableView.delegate = self;\n        _tableView.dataSource = self;\n        _tableView.estimatedRowHeight = 44;\n        _tableView.estimatedSectionFooterHeight = 0;\n        _tableView.estimatedSectionHeaderHeight = 0;\n        _tableView.backgroundColor = [UIColor clearColor];\n        _tableView.alwaysBounceVertical = NO;\n        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;\n        if (@available(iOS 11.0, *)) {\n            _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;\n        }\n        UIView *footer = [UIView new];\n        footer.backgroundColor = UIColor.whiteColor;\n        _tableView.tableFooterView = footer;\n        [_tableView registerClass:YBIBSheetCell.self forCellReuseIdentifier:NSStringFromClass(YBIBSheetCell.self)];\n    }\n    return _tableView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/ToolView/YBIBToolViewHandler.h",
    "content": "//\n//  YBIBToolViewHandler.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/7.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBSheetView.h\"\n#import \"YBIBTopView.h\"\n#import \"YBIBDataProtocol.h\"\n#import \"YBIBOrientationReceiveProtocol.h\"\n#import \"YBIBOperateBrowserProtocol.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@protocol YBIBToolViewHandler <YBIBGetBaseInfoProtocol, YBIBOperateBrowserProtocol, YBIBOrientationReceiveProtocol>\n\n@required\n\n/**\n 容器视图准备好了，可进行子视图的添加和布局\n */\n- (void)yb_containerViewIsReadied;\n\n/**\n 隐藏视图\n \n @param hide 是否隐藏\n */\n- (void)yb_hide:(BOOL)hide;\n\n@optional\n\n/// 当前数据\n@property (nonatomic, copy) id<YBIBDataProtocol>(^yb_currentData)(void);\n\n/**\n 页码变化了\n */\n- (void)yb_pageChanged;\n\n/**\n 偏移量变化了\n\n @param offsetX 当前偏移量\n */\n- (void)yb_offsetXChanged:(CGFloat)offsetX;\n\n/**\n 响应长按手势\n */\n- (void)yb_respondsToLongPress;\n\n@end\n\n@interface YBIBToolViewHandler : NSObject <YBIBToolViewHandler>\n\n/// 弹出表单视图\n@property (nonatomic, strong, readonly) YBIBSheetView *sheetView;\n\n/// 顶部显示页码视图\n@property (nonatomic, strong, readonly) YBIBTopView *topView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/ToolView/YBIBToolViewHandler.m",
    "content": "//\n//  YBIBToolViewHandler.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/7.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBToolViewHandler.h\"\n#import \"YBIBCopywriter.h\"\n#import \"YBIBUtilities.h\"\n\n@interface YBIBToolViewHandler ()\n@property (nonatomic, strong) YBIBSheetView *sheetView;\n@property (nonatomic, strong) YBIBSheetAction *saveAction;\n@property (nonatomic, strong) YBIBTopView *topView;\n@end\n\n@implementation YBIBToolViewHandler\n\n#pragma mark - <YBIBToolViewHandler>\n\n@synthesize yb_containerView = _yb_containerView;\n@synthesize yb_containerSize = _yb_containerSize;\n@synthesize yb_currentPage = _yb_currentPage;\n@synthesize yb_totalPage = _yb_totalPage;\n@synthesize yb_currentOrientation = _yb_currentOrientation;\n@synthesize yb_currentData = _yb_currentData;\n\n- (void)yb_containerViewIsReadied {\n    [self.yb_containerView addSubview:self.topView];\n    [self layoutWithExpectOrientation:self.yb_currentOrientation()];\n}\n\n- (void)yb_pageChanged {\n    if (self.topView.operationType == YBIBTopViewOperationTypeSave) {\n        self.topView.operationButton.hidden = [self currentDataShouldHideSaveButton];\n    }\n    [self.topView setPage:self.yb_currentPage() totalPage:self.yb_totalPage()];\n}\n\n- (void)yb_respondsToLongPress {\n    [self showSheetView];\n}\n\n- (void)yb_hide:(BOOL)hide {\n    self.topView.hidden = hide;\n    [self.sheetView hideWithAnimation:NO];\n}\n\n- (void)yb_orientationWillChangeWithExpectOrientation:(UIDeviceOrientation)orientation {\n    [self.sheetView hideWithAnimation:NO];\n}\n\n- (void)yb_orientationChangeAnimationWithExpectOrientation:(UIDeviceOrientation)orientation {\n    [self layoutWithExpectOrientation:orientation];\n}\n\n#pragma mark - private\n\n- (BOOL)currentDataShouldHideSaveButton {\n    id<YBIBDataProtocol> data = self.yb_currentData();\n    BOOL allow = [data respondsToSelector:@selector(yb_allowSaveToPhotoAlbum)] && [data yb_allowSaveToPhotoAlbum];\n    BOOL can = [data respondsToSelector:@selector(yb_saveToPhotoAlbum)];\n    return !(allow && can);\n}\n\n- (void)layoutWithExpectOrientation:(UIDeviceOrientation)orientation {\n    CGSize containerSize = self.yb_containerSize(orientation);\n    UIEdgeInsets padding = YBIBPaddingByBrowserOrientation(orientation);\n    \n    self.topView.frame = CGRectMake(padding.left, padding.top, containerSize.width - padding.left - padding.right, [YBIBTopView defaultHeight]);\n}\n\n- (void)showSheetView {\n    if ([self currentDataShouldHideSaveButton]) {\n        [self.sheetView.actions removeObject:self.saveAction];\n    } else {\n        if (![self.sheetView.actions containsObject:self.saveAction]) {\n            [self.sheetView.actions addObject:self.saveAction];\n        }\n    }\n    [self.sheetView showToView:self.yb_containerView orientation:self.yb_currentOrientation()];\n}\n\n#pragma mark - getters\n\n- (YBIBSheetView *)sheetView {\n    if (!_sheetView) {\n        _sheetView = [YBIBSheetView new];\n        __weak typeof(self) wSelf = self;\n        [_sheetView setCurrentdata:^id<YBIBDataProtocol>{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return nil;\n            return self.yb_currentData();\n        }];\n    }\n    return _sheetView;\n}\n\n- (YBIBSheetAction *)saveAction {\n    if (!_saveAction) {\n        __weak typeof(self) wSelf = self;\n        _saveAction = [YBIBSheetAction actionWithName:[YBIBCopywriter sharedCopywriter].saveToPhotoAlbum action:^(id<YBIBDataProtocol> data) {\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            if ([data respondsToSelector:@selector(yb_saveToPhotoAlbum)]) {\n                [data yb_saveToPhotoAlbum];\n            }\n            [self.sheetView hideWithAnimation:YES];\n        }];\n    }\n    return _saveAction;\n}\n\n- (YBIBTopView *)topView {\n    if (!_topView) {\n        _topView = [YBIBTopView new];\n        _topView.operationType = YBIBTopViewOperationTypeMore;\n        __weak typeof(self) wSelf = self;\n        [_topView setClickOperation:^(YBIBTopViewOperationType type) {\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            switch (type) {\n                case YBIBTopViewOperationTypeSave: {\n                    id<YBIBDataProtocol> data = self.yb_currentData();\n                    if ([data respondsToSelector:@selector(yb_saveToPhotoAlbum)]) {\n                        [data yb_saveToPhotoAlbum];\n                    }\n                }\n                    break;\n                case YBIBTopViewOperationTypeMore: {\n                    [self showSheetView];\n                }\n                    break;\n                default:\n                    break;\n            }\n        }];\n    }\n    return _topView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/ToolView/YBIBTopView.h",
    "content": "//\n//  YBIBTopView.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/6.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef NS_ENUM(NSInteger, YBIBTopViewOperationType) {\n    YBIBTopViewOperationTypeSave,   //保存\n    YBIBTopViewOperationTypeMore    //更多\n};\n\n@interface YBIBTopView : UIView\n\n/// 页码标签\n@property (nonatomic, strong, readonly) UILabel *pageLabel;\n\n/// 操作按钮（自定义：直接修改图片或文字，然后添加点击事件）\n@property (nonatomic, strong, readonly) UIButton *operationButton;\n\n/// 按钮类型\n@property (nonatomic, assign) YBIBTopViewOperationType operationType;\n\n/**\n 设置页码\n\n @param page 当前页码\n @param totalPage 总页码数\n */\n- (void)setPage:(NSInteger)page totalPage:(NSInteger)totalPage;\n\n/// 点击操作按钮的回调\n@property (nonatomic, copy) void(^clickOperation)(YBIBTopViewOperationType type);\n\n+ (CGFloat)defaultHeight;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/ToolView/YBIBTopView.m",
    "content": "//\n//  YBIBTopView.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/7/6.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBTopView.h\"\n#import \"YBIBIconManager.h\"\n#import \"YBIBUtilities.h\"\n\n@interface YBIBTopView ()\n@property (nonatomic, strong) UILabel *pageLabel;\n@property (nonatomic, strong) UIButton *operationButton;\n@end\n\n@implementation YBIBTopView\n\n#pragma mark - life cycle\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        [self addSubview:self.pageLabel];\n        [self addSubview:self.operationButton];\n        \n        [self setOperationType:YBIBTopViewOperationTypeMore];\n    }\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    CGFloat height = self.bounds.size.height, width = self.bounds.size.width;\n    self.pageLabel.frame = CGRectMake(16, 0, width / 3, height);\n    CGFloat buttonWidth = 54;\n    self.operationButton.frame = CGRectMake(width - buttonWidth, 0, buttonWidth, height);\n}\n\n#pragma mark - public\n\n+ (CGFloat)defaultHeight {\n    return 50;\n}\n\n- (void)setPage:(NSInteger)page totalPage:(NSInteger)totalPage {\n    if (totalPage <= 1) {\n        self.pageLabel.hidden = YES;\n    } else {\n        self.pageLabel.hidden  = NO;\n        \n        NSString *text = [NSString stringWithFormat:@\"%ld/%ld\", page + (NSInteger)1, totalPage];\n        NSShadow *shadow = [NSShadow new];\n        shadow.shadowBlurRadius = 4;\n        shadow.shadowOffset = CGSizeMake(0, 1);\n        shadow.shadowColor = UIColor.darkGrayColor;\n        NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSShadowAttributeName:shadow}];\n        self.pageLabel.attributedText = attr;\n    }\n}\n\n#pragma mark - event\n\n- (void)clickOperationButton:(UIButton *)button {\n    if (self.clickOperation) self.clickOperation(self.operationType);\n}\n\n#pragma mark - getters & setters\n\n- (void)setOperationType:(YBIBTopViewOperationType)operationType {\n    _operationType = operationType;\n    \n    UIImage *image = nil;\n    switch (operationType) {\n        case YBIBTopViewOperationTypeSave:\n            image = [YBIBIconManager sharedManager].toolSaveImage();\n            break;\n        case YBIBTopViewOperationTypeMore:\n            image = [YBIBIconManager sharedManager].toolMoreImage();\n            break;\n    }\n    \n    [self.operationButton setImage:image forState:UIControlStateNormal];\n}\n\n- (UILabel *)pageLabel {\n    if (!_pageLabel) {\n        _pageLabel = [UILabel new];\n        _pageLabel.textColor = [UIColor whiteColor];\n        _pageLabel.font = [UIFont boldSystemFontOfSize:16];\n        _pageLabel.textAlignment = NSTextAlignmentLeft;\n        _pageLabel.adjustsFontSizeToFitWidth = YES;\n    }\n    return _pageLabel;\n}\n\n- (UIButton *)operationButton {\n    if (!_operationButton) {\n        _operationButton = [UIButton buttonWithType:UIButtonTypeCustom];\n        _operationButton.titleLabel.font = [UIFont boldSystemFontOfSize:16];\n        _operationButton.titleLabel.adjustsFontSizeToFitWidth = YES;\n        [_operationButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];\n        [_operationButton addTarget:self action:@selector(clickOperationButton:) forControlEvents:UIControlEventTouchUpInside];\n        _operationButton.layer.shadowColor = UIColor.darkGrayColor.CGColor;\n        _operationButton.layer.shadowOffset = CGSizeMake(0, 1);\n        _operationButton.layer.shadowOpacity = 1;\n        _operationButton.layer.shadowRadius = 4;\n    }\n    return _operationButton;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/WebImageMediator/YBIBDefaultWebImageMediator.h",
    "content": "//\n//  YBIBDefaultWebImageMediator.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/8/27.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBWebImageMediator.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBIBDefaultWebImageMediator : NSObject <YBIBWebImageMediator>\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/WebImageMediator/YBIBDefaultWebImageMediator.m",
    "content": "//\n//  YBIBDefaultWebImageMediator.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/8/27.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import \"YBIBDefaultWebImageMediator.h\"\n#import \"YBIBUtilities.h\"\n#if __has_include(<SDWebImage/SDWebImage.h>)\n#import <SDWebImage/SDWebImage.h>\n#else\n#import \"SDWebImage.h\"\n#endif\n\n@implementation YBIBDefaultWebImageMediator\n\n#pragma mark - <YBIBWebImageMediator>\n\n- (id)yb_downloadImageWithURL:(NSURL *)URL requestModifier:(nullable YBIBWebImageRequestModifierBlock)requestModifier progress:(nonnull YBIBWebImageProgressBlock)progress success:(nonnull YBIBWebImageSuccessBlock)success failed:(nonnull YBIBWebImageFailedBlock)failed {\n    if (!URL) return nil;\n    \n    SDWebImageContext *context = nil;\n    if (requestModifier) {\n        SDWebImageDownloaderRequestModifier *modifier = [SDWebImageDownloaderRequestModifier requestModifierWithBlock:requestModifier];\n        context = @{SDWebImageContextDownloadRequestModifier:modifier};\n    }\n    \n    SDWebImageDownloaderOptions options = SDWebImageDownloaderLowPriority | SDWebImageDownloaderAvoidDecodeImage;\n    \n    SDWebImageDownloadToken *token = [[SDWebImageDownloader sharedDownloader] downloadImageWithURL:URL options:options context:context progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {\n        if (progress) progress(receivedSize, expectedSize);\n    } completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {\n        if (error) {\n            if (failed) failed(error, finished);\n        } else {\n            if (success) success(data, finished);\n        }\n    }];\n    return token;\n}\n\n- (void)yb_cancelTaskWithDownloadToken:(id)token {\n    if (token && [token isKindOfClass:SDWebImageDownloadToken.class]) {\n        [((SDWebImageDownloadToken *)token) cancel];\n    }\n}\n\n- (void)yb_storeToDiskWithImageData:(NSData *)data forKey:(NSURL *)key {\n    if (!key) return;\n    NSString *cacheKey = [SDWebImageManager.sharedManager cacheKeyForURL:key];\n    if (!cacheKey) return;\n    \n    YBIB_DISPATCH_ASYNC(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{\n        [[SDImageCache sharedImageCache] storeImageDataToDisk:data forKey:cacheKey];\n    })\n}\n\n- (void)yb_queryCacheOperationForKey:(NSURL *)key completed:(YBIBWebImageCacheQueryCompletedBlock)completed {\n#define QUERY_CACHE_FAILED if (completed) {completed(nil, nil); return;}\n    if (!key) QUERY_CACHE_FAILED\n        NSString *cacheKey = [SDWebImageManager.sharedManager cacheKeyForURL:key];\n    if (!cacheKey) QUERY_CACHE_FAILED\n#undef QUERY_CACHE_FAILED\n        \n        // 'NSData' of image must be read to ensure decoding correctly.\n        SDImageCacheOptions options = SDImageCacheQueryMemoryData | SDImageCacheAvoidDecodeImage;\n    [[SDImageCache sharedImageCache] queryCacheOperationForKey:cacheKey options:options done:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) {\n        if (completed) completed(image, data);\n    }];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/WebImageMediator/YBIBWebImageMediator.h",
    "content": "//\n//  YBIBWebImageMediator.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/8/27.\n//  Copyright © 2019 杨波. All rights reserved.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\ntypedef NSURLRequest * _Nullable (^YBIBWebImageRequestModifierBlock)(NSURLRequest *request);\ntypedef void(^YBIBWebImageProgressBlock)(NSInteger receivedSize, NSInteger expectedSize);\ntypedef void(^YBIBWebImageSuccessBlock)(NSData * _Nullable imageData, BOOL finished);\ntypedef void(^YBIBWebImageFailedBlock)(NSError * _Nullable error, BOOL finished);\ntypedef void(^YBIBWebImageCacheQueryCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable imageData);\n\n@protocol YBIBWebImageMediator <NSObject>\n\n@required\n\n/**\n 下载图片\n\n @param URL 图片地址\n @param requestModifier 修改默认 NSURLRequest 的闭包\n @param progress 进度回调\n @param success 成功回调\n @param failed 失败回调\n @return 下载 token (可为空)\n */\n- (id)yb_downloadImageWithURL:(NSURL *)URL requestModifier:(nullable YBIBWebImageRequestModifierBlock)requestModifier progress:(YBIBWebImageProgressBlock)progress success:(YBIBWebImageSuccessBlock)success failed:(YBIBWebImageFailedBlock)failed;\n\n/**\n 缓存图片数据到磁盘\n\n @param data 图片数据\n @param key 缓存标识\n */\n- (void)yb_storeToDiskWithImageData:(nullable NSData *)data forKey:(NSURL *)key;\n\n/**\n 读取图片数据\n\n @param key 缓存标识\n @param completed 读取回调\n */\n- (void)yb_queryCacheOperationForKey:(NSURL *)key completed:(YBIBWebImageCacheQueryCompletedBlock)completed;\n\n@optional\n\n/**\n 取消下载\n \n @param token 下载 token\n */\n- (void)yb_cancelTaskWithDownloadToken:(id)token;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/YBImageBrowser.h",
    "content": "//\n//  YBImageBrowser.h\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBIBCollectionView.h\"\n#import \"YBImageBrowserDataSource.h\"\n#import \"YBImageBrowserDelegate.h\"\n#import \"YBIBDataProtocol.h\"\n#import \"YBIBCellProtocol.h\"\n#import \"YBIBAnimatedTransition.h\"\n#import \"YBIBAuxiliaryViewHandler.h\"\n#import \"YBIBToolViewHandler.h\"\n#import \"YBIBWebImageMediator.h\"\n#import \"YBIBImageData.h\"\n\nNS_ASSUME_NONNULL_BEGIN\n\n@interface YBImageBrowser : UIView\n\n/// 数据源数组\n@property (nonatomic, copy) NSArray<id<YBIBDataProtocol>> *dataSourceArray;\n\n/// 数据源代理\n@property (nonatomic, weak) id<YBImageBrowserDataSource> dataSource;\n\n/// 状态回调代理\n@property (nonatomic, weak) id<YBImageBrowserDelegate> delegate;\n\n/**\n 展示图片浏览器\n\n @param view 指定父视图（view 的大小不能为 CGSizeZero，但允许变化）\n @param containerSize 容器大小（当 view 的大小允许变化时，必须指定确切的 containerSize）\n */\n- (void)showToView:(UIView *)view containerSize:(CGSize)containerSize;\n- (void)showToView:(UIView *)view;\n- (void)show;\n\n/**\n 隐藏图片浏览器（不建议外部持有图片浏览器重复使用）\n */\n- (void)hide;\n\n/// 当前页码\n@property (nonatomic, assign) NSInteger currentPage;\n\n/// 分页间距\n@property (nonatomic, assign) CGFloat distanceBetweenPages;\n\n/// 当前图片浏览器的方向\n@property (nonatomic, assign, readonly) UIDeviceOrientation currentOrientation;\n\n/// 图片浏览器支持的方向 (仅当前控制器不支持旋转时有效，否则将跟随控制器旋转)\n@property (nonatomic, assign) UIInterfaceOrientationMask supportedOrientations;\n\n/// 是否自动隐藏 id<YBIBImageData> 设置的映射视图，默认为 YES\n@property (nonatomic, assign) BOOL autoHideProjectiveView;\n\n/// 是否正在转场\n@property (nonatomic, assign, readonly, getter=isTransitioning) BOOL transitioning;\n/// 是否正在进行展示过程转场\n@property (nonatomic, assign, readonly, getter=isShowTransitioning) BOOL showTransitioning;\n/// 是否正在进行隐藏过程转场\n@property (nonatomic, assign, readonly, getter=isHideTransitioning) BOOL hideTransitioning;\n\n/// 预加载数量 (默认为 2，低内存设备默认为 0)\n@property (nonatomic, assign) NSUInteger preloadCount;\n\n/**\n 重载数据，请保证数据源被正确修改\n */\n- (void)reloadData;\n\n/**\n 获取当前展示的数据对象\n\n @return 数据对象\n */\n- (id<YBIBDataProtocol>)currentData;\n\n/// 是否隐藏状态栏，默认为 YES（该值为 YES 时需要在 info.plist 中添加 View controller-based status bar appearance : NO 才能生效）\n@property (nonatomic, assign) BOOL shouldHideStatusBar;\n\n/// 工具视图处理器\n/// 赋值可自定义，实现者可以直接用 UIView，或者创建一个中介者管理一系列的 UIView。\n/// 内部消息是按照数组下标顺序调度的，所以如果有多个处理器注意添加 UIView 的视图层级。\n@property (nonatomic, copy) NSArray<id<YBIBToolViewHandler>> *toolViewHandlers;\n/// 默认工具视图处理器\n@property (nonatomic, weak, readonly) YBIBToolViewHandler *defaultToolViewHandler;\n\n/// Toast/Loading 处理器 (赋值可自定义)\n@property (nonatomic, strong) id<YBIBAuxiliaryViewHandler> auxiliaryViewHandler;\n\n/// 转场实现类 (赋值可自定义)\n@property (nonatomic, strong) id<YBIBAnimatedTransition> animatedTransition;\n/// 默认转场实现类 (可配置其属性)\n@property (nonatomic, weak, readonly) YBIBAnimatedTransition *defaultAnimatedTransition;\n\n/// 图片下载缓存相关的中介者（赋值可自定义）\n@property (nonatomic, strong) id<YBIBWebImageMediator> webImageMediator;\n\n/// 核心集合视图\n@property (nonatomic, strong, readonly) YBIBCollectionView *collectionView;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser/YBImageBrowser/YBImageBrowser.m",
    "content": "//\n//  YBImageBrowser.m\n//  YBImageBrowserDemo\n//\n//  Created by 波儿菜 on 2019/6/5.\n//  Copyright © 2019 波儿菜. All rights reserved.\n//\n\n#import \"YBImageBrowser.h\"\n#import \"YBIBUtilities.h\"\n#import \"YBIBCellProtocol.h\"\n#import \"YBIBDataMediator.h\"\n#import \"YBIBScreenRotationHandler.h\"\n#import \"NSObject+YBImageBrowser.h\"\n#import \"YBImageBrowser+Internal.h\"\n#if __has_include(\"YBIBDefaultWebImageMediator.h\")\n#import \"YBIBDefaultWebImageMediator.h\"\n#endif\n\n@interface YBImageBrowser () <UICollectionViewDelegate, UICollectionViewDataSource>\n@property (nonatomic, strong) YBIBCollectionView *collectionView;\n@property (nonatomic, strong) YBIBDataMediator *dataMediator;\n@property (nonatomic, strong) YBIBScreenRotationHandler *rotationHandler;\n@end\n\n@implementation YBImageBrowser {\n    BOOL _originStatusBarHidden;\n}\n\n#pragma mark - life cycle\n\n- (void)dealloc {\n    self.hiddenProjectiveView = nil;\n    [self showStatusBar];\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (self) {\n        self.backgroundColor = UIColor.blackColor;\n        UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(respondsToLongPress:)];\n        [self addGestureRecognizer:longPress];\n        [self initValue];\n    }\n    return self;\n}\n\n- (void)initValue {\n    _transitioning = _showTransitioning = _hideTransitioning = NO;\n    _defaultAnimatedTransition = _animatedTransition = [YBIBAnimatedTransition new];\n    _toolViewHandlers = @[[YBIBToolViewHandler new]];\n    _defaultToolViewHandler = _toolViewHandlers[0];\n    _auxiliaryViewHandler = [YBIBAuxiliaryViewHandler new];\n    _shouldHideStatusBar = YES;\n    _autoHideProjectiveView = YES;\n#if __has_include(\"YBIBDefaultWebImageMediator.h\")\n    _webImageMediator = [YBIBDefaultWebImageMediator new];\n#endif\n}\n\n#pragma mark - private\n\n- (void)build {\n    [self addSubview:self.collectionView];\n    self.collectionView.frame = self.bounds;\n    self.collectionView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n    \n    [self addSubview:self.containerView];\n    self.containerView.frame = self.bounds;\n    self.containerView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n    \n    [self buildToolView];\n    \n    [self layoutIfNeeded];\n    \n    [self collectionViewScrollToPage:self.currentPage];\n    [self.rotationHandler startObserveDeviceOrientation];\n}\n\n- (void)buildToolView {\n    for (id<YBIBToolViewHandler> handler in self.toolViewHandlers) {\n        [self implementGetBaseInfoProtocol:handler];\n        [self implementOperateBrowserProtocol:handler];\n        __weak typeof(self) wSelf = self;\n        if ([handler respondsToSelector:@selector(setYb_currentData:)]) {\n            [handler setYb_currentData:^id<YBIBDataProtocol>{\n                __strong typeof(wSelf) self = wSelf;\n                if (!self) return nil;\n                return self.currentData;\n            }];\n        }\n        [handler yb_containerViewIsReadied];\n        [handler yb_hide:NO];\n    }\n}\n\n- (void)rebuild {\n    self.hiddenProjectiveView = nil;\n    [self showStatusBar];\n    [self.containerView removeFromSuperview];\n    _containerView = nil;\n    [self.collectionView removeFromSuperview];\n    _collectionView = nil;\n    [self.dataMediator clear];\n    [self.rotationHandler clear];\n}\n\n- (void)collectionViewScrollToPage:(NSInteger)page {\n    [self.collectionView scrollToPage:page];\n    [self pageNumberChanged];\n}\n\n- (void)pageNumberChanged {\n    id<YBIBDataProtocol> data = self.currentData;\n    UIView *projectiveView = nil;\n    if ([data respondsToSelector:@selector(yb_projectiveView)]) {\n        projectiveView = [data yb_projectiveView];\n    }\n    self.hiddenProjectiveView = projectiveView;\n    \n    if (self.delegate && [self.delegate respondsToSelector:@selector(yb_imageBrowser:pageChanged:data:)]) {\n        [self.delegate yb_imageBrowser:self pageChanged:self.currentPage data:data];\n    }\n    for (id<YBIBToolViewHandler> handler in self.toolViewHandlers) {\n        if ([handler respondsToSelector:@selector(yb_pageChanged)]) {\n            [handler yb_pageChanged];\n        }\n    }\n    NSArray *visibleCells = self.collectionView.visibleCells;\n    for (UICollectionViewCell<YBIBCellProtocol> *cell in visibleCells) {\n        if ([cell respondsToSelector:@selector(yb_pageChanged)]) {\n            [cell yb_pageChanged];\n        }\n    }\n}\n\n- (void)showStatusBar {\n    if (self.shouldHideStatusBar) {\n        [UIApplication sharedApplication].statusBarHidden = _originStatusBarHidden;\n    }\n}\n\n- (void)hideStatusBar {\n    if (self.shouldHideStatusBar) {\n        [UIApplication sharedApplication].statusBarHidden = YES;\n    }\n}\n\n#pragma mark - public\n\n- (void)show {\n    [self showToView:[UIApplication sharedApplication].keyWindow];\n}\n\n- (void)showToView:(UIView *)view {\n    [self showToView:view containerSize:view.bounds.size];\n}\n\n- (void)showToView:(UIView *)view containerSize:(CGSize)containerSize {\n    [self.rotationHandler startObserveStatusBarOrientation];\n    \n    [view addSubview:self];\n    self.frame = view.bounds;\n    self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;\n    \n    _originStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;\n    \n    [self.rotationHandler configContainerSize:containerSize];\n    \n    [self.dataMediator preloadWithPage:self.currentPage];\n    \n    __kindof UIView *startView;\n    UIImage *startImage;\n    CGRect endFrame = CGRectZero;\n    id<YBIBDataProtocol> data = [self.dataMediator dataForCellAtIndex:self.currentPage];\n    if ([data respondsToSelector:@selector(yb_projectiveView)]) {\n        startView = data.yb_projectiveView;\n        self.hiddenProjectiveView = startView;\n        if ([startView isKindOfClass:UIImageView.class]) {\n            startImage = ((UIImageView *)startView).image;\n        } else {\n            startImage = YBIBSnapshotView(startView);\n        }\n    }\n    if ([data respondsToSelector:@selector(yb_imageViewFrameWithContainerSize:imageSize:orientation:)]) {\n        endFrame = [data yb_imageViewFrameWithContainerSize:self.bounds.size imageSize:startImage.size orientation:self.rotationHandler.currentOrientation];\n    }\n    \n    [self setTransitioning:YES isShow:YES];\n    [self.animatedTransition yb_showTransitioningWithContainer:self startView:startView startImage:startImage endFrame:endFrame orientation:self.rotationHandler.currentOrientation completion:^{\n        [self hideStatusBar];\n        [self build];\n        [self setTransitioning:NO isShow:YES];\n    }];\n}\n\n- (void)hide {\n    __kindof UIView *startView;\n    __kindof UIView *endView;\n    UICollectionViewCell<YBIBCellProtocol> *cell = (UICollectionViewCell<YBIBCellProtocol> *)self.collectionView.centerCell;\n    if ([cell respondsToSelector:@selector(yb_foregroundView)]) {\n        startView = cell.yb_foregroundView;\n    }\n    if ([cell.yb_cellData respondsToSelector:@selector(yb_projectiveView)]) {\n        endView = cell.yb_cellData.yb_projectiveView;\n    }\n    \n    for (id<YBIBToolViewHandler> handler in self.toolViewHandlers) {\n        [handler yb_hide:YES];\n    }\n    [self showStatusBar];\n    \n    [self setTransitioning:YES isShow:NO];\n    [self.animatedTransition yb_hideTransitioningWithContainer:self startView:startView endView:endView orientation:self.rotationHandler.currentOrientation completion:^{\n        [self rebuild];\n        [self removeFromSuperview];\n        [self setTransitioning:NO isShow:NO];\n    }];\n}\n\n- (void)reloadData {\n    [self.dataMediator clear];\n    NSInteger page = self.currentPage;\n    [self.collectionView reloadData];\n    self.currentPage = page;\n}\n\n- (id<YBIBDataProtocol>)currentData {\n    return [self.dataMediator dataForCellAtIndex:self.currentPage];\n}\n\n#pragma mark - internal\n\n- (void)setHiddenProjectiveView:(NSObject *)hiddenProjectiveView {\n    if (_hiddenProjectiveView && [_hiddenProjectiveView respondsToSelector:@selector(setAlpha:)]) {\n        CGFloat originAlpha = _hiddenProjectiveView.ybib_originAlpha;\n        if (originAlpha != 1) {\n            [_hiddenProjectiveView setValue:@(1) forKey:@\"alpha\"];\n            [UIView animateWithDuration:0.2 animations:^{\n                [self->_hiddenProjectiveView setValue:@(originAlpha) forKey:@\"alpha\"];\n            }];\n        } else {\n            [_hiddenProjectiveView setValue:@(originAlpha) forKey:@\"alpha\"];\n        }\n    }\n    _hiddenProjectiveView = hiddenProjectiveView;\n    \n    if (!self.autoHideProjectiveView) return;\n    \n    if (hiddenProjectiveView && [hiddenProjectiveView respondsToSelector:@selector(setAlpha:)]) {\n        hiddenProjectiveView.ybib_originAlpha = ((NSNumber *)[hiddenProjectiveView valueForKey:@\"alpha\"]).floatValue;\n        [hiddenProjectiveView setValue:@(0) forKey:@\"alpha\"];\n    }\n}\n\n- (void)implementOperateBrowserProtocol:(id<YBIBOperateBrowserProtocol>)obj {\n    __weak typeof(self) wSelf = self;\n    if ([obj respondsToSelector:@selector(setYb_hideBrowser:)]) {\n        [obj setYb_hideBrowser:^{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            [self hide];\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_hideStatusBar:)]) {\n        [obj setYb_hideStatusBar:^(BOOL hide) {\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            hide ? [self hideStatusBar] : [self showStatusBar];\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_hideToolViews:)]) {\n        [obj setYb_hideToolViews:^(BOOL hide) {\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return;\n            for (id<YBIBToolViewHandler> handler in self.toolViewHandlers) {\n                [handler yb_hide:hide];\n            }\n        }];\n    }\n}\n\n- (void)implementGetBaseInfoProtocol:(id<YBIBGetBaseInfoProtocol>)obj {\n    __weak typeof(self) wSelf = self;\n    if ([obj respondsToSelector:@selector(setYb_currentOrientation:)]) {\n        [obj setYb_currentOrientation:^UIDeviceOrientation{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return UIDeviceOrientationPortrait;\n            return self.rotationHandler.currentOrientation;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_containerSize:)]) {\n        [obj setYb_containerSize:^CGSize(UIDeviceOrientation orientation) {\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return CGSizeZero;\n            return [self.rotationHandler containerSizeWithOrientation:orientation];\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_auxiliaryViewHandler:)]) {\n        [obj setYb_auxiliaryViewHandler:^id<YBIBAuxiliaryViewHandler>{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return nil;\n            return self.auxiliaryViewHandler;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_webImageMediator:)]) {\n        [obj setYb_webImageMediator:^id<YBIBWebImageMediator> {\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return nil;\n            NSAssert(self.webImageMediator, @\"'webImageMediator' should not be nil.\");\n            return self.webImageMediator;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_currentPage:)]) {\n        [obj setYb_currentPage:^NSInteger{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return 0;\n            return self.currentPage;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_totalPage:)]) {\n        [obj setYb_totalPage:^NSInteger{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return 0;\n            return [self.dataMediator numberOfCells];\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_backView:)]) {\n        obj.yb_backView = self;\n    }\n    if ([obj respondsToSelector:@selector(setYb_containerView:)]) {\n        obj.yb_containerView = self.containerView;\n    }\n    if ([obj respondsToSelector:@selector(setYb_collectionView:)]) {\n        [obj setYb_collectionView:^__kindof UICollectionView *{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return nil;\n            return self.collectionView;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_cellIsInCenter:)]) {\n        [obj setYb_cellIsInCenter:^BOOL{\n            __strong typeof(wSelf) self = wSelf;\n            CGFloat pageF = self.collectionView.contentOffset.x / self.collectionView.bounds.size.width;\n            // '0.001' is admissible error.\n            return ABS(pageF - (NSInteger)pageF) <= 0.001;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_isTransitioning:)]) {\n        [obj setYb_isTransitioning:^BOOL{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return NO;\n            return self.isTransitioning;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_isShowTransitioning:)]) {\n        [obj setYb_isShowTransitioning:^BOOL{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return NO;\n            return self.isShowTransitioning;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_isHideTransitioning:)]) {\n        [obj setYb_isHideTransitioning:^BOOL{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return NO;\n            return self.isHideTransitioning;\n        }];\n    }\n    if ([obj respondsToSelector:@selector(setYb_isRotating:)]) {\n        [obj setYb_isRotating:^BOOL{\n            __strong typeof(wSelf) self = wSelf;\n            if (!self) return NO;\n            return self.rotationHandler.isRotating;\n        }];\n    }\n}\n\n#pragma mark - <UICollectionViewDataSource>\n\n- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {\n    return [self.dataMediator numberOfCells];\n}\n\n- (UICollectionViewCell *)collectionView:(YBIBCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {\n    id<YBIBDataProtocol> data = [self.dataMediator dataForCellAtIndex:indexPath.row];\n    \n    UICollectionViewCell<YBIBCellProtocol> *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[collectionView reuseIdentifierForCellClass:data.yb_classOfCell] forIndexPath:indexPath];\n    \n    [self implementGetBaseInfoProtocol:cell];\n    [self implementOperateBrowserProtocol:cell];\n    \n    if ([cell respondsToSelector:@selector(setYb_selfPage:)]) {\n        [cell setYb_selfPage:^NSInteger{\n            return indexPath.row;\n        }];\n    }\n    \n    cell.yb_cellData = data;\n    \n    if ([cell respondsToSelector:@selector(yb_pageChanged)]) {\n        [cell yb_pageChanged];\n    }\n    \n    [self.dataMediator preloadWithPage:indexPath.row];\n    \n    return cell;\n}\n\n#pragma mark - <UICollectionViewDelegate>\n\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n    CGFloat pageF = scrollView.contentOffset.x / scrollView.bounds.size.width;\n    NSInteger page = (NSInteger)(pageF + 0.5);\n    \n    for (id<YBIBToolViewHandler> handler in self.toolViewHandlers) {\n        if ([handler respondsToSelector:@selector(yb_offsetXChanged:)]) {\n            [handler yb_offsetXChanged:pageF];\n        }\n    }\n    \n    if (!scrollView.isDecelerating && !scrollView.isDragging) {\n        // Return if not scrolled by finger.\n        return;\n    }\n    if (page < 0 || page > [self.dataMediator numberOfCells] - 1) return;\n    if (self.rotationHandler.isRotating) return;\n    \n    if (page != _currentPage) {\n        _currentPage = page;\n        [self pageNumberChanged];\n    }\n}\n\n#pragma mark - event\n\n- (void)respondsToLongPress:(UILongPressGestureRecognizer *)sender {\n    if (sender.state == UIGestureRecognizerStateBegan) {\n        if ([self.delegate respondsToSelector:@selector(yb_imageBrowser:respondsToLongPressWithData:)]) {\n            [self.delegate yb_imageBrowser:self respondsToLongPressWithData:[self currentData]];\n        } else {\n            for (id<YBIBToolViewHandler> handler in self.toolViewHandlers) {\n                if ([handler respondsToSelector:@selector(yb_respondsToLongPress)]) {\n                    [handler yb_respondsToLongPress];\n                }\n            }\n        }\n    }\n}\n\n#pragma mark - getters & setters\n\n- (YBIBContainerView *)containerView {\n    if (!_containerView) {\n        _containerView = [YBIBContainerView new];\n        _containerView.backgroundColor = UIColor.clearColor;\n        _containerView.layer.masksToBounds = YES;\n    }\n    return _containerView;\n}\n\n- (YBIBCollectionView *)collectionView {\n    if (!_collectionView) {\n        _collectionView = [YBIBCollectionView new];\n        _collectionView.delegate = self;\n        _collectionView.dataSource = self;\n    }\n    return _collectionView;\n}\n- (void)setCurrentPage:(NSInteger)currentPage {\n    NSInteger maxPage = self.dataMediator.numberOfCells - 1;\n    if (currentPage > maxPage) {\n        currentPage = maxPage;\n    }\n    _currentPage = currentPage;\n    if (self.collectionView.superview) {\n        [self collectionViewScrollToPage:currentPage];\n    }\n}\n- (void)setDistanceBetweenPages:(CGFloat)distanceBetweenPages {\n    self.collectionView.layout.distanceBetweenPages = distanceBetweenPages;\n}\n- (CGFloat)distanceBetweenPages {\n    return self.collectionView.layout.distanceBetweenPages;\n}\n\n- (void)setTransitioning:(BOOL)transitioning isShow:(BOOL)isShow {\n    _transitioning = transitioning;\n    _showTransitioning = transitioning && isShow;\n    _hideTransitioning = transitioning && !isShow;\n    \n    // Make 'self.userInteractionEnabled' always 'YES' to block external interaction.\n    self.containerView.userInteractionEnabled = !transitioning;\n    self.collectionView.userInteractionEnabled = !transitioning;\n    \n    if (transitioning) {\n        if ([self.delegate respondsToSelector:@selector(yb_imageBrowser:beginTransitioningWithIsShow:)]) {\n            [self.delegate yb_imageBrowser:self beginTransitioningWithIsShow:isShow];\n        }\n    } else {\n        if ([self.delegate respondsToSelector:@selector(yb_imageBrowser:endTransitioningWithIsShow:)]) {\n            [self.delegate yb_imageBrowser:self endTransitioningWithIsShow:isShow];\n        }\n    }\n}\n\n- (YBIBDataMediator *)dataMediator {\n    if (!_dataMediator) {\n        _dataMediator = [[YBIBDataMediator alloc] initWithBrowser:self];\n        _dataMediator.dataCacheCountLimit = YBIBLowMemory() ? 9 : 27;\n        _dataMediator.preloadCount = YBIBLowMemory() ? 0 : 2;\n    }\n    return _dataMediator;\n}\n- (void)setPreloadCount:(NSUInteger)preloadCount {\n    self.dataMediator.preloadCount = preloadCount;\n}\n- (NSUInteger)preloadCount {\n    return self.dataMediator.preloadCount;\n}\n\n- (YBIBScreenRotationHandler *)rotationHandler {\n    if (!_rotationHandler) {\n        _rotationHandler = [[YBIBScreenRotationHandler alloc] initWithBrowser:self];\n    }\n    return _rotationHandler;\n}\n- (void)setSupportedOrientations:(UIInterfaceOrientationMask)supportedOrientations {\n    self.rotationHandler.supportedOrientations = supportedOrientations;\n}\n- (UIInterfaceOrientationMask)supportedOrientations {\n    return self.rotationHandler.supportedOrientations;\n}\n- (UIDeviceOrientation)currentOrientation {\n    return self.rotationHandler.currentOrientation;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YBImageBrowser.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t08BCFE4358F120359B4C3DC5F9EBD465 /* YBIBContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = F310046B77B247E25EDAA0E5550831C9 /* YBIBContainerView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t10C003F8BB9E1831B8730B021B974BB1 /* YBIBIconManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C6B6FB34774BB4D1D77832DAB1138613 /* YBIBIconManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t10F674D02DF64E9ED71A1598EB723257 /* YBIBGetBaseInfoProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = B1B5DB2D7313C542A555E291C0522A66 /* YBIBGetBaseInfoProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t12877E95506273E8155FD570BE5EDE09 /* YBIBVideoTopBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 11C64268EEFEE7C51225486E6B752EE1 /* YBIBVideoTopBar.m */; };\n\t\t1666807F899C911A1BB314885B921DDF /* YBImageBrowserDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = D86F7A83026F65646CFDB6E7645DF2CE /* YBImageBrowserDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t16D0389E4F8A44B14BF54D5D89E8D149 /* YBImageBrowser-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B7F29141FB21B3B8A01B60BC98C6CCD /* YBImageBrowser-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1979886EB585010993206B40B3A41B13 /* YBIBVideoData.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DAC533CA8081C9E3A2909A65C3416D0 /* YBIBVideoData.m */; };\n\t\t199483B0216C9911C53ABF40604662BF /* YBIBVideoView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CD9182299522FF2A27303D8CA3782A8 /* YBIBVideoView.m */; };\n\t\t1C1FD335C29F013AB59737AC0D7F4830 /* YBIBScreenRotationHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FD64FB5A78B529A96A8F5C9157E6F1 /* YBIBScreenRotationHandler.m */; };\n\t\t1FC2AB93742D495BEFB93DA446888706 /* YBIBCopywriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 22A8C524B7368D345FFEE8814F72D3BD /* YBIBCopywriter.m */; };\n\t\t23B7BEF127F5AF765B865295A15CCC9E /* YBIBIconManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DF316B0B1EBE1DBADD561C96309B9F9D /* YBIBIconManager.m */; };\n\t\t2767319B2DA4A6F461CCEC8DE8E8BC21 /* YBIBLoadingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9239ADE2B1D38EABE49850C45EDE8974 /* YBIBLoadingView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2A9BC1A04BE3FF95D1AAFA63C6AF41BF /* YBIBCellProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 255EB0CF73733CB8759A3F82305DF1E8 /* YBIBCellProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2F60E9AF091B5EC998A4665AB4CB6CD8 /* YBIBToastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F9BA4DAF23D949C05897B1783154480 /* YBIBToastView.m */; };\n\t\t2FCFEF9ABEAEDFE3AE7BAB4F99BDE260 /* YBIBPhotoAlbumManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BAE6C3FB835E699FD485361D48AB9DB /* YBIBPhotoAlbumManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t303CA039039109497506EF726D3114B5 /* YBIBVideoActionBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B794B9C30FB7B7D1185F0BC9503AE6A /* YBIBVideoActionBar.m */; };\n\t\t30EDD42E07C0831D1B36DACA3E21D7F3 /* YBIBLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = EC8D8E3C2A07B20728093D40BB937666 /* YBIBLoadingView.m */; };\n\t\t3181A0D6C761BC7F402B7619DE69D47A /* YBImageBrowser+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FFA25657FEA14753650320848281AC /* YBImageBrowser+Internal.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3572B0A453ACA982E7A8F31D3C2B9706 /* YBIBToolViewHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 21DD63151E1CF12CD7AE771C28DB3744 /* YBIBToolViewHandler.m */; };\n\t\t39F8E7111F233485B6F8781F3DB79F40 /* YBImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 687658C90F2632BB7DCE508633C050A2 /* YBImage.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3AE3E02525E6D5D8627B8FAE1F89E7BC /* YBImageBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 978976D87893386B5E716C8D949F2FD7 /* YBImageBrowser.m */; };\n\t\t3C7452F5B207155E3B47FF9189FC0EED /* YBImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 778FB59000C58F9376C8C93A6F69DC01 /* YBImage.m */; };\n\t\t420C1E74DB4277AF5C4469FBB79248DE /* YBIBImageCell+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C3F0C55437723C7833AF52521CE7349 /* YBIBImageCell+Internal.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4473FD5D946708037C0EC60512BC7AE3 /* YBIBSentinel.h in Headers */ = {isa = PBXBuildFile; fileRef = BA607E09913BA17E905FB245F0CE540A /* YBIBSentinel.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t44D7413CFB8D556A1FBDF9B422B7A70A /* YBIBAnimatedTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = E432293CCD275006254B7D323D502DB9 /* YBIBAnimatedTransition.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t48B7C3D4C676BAF0B5447B85C43EDB10 /* YBIBCollectionViewLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = E53F5C8E869152FFE0DA2EB6D901365F /* YBIBCollectionViewLayout.m */; };\n\t\t4B512FCC6F35C44DDD5EE067E26F1876 /* YBIBAuxiliaryViewHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B162D2C8691F932DB6D0104C530AE4C /* YBIBAuxiliaryViewHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4D2EFE20E6C9E4D9A8E1D69B6A2EF88A /* YBIBImageData+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B92B62F838CD34C7C1E5557FDC82E9A /* YBIBImageData+Internal.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t50CA2116DCB9112063173CFF3458C35B /* YBIBSentinel.m in Sources */ = {isa = PBXBuildFile; fileRef = F5D111A2771E857223CBB5401F6C94D3 /* YBIBSentinel.m */; };\n\t\t51B817C8B575B3D8416070FAC6EDF097 /* YBIBVideoTopBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 92B93411959213419239C65216073F9C /* YBIBVideoTopBar.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t51B8207D70623B01EE6D3CC966AAB692 /* YBIBOrientationReceiveProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D07E09D49E8432A6CC5ED85CDCA9596D /* YBIBOrientationReceiveProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5305CE5D25FD72C0BB8A19680EED64B6 /* YBIBSheetView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BED73104079F0896B99F2FDCBCA22CB /* YBIBSheetView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t56B40D4BDA1929ECB99A1109B966E906 /* YBIBImageCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 75A2CC6DF537803B1CEE58559EFB9EA9 /* YBIBImageCell.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t57B61F3C8B0B1C4279CE467DD9C5CBFF /* YBIBImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DCD959D83E2E32264B68F605980CF64 /* YBIBImageCache.m */; };\n\t\t5AA96B04DFB70148F9E382240C58C8A7 /* YBIBImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A8AF520C6584CDD00FC2D1D728B0B44 /* YBIBImageData.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t5B5D7F7D5F9080C56E999EA5303E30E2 /* YBIBContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CBFBAD1E4C1010A1C0F9A8225B49F23 /* YBIBContainerView.m */; };\n\t\t5EB381385B04D2E8CAD7BAC2D7F56C36 /* YBIBDataMediator.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BB27721F28427C33732D25ABDF93104 /* YBIBDataMediator.m */; };\n\t\t60DD809C74CEDB1AE27D4499496B4113 /* YBIBVideoView.h in Headers */ = {isa = PBXBuildFile; fileRef = 22AD2EE342F17F06CA9C261FB1931872 /* YBIBVideoView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t6144CF91B8050C58269650433D0CA1E0 /* YBIBVideoCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E95935D9E4E91308A4AA077E60884FD /* YBIBVideoCell.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t671E9D7E346CA2B7F439A270FB562D12 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 99930DDFB09D249A47F15A0649834E7C /* Foundation.framework */; };\n\t\t6FEAB822FA08D05F79AFE5520E6CB685 /* YBImageBrowserDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E9ABD94320318FEEA03DD8CB1CB4C166 /* YBImageBrowserDataSource.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t81447937EE39A2692578E4D05D8A6BCB /* YBIBImageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C4DB74E0EFBA1CB8D55F9A1D71255AAE /* YBIBImageCell.m */; };\n\t\t83E9F25D64CBE3CC19CC6A703A83652D /* YBIBDataProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 8515BDB822AB60165F9DBD842ABF91D6 /* YBIBDataProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t84A907321617A873C70297F101A5EBC4 /* YBIBVideoData.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C6F079870BB21F74F84B3BC4AD37D57 /* YBIBVideoData.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8B051FEDEC57BE24ED27D2E1A74C32A7 /* YBIBToolViewHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C38AE4781969F67E0A7F0DD35F92DE2 /* YBIBToolViewHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8D340A6C76AE5288E14D3EF5421EEA98 /* YBImageBrowser-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = F9D7F20869B0B5F249DBA7D6CD7458F6 /* YBImageBrowser-dummy.m */; };\n\t\t90C7FF35711B4C8F1D37FA6EF04BD931 /* YBIBInteractionProfile.m in Sources */ = {isa = PBXBuildFile; fileRef = FE713C9F70395C2FD3743A463A60E415 /* YBIBInteractionProfile.m */; };\n\t\t90CB81BC5BA3CF65B78A5526C537D83D /* YBIBCopywriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CBA7F4747ADF8B3EBCD6AFB23212FDF /* YBIBCopywriter.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t936E449577B193D29D7519128FE97B82 /* YBIBImageScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 95EBE51BDE2B59508C63EB452E7956BE /* YBIBImageScrollView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t93B0BD42232680450B737397BC375F77 /* YBIBDefaultWebImageMediator.m in Sources */ = {isa = PBXBuildFile; fileRef = B0FA6ADFD1B0D5ACF98792C77B065B52 /* YBIBDefaultWebImageMediator.m */; };\n\t\t94EFC24926D19F92EDC4F9A75A5B5DEC /* YBIBCollectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = BF3CBDD303F29308EFB7C474F312FE8D /* YBIBCollectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t976B5684F81F8C557FA7EE8EA7F3000E /* YBIBScreenRotationHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = C8CB8CB8E638EC20B36CCF9C2171067B /* YBIBScreenRotationHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t996549D4F24FB0C5A480EC6C4C3EE944 /* YBIBWebImageMediator.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B09362988362834F1FFD7C8B5944C30 /* YBIBWebImageMediator.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t997E068A10973B3934699D51E73E5D51 /* YBIBCollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = C116A1E244D662F47035C678031D01A5 /* YBIBCollectionView.m */; };\n\t\t9E0933C8F1F99270AB7EB229EE9F8840 /* YBIBAuxiliaryViewHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = FED0CA9D6F890173A4CBD29C2CE2C162 /* YBIBAuxiliaryViewHandler.m */; };\n\t\tA37DF0968A30C298A281CDCAE17E0C20 /* YBIBUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 211000BFCB7EACB2EB04F1E0548A942A /* YBIBUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tAFE47A7976F14408749E2F8D2BE64947 /* YBImageBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8FBAA9DB673482CC8916220D24D0D50E /* YBImageBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB1BF6E7D6BB024555DA57962DC8A9656 /* YBIBImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 07622446C2467D6DF2E8BCA910B5C6BA /* YBIBImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB6D5DA3B39CD8F78EE82012D6AA60D4F /* YBImageBrowserVideo.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E6195F965DCA547A468E09A4BC799E1B /* YBImageBrowserVideo.bundle */; };\n\t\tB98EF74C060813AB4ED08B856559A163 /* YBIBImageCache+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = EBC5052BDCD35247CC62901811EAC925 /* YBIBImageCache+Internal.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tBE10885059C49AB7BFED5F0C4FC43637 /* YBIBDefaultWebImageMediator.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CA397C4E1C505CA935CE05F67E86330 /* YBIBDefaultWebImageMediator.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tC17193FF6310CE1C300C35E335731583 /* YBIBVideoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 52BC3939D5AE47AA31C149A187161C2E /* YBIBVideoCell.m */; };\n\t\tC883EA7D021CFF1D5966BE91D93CABE6 /* NSObject+YBImageBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 638E23546DFCDB320E9FF87698C8A68D /* NSObject+YBImageBrowser.m */; };\n\t\tC999571B9384428CBE63A893305CA1C7 /* YBIBVideoCell+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = D47F1170390DBA6A3260F1D1CD67B0A5 /* YBIBVideoCell+Internal.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCA475F571FC4BFB610843C6C48C385AD /* YBIBToastView.h in Headers */ = {isa = PBXBuildFile; fileRef = B1A4EF627C537429FB09C7E9A9E95338 /* YBIBToastView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCA5A46D4448C773C42A91B5AE37DFCF3 /* YBIBImageLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C0EB509CD479040D6F9FEC3476EB5D8 /* YBIBImageLayout.m */; };\n\t\tCD9A01BF7B157253E7D0B2AC02DCDB14 /* YBIBCollectionViewLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 54A4BDEAA27DC4BDDE54691B50358254 /* YBIBCollectionViewLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD1853EF7974857B79F0290CC06D269B2 /* YBIBImageData.m in Sources */ = {isa = PBXBuildFile; fileRef = 93EEC27975993B0B76016EF8F21CCDCA /* YBIBImageData.m */; };\n\t\tD4F8FFD26F6736033E47996CA231FDCB /* YBImageBrowser.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 9AF2DA9B8B7A45C74BAE7DCA29BBE7EF /* YBImageBrowser.bundle */; };\n\t\tDBCDD4928CA072405CAC44464163AA30 /* NSObject+YBImageBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = 88194304808F9BD3DDFD60B84C2556DA /* NSObject+YBImageBrowser.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDC7440264A8EE646F1326FD9BF671593 /* YBIBImageScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8AA41EFB44E416008B49D8897663B44 /* YBIBImageScrollView.m */; };\n\t\tDE7801C45C5E7C8DF1EAFDFB1048A9C9 /* YBIBTopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D13406F90A3D4B57CD6226E8A5C737C /* YBIBTopView.m */; };\n\t\tDFE094E97F6FF91ABEA773031C15734A /* YBIBOperateBrowserProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = A5B916C88DDC7948DBFA5708959A11E0 /* YBIBOperateBrowserProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tDFE8E82906794741D9231BF6F71F3946 /* YBIBUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 4058C9E6799A134BB3AB12D09FC1E095 /* YBIBUtilities.m */; };\n\t\tE3C831282125182FE0FE5E9F83D06582 /* YBIBTopView.h in Headers */ = {isa = PBXBuildFile; fileRef = D1048A027C4FBCF9152464AEF0A42DF9 /* YBIBTopView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE6C4C50C9C28E3E831001D4E6617E69B /* YBIBAnimatedTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = D52F2FA9B73DFDE39486B238083386C7 /* YBIBAnimatedTransition.m */; };\n\t\tEB7616F43ECEDB1E1ED63CFBA01F6CE8 /* YBIBSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 70311C07C338D15C10359367D124DCB2 /* YBIBSheetView.m */; };\n\t\tEBFB805D356EDFCC85CF0D907D943664 /* YBIBInteractionProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = D14A9C7F2891942F3D3737FF83289C40 /* YBIBInteractionProfile.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF2B4BCB49E65E2ADF3C18994A1EE2A00 /* YBIBVideoData+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = B014095D4652584837E7883E5F0BB566 /* YBIBVideoData+Internal.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF76E9C11FE9D8616F844D0D92C7D8B8B /* YBIBVideoActionBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 20EC611A00FD426ED609458C973B76AB /* YBIBVideoActionBar.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF815B20B1A1F064FAC7497C17DE136F7 /* YBIBImageLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B97B3628E3C7BC7D5BDCA0EF15C670 /* YBIBImageLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF82E74EEAEB24128797F7625F2045F68 /* YBIBPhotoAlbumManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 661ECF1C82D7AFBCD4507E2D36441844 /* YBIBPhotoAlbumManager.m */; };\n\t\tFF796B87DC375EE79823F9C8FAEAEA1B /* YBIBDataMediator.h in Headers */ = {isa = PBXBuildFile; fileRef = 073F235A7429AD9A8364D4262FB3617F /* YBIBDataMediator.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t3EB472E2FC678529EE53D6B9A1630099 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 959804ACDF80A313975CE84559E6F86B /* YYImage.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 79A687989E871964747CED931C10657C;\n\t\t\tremoteInfo = YYImage;\n\t\t};\n\t\tD43DEF07CBD6EF072BF133057FAB88AF /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 956391E2D1DBF99A84861C798AA9000B /* SDWebImage.xcodeproj */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 4ECF4E662EEBE4FA58102FF984D920CC;\n\t\t\tremoteInfo = SDWebImage;\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t04B97B3628E3C7BC7D5BDCA0EF15C670 /* YBIBImageLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBImageLayout.h; path = YBImageBrowser/Image/YBIBImageLayout.h; sourceTree = \"<group>\"; };\n\t\t073F235A7429AD9A8364D4262FB3617F /* YBIBDataMediator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBDataMediator.h; path = YBImageBrowser/Base/YBIBDataMediator.h; sourceTree = \"<group>\"; };\n\t\t07622446C2467D6DF2E8BCA910B5C6BA /* YBIBImageCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBImageCache.h; path = YBImageBrowser/Image/YBIBImageCache.h; sourceTree = \"<group>\"; };\n\t\t0BAE6C3FB835E699FD485361D48AB9DB /* YBIBPhotoAlbumManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBPhotoAlbumManager.h; path = YBImageBrowser/Helper/YBIBPhotoAlbumManager.h; sourceTree = \"<group>\"; };\n\t\t1104C0B49501191A6BAEADE29D64504A /* YBImageBrowser-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"YBImageBrowser-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t11C64268EEFEE7C51225486E6B752EE1 /* YBIBVideoTopBar.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBVideoTopBar.m; path = Video/YBIBVideoTopBar.m; sourceTree = \"<group>\"; };\n\t\t1CBFBAD1E4C1010A1C0F9A8225B49F23 /* YBIBContainerView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBContainerView.m; path = YBImageBrowser/Base/YBIBContainerView.m; sourceTree = \"<group>\"; };\n\t\t1DCD959D83E2E32264B68F605980CF64 /* YBIBImageCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBImageCache.m; path = YBImageBrowser/Image/YBIBImageCache.m; sourceTree = \"<group>\"; };\n\t\t20EC611A00FD426ED609458C973B76AB /* YBIBVideoActionBar.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBVideoActionBar.h; path = Video/YBIBVideoActionBar.h; sourceTree = \"<group>\"; };\n\t\t211000BFCB7EACB2EB04F1E0548A942A /* YBIBUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBUtilities.h; path = YBImageBrowser/Helper/YBIBUtilities.h; sourceTree = \"<group>\"; };\n\t\t21DD63151E1CF12CD7AE771C28DB3744 /* YBIBToolViewHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBToolViewHandler.m; path = YBImageBrowser/ToolView/YBIBToolViewHandler.m; sourceTree = \"<group>\"; };\n\t\t22A8C524B7368D345FFEE8814F72D3BD /* YBIBCopywriter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBCopywriter.m; path = YBImageBrowser/Helper/YBIBCopywriter.m; sourceTree = \"<group>\"; };\n\t\t22AD2EE342F17F06CA9C261FB1931872 /* YBIBVideoView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBVideoView.h; path = Video/YBIBVideoView.h; sourceTree = \"<group>\"; };\n\t\t23FD64FB5A78B529A96A8F5C9157E6F1 /* YBIBScreenRotationHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBScreenRotationHandler.m; path = YBImageBrowser/Base/YBIBScreenRotationHandler.m; sourceTree = \"<group>\"; };\n\t\t255EB0CF73733CB8759A3F82305DF1E8 /* YBIBCellProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBCellProtocol.h; path = YBImageBrowser/Protocol/YBIBCellProtocol.h; sourceTree = \"<group>\"; };\n\t\t3CD9182299522FF2A27303D8CA3782A8 /* YBIBVideoView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBVideoView.m; path = Video/YBIBVideoView.m; sourceTree = \"<group>\"; };\n\t\t3DAC533CA8081C9E3A2909A65C3416D0 /* YBIBVideoData.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBVideoData.m; path = Video/YBIBVideoData.m; sourceTree = \"<group>\"; };\n\t\t3E95935D9E4E91308A4AA077E60884FD /* YBIBVideoCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBVideoCell.h; path = Video/YBIBVideoCell.h; sourceTree = \"<group>\"; };\n\t\t4058C9E6799A134BB3AB12D09FC1E095 /* YBIBUtilities.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBUtilities.m; path = YBImageBrowser/Helper/YBIBUtilities.m; sourceTree = \"<group>\"; };\n\t\t45FFA25657FEA14753650320848281AC /* YBImageBrowser+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"YBImageBrowser+Internal.h\"; path = \"YBImageBrowser/Base/YBImageBrowser+Internal.h\"; sourceTree = \"<group>\"; };\n\t\t4C38AE4781969F67E0A7F0DD35F92DE2 /* YBIBToolViewHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBToolViewHandler.h; path = YBImageBrowser/ToolView/YBIBToolViewHandler.h; sourceTree = \"<group>\"; };\n\t\t52BC3939D5AE47AA31C149A187161C2E /* YBIBVideoCell.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBVideoCell.m; path = Video/YBIBVideoCell.m; sourceTree = \"<group>\"; };\n\t\t54A4BDEAA27DC4BDDE54691B50358254 /* YBIBCollectionViewLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBCollectionViewLayout.h; path = YBImageBrowser/Base/YBIBCollectionViewLayout.h; sourceTree = \"<group>\"; };\n\t\t5B7F29141FB21B3B8A01B60BC98C6CCD /* YBImageBrowser-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"YBImageBrowser-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\t638E23546DFCDB320E9FF87698C8A68D /* NSObject+YBImageBrowser.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSObject+YBImageBrowser.m\"; path = \"YBImageBrowser/Base/NSObject+YBImageBrowser.m\"; sourceTree = \"<group>\"; };\n\t\t661ECF1C82D7AFBCD4507E2D36441844 /* YBIBPhotoAlbumManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBPhotoAlbumManager.m; path = YBImageBrowser/Helper/YBIBPhotoAlbumManager.m; sourceTree = \"<group>\"; };\n\t\t687658C90F2632BB7DCE508633C050A2 /* YBImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBImage.h; path = YBImageBrowser/Image/YBImage.h; sourceTree = \"<group>\"; };\n\t\t6B162D2C8691F932DB6D0104C530AE4C /* YBIBAuxiliaryViewHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBAuxiliaryViewHandler.h; path = YBImageBrowser/AuxiliaryView/YBIBAuxiliaryViewHandler.h; sourceTree = \"<group>\"; };\n\t\t6BED73104079F0896B99F2FDCBCA22CB /* YBIBSheetView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBSheetView.h; path = YBImageBrowser/ToolView/YBIBSheetView.h; sourceTree = \"<group>\"; };\n\t\t70311C07C338D15C10359367D124DCB2 /* YBIBSheetView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBSheetView.m; path = YBImageBrowser/ToolView/YBIBSheetView.m; sourceTree = \"<group>\"; };\n\t\t719A61DCD1BD7846C810702836B7F69E /* YBImageBrowser.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = YBImageBrowser.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t727FBA64C7C9DD98A5F2AA0A8E3D16AE /* YBImageBrowser */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = YBImageBrowser; path = YBImageBrowser.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t75A2CC6DF537803B1CEE58559EFB9EA9 /* YBIBImageCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBImageCell.h; path = YBImageBrowser/Image/YBIBImageCell.h; sourceTree = \"<group>\"; };\n\t\t778FB59000C58F9376C8C93A6F69DC01 /* YBImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBImage.m; path = YBImageBrowser/Image/YBImage.m; sourceTree = \"<group>\"; };\n\t\t7A5C726EF414169F7EE75F8EA9D9CC16 /* YBImageBrowser.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = YBImageBrowser.modulemap; sourceTree = \"<group>\"; };\n\t\t7CA397C4E1C505CA935CE05F67E86330 /* YBIBDefaultWebImageMediator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBDefaultWebImageMediator.h; path = YBImageBrowser/WebImageMediator/YBIBDefaultWebImageMediator.h; sourceTree = \"<group>\"; };\n\t\t7D13406F90A3D4B57CD6226E8A5C737C /* YBIBTopView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBTopView.m; path = YBImageBrowser/ToolView/YBIBTopView.m; sourceTree = \"<group>\"; };\n\t\t8515BDB822AB60165F9DBD842ABF91D6 /* YBIBDataProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBDataProtocol.h; path = YBImageBrowser/Protocol/YBIBDataProtocol.h; sourceTree = \"<group>\"; };\n\t\t88194304808F9BD3DDFD60B84C2556DA /* NSObject+YBImageBrowser.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSObject+YBImageBrowser.h\"; path = \"YBImageBrowser/Base/NSObject+YBImageBrowser.h\"; sourceTree = \"<group>\"; };\n\t\t8A8AF520C6584CDD00FC2D1D728B0B44 /* YBIBImageData.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBImageData.h; path = YBImageBrowser/Image/YBIBImageData.h; sourceTree = \"<group>\"; };\n\t\t8B09362988362834F1FFD7C8B5944C30 /* YBIBWebImageMediator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBWebImageMediator.h; path = YBImageBrowser/WebImageMediator/YBIBWebImageMediator.h; sourceTree = \"<group>\"; };\n\t\t8B794B9C30FB7B7D1185F0BC9503AE6A /* YBIBVideoActionBar.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBVideoActionBar.m; path = Video/YBIBVideoActionBar.m; sourceTree = \"<group>\"; };\n\t\t8C3F0C55437723C7833AF52521CE7349 /* YBIBImageCell+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"YBIBImageCell+Internal.h\"; path = \"YBImageBrowser/Image/YBIBImageCell+Internal.h\"; sourceTree = \"<group>\"; };\n\t\t8C6F079870BB21F74F84B3BC4AD37D57 /* YBIBVideoData.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBVideoData.h; path = Video/YBIBVideoData.h; sourceTree = \"<group>\"; };\n\t\t8CBA7F4747ADF8B3EBCD6AFB23212FDF /* YBIBCopywriter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBCopywriter.h; path = YBImageBrowser/Helper/YBIBCopywriter.h; sourceTree = \"<group>\"; };\n\t\t8FBAA9DB673482CC8916220D24D0D50E /* YBImageBrowser.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBImageBrowser.h; path = YBImageBrowser/YBImageBrowser.h; sourceTree = \"<group>\"; };\n\t\t9239ADE2B1D38EABE49850C45EDE8974 /* YBIBLoadingView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBLoadingView.h; path = YBImageBrowser/AuxiliaryView/YBIBLoadingView.h; sourceTree = \"<group>\"; };\n\t\t92B93411959213419239C65216073F9C /* YBIBVideoTopBar.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBVideoTopBar.h; path = Video/YBIBVideoTopBar.h; sourceTree = \"<group>\"; };\n\t\t93EEC27975993B0B76016EF8F21CCDCA /* YBIBImageData.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBImageData.m; path = YBImageBrowser/Image/YBIBImageData.m; sourceTree = \"<group>\"; };\n\t\t956391E2D1DBF99A84861C798AA9000B /* SDWebImage */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = SDWebImage; path = SDWebImage.xcodeproj; sourceTree = \"<group>\"; };\n\t\t959804ACDF80A313975CE84559E6F86B /* YYImage */ = {isa = PBXFileReference; lastKnownFileType = \"wrapper.pb-project\"; name = YYImage; path = YYImage.xcodeproj; sourceTree = \"<group>\"; };\n\t\t95EBE51BDE2B59508C63EB452E7956BE /* YBIBImageScrollView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBImageScrollView.h; path = YBImageBrowser/Image/YBIBImageScrollView.h; sourceTree = \"<group>\"; };\n\t\t978976D87893386B5E716C8D949F2FD7 /* YBImageBrowser.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBImageBrowser.m; path = YBImageBrowser/YBImageBrowser.m; sourceTree = \"<group>\"; };\n\t\t99930DDFB09D249A47F15A0649834E7C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t9AF2DA9B8B7A45C74BAE7DCA29BBE7EF /* YBImageBrowser.bundle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = \"wrapper.plug-in\"; name = YBImageBrowser.bundle; path = YBImageBrowser/YBImageBrowser.bundle; sourceTree = \"<group>\"; };\n\t\t9B92B62F838CD34C7C1E5557FDC82E9A /* YBIBImageData+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"YBIBImageData+Internal.h\"; path = \"YBImageBrowser/Image/YBIBImageData+Internal.h\"; sourceTree = \"<group>\"; };\n\t\t9BB27721F28427C33732D25ABDF93104 /* YBIBDataMediator.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBDataMediator.m; path = YBImageBrowser/Base/YBIBDataMediator.m; sourceTree = \"<group>\"; };\n\t\t9C0EB509CD479040D6F9FEC3476EB5D8 /* YBIBImageLayout.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBImageLayout.m; path = YBImageBrowser/Image/YBIBImageLayout.m; sourceTree = \"<group>\"; };\n\t\t9F9BA4DAF23D949C05897B1783154480 /* YBIBToastView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBToastView.m; path = YBImageBrowser/AuxiliaryView/YBIBToastView.m; sourceTree = \"<group>\"; };\n\t\tA5B916C88DDC7948DBFA5708959A11E0 /* YBIBOperateBrowserProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBOperateBrowserProtocol.h; path = YBImageBrowser/Protocol/YBIBOperateBrowserProtocol.h; sourceTree = \"<group>\"; };\n\t\tA8AA41EFB44E416008B49D8897663B44 /* YBIBImageScrollView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBImageScrollView.m; path = YBImageBrowser/Image/YBIBImageScrollView.m; sourceTree = \"<group>\"; };\n\t\tACD6E18FB04E61BB9E0E2C1F733ECC82 /* YBImageBrowser-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"YBImageBrowser-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tB014095D4652584837E7883E5F0BB566 /* YBIBVideoData+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"YBIBVideoData+Internal.h\"; path = \"Video/YBIBVideoData+Internal.h\"; sourceTree = \"<group>\"; };\n\t\tB0FA6ADFD1B0D5ACF98792C77B065B52 /* YBIBDefaultWebImageMediator.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBDefaultWebImageMediator.m; path = YBImageBrowser/WebImageMediator/YBIBDefaultWebImageMediator.m; sourceTree = \"<group>\"; };\n\t\tB1A4EF627C537429FB09C7E9A9E95338 /* YBIBToastView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBToastView.h; path = YBImageBrowser/AuxiliaryView/YBIBToastView.h; sourceTree = \"<group>\"; };\n\t\tB1B5DB2D7313C542A555E291C0522A66 /* YBIBGetBaseInfoProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBGetBaseInfoProtocol.h; path = YBImageBrowser/Protocol/YBIBGetBaseInfoProtocol.h; sourceTree = \"<group>\"; };\n\t\tBA607E09913BA17E905FB245F0CE540A /* YBIBSentinel.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBSentinel.h; path = YBImageBrowser/Helper/YBIBSentinel.h; sourceTree = \"<group>\"; };\n\t\tBF3CBDD303F29308EFB7C474F312FE8D /* YBIBCollectionView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBCollectionView.h; path = YBImageBrowser/Base/YBIBCollectionView.h; sourceTree = \"<group>\"; };\n\t\tC116A1E244D662F47035C678031D01A5 /* YBIBCollectionView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBCollectionView.m; path = YBImageBrowser/Base/YBIBCollectionView.m; sourceTree = \"<group>\"; };\n\t\tC2408E7B9F8CA89D28AAB217085C4777 /* YBImageBrowser.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = YBImageBrowser.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tC4DB74E0EFBA1CB8D55F9A1D71255AAE /* YBIBImageCell.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBImageCell.m; path = YBImageBrowser/Image/YBIBImageCell.m; sourceTree = \"<group>\"; };\n\t\tC6B6FB34774BB4D1D77832DAB1138613 /* YBIBIconManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBIconManager.h; path = YBImageBrowser/Helper/YBIBIconManager.h; sourceTree = \"<group>\"; };\n\t\tC8CB8CB8E638EC20B36CCF9C2171067B /* YBIBScreenRotationHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBScreenRotationHandler.h; path = YBImageBrowser/Base/YBIBScreenRotationHandler.h; sourceTree = \"<group>\"; };\n\t\tD07E09D49E8432A6CC5ED85CDCA9596D /* YBIBOrientationReceiveProtocol.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBOrientationReceiveProtocol.h; path = YBImageBrowser/Protocol/YBIBOrientationReceiveProtocol.h; sourceTree = \"<group>\"; };\n\t\tD1048A027C4FBCF9152464AEF0A42DF9 /* YBIBTopView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBTopView.h; path = YBImageBrowser/ToolView/YBIBTopView.h; sourceTree = \"<group>\"; };\n\t\tD14A9C7F2891942F3D3737FF83289C40 /* YBIBInteractionProfile.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBInteractionProfile.h; path = YBImageBrowser/Image/YBIBInteractionProfile.h; sourceTree = \"<group>\"; };\n\t\tD47F1170390DBA6A3260F1D1CD67B0A5 /* YBIBVideoCell+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"YBIBVideoCell+Internal.h\"; path = \"Video/YBIBVideoCell+Internal.h\"; sourceTree = \"<group>\"; };\n\t\tD52F2FA9B73DFDE39486B238083386C7 /* YBIBAnimatedTransition.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBAnimatedTransition.m; path = YBImageBrowser/Base/YBIBAnimatedTransition.m; sourceTree = \"<group>\"; };\n\t\tD86F7A83026F65646CFDB6E7645DF2CE /* YBImageBrowserDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBImageBrowserDelegate.h; path = YBImageBrowser/Protocol/YBImageBrowserDelegate.h; sourceTree = \"<group>\"; };\n\t\tDF316B0B1EBE1DBADD561C96309B9F9D /* YBIBIconManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBIconManager.m; path = YBImageBrowser/Helper/YBIBIconManager.m; sourceTree = \"<group>\"; };\n\t\tE432293CCD275006254B7D323D502DB9 /* YBIBAnimatedTransition.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBAnimatedTransition.h; path = YBImageBrowser/Base/YBIBAnimatedTransition.h; sourceTree = \"<group>\"; };\n\t\tE53F5C8E869152FFE0DA2EB6D901365F /* YBIBCollectionViewLayout.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBCollectionViewLayout.m; path = YBImageBrowser/Base/YBIBCollectionViewLayout.m; sourceTree = \"<group>\"; };\n\t\tE6195F965DCA547A468E09A4BC799E1B /* YBImageBrowserVideo.bundle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = \"wrapper.plug-in\"; name = YBImageBrowserVideo.bundle; path = Video/YBImageBrowserVideo.bundle; sourceTree = \"<group>\"; };\n\t\tE9ABD94320318FEEA03DD8CB1CB4C166 /* YBImageBrowserDataSource.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBImageBrowserDataSource.h; path = YBImageBrowser/Protocol/YBImageBrowserDataSource.h; sourceTree = \"<group>\"; };\n\t\tEBC5052BDCD35247CC62901811EAC925 /* YBIBImageCache+Internal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"YBIBImageCache+Internal.h\"; path = \"YBImageBrowser/Image/YBIBImageCache+Internal.h\"; sourceTree = \"<group>\"; };\n\t\tEC8D8E3C2A07B20728093D40BB937666 /* YBIBLoadingView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBLoadingView.m; path = YBImageBrowser/AuxiliaryView/YBIBLoadingView.m; sourceTree = \"<group>\"; };\n\t\tF310046B77B247E25EDAA0E5550831C9 /* YBIBContainerView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YBIBContainerView.h; path = YBImageBrowser/Base/YBIBContainerView.h; sourceTree = \"<group>\"; };\n\t\tF5D111A2771E857223CBB5401F6C94D3 /* YBIBSentinel.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBSentinel.m; path = YBImageBrowser/Helper/YBIBSentinel.m; sourceTree = \"<group>\"; };\n\t\tF9D7F20869B0B5F249DBA7D6CD7458F6 /* YBImageBrowser-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"YBImageBrowser-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tFE713C9F70395C2FD3743A463A60E415 /* YBIBInteractionProfile.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBInteractionProfile.m; path = YBImageBrowser/Image/YBIBInteractionProfile.m; sourceTree = \"<group>\"; };\n\t\tFED0CA9D6F890173A4CBD29C2CE2C162 /* YBIBAuxiliaryViewHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YBIBAuxiliaryViewHandler.m; path = YBImageBrowser/AuxiliaryView/YBIBAuxiliaryViewHandler.m; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\tC6EA84C4DA07CF4AC4591E1DDE7911DF /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t671E9D7E346CA2B7F439A270FB562D12 /* Foundation.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t117008FB63735F9D85C1630B80588387 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tA4E92796250927BD5070B4D7CDDF81D4 /* Dependencies */,\n\t\t\t\t8A6B07736AA805D13A2A766CA101FAA2 /* Frameworks */,\n\t\t\t\t7DCFE478FEBFDBCE822B03889F05F079 /* Products */,\n\t\t\t\t586BD81253C16FFD6FE4C6A42161079E /* YBImageBrowser */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t4C5CA69FE72E14760A96D7A203F748A6 /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t99930DDFB09D249A47F15A0649834E7C /* Foundation.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t586BD81253C16FFD6FE4C6A42161079E /* YBImageBrowser */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD2114D6E73A62D8BAB40AADDFE97862F /* Core */,\n\t\t\t\tA28BF4D5A024880AA56AE940EE6DD54C /* Support Files */,\n\t\t\t\tDA51D1A658F6E45ADBD81BABB11977ED /* Video */,\n\t\t\t);\n\t\t\tname = YBImageBrowser;\n\t\t\tpath = YBImageBrowser;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t7DCFE478FEBFDBCE822B03889F05F079 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t727FBA64C7C9DD98A5F2AA0A8E3D16AE /* YBImageBrowser */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t844DCCE42DAA23BDA8C20FDB2729D4D9 /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tE6195F965DCA547A468E09A4BC799E1B /* YBImageBrowserVideo.bundle */,\n\t\t\t);\n\t\t\tname = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8A6B07736AA805D13A2A766CA101FAA2 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t4C5CA69FE72E14760A96D7A203F748A6 /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA28BF4D5A024880AA56AE940EE6DD54C /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7A5C726EF414169F7EE75F8EA9D9CC16 /* YBImageBrowser.modulemap */,\n\t\t\t\tF9D7F20869B0B5F249DBA7D6CD7458F6 /* YBImageBrowser-dummy.m */,\n\t\t\t\t1104C0B49501191A6BAEADE29D64504A /* YBImageBrowser-Info.plist */,\n\t\t\t\tACD6E18FB04E61BB9E0E2C1F733ECC82 /* YBImageBrowser-prefix.pch */,\n\t\t\t\t5B7F29141FB21B3B8A01B60BC98C6CCD /* YBImageBrowser-umbrella.h */,\n\t\t\t\tC2408E7B9F8CA89D28AAB217085C4777 /* YBImageBrowser.debug.xcconfig */,\n\t\t\t\t719A61DCD1BD7846C810702836B7F69E /* YBImageBrowser.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/YBImageBrowser\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tA4E92796250927BD5070B4D7CDDF81D4 /* Dependencies */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t956391E2D1DBF99A84861C798AA9000B /* SDWebImage */,\n\t\t\t\t959804ACDF80A313975CE84559E6F86B /* YYImage */,\n\t\t\t);\n\t\t\tname = Dependencies;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB4BD1FA2706D8EAFE51A308AB661ACCB /* Resources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t9AF2DA9B8B7A45C74BAE7DCA29BBE7EF /* YBImageBrowser.bundle */,\n\t\t\t);\n\t\t\tname = Resources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tD2114D6E73A62D8BAB40AADDFE97862F /* Core */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t88194304808F9BD3DDFD60B84C2556DA /* NSObject+YBImageBrowser.h */,\n\t\t\t\t638E23546DFCDB320E9FF87698C8A68D /* NSObject+YBImageBrowser.m */,\n\t\t\t\tE432293CCD275006254B7D323D502DB9 /* YBIBAnimatedTransition.h */,\n\t\t\t\tD52F2FA9B73DFDE39486B238083386C7 /* YBIBAnimatedTransition.m */,\n\t\t\t\t6B162D2C8691F932DB6D0104C530AE4C /* YBIBAuxiliaryViewHandler.h */,\n\t\t\t\tFED0CA9D6F890173A4CBD29C2CE2C162 /* YBIBAuxiliaryViewHandler.m */,\n\t\t\t\t255EB0CF73733CB8759A3F82305DF1E8 /* YBIBCellProtocol.h */,\n\t\t\t\tBF3CBDD303F29308EFB7C474F312FE8D /* YBIBCollectionView.h */,\n\t\t\t\tC116A1E244D662F47035C678031D01A5 /* YBIBCollectionView.m */,\n\t\t\t\t54A4BDEAA27DC4BDDE54691B50358254 /* YBIBCollectionViewLayout.h */,\n\t\t\t\tE53F5C8E869152FFE0DA2EB6D901365F /* YBIBCollectionViewLayout.m */,\n\t\t\t\tF310046B77B247E25EDAA0E5550831C9 /* YBIBContainerView.h */,\n\t\t\t\t1CBFBAD1E4C1010A1C0F9A8225B49F23 /* YBIBContainerView.m */,\n\t\t\t\t8CBA7F4747ADF8B3EBCD6AFB23212FDF /* YBIBCopywriter.h */,\n\t\t\t\t22A8C524B7368D345FFEE8814F72D3BD /* YBIBCopywriter.m */,\n\t\t\t\t073F235A7429AD9A8364D4262FB3617F /* YBIBDataMediator.h */,\n\t\t\t\t9BB27721F28427C33732D25ABDF93104 /* YBIBDataMediator.m */,\n\t\t\t\t8515BDB822AB60165F9DBD842ABF91D6 /* YBIBDataProtocol.h */,\n\t\t\t\t7CA397C4E1C505CA935CE05F67E86330 /* YBIBDefaultWebImageMediator.h */,\n\t\t\t\tB0FA6ADFD1B0D5ACF98792C77B065B52 /* YBIBDefaultWebImageMediator.m */,\n\t\t\t\tB1B5DB2D7313C542A555E291C0522A66 /* YBIBGetBaseInfoProtocol.h */,\n\t\t\t\tC6B6FB34774BB4D1D77832DAB1138613 /* YBIBIconManager.h */,\n\t\t\t\tDF316B0B1EBE1DBADD561C96309B9F9D /* YBIBIconManager.m */,\n\t\t\t\t07622446C2467D6DF2E8BCA910B5C6BA /* YBIBImageCache.h */,\n\t\t\t\t1DCD959D83E2E32264B68F605980CF64 /* YBIBImageCache.m */,\n\t\t\t\tEBC5052BDCD35247CC62901811EAC925 /* YBIBImageCache+Internal.h */,\n\t\t\t\t75A2CC6DF537803B1CEE58559EFB9EA9 /* YBIBImageCell.h */,\n\t\t\t\tC4DB74E0EFBA1CB8D55F9A1D71255AAE /* YBIBImageCell.m */,\n\t\t\t\t8C3F0C55437723C7833AF52521CE7349 /* YBIBImageCell+Internal.h */,\n\t\t\t\t8A8AF520C6584CDD00FC2D1D728B0B44 /* YBIBImageData.h */,\n\t\t\t\t93EEC27975993B0B76016EF8F21CCDCA /* YBIBImageData.m */,\n\t\t\t\t9B92B62F838CD34C7C1E5557FDC82E9A /* YBIBImageData+Internal.h */,\n\t\t\t\t04B97B3628E3C7BC7D5BDCA0EF15C670 /* YBIBImageLayout.h */,\n\t\t\t\t9C0EB509CD479040D6F9FEC3476EB5D8 /* YBIBImageLayout.m */,\n\t\t\t\t95EBE51BDE2B59508C63EB452E7956BE /* YBIBImageScrollView.h */,\n\t\t\t\tA8AA41EFB44E416008B49D8897663B44 /* YBIBImageScrollView.m */,\n\t\t\t\tD14A9C7F2891942F3D3737FF83289C40 /* YBIBInteractionProfile.h */,\n\t\t\t\tFE713C9F70395C2FD3743A463A60E415 /* YBIBInteractionProfile.m */,\n\t\t\t\t9239ADE2B1D38EABE49850C45EDE8974 /* YBIBLoadingView.h */,\n\t\t\t\tEC8D8E3C2A07B20728093D40BB937666 /* YBIBLoadingView.m */,\n\t\t\t\tA5B916C88DDC7948DBFA5708959A11E0 /* YBIBOperateBrowserProtocol.h */,\n\t\t\t\tD07E09D49E8432A6CC5ED85CDCA9596D /* YBIBOrientationReceiveProtocol.h */,\n\t\t\t\t0BAE6C3FB835E699FD485361D48AB9DB /* YBIBPhotoAlbumManager.h */,\n\t\t\t\t661ECF1C82D7AFBCD4507E2D36441844 /* YBIBPhotoAlbumManager.m */,\n\t\t\t\tC8CB8CB8E638EC20B36CCF9C2171067B /* YBIBScreenRotationHandler.h */,\n\t\t\t\t23FD64FB5A78B529A96A8F5C9157E6F1 /* YBIBScreenRotationHandler.m */,\n\t\t\t\tBA607E09913BA17E905FB245F0CE540A /* YBIBSentinel.h */,\n\t\t\t\tF5D111A2771E857223CBB5401F6C94D3 /* YBIBSentinel.m */,\n\t\t\t\t6BED73104079F0896B99F2FDCBCA22CB /* YBIBSheetView.h */,\n\t\t\t\t70311C07C338D15C10359367D124DCB2 /* YBIBSheetView.m */,\n\t\t\t\tB1A4EF627C537429FB09C7E9A9E95338 /* YBIBToastView.h */,\n\t\t\t\t9F9BA4DAF23D949C05897B1783154480 /* YBIBToastView.m */,\n\t\t\t\t4C38AE4781969F67E0A7F0DD35F92DE2 /* YBIBToolViewHandler.h */,\n\t\t\t\t21DD63151E1CF12CD7AE771C28DB3744 /* YBIBToolViewHandler.m */,\n\t\t\t\tD1048A027C4FBCF9152464AEF0A42DF9 /* YBIBTopView.h */,\n\t\t\t\t7D13406F90A3D4B57CD6226E8A5C737C /* YBIBTopView.m */,\n\t\t\t\t211000BFCB7EACB2EB04F1E0548A942A /* YBIBUtilities.h */,\n\t\t\t\t4058C9E6799A134BB3AB12D09FC1E095 /* YBIBUtilities.m */,\n\t\t\t\t8B09362988362834F1FFD7C8B5944C30 /* YBIBWebImageMediator.h */,\n\t\t\t\t687658C90F2632BB7DCE508633C050A2 /* YBImage.h */,\n\t\t\t\t778FB59000C58F9376C8C93A6F69DC01 /* YBImage.m */,\n\t\t\t\t8FBAA9DB673482CC8916220D24D0D50E /* YBImageBrowser.h */,\n\t\t\t\t978976D87893386B5E716C8D949F2FD7 /* YBImageBrowser.m */,\n\t\t\t\t45FFA25657FEA14753650320848281AC /* YBImageBrowser+Internal.h */,\n\t\t\t\tE9ABD94320318FEEA03DD8CB1CB4C166 /* YBImageBrowserDataSource.h */,\n\t\t\t\tD86F7A83026F65646CFDB6E7645DF2CE /* YBImageBrowserDelegate.h */,\n\t\t\t\tB4BD1FA2706D8EAFE51A308AB661ACCB /* Resources */,\n\t\t\t);\n\t\t\tname = Core;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDA51D1A658F6E45ADBD81BABB11977ED /* Video */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t20EC611A00FD426ED609458C973B76AB /* YBIBVideoActionBar.h */,\n\t\t\t\t8B794B9C30FB7B7D1185F0BC9503AE6A /* YBIBVideoActionBar.m */,\n\t\t\t\t3E95935D9E4E91308A4AA077E60884FD /* YBIBVideoCell.h */,\n\t\t\t\t52BC3939D5AE47AA31C149A187161C2E /* YBIBVideoCell.m */,\n\t\t\t\tD47F1170390DBA6A3260F1D1CD67B0A5 /* YBIBVideoCell+Internal.h */,\n\t\t\t\t8C6F079870BB21F74F84B3BC4AD37D57 /* YBIBVideoData.h */,\n\t\t\t\t3DAC533CA8081C9E3A2909A65C3416D0 /* YBIBVideoData.m */,\n\t\t\t\tB014095D4652584837E7883E5F0BB566 /* YBIBVideoData+Internal.h */,\n\t\t\t\t92B93411959213419239C65216073F9C /* YBIBVideoTopBar.h */,\n\t\t\t\t11C64268EEFEE7C51225486E6B752EE1 /* YBIBVideoTopBar.m */,\n\t\t\t\t22AD2EE342F17F06CA9C261FB1931872 /* YBIBVideoView.h */,\n\t\t\t\t3CD9182299522FF2A27303D8CA3782A8 /* YBIBVideoView.m */,\n\t\t\t\t844DCCE42DAA23BDA8C20FDB2729D4D9 /* Resources */,\n\t\t\t);\n\t\t\tname = Video;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t5B0EFF7C180718F14F2623B271BCFB17 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDBCDD4928CA072405CAC44464163AA30 /* NSObject+YBImageBrowser.h in Headers */,\n\t\t\t\t44D7413CFB8D556A1FBDF9B422B7A70A /* YBIBAnimatedTransition.h in Headers */,\n\t\t\t\t4B512FCC6F35C44DDD5EE067E26F1876 /* YBIBAuxiliaryViewHandler.h in Headers */,\n\t\t\t\t2A9BC1A04BE3FF95D1AAFA63C6AF41BF /* YBIBCellProtocol.h in Headers */,\n\t\t\t\t94EFC24926D19F92EDC4F9A75A5B5DEC /* YBIBCollectionView.h in Headers */,\n\t\t\t\tCD9A01BF7B157253E7D0B2AC02DCDB14 /* YBIBCollectionViewLayout.h in Headers */,\n\t\t\t\t08BCFE4358F120359B4C3DC5F9EBD465 /* YBIBContainerView.h in Headers */,\n\t\t\t\t90CB81BC5BA3CF65B78A5526C537D83D /* YBIBCopywriter.h in Headers */,\n\t\t\t\tFF796B87DC375EE79823F9C8FAEAEA1B /* YBIBDataMediator.h in Headers */,\n\t\t\t\t83E9F25D64CBE3CC19CC6A703A83652D /* YBIBDataProtocol.h in Headers */,\n\t\t\t\tBE10885059C49AB7BFED5F0C4FC43637 /* YBIBDefaultWebImageMediator.h in Headers */,\n\t\t\t\t10F674D02DF64E9ED71A1598EB723257 /* YBIBGetBaseInfoProtocol.h in Headers */,\n\t\t\t\t10C003F8BB9E1831B8730B021B974BB1 /* YBIBIconManager.h in Headers */,\n\t\t\t\tB1BF6E7D6BB024555DA57962DC8A9656 /* YBIBImageCache.h in Headers */,\n\t\t\t\tB98EF74C060813AB4ED08B856559A163 /* YBIBImageCache+Internal.h in Headers */,\n\t\t\t\t56B40D4BDA1929ECB99A1109B966E906 /* YBIBImageCell.h in Headers */,\n\t\t\t\t420C1E74DB4277AF5C4469FBB79248DE /* YBIBImageCell+Internal.h in Headers */,\n\t\t\t\t5AA96B04DFB70148F9E382240C58C8A7 /* YBIBImageData.h in Headers */,\n\t\t\t\t4D2EFE20E6C9E4D9A8E1D69B6A2EF88A /* YBIBImageData+Internal.h in Headers */,\n\t\t\t\tF815B20B1A1F064FAC7497C17DE136F7 /* YBIBImageLayout.h in Headers */,\n\t\t\t\t936E449577B193D29D7519128FE97B82 /* YBIBImageScrollView.h in Headers */,\n\t\t\t\tEBFB805D356EDFCC85CF0D907D943664 /* YBIBInteractionProfile.h in Headers */,\n\t\t\t\t2767319B2DA4A6F461CCEC8DE8E8BC21 /* YBIBLoadingView.h in Headers */,\n\t\t\t\tDFE094E97F6FF91ABEA773031C15734A /* YBIBOperateBrowserProtocol.h in Headers */,\n\t\t\t\t51B8207D70623B01EE6D3CC966AAB692 /* YBIBOrientationReceiveProtocol.h in Headers */,\n\t\t\t\t2FCFEF9ABEAEDFE3AE7BAB4F99BDE260 /* YBIBPhotoAlbumManager.h in Headers */,\n\t\t\t\t976B5684F81F8C557FA7EE8EA7F3000E /* YBIBScreenRotationHandler.h in Headers */,\n\t\t\t\t4473FD5D946708037C0EC60512BC7AE3 /* YBIBSentinel.h in Headers */,\n\t\t\t\t5305CE5D25FD72C0BB8A19680EED64B6 /* YBIBSheetView.h in Headers */,\n\t\t\t\tCA475F571FC4BFB610843C6C48C385AD /* YBIBToastView.h in Headers */,\n\t\t\t\t8B051FEDEC57BE24ED27D2E1A74C32A7 /* YBIBToolViewHandler.h in Headers */,\n\t\t\t\tE3C831282125182FE0FE5E9F83D06582 /* YBIBTopView.h in Headers */,\n\t\t\t\tA37DF0968A30C298A281CDCAE17E0C20 /* YBIBUtilities.h in Headers */,\n\t\t\t\tF76E9C11FE9D8616F844D0D92C7D8B8B /* YBIBVideoActionBar.h in Headers */,\n\t\t\t\t6144CF91B8050C58269650433D0CA1E0 /* YBIBVideoCell.h in Headers */,\n\t\t\t\tC999571B9384428CBE63A893305CA1C7 /* YBIBVideoCell+Internal.h in Headers */,\n\t\t\t\t84A907321617A873C70297F101A5EBC4 /* YBIBVideoData.h in Headers */,\n\t\t\t\tF2B4BCB49E65E2ADF3C18994A1EE2A00 /* YBIBVideoData+Internal.h in Headers */,\n\t\t\t\t51B817C8B575B3D8416070FAC6EDF097 /* YBIBVideoTopBar.h in Headers */,\n\t\t\t\t60DD809C74CEDB1AE27D4499496B4113 /* YBIBVideoView.h in Headers */,\n\t\t\t\t996549D4F24FB0C5A480EC6C4C3EE944 /* YBIBWebImageMediator.h in Headers */,\n\t\t\t\t39F8E7111F233485B6F8781F3DB79F40 /* YBImage.h in Headers */,\n\t\t\t\tAFE47A7976F14408749E2F8D2BE64947 /* YBImageBrowser.h in Headers */,\n\t\t\t\t3181A0D6C761BC7F402B7619DE69D47A /* YBImageBrowser+Internal.h in Headers */,\n\t\t\t\t16D0389E4F8A44B14BF54D5D89E8D149 /* YBImageBrowser-umbrella.h in Headers */,\n\t\t\t\t6FEAB822FA08D05F79AFE5520E6CB685 /* YBImageBrowserDataSource.h in Headers */,\n\t\t\t\t1666807F899C911A1BB314885B921DDF /* YBImageBrowserDelegate.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\tA13069CD227D6C648A6A2BF33159B4FA /* YBImageBrowser */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 7BD367FD0893F3FBD26159AE669BC7D7 /* Build configuration list for PBXNativeTarget \"YBImageBrowser\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t5B0EFF7C180718F14F2623B271BCFB17 /* Headers */,\n\t\t\t\t7102ECBFD66CFD2BD2892F4F86ECC40E /* Sources */,\n\t\t\t\tC6EA84C4DA07CF4AC4591E1DDE7911DF /* Frameworks */,\n\t\t\t\t67FC4DFD5D0E860AEA512D4C22B0650D /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t1EBF078059AB2A497673FB0B9FA751D1 /* PBXTargetDependency */,\n\t\t\t\t5D0E095A2C32C8434A101D990C155817 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = YBImageBrowser;\n\t\t\tproductName = YBImageBrowser;\n\t\t\tproductReference = 727FBA64C7C9DD98A5F2AA0A8E3D16AE /* YBImageBrowser */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t08326DCF56FD71CEBE60EA676DDD22C3 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = CDD546E4123FD6EA6854FD72D4C6D847 /* Build configuration list for PBXProject \"YBImageBrowser\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 117008FB63735F9D85C1630B80588387;\n\t\t\tproductRefGroup = 7DCFE478FEBFDBCE822B03889F05F079 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectReferences = (\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 959804ACDF80A313975CE84559E6F86B /* YYImage */;\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tProjectRef = 956391E2D1DBF99A84861C798AA9000B /* SDWebImage */;\n\t\t\t\t},\n\t\t\t);\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\tA13069CD227D6C648A6A2BF33159B4FA /* YBImageBrowser */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t67FC4DFD5D0E860AEA512D4C22B0650D /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tD4F8FFD26F6736033E47996CA231FDCB /* YBImageBrowser.bundle in Resources */,\n\t\t\t\tB6D5DA3B39CD8F78EE82012D6AA60D4F /* YBImageBrowserVideo.bundle in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t7102ECBFD66CFD2BD2892F4F86ECC40E /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tC883EA7D021CFF1D5966BE91D93CABE6 /* NSObject+YBImageBrowser.m in Sources */,\n\t\t\t\tE6C4C50C9C28E3E831001D4E6617E69B /* YBIBAnimatedTransition.m in Sources */,\n\t\t\t\t9E0933C8F1F99270AB7EB229EE9F8840 /* YBIBAuxiliaryViewHandler.m in Sources */,\n\t\t\t\t997E068A10973B3934699D51E73E5D51 /* YBIBCollectionView.m in Sources */,\n\t\t\t\t48B7C3D4C676BAF0B5447B85C43EDB10 /* YBIBCollectionViewLayout.m in Sources */,\n\t\t\t\t5B5D7F7D5F9080C56E999EA5303E30E2 /* YBIBContainerView.m in Sources */,\n\t\t\t\t1FC2AB93742D495BEFB93DA446888706 /* YBIBCopywriter.m in Sources */,\n\t\t\t\t5EB381385B04D2E8CAD7BAC2D7F56C36 /* YBIBDataMediator.m in Sources */,\n\t\t\t\t93B0BD42232680450B737397BC375F77 /* YBIBDefaultWebImageMediator.m in Sources */,\n\t\t\t\t23B7BEF127F5AF765B865295A15CCC9E /* YBIBIconManager.m in Sources */,\n\t\t\t\t57B61F3C8B0B1C4279CE467DD9C5CBFF /* YBIBImageCache.m in Sources */,\n\t\t\t\t81447937EE39A2692578E4D05D8A6BCB /* YBIBImageCell.m in Sources */,\n\t\t\t\tD1853EF7974857B79F0290CC06D269B2 /* YBIBImageData.m in Sources */,\n\t\t\t\tCA5A46D4448C773C42A91B5AE37DFCF3 /* YBIBImageLayout.m in Sources */,\n\t\t\t\tDC7440264A8EE646F1326FD9BF671593 /* YBIBImageScrollView.m in Sources */,\n\t\t\t\t90C7FF35711B4C8F1D37FA6EF04BD931 /* YBIBInteractionProfile.m in Sources */,\n\t\t\t\t30EDD42E07C0831D1B36DACA3E21D7F3 /* YBIBLoadingView.m in Sources */,\n\t\t\t\tF82E74EEAEB24128797F7625F2045F68 /* YBIBPhotoAlbumManager.m in Sources */,\n\t\t\t\t1C1FD335C29F013AB59737AC0D7F4830 /* YBIBScreenRotationHandler.m in Sources */,\n\t\t\t\t50CA2116DCB9112063173CFF3458C35B /* YBIBSentinel.m in Sources */,\n\t\t\t\tEB7616F43ECEDB1E1ED63CFBA01F6CE8 /* YBIBSheetView.m in Sources */,\n\t\t\t\t2F60E9AF091B5EC998A4665AB4CB6CD8 /* YBIBToastView.m in Sources */,\n\t\t\t\t3572B0A453ACA982E7A8F31D3C2B9706 /* YBIBToolViewHandler.m in Sources */,\n\t\t\t\tDE7801C45C5E7C8DF1EAFDFB1048A9C9 /* YBIBTopView.m in Sources */,\n\t\t\t\tDFE8E82906794741D9231BF6F71F3946 /* YBIBUtilities.m in Sources */,\n\t\t\t\t303CA039039109497506EF726D3114B5 /* YBIBVideoActionBar.m in Sources */,\n\t\t\t\tC17193FF6310CE1C300C35E335731583 /* YBIBVideoCell.m in Sources */,\n\t\t\t\t1979886EB585010993206B40B3A41B13 /* YBIBVideoData.m in Sources */,\n\t\t\t\t12877E95506273E8155FD570BE5EDE09 /* YBIBVideoTopBar.m in Sources */,\n\t\t\t\t199483B0216C9911C53ABF40604662BF /* YBIBVideoView.m in Sources */,\n\t\t\t\t3C7452F5B207155E3B47FF9189FC0EED /* YBImage.m in Sources */,\n\t\t\t\t3AE3E02525E6D5D8627B8FAE1F89E7BC /* YBImageBrowser.m in Sources */,\n\t\t\t\t8D340A6C76AE5288E14D3EF5421EEA98 /* YBImageBrowser-dummy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t1EBF078059AB2A497673FB0B9FA751D1 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = SDWebImage;\n\t\t\ttargetProxy = D43DEF07CBD6EF072BF133057FAB88AF /* PBXContainerItemProxy */;\n\t\t};\n\t\t5D0E095A2C32C8434A101D990C155817 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\tname = YYImage;\n\t\t\ttargetProxy = 3EB472E2FC678529EE53D6B9A1630099 /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin XCBuildConfiguration section */\n\t\t04F304BA8D9B84D043E47BC66705B521 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t620FB7354E4BD7E3BA224E0472D95BBA /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t77FEF5A83F740BA02E632EC74E997269 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 719A61DCD1BD7846C810702836B7F69E /* YBImageBrowser.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/YBImageBrowser/YBImageBrowser-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/YBImageBrowser/YBImageBrowser-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/YBImageBrowser/YBImageBrowser.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = YBImageBrowser;\n\t\t\t\tPRODUCT_NAME = YBImageBrowser;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tA33628E0829651BF8F7A92CDFDB32B60 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = C2408E7B9F8CA89D28AAB217085C4777 /* YBImageBrowser.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/YBImageBrowser/YBImageBrowser-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/YBImageBrowser/YBImageBrowser-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/YBImageBrowser/YBImageBrowser.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = YBImageBrowser;\n\t\t\t\tPRODUCT_NAME = YBImageBrowser;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t7BD367FD0893F3FBD26159AE669BC7D7 /* Build configuration list for PBXNativeTarget \"YBImageBrowser\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA33628E0829651BF8F7A92CDFDB32B60 /* Debug */,\n\t\t\t\t77FEF5A83F740BA02E632EC74E997269 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tCDD546E4123FD6EA6854FD72D4C6D847 /* Build configuration list for PBXProject \"YBImageBrowser\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t620FB7354E4BD7E3BA224E0472D95BBA /* Debug */,\n\t\t\t\t04F304BA8D9B84D043E47BC66705B521 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 08326DCF56FD71CEBE60EA676DDD22C3 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/YYImage/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 ibireme <ibireme@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/YYImage/README.md",
    "content": "YYImage\n==============\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/ibireme/YYImage/master/LICENSE)&nbsp;\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)&nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/v/YYImage.svg?style=flat)](http://cocoapods.org/?q= YYImage)&nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/p/YYImage.svg?style=flat)](http://cocoapods.org/?q= YYImage)&nbsp;\n[![Support](https://img.shields.io/badge/support-iOS%206%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)&nbsp;\n[![Build Status](https://travis-ci.org/ibireme/YYImage.svg?branch=master)](https://travis-ci.org/ibireme/YYImage)\n\nImage framework for iOS to display/encode/decode animated WebP, APNG, GIF, and more.<br/>\n(It's a component of [YYKit](https://github.com/ibireme/YYKit))\n\n![niconiconi~](https://raw.github.com/ibireme/YYImage/master/Demo/YYImageDemo/niconiconi@2x.gif\n)\n\nFeatures\n==============\n- Display/encode/decode animated image with these types:<br/>&nbsp;&nbsp;&nbsp;&nbsp;WebP, APNG, GIF.\n- Display/encode/decode still image with these types:<br/>&nbsp;&nbsp;&nbsp;&nbsp;WebP, PNG, GIF, JPEG, JP2, TIFF, BMP, ICO, ICNS.\n- Baseline/progressive/interlaced image decode with these types:<br/>&nbsp;&nbsp;&nbsp;&nbsp;PNG, GIF, JPEG, BMP.\n- Display frame based image animation and sprite sheet animation.\n- Dynamic memory buffer for lower memory usage.\n- Fully compatible with UIImage and UIImageView class.\n- Extendable protocol for custom image animation.\n- Fully documented.\n\nUsage\n==============\n\n###Display animated image\n\t\n\t// File: ani@3x.gif\n\tUIImage *image = [YYImage imageNamed:@\"ani.gif\"];\n\tUIImageView *imageView = [[YYAnimatedImageView alloc] initWithImage:image];\n\t[self.view addSubView:imageView];\n\n\n###Display frame animation\n\t\n\t// Files: frame1.png, frame2.png, frame3.png\n\tNSArray *paths = @[@\"/ani/frame1.png\", @\"/ani/frame2.png\", @\"/ani/frame3.png\"];\n\tNSArray *times = @[@0.1, @0.2, @0.1];\n\tUIImage *image = [YYFrameImage alloc] initWithImagePaths:paths frameDurations:times repeats:YES];\n\tUIImageView *imageView = [YYAnimatedImageView alloc] initWithImage:image];\n\t[self.view addSubView:imageView];\n\n###Display sprite sheet animation\n\n\t// 8 * 12 sprites in a single sheet image\n\tUIImage *spriteSheet = [UIImage imageNamed:@\"sprite-sheet\"];\n\tNSMutableArray *contentRects = [NSMutableArray new];\n\tNSMutableArray *durations = [NSMutableArray new];\n\tfor (int j = 0; j < 12; j++) {\n\t   for (int i = 0; i < 8; i++) {\n\t       CGRect rect;\n\t       rect.size = CGSizeMake(img.size.width / 8, img.size.height / 12);\n\t       rect.origin.x = img.size.width / 8 * i;\n\t       rect.origin.y = img.size.height / 12 * j;\n\t       [contentRects addObject:[NSValue valueWithCGRect:rect]];\n\t       [durations addObject:@(1 / 60.0)];\n\t   }\n\t}\n\tYYSpriteSheetImage *sprite;\n\tsprite = [[YYSpriteSheetImage alloc] initWithSpriteSheetImage:img\n\t                                                contentRects:contentRects\n\t                                              frameDurations:durations\n\t                                                   loopCount:0];\n\tYYAnimatedImageView *imageView = [YYAnimatedImageView new];\n\timageView.size = CGSizeMake(img.size.width / 8, img.size.height / 12);\n\timageView.image = sprite;\n\t[self.view addSubView:imageView];\n\n###Animation control\n\t\n\tYYAnimatedImageView *imageView = ...;\n\t// pause:\n\t[imageView stopAnimating];\n\t// play:\n\t[imageView startAnimating];\n\t// set frame index:\n\timageView.currentAnimatedImageIndex = 12;\n\t// get current status\n\timage.currentIsPlayingAnimation;\n\t\n###Image decoder\n\t\t\n\t// Decode single frame:\n\tNSData *data = [NSData dataWithContentsOfFile:@\"/tmp/image.webp\"];\n\tYYImageDecoder *decoder = [YYImageDecoder decoderWithData:data scale:2.0];\n\tUIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n\t\n\t// Progressive:\n\tNSMutableData *data = [NSMutableData new];\n\tYYImageDecoder *decoder = [[YYImageDecoder alloc] initWithScale:2.0];\n\twhile(newDataArrived) {\n\t   [data appendData:newData];\n\t   [decoder updateData:data final:NO];\n\t   if (decoder.frameCount > 0) {\n\t       UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n\t       // progressive display...\n\t   }\n\t}\n\t[decoder updateData:data final:YES];\n\tUIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n\t// final display...\n\n###Image encoder\n\t\n\t// Encode still image:\n\tYYImageEncoder *jpegEncoder = [[YYImageEncoder alloc] initWithType:YYImageTypeJPEG];\n\tjpegEncoder.quality = 0.9;\n\t[jpegEncoder addImage:image duration:0];\n\tNSData jpegData = [jpegEncoder encode];\n\t \n\t// Encode animated image:\n\tYYImageEncoder *webpEncoder = [[YYImageEncoder alloc] initWithType:YYImageTypeWebP];\n\twebpEncoder.loopCount = 5;\n\t[webpEncoder addImage:image0 duration:0.1];\n\t[webpEncoder addImage:image1 duration:0.15];\n\t[webpEncoder addImage:image2 duration:0.2];\n\tNSData webpData = [webpEncoder encode];\n\n###Image type detection\n\n\t// Get image type from image data\n\tYYImageType type = YYImageDetectType(data); \n\tif (type == YYImageTypePNG) ...\n\t\n\t\nInstallation\n==============\n\n### CocoaPods\n\n1. Update cocoapods to the latest version.\n2. Add `pod 'YYImage'` to your Podfile.\n3. Run `pod install` or `pod update`.\n4. Import \\<YYImage/YYImage.h\\>.\n5. Notice: it doesn't include WebP subspec by default, if you want to support WebP format, you may add `pod 'YYImage/WebP'` to your Podfile.\n\n### Carthage\n\n1. Add `github \"ibireme/YYImage\"` to your Cartfile.\n2. Run `carthage update --platform ios` and add the framework to your project.\n3. Import \\<YYImage/YYImage.h\\>.\n4. Notice: carthage framework doesn't include WebP component, if you want to support WebP format, use CocoaPods or install manually.\n\n### Manually\n\n1. Download all the files in the YYImage subdirectory.\n2. Add the source files to your Xcode project.\n3. Link with required frameworks:\n\t* UIKit\n\t* CoreFoundation\n\t* QuartzCore\n\t* AssetsLibrary\n\t* ImageIO\n\t* Accelerate\n\t* MobileCoreServices\n\t* libz\n4. Import `YYImage.h`.\n5. Notice: if you want to support WebP format, you may add `Vendor/WebP.framework`(static library) to your Xcode project.\n\nFAQ\n==============\n_Q: Why I can't display WebP image?_\n\nA: Make sure you added the `WebP.framework` in your project. You may call `YYImageWebPAvailable()` to check whether the WebP subspec is installed correctly.\n\n_Q: Why I can't play APNG animation?_\n\nA: You should disable the `Compress PNG Files` and `Remove Text Metadata From PNG Files` in your project's build settings. Or you can rename your APNG file's extension name with `apng`.\n\nDocumentation\n==============\nFull API documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/YYImage/).<br/>\nYou can also install documentation locally using [appledoc](https://github.com/tomaz/appledoc).\n\n\n\nRequirements\n==============\nThis library requires `iOS 6.0+` and `Xcode 7.0+`.\n\n\nLicense\n==============\nYYImage is provided under the MIT license. See LICENSE file for details.\n\n\n<br/><br/>\n---\n中文介绍\n==============\nYYImage: 功能强大的 iOS 图像框架。<br/>\n(该项目是 [YYKit](https://github.com/ibireme/YYKit) 组件之一)\n\n![niconiconi~](https://raw.github.com/ibireme/YYImage/master/Demo/YYImageDemo/niconiconi@2x.gif\n)\n\n特性\n==============\n- 支持以下类型动画图像的播放/编码/解码:<br/>\n  &nbsp;&nbsp;&nbsp;&nbsp;WebP, APNG, GIF。\n- 支持以下类型静态图像的显示/编码/解码:<br>\n  &nbsp;&nbsp;&nbsp;&nbsp;WebP, PNG, GIF, JPEG, JP2, TIFF, BMP, ICO, ICNS。\n- 支持以下类型图片的渐进式/逐行扫描/隔行扫描解码:<br/>\n  &nbsp;&nbsp;&nbsp;&nbsp;PNG, GIF, JPEG, BMP。\n- 支持多张图片构成的帧动画播放，支持单张图片的 sprite sheet 动画。\n- 高效的动态内存缓存管理，以保证高性能低内存的动画播放。\n- 完全兼容 UIImage 和 UIImageView，使用方便。\n- 保留可扩展的接口，以支持自定义动画。\n- 每个类和方法都有完善的文档注释。\n\n\n用法\n==============\n\n###显示动画类型的图片\n\t\n\t// 文件: ani@3x.gif\n\tUIImage *image = [YYImage imageNamed:@\"ani.gif\"];\n\tUIImageView *imageView = [[YYAnimatedImageView alloc] initWithImage:image];\n\t[self.view addSubView:imageView];\n\n\n###播放帧动画\n\t\n\t// 文件: frame1.png, frame2.png, frame3.png\n\tNSArray *paths = @[@\"/ani/frame1.png\", @\"/ani/frame2.png\", @\"/ani/frame3.png\"];\n\tNSArray *times = @[@0.1, @0.2, @0.1];\n\tUIImage *image = [YYFrameImage alloc] initWithImagePaths:paths frameDurations:times repeats:YES];\n\tUIImageView *imageView = [YYAnimatedImageView alloc] initWithImage:image];\n\t[self.view addSubView:imageView];\n\n###播放 sprite sheet 动画\n\n\t// 8 * 12 sprites in a single sheet image\n\tUIImage *spriteSheet = [UIImage imageNamed:@\"sprite-sheet\"];\n\tNSMutableArray *contentRects = [NSMutableArray new];\n\tNSMutableArray *durations = [NSMutableArray new];\n\tfor (int j = 0; j < 12; j++) {\n\t   for (int i = 0; i < 8; i++) {\n\t       CGRect rect;\n\t       rect.size = CGSizeMake(img.size.width / 8, img.size.height / 12);\n\t       rect.origin.x = img.size.width / 8 * i;\n\t       rect.origin.y = img.size.height / 12 * j;\n\t       [contentRects addObject:[NSValue valueWithCGRect:rect]];\n\t       [durations addObject:@(1 / 60.0)];\n\t   }\n\t}\n\tYYSpriteSheetImage *sprite;\n\tsprite = [[YYSpriteSheetImage alloc] initWithSpriteSheetImage:img\n\t                                                contentRects:contentRects\n\t                                              frameDurations:durations\n\t                                                   loopCount:0];\n\tYYAnimatedImageView *imageView = [YYAnimatedImageView new];\n\timageView.size = CGSizeMake(img.size.width / 8, img.size.height / 12);\n\timageView.image = sprite;\n\t[self.view addSubView:imageView];\n\n###动画播放控制\n\t\n\tYYAnimatedImageView *imageView = ...;\n\t// 暂停:\n\t[imageView stopAnimating];\n\t// 播放:\n\t[imageView startAnimating];\n\t// 设置播放进度:\n\timageView.currentAnimatedImageIndex = 12;\n\t// 获取播放状态:\n\timage.currentIsPlayingAnimation;\n\t//上面两个属性都支持 KVO。\n\t\n###图片解码\n\t\t\n\t// 解码单帧图片:\n\tNSData *data = [NSData dataWithContentsOfFile:@\"/tmp/image.webp\"];\n\tYYImageDecoder *decoder = [YYImageDecoder decoderWithData:data scale:2.0];\n\tUIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n\t\n\t// 渐进式图片解码 (可用于图片下载显示):\n\tNSMutableData *data = [NSMutableData new];\n\tYYImageDecoder *decoder = [[YYImageDecoder alloc] initWithScale:2.0];\n\twhile(newDataArrived) {\n\t   [data appendData:newData];\n\t   [decoder updateData:data final:NO];\n\t   if (decoder.frameCount > 0) {\n\t       UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n\t       // progressive display...\n\t   }\n\t}\n\t[decoder updateData:data final:YES];\n\tUIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n\t// final display...\n\n###图片编码\n\t\n\t// 编码静态图 (支持各种常见图片格式):\n\tYYImageEncoder *jpegEncoder = [[YYImageEncoder alloc] initWithType:YYImageTypeJPEG];\n\tjpegEncoder.quality = 0.9;\n\t[jpegEncoder addImage:image duration:0];\n\tNSData jpegData = [jpegEncoder encode];\n\t \n\t// 编码动态图 (支持 GIF/APNG/WebP):\n\tYYImageEncoder *webpEncoder = [[YYImageEncoder alloc] initWithType:YYImageTypeWebP];\n\twebpEncoder.loopCount = 5;\n\t[webpEncoder addImage:image0 duration:0.1];\n\t[webpEncoder addImage:image1 duration:0.15];\n\t[webpEncoder addImage:image2 duration:0.2];\n\tNSData webpData = [webpEncoder encode];\n\t\n###图片类型探测\n\n\t// 获取图片类型\n\tYYImageType type = YYImageDetectType(data); \n\tif (type == YYImageTypePNG) ...\n\t\n\n安装\n==============\n\n### CocoaPods\n\n1. 将 cocoapods 更新至最新版本.\n2. 在 Podfile 中添加 `pod 'YYImage'`。\n3. 执行 `pod install` 或 `pod update`。\n4. 导入 \\<YYImage/YYImage.h\\>。\n5. 注意：pod 配置并没有包含 WebP 组件, 如果你需要支持 WebP，可以在 Podfile 中添加 `pod 'YYImage/WebP'`。\n\n### Carthage\n\n1. 在 Cartfile 中添加 `github \"ibireme/YYImage\"`。\n2. 执行 `carthage update --platform ios` 并将生成的 framework 添加到你的工程。\n3. 导入 \\<YYImage/YYImage.h\\>。\n4. 注意：carthage framework 并没有包含 WebP 组件。如果你需要支持 WebP，可以用 CocoaPods 安装，或者手动安装。\n\n### 手动安装\n\n1. 下载 YYImage 文件夹内的所有内容。\n2. 将 YYImage 内的源文件添加(拖放)到你的工程。\n3. 链接以下 frameworks:\n\t* UIKit\n\t* CoreFoundation\n\t* QuartzCore\n\t* AssetsLibrary\n\t* ImageIO\n\t* Accelerate\n\t* MobileCoreServices\n\t* libz\n4. 导入 `YYImage.h`。\n5. 注意：如果你需要支持 WebP，可以将 `Vendor/WebP.framework`(静态库) 加入你的工程。\n\n常见问题\n==============\n_Q: 为什么我不能显示 WebP 图片？_\n\nA: 确保 `WebP.framework` 已经被添加到你的工程内了。你可以调用 `YYImageWebPAvailable()` 来检查一下 WebP 组件是否被正确安装。\n\n_Q: 为什么我不能播放 APNG 动画？_\n\nA: 你应该禁用 Build Settings 中的 `Compress PNG Files` 和 `Remove Text Metadata From PNG Files`. 或者你也可以把 APNG 文件的扩展名改为`apng`.\n\n文档\n==============\n你可以在 [CocoaDocs](http://cocoadocs.org/docsets/YYImage/) 查看在线 API 文档，也可以用 [appledoc](https://github.com/tomaz/appledoc) 本地生成文档。\n\n\n系统要求\n==============\n该项目最低支持 `iOS 6.0` 和 `Xcode 7.0`。\n\n\n许可证\n==============\nYYImage 使用 MIT 许可证，详情见 LICENSE 文件。\n\n\n相关链接\n==============\n[移动端图片格式调研](http://blog.ibireme.com/2015/11/02/mobile_image_benchmark/)<br/>\n\n[iOS 处理图片的一些小 Tip](http://blog.ibireme.com/2015/11/02/ios_image_tips/)\n\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYAnimatedImageView.h",
    "content": "//\n//  YYAnimatedImageView.h\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 14/10/19.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An image view for displaying animated image.\n \n @discussion It is a fully compatible `UIImageView` subclass.\n If the `image` or `highlightedImage` property adopt to the `YYAnimatedImage` protocol,\n then it can be used to play the multi-frame animation. The animation can also be \n controlled with the UIImageView methods `-startAnimating`, `-stopAnimating` and `-isAnimating`.\n \n This view request the frame data just in time. When the device has enough free memory, \n this view may cache some or all future frames in an inner buffer for lower CPU cost.\n Buffer size is dynamically adjusted based on the current state of the device memory.\n \n Sample Code:\n \n     // ani@3x.gif\n     YYImage *image = [YYImage imageNamed:@\"ani\"];\n     YYAnimatedImageView *imageView = [YYAnimatedImageView alloc] initWithImage:image];\n     [view addSubView:imageView];\n */\n@interface YYAnimatedImageView : UIImageView\n\n/**\n If the image has more than one frame, set this value to `YES` will automatically \n play/stop the animation when the view become visible/invisible.\n \n The default value is `YES`.\n */\n@property (nonatomic) BOOL autoPlayAnimatedImage;\n\n/**\n Index of the currently displayed frame (index from 0).\n \n Set a new value to this property will cause to display the new frame immediately.\n If the new value is invalid, this method has no effect.\n \n You can add an observer to this property to observe the playing status.\n */\n@property (nonatomic) NSUInteger currentAnimatedImageIndex;\n\n/**\n Whether the image view is playing animation currently.\n \n You can add an observer to this property to observe the playing status.\n */\n@property (nonatomic, readonly) BOOL currentIsPlayingAnimation;\n\n/**\n The animation timer's runloop mode, default is `NSRunLoopCommonModes`.\n \n Set this property to `NSDefaultRunLoopMode` will make the animation pause during\n UIScrollView scrolling.\n */\n@property (nonatomic, copy) NSString *runloopMode;\n\n/**\n The max size (in bytes) for inner frame buffer size, default is 0 (dynamically).\n \n When the device has enough free memory, this view will request and decode some or \n all future frame image into an inner buffer. If this property's value is 0, then \n the max buffer size will be dynamically adjusted based on the current state of \n the device free memory. Otherwise, the buffer size will be limited by this value.\n \n When receive memory warning or app enter background, the buffer will be released \n immediately, and may grow back at the right time.\n */\n@property (nonatomic) NSUInteger maxBufferSize;\n\n@end\n\n\n\n/**\n The YYAnimatedImage protocol declares the required methods for animated image\n display with YYAnimatedImageView.\n \n Subclass a UIImage and implement this protocol, so that instances of that class \n can be set to YYAnimatedImageView.image or YYAnimatedImageView.highlightedImage\n to display animation.\n \n See `YYImage` and `YYFrameImage` for example.\n */\n@protocol YYAnimatedImage <NSObject>\n@required\n/// Total animated frame count.\n/// It the frame count is less than 1, then the methods below will be ignored.\n- (NSUInteger)animatedImageFrameCount;\n\n/// Animation loop count, 0 means infinite looping.\n- (NSUInteger)animatedImageLoopCount;\n\n/// Bytes per frame (in memory). It may used to optimize memory buffer size.\n- (NSUInteger)animatedImageBytesPerFrame;\n\n/// Returns the frame image from a specified index.\n/// This method may be called on background thread.\n/// @param index  Frame index (zero based).\n- (nullable UIImage *)animatedImageFrameAtIndex:(NSUInteger)index;\n\n/// Returns the frames's duration from a specified index.\n/// @param index  Frame index (zero based).\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index;\n\n@optional\n/// A rectangle in image coordinates defining the subrectangle of the image that\n/// will be displayed. The rectangle should not outside the image's bounds.\n/// It may used to display sprite animation with a single image (sprite sheet).\n- (CGRect)animatedImageContentsRectAtIndex:(NSUInteger)index;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYAnimatedImageView.m",
    "content": "//\n//  YYAnimatedImageView.m\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 14/10/19.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYAnimatedImageView.h\"\n#import \"YYImageCoder.h\"\n#import <pthread.h>\n#import <mach/mach.h>\n\n\n#define BUFFER_SIZE (10 * 1024 * 1024) // 10MB (minimum memory buffer size)\n\n#define LOCK(...) dispatch_semaphore_wait(self->_lock, DISPATCH_TIME_FOREVER); \\\n__VA_ARGS__; \\\ndispatch_semaphore_signal(self->_lock);\n\n#define LOCK_VIEW(...) dispatch_semaphore_wait(view->_lock, DISPATCH_TIME_FOREVER); \\\n__VA_ARGS__; \\\ndispatch_semaphore_signal(view->_lock);\n\n\nstatic int64_t _YYDeviceMemoryTotal() {\n    int64_t mem = [[NSProcessInfo processInfo] physicalMemory];\n    if (mem < -1) mem = -1;\n        return mem;\n}\n\nstatic int64_t _YYDeviceMemoryFree() {\n    mach_port_t host_port = mach_host_self();\n    mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);\n    vm_size_t page_size;\n    vm_statistics_data_t vm_stat;\n    kern_return_t kern;\n    \n    kern = host_page_size(host_port, &page_size);\n    if (kern != KERN_SUCCESS) return -1;\n    kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size);\n    if (kern != KERN_SUCCESS) return -1;\n    return vm_stat.free_count * page_size;\n}\n\n/**\n A proxy used to hold a weak object.\n It can be used to avoid retain cycles, such as the target in NSTimer or CADisplayLink.\n */\n@interface _YYImageWeakProxy : NSProxy\n@property (nonatomic, weak, readonly) id target;\n- (instancetype)initWithTarget:(id)target;\n+ (instancetype)proxyWithTarget:(id)target;\n@end\n\n@implementation _YYImageWeakProxy\n- (instancetype)initWithTarget:(id)target {\n    _target = target;\n    return self;\n}\n+ (instancetype)proxyWithTarget:(id)target {\n    return [[_YYImageWeakProxy alloc] initWithTarget:target];\n}\n- (id)forwardingTargetForSelector:(SEL)selector {\n    return _target;\n}\n- (void)forwardInvocation:(NSInvocation *)invocation {\n    void *null = NULL;\n    [invocation setReturnValue:&null];\n}\n- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {\n    return [NSObject instanceMethodSignatureForSelector:@selector(init)];\n}\n- (BOOL)respondsToSelector:(SEL)aSelector {\n    return [_target respondsToSelector:aSelector];\n}\n- (BOOL)isEqual:(id)object {\n    return [_target isEqual:object];\n}\n- (NSUInteger)hash {\n    return [_target hash];\n}\n- (Class)superclass {\n    return [_target superclass];\n}\n- (Class)class {\n    return [_target class];\n}\n- (BOOL)isKindOfClass:(Class)aClass {\n    return [_target isKindOfClass:aClass];\n}\n- (BOOL)isMemberOfClass:(Class)aClass {\n    return [_target isMemberOfClass:aClass];\n}\n- (BOOL)conformsToProtocol:(Protocol *)aProtocol {\n    return [_target conformsToProtocol:aProtocol];\n}\n- (BOOL)isProxy {\n    return YES;\n}\n- (NSString *)description {\n    return [_target description];\n}\n- (NSString *)debugDescription {\n    return [_target debugDescription];\n}\n@end\n\n\n\n\ntypedef NS_ENUM(NSUInteger, YYAnimatedImageType) {\n    YYAnimatedImageTypeNone = 0,\n    YYAnimatedImageTypeImage,\n    YYAnimatedImageTypeHighlightedImage,\n    YYAnimatedImageTypeImages,\n    YYAnimatedImageTypeHighlightedImages,\n};\n\n@interface YYAnimatedImageView() {\n    @package\n    UIImage <YYAnimatedImage> *_curAnimatedImage;\n    \n    dispatch_once_t _onceToken;\n    dispatch_semaphore_t _lock; ///< lock for _buffer\n    NSOperationQueue *_requestQueue; ///< image request queue, serial\n    \n    CADisplayLink *_link; ///< ticker for change frame\n    NSTimeInterval _time; ///< time after last frame\n    \n    UIImage *_curFrame; ///< current frame to display\n    NSUInteger _curIndex; ///< current frame index (from 0)\n    NSUInteger _totalFrameCount; ///< total frame count\n    \n    BOOL _loopEnd; ///< whether the loop is end.\n    NSUInteger _curLoop; ///< current loop count (from 0)\n    NSUInteger _totalLoop; ///< total loop count, 0 means infinity\n    \n    NSMutableDictionary *_buffer; ///< frame buffer\n    BOOL _bufferMiss; ///< whether miss frame on last opportunity\n    NSUInteger _maxBufferCount; ///< maximum buffer count\n    NSInteger _incrBufferCount; ///< current allowed buffer count (will increase by step)\n    \n    CGRect _curContentsRect;\n    BOOL _curImageHasContentsRect; ///< image has implementated \"animatedImageContentsRectAtIndex:\"\n}\n@property (nonatomic, readwrite) BOOL currentIsPlayingAnimation;\n- (void)calcMaxBufferCount;\n@end\n\n/// An operation for image fetch\n@interface _YYAnimatedImageViewFetchOperation : NSOperation\n@property (nonatomic, weak) YYAnimatedImageView *view;\n@property (nonatomic, assign) NSUInteger nextIndex;\n@property (nonatomic, strong) UIImage <YYAnimatedImage> *curImage;\n@end\n\n@implementation _YYAnimatedImageViewFetchOperation\n- (void)main {\n    __strong YYAnimatedImageView *view = _view;\n    if (!view) return;\n    if ([self isCancelled]) return;\n    view->_incrBufferCount++;\n    if (view->_incrBufferCount == 0) [view calcMaxBufferCount];\n    if (view->_incrBufferCount > (NSInteger)view->_maxBufferCount) {\n        view->_incrBufferCount = view->_maxBufferCount;\n    }\n    NSUInteger idx = _nextIndex;\n    NSUInteger max = view->_incrBufferCount < 1 ? 1 : view->_incrBufferCount;\n    NSUInteger total = view->_totalFrameCount;\n    view = nil;\n    \n    for (int i = 0; i < max; i++, idx++) {\n        @autoreleasepool {\n            if (idx >= total) idx = 0;\n            if ([self isCancelled]) break;\n            __strong YYAnimatedImageView *view = _view;\n            if (!view) break;\n            LOCK_VIEW(BOOL miss = (view->_buffer[@(idx)] == nil));\n            \n            if (miss) {\n                UIImage *img = [_curImage animatedImageFrameAtIndex:idx];\n                img = img.yy_imageByDecoded;\n                if ([self isCancelled]) break;\n                LOCK_VIEW(view->_buffer[@(idx)] = img ? img : [NSNull null]);\n                view = nil;\n            }\n        }\n    }\n}\n@end\n\n@implementation YYAnimatedImageView\n\n- (instancetype)init {\n    self = [super init];\n    _runloopMode = NSRunLoopCommonModes;\n    _autoPlayAnimatedImage = YES;\n    return self;\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    _runloopMode = NSRunLoopCommonModes;\n    _autoPlayAnimatedImage = YES;\n    return self;\n}\n\n- (instancetype)initWithImage:(UIImage *)image {\n    self = [super init];\n    _runloopMode = NSRunLoopCommonModes;\n    _autoPlayAnimatedImage = YES;\n    self.frame = (CGRect) {CGPointZero, image.size };\n    self.image = image;\n    return self;\n}\n\n- (instancetype)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage {\n    self = [super init];\n    _runloopMode = NSRunLoopCommonModes;\n    _autoPlayAnimatedImage = YES;\n    CGSize size = image ? image.size : highlightedImage.size;\n    self.frame = (CGRect) {CGPointZero, size };\n    self.image = image;\n    self.highlightedImage = highlightedImage;\n    return self;\n}\n\n// init the animated params.\n- (void)resetAnimated {\n    dispatch_once(&_onceToken, ^{\n        _lock = dispatch_semaphore_create(1);\n        _buffer = [NSMutableDictionary new];\n        _requestQueue = [[NSOperationQueue alloc] init];\n        _requestQueue.maxConcurrentOperationCount = 1;\n        _link = [CADisplayLink displayLinkWithTarget:[_YYImageWeakProxy proxyWithTarget:self] selector:@selector(step:)];\n        if (_runloopMode) {\n            [_link addToRunLoop:[NSRunLoop mainRunLoop] forMode:_runloopMode];\n        }\n        _link.paused = YES;\n        \n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil];\n    });\n    \n    [_requestQueue cancelAllOperations];\n    LOCK(\n         if (_buffer.count) {\n             NSMutableDictionary *holder = _buffer;\n             _buffer = [NSMutableDictionary new];\n             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{\n                 // Capture the dictionary to global queue,\n                 // release these images in background to avoid blocking UI thread.\n                 [holder class];\n             });\n         }\n    );\n    _link.paused = YES;\n    _time = 0;\n    if (_curIndex != 0) {\n        [self willChangeValueForKey:@\"currentAnimatedImageIndex\"];\n        _curIndex = 0;\n        [self didChangeValueForKey:@\"currentAnimatedImageIndex\"];\n    }\n    _curAnimatedImage = nil;\n    _curFrame = nil;\n    _curLoop = 0;\n    _totalLoop = 0;\n    _totalFrameCount = 1;\n    _loopEnd = NO;\n    _bufferMiss = NO;\n    _incrBufferCount = 0;\n}\n\n- (void)setImage:(UIImage *)image {\n    if (self.image == image) return;\n    [self setImage:image withType:YYAnimatedImageTypeImage];\n}\n\n- (void)setHighlightedImage:(UIImage *)highlightedImage {\n    if (self.highlightedImage == highlightedImage) return;\n    [self setImage:highlightedImage withType:YYAnimatedImageTypeHighlightedImage];\n}\n\n- (void)setAnimationImages:(NSArray *)animationImages {\n    if (self.animationImages == animationImages) return;\n    [self setImage:animationImages withType:YYAnimatedImageTypeImages];\n}\n\n- (void)setHighlightedAnimationImages:(NSArray *)highlightedAnimationImages {\n    if (self.highlightedAnimationImages == highlightedAnimationImages) return;\n    [self setImage:highlightedAnimationImages withType:YYAnimatedImageTypeHighlightedImages];\n}\n\n- (void)setHighlighted:(BOOL)highlighted {\n    [super setHighlighted:highlighted];\n    if (_link) [self resetAnimated];\n    [self imageChanged];\n}\n\n- (id)imageForType:(YYAnimatedImageType)type {\n    switch (type) {\n        case YYAnimatedImageTypeNone: return nil;\n        case YYAnimatedImageTypeImage: return self.image;\n        case YYAnimatedImageTypeHighlightedImage: return self.highlightedImage;\n        case YYAnimatedImageTypeImages: return self.animationImages;\n        case YYAnimatedImageTypeHighlightedImages: return self.highlightedAnimationImages;\n    }\n    return nil;\n}\n\n- (YYAnimatedImageType)currentImageType {\n    YYAnimatedImageType curType = YYAnimatedImageTypeNone;\n    if (self.highlighted) {\n        if (self.highlightedAnimationImages.count) curType = YYAnimatedImageTypeHighlightedImages;\n        else if (self.highlightedImage) curType = YYAnimatedImageTypeHighlightedImage;\n    }\n    if (curType == YYAnimatedImageTypeNone) {\n        if (self.animationImages.count) curType = YYAnimatedImageTypeImages;\n        else if (self.image) curType = YYAnimatedImageTypeImage;\n    }\n    return curType;\n}\n\n- (void)setImage:(id)image withType:(YYAnimatedImageType)type {\n    [self stopAnimating];\n    if (_link) [self resetAnimated];\n    _curFrame = nil;\n    switch (type) {\n        case YYAnimatedImageTypeNone: break;\n        case YYAnimatedImageTypeImage: super.image = image; break;\n        case YYAnimatedImageTypeHighlightedImage: super.highlightedImage = image; break;\n        case YYAnimatedImageTypeImages: super.animationImages = image; break;\n        case YYAnimatedImageTypeHighlightedImages: super.highlightedAnimationImages = image; break;\n    }\n    [self imageChanged];\n}\n\n- (void)imageChanged {\n    YYAnimatedImageType newType = [self currentImageType];\n    id newVisibleImage = [self imageForType:newType];\n    NSUInteger newImageFrameCount = 0;\n    BOOL hasContentsRect = NO;\n    if ([newVisibleImage isKindOfClass:[UIImage class]] &&\n        [newVisibleImage conformsToProtocol:@protocol(YYAnimatedImage)]) {\n        newImageFrameCount = ((UIImage<YYAnimatedImage> *) newVisibleImage).animatedImageFrameCount;\n        if (newImageFrameCount > 1) {\n            hasContentsRect = [((UIImage<YYAnimatedImage> *) newVisibleImage) respondsToSelector:@selector(animatedImageContentsRectAtIndex:)];\n        }\n    }\n    if (!hasContentsRect && _curImageHasContentsRect) {\n        if (!CGRectEqualToRect(self.layer.contentsRect, CGRectMake(0, 0, 1, 1)) ) {\n            [CATransaction begin];\n            [CATransaction setDisableActions:YES];\n            self.layer.contentsRect = CGRectMake(0, 0, 1, 1);\n            [CATransaction commit];\n        }\n    }\n    _curImageHasContentsRect = hasContentsRect;\n    if (hasContentsRect) {\n        CGRect rect = [((UIImage<YYAnimatedImage> *) newVisibleImage) animatedImageContentsRectAtIndex:0];\n        [self setContentsRect:rect forImage:newVisibleImage];\n    }\n    \n    if (newImageFrameCount > 1) {\n        [self resetAnimated];\n        _curAnimatedImage = newVisibleImage;\n        _curFrame = newVisibleImage;\n        _totalLoop = _curAnimatedImage.animatedImageLoopCount;\n        _totalFrameCount = _curAnimatedImage.animatedImageFrameCount;\n        [self calcMaxBufferCount];\n    }\n    [self setNeedsDisplay];\n    [self didMoved];\n}\n\n// dynamically adjust buffer size for current memory.\n- (void)calcMaxBufferCount {\n    int64_t bytes = (int64_t)_curAnimatedImage.animatedImageBytesPerFrame;\n    if (bytes == 0) bytes = 1024;\n    \n    int64_t total = _YYDeviceMemoryTotal();\n    int64_t free = _YYDeviceMemoryFree();\n    int64_t max = MIN(total * 0.2, free * 0.6);\n    max = MAX(max, BUFFER_SIZE);\n    if (_maxBufferSize) max = max > _maxBufferSize ? _maxBufferSize : max;\n    double maxBufferCount = (double)max / (double)bytes;\n    if (maxBufferCount < 1) maxBufferCount = 1;\n    else if (maxBufferCount > 512) maxBufferCount = 512;\n    _maxBufferCount = maxBufferCount;\n}\n\n- (void)dealloc {\n    [_requestQueue cancelAllOperations];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];\n    [_link invalidate];\n}\n\n- (BOOL)isAnimating {\n    return self.currentIsPlayingAnimation;\n}\n\n- (void)stopAnimating {\n    [super stopAnimating];\n    [_requestQueue cancelAllOperations];\n    _link.paused = YES;\n    self.currentIsPlayingAnimation = NO;\n}\n\n- (void)startAnimating {\n    YYAnimatedImageType type = [self currentImageType];\n    if (type == YYAnimatedImageTypeImages || type == YYAnimatedImageTypeHighlightedImages) {\n        NSArray *images = [self imageForType:type];\n        if (images.count > 0) {\n            [super startAnimating];\n            self.currentIsPlayingAnimation = YES;\n        }\n    } else {\n        if (_curAnimatedImage && _link.paused) {\n            _curLoop = 0;\n            _loopEnd = NO;\n            _link.paused = NO;\n            self.currentIsPlayingAnimation = YES;\n        }\n    }\n}\n\n- (void)didReceiveMemoryWarning:(NSNotification *)notification {\n    [_requestQueue cancelAllOperations];\n    [_requestQueue addOperationWithBlock: ^{\n        _incrBufferCount = -60 - (int)(arc4random() % 120); // about 1~3 seconds to grow back..\n        NSNumber *next = @((_curIndex + 1) % _totalFrameCount);\n        LOCK(\n             NSArray * keys = _buffer.allKeys;\n             for (NSNumber * key in keys) {\n                 if (![key isEqualToNumber:next]) { // keep the next frame for smoothly animation\n                     [_buffer removeObjectForKey:key];\n                 }\n             }\n        )//LOCK\n    }];\n}\n\n- (void)didEnterBackground:(NSNotification *)notification {\n    [_requestQueue cancelAllOperations];\n    NSNumber *next = @((_curIndex + 1) % _totalFrameCount);\n    LOCK(\n         NSArray * keys = _buffer.allKeys;\n         for (NSNumber * key in keys) {\n             if (![key isEqualToNumber:next]) { // keep the next frame for smoothly animation\n                 [_buffer removeObjectForKey:key];\n             }\n         }\n     )//LOCK\n}\n\n- (void)step:(CADisplayLink *)link {\n    UIImage <YYAnimatedImage> *image = _curAnimatedImage;\n    NSMutableDictionary *buffer = _buffer;\n    UIImage *bufferedImage = nil;\n    NSUInteger nextIndex = (_curIndex + 1) % _totalFrameCount;\n    BOOL bufferIsFull = NO;\n    \n    if (!image) return;\n    if (_loopEnd) { // view will keep in last frame\n        [self stopAnimating];\n        return;\n    }\n    \n    NSTimeInterval delay = 0;\n    if (!_bufferMiss) {\n        _time += link.duration;\n        delay = [image animatedImageDurationAtIndex:_curIndex];\n        if (_time < delay) return;\n        _time -= delay;\n        if (nextIndex == 0) {\n            _curLoop++;\n            if (_curLoop >= _totalLoop && _totalLoop != 0) {\n                _loopEnd = YES;\n                [self stopAnimating];\n                [self.layer setNeedsDisplay]; // let system call `displayLayer:` before runloop sleep\n                return; // stop at last frame\n            }\n        }\n        delay = [image animatedImageDurationAtIndex:nextIndex];\n        if (_time > delay) _time = delay; // do not jump over frame\n    }\n    LOCK(\n         bufferedImage = buffer[@(nextIndex)];\n         if (bufferedImage) {\n             if ((int)_incrBufferCount < _totalFrameCount) {\n                 [buffer removeObjectForKey:@(nextIndex)];\n             }\n             [self willChangeValueForKey:@\"currentAnimatedImageIndex\"];\n             _curIndex = nextIndex;\n             [self didChangeValueForKey:@\"currentAnimatedImageIndex\"];\n             _curFrame = bufferedImage == (id)[NSNull null] ? nil : bufferedImage;\n             if (_curImageHasContentsRect) {\n                 _curContentsRect = [image animatedImageContentsRectAtIndex:_curIndex];\n                 [self setContentsRect:_curContentsRect forImage:_curFrame];\n             }\n             nextIndex = (_curIndex + 1) % _totalFrameCount;\n             _bufferMiss = NO;\n             if (buffer.count == _totalFrameCount) {\n                 bufferIsFull = YES;\n             }\n         } else {\n             _bufferMiss = YES;\n         }\n    )//LOCK\n    \n    if (!_bufferMiss) {\n        [self.layer setNeedsDisplay]; // let system call `displayLayer:` before runloop sleep\n    }\n    \n    if (!bufferIsFull && _requestQueue.operationCount == 0) { // if some work not finished, wait for next opportunity\n        _YYAnimatedImageViewFetchOperation *operation = [_YYAnimatedImageViewFetchOperation new];\n        operation.view = self;\n        operation.nextIndex = nextIndex;\n        operation.curImage = image;\n        [_requestQueue addOperation:operation];\n    }\n}\n\n- (void)displayLayer:(CALayer *)layer {\n    if (_curFrame) {\n        layer.contents = (__bridge id)_curFrame.CGImage;\n    }\n}\n\n- (void)setContentsRect:(CGRect)rect forImage:(UIImage *)image{\n    CGRect layerRect = CGRectMake(0, 0, 1, 1);\n    if (image) {\n        CGSize imageSize = image.size;\n        if (imageSize.width > 0.01 && imageSize.height > 0.01) {\n            layerRect.origin.x = rect.origin.x / imageSize.width;\n            layerRect.origin.y = rect.origin.y / imageSize.height;\n            layerRect.size.width = rect.size.width / imageSize.width;\n            layerRect.size.height = rect.size.height / imageSize.height;\n            layerRect = CGRectIntersection(layerRect, CGRectMake(0, 0, 1, 1));\n            if (CGRectIsNull(layerRect) || CGRectIsEmpty(layerRect)) {\n                layerRect = CGRectMake(0, 0, 1, 1);\n            }\n        }\n    }\n    [CATransaction begin];\n    [CATransaction setDisableActions:YES];\n    self.layer.contentsRect = layerRect;\n    [CATransaction commit];\n}\n\n- (void)didMoved {\n    if (self.autoPlayAnimatedImage) {\n        if(self.superview && self.window) {\n            [self startAnimating];\n        } else {\n            [self stopAnimating];\n        }\n    }\n}\n\n- (void)didMoveToWindow {\n    [super didMoveToWindow];\n    [self didMoved];\n}\n\n- (void)didMoveToSuperview {\n    [super didMoveToSuperview];\n    [self didMoved];\n}\n\n- (void)setCurrentAnimatedImageIndex:(NSUInteger)currentAnimatedImageIndex {\n    if (!_curAnimatedImage) return;\n    if (currentAnimatedImageIndex >= _curAnimatedImage.animatedImageFrameCount) return;\n    if (_curIndex == currentAnimatedImageIndex) return;\n    \n    void (^block)() = ^{\n        LOCK(\n             [_requestQueue cancelAllOperations];\n             [_buffer removeAllObjects];\n             [self willChangeValueForKey:@\"currentAnimatedImageIndex\"];\n             _curIndex = currentAnimatedImageIndex;\n             [self didChangeValueForKey:@\"currentAnimatedImageIndex\"];\n             _curFrame = [_curAnimatedImage animatedImageFrameAtIndex:_curIndex];\n             if (_curImageHasContentsRect) {\n                 _curContentsRect = [_curAnimatedImage animatedImageContentsRectAtIndex:_curIndex];\n             }\n             _time = 0;\n             _loopEnd = NO;\n             _bufferMiss = NO;\n             [self.layer setNeedsDisplay];\n        )//LOCK\n    };\n    \n    if (pthread_main_np()) {\n        block();\n    } else {\n        dispatch_async(dispatch_get_main_queue(), block);\n    }\n}\n\n- (NSUInteger)currentAnimatedImageIndex {\n    return _curIndex;\n}\n\n- (void)setRunloopMode:(NSString *)runloopMode {\n    if ([_runloopMode isEqual:runloopMode]) return;\n    if (_link) {\n        if (_runloopMode) {\n            [_link removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_runloopMode];\n        }\n        if (runloopMode.length) {\n            [_link addToRunLoop:[NSRunLoop mainRunLoop] forMode:runloopMode];\n        }\n    }\n    _runloopMode = runloopMode.copy;\n}\n\n#pragma mark - Override NSObject(NSKeyValueObservingCustomization)\n\n+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {\n    if ([key isEqualToString:@\"currentAnimatedImageIndex\"]) {\n        return NO;\n    }\n    return [super automaticallyNotifiesObserversForKey:key];\n}\n\n#pragma mark - NSCoding\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    self = [super initWithCoder:aDecoder];\n    _runloopMode = [aDecoder decodeObjectForKey:@\"runloopMode\"];\n    if (_runloopMode.length == 0) _runloopMode = NSRunLoopCommonModes;\n    if ([aDecoder containsValueForKey:@\"autoPlayAnimatedImage\"]) {\n        _autoPlayAnimatedImage = [aDecoder decodeBoolForKey:@\"autoPlayAnimatedImage\"];\n    } else {\n        _autoPlayAnimatedImage = YES;\n    }\n    \n    UIImage *image = [aDecoder decodeObjectForKey:@\"YYAnimatedImage\"];\n    UIImage *highlightedImage = [aDecoder decodeObjectForKey:@\"YYHighlightedAnimatedImage\"];\n    if (image) {\n        self.image = image;\n        [self setImage:image withType:YYAnimatedImageTypeImage];\n    }\n    if (highlightedImage) {\n        self.highlightedImage = highlightedImage;\n        [self setImage:highlightedImage withType:YYAnimatedImageTypeHighlightedImage];\n    }\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [super encodeWithCoder:aCoder];\n    [aCoder encodeObject:_runloopMode forKey:@\"runloopMode\"];\n    [aCoder encodeBool:_autoPlayAnimatedImage forKey:@\"autoPlayAnimatedImage\"];\n    \n    BOOL ani, multi;\n    ani = [self.image conformsToProtocol:@protocol(YYAnimatedImage)];\n    multi = (ani && ((UIImage <YYAnimatedImage> *)self.image).animatedImageFrameCount > 1);\n    if (multi) [aCoder encodeObject:self.image forKey:@\"YYAnimatedImage\"];\n    \n    ani = [self.highlightedImage conformsToProtocol:@protocol(YYAnimatedImage)];\n    multi = (ani && ((UIImage <YYAnimatedImage> *)self.highlightedImage).animatedImageFrameCount > 1);\n    if (multi) [aCoder encodeObject:self.highlightedImage forKey:@\"YYHighlightedAnimatedImage\"];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYFrameImage.h",
    "content": "//\n//  YYFrameImage.h\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 14/12/9.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYImage/YYImage.h>)\n#import <YYImage/YYAnimatedImageView.h>\n#elif __has_include(<YYWebImage/YYImage.h>)\n#import <YYWebImage/YYAnimatedImageView.h>\n#else\n#import \"YYAnimatedImageView.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An image to display frame-based animation.\n \n @discussion It is a fully compatible `UIImage` subclass.\n It only support system image format such as png and jpeg.\n The animation can be played by YYAnimatedImageView.\n \n Sample Code:\n     \n     NSArray *paths = @[@\"/ani/frame1.png\", @\"/ani/frame2.png\", @\"/ani/frame3.png\"];\n     NSArray *times = @[@0.1, @0.2, @0.1];\n     YYFrameImage *image = [YYFrameImage alloc] initWithImagePaths:paths frameDurations:times repeats:YES];\n     YYAnimatedImageView *imageView = [YYAnimatedImageView alloc] initWithImage:image];\n     [view addSubView:imageView];\n */\n@interface YYFrameImage : UIImage <YYAnimatedImage>\n\n/**\n Create a frame animated image from files.\n \n @param paths            An array of NSString objects, contains the full or \n                         partial path to each image file.\n                         e.g. @[@\"/ani/1.png\",@\"/ani/2.png\",@\"/ani/3.png\"]\n \n @param oneFrameDuration The duration (in seconds) per frame.\n \n @param loopCount        The animation loop count, 0 means infinite.\n \n @return An initialized YYFrameImage object, or nil when an error occurs.\n */\n- (nullable instancetype)initWithImagePaths:(NSArray<NSString *> *)paths\n                           oneFrameDuration:(NSTimeInterval)oneFrameDuration\n                                  loopCount:(NSUInteger)loopCount;\n\n/**\n Create a frame animated image from files.\n \n @param paths          An array of NSString objects, contains the full or\n                       partial path to each image file.\n                       e.g. @[@\"/ani/frame1.png\",@\"/ani/frame2.png\",@\"/ani/frame3.png\"]\n \n @param frameDurations An array of NSNumber objects, contains the duration (in seconds) per frame.\n                       e.g. @[@0.1, @0.2, @0.3];\n \n @param loopCount      The animation loop count, 0 means infinite.\n \n @return An initialized YYFrameImage object, or nil when an error occurs.\n */\n- (nullable instancetype)initWithImagePaths:(NSArray<NSString *> *)paths\n                             frameDurations:(NSArray<NSNumber *> *)frameDurations\n                                  loopCount:(NSUInteger)loopCount;\n\n/**\n Create a frame animated image from an array of data.\n \n @param dataArray        An array of NSData objects.\n \n @param oneFrameDuration The duration (in seconds) per frame.\n \n @param loopCount        The animation loop count, 0 means infinite.\n \n @return An initialized YYFrameImage object, or nil when an error occurs.\n */\n- (nullable instancetype)initWithImageDataArray:(NSArray<NSData *> *)dataArray\n                               oneFrameDuration:(NSTimeInterval)oneFrameDuration\n                                      loopCount:(NSUInteger)loopCount;\n\n/**\n Create a frame animated image from an array of data.\n \n @param dataArray      An array of NSData objects.\n \n @param frameDurations An array of NSNumber objects, contains the duration (in seconds) per frame.\n                       e.g. @[@0.1, @0.2, @0.3];\n \n @param loopCount      The animation loop count, 0 means infinite.\n \n @return An initialized YYFrameImage object, or nil when an error occurs.\n */\n- (nullable instancetype)initWithImageDataArray:(NSArray<NSData *> *)dataArray\n                                 frameDurations:(NSArray *)frameDurations\n                                      loopCount:(NSUInteger)loopCount;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYFrameImage.m",
    "content": "//\n//  YYFrameImage.m\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 14/12/9.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYFrameImage.h\"\n#import \"YYImageCoder.h\"\n\n\n/**\n Return the path scale.\n \n e.g.\n <table>\n <tr><th>Path            </th><th>Scale </th></tr>\n <tr><td>\"icon.png\"      </td><td>1     </td></tr>\n <tr><td>\"icon@2x.png\"   </td><td>2     </td></tr>\n <tr><td>\"icon@2.5x.png\" </td><td>2.5   </td></tr>\n <tr><td>\"icon@2x\"       </td><td>1     </td></tr>\n <tr><td>\"icon@2x..png\"  </td><td>1     </td></tr>\n <tr><td>\"icon@2x.png/\"  </td><td>1     </td></tr>\n </table>\n */\nstatic CGFloat _NSStringPathScale(NSString *string) {\n    if (string.length == 0 || [string hasSuffix:@\"/\"]) return 1;\n    NSString *name = string.stringByDeletingPathExtension;\n    __block CGFloat scale = 1;\n    \n    NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:@\"@[0-9]+\\\\.?[0-9]*x$\" options:NSRegularExpressionAnchorsMatchLines error:nil];\n    [pattern enumerateMatchesInString:name options:kNilOptions range:NSMakeRange(0, name.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        if (result.range.location >= 3) {\n            scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue;\n        }\n    }];\n    \n    return scale;\n}\n\n\n\n@implementation YYFrameImage {\n    NSUInteger _loopCount;\n    NSUInteger _oneFrameBytes;\n    NSArray *_imagePaths;\n    NSArray *_imageDatas;\n    NSArray *_frameDurations;\n}\n\n- (instancetype)initWithImagePaths:(NSArray *)paths oneFrameDuration:(NSTimeInterval)oneFrameDuration loopCount:(NSUInteger)loopCount {\n    NSMutableArray *durations = [NSMutableArray new];\n    for (int i = 0, max = (int)paths.count; i < max; i++) {\n        [durations addObject:@(oneFrameDuration)];\n    }\n    return [self initWithImagePaths:paths frameDurations:durations loopCount:loopCount];\n}\n\n- (instancetype)initWithImagePaths:(NSArray *)paths frameDurations:(NSArray *)frameDurations loopCount:(NSUInteger)loopCount {\n    if (paths.count == 0) return nil;\n    if (paths.count != frameDurations.count) return nil;\n    \n    NSString *firstPath = paths[0];\n    NSData *firstData = [NSData dataWithContentsOfFile:firstPath];\n    CGFloat scale = _NSStringPathScale(firstPath);\n    UIImage *firstCG = [[[UIImage alloc] initWithData:firstData] yy_imageByDecoded];\n    self = [self initWithCGImage:firstCG.CGImage scale:scale orientation:UIImageOrientationUp];\n    if (!self) return nil;\n    long frameByte = CGImageGetBytesPerRow(firstCG.CGImage) * CGImageGetHeight(firstCG.CGImage);\n    _oneFrameBytes = (NSUInteger)frameByte;\n    _imagePaths = paths.copy;\n    _frameDurations = frameDurations.copy;\n    _loopCount = loopCount;\n    \n    return self;\n}\n\n- (instancetype)initWithImageDataArray:(NSArray *)dataArray oneFrameDuration:(NSTimeInterval)oneFrameDuration loopCount:(NSUInteger)loopCount {\n    NSMutableArray *durations = [NSMutableArray new];\n    for (int i = 0, max = (int)dataArray.count; i < max; i++) {\n        [durations addObject:@(oneFrameDuration)];\n    }\n    return [self initWithImageDataArray:dataArray frameDurations:durations loopCount:loopCount];\n}\n\n- (instancetype)initWithImageDataArray:(NSArray *)dataArray frameDurations:(NSArray *)frameDurations loopCount:(NSUInteger)loopCount {\n    if (dataArray.count == 0) return nil;\n    if (dataArray.count != frameDurations.count) return nil;\n    \n    NSData *firstData = dataArray[0];\n    CGFloat scale = [UIScreen mainScreen].scale;\n    UIImage *firstCG = [[[UIImage alloc] initWithData:firstData] yy_imageByDecoded];\n    self = [self initWithCGImage:firstCG.CGImage scale:scale orientation:UIImageOrientationUp];\n    if (!self) return nil;\n    long frameByte = CGImageGetBytesPerRow(firstCG.CGImage) * CGImageGetHeight(firstCG.CGImage);\n    _oneFrameBytes = (NSUInteger)frameByte;\n    _imageDatas = dataArray.copy;\n    _frameDurations = frameDurations.copy;\n    _loopCount = loopCount;\n    \n    return self;\n}\n\n#pragma mark - YYAnimtedImage\n\n- (NSUInteger)animatedImageFrameCount {\n    if (_imagePaths) {\n        return _imagePaths.count;\n    } else if (_imageDatas) {\n        return _imageDatas.count;\n    } else {\n        return 1;\n    }\n}\n\n- (NSUInteger)animatedImageLoopCount {\n    return _loopCount;\n}\n\n- (NSUInteger)animatedImageBytesPerFrame {\n    return _oneFrameBytes;\n}\n\n- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {\n    if (_imagePaths) {\n        if (index >= _imagePaths.count) return nil;\n        NSString *path = _imagePaths[index];\n        CGFloat scale = _NSStringPathScale(path);\n        NSData *data = [NSData dataWithContentsOfFile:path];\n        return [[UIImage imageWithData:data scale:scale] yy_imageByDecoded];\n    } else if (_imageDatas) {\n        if (index >= _imageDatas.count) return nil;\n        NSData *data = _imageDatas[index];\n        return [[UIImage imageWithData:data scale:[UIScreen mainScreen].scale] yy_imageByDecoded];\n    } else {\n        return index == 0 ? self : nil;\n    }\n}\n\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index {\n    if (index >= _frameDurations.count) return 0;\n    NSNumber *num = _frameDurations[index];\n    return [num doubleValue];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYImage.h",
    "content": "//\n//  YYImage.h\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 14/10/20.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYImage/YYImage.h>)\nFOUNDATION_EXPORT double YYImageVersionNumber;\nFOUNDATION_EXPORT const unsigned char YYImageVersionString[];\n#import <YYImage/YYFrameImage.h>\n#import <YYImage/YYSpriteSheetImage.h>\n#import <YYImage/YYImageCoder.h>\n#import <YYImage/YYAnimatedImageView.h>\n#elif __has_include(<YYWebImage/YYImage.h>)\n#import <YYWebImage/YYFrameImage.h>\n#import <YYWebImage/YYSpriteSheetImage.h>\n#import <YYWebImage/YYImageCoder.h>\n#import <YYWebImage/YYAnimatedImageView.h>\n#else\n#import \"YYFrameImage.h\"\n#import \"YYSpriteSheetImage.h\"\n#import \"YYImageCoder.h\"\n#import \"YYAnimatedImageView.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n\n/**\n A YYImage object is a high-level way to display animated image data.\n \n @discussion It is a fully compatible `UIImage` subclass. It extends the UIImage\n to support animated WebP, APNG and GIF format image data decoding. It also \n support NSCoding protocol to archive and unarchive multi-frame image data.\n \n If the image is created from multi-frame image data, and you want to play the \n animation, try replace UIImageView with `YYAnimatedImageView`.\n \n Sample Code:\n \n     // animation@3x.webp\n     YYImage *image = [YYImage imageNamed:@\"animation.webp\"];\n     YYAnimatedImageView *imageView = [YYAnimatedImageView alloc] initWithImage:image];\n     [view addSubView:imageView];\n    \n */\n@interface YYImage : UIImage <YYAnimatedImage>\n\n+ (nullable YYImage *)imageNamed:(NSString *)name; // no cache!\n+ (nullable YYImage *)imageWithContentsOfFile:(NSString *)path;\n+ (nullable YYImage *)imageWithData:(NSData *)data;\n+ (nullable YYImage *)imageWithData:(NSData *)data scale:(CGFloat)scale;\n\n/**\n If the image is created from data or file, then the value indicates the data type.\n */\n@property (nonatomic, readonly) YYImageType animatedImageType;\n\n/**\n If the image is created from animated image data (multi-frame GIF/APNG/WebP),\n this property stores the original image data.\n */\n@property (nullable, nonatomic, readonly) NSData *animatedImageData;\n\n/**\n The total memory usage (in bytes) if all frame images was loaded into memory.\n The value is 0 if the image is not created from a multi-frame image data.\n */\n@property (nonatomic, readonly) NSUInteger animatedImageMemorySize;\n\n/**\n Preload all frame image to memory.\n \n @discussion Set this property to `YES` will block the calling thread to decode \n all animation frame image to memory, set to `NO` will release the preloaded frames.\n If the image is shared by lots of image views (such as emoticon), preload all\n frames will reduce the CPU cost.\n \n See `animatedImageMemorySize` for memory cost.\n */\n@property (nonatomic) BOOL preloadAllAnimatedImageFrames;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYImage.m",
    "content": "//\n//  YYImage.m\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 14/10/20.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYImage.h\"\n\n/**\n An array of NSNumber objects, shows the best order for path scale search.\n e.g. iPhone3GS:@[@1,@2,@3] iPhone5:@[@2,@3,@1]  iPhone6 Plus:@[@3,@2,@1]\n */\nstatic NSArray *_NSBundlePreferredScales() {\n    static NSArray *scales;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        CGFloat screenScale = [UIScreen mainScreen].scale;\n        if (screenScale <= 1) {\n            scales = @[@1,@2,@3];\n        } else if (screenScale <= 2) {\n            scales = @[@2,@3,@1];\n        } else {\n            scales = @[@3,@2,@1];\n        }\n    });\n    return scales;\n}\n\n/**\n Add scale modifier to the file name (without path extension),\n From @\"name\" to @\"name@2x\".\n \n e.g.\n <table>\n <tr><th>Before     </th><th>After(scale:2)</th></tr>\n <tr><td>\"icon\"     </td><td>\"icon@2x\"     </td></tr>\n <tr><td>\"icon \"    </td><td>\"icon @2x\"    </td></tr>\n <tr><td>\"icon.top\" </td><td>\"icon.top@2x\" </td></tr>\n <tr><td>\"/p/name\"  </td><td>\"/p/name@2x\"  </td></tr>\n <tr><td>\"/path/\"   </td><td>\"/path/\"      </td></tr>\n </table>\n \n @param scale Resource scale.\n @return String by add scale modifier, or just return if it's not end with file name.\n */\nstatic NSString *_NSStringByAppendingNameScale(NSString *string, CGFloat scale) {\n    if (!string) return nil;\n    if (fabs(scale - 1) <= __FLT_EPSILON__ || string.length == 0 || [string hasSuffix:@\"/\"]) return string.copy;\n    return [string stringByAppendingFormat:@\"@%@x\", @(scale)];\n}\n\n/**\n Return the path scale.\n \n e.g.\n <table>\n <tr><th>Path            </th><th>Scale </th></tr>\n <tr><td>\"icon.png\"      </td><td>1     </td></tr>\n <tr><td>\"icon@2x.png\"   </td><td>2     </td></tr>\n <tr><td>\"icon@2.5x.png\" </td><td>2.5   </td></tr>\n <tr><td>\"icon@2x\"       </td><td>1     </td></tr>\n <tr><td>\"icon@2x..png\"  </td><td>1     </td></tr>\n <tr><td>\"icon@2x.png/\"  </td><td>1     </td></tr>\n </table>\n */\nstatic CGFloat _NSStringPathScale(NSString *string) {\n    if (string.length == 0 || [string hasSuffix:@\"/\"]) return 1;\n    NSString *name = string.stringByDeletingPathExtension;\n    __block CGFloat scale = 1;\n    \n    NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:@\"@[0-9]+\\\\.?[0-9]*x$\" options:NSRegularExpressionAnchorsMatchLines error:nil];\n    [pattern enumerateMatchesInString:name options:kNilOptions range:NSMakeRange(0, name.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        if (result.range.location >= 3) {\n            scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue;\n        }\n    }];\n    \n    return scale;\n}\n\n\n@implementation YYImage {\n    YYImageDecoder *_decoder;\n    NSArray *_preloadedFrames;\n    dispatch_semaphore_t _preloadedLock;\n    NSUInteger _bytesPerFrame;\n}\n\n+ (YYImage *)imageNamed:(NSString *)name {\n    if (name.length == 0) return nil;\n    if ([name hasSuffix:@\"/\"]) return nil;\n    \n    NSString *res = name.stringByDeletingPathExtension;\n    NSString *ext = name.pathExtension;\n    NSString *path = nil;\n    CGFloat scale = 1;\n    \n    // If no extension, guess by system supported (same as UIImage).\n    NSArray *exts = ext.length > 0 ? @[ext] : @[@\"\", @\"png\", @\"jpeg\", @\"jpg\", @\"gif\", @\"webp\", @\"apng\"];\n    NSArray *scales = _NSBundlePreferredScales();\n    for (int s = 0; s < scales.count; s++) {\n        scale = ((NSNumber *)scales[s]).floatValue;\n        NSString *scaledName = _NSStringByAppendingNameScale(res, scale);\n        for (NSString *e in exts) {\n            path = [[NSBundle mainBundle] pathForResource:scaledName ofType:e];\n            if (path) break;\n        }\n        if (path) break;\n    }\n    if (path.length == 0) return nil;\n    \n    NSData *data = [NSData dataWithContentsOfFile:path];\n    if (data.length == 0) return nil;\n    \n    return [[self alloc] initWithData:data scale:scale];\n}\n\n+ (YYImage *)imageWithContentsOfFile:(NSString *)path {\n    return [[self alloc] initWithContentsOfFile:path];\n}\n\n+ (YYImage *)imageWithData:(NSData *)data {\n    return [[self alloc] initWithData:data];\n}\n\n+ (YYImage *)imageWithData:(NSData *)data scale:(CGFloat)scale {\n    return [[self alloc] initWithData:data scale:scale];\n}\n\n- (instancetype)initWithContentsOfFile:(NSString *)path {\n    NSData *data = [NSData dataWithContentsOfFile:path];\n    return [self initWithData:data scale:_NSStringPathScale(path)];\n}\n\n- (instancetype)initWithData:(NSData *)data {\n    return [self initWithData:data scale:1];\n}\n\n- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale {\n    if (data.length == 0) return nil;\n    if (scale <= 0) scale = [UIScreen mainScreen].scale;\n    _preloadedLock = dispatch_semaphore_create(1);\n    @autoreleasepool {\n        YYImageDecoder *decoder = [YYImageDecoder decoderWithData:data scale:scale];\n        YYImageFrame *frame = [decoder frameAtIndex:0 decodeForDisplay:YES];\n        UIImage *image = frame.image;\n        if (!image) return nil;\n        self = [self initWithCGImage:image.CGImage scale:decoder.scale orientation:image.imageOrientation];\n        if (!self) return nil;\n        _animatedImageType = decoder.type;\n        if (decoder.frameCount > 1) {\n            _decoder = decoder;\n            _bytesPerFrame = CGImageGetBytesPerRow(image.CGImage) * CGImageGetHeight(image.CGImage);\n            _animatedImageMemorySize = _bytesPerFrame * decoder.frameCount;\n        }\n        self.yy_isDecodedForDisplay = YES;\n    }\n    return self;\n}\n\n- (NSData *)animatedImageData {\n    return _decoder.data;\n}\n\n- (void)setPreloadAllAnimatedImageFrames:(BOOL)preloadAllAnimatedImageFrames {\n    if (_preloadAllAnimatedImageFrames != preloadAllAnimatedImageFrames) {\n        if (preloadAllAnimatedImageFrames && _decoder.frameCount > 0) {\n            NSMutableArray *frames = [NSMutableArray new];\n            for (NSUInteger i = 0, max = _decoder.frameCount; i < max; i++) {\n                UIImage *img = [self animatedImageFrameAtIndex:i];\n                if (img) {\n                    [frames addObject:img];\n                } else {\n                    [frames addObject:[NSNull null]];\n                }\n            }\n            dispatch_semaphore_wait(_preloadedLock, DISPATCH_TIME_FOREVER);\n            _preloadedFrames = frames;\n            dispatch_semaphore_signal(_preloadedLock);\n        } else {\n            dispatch_semaphore_wait(_preloadedLock, DISPATCH_TIME_FOREVER);\n            _preloadedFrames = nil;\n            dispatch_semaphore_signal(_preloadedLock);\n        }\n    }\n}\n\n#pragma mark - protocol NSCoding\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    NSNumber *scale = [aDecoder decodeObjectForKey:@\"YYImageScale\"];\n    NSData *data = [aDecoder decodeObjectForKey:@\"YYImageData\"];\n    if (data.length) {\n        self = [self initWithData:data scale:scale.doubleValue];\n    } else {\n        self = [super initWithCoder:aDecoder];\n    }\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    if (_decoder.data.length) {\n        [aCoder encodeObject:@(self.scale) forKey:@\"YYImageScale\"];\n        [aCoder encodeObject:_decoder.data forKey:@\"YYImageData\"];\n    } else {\n        [super encodeWithCoder:aCoder]; // Apple use UIImagePNGRepresentation() to encode UIImage.\n    }\n}\n\n#pragma mark - protocol YYAnimatedImage\n\n- (NSUInteger)animatedImageFrameCount {\n    return _decoder.frameCount;\n}\n\n- (NSUInteger)animatedImageLoopCount {\n    return _decoder.loopCount;\n}\n\n- (NSUInteger)animatedImageBytesPerFrame {\n    return _bytesPerFrame;\n}\n\n- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {\n    if (index >= _decoder.frameCount) return nil;\n    dispatch_semaphore_wait(_preloadedLock, DISPATCH_TIME_FOREVER);\n    UIImage *image = _preloadedFrames[index];\n    dispatch_semaphore_signal(_preloadedLock);\n    if (image) return image == (id)[NSNull null] ? nil : image;\n    return [_decoder frameAtIndex:index decodeForDisplay:YES].image;\n}\n\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index {\n    NSTimeInterval duration = [_decoder frameDurationAtIndex:index];\n    \n    /*\n     http://opensource.apple.com/source/WebCore/WebCore-7600.1.25/platform/graphics/cg/ImageSourceCG.cpp\n     Many annoying ads specify a 0 duration to make an image flash as quickly as \n     possible. We follow Safari and Firefox's behavior and use a duration of 100 ms \n     for any frames that specify a duration of <= 10 ms.\n     See <rdar://problem/7689300> and <http://webkit.org/b/36082> for more information.\n     \n     See also: http://nullsleep.tumblr.com/post/16524517190/animated-gif-minimum-frame-delay-browser.\n     */\n    if (duration < 0.011f) return 0.100f;\n    return duration;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYImageCoder.h",
    "content": "//\n//  YYImageCoder.h\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 15/5/13.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Image file type.\n */\ntypedef NS_ENUM(NSUInteger, YYImageType) {\n    YYImageTypeUnknown = 0, ///< unknown\n    YYImageTypeJPEG,        ///< jpeg, jpg\n    YYImageTypeJPEG2000,    ///< jp2\n    YYImageTypeTIFF,        ///< tiff, tif\n    YYImageTypeBMP,         ///< bmp\n    YYImageTypeICO,         ///< ico\n    YYImageTypeICNS,        ///< icns\n    YYImageTypeGIF,         ///< gif\n    YYImageTypePNG,         ///< png\n    YYImageTypeWebP,        ///< webp\n    YYImageTypeOther,       ///< other image format\n};\n\n\n/**\n Dispose method specifies how the area used by the current frame is to be treated\n before rendering the next frame on the canvas.\n */\ntypedef NS_ENUM(NSUInteger, YYImageDisposeMethod) {\n    \n    /**\n     No disposal is done on this frame before rendering the next; the contents\n     of the canvas are left as is.\n     */\n    YYImageDisposeNone = 0,\n    \n    /**\n     The frame's region of the canvas is to be cleared to fully transparent black\n     before rendering the next frame.\n     */\n    YYImageDisposeBackground,\n    \n    /**\n     The frame's region of the canvas is to be reverted to the previous contents\n     before rendering the next frame.\n     */\n    YYImageDisposePrevious,\n};\n\n/**\n Blend operation specifies how transparent pixels of the current frame are\n blended with those of the previous canvas.\n */\ntypedef NS_ENUM(NSUInteger, YYImageBlendOperation) {\n    \n    /**\n     All color components of the frame, including alpha, overwrite the current\n     contents of the frame's canvas region.\n     */\n    YYImageBlendNone = 0,\n    \n    /**\n     The frame should be composited onto the output buffer based on its alpha.\n     */\n    YYImageBlendOver,\n};\n\n/**\n An image frame object.\n */\n@interface YYImageFrame : NSObject <NSCopying>\n@property (nonatomic) NSUInteger index;    ///< Frame index (zero based)\n@property (nonatomic) NSUInteger width;    ///< Frame width\n@property (nonatomic) NSUInteger height;   ///< Frame height\n@property (nonatomic) NSUInteger offsetX;  ///< Frame origin.x in canvas (left-bottom based)\n@property (nonatomic) NSUInteger offsetY;  ///< Frame origin.y in canvas (left-bottom based)\n@property (nonatomic) NSTimeInterval duration;          ///< Frame duration in seconds\n@property (nonatomic) YYImageDisposeMethod dispose;     ///< Frame dispose method.\n@property (nonatomic) YYImageBlendOperation blend;      ///< Frame blend operation.\n@property (nullable, nonatomic, strong) UIImage *image; ///< The image.\n+ (instancetype)frameWithImage:(UIImage *)image;\n@end\n\n\n#pragma mark - Decoder\n\n/**\n An image decoder to decode image data.\n \n @discussion This class supports decoding animated WebP, APNG, GIF and system\n image format such as PNG, JPG, JP2, BMP, TIFF, PIC, ICNS and ICO. It can be used \n to decode complete image data, or to decode incremental image data during image \n download. This class is thread-safe.\n \n Example:\n \n    // Decode single image:\n    NSData *data = [NSData dataWithContentOfFile:@\"/tmp/image.webp\"];\n    YYImageDecoder *decoder = [YYImageDecoder decoderWithData:data scale:2.0];\n    UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n \n    // Decode image during download:\n    NSMutableData *data = [NSMutableData new];\n    YYImageDecoder *decoder = [[YYImageDecoder alloc] initWithScale:2.0];\n    while(newDataArrived) {\n        [data appendData:newData];\n        [decoder updateData:data final:NO];\n        if (decoder.frameCount > 0) {\n            UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n            // progressive display...\n        }\n    }\n    [decoder updateData:data final:YES];\n    UIImage image = [decoder frameAtIndex:0 decodeForDisplay:YES].image;\n    // final display...\n \n */\n@interface YYImageDecoder : NSObject\n\n@property (nullable, nonatomic, readonly) NSData *data;    ///< Image data.\n@property (nonatomic, readonly) YYImageType type;          ///< Image data type.\n@property (nonatomic, readonly) CGFloat scale;             ///< Image scale.\n@property (nonatomic, readonly) NSUInteger frameCount;     ///< Image frame count.\n@property (nonatomic, readonly) NSUInteger loopCount;      ///< Image loop count, 0 means infinite.\n@property (nonatomic, readonly) NSUInteger width;          ///< Image canvas width.\n@property (nonatomic, readonly) NSUInteger height;         ///< Image canvas height.\n@property (nonatomic, readonly, getter=isFinalized) BOOL finalized;\n\n/**\n Creates an image decoder.\n \n @param scale  Image's scale.\n @return An image decoder.\n */\n- (instancetype)initWithScale:(CGFloat)scale NS_DESIGNATED_INITIALIZER;\n\n/**\n Updates the incremental image with new data.\n \n @discussion You can use this method to decode progressive/interlaced/baseline\n image when you do not have the complete image data. The `data` was retained by\n decoder, you should not modify the data in other thread during decoding.\n \n @param data  The data to add to the image decoder. Each time you call this \n function, the 'data' parameter must contain all of the image file data \n accumulated so far.\n \n @param final  A value that specifies whether the data is the final set. \n Pass YES if it is, NO otherwise. When the data is already finalized, you can\n not update the data anymore.\n \n @return Whether succeed.\n */\n- (BOOL)updateData:(nullable NSData *)data final:(BOOL)final;\n\n/**\n Convenience method to create a decoder with specified data.\n @param data  Image data.\n @param scale Image's scale.\n @return A new decoder, or nil if an error occurs.\n */\n+ (nullable instancetype)decoderWithData:(NSData *)data scale:(CGFloat)scale;\n\n/**\n Decodes and returns a frame from a specified index.\n @param index  Frame image index (zero-based).\n @param decodeForDisplay Whether decode the image to memory bitmap for display.\n    If NO, it will try to returns the original frame data without blend.\n @return A new frame with image, or nil if an error occurs.\n */\n- (nullable YYImageFrame *)frameAtIndex:(NSUInteger)index decodeForDisplay:(BOOL)decodeForDisplay;\n\n/**\n Returns the frame duration from a specified index.\n @param index  Frame image (zero-based).\n @return Duration in seconds.\n */\n- (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index;\n\n/**\n Returns the frame's properties. See \"CGImageProperties.h\" in ImageIO.framework\n for more information.\n \n @param index  Frame image index (zero-based).\n @return The ImageIO frame property.\n */\n- (nullable NSDictionary *)framePropertiesAtIndex:(NSUInteger)index;\n\n/**\n Returns the image's properties. See \"CGImageProperties.h\" in ImageIO.framework\n for more information.\n */\n- (nullable NSDictionary *)imageProperties;\n\n@end\n\n\n\n#pragma mark - Encoder\n\n/**\n An image encoder to encode image to data.\n \n @discussion It supports encoding single frame image with the type defined in YYImageType.\n It also supports encoding multi-frame image with GIF, APNG and WebP.\n \n Example:\n    \n    YYImageEncoder *jpegEncoder = [[YYImageEncoder alloc] initWithType:YYImageTypeJPEG];\n    jpegEncoder.quality = 0.9;\n    [jpegEncoder addImage:image duration:0];\n    NSData jpegData = [jpegEncoder encode];\n \n    YYImageEncoder *gifEncoder = [[YYImageEncoder alloc] initWithType:YYImageTypeGIF];\n    gifEncoder.loopCount = 5;\n    [gifEncoder addImage:image0 duration:0.1];\n    [gifEncoder addImage:image1 duration:0.15];\n    [gifEncoder addImage:image2 duration:0.2];\n    NSData gifData = [gifEncoder encode];\n \n @warning It just pack the images together when encoding multi-frame image. If you\n want to reduce the image file size, try imagemagick/ffmpeg for GIF and WebP,\n and apngasm for APNG.\n */\n@interface YYImageEncoder : NSObject\n\n@property (nonatomic, readonly) YYImageType type; ///< Image type.\n@property (nonatomic) NSUInteger loopCount;       ///< Loop count, 0 means infinit, only available for GIF/APNG/WebP.\n@property (nonatomic) BOOL lossless;              ///< Lossless, only available for WebP.\n@property (nonatomic) CGFloat quality;            ///< Compress quality, 0.0~1.0, only available for JPG/JP2/WebP.\n\n- (instancetype)init UNAVAILABLE_ATTRIBUTE;\n+ (instancetype)new UNAVAILABLE_ATTRIBUTE;\n\n/**\n Create an image encoder with a specified type.\n @param type Image type.\n @return A new encoder, or nil if an error occurs.\n */\n- (nullable instancetype)initWithType:(YYImageType)type NS_DESIGNATED_INITIALIZER;\n\n/**\n Add an image to encoder.\n @param image    Image.\n @param duration Image duration for animation. Pass 0 to ignore this parameter.\n */\n- (void)addImage:(UIImage *)image duration:(NSTimeInterval)duration;\n\n/**\n Add an image with image data to encoder.\n @param data    Image data.\n @param duration Image duration for animation. Pass 0 to ignore this parameter.\n */\n- (void)addImageWithData:(NSData *)data duration:(NSTimeInterval)duration;\n\n/**\n Add an image from a file path to encoder.\n @param image    Image file path.\n @param duration Image duration for animation. Pass 0 to ignore this parameter.\n */\n- (void)addImageWithFile:(NSString *)path duration:(NSTimeInterval)duration;\n\n/**\n Encodes the image and returns the image data.\n @return The image data, or nil if an error occurs.\n */\n- (nullable NSData *)encode;\n\n/**\n Encodes the image to a file.\n @param path The file path (overwrite if exist).\n @return Whether succeed.\n */\n- (BOOL)encodeToFile:(NSString *)path;\n\n/**\n Convenience method to encode single frame image.\n @param image   The image.\n @param type    The destination image type.\n @param quality Image quality, 0.0~1.0.\n @return The image data, or nil if an error occurs.\n */\n+ (nullable NSData *)encodeImage:(UIImage *)image type:(YYImageType)type quality:(CGFloat)quality;\n\n/**\n Convenience method to encode image from a decoder.\n @param decoder The image decoder.\n @param type    The destination image type;\n @param quality Image quality, 0.0~1.0.\n @return The image data, or nil if an error occurs.\n */\n+ (nullable NSData *)encodeImageWithDecoder:(YYImageDecoder *)decoder type:(YYImageType)type quality:(CGFloat)quality;\n\n@end\n\n\n#pragma mark - UIImage\n\n@interface UIImage (YYImageCoder)\n\n/**\n Decompress this image to bitmap, so when the image is displayed on screen, \n the main thread won't be blocked by additional decode. If the image has already\n been decoded or unable to decode, it just returns itself.\n \n @return an image decoded, or just return itself if no needed.\n @see yy_isDecodedForDisplay\n */\n- (instancetype)yy_imageByDecoded;\n\n/**\n Wherher the image can be display on screen without additional decoding.\n @warning It just a hint for your code, change it has no other effect.\n */\n@property (nonatomic) BOOL yy_isDecodedForDisplay;\n\n/**\n Saves this image to iOS Photos Album. \n \n @discussion  This method attempts to save the original data to album if the\n image is created from an animated GIF/APNG, otherwise, it will save the image \n as JPEG or PNG (based on the alpha information).\n \n @param completionBlock The block invoked (in main thread) after the save operation completes.\n    assetURL: An URL that identifies the saved image file. If the image is not saved, assetURL is nil.\n    error: If the image is not saved, an error object that describes the reason for failure, otherwise nil.\n */\n- (void)yy_saveToAlbumWithCompletionBlock:(nullable void(^)(NSURL * _Nullable assetURL, NSError * _Nullable error))completionBlock;\n\n/**\n Return a 'best' data representation for this image.\n \n @discussion The convertion based on these rule:\n 1. If the image is created from an animated GIF/APNG/WebP, it returns the original data.\n 2. It returns PNG or JPEG(0.9) representation based on the alpha information.\n \n @return Image data, or nil if an error occurs.\n */\n- (nullable NSData *)yy_imageDataRepresentation;\n\n@end\n\n\n\n#pragma mark - Helper\n\n/// Detect a data's image type by reading the data's header 16 bytes (very fast).\nCG_EXTERN YYImageType YYImageDetectType(CFDataRef data);\n\n/// Convert YYImageType to UTI (such as kUTTypeJPEG).\nCG_EXTERN CFStringRef _Nullable YYImageTypeToUTType(YYImageType type);\n\n/// Convert UTI (such as kUTTypeJPEG) to YYImageType.\nCG_EXTERN YYImageType YYImageTypeFromUTType(CFStringRef uti);\n\n/// Get image type's file extension (such as @\"jpg\").\nCG_EXTERN NSString *_Nullable YYImageTypeGetExtension(YYImageType type);\n\n\n\n/// Returns the shared DeviceRGB color space.\nCG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceRGB();\n\n/// Returns the shared DeviceGray color space.\nCG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceGray();\n\n/// Returns whether a color space is DeviceRGB.\nCG_EXTERN BOOL YYCGColorSpaceIsDeviceRGB(CGColorSpaceRef space);\n\n/// Returns whether a color space is DeviceGray.\nCG_EXTERN BOOL YYCGColorSpaceIsDeviceGray(CGColorSpaceRef space);\n\n\n\n/// Convert EXIF orientation value to UIImageOrientation.\nCG_EXTERN UIImageOrientation YYUIImageOrientationFromEXIFValue(NSInteger value);\n\n/// Convert UIImageOrientation to EXIF orientation value.\nCG_EXTERN NSInteger YYUIImageOrientationToEXIFValue(UIImageOrientation orientation);\n\n\n\n/**\n Create a decoded image.\n \n @discussion If the source image is created from a compressed image data (such as\n PNG or JPEG), you can use this method to decode the image. After decoded, you can\n access the decoded bytes with CGImageGetDataProvider() and CGDataProviderCopyData()\n without additional decode process. If the image has already decoded, this method\n just copy the decoded bytes to the new image.\n \n @param imageRef          The source image.\n @param decodeForDisplay  If YES, this method will decode the image and convert\n          it to BGRA8888 (premultiplied) or BGRX8888 format for CALayer display.\n \n @return A decoded image, or NULL if an error occurs.\n */\nCG_EXTERN CGImageRef _Nullable YYCGImageCreateDecodedCopy(CGImageRef imageRef, BOOL decodeForDisplay);\n\n/**\n Create an image copy with an orientation.\n \n @param imageRef       Source image\n @param orientation    Image orientation which will applied to the image.\n @param destBitmapInfo Destimation image bitmap, only support 32bit format (such as ARGB8888).\n @return A new image, or NULL if an error occurs.\n */\nCG_EXTERN CGImageRef _Nullable YYCGImageCreateCopyWithOrientation(CGImageRef imageRef,\n                                                                  UIImageOrientation orientation,\n                                                                  CGBitmapInfo destBitmapInfo);\n\n/**\n Create an image copy with CGAffineTransform.\n \n @param imageRef       Source image.\n @param transform      Transform applied to image (left-bottom based coordinate system).\n @param destSize       Destination image size\n @param destBitmapInfo Destimation image bitmap, only support 32bit format (such as ARGB8888).\n @return A new image, or NULL if an error occurs.\n */\nCG_EXTERN CGImageRef _Nullable YYCGImageCreateAffineTransformCopy(CGImageRef imageRef,\n                                                                  CGAffineTransform transform,\n                                                                  CGSize destSize,\n                                                                  CGBitmapInfo destBitmapInfo);\n\n/**\n Encode an image to data with CGImageDestination.\n \n @param imageRef  The image.\n @param type      The image destination data type.\n @param quality   The quality (0.0~1.0)\n @return A new image data, or nil if an error occurs.\n */\nCG_EXTERN CFDataRef _Nullable YYCGImageCreateEncodedData(CGImageRef imageRef, YYImageType type, CGFloat quality);\n\n\n/**\n Whether WebP is available in YYImage.\n */\nCG_EXTERN BOOL YYImageWebPAvailable();\n\n/**\n Get a webp image frame count;\n \n @param webpData WebP data.\n @return Image frame count, or 0 if an error occurs.\n */\nCG_EXTERN NSUInteger YYImageGetWebPFrameCount(CFDataRef webpData);\n\n/**\n Decode an image from WebP data, returns NULL if an error occurs.\n \n @param webpData          The WebP data.\n @param decodeForDisplay  If YES, this method will decode the image and convert it\n                            to BGRA8888 (premultiplied) format for CALayer display.\n @param useThreads        YES to enable multi-thread decode.\n                            (speed up, but cost more CPU)\n @param bypassFiltering   YES to skip the in-loop filtering.\n                            (speed up, but may lose some smooth)\n @param noFancyUpsampling YES to use faster pointwise upsampler.\n                            (speed down, and may lose some details).\n @return The decoded image, or NULL if an error occurs.\n */\nCG_EXTERN CGImageRef _Nullable YYCGImageCreateWithWebPData(CFDataRef webpData,\n                                                           BOOL decodeForDisplay,\n                                                           BOOL useThreads,\n                                                           BOOL bypassFiltering,\n                                                           BOOL noFancyUpsampling);\n\ntypedef NS_ENUM(NSUInteger, YYImagePreset) {\n    YYImagePresetDefault = 0,  ///< default preset.\n    YYImagePresetPicture,      ///< digital picture, like portrait, inner shot\n    YYImagePresetPhoto,        ///< outdoor photograph, with natural lighting\n    YYImagePresetDrawing,      ///< hand or line drawing, with high-contrast details\n    YYImagePresetIcon,         ///< small-sized colorful images\n    YYImagePresetText          ///< text-like\n};\n\n/**\n Encode a CGImage to WebP data\n \n @param imageRef      image\n @param lossless      YES=lossless (similar to PNG), NO=lossy (similar to JPEG)\n @param quality       0.0~1.0 (0=smallest file, 1.0=biggest file)\n                      For lossless image, try the value near 1.0; for lossy, try the value near 0.8.\n @param compressLevel 0~6 (0=fast, 6=slower-better). Default is 4.\n @param preset        Preset for different image type, default is YYImagePresetDefault.\n @return WebP data, or nil if an error occurs.\n */\nCG_EXTERN CFDataRef _Nullable YYCGImageCreateEncodedWebPData(CGImageRef imageRef,\n                                                             BOOL lossless,\n                                                             CGFloat quality,\n                                                             int compressLevel,\n                                                             YYImagePreset preset);\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYImageCoder.m",
    "content": "//\n//  YYImageCoder.m\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 15/5/13.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYImageCoder.h\"\n#import \"YYImage.h\"\n#import <CoreFoundation/CoreFoundation.h>\n#import <ImageIO/ImageIO.h>\n#import <Accelerate/Accelerate.h>\n#import <QuartzCore/QuartzCore.h>\n#import <MobileCoreServices/MobileCoreServices.h>\n#import <AssetsLibrary/AssetsLibrary.h>\n#import <objc/runtime.h>\n#import <pthread.h>\n#import <zlib.h>\n\n\n\n#ifndef YYIMAGE_WEBP_ENABLED\n#if __has_include(<webp/decode.h>) && __has_include(<webp/encode.h>) && \\\n    __has_include(<webp/demux.h>)  && __has_include(<webp/mux.h>)\n#define YYIMAGE_WEBP_ENABLED 1\n#import <webp/decode.h>\n#import <webp/encode.h>\n#import <webp/demux.h>\n#import <webp/mux.h>\n#elif __has_include(\"webp/decode.h\") && __has_include(\"webp/encode.h\") && \\\n      __has_include(\"webp/demux.h\")  && __has_include(\"webp/mux.h\")\n#define YYIMAGE_WEBP_ENABLED 1\n#import \"webp/decode.h\"\n#import \"webp/encode.h\"\n#import \"webp/demux.h\"\n#import \"webp/mux.h\"\n#else\n#define YYIMAGE_WEBP_ENABLED 0\n#endif\n#endif\n\n\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n#pragma mark - Utility (for little endian platform)\n\n#define YY_FOUR_CC(c1,c2,c3,c4) ((uint32_t)(((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1)))\n#define YY_TWO_CC(c1,c2) ((uint16_t)(((c2) << 8) | (c1)))\n\nstatic inline uint16_t yy_swap_endian_uint16(uint16_t value) {\n    return\n    (uint16_t) ((value & 0x00FF) << 8) |\n    (uint16_t) ((value & 0xFF00) >> 8) ;\n}\n\nstatic inline uint32_t yy_swap_endian_uint32(uint32_t value) {\n    return\n    (uint32_t)((value & 0x000000FFU) << 24) |\n    (uint32_t)((value & 0x0000FF00U) <<  8) |\n    (uint32_t)((value & 0x00FF0000U) >>  8) |\n    (uint32_t)((value & 0xFF000000U) >> 24) ;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n#pragma mark - APNG\n\n/*\n PNG  spec: http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html\n APNG spec: https://wiki.mozilla.org/APNG_Specification\n \n ===============================================================================\n PNG format:\n header (8): 89 50 4e 47 0d 0a 1a 0a\n chunk, chunk, chunk, ...\n \n ===============================================================================\n chunk format:\n length (4): uint32_t big endian\n fourcc (4): chunk type code\n data   (length): data\n crc32  (4): uint32_t big endian crc32(fourcc + data)\n \n ===============================================================================\n PNG chunk define:\n \n IHDR (Image Header) required, must appear first, 13 bytes\n width              (4) pixel count, should not be zero\n height             (4) pixel count, should not be zero\n bit depth          (1) expected: 1, 2, 4, 8, 16\n color type         (1) 1<<0 (palette used), 1<<1 (color used), 1<<2 (alpha channel used)\n compression method (1) 0 (deflate/inflate)\n filter method      (1) 0 (adaptive filtering with five basic filter types)\n interlace method   (1) 0 (no interlace) or 1 (Adam7 interlace)\n \n IDAT (Image Data) required, must appear consecutively if there's multiple 'IDAT' chunk\n \n IEND (End) required, must appear last, 0 bytes\n \n ===============================================================================\n APNG chunk define:\n \n acTL (Animation Control) required, must appear before 'IDAT', 8 bytes\n num frames     (4) number of frames\n num plays      (4) number of times to loop, 0 indicates infinite looping\n \n fcTL (Frame Control) required, must appear before the 'IDAT' or 'fdAT' chunks of the frame to which it applies, 26 bytes\n sequence number   (4) sequence number of the animation chunk, starting from 0\n width             (4) width of the following frame\n height            (4) height of the following frame\n x offset          (4) x position at which to render the following frame\n y offset          (4) y position at which to render the following frame\n delay num         (2) frame delay fraction numerator\n delay den         (2) frame delay fraction denominator\n dispose op        (1) type of frame area disposal to be done after rendering this frame (0:none, 1:background 2:previous)\n blend op          (1) type of frame area rendering for this frame (0:source, 1:over)\n \n fdAT (Frame Data) required\n sequence number   (4) sequence number of the animation chunk\n frame data        (x) frame data for this frame (same as 'IDAT')\n \n ===============================================================================\n `dispose_op` specifies how the output buffer should be changed at the end of the delay \n (before rendering the next frame).\n \n * NONE: no disposal is done on this frame before rendering the next; the contents\n    of the output buffer are left as is.\n * BACKGROUND: the frame's region of the output buffer is to be cleared to fully\n    transparent black before rendering the next frame.\n * PREVIOUS: the frame's region of the output buffer is to be reverted to the previous\n    contents before rendering the next frame.\n\n `blend_op` specifies whether the frame is to be alpha blended into the current output buffer\n content, or whether it should completely replace its region in the output buffer.\n \n * SOURCE: all color components of the frame, including alpha, overwrite the current contents\n    of the frame's output buffer region. \n * OVER: the frame should be composited onto the output buffer based on its alpha,\n    using a simple OVER operation as described in the \"Alpha Channel Processing\" section\n    of the PNG specification\n */\n\ntypedef enum {\n    YY_PNG_ALPHA_TYPE_PALEETE = 1 << 0,\n    YY_PNG_ALPHA_TYPE_COLOR = 1 << 1,\n    YY_PNG_ALPHA_TYPE_ALPHA = 1 << 2,\n} yy_png_alpha_type;\n\ntypedef enum {\n    YY_PNG_DISPOSE_OP_NONE = 0,\n    YY_PNG_DISPOSE_OP_BACKGROUND = 1,\n    YY_PNG_DISPOSE_OP_PREVIOUS = 2,\n} yy_png_dispose_op;\n\ntypedef enum {\n    YY_PNG_BLEND_OP_SOURCE = 0,\n    YY_PNG_BLEND_OP_OVER = 1,\n} yy_png_blend_op;\n\ntypedef struct {\n    uint32_t width;             ///< pixel count, should not be zero\n    uint32_t height;            ///< pixel count, should not be zero\n    uint8_t bit_depth;          ///< expected: 1, 2, 4, 8, 16\n    uint8_t color_type;         ///< see yy_png_alpha_type\n    uint8_t compression_method; ///< 0 (deflate/inflate)\n    uint8_t filter_method;      ///< 0 (adaptive filtering with five basic filter types)\n    uint8_t interlace_method;   ///< 0 (no interlace) or 1 (Adam7 interlace)\n} yy_png_chunk_IHDR;\n\ntypedef struct {\n    uint32_t sequence_number;  ///< sequence number of the animation chunk, starting from 0\n    uint32_t width;            ///< width of the following frame\n    uint32_t height;           ///< height of the following frame\n    uint32_t x_offset;         ///< x position at which to render the following frame\n    uint32_t y_offset;         ///< y position at which to render the following frame\n    uint16_t delay_num;        ///< frame delay fraction numerator\n    uint16_t delay_den;        ///< frame delay fraction denominator\n    uint8_t dispose_op;        ///< see yy_png_dispose_op\n    uint8_t blend_op;          ///< see yy_png_blend_op\n} yy_png_chunk_fcTL;\n\ntypedef struct {\n    uint32_t offset; ///< chunk offset in PNG data\n    uint32_t fourcc; ///< chunk fourcc\n    uint32_t length; ///< chunk data length\n    uint32_t crc32;  ///< chunk crc32\n} yy_png_chunk_info;\n\ntypedef struct {\n    uint32_t chunk_index; ///< the first `fdAT`/`IDAT` chunk index\n    uint32_t chunk_num;   ///< the `fdAT`/`IDAT` chunk count\n    uint32_t chunk_size;  ///< the `fdAT`/`IDAT` chunk bytes\n    yy_png_chunk_fcTL frame_control;\n} yy_png_frame_info;\n\ntypedef struct {\n    yy_png_chunk_IHDR header;   ///< png header\n    yy_png_chunk_info *chunks;      ///< chunks\n    uint32_t chunk_num;          ///< count of chunks\n    \n    yy_png_frame_info *apng_frames; ///< frame info, NULL if not apng\n    uint32_t apng_frame_num;     ///< 0 if not apng\n    uint32_t apng_loop_num;      ///< 0 indicates infinite looping\n    \n    uint32_t *apng_shared_chunk_indexs; ///< shared chunk index\n    uint32_t apng_shared_chunk_num;     ///< shared chunk count\n    uint32_t apng_shared_chunk_size;    ///< shared chunk bytes\n    uint32_t apng_shared_insert_index;  ///< shared chunk insert index\n    bool apng_first_frame_is_cover;     ///< the first frame is same as png (cover)\n} yy_png_info;\n\nstatic void yy_png_chunk_IHDR_read(yy_png_chunk_IHDR *IHDR, const uint8_t *data) {\n    IHDR->width = yy_swap_endian_uint32(*((uint32_t *)(data)));\n    IHDR->height = yy_swap_endian_uint32(*((uint32_t *)(data + 4)));\n    IHDR->bit_depth = data[8];\n    IHDR->color_type = data[9];\n    IHDR->compression_method = data[10];\n    IHDR->filter_method = data[11];\n    IHDR->interlace_method = data[12];\n}\n\nstatic void yy_png_chunk_IHDR_write(yy_png_chunk_IHDR *IHDR, uint8_t *data) {\n    *((uint32_t *)(data)) = yy_swap_endian_uint32(IHDR->width);\n    *((uint32_t *)(data + 4)) = yy_swap_endian_uint32(IHDR->height);\n    data[8] = IHDR->bit_depth;\n    data[9] = IHDR->color_type;\n    data[10] = IHDR->compression_method;\n    data[11] = IHDR->filter_method;\n    data[12] = IHDR->interlace_method;\n}\n\nstatic void yy_png_chunk_fcTL_read(yy_png_chunk_fcTL *fcTL, const uint8_t *data) {\n    fcTL->sequence_number = yy_swap_endian_uint32(*((uint32_t *)(data)));\n    fcTL->width = yy_swap_endian_uint32(*((uint32_t *)(data + 4)));\n    fcTL->height = yy_swap_endian_uint32(*((uint32_t *)(data + 8)));\n    fcTL->x_offset = yy_swap_endian_uint32(*((uint32_t *)(data + 12)));\n    fcTL->y_offset = yy_swap_endian_uint32(*((uint32_t *)(data + 16)));\n    fcTL->delay_num = yy_swap_endian_uint16(*((uint16_t *)(data + 20)));\n    fcTL->delay_den = yy_swap_endian_uint16(*((uint16_t *)(data + 22)));\n    fcTL->dispose_op = data[24];\n    fcTL->blend_op = data[25];\n}\n\nstatic void yy_png_chunk_fcTL_write(yy_png_chunk_fcTL *fcTL, uint8_t *data) {\n    *((uint32_t *)(data)) = yy_swap_endian_uint32(fcTL->sequence_number);\n    *((uint32_t *)(data + 4)) = yy_swap_endian_uint32(fcTL->width);\n    *((uint32_t *)(data + 8)) = yy_swap_endian_uint32(fcTL->height);\n    *((uint32_t *)(data + 12)) = yy_swap_endian_uint32(fcTL->x_offset);\n    *((uint32_t *)(data + 16)) = yy_swap_endian_uint32(fcTL->y_offset);\n    *((uint16_t *)(data + 20)) = yy_swap_endian_uint16(fcTL->delay_num);\n    *((uint16_t *)(data + 22)) = yy_swap_endian_uint16(fcTL->delay_den);\n    data[24] = fcTL->dispose_op;\n    data[25] = fcTL->blend_op;\n}\n\n// convert double value to fraction\nstatic void yy_png_delay_to_fraction(double duration, uint16_t *num, uint16_t *den) {\n    if (duration >= 0xFF) {\n        *num = 0xFF;\n        *den = 1;\n    } else if (duration <= 1.0 / (double)0xFF) {\n        *num = 1;\n        *den = 0xFF;\n    } else {\n        // Use continued fraction to calculate the num and den.\n        long MAX = 10;\n        double eps = (0.5 / (double)0xFF);\n        long p[MAX], q[MAX], a[MAX], i, numl = 0, denl = 0;\n        // The first two convergents are 0/1 and 1/0\n        p[0] = 0; q[0] = 1;\n        p[1] = 1; q[1] = 0;\n        // The rest of the convergents (and continued fraction)\n        for (i = 2; i < MAX; i++) {\n            a[i] = lrint(floor(duration));\n            p[i] = a[i] * p[i - 1] + p[i - 2];\n            q[i] = a[i] * q[i - 1] + q[i - 2];\n            if (p[i] <= 0xFF && q[i] <= 0xFF) { // uint16_t\n                numl = p[i];\n                denl = q[i];\n            } else break;\n            if (fabs(duration - a[i]) < eps) break;\n            duration = 1.0 / (duration - a[i]);\n        }\n        \n        if (numl != 0 && denl != 0) {\n            *num = numl;\n            *den = denl;\n        } else {\n            *num = 1;\n            *den = 100;\n        }\n    }\n}\n\n// convert fraction to double value\nstatic double yy_png_delay_to_seconds(uint16_t num, uint16_t den) {\n    if (den == 0) {\n        return num / 100.0;\n    } else {\n        return (double)num / (double)den;\n    }\n}\n\nstatic bool yy_png_validate_animation_chunk_order(yy_png_chunk_info *chunks,  /* input */\n                                                  uint32_t chunk_num,         /* input */\n                                                  uint32_t *first_idat_index, /* output */\n                                                  bool *first_frame_is_cover  /* output */) {\n    /*\n     PNG at least contains 3 chunks: IHDR, IDAT, IEND.\n     `IHDR` must appear first.\n     `IDAT` must appear consecutively.\n     `IEND` must appear end.\n     \n     APNG must contains one `acTL` and at least one 'fcTL' and `fdAT`.\n     `fdAT` must appear consecutively.\n     `fcTL` must appear before `IDAT` or `fdAT`.\n     */\n    if (chunk_num <= 2) return false;\n    if (chunks->fourcc != YY_FOUR_CC('I', 'H', 'D', 'R')) return false;\n    if ((chunks + chunk_num - 1)->fourcc != YY_FOUR_CC('I', 'E', 'N', 'D')) return false;\n    \n    uint32_t prev_fourcc = 0;\n    uint32_t IHDR_num = 0;\n    uint32_t IDAT_num = 0;\n    uint32_t acTL_num = 0;\n    uint32_t fcTL_num = 0;\n    uint32_t first_IDAT = 0;\n    bool first_frame_cover = false;\n    for (uint32_t i = 0; i < chunk_num; i++) {\n        yy_png_chunk_info *chunk = chunks + i;\n        switch (chunk->fourcc) {\n            case YY_FOUR_CC('I', 'H', 'D', 'R'): {  // png header\n                if (i != 0) return false;\n                if (IHDR_num > 0) return false;\n                IHDR_num++;\n            } break;\n            case YY_FOUR_CC('I', 'D', 'A', 'T'): {  // png data\n                if (prev_fourcc != YY_FOUR_CC('I', 'D', 'A', 'T')) {\n                    if (IDAT_num == 0)\n                        first_IDAT = i;\n                    else\n                        return false;\n                }\n                IDAT_num++;\n            } break;\n            case YY_FOUR_CC('a', 'c', 'T', 'L'): {  // apng control\n                if (acTL_num > 0) return false;\n                acTL_num++;\n            } break;\n            case YY_FOUR_CC('f', 'c', 'T', 'L'): {  // apng frame control\n                if (i + 1 == chunk_num) return false;\n                if ((chunk + 1)->fourcc != YY_FOUR_CC('f', 'd', 'A', 'T') &&\n                    (chunk + 1)->fourcc != YY_FOUR_CC('I', 'D', 'A', 'T')) {\n                    return false;\n                }\n                if (fcTL_num == 0) {\n                    if ((chunk + 1)->fourcc == YY_FOUR_CC('I', 'D', 'A', 'T')) {\n                        first_frame_cover = true;\n                    }\n                }\n                fcTL_num++;\n            } break;\n            case YY_FOUR_CC('f', 'd', 'A', 'T'): {  // apng data\n                if (prev_fourcc != YY_FOUR_CC('f', 'd', 'A', 'T') && prev_fourcc != YY_FOUR_CC('f', 'c', 'T', 'L')) {\n                    return false;\n                }\n            } break;\n        }\n        prev_fourcc = chunk->fourcc;\n    }\n    if (IHDR_num != 1) return false;\n    if (IDAT_num == 0) return false;\n    if (acTL_num != 1) return false;\n    if (fcTL_num < acTL_num) return false;\n    *first_idat_index = first_IDAT;\n    *first_frame_is_cover = first_frame_cover;\n    return true;\n}\n\nstatic void yy_png_info_release(yy_png_info *info) {\n    if (info) {\n        if (info->chunks) free(info->chunks);\n        if (info->apng_frames) free(info->apng_frames);\n        if (info->apng_shared_chunk_indexs) free(info->apng_shared_chunk_indexs);\n        free(info);\n    }\n}\n\n/**\n Create a png info from a png file. See struct png_info for more information.\n \n @param data   png/apng file data.\n @param length the data's length in bytes.\n @return A png info object, you may call yy_png_info_release() to release it.\n Returns NULL if an error occurs.\n */\nstatic yy_png_info *yy_png_info_create(const uint8_t *data, uint32_t length) {\n    if (length < 32) return NULL;\n    if (*((uint32_t *)data) != YY_FOUR_CC(0x89, 0x50, 0x4E, 0x47)) return NULL;\n    if (*((uint32_t *)(data + 4)) != YY_FOUR_CC(0x0D, 0x0A, 0x1A, 0x0A)) return NULL;\n    \n    uint32_t chunk_realloc_num = 16;\n    yy_png_chunk_info *chunks = malloc(sizeof(yy_png_chunk_info) * chunk_realloc_num);\n    if (!chunks) return NULL;\n    \n    // parse png chunks\n    uint32_t offset = 8;\n    uint32_t chunk_num = 0;\n    uint32_t chunk_capacity = chunk_realloc_num;\n    uint32_t apng_loop_num = 0;\n    int32_t apng_sequence_index = -1;\n    int32_t apng_frame_index = 0;\n    int32_t apng_frame_number = -1;\n    bool apng_chunk_error = false;\n    do {\n        if (chunk_num >= chunk_capacity) {\n            yy_png_chunk_info *new_chunks = realloc(chunks, sizeof(yy_png_chunk_info) * (chunk_capacity + chunk_realloc_num));\n            if (!new_chunks) {\n                free(chunks);\n                return NULL;\n            }\n            chunks = new_chunks;\n            chunk_capacity += chunk_realloc_num;\n        }\n        yy_png_chunk_info *chunk = chunks + chunk_num;\n        const uint8_t *chunk_data = data + offset;\n        chunk->offset = offset;\n        chunk->length = yy_swap_endian_uint32(*((uint32_t *)chunk_data));\n        if ((uint64_t)chunk->offset + (uint64_t)chunk->length + 12 > length) {\n            free(chunks);\n            return NULL;\n        }\n        \n        chunk->fourcc = *((uint32_t *)(chunk_data + 4));\n        if ((uint64_t)chunk->offset + 4 + chunk->length + 4 > (uint64_t)length) break;\n        chunk->crc32 = yy_swap_endian_uint32(*((uint32_t *)(chunk_data + 8 + chunk->length)));\n        chunk_num++;\n        offset += 12 + chunk->length;\n        \n        switch (chunk->fourcc) {\n            case YY_FOUR_CC('a', 'c', 'T', 'L') : {\n                if (chunk->length == 8) {\n                    apng_frame_number = yy_swap_endian_uint32(*((uint32_t *)(chunk_data + 8)));\n                    apng_loop_num = yy_swap_endian_uint32(*((uint32_t *)(chunk_data + 12)));\n                } else {\n                    apng_chunk_error = true;\n                }\n            } break;\n            case YY_FOUR_CC('f', 'c', 'T', 'L') :\n            case YY_FOUR_CC('f', 'd', 'A', 'T') : {\n                if (chunk->fourcc == YY_FOUR_CC('f', 'c', 'T', 'L')) {\n                    if (chunk->length != 26) {\n                        apng_chunk_error = true;\n                    } else {\n                        apng_frame_index++;\n                    }\n                }\n                if (chunk->length > 4) {\n                    uint32_t sequence = yy_swap_endian_uint32(*((uint32_t *)(chunk_data + 8)));\n                    if (apng_sequence_index + 1 == sequence) {\n                        apng_sequence_index++;\n                    } else {\n                        apng_chunk_error = true;\n                    }\n                } else {\n                    apng_chunk_error = true;\n                }\n            } break;\n            case YY_FOUR_CC('I', 'E', 'N', 'D') : {\n                offset = length; // end, break do-while loop\n            } break;\n        }\n    } while (offset + 12 <= length);\n    \n    if (chunk_num < 3 ||\n        chunks->fourcc != YY_FOUR_CC('I', 'H', 'D', 'R') ||\n        chunks->length != 13) {\n        free(chunks);\n        return NULL;\n    }\n    \n    // png info\n    yy_png_info *info = calloc(1, sizeof(yy_png_info));\n    if (!info) {\n        free(chunks);\n        return NULL;\n    }\n    info->chunks = chunks;\n    info->chunk_num = chunk_num;\n    yy_png_chunk_IHDR_read(&info->header, data + chunks->offset + 8);\n    \n    // apng info\n    if (!apng_chunk_error && apng_frame_number == apng_frame_index && apng_frame_number >= 1) {\n        bool first_frame_is_cover = false;\n        uint32_t first_IDAT_index = 0;\n        if (!yy_png_validate_animation_chunk_order(info->chunks, info->chunk_num, &first_IDAT_index, &first_frame_is_cover)) {\n            return info; // ignore apng chunk\n        }\n        \n        info->apng_loop_num = apng_loop_num;\n        info->apng_frame_num = apng_frame_number;\n        info->apng_first_frame_is_cover = first_frame_is_cover;\n        info->apng_shared_insert_index = first_IDAT_index;\n        info->apng_frames = calloc(apng_frame_number, sizeof(yy_png_frame_info));\n        if (!info->apng_frames) {\n            yy_png_info_release(info);\n            return NULL;\n        }\n        info->apng_shared_chunk_indexs = calloc(info->chunk_num, sizeof(uint32_t));\n        if (!info->apng_shared_chunk_indexs) {\n            yy_png_info_release(info);\n            return NULL;\n        }\n        \n        int32_t frame_index = -1;\n        uint32_t *shared_chunk_index = info->apng_shared_chunk_indexs;\n        for (int32_t i = 0; i < info->chunk_num; i++) {\n            yy_png_chunk_info *chunk = info->chunks + i;\n            switch (chunk->fourcc) {\n                case YY_FOUR_CC('I', 'D', 'A', 'T'): {\n                    if (info->apng_shared_insert_index == 0) {\n                        info->apng_shared_insert_index = i;\n                    }\n                    if (first_frame_is_cover) {\n                        yy_png_frame_info *frame = info->apng_frames + frame_index;\n                        frame->chunk_num++;\n                        frame->chunk_size += chunk->length + 12;\n                    }\n                } break;\n                case YY_FOUR_CC('a', 'c', 'T', 'L'): {\n                } break;\n                case YY_FOUR_CC('f', 'c', 'T', 'L'): {\n                    frame_index++;\n                    yy_png_frame_info *frame = info->apng_frames + frame_index;\n                    frame->chunk_index = i + 1;\n                    yy_png_chunk_fcTL_read(&frame->frame_control, data + chunk->offset + 8);\n                } break;\n                case YY_FOUR_CC('f', 'd', 'A', 'T'): {\n                    yy_png_frame_info *frame = info->apng_frames + frame_index;\n                    frame->chunk_num++;\n                    frame->chunk_size += chunk->length + 12;\n                } break;\n                default: {\n                    *shared_chunk_index = i;\n                    shared_chunk_index++;\n                    info->apng_shared_chunk_size += chunk->length + 12;\n                    info->apng_shared_chunk_num++;\n                } break;\n            }\n        }\n    }\n    return info;\n}\n\n/**\n Copy a png frame data from an apng file.\n \n @param data  apng file data\n @param info  png info\n @param index frame index (zero-based)\n @param size  output, the size of the frame data\n @return A frame data (single-frame png file), call free() to release the data.\n Returns NULL if an error occurs.\n */\nstatic uint8_t *yy_png_copy_frame_data_at_index(const uint8_t *data,\n                                                const yy_png_info *info,\n                                                const uint32_t index,\n                                                uint32_t *size) {\n    if (index >= info->apng_frame_num) return NULL;\n    \n    yy_png_frame_info *frame_info = info->apng_frames + index;\n    uint32_t frame_remux_size = 8 /* PNG Header */ + info->apng_shared_chunk_size + frame_info->chunk_size;\n    if (!(info->apng_first_frame_is_cover && index == 0)) {\n        frame_remux_size -= frame_info->chunk_num * 4; // remove fdAT sequence number\n    }\n    uint8_t *frame_data = malloc(frame_remux_size);\n    if (!frame_data) return NULL;\n    *size = frame_remux_size;\n    \n    uint32_t data_offset = 0;\n    bool inserted = false;\n    memcpy(frame_data, data, 8); // PNG File Header\n    data_offset += 8;\n    for (uint32_t i = 0; i < info->apng_shared_chunk_num; i++) {\n        uint32_t shared_chunk_index = info->apng_shared_chunk_indexs[i];\n        yy_png_chunk_info *shared_chunk_info = info->chunks + shared_chunk_index;\n        \n        if (shared_chunk_index >= info->apng_shared_insert_index && !inserted) { // replace IDAT with fdAT\n            inserted = true;\n            for (uint32_t c = 0; c < frame_info->chunk_num; c++) {\n                yy_png_chunk_info *insert_chunk_info = info->chunks + frame_info->chunk_index + c;\n                if (insert_chunk_info->fourcc == YY_FOUR_CC('f', 'd', 'A', 'T')) {\n                    *((uint32_t *)(frame_data + data_offset)) = yy_swap_endian_uint32(insert_chunk_info->length - 4);\n                    *((uint32_t *)(frame_data + data_offset + 4)) = YY_FOUR_CC('I', 'D', 'A', 'T');\n                    memcpy(frame_data + data_offset + 8, data + insert_chunk_info->offset + 12, insert_chunk_info->length - 4);\n                    uint32_t crc = (uint32_t)crc32(0, frame_data + data_offset + 4, insert_chunk_info->length);\n                    *((uint32_t *)(frame_data + data_offset + insert_chunk_info->length + 4)) = yy_swap_endian_uint32(crc);\n                    data_offset += insert_chunk_info->length + 8;\n                } else { // IDAT\n                    memcpy(frame_data + data_offset, data + insert_chunk_info->offset, insert_chunk_info->length + 12);\n                    data_offset += insert_chunk_info->length + 12;\n                }\n            }\n        }\n        \n        if (shared_chunk_info->fourcc == YY_FOUR_CC('I', 'H', 'D', 'R')) {\n            uint8_t tmp[25] = {0};\n            memcpy(tmp, data + shared_chunk_info->offset, 25);\n            yy_png_chunk_IHDR IHDR = info->header;\n            IHDR.width = frame_info->frame_control.width;\n            IHDR.height = frame_info->frame_control.height;\n            yy_png_chunk_IHDR_write(&IHDR, tmp + 8);\n            *((uint32_t *)(tmp + 21)) = yy_swap_endian_uint32((uint32_t)crc32(0, tmp + 4, 17));\n            memcpy(frame_data + data_offset, tmp, 25);\n            data_offset += 25;\n        } else {\n            memcpy(frame_data + data_offset, data + shared_chunk_info->offset, shared_chunk_info->length + 12);\n            data_offset += shared_chunk_info->length + 12;\n        }\n    }\n    return frame_data;\n}\n\n\n\n////////////////////////////////////////////////////////////////////////////////\n#pragma mark - Helper\n\n/// Returns byte-aligned size.\nstatic inline size_t YYImageByteAlign(size_t size, size_t alignment) {\n    return ((size + (alignment - 1)) / alignment) * alignment;\n}\n\n/// Convert degree to radians\nstatic inline CGFloat YYImageDegreesToRadians(CGFloat degrees) {\n    return degrees * M_PI / 180;\n}\n\nCGColorSpaceRef YYCGColorSpaceGetDeviceRGB() {\n    static CGColorSpaceRef space;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        space = CGColorSpaceCreateDeviceRGB();\n    });\n    return space;\n}\n\nCGColorSpaceRef YYCGColorSpaceGetDeviceGray() {\n    static CGColorSpaceRef space;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        space = CGColorSpaceCreateDeviceGray();\n    });\n    return space;\n}\n\nBOOL YYCGColorSpaceIsDeviceRGB(CGColorSpaceRef space) {\n    return space && CFEqual(space, YYCGColorSpaceGetDeviceRGB());\n}\n\nBOOL YYCGColorSpaceIsDeviceGray(CGColorSpaceRef space) {\n    return space && CFEqual(space, YYCGColorSpaceGetDeviceGray());\n}\n\n/**\n A callback used in CGDataProviderCreateWithData() to release data.\n \n Example:\n \n void *data = malloc(size);\n CGDataProviderRef provider = CGDataProviderCreateWithData(data, data, size, YYCGDataProviderReleaseDataCallback);\n */\nstatic void YYCGDataProviderReleaseDataCallback(void *info, const void *data, size_t size) {\n    if (info) free(info);\n}\n\n/**\n Decode an image to bitmap buffer with the specified format.\n \n @param srcImage   Source image.\n @param dest       Destination buffer. It should be zero before call this method.\n                   If decode succeed, you should release the dest->data using free().\n @param destFormat Destination bitmap format.\n \n @return Whether succeed.\n \n @warning This method support iOS7.0 and later. If call it on iOS6, it just returns NO.\n CG_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0)\n */\nstatic BOOL YYCGImageDecodeToBitmapBufferWithAnyFormat(CGImageRef srcImage, vImage_Buffer *dest, vImage_CGImageFormat *destFormat) {\n    if (!srcImage || (((long)vImageConvert_AnyToAny) + 1 == 1) || !destFormat || !dest) return NO;\n    size_t width = CGImageGetWidth(srcImage);\n    size_t height = CGImageGetHeight(srcImage);\n    if (width == 0 || height == 0) return NO;\n    dest->data = NULL;\n    \n    vImage_Error error = kvImageNoError;\n    CFDataRef srcData = NULL;\n    vImageConverterRef convertor = NULL;\n    vImage_CGImageFormat srcFormat = {0};\n    srcFormat.bitsPerComponent = (uint32_t)CGImageGetBitsPerComponent(srcImage);\n    srcFormat.bitsPerPixel = (uint32_t)CGImageGetBitsPerPixel(srcImage);\n    srcFormat.colorSpace = CGImageGetColorSpace(srcImage);\n    srcFormat.bitmapInfo = CGImageGetBitmapInfo(srcImage) | CGImageGetAlphaInfo(srcImage);\n    \n    convertor = vImageConverter_CreateWithCGImageFormat(&srcFormat, destFormat, NULL, kvImageNoFlags, NULL);\n    if (!convertor) goto fail;\n    \n    CGDataProviderRef srcProvider = CGImageGetDataProvider(srcImage);\n    srcData = srcProvider ? CGDataProviderCopyData(srcProvider) : NULL; // decode\n    size_t srcLength = srcData ? CFDataGetLength(srcData) : 0;\n    const void *srcBytes = srcData ? CFDataGetBytePtr(srcData) : NULL;\n    if (srcLength == 0 || !srcBytes) goto fail;\n    \n    vImage_Buffer src = {0};\n    src.data = (void *)srcBytes;\n    src.width = width;\n    src.height = height;\n    src.rowBytes = CGImageGetBytesPerRow(srcImage);\n    \n    error = vImageBuffer_Init(dest, height, width, 32, kvImageNoFlags);\n    if (error != kvImageNoError) goto fail;\n    \n    error = vImageConvert_AnyToAny(convertor, &src, dest, NULL, kvImageNoFlags); // convert\n    if (error != kvImageNoError) goto fail;\n    \n    CFRelease(convertor);\n    CFRelease(srcData);\n    return YES;\n    \nfail:\n    if (convertor) CFRelease(convertor);\n    if (srcData) CFRelease(srcData);\n    if (dest->data) free(dest->data);\n    dest->data = NULL;\n    return NO;\n}\n\n/**\n Decode an image to bitmap buffer with the 32bit format (such as ARGB8888).\n \n @param srcImage   Source image.\n @param dest       Destination buffer. It should be zero before call this method.\n                   If decode succeed, you should release the dest->data using free().\n @param bitmapInfo Destination bitmap format.\n \n @return Whether succeed.\n */\nstatic BOOL YYCGImageDecodeToBitmapBufferWith32BitFormat(CGImageRef srcImage, vImage_Buffer *dest, CGBitmapInfo bitmapInfo) {\n    if (!srcImage || !dest) return NO;\n    size_t width = CGImageGetWidth(srcImage);\n    size_t height = CGImageGetHeight(srcImage);\n    if (width == 0 || height == 0) return NO;\n    \n    BOOL hasAlpha = NO;\n    BOOL alphaFirst = NO;\n    BOOL alphaPremultiplied = NO;\n    BOOL byteOrderNormal = NO;\n    \n    switch (bitmapInfo & kCGBitmapAlphaInfoMask) {\n        case kCGImageAlphaPremultipliedLast: {\n            hasAlpha = YES;\n            alphaPremultiplied = YES;\n        } break;\n        case kCGImageAlphaPremultipliedFirst: {\n            hasAlpha = YES;\n            alphaPremultiplied = YES;\n            alphaFirst = YES;\n        } break;\n        case kCGImageAlphaLast: {\n            hasAlpha = YES;\n        } break;\n        case kCGImageAlphaFirst: {\n            hasAlpha = YES;\n            alphaFirst = YES;\n        } break;\n        case kCGImageAlphaNoneSkipLast: {\n        } break;\n        case kCGImageAlphaNoneSkipFirst: {\n            alphaFirst = YES;\n        } break;\n        default: {\n            return NO;\n        } break;\n    }\n    \n    switch (bitmapInfo & kCGBitmapByteOrderMask) {\n        case kCGBitmapByteOrderDefault: {\n            byteOrderNormal = YES;\n        } break;\n        case kCGBitmapByteOrder32Little: {\n        } break;\n        case kCGBitmapByteOrder32Big: {\n            byteOrderNormal = YES;\n        } break;\n        default: {\n            return NO;\n        } break;\n    }\n    \n    /*\n     Try convert with vImageConvert_AnyToAny() (avaliable since iOS 7.0).\n     If fail, try decode with CGContextDrawImage().\n     CGBitmapContext use a premultiplied alpha format, unpremultiply may lose precision.\n     */\n    vImage_CGImageFormat destFormat = {0};\n    destFormat.bitsPerComponent = 8;\n    destFormat.bitsPerPixel = 32;\n    destFormat.colorSpace = YYCGColorSpaceGetDeviceRGB();\n    destFormat.bitmapInfo = bitmapInfo;\n    dest->data = NULL;\n    if (YYCGImageDecodeToBitmapBufferWithAnyFormat(srcImage, dest, &destFormat)) return YES;\n    \n    CGBitmapInfo contextBitmapInfo = bitmapInfo & kCGBitmapByteOrderMask;\n    if (!hasAlpha || alphaPremultiplied) {\n        contextBitmapInfo |= (bitmapInfo & kCGBitmapAlphaInfoMask);\n    } else {\n        contextBitmapInfo |= alphaFirst ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaPremultipliedLast;\n    }\n    CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, YYCGColorSpaceGetDeviceRGB(), contextBitmapInfo);\n    if (!context) goto fail;\n    \n    CGContextDrawImage(context, CGRectMake(0, 0, width, height), srcImage); // decode and convert\n    size_t bytesPerRow = CGBitmapContextGetBytesPerRow(context);\n    size_t length = height * bytesPerRow;\n    void *data = CGBitmapContextGetData(context);\n    if (length == 0 || !data) goto fail;\n    \n    dest->data = malloc(length);\n    dest->width = width;\n    dest->height = height;\n    dest->rowBytes = bytesPerRow;\n    if (!dest->data) goto fail;\n    \n    if (hasAlpha && !alphaPremultiplied) {\n        vImage_Buffer tmpSrc = {0};\n        tmpSrc.data = data;\n        tmpSrc.width = width;\n        tmpSrc.height = height;\n        tmpSrc.rowBytes = bytesPerRow;\n        vImage_Error error;\n        if (alphaFirst && byteOrderNormal) {\n            error = vImageUnpremultiplyData_ARGB8888(&tmpSrc, dest, kvImageNoFlags);\n        } else {\n            error = vImageUnpremultiplyData_RGBA8888(&tmpSrc, dest, kvImageNoFlags);\n        }\n        if (error != kvImageNoError) goto fail;\n    } else {\n        memcpy(dest->data, data, length);\n    }\n    \n    CFRelease(context);\n    return YES;\n    \nfail:\n    if (context) CFRelease(context);\n    if (dest->data) free(dest->data);\n    dest->data = NULL;\n    return NO;\n    return NO;\n}\n\nCGImageRef YYCGImageCreateDecodedCopy(CGImageRef imageRef, BOOL decodeForDisplay) {\n    if (!imageRef) return NULL;\n    size_t width = CGImageGetWidth(imageRef);\n    size_t height = CGImageGetHeight(imageRef);\n    if (width == 0 || height == 0) return NULL;\n    \n    if (decodeForDisplay) { //decode with redraw (may lose some precision)\n        CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef) & kCGBitmapAlphaInfoMask;\n        BOOL hasAlpha = NO;\n        if (alphaInfo == kCGImageAlphaPremultipliedLast ||\n            alphaInfo == kCGImageAlphaPremultipliedFirst ||\n            alphaInfo == kCGImageAlphaLast ||\n            alphaInfo == kCGImageAlphaFirst) {\n            hasAlpha = YES;\n        }\n        // BGRA8888 (premultiplied) or BGRX8888\n        // same as UIGraphicsBeginImageContext() and -[UIView drawRect:]\n        CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host;\n        bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst;\n        CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, YYCGColorSpaceGetDeviceRGB(), bitmapInfo);\n        if (!context) return NULL;\n        CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef); // decode\n        CGImageRef newImage = CGBitmapContextCreateImage(context);\n        CFRelease(context);\n        return newImage;\n        \n    } else {\n        CGColorSpaceRef space = CGImageGetColorSpace(imageRef);\n        size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);\n        size_t bitsPerPixel = CGImageGetBitsPerPixel(imageRef);\n        size_t bytesPerRow = CGImageGetBytesPerRow(imageRef);\n        CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);\n        if (bytesPerRow == 0 || width == 0 || height == 0) return NULL;\n        \n        CGDataProviderRef dataProvider = CGImageGetDataProvider(imageRef);\n        if (!dataProvider) return NULL;\n        CFDataRef data = CGDataProviderCopyData(dataProvider); // decode\n        if (!data) return NULL;\n        \n        CGDataProviderRef newProvider = CGDataProviderCreateWithCFData(data);\n        CFRelease(data);\n        if (!newProvider) return NULL;\n        \n        CGImageRef newImage = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, space, bitmapInfo, newProvider, NULL, false, kCGRenderingIntentDefault);\n        CFRelease(newProvider);\n        return newImage;\n    }\n}\n\nCGImageRef YYCGImageCreateAffineTransformCopy(CGImageRef imageRef, CGAffineTransform transform, CGSize destSize, CGBitmapInfo destBitmapInfo) {\n    if (!imageRef) return NULL;\n    size_t srcWidth = CGImageGetWidth(imageRef);\n    size_t srcHeight = CGImageGetHeight(imageRef);\n    size_t destWidth = round(destSize.width);\n    size_t destHeight = round(destSize.height);\n    if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return NULL;\n    \n    CGDataProviderRef tmpProvider = NULL, destProvider = NULL;\n    CGImageRef tmpImage = NULL, destImage = NULL;\n    vImage_Buffer src = {0}, tmp = {0}, dest = {0};\n    if(!YYCGImageDecodeToBitmapBufferWith32BitFormat(imageRef, &src, kCGImageAlphaFirst | kCGBitmapByteOrderDefault)) return NULL;\n    \n    size_t destBytesPerRow = YYImageByteAlign(destWidth * 4, 32);\n    tmp.data = malloc(destHeight * destBytesPerRow);\n    if (!tmp.data) goto fail;\n    \n    tmp.width = destWidth;\n    tmp.height = destHeight;\n    tmp.rowBytes = destBytesPerRow;\n    vImage_CGAffineTransform vTransform = *((vImage_CGAffineTransform *)&transform);\n    uint8_t backColor[4] = {0};\n    vImage_Error error = vImageAffineWarpCG_ARGB8888(&src, &tmp, NULL, &vTransform, backColor, kvImageBackgroundColorFill);\n    if (error != kvImageNoError) goto fail;\n    free(src.data);\n    src.data = NULL;\n    \n    tmpProvider = CGDataProviderCreateWithData(tmp.data, tmp.data, destHeight * destBytesPerRow, YYCGDataProviderReleaseDataCallback);\n    if (!tmpProvider) goto fail;\n    tmp.data = NULL; // hold by provider\n    tmpImage = CGImageCreate(destWidth, destHeight, 8, 32, destBytesPerRow, YYCGColorSpaceGetDeviceRGB(), kCGImageAlphaFirst | kCGBitmapByteOrderDefault, tmpProvider, NULL, false, kCGRenderingIntentDefault);\n    if (!tmpImage) goto fail;\n    CFRelease(tmpProvider);\n    tmpProvider = NULL;\n    \n    if ((destBitmapInfo & kCGBitmapAlphaInfoMask) == kCGImageAlphaFirst &&\n        (destBitmapInfo & kCGBitmapByteOrderMask) != kCGBitmapByteOrder32Little) {\n        return tmpImage;\n    }\n    \n    if (!YYCGImageDecodeToBitmapBufferWith32BitFormat(tmpImage, &dest, destBitmapInfo)) goto fail;\n    CFRelease(tmpImage);\n    tmpImage = NULL;\n    \n    destProvider = CGDataProviderCreateWithData(dest.data, dest.data, destHeight * destBytesPerRow, YYCGDataProviderReleaseDataCallback);\n    if (!destProvider) goto fail;\n    dest.data = NULL; // hold by provider\n    destImage = CGImageCreate(destWidth, destHeight, 8, 32, destBytesPerRow, YYCGColorSpaceGetDeviceRGB(), destBitmapInfo, destProvider, NULL, false, kCGRenderingIntentDefault);\n    if (!destImage) goto fail;\n    CFRelease(destProvider);\n    destProvider = NULL;\n    \n    return destImage;\n    \nfail:\n    if (src.data) free(src.data);\n    if (tmp.data) free(tmp.data);\n    if (dest.data) free(dest.data);\n    if (tmpProvider) CFRelease(tmpProvider);\n    if (tmpImage) CFRelease(tmpImage);\n    if (destProvider) CFRelease(destProvider);\n    return NULL;\n}\n\nUIImageOrientation YYUIImageOrientationFromEXIFValue(NSInteger value) {\n    switch (value) {\n        case kCGImagePropertyOrientationUp: return UIImageOrientationUp;\n        case kCGImagePropertyOrientationDown: return UIImageOrientationDown;\n        case kCGImagePropertyOrientationLeft: return UIImageOrientationLeft;\n        case kCGImagePropertyOrientationRight: return UIImageOrientationRight;\n        case kCGImagePropertyOrientationUpMirrored: return UIImageOrientationUpMirrored;\n        case kCGImagePropertyOrientationDownMirrored: return UIImageOrientationDownMirrored;\n        case kCGImagePropertyOrientationLeftMirrored: return UIImageOrientationLeftMirrored;\n        case kCGImagePropertyOrientationRightMirrored: return UIImageOrientationRightMirrored;\n        default: return UIImageOrientationUp;\n    }\n}\n\nNSInteger YYUIImageOrientationToEXIFValue(UIImageOrientation orientation) {\n    switch (orientation) {\n        case UIImageOrientationUp: return kCGImagePropertyOrientationUp;\n        case UIImageOrientationDown: return kCGImagePropertyOrientationDown;\n        case UIImageOrientationLeft: return kCGImagePropertyOrientationLeft;\n        case UIImageOrientationRight: return kCGImagePropertyOrientationRight;\n        case UIImageOrientationUpMirrored: return kCGImagePropertyOrientationUpMirrored;\n        case UIImageOrientationDownMirrored: return kCGImagePropertyOrientationDownMirrored;\n        case UIImageOrientationLeftMirrored: return kCGImagePropertyOrientationLeftMirrored;\n        case UIImageOrientationRightMirrored: return kCGImagePropertyOrientationRightMirrored;\n        default: return kCGImagePropertyOrientationUp;\n    }\n}\n\nCGImageRef YYCGImageCreateCopyWithOrientation(CGImageRef imageRef, UIImageOrientation orientation, CGBitmapInfo destBitmapInfo) {\n    if (!imageRef) return NULL;\n    if (orientation == UIImageOrientationUp) return (CGImageRef)CFRetain(imageRef);\n    \n    size_t width = CGImageGetWidth(imageRef);\n    size_t height = CGImageGetHeight(imageRef);\n    \n    CGAffineTransform transform = CGAffineTransformIdentity;\n    BOOL swapWidthAndHeight = NO;\n    switch (orientation) {\n        case UIImageOrientationDown: {\n            transform = CGAffineTransformMakeRotation(YYImageDegreesToRadians(180));\n            transform = CGAffineTransformTranslate(transform, -(CGFloat)width, -(CGFloat)height);\n        } break;\n        case UIImageOrientationLeft: {\n            transform = CGAffineTransformMakeRotation(YYImageDegreesToRadians(90));\n            transform = CGAffineTransformTranslate(transform, -(CGFloat)0, -(CGFloat)height);\n            swapWidthAndHeight = YES;\n        } break;\n        case UIImageOrientationRight: {\n            transform = CGAffineTransformMakeRotation(YYImageDegreesToRadians(-90));\n            transform = CGAffineTransformTranslate(transform, -(CGFloat)width, (CGFloat)0);\n            swapWidthAndHeight = YES;\n        } break;\n        case UIImageOrientationUpMirrored: {\n            transform = CGAffineTransformTranslate(transform, (CGFloat)width, 0);\n            transform = CGAffineTransformScale(transform, -1, 1);\n        } break;\n        case UIImageOrientationDownMirrored: {\n            transform = CGAffineTransformTranslate(transform, 0, (CGFloat)height);\n            transform = CGAffineTransformScale(transform, 1, -1);\n        } break;\n        case UIImageOrientationLeftMirrored: {\n            transform = CGAffineTransformMakeRotation(YYImageDegreesToRadians(-90));\n            transform = CGAffineTransformScale(transform, 1, -1);\n            transform = CGAffineTransformTranslate(transform, -(CGFloat)width, -(CGFloat)height);\n            swapWidthAndHeight = YES;\n        } break;\n        case UIImageOrientationRightMirrored: {\n            transform = CGAffineTransformMakeRotation(YYImageDegreesToRadians(90));\n            transform = CGAffineTransformScale(transform, 1, -1);\n            swapWidthAndHeight = YES;\n        } break;\n        default: break;\n    }\n    if (CGAffineTransformIsIdentity(transform)) return (CGImageRef)CFRetain(imageRef);\n    \n    CGSize destSize = {width, height};\n    if (swapWidthAndHeight) {\n        destSize.width = height;\n        destSize.height = width;\n    }\n    \n    return YYCGImageCreateAffineTransformCopy(imageRef, transform, destSize, destBitmapInfo);\n}\n\nYYImageType YYImageDetectType(CFDataRef data) {\n    if (!data) return YYImageTypeUnknown;\n    uint64_t length = CFDataGetLength(data);\n    if (length < 16) return YYImageTypeUnknown;\n    \n    const char *bytes = (char *)CFDataGetBytePtr(data);\n    \n    uint32_t magic4 = *((uint32_t *)bytes);\n    switch (magic4) {\n        case YY_FOUR_CC(0x4D, 0x4D, 0x00, 0x2A): { // big endian TIFF\n            return YYImageTypeTIFF;\n        } break;\n            \n        case YY_FOUR_CC(0x49, 0x49, 0x2A, 0x00): { // little endian TIFF\n            return YYImageTypeTIFF;\n        } break;\n            \n        case YY_FOUR_CC(0x00, 0x00, 0x01, 0x00): { // ICO\n            return YYImageTypeICO;\n        } break;\n            \n        case YY_FOUR_CC(0x00, 0x00, 0x02, 0x00): { // CUR\n            return YYImageTypeICO;\n        } break;\n            \n        case YY_FOUR_CC('i', 'c', 'n', 's'): { // ICNS\n            return YYImageTypeICNS;\n        } break;\n            \n        case YY_FOUR_CC('G', 'I', 'F', '8'): { // GIF\n            return YYImageTypeGIF;\n        } break;\n            \n        case YY_FOUR_CC(0x89, 'P', 'N', 'G'): {  // PNG\n            uint32_t tmp = *((uint32_t *)(bytes + 4));\n            if (tmp == YY_FOUR_CC('\\r', '\\n', 0x1A, '\\n')) {\n                return YYImageTypePNG;\n            }\n        } break;\n            \n        case YY_FOUR_CC('R', 'I', 'F', 'F'): { // WebP\n            uint32_t tmp = *((uint32_t *)(bytes + 8));\n            if (tmp == YY_FOUR_CC('W', 'E', 'B', 'P')) {\n                return YYImageTypeWebP;\n            }\n        } break;\n        /*\n        case YY_FOUR_CC('B', 'P', 'G', 0xFB): { // BPG\n            return YYImageTypeBPG;\n        } break;\n        */\n    }\n    \n    uint16_t magic2 = *((uint16_t *)bytes);\n    switch (magic2) {\n        case YY_TWO_CC('B', 'A'):\n        case YY_TWO_CC('B', 'M'):\n        case YY_TWO_CC('I', 'C'):\n        case YY_TWO_CC('P', 'I'):\n        case YY_TWO_CC('C', 'I'):\n        case YY_TWO_CC('C', 'P'): { // BMP\n            return YYImageTypeBMP;\n        }\n        case YY_TWO_CC(0xFF, 0x4F): { // JPEG2000\n            return YYImageTypeJPEG2000;\n        }\n    }\n    \n    // JPG             FF D8 FF\n    if (memcmp(bytes,\"\\377\\330\\377\",3) == 0) return YYImageTypeJPEG;\n    \n    // JP2\n    if (memcmp(bytes + 4, \"\\152\\120\\040\\040\\015\", 5) == 0) return YYImageTypeJPEG2000;\n    \n    return YYImageTypeUnknown;\n}\n\nCFStringRef YYImageTypeToUTType(YYImageType type) {\n    switch (type) {\n        case YYImageTypeJPEG: return kUTTypeJPEG;\n        case YYImageTypeJPEG2000: return kUTTypeJPEG2000;\n        case YYImageTypeTIFF: return kUTTypeTIFF;\n        case YYImageTypeBMP: return kUTTypeBMP;\n        case YYImageTypeICO: return kUTTypeICO;\n        case YYImageTypeICNS: return kUTTypeAppleICNS;\n        case YYImageTypeGIF: return kUTTypeGIF;\n        case YYImageTypePNG: return kUTTypePNG;\n        default: return NULL;\n    }\n}\n\nYYImageType YYImageTypeFromUTType(CFStringRef uti) {\n    static NSDictionary *dic;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        dic = @{(id)kUTTypeJPEG : @(YYImageTypeJPEG),\n                (id)kUTTypeJPEG2000 : @(YYImageTypeJPEG2000),\n                (id)kUTTypeTIFF : @(YYImageTypeTIFF),\n                (id)kUTTypeBMP : @(YYImageTypeBMP),\n                (id)kUTTypeICO : @(YYImageTypeICO),\n                (id)kUTTypeAppleICNS : @(YYImageTypeICNS),\n                (id)kUTTypeGIF : @(YYImageTypeGIF),\n                (id)kUTTypePNG : @(YYImageTypePNG)};\n    });\n    if (!uti) return YYImageTypeUnknown;\n    NSNumber *num = dic[(__bridge __strong id)(uti)];\n    return num.unsignedIntegerValue;\n}\n\nNSString *YYImageTypeGetExtension(YYImageType type) {\n    switch (type) {\n        case YYImageTypeJPEG: return @\"jpg\";\n        case YYImageTypeJPEG2000: return @\"jp2\";\n        case YYImageTypeTIFF: return @\"tiff\";\n        case YYImageTypeBMP: return @\"bmp\";\n        case YYImageTypeICO: return @\"ico\";\n        case YYImageTypeICNS: return @\"icns\";\n        case YYImageTypeGIF: return @\"gif\";\n        case YYImageTypePNG: return @\"png\";\n        case YYImageTypeWebP: return @\"webp\";\n        default: return nil;\n    }\n}\n\nCFDataRef YYCGImageCreateEncodedData(CGImageRef imageRef, YYImageType type, CGFloat quality) {\n    if (!imageRef) return nil;\n    quality = quality < 0 ? 0 : quality > 1 ? 1 : quality;\n    \n    if (type == YYImageTypeWebP) {\n#if YYIMAGE_WEBP_ENABLED\n        if (quality == 1) {\n            return YYCGImageCreateEncodedWebPData(imageRef, YES, quality, 4, YYImagePresetDefault);\n        } else {\n            return YYCGImageCreateEncodedWebPData(imageRef, NO, quality, 4, YYImagePresetDefault);\n        }\n#else\n        return NULL;\n#endif\n    }\n    \n    CFStringRef uti = YYImageTypeToUTType(type);\n    if (!uti) return nil;\n    \n    CFMutableDataRef data = CFDataCreateMutable(CFAllocatorGetDefault(), 0);\n    if (!data) return NULL;\n    CGImageDestinationRef dest = CGImageDestinationCreateWithData(data, uti, 1, NULL);\n    if (!dest) {\n        CFRelease(data);\n        return NULL;\n    }\n    NSDictionary *options = @{(id)kCGImageDestinationLossyCompressionQuality : @(quality) };\n    CGImageDestinationAddImage(dest, imageRef, (CFDictionaryRef)options);\n    if (!CGImageDestinationFinalize(dest)) {\n        CFRelease(data);\n        CFRelease(dest);\n        return nil;\n    }\n    CFRelease(dest);\n    \n    if (CFDataGetLength(data) == 0) {\n        CFRelease(data);\n        return NULL;\n    }\n    return data;\n}\n\n#if YYIMAGE_WEBP_ENABLED\n\nBOOL YYImageWebPAvailable() {\n    return YES;\n}\n\nCFDataRef YYCGImageCreateEncodedWebPData(CGImageRef imageRef, BOOL lossless, CGFloat quality, int compressLevel, YYImagePreset preset) {\n    if (!imageRef) return nil;\n    size_t width = CGImageGetWidth(imageRef);\n    size_t height = CGImageGetHeight(imageRef);\n    if (width == 0 || width > WEBP_MAX_DIMENSION) return nil;\n    if (height == 0 || height > WEBP_MAX_DIMENSION) return nil;\n    \n    vImage_Buffer buffer = {0};\n    if(!YYCGImageDecodeToBitmapBufferWith32BitFormat(imageRef, &buffer, kCGImageAlphaLast | kCGBitmapByteOrderDefault)) return nil;\n    \n    WebPConfig config = {0};\n    WebPPicture picture = {0};\n    WebPMemoryWriter writer = {0};\n    CFDataRef webpData = NULL;\n    BOOL pictureNeedFree = NO;\n    \n    quality = quality < 0 ? 0 : quality > 1 ? 1 : quality;\n    preset = preset > YYImagePresetText ? YYImagePresetDefault : preset;\n    compressLevel = compressLevel < 0 ? 0 : compressLevel > 6 ? 6 : compressLevel;\n    if (!WebPConfigPreset(&config, (WebPPreset)preset, quality)) goto fail;\n    \n    config.quality = round(quality * 100.0);\n    config.lossless = lossless;\n    config.method = compressLevel;\n    switch ((WebPPreset)preset) {\n        case WEBP_PRESET_DEFAULT: {\n            config.image_hint = WEBP_HINT_DEFAULT;\n        } break;\n        case WEBP_PRESET_PICTURE: {\n            config.image_hint = WEBP_HINT_PICTURE;\n        } break;\n        case WEBP_PRESET_PHOTO: {\n            config.image_hint = WEBP_HINT_PHOTO;\n        } break;\n        case WEBP_PRESET_DRAWING:\n        case WEBP_PRESET_ICON:\n        case WEBP_PRESET_TEXT: {\n            config.image_hint = WEBP_HINT_GRAPH;\n        } break;\n    }\n    if (!WebPValidateConfig(&config)) goto fail;\n    \n    if (!WebPPictureInit(&picture)) goto fail;\n    pictureNeedFree = YES;\n    picture.width = (int)buffer.width;\n    picture.height = (int)buffer.height;\n    picture.use_argb = lossless;\n    if(!WebPPictureImportRGBA(&picture, buffer.data, (int)buffer.rowBytes)) goto fail;\n    \n    WebPMemoryWriterInit(&writer);\n    picture.writer = WebPMemoryWrite;\n    picture.custom_ptr = &writer;\n    if(!WebPEncode(&config, &picture)) goto fail;\n    \n    webpData = CFDataCreate(CFAllocatorGetDefault(), writer.mem, writer.size);\n    free(writer.mem);\n    WebPPictureFree(&picture);\n    free(buffer.data);\n    return webpData;\n    \nfail:\n    if (buffer.data) free(buffer.data);\n    if (pictureNeedFree) WebPPictureFree(&picture);\n    return nil;\n}\n\nNSUInteger YYImageGetWebPFrameCount(CFDataRef webpData) {\n    if (!webpData || CFDataGetLength(webpData) == 0) return 0;\n    \n    WebPData data = {CFDataGetBytePtr(webpData), CFDataGetLength(webpData)};\n    WebPDemuxer *demuxer = WebPDemux(&data);\n    if (!demuxer) return 0;\n    NSUInteger webpFrameCount = WebPDemuxGetI(demuxer, WEBP_FF_FRAME_COUNT);\n    WebPDemuxDelete(demuxer);\n    return webpFrameCount;\n}\n\nCGImageRef YYCGImageCreateWithWebPData(CFDataRef webpData,\n                                       BOOL decodeForDisplay,\n                                       BOOL useThreads,\n                                       BOOL bypassFiltering,\n                                       BOOL noFancyUpsampling) {\n    /*\n     Call WebPDecode() on a multi-frame webp data will get an error (VP8_STATUS_UNSUPPORTED_FEATURE).\n     Use WebPDemuxer to unpack it first.\n     */\n    WebPData data = {0};\n    WebPDemuxer *demuxer = NULL;\n    \n    int frameCount = 0, canvasWidth = 0, canvasHeight = 0;\n    WebPIterator iter = {0};\n    BOOL iterInited = NO;\n    const uint8_t *payload = NULL;\n    size_t payloadSize = 0;\n    WebPDecoderConfig config = {0};\n    \n    BOOL hasAlpha = NO;\n    size_t bitsPerComponent = 0, bitsPerPixel = 0, bytesPerRow = 0, destLength = 0;\n    CGBitmapInfo bitmapInfo = 0;\n    WEBP_CSP_MODE colorspace = 0;\n    void *destBytes = NULL;\n    CGDataProviderRef provider = NULL;\n    CGImageRef imageRef = NULL;\n    \n    if (!webpData || CFDataGetLength(webpData) == 0) return NULL;\n    data.bytes = CFDataGetBytePtr(webpData);\n    data.size = CFDataGetLength(webpData);\n    demuxer = WebPDemux(&data);\n    if (!demuxer) goto fail;\n    \n    frameCount = WebPDemuxGetI(demuxer, WEBP_FF_FRAME_COUNT);\n    if (frameCount == 0) {\n        goto fail;\n        \n    } else if (frameCount == 1) { // single-frame\n        payload = data.bytes;\n        payloadSize = data.size;\n        if (!WebPInitDecoderConfig(&config)) goto fail;\n        if (WebPGetFeatures(payload , payloadSize, &config.input) != VP8_STATUS_OK) goto fail;\n        canvasWidth = config.input.width;\n        canvasHeight = config.input.height;\n        \n    } else { // multi-frame\n        canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH);\n        canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT);\n        if (canvasWidth < 1 || canvasHeight < 1) goto fail;\n        \n        if (!WebPDemuxGetFrame(demuxer, 1, &iter)) goto fail;\n        iterInited = YES;\n        \n        if (iter.width > canvasWidth || iter.height > canvasHeight) goto fail;\n        payload = iter.fragment.bytes;\n        payloadSize = iter.fragment.size;\n        \n        if (!WebPInitDecoderConfig(&config)) goto fail;\n        if (WebPGetFeatures(payload , payloadSize, &config.input) != VP8_STATUS_OK) goto fail;\n    }\n    if (payload == NULL || payloadSize == 0) goto fail;\n    \n    hasAlpha = config.input.has_alpha;\n    bitsPerComponent = 8;\n    bitsPerPixel = 32;\n    bytesPerRow = YYImageByteAlign(bitsPerPixel / 8 * canvasWidth, 32);\n    destLength = bytesPerRow * canvasHeight;\n    if (decodeForDisplay) {\n        bitmapInfo = kCGBitmapByteOrder32Host;\n        bitmapInfo |= hasAlpha ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst;\n        colorspace = MODE_bgrA; // small endian\n    } else {\n        bitmapInfo = kCGBitmapByteOrderDefault;\n        bitmapInfo |= hasAlpha ? kCGImageAlphaLast : kCGImageAlphaNoneSkipLast;\n        colorspace = MODE_RGBA;\n    }\n    destBytes = calloc(1, destLength);\n    if (!destBytes) goto fail;\n    \n    config.options.use_threads = useThreads; //speed up 23%\n    config.options.bypass_filtering = bypassFiltering; //speed up 11%, cause some banding\n    config.options.no_fancy_upsampling = noFancyUpsampling; //speed down 16%, lose some details\n    config.output.colorspace = colorspace;\n    config.output.is_external_memory = 1;\n    config.output.u.RGBA.rgba = destBytes;\n    config.output.u.RGBA.stride = (int)bytesPerRow;\n    config.output.u.RGBA.size = destLength;\n    \n    VP8StatusCode result = WebPDecode(payload, payloadSize, &config);\n    if ((result != VP8_STATUS_OK) && (result != VP8_STATUS_NOT_ENOUGH_DATA)) goto fail;\n    \n    if (iter.x_offset != 0 || iter.y_offset != 0) {\n        void *tmp = calloc(1, destLength);\n        if (tmp) {\n            vImage_Buffer src = {destBytes, canvasHeight, canvasWidth, bytesPerRow};\n            vImage_Buffer dest = {tmp, canvasHeight, canvasWidth, bytesPerRow};\n            vImage_CGAffineTransform transform = {1, 0, 0, 1, iter.x_offset, -iter.y_offset};\n            uint8_t backColor[4] = {0};\n            vImageAffineWarpCG_ARGB8888(&src, &dest, NULL, &transform, backColor, kvImageBackgroundColorFill);\n            memcpy(destBytes, tmp, destLength);\n            free(tmp);\n        }\n    }\n    \n    provider = CGDataProviderCreateWithData(destBytes, destBytes, destLength, YYCGDataProviderReleaseDataCallback);\n    if (!provider) goto fail;\n    destBytes = NULL; // hold by provider\n    \n    imageRef = CGImageCreate(canvasWidth, canvasHeight, bitsPerComponent, bitsPerPixel, bytesPerRow, YYCGColorSpaceGetDeviceRGB(), bitmapInfo, provider, NULL, false, kCGRenderingIntentDefault);\n    \n    CFRelease(provider);\n    if (iterInited) WebPDemuxReleaseIterator(&iter);\n    WebPDemuxDelete(demuxer);\n    \n    return imageRef;\n    \nfail:\n    if (destBytes) free(destBytes);\n    if (provider) CFRelease(provider);\n    if (iterInited) WebPDemuxReleaseIterator(&iter);\n    if (demuxer) WebPDemuxDelete(demuxer);\n    return NULL;\n}\n\n#else\n\nBOOL YYImageWebPAvailable() {\n    return NO;\n}\n\nCFDataRef YYCGImageCreateEncodedWebPData(CGImageRef imageRef, BOOL lossless, CGFloat quality, int compressLevel, YYImagePreset preset) {\n    NSLog(@\"WebP decoder is disabled\");\n    return NULL;\n}\n\nNSUInteger YYImageGetWebPFrameCount(CFDataRef webpData) {\n    NSLog(@\"WebP decoder is disabled\");\n    return 0;\n}\n\nCGImageRef YYCGImageCreateWithWebPData(CFDataRef webpData,\n                                       BOOL decodeForDisplay,\n                                       BOOL useThreads,\n                                       BOOL bypassFiltering,\n                                       BOOL noFancyUpsampling) {\n    NSLog(@\"WebP decoder is disabled\");\n    return NULL;\n}\n\n#endif\n\n\n////////////////////////////////////////////////////////////////////////////////\n#pragma mark - Decoder\n\n@implementation YYImageFrame\n+ (instancetype)frameWithImage:(UIImage *)image {\n    YYImageFrame *frame = [self new];\n    frame.image = image;\n    return frame;\n}\n- (id)copyWithZone:(NSZone *)zone {\n    YYImageFrame *frame = [self.class new];\n    frame.index = _index;\n    frame.width = _width;\n    frame.height = _height;\n    frame.offsetX = _offsetX;\n    frame.offsetY = _offsetY;\n    frame.duration = _duration;\n    frame.dispose = _dispose;\n    frame.blend = _blend;\n    frame.image = _image.copy;\n    return frame;\n}\n@end\n\n// Internal frame object.\n@interface _YYImageDecoderFrame : YYImageFrame\n@property (nonatomic, assign) BOOL hasAlpha;                ///< Whether frame has alpha.\n@property (nonatomic, assign) BOOL isFullSize;              ///< Whether frame fill the canvas.\n@property (nonatomic, assign) NSUInteger blendFromIndex;    ///< Blend from frame index to current frame.\n@end\n\n@implementation _YYImageDecoderFrame\n- (id)copyWithZone:(NSZone *)zone {\n    _YYImageDecoderFrame *frame = [super copyWithZone:zone];\n    frame.hasAlpha = _hasAlpha;\n    frame.isFullSize = _isFullSize;\n    frame.blendFromIndex = _blendFromIndex;\n    return frame;\n}\n@end\n\n\n@implementation YYImageDecoder {\n    pthread_mutex_t _lock; // recursive lock\n    \n    BOOL _sourceTypeDetected;\n    CGImageSourceRef _source;\n    yy_png_info *_apngSource;\n#if YYIMAGE_WEBP_ENABLED\n    WebPDemuxer *_webpSource;\n#endif\n    \n    UIImageOrientation _orientation;\n    dispatch_semaphore_t _framesLock;\n    NSArray *_frames; ///< Array<GGImageDecoderFrame>, without image\n    BOOL _needBlend;\n    NSUInteger _blendFrameIndex;\n    CGContextRef _blendCanvas;\n}\n\n- (void)dealloc {\n    if (_source) CFRelease(_source);\n    if (_apngSource) yy_png_info_release(_apngSource);\n#if YYIMAGE_WEBP_ENABLED\n    if (_webpSource) WebPDemuxDelete(_webpSource);\n#endif\n    if (_blendCanvas) CFRelease(_blendCanvas);\n    pthread_mutex_destroy(&_lock);\n}\n\n+ (instancetype)decoderWithData:(NSData *)data scale:(CGFloat)scale {\n    if (!data) return nil;\n    YYImageDecoder *decoder = [[YYImageDecoder alloc] initWithScale:scale];\n    [decoder updateData:data final:YES];\n    if (decoder.frameCount == 0) return nil;\n    return decoder;\n}\n\n- (instancetype)init {\n    return [self initWithScale:[UIScreen mainScreen].scale];\n}\n\n- (instancetype)initWithScale:(CGFloat)scale {\n    self = [super init];\n    if (scale <= 0) scale = 1;\n    _scale = scale;\n    _framesLock = dispatch_semaphore_create(1);\n    \n    pthread_mutexattr_t attr;\n    pthread_mutexattr_init (&attr);\n    pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);\n    pthread_mutex_init (&_lock, &attr);\n    pthread_mutexattr_destroy (&attr);\n    \n    return self;\n}\n\n- (BOOL)updateData:(NSData *)data final:(BOOL)final {\n    BOOL result = NO;\n    pthread_mutex_lock(&_lock);\n    result = [self _updateData:data final:final];\n    pthread_mutex_unlock(&_lock);\n    return result;\n}\n\n- (YYImageFrame *)frameAtIndex:(NSUInteger)index decodeForDisplay:(BOOL)decodeForDisplay {\n    YYImageFrame *result = nil;\n    pthread_mutex_lock(&_lock);\n    result = [self _frameAtIndex:index decodeForDisplay:decodeForDisplay];\n    pthread_mutex_unlock(&_lock);\n    return result;\n}\n\n- (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index {\n    NSTimeInterval result = 0;\n    dispatch_semaphore_wait(_framesLock, DISPATCH_TIME_FOREVER);\n    if (index < _frames.count) {\n        result = ((_YYImageDecoderFrame *)_frames[index]).duration;\n    }\n    dispatch_semaphore_signal(_framesLock);\n    return result;\n}\n\n- (NSDictionary *)framePropertiesAtIndex:(NSUInteger)index {\n    NSDictionary *result = nil;\n    pthread_mutex_lock(&_lock);\n    result = [self _framePropertiesAtIndex:index];\n    pthread_mutex_unlock(&_lock);\n    return result;\n}\n\n- (NSDictionary *)imageProperties {\n    NSDictionary *result = nil;\n    pthread_mutex_lock(&_lock);\n    result = [self _imageProperties];\n    pthread_mutex_unlock(&_lock);\n    return result;\n}\n\n#pragma private (wrap)\n\n- (BOOL)_updateData:(NSData *)data final:(BOOL)final {\n    if (_finalized) return NO;\n    if (data.length < _data.length) return NO;\n    _finalized = final;\n    _data = data;\n    \n    YYImageType type = YYImageDetectType((__bridge CFDataRef)data);\n    if (_sourceTypeDetected) {\n        if (_type != type) {\n            return NO;\n        } else {\n            [self _updateSource];\n        }\n    } else {\n        if (_data.length > 16) {\n            _type = type;\n            _sourceTypeDetected = YES;\n            [self _updateSource];\n        }\n    }\n    return YES;\n}\n\n- (YYImageFrame *)_frameAtIndex:(NSUInteger)index decodeForDisplay:(BOOL)decodeForDisplay {\n    if (index >= _frames.count) return 0;\n    _YYImageDecoderFrame *frame = [(_YYImageDecoderFrame *)_frames[index] copy];\n    BOOL decoded = NO;\n    BOOL extendToCanvas = NO;\n    if (_type != YYImageTypeICO && decodeForDisplay) { // ICO contains multi-size frame and should not extend to canvas.\n        extendToCanvas = YES;\n    }\n    \n    if (!_needBlend) {\n        CGImageRef imageRef = [self _newUnblendedImageAtIndex:index extendToCanvas:extendToCanvas decoded:&decoded];\n        if (!imageRef) return nil;\n        if (decodeForDisplay && !decoded) {\n            CGImageRef imageRefDecoded = YYCGImageCreateDecodedCopy(imageRef, YES);\n            if (imageRefDecoded) {\n                CFRelease(imageRef);\n                imageRef = imageRefDecoded;\n                decoded = YES;\n            }\n        }\n        UIImage *image = [UIImage imageWithCGImage:imageRef scale:_scale orientation:_orientation];\n        CFRelease(imageRef);\n        if (!image) return nil;\n        image.yy_isDecodedForDisplay = decoded;\n        frame.image = image;\n        return frame;\n    }\n    \n    // blend\n    if (![self _createBlendContextIfNeeded]) return nil;\n    CGImageRef imageRef = NULL;\n    \n    if (_blendFrameIndex + 1 == frame.index) {\n        imageRef = [self _newBlendedImageWithFrame:frame];\n        _blendFrameIndex = index;\n    } else { // should draw canvas from previous frame\n        _blendFrameIndex = NSNotFound;\n        CGContextClearRect(_blendCanvas, CGRectMake(0, 0, _width, _height));\n        \n        if (frame.blendFromIndex == frame.index) {\n            CGImageRef unblendedImage = [self _newUnblendedImageAtIndex:index extendToCanvas:NO decoded:NULL];\n            if (unblendedImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendedImage);\n                CFRelease(unblendedImage);\n            }\n            imageRef = CGBitmapContextCreateImage(_blendCanvas);\n            if (frame.dispose == YYImageDisposeBackground) {\n                CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n            }\n            _blendFrameIndex = index;\n        } else { // canvas is not ready\n            for (uint32_t i = (uint32_t)frame.blendFromIndex; i <= (uint32_t)frame.index; i++) {\n                if (i == frame.index) {\n                    if (!imageRef) imageRef = [self _newBlendedImageWithFrame:frame];\n                } else {\n                    [self _blendImageWithFrame:_frames[i]];\n                }\n            }\n            _blendFrameIndex = index;\n        }\n    }\n    \n    if (!imageRef) return nil;\n    UIImage *image = [UIImage imageWithCGImage:imageRef scale:_scale orientation:_orientation];\n    CFRelease(imageRef);\n    if (!image) return nil;\n    \n    image.yy_isDecodedForDisplay = YES;\n    frame.image = image;\n    if (extendToCanvas) {\n        frame.width = _width;\n        frame.height = _height;\n        frame.offsetX = 0;\n        frame.offsetY = 0;\n        frame.dispose = YYImageDisposeNone;\n        frame.blend = YYImageBlendNone;\n    }\n    return frame;\n}\n\n- (NSDictionary *)_framePropertiesAtIndex:(NSUInteger)index {\n    if (index >= _frames.count) return nil;\n    if (!_source) return nil;\n    CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_source, index, NULL);\n    if (!properties) return nil;\n    return CFBridgingRelease(properties);\n}\n\n- (NSDictionary *)_imageProperties {\n    if (!_source) return nil;\n    CFDictionaryRef properties = CGImageSourceCopyProperties(_source, NULL);\n    if (!properties) return nil;\n    return CFBridgingRelease(properties);\n}\n\n#pragma private\n\n- (void)_updateSource {\n    switch (_type) {\n        case YYImageTypeWebP: {\n            [self _updateSourceWebP];\n        } break;\n            \n        case YYImageTypePNG: {\n            [self _updateSourceAPNG];\n        } break;\n            \n        default: {\n            [self _updateSourceImageIO];\n        } break;\n    }\n}\n\n- (void)_updateSourceWebP {\n#if YYIMAGE_WEBP_ENABLED\n    _width = 0;\n    _height = 0;\n    _loopCount = 0;\n    if (_webpSource) WebPDemuxDelete(_webpSource);\n    _webpSource = NULL;\n    dispatch_semaphore_wait(_framesLock, DISPATCH_TIME_FOREVER);\n    _frames = nil;\n    dispatch_semaphore_signal(_framesLock);\n    \n    /*\n     https://developers.google.com/speed/webp/docs/api\n     The documentation said we can use WebPIDecoder to decode webp progressively, \n     but currently it can only returns an empty image (not same as progressive jpegs),\n     so we don't use progressive decoding.\n     \n     When using WebPDecode() to decode multi-frame webp, we will get the error\n     \"VP8_STATUS_UNSUPPORTED_FEATURE\", so we first use WebPDemuxer to unpack it.\n     */\n    \n    WebPData webPData = {0};\n    webPData.bytes = _data.bytes;\n    webPData.size = _data.length;\n    WebPDemuxer *demuxer = WebPDemux(&webPData);\n    if (!demuxer) return;\n    \n    uint32_t webpFrameCount = WebPDemuxGetI(demuxer, WEBP_FF_FRAME_COUNT);\n    uint32_t webpLoopCount =  WebPDemuxGetI(demuxer, WEBP_FF_LOOP_COUNT);\n    uint32_t canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH);\n    uint32_t canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT);\n    if (webpFrameCount == 0 || canvasWidth < 1 || canvasHeight < 1) {\n        WebPDemuxDelete(demuxer);\n        return;\n    }\n    \n    NSMutableArray *frames = [NSMutableArray new];\n    BOOL needBlend = NO;\n    uint32_t iterIndex = 0;\n    uint32_t lastBlendIndex = 0;\n    WebPIterator iter = {0};\n    if (WebPDemuxGetFrame(demuxer, 1, &iter)) { // one-based index...\n        do {\n            _YYImageDecoderFrame *frame = [_YYImageDecoderFrame new];\n            [frames addObject:frame];\n            if (iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) {\n                frame.dispose = YYImageDisposeBackground;\n            }\n            if (iter.blend_method == WEBP_MUX_BLEND) {\n                frame.blend = YYImageBlendOver;\n            }\n            \n            int canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH);\n            int canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT);\n            frame.index = iterIndex;\n            frame.duration = iter.duration / 1000.0;\n            frame.width = iter.width;\n            frame.height = iter.height;\n            frame.hasAlpha = iter.has_alpha;\n            frame.blend = iter.blend_method == WEBP_MUX_BLEND;\n            frame.offsetX = iter.x_offset;\n            frame.offsetY = canvasHeight - iter.y_offset - iter.height;\n            \n            BOOL sizeEqualsToCanvas = (iter.width == canvasWidth && iter.height == canvasHeight);\n            BOOL offsetIsZero = (iter.x_offset == 0 && iter.y_offset == 0);\n            frame.isFullSize = (sizeEqualsToCanvas && offsetIsZero);\n            \n            if ((!frame.blend || !frame.hasAlpha) && frame.isFullSize) {\n                frame.blendFromIndex = lastBlendIndex = iterIndex;\n            } else {\n                if (frame.dispose && frame.isFullSize) {\n                    frame.blendFromIndex = lastBlendIndex;\n                    lastBlendIndex = iterIndex + 1;\n                } else {\n                    frame.blendFromIndex = lastBlendIndex;\n                }\n            }\n            if (frame.index != frame.blendFromIndex) needBlend = YES;\n            iterIndex++;\n        } while (WebPDemuxNextFrame(&iter));\n        WebPDemuxReleaseIterator(&iter);\n    }\n    if (frames.count != webpFrameCount) {\n        WebPDemuxDelete(demuxer);\n        return;\n    }\n    \n    _width = canvasWidth;\n    _height = canvasHeight;\n    _frameCount = frames.count;\n    _loopCount = webpLoopCount;\n    _needBlend = needBlend;\n    _webpSource = demuxer;\n    dispatch_semaphore_wait(_framesLock, DISPATCH_TIME_FOREVER);\n    _frames = frames;\n    dispatch_semaphore_signal(_framesLock);\n#else\n    static const char *func = __FUNCTION__;\n    static const int line = __LINE__;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSLog(@\"[%s: %d] WebP is not available, check the documentation to see how to install WebP component: https://github.com/ibireme/YYImage#installation\", func, line);\n    });\n#endif\n}\n\n- (void)_updateSourceAPNG {\n    /*\n     APNG extends PNG format to support animation, it was supported by ImageIO\n     since iOS 8.\n     \n     We use a custom APNG decoder to make APNG available in old system, so we\n     ignore the ImageIO's APNG frame info. Typically the custom decoder is a bit\n     faster than ImageIO.\n     */\n    \n    yy_png_info_release(_apngSource);\n    _apngSource = nil;\n    \n    [self _updateSourceImageIO]; // decode first frame\n    if (_frameCount == 0) return; // png decode failed\n    if (!_finalized) return; // ignore multi-frame before finalized\n    \n    yy_png_info *apng = yy_png_info_create(_data.bytes, (uint32_t)_data.length);\n    if (!apng) return; // apng decode failed\n    if (apng->apng_frame_num == 0 ||\n        (apng->apng_frame_num == 1 && apng->apng_first_frame_is_cover)) {\n        yy_png_info_release(apng);\n        return; // no animation\n    }\n    if (_source) { // apng decode succeed, no longer need image souce\n        CFRelease(_source);\n        _source = NULL;\n    }\n    \n    uint32_t canvasWidth = apng->header.width;\n    uint32_t canvasHeight = apng->header.height;\n    NSMutableArray *frames = [NSMutableArray new];\n    BOOL needBlend = NO;\n    uint32_t lastBlendIndex = 0;\n    for (uint32_t i = 0; i < apng->apng_frame_num; i++) {\n        _YYImageDecoderFrame *frame = [_YYImageDecoderFrame new];\n        [frames addObject:frame];\n        \n        yy_png_frame_info *fi = apng->apng_frames + i;\n        frame.index = i;\n        frame.duration = yy_png_delay_to_seconds(fi->frame_control.delay_num, fi->frame_control.delay_den);\n        frame.hasAlpha = YES;\n        frame.width = fi->frame_control.width;\n        frame.height = fi->frame_control.height;\n        frame.offsetX = fi->frame_control.x_offset;\n        frame.offsetY = canvasHeight - fi->frame_control.y_offset - fi->frame_control.height;\n        \n        BOOL sizeEqualsToCanvas = (frame.width == canvasWidth && frame.height == canvasHeight);\n        BOOL offsetIsZero = (fi->frame_control.x_offset == 0 && fi->frame_control.y_offset == 0);\n        frame.isFullSize = (sizeEqualsToCanvas && offsetIsZero);\n        \n        switch (fi->frame_control.dispose_op) {\n            case YY_PNG_DISPOSE_OP_BACKGROUND: {\n                frame.dispose = YYImageDisposeBackground;\n            } break;\n            case YY_PNG_DISPOSE_OP_PREVIOUS: {\n                frame.dispose = YYImageDisposePrevious;\n            } break;\n            default: {\n                frame.dispose = YYImageDisposeNone;\n            } break;\n        }\n        switch (fi->frame_control.blend_op) {\n            case YY_PNG_BLEND_OP_OVER: {\n                frame.blend = YYImageBlendOver;\n            } break;\n                \n            default: {\n                frame.blend = YYImageBlendNone;\n            } break;\n        }\n        \n        if (frame.blend == YYImageBlendNone && frame.isFullSize) {\n            frame.blendFromIndex  = i;\n            if (frame.dispose != YYImageDisposePrevious) lastBlendIndex = i;\n        } else {\n            if (frame.dispose == YYImageDisposeBackground && frame.isFullSize) {\n                frame.blendFromIndex = lastBlendIndex;\n                lastBlendIndex = i + 1;\n            } else {\n                frame.blendFromIndex = lastBlendIndex;\n            }\n        }\n        if (frame.index != frame.blendFromIndex) needBlend = YES;\n    }\n    \n    _width = canvasWidth;\n    _height = canvasHeight;\n    _frameCount = frames.count;\n    _loopCount = apng->apng_loop_num;\n    _needBlend = needBlend;\n    _apngSource = apng;\n    dispatch_semaphore_wait(_framesLock, DISPATCH_TIME_FOREVER);\n    _frames = frames;\n    dispatch_semaphore_signal(_framesLock);\n}\n\n- (void)_updateSourceImageIO {\n    _width = 0;\n    _height = 0;\n    _orientation = UIImageOrientationUp;\n    _loopCount = 0;\n    dispatch_semaphore_wait(_framesLock, DISPATCH_TIME_FOREVER);\n    _frames = nil;\n    dispatch_semaphore_signal(_framesLock);\n    \n    if (!_source) {\n        if (_finalized) {\n            _source = CGImageSourceCreateWithData((__bridge CFDataRef)_data, NULL);\n        } else {\n            _source = CGImageSourceCreateIncremental(NULL);\n            if (_source) CGImageSourceUpdateData(_source, (__bridge CFDataRef)_data, false);\n        }\n    } else {\n        CGImageSourceUpdateData(_source, (__bridge CFDataRef)_data, _finalized);\n    }\n    if (!_source) return;\n    \n    _frameCount = CGImageSourceGetCount(_source);\n    if (_frameCount == 0) return;\n    \n    if (!_finalized) { // ignore multi-frame before finalized\n        _frameCount = 1;\n    } else {\n        if (_type == YYImageTypePNG) { // use custom apng decoder and ignore multi-frame\n            _frameCount = 1;\n        }\n        if (_type == YYImageTypeGIF) { // get gif loop count\n            CFDictionaryRef properties = CGImageSourceCopyProperties(_source, NULL);\n            if (properties) {\n                CFDictionaryRef gif = CFDictionaryGetValue(properties, kCGImagePropertyGIFDictionary);\n                if (gif) {\n                    CFTypeRef loop = CFDictionaryGetValue(gif, kCGImagePropertyGIFLoopCount);\n                    if (loop) CFNumberGetValue(loop, kCFNumberNSIntegerType, &_loopCount);\n                }\n                CFRelease(properties);\n            }\n        }\n    }\n\n    /*\n     ICO, GIF, APNG may contains multi-frame.\n     */\n    NSMutableArray *frames = [NSMutableArray new];\n    for (NSUInteger i = 0; i < _frameCount; i++) {\n        _YYImageDecoderFrame *frame = [_YYImageDecoderFrame new];\n        frame.index = i;\n        frame.blendFromIndex = i;\n        frame.hasAlpha = YES;\n        frame.isFullSize = YES;\n        [frames addObject:frame];\n        \n        CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_source, i, NULL);\n        if (properties) {\n            NSTimeInterval duration = 0;\n            NSInteger orientationValue = 0, width = 0, height = 0;\n            CFTypeRef value = NULL;\n            \n            value = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth);\n            if (value) CFNumberGetValue(value, kCFNumberNSIntegerType, &width);\n            value = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight);\n            if (value) CFNumberGetValue(value, kCFNumberNSIntegerType, &height);\n            if (_type == YYImageTypeGIF) {\n                CFDictionaryRef gif = CFDictionaryGetValue(properties, kCGImagePropertyGIFDictionary);\n                if (gif) {\n                    // Use the unclamped frame delay if it exists.\n                    value = CFDictionaryGetValue(gif, kCGImagePropertyGIFUnclampedDelayTime);\n                    if (!value) {\n                        // Fall back to the clamped frame delay if the unclamped frame delay does not exist.\n                        value = CFDictionaryGetValue(gif, kCGImagePropertyGIFDelayTime);\n                    }\n                    if (value) CFNumberGetValue(value, kCFNumberDoubleType, &duration);\n                }\n            }\n            \n            frame.width = width;\n            frame.height = height;\n            frame.duration = duration;\n            \n            if (i == 0 && _width + _height == 0) { // init first frame\n                _width = width;\n                _height = height;\n                value = CFDictionaryGetValue(properties, kCGImagePropertyOrientation);\n                if (value) {\n                    CFNumberGetValue(value, kCFNumberNSIntegerType, &orientationValue);\n                    _orientation = YYUIImageOrientationFromEXIFValue(orientationValue);\n                }\n            }\n            CFRelease(properties);\n        }\n    }\n    dispatch_semaphore_wait(_framesLock, DISPATCH_TIME_FOREVER);\n    _frames = frames;\n    dispatch_semaphore_signal(_framesLock);\n}\n\n- (CGImageRef)_newUnblendedImageAtIndex:(NSUInteger)index\n                         extendToCanvas:(BOOL)extendToCanvas\n                                decoded:(BOOL *)decoded CF_RETURNS_RETAINED {\n    \n    if (!_finalized && index > 0) return NULL;\n    if (_frames.count <= index) return NULL;\n    _YYImageDecoderFrame *frame = _frames[index];\n    \n    if (_source) {\n        CGImageRef imageRef = CGImageSourceCreateImageAtIndex(_source, index, (CFDictionaryRef)@{(id)kCGImageSourceShouldCache:@(YES)});\n        if (imageRef && extendToCanvas) {\n            size_t width = CGImageGetWidth(imageRef);\n            size_t height = CGImageGetHeight(imageRef);\n            if (width == _width && height == _height) {\n                CGImageRef imageRefExtended = YYCGImageCreateDecodedCopy(imageRef, YES);\n                if (imageRefExtended) {\n                    CFRelease(imageRef);\n                    imageRef = imageRefExtended;\n                    if (decoded) *decoded = YES;\n                }\n            } else {\n                CGContextRef context = CGBitmapContextCreate(NULL, _width, _height, 8, 0, YYCGColorSpaceGetDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);\n                if (context) {\n                    CGContextDrawImage(context, CGRectMake(0, _height - height, width, height), imageRef);\n                    CGImageRef imageRefExtended = CGBitmapContextCreateImage(context);\n                    CFRelease(context);\n                    if (imageRefExtended) {\n                        CFRelease(imageRef);\n                        imageRef = imageRefExtended;\n                        if (decoded) *decoded = YES;\n                    }\n                }\n            }\n        }\n        return imageRef;\n    }\n    \n    if (_apngSource) {\n        uint32_t size = 0;\n        uint8_t *bytes = yy_png_copy_frame_data_at_index(_data.bytes, _apngSource, (uint32_t)index, &size);\n        if (!bytes) return NULL;\n        CGDataProviderRef provider = CGDataProviderCreateWithData(bytes, bytes, size, YYCGDataProviderReleaseDataCallback);\n        if (!provider) {\n            free(bytes);\n            return NULL;\n        }\n        bytes = NULL; // hold by provider\n        \n        CGImageSourceRef source = CGImageSourceCreateWithDataProvider(provider, NULL);\n        if (!source) {\n            CFRelease(provider);\n            return NULL;\n        }\n        CFRelease(provider);\n        \n        if(CGImageSourceGetCount(source) < 1) {\n            CFRelease(source);\n            return NULL;\n        }\n        \n        CGImageRef imageRef = CGImageSourceCreateImageAtIndex(source, 0, (CFDictionaryRef)@{(id)kCGImageSourceShouldCache:@(YES)});\n        CFRelease(source);\n        if (!imageRef) return NULL;\n        if (extendToCanvas) {\n            CGContextRef context = CGBitmapContextCreate(NULL, _width, _height, 8, 0, YYCGColorSpaceGetDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); //bgrA\n            if (context) {\n                CGContextDrawImage(context, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), imageRef);\n                CFRelease(imageRef);\n                imageRef = CGBitmapContextCreateImage(context);\n                CFRelease(context);\n                if (decoded) *decoded = YES;\n            }\n        }\n        return imageRef;\n    }\n    \n#if YYIMAGE_WEBP_ENABLED\n    if (_webpSource) {\n        WebPIterator iter;\n        if (!WebPDemuxGetFrame(_webpSource, (int)(index + 1), &iter)) return NULL; // demux webp frame data\n        // frame numbers are one-based in webp -----------^\n        \n        int frameWidth = iter.width;\n        int frameHeight = iter.height;\n        if (frameWidth < 1 || frameHeight < 1) return NULL;\n        \n        int width = extendToCanvas ? (int)_width : frameWidth;\n        int height = extendToCanvas ? (int)_height : frameHeight;\n        if (width > _width || height > _height) return NULL;\n        \n        const uint8_t *payload = iter.fragment.bytes;\n        size_t payloadSize = iter.fragment.size;\n        \n        WebPDecoderConfig config;\n        if (!WebPInitDecoderConfig(&config)) {\n            WebPDemuxReleaseIterator(&iter);\n            return NULL;\n        }\n        if (WebPGetFeatures(payload , payloadSize, &config.input) != VP8_STATUS_OK) {\n            WebPDemuxReleaseIterator(&iter);\n            return NULL;\n        }\n        \n        size_t bitsPerComponent = 8;\n        size_t bitsPerPixel = 32;\n        size_t bytesPerRow = YYImageByteAlign(bitsPerPixel / 8 * width, 32);\n        size_t length = bytesPerRow * height;\n        CGBitmapInfo bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst; //bgrA\n        \n        void *pixels = calloc(1, length);\n        if (!pixels) {\n            WebPDemuxReleaseIterator(&iter);\n            return NULL;\n        }\n        \n        config.output.colorspace = MODE_bgrA;\n        config.output.is_external_memory = 1;\n        config.output.u.RGBA.rgba = pixels;\n        config.output.u.RGBA.stride = (int)bytesPerRow;\n        config.output.u.RGBA.size = length;\n        VP8StatusCode result = WebPDecode(payload, payloadSize, &config); // decode\n        if ((result != VP8_STATUS_OK) && (result != VP8_STATUS_NOT_ENOUGH_DATA)) {\n            WebPDemuxReleaseIterator(&iter);\n            free(pixels);\n            return NULL;\n        }\n        WebPDemuxReleaseIterator(&iter);\n        \n        if (extendToCanvas && (iter.x_offset != 0 || iter.y_offset != 0)) {\n            void *tmp = calloc(1, length);\n            if (tmp) {\n                vImage_Buffer src = {pixels, height, width, bytesPerRow};\n                vImage_Buffer dest = {tmp, height, width, bytesPerRow};\n                vImage_CGAffineTransform transform = {1, 0, 0, 1, iter.x_offset, -iter.y_offset};\n                uint8_t backColor[4] = {0};\n                vImage_Error error = vImageAffineWarpCG_ARGB8888(&src, &dest, NULL, &transform, backColor, kvImageBackgroundColorFill);\n                if (error == kvImageNoError) {\n                    memcpy(pixels, tmp, length);\n                }\n                free(tmp);\n            }\n        }\n        \n        CGDataProviderRef provider = CGDataProviderCreateWithData(pixels, pixels, length, YYCGDataProviderReleaseDataCallback);\n        if (!provider) {\n            free(pixels);\n            return NULL;\n        }\n        pixels = NULL; // hold by provider\n        \n        CGImageRef image = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, YYCGColorSpaceGetDeviceRGB(), bitmapInfo, provider, NULL, false, kCGRenderingIntentDefault);\n        CFRelease(provider);\n        if (decoded) *decoded = YES;\n        return image;\n    }\n#endif\n    \n    return NULL;\n}\n\n- (BOOL)_createBlendContextIfNeeded {\n    if (!_blendCanvas) {\n        _blendFrameIndex = NSNotFound;\n        _blendCanvas = CGBitmapContextCreate(NULL, _width, _height, 8, 0, YYCGColorSpaceGetDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);\n    }\n    BOOL suc = _blendCanvas != NULL;\n    return suc;\n}\n\n- (void)_blendImageWithFrame:(_YYImageDecoderFrame *)frame {\n    if (frame.dispose == YYImageDisposePrevious) {\n        // nothing\n    } else if (frame.dispose == YYImageDisposeBackground) {\n        CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n    } else { // no dispose\n        if (frame.blend == YYImageBlendOver) {\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n        } else {\n            CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n        }\n    }\n}\n\n- (CGImageRef)_newBlendedImageWithFrame:(_YYImageDecoderFrame *)frame CF_RETURNS_RETAINED{\n    CGImageRef imageRef = NULL;\n    if (frame.dispose == YYImageDisposePrevious) {\n        if (frame.blend == YYImageBlendOver) {\n            CGImageRef previousImage = CGBitmapContextCreateImage(_blendCanvas);\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n            imageRef = CGBitmapContextCreateImage(_blendCanvas);\n            CGContextClearRect(_blendCanvas, CGRectMake(0, 0, _width, _height));\n            if (previousImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(0, 0, _width, _height), previousImage);\n                CFRelease(previousImage);\n            }\n        } else {\n            CGImageRef previousImage = CGBitmapContextCreateImage(_blendCanvas);\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n            imageRef = CGBitmapContextCreateImage(_blendCanvas);\n            CGContextClearRect(_blendCanvas, CGRectMake(0, 0, _width, _height));\n            if (previousImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(0, 0, _width, _height), previousImage);\n                CFRelease(previousImage);\n            }\n        }\n    } else if (frame.dispose == YYImageDisposeBackground) {\n        if (frame.blend == YYImageBlendOver) {\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n            imageRef = CGBitmapContextCreateImage(_blendCanvas);\n            CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n        } else {\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n            imageRef = CGBitmapContextCreateImage(_blendCanvas);\n            CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n        }\n    } else { // no dispose\n        if (frame.blend == YYImageBlendOver) {\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n            imageRef = CGBitmapContextCreateImage(_blendCanvas);\n        } else {\n            CGImageRef unblendImage = [self _newUnblendedImageAtIndex:frame.index extendToCanvas:NO decoded:NULL];\n            if (unblendImage) {\n                CGContextClearRect(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height));\n                CGContextDrawImage(_blendCanvas, CGRectMake(frame.offsetX, frame.offsetY, frame.width, frame.height), unblendImage);\n                CFRelease(unblendImage);\n            }\n            imageRef = CGBitmapContextCreateImage(_blendCanvas);\n        }\n    }\n    return imageRef;\n}\n\n@end\n\n\n////////////////////////////////////////////////////////////////////////////////\n#pragma mark - Encoder\n\n@implementation YYImageEncoder {\n    NSMutableArray *_images;\n    NSMutableArray *_durations;\n}\n\n- (instancetype)init {\n    @throw [NSException exceptionWithName:@\"YYImageEncoder init error\" reason:@\"YYImageEncoder must be initialized with a type. Use 'initWithType:' instead.\" userInfo:nil];\n    return [self initWithType:YYImageTypeUnknown];\n}\n\n- (instancetype)initWithType:(YYImageType)type {\n    if (type == YYImageTypeUnknown || type >= YYImageTypeOther) {\n        NSLog(@\"[%s: %d] Unsupported image type:%d\",__FUNCTION__, __LINE__, (int)type);\n        return nil;\n    }\n    \n#if !YYIMAGE_WEBP_ENABLED\n    if (type == YYImageTypeWebP) {\n        NSLog(@\"[%s: %d] WebP is not available, check the documentation to see how to install WebP component: https://github.com/ibireme/YYImage#installation\", __FUNCTION__, __LINE__);\n        return nil;\n    }\n#endif\n    \n    self = [super init];\n    if (!self) return nil;\n    _type = type;\n    _images = [NSMutableArray new];\n    _durations = [NSMutableArray new];\n\n    switch (type) {\n        case YYImageTypeJPEG:\n        case YYImageTypeJPEG2000: {\n            _quality = 0.9;\n        } break;\n        case YYImageTypeTIFF:\n        case YYImageTypeBMP:\n        case YYImageTypeGIF:\n        case YYImageTypeICO:\n        case YYImageTypeICNS:\n        case YYImageTypePNG: {\n            _quality = 1;\n            _lossless = YES;\n        } break;\n        case YYImageTypeWebP: {\n            _quality = 0.8;\n        } break;\n        default:\n            break;\n    }\n    \n    return self;\n}\n\n- (void)setQuality:(CGFloat)quality {\n    _quality = quality < 0 ? 0 : quality > 1 ? 1 : quality;\n}\n\n- (void)addImage:(UIImage *)image duration:(NSTimeInterval)duration {\n    if (!image.CGImage) return;\n    duration = duration < 0 ? 0 : duration;\n    [_images addObject:image];\n    [_durations addObject:@(duration)];\n}\n\n- (void)addImageWithData:(NSData *)data duration:(NSTimeInterval)duration {\n    if (data.length == 0) return;\n    duration = duration < 0 ? 0 : duration;\n    [_images addObject:data];\n    [_durations addObject:@(duration)];\n}\n\n- (void)addImageWithFile:(NSString *)path duration:(NSTimeInterval)duration {\n    if (path.length == 0) return;\n    duration = duration < 0 ? 0 : duration;\n    NSURL *url = [NSURL URLWithString:path];\n    if (!url) return;\n    [_images addObject:url];\n    [_durations addObject:@(duration)];\n}\n\n- (BOOL)_imageIOAvaliable {\n    switch (_type) {\n        case YYImageTypeJPEG:\n        case YYImageTypeJPEG2000:\n        case YYImageTypeTIFF:\n        case YYImageTypeBMP:\n        case YYImageTypeICO:\n        case YYImageTypeICNS:\n        case YYImageTypeGIF: {\n            return _images.count > 0;\n        } break;\n        case YYImageTypePNG: {\n            return _images.count == 1;\n        } break;\n        case YYImageTypeWebP: {\n            return NO;\n        } break;\n        default: return NO;\n    }\n}\n\n- (CGImageDestinationRef)_newImageDestination:(id)dest imageCount:(NSUInteger)count CF_RETURNS_RETAINED {\n    if (!dest) return nil;\n    CGImageDestinationRef destination = NULL;\n    if ([dest isKindOfClass:[NSString class]]) {\n        NSURL *url = [[NSURL alloc] initFileURLWithPath:dest];\n        if (url) {\n            destination = CGImageDestinationCreateWithURL((CFURLRef)url, YYImageTypeToUTType(_type), count, NULL);\n        }\n    } else if ([dest isKindOfClass:[NSMutableData class]]) {\n        destination = CGImageDestinationCreateWithData((CFMutableDataRef)dest, YYImageTypeToUTType(_type), count, NULL);\n    }\n    return destination;\n}\n\n- (void)_encodeImageWithDestination:(CGImageDestinationRef)destination imageCount:(NSUInteger)count {\n    if (_type == YYImageTypeGIF) {\n        NSDictionary *gifProperty = @{(__bridge id)kCGImagePropertyGIFDictionary:\n                                        @{(__bridge id)kCGImagePropertyGIFLoopCount: @(_loopCount)}};\n        CGImageDestinationSetProperties(destination, (__bridge CFDictionaryRef)gifProperty);\n    }\n    \n    for (int i = 0; i < count; i++) {\n        @autoreleasepool {\n            id imageSrc = _images[i];\n            NSDictionary *frameProperty = NULL;\n            if (_type == YYImageTypeGIF && count > 1) {\n                frameProperty = @{(NSString *)kCGImagePropertyGIFDictionary : @{(NSString *) kCGImagePropertyGIFDelayTime:_durations[i]}};\n            } else {\n                frameProperty = @{(id)kCGImageDestinationLossyCompressionQuality : @(_quality)};\n            }\n            \n            if ([imageSrc isKindOfClass:[UIImage class]]) {\n                UIImage *image = imageSrc;\n                if (image.imageOrientation != UIImageOrientationUp && image.CGImage) {\n                    CGBitmapInfo info = CGImageGetBitmapInfo(image.CGImage) | CGImageGetAlphaInfo(image.CGImage);\n                    CGImageRef rotated = YYCGImageCreateCopyWithOrientation(image.CGImage, image.imageOrientation, info);\n                    if (rotated) {\n                        image = [UIImage imageWithCGImage:rotated];\n                        CFRelease(rotated);\n                    }\n                }\n                if (image.CGImage) CGImageDestinationAddImage(destination, ((UIImage *)imageSrc).CGImage, (CFDictionaryRef)frameProperty);\n            } else if ([imageSrc isKindOfClass:[NSURL class]]) {\n                CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)imageSrc, NULL);\n                if (source) {\n                    CGImageDestinationAddImageFromSource(destination, source, 0, (CFDictionaryRef)frameProperty);\n                    CFRelease(source);\n                }\n            } else if ([imageSrc isKindOfClass:[NSData class]]) {\n                CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)imageSrc, NULL);\n                if (source) {\n                    CGImageDestinationAddImageFromSource(destination, source, 0, (CFDictionaryRef)frameProperty);\n                    CFRelease(source);\n                }\n            }\n        }\n    }\n}\n\n- (CGImageRef)_newCGImageFromIndex:(NSUInteger)index decoded:(BOOL)decoded CF_RETURNS_RETAINED {\n    UIImage *image = nil;\n    id imageSrc= _images[index];\n    if ([imageSrc isKindOfClass:[UIImage class]]) {\n        image = imageSrc;\n    } else if ([imageSrc isKindOfClass:[NSURL class]]) {\n        image = [UIImage imageWithContentsOfFile:((NSURL *)imageSrc).absoluteString];\n    } else if ([imageSrc isKindOfClass:[NSData class]]) {\n        image = [UIImage imageWithData:imageSrc];\n    }\n    if (!image) return NULL;\n    CGImageRef imageRef = image.CGImage;\n    if (!imageRef) return NULL;\n    if (image.imageOrientation != UIImageOrientationUp) {\n        return YYCGImageCreateCopyWithOrientation(imageRef, image.imageOrientation, kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);\n    }\n    if (decoded) {\n        return YYCGImageCreateDecodedCopy(imageRef, YES);\n    }\n    return (CGImageRef)CFRetain(imageRef);\n}\n\n- (NSData *)_encodeWithImageIO {\n    NSMutableData *data = [NSMutableData new];\n    NSUInteger count = _type == YYImageTypeGIF ? _images.count : 1;\n    CGImageDestinationRef destination = [self _newImageDestination:data imageCount:count];\n    BOOL suc = NO;\n    if (destination) {\n        [self _encodeImageWithDestination:destination imageCount:count];\n        suc = CGImageDestinationFinalize(destination);\n        CFRelease(destination);\n    }\n    if (suc && data.length > 0) {\n        return data;\n    } else {\n        return nil;\n    }\n}\n\n- (BOOL)_encodeWithImageIO:(NSString *)path {\n    NSUInteger count = _type == YYImageTypeGIF ? _images.count : 1;\n    CGImageDestinationRef destination = [self _newImageDestination:path imageCount:count];\n    BOOL suc = NO;\n    if (destination) {\n        [self _encodeImageWithDestination:destination imageCount:count];\n        suc = CGImageDestinationFinalize(destination);\n        CFRelease(destination);\n    }\n    return suc;\n}\n\n- (NSData *)_encodeAPNG {\n    // encode APNG (ImageIO doesn't support APNG encoding, so we use a custom encoder)\n    NSMutableArray *pngDatas = [NSMutableArray new];\n    NSMutableArray *pngSizes = [NSMutableArray new];\n    NSUInteger canvasWidth = 0, canvasHeight = 0;\n    for (int i = 0; i < _images.count; i++) {\n        CGImageRef decoded = [self _newCGImageFromIndex:i decoded:YES];\n        if (!decoded) return nil;\n        CGSize size = CGSizeMake(CGImageGetWidth(decoded), CGImageGetHeight(decoded));\n        [pngSizes addObject:[NSValue valueWithCGSize:size]];\n        if (canvasWidth < size.width) canvasWidth = size.width;\n        if (canvasHeight < size.height) canvasHeight = size.height;\n        CFDataRef frameData = YYCGImageCreateEncodedData(decoded, YYImageTypePNG, 1);\n        CFRelease(decoded);\n        if (!frameData) return nil;\n        [pngDatas addObject:(__bridge id)(frameData)];\n        CFRelease(frameData);\n        if (size.width < 1 || size.height < 1) return nil;\n    }\n    CGSize firstFrameSize = [(NSValue *)[pngSizes firstObject] CGSizeValue];\n    if (firstFrameSize.width < canvasWidth || firstFrameSize.height < canvasHeight) {\n        CGImageRef decoded = [self _newCGImageFromIndex:0 decoded:YES];\n        if (!decoded) return nil;\n        CGContextRef context = CGBitmapContextCreate(NULL, canvasWidth, canvasHeight, 8,\n                                                     0, YYCGColorSpaceGetDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);\n        if (!context) {\n            CFRelease(decoded);\n            return nil;\n        }\n        CGContextDrawImage(context, CGRectMake(0, canvasHeight - firstFrameSize.height, firstFrameSize.width, firstFrameSize.height), decoded);\n        CFRelease(decoded);\n        CGImageRef extendedImage = CGBitmapContextCreateImage(context);\n        CFRelease(context);\n        if (!extendedImage) return nil;\n        CFDataRef frameData = YYCGImageCreateEncodedData(extendedImage, YYImageTypePNG, 1);\n        if (!frameData) {\n            CFRelease(extendedImage);\n            return nil;\n        }\n        pngDatas[0] = (__bridge id)(frameData);\n        CFRelease(frameData);\n    }\n    \n    NSData *firstFrameData = pngDatas[0];\n    yy_png_info *info = yy_png_info_create(firstFrameData.bytes, (uint32_t)firstFrameData.length);\n    if (!info) return nil;\n    NSMutableData *result = [NSMutableData new];\n    BOOL insertBefore = NO, insertAfter = NO;\n    uint32_t apngSequenceIndex = 0;\n    \n    uint32_t png_header[2];\n    png_header[0] = YY_FOUR_CC(0x89, 0x50, 0x4E, 0x47);\n    png_header[1] = YY_FOUR_CC(0x0D, 0x0A, 0x1A, 0x0A);\n    \n    [result appendBytes:png_header length:8];\n    \n    for (int i = 0; i < info->chunk_num; i++) {\n        yy_png_chunk_info *chunk = info->chunks + i;\n        \n        if (!insertBefore && chunk->fourcc == YY_FOUR_CC('I', 'D', 'A', 'T')) {\n            insertBefore = YES;\n            // insert acTL (APNG Control)\n            uint32_t acTL[5] = {0};\n            acTL[0] = yy_swap_endian_uint32(8); //length\n            acTL[1] = YY_FOUR_CC('a', 'c', 'T', 'L'); // fourcc\n            acTL[2] = yy_swap_endian_uint32((uint32_t)pngDatas.count); // num frames\n            acTL[3] = yy_swap_endian_uint32((uint32_t)_loopCount); // num plays\n            acTL[4] = yy_swap_endian_uint32((uint32_t)crc32(0, (const Bytef *)(acTL + 1), 12)); //crc32\n            [result appendBytes:acTL length:20];\n            \n            // insert fcTL (first frame control)\n            yy_png_chunk_fcTL chunk_fcTL = {0};\n            chunk_fcTL.sequence_number = apngSequenceIndex;\n            chunk_fcTL.width = (uint32_t)firstFrameSize.width;\n            chunk_fcTL.height = (uint32_t)firstFrameSize.height;\n            yy_png_delay_to_fraction([(NSNumber *)_durations[0] doubleValue], &chunk_fcTL.delay_num, &chunk_fcTL.delay_den);\n            chunk_fcTL.delay_num = chunk_fcTL.delay_num;\n            chunk_fcTL.delay_den = chunk_fcTL.delay_den;\n            chunk_fcTL.dispose_op = YY_PNG_DISPOSE_OP_BACKGROUND;\n            chunk_fcTL.blend_op = YY_PNG_BLEND_OP_SOURCE;\n            \n            uint8_t fcTL[38] = {0};\n            *((uint32_t *)fcTL) = yy_swap_endian_uint32(26); //length\n            *((uint32_t *)(fcTL + 4)) = YY_FOUR_CC('f', 'c', 'T', 'L'); // fourcc\n            yy_png_chunk_fcTL_write(&chunk_fcTL, fcTL + 8);\n            *((uint32_t *)(fcTL + 34)) = yy_swap_endian_uint32((uint32_t)crc32(0, (const Bytef *)(fcTL + 4), 30));\n            [result appendBytes:fcTL length:38];\n            \n            apngSequenceIndex++;\n        }\n        \n        if (!insertAfter && insertBefore && chunk->fourcc != YY_FOUR_CC('I', 'D', 'A', 'T')) {\n            insertAfter = YES;\n            // insert fcTL and fdAT (APNG frame control and data)\n            \n            for (int i = 1; i < pngDatas.count; i++) {\n                NSData *frameData = pngDatas[i];\n                yy_png_info *frame = yy_png_info_create(frameData.bytes, (uint32_t)frameData.length);\n                if (!frame) {\n                    yy_png_info_release(info);\n                    return nil;\n                }\n                \n                // insert fcTL (first frame control)\n                yy_png_chunk_fcTL chunk_fcTL = {0};\n                chunk_fcTL.sequence_number = apngSequenceIndex;\n                chunk_fcTL.width = frame->header.width;\n                chunk_fcTL.height = frame->header.height;\n                yy_png_delay_to_fraction([(NSNumber *)_durations[i] doubleValue], &chunk_fcTL.delay_num, &chunk_fcTL.delay_den);\n                chunk_fcTL.delay_num = chunk_fcTL.delay_num;\n                chunk_fcTL.delay_den = chunk_fcTL.delay_den;\n                chunk_fcTL.dispose_op = YY_PNG_DISPOSE_OP_BACKGROUND;\n                chunk_fcTL.blend_op = YY_PNG_BLEND_OP_SOURCE;\n                \n                uint8_t fcTL[38] = {0};\n                *((uint32_t *)fcTL) = yy_swap_endian_uint32(26); //length\n                *((uint32_t *)(fcTL + 4)) = YY_FOUR_CC('f', 'c', 'T', 'L'); // fourcc\n                yy_png_chunk_fcTL_write(&chunk_fcTL, fcTL + 8);\n                *((uint32_t *)(fcTL + 34)) = yy_swap_endian_uint32((uint32_t)crc32(0, (const Bytef *)(fcTL + 4), 30));\n                [result appendBytes:fcTL length:38];\n                \n                apngSequenceIndex++;\n                \n                // insert fdAT (frame data)\n                for (int d = 0; d < frame->chunk_num; d++) {\n                    yy_png_chunk_info *dchunk = frame->chunks + d;\n                    if (dchunk->fourcc == YY_FOUR_CC('I', 'D', 'A', 'T')) {\n                        uint32_t length = yy_swap_endian_uint32(dchunk->length + 4);\n                        [result appendBytes:&length length:4]; //length\n                        uint32_t fourcc = YY_FOUR_CC('f', 'd', 'A', 'T');\n                        [result appendBytes:&fourcc length:4]; //fourcc\n                        uint32_t sq = yy_swap_endian_uint32(apngSequenceIndex);\n                        [result appendBytes:&sq length:4]; //data (sq)\n                        [result appendBytes:(((uint8_t *)frameData.bytes) + dchunk->offset + 8) length:dchunk->length]; //data\n                        uint8_t *bytes = ((uint8_t *)result.bytes) + result.length - dchunk->length - 8;\n                        uint32_t crc = yy_swap_endian_uint32((uint32_t)crc32(0, bytes, dchunk->length + 8));\n                        [result appendBytes:&crc length:4]; //crc\n                        \n                        apngSequenceIndex++;\n                    }\n                }\n                yy_png_info_release(frame);\n            }\n        }\n        \n        [result appendBytes:((uint8_t *)firstFrameData.bytes) + chunk->offset length:chunk->length + 12];\n    }\n    yy_png_info_release(info);\n    return result;\n}\n\n- (NSData *)_encodeWebP {\n#if YYIMAGE_WEBP_ENABLED\n    // encode webp\n    NSMutableArray *webpDatas = [NSMutableArray new];\n    for (NSUInteger i = 0; i < _images.count; i++) {\n        CGImageRef image = [self _newCGImageFromIndex:i decoded:NO];\n        if (!image) return nil;\n        CFDataRef frameData = YYCGImageCreateEncodedWebPData(image, _lossless, _quality, 4, YYImagePresetDefault);\n        CFRelease(image);\n        if (!frameData) return nil;\n        [webpDatas addObject:(__bridge id)frameData];\n        CFRelease(frameData);\n    }\n    if (webpDatas.count == 1) {\n        return webpDatas.firstObject;\n    } else {\n        // multi-frame webp\n        WebPMux *mux = WebPMuxNew();\n        if (!mux) return nil;\n        for (NSUInteger i = 0; i < _images.count; i++) {\n            NSData *data = webpDatas[i];\n            NSNumber *duration = _durations[i];\n            WebPMuxFrameInfo frame = {0};\n            frame.bitstream.bytes = data.bytes;\n            frame.bitstream.size = data.length;\n            frame.duration = (int)(duration.floatValue * 1000.0);\n            frame.id = WEBP_CHUNK_ANMF;\n            frame.dispose_method = WEBP_MUX_DISPOSE_BACKGROUND;\n            frame.blend_method = WEBP_MUX_NO_BLEND;\n            if (WebPMuxPushFrame(mux, &frame, 0) != WEBP_MUX_OK) {\n                WebPMuxDelete(mux);\n                return nil;\n            }\n        }\n        \n        WebPMuxAnimParams params = {(uint32_t)0, (int)_loopCount};\n        if (WebPMuxSetAnimationParams(mux, &params) != WEBP_MUX_OK) {\n            WebPMuxDelete(mux);\n            return nil;\n        }\n        \n        WebPData output_data;\n        WebPMuxError error = WebPMuxAssemble(mux, &output_data);\n        WebPMuxDelete(mux);\n        if (error != WEBP_MUX_OK) {\n            return nil;\n        }\n        NSData *result = [NSData dataWithBytes:output_data.bytes length:output_data.size];\n        WebPDataClear(&output_data);\n        return result.length ? result : nil;\n    }\n#else\n    return nil;\n#endif\n}\n- (NSData *)encode {\n    if (_images.count == 0) return nil;\n    \n    if ([self _imageIOAvaliable]) return [self _encodeWithImageIO];\n    if (_type == YYImageTypePNG) return [self _encodeAPNG];\n    if (_type == YYImageTypeWebP) return [self _encodeWebP];\n    return nil;\n}\n\n- (BOOL)encodeToFile:(NSString *)path {\n    if (_images.count == 0 || path.length == 0) return NO;\n    \n    if ([self _imageIOAvaliable]) return [self _encodeWithImageIO:path];\n    NSData *data = [self encode];\n    if (!data) return NO;\n    return [data writeToFile:path atomically:YES];\n}\n\n+ (NSData *)encodeImage:(UIImage *)image type:(YYImageType)type quality:(CGFloat)quality {\n    YYImageEncoder *encoder = [[YYImageEncoder alloc] initWithType:type];\n    encoder.quality = quality;\n    [encoder addImage:image duration:0];\n    return [encoder encode];\n}\n\n+ (NSData *)encodeImageWithDecoder:(YYImageDecoder *)decoder type:(YYImageType)type quality:(CGFloat)quality {\n    if (!decoder || decoder.frameCount == 0) return nil;\n    YYImageEncoder *encoder = [[YYImageEncoder alloc] initWithType:type];\n    encoder.quality = quality;\n    for (int i = 0; i < decoder.frameCount; i++) {\n        UIImage *frame = [decoder frameAtIndex:i decodeForDisplay:YES].image;\n        [encoder addImageWithData:UIImagePNGRepresentation(frame) duration:[decoder frameDurationAtIndex:i]];\n    }\n    return encoder.encode;\n}\n\n@end\n\n\n@implementation UIImage (YYImageCoder)\n\n- (instancetype)yy_imageByDecoded {\n    if (self.yy_isDecodedForDisplay) return self;\n    CGImageRef imageRef = self.CGImage;\n    if (!imageRef) return self;\n    CGImageRef newImageRef = YYCGImageCreateDecodedCopy(imageRef, YES);\n    if (!newImageRef) return self;\n    UIImage *newImage = [[self.class alloc] initWithCGImage:newImageRef scale:self.scale orientation:self.imageOrientation];\n    CGImageRelease(newImageRef);\n    if (!newImage) newImage = self; // decode failed, return self.\n    newImage.yy_isDecodedForDisplay = YES;\n    return newImage;\n}\n\n- (BOOL)yy_isDecodedForDisplay {\n    if (self.images.count > 1 || [self isKindOfClass:[YYSpriteSheetImage class]]) return YES;\n    NSNumber *num = objc_getAssociatedObject(self, @selector(yy_isDecodedForDisplay));\n    return [num boolValue];\n}\n\n- (void)setYy_isDecodedForDisplay:(BOOL)isDecodedForDisplay {\n    objc_setAssociatedObject(self, @selector(yy_isDecodedForDisplay), @(isDecodedForDisplay), OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (void)yy_saveToAlbumWithCompletionBlock:(void(^)(NSURL *assetURL, NSError *error))completionBlock {\n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        NSData *data = [self _yy_dataRepresentationForSystem:YES];\n        ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];\n        [library writeImageDataToSavedPhotosAlbum:data metadata:nil completionBlock:^(NSURL *assetURL, NSError *error){\n            if (!completionBlock) return;\n            if (pthread_main_np()) {\n                completionBlock(assetURL, error);\n            } else {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    completionBlock(assetURL, error);\n                });\n            }\n        }];\n    });\n}\n\n- (NSData *)yy_imageDataRepresentation {\n    return [self _yy_dataRepresentationForSystem:NO];\n}\n\n/// @param forSystem YES: used for system album (PNG/JPEG/GIF), NO: used for YYImage (PNG/JPEG/GIF/WebP)\n- (NSData *)_yy_dataRepresentationForSystem:(BOOL)forSystem {\n    NSData *data = nil;\n    if ([self isKindOfClass:[YYImage class]]) {\n        YYImage *image = (id)self;\n        if (image.animatedImageData) {\n            if (forSystem) { // system only support GIF and PNG\n                if (image.animatedImageType == YYImageTypeGIF ||\n                    image.animatedImageType == YYImageTypePNG) {\n                    data = image.animatedImageData;\n                }\n            } else {\n                data = image.animatedImageData;\n            }\n        }\n    }\n    if (!data) {\n        CGImageRef imageRef = self.CGImage ? (CGImageRef)CFRetain(self.CGImage) : nil;\n        if (imageRef) {\n            CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);\n            CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef) & kCGBitmapAlphaInfoMask;\n            BOOL hasAlpha = NO;\n            if (alphaInfo == kCGImageAlphaPremultipliedLast ||\n                alphaInfo == kCGImageAlphaPremultipliedFirst ||\n                alphaInfo == kCGImageAlphaLast ||\n                alphaInfo == kCGImageAlphaFirst) {\n                hasAlpha = YES;\n            }\n            if (self.imageOrientation != UIImageOrientationUp) {\n                CGImageRef rotated = YYCGImageCreateCopyWithOrientation(imageRef, self.imageOrientation, bitmapInfo | alphaInfo);\n                if (rotated) {\n                    CFRelease(imageRef);\n                    imageRef = rotated;\n                }\n            }\n            @autoreleasepool {\n                UIImage *newImage = [UIImage imageWithCGImage:imageRef];\n                if (newImage) {\n                    if (hasAlpha) {\n                        data = UIImagePNGRepresentation([UIImage imageWithCGImage:imageRef]);\n                    } else {\n                        data = UIImageJPEGRepresentation([UIImage imageWithCGImage:imageRef], 0.9); // same as Apple's example\n                    }\n                }\n            }\n            CFRelease(imageRef);\n        }\n    }\n    if (!data) {\n        data = UIImagePNGRepresentation(self);\n    }\n    return data;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYSpriteSheetImage.h",
    "content": "//\n//  YYSpriteImage.h\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 15/4/21.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYImage/YYImage.h>)\n#import <YYImage/YYAnimatedImageView.h>\n#elif __has_include(<YYWebImage/YYImage.h>)\n#import <YYWebImage/YYAnimatedImageView.h>\n#else\n#import \"YYAnimatedImageView.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n An image to display sprite sheet animation.\n \n @discussion It is a fully compatible `UIImage` subclass.\n The animation can be played by YYAnimatedImageView.\n \n Sample Code:\n  \n    // 8 * 12 sprites in a single sheet image\n    UIImage *spriteSheet = [UIImage imageNamed:@\"sprite-sheet\"];\n    NSMutableArray *contentRects = [NSMutableArray new];\n    NSMutableArray *durations = [NSMutableArray new];\n    for (int j = 0; j < 12; j++) {\n        for (int i = 0; i < 8; i++) {\n            CGRect rect;\n            rect.size = CGSizeMake(img.size.width / 8, img.size.height / 12);\n            rect.origin.x = img.size.width / 8 * i;\n            rect.origin.y = img.size.height / 12 * j;\n            [contentRects addObject:[NSValue valueWithCGRect:rect]];\n            [durations addObject:@(1 / 60.0)];\n        }\n    }\n    YYSpriteSheetImage *sprite;\n    sprite = [[YYSpriteSheetImage alloc] initWithSpriteSheetImage:img\n                                                     contentRects:contentRects\n                                                   frameDurations:durations\n                                                        loopCount:0];\n    YYAnimatedImageView *imgView = [YYAnimatedImageView new];\n    imgView.size = CGSizeMake(img.size.width / 8, img.size.height / 12);\n    imgView.image = sprite;\n \n \n \n @discussion It can also be used to display single frame in sprite sheet image.\n Sample Code:\n \n    YYSpriteSheetImage *sheet = ...;\n    UIImageView *imageView = ...;\n    imageView.image = sheet;\n    imageView.layer.contentsRect = [sheet contentsRectForCALayerAtIndex:6];\n \n */\n@interface YYSpriteSheetImage : UIImage <YYAnimatedImage>\n\n/**\n Creates and returns an image object.\n \n @param image          The sprite sheet image (contains all frames).\n \n @param contentRects   The sprite sheet image frame rects in the image coordinates.\n     The rectangle should not outside the image's bounds. The objects in this array\n     should be created with [NSValue valueWithCGRect:].\n \n @param frameDurations The sprite sheet image frame's durations in seconds. \n     The objects in this array should be NSNumber.\n \n @param loopCount      Animation loop count, 0 means infinite looping.\n \n @return An image object, or nil if an error occurs.\n */\n- (nullable instancetype)initWithSpriteSheetImage:(UIImage *)image\n                                     contentRects:(NSArray<NSValue *> *)contentRects\n                                   frameDurations:(NSArray<NSNumber *> *)frameDurations\n                                        loopCount:(NSUInteger)loopCount;\n\n@property (nonatomic, readonly) NSArray<NSValue *> *contentRects;\n@property (nonatomic, readonly) NSArray<NSValue *> *frameDurations;\n@property (nonatomic, readonly) NSUInteger loopCount;\n\n/**\n Get the contents rect for CALayer.\n See \"contentsRect\" property in CALayer for more information.\n \n @param index Index of frame.\n @return Contents Rect.\n */\n- (CGRect)contentsRectForCALayerAtIndex:(NSUInteger)index;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYImage/YYImage/YYSpriteSheetImage.m",
    "content": "//\n//  YYSpriteImage.m\n//  YYImage <https://github.com/ibireme/YYImage>\n//\n//  Created by ibireme on 15/4/21.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYSpriteSheetImage.h\"\n\n@implementation YYSpriteSheetImage\n\n- (instancetype)initWithSpriteSheetImage:(UIImage *)image\n                            contentRects:(NSArray *)contentRects\n                          frameDurations:(NSArray *)frameDurations\n                               loopCount:(NSUInteger)loopCount {\n    if (!image.CGImage) return nil;\n    if (contentRects.count < 1 || frameDurations.count < 1) return nil;\n    if (contentRects.count != frameDurations.count) return nil;\n    \n    self = [super initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];\n    if (!self) return nil;\n    \n    _contentRects = contentRects.copy;\n    _frameDurations = frameDurations.copy;\n    _loopCount = loopCount;\n    return self;\n}\n\n- (CGRect)contentsRectForCALayerAtIndex:(NSUInteger)index {\n    CGRect layerRect = CGRectMake(0, 0, 1, 1);\n    if (index >= _contentRects.count) return layerRect;\n    \n    CGSize imageSize = self.size;\n    CGRect rect = [self animatedImageContentsRectAtIndex:index];\n    if (imageSize.width > 0.01 && imageSize.height > 0.01) {\n        layerRect.origin.x = rect.origin.x / imageSize.width;\n        layerRect.origin.y = rect.origin.y / imageSize.height;\n        layerRect.size.width = rect.size.width / imageSize.width;\n        layerRect.size.height = rect.size.height / imageSize.height;\n        layerRect = CGRectIntersection(layerRect, CGRectMake(0, 0, 1, 1));\n        if (CGRectIsNull(layerRect) || CGRectIsEmpty(layerRect)) {\n            layerRect = CGRectMake(0, 0, 1, 1);\n        }\n    }\n    return layerRect;\n}\n\n#pragma mark @protocol YYAnimatedImage\n\n- (NSUInteger)animatedImageFrameCount {\n    return _contentRects.count;\n}\n\n- (NSUInteger)animatedImageLoopCount {\n    return _loopCount;\n}\n\n- (NSUInteger)animatedImageBytesPerFrame {\n    return 0;\n}\n\n- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {\n    return self;\n}\n\n- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index {\n    if (index >= _frameDurations.count) return 0;\n    return ((NSNumber *)_frameDurations[index]).doubleValue;\n}\n\n- (CGRect)animatedImageContentsRectAtIndex:(NSUInteger)index {\n    if (index >= _contentRects.count) return CGRectZero;\n    return ((NSValue *)_contentRects[index]).CGRectValue;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYImage.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t209ACDE216DE89F317AEAC26A43EE166 /* YYSpriteSheetImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 91E05EF3840C6520B4BC49AC82624EF8 /* YYSpriteSheetImage.m */; };\n\t\t295B3F428451E92AE5D1452CEC55D805 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4317CA0E68B9E0EB3C7172FBE66434ED /* Foundation.framework */; };\n\t\t30B51EE477578384089C8A1C20C1168D /* YYAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ACB4BB455DA6C02D36B300168863FFA /* YYAnimatedImageView.m */; };\n\t\t337C8438AEE46F7E43C3D8F54DE8C96D /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67BE23332E59FC7A08194F469DB69863 /* Accelerate.framework */; };\n\t\t3AF86D9EA3E53B5A672509CE23D32938 /* YYImageCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DC88EE32D80C7995E29E092D5F63989 /* YYImageCoder.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t42381F6269ABB1F718CC0CD5DA57E9D0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 973C17BCC304748A403202DD776795F8 /* UIKit.framework */; };\n\t\t432ABC91301615CDA7E3769038C2D289 /* YYFrameImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D5ED57367176A485AE3482CD3FC06E /* YYFrameImage.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4AB4910357E82D4A9AE8B90796C73FF3 /* YYImage-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D719C3A7B5D26C0CA6819A0E3400987C /* YYImage-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4E5D460643B4E9B32721843A60CC2735 /* YYImage.m in Sources */ = {isa = PBXBuildFile; fileRef = BABF07F15CE521F5E4BB2E82947C33FE /* YYImage.m */; };\n\t\t5770390C18D505E3A0ECC3649E657CEF /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F89B576205FC3E48435179314E0B49C /* AssetsLibrary.framework */; };\n\t\t58977085BD8A6FD8BA4D585FB32A24BD /* YYImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D01DDA4F87CC2D3C533C7AA755CADFB /* YYImage.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t61647B69DDE1029A0622513D94B89780 /* YYImage-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D59F61ECEC03383C0DB66D54A997E5FB /* YYImage-dummy.m */; };\n\t\t6B4662E5EF2340DA5153EB6D57C0C1BF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24A2A9EAE840B0AC620FACCA9DA3368 /* CoreFoundation.framework */; };\n\t\t79BDC4EA069E1DE7D8F760B2A0362FAD /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0C8243D2D51649298FBADDD94EC08E9 /* QuartzCore.framework */; };\n\t\t8B0E144413FCFDD51E2A1ED28D31D90B /* YYSpriteSheetImage.h in Headers */ = {isa = PBXBuildFile; fileRef = DEAA3766671C1B40B1CC40EDA4CD1878 /* YYSpriteSheetImage.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8F642EC6D2D45E9BD0157FAAE6974810 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41345103E3AB3D7E26F8BA72952353BD /* ImageIO.framework */; };\n\t\tA08036A983668E96500EE8D68F2ED0EA /* YYImageCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = B23A587A3E3FA6F959ACBB86F716B7D5 /* YYImageCoder.m */; };\n\t\tB2EFA7FB730A0B6908E2DF00A607780E /* YYFrameImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D08A6C26DC2F7AAF2BA7A5570C3262E7 /* YYFrameImage.m */; };\n\t\tBA32BC6D8A50A5D97E587CAB714E62AF /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DBB668F0CA14EA9449D1D9184EDA8B5 /* MobileCoreServices.framework */; };\n\t\tCC82229DD4EF6FD62587C9C83BD04176 /* YYAnimatedImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = B8172AAF49D5C081248914F1E1790F2E /* YYAnimatedImageView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t2633AA5F196274D8FACCEFAF6CC8D9A3 /* YYImage-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"YYImage-Info.plist\"; sourceTree = \"<group>\"; };\n\t\t3DC88EE32D80C7995E29E092D5F63989 /* YYImageCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYImageCoder.h; path = YYImage/YYImageCoder.h; sourceTree = \"<group>\"; };\n\t\t41345103E3AB3D7E26F8BA72952353BD /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; };\n\t\t4317CA0E68B9E0EB3C7172FBE66434ED /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t5F89B576205FC3E48435179314E0B49C /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/AssetsLibrary.framework; sourceTree = DEVELOPER_DIR; };\n\t\t67BE23332E59FC7A08194F469DB69863 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; };\n\t\t69C33676C094D9237E644BA64A9B8CCD /* YYImage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = YYImage.release.xcconfig; sourceTree = \"<group>\"; };\n\t\t86D5ED57367176A485AE3482CD3FC06E /* YYFrameImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYFrameImage.h; path = YYImage/YYFrameImage.h; sourceTree = \"<group>\"; };\n\t\t8ACB4BB455DA6C02D36B300168863FFA /* YYAnimatedImageView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYAnimatedImageView.m; path = YYImage/YYAnimatedImageView.m; sourceTree = \"<group>\"; };\n\t\t91E05EF3840C6520B4BC49AC82624EF8 /* YYSpriteSheetImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYSpriteSheetImage.m; path = YYImage/YYSpriteSheetImage.m; sourceTree = \"<group>\"; };\n\t\t973C17BCC304748A403202DD776795F8 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };\n\t\t9D01DDA4F87CC2D3C533C7AA755CADFB /* YYImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYImage.h; path = YYImage/YYImage.h; sourceTree = \"<group>\"; };\n\t\t9DBB668F0CA14EA9449D1D9184EDA8B5 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = DEVELOPER_DIR; };\n\t\tA24A2A9EAE840B0AC620FACCA9DA3368 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tB23A587A3E3FA6F959ACBB86F716B7D5 /* YYImageCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYImageCoder.m; path = YYImage/YYImageCoder.m; sourceTree = \"<group>\"; };\n\t\tB8172AAF49D5C081248914F1E1790F2E /* YYAnimatedImageView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYAnimatedImageView.h; path = YYImage/YYAnimatedImageView.h; sourceTree = \"<group>\"; };\n\t\tBABF07F15CE521F5E4BB2E82947C33FE /* YYImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYImage.m; path = YYImage/YYImage.m; sourceTree = \"<group>\"; };\n\t\tCE9B4401BA37E9BB5B55AF8CA5FB86BB /* YYImage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = YYImage.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tD08A6C26DC2F7AAF2BA7A5570C3262E7 /* YYFrameImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYFrameImage.m; path = YYImage/YYFrameImage.m; sourceTree = \"<group>\"; };\n\t\tD59F61ECEC03383C0DB66D54A997E5FB /* YYImage-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"YYImage-dummy.m\"; sourceTree = \"<group>\"; };\n\t\tD719C3A7B5D26C0CA6819A0E3400987C /* YYImage-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"YYImage-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tD734CAFB20EA6A88031ABF56627ACECF /* YYImage.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = YYImage.modulemap; sourceTree = \"<group>\"; };\n\t\tDEAA3766671C1B40B1CC40EDA4CD1878 /* YYSpriteSheetImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYSpriteSheetImage.h; path = YYImage/YYSpriteSheetImage.h; sourceTree = \"<group>\"; };\n\t\tE3FA87F056EF6868CDF6AA3D635649A1 /* YYImage-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"YYImage-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\tF0C8243D2D51649298FBADDD94EC08E9 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };\n\t\tF155475BB19F88C1C1C50EE03F354FF7 /* YYImage */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = YYImage; path = YYImage.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t969A53438783160EA28A91C7289ED4F7 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t337C8438AEE46F7E43C3D8F54DE8C96D /* Accelerate.framework in Frameworks */,\n\t\t\t\t5770390C18D505E3A0ECC3649E657CEF /* AssetsLibrary.framework in Frameworks */,\n\t\t\t\t6B4662E5EF2340DA5153EB6D57C0C1BF /* CoreFoundation.framework in Frameworks */,\n\t\t\t\t295B3F428451E92AE5D1452CEC55D805 /* Foundation.framework in Frameworks */,\n\t\t\t\t8F642EC6D2D45E9BD0157FAAE6974810 /* ImageIO.framework in Frameworks */,\n\t\t\t\tBA32BC6D8A50A5D97E587CAB714E62AF /* MobileCoreServices.framework in Frameworks */,\n\t\t\t\t79BDC4EA069E1DE7D8F760B2A0362FAD /* QuartzCore.framework in Frameworks */,\n\t\t\t\t42381F6269ABB1F718CC0CD5DA57E9D0 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t1AD42CCED1D9B602FCA579DEAB55EB22 /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD734CAFB20EA6A88031ABF56627ACECF /* YYImage.modulemap */,\n\t\t\t\tD59F61ECEC03383C0DB66D54A997E5FB /* YYImage-dummy.m */,\n\t\t\t\t2633AA5F196274D8FACCEFAF6CC8D9A3 /* YYImage-Info.plist */,\n\t\t\t\tE3FA87F056EF6868CDF6AA3D635649A1 /* YYImage-prefix.pch */,\n\t\t\t\tD719C3A7B5D26C0CA6819A0E3400987C /* YYImage-umbrella.h */,\n\t\t\t\tCE9B4401BA37E9BB5B55AF8CA5FB86BB /* YYImage.debug.xcconfig */,\n\t\t\t\t69C33676C094D9237E644BA64A9B8CCD /* YYImage.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/YYImage\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t353DB08ED01AD4A14F643ED764EAEB1E /* Core */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tB8172AAF49D5C081248914F1E1790F2E /* YYAnimatedImageView.h */,\n\t\t\t\t8ACB4BB455DA6C02D36B300168863FFA /* YYAnimatedImageView.m */,\n\t\t\t\t86D5ED57367176A485AE3482CD3FC06E /* YYFrameImage.h */,\n\t\t\t\tD08A6C26DC2F7AAF2BA7A5570C3262E7 /* YYFrameImage.m */,\n\t\t\t\t9D01DDA4F87CC2D3C533C7AA755CADFB /* YYImage.h */,\n\t\t\t\tBABF07F15CE521F5E4BB2E82947C33FE /* YYImage.m */,\n\t\t\t\t3DC88EE32D80C7995E29E092D5F63989 /* YYImageCoder.h */,\n\t\t\t\tB23A587A3E3FA6F959ACBB86F716B7D5 /* YYImageCoder.m */,\n\t\t\t\tDEAA3766671C1B40B1CC40EDA4CD1878 /* YYSpriteSheetImage.h */,\n\t\t\t\t91E05EF3840C6520B4BC49AC82624EF8 /* YYSpriteSheetImage.m */,\n\t\t\t);\n\t\t\tname = Core;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8409D61397A7448A5D7BB1CE8D62505D /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t67BE23332E59FC7A08194F469DB69863 /* Accelerate.framework */,\n\t\t\t\t5F89B576205FC3E48435179314E0B49C /* AssetsLibrary.framework */,\n\t\t\t\tA24A2A9EAE840B0AC620FACCA9DA3368 /* CoreFoundation.framework */,\n\t\t\t\t4317CA0E68B9E0EB3C7172FBE66434ED /* Foundation.framework */,\n\t\t\t\t41345103E3AB3D7E26F8BA72952353BD /* ImageIO.framework */,\n\t\t\t\t9DBB668F0CA14EA9449D1D9184EDA8B5 /* MobileCoreServices.framework */,\n\t\t\t\tF0C8243D2D51649298FBADDD94EC08E9 /* QuartzCore.framework */,\n\t\t\t\t973C17BCC304748A403202DD776795F8 /* UIKit.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t996ED745698A9E132D661FCCFB264E7D /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF155475BB19F88C1C1C50EE03F354FF7 /* YYImage */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t9EBEBB3BCEDF8B32474736276D3C7F3F = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tFA817A441A73891A089814E6C810013C /* Frameworks */,\n\t\t\t\t996ED745698A9E132D661FCCFB264E7D /* Products */,\n\t\t\t\tB7948C665D429E7EAC8B0F5B29420005 /* YYImage */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB7948C665D429E7EAC8B0F5B29420005 /* YYImage */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t353DB08ED01AD4A14F643ED764EAEB1E /* Core */,\n\t\t\t\t1AD42CCED1D9B602FCA579DEAB55EB22 /* Support Files */,\n\t\t\t);\n\t\t\tname = YYImage;\n\t\t\tpath = YYImage;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tFA817A441A73891A089814E6C810013C /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t8409D61397A7448A5D7BB1CE8D62505D /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t111D423F1BCA8325D041C73CBC1ABFB6 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tCC82229DD4EF6FD62587C9C83BD04176 /* YYAnimatedImageView.h in Headers */,\n\t\t\t\t432ABC91301615CDA7E3769038C2D289 /* YYFrameImage.h in Headers */,\n\t\t\t\t58977085BD8A6FD8BA4D585FB32A24BD /* YYImage.h in Headers */,\n\t\t\t\t4AB4910357E82D4A9AE8B90796C73FF3 /* YYImage-umbrella.h in Headers */,\n\t\t\t\t3AF86D9EA3E53B5A672509CE23D32938 /* YYImageCoder.h in Headers */,\n\t\t\t\t8B0E144413FCFDD51E2A1ED28D31D90B /* YYSpriteSheetImage.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t79A687989E871964747CED931C10657C /* YYImage */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 91592327401497D87071C0E8D27914BC /* Build configuration list for PBXNativeTarget \"YYImage\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t111D423F1BCA8325D041C73CBC1ABFB6 /* Headers */,\n\t\t\t\tE1599FBF448E3190F6933095103EE6F5 /* Sources */,\n\t\t\t\t969A53438783160EA28A91C7289ED4F7 /* Frameworks */,\n\t\t\t\t499F2BA252FF0550FF157F665378B5B0 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = YYImage;\n\t\t\tproductName = YYImage;\n\t\t\tproductReference = F155475BB19F88C1C1C50EE03F354FF7 /* YYImage */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\tBC1F193CFBD76E81B1E490E1194514B4 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 1D14B4819F4F3712C5F16A60334D9174 /* Build configuration list for PBXProject \"YYImage\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 9EBEBB3BCEDF8B32474736276D3C7F3F;\n\t\t\tproductRefGroup = 996ED745698A9E132D661FCCFB264E7D /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t79A687989E871964747CED931C10657C /* YYImage */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t499F2BA252FF0550FF157F665378B5B0 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\tE1599FBF448E3190F6933095103EE6F5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t30B51EE477578384089C8A1C20C1168D /* YYAnimatedImageView.m in Sources */,\n\t\t\t\tB2EFA7FB730A0B6908E2DF00A607780E /* YYFrameImage.m in Sources */,\n\t\t\t\t4E5D460643B4E9B32721843A60CC2735 /* YYImage.m in Sources */,\n\t\t\t\t61647B69DDE1029A0622513D94B89780 /* YYImage-dummy.m in Sources */,\n\t\t\t\tA08036A983668E96500EE8D68F2ED0EA /* YYImageCoder.m in Sources */,\n\t\t\t\t209ACDE216DE89F317AEAC26A43EE166 /* YYSpriteSheetImage.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t9A16DA4E46A57547F1B2F559234776DE /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 69C33676C094D9237E644BA64A9B8CCD /* YYImage.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/YYImage/YYImage-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/YYImage/YYImage-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/YYImage/YYImage.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = YYImage;\n\t\t\t\tPRODUCT_NAME = YYImage;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tA4FFBC3B7A6CF56B8764277A57AAD42A /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDCC379B8AE39A84DD5934D45936DAB3F /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = CE9B4401BA37E9BB5B55AF8CA5FB86BB /* YYImage.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/YYImage/YYImage-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/YYImage/YYImage-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/YYImage/YYImage.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = YYImage;\n\t\t\t\tPRODUCT_NAME = YYImage;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tF728EFF4C9757920A6173281D8155886 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t1D14B4819F4F3712C5F16A60334D9174 /* Build configuration list for PBXProject \"YYImage\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tA4FFBC3B7A6CF56B8764277A57AAD42A /* Debug */,\n\t\t\t\tF728EFF4C9757920A6173281D8155886 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t91592327401497D87071C0E8D27914BC /* Build configuration list for PBXNativeTarget \"YYImage\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tDCC379B8AE39A84DD5934D45936DAB3F /* Debug */,\n\t\t\t\t9A16DA4E46A57547F1B2F559234776DE /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = BC1F193CFBD76E81B1E490E1194514B4 /* Project object */;\n}\n"
  },
  {
    "path": "JetChat/Pods/YYText/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 ibireme <ibireme@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "JetChat/Pods/YYText/README.md",
    "content": "YYText\n==============\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/ibireme/YYText/master/LICENSE)&nbsp;\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)&nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/v/YYText.svg?style=flat)](http://cocoapods.org/?q= YYText)&nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/p/YYText.svg?style=flat)](http://cocoapods.org/?q= YYText)&nbsp;\n[![Support](https://img.shields.io/badge/support-iOS%206%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)&nbsp;\n[![Build Status](https://travis-ci.org/ibireme/YYText.svg?branch=master)](https://travis-ci.org/ibireme/YYText)\n\nPowerful text framework for iOS to display and edit rich text.<br/>\n(It's a component of [YYKit](https://github.com/ibireme/YYKit))\n\n\nFeatures\n==============\n\n- UILabel and UITextView API compatible\n- High performance asynchronous text layout and rendering\n- Extended CoreText attributes with more text effects\n- Text attachments with UIImage, UIView and CALayer\n- Custom highlight text range to allow user interact with\n- Text parser support (built in markdown/emoticon parser)\n- Text container path and exclusion paths support\n- Vertical form layout support (for CJK text)\n- Image and attributed text copy/paste support\n- Attributed text placeholder support\n- Custom keyboard view support\n- Undo and redo control\n- Attributed text archiver and unarchiver support\n- Multi-language and VoiceOver support\n- Interface Builder support\n- Fully documented\n\n\nArchitecture\n==============\nYYText vs TextKit\n\n<img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/architecture.png\" width=\"400\">\n\n\nText Attributes\n==============\n\n### YYText supported attributes\n<table>\n  <thead>\n    <tr>\n      <th>Demo</th>\n      <th>Attribute Name</th>\n      <th>Class</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextAttachment.gif\" width=\"200\"></td>\n      <td>TextAttachment</td>\n      <td>YYTextAttachment</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextHighlight.gif\" width=\"200\"></td>\n      <td>TextHighlight</td>\n      <td>YYTextHighlight</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBinding.gif\" width=\"200\"></td>\n      <td>TextBinding</td>\n      <td>YYTextBinding</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextShadow.png\" width=\"200\"></td>\n      <td>TextShadow<br/>TextInnerShadow</td>\n      <td>YYTextShadow</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBorder.png\" width=\"200\"></td>\n      <td>TextBorder</td>\n      <td>YYTextBorder</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBackgroundBorder.png\" width=\"200\"></td>\n      <td>TextBackgroundBorder</td>\n      <td>YYTextBorder</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBlockBorder.png\" width=\"200\"></td>\n      <td>TextBlockBorder</td>\n      <td>YYTextBorder</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Obliqueness.png\" width=\"200\"></td>\n      <td>TextGlyphTransform</td>\n      <td> NSValue(CGAffineTransform)</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Underline.png\" width=\"200\"></td>\n      <td>TextUnderline</td>\n      <td>YYTextDecoration</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Strikethrough.png\" width=\"200\"></td>\n      <td>TextStrickthrough</td>\n      <td>YYTextDecoration</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBackedString.png\" width=\"200\"></td>\n      <td>TextBackedString</td>\n      <td>YYTextBackedString</td>\n    </tr>\n  </tbody>\n</table>\n\n###CoreText attributes which is supported by YYText\n<table>\n  <thead>\n    <tr>\n      <th>Demo</th>\n      <th>Attribute Name</th>\n      <th>Class</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Font.png\" width=\"200\"></td>\n      <td> Font </td>\n      <td>UIFont(CTFontRef)</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Kern.png\" width=\"200\"></td>\n      <td> Kern </td>\n      <td>NSNumber</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Stroke.png\" width=\"200\"></td>\n      <td> StrokeWidth </td>\n      <td> NSNumber </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/StrokeColor.png\" width=\"200\"></td>\n      <td> StrokeColor </td>\n      <td> CGColorRef </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Shadow.png\" width=\"200\"></td>\n      <td> Shadow </td>\n      <td> NSShadow </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Ligature.png\" width=\"200\"></td>\n      <td> Ligature </td>\n      <td> NSNumber </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/VerticalForms.png\" width=\"200\"></td>\n      <td> VerticalGlyphForm </td>\n      <td> NSNumber(BOOL) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/WriteDirection.png\" width=\"200\"></td>\n      <td> WritingDirection </td>\n      <td> NSArray(NSNumber) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/RunDelegate.png\" width=\"200\"></td>\n      <td> RunDelegate </td>\n      <td> CTRunDelegateRef </td>\n    </tr>\n    \n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/Alignment.png\" width=\"200\"></td>\n      <td> TextAlignment </td>\n      <td> NSParagraphStyle <br/>(NSTextAlignment) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/LineBreakMode.png\" width=\"200\"></td>\n      <td> LineBreakMode </td>\n      <td> NSParagraphStyle <br/>(NSLineBreakMode) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/LineSpacing.png\" width=\"200\"></td>\n      <td> LineSpacing </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/ParagraphSpacing.png\" width=\"200\"></td>\n      <td> ParagraphSpacing <br/> ParagraphSpacingBefore </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/FirstLineHeadIndent.png\" width=\"200\"></td>\n      <td> FirstLineHeadIndent </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/HeadIndent.png\" width=\"200\"></td>\n      <td> HeadIndent </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/TailIndent.png\" width=\"200\"></td>\n      <td> TailIndent </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/MinimumLineHeight.png\" width=\"200\"></td>\n      <td> MinimumLineHeight </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/MaximumLineHeight.png\" width=\"200\"></td>\n      <td> MaximumLineHeight </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/LineHeightMultiple.png\" width=\"200\"></td>\n      <td> LineHeightMultiple </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/BaseWritingDirection.png\" width=\"200\"></td>\n      <td> BaseWritingDirection </td>\n      <td> NSParagraphStyle <br/>(NSWritingDirection) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/Tab.png\" width=\"200\"></td>\n      <td> DefaultTabInterval <br/> TabStops </td>\n      <td> NSParagraphStyle <br/>CGFloat/NSArray(NSTextTab)</td>\n    </tr>\n  </tbody>\n</table>\n\n\nUsage\n==============\n\n### Basic\n    // YYLabel (similar to UILabel)\n    YYLabel *label = [YYLabel new];\n    label.frame = ...\n    label.font = ...\n    label.textColor = ...\n    label.textAlignment = ...\n    label.lineBreakMode = ...\n    label.numberOfLines = ...\n    label.text = ...\n    \n    // YYTextView (similar to UITextView)\n    YYTextView *textView = [YYTextView new];\n    textView.frame = ...\n    textView.font = ...\n    textView.textColor = ...\n    textView.dataDetectorTypes = ...\n    textView.placeHolderText = ...\n    textView.placeHolderTextColor = ...\n    textView.delegate = ...\n    \n\n### Attributed text\n    \n    // 1. Create an attributed string.\n    NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@\"Some Text, blabla...\"];\n    \n    // 2. Set attributes to text, you can use almost all CoreText attributes.\n    text.yy_font = [UIFont boldSystemFontOfSize:30];\n    text.yy_color = [UIColor blueColor];\n    [text yy_setColor:[UIColor redColor] range:NSMakeRange(0, 4)];\n    text.yy_lineSpacing = 10;\n    \n    // 3. Set to YYLabel or YYTextView.\n    YYLabel *label = [YYLabel new];\n    label.frame = ...\n    label.attributedString = text;\n    \n    YYTextView *textView = [YYTextView new];\n    textView.frame = ...\n    textView.attributedString = text;\n    \n### Text highlight\n    \nYou can use some convenience methods to set text highlight:\n\n\t[text yy_setTextHighlightRange:range\n                            color:[UIColor blueColor]\n                  backgroundColor:[UIColor grayColor]\n                        tapAction:^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect){ \n                            NSLog(@\"tap text range:...\"); \n                        }];\n    \nOr set the text highlight with your custom config:\n    \n    // 1. Create a 'highlight' attribute for text.\n    YYTextBorder *border = [YYTextBorder borderWithFillColor:[UIColor grayColor] cornerRadius:3];\n        \n    YYTextHighlight *highlight = [YYTextHighlight new];\n    [highlight setColor:[UIColor whiteColor]];\n    [highlight setBackgroundBorder:highlightBorder];\n    highlight.tapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {\n      NSLog(@\"tap text range:...\"); \n      // you can also set the action handler to YYLabel or YYTextView.\n    };\n    \n    // 2. Add 'highlight' attribute to a range of text.\n    [attributedText yy_setTextHighlight:highlight range:highlightRange];\n    \n    // 3. Set text to label or text view.\n    YYLabel *label = ...\n    label.attributedText = attributedText\n    \n    YYTextView *textView = ...\n    textView.attributedText = ...\n    \n    // 4. Receive user interactive action.\n    label.highlightTapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {\n        NSLog(@\"tap text range:...\");\n    };\n    label.highlightLongPressAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {\n        NSLog(@\"long press text range:...\");\n    };\n    \n    @UITextViewDelegate\n    - (void)textView:(YYTextView *)textView didTapHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect {\n        NSLog(@\"tap text range:...\");\n    }\n    - (void)textView:(YYTextView *)textView didLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect {\n        NSLog(@\"long press text range:...\");\n    }\n\n\n### Text attachments\n\n\tNSMutableAttributedString *text = [NSMutableAttributedString new];\n\tUIFont *font = [UIFont systemFontOfSize:16];\n\tNSMutableAttributedString *attachment = nil;\n\t\n\t// UIImage attachment\n\tUIImage *image = [UIImage imageNamed:@\"dribbble64_imageio\"];\n\tattachment = [NSMutableAttributedString yy_attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:image.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];\n\t[text appendAttributedString: attachment];\n\t\n\t// UIView attachment\n\tUISwitch *switcher = [UISwitch new];\n    [switcher sizeToFit];\n\tattachment = [NSMutableAttributedString yy_attachmentStringWithContent:switcher contentMode:UIViewContentModeBottom attachmentSize:switcher.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];\n\t[text appendAttributedString: attachment];\n\t\n\t// CALayer attachment\n\tCASharpLayer *layer = [CASharpLayer layer];\n\tlayer.path = ...\n\tattachment = [NSMutableAttributedString yy_attachmentStringWithContent:layer contentMode:UIViewContentModeBottom attachmentSize:switcher.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];\n\t[text appendAttributedString: attachment];\n\n\n### Text layout calculation\n\t\n\tNSAttributedString *text = ...\n\tCGSize size = CGSizeMake(100, CGFLOAT_MAX);\n\tYYTextLayout *layout = [YYTextLayout layoutWithContainerSize:size text:text];\n\t\n\t// get text bounding\n\tlayout.textBoundingRect; // get bounding rect\n\tlayout.textBoundingSize; // get bounding size\n\t\n\t // query text layout\n\t[layout lineIndexForPoint:CGPointMake(10,10)];\n\t[layout closestLineIndexForPoint:CGPointMake(10,10)];\n\t[layout closestPositionToPoint:CGPointMake(10,10)];\n\t[layout textRangeAtPoint:CGPointMake(10,10)];\n\t[layout rectForRange:[YYTextRange rangeWithRange:NSMakeRange(10,2)]];\n\t[layout selectionRectsForRange:[YYTextRange rangeWithRange:NSMakeRange(10,2)]];\n\t\n\t// text layout display\n\tYYLabel *label = [YYLabel new];\n\tlabel.size = layout.textBoundingSize;\n\tlabel.textLayout = layout;\n\n\n### Adjust text line position\n\t\n\t// Convenience methods:\n\t// 1. Create a text line position modifier, implements `YYTextLinePositionModifier` protocol.\n\t// 2. Set it to label or text view.\n\t\n\tYYTextLinePositionSimpleModifier *modifier = [YYTextLinePositionSimpleModifier new];\n\tmodifier.fixedLineHeight = 24;\n\t\n\tYYLabel *label = [YYLabel new];\n\tlabel.linePositionModifier = modifier;\n\t\n\t// Fully control\n\tYYTextLinePositionSimpleModifier *modifier = [YYTextLinePositionSimpleModifier new];\n\tmodifier.fixedLineHeight = 24;\n\t\n\tYYTextContainer *container = [YYTextContainer new];\n\tcontainer.size = CGSizeMake(100, CGFLOAT_MAX);\n\tcontainer.linePositionModifier = modifier;\n\t\n\tYYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];\n\tYYLabel *label = [YYLabel new];\n\tlabel.size = layout.textBoundingSize;\n\tlabel.textLayout = layout;\n\t\n\t\n### Asynchronous layout and rendering\n    \n    // If you have performance issues,\n    // you may enable the asynchronous display mode.\n    YYLabel *label = ...\n    label.displaysAsynchronously = YES;\n    \n    // If you want to get the highest performance, you should do \n    // text layout with `YYTextLayout` class in background thread.\n    YYLabel *label = [YYLabel new];\n    label.displaysAsynchronously = YES;\n    label.ignoreCommonProperties = YES;\n    \n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        // Create attributed string.\n        NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@\"Some Text\"];\n        text.yy_font = [UIFont systemFontOfSize:16];\n        text.yy_color = [UIColor grayColor];\n        [text yy_setColor:[UIColor redColor] range:NSMakeRange(0, 4)];\n \t\n        // Create text container\n        YYTextContainer *container = [YYTextContainer new];\n        container.size = CGSizeMake(100, CGFLOAT_MAX);\n        container.maximumNumberOfRows = 0;\n        \n        // Generate a text layout.\n        YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            label.size = layout.textBoundingSize;\n            label.textLayout = layout;\n        });\n    });\n\n\n### Text container control\n\n\tYYLabel *label = ...\n\tlabel.textContainerPath = [UIBezierPath bezierPathWith...];\n\tlabel.exclusionPaths = \t@[[UIBezierPath bezierPathWith...];,...];\n\tlabel.textContainerInset = UIEdgeInsetsMake(...);\n\tlabel.verticalForm = YES/NO;\n    \n    YYTextView *textView = ...\n\ttextView.exclusionPaths = \t@[[UIBezierPath bezierPathWith...];,...];\n\ttextView.textContainerInset = UIEdgeInsetsMake(...);\n\ttextView.verticalForm = YES/NO;\n    \n### Text parser\n\t// 1. Create a text parser\n\t\n    YYTextSimpleEmoticonParser *parser = [YYTextSimpleEmoticonParser new];\n    NSMutableDictionary *mapper = [NSMutableDictionary new];\n    mapper[@\":smile:\"] = [UIImage imageNamed:@\"smile.png\"];\n    mapper[@\":cool:\"] = [UIImage imageNamed:@\"cool.png\"];\n    mapper[@\":cry:\"] = [UIImage imageNamed:@\"cry.png\"];\n    mapper[@\":wink:\"] = [UIImage imageNamed:@\"wink.png\"];\n    parser.emoticonMapper = mapper;\n\t\n\tYYTextSimpleMarkdownParser *parser = [YYTextSimpleMarkdownParser new];\n    [parser setColorWithDarkTheme];\n    \n    MyCustomParser *parser = ... // custom parser\n    \n    // 2. Attach parser to label or text view\n    YYLabel *label = ...\n    label.textParser = parser;\n    \n    YYTextView *textView = ...\n    textView.textParser = parser;\n   \n### Debug\n\n    // Set a shared debug option to show text layout result.\n    YYTextDebugOption *debugOptions = [YYTextDebugOption new];\n    debugOptions.baselineColor = [UIColor redColor];\n    debugOptions.CTFrameBorderColor = [UIColor redColor];\n    debugOptions.CTLineFillColor = [UIColor colorWithRed:0.000 green:0.463 blue:1.000 alpha:0.180];\n    debugOptions.CGGlyphBorderColor = [UIColor colorWithRed:1.000 green:0.524 blue:0.000 alpha:0.200];\n    [YYTextDebugOption setSharedDebugOption:debugOptions];\n\n\n### More examples\nSee `Demo/YYTextDemo.xcodeproj` for more examples:\n\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_path.gif\" width=\"320\">\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_markdown.gif\" width=\"320\">\n<br/> <br/>\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_vertical.gif\" width=\"320\">\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_paste.gif\" width=\"320\">\n\n\nInstallation\n==============\n\n### CocoaPods\n\n1. Add `pod 'YYText'` to your Podfile.\n2. Run `pod install` or `pod update`.\n3. Import \\<YYText/YYText.h\\>.\n\n\n### Carthage\n\n1. Add `github \"ibireme/YYText\"` to your Cartfile.\n2. Run `carthage update --platform ios` and add the framework to your project.\n3. Import \\<YYText/YYText.h\\>.\n\n\n### Manually\n\n1. Download all the files in the `YYText` subdirectory.\n2. Add the source files to your Xcode project.\n3. Link with required frameworks:\n    * UIKit\n    * CoreFoundation\n    * CoreText\n    * QuartzCore\n    * Accelerate\n    * MobileCoreServices\n4. Import `YYText.h`.\n\n\n### Notice\nYou may add [YYImage](https://github.com/ibireme/YYImage) or [YYWebImage](https://github.com/ibireme/YYWebImage) to your project if you want to support animated image (GIF/APNG/WebP).\n\n\nDocumentation\n==============\nFull API documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/YYText/).<br/>\nYou can also install documentation locally using [appledoc](https://github.com/tomaz/appledoc).\n\n\nRequirements\n==============\nThis library requires `iOS 6.0+` and `Xcode 7.0+`.\n\n\nLicense\n==============\nYYText is released under the MIT license. See LICENSE file for details.\n\n\n<br/><br/>\n---\n中文介绍\n==============\n功能强大的 iOS 富文本编辑与显示框架。<br/>\n(该项目是 [YYKit](https://github.com/ibireme/YYKit) 组件之一)\n\n\n特性\n==============\n- API 兼容 UILabel 和 UITextView\n- 支持高性能的异步排版和渲染\n- 扩展了 CoreText 的属性以支持更多文字效果\n- 支持 UIImage、UIView、CALayer 作为图文混排元素\n- 支持添加自定义样式的、可点击的文本高亮范围\n- 支持自定义文本解析 (内置简单的 Markdown/表情解析)\n- 支持文本容器路径、内部留空路径的控制\n- 支持文字竖排版，可用于编辑和显示中日韩文本\n- 支持图片和富文本的复制粘贴\n- 文本编辑时，支持富文本占位符\n- 支持自定义键盘视图\n- 撤销和重做次数的控制\n- 富文本的序列化与反序列化支持\n- 支持多语言，支持 VoiceOver\n- 支持 Interface Builder\n- 全部代码都有文档注释\n\n\n架构\n==============\nYYText 和 TextKit 架构对比\n\n<img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/architecture.png\" width=\"400\">\n\n\n文本属性\n==============\n\n### YYText 原生支持的属性\n<table>\n  <thead>\n    <tr>\n      <th>Demo</th>\n      <th>Attribute Name</th>\n      <th>Class</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextAttachment.gif\" width=\"200\"></td>\n      <td>TextAttachment</td>\n      <td>YYTextAttachment</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextHighlight.gif\" width=\"200\"></td>\n      <td>TextHighlight</td>\n      <td>YYTextHighlight</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBinding.gif\" width=\"200\"></td>\n      <td>TextBinding</td>\n      <td>YYTextBinding</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextShadow.png\" width=\"200\"></td>\n      <td>TextShadow<br/>TextInnerShadow</td>\n      <td>YYTextShadow</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBorder.png\" width=\"200\"></td>\n      <td>TextBorder</td>\n      <td>YYTextBorder</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBackgroundBorder.png\" width=\"200\"></td>\n      <td>TextBackgroundBorder</td>\n      <td>YYTextBorder</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBlockBorder.png\" width=\"200\"></td>\n      <td>TextBlockBorder</td>\n      <td>YYTextBorder</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Obliqueness.png\" width=\"200\"></td>\n      <td>TextGlyphTransform</td>\n      <td> NSValue(CGAffineTransform)</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Underline.png\" width=\"200\"></td>\n      <td>TextUnderline</td>\n      <td>YYTextDecoration</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Strikethrough.png\" width=\"200\"></td>\n      <td>TextStrickthrough</td>\n      <td>YYTextDecoration</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/YYText Extended/YYTextBackedString.png\" width=\"200\"></td>\n      <td>TextBackedString</td>\n      <td>YYTextBackedString</td>\n    </tr>\n  </tbody>\n</table>\n\n###YYText 支持的 CoreText 属性\n<table>\n  <thead>\n    <tr>\n      <th>Demo</th>\n      <th>Attribute Name</th>\n      <th>Class</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Font.png\" width=\"200\"></td>\n      <td> Font </td>\n      <td>UIFont(CTFontRef)</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Kern.png\" width=\"200\"></td>\n      <td> Kern </td>\n      <td>NSNumber</td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Stroke.png\" width=\"200\"></td>\n      <td> StrokeWidth </td>\n      <td> NSNumber </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/StrokeColor.png\" width=\"200\"></td>\n      <td> StrokeColor </td>\n      <td> CGColorRef </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Shadow.png\" width=\"200\"></td>\n      <td> Shadow </td>\n      <td> NSShadow </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Ligature.png\" width=\"200\"></td>\n      <td> Ligature </td>\n      <td> NSNumber </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/VerticalForms.png\" width=\"200\"></td>\n      <td> VerticalGlyphForm </td>\n      <td> NSNumber(BOOL) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/WriteDirection.png\" width=\"200\"></td>\n      <td> WritingDirection </td>\n      <td> NSArray(NSNumber) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/RunDelegate.png\" width=\"200\"></td>\n      <td> RunDelegate </td>\n      <td> CTRunDelegateRef </td>\n    </tr>\n    \n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/Alignment.png\" width=\"200\"></td>\n      <td> TextAlignment </td>\n      <td> NSParagraphStyle <br/>(NSTextAlignment) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/LineBreakMode.png\" width=\"200\"></td>\n      <td> LineBreakMode </td>\n      <td> NSParagraphStyle <br/>(NSLineBreakMode) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/LineSpacing.png\" width=\"200\"></td>\n      <td> LineSpacing </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/ParagraphSpacing.png\" width=\"200\"></td>\n      <td> ParagraphSpacing <br/> ParagraphSpacingBefore </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/FirstLineHeadIndent.png\" width=\"200\"></td>\n      <td> FirstLineHeadIndent </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/HeadIndent.png\" width=\"200\"></td>\n      <td> HeadIndent </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/TailIndent.png\" width=\"200\"></td>\n      <td> TailIndent </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/MinimumLineHeight.png\" width=\"200\"></td>\n      <td> MinimumLineHeight </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/MaximumLineHeight.png\" width=\"200\"></td>\n      <td> MaximumLineHeight </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/LineHeightMultiple.png\" width=\"200\"></td>\n      <td> LineHeightMultiple </td>\n      <td> NSParagraphStyle <br/>(CGFloat) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/BaseWritingDirection.png\" width=\"200\"></td>\n      <td> BaseWritingDirection </td>\n      <td> NSParagraphStyle <br/>(NSWritingDirection) </td>\n    </tr>\n    <tr>\n      <td><img src=\"https://raw.github.com/ibireme/YYText/master/Attributes/CoreText and TextKit/Paragraph/Tab.png\" width=\"200\"></td>\n      <td> DefaultTabInterval <br/> TabStops </td>\n      <td> NSParagraphStyle <br/>CGFloat/NSArray(NSTextTab)</td>\n    </tr>\n  </tbody>\n</table>\n\n\n用法\n==============\n\n### 基本用法\n    // YYLabel (和 UILabel 用法一致)\n    YYLabel *label = [YYLabel new];\n    label.frame = ...\n    label.font = ...\n    label.textColor = ...\n    label.textAlignment = ...\n    label.lineBreakMode = ...\n    label.numberOfLines = ...\n    label.text = ...\n    \n    // YYTextView (和 UITextView 用法一致)\n    YYTextView *textView = [YYTextView new];\n    textView.frame = ...\n    textView.font = ...\n    textView.textColor = ...\n    textView.dataDetectorTypes = ...\n    textView.placeHolderText = ...\n    textView.placeHolderTextColor = ...\n    textView.delegate = ...\n    \n\n### 属性文本\n    \n    // 1. 创建一个属性文本\n    NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@\"Some Text, blabla...\"];\n    \n    // 2. 为文本设置属性\n    text.yy_font = [UIFont boldSystemFontOfSize:30];\n    text.yy_color = [UIColor blueColor];\n    [text yy_setColor:[UIColor redColor] range:NSMakeRange(0, 4)];\n    text.yy_lineSpacing = 10;\n    \n    // 3. 赋值到 YYLabel 或 YYTextView\n    YYLabel *label = [YYLabel new];\n    label.frame = ...\n    label.attributedString = text;\n    \n    YYTextView *textView = [YYTextView new];\n    textView.frame = ...\n    textView.attributedString = text;\n    \n\n### 文本高亮\n\n你可以用一些已经封装好的简便方法来设置文本高亮：\n\n\t[text yy_setTextHighlightRange:range\n                            color:[UIColor blueColor]\n                  backgroundColor:[UIColor grayColor]\n                        tapAction:^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect){ \n                            NSLog(@\"tap text range:...\"); \n                        }];\n\n或者用更复杂的办法来调节文本高亮的细节：\n    \n    // 1. 创建一个\"高亮\"属性，当用户点击了高亮区域的文本时，\"高亮\"属性会替换掉原本的属性\n    YYTextBorder *border = [YYTextBorder borderWithFillColor:[UIColor grayColor] cornerRadius:3];\n        \n    YYTextHighlight *highlight = [YYTextHighlight new];\n    [highlight setColor:[UIColor whiteColor]];\n    [highlight setBackgroundBorder:highlightBorder];\n    highlight.tapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {\n      NSLog(@\"tap text range:...\"); \n      // 你也可以把事件回调放到 YYLabel 和 YYTextView 来处理。\n    };\n    \n    // 2. 把\"高亮\"属性设置到某个文本范围\n    [attributedText yy_setTextHighlight:highlight range:highlightRange];\n    \n    // 3. 把属性文本设置到 YYLabel 或 YYTextView\n    YYLabel *label = ...\n    label.attributedText = attributedText\n    \n    YYTextView *textView = ...\n    textView.attributedText = ...\n    \n    // 4. 接受事件回调\n    label.highlightTapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {\n        NSLog(@\"tap text range:...\");\n    };\n    label.highlightLongPressAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {\n        NSLog(@\"long press text range:...\");\n    };\n    \n    @UITextViewDelegate\n    - (void)textView:(YYTextView *)textView didTapHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect {\n        NSLog(@\"tap text range:...\");\n    }\n    - (void)textView:(YYTextView *)textView didLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect {\n        NSLog(@\"long press text range:...\");\n    }\n\n\n### 图文混排\n\n\tNSMutableAttributedString *text = [NSMutableAttributedString new];\n\tUIFont *font = [UIFont systemFontOfSize:16];\n\tNSMutableAttributedString *attachment = nil;\n\t\n\t// 嵌入 UIImage\n\tUIImage *image = [UIImage imageNamed:@\"dribbble64_imageio\"];\n\tattachment = [NSMutableAttributedString yy_attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:image.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];\n\t[text appendAttributedString: attachment];\n\t\n\t// 嵌入 UIView\n\tUISwitch *switcher = [UISwitch new];\n    [switcher sizeToFit];\n\tattachment = [NSMutableAttributedString yy_attachmentStringWithContent:switcher contentMode:UIViewContentModeBottom attachmentSize:switcher.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];\n\t[text appendAttributedString: attachment];\n\t\n\t// 嵌入 CALayer\n\tCASharpLayer *layer = [CASharpLayer layer];\n\tlayer.path = ...\n\tattachment = [NSMutableAttributedString yy_attachmentStringWithContent:layer contentMode:UIViewContentModeBottom attachmentSize:switcher.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];\n\t[text appendAttributedString: attachment];\n\n\n### 文本布局计算\n\t\n\tNSAttributedString *text = ...\n\tCGSize size = CGSizeMake(100, CGFLOAT_MAX);\n\tYYTextLayout *layout = [YYTextLayout layoutWithContainerSize:size text:text];\n\t\n\t// 获取文本显示位置和大小\n\tlayout.textBoundingRect; // get bounding rect\n\tlayout.textBoundingSize; // get bounding size\n\t\n\t // 查询文本排版结果\n\t[layout lineIndexForPoint:CGPointMake(10,10)];\n\t[layout closestLineIndexForPoint:CGPointMake(10,10)];\n\t[layout closestPositionToPoint:CGPointMake(10,10)];\n\t[layout textRangeAtPoint:CGPointMake(10,10)];\n\t[layout rectForRange:[YYTextRange rangeWithRange:NSMakeRange(10,2)]];\n\t[layout selectionRectsForRange:[YYTextRange rangeWithRange:NSMakeRange(10,2)]];\n\t\n\t// 显示文本排版结果\n\tYYLabel *label = [YYLabel new];\n\tlabel.size = layout.textBoundingSize;\n\tlabel.textLayout = layout;\n\n\t\n### 文本行位置调整\n\n\t// 由于中文、英文、Emoji 等字体高度不一致，或者富文本中出现了不同字号的字体，\n\t// 可能会造成每行文字的高度不一致。这里可以添加一个修改器来实现固定行高，或者自定义文本行位置。\n  \n\t// 简单的方法:\n\t// 1. 创建一个文本行位置修改类，实现 `YYTextLinePositionModifier` 协议。\n\t// 2. 设置到 Label 或 TextView。\n\t\n\tYYTextLinePositionSimpleModifier *modifier = [YYTextLinePositionSimpleModifier new];\n\tmodifier.fixedLineHeight = 24;\n\t\n\tYYLabel *label = [YYLabel new];\n\tlabel.linePositionModifier = modifier;\n\t\n\t// 完全控制:\n\tYYTextLinePositionSimpleModifier *modifier = [YYTextLinePositionSimpleModifier new];\n\tmodifier.fixedLineHeight = 24;\n\t\n\tYYTextContainer *container = [YYTextContainer new];\n\tcontainer.size = CGSizeMake(100, CGFLOAT_MAX);\n\tcontainer.linePositionModifier = modifier;\n\t\n\tYYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];\n\tYYLabel *label = [YYLabel new];\n\tlabel.size = layout.textBoundingSize;\n\tlabel.textLayout = layout;\n\n\n### 异步排版和渲染\n    \n    // 如果你在显示字符串时有性能问题，可以这样开启异步模式：\n    YYLabel *label = ...\n    label.displaysAsynchronously = YES;\n    \n    // 如果需要获得最高的性能，你可以在后台线程用 `YYTextLayout` 进行预排版： \n    YYLabel *label = [YYLabel new];\n    label.displaysAsynchronously = YES; //开启异步绘制\n    label.ignoreCommonProperties = YES; //忽略除了 textLayout 之外的其他属性\n    \n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        // 创建属性字符串\n        NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@\"Some Text\"];\n        text.yy_font = [UIFont systemFontOfSize:16];\n        text.yy_color = [UIColor grayColor];\n        [text yy_setColor:[UIColor redColor] range:NSMakeRange(0, 4)];\n \n        // 创建文本容器\n        YYTextContainer *container = [YYTextContainer new];\n        container.size = CGSizeMake(100, CGFLOAT_MAX);\n        container.maximumNumberOfRows = 0;\n        \n        // 生成排版结果\n        YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            label.size = layout.textBoundingSize;\n            label.textLayout = layout;\n        });\n    });\n\n\n### 文本容器控制\n\n\tYYLabel *label = ...\n\tlabel.textContainerPath = [UIBezierPath bezierPathWith...];\n\tlabel.exclusionPaths = \t@[[UIBezierPath bezierPathWith...];,...];\n\tlabel.textContainerInset = UIEdgeInsetsMake(...);\n\tlabel.verticalForm = YES/NO;\n    \n    YYTextView *textView = ...\n\ttextView.exclusionPaths = \t@[[UIBezierPath bezierPathWith...];,...];\n\ttextView.textContainerInset = UIEdgeInsetsMake(...);\n\ttextView.verticalForm = YES/NO;\n    \n\n### 文本解析\n\t// 1. 创建一个解析器\n\t\n\t// 内置简单的表情解析\n    YYTextSimpleEmoticonParser *parser = [YYTextSimpleEmoticonParser new];\n    NSMutableDictionary *mapper = [NSMutableDictionary new];\n    mapper[@\":smile:\"] = [UIImage imageNamed:@\"smile.png\"];\n    mapper[@\":cool:\"] = [UIImage imageNamed:@\"cool.png\"];\n    mapper[@\":cry:\"] = [UIImage imageNamed:@\"cry.png\"];\n    mapper[@\":wink:\"] = [UIImage imageNamed:@\"wink.png\"];\n    parser.emoticonMapper = mapper;\n\t\n\t// 内置简单的 markdown 解析\n\tYYTextSimpleMarkdownParser *parser = [YYTextSimpleMarkdownParser new];\n    [parser setColorWithDarkTheme];\n    \n    // 实现 `YYTextParser` 协议的自定义解析器\n    MyCustomParser *parser = ... \n    \n    // 2. 把解析器添加到 YYLabel 或 YYTextView\n    YYLabel *label = ...\n    label.textParser = parser;\n    \n    YYTextView *textView = ...\n    textView.textParser = parser;\n\n### Debug\n\n    // 设置一个全局的 debug option 来显示排版结果。\n    YYTextDebugOption *debugOptions = [YYTextDebugOption new];\n    debugOptions.baselineColor = [UIColor redColor];\n    debugOptions.CTFrameBorderColor = [UIColor redColor];\n    debugOptions.CTLineFillColor = [UIColor colorWithRed:0.000 green:0.463 blue:1.000 alpha:0.180];\n    debugOptions.CGGlyphBorderColor = [UIColor colorWithRed:1.000 green:0.524 blue:0.000 alpha:0.200];\n    [YYTextDebugOption setSharedDebugOption:debugOptions];\n\n### 更多示例\n查看演示工程 `Demo/YYTextDemo.xcodeproj`:\n\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_path.gif\" width=\"320\">\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_markdown.gif\" width=\"320\">\n<br/> <br/>\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_vertical.gif\" width=\"320\">\n<img src=\"https://raw.github.com/ibireme/YYText/master/Demo/DemoSnapshot/text_paste.gif\" width=\"320\">\n\n\n安装\n==============\n\n### CocoaPods\n\n1. 在 Podfile 中添加 `pod 'YYText'`。\n2. 执行 `pod install` 或 `pod update`。\n3. 导入 \\<YYText/YYText.h\\>。\n\n\n### Carthage\n\n1. 在 Cartfile 中添加 `github \"ibireme/YYText\"`。\n2. 执行 `carthage update --platform ios` 并将生成的 framework 添加到你的工程。\n3. 导入 \\<YYText/YYText.h\\>。\n\n\n### 手动安装\n\n1. 下载 YYText 文件夹内的所有内容。\n2. 将 YYText 内的源文件添加(拖放)到你的工程。\n3. 链接以下 frameworks:\n    * UIKit\n    * CoreFoundation\n    * CoreText\n    * QuartzCore\n    * Accelerate\n    * MobileCoreServices\n4. 导入 `YYText.h`。\n\n\n### 注意\n你可以添加 [YYImage](https://github.com/ibireme/YYImage) 或 [YYWebImage](https://github.com/ibireme/YYWebImage) 到你的工程，以支持动画格式(GIF/APNG/WebP)的图片。\n\n\n文档\n==============\n你可以在 [CocoaDocs](http://cocoadocs.org/docsets/YYText/) 查看在线 API 文档，也可以用 [appledoc](https://github.com/tomaz/appledoc) 本地生成文档。\n\n\n系统要求\n==============\n该项目最低支持 `iOS 6.0` 和 `Xcode 7.0`。\n\n\n已知问题\n==============\n* YYText 并不能支持所有 CoreText/TextKit 的属性，比如 NSBackgroundColor、NSStrikethrough、NSUnderline、NSAttachment、NSLink 等，但 YYText 中基本都有对应属性作为替代。详情见上方表格。\n* YYTextView 未实现局部刷新，所以在输入和编辑大量的文本（比如超过大概五千个汉字、或大概一万个英文字符）时会出现较明显的卡顿现象。\n* 竖排版时，添加 exclusionPaths 在少数情况下可能会导致文本显示空白。\n* 当添加了非矩形的 textContainerPath，并且有嵌入大于文本排版方向宽度的 RunDelegate 时，RunDelegate 之后的文字会无法显示。这是 CoreText 的 Bug（或者说是 Feature）。\n\n许可证\n==============\nYYText 使用 MIT 许可证，详情见 LICENSE 文件。\n\n\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextContainerView.h",
    "content": "//\n//  YYTextContainerView.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/21.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextLayout.h>\n#else\n#import \"YYTextLayout.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A simple view to diaplay `YYTextLayout`.\n\n @discussion This view can become first responder. If this view is first responder,\n all the action (such as UIMenu's action) would forward to the `hostView` property.\n Typically, you should not use this class directly.\n \n @warning All the methods in this class should be called on main thread.\n */\n@interface YYTextContainerView : UIView\n\n/// First responder's aciton will forward to this view.\n@property (nullable, nonatomic, weak) UIView *hostView;\n\n/// Debug option for layout debug. Set this property will let the view redraw it's contents.\n@property (nullable, nonatomic, copy) YYTextDebugOption *debugOption;\n\n/// Text vertical alignment.\n@property (nonatomic) YYTextVerticalAlignment textVerticalAlignment;\n\n/// Text layout. Set this property will let the view redraw it's contents.\n@property (nullable, nonatomic, strong) YYTextLayout *layout;\n\n/// The contents fade animation duration when the layout's contents changed. Default is 0 (no animation).\n@property (nonatomic) NSTimeInterval contentsFadeDuration;\n\n/// Convenience method to set `layout` and `contentsFadeDuration`.\n/// @param layout  Same as `layout` property.\n/// @param fadeDuration  Same as `contentsFadeDuration` property.\n- (void)setLayout:(nullable YYTextLayout *)layout withFadeDuration:(NSTimeInterval)fadeDuration;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextContainerView.m",
    "content": "//\n//  YYTextContainerView.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/21.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextContainerView.h\"\n\n@implementation YYTextContainerView {\n    BOOL _attachmentChanged;\n    NSMutableArray *_attachmentViews;\n    NSMutableArray *_attachmentLayers;\n}\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (!self) return nil;\n    self.backgroundColor = [UIColor clearColor];\n    _attachmentViews = [NSMutableArray array];\n    _attachmentLayers = [NSMutableArray array];\n    return self;\n}\n\n- (void)setDebugOption:(YYTextDebugOption *)debugOption {\n    BOOL needDraw = _debugOption.needDrawDebug;\n    _debugOption = debugOption.copy;\n    if (_debugOption.needDrawDebug != needDraw) {\n        [self setNeedsDisplay];\n    }\n}\n\n- (void)setTextVerticalAlignment:(YYTextVerticalAlignment)textVerticalAlignment {\n    if (_textVerticalAlignment == textVerticalAlignment) return;\n    _textVerticalAlignment = textVerticalAlignment;\n    [self setNeedsDisplay];\n}\n\n- (void)setContentsFadeDuration:(NSTimeInterval)contentsFadeDuration {\n    if (_contentsFadeDuration == contentsFadeDuration) return;\n    _contentsFadeDuration = contentsFadeDuration;\n    if (contentsFadeDuration <= 0) {\n        [self.layer removeAnimationForKey:@\"contents\"];\n    }\n}\n\n- (void)setLayout:(YYTextLayout *)layout {\n    if (_layout == layout) return;\n    _layout = layout;\n    _attachmentChanged = YES;\n    [self setNeedsDisplay];\n}\n\n- (void)setLayout:(YYTextLayout *)layout withFadeDuration:(NSTimeInterval)fadeDuration {\n    self.contentsFadeDuration = fadeDuration;\n    self.layout = layout;\n}\n\n- (void)drawRect:(CGRect)rect {\n    // fade content\n    [self.layer removeAnimationForKey:@\"contents\"];\n    if (_contentsFadeDuration > 0) {\n        CATransition *transition = [CATransition animation];\n        transition.duration = _contentsFadeDuration;\n        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];\n        transition.type = kCATransitionFade;\n        [self.layer addAnimation:transition forKey:@\"contents\"];\n    }\n    \n    // update attachment\n    if (_attachmentChanged) {\n        for (UIView *view in _attachmentViews) {\n            if (view.superview == self) [view removeFromSuperview];\n        }\n        for (CALayer *layer in _attachmentLayers) {\n            if (layer.superlayer == self.layer) [layer removeFromSuperlayer];\n        }\n        [_attachmentViews removeAllObjects];\n        [_attachmentLayers removeAllObjects];\n    }\n    \n    // draw layout\n    CGSize boundingSize = _layout.textBoundingSize;\n    CGPoint point = CGPointZero;\n    if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n        if (_layout.container.isVerticalForm) {\n            point.x = -(self.bounds.size.width - boundingSize.width) * 0.5;\n        } else {\n            point.y = (self.bounds.size.height - boundingSize.height) * 0.5;\n        }\n    } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n        if (_layout.container.isVerticalForm) {\n            point.x = -(self.bounds.size.width - boundingSize.width);\n        } else {\n            point.y = (self.bounds.size.height - boundingSize.height);\n        }\n    }\n    [_layout drawInContext:UIGraphicsGetCurrentContext() size:self.bounds.size point:point view:self layer:self.layer debug:_debugOption cancel:nil];\n    \n    // update attachment\n    if (_attachmentChanged) {\n        _attachmentChanged = NO;\n        for (YYTextAttachment *a in _layout.attachments) {\n            if ([a.content isKindOfClass:[UIView class]]) [_attachmentViews addObject:a.content];\n            if ([a.content isKindOfClass:[CALayer class]]) [_attachmentLayers addObject:a.content];\n        }\n    }\n}\n\n- (void)setFrame:(CGRect)frame {\n    CGSize oldSize = self.bounds.size;\n    [super setFrame:frame];\n    if (!CGSizeEqualToSize(oldSize, self.bounds.size)) {\n        [self setNeedsLayout];\n    }\n}\n\n- (void)setBounds:(CGRect)bounds {\n    CGSize oldSize = self.bounds.size;\n    [super setBounds:bounds];\n    if (!CGSizeEqualToSize(oldSize, self.bounds.size)) {\n        [self setNeedsLayout];\n    }\n}\n\n#pragma mark - UIResponder forward\n\n- (BOOL)canBecomeFirstResponder {\n    return YES;\n}\n\n- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {\n    return [self.hostView canPerformAction:action withSender:sender];\n}\n\n- (id)forwardingTargetForSelector:(SEL)aSelector {\n    return self.hostView;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextDebugOption.h",
    "content": "//\n//  YYTextDebugOption.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/8.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n@class YYTextDebugOption;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The YYTextDebugTarget protocol defines the method a debug target should implement.\n A debug target can be add to the global container to receive the shared debug\n option changed notification.\n */\n@protocol YYTextDebugTarget <NSObject>\n\n@required\n/**\n When the shared debug option changed, this method would be called on main thread.\n It should return as quickly as possible. The option's property should not be changed\n in this method.\n \n @param option  The shared debug option.\n */\n- (void)setDebugOption:(nullable YYTextDebugOption *)option;\n@end\n\n\n\n/**\n The debug option for YYText.\n */\n@interface YYTextDebugOption : NSObject <NSCopying>\n@property (nullable, nonatomic, strong) UIColor *baselineColor;      ///< baseline color\n@property (nullable, nonatomic, strong) UIColor *CTFrameBorderColor; ///< CTFrame path border color\n@property (nullable, nonatomic, strong) UIColor *CTFrameFillColor;   ///< CTFrame path fill color\n@property (nullable, nonatomic, strong) UIColor *CTLineBorderColor;  ///< CTLine bounds border color\n@property (nullable, nonatomic, strong) UIColor *CTLineFillColor;    ///< CTLine bounds fill color\n@property (nullable, nonatomic, strong) UIColor *CTLineNumberColor;  ///< CTLine line number color\n@property (nullable, nonatomic, strong) UIColor *CTRunBorderColor;   ///< CTRun bounds border color\n@property (nullable, nonatomic, strong) UIColor *CTRunFillColor;     ///< CTRun bounds fill color\n@property (nullable, nonatomic, strong) UIColor *CTRunNumberColor;   ///< CTRun number color\n@property (nullable, nonatomic, strong) UIColor *CGGlyphBorderColor; ///< CGGlyph bounds border color\n@property (nullable, nonatomic, strong) UIColor *CGGlyphFillColor;   ///< CGGlyph bounds fill color\n\n- (BOOL)needDrawDebug; ///< `YES`: at least one debug color is visible. `NO`: all debug color is invisible/nil.\n- (void)clear; ///< Set all debug color to nil.\n\n/**\n Add a debug target.\n \n @discussion When `setSharedDebugOption:` is called, all added debug target will \n receive `setDebugOption:` in main thread. It maintains an unsafe_unretained\n reference to this target. The target must to removed before dealloc.\n \n @param target A debug target.\n */\n+ (void)addDebugTarget:(id<YYTextDebugTarget>)target;\n\n/**\n Remove a debug target which is added by `addDebugTarget:`.\n \n @param target A debug target.\n */\n+ (void)removeDebugTarget:(id<YYTextDebugTarget>)target;\n\n/**\n Returns the shared debug option.\n \n @return The shared debug option, default is nil.\n */\n+ (nullable YYTextDebugOption *)sharedDebugOption;\n\n/**\n Set a debug option as shared debug option.\n This method must be called on main thread.\n \n @discussion When call this method, the new option will set to all debug target\n which is added by `addDebugTarget:`.\n \n @param option  A new debug option (nil is valid).\n */\n+ (void)setSharedDebugOption:(nullable YYTextDebugOption *)option;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextDebugOption.m",
    "content": "//\n//  YYTextDebugOption.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/8.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextDebugOption.h\"\n#import \"YYTextWeakProxy.h\"\n#import <libkern/OSAtomic.h>\n#import <pthread.h>\n\nstatic pthread_mutex_t _sharedDebugLock;\nstatic CFMutableSetRef _sharedDebugTargets = nil;\nstatic YYTextDebugOption *_sharedDebugOption = nil;\n\nstatic const void* _sharedDebugSetRetain(CFAllocatorRef allocator, const void *value) {\n    return value;\n}\n\nstatic void _sharedDebugSetRelease(CFAllocatorRef allocator, const void *value) {\n}\n\nvoid _sharedDebugSetFunction(const void *value, void *context) {\n    id<YYTextDebugTarget> target = (__bridge id<YYTextDebugTarget>)(value);\n    [target setDebugOption:_sharedDebugOption];\n}\n\nstatic void _initSharedDebug() {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        pthread_mutex_init(&_sharedDebugLock, NULL);\n        CFSetCallBacks callbacks = kCFTypeSetCallBacks;\n        callbacks.retain = _sharedDebugSetRetain;\n        callbacks.release = _sharedDebugSetRelease;\n        _sharedDebugTargets = CFSetCreateMutable(CFAllocatorGetDefault(), 0, &callbacks);\n    });\n}\n\nstatic void _setSharedDebugOption(YYTextDebugOption *option) {\n    _initSharedDebug();\n    pthread_mutex_lock(&_sharedDebugLock);\n    _sharedDebugOption = option.copy;\n    CFSetApplyFunction(_sharedDebugTargets, _sharedDebugSetFunction, NULL);\n    pthread_mutex_unlock(&_sharedDebugLock);\n}\n\nstatic YYTextDebugOption *_getSharedDebugOption() {\n    _initSharedDebug();\n    pthread_mutex_lock(&_sharedDebugLock);\n    YYTextDebugOption *op = _sharedDebugOption;\n    pthread_mutex_unlock(&_sharedDebugLock);\n    return op;\n}\n\nstatic void _addDebugTarget(id<YYTextDebugTarget> target) {\n    _initSharedDebug();\n    pthread_mutex_lock(&_sharedDebugLock);\n    CFSetAddValue(_sharedDebugTargets, (__bridge const void *)(target));\n    pthread_mutex_unlock(&_sharedDebugLock);\n}\n\nstatic void _removeDebugTarget(id<YYTextDebugTarget> target) {\n    _initSharedDebug();\n    pthread_mutex_lock(&_sharedDebugLock);\n    CFSetRemoveValue(_sharedDebugTargets, (__bridge const void *)(target));\n    pthread_mutex_unlock(&_sharedDebugLock);\n}\n\n\n@implementation YYTextDebugOption\n\n- (id)copyWithZone:(NSZone *)zone {\n    YYTextDebugOption *op = [self.class new];\n    op.baselineColor = self.baselineColor;\n    op.CTFrameBorderColor = self.CTFrameBorderColor;\n    op.CTFrameFillColor = self.CTFrameFillColor;\n    op.CTLineBorderColor = self.CTLineBorderColor;\n    op.CTLineFillColor = self.CTLineFillColor;\n    op.CTLineNumberColor = self.CTLineNumberColor;\n    op.CTRunBorderColor = self.CTRunBorderColor;\n    op.CTRunFillColor = self.CTRunFillColor;\n    op.CTRunNumberColor = self.CTRunNumberColor;\n    op.CGGlyphBorderColor = self.CGGlyphBorderColor;\n    op.CGGlyphFillColor = self.CGGlyphFillColor;\n    return op;\n}\n\n- (BOOL)needDrawDebug {\n    if (self.baselineColor ||\n        self.CTFrameBorderColor ||\n        self.CTFrameFillColor ||\n        self.CTLineBorderColor ||\n        self.CTLineFillColor ||\n        self.CTLineNumberColor ||\n        self.CTRunBorderColor ||\n        self.CTRunFillColor ||\n        self.CTRunNumberColor ||\n        self.CGGlyphBorderColor ||\n        self.CGGlyphFillColor) return YES;\n    return NO;\n}\n\n- (void)clear {\n    self.baselineColor = nil;\n    self.CTFrameBorderColor = nil;\n    self.CTFrameFillColor = nil;\n    self.CTLineBorderColor = nil;\n    self.CTLineFillColor = nil;\n    self.CTLineNumberColor = nil;\n    self.CTRunBorderColor = nil;\n    self.CTRunFillColor = nil;\n    self.CTRunNumberColor = nil;\n    self.CGGlyphBorderColor = nil;\n    self.CGGlyphFillColor = nil;\n}\n\n+ (void)addDebugTarget:(id<YYTextDebugTarget>)target {\n    if (target) _addDebugTarget(target);\n}\n\n+ (void)removeDebugTarget:(id<YYTextDebugTarget>)target {\n    if (target) _removeDebugTarget(target);\n}\n\n+ (YYTextDebugOption *)sharedDebugOption {\n    return _getSharedDebugOption();\n}\n\n+ (void)setSharedDebugOption:(YYTextDebugOption *)option {\n    NSAssert([NSThread isMainThread], @\"This method must be called on the main thread\");\n    _setSharedDebugOption(option);\n}\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextEffectWindow.h",
    "content": "//\n//  YYTextEffectWindow.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextMagnifier.h>\n#import <YYtext/YYTextSelectionView.h>\n#else\n#import \"YYTextMagnifier.h\"\n#import \"YYTextSelectionView.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A window to display magnifier and extra contents for text view.\n \n @discussion Use `sharedWindow` to get the instance, don't create your own instance.\n Typically, you should not use this class directly.\n */\n@interface YYTextEffectWindow : UIWindow\n\n/// Returns the shared instance (returns nil in App Extension).\n+ (nullable instancetype)sharedWindow;\n\n/// Show the magnifier in this window with a 'popup' animation. @param mag A magnifier.\n- (void)showMagnifier:(YYTextMagnifier *)mag;\n/// Update the magnifier content and position. @param mag A magnifier.\n- (void)moveMagnifier:(YYTextMagnifier *)mag;\n/// Remove the magnifier from this window with a 'shrink' animation. @param mag A magnifier.\n- (void)hideMagnifier:(YYTextMagnifier *)mag;\n\n\n/// Show the selection dot in this window if the dot is clipped by the selection view.\n/// @param selection A selection view.\n- (void)showSelectionDot:(YYTextSelectionView *)selection;\n/// Remove the selection dot from this window.\n/// @param selection A selection view.\n- (void)hideSelectionDot:(YYTextSelectionView *)selection;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextEffectWindow.m",
    "content": "//\n//  YYTextEffectWindow.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextEffectWindow.h\"\n#import \"YYTextKeyboardManager.h\"\n#import \"YYTextUtilities.h\"\n#import \"UIView+YYText.h\"\n\n\n@implementation YYTextEffectWindow\n\n+ (instancetype)sharedWindow {\n    static YYTextEffectWindow *one = nil;\n    if (one == nil) {\n        // iOS 9 compatible\n        NSString *mode = [NSRunLoop currentRunLoop].currentMode;\n        if (mode.length == 27 &&\n            [mode hasPrefix:@\"UI\"] &&\n            [mode hasSuffix:@\"InitializationRunLoopMode\"]) {\n            return nil;\n        }\n    }\n    \n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        if (!YYTextIsAppExtension()) {\n            one = [self new];\n            one.frame = (CGRect){.size = YYTextScreenSize()};\n            one.userInteractionEnabled = NO;\n            one.windowLevel = UIWindowLevelStatusBar + 1;\n            one.hidden = NO;\n            \n            // for iOS 9:\n            one.opaque = NO;\n            one.backgroundColor = [UIColor clearColor];\n            one.layer.backgroundColor = [UIColor clearColor].CGColor;\n        }\n    });\n    return one;\n}\n\n// stop self from becoming the KeyWindow\n- (void)becomeKeyWindow {\n    [[YYTextSharedApplication().delegate window] makeKeyWindow];\n}\n\n- (UIViewController *)rootViewController {\n    for (UIWindow *window in [YYTextSharedApplication() windows]) {\n        if (self == window) continue;\n        if (window.hidden) continue;\n        UIViewController *topViewController = window.rootViewController;\n        if (topViewController) return topViewController;\n    }\n    UIViewController *viewController = [super rootViewController];\n    if (!viewController) {\n        viewController = [UIViewController new];\n        [super setRootViewController:viewController];\n    }\n    return viewController;\n}\n\n// Bring self to front\n- (void)_updateWindowLevel {\n    UIApplication *app = YYTextSharedApplication();\n    if (!app) return;\n    \n    UIWindow *top = app.windows.lastObject;\n    UIWindow *key = app.keyWindow;\n    if (key && key.windowLevel > top.windowLevel) top = key;\n    if (top == self) return;\n    self.windowLevel = top.windowLevel + 1;\n}\n\n- (YYTextDirection)_keyboardDirection {\n    CGRect keyboardFrame = [YYTextKeyboardManager defaultManager].keyboardFrame;\n    keyboardFrame = [[YYTextKeyboardManager defaultManager] convertRect:keyboardFrame toView:self];\n    if (CGRectIsNull(keyboardFrame) || CGRectIsEmpty(keyboardFrame)) return YYTextDirectionNone;\n    \n    if (CGRectGetMinY(keyboardFrame) == 0 &&\n        CGRectGetMinX(keyboardFrame) == 0 &&\n        CGRectGetMaxX(keyboardFrame) == CGRectGetWidth(self.frame))\n        return YYTextDirectionTop;\n    \n    if (CGRectGetMaxX(keyboardFrame) == CGRectGetWidth(self.frame) &&\n        CGRectGetMinY(keyboardFrame) == 0 &&\n        CGRectGetMaxY(keyboardFrame) == CGRectGetHeight(self.frame))\n        return YYTextDirectionRight;\n    \n    if (CGRectGetMaxY(keyboardFrame) == CGRectGetHeight(self.frame) &&\n        CGRectGetMinX(keyboardFrame) == 0 &&\n        CGRectGetMaxX(keyboardFrame) == CGRectGetWidth(self.frame))\n        return YYTextDirectionBottom;\n    \n    if (CGRectGetMinX(keyboardFrame) == 0 &&\n        CGRectGetMinY(keyboardFrame) == 0 &&\n        CGRectGetMaxY(keyboardFrame) == CGRectGetHeight(self.frame))\n        return YYTextDirectionLeft;\n    \n    return YYTextDirectionNone;\n}\n\n- (CGPoint)_correctedCaptureCenter:(CGPoint)center{\n    CGRect keyboardFrame = [YYTextKeyboardManager defaultManager].keyboardFrame;\n    keyboardFrame = [[YYTextKeyboardManager defaultManager] convertRect:keyboardFrame toView:self];\n    if (!CGRectIsNull(keyboardFrame) && !CGRectIsEmpty(keyboardFrame)) {\n        YYTextDirection direction = [self _keyboardDirection];\n        switch (direction) {\n            case YYTextDirectionTop: {\n                if (center.y < CGRectGetMaxY(keyboardFrame)) center.y = CGRectGetMaxY(keyboardFrame);\n            } break;\n            case YYTextDirectionRight: {\n                if (center.x > CGRectGetMinX(keyboardFrame)) center.x = CGRectGetMinX(keyboardFrame);\n            } break;\n            case YYTextDirectionBottom: {\n                if (center.y > CGRectGetMinY(keyboardFrame)) center.y = CGRectGetMinY(keyboardFrame);\n            } break;\n            case YYTextDirectionLeft: {\n                if (center.x < CGRectGetMaxX(keyboardFrame)) center.x = CGRectGetMaxX(keyboardFrame);\n            } break;\n            default: break;\n        }\n    }\n    return center;\n}\n\n- (CGPoint)_correctedCenter:(CGPoint)center forMagnifier:(YYTextMagnifier *)mag rotation:(CGFloat)rotation {\n    CGFloat degree = YYTextRadiansToDegrees(rotation);\n    \n    degree /= 45.0;\n    if (degree < 0) degree += (int)(-degree/8.0 + 1) * 8;\n    if (degree > 8) degree -= (int)(degree/8.0) * 8;\n    \n    CGFloat caretExt = 10;\n    if (degree <= 1 || degree >= 7) { //top\n        if (mag.type == YYTextMagnifierTypeCaret) {\n            if (center.y < caretExt)\n                center.y = caretExt;\n        } else if (mag.type == YYTextMagnifierTypeRanged) {\n            if (center.y < mag.bounds.size.height)\n                center.y = mag.bounds.size.height;\n        }\n    } else if (1 < degree && degree < 3) { // right\n        if (mag.type == YYTextMagnifierTypeCaret) {\n            if (center.x > self.bounds.size.width - caretExt)\n                center.x = self.bounds.size.width - caretExt;\n        } else if (mag.type == YYTextMagnifierTypeRanged) {\n            if (center.x > self.bounds.size.width - mag.bounds.size.height)\n                center.x = self.bounds.size.width - mag.bounds.size.height;\n        }\n    } else if (3 <= degree && degree <= 5) { // bottom\n        if (mag.type == YYTextMagnifierTypeCaret) {\n            if (center.y > self.bounds.size.height - caretExt)\n                center.y = self.bounds.size.height - caretExt;\n        } else if (mag.type == YYTextMagnifierTypeRanged) {\n            if (center.y > mag.bounds.size.height)\n                center.y = mag.bounds.size.height;\n        }\n    } else if (5 < degree && degree < 7) { // left\n        if (mag.type == YYTextMagnifierTypeCaret) {\n            if (center.x < caretExt)\n                center.x = caretExt;\n        } else if (mag.type == YYTextMagnifierTypeRanged) {\n            if (center.x < mag.bounds.size.height)\n                center.x = mag.bounds.size.height;\n        }\n    }\n\n    \n    CGRect keyboardFrame = [YYTextKeyboardManager defaultManager].keyboardFrame;\n    keyboardFrame = [[YYTextKeyboardManager defaultManager] convertRect:keyboardFrame toView:self];\n    if (!CGRectIsNull(keyboardFrame) && !CGRectIsEmpty(keyboardFrame)) {\n        YYTextDirection direction = [self _keyboardDirection];\n        switch (direction) {\n            case YYTextDirectionTop: {\n                if (mag.type == YYTextMagnifierTypeCaret) {\n                    if (center.y - mag.bounds.size.height / 2 < CGRectGetMaxY(keyboardFrame))\n                        center.y = CGRectGetMaxY(keyboardFrame) + mag.bounds.size.height / 2;\n                } else if (mag.type == YYTextMagnifierTypeRanged) {\n                    if (center.y < CGRectGetMaxY(keyboardFrame)) center.y = CGRectGetMaxY(keyboardFrame);\n                }\n            } break;\n            case YYTextDirectionRight: {\n                if (mag.type == YYTextMagnifierTypeCaret) {\n                    if (center.x + mag.bounds.size.height / 2 > CGRectGetMinX(keyboardFrame))\n                        center.x = CGRectGetMinX(keyboardFrame) - mag.bounds.size.width / 2;\n                } else if (mag.type == YYTextMagnifierTypeRanged) {\n                    if (center.x > CGRectGetMinX(keyboardFrame)) center.x = CGRectGetMinX(keyboardFrame);\n                }\n            } break;\n            case YYTextDirectionBottom: {\n                if (mag.type == YYTextMagnifierTypeCaret) {\n                    if (center.y + mag.bounds.size.height / 2 > CGRectGetMinY(keyboardFrame))\n                        center.y = CGRectGetMinY(keyboardFrame) - mag.bounds.size.height / 2;\n                } else if (mag.type == YYTextMagnifierTypeRanged) {\n                    if (center.y > CGRectGetMinY(keyboardFrame)) center.y = CGRectGetMinY(keyboardFrame);\n                }\n            } break;\n            case YYTextDirectionLeft: {\n                if (mag.type == YYTextMagnifierTypeCaret) {\n                    if (center.x - mag.bounds.size.height / 2 < CGRectGetMaxX(keyboardFrame))\n                        center.x = CGRectGetMaxX(keyboardFrame) + mag.bounds.size.width / 2;\n                } else if (mag.type == YYTextMagnifierTypeRanged) {\n                    if (center.x < CGRectGetMaxX(keyboardFrame)) center.x = CGRectGetMaxX(keyboardFrame);\n                }\n            } break;\n            default: break;\n        }\n    }\n    \n    return center;\n}\n\n/**\n Capture screen snapshot and set it to magnifier.\n @return Magnifier rotation radius.\n */\n- (CGFloat)_updateMagnifier:(YYTextMagnifier *)mag {\n    UIApplication *app = YYTextSharedApplication();\n    if (!app) return 0;\n    \n    UIView *hostView = mag.hostView;\n    UIWindow *hostWindow = [hostView isKindOfClass:[UIWindow class]] ? (id)hostView : hostView.window;\n    if (!hostView || !hostWindow) return 0;\n    CGPoint captureCenter = [self yy_convertPoint:mag.hostCaptureCenter fromViewOrWindow:hostView];\n    captureCenter = [self _correctedCaptureCenter:captureCenter];\n    CGRect captureRect = {.size = mag.snapshotSize};\n    captureRect.origin.x = captureCenter.x - captureRect.size.width / 2;\n    captureRect.origin.y = captureCenter.y - captureRect.size.height / 2;\n    \n    CGAffineTransform trans = YYTextCGAffineTransformGetFromViews(hostView, self);\n    CGFloat rotation = YYTextCGAffineTransformGetRotation(trans);\n    \n    if (mag.captureDisabled) {\n        if (!mag.snapshot || mag.snapshot.size.width > 1) {\n            static UIImage *placeholder;\n            static dispatch_once_t onceToken;\n            dispatch_once(&onceToken, ^{\n                CGRect rect = mag.bounds;\n                rect.origin = CGPointZero;\n                UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);\n                CGContextRef context = UIGraphicsGetCurrentContext();\n                [[UIColor colorWithWhite:1 alpha:0.8] set];\n                CGContextFillRect(context, rect);\n                placeholder = UIGraphicsGetImageFromCurrentImageContext();\n                UIGraphicsEndImageContext();\n            });\n            mag.captureFadeAnimation = YES;\n            mag.snapshot = placeholder;\n            mag.captureFadeAnimation = NO;\n        }\n        return rotation;\n    }\n    \n    UIGraphicsBeginImageContextWithOptions(captureRect.size, NO, 0);\n    CGContextRef context = UIGraphicsGetCurrentContext();\n    if (!context) return rotation;\n    \n    CGPoint tp = CGPointMake(captureRect.size.width / 2, captureRect.size.height / 2);\n    tp = CGPointApplyAffineTransform(tp, CGAffineTransformMakeRotation(rotation));\n    CGContextRotateCTM(context, -rotation);\n    CGContextTranslateCTM(context, tp.x - captureCenter.x, tp.y - captureCenter.y);\n    \n    NSMutableArray *windows = app.windows.mutableCopy;\n    UIWindow *keyWindow = app.keyWindow;\n    if (![windows containsObject:keyWindow]) [windows addObject:keyWindow];\n    [windows sortUsingComparator:^NSComparisonResult(UIWindow *w1, UIWindow *w2) {\n        if (w1.windowLevel < w2.windowLevel) return NSOrderedAscending;\n        else if (w1.windowLevel > w2.windowLevel) return NSOrderedDescending;\n        return NSOrderedSame;\n    }];\n    UIScreen *mainScreen = [UIScreen mainScreen];\n    for (UIWindow *window in windows) {\n        if (window.hidden || window.alpha <= 0.01) continue;\n        if (window.screen != mainScreen) continue;\n        if ([window isKindOfClass:self.class]) break; //don't capture window above self\n        CGContextSaveGState(context);\n        CGContextConcatCTM(context, YYTextCGAffineTransformGetFromViews(window, self));\n        [window.layer renderInContext:context]; //render\n        //[window drawViewHierarchyInRect:window.bounds afterScreenUpdates:NO]; //slower when capture whole window\n        CGContextRestoreGState(context);\n    }\n    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n    UIGraphicsEndImageContext();\n    \n    if (mag.snapshot.size.width == 1) {\n        mag.captureFadeAnimation = YES;\n    }\n    mag.snapshot = image;\n    mag.captureFadeAnimation = NO;\n    return rotation;\n}\n\n- (void)showMagnifier:(YYTextMagnifier *)mag {\n    if (!mag) return;\n    if (mag.superview != self) [self addSubview:mag];\n    [self _updateWindowLevel];\n    CGFloat rotation = [self _updateMagnifier:mag];\n    CGPoint center = [self yy_convertPoint:mag.hostPopoverCenter fromViewOrWindow:mag.hostView];\n    CGAffineTransform trans = CGAffineTransformMakeRotation(rotation);\n    trans = CGAffineTransformScale(trans, 0.3, 0.3);\n    mag.transform = trans;\n    mag.center = center;\n    if (mag.type == YYTextMagnifierTypeRanged) {\n        mag.alpha = 0;\n    }\n    NSTimeInterval time = mag.type == YYTextMagnifierTypeCaret ? 0.08 : 0.1;\n    [UIView animateWithDuration:time delay:0 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState animations:^{\n        if (mag.type == YYTextMagnifierTypeCaret) {\n            CGPoint newCenter = CGPointMake(0, -mag.fitSize.height / 2);\n            newCenter = CGPointApplyAffineTransform(newCenter, CGAffineTransformMakeRotation(rotation));\n            newCenter.x += center.x;\n            newCenter.y += center.y;\n            mag.center = [self _correctedCenter:newCenter forMagnifier:mag rotation:rotation];\n        } else {\n            mag.center = [self _correctedCenter:center forMagnifier:mag rotation:rotation];\n        }\n        mag.transform = CGAffineTransformMakeRotation(rotation);\n        mag.alpha = 1;\n    } completion:^(BOOL finished) {\n        \n    }];\n}\n\n- (void)moveMagnifier:(YYTextMagnifier *)mag {\n    if (!mag) return;\n    [self _updateWindowLevel];\n    CGFloat rotation = [self _updateMagnifier:mag];\n    CGPoint center = [self yy_convertPoint:mag.hostPopoverCenter fromViewOrWindow:mag.hostView];\n    if (mag.type == YYTextMagnifierTypeCaret) {\n        CGPoint newCenter = CGPointMake(0, -mag.fitSize.height / 2);\n        newCenter = CGPointApplyAffineTransform(newCenter, CGAffineTransformMakeRotation(rotation));\n        newCenter.x += center.x;\n        newCenter.y += center.y;\n        mag.center = [self _correctedCenter:newCenter forMagnifier:mag rotation:rotation];\n    } else {\n        mag.center = [self _correctedCenter:center forMagnifier:mag rotation:rotation];\n    }\n    mag.transform = CGAffineTransformMakeRotation(rotation);\n}\n\n- (void)hideMagnifier:(YYTextMagnifier *)mag {\n    if (!mag) return;\n    if (mag.superview != self) return;\n    CGFloat rotation = [self _updateMagnifier:mag];\n    CGPoint center = [self yy_convertPoint:mag.hostPopoverCenter fromViewOrWindow:mag.hostView];\n    NSTimeInterval time = mag.type == YYTextMagnifierTypeCaret ? 0.20 : 0.15;\n    [UIView animateWithDuration:time delay:0 options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState animations:^{\n        \n        CGAffineTransform trans = CGAffineTransformMakeRotation(rotation);\n        trans = CGAffineTransformScale(trans, 0.01, 0.01);\n        mag.transform = trans;\n        \n        if (mag.type == YYTextMagnifierTypeCaret) {\n            CGPoint newCenter = CGPointMake(0, -mag.fitSize.height / 2);\n            newCenter = CGPointApplyAffineTransform(newCenter, CGAffineTransformMakeRotation(rotation));\n            newCenter.x += center.x;\n            newCenter.y += center.y;\n            mag.center = [self _correctedCenter:newCenter forMagnifier:mag rotation:rotation];\n        } else {\n            mag.center = [self _correctedCenter:center forMagnifier:mag rotation:rotation];\n            mag.alpha = 0;\n        }\n        \n    } completion:^(BOOL finished) {\n        if (finished) {\n            [mag removeFromSuperview];\n            mag.transform = CGAffineTransformIdentity;\n            mag.alpha = 1;\n        }\n    }];\n}\n\n- (void)_updateSelectionGrabberDot:(YYSelectionGrabberDot *)dot selection:(YYTextSelectionView *)selection{\n    dot.mirror.hidden = YES;\n    if (selection.hostView.clipsToBounds == YES && dot.yy_visibleAlpha > 0.1) {\n        CGRect dotRect = [dot yy_convertRect:dot.bounds toViewOrWindow:self];\n        BOOL dotInKeyboard = NO;\n        \n        CGRect keyboardFrame = [YYTextKeyboardManager defaultManager].keyboardFrame;\n        keyboardFrame = [[YYTextKeyboardManager defaultManager] convertRect:keyboardFrame toView:self];\n        if (!CGRectIsNull(keyboardFrame) && !CGRectIsEmpty(keyboardFrame)) {\n            CGRect inter = CGRectIntersection(dotRect, keyboardFrame);\n            if (!CGRectIsNull(inter) && (inter.size.width > 1 || inter.size.height > 1)) {\n                dotInKeyboard = YES;\n            }\n        }\n        if (!dotInKeyboard) {\n            CGRect hostRect = [selection.hostView convertRect:selection.hostView.bounds toView:self];\n            CGRect intersection = CGRectIntersection(dotRect, hostRect);\n            if (YYTextCGRectGetArea(intersection) < YYTextCGRectGetArea(dotRect)) {\n                CGFloat dist = YYTextCGPointGetDistanceToRect(YYTextCGRectGetCenter(dotRect), hostRect);\n                if (dist < CGRectGetWidth(dot.frame) * 0.55) {\n                    dot.mirror.hidden = NO;\n                }\n            }\n        }\n    }\n    CGPoint center = [dot yy_convertPoint:CGPointMake(CGRectGetWidth(dot.frame) / 2, CGRectGetHeight(dot.frame) / 2) toViewOrWindow:self];\n    if (isnan(center.x) || isnan(center.y) || isinf(center.x) || isinf(center.y)) {\n        dot.mirror.hidden = YES;\n    } else {\n        dot.mirror.center = center;\n    }\n}\n\n- (void)showSelectionDot:(YYTextSelectionView *)selection {\n    if (!selection) return;\n    [self _updateWindowLevel];\n    [self insertSubview:selection.startGrabber.dot.mirror atIndex:0];\n    [self insertSubview:selection.endGrabber.dot.mirror atIndex:0];\n    [self _updateSelectionGrabberDot:selection.startGrabber.dot selection:selection];\n    [self _updateSelectionGrabberDot:selection.endGrabber.dot selection:selection];\n}\n\n- (void)hideSelectionDot:(YYTextSelectionView *)selection {\n    if (!selection) return;\n    [selection.startGrabber.dot.mirror removeFromSuperview];\n    [selection.endGrabber.dot.mirror removeFromSuperview];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextInput.h",
    "content": "//\n//  YYTextInput.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/17.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Text position affinity. For example, the offset appears after the last\n character on a line is backward affinity, before the first character on\n the following line is forward affinity.\n */\ntypedef NS_ENUM(NSInteger, YYTextAffinity) {\n    YYTextAffinityForward  = 0, ///< offset appears before the character\n    YYTextAffinityBackward = 1, ///< offset appears after the character\n};\n\n\n/**\n A YYTextPosition object represents a position in a text container; in other words, \n it is an index into the backing string in a text-displaying view.\n \n YYTextPosition has the same API as Apple's implementation in UITextView/UITextField,\n so you can alse use it to interact with UITextView/UITextField.\n */\n@interface YYTextPosition : UITextPosition <NSCopying>\n\n@property (nonatomic, readonly) NSInteger offset;\n@property (nonatomic, readonly) YYTextAffinity affinity;\n\n+ (instancetype)positionWithOffset:(NSInteger)offset;\n+ (instancetype)positionWithOffset:(NSInteger)offset affinity:(YYTextAffinity) affinity;\n\n- (NSComparisonResult)compare:(id)otherPosition;\n\n@end\n\n\n/**\n A YYTextRange object represents a range of characters in a text container; in other words, \n it identifies a starting index and an ending index in string backing a text-displaying view.\n \n YYTextRange has the same API as Apple's implementation in UITextView/UITextField,\n so you can alse use it to interact with UITextView/UITextField.\n */\n@interface YYTextRange : UITextRange <NSCopying>\n\n@property (nonatomic, readonly) YYTextPosition *start;\n@property (nonatomic, readonly) YYTextPosition *end;\n@property (nonatomic, readonly, getter=isEmpty) BOOL empty;\n\n+ (instancetype)rangeWithRange:(NSRange)range;\n+ (instancetype)rangeWithRange:(NSRange)range affinity:(YYTextAffinity) affinity;\n+ (instancetype)rangeWithStart:(YYTextPosition *)start end:(YYTextPosition *)end;\n+ (instancetype)defaultRange; ///< <{0,0} Forward>\n\n- (NSRange)asRange;\n\n@end\n\n\n/**\n A YYTextSelectionRect object encapsulates information about a selected range of \n text in a text-displaying view.\n \n YYTextSelectionRect has the same API as Apple's implementation in UITextView/UITextField,\n so you can alse use it to interact with UITextView/UITextField.\n */\n@interface YYTextSelectionRect : UITextSelectionRect <NSCopying>\n\n@property (nonatomic, readwrite) CGRect rect;\n@property (nonatomic, readwrite) UITextWritingDirection writingDirection;\n@property (nonatomic, readwrite) BOOL containsStart;\n@property (nonatomic, readwrite) BOOL containsEnd;\n@property (nonatomic, readwrite) BOOL isVertical;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextInput.m",
    "content": "//\n//  YYTextInput.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/17.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextInput.h\"\n#import \"YYTextUtilities.h\"\n\n\n@implementation YYTextPosition\n\n+ (instancetype)positionWithOffset:(NSInteger)offset {\n    return [self positionWithOffset:offset affinity:YYTextAffinityForward];\n}\n\n+ (instancetype)positionWithOffset:(NSInteger)offset affinity:(YYTextAffinity)affinity {\n    YYTextPosition *p = [self new];\n    p->_offset = offset;\n    p->_affinity = affinity;\n    return p;\n}\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    return [self.class positionWithOffset:_offset affinity:_affinity];\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@: %p> (%@%@)\", self.class, self, @(_offset), _affinity == YYTextAffinityForward ? @\"F\":@\"B\"];\n}\n\n- (NSUInteger)hash {\n    return _offset * 2 + (_affinity == YYTextAffinityForward ? 1 : 0);\n}\n\n- (BOOL)isEqual:(YYTextPosition *)object {\n    if (!object) return NO;\n    return _offset == object.offset && _affinity == object.affinity;\n}\n\n- (NSComparisonResult)compare:(YYTextPosition *)otherPosition {\n    if (!otherPosition) return NSOrderedAscending;\n    if (_offset < otherPosition.offset) return NSOrderedAscending;\n    if (_offset > otherPosition.offset) return NSOrderedDescending;\n    if (_affinity == YYTextAffinityBackward && otherPosition.affinity == YYTextAffinityForward) return NSOrderedAscending;\n    if (_affinity == YYTextAffinityForward && otherPosition.affinity == YYTextAffinityBackward) return NSOrderedDescending;\n    return NSOrderedSame;\n}\n\n@end\n\n\n\n@implementation YYTextRange {\n    YYTextPosition *_start;\n    YYTextPosition *_end;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) return nil;\n    _start = [YYTextPosition positionWithOffset:0];\n    _end = [YYTextPosition positionWithOffset:0];\n    return self;\n}\n\n- (YYTextPosition *)start {\n    return _start;\n}\n\n- (YYTextPosition *)end {\n    return _end;\n}\n\n- (BOOL)isEmpty {\n    return _start.offset == _end.offset;\n}\n\n- (NSRange)asRange {\n    return NSMakeRange(_start.offset, _end.offset - _start.offset);\n}\n\n+ (instancetype)rangeWithRange:(NSRange)range {\n    return [self rangeWithRange:range affinity:YYTextAffinityForward];\n}\n\n+ (instancetype)rangeWithRange:(NSRange)range affinity:(YYTextAffinity)affinity {\n    YYTextPosition *start = [YYTextPosition positionWithOffset:range.location affinity:affinity];\n    YYTextPosition *end = [YYTextPosition positionWithOffset:range.location + range.length affinity:affinity];\n    return [self rangeWithStart:start end:end];\n}\n\n+ (instancetype)rangeWithStart:(YYTextPosition *)start end:(YYTextPosition *)end {\n    if (!start || !end) return nil;\n    if ([start compare:end] == NSOrderedDescending) {\n        YYTEXT_SWAP(start, end);\n    }\n    YYTextRange *range = [YYTextRange new];\n    range->_start = start;\n    range->_end = end;\n    return range;\n}\n\n+ (instancetype)defaultRange {\n    return [self new];\n}\n\n- (instancetype)copyWithZone:(NSZone *)zone {\n    return [self.class rangeWithStart:_start end:_end];\n}\n\n- (NSString *)description {\n    return [NSString stringWithFormat:@\"<%@: %p> (%@, %@)%@\", self.class, self, @(_start.offset), @(_end.offset - _start.offset), _end.affinity == YYTextAffinityForward ? @\"F\":@\"B\"];\n}\n\n- (NSUInteger)hash {\n    return (sizeof(NSUInteger) == 8 ? OSSwapInt64(_start.hash) : OSSwapInt32(_start.hash)) + _end.hash;\n}\n\n- (BOOL)isEqual:(YYTextRange *)object {\n    if (!object) return NO;\n    return [_start isEqual:object.start] && [_end isEqual:object.end];\n}\n\n@end\n\n\n\n@implementation YYTextSelectionRect\n\n@synthesize rect = _rect;\n@synthesize writingDirection = _writingDirection;\n@synthesize containsStart = _containsStart;\n@synthesize containsEnd = _containsEnd;\n@synthesize isVertical = _isVertical;\n\n- (id)copyWithZone:(NSZone *)zone {\n    YYTextSelectionRect *one = [self.class new];\n    one.rect = _rect;\n    one.writingDirection = _writingDirection;\n    one.containsStart = _containsStart;\n    one.containsEnd = _containsEnd;\n    one.isVertical = _isVertical;\n    return one;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextKeyboardManager.h",
    "content": "//\n//  YYTextKeyboardManager.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/6/3.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n System keyboard transition information.\n Use -[YYTextKeyboardManager convertRect:toView:] to convert frame to specified view.\n */\ntypedef struct {\n    BOOL fromVisible; ///< Keyboard visible before transition.\n    BOOL toVisible;   ///< Keyboard visible after transition.\n    CGRect fromFrame; ///< Keyboard frame before transition.\n    CGRect toFrame;   ///< Keyboard frame after transition.\n    NSTimeInterval animationDuration;       ///< Keyboard transition animation duration.\n    UIViewAnimationCurve animationCurve;    ///< Keyboard transition animation curve.\n    UIViewAnimationOptions animationOption; ///< Keybaord transition animation option.\n} YYTextKeyboardTransition;\n\n\n/**\n The YYTextKeyboardObserver protocol defines the method you can use\n to receive system keyboard change information.\n */\n@protocol YYTextKeyboardObserver <NSObject>\n@optional\n- (void)keyboardChangedWithTransition:(YYTextKeyboardTransition)transition;\n@end\n\n\n/**\n A YYTextKeyboardManager object lets you get the system keyboard information,\n and track the keyboard visible/frame/transition.\n \n @discussion You should access this class in main thread.\n Compatible: iPhone/iPad with iOS6/7/8/9.\n */\n@interface YYTextKeyboardManager : NSObject\n\n- (instancetype)init UNAVAILABLE_ATTRIBUTE;\n+ (instancetype)new UNAVAILABLE_ATTRIBUTE;\n\n/// Get the default manager (returns nil in App Extension).\n+ (nullable instancetype)defaultManager;\n\n/// Get the keyboard window. nil if there's no keyboard window.\n@property (nullable, nonatomic, readonly) UIWindow *keyboardWindow;\n\n/// Get the keyboard view. nil if there's no keyboard view.\n@property (nullable, nonatomic, readonly) UIView *keyboardView;\n\n/// Whether the keyboard is visible.\n@property (nonatomic, readonly, getter=isKeyboardVisible) BOOL keyboardVisible;\n\n/// Get the keyboard frame. CGRectNull if there's no keyboard view.\n/// Use convertRect:toView: to convert frame to specified view.\n@property (nonatomic, readonly) CGRect keyboardFrame;\n\n\n/**\n Add an observer to manager to get keyboard change information.\n This method makes a weak reference to the observer.\n \n @param observer An observer. \n This method will do nothing if the observer is nil, or already added.\n */\n- (void)addObserver:(id<YYTextKeyboardObserver>)observer;\n\n/**\n Remove an observer from manager.\n \n @param observer An observer.\n This method will do nothing if the observer is nil, or not in manager.\n */\n- (void)removeObserver:(id<YYTextKeyboardObserver>)observer;\n\n/**\n Convert rect to specified view or window.\n \n @param rect The frame rect.\n @param view A specified view or window (pass nil to convert for main window).\n @return The converted rect in specifeid view.\n */\n- (CGRect)convertRect:(CGRect)rect toView:(nullable UIView *)view;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextKeyboardManager.m",
    "content": "//\n//  YYTextKeyboardManager.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/6/3.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextKeyboardManager.h\"\n#import \"YYTextUtilities.h\"\n#import <objc/runtime.h>\n\n\nstatic int _YYTextKeyboardViewFrameObserverKey;\n\n/// Observer for view's frame/bounds/center/transform\n@interface _YYTextKeyboardViewFrameObserver : NSObject\n@property (nonatomic, copy) void (^notifyBlock)(UIView *keyboard);\n- (void)addToKeyboardView:(UIView *)keyboardView;\n+ (instancetype)observerForView:(UIView *)keyboardView;\n@end\n\n\n@implementation _YYTextKeyboardViewFrameObserver {\n    __unsafe_unretained UIView *_keyboardView;\n}\n- (void)addToKeyboardView:(UIView *)keyboardView {\n    if (_keyboardView == keyboardView) return;\n    if (_keyboardView) {\n        [self removeFrameObserver];\n        objc_setAssociatedObject(_keyboardView, &_YYTextKeyboardViewFrameObserverKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n    }\n    _keyboardView = keyboardView;\n    if (keyboardView) {\n        [self addFrameObserver];\n    }\n    objc_setAssociatedObject(keyboardView, &_YYTextKeyboardViewFrameObserverKey, self, OBJC_ASSOCIATION_RETAIN_NONATOMIC);\n}\n\n- (void)removeFrameObserver {\n    [_keyboardView removeObserver:self forKeyPath:@\"frame\"];\n    [_keyboardView removeObserver:self forKeyPath:@\"center\"];\n    [_keyboardView removeObserver:self forKeyPath:@\"bounds\"];\n    [_keyboardView removeObserver:self forKeyPath:@\"transform\"];\n    _keyboardView = nil;\n}\n\n- (void)addFrameObserver {\n    if (!_keyboardView) return;\n    [_keyboardView addObserver:self forKeyPath:@\"frame\" options:kNilOptions context:NULL];\n    [_keyboardView addObserver:self forKeyPath:@\"center\" options:kNilOptions context:NULL];\n    [_keyboardView addObserver:self forKeyPath:@\"bounds\" options:kNilOptions context:NULL];\n    [_keyboardView addObserver:self forKeyPath:@\"transform\" options:kNilOptions context:NULL];\n}\n\n- (void)dealloc {\n    [self removeFrameObserver];\n}\n\n+ (instancetype)observerForView:(UIView *)keyboardView {\n    if (!keyboardView) return nil;\n    return objc_getAssociatedObject(keyboardView, &_YYTextKeyboardViewFrameObserverKey);\n}\n\n- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {\n    \n    BOOL isPrior = [[change objectForKey:NSKeyValueChangeNotificationIsPriorKey] boolValue];\n    if (isPrior) return;\n    \n    NSKeyValueChange changeKind = [[change objectForKey:NSKeyValueChangeKindKey] integerValue];\n    if (changeKind != NSKeyValueChangeSetting) return;\n    \n    id newVal = [change objectForKey:NSKeyValueChangeNewKey];\n    if (newVal == [NSNull null]) newVal = nil;\n    \n    if (_notifyBlock) {\n        _notifyBlock(_keyboardView);\n    }\n}\n\n@end\n\n\n\n@implementation YYTextKeyboardManager {\n    NSHashTable *_observers;\n    \n    CGRect _fromFrame;\n    BOOL _fromVisible;\n    UIInterfaceOrientation _fromOrientation;\n    \n    CGRect _notificationFromFrame;\n    CGRect _notificationToFrame;\n    NSTimeInterval _notificationDuration;\n    UIViewAnimationCurve _notificationCurve;\n    BOOL _hasNotification;\n    \n    CGRect _observedToFrame;\n    BOOL _hasObservedChange;\n    \n    BOOL _lastIsNotification;\n}\n\n- (instancetype)init {\n    @throw [NSException exceptionWithName:@\"YYTextKeyboardManager init error\" reason:@\"Use 'defaultManager' to get instance.\" userInfo:nil];\n    return [super init];\n}\n\n- (instancetype)_init {\n    self = [super init];\n    _observers = [[NSHashTable alloc] initWithOptions:NSPointerFunctionsWeakMemory|NSPointerFunctionsObjectPointerPersonality capacity:0];\n    [[NSNotificationCenter defaultCenter] addObserver:self\n                                             selector:@selector(_keyboardFrameWillChangeNotification:)\n                                                 name:UIKeyboardWillChangeFrameNotification\n                                               object:nil];\n    // for iPad (iOS 9)\n    if ([UIDevice currentDevice].systemVersion.floatValue >= 9) {\n        [[NSNotificationCenter defaultCenter] addObserver:self\n                                                 selector:@selector(_keyboardFrameDidChangeNotification:)\n                                                     name:UIKeyboardDidChangeFrameNotification\n                                                   object:nil];\n    }\n    return self;\n}\n\n- (void)_initFrameObserver {\n    UIView *keyboardView = self.keyboardView;\n    if (!keyboardView) return;\n    __weak typeof(self) _self = self;\n    _YYTextKeyboardViewFrameObserver *observer = [_YYTextKeyboardViewFrameObserver observerForView:keyboardView];\n    if (!observer) {\n        observer = [_YYTextKeyboardViewFrameObserver new];\n        observer.notifyBlock = ^(UIView *keyboard) {\n            [_self _keyboardFrameChanged:keyboard];\n        };\n        [observer addToKeyboardView:keyboardView];\n    }\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\n}\n\n+ (instancetype)defaultManager {\n    static YYTextKeyboardManager *mgr = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        if (!YYTextIsAppExtension()) {\n            mgr = [[self alloc] _init];\n        }\n    });\n    return mgr;\n}\n\n+ (void)load {\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        [self defaultManager];\n    });\n}\n\n- (void)addObserver:(id<YYTextKeyboardObserver>)observer {\n    if (!observer) return;\n    [_observers addObject:observer];\n}\n\n- (void)removeObserver:(id<YYTextKeyboardObserver>)observer {\n    if (!observer) return;\n    [_observers removeObject:observer];\n}\n\n- (UIWindow *)keyboardWindow {\n    UIApplication *app = YYTextSharedApplication();\n    if (!app) return nil;\n    \n    UIWindow *window = nil;\n    for (window in app.windows) {\n        if ([self _getKeyboardViewFromWindow:window]) return window;\n    }\n    window = app.keyWindow;\n    if ([self _getKeyboardViewFromWindow:window]) return window;\n    \n    NSMutableArray *kbWindows = nil;\n    for (window in app.windows) {\n        NSString *windowName = NSStringFromClass(window.class);\n        if ([self _systemVersion] < 9) {\n            // UITextEffectsWindow\n            if (windowName.length == 19 &&\n                [windowName hasPrefix:@\"UI\"] &&\n                [windowName hasSuffix:@\"TextEffectsWindow\"]) {\n                if (!kbWindows) kbWindows = [NSMutableArray new];\n                [kbWindows addObject:window];\n            }\n        } else {\n            // UIRemoteKeyboardWindow\n            if (windowName.length == 22 &&\n                [windowName hasPrefix:@\"UI\"] &&\n                [windowName hasSuffix:@\"RemoteKeyboardWindow\"]) {\n                if (!kbWindows) kbWindows = [NSMutableArray new];\n                [kbWindows addObject:window];\n            }\n        }\n    }\n    \n    if (kbWindows.count == 1) {\n        return kbWindows.firstObject;\n    }\n    return nil;\n}\n\n- (UIView *)keyboardView {\n    UIApplication *app = YYTextSharedApplication();\n    if (!app) return nil;\n    \n    UIWindow *window = nil;\n    UIView *view = nil;\n    for (window in app.windows) {\n        view = [self _getKeyboardViewFromWindow:window];\n        if (view) return view;\n    }\n    window = app.keyWindow;\n    view = [self _getKeyboardViewFromWindow:window];\n    if (view) return view;\n    return nil;\n}\n\n- (BOOL)isKeyboardVisible {\n    UIWindow *window = self.keyboardWindow;\n    if (!window) return NO;\n    UIView *view = self.keyboardView;\n    if (!view) return NO;\n    CGRect rect = CGRectIntersection(window.bounds, view.frame);\n    if (CGRectIsNull(rect)) return NO;\n    if (CGRectIsInfinite(rect)) return NO;\n    return rect.size.width > 0 && rect.size.height > 0;\n}\n\n- (CGRect)keyboardFrame {\n    UIView *keyboard = [self keyboardView];\n    if (!keyboard) return CGRectNull;\n    \n    CGRect frame = CGRectNull;\n    UIWindow *window = keyboard.window;\n    if (window) {\n        frame = [window convertRect:keyboard.frame toWindow:nil];\n    } else {\n        frame = keyboard.frame;\n    }\n    return frame;\n}\n\n#pragma mark - private\n\n- (double)_systemVersion {\n    static double v;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        v = [UIDevice currentDevice].systemVersion.doubleValue;\n    });\n    return v;\n}\n\n- (UIView *)_getKeyboardViewFromWindow:(UIWindow *)window {\n    /*\n     iOS 6/7:\n     UITextEffectsWindow\n        UIPeripheralHostView << keyboard\n     \n     iOS 8:\n     UITextEffectsWindow\n        UIInputSetContainerView\n            UIInputSetHostView << keyboard\n     \n     iOS 9:\n     UIRemoteKeyboardWindow\n        UIInputSetContainerView\n            UIInputSetHostView << keyboard\n     */\n    if (!window) return nil;\n    \n    // Get the window\n    NSString *windowName = NSStringFromClass(window.class);\n    if ([self _systemVersion] < 9) {\n        // UITextEffectsWindow\n        if (windowName.length != 19) return nil;\n        if (![windowName hasPrefix:@\"UI\"]) return nil;\n        if (![windowName hasSuffix:@\"TextEffectsWindow\"]) return nil;\n    } else {\n        // UIRemoteKeyboardWindow\n        if (windowName.length != 22) return nil;\n        if (![windowName hasPrefix:@\"UI\"]) return nil;\n        if (![windowName hasSuffix:@\"RemoteKeyboardWindow\"]) return nil;\n    }\n    \n    // Get the view\n    if ([self _systemVersion] < 8) {\n        // UIPeripheralHostView\n        for (UIView *view in window.subviews) {\n            NSString *viewName = NSStringFromClass(view.class);\n            if (viewName.length != 20) continue;\n            if (![viewName hasPrefix:@\"UI\"]) continue;\n            if (![viewName hasSuffix:@\"PeripheralHostView\"]) continue;\n            return view;\n        }\n    } else {\n        // UIInputSetContainerView\n        for (UIView *view in window.subviews) {\n            NSString *viewName = NSStringFromClass(view.class);\n            if (viewName.length != 23) continue;\n            if (![viewName hasPrefix:@\"UI\"]) continue;\n            if (![viewName hasSuffix:@\"InputSetContainerView\"]) continue;\n            // UIInputSetHostView\n            for (UIView *subView in view.subviews) {\n                NSString *subViewName = NSStringFromClass(subView.class);\n                if (subViewName.length != 18) continue;\n                if (![subViewName hasPrefix:@\"UI\"]) continue;\n                if (![subViewName hasSuffix:@\"InputSetHostView\"]) continue;\n                return subView;\n            }\n        }\n    }\n    \n    return nil;\n}\n\n- (void)_keyboardFrameWillChangeNotification:(NSNotification *)notif {\n    if (![notif.name isEqualToString:UIKeyboardWillChangeFrameNotification]) return;\n    NSDictionary *info = notif.userInfo;\n    if (!info) return;\n    \n    [self _initFrameObserver];\n    \n    NSValue *beforeValue = info[UIKeyboardFrameBeginUserInfoKey];\n    NSValue *afterValue = info[UIKeyboardFrameEndUserInfoKey];\n    NSNumber *curveNumber = info[UIKeyboardAnimationCurveUserInfoKey];\n    NSNumber *durationNumber = info[UIKeyboardAnimationDurationUserInfoKey];\n    \n    CGRect before = beforeValue.CGRectValue;\n    CGRect after = afterValue.CGRectValue;\n    UIViewAnimationCurve curve = curveNumber.integerValue;\n    NSTimeInterval duration = durationNumber.doubleValue;\n    \n    // ignore zero end frame\n    if (after.size.width <= 0 && after.size.height <= 0) return;\n    \n    _notificationFromFrame = before;\n    _notificationToFrame = after;\n    _notificationCurve = curve;\n    _notificationDuration = duration;\n    _hasNotification = YES;\n    _lastIsNotification = YES;\n    \n    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_notifyAllObservers) object:nil];\n    if (duration == 0) {\n        [self performSelector:@selector(_notifyAllObservers) withObject:nil afterDelay:0 inModes:@[NSRunLoopCommonModes]];\n    } else {\n        [self _notifyAllObservers];\n    }\n}\n\n- (void)_keyboardFrameDidChangeNotification:(NSNotification *)notif {\n    if (![notif.name isEqualToString:UIKeyboardDidChangeFrameNotification]) return;\n    NSDictionary *info = notif.userInfo;\n    if (!info) return;\n    \n    [self _initFrameObserver];\n    \n    NSValue *afterValue = info[UIKeyboardFrameEndUserInfoKey];\n    CGRect after = afterValue.CGRectValue;\n    \n    // ignore zero end frame\n    if (after.size.width <= 0 && after.size.height <= 0) return;\n    \n    _notificationToFrame = after;\n    _notificationCurve = UIViewAnimationCurveEaseInOut;\n    _notificationDuration = 0;\n    _hasNotification = YES;\n    _lastIsNotification = YES;\n    \n    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_notifyAllObservers) object:nil];\n    [self performSelector:@selector(_notifyAllObservers) withObject:nil afterDelay:0 inModes:@[NSRunLoopCommonModes]];\n}\n\n- (void)_keyboardFrameChanged:(UIView *)keyboard {\n    if (keyboard != self.keyboardView) return;\n    \n    UIWindow *window = keyboard.window;\n    if (window) {\n        _observedToFrame = [window convertRect:keyboard.frame toWindow:nil];\n    } else {\n        _observedToFrame = keyboard.frame;\n    }\n    _hasObservedChange = YES;\n    _lastIsNotification = NO;\n    \n    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_notifyAllObservers) object:nil];\n    [self performSelector:@selector(_notifyAllObservers) withObject:nil afterDelay:0 inModes:@[NSRunLoopCommonModes]];\n}\n\n- (void)_notifyAllObservers {\n    UIApplication *app = YYTextSharedApplication();\n    if (!app) return;\n    \n    UIView *keyboard = self.keyboardView;\n    UIWindow *window = keyboard.window;\n    if (!window) {\n        window = app.keyWindow;\n    }\n    if (!window) {\n        window = app.windows.firstObject;\n    }\n    \n    YYTextKeyboardTransition trans = {0};\n    \n    // from\n    if (_fromFrame.size.width == 0 && _fromFrame.size.height == 0) { // first notify\n        _fromFrame.size.width = window.bounds.size.width;\n        _fromFrame.size.height = trans.toFrame.size.height;\n        _fromFrame.origin.x = trans.toFrame.origin.x;\n        _fromFrame.origin.y = window.bounds.size.height;\n    }\n    trans.fromFrame = _fromFrame;\n    trans.fromVisible = _fromVisible;\n    \n    // to\n    if (_lastIsNotification || (_hasObservedChange && CGRectEqualToRect(_observedToFrame, _notificationToFrame))) {\n        trans.toFrame = _notificationToFrame;\n        trans.animationDuration = _notificationDuration;\n        trans.animationCurve = _notificationCurve;\n        trans.animationOption = _notificationCurve << 16;\n        \n        // Fix iPad(iOS7) keyboard frame error after rorate device when the keyboard is not docked to bottom.\n        if (((int)[self _systemVersion]) == 7) {\n            UIInterfaceOrientation ori = app.statusBarOrientation;\n            if (_fromOrientation != UIInterfaceOrientationUnknown && _fromOrientation != ori) {\n                switch (ori) {\n                    case UIInterfaceOrientationPortrait: {\n                        if (CGRectGetMaxY(trans.toFrame) != window.frame.size.height) {\n                            trans.toFrame.origin.y -= trans.toFrame.size.height;\n                        }\n                    } break;\n                    case UIInterfaceOrientationPortraitUpsideDown: {\n                        if (CGRectGetMinY(trans.toFrame) != 0) {\n                            trans.toFrame.origin.y += trans.toFrame.size.height;\n                        }\n                    } break;\n                    case UIInterfaceOrientationLandscapeLeft: {\n                        if (CGRectGetMaxX(trans.toFrame) != window.frame.size.width) {\n                            trans.toFrame.origin.x -= trans.toFrame.size.width;\n                        }\n                    } break;\n                    case UIInterfaceOrientationLandscapeRight: {\n                        if (CGRectGetMinX(trans.toFrame) != 0) {\n                            trans.toFrame.origin.x += trans.toFrame.size.width;\n                        }\n                    } break;\n                    default: break;\n                }\n            }\n        }\n    } else {\n        trans.toFrame = _observedToFrame;\n    }\n    \n    if (window && trans.toFrame.size.width > 0 && trans.toFrame.size.height > 0) {\n        CGRect rect = CGRectIntersection(window.bounds, trans.toFrame);\n        if (!CGRectIsNull(rect) && !CGRectIsEmpty(rect)) {\n            trans.toVisible = YES;\n        }\n    }\n    \n    if (!CGRectEqualToRect(trans.toFrame, _fromFrame)) {\n        for (id<YYTextKeyboardObserver> observer in _observers.copy) {\n            if ([observer respondsToSelector:@selector(keyboardChangedWithTransition:)]) {\n                [observer keyboardChangedWithTransition:trans];\n            }\n        }\n    }\n    \n    _hasNotification = NO;\n    _hasObservedChange = NO;\n    _fromFrame = trans.toFrame;\n    _fromVisible = trans.toVisible;\n    _fromOrientation = app.statusBarOrientation;\n}\n\n- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view {\n    UIApplication *app = YYTextSharedApplication();\n    if (!app) return CGRectZero;\n    \n    if (CGRectIsNull(rect)) return rect;\n    if (CGRectIsInfinite(rect)) return rect;\n    \n    UIWindow *mainWindow = app.keyWindow;\n    if (!mainWindow) mainWindow = app.windows.firstObject;\n    if (!mainWindow) { // no window ?!\n        if (view) {\n            [view convertRect:rect fromView:nil];\n        } else {\n            return rect;\n        }\n    }\n    \n    rect = [mainWindow convertRect:rect fromWindow:nil];\n    if (!view) return [mainWindow convertRect:rect toWindow:nil];\n    if (view == mainWindow) return rect;\n    \n    UIWindow *toWindow = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;\n    if (!mainWindow || !toWindow) return [mainWindow convertRect:rect toView:view];\n    if (mainWindow == toWindow) return [mainWindow convertRect:rect toView:view];\n    \n    // in different window\n    rect = [mainWindow convertRect:rect toView:mainWindow];\n    rect = [toWindow convertRect:rect fromWindow:mainWindow];\n    rect = [view convertRect:rect fromView:toWindow];\n    return rect;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextLayout.h",
    "content": "//\n//  YYTextLayout.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/3.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n#import <CoreText/CoreText.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextDebugOption.h>\n#import <YYText/YYTextLine.h>\n#import <YYText/YYTextInput.h>\n#else\n#import \"YYTextDebugOption.h\"\n#import \"YYTextLine.h\"\n#import \"YYTextInput.h\"\n#endif\n\n@protocol YYTextLinePositionModifier;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The max text container size in layout.\n */\nextern const CGSize YYTextContainerMaxSize;\n\n/**\n The YYTextContainer class defines a region in which text is laid out.\n YYTextLayout class uses one or more YYTextContainer objects to generate layouts.\n \n A YYTextContainer defines rectangular regions (`size` and `insets`) or \n nonrectangular shapes (`path`), and you can define exclusion paths inside the \n text container's bounding rectangle so that text flows around the exclusion \n path as it is laid out.\n \n All methods in this class is thread-safe.\n \n Example:\n \n     ┌─────────────────────────────┐  <------- container\n     │                             │\n     │    asdfasdfasdfasdfasdfa   <------------ container insets\n     │    asdfasdfa   asdfasdfa    │\n     │    asdfas         asdasd    │\n     │    asdfa        <----------------------- container exclusion path\n     │    asdfas         adfasd    │\n     │    asdfasdfa   asdfasdfa    │\n     │    asdfasdfasdfasdfasdfa    │\n     │                             │\n     └─────────────────────────────┘\n */\n@interface YYTextContainer : NSObject <NSCoding, NSCopying>\n\n/// Creates a container with the specified size. @param size The size.\n+ (instancetype)containerWithSize:(CGSize)size;\n\n/// Creates a container with the specified size and insets. @param size The size. @param insets The text insets.\n+ (instancetype)containerWithSize:(CGSize)size insets:(UIEdgeInsets)insets;\n\n/// Creates a container with the specified path. @param size The path.\n+ (instancetype)containerWithPath:(nullable UIBezierPath *)path;\n\n/// The constrained size. (if the size is larger than YYTextContainerMaxSize, it will be clipped)\n@property CGSize size;\n\n/// The insets for constrained size. The inset value should not be negative. Default is UIEdgeInsetsZero.\n@property UIEdgeInsets insets;\n\n/// Custom constrained path. Set this property to ignore `size` and `insets`. Default is nil.\n@property (nullable, copy) UIBezierPath *path;\n\n/// An array of `UIBezierPath` for path exclusion. Default is nil.\n@property (nullable, copy) NSArray<UIBezierPath *> *exclusionPaths;\n\n/// Path line width. Default is 0;\n@property CGFloat pathLineWidth;\n\n/// YES:(PathFillEvenOdd) Text is filled in the area that would be painted if the path were given to CGContextEOFillPath.\n/// NO: (PathFillWindingNumber) Text is fill in the area that would be painted if the path were given to CGContextFillPath.\n/// Default is YES;\n@property (getter=isPathFillEvenOdd) BOOL pathFillEvenOdd;\n\n/// Whether the text is vertical form (may used for CJK text layout). Default is NO.\n@property (getter=isVerticalForm) BOOL verticalForm;\n\n/// Maximum number of rows, 0 means no limit. Default is 0.\n@property NSUInteger maximumNumberOfRows;\n\n/// The line truncation type, default is none.\n@property YYTextTruncationType truncationType;\n\n/// The truncation token. If nil, the layout will use \"…\" instead. Default is nil.\n@property (nullable, copy) NSAttributedString *truncationToken;\n\n/// This modifier is applied to the lines before the layout is completed,\n/// give you a chance to modify the line position. Default is nil.\n@property (nullable, copy) id<YYTextLinePositionModifier> linePositionModifier;\n@end\n\n\n/**\n The YYTextLinePositionModifier protocol declares the required method to modify\n the line position in text layout progress. See `YYTextLinePositionSimpleModifier` for example.\n */\n@protocol YYTextLinePositionModifier <NSObject, NSCopying>\n@required\n/**\n This method will called before layout is completed. The method should be thread-safe.\n @param lines     An array of YYTextLine.\n @param text      The full text.\n @param container The layout container.\n */\n- (void)modifyLines:(NSArray<YYTextLine *> *)lines fromText:(NSAttributedString *)text inContainer:(YYTextContainer *)container;\n@end\n\n\n/**\n A simple implementation of `YYTextLinePositionModifier`. It can fix each line's position\n to a specified value, lets each line of height be the same.\n */\n@interface YYTextLinePositionSimpleModifier : NSObject <YYTextLinePositionModifier>\n@property (assign) CGFloat fixedLineHeight; ///< The fixed line height (distance between two baseline).\n@end\n\n\n\n/**\n YYTextLayout class is a readonly class stores text layout result.\n All the property in this class is readonly, and should not be changed.\n The methods in this class is thread-safe (except some of the draw methods).\n \n example: (layout with a circle exclusion path)\n \n     ┌──────────────────────────┐  <------ container\n     │ [--------Line0--------]  │  <- Row0\n     │ [--------Line1--------]  │  <- Row1\n     │ [-Line2-]     [-Line3-]  │  <- Row2\n     │ [-Line4]       [Line5-]  │  <- Row3\n     │ [-Line6-]     [-Line7-]  │  <- Row4\n     │ [--------Line8--------]  │  <- Row5\n     │ [--------Line9--------]  │  <- Row6\n     └──────────────────────────┘\n */\n@interface YYTextLayout : NSObject <NSCoding>\n\n\n#pragma mark - Generate text layout\n///=============================================================================\n/// @name Generate text layout\n///=============================================================================\n\n/**\n Generate a layout with the given container size and text.\n\n @param size The text container's size\n @param text The text (if nil, returns nil).\n @return A new layout, or nil when an error occurs.\n*/\n+ (nullable YYTextLayout *)layoutWithContainerSize:(CGSize)size text:(NSAttributedString *)text;\n\n/**\n Generate a layout with the given container and text.\n \n @param container The text container (if nil, returns nil).\n @param text      The text (if nil, returns nil).\n @return A new layout, or nil when an error occurs.\n */\n+ (nullable YYTextLayout *)layoutWithContainer:(YYTextContainer *)container text:(NSAttributedString *)text;\n\n/**\n Generate a layout with the given container and text.\n \n @param container The text container (if nil, returns nil).\n @param text      The text (if nil, returns nil).\n @param range     The text range (if out of range, returns nil). If the\n    length of the range is 0, it means the length is no limit.\n @return A new layout, or nil when an error occurs.\n */\n+ (nullable YYTextLayout *)layoutWithContainer:(YYTextContainer *)container text:(NSAttributedString *)text range:(NSRange)range;\n\n/**\n Generate layouts with the given containers and text.\n \n @param containers An array of YYTextContainer object (if nil, returns nil).\n @param text       The text (if nil, returns nil).\n @return An array of YYTextLayout object (the count is same as containers),\n    or nil when an error occurs.\n */\n+ (nullable NSArray<YYTextLayout *> *)layoutWithContainers:(NSArray<YYTextContainer *> *)containers\n                                                      text:(NSAttributedString *)text;\n\n/**\n Generate layouts with the given containers and text.\n \n @param containers An array of YYTextContainer object (if nil, returns nil).\n @param text       The text (if nil, returns nil).\n @param range      The text range (if out of range, returns nil). If the\n    length of the range is 0, it means the length is no limit.\n @return An array of YYTextLayout object (the count is same as containers),\n    or nil when an error occurs.\n */\n+ (nullable NSArray<YYTextLayout *> *)layoutWithContainers:(NSArray<YYTextContainer *> *)containers\n                                                      text:(NSAttributedString *)text\n                                                     range:(NSRange)range;\n\n- (instancetype)init UNAVAILABLE_ATTRIBUTE;\n+ (instancetype)new UNAVAILABLE_ATTRIBUTE;\n\n\n#pragma mark - Text layout attributes\n///=============================================================================\n/// @name Text layout attributes\n///=============================================================================\n\n///< The text container\n@property (nonatomic, strong, readonly) YYTextContainer *container;\n///< The full text\n@property (nonatomic, strong, readonly) NSAttributedString *text;\n///< The text range in full text\n@property (nonatomic, readonly) NSRange range;\n///< CTFrameSetter\n@property (nonatomic, readonly) CTFramesetterRef frameSetter;\n///< CTFrame\n@property (nonatomic, readonly) CTFrameRef frame;\n///< Array of `YYTextLine`, no truncated\n@property (nonatomic, strong, readonly) NSArray<YYTextLine *> *lines;\n///< YYTextLine with truncated token, or nil\n@property (nullable, nonatomic, strong, readonly) YYTextLine *truncatedLine;\n///< Array of `YYTextAttachment`\n@property (nullable, nonatomic, strong, readonly) NSArray<YYTextAttachment *> *attachments;\n///< Array of NSRange(wrapped by NSValue) in text\n@property (nullable, nonatomic, strong, readonly) NSArray<NSValue *> *attachmentRanges;\n///< Array of CGRect(wrapped by NSValue) in container\n@property (nullable, nonatomic, strong, readonly) NSArray<NSValue *> *attachmentRects;\n///< Set of Attachment (UIImage/UIView/CALayer)\n@property (nullable, nonatomic, strong, readonly) NSSet *attachmentContentsSet;\n///< Number of rows\n@property (nonatomic, readonly) NSUInteger rowCount;\n///< Visible text range\n@property (nonatomic, readonly) NSRange visibleRange;\n///< Bounding rect (glyphs)\n@property (nonatomic, readonly) CGRect textBoundingRect;\n///< Bounding size (glyphs and insets, ceil to pixel)\n@property (nonatomic, readonly) CGSize textBoundingSize;\n///< Has highlight attribute\n@property (nonatomic, readonly) BOOL containsHighlight;\n///< Has block border attribute\n@property (nonatomic, readonly) BOOL needDrawBlockBorder;\n///< Has background border attribute\n@property (nonatomic, readonly) BOOL needDrawBackgroundBorder;\n///< Has shadow attribute\n@property (nonatomic, readonly) BOOL needDrawShadow;\n///< Has underline attribute\n@property (nonatomic, readonly) BOOL needDrawUnderline;\n///< Has visible text\n@property (nonatomic, readonly) BOOL needDrawText;\n///< Has attachment attribute\n@property (nonatomic, readonly) BOOL needDrawAttachment;\n///< Has inner shadow attribute\n@property (nonatomic, readonly) BOOL needDrawInnerShadow;\n///< Has strickthrough attribute\n@property (nonatomic, readonly) BOOL needDrawStrikethrough;\n///< Has border attribute\n@property (nonatomic, readonly) BOOL needDrawBorder;\n\n\n#pragma mark - Query information from text layout\n///=============================================================================\n/// @name Query information from text layout\n///=============================================================================\n\n/**\n The first line index for row.\n \n @param row  A row index.\n @return The line index, or NSNotFound if not found.\n */\n- (NSUInteger)lineIndexForRow:(NSUInteger)row;\n\n/**\n The number of lines for row.\n \n @param row  A row index.\n @return The number of lines, or NSNotFound when an error occurs.\n */\n- (NSUInteger)lineCountForRow:(NSUInteger)row;\n\n/**\n The row index for line.\n \n @param line A row index.\n \n @return The row index, or NSNotFound if not found.\n */\n- (NSUInteger)rowIndexForLine:(NSUInteger)line;\n\n/**\n The line index for a specified point.\n \n @discussion It returns NSNotFound if there's no text at the point.\n \n @param point  A point in the container.\n @return The line index, or NSNotFound if not found.\n */\n- (NSUInteger)lineIndexForPoint:(CGPoint)point;\n\n/**\n The line index closest to a specified point.\n \n @param point  A point in the container.\n @return The line index, or NSNotFound if no line exist in layout.\n */\n- (NSUInteger)closestLineIndexForPoint:(CGPoint)point;\n\n/**\n The offset in container for a text position in a specified line.\n \n @discussion The offset is the text position's baseline point.x.\n If the container is vertical form, the offset is the baseline point.y;\n \n @param position   The text position in string.\n @param lineIndex  The line index.\n @return The offset in container, or CGFLOAT_MAX if not found.\n */\n- (CGFloat)offsetForTextPosition:(NSUInteger)position lineIndex:(NSUInteger)lineIndex;\n\n/**\n The text position for a point in a specified line.\n \n @discussion This method just call CTLineGetStringIndexForPosition() and does \n NOT consider the emoji, line break character, binding text...\n \n @param point      A point in the container.\n @param lineIndex  The line index.\n @return The text position, or NSNotFound if not found.\n */\n- (NSUInteger)textPositionForPoint:(CGPoint)point lineIndex:(NSUInteger)lineIndex;\n\n/**\n The closest text position to a specified point.\n \n @discussion This method takes into account the restrict of emoji, line break \n character, binding text and text affinity.\n \n @param point  A point in the container.\n @return A text position, or nil if not found.\n */\n- (nullable YYTextPosition *)closestPositionToPoint:(CGPoint)point;\n\n/**\n Returns the new position when moving selection grabber in text view.\n \n @discussion There are two grabber in the text selection period, user can only \n move one grabber at the same time.\n \n @param point          A point in the container.\n @param oldPosition    The old text position for the moving grabber.\n @param otherPosition  The other position in text selection view.\n \n @return A text position, or nil if not found.\n */\n- (nullable YYTextPosition *)positionForPoint:(CGPoint)point\n                                  oldPosition:(YYTextPosition *)oldPosition\n                                otherPosition:(YYTextPosition *)otherPosition;\n\n/**\n Returns the character or range of characters that is at a given point in the container.\n If there is no text at the point, returns nil.\n \n @discussion This method takes into account the restrict of emoji, line break\n character, binding text and text affinity.\n \n @param point  A point in the container.\n @return An object representing a range that encloses a character (or characters) \n at point. Or nil if not found.\n */\n- (nullable YYTextRange *)textRangeAtPoint:(CGPoint)point;\n\n/**\n Returns the closest character or range of characters that is at a given point in \n the container.\n \n @discussion This method takes into account the restrict of emoji, line break\n character, binding text and text affinity.\n \n @param point  A point in the container.\n @return An object representing a range that encloses a character (or characters)\n at point. Or nil if not found.\n */\n- (nullable YYTextRange *)closestTextRangeAtPoint:(CGPoint)point;\n\n/**\n If the position is inside an emoji, composed character sequences, line break '\\\\r\\\\n'\n or custom binding range, then returns the range by extend the position. Otherwise,\n returns a zero length range from the position.\n \n @param position A text-position object that identifies a location in layout.\n \n @return A text-range object that extend the position. Or nil if an error occurs\n */\n- (nullable YYTextRange *)textRangeByExtendingPosition:(YYTextPosition *)position;\n\n/**\n Returns a text range at a given offset in a specified direction from another \n text position to its farthest extent in a certain direction of layout.\n \n @param position  A text-position object that identifies a location in layout.\n @param direction A constant that indicates a direction of layout (right, left, up, down).\n @param offset    A character offset from position.\n \n @return A text-range object that represents the distance from position to the\n farthest extent in direction. Or nil if an error occurs.\n */\n- (nullable YYTextRange *)textRangeByExtendingPosition:(YYTextPosition *)position\n                                           inDirection:(UITextLayoutDirection)direction\n                                                offset:(NSInteger)offset;\n\n/**\n Returns the line index for a given text position.\n \n @discussion This method takes into account the text affinity.\n \n @param position A text-position object that identifies a location in layout.\n @return The line index, or NSNotFound if not found.\n */\n- (NSUInteger)lineIndexForPosition:(YYTextPosition *)position;\n\n/**\n Returns the baseline position for a given text position.\n \n @param position An object that identifies a location in the layout.\n @return The baseline position for text, or CGPointZero if not found.\n */\n- (CGPoint)linePositionForPosition:(YYTextPosition *)position;\n\n/**\n Returns a rectangle used to draw the caret at a given insertion point.\n \n @param position An object that identifies a location in the layout.\n @return A rectangle that defines the area for drawing the caret. The width is\n always zero in normal container, the height is always zero in vertical form container.\n If not found, it returns CGRectNull.\n */\n- (CGRect)caretRectForPosition:(YYTextPosition *)position;\n\n/**\n Returns the first rectangle that encloses a range of text in the layout.\n \n @param range An object that represents a range of text in layout.\n \n @return The first rectangle in a range of text. You might use this rectangle to \n draw a correction rectangle. The \"first\" in the name refers the rectangle \n enclosing the first line when the range encompasses multiple lines of text.\n If not found, it returns CGRectNull.\n */\n- (CGRect)firstRectForRange:(YYTextRange *)range;\n\n/**\n Returns the rectangle union that encloses a range of text in the layout.\n \n @param range An object that represents a range of text in layout.\n \n @return A rectangle that defines the area than encloses the range.\n If not found, it returns CGRectNull.\n */\n- (CGRect)rectForRange:(YYTextRange *)range;\n\n/**\n Returns an array of selection rects corresponding to the range of text.\n The start and end rect can be used to show grabber.\n \n @param range An object representing a range in text.\n @return An array of `YYTextSelectionRect` objects that encompass the selection.\n If not found, the array is empty.\n */\n- (NSArray<YYTextSelectionRect *> *)selectionRectsForRange:(YYTextRange *)range;\n\n/**\n Returns an array of selection rects corresponding to the range of text.\n \n @param range An object representing a range in text.\n @return An array of `YYTextSelectionRect` objects that encompass the selection.\n If not found, the array is empty.\n */\n- (NSArray<YYTextSelectionRect *> *)selectionRectsWithoutStartAndEndForRange:(YYTextRange *)range;\n\n/**\n Returns the start and end selection rects corresponding to the range of text.\n The start and end rect can be used to show grabber.\n \n @param range An object representing a range in text.\n @return An array of `YYTextSelectionRect` objects contains the start and end to\n the selection. If not found, the array is empty.\n */\n- (NSArray<YYTextSelectionRect *> *)selectionRectsWithOnlyStartAndEndForRange:(YYTextRange *)range;\n\n\n#pragma mark - Draw text layout\n///=============================================================================\n/// @name Draw text layout\n///=============================================================================\n\n/**\n Draw the layout and show the attachments.\n \n @discussion If the `view` parameter is not nil, then the attachment views will\n add to this `view`, and if the `layer` parameter is not nil, then the attachment\n layers will add to this `layer`. \n \n @warning This method should be called on main thread if `view` or `layer` parameter\n is not nil and there's UIView or CALayer attachments in layout. \n Otherwise, it can be called on any thread.\n \n @param context The draw context. Pass nil to avoid text and image drawing.\n @param size    The context size.\n @param point   The point at which to draw the layout.\n @param view    The attachment views will add to this view.\n @param layer   The attachment layers will add to this layer.\n @param debug   The debug option. Pass nil to avoid debug drawing.\n @param cancel  The cancel checker block. It will be called in drawing progress.\n                    If it returns YES, the further draw progress will be canceled.\n                    Pass nil to ignore this feature.\n */\n- (void)drawInContext:(nullable CGContextRef)context\n                 size:(CGSize)size\n                point:(CGPoint)point\n                 view:(nullable UIView *)view\n                layer:(nullable CALayer *)layer\n                debug:(nullable YYTextDebugOption *)debug\n               cancel:(nullable BOOL (^)(void))cancel;\n\n/**\n Draw the layout text and image (without view or layer attachments).\n \n @discussion This method is thread safe and can be called on any thread.\n \n @param context The draw context. Pass nil to avoid text and image drawing.\n @param size    The context size.\n @param debug   The debug option. Pass nil to avoid debug drawing.\n */\n- (void)drawInContext:(nullable CGContextRef)context\n                 size:(CGSize)size\n                debug:(nullable YYTextDebugOption *)debug;\n\n/**\n Show view and layer attachments.\n \n @warning This method must be called on main thread.\n \n @param view  The attachment views will add to this view.\n @param layer The attachment layers will add to this layer.\n */\n- (void)addAttachmentToView:(nullable UIView *)view layer:(nullable CALayer *)layer;\n\n/**\n Remove attachment views and layers from their super container.\n \n @warning This method must be called on main thread.\n */\n- (void)removeAttachmentFromViewAndLayer;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextLayout.m",
    "content": "//\n//  YYTextLayout.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/3.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextLayout.h\"\n#import \"YYTextUtilities.h\"\n#import \"YYTextAttribute.h\"\n#import \"YYTextArchiver.h\"\n#import \"NSAttributedString+YYText.h\"\n\nconst CGSize YYTextContainerMaxSize = (CGSize){0x100000, 0x100000};\n\ntypedef struct {\n    CGFloat head;\n    CGFloat foot;\n} YYRowEdge;\n\nstatic inline CGSize YYTextClipCGSize(CGSize size) {\n    if (size.width > YYTextContainerMaxSize.width) size.width = YYTextContainerMaxSize.width;\n    if (size.height > YYTextContainerMaxSize.height) size.height = YYTextContainerMaxSize.height;\n    return size;\n}\n\nstatic inline UIEdgeInsets UIEdgeInsetRotateVertical(UIEdgeInsets insets) {\n    UIEdgeInsets one;\n    one.top = insets.left;\n    one.left = insets.bottom;\n    one.bottom = insets.right;\n    one.right = insets.top;\n    return one;\n}\n\n/**\n Sometimes CoreText may convert CGColor to UIColor for `kCTForegroundColorAttributeName`\n attribute in iOS7. This should be a bug of CoreText, and may cause crash. Here's a workaround.\n */\nstatic CGColorRef YYTextGetCGColor(CGColorRef color) {\n    static UIColor *defaultColor;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        defaultColor = [UIColor blackColor];\n    });\n    if (!color) return defaultColor.CGColor;\n    if ([((__bridge NSObject *)color) respondsToSelector:@selector(CGColor)]) {\n        return ((__bridge UIColor *)color).CGColor;\n    }\n    return color;\n}\n\n@implementation YYTextLinePositionSimpleModifier\n- (void)modifyLines:(NSArray *)lines fromText:(NSAttributedString *)text inContainer:(YYTextContainer *)container {\n    if (container.verticalForm) {\n        for (NSUInteger i = 0, max = lines.count; i < max; i++) {\n            YYTextLine *line = lines[i];\n            CGPoint pos = line.position;\n            pos.x = container.size.width - container.insets.right - line.row * _fixedLineHeight - _fixedLineHeight * 0.9;\n            line.position = pos;\n        }\n    } else {\n        for (NSUInteger i = 0, max = lines.count; i < max; i++) {\n            YYTextLine *line = lines[i];\n            CGPoint pos = line.position;\n            pos.y = line.row * _fixedLineHeight + _fixedLineHeight * 0.9 + container.insets.top;\n            line.position = pos;\n        }\n    }\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    YYTextLinePositionSimpleModifier *one = [self.class new];\n    one.fixedLineHeight = _fixedLineHeight;\n    return one;\n}\n@end\n\n\n@implementation YYTextContainer {\n    @package\n    BOOL _readonly; ///< used only in YYTextLayout.implementation\n    dispatch_semaphore_t _lock;\n    \n    CGSize _size;\n    UIEdgeInsets _insets;\n    UIBezierPath *_path;\n    NSArray *_exclusionPaths;\n    BOOL _pathFillEvenOdd;\n    CGFloat _pathLineWidth;\n    BOOL _verticalForm;\n    NSUInteger _maximumNumberOfRows;\n    YYTextTruncationType _truncationType;\n    NSAttributedString *_truncationToken;\n    id<YYTextLinePositionModifier> _linePositionModifier;\n}\n\n+ (instancetype)containerWithSize:(CGSize)size {\n    return [self containerWithSize:size insets:UIEdgeInsetsZero];\n}\n\n+ (instancetype)containerWithSize:(CGSize)size insets:(UIEdgeInsets)insets {\n    YYTextContainer *one = [self new];\n    one.size = YYTextClipCGSize(size);\n    one.insets = insets;\n    return one;\n}\n\n+ (instancetype)containerWithPath:(UIBezierPath *)path {\n    YYTextContainer *one = [self new];\n    one.path = path;\n    return one;\n}\n\n- (instancetype)init {\n    self = [super init];\n    if (!self) return nil;\n    _lock = dispatch_semaphore_create(1);\n    _pathFillEvenOdd = YES;\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    YYTextContainer *one = [self.class new];\n    dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER);\n    one->_size = _size;\n    one->_insets = _insets;\n    one->_path = _path;\n    one->_exclusionPaths = _exclusionPaths.copy;\n    one->_pathFillEvenOdd = _pathFillEvenOdd;\n    one->_pathLineWidth = _pathLineWidth;\n    one->_verticalForm = _verticalForm;\n    one->_maximumNumberOfRows = _maximumNumberOfRows;\n    one->_truncationType = _truncationType;\n    one->_truncationToken = _truncationToken.copy;\n    one->_linePositionModifier = [(NSObject *)_linePositionModifier copy];\n    dispatch_semaphore_signal(_lock);\n    return one;\n}\n\n- (id)mutableCopyWithZone:(nullable NSZone *)zone {\n    return [self copyWithZone:zone];\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:[NSValue valueWithCGSize:_size] forKey:@\"size\"];\n    [aCoder encodeObject:[NSValue valueWithUIEdgeInsets:_insets] forKey:@\"insets\"];\n    [aCoder encodeObject:_path forKey:@\"path\"];\n    [aCoder encodeObject:_exclusionPaths forKey:@\"exclusionPaths\"];\n    [aCoder encodeBool:_pathFillEvenOdd forKey:@\"pathFillEvenOdd\"];\n    [aCoder encodeDouble:_pathLineWidth forKey:@\"pathLineWidth\"];\n    [aCoder encodeBool:_verticalForm forKey:@\"verticalForm\"];\n    [aCoder encodeInteger:_maximumNumberOfRows forKey:@\"maximumNumberOfRows\"];\n    [aCoder encodeInteger:_truncationType forKey:@\"truncationType\"];\n    [aCoder encodeObject:_truncationToken forKey:@\"truncationToken\"];\n    if ([_linePositionModifier respondsToSelector:@selector(encodeWithCoder:)] &&\n        [_linePositionModifier respondsToSelector:@selector(initWithCoder:)]) {\n        [aCoder encodeObject:_linePositionModifier forKey:@\"linePositionModifier\"];\n    }\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [self init];\n    _size = ((NSValue *)[aDecoder decodeObjectForKey:@\"size\"]).CGSizeValue;\n    _insets = ((NSValue *)[aDecoder decodeObjectForKey:@\"insets\"]).UIEdgeInsetsValue;\n    _path = [aDecoder decodeObjectForKey:@\"path\"];\n    _exclusionPaths = [aDecoder decodeObjectForKey:@\"exclusionPaths\"];\n    _pathFillEvenOdd = [aDecoder decodeBoolForKey:@\"pathFillEvenOdd\"];\n    _pathLineWidth = [aDecoder decodeDoubleForKey:@\"pathLineWidth\"];\n    _verticalForm = [aDecoder decodeBoolForKey:@\"verticalForm\"];\n    _maximumNumberOfRows = [aDecoder decodeIntegerForKey:@\"maximumNumberOfRows\"];\n    _truncationType = [aDecoder decodeIntegerForKey:@\"truncationType\"];\n    _truncationToken = [aDecoder decodeObjectForKey:@\"truncationToken\"];\n    _linePositionModifier = [aDecoder decodeObjectForKey:@\"linePositionModifier\"];\n    return self;\n}\n\n#define Getter(...) \\\ndispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \\\n__VA_ARGS__; \\\ndispatch_semaphore_signal(_lock);\n\n#define Setter(...) \\\nif (_readonly) { \\\n@throw [NSException exceptionWithName:NSInternalInconsistencyException \\\nreason:@\"Cannot change the property of the 'container' in 'YYTextLayout'.\" userInfo:nil]; \\\nreturn; \\\n} \\\ndispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \\\n__VA_ARGS__; \\\ndispatch_semaphore_signal(_lock);\n\n- (CGSize)size {\n    Getter(CGSize size = _size) return size;\n}\n\n- (void)setSize:(CGSize)size {\n    Setter(if(!_path) _size = YYTextClipCGSize(size));\n}\n\n- (UIEdgeInsets)insets {\n    Getter(UIEdgeInsets insets = _insets) return insets;\n}\n\n- (void)setInsets:(UIEdgeInsets)insets {\n    Setter(if(!_path){\n        if (insets.top < 0) insets.top = 0;\n        if (insets.left < 0) insets.left = 0;\n        if (insets.bottom < 0) insets.bottom = 0;\n        if (insets.right < 0) insets.right = 0;\n        _insets = insets;\n    });\n}\n\n- (UIBezierPath *)path {\n    Getter(UIBezierPath *path = _path) return path;\n}\n\n- (void)setPath:(UIBezierPath *)path {\n    Setter(\n           _path = path.copy;\n           if (_path) {\n               CGRect bounds = _path.bounds;\n               CGSize size = bounds.size;\n               UIEdgeInsets insets = UIEdgeInsetsZero;\n               if (bounds.origin.x < 0) size.width += bounds.origin.x;\n               if (bounds.origin.x > 0) insets.left = bounds.origin.x;\n               if (bounds.origin.y < 0) size.height += bounds.origin.y;\n               if (bounds.origin.y > 0) insets.top = bounds.origin.y;\n               _size = size;\n               _insets = insets;\n           }\n    );\n}\n\n- (NSArray *)exclusionPaths {\n    Getter(NSArray *paths = _exclusionPaths) return paths;\n}\n\n- (void)setExclusionPaths:(NSArray *)exclusionPaths {\n    Setter(_exclusionPaths = exclusionPaths.copy);\n}\n\n- (BOOL)isPathFillEvenOdd {\n    Getter(BOOL is = _pathFillEvenOdd) return is;\n}\n\n- (void)setPathFillEvenOdd:(BOOL)pathFillEvenOdd {\n    Setter(_pathFillEvenOdd = pathFillEvenOdd);\n}\n\n- (CGFloat)pathLineWidth {\n    Getter(CGFloat width = _pathLineWidth) return width;\n}\n\n- (void)setPathLineWidth:(CGFloat)pathLineWidth {\n    Setter(_pathLineWidth = pathLineWidth);\n}\n\n- (BOOL)isVerticalForm {\n    Getter(BOOL v = _verticalForm) return v;\n}\n\n- (void)setVerticalForm:(BOOL)verticalForm {\n    Setter(_verticalForm = verticalForm);\n}\n\n- (NSUInteger)maximumNumberOfRows {\n    Getter(NSUInteger num = _maximumNumberOfRows) return num;\n}\n\n- (void)setMaximumNumberOfRows:(NSUInteger)maximumNumberOfRows {\n    Setter(_maximumNumberOfRows = maximumNumberOfRows);\n}\n\n- (YYTextTruncationType)truncationType {\n    Getter(YYTextTruncationType type = _truncationType) return type;\n}\n\n- (void)setTruncationType:(YYTextTruncationType)truncationType {\n    Setter(_truncationType = truncationType);\n}\n\n- (NSAttributedString *)truncationToken {\n    Getter(NSAttributedString *token = _truncationToken) return token;\n}\n\n- (void)setTruncationToken:(NSAttributedString *)truncationToken {\n    Setter(_truncationToken = truncationToken.copy);\n}\n\n- (void)setLinePositionModifier:(id<YYTextLinePositionModifier>)linePositionModifier {\n    Setter(_linePositionModifier = [(NSObject *)linePositionModifier copy]);\n}\n\n- (id<YYTextLinePositionModifier>)linePositionModifier {\n    Getter(id<YYTextLinePositionModifier> m = _linePositionModifier) return m;\n}\n\n#undef Getter\n#undef Setter\n@end\n\n\n\n\n@interface YYTextLayout ()\n\n@property (nonatomic, readwrite) YYTextContainer *container;\n@property (nonatomic, readwrite) NSAttributedString *text;\n@property (nonatomic, readwrite) NSRange range;\n\n@property (nonatomic, readwrite) CTFramesetterRef frameSetter;\n@property (nonatomic, readwrite) CTFrameRef frame;\n@property (nonatomic, readwrite) NSArray *lines;\n@property (nonatomic, readwrite) YYTextLine *truncatedLine;\n@property (nonatomic, readwrite) NSArray *attachments;\n@property (nonatomic, readwrite) NSArray *attachmentRanges;\n@property (nonatomic, readwrite) NSArray *attachmentRects;\n@property (nonatomic, readwrite) NSSet *attachmentContentsSet;\n@property (nonatomic, readwrite) NSUInteger rowCount;\n@property (nonatomic, readwrite) NSRange visibleRange;\n@property (nonatomic, readwrite) CGRect textBoundingRect;\n@property (nonatomic, readwrite) CGSize textBoundingSize;\n\n@property (nonatomic, readwrite) BOOL containsHighlight;\n@property (nonatomic, readwrite) BOOL needDrawBlockBorder;\n@property (nonatomic, readwrite) BOOL needDrawBackgroundBorder;\n@property (nonatomic, readwrite) BOOL needDrawShadow;\n@property (nonatomic, readwrite) BOOL needDrawUnderline;\n@property (nonatomic, readwrite) BOOL needDrawText;\n@property (nonatomic, readwrite) BOOL needDrawAttachment;\n@property (nonatomic, readwrite) BOOL needDrawInnerShadow;\n@property (nonatomic, readwrite) BOOL needDrawStrikethrough;\n@property (nonatomic, readwrite) BOOL needDrawBorder;\n\n@property (nonatomic, assign) NSUInteger *lineRowsIndex;\n@property (nonatomic, assign) YYRowEdge *lineRowsEdge; ///< top-left origin\n\n@end\n\n\n\n@implementation YYTextLayout\n\n#pragma mark - Layout\n\n- (instancetype)_init {\n    self = [super init];\n    return self;\n}\n\n+ (YYTextLayout *)layoutWithContainerSize:(CGSize)size text:(NSAttributedString *)text {\n    YYTextContainer *container = [YYTextContainer containerWithSize:size];\n    return [self layoutWithContainer:container text:text];\n}\n\n+ (YYTextLayout *)layoutWithContainer:(YYTextContainer *)container text:(NSAttributedString *)text {\n    return [self layoutWithContainer:container text:text range:NSMakeRange(0, text.length)];\n}\n\n+ (YYTextLayout *)layoutWithContainer:(YYTextContainer *)container text:(NSAttributedString *)text range:(NSRange)range {\n    YYTextLayout *layout = NULL;\n    CGPathRef cgPath = nil;\n    CGRect cgPathBox = {0};\n    BOOL isVerticalForm = NO;\n    BOOL rowMaySeparated = NO;\n    NSMutableDictionary *frameAttrs = nil;\n    CTFramesetterRef ctSetter = NULL;\n    CTFrameRef ctFrame = NULL;\n    CFArrayRef ctLines = nil;\n    CGPoint *lineOrigins = NULL;\n    NSUInteger lineCount = 0;\n    NSMutableArray *lines = nil;\n    NSMutableArray *attachments = nil;\n    NSMutableArray *attachmentRanges = nil;\n    NSMutableArray *attachmentRects = nil;\n    NSMutableSet *attachmentContentsSet = nil;\n    BOOL needTruncation = NO;\n    NSAttributedString *truncationToken = nil;\n    YYTextLine *truncatedLine = nil;\n    YYRowEdge *lineRowsEdge = NULL;\n    NSUInteger *lineRowsIndex = NULL;\n    NSRange visibleRange;\n    NSUInteger maximumNumberOfRows = 0;\n    BOOL constraintSizeIsExtended = NO;\n    CGRect constraintRectBeforeExtended = {0};\n    \n    text = text.mutableCopy;\n    container = container.copy;\n    if (!text || !container) return nil;\n    if (range.location + range.length > text.length) return nil;\n    container->_readonly = YES;\n    maximumNumberOfRows = container.maximumNumberOfRows;\n    \n    // CoreText bug when draw joined emoji since iOS 8.3.\n    // See -[NSMutableAttributedString setClearColorToJoinedEmoji] for more information.\n    static BOOL needFixJoinedEmojiBug = NO;\n    // It may use larger constraint size when create CTFrame with\n    // CTFramesetterCreateFrame in iOS 10.\n    static BOOL needFixLayoutSizeBug = NO;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        double systemVersionDouble = [UIDevice currentDevice].systemVersion.doubleValue;\n        if (8.3 <= systemVersionDouble && systemVersionDouble < 9) {\n            needFixJoinedEmojiBug = YES;\n        }\n        if (systemVersionDouble >= 10) {\n            needFixLayoutSizeBug = YES;\n        }\n    });\n    if (needFixJoinedEmojiBug) {\n        [((NSMutableAttributedString *)text) yy_setClearColorToJoinedEmoji];\n    }\n    \n    layout = [[YYTextLayout alloc] _init];\n    layout.text = text;\n    layout.container = container;\n    layout.range = range;\n    isVerticalForm = container.verticalForm;\n    \n    // set cgPath and cgPathBox\n    if (container.path == nil && container.exclusionPaths.count == 0) {\n        if (container.size.width <= 0 || container.size.height <= 0) goto fail;\n        CGRect rect = (CGRect) {CGPointZero, container.size };\n        if (needFixLayoutSizeBug) {\n            constraintSizeIsExtended = YES;\n            constraintRectBeforeExtended = UIEdgeInsetsInsetRect(rect, container.insets);\n            constraintRectBeforeExtended = CGRectStandardize(constraintRectBeforeExtended);\n            if (container.isVerticalForm) {\n                rect.size.width = YYTextContainerMaxSize.width;\n            } else {\n                rect.size.height = YYTextContainerMaxSize.height;\n            }\n        }\n        rect = UIEdgeInsetsInsetRect(rect, container.insets);\n        rect = CGRectStandardize(rect);\n        cgPathBox = rect;\n        rect = CGRectApplyAffineTransform(rect, CGAffineTransformMakeScale(1, -1));\n        cgPath = CGPathCreateWithRect(rect, NULL); // let CGPathIsRect() returns true\n    } else if (container.path && CGPathIsRect(container.path.CGPath, &cgPathBox) && container.exclusionPaths.count == 0) {\n        CGRect rect = CGRectApplyAffineTransform(cgPathBox, CGAffineTransformMakeScale(1, -1));\n        cgPath = CGPathCreateWithRect(rect, NULL); // let CGPathIsRect() returns true\n    } else {\n        rowMaySeparated = YES;\n        CGMutablePathRef path = NULL;\n        if (container.path) {\n            path = CGPathCreateMutableCopy(container.path.CGPath);\n        } else {\n            CGRect rect = (CGRect) {CGPointZero, container.size };\n            rect = UIEdgeInsetsInsetRect(rect, container.insets);\n            CGPathRef rectPath = CGPathCreateWithRect(rect, NULL);\n            if (rectPath) {\n                path = CGPathCreateMutableCopy(rectPath);\n                CGPathRelease(rectPath);\n            }\n        }\n        if (path) {\n            [layout.container.exclusionPaths enumerateObjectsUsingBlock: ^(UIBezierPath *onePath, NSUInteger idx, BOOL *stop) {\n                CGPathAddPath(path, NULL, onePath.CGPath);\n            }];\n            \n            cgPathBox = CGPathGetPathBoundingBox(path);\n            CGAffineTransform trans = CGAffineTransformMakeScale(1, -1);\n            CGMutablePathRef transPath = CGPathCreateMutableCopyByTransformingPath(path, &trans);\n            CGPathRelease(path);\n            path = transPath;\n        }\n        cgPath = path;\n    }\n    if (!cgPath) goto fail;\n    \n    // frame setter config\n    frameAttrs = [NSMutableDictionary dictionary];\n    if (container.isPathFillEvenOdd == NO) {\n        frameAttrs[(id)kCTFramePathFillRuleAttributeName] = @(kCTFramePathFillWindingNumber);\n    }\n    if (container.pathLineWidth > 0) {\n        frameAttrs[(id)kCTFramePathWidthAttributeName] = @(container.pathLineWidth);\n    }\n    if (container.isVerticalForm == YES) {\n        frameAttrs[(id)kCTFrameProgressionAttributeName] = @(kCTFrameProgressionRightToLeft);\n    }\n    \n    // create CoreText objects\n    ctSetter = CTFramesetterCreateWithAttributedString((CFTypeRef)text);\n    if (!ctSetter) goto fail;\n    ctFrame = CTFramesetterCreateFrame(ctSetter, YYTextCFRangeFromNSRange(range), cgPath, (CFTypeRef)frameAttrs);\n    if (!ctFrame) goto fail;\n    lines = [NSMutableArray new];\n    ctLines = CTFrameGetLines(ctFrame);\n    lineCount = CFArrayGetCount(ctLines);\n    if (lineCount > 0) {\n        lineOrigins = malloc(lineCount * sizeof(CGPoint));\n        if (lineOrigins == NULL) goto fail;\n        CTFrameGetLineOrigins(ctFrame, CFRangeMake(0, lineCount), lineOrigins);\n    }\n    \n    CGRect textBoundingRect = CGRectZero;\n    CGSize textBoundingSize = CGSizeZero;\n    NSInteger rowIdx = -1;\n    NSUInteger rowCount = 0;\n    CGRect lastRect = CGRectMake(0, -FLT_MAX, 0, 0);\n    CGPoint lastPosition = CGPointMake(0, -FLT_MAX);\n    if (isVerticalForm) {\n        lastRect = CGRectMake(FLT_MAX, 0, 0, 0);\n        lastPosition = CGPointMake(FLT_MAX, 0);\n    }\n    \n    // calculate line frame\n    NSUInteger lineCurrentIdx = 0;\n    for (NSUInteger i = 0; i < lineCount; i++) {\n        CTLineRef ctLine = CFArrayGetValueAtIndex(ctLines, i);\n        CFArrayRef ctRuns = CTLineGetGlyphRuns(ctLine);\n        if (!ctRuns || CFArrayGetCount(ctRuns) == 0) continue;\n        \n        // CoreText coordinate system\n        CGPoint ctLineOrigin = lineOrigins[i];\n        \n        // UIKit coordinate system\n        CGPoint position;\n        position.x = cgPathBox.origin.x + ctLineOrigin.x;\n        position.y = cgPathBox.size.height + cgPathBox.origin.y - ctLineOrigin.y;\n        \n        YYTextLine *line = [YYTextLine lineWithCTLine:ctLine position:position vertical:isVerticalForm];\n        CGRect rect = line.bounds;\n        \n        if (constraintSizeIsExtended) {\n            if (isVerticalForm) {\n                if (rect.origin.x + rect.size.width >\n                    constraintRectBeforeExtended.origin.x +\n                    constraintRectBeforeExtended.size.width) break;\n            } else {\n                if (rect.origin.y + rect.size.height >\n                    constraintRectBeforeExtended.origin.y +\n                    constraintRectBeforeExtended.size.height) break;\n            }\n        }\n        \n        BOOL newRow = YES;\n        if (rowMaySeparated && position.x != lastPosition.x) {\n            if (isVerticalForm) {\n                if (rect.size.width > lastRect.size.width) {\n                    if (rect.origin.x > lastPosition.x && lastPosition.x > rect.origin.x - rect.size.width) newRow = NO;\n                } else {\n                    if (lastRect.origin.x > position.x && position.x > lastRect.origin.x - lastRect.size.width) newRow = NO;\n                }\n            } else {\n                if (rect.size.height > lastRect.size.height) {\n                    if (rect.origin.y < lastPosition.y && lastPosition.y < rect.origin.y + rect.size.height) newRow = NO;\n                } else {\n                    if (lastRect.origin.y < position.y && position.y < lastRect.origin.y + lastRect.size.height) newRow = NO;\n                }\n            }\n        }\n        \n        if (newRow) rowIdx++;\n        lastRect = rect;\n        lastPosition = position;\n        \n        line.index = lineCurrentIdx;\n        line.row = rowIdx;\n        [lines addObject:line];\n        rowCount = rowIdx + 1;\n        lineCurrentIdx ++;\n        \n        if (i == 0) textBoundingRect = rect;\n        else {\n            if (maximumNumberOfRows == 0 || rowIdx < maximumNumberOfRows) {\n                textBoundingRect = CGRectUnion(textBoundingRect, rect);\n            }\n        }\n    }\n    \n    if (rowCount > 0) {\n        if (maximumNumberOfRows > 0) {\n            if (rowCount > maximumNumberOfRows) {\n                needTruncation = YES;\n                rowCount = maximumNumberOfRows;\n                do {\n                    YYTextLine *line = lines.lastObject;\n                    if (!line) break;\n                    if (line.row < rowCount) break;\n                    [lines removeLastObject];\n                } while (1);\n            }\n        }\n        YYTextLine *lastLine = lines.lastObject;\n        if (!needTruncation && lastLine.range.location + lastLine.range.length < text.length) {\n            needTruncation = YES;\n        }\n        \n        // Give user a chance to modify the line's position.\n        if (container.linePositionModifier) {\n            [container.linePositionModifier modifyLines:lines fromText:text inContainer:container];\n            textBoundingRect = CGRectZero;\n            for (NSUInteger i = 0, max = lines.count; i < max; i++) {\n                YYTextLine *line = lines[i];\n                if (i == 0) textBoundingRect = line.bounds;\n                else textBoundingRect = CGRectUnion(textBoundingRect, line.bounds);\n            }\n        }\n        \n        lineRowsEdge = calloc(rowCount, sizeof(YYRowEdge));\n        if (lineRowsEdge == NULL) goto fail;\n        lineRowsIndex = calloc(rowCount, sizeof(NSUInteger));\n        if (lineRowsIndex == NULL) goto fail;\n        NSInteger lastRowIdx = -1;\n        CGFloat lastHead = 0;\n        CGFloat lastFoot = 0;\n        for (NSUInteger i = 0, max = lines.count; i < max; i++) {\n            YYTextLine *line = lines[i];\n            CGRect rect = line.bounds;\n            if ((NSInteger)line.row != lastRowIdx) {\n                if (lastRowIdx >= 0) {\n                    lineRowsEdge[lastRowIdx] = (YYRowEdge) {.head = lastHead, .foot = lastFoot };\n                }\n                lastRowIdx = line.row;\n                lineRowsIndex[lastRowIdx] = i;\n                if (isVerticalForm) {\n                    lastHead = rect.origin.x + rect.size.width;\n                    lastFoot = lastHead - rect.size.width;\n                } else {\n                    lastHead = rect.origin.y;\n                    lastFoot = lastHead + rect.size.height;\n                }\n            } else {\n                if (isVerticalForm) {\n                    lastHead = MAX(lastHead, rect.origin.x + rect.size.width);\n                    lastFoot = MIN(lastFoot, rect.origin.x);\n                } else {\n                    lastHead = MIN(lastHead, rect.origin.y);\n                    lastFoot = MAX(lastFoot, rect.origin.y + rect.size.height);\n                }\n            }\n        }\n        lineRowsEdge[lastRowIdx] = (YYRowEdge) {.head = lastHead, .foot = lastFoot };\n        \n        for (NSUInteger i = 1; i < rowCount; i++) {\n            YYRowEdge v0 = lineRowsEdge[i - 1];\n            YYRowEdge v1 = lineRowsEdge[i];\n            lineRowsEdge[i - 1].foot = lineRowsEdge[i].head = (v0.foot + v1.head) * 0.5;\n        }\n    }\n    \n    { // calculate bounding size\n        CGRect rect = textBoundingRect;\n        if (container.path) {\n            if (container.pathLineWidth > 0) {\n                CGFloat inset = container.pathLineWidth / 2;\n                rect = CGRectInset(rect, -inset, -inset);\n            }\n        } else {\n            rect = UIEdgeInsetsInsetRect(rect,YYTextUIEdgeInsetsInvert(container.insets));\n        }\n        rect = CGRectStandardize(rect);\n        CGSize size = rect.size;\n        if (container.verticalForm) {\n            size.width += container.size.width - (rect.origin.x + rect.size.width);\n        } else {\n            size.width += rect.origin.x;\n        }\n        size.height += rect.origin.y;\n        if (size.width < 0) size.width = 0;\n        if (size.height < 0) size.height = 0;\n        size.width = ceil(size.width);\n        size.height = ceil(size.height);\n        textBoundingSize = size;\n    }\n    \n    visibleRange = YYTextNSRangeFromCFRange(CTFrameGetVisibleStringRange(ctFrame));\n    if (needTruncation) {\n        YYTextLine *lastLine = lines.lastObject;\n        NSRange lastRange = lastLine.range;\n        visibleRange.length = lastRange.location + lastRange.length - visibleRange.location;\n        \n        // create truncated line\n        if (container.truncationType != YYTextTruncationTypeNone) {\n            CTLineRef truncationTokenLine = NULL;\n            if (container.truncationToken) {\n                truncationToken = container.truncationToken;\n                truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)truncationToken);\n            } else {\n                CFArrayRef runs = CTLineGetGlyphRuns(lastLine.CTLine);\n                NSUInteger runCount = CFArrayGetCount(runs);\n                NSMutableDictionary *attrs = nil;\n                if (runCount > 0) {\n                    CTRunRef run = CFArrayGetValueAtIndex(runs, runCount - 1);\n                    attrs = (id)CTRunGetAttributes(run);\n                    attrs = attrs ? attrs.mutableCopy : [NSMutableArray new];\n                    [attrs removeObjectsForKeys:[NSMutableAttributedString yy_allDiscontinuousAttributeKeys]];\n                    CTFontRef font = (__bridge CFTypeRef)attrs[(id)kCTFontAttributeName];\n                    CGFloat fontSize = font ? CTFontGetSize(font) : 12.0;\n                    UIFont *uiFont = [UIFont systemFontOfSize:fontSize * 0.9];\n                    if (uiFont) {\n                        font = CTFontCreateWithName((__bridge CFStringRef)uiFont.fontName, uiFont.pointSize, NULL);\n                    } else {\n                        font = NULL;\n                    }\n                    if (font) {\n                        attrs[(id)kCTFontAttributeName] = (__bridge id)(font);\n                        uiFont = nil;\n                        CFRelease(font);\n                    }\n                    CGColorRef color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]);\n                    if (color && CFGetTypeID(color) == CGColorGetTypeID() && CGColorGetAlpha(color) == 0) {\n                        // ignore clear color\n                        [attrs removeObjectForKey:(id)kCTForegroundColorAttributeName];\n                    }\n                    if (!attrs) attrs = [NSMutableDictionary new];\n                }\n                truncationToken = [[NSAttributedString alloc] initWithString:YYTextTruncationToken attributes:attrs];\n                truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)truncationToken);\n            }\n            if (truncationTokenLine) {\n                CTLineTruncationType type = kCTLineTruncationEnd;\n                if (container.truncationType == YYTextTruncationTypeStart) {\n                    type = kCTLineTruncationStart;\n                } else if (container.truncationType == YYTextTruncationTypeMiddle) {\n                    type = kCTLineTruncationMiddle;\n                }\n                NSMutableAttributedString *lastLineText = [text attributedSubstringFromRange:lastLine.range].mutableCopy;\n                [lastLineText appendAttributedString:truncationToken];\n                CTLineRef ctLastLineExtend = CTLineCreateWithAttributedString((CFAttributedStringRef)lastLineText);\n                if (ctLastLineExtend) {\n                    CGFloat truncatedWidth = lastLine.width;\n                    CGRect cgPathRect = CGRectZero;\n                    if (CGPathIsRect(cgPath, &cgPathRect)) {\n                        if (isVerticalForm) {\n                            truncatedWidth = cgPathRect.size.height;\n                        } else {\n                            truncatedWidth = cgPathRect.size.width;\n                        }\n                    }\n                    CTLineRef ctTruncatedLine = CTLineCreateTruncatedLine(ctLastLineExtend, truncatedWidth, type, truncationTokenLine);\n                    CFRelease(ctLastLineExtend);\n                    if (ctTruncatedLine) {\n                        truncatedLine = [YYTextLine lineWithCTLine:ctTruncatedLine position:lastLine.position vertical:isVerticalForm];\n                        truncatedLine.index = lastLine.index;\n                        truncatedLine.row = lastLine.row;\n                        CFRelease(ctTruncatedLine);\n                    }\n                }\n                CFRelease(truncationTokenLine);\n            }\n        }\n    }\n    \n    if (isVerticalForm) {\n        NSCharacterSet *rotateCharset = YYTextVerticalFormRotateCharacterSet();\n        NSCharacterSet *rotateMoveCharset = YYTextVerticalFormRotateAndMoveCharacterSet();\n        \n        void (^lineBlock)(YYTextLine *) = ^(YYTextLine *line){\n            CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n            if (!runs) return;\n            NSUInteger runCount = CFArrayGetCount(runs);\n            if (runCount == 0) return;\n            NSMutableArray *lineRunRanges = [NSMutableArray new];\n            line.verticalRotateRange = lineRunRanges;\n            for (NSUInteger r = 0; r < runCount; r++) {\n                CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n                NSMutableArray *runRanges = [NSMutableArray new];\n                [lineRunRanges addObject:runRanges];\n                NSUInteger glyphCount = CTRunGetGlyphCount(run);\n                if (glyphCount == 0) continue;\n                \n                CFIndex runStrIdx[glyphCount + 1];\n                CTRunGetStringIndices(run, CFRangeMake(0, 0), runStrIdx);\n                CFRange runStrRange = CTRunGetStringRange(run);\n                runStrIdx[glyphCount] = runStrRange.location + runStrRange.length;\n                CFDictionaryRef runAttrs = CTRunGetAttributes(run);\n                CTFontRef font = CFDictionaryGetValue(runAttrs, kCTFontAttributeName);\n                BOOL isColorGlyph = YYTextCTFontContainsColorBitmapGlyphs(font);\n                \n                NSUInteger prevIdx = 0;\n                YYTextRunGlyphDrawMode prevMode = YYTextRunGlyphDrawModeHorizontal;\n                NSString *layoutStr = layout.text.string;\n                for (NSUInteger g = 0; g < glyphCount; g++) {\n                    BOOL glyphRotate = 0, glyphRotateMove = NO;\n                    CFIndex runStrLen = runStrIdx[g + 1] - runStrIdx[g];\n                    if (isColorGlyph) {\n                        glyphRotate = YES;\n                    } else if (runStrLen == 1) {\n                        unichar c = [layoutStr characterAtIndex:runStrIdx[g]];\n                        glyphRotate = [rotateCharset characterIsMember:c];\n                        if (glyphRotate) glyphRotateMove = [rotateMoveCharset characterIsMember:c];\n                    } else if (runStrLen > 1){\n                        NSString *glyphStr = [layoutStr substringWithRange:NSMakeRange(runStrIdx[g], runStrLen)];\n                        BOOL glyphRotate = [glyphStr rangeOfCharacterFromSet:rotateCharset].location != NSNotFound;\n                        if (glyphRotate) glyphRotateMove = [glyphStr rangeOfCharacterFromSet:rotateMoveCharset].location != NSNotFound;\n                    }\n                    \n                    YYTextRunGlyphDrawMode mode = glyphRotateMove ? YYTextRunGlyphDrawModeVerticalRotateMove : (glyphRotate ? YYTextRunGlyphDrawModeVerticalRotate : YYTextRunGlyphDrawModeHorizontal);\n                    if (g == 0) {\n                        prevMode = mode;\n                    } else if (mode != prevMode) {\n                        YYTextRunGlyphRange *aRange = [YYTextRunGlyphRange rangeWithRange:NSMakeRange(prevIdx, g - prevIdx) drawMode:prevMode];\n                        [runRanges addObject:aRange];\n                        prevIdx = g;\n                        prevMode = mode;\n                    }\n                }\n                if (prevIdx < glyphCount) {\n                    YYTextRunGlyphRange *aRange = [YYTextRunGlyphRange rangeWithRange:NSMakeRange(prevIdx, glyphCount - prevIdx) drawMode:prevMode];\n                    [runRanges addObject:aRange];\n                }\n                \n            }\n        };\n        for (YYTextLine *line in lines) {\n            lineBlock(line);\n        }\n        if (truncatedLine) lineBlock(truncatedLine);\n    }\n    \n    if (visibleRange.length > 0) {\n        layout.needDrawText = YES;\n        \n        void (^block)(NSDictionary *attrs, NSRange range, BOOL *stop) = ^(NSDictionary *attrs, NSRange range, BOOL *stop) {\n            if (attrs[YYTextHighlightAttributeName]) layout.containsHighlight = YES;\n            if (attrs[YYTextBlockBorderAttributeName]) layout.needDrawBlockBorder = YES;\n            if (attrs[YYTextBackgroundBorderAttributeName]) layout.needDrawBackgroundBorder = YES;\n            if (attrs[YYTextShadowAttributeName] || attrs[NSShadowAttributeName]) layout.needDrawShadow = YES;\n            if (attrs[YYTextUnderlineAttributeName]) layout.needDrawUnderline = YES;\n            if (attrs[YYTextAttachmentAttributeName]) layout.needDrawAttachment = YES;\n            if (attrs[YYTextInnerShadowAttributeName]) layout.needDrawInnerShadow = YES;\n            if (attrs[YYTextStrikethroughAttributeName]) layout.needDrawStrikethrough = YES;\n            if (attrs[YYTextBorderAttributeName]) layout.needDrawBorder = YES;\n        };\n        \n        [layout.text enumerateAttributesInRange:visibleRange options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:block];\n        if (truncatedLine) {\n            [truncationToken enumerateAttributesInRange:NSMakeRange(0, truncationToken.length) options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:block];\n        }\n    }\n    \n    attachments = [NSMutableArray new];\n    attachmentRanges = [NSMutableArray new];\n    attachmentRects = [NSMutableArray new];\n    attachmentContentsSet = [NSMutableSet new];\n    for (NSUInteger i = 0, max = lines.count; i < max; i++) {\n        YYTextLine *line = lines[i];\n        if (truncatedLine && line.index == truncatedLine.index) line = truncatedLine;\n        if (line.attachments.count > 0) {\n            [attachments addObjectsFromArray:line.attachments];\n            [attachmentRanges addObjectsFromArray:line.attachmentRanges];\n            [attachmentRects addObjectsFromArray:line.attachmentRects];\n            for (YYTextAttachment *attachment in line.attachments) {\n                if (attachment.content) {\n                    [attachmentContentsSet addObject:attachment.content];\n                }\n            }\n        }\n    }\n    if (attachments.count == 0) {\n        attachments = attachmentRanges = attachmentRects = nil;\n    }\n    \n    layout.frameSetter = ctSetter;\n    layout.frame = ctFrame;\n    layout.lines = lines;\n    layout.truncatedLine = truncatedLine;\n    layout.attachments = attachments;\n    layout.attachmentRanges = attachmentRanges;\n    layout.attachmentRects = attachmentRects;\n    layout.attachmentContentsSet = attachmentContentsSet;\n    layout.rowCount = rowCount;\n    layout.visibleRange = visibleRange;\n    layout.textBoundingRect = textBoundingRect;\n    layout.textBoundingSize = textBoundingSize;\n    layout.lineRowsEdge = lineRowsEdge;\n    layout.lineRowsIndex = lineRowsIndex;\n    CFRelease(cgPath);\n    CFRelease(ctSetter);\n    CFRelease(ctFrame);\n    if (lineOrigins) free(lineOrigins);\n    return layout;\n    \nfail:\n    if (cgPath) CFRelease(cgPath);\n    if (ctSetter) CFRelease(ctSetter);\n    if (ctFrame) CFRelease(ctFrame);\n    if (lineOrigins) free(lineOrigins);\n    if (lineRowsEdge) free(lineRowsEdge);\n    if (lineRowsIndex) free(lineRowsIndex);\n    return nil;\n}\n\n+ (NSArray *)layoutWithContainers:(NSArray *)containers text:(NSAttributedString *)text {\n    return [self layoutWithContainers:containers text:text range:NSMakeRange(0, text.length)];\n}\n\n+ (NSArray *)layoutWithContainers:(NSArray *)containers text:(NSAttributedString *)text range:(NSRange)range {\n    if (!containers || !text) return nil;\n    if (range.location + range.length > text.length) return nil;\n    NSMutableArray *layouts = [NSMutableArray array];\n    for (NSUInteger i = 0, max = containers.count; i < max; i++) {\n        YYTextContainer *container = containers[i];\n        YYTextLayout *layout = [self layoutWithContainer:container text:text range:range];\n        if (!layout) return nil;\n        NSInteger length = (NSInteger)range.length - (NSInteger)layout.visibleRange.length;\n        if (length <= 0) {\n            range.length = 0;\n            range.location = text.length;\n        } else {\n            range.length = length;\n            range.location += layout.visibleRange.length;\n        }\n    }\n    return layouts;\n}\n\n- (void)setFrameSetter:(CTFramesetterRef)frameSetter {\n    if (_frameSetter != frameSetter) {\n        if (frameSetter) CFRetain(frameSetter);\n        if (_frameSetter) CFRelease(_frameSetter);\n        _frameSetter = frameSetter;\n    }\n}\n\n- (void)setFrame:(CTFrameRef)frame {\n    if (_frame != frame) {\n        if (frame) CFRetain(frame);\n        if (_frame) CFRelease(_frame);\n        _frame = frame;\n    }\n}\n\n- (void)dealloc {\n    if (_frameSetter) CFRelease(_frameSetter);\n    if (_frame) CFRelease(_frame);\n    if (_lineRowsIndex) free(_lineRowsIndex);\n    if (_lineRowsEdge) free(_lineRowsEdge);\n}\n\n#pragma mark - Coding\n\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    NSData *textData = [YYTextArchiver archivedDataWithRootObject:_text];\n    [aCoder encodeObject:textData forKey:@\"text\"];\n    [aCoder encodeObject:_container forKey:@\"container\"];\n    [aCoder encodeObject:[NSValue valueWithRange:_range] forKey:@\"range\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    NSData *textData = [aDecoder decodeObjectForKey:@\"text\"];\n    NSAttributedString *text = [YYTextUnarchiver unarchiveObjectWithData:textData];\n    YYTextContainer *container = [aDecoder decodeObjectForKey:@\"container\"];\n    NSRange range = ((NSValue *)[aDecoder decodeObjectForKey:@\"range\"]).rangeValue;\n    self = [self.class layoutWithContainer:container text:text range:range];\n    return self;\n}\n\n#pragma mark - Copying\n\n- (id)copyWithZone:(NSZone *)zone {\n    return self; // readonly object\n}\n\n\n#pragma mark - Query\n\n/**\n Get the row index with 'edge' distance.\n \n @param edge  The distance from edge to the point.\n If vertical form, the edge is left edge, otherwise the edge is top edge.\n \n @return Returns NSNotFound if there's no row at the point.\n */\n- (NSUInteger)_rowIndexForEdge:(CGFloat)edge {\n    if (_rowCount == 0) return NSNotFound;\n    BOOL isVertical = _container.verticalForm;\n    NSUInteger lo = 0, hi = _rowCount - 1, mid = 0;\n    NSUInteger rowIdx = NSNotFound;\n    while (lo <= hi) {\n        mid = (lo + hi) / 2;\n        YYRowEdge oneEdge = _lineRowsEdge[mid];\n        if (isVertical ?\n            (oneEdge.foot <= edge && edge <= oneEdge.head) :\n            (oneEdge.head <= edge && edge <= oneEdge.foot)) {\n          rowIdx = mid;\n          break;\n        }\n        if ((isVertical ? (edge > oneEdge.head) : (edge < oneEdge.head))) {\n            if (mid == 0) break;\n            hi = mid - 1;\n        } else {\n            lo = mid + 1;\n        }\n    }\n    return rowIdx;\n}\n\n/**\n Get the closest row index with 'edge' distance.\n \n @param edge  The distance from edge to the point.\n If vertical form, the edge is left edge, otherwise the edge is top edge.\n \n @return Returns NSNotFound if there's no line.\n */\n- (NSUInteger)_closestRowIndexForEdge:(CGFloat)edge {\n    if (_rowCount == 0) return NSNotFound;\n    NSUInteger rowIdx = [self _rowIndexForEdge:edge];\n    if (rowIdx == NSNotFound) {\n        if (_container.verticalForm) {\n            if (edge > _lineRowsEdge[0].head) {\n                rowIdx = 0;\n            } else if (edge < _lineRowsEdge[_rowCount - 1].foot) {\n                rowIdx = _rowCount - 1;\n            }\n        } else {\n            if (edge < _lineRowsEdge[0].head) {\n                rowIdx = 0;\n            } else if (edge > _lineRowsEdge[_rowCount - 1].foot) {\n                rowIdx = _rowCount - 1;\n            }\n        }\n    }\n    return rowIdx;\n}\n\n/**\n Get a CTRun from a line position.\n \n @param line     The text line.\n @param position The position in the whole text.\n \n @return Returns NULL if not found (no CTRun at the position).\n */\n- (CTRunRef)_runForLine:(YYTextLine *)line position:(YYTextPosition *)position {\n    if (!line || !position) return NULL;\n    CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n    for (NSUInteger i = 0, max = CFArrayGetCount(runs); i < max; i++) {\n        CTRunRef run = CFArrayGetValueAtIndex(runs, i);\n        CFRange range = CTRunGetStringRange(run);\n        if (position.affinity == YYTextAffinityBackward) {\n            if (range.location < position.offset && position.offset <= range.location + range.length) {\n                return run;\n            }\n        } else {\n            if (range.location <= position.offset && position.offset < range.location + range.length) {\n                return run;\n            }\n        }\n    }\n    return NULL;\n}\n\n/**\n Whether the position is inside a composed character sequence.\n \n @param line     The text line.\n @param position Text text position in whole text.\n @param block    The block to be executed before returns YES.\n            left:  left X offset\n            right: right X offset\n            prev:  left position\n            next:  right position\n */\n- (BOOL)_insideComposedCharacterSequences:(YYTextLine *)line position:(NSUInteger)position block:(void (^)(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next))block {\n    NSRange range = line.range;\n    if (range.length == 0) return NO;\n    __block BOOL inside = NO;\n    __block NSUInteger _prev, _next;\n    [_text.string enumerateSubstringsInRange:range options:NSStringEnumerationByComposedCharacterSequences usingBlock: ^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {\n        NSUInteger prev = substringRange.location;\n        NSUInteger next = substringRange.location + substringRange.length;\n        if (prev == position || next == position) {\n            *stop = YES;\n        }\n        if (prev < position && position < next) {\n            inside = YES;\n            _prev = prev;\n            _next = next;\n            *stop = YES;\n        }\n    }];\n    if (inside && block) {\n        CGFloat left = [self offsetForTextPosition:_prev lineIndex:line.index];\n        CGFloat right = [self offsetForTextPosition:_next lineIndex:line.index];\n        block(left, right, _prev, _next);\n    }\n    return inside;\n}\n\n/**\n Whether the position is inside an emoji (such as National Flag Emoji).\n \n @param line     The text line.\n @param position Text text position in whole text.\n @param block    Yhe block to be executed before returns YES.\n           left:  emoji's left X offset\n           right: emoji's right X offset\n           prev:  emoji's left position\n           next:  emoji's right position\n */\n- (BOOL)_insideEmoji:(YYTextLine *)line position:(NSUInteger)position block:(void (^)(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next))block {\n    if (!line) return NO;\n    CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n    for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n        CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n        NSUInteger glyphCount = CTRunGetGlyphCount(run);\n        if (glyphCount == 0) continue;\n        CFRange range = CTRunGetStringRange(run);\n        if (range.length <= 1) continue;\n        if (position <= range.location || position >= range.location + range.length) continue;\n        CFDictionaryRef attrs = CTRunGetAttributes(run);\n        CTFontRef font = CFDictionaryGetValue(attrs, kCTFontAttributeName);\n        if (!YYTextCTFontContainsColorBitmapGlyphs(font)) continue;\n        \n        // Here's Emoji runs (larger than 1 unichar), and position is inside the range.\n        CFIndex indices[glyphCount];\n        CTRunGetStringIndices(run, CFRangeMake(0, glyphCount), indices);\n        for (NSUInteger g = 0; g < glyphCount; g++) {\n            CFIndex prev = indices[g];\n            CFIndex next = g + 1 < glyphCount ? indices[g + 1] : range.location + range.length;\n            if (position == prev) break; // Emoji edge\n            if (prev < position && position < next) { // inside an emoji (such as National Flag Emoji)\n                CGPoint pos = CGPointZero;\n                CGSize adv = CGSizeZero;\n                CTRunGetPositions(run, CFRangeMake(g, 1), &pos);\n                CTRunGetAdvances(run, CFRangeMake(g, 1), &adv);\n                if (block) {\n                    block(line.position.x + pos.x,\n                          line.position.x + pos.x + adv.width,\n                          prev, next);\n                }\n                return YES;\n            }\n        }\n    }\n    return NO;\n}\n/**\n Whether the write direction is RTL at the specified point\n \n @param line  The text line\n @param point The point in layout.\n \n @return YES if RTL.\n */\n- (BOOL)_isRightToLeftInLine:(YYTextLine *)line atPoint:(CGPoint)point {\n    if (!line) return NO;\n    // get write direction\n    BOOL RTL = NO;\n    CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n    for (NSUInteger r = 0, max = CFArrayGetCount(runs); r < max; r++) {\n        CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n        CGPoint glyphPosition;\n        CTRunGetPositions(run, CFRangeMake(0, 1), &glyphPosition);\n        if (_container.verticalForm) {\n            CGFloat runX = glyphPosition.x;\n            runX += line.position.y;\n            CGFloat runWidth = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL);\n            if (runX <= point.y && point.y <= runX + runWidth) {\n                if (CTRunGetStatus(run) & kCTRunStatusRightToLeft) RTL = YES;\n                break;\n            }\n        } else {\n            CGFloat runX = glyphPosition.x;\n            runX += line.position.x;\n            CGFloat runWidth = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL);\n            if (runX <= point.x && point.x <= runX + runWidth) {\n                if (CTRunGetStatus(run) & kCTRunStatusRightToLeft) RTL = YES;\n                break;\n            }\n        }\n    }\n    return RTL;\n}\n\n/**\n Correct the range's edge.\n */\n- (YYTextRange *)_correctedRangeWithEdge:(YYTextRange *)range {\n    NSRange visibleRange = self.visibleRange;\n    YYTextPosition *start = range.start;\n    YYTextPosition *end = range.end;\n    \n    if (start.offset == visibleRange.location && start.affinity == YYTextAffinityBackward) {\n        start = [YYTextPosition positionWithOffset:start.offset affinity:YYTextAffinityForward];\n    }\n    \n    if (end.offset == visibleRange.location + visibleRange.length && start.affinity == YYTextAffinityForward) {\n        end = [YYTextPosition positionWithOffset:end.offset affinity:YYTextAffinityBackward];\n    }\n    \n    if (start != range.start || end != range.end) {\n        range = [YYTextRange rangeWithStart:start end:end];\n    }\n    return range;\n}\n\n- (NSUInteger)lineIndexForRow:(NSUInteger)row {\n    if (row >= _rowCount) return NSNotFound;\n    return _lineRowsIndex[row];\n}\n\n- (NSUInteger)lineCountForRow:(NSUInteger)row {\n    if (row >= _rowCount) return NSNotFound;\n    if (row == _rowCount - 1) {\n        return _lines.count - _lineRowsIndex[row];\n    } else {\n        return _lineRowsIndex[row + 1] - _lineRowsIndex[row];\n    }\n}\n\n- (NSUInteger)rowIndexForLine:(NSUInteger)line {\n    if (line >= _lines.count) return NSNotFound;\n    return ((YYTextLine *)_lines[line]).row;\n}\n\n- (NSUInteger)lineIndexForPoint:(CGPoint)point {\n    if (_lines.count == 0 || _rowCount == 0) return NSNotFound;\n    NSUInteger rowIdx = [self _rowIndexForEdge:_container.verticalForm ? point.x : point.y];\n    if (rowIdx == NSNotFound) return NSNotFound;\n    \n    NSUInteger lineIdx0 = _lineRowsIndex[rowIdx];\n    NSUInteger lineIdx1 = rowIdx == _rowCount - 1 ? _lines.count - 1 : _lineRowsIndex[rowIdx + 1] - 1;\n    for (NSUInteger i = lineIdx0; i <= lineIdx1; i++) {\n        CGRect bounds = ((YYTextLine *)_lines[i]).bounds;\n        if (CGRectContainsPoint(bounds, point)) return i;\n    }\n    \n    return NSNotFound;\n}\n\n- (NSUInteger)closestLineIndexForPoint:(CGPoint)point {\n    BOOL isVertical = _container.verticalForm;\n    if (_lines.count == 0 || _rowCount == 0) return NSNotFound;\n    NSUInteger rowIdx = [self _closestRowIndexForEdge:isVertical ? point.x : point.y];\n    if (rowIdx == NSNotFound) return NSNotFound;\n    \n    NSUInteger lineIdx0 = _lineRowsIndex[rowIdx];\n    NSUInteger lineIdx1 = rowIdx == _rowCount - 1 ? _lines.count - 1 : _lineRowsIndex[rowIdx + 1] - 1;\n    if (lineIdx0 == lineIdx1) return lineIdx0;\n    \n    CGFloat minDistance = CGFLOAT_MAX;\n    NSUInteger minIndex = lineIdx0;\n    for (NSUInteger i = lineIdx0; i <= lineIdx1; i++) {\n        CGRect bounds = ((YYTextLine *)_lines[i]).bounds;\n        if (isVertical) {\n            if (bounds.origin.y <= point.y && point.y <= bounds.origin.y + bounds.size.height) return i;\n            CGFloat distance;\n            if (point.y < bounds.origin.y) {\n                distance = bounds.origin.y - point.y;\n            } else {\n                distance = point.y - (bounds.origin.y + bounds.size.height);\n            }\n            if (distance < minDistance) {\n                minDistance = distance;\n                minIndex = i;\n            }\n        } else {\n            if (bounds.origin.x <= point.x && point.x <= bounds.origin.x + bounds.size.width) return i;\n            CGFloat distance;\n            if (point.x < bounds.origin.x) {\n                distance = bounds.origin.x - point.x;\n            } else {\n                distance = point.x - (bounds.origin.x + bounds.size.width);\n            }\n            if (distance < minDistance) {\n                minDistance = distance;\n                minIndex = i;\n            }\n        }\n    }\n    return minIndex;\n}\n\n- (CGFloat)offsetForTextPosition:(NSUInteger)position lineIndex:(NSUInteger)lineIndex {\n    if (lineIndex >= _lines.count) return CGFLOAT_MAX;\n    YYTextLine *line = _lines[lineIndex];\n    CFRange range = CTLineGetStringRange(line.CTLine);\n    if (position < range.location || position > range.location + range.length) return CGFLOAT_MAX;\n    \n    CGFloat offset = CTLineGetOffsetForStringIndex(line.CTLine, position, NULL);\n    return _container.verticalForm ? (offset + line.position.y) : (offset + line.position.x);\n}\n\n- (NSUInteger)textPositionForPoint:(CGPoint)point lineIndex:(NSUInteger)lineIndex {\n    if (lineIndex >= _lines.count) return NSNotFound;\n    YYTextLine *line = _lines[lineIndex];\n    if (_container.verticalForm) {\n        point.x = point.y - line.position.y;\n        point.y = 0;\n    } else {\n        point.x -= line.position.x;\n        point.y = 0;\n    }\n    CFIndex idx = CTLineGetStringIndexForPosition(line.CTLine, point);\n    if (idx == kCFNotFound) return NSNotFound;\n    \n    /*\n     If the emoji contains one or more variant form (such as ☔️ \"\\u2614\\uFE0F\")\n     and the font size is smaller than 379/15, then each variant form (\"\\uFE0F\")\n     will rendered as a single blank glyph behind the emoji glyph. Maybe it's a\n     bug in CoreText? Seems iOS8.3 fixes this problem.\n     \n     If the point hit the blank glyph, the CTLineGetStringIndexForPosition()\n     returns the position before the emoji glyph, but it should returns the\n     position after the emoji and variant form.\n     \n     Here's a workaround.\n     */\n    CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n    for (NSUInteger r = 0, max = CFArrayGetCount(runs); r < max; r++) {\n        CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n        CFRange range = CTRunGetStringRange(run);\n        if (range.location <= idx && idx < range.location + range.length) {\n            NSUInteger glyphCount = CTRunGetGlyphCount(run);\n            if (glyphCount == 0) break;\n            CFDictionaryRef attrs = CTRunGetAttributes(run);\n            CTFontRef font = CFDictionaryGetValue(attrs, kCTFontAttributeName);\n            if (!YYTextCTFontContainsColorBitmapGlyphs(font)) break;\n            \n            CFIndex indices[glyphCount];\n            CGPoint positions[glyphCount];\n            CTRunGetStringIndices(run, CFRangeMake(0, glyphCount), indices);\n            CTRunGetPositions(run, CFRangeMake(0, glyphCount), positions);\n            for (NSUInteger g = 0; g < glyphCount; g++) {\n                NSUInteger gIdx = indices[g];\n                if (gIdx == idx && g + 1 < glyphCount) {\n                    CGFloat right = positions[g + 1].x;\n                    if (point.x < right) break;\n                    NSUInteger next = indices[g + 1];\n                    do {\n                        if (next == range.location + range.length) break;\n                        unichar c = [_text.string characterAtIndex:next];\n                        if ((c == 0xFE0E || c == 0xFE0F)) { // unicode variant form for emoji style\n                            next++;\n                        } else break;\n                    }\n                    while (1);\n                    if (next != indices[g + 1]) idx = next;\n                    break;\n                }\n            }\n            break;\n        }\n    }\n    return idx;\n}\n\n- (YYTextPosition *)closestPositionToPoint:(CGPoint)point {\n    BOOL isVertical = _container.verticalForm;\n    // When call CTLineGetStringIndexForPosition() on ligature such as 'fi',\n    // and the point `hit` the glyph's left edge, it may get the ligature inside offset.\n    // I don't know why, maybe it's a bug of CoreText. Try to avoid it.\n    if (isVertical) point.y += 0.00001234;\n    else point.x += 0.00001234;\n    \n    NSUInteger lineIndex = [self closestLineIndexForPoint:point];\n    if (lineIndex == NSNotFound) return nil;\n    YYTextLine *line = _lines[lineIndex];\n    __block NSUInteger position = [self textPositionForPoint:point lineIndex:lineIndex];\n    if (position == NSNotFound) position = line.range.location;\n    if (position <= _visibleRange.location) {\n        return [YYTextPosition positionWithOffset:_visibleRange.location affinity:YYTextAffinityForward];\n    } else if (position >= _visibleRange.location + _visibleRange.length) {\n        return [YYTextPosition positionWithOffset:_visibleRange.location + _visibleRange.length affinity:YYTextAffinityBackward];\n    }\n    \n    YYTextAffinity finalAffinity = YYTextAffinityForward;\n    BOOL finalAffinityDetected = NO;\n    \n    // binding range\n    NSRange bindingRange;\n    YYTextBinding *binding = [_text attribute:YYTextBindingAttributeName atIndex:position longestEffectiveRange:&bindingRange inRange:NSMakeRange(0, _text.length)];\n    if (binding && bindingRange.length > 0) {\n        NSUInteger headLineIdx = [self lineIndexForPosition:[YYTextPosition positionWithOffset:bindingRange.location]];\n        NSUInteger tailLineIdx = [self lineIndexForPosition:[YYTextPosition positionWithOffset:bindingRange.location + bindingRange.length affinity:YYTextAffinityBackward]];\n        if (headLineIdx == lineIndex && lineIndex == tailLineIdx) { // all in same line\n            CGFloat left = [self offsetForTextPosition:bindingRange.location lineIndex:lineIndex];\n            CGFloat right = [self offsetForTextPosition:bindingRange.location + bindingRange.length lineIndex:lineIndex];\n            if (left != CGFLOAT_MAX && right != CGFLOAT_MAX) {\n                if (_container.isVerticalForm) {\n                    if (fabs(point.y - left) < fabs(point.y - right)) {\n                        position = bindingRange.location;\n                        finalAffinity = YYTextAffinityForward;\n                    } else {\n                        position = bindingRange.location + bindingRange.length;\n                        finalAffinity = YYTextAffinityBackward;\n                    }\n                } else {\n                    if (fabs(point.x - left) < fabs(point.x - right)) {\n                        position = bindingRange.location;\n                        finalAffinity = YYTextAffinityForward;\n                    } else {\n                        position = bindingRange.location + bindingRange.length;\n                        finalAffinity = YYTextAffinityBackward;\n                    }\n                }\n            } else if (left != CGFLOAT_MAX) {\n                position = left;\n                finalAffinity = YYTextAffinityForward;\n            } else if (right != CGFLOAT_MAX) {\n                position = right;\n                finalAffinity = YYTextAffinityBackward;\n            }\n            finalAffinityDetected = YES;\n        } else if (headLineIdx == lineIndex) {\n            CGFloat left = [self offsetForTextPosition:bindingRange.location lineIndex:lineIndex];\n            if (left != CGFLOAT_MAX) {\n                position = bindingRange.location;\n                finalAffinity = YYTextAffinityForward;\n                finalAffinityDetected = YES;\n            }\n        } else if (tailLineIdx == lineIndex) {\n            CGFloat right = [self offsetForTextPosition:bindingRange.location + bindingRange.length lineIndex:lineIndex];\n            if (right != CGFLOAT_MAX) {\n                position = bindingRange.location + bindingRange.length;\n                finalAffinity = YYTextAffinityBackward;\n                finalAffinityDetected = YES;\n            }\n        } else {\n            BOOL onLeft = NO, onRight = NO;\n            if (headLineIdx != NSNotFound && tailLineIdx != NSNotFound) {\n                if (abs((int)headLineIdx - (int)lineIndex) < abs((int)tailLineIdx - (int)lineIndex)) onLeft = YES;\n                else onRight = YES;\n            } else if (headLineIdx != NSNotFound) {\n                onLeft = YES;\n            } else if (tailLineIdx != NSNotFound) {\n                onRight = YES;\n            }\n            \n            if (onLeft) {\n                CGFloat left = [self offsetForTextPosition:bindingRange.location lineIndex:headLineIdx];\n                if (left != CGFLOAT_MAX) {\n                    lineIndex = headLineIdx;\n                    line = _lines[headLineIdx];\n                    position = bindingRange.location;\n                    finalAffinity = YYTextAffinityForward;\n                    finalAffinityDetected = YES;\n                }\n            } else if (onRight) {\n                CGFloat right = [self offsetForTextPosition:bindingRange.location + bindingRange.length lineIndex:tailLineIdx];\n                if (right != CGFLOAT_MAX) {\n                    lineIndex = tailLineIdx;\n                    line = _lines[tailLineIdx];\n                    position = bindingRange.location + bindingRange.length;\n                    finalAffinity = YYTextAffinityBackward;\n                    finalAffinityDetected = YES;\n                }\n            }\n        }\n    }\n    \n    // empty line\n    if (line.range.length == 0) {\n        BOOL behind = (_lines.count > 1 && lineIndex == _lines.count - 1);  //end line\n        return [YYTextPosition positionWithOffset:line.range.location affinity:behind ? YYTextAffinityBackward:YYTextAffinityForward];\n    }\n    \n    // detect weather the line is a linebreak token\n    if (line.range.length <= 2) {\n        NSString *str = [_text.string substringWithRange:line.range];\n        if (YYTextIsLinebreakString(str)) { // an empty line (\"\\r\", \"\\n\", \"\\r\\n\")\n            return [YYTextPosition positionWithOffset:line.range.location];\n        }\n    }\n    \n    // above whole text frame\n    if (lineIndex == 0 && (isVertical ? (point.x > line.right) : (point.y < line.top))) {\n        position = 0;\n        finalAffinity = YYTextAffinityForward;\n        finalAffinityDetected = YES;\n    }\n    // below whole text frame\n    if (lineIndex == _lines.count - 1 && (isVertical ? (point.x < line.left) : (point.y > line.bottom))) {\n        position = line.range.location + line.range.length;\n        finalAffinity = YYTextAffinityBackward;\n        finalAffinityDetected = YES;\n    }\n    \n    // There must be at least one non-linebreak char,\n    // ignore the linebreak characters at line end if exists.\n    if (position >= line.range.location + line.range.length - 1) {\n        if (position > line.range.location) {\n            unichar c1 = [_text.string characterAtIndex:position - 1];\n            if (YYTextIsLinebreakChar(c1)) {\n                position--;\n                if (position > line.range.location) {\n                    unichar c0 = [_text.string characterAtIndex:position - 1];\n                    if (YYTextIsLinebreakChar(c0)) {\n                        position--;\n                    }\n                }\n            }\n        }\n    }\n    if (position == line.range.location) {\n        return [YYTextPosition positionWithOffset:position];\n    }\n    if (position == line.range.location + line.range.length) {\n        return [YYTextPosition positionWithOffset:position affinity:YYTextAffinityBackward];\n    }\n    \n    [self _insideComposedCharacterSequences:line position:position block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) {\n        if (isVertical) {\n            position = fabs(left - point.y) < fabs(right - point.y) < (right ? prev : next);\n        } else {\n            position = fabs(left - point.x) < fabs(right - point.x) < (right ? prev : next);\n        }\n    }];\n    \n    [self _insideEmoji:line position:position block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) {\n        if (isVertical) {\n            position = fabs(left - point.y) < fabs(right - point.y) < (right ? prev : next);\n        } else {\n            position = fabs(left - point.x) < fabs(right - point.x) < (right ? prev : next);\n        }\n    }];\n    \n    if (position < _visibleRange.location) position = _visibleRange.location;\n    else if (position > _visibleRange.location + _visibleRange.length) position = _visibleRange.location + _visibleRange.length;\n    \n    if (!finalAffinityDetected) {\n        CGFloat ofs = [self offsetForTextPosition:position lineIndex:lineIndex];\n        if (ofs != CGFLOAT_MAX) {\n            BOOL RTL = [self _isRightToLeftInLine:line atPoint:point];\n            if (position >= line.range.location + line.range.length) {\n                finalAffinity = RTL ? YYTextAffinityForward : YYTextAffinityBackward;\n            } else if (position <= line.range.location) {\n                finalAffinity = RTL ? YYTextAffinityBackward : YYTextAffinityForward;\n            } else {\n                finalAffinity = (ofs < (isVertical ? point.y : point.x) && !RTL) ? YYTextAffinityForward : YYTextAffinityBackward;\n            }\n        }\n    }\n    \n    return [YYTextPosition positionWithOffset:position affinity:finalAffinity];\n}\n\n- (YYTextPosition *)positionForPoint:(CGPoint)point\n                         oldPosition:(YYTextPosition *)oldPosition\n                       otherPosition:(YYTextPosition *)otherPosition {\n    if (!oldPosition || !otherPosition) {\n        return oldPosition;\n    }\n    YYTextPosition *newPos = [self closestPositionToPoint:point];\n    if (!newPos) return oldPosition;\n    if ([newPos compare:otherPosition] == [oldPosition compare:otherPosition] &&\n        newPos.offset != otherPosition.offset) {\n        return newPos;\n    }\n    NSUInteger lineIndex = [self lineIndexForPosition:otherPosition];\n    if (lineIndex == NSNotFound) return oldPosition;\n    YYTextLine *line = _lines[lineIndex];\n    YYRowEdge vertical = _lineRowsEdge[line.row];\n    if (_container.verticalForm) {\n        point.x = (vertical.head + vertical.foot) * 0.5;\n    } else {\n        point.y = (vertical.head + vertical.foot) * 0.5;\n    }\n    newPos = [self closestPositionToPoint:point];\n    if ([newPos compare:otherPosition] == [oldPosition compare:otherPosition] &&\n        newPos.offset != otherPosition.offset) {\n        return newPos;\n    }\n    \n    if (_container.isVerticalForm) {\n        if ([oldPosition compare:otherPosition] == NSOrderedAscending) { // search backward\n            YYTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionUp offset:1];\n            if (range) return range.start;\n        } else { // search forward\n            YYTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionDown offset:1];\n            if (range) return range.end;\n        }\n    } else {\n        if ([oldPosition compare:otherPosition] == NSOrderedAscending) { // search backward\n            YYTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionLeft offset:1];\n            if (range) return range.start;\n        } else { // search forward\n            YYTextRange *range = [self textRangeByExtendingPosition:otherPosition inDirection:UITextLayoutDirectionRight offset:1];\n            if (range) return range.end;\n        }\n    }\n    \n    return oldPosition;\n}\n\n- (YYTextRange *)textRangeAtPoint:(CGPoint)point {\n    NSUInteger lineIndex = [self lineIndexForPoint:point];\n    if (lineIndex == NSNotFound) return nil;\n    NSUInteger textPosition = [self textPositionForPoint:point lineIndex:[self lineIndexForPoint:point]];\n    if (textPosition == NSNotFound) return nil;\n    YYTextPosition *pos = [self closestPositionToPoint:point];\n    if (!pos) return nil;\n    \n    // get write direction\n    BOOL RTL = [self _isRightToLeftInLine:_lines[lineIndex] atPoint:point];\n    CGRect rect = [self caretRectForPosition:pos];\n    if (CGRectIsNull(rect)) return nil;\n    \n    if (_container.verticalForm) {\n        YYTextRange *range = [self textRangeByExtendingPosition:pos inDirection:(rect.origin.y >= point.y && !RTL) ? UITextLayoutDirectionUp:UITextLayoutDirectionDown offset:1];\n        return range;\n    } else {\n        YYTextRange *range = [self textRangeByExtendingPosition:pos inDirection:(rect.origin.x >= point.x && !RTL) ? UITextLayoutDirectionLeft:UITextLayoutDirectionRight offset:1];\n        return range;\n    }\n}\n\n- (YYTextRange *)closestTextRangeAtPoint:(CGPoint)point {\n    YYTextPosition *pos = [self closestPositionToPoint:point];\n    if (!pos) return nil;\n    NSUInteger lineIndex = [self lineIndexForPosition:pos];\n    if (lineIndex == NSNotFound) return nil;\n    YYTextLine *line = _lines[lineIndex];\n    BOOL RTL = [self _isRightToLeftInLine:line atPoint:point];\n    CGRect rect = [self caretRectForPosition:pos];\n    if (CGRectIsNull(rect)) return nil;\n    \n    UITextLayoutDirection direction = UITextLayoutDirectionRight;\n    if (pos.offset >= line.range.location + line.range.length) {\n        if (direction != RTL) {\n            direction = _container.verticalForm ? UITextLayoutDirectionUp : UITextLayoutDirectionLeft;\n        } else {\n            direction = _container.verticalForm ? UITextLayoutDirectionDown : UITextLayoutDirectionRight;\n        }\n    } else if (pos.offset <= line.range.location) {\n        if (direction != RTL) {\n            direction = _container.verticalForm ? UITextLayoutDirectionDown : UITextLayoutDirectionRight;\n        } else {\n            direction = _container.verticalForm ? UITextLayoutDirectionUp : UITextLayoutDirectionLeft;\n        }\n    } else {\n        if (_container.verticalForm) {\n            direction = (rect.origin.y >= point.y && !RTL) ? UITextLayoutDirectionUp:UITextLayoutDirectionDown;\n        } else {\n            direction = (rect.origin.x >= point.x && !RTL) ? UITextLayoutDirectionLeft:UITextLayoutDirectionRight;\n        }\n    }\n    \n    YYTextRange *range = [self textRangeByExtendingPosition:pos inDirection:direction offset:1];\n    return range;\n}\n\n- (YYTextRange *)textRangeByExtendingPosition:(YYTextPosition *)position {\n    NSUInteger visibleStart = _visibleRange.location;\n    NSUInteger visibleEnd = _visibleRange.location + _visibleRange.length;\n    \n    if (!position) return nil;\n    if (position.offset < visibleStart || position.offset > visibleEnd) return nil;\n    \n    // head or tail, returns immediately\n    if (position.offset == visibleStart) {\n        return [YYTextRange rangeWithRange:NSMakeRange(position.offset, 0)];\n    } else if (position.offset == visibleEnd) {\n        return [YYTextRange rangeWithRange:NSMakeRange(position.offset, 0) affinity:YYTextAffinityBackward];\n    }\n    \n    // binding range\n    NSRange tRange;\n    YYTextBinding *binding = [_text attribute:YYTextBindingAttributeName atIndex:position.offset longestEffectiveRange:&tRange inRange:_visibleRange];\n    if (binding && tRange.length > 0 && tRange.location < position.offset) {\n        return [YYTextRange rangeWithRange:tRange];\n    }\n    \n    // inside emoji or composed character sequences\n    NSUInteger lineIndex = [self lineIndexForPosition:position];\n    if (lineIndex != NSNotFound) {\n        __block NSUInteger _prev, _next;\n        BOOL emoji = NO, seq = NO;\n        \n        YYTextLine *line = _lines[lineIndex];\n        emoji = [self _insideEmoji:line position:position.offset block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) {\n            _prev = prev;\n            _next = next;\n        }];\n        if (!emoji) {\n            seq = [self _insideComposedCharacterSequences:line position:position.offset block: ^(CGFloat left, CGFloat right, NSUInteger prev, NSUInteger next) {\n                _prev = prev;\n                _next = next;\n            }];\n        }\n        if (emoji || seq) {\n            return [YYTextRange rangeWithRange:NSMakeRange(_prev, _next - _prev)];\n        }\n    }\n    \n    // inside linebreak '\\r\\n'\n    if (position.offset > visibleStart && position.offset < visibleEnd) {\n        unichar c0 = [_text.string characterAtIndex:position.offset - 1];\n        if ((c0 == '\\r') && position.offset < visibleEnd) {\n            unichar c1 = [_text.string characterAtIndex:position.offset];\n            if (c1 == '\\n') {\n                return [YYTextRange rangeWithStart:[YYTextPosition positionWithOffset:position.offset - 1] end:[YYTextPosition positionWithOffset:position.offset + 1]];\n            }\n        }\n        if (YYTextIsLinebreakChar(c0) && position.affinity == YYTextAffinityBackward) {\n            NSString *str = [_text.string substringToIndex:position.offset];\n            NSUInteger len = YYTextLinebreakTailLength(str);\n            return [YYTextRange rangeWithStart:[YYTextPosition positionWithOffset:position.offset - len] end:[YYTextPosition positionWithOffset:position.offset]];\n        }\n    }\n    \n    return [YYTextRange rangeWithRange:NSMakeRange(position.offset, 0) affinity:position.affinity];\n}\n\n- (YYTextRange *)textRangeByExtendingPosition:(YYTextPosition *)position\n                                  inDirection:(UITextLayoutDirection)direction\n                                       offset:(NSInteger)offset {\n    NSInteger visibleStart = _visibleRange.location;\n    NSInteger visibleEnd = _visibleRange.location + _visibleRange.length;\n    \n    if (!position) return nil;\n    if (position.offset < visibleStart || position.offset > visibleEnd) return nil;\n    if (offset == 0) return [self textRangeByExtendingPosition:position];\n    \n    BOOL isVerticalForm = _container.verticalForm;\n    BOOL verticalMove, forwardMove;\n    \n    if (isVerticalForm) {\n        verticalMove = direction == UITextLayoutDirectionLeft || direction == UITextLayoutDirectionRight;\n        forwardMove = direction == UITextLayoutDirectionLeft || direction == UITextLayoutDirectionDown;\n    } else {\n        verticalMove = direction == UITextLayoutDirectionUp || direction == UITextLayoutDirectionDown;\n        forwardMove = direction == UITextLayoutDirectionDown || direction == UITextLayoutDirectionRight;\n    }\n    \n    if (offset < 0) {\n        forwardMove = !forwardMove;\n        offset = -offset;\n    }\n    \n    // head or tail, returns immediately\n    if (!forwardMove && position.offset == visibleStart) {\n        return [YYTextRange rangeWithRange:NSMakeRange(_visibleRange.location, 0)];\n    } else if (forwardMove && position.offset == visibleEnd) {\n        return [YYTextRange rangeWithRange:NSMakeRange(position.offset, 0) affinity:YYTextAffinityBackward];\n    }\n    \n    // extend from position\n    YYTextRange *fromRange = [self textRangeByExtendingPosition:position];\n    if (!fromRange) return nil;\n    YYTextRange *allForward = [YYTextRange rangeWithStart:fromRange.start end:[YYTextPosition positionWithOffset:visibleEnd]];\n    YYTextRange *allBackward = [YYTextRange rangeWithStart:[YYTextPosition positionWithOffset:visibleStart] end:fromRange.end];\n    \n    if (verticalMove) { // up/down in text layout\n        NSInteger lineIndex = [self lineIndexForPosition:position];\n        if (lineIndex == NSNotFound) return nil;\n        \n        YYTextLine *line = _lines[lineIndex];\n        NSInteger moveToRowIndex = (NSInteger)line.row + (forwardMove ? offset : -offset);\n        if (moveToRowIndex < 0) return allBackward;\n        else if (moveToRowIndex >= (NSInteger)_rowCount) return allForward;\n        \n        CGFloat ofs = [self offsetForTextPosition:position.offset lineIndex:lineIndex];\n        if (ofs == CGFLOAT_MAX) return nil;\n        \n        NSUInteger moveToLineFirstIndex = [self lineIndexForRow:moveToRowIndex];\n        NSUInteger moveToLineCount = [self lineCountForRow:moveToRowIndex];\n        if (moveToLineFirstIndex == NSNotFound || moveToLineCount == NSNotFound || moveToLineCount == 0) return nil;\n        CGFloat mostLeft = CGFLOAT_MAX, mostRight = -CGFLOAT_MAX;\n        YYTextLine *mostLeftLine = nil, *mostRightLine = nil;\n        NSUInteger insideIndex = NSNotFound;\n        for (NSUInteger i = 0; i < moveToLineCount; i++) {\n            NSUInteger lineIndex = moveToLineFirstIndex + i;\n            YYTextLine *line = _lines[lineIndex];\n            if (isVerticalForm) {\n                if (line.top <= ofs && ofs <= line.bottom) {\n                    insideIndex = line.index;\n                    break;\n                }\n                if (line.top < mostLeft) {\n                    mostLeft = line.top;\n                    mostLeftLine = line;\n                }\n                if (line.bottom > mostRight) {\n                    mostRight = line.bottom;\n                    mostRightLine = line;\n                }\n            } else {\n                if (line.left <= ofs && ofs <= line.right) {\n                    insideIndex = line.index;\n                    break;\n                }\n                if (line.left < mostLeft) {\n                    mostLeft = line.left;\n                    mostLeftLine = line;\n                }\n                if (line.right > mostRight) {\n                    mostRight = line.right;\n                    mostRightLine = line;\n                }\n            }\n        }\n        BOOL afinityEdge = NO;\n        if (insideIndex == NSNotFound) {\n            if (ofs <= mostLeft) {\n                insideIndex = mostLeftLine.index;\n            } else {\n                insideIndex = mostRightLine.index;\n            }\n            afinityEdge = YES;\n        }\n        YYTextLine *insideLine = _lines[insideIndex];\n        NSUInteger pos;\n        if (isVerticalForm) {\n            pos = [self textPositionForPoint:CGPointMake(insideLine.position.x, ofs) lineIndex:insideIndex];\n        } else {\n            pos = [self textPositionForPoint:CGPointMake(ofs, insideLine.position.y) lineIndex:insideIndex];\n        }\n        if (pos == NSNotFound) return nil;\n        YYTextPosition *extPos;\n        if (afinityEdge) {\n            if (pos == insideLine.range.location + insideLine.range.length) {\n                NSString *subStr = [_text.string substringWithRange:insideLine.range];\n                NSUInteger lineBreakLen = YYTextLinebreakTailLength(subStr);\n                extPos = [YYTextPosition positionWithOffset:pos - lineBreakLen];\n            } else {\n                extPos = [YYTextPosition positionWithOffset:pos];\n            }\n        } else {\n            extPos = [YYTextPosition positionWithOffset:pos];\n        }\n        YYTextRange *ext = [self textRangeByExtendingPosition:extPos];\n        if (!ext) return nil;\n        if (forwardMove) {\n            return [YYTextRange rangeWithStart:fromRange.start end:ext.end];\n        } else {\n            return [YYTextRange rangeWithStart:ext.start end:fromRange.end];\n        }\n        \n    } else { // left/right in text layout\n        YYTextPosition *toPosition = [YYTextPosition positionWithOffset:position.offset + (forwardMove ? offset : -offset)];\n        if (toPosition.offset <= visibleStart) return allBackward;\n        else if (toPosition.offset >= visibleEnd) return allForward;\n        \n        YYTextRange *toRange = [self textRangeByExtendingPosition:toPosition];\n        if (!toRange) return nil;\n        \n        NSInteger start = MIN(fromRange.start.offset, toRange.start.offset);\n        NSInteger end = MAX(fromRange.end.offset, toRange.end.offset);\n        return [YYTextRange rangeWithRange:NSMakeRange(start, end - start)];\n    }\n}\n\n- (NSUInteger)lineIndexForPosition:(YYTextPosition *)position {\n    if (!position) return NSNotFound;\n    if (_lines.count == 0) return NSNotFound;\n    NSUInteger location = position.offset;\n    NSInteger lo = 0, hi = _lines.count - 1, mid = 0;\n    if (position.affinity == YYTextAffinityBackward) {\n        while (lo <= hi) {\n            mid = (lo + hi) / 2;\n            YYTextLine *line = _lines[mid];\n            NSRange range = line.range;\n            if (range.location < location && location <= range.location + range.length) {\n                return mid;\n            }\n            if (location <= range.location) {\n                hi = mid - 1;\n            } else {\n                lo = mid + 1;\n            }\n        }\n    } else {\n        while (lo <= hi) {\n            mid = (lo + hi) / 2;\n            YYTextLine *line = _lines[mid];\n            NSRange range = line.range;\n            if (range.location <= location && location < range.location + range.length) {\n                return mid;\n            }\n            if (location < range.location) {\n                hi = mid - 1;\n            } else {\n                lo = mid + 1;\n            }\n        }\n    }\n    return NSNotFound;\n}\n\n- (CGPoint)linePositionForPosition:(YYTextPosition *)position {\n    NSUInteger lineIndex = [self lineIndexForPosition:position];\n    if (lineIndex == NSNotFound) return CGPointZero;\n    YYTextLine *line = _lines[lineIndex];\n    CGFloat offset = [self offsetForTextPosition:position.offset lineIndex:lineIndex];\n    if (offset == CGFLOAT_MAX) return CGPointZero;\n    if (_container.verticalForm) {\n        return CGPointMake(line.position.x, offset);\n    } else {\n        return CGPointMake(offset, line.position.y);\n    }\n}\n\n- (CGRect)caretRectForPosition:(YYTextPosition *)position {\n    NSUInteger lineIndex = [self lineIndexForPosition:position];\n    if (lineIndex == NSNotFound) return CGRectNull;\n    YYTextLine *line = _lines[lineIndex];\n    CGFloat offset = [self offsetForTextPosition:position.offset lineIndex:lineIndex];\n    if (offset == CGFLOAT_MAX) return CGRectNull;\n    if (_container.verticalForm) {\n        return CGRectMake(line.bounds.origin.x, offset, line.bounds.size.width, 0);\n    } else {\n        return CGRectMake(offset, line.bounds.origin.y, 0, line.bounds.size.height);\n    }\n}\n\n- (CGRect)firstRectForRange:(YYTextRange *)range {\n    range = [self _correctedRangeWithEdge:range];\n    \n    NSUInteger startLineIndex = [self lineIndexForPosition:range.start];\n    NSUInteger endLineIndex = [self lineIndexForPosition:range.end];\n    if (startLineIndex == NSNotFound || endLineIndex == NSNotFound) return CGRectNull;\n    if (startLineIndex > endLineIndex) return CGRectNull;\n    YYTextLine *startLine = _lines[startLineIndex];\n    YYTextLine *endLine = _lines[endLineIndex];\n    NSMutableArray *lines = [NSMutableArray new];\n    for (NSUInteger i = startLineIndex; i <= startLineIndex; i++) {\n        YYTextLine *line = _lines[i];\n        if (line.row != startLine.row) break;\n        [lines addObject:line];\n    }\n    if (_container.verticalForm) {\n        if (lines.count == 1) {\n            CGFloat top = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex];\n            CGFloat bottom;\n            if (startLine == endLine) {\n                bottom = [self offsetForTextPosition:range.end.offset lineIndex:startLineIndex];\n            } else {\n                bottom = startLine.bottom;\n            }\n            if (top == CGFLOAT_MAX || bottom == CGFLOAT_MAX) return CGRectNull;\n            if (top > bottom) YYTEXT_SWAP(top, bottom);\n            return CGRectMake(startLine.left, top, startLine.width, bottom - top);\n        } else {\n            CGFloat top = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex];\n            CGFloat bottom = startLine.bottom;\n            if (top == CGFLOAT_MAX || bottom == CGFLOAT_MAX) return CGRectNull;\n            if (top > bottom) YYTEXT_SWAP(top, bottom);\n            CGRect rect = CGRectMake(startLine.left, top, startLine.width, bottom - top);\n            for (NSUInteger i = 1; i < lines.count; i++) {\n                YYTextLine *line = lines[i];\n                rect = CGRectUnion(rect, line.bounds);\n            }\n            return rect;\n        }\n    } else {\n        if (lines.count == 1) {\n            CGFloat left = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex];\n            CGFloat right;\n            if (startLine == endLine) {\n                right = [self offsetForTextPosition:range.end.offset lineIndex:startLineIndex];\n            } else {\n                right = startLine.right;\n            }\n            if (left == CGFLOAT_MAX || right == CGFLOAT_MAX) return CGRectNull;\n            if (left > right) YYTEXT_SWAP(left, right);\n            return CGRectMake(left, startLine.top, right - left, startLine.height);\n        } else {\n            CGFloat left = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex];\n            CGFloat right = startLine.right;\n            if (left == CGFLOAT_MAX || right == CGFLOAT_MAX) return CGRectNull;\n            if (left > right) YYTEXT_SWAP(left, right);\n            CGRect rect = CGRectMake(left, startLine.top, right - left, startLine.height);\n            for (NSUInteger i = 1; i < lines.count; i++) {\n                YYTextLine *line = lines[i];\n                rect = CGRectUnion(rect, line.bounds);\n            }\n            return rect;\n        }\n    }\n}\n\n- (CGRect)rectForRange:(YYTextRange *)range {\n    NSArray *rects = [self selectionRectsForRange:range];\n    if (rects.count == 0) return CGRectNull;\n    CGRect rectUnion = ((YYTextSelectionRect *)rects.firstObject).rect;\n    for (NSUInteger i = 1; i < rects.count; i++) {\n        YYTextSelectionRect *rect = rects[i];\n        rectUnion = CGRectUnion(rectUnion, rect.rect);\n    }\n    return rectUnion;\n}\n\n- (NSArray *)selectionRectsForRange:(YYTextRange *)range {\n    range = [self _correctedRangeWithEdge:range];\n    \n    BOOL isVertical = _container.verticalForm;\n    NSMutableArray *rects = [NSMutableArray array];\n    if (!range) return rects;\n    \n    NSUInteger startLineIndex = [self lineIndexForPosition:range.start];\n    NSUInteger endLineIndex = [self lineIndexForPosition:range.end];\n    if (startLineIndex == NSNotFound || endLineIndex == NSNotFound) return rects;\n    if (startLineIndex > endLineIndex) YYTEXT_SWAP(startLineIndex, endLineIndex);\n    YYTextLine *startLine = _lines[startLineIndex];\n    YYTextLine *endLine = _lines[endLineIndex];\n    CGFloat offsetStart = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex];\n    CGFloat offsetEnd = [self offsetForTextPosition:range.end.offset lineIndex:endLineIndex];\n    \n    YYTextSelectionRect *start = [YYTextSelectionRect new];\n    if (isVertical) {\n        start.rect = CGRectMake(startLine.left, offsetStart, startLine.width, 0);\n    } else {\n        start.rect = CGRectMake(offsetStart, startLine.top, 0, startLine.height);\n    }\n    start.containsStart = YES;\n    start.isVertical = isVertical;\n    [rects addObject:start];\n    \n    YYTextSelectionRect *end = [YYTextSelectionRect new];\n    if (isVertical) {\n        end.rect = CGRectMake(endLine.left, offsetEnd, endLine.width, 0);\n    } else {\n        end.rect = CGRectMake(offsetEnd, endLine.top, 0, endLine.height);\n    }\n    end.containsEnd = YES;\n    end.isVertical = isVertical;\n    [rects addObject:end];\n    \n    if (startLine.row == endLine.row) { // same row\n        if (offsetStart > offsetEnd) YYTEXT_SWAP(offsetStart, offsetEnd);\n        YYTextSelectionRect *rect = [YYTextSelectionRect new];\n        if (isVertical) {\n            rect.rect = CGRectMake(startLine.bounds.origin.x, offsetStart, MAX(startLine.width, endLine.width), offsetEnd - offsetStart);\n        } else {\n            rect.rect = CGRectMake(offsetStart, startLine.bounds.origin.y, offsetEnd - offsetStart, MAX(startLine.height, endLine.height));\n        }\n        rect.isVertical = isVertical;\n        [rects addObject:rect];\n        \n    } else { // more than one row\n        \n        // start line select rect\n        YYTextSelectionRect *topRect = [YYTextSelectionRect new];\n        topRect.isVertical = isVertical;\n        CGFloat topOffset = [self offsetForTextPosition:range.start.offset lineIndex:startLineIndex];\n        CTRunRef topRun = [self _runForLine:startLine position:range.start];\n        if (topRun && (CTRunGetStatus(topRun) & kCTRunStatusRightToLeft)) {\n            if (isVertical) {\n                topRect.rect = CGRectMake(startLine.left, _container.path ? startLine.top : _container.insets.top, startLine.width, topOffset - startLine.top);\n            } else {\n                topRect.rect = CGRectMake(_container.path ? startLine.left : _container.insets.left, startLine.top, topOffset - startLine.left, startLine.height);\n            }\n            topRect.writingDirection = UITextWritingDirectionRightToLeft;\n        } else {\n            if (isVertical) {\n                topRect.rect = CGRectMake(startLine.left, topOffset, startLine.width, (_container.path ? startLine.bottom : _container.size.height - _container.insets.bottom) - topOffset);\n            } else {\n                topRect.rect = CGRectMake(topOffset, startLine.top, (_container.path ? startLine.right : _container.size.width - _container.insets.right) - topOffset, startLine.height);\n            }\n        }\n        [rects addObject:topRect];\n        \n        // end line select rect\n        YYTextSelectionRect *bottomRect = [YYTextSelectionRect new];\n        bottomRect.isVertical = isVertical;\n        CGFloat bottomOffset = [self offsetForTextPosition:range.end.offset lineIndex:endLineIndex];\n        CTRunRef bottomRun = [self _runForLine:endLine position:range.end];\n        if (bottomRun && (CTRunGetStatus(bottomRun) & kCTRunStatusRightToLeft)) {\n            if (isVertical) {\n                bottomRect.rect = CGRectMake(endLine.left, bottomOffset, endLine.width, (_container.path ? endLine.bottom : _container.size.height - _container.insets.bottom) - bottomOffset);\n            } else {\n                bottomRect.rect = CGRectMake(bottomOffset, endLine.top, (_container.path ? endLine.right : _container.size.width - _container.insets.right) - bottomOffset, endLine.height);\n            }\n            bottomRect.writingDirection = UITextWritingDirectionRightToLeft;\n        } else {\n            if (isVertical) {\n                CGFloat top = _container.path ? endLine.top : _container.insets.top;\n                bottomRect.rect = CGRectMake(endLine.left, top, endLine.width, bottomOffset - top);\n            } else {\n                CGFloat left = _container.path ? endLine.left : _container.insets.left;\n                bottomRect.rect = CGRectMake(left, endLine.top, bottomOffset - left, endLine.height);\n            }\n        }\n        [rects addObject:bottomRect];\n        \n        if (endLineIndex - startLineIndex >= 2) {\n            CGRect r = CGRectZero;\n            BOOL startLineDetected = NO;\n            for (NSUInteger l = startLineIndex + 1; l < endLineIndex; l++) {\n                YYTextLine *line = _lines[l];\n                if (line.row == startLine.row || line.row == endLine.row) continue;\n                if (!startLineDetected) {\n                    r = line.bounds;\n                    startLineDetected = YES;\n                } else {\n                    r = CGRectUnion(r, line.bounds);\n                }\n            }\n            if (startLineDetected) {\n                if (isVertical) {\n                    if (!_container.path) {\n                        r.origin.y = _container.insets.top;\n                        r.size.height = _container.size.height - _container.insets.bottom - _container.insets.top;\n                    }\n                    r.size.width =  CGRectGetMinX(topRect.rect) - CGRectGetMaxX(bottomRect.rect);\n                    r.origin.x = CGRectGetMaxX(bottomRect.rect);\n                } else {\n                    if (!_container.path) {\n                        r.origin.x = _container.insets.left;\n                        r.size.width = _container.size.width - _container.insets.right - _container.insets.left;\n                    }\n                    r.origin.y = CGRectGetMaxY(topRect.rect);\n                    r.size.height = bottomRect.rect.origin.y - r.origin.y;\n                }\n                \n                YYTextSelectionRect *rect = [YYTextSelectionRect new];\n                rect.rect = r;\n                rect.isVertical = isVertical;\n                [rects addObject:rect];\n            }\n        } else {\n            if (isVertical) {\n                CGRect r0 = bottomRect.rect;\n                CGRect r1 = topRect.rect;\n                CGFloat mid = (CGRectGetMaxX(r0) + CGRectGetMinX(r1)) * 0.5;\n                r0.size.width = mid - r0.origin.x;\n                CGFloat r1ofs = r1.origin.x - mid;\n                r1.origin.x -= r1ofs;\n                r1.size.width += r1ofs;\n                topRect.rect = r1;\n                bottomRect.rect = r0;\n            } else {\n                CGRect r0 = topRect.rect;\n                CGRect r1 = bottomRect.rect;\n                CGFloat mid = (CGRectGetMaxY(r0) + CGRectGetMinY(r1)) * 0.5;\n                r0.size.height = mid - r0.origin.y;\n                CGFloat r1ofs = r1.origin.y - mid;\n                r1.origin.y -= r1ofs;\n                r1.size.height += r1ofs;\n                topRect.rect = r0;\n                bottomRect.rect = r1;\n            }\n        }\n    }\n    return rects;\n}\n\n- (NSArray *)selectionRectsWithoutStartAndEndForRange:(YYTextRange *)range {\n    NSMutableArray *rects = [self selectionRectsForRange:range].mutableCopy;\n    for (NSInteger i = 0, max = rects.count; i < max; i++) {\n        YYTextSelectionRect *rect = rects[i];\n        if (rect.containsStart || rect.containsEnd) {\n            [rects removeObjectAtIndex:i];\n            i--;\n            max--;\n        }\n    }\n    return rects;\n}\n\n- (NSArray *)selectionRectsWithOnlyStartAndEndForRange:(YYTextRange *)range {\n    NSMutableArray *rects = [self selectionRectsForRange:range].mutableCopy;\n    for (NSInteger i = 0, max = rects.count; i < max; i++) {\n        YYTextSelectionRect *rect = rects[i];\n        if (!rect.containsStart && !rect.containsEnd) {\n            [rects removeObjectAtIndex:i];\n            i--;\n            max--;\n        }\n    }\n    return rects;\n}\n\n\n#pragma mark - Draw\n\n\ntypedef NS_OPTIONS(NSUInteger, YYTextDecorationType) {\n    YYTextDecorationTypeUnderline     = 1 << 0,\n    YYTextDecorationTypeStrikethrough = 1 << 1,\n};\n\ntypedef NS_OPTIONS(NSUInteger, YYTextBorderType) {\n    YYTextBorderTypeBackgound = 1 << 0,\n    YYTextBorderTypeNormal    = 1 << 1,\n};\n\nstatic CGRect YYTextMergeRectInSameLine(CGRect rect1, CGRect rect2, BOOL isVertical) {\n    if (isVertical) {\n        CGFloat top = MIN(rect1.origin.y, rect2.origin.y);\n        CGFloat bottom = MAX(rect1.origin.y + rect1.size.height, rect2.origin.y + rect2.size.height);\n        CGFloat width = MAX(rect1.size.width, rect2.size.width);\n        return CGRectMake(rect1.origin.x, top, width, bottom - top);\n    } else {\n        CGFloat left = MIN(rect1.origin.x, rect2.origin.x);\n        CGFloat right = MAX(rect1.origin.x + rect1.size.width, rect2.origin.x + rect2.size.width);\n        CGFloat height = MAX(rect1.size.height, rect2.size.height);\n        return CGRectMake(left, rect1.origin.y, right - left, height);\n    }\n}\n\nstatic void YYTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *underlinePosition, CGFloat *lineThickness) {\n    CGFloat maxXHeight = 0;\n    CGFloat maxUnderlinePos = 0;\n    CGFloat maxLineThickness = 0;\n    for (NSUInteger i = 0, max = CFArrayGetCount(runs); i < max; i++) {\n        CTRunRef run = CFArrayGetValueAtIndex(runs, i);\n        CFDictionaryRef attrs = CTRunGetAttributes(run);\n        if (attrs) {\n            CTFontRef font = CFDictionaryGetValue(attrs, kCTFontAttributeName);\n            if (font) {\n                CGFloat xHeight = CTFontGetXHeight(font);\n                if (xHeight > maxXHeight) maxXHeight = xHeight;\n                CGFloat underlinePos = CTFontGetUnderlinePosition(font);\n                if (underlinePos < maxUnderlinePos) maxUnderlinePos = underlinePos;\n                CGFloat lineThickness = CTFontGetUnderlineThickness(font);\n                if (lineThickness > maxLineThickness) maxLineThickness = lineThickness;\n            }\n        }\n    }\n    if (xHeight) *xHeight = maxXHeight;\n    if (underlinePosition) *underlinePosition = maxUnderlinePos;\n    if (lineThickness) *lineThickness = maxLineThickness;\n}\n\nstatic void YYTextDrawRun(YYTextLine *line, CTRunRef run, CGContextRef context, CGSize size, BOOL isVertical, NSArray *runRanges, CGFloat verticalOffset) {\n    CGAffineTransform runTextMatrix = CTRunGetTextMatrix(run);\n    BOOL runTextMatrixIsID = CGAffineTransformIsIdentity(runTextMatrix);\n    \n    CFDictionaryRef runAttrs = CTRunGetAttributes(run);\n    NSValue *glyphTransformValue = CFDictionaryGetValue(runAttrs, (__bridge const void *)(YYTextGlyphTransformAttributeName));\n    if (!isVertical && !glyphTransformValue) { // draw run\n        if (!runTextMatrixIsID) {\n            CGContextSaveGState(context);\n            CGAffineTransform trans = CGContextGetTextMatrix(context);\n            CGContextSetTextMatrix(context, CGAffineTransformConcat(trans, runTextMatrix));\n        }\n        CTRunDraw(run, context, CFRangeMake(0, 0));\n        if (!runTextMatrixIsID) {\n            CGContextRestoreGState(context);\n        }\n    } else { // draw glyph\n        CTFontRef runFont = CFDictionaryGetValue(runAttrs, kCTFontAttributeName);\n        if (!runFont) return;\n        NSUInteger glyphCount = CTRunGetGlyphCount(run);\n        if (glyphCount <= 0) return;\n        \n        CGGlyph glyphs[glyphCount];\n        CGPoint glyphPositions[glyphCount];\n        CTRunGetGlyphs(run, CFRangeMake(0, 0), glyphs);\n        CTRunGetPositions(run, CFRangeMake(0, 0), glyphPositions);\n        \n        CGColorRef fillColor = (CGColorRef)CFDictionaryGetValue(runAttrs, kCTForegroundColorAttributeName);\n        fillColor = YYTextGetCGColor(fillColor);\n        NSNumber *strokeWidth = CFDictionaryGetValue(runAttrs, kCTStrokeWidthAttributeName);\n        \n        CGContextSaveGState(context); {\n            CGContextSetFillColorWithColor(context, fillColor);\n            if (!strokeWidth || strokeWidth.floatValue == 0) {\n                CGContextSetTextDrawingMode(context, kCGTextFill);\n            } else {\n                CGColorRef strokeColor = (CGColorRef)CFDictionaryGetValue(runAttrs, kCTStrokeColorAttributeName);\n                if (!strokeColor) strokeColor = fillColor;\n                CGContextSetStrokeColorWithColor(context, strokeColor);\n                CGContextSetLineWidth(context, CTFontGetSize(runFont) * fabs(strokeWidth.floatValue * 0.01));\n                if (strokeWidth.floatValue > 0) {\n                    CGContextSetTextDrawingMode(context, kCGTextStroke);\n                } else {\n                    CGContextSetTextDrawingMode(context, kCGTextFillStroke);\n                }\n            }\n            \n            if (isVertical) {\n                CFIndex runStrIdx[glyphCount + 1];\n                CTRunGetStringIndices(run, CFRangeMake(0, 0), runStrIdx);\n                CFRange runStrRange = CTRunGetStringRange(run);\n                runStrIdx[glyphCount] = runStrRange.location + runStrRange.length;\n                CGSize glyphAdvances[glyphCount];\n                CTRunGetAdvances(run, CFRangeMake(0, 0), glyphAdvances);\n                CGFloat ascent = CTFontGetAscent(runFont);\n                CGFloat descent = CTFontGetDescent(runFont);\n                CGAffineTransform glyphTransform = glyphTransformValue.CGAffineTransformValue;\n                CGPoint zeroPoint = CGPointZero;\n                \n                for (YYTextRunGlyphRange *oneRange in runRanges) {\n                    NSRange range = oneRange.glyphRangeInRun;\n                    NSUInteger rangeMax = range.location + range.length;\n                    YYTextRunGlyphDrawMode mode = oneRange.drawMode;\n                    \n                    for (NSUInteger g = range.location; g < rangeMax; g++) {\n                        CGContextSaveGState(context); {\n                            CGContextSetTextMatrix(context, CGAffineTransformIdentity);\n                            if (glyphTransformValue) {\n                                CGContextSetTextMatrix(context, glyphTransform);\n                            }\n                            if (mode) { // CJK glyph, need rotated\n                                CGFloat ofs = (ascent - descent) * 0.5;\n                                CGFloat w = glyphAdvances[g].width * 0.5;\n                                CGFloat x = x = line.position.x + verticalOffset + glyphPositions[g].y + (ofs - w);\n                                CGFloat y = -line.position.y + size.height - glyphPositions[g].x - (ofs + w);\n                                if (mode == YYTextRunGlyphDrawModeVerticalRotateMove) {\n                                    x += w;\n                                    y += w;\n                                }\n                                CGContextSetTextPosition(context, x, y);\n                            } else {\n                                CGContextRotateCTM(context, YYTextDegreesToRadians(-90));\n                                CGContextSetTextPosition(context,\n                                                         line.position.y - size.height + glyphPositions[g].x,\n                                                         line.position.x + verticalOffset + glyphPositions[g].y);\n                            }\n                            \n                            if (YYTextCTFontContainsColorBitmapGlyphs(runFont)) {\n                                CTFontDrawGlyphs(runFont, glyphs + g, &zeroPoint, 1, context);\n                            } else {\n                                CGFontRef cgFont = CTFontCopyGraphicsFont(runFont, NULL);\n                                CGContextSetFont(context, cgFont);\n                                CGContextSetFontSize(context, CTFontGetSize(runFont));\n                                CGContextShowGlyphsAtPositions(context, glyphs + g, &zeroPoint, 1);\n                                CGFontRelease(cgFont);\n                            }\n                        } CGContextRestoreGState(context);\n                    }\n                }\n            } else { // not vertical\n                if (glyphTransformValue) {\n                    CFIndex runStrIdx[glyphCount + 1];\n                    CTRunGetStringIndices(run, CFRangeMake(0, 0), runStrIdx);\n                    CFRange runStrRange = CTRunGetStringRange(run);\n                    runStrIdx[glyphCount] = runStrRange.location + runStrRange.length;\n                    CGSize glyphAdvances[glyphCount];\n                    CTRunGetAdvances(run, CFRangeMake(0, 0), glyphAdvances);\n                    CGAffineTransform glyphTransform = glyphTransformValue.CGAffineTransformValue;\n                    CGPoint zeroPoint = CGPointZero;\n                    \n                    for (NSUInteger g = 0; g < glyphCount; g++) {\n                        CGContextSaveGState(context); {\n                            CGContextSetTextMatrix(context, CGAffineTransformIdentity);\n                            CGContextSetTextMatrix(context, glyphTransform);\n                            CGContextSetTextPosition(context,\n                                                     line.position.x + glyphPositions[g].x,\n                                                     size.height - (line.position.y + glyphPositions[g].y));\n                            \n                            if (YYTextCTFontContainsColorBitmapGlyphs(runFont)) {\n                                CTFontDrawGlyphs(runFont, glyphs + g, &zeroPoint, 1, context);\n                            } else {\n                                CGFontRef cgFont = CTFontCopyGraphicsFont(runFont, NULL);\n                                CGContextSetFont(context, cgFont);\n                                CGContextSetFontSize(context, CTFontGetSize(runFont));\n                                CGContextShowGlyphsAtPositions(context, glyphs + g, &zeroPoint, 1);\n                                CGFontRelease(cgFont);\n                            }\n                        } CGContextRestoreGState(context);\n                    }\n                } else {\n                    if (YYTextCTFontContainsColorBitmapGlyphs(runFont)) {\n                        CTFontDrawGlyphs(runFont, glyphs, glyphPositions, glyphCount, context);\n                    } else {\n                        CGFontRef cgFont = CTFontCopyGraphicsFont(runFont, NULL);\n                        CGContextSetFont(context, cgFont);\n                        CGContextSetFontSize(context, CTFontGetSize(runFont));\n                        CGContextShowGlyphsAtPositions(context, glyphs, glyphPositions, glyphCount);\n                        CGFontRelease(cgFont);\n                    }\n                }\n            }\n            \n        } CGContextRestoreGState(context);\n    }\n}\n\nstatic void YYTextSetLinePatternInContext(YYTextLineStyle style, CGFloat width, CGFloat phase, CGContextRef context){\n    CGContextSetLineWidth(context, width);\n    CGContextSetLineCap(context, kCGLineCapButt);\n    CGContextSetLineJoin(context, kCGLineJoinMiter);\n    \n    CGFloat dash = 12, dot = 5, space = 3;\n    NSUInteger pattern = style & 0xF00;\n    if (pattern == YYTextLineStylePatternSolid) {\n        CGContextSetLineDash(context, phase, NULL, 0);\n    } else if (pattern == YYTextLineStylePatternDot) {\n        CGFloat lengths[2] = {width * dot, width * space};\n        CGContextSetLineDash(context, phase, lengths, 2);\n    } else if (pattern == YYTextLineStylePatternDash) {\n        CGFloat lengths[2] = {width * dash, width * space};\n        CGContextSetLineDash(context, phase, lengths, 2);\n    } else if (pattern == YYTextLineStylePatternDashDot) {\n        CGFloat lengths[4] = {width * dash, width * space, width * dot, width * space};\n        CGContextSetLineDash(context, phase, lengths, 4);\n    } else if (pattern == YYTextLineStylePatternDashDotDot) {\n        CGFloat lengths[6] = {width * dash, width * space,width * dot, width * space, width * dot, width * space};\n        CGContextSetLineDash(context, phase, lengths, 6);\n    } else if (pattern == YYTextLineStylePatternCircleDot) {\n        CGFloat lengths[2] = {width * 0, width * 3};\n        CGContextSetLineDash(context, phase, lengths, 2);\n        CGContextSetLineCap(context, kCGLineCapRound);\n        CGContextSetLineJoin(context, kCGLineJoinRound);\n    }\n}\n\n\nstatic void YYTextDrawBorderRects(CGContextRef context, CGSize size, YYTextBorder *border, NSArray *rects, BOOL isVertical) {\n    if (rects.count == 0) return;\n    \n    YYTextShadow *shadow = border.shadow;\n    if (shadow.color) {\n        CGContextSaveGState(context);\n        CGContextSetShadowWithColor(context, shadow.offset, shadow.radius, shadow.color.CGColor);\n        CGContextBeginTransparencyLayer(context, NULL);\n    }\n    \n    NSMutableArray *paths = [NSMutableArray new];\n    for (NSValue *value in rects) {\n        CGRect rect = value.CGRectValue;\n        if (isVertical) {\n            rect = UIEdgeInsetsInsetRect(rect, UIEdgeInsetRotateVertical(border.insets));\n        } else {\n            rect = UIEdgeInsetsInsetRect(rect, border.insets);\n        }\n        rect = YYTextCGRectPixelRound(rect);\n        UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius];\n        [path closePath];\n        [paths addObject:path];\n    }\n    \n    if (border.fillColor) {\n        CGContextSaveGState(context);\n        CGContextSetFillColorWithColor(context, border.fillColor.CGColor);\n        for (UIBezierPath *path in paths) {\n            CGContextAddPath(context, path.CGPath);\n        }\n        CGContextFillPath(context);\n        CGContextRestoreGState(context);\n    }\n    \n    if (border.strokeColor && border.lineStyle > 0 && border.strokeWidth > 0) {\n        \n        //-------------------------- single line ------------------------------//\n        CGContextSaveGState(context);\n        for (UIBezierPath *path in paths) {\n            CGRect bounds = CGRectUnion(path.bounds, (CGRect){CGPointZero, size});\n            bounds = CGRectInset(bounds, -2 * border.strokeWidth, -2 * border.strokeWidth);\n            CGContextAddRect(context, bounds);\n            CGContextAddPath(context, path.CGPath);\n            CGContextEOClip(context);\n        }\n        [border.strokeColor setStroke];\n        YYTextSetLinePatternInContext(border.lineStyle, border.strokeWidth, 0, context);\n        CGFloat inset = -border.strokeWidth * 0.5;\n        if ((border.lineStyle & 0xFF) == YYTextLineStyleThick) {\n            inset *= 2;\n            CGContextSetLineWidth(context, border.strokeWidth * 2);\n        }\n        CGFloat radiusDelta = -inset;\n        if (border.cornerRadius <= 0) {\n            radiusDelta = 0;\n        }\n        CGContextSetLineJoin(context, border.lineJoin);\n        for (NSValue *value in rects) {\n            CGRect rect = value.CGRectValue;\n            if (isVertical) {\n                rect = UIEdgeInsetsInsetRect(rect, UIEdgeInsetRotateVertical(border.insets));\n            } else {\n                rect = UIEdgeInsetsInsetRect(rect, border.insets);\n            }\n            rect = CGRectInset(rect, inset, inset);\n            UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius + radiusDelta];\n            [path closePath];\n            CGContextAddPath(context, path.CGPath);\n        }\n        CGContextStrokePath(context);\n        CGContextRestoreGState(context);\n        \n        //------------------------- second line ------------------------------//\n        if ((border.lineStyle & 0xFF) == YYTextLineStyleDouble) {\n            CGContextSaveGState(context);\n            CGFloat inset = -border.strokeWidth * 2;\n            for (NSValue *value in rects) {\n                CGRect rect = value.CGRectValue;\n                rect = UIEdgeInsetsInsetRect(rect, border.insets);\n                rect = CGRectInset(rect, inset, inset);\n                UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius + 2 * border.strokeWidth];\n                [path closePath];\n                \n                CGRect bounds = CGRectUnion(path.bounds, (CGRect){CGPointZero, size});\n                bounds = CGRectInset(bounds, -2 * border.strokeWidth, -2 * border.strokeWidth);\n                CGContextAddRect(context, bounds);\n                CGContextAddPath(context, path.CGPath);\n                CGContextEOClip(context);\n            }\n            CGContextSetStrokeColorWithColor(context, border.strokeColor.CGColor);\n            YYTextSetLinePatternInContext(border.lineStyle, border.strokeWidth, 0, context);\n            CGContextSetLineJoin(context, border.lineJoin);\n            inset = -border.strokeWidth * 2.5;\n            radiusDelta = border.strokeWidth * 2;\n            if (border.cornerRadius <= 0) {\n                radiusDelta = 0;\n            }\n            for (NSValue *value in rects) {\n                CGRect rect = value.CGRectValue;\n                rect = UIEdgeInsetsInsetRect(rect, border.insets);\n                rect = CGRectInset(rect, inset, inset);\n                UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:border.cornerRadius + radiusDelta];\n                [path closePath];\n                CGContextAddPath(context, path.CGPath);\n            }\n            CGContextStrokePath(context);\n            CGContextRestoreGState(context);\n        }\n    }\n    \n    if (shadow.color) {\n        CGContextEndTransparencyLayer(context);\n        CGContextRestoreGState(context);\n    }\n}\n\nstatic void YYTextDrawLineStyle(CGContextRef context, CGFloat length, CGFloat lineWidth, YYTextLineStyle style, CGPoint position, CGColorRef color, BOOL isVertical) {\n    NSUInteger styleBase = style & 0xFF;\n    if (styleBase == 0) return;\n    \n    CGContextSaveGState(context); {\n        if (isVertical) {\n            CGFloat x, y1, y2, w;\n            y1 = YYTextCGFloatPixelRound(position.y);\n            y2 = YYTextCGFloatPixelRound(position.y + length);\n            w = (styleBase == YYTextLineStyleThick ? lineWidth * 2 : lineWidth);\n            \n            CGFloat linePixel = YYTextCGFloatToPixel(w);\n            if (fabs(linePixel - floor(linePixel)) < 0.1) {\n                int iPixel = linePixel;\n                if (iPixel == 0 || (iPixel % 2)) { // odd line pixel\n                    x = YYTextCGFloatPixelHalf(position.x);\n                } else {\n                    x = YYTextCGFloatPixelFloor(position.x);\n                }\n            } else {\n                x = position.x;\n            }\n            \n            CGContextSetStrokeColorWithColor(context, color);\n            YYTextSetLinePatternInContext(style, lineWidth, position.y, context);\n            CGContextSetLineWidth(context, w);\n            if (styleBase == YYTextLineStyleSingle) {\n                CGContextMoveToPoint(context, x, y1);\n                CGContextAddLineToPoint(context, x, y2);\n                CGContextStrokePath(context);\n            } else if (styleBase == YYTextLineStyleThick) {\n                CGContextMoveToPoint(context, x, y1);\n                CGContextAddLineToPoint(context, x, y2);\n                CGContextStrokePath(context);\n            } else if (styleBase == YYTextLineStyleDouble) {\n                CGContextMoveToPoint(context, x - w, y1);\n                CGContextAddLineToPoint(context, x - w, y2);\n                CGContextStrokePath(context);\n                CGContextMoveToPoint(context, x + w, y1);\n                CGContextAddLineToPoint(context, x + w, y2);\n                CGContextStrokePath(context);\n            }\n        } else {\n            CGFloat x1, x2, y, w;\n            x1 = YYTextCGFloatPixelRound(position.x);\n            x2 = YYTextCGFloatPixelRound(position.x + length);\n            w = (styleBase == YYTextLineStyleThick ? lineWidth * 2 : lineWidth);\n            \n            CGFloat linePixel = YYTextCGFloatToPixel(w);\n            if (fabs(linePixel - floor(linePixel)) < 0.1) {\n                int iPixel = linePixel;\n                if (iPixel == 0 || (iPixel % 2)) { // odd line pixel\n                    y = YYTextCGFloatPixelHalf(position.y);\n                } else {\n                    y = YYTextCGFloatPixelFloor(position.y);\n                }\n            } else {\n                y = position.y;\n            }\n            \n            CGContextSetStrokeColorWithColor(context, color);\n            YYTextSetLinePatternInContext(style, lineWidth, position.x, context);\n            CGContextSetLineWidth(context, w);\n            if (styleBase == YYTextLineStyleSingle) {\n                CGContextMoveToPoint(context, x1, y);\n                CGContextAddLineToPoint(context, x2, y);\n                CGContextStrokePath(context);\n            } else if (styleBase == YYTextLineStyleThick) {\n                CGContextMoveToPoint(context, x1, y);\n                CGContextAddLineToPoint(context, x2, y);\n                CGContextStrokePath(context);\n            } else if (styleBase == YYTextLineStyleDouble) {\n                CGContextMoveToPoint(context, x1, y - w);\n                CGContextAddLineToPoint(context, x2, y - w);\n                CGContextStrokePath(context);\n                CGContextMoveToPoint(context, x1, y + w);\n                CGContextAddLineToPoint(context, x2, y + w);\n                CGContextStrokePath(context);\n            }\n        }\n    } CGContextRestoreGState(context);\n}\n\nstatic void YYTextDrawText(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) {\n    CGContextSaveGState(context); {\n        \n        CGContextTranslateCTM(context, point.x, point.y);\n        CGContextTranslateCTM(context, 0, size.height);\n        CGContextScaleCTM(context, 1, -1);\n        \n        BOOL isVertical = layout.container.verticalForm;\n        CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n        \n        NSArray *lines = layout.lines;\n        for (NSUInteger l = 0, lMax = lines.count; l < lMax; l++) {\n            YYTextLine *line = lines[l];\n            if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine;\n            NSArray *lineRunRanges = line.verticalRotateRange;\n            CGFloat posX = line.position.x + verticalOffset;\n            CGFloat posY = size.height - line.position.y;\n            CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n            for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n                CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n                CGContextSetTextMatrix(context, CGAffineTransformIdentity);\n                CGContextSetTextPosition(context, posX, posY);\n                YYTextDrawRun(line, run, context, size, isVertical, lineRunRanges[r], verticalOffset);\n            }\n            if (cancel && cancel()) break;\n        }\n        \n        // Use this to draw frame for test/debug.\n        // CGContextTranslateCTM(context, verticalOffset, size.height);\n        // CTFrameDraw(layout.frame, context);\n        \n    } CGContextRestoreGState(context);\n}\n\nstatic void YYTextDrawBlockBorder(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) {\n    CGContextSaveGState(context);\n    CGContextTranslateCTM(context, point.x, point.y);\n    \n    BOOL isVertical = layout.container.verticalForm;\n    CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n    \n    NSArray *lines = layout.lines;\n    for (NSInteger l = 0, lMax = lines.count; l < lMax; l++) {\n        if (cancel && cancel()) break;\n        \n        YYTextLine *line = lines[l];\n        if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine;\n        CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n        for (NSInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n            CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n            CFIndex glyphCount = CTRunGetGlyphCount(run);\n            if (glyphCount == 0) continue;\n            NSDictionary *attrs = (id)CTRunGetAttributes(run);\n            YYTextBorder *border = attrs[YYTextBlockBorderAttributeName];\n            if (!border) continue;\n            \n            NSUInteger lineStartIndex = line.index;\n            while (lineStartIndex > 0) {\n                if (((YYTextLine *)lines[lineStartIndex - 1]).row == line.row) lineStartIndex--;\n                else break;\n            }\n            \n            CGRect unionRect = CGRectZero;\n            NSUInteger lineStartRow = ((YYTextLine *)lines[lineStartIndex]).row;\n            NSUInteger lineContinueIndex = lineStartIndex;\n            NSUInteger lineContinueRow = lineStartRow;\n            do {\n                YYTextLine *one = lines[lineContinueIndex];\n                if (lineContinueIndex == lineStartIndex) {\n                    unionRect = one.bounds;\n                } else {\n                    unionRect = CGRectUnion(unionRect, one.bounds);\n                }\n                if (lineContinueIndex + 1 == lMax) break;\n                YYTextLine *next = lines[lineContinueIndex + 1];\n                if (next.row != lineContinueRow) {\n                    YYTextBorder *nextBorder = [layout.text yy_attribute:YYTextBlockBorderAttributeName atIndex:next.range.location];\n                    if ([nextBorder isEqual:border]) {\n                        lineContinueRow++;\n                    } else {\n                        break;\n                    }\n                }\n                lineContinueIndex++;\n            } while (true);\n            \n            if (isVertical) {\n                UIEdgeInsets insets = layout.container.insets;\n                unionRect.origin.y = insets.top;\n                unionRect.size.height = layout.container.size.height -insets.top - insets.bottom;\n            } else {\n                UIEdgeInsets insets = layout.container.insets;\n                unionRect.origin.x = insets.left;\n                unionRect.size.width = layout.container.size.width -insets.left - insets.right;\n            }\n            unionRect.origin.x += verticalOffset;\n            YYTextDrawBorderRects(context, size, border, @[[NSValue valueWithCGRect:unionRect]], isVertical);\n            \n            l = lineContinueIndex;\n            break;\n        }\n    }\n    \n    \n    CGContextRestoreGState(context);\n}\n\nstatic void YYTextDrawBorder(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, YYTextBorderType type, BOOL (^cancel)(void)) {\n    CGContextSaveGState(context);\n    CGContextTranslateCTM(context, point.x, point.y);\n    \n    BOOL isVertical = layout.container.verticalForm;\n    CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n    \n    NSArray *lines = layout.lines;\n    NSString *borderKey = (type == YYTextBorderTypeNormal ? YYTextBorderAttributeName : YYTextBackgroundBorderAttributeName);\n    \n    BOOL needJumpRun = NO;\n    NSUInteger jumpRunIndex = 0;\n    \n    for (NSInteger l = 0, lMax = lines.count; l < lMax; l++) {\n        if (cancel && cancel()) break;\n        \n        YYTextLine *line = lines[l];\n        if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine;\n        CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n        for (NSInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n            if (needJumpRun) {\n                needJumpRun = NO;\n                r = jumpRunIndex + 1;\n                if (r >= rMax) break;\n            }\n            \n            CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n            CFIndex glyphCount = CTRunGetGlyphCount(run);\n            if (glyphCount == 0) continue;\n            \n            NSDictionary *attrs = (id)CTRunGetAttributes(run);\n            YYTextBorder *border = attrs[borderKey];\n            if (!border) continue;\n            \n            CFRange runRange = CTRunGetStringRange(run);\n            if (runRange.location == kCFNotFound || runRange.length == 0) continue;\n            if (runRange.location + runRange.length > layout.text.length) continue;\n            \n            NSMutableArray *runRects = [NSMutableArray new];\n            NSInteger endLineIndex = l;\n            NSInteger endRunIndex = r;\n            BOOL endFound = NO;\n            for (NSInteger ll = l; ll < lMax; ll++) {\n                if (endFound) break;\n                YYTextLine *iLine = lines[ll];\n                CFArrayRef iRuns = CTLineGetGlyphRuns(iLine.CTLine);\n                \n                CGRect extLineRect = CGRectNull;\n                for (NSInteger rr = (ll == l) ? r : 0, rrMax = CFArrayGetCount(iRuns); rr < rrMax; rr++) {\n                    CTRunRef iRun = CFArrayGetValueAtIndex(iRuns, rr);\n                    NSDictionary *iAttrs = (id)CTRunGetAttributes(iRun);\n                    YYTextBorder *iBorder = iAttrs[borderKey];\n                    if (![border isEqual:iBorder]) {\n                        endFound = YES;\n                        break;\n                    }\n                    endLineIndex = ll;\n                    endRunIndex = rr;\n                    \n                    CGPoint iRunPosition = CGPointZero;\n                    CTRunGetPositions(iRun, CFRangeMake(0, 1), &iRunPosition);\n                    CGFloat ascent, descent;\n                    CGFloat iRunWidth = CTRunGetTypographicBounds(iRun, CFRangeMake(0, 0), &ascent, &descent, NULL);\n                    \n                    if (isVertical) {\n                        YYTEXT_SWAP(iRunPosition.x, iRunPosition.y);\n                        iRunPosition.y += iLine.position.y;\n                        CGRect iRect = CGRectMake(verticalOffset + line.position.x - descent, iRunPosition.y, ascent + descent, iRunWidth);\n                        if (CGRectIsNull(extLineRect)) {\n                            extLineRect = iRect;\n                        } else {\n                            extLineRect = CGRectUnion(extLineRect, iRect);\n                        }\n                    } else {\n                        iRunPosition.x += iLine.position.x;\n                        CGRect iRect = CGRectMake(iRunPosition.x, iLine.position.y - ascent, iRunWidth, ascent + descent);\n                        if (CGRectIsNull(extLineRect)) {\n                            extLineRect = iRect;\n                        } else {\n                            extLineRect = CGRectUnion(extLineRect, iRect);\n                        }\n                    }\n                }\n                \n                if (!CGRectIsNull(extLineRect)) {\n                    [runRects addObject:[NSValue valueWithCGRect:extLineRect]];\n                }\n            }\n            \n            NSMutableArray *drawRects = [NSMutableArray new];\n            CGRect curRect= ((NSValue *)[runRects firstObject]).CGRectValue;\n            for (NSInteger re = 0, reMax = runRects.count; re < reMax; re++) {\n                CGRect rect = ((NSValue *)runRects[re]).CGRectValue;\n                if (isVertical) {\n                    if (fabs(rect.origin.x - curRect.origin.x) < 1) {\n                        curRect = YYTextMergeRectInSameLine(rect, curRect, isVertical);\n                    } else {\n                        [drawRects addObject:[NSValue valueWithCGRect:curRect]];\n                        curRect = rect;\n                    }\n                } else {\n                    if (fabs(rect.origin.y - curRect.origin.y) < 1) {\n                        curRect = YYTextMergeRectInSameLine(rect, curRect, isVertical);\n                    } else {\n                        [drawRects addObject:[NSValue valueWithCGRect:curRect]];\n                        curRect = rect;\n                    }\n                }\n            }\n            if (!CGRectEqualToRect(curRect, CGRectZero)) {\n                [drawRects addObject:[NSValue valueWithCGRect:curRect]];\n            }\n            \n            YYTextDrawBorderRects(context, size, border, drawRects, isVertical);\n            \n            if (l == endLineIndex) {\n                r = endRunIndex;\n            } else {\n                l = endLineIndex - 1;\n                needJumpRun = YES;\n                jumpRunIndex = endRunIndex;\n                break;\n            }\n            \n        }\n    }\n    \n    CGContextRestoreGState(context);\n}\n\nstatic void YYTextDrawDecoration(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, YYTextDecorationType type, BOOL (^cancel)(void)) {\n    NSArray *lines = layout.lines;\n    \n    CGContextSaveGState(context);\n    CGContextTranslateCTM(context, point.x, point.y);\n    \n    BOOL isVertical = layout.container.verticalForm;\n    CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n    CGContextTranslateCTM(context, verticalOffset, 0);\n    \n    for (NSUInteger l = 0, lMax = layout.lines.count; l < lMax; l++) {\n        if (cancel && cancel()) break;\n        \n        YYTextLine *line = lines[l];\n        if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine;\n        CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n        for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n            CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n            CFIndex glyphCount = CTRunGetGlyphCount(run);\n            if (glyphCount == 0) continue;\n            \n            NSDictionary *attrs = (id)CTRunGetAttributes(run);\n            YYTextDecoration *underline = attrs[YYTextUnderlineAttributeName];\n            YYTextDecoration *strikethrough = attrs[YYTextStrikethroughAttributeName];\n            \n            BOOL needDrawUnderline = NO, needDrawStrikethrough = NO;\n            if ((type & YYTextDecorationTypeUnderline) && underline.style > 0) {\n                needDrawUnderline = YES;\n            }\n            if ((type & YYTextDecorationTypeStrikethrough) && strikethrough.style > 0) {\n                needDrawStrikethrough = YES;\n            }\n            if (!needDrawUnderline && !needDrawStrikethrough) continue;\n            \n            CFRange runRange = CTRunGetStringRange(run);\n            if (runRange.location == kCFNotFound || runRange.length == 0) continue;\n            if (runRange.location + runRange.length > layout.text.length) continue;\n            NSString *runStr = [layout.text attributedSubstringFromRange:NSMakeRange(runRange.location, runRange.length)].string;\n            if (YYTextIsLinebreakString(runStr)) continue; // may need more checks...\n            \n            CGFloat xHeight, underlinePosition, lineThickness;\n            YYTextGetRunsMaxMetric(runs, &xHeight, &underlinePosition, &lineThickness);\n            \n            CGPoint underlineStart, strikethroughStart;\n            CGFloat length;\n            \n            if (isVertical) {\n                underlineStart.x = line.position.x + underlinePosition;\n                strikethroughStart.x = line.position.x + xHeight / 2;\n                \n                CGPoint runPosition = CGPointZero;\n                CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition);\n                underlineStart.y = strikethroughStart.y = runPosition.x + line.position.y;\n                length = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL);\n                \n            } else {\n                underlineStart.y = line.position.y - underlinePosition;\n                strikethroughStart.y = line.position.y - xHeight / 2;\n                \n                CGPoint runPosition = CGPointZero;\n                CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition);\n                underlineStart.x = strikethroughStart.x = runPosition.x + line.position.x;\n                length = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), NULL, NULL, NULL);\n            }\n            \n            if (needDrawUnderline) {\n                CGColorRef color = underline.color.CGColor;\n                if (!color) {\n                    color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]);\n                    color = YYTextGetCGColor(color);\n                }\n                CGFloat thickness = underline.width ? underline.width.floatValue : lineThickness;\n                YYTextShadow *shadow = underline.shadow;\n                while (shadow) {\n                    if (!shadow.color) {\n                        shadow = shadow.subShadow;\n                        continue;\n                    }\n                    CGFloat offsetAlterX = size.width + 0xFFFF;\n                    CGContextSaveGState(context); {\n                        CGSize offset = shadow.offset;\n                        offset.width -= offsetAlterX;\n                        CGContextSaveGState(context); {\n                            CGContextSetShadowWithColor(context, offset, shadow.radius, shadow.color.CGColor);\n                            CGContextSetBlendMode(context, shadow.blendMode);\n                            CGContextTranslateCTM(context, offsetAlterX, 0);\n                            YYTextDrawLineStyle(context, length, thickness, underline.style, underlineStart, color, isVertical);\n                        } CGContextRestoreGState(context);\n                    } CGContextRestoreGState(context);\n                    shadow = shadow.subShadow;\n                }\n                YYTextDrawLineStyle(context, length, thickness, underline.style, underlineStart, color, isVertical);\n            }\n            \n            if (needDrawStrikethrough) {\n                CGColorRef color = strikethrough.color.CGColor;\n                if (!color) {\n                    color = (__bridge CGColorRef)(attrs[(id)kCTForegroundColorAttributeName]);\n                    color = YYTextGetCGColor(color);\n                }\n                CGFloat thickness = strikethrough.width ? strikethrough.width.floatValue : lineThickness;\n                YYTextShadow *shadow = underline.shadow;\n                while (shadow) {\n                    if (!shadow.color) {\n                        shadow = shadow.subShadow;\n                        continue;\n                    }\n                    CGFloat offsetAlterX = size.width + 0xFFFF;\n                    CGContextSaveGState(context); {\n                        CGSize offset = shadow.offset;\n                        offset.width -= offsetAlterX;\n                        CGContextSaveGState(context); {\n                            CGContextSetShadowWithColor(context, offset, shadow.radius, shadow.color.CGColor);\n                            CGContextSetBlendMode(context, shadow.blendMode);\n                            CGContextTranslateCTM(context, offsetAlterX, 0);\n                            YYTextDrawLineStyle(context, length, thickness, underline.style, underlineStart, color, isVertical);\n                        } CGContextRestoreGState(context);\n                    } CGContextRestoreGState(context);\n                    shadow = shadow.subShadow;\n                }\n                YYTextDrawLineStyle(context, length, thickness, strikethrough.style, strikethroughStart, color, isVertical);\n            }\n        }\n    }\n    CGContextRestoreGState(context);\n}\n\nstatic void YYTextDrawAttachment(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, UIView *targetView, CALayer *targetLayer, BOOL (^cancel)(void)) {\n    \n    BOOL isVertical = layout.container.verticalForm;\n    CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n    \n    for (NSUInteger i = 0, max = layout.attachments.count; i < max; i++) {\n        YYTextAttachment *a = layout.attachments[i];\n        if (!a.content) continue;\n        \n        UIImage *image = nil;\n        UIView *view = nil;\n        CALayer *layer = nil;\n        if ([a.content isKindOfClass:[UIImage class]]) {\n            image = a.content;\n        } else if ([a.content isKindOfClass:[UIView class]]) {\n            view = a.content;\n        } else if ([a.content isKindOfClass:[CALayer class]]) {\n            layer = a.content;\n        }\n        if (!image && !view && !layer) continue;\n        if (image && !context) continue;\n        if (view && !targetView) continue;\n        if (layer && !targetLayer) continue;\n        if (cancel && cancel()) break;\n        \n        CGSize asize = image ? image.size : view ? view.frame.size : layer.frame.size;\n        CGRect rect = ((NSValue *)layout.attachmentRects[i]).CGRectValue;\n        if (isVertical) {\n            rect = UIEdgeInsetsInsetRect(rect, UIEdgeInsetRotateVertical(a.contentInsets));\n        } else {\n            rect = UIEdgeInsetsInsetRect(rect, a.contentInsets);\n        }\n        rect = YYTextCGRectFitWithContentMode(rect, asize, a.contentMode);\n        rect = YYTextCGRectPixelRound(rect);\n        rect = CGRectStandardize(rect);\n        rect.origin.x += point.x + verticalOffset;\n        rect.origin.y += point.y;\n        if (image) {\n            CGImageRef ref = image.CGImage;\n            if (ref) {\n                CGContextSaveGState(context);\n                CGContextTranslateCTM(context, 0, CGRectGetMaxY(rect) + CGRectGetMinY(rect));\n                CGContextScaleCTM(context, 1, -1);\n                CGContextDrawImage(context, rect, ref);\n                CGContextRestoreGState(context);\n            }\n        } else if (view) {\n            view.frame = rect;\n            [targetView addSubview:view];\n        } else if (layer) {\n            layer.frame = rect;\n            [targetLayer addSublayer:layer];\n        }\n    }\n}\n\nstatic void YYTextDrawShadow(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) {\n    //move out of context. (0xFFFF is just a random large number)\n    CGFloat offsetAlterX = size.width + 0xFFFF;\n    \n    BOOL isVertical = layout.container.verticalForm;\n    CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n    \n    CGContextSaveGState(context); {\n        CGContextTranslateCTM(context, point.x, point.y);\n        CGContextTranslateCTM(context, 0, size.height);\n        CGContextScaleCTM(context, 1, -1);\n        NSArray *lines = layout.lines;\n        for (NSUInteger l = 0, lMax = layout.lines.count; l < lMax; l++) {\n            if (cancel && cancel()) break;\n            YYTextLine *line = lines[l];\n            if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine;\n            NSArray *lineRunRanges = line.verticalRotateRange;\n            CGFloat linePosX = line.position.x;\n            CGFloat linePosY = size.height - line.position.y;\n            CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n            for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n                CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n                CGContextSetTextMatrix(context, CGAffineTransformIdentity);\n                CGContextSetTextPosition(context, linePosX, linePosY);\n                NSDictionary *attrs = (id)CTRunGetAttributes(run);\n                YYTextShadow *shadow = attrs[YYTextShadowAttributeName];\n                YYTextShadow *nsShadow = [YYTextShadow shadowWithNSShadow:attrs[NSShadowAttributeName]]; // NSShadow compatible\n                if (nsShadow) {\n                    nsShadow.subShadow = shadow;\n                    shadow = nsShadow;\n                }\n                while (shadow) {\n                    if (!shadow.color) {\n                        shadow = shadow.subShadow;\n                        continue;\n                    }\n                    CGSize offset = shadow.offset;\n                    offset.width -= offsetAlterX;\n                    CGContextSaveGState(context); {\n                        CGContextSetShadowWithColor(context, offset, shadow.radius, shadow.color.CGColor);\n                        CGContextSetBlendMode(context, shadow.blendMode);\n                        CGContextTranslateCTM(context, offsetAlterX, 0);\n                        YYTextDrawRun(line, run, context, size, isVertical, lineRunRanges[r], verticalOffset);\n                    } CGContextRestoreGState(context);\n                    shadow = shadow.subShadow;\n                }\n            }\n        }\n    } CGContextRestoreGState(context);\n}\n\nstatic void YYTextDrawInnerShadow(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, BOOL (^cancel)(void)) {\n    CGContextSaveGState(context);\n    CGContextTranslateCTM(context, point.x, point.y);\n    CGContextTranslateCTM(context, 0, size.height);\n    CGContextScaleCTM(context, 1, -1);\n    CGContextSetTextMatrix(context, CGAffineTransformIdentity);\n    \n    BOOL isVertical = layout.container.verticalForm;\n    CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n    \n    NSArray *lines = layout.lines;\n    for (NSUInteger l = 0, lMax = lines.count; l < lMax; l++) {\n        if (cancel && cancel()) break;\n        \n        YYTextLine *line = lines[l];\n        if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine;\n        NSArray *lineRunRanges = line.verticalRotateRange;\n        CGFloat linePosX = line.position.x;\n        CGFloat linePosY = size.height - line.position.y;\n        CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n        for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n            CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n            if (CTRunGetGlyphCount(run) == 0) continue;\n            CGContextSetTextMatrix(context, CGAffineTransformIdentity);\n            CGContextSetTextPosition(context, linePosX, linePosY);\n            NSDictionary *attrs = (id)CTRunGetAttributes(run);\n            YYTextShadow *shadow = attrs[YYTextInnerShadowAttributeName];\n            while (shadow) {\n                if (!shadow.color) {\n                    shadow = shadow.subShadow;\n                    continue;\n                }\n                CGPoint runPosition = CGPointZero;\n                CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition);\n                CGRect runImageBounds = CTRunGetImageBounds(run, context, CFRangeMake(0, 0));\n                runImageBounds.origin.x += runPosition.x;\n                if (runImageBounds.size.width < 0.1 || runImageBounds.size.height < 0.1) continue;\n                \n                CFDictionaryRef runAttrs = CTRunGetAttributes(run);\n                NSValue *glyphTransformValue = CFDictionaryGetValue(runAttrs, (__bridge const void *)(YYTextGlyphTransformAttributeName));\n                if (glyphTransformValue) {\n                    runImageBounds = CGRectMake(0, 0, size.width, size.height);\n                }\n                \n                // text inner shadow\n                CGContextSaveGState(context); {\n                    CGContextSetBlendMode(context, shadow.blendMode);\n                    CGContextSetShadowWithColor(context, CGSizeZero, 0, NULL);\n                    CGContextSetAlpha(context, CGColorGetAlpha(shadow.color.CGColor));\n                    CGContextClipToRect(context, runImageBounds);\n                    CGContextBeginTransparencyLayer(context, NULL); {\n                        UIColor *opaqueShadowColor = [shadow.color colorWithAlphaComponent:1];\n                        CGContextSetShadowWithColor(context, shadow.offset, shadow.radius, opaqueShadowColor.CGColor);\n                        CGContextSetFillColorWithColor(context, opaqueShadowColor.CGColor);\n                        CGContextSetBlendMode(context, kCGBlendModeSourceOut);\n                        CGContextBeginTransparencyLayer(context, NULL); {\n                            CGContextFillRect(context, runImageBounds);\n                            CGContextSetBlendMode(context, kCGBlendModeDestinationIn);\n                            CGContextBeginTransparencyLayer(context, NULL); {\n                                YYTextDrawRun(line, run, context, size, isVertical, lineRunRanges[r], verticalOffset);\n                            } CGContextEndTransparencyLayer(context);\n                        } CGContextEndTransparencyLayer(context);\n                    } CGContextEndTransparencyLayer(context);\n                } CGContextRestoreGState(context);\n                shadow = shadow.subShadow;\n            }\n        }\n    }\n    \n    CGContextRestoreGState(context);\n}\n\nstatic void YYTextDrawDebug(YYTextLayout *layout, CGContextRef context, CGSize size, CGPoint point, YYTextDebugOption *op) {\n    UIGraphicsPushContext(context);\n    CGContextSaveGState(context);\n    CGContextTranslateCTM(context, point.x, point.y);\n    CGContextSetLineWidth(context, 1.0 / YYTextScreenScale());\n    CGContextSetLineDash(context, 0, NULL, 0);\n    CGContextSetLineJoin(context, kCGLineJoinMiter);\n    CGContextSetLineCap(context, kCGLineCapButt);\n    \n    BOOL isVertical = layout.container.verticalForm;\n    CGFloat verticalOffset = isVertical ? (size.width - layout.container.size.width) : 0;\n    CGContextTranslateCTM(context, verticalOffset, 0);\n    \n    if (op.CTFrameBorderColor || op.CTFrameFillColor) {\n        UIBezierPath *path = layout.container.path;\n        if (!path) {\n            CGRect rect = (CGRect){CGPointZero, layout.container.size};\n            rect = UIEdgeInsetsInsetRect(rect, layout.container.insets);\n            if (op.CTFrameBorderColor) rect = YYTextCGRectPixelHalf(rect);\n            else rect = YYTextCGRectPixelRound(rect);\n            path = [UIBezierPath bezierPathWithRect:rect];\n        }\n        [path closePath];\n        \n        for (UIBezierPath *ex in layout.container.exclusionPaths) {\n            [path appendPath:ex];\n        }\n        if (op.CTFrameFillColor) {\n            [op.CTFrameFillColor setFill];\n            if (layout.container.pathLineWidth > 0) {\n                CGContextSaveGState(context); {\n                    CGContextBeginTransparencyLayer(context, NULL); {\n                        CGContextAddPath(context, path.CGPath);\n                        if (layout.container.pathFillEvenOdd) {\n                            CGContextEOFillPath(context);\n                        } else {\n                            CGContextFillPath(context);\n                        }\n                        CGContextSetBlendMode(context, kCGBlendModeDestinationOut);\n                        [[UIColor blackColor] setFill];\n                        CGPathRef cgPath = CGPathCreateCopyByStrokingPath(path.CGPath, NULL, layout.container.pathLineWidth, kCGLineCapButt, kCGLineJoinMiter, 0);\n                        if (cgPath) {\n                            CGContextAddPath(context, cgPath);\n                            CGContextFillPath(context);\n                        }\n                        CGPathRelease(cgPath);\n                    } CGContextEndTransparencyLayer(context);\n                } CGContextRestoreGState(context);\n            } else {\n                CGContextAddPath(context, path.CGPath);\n                if (layout.container.pathFillEvenOdd) {\n                    CGContextEOFillPath(context);\n                } else {\n                    CGContextFillPath(context);\n                }\n            }\n        }\n        if (op.CTFrameBorderColor) {\n            CGContextSaveGState(context); {\n                if (layout.container.pathLineWidth > 0) {\n                    CGContextSetLineWidth(context, layout.container.pathLineWidth);\n                }\n                [op.CTFrameBorderColor setStroke];\n                CGContextAddPath(context, path.CGPath);\n                CGContextStrokePath(context);\n            } CGContextRestoreGState(context);\n        }\n    }\n    \n    NSArray *lines = layout.lines;\n    for (NSUInteger l = 0, lMax = lines.count; l < lMax; l++) {\n        YYTextLine *line = lines[l];\n        if (layout.truncatedLine && layout.truncatedLine.index == line.index) line = layout.truncatedLine;\n        CGRect lineBounds = line.bounds;\n        if (op.CTLineFillColor) {\n            [op.CTLineFillColor setFill];\n            CGContextAddRect(context, YYTextCGRectPixelRound(lineBounds));\n            CGContextFillPath(context);\n        }\n        if (op.CTLineBorderColor) {\n            [op.CTLineBorderColor setStroke];\n            CGContextAddRect(context, YYTextCGRectPixelHalf(lineBounds));\n            CGContextStrokePath(context);\n        }\n        if (op.baselineColor) {\n            [op.baselineColor setStroke];\n            if (isVertical) {\n                CGFloat x = YYTextCGFloatPixelHalf(line.position.x);\n                CGFloat y1 = YYTextCGFloatPixelHalf(line.top);\n                CGFloat y2 = YYTextCGFloatPixelHalf(line.bottom);\n                CGContextMoveToPoint(context, x, y1);\n                CGContextAddLineToPoint(context, x, y2);\n                CGContextStrokePath(context);\n            } else {\n                CGFloat x1 = YYTextCGFloatPixelHalf(lineBounds.origin.x);\n                CGFloat x2 = YYTextCGFloatPixelHalf(lineBounds.origin.x + lineBounds.size.width);\n                CGFloat y = YYTextCGFloatPixelHalf(line.position.y);\n                CGContextMoveToPoint(context, x1, y);\n                CGContextAddLineToPoint(context, x2, y);\n                CGContextStrokePath(context);\n            }\n        }\n        if (op.CTLineNumberColor) {\n            [op.CTLineNumberColor set];\n            NSMutableAttributedString *num = [[NSMutableAttributedString alloc] initWithString:@(l).description];\n            num.yy_color = op.CTLineNumberColor;\n            num.yy_font = [UIFont systemFontOfSize:6];\n            [num drawAtPoint:CGPointMake(line.position.x, line.position.y - (isVertical ? 1 : 6))];\n        }\n        if (op.CTRunFillColor || op.CTRunBorderColor || op.CTRunNumberColor || op.CGGlyphFillColor || op.CGGlyphBorderColor) {\n            CFArrayRef runs = CTLineGetGlyphRuns(line.CTLine);\n            for (NSUInteger r = 0, rMax = CFArrayGetCount(runs); r < rMax; r++) {\n                CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n                CFIndex glyphCount = CTRunGetGlyphCount(run);\n                if (glyphCount == 0) continue;\n                \n                CGPoint glyphPositions[glyphCount];\n                CTRunGetPositions(run, CFRangeMake(0, glyphCount), glyphPositions);\n                \n                CGSize glyphAdvances[glyphCount];\n                CTRunGetAdvances(run, CFRangeMake(0, glyphCount), glyphAdvances);\n                \n                CGPoint runPosition = glyphPositions[0];\n                if (isVertical) {\n                    YYTEXT_SWAP(runPosition.x, runPosition.y);\n                    runPosition.x = line.position.x;\n                    runPosition.y += line.position.y;\n                } else {\n                    runPosition.x += line.position.x;\n                    runPosition.y = line.position.y - runPosition.y;\n                }\n                \n                CGFloat ascent, descent, leading;\n                CGFloat width = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), &ascent, &descent, &leading);\n                CGRect runTypoBounds;\n                if (isVertical) {\n                    runTypoBounds = CGRectMake(runPosition.x - descent, runPosition.y, ascent + descent, width);\n                } else {\n                    runTypoBounds = CGRectMake(runPosition.x, line.position.y - ascent, width, ascent + descent);\n                }\n                \n                if (op.CTRunFillColor) {\n                    [op.CTRunFillColor setFill];\n                    CGContextAddRect(context, YYTextCGRectPixelRound(runTypoBounds));\n                    CGContextFillPath(context);\n                }\n                if (op.CTRunBorderColor) {\n                    [op.CTRunBorderColor setStroke];\n                    CGContextAddRect(context, YYTextCGRectPixelHalf(runTypoBounds));\n                    CGContextStrokePath(context);\n                }\n                if (op.CTRunNumberColor) {\n                    [op.CTRunNumberColor set];\n                    NSMutableAttributedString *num = [[NSMutableAttributedString alloc] initWithString:@(r).description];\n                    num.yy_color = op.CTRunNumberColor;\n                    num.yy_font = [UIFont systemFontOfSize:6];\n                    [num drawAtPoint:CGPointMake(runTypoBounds.origin.x, runTypoBounds.origin.y - 1)];\n                }\n                if (op.CGGlyphBorderColor || op.CGGlyphFillColor) {\n                    for (NSUInteger g = 0; g < glyphCount; g++) {\n                        CGPoint pos = glyphPositions[g];\n                        CGSize adv = glyphAdvances[g];\n                        CGRect rect;\n                        if (isVertical) {\n                            YYTEXT_SWAP(pos.x, pos.y);\n                            pos.x = runPosition.x;\n                            pos.y += line.position.y;\n                            rect = CGRectMake(pos.x - descent, pos.y, runTypoBounds.size.width, adv.width);\n                        } else {\n                            pos.x += line.position.x;\n                            pos.y = runPosition.y;\n                            rect = CGRectMake(pos.x, pos.y - ascent, adv.width, runTypoBounds.size.height);\n                        }\n                        if (op.CGGlyphFillColor) {\n                            [op.CGGlyphFillColor setFill];\n                            CGContextAddRect(context, YYTextCGRectPixelRound(rect));\n                            CGContextFillPath(context);\n                        }\n                        if (op.CGGlyphBorderColor) {\n                            [op.CGGlyphBorderColor setStroke];\n                            CGContextAddRect(context, YYTextCGRectPixelHalf(rect));\n                            CGContextStrokePath(context);\n                        }\n                    }\n                }\n            }\n        }\n    }\n    CGContextRestoreGState(context);\n    UIGraphicsPopContext();\n}\n\n\n- (void)drawInContext:(CGContextRef)context\n                 size:(CGSize)size\n                point:(CGPoint)point\n                 view:(UIView *)view\n                layer:(CALayer *)layer\n                debug:(YYTextDebugOption *)debug\n                cancel:(BOOL (^)(void))cancel{\n    @autoreleasepool {\n        if (self.needDrawBlockBorder && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawBlockBorder(self, context, size, point, cancel);\n        }\n        if (self.needDrawBackgroundBorder && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawBorder(self, context, size, point, YYTextBorderTypeBackgound, cancel);\n        }\n        if (self.needDrawShadow && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawShadow(self, context, size, point, cancel);\n        }\n        if (self.needDrawUnderline && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawDecoration(self, context, size, point, YYTextDecorationTypeUnderline, cancel);\n        }\n        if (self.needDrawText && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawText(self, context, size, point, cancel);\n        }\n        if (self.needDrawAttachment && (context || view || layer)) {\n            if (cancel && cancel()) return;\n            YYTextDrawAttachment(self, context, size, point, view, layer, cancel);\n        }\n        if (self.needDrawInnerShadow && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawInnerShadow(self, context, size, point, cancel);\n        }\n        if (self.needDrawStrikethrough && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawDecoration(self, context, size, point, YYTextDecorationTypeStrikethrough, cancel);\n        }\n        if (self.needDrawBorder && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawBorder(self, context, size, point, YYTextBorderTypeNormal, cancel);\n        }\n        if (debug.needDrawDebug && context) {\n            if (cancel && cancel()) return;\n            YYTextDrawDebug(self, context, size, point, debug);\n        }\n    }\n}\n\n- (void)drawInContext:(CGContextRef)context\n                 size:(CGSize)size\n                debug:(YYTextDebugOption *)debug {\n    [self drawInContext:context size:size point:CGPointZero view:nil layer:nil debug:debug cancel:nil];\n}\n\n- (void)addAttachmentToView:(UIView *)view layer:(CALayer *)layer {\n    NSAssert([NSThread isMainThread], @\"This method must be called on the main thread\");\n    [self drawInContext:NULL size:CGSizeZero point:CGPointZero view:view layer:layer debug:nil cancel:nil];\n}\n\n- (void)removeAttachmentFromViewAndLayer {\n    NSAssert([NSThread isMainThread], @\"This method must be called on the main thread\");\n    for (YYTextAttachment *a in self.attachments) {\n        if ([a.content isKindOfClass:[UIView class]]) {\n            UIView *v = a.content;\n            [v removeFromSuperview];\n        } else if ([a.content isKindOfClass:[CALayer class]]) {\n            CALayer *l = a.content;\n            [l removeFromSuperlayer];\n        }\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextLine.h",
    "content": "//\n//  YYTextLine.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/10.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n#import <CoreText/CoreText.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextAttribute.h>\n#else\n#import \"YYTextAttribute.h\"\n#endif\n\n@class YYTextRunGlyphRange;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A text line object wrapped `CTLineRef`, see `YYTextLayout` for more.\n */\n@interface YYTextLine : NSObject\n\n+ (instancetype)lineWithCTLine:(CTLineRef)CTLine position:(CGPoint)position vertical:(BOOL)isVertical;\n\n@property (nonatomic) NSUInteger index;     ///< line index\n@property (nonatomic) NSUInteger row;       ///< line row\n@property (nullable, nonatomic, strong) NSArray<NSArray<YYTextRunGlyphRange *> *> *verticalRotateRange; ///< Run rotate range\n\n@property (nonatomic, readonly) CTLineRef CTLine;   ///< CoreText line\n@property (nonatomic, readonly) NSRange range;      ///< string range\n@property (nonatomic, readonly) BOOL vertical;      ///< vertical form\n\n@property (nonatomic, readonly) CGRect bounds;      ///< bounds (ascent + descent)\n@property (nonatomic, readonly) CGSize size;        ///< bounds.size\n@property (nonatomic, readonly) CGFloat width;      ///< bounds.size.width\n@property (nonatomic, readonly) CGFloat height;     ///< bounds.size.height\n@property (nonatomic, readonly) CGFloat top;        ///< bounds.origin.y\n@property (nonatomic, readonly) CGFloat bottom;     ///< bounds.origin.y + bounds.size.height\n@property (nonatomic, readonly) CGFloat left;       ///< bounds.origin.x\n@property (nonatomic, readonly) CGFloat right;      ///< bounds.origin.x + bounds.size.width\n\n@property (nonatomic)   CGPoint position;   ///< baseline position\n@property (nonatomic, readonly) CGFloat ascent;     ///< line ascent\n@property (nonatomic, readonly) CGFloat descent;    ///< line descent\n@property (nonatomic, readonly) CGFloat leading;    ///< line leading\n@property (nonatomic, readonly) CGFloat lineWidth;  ///< line width\n@property (nonatomic, readonly) CGFloat trailingWhitespaceWidth;\n\n@property (nullable, nonatomic, readonly) NSArray<YYTextAttachment *> *attachments; ///< YYTextAttachment\n@property (nullable, nonatomic, readonly) NSArray<NSValue *> *attachmentRanges;     ///< NSRange(NSValue)\n@property (nullable, nonatomic, readonly) NSArray<NSValue *> *attachmentRects;      ///< CGRect(NSValue)\n\n@end\n\n\ntypedef NS_ENUM(NSUInteger, YYTextRunGlyphDrawMode) {\n    /// No rotate.\n    YYTextRunGlyphDrawModeHorizontal = 0,\n    \n    /// Rotate vertical for single glyph.\n    YYTextRunGlyphDrawModeVerticalRotate = 1,\n    \n    /// Rotate vertical for single glyph, and move the glyph to a better position,\n    /// such as fullwidth punctuation.\n    YYTextRunGlyphDrawModeVerticalRotateMove = 2,\n};\n\n/**\n A range in CTRun, used for vertical form.\n */\n@interface YYTextRunGlyphRange : NSObject\n@property (nonatomic) NSRange glyphRangeInRun;\n@property (nonatomic) YYTextRunGlyphDrawMode drawMode;\n+ (instancetype)rangeWithRange:(NSRange)range drawMode:(YYTextRunGlyphDrawMode)mode;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextLine.m",
    "content": "//\n//  YYYTextLine.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/3.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextLine.h\"\n#import \"YYTextUtilities.h\"\n\n\n@implementation YYTextLine {\n    CGFloat _firstGlyphPos; // first glyph position for baseline, typically 0.\n}\n\n+ (instancetype)lineWithCTLine:(CTLineRef)CTLine position:(CGPoint)position vertical:(BOOL)isVertical {\n    if (!CTLine) return nil;\n    YYTextLine *line = [self new];\n    line->_position = position;\n    line->_vertical = isVertical;\n    [line setCTLine:CTLine];\n    return line;\n}\n\n- (void)dealloc {\n    if (_CTLine) CFRelease(_CTLine);\n}\n\n- (void)setCTLine:(_Nonnull CTLineRef)CTLine {\n    if (_CTLine != CTLine) {\n        if (CTLine) CFRetain(CTLine);\n        if (_CTLine) CFRelease(_CTLine);\n        _CTLine = CTLine;\n        if (_CTLine) {\n            _lineWidth = CTLineGetTypographicBounds(_CTLine, &_ascent, &_descent, &_leading);\n            CFRange range = CTLineGetStringRange(_CTLine);\n            _range = NSMakeRange(range.location, range.length);\n            if (CTLineGetGlyphCount(_CTLine) > 0) {\n                CFArrayRef runs = CTLineGetGlyphRuns(_CTLine);\n                CTRunRef run = CFArrayGetValueAtIndex(runs, 0);\n                CGPoint pos;\n                CTRunGetPositions(run, CFRangeMake(0, 1), &pos);\n                _firstGlyphPos = pos.x;\n            } else {\n                _firstGlyphPos = 0;\n            }\n            _trailingWhitespaceWidth = CTLineGetTrailingWhitespaceWidth(_CTLine);\n        } else {\n            _lineWidth = _ascent = _descent = _leading = _firstGlyphPos = _trailingWhitespaceWidth = 0;\n            _range = NSMakeRange(0, 0);\n        }\n        [self reloadBounds];\n    }\n}\n\n- (void)setPosition:(CGPoint)position {\n    _position = position;\n    [self reloadBounds];\n}\n\n- (void)reloadBounds {\n    if (_vertical) {\n        _bounds = CGRectMake(_position.x - _descent, _position.y, _ascent + _descent, _lineWidth);\n        _bounds.origin.y += _firstGlyphPos;\n    } else {\n        _bounds = CGRectMake(_position.x, _position.y - _ascent, _lineWidth, _ascent + _descent);\n        _bounds.origin.x += _firstGlyphPos;\n    }\n    \n    _attachments = nil;\n    _attachmentRanges = nil;\n    _attachmentRects = nil;\n    if (!_CTLine) return;\n    CFArrayRef runs = CTLineGetGlyphRuns(_CTLine);\n    NSUInteger runCount = CFArrayGetCount(runs);\n    if (runCount == 0) return;\n    \n    NSMutableArray *attachments = [NSMutableArray new];\n    NSMutableArray *attachmentRanges = [NSMutableArray new];\n    NSMutableArray *attachmentRects = [NSMutableArray new];\n    for (NSUInteger r = 0; r < runCount; r++) {\n        CTRunRef run = CFArrayGetValueAtIndex(runs, r);\n        CFIndex glyphCount = CTRunGetGlyphCount(run);\n        if (glyphCount == 0) continue;\n        NSDictionary *attrs = (id)CTRunGetAttributes(run);\n        YYTextAttachment *attachment = attrs[YYTextAttachmentAttributeName];\n        if (attachment) {\n            CGPoint runPosition = CGPointZero;\n            CTRunGetPositions(run, CFRangeMake(0, 1), &runPosition);\n            \n            CGFloat ascent, descent, leading, runWidth;\n            CGRect runTypoBounds;\n            runWidth = CTRunGetTypographicBounds(run, CFRangeMake(0, 0), &ascent, &descent, &leading);\n            \n            if (_vertical) {\n                YYTEXT_SWAP(runPosition.x, runPosition.y);\n                runPosition.y = _position.y + runPosition.y;\n                runTypoBounds = CGRectMake(_position.x + runPosition.x - descent, runPosition.y , ascent + descent, runWidth);\n            } else {\n                runPosition.x += _position.x;\n                runPosition.y = _position.y - runPosition.y;\n                runTypoBounds = CGRectMake(runPosition.x, runPosition.y - ascent, runWidth, ascent + descent);\n            }\n            \n            NSRange runRange = YYTextNSRangeFromCFRange(CTRunGetStringRange(run));\n            [attachments addObject:attachment];\n            [attachmentRanges addObject:[NSValue valueWithRange:runRange]];\n            [attachmentRects addObject:[NSValue valueWithCGRect:runTypoBounds]];\n        }\n    }\n    _attachments = attachments.count ? attachments : nil;\n    _attachmentRanges = attachmentRanges.count ? attachmentRanges : nil;\n    _attachmentRects = attachmentRects.count ? attachmentRects : nil;\n}\n\n- (CGSize)size {\n    return _bounds.size;\n}\n\n- (CGFloat)width {\n    return CGRectGetWidth(_bounds);\n}\n\n- (CGFloat)height {\n    return CGRectGetHeight(_bounds);\n}\n\n- (CGFloat)top {\n    return CGRectGetMinY(_bounds);\n}\n\n- (CGFloat)bottom {\n    return CGRectGetMaxY(_bounds);\n}\n\n- (CGFloat)left {\n    return CGRectGetMinX(_bounds);\n}\n\n- (CGFloat)right {\n    return CGRectGetMaxX(_bounds);\n}\n\n- (NSString *)description {\n    NSMutableString *desc = @\"\".mutableCopy;\n    NSRange range = self.range;\n    [desc appendFormat:@\"<YYTextLine: %p> row:%zd range:%tu,%tu\",self, self.row, range.location, range.length];\n    [desc appendFormat:@\" position:%@\",NSStringFromCGPoint(self.position)];\n    [desc appendFormat:@\" bounds:%@\",NSStringFromCGRect(self.bounds)];\n    return desc;\n}\n\n@end\n\n\n@implementation YYTextRunGlyphRange\n+ (instancetype)rangeWithRange:(NSRange)range drawMode:(YYTextRunGlyphDrawMode)mode {\n    YYTextRunGlyphRange *one = [self new];\n    one.glyphRangeInRun = range;\n    one.drawMode = mode;\n    return one;\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextMagnifier.h",
    "content": "//\n//  YYTextMagnifier.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextAttribute.h>\n#else\n#import \"YYTextAttribute.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/// Magnifier type\ntypedef NS_ENUM(NSInteger, YYTextMagnifierType) {\n    YYTextMagnifierTypeCaret,  ///< Circular magnifier\n    YYTextMagnifierTypeRanged, ///< Round rectangle magnifier\n};\n\n/**\n A magnifier view which can be displayed in `YYTextEffectWindow`.\n \n @discussion Use `magnifierWithType:` to create instance.\n Typically, you should not use this class directly.\n */\n@interface YYTextMagnifier : UIView\n\n/// Create a mangifier with the specified type. @param type The magnifier type.\n+ (id)magnifierWithType:(YYTextMagnifierType)type;\n\n@property (nonatomic, readonly) YYTextMagnifierType type;  ///< Type of magnifier\n@property (nonatomic, readonly) CGSize fitSize;            ///< The 'best' size for magnifier view.\n@property (nonatomic, readonly) CGSize snapshotSize;       ///< The 'best' snapshot image size for magnifier.\n@property (nullable, nonatomic, strong) UIImage *snapshot; ///< The image in magnifier (readwrite).\n\n@property (nullable, nonatomic, weak) UIView *hostView;   ///< The coordinate based view.\n@property (nonatomic) CGPoint hostCaptureCenter;          ///< The snapshot capture center in `hostView`.\n@property (nonatomic) CGPoint hostPopoverCenter;          ///< The popover center in `hostView`.\n@property (nonatomic) BOOL hostVerticalForm;              ///< The host view is vertical form.\n@property (nonatomic) BOOL captureDisabled;               ///< A hint for `YYTextEffectWindow` to disable capture.\n@property (nonatomic) BOOL captureFadeAnimation;          ///< Show fade animation when the snapshot image changed.\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextMagnifier.m",
    "content": "//\n//  YYTextMagnifier.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextMagnifier.h\"\n#import \"YYTextUtilities.h\"\n\n#define kCaptureDisableFadeTime 0.1\n\n\n@interface _YYTextMagnifierCaret : YYTextMagnifier {\n    UIImageView *_contentView;\n    UIImageView *_coverView;\n}\n@end\n\n@implementation _YYTextMagnifierCaret\n\n#define kMultiple 1.2\n#define kDiameter 113.0\n#define kPadding 7.0\n#define kSize CGSizeMake(kDiameter + kPadding * 2, kDiameter + kPadding * 2)\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    _contentView = [UIImageView new];\n    _contentView.frame = CGRectMake(kPadding, kPadding, kDiameter, kDiameter);\n    _contentView.layer.cornerRadius = kDiameter / 2;\n    _contentView.clipsToBounds = YES;\n    [self addSubview:_contentView];\n    \n    _coverView = [UIImageView new];\n    _coverView.frame = (CGRect){.origin = CGPointZero, .size = kSize};\n    _coverView.image = [self.class coverImage];\n    [self addSubview:_coverView];\n    return self;\n}\n\n- (instancetype)init {\n    self = [self initWithFrame:CGRectZero];\n    self.frame = (CGRect){.size = [self sizeThatFits:CGSizeZero]};\n    return self;\n}\n\n- (YYTextMagnifierType)type {\n    return YYTextMagnifierTypeCaret;\n}\n\n- (CGSize)sizeThatFits:(CGSize)size {\n    return kSize;\n}\n\n- (void)setSnapshot:(UIImage *)snapshot {\n    if (self.captureFadeAnimation) {\n        [_contentView.layer removeAnimationForKey:@\"contents\"];\n        CABasicAnimation *animation = [CABasicAnimation animation];\n        animation.duration = kCaptureDisableFadeTime;\n        animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];\n        [_contentView.layer addAnimation:animation forKey:@\"contents\"];\n    }\n    _contentView.image = snapshot;\n}\n\n- (UIImage *)snapshot {\n    return _contentView.image;\n}\n\n- (CGSize)snapshotSize {\n    CGFloat length = floor(kDiameter / 1.2);\n    return CGSizeMake(length, length);\n}\n\n- (CGSize)fitSize {\n    return [self sizeThatFits:CGSizeZero];\n}\n\n+ (UIImage *)coverImage {\n    static UIImage *image;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        CGSize size = kSize;\n        CGRect rect = (CGRect) {.size = size, .origin = CGPointZero};\n        rect = CGRectInset(rect, kPadding, kPadding);\n        \n        UIGraphicsBeginImageContextWithOptions(size, NO, 0);\n        CGContextRef context = UIGraphicsGetCurrentContext();\n        \n        CGPathRef boxPath = CGPathCreateWithRect(CGRectMake(0, 0, size.width, size.height), NULL);\n        CGPathRef fillPath = CGPathCreateWithEllipseInRect(rect, NULL);\n        CGPathRef strokePath = CGPathCreateWithEllipseInRect(YYTextCGRectPixelHalf(rect), NULL);\n        \n        // inner shadow\n        CGContextSaveGState(context); {\n            CGFloat blurRadius = 25;\n            CGSize offset = CGSizeMake(0, 15);\n            CGColorRef shadowColor = [UIColor colorWithWhite:0 alpha:0.16].CGColor;\n            CGColorRef opaqueShadowColor = CGColorCreateCopyWithAlpha(shadowColor, 1.0);\n            CGContextAddPath(context, fillPath);\n            CGContextClip(context);\n            CGContextSetAlpha(context, CGColorGetAlpha(shadowColor));\n            CGContextBeginTransparencyLayer(context, NULL); {\n                CGContextSetShadowWithColor(context, offset, blurRadius, opaqueShadowColor);\n                CGContextSetBlendMode(context, kCGBlendModeSourceOut);\n                CGContextSetFillColorWithColor(context, opaqueShadowColor);\n                CGContextAddPath(context, fillPath);\n                CGContextFillPath(context);\n            } CGContextEndTransparencyLayer(context);\n            CGColorRelease(opaqueShadowColor);\n        } CGContextRestoreGState(context);\n        \n        // outer shadow\n        CGContextSaveGState(context); {\n            CGContextAddPath(context, boxPath);\n            CGContextAddPath(context, fillPath);\n            CGContextEOClip(context);\n            CGColorRef shadowColor = [UIColor colorWithWhite:0 alpha:0.32].CGColor;\n            CGContextSetShadowWithColor(context, CGSizeMake(0, 1.5), 3, shadowColor);\n            CGContextBeginTransparencyLayer(context, NULL); {\n                CGContextAddPath(context, fillPath);\n                [[UIColor colorWithWhite:0.7 alpha:1.000] setFill];\n                CGContextFillPath(context);\n            } CGContextEndTransparencyLayer(context);\n        } CGContextRestoreGState(context);\n        \n        // stroke\n        CGContextSaveGState(context); {\n            CGContextAddPath(context, strokePath);\n            [[UIColor colorWithWhite:0.6 alpha:1] setStroke];\n            CGContextSetLineWidth(context, YYTextCGFloatFromPixel(1));\n            CGContextStrokePath(context);\n        } CGContextRestoreGState(context);\n        \n        CFRelease(boxPath);\n        CFRelease(fillPath);\n        CFRelease(strokePath);\n        \n        image = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        \n    });\n    return image;\n}\n\n\n#undef kMultiple\n#undef kDiameter\n#undef kPadding\n#undef kSize\n\n@end\n\n\n\n@interface _YYTextMagnifierRanged : YYTextMagnifier {\n    UIImageView *_contentView;\n    UIImageView *_coverView;\n}\n@end\n\n\n@implementation _YYTextMagnifierRanged\n#define kMultiple 1.2\n#define kSize CGSizeMake(141, 60)\n#define kPadding YYTextCGFloatPixelHalf(6.0)\n#define kRadius 6.0\n#define kHeight 32.0\n#define kArrow 14.0\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    _contentView = [UIImageView new];\n    _contentView.frame = CGRectMake(kPadding, kPadding, kSize.width - 2 * kPadding, kHeight);\n    _contentView.layer.cornerRadius = kRadius;\n    _contentView.clipsToBounds = YES;\n    [self addSubview:_contentView];\n    \n    _coverView = [UIImageView new];\n    _coverView.frame = (CGRect){.origin = CGPointZero, .size = kSize};\n    _coverView.image = [self.class coverImage];\n    [self addSubview:_coverView];\n    \n    self.layer.anchorPoint = CGPointMake(0.5, 1.2);\n    return self;\n}\n\n- (instancetype)init {\n    self = [self initWithFrame:CGRectZero];\n    self.frame = (CGRect){.size = [self sizeThatFits:CGSizeZero]};\n    return self;\n}\n\n- (YYTextMagnifierType)type {\n    return YYTextMagnifierTypeRanged;\n}\n\n- (CGSize)sizeThatFits:(CGSize)size {\n    return kSize;\n}\n\n- (void)setSnapshot:(UIImage *)snapshot {\n    if (self.captureFadeAnimation) {\n        [_contentView.layer removeAnimationForKey:@\"contents\"];\n        CABasicAnimation *animation = [CABasicAnimation animation];\n        animation.duration = kCaptureDisableFadeTime;\n        animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];\n        [_contentView.layer addAnimation:animation forKey:@\"contents\"];\n    }\n    _contentView.image = snapshot;\n}\n\n- (UIImage *)snapshot {\n    return _contentView.image;\n}\n\n- (CGSize)snapshotSize {\n    CGSize size;\n    size.width = floor((kSize.width - 2 * kPadding) / kMultiple);\n    size.height = floor(kHeight / kMultiple);\n    return size;\n}\n\n- (CGSize)fitSize {\n    return [self sizeThatFits:CGSizeZero];\n}\n\n+ (UIImage *)coverImage {\n    static UIImage *image;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        CGSize size = kSize;\n        CGRect rect = (CGRect) {.size = size, .origin = CGPointZero};\n        \n        UIGraphicsBeginImageContextWithOptions(size, NO, 0);\n        CGContextRef context = UIGraphicsGetCurrentContext();\n        \n        CGPathRef boxPath = CGPathCreateWithRect(rect, NULL);\n        \n        CGMutablePathRef path = CGPathCreateMutable();\n        CGPathMoveToPoint(path, NULL, kPadding + kRadius, kPadding);\n        CGPathAddLineToPoint(path, NULL, size.width - kPadding - kRadius, kPadding);\n        CGPathAddQuadCurveToPoint(path, NULL, size.width - kPadding, kPadding, size.width - kPadding, kPadding + kRadius);\n        CGPathAddLineToPoint(path, NULL, size.width - kPadding, kHeight);\n        CGPathAddCurveToPoint(path, NULL, size.width - kPadding, kPadding + kHeight, size.width - kPadding - kRadius, kPadding + kHeight, size.width - kPadding - kRadius, kPadding + kHeight);\n        CGPathAddLineToPoint(path, NULL, size.width / 2 + kArrow, kPadding + kHeight);\n        CGPathAddLineToPoint(path, NULL, size.width / 2, kPadding + kHeight + kArrow);\n        CGPathAddLineToPoint(path, NULL, size.width / 2 - kArrow, kPadding + kHeight);\n        CGPathAddLineToPoint(path, NULL, kPadding + kRadius, kPadding + kHeight);\n        CGPathAddQuadCurveToPoint(path, NULL, kPadding, kPadding + kHeight, kPadding, kHeight);\n        CGPathAddLineToPoint(path, NULL, kPadding, kPadding + kRadius);\n        CGPathAddQuadCurveToPoint(path, NULL, kPadding, kPadding, kPadding + kRadius, kPadding);\n        CGPathCloseSubpath(path);\n        \n        CGMutablePathRef arrowPath = CGPathCreateMutable();\n        CGPathMoveToPoint(arrowPath, NULL, size.width / 2 - kArrow, YYTextCGFloatPixelFloor(kPadding) + kHeight);\n        CGPathAddLineToPoint(arrowPath, NULL, size.width / 2 + kArrow, YYTextCGFloatPixelFloor(kPadding) + kHeight);\n        CGPathAddLineToPoint(arrowPath, NULL, size.width / 2, kPadding + kHeight + kArrow);\n        CGPathCloseSubpath(arrowPath);\n        \n        // inner shadow\n        CGContextSaveGState(context); {\n            CGFloat blurRadius = 25;\n            CGSize offset = CGSizeMake(0, 15);\n            CGColorRef shadowColor = [UIColor colorWithWhite:0 alpha:0.16].CGColor;\n            CGColorRef opaqueShadowColor = CGColorCreateCopyWithAlpha(shadowColor, 1.0);\n            CGContextAddPath(context, path);\n            CGContextClip(context);\n            CGContextSetAlpha(context, CGColorGetAlpha(shadowColor));\n            CGContextBeginTransparencyLayer(context, NULL); {\n                CGContextSetShadowWithColor(context, offset, blurRadius, opaqueShadowColor);\n                CGContextSetBlendMode(context, kCGBlendModeSourceOut);\n                CGContextSetFillColorWithColor(context, opaqueShadowColor);\n                CGContextAddPath(context, path);\n                CGContextFillPath(context);\n            } CGContextEndTransparencyLayer(context);\n            CGColorRelease(opaqueShadowColor);\n        } CGContextRestoreGState(context);\n        \n        // outer shadow\n        CGContextSaveGState(context); {\n            CGContextAddPath(context, boxPath);\n            CGContextAddPath(context, path);\n            CGContextEOClip(context);\n            CGColorRef shadowColor = [UIColor colorWithWhite:0 alpha:0.32].CGColor;\n            CGContextSetShadowWithColor(context, CGSizeMake(0, 1.5), 3, shadowColor);\n            CGContextBeginTransparencyLayer(context, NULL); {\n                CGContextAddPath(context, path);\n                [[UIColor colorWithWhite:0.7 alpha:1.000] setFill];\n                CGContextFillPath(context);\n            } CGContextEndTransparencyLayer(context);\n        } CGContextRestoreGState(context);\n        \n        // arrow\n        CGContextSaveGState(context); {\n            CGContextAddPath(context, arrowPath);\n            [[UIColor colorWithWhite:1 alpha:0.95] set];\n            CGContextFillPath(context);\n        } CGContextRestoreGState(context);\n        \n        // stroke\n        CGContextSaveGState(context); {\n            CGContextAddPath(context, path);\n            [[UIColor colorWithWhite:0.6 alpha:1] setStroke];\n            CGContextSetLineWidth(context, YYTextCGFloatFromPixel(1));\n            CGContextStrokePath(context);\n        } CGContextRestoreGState(context);\n        \n        CFRelease(boxPath);\n        CFRelease(path);\n        CFRelease(arrowPath);\n        \n        image = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        \n    });\n    return image;\n}\n\n#undef kMultiple\n#undef kSize\n#undef kPadding\n#undef kRadius\n#undef kHeight\n#undef kArrow\n\n@end\n\n\n@implementation YYTextMagnifier\n\n+ (id)magnifierWithType:(YYTextMagnifierType)type {\n    switch (type) {\n        case YYTextMagnifierTypeCaret :return [_YYTextMagnifierCaret new];\n        case YYTextMagnifierTypeRanged :return [_YYTextMagnifierRanged new];\n    }\n    return nil;\n}\n\n- (id)initWithFrame:(CGRect)frame {\n    // class cluster\n    if ([self isMemberOfClass:[YYTextMagnifier class]]) {\n        @throw [NSException exceptionWithName:NSStringFromClass([self class]) reason:@\"Attempting to instantiate an abstract class. Use a concrete subclass instead.\" userInfo:nil];\n        return nil;\n    }\n    self = [super initWithFrame:frame];\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextSelectionView.h",
    "content": "//\n//  YYTextSelectionView.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextAttribute.h>\n#import <YYText/YYTextInput.h>\n#else\n#import \"YYTextAttribute.h\"\n#import \"YYTextInput.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A single dot view. The frame should be foursquare.\n Change the background color for display.\n \n @discussion Typically, you should not use this class directly.\n */\n@interface YYSelectionGrabberDot : UIView\n/// Dont't access this property. It was used by `YYTextEffectWindow`.\n@property (nonatomic, strong) UIView *mirror;\n@end\n\n\n/**\n A grabber (stick with a dot).\n \n @discussion Typically, you should not use this class directly.\n */\n@interface YYSelectionGrabber : UIView\n\n@property (nonatomic, readonly) YYSelectionGrabberDot *dot; ///< the dot view\n@property (nonatomic) YYTextDirection dotDirection;         ///< don't support composite direction\n@property (nullable, nonatomic, strong) UIColor *color;     ///< tint color, default is nil\n\n@end\n\n\n/**\n The selection view for text edit and select.\n \n @discussion Typically, you should not use this class directly.\n */\n@interface YYTextSelectionView : UIView\n\n@property (nullable, nonatomic, weak) UIView *hostView; ///< the holder view\n@property (nullable, nonatomic, strong) UIColor *color; ///< the tint color\n@property (nonatomic, getter = isCaretBlinks) BOOL caretBlinks; ///< whether the caret is blinks\n@property (nonatomic, getter = isCaretVisible) BOOL caretVisible; ///< whether the caret is visible\n@property (nonatomic, getter = isVerticalForm) BOOL verticalForm; ///< weather the text view is vertical form\n\n@property (nonatomic) CGRect caretRect; ///< caret rect (width==0 or height==0)\n@property (nullable, nonatomic, copy) NSArray<YYTextSelectionRect *> *selectionRects; ///< default is nil\n\n@property (nonatomic, readonly) UIView *caretView;\n@property (nonatomic, readonly) YYSelectionGrabber *startGrabber;\n@property (nonatomic, readonly) YYSelectionGrabber *endGrabber;\n\n- (BOOL)isGrabberContainsPoint:(CGPoint)point;\n- (BOOL)isStartGrabberContainsPoint:(CGPoint)point;\n- (BOOL)isEndGrabberContainsPoint:(CGPoint)point;\n- (BOOL)isCaretContainsPoint:(CGPoint)point;\n- (BOOL)isSelectionRectsContainsPoint:(CGPoint)point;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Component/YYTextSelectionView.m",
    "content": "//\n//  YYTextSelectionView.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextSelectionView.h\"\n#import \"YYTextUtilities.h\"\n#import \"YYTextWeakProxy.h\"\n\n#define kMarkAlpha 0.2\n#define kLineWidth 2.0\n#define kBlinkDuration 0.5\n#define kBlinkFadeDuration 0.2\n#define kBlinkFirstDelay 0.1\n#define kTouchTestExtend 14.0\n#define kTouchDotExtend 7.0\n\n\n@implementation YYSelectionGrabberDot\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (!self) return nil;\n    self.userInteractionEnabled = NO;\n    self.mirror = [UIView new];\n    return self;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    CGFloat length = MIN(self.bounds.size.width, self.bounds.size.height);\n    self.layer.cornerRadius = length * 0.5;\n    self.mirror.bounds = self.bounds;\n    self.mirror.layer.cornerRadius = self.layer.cornerRadius;\n}\n\n- (void)setBackgroundColor:(UIColor *)backgroundColor {\n    [super setBackgroundColor:backgroundColor];\n    _mirror.backgroundColor = backgroundColor;    \n}\n\n@end\n\n\n\n@implementation YYSelectionGrabber\n\n- (instancetype) initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (!self) return nil;\n    _dot = [[YYSelectionGrabberDot alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];\n    return self;\n}\n\n- (void)setDotDirection:(YYTextDirection)dotDirection {\n    _dotDirection = dotDirection;\n    [self addSubview:_dot];\n    CGRect frame = _dot.frame;\n    CGFloat ofs = 0.5;\n    if (dotDirection == YYTextDirectionTop) {\n        frame.origin.y = -frame.size.height + ofs;\n        frame.origin.x = (self.bounds.size.width - frame.size.width) / 2;\n    } else if (dotDirection == YYTextDirectionRight) {\n        frame.origin.x = self.bounds.size.width - ofs;\n        frame.origin.y = (self.bounds.size.height - frame.size.height) / 2;\n    } else if (dotDirection == YYTextDirectionBottom) {\n        frame.origin.y = self.bounds.size.height - ofs;\n        frame.origin.x = (self.bounds.size.width - frame.size.width) / 2;\n    } else if (dotDirection == YYTextDirectionLeft) {\n        frame.origin.x = -frame.size.width + ofs;\n        frame.origin.y = (self.bounds.size.height - frame.size.height) / 2;\n    } else {\n        [_dot removeFromSuperview];\n    }\n    _dot.frame = frame;\n}\n\n- (void)setColor:(UIColor *)color {\n    self.backgroundColor = color;\n    _dot.backgroundColor = color;\n    _color = color;\n}\n\n- (void)layoutSubviews {\n    [super layoutSubviews];\n    [self setDotDirection:_dotDirection];\n}\n\n- (CGRect)touchRect {\n    CGRect rect = CGRectInset(self.frame, -kTouchTestExtend, -kTouchTestExtend);\n    UIEdgeInsets insets = {0};\n    if (_dotDirection == YYTextDirectionTop) {\n        insets.top = -kTouchDotExtend;\n    } else if (_dotDirection == YYTextDirectionRight) {\n        insets.right = -kTouchDotExtend;\n    } else if (_dotDirection == YYTextDirectionBottom) {\n        insets.bottom = -kTouchDotExtend;\n    } else if (_dotDirection == YYTextDirectionLeft) {\n        insets.left = -kTouchDotExtend;\n    }\n    rect = UIEdgeInsetsInsetRect(rect, insets);\n    return rect;\n}\n\n@end\n\n\n\n@interface YYTextSelectionView ()\n@property (nonatomic, strong) NSTimer *caretTimer;\n@property (nonatomic, strong) UIView *caretView;\n@property (nonatomic, strong) YYSelectionGrabber *startGrabber;\n@property (nonatomic, strong) YYSelectionGrabber *endGrabber;\n@property (nonatomic, strong) NSMutableArray *markViews;\n@end\n\n@implementation YYTextSelectionView\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (!self) return nil;\n    \n    self.userInteractionEnabled = NO;\n    self.clipsToBounds = NO;\n    _markViews = [NSMutableArray array];\n    _caretView = [UIView new];\n    _caretView.hidden = YES;\n    _startGrabber = [YYSelectionGrabber new];\n    _startGrabber.dotDirection = YYTextDirectionTop;\n    _startGrabber.hidden = YES;\n    _endGrabber = [YYSelectionGrabber new];\n    _endGrabber.dotDirection = YYTextDirectionBottom;\n    _endGrabber.hidden = YES;\n    \n    [self addSubview:_startGrabber];\n    [self addSubview:_endGrabber];\n    [self addSubview:_caretView];\n    \n    return self;\n}\n\n- (void)dealloc {\n    [_caretTimer invalidate];\n}\n\n- (void)setColor:(UIColor *)color {\n    _color = color;\n    self.caretView.backgroundColor = color;\n    self.startGrabber.color = color;\n    self.endGrabber.color = color;\n    [self.markViews enumerateObjectsUsingBlock: ^(UIView *v, NSUInteger idx, BOOL *stop) {\n        v.backgroundColor = color;\n    }];\n}\n\n- (void)setCaretBlinks:(BOOL)caretBlinks {\n    if (_caretBlinks != caretBlinks) {\n        _caretView.alpha = 1;\n        [self.class cancelPreviousPerformRequestsWithTarget:self selector:@selector(_startBlinks) object:nil];\n        if (caretBlinks) {\n            [self performSelector:@selector(_startBlinks) withObject:nil afterDelay:kBlinkFirstDelay];\n        } else {\n            [_caretTimer invalidate];\n            _caretTimer = nil;\n        }\n        _caretBlinks = caretBlinks;\n    }\n}\n\n- (void)_startBlinks {\n    [_caretTimer invalidate];\n    if (_caretVisible) {\n        _caretTimer = [NSTimer timerWithTimeInterval:kBlinkDuration target:[YYTextWeakProxy proxyWithTarget:self] selector:@selector(_doBlink) userInfo:nil repeats:YES];\n        [[NSRunLoop currentRunLoop] addTimer:_caretTimer forMode:NSDefaultRunLoopMode];\n    } else {\n        _caretView.alpha = 1;\n    }\n}\n\n- (void)_doBlink {\n    [UIView animateWithDuration:kBlinkFadeDuration delay:0 options:UIViewAnimationOptionCurveEaseInOut animations: ^{\n        if (_caretView.alpha == 1) _caretView.alpha = 0;\n        else _caretView.alpha = 1;\n    } completion:NULL];\n}\n\n- (void)setCaretVisible:(BOOL)caretVisible {\n    _caretVisible = caretVisible;\n    self.caretView.hidden = !caretVisible;\n    _caretView.alpha = 1;\n    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_startBlinks) object:nil];\n    if (_caretBlinks) {\n        [self performSelector:@selector(_startBlinks) withObject:nil afterDelay:kBlinkFirstDelay];\n    }\n}\n\n- (void)setVerticalForm:(BOOL)verticalForm {\n    if (_verticalForm != verticalForm) {\n        _verticalForm = verticalForm;\n        [self setCaretRect:_caretRect];\n        self.startGrabber.dotDirection = verticalForm ? YYTextDirectionRight : YYTextDirectionTop;\n        self.endGrabber.dotDirection = verticalForm ? YYTextDirectionLeft : YYTextDirectionBottom;\n    }\n}\n\n- (CGRect)_standardCaretRect:(CGRect)caretRect {\n    caretRect = CGRectStandardize(caretRect);\n    if (_verticalForm) {\n        if (caretRect.size.height == 0) {\n            caretRect.size.height = kLineWidth;\n            caretRect.origin.y -= kLineWidth * 0.5;\n        }\n        if (caretRect.origin.y < 0) {\n            caretRect.origin.y = 0;\n        } else if (caretRect.origin.y + caretRect.size.height > self.bounds.size.height) {\n            caretRect.origin.y = self.bounds.size.height - caretRect.size.height;\n        }\n    } else {\n        if (caretRect.size.width == 0) {\n            caretRect.size.width = kLineWidth;\n            caretRect.origin.x -= kLineWidth * 0.5;\n        }\n        if (caretRect.origin.x < 0) {\n            caretRect.origin.x = 0;\n        } else if (caretRect.origin.x + caretRect.size.width > self.bounds.size.width) {\n            caretRect.origin.x = self.bounds.size.width - caretRect.size.width;\n        }\n    }\n    caretRect = YYTextCGRectPixelRound(caretRect);\n    if (isnan(caretRect.origin.x) || isinf(caretRect.origin.x)) caretRect.origin.x = 0;\n    if (isnan(caretRect.origin.y) || isinf(caretRect.origin.y)) caretRect.origin.y = 0;\n    if (isnan(caretRect.size.width) || isinf(caretRect.size.width)) caretRect.size.width = 0;\n    if (isnan(caretRect.size.height) || isinf(caretRect.size.height)) caretRect.size.height = 0;\n    return caretRect;\n}\n\n- (void)setCaretRect:(CGRect)caretRect {\n    _caretRect = caretRect;\n    self.caretView.frame = [self _standardCaretRect:caretRect];\n    CGFloat minWidth = MIN(self.caretView.bounds.size.width, self.caretView.bounds.size.height);\n    self.caretView.layer.cornerRadius = minWidth / 2;\n}\n\n- (void)setSelectionRects:(NSArray *)selectionRects {\n    _selectionRects = selectionRects.copy;\n    [self.markViews enumerateObjectsUsingBlock: ^(UIView *v, NSUInteger idx, BOOL *stop) {\n        [v removeFromSuperview];\n    }];\n    [self.markViews removeAllObjects];\n    self.startGrabber.hidden = YES;\n    self.endGrabber.hidden = YES;\n    \n    [selectionRects enumerateObjectsUsingBlock: ^(YYTextSelectionRect *r, NSUInteger idx, BOOL *stop) {\n        CGRect rect = r.rect;\n        rect = CGRectStandardize(rect);\n        rect = YYTextCGRectPixelRound(rect);\n        if (r.containsStart || r.containsEnd) {\n            rect = [self _standardCaretRect:rect];\n            if (r.containsStart) {\n                self.startGrabber.hidden = NO;\n                self.startGrabber.frame = rect;\n            }\n            if (r.containsEnd) {\n                self.endGrabber.hidden = NO;\n                self.endGrabber.frame = rect;\n            }\n        } else {\n            if (rect.size.width > 0 && rect.size.height > 0) {\n                UIView *mark = [[UIView alloc] initWithFrame:rect];\n                mark.backgroundColor = _color;\n                mark.alpha = kMarkAlpha;\n                [self insertSubview:mark atIndex:0];\n                [self.markViews addObject:mark];\n            }\n        }\n    }];\n}\n\n- (BOOL)isGrabberContainsPoint:(CGPoint)point {\n    return [self isStartGrabberContainsPoint:point] || [self isEndGrabberContainsPoint:point];\n}\n\n- (BOOL)isStartGrabberContainsPoint:(CGPoint)point {\n    if (_startGrabber.hidden) return NO;\n    CGRect startRect = [_startGrabber touchRect];\n    CGRect endRect = [_endGrabber touchRect];\n    if (CGRectIntersectsRect(startRect, endRect)) {\n        CGFloat distStart = YYTextCGPointGetDistanceToPoint(point, YYTextCGRectGetCenter(startRect));\n        CGFloat distEnd = YYTextCGPointGetDistanceToPoint(point, YYTextCGRectGetCenter(endRect));\n        if (distEnd <= distStart) return NO;\n    }\n    return CGRectContainsPoint(startRect, point);\n}\n\n- (BOOL)isEndGrabberContainsPoint:(CGPoint)point {\n    if (_endGrabber.hidden) return NO;\n    CGRect startRect = [_startGrabber touchRect];\n    CGRect endRect = [_endGrabber touchRect];\n    if (CGRectIntersectsRect(startRect, endRect)) {\n        CGFloat distStart = YYTextCGPointGetDistanceToPoint(point, YYTextCGRectGetCenter(startRect));\n        CGFloat distEnd = YYTextCGPointGetDistanceToPoint(point, YYTextCGRectGetCenter(endRect));\n        if (distEnd > distStart) return NO;\n    }\n    return CGRectContainsPoint(endRect, point);\n}\n\n- (BOOL)isCaretContainsPoint:(CGPoint)point {\n    if (_caretVisible) {\n        CGRect rect = CGRectInset(_caretRect, -kTouchTestExtend, -kTouchTestExtend);\n        return CGRectContainsPoint(rect, point);\n    }\n    return NO;\n}\n\n- (BOOL)isSelectionRectsContainsPoint:(CGPoint)point {\n    if (_selectionRects.count == 0) return NO;\n    for (YYTextSelectionRect *rect in _selectionRects) {\n        if (CGRectContainsPoint(rect.rect, point)) return YES;\n    }\n    return NO;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextArchiver.h",
    "content": "//\n//  YYTextArchiver.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/16.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A subclass of `NSKeyedArchiver` which implement `NSKeyedArchiverDelegate` protocol.\n \n The archiver can encode the object which contains\n CGColor/CGImage/CTRunDelegateRef/.. (such as NSAttributedString).\n */\n@interface YYTextArchiver : NSKeyedArchiver <NSKeyedArchiverDelegate>\n@end\n\n/**\n A subclass of `NSKeyedUnarchiver` which implement `NSKeyedUnarchiverDelegate` \n protocol. The unarchiver can decode the data which is encoded by \n `YYTextArchiver` or `NSKeyedArchiver`.\n */\n@interface YYTextUnarchiver : NSKeyedUnarchiver <NSKeyedUnarchiverDelegate>\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextArchiver.m",
    "content": "//\n//  YYTextArchiver.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/16.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextArchiver.h\"\n#import \"YYTextRunDelegate.h\"\n#import \"YYTextRubyAnnotation.h\"\n\n/**\n When call CTRunDelegateGetTypeID() on some devices (runs iOS6), I got the error:\n \"dyld: lazy symbol binding failed: Symbol not found: _CTRunDelegateGetTypeID\"\n \n Here's a workaround for this issue.\n */\nstatic CFTypeID CTRunDelegateTypeID() {\n    static CFTypeID typeID;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        /*\n        if ((long)CTRunDelegateGetTypeID + 1 > 1) { //avoid compiler optimization\n            typeID = CTRunDelegateGetTypeID();\n        }\n         */\n        YYTextRunDelegate *delegate = [YYTextRunDelegate new];\n        CTRunDelegateRef ref = delegate.CTRunDelegate;\n        typeID = CFGetTypeID(ref);\n        CFRelease(ref);\n    });\n    return typeID;\n}\n\nstatic CFTypeID CTRubyAnnotationTypeID() {\n    static CFTypeID typeID;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        if ((long)CTRubyAnnotationGetTypeID + 1 > 1) { //avoid compiler optimization\n            typeID = CTRunDelegateGetTypeID();\n        } else {\n            typeID = kCFNotFound;\n        }\n    });\n    return typeID;\n}\n\n/**\n A wrapper for CGColorRef. Used for Archive/Unarchive/Copy.\n */\n@interface _YYCGColor : NSObject <NSCopying, NSCoding>\n@property (nonatomic, assign) CGColorRef CGColor;\n+ (instancetype)colorWithCGColor:(CGColorRef)CGColor;\n@end\n\n@implementation _YYCGColor\n\n+ (instancetype)colorWithCGColor:(CGColorRef)CGColor {\n    _YYCGColor *color = [self new];\n    color.CGColor = CGColor;\n    return color;\n}\n\n- (void)setCGColor:(CGColorRef)CGColor {\n    if (_CGColor != CGColor) {\n        if (CGColor) CGColor = (CGColorRef)CFRetain(CGColor);\n        if (_CGColor) CFRelease(_CGColor);\n        _CGColor = CGColor;\n    }\n}\n\n- (void)dealloc {\n    if (_CGColor) CFRelease(_CGColor);\n    _CGColor = NULL;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    _YYCGColor *color = [self.class new];\n    color.CGColor = self.CGColor;\n    return color;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    UIColor *color = [UIColor colorWithCGColor:_CGColor];\n    [aCoder encodeObject:color forKey:@\"color\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [self init];\n    UIColor *color = [aDecoder decodeObjectForKey:@\"color\"];\n    self.CGColor = color.CGColor;\n    return self;\n}\n\n@end\n\n/**\n A wrapper for CGImageRef. Used for Archive/Unarchive/Copy.\n */\n@interface _YYCGImage : NSObject <NSCoding, NSCopying>\n@property (nonatomic, assign) CGImageRef CGImage;\n+ (instancetype)imageWithCGImage:(CGImageRef)CGImage;\n@end\n\n@implementation _YYCGImage\n\n+ (instancetype)imageWithCGImage:(CGImageRef)CGImage {\n    _YYCGImage *image = [self new];\n    image.CGImage = CGImage;\n    return image;\n}\n\n- (void)setCGImage:(CGImageRef)CGImage {\n    if (_CGImage != CGImage) {\n        if (CGImage) CGImage = (CGImageRef)CFRetain(CGImage);\n        if (_CGImage) CFRelease(_CGImage);\n        _CGImage = CGImage;\n    }\n}\n\n- (void)dealloc {\n    if (_CGImage) CFRelease(_CGImage);\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    _YYCGImage *image = [self.class new];\n    image.CGImage = self.CGImage;\n    return image;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    UIImage *image = [UIImage imageWithCGImage:_CGImage];\n    [aCoder encodeObject:image forKey:@\"image\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [self init];\n    UIImage *image = [aDecoder decodeObjectForKey:@\"image\"];\n    self.CGImage = image.CGImage;\n    return self;\n}\n\n@end\n\n\n@implementation YYTextArchiver\n\n+ (NSData *)archivedDataWithRootObject:(id)rootObject {\n    if (!rootObject) return nil;\n    NSMutableData *data = [NSMutableData data];\n    YYTextArchiver *archiver = [[[self class] alloc] initForWritingWithMutableData:data];\n    [archiver encodeRootObject:rootObject];\n    [archiver finishEncoding];\n    return data;\n}\n\n+ (BOOL)archiveRootObject:(id)rootObject toFile:(NSString *)path {\n    NSData *data = [self archivedDataWithRootObject:rootObject];\n    if (!data) return NO;\n    return [data writeToFile:path atomically:YES];\n}\n\n- (instancetype)init {\n    self = [super init];\n    self.delegate = self;\n    return self;\n}\n\n- (instancetype)initForWritingWithMutableData:(NSMutableData *)data {\n    self = [super initForWritingWithMutableData:data];\n    self.delegate = self;\n    return self;\n}\n\n- (id)archiver:(NSKeyedArchiver *)archiver willEncodeObject:(id)object {\n    CFTypeID typeID = CFGetTypeID((CFTypeRef)object);\n    if (typeID == CTRunDelegateTypeID()) {\n        CTRunDelegateRef runDelegate = (__bridge CFTypeRef)(object);\n        id ref = CTRunDelegateGetRefCon(runDelegate);\n        if (ref) return ref;\n    } else if (typeID == CTRubyAnnotationTypeID()) {\n        CTRubyAnnotationRef ctRuby = (__bridge CFTypeRef)(object);\n        YYTextRubyAnnotation *ruby = [YYTextRubyAnnotation rubyWithCTRubyRef:ctRuby];\n        if (ruby) return ruby;\n    } else if (typeID == CGColorGetTypeID()) {\n        return [_YYCGColor colorWithCGColor:(CGColorRef)object];\n    } else if (typeID == CGImageGetTypeID()) {\n        return [_YYCGImage imageWithCGImage:(CGImageRef)object];\n    }\n    return object;\n}\n\n@end\n\n\n@implementation YYTextUnarchiver\n\n+ (id)unarchiveObjectWithData:(NSData *)data {\n    if (data.length == 0) return nil;\n    YYTextUnarchiver *unarchiver = [[self alloc] initForReadingWithData:data];\n    return [unarchiver decodeObject];\n}\n\n+ (id)unarchiveObjectWithFile:(NSString *)path {\n    NSData *data = [NSData dataWithContentsOfFile:path];\n    return [self unarchiveObjectWithData:data];\n}\n\n- (instancetype)init {\n    self = [super init];\n    self.delegate = self;\n    return self;\n}\n\n- (instancetype)initForReadingWithData:(NSData *)data {\n    self = [super initForReadingWithData:data];\n    self.delegate = self;\n    return self;\n}\n\n- (id)unarchiver:(NSKeyedUnarchiver *)unarchiver didDecodeObject:(id) NS_RELEASES_ARGUMENT object NS_RETURNS_RETAINED {\n    if ([object class] == [YYTextRunDelegate class]) {\n        YYTextRunDelegate *runDelegate = object;\n        CTRunDelegateRef ct = runDelegate.CTRunDelegate;\n        id ctObj = (__bridge id)ct;\n        if (ct) CFRelease(ct);\n        return ctObj;\n    } else if ([object class] == [YYTextRubyAnnotation class]) {\n        YYTextRubyAnnotation *ruby = object;\n        if ([UIDevice currentDevice].systemVersion.floatValue >= 8) {\n            CTRubyAnnotationRef ct = ruby.CTRubyAnnotation;\n            id ctObj = (__bridge id)(ct);\n            if (ct) CFRelease(ct);\n            return ctObj;\n        } else {\n            return object;\n        }\n    } else if ([object class] == [_YYCGColor class]) {\n        _YYCGColor *color = object;\n        return (id)color.CGColor;\n    } else if ([object class] == [_YYCGImage class]) {\n        _YYCGImage *image = object;\n        return (id)image.CGImage;\n    }\n    return object;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextAttribute.h",
    "content": "//\n//  YYTextAttribute.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/26.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n#pragma mark - Enum Define\n\n/// The attribute type\ntypedef NS_OPTIONS(NSInteger, YYTextAttributeType) {\n    YYTextAttributeTypeNone     = 0,\n    YYTextAttributeTypeUIKit    = 1 << 0, ///< UIKit attributes, such as UILabel/UITextField/drawInRect.\n    YYTextAttributeTypeCoreText = 1 << 1, ///< CoreText attributes, used by CoreText.\n    YYTextAttributeTypeYYText   = 1 << 2, ///< YYText attributes, used by YYText.\n};\n\n/// Get the attribute type from an attribute name.\nextern YYTextAttributeType YYTextAttributeGetType(NSString *attributeName);\n\n/**\n Line style in YYText (similar to NSUnderlineStyle).\n */\ntypedef NS_OPTIONS (NSInteger, YYTextLineStyle) {\n    // basic style (bitmask:0xFF)\n    YYTextLineStyleNone       = 0x00, ///< (        ) Do not draw a line (Default).\n    YYTextLineStyleSingle     = 0x01, ///< (──────) Draw a single line.\n    YYTextLineStyleThick      = 0x02, ///< (━━━━━━━) Draw a thick line.\n    YYTextLineStyleDouble     = 0x09, ///< (══════) Draw a double line.\n    \n    // style pattern (bitmask:0xF00)\n    YYTextLineStylePatternSolid      = 0x000, ///< (────────) Draw a solid line (Default).\n    YYTextLineStylePatternDot        = 0x100, ///< (‑ ‑ ‑ ‑ ‑ ‑) Draw a line of dots.\n    YYTextLineStylePatternDash       = 0x200, ///< (— — — —) Draw a line of dashes.\n    YYTextLineStylePatternDashDot    = 0x300, ///< (— ‑ — ‑ — ‑) Draw a line of alternating dashes and dots.\n    YYTextLineStylePatternDashDotDot = 0x400, ///< (— ‑ ‑ — ‑ ‑) Draw a line of alternating dashes and two dots.\n    YYTextLineStylePatternCircleDot  = 0x900, ///< (••••••••••••) Draw a line of small circle dots.\n};\n\n/**\n Text vertical alignment.\n */\ntypedef NS_ENUM(NSInteger, YYTextVerticalAlignment) {\n    YYTextVerticalAlignmentTop =    0, ///< Top alignment.\n    YYTextVerticalAlignmentCenter = 1, ///< Center alignment.\n    YYTextVerticalAlignmentBottom = 2, ///< Bottom alignment.\n};\n\n/**\n The direction define in YYText.\n */\ntypedef NS_OPTIONS(NSUInteger, YYTextDirection) {\n    YYTextDirectionNone   = 0,\n    YYTextDirectionTop    = 1 << 0,\n    YYTextDirectionRight  = 1 << 1,\n    YYTextDirectionBottom = 1 << 2,\n    YYTextDirectionLeft   = 1 << 3,\n};\n\n/**\n The trunction type, tells the truncation engine which type of truncation is being requested.\n */\ntypedef NS_ENUM (NSUInteger, YYTextTruncationType) {\n    /// No truncate.\n    YYTextTruncationTypeNone   = 0,\n    \n    /// Truncate at the beginning of the line, leaving the end portion visible.\n    YYTextTruncationTypeStart  = 1,\n    \n    /// Truncate at the end of the line, leaving the start portion visible.\n    YYTextTruncationTypeEnd    = 2,\n    \n    /// Truncate in the middle of the line, leaving both the start and the end portions visible.\n    YYTextTruncationTypeMiddle = 3,\n};\n\n\n\n#pragma mark - Attribute Name Defined in YYText\n\n/// The value of this attribute is a `YYTextBackedString` object.\n/// Use this attribute to store the original plain text if it is replaced by something else (such as attachment).\nUIKIT_EXTERN NSString *const YYTextBackedStringAttributeName;\n\n/// The value of this attribute is a `YYTextBinding` object.\n/// Use this attribute to bind a range of text together, as if it was a single charactor.\nUIKIT_EXTERN NSString *const YYTextBindingAttributeName;\n\n/// The value of this attribute is a `YYTextShadow` object.\n/// Use this attribute to add shadow to a range of text.\n/// Shadow will be drawn below text glyphs. Use YYTextShadow.subShadow to add multi-shadow.\nUIKIT_EXTERN NSString *const YYTextShadowAttributeName;\n\n/// The value of this attribute is a `YYTextShadow` object.\n/// Use this attribute to add inner shadow to a range of text.\n/// Inner shadow will be drawn above text glyphs. Use YYTextShadow.subShadow to add multi-shadow.\nUIKIT_EXTERN NSString *const YYTextInnerShadowAttributeName;\n\n/// The value of this attribute is a `YYTextDecoration` object.\n/// Use this attribute to add underline to a range of text.\n/// The underline will be drawn below text glyphs.\nUIKIT_EXTERN NSString *const YYTextUnderlineAttributeName;\n\n/// The value of this attribute is a `YYTextDecoration` object.\n/// Use this attribute to add strikethrough (delete line) to a range of text.\n/// The strikethrough will be drawn above text glyphs.\nUIKIT_EXTERN NSString *const YYTextStrikethroughAttributeName;\n\n/// The value of this attribute is a `YYTextBorder` object.\n/// Use this attribute to add cover border or cover color to a range of text.\n/// The border will be drawn above the text glyphs.\nUIKIT_EXTERN NSString *const YYTextBorderAttributeName;\n\n/// The value of this attribute is a `YYTextBorder` object.\n/// Use this attribute to add background border or background color to a range of text.\n/// The border will be drawn below the text glyphs.\nUIKIT_EXTERN NSString *const YYTextBackgroundBorderAttributeName;\n\n/// The value of this attribute is a `YYTextBorder` object.\n/// Use this attribute to add a code block border to one or more line of text.\n/// The border will be drawn below the text glyphs.\nUIKIT_EXTERN NSString *const YYTextBlockBorderAttributeName;\n\n/// The value of this attribute is a `YYTextAttachment` object.\n/// Use this attribute to add attachment to text.\n/// It should be used in conjunction with a CTRunDelegate.\nUIKIT_EXTERN NSString *const YYTextAttachmentAttributeName;\n\n/// The value of this attribute is a `YYTextHighlight` object.\n/// Use this attribute to add a touchable highlight state to a range of text.\nUIKIT_EXTERN NSString *const YYTextHighlightAttributeName;\n\n/// The value of this attribute is a `NSValue` object stores CGAffineTransform.\n/// Use this attribute to add transform to each glyph in a range of text.\nUIKIT_EXTERN NSString *const YYTextGlyphTransformAttributeName;\n\n\n\n#pragma mark - String Token Define\n\nUIKIT_EXTERN NSString *const YYTextAttachmentToken; ///< Object replacement character (U+FFFC), used for text attachment.\nUIKIT_EXTERN NSString *const YYTextTruncationToken; ///< Horizontal ellipsis (U+2026), used for text truncation  \"…\".\n\n\n\n#pragma mark - Attribute Value Define\n\n/**\n The tap/long press action callback defined in YYText.\n \n @param containerView The text container view (such as YYLabel/YYTextView).\n @param text          The whole text.\n @param range         The text range in `text` (if no range, the range.location is NSNotFound).\n @param rect          The text frame in `containerView` (if no data, the rect is CGRectNull).\n */\ntypedef void(^YYTextAction)(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect);\n\n\n/**\n YYTextBackedString objects are used by the NSAttributedString class cluster\n as the values for text backed string attributes (stored in the attributed \n string under the key named YYTextBackedStringAttributeName).\n \n It may used for copy/paste plain text from attributed string.\n Example: If :) is replace by a custom emoji (such as😊), the backed string can be set to @\":)\".\n */\n@interface YYTextBackedString : NSObject <NSCoding, NSCopying>\n+ (instancetype)stringWithString:(nullable NSString *)string;\n@property (nullable, nonatomic, copy) NSString *string; ///< backed string\n@end\n\n\n/**\n YYTextBinding objects are used by the NSAttributedString class cluster\n as the values for shadow attributes (stored in the attributed string under\n the key named YYTextBindingAttributeName).\n \n Add this to a range of text will make the specified characters 'binding together'.\n YYTextView will treat the range of text as a single character during text \n selection and edit.\n */\n@interface YYTextBinding : NSObject <NSCoding, NSCopying>\n+ (instancetype)bindingWithDeleteConfirm:(BOOL)deleteConfirm;\n@property (nonatomic) BOOL deleteConfirm; ///< confirm the range when delete in YYTextView\n@end\n\n\n/**\n YYTextShadow objects are used by the NSAttributedString class cluster\n as the values for shadow attributes (stored in the attributed string under\n the key named YYTextShadowAttributeName or YYTextInnerShadowAttributeName).\n \n It's similar to `NSShadow`, but offers more options.\n */\n@interface YYTextShadow : NSObject <NSCoding, NSCopying>\n+ (instancetype)shadowWithColor:(nullable UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius;\n\n@property (nullable, nonatomic, strong) UIColor *color; ///< shadow color\n@property (nonatomic) CGSize offset;                    ///< shadow offset\n@property (nonatomic) CGFloat radius;                   ///< shadow blur radius\n@property (nonatomic) CGBlendMode blendMode;            ///< shadow blend mode\n@property (nullable, nonatomic, strong) YYTextShadow *subShadow;  ///< a sub shadow which will be added above the parent shadow\n\n+ (instancetype)shadowWithNSShadow:(NSShadow *)nsShadow; ///< convert NSShadow to YYTextShadow\n- (NSShadow *)nsShadow; ///< convert YYTextShadow to NSShadow\n@end\n\n\n/**\n YYTextDecorationLine objects are used by the NSAttributedString class cluster\n as the values for decoration line attributes (stored in the attributed string under\n the key named YYTextUnderlineAttributeName or YYTextStrikethroughAttributeName).\n \n When it's used as underline, the line is drawn below text glyphs;\n when it's used as strikethrough, the line is drawn above text glyphs.\n */\n@interface YYTextDecoration : NSObject <NSCoding, NSCopying>\n+ (instancetype)decorationWithStyle:(YYTextLineStyle)style;\n+ (instancetype)decorationWithStyle:(YYTextLineStyle)style width:(nullable NSNumber *)width color:(nullable UIColor *)color;\n@property (nonatomic) YYTextLineStyle style;                   ///< line style\n@property (nullable, nonatomic, strong) NSNumber *width;       ///< line width (nil means automatic width)\n@property (nullable, nonatomic, strong) UIColor *color;        ///< line color (nil means automatic color)\n@property (nullable, nonatomic, strong) YYTextShadow *shadow;  ///< line shadow\n@end\n\n\n/**\n YYTextBorder objects are used by the NSAttributedString class cluster\n as the values for border attributes (stored in the attributed string under\n the key named YYTextBorderAttributeName or YYTextBackgroundBorderAttributeName).\n \n It can be used to draw a border around a range of text, or draw a background\n to a range of text.\n \n Example:\n    ╭──────╮\n    │ Text │\n    ╰──────╯\n */\n@interface YYTextBorder : NSObject <NSCoding, NSCopying>\n+ (instancetype)borderWithLineStyle:(YYTextLineStyle)lineStyle lineWidth:(CGFloat)width strokeColor:(nullable UIColor *)color;\n+ (instancetype)borderWithFillColor:(nullable UIColor *)color cornerRadius:(CGFloat)cornerRadius;\n@property (nonatomic) YYTextLineStyle lineStyle;              ///< border line style\n@property (nonatomic) CGFloat strokeWidth;                    ///< border line width\n@property (nullable, nonatomic, strong) UIColor *strokeColor; ///< border line color\n@property (nonatomic) CGLineJoin lineJoin;                    ///< border line join\n@property (nonatomic) UIEdgeInsets insets;                    ///< border insets for text bounds\n@property (nonatomic) CGFloat cornerRadius;                   ///< border corder radius\n@property (nullable, nonatomic, strong) YYTextShadow *shadow; ///< border shadow\n@property (nullable, nonatomic, strong) UIColor *fillColor;   ///< inner fill color\n@end\n\n\n/**\n YYTextAttachment objects are used by the NSAttributedString class cluster \n as the values for attachment attributes (stored in the attributed string under \n the key named YYTextAttachmentAttributeName).\n \n When display an attributed string which contains `YYTextAttachment` object,\n the content will be placed in text metric. If the content is `UIImage`, \n then it will be drawn to CGContext; if the content is `UIView` or `CALayer`, \n then it will be added to the text container's view or layer.\n */\n@interface YYTextAttachment : NSObject<NSCoding, NSCopying>\n+ (instancetype)attachmentWithContent:(nullable id)content;\n@property (nullable, nonatomic, strong) id content;             ///< Supported type: UIImage, UIView, CALayer\n@property (nonatomic) UIViewContentMode contentMode;            ///< Content display mode.\n@property (nonatomic) UIEdgeInsets contentInsets;               ///< The insets when drawing content.\n@property (nullable, nonatomic, strong) NSDictionary *userInfo; ///< The user information dictionary.\n@end\n\n\n/**\n YYTextHighlight objects are used by the NSAttributedString class cluster\n as the values for touchable highlight attributes (stored in the attributed string\n under the key named YYTextHighlightAttributeName).\n \n When display an attributed string in `YYLabel` or `YYTextView`, the range of \n highlight text can be toucheds down by users. If a range of text is turned into \n highlighted state, the `attributes` in `YYTextHighlight` will be used to modify \n (set or remove) the original attributes in the range for display.\n */\n@interface YYTextHighlight : NSObject <NSCoding, NSCopying>\n\n/**\n Attributes that you can apply to text in an attributed string when highlight.\n Key:   Same as CoreText/YYText Attribute Name.\n Value: Modify attribute value when highlight (NSNull for remove attribute).\n */\n@property (nullable, nonatomic, copy) NSDictionary<NSString *, id> *attributes;\n\n/**\n Creates a highlight object with specified attributes.\n \n @param attributes The attributes which will replace original attributes when highlight,\n        If the value is NSNull, it will removed when highlight.\n */\n+ (instancetype)highlightWithAttributes:(nullable NSDictionary<NSString *, id> *)attributes;\n\n/**\n Convenience methods to create a default highlight with the specifeid background color.\n \n @param color The background border color.\n */\n+ (instancetype)highlightWithBackgroundColor:(nullable UIColor *)color;\n\n// Convenience methods below to set the `attributes`.\n- (void)setFont:(nullable UIFont *)font;\n- (void)setColor:(nullable UIColor *)color;\n- (void)setStrokeWidth:(nullable NSNumber *)width;\n- (void)setStrokeColor:(nullable UIColor *)color;\n- (void)setShadow:(nullable YYTextShadow *)shadow;\n- (void)setInnerShadow:(nullable YYTextShadow *)shadow;\n- (void)setUnderline:(nullable YYTextDecoration *)underline;\n- (void)setStrikethrough:(nullable YYTextDecoration *)strikethrough;\n- (void)setBackgroundBorder:(nullable YYTextBorder *)border;\n- (void)setBorder:(nullable YYTextBorder *)border;\n- (void)setAttachment:(nullable YYTextAttachment *)attachment;\n\n/**\n The user information dictionary, default is nil.\n */\n@property (nullable, nonatomic, copy) NSDictionary *userInfo;\n\n/**\n Tap action when user tap the highlight, default is nil.\n If the value is nil, YYTextView or YYLabel will ask it's delegate to handle the tap action.\n */\n@property (nullable, nonatomic, copy) YYTextAction tapAction;\n\n/**\n Long press action when user long press the highlight, default is nil.\n If the value is nil, YYTextView or YYLabel will ask it's delegate to handle the long press action.\n */\n@property (nullable, nonatomic, copy) YYTextAction longPressAction;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextAttribute.m",
    "content": "//\n//  YYTextAttribute.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/26.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextAttribute.h\"\n#import <UIKit/UIKit.h>\n#import <CoreText/CoreText.h>\n#import \"NSAttributedString+YYText.h\"\n#import \"YYTextArchiver.h\"\n\n\nstatic double _YYDeviceSystemVersion() {\n    static double version;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        version = [UIDevice currentDevice].systemVersion.doubleValue;\n    });\n    return version;\n}\n\n\nNSString *const YYTextBackedStringAttributeName = @\"YYTextBackedString\";\nNSString *const YYTextBindingAttributeName = @\"YYTextBinding\";\nNSString *const YYTextShadowAttributeName = @\"YYTextShadow\";\nNSString *const YYTextInnerShadowAttributeName = @\"YYTextInnerShadow\";\nNSString *const YYTextUnderlineAttributeName = @\"YYTextUnderline\";\nNSString *const YYTextStrikethroughAttributeName = @\"YYTextStrikethrough\";\nNSString *const YYTextBorderAttributeName = @\"YYTextBorder\";\nNSString *const YYTextBackgroundBorderAttributeName = @\"YYTextBackgroundBorder\";\nNSString *const YYTextBlockBorderAttributeName = @\"YYTextBlockBorder\";\nNSString *const YYTextAttachmentAttributeName = @\"YYTextAttachment\";\nNSString *const YYTextHighlightAttributeName = @\"YYTextHighlight\";\nNSString *const YYTextGlyphTransformAttributeName = @\"YYTextGlyphTransform\";\n\nNSString *const YYTextAttachmentToken = @\"\\uFFFC\";\nNSString *const YYTextTruncationToken = @\"\\u2026\";\n\n\nYYTextAttributeType YYTextAttributeGetType(NSString *name){\n    if (name.length == 0) return YYTextAttributeTypeNone;\n    \n    static NSMutableDictionary *dic;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        dic = [NSMutableDictionary new];\n        NSNumber *All = @(YYTextAttributeTypeUIKit | YYTextAttributeTypeCoreText | YYTextAttributeTypeYYText);\n        NSNumber *CoreText_YYText = @(YYTextAttributeTypeCoreText | YYTextAttributeTypeYYText);\n        NSNumber *UIKit_YYText = @(YYTextAttributeTypeUIKit | YYTextAttributeTypeYYText);\n        NSNumber *UIKit_CoreText = @(YYTextAttributeTypeUIKit | YYTextAttributeTypeCoreText);\n        NSNumber *UIKit = @(YYTextAttributeTypeUIKit);\n        NSNumber *CoreText = @(YYTextAttributeTypeCoreText);\n        NSNumber *YYText = @(YYTextAttributeTypeYYText);\n        \n        dic[NSFontAttributeName] = All;\n        dic[NSKernAttributeName] = All;\n        dic[NSForegroundColorAttributeName] = UIKit;\n        dic[(id)kCTForegroundColorAttributeName] = CoreText;\n        dic[(id)kCTForegroundColorFromContextAttributeName] = CoreText;\n        dic[NSBackgroundColorAttributeName] = UIKit;\n        dic[NSStrokeWidthAttributeName] = All;\n        dic[NSStrokeColorAttributeName] = UIKit;\n        dic[(id)kCTStrokeColorAttributeName] = CoreText_YYText;\n        dic[NSShadowAttributeName] = UIKit_YYText;\n        dic[NSStrikethroughStyleAttributeName] = UIKit;\n        dic[NSUnderlineStyleAttributeName] = UIKit_CoreText;\n        dic[(id)kCTUnderlineColorAttributeName] = CoreText;\n        dic[NSLigatureAttributeName] = All;\n        dic[(id)kCTSuperscriptAttributeName] = UIKit; //it's a CoreText attrubite, but only supported by UIKit...\n        dic[NSVerticalGlyphFormAttributeName] = All;\n        dic[(id)kCTGlyphInfoAttributeName] = CoreText_YYText;\n        dic[(id)kCTCharacterShapeAttributeName] = CoreText_YYText;\n        dic[(id)kCTRunDelegateAttributeName] = CoreText_YYText;\n        dic[(id)kCTBaselineClassAttributeName] = CoreText_YYText;\n        dic[(id)kCTBaselineInfoAttributeName] = CoreText_YYText;\n        dic[(id)kCTBaselineReferenceInfoAttributeName] = CoreText_YYText;\n        dic[(id)kCTWritingDirectionAttributeName] = CoreText_YYText;\n        dic[NSParagraphStyleAttributeName] = All;\n        \n        if (_YYDeviceSystemVersion() >= 7) {\n            dic[NSStrikethroughColorAttributeName] = UIKit;\n            dic[NSUnderlineColorAttributeName] = UIKit;\n            dic[NSTextEffectAttributeName] = UIKit;\n            dic[NSObliquenessAttributeName] = UIKit;\n            dic[NSExpansionAttributeName] = UIKit;\n            dic[(id)kCTLanguageAttributeName] = CoreText_YYText;\n            dic[NSBaselineOffsetAttributeName] = UIKit;\n            dic[NSWritingDirectionAttributeName] = All;\n            dic[NSAttachmentAttributeName] = UIKit;\n            dic[NSLinkAttributeName] = UIKit;\n        }\n        if (_YYDeviceSystemVersion() >= 8) {\n            dic[(id)kCTRubyAnnotationAttributeName] = CoreText;\n        }\n        \n        dic[YYTextBackedStringAttributeName] = YYText;\n        dic[YYTextBindingAttributeName] = YYText;\n        dic[YYTextShadowAttributeName] = YYText;\n        dic[YYTextInnerShadowAttributeName] = YYText;\n        dic[YYTextUnderlineAttributeName] = YYText;\n        dic[YYTextStrikethroughAttributeName] = YYText;\n        dic[YYTextBorderAttributeName] = YYText;\n        dic[YYTextBackgroundBorderAttributeName] = YYText;\n        dic[YYTextBlockBorderAttributeName] = YYText;\n        dic[YYTextAttachmentAttributeName] = YYText;\n        dic[YYTextHighlightAttributeName] = YYText;\n        dic[YYTextGlyphTransformAttributeName] = YYText;\n    });\n    NSNumber *num = dic[name];\n    if (num) return num.integerValue;\n    return YYTextAttributeTypeNone;\n}\n\n\n@implementation YYTextBackedString\n\n+ (instancetype)stringWithString:(NSString *)string {\n    YYTextBackedString *one = [self new];\n    one.string = string;\n    return one;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.string forKey:@\"string\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    _string = [aDecoder decodeObjectForKey:@\"string\"];\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    one.string = self.string;\n    return one;\n}\n\n@end\n\n\n@implementation YYTextBinding\n\n+ (instancetype)bindingWithDeleteConfirm:(BOOL)deleteConfirm {\n    YYTextBinding *one = [self new];\n    one.deleteConfirm = deleteConfirm;\n    return one;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(self.deleteConfirm) forKey:@\"deleteConfirm\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    _deleteConfirm = ((NSNumber *)[aDecoder decodeObjectForKey:@\"deleteConfirm\"]).boolValue;\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    one.deleteConfirm = self.deleteConfirm;\n    return one;\n}\n\n@end\n\n\n@implementation YYTextShadow\n\n+ (instancetype)shadowWithColor:(UIColor *)color offset:(CGSize)offset radius:(CGFloat)radius {\n    YYTextShadow *one = [self new];\n    one.color = color;\n    one.offset = offset;\n    one.radius = radius;\n    return one;\n}\n\n+ (instancetype)shadowWithNSShadow:(NSShadow *)nsShadow {\n    if (!nsShadow) return nil;\n    YYTextShadow *shadow = [self new];\n    shadow.offset = nsShadow.shadowOffset;\n    shadow.radius = nsShadow.shadowBlurRadius;\n    id color = nsShadow.shadowColor;\n    if (color) {\n        if (CGColorGetTypeID() == CFGetTypeID((__bridge CFTypeRef)(color))) {\n            color = [UIColor colorWithCGColor:(__bridge CGColorRef)(color)];\n        }\n        if ([color isKindOfClass:[UIColor class]]) {\n            shadow.color = color;\n        }\n    }\n    return shadow;\n}\n\n- (NSShadow *)nsShadow {\n    NSShadow *shadow = [NSShadow new];\n    shadow.shadowOffset = self.offset;\n    shadow.shadowBlurRadius = self.radius;\n    shadow.shadowColor = self.color;\n    return shadow;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.color forKey:@\"color\"];\n    [aCoder encodeObject:@(self.radius) forKey:@\"radius\"];\n    [aCoder encodeObject:[NSValue valueWithCGSize:self.offset] forKey:@\"offset\"];\n    [aCoder encodeObject:self.subShadow forKey:@\"subShadow\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    _color = [aDecoder decodeObjectForKey:@\"color\"];\n    _radius = ((NSNumber *)[aDecoder decodeObjectForKey:@\"radius\"]).floatValue;\n    _offset = ((NSValue *)[aDecoder decodeObjectForKey:@\"offset\"]).CGSizeValue;\n    _subShadow = [aDecoder decodeObjectForKey:@\"subShadow\"];\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    one.color = self.color;\n    one.radius = self.radius;\n    one.offset = self.offset;\n    one.subShadow = self.subShadow.copy;\n    return one;\n}\n\n@end\n\n\n@implementation YYTextDecoration\n\n- (instancetype)init {\n    self = [super init];\n    _style = YYTextLineStyleSingle;\n    return self;\n}\n\n+ (instancetype)decorationWithStyle:(YYTextLineStyle)style {\n    YYTextDecoration *one = [self new];\n    one.style = style;\n    return one;\n}\n+ (instancetype)decorationWithStyle:(YYTextLineStyle)style width:(NSNumber *)width color:(UIColor *)color {\n    YYTextDecoration *one = [self new];\n    one.style = style;\n    one.width = width;\n    one.color = color;\n    return one;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(self.style) forKey:@\"style\"];\n    [aCoder encodeObject:self.width forKey:@\"width\"];\n    [aCoder encodeObject:self.color forKey:@\"color\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    self.style = ((NSNumber *)[aDecoder decodeObjectForKey:@\"style\"]).unsignedIntegerValue;\n    self.width = [aDecoder decodeObjectForKey:@\"width\"];\n    self.color = [aDecoder decodeObjectForKey:@\"color\"];\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    one.style = self.style;\n    one.width = self.width;\n    one.color = self.color;\n    return one;\n}\n\n@end\n\n\n@implementation YYTextBorder\n\n+ (instancetype)borderWithLineStyle:(YYTextLineStyle)lineStyle lineWidth:(CGFloat)width strokeColor:(UIColor *)color {\n    YYTextBorder *one = [self new];\n    one.lineStyle = lineStyle;\n    one.strokeWidth = width;\n    one.strokeColor = color;\n    return one;\n}\n\n+ (instancetype)borderWithFillColor:(UIColor *)color cornerRadius:(CGFloat)cornerRadius {\n    YYTextBorder *one = [self new];\n    one.fillColor = color;\n    one.cornerRadius = cornerRadius;\n    one.insets = UIEdgeInsetsMake(-2, 0, 0, -2);\n    return one;\n}\n\n- (instancetype)init {\n    self = [super init];\n    self.lineStyle = YYTextLineStyleSingle;\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(self.lineStyle) forKey:@\"lineStyle\"];\n    [aCoder encodeObject:@(self.strokeWidth) forKey:@\"strokeWidth\"];\n    [aCoder encodeObject:self.strokeColor forKey:@\"strokeColor\"];\n    [aCoder encodeObject:@(self.lineJoin) forKey:@\"lineJoin\"];\n    [aCoder encodeObject:[NSValue valueWithUIEdgeInsets:self.insets] forKey:@\"insets\"];\n    [aCoder encodeObject:@(self.cornerRadius) forKey:@\"cornerRadius\"];\n    [aCoder encodeObject:self.shadow forKey:@\"shadow\"];\n    [aCoder encodeObject:self.fillColor forKey:@\"fillColor\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    _lineStyle = ((NSNumber *)[aDecoder decodeObjectForKey:@\"lineStyle\"]).unsignedIntegerValue;\n    _strokeWidth = ((NSNumber *)[aDecoder decodeObjectForKey:@\"strokeWidth\"]).doubleValue;\n    _strokeColor = [aDecoder decodeObjectForKey:@\"strokeColor\"];\n    _lineJoin = (CGLineJoin)((NSNumber *)[aDecoder decodeObjectForKey:@\"join\"]).unsignedIntegerValue;\n    _insets = ((NSValue *)[aDecoder decodeObjectForKey:@\"insets\"]).UIEdgeInsetsValue;\n    _cornerRadius = ((NSNumber *)[aDecoder decodeObjectForKey:@\"cornerRadius\"]).doubleValue;\n    _shadow = [aDecoder decodeObjectForKey:@\"shadow\"];\n    _fillColor = [aDecoder decodeObjectForKey:@\"fillColor\"];\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    one.lineStyle = self.lineStyle;\n    one.strokeWidth = self.strokeWidth;\n    one.strokeColor = self.strokeColor;\n    one.lineJoin = self.lineJoin;\n    one.insets = self.insets;\n    one.cornerRadius = self.cornerRadius;\n    one.shadow = self.shadow.copy;\n    one.fillColor = self.fillColor;\n    return one;\n}\n\n@end\n\n\n@implementation YYTextAttachment\n\n+ (instancetype)attachmentWithContent:(id)content {\n    YYTextAttachment *one = [self new];\n    one.content = content;\n    return one;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:self.content forKey:@\"content\"];\n    [aCoder encodeObject:[NSValue valueWithUIEdgeInsets:self.contentInsets] forKey:@\"contentInsets\"];\n    [aCoder encodeObject:self.userInfo forKey:@\"userInfo\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    _content = [aDecoder decodeObjectForKey:@\"content\"];\n    _contentInsets = ((NSValue *)[aDecoder decodeObjectForKey:@\"contentInsets\"]).UIEdgeInsetsValue;\n    _userInfo = [aDecoder decodeObjectForKey:@\"userInfo\"];\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    if ([self.content respondsToSelector:@selector(copy)]) {\n        one.content = [self.content copy];\n    } else {\n        one.content = self.content;\n    }\n    one.contentInsets = self.contentInsets;\n    one.userInfo = self.userInfo.copy;\n    return one;\n}\n\n@end\n\n\n@implementation YYTextHighlight\n\n+ (instancetype)highlightWithAttributes:(NSDictionary *)attributes {\n    YYTextHighlight *one = [self new];\n    one.attributes = attributes;\n    return one;\n}\n\n+ (instancetype)highlightWithBackgroundColor:(UIColor *)color {\n    YYTextBorder *highlightBorder = [YYTextBorder new];\n    highlightBorder.insets = UIEdgeInsetsMake(-2, -1, -2, -1);\n    highlightBorder.cornerRadius = 3;\n    highlightBorder.fillColor = color;\n    \n    YYTextHighlight *one = [self new];\n    [one setBackgroundBorder:highlightBorder];\n    return one;\n}\n\n- (void)setAttributes:(NSDictionary *)attributes {\n    _attributes = attributes.mutableCopy;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    NSData *data = nil;\n    @try {\n        data = [YYTextArchiver archivedDataWithRootObject:self.attributes];\n    }\n    @catch (NSException *exception) {\n        NSLog(@\"%@\",exception);\n    }\n    [aCoder encodeObject:data forKey:@\"attributes\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    NSData *data = [aDecoder decodeObjectForKey:@\"attributes\"];\n    @try {\n        _attributes = [YYTextUnarchiver unarchiveObjectWithData:data];\n    }\n    @catch (NSException *exception) {\n        NSLog(@\"%@\",exception);\n    }\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    one.attributes = self.attributes.mutableCopy;\n    return one;\n}\n\n- (void)_makeMutableAttributes {\n    if (!_attributes) {\n        _attributes = [NSMutableDictionary new];\n    } else if (![_attributes isKindOfClass:[NSMutableDictionary class]]) {\n        _attributes = _attributes.mutableCopy;\n    }\n}\n\n- (void)setFont:(UIFont *)font {\n    [self _makeMutableAttributes];\n    if (font == (id)[NSNull null] || font == nil) {\n        ((NSMutableDictionary *)_attributes)[(id)kCTFontAttributeName] = [NSNull null];\n    } else {\n        CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, font.pointSize, NULL);\n        if (ctFont) {\n            ((NSMutableDictionary *)_attributes)[(id)kCTFontAttributeName] = (__bridge id)(ctFont);\n            CFRelease(ctFont);\n        }\n    }\n}\n\n- (void)setColor:(UIColor *)color {\n    [self _makeMutableAttributes];\n    if (color == (id)[NSNull null] || color == nil) {\n        ((NSMutableDictionary *)_attributes)[(id)kCTForegroundColorAttributeName] = [NSNull null];\n        ((NSMutableDictionary *)_attributes)[NSForegroundColorAttributeName] = [NSNull null];\n    } else {\n        ((NSMutableDictionary *)_attributes)[(id)kCTForegroundColorAttributeName] = (__bridge id)(color.CGColor);\n        ((NSMutableDictionary *)_attributes)[NSForegroundColorAttributeName] = color;\n    }\n}\n\n- (void)setStrokeWidth:(NSNumber *)width {\n    [self _makeMutableAttributes];\n    if (width == (id)[NSNull null] || width == nil) {\n        ((NSMutableDictionary *)_attributes)[(id)kCTStrokeWidthAttributeName] = [NSNull null];\n    } else {\n        ((NSMutableDictionary *)_attributes)[(id)kCTStrokeWidthAttributeName] = width;\n    }\n}\n\n- (void)setStrokeColor:(UIColor *)color {\n    [self _makeMutableAttributes];\n    if (color == (id)[NSNull null] || color == nil) {\n        ((NSMutableDictionary *)_attributes)[(id)kCTStrokeColorAttributeName] = [NSNull null];\n        ((NSMutableDictionary *)_attributes)[NSStrokeColorAttributeName] = [NSNull null];\n    } else {\n        ((NSMutableDictionary *)_attributes)[(id)kCTStrokeColorAttributeName] = (__bridge id)(color.CGColor);\n        ((NSMutableDictionary *)_attributes)[NSStrokeColorAttributeName] = color;\n    }\n}\n\n- (void)setTextAttribute:(NSString *)attribute value:(id)value {\n    [self _makeMutableAttributes];\n    if (value == nil) value = [NSNull null];\n    ((NSMutableDictionary *)_attributes)[attribute] = value;\n}\n\n- (void)setShadow:(YYTextShadow *)shadow {\n    [self setTextAttribute:YYTextShadowAttributeName value:shadow];\n}\n\n- (void)setInnerShadow:(YYTextShadow *)shadow {\n    [self setTextAttribute:YYTextInnerShadowAttributeName value:shadow];\n}\n\n- (void)setUnderline:(YYTextDecoration *)underline {\n    [self setTextAttribute:YYTextUnderlineAttributeName value:underline];\n}\n\n- (void)setStrikethrough:(YYTextDecoration *)strikethrough {\n    [self setTextAttribute:YYTextStrikethroughAttributeName value:strikethrough];\n}\n\n- (void)setBackgroundBorder:(YYTextBorder *)border {\n    [self setTextAttribute:YYTextBackgroundBorderAttributeName value:border];\n}\n\n- (void)setBorder:(YYTextBorder *)border {\n    [self setTextAttribute:YYTextBorderAttributeName value:border];\n}\n\n- (void)setAttachment:(YYTextAttachment *)attachment {\n    [self setTextAttribute:YYTextAttachmentAttributeName value:attachment];\n}\n\n@end\n\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextParser.h",
    "content": "//\n//  YYTextParser.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/6.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The YYTextParser protocol declares the required method for YYTextView and YYLabel\n to modify the text during editing.\n \n You can implement this protocol to add code highlighting or emoticon replacement for\n YYTextView and YYLabel. See `YYTextSimpleMarkdownParser` and `YYTextSimpleEmoticonParser` for example.\n */\n@protocol YYTextParser <NSObject>\n@required\n/**\n When text is changed in YYTextView or YYLabel, this method will be called.\n \n @param text  The original attributed string. This method may parse the text and\n change the text attributes or content.\n \n @param selectedRange  Current selected range in `text`.\n This method should correct the range if the text content is changed. If there's \n no selected range (such as YYLabel), this value is NULL.\n \n @return If the 'text' is modified in this method, returns `YES`, otherwise returns `NO`.\n */\n- (BOOL)parseText:(nullable NSMutableAttributedString *)text selectedRange:(nullable NSRangePointer)selectedRange;\n@end\n\n\n\n/**\n A simple markdown parser.\n \n It'a very simple markdown parser, you can use this parser to highlight some \n small piece of markdown text.\n \n This markdown parser use regular expression to parse text, slow and weak.\n If you want to write a better parser, try these projests:\n https://github.com/NimbusKit/markdown\n https://github.com/dreamwieber/AttributedMarkdown\n https://github.com/indragiek/CocoaMarkdown\n \n Or you can use lex/yacc to generate your custom parser.\n */\n@interface YYTextSimpleMarkdownParser : NSObject <YYTextParser>\n@property (nonatomic) CGFloat fontSize;         ///< default is 14\n@property (nonatomic) CGFloat headerFontSize;   ///< default is 20\n\n@property (nullable, nonatomic, strong) UIColor *textColor;\n@property (nullable, nonatomic, strong) UIColor *controlTextColor;\n@property (nullable, nonatomic, strong) UIColor *headerTextColor;\n@property (nullable, nonatomic, strong) UIColor *inlineTextColor;\n@property (nullable, nonatomic, strong) UIColor *codeTextColor;\n@property (nullable, nonatomic, strong) UIColor *linkTextColor;\n\n- (void)setColorWithBrightTheme; ///< reset the color properties to pre-defined value.\n- (void)setColorWithDarkTheme;   ///< reset the color properties to pre-defined value.\n@end\n\n\n\n/**\n A simple emoticon parser.\n \n Use this parser to map some specified piece of string to image emoticon.\n Example: \"Hello :smile:\"  ->  \"Hello 😀\"\n \n It can also be used to extend the \"unicode emoticon\".\n */\n@interface YYTextSimpleEmoticonParser : NSObject <YYTextParser>\n\n/**\n The custom emoticon mapper.\n The key is a specified plain string, such as @\":smile:\".\n The value is a UIImage which will replace the specified plain string in text.\n */\n@property (nullable, copy) NSDictionary<NSString *, __kindof UIImage *> *emoticonMapper;\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextParser.m",
    "content": "//\n//  YYTextParser.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/3/6.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextParser.h\"\n#import \"YYTextUtilities.h\"\n#import \"YYTextAttribute.h\"\n#import \"NSAttributedString+YYText.h\"\n#import \"NSParagraphStyle+YYText.h\"\n\n\n#pragma mark - Markdown Parser\n\n@implementation YYTextSimpleMarkdownParser {\n    UIFont *_font;\n    NSMutableArray *_headerFonts; ///< h1~h6\n    UIFont *_boldFont;\n    UIFont *_italicFont;\n    UIFont *_boldItalicFont;\n    UIFont *_monospaceFont;\n    YYTextBorder *_border;\n    \n    NSRegularExpression *_regexEscape;          ///< escape\n    NSRegularExpression *_regexHeader;          ///< #header\n    NSRegularExpression *_regexH1;              ///< header\\n====\n    NSRegularExpression *_regexH2;              ///< header\\n----\n    NSRegularExpression *_regexBreakline;       ///< ******\n    NSRegularExpression *_regexEmphasis;        ///< *text*  _text_\n    NSRegularExpression *_regexStrong;          ///< **text**\n    NSRegularExpression *_regexStrongEmphasis;  ///< ***text*** ___text___\n    NSRegularExpression *_regexUnderline;       ///< __text__\n    NSRegularExpression *_regexStrikethrough;   ///< ~~text~~\n    NSRegularExpression *_regexInlineCode;      ///< `text`\n    NSRegularExpression *_regexLink;            ///< [name](link)\n    NSRegularExpression *_regexLinkRefer;       ///< [ref]:\n    NSRegularExpression *_regexList;            ///< 1.text 2.text 3.text\n    NSRegularExpression *_regexBlockQuote;      ///< > quote\n    NSRegularExpression *_regexCodeBlock;       ///< \\tcode \\tcode\n    NSRegularExpression *_regexNotEmptyLine;\n}\n\n- (void)initRegex {\n#define regexp(reg, option) [NSRegularExpression regularExpressionWithPattern : @reg options : option error : NULL]\n    _regexEscape = regexp(\"(\\\\\\\\\\\\\\\\|\\\\\\\\\\\\`|\\\\\\\\\\\\*|\\\\\\\\\\\\_|\\\\\\\\\\\\(|\\\\\\\\\\\\)|\\\\\\\\\\\\[|\\\\\\\\\\\\]|\\\\\\\\#|\\\\\\\\\\\\+|\\\\\\\\\\\\-|\\\\\\\\\\\\!)\", 0);\n    _regexHeader = regexp(\"^((\\\\#{1,6}[^#].*)|(\\\\#{6}.+))$\", NSRegularExpressionAnchorsMatchLines);\n    _regexH1 = regexp(\"^[^=\\\\n][^\\\\n]*\\\\n=+$\", NSRegularExpressionAnchorsMatchLines);\n    _regexH2 = regexp(\"^[^-\\\\n][^\\\\n]*\\\\n-+$\", NSRegularExpressionAnchorsMatchLines);\n    _regexBreakline = regexp(\"^[ \\\\t]*([*-])[ \\\\t]*((\\\\1)[ \\\\t]*){2,}[ \\\\t]*$\", NSRegularExpressionAnchorsMatchLines);\n    _regexEmphasis = regexp(\"((?<!\\\\*)\\\\*(?=[^ \\\\t*])(.+?)(?<=[^ \\\\t*])\\\\*(?!\\\\*)|(?<!_)_(?=[^ \\\\t_])(.+?)(?<=[^ \\\\t_])_(?!_))\", 0);\n    _regexStrong = regexp(\"(?<!\\\\*)\\\\*{2}(?=[^ \\\\t*])(.+?)(?<=[^ \\\\t*])\\\\*{2}(?!\\\\*)\", 0);\n    _regexStrongEmphasis =  regexp(\"((?<!\\\\*)\\\\*{3}(?=[^ \\\\t*])(.+?)(?<=[^ \\\\t*])\\\\*{3}(?!\\\\*)|(?<!_)_{3}(?=[^ \\\\t_])(.+?)(?<=[^ \\\\t_])_{3}(?!_))\", 0);\n    _regexUnderline = regexp(\"(?<!_)__(?=[^ \\\\t_])(.+?)(?<=[^ \\\\t_])\\\\__(?!_)\", 0);\n    _regexStrikethrough = regexp(\"(?<!~)~~(?=[^ \\\\t~])(.+?)(?<=[^ \\\\t~])\\\\~~(?!~)\", 0);\n    _regexInlineCode = regexp(\"(?<!`)(`{1,3})([^`\\n]+?)\\\\1(?!`)\", 0);\n    _regexLink = regexp(\"!?\\\\[([^\\\\[\\\\]]+)\\\\](\\\\(([^\\\\(\\\\)]+)\\\\)|\\\\[([^\\\\[\\\\]]+)\\\\])\", 0);\n    _regexLinkRefer = regexp(\"^[ \\\\t]*\\\\[[^\\\\[\\\\]]\\\\]:\", NSRegularExpressionAnchorsMatchLines);\n    _regexList = regexp(\"^[ \\\\t]*([*+-]|\\\\d+[.])[ \\\\t]+\", NSRegularExpressionAnchorsMatchLines);\n    _regexBlockQuote = regexp(\"^[ \\\\t]*>[ \\\\t>]*\", NSRegularExpressionAnchorsMatchLines);\n    _regexCodeBlock = regexp(\"(^\\\\s*$\\\\n)((( {4}|\\\\t).*(\\\\n|\\\\z))|(^\\\\s*$\\\\n))+\", NSRegularExpressionAnchorsMatchLines);\n    _regexNotEmptyLine = regexp(\"^[ \\\\t]*[^ \\\\t]+[ \\\\t]*$\", NSRegularExpressionAnchorsMatchLines);\n#undef regexp\n}\n\n- (instancetype)init {\n    self = [super init];\n    _fontSize = 14;\n    _headerFontSize = 20;\n    [self _updateFonts];\n    [self setColorWithBrightTheme];\n    [self initRegex];\n    return self;\n}\n\n- (void)setFontSize:(CGFloat)fontSize {\n    if (fontSize < 1) fontSize = 12;\n    _fontSize = fontSize;\n    [self _updateFonts];\n}\n\n- (void)setHeaderFontSize:(CGFloat)headerFontSize {\n    if (headerFontSize < 1) headerFontSize = 20;\n    _headerFontSize = headerFontSize;\n    [self _updateFonts];\n}\n\n- (void)_updateFonts {\n    _font = [UIFont systemFontOfSize:_fontSize];\n    _headerFonts = [NSMutableArray new];\n    for (int i = 0; i < 6; i++) {\n        CGFloat size = _headerFontSize - (_headerFontSize - _fontSize) / 5.0 * i;\n        [_headerFonts addObject:[UIFont systemFontOfSize:size]];\n    }\n    _boldFont = YYTextFontWithBold(_font);\n    _italicFont = YYTextFontWithItalic(_font);\n    _boldItalicFont = YYTextFontWithBoldItalic(_font);\n    _monospaceFont = [UIFont fontWithName:@\"Menlo\" size:_fontSize]; // Since iOS 7\n    if (!_monospaceFont) _monospaceFont = [UIFont fontWithName:@\"Courier\" size:_fontSize]; // Since iOS 3\n}\n\n- (void)setColorWithBrightTheme {\n    _textColor = [UIColor blackColor];\n    _controlTextColor = [UIColor colorWithWhite:0.749 alpha:1.000];\n    _headerTextColor = [UIColor colorWithRed:1.000 green:0.502 blue:0.000 alpha:1.000];\n    _inlineTextColor = [UIColor colorWithWhite:0.150 alpha:1.000];\n    _codeTextColor = [UIColor colorWithWhite:0.150 alpha:1.000];\n    _linkTextColor = [UIColor colorWithRed:0.000 green:0.478 blue:0.962 alpha:1.000];\n    \n    _border = [YYTextBorder new];\n    _border.lineStyle = YYTextLineStyleSingle;\n    _border.fillColor = [UIColor colorWithWhite:0.184 alpha:0.090];\n    _border.strokeColor = [UIColor colorWithWhite:0.546 alpha:0.650];\n    _border.insets = UIEdgeInsetsMake(-1, 0, -1, 0);\n    _border.cornerRadius = 2;\n    _border.strokeWidth = YYTextCGFloatFromPixel(1);\n}\n\n- (void)setColorWithDarkTheme {\n    _textColor = [UIColor whiteColor];\n    _controlTextColor = [UIColor colorWithWhite:0.604 alpha:1.000];\n    _headerTextColor = [UIColor colorWithRed:0.558 green:1.000 blue:0.502 alpha:1.000];\n    _inlineTextColor = [UIColor colorWithRed:1.000 green:0.862 blue:0.387 alpha:1.000];\n    _codeTextColor = [UIColor colorWithWhite:0.906 alpha:1.000];\n    _linkTextColor = [UIColor colorWithRed:0.000 green:0.646 blue:1.000 alpha:1.000];\n    \n    _border = [YYTextBorder new];\n    _border.lineStyle = YYTextLineStyleSingle;\n    _border.fillColor = [UIColor colorWithWhite:0.820 alpha:0.130];\n    _border.strokeColor = [UIColor colorWithWhite:1.000 alpha:0.280];\n    _border.insets = UIEdgeInsetsMake(-1, 0, -1, 0);\n    _border.cornerRadius = 2;\n    _border.strokeWidth = YYTextCGFloatFromPixel(1);\n}\n\n- (NSUInteger)lenghOfBeginWhiteInString:(NSString *)str withRange:(NSRange)range{\n    for (NSUInteger i = 0; i < range.length; i++) {\n        unichar c = [str characterAtIndex:i + range.location];\n        if (c != ' ' && c != '\\t' && c != '\\n') return i;\n    }\n    return str.length;\n}\n\n- (NSUInteger)lenghOfEndWhiteInString:(NSString *)str withRange:(NSRange)range{\n    for (NSInteger i = range.length - 1; i >= 0; i--) {\n        unichar c = [str characterAtIndex:i + range.location];\n        if (c != ' ' && c != '\\t' && c != '\\n') return range.length - i;\n    }\n    return str.length;\n}\n\n- (NSUInteger)lenghOfBeginChar:(unichar)c inString:(NSString *)str withRange:(NSRange)range{\n    for (NSUInteger i = 0; i < range.length; i++) {\n        if ([str characterAtIndex:i + range.location] != c) return i;\n    }\n    return str.length;\n}\n\n- (BOOL)parseText:(NSMutableAttributedString *)text selectedRange:(NSRangePointer)range {\n    if (text.length == 0) return NO;\n    [text yy_removeAttributesInRange:NSMakeRange(0, text.length)];\n    text.yy_font = _font;\n    text.yy_color = _textColor;\n    \n    NSMutableString *str = text.string.mutableCopy;\n    [_regexEscape replaceMatchesInString:str options:kNilOptions range:NSMakeRange(0, str.length) withTemplate:@\"@@\"];\n    \n    [_regexHeader enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        NSUInteger whiteLen = [self lenghOfBeginWhiteInString:str withRange:r];\n        NSUInteger sharpLen = [self lenghOfBeginChar:'#' inString:str withRange:NSMakeRange(r.location + whiteLen, r.length - whiteLen)];\n        if (sharpLen > 6) sharpLen = 6;\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location, whiteLen + sharpLen)];\n        [text yy_setColor:_headerTextColor range:NSMakeRange(r.location + whiteLen + sharpLen, r.length - whiteLen - sharpLen)];\n        [text yy_setFont:_headerFonts[sharpLen - 1] range:result.range];\n    }];\n    \n    [_regexH1 enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        NSRange linebreak = [str rangeOfString:@\"\\n\" options:0 range:result.range locale:nil];\n        if (linebreak.location != NSNotFound) {\n            [text yy_setColor:_headerTextColor range:NSMakeRange(r.location, linebreak.location - r.location)];\n            [text yy_setFont:_headerFonts[0] range:NSMakeRange(r.location, linebreak.location - r.location + 1)];\n            [text yy_setColor:_controlTextColor range:NSMakeRange(linebreak.location + linebreak.length, r.location + r.length - linebreak.location - linebreak.length)];\n        }\n    }];\n    \n    [_regexH2 enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        NSRange linebreak = [str rangeOfString:@\"\\n\" options:0 range:result.range locale:nil];\n        if (linebreak.location != NSNotFound) {\n            [text yy_setColor:_headerTextColor range:NSMakeRange(r.location, linebreak.location - r.location)];\n            [text yy_setFont:_headerFonts[1] range:NSMakeRange(r.location, linebreak.location - r.location + 1)];\n            [text yy_setColor:_controlTextColor range:NSMakeRange(linebreak.location + linebreak.length, r.location + r.length - linebreak.location - linebreak.length)];\n        }\n    }];\n    \n    [_regexBreakline enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        [text yy_setColor:_controlTextColor range:result.range];\n    }];\n    \n    [_regexEmphasis enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location, 1)];\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location + r.length - 1, 1)];\n        [text yy_setFont:_italicFont range:NSMakeRange(r.location + 1, r.length - 2)];\n    }];\n    \n    [_regexStrong enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location, 2)];\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location + r.length - 2, 2)];\n        [text yy_setFont:_boldFont range:NSMakeRange(r.location + 2, r.length - 4)];\n    }];\n    \n    [_regexStrongEmphasis enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location, 3)];\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location + r.length - 3, 3)];\n        [text yy_setFont:_boldItalicFont range:NSMakeRange(r.location + 3, r.length - 6)];\n    }];\n    \n    [_regexUnderline enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location, 2)];\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location + r.length - 2, 2)];\n        [text yy_setTextUnderline:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle width:@1 color:nil] range:NSMakeRange(r.location + 2, r.length - 4)];\n    }];\n    \n    [_regexStrikethrough enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location, 2)];\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location + r.length - 2, 2)];\n        [text yy_setTextStrikethrough:[YYTextDecoration decorationWithStyle:YYTextLineStyleSingle width:@1 color:nil] range:NSMakeRange(r.location + 2, r.length - 4)];\n    }];\n    \n    [_regexInlineCode enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        NSUInteger len = [self lenghOfBeginChar:'`' inString:str withRange:r];\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location, len)];\n        [text yy_setColor:_controlTextColor range:NSMakeRange(r.location + r.length - len, len)];\n        [text yy_setColor:_inlineTextColor range:NSMakeRange(r.location + len, r.length - 2 * len)];\n        [text yy_setFont:_monospaceFont range:r];\n        [text yy_setTextBorder:_border.copy range:r];\n    }];\n    \n    [_regexLink enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_linkTextColor range:r];\n    }];\n    \n    [_regexLinkRefer enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:r];\n    }];\n    \n    [_regexList enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:r];\n    }];\n    \n    [_regexBlockQuote enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        [text yy_setColor:_controlTextColor range:r];\n    }];\n    \n    [_regexCodeBlock enumerateMatchesInString:str options:0 range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        NSRange r = result.range;\n        NSRange firstLineRange = [_regexNotEmptyLine rangeOfFirstMatchInString:str options:kNilOptions range:r];\n        NSUInteger lenStart = (firstLineRange.location != NSNotFound) ? firstLineRange.location - r.location : 0;\n        NSUInteger lenEnd = [self lenghOfEndWhiteInString:str withRange:r];\n        if (lenStart + lenEnd < r.length) {\n            NSRange codeR = NSMakeRange(r.location + lenStart, r.length - lenStart - lenEnd);\n            [text yy_setColor:_codeTextColor range:codeR];\n            [text yy_setFont:_monospaceFont range:codeR];\n            YYTextBorder *border = [YYTextBorder new];\n            border.lineStyle = YYTextLineStyleSingle;\n            border.fillColor = [UIColor colorWithWhite:0.184 alpha:0.090];\n            border.strokeColor = [UIColor colorWithWhite:0.200 alpha:0.300];\n            border.insets = UIEdgeInsetsMake(-1, 0, -1, 0);\n            border.cornerRadius = 3;\n            border.strokeWidth = YYTextCGFloatFromPixel(2);\n            [text yy_setTextBlockBorder:_border.copy range:codeR];\n        }\n    }];\n    \n    return YES;\n}\n\n\n@end\n\n\n\n#pragma mark - Emoticon Parser\n\n#define LOCK(...) dispatch_semaphore_wait(_lock, DISPATCH_TIME_FOREVER); \\\n__VA_ARGS__; \\\ndispatch_semaphore_signal(_lock);\n\n@implementation YYTextSimpleEmoticonParser {\n    NSRegularExpression *_regex;\n    NSDictionary *_mapper;\n    dispatch_semaphore_t _lock;\n}\n\n- (instancetype)init {\n    self = [super init];\n    _lock = dispatch_semaphore_create(1);\n    return self;\n}\n\n- (NSDictionary *)emoticonMapper {\n    LOCK(NSDictionary *mapper = _mapper); return mapper;\n}\n\n- (void)setEmoticonMapper:(NSDictionary *)emoticonMapper {\n    LOCK(\n         _mapper = emoticonMapper.copy;\n         if (_mapper.count == 0) {\n             _regex = nil;\n         } else {\n             NSMutableString *pattern = @\"(\".mutableCopy;\n             NSArray *allKeys = _mapper.allKeys;\n             NSCharacterSet *charset = [NSCharacterSet characterSetWithCharactersInString:@\"$^?+*.,#|{}[]()\\\\\"];\n             for (NSUInteger i = 0, max = allKeys.count; i < max; i++) {\n                 NSMutableString *one = [allKeys[i] mutableCopy];\n                 \n                 // escape regex characters\n                 for (NSUInteger ci = 0, cmax = one.length; ci < cmax; ci++) {\n                     unichar c = [one characterAtIndex:ci];\n                     if ([charset characterIsMember:c]) {\n                         [one insertString:@\"\\\\\" atIndex:ci];\n                         ci++;\n                         cmax++;\n                     }\n                 }\n                 \n                 [pattern appendString:one];\n                 if (i != max - 1) [pattern appendString:@\"|\"];\n             }\n             [pattern appendString:@\")\"];\n             _regex = [[NSRegularExpression alloc] initWithPattern:pattern options:kNilOptions error:nil];\n         }\n    );\n}\n\n// correct the selected range during text replacement\n- (NSRange)_replaceTextInRange:(NSRange)range withLength:(NSUInteger)length selectedRange:(NSRange)selectedRange {\n    // no change\n    if (range.length == length) return selectedRange;\n    // right\n    if (range.location >= selectedRange.location + selectedRange.length) return selectedRange;\n    // left\n    if (selectedRange.location >= range.location + range.length) {\n        selectedRange.location = selectedRange.location + length - range.length;\n        return selectedRange;\n    }\n    // same\n    if (NSEqualRanges(range, selectedRange)) {\n        selectedRange.length = length;\n        return selectedRange;\n    }\n    // one edge same\n    if ((range.location == selectedRange.location && range.length < selectedRange.length) ||\n        (range.location + range.length == selectedRange.location + selectedRange.length && range.length < selectedRange.length)) {\n        selectedRange.length = selectedRange.length + length - range.length;\n        return selectedRange;\n    }\n    selectedRange.location = range.location + length;\n    selectedRange.length = 0;\n    return selectedRange;\n}\n\n- (BOOL)parseText:(NSMutableAttributedString *)text selectedRange:(NSRangePointer)range {\n    if (text.length == 0) return NO;\n    \n    NSDictionary *mapper;\n    NSRegularExpression *regex;\n    LOCK(mapper = _mapper; regex = _regex;);\n    if (mapper.count == 0 || regex == nil) return NO;\n    \n    NSArray *matches = [regex matchesInString:text.string options:kNilOptions range:NSMakeRange(0, text.length)];\n    if (matches.count == 0) return NO;\n    \n    NSRange selectedRange = range ? *range : NSMakeRange(0, 0);\n    NSUInteger cutLength = 0;\n    for (NSUInteger i = 0, max = matches.count; i < max; i++) {\n        NSTextCheckingResult *one = matches[i];\n        NSRange oneRange = one.range;\n        if (oneRange.length == 0) continue;\n        oneRange.location -= cutLength;\n        NSString *subStr = [text.string substringWithRange:oneRange];\n        UIImage *emoticon = mapper[subStr];\n        if (!emoticon) continue;\n        \n        CGFloat fontSize = 12; // CoreText default value\n        CTFontRef font = (__bridge CTFontRef)([text yy_attribute:NSFontAttributeName atIndex:oneRange.location]);\n        if (font) fontSize = CTFontGetSize(font);\n        NSMutableAttributedString *atr = [NSAttributedString yy_attachmentStringWithEmojiImage:emoticon fontSize:fontSize];\n        [atr yy_setTextBackedString:[YYTextBackedString stringWithString:subStr] range:NSMakeRange(0, atr.length)];\n        [text replaceCharactersInRange:oneRange withString:atr.string];\n        [text yy_removeDiscontinuousAttributesInRange:NSMakeRange(oneRange.location, atr.length)];\n        [text addAttributes:atr.yy_attributes range:NSMakeRange(oneRange.location, atr.length)];\n        selectedRange = [self _replaceTextInRange:oneRange withLength:atr.length selectedRange:selectedRange];\n        cutLength += oneRange.length - 1;\n    }\n    if (range) *range = selectedRange;\n    \n    return YES;\n}\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextRubyAnnotation.h",
    "content": "//\n//  YYTextRubyAnnotation.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/24.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n#import <CoreText/CoreText.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Wrapper for CTRubyAnnotationRef.\n \n Example:\n \n     YYTextRubyAnnotation *ruby = [YYTextRubyAnnotation new];\n     ruby.textBefore = @\"zhù yīn\";\n     CTRubyAnnotationRef ctRuby = ruby.CTRubyAnnotation;\n     if (ctRuby) {\n        /// add to attributed string\n        CFRelease(ctRuby);\n     }\n \n */\n@interface YYTextRubyAnnotation : NSObject <NSCopying, NSCoding>\n\n/// Specifies how the ruby text and the base text should be aligned relative to each other.\n@property (nonatomic) CTRubyAlignment alignment;\n\n/// Specifies how the ruby text can overhang adjacent characters.\n@property (nonatomic) CTRubyOverhang overhang;\n\n/// Specifies the size of the annotation text as a percent of the size of the base text.\n@property (nonatomic) CGFloat sizeFactor;\n\n\n/// The ruby text is positioned before the base text;\n/// i.e. above horizontal text and to the right of vertical text.\n@property (nullable, nonatomic, copy) NSString *textBefore;\n\n/// The ruby text is positioned after the base text;\n/// i.e. below horizontal text and to the left of vertical text.\n@property (nullable, nonatomic, copy) NSString *textAfter;\n\n/// The ruby text is positioned to the right of the base text whether it is horizontal or vertical.\n/// This is the way that Bopomofo annotations are attached to Chinese text in Taiwan.\n@property (nullable, nonatomic, copy) NSString *textInterCharacter;\n\n/// The ruby text follows the base text with no special styling.\n@property (nullable, nonatomic, copy) NSString *textInline;\n\n\n/**\n Create a ruby object from CTRuby object.\n \n @param ctRuby  A CTRuby object.\n \n @return A ruby object, or nil when an error occurs.\n */\n+ (instancetype)rubyWithCTRubyRef:(CTRubyAnnotationRef)ctRuby NS_AVAILABLE_IOS(8_0);\n\n/**\n Create a CTRuby object from the instance.\n \n @return A new CTRuby object, or NULL when an error occurs.\n The returned value should be release after used.\n */\n- (nullable CTRubyAnnotationRef)CTRubyAnnotation CF_RETURNS_RETAINED NS_AVAILABLE_IOS(8_0);\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextRubyAnnotation.m",
    "content": "//\n//  YYTextRubyAnnotation.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/24.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextRubyAnnotation.h\"\n\n@implementation YYTextRubyAnnotation\n\n- (instancetype)init {\n    self = super.init;\n    self.alignment = kCTRubyAlignmentAuto;\n    self.overhang = kCTRubyOverhangAuto;\n    self.sizeFactor = 0.5;\n    return self;\n}\n\n+ (instancetype)rubyWithCTRubyRef:(CTRubyAnnotationRef)ctRuby {\n    if (!ctRuby) return nil;\n    YYTextRubyAnnotation *one = [self new];\n    one.alignment = CTRubyAnnotationGetAlignment(ctRuby);\n    one.overhang = CTRubyAnnotationGetOverhang(ctRuby);\n    one.sizeFactor = CTRubyAnnotationGetSizeFactor(ctRuby);\n    one.textBefore = (__bridge NSString *)(CTRubyAnnotationGetTextForPosition(ctRuby, kCTRubyPositionBefore));\n    one.textAfter = (__bridge NSString *)(CTRubyAnnotationGetTextForPosition(ctRuby, kCTRubyPositionAfter));\n    one.textInterCharacter = (__bridge NSString *)(CTRubyAnnotationGetTextForPosition(ctRuby, kCTRubyPositionInterCharacter));\n    one.textInline = (__bridge NSString *)(CTRubyAnnotationGetTextForPosition(ctRuby, kCTRubyPositionInline));\n    return one;\n}\n\n- (CTRubyAnnotationRef)CTRubyAnnotation CF_RETURNS_RETAINED {\n    if (((long)CTRubyAnnotationCreate + 1) == 1) return NULL; // system not support\n    \n    CFStringRef text[kCTRubyPositionCount];\n    text[kCTRubyPositionBefore] = (__bridge CFStringRef)(_textBefore);\n    text[kCTRubyPositionAfter] = (__bridge CFStringRef)(_textAfter);\n    text[kCTRubyPositionInterCharacter] = (__bridge CFStringRef)(_textInterCharacter);\n    text[kCTRubyPositionInline] = (__bridge CFStringRef)(_textInline);\n    CTRubyAnnotationRef ruby = CTRubyAnnotationCreate(_alignment, _overhang, _sizeFactor, text);\n    return ruby;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    YYTextRubyAnnotation *one = [self.class new];\n    one.alignment = _alignment;\n    one.overhang = _overhang;\n    one.sizeFactor = _sizeFactor;\n    one.textBefore = _textBefore;\n    one.textAfter = _textAfter;\n    one.textInterCharacter = _textInterCharacter;\n    one.textInline = _textInline;\n    return one;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(_alignment) forKey:@\"alignment\"];\n    [aCoder encodeObject:@(_overhang) forKey:@\"overhang\"];\n    [aCoder encodeObject:@(_sizeFactor) forKey:@\"sizeFactor\"];\n    [aCoder encodeObject:_textBefore forKey:@\"textBefore\"];\n    [aCoder encodeObject:_textAfter forKey:@\"textAfter\"];\n    [aCoder encodeObject:_textInterCharacter forKey:@\"textInterCharacter\"];\n    [aCoder encodeObject:_textInline forKey:@\"textInline\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [self init];\n    _alignment = ((NSNumber *)[aDecoder decodeObjectForKey:@\"alignment\"]).intValue;\n    _overhang = ((NSNumber *)[aDecoder decodeObjectForKey:@\"overhang\"]).intValue;\n    _sizeFactor = ((NSNumber *)[aDecoder decodeObjectForKey:@\"sizeFactor\"]).intValue;\n    _textBefore = [aDecoder decodeObjectForKey:@\"textBefore\"];\n    _textAfter = [aDecoder decodeObjectForKey:@\"textAfter\"];\n    _textInterCharacter = [aDecoder decodeObjectForKey:@\"textInterCharacter\"];\n    _textInline = [aDecoder decodeObjectForKey:@\"textInline\"];\n    return self;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextRunDelegate.h",
    "content": "//\n//  YYTextRunDelegate.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/14.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n#import <CoreText/CoreText.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Wrapper for CTRunDelegateRef.\n \n Example:\n \n     YYTextRunDelegate *delegate = [YYTextRunDelegate new];\n     delegate.ascent = 20;\n     delegate.descent = 4;\n     delegate.width = 20;\n     CTRunDelegateRef ctRunDelegate = delegate.CTRunDelegate;\n     if (ctRunDelegate) {\n         /// add to attributed string\n         CFRelease(ctRunDelegate);\n     }\n \n */\n@interface YYTextRunDelegate : NSObject <NSCopying, NSCoding>\n\n/**\n Creates and returns the CTRunDelegate.\n \n @discussion You need call CFRelease() after used.\n The CTRunDelegateRef has a strong reference to this YYTextRunDelegate object.\n In CoreText, use CTRunDelegateGetRefCon() to get this YYTextRunDelegate object.\n \n @return The CTRunDelegate object.\n */\n- (nullable CTRunDelegateRef)CTRunDelegate CF_RETURNS_RETAINED;\n\n/**\n Additional information about the the run delegate.\n */\n@property (nullable, nonatomic, strong) NSDictionary *userInfo;\n\n/**\n The typographic ascent of glyphs in the run.\n */\n@property (nonatomic) CGFloat ascent;\n\n/**\n The typographic descent of glyphs in the run.\n */\n@property (nonatomic) CGFloat descent;\n\n/**\n The typographic width of glyphs in the run.\n */\n@property (nonatomic) CGFloat width;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/String/YYTextRunDelegate.m",
    "content": "//\n//  YYTextRunDelegate.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/14.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextRunDelegate.h\"\n\nstatic void DeallocCallback(void *ref) {\n    YYTextRunDelegate *self = (__bridge_transfer YYTextRunDelegate *)(ref);\n    self = nil; // release\n}\n\nstatic CGFloat GetAscentCallback(void *ref) {\n    YYTextRunDelegate *self = (__bridge YYTextRunDelegate *)(ref);\n    return self.ascent;\n}\n\nstatic CGFloat GetDecentCallback(void *ref) {\n    YYTextRunDelegate *self = (__bridge YYTextRunDelegate *)(ref);\n    return self.descent;\n}\n\nstatic CGFloat GetWidthCallback(void *ref) {\n    YYTextRunDelegate *self = (__bridge YYTextRunDelegate *)(ref);\n    return self.width;\n}\n\n@implementation YYTextRunDelegate\n\n- (CTRunDelegateRef)CTRunDelegate CF_RETURNS_RETAINED {\n    CTRunDelegateCallbacks callbacks;\n    callbacks.version = kCTRunDelegateCurrentVersion;\n    callbacks.dealloc = DeallocCallback;\n    callbacks.getAscent = GetAscentCallback;\n    callbacks.getDescent = GetDecentCallback;\n    callbacks.getWidth = GetWidthCallback;\n    return CTRunDelegateCreate(&callbacks, (__bridge_retained void *)(self.copy));\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [aCoder encodeObject:@(_ascent) forKey:@\"ascent\"];\n    [aCoder encodeObject:@(_descent) forKey:@\"descent\"];\n    [aCoder encodeObject:@(_width) forKey:@\"width\"];\n    [aCoder encodeObject:_userInfo forKey:@\"userInfo\"];\n}\n\n- (id)initWithCoder:(NSCoder *)aDecoder {\n    self = [super init];\n    _ascent = ((NSNumber *)[aDecoder decodeObjectForKey:@\"ascent\"]).floatValue;\n    _descent = ((NSNumber *)[aDecoder decodeObjectForKey:@\"descent\"]).floatValue;\n    _width = ((NSNumber *)[aDecoder decodeObjectForKey:@\"width\"]).floatValue;\n    _userInfo = [aDecoder decodeObjectForKey:@\"userInfo\"];\n    return self;\n}\n\n- (id)copyWithZone:(NSZone *)zone {\n    typeof(self) one = [self.class new];\n    one.ascent = self.ascent;\n    one.descent = self.descent;\n    one.width = self.width;\n    one.userInfo = self.userInfo;\n    return one;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/NSAttributedString+YYText.h",
    "content": "//\n//  NSAttributedString+YYText.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/7.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n#import <CoreText/CoreText.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextAttribute.h>\n#import <YYText/YYTextRubyAnnotation.h>\n#else\n#import \"YYTextAttribute.h\"\n#import \"YYTextRubyAnnotation.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Get pre-defined attributes from attributed string.\n All properties defined in UIKit, CoreText and YYText are included.\n */\n@interface NSAttributedString (YYText)\n\n/**\n Archive the string to data.\n @return Returns nil if an error occurs.\n */\n- (nullable NSData *)yy_archiveToData;\n\n/**\n Unarchive string from data.\n @param data  The archived attributed string data.\n @return Returns nil if an error occurs.\n */\n+ (nullable instancetype)yy_unarchiveFromData:(NSData *)data;\n\n\n\n#pragma mark - Retrieving character attribute information\n///=============================================================================\n/// @name Retrieving character attribute information\n///=============================================================================\n\n/**\n Returns the attributes at first charactor.\n */\n@property (nullable, nonatomic, copy, readonly) NSDictionary<NSString *, id> *yy_attributes;\n\n/**\n Returns the attributes for the character at a given index.\n \n @discussion Raises an `NSRangeException` if index lies beyond the end of the \n receiver's characters.\n \n @param index  The index for which to return attributes. \n This value must lie within the bounds of the receiver.\n \n @return The attributes for the character at index.\n */\n- (nullable NSDictionary<NSString *, id> *)yy_attributesAtIndex:(NSUInteger)index;\n\n/**\n Returns the value for an attribute with a given name of the character at a given index.\n \n @discussion Raises an `NSRangeException` if index lies beyond the end of the\n receiver's characters.\n \n @param attributeName  The name of an attribute.\n @param index          The index for which to return attributes. \n This value must not exceed the bounds of the receiver.\n \n @return The value for the attribute named `attributeName` of the character at \n index `index`, or nil if there is no such attribute.\n */\n- (nullable id)yy_attribute:(NSString *)attributeName atIndex:(NSUInteger)index;\n\n\n#pragma mark - Get character attribute as property\n///=============================================================================\n/// @name Get character attribute as property\n///=============================================================================\n\n/**\n The font of the text. (read-only)\n \n @discussion Default is Helvetica (Neue) 12.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) UIFont *yy_font;\n- (nullable UIFont *)yy_fontAtIndex:(NSUInteger)index;\n\n/**\n A kerning adjustment. (read-only)\n \n @discussion Default is standard kerning. The kerning attribute indicate how many \n points the following character should be shifted from its default offset as \n defined by the current character's font in points; a positive kern indicates a \n shift farther along and a negative kern indicates a shift closer to the current \n character. If this attribute is not present, standard kerning will be used. \n If this attribute is set to 0.0, no kerning will be done at all.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) NSNumber *yy_kern;\n- (nullable NSNumber *)yy_kernAtIndex:(NSUInteger)index;\n\n/**\n The foreground color. (read-only)\n \n @discussion Default is Black.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) UIColor *yy_color;\n- (nullable UIColor *)yy_colorAtIndex:(NSUInteger)index;\n\n/**\n The background color. (read-only)\n \n @discussion Default is nil (or no background).\n @discussion Get this property returns the first character's attribute.\n @since UIKit:6.0\n */\n@property (nullable, nonatomic, strong, readonly) UIColor *yy_backgroundColor;\n- (nullable UIColor *)yy_backgroundColorAtIndex:(NSUInteger)index;\n\n/**\n The stroke width. (read-only)\n \n @discussion Default value is 0.0 (no stroke). This attribute, interpreted as\n a percentage of font point size, controls the text drawing mode: positive \n values effect drawing with stroke only; negative values are for stroke and fill.\n A typical value for outlined text is 3.0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0\n */\n@property (nullable, nonatomic, strong, readonly) NSNumber *yy_strokeWidth;\n- (nullable NSNumber *)yy_strokeWidthAtIndex:(NSUInteger)index;\n\n/**\n The stroke color. (read-only)\n \n @discussion Default value is nil (same as foreground color).\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0\n */\n@property (nullable, nonatomic, strong, readonly) UIColor *yy_strokeColor;\n- (nullable UIColor *)yy_strokeColorAtIndex:(NSUInteger)index;\n\n/**\n The text shadow. (read-only)\n \n @discussion Default value is nil (no shadow).\n @discussion Get this property returns the first character's attribute.\n @since UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) NSShadow *yy_shadow;\n- (nullable NSShadow *)yy_shadowAtIndex:(NSUInteger)index;\n\n/**\n The strikethrough style. (read-only)\n \n @discussion Default value is NSUnderlineStyleNone (no strikethrough).\n @discussion Get this property returns the first character's attribute.\n @since UIKit:6.0\n */\n@property (nonatomic, readonly) NSUnderlineStyle yy_strikethroughStyle;\n- (NSUnderlineStyle)yy_strikethroughStyleAtIndex:(NSUInteger)index;\n\n/**\n The strikethrough color. (read-only)\n \n @discussion Default value is nil (same as foreground color).\n @discussion Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readonly) UIColor *yy_strikethroughColor;\n- (nullable UIColor *)yy_strikethroughColorAtIndex:(NSUInteger)index;\n\n/**\n The underline style. (read-only)\n \n @discussion Default value is NSUnderlineStyleNone (no underline).\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0\n */\n@property (nonatomic, readonly) NSUnderlineStyle yy_underlineStyle;\n- (NSUnderlineStyle)yy_underlineStyleAtIndex:(NSUInteger)index;\n\n/**\n The underline color. (read-only)\n \n @discussion Default value is nil (same as foreground color).\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readonly) UIColor *yy_underlineColor;\n- (nullable UIColor *)yy_underlineColorAtIndex:(NSUInteger)index;\n\n/**\n Ligature formation control. (read-only)\n \n @discussion Default is int value 1. The ligature attribute determines what kinds \n of ligatures should be used when displaying the string. A value of 0 indicates \n that only ligatures essential for proper rendering of text should be used, \n 1 indicates that standard ligatures should be used, and 2 indicates that all \n available ligatures should be used. Which ligatures are standard depends on the \n script and possibly the font.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) NSNumber *yy_ligature;\n- (nullable NSNumber *)yy_ligatureAtIndex:(NSUInteger)index;\n\n/**\n The text effect. (read-only)\n \n @discussion Default is nil (no effect). The only currently supported value\n is NSTextEffectLetterpressStyle.\n @discussion Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readonly) NSString *yy_textEffect;\n- (nullable NSString *)yy_textEffectAtIndex:(NSUInteger)index;\n\n/**\n The skew to be applied to glyphs. (read-only)\n \n @discussion Default is 0 (no skew).\n @discussion Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readonly) NSNumber *yy_obliqueness;\n- (nullable NSNumber *)yy_obliquenessAtIndex:(NSUInteger)index;\n\n/**\n The log of the expansion factor to be applied to glyphs. (read-only)\n \n @discussion Default is 0 (no expansion).\n @discussion Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readonly) NSNumber *yy_expansion;\n- (nullable NSNumber *)yy_expansionAtIndex:(NSUInteger)index;\n\n/**\n The character's offset from the baseline, in points. (read-only)\n \n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readonly) NSNumber *yy_baselineOffset;\n- (nullable NSNumber *)yy_baselineOffsetAtIndex:(NSUInteger)index;\n\n/**\n Glyph orientation control. (read-only)\n \n @discussion Default is NO. A value of NO indicates that horizontal glyph forms \n are to be used, YES indicates that vertical glyph forms are to be used.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:4.3  YYText:6.0\n */\n@property (nonatomic, readonly) BOOL yy_verticalGlyphForm;\n- (BOOL)yy_verticalGlyphFormAtIndex:(NSUInteger)index;\n\n/**\n Specifies text language. (read-only)\n \n @discussion Value must be a NSString containing a locale identifier. Default is \n unset. When this attribute is set to a valid identifier, it will be used to select \n localized glyphs (if supported by the font) and locale-specific line breaking rules.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:7.0  YYText:7.0\n */\n@property (nullable, nonatomic, strong, readonly) NSString *yy_language;\n- (nullable NSString *)yy_languageAtIndex:(NSUInteger)index;\n\n/**\n Specifies a bidirectional override or embedding. (read-only)\n \n @discussion See alse NSWritingDirection and NSWritingDirectionAttributeName.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:7.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) NSArray<NSNumber *> *yy_writingDirection;\n- (nullable NSArray<NSNumber *> *)yy_writingDirectionAtIndex:(NSUInteger)index;\n\n/**\n An NSParagraphStyle object which is used to specify things like\n line alignment, tab rulers, writing direction, etc. (read-only)\n \n @discussion Default is nil ([NSParagraphStyle defaultParagraphStyle]).\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) NSParagraphStyle *yy_paragraphStyle;\n- (nullable NSParagraphStyle *)yy_paragraphStyleAtIndex:(NSUInteger)index;\n\n#pragma mark - Get paragraph attribute as property\n///=============================================================================\n/// @name Get paragraph attribute as property\n///=============================================================================\n\n/**\n The text alignment (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion Natural text alignment is realized as left or right alignment \n depending on the line sweep direction of the first script contained in the paragraph.\n @discussion Default is NSTextAlignmentNatural.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) NSTextAlignment yy_alignment;\n- (NSTextAlignment)yy_alignmentAtIndex:(NSUInteger)index;\n\n/**\n The mode that should be used to break lines (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the line break mode to be used laying out the paragraph's text.\n @discussion Default is NSLineBreakByWordWrapping.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) NSLineBreakMode yy_lineBreakMode;\n- (NSLineBreakMode)yy_lineBreakModeAtIndex:(NSUInteger)index;\n\n/**\n The distance in points between the bottom of one line fragment and the top of the next.\n (A wrapper for NSParagraphStyle) (read-only)\n \n @discussion This value is always nonnegative. This value is included in the line \n fragment heights in the layout manager.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_lineSpacing;\n- (CGFloat)yy_lineSpacingAtIndex:(NSUInteger)index;\n\n/**\n The space after the end of the paragraph (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the space (measured in points) added at the \n end of the paragraph to separate it from the following paragraph. This value must\n be nonnegative. The space between paragraphs is determined by adding the previous \n paragraph's paragraphSpacing and the current paragraph's paragraphSpacingBefore.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_paragraphSpacing;\n- (CGFloat)yy_paragraphSpacingAtIndex:(NSUInteger)index;\n\n/**\n The distance between the paragraph's top and the beginning of its text content.\n (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the space (measured in points) between the \n paragraph's top and the beginning of its text content.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_paragraphSpacingBefore;\n- (CGFloat)yy_paragraphSpacingBeforeAtIndex:(NSUInteger)index;\n\n/**\n The indentation of the first line (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the distance (in points) from the leading margin \n of a text container to the beginning of the paragraph's first line. This value \n is always nonnegative.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_firstLineHeadIndent;\n- (CGFloat)yy_firstLineHeadIndentAtIndex:(NSUInteger)index;\n\n/**\n The indentation of the receiver's lines other than the first. (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the distance (in points) from the leading margin \n of a text container to the beginning of lines other than the first. This value is \n always nonnegative.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_headIndent;\n- (CGFloat)yy_headIndentAtIndex:(NSUInteger)index;\n\n/**\n The trailing indentation (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion If positive, this value is the distance from the leading margin \n (for example, the left margin in left-to-right text). If 0 or negative, it's the \n distance from the trailing margin.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_tailIndent;\n- (CGFloat)yy_tailIndentAtIndex:(NSUInteger)index;\n\n/**\n The receiver's minimum height (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the minimum height in points that any line in \n the receiver will occupy, regardless of the font size or size of any attached graphic. \n This value must be nonnegative.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_minimumLineHeight;\n- (CGFloat)yy_minimumLineHeightAtIndex:(NSUInteger)index;\n\n/**\n The receiver's maximum line height (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the maximum height in points that any line in \n the receiver will occupy, regardless of the font size or size of any attached graphic. \n This value is always nonnegative. Glyphs and graphics exceeding this height will \n overlap neighboring lines; however, a maximum height of 0 implies no line height limit. \n Although this limit applies to the line itself, line spacing adds extra space between adjacent lines.\n @discussion Default is 0 (no limit).\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_maximumLineHeight;\n- (CGFloat)yy_maximumLineHeightAtIndex:(NSUInteger)index;\n\n/**\n The line height multiple (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property contains the line break mode to be used laying out the paragraph's text.\n @discussion Default is 0 (no multiple).\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) CGFloat yy_lineHeightMultiple;\n- (CGFloat)yy_lineHeightMultipleAtIndex:(NSUInteger)index;\n\n/**\n The base writing direction (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion If you specify NSWritingDirectionNaturalDirection, the receiver resolves \n the writing direction to either NSWritingDirectionLeftToRight or NSWritingDirectionRightToLeft, \n depending on the direction for the user's `language` preference setting.\n @discussion Default is NSWritingDirectionNatural.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readonly) NSWritingDirection yy_baseWritingDirection;\n- (NSWritingDirection)yy_baseWritingDirectionAtIndex:(NSUInteger)index;\n\n/**\n The paragraph's threshold for hyphenation. (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion Valid values lie between 0.0 and 1.0 inclusive. Hyphenation is attempted \n when the ratio of the text width (as broken without hyphenation) to the width of the \n line fragment is less than the hyphenation factor. When the paragraph's hyphenation \n factor is 0.0, the layout manager's hyphenation factor is used instead. When both \n are 0.0, hyphenation is disabled.\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since UIKit:6.0\n */\n@property (nonatomic, readonly) float yy_hyphenationFactor;\n- (float)yy_hyphenationFactorAtIndex:(NSUInteger)index;\n\n/**\n The document-wide default tab interval (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion This property represents the default tab interval in points. Tabs after the \n last specified in tabStops are placed at integer multiples of this distance (if positive).\n @discussion Default is 0.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:7.0  UIKit:7.0  YYText:7.0\n */\n@property (nonatomic, readonly) CGFloat yy_defaultTabInterval;\n- (CGFloat)yy_defaultTabIntervalAtIndex:(NSUInteger)index;\n\n/**\n An array of NSTextTab objects representing the receiver's tab stops.\n (A wrapper for NSParagraphStyle). (read-only)\n \n @discussion The NSTextTab objects, sorted by location, define the tab stops for \n the paragraph style.\n @discussion Default is 12 TabStops with 28.0 tab interval.\n @discussion Get this property returns the first character's attribute.\n @since CoreText:7.0  UIKit:7.0  YYText:7.0\n */\n@property (nullable, nonatomic, copy, readonly) NSArray<NSTextTab *> *yy_tabStops;\n- (nullable NSArray<NSTextTab *> *)yy_tabStopsAtIndex:(NSUInteger)index;\n\n#pragma mark - Get YYText attribute as property\n///=============================================================================\n/// @name Get YYText attribute as property\n///=============================================================================\n\n/**\n The text shadow. (read-only)\n \n @discussion Default value is nil (no shadow).\n @discussion Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) YYTextShadow *yy_textShadow;\n- (nullable YYTextShadow *)yy_textShadowAtIndex:(NSUInteger)index;\n\n/**\n The text inner shadow. (read-only)\n \n @discussion Default value is nil (no shadow).\n @discussion Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) YYTextShadow *yy_textInnerShadow;\n- (nullable YYTextShadow *)yy_textInnerShadowAtIndex:(NSUInteger)index;\n\n/**\n The text underline. (read-only)\n \n @discussion Default value is nil (no underline).\n @discussion Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) YYTextDecoration *yy_textUnderline;\n- (nullable YYTextDecoration *)yy_textUnderlineAtIndex:(NSUInteger)index;\n\n/**\n The text strikethrough. (read-only)\n \n @discussion Default value is nil (no strikethrough).\n @discussion Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) YYTextDecoration *yy_textStrikethrough;\n- (nullable YYTextDecoration *)yy_textStrikethroughAtIndex:(NSUInteger)index;\n\n/**\n The text border. (read-only)\n \n @discussion Default value is nil (no border).\n @discussion Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) YYTextBorder *yy_textBorder;\n- (nullable YYTextBorder *)yy_textBorderAtIndex:(NSUInteger)index;\n\n/**\n The text background border. (read-only)\n \n @discussion Default value is nil (no background border).\n @discussion Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readonly) YYTextBorder *yy_textBackgroundBorder;\n- (nullable YYTextBorder *)yy_textBackgroundBorderAtIndex:(NSUInteger)index;\n\n/**\n The glyph transform. (read-only)\n \n @discussion Default value is CGAffineTransformIdentity (no transform).\n @discussion Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nonatomic, readonly) CGAffineTransform yy_textGlyphTransform;\n- (CGAffineTransform)yy_textGlyphTransformAtIndex:(NSUInteger)index;\n\n\n#pragma mark - Query for YYText\n///=============================================================================\n/// @name Query for YYText\n///=============================================================================\n\n/**\n Returns the plain text from a range.\n If there's `YYTextBackedStringAttributeName` attribute, the backed string will\n replace the attributed string range.\n \n @param range A range in receiver.\n @return The plain text.\n */\n- (nullable NSString *)yy_plainTextForRange:(NSRange)range;\n\n\n#pragma mark - Create attachment string for YYText\n///=============================================================================\n/// @name Create attachment string for YYText\n///=============================================================================\n\n/**\n Creates and returns an attachment.\n \n @param content      The attachment (UIImage/UIView/CALayer).\n @param contentMode  The attachment's content mode.\n @param width        The attachment's container width in layout.\n @param ascent       The attachment's container ascent in layout.\n @param descent      The attachment's container descent in layout.\n \n @return An attributed string, or nil if an error occurs.\n @since YYText:6.0\n */\n+ (NSMutableAttributedString *)yy_attachmentStringWithContent:(nullable id)content\n                                                  contentMode:(UIViewContentMode)contentMode\n                                                        width:(CGFloat)width\n                                                       ascent:(CGFloat)ascent\n                                                      descent:(CGFloat)descent;\n\n/**\n Creates and returns an attachment.\n \n \n Example: ContentMode:bottom Alignment:Top.\n \n      The text      The attachment holder\n         ↓                ↓\n     ─────────┌──────────────────────┐───────\n        / \\   │                      │ / ___|\n       / _ \\  │                      │| |\n      / ___ \\ │                      │| |___     ←── The text line\n     /_/   \\_\\│    ██████████████    │ \\____|\n     ─────────│    ██████████████    │───────\n              │    ██████████████    │\n              │    ██████████████ ←───────────────── The attachment content\n              │    ██████████████    │\n              └──────────────────────┘\n\n @param content        The attachment (UIImage/UIView/CALayer).\n @param contentMode    The attachment's content mode in attachment holder\n @param attachmentSize The attachment holder's size in text layout.\n @param fontSize       The attachment will align to this font.\n @param alignment      The attachment holder's alignment to text line.\n \n @return An attributed string, or nil if an error occurs.\n @since YYText:6.0\n */\n+ (NSMutableAttributedString *)yy_attachmentStringWithContent:(nullable id)content\n                                                  contentMode:(UIViewContentMode)contentMode\n                                               attachmentSize:(CGSize)attachmentSize\n                                                  alignToFont:(UIFont *)font\n                                                    alignment:(YYTextVerticalAlignment)alignment;\n\n/**\n Creates and returns an attahment from a fourquare image as if it was an emoji.\n \n @param image     A fourquare image.\n @param fontSize  The font size.\n \n @return An attributed string, or nil if an error occurs.\n @since YYText:6.0\n */\n+ (nullable NSMutableAttributedString *)yy_attachmentStringWithEmojiImage:(UIImage *)image\n                                                                 fontSize:(CGFloat)fontSize;\n\n#pragma mark - Utility\n///=============================================================================\n/// @name Utility\n///=============================================================================\n\n/**\n Returns NSMakeRange(0, self.length).\n */\n- (NSRange)yy_rangeOfAll;\n\n/**\n If YES, it share the same attribute in entire text range.\n */\n- (BOOL)yy_isSharedAttributesInAllRange;\n\n/**\n If YES, it can be drawn with the [drawWithRect:options:context:] method or displayed with UIKit.\n If NO, it should be drawn with CoreText or YYText.\n \n @discussion If the method returns NO, it means that there's at least one attribute \n which is not supported by UIKit (such as CTParagraphStyleRef). If display this string\n in UIKit, it may lose some attribute, or even crash the app.\n */\n- (BOOL)yy_canDrawWithUIKit;\n\n@end\n\n\n\n\n/**\n Set pre-defined attributes to attributed string.\n All properties defined in UIKit, CoreText and YYText are included.\n */\n@interface NSMutableAttributedString (YYText)\n\n#pragma mark - Set character attribute\n///=============================================================================\n/// @name Set character attribute\n///=============================================================================\n\n/**\n Sets the attributes to the entire text string.\n \n @discussion The old attributes will be removed.\n \n @param attributes  A dictionary containing the attributes to set, or nil to remove all attributes.\n */\n- (void)yy_setAttributes:(nullable NSDictionary<NSString *, id> *)attributes;\n- (void)setYy_attributes:(nullable NSDictionary<NSString *, id> *)attributes;\n\n/**\n Sets an attribute with the given name and value to the entire text string.\n \n @param name   A string specifying the attribute name.\n @param value  The attribute value associated with name. Pass `nil` or `NSNull` to\n remove the attribute.\n */\n- (void)yy_setAttribute:(NSString *)name value:(nullable id)value;\n\n/**\n Sets an attribute with the given name and value to the characters in the specified range.\n \n @param name   A string specifying the attribute name.\n @param value  The attribute value associated with name. Pass `nil` or `NSNull` to\n remove the attribute.\n @param range  The range of characters to which the specified attribute/value pair applies.\n */\n- (void)yy_setAttribute:(NSString *)name value:(nullable id)value range:(NSRange)range;\n\n/**\n Removes all attributes in the specified range.\n \n @param range  The range of characters.\n */\n- (void)yy_removeAttributesInRange:(NSRange)range;\n\n\n#pragma mark - Set character attribute as property\n///=============================================================================\n/// @name Set character attribute as property\n///=============================================================================\n\n/**\n The font of the text.\n \n @discussion Default is Helvetica (Neue) 12.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) UIFont *yy_font;\n- (void)yy_setFont:(nullable UIFont *)font range:(NSRange)range;\n\n/**\n A kerning adjustment.\n \n @discussion Default is standard kerning. The kerning attribute indicate how many \n points the following character should be shifted from its default offset as \n defined by the current character's font in points; a positive kern indicates a \n shift farther along and a negative kern indicates a shift closer to the current \n character. If this attribute is not present, standard kerning will be used. \n If this attribute is set to 0.0, no kerning will be done at all.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSNumber *yy_kern;\n- (void)yy_setKern:(nullable NSNumber *)kern range:(NSRange)range;\n\n/**\n The foreground color.\n \n @discussion Default is Black.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) UIColor *yy_color;\n- (void)yy_setColor:(nullable UIColor *)color range:(NSRange)range;\n\n/**\n The background color.\n \n @discussion Default is nil (or no background).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) UIColor *yy_backgroundColor;\n- (void)yy_setBackgroundColor:(nullable UIColor *)backgroundColor range:(NSRange)range;\n\n/**\n The stroke width.\n \n @discussion Default value is 0.0 (no stroke). This attribute, interpreted as\n a percentage of font point size, controls the text drawing mode: positive \n values effect drawing with stroke only; negative values are for stroke and fill.\n A typical value for outlined text is 3.0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSNumber *yy_strokeWidth;\n- (void)yy_setStrokeWidth:(nullable NSNumber *)strokeWidth range:(NSRange)range;\n\n/**\n The stroke color.\n \n @discussion Default value is nil (same as foreground color).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) UIColor *yy_strokeColor;\n- (void)yy_setStrokeColor:(nullable UIColor *)strokeColor range:(NSRange)range;\n\n/**\n The text shadow.\n \n @discussion Default value is nil (no shadow).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSShadow *yy_shadow;\n- (void)yy_setShadow:(nullable NSShadow *)shadow range:(NSRange)range;\n\n/**\n The strikethrough style.\n \n @discussion Default value is NSUnderlineStyleNone (no strikethrough).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:6.0\n */\n@property (nonatomic, readwrite) NSUnderlineStyle yy_strikethroughStyle;\n- (void)yy_setStrikethroughStyle:(NSUnderlineStyle)strikethroughStyle range:(NSRange)range;\n\n/**\n The strikethrough color.\n \n @discussion Default value is nil (same as foreground color).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readwrite) UIColor *yy_strikethroughColor;\n- (void)yy_setStrikethroughColor:(nullable UIColor *)strikethroughColor range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n/**\n The underline style.\n \n @discussion Default value is NSUnderlineStyleNone (no underline).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0\n */\n@property (nonatomic, readwrite) NSUnderlineStyle yy_underlineStyle;\n- (void)yy_setUnderlineStyle:(NSUnderlineStyle)underlineStyle range:(NSRange)range;\n\n/**\n The underline color.\n \n @discussion Default value is nil (same as foreground color).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readwrite) UIColor *yy_underlineColor;\n- (void)yy_setUnderlineColor:(nullable UIColor *)underlineColor range:(NSRange)range;\n\n/**\n Ligature formation control.\n \n @discussion Default is int value 1. The ligature attribute determines what kinds \n of ligatures should be used when displaying the string. A value of 0 indicates \n that only ligatures essential for proper rendering of text should be used, \n 1 indicates that standard ligatures should be used, and 2 indicates that all \n available ligatures should be used. Which ligatures are standard depends on the \n script and possibly the font.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:3.2  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSNumber *yy_ligature;\n- (void)yy_setLigature:(nullable NSNumber *)ligature range:(NSRange)range;\n\n/**\n The text effect.\n \n @discussion Default is nil (no effect). The only currently supported value\n is NSTextEffectLetterpressStyle.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSString *yy_textEffect;\n- (void)yy_setTextEffect:(nullable NSString *)textEffect range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n/**\n The skew to be applied to glyphs. \n \n @discussion Default is 0 (no skew).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSNumber *yy_obliqueness;\n- (void)yy_setObliqueness:(nullable NSNumber *)obliqueness range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n/**\n The log of the expansion factor to be applied to glyphs.\n \n @discussion Default is 0 (no expansion).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSNumber *yy_expansion;\n- (void)yy_setExpansion:(nullable NSNumber *)expansion range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n/**\n The character's offset from the baseline, in points. \n \n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:7.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSNumber *yy_baselineOffset;\n- (void)yy_setBaselineOffset:(nullable NSNumber *)baselineOffset range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n/**\n Glyph orientation control.\n \n @discussion Default is NO. A value of NO indicates that horizontal glyph forms \n are to be used, YES indicates that vertical glyph forms are to be used.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:4.3  YYText:6.0\n */\n@property (nonatomic, readwrite) BOOL yy_verticalGlyphForm;\n- (void)yy_setVerticalGlyphForm:(BOOL)verticalGlyphForm range:(NSRange)range;\n\n/**\n Specifies text language.\n \n @discussion Value must be a NSString containing a locale identifier. Default is \n unset. When this attribute is set to a valid identifier, it will be used to select \n localized glyphs (if supported by the font) and locale-specific line breaking rules.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:7.0  YYText:7.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSString *yy_language;\n- (void)yy_setLanguage:(nullable NSString *)language range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n/**\n Specifies a bidirectional override or embedding.\n \n @discussion See alse NSWritingDirection and NSWritingDirectionAttributeName.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:7.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSArray<NSNumber *> *yy_writingDirection;\n- (void)yy_setWritingDirection:(nullable NSArray<NSNumber *> *)writingDirection range:(NSRange)range;\n\n/**\n An NSParagraphStyle object which is used to specify things like\n line alignment, tab rulers, writing direction, etc.\n \n @discussion Default is nil ([NSParagraphStyle defaultParagraphStyle]).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) NSParagraphStyle *yy_paragraphStyle;\n- (void)yy_setParagraphStyle:(nullable NSParagraphStyle *)paragraphStyle range:(NSRange)range;\n\n\n#pragma mark - Set paragraph attribute as property\n///=============================================================================\n/// @name Set paragraph attribute as property\n///=============================================================================\n\n/**\n The text alignment (A wrapper for NSParagraphStyle).\n \n @discussion Natural text alignment is realized as left or right alignment\n depending on the line sweep direction of the first script contained in the paragraph.\n @discussion Default is NSTextAlignmentNatural.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) NSTextAlignment yy_alignment;\n- (void)yy_setAlignment:(NSTextAlignment)alignment range:(NSRange)range;\n\n/**\n The mode that should be used to break lines (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the line break mode to be used laying out the paragraph's text.\n @discussion Default is NSLineBreakByWordWrapping.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) NSLineBreakMode yy_lineBreakMode;\n- (void)yy_setLineBreakMode:(NSLineBreakMode)lineBreakMode range:(NSRange)range;\n\n/**\n The distance in points between the bottom of one line fragment and the top of the next.\n (A wrapper for NSParagraphStyle)\n \n @discussion This value is always nonnegative. This value is included in the line\n fragment heights in the layout manager.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_lineSpacing;\n- (void)yy_setLineSpacing:(CGFloat)lineSpacing range:(NSRange)range;\n\n/**\n The space after the end of the paragraph (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the space (measured in points) added at the\n end of the paragraph to separate it from the following paragraph. This value must\n be nonnegative. The space between paragraphs is determined by adding the previous\n paragraph's paragraphSpacing and the current paragraph's paragraphSpacingBefore.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_paragraphSpacing;\n- (void)yy_setParagraphSpacing:(CGFloat)paragraphSpacing range:(NSRange)range;\n\n/**\n The distance between the paragraph's top and the beginning of its text content.\n (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the space (measured in points) between the\n paragraph's top and the beginning of its text content.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_paragraphSpacingBefore;\n- (void)yy_setParagraphSpacingBefore:(CGFloat)paragraphSpacingBefore range:(NSRange)range;\n\n/**\n The indentation of the first line (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the distance (in points) from the leading margin\n of a text container to the beginning of the paragraph's first line. This value\n is always nonnegative.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_firstLineHeadIndent;\n- (void)yy_setFirstLineHeadIndent:(CGFloat)firstLineHeadIndent range:(NSRange)range;\n\n/**\n The indentation of the receiver's lines other than the first. (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the distance (in points) from the leading margin\n of a text container to the beginning of lines other than the first. This value is\n always nonnegative.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_headIndent;\n- (void)yy_setHeadIndent:(CGFloat)headIndent range:(NSRange)range;\n\n/**\n The trailing indentation (A wrapper for NSParagraphStyle).\n \n @discussion If positive, this value is the distance from the leading margin\n (for example, the left margin in left-to-right text). If 0 or negative, it's the\n distance from the trailing margin.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_tailIndent;\n- (void)yy_setTailIndent:(CGFloat)tailIndent range:(NSRange)range;\n\n/**\n The receiver's minimum height (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the minimum height in points that any line in\n the receiver will occupy, regardless of the font size or size of any attached graphic.\n This value must be nonnegative.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_minimumLineHeight;\n- (void)yy_setMinimumLineHeight:(CGFloat)minimumLineHeight range:(NSRange)range;\n\n/**\n The receiver's maximum line height (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the maximum height in points that any line in\n the receiver will occupy, regardless of the font size or size of any attached graphic.\n This value is always nonnegative. Glyphs and graphics exceeding this height will\n overlap neighboring lines; however, a maximum height of 0 implies no line height limit.\n Although this limit applies to the line itself, line spacing adds extra space between adjacent lines.\n @discussion Default is 0 (no limit).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_maximumLineHeight;\n- (void)yy_setMaximumLineHeight:(CGFloat)maximumLineHeight range:(NSRange)range;\n\n/**\n The line height multiple (A wrapper for NSParagraphStyle).\n \n @discussion This property contains the line break mode to be used laying out the paragraph's text.\n @discussion Default is 0 (no multiple).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) CGFloat yy_lineHeightMultiple;\n- (void)yy_setLineHeightMultiple:(CGFloat)lineHeightMultiple range:(NSRange)range;\n\n/**\n The base writing direction (A wrapper for NSParagraphStyle).\n \n @discussion If you specify NSWritingDirectionNaturalDirection, the receiver resolves\n the writing direction to either NSWritingDirectionLeftToRight or NSWritingDirectionRightToLeft,\n depending on the direction for the user's `language` preference setting.\n @discussion Default is NSWritingDirectionNatural.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:6.0  UIKit:6.0  YYText:6.0\n */\n@property (nonatomic, readwrite) NSWritingDirection yy_baseWritingDirection;\n- (void)yy_setBaseWritingDirection:(NSWritingDirection)baseWritingDirection range:(NSRange)range;\n\n/**\n The paragraph's threshold for hyphenation. (A wrapper for NSParagraphStyle).\n \n @discussion Valid values lie between 0.0 and 1.0 inclusive. Hyphenation is attempted\n when the ratio of the text width (as broken without hyphenation) to the width of the\n line fragment is less than the hyphenation factor. When the paragraph's hyphenation\n factor is 0.0, the layout manager's hyphenation factor is used instead. When both\n are 0.0, hyphenation is disabled.\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since UIKit:6.0\n */\n@property (nonatomic, readwrite) float yy_hyphenationFactor;\n- (void)yy_setHyphenationFactor:(float)hyphenationFactor range:(NSRange)range;\n\n/**\n The document-wide default tab interval (A wrapper for NSParagraphStyle).\n \n @discussion This property represents the default tab interval in points. Tabs after the\n last specified in tabStops are placed at integer multiples of this distance (if positive).\n @discussion Default is 0.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:7.0  UIKit:7.0  YYText:7.0\n */\n@property (nonatomic, readwrite) CGFloat yy_defaultTabInterval;\n- (void)yy_setDefaultTabInterval:(CGFloat)defaultTabInterval range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n/**\n An array of NSTextTab objects representing the receiver's tab stops.\n (A wrapper for NSParagraphStyle).\n \n @discussion The NSTextTab objects, sorted by location, define the tab stops for\n the paragraph style.\n @discussion Default is 12 TabStops with 28.0 tab interval.\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since CoreText:7.0  UIKit:7.0  YYText:7.0\n */\n@property (nullable, nonatomic, copy, readwrite) NSArray<NSTextTab *> *yy_tabStops;\n- (void)yy_setTabStops:(nullable NSArray<NSTextTab *> *)tabStops range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n\n#pragma mark - Set YYText attribute as property\n///=============================================================================\n/// @name Set YYText attribute as property\n///=============================================================================\n\n/**\n The text shadow.\n \n @discussion Default value is nil (no shadow).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) YYTextShadow *yy_textShadow;\n- (void)yy_setTextShadow:(nullable YYTextShadow *)textShadow range:(NSRange)range;\n\n/**\n The text inner shadow.\n \n @discussion Default value is nil (no shadow).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) YYTextShadow *yy_textInnerShadow;\n- (void)yy_setTextInnerShadow:(nullable YYTextShadow *)textInnerShadow range:(NSRange)range;\n\n/**\n The text underline.\n \n @discussion Default value is nil (no underline).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) YYTextDecoration *yy_textUnderline;\n- (void)yy_setTextUnderline:(nullable YYTextDecoration *)textUnderline range:(NSRange)range;\n\n/**\n The text strikethrough.\n \n @discussion Default value is nil (no strikethrough).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) YYTextDecoration *yy_textStrikethrough;\n- (void)yy_setTextStrikethrough:(nullable YYTextDecoration *)textStrikethrough range:(NSRange)range;\n\n/**\n The text border.\n \n @discussion Default value is nil (no border).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) YYTextBorder *yy_textBorder;\n- (void)yy_setTextBorder:(nullable YYTextBorder *)textBorder range:(NSRange)range;\n\n/**\n The text background border.\n \n @discussion Default value is nil (no background border).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nullable, nonatomic, strong, readwrite) YYTextBorder *yy_textBackgroundBorder;\n- (void)yy_setTextBackgroundBorder:(nullable YYTextBorder *)textBackgroundBorder range:(NSRange)range;\n\n/**\n The glyph transform.\n \n @discussion Default value is CGAffineTransformIdentity (no transform).\n @discussion Set this property applies to the entire text string.\n             Get this property returns the first character's attribute.\n @since YYText:6.0\n */\n@property (nonatomic, readwrite) CGAffineTransform yy_textGlyphTransform;\n- (void)yy_setTextGlyphTransform:(CGAffineTransform)textGlyphTransform range:(NSRange)range;\n\n\n#pragma mark - Set discontinuous attribute for range\n///=============================================================================\n/// @name Set discontinuous attribute for range\n///=============================================================================\n\n- (void)yy_setSuperscript:(nullable NSNumber *)superscript range:(NSRange)range;\n- (void)yy_setGlyphInfo:(nullable CTGlyphInfoRef)glyphInfo range:(NSRange)range;\n- (void)yy_setCharacterShape:(nullable NSNumber *)characterShape range:(NSRange)range;\n- (void)yy_setRunDelegate:(nullable CTRunDelegateRef)runDelegate range:(NSRange)range;\n- (void)yy_setBaselineClass:(nullable CFStringRef)baselineClass range:(NSRange)range;\n- (void)yy_setBaselineInfo:(nullable CFDictionaryRef)baselineInfo range:(NSRange)range;\n- (void)yy_setBaselineReferenceInfo:(nullable CFDictionaryRef)referenceInfo range:(NSRange)range;\n- (void)yy_setRubyAnnotation:(nullable CTRubyAnnotationRef)ruby range:(NSRange)range NS_AVAILABLE_IOS(8_0);\n- (void)yy_setAttachment:(nullable NSTextAttachment *)attachment range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n- (void)yy_setLink:(nullable id)link range:(NSRange)range NS_AVAILABLE_IOS(7_0);\n- (void)yy_setTextBackedString:(nullable YYTextBackedString *)textBackedString range:(NSRange)range;\n- (void)yy_setTextBinding:(nullable YYTextBinding *)textBinding range:(NSRange)range;\n- (void)yy_setTextAttachment:(nullable YYTextAttachment *)textAttachment range:(NSRange)range;\n- (void)yy_setTextHighlight:(nullable YYTextHighlight *)textHighlight range:(NSRange)range;\n- (void)yy_setTextBlockBorder:(nullable YYTextBorder *)textBlockBorder range:(NSRange)range;\n- (void)yy_setTextRubyAnnotation:(nullable YYTextRubyAnnotation *)ruby range:(NSRange)range NS_AVAILABLE_IOS(8_0);\n\n\n#pragma mark - Convenience methods for text highlight\n///=============================================================================\n/// @name Convenience methods for text highlight\n///=============================================================================\n\n/**\n Convenience method to set text highlight\n \n @param range           text range\n @param color           text color (pass nil to ignore)\n @param backgroundColor text background color when highlight\n @param userInfo        user information dictionary (pass nil to ignore)\n @param tapAction       tap action when user tap the highlight (pass nil to ignore)\n @param longPressAction long press action when user long press the highlight (pass nil to ignore)\n */\n- (void)yy_setTextHighlightRange:(NSRange)range\n                           color:(nullable UIColor *)color\n                 backgroundColor:(nullable UIColor *)backgroundColor\n                        userInfo:(nullable NSDictionary *)userInfo\n                       tapAction:(nullable YYTextAction)tapAction\n                 longPressAction:(nullable YYTextAction)longPressAction;\n\n/**\n Convenience method to set text highlight\n \n @param range           text range\n @param color           text color (pass nil to ignore)\n @param backgroundColor text background color when highlight\n @param tapAction       tap action when user tap the highlight (pass nil to ignore)\n */\n- (void)yy_setTextHighlightRange:(NSRange)range\n                           color:(nullable UIColor *)color\n                 backgroundColor:(nullable UIColor *)backgroundColor\n                       tapAction:(nullable YYTextAction)tapAction;\n\n/**\n Convenience method to set text highlight\n \n @param range           text range\n @param color           text color (pass nil to ignore)\n @param backgroundColor text background color when highlight\n @param userInfo        tap action when user tap the highlight (pass nil to ignore)\n */\n- (void)yy_setTextHighlightRange:(NSRange)range\n                           color:(nullable UIColor *)color\n                 backgroundColor:(nullable UIColor *)backgroundColor\n                        userInfo:(nullable NSDictionary *)userInfo;\n\n#pragma mark - Utilities\n///=============================================================================\n/// @name Utilities\n///=============================================================================\n\n/**\n Inserts into the receiver the characters of a given string at a given location.\n The new string inherit the attributes of the first replaced character from location.\n \n @param string  The string to insert into the receiver, must not be nil.\n @param location The location at which string is inserted. The location must not \n    exceed the bounds of the receiver.\n @throw Raises an NSRangeException if the location out of bounds.\n */\n- (void)yy_insertString:(NSString *)string atIndex:(NSUInteger)location;\n\n/**\n Adds to the end of the receiver the characters of a given string.\n The new string inherit the attributes of the receiver's tail.\n \n @param string  The string to append to the receiver, must not be nil.\n */\n- (void)yy_appendString:(NSString *)string;\n\n/**\n Set foreground color with [UIColor clearColor] in joined-emoji range.\n Emoji drawing will not be affected by the foreground color.\n \n @discussion In iOS 8.3, Apple releases some new diversified emojis. \n There's some single emoji which can be assembled to a new 'joined-emoji'.\n The joiner is unicode character 'ZERO WIDTH JOINER' (U+200D).\n For example: 👨👩👧👧 -> 👨‍👩‍👧‍👧.\n \n When there are more than 5 'joined-emoji' in a same CTLine, CoreText may render some\n extra glyphs above the emoji. It's a bug in CoreText, try this method to avoid.\n This bug is fixed in iOS 9.\n */\n- (void)yy_setClearColorToJoinedEmoji;\n\n/**\n Removes all discontinuous attributes in a specified range.\n See `allDiscontinuousAttributeKeys`.\n \n @param range A text range.\n */\n- (void)yy_removeDiscontinuousAttributesInRange:(NSRange)range;\n\n/**\n Returns all discontinuous attribute keys, such as RunDelegate/Attachment/Ruby.\n \n @discussion These attributes can only set to a specified range of text, and\n should not extend to other range when editing text.\n */\n+ (NSArray<NSString *> *)yy_allDiscontinuousAttributeKeys;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/NSAttributedString+YYText.m",
    "content": "//\n//  NSAttributedString+YYText.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/7.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"NSAttributedString+YYText.h\"\n#import \"NSParagraphStyle+YYText.h\"\n#import \"YYTextArchiver.h\"\n#import \"YYTextRunDelegate.h\"\n#import \"YYTextUtilities.h\"\n#import <CoreFoundation/CoreFoundation.h>\n\n\n// Dummy class for category\n@interface NSAttributedString_YYText : NSObject @end\n@implementation NSAttributedString_YYText @end\n\n\nstatic double _YYDeviceSystemVersion() {\n    static double version;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        version = [UIDevice currentDevice].systemVersion.doubleValue;\n    });\n    return version;\n}\n\n#ifndef kSystemVersion\n#define kSystemVersion _YYDeviceSystemVersion()\n#endif\n\n#ifndef kiOS6Later\n#define kiOS6Later (kSystemVersion >= 6)\n#endif\n\n#ifndef kiOS7Later\n#define kiOS7Later (kSystemVersion >= 7)\n#endif\n\n#ifndef kiOS8Later\n#define kiOS8Later (kSystemVersion >= 8)\n#endif\n\n#ifndef kiOS9Later\n#define kiOS9Later (kSystemVersion >= 9)\n#endif\n\n\n\n@implementation NSAttributedString (YYText)\n\n- (NSData *)yy_archiveToData {\n    NSData *data = nil;\n    @try {\n        data = [YYTextArchiver archivedDataWithRootObject:self];\n    }\n    @catch (NSException *exception) {\n        NSLog(@\"%@\",exception);\n    }\n    return data;\n}\n\n+ (instancetype)yy_unarchiveFromData:(NSData *)data {\n    NSAttributedString *one = nil;\n    @try {\n        one = [YYTextUnarchiver unarchiveObjectWithData:data];\n    }\n    @catch (NSException *exception) {\n        NSLog(@\"%@\",exception);\n    }\n    return one;\n}\n\n- (NSDictionary *)yy_attributesAtIndex:(NSUInteger)index {\n    if (index > self.length || self.length == 0) return nil;\n    if (self.length > 0 && index == self.length) index--;\n    return [self attributesAtIndex:index effectiveRange:NULL];\n}\n\n- (id)yy_attribute:(NSString *)attributeName atIndex:(NSUInteger)index {\n    if (!attributeName) return nil;\n    if (index > self.length || self.length == 0) return nil;\n    if (self.length > 0 && index == self.length) index--;\n    return [self attribute:attributeName atIndex:index effectiveRange:NULL];\n}\n\n- (NSDictionary *)yy_attributes {\n    return [self yy_attributesAtIndex:0];\n}\n\n- (UIFont *)yy_font {\n    return [self yy_fontAtIndex:0];\n}\n\n- (UIFont *)yy_fontAtIndex:(NSUInteger)index {\n    /*\n     In iOS7 and later, UIFont is toll-free bridged to CTFontRef,\n     although Apple does not mention it in documentation.\n     \n     In iOS6, UIFont is a wrapper for CTFontRef, so CoreText can alse use UIfont,\n     but UILabel/UITextView cannot use CTFontRef.\n     \n     We use UIFont for both CoreText and UIKit.\n     */\n    UIFont *font = [self yy_attribute:NSFontAttributeName atIndex:index];\n    if (kSystemVersion <= 6) {\n        if (font) {\n            if (CFGetTypeID((__bridge CFTypeRef)(font)) == CTFontGetTypeID()) {\n                CTFontRef CTFont = (__bridge CTFontRef)(font);\n                CFStringRef name = CTFontCopyPostScriptName(CTFont);\n                CGFloat size = CTFontGetSize(CTFont);\n                if (!name) {\n                    font = nil;\n                } else {\n                    font = [UIFont fontWithName:(__bridge NSString *)(name) size:size];\n                    CFRelease(name);\n                }\n            }\n        }\n    }\n    return font;\n}\n\n- (NSNumber *)yy_kern {\n    return [self yy_kernAtIndex:0];\n}\n\n- (NSNumber *)yy_kernAtIndex:(NSUInteger)index {\n    return [self yy_attribute:NSKernAttributeName atIndex:index];\n}\n\n- (UIColor *)yy_color {\n    return [self yy_colorAtIndex:0];\n}\n\n- (UIColor *)yy_colorAtIndex:(NSUInteger)index {\n    UIColor *color = [self yy_attribute:NSForegroundColorAttributeName atIndex:index];\n    if (!color) {\n        CGColorRef ref = (__bridge CGColorRef)([self yy_attribute:(NSString *)kCTForegroundColorAttributeName atIndex:index]);\n        color = [UIColor colorWithCGColor:ref];\n    }\n    if (color && ![color isKindOfClass:[UIColor class]]) {\n        if (CFGetTypeID((__bridge CFTypeRef)(color)) == CGColorGetTypeID()) {\n            color = [UIColor colorWithCGColor:(__bridge CGColorRef)(color)];\n        } else {\n            color = nil;\n        }\n    }\n    return color;\n}\n\n- (UIColor *)yy_backgroundColor {\n    return [self yy_backgroundColorAtIndex:0];\n}\n\n- (UIColor *)yy_backgroundColorAtIndex:(NSUInteger)index {\n    return [self yy_attribute:NSBackgroundColorAttributeName atIndex:index];\n}\n\n- (NSNumber *)yy_strokeWidth {\n    return [self yy_strokeWidthAtIndex:0];\n}\n\n- (NSNumber *)yy_strokeWidthAtIndex:(NSUInteger)index {\n    return [self yy_attribute:NSStrokeWidthAttributeName atIndex:index];\n}\n\n- (UIColor *)yy_strokeColor {\n    return [self yy_strokeColorAtIndex:0];\n}\n\n- (UIColor *)yy_strokeColorAtIndex:(NSUInteger)index {\n    UIColor *color = [self yy_attribute:NSStrokeColorAttributeName atIndex:index];\n    if (!color) {\n        CGColorRef ref = (__bridge CGColorRef)([self yy_attribute:(NSString *)kCTStrokeColorAttributeName atIndex:index]);\n        color = [UIColor colorWithCGColor:ref];\n    }\n    return color;\n}\n\n- (NSShadow *)yy_shadow {\n    return [self yy_shadowAtIndex:0];\n}\n\n- (NSShadow *)yy_shadowAtIndex:(NSUInteger)index {\n    return [self yy_attribute:NSShadowAttributeName atIndex:index];\n}\n\n- (NSUnderlineStyle)yy_strikethroughStyle {\n    return [self yy_strikethroughStyleAtIndex:0];\n}\n\n- (NSUnderlineStyle)yy_strikethroughStyleAtIndex:(NSUInteger)index {\n    NSNumber *style = [self yy_attribute:NSStrikethroughStyleAttributeName atIndex:index];\n    return style.integerValue;\n}\n\n- (UIColor *)yy_strikethroughColor {\n    return [self yy_strikethroughColorAtIndex:0];\n}\n\n- (UIColor *)yy_strikethroughColorAtIndex:(NSUInteger)index {\n    if (kSystemVersion >= 7) {\n        return [self yy_attribute:NSStrikethroughColorAttributeName atIndex:index];\n    }\n    return nil;\n}\n\n- (NSUnderlineStyle)yy_underlineStyle {\n    return [self yy_underlineStyleAtIndex:0];\n}\n\n- (NSUnderlineStyle)yy_underlineStyleAtIndex:(NSUInteger)index {\n    NSNumber *style = [self yy_attribute:NSUnderlineStyleAttributeName atIndex:index];\n    return style.integerValue;\n}\n\n- (UIColor *)yy_underlineColor {\n    return [self yy_underlineColorAtIndex:0];\n}\n\n- (UIColor *)yy_underlineColorAtIndex:(NSUInteger)index {\n    UIColor *color = nil;\n    if (kSystemVersion >= 7) {\n        color = [self yy_attribute:NSUnderlineColorAttributeName atIndex:index];\n    }\n    if (!color) {\n        CGColorRef ref = (__bridge CGColorRef)([self yy_attribute:(NSString *)kCTUnderlineColorAttributeName atIndex:index]);\n        color = [UIColor colorWithCGColor:ref];\n    }\n    return color;\n}\n\n- (NSNumber *)yy_ligature {\n    return [self yy_ligatureAtIndex:0];\n}\n\n- (NSNumber *)yy_ligatureAtIndex:(NSUInteger)index {\n    return [self yy_attribute:NSLigatureAttributeName atIndex:index];\n}\n\n- (NSString *)yy_textEffect {\n    return [self yy_textEffectAtIndex:0];\n}\n\n- (NSString *)yy_textEffectAtIndex:(NSUInteger)index {\n    if (kSystemVersion >= 7) {\n        return [self yy_attribute:NSTextEffectAttributeName atIndex:index];\n    }\n    return nil;\n}\n\n- (NSNumber *)yy_obliqueness {\n    return [self yy_obliquenessAtIndex:0];\n}\n\n- (NSNumber *)yy_obliquenessAtIndex:(NSUInteger)index {\n    if (kSystemVersion >= 7) {\n        return [self yy_attribute:NSObliquenessAttributeName atIndex:index];\n    }\n    return nil;\n}\n\n- (NSNumber *)yy_expansion {\n    return [self yy_expansionAtIndex:0];\n}\n\n- (NSNumber *)yy_expansionAtIndex:(NSUInteger)index {\n    if (kSystemVersion >= 7) {\n        return [self yy_attribute:NSExpansionAttributeName atIndex:index];\n    }\n    return nil;\n}\n\n- (NSNumber *)yy_baselineOffset {\n    return [self yy_baselineOffsetAtIndex:0];\n}\n\n- (NSNumber *)yy_baselineOffsetAtIndex:(NSUInteger)index {\n    if (kSystemVersion >= 7) {\n        return [self yy_attribute:NSBaselineOffsetAttributeName atIndex:index];\n    }\n    return nil;\n}\n\n- (BOOL)yy_verticalGlyphForm {\n    return [self yy_verticalGlyphFormAtIndex:0];\n}\n\n- (BOOL)yy_verticalGlyphFormAtIndex:(NSUInteger)index {\n    NSNumber *num = [self yy_attribute:NSVerticalGlyphFormAttributeName atIndex:index];\n    return num.boolValue;\n}\n\n- (NSString *)yy_language {\n    return [self yy_languageAtIndex:0];\n}\n\n- (NSString *)yy_languageAtIndex:(NSUInteger)index {\n    if (kSystemVersion >= 7) {\n        return [self yy_attribute:(id)kCTLanguageAttributeName atIndex:index];\n    }\n    return nil;\n}\n\n- (NSArray *)yy_writingDirection {\n    return [self yy_writingDirectionAtIndex:0];\n}\n\n- (NSArray *)yy_writingDirectionAtIndex:(NSUInteger)index {\n    return [self yy_attribute:(id)kCTWritingDirectionAttributeName atIndex:index];\n}\n\n- (NSParagraphStyle *)yy_paragraphStyle {\n    return [self yy_paragraphStyleAtIndex:0];\n}\n\n- (NSParagraphStyle *)yy_paragraphStyleAtIndex:(NSUInteger)index {\n    /*\n     NSParagraphStyle is NOT toll-free bridged to CTParagraphStyleRef.\n     \n     CoreText can use both NSParagraphStyle and CTParagraphStyleRef,\n     but UILabel/UITextView can only use NSParagraphStyle.\n     \n     We use NSParagraphStyle in both CoreText and UIKit.\n     */\n    NSParagraphStyle *style = [self yy_attribute:NSParagraphStyleAttributeName atIndex:index];\n    if (style) {\n        if (CFGetTypeID((__bridge CFTypeRef)(style)) == CTParagraphStyleGetTypeID()) { \\\n            style = [NSParagraphStyle yy_styleWithCTStyle:(__bridge CTParagraphStyleRef)(style)];\n        }\n    }\n    return style;\n}\n\n#define ParagraphAttribute(_attr_) \\\nNSParagraphStyle *style = self.yy_paragraphStyle; \\\nif (!style) style = [NSParagraphStyle defaultParagraphStyle]; \\\nreturn style. _attr_;\n\n#define ParagraphAttributeAtIndex(_attr_) \\\nNSParagraphStyle *style = [self yy_paragraphStyleAtIndex:index]; \\\nif (!style) style = [NSParagraphStyle defaultParagraphStyle]; \\\nreturn style. _attr_;\n\n- (NSTextAlignment)yy_alignment {\n    ParagraphAttribute(alignment);\n}\n\n- (NSLineBreakMode)yy_lineBreakMode {\n    ParagraphAttribute(lineBreakMode);\n}\n\n- (CGFloat)yy_lineSpacing {\n    ParagraphAttribute(lineSpacing);\n}\n\n- (CGFloat)yy_paragraphSpacing {\n    ParagraphAttribute(paragraphSpacing);\n}\n\n- (CGFloat)yy_paragraphSpacingBefore {\n    ParagraphAttribute(paragraphSpacingBefore);\n}\n\n- (CGFloat)yy_firstLineHeadIndent {\n    ParagraphAttribute(firstLineHeadIndent);\n}\n\n- (CGFloat)yy_headIndent {\n    ParagraphAttribute(headIndent);\n}\n\n- (CGFloat)yy_tailIndent {\n    ParagraphAttribute(tailIndent);\n}\n\n- (CGFloat)yy_minimumLineHeight {\n    ParagraphAttribute(minimumLineHeight);\n}\n\n- (CGFloat)yy_maximumLineHeight {\n    ParagraphAttribute(maximumLineHeight);\n}\n\n- (CGFloat)yy_lineHeightMultiple {\n    ParagraphAttribute(lineHeightMultiple);\n}\n\n- (NSWritingDirection)yy_baseWritingDirection {\n    ParagraphAttribute(baseWritingDirection);\n}\n\n- (float)yy_hyphenationFactor {\n    ParagraphAttribute(hyphenationFactor);\n}\n\n- (CGFloat)yy_defaultTabInterval {\n    if (!kiOS7Later) return 0;\n    ParagraphAttribute(defaultTabInterval);\n}\n\n- (NSArray *)yy_tabStops {\n    if (!kiOS7Later) return nil;\n    ParagraphAttribute(tabStops);\n}\n\n- (NSTextAlignment)yy_alignmentAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(alignment);\n}\n\n- (NSLineBreakMode)yy_lineBreakModeAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(lineBreakMode);\n}\n\n- (CGFloat)yy_lineSpacingAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(lineSpacing);\n}\n\n- (CGFloat)yy_paragraphSpacingAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(paragraphSpacing);\n}\n\n- (CGFloat)yy_paragraphSpacingBeforeAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(paragraphSpacingBefore);\n}\n\n- (CGFloat)yy_firstLineHeadIndentAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(firstLineHeadIndent);\n}\n\n- (CGFloat)yy_headIndentAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(headIndent);\n}\n\n- (CGFloat)yy_tailIndentAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(tailIndent);\n}\n\n- (CGFloat)yy_minimumLineHeightAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(minimumLineHeight);\n}\n\n- (CGFloat)yy_maximumLineHeightAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(maximumLineHeight);\n}\n\n- (CGFloat)yy_lineHeightMultipleAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(lineHeightMultiple);\n}\n\n- (NSWritingDirection)yy_baseWritingDirectionAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(baseWritingDirection);\n}\n\n- (float)yy_hyphenationFactorAtIndex:(NSUInteger)index {\n    ParagraphAttributeAtIndex(hyphenationFactor);\n}\n\n- (CGFloat)yy_defaultTabIntervalAtIndex:(NSUInteger)index {\n    if (!kiOS7Later) return 0;\n    ParagraphAttributeAtIndex(defaultTabInterval);\n}\n\n- (NSArray *)yy_tabStopsAtIndex:(NSUInteger)index {\n    if (!kiOS7Later) return nil;\n    ParagraphAttributeAtIndex(tabStops);\n}\n\n#undef ParagraphAttribute\n#undef ParagraphAttributeAtIndex\n\n- (YYTextShadow *)yy_textShadow {\n    return [self yy_textShadowAtIndex:0];\n}\n\n- (YYTextShadow *)yy_textShadowAtIndex:(NSUInteger)index {\n    return [self yy_attribute:YYTextShadowAttributeName atIndex:index];\n}\n\n- (YYTextShadow *)yy_textInnerShadow {\n    return [self yy_textInnerShadowAtIndex:0];\n}\n\n- (YYTextShadow *)yy_textInnerShadowAtIndex:(NSUInteger)index {\n    return [self yy_attribute:YYTextInnerShadowAttributeName atIndex:index];\n}\n\n- (YYTextDecoration *)yy_textUnderline {\n    return [self yy_textUnderlineAtIndex:0];\n}\n\n- (YYTextDecoration *)yy_textUnderlineAtIndex:(NSUInteger)index {\n    return [self yy_attribute:YYTextUnderlineAttributeName atIndex:index];\n}\n\n- (YYTextDecoration *)yy_textStrikethrough {\n    return [self yy_textStrikethroughAtIndex:0];\n}\n\n- (YYTextDecoration *)yy_textStrikethroughAtIndex:(NSUInteger)index {\n    return [self yy_attribute:YYTextStrikethroughAttributeName atIndex:index];\n}\n\n- (YYTextBorder *)yy_textBorder {\n    return [self yy_textBorderAtIndex:0];\n}\n\n- (YYTextBorder *)yy_textBorderAtIndex:(NSUInteger)index {\n    return [self yy_attribute:YYTextBorderAttributeName atIndex:index];\n}\n\n- (YYTextBorder *)yy_textBackgroundBorder {\n    return [self yy_textBackgroundBorderAtIndex:0];\n}\n\n- (YYTextBorder *)yy_textBackgroundBorderAtIndex:(NSUInteger)index {\n    return [self yy_attribute:YYTextBackedStringAttributeName atIndex:index];\n}\n\n- (CGAffineTransform)yy_textGlyphTransform {\n    return [self yy_textGlyphTransformAtIndex:0];\n}\n\n- (CGAffineTransform)yy_textGlyphTransformAtIndex:(NSUInteger)index {\n    NSValue *value = [self yy_attribute:YYTextGlyphTransformAttributeName atIndex:index];\n    if (!value) return CGAffineTransformIdentity;\n    return [value CGAffineTransformValue];\n}\n\n- (NSString *)yy_plainTextForRange:(NSRange)range {\n    if (range.location == NSNotFound ||range.length == NSNotFound) return nil;\n    NSMutableString *result = [NSMutableString string];\n    if (range.length == 0) return result;\n    NSString *string = self.string;\n    [self enumerateAttribute:YYTextBackedStringAttributeName inRange:range options:kNilOptions usingBlock:^(id value, NSRange range, BOOL *stop) {\n        YYTextBackedString *backed = value;\n        if (backed && backed.string) {\n            [result appendString:backed.string];\n        } else {\n            [result appendString:[string substringWithRange:range]];\n        }\n    }];\n    return result;\n}\n\n+ (NSMutableAttributedString *)yy_attachmentStringWithContent:(id)content\n                                                  contentMode:(UIViewContentMode)contentMode\n                                                        width:(CGFloat)width\n                                                       ascent:(CGFloat)ascent\n                                                      descent:(CGFloat)descent {\n    NSMutableAttributedString *atr = [[NSMutableAttributedString alloc] initWithString:YYTextAttachmentToken];\n    \n    YYTextAttachment *attach = [YYTextAttachment new];\n    attach.content = content;\n    attach.contentMode = contentMode;\n    [atr yy_setTextAttachment:attach range:NSMakeRange(0, atr.length)];\n    \n    YYTextRunDelegate *delegate = [YYTextRunDelegate new];\n    delegate.width = width;\n    delegate.ascent = ascent;\n    delegate.descent = descent;\n    CTRunDelegateRef delegateRef = delegate.CTRunDelegate;\n    [atr yy_setRunDelegate:delegateRef range:NSMakeRange(0, atr.length)];\n    if (delegate) CFRelease(delegateRef);\n    \n    return atr;\n}\n\n+ (NSMutableAttributedString *)yy_attachmentStringWithContent:(id)content\n                                                  contentMode:(UIViewContentMode)contentMode\n                                               attachmentSize:(CGSize)attachmentSize\n                                                  alignToFont:(UIFont *)font\n                                                    alignment:(YYTextVerticalAlignment)alignment {\n    NSMutableAttributedString *atr = [[NSMutableAttributedString alloc] initWithString:YYTextAttachmentToken];\n    \n    YYTextAttachment *attach = [YYTextAttachment new];\n    attach.content = content;\n    attach.contentMode = contentMode;\n    [atr yy_setTextAttachment:attach range:NSMakeRange(0, atr.length)];\n    \n    YYTextRunDelegate *delegate = [YYTextRunDelegate new];\n    delegate.width = attachmentSize.width;\n    switch (alignment) {\n        case YYTextVerticalAlignmentTop: {\n            delegate.ascent = font.ascender;\n            delegate.descent = attachmentSize.height - font.ascender;\n            if (delegate.descent < 0) {\n                delegate.descent = 0;\n                delegate.ascent = attachmentSize.height;\n            }\n        } break;\n        case YYTextVerticalAlignmentCenter: {\n            CGFloat fontHeight = font.ascender - font.descender;\n            CGFloat yOffset = font.ascender - fontHeight * 0.5;\n            delegate.ascent = attachmentSize.height * 0.5 + yOffset;\n            delegate.descent = attachmentSize.height - delegate.ascent;\n            if (delegate.descent < 0) {\n                delegate.descent = 0;\n                delegate.ascent = attachmentSize.height;\n            }\n        } break;\n        case YYTextVerticalAlignmentBottom: {\n            delegate.ascent = attachmentSize.height + font.descender;\n            delegate.descent = -font.descender;\n            if (delegate.ascent < 0) {\n                delegate.ascent = 0;\n                delegate.descent = attachmentSize.height;\n            }\n        } break;\n        default: {\n            delegate.ascent = attachmentSize.height;\n            delegate.descent = 0;\n        } break;\n    }\n    \n    CTRunDelegateRef delegateRef = delegate.CTRunDelegate;\n    [atr yy_setRunDelegate:delegateRef range:NSMakeRange(0, atr.length)];\n    if (delegate) CFRelease(delegateRef);\n    \n    return atr;\n}\n\n+ (NSMutableAttributedString *)yy_attachmentStringWithEmojiImage:(UIImage *)image\n                                                        fontSize:(CGFloat)fontSize {\n    if (!image || fontSize <= 0) return nil;\n    \n    BOOL hasAnim = NO;\n    if (image.images.count > 1) {\n        hasAnim = YES;\n    } else if (NSProtocolFromString(@\"YYAnimatedImage\") &&\n               [image conformsToProtocol:NSProtocolFromString(@\"YYAnimatedImage\")]) {\n        NSNumber *frameCount = [image valueForKey:@\"animatedImageFrameCount\"];\n        if (frameCount.intValue > 1) hasAnim = YES;\n    }\n    \n    CGFloat ascent = YYTextEmojiGetAscentWithFontSize(fontSize);\n    CGFloat descent = YYTextEmojiGetDescentWithFontSize(fontSize);\n    CGRect bounding = YYTextEmojiGetGlyphBoundingRectWithFontSize(fontSize);\n    \n    YYTextRunDelegate *delegate = [YYTextRunDelegate new];\n    delegate.ascent = ascent;\n    delegate.descent = descent;\n    delegate.width = bounding.size.width + 2 * bounding.origin.x;\n    \n    YYTextAttachment *attachment = [YYTextAttachment new];\n    attachment.contentMode = UIViewContentModeScaleAspectFit;\n    attachment.contentInsets = UIEdgeInsetsMake(ascent - (bounding.size.height + bounding.origin.y), bounding.origin.x, descent + bounding.origin.y, bounding.origin.x);\n    if (hasAnim) {\n        Class imageClass = NSClassFromString(@\"YYAnimatedImageView\");\n        if (!imageClass) imageClass = [UIImageView class];\n        UIImageView *view = (id)[imageClass new];\n        view.frame = bounding;\n        view.image = image;\n        view.contentMode = UIViewContentModeScaleAspectFit;\n        attachment.content = view;\n    } else {\n        attachment.content = image;\n    }\n    \n    NSMutableAttributedString *atr = [[NSMutableAttributedString alloc] initWithString:YYTextAttachmentToken];\n    [atr yy_setTextAttachment:attachment range:NSMakeRange(0, atr.length)];\n    CTRunDelegateRef ctDelegate = delegate.CTRunDelegate;\n    [atr yy_setRunDelegate:ctDelegate range:NSMakeRange(0, atr.length)];\n    if (ctDelegate) CFRelease(ctDelegate);\n    \n    return atr;\n}\n\n- (NSRange)yy_rangeOfAll {\n    return NSMakeRange(0, self.length);\n}\n\n- (BOOL)yy_isSharedAttributesInAllRange {\n    __block BOOL shared = YES;\n    __block NSDictionary *firstAttrs = nil;\n    [self enumerateAttributesInRange:self.yy_rangeOfAll options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) {\n        if (range.location == 0) {\n            firstAttrs = attrs;\n        } else {\n            if (firstAttrs.count != attrs.count) {\n                shared = NO;\n                *stop = YES;\n            } else if (firstAttrs) {\n                if (![firstAttrs isEqualToDictionary:attrs]) {\n                    shared = NO;\n                    *stop = YES;\n                }\n            }\n        }\n    }];\n    return shared;\n}\n\n- (BOOL)yy_canDrawWithUIKit {\n    static NSMutableSet *failSet;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        failSet = [NSMutableSet new];\n        [failSet addObject:(id)kCTGlyphInfoAttributeName];\n        [failSet addObject:(id)kCTCharacterShapeAttributeName];\n        if (kiOS7Later) {\n            [failSet addObject:(id)kCTLanguageAttributeName];\n        }\n        [failSet addObject:(id)kCTRunDelegateAttributeName];\n        [failSet addObject:(id)kCTBaselineClassAttributeName];\n        [failSet addObject:(id)kCTBaselineInfoAttributeName];\n        [failSet addObject:(id)kCTBaselineReferenceInfoAttributeName];\n        if (kiOS8Later) {\n            [failSet addObject:(id)kCTRubyAnnotationAttributeName];\n        }\n        [failSet addObject:YYTextShadowAttributeName];\n        [failSet addObject:YYTextInnerShadowAttributeName];\n        [failSet addObject:YYTextUnderlineAttributeName];\n        [failSet addObject:YYTextStrikethroughAttributeName];\n        [failSet addObject:YYTextBorderAttributeName];\n        [failSet addObject:YYTextBackgroundBorderAttributeName];\n        [failSet addObject:YYTextBlockBorderAttributeName];\n        [failSet addObject:YYTextAttachmentAttributeName];\n        [failSet addObject:YYTextHighlightAttributeName];\n        [failSet addObject:YYTextGlyphTransformAttributeName];\n    });\n    \n#define Fail { result = NO; *stop = YES; return; }\n    __block BOOL result = YES;\n    [self enumerateAttributesInRange:self.yy_rangeOfAll options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) {\n        if (attrs.count == 0) return;\n        for (NSString *str in attrs.allKeys) {\n            if ([failSet containsObject:str]) Fail;\n        }\n        if (!kiOS7Later) {\n            UIFont *font = attrs[NSFontAttributeName];\n            if (CFGetTypeID((__bridge CFTypeRef)(font)) == CTFontGetTypeID()) Fail;\n        }\n        if (attrs[(id)kCTForegroundColorAttributeName] && !attrs[NSForegroundColorAttributeName]) Fail;\n        if (attrs[(id)kCTStrokeColorAttributeName] && !attrs[NSStrokeColorAttributeName]) Fail;\n        if (attrs[(id)kCTUnderlineColorAttributeName]) {\n            if (!kiOS7Later) Fail;\n            if (!attrs[NSUnderlineColorAttributeName]) Fail;\n        }\n        NSParagraphStyle *style = attrs[NSParagraphStyleAttributeName];\n        if (style && CFGetTypeID((__bridge CFTypeRef)(style)) == CTParagraphStyleGetTypeID()) Fail;\n    }];\n    return result;\n#undef Fail\n}\n\n@end\n\n@implementation NSMutableAttributedString (YYText)\n\n- (void)yy_setAttributes:(NSDictionary *)attributes {\n    [self setYy_attributes:attributes];\n}\n\n- (void)setYy_attributes:(NSDictionary *)attributes {\n    if (attributes == (id)[NSNull null]) attributes = nil;\n    [self setAttributes:@{} range:NSMakeRange(0, self.length)];\n    [attributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {\n        [self yy_setAttribute:key value:obj];\n    }];\n}\n\n- (void)yy_setAttribute:(NSString *)name value:(id)value {\n    [self yy_setAttribute:name value:value range:NSMakeRange(0, self.length)];\n}\n\n- (void)yy_setAttribute:(NSString *)name value:(id)value range:(NSRange)range {\n    if (!name || [NSNull isEqual:name]) return;\n    if (value && ![NSNull isEqual:value]) [self addAttribute:name value:value range:range];\n    else [self removeAttribute:name range:range];\n}\n\n- (void)yy_removeAttributesInRange:(NSRange)range {\n    [self setAttributes:nil range:range];\n}\n\n#pragma mark - Property Setter\n\n- (void)setYy_font:(UIFont *)font {\n    /*\n     In iOS7 and later, UIFont is toll-free bridged to CTFontRef,\n     although Apple does not mention it in documentation.\n     \n     In iOS6, UIFont is a wrapper for CTFontRef, so CoreText can alse use UIfont,\n     but UILabel/UITextView cannot use CTFontRef.\n     \n     We use UIFont for both CoreText and UIKit.\n     */\n    [self yy_setFont:font range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_kern:(NSNumber *)kern {\n    [self yy_setKern:kern range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_color:(UIColor *)color {\n    [self yy_setColor:color range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_backgroundColor:(UIColor *)backgroundColor {\n    [self yy_setBackgroundColor:backgroundColor range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_strokeWidth:(NSNumber *)strokeWidth {\n    [self yy_setStrokeWidth:strokeWidth range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_strokeColor:(UIColor *)strokeColor {\n    [self yy_setStrokeColor:strokeColor range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_shadow:(NSShadow *)shadow {\n    [self yy_setShadow:shadow range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_strikethroughStyle:(NSUnderlineStyle)strikethroughStyle {\n    [self yy_setStrikethroughStyle:strikethroughStyle range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_strikethroughColor:(UIColor *)strikethroughColor {\n    [self yy_setStrikethroughColor:strikethroughColor range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_underlineStyle:(NSUnderlineStyle)underlineStyle {\n    [self yy_setUnderlineStyle:underlineStyle range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_underlineColor:(UIColor *)underlineColor {\n    [self yy_setUnderlineColor:underlineColor range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_ligature:(NSNumber *)ligature {\n    [self yy_setLigature:ligature range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textEffect:(NSString *)textEffect {\n    [self yy_setTextEffect:textEffect range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_obliqueness:(NSNumber *)obliqueness {\n    [self yy_setObliqueness:obliqueness range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_expansion:(NSNumber *)expansion {\n    [self yy_setExpansion:expansion range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_baselineOffset:(NSNumber *)baselineOffset {\n    [self yy_setBaselineOffset:baselineOffset range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_verticalGlyphForm:(BOOL)verticalGlyphForm {\n    [self yy_setVerticalGlyphForm:verticalGlyphForm range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_language:(NSString *)language {\n    [self yy_setLanguage:language range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_writingDirection:(NSArray *)writingDirection {\n    [self yy_setWritingDirection:writingDirection range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_paragraphStyle:(NSParagraphStyle *)paragraphStyle {\n    /*\n     NSParagraphStyle is NOT toll-free bridged to CTParagraphStyleRef.\n     \n     CoreText can use both NSParagraphStyle and CTParagraphStyleRef,\n     but UILabel/UITextView can only use NSParagraphStyle.\n     \n     We use NSParagraphStyle in both CoreText and UIKit.\n     */\n    [self yy_setParagraphStyle:paragraphStyle range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_alignment:(NSTextAlignment)alignment {\n    [self yy_setAlignment:alignment range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_baseWritingDirection:(NSWritingDirection)baseWritingDirection {\n    [self yy_setBaseWritingDirection:baseWritingDirection range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_lineSpacing:(CGFloat)lineSpacing {\n    [self yy_setLineSpacing:lineSpacing range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_paragraphSpacing:(CGFloat)paragraphSpacing {\n    [self yy_setParagraphSpacing:paragraphSpacing range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_paragraphSpacingBefore:(CGFloat)paragraphSpacingBefore {\n    [self yy_setParagraphSpacing:paragraphSpacingBefore range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_firstLineHeadIndent:(CGFloat)firstLineHeadIndent {\n    [self yy_setFirstLineHeadIndent:firstLineHeadIndent range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_headIndent:(CGFloat)headIndent {\n    [self yy_setHeadIndent:headIndent range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_tailIndent:(CGFloat)tailIndent {\n    [self yy_setTailIndent:tailIndent range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_lineBreakMode:(NSLineBreakMode)lineBreakMode {\n    [self yy_setLineBreakMode:lineBreakMode range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_minimumLineHeight:(CGFloat)minimumLineHeight {\n    [self yy_setMinimumLineHeight:minimumLineHeight range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_maximumLineHeight:(CGFloat)maximumLineHeight {\n    [self yy_setMaximumLineHeight:maximumLineHeight range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_lineHeightMultiple:(CGFloat)lineHeightMultiple {\n    [self yy_setLineHeightMultiple:lineHeightMultiple range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_hyphenationFactor:(float)hyphenationFactor {\n    [self yy_setHyphenationFactor:hyphenationFactor range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_defaultTabInterval:(CGFloat)defaultTabInterval {\n    [self yy_setDefaultTabInterval:defaultTabInterval range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_tabStops:(NSArray *)tabStops {\n    [self yy_setTabStops:tabStops range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textShadow:(YYTextShadow *)textShadow {\n    [self yy_setTextShadow:textShadow range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textInnerShadow:(YYTextShadow *)textInnerShadow {\n    [self yy_setTextInnerShadow:textInnerShadow range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textUnderline:(YYTextDecoration *)textUnderline {\n    [self yy_setTextUnderline:textUnderline range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textStrikethrough:(YYTextDecoration *)textStrikethrough {\n    [self yy_setTextStrikethrough:textStrikethrough range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textBorder:(YYTextBorder *)textBorder {\n    [self yy_setTextBorder:textBorder range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textBackgroundBorder:(YYTextBorder *)textBackgroundBorder {\n    [self yy_setTextBackgroundBorder:textBackgroundBorder range:NSMakeRange(0, self.length)];\n}\n\n- (void)setYy_textGlyphTransform:(CGAffineTransform)textGlyphTransform {\n    [self yy_setTextGlyphTransform:textGlyphTransform range:NSMakeRange(0, self.length)];\n}\n\n#pragma mark - Range Setter\n\n- (void)yy_setFont:(UIFont *)font range:(NSRange)range {\n    /*\n     In iOS7 and later, UIFont is toll-free bridged to CTFontRef,\n     although Apple does not mention it in documentation.\n     \n     In iOS6, UIFont is a wrapper for CTFontRef, so CoreText can alse use UIfont,\n     but UILabel/UITextView cannot use CTFontRef.\n     \n     We use UIFont for both CoreText and UIKit.\n     */\n    [self yy_setAttribute:NSFontAttributeName value:font range:range];\n}\n\n- (void)yy_setKern:(NSNumber *)kern range:(NSRange)range {\n    [self yy_setAttribute:NSKernAttributeName value:kern range:range];\n}\n\n- (void)yy_setColor:(UIColor *)color range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTForegroundColorAttributeName value:(id)color.CGColor range:range];\n    [self yy_setAttribute:NSForegroundColorAttributeName value:color range:range];\n}\n\n- (void)yy_setBackgroundColor:(UIColor *)backgroundColor range:(NSRange)range {\n    [self yy_setAttribute:NSBackgroundColorAttributeName value:backgroundColor range:range];\n}\n\n- (void)yy_setStrokeWidth:(NSNumber *)strokeWidth range:(NSRange)range {\n    [self yy_setAttribute:NSStrokeWidthAttributeName value:strokeWidth range:range];\n}\n\n- (void)yy_setStrokeColor:(UIColor *)strokeColor range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTStrokeColorAttributeName value:(id)strokeColor.CGColor range:range];\n    [self yy_setAttribute:NSStrokeColorAttributeName value:strokeColor range:range];\n}\n\n- (void)yy_setShadow:(NSShadow *)shadow range:(NSRange)range {\n    [self yy_setAttribute:NSShadowAttributeName value:shadow range:range];\n}\n\n- (void)yy_setStrikethroughStyle:(NSUnderlineStyle)strikethroughStyle range:(NSRange)range {\n    NSNumber *style = strikethroughStyle == 0 ? nil : @(strikethroughStyle);\n    [self yy_setAttribute:NSStrikethroughStyleAttributeName value:style range:range];\n}\n\n- (void)yy_setStrikethroughColor:(UIColor *)strikethroughColor range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSStrikethroughColorAttributeName value:strikethroughColor range:range];\n    }\n}\n\n- (void)yy_setUnderlineStyle:(NSUnderlineStyle)underlineStyle range:(NSRange)range {\n    NSNumber *style = underlineStyle == 0 ? nil : @(underlineStyle);\n    [self yy_setAttribute:NSUnderlineStyleAttributeName value:style range:range];\n}\n\n- (void)yy_setUnderlineColor:(UIColor *)underlineColor range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTUnderlineColorAttributeName value:(id)underlineColor.CGColor range:range];\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSUnderlineColorAttributeName value:underlineColor range:range];\n    }\n}\n\n- (void)yy_setLigature:(NSNumber *)ligature range:(NSRange)range {\n    [self yy_setAttribute:NSLigatureAttributeName value:ligature range:range];\n}\n\n- (void)yy_setTextEffect:(NSString *)textEffect range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSTextEffectAttributeName value:textEffect range:range];\n    }\n}\n\n- (void)yy_setObliqueness:(NSNumber *)obliqueness range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSObliquenessAttributeName value:obliqueness range:range];\n    }\n}\n\n- (void)yy_setExpansion:(NSNumber *)expansion range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSExpansionAttributeName value:expansion range:range];\n    }\n}\n\n- (void)yy_setBaselineOffset:(NSNumber *)baselineOffset range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSBaselineOffsetAttributeName value:baselineOffset range:range];\n    }\n}\n\n- (void)yy_setVerticalGlyphForm:(BOOL)verticalGlyphForm range:(NSRange)range {\n    NSNumber *v = verticalGlyphForm ? @(YES) : nil;\n    [self yy_setAttribute:NSVerticalGlyphFormAttributeName value:v range:range];\n}\n\n- (void)yy_setLanguage:(NSString *)language range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:(id)kCTLanguageAttributeName value:language range:range];\n    }\n}\n\n- (void)yy_setWritingDirection:(NSArray *)writingDirection range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTWritingDirectionAttributeName value:writingDirection range:range];\n}\n\n- (void)yy_setParagraphStyle:(NSParagraphStyle *)paragraphStyle range:(NSRange)range {\n    /*\n     NSParagraphStyle is NOT toll-free bridged to CTParagraphStyleRef.\n     \n     CoreText can use both NSParagraphStyle and CTParagraphStyleRef,\n     but UILabel/UITextView can only use NSParagraphStyle.\n     \n     We use NSParagraphStyle in both CoreText and UIKit.\n     */\n    [self yy_setAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];\n}\n\n#define ParagraphStyleSet(_attr_) \\\n[self enumerateAttribute:NSParagraphStyleAttributeName \\\n                 inRange:range \\\n                 options:kNilOptions \\\n              usingBlock: ^(NSParagraphStyle *value, NSRange subRange, BOOL *stop) { \\\n                  NSMutableParagraphStyle *style = nil; \\\n                  if (value) { \\\n                      if (CFGetTypeID((__bridge CFTypeRef)(value)) == CTParagraphStyleGetTypeID()) { \\\n                          value = [NSParagraphStyle yy_styleWithCTStyle:(__bridge CTParagraphStyleRef)(value)]; \\\n                      } \\\n                      if (value. _attr_ == _attr_) return; \\\n                      if ([value isKindOfClass:[NSMutableParagraphStyle class]]) { \\\n                          style = (id)value; \\\n                      } else { \\\n                          style = value.mutableCopy; \\\n                      } \\\n                  } else { \\\n                      if ([NSParagraphStyle defaultParagraphStyle]. _attr_ == _attr_) return; \\\n                      style = [NSParagraphStyle defaultParagraphStyle].mutableCopy; \\\n                  } \\\n                  style. _attr_ = _attr_; \\\n                  [self yy_setParagraphStyle:style range:subRange]; \\\n              }];\n\n- (void)yy_setAlignment:(NSTextAlignment)alignment range:(NSRange)range {\n    ParagraphStyleSet(alignment);\n}\n\n- (void)yy_setBaseWritingDirection:(NSWritingDirection)baseWritingDirection range:(NSRange)range {\n    ParagraphStyleSet(baseWritingDirection);\n}\n\n- (void)yy_setLineSpacing:(CGFloat)lineSpacing range:(NSRange)range {\n    ParagraphStyleSet(lineSpacing);\n}\n\n- (void)yy_setParagraphSpacing:(CGFloat)paragraphSpacing range:(NSRange)range {\n    ParagraphStyleSet(paragraphSpacing);\n}\n\n- (void)yy_setParagraphSpacingBefore:(CGFloat)paragraphSpacingBefore range:(NSRange)range {\n    ParagraphStyleSet(paragraphSpacingBefore);\n}\n\n- (void)yy_setFirstLineHeadIndent:(CGFloat)firstLineHeadIndent range:(NSRange)range {\n    ParagraphStyleSet(firstLineHeadIndent);\n}\n\n- (void)yy_setHeadIndent:(CGFloat)headIndent range:(NSRange)range {\n    ParagraphStyleSet(headIndent);\n}\n\n- (void)yy_setTailIndent:(CGFloat)tailIndent range:(NSRange)range {\n    ParagraphStyleSet(tailIndent);\n}\n\n- (void)yy_setLineBreakMode:(NSLineBreakMode)lineBreakMode range:(NSRange)range {\n    ParagraphStyleSet(lineBreakMode);\n}\n\n- (void)yy_setMinimumLineHeight:(CGFloat)minimumLineHeight range:(NSRange)range {\n    ParagraphStyleSet(minimumLineHeight);\n}\n\n- (void)yy_setMaximumLineHeight:(CGFloat)maximumLineHeight range:(NSRange)range {\n    ParagraphStyleSet(maximumLineHeight);\n}\n\n- (void)yy_setLineHeightMultiple:(CGFloat)lineHeightMultiple range:(NSRange)range {\n    ParagraphStyleSet(lineHeightMultiple);\n}\n\n- (void)yy_setHyphenationFactor:(float)hyphenationFactor range:(NSRange)range {\n    ParagraphStyleSet(hyphenationFactor);\n}\n\n- (void)yy_setDefaultTabInterval:(CGFloat)defaultTabInterval range:(NSRange)range {\n    if (!kiOS7Later) return;\n    ParagraphStyleSet(defaultTabInterval);\n}\n\n- (void)yy_setTabStops:(NSArray *)tabStops range:(NSRange)range {\n    if (!kiOS7Later) return;\n    ParagraphStyleSet(tabStops);\n}\n\n#undef ParagraphStyleSet\n\n- (void)yy_setSuperscript:(NSNumber *)superscript range:(NSRange)range {\n    if ([superscript isEqualToNumber:@(0)]) {\n        superscript = nil;\n    }\n    [self yy_setAttribute:(id)kCTSuperscriptAttributeName value:superscript range:range];\n}\n\n- (void)yy_setGlyphInfo:(CTGlyphInfoRef)glyphInfo range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTGlyphInfoAttributeName value:(__bridge id)glyphInfo range:range];\n}\n\n- (void)yy_setCharacterShape:(NSNumber *)characterShape range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTCharacterShapeAttributeName value:characterShape range:range];\n}\n\n- (void)yy_setRunDelegate:(CTRunDelegateRef)runDelegate range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTRunDelegateAttributeName value:(__bridge id)runDelegate range:range];\n}\n\n- (void)yy_setBaselineClass:(CFStringRef)baselineClass range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTBaselineClassAttributeName value:(__bridge id)baselineClass range:range];\n}\n\n- (void)yy_setBaselineInfo:(CFDictionaryRef)baselineInfo range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTBaselineInfoAttributeName value:(__bridge id)baselineInfo range:range];\n}\n\n- (void)yy_setBaselineReferenceInfo:(CFDictionaryRef)referenceInfo range:(NSRange)range {\n    [self yy_setAttribute:(id)kCTBaselineReferenceInfoAttributeName value:(__bridge id)referenceInfo range:range];\n}\n\n- (void)yy_setRubyAnnotation:(CTRubyAnnotationRef)ruby range:(NSRange)range {\n    if (kSystemVersion >= 8) {\n        [self yy_setAttribute:(id)kCTRubyAnnotationAttributeName value:(__bridge id)ruby range:range];\n    }\n}\n\n- (void)yy_setAttachment:(NSTextAttachment *)attachment range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSAttachmentAttributeName value:attachment range:range];\n    }\n}\n\n- (void)yy_setLink:(id)link range:(NSRange)range {\n    if (kSystemVersion >= 7) {\n        [self yy_setAttribute:NSLinkAttributeName value:link range:range];\n    }\n}\n\n- (void)yy_setTextBackedString:(YYTextBackedString *)textBackedString range:(NSRange)range {\n    [self yy_setAttribute:YYTextBackedStringAttributeName value:textBackedString range:range];\n}\n\n- (void)yy_setTextBinding:(YYTextBinding *)textBinding range:(NSRange)range {\n    [self yy_setAttribute:YYTextBindingAttributeName value:textBinding range:range];\n}\n\n- (void)yy_setTextShadow:(YYTextShadow *)textShadow range:(NSRange)range {\n    [self yy_setAttribute:YYTextShadowAttributeName value:textShadow range:range];\n}\n\n- (void)yy_setTextInnerShadow:(YYTextShadow *)textInnerShadow range:(NSRange)range {\n    [self yy_setAttribute:YYTextInnerShadowAttributeName value:textInnerShadow range:range];\n}\n\n- (void)yy_setTextUnderline:(YYTextDecoration *)textUnderline range:(NSRange)range {\n    [self yy_setAttribute:YYTextUnderlineAttributeName value:textUnderline range:range];\n}\n\n- (void)yy_setTextStrikethrough:(YYTextDecoration *)textStrikethrough range:(NSRange)range {\n    [self yy_setAttribute:YYTextStrikethroughAttributeName value:textStrikethrough range:range];\n}\n\n- (void)yy_setTextBorder:(YYTextBorder *)textBorder range:(NSRange)range {\n    [self yy_setAttribute:YYTextBorderAttributeName value:textBorder range:range];\n}\n\n- (void)yy_setTextBackgroundBorder:(YYTextBorder *)textBackgroundBorder range:(NSRange)range {\n    [self yy_setAttribute:YYTextBackgroundBorderAttributeName value:textBackgroundBorder range:range];\n}\n\n- (void)yy_setTextAttachment:(YYTextAttachment *)textAttachment range:(NSRange)range {\n    [self yy_setAttribute:YYTextAttachmentAttributeName value:textAttachment range:range];\n}\n\n- (void)yy_setTextHighlight:(YYTextHighlight *)textHighlight range:(NSRange)range {\n    [self yy_setAttribute:YYTextHighlightAttributeName value:textHighlight range:range];\n}\n\n- (void)yy_setTextBlockBorder:(YYTextBorder *)textBlockBorder range:(NSRange)range {\n    [self yy_setAttribute:YYTextBlockBorderAttributeName value:textBlockBorder range:range];\n}\n\n- (void)yy_setTextRubyAnnotation:(YYTextRubyAnnotation *)ruby range:(NSRange)range {\n    if (kiOS8Later) {\n        CTRubyAnnotationRef rubyRef = [ruby CTRubyAnnotation];\n        [self yy_setRubyAnnotation:rubyRef range:range];\n        if (rubyRef) CFRelease(rubyRef);\n    }\n}\n\n- (void)yy_setTextGlyphTransform:(CGAffineTransform)textGlyphTransform range:(NSRange)range {\n    NSValue *value = CGAffineTransformIsIdentity(textGlyphTransform) ? nil : [NSValue valueWithCGAffineTransform:textGlyphTransform];\n    [self yy_setAttribute:YYTextGlyphTransformAttributeName value:value range:range];\n}\n\n- (void)yy_setTextHighlightRange:(NSRange)range\n                           color:(UIColor *)color\n                 backgroundColor:(UIColor *)backgroundColor\n                        userInfo:(NSDictionary *)userInfo\n                       tapAction:(YYTextAction)tapAction\n                 longPressAction:(YYTextAction)longPressAction {\n    YYTextHighlight *highlight = [YYTextHighlight highlightWithBackgroundColor:backgroundColor];\n    highlight.userInfo = userInfo;\n    highlight.tapAction = tapAction;\n    highlight.longPressAction = longPressAction;\n    if (color) [self yy_setColor:color range:range];\n    [self yy_setTextHighlight:highlight range:range];\n}\n\n- (void)yy_setTextHighlightRange:(NSRange)range\n                           color:(UIColor *)color\n                 backgroundColor:(UIColor *)backgroundColor\n                       tapAction:(YYTextAction)tapAction {\n    [self yy_setTextHighlightRange:range\n                         color:color\n               backgroundColor:backgroundColor\n                      userInfo:nil\n                     tapAction:tapAction\n               longPressAction:nil];\n}\n\n- (void)yy_setTextHighlightRange:(NSRange)range\n                           color:(UIColor *)color\n                 backgroundColor:(UIColor *)backgroundColor\n                        userInfo:(NSDictionary *)userInfo {\n    [self yy_setTextHighlightRange:range\n                         color:color\n               backgroundColor:backgroundColor\n                      userInfo:userInfo\n                     tapAction:nil\n               longPressAction:nil];\n}\n\n- (void)yy_insertString:(NSString *)string atIndex:(NSUInteger)location {\n    [self replaceCharactersInRange:NSMakeRange(location, 0) withString:string];\n    [self yy_removeDiscontinuousAttributesInRange:NSMakeRange(location, string.length)];\n}\n\n- (void)yy_appendString:(NSString *)string {\n    NSUInteger length = self.length;\n    [self replaceCharactersInRange:NSMakeRange(length, 0) withString:string];\n    [self yy_removeDiscontinuousAttributesInRange:NSMakeRange(length, string.length)];\n}\n\n- (void)yy_setClearColorToJoinedEmoji {\n    NSString *str = self.string;\n    if (str.length < 8) return;\n    \n    // Most string do not contains the joined-emoji, test the joiner first.\n    BOOL containsJoiner = NO;\n    {\n        CFStringRef cfStr = (__bridge CFStringRef)str;\n        BOOL needFree = NO;\n        UniChar *chars = NULL;\n        chars = (void *)CFStringGetCharactersPtr(cfStr);\n        if (!chars) {\n            chars = malloc(str.length * sizeof(UniChar));\n            if (chars) {\n                needFree = YES;\n                CFStringGetCharacters(cfStr, CFRangeMake(0, str.length), chars);\n            }\n        }\n        if (!chars) { // fail to get unichar..\n            containsJoiner = YES;\n        } else {\n            for (int i = 0, max = (int)str.length; i < max; i++) {\n                if (chars[i] == 0x200D) { // 'ZERO WIDTH JOINER' (U+200D)\n                    containsJoiner = YES;\n                    break;\n                }\n            }\n            if (needFree) free(chars);\n        }\n    }\n    if (!containsJoiner) return;\n    \n    // NSRegularExpression is designed to be immutable and thread safe.\n    static NSRegularExpression *regex;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        regex = [NSRegularExpression regularExpressionWithPattern:@\"((👨‍👩‍👧‍👦|👨‍👩‍👦‍👦|👨‍👩‍👧‍👧|👩‍👩‍👧‍👦|👩‍👩‍👦‍👦|👩‍👩‍👧‍👧|👨‍👨‍👧‍👦|👨‍👨‍👦‍👦|👨‍👨‍👧‍👧)+|(👨‍👩‍👧|👩‍👩‍👦|👩‍👩‍👧|👨‍👨‍👦|👨‍👨‍👧))\" options:kNilOptions error:nil];\n    });\n    \n    UIColor *clear = [UIColor clearColor];\n    [regex enumerateMatchesInString:str options:kNilOptions range:NSMakeRange(0, str.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        [self yy_setColor:clear range:result.range];\n    }];\n}\n\n- (void)yy_removeDiscontinuousAttributesInRange:(NSRange)range {\n    NSArray *keys = [NSMutableAttributedString yy_allDiscontinuousAttributeKeys];\n    for (NSString *key in keys) {\n        [self removeAttribute:key range:range];\n    }\n}\n\n+ (NSArray *)yy_allDiscontinuousAttributeKeys {\n    static NSMutableArray *keys;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        keys = @[(id)kCTSuperscriptAttributeName,\n                 (id)kCTRunDelegateAttributeName,\n                 YYTextBackedStringAttributeName,\n                 YYTextBindingAttributeName,\n                 YYTextAttachmentAttributeName].mutableCopy;\n        if (kiOS8Later) {\n            [keys addObject:(id)kCTRubyAnnotationAttributeName];\n        }\n        if (kiOS7Later) {\n            [keys addObject:NSAttachmentAttributeName];\n        }\n    });\n    return keys;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/NSParagraphStyle+YYText.h",
    "content": "//\n//  NSParagraphStyle+YYText.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/7.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Provides extensions for `NSParagraphStyle` to work with CoreText.\n */\n@interface NSParagraphStyle (YYText)\n\n/**\n Creates a new NSParagraphStyle object from the CoreText Style.\n \n @param CTStyle CoreText Paragraph Style.\n \n @return a new NSParagraphStyle\n */\n+ (nullable NSParagraphStyle *)yy_styleWithCTStyle:(CTParagraphStyleRef)CTStyle;\n\n/**\n Creates and returns a CoreText Paragraph Style. (need call CFRelease() after used)\n */\n- (nullable CTParagraphStyleRef)yy_CTStyle CF_RETURNS_RETAINED;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/NSParagraphStyle+YYText.m",
    "content": "//\n//  NSParagraphStyle+YYText.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/7.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"NSParagraphStyle+YYText.h\"\n#import \"YYTextAttribute.h\"\n#import <CoreText/CoreText.h>\n\n// Dummy class for category\n@interface NSParagraphStyle_YYText : NSObject @end\n@implementation NSParagraphStyle_YYText @end\n\n\n@implementation NSParagraphStyle (YYText)\n\n+ (NSParagraphStyle *)yy_styleWithCTStyle:(CTParagraphStyleRef)CTStyle {\n    if (CTStyle == NULL) return nil;\n    \n    NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];\n    \n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n    CGFloat lineSpacing;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineSpacing, sizeof(CGFloat), &lineSpacing)) {\n        style.lineSpacing = lineSpacing;\n    }\n#pragma clang diagnostic pop\n    \n    CGFloat paragraphSpacing;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierParagraphSpacing, sizeof(CGFloat), &paragraphSpacing)) {\n        style.paragraphSpacing = paragraphSpacing;\n    }\n    \n    CTTextAlignment alignment;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierAlignment, sizeof(CTTextAlignment), &alignment)) {\n        style.alignment = NSTextAlignmentFromCTTextAlignment(alignment);\n    }\n    \n    CGFloat firstLineHeadIndent;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierFirstLineHeadIndent, sizeof(CGFloat), &firstLineHeadIndent)) {\n        style.firstLineHeadIndent = firstLineHeadIndent;\n    }\n    \n    CGFloat headIndent;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierHeadIndent, sizeof(CGFloat), &headIndent)) {\n        style.headIndent = headIndent;\n    }\n    \n    CGFloat tailIndent;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierTailIndent, sizeof(CGFloat), &tailIndent)) {\n        style.tailIndent = tailIndent;\n    }\n    \n    CTLineBreakMode lineBreakMode;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineBreakMode, sizeof(CTLineBreakMode), &lineBreakMode)) {\n        style.lineBreakMode = (NSLineBreakMode)lineBreakMode;\n    }\n    \n    CGFloat minimumLineHeight;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierMinimumLineHeight, sizeof(CGFloat), &minimumLineHeight)) {\n        style.minimumLineHeight = minimumLineHeight;\n    }\n    \n    CGFloat maximumLineHeight;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierMaximumLineHeight, sizeof(CGFloat), &maximumLineHeight)) {\n        style.maximumLineHeight = maximumLineHeight;\n    }\n    \n    CTWritingDirection baseWritingDirection;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierBaseWritingDirection, sizeof(CTWritingDirection), &baseWritingDirection)) {\n        style.baseWritingDirection = (NSWritingDirection)baseWritingDirection;\n    }\n    \n    CGFloat lineHeightMultiple;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineHeightMultiple, sizeof(CGFloat), &lineHeightMultiple)) {\n        style.lineHeightMultiple = lineHeightMultiple;\n    }\n    \n    CGFloat paragraphSpacingBefore;\n    if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierParagraphSpacingBefore, sizeof(CGFloat), &paragraphSpacingBefore)) {\n        style.paragraphSpacingBefore = paragraphSpacingBefore;\n    }\n    \n    if ([style respondsToSelector:@selector(tabStops)]) {\n        CFArrayRef tabStops;\n        if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierTabStops, sizeof(CFArrayRef), &tabStops)) {\n            if ([style respondsToSelector:@selector(setTabStops:)]) {\n                NSMutableArray *tabs = [NSMutableArray new];\n                [((__bridge NSArray *)(tabStops))enumerateObjectsUsingBlock : ^(id obj, NSUInteger idx, BOOL *stop) {\n                    CTTextTabRef ctTab = (__bridge CFTypeRef)obj;\n                    \n                    NSTextTab *tab = [[NSTextTab alloc] initWithTextAlignment:NSTextAlignmentFromCTTextAlignment(CTTextTabGetAlignment(ctTab)) location:CTTextTabGetLocation(ctTab) options:(__bridge id)CTTextTabGetOptions(ctTab)];\n                    [tabs addObject:tab];\n                }];\n                if (tabs.count) {\n                    style.tabStops = tabs;\n                }\n            }\n        }\n        \n        CGFloat defaultTabInterval;\n        if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierDefaultTabInterval, sizeof(CGFloat), &defaultTabInterval)) {\n            if ([style respondsToSelector:@selector(setDefaultTabInterval:)]) {\n                style.defaultTabInterval = defaultTabInterval;\n            }\n        }\n    }\n    \n    return style;\n}\n\n- (CTParagraphStyleRef)yy_CTStyle CF_RETURNS_RETAINED {\n    CTParagraphStyleSetting set[kCTParagraphStyleSpecifierCount] = { 0 };\n    int count = 0;\n    \n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n    CGFloat lineSpacing = self.lineSpacing;\n    set[count].spec = kCTParagraphStyleSpecifierLineSpacing;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &lineSpacing;\n    count++;\n#pragma clang diagnostic pop\n    \n    CGFloat paragraphSpacing = self.paragraphSpacing;\n    set[count].spec = kCTParagraphStyleSpecifierParagraphSpacing;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &paragraphSpacing;\n    count++;\n    \n    CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment(self.alignment);\n    set[count].spec = kCTParagraphStyleSpecifierAlignment;\n    set[count].valueSize = sizeof(CTTextAlignment);\n    set[count].value = &alignment;\n    count++;\n    \n    CGFloat firstLineHeadIndent = self.firstLineHeadIndent;\n    set[count].spec = kCTParagraphStyleSpecifierFirstLineHeadIndent;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &firstLineHeadIndent;\n    count++;\n    \n    CGFloat headIndent = self.headIndent;\n    set[count].spec = kCTParagraphStyleSpecifierHeadIndent;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &headIndent;\n    count++;\n    \n    CGFloat tailIndent = self.tailIndent;\n    set[count].spec = kCTParagraphStyleSpecifierTailIndent;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &tailIndent;\n    count++;\n    \n    CTLineBreakMode paraLineBreak = (CTLineBreakMode)self.lineBreakMode;\n    set[count].spec = kCTParagraphStyleSpecifierLineBreakMode;\n    set[count].valueSize = sizeof(CTLineBreakMode);\n    set[count].value = &paraLineBreak;\n    count++;\n    \n    CGFloat minimumLineHeight = self.minimumLineHeight;\n    set[count].spec = kCTParagraphStyleSpecifierMinimumLineHeight;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &minimumLineHeight;\n    count++;\n    \n    CGFloat maximumLineHeight = self.maximumLineHeight;\n    set[count].spec = kCTParagraphStyleSpecifierMaximumLineHeight;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &maximumLineHeight;\n    count++;\n    \n    CTWritingDirection paraWritingDirection = (CTWritingDirection)self.baseWritingDirection;\n    set[count].spec = kCTParagraphStyleSpecifierBaseWritingDirection;\n    set[count].valueSize = sizeof(CTWritingDirection);\n    set[count].value = &paraWritingDirection;\n    count++;\n    \n    CGFloat lineHeightMultiple = self.lineHeightMultiple;\n    set[count].spec = kCTParagraphStyleSpecifierLineHeightMultiple;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &lineHeightMultiple;\n    count++;\n    \n    CGFloat paragraphSpacingBefore = self.paragraphSpacingBefore;\n    set[count].spec = kCTParagraphStyleSpecifierParagraphSpacingBefore;\n    set[count].valueSize = sizeof(CGFloat);\n    set[count].value = &paragraphSpacingBefore;\n    count++;\n    \n    if([self respondsToSelector:@selector(tabStops)]) {\n        NSMutableArray *tabs = [NSMutableArray array];\n        if ([self respondsToSelector:@selector(tabStops)]) {\n            NSInteger numTabs = self.tabStops.count;\n            if (numTabs) {\n                [self.tabStops enumerateObjectsUsingBlock: ^(NSTextTab *tab, NSUInteger idx, BOOL *stop) {\n                    CTTextTabRef ctTab = CTTextTabCreate(NSTextAlignmentToCTTextAlignment(tab.alignment), tab.location, (__bridge CFTypeRef)tab.options);\n                    [tabs addObject:(__bridge id)ctTab];\n                    CFRelease(ctTab);\n                }];\n                \n                CFArrayRef tabStops = (__bridge CFArrayRef)(tabs);\n                set[count].spec = kCTParagraphStyleSpecifierTabStops;\n                set[count].valueSize = sizeof(CFArrayRef);\n                set[count].value = &tabStops;\n                count++;\n            }\n        }\n        \n        if ([self respondsToSelector:@selector(defaultTabInterval)]) {\n            CGFloat defaultTabInterval = self.defaultTabInterval;\n            set[count].spec = kCTParagraphStyleSpecifierDefaultTabInterval;\n            set[count].valueSize = sizeof(CGFloat);\n            set[count].value = &defaultTabInterval;\n            count++;\n        }\n    }\n    \n    CTParagraphStyleRef style = CTParagraphStyleCreate(set, count);\n    return style;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/UIPasteboard+YYText.h",
    "content": "//\n//  UIPasteboard+YYText.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/2.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Extend UIPasteboard to support image and attributed string.\n */\n@interface UIPasteboard (YYText)\n\n@property (nullable, nonatomic, copy) NSData *yy_PNGData;    ///< PNG file data\n@property (nullable, nonatomic, copy) NSData *yy_JPEGData;   ///< JPEG file data\n@property (nullable, nonatomic, copy) NSData *yy_GIFData;    ///< GIF file data\n@property (nullable, nonatomic, copy) NSData *yy_WEBPData;   ///< WebP file data\n@property (nullable, nonatomic, copy) NSData *yy_ImageData;  ///< image file data\n\n/// Attributed string,\n/// Set this attributed will also set the string property which is copy from the attributed string.\n/// If the attributed string contains one or more image, it will also set the `images` property.\n@property (nullable, nonatomic, copy) NSAttributedString *yy_AttributedString;\n\n@end\n\n\n/// The name identifying the attributed string in pasteboard.\nUIKIT_EXTERN NSString *const YYTextPasteboardTypeAttributedString;\n\n/// The UTI Type identifying WebP data in pasteboard.\nUIKIT_EXTERN NSString *const YYTextUTTypeWEBP;\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/UIPasteboard+YYText.m",
    "content": "//\n//  UIPasteboard+YYText.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/2.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"UIPasteboard+YYText.h\"\n#import \"NSAttributedString+YYText.h\"\n#import <MobileCoreServices/MobileCoreServices.h>\n\n\n#if __has_include(\"YYImage.h\")\n#import \"YYImage.h\"\n#define YYTextAnimatedImageAvailable 1\n#elif __has_include(<YYImage/YYImage.h>)\n#import <YYImage/YYImage.h>\n#define YYTextAnimatedImageAvailable 1\n#elif __has_include(<YYWebImage/YYImage.h>)\n#import <YYWebImage/YYImage.h>\n#define YYTextAnimatedImageAvailable 1\n#else\n#define YYTextAnimatedImageAvailable 0\n#endif\n\n\n// Dummy class for category\n@interface UIPasteboard_YYText : NSObject @end\n@implementation UIPasteboard_YYText @end\n\n\nNSString *const YYTextPasteboardTypeAttributedString = @\"com.ibireme.NSAttributedString\";\nNSString *const YYTextUTTypeWEBP = @\"com.google.webp\";\n\n@implementation UIPasteboard (YYText)\n\n\n- (void)setYy_PNGData:(NSData *)PNGData {\n    [self setData:PNGData forPasteboardType:(id)kUTTypePNG];\n}\n\n- (NSData *)yy_PNGData {\n    return [self dataForPasteboardType:(id)kUTTypePNG];\n}\n\n- (void)setYy_JPEGData:(NSData *)JPEGData {\n    [self setData:JPEGData forPasteboardType:(id)kUTTypeJPEG];\n}\n\n- (NSData *)yy_JPEGData {\n    return [self dataForPasteboardType:(id)kUTTypeJPEG];\n}\n\n- (void)setYy_GIFData:(NSData *)GIFData {\n    [self setData:GIFData forPasteboardType:(id)kUTTypeGIF];\n}\n\n- (NSData *)yy_GIFData {\n    return [self dataForPasteboardType:(id)kUTTypeGIF];\n}\n\n- (void)setYy_WEBPData:(NSData *)WEBPData {\n    [self setData:WEBPData forPasteboardType:YYTextUTTypeWEBP];\n}\n\n- (NSData *)yy_WEBPData {\n    return [self dataForPasteboardType:YYTextUTTypeWEBP];\n}\n\n- (void)setYy_ImageData:(NSData *)imageData {\n    [self setData:imageData forPasteboardType:(id)kUTTypeImage];\n}\n\n- (NSData *)yy_ImageData {\n    return [self dataForPasteboardType:(id)kUTTypeImage];\n}\n\n- (void)setYy_AttributedString:(NSAttributedString *)attributedString {\n    self.string = [attributedString yy_plainTextForRange:NSMakeRange(0, attributedString.length)];\n    NSData *data = [attributedString yy_archiveToData];\n    if (data) {\n        NSDictionary *item = @{YYTextPasteboardTypeAttributedString : data};\n        [self addItems:@[item]];\n    }\n    [attributedString enumerateAttribute:YYTextAttachmentAttributeName inRange:NSMakeRange(0, attributedString.length) options:NSAttributedStringEnumerationLongestEffectiveRangeNotRequired usingBlock:^(YYTextAttachment *attachment, NSRange range, BOOL *stop) {\n        \n        // save image\n        UIImage *simpleImage = nil;\n        if ([attachment.content isKindOfClass:[UIImage class]]) {\n            simpleImage = attachment.content;\n        } else if ([attachment.content isKindOfClass:[UIImageView class]]) {\n            simpleImage = ((UIImageView *)attachment.content).image;\n        }\n        if (simpleImage) {\n            NSDictionary *item = @{@\"com.apple.uikit.image\" : simpleImage};\n            [self addItems:@[item]];\n        }\n        \n#if YYTextAnimatedImageAvailable\n        // save animated image\n        if ([attachment.content isKindOfClass:[UIImageView class]]) {\n            UIImageView *imageView = attachment.content;\n            Class aniImageClass = NSClassFromString(@\"YYImage\");\n            UIImage *image = imageView.image;\n            if (aniImageClass && [image isKindOfClass:aniImageClass]) {\n                NSData *data = [image valueForKey:@\"animatedImageData\"];\n                NSNumber *type = [image valueForKey:@\"animatedImageType\"];\n                if (data) {\n                    switch (type.unsignedIntegerValue) {\n                        case YYImageTypeGIF: {\n                            NSDictionary *item = @{(id)kUTTypeGIF : data};\n                            [self addItems:@[item]];\n                        } break;\n                        case YYImageTypePNG: { // APNG\n                            NSDictionary *item = @{(id)kUTTypePNG : data};\n                            [self addItems:@[item]];\n                        } break;\n                        case YYImageTypeWebP: {\n                            NSDictionary *item = @{(id)YYTextUTTypeWEBP : data};\n                            [self addItems:@[item]];\n                        } break;\n                        default: break;\n                    }\n                }\n            }\n        }\n#endif\n        \n    }];\n}\n\n- (NSAttributedString *)yy_AttributedString {\n    for (NSDictionary *items in self.items) {\n        NSData *data = items[YYTextPasteboardTypeAttributedString];\n        if (data) {\n            return [NSAttributedString yy_unarchiveFromData:data];\n        }\n    }\n    return nil;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/UIView+YYText.h",
    "content": "//\n//  UIView+YYText.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 13/4/3.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Provides extensions for `UIView`.\n */\n@interface UIView (YYText)\n\n/**\n Returns the view's view controller (may be nil).\n */\n@property (nullable, nonatomic, readonly) UIViewController *yy_viewController;\n\n/**\n Returns the visible alpha on screen, taking into account superview and window.\n */\n@property (nonatomic, readonly) CGFloat yy_visibleAlpha;\n\n/**\n Converts a point from the receiver's coordinate system to that of the specified view or window.\n \n @param point A point specified in the local coordinate system (bounds) of the receiver.\n @param view  The view or window into whose coordinate system point is to be converted.\n If view is nil, this method instead converts to window base coordinates.\n @return The point converted to the coordinate system of view.\n */\n- (CGPoint)yy_convertPoint:(CGPoint)point toViewOrWindow:(UIView *)view;\n\n/**\n Converts a point from the coordinate system of a given view or window to that of the receiver.\n \n @param point A point specified in the local coordinate system (bounds) of view.\n @param view  The view or window with point in its coordinate system.\n If view is nil, this method instead converts from window base coordinates.\n @return The point converted to the local coordinate system (bounds) of the receiver.\n */\n- (CGPoint)yy_convertPoint:(CGPoint)point fromViewOrWindow:(UIView *)view;\n\n/**\n Converts a rectangle from the receiver's coordinate system to that of another view or window.\n \n @param rect A rectangle specified in the local coordinate system (bounds) of the receiver.\n @param view The view or window that is the target of the conversion operation. If view is nil, this method instead converts to window base coordinates.\n @return The converted rectangle.\n */\n- (CGRect)yy_convertRect:(CGRect)rect toViewOrWindow:(UIView *)view;\n\n/**\n Converts a rectangle from the coordinate system of another view or window to that of the receiver.\n \n @param rect A rectangle specified in the local coordinate system (bounds) of view.\n @param view The view or window with rect in its coordinate system.\n If view is nil, this method instead converts from window base coordinates.\n @return The converted rectangle.\n */\n- (CGRect)yy_convertRect:(CGRect)rect fromViewOrWindow:(UIView *)view;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/UIView+YYText.m",
    "content": "//\n//  UIView+YYText.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 13/4/3.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"UIView+YYText.h\"\n\n// Dummy class for category\n@interface UIView_YYText : NSObject @end\n@implementation UIView_YYText @end\n\n\n@implementation UIView (YYText)\n\n- (UIViewController *)yy_viewController {\n    for (UIView *view = self; view; view = view.superview) {\n        UIResponder *nextResponder = [view nextResponder];\n        if ([nextResponder isKindOfClass:[UIViewController class]]) {\n            return (UIViewController *)nextResponder;\n        }\n    }\n    return nil;\n}\n\n- (CGFloat)yy_visibleAlpha {\n    if ([self isKindOfClass:[UIWindow class]]) {\n        if (self.hidden) return 0;\n        return self.alpha;\n    }\n    if (!self.window) return 0;\n    CGFloat alpha = 1;\n    UIView *v = self;\n    while (v) {\n        if (v.hidden) {\n            alpha = 0;\n            break;\n        }\n        alpha *= v.alpha;\n        v = v.superview;\n    }\n    return alpha;\n}\n\n- (CGPoint)yy_convertPoint:(CGPoint)point toViewOrWindow:(UIView *)view {\n    if (!view) {\n        if ([self isKindOfClass:[UIWindow class]]) {\n            return [((UIWindow *)self) convertPoint:point toWindow:nil];\n        } else {\n            return [self convertPoint:point toView:nil];\n        }\n    }\n    \n    UIWindow *from = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;\n    UIWindow *to = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;\n    if ((!from || !to) || (from == to)) return [self convertPoint:point toView:view];\n    point = [self convertPoint:point toView:from];\n    point = [to convertPoint:point fromWindow:from];\n    point = [view convertPoint:point fromView:to];\n    return point;\n}\n\n- (CGPoint)yy_convertPoint:(CGPoint)point fromViewOrWindow:(UIView *)view {\n    if (!view) {\n        if ([self isKindOfClass:[UIWindow class]]) {\n            return [((UIWindow *)self) convertPoint:point fromWindow:nil];\n        } else {\n            return [self convertPoint:point fromView:nil];\n        }\n    }\n    \n    UIWindow *from = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;\n    UIWindow *to = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;\n    if ((!from || !to) || (from == to)) return [self convertPoint:point fromView:view];\n    point = [from convertPoint:point fromView:view];\n    point = [to convertPoint:point fromWindow:from];\n    point = [self convertPoint:point fromView:to];\n    return point;\n}\n\n- (CGRect)yy_convertRect:(CGRect)rect toViewOrWindow:(UIView *)view {\n    if (!view) {\n        if ([self isKindOfClass:[UIWindow class]]) {\n            return [((UIWindow *)self) convertRect:rect toWindow:nil];\n        } else {\n            return [self convertRect:rect toView:nil];\n        }\n    }\n    \n    UIWindow *from = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;\n    UIWindow *to = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;\n    if (!from || !to) return [self convertRect:rect toView:view];\n    if (from == to) return [self convertRect:rect toView:view];\n    rect = [self convertRect:rect toView:from];\n    rect = [to convertRect:rect fromWindow:from];\n    rect = [view convertRect:rect fromView:to];\n    return rect;\n}\n\n- (CGRect)yy_convertRect:(CGRect)rect fromViewOrWindow:(UIView *)view {\n    if (!view) {\n        if ([self isKindOfClass:[UIWindow class]]) {\n            return [((UIWindow *)self) convertRect:rect fromWindow:nil];\n        } else {\n            return [self convertRect:rect fromView:nil];\n        }\n    }\n    \n    UIWindow *from = [view isKindOfClass:[UIWindow class]] ? (id)view : view.window;\n    UIWindow *to = [self isKindOfClass:[UIWindow class]] ? (id)self : self.window;\n    if ((!from || !to) || (from == to)) return [self convertRect:rect fromView:view];\n    rect = [from convertRect:rect fromView:view];\n    rect = [to convertRect:rect fromWindow:from];\n    rect = [self convertRect:rect fromView:to];\n    return rect;\n}\n\n@end"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextAsyncLayer.h",
    "content": "//\n//  YYTextAsyncLayer.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/11.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n#import <QuartzCore/QuartzCore.h>\n\n@class YYTextAsyncLayerDisplayTask;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The YYTextAsyncLayer class is a subclass of CALayer used for render contents asynchronously.\n \n @discussion When the layer need update it's contents, it will ask the delegate \n for a async display task to render the contents in a background queue.\n */\n@interface YYTextAsyncLayer : CALayer\n/// Whether the render code is executed in background. Default is YES.\n@property BOOL displaysAsynchronously;\n@end\n\n\n/**\n The YYTextAsyncLayer's delegate protocol. The delegate of the YYTextAsyncLayer (typically a UIView)\n must implements the method in this protocol.\n */\n@protocol YYTextAsyncLayerDelegate <NSObject>\n@required\n/// This method is called to return a new display task when the layer's contents need update.\n- (YYTextAsyncLayerDisplayTask *)newAsyncDisplayTask;\n@end\n\n\n/**\n A display task used by YYTextAsyncLayer to render the contents in background queue.\n */\n@interface YYTextAsyncLayerDisplayTask : NSObject\n\n/**\n This block will be called before the asynchronous drawing begins.\n It will be called on the main thread.\n \n @param layer  The layer.\n */\n@property (nullable, nonatomic, copy) void (^willDisplay)(CALayer *layer);\n\n/**\n This block is called to draw the layer's contents.\n \n @discussion This block may be called on main thread or background thread,\n so is should be thread-safe.\n \n @param context      A new bitmap content created by layer.\n @param size         The content size (typically same as layer's bound size).\n @param isCancelled  If this block returns `YES`, the method should cancel the\n drawing process and return as quickly as possible.\n */\n@property (nullable, nonatomic, copy) void (^display)(CGContextRef context, CGSize size, BOOL(^isCancelled)(void));\n\n/**\n This block will be called after the asynchronous drawing finished.\n It will be called on the main thread.\n \n @param layer  The layer.\n @param finished  If the draw process is cancelled, it's `NO`, otherwise it's `YES`;\n */\n@property (nullable, nonatomic, copy) void (^didDisplay)(CALayer *layer, BOOL finished);\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextAsyncLayer.m",
    "content": "//\n//  YYTextAsyncLayer.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/11.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextAsyncLayer.h\"\n#import <libkern/OSAtomic.h>\n\n\n/// Global display queue, used for content rendering.\nstatic dispatch_queue_t YYTextAsyncLayerGetDisplayQueue() {\n#define MAX_QUEUE_COUNT 16\n    static int queueCount;\n    static dispatch_queue_t queues[MAX_QUEUE_COUNT];\n    static dispatch_once_t onceToken;\n    static int32_t counter = 0;\n    dispatch_once(&onceToken, ^{\n        queueCount = (int)[NSProcessInfo processInfo].activeProcessorCount;\n        queueCount = queueCount < 1 ? 1 : queueCount > MAX_QUEUE_COUNT ? MAX_QUEUE_COUNT : queueCount;\n        if ([UIDevice currentDevice].systemVersion.floatValue >= 8.0) {\n            for (NSUInteger i = 0; i < queueCount; i++) {\n                dispatch_queue_attr_t attr = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, 0);\n                queues[i] = dispatch_queue_create(\"com.ibireme.text.render\", attr);\n            }\n        } else {\n            for (NSUInteger i = 0; i < queueCount; i++) {\n                queues[i] = dispatch_queue_create(\"com.ibireme.text.render\", DISPATCH_QUEUE_SERIAL);\n                dispatch_set_target_queue(queues[i], dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));\n            }\n        }\n    });\n    uint32_t cur = (uint32_t)OSAtomicIncrement32(&counter);\n    return queues[(cur) % queueCount];\n#undef MAX_QUEUE_COUNT\n}\n\nstatic dispatch_queue_t YYTextAsyncLayerGetReleaseQueue() {\n#ifdef YYDispatchQueuePool_h\n    return YYDispatchQueueGetForQOS(NSQualityOfServiceDefault);\n#else\n    return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);\n#endif\n}\n\n\n/// a thread safe incrementing counter.\n@interface _YYTextSentinel : NSObject\n/// Returns the current value of the counter.\n@property (atomic, readonly) int32_t value;\n/// Increase the value atomically. @return The new value.\n- (int32_t)increase;\n@end\n\n@implementation _YYTextSentinel {\n    int32_t _value;\n}\n- (int32_t)value {\n    return _value;\n}\n- (int32_t)increase {\n    return OSAtomicIncrement32(&_value);\n}\n@end\n\n\n@implementation YYTextAsyncLayerDisplayTask\n@end\n\n\n@implementation YYTextAsyncLayer {\n    _YYTextSentinel *_sentinel;\n}\n\n#pragma mark - Override\n\n+ (id)defaultValueForKey:(NSString *)key {\n    if ([key isEqualToString:@\"displaysAsynchronously\"]) {\n        return @(YES);\n    } else {\n        return [super defaultValueForKey:key];\n    }\n}\n\n- (instancetype)init {\n    self = [super init];\n    static CGFloat scale; //global\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        scale = [UIScreen mainScreen].scale;\n    });\n    self.contentsScale = scale;\n    _sentinel = [_YYTextSentinel new];\n    _displaysAsynchronously = YES;\n    return self;\n}\n\n- (void)dealloc {\n    [_sentinel increase];\n}\n\n- (void)setNeedsDisplay {\n    [self _cancelAsyncDisplay];\n    [super setNeedsDisplay];\n}\n\n- (void)display {\n    super.contents = super.contents;\n    [self _displayAsync:_displaysAsynchronously];\n}\n\n#pragma mark - Private\n\n- (void)_displayAsync:(BOOL)async {\n    __strong id<YYTextAsyncLayerDelegate> delegate = (id)self.delegate;\n    YYTextAsyncLayerDisplayTask *task = [delegate newAsyncDisplayTask];\n    if (!task.display) {\n        if (task.willDisplay) task.willDisplay(self);\n        self.contents = nil;\n        if (task.didDisplay) task.didDisplay(self, YES);\n        return;\n    }\n    \n    if (async) {\n        if (task.willDisplay) task.willDisplay(self);\n        _YYTextSentinel *sentinel = _sentinel;\n        int32_t value = sentinel.value;\n        BOOL (^isCancelled)() = ^BOOL() {\n            return value != sentinel.value;\n        };\n        CGSize size = self.bounds.size;\n        BOOL opaque = self.opaque;\n        CGFloat scale = self.contentsScale;\n        CGColorRef backgroundColor = (opaque && self.backgroundColor) ? CGColorRetain(self.backgroundColor) : NULL;\n        if (size.width < 1 || size.height < 1) {\n            CGImageRef image = (__bridge_retained CGImageRef)(self.contents);\n            self.contents = nil;\n            if (image) {\n                dispatch_async(YYTextAsyncLayerGetReleaseQueue(), ^{\n                    CFRelease(image);\n                });\n            }\n            if (task.didDisplay) task.didDisplay(self, YES);\n            CGColorRelease(backgroundColor);\n            return;\n        }\n        \n        dispatch_async(YYTextAsyncLayerGetDisplayQueue(), ^{\n            if (isCancelled()) {\n                CGColorRelease(backgroundColor);\n                return;\n            }\n            UIGraphicsBeginImageContextWithOptions(size, opaque, scale);\n            CGContextRef context = UIGraphicsGetCurrentContext();\n            if (opaque) {\n                CGContextSaveGState(context); {\n                    if (!backgroundColor || CGColorGetAlpha(backgroundColor) < 1) {\n                        CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n                        CGContextAddRect(context, CGRectMake(0, 0, size.width * scale, size.height * scale));\n                        CGContextFillPath(context);\n                    }\n                    if (backgroundColor) {\n                        CGContextSetFillColorWithColor(context, backgroundColor);\n                        CGContextAddRect(context, CGRectMake(0, 0, size.width * scale, size.height * scale));\n                        CGContextFillPath(context);\n                    }\n                } CGContextRestoreGState(context);\n                CGColorRelease(backgroundColor);\n            }\n            task.display(context, size, isCancelled);\n            if (isCancelled()) {\n                UIGraphicsEndImageContext();\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    if (task.didDisplay) task.didDisplay(self, NO);\n                });\n                return;\n            }\n            UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n            UIGraphicsEndImageContext();\n            if (isCancelled()) {\n                dispatch_async(dispatch_get_main_queue(), ^{\n                    if (task.didDisplay) task.didDisplay(self, NO);\n                });\n                return;\n            }\n            dispatch_async(dispatch_get_main_queue(), ^{\n                if (isCancelled()) {\n                    if (task.didDisplay) task.didDisplay(self, NO);\n                } else {\n                    self.contents = (__bridge id)(image.CGImage);\n                    if (task.didDisplay) task.didDisplay(self, YES);\n                }\n            });\n        });\n    } else {\n        [_sentinel increase];\n        if (task.willDisplay) task.willDisplay(self);\n        UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, self.contentsScale);\n        CGContextRef context = UIGraphicsGetCurrentContext();\n        if (self.opaque) {\n            CGSize size = self.bounds.size;\n            size.width *= self.contentsScale;\n            size.height *= self.contentsScale;\n            CGContextSaveGState(context); {\n                if (!self.backgroundColor || CGColorGetAlpha(self.backgroundColor) < 1) {\n                    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);\n                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));\n                    CGContextFillPath(context);\n                }\n                if (self.backgroundColor) {\n                    CGContextSetFillColorWithColor(context, self.backgroundColor);\n                    CGContextAddRect(context, CGRectMake(0, 0, size.width, size.height));\n                    CGContextFillPath(context);\n                }\n            } CGContextRestoreGState(context);\n        }\n        task.display(context, self.bounds.size, ^{return NO;});\n        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n        UIGraphicsEndImageContext();\n        self.contents = (__bridge id)(image.CGImage);\n        if (task.didDisplay) task.didDisplay(self, YES);\n    }\n}\n\n- (void)_cancelAsyncDisplay {\n    [_sentinel increase];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextTransaction.h",
    "content": "//\n//  YYTextTransaction.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/18.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n YYTextTransaction let you perform a selector once before current runloop sleep.\n */\n@interface YYTextTransaction : NSObject\n\n/**\n Creates and returns a transaction with a specified target and selector.\n \n @param target    A specified target, the target is retained until runloop end.\n @param selector  A selector for target.\n \n @return A new transaction, or nil if an error occurs.\n */\n+ (YYTextTransaction *)transactionWithTarget:(id)target selector:(SEL)selector;\n\n/**\n Commit the trancaction to main runloop.\n \n @discussion It will perform the selector on the target once before main runloop's\n current loop sleep. If the same transaction (same target and same selector) has \n already commit to runloop in this loop, this method do nothing.\n */\n- (void)commit;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextTransaction.m",
    "content": "//\n//  YYTextTransaction.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/18.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextTransaction.h\"\n\n\n@interface YYTextTransaction()\n@property (nonatomic, strong) id target;\n@property (nonatomic, assign) SEL selector;\n@end\n\nstatic NSMutableSet *transactionSet = nil;\n\nstatic void YYRunLoopObserverCallBack(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) {\n    if (transactionSet.count == 0) return;\n    NSSet *currentSet = transactionSet;\n    transactionSet = [NSMutableSet new];\n    [currentSet enumerateObjectsUsingBlock:^(YYTextTransaction *transaction, BOOL *stop) {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Warc-performSelector-leaks\"\n        [transaction.target performSelector:transaction.selector];\n#pragma clang diagnostic pop\n    }];\n}\n\nstatic void YYTextTransactionSetup() {\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        transactionSet = [NSMutableSet new];\n        CFRunLoopRef runloop = CFRunLoopGetMain();\n        CFRunLoopObserverRef observer;\n        \n        observer = CFRunLoopObserverCreate(CFAllocatorGetDefault(),\n                                           kCFRunLoopBeforeWaiting | kCFRunLoopExit,\n                                           true,      // repeat\n                                           0xFFFFFF,  // after CATransaction(2000000)\n                                           YYRunLoopObserverCallBack, NULL);\n        CFRunLoopAddObserver(runloop, observer, kCFRunLoopCommonModes);\n        CFRelease(observer);\n    });\n}\n\n\n@implementation YYTextTransaction\n\n+ (YYTextTransaction *)transactionWithTarget:(id)target selector:(SEL)selector{\n    if (!target || !selector) return nil;\n    YYTextTransaction *t = [YYTextTransaction new];\n    t.target = target;\n    t.selector = selector;\n    return t;\n}\n\n- (void)commit {\n    if (!_target || !_selector) return;\n    YYTextTransactionSetup();\n    [transactionSet addObject:self];\n}\n\n- (NSUInteger)hash {\n    long v1 = (long)((void *)_selector);\n    long v2 = (long)_target;\n    return v1 ^ v2;\n}\n\n- (BOOL)isEqual:(id)object {\n    if (self == object) return YES;\n    if (![object isMemberOfClass:self.class]) return NO;\n    YYTextTransaction *other = object;\n    return other.selector == _selector && other.target == _target;\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextUtilities.h",
    "content": "//\n//  YYTextUtilities.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/6.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n#import <QuartzCore/QuartzCore.h>\n#import <CoreText/CoreText.h>\n\n\n#ifndef YYTEXT_CLAMP // return the clamped value\n#define YYTEXT_CLAMP(_x_, _low_, _high_)  (((_x_) > (_high_)) ? (_high_) : (((_x_) < (_low_)) ? (_low_) : (_x_)))\n#endif\n\n#ifndef YYTEXT_SWAP // swap two value\n#define YYTEXT_SWAP(_a_, _b_)  do { __typeof__(_a_) _tmp_ = (_a_); (_a_) = (_b_); (_b_) = _tmp_; } while (0)\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n Whether the character is 'line break char':\n U+000D (\\\\r or CR)\n U+2028 (Unicode line separator)\n U+000A (\\\\n or LF)\n U+2029 (Unicode paragraph separator)\n \n @param c  A character\n @return YES or NO.\n */\nstatic inline BOOL YYTextIsLinebreakChar(unichar c) {\n    switch (c) {\n        case 0x000D:\n        case 0x2028:\n        case 0x000A:\n        case 0x2029:\n            return YES;\n        default:\n            return NO;\n    }\n}\n\n/**\n Whether the string is a 'line break':\n U+000D (\\\\r or CR)\n U+2028 (Unicode line separator)\n U+000A (\\\\n or LF)\n U+2029 (Unicode paragraph separator)\n \\\\r\\\\n, in that order (also known as CRLF)\n \n @param str A string\n @return YES or NO.\n */\nstatic inline BOOL YYTextIsLinebreakString(NSString * _Nullable str) {\n    if (str.length > 2 || str.length == 0) return NO;\n    if (str.length == 1) {\n        unichar c = [str characterAtIndex:0];\n        return YYTextIsLinebreakChar(c);\n    } else {\n        return ([str characterAtIndex:0] == '\\r') && ([str characterAtIndex:1] == '\\n');\n    }\n}\n\n/**\n If the string has a 'line break' suffix, return the 'line break' length.\n \n @param str  A string.\n @return The length of the tail line break: 0, 1 or 2.\n */\nstatic inline NSUInteger YYTextLinebreakTailLength(NSString * _Nullable str) {\n    if (str.length >= 2) {\n        unichar c2 = [str characterAtIndex:str.length - 1];\n        if (YYTextIsLinebreakChar(c2)) {\n            unichar c1 = [str characterAtIndex:str.length - 2];\n            if (c1 == '\\r' && c2 == '\\n') return 2;\n            else return 1;\n        } else {\n            return 0;\n        }\n    } else if (str.length == 1) {\n        return YYTextIsLinebreakChar([str characterAtIndex:0]) ? 1 : 0;\n    } else {\n        return 0;\n    }\n}\n\n/**\n Convert `UIDataDetectorTypes` to `NSTextCheckingType`.\n \n @param types  The `UIDataDetectorTypes` type.\n @return The `NSTextCheckingType` type.\n */\nstatic inline NSTextCheckingType YYTextNSTextCheckingTypeFromUIDataDetectorType(UIDataDetectorTypes types) {\n    NSTextCheckingType t = 0;\n    if (types & UIDataDetectorTypePhoneNumber) t |= NSTextCheckingTypePhoneNumber;\n    if (types & UIDataDetectorTypeLink) t |= NSTextCheckingTypeLink;\n    if (types & UIDataDetectorTypeAddress) t |= NSTextCheckingTypeAddress;\n    if (types & UIDataDetectorTypeCalendarEvent) t |= NSTextCheckingTypeDate;\n    return t;\n}\n\n/**\n Whether the font is `AppleColorEmoji` font.\n \n @param font  A font.\n @return YES: the font is Emoji, NO: the font is not Emoji.\n */\nstatic inline BOOL YYTextUIFontIsEmoji(UIFont *font) {\n    return [font.fontName isEqualToString:@\"AppleColorEmoji\"];\n}\n\n/**\n Whether the font is `AppleColorEmoji` font.\n \n @param font  A font.\n @return YES: the font is Emoji, NO: the font is not Emoji.\n */\nstatic inline BOOL YYTextCTFontIsEmoji(CTFontRef font) {\n    BOOL isEmoji = NO;\n    CFStringRef name = CTFontCopyPostScriptName(font);\n    if (name && CFEqual(CFSTR(\"AppleColorEmoji\"), name)) isEmoji = YES;\n    if (name) CFRelease(name);\n    return isEmoji;\n}\n\n/**\n Whether the font is `AppleColorEmoji` font.\n \n @param font  A font.\n @return YES: the font is Emoji, NO: the font is not Emoji.\n */\nstatic inline BOOL YYTextCGFontIsEmoji(CGFontRef font) {\n    BOOL isEmoji = NO;\n    CFStringRef name = CGFontCopyPostScriptName(font);\n    if (name && CFEqual(CFSTR(\"AppleColorEmoji\"), name)) isEmoji = YES;\n    if (name) CFRelease(name);\n    return isEmoji;\n}\n\n/**\n Whether the font contains color bitmap glyphs.\n \n @discussion Only `AppleColorEmoji` contains color bitmap glyphs in iOS system fonts.\n @param font  A font.\n @return YES: the font contains color bitmap glyphs, NO: the font has no color bitmap glyph.\n */\nstatic inline BOOL YYTextCTFontContainsColorBitmapGlyphs(CTFontRef font) {\n    return  (CTFontGetSymbolicTraits(font) & kCTFontTraitColorGlyphs) != 0;\n}\n\n/**\n Whether the glyph is bitmap.\n \n @param font  The glyph's font.\n @param glyph The glyph which is created from the specified font.\n @return YES: the glyph is bitmap, NO: the glyph is vector.\n */\nstatic inline BOOL YYTextCGGlyphIsBitmap(CTFontRef font, CGGlyph glyph) {\n    if (!font && !glyph) return NO;\n    if (!YYTextCTFontContainsColorBitmapGlyphs(font)) return NO;\n    CGPathRef path = CTFontCreatePathForGlyph(font, glyph, NULL);\n    if (path) {\n        CFRelease(path);\n        return NO;\n    }\n    return YES;\n}\n\n/**\n Get the `AppleColorEmoji` font's ascent with a specified font size.\n It may used to create custom emoji.\n \n @param fontSize  The specified font size.\n @return The font ascent.\n */\nstatic inline CGFloat YYTextEmojiGetAscentWithFontSize(CGFloat fontSize) {\n    if (fontSize < 16) {\n        return 1.25 * fontSize;\n    } else if (16 <= fontSize && fontSize <= 24) {\n        return 0.5 * fontSize + 12;\n    } else {\n        return fontSize;\n    }\n}\n\n/**\n Get the `AppleColorEmoji` font's descent with a specified font size.\n It may used to create custom emoji.\n \n @param fontSize  The specified font size.\n @return The font descent.\n */\nstatic inline CGFloat YYTextEmojiGetDescentWithFontSize(CGFloat fontSize) {\n    if (fontSize < 16) {\n        return 0.390625 * fontSize;\n    } else if (16 <= fontSize && fontSize <= 24) {\n        return 0.15625 * fontSize + 3.75;\n    } else {\n        return 0.3125 * fontSize;\n    }\n    return 0;\n}\n\n/**\n Get the `AppleColorEmoji` font's glyph bounding rect with a specified font size.\n It may used to create custom emoji.\n \n @param fontSize  The specified font size.\n @return The font glyph bounding rect.\n */\nstatic inline CGRect YYTextEmojiGetGlyphBoundingRectWithFontSize(CGFloat fontSize) {\n    CGRect rect;\n    rect.origin.x = 0.75;\n    rect.size.width = rect.size.height = YYTextEmojiGetAscentWithFontSize(fontSize);\n    if (fontSize < 16) {\n        rect.origin.y = -0.2525 * fontSize;\n    } else if (16 <= fontSize && fontSize <= 24) {\n        rect.origin.y = 0.1225 * fontSize -6;\n    } else {\n        rect.origin.y = -0.1275 * fontSize;\n    }\n    return rect;\n}\n\n\n/**\n Get the character set which should rotate in vertical form.\n @return The shared character set.\n */\nNSCharacterSet *YYTextVerticalFormRotateCharacterSet();\n\n/**\n Get the character set which should rotate and move in vertical form.\n @return The shared character set.\n */\nNSCharacterSet *YYTextVerticalFormRotateAndMoveCharacterSet();\n\n\n\n/// Convert degrees to radians.\nstatic inline CGFloat YYTextDegreesToRadians(CGFloat degrees) {\n    return degrees * M_PI / 180;\n}\n\n/// Convert radians to degrees.\nstatic inline CGFloat YYTextRadiansToDegrees(CGFloat radians) {\n    return radians * 180 / M_PI;\n}\n\n\n\n/// Get the transform rotation.\n/// @return the rotation in radians [-PI,PI] ([-180°,180°])\nstatic inline CGFloat YYTextCGAffineTransformGetRotation(CGAffineTransform transform) {\n    return atan2(transform.b, transform.a);\n}\n\n/// Get the transform's scale.x\nstatic inline CGFloat YYTextCGAffineTransformGetScaleX(CGAffineTransform transform) {\n    return  sqrt(transform.a * transform.a + transform.c * transform.c);\n}\n\n/// Get the transform's scale.y\nstatic inline CGFloat YYTextCGAffineTransformGetScaleY(CGAffineTransform transform) {\n    return sqrt(transform.b * transform.b + transform.d * transform.d);\n}\n\n/// Get the transform's translate.x\nstatic inline CGFloat YYTextCGAffineTransformGetTranslateX(CGAffineTransform transform) {\n    return transform.tx;\n}\n\n/// Get the transform's translate.y\nstatic inline CGFloat YYTextCGAffineTransformGetTranslateY(CGAffineTransform transform) {\n    return transform.ty;\n}\n\n/**\n If you have 3 pair of points transformed by a same CGAffineTransform:\n p1 (transform->) q1\n p2 (transform->) q2\n p3 (transform->) q3\n This method returns the original transform matrix from these 3 pair of points.\n \n @see http://stackoverflow.com/questions/13291796/calculate-values-for-a-cgaffinetransform-from-three-points-in-each-of-two-uiview\n */\nCGAffineTransform YYTextCGAffineTransformGetFromPoints(CGPoint before[3], CGPoint after[3]);\n\n/// Get the transform which can converts a point from the coordinate system of a given view to another.\nCGAffineTransform YYTextCGAffineTransformGetFromViews(UIView *from, UIView *to);\n\n/// Create a skew transform.\nstatic inline CGAffineTransform YYTextCGAffineTransformMakeSkew(CGFloat x, CGFloat y){\n    CGAffineTransform transform = CGAffineTransformIdentity;\n    transform.c = -x;\n    transform.b = y;\n    return transform;\n}\n\n/// Negates/inverts a UIEdgeInsets.\nstatic inline UIEdgeInsets YYTextUIEdgeInsetsInvert(UIEdgeInsets insets) {\n    return UIEdgeInsetsMake(-insets.top, -insets.left, -insets.bottom, -insets.right);\n}\n\n/// Convert CALayer's gravity string to UIViewContentMode.\nUIViewContentMode YYTextCAGravityToUIViewContentMode(NSString *gravity);\n\n/// Convert UIViewContentMode to CALayer's gravity string.\nNSString *YYTextUIViewContentModeToCAGravity(UIViewContentMode contentMode);\n\n\n\n/**\n Returns a rectangle to fit the @param rect with specified content mode.\n \n @param rect The constrant rect\n @param size The content size\n @param mode The content mode\n @return A rectangle for the given content mode.\n @discussion UIViewContentModeRedraw is same as UIViewContentModeScaleToFill.\n */\nCGRect YYTextCGRectFitWithContentMode(CGRect rect, CGSize size, UIViewContentMode mode);\n\n/// Returns the center for the rectangle.\nstatic inline CGPoint YYTextCGRectGetCenter(CGRect rect) {\n    return CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));\n}\n\n/// Returns the area of the rectangle.\nstatic inline CGFloat YYTextCGRectGetArea(CGRect rect) {\n    if (CGRectIsNull(rect)) return 0;\n    rect = CGRectStandardize(rect);\n    return rect.size.width * rect.size.height;\n}\n\n/// Returns the distance between two points.\nstatic inline CGFloat YYTextCGPointGetDistanceToPoint(CGPoint p1, CGPoint p2) {\n    return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));\n}\n\n/// Returns the minmium distance between a point to a rectangle.\nstatic inline CGFloat YYTextCGPointGetDistanceToRect(CGPoint p, CGRect r) {\n    r = CGRectStandardize(r);\n    if (CGRectContainsPoint(r, p)) return 0;\n    CGFloat distV, distH;\n    if (CGRectGetMinY(r) <= p.y && p.y <= CGRectGetMaxY(r)) {\n        distV = 0;\n    } else {\n        distV = p.y < CGRectGetMinY(r) ? CGRectGetMinY(r) - p.y : p.y - CGRectGetMaxY(r);\n    }\n    if (CGRectGetMinX(r) <= p.x && p.x <= CGRectGetMaxX(r)) {\n        distH = 0;\n    } else {\n        distH = p.x < CGRectGetMinX(r) ? CGRectGetMinX(r) - p.x : p.x - CGRectGetMaxX(r);\n    }\n    return MAX(distV, distH);\n}\n\n\n/// Get main screen's scale.\nCGFloat YYTextScreenScale();\n\n/// Get main screen's size. Height is always larger than width.\nCGSize YYTextScreenSize();\n\n/// Convert point to pixel.\nstatic inline CGFloat YYTextCGFloatToPixel(CGFloat value) {\n    return value * YYTextScreenScale();\n}\n\n/// Convert pixel to point.\nstatic inline CGFloat YYTextCGFloatFromPixel(CGFloat value) {\n    return value / YYTextScreenScale();\n}\n\n/// floor point value for pixel-aligned\nstatic inline CGFloat YYTextCGFloatPixelFloor(CGFloat value) {\n    CGFloat scale = YYTextScreenScale();\n    return floor(value * scale) / scale;\n}\n\n/// round point value for pixel-aligned\nstatic inline CGFloat YYTextCGFloatPixelRound(CGFloat value) {\n    CGFloat scale = YYTextScreenScale();\n    return round(value * scale) / scale;\n}\n\n/// ceil point value for pixel-aligned\nstatic inline CGFloat YYTextCGFloatPixelCeil(CGFloat value) {\n    CGFloat scale = YYTextScreenScale();\n    return ceil(value * scale) / scale;\n}\n\n/// round point value to .5 pixel for path stroke (odd pixel line width pixel-aligned)\nstatic inline CGFloat YYTextCGFloatPixelHalf(CGFloat value) {\n    CGFloat scale = YYTextScreenScale();\n    return (floor(value * scale) + 0.5) / scale;\n}\n\n/// floor point value for pixel-aligned\nstatic inline CGPoint YYTextCGPointPixelFloor(CGPoint point) {\n    CGFloat scale = YYTextScreenScale();\n    return CGPointMake(floor(point.x * scale) / scale,\n                       floor(point.y * scale) / scale);\n}\n\n/// round point value for pixel-aligned\nstatic inline CGPoint YYTextCGPointPixelRound(CGPoint point) {\n    CGFloat scale = YYTextScreenScale();\n    return CGPointMake(round(point.x * scale) / scale,\n                       round(point.y * scale) / scale);\n}\n\n/// ceil point value for pixel-aligned\nstatic inline CGPoint YYTextCGPointPixelCeil(CGPoint point) {\n    CGFloat scale = YYTextScreenScale();\n    return CGPointMake(ceil(point.x * scale) / scale,\n                       ceil(point.y * scale) / scale);\n}\n\n/// round point value to .5 pixel for path stroke (odd pixel line width pixel-aligned)\nstatic inline CGPoint YYTextCGPointPixelHalf(CGPoint point) {\n    CGFloat scale = YYTextScreenScale();\n    return CGPointMake((floor(point.x * scale) + 0.5) / scale,\n                       (floor(point.y * scale) + 0.5) / scale);\n}\n\n\n\n/// floor point value for pixel-aligned\nstatic inline CGSize YYTextCGSizePixelFloor(CGSize size) {\n    CGFloat scale = YYTextScreenScale();\n    return CGSizeMake(floor(size.width * scale) / scale,\n                      floor(size.height * scale) / scale);\n}\n\n/// round point value for pixel-aligned\nstatic inline CGSize YYTextCGSizePixelRound(CGSize size) {\n    CGFloat scale = YYTextScreenScale();\n    return CGSizeMake(round(size.width * scale) / scale,\n                      round(size.height * scale) / scale);\n}\n\n/// ceil point value for pixel-aligned\nstatic inline CGSize YYTextCGSizePixelCeil(CGSize size) {\n    CGFloat scale = YYTextScreenScale();\n    return CGSizeMake(ceil(size.width * scale) / scale,\n                      ceil(size.height * scale) / scale);\n}\n\n/// round point value to .5 pixel for path stroke (odd pixel line width pixel-aligned)\nstatic inline CGSize YYTextCGSizePixelHalf(CGSize size) {\n    CGFloat scale = YYTextScreenScale();\n    return CGSizeMake((floor(size.width * scale) + 0.5) / scale,\n                      (floor(size.height * scale) + 0.5) / scale);\n}\n\n\n\n/// floor point value for pixel-aligned\nstatic inline CGRect YYTextCGRectPixelFloor(CGRect rect) {\n    CGPoint origin = YYTextCGPointPixelCeil(rect.origin);\n    CGPoint corner = YYTextCGPointPixelFloor(CGPointMake(rect.origin.x + rect.size.width,\n                                                     rect.origin.y + rect.size.height));\n    CGRect ret = CGRectMake(origin.x, origin.y, corner.x - origin.x, corner.y - origin.y);\n    if (ret.size.width < 0) ret.size.width = 0;\n    if (ret.size.height < 0) ret.size.height = 0;\n    return ret;\n}\n\n/// round point value for pixel-aligned\nstatic inline CGRect YYTextCGRectPixelRound(CGRect rect) {\n    CGPoint origin = YYTextCGPointPixelRound(rect.origin);\n    CGPoint corner = YYTextCGPointPixelRound(CGPointMake(rect.origin.x + rect.size.width,\n                                                     rect.origin.y + rect.size.height));\n    return CGRectMake(origin.x, origin.y, corner.x - origin.x, corner.y - origin.y);\n}\n\n/// ceil point value for pixel-aligned\nstatic inline CGRect YYTextCGRectPixelCeil(CGRect rect) {\n    CGPoint origin = YYTextCGPointPixelFloor(rect.origin);\n    CGPoint corner = YYTextCGPointPixelCeil(CGPointMake(rect.origin.x + rect.size.width,\n                                                    rect.origin.y + rect.size.height));\n    return CGRectMake(origin.x, origin.y, corner.x - origin.x, corner.y - origin.y);\n}\n\n/// round point value to .5 pixel for path stroke (odd pixel line width pixel-aligned)\nstatic inline CGRect YYTextCGRectPixelHalf(CGRect rect) {\n    CGPoint origin = YYTextCGPointPixelHalf(rect.origin);\n    CGPoint corner = YYTextCGPointPixelHalf(CGPointMake(rect.origin.x + rect.size.width,\n                                                    rect.origin.y + rect.size.height));\n    return CGRectMake(origin.x, origin.y, corner.x - origin.x, corner.y - origin.y);\n}\n\n\n\n/// floor UIEdgeInset for pixel-aligned\nstatic inline UIEdgeInsets YYTextUIEdgeInsetPixelFloor(UIEdgeInsets insets) {\n    insets.top = YYTextCGFloatPixelFloor(insets.top);\n    insets.left = YYTextCGFloatPixelFloor(insets.left);\n    insets.bottom = YYTextCGFloatPixelFloor(insets.bottom);\n    insets.right = YYTextCGFloatPixelFloor(insets.right);\n    return insets;\n}\n\n/// ceil UIEdgeInset for pixel-aligned\nstatic inline UIEdgeInsets YYTextUIEdgeInsetPixelCeil(UIEdgeInsets insets) {\n    insets.top = YYTextCGFloatPixelCeil(insets.top);\n    insets.left = YYTextCGFloatPixelCeil(insets.left);\n    insets.bottom = YYTextCGFloatPixelCeil(insets.bottom);\n    insets.right = YYTextCGFloatPixelCeil(insets.right);\n    return insets;\n}\n\n\n\nstatic inline UIFont * _Nullable YYTextFontWithBold(UIFont *font) {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return font;\n    return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold] size:font.pointSize];\n}\n\nstatic inline UIFont * _Nullable YYTextFontWithItalic(UIFont *font) {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return font;\n    return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic] size:font.pointSize];\n}\n\nstatic inline UIFont * _Nullable YYTextFontWithBoldItalic(UIFont *font) {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return font;\n    return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold | UIFontDescriptorTraitItalic] size:font.pointSize];\n}\n\n\n\n/**\n Convert CFRange to NSRange\n @param range CFRange @return NSRange\n */\nstatic inline NSRange YYTextNSRangeFromCFRange(CFRange range) {\n    return NSMakeRange(range.location, range.length);\n}\n\n/**\n Convert NSRange to CFRange\n @param range NSRange @return CFRange\n */\nstatic inline CFRange YYTextCFRangeFromNSRange(NSRange range) {\n    return CFRangeMake(range.location, range.length);\n}\n\n\n/// Returns YES in App Extension.\nBOOL YYTextIsAppExtension();\n\n/// Returns nil in App Extension.\nUIApplication * _Nullable YYTextSharedApplication();\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextUtilities.m",
    "content": "//\n//  YYTextUtilities.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/4/6.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextUtilities.h\"\n#import <Accelerate/Accelerate.h>\n#import \"UIView+YYText.h\"\n\nNSCharacterSet *YYTextVerticalFormRotateCharacterSet() {\n    static NSMutableCharacterSet *set;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        set = [NSMutableCharacterSet new];\n        [set addCharactersInRange:NSMakeRange(0x1100, 256)]; // Hangul Jamo\n        [set addCharactersInRange:NSMakeRange(0x2460, 160)]; // Enclosed Alphanumerics\n        [set addCharactersInRange:NSMakeRange(0x2600, 256)]; // Miscellaneous Symbols\n        [set addCharactersInRange:NSMakeRange(0x2700, 192)]; // Dingbats\n        [set addCharactersInRange:NSMakeRange(0x2E80, 128)]; // CJK Radicals Supplement\n        [set addCharactersInRange:NSMakeRange(0x2F00, 224)]; // Kangxi Radicals\n        [set addCharactersInRange:NSMakeRange(0x2FF0, 16)]; // Ideographic Description Characters\n        [set addCharactersInRange:NSMakeRange(0x3000, 64)]; // CJK Symbols and Punctuation\n        [set removeCharactersInRange:NSMakeRange(0x3008, 10)];\n        [set removeCharactersInRange:NSMakeRange(0x3014, 12)];\n        [set addCharactersInRange:NSMakeRange(0x3040, 96)]; // Hiragana\n        [set addCharactersInRange:NSMakeRange(0x30A0, 96)]; // Katakana\n        [set addCharactersInRange:NSMakeRange(0x3100, 48)]; // Bopomofo\n        [set addCharactersInRange:NSMakeRange(0x3130, 96)]; // Hangul Compatibility Jamo\n        [set addCharactersInRange:NSMakeRange(0x3190, 16)]; // Kanbun\n        [set addCharactersInRange:NSMakeRange(0x31A0, 32)]; // Bopomofo Extended\n        [set addCharactersInRange:NSMakeRange(0x31C0, 48)]; // CJK Strokes\n        [set addCharactersInRange:NSMakeRange(0x31F0, 16)]; // Katakana Phonetic Extensions\n        [set addCharactersInRange:NSMakeRange(0x3200, 256)]; // Enclosed CJK Letters and Months\n        [set addCharactersInRange:NSMakeRange(0x3300, 256)]; // CJK Compatibility\n        [set addCharactersInRange:NSMakeRange(0x3400, 2582)]; // CJK Unified Ideographs Extension A\n        [set addCharactersInRange:NSMakeRange(0x4E00, 20941)]; // CJK Unified Ideographs\n        [set addCharactersInRange:NSMakeRange(0xAC00, 11172)]; // Hangul Syllables\n        [set addCharactersInRange:NSMakeRange(0xD7B0, 80)]; // Hangul Jamo Extended-B\n        [set addCharactersInString:@\"\"]; // U+F8FF (Private Use Area)\n        [set addCharactersInRange:NSMakeRange(0xF900, 512)]; // CJK Compatibility Ideographs\n        [set addCharactersInRange:NSMakeRange(0xFE10, 16)]; // Vertical Forms\n        [set addCharactersInRange:NSMakeRange(0xFF00, 240)]; // Halfwidth and Fullwidth Forms\n        [set addCharactersInRange:NSMakeRange(0x1F200, 256)]; // Enclosed Ideographic Supplement\n        [set addCharactersInRange:NSMakeRange(0x1F300, 768)]; // Enclosed Ideographic Supplement\n        [set addCharactersInRange:NSMakeRange(0x1F600, 80)]; // Emoticons (Emoji)\n        [set addCharactersInRange:NSMakeRange(0x1F680, 128)]; // Transport and Map Symbols\n        \n        // See http://unicode-table.com/ for more information.\n    });\n    return set;\n}\n\nNSCharacterSet *YYTextVerticalFormRotateAndMoveCharacterSet() {\n    static NSMutableCharacterSet *set;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        set = [NSMutableCharacterSet new];\n        [set addCharactersInString:@\"，。、．\"];\n    });\n    return set;\n}\n\n// return 0 when succeed\nstatic int matrix_invert(__CLPK_integer N, double *matrix) {\n    __CLPK_integer error = 0;\n    __CLPK_integer pivot_tmp[6 * 6];\n    __CLPK_integer *pivot = pivot_tmp;\n    double workspace_tmp[6 * 6];\n    double *workspace = workspace_tmp;\n    bool need_free = false;\n    \n    if (N > 6) {\n        need_free = true;\n        pivot = malloc(N * N * sizeof(__CLPK_integer));\n        if (!pivot) return -1;\n        workspace = malloc(N * sizeof(double));\n        if (!workspace) {\n            free(pivot);\n            return -1;\n        }\n    }\n    \n    dgetrf_(&N, &N, matrix, &N, pivot, &error);\n    \n    if (error == 0) {\n        dgetri_(&N, matrix, &N, pivot, workspace, &N, &error);\n    }\n    \n    if (need_free) {\n        free(pivot);\n        free(workspace);\n    }\n    return error;\n}\n\nCGAffineTransform YYTextCGAffineTransformGetFromPoints(CGPoint before[3], CGPoint after[3]) {\n    if (before == NULL || after == NULL) return CGAffineTransformIdentity;\n    \n    CGPoint p1, p2, p3, q1, q2, q3;\n    p1 = before[0]; p2 = before[1]; p3 = before[2];\n    q1 =  after[0]; q2 =  after[1]; q3 =  after[2];\n    \n    double A[36];\n    A[ 0] = p1.x; A[ 1] = p1.y; A[ 2] = 0; A[ 3] = 0; A[ 4] = 1; A[ 5] = 0;\n    A[ 6] = 0; A[ 7] = 0; A[ 8] = p1.x; A[ 9] = p1.y; A[10] = 0; A[11] = 1;\n    A[12] = p2.x; A[13] = p2.y; A[14] = 0; A[15] = 0; A[16] = 1; A[17] = 0;\n    A[18] = 0; A[19] = 0; A[20] = p2.x; A[21] = p2.y; A[22] = 0; A[23] = 1;\n    A[24] = p3.x; A[25] = p3.y; A[26] = 0; A[27] = 0; A[28] = 1; A[29] = 0;\n    A[30] = 0; A[31] = 0; A[32] = p3.x; A[33] = p3.y; A[34] = 0; A[35] = 1;\n    \n    int error = matrix_invert(6, A);\n    if (error) return CGAffineTransformIdentity;\n    \n    double B[6];\n    B[0] = q1.x; B[1] = q1.y; B[2] = q2.x; B[3] = q2.y; B[4] = q3.x; B[5] = q3.y;\n    \n    double M[6];\n    M[0] = A[ 0] * B[0] + A[ 1] * B[1] + A[ 2] * B[2] + A[ 3] * B[3] + A[ 4] * B[4] + A[ 5] * B[5];\n    M[1] = A[ 6] * B[0] + A[ 7] * B[1] + A[ 8] * B[2] + A[ 9] * B[3] + A[10] * B[4] + A[11] * B[5];\n    M[2] = A[12] * B[0] + A[13] * B[1] + A[14] * B[2] + A[15] * B[3] + A[16] * B[4] + A[17] * B[5];\n    M[3] = A[18] * B[0] + A[19] * B[1] + A[20] * B[2] + A[21] * B[3] + A[22] * B[4] + A[23] * B[5];\n    M[4] = A[24] * B[0] + A[25] * B[1] + A[26] * B[2] + A[27] * B[3] + A[28] * B[4] + A[29] * B[5];\n    M[5] = A[30] * B[0] + A[31] * B[1] + A[32] * B[2] + A[33] * B[3] + A[34] * B[4] + A[35] * B[5];\n    \n    CGAffineTransform transform = CGAffineTransformMake(M[0], M[2], M[1], M[3], M[4], M[5]);\n    return transform;\n}\n\nCGAffineTransform YYTextCGAffineTransformGetFromViews(UIView *from, UIView *to) {\n    if (!from || !to) return CGAffineTransformIdentity;\n    \n    CGPoint before[3], after[3];\n    before[0] = CGPointMake(0, 0);\n    before[1] = CGPointMake(0, 1);\n    before[2] = CGPointMake(1, 0);\n    after[0] = [from yy_convertPoint:before[0] toViewOrWindow:to];\n    after[1] = [from yy_convertPoint:before[1] toViewOrWindow:to];\n    after[2] = [from yy_convertPoint:before[2] toViewOrWindow:to];\n    \n    return YYTextCGAffineTransformGetFromPoints(before, after);\n}\n\nUIViewContentMode YYTextCAGravityToUIViewContentMode(NSString *gravity) {\n    static NSDictionary *dic;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        dic = @{ kCAGravityCenter:@(UIViewContentModeCenter),\n                 kCAGravityTop:@(UIViewContentModeTop),\n                 kCAGravityBottom:@(UIViewContentModeBottom),\n                 kCAGravityLeft:@(UIViewContentModeLeft),\n                 kCAGravityRight:@(UIViewContentModeRight),\n                 kCAGravityTopLeft:@(UIViewContentModeTopLeft),\n                 kCAGravityTopRight:@(UIViewContentModeTopRight),\n                 kCAGravityBottomLeft:@(UIViewContentModeBottomLeft),\n                 kCAGravityBottomRight:@(UIViewContentModeBottomRight),\n                 kCAGravityResize:@(UIViewContentModeScaleToFill),\n                 kCAGravityResizeAspect:@(UIViewContentModeScaleAspectFit),\n                 kCAGravityResizeAspectFill:@(UIViewContentModeScaleAspectFill) };\n    });\n    if (!gravity) return UIViewContentModeScaleToFill;\n    return (UIViewContentMode)((NSNumber *)dic[gravity]).integerValue;\n}\n\nNSString *YYTextUIViewContentModeToCAGravity(UIViewContentMode contentMode) {\n    switch (contentMode) {\n        case UIViewContentModeScaleToFill: return kCAGravityResize;\n        case UIViewContentModeScaleAspectFit: return kCAGravityResizeAspect;\n        case UIViewContentModeScaleAspectFill: return kCAGravityResizeAspectFill;\n        case UIViewContentModeRedraw: return kCAGravityResize;\n        case UIViewContentModeCenter: return kCAGravityCenter;\n        case UIViewContentModeTop: return kCAGravityTop;\n        case UIViewContentModeBottom: return kCAGravityBottom;\n        case UIViewContentModeLeft: return kCAGravityLeft;\n        case UIViewContentModeRight: return kCAGravityRight;\n        case UIViewContentModeTopLeft: return kCAGravityTopLeft;\n        case UIViewContentModeTopRight: return kCAGravityTopRight;\n        case UIViewContentModeBottomLeft: return kCAGravityBottomLeft;\n        case UIViewContentModeBottomRight: return kCAGravityBottomRight;\n        default: return kCAGravityResize;\n    }\n}\n\nCGRect YYTextCGRectFitWithContentMode(CGRect rect, CGSize size, UIViewContentMode mode) {\n    rect = CGRectStandardize(rect);\n    size.width = size.width < 0 ? -size.width : size.width;\n    size.height = size.height < 0 ? -size.height : size.height;\n    CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));\n    switch (mode) {\n        case UIViewContentModeScaleAspectFit:\n        case UIViewContentModeScaleAspectFill: {\n            if (rect.size.width < 0.01 || rect.size.height < 0.01 ||\n                size.width < 0.01 || size.height < 0.01) {\n                rect.origin = center;\n                rect.size = CGSizeZero;\n            } else {\n                CGFloat scale;\n                if (mode == UIViewContentModeScaleAspectFit) {\n                    if (size.width / size.height < rect.size.width / rect.size.height) {\n                        scale = rect.size.height / size.height;\n                    } else {\n                        scale = rect.size.width / size.width;\n                    }\n                } else {\n                    if (size.width / size.height < rect.size.width / rect.size.height) {\n                        scale = rect.size.width / size.width;\n                    } else {\n                        scale = rect.size.height / size.height;\n                    }\n                }\n                size.width *= scale;\n                size.height *= scale;\n                rect.size = size;\n                rect.origin = CGPointMake(center.x - size.width * 0.5, center.y - size.height * 0.5);\n            }\n        } break;\n        case UIViewContentModeCenter: {\n            rect.size = size;\n            rect.origin = CGPointMake(center.x - size.width * 0.5, center.y - size.height * 0.5);\n        } break;\n        case UIViewContentModeTop: {\n            rect.origin.x = center.x - size.width * 0.5;\n            rect.size = size;\n        } break;\n        case UIViewContentModeBottom: {\n            rect.origin.x = center.x - size.width * 0.5;\n            rect.origin.y += rect.size.height - size.height;\n            rect.size = size;\n        } break;\n        case UIViewContentModeLeft: {\n            rect.origin.y = center.y - size.height * 0.5;\n            rect.size = size;\n        } break;\n        case UIViewContentModeRight: {\n            rect.origin.y = center.y - size.height * 0.5;\n            rect.origin.x += rect.size.width - size.width;\n            rect.size = size;\n        } break;\n        case UIViewContentModeTopLeft: {\n            rect.size = size;\n        } break;\n        case UIViewContentModeTopRight: {\n            rect.origin.x += rect.size.width - size.width;\n            rect.size = size;\n        } break;\n        case UIViewContentModeBottomLeft: {\n            rect.origin.y += rect.size.height - size.height;\n            rect.size = size;\n        } break;\n        case UIViewContentModeBottomRight: {\n            rect.origin.x += rect.size.width - size.width;\n            rect.origin.y += rect.size.height - size.height;\n            rect.size = size;\n        } break;\n        case UIViewContentModeScaleToFill:\n        case UIViewContentModeRedraw:\n        default: {\n            rect = rect;\n        }\n    }\n    return rect;\n}\n\nCGFloat YYTextScreenScale() {\n    static CGFloat scale;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        scale = [UIScreen mainScreen].scale;\n    });\n    return scale;\n}\n\nCGSize YYTextScreenSize() {\n    static CGSize size;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        size = [UIScreen mainScreen].bounds.size;\n        if (size.height < size.width) {\n            CGFloat tmp = size.height;\n            size.height = size.width;\n            size.width = tmp;\n        }\n    });\n    return size;\n}\n\n\nBOOL YYTextIsAppExtension() {\n    static BOOL isAppExtension = NO;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        Class cls = NSClassFromString(@\"UIApplication\");\n        if(!cls || ![cls respondsToSelector:@selector(sharedApplication)]) isAppExtension = YES;\n        if ([[[NSBundle mainBundle] bundlePath] hasSuffix:@\".appex\"]) isAppExtension = YES;\n    });\n    return isAppExtension;\n}\n\nUIApplication *YYTextSharedApplication() {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wundeclared-selector\"\n    return YYTextIsAppExtension() ? nil : [UIApplication performSelector:@selector(sharedApplication)];\n#pragma clang diagnostic pop\n}\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextWeakProxy.h",
    "content": "//\n//  YYTextWeakProxy.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/18.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <Foundation/Foundation.h>\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n A proxy used to hold a weak object.\n It can be used to avoid retain cycles, such as the target in NSTimer or CADisplayLink.\n \n sample code:\n \n     @implementation MyView {\n        NSTimer *_timer;\n     }\n     \n     - (void)initTimer {\n        YYTextWeakProxy *proxy = [YYTextWeakProxy proxyWithTarget:self];\n        _timer = [NSTimer timerWithTimeInterval:0.1 target:proxy selector:@selector(tick:) userInfo:nil repeats:YES];\n     }\n     \n     - (void)tick:(NSTimer *)timer {...}\n     @end\n */\n@interface YYTextWeakProxy : NSProxy\n\n/**\n The proxy target.\n */\n@property (nullable, nonatomic, weak, readonly) id target;\n\n/**\n Creates a new weak proxy for target.\n \n @param target Target object.\n \n @return A new proxy object.\n */\n- (instancetype)initWithTarget:(id)target;\n\n/**\n Creates a new weak proxy for target.\n \n @param target Target object.\n \n @return A new proxy object.\n */\n+ (instancetype)proxyWithTarget:(id)target;\n\n@end\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/Utility/YYTextWeakProxy.m",
    "content": "//\n//  YYTextWeakProxy.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 14/10/18.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextWeakProxy.h\"\n\n\n@implementation YYTextWeakProxy\n\n- (instancetype)initWithTarget:(id)target {\n    _target = target;\n    return self;\n}\n\n+ (instancetype)proxyWithTarget:(id)target {\n    return [[YYTextWeakProxy alloc] initWithTarget:target];\n}\n\n- (id)forwardingTargetForSelector:(SEL)selector {\n    return _target;\n}\n\n- (void)forwardInvocation:(NSInvocation *)invocation {\n    void *null = NULL;\n    [invocation setReturnValue:&null];\n}\n\n- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {\n    return [NSObject instanceMethodSignatureForSelector:@selector(init)];\n}\n\n- (BOOL)respondsToSelector:(SEL)aSelector {\n    return [_target respondsToSelector:aSelector];\n}\n\n- (BOOL)isEqual:(id)object {\n    return [_target isEqual:object];\n}\n\n- (NSUInteger)hash {\n    return [_target hash];\n}\n\n- (Class)superclass {\n    return [_target superclass];\n}\n\n- (Class)class {\n    return [_target class];\n}\n\n- (BOOL)isKindOfClass:(Class)aClass {\n    return [_target isKindOfClass:aClass];\n}\n\n- (BOOL)isMemberOfClass:(Class)aClass {\n    return [_target isMemberOfClass:aClass];\n}\n\n- (BOOL)conformsToProtocol:(Protocol *)aProtocol {\n    return [_target conformsToProtocol:aProtocol];\n}\n\n- (BOOL)isProxy {\n    return YES;\n}\n\n- (NSString *)description {\n    return [_target description];\n}\n\n- (NSString *)debugDescription {\n    return [_target debugDescription];\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/YYLabel.h",
    "content": "//\n//  YYLabel.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextParser.h>\n#import <YYText/YYTextLayout.h>\n#import <YYText/YYTextAttribute.h>\n#else\n#import \"YYTextParser.h\"\n#import \"YYTextLayout.h\"\n#import \"YYTextAttribute.h\"\n#endif\n\nNS_ASSUME_NONNULL_BEGIN\n\n#if !TARGET_INTERFACE_BUILDER\n\n/**\n The YYLabel class implements a read-only text view.\n \n @discussion The API and behavior is similar to UILabel, but provides more features:\n \n * It supports asynchronous layout and rendering (to avoid blocking UI thread).\n * It extends the CoreText attributes to support more text effects.\n * It allows to add UIImage, UIView and CALayer as text attachments.\n * It allows to add 'highlight' link to some range of text to allow user interact with.\n * It allows to add container path and exclusion paths to control text container's shape.\n * It supports vertical form layout to display CJK text.\n \n See NSAttributedString+YYText.h for more convenience methods to set the attributes.\n See YYTextAttribute.h and YYTextLayout.h for more information.\n */\n@interface YYLabel : UIView <NSCoding>\n\n#pragma mark - Accessing the Text Attributes\n///=============================================================================\n/// @name Accessing the Text Attributes\n///=============================================================================\n\n/**\n The text displayed by the label. Default is nil.\n Set a new value to this property also replaces the text in `attributedText`.\n Get the value returns the plain text in `attributedText`.\n */\n@property (nullable, nonatomic, copy) NSString *text;\n\n/**\n The font of the text. Default is 17-point system font.\n Set a new value to this property also causes the new font to be applied to the entire `attributedText`.\n Get the value returns the font at the head of `attributedText`.\n */\n@property (null_resettable, nonatomic, strong) UIFont *font;\n\n/**\n The color of the text. Default is black.\n Set a new value to this property also causes the new color to be applied to the entire `attributedText`.\n Get the value returns the color at the head of `attributedText`.\n */\n@property (null_resettable, nonatomic, strong) UIColor *textColor;\n\n/**\n The shadow color of the text. Default is nil.\n Set a new value to this property also causes the shadow color to be applied to the entire `attributedText`.\n Get the value returns the shadow color at the head of `attributedText`.\n */\n@property (nullable, nonatomic, strong) UIColor *shadowColor;\n\n/**\n The shadow offset of the text. Default is CGSizeZero.\n Set a new value to this property also causes the shadow offset to be applied to the entire `attributedText`.\n Get the value returns the shadow offset at the head of `attributedText`.\n */\n@property (nonatomic) CGSize shadowOffset;\n\n/**\n The shadow blur of the text. Default is 0.\n Set a new value to this property also causes the shadow blur to be applied to the entire `attributedText`.\n Get the value returns the shadow blur at the head of `attributedText`.\n */\n@property (nonatomic) CGFloat shadowBlurRadius;\n\n/**\n The technique to use for aligning the text. Default is NSTextAlignmentNatural.\n Set a new value to this property also causes the new alignment to be applied to the entire `attributedText`.\n Get the value returns the alignment at the head of `attributedText`.\n */\n@property (nonatomic) NSTextAlignment textAlignment;\n\n/**\n The text vertical aligmnent in container. Default is YYTextVerticalAlignmentCenter.\n */\n@property (nonatomic) YYTextVerticalAlignment textVerticalAlignment;\n\n/**\n The styled text displayed by the label.\n Set a new value to this property also replaces the value of the `text`, `font`, `textColor`,\n `textAlignment` and other properties in label.\n \n @discussion It only support the attributes declared in CoreText and YYTextAttribute.\n See `NSAttributedString+YYText` for more convenience methods to set the attributes.\n */\n@property (nullable, nonatomic, copy) NSAttributedString *attributedText;\n\n/**\n The technique to use for wrapping and truncating the label's text.\n Default is NSLineBreakByTruncatingTail.\n */\n@property (nonatomic) NSLineBreakMode lineBreakMode;\n\n/**\n The truncation token string used when text is truncated. Default is nil.\n When the value is nil, the label use \"…\" as default truncation token.\n */\n@property (nullable, nonatomic, copy) NSAttributedString *truncationToken;\n\n/**\n The maximum number of lines to use for rendering text. Default value is 1.\n 0 means no limit.\n */\n@property (nonatomic) NSUInteger numberOfLines;\n\n/**\n When `text` or `attributedText` is changed, the parser will be called to modify the text.\n It can be used to add code highlighting or emoticon replacement to text view. \n The default value is nil.\n \n See `YYTextParser` protocol for more information.\n */\n@property (nullable, nonatomic, strong) id<YYTextParser> textParser;\n\n/**\n The current text layout in text view. It can be used to query the text layout information.\n Set a new value to this property also replaces most properties in this label, such as `text`,\n `color`, `attributedText`, `lineBreakMode`, `textContainerPath`, `exclusionPaths` and so on.\n */\n@property (nullable, nonatomic, strong) YYTextLayout *textLayout;\n\n\n#pragma mark - Configuring the Text Container\n///=============================================================================\n/// @name Configuring the Text Container\n///=============================================================================\n\n/**\n A UIBezierPath object that specifies the shape of the text frame. Default value is nil.\n */\n@property (nullable, nonatomic, copy) UIBezierPath *textContainerPath;\n\n/**\n An array of UIBezierPath objects representing the exclusion paths inside the\n receiver's bounding rectangle. Default value is nil.\n */\n@property (nullable, nonatomic, copy) NSArray<UIBezierPath *> *exclusionPaths;\n\n/**\n The inset of the text container's layout area within the text view's content area.\n Default value is UIEdgeInsetsZero.\n */\n@property (nonatomic) UIEdgeInsets textContainerInset;\n\n/**\n Whether the receiver's layout orientation is vertical form. Default is NO.\n It may used to display CJK text.\n */\n@property (nonatomic, getter=isVerticalForm) BOOL verticalForm;\n\n/**\n The text line position modifier used to modify the lines' position in layout.\n Default value is nil.\n See `YYTextLinePositionModifier` protocol for more information.\n */\n@property (nullable, nonatomic, copy) id<YYTextLinePositionModifier> linePositionModifier;\n\n/**\n The debug option to display CoreText layout result.\n The default value is [YYTextDebugOption sharedDebugOption].\n */\n@property (nullable, nonatomic, copy) YYTextDebugOption *debugOption;\n\n\n#pragma mark - Getting the Layout Constraints\n///=============================================================================\n/// @name Getting the Layout Constraints\n///=============================================================================\n\n/**\n The preferred maximum width (in points) for a multiline label.\n \n @discussion This property affects the size of the label when layout constraints \n     are applied to it. During layout, if the text extends beyond the width \n     specified by this property, the additional text is flowed to one or more new \n     lines, thereby increasing the height of the label. If the text is vertical \n     form, this value will match to text height.\n */\n@property (nonatomic) CGFloat preferredMaxLayoutWidth;\n\n\n#pragma mark - Interacting with Text Data\n///=============================================================================\n/// @name Interacting with Text Data\n///=============================================================================\n\n/**\n When user tap the label, this action will be called (similar to tap gesture).\n The default value is nil.\n */\n@property (nullable, nonatomic, copy) YYTextAction textTapAction;\n\n/**\n When user long press the label, this action will be called (similar to long press gesture).\n The default value is nil.\n */\n@property (nullable, nonatomic, copy) YYTextAction textLongPressAction;\n\n/**\n When user tap the highlight range of text, this action will be called.\n The default value is nil.\n */\n@property (nullable, nonatomic, copy) YYTextAction highlightTapAction;\n\n/**\n When user long press the highlight range of text, this action will be called.\n The default value is nil. \n */\n@property (nullable, nonatomic, copy) YYTextAction highlightLongPressAction;\n\n\n#pragma mark - Configuring the Display Mode\n///=============================================================================\n/// @name Configuring the Display Mode\n///=============================================================================\n\n/**\n A Boolean value indicating whether the layout and rendering codes are running\n asynchronously on background threads. \n \n The default value is `NO`.\n */\n@property (nonatomic) BOOL displaysAsynchronously;\n\n/**\n If the value is YES, and the layer is rendered asynchronously, then it will\n set label.layer.contents to nil before display. \n \n The default value is `YES`.\n \n @discussion When the asynchronously display is enabled, the layer's content will\n be updated after the background render process finished. If the render process\n can not finished in a vsync time (1/60 second), the old content will be still kept\n for display. You may manually clear the content by set the layer.contents to nil \n after you update the label's properties, or you can just set this property to YES.\n */\n@property (nonatomic) BOOL clearContentsBeforeAsynchronouslyDisplay;\n\n/**\n If the value is YES, and the layer is rendered asynchronously, then it will add \n a fade animation on layer when the contents of layer changed. \n \n The default value is `YES`.\n */\n@property (nonatomic) BOOL fadeOnAsynchronouslyDisplay;\n\n/**\n If the value is YES, then it will add a fade animation on layer when some range\n of text become highlighted. \n \n The default value is `YES`.\n */\n@property (nonatomic) BOOL fadeOnHighlight;\n\n/**\n Ignore common properties (such as text, font, textColor, attributedText...) and\n only use \"textLayout\" to display content. \n \n The default value is `NO`.\n \n @discussion If you control the label content only through \"textLayout\", then\n you may set this value to YES for higher performance.\n */\n@property (nonatomic) BOOL ignoreCommonProperties;\n\n/*\n Tips:\n \n 1. If you only need a UILabel alternative to display rich text and receive link touch event, \n    you do not need to adjust the display mode properties.\n \n 2. If you have performance issues, you may enable the asynchronous display mode\n    by setting the `displaysAsynchronously` to YES.\n \n 3. If you want to get the highest performance, you should do text layout with\n    `YYTextLayout` class in background thread. Here's an example:\n    \n    YYLabel *label = [YYLabel new];\n    label.displaysAsynchronously = YES;\n    label.ignoreCommonProperties = YES;\n    \n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n \n        // Create attributed string.\n        NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@\"Some Text\"];\n        text.yy_font = [UIFont systemFontOfSize:16];\n        text.yy_color = [UIColor grayColor];\n        [text yy_setColor:[UIColor redColor] range:NSMakeRange(0, 4)];\n \n        // Create text container\n        YYTextContainer *container = [YYTextContainer new];\n        container.size = CGSizeMake(100, CGFLOAT_MAX);\n        container.maximumNumberOfRows = 0;\n        \n        // Generate a text layout.\n        YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];\n        \n        dispatch_async(dispatch_get_main_queue(), ^{\n            label.size = layout.textBoundingSize;\n            label.textLayout = layout;\n        });\n    });\n \n */\n\n@end\n\n\n#else // TARGET_INTERFACE_BUILDER\nIB_DESIGNABLE\n@interface YYLabel : UIView <NSCoding>\n@property (nullable, nonatomic, copy) IBInspectable NSString *text;\n@property (null_resettable, nonatomic, strong) IBInspectable UIColor *textColor;\n@property (nullable, nonatomic, strong) IBInspectable NSString *fontName_;\n@property (nonatomic) IBInspectable CGFloat fontSize_;\n@property (nonatomic) IBInspectable BOOL fontIsBold_;\n@property (nonatomic) IBInspectable NSUInteger numberOfLines;\n@property (nonatomic) IBInspectable NSInteger lineBreakMode;\n@property (nonatomic) IBInspectable CGFloat preferredMaxLayoutWidth;\n@property (nonatomic, getter=isVerticalForm) IBInspectable BOOL verticalForm;\n@property (nonatomic) IBInspectable NSInteger textAlignment;\n@property (nonatomic) IBInspectable NSInteger textVerticalAlignment;\n@property (nullable, nonatomic, strong) IBInspectable UIColor *shadowColor;\n@property (nonatomic) IBInspectable CGPoint shadowOffset;\n@property (nonatomic) IBInspectable CGFloat shadowBlurRadius;\n@property (nullable, nonatomic, copy) IBInspectable NSAttributedString *attributedText;\n@property (nonatomic) IBInspectable CGFloat insetTop_;\n@property (nonatomic) IBInspectable CGFloat insetBottom_;\n@property (nonatomic) IBInspectable CGFloat insetLeft_;\n@property (nonatomic) IBInspectable CGFloat insetRight_;\n@property (nonatomic) IBInspectable BOOL debugEnabled_;\n\n@property (null_resettable, nonatomic, strong) UIFont *font;\n@property (nullable, nonatomic, copy) NSAttributedString *truncationToken;\n@property (nullable, nonatomic, strong) id<YYTextParser> textParser;\n@property (nullable, nonatomic, strong) YYTextLayout *textLayout;\n@property (nullable, nonatomic, copy) UIBezierPath *textContainerPath;\n@property (nullable, nonatomic, copy) NSArray<UIBezierPath*> *exclusionPaths;\n@property (nonatomic) UIEdgeInsets textContainerInset;\n@property (nullable, nonatomic, copy) id<YYTextLinePositionModifier> linePositionModifier;\n@property (nonnull, nonatomic, copy) YYTextDebugOption *debugOption;\n@property (nullable, nonatomic, copy) YYTextAction textTapAction;\n@property (nullable, nonatomic, copy) YYTextAction textLongPressAction;\n@property (nullable, nonatomic, copy) YYTextAction highlightTapAction;\n@property (nullable, nonatomic, copy) YYTextAction highlightLongPressAction;\n@property (nonatomic) BOOL displaysAsynchronously;\n@property (nonatomic) BOOL clearContentsBeforeAsynchronouslyDisplay;\n@property (nonatomic) BOOL fadeOnAsynchronouslyDisplay;\n@property (nonatomic) BOOL fadeOnHighlight;\n@property (nonatomic) BOOL ignoreCommonProperties;\n@end\n#endif // !TARGET_INTERFACE_BUILDER\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/YYLabel.m",
    "content": "//\n//  YYLabel.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYLabel.h\"\n#import \"YYTextAsyncLayer.h\"\n#import \"YYTextWeakProxy.h\"\n#import \"YYTextUtilities.h\"\n#import \"NSAttributedString+YYText.h\"\n#import <libkern/OSAtomic.h>\n\n\nstatic dispatch_queue_t YYLabelGetReleaseQueue() {\n    return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);\n}\n\n\n#define kLongPressMinimumDuration 0.5 // Time in seconds the fingers must be held down for long press gesture.\n#define kLongPressAllowableMovement 9.0 // Maximum movement in points allowed before the long press fails.\n#define kHighlightFadeDuration 0.15 // Time in seconds for highlight fadeout animation.\n#define kAsyncFadeDuration 0.08 // Time in seconds for async display fadeout animation.\n\n\n@interface YYLabel() <YYTextDebugTarget, YYTextAsyncLayerDelegate> {\n    NSMutableAttributedString *_innerText; ///< nonnull\n    YYTextLayout *_innerLayout;\n    YYTextContainer *_innerContainer; ///< nonnull\n    \n    NSMutableArray *_attachmentViews;\n    NSMutableArray *_attachmentLayers;\n    \n    NSRange _highlightRange; ///< current highlight range\n    YYTextHighlight *_highlight; ///< highlight attribute in `_highlightRange`\n    YYTextLayout *_highlightLayout; ///< when _state.showingHighlight=YES, this layout should be displayed\n    \n    YYTextLayout *_shrinkInnerLayout;\n    YYTextLayout *_shrinkHighlightLayout;\n    \n    NSTimer *_longPressTimer;\n    CGPoint _touchBeganPoint;\n    \n    struct {\n        unsigned int layoutNeedUpdate : 1;\n        unsigned int showingHighlight : 1;\n        \n        unsigned int trackingTouch : 1;\n        unsigned int swallowTouch : 1;\n        unsigned int touchMoved : 1;\n        \n        unsigned int hasTapAction : 1;\n        unsigned int hasLongPressAction : 1;\n        \n        unsigned int contentsNeedFade : 1;\n    } _state;\n}\n@end\n\n\n@implementation YYLabel\n\n#pragma mark - Private\n\n- (void)_updateIfNeeded {\n    if (_state.layoutNeedUpdate) {\n        _state.layoutNeedUpdate = NO;\n        [self _updateLayout];\n        [self.layer setNeedsDisplay];\n    }\n}\n\n- (void)_updateLayout {\n    _innerLayout = [YYTextLayout layoutWithContainer:_innerContainer text:_innerText];\n    _shrinkInnerLayout = [YYLabel _shrinkLayoutWithLayout:_innerLayout];\n}\n\n- (void)_setLayoutNeedUpdate {\n    _state.layoutNeedUpdate = YES;\n    [self _clearInnerLayout];\n    [self _setLayoutNeedRedraw];\n}\n\n- (void)_setLayoutNeedRedraw {\n    [self.layer setNeedsDisplay];\n}\n\n- (void)_clearInnerLayout {\n    if (!_innerLayout) return;\n    YYTextLayout *layout = _innerLayout;\n    _innerLayout = nil;\n    _shrinkInnerLayout = nil;\n    dispatch_async(YYLabelGetReleaseQueue(), ^{\n        NSAttributedString *text = [layout text]; // capture to block and release in background\n        if (layout.attachments.count) {\n            dispatch_async(dispatch_get_main_queue(), ^{\n                [text length]; // capture to block and release in main thread (maybe there's UIView/CALayer attachments).\n            });\n        }\n    });\n}\n\n- (YYTextLayout *)_innerLayout {\n    return _shrinkInnerLayout ? _shrinkInnerLayout : _innerLayout;\n}\n\n- (YYTextLayout *)_highlightLayout {\n    return _shrinkHighlightLayout ? _shrinkHighlightLayout : _highlightLayout;\n}\n\n+ (YYTextLayout *)_shrinkLayoutWithLayout:(YYTextLayout *)layout {\n    if (layout.text.length && layout.lines.count == 0) {\n        YYTextContainer *container = layout.container.copy;\n        container.maximumNumberOfRows = 1;\n        CGSize containerSize = container.size;\n        if (!container.verticalForm) {\n            containerSize.height = YYTextContainerMaxSize.height;\n        } else {\n            containerSize.width = YYTextContainerMaxSize.width;\n        }\n        container.size = containerSize;\n        return [YYTextLayout layoutWithContainer:container text:layout.text];\n    } else {\n        return nil;\n    }\n}\n\n- (void)_startLongPressTimer {\n    [_longPressTimer invalidate];\n    _longPressTimer = [NSTimer timerWithTimeInterval:kLongPressMinimumDuration\n                                              target:[YYTextWeakProxy proxyWithTarget:self]\n                                            selector:@selector(_trackDidLongPress)\n                                            userInfo:nil\n                                             repeats:NO];\n    [[NSRunLoop currentRunLoop] addTimer:_longPressTimer forMode:NSRunLoopCommonModes];\n}\n\n- (void)_endLongPressTimer {\n    [_longPressTimer invalidate];\n    _longPressTimer = nil;\n}\n\n- (void)_trackDidLongPress {\n    [self _endLongPressTimer];\n    if (_state.hasLongPressAction && _textLongPressAction) {\n        NSRange range = NSMakeRange(NSNotFound, 0);\n        CGRect rect = CGRectNull;\n        CGPoint point = [self _convertPointToLayout:_touchBeganPoint];\n        YYTextRange *textRange = [self._innerLayout textRangeAtPoint:point];\n        CGRect textRect = [self._innerLayout rectForRange:textRange];\n        textRect = [self _convertRectFromLayout:textRect];\n        if (textRange) {\n            range = textRange.asRange;\n            rect = textRect;\n        }\n        _textLongPressAction(self, _innerText, range, rect);\n    }\n    if (_highlight) {\n        YYTextAction longPressAction = _highlight.longPressAction ? _highlight.longPressAction : _highlightLongPressAction;\n        if (longPressAction) {\n            YYTextPosition *start = [YYTextPosition positionWithOffset:_highlightRange.location];\n            YYTextPosition *end = [YYTextPosition positionWithOffset:_highlightRange.location + _highlightRange.length affinity:YYTextAffinityBackward];\n            YYTextRange *range = [YYTextRange rangeWithStart:start end:end];\n            CGRect rect = [self._innerLayout rectForRange:range];\n            rect = [self _convertRectFromLayout:rect];\n            longPressAction(self, _innerText, _highlightRange, rect);\n            [self _removeHighlightAnimated:YES];\n            _state.trackingTouch = NO;\n        }\n    }\n}\n\n- (YYTextHighlight *)_getHighlightAtPoint:(CGPoint)point range:(NSRangePointer)range {\n    if (!self._innerLayout.containsHighlight) return nil;\n    point = [self _convertPointToLayout:point];\n    YYTextRange *textRange = [self._innerLayout textRangeAtPoint:point];\n    if (!textRange) return nil;\n    \n    NSUInteger startIndex = textRange.start.offset;\n    if (startIndex == _innerText.length) {\n        if (startIndex > 0) {\n            startIndex--;\n        }\n    }\n    NSRange highlightRange = {0};\n    YYTextHighlight *highlight = [_innerText attribute:YYTextHighlightAttributeName\n                                               atIndex:startIndex\n                                 longestEffectiveRange:&highlightRange\n                                               inRange:NSMakeRange(0, _innerText.length)];\n    \n    if (!highlight) return nil;\n    if (range) *range = highlightRange;\n    return highlight;\n}\n\n- (void)_showHighlightAnimated:(BOOL)animated {\n    if (!_highlight) return;\n    if (!_highlightLayout) {\n        NSMutableAttributedString *hiText = _innerText.mutableCopy;\n        NSDictionary *newAttrs = _highlight.attributes;\n        [newAttrs enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) {\n            [hiText yy_setAttribute:key value:value range:_highlightRange];\n        }];\n        _highlightLayout = [YYTextLayout layoutWithContainer:_innerContainer text:hiText];\n        _shrinkHighlightLayout = [YYLabel _shrinkLayoutWithLayout:_highlightLayout];\n        if (!_highlightLayout) _highlight = nil;\n    }\n    \n    if (_highlightLayout && !_state.showingHighlight) {\n        _state.showingHighlight = YES;\n        _state.contentsNeedFade = animated;\n        [self _setLayoutNeedRedraw];\n    }\n}\n\n- (void)_hideHighlightAnimated:(BOOL)animated {\n    if (_state.showingHighlight) {\n        _state.showingHighlight = NO;\n        _state.contentsNeedFade = animated;\n        [self _setLayoutNeedRedraw];\n    }\n}\n\n- (void)_removeHighlightAnimated:(BOOL)animated {\n    [self _hideHighlightAnimated:animated];\n    _highlight = nil;\n    _highlightLayout = nil;\n    _shrinkHighlightLayout = nil;\n}\n\n- (void)_endTouch {\n    [self _endLongPressTimer];\n    [self _removeHighlightAnimated:YES];\n    _state.trackingTouch = NO;\n}\n\n- (CGPoint)_convertPointToLayout:(CGPoint)point {\n    CGSize boundingSize = self._innerLayout.textBoundingSize;\n    if (self._innerLayout.container.isVerticalForm) {\n        CGFloat w = self._innerLayout.textBoundingSize.width;\n        if (w < self.bounds.size.width) w = self.bounds.size.width;\n        point.x += self._innerLayout.container.size.width - w;\n        if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n            point.x += (self.bounds.size.width - boundingSize.width) * 0.5;\n        } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n            point.x += (self.bounds.size.width - boundingSize.width);\n        }\n        return point;\n    } else {\n        if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n            point.y -= (self.bounds.size.height - boundingSize.height) * 0.5;\n        } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n            point.y -= (self.bounds.size.height - boundingSize.height);\n        }\n        return point;\n    }\n}\n\n- (CGPoint)_convertPointFromLayout:(CGPoint)point {\n    CGSize boundingSize = self._innerLayout.textBoundingSize;\n    if (self._innerLayout.container.isVerticalForm) {\n        CGFloat w = self._innerLayout.textBoundingSize.width;\n        if (w < self.bounds.size.width) w = self.bounds.size.width;\n        point.x -= self._innerLayout.container.size.width - w;\n        if (boundingSize.width < self.bounds.size.width) {\n            if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n                point.x -= (self.bounds.size.width - boundingSize.width) * 0.5;\n            } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n                point.x -= (self.bounds.size.width - boundingSize.width);\n            }\n        }\n        return point;\n    } else {\n        if (boundingSize.height < self.bounds.size.height) {\n            if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n                point.y += (self.bounds.size.height - boundingSize.height) * 0.5;\n            } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n                point.y += (self.bounds.size.height - boundingSize.height);\n            }\n        }\n        return point;\n    }\n}\n\n- (CGRect)_convertRectToLayout:(CGRect)rect {\n    rect.origin = [self _convertPointToLayout:rect.origin];\n    return rect;\n}\n\n- (CGRect)_convertRectFromLayout:(CGRect)rect {\n    rect.origin = [self _convertPointFromLayout:rect.origin];\n    return rect;\n}\n\n- (UIFont *)_defaultFont {\n    return [UIFont systemFontOfSize:17];\n}\n\n- (NSShadow *)_shadowFromProperties {\n    if (!_shadowColor || _shadowBlurRadius < 0) return nil;\n    NSShadow *shadow = [NSShadow new];\n    shadow.shadowColor = _shadowColor;\n#if !TARGET_INTERFACE_BUILDER\n    shadow.shadowOffset = _shadowOffset;\n#else\n    shadow.shadowOffset = CGSizeMake(_shadowOffset.x, _shadowOffset.y);\n#endif\n    shadow.shadowBlurRadius = _shadowBlurRadius;\n    return shadow;\n}\n\n- (void)_updateOuterLineBreakMode {\n    if (_innerContainer.truncationType) {\n        switch (_innerContainer.truncationType) {\n            case YYTextTruncationTypeStart: {\n                _lineBreakMode = NSLineBreakByTruncatingHead;\n            } break;\n            case YYTextTruncationTypeEnd: {\n                _lineBreakMode = NSLineBreakByTruncatingTail;\n            } break;\n            case YYTextTruncationTypeMiddle: {\n                _lineBreakMode = NSLineBreakByTruncatingMiddle;\n            } break;\n            default:break;\n        }\n    } else {\n        _lineBreakMode = _innerText.yy_lineBreakMode;\n    }\n}\n\n- (void)_updateOuterTextProperties {\n    _text = [_innerText yy_plainTextForRange:NSMakeRange(0, _innerText.length)];\n    _font = _innerText.yy_font;\n    if (!_font) _font = [self _defaultFont];\n    _textColor = _innerText.yy_color;\n    if (!_textColor) _textColor = [UIColor blackColor];\n    _textAlignment = _innerText.yy_alignment;\n    _lineBreakMode = _innerText.yy_lineBreakMode;\n    NSShadow *shadow = _innerText.yy_shadow;\n    _shadowColor = shadow.shadowColor;\n#if !TARGET_INTERFACE_BUILDER\n    _shadowOffset = shadow.shadowOffset;\n#else\n    _shadowOffset = CGPointMake(shadow.shadowOffset.width, shadow.shadowOffset.height);\n#endif\n    \n    _shadowBlurRadius = shadow.shadowBlurRadius;\n    _attributedText = _innerText;\n    [self _updateOuterLineBreakMode];\n}\n\n- (void)_updateOuterContainerProperties {\n    _truncationToken = _innerContainer.truncationToken;\n    _numberOfLines = _innerContainer.maximumNumberOfRows;\n    _textContainerPath = _innerContainer.path;\n    _exclusionPaths = _innerContainer.exclusionPaths;\n    _textContainerInset = _innerContainer.insets;\n    _verticalForm = _innerContainer.verticalForm;\n    _linePositionModifier = _innerContainer.linePositionModifier;\n    [self _updateOuterLineBreakMode];\n}\n\n- (void)_clearContents {\n    CGImageRef image = (__bridge_retained CGImageRef)(self.layer.contents);\n    self.layer.contents = nil;\n    if (image) {\n        dispatch_async(YYLabelGetReleaseQueue(), ^{\n            CFRelease(image);\n        });\n    }\n}\n\n- (void)_initLabel {\n    ((YYTextAsyncLayer *)self.layer).displaysAsynchronously = NO;\n    self.layer.contentsScale = [UIScreen mainScreen].scale;\n    self.contentMode = UIViewContentModeRedraw;\n    \n    _attachmentViews = [NSMutableArray new];\n    _attachmentLayers = [NSMutableArray new];\n    \n    _debugOption = [YYTextDebugOption sharedDebugOption];\n    [YYTextDebugOption addDebugTarget:self];\n    \n    _font = [self _defaultFont];\n    _textColor = [UIColor blackColor];\n    _textVerticalAlignment = YYTextVerticalAlignmentCenter;\n    _numberOfLines = 1;\n    _textAlignment = NSTextAlignmentNatural;\n    _lineBreakMode = NSLineBreakByTruncatingTail;\n    _innerText = [NSMutableAttributedString new];\n    _innerContainer = [YYTextContainer new];\n    _innerContainer.truncationType = YYTextTruncationTypeEnd;\n    _innerContainer.maximumNumberOfRows = _numberOfLines;\n    _clearContentsBeforeAsynchronouslyDisplay = YES;\n    _fadeOnAsynchronouslyDisplay = YES;\n    _fadeOnHighlight = YES;\n    \n    self.isAccessibilityElement = YES;\n}\n\n#pragma mark - Override\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:CGRectZero];\n    if (!self) return nil;\n    self.backgroundColor = [UIColor clearColor];\n    self.opaque = NO;\n    [self _initLabel];\n    self.frame = frame;\n    return self;\n}\n\n- (void)dealloc {\n    [YYTextDebugOption removeDebugTarget:self];\n    [_longPressTimer invalidate];\n}\n\n+ (Class)layerClass {\n    return [YYTextAsyncLayer class];\n}\n\n- (void)setFrame:(CGRect)frame {\n    CGSize oldSize = self.bounds.size;\n    [super setFrame:frame];\n    CGSize newSize = self.bounds.size;\n    if (!CGSizeEqualToSize(oldSize, newSize)) {\n        _innerContainer.size = self.bounds.size;\n        if (!_ignoreCommonProperties) {\n            _state.layoutNeedUpdate = YES;\n        }\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedRedraw];\n    }\n}\n\n- (void)setBounds:(CGRect)bounds {\n    CGSize oldSize = self.bounds.size;\n    [super setBounds:bounds];\n    CGSize newSize = self.bounds.size;\n    if (!CGSizeEqualToSize(oldSize, newSize)) {\n        _innerContainer.size = self.bounds.size;\n        if (!_ignoreCommonProperties) {\n            _state.layoutNeedUpdate = YES;\n        }\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedRedraw];\n    }\n}\n\n- (CGSize)sizeThatFits:(CGSize)size {\n    if (_ignoreCommonProperties) {\n        return _innerLayout.textBoundingSize;\n    }\n    \n    if (!_verticalForm && size.width <= 0) size.width = YYTextContainerMaxSize.width;\n    if (_verticalForm && size.height <= 0) size.height = YYTextContainerMaxSize.height;\n    \n    if ((!_verticalForm && size.width == self.bounds.size.width) ||\n        (_verticalForm && size.height == self.bounds.size.height)) {\n        [self _updateIfNeeded];\n        YYTextLayout *layout = self._innerLayout;\n        BOOL contains = NO;\n        if (layout.container.maximumNumberOfRows == 0) {\n            if (layout.truncatedLine == nil) {\n                contains = YES;\n            }\n        } else {\n            if (layout.rowCount <= layout.container.maximumNumberOfRows) {\n                contains = YES;\n            }\n        }\n        if (contains) {\n            return layout.textBoundingSize;\n        }\n    }\n    \n    if (!_verticalForm) {\n        size.height = YYTextContainerMaxSize.height;\n    } else {\n        size.width = YYTextContainerMaxSize.width;\n    }\n    \n    YYTextContainer *container = [_innerContainer copy];\n    container.size = size;\n    \n    YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:_innerText];\n    return layout.textBoundingSize;\n}\n\n- (NSString *)accessibilityLabel {\n    return [_innerLayout.text yy_plainTextForRange:_innerLayout.text.yy_rangeOfAll];\n}\n\n#pragma mark - NSCoding\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [super encodeWithCoder:aCoder];\n    [aCoder encodeObject:_attributedText forKey:@\"attributedText\"];\n    [aCoder encodeObject:_innerContainer forKey:@\"innerContainer\"];\n}\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    self = [super initWithCoder:aDecoder];\n    [self _initLabel];\n    YYTextContainer *innerContainer = [aDecoder decodeObjectForKey:@\"innerContainer\"];\n    if (innerContainer) {\n        _innerContainer = innerContainer;\n    } else {\n        _innerContainer.size = self.bounds.size;\n    }\n    [self _updateOuterContainerProperties];\n    self.attributedText = [aDecoder decodeObjectForKey:@\"attributedText\"];\n    [self _setLayoutNeedUpdate];\n    return self;\n}\n\n#pragma mark - Touches\n\n- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {\n    [self _updateIfNeeded];\n    UITouch *touch = touches.anyObject;\n    CGPoint point = [touch locationInView:self];\n    \n    _highlight = [self _getHighlightAtPoint:point range:&_highlightRange];\n    _highlightLayout = nil;\n    _shrinkHighlightLayout = nil;\n    _state.hasTapAction = _textTapAction != nil;\n    _state.hasLongPressAction = _textLongPressAction != nil;\n    \n    if (_highlight || _textTapAction || _textLongPressAction) {\n        _touchBeganPoint = point;\n        _state.trackingTouch = YES;\n        _state.swallowTouch = YES;\n        _state.touchMoved = NO;\n        [self _startLongPressTimer];\n        if (_highlight) [self _showHighlightAnimated:NO];\n    } else {\n        _state.trackingTouch = NO;\n        _state.swallowTouch = NO;\n        _state.touchMoved = NO;\n    }\n    if (!_state.swallowTouch) {\n        [super touchesBegan:touches withEvent:event];\n    }\n}\n\n- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {\n    [self _updateIfNeeded];\n    \n    UITouch *touch = touches.anyObject;\n    CGPoint point = [touch locationInView:self];\n    \n    if (_state.trackingTouch) {\n        if (!_state.touchMoved) {\n            CGFloat moveH = point.x - _touchBeganPoint.x;\n            CGFloat moveV = point.y - _touchBeganPoint.y;\n            if (fabs(moveH) > fabs(moveV)) {\n                if (fabs(moveH) > kLongPressAllowableMovement) _state.touchMoved = YES;\n            } else {\n                if (fabs(moveV) > kLongPressAllowableMovement) _state.touchMoved = YES;\n            }\n            if (_state.touchMoved) {\n                [self _endLongPressTimer];\n            }\n        }\n        if (_state.touchMoved && _highlight) {\n            YYTextHighlight *highlight = [self _getHighlightAtPoint:point range:NULL];\n            if (highlight == _highlight) {\n                [self _showHighlightAnimated:_fadeOnHighlight];\n            } else {\n                [self _hideHighlightAnimated:_fadeOnHighlight];\n            }\n        }\n    }\n    \n    if (!_state.swallowTouch) {\n        [super touchesMoved:touches withEvent:event];\n    }\n}\n\n- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {\n    UITouch *touch = touches.anyObject;\n    CGPoint point = [touch locationInView:self];\n    \n    if (_state.trackingTouch) {\n        [self _endLongPressTimer];\n        if (!_state.touchMoved && _textTapAction) {\n            NSRange range = NSMakeRange(NSNotFound, 0);\n            CGRect rect = CGRectNull;\n            CGPoint point = [self _convertPointToLayout:_touchBeganPoint];\n            YYTextRange *textRange = [self._innerLayout textRangeAtPoint:point];\n            CGRect textRect = [self._innerLayout rectForRange:textRange];\n            textRect = [self _convertRectFromLayout:textRect];\n            if (textRange) {\n                range = textRange.asRange;\n                rect = textRect;\n            }\n            _textTapAction(self, _innerText, range, rect);\n        }\n        \n        if (_highlight) {\n            if (!_state.touchMoved || [self _getHighlightAtPoint:point range:NULL] == _highlight) {\n                YYTextAction tapAction = _highlight.tapAction ? _highlight.tapAction : _highlightTapAction;\n                if (tapAction) {\n                    YYTextPosition *start = [YYTextPosition positionWithOffset:_highlightRange.location];\n                    YYTextPosition *end = [YYTextPosition positionWithOffset:_highlightRange.location + _highlightRange.length affinity:YYTextAffinityBackward];\n                    YYTextRange *range = [YYTextRange rangeWithStart:start end:end];\n                    CGRect rect = [self._innerLayout rectForRange:range];\n                    rect = [self _convertRectFromLayout:rect];\n                    tapAction(self, _innerText, _highlightRange, rect);\n                }\n            }\n            [self _removeHighlightAnimated:_fadeOnHighlight];\n        }\n    }\n    \n    if (!_state.swallowTouch) {\n        [super touchesEnded:touches withEvent:event];\n    }\n}\n\n- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {\n    [self _endTouch];\n    if (!_state.swallowTouch) [super touchesCancelled:touches withEvent:event];\n}\n\n#pragma mark - Properties\n\n- (void)setText:(NSString *)text {\n    if (_text == text || [_text isEqualToString:text]) return;\n    _text = text.copy;\n    BOOL needAddAttributes = _innerText.length == 0 && text.length > 0;\n    [_innerText replaceCharactersInRange:NSMakeRange(0, _innerText.length) withString:text ? text : @\"\"];\n    [_innerText yy_removeDiscontinuousAttributesInRange:NSMakeRange(0, _innerText.length)];\n    if (needAddAttributes) {\n        _innerText.yy_font = _font;\n        _innerText.yy_color = _textColor;\n        _innerText.yy_shadow = [self _shadowFromProperties];\n        _innerText.yy_alignment = _textAlignment;\n        switch (_lineBreakMode) {\n            case NSLineBreakByWordWrapping:\n            case NSLineBreakByCharWrapping:\n            case NSLineBreakByClipping: {\n                _innerText.yy_lineBreakMode = _lineBreakMode;\n            } break;\n            case NSLineBreakByTruncatingHead:\n            case NSLineBreakByTruncatingTail:\n            case NSLineBreakByTruncatingMiddle: {\n                _innerText.yy_lineBreakMode = NSLineBreakByWordWrapping;\n            } break;\n            default: break;\n        }\n    }\n    if ([_textParser parseText:_innerText selectedRange:NULL]) {\n        [self _updateOuterTextProperties];\n    }\n    if (!_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setFont:(UIFont *)font {\n    if (!font) {\n        font = [self _defaultFont];\n    }\n    if (_font == font || [_font isEqual:font]) return;\n    _font = font;\n    _innerText.yy_font = _font;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setTextColor:(UIColor *)textColor {\n    if (!textColor) {\n        textColor = [UIColor blackColor];\n    }\n    if (_textColor == textColor || [_textColor isEqual:textColor]) return;\n    _textColor = textColor;\n    _innerText.yy_color = textColor;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n    }\n}\n\n- (void)setShadowColor:(UIColor *)shadowColor {\n    if (_shadowColor == shadowColor || [_shadowColor isEqual:shadowColor]) return;\n    _shadowColor = shadowColor;\n    _innerText.yy_shadow = [self _shadowFromProperties];\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n    }\n}\n\n#if !TARGET_INTERFACE_BUILDER\n- (void)setShadowOffset:(CGSize)shadowOffset {\n    if (CGSizeEqualToSize(_shadowOffset, shadowOffset)) return;\n    _shadowOffset = shadowOffset;\n    _innerText.yy_shadow = [self _shadowFromProperties];\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n    }\n}\n#else\n- (void)setShadowOffset:(CGPoint)shadowOffset {\n    if (CGPointEqualToPoint(_shadowOffset, shadowOffset)) return;\n    _shadowOffset = shadowOffset;\n    _innerText.yy_shadow = [self _shadowFromProperties];\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n    }\n}\n#endif\n\n- (void)setShadowBlurRadius:(CGFloat)shadowBlurRadius {\n    if (_shadowBlurRadius == shadowBlurRadius) return;\n    _shadowBlurRadius = shadowBlurRadius;\n    _innerText.yy_shadow = [self _shadowFromProperties];\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n    }\n}\n\n- (void)setTextAlignment:(NSTextAlignment)textAlignment {\n    if (_textAlignment == textAlignment) return;\n    _textAlignment = textAlignment;\n    _innerText.yy_alignment = textAlignment;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setLineBreakMode:(NSLineBreakMode)lineBreakMode {\n    if (_lineBreakMode == lineBreakMode) return;\n    _lineBreakMode = lineBreakMode;\n    _innerText.yy_lineBreakMode = lineBreakMode;\n    // allow multi-line break\n    switch (lineBreakMode) {\n        case NSLineBreakByWordWrapping:\n        case NSLineBreakByCharWrapping:\n        case NSLineBreakByClipping: {\n            _innerContainer.truncationType = YYTextTruncationTypeNone;\n            _innerText.yy_lineBreakMode = lineBreakMode;\n        } break;\n        case NSLineBreakByTruncatingHead:{\n            _innerContainer.truncationType = YYTextTruncationTypeStart;\n            _innerText.yy_lineBreakMode = NSLineBreakByWordWrapping;\n        } break;\n        case NSLineBreakByTruncatingTail:{\n            _innerContainer.truncationType = YYTextTruncationTypeEnd;\n            _innerText.yy_lineBreakMode = NSLineBreakByWordWrapping;\n        } break;\n        case NSLineBreakByTruncatingMiddle: {\n            _innerContainer.truncationType = YYTextTruncationTypeMiddle;\n            _innerText.yy_lineBreakMode = NSLineBreakByWordWrapping;\n        } break;\n        default: break;\n    }\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setTextVerticalAlignment:(YYTextVerticalAlignment)textVerticalAlignment {\n    if (_textVerticalAlignment == textVerticalAlignment) return;\n    _textVerticalAlignment = textVerticalAlignment;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setTruncationToken:(NSAttributedString *)truncationToken {\n    if (_truncationToken == truncationToken || [_truncationToken isEqual:truncationToken]) return;\n    _truncationToken = truncationToken.copy;\n    _innerContainer.truncationToken = truncationToken;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setNumberOfLines:(NSUInteger)numberOfLines {\n    if (_numberOfLines == numberOfLines) return;\n    _numberOfLines = numberOfLines;\n    _innerContainer.maximumNumberOfRows = numberOfLines;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setAttributedText:(NSAttributedString *)attributedText {\n    if (attributedText.length > 0) {\n        _innerText = attributedText.mutableCopy;\n        switch (_lineBreakMode) {\n            case NSLineBreakByWordWrapping:\n            case NSLineBreakByCharWrapping:\n            case NSLineBreakByClipping: {\n                _innerText.yy_lineBreakMode = _lineBreakMode;\n            } break;\n            case NSLineBreakByTruncatingHead:\n            case NSLineBreakByTruncatingTail:\n            case NSLineBreakByTruncatingMiddle: {\n                _innerText.yy_lineBreakMode = NSLineBreakByWordWrapping;\n            } break;\n            default: break;\n        }\n    } else {\n        _innerText = [NSMutableAttributedString new];\n    }\n    [_textParser parseText:_innerText selectedRange:NULL];\n    if (!_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _updateOuterTextProperties];\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setTextContainerPath:(UIBezierPath *)textContainerPath {\n    if (_textContainerPath == textContainerPath || [_textContainerPath isEqual:textContainerPath]) return;\n    _textContainerPath = textContainerPath.copy;\n    _innerContainer.path = textContainerPath;\n    if (!_textContainerPath) {\n        _innerContainer.size = self.bounds.size;\n        _innerContainer.insets = _textContainerInset;\n    }\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setExclusionPaths:(NSArray *)exclusionPaths {\n    if (_exclusionPaths == exclusionPaths || [_exclusionPaths isEqual:exclusionPaths]) return;\n    _exclusionPaths = exclusionPaths.copy;\n    _innerContainer.exclusionPaths = exclusionPaths;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset {\n    if (UIEdgeInsetsEqualToEdgeInsets(_textContainerInset, textContainerInset)) return;\n    _textContainerInset = textContainerInset;\n    _innerContainer.insets = textContainerInset;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setVerticalForm:(BOOL)verticalForm {\n    if (_verticalForm == verticalForm) return;\n    _verticalForm = verticalForm;\n    _innerContainer.verticalForm = verticalForm;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setLinePositionModifier:(id<YYTextLinePositionModifier>)linePositionModifier {\n    if (_linePositionModifier == linePositionModifier) return;\n    _linePositionModifier = linePositionModifier;\n    _innerContainer.linePositionModifier = linePositionModifier;\n    if (_innerText.length && !_ignoreCommonProperties) {\n        if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n            [self _clearContents];\n        }\n        [self _setLayoutNeedUpdate];\n        [self _endTouch];\n        [self invalidateIntrinsicContentSize];\n    }\n}\n\n- (void)setTextParser:(id<YYTextParser>)textParser {\n    if (_textParser == textParser || [_textParser isEqual:textParser]) return;\n    _textParser = textParser;\n    if ([_textParser parseText:_innerText selectedRange:NULL]) {\n        [self _updateOuterTextProperties];\n        if (!_ignoreCommonProperties) {\n            if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n                [self _clearContents];\n            }\n            [self _setLayoutNeedUpdate];\n            [self _endTouch];\n            [self invalidateIntrinsicContentSize];\n        }\n    }\n}\n\n- (void)setTextLayout:(YYTextLayout *)textLayout {\n    _innerLayout = textLayout;\n    _shrinkInnerLayout = nil;\n    \n    if (_ignoreCommonProperties) {\n        _innerText = (NSMutableAttributedString *)textLayout.text;\n        _innerContainer = textLayout.container.copy;\n    } else {\n        _innerText = textLayout.text.mutableCopy;\n        if (!_innerText) {\n            _innerText = [NSMutableAttributedString new];\n        }\n        [self _updateOuterTextProperties];\n        \n        _innerContainer = textLayout.container.copy;\n        if (!_innerContainer) {\n            _innerContainer = [YYTextContainer new];\n            _innerContainer.size = self.bounds.size;\n            _innerContainer.insets = self.textContainerInset;\n        }\n        [self _updateOuterContainerProperties];\n    }\n    \n    if (_displaysAsynchronously && _clearContentsBeforeAsynchronouslyDisplay) {\n        [self _clearContents];\n    }\n    _state.layoutNeedUpdate = NO;\n    [self _setLayoutNeedRedraw];\n    [self _endTouch];\n    [self invalidateIntrinsicContentSize];\n}\n\n- (YYTextLayout *)textLayout {\n    [self _updateIfNeeded];\n    return _innerLayout;\n}\n\n- (void)setDisplaysAsynchronously:(BOOL)displaysAsynchronously {\n    _displaysAsynchronously = displaysAsynchronously;\n    ((YYTextAsyncLayer *)self.layer).displaysAsynchronously = displaysAsynchronously;\n}\n\n#pragma mark - AutoLayout\n\n- (void)setPreferredMaxLayoutWidth:(CGFloat)preferredMaxLayoutWidth {\n    if (_preferredMaxLayoutWidth == preferredMaxLayoutWidth) return;\n    _preferredMaxLayoutWidth = preferredMaxLayoutWidth;\n    [self invalidateIntrinsicContentSize];\n}\n\n- (CGSize)intrinsicContentSize {\n    if (_preferredMaxLayoutWidth == 0) {\n        YYTextContainer *container = [_innerContainer copy];\n        container.size = YYTextContainerMaxSize;\n        \n        YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:_innerText];\n        return layout.textBoundingSize;\n    }\n    \n    CGSize containerSize = _innerContainer.size;\n    if (!_verticalForm) {\n        containerSize.height = YYTextContainerMaxSize.height;\n        containerSize.width = _preferredMaxLayoutWidth;\n        if (containerSize.width == 0) containerSize.width = self.bounds.size.width;\n    } else {\n        containerSize.width = YYTextContainerMaxSize.width;\n        containerSize.height = _preferredMaxLayoutWidth;\n        if (containerSize.height == 0) containerSize.height = self.bounds.size.height;\n    }\n    \n    YYTextContainer *container = [_innerContainer copy];\n    container.size = containerSize;\n    \n    YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:_innerText];\n    return layout.textBoundingSize;\n}\n\n#pragma mark - YYTextDebugTarget\n\n- (void)setDebugOption:(YYTextDebugOption *)debugOption {\n    BOOL needDraw = _debugOption.needDrawDebug;\n    _debugOption = debugOption.copy;\n    if (_debugOption.needDrawDebug != needDraw) {\n        [self _setLayoutNeedRedraw];\n    }\n}\n\n#pragma mark - YYTextAsyncLayerDelegate\n\n- (YYTextAsyncLayerDisplayTask *)newAsyncDisplayTask {\n    \n    // capture current context\n    BOOL contentsNeedFade = _state.contentsNeedFade;\n    NSAttributedString *text = _innerText;\n    YYTextContainer *container = _innerContainer;\n    YYTextVerticalAlignment verticalAlignment = _textVerticalAlignment;\n    YYTextDebugOption *debug = _debugOption;\n    NSMutableArray *attachmentViews = _attachmentViews;\n    NSMutableArray *attachmentLayers = _attachmentLayers;\n    BOOL layoutNeedUpdate = _state.layoutNeedUpdate;\n    BOOL fadeForAsync = _displaysAsynchronously && _fadeOnAsynchronouslyDisplay;\n    __block YYTextLayout *layout = (_state.showingHighlight && _highlightLayout) ? self._highlightLayout : self._innerLayout;\n    __block YYTextLayout *shrinkLayout = nil;\n    __block BOOL layoutUpdated = NO;\n    if (layoutNeedUpdate) {\n        text = text.copy;\n        container = container.copy;\n    }\n    \n    // create display task\n    YYTextAsyncLayerDisplayTask *task = [YYTextAsyncLayerDisplayTask new];\n    \n    task.willDisplay = ^(CALayer *layer) {\n        [layer removeAnimationForKey:@\"contents\"];\n        \n        // If the attachment is not in new layout, or we don't know the new layout currently,\n        // the attachment should be removed.\n        for (UIView *view in attachmentViews) {\n            if (layoutNeedUpdate || ![layout.attachmentContentsSet containsObject:view]) {\n                if (view.superview == self) {\n                    [view removeFromSuperview];\n                }\n            }\n        }\n        for (CALayer *layer in attachmentLayers) {\n            if (layoutNeedUpdate || ![layout.attachmentContentsSet containsObject:layer]) {\n                if (layer.superlayer == self.layer) {\n                    [layer removeFromSuperlayer];\n                }\n            }\n        }\n        [attachmentViews removeAllObjects];\n        [attachmentLayers removeAllObjects];\n    };\n\n    task.display = ^(CGContextRef context, CGSize size, BOOL (^isCancelled)(void)) {\n        if (isCancelled()) return;\n        if (text.length == 0) return;\n        \n        YYTextLayout *drawLayout = layout;\n        if (layoutNeedUpdate) {\n            layout = [YYTextLayout layoutWithContainer:container text:text];\n            shrinkLayout = [YYLabel _shrinkLayoutWithLayout:layout];\n            if (isCancelled()) return;\n            layoutUpdated = YES;\n            drawLayout = shrinkLayout ? shrinkLayout : layout;\n        }\n        \n        CGSize boundingSize = drawLayout.textBoundingSize;\n        CGPoint point = CGPointZero;\n        if (verticalAlignment == YYTextVerticalAlignmentCenter) {\n            if (drawLayout.container.isVerticalForm) {\n                point.x = -(size.width - boundingSize.width) * 0.5;\n            } else {\n                point.y = (size.height - boundingSize.height) * 0.5;\n            }\n        } else if (verticalAlignment == YYTextVerticalAlignmentBottom) {\n            if (drawLayout.container.isVerticalForm) {\n                point.x = -(size.width - boundingSize.width);\n            } else {\n                point.y = (size.height - boundingSize.height);\n            }\n        }\n        point = YYTextCGPointPixelRound(point);\n        [drawLayout drawInContext:context size:size point:point view:nil layer:nil debug:debug cancel:isCancelled];\n    };\n\n    task.didDisplay = ^(CALayer *layer, BOOL finished) {\n        YYTextLayout *drawLayout = layout;\n        if (layoutUpdated && shrinkLayout) {\n            drawLayout = shrinkLayout;\n        }\n        if (!finished) {\n            // If the display task is cancelled, we should clear the attachments.\n            for (YYTextAttachment *a in drawLayout.attachments) {\n                if ([a.content isKindOfClass:[UIView class]]) {\n                    if (((UIView *)a.content).superview == layer.delegate) {\n                        [((UIView *)a.content) removeFromSuperview];\n                    }\n                } else if ([a.content isKindOfClass:[CALayer class]]) {\n                    if (((CALayer *)a.content).superlayer == layer) {\n                        [((CALayer *)a.content) removeFromSuperlayer];\n                    }\n                }\n            }\n            return;\n        }\n        [layer removeAnimationForKey:@\"contents\"];\n        \n        __strong YYLabel *view = (YYLabel *)layer.delegate;\n        if (!view) return;\n        if (view->_state.layoutNeedUpdate && layoutUpdated) {\n            view->_innerLayout = layout;\n            view->_shrinkInnerLayout = shrinkLayout;\n            view->_state.layoutNeedUpdate = NO;\n        }\n        \n        CGSize size = layer.bounds.size;\n        CGSize boundingSize = drawLayout.textBoundingSize;\n        CGPoint point = CGPointZero;\n        if (verticalAlignment == YYTextVerticalAlignmentCenter) {\n            if (drawLayout.container.isVerticalForm) {\n                point.x = -(size.width - boundingSize.width) * 0.5;\n            } else {\n                point.y = (size.height - boundingSize.height) * 0.5;\n            }\n        } else if (verticalAlignment == YYTextVerticalAlignmentBottom) {\n            if (drawLayout.container.isVerticalForm) {\n                point.x = -(size.width - boundingSize.width);\n            } else {\n                point.y = (size.height - boundingSize.height);\n            }\n        }\n        point = YYTextCGPointPixelRound(point);\n        [drawLayout drawInContext:nil size:size point:point view:view layer:layer debug:nil cancel:NULL];\n        for (YYTextAttachment *a in drawLayout.attachments) {\n            if ([a.content isKindOfClass:[UIView class]]) [attachmentViews addObject:a.content];\n            else if ([a.content isKindOfClass:[CALayer class]]) [attachmentLayers addObject:a.content];\n        }\n        \n        if (contentsNeedFade) {\n            CATransition *transition = [CATransition animation];\n            transition.duration = kHighlightFadeDuration;\n            transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];\n            transition.type = kCATransitionFade;\n            [layer addAnimation:transition forKey:@\"contents\"];\n        } else if (fadeForAsync) {\n            CATransition *transition = [CATransition animation];\n            transition.duration = kAsyncFadeDuration;\n            transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];\n            transition.type = kCATransitionFade;\n            [layer addAnimation:transition forKey:@\"contents\"];\n        }\n    };\n    \n    return task;\n}\n\n@end\n\n\n\n@interface YYLabel(IBInspectableProperties)\n@end\n\n@implementation YYLabel (IBInspectableProperties)\n\n- (BOOL)fontIsBold_:(UIFont *)font {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return NO;\n    return (font.fontDescriptor.symbolicTraits & UIFontDescriptorTraitBold) > 0;\n}\n\n- (UIFont *)boldFont_:(UIFont *)font {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return font;\n    return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold] size:font.pointSize];\n}\n\n- (UIFont *)normalFont_:(UIFont *)font {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return font;\n    return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:0] size:font.pointSize];\n}\n\n- (void)setFontName_:(NSString *)fontName {\n    if (!fontName) return;\n    UIFont *font = self.font;\n    if ((fontName.length == 0 || [fontName.lowercaseString isEqualToString:@\"system\"]) && ![self fontIsBold_:font]) {\n        font = [UIFont systemFontOfSize:font.pointSize];\n    } else if ([fontName.lowercaseString isEqualToString:@\"system bold\"]) {\n        font = [UIFont boldSystemFontOfSize:font.pointSize];\n    } else {\n        if ([self fontIsBold_:font] && ([fontName.lowercaseString rangeOfString:@\"bold\"].location == NSNotFound)) {\n            font = [UIFont fontWithName:fontName size:font.pointSize];\n            font = [self boldFont_:font];\n        } else {\n            font = [UIFont fontWithName:fontName size:font.pointSize];\n        }\n    }\n    if (font) self.font = font;\n}\n\n- (void)setFontSize_:(CGFloat)fontSize {\n    if (fontSize <= 0) return;\n    UIFont *font = self.font;\n    font = [font fontWithSize:fontSize];\n    if (font) self.font = font;\n}\n\n- (void)setFontIsBold_:(BOOL)fontBold {\n    UIFont *font = self.font;\n    if ([self fontIsBold_:font] == fontBold) return;\n    if (fontBold) {\n        font = [self boldFont_:font];\n    } else {\n        font = [self normalFont_:font];\n    }\n    if (font) self.font = font;\n}\n\n- (void)setInsetTop_:(CGFloat)textInsetTop {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.top = textInsetTop;\n    self.textContainerInset = insets;\n}\n\n- (void)setInsetBottom_:(CGFloat)textInsetBottom {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.bottom = textInsetBottom;\n    self.textContainerInset = insets;\n}\n\n- (void)setInsetLeft_:(CGFloat)textInsetLeft {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.left = textInsetLeft;\n    self.textContainerInset = insets;\n    \n}\n\n- (void)setInsetRight_:(CGFloat)textInsetRight {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.right = textInsetRight;\n    self.textContainerInset = insets;\n}\n\n- (void)setDebugEnabled_:(BOOL)enabled {\n    if (!enabled) {\n        self.debugOption = nil;\n    } else {\n        YYTextDebugOption *debugOption = [YYTextDebugOption new];\n        debugOption.baselineColor = [UIColor redColor];\n        debugOption.CTFrameBorderColor = [UIColor redColor];\n        debugOption.CTLineFillColor = [UIColor colorWithRed:0.000 green:0.463 blue:1.000 alpha:0.180];\n        debugOption.CGGlyphBorderColor = [UIColor colorWithRed:1.000 green:0.524 blue:0.000 alpha:0.200];\n        self.debugOption = debugOption;\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/YYText.h",
    "content": "//\n//  YYText.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYText/YYText.h>)\nFOUNDATION_EXPORT double YYTextVersionNumber;\nFOUNDATION_EXPORT const unsigned char YYTextVersionString[];\n#import <YYText/YYLabel.h>\n#import <YYText/YYTextView.h>\n#import <YYText/YYTextAttribute.h>\n#import <YYText/YYTextArchiver.h>\n#import <YYText/YYTextParser.h>\n#import <YYText/YYTextRunDelegate.h>\n#import <YYText/YYTextRubyAnnotation.h>\n#import <YYText/YYTextLayout.h>\n#import <YYText/YYTextLine.h>\n#import <YYText/YYTextInput.h>\n#import <YYText/YYTextDebugOption.h>\n#import <YYText/YYTextKeyboardManager.h>\n#import <YYText/YYTextUtilities.h>\n#import <YYText/NSAttributedString+YYText.h>\n#import <YYText/NSParagraphStyle+YYText.h>\n#import <YYText/UIPasteboard+YYText.h>\n#else\n#import \"YYLabel.h\"\n#import \"YYTextView.h\"\n#import \"YYTextAttribute.h\"\n#import \"YYTextArchiver.h\"\n#import \"YYTextParser.h\"\n#import \"YYTextRunDelegate.h\"\n#import \"YYTextRubyAnnotation.h\"\n#import \"YYTextLayout.h\"\n#import \"YYTextLine.h\"\n#import \"YYTextInput.h\"\n#import \"YYTextDebugOption.h\"\n#import \"YYTextKeyboardManager.h\"\n#import \"YYTextUtilities.h\"\n#import \"NSAttributedString+YYText.h\"\n#import \"NSParagraphStyle+YYText.h\"\n#import \"UIPasteboard+YYText.h\"\n#endif\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/YYTextView.h",
    "content": "//\n//  YYTextView.h\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import <UIKit/UIKit.h>\n\n#if __has_include(<YYText/YYText.h>)\n#import <YYText/YYTextParser.h>\n#import <YYText/YYTextLayout.h>\n#import <YYText/YYTextAttribute.h>\n#else\n#import \"YYTextParser.h\"\n#import \"YYTextLayout.h\"\n#import \"YYTextAttribute.h\"\n#endif\n\n@class YYTextView;\n\nNS_ASSUME_NONNULL_BEGIN\n\n/**\n The YYTextViewDelegate protocol defines a set of optional methods you can use\n to receive editing-related messages for YYTextView objects. \n \n @discussion The API and behavior is similar to UITextViewDelegate,\n see UITextViewDelegate's documentation for more information.\n */\n@protocol YYTextViewDelegate <NSObject, UIScrollViewDelegate>\n@optional\n- (BOOL)textViewShouldBeginEditing:(YYTextView *)textView;\n- (BOOL)textViewShouldEndEditing:(YYTextView *)textView;\n- (void)textViewDidBeginEditing:(YYTextView *)textView;\n- (void)textViewDidEndEditing:(YYTextView *)textView;\n- (BOOL)textView:(YYTextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;\n- (void)textViewDidChange:(YYTextView *)textView;\n- (void)textViewDidChangeSelection:(YYTextView *)textView;\n\n- (BOOL)textView:(YYTextView *)textView shouldTapHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange;\n- (void)textView:(YYTextView *)textView didTapHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect;\n- (BOOL)textView:(YYTextView *)textView shouldLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange;\n- (void)textView:(YYTextView *)textView didLongPressHighlight:(YYTextHighlight *)highlight inRange:(NSRange)characterRange rect:(CGRect)rect;\n@end\n\n\n#if !TARGET_INTERFACE_BUILDER\n\n/**\n The YYTextView class implements the behavior for a scrollable, multiline text region.\n \n @discussion The API and behavior is similar to UITextView, but provides more features:\n \n * It extends the CoreText attributes to support more text effects.\n * It allows to add UIImage, UIView and CALayer as text attachments.\n * It allows to add 'highlight' link to some range of text to allow user interact with.\n * It allows to add exclusion paths to control text container's shape.\n * It supports vertical form layout to display and edit CJK text.\n * It allows user to copy/paste image and attributed text from/to text view.\n * It allows to set an attributed text as placeholder.\n \n See NSAttributedString+YYText.h for more convenience methods to set the attributes.\n See YYTextAttribute.h and YYTextLayout.h for more information.\n */\n@interface YYTextView : UIScrollView <UITextInput>\n\n\n#pragma mark - Accessing the Delegate\n///=============================================================================\n/// @name Accessing the Delegate\n///=============================================================================\n\n@property (nullable, nonatomic, weak) id<YYTextViewDelegate> delegate;\n\n\n#pragma mark - Configuring the Text Attributes\n///=============================================================================\n/// @name Configuring the Text Attributes\n///=============================================================================\n\n/**\n The text displayed by the text view.\n Set a new value to this property also replaces the text in `attributedText`.\n Get the value returns the plain text in `attributedText`.\n */\n@property (null_resettable, nonatomic, copy) NSString *text;\n\n/**\n The font of the text. Default is 12-point system font.\n Set a new value to this property also causes the new font to be applied to the entire `attributedText`.\n Get the value returns the font at the head of `attributedText`.\n */\n@property (nullable, nonatomic, strong) UIFont *font;\n\n/**\n The color of the text. Default is black.\n Set a new value to this property also causes the new color to be applied to the entire `attributedText`.\n Get the value returns the color at the head of `attributedText`.\n */\n@property (nullable, nonatomic, strong) UIColor *textColor;\n\n/**\n The technique to use for aligning the text. Default is NSTextAlignmentNatural.\n Set a new value to this property also causes the new alignment to be applied to the entire `attributedText`.\n Get the value returns the alignment at the head of `attributedText`.\n */\n@property (nonatomic) NSTextAlignment textAlignment;\n\n/**\n The text vertical aligmnent in container. Default is YYTextVerticalAlignmentTop.\n */\n@property (nonatomic) YYTextVerticalAlignment textVerticalAlignment;\n\n/**\n The types of data converted to clickable URLs in the text view. Default is UIDataDetectorTypeNone.\n The tap or long press action should be handled by delegate.\n */\n@property (nonatomic) UIDataDetectorTypes dataDetectorTypes;\n\n/**\n The attributes to apply to links at normal state. Default is light blue color.\n When a range of text is detected by the `dataDetectorTypes`, this value would be\n used to modify the original attributes in the range.\n */\n@property (nullable, nonatomic, copy) NSDictionary<NSString *, id> *linkTextAttributes;\n\n/**\n The attributes to apply to links at highlight state. Default is a gray border.\n When a range of text is detected by the `dataDetectorTypes` and the range was touched by user,\n this value would be used to modify the original attributes in the range.\n */\n@property (nullable, nonatomic, copy) NSDictionary<NSString *, id> *highlightTextAttributes;\n\n/**\n The attributes to apply to new text being entered by the user.\n When the text view's selection changes, this value is reset automatically.\n */\n@property (nullable, nonatomic, copy) NSDictionary<NSString *, id> *typingAttributes;\n\n/**\n The styled text displayed by the text view.\n Set a new value to this property also replaces the value of the `text`, `font`, `textColor`,\n `textAlignment` and other properties in text view.\n \n @discussion It only support the attributes declared in CoreText and YYTextAttribute.\n See `NSAttributedString+YYText` for more convenience methods to set the attributes.\n */\n@property (nullable, nonatomic, copy) NSAttributedString *attributedText;\n\n/**\n When `text` or `attributedText` is changed, the parser will be called to modify the text.\n It can be used to add code highlighting or emoticon replacement to text view.\n The default value is nil.\n \n See `YYTextParser` protocol for more information.\n */\n@property (nullable, nonatomic, strong) id<YYTextParser> textParser;\n\n/**\n The current text layout in text view (readonly).\n It can be used to query the text layout information.\n */\n@property (nullable, nonatomic, strong, readonly) YYTextLayout *textLayout;\n\n\n#pragma mark - Configuring the Placeholder\n///=============================================================================\n/// @name Configuring the Placeholder\n///=============================================================================\n\n/**\n The placeholder text displayed by the text view (when the text view is empty).\n Set a new value to this property also replaces the text in `placeholderAttributedText`.\n Get the value returns the plain text in `placeholderAttributedText`.\n */\n@property (nullable, nonatomic, copy) NSString *placeholderText;\n\n/**\n The font of the placeholder text. Default is same as `font` property.\n Set a new value to this property also causes the new font to be applied to the entire `placeholderAttributedText`.\n Get the value returns the font at the head of `placeholderAttributedText`.\n */\n@property (nullable, nonatomic, strong) UIFont *placeholderFont;\n\n/**\n The color of the placeholder text. Default is gray.\n Set a new value to this property also causes the new color to be applied to the entire `placeholderAttributedText`.\n Get the value returns the color at the head of `placeholderAttributedText`.\n */\n@property (nullable, nonatomic, strong) UIColor *placeholderTextColor;\n\n/**\n The styled placeholder text displayed by the text view (when the text view is empty).\n Set a new value to this property also replaces the value of the `placeholderText`, \n `placeholderFont`, `placeholderTextColor`.\n \n @discussion It only support the attributes declared in CoreText and YYTextAttribute.\n See `NSAttributedString+YYText` for more convenience methods to set the attributes.\n */\n@property (nullable, nonatomic, copy) NSAttributedString *placeholderAttributedText;\n\n\n#pragma mark - Configuring the Text Container\n///=============================================================================\n/// @name Configuring the Text Container\n///=============================================================================\n\n/**\n The inset of the text container's layout area within the text view's content area.\n */\n@property (nonatomic) UIEdgeInsets textContainerInset;\n\n/**\n An array of UIBezierPath objects representing the exclusion paths inside the \n receiver's bounding rectangle. Default value is nil.\n */\n@property (nullable, nonatomic, copy) NSArray<UIBezierPath *> *exclusionPaths;\n\n/**\n Whether the receiver's layout orientation is vertical form. Default is NO.\n It may used to edit/display CJK text.\n */\n@property (nonatomic, getter=isVerticalForm) BOOL verticalForm;\n\n/**\n The text line position modifier used to modify the lines' position in layout.\n See `YYTextLinePositionModifier` protocol for more information.\n */\n@property (nullable, nonatomic, copy) id<YYTextLinePositionModifier> linePositionModifier;\n\n/**\n The debug option to display CoreText layout result.\n The default value is [YYTextDebugOption sharedDebugOption].\n */\n@property (nullable, nonatomic, copy) YYTextDebugOption *debugOption;\n\n\n#pragma mark - Working with the Selection and Menu\n///=============================================================================\n/// @name Working with the Selection and Menu\n///=============================================================================\n\n/**\n Scrolls the receiver until the text in the specified range is visible.\n */\n- (void)scrollRangeToVisible:(NSRange)range;\n\n/**\n The current selection range of the receiver.\n */\n@property (nonatomic) NSRange selectedRange;\n\n/**\n A Boolean value indicating whether inserting text replaces the previous contents.\n The default value is NO.\n */\n@property (nonatomic) BOOL clearsOnInsertion;\n\n/**\n A Boolean value indicating whether the receiver is selectable. Default is YES.\n When the value of this property is NO, user cannot select content or edit text.\n */\n@property (nonatomic, getter=isSelectable) BOOL selectable;\n\n/**\n A Boolean value indicating whether the receiver is highlightable. Default is YES.\n When the value of this property is NO, user cannot interact with the highlight range of text.\n */\n@property (nonatomic, getter=isHighlightable) BOOL highlightable;\n\n/**\n A Boolean value indicating whether the receiver is editable. Default is YES.\n When the value of this property is NO, user cannot edit text.\n */\n@property (nonatomic, getter=isEditable) BOOL editable;\n\n/**\n A Boolean value indicating whether the receiver can paste image from pasteboard. Default is NO.\n When the value of this property is YES, user can paste image from pasteboard via \"paste\" menu.\n */\n@property (nonatomic) BOOL allowsPasteImage;\n\n/**\n A Boolean value indicating whether the receiver can paste attributed text from pasteboard. Default is NO.\n When the value of this property is YES, user can paste attributed text from pasteboard via \"paste\" menu.\n */\n@property (nonatomic) BOOL allowsPasteAttributedString;\n\n/**\n A Boolean value indicating whether the receiver can copy attributed text to pasteboard. Default is YES.\n When the value of this property is YES, user can copy attributed text (with attachment image)\n from text view to pasteboard via \"copy\" menu.\n */\n@property (nonatomic) BOOL allowsCopyAttributedString;\n\n\n#pragma mark - Manage the undo and redo\n///=============================================================================\n/// @name Manage the undo and redo\n///=============================================================================\n\n/**\n A Boolean value indicating whether the receiver can undo and redo typing with\n shake gesture. The default value is YES.\n */\n@property (nonatomic) BOOL allowsUndoAndRedo;\n\n/**\n The maximum undo/redo level. The default value is 20.\n */\n@property (nonatomic) NSUInteger maximumUndoLevel;\n\n\n#pragma mark - Replacing the System Input Views\n///=============================================================================\n/// @name Replacing the System Input Views\n///=============================================================================\n\n/**\n The custom input view to display when the text view becomes the first responder.\n It can be used to replace system keyboard.\n \n @discussion If set the value while first responder, it will not take effect until \n 'reloadInputViews' is called.\n */\n@property (nullable, nonatomic, readwrite, strong) __kindof UIView *inputView;\n\n/**\n The custom accessory view to display when the text view becomes the first responder.\n It can be used to add a toolbar at the top of keyboard.\n \n @discussion If set the value while first responder, it will not take effect until\n 'reloadInputViews' is called.\n */\n@property (nullable, nonatomic, readwrite, strong) __kindof UIView *inputAccessoryView;\n\n/**\n If you use an custom accessory view without \"inputAccessoryView\" property,\n you may set the accessory view's height. It may used by auto scroll calculation.\n */\n@property (nonatomic) CGFloat extraAccessoryViewHeight;\n\n@end\n\n\n#else // TARGET_INTERFACE_BUILDER\nIB_DESIGNABLE\n@interface YYTextView : UIScrollView <UITextInput>\n@property (null_resettable, nonatomic, copy) IBInspectable NSString *text;\n@property (nullable, nonatomic, strong) IBInspectable UIColor *textColor;\n@property (nullable, nonatomic, strong) IBInspectable NSString *fontName_;\n@property (nonatomic) IBInspectable CGFloat fontSize_;\n@property (nonatomic) IBInspectable BOOL fontIsBold_;\n@property (nonatomic) IBInspectable NSTextAlignment textAlignment;\n@property (nonatomic) IBInspectable YYTextVerticalAlignment textVerticalAlignment;\n@property (nullable, nonatomic, copy) IBInspectable NSString *placeholderText;\n@property (nullable, nonatomic, strong) IBInspectable UIColor *placeholderTextColor;\n@property (nullable, nonatomic, strong) IBInspectable NSString *placeholderFontName_;\n@property (nonatomic) IBInspectable CGFloat placeholderFontSize_;\n@property (nonatomic) IBInspectable BOOL placeholderFontIsBold_;\n@property (nonatomic, getter=isVerticalForm) IBInspectable BOOL verticalForm;\n@property (nonatomic) IBInspectable BOOL clearsOnInsertion;\n@property (nonatomic, getter=isSelectable) IBInspectable BOOL selectable;\n@property (nonatomic, getter=isHighlightable) IBInspectable BOOL highlightable;\n@property (nonatomic, getter=isEditable) IBInspectable BOOL editable;\n@property (nonatomic) IBInspectable BOOL allowsPasteImage;\n@property (nonatomic) IBInspectable BOOL allowsPasteAttributedString;\n@property (nonatomic) IBInspectable BOOL allowsCopyAttributedString;\n@property (nonatomic) IBInspectable BOOL allowsUndoAndRedo;\n@property (nonatomic) IBInspectable NSUInteger maximumUndoLevel;\n@property (nonatomic) IBInspectable CGFloat insetTop_;\n@property (nonatomic) IBInspectable CGFloat insetBottom_;\n@property (nonatomic) IBInspectable CGFloat insetLeft_;\n@property (nonatomic) IBInspectable CGFloat insetRight_;\n@property (nonatomic) IBInspectable BOOL debugEnabled_;\n@property (nullable, nonatomic, weak) id<YYTextViewDelegate> delegate;\n@property (nullable, nonatomic, strong) UIFont *font;\n@property (nonatomic) UIDataDetectorTypes dataDetectorTypes;\n@property (nullable, nonatomic, copy) NSDictionary *linkTextAttributes;\n@property (nullable, nonatomic, copy) NSDictionary *highlightTextAttributes;\n@property (nullable, nonatomic, copy) NSDictionary *typingAttributes;\n@property (nullable, nonatomic, copy) NSAttributedString *attributedText;\n@property (nullable, nonatomic, strong) id<YYTextParser> textParser;\n@property (nullable, nonatomic, strong, readonly) YYTextLayout *textLayout;\n@property (nullable, nonatomic, strong) UIFont *placeholderFont;\n@property (nullable, nonatomic, copy) NSAttributedString *placeholderAttributedText;\n@property (nonatomic) UIEdgeInsets textContainerInset;\n@property (nullable, nonatomic, copy) NSArray *exclusionPaths;\n@property (nullable, nonatomic, copy) id<YYTextLinePositionModifier> linePositionModifier;\n@property (nullable, nonatomic, copy) YYTextDebugOption *debugOption;\n- (void)scrollRangeToVisible:(NSRange)range;\n@property (nonatomic) NSRange selectedRange;\n@property (nullable, nonatomic, readwrite, strong) __kindof UIView *inputView;\n@property (nullable, nonatomic, readwrite, strong) __kindof UIView *inputAccessoryView;\n@property (nonatomic) CGFloat extraAccessoryViewHeight;\n@end\n#endif // !TARGET_INTERFACE_BUILDER\n\n\n// Notifications, see UITextView's documentation for more information.\nUIKIT_EXTERN NSString *const YYTextViewTextDidBeginEditingNotification;\nUIKIT_EXTERN NSString *const YYTextViewTextDidChangeNotification;\nUIKIT_EXTERN NSString *const YYTextViewTextDidEndEditingNotification;\n\nNS_ASSUME_NONNULL_END\n"
  },
  {
    "path": "JetChat/Pods/YYText/YYText/YYTextView.m",
    "content": "//\n//  YYTextView.m\n//  YYText <https://github.com/ibireme/YYText>\n//\n//  Created by ibireme on 15/2/25.\n//  Copyright (c) 2015 ibireme.\n//\n//  This source code is licensed under the MIT-style license found in the\n//  LICENSE file in the root directory of this source tree.\n//\n\n#import \"YYTextView.h\"\n#import \"YYTextInput.h\"\n#import \"YYTextContainerView.h\"\n#import \"YYTextSelectionView.h\"\n#import \"YYTextMagnifier.h\"\n#import \"YYTextEffectWindow.h\"\n#import \"YYTextKeyboardManager.h\"\n#import \"YYTextUtilities.h\"\n#import \"YYTextTransaction.h\"\n#import \"YYTextWeakProxy.h\"\n#import \"NSAttributedString+YYText.h\"\n#import \"UIPasteboard+YYText.h\"\n#import \"UIView+YYText.h\"\n\n\nstatic double _YYDeviceSystemVersion() {\n    static double version;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        version = [UIDevice currentDevice].systemVersion.doubleValue;\n    });\n    return version;\n}\n\n#ifndef kSystemVersion\n#define kSystemVersion _YYDeviceSystemVersion()\n#endif\n\n#ifndef kiOS6Later\n#define kiOS6Later (kSystemVersion >= 6)\n#endif\n\n#ifndef kiOS7Later\n#define kiOS7Later (kSystemVersion >= 7)\n#endif\n\n#ifndef kiOS8Later\n#define kiOS8Later (kSystemVersion >= 8)\n#endif\n\n#ifndef kiOS9Later\n#define kiOS9Later (kSystemVersion >= 9)\n#endif\n\n\n\n#define kDefaultUndoLevelMax 20 // Default maximum undo level\n\n#define kAutoScrollMinimumDuration 0.1 // Time in seconds to tick auto-scroll.\n#define kLongPressMinimumDuration 0.5 // Time in seconds the fingers must be held down for long press gesture.\n#define kLongPressAllowableMovement 10.0 // Maximum movement in points allowed before the long press fails.\n\n#define kMagnifierRangedTrackFix -6.0 // Magnifier ranged offset fix.\n#define kMagnifierRangedPopoverOffset 4.0 // Magnifier ranged popover offset.\n#define kMagnifierRangedCaptureOffset -6.0 // Magnifier ranged capture center offset.\n\n#define kHighlightFadeDuration 0.15 // Time in seconds for highlight fadeout animation.\n\n#define kDefaultInset UIEdgeInsetsMake(6, 4, 6, 4)\n#define kDefaultVerticalInset UIEdgeInsetsMake(4, 6, 4, 6)\n\n\nNSString *const YYTextViewTextDidBeginEditingNotification = @\"YYTextViewTextDidBeginEditing\";\nNSString *const YYTextViewTextDidChangeNotification = @\"YYTextViewTextDidChange\";\nNSString *const YYTextViewTextDidEndEditingNotification = @\"YYTextViewTextDidEndEditing\";\n\n\ntypedef NS_ENUM (NSUInteger, YYTextGrabberDirection) {\n    kStart = 1,\n    kEnd   = 2,\n};\n\ntypedef NS_ENUM(NSUInteger, YYTextMoveDirection) {\n    kLeft   = 1,\n    kTop    = 2,\n    kRight  = 3,\n    kBottom = 4,\n};\n\n\n/// An object that captures the state of the text view. Used for undo and redo.\n@interface _YYTextViewUndoObject : NSObject\n@property (nonatomic, strong) NSAttributedString *text;\n@property (nonatomic, assign) NSRange selectedRange;\n@end\n@implementation _YYTextViewUndoObject\n+ (instancetype)objectWithText:(NSAttributedString *)text range:(NSRange)range {\n    _YYTextViewUndoObject *obj = [self new];\n    obj.text = text ? text : [NSAttributedString new];\n    obj.selectedRange = range;\n    return obj;\n}\n@end\n\n\n@interface YYTextView () <UIScrollViewDelegate, UIAlertViewDelegate, YYTextDebugTarget, YYTextKeyboardObserver> {\n    \n    YYTextRange *_selectedTextRange; /// nonnull\n    YYTextRange *_markedTextRange;\n    \n    __weak id<YYTextViewDelegate> _outerDelegate;\n    \n    UIImageView *_placeHolderView;\n    \n    NSMutableAttributedString *_innerText; ///< nonnull, inner attributed text\n    NSMutableAttributedString *_delectedText; ///< detected text for display\n    YYTextContainer *_innerContainer; ///< nonnull, inner text container\n    YYTextLayout *_innerLayout; ///< inner text layout, the text in this layout is longer than `_innerText` by appending '\\n'\n    \n    YYTextContainerView *_containerView; ///< nonnull\n    YYTextSelectionView *_selectionView; ///< nonnull\n    YYTextMagnifier *_magnifierCaret; ///< nonnull\n    YYTextMagnifier *_magnifierRanged; ///< nonnull\n    \n    NSMutableAttributedString *_typingAttributesHolder; ///< nonnull, typing attributes\n    NSDataDetector *_dataDetector;\n    CGFloat _magnifierRangedOffset;\n    \n    NSRange _highlightRange; ///< current highlight range\n    YYTextHighlight *_highlight; ///< highlight attribute in `_highlightRange`\n    YYTextLayout *_highlightLayout; ///< when _state.showingHighlight=YES, this layout should be displayed\n    YYTextRange *_trackingRange; ///< the range in _innerLayout, may out of _innerText.\n    \n    BOOL _insetModifiedByKeyboard; ///< text is covered by keyboard, and the contentInset is modified\n    UIEdgeInsets _originalContentInset; ///< the original contentInset before modified\n    UIEdgeInsets _originalScrollIndicatorInsets; ///< the original scrollIndicatorInsets before modified\n    \n    NSTimer *_longPressTimer;\n    NSTimer *_autoScrollTimer;\n    CGFloat _autoScrollOffset; ///< current auto scroll offset which shoud add to scroll view\n    NSInteger _autoScrollAcceleration; ///< an acceleration coefficient for auto scroll\n    NSTimer *_selectionDotFixTimer; ///< fix the selection dot in window if the view is moved by parents\n    CGPoint _previousOriginInWindow;\n    \n    CGPoint _touchBeganPoint;\n    CGPoint _trackingPoint;\n    NSTimeInterval _touchBeganTime;\n    NSTimeInterval _trackingTime;\n    \n    NSMutableArray *_undoStack;\n    NSMutableArray *_redoStack;\n    NSRange _lastTypeRange;\n    \n    struct {\n        unsigned int trackingGrabber : 2;       ///< YYTextGrabberDirection, current tracking grabber\n        unsigned int trackingCaret : 1;         ///< track the caret\n        unsigned int trackingPreSelect : 1;     ///< track pre-select\n        unsigned int trackingTouch : 1;         ///< is in touch phase\n        unsigned int swallowTouch : 1;          ///< don't forward event to next responder\n        unsigned int touchMoved : 3;            ///< YYTextMoveDirection, move direction after touch began\n        unsigned int selectedWithoutEdit : 1;   ///< show selected range but not first responder\n        unsigned int deleteConfirm : 1;         ///< delete a binding text range\n        unsigned int ignoreFirstResponder : 1;  ///< ignore become first responder temporary\n        unsigned int ignoreTouchBegan : 1;      ///< ignore begin tracking touch temporary\n        \n        unsigned int showingMagnifierCaret : 1;\n        unsigned int showingMagnifierRanged : 1;\n        unsigned int showingMenu : 1;\n        unsigned int showingHighlight : 1;\n        \n        unsigned int typingAttributesOnce : 1;  ///< apply the typing attributes once\n        unsigned int clearsOnInsertionOnce : 1; ///< select all once when become first responder\n        unsigned int autoScrollTicked : 1;      ///< auto scroll did tick scroll at this timer period\n        unsigned int firstShowDot : 1;          ///< the selection grabber dot has displayed at least once\n        unsigned int needUpdate : 1;            ///< the layout or selection view is 'dirty' and need update\n        unsigned int placeholderNeedUpdate : 1; ///< the placeholder need update it's contents\n        \n        unsigned int insideUndoBlock : 1;\n        unsigned int firstResponderBeforeUndoAlert : 1;\n    } _state;\n}\n\n@end\n\n\n@implementation YYTextView\n\n#pragma mark - @protocol UITextInputTraits\n@synthesize autocapitalizationType = _autocapitalizationType;\n@synthesize autocorrectionType = _autocorrectionType;\n@synthesize spellCheckingType = _spellCheckingType;\n@synthesize keyboardType = _keyboardType;\n@synthesize keyboardAppearance = _keyboardAppearance;\n@synthesize returnKeyType = _returnKeyType;\n@synthesize enablesReturnKeyAutomatically = _enablesReturnKeyAutomatically;\n@synthesize secureTextEntry = _secureTextEntry;\n\n#pragma mark - @protocol UITextInput\n@synthesize selectedTextRange = _selectedTextRange;  //copy nonnull (YYTextRange*)\n@synthesize markedTextRange = _markedTextRange;      //readonly     (YYTextRange*)\n@synthesize markedTextStyle = _markedTextStyle;      //copy\n@synthesize inputDelegate = _inputDelegate;         //assign\n@synthesize tokenizer = _tokenizer;                 //readonly\n\n#pragma mark - @protocol UITextInput optional\n@synthesize selectionAffinity = _selectionAffinity;\n\n\n#pragma mark - Private\n\n/// Update layout and selection before runloop sleep/end.\n- (void)_commitUpdate {\n#if !TARGET_INTERFACE_BUILDER\n    _state.needUpdate = YES;\n    [[YYTextTransaction transactionWithTarget:self selector:@selector(_updateIfNeeded)] commit];\n#else\n    [self _update];\n#endif\n}\n\n/// Update layout and selection view if needed.\n- (void)_updateIfNeeded {\n    if (_state.needUpdate) {\n        [self _update];\n    }\n}\n\n/// Update layout and selection view immediately.\n- (void)_update {\n    _state.needUpdate = NO;\n    [self _updateLayout];\n    [self _updateSelectionView];\n}\n\n/// Update layout immediately.\n- (void)_updateLayout {\n    NSMutableAttributedString *text = _innerText.mutableCopy;\n    _placeHolderView.hidden = text.length > 0;\n    if ([self _detectText:text]) {\n        _delectedText = text;\n    } else {\n        _delectedText = nil;\n    }\n    [text replaceCharactersInRange:NSMakeRange(text.length, 0) withString:@\"\\r\"]; // add for nextline caret\n    [text yy_removeDiscontinuousAttributesInRange:NSMakeRange(_innerText.length, 1)];\n    [text removeAttribute:YYTextBorderAttributeName range:NSMakeRange(_innerText.length, 1)];\n    [text removeAttribute:YYTextBackgroundBorderAttributeName range:NSMakeRange(_innerText.length, 1)];\n    if (_innerText.length == 0) {\n        [text yy_setAttributes:_typingAttributesHolder.yy_attributes]; // add for empty text caret\n    }\n    if (_selectedTextRange.end.offset == _innerText.length) {\n        [_typingAttributesHolder.yy_attributes enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) {\n            [text yy_setAttribute:key value:value range:NSMakeRange(_innerText.length, 1)];\n        }];\n    }\n    [self willChangeValueForKey:@\"textLayout\"];\n    _innerLayout = [YYTextLayout layoutWithContainer:_innerContainer text:text];\n    [self didChangeValueForKey:@\"textLayout\"];\n    CGSize size = [_innerLayout textBoundingSize];\n    CGSize visibleSize = [self _getVisibleSize];\n    if (_innerContainer.isVerticalForm) {\n        size.height = visibleSize.height;\n        if (size.width < visibleSize.width) size.width = visibleSize.width;\n    } else {\n        size.width = visibleSize.width;\n    }\n    \n    [_containerView setLayout:_innerLayout withFadeDuration:0];\n    _containerView.frame = (CGRect){.size = size};\n    _state.showingHighlight = NO;\n    self.contentSize = size;\n}\n\n/// Update selection view immediately.\n/// This method should be called after \"layout update\" finished.\n- (void)_updateSelectionView {\n    _selectionView.frame = _containerView.frame;\n    _selectionView.caretBlinks = NO;\n    _selectionView.caretVisible = NO;\n    _selectionView.selectionRects = nil;\n    [[YYTextEffectWindow sharedWindow] hideSelectionDot:_selectionView];\n    if (!_innerLayout) return;\n    \n    NSMutableArray *allRects = [NSMutableArray new];\n    BOOL containsDot = NO;\n    \n    YYTextRange *selectedRange = _selectedTextRange;\n    if (_state.trackingTouch && _trackingRange) {\n        selectedRange = _trackingRange;\n    }\n    \n    if (_markedTextRange) {\n        NSArray *rects = [_innerLayout selectionRectsWithoutStartAndEndForRange:_markedTextRange];\n        if (rects) [allRects addObjectsFromArray:rects];\n        if (selectedRange.asRange.length > 0) {\n            rects = [_innerLayout selectionRectsWithOnlyStartAndEndForRange:selectedRange];\n            if (rects) [allRects addObjectsFromArray:rects];\n            containsDot = rects.count > 0;\n        } else {\n            CGRect rect = [_innerLayout caretRectForPosition:selectedRange.end];\n            _selectionView.caretRect = [self _convertRectFromLayout:rect];\n            _selectionView.caretVisible = YES;\n            _selectionView.caretBlinks = YES;\n        }\n    } else {\n        if (selectedRange.asRange.length == 0) { // only caret\n            if (self.isFirstResponder || _state.trackingPreSelect) {\n                CGRect rect = [_innerLayout caretRectForPosition:selectedRange.end];\n                _selectionView.caretRect = [self _convertRectFromLayout:rect];\n                _selectionView.caretVisible = YES;\n                if (!_state.trackingCaret && !_state.trackingPreSelect) {\n                    _selectionView.caretBlinks = YES;\n                }\n            }\n        } else { // range selected\n            if ((self.isFirstResponder && !_state.deleteConfirm) ||\n                (!self.isFirstResponder && _state.selectedWithoutEdit)) {\n                NSArray *rects = [_innerLayout selectionRectsForRange:selectedRange];\n                if (rects) [allRects addObjectsFromArray:rects];\n                containsDot = rects.count > 0;\n            } else if ((!self.isFirstResponder && _state.trackingPreSelect) ||\n                       (self.isFirstResponder && _state.deleteConfirm)){\n                NSArray *rects = [_innerLayout selectionRectsWithoutStartAndEndForRange:selectedRange];\n                if (rects) [allRects addObjectsFromArray:rects];\n            }\n        }\n    }\n    [allRects enumerateObjectsUsingBlock:^(YYTextSelectionRect *rect, NSUInteger idx, BOOL *stop) {\n        rect.rect = [self _convertRectFromLayout:rect.rect];\n    }];\n    _selectionView.selectionRects = allRects;\n    if (!_state.firstShowDot && containsDot) {\n        _state.firstShowDot = YES;\n        /*\n         The dot position may be wrong at the first time displayed.\n         I can't find the reason. Here's a workaround.\n         */\n        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.02 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n            [[YYTextEffectWindow sharedWindow] showSelectionDot:_selectionView];\n        });\n    }\n    [[YYTextEffectWindow sharedWindow] showSelectionDot:_selectionView];\n    \n    if (containsDot) {\n        [self _startSelectionDotFixTimer];\n    } else {\n        [self _endSelectionDotFixTimer];\n    }\n}\n\n/// Update inner contains's size.\n- (void)_updateInnerContainerSize {\n    CGSize size = [self _getVisibleSize];\n    if (_innerContainer.isVerticalForm) size.width = CGFLOAT_MAX;\n    else size.height = CGFLOAT_MAX;\n    _innerContainer.size = size;\n}\n\n/// Update placeholder before runloop sleep/end.\n- (void)_commitPlaceholderUpdate {\n#if !TARGET_INTERFACE_BUILDER\n    _state.placeholderNeedUpdate = YES;\n    [[YYTextTransaction transactionWithTarget:self selector:@selector(_updatePlaceholderIfNeeded)] commit];\n#else\n    [self _updatePlaceholder];\n#endif\n}\n\n/// Update placeholder if needed.\n- (void)_updatePlaceholderIfNeeded {\n    if (_state.placeholderNeedUpdate) {\n        _state.placeholderNeedUpdate = NO;\n        [self _updatePlaceholder];\n    }\n}\n\n/// Update placeholder immediately.\n- (void)_updatePlaceholder {\n    CGRect frame = CGRectZero;\n    _placeHolderView.image = nil;\n    _placeHolderView.frame = frame;\n    if (_placeholderAttributedText.length > 0) {\n        YYTextContainer *container = _innerContainer.copy;\n        container.size = self.bounds.size;\n        container.truncationType = YYTextTruncationTypeEnd;\n        container.truncationToken = nil;\n        YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:_placeholderAttributedText];\n        CGSize size = [layout textBoundingSize];\n        BOOL needDraw = size.width > 1 && size.height > 1;\n        if (needDraw) {\n            UIGraphicsBeginImageContextWithOptions(size, NO, 0);\n            CGContextRef context = UIGraphicsGetCurrentContext();\n            [layout drawInContext:context size:size debug:self.debugOption];\n            UIImage *image = UIGraphicsGetImageFromCurrentImageContext();\n            UIGraphicsEndImageContext();\n            _placeHolderView.image = image;\n            frame.size = image.size;\n            if (container.isVerticalForm) {\n                frame.origin.x = self.bounds.size.width - image.size.width;\n            } else {\n                frame.origin = CGPointZero;\n            }\n            _placeHolderView.frame = frame;\n        }\n    }\n}\n\n/// Update the `_selectedTextRange` to a single position by `_trackingPoint`.\n- (void)_updateTextRangeByTrackingCaret {\n    if (!_state.trackingTouch) return;\n    \n    CGPoint trackingPoint = [self _convertPointToLayout:_trackingPoint];\n    YYTextPosition *newPos = [_innerLayout closestPositionToPoint:trackingPoint];\n    if (newPos) {\n        newPos = [self _correctedTextPosition:newPos];\n        if (_markedTextRange) {\n            if ([newPos compare:_markedTextRange.start] == NSOrderedAscending) {\n                newPos = _markedTextRange.start;\n            } else if ([newPos compare:_markedTextRange.end] == NSOrderedDescending) {\n                newPos = _markedTextRange.end;\n            }\n        }\n        YYTextRange *newRange = [YYTextRange rangeWithRange:NSMakeRange(newPos.offset, 0) affinity:newPos.affinity];\n        _trackingRange = newRange;\n    }\n}\n\n/// Update the `_selectedTextRange` to a new range by `_trackingPoint` and `_state.trackingGrabber`.\n- (void)_updateTextRangeByTrackingGrabber {\n    if (!_state.trackingTouch || !_state.trackingGrabber) return;\n    \n    BOOL isStart = _state.trackingGrabber == kStart;\n    CGPoint magPoint = _trackingPoint;\n    magPoint.y += kMagnifierRangedTrackFix;\n    magPoint = [self _convertPointToLayout:magPoint];\n    YYTextPosition *position = [_innerLayout positionForPoint:magPoint\n                                                  oldPosition:(isStart ? _selectedTextRange.start : _selectedTextRange.end)\n                                                otherPosition:(isStart ? _selectedTextRange.end : _selectedTextRange.start)];\n    if (position) {\n        position = [self _correctedTextPosition:position];\n        if ((NSUInteger)position.offset > _innerText.length) {\n            position = [YYTextPosition positionWithOffset:_innerText.length];\n        }\n        YYTextRange *newRange = [YYTextRange rangeWithStart:(isStart ? position : _selectedTextRange.start)\n                                                        end:(isStart ? _selectedTextRange.end : position)];\n        _trackingRange = newRange;\n    }\n}\n\n/// Update the `_selectedTextRange` to a new range/position by `_trackingPoint`.\n- (void)_updateTextRangeByTrackingPreSelect {\n    if (!_state.trackingTouch) return;\n    YYTextRange *newRange = [self _getClosestTokenRangeAtPoint:_trackingPoint];\n    _trackingRange = newRange;\n}\n\n/// Show or update `_magnifierCaret` based on `_trackingPoint`, and hide `_magnifierRange`.\n- (void)_showMagnifierCaret {\n    if (YYTextIsAppExtension()) return;\n    \n    if (_state.showingMagnifierRanged) {\n        _state.showingMagnifierRanged = NO;\n        [[YYTextEffectWindow sharedWindow] hideMagnifier:_magnifierRanged];\n    }\n    \n    _magnifierCaret.hostPopoverCenter = _trackingPoint;\n    _magnifierCaret.hostCaptureCenter = _trackingPoint;\n    if (!_state.showingMagnifierCaret) {\n        _state.showingMagnifierCaret = YES;\n        [[YYTextEffectWindow sharedWindow] showMagnifier:_magnifierCaret];\n    } else {\n        [[YYTextEffectWindow sharedWindow] moveMagnifier:_magnifierCaret];\n    }\n}\n\n/// Show or update `_magnifierRanged` based on `_trackingPoint`, and hide `_magnifierCaret`.\n- (void)_showMagnifierRanged {\n    if (YYTextIsAppExtension()) return;\n    \n    if (_verticalForm) { // hack for vertical form...\n        [self _showMagnifierCaret];\n        return;\n    }\n    \n    if (_state.showingMagnifierCaret) {\n        _state.showingMagnifierCaret = NO;\n        [[YYTextEffectWindow sharedWindow] hideMagnifier:_magnifierCaret];\n    }\n    \n    CGPoint magPoint = _trackingPoint;\n    if (_verticalForm) {\n        magPoint.x += kMagnifierRangedTrackFix;\n    } else {\n        magPoint.y += kMagnifierRangedTrackFix;\n    }\n    \n    YYTextRange *selectedRange = _selectedTextRange;\n    if (_state.trackingTouch && _trackingRange) {\n        selectedRange = _trackingRange;\n    }\n    \n    YYTextPosition *position;\n    if (_markedTextRange) {\n        position = selectedRange.end;\n    } else {\n        position = [_innerLayout positionForPoint:[self _convertPointToLayout:magPoint]\n                                      oldPosition:(_state.trackingGrabber == kStart ? selectedRange.start : selectedRange.end)\n                                    otherPosition:(_state.trackingGrabber == kStart ? selectedRange.end : selectedRange.start)];\n    }\n    \n    NSUInteger lineIndex = [_innerLayout lineIndexForPosition:position];\n    if (lineIndex < _innerLayout.lines.count) {\n        YYTextLine *line = _innerLayout.lines[lineIndex];\n        CGRect lineRect = [self _convertRectFromLayout:line.bounds];\n        if (_verticalForm) {\n            magPoint.x = YYTEXT_CLAMP(magPoint.x, CGRectGetMinX(lineRect), CGRectGetMaxX(lineRect));\n        } else {\n            magPoint.y = YYTEXT_CLAMP(magPoint.y, CGRectGetMinY(lineRect), CGRectGetMaxY(lineRect));\n        }\n        CGPoint linePoint = [_innerLayout linePositionForPosition:position];\n        linePoint = [self _convertPointFromLayout:linePoint];\n        \n        CGPoint popoverPoint = linePoint;\n        if (_verticalForm) {\n            popoverPoint.x = linePoint.x + _magnifierRangedOffset;\n        } else {\n            popoverPoint.y = linePoint.y + _magnifierRangedOffset;\n        }\n        \n        CGPoint capturePoint;\n        if (_verticalForm) {\n            capturePoint.x = linePoint.x + kMagnifierRangedCaptureOffset;\n            capturePoint.y = linePoint.y;\n        } else {\n            capturePoint.x = linePoint.x;\n            capturePoint.y = linePoint.y + kMagnifierRangedCaptureOffset;\n        }\n        \n        _magnifierRanged.hostPopoverCenter = popoverPoint;\n        _magnifierRanged.hostCaptureCenter = capturePoint;\n        if (!_state.showingMagnifierRanged) {\n            _state.showingMagnifierRanged = YES;\n            [[YYTextEffectWindow sharedWindow] showMagnifier:_magnifierRanged];\n        } else {\n            [[YYTextEffectWindow sharedWindow] moveMagnifier:_magnifierRanged];\n        }\n    }\n}\n\n/// Update the showing magnifier.\n- (void)_updateMagnifier {\n    if (YYTextIsAppExtension()) return;\n    \n    if (_state.showingMagnifierCaret) {\n        [[YYTextEffectWindow sharedWindow] moveMagnifier:_magnifierCaret];\n    }\n    if (_state.showingMagnifierRanged) {\n        [[YYTextEffectWindow sharedWindow] moveMagnifier:_magnifierRanged];\n    }\n}\n\n/// Hide the `_magnifierCaret` and `_magnifierRanged`.\n- (void)_hideMagnifier {\n    if (YYTextIsAppExtension()) return;\n    \n    if (_state.showingMagnifierCaret || _state.showingMagnifierRanged) {\n        // disable touch began temporary to ignore caret animation overlap\n        _state.ignoreTouchBegan = YES;\n        __weak typeof(self) _self = self;\n        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n            __strong typeof(_self) self = _self;\n            if (self) self->_state.ignoreTouchBegan = NO;\n        });\n    }\n    \n    if (_state.showingMagnifierCaret) {\n        _state.showingMagnifierCaret = NO;\n        [[YYTextEffectWindow sharedWindow] hideMagnifier:_magnifierCaret];\n    }\n    if (_state.showingMagnifierRanged) {\n        _state.showingMagnifierRanged = NO;\n        [[YYTextEffectWindow sharedWindow] hideMagnifier:_magnifierRanged];\n    }\n}\n\n/// Show and update the UIMenuController.\n- (void)_showMenu {\n    CGRect rect;\n    if (_selectionView.caretVisible) {\n        rect = _selectionView.caretView.frame;\n    } else if (_selectionView.selectionRects.count > 0) {\n        YYTextSelectionRect *sRect = _selectionView.selectionRects.firstObject;\n        rect = sRect.rect;\n        for (NSUInteger i = 1; i < _selectionView.selectionRects.count; i++) {\n            sRect = _selectionView.selectionRects[i];\n            rect = CGRectUnion(rect, sRect.rect);\n        }\n        \n        CGRect inter = CGRectIntersection(rect, self.bounds);\n        if (!CGRectIsNull(inter) && inter.size.height > 1) {\n            rect = inter; //clip to bounds\n        } else {\n            if (CGRectGetMinY(rect) < CGRectGetMinY(self.bounds)) {\n                rect.size.height = 1;\n                rect.origin.y = CGRectGetMinY(self.bounds);\n            } else {\n                rect.size.height = 1;\n                rect.origin.y = CGRectGetMaxY(self.bounds);\n            }\n        }\n        \n        YYTextKeyboardManager *mgr = [YYTextKeyboardManager defaultManager];\n        if (mgr.keyboardVisible) {\n            CGRect kbRect = [mgr convertRect:mgr.keyboardFrame toView:self];\n            CGRect kbInter = CGRectIntersection(rect, kbRect);\n            if (!CGRectIsNull(kbInter) && kbInter.size.height > 1 && kbInter.size.width > 1) {\n                // self is covered by keyboard\n                if (CGRectGetMinY(kbInter) > CGRectGetMinY(rect)) { // keyboard at bottom\n                    rect.size.height -= kbInter.size.height;\n                } else if (CGRectGetMaxY(kbInter) < CGRectGetMaxY(rect)) { // keyboard at top\n                    rect.origin.y += kbInter.size.height;\n                    rect.size.height -= kbInter.size.height;\n                }\n            }\n        }\n    } else {\n        rect = _selectionView.bounds;\n    }\n    \n    if (!self.isFirstResponder) {\n        if (!_containerView.isFirstResponder) {\n            [_containerView becomeFirstResponder];\n        }\n    }\n    \n    if (self.isFirstResponder || _containerView.isFirstResponder) {\n        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n            UIMenuController *menu = [UIMenuController sharedMenuController];\n            [menu setTargetRect:CGRectStandardize(rect) inView:_selectionView];\n            [menu update];\n            if (!_state.showingMenu || !menu.menuVisible) {\n                _state.showingMenu = YES;\n                [menu setMenuVisible:YES animated:YES];\n            }\n        });\n    }\n}\n\n/// Hide the UIMenuController.\n- (void)_hideMenu {\n    if (_state.showingMenu) {\n        _state.showingMenu = NO;\n        UIMenuController *menu = [UIMenuController sharedMenuController];\n        [menu setMenuVisible:NO animated:YES];\n    }\n    if (_containerView.isFirstResponder) {\n        _state.ignoreFirstResponder = YES;\n        [_containerView resignFirstResponder]; // it will call [self becomeFirstResponder], ignore it temporary.\n        _state.ignoreFirstResponder = NO;\n    }\n}\n\n/// Show highlight layout based on `_highlight` and `_highlightRange`\n/// If the `_highlightLayout` is nil, try to create.\n- (void)_showHighlightAnimated:(BOOL)animated {\n    NSTimeInterval fadeDuration = animated ? kHighlightFadeDuration : 0;\n    if (!_highlight) return;\n    if (!_highlightLayout) {\n        NSMutableAttributedString *hiText = (_delectedText ? _delectedText : _innerText).mutableCopy;\n        NSDictionary *newAttrs = _highlight.attributes;\n        [newAttrs enumerateKeysAndObjectsUsingBlock:^(NSString *key, id value, BOOL *stop) {\n            [hiText yy_setAttribute:key value:value range:_highlightRange];\n        }];\n        _highlightLayout = [YYTextLayout layoutWithContainer:_innerContainer text:hiText];\n        if (!_highlightLayout) _highlight = nil;\n    }\n    \n    if (_highlightLayout && !_state.showingHighlight) {\n        _state.showingHighlight = YES;\n        [_containerView setLayout:_highlightLayout withFadeDuration:fadeDuration];\n    }\n}\n\n/// Show `_innerLayout` instead of `_highlightLayout`.\n/// It does not destory the `_highlightLayout`.\n- (void)_hideHighlightAnimated:(BOOL)animated {\n    NSTimeInterval fadeDuration = animated ? kHighlightFadeDuration : 0;\n    if (_state.showingHighlight) {\n        _state.showingHighlight = NO;\n        [_containerView setLayout:_innerLayout withFadeDuration:fadeDuration];\n    }\n}\n\n/// Show `_innerLayout` and destory the `_highlight` and `_highlightLayout`.\n- (void)_removeHighlightAnimated:(BOOL)animated {\n    [self _hideHighlightAnimated:animated];\n    _highlight = nil;\n    _highlightLayout = nil;\n}\n\n/// Scroll current selected range to visible.\n- (void)_scrollSelectedRangeToVisible {\n    [self _scrollRangeToVisible:_selectedTextRange];\n}\n\n/// Scroll range to visible, take account into keyboard and insets.\n- (void)_scrollRangeToVisible:(YYTextRange *)range {\n    if (!range) return;\n    CGRect rect = [_innerLayout rectForRange:range];\n    if (CGRectIsNull(rect)) return;\n    rect = [self _convertRectFromLayout:rect];\n    rect = [_containerView convertRect:rect toView:self];\n    \n    if (rect.size.width < 1) rect.size.width = 1;\n    if (rect.size.height < 1) rect.size.height = 1;\n    CGFloat extend = 3;\n    \n    BOOL insetModified = NO;\n    YYTextKeyboardManager *mgr = [YYTextKeyboardManager defaultManager];\n    \n    if (mgr.keyboardVisible && self.window && self.superview && self.isFirstResponder && !_verticalForm) {\n        CGRect bounds = self.bounds;\n        bounds.origin = CGPointZero;\n        CGRect kbRect = [mgr convertRect:mgr.keyboardFrame toView:self];\n        kbRect.origin.y -= _extraAccessoryViewHeight;\n        kbRect.size.height += _extraAccessoryViewHeight;\n        \n        kbRect.origin.x -= self.contentOffset.x;\n        kbRect.origin.y -= self.contentOffset.y;\n        CGRect inter = CGRectIntersection(bounds, kbRect);\n        if (!CGRectIsNull(inter) && inter.size.height > 1 && inter.size.width > extend) { // self is covered by keyboard\n            if (CGRectGetMinY(inter) > CGRectGetMinY(bounds)) { // keyboard below self.top\n                \n                UIEdgeInsets originalContentInset = self.contentInset;\n                UIEdgeInsets originalScrollIndicatorInsets = self.scrollIndicatorInsets;\n                if (_insetModifiedByKeyboard) {\n                    originalContentInset = _originalContentInset;\n                    originalScrollIndicatorInsets = _originalScrollIndicatorInsets;\n                }\n                \n                if (originalContentInset.bottom < inter.size.height + extend) {\n                    insetModified = YES;\n                    if (!_insetModifiedByKeyboard) {\n                        _insetModifiedByKeyboard = YES;\n                        _originalContentInset = self.contentInset;\n                        _originalScrollIndicatorInsets = self.scrollIndicatorInsets;\n                    }\n                    UIEdgeInsets newInset = originalContentInset;\n                    UIEdgeInsets newIndicatorInsets = originalScrollIndicatorInsets;\n                    newInset.bottom = inter.size.height + extend;\n                    newIndicatorInsets.bottom = newInset.bottom;\n                    UIViewAnimationOptions curve;\n                    if (kiOS7Later) {\n                        curve = 7 << 16;\n                    } else {\n                        curve = UIViewAnimationOptionCurveEaseInOut;\n                    }\n                    [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction | curve animations:^{\n                        [super setContentInset:newInset];\n                        [super setScrollIndicatorInsets:newIndicatorInsets];\n                        [self scrollRectToVisible:CGRectInset(rect, -extend, -extend) animated:NO];\n                    } completion:NULL];\n                }\n            }\n        }\n    }\n    if (!insetModified) {\n        [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveEaseOut animations:^{\n            [self _restoreInsetsAnimated:NO];\n            [self scrollRectToVisible:CGRectInset(rect, -extend, -extend) animated:NO];\n        } completion:NULL];\n    }\n}\n\n/// Restore contents insets if modified by keyboard.\n- (void)_restoreInsetsAnimated:(BOOL)animated {\n    if (_insetModifiedByKeyboard) {\n        _insetModifiedByKeyboard = NO;\n        if (animated) {\n            [UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveEaseOut  animations:^{\n                [super setContentInset:_originalContentInset];\n                [super setScrollIndicatorInsets:_originalScrollIndicatorInsets];\n            } completion:NULL];\n        } else {\n            [super setContentInset:_originalContentInset];\n            [super setScrollIndicatorInsets:_originalScrollIndicatorInsets];\n        }\n    }\n}\n\n/// Keyboard frame changed, scroll the caret to visible range, or modify the content insets.\n- (void)_keyboardChanged {\n    if (!self.isFirstResponder) return;\n    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{\n        if ([YYTextKeyboardManager defaultManager].keyboardVisible) {\n            [self _scrollRangeToVisible:_selectedTextRange];\n        } else {\n            [self _restoreInsetsAnimated:YES];\n        }\n        [self _updateMagnifier];\n        if (_state.showingMenu) {\n            [self _showMenu];\n        }\n    });\n}\n\n/// Start long press timer, used for 'highlight' range text action.\n- (void)_startLongPressTimer {\n    [_longPressTimer invalidate];\n    _longPressTimer = [NSTimer timerWithTimeInterval:kLongPressMinimumDuration\n                                              target:[YYTextWeakProxy proxyWithTarget:self]\n                                            selector:@selector(_trackDidLongPress)\n                                            userInfo:nil\n                                             repeats:NO];\n    [[NSRunLoop currentRunLoop] addTimer:_longPressTimer forMode:NSRunLoopCommonModes];\n}\n\n/// Invalidate the long press timer.\n- (void)_endLongPressTimer {\n    [_longPressTimer invalidate];\n    _longPressTimer = nil;\n}\n\n/// Long press detected.\n- (void)_trackDidLongPress {\n    [self _endLongPressTimer];\n    \n    BOOL dealLongPressAction = NO;\n    if (_state.showingHighlight) {\n        [self _hideMenu];\n        \n        if (_highlight.longPressAction) {\n            dealLongPressAction = YES;\n            CGRect rect = [_innerLayout rectForRange:[YYTextRange rangeWithRange:_highlightRange]];\n            rect = [self _convertRectFromLayout:rect];\n            _highlight.longPressAction(self, _innerText, _highlightRange, rect);\n            [self _endTouchTracking];\n        } else {\n            BOOL shouldHighlight = YES;\n            if ([self.delegate respondsToSelector:@selector(textView:shouldLongPressHighlight:inRange:)]) {\n                shouldHighlight = [self.delegate textView:self shouldLongPressHighlight:_highlight inRange:_highlightRange];\n            }\n            if (shouldHighlight && [self.delegate respondsToSelector:@selector(textView:didLongPressHighlight:inRange:rect:)]) {\n                dealLongPressAction = YES;\n                CGRect rect = [_innerLayout rectForRange:[YYTextRange rangeWithRange:_highlightRange]];\n                rect = [self _convertRectFromLayout:rect];\n                [self.delegate textView:self didLongPressHighlight:_highlight inRange:_highlightRange rect:rect];\n                [self _endTouchTracking];\n            }\n        }\n    }\n    \n    if (!dealLongPressAction){\n        [self _removeHighlightAnimated:NO];\n        if (_state.trackingTouch) {\n            if (_state.trackingGrabber) {\n                self.panGestureRecognizer.enabled = NO;\n                [self _hideMenu];\n                [self _showMagnifierRanged];\n            } else if (self.isFirstResponder){\n                self.panGestureRecognizer.enabled = NO;\n                _selectionView.caretBlinks = NO;\n                _state.trackingCaret = YES;\n                CGPoint trackingPoint = [self _convertPointToLayout:_trackingPoint];\n                YYTextPosition *newPos = [_innerLayout closestPositionToPoint:trackingPoint];\n                newPos = [self _correctedTextPosition:newPos];\n                if (newPos) {\n                    if (_markedTextRange) {\n                        if ([newPos compare:_markedTextRange.start] != NSOrderedDescending) {\n                            newPos = _markedTextRange.start;\n                        } else if ([newPos compare:_markedTextRange.end] != NSOrderedAscending) {\n                            newPos = _markedTextRange.end;\n                        }\n                    }\n                    _trackingRange = [YYTextRange rangeWithRange:NSMakeRange(newPos.offset, 0) affinity:newPos.affinity];\n                    [self _updateSelectionView];\n                }\n                [self _hideMenu];\n                \n                if (_markedTextRange) {\n                    [self _showMagnifierRanged];\n                } else {\n                    [self _showMagnifierCaret];\n                }\n            } else if (self.selectable) {\n                self.panGestureRecognizer.enabled = NO;\n                _state.trackingPreSelect = YES;\n                _state.selectedWithoutEdit = NO;\n                [self _updateTextRangeByTrackingPreSelect];\n                [self _updateSelectionView];\n                [self _showMagnifierCaret];\n            }\n        }\n    }\n}\n\n/// Start auto scroll timer, used for auto scroll tick.\n- (void)_startAutoScrollTimer {\n    if (!_autoScrollTimer) {\n        [_autoScrollTimer invalidate];\n        _autoScrollTimer = [NSTimer timerWithTimeInterval:kAutoScrollMinimumDuration\n                                                   target:[YYTextWeakProxy proxyWithTarget:self]\n                                                 selector:@selector(_trackDidTickAutoScroll)\n                                                 userInfo:nil\n                                                  repeats:YES];\n        [[NSRunLoop currentRunLoop] addTimer:_autoScrollTimer forMode:NSRunLoopCommonModes];\n    }\n}\n\n/// Invalidate the auto scroll, and restore the text view state.\n- (void)_endAutoScrollTimer {\n    if (_state.autoScrollTicked) [self flashScrollIndicators];\n    [_autoScrollTimer invalidate];\n    _autoScrollTimer = nil;\n    _autoScrollOffset = 0;\n    _autoScrollAcceleration = 0;\n    _state.autoScrollTicked = NO;\n    \n    if (_magnifierCaret.captureDisabled) {\n        _magnifierCaret.captureDisabled = NO;\n        if (_state.showingMagnifierCaret) {\n            [self _showMagnifierCaret];\n        }\n    }\n    if (_magnifierRanged.captureDisabled) {\n        _magnifierRanged.captureDisabled = NO;\n        if (_state.showingMagnifierRanged) {\n            [self _showMagnifierRanged];\n        }\n    }\n}\n\n/// Auto scroll ticked by timer.\n- (void)_trackDidTickAutoScroll {\n    if (_autoScrollOffset != 0) {\n        _magnifierCaret.captureDisabled = YES;\n        _magnifierRanged.captureDisabled = YES;\n        \n        CGPoint offset = self.contentOffset;\n        if (_verticalForm) {\n            offset.x += _autoScrollOffset;\n            \n            if (_autoScrollAcceleration > 0) {\n                offset.x += ((_autoScrollOffset > 0 ? 1 : -1) * _autoScrollAcceleration * _autoScrollAcceleration * 0.5);\n            }\n            _autoScrollAcceleration++;\n            offset.x = round(offset.x);\n            if (_autoScrollOffset < 0) {\n                if (offset.x < -self.contentInset.left) offset.x = -self.contentInset.left;\n            } else {\n                CGFloat maxOffsetX = self.contentSize.width - self.bounds.size.width + self.contentInset.right;\n                if (offset.x > maxOffsetX) offset.x = maxOffsetX;\n            }\n            if (offset.x < -self.contentInset.left) offset.x = -self.contentInset.left;\n        } else {\n            offset.y += _autoScrollOffset;\n            if (_autoScrollAcceleration > 0) {\n                offset.y += ((_autoScrollOffset > 0 ? 1 : -1) * _autoScrollAcceleration * _autoScrollAcceleration * 0.5);\n            }\n            _autoScrollAcceleration++;\n            offset.y = round(offset.y);\n            if (_autoScrollOffset < 0) {\n                if (offset.y < -self.contentInset.top) offset.y = -self.contentInset.top;\n            } else {\n                CGFloat maxOffsetY = self.contentSize.height - self.bounds.size.height + self.contentInset.bottom;\n                if (offset.y > maxOffsetY) offset.y = maxOffsetY;\n            }\n            if (offset.y < -self.contentInset.top) offset.y = -self.contentInset.top;\n        }\n        \n        BOOL shouldScroll;\n        if (_verticalForm) {\n            shouldScroll = fabs(offset.x -self.contentOffset.x) > 0.5;\n        } else {\n            shouldScroll = fabs(offset.y -self.contentOffset.y) > 0.5;\n        }\n        \n        if (shouldScroll) {\n            _state.autoScrollTicked = YES;\n            _trackingPoint.x += offset.x - self.contentOffset.x;\n            _trackingPoint.y += offset.y - self.contentOffset.y;\n            [UIView animateWithDuration:kAutoScrollMinimumDuration delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveLinear animations:^{\n                [self setContentOffset:offset];\n            } completion:^(BOOL finished) {\n                if (_state.trackingTouch) {\n                    if (_state.trackingGrabber) {\n                        [self _showMagnifierRanged];\n                        [self _updateTextRangeByTrackingGrabber];\n                    } else if (_state.trackingPreSelect) {\n                        [self _showMagnifierCaret];\n                        [self _updateTextRangeByTrackingPreSelect];\n                    } else if (_state.trackingCaret) {\n                        if (_markedTextRange) {\n                            [self _showMagnifierRanged];\n                        } else {\n                            [self _showMagnifierCaret];\n                        }\n                        [self _updateTextRangeByTrackingCaret];\n                    }\n                    [self _updateSelectionView];\n                }\n            }];\n        } else {\n            [self _endAutoScrollTimer];\n        }\n    } else {\n        [self _endAutoScrollTimer];\n    }\n}\n\n/// End current touch tracking (if is tracking now), and update the state.\n- (void)_endTouchTracking {\n    if (!_state.trackingTouch) return;\n    \n    _state.trackingTouch = NO;\n    _state.trackingGrabber = NO;\n    _state.trackingCaret = NO;\n    _state.trackingPreSelect = NO;\n    _state.touchMoved = NO;\n    _state.deleteConfirm = NO;\n    _state.clearsOnInsertionOnce = NO;\n    _trackingRange = nil;\n    _selectionView.caretBlinks = YES;\n    \n    [self _removeHighlightAnimated:YES];\n    [self _hideMagnifier];\n    [self _endLongPressTimer];\n    [self _endAutoScrollTimer];\n    [self _updateSelectionView];\n    \n    self.panGestureRecognizer.enabled = self.scrollEnabled;\n}\n\n/// Start a timer to fix the selection dot.\n- (void)_startSelectionDotFixTimer {\n    [_selectionDotFixTimer invalidate];\n    _longPressTimer = [NSTimer timerWithTimeInterval:1/15.0\n                                              target:[YYTextWeakProxy proxyWithTarget:self]\n                                            selector:@selector(_fixSelectionDot)\n                                            userInfo:nil\n                                             repeats:NO];\n    [[NSRunLoop currentRunLoop] addTimer:_longPressTimer forMode:NSRunLoopCommonModes];\n}\n\n/// End the timer.\n- (void)_endSelectionDotFixTimer {\n    [_selectionDotFixTimer invalidate];\n    _selectionDotFixTimer = nil;\n}\n\n/// If it shows selection grabber and this view was moved by super view,\n/// update the selection dot in window.\n- (void)_fixSelectionDot {\n    if (YYTextIsAppExtension()) return;\n    CGPoint origin = [self yy_convertPoint:CGPointZero toViewOrWindow:[YYTextEffectWindow sharedWindow]];\n    if (!CGPointEqualToPoint(origin, _previousOriginInWindow)) {\n        _previousOriginInWindow = origin;\n        [[YYTextEffectWindow sharedWindow] hideSelectionDot:_selectionView];\n        [[YYTextEffectWindow sharedWindow] showSelectionDot:_selectionView];\n    }\n}\n\n/// Try to get the character range/position with word granularity from the tokenizer.\n- (YYTextRange *)_getClosestTokenRangeAtPosition:(YYTextPosition *)position {\n    position = [self _correctedTextPosition:position];\n    if (!position) return nil;\n    YYTextRange *range = nil;\n    if (_tokenizer) {\n        range = (id)[_tokenizer rangeEnclosingPosition:position withGranularity:UITextGranularityWord inDirection:UITextStorageDirectionForward];\n        if (range.asRange.length == 0) {\n            range = (id)[_tokenizer rangeEnclosingPosition:position withGranularity:UITextGranularityWord inDirection:UITextStorageDirectionBackward];\n        }\n    }\n    \n    if (!range || range.asRange.length == 0) {\n        range = [_innerLayout textRangeByExtendingPosition:position inDirection:UITextLayoutDirectionRight offset:1];\n        range = [self _correctedTextRange:range];\n        if (range.asRange.length == 0) {\n            range = [_innerLayout textRangeByExtendingPosition:position inDirection:UITextLayoutDirectionLeft offset:1];\n            range = [self _correctedTextRange:range];\n        }\n    } else {\n        YYTextRange *extStart = [_innerLayout textRangeByExtendingPosition:range.start];\n        YYTextRange *extEnd = [_innerLayout textRangeByExtendingPosition:range.end];\n        if (extStart && extEnd) {\n            NSArray *arr = [@[extStart.start, extStart.end, extEnd.start, extEnd.end] sortedArrayUsingSelector:@selector(compare:)];\n            range = [YYTextRange rangeWithStart:arr.firstObject end:arr.lastObject];\n        }\n    }\n    \n    range = [self _correctedTextRange:range];\n    if (range.asRange.length == 0) {\n        range = [YYTextRange rangeWithRange:NSMakeRange(0, _innerText.length)];\n    }\n    \n    return [self _correctedTextRange:range];\n}\n\n/// Try to get the character range/position with word granularity from the tokenizer.\n- (YYTextRange *)_getClosestTokenRangeAtPoint:(CGPoint)point {\n    point = [self _convertPointToLayout:point];\n    YYTextRange *touchRange = [_innerLayout closestTextRangeAtPoint:point];\n    touchRange = [self _correctedTextRange:touchRange];\n    \n    if (_tokenizer && touchRange) {\n        YYTextRange *encEnd = (id)[_tokenizer rangeEnclosingPosition:touchRange.end withGranularity:UITextGranularityWord inDirection:UITextStorageDirectionBackward];\n        YYTextRange *encStart = (id)[_tokenizer rangeEnclosingPosition:touchRange.start withGranularity:UITextGranularityWord inDirection:UITextStorageDirectionForward];\n        if (encEnd && encStart) {\n            NSArray *arr = [@[encEnd.start, encEnd.end, encStart.start, encStart.end] sortedArrayUsingSelector:@selector(compare:)];\n            touchRange = [YYTextRange rangeWithStart:arr.firstObject end:arr.lastObject];\n        }\n    }\n    \n    if (touchRange) {\n        YYTextRange *extStart = [_innerLayout textRangeByExtendingPosition:touchRange.start];\n        YYTextRange *extEnd = [_innerLayout textRangeByExtendingPosition:touchRange.end];\n        if (extStart && extEnd) {\n            NSArray *arr = [@[extStart.start, extStart.end, extEnd.start, extEnd.end] sortedArrayUsingSelector:@selector(compare:)];\n            touchRange = [YYTextRange rangeWithStart:arr.firstObject end:arr.lastObject];\n        }\n    }\n    \n    if (!touchRange) touchRange = [YYTextRange defaultRange];\n    \n    if (_innerText.length && touchRange.asRange.length == 0) {\n        touchRange = [YYTextRange rangeWithRange:NSMakeRange(0, _innerText.length)];\n    }\n    \n    return touchRange;\n}\n\n/// Try to get the highlight property. If exist, the range will be returnd by the range pointer.\n/// If the delegate ignore the highlight, returns nil.\n- (YYTextHighlight *)_getHighlightAtPoint:(CGPoint)point range:(NSRangePointer)range {\n    if (!_highlightable || !_innerLayout.containsHighlight) return nil;\n    point = [self _convertPointToLayout:point];\n    YYTextRange *textRange = [_innerLayout textRangeAtPoint:point];\n    textRange = [self _correctedTextRange:textRange];\n    if (!textRange) return nil;\n    NSUInteger startIndex = textRange.start.offset;\n    if (startIndex == _innerText.length) {\n        if (startIndex == 0) return nil;\n        else startIndex--;\n    }\n    NSRange highlightRange = {0};\n    NSAttributedString *text = _delectedText ? _delectedText : _innerText;\n    YYTextHighlight *highlight = [text attribute:YYTextHighlightAttributeName\n                                         atIndex:startIndex\n                           longestEffectiveRange:&highlightRange\n                                         inRange:NSMakeRange(0, _innerText.length)];\n    \n    if (!highlight) return nil;\n    \n    BOOL shouldTap = YES, shouldLongPress = YES;\n    if (!highlight.tapAction && !highlight.longPressAction) {\n        if ([self.delegate respondsToSelector:@selector(textView:shouldTapHighlight:inRange:)]) {\n            shouldTap = [self.delegate textView:self shouldTapHighlight:highlight inRange:highlightRange];\n        }\n        if ([self.delegate respondsToSelector:@selector(textView:shouldLongPressHighlight:inRange:)]) {\n            shouldLongPress = [self.delegate textView:self shouldLongPressHighlight:highlight inRange:highlightRange];\n        }\n    }\n    if (!shouldTap && !shouldLongPress) return nil;\n    if (range) *range = highlightRange;\n    return highlight;\n}\n\n/// Return the ranged magnifier popover offset from the baseline, base on `_trackingPoint`.\n- (CGFloat)_getMagnifierRangedOffset {\n    CGPoint magPoint = _trackingPoint;\n    magPoint = [self _convertPointToLayout:magPoint];\n    if (_verticalForm) {\n        magPoint.x += kMagnifierRangedTrackFix;\n    } else {\n        magPoint.y += kMagnifierRangedTrackFix;\n    }\n    YYTextPosition *position = [_innerLayout closestPositionToPoint:magPoint];\n    NSUInteger lineIndex = [_innerLayout lineIndexForPosition:position];\n    if (lineIndex < _innerLayout.lines.count) {\n        YYTextLine *line = _innerLayout.lines[lineIndex];\n        if (_verticalForm) {\n            magPoint.x = YYTEXT_CLAMP(magPoint.x, line.left, line.right);\n            return magPoint.x - line.position.x + kMagnifierRangedPopoverOffset;\n        } else {\n            magPoint.y = YYTEXT_CLAMP(magPoint.y, line.top, line.bottom);\n            return magPoint.y - line.position.y + kMagnifierRangedPopoverOffset;\n        }\n    } else {\n        return 0;\n    }\n}\n\n/// Return a YYTextMoveDirection from `_touchBeganPoint` to `_trackingPoint`.\n- (unsigned int)_getMoveDirection {\n    CGFloat moveH = _trackingPoint.x - _touchBeganPoint.x;\n    CGFloat moveV = _trackingPoint.y - _touchBeganPoint.y;\n    if (fabs(moveH) > fabs(moveV)) {\n        if (fabs(moveH) > kLongPressAllowableMovement) {\n            return moveH > 0 ? kRight : kLeft;\n        }\n    } else {\n        if (fabs(moveV) > kLongPressAllowableMovement) {\n            return moveV > 0 ? kBottom : kTop;\n        }\n    }\n    return 0;\n}\n\n/// Get the auto scroll offset in one tick time.\n- (CGFloat)_getAutoscrollOffset {\n    if (!_state.trackingTouch) return 0;\n    \n    CGRect bounds = self.bounds;\n    bounds.origin = CGPointZero;\n    YYTextKeyboardManager *mgr = [YYTextKeyboardManager defaultManager];\n    if (mgr.keyboardVisible && self.window && self.superview && self.isFirstResponder && !_verticalForm) {\n        CGRect kbRect = [mgr convertRect:mgr.keyboardFrame toView:self];\n        kbRect.origin.y -= _extraAccessoryViewHeight;\n        kbRect.size.height += _extraAccessoryViewHeight;\n        \n        kbRect.origin.x -= self.contentOffset.x;\n        kbRect.origin.y -= self.contentOffset.y;\n        CGRect inter = CGRectIntersection(bounds, kbRect);\n        if (!CGRectIsNull(inter) && inter.size.height > 1 && inter.size.width > 1) {\n            if (CGRectGetMinY(inter) > CGRectGetMinY(bounds)) {\n                bounds.size.height -= inter.size.height;\n            }\n        }\n    }\n    \n    CGPoint point = _trackingPoint;\n    point.x -= self.contentOffset.x;\n    point.y -= self.contentOffset.y;\n    \n    CGFloat maxOfs = 32; // a good value ~\n    CGFloat ofs = 0;\n    if (_verticalForm) {\n        if (point.x < self.contentInset.left) {\n            ofs = (point.x - self.contentInset.left - 5) * 0.5;\n            if (ofs < -maxOfs) ofs = -maxOfs;\n        } else if (point.x > bounds.size.width) {\n            ofs = ((point.x - bounds.size.width) + 5) * 0.5;\n            if (ofs > maxOfs) ofs = maxOfs;\n        }\n    } else {\n        if (point.y < self.contentInset.top) {\n            ofs = (point.y - self.contentInset.top - 5) * 0.5;\n            if (ofs < -maxOfs) ofs = -maxOfs;\n        } else if (point.y > bounds.size.height) {\n            ofs = ((point.y - bounds.size.height) + 5) * 0.5;\n            if (ofs > maxOfs) ofs = maxOfs;\n        }\n    }\n    return ofs;\n}\n\n/// Visible size based on bounds and insets\n- (CGSize)_getVisibleSize {\n    CGSize visibleSize = self.bounds.size;\n    visibleSize.width -= self.contentInset.left - self.contentInset.right;\n    visibleSize.height -= self.contentInset.top - self.contentInset.bottom;\n    if (visibleSize.width < 0) visibleSize.width = 0;\n    if (visibleSize.height < 0) visibleSize.height = 0;\n    return visibleSize;\n}\n\n/// Returns whether the text view can paste data from pastboard.\n- (BOOL)_isPasteboardContainsValidValue {\n    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];\n    if (pasteboard.string.length > 0) {\n        return YES;\n    }\n    if (pasteboard.yy_AttributedString.length > 0) {\n        if (_allowsPasteAttributedString) {\n            return YES;\n        }\n    }\n    if (pasteboard.image || pasteboard.yy_ImageData.length > 0) {\n        if (_allowsPasteImage) {\n            return YES;\n        }\n    }\n    return NO;\n}\n\n/// Save current selected attributed text to pasteboard.\n- (void)_copySelectedTextToPasteboard {\n    if (_allowsCopyAttributedString) {\n        NSAttributedString *text = [_innerText attributedSubstringFromRange:_selectedTextRange.asRange];\n        if (text.length) {\n            [UIPasteboard generalPasteboard].yy_AttributedString = text;\n        }\n    } else {\n        NSString *string = [_innerText yy_plainTextForRange:_selectedTextRange.asRange];\n        if (string.length) {\n            [UIPasteboard generalPasteboard].string = string;\n        }\n    }\n}\n\n/// Update the text view state when pasteboard changed.\n- (void)_pasteboardChanged {\n    if (_state.showingMenu) {\n        UIMenuController *menu = [UIMenuController sharedMenuController];\n        [menu update];\n    }\n}\n\n/// Whether the position is valid (not out of bounds).\n- (BOOL)_isTextPositionValid:(YYTextPosition *)position {\n    if (!position) return NO;\n    if (position.offset < 0) return NO;\n    if (position.offset > _innerText.length) return NO;\n    if (position.offset == 0 && position.affinity == YYTextAffinityBackward) return NO;\n    if (position.offset == _innerText.length && position.affinity == YYTextAffinityBackward) return NO;\n    return YES;\n}\n\n/// Whether the range is valid (not out of bounds).\n- (BOOL)_isTextRangeValid:(YYTextRange *)range {\n    if (![self _isTextPositionValid:range.start]) return NO;\n    if (![self _isTextPositionValid:range.end]) return NO;\n    return YES;\n}\n\n/// Correct the position if it out of bounds.\n- (YYTextPosition *)_correctedTextPosition:(YYTextPosition *)position {\n    if (!position) return nil;\n    if ([self _isTextPositionValid:position]) return position;\n    if (position.offset < 0) {\n        return [YYTextPosition positionWithOffset:0];\n    }\n    if (position.offset > _innerText.length) {\n        return [YYTextPosition positionWithOffset:_innerText.length];\n    }\n    if (position.offset == 0 && position.affinity == YYTextAffinityBackward) {\n        return [YYTextPosition positionWithOffset:position.offset];\n    }\n    if (position.offset == _innerText.length && position.affinity == YYTextAffinityBackward) {\n        return [YYTextPosition positionWithOffset:position.offset];\n    }\n    return position;\n}\n\n/// Correct the range if it out of bounds.\n- (YYTextRange *)_correctedTextRange:(YYTextRange *)range {\n    if (!range) return nil;\n    if ([self _isTextRangeValid:range]) return range;\n    YYTextPosition *start = [self _correctedTextPosition:range.start];\n    YYTextPosition *end = [self _correctedTextPosition:range.end];\n    return [YYTextRange rangeWithStart:start end:end];\n}\n\n/// Convert the point from this view to text layout.\n- (CGPoint)_convertPointToLayout:(CGPoint)point {\n    CGSize boundingSize = _innerLayout.textBoundingSize;\n    if (_innerLayout.container.isVerticalForm) {\n        CGFloat w = _innerLayout.textBoundingSize.width;\n        if (w < self.bounds.size.width) w = self.bounds.size.width;\n        point.x += _innerLayout.container.size.width - w;\n        if (boundingSize.width < self.bounds.size.width) {\n            if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n                point.x += (self.bounds.size.width - boundingSize.width) * 0.5;\n            } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n                point.x += (self.bounds.size.width - boundingSize.width);\n            }\n        }\n        return point;\n    } else {\n        if (boundingSize.height < self.bounds.size.height) {\n            if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n                point.y -= (self.bounds.size.height - boundingSize.height) * 0.5;\n            } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n                point.y -= (self.bounds.size.height - boundingSize.height);\n            }\n        }\n        return point;\n    }\n}\n\n/// Convert the point from text layout to this view.\n- (CGPoint)_convertPointFromLayout:(CGPoint)point {\n    CGSize boundingSize = _innerLayout.textBoundingSize;\n    if (_innerLayout.container.isVerticalForm) {\n        CGFloat w = _innerLayout.textBoundingSize.width;\n        if (w < self.bounds.size.width) w = self.bounds.size.width;\n        point.x -= _innerLayout.container.size.width - w;\n        if (boundingSize.width < self.bounds.size.width) {\n            if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n                point.x -= (self.bounds.size.width - boundingSize.width) * 0.5;\n            } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n                point.x -= (self.bounds.size.width - boundingSize.width);\n            }\n        }\n        return point;\n    } else {\n        if (boundingSize.height < self.bounds.size.height) {\n            if (_textVerticalAlignment == YYTextVerticalAlignmentCenter) {\n                point.y += (self.bounds.size.height - boundingSize.height) * 0.5;\n            } else if (_textVerticalAlignment == YYTextVerticalAlignmentBottom) {\n                point.y += (self.bounds.size.height - boundingSize.height);\n            }\n        }\n        return point;\n    }\n}\n\n/// Convert the rect from this view to text layout.\n- (CGRect)_convertRectToLayout:(CGRect)rect {\n    rect.origin = [self _convertPointToLayout:rect.origin];\n    return rect;\n}\n\n/// Convert the rect from text layout to this view.\n- (CGRect)_convertRectFromLayout:(CGRect)rect {\n    rect.origin = [self _convertPointFromLayout:rect.origin];\n    return rect;\n}\n\n/// Replace the range with the text, and change the `_selectTextRange`.\n/// The caller should make sure the `range` and `text` are valid before call this method.\n- (void)_replaceRange:(YYTextRange *)range withText:(NSString *)text notifyToDelegate:(BOOL)notify{\n    if (NSEqualRanges(range.asRange, _selectedTextRange.asRange)) {\n        if (notify) [_inputDelegate selectionWillChange:self];\n        NSRange newRange = NSMakeRange(0, 0);\n        newRange.location = _selectedTextRange.start.offset + text.length;\n        _selectedTextRange = [YYTextRange rangeWithRange:newRange];\n        if (notify) [_inputDelegate selectionDidChange:self];\n    } else {\n        if (range.asRange.length != text.length) {\n            if (notify) [_inputDelegate selectionWillChange:self];\n            NSRange unionRange = NSIntersectionRange(_selectedTextRange.asRange, range.asRange);\n            if (unionRange.length == 0) {\n                // no intersection\n                if (range.end.offset <= _selectedTextRange.start.offset) {\n                    NSInteger ofs = (NSInteger)text.length - (NSInteger)range.asRange.length;\n                    NSRange newRange = _selectedTextRange.asRange;\n                    newRange.location += ofs;\n                    _selectedTextRange = [YYTextRange rangeWithRange:newRange];\n                }\n            } else if (unionRange.length == _selectedTextRange.asRange.length) {\n                // target range contains selected range\n                _selectedTextRange = [YYTextRange rangeWithRange:NSMakeRange(range.start.offset + text.length, 0)];\n            } else if (range.start.offset >= _selectedTextRange.start.offset &&\n                       range.end.offset <= _selectedTextRange.end.offset) {\n                // target range inside selected range\n                NSInteger ofs = (NSInteger)text.length - (NSInteger)range.asRange.length;\n                NSRange newRange = _selectedTextRange.asRange;\n                newRange.length += ofs;\n                _selectedTextRange = [YYTextRange rangeWithRange:newRange];\n            } else {\n                // interleaving\n                if (range.start.offset < _selectedTextRange.start.offset) {\n                    NSRange newRange = _selectedTextRange.asRange;\n                    newRange.location = range.start.offset + text.length;\n                    newRange.length -= unionRange.length;\n                    _selectedTextRange = [YYTextRange rangeWithRange:newRange];\n                } else {\n                    NSRange newRange = _selectedTextRange.asRange;\n                    newRange.length -= unionRange.length;\n                    _selectedTextRange = [YYTextRange rangeWithRange:newRange];\n                }\n            }\n            _selectedTextRange = [self _correctedTextRange:_selectedTextRange];\n            if (notify) [_inputDelegate selectionDidChange:self];\n        }\n    }\n    if (notify) [_inputDelegate textWillChange:self];\n    NSRange newRange = NSMakeRange(range.asRange.location, text.length);\n    [_innerText replaceCharactersInRange:range.asRange withString:text];\n    [_innerText yy_removeDiscontinuousAttributesInRange:newRange];\n    if (notify) [_inputDelegate textDidChange:self];\n}\n\n/// Save current typing attributes to the attributes holder.\n- (void)_updateAttributesHolder {\n    if (_innerText.length > 0) {\n        NSUInteger index = _selectedTextRange.end.offset == 0 ? 0 : _selectedTextRange.end.offset - 1;\n        NSDictionary *attributes = [_innerText yy_attributesAtIndex:index];\n        if (!attributes) attributes = @{};\n        _typingAttributesHolder.yy_attributes = attributes;\n        [_typingAttributesHolder yy_removeDiscontinuousAttributesInRange:NSMakeRange(0, _typingAttributesHolder.length)];\n        [_typingAttributesHolder removeAttribute:YYTextBorderAttributeName range:NSMakeRange(0, _typingAttributesHolder.length)];\n        [_typingAttributesHolder removeAttribute:YYTextBackgroundBorderAttributeName range:NSMakeRange(0, _typingAttributesHolder.length)];\n    }\n}\n\n/// Update outer properties from current inner data.\n- (void)_updateOuterProperties {\n    [self _updateAttributesHolder];\n    NSParagraphStyle *style = _innerText.yy_paragraphStyle;\n    if (!style) style = _typingAttributesHolder.yy_paragraphStyle;\n    if (!style) style = [NSParagraphStyle defaultParagraphStyle];\n    \n    UIFont *font = _innerText.yy_font;\n    if (!font) font = _typingAttributesHolder.yy_font;\n    if (!font) font = [self _defaultFont];\n    \n    UIColor *color = _innerText.yy_color;\n    if (!color) color = _typingAttributesHolder.yy_color;\n    if (!color) color = [UIColor blackColor];\n    \n    [self _setText:[_innerText yy_plainTextForRange:NSMakeRange(0, _innerText.length)]];\n    [self _setFont:font];\n    [self _setTextColor:color];\n    [self _setTextAlignment:style.alignment];\n    [self _setSelectedRange:_selectedTextRange.asRange];\n    [self _setTypingAttributes:_typingAttributesHolder.yy_attributes];\n    [self _setAttributedText:_innerText];\n}\n\n/// Parse text with `textParser` and update the _selectedTextRange.\n/// @return Whether changed (text or selection)\n- (BOOL)_parseText {\n    if (self.textParser) {\n        YYTextRange *oldTextRange = _selectedTextRange;\n        NSRange newRange = _selectedTextRange.asRange;\n        \n        [_inputDelegate textWillChange:self];\n        BOOL textChanged = [self.textParser parseText:_innerText selectedRange:&newRange];\n        [_inputDelegate textDidChange:self];\n        \n        YYTextRange *newTextRange = [YYTextRange rangeWithRange:newRange];\n        newTextRange = [self _correctedTextRange:newTextRange];\n        \n        if (![oldTextRange isEqual:newTextRange]) {\n            [_inputDelegate selectionWillChange:self];\n            _selectedTextRange = newTextRange;\n            [_inputDelegate selectionDidChange:self];\n        }\n        return textChanged;\n    }\n    return NO;\n}\n\n/// Returns whether the text should be detected by the data detector.\n- (BOOL)_shouldDetectText {\n    if (!_dataDetector) return NO;\n    if (!_highlightable) return NO;\n    if (_linkTextAttributes.count == 0 && _highlightTextAttributes.count == 0) return NO;\n    if (self.isFirstResponder || _containerView.isFirstResponder) return NO;\n    return YES;\n}\n\n/// Detect the data in text and add highlight to the data range.\n/// @return Whether detected.\n- (BOOL)_detectText:(NSMutableAttributedString *)text {\n    if (![self _shouldDetectText]) return NO;\n    if (text.length == 0) return NO;\n    __block BOOL detected = NO;\n    [_dataDetector enumerateMatchesInString:text.string options:kNilOptions range:NSMakeRange(0, text.length) usingBlock: ^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {\n        switch (result.resultType) {\n            case NSTextCheckingTypeDate:\n            case NSTextCheckingTypeAddress:\n            case NSTextCheckingTypeLink:\n            case NSTextCheckingTypePhoneNumber: {\n                detected = YES;\n                if (_highlightTextAttributes.count) {\n                    YYTextHighlight *highlight = [YYTextHighlight highlightWithAttributes:_highlightTextAttributes];\n                    [text yy_setTextHighlight:highlight range:result.range];\n                }\n                if (_linkTextAttributes.count) {\n                    [_linkTextAttributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {\n                        [text yy_setAttribute:key value:obj range:result.range];\n                    }];\n                }\n            } break;\n            default:\n                break;\n        }\n    }];\n    return detected;\n}\n\n/// Returns the `root` view controller (returns nil if not found).\n- (UIViewController *)_getRootViewController {\n    UIViewController *ctrl = nil;\n    UIApplication *app = YYTextSharedApplication();\n    if (!ctrl) ctrl = app.keyWindow.rootViewController;\n    if (!ctrl) ctrl = [app.windows.firstObject rootViewController];\n    if (!ctrl) ctrl = self.yy_viewController;\n    if (!ctrl) return nil;\n    \n    while (!ctrl.view.window && ctrl.presentedViewController) {\n        ctrl = ctrl.presentedViewController;\n    }\n    if (!ctrl.view.window) return nil;\n    return ctrl;\n}\n\n/// Clear the undo and redo stack, and capture current state to undo stack.\n- (void)_resetUndoAndRedoStack {\n    [_undoStack removeAllObjects];\n    [_redoStack removeAllObjects];\n    _YYTextViewUndoObject *object = [_YYTextViewUndoObject objectWithText:_innerText.copy range:_selectedTextRange.asRange];\n    _lastTypeRange = _selectedTextRange.asRange;\n    [_undoStack addObject:object];\n}\n\n/// Clear the redo stack.\n- (void)_resetRedoStack {\n    [_redoStack removeAllObjects];\n}\n\n/// Capture current state to undo stack.\n- (void)_saveToUndoStack {\n    if (!_allowsUndoAndRedo) return;\n    _YYTextViewUndoObject *lastObject = _undoStack.lastObject;\n    if ([lastObject.text isEqualToAttributedString:self.attributedText]) return;\n    \n    _YYTextViewUndoObject *object = [_YYTextViewUndoObject objectWithText:_innerText.copy range:_selectedTextRange.asRange];\n    _lastTypeRange = _selectedTextRange.asRange;\n    [_undoStack addObject:object];\n    while (_undoStack.count > _maximumUndoLevel) {\n        [_undoStack removeObjectAtIndex:0];\n    }\n}\n\n/// Capture current state to redo stack.\n- (void)_saveToRedoStack {\n    if (!_allowsUndoAndRedo) return;\n    _YYTextViewUndoObject *lastObject = _redoStack.lastObject;\n    if ([lastObject.text isEqualToAttributedString:self.attributedText]) return;\n    \n    _YYTextViewUndoObject *object = [_YYTextViewUndoObject objectWithText:_innerText.copy range:_selectedTextRange.asRange];\n    [_redoStack addObject:object];\n    while (_redoStack.count > _maximumUndoLevel) {\n        [_redoStack removeObjectAtIndex:0];\n    }\n}\n\n- (BOOL)_canUndo {\n    if (_undoStack.count == 0) return NO;\n    _YYTextViewUndoObject *object = _undoStack.lastObject;\n    if ([object.text isEqualToAttributedString:_innerText]) return NO;\n    return YES;\n}\n\n- (BOOL)_canRedo {\n    if (_redoStack.count == 0) return NO;\n    _YYTextViewUndoObject *object = _undoStack.lastObject;\n    if ([object.text isEqualToAttributedString:_innerText]) return NO;\n    return YES;\n}\n\n- (void)_undo {\n    if (![self _canUndo]) return;\n    [self _saveToRedoStack];\n    _YYTextViewUndoObject *object = _undoStack.lastObject;\n    [_undoStack removeLastObject];\n    \n    _state.insideUndoBlock = YES;\n    self.attributedText = object.text;\n    self.selectedRange = object.selectedRange;\n    _state.insideUndoBlock = NO;\n}\n\n- (void)_redo {\n    if (![self _canRedo]) return;\n    [self _saveToUndoStack];\n    _YYTextViewUndoObject *object = _redoStack.lastObject;\n    [_redoStack removeLastObject];\n    \n    _state.insideUndoBlock = YES;\n    self.attributedText = object.text;\n    self.selectedRange = object.selectedRange;\n    _state.insideUndoBlock = NO;\n}\n\n- (void)_restoreFirstResponderAfterUndoAlert {\n    if (_state.firstResponderBeforeUndoAlert) {\n        [self performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0];\n    }\n}\n\n/// Show undo alert if it can undo or redo.\n#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED\n- (void)_showUndoRedoAlert NS_EXTENSION_UNAVAILABLE_IOS(\"\"){\n    _state.firstResponderBeforeUndoAlert = self.isFirstResponder;\n    __weak typeof(self) _self = self;\n    NSArray *strings = [self _localizedUndoStrings];\n    BOOL canUndo = [self _canUndo];\n    BOOL canRedo = [self _canRedo];\n    \n    UIViewController *ctrl = [self _getRootViewController];\n    \n    if (canUndo && canRedo) {\n        if (kiOS8Later) {\n            UIAlertController *alert = [UIAlertController alertControllerWithTitle:strings[4] message:@\"\" preferredStyle:UIAlertControllerStyleAlert];\n            [alert addAction:[UIAlertAction actionWithTitle:strings[3] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {\n                [_self _undo];\n                [_self _restoreFirstResponderAfterUndoAlert];\n            }]];\n            [alert addAction:[UIAlertAction actionWithTitle:strings[2] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {\n                [_self _redo];\n                [_self _restoreFirstResponderAfterUndoAlert];\n            }]];\n            [alert addAction:[UIAlertAction actionWithTitle:strings[0] style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {\n                [_self _restoreFirstResponderAfterUndoAlert];\n            }]];\n            [ctrl presentViewController:alert animated:YES completion:nil];\n        } else {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strings[4] message:@\"\" delegate:self cancelButtonTitle:strings[0] otherButtonTitles:strings[3], strings[2], nil];\n            [alert show];\n#pragma clang diagnostic pop\n        }\n    } else if (canUndo) {\n        if (kiOS8Later) {\n            UIAlertController *alert = [UIAlertController alertControllerWithTitle:strings[4] message:@\"\" preferredStyle:UIAlertControllerStyleAlert];\n            [alert addAction:[UIAlertAction actionWithTitle:strings[3] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {\n                [_self _undo];\n                [_self _restoreFirstResponderAfterUndoAlert];\n            }]];\n            [alert addAction:[UIAlertAction actionWithTitle:strings[0] style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {\n                [_self _restoreFirstResponderAfterUndoAlert];\n            }]];\n            [ctrl presentViewController:alert animated:YES completion:nil];\n        } else {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strings[4] message:@\"\" delegate:self cancelButtonTitle:strings[0] otherButtonTitles:strings[3], nil];\n            [alert show];\n#pragma clang diagnostic pop\n        }\n    } else if (canRedo) {\n        if (kiOS8Later) {\n            UIAlertController *alert = [UIAlertController alertControllerWithTitle:strings[2] message:@\"\" preferredStyle:UIAlertControllerStyleAlert];\n            [alert addAction:[UIAlertAction actionWithTitle:strings[1] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {\n                [_self _redo];\n                [_self _restoreFirstResponderAfterUndoAlert];\n            }]];\n            [alert addAction:[UIAlertAction actionWithTitle:strings[0] style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {\n                [_self _restoreFirstResponderAfterUndoAlert];\n            }]];\n            [ctrl presentViewController:alert animated:YES completion:nil];\n        } else {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-declarations\"\n            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:strings[2] message:@\"\" delegate:self cancelButtonTitle:strings[0] otherButtonTitles:strings[1], nil];\n            [alert show];\n#pragma clang diagnostic pop\n        }\n    }\n}\n#endif\n\n/// Get the localized undo alert strings based on app's main bundle.\n- (NSArray *)_localizedUndoStrings {\n    static NSArray *strings = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        NSDictionary *dic = @{\n            @\"ar\" : @[ @\"إلغاء\", @\"إعادة\", @\"إعادة الكتابة\", @\"تراجع\", @\"تراجع عن الكتابة\" ],\n            @\"ca\" : @[ @\"Cancel·lar\", @\"Refer\", @\"Refer l’escriptura\", @\"Desfer\", @\"Desfer l’escriptura\" ],\n            @\"cs\" : @[ @\"Zrušit\", @\"Opakovat akci\", @\"Opakovat akci Psát\", @\"Odvolat akci\", @\"Odvolat akci Psát\" ],\n            @\"da\" : @[ @\"Annuller\", @\"Gentag\", @\"Gentag Indtastning\", @\"Fortryd\", @\"Fortryd Indtastning\" ],\n            @\"de\" : @[ @\"Abbrechen\", @\"Wiederholen\", @\"Eingabe wiederholen\", @\"Widerrufen\", @\"Eingabe widerrufen\" ],\n            @\"el\" : @[ @\"Ακύρωση\", @\"Επανάληψη\", @\"Επανάληψη πληκτρολόγησης\", @\"Αναίρεση\", @\"Αναίρεση πληκτρολόγησης\" ],\n            @\"en\" : @[ @\"Cancel\", @\"Redo\", @\"Redo Typing\", @\"Undo\", @\"Undo Typing\" ],\n            @\"es\" : @[ @\"Cancelar\", @\"Rehacer\", @\"Rehacer escritura\", @\"Deshacer\", @\"Deshacer escritura\" ],\n            @\"es_MX\" : @[ @\"Cancelar\", @\"Rehacer\", @\"Rehacer escritura\", @\"Deshacer\", @\"Deshacer escritura\" ],\n            @\"fi\" : @[ @\"Kumoa\", @\"Tee sittenkin\", @\"Kirjoita sittenkin\", @\"Peru\", @\"Peru kirjoitus\" ],\n            @\"fr\" : @[ @\"Annuler\", @\"Rétablir\", @\"Rétablir la saisie\", @\"Annuler\", @\"Annuler la saisie\" ],\n            @\"he\" : @[ @\"ביטול\", @\"חזור על הפעולה האחרונה\", @\"חזור על הקלדה\", @\"בטל\", @\"בטל הקלדה\" ],\n            @\"hr\" : @[ @\"Odustani\", @\"Ponovi\", @\"Ponovno upiši\", @\"Poništi\", @\"Poništi upisivanje\" ],\n            @\"hu\" : @[ @\"Mégsem\", @\"Ismétlés\", @\"Gépelés ismétlése\", @\"Visszavonás\", @\"Gépelés visszavonása\" ],\n            @\"id\" : @[ @\"Batalkan\", @\"Ulang\", @\"Ulang Pengetikan\", @\"Kembalikan\", @\"Batalkan Pengetikan\" ],\n            @\"it\" : @[ @\"Annulla\", @\"Ripristina originale\", @\"Ripristina Inserimento\", @\"Annulla\", @\"Annulla Inserimento\" ],\n            @\"ja\" : @[ @\"キャンセル\", @\"やり直す\", @\"やり直す - 入力\", @\"取り消す\", @\"取り消す - 入力\" ],\n            @\"ko\" : @[ @\"취소\", @\"실행 복귀\", @\"입력 복귀\", @\"실행 취소\", @\"입력 실행 취소\" ],\n            @\"ms\" : @[ @\"Batal\", @\"Buat semula\", @\"Ulang Penaipan\", @\"Buat asal\", @\"Buat asal Penaipan\" ],\n            @\"nb\" : @[ @\"Avbryt\", @\"Utfør likevel\", @\"Utfør skriving likevel\", @\"Angre\", @\"Angre skriving\" ],\n            @\"nl\" : @[ @\"Annuleer\", @\"Opnieuw\", @\"Opnieuw typen\", @\"Herstel\", @\"Herstel typen\" ],\n            @\"pl\" : @[ @\"Anuluj\", @\"Przywróć\", @\"Przywróć Wpisz\", @\"Cofnij\", @\"Cofnij Wpisz\" ],\n            @\"pt\" : @[ @\"Cancelar\", @\"Refazer\", @\"Refazer Digitação\", @\"Desfazer\", @\"Desfazer Digitação\" ],\n            @\"pt_PT\" : @[ @\"Cancelar\", @\"Refazer\", @\"Refazer digitar\", @\"Desfazer\", @\"Desfazer digitar\" ],\n            @\"ro\" : @[ @\"Renunță\", @\"Refă\", @\"Refă tastare\", @\"Anulează\", @\"Anulează tastare\" ],\n            @\"ru\" : @[ @\"Отменить\", @\"Повторить\", @\"Повторить набор на клавиатуре\", @\"Отменить\", @\"Отменить набор на клавиатуре\" ],\n            @\"sk\" : @[ @\"Zrušiť\", @\"Obnoviť\", @\"Obnoviť písanie\", @\"Odvolať\", @\"Odvolať písanie\" ],\n            @\"sv\" : @[ @\"Avbryt\", @\"Gör om\", @\"Gör om skriven text\", @\"Ångra\", @\"Ångra skriven text\" ],\n            @\"th\" : @[ @\"ยกเลิก\", @\"ทำกลับมาใหม่\", @\"ป้อนกลับมาใหม่\", @\"เลิกทำ\", @\"เลิกป้อน\" ],\n            @\"tr\" : @[ @\"Vazgeç\", @\"Yinele\", @\"Yazmayı Yinele\", @\"Geri Al\", @\"Yazmayı Geri Al\" ],\n            @\"uk\" : @[ @\"Скасувати\", @\"Повторити\", @\"Повторити введення\", @\"Відмінити\", @\"Відмінити введення\" ],\n            @\"vi\" : @[ @\"Hủy\", @\"Làm lại\", @\"Làm lại thao tác Nhập\", @\"Hoàn tác\", @\"Hoàn tác thao tác Nhập\" ],\n            @\"zh\" : @[ @\"取消\", @\"重做\", @\"重做键入\", @\"撤销\", @\"撤销键入\" ],\n            @\"zh_CN\" : @[ @\"取消\", @\"重做\", @\"重做键入\", @\"撤销\", @\"撤销键入\" ],\n            @\"zh_HK\" : @[ @\"取消\", @\"重做\", @\"重做輸入\", @\"還原\", @\"還原輸入\" ],\n            @\"zh_TW\" : @[ @\"取消\", @\"重做\", @\"重做輸入\", @\"還原\", @\"還原輸入\" ]\n        };\n        NSString *preferred = [[NSBundle mainBundle] preferredLocalizations].firstObject;\n        if (preferred.length == 0) preferred = @\"English\";\n        NSString *canonical = [NSLocale canonicalLocaleIdentifierFromString:preferred];\n        if (canonical.length == 0) canonical = @\"en\";\n        strings = dic[canonical];\n        if (!strings  && ([canonical rangeOfString:@\"_\"].location != NSNotFound)) {\n            NSString *prefix = [canonical componentsSeparatedByString:@\"_\"].firstObject;\n            if (prefix.length) strings = dic[prefix];\n        }\n        if (!strings) strings = dic[@\"en\"];\n    });\n    return strings;\n}\n\n/// Returns the default font for text view (same as CoreText).\n- (UIFont *)_defaultFont {\n    return [UIFont systemFontOfSize:12];\n}\n\n/// Returns the default tint color for text view (used for caret and select range background).\n- (UIColor *)_defaultTintColor {\n    return [UIColor colorWithRed:69/255.0 green:111/255.0 blue:238/255.0 alpha:1];\n}\n\n/// Returns the default placeholder color for text view (same as UITextField).\n- (UIColor *)_defaultPlaceholderColor {\n    return [UIColor colorWithRed:0 green:0 blue:25/255.0 alpha:44/255.0];\n}\n\n#pragma mark - Private Setter\n\n- (void)_setText:(NSString *)text {\n    if (_text == text || [_text isEqualToString:text]) return;\n    [self willChangeValueForKey:@\"text\"];\n    _text = text.copy;\n    if (!_text) _text = @\"\";\n    [self didChangeValueForKey:@\"text\"];\n    self.accessibilityLabel = _text;\n}\n\n- (void)_setFont:(UIFont *)font {\n    if (_font == font || [_font isEqual:font]) return;\n    [self willChangeValueForKey:@\"font\"];\n    _font = font;\n    [self didChangeValueForKey:@\"font\"];\n}\n\n- (void)_setTextColor:(UIColor *)textColor {\n    if (_textColor == textColor) return;\n    if (_textColor && textColor) {\n        if (CFGetTypeID(_textColor.CGColor) == CFGetTypeID(textColor.CGColor) &&\n            CFGetTypeID(_textColor.CGColor) == CGColorGetTypeID()) {\n            if ([_textColor isEqual:textColor]) {\n                return;\n            }\n        }\n    }\n    [self willChangeValueForKey:@\"textColor\"];\n    _textColor = textColor;\n    [self didChangeValueForKey:@\"textColor\"];\n}\n\n- (void)_setTextAlignment:(NSTextAlignment)textAlignment {\n    if (_textAlignment == textAlignment) return;\n    [self willChangeValueForKey:@\"textAlignment\"];\n    _textAlignment = textAlignment;\n    [self didChangeValueForKey:@\"textAlignment\"];\n}\n\n- (void)_setDataDetectorTypes:(UIDataDetectorTypes)dataDetectorTypes {\n    if (_dataDetectorTypes == dataDetectorTypes) return;\n    [self willChangeValueForKey:@\"dataDetectorTypes\"];\n    _dataDetectorTypes = dataDetectorTypes;\n    [self didChangeValueForKey:@\"dataDetectorTypes\"];\n}\n\n- (void)_setLinkTextAttributes:(NSDictionary *)linkTextAttributes {\n    if (_linkTextAttributes == linkTextAttributes || [_linkTextAttributes isEqual:linkTextAttributes]) return;\n    [self willChangeValueForKey:@\"linkTextAttributes\"];\n    _linkTextAttributes = linkTextAttributes.copy;\n    [self didChangeValueForKey:@\"linkTextAttributes\"];\n}\n\n- (void)_setHighlightTextAttributes:(NSDictionary *)highlightTextAttributes {\n    if (_highlightTextAttributes == highlightTextAttributes || [_highlightTextAttributes isEqual:highlightTextAttributes]) return;\n    [self willChangeValueForKey:@\"highlightTextAttributes\"];\n    _highlightTextAttributes = highlightTextAttributes.copy;\n    [self didChangeValueForKey:@\"highlightTextAttributes\"];\n}\n- (void)_setTextParser:(id<YYTextParser>)textParser {\n    if (_textParser == textParser || [_textParser isEqual:textParser]) return;\n    [self willChangeValueForKey:@\"textParser\"];\n    _textParser = textParser;\n    [self didChangeValueForKey:@\"textParser\"];\n}\n\n- (void)_setAttributedText:(NSAttributedString *)attributedText {\n    if (_attributedText == attributedText || [_attributedText isEqual:attributedText]) return;\n    [self willChangeValueForKey:@\"attributedText\"];\n    _attributedText = attributedText.copy;\n    if (!_attributedText) _attributedText = [NSAttributedString new];\n    [self didChangeValueForKey:@\"attributedText\"];\n}\n\n- (void)_setTextContainerInset:(UIEdgeInsets)textContainerInset {\n    if (UIEdgeInsetsEqualToEdgeInsets(_textContainerInset, textContainerInset)) return;\n    [self willChangeValueForKey:@\"textContainerInset\"];\n    _textContainerInset = textContainerInset;\n    [self didChangeValueForKey:@\"textContainerInset\"];\n}\n\n- (void)_setExclusionPaths:(NSArray *)exclusionPaths {\n    if (_exclusionPaths == exclusionPaths || [_exclusionPaths isEqual:exclusionPaths]) return;\n    [self willChangeValueForKey:@\"exclusionPaths\"];\n    _exclusionPaths = exclusionPaths.copy;\n    [self didChangeValueForKey:@\"exclusionPaths\"];\n}\n\n- (void)_setVerticalForm:(BOOL)verticalForm {\n    if (_verticalForm == verticalForm) return;\n    [self willChangeValueForKey:@\"verticalForm\"];\n    _verticalForm = verticalForm;\n    [self didChangeValueForKey:@\"verticalForm\"];\n}\n\n- (void)_setLinePositionModifier:(id<YYTextLinePositionModifier>)linePositionModifier {\n    if (_linePositionModifier == linePositionModifier) return;\n    [self willChangeValueForKey:@\"linePositionModifier\"];\n    _linePositionModifier = [(NSObject *)linePositionModifier copy];\n    [self didChangeValueForKey:@\"linePositionModifier\"];\n}\n\n- (void)_setSelectedRange:(NSRange)selectedRange {\n    if (NSEqualRanges(_selectedRange, selectedRange)) return;\n    [self willChangeValueForKey:@\"selectedRange\"];\n    _selectedRange = selectedRange;\n    [self didChangeValueForKey:@\"selectedRange\"];\n    if ([self.delegate respondsToSelector:@selector(textViewDidChangeSelection:)]) {\n        [self.delegate textViewDidChangeSelection:self];\n    }\n}\n\n- (void)_setTypingAttributes:(NSDictionary *)typingAttributes {\n    if (_typingAttributes == typingAttributes || [_typingAttributes isEqual:typingAttributes]) return;\n    [self willChangeValueForKey:@\"typingAttributes\"];\n    _typingAttributes = typingAttributes.copy;\n    [self didChangeValueForKey:@\"typingAttributes\"];\n}\n\n#pragma mark - Private Init\n\n- (void)_initTextView {\n    self.delaysContentTouches = NO;\n    self.canCancelContentTouches = YES;\n    self.multipleTouchEnabled = NO;\n    self.clipsToBounds = YES;\n    [super setDelegate:self];\n    \n    _text = @\"\";\n    _attributedText = [NSAttributedString new];\n    \n    // UITextInputTraits\n    _autocapitalizationType = UITextAutocapitalizationTypeSentences;\n    _autocorrectionType = UITextAutocorrectionTypeDefault;\n    _spellCheckingType = UITextSpellCheckingTypeDefault;\n    _keyboardType = UIKeyboardTypeDefault;\n    _keyboardAppearance = UIKeyboardAppearanceDefault;\n    _returnKeyType = UIReturnKeyDefault;\n    _enablesReturnKeyAutomatically = NO;\n    _secureTextEntry = NO;\n    \n    // UITextInput\n    _selectedTextRange = [YYTextRange defaultRange];\n    _markedTextRange = nil;\n    _markedTextStyle = nil;\n    _tokenizer = [[UITextInputStringTokenizer alloc] initWithTextInput:self];\n    \n    _editable = YES;\n    _selectable = YES;\n    _highlightable = YES;\n    _allowsCopyAttributedString = YES;\n    _textAlignment = NSTextAlignmentNatural;\n    \n    _innerText = [NSMutableAttributedString new];\n    _innerContainer = [YYTextContainer new];\n    _innerContainer.insets = kDefaultInset;\n    _textContainerInset = kDefaultInset;\n    _typingAttributesHolder = [[NSMutableAttributedString alloc] initWithString:@\" \"];\n    _linkTextAttributes = @{NSForegroundColorAttributeName : [self _defaultTintColor],\n                            (id)kCTForegroundColorAttributeName : (id)[self _defaultTintColor].CGColor};\n    \n    YYTextHighlight *highlight = [YYTextHighlight new];\n    YYTextBorder * border = [YYTextBorder new];\n    border.insets = UIEdgeInsetsMake(-2, -2, -2, -2);\n    border.fillColor = [UIColor colorWithWhite:0.1 alpha:0.2];\n    border.cornerRadius = 3;\n    [highlight setBorder:border];\n    _highlightTextAttributes = highlight.attributes.copy;\n    \n    _placeHolderView = [UIImageView new];\n    _placeHolderView.userInteractionEnabled = NO;\n    _placeHolderView.hidden = YES;\n    \n    _containerView = [YYTextContainerView new];\n    _containerView.hostView = self;\n    \n    _selectionView = [YYTextSelectionView new];\n    _selectionView.userInteractionEnabled = NO;\n    _selectionView.hostView = self;\n    _selectionView.color = [self _defaultTintColor];\n    \n    _magnifierCaret = [YYTextMagnifier magnifierWithType:YYTextMagnifierTypeCaret];\n    _magnifierCaret.hostView = _containerView;\n    _magnifierRanged = [YYTextMagnifier magnifierWithType:YYTextMagnifierTypeRanged];\n    _magnifierRanged.hostView = _containerView;\n    \n    [self addSubview:_placeHolderView];\n    [self addSubview:_containerView];\n    [self addSubview:_selectionView];\n    \n    _undoStack = [NSMutableArray new];\n    _redoStack = [NSMutableArray new];\n    _allowsUndoAndRedo = YES;\n    _maximumUndoLevel = kDefaultUndoLevelMax;\n    \n    self.debugOption = [YYTextDebugOption sharedDebugOption];\n    [YYTextDebugOption addDebugTarget:self];\n    \n    [self _updateInnerContainerSize];\n    [self _update];\n    \n    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_pasteboardChanged) name:UIPasteboardChangedNotification object:nil];\n    [[YYTextKeyboardManager defaultManager] addObserver:self];\n    \n    self.isAccessibilityElement = YES;\n}\n\n#pragma mark - Public\n\n- (instancetype)initWithFrame:(CGRect)frame {\n    self = [super initWithFrame:frame];\n    if (!self) return nil;\n    [self _initTextView];\n    return self;\n}\n\n- (void)dealloc {\n    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIPasteboardChangedNotification object:nil];\n    [[YYTextKeyboardManager defaultManager] removeObserver:self];\n    \n    [[YYTextEffectWindow sharedWindow] hideSelectionDot:_selectionView];\n    [[YYTextEffectWindow sharedWindow] hideMagnifier:_magnifierCaret];\n    [[YYTextEffectWindow sharedWindow] hideMagnifier:_magnifierRanged];\n    \n    [YYTextDebugOption removeDebugTarget:self];\n    \n    [_longPressTimer invalidate];\n    [_autoScrollTimer invalidate];\n    [_selectionDotFixTimer invalidate];\n}\n\n- (void)scrollRangeToVisible:(NSRange)range {\n    YYTextRange *textRange = [YYTextRange rangeWithRange:range];\n    textRange = [self _correctedTextRange:textRange];\n    [self _scrollRangeToVisible:textRange];\n}\n\n#pragma mark - Property\n\n- (void)setText:(NSString *)text {\n    if (_text == text || [_text isEqualToString:text]) return;\n    [self _setText:text];\n    \n    _state.selectedWithoutEdit = NO;\n    _state.deleteConfirm = NO;\n    [self _endTouchTracking];\n    [self _hideMenu];\n    [self _resetUndoAndRedoStack];\n    [self replaceRange:[YYTextRange rangeWithRange:NSMakeRange(0, _innerText.length)] withText:text];\n}\n\n- (void)setFont:(UIFont *)font {\n    if (_font == font || [_font isEqual:font]) return;\n    [self _setFont:font];\n    \n    _state.typingAttributesOnce = NO;\n    _typingAttributesHolder.yy_font = font;\n    _innerText.yy_font = font;\n    [self _resetUndoAndRedoStack];\n    [self _commitUpdate];\n}\n\n- (void)setTextColor:(UIColor *)textColor {\n    if (_textColor == textColor || [_textColor isEqual:textColor]) return;\n    [self _setTextColor:textColor];\n    \n    _state.typingAttributesOnce = NO;\n    _typingAttributesHolder.yy_color = textColor;\n    _innerText.yy_color = textColor;\n    [self _resetUndoAndRedoStack];\n    [self _commitUpdate];\n}\n\n- (void)setTextAlignment:(NSTextAlignment)textAlignment {\n    if (_textAlignment == textAlignment) return;\n    [self _setTextAlignment:textAlignment];\n    \n    _typingAttributesHolder.yy_alignment = textAlignment;\n    _innerText.yy_alignment = textAlignment;\n    [self _resetUndoAndRedoStack];\n    [self _commitUpdate];\n}\n\n- (void)setDataDetectorTypes:(UIDataDetectorTypes)dataDetectorTypes {\n    if (_dataDetectorTypes == dataDetectorTypes) return;\n    [self _setDataDetectorTypes:dataDetectorTypes];\n    NSTextCheckingType type = YYTextNSTextCheckingTypeFromUIDataDetectorType(dataDetectorTypes);\n    _dataDetector = type ? [NSDataDetector dataDetectorWithTypes:type error:NULL] : nil;\n    [self _resetUndoAndRedoStack];\n    [self _commitUpdate];\n}\n\n- (void)setLinkTextAttributes:(NSDictionary *)linkTextAttributes {\n    if (_linkTextAttributes == linkTextAttributes || [_linkTextAttributes isEqual:linkTextAttributes]) return;\n    [self _setLinkTextAttributes:linkTextAttributes];\n    if (_dataDetector) {\n        [self _commitUpdate];\n    }\n}\n\n- (void)setHighlightTextAttributes:(NSDictionary *)highlightTextAttributes {\n    if (_highlightTextAttributes == highlightTextAttributes || [_highlightTextAttributes isEqual:highlightTextAttributes]) return;\n    [self _setHighlightTextAttributes:highlightTextAttributes];\n    if (_dataDetector) {\n        [self _commitUpdate];\n    }\n}\n\n- (void)setTextParser:(id<YYTextParser>)textParser {\n    if (_textParser == textParser || [_textParser isEqual:textParser]) return;\n    [self _setTextParser:textParser];\n    if (textParser && _text.length) {\n        [self replaceRange:[YYTextRange rangeWithRange:NSMakeRange(0, _text.length)] withText:_text];\n    }\n    [self _resetUndoAndRedoStack];\n    [self _commitUpdate];\n}\n\n- (void)setTypingAttributes:(NSDictionary *)typingAttributes {\n    [self _setTypingAttributes:typingAttributes];\n    _state.typingAttributesOnce = YES;\n    [typingAttributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {\n        [_typingAttributesHolder yy_setAttribute:key value:obj];\n    }];\n    [self _commitUpdate];\n}\n\n- (void)setAttributedText:(NSAttributedString *)attributedText {\n    if (_attributedText == attributedText) return;\n    [self _setAttributedText:attributedText];\n    _state.typingAttributesOnce = NO;\n    \n    NSMutableAttributedString *text = attributedText.mutableCopy;\n    if (text.length == 0) {\n        [self replaceRange:[YYTextRange rangeWithRange:NSMakeRange(0, _innerText.length)] withText:@\"\"];\n        return;\n    }\n    if ([self.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:)]) {\n        BOOL should = [self.delegate textView:self shouldChangeTextInRange:NSMakeRange(0, _innerText.length) replacementText:text.string];\n        if (!should) return;\n    }\n    \n    _state.selectedWithoutEdit = NO;\n    _state.deleteConfirm = NO;\n    [self _endTouchTracking];\n    [self _hideMenu];\n    \n    [_inputDelegate selectionWillChange:self];\n    [_inputDelegate textWillChange:self];\n     _innerText = text;\n    [self _parseText];\n    _selectedTextRange = [YYTextRange rangeWithRange:NSMakeRange(0, _innerText.length)];\n    [_inputDelegate textDidChange:self];\n    [_inputDelegate selectionDidChange:self];\n    \n    [self _setAttributedText:text];\n    if (_innerText.length > 0) {\n        _typingAttributesHolder.yy_attributes = [_innerText yy_attributesAtIndex:_innerText.length - 1];\n    }\n    \n    [self _updateOuterProperties];\n    [self _updateLayout];\n    [self _updateSelectionView];\n    \n    if (self.isFirstResponder) {\n        [self _scrollRangeToVisible:_selectedTextRange];\n    }\n    \n    if ([self.delegate respondsToSelector:@selector(textViewDidChange:)]) {\n        [self.delegate textViewDidChange:self];\n    }\n    [[NSNotificationCenter defaultCenter] postNotificationName:YYTextViewTextDidChangeNotification object:self];\n    \n    if (!_state.insideUndoBlock) {\n        [self _resetUndoAndRedoStack];\n    }\n}\n\n- (void)setTextVerticalAlignment:(YYTextVerticalAlignment)textVerticalAlignment {\n    if (_textVerticalAlignment == textVerticalAlignment) return;\n    [self willChangeValueForKey:@\"textVerticalAlignment\"];\n    _textVerticalAlignment = textVerticalAlignment;\n    [self didChangeValueForKey:@\"textVerticalAlignment\"];\n    _containerView.textVerticalAlignment = textVerticalAlignment;\n    [self _commitUpdate];\n}\n\n- (void)setTextContainerInset:(UIEdgeInsets)textContainerInset {\n    if (UIEdgeInsetsEqualToEdgeInsets(_textContainerInset, textContainerInset)) return;\n    [self _setTextContainerInset:textContainerInset];\n    _innerContainer.insets = textContainerInset;\n    [self _commitUpdate];\n}\n\n- (void)setExclusionPaths:(NSArray *)exclusionPaths {\n    if (_exclusionPaths == exclusionPaths || [_exclusionPaths isEqual:exclusionPaths]) return;\n    [self _setExclusionPaths:exclusionPaths];\n    _innerContainer.exclusionPaths = exclusionPaths;\n    if (_innerContainer.isVerticalForm) {\n        CGAffineTransform trans = CGAffineTransformMakeTranslation(_innerContainer.size.width - self.bounds.size.width, 0);\n        [_innerContainer.exclusionPaths enumerateObjectsUsingBlock:^(UIBezierPath *path, NSUInteger idx, BOOL *stop) {\n            [path applyTransform:trans];\n        }];\n    }\n    [self _commitUpdate];\n}\n\n- (void)setVerticalForm:(BOOL)verticalForm {\n    if (_verticalForm == verticalForm) return;\n    [self _setVerticalForm:verticalForm];\n    _innerContainer.verticalForm = verticalForm;\n    _selectionView.verticalForm = verticalForm;\n    \n    [self _updateInnerContainerSize];\n    \n    if (verticalForm) {\n        if (UIEdgeInsetsEqualToEdgeInsets(_innerContainer.insets, kDefaultInset)) {\n            _innerContainer.insets = kDefaultVerticalInset;\n            [self _setTextContainerInset:kDefaultVerticalInset];\n        }\n    } else {\n        if (UIEdgeInsetsEqualToEdgeInsets(_innerContainer.insets, kDefaultVerticalInset)) {\n            _innerContainer.insets = kDefaultInset;\n            [self _setTextContainerInset:kDefaultInset];\n        }\n    }\n    \n    _innerContainer.exclusionPaths = _exclusionPaths;\n    if (verticalForm) {\n        CGAffineTransform trans = CGAffineTransformMakeTranslation(_innerContainer.size.width - self.bounds.size.width, 0);\n        [_innerContainer.exclusionPaths enumerateObjectsUsingBlock:^(UIBezierPath *path, NSUInteger idx, BOOL *stop) {\n            [path applyTransform:trans];\n        }];\n    }\n    \n    [self _keyboardChanged];\n    [self _commitUpdate];\n}\n\n- (void)setLinePositionModifier:(id<YYTextLinePositionModifier>)linePositionModifier {\n    if (_linePositionModifier == linePositionModifier) return;\n    [self _setLinePositionModifier:linePositionModifier];\n    _innerContainer.linePositionModifier = linePositionModifier;\n    [self _commitUpdate];\n}\n\n- (void)setSelectedRange:(NSRange)selectedRange {\n    if (NSEqualRanges(_selectedRange, selectedRange)) return;\n    if (_markedTextRange) return;\n    _state.typingAttributesOnce = NO;\n    \n    YYTextRange *range = [YYTextRange rangeWithRange:selectedRange];\n    range = [self _correctedTextRange:range];\n    [self _endTouchTracking];\n    _selectedTextRange = range;\n    [self _updateSelectionView];\n    \n    [self _setSelectedRange:range.asRange];\n    \n    if (!_state.insideUndoBlock) {\n        [self _resetUndoAndRedoStack];\n    }\n}\n\n- (void)setHighlightable:(BOOL)highlightable {\n    if (_highlightable == highlightable) return;\n    [self willChangeValueForKey:@\"highlightable\"];\n    _highlightable = highlightable;\n    [self didChangeValueForKey:@\"highlightable\"];\n    [self _commitUpdate];\n}\n\n- (void)setEditable:(BOOL)editable {\n    if (_editable == editable) return;\n    [self willChangeValueForKey:@\"editable\"];\n    _editable = editable;\n    [self didChangeValueForKey:@\"editable\"];\n    if (!editable) {\n        [self resignFirstResponder];\n    }\n}\n\n- (void)setSelectable:(BOOL)selectable {\n    if (_selectable == selectable) return;\n    [self willChangeValueForKey:@\"selectable\"];\n    _selectable = selectable;\n    [self didChangeValueForKey:@\"selectable\"];\n    if (!selectable) {\n        if (self.isFirstResponder) {\n            [self resignFirstResponder];\n        } else {\n            _state.selectedWithoutEdit = NO;\n            [self _endTouchTracking];\n            [self _hideMenu];\n            [self _updateSelectionView];\n        }\n    }\n}\n\n- (void)setClearsOnInsertion:(BOOL)clearsOnInsertion {\n    if (_clearsOnInsertion == clearsOnInsertion) return;\n    _clearsOnInsertion = clearsOnInsertion;\n    if (clearsOnInsertion) {\n        if (self.isFirstResponder) {\n            self.selectedRange = NSMakeRange(0, _attributedText.length);\n        } else {\n            _state.clearsOnInsertionOnce = YES;\n        }\n    }\n}\n\n- (void)setDebugOption:(YYTextDebugOption *)debugOption {\n    _containerView.debugOption = debugOption;\n}\n\n- (YYTextDebugOption *)debugOption {\n    return _containerView.debugOption;\n}\n\n- (YYTextLayout *)textLayout {\n    [self _updateIfNeeded];\n    return _innerLayout;\n}\n\n- (void)setPlaceholderText:(NSString *)placeholderText {\n    if (_placeholderAttributedText.length > 0) {\n        if (placeholderText.length > 0) {\n            [((NSMutableAttributedString *)_placeholderAttributedText) replaceCharactersInRange:NSMakeRange(0, _placeholderAttributedText.length) withString:placeholderText];\n        } else {\n            [((NSMutableAttributedString *)_placeholderAttributedText) replaceCharactersInRange:NSMakeRange(0, _placeholderAttributedText.length) withString:@\"\"];\n        }\n        ((NSMutableAttributedString *)_placeholderAttributedText).yy_font = _placeholderFont;\n        ((NSMutableAttributedString *)_placeholderAttributedText).yy_color = _placeholderTextColor;\n    } else {\n        if (placeholderText.length > 0) {\n            NSMutableAttributedString *atr = [[NSMutableAttributedString alloc] initWithString:placeholderText];\n            if (!_placeholderFont) _placeholderFont = _font;\n            if (!_placeholderFont) _placeholderFont = [self _defaultFont];\n            if (!_placeholderTextColor) _placeholderTextColor = [self _defaultPlaceholderColor];\n            atr.yy_font = _placeholderFont;\n            atr.yy_color = _placeholderTextColor;\n            _placeholderAttributedText = atr;\n        }\n    }\n    _placeholderText = [_placeholderAttributedText yy_plainTextForRange:NSMakeRange(0, _placeholderAttributedText.length)];\n    [self _commitPlaceholderUpdate];\n}\n\n- (void)setPlaceholderFont:(UIFont *)placeholderFont {\n    _placeholderFont = placeholderFont;\n    ((NSMutableAttributedString *)_placeholderAttributedText).yy_font = _placeholderFont;\n    [self _commitPlaceholderUpdate];\n}\n\n- (void)setPlaceholderTextColor:(UIColor *)placeholderTextColor {\n    _placeholderTextColor = placeholderTextColor;\n    ((NSMutableAttributedString *)_placeholderAttributedText).yy_color = _placeholderTextColor;\n    [self _commitPlaceholderUpdate];\n}\n\n- (void)setPlaceholderAttributedText:(NSAttributedString *)placeholderAttributedText {\n    _placeholderAttributedText = placeholderAttributedText.mutableCopy;\n    _placeholderText = [_placeholderAttributedText yy_plainTextForRange:NSMakeRange(0, _placeholderAttributedText.length)];\n    _placeholderFont = _placeholderAttributedText.yy_font;\n    _placeholderTextColor = _placeholderAttributedText.yy_color;\n    [self _commitPlaceholderUpdate];\n}\n\n#pragma mark - Override For Protect\n\n- (void)setMultipleTouchEnabled:(BOOL)multipleTouchEnabled {\n    [super setMultipleTouchEnabled:NO]; // must not enabled\n}\n\n- (void)setContentInset:(UIEdgeInsets)contentInset {\n    UIEdgeInsets oldInsets = self.contentInset;\n    if (_insetModifiedByKeyboard) {\n        _originalContentInset = contentInset;\n    } else {\n        [super setContentInset:contentInset];\n        BOOL changed = !UIEdgeInsetsEqualToEdgeInsets(oldInsets, contentInset);\n        if (changed) {\n            [self _updateInnerContainerSize];\n            [self _commitUpdate];\n            [self _commitPlaceholderUpdate];\n        }\n    }\n}\n\n- (void)setScrollIndicatorInsets:(UIEdgeInsets)scrollIndicatorInsets {\n    if (_insetModifiedByKeyboard) {\n        _originalScrollIndicatorInsets = scrollIndicatorInsets;\n    } else {\n        [super setScrollIndicatorInsets:scrollIndicatorInsets];\n    }\n}\n\n- (void)setFrame:(CGRect)frame {\n    CGSize oldSize = self.bounds.size;\n    [super setFrame:frame];\n    CGSize newSize = self.bounds.size;\n    BOOL changed = _innerContainer.isVerticalForm ? (oldSize.height != newSize.height) : (oldSize.width != newSize.width);\n    if (changed) {\n        [self _updateInnerContainerSize];\n        [self _commitUpdate];\n    }\n    if (!CGSizeEqualToSize(oldSize, newSize)) {\n        [self _commitPlaceholderUpdate];\n    }\n}\n\n- (void)setBounds:(CGRect)bounds {\n    CGSize oldSize = self.bounds.size;\n    [super setBounds:bounds];\n    CGSize newSize = self.bounds.size;\n    BOOL changed = _innerContainer.isVerticalForm ? (oldSize.height != newSize.height) : (oldSize.width != newSize.width);\n    if (changed) {\n        [self _updateInnerContainerSize];\n        [self _commitUpdate];\n    }\n    if (!CGSizeEqualToSize(oldSize, newSize)) {\n        [self _commitPlaceholderUpdate];\n    }\n}\n\n- (void)tintColorDidChange {\n    if ([self respondsToSelector:@selector(tintColor)]) {\n        UIColor *color = self.tintColor;\n        NSMutableDictionary *attrs = _highlightTextAttributes.mutableCopy;\n        NSMutableDictionary *linkAttrs = _linkTextAttributes.mutableCopy;\n        if (!linkAttrs) linkAttrs = @{}.mutableCopy;\n        if (!color) {\n            [attrs removeObjectForKey:NSForegroundColorAttributeName];\n            [attrs removeObjectForKey:(id)kCTForegroundColorAttributeName];\n            [linkAttrs setObject:[self _defaultTintColor] forKey:NSForegroundColorAttributeName];\n            [linkAttrs setObject:(id)[self _defaultTintColor].CGColor forKey:(id)kCTForegroundColorAttributeName];\n        } else {\n            [attrs setObject:color forKey:NSForegroundColorAttributeName];\n            [attrs setObject:(id)color.CGColor forKey:(id)kCTForegroundColorAttributeName];\n            [linkAttrs setObject:color forKey:NSForegroundColorAttributeName];\n            [linkAttrs setObject:(id)color.CGColor forKey:(id)kCTForegroundColorAttributeName];\n        }\n        self.highlightTextAttributes = attrs;\n        _selectionView.color = color ? color : [self _defaultTintColor];\n        _linkTextAttributes = linkAttrs;\n        [self _commitUpdate];\n    }\n}\n\n- (CGSize)sizeThatFits:(CGSize)size {\n    if (!_verticalForm && size.width <= 0) size.width = YYTextContainerMaxSize.width;\n    if (_verticalForm && size.height <= 0) size.height = YYTextContainerMaxSize.height;\n    \n    if ((!_verticalForm && size.width == self.bounds.size.width) ||\n        (_verticalForm && size.height == self.bounds.size.height)) {\n        [self _updateIfNeeded];\n        if (!_verticalForm) {\n            if (_containerView.bounds.size.height <= size.height) {\n                return _containerView.bounds.size;\n            }\n        } else {\n            if (_containerView.bounds.size.width <= size.width) {\n                return _containerView.bounds.size;\n            }\n        }\n    }\n    \n    if (!_verticalForm) {\n        size.height = YYTextContainerMaxSize.height;\n    } else {\n        size.width = YYTextContainerMaxSize.width;\n    }\n    \n    YYTextContainer *container = [_innerContainer copy];\n    container.size = size;\n    \n    YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:_innerText];\n    return layout.textBoundingSize;\n}\n\n#pragma mark - Override UIResponder\n\n- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {\n    [self _updateIfNeeded];\n    UITouch *touch = touches.anyObject;\n    CGPoint point = [touch locationInView:_containerView];\n    \n    _touchBeganTime = _trackingTime = touch.timestamp;\n    _touchBeganPoint = _trackingPoint = point;\n    _trackingRange = _selectedTextRange;\n    \n    _state.trackingGrabber = NO;\n    _state.trackingCaret = NO;\n    _state.trackingPreSelect = NO;\n    _state.trackingTouch = YES;\n    _state.swallowTouch = YES;\n    _state.touchMoved = NO;\n    \n    if (!self.isFirstResponder && !_state.selectedWithoutEdit && self.highlightable) {\n        _highlight = [self _getHighlightAtPoint:point range:&_highlightRange];\n        _highlightLayout = nil;\n    }\n    \n    if ((!self.selectable && !_highlight) || _state.ignoreTouchBegan) {\n        _state.swallowTouch = NO;\n        _state.trackingTouch = NO;\n    }\n    \n    if (_state.trackingTouch) {\n        [self _startLongPressTimer];\n        if (_highlight) {\n            [self _showHighlightAnimated:NO];\n        } else {\n            if ([_selectionView isGrabberContainsPoint:point]) { // track grabber\n                self.panGestureRecognizer.enabled = NO; // disable scroll view\n                [self _hideMenu];\n                _state.trackingGrabber = [_selectionView isStartGrabberContainsPoint:point] ? kStart : kEnd;\n                _magnifierRangedOffset = [self _getMagnifierRangedOffset];\n            } else {\n                if (_selectedTextRange.asRange.length == 0 && self.isFirstResponder) {\n                    if ([_selectionView isCaretContainsPoint:point]) { // track caret\n                        _state.trackingCaret = YES;\n                        self.panGestureRecognizer.enabled = NO; // disable scroll view\n                    }\n                }\n            }\n        }\n        [self _updateSelectionView];\n    }\n    \n    if (!_state.swallowTouch) [super touchesBegan:touches withEvent:event];\n}\n\n- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {\n    [self _updateIfNeeded];\n    UITouch *touch = touches.anyObject;\n    CGPoint point = [touch locationInView:_containerView];\n    \n    _trackingTime = touch.timestamp;\n    _trackingPoint = point;\n    \n    if (!_state.touchMoved) {\n        _state.touchMoved = [self _getMoveDirection];\n        if (_state.touchMoved) [self _endLongPressTimer];\n    }\n    _state.clearsOnInsertionOnce = NO;\n    \n    if (_state.trackingTouch) {\n        BOOL showMagnifierCaret = NO;\n        BOOL showMagnifierRanged = NO;\n        \n        if (_highlight) {\n            \n            YYTextHighlight *highlight = [self _getHighlightAtPoint:_trackingPoint range:NULL];\n            if (highlight == _highlight) {\n                [self _showHighlightAnimated:YES];\n            } else {\n                [self _hideHighlightAnimated:YES];\n            }\n            \n        } else {\n            _trackingRange = _selectedTextRange;\n            if (_state.trackingGrabber) {\n                self.panGestureRecognizer.enabled = NO;\n                [self _hideMenu];\n                [self _updateTextRangeByTrackingGrabber];\n                showMagnifierRanged = YES;\n            } else if (_state.trackingPreSelect) {\n                [self _updateTextRangeByTrackingPreSelect];\n                showMagnifierCaret = YES;\n            } else if (_state.trackingCaret || _markedTextRange || self.isFirstResponder) {\n                if (_state.trackingCaret || _state.touchMoved) {\n                    _state.trackingCaret = YES;\n                    [self _hideMenu];\n                    if (_verticalForm) {\n                        if (_state.touchMoved == kTop || _state.touchMoved == kBottom) {\n                            self.panGestureRecognizer.enabled = NO;\n                        }\n                    } else {\n                        if (_state.touchMoved == kLeft || _state.touchMoved == kRight) {\n                            self.panGestureRecognizer.enabled = NO;\n                        }\n                    }\n                    [self _updateTextRangeByTrackingCaret];\n                    if (_markedTextRange) {\n                        showMagnifierRanged = YES;\n                    } else {\n                        showMagnifierCaret = YES;\n                    }\n                }\n            }\n        }\n        [self _updateSelectionView];\n        if (showMagnifierCaret) [self _showMagnifierCaret];\n        if (showMagnifierRanged) [self _showMagnifierRanged];\n    }\n    \n    CGFloat autoScrollOffset = [self _getAutoscrollOffset];\n    if (_autoScrollOffset != autoScrollOffset) {\n        if (fabs(autoScrollOffset) < fabs(_autoScrollOffset)) {\n            _autoScrollAcceleration *= 0.5;\n        }\n        _autoScrollOffset = autoScrollOffset;\n        if (_autoScrollOffset != 0 && _state.touchMoved) {\n            [self _startAutoScrollTimer];\n        }\n    }\n    \n    if (!_state.swallowTouch) [super touchesMoved:touches withEvent:event];\n}\n\n- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {\n    [self _updateIfNeeded];\n    \n    UITouch *touch = touches.anyObject;\n    CGPoint point = [touch locationInView:_containerView];\n    \n    _trackingTime = touch.timestamp;\n    _trackingPoint = point;\n    \n    if (!_state.touchMoved) {\n        _state.touchMoved = [self _getMoveDirection];\n    }\n    if (_state.trackingTouch) {\n        [self _hideMagnifier];\n        \n        if (_highlight) {\n            if (_state.showingHighlight) {\n                if (_highlight.tapAction) {\n                    CGRect rect = [_innerLayout rectForRange:[YYTextRange rangeWithRange:_highlightRange]];\n                    rect = [self _convertRectFromLayout:rect];\n                    _highlight.tapAction(self, _innerText, _highlightRange, rect);\n                } else {\n                    BOOL shouldTap = YES;\n                    if ([self.delegate respondsToSelector:@selector(textView:shouldTapHighlight:inRange:)]) {\n                        shouldTap = [self.delegate textView:self shouldTapHighlight:_highlight inRange:_highlightRange];\n                    }\n                    if (shouldTap && [self.delegate respondsToSelector:@selector(textView:didTapHighlight:inRange:rect:)]) {\n                        CGRect rect = [_innerLayout rectForRange:[YYTextRange rangeWithRange:_highlightRange]];\n                        rect = [self _convertRectFromLayout:rect];\n                        [self.delegate textView:self didTapHighlight:_highlight inRange:_highlightRange rect:rect];\n                    }\n                }\n                [self _removeHighlightAnimated:YES];\n            }\n        } else {\n            if (_state.trackingCaret) {\n                if (_state.touchMoved) {\n                    [self _updateTextRangeByTrackingCaret];\n                    [self _showMenu];\n                } else {\n                    if (_state.showingMenu) [self _hideMenu];\n                    else [self _showMenu];\n                }\n            } else if (_state.trackingGrabber) {\n                [self _updateTextRangeByTrackingGrabber];\n                [self _showMenu];\n            } else if (_state.trackingPreSelect) {\n                [self _updateTextRangeByTrackingPreSelect];\n                if (_trackingRange.asRange.length > 0) {\n                    _state.selectedWithoutEdit = YES;\n                    [self _showMenu];\n                } else {\n                    [self performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0];\n                }\n            } else if (_state.deleteConfirm || _markedTextRange) {\n                [self _updateTextRangeByTrackingCaret];\n                [self _hideMenu];\n            } else {\n                if (!_state.touchMoved) {\n                    if (_state.selectedWithoutEdit) {\n                        _state.selectedWithoutEdit = NO;\n                        [self _hideMenu];\n                    } else {\n                        if (self.isFirstResponder) {\n                            YYTextRange *_oldRange = _trackingRange;\n                            [self _updateTextRangeByTrackingCaret];\n                            if ([_oldRange isEqual:_trackingRange]) {\n                                if (_state.showingMenu) [self _hideMenu];\n                                else [self _showMenu];\n                            } else {\n                                [self _hideMenu];\n                            }\n                        } else {\n                            [self _hideMenu];\n                            if (_state.clearsOnInsertionOnce) {\n                                _state.clearsOnInsertionOnce = NO;\n                                _selectedTextRange = [YYTextRange rangeWithRange:NSMakeRange(0, _innerText.length)];\n                                [self _setSelectedRange:_selectedTextRange.asRange];\n                            } else {\n                                [self _updateTextRangeByTrackingCaret];\n                            }\n                            [self performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0];\n                        }\n                    }\n                }\n            }\n        }\n        \n        if (_trackingRange && (![_trackingRange isEqual:_selectedTextRange] || _state.trackingPreSelect)) {\n            if (![_trackingRange isEqual:_selectedTextRange]) {\n                [_inputDelegate selectionWillChange:self];\n                _selectedTextRange = _trackingRange;\n                [_inputDelegate selectionDidChange:self];\n                [self _updateAttributesHolder];\n                [self _updateOuterProperties];\n            }\n            if (!_state.trackingGrabber && !_state.trackingPreSelect) {\n                [self _scrollRangeToVisible:_selectedTextRange];\n            }\n        }\n        \n        [self _endTouchTracking];\n    }\n    \n    if (!_state.swallowTouch) [super touchesEnded:touches withEvent:event];\n}\n\n- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {\n    [self _endTouchTracking];\n    [self _hideMenu];\n\n    if (!_state.swallowTouch) [super touchesCancelled:touches withEvent:event];\n}\n\n- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {\n    if (motion == UIEventSubtypeMotionShake && _allowsUndoAndRedo) {\n        if (!YYTextIsAppExtension()) {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wundeclared-selector\"\n            [self performSelector:@selector(_showUndoRedoAlert)];\n#pragma clang diagnostic pop\n        }\n    } else {\n        [super motionEnded:motion withEvent:event];\n    }\n}\n\n- (BOOL)canBecomeFirstResponder {\n    if (!self.isSelectable) return NO;\n    if (!self.isEditable) return NO;\n    if (_state.ignoreFirstResponder) return NO;\n    if ([self.delegate respondsToSelector:@selector(textViewShouldBeginEditing:)]) {\n        if (![self.delegate textViewShouldBeginEditing:self]) return NO;\n    }\n    return YES;\n}\n\n- (BOOL)becomeFirstResponder {\n    BOOL isFirstResponder = self.isFirstResponder;\n    if (isFirstResponder) return YES;\n    BOOL shouldDetectData = [self _shouldDetectText];\n    BOOL become = [super becomeFirstResponder];\n    if (!isFirstResponder && become) {\n        [self _endTouchTracking];\n        [self _hideMenu];\n        \n        _state.selectedWithoutEdit = NO;\n        if (shouldDetectData != [self _shouldDetectText]) {\n            [self _update];\n        }\n        [self _updateIfNeeded];\n        [self _updateSelectionView];\n        [self performSelector:@selector(_scrollSelectedRangeToVisible) withObject:nil afterDelay:0];\n        if ([self.delegate respondsToSelector:@selector(textViewDidBeginEditing:)]) {\n            [self.delegate textViewDidBeginEditing:self];\n        }\n        [[NSNotificationCenter defaultCenter] postNotificationName:YYTextViewTextDidBeginEditingNotification object:self];\n    }\n    return become;\n}\n\n- (BOOL)canResignFirstResponder {\n    if (!self.isFirstResponder) return YES;\n    if ([self.delegate respondsToSelector:@selector(textViewShouldEndEditing:)]) {\n        if (![self.delegate textViewShouldEndEditing:self]) return NO;\n    }\n    return YES;\n}\n\n- (BOOL)resignFirstResponder {\n    BOOL isFirstResponder = self.isFirstResponder;\n    if (!isFirstResponder) return YES;\n    BOOL resign = [super resignFirstResponder];\n    if (resign) {\n        if (_markedTextRange) {\n            _markedTextRange = nil;\n            [self _parseText];\n            [self _setText:[_innerText yy_plainTextForRange:NSMakeRange(0, _innerText.length)]];\n        }\n        _state.selectedWithoutEdit = NO;\n        if ([self _shouldDetectText]) {\n            [self _update];\n        }\n        [self _endTouchTracking];\n        [self _hideMenu];\n        [self _updateIfNeeded];\n        [self _updateSelectionView];\n        [self _restoreInsetsAnimated:YES];\n        if ([self.delegate respondsToSelector:@selector(textViewDidEndEditing:)]) {\n            [self.delegate textViewDidEndEditing:self];\n        }\n        [[NSNotificationCenter defaultCenter] postNotificationName:YYTextViewTextDidEndEditingNotification object:self];\n    }\n    return resign;\n}\n\n- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {\n    /*\n     ------------------------------------------------------\n     Default menu actions list:\n     cut:                                   Cut\n     copy:                                  Copy\n     select:                                Select\n     selectAll:                             Select All\n     paste:                                 Paste\n     delete:                                Delete\n     _promptForReplace:                     Replace...\n     _transliterateChinese:                 简⇄繁\n     _showTextStyleOptions:                 𝐁𝐼𝐔\n     _define:                               Define\n     _addShortcut:                          Add...\n     _accessibilitySpeak:                   Speak\n     _accessibilitySpeakLanguageSelection:  Speak...\n     _accessibilityPauseSpeaking:           Pause Speak\n     makeTextWritingDirectionRightToLeft:   ⇋\n     makeTextWritingDirectionLeftToRight:   ⇌\n     \n     ------------------------------------------------------\n     Default attribute modifier list:\n     toggleBoldface:\n     toggleItalics:\n     toggleUnderline:\n     increaseSize:\n     decreaseSize:\n     */\n    \n    if (_selectedTextRange.asRange.length == 0) {\n        if (action == @selector(select:) ||\n            action == @selector(selectAll:)) {\n            return _innerText.length > 0;\n        }\n        if (action == @selector(paste:)) {\n            return [self _isPasteboardContainsValidValue];\n        }\n    } else {\n        if (action == @selector(cut:)) {\n            return self.isFirstResponder && self.editable;\n        }\n        if (action == @selector(copy:)) {\n            return YES;\n        }\n        if (action == @selector(selectAll:)) {\n            return _selectedTextRange.asRange.length < _innerText.length;\n        }\n        if (action == @selector(paste:)) {\n            return self.isFirstResponder && self.editable && [self _isPasteboardContainsValidValue];\n        }\n        NSString *selString = NSStringFromSelector(action);\n        if ([selString hasSuffix:@\"define:\"] && [selString hasPrefix:@\"_\"]) {\n            return [self _getRootViewController] != nil;\n        }\n    }\n    return NO;\n}\n\n- (void)reloadInputViews {\n    [super reloadInputViews];\n    if (_markedTextRange) {\n        [self unmarkText];\n    }\n}\n\n#pragma mark - Override NSObject(UIResponderStandardEditActions)\n\n- (void)cut:(id)sender {\n    [self _endTouchTracking];\n    if (_selectedTextRange.asRange.length == 0) return;\n    \n    [self _copySelectedTextToPasteboard];\n    [self _saveToUndoStack];\n    [self _resetRedoStack];\n    [self replaceRange:_selectedTextRange withText:@\"\"];\n}\n\n- (void)copy:(id)sender {\n    [self _endTouchTracking];\n    [self _copySelectedTextToPasteboard];\n}\n\n- (void)paste:(id)sender {\n    [self _endTouchTracking];\n    UIPasteboard *p = [UIPasteboard generalPasteboard];\n    NSAttributedString *atr = nil;\n    \n    if (_allowsPasteAttributedString) {\n        atr = p.yy_AttributedString;\n        if (atr.length == 0) atr = nil;\n    }\n    if (!atr && _allowsPasteImage) {\n        UIImage *img = nil;\n        \n        Class cls = NSClassFromString(@\"YYImage\");\n        if (cls) {\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wundeclared-selector\"\n            if (p.yy_GIFData) {\n                img = [(id)cls performSelector:@selector(imageWithData:scale:) withObject:p.yy_GIFData withObject:nil];\n            }\n            if (!img && p.yy_PNGData) {\n                img = [(id)cls performSelector:@selector(imageWithData:scale:) withObject:p.yy_PNGData withObject:nil];\n            }\n            if (!img && p.yy_WEBPData) {\n                img = [(id)cls performSelector:@selector(imageWithData:scale:) withObject:p.yy_WEBPData withObject:nil];\n            }\n#pragma clang diagnostic pop\n        }\n        \n        if (!img) {\n            img = p.image;\n        }\n        if (!img && p.yy_ImageData) {\n            img = [UIImage imageWithData:p.yy_ImageData scale:YYTextScreenScale()];\n        }\n        if (img && img.size.width > 1 && img.size.height > 1) {\n            id content = img;\n            \n            if (cls) {\n                if ([img conformsToProtocol:NSProtocolFromString(@\"YYAnimatedImage\")]) {\n                    NSNumber *frameCount = [img valueForKey:@\"animatedImageFrameCount\"];\n                    if (frameCount.integerValue > 1) {\n                        Class viewCls = NSClassFromString(@\"YYAnimatedImageView\");\n                        UIImageView *imgView = [(id)viewCls new];\n                        imgView.image = img;\n                        imgView.frame = CGRectMake(0, 0, img.size.width, img.size.height);\n                        if (imgView) {\n                            content = imgView;\n                        }\n                    }\n                }\n            }\n            \n            if ([content isKindOfClass:[UIImage class]] && img.images.count > 1) {\n                UIImageView *imgView = [UIImageView new];\n                imgView.image = img;\n                imgView.frame = CGRectMake(0, 0, img.size.width, img.size.height);\n                if (imgView) {\n                    content = imgView;\n                }\n            }\n            \n            NSMutableAttributedString *attText = [NSAttributedString yy_attachmentStringWithContent:content contentMode:UIViewContentModeScaleToFill width:img.size.width ascent:img.size.height descent:0];\n            NSDictionary *attrs = _typingAttributesHolder.yy_attributes;\n            if (attrs) [attText addAttributes:attrs range:NSMakeRange(0, attText.length)];\n            atr = attText;\n        }\n    }\n    \n    if (atr) {\n        NSUInteger endPosition = _selectedTextRange.start.offset + atr.length;\n        NSMutableAttributedString *text = _innerText.mutableCopy;\n        [text replaceCharactersInRange:_selectedTextRange.asRange withAttributedString:atr];\n        self.attributedText = text;\n        YYTextPosition *pos = [self _correctedTextPosition:[YYTextPosition positionWithOffset:endPosition]];\n        YYTextRange *range = [_innerLayout textRangeByExtendingPosition:pos];\n        range = [self _correctedTextRange:range];\n        if (range) {\n            self.selectedRange = NSMakeRange(range.end.offset, 0);\n        }\n    } else {\n        NSString *string = p.string;\n        if (string.length > 0) {\n            [self _saveToUndoStack];\n            [self _resetRedoStack];\n            [self replaceRange:_selectedTextRange withText:string];\n        }\n    }\n}\n\n- (void)select:(id)sender {\n    [self _endTouchTracking];\n    \n    if (_selectedTextRange.asRange.length > 0 || _innerText.length == 0) return;\n    YYTextRange *newRange = [self _getClosestTokenRangeAtPosition:_selectedTextRange.start];\n    if (newRange.asRange.length > 0) {\n        [_inputDelegate selectionWillChange:self];\n        _selectedTextRange = newRange;\n        [_inputDelegate selectionDidChange:self];\n    }\n    \n    [self _updateIfNeeded];\n    [self _updateOuterProperties];\n    [self _updateSelectionView];\n    [self _hideMenu];\n    [self _showMenu];\n}\n\n- (void)selectAll:(id)sender {\n    _trackingRange = nil;\n    [_inputDelegate selectionWillChange:self];\n    _selectedTextRange = [YYTextRange rangeWithRange:NSMakeRange(0, _innerText.length)];\n    [_inputDelegate selectionDidChange:self];\n    \n    [self _updateIfNeeded];\n    [self _updateOuterProperties];\n    [self _updateSelectionView];\n    [self _hideMenu];\n    [self _showMenu];\n}\n\n- (void)_define:(id)sender {\n    [self _hideMenu];\n    \n    NSString *string = [_innerText yy_plainTextForRange:_selectedTextRange.asRange];\n    if (string.length == 0) return;\n    BOOL resign = [self resignFirstResponder];\n    if (!resign) return;\n    \n    UIReferenceLibraryViewController* ref = [[UIReferenceLibraryViewController alloc] initWithTerm:string];\n    ref.view.backgroundColor = [UIColor whiteColor];\n    [[self _getRootViewController] presentViewController:ref animated:YES completion:^{}];\n}\n\n\n#pragma mark - Overrice NSObject(NSKeyValueObservingCustomization)\n\n+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key {\n    static NSSet *keys = nil;\n    static dispatch_once_t onceToken;\n    dispatch_once(&onceToken, ^{\n        keys = [NSSet setWithArray:@[\n            @\"text\",\n            @\"font\",\n            @\"textColor\",\n            @\"textAlignment\",\n            @\"dataDetectorTypes\",\n            @\"linkTextAttributes\",\n            @\"highlightTextAttributes\",\n            @\"textParser\",\n            @\"attributedText\",\n            @\"textVerticalAlignment\",\n            @\"textContainerInset\",\n            @\"exclusionPaths\",\n            @\"verticalForm\",\n            @\"linePositionModifier\",\n            @\"selectedRange\",\n            @\"typingAttributes\"\n        ]];\n    });\n    if ([keys containsObject:key]) {\n        return NO;\n    }\n    return [super automaticallyNotifiesObserversForKey:key];\n}\n\n#pragma mark - @protocol NSCoding\n\n- (instancetype)initWithCoder:(NSCoder *)aDecoder {\n    self = [super initWithCoder:aDecoder];\n    [self _initTextView];\n    self.attributedText = [aDecoder decodeObjectForKey:@\"attributedText\"];\n    self.selectedRange = ((NSValue *)[aDecoder decodeObjectForKey:@\"selectedRange\"]).rangeValue;\n    self.textVerticalAlignment = [aDecoder decodeIntegerForKey:@\"textVerticalAlignment\"];\n    self.dataDetectorTypes = [aDecoder decodeIntegerForKey:@\"dataDetectorTypes\"];\n    self.textContainerInset = ((NSValue *)[aDecoder decodeObjectForKey:@\"textContainerInset\"]).UIEdgeInsetsValue;\n    self.exclusionPaths = [aDecoder decodeObjectForKey:@\"exclusionPaths\"];\n    self.verticalForm = [aDecoder decodeBoolForKey:@\"verticalForm\"];\n    return self;\n}\n\n- (void)encodeWithCoder:(NSCoder *)aCoder {\n    [super encodeWithCoder:aCoder];\n    [aCoder encodeObject:self.attributedText forKey:@\"attributedText\"];\n    [aCoder encodeObject:[NSValue valueWithRange:self.selectedRange] forKey:@\"selectedRange\"];\n    [aCoder encodeInteger:self.textVerticalAlignment forKey:@\"textVerticalAlignment\"];\n    [aCoder encodeInteger:self.dataDetectorTypes forKey:@\"dataDetectorTypes\"];\n    [aCoder encodeUIEdgeInsets:self.textContainerInset forKey:@\"textContainerInset\"];\n    [aCoder encodeObject:self.exclusionPaths forKey:@\"exclusionPaths\"];\n    [aCoder encodeBool:self.verticalForm forKey:@\"verticalForm\"];\n}\n\n#pragma mark - @protocol UIScrollViewDelegate\n\n- (id<YYTextViewDelegate>)delegate {\n    return _outerDelegate;\n}\n\n- (void)setDelegate:(id<YYTextViewDelegate>)delegate {\n    _outerDelegate = delegate;\n}\n\n- (void)scrollViewDidScroll:(UIScrollView *)scrollView {\n    [[YYTextEffectWindow sharedWindow] hideSelectionDot:_selectionView];\n    \n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewDidScroll:scrollView];\n    }\n}\n\n- (void)scrollViewDidZoom:(UIScrollView *)scrollView {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewDidZoom:scrollView];\n    }\n}\n\n- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewWillBeginDragging:scrollView];\n    }\n}\n\n- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewWillEndDragging:scrollView withVelocity:velocity targetContentOffset:targetContentOffset];\n    }\n}\n\n- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {\n    if (!decelerate) {\n        [[YYTextEffectWindow sharedWindow] showSelectionDot:_selectionView];\n    }\n    \n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewDidEndDragging:scrollView willDecelerate:decelerate];\n    }\n}\n\n- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewWillBeginDecelerating:scrollView];\n    }\n}\n\n- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {\n    [[YYTextEffectWindow sharedWindow] showSelectionDot:_selectionView];\n    \n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewDidEndDecelerating:scrollView];\n    }\n}\n\n- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewDidEndScrollingAnimation:scrollView];\n    }\n}\n\n- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        return [_outerDelegate viewForZoomingInScrollView:scrollView];\n    } else {\n        return nil;\n    }\n}\n\n- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view{\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewWillBeginZooming:scrollView withView:view];\n    }\n}\n\n- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewDidEndZooming:scrollView withView:view atScale:scale];\n    }\n}\n\n- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        return [_outerDelegate scrollViewShouldScrollToTop:scrollView];\n    }\n    return YES;\n}\n\n- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView {\n    if ([_outerDelegate respondsToSelector:_cmd]) {\n        [_outerDelegate scrollViewDidScrollToTop:scrollView];\n    }\n}\n\n#pragma mark - @protocol YYTextKeyboardObserver\n\n- (void)keyboardChangedWithTransition:(YYTextKeyboardTransition)transition {\n    [self _keyboardChanged];\n}\n\n#pragma mark - @protocol UIALertViewDelegate\n\n- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {\n    NSString *title = [alertView buttonTitleAtIndex:buttonIndex];\n    if (title.length == 0) return;\n    NSArray *strings = [self _localizedUndoStrings];\n    if ([title isEqualToString:strings[1]] || [title isEqualToString:strings[2]]) {\n        [self _redo];\n    } else if ([title isEqualToString:strings[3]] || [title isEqualToString:strings[4]]) {\n        [self _undo];\n    }\n    [self _restoreFirstResponderAfterUndoAlert];\n}\n\n#pragma mark - @protocol UIKeyInput\n\n- (BOOL)hasText {\n    return _innerText.length > 0;\n}\n\n- (void)insertText:(NSString *)text {\n    if (text.length == 0) return;\n    if (!NSEqualRanges(_lastTypeRange, _selectedTextRange.asRange)) {\n        [self _saveToUndoStack];\n        [self _resetRedoStack];\n    }\n    [self replaceRange:_selectedTextRange withText:text];\n}\n\n- (void)deleteBackward {\n    [self _updateIfNeeded];\n    NSRange range = _selectedTextRange.asRange;\n    if (range.location == 0 && range.length == 0) return;\n    _state.typingAttributesOnce = NO;\n    \n    // test if there's 'TextBinding' before the caret\n    if (!_state.deleteConfirm && range.length == 0 && range.location > 0) {\n        NSRange effectiveRange;\n        YYTextBinding *binding = [_innerText attribute:YYTextBindingAttributeName atIndex:range.location - 1 longestEffectiveRange:&effectiveRange inRange:NSMakeRange(0, _innerText.length)];\n        if (binding && binding.deleteConfirm) {\n            _state.deleteConfirm = YES;\n            [_inputDelegate selectionWillChange:self];\n            _selectedTextRange = [YYTextRange rangeWithRange:effectiveRange];\n            _selectedTextRange = [self _correctedTextRange:_selectedTextRange];\n            [_inputDelegate selectionDidChange:self];\n            \n            [self _updateOuterProperties];\n            [self _updateSelectionView];\n            return;\n        }\n    }\n    \n    _state.deleteConfirm = NO;\n    if (range.length == 0) {\n        YYTextRange *extendRange = [_innerLayout textRangeByExtendingPosition:_selectedTextRange.end inDirection:UITextLayoutDirectionLeft offset:1];\n        if ([self _isTextRangeValid:extendRange]) {\n            range = extendRange.asRange;\n        }\n    }\n    if (!NSEqualRanges(_lastTypeRange, _selectedTextRange.asRange)) {\n        [self _saveToUndoStack];\n        [self _resetRedoStack];\n    }\n    [self replaceRange:[YYTextRange rangeWithRange:range] withText:@\"\"];\n}\n\n#pragma mark - @protocol UITextInput\n\n- (void)setInputDelegate:(id<UITextInputDelegate>)inputDelegate {\n    _inputDelegate = inputDelegate;\n}\n\n- (void)setSelectedTextRange:(YYTextRange *)selectedTextRange {\n    if (!selectedTextRange) return;\n    selectedTextRange = [self _correctedTextRange:selectedTextRange];\n    if ([selectedTextRange isEqual:_selectedTextRange]) return;\n    [self _updateIfNeeded];\n    [self _endTouchTracking];\n    [self _hideMenu];\n    _state.deleteConfirm = NO;\n    _state.typingAttributesOnce = NO;\n    \n    [_inputDelegate selectionWillChange:self];\n    _selectedTextRange = selectedTextRange;\n    _lastTypeRange = _selectedTextRange.asRange;\n    [_inputDelegate selectionDidChange:self];\n    \n    [self _updateOuterProperties];\n    [self _updateSelectionView];\n    \n    if (self.isFirstResponder) {\n        [self _scrollRangeToVisible:_selectedTextRange];\n    }\n}\n\n- (void)setMarkedTextStyle:(NSDictionary *)markedTextStyle {\n    _markedTextStyle = markedTextStyle.copy;\n}\n\n/*\n Replace current markedText with the new markedText\n @param markedText     New marked text.\n @param selectedRange  The range from the '_markedTextRange'\n */\n- (void)setMarkedText:(NSString *)markedText selectedRange:(NSRange)selectedRange {\n    [self _updateIfNeeded];\n    [self _endTouchTracking];\n    [self _hideMenu];\n    \n    if ([self.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:)]) {\n        NSRange range = _markedTextRange ? _markedTextRange.asRange : NSMakeRange(_selectedTextRange.end.offset, 0);\n        BOOL should = [self.delegate textView:self shouldChangeTextInRange:range replacementText:markedText];\n        if (!should) return;\n    }\n    \n    \n    if (!NSEqualRanges(_lastTypeRange, _selectedTextRange.asRange)) {\n        [self _saveToUndoStack];\n        [self _resetRedoStack];\n    }\n    \n    BOOL needApplyHolderAttribute = NO;\n    if (_innerText.length > 0 && _markedTextRange) {\n        [self _updateAttributesHolder];\n    } else {\n        needApplyHolderAttribute = YES;\n    }\n    \n    if (_selectedTextRange.asRange.length > 0) {\n        [self replaceRange:_selectedTextRange withText:@\"\"];\n    }\n    \n    [_inputDelegate textWillChange:self];\n    [_inputDelegate selectionWillChange:self];\n    \n    if (!markedText) markedText = @\"\";\n    if (_markedTextRange == nil) {\n        _markedTextRange = [YYTextRange rangeWithRange:NSMakeRange(_selectedTextRange.end.offset, markedText.length)];\n        [_innerText replaceCharactersInRange:NSMakeRange(_selectedTextRange.end.offset, 0) withString:markedText];\n        _selectedTextRange = [YYTextRange rangeWithRange:NSMakeRange(_selectedTextRange.start.offset + selectedRange.location, selectedRange.length)];\n    } else {\n        _markedTextRange = [self _correctedTextRange:_markedTextRange];\n        [_innerText replaceCharactersInRange:_markedTextRange.asRange withString:markedText];\n        _markedTextRange = [YYTextRange rangeWithRange:NSMakeRange(_markedTextRange.start.offset, markedText.length)];\n        _selectedTextRange = [YYTextRange rangeWithRange:NSMakeRange(_markedTextRange.start.offset + selectedRange.location, selectedRange.length)];\n    }\n    \n    _selectedTextRange = [self _correctedTextRange:_selectedTextRange];\n    _markedTextRange = [self _correctedTextRange:_markedTextRange];\n    if (_markedTextRange.asRange.length == 0) {\n        _markedTextRange = nil;\n    } else {\n        if (needApplyHolderAttribute) {\n            [_innerText setAttributes:_typingAttributesHolder.yy_attributes range:_markedTextRange.asRange];\n        }\n        [_innerText yy_removeDiscontinuousAttributesInRange:_markedTextRange.asRange];\n    }\n    \n    [_inputDelegate selectionDidChange:self];\n    [_inputDelegate textDidChange:self];\n    \n    [self _updateOuterProperties];\n    [self _updateLayout];\n    [self _updateSelectionView];\n    [self _scrollRangeToVisible:_selectedTextRange];\n    \n    if ([self.delegate respondsToSelector:@selector(textViewDidChange:)]) {\n        [self.delegate textViewDidChange:self];\n    }\n    [[NSNotificationCenter defaultCenter] postNotificationName:YYTextViewTextDidChangeNotification object:self];\n    \n    _lastTypeRange = _selectedTextRange.asRange;\n}\n\n- (void)unmarkText {\n    _markedTextRange = nil;\n    [self _endTouchTracking];\n    [self _hideMenu];\n    if ([self _parseText]) _state.needUpdate = YES;\n    \n    [self _updateIfNeeded];\n    [self _updateOuterProperties];\n    [self _updateSelectionView];\n    [self _scrollRangeToVisible:_selectedTextRange];\n}\n\n- (void)replaceRange:(YYTextRange *)range withText:(NSString *)text {\n    if (!range) return;\n    if (!text) text = @\"\";\n    if (range.asRange.length == 0 && text.length == 0) return;\n    range = [self _correctedTextRange:range];\n    \n    if ([self.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:)]) {\n        BOOL should = [self.delegate textView:self shouldChangeTextInRange:range.asRange replacementText:text];\n        if (!should) return;\n    }\n    \n    BOOL useInnerAttributes = NO;\n    if (_innerText.length > 0) {\n        if (range.start.offset == 0 && range.end.offset == _innerText.length) {\n            if (text.length == 0) {\n                NSMutableDictionary *attrs = [_innerText yy_attributesAtIndex:0].mutableCopy;\n                [attrs removeObjectsForKeys:[NSMutableAttributedString yy_allDiscontinuousAttributeKeys]];\n                _typingAttributesHolder.yy_attributes = attrs;\n            }\n        }\n    } else { // no text\n        useInnerAttributes = YES;\n    }\n    BOOL applyTypingAttributes = NO;\n    if (_state.typingAttributesOnce) {\n        _state.typingAttributesOnce = NO;\n        if (!useInnerAttributes) {\n            if (range.asRange.length == 0 && text.length > 0) {\n                applyTypingAttributes = YES;\n            }\n        }\n    }\n    \n    _state.selectedWithoutEdit = NO;\n    _state.deleteConfirm = NO;\n    [self _endTouchTracking];\n    [self _hideMenu];\n    \n    [self _replaceRange:range withText:text notifyToDelegate:YES];\n    if (useInnerAttributes) {\n        [_innerText yy_setAttributes:_typingAttributesHolder.yy_attributes];\n    } else if (applyTypingAttributes) {\n        NSRange newRange = NSMakeRange(range.asRange.location, text.length);\n        [_typingAttributesHolder.yy_attributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {\n            [_innerText yy_setAttribute:key value:obj range:newRange];\n        }];\n    }\n    [self _parseText];\n    [self _updateOuterProperties];\n    [self _update];\n    \n    if (self.isFirstResponder) {\n        [self _scrollRangeToVisible:_selectedTextRange];\n    }\n    \n    if ([self.delegate respondsToSelector:@selector(textViewDidChange:)]) {\n        [self.delegate textViewDidChange:self];\n    }\n    [[NSNotificationCenter defaultCenter] postNotificationName:YYTextViewTextDidChangeNotification object:self];\n    \n    _lastTypeRange = _selectedTextRange.asRange;\n}\n\n- (void)setBaseWritingDirection:(UITextWritingDirection)writingDirection forRange:(YYTextRange *)range {\n    if (!range) return;\n    range = [self _correctedTextRange:range];\n    [_innerText yy_setBaseWritingDirection:(NSWritingDirection)writingDirection range:range.asRange];\n    [self _commitUpdate];\n}\n\n- (NSString *)textInRange:(YYTextRange *)range {\n    range = [self _correctedTextRange:range];\n    if (!range) return @\"\";\n    return [_innerText.string substringWithRange:range.asRange];\n}\n\n- (UITextWritingDirection)baseWritingDirectionForPosition:(YYTextPosition *)position inDirection:(UITextStorageDirection)direction {\n    [self _updateIfNeeded];\n    position = [self _correctedTextPosition:position];\n    if (!position) return UITextWritingDirectionNatural;\n    if (_innerText.length == 0) return UITextWritingDirectionNatural;\n    NSUInteger idx = position.offset;\n    if (idx == _innerText.length) idx--;\n    \n    NSDictionary *attrs = [_innerText yy_attributesAtIndex:idx];\n    CTParagraphStyleRef paraStyle = (__bridge CFTypeRef)(attrs[NSParagraphStyleAttributeName]);\n    if (paraStyle) {\n        CTWritingDirection baseWritingDirection;\n        if (CTParagraphStyleGetValueForSpecifier(paraStyle, kCTParagraphStyleSpecifierBaseWritingDirection, sizeof(CTWritingDirection), &baseWritingDirection)) {\n            return (UITextWritingDirection)baseWritingDirection;\n        }\n    }\n    \n    return UITextWritingDirectionNatural;\n}\n\n- (YYTextPosition *)beginningOfDocument {\n    return [YYTextPosition positionWithOffset:0];\n}\n\n- (YYTextPosition *)endOfDocument {\n    return [YYTextPosition positionWithOffset:_innerText.length];\n}\n\n- (YYTextPosition *)positionFromPosition:(YYTextPosition *)position offset:(NSInteger)offset {\n    if (offset == 0) return position;\n    \n    NSUInteger location = position.offset;\n    NSInteger newLocation = (NSInteger)location + offset;\n    if (newLocation < 0 || newLocation > _innerText.length) return nil;\n    \n    if (newLocation != 0 && newLocation != _innerText.length) {\n        // fix emoji\n        [self _updateIfNeeded];\n        YYTextRange *extendRange = [_innerLayout textRangeByExtendingPosition:[YYTextPosition positionWithOffset:newLocation]];\n        if (extendRange.asRange.length > 0) {\n            if (offset < 0) {\n                newLocation = extendRange.start.offset;\n            } else {\n                newLocation = extendRange.end.offset;\n            }\n        }\n    }\n    \n    YYTextPosition *p = [YYTextPosition positionWithOffset:newLocation];\n    return [self _correctedTextPosition:p];\n}\n\n- (YYTextPosition *)positionFromPosition:(YYTextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset {\n    [self _updateIfNeeded];\n    YYTextRange *range = [_innerLayout textRangeByExtendingPosition:position inDirection:direction offset:offset];\n    \n    BOOL forward;\n    if (_innerContainer.isVerticalForm) {\n        forward = direction == UITextLayoutDirectionLeft || direction == UITextLayoutDirectionDown;\n    } else {\n        forward = direction == UITextLayoutDirectionDown || direction == UITextLayoutDirectionRight;\n    }\n    if (!forward && offset < 0) {\n        forward = -forward;\n    }\n    \n    YYTextPosition *newPosition = forward ? range.end : range.start;\n    if (newPosition.offset > _innerText.length) {\n        newPosition = [YYTextPosition positionWithOffset:_innerText.length affinity:YYTextAffinityBackward];\n    }\n    \n    return [self _correctedTextPosition:newPosition];\n}\n\n- (YYTextRange *)textRangeFromPosition:(YYTextPosition *)fromPosition toPosition:(YYTextPosition *)toPosition {\n    return [YYTextRange rangeWithStart:fromPosition end:toPosition];\n}\n\n- (NSComparisonResult)comparePosition:(YYTextPosition *)position toPosition:(YYTextPosition *)other {\n    return [position compare:other];\n}\n\n- (NSInteger)offsetFromPosition:(YYTextPosition *)from toPosition:(YYTextPosition *)toPosition {\n    return toPosition.offset - from.offset;\n}\n\n- (YYTextPosition *)positionWithinRange:(YYTextRange *)range farthestInDirection:(UITextLayoutDirection)direction {\n    NSRange nsRange = range.asRange;\n    if (direction == UITextLayoutDirectionLeft | direction == UITextLayoutDirectionUp) {\n        return [YYTextPosition positionWithOffset:nsRange.location];\n    } else {\n        return [YYTextPosition positionWithOffset:nsRange.location + nsRange.length affinity:YYTextAffinityBackward];\n    }\n}\n\n- (YYTextRange *)characterRangeByExtendingPosition:(YYTextPosition *)position inDirection:(UITextLayoutDirection)direction {\n    [self _updateIfNeeded];\n    YYTextRange *range = [_innerLayout textRangeByExtendingPosition:position inDirection:direction offset:1];\n    return [self _correctedTextRange:range];\n}\n\n- (YYTextPosition *)closestPositionToPoint:(CGPoint)point {\n    [self _updateIfNeeded];\n    point = [self _convertPointToLayout:point];\n    YYTextPosition *position = [_innerLayout closestPositionToPoint:point];\n    return [self _correctedTextPosition:position];\n}\n\n- (YYTextPosition *)closestPositionToPoint:(CGPoint)point withinRange:(YYTextRange *)range {\n    YYTextPosition *pos = (id)[self closestPositionToPoint:point];\n    if (!pos) return nil;\n    \n    range = [self _correctedTextRange:range];\n    if ([pos compare:range.start] == NSOrderedAscending) {\n        pos = range.start;\n    } else if ([pos compare:range.end] == NSOrderedDescending) {\n        pos = range.end;\n    }\n    return pos;\n}\n\n- (YYTextRange *)characterRangeAtPoint:(CGPoint)point {\n    [self _updateIfNeeded];\n    point = [self _convertPointToLayout:point];\n    YYTextRange *r = [_innerLayout closestTextRangeAtPoint:point];\n    return [self _correctedTextRange:r];\n}\n\n- (CGRect)firstRectForRange:(YYTextRange *)range {\n    [self _updateIfNeeded];\n    CGRect rect = [_innerLayout firstRectForRange:range];\n    if (CGRectIsNull(rect)) rect = CGRectZero;\n    return [self _convertRectFromLayout:rect];\n}\n\n- (CGRect)caretRectForPosition:(YYTextPosition *)position {\n    [self _updateIfNeeded];\n    CGRect caretRect = [_innerLayout caretRectForPosition:position];\n    if (!CGRectIsNull(caretRect)) {\n        caretRect = [self _convertRectFromLayout:caretRect];\n        caretRect = CGRectStandardize(caretRect);\n        if (_verticalForm) {\n            if (caretRect.size.height == 0) {\n                caretRect.size.height = 2;\n                caretRect.origin.y -= 2 * 0.5;\n            }\n            if (caretRect.origin.y < 0) {\n                caretRect.origin.y = 0;\n            } else if (caretRect.origin.y + caretRect.size.height > self.bounds.size.height) {\n                caretRect.origin.y = self.bounds.size.height - caretRect.size.height;\n            }\n        } else {\n            if (caretRect.size.width == 0) {\n                caretRect.size.width = 2;\n                caretRect.origin.x -= 2 * 0.5;\n            }\n            if (caretRect.origin.x < 0) {\n                caretRect.origin.x = 0;\n            } else if (caretRect.origin.x + caretRect.size.width > self.bounds.size.width) {\n                caretRect.origin.x = self.bounds.size.width - caretRect.size.width;\n            }\n        }\n        return YYTextCGRectPixelRound(caretRect);\n    }\n    return CGRectZero;\n}\n\n- (NSArray *)selectionRectsForRange:(YYTextRange *)range {\n    [self _updateIfNeeded];\n    NSArray *rects = [_innerLayout selectionRectsForRange:range];\n    [rects enumerateObjectsUsingBlock:^(YYTextSelectionRect *rect, NSUInteger idx, BOOL *stop) {\n        rect.rect = [self _convertRectFromLayout:rect.rect];\n    }];\n    return rects;\n}\n\n#pragma mark - @protocol UITextInput optional\n\n- (UITextStorageDirection)selectionAffinity {\n    if (_selectedTextRange.end.affinity == YYTextAffinityForward) {\n        return UITextStorageDirectionForward;\n    } else {\n        return UITextStorageDirectionBackward;\n    }\n}\n\n- (void)setSelectionAffinity:(UITextStorageDirection)selectionAffinity {\n    _selectedTextRange = [YYTextRange rangeWithRange:_selectedTextRange.asRange affinity:selectionAffinity == UITextStorageDirectionForward ? YYTextAffinityForward : YYTextAffinityBackward];\n    [self _updateSelectionView];\n}\n\n- (NSDictionary *)textStylingAtPosition:(YYTextPosition *)position inDirection:(UITextStorageDirection)direction {\n    if (!position) return nil;\n    if (_innerText.length == 0) return _typingAttributesHolder.yy_attributes;\n    NSDictionary *attrs = nil;\n    if (0 <= position.offset  && position.offset <= _innerText.length) {\n        NSUInteger ofs = position.offset;\n        if (position.offset == _innerText.length ||\n            direction == UITextStorageDirectionBackward) {\n             ofs--;\n        }\n        attrs = [_innerText attributesAtIndex:ofs effectiveRange:NULL];\n    }\n    return attrs;\n}\n\n- (YYTextPosition *)positionWithinRange:(YYTextRange *)range atCharacterOffset:(NSInteger)offset {\n    if (!range) return nil;\n    if (offset < range.start.offset || offset > range.end.offset) return nil;\n    if (offset == range.start.offset) return range.start;\n    else if (offset == range.end.offset) return range.end;\n    else return [YYTextPosition positionWithOffset:offset];\n}\n\n- (NSInteger)characterOffsetOfPosition:(YYTextPosition *)position withinRange:(YYTextRange *)range {\n    return position ? position.offset : NSNotFound;\n}\n\n@end\n\n\n\n@interface YYTextView(IBInspectableProperties)\n@end\n\n@implementation YYTextView(IBInspectableProperties)\n\n- (BOOL)fontIsBold_:(UIFont *)font {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return NO;\n    return (font.fontDescriptor.symbolicTraits & UIFontDescriptorTraitBold) > 0;\n}\n\n- (UIFont *)boldFont_:(UIFont *)font {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return font;\n    return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold] size:font.pointSize];\n}\n\n- (UIFont *)normalFont_:(UIFont *)font {\n    if (![font respondsToSelector:@selector(fontDescriptor)]) return font;\n    return [UIFont fontWithDescriptor:[font.fontDescriptor fontDescriptorWithSymbolicTraits:0] size:font.pointSize];\n}\n\n- (void)setFontName_:(NSString *)fontName {\n    if (!fontName) return;\n    UIFont *font = self.font;\n    if (!font) font = [self _defaultFont];\n    if ((fontName.length == 0 || [fontName.lowercaseString isEqualToString:@\"system\"]) && ![self fontIsBold_:font]) {\n        font = [UIFont systemFontOfSize:font.pointSize];\n    } else if ([fontName.lowercaseString isEqualToString:@\"system bold\"]) {\n        font = [UIFont boldSystemFontOfSize:font.pointSize];\n    } else {\n        if ([self fontIsBold_:font] && ([fontName.lowercaseString rangeOfString:@\"bold\"].location == NSNotFound)) {\n            font = [UIFont fontWithName:fontName size:font.pointSize];\n            font = [self boldFont_:font];\n        } else {\n            font = [UIFont fontWithName:fontName size:font.pointSize];\n        }\n    }\n    if (font) self.font = font;\n}\n\n- (void)setFontSize_:(CGFloat)fontSize {\n    if (fontSize <= 0) return;\n    UIFont *font = self.font;\n    if (!font) font = [self _defaultFont];\n    if (!font) font = [self _defaultFont];\n    font = [font fontWithSize:fontSize];\n    if (font) self.font = font;\n}\n\n- (void)setFontIsBold_:(BOOL)fontBold {\n    UIFont *font = self.font;\n    if (!font) font = [self _defaultFont];\n    if ([self fontIsBold_:font] == fontBold) return;\n    if (fontBold) {\n        font = [self boldFont_:font];\n    } else {\n        font = [self normalFont_:font];\n    }\n    if (font) self.font = font;\n}\n\n- (void)setPlaceholderFontName_:(NSString *)fontName {\n    if (!fontName) return;\n    UIFont *font = self.placeholderFont;\n    if (!font) font = [self _defaultFont];\n    if ((fontName.length == 0 || [fontName.lowercaseString isEqualToString:@\"system\"]) && ![self fontIsBold_:font]) {\n        font = [UIFont systemFontOfSize:font.pointSize];\n    } else if ([fontName.lowercaseString isEqualToString:@\"system bold\"]) {\n        font = [UIFont boldSystemFontOfSize:font.pointSize];\n    } else {\n        if ([self fontIsBold_:font] && ([fontName.lowercaseString rangeOfString:@\"bold\"].location == NSNotFound)) {\n            font = [UIFont fontWithName:fontName size:font.pointSize];\n            font = [self boldFont_:font];\n        } else {\n            font = [UIFont fontWithName:fontName size:font.pointSize];\n        }\n    }\n    if (font) self.placeholderFont = font;\n}\n\n- (void)setPlaceholderFontSize_:(CGFloat)fontSize {\n    if (fontSize <= 0) return;\n    UIFont *font = self.placeholderFont;\n    if (!font) font = [self _defaultFont];\n    font = [font fontWithSize:fontSize];\n    if (font) self.placeholderFont = font;\n}\n\n- (void)setPlaceholderFontIsBold_:(BOOL)fontBold {\n    UIFont *font = self.placeholderFont;\n    if (!font) font = [self _defaultFont];\n    if ([self fontIsBold_:font] == fontBold) return;\n    if (fontBold) {\n        font = [self boldFont_:font];\n    } else {\n        font = [self normalFont_:font];\n    }\n    if (font) self.placeholderFont = font;\n}\n\n- (void)setInsetTop_:(CGFloat)textInsetTop {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.top = textInsetTop;\n    self.textContainerInset = insets;\n}\n\n- (void)setInsetBottom_:(CGFloat)textInsetBottom {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.bottom = textInsetBottom;\n    self.textContainerInset = insets;\n}\n\n- (void)setInsetLeft_:(CGFloat)textInsetLeft {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.left = textInsetLeft;\n    self.textContainerInset = insets;\n    \n}\n\n- (void)setInsetRight_:(CGFloat)textInsetRight {\n    UIEdgeInsets insets = self.textContainerInset;\n    insets.right = textInsetRight;\n    self.textContainerInset = insets;\n}\n\n- (void)setDebugEnabled_:(BOOL)enabled {\n    if (!enabled) {\n        self.debugOption = nil;\n    } else {\n        YYTextDebugOption *debugOption = [YYTextDebugOption new];\n        debugOption.baselineColor = [UIColor redColor];\n        debugOption.CTFrameBorderColor = [UIColor redColor];\n        debugOption.CTLineFillColor = [UIColor colorWithRed:0.000 green:0.463 blue:1.000 alpha:0.180];\n        debugOption.CGGlyphBorderColor = [UIColor colorWithRed:1.000 green:0.524 blue:0.000 alpha:0.200];\n        self.debugOption = debugOption;\n    }\n}\n\n@end\n"
  },
  {
    "path": "JetChat/Pods/YYText.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 50;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t07A0F7A09509A157004C838AF6D2123D /* YYTextParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 327E6ABBC60E9D776DB6462C1030E02B /* YYTextParser.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t08A253F37EF044645F549ABCC58984D3 /* YYTextArchiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 796546A8B56B82F7D05AA2D2B393C2A0 /* YYTextArchiver.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t08F1F51040FFBC92D3C2ADB5AA4C3BD2 /* YYText-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E04542958FD7C9B7FF5CFEF1F8AB6DC /* YYText-dummy.m */; };\n\t\t0961D20AC156A03A743AA9ACE8BA862B /* YYTextUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 337FECF2A87882CD8C6585E0C6FAA075 /* YYTextUtilities.m */; };\n\t\t0B090EDF6254A18997B7835635366CFA /* NSAttributedString+YYText.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D17B9F0A61C384F453BE66979AC07F9 /* NSAttributedString+YYText.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t0F2BD5A8CD86854D2240ED5773A3CFFE /* YYTextParser.m in Sources */ = {isa = PBXBuildFile; fileRef = A881B46EAC10700DBC48206FA5E98BED /* YYTextParser.m */; };\n\t\t15582D1E53AAFD824381CCC537712B48 /* YYTextEffectWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = E76B23A8484CF2E4A9BB9F42EEDD47E2 /* YYTextEffectWindow.m */; };\n\t\t1636438A74114B75838484D22D73DAA1 /* UIPasteboard+YYText.m in Sources */ = {isa = PBXBuildFile; fileRef = 621E4446161A6F8320C71B5C44F1F8F0 /* UIPasteboard+YYText.m */; };\n\t\t1E00A2014AD5ED4519727E36008B8454 /* YYTextAsyncLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DD2B53F753004E2376975D74D95A0133 /* YYTextAsyncLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t1E96E3A9B36DC28CAC14CCA511F2D745 /* YYTextLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CA9B8D3543FFE1270AD044364155A6D /* YYTextLine.m */; };\n\t\t228E1208734C2446B8C64885A1895A6A /* UIView+YYText.h in Headers */ = {isa = PBXBuildFile; fileRef = 340B803F01390CC099F517470F59BF3C /* UIView+YYText.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2465E6FDA599BABD8B029EFEAFFAD440 /* YYTextContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = F2EAAF8FA3A32FBB19D55FDC009D57A9 /* YYTextContainerView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t28F8B0C5DDF5343B3F29F0880028C310 /* YYTextAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = B7BD0CDEBFD69B5E95C42F70D3293D53 /* YYTextAttribute.m */; };\n\t\t29E5EEC2A75F884A486CC0435D449542 /* YYTextAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 67C5B2BA6D69A2DC27B68CE328A5AD3E /* YYTextAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t2B1A45DB41565D931682C2A600FCB075 /* YYTextRunDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A2339E6F9ED32D4B4E750BE76BACA7AF /* YYTextRunDelegate.m */; };\n\t\t2B62668EB828FDC83925FF8C48D4ABA7 /* YYTextDebugOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BEF0F7A4940B710C27B4489C2905631 /* YYTextDebugOption.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t3310DB443CEB5017520D394DF4591422 /* YYTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0947A3D41E9D2B824982C78036F0B2 /* YYTextLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t33DC45D7711D143E7932F12BE6FD01F2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 39B43C3BEB549D33EBF05644C843BC8E /* Foundation.framework */; };\n\t\t3FEE6384B1017CC5302262EDF47C67D6 /* YYTextKeyboardManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 829FCF03CF44A96D57DC7774A4EE754C /* YYTextKeyboardManager.m */; };\n\t\t444FAC2E09F2BF487C09F3138CB96EB1 /* YYTextRubyAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C133748ACFF0B6F6499D527EA256A62 /* YYTextRubyAnnotation.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t4D2BDD849138452501632B46D0052BCE /* YYTextLine.h in Headers */ = {isa = PBXBuildFile; fileRef = FA5E19F68EF8D81BBCC773A1BB4DC21F /* YYTextLine.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t50690624AF1B0866A02DD5331EA777CB /* YYTextSelectionView.h in Headers */ = {isa = PBXBuildFile; fileRef = E15B497A9232AE2CD27FD24AB1814AA8 /* YYTextSelectionView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t593C31642EB98095349DC24846F20162 /* YYTextArchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = D4EF814FB77CD4829BE59D69C5492F7F /* YYTextArchiver.m */; };\n\t\t6231B23CFB58D36F06E6D872A4ECEEF4 /* YYLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = EAFB3296A5C0D946E120F53E34E1C290 /* YYLabel.m */; };\n\t\t63FE20962D315F65EA36B8F7B6062A3F /* YYTextSelectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 26B42061C482C7295B30B15437A5A8F8 /* YYTextSelectionView.m */; };\n\t\t7E46DCC112FE5FAFF09E567024D0E785 /* YYText-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = CFA335A1C4EB415A295303E2F2A1CB0B /* YYText-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t7FC5E7FFBF6287BA8CB90661AAD96749 /* UIView+YYText.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C0A97AD6F0947735C1C8960BC1ECAB7 /* UIView+YYText.m */; };\n\t\t7FF6F7E9EE94DAE7477618CEF7D91C2A /* NSParagraphStyle+YYText.m in Sources */ = {isa = PBXBuildFile; fileRef = 81A85516FDD2182A885F0CD7A81526D9 /* NSParagraphStyle+YYText.m */; };\n\t\t8312E762C6B7E7F129314EDD18CD29FA /* YYTextRunDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0C8A542AFB1388D76BB45DFA7E536B /* YYTextRunDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8866B411055FB6BA57693E17B67E4BD1 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FED0A724E20FD13FC179CE1EB7E523F /* CoreText.framework */; };\n\t\t8CE29B76A7D49DF1D4A7BF5A120F001C /* YYTextTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = D82B4D11EEEAD1DA264D4A142484B92E /* YYTextTransaction.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\t8D1E6137991E7E64F4D65C0EAA2681B0 /* YYTextLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 6DE855E37C567CF505A8C5CC96D4E8AD /* YYTextLayout.m */; };\n\t\t8F9FAF1E570F5CB6AC3DFE6399473DD1 /* NSAttributedString+YYText.m in Sources */ = {isa = PBXBuildFile; fileRef = 59959E1EF0750FDFC431775254C5454C /* NSAttributedString+YYText.m */; };\n\t\t91E4EF4C2969FAC922CE6AF391857874 /* YYTextTransaction.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A2567A3677D9D8631F863C0925FD9C8 /* YYTextTransaction.m */; };\n\t\t96381F7A177D7E3FE00D47DDA303A7AB /* YYTextAsyncLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EAD9944FA5131C33E1BCB987AE79934 /* YYTextAsyncLayer.m */; };\n\t\tA2E4C858C12E37E52C1DA588A618586A /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AFB2C28A64111C57042E2D9FE952F693 /* CoreFoundation.framework */; };\n\t\tA7041FD223FA92306B5E92F4679A6EB8 /* YYTextInput.h in Headers */ = {isa = PBXBuildFile; fileRef = BF0363AFD3D92B1CC8BECC9AAEF130CD /* YYTextInput.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA8760AF5944948E09CB4186B559B0A04 /* YYTextMagnifier.h in Headers */ = {isa = PBXBuildFile; fileRef = B9F38E61491EB0D7B96FF92FADD72FE6 /* YYTextMagnifier.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tA9EA2A1104C82A2DFBE81ABB2983F27A /* YYTextDebugOption.m in Sources */ = {isa = PBXBuildFile; fileRef = B0669217599AF74440A6ACCC921CF36E /* YYTextDebugOption.m */; };\n\t\tB408D43F26FE75493293DE3B6B8DA92E /* YYTextContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B888C2D12359A72A5CD926A3E04FD34 /* YYTextContainerView.m */; };\n\t\tB4BC227B4275A93CDD2C1E4108E9E931 /* YYTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = B1FB13873EB50D90C8CE174D2D070056 /* YYTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tB54C3C77D8C8F2D3B9FC7C66F98D6FBB /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 098B390F162048CFAE9DD7BF42A0E01F /* Accelerate.framework */; };\n\t\tC7C1B36B888F2281E42BA5CE9E6E09C8 /* NSParagraphStyle+YYText.h in Headers */ = {isa = PBXBuildFile; fileRef = C973B3EC785C2C0410DBC400A743F47D /* NSParagraphStyle+YYText.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCB3ED258AC303ADC864A2A3E2ADF8F75 /* YYTextEffectWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 76BF7FFFABDB6F95C9CAC3B33C893A98 /* YYTextEffectWindow.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCD8418D8E742D471F434CF45641B8ECF /* UIPasteboard+YYText.h in Headers */ = {isa = PBXBuildFile; fileRef = 80CE847381671F25F7DF67225F0BADFB /* UIPasteboard+YYText.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tCEF6E35EDC546586498EC130FE00DB5E /* YYTextWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = C74F5F3B665CA86B4E22743952AF20DF /* YYTextWeakProxy.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD1883925F5919EBE5315CE5FA76261FA /* YYLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4681E427A7083B09BEEA7631CA87C61D /* YYLabel.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tD62C15E1FD4BC1CBE1103AAEE03D6854 /* YYTextMagnifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E7B641CA8E9F8E03C9222E573A48CE9 /* YYTextMagnifier.m */; };\n\t\tD97E33EB3A11DF8AB97FC904480EA718 /* YYTextRubyAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = C5EE6D96ECAFEE346A28EAC4B34DD793 /* YYTextRubyAnnotation.m */; };\n\t\tD9E01320B98261F101D3BAA7D241EA84 /* YYTextWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = F418614510051E83DFEAD090156424B6 /* YYTextWeakProxy.m */; };\n\t\tDD31E6E803180F304C90F0B52CFAAC3C /* YYTextKeyboardManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 98171459E8F6544D9360328CBA8D97DE /* YYTextKeyboardManager.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tE070DAE7A172371167497289B9FFA7E0 /* YYTextInput.m in Sources */ = {isa = PBXBuildFile; fileRef = 8AC3DEF93A603A750A1F5F726CD91E67 /* YYTextInput.m */; };\n\t\tE28DA9FAE792C17C58CCFE8A06611F35 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2BEB0220285ED5B9F69089C4260D2AD /* MobileCoreServices.framework */; };\n\t\tE51E85A77CE27DDB88A2DD50447D1362 /* YYText.h in Headers */ = {isa = PBXBuildFile; fileRef = 91F761E63083D63702C1919989298978 /* YYText.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tEC3D386D6732654E92240B493008AF62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DECB12D55A25DF9C77A1F6FFB4810662 /* UIKit.framework */; };\n\t\tF10932438E07BE3D594DA88E51C8D8DA /* YYTextUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = C63243CB4549A25D77D9AEDC9EFFEAC4 /* YYTextUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };\n\t\tF20542B593B2DB685F1AFF4BE26E6FC8 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 087DFF3C883D1323D43AF5ED7A8F27EF /* QuartzCore.framework */; };\n\t\tFE061D7E6A93C3185376D71B67BE0004 /* YYTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8F1517186E257C1528F6AE22318DDF5 /* YYTextView.m */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t087DFF3C883D1323D43AF5ED7A8F27EF /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };\n\t\t098B390F162048CFAE9DD7BF42A0E01F /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; };\n\t\t0F0947A3D41E9D2B824982C78036F0B2 /* YYTextLayout.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextLayout.h; path = YYText/Component/YYTextLayout.h; sourceTree = \"<group>\"; };\n\t\t24648642BC969D4C67FCB162BA7103CE /* YYText.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = YYText.modulemap; sourceTree = \"<group>\"; };\n\t\t26B42061C482C7295B30B15437A5A8F8 /* YYTextSelectionView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextSelectionView.m; path = YYText/Component/YYTextSelectionView.m; sourceTree = \"<group>\"; };\n\t\t2C0A97AD6F0947735C1C8960BC1ECAB7 /* UIView+YYText.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIView+YYText.m\"; path = \"YYText/Utility/UIView+YYText.m\"; sourceTree = \"<group>\"; };\n\t\t327E6ABBC60E9D776DB6462C1030E02B /* YYTextParser.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextParser.h; path = YYText/String/YYTextParser.h; sourceTree = \"<group>\"; };\n\t\t337FECF2A87882CD8C6585E0C6FAA075 /* YYTextUtilities.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextUtilities.m; path = YYText/Utility/YYTextUtilities.m; sourceTree = \"<group>\"; };\n\t\t340B803F01390CC099F517470F59BF3C /* UIView+YYText.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIView+YYText.h\"; path = \"YYText/Utility/UIView+YYText.h\"; sourceTree = \"<group>\"; };\n\t\t39B43C3BEB549D33EBF05644C843BC8E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\t3BEF0F7A4940B710C27B4489C2905631 /* YYTextDebugOption.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextDebugOption.h; path = YYText/Component/YYTextDebugOption.h; sourceTree = \"<group>\"; };\n\t\t4681E427A7083B09BEEA7631CA87C61D /* YYLabel.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYLabel.h; path = YYText/YYLabel.h; sourceTree = \"<group>\"; };\n\t\t4E7B641CA8E9F8E03C9222E573A48CE9 /* YYTextMagnifier.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextMagnifier.m; path = YYText/Component/YYTextMagnifier.m; sourceTree = \"<group>\"; };\n\t\t59959E1EF0750FDFC431775254C5454C /* NSAttributedString+YYText.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSAttributedString+YYText.m\"; path = \"YYText/Utility/NSAttributedString+YYText.m\"; sourceTree = \"<group>\"; };\n\t\t5C133748ACFF0B6F6499D527EA256A62 /* YYTextRubyAnnotation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextRubyAnnotation.h; path = YYText/String/YYTextRubyAnnotation.h; sourceTree = \"<group>\"; };\n\t\t621E4446161A6F8320C71B5C44F1F8F0 /* UIPasteboard+YYText.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"UIPasteboard+YYText.m\"; path = \"YYText/Utility/UIPasteboard+YYText.m\"; sourceTree = \"<group>\"; };\n\t\t67C5B2BA6D69A2DC27B68CE328A5AD3E /* YYTextAttribute.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextAttribute.h; path = YYText/String/YYTextAttribute.h; sourceTree = \"<group>\"; };\n\t\t6A2567A3677D9D8631F863C0925FD9C8 /* YYTextTransaction.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextTransaction.m; path = YYText/Utility/YYTextTransaction.m; sourceTree = \"<group>\"; };\n\t\t6DE855E37C567CF505A8C5CC96D4E8AD /* YYTextLayout.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextLayout.m; path = YYText/Component/YYTextLayout.m; sourceTree = \"<group>\"; };\n\t\t6EAD9944FA5131C33E1BCB987AE79934 /* YYTextAsyncLayer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextAsyncLayer.m; path = YYText/Utility/YYTextAsyncLayer.m; sourceTree = \"<group>\"; };\n\t\t76BF7FFFABDB6F95C9CAC3B33C893A98 /* YYTextEffectWindow.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextEffectWindow.h; path = YYText/Component/YYTextEffectWindow.h; sourceTree = \"<group>\"; };\n\t\t796546A8B56B82F7D05AA2D2B393C2A0 /* YYTextArchiver.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextArchiver.h; path = YYText/String/YYTextArchiver.h; sourceTree = \"<group>\"; };\n\t\t7D17B9F0A61C384F453BE66979AC07F9 /* NSAttributedString+YYText.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSAttributedString+YYText.h\"; path = \"YYText/Utility/NSAttributedString+YYText.h\"; sourceTree = \"<group>\"; };\n\t\t7E04542958FD7C9B7FF5CFEF1F8AB6DC /* YYText-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = \"YYText-dummy.m\"; sourceTree = \"<group>\"; };\n\t\t80CE847381671F25F7DF67225F0BADFB /* UIPasteboard+YYText.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"UIPasteboard+YYText.h\"; path = \"YYText/Utility/UIPasteboard+YYText.h\"; sourceTree = \"<group>\"; };\n\t\t81A85516FDD2182A885F0CD7A81526D9 /* NSParagraphStyle+YYText.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = \"NSParagraphStyle+YYText.m\"; path = \"YYText/Utility/NSParagraphStyle+YYText.m\"; sourceTree = \"<group>\"; };\n\t\t829FCF03CF44A96D57DC7774A4EE754C /* YYTextKeyboardManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextKeyboardManager.m; path = YYText/Component/YYTextKeyboardManager.m; sourceTree = \"<group>\"; };\n\t\t88A4F0EF84B291A15E2C68C3B87BD84B /* YYText-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"YYText-prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t8AC3DEF93A603A750A1F5F726CD91E67 /* YYTextInput.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextInput.m; path = YYText/Component/YYTextInput.m; sourceTree = \"<group>\"; };\n\t\t8CA9B8D3543FFE1270AD044364155A6D /* YYTextLine.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextLine.m; path = YYText/Component/YYTextLine.m; sourceTree = \"<group>\"; };\n\t\t91F761E63083D63702C1919989298978 /* YYText.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYText.h; path = YYText/YYText.h; sourceTree = \"<group>\"; };\n\t\t98171459E8F6544D9360328CBA8D97DE /* YYTextKeyboardManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextKeyboardManager.h; path = YYText/Component/YYTextKeyboardManager.h; sourceTree = \"<group>\"; };\n\t\t9B0C8A542AFB1388D76BB45DFA7E536B /* YYTextRunDelegate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextRunDelegate.h; path = YYText/String/YYTextRunDelegate.h; sourceTree = \"<group>\"; };\n\t\t9B888C2D12359A72A5CD926A3E04FD34 /* YYTextContainerView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextContainerView.m; path = YYText/Component/YYTextContainerView.m; sourceTree = \"<group>\"; };\n\t\t9FED0A724E20FD13FC179CE1EB7E523F /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; };\n\t\tA2339E6F9ED32D4B4E750BE76BACA7AF /* YYTextRunDelegate.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextRunDelegate.m; path = YYText/String/YYTextRunDelegate.m; sourceTree = \"<group>\"; };\n\t\tA881B46EAC10700DBC48206FA5E98BED /* YYTextParser.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextParser.m; path = YYText/String/YYTextParser.m; sourceTree = \"<group>\"; };\n\t\tA8F1517186E257C1528F6AE22318DDF5 /* YYTextView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextView.m; path = YYText/YYTextView.m; sourceTree = \"<group>\"; };\n\t\tAFB2C28A64111C57042E2D9FE952F693 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; };\n\t\tB0669217599AF74440A6ACCC921CF36E /* YYTextDebugOption.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextDebugOption.m; path = YYText/Component/YYTextDebugOption.m; sourceTree = \"<group>\"; };\n\t\tB1FB13873EB50D90C8CE174D2D070056 /* YYTextView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextView.h; path = YYText/YYTextView.h; sourceTree = \"<group>\"; };\n\t\tB2BEB0220285ED5B9F69089C4260D2AD /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = DEVELOPER_DIR; };\n\t\tB7BD0CDEBFD69B5E95C42F70D3293D53 /* YYTextAttribute.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextAttribute.m; path = YYText/String/YYTextAttribute.m; sourceTree = \"<group>\"; };\n\t\tB9F38E61491EB0D7B96FF92FADD72FE6 /* YYTextMagnifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextMagnifier.h; path = YYText/Component/YYTextMagnifier.h; sourceTree = \"<group>\"; };\n\t\tBF0363AFD3D92B1CC8BECC9AAEF130CD /* YYTextInput.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextInput.h; path = YYText/Component/YYTextInput.h; sourceTree = \"<group>\"; };\n\t\tC5EE6D96ECAFEE346A28EAC4B34DD793 /* YYTextRubyAnnotation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextRubyAnnotation.m; path = YYText/String/YYTextRubyAnnotation.m; sourceTree = \"<group>\"; };\n\t\tC63243CB4549A25D77D9AEDC9EFFEAC4 /* YYTextUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextUtilities.h; path = YYText/Utility/YYTextUtilities.h; sourceTree = \"<group>\"; };\n\t\tC74F5F3B665CA86B4E22743952AF20DF /* YYTextWeakProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextWeakProxy.h; path = YYText/Utility/YYTextWeakProxy.h; sourceTree = \"<group>\"; };\n\t\tC973B3EC785C2C0410DBC400A743F47D /* NSParagraphStyle+YYText.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = \"NSParagraphStyle+YYText.h\"; path = \"YYText/Utility/NSParagraphStyle+YYText.h\"; sourceTree = \"<group>\"; };\n\t\tCFA335A1C4EB415A295303E2F2A1CB0B /* YYText-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = \"YYText-umbrella.h\"; sourceTree = \"<group>\"; };\n\t\tD3EA0E287763EE2C9C54B3283E5215EA /* YYText */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = YYText; path = YYText.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tD4EF814FB77CD4829BE59D69C5492F7F /* YYTextArchiver.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextArchiver.m; path = YYText/String/YYTextArchiver.m; sourceTree = \"<group>\"; };\n\t\tD82B4D11EEEAD1DA264D4A142484B92E /* YYTextTransaction.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextTransaction.h; path = YYText/Utility/YYTextTransaction.h; sourceTree = \"<group>\"; };\n\t\tDD2B53F753004E2376975D74D95A0133 /* YYTextAsyncLayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextAsyncLayer.h; path = YYText/Utility/YYTextAsyncLayer.h; sourceTree = \"<group>\"; };\n\t\tDECB12D55A25DF9C77A1F6FFB4810662 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };\n\t\tE15B497A9232AE2CD27FD24AB1814AA8 /* YYTextSelectionView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextSelectionView.h; path = YYText/Component/YYTextSelectionView.h; sourceTree = \"<group>\"; };\n\t\tE76B23A8484CF2E4A9BB9F42EEDD47E2 /* YYTextEffectWindow.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextEffectWindow.m; path = YYText/Component/YYTextEffectWindow.m; sourceTree = \"<group>\"; };\n\t\tE81FC1CBDF0781C399983F43C9947907 /* YYText.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = YYText.debug.xcconfig; sourceTree = \"<group>\"; };\n\t\tEAFB3296A5C0D946E120F53E34E1C290 /* YYLabel.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYLabel.m; path = YYText/YYLabel.m; sourceTree = \"<group>\"; };\n\t\tF2EAAF8FA3A32FBB19D55FDC009D57A9 /* YYTextContainerView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextContainerView.h; path = YYText/Component/YYTextContainerView.h; sourceTree = \"<group>\"; };\n\t\tF418614510051E83DFEAD090156424B6 /* YYTextWeakProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YYTextWeakProxy.m; path = YYText/Utility/YYTextWeakProxy.m; sourceTree = \"<group>\"; };\n\t\tFA5E19F68EF8D81BBCC773A1BB4DC21F /* YYTextLine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = YYTextLine.h; path = YYText/Component/YYTextLine.h; sourceTree = \"<group>\"; };\n\t\tFB3AA6ADC23FFDAFB990FD283E3742EC /* YYText.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = YYText.release.xcconfig; sourceTree = \"<group>\"; };\n\t\tFB73DCCF7CBBDC2BEEC24D29598F5DA6 /* YYText-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = \"YYText-Info.plist\"; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t56D4BC96E1D552A19058888CE16C0F8F /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tB54C3C77D8C8F2D3B9FC7C66F98D6FBB /* Accelerate.framework in Frameworks */,\n\t\t\t\tA2E4C858C12E37E52C1DA588A618586A /* CoreFoundation.framework in Frameworks */,\n\t\t\t\t8866B411055FB6BA57693E17B67E4BD1 /* CoreText.framework in Frameworks */,\n\t\t\t\t33DC45D7711D143E7932F12BE6FD01F2 /* Foundation.framework in Frameworks */,\n\t\t\t\tE28DA9FAE792C17C58CCFE8A06611F35 /* MobileCoreServices.framework in Frameworks */,\n\t\t\t\tF20542B593B2DB685F1AFF4BE26E6FC8 /* QuartzCore.framework in Frameworks */,\n\t\t\t\tEC3D386D6732654E92240B493008AF62 /* UIKit.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t31FA4DE5F6F4BDD36F46BECE3E00C51C /* Support Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t24648642BC969D4C67FCB162BA7103CE /* YYText.modulemap */,\n\t\t\t\t7E04542958FD7C9B7FF5CFEF1F8AB6DC /* YYText-dummy.m */,\n\t\t\t\tFB73DCCF7CBBDC2BEEC24D29598F5DA6 /* YYText-Info.plist */,\n\t\t\t\t88A4F0EF84B291A15E2C68C3B87BD84B /* YYText-prefix.pch */,\n\t\t\t\tCFA335A1C4EB415A295303E2F2A1CB0B /* YYText-umbrella.h */,\n\t\t\t\tE81FC1CBDF0781C399983F43C9947907 /* YYText.debug.xcconfig */,\n\t\t\t\tFB3AA6ADC23FFDAFB990FD283E3742EC /* YYText.release.xcconfig */,\n\t\t\t);\n\t\t\tname = \"Support Files\";\n\t\t\tpath = \"../Target Support Files/YYText\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8EF610A4EBF86B34989DD8CA1945B7E9 /* YYText */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t7D17B9F0A61C384F453BE66979AC07F9 /* NSAttributedString+YYText.h */,\n\t\t\t\t59959E1EF0750FDFC431775254C5454C /* NSAttributedString+YYText.m */,\n\t\t\t\tC973B3EC785C2C0410DBC400A743F47D /* NSParagraphStyle+YYText.h */,\n\t\t\t\t81A85516FDD2182A885F0CD7A81526D9 /* NSParagraphStyle+YYText.m */,\n\t\t\t\t80CE847381671F25F7DF67225F0BADFB /* UIPasteboard+YYText.h */,\n\t\t\t\t621E4446161A6F8320C71B5C44F1F8F0 /* UIPasteboard+YYText.m */,\n\t\t\t\t340B803F01390CC099F517470F59BF3C /* UIView+YYText.h */,\n\t\t\t\t2C0A97AD6F0947735C1C8960BC1ECAB7 /* UIView+YYText.m */,\n\t\t\t\t4681E427A7083B09BEEA7631CA87C61D /* YYLabel.h */,\n\t\t\t\tEAFB3296A5C0D946E120F53E34E1C290 /* YYLabel.m */,\n\t\t\t\t91F761E63083D63702C1919989298978 /* YYText.h */,\n\t\t\t\t796546A8B56B82F7D05AA2D2B393C2A0 /* YYTextArchiver.h */,\n\t\t\t\tD4EF814FB77CD4829BE59D69C5492F7F /* YYTextArchiver.m */,\n\t\t\t\tDD2B53F753004E2376975D74D95A0133 /* YYTextAsyncLayer.h */,\n\t\t\t\t6EAD9944FA5131C33E1BCB987AE79934 /* YYTextAsyncLayer.m */,\n\t\t\t\t67C5B2BA6D69A2DC27B68CE328A5AD3E /* YYTextAttribute.h */,\n\t\t\t\tB7BD0CDEBFD69B5E95C42F70D3293D53 /* YYTextAttribute.m */,\n\t\t\t\tF2EAAF8FA3A32FBB19D55FDC009D57A9 /* YYTextContainerView.h */,\n\t\t\t\t9B888C2D12359A72A5CD926A3E04FD34 /* YYTextContainerView.m */,\n\t\t\t\t3BEF0F7A4940B710C27B4489C2905631 /* YYTextDebugOption.h */,\n\t\t\t\tB0669217599AF74440A6ACCC921CF36E /* YYTextDebugOption.m */,\n\t\t\t\t76BF7FFFABDB6F95C9CAC3B33C893A98 /* YYTextEffectWindow.h */,\n\t\t\t\tE76B23A8484CF2E4A9BB9F42EEDD47E2 /* YYTextEffectWindow.m */,\n\t\t\t\tBF0363AFD3D92B1CC8BECC9AAEF130CD /* YYTextInput.h */,\n\t\t\t\t8AC3DEF93A603A750A1F5F726CD91E67 /* YYTextInput.m */,\n\t\t\t\t98171459E8F6544D9360328CBA8D97DE /* YYTextKeyboardManager.h */,\n\t\t\t\t829FCF03CF44A96D57DC7774A4EE754C /* YYTextKeyboardManager.m */,\n\t\t\t\t0F0947A3D41E9D2B824982C78036F0B2 /* YYTextLayout.h */,\n\t\t\t\t6DE855E37C567CF505A8C5CC96D4E8AD /* YYTextLayout.m */,\n\t\t\t\tFA5E19F68EF8D81BBCC773A1BB4DC21F /* YYTextLine.h */,\n\t\t\t\t8CA9B8D3543FFE1270AD044364155A6D /* YYTextLine.m */,\n\t\t\t\tB9F38E61491EB0D7B96FF92FADD72FE6 /* YYTextMagnifier.h */,\n\t\t\t\t4E7B641CA8E9F8E03C9222E573A48CE9 /* YYTextMagnifier.m */,\n\t\t\t\t327E6ABBC60E9D776DB6462C1030E02B /* YYTextParser.h */,\n\t\t\t\tA881B46EAC10700DBC48206FA5E98BED /* YYTextParser.m */,\n\t\t\t\t5C133748ACFF0B6F6499D527EA256A62 /* YYTextRubyAnnotation.h */,\n\t\t\t\tC5EE6D96ECAFEE346A28EAC4B34DD793 /* YYTextRubyAnnotation.m */,\n\t\t\t\t9B0C8A542AFB1388D76BB45DFA7E536B /* YYTextRunDelegate.h */,\n\t\t\t\tA2339E6F9ED32D4B4E750BE76BACA7AF /* YYTextRunDelegate.m */,\n\t\t\t\tE15B497A9232AE2CD27FD24AB1814AA8 /* YYTextSelectionView.h */,\n\t\t\t\t26B42061C482C7295B30B15437A5A8F8 /* YYTextSelectionView.m */,\n\t\t\t\tD82B4D11EEEAD1DA264D4A142484B92E /* YYTextTransaction.h */,\n\t\t\t\t6A2567A3677D9D8631F863C0925FD9C8 /* YYTextTransaction.m */,\n\t\t\t\tC63243CB4549A25D77D9AEDC9EFFEAC4 /* YYTextUtilities.h */,\n\t\t\t\t337FECF2A87882CD8C6585E0C6FAA075 /* YYTextUtilities.m */,\n\t\t\t\tB1FB13873EB50D90C8CE174D2D070056 /* YYTextView.h */,\n\t\t\t\tA8F1517186E257C1528F6AE22318DDF5 /* YYTextView.m */,\n\t\t\t\tC74F5F3B665CA86B4E22743952AF20DF /* YYTextWeakProxy.h */,\n\t\t\t\tF418614510051E83DFEAD090156424B6 /* YYTextWeakProxy.m */,\n\t\t\t\t31FA4DE5F6F4BDD36F46BECE3E00C51C /* Support Files */,\n\t\t\t);\n\t\t\tname = YYText;\n\t\t\tpath = YYText;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tB104F4149483DB7838826CDA0BDCD0D7 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF5AE3400638AC1A58017B7DF0F06A3F4 /* Frameworks */,\n\t\t\t\tDBE3DE77E5D0C869E26C8369DA0F2A09 /* Products */,\n\t\t\t\t8EF610A4EBF86B34989DD8CA1945B7E9 /* YYText */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDBE3DE77E5D0C869E26C8369DA0F2A09 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tD3EA0E287763EE2C9C54B3283E5215EA /* YYText */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tEBB0DF66B01CFA4D5987EB97465664BB /* iOS */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t098B390F162048CFAE9DD7BF42A0E01F /* Accelerate.framework */,\n\t\t\t\tAFB2C28A64111C57042E2D9FE952F693 /* CoreFoundation.framework */,\n\t\t\t\t9FED0A724E20FD13FC179CE1EB7E523F /* CoreText.framework */,\n\t\t\t\t39B43C3BEB549D33EBF05644C843BC8E /* Foundation.framework */,\n\t\t\t\tB2BEB0220285ED5B9F69089C4260D2AD /* MobileCoreServices.framework */,\n\t\t\t\t087DFF3C883D1323D43AF5ED7A8F27EF /* QuartzCore.framework */,\n\t\t\t\tDECB12D55A25DF9C77A1F6FFB4810662 /* UIKit.framework */,\n\t\t\t);\n\t\t\tname = iOS;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tF5AE3400638AC1A58017B7DF0F06A3F4 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tEBB0DF66B01CFA4D5987EB97465664BB /* iOS */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\tA8BC2963D6B86939785481EF45528F7A /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t0B090EDF6254A18997B7835635366CFA /* NSAttributedString+YYText.h in Headers */,\n\t\t\t\tC7C1B36B888F2281E42BA5CE9E6E09C8 /* NSParagraphStyle+YYText.h in Headers */,\n\t\t\t\tCD8418D8E742D471F434CF45641B8ECF /* UIPasteboard+YYText.h in Headers */,\n\t\t\t\t228E1208734C2446B8C64885A1895A6A /* UIView+YYText.h in Headers */,\n\t\t\t\tD1883925F5919EBE5315CE5FA76261FA /* YYLabel.h in Headers */,\n\t\t\t\tE51E85A77CE27DDB88A2DD50447D1362 /* YYText.h in Headers */,\n\t\t\t\t7E46DCC112FE5FAFF09E567024D0E785 /* YYText-umbrella.h in Headers */,\n\t\t\t\t08A253F37EF044645F549ABCC58984D3 /* YYTextArchiver.h in Headers */,\n\t\t\t\t1E00A2014AD5ED4519727E36008B8454 /* YYTextAsyncLayer.h in Headers */,\n\t\t\t\t29E5EEC2A75F884A486CC0435D449542 /* YYTextAttribute.h in Headers */,\n\t\t\t\t2465E6FDA599BABD8B029EFEAFFAD440 /* YYTextContainerView.h in Headers */,\n\t\t\t\t2B62668EB828FDC83925FF8C48D4ABA7 /* YYTextDebugOption.h in Headers */,\n\t\t\t\tCB3ED258AC303ADC864A2A3E2ADF8F75 /* YYTextEffectWindow.h in Headers */,\n\t\t\t\tA7041FD223FA92306B5E92F4679A6EB8 /* YYTextInput.h in Headers */,\n\t\t\t\tDD31E6E803180F304C90F0B52CFAAC3C /* YYTextKeyboardManager.h in Headers */,\n\t\t\t\t3310DB443CEB5017520D394DF4591422 /* YYTextLayout.h in Headers */,\n\t\t\t\t4D2BDD849138452501632B46D0052BCE /* YYTextLine.h in Headers */,\n\t\t\t\tA8760AF5944948E09CB4186B559B0A04 /* YYTextMagnifier.h in Headers */,\n\t\t\t\t07A0F7A09509A157004C838AF6D2123D /* YYTextParser.h in Headers */,\n\t\t\t\t444FAC2E09F2BF487C09F3138CB96EB1 /* YYTextRubyAnnotation.h in Headers */,\n\t\t\t\t8312E762C6B7E7F129314EDD18CD29FA /* YYTextRunDelegate.h in Headers */,\n\t\t\t\t50690624AF1B0866A02DD5331EA777CB /* YYTextSelectionView.h in Headers */,\n\t\t\t\t8CE29B76A7D49DF1D4A7BF5A120F001C /* YYTextTransaction.h in Headers */,\n\t\t\t\tF10932438E07BE3D594DA88E51C8D8DA /* YYTextUtilities.h in Headers */,\n\t\t\t\tB4BC227B4275A93CDD2C1E4108E9E931 /* YYTextView.h in Headers */,\n\t\t\t\tCEF6E35EDC546586498EC130FE00DB5E /* YYTextWeakProxy.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t40E4DD13C21C218AB8CF84FBB29F3285 /* YYText */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 1C52BA24BE02B2F72913381F5FCFC131 /* Build configuration list for PBXNativeTarget \"YYText\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tA8BC2963D6B86939785481EF45528F7A /* Headers */,\n\t\t\t\t0219D4B5728B41F2800794BA3CF5B14A /* Sources */,\n\t\t\t\t56D4BC96E1D552A19058888CE16C0F8F /* Frameworks */,\n\t\t\t\tC61FC957B94681B3EF0D4137401D4EC3 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = YYText;\n\t\t\tproductName = YYText;\n\t\t\tproductReference = D3EA0E287763EE2C9C54B3283E5215EA /* YYText */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t119F75E86BE1576E3687B272C2D7534D /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 1500;\n\t\t\t\tLastUpgradeCheck = 1500;\n\t\t\t};\n\t\t\tbuildConfigurationList = 3DE24A83FEDA69BCD596EAFA252F431A /* Build configuration list for PBXProject \"YYText\" */;\n\t\t\tcompatibilityVersion = \"Xcode 9.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\tBase,\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = B104F4149483DB7838826CDA0BDCD0D7;\n\t\t\tproductRefGroup = DBE3DE77E5D0C869E26C8369DA0F2A09 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t40E4DD13C21C218AB8CF84FBB29F3285 /* YYText */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\tC61FC957B94681B3EF0D4137401D4EC3 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t0219D4B5728B41F2800794BA3CF5B14A /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t8F9FAF1E570F5CB6AC3DFE6399473DD1 /* NSAttributedString+YYText.m in Sources */,\n\t\t\t\t7FF6F7E9EE94DAE7477618CEF7D91C2A /* NSParagraphStyle+YYText.m in Sources */,\n\t\t\t\t1636438A74114B75838484D22D73DAA1 /* UIPasteboard+YYText.m in Sources */,\n\t\t\t\t7FC5E7FFBF6287BA8CB90661AAD96749 /* UIView+YYText.m in Sources */,\n\t\t\t\t6231B23CFB58D36F06E6D872A4ECEEF4 /* YYLabel.m in Sources */,\n\t\t\t\t08F1F51040FFBC92D3C2ADB5AA4C3BD2 /* YYText-dummy.m in Sources */,\n\t\t\t\t593C31642EB98095349DC24846F20162 /* YYTextArchiver.m in Sources */,\n\t\t\t\t96381F7A177D7E3FE00D47DDA303A7AB /* YYTextAsyncLayer.m in Sources */,\n\t\t\t\t28F8B0C5DDF5343B3F29F0880028C310 /* YYTextAttribute.m in Sources */,\n\t\t\t\tB408D43F26FE75493293DE3B6B8DA92E /* YYTextContainerView.m in Sources */,\n\t\t\t\tA9EA2A1104C82A2DFBE81ABB2983F27A /* YYTextDebugOption.m in Sources */,\n\t\t\t\t15582D1E53AAFD824381CCC537712B48 /* YYTextEffectWindow.m in Sources */,\n\t\t\t\tE070DAE7A172371167497289B9FFA7E0 /* YYTextInput.m in Sources */,\n\t\t\t\t3FEE6384B1017CC5302262EDF47C67D6 /* YYTextKeyboardManager.m in Sources */,\n\t\t\t\t8D1E6137991E7E64F4D65C0EAA2681B0 /* YYTextLayout.m in Sources */,\n\t\t\t\t1E96E3A9B36DC28CAC14CCA511F2D745 /* YYTextLine.m in Sources */,\n\t\t\t\tD62C15E1FD4BC1CBE1103AAEE03D6854 /* YYTextMagnifier.m in Sources */,\n\t\t\t\t0F2BD5A8CD86854D2240ED5773A3CFFE /* YYTextParser.m in Sources */,\n\t\t\t\tD97E33EB3A11DF8AB97FC904480EA718 /* YYTextRubyAnnotation.m in Sources */,\n\t\t\t\t2B1A45DB41565D931682C2A600FCB075 /* YYTextRunDelegate.m in Sources */,\n\t\t\t\t63FE20962D315F65EA36B8F7B6062A3F /* YYTextSelectionView.m in Sources */,\n\t\t\t\t91E4EF4C2969FAC922CE6AF391857874 /* YYTextTransaction.m in Sources */,\n\t\t\t\t0961D20AC156A03A743AA9ACE8BA862B /* YYTextUtilities.m in Sources */,\n\t\t\t\tFE061D7E6A93C3185376D71B67BE0004 /* YYTextView.m in Sources */,\n\t\t\t\tD9E01320B98261F101D3BAA7D241EA84 /* YYTextWeakProxy.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t26E150DC887BD73AA5740EF597B0CB71 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = FB3AA6ADC23FFDAFB990FD283E3742EC /* YYText.release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/YYText/YYText-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/YYText/YYText-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/YYText/YYText.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = YYText;\n\t\t\t\tPRODUCT_NAME = YYText;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t3C74ABE32785BA9BE1CCEBA31A48C1AC /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_RELEASE=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_COMPILATION_MODE = wholemodule;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-O\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tD664597785B000CB4929A4800833E53E /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = E81FC1CBDF0781C399983F43C9947907 /* YYText.debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tGCC_PREFIX_HEADER = \"Target Support Files/YYText/YYText-prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"Target Support Files/YYText/YYText-Info.plist\";\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"@executable_path/Frameworks\",\n\t\t\t\t\t\"@loader_path/Frameworks\",\n\t\t\t\t);\n\t\t\t\tMODULEMAP_FILE = \"Target Support Files/YYText/YYText.modulemap\";\n\t\t\t\tPRODUCT_MODULE_NAME = YYText;\n\t\t\t\tPRODUCT_NAME = YYText;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = \"$(inherited) \";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tD7AF8293FBD0AD78100B6510528FA768 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"POD_CONFIGURATION_DEBUG=1\",\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\n\t\t\t\tMTL_FAST_MATH = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSTRIP_INSTALLED_PRODUCT = NO;\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tSYMROOT = \"${SRCROOT}/../build\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t1C52BA24BE02B2F72913381F5FCFC131 /* Build configuration list for PBXNativeTarget \"YYText\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD664597785B000CB4929A4800833E53E /* Debug */,\n\t\t\t\t26E150DC887BD73AA5740EF597B0CB71 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t3DE24A83FEDA69BCD596EAFA252F431A /* Build configuration list for PBXProject \"YYText\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tD7AF8293FBD0AD78100B6510528FA768 /* Debug */,\n\t\t\t\t3C74ABE32785BA9BE1CCEBA31A48C1AC /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 119F75E86BE1576E3687B272C2D7534D /* Project object */;\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2022 iOS.Jett\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "<div align=center><img src=\"ScreenShot/JetChatSmall.png\" width=\"914\" height=\"162\" /></div>\n\n# JetChat\nSwift5.0编写的简仿微信聊天应用，完美支持表情键盘、单聊、群聊、本地消息会话缓存、朋友圈、白天和黑夜主题模式<br>\n \n[![platform](https://img.shields.io/badge/platform-iOS-blue.svg?style=plastic)](#)\n[![languages](https://img.shields.io/badge/language-swift-blue.svg)](#) \n[![support](https://img.shields.io/badge/support-ios12-blue.svg)](#) \n\n ### Examples\n| 聊天 | 朋友圈 |\n| -- | -- |\n|![image](https://github.com/developerjet/JetChat/blob/master/ScreenShot/JetChat.gif)|![image](https://github.com/developerjet/JetChat/blob/master/ScreenShot/Moments.png)|\n\n| 夜间模式 | 白天模式 |\n| -- | -- |\n|![image](https://github.com/developerjet/JetChat/blob/master/ScreenShot/DarkTheme.png)|![image](https://github.com/developerjet/JetChat/blob/master/ScreenShot/LightTheme.png)|\n\n### 主要技术运用\n- 聊天功能采用RxSwift+MVVM响应式架构设计，通过ViewModel合理过渡处理消息数据，减轻Controller层业务计算\n- UITableView+FDTemplateLayoutCell实现cell高度自适应计算和缓存，提高列表滑动顺滑\n- WCDBSwift实现所有会话消息快速缓存\n- 基于IGList数据驱动，实现高帧率朋友圈列表滑动\n- RxTheme适配夜间模式并兼容iOS13跟随系统模式设置\n- SnapKit纯代码自动布局\n\n### 主要实现功能\n- 聊天室键盘控件封装处理，支持表情文字多行输入，支持iOS13\n- 用户：添加好友，添加群，用户备注名称修改，本地实时同步\n- 聊天：一对一单聊，一对多群聊，支持文字、视频、图片发送和转发，图片和视频浏览\n- 会话：最近聊天会话记录，并按照最近时间排序列表展示\n- 角标：单个会话未读消息数量展示，全部未读消息数量显示\n- 清除：单个消息删除，退出群，删除好友，消息会话角标清除，记录删除\n\n> 目前基础功能已完成，具体功能了解可以下载源码运行查看 https://github.com/developerjet/JetChat\n\n### 新增功能\n- 朋友圈：IGList实现高帧率朋友圈列表滑动\n- 黑夜模式：RxTheme实现白天和黑夜主题模式切换并兼容iOS13跟随系统模式设置\n- Widget：新增最近聊天小组件，Widget点击跳转聊天室[注意AppGroupsID配置]\n- 多语言切换：已新增英文翻译 \n\n### Tips\n- 如果您对该项目有更好的建议和优化方案或者需要新增什么有趣的功能，请在lssues提交.\n- Xcode15运行报错: SDK does not contain 'libarclite'，解决方案https://www.jianshu.com/p/6f3798d1de0e\n\n### Licensed under the [MIT licens](https://github.com/developerjet/JetChat/blob/master/LICENSE)\n- 如果你对该项目感兴趣或者对你有一些帮助，希望可以给我点个🌟Star🌟，非常感谢❤️<br>\n"
  }
]